@webority/ui-elements 0.147.0 → 0.149.0

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.
Files changed (96) hide show
  1. package/dist/WuiCommandPalette-Bfrbocu6.js +2 -0
  2. package/dist/{WuiCommentThread-B9bkBMIq.js → WuiCommentThread-Dx3vvBWp.js} +1 -1
  3. package/dist/{WuiContextMenu-BvDHn1cP.js → WuiContextMenu-KXD8TFfy.js} +1 -1
  4. package/dist/{WuiDatePicker-_h8R3HSU.js → WuiDatePicker-kEyyILbM.js} +2 -2
  5. package/dist/{WuiDateRange-BtkmxMSN.js → WuiDateRange-B05PsdJ3.js} +2 -2
  6. package/dist/{WuiHoverCard-sq6EZZYD.js → WuiHoverCard-Bqapy8Is.js} +1 -1
  7. package/dist/{WuiInlineEdit-CBw0bupF.js → WuiInlineEdit-BqgKfVMy.js} +1 -1
  8. package/dist/{WuiMentionInput-9iC7Tur2.js → WuiMentionInput-Bi3VQoKo.js} +1 -1
  9. package/dist/WuiNavigationMenu-DmH3waKW.js +1 -0
  10. package/dist/WuiNotificationCenter-DawJRGBc.js +1 -0
  11. package/dist/WuiOverflow-DP3qEbDp.js +1 -0
  12. package/dist/{WuiPhone-oEkvgH1D.js → WuiPhone-CFne_6XG.js} +2 -2
  13. package/dist/WuiSavedViews-BMBQUv2K.js +1 -0
  14. package/dist/WuiSelect-oSJPev4N.js +9 -0
  15. package/dist/WuiShortcuts-BEvFCIu9.js +1 -0
  16. package/dist/{WuiTimePicker-CLS7ahpd.js → WuiTimePicker-DqqZPv0T.js} +2 -2
  17. package/dist/{WuiTour-Cz_SaC60.js → WuiTour-B-V1PZnw.js} +1 -1
  18. package/dist/{WuiTree-BZaGfmr9.js → WuiTree-B3cnH1PG.js} +1 -1
  19. package/dist/WuiWhatsNew-B5jK2zwZ.js +1 -0
  20. package/dist/{anchorOverlay-CBMAnDUt.js → anchorOverlay-DDrc2k6y.js} +1 -1
  21. package/dist/{chips-CjCv74bk.js → chips-DbhCYoAp.js} +1 -1
  22. package/dist/drawerDiscard-D6YgF59q.js +1 -0
  23. package/dist/elements/command-palette.js +1 -1
  24. package/dist/elements/comment-thread.js +1 -1
  25. package/dist/elements/context-menu.js +1 -1
  26. package/dist/elements/date-range.js +1 -1
  27. package/dist/elements/datepicker.js +1 -1
  28. package/dist/elements/filter-popover.js +1 -1
  29. package/dist/elements/hover-card.js +1 -1
  30. package/dist/elements/inline-edit.js +1 -1
  31. package/dist/elements/kanban.js +1 -1
  32. package/dist/elements/mention-input.js +1 -1
  33. package/dist/elements/navigation-menu.js +1 -1
  34. package/dist/elements/notification-center.js +1 -1
  35. package/dist/elements/overflow.js +1 -1
  36. package/dist/elements/phone.js +1 -1
  37. package/dist/elements/saved-views.js +1 -1
  38. package/dist/elements/select.js +1 -1
  39. package/dist/elements/shortcuts.js +1 -1
  40. package/dist/elements/timepicker.js +1 -1
  41. package/dist/elements/tour.js +1 -1
  42. package/dist/elements/tree.js +1 -1
  43. package/dist/elements/whats-new.js +1 -1
  44. package/dist/filterPopover-DniNyLWI.js +1 -0
  45. package/dist/{kanban-D-ljbA4A.js → kanban-BtgxVDE-.js} +1 -1
  46. package/dist/loader-Dw3IkGM0.js +1 -0
  47. package/dist/recents-BzN7j9kV.js +1 -0
  48. package/dist/{search-rosjW6Tp.js → search-CdAH8NGK.js} +1 -1
  49. package/dist/server.js +1 -1
  50. package/dist/ui-calendar.global.js +1 -1
  51. package/dist/ui-calendar.js +1 -1
  52. package/dist/ui-elements/carousel.global.js +1 -1
  53. package/dist/ui-elements/code-block.global.js +1 -1
  54. package/dist/ui-elements/command-palette.global.js +2 -2
  55. package/dist/ui-elements/comment-thread.global.js +1 -1
  56. package/dist/ui-elements/consent-banner.global.js +1 -1
  57. package/dist/ui-elements/context-menu.global.js +1 -1
  58. package/dist/ui-elements/date-range.global.js +2 -2
  59. package/dist/ui-elements/drawer.global.js +1 -1
  60. package/dist/ui-elements/image-crop.global.js +1 -1
  61. package/dist/ui-elements/inline-edit.global.js +1 -1
  62. package/dist/ui-elements/kanban.global.js +1 -1
  63. package/dist/ui-elements/lead-popup.global.js +1 -1
  64. package/dist/ui-elements/lightbox.global.js +1 -1
  65. package/dist/ui-elements/markdown.global.js +1 -1
  66. package/dist/ui-elements/org-tree.global.js +1 -1
  67. package/dist/ui-elements/phone.global.js +2 -2
  68. package/dist/ui-elements/resizable.global.js +1 -1
  69. package/dist/ui-elements/saved-views.global.js +1 -1
  70. package/dist/ui-elements/select-chips.global.js +1 -1
  71. package/dist/ui-elements/select-recents.global.js +1 -0
  72. package/dist/ui-elements/select-search.global.js +1 -1
  73. package/dist/ui-elements/slider.global.js +1 -1
  74. package/dist/ui-elements/sortable.global.js +1 -1
  75. package/dist/ui-elements/status-icon.global.js +1 -1
  76. package/dist/ui-elements/timepicker.global.js +2 -2
  77. package/dist/ui-elements/tour.global.js +1 -1
  78. package/dist/ui-elements/tree.global.js +1 -1
  79. package/dist/ui-elements/wizard.global.js +1 -1
  80. package/dist/ui-elements.global.js +18 -18
  81. package/dist/ui-elements.js +1 -1
  82. package/dist/ui-tour.global.js +1 -1
  83. package/dist/wuiHttp-BuaTcumE.js +1 -0
  84. package/package.json +6 -6
  85. package/dist/WuiCommandPalette-Bk9UuXmZ.js +0 -2
  86. package/dist/WuiNavigationMenu-CGqTADvr.js +0 -1
  87. package/dist/WuiNotificationCenter-CClYbyQ2.js +0 -1
  88. package/dist/WuiOverflow-Bn68qgAQ.js +0 -1
  89. package/dist/WuiSavedViews-CQSrMJUb.js +0 -1
  90. package/dist/WuiSelect-BEhh06ZD.js +0 -9
  91. package/dist/WuiShortcuts-Cerbe67I.js +0 -1
  92. package/dist/WuiWhatsNew-Biolggw8.js +0 -1
  93. package/dist/drawerDiscard-YjDBwb2_.js +0 -1
  94. package/dist/filterPopover-DrwHiZiL.js +0 -1
  95. package/dist/loader-CVFmEPjv.js +0 -1
  96. package/dist/wuiHttp-DgnM7K2Q.js +0 -1
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-DV9IZZCu.js";import{i as t,n,r,t as i}from"../WuiCommentThread-B9bkBMIq.js";import"./mention-input.js";e(`wui-comment-thread`,t);export{i as COMMENT_INTENTS,n as COMMENT_REACTIONS,r as COMMENT_TEXT,t as WuiCommentThread};
1
+ import{n as e}from"../elementBase-DV9IZZCu.js";import{i as t,n,r,t as i}from"../WuiCommentThread-Dx3vvBWp.js";import"./mention-input.js";e(`wui-comment-thread`,t);export{i as COMMENT_INTENTS,n as COMMENT_REACTIONS,r as COMMENT_TEXT,t as WuiCommentThread};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-DV9IZZCu.js";import{t}from"../WuiContextMenu-BvDHn1cP.js";e(`wui-context-menu`,t);export{t as WuiContextMenu};
1
+ import{n as e}from"../elementBase-DV9IZZCu.js";import{t}from"../WuiContextMenu-KXD8TFfy.js";e(`wui-context-menu`,t);export{t as WuiContextMenu};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-DV9IZZCu.js";import{t}from"../WuiDateRange-BtkmxMSN.js";e(`wui-date-range`,t);export{t as WuiDateRange};
1
+ import{n as e}from"../elementBase-DV9IZZCu.js";import{t}from"../WuiDateRange-B05PsdJ3.js";e(`wui-date-range`,t);export{t as WuiDateRange};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-DV9IZZCu.js";import{t}from"../WuiDatePicker-_h8R3HSU.js";e(`wui-datepicker`,t);export{t as WuiDatePicker};
1
+ import{n as e}from"../elementBase-DV9IZZCu.js";import{t}from"../WuiDatePicker-kEyyILbM.js";e(`wui-datepicker`,t);export{t as WuiDatePicker};
@@ -1 +1 @@
1
- import{n as e,t}from"../filterPopover-DrwHiZiL.js";e();export{t as FILTER_POPOVER_MAX_CHIPS};
1
+ import{n as e,t}from"../filterPopover-DniNyLWI.js";e();export{t as FILTER_POPOVER_MAX_CHIPS};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-DV9IZZCu.js";import{t}from"../WuiHoverCard-sq6EZZYD.js";e(`wui-hover-card`,t);export{t as WuiHoverCard};
1
+ import{n as e}from"../elementBase-DV9IZZCu.js";import{t}from"../WuiHoverCard-Bqapy8Is.js";e(`wui-hover-card`,t);export{t as WuiHoverCard};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-DV9IZZCu.js";import{a as t,i as n,n as r,r as i,t as a}from"../WuiInlineEdit-CBw0bupF.js";e(`wui-inline-edit`,n);export{a as INLINE_EDIT_SAVED_MS,r as INLINE_EDIT_TEXT,i as INLINE_EDIT_TYPES,n as WuiInlineEdit,t as inlineEditText};
1
+ import{n as e}from"../elementBase-DV9IZZCu.js";import{a as t,i as n,n as r,r as i,t as a}from"../WuiInlineEdit-BqgKfVMy.js";e(`wui-inline-edit`,n);export{a as INLINE_EDIT_SAVED_MS,r as INLINE_EDIT_TEXT,i as INLINE_EDIT_TYPES,n as WuiInlineEdit,t as inlineEditText};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-DV9IZZCu.js";import{a as t,c as n,d as r,f as i,g as a,h as o,i as s,l as c,m as l,n as u,o as d,p as f,r as p,s as m,t as h,u as g}from"../kanban-D-ljbA4A.js";e(`wui-kanban`,n);export{h as KANBAN_DRAG_THRESHOLD_PX,u as KANBAN_LONG_PRESS_MS,p as KANBAN_PHONE_QUERY,s as KANBAN_STORAGE_PREFIX,t as KANBAN_SUMMARY_FORMATS,d as KANBAN_TEXT,m as KANBAN_TONES,n as WuiKanban,c as kanbanCardLabel,g as kanbanOverflow,r as kanbanStorageKey,i as kanbanSummaryFormat,f as kanbanVisibleLimit,l as readKanbanCollapsed,o as sumKanbanValues,a as writeKanbanCollapsed};
1
+ import{n as e}from"../elementBase-DV9IZZCu.js";import{a as t,c as n,d as r,f as i,g as a,h as o,i as s,l as c,m as l,n as u,o as d,p as f,r as p,s as m,t as h,u as g}from"../kanban-BtgxVDE-.js";e(`wui-kanban`,n);export{h as KANBAN_DRAG_THRESHOLD_PX,u as KANBAN_LONG_PRESS_MS,p as KANBAN_PHONE_QUERY,s as KANBAN_STORAGE_PREFIX,t as KANBAN_SUMMARY_FORMATS,d as KANBAN_TEXT,m as KANBAN_TONES,n as WuiKanban,c as kanbanCardLabel,g as kanbanOverflow,r as kanbanStorageKey,i as kanbanSummaryFormat,f as kanbanVisibleLimit,l as readKanbanCollapsed,o as sumKanbanValues,a as writeKanbanCollapsed};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-DV9IZZCu.js";import{a as t,c as n,i as r,l as i,n as a,o,r as s,s as c,t as l,u}from"../WuiMentionInput-9iC7Tur2.js";e(`wui-mention-input`,r);export{t as MENTION_ID_PATTERN,l as MENTION_MAX_QUERY,a as MENTION_MAX_RESULTS,s as MENTION_TEXT,r as WuiMentionInput,o as mentionLabel,c as mentionTextFromValue,n as mentionValueFromText,i as mentionedIds,u as parseMentionValue};
1
+ import{n as e}from"../elementBase-DV9IZZCu.js";import{a as t,c as n,i as r,l as i,n as a,o,r as s,s as c,t as l,u}from"../WuiMentionInput-Bi3VQoKo.js";e(`wui-mention-input`,r);export{t as MENTION_ID_PATTERN,l as MENTION_MAX_QUERY,a as MENTION_MAX_RESULTS,s as MENTION_TEXT,r as WuiMentionInput,o as mentionLabel,c as mentionTextFromValue,n as mentionValueFromText,i as mentionedIds,u as parseMentionValue};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-DV9IZZCu.js";import{t}from"../WuiNavigationMenu-CGqTADvr.js";e(`wui-navigation-menu`,t);export{t as WuiNavigationMenu};
1
+ import{n as e}from"../elementBase-DV9IZZCu.js";import{t}from"../WuiNavigationMenu-DmH3waKW.js";e(`wui-navigation-menu`,t);export{t as WuiNavigationMenu};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-DV9IZZCu.js";import{t}from"../WuiNotificationCenter-CClYbyQ2.js";e(`wui-notification-center`,t);export{t as WuiNotificationCenter};
1
+ import{n as e}from"../elementBase-DV9IZZCu.js";import{t}from"../WuiNotificationCenter-DawJRGBc.js";e(`wui-notification-center`,t);export{t as WuiNotificationCenter};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-DV9IZZCu.js";import{t}from"../WuiOverflow-Bn68qgAQ.js";e(`wui-overflow`,t);export{t as WuiOverflow};
1
+ import{n as e}from"../elementBase-DV9IZZCu.js";import{t}from"../WuiOverflow-DP3qEbDp.js";e(`wui-overflow`,t);export{t as WuiOverflow};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-DV9IZZCu.js";import{t}from"../WuiPhone-oEkvgH1D.js";e(`wui-phone`,t);export{t as WuiPhone};
1
+ import{n as e}from"../elementBase-DV9IZZCu.js";import{t}from"../WuiPhone-CFne_6XG.js";e(`wui-phone`,t);export{t as WuiPhone};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-DV9IZZCu.js";import{t}from"../WuiSavedViews-CQSrMJUb.js";e(`wui-saved-views`,t);export{t as WuiSavedViews};
1
+ import{n as e}from"../elementBase-DV9IZZCu.js";import{t}from"../WuiSavedViews-BMBQUv2K.js";e(`wui-saved-views`,t);export{t as WuiSavedViews};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-DV9IZZCu.js";import{t}from"../WuiSelect-BEhh06ZD.js";e(`wui-select`,t);export{t as WuiSelect};
1
+ import{n as e}from"../elementBase-DV9IZZCu.js";import{t}from"../WuiSelect-oSJPev4N.js";e(`wui-select`,t);export{t as WuiSelect};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-DV9IZZCu.js";import{t}from"../WuiShortcuts-Cerbe67I.js";e(`wui-shortcuts`,t);export{t as WuiShortcuts};
1
+ import{n as e}from"../elementBase-DV9IZZCu.js";import{t}from"../WuiShortcuts-BEvFCIu9.js";e(`wui-shortcuts`,t);export{t as WuiShortcuts};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-DV9IZZCu.js";import{t}from"../WuiTimePicker-CLS7ahpd.js";e(`wui-timepicker`,t);export{t as WuiTimePicker};
1
+ import{n as e}from"../elementBase-DV9IZZCu.js";import{t}from"../WuiTimePicker-DqqZPv0T.js";e(`wui-timepicker`,t);export{t as WuiTimePicker};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-DV9IZZCu.js";import{n as t,t as n}from"../WuiTour-Cz_SaC60.js";e(`wui-tour`,n);export{n as WuiTour,t as createLocalSeenStore};
1
+ import{n as e}from"../elementBase-DV9IZZCu.js";import{n as t,t as n}from"../WuiTour-B-V1PZnw.js";e(`wui-tour`,n);export{n as WuiTour,t as createLocalSeenStore};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-DV9IZZCu.js";import{t}from"../WuiTree-BZaGfmr9.js";e(`wui-tree`,t);export{t as WuiTree};
1
+ import{n as e}from"../elementBase-DV9IZZCu.js";import{t}from"../WuiTree-B3cnH1PG.js";e(`wui-tree`,t);export{t as WuiTree};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-DV9IZZCu.js";import{n as t,t as n}from"../WuiWhatsNew-Biolggw8.js";e(`wui-whats-new`,t);export{n as WHATS_NEW_READ_EVENT,t as WuiWhatsNew};
1
+ import{n as e}from"../elementBase-DV9IZZCu.js";import{n as t,t as n}from"../WuiWhatsNew-B5jK2zwZ.js";e(`wui-whats-new`,t);export{n as WHATS_NEW_READ_EVENT,t as WuiWhatsNew};
@@ -0,0 +1 @@
1
+ import{n as e,r as t,t as n}from"./anchorOverlay-DDrc2k6y.js";import{n as r,t as i}from"./elementBase-DV9IZZCu.js";import{d as a}from"./shortcutKeys-CvxSh3bV.js";var o=2,s=`wui-filter-popover-pinned`,c=`.wui-filter-popover-trigger`,l=`.wui-filter-popover-panel`,u=`.wui-filter-popover-head`,d=`input:not([type]),input[type="text"],input[type="search"]`,f=`a[href],button:not([disabled]),input:not([disabled]):not([type='hidden']),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex='-1'])`;function p(){try{return sessionStorage.getItem(s)===`1`}catch{return!1}}function m(e){try{e?sessionStorage.setItem(s,`1`):sessionStorage.removeItem(s)}catch{}}var h=class extends i{constructor(){super(),this._doc=null,this._timer=null,this._sticky=!1,this._inside=!1,this._pendingSubmit=!1,this._onEnter=e=>{e.pointerType!==`touch`&&e.pointerType!==`pen`&&(this._inside=!0,this._schedule(!0))},this._onLeave=e=>{e.pointerType!==`touch`&&e.pointerType!==`pen`&&(this._inside=!1,this._schedule(!1))},this._onClick=e=>{this._trigger?.contains(e.target)&&(this._clear(),this.isOpen&&this._sticky?this._close(!0):this._open(!0,e.detail===0))},this._onChange=e=>{let t=this._pin;e.target===t?(m(t.checked),t.checked?this._clear():this._schedule(!1)):e.target.closest?.(`wui-select[mode="multiple"], wui-select[mode="tag"]`)?.querySelector(`[aria-expanded="true"]`)?this._pendingSubmit=!0:this.closest(`form.wui-filter-form`)?.requestSubmit()},this._onListClose=()=>{this._pendingSubmit&&(this._pendingSubmit=!1,this.closest(`form.wui-filter-form`)?.requestSubmit())},this._onFocusOut=e=>{this.contains(e.relatedTarget)||this._schedule(!1)},this._onKeyDown=e=>{e.key===`Enter`&&this._panel?.contains(e.target)&&e.target.matches(d)&&(e.preventDefault(),this.closest(`form.wui-filter-form`)?.requestSubmit())},this._onShortcut=e=>{this.ownerDocument.querySelector(`wui-filter-popover`)===this&&a(e,{f:()=>this._open(!0,!0)})},this._onEscape=e=>{e.key===`Escape`&&this.isOpen&&this._close(!0)},this._onOutside=e=>{this.isOpen&&!e.composedPath().includes(this)&&this._close(!1)}}get isOpen(){let e=this._panel;return e?!e.hidden:!1}connectedCallback(){this._doc=this.ownerDocument,this.addEventListener(`pointerenter`,this._onEnter),this.addEventListener(`pointerleave`,this._onLeave),this.addEventListener(`click`,this._onClick),this.addEventListener(`change`,this._onChange),this.addEventListener(`focusout`,this._onFocusOut),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`wui-select:close`,this._onListClose),this._doc.addEventListener(`keydown`,this._onShortcut),p()&&this._pin&&(this._pin.checked=!0,this._open(!1,!1))}disconnectedCallback(){this._clear(),this.removeEventListener(`pointerenter`,this._onEnter),this.removeEventListener(`pointerleave`,this._onLeave),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`change`,this._onChange),this.removeEventListener(`focusout`,this._onFocusOut),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`wui-select:close`,this._onListClose),this._doc?.removeEventListener(`keydown`,this._onShortcut),this._doc?.removeEventListener(`keydown`,this._onEscape),this._doc?.removeEventListener(`click`,this._onOutside),t(this),this._doc=null}get _trigger(){return this.querySelector(c)}get _panel(){return this.querySelector(l)}get _pin(){return this.querySelector(`${u} input[type="checkbox"]`)}get _pinned(){return this._pin?.checked===!0}_clear(){this._timer!==null&&clearTimeout(this._timer),this._timer=null}_schedule(e){if(this._clear(),e){if(this.isOpen)return;this._timer=setTimeout(()=>{this._timer=null,this._open(!1,!1)},150)}else this.isOpen&&!this._stayOpen()&&(this._timer=setTimeout(()=>{this._timer=null,this._stayOpen()||this._close(!1)},400))}_stayOpen(){let e=this._panel;return e?this._pinned||this._inside||e.contains(this.ownerDocument.activeElement)||e.querySelector(`[aria-expanded="true"]`)!==null:!1}_open(t,n){this._clear();let r=this._panel,i=this._trigger;r&&i&&(this.isOpen?t&&(this._sticky=!0):(r.hidden=!1,i.setAttribute(`aria-expanded`,`true`),this._sticky=t,this._reposition(),e(this,()=>{this._triggerOutOfView()?this._close(!1):this._reposition()}),this._doc?.addEventListener(`keydown`,this._onEscape),this._doc?.addEventListener(`click`,this._onOutside)),n&&(r.querySelector(`.wui-filter-popover-grid`)?.querySelector(f)??r.querySelector(f))?.focus())}_close(e){if(this._clear(),!this.isOpen)return;let n=this._panel,r=n.contains(this.ownerDocument.activeElement);n.hidden=!0,this._trigger?.setAttribute(`aria-expanded`,`false`),this._sticky=!1,t(this),this._doc?.removeEventListener(`keydown`,this._onEscape),this._doc?.removeEventListener(`click`,this._onOutside),e&&r&&this._trigger?.focus()}_reposition(){this.isOpen&&this._trigger&&n(this._trigger,this._panel,{clampHeight:!0,alignEnd:!0})}_triggerOutOfView(){let e=this._trigger;if(!e||!this._doc?.elementFromPoint)return!1;let t=e.getBoundingClientRect();if(!t.width&&!t.height)return!1;let n=this._doc.elementFromPoint(t.left+t.width/2,t.top+t.height/2);return!n||!(e.contains(n)||this._panel?.contains(n))}};function g(){r(`wui-filter-popover`,h)}export{g as n,o as t};
@@ -1 +1 @@
1
- import{m as e,o as t}from"./formatters-Ba0CvsTs.js";import{n,t as r}from"./devWarn-DXdRWZs3.js";import{t as i}from"./elementBase-DV9IZZCu.js";import{l as a}from"./wuiHttp-DgnM7K2Q.js";var o=Object.freeze([`neutral`,`primary`,`info`,`success`,`warning`,`danger`]),s=Object.freeze([`number`,`currency`,`compact`]),c=`wui-kanban:`,l=`(max-width: 767.98px)`,u=400,d=6,f=Object.freeze({help:`Press Space to pick up the card. Use the Left and Right arrow keys to choose a column, then Space to drop it, or Escape to cancel.`,empty:`Nothing here`,collapse:e=>`Collapse ${e}`,expand:e=>`Expand ${e}`,lifted:(e,t)=>`Picked up ${e} in ${t}. Use the Left and Right arrow keys to choose a column.`,over:(e,t)=>`${e}, ${t===1?`1 card`:`${t} cards`}. Drop allowed.`,overSource:e=>`${e}, where the card started.`,overRefused:(e,t)=>`${e}. ${t}`,dropHere:(e,t)=>`Drop here to move ${e} to ${t}.`,refused:(e,t)=>`Cards in ${e} cannot move to ${t}.`,moved:(e,t)=>`Moved ${e} to ${t}.`,saving:(e,t)=>`Moving ${e} to ${t}.`,cancelled:e=>`${e} was not moved.`,rolledBack:(e,t)=>`${e} went back to ${t}.`,locked:e=>`${e} cannot be moved.`,more:e=>`Show ${e} more`,fewer:`Show fewer`,loadMore:e=>`Show more (${e})`,loading:`Loading…`,loadFailed:`More cards could not be loaded. Try again.`,swipeHint:`Swipe sideways or tap a column`,busy:`This card is still saving. Try again in a moment.`,failed:Object.freeze({forbidden:`You do not have permission to move this card.`,client:`This card could not be moved. Refresh the board and try again.`,validation:`This card could not be moved. Refresh the board and try again.`,server:`Something went wrong on our side, so the card went back. Try again in a moment.`,network:`Could not reach the server, so the card went back. Check your connection and try again.`})}),p=`[data-wui-column]`,m=`[data-wui-body]`,h=`[data-wui-card]`,g=`[data-wui-count]`,_=`[data-wui-summary]`,v=`[data-wui-empty]`,y=`[data-wui-drop-note]`,b=`[data-wui-live]`,x=`[data-wui-help]`,S=`[data-wui-switch]`,C=`[data-wui-scroller]`,w=`[data-wui-collapse]`,T=`[data-wui-more]`,E=`data-wui-visible-limit`,D=`data-wui-overflow`,O=`input, select, textarea, [contenteditable=""], [contenteditable="true"], [data-wui-no-drag]`,k=`[data-wui-load-more]`,A=`data-wui-more-url`,j=`data-wui-total`,M=`data-wui-unloaded`,N=48,P=16,F=160,I=e=>e.getAttribute(`data-wui-column`),L=e=>e.getAttribute(`data-wui-card`),R=e=>e.hidden||e.hasAttribute(`hidden`),z=e=>R(e)||e.hasAttribute(D);function B(e){if(e==null||e===``)return null;let t=typeof e==`number`?e:Number(e);if(!Number.isInteger(t)||t<1)throw TypeError(`Unsupported kanban visible limit "${String(e)}". Use a whole number of 1 or more.`);return t}function V(e,t,n,r){let i=/* @__PURE__ */ new Set;if(t==null||n)return i;let a=0;for(let n of e)r.has(n)||(a<t?a++:i.add(n));return i}function H(e){let t=(e.getAttribute(`aria-label`)||e.textContent||``).replace(/\s+/g,` `).trim();return t.length>80?`${t.slice(0,79)}…`:t||L(e)||`Card`}function U(e){return e?`${c}${e}`:null}function W(e,t=globalThis.localStorage){let n=U(e);if(!n||!t)return{};try{let e=JSON.parse(t.getItem(n)||`null`);return e&&typeof e.collapsed==`object`&&e.collapsed?e.collapsed:{}}catch{return{}}}function G(e,t,n,r=globalThis.localStorage){let i=U(e);if(!i||!r)return;let a={...W(e,r),[t]:!!n};try{r.setItem(i,JSON.stringify({collapsed:a}))}catch{}}function K(e,n){if(!s.includes(e))throw TypeError(`Unsupported kanban summary format "${String(e)}". Use ${s.join(`, `)}.`);if(n!=null&&n!==``&&!t.includes(n))throw TypeError(`Unsupported kanban summary unit "${String(n)}". Use ${t.join(`, `)}.`);return e===`currency`?{style:`currency`,unit:n||`rupees`}:e===`compact`?{style:`compact`,currency:`INR`,unit:n||`rupees`}:{style:`number`,decimals:0}}function q(e){let t=0;for(let n of e){if(n==null||n===``)continue;let e=typeof n==`number`?n:Number(n);Number.isFinite(e)&&(t+=e)}return t}var J=(e,t)=>{e&&window.WUI?.toast?.(e,{variant:t})},Y=class extends i{constructor(){super(),this._wired=!1,this._filter=null,this._expanded=/* @__PURE__ */ new Set,this._revealed=/* @__PURE__ */ new Set,this._press=null,this._drag=null,this._kbd=null,this._suppressClick=!1,this._observer=null,this._refreshQueued=!1,this._scrollTimer=0,this._onPointerMove=e=>this._pointerMove(e),this._onPointerUp=e=>this._pointerUp(e),this._onPointerCancel=()=>this._endPointer(!1),this._onDocKeyDown=e=>{e.key===`Escape`&&this._drag&&(e.preventDefault(),this._endPointer(!1))},this._onScroll=()=>{clearTimeout(this._scrollTimer),this._scrollTimer=setTimeout(()=>this._syncSwitcherFromScroll(),80)},this.addEventListener(`pointerdown`,e=>this._pointerDown(e)),this.addEventListener(`keydown`,e=>this._keyDown(e)),this.addEventListener(`click`,e=>this._click(e),!0),this.addEventListener(`scroll`,e=>this._loadOnScroll(e.target),!0),this.addEventListener(`dragstart`,e=>{e.target.closest?.(h)&&e.preventDefault()}),this.addEventListener(`touchmove`,e=>{this._drag&&e.preventDefault()},{passive:!1})}_controlled(){return this.hasAttribute(`controlled`)}connectedCallback(){if(!this._wired){this._wired=!0,this._scroller()?.addEventListener(`scroll`,this._onScroll,{passive:!0}),this._restoreCollapsed();for(let e of this._allCards())this._prepareCard(e);if(typeof MutationObserver==`function`){this._observer=new MutationObserver(e=>{for(let t of e)for(let e of t.addedNodes)e.nodeType===1&&e.matches(h)&&this._prepareCard(e);this._queueRefresh()});for(let e of this.querySelectorAll(m))this._observer.observe(e,{childList:!0})}this.refresh()}}disconnectedCallback(){this._endPointer(!1),this._observer?.disconnect(),this._observer=null,this._scroller()?.removeEventListener(`scroll`,this._onScroll),clearTimeout(this._scrollTimer),this._wired=!1}setFilter(e){if(e!=null&&typeof e!=`function`)throw TypeError(`wui-kanban setFilter: pass a function or null.`);if(this._filter=e,!e)for(let e of this._allCards())e.hidden=!1;this.refresh()}refresh(){if(this._controlled())return;this._refreshQueued=!1;let t=this._summaryFormat();for(let n of this._columns()){let r=I(n),i=B(n.getAttribute(E)),a=[],o=[];for(let e of this._cardsIn(n))this._filter&&(e.hidden=this._filter(e)===!1),R(e)?e.removeAttribute(D):(a.push(e),o.push(e.getAttribute(`data-wui-value`)));let s=this._expanded.has(r),c=V(a.map(L),i,s,this._revealed);for(let e of a)e.toggleAttribute(D,c.has(L(e)));let l=this._unloadedIn(n),u=String(a.length+l);for(let e of this._countsOf(n))e.textContent!==u&&(e.textContent=u);let d=n.querySelector(v);if(d&&(d.hidden=a.length>0),t){let r=n.querySelector(_);r&&(r.textContent=e(q(o),t))}let p=n.querySelector(T);if(p){p.hidden=i==null||(s?a.length<=i:c.size===0),p.setAttribute(`aria-expanded`,s?`true`:`false`);let e=s?f.fewer:f.more(c.size);p.textContent!==e&&(p.textContent=e)}let m=n.querySelector(k);if(m&&(m.hidden=l<=0,!n.hasAttribute(`data-wui-loading`))){m.disabled=!1;let e=f.loadMore(l);m.textContent!==e&&(m.textContent=e)}}}moveCard(e,t,n){let r=this._cardByKey(e);if(!r)throw Error(`wui-kanban moveCard: no card "${String(e)}" on this board.`);if(!this._columnByKey(t))throw Error(`wui-kanban moveCard: no column "${String(t)}" on this board.`);return this._commit(r,t,n)}_columns(){return[...this.querySelectorAll(p)]}_columnByKey(e){return this._columns().find(t=>I(t)===e)||null}_columnOf(e){return e.closest(p)}_titleOf(e){return(e.querySelector(`.wui-kanban-title`)?.textContent||I(e)||``).replace(/\s+/g,` `).trim()}_bodyOf(e){return e.querySelector(m)}_cardsIn(e){let t=this._bodyOf(e);return t?[...t.children].filter(e=>e.matches(h)):[]}_visibleCardsIn(e){return this._cardsIn(e).filter(e=>!z(e))}_allCards(){return[...this.querySelectorAll(`${m} > ${h}`)]}_cardByKey(e){return this._allCards().find(t=>L(t)===e)||null}_countsOf(e){let t=I(e),n=[...this.querySelectorAll(S)].filter(e=>e.getAttribute(`data-wui-switch`)===t);return[...e.querySelectorAll(g),...n.flatMap(e=>[...e.querySelectorAll(g)])]}_scroller(){return this.querySelector(C)}_summaryFormat(){let e=this.getAttribute(`summary-format`);return e?K(e,this.getAttribute(`summary-unit`)):null}_queueRefresh(){this._refreshQueued||(this._refreshQueued=!0,queueMicrotask(()=>{this._refreshQueued&&this.refresh()}))}_prepareCard(e){let t=this.querySelector(x);t?.id&&!e.hasAttribute(`aria-describedby`)&&e.setAttribute(`aria-describedby`,t.id),e.hasAttribute(`tabindex`)||(e.tabIndex=0)}_announce(e){let t=this.querySelector(b);t&&e&&(t.textContent=``,t.textContent=e)}_fire(e,t,n=!1){return this.dispatchEvent(new CustomEvent(e,{bubbles:!0,cancelable:n,detail:t}))}_canLift(e){let t=H(e),n=this.hasAttribute(`readonly`);return n||e.hasAttribute(`data-wui-locked`)?(this._announce(f.locked(t)),this._fire(`wui:kanban:locked`,{key:L(e),card:e,reason:n?`readonly`:`locked`},!0),!1):e.getAttribute(`aria-busy`)!==`true`||(this._announce(f.busy),J(f.busy,`info`),!1)}_check(e,t,n){if(t===n)return{ok:!1,source:!0,reason:null};let r=this._columnByKey(t),i=this._columnByKey(n),a=f.refused(r?this._titleOf(r):t,i?this._titleOf(i):n),o=i?.getAttribute(`data-accept-from`);if(o!=null&&!o.split(/\s+/).filter(Boolean).includes(t))return{ok:!1,reason:a};if(typeof this.accept==`function`){let r=this.accept(e,t,n);if(r===!1)return{ok:!1,reason:a};if(typeof r==`string`&&r)return{ok:!1,reason:r}}return{ok:!0,reason:null}}_markTargets(e,t){let n=H(e),r=/* @__PURE__ */ new Map;for(let i of this._columns()){let a=I(i),o=this._check(e,t,a);r.set(a,o),i.setAttribute(`data-wui-drop`,o.source?`source`:o.ok?`ok`:`refused`);let s=i.querySelector(y);s&&!o.source&&(s.textContent=o.ok?f.dropHere(n,this._titleOf(i)):o.reason,s.hidden=!1)}return r}_clearTargets(){for(let e of this._columns()){e.removeAttribute(`data-wui-drop`),e.removeAttribute(`data-wui-over`),e.removeAttribute(`data-wui-target`);let t=e.querySelector(y);t&&(t.hidden=!0,t.textContent=``)}}async _commit(e,t,n){let r=this._columnOf(e),i=I(r),o=this._columnByKey(t),s=H(e);if(i===t||!this._canLift(e))return!1;let c=this._check(e,i,t);if(!c.ok)return this._announce(c.reason),J(c.reason,`info`),!1;let l=this._cardsIn(o),u=Number.isInteger(n)?Math.max(0,Math.min(n,l.length)):l.length,d={key:L(e),card:e,from:i,to:t,index:u},p=e.contains(document.activeElement);if(this._controlled())return this._fire(`wui:kanban:move`,d),this._announce(f.moved(s,this._titleOf(o))),p&&this._refocusSoon(d.key),!0;if(!this._fire(`wui:kanban:move`,d,!0))return!1;let m=o.hasAttribute(E)&&!this._revealed.has(d.key);m&&this._revealed.add(d.key);let h={parent:e.parentNode,next:e.nextSibling,column:r,revealed:m};this._bodyOf(o).insertBefore(e,l[u]||null),p&&this._focusMoved(e),this.refresh();let g=o.getAttribute(`data-wui-step`);if(g)return this._runStep(e,d,h,g,o.getAttribute(`data-wui-step-size`));let _=this.getAttribute(`move-url`);if(!_)return this._announce(f.moved(s,this._titleOf(o))),this._fire(`wui:kanban:moved`,{...d,result:null}),!0;this._lock(e,!0),this._announce(f.saving(s,this._titleOf(o)));let v=new URLSearchParams({card:d.key,from:i,to:t,index:String(u)}),y=await a(_,{method:`POST`,body:v});if(this._lock(e,!1),y.kind===`session`)return!1;if(y.ok){let t=this._applyFragment(y.html)||e;return J(y.message,`success`),this._announce(f.moved(H(t),this._titleOf(o))),this._fire(`wui:kanban:moved`,{...d,card:t,result:y}),!0}return this._rollback(e,h),y.kind!==`aborted`&&J(y.message||f.failed[y.kind]||f.failed.server,`danger`),this._fire(`wui:kanban:failed`,{...d,kind:y.kind,status:y.status,message:y.message}),!1}async _runStep(e,t,n,r,i){let o=H(e),s=this._columnByKey(t.to),c=new URLSearchParams({card:t.key,from:t.from,to:t.to}).toString(),l=r+(r.includes(`?`)?`&`:`?`)+c;this._lock(e,!0);let u;try{let t=window.WUI?.modal?.load;if(typeof t!=`function`)throw Error(`<wui-kanban> data-wui-step needs the Razor script webority-ui.js (WUI.modal.load).`);u=await(await t(l,{trigger:e,size:i||void 0})).closed}catch(r){return this._lock(e,!1),this._rollback(e,n),r?.name!==`AbortError`&&J(f.failed.server,`danger`),this._fire(`wui:kanban:failed`,{...t,kind:`step`,status:0,message:r?.message??null}),!1}if(u?.status!==`success`)return this._lock(e,!1),this._rollback(e,n),this._announce(f.cancelled(o)),this._fire(`wui:kanban:failed`,{...t,kind:`dismissed`,status:0,message:null}),!1;let d=e,p=this.getAttribute(`card-url`);if(p){let n=await a(`${p}${p.includes(`?`)?`&`:`?`}${new URLSearchParams({card:t.key})}`);n.ok&&(d=this._applyFragment(n.html)||e)}return this._lock(d,!1),this._announce(f.moved(H(d),this._titleOf(s))),this._fire(`wui:kanban:moved`,{...t,card:d,result:u}),!0}_lock(e,t){t?(e.setAttribute(`aria-busy`,`true`),e.setAttribute(`data-wui-saving`,``)):(e.removeAttribute(`aria-busy`),e.removeAttribute(`data-wui-saving`))}_rollback(e,t){let n=e.contains(document.activeElement),r=t.next&&t.next.parentNode===t.parent?t.next:null;t.revealed&&this._revealed.delete(L(e)),t.parent.insertBefore(e,r),n&&e.focus(),this.refresh(),this._announce(f.rolledBack(H(e),this._titleOf(t.column)))}_applyFragment(e){if(!e)return null;let t=document.createElement(`template`);t.innerHTML=e;for(let e of t.content.querySelectorAll(`script`))n(`[@webority/ui-elements] A kanban fragment carried a script tag; it was removed, not run.`),e.remove();let r=null;for(let e of[...t.content.querySelectorAll(h)]){if(e.closest(`template`))continue;let t=this._cardByKey(L(e));if(!t)continue;let n=t.contains(document.activeElement);t.dispatchEvent(new CustomEvent(`wui:teardown`,{bubbles:!0})),t.hidden&&(e.hidden=!0),t.replaceWith(e),this._prepareCard(e),n&&e.focus(),r??=e}for(let e of t.content.querySelectorAll(`template[data-wui-kanban-summary]`))this._columnByKey(e.getAttribute(`data-wui-kanban-summary`))?.querySelector(_)?.replaceChildren(e.content.cloneNode(!0));return this.refresh(),window.WUI?.refresh?.(),r}_refocusSoon(e){let t=()=>{let t=this._cardByKey(e);t&&this._focusMoved(t)};typeof requestAnimationFrame==`function`?requestAnimationFrame(t):setTimeout(t,0)}_focusMoved(e){e.focus({preventScroll:!0}),e.scrollIntoView?.({block:`nearest`})}_pointerDown(e){if(e.button!==0||e.isPrimary===!1||this._drag||this._kbd)return;let t=e.target.closest?.(h);if(!t||!this.contains(t)||e.target.closest(O))return;let n={card:t,id:e.pointerId,x:e.clientX,y:e.clientY,type:e.pointerType,timer:0};this._press=n,e.pointerType===`touch`&&(n.timer=setTimeout(()=>{this._press===n&&this._startDrag(n,n.x,n.y)},400)),window.addEventListener(`pointermove`,this._onPointerMove),window.addEventListener(`pointerup`,this._onPointerUp),window.addEventListener(`pointercancel`,this._onPointerCancel)}_pointerMove(e){let t=this._press;if(t&&e.pointerId===t.id){if(!this._drag){if(!(Math.hypot(e.clientX-t.x,e.clientY-t.y)>6))return;if(t.type===`touch`){this._endPointer(!1);return}if(this._startDrag(t,e.clientX,e.clientY),!this._drag)return}this._dragTo(e.clientX,e.clientY)}}_pointerUp(e){this._press&&e.pointerId===this._press.id&&this._endPointer(!!this._drag)}_startDrag(e,t,n){let r=e.card;if(!this._canLift(r)){this._endPointer(!1);return}let i=I(this._columnOf(r)),a=r.getBoundingClientRect(),o=r.cloneNode(!0);for(let e of[o,...o.querySelectorAll(`[id]`)])e.removeAttribute(`id`);o.removeAttribute(`data-wui-card`),o.removeAttribute(`tabindex`),o.setAttribute(`aria-hidden`,`true`),o.classList.add(`wui-kanban-ghost`),o.style.width=`${a.width}px`,this.appendChild(o),r.setAttribute(`data-wui-dragging`,``),this.setAttribute(`data-wui-dragging`,``),this._drag={card:r,from:i,ghost:o,dx:t-a.left,dy:n-a.top,over:null,verdicts:this._markTargets(r,i)},this._announce(f.lifted(H(r),this._titleOf(this._columnOf(r)))),document.addEventListener(`keydown`,this._onDocKeyDown),this._dragTo(t,n)}_dragTo(e,t){let n=this._drag;n.x=e,n.y=t,n.ghost.style.transform=`translate(${e-n.dx}px, ${t-n.dy}px)`;let r=this._columnAt(e,t);r!==n.over&&(n.over?.removeAttribute(`data-wui-over`),r?.setAttribute(`data-wui-over`,``),n.over=r),this._autoScroll(e,t,r)}_columnAt(e,t){for(let n of this._columns()){let r=n.getBoundingClientRect();if(e>=r.left&&e<=r.right&&t>=r.top&&t<=r.bottom)return n}return null}_indexAt(e,t){let n=this._visibleCardsIn(e).filter(e=>e!==this._drag?.card).find(e=>{let n=e.getBoundingClientRect();return t<n.top+n.height/2}),r=this._cardsIn(e).filter(e=>e!==this._drag?.card);return n?r.indexOf(n):r.length}_autoScroll(e,t,n){let r=this._scroller();if(r){let t=r.getBoundingClientRect();t.width>0&&(e<t.left+N?r.scrollBy?.({left:-16}):e>t.right-N&&r.scrollBy?.({left:P}))}if(n&&this._scrollColumn(n,t))return;let i=window.innerHeight||0;i>0&&(t<N?window.scrollBy?.({top:-16}):t>i-N&&window.scrollBy?.({top:P}))}_scrollColumn(e,t){let n=this._bodyOf(e);if(!n||e.hasAttribute(`data-collapsed`)||n.scrollHeight<=n.clientHeight)return!1;let r=n.getBoundingClientRect();return t<r.top+N&&n.scrollTop>0?(n.scrollBy?.({top:-16}),!0):t>r.bottom-N&&n.scrollTop+n.clientHeight<n.scrollHeight-1&&(n.scrollBy?.({top:P}),!0)}_endPointer(e){let t=this._press,n=this._drag;if(t&&clearTimeout(t.timer),this._press=null,this._drag=null,window.removeEventListener(`pointermove`,this._onPointerMove),window.removeEventListener(`pointerup`,this._onPointerUp),window.removeEventListener(`pointercancel`,this._onPointerCancel),document.removeEventListener(`keydown`,this._onDocKeyDown),!n)return;n.ghost.remove(),n.card.removeAttribute(`data-wui-dragging`),this.removeAttribute(`data-wui-dragging`),this._suppressClick=!0,setTimeout(()=>{this._suppressClick=!1},0);let r=n.over;if(this._clearTargets(),!e||!r){this._announce(f.cancelled(H(n.card)));return}let i=I(r),a=n.verdicts.get(i);a?.source?this._announce(f.cancelled(H(n.card))):a?.ok?this._commit(n.card,i,this._indexAt(r,n.y)):(this._announce(a?.reason),J(a?.reason,`info`))}_click(e){if(this._suppressClick&&e.target.closest?.(h)){e.preventDefault(),e.stopPropagation(),this._suppressClick=!1;return}let t=e.target.closest?.(w);if(t&&this.contains(t)){let e=t.closest(p);e&&this._setCollapsed(e,!e.hasAttribute(`data-collapsed`),!0);return}let n=e.target.closest?.(k);if(n&&this.contains(n)){this._controlled()||this._loadMore(n.closest(p));return}let r=e.target.closest?.(T);if(r&&this.contains(r)){this._controlled()||this._toggleMore(r.closest(p));return}let i=e.target.closest?.(S);i&&this.contains(i)&&this._showColumn(i.getAttribute(`data-wui-switch`))}_keyDown(e){if(this._kbd){this._liftedKey(e);return}let t=e.target;if(!t.matches?.(h)||!this.contains(t))return;let n=this._columnOf(t);switch(e.key){case` `:case`Spacebar`:{if(e.preventDefault(),!this._canLift(t))return;let r=I(n),i=this._columns();this._kbd={card:t,from:r,target:i.indexOf(n),verdicts:this._markTargets(t,r)},t.setAttribute(`data-wui-lifted`,``),this.setAttribute(`data-wui-dragging`,``),n.setAttribute(`data-wui-target`,``),this._announce(f.lifted(H(t),this._titleOf(n)));return}case`ArrowDown`:case`ArrowUp`:{let r=this._visibleCardsIn(n),i=r[r.indexOf(t)+(e.key===`ArrowDown`?1:-1)];i&&(e.preventDefault(),i.focus());return}case`ArrowLeft`:case`ArrowRight`:{let t=this._columns(),r=e.key===`ArrowRight`?1:-1;for(let i=t.indexOf(n)+r;i>=0&&i<t.length;i+=r){let n=this._visibleCardsIn(t[i])[0];if(n&&!t[i].hasAttribute(`data-collapsed`)){e.preventDefault(),n.focus();return}}return}}}_liftedKey(e){let t=this._kbd,n=this._columns();switch(e.key){case`ArrowLeft`:case`ArrowRight`:{e.preventDefault();let r=t.target+(e.key===`ArrowRight`?1:-1);if(r<0||r>=n.length)return;n[t.target]?.removeAttribute(`data-wui-target`),t.target=r;let i=n[r];i.setAttribute(`data-wui-target`,``),this._showColumn(I(i),!1);let a=t.verdicts.get(I(i)),o=this._titleOf(i);this._announce(a.source?f.overSource(o):a.ok?f.over(o,this._cardsIn(i).filter(e=>!R(e)).length):f.overRefused(o,a.reason));return}case` `:case`Spacebar`:case`Enter`:{e.preventDefault();let r=n[t.target],i=I(r),a=t.verdicts.get(i);if(!a.source&&!a.ok){this._announce(a.reason);return}this._endKeyboard(),a.source?this._announce(f.cancelled(H(t.card))):this._commit(t.card,i);return}case`Escape`:case`Tab`:e.key===`Escape`&&e.preventDefault(),this._endKeyboard(),this._showColumn(t.from,!1),this._announce(f.cancelled(H(t.card)));return}}_endKeyboard(){let e=this._kbd;this._kbd=null,e&&(e.card.removeAttribute(`data-wui-lifted`),this.removeAttribute(`data-wui-dragging`),this._clearTargets())}_restoreCollapsed(){let e=W(this.getAttribute(`board-id`));for(let t of this._columns()){let n=I(t);t.hasAttribute(`data-collapsible`)&&Object.hasOwn(e,n)&&this._setCollapsed(t,e[n],!1)}}_setCollapsed(e,t,n){let r=I(e);e.toggleAttribute(`data-collapsed`,t);let i=this._titleOf(e);for(let n of e.querySelectorAll(w))n.setAttribute(`aria-expanded`,t?`false`:`true`),n.setAttribute(`aria-label`,t?f.expand(i):f.collapse(i));n&&(G(this.getAttribute(`board-id`),r,t),this._fire(`wui:kanban:collapse`,{column:r,collapsed:t}))}_toggleMore(e){if(!e)return;let t=I(e);if(this._expanded.delete(t))for(let t of this._cardsIn(e))this._revealed.delete(L(t));else this._expanded.add(t);this.refresh()}_unloadedIn(e){return e.hasAttribute(A)?(e.hasAttribute(M)||e.setAttribute(M,String(Math.max(0,Number(e.getAttribute(j))-this._cardsIn(e).length))),Number(e.getAttribute(M))):0}async _loadMore(e){let t=Number(e.getAttribute(M));if(e.hasAttribute(`data-wui-loading`)||!(t>0))return;e.setAttribute(`data-wui-loading`,``);let n=e.querySelector(k);n&&(n.disabled=!0,n.textContent=f.loading);let i=new URL(e.getAttribute(A),document.baseURI);i.searchParams.set(`skip`,String(this._cardsIn(e).length));let o=0,s=!1;try{let n=await a(i.toString());if(n.ok){let r=document.createElement(`template`);r.innerHTML=n.html;let i=this._bodyOf(e);for(let e of[...r.content.children])e.matches(h)&&!this._cardByKey(L(e))&&(i.append(e),o++);let a=n.response?.headers.get(`Wui-Kanban-Remaining`)??``;e.setAttribute(M,String(/^\d+$/.test(a)?Number(a):Math.max(0,t-o))),s=!0}}catch(e){r(`[@webority/ui-elements] A kanban column could not load its next cards.`,e)}e.removeAttribute(`data-wui-loading`),this.refresh(),s?this._fire(`wui:kanban:loaded`,{key:I(e),added:o}):J(f.loadFailed,`danger`)}_loadOnScroll(e){if(this._controlled()||!e.matches(m))return;let t=e.closest(p);t?.hasAttribute(A)&&e.scrollTop+e.clientHeight>=e.scrollHeight-F&&this._loadMore(t)}_isPhone(){return typeof matchMedia==`function`&&matchMedia(`(max-width: 767.98px)`).matches}_showColumn(e,t=!0){for(let t of this.querySelectorAll(S))t.getAttribute(`data-wui-switch`)===e?t.setAttribute(`aria-current`,`true`):t.removeAttribute(`aria-current`);let n=this._columnByKey(e),r=this._scroller();if(!n||!r||!t&&!this._isPhone())return;let i=typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches;r.scrollTo?.({left:n.offsetLeft-r.offsetLeft,behavior:i?`auto`:`smooth`})}_syncSwitcherFromScroll(){let e=this._scroller();if(!e||!this._isPhone())return;let t=e.clientWidth||1,n=this._columns()[Math.round(e.scrollLeft/t)];if(n)for(let e of this.querySelectorAll(S))e.getAttribute(`data-wui-switch`)===I(n)?e.setAttribute(`aria-current`,`true`):e.removeAttribute(`aria-current`)}};export{s as a,Y as c,U as d,K as f,G as g,q as h,c as i,H as l,W as m,u as n,f as o,B as p,l as r,o as s,d as t,V as u};
1
+ import{m as e,o as t}from"./formatters-Ba0CvsTs.js";import{n,t as r}from"./devWarn-DXdRWZs3.js";import{t as i}from"./elementBase-DV9IZZCu.js";import{l as a}from"./wuiHttp-BuaTcumE.js";var o=Object.freeze([`neutral`,`primary`,`info`,`success`,`warning`,`danger`]),s=Object.freeze([`number`,`currency`,`compact`]),c=`wui-kanban:`,l=`(max-width: 767.98px)`,u=400,d=6,f=Object.freeze({help:`Press Space to pick up the card. Use the Left and Right arrow keys to choose a column, then Space to drop it, or Escape to cancel.`,empty:`Nothing here`,collapse:e=>`Collapse ${e}`,expand:e=>`Expand ${e}`,lifted:(e,t)=>`Picked up ${e} in ${t}. Use the Left and Right arrow keys to choose a column.`,over:(e,t)=>`${e}, ${t===1?`1 card`:`${t} cards`}. Drop allowed.`,overSource:e=>`${e}, where the card started.`,overRefused:(e,t)=>`${e}. ${t}`,dropHere:(e,t)=>`Drop here to move ${e} to ${t}.`,refused:(e,t)=>`Cards in ${e} cannot move to ${t}.`,moved:(e,t)=>`Moved ${e} to ${t}.`,saving:(e,t)=>`Moving ${e} to ${t}.`,cancelled:e=>`${e} was not moved.`,rolledBack:(e,t)=>`${e} went back to ${t}.`,locked:e=>`${e} cannot be moved.`,more:e=>`Show ${e} more`,fewer:`Show fewer`,loadMore:e=>`Show more (${e})`,loading:`Loading…`,loadFailed:`More cards could not be loaded. Try again.`,swipeHint:`Swipe sideways or tap a column`,busy:`This card is still saving. Try again in a moment.`,failed:Object.freeze({forbidden:`You do not have permission to move this card.`,client:`This card could not be moved. Refresh the board and try again.`,validation:`This card could not be moved. Refresh the board and try again.`,server:`Something went wrong on our side, so the card went back. Try again in a moment.`,network:`Could not reach the server, so the card went back. Check your connection and try again.`})}),p=`[data-wui-column]`,m=`[data-wui-body]`,h=`[data-wui-card]`,g=`[data-wui-count]`,_=`[data-wui-summary]`,v=`[data-wui-empty]`,y=`[data-wui-drop-note]`,b=`[data-wui-live]`,x=`[data-wui-help]`,S=`[data-wui-switch]`,C=`[data-wui-scroller]`,w=`[data-wui-collapse]`,T=`[data-wui-more]`,E=`data-wui-visible-limit`,D=`data-wui-overflow`,O=`input, select, textarea, [contenteditable=""], [contenteditable="true"], [data-wui-no-drag]`,k=`[data-wui-load-more]`,A=`data-wui-more-url`,j=`data-wui-total`,M=`data-wui-unloaded`,N=48,P=16,F=160,I=e=>e.getAttribute(`data-wui-column`),L=e=>e.getAttribute(`data-wui-card`),R=e=>e.hidden||e.hasAttribute(`hidden`),z=e=>R(e)||e.hasAttribute(D);function B(e){if(e==null||e===``)return null;let t=typeof e==`number`?e:Number(e);if(!Number.isInteger(t)||t<1)throw TypeError(`Unsupported kanban visible limit "${String(e)}". Use a whole number of 1 or more.`);return t}function V(e,t,n,r){let i=/* @__PURE__ */ new Set;if(t==null||n)return i;let a=0;for(let n of e)r.has(n)||(a<t?a++:i.add(n));return i}function H(e){let t=(e.getAttribute(`aria-label`)||e.textContent||``).replace(/\s+/g,` `).trim();return t.length>80?`${t.slice(0,79)}…`:t||L(e)||`Card`}function U(e){return e?`${c}${e}`:null}function W(e,t=globalThis.localStorage){let n=U(e);if(!n||!t)return{};try{let e=JSON.parse(t.getItem(n)||`null`);return e&&typeof e.collapsed==`object`&&e.collapsed?e.collapsed:{}}catch{return{}}}function G(e,t,n,r=globalThis.localStorage){let i=U(e);if(!i||!r)return;let a={...W(e,r),[t]:!!n};try{r.setItem(i,JSON.stringify({collapsed:a}))}catch{}}function K(e,n){if(!s.includes(e))throw TypeError(`Unsupported kanban summary format "${String(e)}". Use ${s.join(`, `)}.`);if(n!=null&&n!==``&&!t.includes(n))throw TypeError(`Unsupported kanban summary unit "${String(n)}". Use ${t.join(`, `)}.`);return e===`currency`?{style:`currency`,unit:n||`rupees`}:e===`compact`?{style:`compact`,currency:`INR`,unit:n||`rupees`}:{style:`number`,decimals:0}}function q(e){let t=0;for(let n of e){if(n==null||n===``)continue;let e=typeof n==`number`?n:Number(n);Number.isFinite(e)&&(t+=e)}return t}var J=(e,t)=>{e&&window.WUI?.toast?.(e,{variant:t})},Y=class extends i{constructor(){super(),this._wired=!1,this._filter=null,this._expanded=/* @__PURE__ */ new Set,this._revealed=/* @__PURE__ */ new Set,this._press=null,this._drag=null,this._kbd=null,this._suppressClick=!1,this._observer=null,this._refreshQueued=!1,this._scrollTimer=0,this._onPointerMove=e=>this._pointerMove(e),this._onPointerUp=e=>this._pointerUp(e),this._onPointerCancel=()=>this._endPointer(!1),this._onDocKeyDown=e=>{e.key===`Escape`&&this._drag&&(e.preventDefault(),this._endPointer(!1))},this._onScroll=()=>{clearTimeout(this._scrollTimer),this._scrollTimer=setTimeout(()=>this._syncSwitcherFromScroll(),80)},this.addEventListener(`pointerdown`,e=>this._pointerDown(e)),this.addEventListener(`keydown`,e=>this._keyDown(e)),this.addEventListener(`click`,e=>this._click(e),!0),this.addEventListener(`scroll`,e=>this._loadOnScroll(e.target),!0),this.addEventListener(`dragstart`,e=>{e.target.closest?.(h)&&e.preventDefault()}),this.addEventListener(`touchmove`,e=>{this._drag&&e.preventDefault()},{passive:!1})}_controlled(){return this.hasAttribute(`controlled`)}connectedCallback(){if(!this._wired){this._wired=!0,this._scroller()?.addEventListener(`scroll`,this._onScroll,{passive:!0}),this._restoreCollapsed();for(let e of this._allCards())this._prepareCard(e);if(typeof MutationObserver==`function`){this._observer=new MutationObserver(e=>{for(let t of e)for(let e of t.addedNodes)e.nodeType===1&&e.matches(h)&&this._prepareCard(e);this._queueRefresh()});for(let e of this.querySelectorAll(m))this._observer.observe(e,{childList:!0})}this.refresh()}}disconnectedCallback(){this._endPointer(!1),this._observer?.disconnect(),this._observer=null,this._scroller()?.removeEventListener(`scroll`,this._onScroll),clearTimeout(this._scrollTimer),this._wired=!1}setFilter(e){if(e!=null&&typeof e!=`function`)throw TypeError(`wui-kanban setFilter: pass a function or null.`);if(this._filter=e,!e)for(let e of this._allCards())e.hidden=!1;this.refresh()}refresh(){if(this._controlled())return;this._refreshQueued=!1;let t=this._summaryFormat();for(let n of this._columns()){let r=I(n),i=B(n.getAttribute(E)),a=[],o=[];for(let e of this._cardsIn(n))this._filter&&(e.hidden=this._filter(e)===!1),R(e)?e.removeAttribute(D):(a.push(e),o.push(e.getAttribute(`data-wui-value`)));let s=this._expanded.has(r),c=V(a.map(L),i,s,this._revealed);for(let e of a)e.toggleAttribute(D,c.has(L(e)));let l=this._unloadedIn(n),u=String(a.length+l);for(let e of this._countsOf(n))e.textContent!==u&&(e.textContent=u);let d=n.querySelector(v);if(d&&(d.hidden=a.length>0),t){let r=n.querySelector(_);r&&(r.textContent=e(q(o),t))}let p=n.querySelector(T);if(p){p.hidden=i==null||(s?a.length<=i:c.size===0),p.setAttribute(`aria-expanded`,s?`true`:`false`);let e=s?f.fewer:f.more(c.size);p.textContent!==e&&(p.textContent=e)}let m=n.querySelector(k);if(m&&(m.hidden=l<=0,!n.hasAttribute(`data-wui-loading`))){m.disabled=!1;let e=f.loadMore(l);m.textContent!==e&&(m.textContent=e)}}}moveCard(e,t,n){let r=this._cardByKey(e);if(!r)throw Error(`wui-kanban moveCard: no card "${String(e)}" on this board.`);if(!this._columnByKey(t))throw Error(`wui-kanban moveCard: no column "${String(t)}" on this board.`);return this._commit(r,t,n)}_columns(){return[...this.querySelectorAll(p)]}_columnByKey(e){return this._columns().find(t=>I(t)===e)||null}_columnOf(e){return e.closest(p)}_titleOf(e){return(e.querySelector(`.wui-kanban-title`)?.textContent||I(e)||``).replace(/\s+/g,` `).trim()}_bodyOf(e){return e.querySelector(m)}_cardsIn(e){let t=this._bodyOf(e);return t?[...t.children].filter(e=>e.matches(h)):[]}_visibleCardsIn(e){return this._cardsIn(e).filter(e=>!z(e))}_allCards(){return[...this.querySelectorAll(`${m} > ${h}`)]}_cardByKey(e){return this._allCards().find(t=>L(t)===e)||null}_countsOf(e){let t=I(e),n=[...this.querySelectorAll(S)].filter(e=>e.getAttribute(`data-wui-switch`)===t);return[...e.querySelectorAll(g),...n.flatMap(e=>[...e.querySelectorAll(g)])]}_scroller(){return this.querySelector(C)}_summaryFormat(){let e=this.getAttribute(`summary-format`);return e?K(e,this.getAttribute(`summary-unit`)):null}_queueRefresh(){this._refreshQueued||(this._refreshQueued=!0,queueMicrotask(()=>{this._refreshQueued&&this.refresh()}))}_prepareCard(e){let t=this.querySelector(x);t?.id&&!e.hasAttribute(`aria-describedby`)&&e.setAttribute(`aria-describedby`,t.id),e.hasAttribute(`tabindex`)||(e.tabIndex=0)}_announce(e){let t=this.querySelector(b);t&&e&&(t.textContent=``,t.textContent=e)}_fire(e,t,n=!1){return this.dispatchEvent(new CustomEvent(e,{bubbles:!0,cancelable:n,detail:t}))}_canLift(e){let t=H(e),n=this.hasAttribute(`readonly`);return n||e.hasAttribute(`data-wui-locked`)?(this._announce(f.locked(t)),this._fire(`wui:kanban:locked`,{key:L(e),card:e,reason:n?`readonly`:`locked`},!0),!1):e.getAttribute(`aria-busy`)!==`true`||(this._announce(f.busy),J(f.busy,`info`),!1)}_check(e,t,n){if(t===n)return{ok:!1,source:!0,reason:null};let r=this._columnByKey(t),i=this._columnByKey(n),a=f.refused(r?this._titleOf(r):t,i?this._titleOf(i):n),o=i?.getAttribute(`data-accept-from`);if(o!=null&&!o.split(/\s+/).filter(Boolean).includes(t))return{ok:!1,reason:a};if(typeof this.accept==`function`){let r=this.accept(e,t,n);if(r===!1)return{ok:!1,reason:a};if(typeof r==`string`&&r)return{ok:!1,reason:r}}return{ok:!0,reason:null}}_markTargets(e,t){let n=H(e),r=/* @__PURE__ */ new Map;for(let i of this._columns()){let a=I(i),o=this._check(e,t,a);r.set(a,o),i.setAttribute(`data-wui-drop`,o.source?`source`:o.ok?`ok`:`refused`);let s=i.querySelector(y);s&&!o.source&&(s.textContent=o.ok?f.dropHere(n,this._titleOf(i)):o.reason,s.hidden=!1)}return r}_clearTargets(){for(let e of this._columns()){e.removeAttribute(`data-wui-drop`),e.removeAttribute(`data-wui-over`),e.removeAttribute(`data-wui-target`);let t=e.querySelector(y);t&&(t.hidden=!0,t.textContent=``)}}async _commit(e,t,n){let r=this._columnOf(e),i=I(r),o=this._columnByKey(t),s=H(e);if(i===t||!this._canLift(e))return!1;let c=this._check(e,i,t);if(!c.ok)return this._announce(c.reason),J(c.reason,`info`),!1;let l=this._cardsIn(o),u=Number.isInteger(n)?Math.max(0,Math.min(n,l.length)):l.length,d={key:L(e),card:e,from:i,to:t,index:u},p=e.contains(document.activeElement);if(this._controlled())return this._fire(`wui:kanban:move`,d),this._announce(f.moved(s,this._titleOf(o))),p&&this._refocusSoon(d.key),!0;if(!this._fire(`wui:kanban:move`,d,!0))return!1;let m=o.hasAttribute(E)&&!this._revealed.has(d.key);m&&this._revealed.add(d.key);let h={parent:e.parentNode,next:e.nextSibling,column:r,revealed:m};this._bodyOf(o).insertBefore(e,l[u]||null),p&&this._focusMoved(e),this.refresh();let g=o.getAttribute(`data-wui-step`);if(g)return this._runStep(e,d,h,g,o.getAttribute(`data-wui-step-size`));let _=this.getAttribute(`move-url`);if(!_)return this._announce(f.moved(s,this._titleOf(o))),this._fire(`wui:kanban:moved`,{...d,result:null}),!0;this._lock(e,!0),this._announce(f.saving(s,this._titleOf(o)));let v=new URLSearchParams({card:d.key,from:i,to:t,index:String(u)}),y=await a(_,{method:`POST`,body:v});if(this._lock(e,!1),y.kind===`session`)return!1;if(y.ok){let t=this._applyFragment(y.html)||e;return J(y.message,`success`),this._announce(f.moved(H(t),this._titleOf(o))),this._fire(`wui:kanban:moved`,{...d,card:t,result:y}),!0}return this._rollback(e,h),y.kind!==`aborted`&&J(y.message||f.failed[y.kind]||f.failed.server,`danger`),this._fire(`wui:kanban:failed`,{...d,kind:y.kind,status:y.status,message:y.message}),!1}async _runStep(e,t,n,r,i){let o=H(e),s=this._columnByKey(t.to),c=new URLSearchParams({card:t.key,from:t.from,to:t.to}).toString(),l=r+(r.includes(`?`)?`&`:`?`)+c;this._lock(e,!0);let u;try{let t=window.WUI?.modal?.load;if(typeof t!=`function`)throw Error(`<wui-kanban> data-wui-step needs the Razor script webority-ui.js (WUI.modal.load).`);u=await(await t(l,{trigger:e,size:i||void 0})).closed}catch(r){return this._lock(e,!1),this._rollback(e,n),r?.name!==`AbortError`&&J(f.failed.server,`danger`),this._fire(`wui:kanban:failed`,{...t,kind:`step`,status:0,message:r?.message??null}),!1}if(u?.status!==`success`)return this._lock(e,!1),this._rollback(e,n),this._announce(f.cancelled(o)),this._fire(`wui:kanban:failed`,{...t,kind:`dismissed`,status:0,message:null}),!1;let d=e,p=this.getAttribute(`card-url`);if(p){let n=await a(`${p}${p.includes(`?`)?`&`:`?`}${new URLSearchParams({card:t.key})}`);n.ok&&(d=this._applyFragment(n.html)||e)}return this._lock(d,!1),this._announce(f.moved(H(d),this._titleOf(s))),this._fire(`wui:kanban:moved`,{...t,card:d,result:u}),!0}_lock(e,t){t?(e.setAttribute(`aria-busy`,`true`),e.setAttribute(`data-wui-saving`,``)):(e.removeAttribute(`aria-busy`),e.removeAttribute(`data-wui-saving`))}_rollback(e,t){let n=e.contains(document.activeElement),r=t.next&&t.next.parentNode===t.parent?t.next:null;t.revealed&&this._revealed.delete(L(e)),t.parent.insertBefore(e,r),n&&e.focus(),this.refresh(),this._announce(f.rolledBack(H(e),this._titleOf(t.column)))}_applyFragment(e){if(!e)return null;let t=document.createElement(`template`);t.innerHTML=e;for(let e of t.content.querySelectorAll(`script`))n(`[@webority/ui-elements] A kanban fragment carried a script tag; it was removed, not run.`),e.remove();let r=null;for(let e of[...t.content.querySelectorAll(h)]){if(e.closest(`template`))continue;let t=this._cardByKey(L(e));if(!t)continue;let n=t.contains(document.activeElement);t.dispatchEvent(new CustomEvent(`wui:teardown`,{bubbles:!0})),t.hidden&&(e.hidden=!0),t.replaceWith(e),this._prepareCard(e),n&&e.focus(),r??=e}for(let e of t.content.querySelectorAll(`template[data-wui-kanban-summary]`))this._columnByKey(e.getAttribute(`data-wui-kanban-summary`))?.querySelector(_)?.replaceChildren(e.content.cloneNode(!0));return this.refresh(),window.WUI?.refresh?.(),r}_refocusSoon(e){let t=()=>{let t=this._cardByKey(e);t&&this._focusMoved(t)};typeof requestAnimationFrame==`function`?requestAnimationFrame(t):setTimeout(t,0)}_focusMoved(e){e.focus({preventScroll:!0}),e.scrollIntoView?.({block:`nearest`})}_pointerDown(e){if(e.button!==0||e.isPrimary===!1||this._drag||this._kbd)return;let t=e.target.closest?.(h);if(!t||!this.contains(t)||e.target.closest(O))return;let n={card:t,id:e.pointerId,x:e.clientX,y:e.clientY,type:e.pointerType,timer:0};this._press=n,e.pointerType===`touch`&&(n.timer=setTimeout(()=>{this._press===n&&this._startDrag(n,n.x,n.y)},400)),window.addEventListener(`pointermove`,this._onPointerMove),window.addEventListener(`pointerup`,this._onPointerUp),window.addEventListener(`pointercancel`,this._onPointerCancel)}_pointerMove(e){let t=this._press;if(t&&e.pointerId===t.id){if(!this._drag){if(!(Math.hypot(e.clientX-t.x,e.clientY-t.y)>6))return;if(t.type===`touch`){this._endPointer(!1);return}if(this._startDrag(t,e.clientX,e.clientY),!this._drag)return}this._dragTo(e.clientX,e.clientY)}}_pointerUp(e){this._press&&e.pointerId===this._press.id&&this._endPointer(!!this._drag)}_startDrag(e,t,n){let r=e.card;if(!this._canLift(r)){this._endPointer(!1);return}let i=I(this._columnOf(r)),a=r.getBoundingClientRect(),o=r.cloneNode(!0);for(let e of[o,...o.querySelectorAll(`[id]`)])e.removeAttribute(`id`);o.removeAttribute(`data-wui-card`),o.removeAttribute(`tabindex`),o.setAttribute(`aria-hidden`,`true`),o.classList.add(`wui-kanban-ghost`),o.style.width=`${a.width}px`,this.appendChild(o),r.setAttribute(`data-wui-dragging`,``),this.setAttribute(`data-wui-dragging`,``),this._drag={card:r,from:i,ghost:o,dx:t-a.left,dy:n-a.top,over:null,verdicts:this._markTargets(r,i)},this._announce(f.lifted(H(r),this._titleOf(this._columnOf(r)))),document.addEventListener(`keydown`,this._onDocKeyDown),this._dragTo(t,n)}_dragTo(e,t){let n=this._drag;n.x=e,n.y=t,n.ghost.style.transform=`translate(${e-n.dx}px, ${t-n.dy}px)`;let r=this._columnAt(e,t);r!==n.over&&(n.over?.removeAttribute(`data-wui-over`),r?.setAttribute(`data-wui-over`,``),n.over=r),this._autoScroll(e,t,r)}_columnAt(e,t){for(let n of this._columns()){let r=n.getBoundingClientRect();if(e>=r.left&&e<=r.right&&t>=r.top&&t<=r.bottom)return n}return null}_indexAt(e,t){let n=this._visibleCardsIn(e).filter(e=>e!==this._drag?.card).find(e=>{let n=e.getBoundingClientRect();return t<n.top+n.height/2}),r=this._cardsIn(e).filter(e=>e!==this._drag?.card);return n?r.indexOf(n):r.length}_autoScroll(e,t,n){let r=this._scroller();if(r){let t=r.getBoundingClientRect();t.width>0&&(e<t.left+N?r.scrollBy?.({left:-16}):e>t.right-N&&r.scrollBy?.({left:P}))}if(n&&this._scrollColumn(n,t))return;let i=window.innerHeight||0;i>0&&(t<N?window.scrollBy?.({top:-16}):t>i-N&&window.scrollBy?.({top:P}))}_scrollColumn(e,t){let n=this._bodyOf(e);if(!n||e.hasAttribute(`data-collapsed`)||n.scrollHeight<=n.clientHeight)return!1;let r=n.getBoundingClientRect();return t<r.top+N&&n.scrollTop>0?(n.scrollBy?.({top:-16}),!0):t>r.bottom-N&&n.scrollTop+n.clientHeight<n.scrollHeight-1&&(n.scrollBy?.({top:P}),!0)}_endPointer(e){let t=this._press,n=this._drag;if(t&&clearTimeout(t.timer),this._press=null,this._drag=null,window.removeEventListener(`pointermove`,this._onPointerMove),window.removeEventListener(`pointerup`,this._onPointerUp),window.removeEventListener(`pointercancel`,this._onPointerCancel),document.removeEventListener(`keydown`,this._onDocKeyDown),!n)return;n.ghost.remove(),n.card.removeAttribute(`data-wui-dragging`),this.removeAttribute(`data-wui-dragging`),this._suppressClick=!0,setTimeout(()=>{this._suppressClick=!1},0);let r=n.over;if(this._clearTargets(),!e||!r){this._announce(f.cancelled(H(n.card)));return}let i=I(r),a=n.verdicts.get(i);a?.source?this._announce(f.cancelled(H(n.card))):a?.ok?this._commit(n.card,i,this._indexAt(r,n.y)):(this._announce(a?.reason),J(a?.reason,`info`))}_click(e){if(this._suppressClick&&e.target.closest?.(h)){e.preventDefault(),e.stopPropagation(),this._suppressClick=!1;return}let t=e.target.closest?.(w);if(t&&this.contains(t)){let e=t.closest(p);e&&this._setCollapsed(e,!e.hasAttribute(`data-collapsed`),!0);return}let n=e.target.closest?.(k);if(n&&this.contains(n)){this._controlled()||this._loadMore(n.closest(p));return}let r=e.target.closest?.(T);if(r&&this.contains(r)){this._controlled()||this._toggleMore(r.closest(p));return}let i=e.target.closest?.(S);i&&this.contains(i)&&this._showColumn(i.getAttribute(`data-wui-switch`))}_keyDown(e){if(this._kbd){this._liftedKey(e);return}let t=e.target;if(!t.matches?.(h)||!this.contains(t))return;let n=this._columnOf(t);switch(e.key){case` `:case`Spacebar`:{if(e.preventDefault(),!this._canLift(t))return;let r=I(n),i=this._columns();this._kbd={card:t,from:r,target:i.indexOf(n),verdicts:this._markTargets(t,r)},t.setAttribute(`data-wui-lifted`,``),this.setAttribute(`data-wui-dragging`,``),n.setAttribute(`data-wui-target`,``),this._announce(f.lifted(H(t),this._titleOf(n)));return}case`ArrowDown`:case`ArrowUp`:{let r=this._visibleCardsIn(n),i=r[r.indexOf(t)+(e.key===`ArrowDown`?1:-1)];i&&(e.preventDefault(),i.focus());return}case`ArrowLeft`:case`ArrowRight`:{let t=this._columns(),r=e.key===`ArrowRight`?1:-1;for(let i=t.indexOf(n)+r;i>=0&&i<t.length;i+=r){let n=this._visibleCardsIn(t[i])[0];if(n&&!t[i].hasAttribute(`data-collapsed`)){e.preventDefault(),n.focus();return}}return}}}_liftedKey(e){let t=this._kbd,n=this._columns();switch(e.key){case`ArrowLeft`:case`ArrowRight`:{e.preventDefault();let r=t.target+(e.key===`ArrowRight`?1:-1);if(r<0||r>=n.length)return;n[t.target]?.removeAttribute(`data-wui-target`),t.target=r;let i=n[r];i.setAttribute(`data-wui-target`,``),this._showColumn(I(i),!1);let a=t.verdicts.get(I(i)),o=this._titleOf(i);this._announce(a.source?f.overSource(o):a.ok?f.over(o,this._cardsIn(i).filter(e=>!R(e)).length):f.overRefused(o,a.reason));return}case` `:case`Spacebar`:case`Enter`:{e.preventDefault();let r=n[t.target],i=I(r),a=t.verdicts.get(i);if(!a.source&&!a.ok){this._announce(a.reason);return}this._endKeyboard(),a.source?this._announce(f.cancelled(H(t.card))):this._commit(t.card,i);return}case`Escape`:case`Tab`:e.key===`Escape`&&e.preventDefault(),this._endKeyboard(),this._showColumn(t.from,!1),this._announce(f.cancelled(H(t.card)));return}}_endKeyboard(){let e=this._kbd;this._kbd=null,e&&(e.card.removeAttribute(`data-wui-lifted`),this.removeAttribute(`data-wui-dragging`),this._clearTargets())}_restoreCollapsed(){let e=W(this.getAttribute(`board-id`));for(let t of this._columns()){let n=I(t);t.hasAttribute(`data-collapsible`)&&Object.hasOwn(e,n)&&this._setCollapsed(t,e[n],!1)}}_setCollapsed(e,t,n){let r=I(e);e.toggleAttribute(`data-collapsed`,t);let i=this._titleOf(e);for(let n of e.querySelectorAll(w))n.setAttribute(`aria-expanded`,t?`false`:`true`),n.setAttribute(`aria-label`,t?f.expand(i):f.collapse(i));n&&(G(this.getAttribute(`board-id`),r,t),this._fire(`wui:kanban:collapse`,{column:r,collapsed:t}))}_toggleMore(e){if(!e)return;let t=I(e);if(this._expanded.delete(t))for(let t of this._cardsIn(e))this._revealed.delete(L(t));else this._expanded.add(t);this.refresh()}_unloadedIn(e){return e.hasAttribute(A)?(e.hasAttribute(M)||e.setAttribute(M,String(Math.max(0,Number(e.getAttribute(j))-this._cardsIn(e).length))),Number(e.getAttribute(M))):0}async _loadMore(e){let t=Number(e.getAttribute(M));if(e.hasAttribute(`data-wui-loading`)||!(t>0))return;e.setAttribute(`data-wui-loading`,``);let n=e.querySelector(k);n&&(n.disabled=!0,n.textContent=f.loading);let i=new URL(e.getAttribute(A),document.baseURI);i.searchParams.set(`skip`,String(this._cardsIn(e).length));let o=0,s=!1;try{let n=await a(i.toString());if(n.ok){let r=document.createElement(`template`);r.innerHTML=n.html;let i=this._bodyOf(e);for(let e of[...r.content.children])e.matches(h)&&!this._cardByKey(L(e))&&(i.append(e),o++);let a=n.response?.headers.get(`Wui-Kanban-Remaining`)??``;e.setAttribute(M,String(/^\d+$/.test(a)?Number(a):Math.max(0,t-o))),s=!0}}catch(e){r(`[@webority/ui-elements] A kanban column could not load its next cards.`,e)}e.removeAttribute(`data-wui-loading`),this.refresh(),s?this._fire(`wui:kanban:loaded`,{key:I(e),added:o}):J(f.loadFailed,`danger`)}_loadOnScroll(e){if(this._controlled()||!e.matches(m))return;let t=e.closest(p);t?.hasAttribute(A)&&e.scrollTop+e.clientHeight>=e.scrollHeight-F&&this._loadMore(t)}_isPhone(){return typeof matchMedia==`function`&&matchMedia(`(max-width: 767.98px)`).matches}_showColumn(e,t=!0){for(let t of this.querySelectorAll(S))t.getAttribute(`data-wui-switch`)===e?t.setAttribute(`aria-current`,`true`):t.removeAttribute(`aria-current`);let n=this._columnByKey(e),r=this._scroller();if(!n||!r||!t&&!this._isPhone())return;let i=typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches;r.scrollTo?.({left:n.offsetLeft-r.offsetLeft,behavior:i?`auto`:`smooth`})}_syncSwitcherFromScroll(){let e=this._scroller();if(!e||!this._isPhone())return;let t=e.clientWidth||1,n=this._columns()[Math.round(e.scrollLeft/t)];if(n)for(let e of this.querySelectorAll(S))e.getAttribute(`data-wui-switch`)===I(n)?e.setAttribute(`aria-current`,`true`):e.removeAttribute(`aria-current`)}};export{s as a,Y as c,U as d,K as f,G as g,q as h,c as i,H as l,W as m,u as n,f as o,B as p,l as r,o as s,d as t,V as u};
@@ -0,0 +1 @@
1
+ var e=Object.freeze({carousel:{entries:[`elements/carousel.js`],tags:[`wui-carousel`]},"code-block":{entries:[`elements/code-block.js`],tags:[`wui-code-block`]},"command-palette":{entries:[`elements/command-palette.js`],tags:[`wui-command-palette`]},"comment-thread":{entries:[`elements/comment-thread.js`],tags:[`wui-mention-input`,`wui-comment-thread`]},"consent-banner":{entries:[`elements/consent-banner.js`],tags:[`wui-consent-banner`]},"context-menu":{entries:[`elements/context-menu.js`],tags:[`wui-context-menu`]},"date-range":{entries:[`elements/date-range.js`],tags:[`wui-date-range`]},drawer:{entries:[`elements/drawer.js`],tags:[`wui-drawer`]},"image-crop":{entries:[`elements/image-crop.js`],tags:[`wui-image-crop`]},"inline-edit":{entries:[`elements/inline-edit.js`],tags:[`wui-inline-edit`]},kanban:{entries:[`elements/kanban.js`],tags:[`wui-kanban`]},"lead-popup":{entries:[`elements/lead-popup.js`],tags:[`wui-lead-popup`]},lightbox:{entries:[`elements/lightbox.js`],tags:[`wui-lightbox`]},"org-tree":{entries:[`elements/org-tree.js`],tags:[`wui-org-tree`]},markdown:{entries:[`elements/markdown.js`],tags:[`wui-markdown`]},phone:{entries:[`elements/phone.js`,`global/parts/select-country.js`],tags:[`wui-phone`]},resizable:{entries:[`elements/resizable.js`],tags:[`wui-resizable`]},"saved-views":{entries:[`elements/saved-views.js`],tags:[`wui-saved-views`]},"select-chips":{entries:[`global/parts/select-chips.js`],tags:[]},"select-recents":{entries:[`global/parts/select-recents.js`],tags:[]},"select-search":{entries:[`global/parts/select-search.js`],tags:[]},slider:{entries:[`elements/slider.js`],tags:[`wui-slider`]},sortable:{entries:[`elements/sortable.js`],tags:[`wui-sortable`]},"status-icon":{entries:[`elements/status-icon.js`],tags:[`wui-status-icon`]},timepicker:{entries:[`elements/timepicker.js`],tags:[`wui-timepicker`]},tour:{entries:[`elements/tour.js`],tags:[`wui-tour`]},tree:{entries:[`elements/tree.js`],tags:[`wui-tree`]},wizard:{entries:[`elements/wizard.js`],tags:[`wui-wizard-step`,`wui-wizard`]},chart:{file:`ui-chart.global.js`,tags:[`wui-chart`],selfContained:!0},calendar:{file:`ui-calendar.global.js`,tags:[`wui-calendar`],selfContained:!0},"rich-text":{file:`ui-rich-text.global.js`,tags:[`wui-rich-text`],selfContained:!0},"file-viewer":{file:`ui-file-viewer.global.js`,tags:[`wui-file-viewer`],selfContained:!0}});Object.freeze({anchorOverlay:`anchorOverlay.js`,buttonClass:`buttonClass.js`,calendarMath:`calendarMath.js`,copyText:`copyText.js`,dataTable:`dataTable.js`,defineElement:`defineElement.js`,devWarn:`devWarn.js`,elementBase:`elementBase.js`,fieldState:`fieldState.js`,formatters:`formatters.js`,formMirror:`formMirror.js`,iconGlyphs:`iconGlyphs.g.js`,listboxKeyNav:`listboxKeyNav.js`,loader:`global/loader.js`,mentionText:`mentionText.js`,notificationDays:`notificationDays.js`,optionLabel:`optionLabel.js`,partRegistry:`select/partRegistry.js`,selectList:`select/list.js`,selectRemote:`select/remote.js`,stepperHeader:`stepperHeader.js`,tableSelect:`tableSelect.js`,textMatch:`textMatch.js`,wuiHttp:`server/wuiHttp.js`,WuiSelect:`WuiSelect.js`,zone:`zone.js`});var t=`wui-elements:defined`,n=`wui-elements:load-error`,r=/* @__PURE__ */ new Map;for(let[t,n]of Object.entries(e))for(let e of n.tags)r.set(e,t);[...r.keys()].join(`,`);export{n,t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./devWarn-DXdRWZs3.js";var t=`Recent`,n=5,r=20;function i(){let i=null,a=null,o=()=>i.getAttribute(`recents-key`)??``,s=()=>i.mode!==`tag`&&o()!==``,c=(t,n)=>{t!==a&&(a=t,e(`<wui-select> recents-limit "${t}" ${n}.`))},l=()=>{let e=i.getAttribute(`recents-limit`);if(e===null)return n;let t=Number(e);return!Number.isInteger(t)||t<1?(c(e,`is not a whole number from 1 to 20; 5 is used`),n):t>r?(c(e,`is over 20; 20 is used`),r):t},u=()=>{let e;try{e=JSON.parse(globalThis.localStorage?.getItem(o())??`[]`)}catch{return[]}return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]},d=e=>{try{globalThis.localStorage?.setItem(o(),JSON.stringify(e))}catch{}};return{mount(t){i=t,i.mode===`tag`?e(`<wui-select> recents-key is not used in mode "tag"; it is ignored.`):o()===``&&e(`<wui-select> recents-key is empty; no recents are kept.`)},onPick(e,t){if(!s()||t?.isCustom)return!1;let n=String(e.value);return n===``||Array.isArray(i.value)&&i.value.includes(n)||d([n,...u().filter(e=>e!==n)].slice(0,l())),!1},recents(e){if(!s())return null;let n=l(),r=[];for(let t of u()){let i=e.find(e=>String(e.value)===t);if(i&&!i.disabled&&r.push(i),r.length===n)break}return r.length?{label:i.getAttribute(`recents-label`)||t,options:r}:null},teardown(){}}}export{i as default};
@@ -1 +1 @@
1
- import{n as e}from"./devWarn-DXdRWZs3.js";import{i as t}from"./optionLabel-CLemms21.js";import{t as n}from"./customRule-BE7CusA3.js";import{n as r}from"./WuiSelect-BEhh06ZD.js";var i=(e,n)=>{let r=n.toLowerCase(),i=e.getAttribute(`value-label`);return i&&String(e.value??``)!==``&&i.toLowerCase()===r?!0:e.options.some(e=>t(e).toLowerCase()===r||String(e.value??``).toLowerCase()===r)};function a(){let t=null,a=null,o=0,s=null,c=null,l=null,u=``,d=null,f=!1,p=()=>r(t),m=()=>typeof t.loadOptions!=`function`&&!t.getAttribute(`source`),h=(e,n,r)=>{let i=t.getAttribute(e);if(i==null||i.trim()===``)return n;let a=Number(i);return r(a)?a:n},g=()=>h(`min-chars`,1,e=>Number.isInteger(e)&&e>=0),_=()=>h(`debounce`,250,e=>Number.isFinite(e)&&e>=0),v=()=>{c?.abort(),c=null};function y(e,n){if(typeof t.loadOptions==`function`)return t.loadOptions(e,{signal:n});let r=t.getAttribute(`source`),i=`${r}${r.includes(`?`)?`&`:`?`}q=${encodeURIComponent(e)}`;return fetch(i,{signal:n,credentials:`same-origin`,headers:{Accept:`application/json`}}).then(e=>{if(!e.ok)throw Error(`search request failed with status ${e.status}`);return e.json()})}function b(n,r,i){r?(e(`wui-select: search failed`,i),t.setPartOptions([]),t.setStatus(`empty`)):(t.setPartOptions(n),t.setStatus(n.length?`idle`:`empty`))}async function x(e,t,n){let r=[],i=!1,a=null;try{if(r=await y(e,n),!Array.isArray(r))throw TypeError(`search results must be an array`)}catch(e){i=!0,a=e??/* @__PURE__ */ Error(`search failed`)}finally{t===o&&(c=null,b(r,i,a))}}function S(e){let n=o;v(),m()?(f=!0,t.setStatus(`loading`)):(c=new AbortController,t.setStatus(`loading`),x(e,n,c.signal))}let C=(e,n)=>t.dispatchEvent(new CustomEvent(`search`,{bubbles:!0,detail:{query:e,seq:n}}));function w(e){o+=1,v(),clearTimeout(s),s=null,e.trim().length<g()?(t.setPartOptions([]),t.setStatus(`hint`)):(C(e,o),S(e))}return{mount(e,n,r={}){t=e,a=n;let i=a.search?.value??``;a.search&&r.carry?.query&&i===``&&(a.search.value=r.carry.query),i.trim()!==``&&t._onQueryChange(i)},onQuery(e){if(o+=1,v(),clearTimeout(s),s=null,u=e,d=null,f=!1,!p())return!1;if(e.trim().length<g())return t.setPartOptions([]),t.setStatus(`hint`),!0;let n=o;return s=setTimeout(()=>{s=null,C(e,n),S(e)},_()),!0},onOpen(){if(p()){if(d!==null){let e=d;d=null,w(e)}else g()===0&&t._query.trim()===``&&w(``)}},onOptions(){f&&(f=!1,t.setStatus(t.options.length?`idle`:`empty`))},onBlur(){if(t.mode!==`search`||!t.hasAttribute(`allow-custom`))return!1;let e=(a.search?.value??``).trim();if(!e||e===String(t.value)||i(t,e))return!1;let r=n(t,e);return r?(t.setError(r),!1):(t.commit(e,{isCustom:!0}),!0)},actionRow(e){if(l=null,t.mode===`tag`||!t.hasAttribute(`allow-custom`))return null;let n=e.trim();return!n||i(t,n)?null:(l={position:`bottom`,label:(t.getAttribute(`add-label`)??`Add '{query}'`).replaceAll(`{query}`,n),value:n},l)},onPick(e){if(!l||e.value!==l.value||e.label!==l.label)return!1;let n=l.value;return l=null,t.commit(n,{isCustom:!0}),!0},renderValue(){let e=t.value;if(!e||t.options.some(t=>String(t.value)===String(e)))return!1;let n=t.getAttribute(`value-label`);return n?(a.value.classList.remove(`wui-select-placeholder`),a.value.textContent=n,!0):!1},teardown(){(s!==null||c!==null||f)&&(d=u),f=!1,o+=1,clearTimeout(s),s=null,v(),l=null}}}export{a as default};
1
+ import{n as e}from"./devWarn-DXdRWZs3.js";import{i as t}from"./optionLabel-CLemms21.js";import{t as n}from"./customRule-BE7CusA3.js";import{n as r}from"./WuiSelect-oSJPev4N.js";var i=(e,n)=>{let r=n.toLowerCase(),i=e.getAttribute(`value-label`);return i&&String(e.value??``)!==``&&i.toLowerCase()===r?!0:e.options.some(e=>t(e).toLowerCase()===r||String(e.value??``).toLowerCase()===r)};function a(){let t=null,a=null,o=0,s=null,c=null,l=null,u=``,d=null,f=!1,p=()=>r(t),m=()=>typeof t.loadOptions!=`function`&&!t.getAttribute(`source`),h=(e,n,r)=>{let i=t.getAttribute(e);if(i==null||i.trim()===``)return n;let a=Number(i);return r(a)?a:n},g=()=>h(`min-chars`,1,e=>Number.isInteger(e)&&e>=0),_=()=>h(`debounce`,250,e=>Number.isFinite(e)&&e>=0),v=()=>{c?.abort(),c=null};function y(e,n){if(typeof t.loadOptions==`function`)return t.loadOptions(e,{signal:n});let r=t.getAttribute(`source`),i=`${r}${r.includes(`?`)?`&`:`?`}q=${encodeURIComponent(e)}`;return fetch(i,{signal:n,credentials:`same-origin`,headers:{Accept:`application/json`}}).then(e=>{if(!e.ok)throw Error(`search request failed with status ${e.status}`);return e.json()})}function b(n,r,i){r?(e(`wui-select: search failed`,i),t.setPartOptions([]),t.setStatus(`empty`)):(t.setPartOptions(n),t.setStatus(n.length?`idle`:`empty`))}async function x(e,t,n){let r=[],i=!1,a=null;try{if(r=await y(e,n),!Array.isArray(r))throw TypeError(`search results must be an array`)}catch(e){i=!0,a=e??/* @__PURE__ */ Error(`search failed`)}finally{t===o&&(c=null,b(r,i,a))}}function S(e){let n=o;v(),m()?(f=!0,t.setStatus(`loading`)):(c=new AbortController,t.setStatus(`loading`),x(e,n,c.signal))}let C=(e,n)=>t.dispatchEvent(new CustomEvent(`search`,{bubbles:!0,detail:{query:e,seq:n}}));function w(e){o+=1,v(),clearTimeout(s),s=null,e.trim().length<g()?(t.setPartOptions([]),t.setStatus(`hint`)):(C(e,o),S(e))}return{mount(e,n,r={}){t=e,a=n;let i=a.search?.value??``;a.search&&r.carry?.query&&i===``&&(a.search.value=r.carry.query),i.trim()!==``&&t._onQueryChange(i)},onQuery(e){if(o+=1,v(),clearTimeout(s),s=null,u=e,d=null,f=!1,!p())return!1;if(e.trim().length<g())return t.setPartOptions([]),t.setStatus(`hint`),!0;let n=o;return s=setTimeout(()=>{s=null,C(e,n),S(e)},_()),!0},onOpen(){if(p()){if(d!==null){let e=d;d=null,w(e)}else g()===0&&t._query.trim()===``&&w(``)}},onOptions(){f&&(f=!1,t.setStatus(t.options.length?`idle`:`empty`))},onBlur(){if(t.mode!==`search`||!t.hasAttribute(`allow-custom`))return!1;let e=(a.search?.value??``).trim();if(!e||e===String(t.value)||i(t,e))return!1;let r=n(t,e);return r?(t.setError(r),!1):(t.commit(e,{isCustom:!0}),!0)},actionRow(e){if(l=null,t.mode===`tag`||!t.hasAttribute(`allow-custom`))return null;let n=e.trim();return!n||i(t,n)?null:(l={position:`bottom`,label:(t.getAttribute(`add-label`)??`Add '{query}'`).replaceAll(`{query}`,n),value:n},l)},onPick(e){if(!l||e.value!==l.value||e.label!==l.label)return!1;let n=l.value;return l=null,t.commit(n,{isCustom:!0}),!0},renderValue(){let e=t.value;if(!e||t.options.some(t=>String(t.value)===String(e)))return!1;let n=t.getAttribute(`value-label`);return n?(a.value.classList.remove(`wui-select-placeholder`),a.value.textContent=n,!0):!1},teardown(){(s!==null||c!==null||f)&&(d=u),f=!1,o+=1,clearTimeout(s),s=null,v(),l=null}}}export{a as default};
package/dist/server.js CHANGED
@@ -1 +1 @@
1
- import{C as e,S as t,T as n,_ as r,a as i,b as a,c as o,d as s,f as c,g as l,h as u,i as d,l as f,m as p,n as m,o as h,p as g,r as _,s as v,t as y,u as b,v as x,w as S,x as C,y as w}from"./drawerDiscard-YjDBwb2_.js";import{a as T,c as E,d as D,i as O,l as k,n as A,o as j,r as M,s as N,t as P,u as F}from"./wuiHttp-DgnM7K2Q.js";var I=31536e3,L=/* @__PURE__ */ new WeakMap,R=e=>e>99?`99+`:String(e),z=(e,t)=>Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{${t}}`,()=>String(n)),e);function B(e,t,n=document){try{n.cookie=`${e}=${t?`1`:`0`}; Path=/; Max-Age=${I}; SameSite=Lax`}catch(e){if(!(e instanceof DOMException&&e.name===`SecurityError`))throw e}}function V(e,t,n,r=document){try{let i=`${e}=`,a=r.cookie.split(`;`).map(e=>e.trim()).find(e=>e.startsWith(i)),o=new Set(a?a.slice(i.length).split(`.`).filter(Boolean):[]);n?o.add(t):o.delete(t),r.cookie=`${e}=${[...o].join(`.`)}; Path=/; Max-Age=${I}; SameSite=Lax`}catch(e){if(!(e instanceof DOMException&&e.name===`SecurityError`))throw e}}var H=e=>{let t=document.createElement(`template`);return t.innerHTML=e,t.content},U=(e,t)=>{let n=document.createElement(`div`);return n.className=e,n.textContent=t,n};function W(e,t){let n=e.querySelector(`.wui-bell-trigger`),r=e.querySelector(`.wui-bell-count`),i=e.querySelector(`[data-wui-bell-live]`),a=e.querySelector(`[data-wui-bell-list]`),o=e.querySelector(`.wui-bell-menu`),{src:s,readAction:c}=e.dataset,l=e.dataset.label||`Notifications`,u=e.dataset.emptyText||`You are all caught up.`,d=e.dataset.loadingText??`Loading…`,f=e.dataset.noUnreadText??`No unread notifications`,p=e.dataset.unreadText??`{count} unread notifications`,m=e.dataset.bellLabel??`{label}, {count} unread`,h=Number(e.dataset.pollSeconds??60),g=N(),_=Number(e.dataset.unread)||0,v=(t,a=!0)=>{let o=Math.max(0,Number(t)||0),s=o!==_;_=o,e.dataset.unread=String(o),r&&(r.textContent=R(o),r.hidden=o===0),n?.setAttribute(`aria-label`,o===0?l:z(m,{label:l,count:R(o)})),a&&s&&i&&(i.textContent=o===0?f:z(p,{count:R(o)}))},y=()=>o?.classList.contains(`show`)??!1,b=()=>{let e=U(`wui-bell-state`,`Could not load notifications. `),t=document.createElement(`button`);t.type=`button`,t.className=`btn btn-link btn-sm`,t.dataset.wuiBellRetry=``,t.textContent=`Retry`,e.append(t),a.replaceChildren(e)},x=async t=>{t&&(a.setAttribute(`aria-busy`,`true`),a.querySelector(`.wui-bell-item`)||a.replaceChildren(U(`wui-bell-state`,d)));let n=await g.run(s);if(n.kind===`aborted`||n.kind===`stale`||n.kind===`session`)return;if(a.removeAttribute(`aria-busy`),!n.ok){t&&b();return}let r=H(n.html),i=r.querySelector(`[data-wui-unread]`),o=i?Number(i.getAttribute(`data-wui-unread`)):_;v(o),(t||y())&&(r.querySelector(`.wui-bell-item`)?a.replaceChildren(r):a.replaceChildren(U(`wui-bell-state`,u))),e.dispatchEvent(new CustomEvent(`wui:notifications:loaded`,{bubbles:!0,detail:{unread:o}}))};e.addEventListener(`show.bs.dropdown`,()=>x(!0)),e.addEventListener(`click`,async e=>{if(e.target.closest(`[data-wui-bell-retry]`)){await x(!0);return}let t=e.target.closest(`[data-wui-bell-read]`);if(!t||!c)return;t.disabled=!0;let n=await k(c,{method:`POST`});t.disabled=!1,n.ok&&(v(0),await x(!0))});let S=null,C=()=>{h>0&&S===null&&(S=setInterval(()=>x(y()),h*1e3))},w=()=>{S!==null&&clearInterval(S),S=null},T=()=>{document.hidden?w():(x(y()),C())};return h>0&&(document.addEventListener(`visibilitychange`,T),document.hidden||C()),t.push(()=>{w(),g.abort(),document.removeEventListener(`visibilitychange`,T)}),{setUnread:e=>v(e),refresh:()=>x(y())}}var G=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName)),K=(e,t,n)=>`${e}${e.includes(`?`)?`&`:`?`}${encodeURIComponent(t)}=${encodeURIComponent(n)}`;function q(e,t){let n=e.querySelector(`input.search-input`),r=e.querySelector(`.wui-topsearch-results`),i=e.querySelector(`.wui-topsearch-open`),a=e.querySelector(`[data-wui-topsearch-live]`),{src:o,param:s=`q`,resultsHref:c}=e.dataset,l=Number(e.dataset.minChars??2),u=Number(e.dataset.debounceMs??250),d=e.dataset.noResultsText??`No results`,f=e.dataset.resultsCountText??`{count} results`,p=e.dataset.resultCountText??`{count} result`,m=N(),h=null,g=-1,_=()=>[...r.querySelectorAll(`.wui-topsearch-hit`)],v=e=>{let t=_();g=t.length===0?-1:(e+t.length)%t.length,t.forEach((e,t)=>{let n=t===g;e.classList.toggle(`is-active`,n),e.setAttribute(`aria-selected`,n?`true`:`false`)}),g>=0?(n.setAttribute(`aria-activedescendant`,t[g].id),t[g].scrollIntoView?.({block:`nearest`})):n.removeAttribute(`aria-activedescendant`)},y=()=>{r.hidden=!0,n.setAttribute(`aria-expanded`,`false`),n.removeAttribute(`aria-activedescendant`),g=-1},b=()=>{r.hidden=!1,n.setAttribute(`aria-expanded`,`true`)},x=t=>{e.classList.toggle(`is-open`,t),i?.setAttribute(`aria-expanded`,t?`true`:`false`)},S=t=>{let n=new CustomEvent(`wui:search:select`,{bubbles:!0,cancelable:!0,detail:{href:t}});e.dispatchEvent(n)&&window.location.assign(t)},C=async t=>{e.classList.add(`is-loading`);let n=await m.run(K(o,s,t));if(n.kind!==`aborted`&&n.kind!==`stale`&&n.kind!==`session`){if(e.classList.remove(`is-loading`),n.ok){let e=H(n.html),t=e.querySelector(`[data-wui-count]`);r.replaceChildren(e),_().forEach((e,t)=>{e.id=`${r.id}-opt-${t}`});let i=t?Number(t.getAttribute(`data-wui-count`)):_().length;a&&(a.textContent=i===0?d:z(i===1?p:f,{count:i}))}else r.replaceChildren(U(`wui-topsearch-empty`,`Search is unavailable right now.`));g=-1,b()}};n.addEventListener(`input`,()=>{clearTimeout(h);let t=n.value.trim();t.length<l?(m.abort(),e.classList.remove(`is-loading`),r.replaceChildren(),y()):h=setTimeout(()=>C(t),u)}),n.addEventListener(`keydown`,t=>{if(t.key===`ArrowDown`||t.key===`ArrowUp`){if(r.hidden||_().length===0)return;t.preventDefault(),v(g+(t.key===`ArrowDown`?1:-1))}else if(t.key===`Enter`){let e=_();!r.hidden&&g>=0&&e[g]?(t.preventDefault(),S(e[g].getAttribute(`href`))):c&&n.value.trim()!==``&&(t.preventDefault(),S(K(c,s,n.value.trim())))}else t.key===`Escape`&&(r.hidden?e.classList.contains(`is-open`)&&(t.preventDefault(),t.stopPropagation(),x(!1),i?.focus()):(t.preventDefault(),t.stopPropagation(),y()))}),r.addEventListener(`click`,e=>{let t=e.target.closest(`.wui-topsearch-hit`);!t||e.ctrlKey||e.metaKey||e.shiftKey||e.button===1||(e.preventDefault(),S(t.getAttribute(`href`)))}),i?.addEventListener(`click`,()=>{let t=!e.classList.contains(`is-open`);x(t),t&&n.focus()});let w=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||G(e.target)||(e.preventDefault(),x(!0),n.focus())},T=t=>{e.contains(t.target)||(y(),e.classList.contains(`is-open`)&&x(!1))};document.addEventListener(`keydown`,w),document.addEventListener(`pointerdown`,T),t.push(()=>{clearTimeout(h),m.abort(),document.removeEventListener(`keydown`,w),document.removeEventListener(`pointerdown`,T)})}function J(e){let t=[],n=e.dataset.wuiCollapsedCookie;n&&e.addEventListener(`wui:shell:collapse`,e=>B(n,!!e.detail?.collapsed));let r=e.dataset.wuiFoldedCookie;r&&e.addEventListener(`wui:shell:nav-fold`,e=>V(r,e.detail?.key,!!e.detail?.folded)),e.addEventListener(`click`,t=>{t.target.closest(`[data-wui-tabbar-more]`)&&e.querySelector(`[data-app-shell-menu]`)?.click()});let i=e.querySelector(`[data-wui-bell]`),a=i?W(i,t):null,o=e.querySelector(`[data-wui-topsearch]`);o&&q(o,t);let s={el:e,setUnread(e){if(!a)throw Error(`WUI.shell: this <app-shell> has no <app-shell-notifications>.`);a.setUnread(e)},refreshNotifications(){if(!a)throw Error(`WUI.shell: this <app-shell> has no <app-shell-notifications>.`);return a.refresh()},get collapsed(){return e.classList.contains(`collapsed`)},set collapsed(t){if(!!t===e.classList.contains(`collapsed`))return;let n=e.querySelector(`[data-app-shell-collapse]`);n?n.click():e.classList.toggle(`collapsed`,!!t)}};L.set(e,s);let c=n=>{if(n.target===e||n.target.contains?.(e)){for(let e of t)e();L.delete(e),delete e.dataset.wuiPartsWired,document.removeEventListener(`wui:teardown`,c)}};return document.addEventListener(`wui:teardown`,c),s}function Y(e=document){let t=[];e instanceof Element&&e.matches(`[data-app-shell]`)&&t.push(e),t.push(...e.querySelectorAll(`[data-app-shell]`));for(let e of t)e.dataset.wuiPartsWired||(e.dataset.wuiPartsWired=`1`,J(e))}function X(e){let t=e?.closest?.(`[data-app-shell]`)??null;return t?(L.has(t)||Y(t),L.get(t)??null):null}export{f as CONFIRM_DIALOG_ID,b as CONFIRM_TONES,P as CSRF_META_NAME,A as DEFAULT_CSRF_HEADER,y as DISCARD_EVENT,m as DISCARD_TEXT,s as FLASH_STORAGE_KEY,c as FLASH_VARIANTS,M as HTTP_KINDS,g as SERVER_ACTION_TEXT,F as TOAST_ACTION_METHODS,x as TOAST_ACTION_MS,i as UNSAVED_TEXT,O as WUI_HEADERS,T as classifyStatus,C as closeRemotePane,j as configureCsrf,p as confirmAction,_ as createDiscardPrompt,N as createRequestQueue,h as formValues,l as getServerTable,X as getShell,d as initDrawerDiscard,t as initRemoteModals,u as initServerActions,r as initServerTables,Y as initShellParts,v as initUnsavedChanges,e as loadRemoteDrawer,S as loadRemoteModal,n as loadRemotePane,D as parseToastAction,E as readCsrf,o as resetUnsavedChanges,w as runToastAction,a as showResultToast,k as wuiFetch};
1
+ import{C as e,S as t,T as n,_ as r,a as i,b as a,c as o,d as s,f as c,g as l,h as u,i as d,l as f,m as p,n as m,o as h,p as g,r as _,s as v,t as y,u as b,v as x,w as S,x as C,y as w}from"./drawerDiscard-D6YgF59q.js";import{a as T,c as E,d as D,i as O,l as k,n as A,o as j,r as M,s as N,t as P,u as F}from"./wuiHttp-BuaTcumE.js";var I=31536e3,L=/* @__PURE__ */ new WeakMap,R=e=>e>99?`99+`:String(e),z=(e,t)=>Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{${t}}`,()=>String(n)),e);function B(e,t,n=document){try{n.cookie=`${e}=${t?`1`:`0`}; Path=/; Max-Age=${I}; SameSite=Lax`}catch(e){if(!(e instanceof DOMException&&e.name===`SecurityError`))throw e}}function V(e,t,n,r=document){try{let i=`${e}=`,a=r.cookie.split(`;`).map(e=>e.trim()).find(e=>e.startsWith(i)),o=new Set(a?a.slice(i.length).split(`.`).filter(Boolean):[]);n?o.add(t):o.delete(t),r.cookie=`${e}=${[...o].join(`.`)}; Path=/; Max-Age=${I}; SameSite=Lax`}catch(e){if(!(e instanceof DOMException&&e.name===`SecurityError`))throw e}}var H=e=>{let t=document.createElement(`template`);return t.innerHTML=e,t.content},U=(e,t)=>{let n=document.createElement(`div`);return n.className=e,n.textContent=t,n};function W(e,t){let n=e.querySelector(`.wui-bell-trigger`),r=e.querySelector(`.wui-bell-count`),i=e.querySelector(`[data-wui-bell-live]`),a=e.querySelector(`[data-wui-bell-list]`),o=e.querySelector(`.wui-bell-menu`),{src:s,readAction:c}=e.dataset,l=e.dataset.label||`Notifications`,u=e.dataset.emptyText||`You are all caught up.`,d=e.dataset.loadingText??`Loading…`,f=e.dataset.noUnreadText??`No unread notifications`,p=e.dataset.unreadText??`{count} unread notifications`,m=e.dataset.bellLabel??`{label}, {count} unread`,h=Number(e.dataset.pollSeconds??60),g=N(),_=Number(e.dataset.unread)||0,v=(t,a=!0)=>{let o=Math.max(0,Number(t)||0),s=o!==_;_=o,e.dataset.unread=String(o),r&&(r.textContent=R(o),r.hidden=o===0),n?.setAttribute(`aria-label`,o===0?l:z(m,{label:l,count:R(o)})),a&&s&&i&&(i.textContent=o===0?f:z(p,{count:R(o)}))},y=()=>o?.classList.contains(`show`)??!1,b=()=>{let e=U(`wui-bell-state`,`Could not load notifications. `),t=document.createElement(`button`);t.type=`button`,t.className=`btn btn-link btn-sm`,t.dataset.wuiBellRetry=``,t.textContent=`Retry`,e.append(t),a.replaceChildren(e)},x=async t=>{t&&(a.setAttribute(`aria-busy`,`true`),a.querySelector(`.wui-bell-item`)||a.replaceChildren(U(`wui-bell-state`,d)));let n=await g.run(s);if(n.kind===`aborted`||n.kind===`stale`||n.kind===`session`)return;if(a.removeAttribute(`aria-busy`),!n.ok){t&&b();return}let r=H(n.html),i=r.querySelector(`[data-wui-unread]`),o=i?Number(i.getAttribute(`data-wui-unread`)):_;v(o),(t||y())&&(r.querySelector(`.wui-bell-item`)?a.replaceChildren(r):a.replaceChildren(U(`wui-bell-state`,u))),e.dispatchEvent(new CustomEvent(`wui:notifications:loaded`,{bubbles:!0,detail:{unread:o}}))};e.addEventListener(`show.bs.dropdown`,()=>x(!0)),e.addEventListener(`click`,async e=>{if(e.target.closest(`[data-wui-bell-retry]`)){await x(!0);return}let t=e.target.closest(`[data-wui-bell-read]`);if(!t||!c)return;t.disabled=!0;let n=await k(c,{method:`POST`});t.disabled=!1,n.ok&&(v(0),await x(!0))});let S=null,C=()=>{h>0&&S===null&&(S=setInterval(()=>x(y()),h*1e3))},w=()=>{S!==null&&clearInterval(S),S=null},T=()=>{document.hidden?w():(x(y()),C())};return h>0&&(document.addEventListener(`visibilitychange`,T),document.hidden||C()),t.push(()=>{w(),g.abort(),document.removeEventListener(`visibilitychange`,T)}),{setUnread:e=>v(e),refresh:()=>x(y())}}var G=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName)),K=(e,t,n)=>`${e}${e.includes(`?`)?`&`:`?`}${encodeURIComponent(t)}=${encodeURIComponent(n)}`;function q(e,t){let n=e.querySelector(`input.search-input`),r=e.querySelector(`.wui-topsearch-results`),i=e.querySelector(`.wui-topsearch-open`),a=e.querySelector(`[data-wui-topsearch-live]`),{src:o,param:s=`q`,resultsHref:c}=e.dataset,l=Number(e.dataset.minChars??2),u=Number(e.dataset.debounceMs??250),d=e.dataset.noResultsText??`No results`,f=e.dataset.resultsCountText??`{count} results`,p=e.dataset.resultCountText??`{count} result`,m=N(),h=null,g=-1,_=()=>[...r.querySelectorAll(`.wui-topsearch-hit`)],v=e=>{let t=_();g=t.length===0?-1:(e+t.length)%t.length,t.forEach((e,t)=>{let n=t===g;e.classList.toggle(`is-active`,n),e.setAttribute(`aria-selected`,n?`true`:`false`)}),g>=0?(n.setAttribute(`aria-activedescendant`,t[g].id),t[g].scrollIntoView?.({block:`nearest`})):n.removeAttribute(`aria-activedescendant`)},y=()=>{r.hidden=!0,n.setAttribute(`aria-expanded`,`false`),n.removeAttribute(`aria-activedescendant`),g=-1},b=()=>{r.hidden=!1,n.setAttribute(`aria-expanded`,`true`)},x=t=>{e.classList.toggle(`is-open`,t),i?.setAttribute(`aria-expanded`,t?`true`:`false`)},S=t=>{let n=new CustomEvent(`wui:search:select`,{bubbles:!0,cancelable:!0,detail:{href:t}});e.dispatchEvent(n)&&window.location.assign(t)},C=async t=>{e.classList.add(`is-loading`);let n=await m.run(K(o,s,t));if(n.kind!==`aborted`&&n.kind!==`stale`&&n.kind!==`session`){if(e.classList.remove(`is-loading`),n.ok){let e=H(n.html),t=e.querySelector(`[data-wui-count]`);r.replaceChildren(e),_().forEach((e,t)=>{e.id=`${r.id}-opt-${t}`});let i=t?Number(t.getAttribute(`data-wui-count`)):_().length;a&&(a.textContent=i===0?d:z(i===1?p:f,{count:i}))}else r.replaceChildren(U(`wui-topsearch-empty`,`Search is unavailable right now.`));g=-1,b()}};n.addEventListener(`input`,()=>{clearTimeout(h);let t=n.value.trim();t.length<l?(m.abort(),e.classList.remove(`is-loading`),r.replaceChildren(),y()):h=setTimeout(()=>C(t),u)}),n.addEventListener(`keydown`,t=>{if(t.key===`ArrowDown`||t.key===`ArrowUp`){if(r.hidden||_().length===0)return;t.preventDefault(),v(g+(t.key===`ArrowDown`?1:-1))}else if(t.key===`Enter`){let e=_();!r.hidden&&g>=0&&e[g]?(t.preventDefault(),S(e[g].getAttribute(`href`))):c&&n.value.trim()!==``&&(t.preventDefault(),S(K(c,s,n.value.trim())))}else t.key===`Escape`&&(r.hidden?e.classList.contains(`is-open`)&&(t.preventDefault(),t.stopPropagation(),x(!1),i?.focus()):(t.preventDefault(),t.stopPropagation(),y()))}),r.addEventListener(`click`,e=>{let t=e.target.closest(`.wui-topsearch-hit`);!t||e.ctrlKey||e.metaKey||e.shiftKey||e.button===1||(e.preventDefault(),S(t.getAttribute(`href`)))}),i?.addEventListener(`click`,()=>{let t=!e.classList.contains(`is-open`);x(t),t&&n.focus()});let w=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||G(e.target)||(e.preventDefault(),x(!0),n.focus())},T=t=>{e.contains(t.target)||(y(),e.classList.contains(`is-open`)&&x(!1))};document.addEventListener(`keydown`,w),document.addEventListener(`pointerdown`,T),t.push(()=>{clearTimeout(h),m.abort(),document.removeEventListener(`keydown`,w),document.removeEventListener(`pointerdown`,T)})}function J(e){let t=[],n=e.dataset.wuiCollapsedCookie;n&&e.addEventListener(`wui:shell:collapse`,e=>B(n,!!e.detail?.collapsed));let r=e.dataset.wuiFoldedCookie;r&&e.addEventListener(`wui:shell:nav-fold`,e=>V(r,e.detail?.key,!!e.detail?.folded)),e.addEventListener(`click`,t=>{t.target.closest(`[data-wui-tabbar-more]`)&&e.querySelector(`[data-app-shell-menu]`)?.click()});let i=e.querySelector(`[data-wui-bell]`),a=i?W(i,t):null,o=e.querySelector(`[data-wui-topsearch]`);o&&q(o,t);let s={el:e,setUnread(e){if(!a)throw Error(`WUI.shell: this <app-shell> has no <app-shell-notifications>.`);a.setUnread(e)},refreshNotifications(){if(!a)throw Error(`WUI.shell: this <app-shell> has no <app-shell-notifications>.`);return a.refresh()},get collapsed(){return e.classList.contains(`collapsed`)},set collapsed(t){if(!!t===e.classList.contains(`collapsed`))return;let n=e.querySelector(`[data-app-shell-collapse]`);n?n.click():e.classList.toggle(`collapsed`,!!t)}};L.set(e,s);let c=n=>{if(n.target===e||n.target.contains?.(e)){for(let e of t)e();L.delete(e),delete e.dataset.wuiPartsWired,document.removeEventListener(`wui:teardown`,c)}};return document.addEventListener(`wui:teardown`,c),s}function Y(e=document){let t=[];e instanceof Element&&e.matches(`[data-app-shell]`)&&t.push(e),t.push(...e.querySelectorAll(`[data-app-shell]`));for(let e of t)e.dataset.wuiPartsWired||(e.dataset.wuiPartsWired=`1`,J(e))}function X(e){let t=e?.closest?.(`[data-app-shell]`)??null;return t?(L.has(t)||Y(t),L.get(t)??null):null}export{f as CONFIRM_DIALOG_ID,b as CONFIRM_TONES,P as CSRF_META_NAME,A as DEFAULT_CSRF_HEADER,y as DISCARD_EVENT,m as DISCARD_TEXT,s as FLASH_STORAGE_KEY,c as FLASH_VARIANTS,M as HTTP_KINDS,g as SERVER_ACTION_TEXT,F as TOAST_ACTION_METHODS,x as TOAST_ACTION_MS,i as UNSAVED_TEXT,O as WUI_HEADERS,T as classifyStatus,C as closeRemotePane,j as configureCsrf,p as confirmAction,_ as createDiscardPrompt,N as createRequestQueue,h as formValues,l as getServerTable,X as getShell,d as initDrawerDiscard,t as initRemoteModals,u as initServerActions,r as initServerTables,Y as initShellParts,v as initUnsavedChanges,e as loadRemoteDrawer,S as loadRemoteModal,n as loadRemotePane,D as parseToastAction,E as readCsrf,o as resetUnsavedChanges,w as runToastAction,a as showResultToast,k as wuiFetch};