@webority/ui-elements 0.80.8 → 0.80.9

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 (36) hide show
  1. package/dist/{WuiNotificationCenter-DAjq5oUU.js → WuiNotificationCenter-D8z-xECD.js} +1 -1
  2. package/dist/{WuiSlider-D2cfvAPE.js → WuiSlider-IOqadOtK.js} +5 -3
  3. package/dist/elements/notification-center.js +1 -1
  4. package/dist/elements/slider.js +1 -1
  5. package/dist/helpers.js +1 -1
  6. package/dist/{notificationDays-pYmoU0g6.js → notificationDays-BUoh4mG6.js} +1 -1
  7. package/dist/themeTransition-DbKWgZ9M.js +1 -0
  8. package/dist/ui-elements/autocomplete.global.js +1 -1
  9. package/dist/ui-elements/carousel.global.js +1 -1
  10. package/dist/ui-elements/code-block.global.js +1 -1
  11. package/dist/ui-elements/command-palette.global.js +1 -1
  12. package/dist/ui-elements/comment-thread.global.js +1 -1
  13. package/dist/ui-elements/consent-banner.global.js +1 -1
  14. package/dist/ui-elements/context-menu.global.js +1 -1
  15. package/dist/ui-elements/date-range.global.js +1 -1
  16. package/dist/ui-elements/drawer.global.js +1 -1
  17. package/dist/ui-elements/image-crop.global.js +1 -1
  18. package/dist/ui-elements/inline-edit.global.js +1 -1
  19. package/dist/ui-elements/kanban.global.js +1 -1
  20. package/dist/ui-elements/lightbox.global.js +1 -1
  21. package/dist/ui-elements/menubar.global.js +1 -1
  22. package/dist/ui-elements/multiselect.global.js +1 -1
  23. package/dist/ui-elements/phone.global.js +1 -1
  24. package/dist/ui-elements/resizable.global.js +1 -1
  25. package/dist/ui-elements/slider.global.js +6 -4
  26. package/dist/ui-elements/sortable.global.js +1 -1
  27. package/dist/ui-elements/status-icon.global.js +1 -1
  28. package/dist/ui-elements/taginput.global.js +1 -1
  29. package/dist/ui-elements/timepicker.global.js +1 -1
  30. package/dist/ui-elements/tour.global.js +1 -1
  31. package/dist/ui-elements/tree.global.js +1 -1
  32. package/dist/ui-elements/wizard.global.js +1 -1
  33. package/dist/ui-elements.global.js +2 -2
  34. package/dist/ui-elements.js +1 -1
  35. package/package.json +1 -1
  36. package/dist/themeTransition-Qv1SCQIB.js +0 -1
@@ -1 +1 @@
1
- import{t as e}from"./elementBase-DV9IZZCu.js";import{c as t}from"./wuiHttp-Cu7OPWr2.js";import{c as n,i as r,n as i,s as a}from"./notificationDays-pYmoU0g6.js";var o=`.wui-notification-center-trigger`,s=`.wui-notification-center-panel`,c=`.wui-notification-center-count`,l=`.wui-notification-center-live`,u=`.wui-notification-center-markall`,d=`.wui-notification-center-item`,f=`wui-notification-center-item-read`,p=`.wui-notification-center-unread-label`,m=class extends e{constructor(){super(),this._doc=null,this._unread=0,this._busy=!1,this._onClick=e=>this._click(e),this._onKeyDown=e=>this._key(e),this._onOutside=e=>{this.contains(e.target)||this.close()},this._onFocusOut=e=>{let t=e.relatedTarget;t instanceof Node&&!this.contains(t)&&this.close()}}connectedCallback(){this._doc=this.ownerDocument,this._unread=this._initialUnread(),this.addEventListener(`click`,this._onClick),this.addEventListener(`keydown`,this._onKeyDown),this._doc.addEventListener(`mousedown`,this._onOutside),this.addEventListener(`focusout`,this._onFocusOut),this._syncOpen()}disconnectedCallback(){this.removeEventListener(`click`,this._onClick),this.removeEventListener(`keydown`,this._onKeyDown),this._doc?.removeEventListener(`mousedown`,this._onOutside),this.removeEventListener(`focusout`,this._onFocusOut),this._doc=null}get isOpen(){return this.hasAttribute(`open`)}open(){this.isOpen||(this.setAttribute(`open`,``),this._syncOpen(),this.querySelector(s)?.focus(),this._announceToggle())}close({restoreFocus:e=!1}={}){this.isOpen&&(this.removeAttribute(`open`),this._syncOpen(),e&&this.querySelector(o)?.focus(),this._announceToggle())}toggle(){this.isOpen?this.close():this.open()}_announceToggle(){this.dispatchEvent(new CustomEvent(`wui:notification-center:toggle`,{bubbles:!0,detail:{open:this.isOpen}}))}_syncOpen(){this.querySelector(o)?.setAttribute(`aria-expanded`,this.isOpen?`true`:`false`)}_initialUnread(){let e=Number.parseInt(this.getAttribute(`unread`)??``,10);return Number.isInteger(e)&&e>=0?e:this.querySelectorAll(`${d}:not(.${f})`).length}_click(e){let t=e.target.closest?.(`${o}, ${u}, ${d}`);if(!(!t||!this.contains(t))){if(t.matches(o)){this.toggle();return}this.hasAttribute(`controlled`)||(t.matches(u)?this._markAll():this._markItem(t))}}_key(e){if(e.key===`Escape`&&this.isOpen){e.preventDefault(),e.stopPropagation(),this.close({restoreFocus:!0});return}if(!this.isOpen||!this.querySelector(s)?.contains(e.target))return;let t={ArrowDown:1,ArrowUp:-1,Home:`first`,End:`last`}[e.key];if(t===void 0)return;let n=[...this.querySelectorAll(d)];if(n.length===0)return;let r=n.indexOf(e.target.closest(d)),i;i=t===`first`?0:t===`last`?n.length-1:r===-1?t===1?0:n.length-1:Math.min(n.length-1,Math.max(0,r+t)),e.preventDefault(),n[i].focus()}_markItem(e){e.classList.contains(f)||(this._applyRead(e),this._unread=Math.max(0,this._unread-1),this._render(),this._say(n(this._unread)),this._emitRead([e.dataset.id].filter(Boolean),!1))}async _markAll(){if(this._busy)return;let e=[...this.querySelectorAll(`${d}:not(.${f})`)];if(e.length===0&&this._unread===0)return;let n=e.map(e=>e.dataset.id).filter(Boolean),r=this.getAttribute(`read-action`);if(r){this._setBusy(!0);let e=new URLSearchParams;for(let t of n)e.append(`ids`,t);let a=await t(r,{method:`POST`,body:e});if(this._setBusy(!1),!a.ok){if(a.kind===`session`||a.kind===`aborted`)return;let e=a.message||i.failed[a.kind]||i.failed.server;this._say(e),this.dispatchEvent(new CustomEvent(`wui:notification-center:failed`,{bubbles:!0,detail:{kind:a.kind,message:e}}));return}}for(let t of e)this._applyRead(t);this._unread=0,this._render(),this._say(i.allRead),this._emitRead(n,!0)}_applyRead(e){e.classList.add(f),e.querySelector(p)?.remove()}_setBusy(e){this._busy=e;let t=this.querySelector(u);t&&(t.disabled=e||this._unread===0,e?t.setAttribute(`aria-busy`,`true`):t.removeAttribute(`aria-busy`))}_render(){let e=this.querySelector(c);e&&(e.textContent=r(this._unread),e.hidden=this._unread===0),this.querySelector(o)?.setAttribute(`aria-label`,a(this.getAttribute(`label`)||i.label,this._unread));let t=this.querySelector(u);t&&(t.disabled=this._unread===0)}_say(e){let t=this.querySelector(l);t&&(t.textContent=e)}_emitRead(e,t){this.dispatchEvent(new CustomEvent(`wui:notification-center:read`,{bubbles:!0,detail:{ids:e,all:t}}))}};export{m as t};
1
+ import{t as e}from"./elementBase-DV9IZZCu.js";import{c as t}from"./wuiHttp-Cu7OPWr2.js";import{c as n,i as r,n as i,s as a}from"./notificationDays-BUoh4mG6.js";var o=`.wui-notification-center-trigger`,s=`.wui-notification-center-panel`,c=`.wui-notification-center-count`,l=`.wui-notification-center-live`,u=`.wui-notification-center-markall`,d=`.wui-notification-center-item`,f=`wui-notification-center-item-read`,p=`.wui-notification-center-unread-label`,m=class extends e{constructor(){super(),this._doc=null,this._unread=0,this._busy=!1,this._onClick=e=>this._click(e),this._onKeyDown=e=>this._key(e),this._onOutside=e=>{this.contains(e.target)||this.close()},this._onFocusOut=e=>{let t=e.relatedTarget;t instanceof Node&&!this.contains(t)&&this.close()}}connectedCallback(){this._doc=this.ownerDocument,this._unread=this._initialUnread(),this.addEventListener(`click`,this._onClick),this.addEventListener(`keydown`,this._onKeyDown),this._doc.addEventListener(`mousedown`,this._onOutside),this.addEventListener(`focusout`,this._onFocusOut),this._syncOpen()}disconnectedCallback(){this.removeEventListener(`click`,this._onClick),this.removeEventListener(`keydown`,this._onKeyDown),this._doc?.removeEventListener(`mousedown`,this._onOutside),this.removeEventListener(`focusout`,this._onFocusOut),this._doc=null}get isOpen(){return this.hasAttribute(`open`)}open(){this.isOpen||(this.setAttribute(`open`,``),this._syncOpen(),this.querySelector(s)?.focus(),this._announceToggle())}close({restoreFocus:e=!1}={}){this.isOpen&&(this.removeAttribute(`open`),this._syncOpen(),e&&this.querySelector(o)?.focus(),this._announceToggle())}toggle(){this.isOpen?this.close():this.open()}_announceToggle(){this.dispatchEvent(new CustomEvent(`wui:notification-center:toggle`,{bubbles:!0,detail:{open:this.isOpen}}))}_syncOpen(){this.querySelector(o)?.setAttribute(`aria-expanded`,this.isOpen?`true`:`false`)}_initialUnread(){let e=Number.parseInt(this.getAttribute(`unread`)??``,10);return Number.isInteger(e)&&e>=0?e:this.querySelectorAll(`${d}:not(.${f})`).length}_click(e){let t=e.target.closest?.(`${o}, ${u}, ${d}`);if(!(!t||!this.contains(t))){if(t.matches(o)){this.toggle();return}this.hasAttribute(`controlled`)||(t.matches(u)?this._markAll():this._markItem(t))}}_key(e){if(e.key===`Escape`&&this.isOpen){e.preventDefault(),e.stopPropagation(),this.close({restoreFocus:!0});return}if(!this.isOpen||!this.querySelector(s)?.contains(e.target))return;let t={ArrowDown:1,ArrowUp:-1,Home:`first`,End:`last`}[e.key];if(t===void 0)return;let n=[...this.querySelectorAll(d)];if(n.length===0)return;let r=n.indexOf(e.target.closest(d)),i;i=t===`first`?0:t===`last`?n.length-1:r===-1?t===1?0:n.length-1:Math.min(n.length-1,Math.max(0,r+t)),e.preventDefault(),n[i].focus()}_markItem(e){e.classList.contains(f)||(this._applyRead(e),this._unread=Math.max(0,this._unread-1),this._render(),this._say(n(this._unread)),this._emitRead([e.dataset.id].filter(Boolean),!1))}async _markAll(){if(this._busy)return;let e=[...this.querySelectorAll(`${d}:not(.${f})`)];if(e.length===0&&this._unread===0)return;let n=e.map(e=>e.dataset.id).filter(Boolean),r=this.getAttribute(`read-action`);if(r){this._setBusy(!0);let e=new URLSearchParams;for(let t of n)e.append(`ids`,t);let a=await t(r,{method:`POST`,body:e});if(this._setBusy(!1),!a.ok){if(a.kind===`session`||a.kind===`aborted`)return;let e=a.message||i.failed[a.kind]||i.failed.server;this._say(e),this.dispatchEvent(new CustomEvent(`wui:notification-center:failed`,{bubbles:!0,detail:{kind:a.kind,message:e}}));return}}for(let t of e)this._applyRead(t);this._unread=0,this._render(),this._say(i.allRead),this._emitRead(n,!0)}_applyRead(e){e.classList.add(f),e.querySelector(p)?.remove()}_setBusy(e){this._busy=e;let t=this.querySelector(u);t&&(t.disabled=e||this._unread===0,e?t.setAttribute(`aria-busy`,`true`):t.removeAttribute(`aria-busy`))}_render(){let e=this.querySelector(c);e&&(e.textContent=r(this._unread),e.hidden=this._unread===0),this.querySelector(o)?.setAttribute(`aria-label`,a(this.getAttribute(`label`)||i.label,this._unread));let t=this.querySelector(u);t&&(t.disabled=this._unread===0)}_say(e){let t=this.querySelector(l);t&&(t.textContent=e)}_emitRead(e,t){this.dispatchEvent(new CustomEvent(`wui:notification-center:read`,{bubbles:!0,detail:{ids:e,all:t}}))}};export{m as t};
@@ -1,8 +1,9 @@
1
1
  import{t as e}from"./elementBase-DV9IZZCu.js";import{t}from"./formMirror-BgY7zkC3.js";var n=class extends e{static formAssociated=!0;static get observedAttributes(){return[`min`,`max`,`step`,`value`,`start`,`end`,`name`,`start-name`,`end-name`,`disabled`,`size`,`show-value`,`unit`,`aria-label`]}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._value=50,this._start=25,this._end=75,this._isDragging=!1,this._dragThumb=null,this._pointerDownListener=null,this._pointerMoveListener=null,this._pointerUpListener=null,this._thumbKeyListener=null,this._trackClickListener=null}connectedCallback(){if(!this._rendered){this.render();return}this._wire()}get value(){return this._value}set value(e){this._value=this._snapToStep(this._clamp(r(e,this._value))),this._syncValue(),this._syncMirrors()}get start(){return this._start}set start(e){this._start=Math.min(this._snapToStep(this._clamp(r(e,this._start))),this._end),this._syncValue(),this._syncMirrors()}get end(){return this._end}set end(e){this._end=Math.max(this._snapToStep(this._clamp(r(e,this._end))),this._start),this._syncValue(),this._syncMirrors()}attributeChangedCallback(e,t,n){if(e===`value`||e===`start`||e===`end`||e===`min`||e===`max`||e===`step`){this._updateFromAttribute(e),this._rendered&&(this._syncValue(),this._syncMirrors());return}this._rendered&&this.render()}formResetCallback(){this._isRange()?this._resetRange():this._resetSingle()}_updateFromAttribute(e){e===`value`?this._value=this._snapToStep(this._clamp(r(this.getAttribute(`value`),this._value))):e===`start`?this._start=this._snapToStep(this._clamp(r(this.getAttribute(`start`),this._start))):e===`end`&&(this._end=this._snapToStep(this._clamp(r(this.getAttribute(`end`),this._end))))}_isRange(){return this.hasAttribute(`range`)}_min(){return r(this.getAttribute(`min`),0)}_max(){return r(this.getAttribute(`max`),100)}_step(){return r(this.getAttribute(`step`),1)}_clamp(e){return Math.max(this._min(),Math.min(e,this._max()))}_snapToStep(e){let t=this._step();if(t<=0)return e;let n=this._min();return this._clamp(n+Math.round((e-n)/t)*t)}_captureDefaults(){this._defaultsCaptured||=(this._isRange()?(this._defaultStart=this._start,this._defaultEnd=this._end):this._defaultValue=this._value,!0)}_resetSingle(){this._value=this._defaultValue??50,this._syncValue(),this._syncMirrors()}_resetRange(){this._start=this._defaultStart??25,this._end=this._defaultEnd??75,this._syncValue(),this._syncMirrors()}render(){this._captureDefaults();let e=this._min(),t=this._max(),n=this._isRange(),r=this.getAttribute(`size`),a=r===`sm`?` slider-sm`:r===`lg`?` slider-lg`:``,o=this.hasAttribute(`disabled`);n?(this._start=this._clamp(this._start),this._end=this._clamp(this._end),this._start>this._end&&([this._start,this._end]=[this._end,this._start])):this._value=this._clamp(this._value),this.innerHTML=`
2
2
  <div class="slider${a}">
3
- <div class="slider-track" role="presentation"></div>
4
- <div class="slider-fill" role="presentation"></div>
5
- ${n?`
3
+ <div class="wui-slider-rail">
4
+ <div class="slider-track" role="presentation"></div>
5
+ <div class="slider-fill" role="presentation"></div>
6
+ ${n?`
6
7
  <button
7
8
  type="button"
8
9
  role="slider"
@@ -41,6 +42,7 @@ import{t as e}from"./elementBase-DV9IZZCu.js";import{t}from"./formMirror-BgY7zkC
41
42
  aria-label="${i(this.getAttribute(`aria-label`)||`Value`)}"
42
43
  ></button>
43
44
  `}
45
+ </div>
44
46
  ${this.hasAttribute(`show-value`)?n?`<span class="slider-value">${this._formatValue(this._start)} to ${this._formatValue(this._end)}</span>`:`<span class="slider-value">${this._formatValue(this._value)}</span>`:``}
45
47
  </div>
46
48
  `,this._rendered=!0,this._placeParts(),this._syncMirrors(),this._wire()}_formatValue(e){return`${e}${this.getAttribute(`unit`)||``}`}_placeParts(){let e=this._min(),t=this._max(),n=n=>t===e?0:(n-e)/(t-e),r=this._isRange(),i=r?n(this._start):0,a=n(r?this._end:this._value),o=this.querySelector(`.slider-fill`);o&&(o.style.left=`${i*100}%`,o.style.right=`${100-a*100}%`,r&&o.style.setProperty(`--wui-fill-start`,String(i)),o.style.setProperty(`--wui-fill-end`,String(a)));let s=(e,t)=>{e&&(e.style.left=`${t*100}%`,e.style.setProperty(`--wui-t`,String(t)))};r?(s(this.querySelector(`[data-thumb="start"]`),i),s(this.querySelector(`[data-thumb="end"]`),a)):s(this.querySelector(`.slider-thumb`),a)}_syncValue(){if(this._rendered)if(this._placeParts(),this._isRange()){let e=this.querySelector(`[data-thumb="start"]`),t=this.querySelector(`[data-thumb="end"]`);e&&(e.setAttribute(`aria-valuenow`,String(this._start)),e.setAttribute(`aria-valuetext`,this._formatValue(this._start))),t&&(t.setAttribute(`aria-valuenow`,String(this._end)),t.setAttribute(`aria-valuetext`,this._formatValue(this._end)));let n=this.querySelector(`.slider-value`);n&&(n.textContent=`${this._formatValue(this._start)} to ${this._formatValue(this._end)}`)}else{let e=this.querySelector(`.slider-thumb`);e&&(e.setAttribute(`aria-valuenow`,String(this._value)),e.setAttribute(`aria-valuetext`,this._formatValue(this._value)));let t=this.querySelector(`.slider-value`);t&&(t.textContent=this._formatValue(this._value))}}_syncMirrors(){this._isRange()?this._syncRangeMirrors():this._syncSingleMirror()}_syncSingleMirror(){this.getAttribute(`name`)&&t(this,String(this._value))}_syncRangeMirrors(){let e=this.getAttribute(`start-name`)||this.getAttribute(`name`),t=this.getAttribute(`end-name`);this._mirrorRange(`start`,e,this._start),this._mirrorRange(`end`,t,this._end)}_mirrorRange(e,t,n){if(!t)return;let r=this.querySelector(`input[type="hidden"][data-slider-mirror="${e}"]`);r||(r=document.createElement(`input`),r.type=`hidden`,r.setAttribute(`data-slider-mirror`,e),this.appendChild(r)),r.name=t,r.value=String(n),r.disabled=this.hasAttribute(`disabled`)}_valueAtPosition(e){let t=this.querySelector(`.slider-track`);if(!t)return this._min();let n=t.getBoundingClientRect(),r=this.querySelector(`.slider-thumb`),i=r?r.offsetWidth/2:0,a=n.width-i*2,o=a>0?Math.max(0,Math.min(1,(e-n.left-i)/a)):0,s=this._min()+o*(this._max()-this._min());return this._snapToStep(s)}_nearestThumb(e){return Math.abs(e-this._start)<=Math.abs(e-this._end)?`start`:`end`}_wire(){if(this._teardown(),this.hasAttribute(`disabled`))return;let e=this.querySelectorAll(`.slider-thumb`),t=this.querySelector(`.slider-track`),n=this._isRange();this._pointerDownListener=e=>{if(this.hasAttribute(`disabled`))return;let t=e.target.closest(`.slider-thumb`);t&&(e.preventDefault(),this._isDragging=!0,this._dragThumb=t.getAttribute(`data-thumb`),document.addEventListener(`pointermove`,this._pointerMoveListener),document.addEventListener(`pointerup`,this._pointerUpListener),document.addEventListener(`pointercancel`,this._pointerUpListener))},this._pointerMoveListener=e=>{if(!this._isDragging)return;e.preventDefault();let t=this._valueAtPosition(e.clientX);if(this._dragThumb===`single`)this._value=this._clamp(t),this._syncValue(),this.dispatchEvent(new CustomEvent(`slide`,{detail:{value:this._value}}));else if(this._dragThumb===`start`){let e=Math.min(t,this._end);this._start=this._clamp(e),this._syncValue(),this.dispatchEvent(new CustomEvent(`slide`,{detail:{start:this._start,end:this._end}}))}else if(this._dragThumb===`end`){let e=Math.max(t,this._start);this._end=this._clamp(e),this._syncValue(),this.dispatchEvent(new CustomEvent(`slide`,{detail:{start:this._start,end:this._end}}))}},this._pointerUpListener=()=>{this._isDragging&&(this._isDragging=!1,this._dragThumb=null,document.removeEventListener(`pointermove`,this._pointerMoveListener),document.removeEventListener(`pointerup`,this._pointerUpListener),document.removeEventListener(`pointercancel`,this._pointerUpListener),this._syncMirrors(),this.dispatchEvent(new Event(`change`,{bubbles:!0})))},this._thumbKeyListener=e=>{let t=e.currentTarget;if(this.hasAttribute(`disabled`))return;let n=this._step(),r=n*10,i=null,a=t.getAttribute(`data-thumb`),o=a===`end`?this._end:a===`start`?this._start:this._value;e.key===`ArrowLeft`||e.key===`ArrowDown`?(e.preventDefault(),i=o-n):e.key===`ArrowRight`||e.key===`ArrowUp`?(e.preventDefault(),i=o+n):e.key===`PageDown`?(e.preventDefault(),i=o-r):e.key===`PageUp`?(e.preventDefault(),i=o+r):e.key===`Home`?(e.preventDefault(),i=this._min()):e.key===`End`&&(e.preventDefault(),i=this._max()),i!=null&&(i=this._clamp(i),a===`single`?this._value=i:a===`start`?this._start=Math.min(i,this._end):a===`end`&&(this._end=Math.max(i,this._start)),this._syncValue(),this._syncMirrors(),this.dispatchEvent(new Event(`change`,{bubbles:!0})))},this._trackClickListener=e=>{if(this.hasAttribute(`disabled`))return;let t=this._valueAtPosition(e.clientX);n?this._nearestThumb(t)===`start`?this._start=Math.min(this._clamp(t),this._end):this._end=Math.max(this._clamp(t),this._start):this._value=this._clamp(t),this._syncValue(),this._syncMirrors(),this.dispatchEvent(new Event(`change`,{bubbles:!0}))},e.forEach(e=>{e.addEventListener(`pointerdown`,this._pointerDownListener),e.addEventListener(`keydown`,this._thumbKeyListener)}),t?.addEventListener(`click`,this._trackClickListener)}_teardown(){for(let e of this.querySelectorAll(`.slider-thumb`))e.removeEventListener(`pointerdown`,this._pointerDownListener),e.removeEventListener(`keydown`,this._thumbKeyListener);document.removeEventListener(`pointermove`,this._pointerMoveListener),document.removeEventListener(`pointerup`,this._pointerUpListener),document.removeEventListener(`pointercancel`,this._pointerUpListener),this._isDragging=!1,this._dragThumb=null,this.querySelector(`.slider-track`)?.removeEventListener(`click`,this._trackClickListener)}disconnectedCallback(){this._teardown()}},r=(e,t)=>{let n=Number.parseFloat(e);return Number.isFinite(n)?n:t},i=e=>String(e??``).replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`);export{n as t};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-DV9IZZCu.js";import{t}from"../WuiNotificationCenter-DAjq5oUU.js";e(`wui-notification-center`,t);export{t as WuiNotificationCenter};
1
+ import{n as e}from"../elementBase-DV9IZZCu.js";import{t}from"../WuiNotificationCenter-D8z-xECD.js";e(`wui-notification-center`,t);export{t as WuiNotificationCenter};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-DV9IZZCu.js";import{t}from"../WuiSlider-D2cfvAPE.js";e(`wui-slider`,t);export{t as WuiSlider};
1
+ import{n as e}from"../elementBase-DV9IZZCu.js";import{t}from"../WuiSlider-IOqadOtK.js";e(`wui-slider`,t);export{t as WuiSlider};
package/dist/helpers.js CHANGED
@@ -1 +1 @@
1
- import{a as e,c as t,d as n,f as r,i,l as a,m as o,n as s,o as c,p as l,r as u,s as d,t as f,u as p}from"./shortcutKeys-BQiDpsTJ.js";import{a as m,c as h,d as g,f as _,h as v,i as y,l as b,m as x,n as S,o as C,p as w,r as T,s as E,t as D,u as O}from"./formatters-BAE__8ye.js";import{t as k}from"./iconGlyphs.g-Bk8AzmSO.js";import{o as A}from"./optionLabel-Bd3vP-XI.js";import{n as j,t as M}from"./copyText-DM5HhXjf.js";import{t as N}from"./textMatch-wdY7XLIc.js";import{a as P,c as F,i as I,n as L,o as R,r as z,s as B,t as V}from"./notificationDays-pYmoU0g6.js";import{$ as H,A as U,B as W,E as G,F as K,G as q,H as J,I as Y,J as X,K as Z,L as Q,M as $,N as ee,O as te,P as ne,Q as re,R as ie,U as ae,V as oe,W as se,X as ce,Y as le,Z as ue,_ as de,a as fe,at as pe,b as me,c as he,d as ge,et as _e,f as ve,g as ye,h as be,i as xe,it as Se,j as Ce,k as we,l as Te,m as Ee,n as De,nt as Oe,o as ke,p as Ae,q as je,rt as Me,s as Ne,t as Pe,tt as Fe,u as Ie,v as Le,w as Re,y as ze,z as Be}from"./themeTransition-Qv1SCQIB.js";export{ue as AVATAR_ACCEPT,re as AVATAR_MAX_SIZE_MB,H as AVATAR_OUTPUT_SIZE,_e as AVATAR_OUTPUT_TYPE,Fe as AVATAR_PREVIEW_SIZES,Oe as AVATAR_TEXT,M as COPY_FEEDBACK_MS,D as CURRENCIES,S as DATE_PATTERNS,ae as DEFAULT_IMAGE_ACCEPT,se as DEFAULT_MAX_SIZE_MB,te as DEFAULT_PASSWORD_RULES,we as DEFAULT_REQUIREMENTS_TITLE,Pe as DEFAULT_THEME_EFFECT,De as DEFAULT_THEME_STORAGE_KEY,T as DURATION_UNITS,y as EMPTY_VALUE,m as FORMAT_STYLES,C as IST_TIME_ZONE,f as LIST_KEYS,ee as MASK_INPUT_TYPES,ne as MASK_NAMES,E as MONEY_UNITS,V as NOTIFICATION_COUNT_CAP,L as NOTIFICATION_TEXT,Le as SCROLL_EDGE_SELECTOR,s as SELECT_KEY,u as SHORTCUTS_OFF_ATTRIBUTE,i as SHORTCUT_EVENT,e as SHORTCUT_SCOPE_ATTRIBUTE,c as SHORTCUT_TEXT,xe as THEME_CHANGE_EVENT,fe as THEME_EFFECTS,ke as THEME_EFFECT_DURATION,Ne as THEME_MODES,he as THEME_SWITCHING_CLASS,q as acceptLabel,Te as applyTheme,d as ariaKeyShortcuts,K as attachInputMask,Re as attachRowDrag,ze as attachScrollEdges,Me as avatarCropOptions,Se as avatarUnreadableMessage,U as buildPasswordRules,j as copyTextToClipboard,Ce as evaluatePassword,h as formatCompact,b as formatCurrency,O as formatDate,g as formatDuration,Y as formatMasked,_ as formatNumber,w as formatPercent,x as formatValue,k as glyphSvg,z as groupNotificationsByDay,t as inShortcutScope,Q as initInputMasks,me as initScrollEdges,pe as isHeicFile,Z as isImageFile,je as isImageOnlyAccept,ie as isMaskPattern,X as isPdfFile,a as isTypingTarget,Be as maskedPostValue,N as matchSegments,le as matchesAccept,p as moveFocus,Ie as nextTheme,I as notificationCountText,P as notificationDayHeading,R as notificationTime,B as notificationTriggerLabel,F as notificationUnreadAnnouncement,$ as passwordSatisfies,W as postedMasked,oe as rawMasked,ge as readStoredTheme,J as resolveMask,ve as resolveTheme,n as runShortcut,r as shortcutKey,l as shortcutName,o as shortcutsOff,Ae as storeTheme,G as syncTargets,Ee as themeBootScript,be as themeKeyframes,v as toInstant,ye as transitionTheme,ce as validateFile,de as watchSystemTheme,A as withTrustedLabel};
1
+ import{a as e,c as t,d as n,f as r,i,l as a,m as o,n as s,o as c,p as l,r as u,s as d,t as f,u as p}from"./shortcutKeys-BQiDpsTJ.js";import{a as m,c as h,d as g,f as _,h as v,i as y,l as b,m as x,n as S,o as C,p as w,r as T,s as E,t as D,u as O}from"./formatters-BAE__8ye.js";import{t as k}from"./iconGlyphs.g-Bk8AzmSO.js";import{o as A}from"./optionLabel-Bd3vP-XI.js";import{n as j,t as M}from"./copyText-DM5HhXjf.js";import{t as N}from"./textMatch-wdY7XLIc.js";import{a as P,c as F,i as I,n as L,o as R,r as z,s as B,t as V}from"./notificationDays-BUoh4mG6.js";import{$ as H,A as U,B as W,E as G,F as K,G as q,H as J,I as Y,J as X,K as Z,L as Q,M as $,N as ee,O as te,P as ne,Q as re,R as ie,U as ae,V as oe,W as se,X as ce,Y as le,Z as ue,_ as de,a as fe,at as pe,b as me,c as he,d as ge,et as _e,f as ve,g as ye,h as be,i as xe,it as Se,j as Ce,k as we,l as Te,m as Ee,n as De,nt as Oe,o as ke,p as Ae,q as je,rt as Me,s as Ne,t as Pe,tt as Fe,u as Ie,v as Le,w as Re,y as ze,z as Be}from"./themeTransition-DbKWgZ9M.js";export{ue as AVATAR_ACCEPT,re as AVATAR_MAX_SIZE_MB,H as AVATAR_OUTPUT_SIZE,_e as AVATAR_OUTPUT_TYPE,Fe as AVATAR_PREVIEW_SIZES,Oe as AVATAR_TEXT,M as COPY_FEEDBACK_MS,D as CURRENCIES,S as DATE_PATTERNS,ae as DEFAULT_IMAGE_ACCEPT,se as DEFAULT_MAX_SIZE_MB,te as DEFAULT_PASSWORD_RULES,we as DEFAULT_REQUIREMENTS_TITLE,Pe as DEFAULT_THEME_EFFECT,De as DEFAULT_THEME_STORAGE_KEY,T as DURATION_UNITS,y as EMPTY_VALUE,m as FORMAT_STYLES,C as IST_TIME_ZONE,f as LIST_KEYS,ee as MASK_INPUT_TYPES,ne as MASK_NAMES,E as MONEY_UNITS,V as NOTIFICATION_COUNT_CAP,L as NOTIFICATION_TEXT,Le as SCROLL_EDGE_SELECTOR,s as SELECT_KEY,u as SHORTCUTS_OFF_ATTRIBUTE,i as SHORTCUT_EVENT,e as SHORTCUT_SCOPE_ATTRIBUTE,c as SHORTCUT_TEXT,xe as THEME_CHANGE_EVENT,fe as THEME_EFFECTS,ke as THEME_EFFECT_DURATION,Ne as THEME_MODES,he as THEME_SWITCHING_CLASS,q as acceptLabel,Te as applyTheme,d as ariaKeyShortcuts,K as attachInputMask,Re as attachRowDrag,ze as attachScrollEdges,Me as avatarCropOptions,Se as avatarUnreadableMessage,U as buildPasswordRules,j as copyTextToClipboard,Ce as evaluatePassword,h as formatCompact,b as formatCurrency,O as formatDate,g as formatDuration,Y as formatMasked,_ as formatNumber,w as formatPercent,x as formatValue,k as glyphSvg,z as groupNotificationsByDay,t as inShortcutScope,Q as initInputMasks,me as initScrollEdges,pe as isHeicFile,Z as isImageFile,je as isImageOnlyAccept,ie as isMaskPattern,X as isPdfFile,a as isTypingTarget,Be as maskedPostValue,N as matchSegments,le as matchesAccept,p as moveFocus,Ie as nextTheme,I as notificationCountText,P as notificationDayHeading,R as notificationTime,B as notificationTriggerLabel,F as notificationUnreadAnnouncement,$ as passwordSatisfies,W as postedMasked,oe as rawMasked,ge as readStoredTheme,J as resolveMask,ve as resolveTheme,n as runShortcut,r as shortcutKey,l as shortcutName,o as shortcutsOff,Ae as storeTheme,G as syncTargets,Ee as themeBootScript,be as themeKeyframes,v as toInstant,ye as transitionTheme,ce as validateFile,de as watchSystemTheme,A as withTrustedLabel};
@@ -1 +1 @@
1
- import{h as e,u as t}from"./formatters-BAE__8ye.js";var n=99,r=1440*60*1e3,i=Object.freeze({label:`Notifications`,empty:`You are all caught up.`,markAll:`Mark all read`,viewAll:`View all`,unreadPrefix:`Unread: `,today:`Today`,yesterday:`Yesterday`,allRead:`All notifications marked as read.`,noneUnread:`No unread notifications`,failed:Object.freeze({forbidden:`You do not have permission to mark these as read.`,client:`These could not be marked as read. Refresh the page and try again.`,validation:`These could not be marked as read. Refresh the page and try again.`,server:`Something went wrong on our side, so these were not marked as read. Try again in a moment.`,network:`Could not reach the server, so these were not marked as read. Check your connection and try again.`})});function a(e){return e>99?`99+`:String(e)}function o(e,t){return t===0?e:`${e}, ${a(t)} unread`}function s(e){return e===0?i.noneUnread:`${a(e)} unread notifications`}function c(e){return t(e,{pattern:`time`})}function l(n,a=Date.now()){let o=t(n);return o===t(a)?i.today:o===t(e(a)-r)?i.yesterday:o}function u(n,r=Date.now()){let i=new Map;for(let a of n){if(!Number.isFinite(e(a.at)))throw Error(`<AppNotificationCenter> item "${a.id}": at must be an ISO date-time with its zone (or a YYYY-MM-DD day), got ${String(a.at)}.`);let n=t(a.at);i.has(n)||i.set(n,{key:n,heading:l(a.at,r),items:[]}),i.get(n).items.push(a)}return[...i.values()]}export{l as a,s as c,a as i,i as n,c as o,u as r,o as s,n as t};
1
+ import{h as e,u as t}from"./formatters-BAE__8ye.js";var n=99,r=1440*60*1e3,i=Object.freeze({label:`Notifications`,empty:`You are all caught up.`,markAll:`Mark all read`,viewAll:`View all`,unreadPrefix:`Unread: `,today:`Today`,yesterday:`Yesterday`,allRead:`All notifications marked as read.`,noneUnread:`No unread notifications`,failed:Object.freeze({forbidden:`You do not have permission to mark these as read.`,client:`These could not be marked as read. Refresh the page and try again.`,validation:`These could not be marked as read. Refresh the page and try again.`,server:`Something went wrong on our side, so these were not marked as read. Try again in a moment.`,network:`Could not reach the server, so these were not marked as read. Check your connection and try again.`})});function a(e){return e>99?`99+`:String(e)}function o(e,t){return t===0?e:`${e}, ${a(t)} unread`}function s(e){return e===0?i.noneUnread:`${a(e)} unread notifications`}function c(e){return/^\d{4}-\d{2}-\d{2}$/.test(e)?``:t(e,{pattern:`time`})}function l(n,a=Date.now()){let o=t(n);return o===t(a)?i.today:o===t(e(a)-r)?i.yesterday:o}function u(n,r=Date.now()){let i=new Map;for(let a of n){if(!Number.isFinite(e(a.at)))throw Error(`<AppNotificationCenter> item "${a.id}": at must be an ISO date-time with its zone (or a YYYY-MM-DD day), got ${String(a.at)}.`);let n=t(a.at);i.has(n)||i.set(n,{key:n,heading:l(a.at,r),items:[]}),i.get(n).items.push(a)}return[...i.values()]}export{l as a,s as c,a as i,i as n,c as o,u as r,o as s,n as t};
@@ -0,0 +1 @@
1
+ var e=`image/jpeg,image/png,image/webp,image/heic,image/heif,.heic,.heif`,t=10,n=512,r=`image/webp`,i=[96,48],a={dialogTitle:`Edit photo`,dialogSubtitle:`Drag to position the photo, then zoom or rotate it.`,save:`Save photo`,cancel:`Cancel`,choose:`Upload photo`,change:`Change photo`,camera:`Take photo`,remove:`Remove photo`,unreadable:`That photo could not be opened. Choose a JPG, PNG or WebP image.`,heicUnreadable:`This browser cannot open HEIC photos. Choose a JPG, PNG or WebP image instead.`,cropFailed:`That photo could not be saved. Try again, or choose another one.`};function o(e){if(!e)return!1;let t=String(e.type||``).toLowerCase();return t===`image/heic`||t===`image/heif`||/\.hei[cf]$/i.test(String(e.name||``))}function s(e){return o(e)?a.heicUnreadable:a.unreadable}function c(e,t){let n=Number(t);return{name:e?.name||`photo`,type:r,size:Number.isInteger(n)&&n>0?n:512}}var l=`image/png,image/jpeg,image/webp`,u=5,d={"image/png":[`.png`],"image/jpeg":[`.jpg`,`.jpeg`],"image/webp":[`.webp`],"image/gif":[`.gif`],"image/svg+xml":[`.svg`],"image/heic":[`.heic`],"image/heif":[`.heif`],"application/pdf":[`.pdf`],"text/plain":[`.txt`]},f={"image/png":`PNG`,"image/jpeg":`JPG`,"image/webp":`WEBP`,"image/gif":`GIF`,"image/svg+xml":`SVG`,"image/heic":`HEIC`,"image/heif":`HEIC`,"application/pdf":`PDF`,"text/plain":`text file`,"image/*":`images`,"video/*":`videos`,"audio/*":`audio`,".png":`PNG`,".jpg":`JPG`,".jpeg":`JPG`,".webp":`WEBP`,".gif":`GIF`,".svg":`SVG`,".heic":`HEIC`,".heif":`HEIC`,".pdf":`PDF`,".txt":`text file`},p=e=>String(e||``).split(`,`).map(e=>e.trim().toLowerCase()).filter(Boolean),m=[`.png`,`.jpg`,`.jpeg`,`.webp`,`.gif`,`.svg`,`.bmp`,`.avif`,`.heic`,`.heif`];function h(e){if(!e)return!1;let t=typeof e==`object`&&e.type?String(e.type).toLowerCase():``;if(t)return t.startsWith(`image/`);let n=typeof e==`string`?e:e.name||e.url||``,r=String(n).toLowerCase();return m.some(e=>r.endsWith(e))}function g(e){if(!e)return!1;let t=typeof e==`object`&&e.type?String(e.type).toLowerCase():``;if(t)return t===`application/pdf`;let n=typeof e==`string`?e:e.name||e.url||``;return String(n).toLowerCase().split(/[?#]/)[0].endsWith(`.pdf`)}function _(e){let t=p(e);return t.length?t.every(e=>e.startsWith(`.`)?m.includes(e):e===`image/*`||e.startsWith(`image/`)):!1}function v(e){let t=[];for(let n of p(e)){let e=f[n]||(n.startsWith(`.`)?n.slice(1).toUpperCase():n.toUpperCase());t.includes(e)||t.push(e)}return t.length<=1?t[0]||`supported`:`${t.slice(0,-1).join(`, `)} or ${t[t.length-1]}`}function y(e,t){let n=p(t);if(!n.length)return!0;let r=(e.type||``).toLowerCase(),i=(e.name||``).toLowerCase();return n.some(e=>e.startsWith(`.`)?i.endsWith(e):e.endsWith(`/*`)?r.startsWith(e.slice(0,-1)):r&&r===e?!0:!r&&(d[e]||[]).some(e=>i.endsWith(e)))}function b(e,t={}){if(!e)return null;let n=t.accept===void 0?l:t.accept,r=t.maxSizeMb===void 0?5:t.maxSizeMb;if(!y(e,n)){let e=v(n),t=p(n).map(e=>[`images`,`videos`,`audio`].includes(f[e]));return t.every(Boolean)?`Choose ${e}.`:t.some(Boolean)?`Choose ${e.endsWith(` file`)?`${e}s`:`${e} files`}.`:`Choose a ${e.endsWith(` file`)?e:`${e} file`}.`}return r>0&&e.size>r*1024*1024?`Keep the file under ${r} MB.`:null}var x=/[0-9]/,S={9:x,A:/[A-Za-z]/,"*":/[0-9A-Za-z]/},C=/[9A*]/,w=new Set([`text`,`tel`,`search`,`url`,`password`]),T=e=>{let t=e.replace(/\D/g,``);return t.length===12&&t.startsWith(`91`)?t.slice(2):t.length===11&&t.startsWith(`0`)?t.slice(1):e},E=e=>{let t=Number(e.slice(0,2)),n=Number(e.slice(2,4)),r=Number(e.slice(4,8));if(r<1)return!1;let i=new Date(Date.UTC(r,n-1,t));return i.getUTCFullYear()===r&&i.getUTCMonth()===n-1&&i.getUTCDate()===t},D=e=>e.length<=3?e:`${e.slice(0,-3).replace(/\B(?=(\d{2})+(?!\d))/g,`,`)},${e.slice(-3)}`,ee=e=>{let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e.trim());return t?`${t[3]}-${t[2]}-${t[1]}`:e};function O(e,{upper:t=!1,normalize:n,valid:r,post:i=e=>e,message:a=`Enter the full value`}={}){let o=[...e].map(e=>S[e]?{re:S[e]}:{lit:e}),s=o.filter(e=>e.re).length;return{inputMode:o.every(e=>!e.re||e.re===x)?`numeric`:`text`,normalize:n,post:i,message:a,extract(e){let n=``,r=0;for(let i of e){for(;r<o.length&&o[r].lit!==void 0&&o[r].lit!==i;)r++;if(r>=o.length)break;let e=o[r];e.lit===void 0?e.re.test(i)&&(n+=t?i.toUpperCase():i,r++):r++}return n},layout(e){let t=``,n=[],r=0;for(let i=0;i<o.length&&r<e.length;i++)o[i].lit===void 0?(t+=e[r++],n.push(!0)):(t+=o[i].lit,n.push(!1));return{text:t,isRaw:n}},isValid:e=>e.length===s&&(!r||r(e))}}function k(){return{inputMode:`decimal`,post:e=>e,message:`Enter a valid amount`,extract(e){let t=``,n=!1,r=0;for(let i of e)x.test(i)?n?r<2&&(t+=i,r++):t+=i:i===`.`&&!n&&(n=!0,t+=i);return t.startsWith(`.`)&&(t=`0${t}`),t.replace(/^0+(?=\d)/,``)},layout(e){let[t,n]=e.split(`.`),r=D(t)+(e.includes(`.`)?`.${n}`:``);return{text:r,isRaw:[...r].map(e=>e!==`,`)}},isValid:e=>/^\d+(\.\d{1,2})?$/.test(e)}}var A={"phone-in":()=>O(`99999 99999`,{normalize:T,valid:e=>/^[6-9]/.test(e),message:`Enter a 10-digit mobile number`}),pan:()=>O(`AAAAA9999A`,{upper:!0,valid:e=>/^[A-Z]{5}\d{4}[A-Z]$/.test(e),message:`Enter a valid PAN`}),gstin:()=>O(`99AAAAA9999A***`,{upper:!0,valid:e=>/^\d{2}[A-Z]{5}\d{4}[A-Z][1-9A-Z]Z[0-9A-Z]$/.test(e),message:`Enter a valid GSTIN`}),aadhaar:()=>O(`9999 9999 9999`,{valid:e=>/^[2-9]/.test(e),message:`Enter a valid 12-digit Aadhaar number`}),ifsc:()=>O(`AAAA*******`,{upper:!0,valid:e=>/^[A-Z]{4}0[A-Z0-9]{6}$/.test(e),message:`Enter a valid IFSC`}),"pin-code":()=>O(`999999`,{valid:e=>/^[1-9]/.test(e),message:`Enter a valid 6-digit PIN code`}),date:()=>O(`99-99-9999`,{normalize:ee,valid:E,post:(e,t)=>e.length===8&&E(e)?`${e.slice(4)}-${e.slice(2,4)}-${e.slice(0,2)}`:t,message:`Enter a valid date as DD-MM-YYYY`}),amount:k},j=Object.keys(A),M=e=>{let t=String(e).toLowerCase();return Object.hasOwn(A,t)?t:void 0},te=e=>C.test(String(e))&&M(e)===void 0,N=new Map;function P(e){if(e==null||e===``)return null;let t=String(e);return N.has(t)||(te(t)?N.set(t,O(t)):N.set(t,Object.hasOwn(A,t)?A[t]():null)),N.get(t)}var F=(e,t)=>e.normalize?e.normalize(t):t;function ne(e,t){let n=P(e);return n?n.extract(F(n,String(t??``))):String(t??``)}function re(e,t){let n=P(e);if(!n)return String(t??``);let r=n.extract(F(n,String(t??``)));return n.post(r,n.layout(r).text)}function ie(e,t){let n=P(e);return n?n.layout(n.extract(F(n,String(t??``)))).text:String(t??``)}var ae=(e,t)=>{if(t<=0)return 0;let n=0;for(let r=0;r<e.length;r++)if(e[r]&&++n===t)return r+1;return e.length},I=new WeakMap,oe=e=>I.get(e)?.(),se=new WeakMap;function ce(e,t,n,r){let i=e.getAll(t),a=se.get(e);a||se.set(e,a=new Set);let o=i.findIndex((e,r)=>e===n&&!a.has(`${t}\u0000${r}`));if(!(o<0)){if(a.add(`${t}\u0000${o}`),i[o]=r,i.length===1){e.set(t,r);return}e.delete(t);for(let n of i)e.append(t,n)}}function le(e){let t=null,n=null,r=!1,i=(t,n)=>n===null?e.removeAttribute(t):e.setAttribute(t,n),a,o,s=()=>{t?.remove(),t=null,n&&(n.hidden=!1),n=null,r&&e.classList.remove(`error`),r=!1,a!==void 0&&i(`aria-invalid`,a),o!==void 0&&i(`aria-describedby`,o),a=void 0,o=void 0};return i=>{if(!i){s();return}let c=e.closest(`.field`),l=c?.querySelector(`.field-error`);l&&l!==t&&l.textContent.trim()||(t||(r=!e.classList.contains(`error`),e.classList.add(`error`),a=e.getAttribute(`aria-invalid`),o=e.getAttribute(`aria-describedby`),c&&(t=document.createElement(`div`),t.className=`field-error`,e.id&&(t.id=`${e.id}-error`),n=c.querySelector(`.field-hint`),n&&(n.hidden=!0),c.insertBefore(t,[...c.children].find(e=>e.classList.contains(`field-count`))??null),t.id&&e.setAttribute(`aria-describedby`,t.id)),e.setAttribute(`aria-invalid`,`true`)),t&&(t.textContent=i))}}function ue(e,{mask:t,postFormatted:n=!1,onChange:r,onInvalidChange:i}={}){let a=P(t);if(!a||!w.has(e.type))return()=>{};let o=Object.getPrototypeOf(e),s=Object.getOwnPropertyDescriptor(o,`value`).set,c=!e.hasAttribute(`inputmode`);c&&e.setAttribute(`inputmode`,a.inputMode);let l=i??le(e),u=null,d=!1,f=!1,p=!1,m=``,h=``,g,_=()=>{let e=p?m:``;e!==h&&(h=e,l(h))},v=(t,n,i)=>{let o=a.extract(t.slice(0,n)).length,c=a.extract(t),{text:l,isRaw:d}=a.layout(c);if(e.value!==l&&(s.call(e,l),document.activeElement===e&&w.has(e.type))){let t=ae(d,o);e.setSelectionRange(t,t)}e.dataset.maskRaw=c,m=c&&!a.isValid(c)?a.message:``,e.setCustomValidity(m),_(),i&&c!==u&&r?.(c,l),u=c},y=Object.getOwnPropertyDescriptor(e,`value`),b=y??Object.getOwnPropertyDescriptor(o,`value`);Object.defineProperty(e,"value",{configurable:!0,enumerable:b.enumerable,get:()=>b.get.call(e),set:t=>{if(b.set.call(e,t),f)return;let n=F(a,e.value);v(n,n.length,!0)}});let x=()=>{d=!0,e.dispatchEvent(new Event(`input`,{bubbles:!0})),d=!1},S=t=>{if(d||f||t.isComposing)return;let n=t.inputType===`insertText`&&(t.data?.length??0)<=1||t.inputType?.startsWith(`delete`)?e.value:F(a,e.value);v(n,e.selectionStart??n.length,!0)},C=()=>{f=!0},T=()=>{f=!1;let t=F(a,e.value);v(t,e.selectionStart??t.length,!0),x()},E=t=>{let n=t.inputType===`deleteContentBackward`;if(!n&&t.inputType!==`deleteContentForward`||t.isComposing)return;let r=e.selectionStart;if(r==null||r!==e.selectionEnd)return;let{isRaw:i}=a.layout(a.extract(e.value)),o=n?r-1:r;for(;o>=0&&o<i.length&&!i[o];)o+=n?-1:1;o!==(n?r-1:r)&&(t.preventDefault(),!(o<0||o>=i.length)&&(v(e.value.slice(0,o)+e.value.slice(o+1),n?o:r,!0),x()))},D=t=>{if(e.readOnly||e.disabled)return;let n=t.clipboardData?.getData(`text`);if(n==null)return;t.preventDefault();let r=F(a,n),i=e.selectionStart??e.value.length,o=e.selectionEnd??i;v(e.value.slice(0,i)+r+e.value.slice(o),i+r.length,!0),x()},ee=()=>{let t=a.extract(e.value);return a.post(t,a.layout(t).text)},O=()=>{p=!0,_()};e.addEventListener(`input`,S),e.addEventListener(`beforeinput`,E),e.addEventListener(`paste`,D),e.addEventListener(`compositionstart`,C),e.addEventListener(`compositionend`,T),e.addEventListener(`blur`,O),e.addEventListener(`invalid`,O);let k=e.form,A=t=>{e.name&&!e.disabled&&ce(t.formData,e.name,e.value,ee())},j=()=>{clearTimeout(g),g=setTimeout(()=>{p=!1,v(F(a,e.value),e.value.length,!0)},0)};n||(k?.addEventListener(`formdata`,A),I.set(e,ee)),k?.addEventListener(`reset`,j),k?.addEventListener(`submit`,O);let M=F(a,e.value);return v(M,M.length,!1),()=>{clearTimeout(g),e.removeEventListener(`input`,S),e.removeEventListener(`beforeinput`,E),e.removeEventListener(`paste`,D),e.removeEventListener(`compositionstart`,C),e.removeEventListener(`compositionend`,T),e.removeEventListener(`blur`,O),e.removeEventListener(`invalid`,O),k?.removeEventListener(`formdata`,A),k?.removeEventListener(`reset`,j),k?.removeEventListener(`submit`,O),I.delete(e),y?Object.defineProperty(e,"value",y):delete e.value,p=!1,m=``,_(),e.setCustomValidity(``),delete e.dataset.maskRaw,c&&e.removeAttribute(`inputmode`)}}function de(){let e=typeof window>`u`?void 0:window.jQuery?.validator?.prototype;if(!e||e.wuiMaskHook)return;let t=e.elementValue;e.elementValue=function(e){let n=oe(e);return n===void 0?t.call(this,e):n},e.wuiMaskHook=!0}var L=new WeakMap,R,fe=e=>{L.has(e)||L.set(e,ue(e,{mask:e.dataset.appMask,postFormatted:e.hasAttribute(`data-mask-post-formatted`)}))},pe=e=>e.nodeType===1?[...e.matches(`input[data-app-mask]`)?[e]:[],...e.querySelectorAll(`input[data-app-mask]`)]:[];function me(){R||typeof MutationObserver>`u`||(R=new MutationObserver(e=>{for(let t of e){for(let e of t.removedNodes)for(let t of pe(e))L.get(t)?.(),L.delete(t);for(let e of t.addedNodes)for(let t of pe(e))fe(t)}}),R.observe(document.documentElement,{childList:!0,subtree:!0}))}function he(e=document){de();for(let t of e.querySelectorAll(`input[data-app-mask]`))fe(t);e===document&&me()}var z={minLength:10,uppercase:!0,lowercase:!0,digit:!0,special:!0,uniqueChars:0,customRules:[]},ge=`Password requirements`;function _e(e){return e===!0||e==null?{...z}:{...z,...e}}function ve(e){let t=_e(e),n=[];if(t.minLength>0&&n.push({key:`length`,label:`At least ${t.minLength} characters long`,test:e=>e.length>=t.minLength}),t.uppercase&&n.push({key:`uppercase`,label:`At least one uppercase letter`,test:e=>/[A-Z]/.test(e)}),t.lowercase&&n.push({key:`lowercase`,label:`At least one lowercase letter`,test:e=>/[a-z]/.test(e)}),t.digit&&n.push({key:`digit`,label:`At least one digit`,test:e=>/[0-9]/.test(e)}),t.special&&n.push({key:`special`,label:`At least one special character`,test:e=>/[^A-Za-z0-9]/.test(e)}),t.uniqueChars>0){let e=t.uniqueChars;n.push({key:`unique`,label:`At least ${e} unique character${e>1?`s`:``}`,test:t=>new Set(t).size>=e})}for(let[e,r]of(t.customRules??[]).entries()){let t=new RegExp(r.pattern);n.push({key:`custom-${e}`,label:r.label,test:e=>t.test(e)})}return n}function ye(e,t){let n=e==null?``:String(e);return ve(t).map(e=>({key:e.key,label:e.label,met:e.test(n)}))}function be(e,t){return ye(e,t).every(e=>e.met)}var xe=`wui:row-drop`,B=`is-drop-over`,Se=`application/x-wui-rows`,Ce=`wui-row-dragging`,V=`[data-wui-drop-target]`,we=`tbody tr[data-row-key]`,Te=`input, button, a, select, textarea, label`,Ee=`.wui-select-cell .wui-check`,H=new WeakMap,De=new WeakSet,U=null,W=null;function Oe(e){return e.querySelector(Ee)?.checked===!0}function G(e){return[...e.querySelectorAll(`tbody tr`)].filter(Oe).map(e=>e.dataset.rowKey)}function K(){U=null,document.body.classList.remove(Ce);for(let e of document.querySelectorAll(`${V}.${B}`))e.classList.remove(B)}function ke(e,t,n){e.dispatchEvent(new CustomEvent(xe,{bubbles:!0,detail:{keys:t,target:n.dataset.wuiDropTarget}}))}function Ae(e){let t=e.target.closest?.(V);!t||!U||(e.preventDefault(),e.dataTransfer.dropEffect=`move`,t.classList.add(B))}function je(e){let t=e.target.closest?.(V);!t||t.contains(e.relatedTarget)||t.classList.remove(B)}function Me(e){let t=e.target.closest?.(V);if(!t||!U)return;e.preventDefault(),t.classList.remove(B);let{root:n,keys:r}=U;ke(n,r,t),K()}function Ne(e){let t=e.target.closest?.(V);!t||!W?.keys.length||(e.preventDefault(),ke(W.root,W.keys,t))}function Pe(e){(e.key===`Enter`||e.key===` `)&&Ne(e)}function Fe(e){De.has(e)||(De.add(e),e.addEventListener(`dragover`,Ae),e.addEventListener(`dragenter`,Ae),e.addEventListener(`dragleave`,je),e.addEventListener(`drop`,Me),e.addEventListener(`click`,Ne),e.addEventListener(`keydown`,Pe))}function Ie(e){let t=H.get(e);if(t)return t;Fe(e.ownerDocument||e);let n=t=>{let n=t.target.closest?.(we);if(!n||!e.contains(n))return;let r=t.target.closest(Te);r&&n.contains(r)||(n.draggable=!0)},r=t=>{let n=t.target.closest?.(we);if(!n||!e.contains(n))return;let r=Oe(n)?G(e):[n.dataset.rowKey];t.dataTransfer.setData(Se,JSON.stringify(r)),t.dataTransfer.setData(`text/plain`,r.join(`,`)),t.dataTransfer.effectAllowed=`move`,U={root:e,keys:r},document.body.classList.add(Ce)},i=t=>{let n=t.detail?.selected;n>0?W={root:e,keys:t.detail.keys??G(e)}:n===0&&(W=null),q(document)};e.addEventListener(`pointerdown`,n),e.addEventListener(`dragstart`,r),e.addEventListener(`dragend`,K),e.addEventListener(`selectionchange`,i);let a=()=>{e.removeEventListener(`pointerdown`,n),e.removeEventListener(`dragstart`,r),e.removeEventListener(`dragend`,K),e.removeEventListener(`selectionchange`,i),H.delete(e)};return H.set(e,a),a}function q(e=document){let t=e.querySelector(`[data-wui-row-drag] tbody tr ${Ee}:checked`)!==null;for(let n of e.querySelectorAll(V)){n.tagName!==`BUTTON`&&(n.setAttribute(`role`,`button`),n.setAttribute(`tabindex`,`0`)),t?n.removeAttribute(`aria-disabled`):n.setAttribute(`aria-disabled`,`true`);let e=n.getAttribute(`data-wui-drop-label`)||n.textContent.trim();n.setAttribute(`aria-label`,`Move to ${e}`)}for(let t of e.querySelectorAll(`.wui-drop-tray`))t.hasAttribute(`role`)||(t.setAttribute(`role`,`toolbar`),t.setAttribute(`aria-label`,`Move to`))}function Le(e=document){for(let t of e.querySelectorAll(`[data-wui-row-drag]`))Ie(t);q(e.ownerDocument||e)}var J=`.table-wrap, .table-responsive, [class*="table-responsive-"]`,Y=1;function Re(e){let t=()=>{let t=e.scrollWidth-e.clientWidth,n=Math.abs(e.scrollLeft);e.toggleAttribute(`data-wui-overflow-start`,t>Y&&n>Y),e.toggleAttribute(`data-wui-overflow-end`,t>Y&&n<t-Y),e.toggleAttribute(`data-wui-overflow-top`,e.scrollTop>Y)},n=()=>{if(e.scrollWidth-e.clientWidth>Y){let t=getComputedStyle(e);e.style.setProperty(`--wui-scroll-pad-start`,t.paddingInlineStart),e.style.setProperty(`--wui-scroll-pad-end`,t.paddingInlineEnd)}else e.style.getPropertyValue(`--wui-scroll-pad-end`)&&(e.style.removeProperty(`--wui-scroll-pad-start`),e.style.removeProperty(`--wui-scroll-pad-end`))},r=()=>{n(),t()};e.addEventListener(`scroll`,t,{passive:!0});let i=null;if(typeof ResizeObserver<`u`){i=new ResizeObserver(r),i.observe(e);for(let t of e.children)i.observe(t)}return r(),()=>{e.removeEventListener(`scroll`,t),i?.disconnect(),e.removeAttribute(`data-wui-overflow-start`),e.removeAttribute(`data-wui-overflow-end`),e.removeAttribute(`data-wui-overflow-top`),e.style.getPropertyValue(`--wui-scroll-pad-end`)&&(e.style.removeProperty(`--wui-scroll-pad-start`),e.style.removeProperty(`--wui-scroll-pad-end`))}}var X=new WeakMap,ze,Be=e=>{X.has(e)||X.set(e,Re(e))},Ve=e=>{if(e.nodeType!==1)return[];let t=e.matches(`.table-wrap, .table-responsive, [class*="table-responsive-"]`)?[e]:[];return e.firstElementChild===null?t:[...t,...e.querySelectorAll(J)]};function He(){ze||typeof MutationObserver>`u`||(ze=new MutationObserver(e=>{for(let t of e){for(let e of t.removedNodes)for(let t of Ve(e))X.get(t)?.(),X.delete(t);for(let e of t.addedNodes)for(let t of Ve(e))Be(t)}}),ze.observe(document.documentElement,{childList:!0,subtree:!0}))}function Ue(e=document){for(let t of e.querySelectorAll(J))Be(t);e===document&&He()}var We=[`light`,`dark`,`auto`],Ge=[`wave`,`circle`,`slide`,`blinds`,`fade`,`none`],Ke=`wave`,Z=`theme`,qe={wave:1100,circle:700,slide:600,blinds:900,fade:350,none:0},Je=`wui-theme-switching`,Ye=`wui:theme:change`,Xe=`(prefers-color-scheme: dark)`,Ze=e=>typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(e).matches,Qe=e=>We.includes(e);function $e(e){return e===`dark`||e===`auto`&&Ze(Xe)?`dark`:`light`}function et(e=Z){let t=null;try{t=window.localStorage.getItem(e)}catch{}return Qe(t)?t:`auto`}function tt(e,t=Z){try{window.localStorage.setItem(t,e)}catch{}}function nt(e){let t=document.documentElement,n=$e(e);t.setAttribute(`data-theme`,e),t.setAttribute(`data-bs-theme`,n),document.dispatchEvent(new CustomEvent(Ye,{detail:{mode:n,preference:e}}))}var rt=`(function(k){var m;try{m=localStorage.getItem(k)}catch{}if(m!=='light'&&m!=='dark')m='auto';var r=document.documentElement,q=window.matchMedia?window.matchMedia('(prefers-color-scheme: dark)'):null;function s(){var t=r.getAttribute('data-theme');r.setAttribute('data-bs-theme',t==='auto'?(q&&q.matches?'dark':'light'):t)}r.setAttribute('data-theme',m);s();if(q&&q.addEventListener)q.addEventListener('change',function(){if(r.getAttribute('data-theme')==='auto')s()})})(`;function it(e=Z){return`${rt}${JSON.stringify(String(e)).replace(/</g,`\\u003c`)})`}function at(e,{includeAuto:t=!1}={}){return e===`light`?`dark`:e===`dark`&&t?`auto`:`light`}function ot(e){if(typeof window>`u`||typeof window.matchMedia!=`function`)return()=>{};let t=window.matchMedia(Xe),n=()=>e(t.matches?`dark`:`light`);return t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)}var st=60,ct=e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2,Q=e=>e.toFixed(1),$=(e,t)=>`${Q(e)}px ${Q(t)}px`,lt={amplitude:22,segments:36,cycles:1.5,ripples:2},ut=6,dt=(e,t,n,r,i)=>{let{amplitude:a,segments:o,cycles:s}=lt,c=n*(t+2*a),l=i?t+a-c:c-a,u=i?t+2*a:-2*a,d=[$(0,u)];for(let t=0;t<=o;t++){let n=e*t/o,i=l+a*Math.sin(2*Math.PI*s*t/o+r);d.push($(n,i))}return d.push($(e,u)),`polygon(${d.join(`, `)})`},ft=(e,t,n,r)=>{let i=t/ut,a=[];for(let t=0;t<ut;t++){let o=t*i,s=i*n,c=r?o+i-s:o,l=r?o+i:o+s;a.push($(0,c),$(e,c),$(e,l),$(0,l))}return`polygon(${a.join(`, `)})`};function pt(e,{width:t,height:n,to:r=`dark`,origin:i}={}){let a=r===`dark`,o=[];for(let r=0;r<=st;r++){let s=r/st,c=ct(s);switch(e){case`circle`:{let e=i?.x??t/2,r=i?.y??n/2,a=Math.hypot(Math.max(e,t-e),Math.max(r,n-r));o.push({clipPath:`circle(${Q(a*c)}px at ${Q(e)}px ${Q(r)}px)`});break}case`slide`:{let e=n*(1-c);o.push({clipPath:a?`inset(${Q(e)}px 0px 0px 0px)`:`inset(0px 0px ${Q(e)}px 0px)`});break}case`blinds`:o.push({clipPath:ft(t,n,c,a)});break;case`fade`:o.push({clipPath:`none`,opacity:c});break;case`none`:return[];default:o.push({clipPath:dt(t,n,c,s*lt.ripples*2*Math.PI,a)})}}return o}function mt(e,{effect:t=Ke,to:n,origin:r,duration:i}={}){let a=document.documentElement,o=n!==void 0&&a.getAttribute(`data-bs-theme`)===n;if(t===`none`||o||Ze(`(prefers-reduced-motion: reduce)`)||typeof document.startViewTransition!=`function`||typeof a.animate!=`function`)return e(),Promise.resolve(!1);a.classList.add(Je);let s=document.startViewTransition(e),c=i??qe[t]??qe.wave;return s.ready.then(()=>{let e=pt(t,{width:window.innerWidth,height:window.innerHeight,to:n,origin:r});a.animate(e,{duration:c,easing:`linear`,fill:`both`,pseudoElement:`::view-transition-new(root)`})}).catch(()=>{}),s.finished.catch(()=>{}).then(()=>(a.classList.remove(Je),!0))}export{n as $,ve as A,re as B,xe as C,G as D,q as E,ue as F,v as G,P as H,ie as I,g as J,h as K,he as L,be as M,w as N,z as O,j as P,t as Q,te as R,Se as S,Le as T,l as U,ne as V,u as W,b as X,y as Y,e as Z,ot as _,Ge as a,o as at,Ue as b,Je as c,et as d,r as et,$e as f,mt as g,pt as h,Ye as i,s as it,ye as j,ge as k,nt as l,it as m,Z as n,a as nt,qe as o,tt as p,_ as q,rt as r,c as rt,We as s,Ke as t,i as tt,at as u,J as v,Ie as w,B as x,Re as y,oe as z};
@@ -1,4 +1,4 @@
1
- (function(e,t,n,r,i,a,o,s){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var c=globalThis.WeborityUiElementsInternal?.version;if(c!==`0.80.8`)throw Error(`[webority-ui] autocomplete expects ui-elements 0.80.8 but the page loaded `+c+`.`);var l=!1,u=!1;function d(){u||typeof document>`u`||(u=!0,document.addEventListener(`keydown`,e=>{l=e.key===`Tab`},!0),document.addEventListener(`keyup`,()=>{l=!1},!0))}function f(){return l}var p=class extends r.ElementBase{static formAssociated=!0;_accessibleName(){return this.getAttribute(`aria-label`)||this.getAttribute(`placeholder`)||`Select`}static get observedAttributes(){return[`value`,`placeholder`,`disabled`,`min-chars`,`debounce`,`remote`,`size`,`aria-label`,`allow-custom`,`aria-invalid`]}constructor(){super(),this._value=``,this._label=``,this._optionsProp=null,this._loading=!1,this._active=-1,this._timer=null,this._reqSeq=0,this._pendingSearch=null,this._typeahead=``,this._typeaheadTimer=null;try{this._internals=this.attachInternals()}catch{this._internals=null}}connectedCallback(){if(!this._rendered){this._defaultCaptured||=(this._defaultValue=this._value,!0),this.render();return}if(this._bindGlobal?.(),this._pendingSearch){let{query:e,seq:t}=this._pendingSearch;clearTimeout(this._timer),this._timer=setTimeout(()=>this._fireSearch(e,t),this._debounceMs)}}formResetCallback(){this.value=this._defaultValue||``}attributeChangedCallback(e,t,n){if(e===`value`){this.value=n;return}if(e===`aria-invalid`){this._syncInvalid();return}this._rendered&&this.render()}_syncInvalid(){let e=this.querySelector(`.search-select-control`);e&&(this.hasAttribute(`aria-invalid`)?e.setAttribute(`aria-invalid`,`true`):e.removeAttribute(`aria-invalid`))}get value(){return this._value}set value(e){this._value=e==null?``:String(e),(0,i.syncFormMirror)(this,this._value);let t=this._readOptions().find(e=>String(e.value)===this._value);this._label=t?(0,s.optionText)(t):``,this._syncInput(),this._renderOptions(``)}set options(e){this._optionsProp=Array.isArray(e)?e:[];let t=this._readOptions().find(e=>String(e.value)===this._value);t&&(this._label=(0,s.optionText)(t)),this._renderOptions(),this._syncInput()}get options(){return this._readOptions()}set loading(e){this._loading=!!e,this._renderLoading(),this._renderOptions()}get loading(){return this._loading}get _remote(){return this.hasAttribute(`remote`)}get _allowCustom(){return this.hasAttribute(`allow-custom`)}_matchesKnownOption(e){let t=e.toLowerCase();return this._readOptions().some(e=>(0,s.optionText)(e).toLowerCase()===t||String(e.value??``).toLowerCase()===t)}get _minChars(){let e=+!!this._remote,t=this.getAttribute(`min-chars`);if(t==null||t.trim()===``)return e;let n=Number(t);return Number.isInteger(n)&&n>=0?n:e}get _debounceMs(){let e=this.getAttribute(`debounce`);if(e==null||e===``)return 250;let t=Number(e);return Number.isFinite(t)&&t>=0?t:250}_snapshotDeclared(){if(this._declared)return;let e=[...this.querySelectorAll(`:scope > wui-option`)];e.length&&(this._declared=e.map(e=>({value:e.getAttribute(`value`)??e.textContent.trim(),label:e.innerHTML,icon:e.getAttribute(`icon`)||void 0,[s.TRUSTED_HTML]:!0,selected:e.hasAttribute(`selected`)})))}_readOptions(){return this._optionsProp?this._optionsProp:(this._snapshotDeclared(),this._declared||[])}render(){this._snapshotDeclared();let e=this.getAttribute(`placeholder`)||`Search…`,t=this.getAttribute(`size`),n=t===`sm`?` search-select-sm`:t===`lg`?` search-select-lg`:``;this.id||=`wui-autocomplete-${Math.random().toString(36).slice(2,9)}`;let r=`${this.id}-listbox`;this._listboxId=r,this.innerHTML=`
1
+ (function(e,t,n,r,i,a,o,s){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var c=globalThis.WeborityUiElementsInternal?.version;if(c!==`0.80.9`)throw Error(`[webority-ui] autocomplete expects ui-elements 0.80.9 but the page loaded `+c+`.`);var l=!1,u=!1;function d(){u||typeof document>`u`||(u=!0,document.addEventListener(`keydown`,e=>{l=e.key===`Tab`},!0),document.addEventListener(`keyup`,()=>{l=!1},!0))}function f(){return l}var p=class extends r.ElementBase{static formAssociated=!0;_accessibleName(){return this.getAttribute(`aria-label`)||this.getAttribute(`placeholder`)||`Select`}static get observedAttributes(){return[`value`,`placeholder`,`disabled`,`min-chars`,`debounce`,`remote`,`size`,`aria-label`,`allow-custom`,`aria-invalid`]}constructor(){super(),this._value=``,this._label=``,this._optionsProp=null,this._loading=!1,this._active=-1,this._timer=null,this._reqSeq=0,this._pendingSearch=null,this._typeahead=``,this._typeaheadTimer=null;try{this._internals=this.attachInternals()}catch{this._internals=null}}connectedCallback(){if(!this._rendered){this._defaultCaptured||=(this._defaultValue=this._value,!0),this.render();return}if(this._bindGlobal?.(),this._pendingSearch){let{query:e,seq:t}=this._pendingSearch;clearTimeout(this._timer),this._timer=setTimeout(()=>this._fireSearch(e,t),this._debounceMs)}}formResetCallback(){this.value=this._defaultValue||``}attributeChangedCallback(e,t,n){if(e===`value`){this.value=n;return}if(e===`aria-invalid`){this._syncInvalid();return}this._rendered&&this.render()}_syncInvalid(){let e=this.querySelector(`.search-select-control`);e&&(this.hasAttribute(`aria-invalid`)?e.setAttribute(`aria-invalid`,`true`):e.removeAttribute(`aria-invalid`))}get value(){return this._value}set value(e){this._value=e==null?``:String(e),(0,i.syncFormMirror)(this,this._value);let t=this._readOptions().find(e=>String(e.value)===this._value);this._label=t?(0,s.optionText)(t):``,this._syncInput(),this._renderOptions(``)}set options(e){this._optionsProp=Array.isArray(e)?e:[];let t=this._readOptions().find(e=>String(e.value)===this._value);t&&(this._label=(0,s.optionText)(t)),this._renderOptions(),this._syncInput()}get options(){return this._readOptions()}set loading(e){this._loading=!!e,this._renderLoading(),this._renderOptions()}get loading(){return this._loading}get _remote(){return this.hasAttribute(`remote`)}get _allowCustom(){return this.hasAttribute(`allow-custom`)}_matchesKnownOption(e){let t=e.toLowerCase();return this._readOptions().some(e=>(0,s.optionText)(e).toLowerCase()===t||String(e.value??``).toLowerCase()===t)}get _minChars(){let e=+!!this._remote,t=this.getAttribute(`min-chars`);if(t==null||t.trim()===``)return e;let n=Number(t);return Number.isInteger(n)&&n>=0?n:e}get _debounceMs(){let e=this.getAttribute(`debounce`);if(e==null||e===``)return 250;let t=Number(e);return Number.isFinite(t)&&t>=0?t:250}_snapshotDeclared(){if(this._declared)return;let e=[...this.querySelectorAll(`:scope > wui-option`)];e.length&&(this._declared=e.map(e=>({value:e.getAttribute(`value`)??e.textContent.trim(),label:e.innerHTML,icon:e.getAttribute(`icon`)||void 0,[s.TRUSTED_HTML]:!0,selected:e.hasAttribute(`selected`)})))}_readOptions(){return this._optionsProp?this._optionsProp:(this._snapshotDeclared(),this._declared||[])}render(){this._snapshotDeclared();let e=this.getAttribute(`placeholder`)||`Search…`,t=this.getAttribute(`size`),n=t===`sm`?` search-select-sm`:t===`lg`?` search-select-lg`:``;this.id||=`wui-autocomplete-${Math.random().toString(36).slice(2,9)}`;let r=`${this.id}-listbox`;this._listboxId=r,this.innerHTML=`
2
2
  <div class="search-select${n}">
3
3
  <div class="input search-select-control search-select-ac" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="${m(r)}" aria-label="${m(this._accessibleName())}"${this.hasAttribute(`aria-invalid`)?` aria-invalid="true"`:``}>
4
4
  <input class="search-select-input search-select-ac-input" placeholder="${m(e)}" aria-autocomplete="list" autocomplete="off"${this.hasAttribute(`disabled`)?` disabled`:``} />
@@ -1 +1 @@
1
- (function(e,t,n){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var r=globalThis.WeborityUiElementsInternal?.version;if(r!==`0.80.8`)throw Error(`[webority-ui] carousel expects ui-elements 0.80.8 but the page loaded `+r+`.`);var i=Object.freeze({slide:(e,t)=>`${e} of ${t}`,status:(e,t,n)=>e===t?`Slide ${e} of ${n}`:`Slides ${e} to ${t} of ${n}`,dot:`Go to slide`,pause:`Pause`,play:`Play`}),a=120,o=class extends n.ElementBase{static get observedAttributes(){return[`autoplay`]}constructor(){super(),this._page=0,this._pages=1,this._perView=1,this._paused=!1,this._hover=!1,this._focus=!1,this._timer=null,this._settleTimer=null,this._status=``,this._ready=!1,this._motion=null,this._mutations=null,this._resizer=null,this._doc=null,this._onClick=e=>this._click(e),this._onKeyDown=e=>this._key(e),this._onScroll=()=>{clearTimeout(this._settleTimer),this._settleTimer=setTimeout(()=>this._settle(),a)},this._onEnter=()=>this._hold({hover:!0}),this._onLeave=()=>this._hold({hover:!1}),this._onFocusIn=()=>this._hold({focus:!0}),this._onFocusOut=e=>this._hold({focus:!!e.relatedTarget&&this.contains(e.relatedTarget)}),this._onVisibility=()=>this._sync(),this._onMotion=()=>this._sync(),this._tick=()=>{this._timer=null,this._go(this._page+1<this._pages?this._page+1:0)}}connectedCallback(){if(this._track=this.querySelector(`.wui-carousel-track`),!this._track){this.ownerDocument.readyState===`loading`&&this.ownerDocument.addEventListener(`DOMContentLoaded`,()=>this.isConnected&&this.connectedCallback(),{once:!0});return}this._doc=this.ownerDocument;let e=this.getAttribute(`data-wui-style`);if(e){for(let t of e.split(`;`)){let e=t.indexOf(`:`);e>0&&this.style.setProperty(t.slice(0,e).trim(),t.slice(e+1).trim())}this.removeAttribute(`data-wui-style`)}this._motion=typeof window<`u`&&typeof window.matchMedia==`function`?window.matchMedia(`(prefers-reduced-motion: reduce)`):null,this._motion?.addEventListener(`change`,this._onMotion),this.addEventListener(`click`,this._onClick),this.addEventListener(`mouseenter`,this._onEnter),this.addEventListener(`mouseleave`,this._onLeave),this.addEventListener(`focusin`,this._onFocusIn),this.addEventListener(`focusout`,this._onFocusOut),this._track.addEventListener(`keydown`,this._onKeyDown),this._track.addEventListener(`scroll`,this._onScroll,{passive:!0}),this._doc.addEventListener(`visibilitychange`,this._onVisibility),typeof MutationObserver<`u`&&(this._mutations=new MutationObserver(()=>this._refresh()),this._mutations.observe(this._track,{childList:!0})),typeof ResizeObserver<`u`&&(this._resizer=new ResizeObserver(()=>this._refresh()),this._resizer.observe(this._track)),this._ready=!0,this._refresh()}disconnectedCallback(){this._ready=!1,clearTimeout(this._timer),clearTimeout(this._settleTimer),this._timer=null,this._motion?.removeEventListener(`change`,this._onMotion),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`mouseenter`,this._onEnter),this.removeEventListener(`mouseleave`,this._onLeave),this.removeEventListener(`focusin`,this._onFocusIn),this.removeEventListener(`focusout`,this._onFocusOut),this._track?.removeEventListener(`keydown`,this._onKeyDown),this._track?.removeEventListener(`scroll`,this._onScroll),this._doc?.removeEventListener(`visibilitychange`,this._onVisibility),this._mutations?.disconnect(),this._resizer?.disconnect(),this._mutations=this._resizer=this._motion=this._doc=null}attributeChangedCallback(){this._ready&&this._sync()}get paused(){return this._paused}set paused(e){this._paused=!!e,this._ready&&this._sync()}next(){this._page+1<this._pages?this._go(this._page+1):this.hasAttribute(`loop`)&&this._go(0)}prev(){this._page>0?this._go(this._page-1):this.hasAttribute(`loop`)&&this._go(this._pages-1)}goTo(e){this._go(Number(e))}_interval(){let e=Number.parseInt(this.getAttribute(`autoplay`)??``,10);return e>0?e:0}_slides(){return Array.from(this._track.children).filter(e=>e.classList.contains(`wui-carousel-slide`))}_playing(){return this._interval()>0&&this._pages>1&&!this._paused&&!this._hover&&!this._focus&&!this._motion?.matches&&!this._doc?.hidden}_hold({hover:e=this._hover,focus:t=this._focus}){this._hover=e,this._focus=t,this._sync()}_click(e){let t=e.target.closest?.(`.wui-carousel-pause, .wui-carousel-prev, .wui-carousel-next, .wui-carousel-dot`);!t||!this.contains(t)||this._track.contains(t)||(t.classList.contains(`wui-carousel-pause`)?(this._paused=!this._paused,this._hover=!1,this._focus=!1,this._sync()):t.getAttribute(`aria-disabled`)===`true`?e.preventDefault():t.classList.contains(`wui-carousel-prev`)?this.prev():t.classList.contains(`wui-carousel-next`)?this.next():this._go(Number(t.dataset.page)))}_key(e){if(e.target!==this._track||e.altKey||e.ctrlKey||e.metaKey)return;let t={ArrowRight:()=>this.next(),ArrowLeft:()=>this.prev(),Home:()=>this._go(0),End:()=>this._go(this._pages-1)}[e.key];t&&(e.preventDefault(),t())}_perViewNow(){let e=typeof window<`u`?window.getComputedStyle(this._track).getPropertyValue(`--wui-carousel-view`):``,t=Number.parseInt(e,10);return t>=1?t:1}_start(e){return Math.min(e*this._perView,Math.max(0,this._slides().length-this._perView))}_label(){let e=this._slides();return e.forEach((t,n)=>{let r=i.slide(n+1,e.length);t.getAttribute(`aria-label`)!==r&&t.setAttribute(`aria-label`,r)}),e.length}_refresh(){let e=this._label();this._perView=this._perViewNow();let t=Math.max(1,Math.ceil(e/this._perView)),n=this.querySelector(`.wui-carousel-dots`);if(n&&n.children.length!==t){let e=this.getAttribute(`dot-label`)||i.dot;n.replaceChildren(...Array.from({length:t},(t,n)=>{let r=this.ownerDocument.createElement(`button`);return r.type=`button`,r.className=`wui-carousel-dot`,r.dataset.page=String(n),r.setAttribute(`aria-label`,`${e} ${this._start(n)+1}`),r}))}this._pages=t,this._page=Math.min(this._page,t-1),this.toggleAttribute(`data-single`,t<=1),this._render(!1),this._sync()}_settle(){let e=this._track,t=this._slides();if(!t.length)return;let n;if(e.scrollWidth>e.clientWidth&&e.scrollLeft+e.clientWidth>=e.scrollWidth-2)n=this._pages-1;else{let r=0,i=1/0;t.forEach((t,n)=>{let a=Math.abs(t.offsetLeft-e.scrollLeft);a<i&&(i=a,r=n)}),n=Math.min(this._pages-1,Math.round(r/this._perView))}n!==this._page&&(this._page=n,this._render(!0),this._sync())}_go(e){if(!Number.isInteger(e))return;this._page=Math.max(0,Math.min(this._pages-1,e));let t=this._slides()[this._start(this._page)];if(t){let e=this._motion?.matches?`auto`:`smooth`;typeof this._track.scrollTo==`function`?this._track.scrollTo({left:t.offsetLeft,behavior:e}):this._track.scrollLeft=t.offsetLeft}this._render(!0),this._sync()}_render(e){let t=this.hasAttribute(`loop`);for(let e of this.querySelectorAll(`.wui-carousel-dot`))Number(e.dataset.page)===this._page?e.setAttribute(`aria-current`,`true`):e.removeAttribute(`aria-current`);this.querySelector(`.wui-carousel-prev`)?.setAttribute(`aria-disabled`,String(!t&&this._page===0)),this.querySelector(`.wui-carousel-next`)?.setAttribute(`aria-disabled`,String(!t&&this._page===this._pages-1));let n=this._slides().length,r=this._start(this._page)+1,a=Math.min(n,r+this._perView-1),o=i.status(r,a,n);if(o===this._status||(this._status=o,!e))return;let s=this.querySelector(`[data-wui-status]`);s&&!this._playing()&&(s.textContent=o),this.dispatchEvent(new CustomEvent(`wui:carousel:change`,{bubbles:!0,detail:{page:this._page,pages:this._pages}}))}_sync(){clearTimeout(this._timer),this._timer=null;let e=this._interval(),t=this.querySelector(`.wui-carousel-pause`);if(t){t.hidden=e===0||this._pages<=1||!!this._motion?.matches;let n=this._paused?this.getAttribute(`play-label`)||i.play:this.getAttribute(`pause-label`)||i.pause,r=t.querySelector(`.wui-carousel-pause-text`);r&&r.textContent!==n&&(r.textContent=n),this.toggleAttribute(`data-paused`,this._paused)}this._playing()&&(this._timer=setTimeout(this._tick,e))}};(0,t.defineElement)(`wui-carousel`,o),e.WuiCarousel=o})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.elementBase);
1
+ (function(e,t,n){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var r=globalThis.WeborityUiElementsInternal?.version;if(r!==`0.80.9`)throw Error(`[webority-ui] carousel expects ui-elements 0.80.9 but the page loaded `+r+`.`);var i=Object.freeze({slide:(e,t)=>`${e} of ${t}`,status:(e,t,n)=>e===t?`Slide ${e} of ${n}`:`Slides ${e} to ${t} of ${n}`,dot:`Go to slide`,pause:`Pause`,play:`Play`}),a=120,o=class extends n.ElementBase{static get observedAttributes(){return[`autoplay`]}constructor(){super(),this._page=0,this._pages=1,this._perView=1,this._paused=!1,this._hover=!1,this._focus=!1,this._timer=null,this._settleTimer=null,this._status=``,this._ready=!1,this._motion=null,this._mutations=null,this._resizer=null,this._doc=null,this._onClick=e=>this._click(e),this._onKeyDown=e=>this._key(e),this._onScroll=()=>{clearTimeout(this._settleTimer),this._settleTimer=setTimeout(()=>this._settle(),a)},this._onEnter=()=>this._hold({hover:!0}),this._onLeave=()=>this._hold({hover:!1}),this._onFocusIn=()=>this._hold({focus:!0}),this._onFocusOut=e=>this._hold({focus:!!e.relatedTarget&&this.contains(e.relatedTarget)}),this._onVisibility=()=>this._sync(),this._onMotion=()=>this._sync(),this._tick=()=>{this._timer=null,this._go(this._page+1<this._pages?this._page+1:0)}}connectedCallback(){if(this._track=this.querySelector(`.wui-carousel-track`),!this._track){this.ownerDocument.readyState===`loading`&&this.ownerDocument.addEventListener(`DOMContentLoaded`,()=>this.isConnected&&this.connectedCallback(),{once:!0});return}this._doc=this.ownerDocument;let e=this.getAttribute(`data-wui-style`);if(e){for(let t of e.split(`;`)){let e=t.indexOf(`:`);e>0&&this.style.setProperty(t.slice(0,e).trim(),t.slice(e+1).trim())}this.removeAttribute(`data-wui-style`)}this._motion=typeof window<`u`&&typeof window.matchMedia==`function`?window.matchMedia(`(prefers-reduced-motion: reduce)`):null,this._motion?.addEventListener(`change`,this._onMotion),this.addEventListener(`click`,this._onClick),this.addEventListener(`mouseenter`,this._onEnter),this.addEventListener(`mouseleave`,this._onLeave),this.addEventListener(`focusin`,this._onFocusIn),this.addEventListener(`focusout`,this._onFocusOut),this._track.addEventListener(`keydown`,this._onKeyDown),this._track.addEventListener(`scroll`,this._onScroll,{passive:!0}),this._doc.addEventListener(`visibilitychange`,this._onVisibility),typeof MutationObserver<`u`&&(this._mutations=new MutationObserver(()=>this._refresh()),this._mutations.observe(this._track,{childList:!0})),typeof ResizeObserver<`u`&&(this._resizer=new ResizeObserver(()=>this._refresh()),this._resizer.observe(this._track)),this._ready=!0,this._refresh()}disconnectedCallback(){this._ready=!1,clearTimeout(this._timer),clearTimeout(this._settleTimer),this._timer=null,this._motion?.removeEventListener(`change`,this._onMotion),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`mouseenter`,this._onEnter),this.removeEventListener(`mouseleave`,this._onLeave),this.removeEventListener(`focusin`,this._onFocusIn),this.removeEventListener(`focusout`,this._onFocusOut),this._track?.removeEventListener(`keydown`,this._onKeyDown),this._track?.removeEventListener(`scroll`,this._onScroll),this._doc?.removeEventListener(`visibilitychange`,this._onVisibility),this._mutations?.disconnect(),this._resizer?.disconnect(),this._mutations=this._resizer=this._motion=this._doc=null}attributeChangedCallback(){this._ready&&this._sync()}get paused(){return this._paused}set paused(e){this._paused=!!e,this._ready&&this._sync()}next(){this._page+1<this._pages?this._go(this._page+1):this.hasAttribute(`loop`)&&this._go(0)}prev(){this._page>0?this._go(this._page-1):this.hasAttribute(`loop`)&&this._go(this._pages-1)}goTo(e){this._go(Number(e))}_interval(){let e=Number.parseInt(this.getAttribute(`autoplay`)??``,10);return e>0?e:0}_slides(){return Array.from(this._track.children).filter(e=>e.classList.contains(`wui-carousel-slide`))}_playing(){return this._interval()>0&&this._pages>1&&!this._paused&&!this._hover&&!this._focus&&!this._motion?.matches&&!this._doc?.hidden}_hold({hover:e=this._hover,focus:t=this._focus}){this._hover=e,this._focus=t,this._sync()}_click(e){let t=e.target.closest?.(`.wui-carousel-pause, .wui-carousel-prev, .wui-carousel-next, .wui-carousel-dot`);!t||!this.contains(t)||this._track.contains(t)||(t.classList.contains(`wui-carousel-pause`)?(this._paused=!this._paused,this._hover=!1,this._focus=!1,this._sync()):t.getAttribute(`aria-disabled`)===`true`?e.preventDefault():t.classList.contains(`wui-carousel-prev`)?this.prev():t.classList.contains(`wui-carousel-next`)?this.next():this._go(Number(t.dataset.page)))}_key(e){if(e.target!==this._track||e.altKey||e.ctrlKey||e.metaKey)return;let t={ArrowRight:()=>this.next(),ArrowLeft:()=>this.prev(),Home:()=>this._go(0),End:()=>this._go(this._pages-1)}[e.key];t&&(e.preventDefault(),t())}_perViewNow(){let e=typeof window<`u`?window.getComputedStyle(this._track).getPropertyValue(`--wui-carousel-view`):``,t=Number.parseInt(e,10);return t>=1?t:1}_start(e){return Math.min(e*this._perView,Math.max(0,this._slides().length-this._perView))}_label(){let e=this._slides();return e.forEach((t,n)=>{let r=i.slide(n+1,e.length);t.getAttribute(`aria-label`)!==r&&t.setAttribute(`aria-label`,r)}),e.length}_refresh(){let e=this._label();this._perView=this._perViewNow();let t=Math.max(1,Math.ceil(e/this._perView)),n=this.querySelector(`.wui-carousel-dots`);if(n&&n.children.length!==t){let e=this.getAttribute(`dot-label`)||i.dot;n.replaceChildren(...Array.from({length:t},(t,n)=>{let r=this.ownerDocument.createElement(`button`);return r.type=`button`,r.className=`wui-carousel-dot`,r.dataset.page=String(n),r.setAttribute(`aria-label`,`${e} ${this._start(n)+1}`),r}))}this._pages=t,this._page=Math.min(this._page,t-1),this.toggleAttribute(`data-single`,t<=1),this._render(!1),this._sync()}_settle(){let e=this._track,t=this._slides();if(!t.length)return;let n;if(e.scrollWidth>e.clientWidth&&e.scrollLeft+e.clientWidth>=e.scrollWidth-2)n=this._pages-1;else{let r=0,i=1/0;t.forEach((t,n)=>{let a=Math.abs(t.offsetLeft-e.scrollLeft);a<i&&(i=a,r=n)}),n=Math.min(this._pages-1,Math.round(r/this._perView))}n!==this._page&&(this._page=n,this._render(!0),this._sync())}_go(e){if(!Number.isInteger(e))return;this._page=Math.max(0,Math.min(this._pages-1,e));let t=this._slides()[this._start(this._page)];if(t){let e=this._motion?.matches?`auto`:`smooth`;typeof this._track.scrollTo==`function`?this._track.scrollTo({left:t.offsetLeft,behavior:e}):this._track.scrollLeft=t.offsetLeft}this._render(!0),this._sync()}_render(e){let t=this.hasAttribute(`loop`);for(let e of this.querySelectorAll(`.wui-carousel-dot`))Number(e.dataset.page)===this._page?e.setAttribute(`aria-current`,`true`):e.removeAttribute(`aria-current`);this.querySelector(`.wui-carousel-prev`)?.setAttribute(`aria-disabled`,String(!t&&this._page===0)),this.querySelector(`.wui-carousel-next`)?.setAttribute(`aria-disabled`,String(!t&&this._page===this._pages-1));let n=this._slides().length,r=this._start(this._page)+1,a=Math.min(n,r+this._perView-1),o=i.status(r,a,n);if(o===this._status||(this._status=o,!e))return;let s=this.querySelector(`[data-wui-status]`);s&&!this._playing()&&(s.textContent=o),this.dispatchEvent(new CustomEvent(`wui:carousel:change`,{bubbles:!0,detail:{page:this._page,pages:this._pages}}))}_sync(){clearTimeout(this._timer),this._timer=null;let e=this._interval(),t=this.querySelector(`.wui-carousel-pause`);if(t){t.hidden=e===0||this._pages<=1||!!this._motion?.matches;let n=this._paused?this.getAttribute(`play-label`)||i.play:this.getAttribute(`pause-label`)||i.pause,r=t.querySelector(`.wui-carousel-pause-text`);r&&r.textContent!==n&&(r.textContent=n),this.toggleAttribute(`data-paused`,this._paused)}this._playing()&&(this._timer=setTimeout(this._tick,e))}};(0,t.defineElement)(`wui-carousel`,o),e.WuiCarousel=o})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.elementBase);
@@ -1 +1 @@
1
- (function(e,t,n,r,i){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var a=globalThis.WeborityUiElementsInternal?.version;if(a!==`0.80.8`)throw Error(`[webority-ui] code-block expects ui-elements 0.80.8 but the page loaded `+a+`.`);var o=Object.freeze([`text`,`json`,`js`,`cs`,`sql`,`bash`,`http`,`html`,`css`]),s=Object.freeze({text:``,json:`JSON`,js:`JavaScript`,cs:`C#`,sql:`SQL`,bash:`Bash`,http:`HTTP`,html:`HTML`,css:`CSS`}),c=e=>RegExp(`\\b(?:${e.join(`|`)})\\b`),l=`(?![\\s\\S])`,u=RegExp(`/\\*[\\s\\S]*?(?:\\*/|${l})`).source,d=[[`attr`,/"(?:[^"\\\n]|\\.)*"(?=\s*:)/],[`string`,/"(?:[^"\\\n]|\\.)*"?/],[`number`,/-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?\b/],[`literal`,c([`true`,`false`,`null`])],[`punct`,/[{}[\],:]/]],f=[[`comment`,RegExp(`//[^\\n]*|${u}`)],[`string`,/"(?:[^"\\\n]|\\.)*"?|'(?:[^'\\\n]|\\.)*'?|`(?:[^`\\]|\\[\s\S])*`?/],[`number`,/\b(?:0[xX][\da-fA-F_]+|\d[\d_]*\.?\d*(?:[eE][+-]?\d+)?n?)\b/],[`keyword`,c(`async.await.break.case.catch.class.const.continue.default.delete.do.else.export.extends.finally.for.from.function.if.import.in.instanceof.let.new.of.return.static.super.switch.this.throw.try.typeof.var.void.while.yield`.split(`.`))],[`literal`,c([`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`])],[`function`,/(?<![\w$])[A-Za-z_$][\w$]*(?=\s*\()/],[`type`,/(?<![\w$])[A-Z][\w$]*/],[`punct`,/[{}()[\];,]/]],p=[[`comment`,RegExp(`//[^\\n]*|${u}`)],[`string`,/@"(?:[^"]|"")*"?|\$@?"(?:[^"\\\n]|\\.)*"?|"(?:[^"\\\n]|\\.)*"?|'(?:[^'\\\n]|\\.)*'?/],[`number`,/\b\d[\d_]*\.?\d*(?:[eE][+-]?\d+)?[fFdDmMlLuU]{0,2}\b/],[`keyword`,c(`abstract.as.async.await.base.bool.break.byte.case.catch.char.checked.class.const.continue.decimal.default.delegate.do.double.else.enum.event.explicit.extern.finally.fixed.float.for.foreach.get.goto.if.implicit.in.init.int.interface.internal.is.lock.long.namespace.new.object.operator.out.override.params.private.protected.public.readonly.record.ref.required.return.sbyte.sealed.set.short.sizeof.static.string.struct.switch.this.throw.try.typeof.uint.ulong.unchecked.unsafe.ushort.using.var.virtual.void.volatile.when.while.with`.split(`.`))],[`literal`,c([`true`,`false`,`null`])],[`function`,/(?<!\w)[A-Za-z_]\w*(?=\s*\()/],[`type`,/(?<!\w)[A-Z]\w*/],[`punct`,/[{}()[\];,]/]],m=[[`comment`,RegExp(`--[^\\n]*|${u}`)],[`string`,/'(?:[^']|'')*'?/],[`variable`,/@@?\w+/],[`number`,/\b\d+(?:\.\d+)?\b/],[`keyword`,c(`add.all.alter.and.as.asc.begin.between.by.case.check.column.commit.constraint.create.cross.database.declare.default.delete.desc.distinct.drop.else.end.exec.execute.exists.foreign.from.full.function.group.having.if.in.index.inner.insert.into.is.join.key.left.like.limit.not.null.offset.on.or.order.outer.over.partition.primary.procedure.references.return.returns.right.rollback.select.set.table.then.top.transaction.union.unique.update.values.view.when.where.while.with`.split(`.`))],[`literal`,c([`true`,`false`])],[`type`,c([`bigint`,`bit`,`char`,`date`,`datetime`,`datetime2`,`decimal`,`float`,`int`,`money`,`nchar`,`numeric`,`nvarchar`,`real`,`smallint`,`text`,`time`,`tinyint`,`uniqueidentifier`,`varchar`])],[`function`,/\b[A-Za-z_]\w*(?=\s*\()/],[`punct`,/[(),;]/]],h=[[`comment`,/(?<![^\s;|&(])#[^\n]*/],[`string`,/"(?:[^"\\]|\\[\s\S])*"?|'[^']*'?/],[`variable`,/\$(?:\{[^}\n]*\}?|[A-Za-z_]\w*|[0-9@#?$!*-])/],[`attr`,/(?<![\w-])--?[A-Za-z][\w-]*/],[`number`,/(?<![\w.-])\d+(?:\.\d+)?\b/],[`keyword`,c([`case`,`do`,`done`,`elif`,`else`,`esac`,`exit`,`export`,`fi`,`for`,`function`,`if`,`in`,`local`,`return`,`select`,`then`,`until`,`while`])],[`function`,c(`awk.az.cat.cd.chmod.chown.cp.curl.docker.dotnet.echo.gcloud.git.grep.kubectl.ls.mkdir.mv.npm.npx.pnpm.rm.sed.source.sudo.wget`.split(`.`))],[`punct`,/[|&;<>(){}[\]]+/]],g=[[`comment`,/^#[^\n]*/m],[`keyword`,/^(?:GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS|TRACE|CONNECT)(?= )/m],[`literal`,/HTTP\/\d(?:\.\d)?/],[`number`,/(?<=^HTTP\/\d(?:\.\d)? )\d{3}\b/m],[`function`,/(?<=^[A-Z]+ )\S+/m],[`attr`,/^[A-Za-z][\w-]*(?=:)/m],[`string`,/(?<=^[A-Za-z][\w-]*:[ \t]*)[^\n]+/m]],_=[[`comment`,RegExp(`<!--[\\s\\S]*?(?:-->|${l})`)],[`keyword`,/<![A-Za-z][^>]*>?/],[`tag`,/<\/?[A-Za-z][^<>]*>?/],[`literal`,/&#?\w+;/]],v={json:d,js:f,cs:p,sql:m,bash:h,http:g,css:[[`comment`,new RegExp(u)],[`string`,/"(?:[^"\\\n]|\\.)*"?|'(?:[^'\\\n]|\\.)*'?/],[`keyword`,/@[\w-]+|!important/],[`attr`,/[\w-]+(?=\s*:[^{};]*[;}])/],[`number`,/#[0-9a-fA-F]{3,8}\b|(?<![\w-])-?(?:\d+\.?\d*|\.\d+)(?:%|[A-Za-z]{1,4})?/],[`function`,/[\w-]+(?=\()/],[`type`,/[.#](?!\d)[A-Za-z_][\w-]*/],[`punct`,/[{}();:,]/]],html:_,htmlTag:[[`tag`,/^<\/?[\w:.-]+/],[`string`,/"[^"]*"?|'[^']*'?/],[`attr`,/(?<=\s)[^\s=<>/"']+/],[`punct`,/\/?>|=/]]},y=new Map;function b(e){let t=y.get(e);if(!t){let n=v[e],r=e===`sql`?`gi`:`g`,i=n.map(([,e])=>`(${e.source})`).join(`|`);t={re:new RegExp(i,`${r}m`),types:n.map(([e])=>e)},y.set(e,t)}return t}function x(e,t,n){if(!n)return;let r=e[e.length-1];r&&r[0]===t?r[1]+=n:e.push([t,n])}function S(e,t,n=[]){let{re:r,types:i}=b(e),a=0;for(let o of t.matchAll(r)){if(!o[0])continue;x(n,`plain`,t.slice(a,o.index));let r=i.findIndex((e,t)=>o[t+1]!==void 0);e===`html`&&i[r]===`tag`?S(`htmlTag`,o[0],n):x(n,i[r],o[0]),a=o.index+o[0].length}return x(n,`plain`,t.slice(a)),n}function C(e){let t=/\r?\n\r?\n/.exec(e);if(!t)return S(`http`,e);let n=S(`http`,e.slice(0,t.index+t[0].length)),r=e.slice(t.index+t[0].length),i=r.trimStart()[0];return i===`{`||i===`[`?S(`json`,r,n):i===`<`?S(`html`,r,n):(x(n,`plain`,r),n)}function w(e,t){let n=String(e??``);return!n||n.length>1e5?n?[[`plain`,n]]:[]:t===`http`?C(n):!Object.hasOwn(v,t)||t===`htmlTag`?[[`plain`,n]]:S(t,n)}function T(e,t){let n=[[]];for(let[r,i]of w(e,t))i.split(/\r\n|\r|\n/).forEach((e,t)=>{t>0&&n.push([]),e&&n[n.length-1].push([r,e])});return n.length>1&&n[n.length-1].length===0&&n.pop(),n}var E=class extends r.ElementBase{static get observedAttributes(){return[`language`,`line-numbers`,`wrap`,`label`,`copy-label`,`copied-label`]}constructor(){super(),this._chrome=null,this._observer=null,this._timer=0}connectedCallback(){this._render(),!(typeof MutationObserver>`u`)&&(this._observer=new MutationObserver(e=>{e.some(e=>!this._chrome?.contains(e.target))&&this._render()}),this._observer.observe(this,{childList:!0,subtree:!0,characterData:!0}))}disconnectedCallback(){this._observer?.disconnect(),this._observer=null,clearTimeout(this._timer)}attributeChangedCallback(){this.isConnected&&this._render()}_source(){return Array.from(this.children).find(e=>e.classList.contains(`wui-code-source`))}_render(){let e=this._source();if(!e)return;clearTimeout(this._timer);let t=this.ownerDocument,n=(e.textContent??``).replace(/\r?\n$/,``),r=this.getAttribute(`language`),i=o.includes(r)?r:`text`,a=this.getAttribute(`label`)||``,c=T(n,i),l=t.createElement(`div`);l.className=`wui-code-chrome`,l.append(this._bar(t,a||s[i],n));let u=t.createElement(`div`);u.className=`wui-code-view`,u.setAttribute(`role`,`region`),u.setAttribute(`aria-label`,a||`Code`),u.tabIndex=0,u.style.setProperty(`--wui-code-digits`,String(String(c.length).length));let d=t.createElement(`pre`);d.className=`wui-code-pre`;let f=t.createElement(`code`);for(let e of c){let n=t.createElement(`span`);n.className=`wui-code-line`;for(let[r,i]of e){if(r===`plain`){n.append(i);continue}let e=t.createElement(`span`);e.className=`wui-code-t-${r}`,e.textContent=i,n.append(e)}f.append(n)}d.append(f),u.append(d),l.append(u),this._chrome?.remove(),this._chrome=l,this.append(l),this.setAttribute(`data-wui-ready`,``),this._observer?.takeRecords()}_bar(e,t,r){let a=e.createElement(`div`);a.className=`wui-code-bar`;let o=e.createElement(`span`);o.className=`wui-code-title`,o.textContent=t;let s=this.getAttribute(`copy-label`)||`Copy`,c=this.getAttribute(`copied-label`)||`Copied`,l=e.createElement(`button`);l.type=`button`,l.className=`btn btn-ghost btn-sm wui-code-copy`,l.setAttribute(`aria-live`,`polite`);let u=e.createElement(`span`);u.className=`wui-code-copy-icon`;let d=e.createElement(`span`),f=e=>{u.innerHTML=(0,i.glyphSvg)(e?`check`:`files`,{size:14}),d.textContent=e?c:s};return f(!1),l.append(u,d),l.addEventListener(`click`,async()=>{await(0,n.copyTextToClipboard)(r)&&(f(!0),clearTimeout(this._timer),this._timer=setTimeout(()=>f(!1),n.COPY_FEEDBACK_MS))}),a.append(o,l),a}};(0,t.defineElement)(`wui-code-block`,E),e.WuiCodeBlock=E})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.copyText,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.iconGlyphs);
1
+ (function(e,t,n,r,i){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var a=globalThis.WeborityUiElementsInternal?.version;if(a!==`0.80.9`)throw Error(`[webority-ui] code-block expects ui-elements 0.80.9 but the page loaded `+a+`.`);var o=Object.freeze([`text`,`json`,`js`,`cs`,`sql`,`bash`,`http`,`html`,`css`]),s=Object.freeze({text:``,json:`JSON`,js:`JavaScript`,cs:`C#`,sql:`SQL`,bash:`Bash`,http:`HTTP`,html:`HTML`,css:`CSS`}),c=e=>RegExp(`\\b(?:${e.join(`|`)})\\b`),l=`(?![\\s\\S])`,u=RegExp(`/\\*[\\s\\S]*?(?:\\*/|${l})`).source,d=[[`attr`,/"(?:[^"\\\n]|\\.)*"(?=\s*:)/],[`string`,/"(?:[^"\\\n]|\\.)*"?/],[`number`,/-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?\b/],[`literal`,c([`true`,`false`,`null`])],[`punct`,/[{}[\],:]/]],f=[[`comment`,RegExp(`//[^\\n]*|${u}`)],[`string`,/"(?:[^"\\\n]|\\.)*"?|'(?:[^'\\\n]|\\.)*'?|`(?:[^`\\]|\\[\s\S])*`?/],[`number`,/\b(?:0[xX][\da-fA-F_]+|\d[\d_]*\.?\d*(?:[eE][+-]?\d+)?n?)\b/],[`keyword`,c(`async.await.break.case.catch.class.const.continue.default.delete.do.else.export.extends.finally.for.from.function.if.import.in.instanceof.let.new.of.return.static.super.switch.this.throw.try.typeof.var.void.while.yield`.split(`.`))],[`literal`,c([`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`])],[`function`,/(?<![\w$])[A-Za-z_$][\w$]*(?=\s*\()/],[`type`,/(?<![\w$])[A-Z][\w$]*/],[`punct`,/[{}()[\];,]/]],p=[[`comment`,RegExp(`//[^\\n]*|${u}`)],[`string`,/@"(?:[^"]|"")*"?|\$@?"(?:[^"\\\n]|\\.)*"?|"(?:[^"\\\n]|\\.)*"?|'(?:[^'\\\n]|\\.)*'?/],[`number`,/\b\d[\d_]*\.?\d*(?:[eE][+-]?\d+)?[fFdDmMlLuU]{0,2}\b/],[`keyword`,c(`abstract.as.async.await.base.bool.break.byte.case.catch.char.checked.class.const.continue.decimal.default.delegate.do.double.else.enum.event.explicit.extern.finally.fixed.float.for.foreach.get.goto.if.implicit.in.init.int.interface.internal.is.lock.long.namespace.new.object.operator.out.override.params.private.protected.public.readonly.record.ref.required.return.sbyte.sealed.set.short.sizeof.static.string.struct.switch.this.throw.try.typeof.uint.ulong.unchecked.unsafe.ushort.using.var.virtual.void.volatile.when.while.with`.split(`.`))],[`literal`,c([`true`,`false`,`null`])],[`function`,/(?<!\w)[A-Za-z_]\w*(?=\s*\()/],[`type`,/(?<!\w)[A-Z]\w*/],[`punct`,/[{}()[\];,]/]],m=[[`comment`,RegExp(`--[^\\n]*|${u}`)],[`string`,/'(?:[^']|'')*'?/],[`variable`,/@@?\w+/],[`number`,/\b\d+(?:\.\d+)?\b/],[`keyword`,c(`add.all.alter.and.as.asc.begin.between.by.case.check.column.commit.constraint.create.cross.database.declare.default.delete.desc.distinct.drop.else.end.exec.execute.exists.foreign.from.full.function.group.having.if.in.index.inner.insert.into.is.join.key.left.like.limit.not.null.offset.on.or.order.outer.over.partition.primary.procedure.references.return.returns.right.rollback.select.set.table.then.top.transaction.union.unique.update.values.view.when.where.while.with`.split(`.`))],[`literal`,c([`true`,`false`])],[`type`,c([`bigint`,`bit`,`char`,`date`,`datetime`,`datetime2`,`decimal`,`float`,`int`,`money`,`nchar`,`numeric`,`nvarchar`,`real`,`smallint`,`text`,`time`,`tinyint`,`uniqueidentifier`,`varchar`])],[`function`,/\b[A-Za-z_]\w*(?=\s*\()/],[`punct`,/[(),;]/]],h=[[`comment`,/(?<![^\s;|&(])#[^\n]*/],[`string`,/"(?:[^"\\]|\\[\s\S])*"?|'[^']*'?/],[`variable`,/\$(?:\{[^}\n]*\}?|[A-Za-z_]\w*|[0-9@#?$!*-])/],[`attr`,/(?<![\w-])--?[A-Za-z][\w-]*/],[`number`,/(?<![\w.-])\d+(?:\.\d+)?\b/],[`keyword`,c([`case`,`do`,`done`,`elif`,`else`,`esac`,`exit`,`export`,`fi`,`for`,`function`,`if`,`in`,`local`,`return`,`select`,`then`,`until`,`while`])],[`function`,c(`awk.az.cat.cd.chmod.chown.cp.curl.docker.dotnet.echo.gcloud.git.grep.kubectl.ls.mkdir.mv.npm.npx.pnpm.rm.sed.source.sudo.wget`.split(`.`))],[`punct`,/[|&;<>(){}[\]]+/]],g=[[`comment`,/^#[^\n]*/m],[`keyword`,/^(?:GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS|TRACE|CONNECT)(?= )/m],[`literal`,/HTTP\/\d(?:\.\d)?/],[`number`,/(?<=^HTTP\/\d(?:\.\d)? )\d{3}\b/m],[`function`,/(?<=^[A-Z]+ )\S+/m],[`attr`,/^[A-Za-z][\w-]*(?=:)/m],[`string`,/(?<=^[A-Za-z][\w-]*:[ \t]*)[^\n]+/m]],_=[[`comment`,RegExp(`<!--[\\s\\S]*?(?:-->|${l})`)],[`keyword`,/<![A-Za-z][^>]*>?/],[`tag`,/<\/?[A-Za-z][^<>]*>?/],[`literal`,/&#?\w+;/]],v={json:d,js:f,cs:p,sql:m,bash:h,http:g,css:[[`comment`,new RegExp(u)],[`string`,/"(?:[^"\\\n]|\\.)*"?|'(?:[^'\\\n]|\\.)*'?/],[`keyword`,/@[\w-]+|!important/],[`attr`,/[\w-]+(?=\s*:[^{};]*[;}])/],[`number`,/#[0-9a-fA-F]{3,8}\b|(?<![\w-])-?(?:\d+\.?\d*|\.\d+)(?:%|[A-Za-z]{1,4})?/],[`function`,/[\w-]+(?=\()/],[`type`,/[.#](?!\d)[A-Za-z_][\w-]*/],[`punct`,/[{}();:,]/]],html:_,htmlTag:[[`tag`,/^<\/?[\w:.-]+/],[`string`,/"[^"]*"?|'[^']*'?/],[`attr`,/(?<=\s)[^\s=<>/"']+/],[`punct`,/\/?>|=/]]},y=new Map;function b(e){let t=y.get(e);if(!t){let n=v[e],r=e===`sql`?`gi`:`g`,i=n.map(([,e])=>`(${e.source})`).join(`|`);t={re:new RegExp(i,`${r}m`),types:n.map(([e])=>e)},y.set(e,t)}return t}function x(e,t,n){if(!n)return;let r=e[e.length-1];r&&r[0]===t?r[1]+=n:e.push([t,n])}function S(e,t,n=[]){let{re:r,types:i}=b(e),a=0;for(let o of t.matchAll(r)){if(!o[0])continue;x(n,`plain`,t.slice(a,o.index));let r=i.findIndex((e,t)=>o[t+1]!==void 0);e===`html`&&i[r]===`tag`?S(`htmlTag`,o[0],n):x(n,i[r],o[0]),a=o.index+o[0].length}return x(n,`plain`,t.slice(a)),n}function C(e){let t=/\r?\n\r?\n/.exec(e);if(!t)return S(`http`,e);let n=S(`http`,e.slice(0,t.index+t[0].length)),r=e.slice(t.index+t[0].length),i=r.trimStart()[0];return i===`{`||i===`[`?S(`json`,r,n):i===`<`?S(`html`,r,n):(x(n,`plain`,r),n)}function w(e,t){let n=String(e??``);return!n||n.length>1e5?n?[[`plain`,n]]:[]:t===`http`?C(n):!Object.hasOwn(v,t)||t===`htmlTag`?[[`plain`,n]]:S(t,n)}function T(e,t){let n=[[]];for(let[r,i]of w(e,t))i.split(/\r\n|\r|\n/).forEach((e,t)=>{t>0&&n.push([]),e&&n[n.length-1].push([r,e])});return n.length>1&&n[n.length-1].length===0&&n.pop(),n}var E=class extends r.ElementBase{static get observedAttributes(){return[`language`,`line-numbers`,`wrap`,`label`,`copy-label`,`copied-label`]}constructor(){super(),this._chrome=null,this._observer=null,this._timer=0}connectedCallback(){this._render(),!(typeof MutationObserver>`u`)&&(this._observer=new MutationObserver(e=>{e.some(e=>!this._chrome?.contains(e.target))&&this._render()}),this._observer.observe(this,{childList:!0,subtree:!0,characterData:!0}))}disconnectedCallback(){this._observer?.disconnect(),this._observer=null,clearTimeout(this._timer)}attributeChangedCallback(){this.isConnected&&this._render()}_source(){return Array.from(this.children).find(e=>e.classList.contains(`wui-code-source`))}_render(){let e=this._source();if(!e)return;clearTimeout(this._timer);let t=this.ownerDocument,n=(e.textContent??``).replace(/\r?\n$/,``),r=this.getAttribute(`language`),i=o.includes(r)?r:`text`,a=this.getAttribute(`label`)||``,c=T(n,i),l=t.createElement(`div`);l.className=`wui-code-chrome`,l.append(this._bar(t,a||s[i],n));let u=t.createElement(`div`);u.className=`wui-code-view`,u.setAttribute(`role`,`region`),u.setAttribute(`aria-label`,a||`Code`),u.tabIndex=0,u.style.setProperty(`--wui-code-digits`,String(String(c.length).length));let d=t.createElement(`pre`);d.className=`wui-code-pre`;let f=t.createElement(`code`);for(let e of c){let n=t.createElement(`span`);n.className=`wui-code-line`;for(let[r,i]of e){if(r===`plain`){n.append(i);continue}let e=t.createElement(`span`);e.className=`wui-code-t-${r}`,e.textContent=i,n.append(e)}f.append(n)}d.append(f),u.append(d),l.append(u),this._chrome?.remove(),this._chrome=l,this.append(l),this.setAttribute(`data-wui-ready`,``),this._observer?.takeRecords()}_bar(e,t,r){let a=e.createElement(`div`);a.className=`wui-code-bar`;let o=e.createElement(`span`);o.className=`wui-code-title`,o.textContent=t;let s=this.getAttribute(`copy-label`)||`Copy`,c=this.getAttribute(`copied-label`)||`Copied`,l=e.createElement(`button`);l.type=`button`,l.className=`btn btn-ghost btn-sm wui-code-copy`,l.setAttribute(`aria-live`,`polite`);let u=e.createElement(`span`);u.className=`wui-code-copy-icon`;let d=e.createElement(`span`),f=e=>{u.innerHTML=(0,i.glyphSvg)(e?`check`:`files`,{size:14}),d.textContent=e?c:s};return f(!1),l.append(u,d),l.addEventListener(`click`,async()=>{await(0,n.copyTextToClipboard)(r)&&(f(!0),clearTimeout(this._timer),this._timer=setTimeout(()=>f(!1),n.COPY_FEEDBACK_MS))}),a.append(o,l),a}};(0,t.defineElement)(`wui-code-block`,E),e.WuiCodeBlock=E})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.copyText,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.iconGlyphs);
@@ -1,2 +1,2 @@
1
- (function(e,t,n,r,i){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var a=globalThis.WeborityUiElementsInternal?.version;if(a!==`0.80.8`)throw Error(`[webority-ui] command-palette expects ui-elements 0.80.8 but the page loaded `+a+`.`);var o=`[role="option"]`,s=`No results`,c=`All`,l=`Recent`,u=5,d=20,f=`.wui-cmd-back, [data-depth]`,p=0,m=class extends n.ElementBase{static get observedAttributes(){return[`filter`,`highlight`,`empty-text`,`path`,`root-label`,`recents-key`,`recents-limit`,`recents-label`]}constructor(){super(),this._path=[],this._crumbSig=null,this._modal=null,this._recentsId=`wui-cmd-recents-${++p}`,this._onModalHidden=()=>this._reset(),this._activeId=null,this._lastQuery=null,this._lastIds=null,this._userChose=!1,this._onKeyDown=e=>this._handleKeyDown(e),this._onClick=e=>{let t=e.target?.closest?.(f);if(t&&this.contains(t)){let e=t.matches(`.wui-cmd-back`)?this._path.length-1:Number(t.dataset.depth);this._goTo(this._path.slice(0,e));return}let n=this._optionFrom(e.target);n&&this._select(n)},this._onMouseDown=e=>{let t=e.target?.closest?.(f);(t&&this.contains(t)||this._optionFrom(e.target,!0))&&e.preventDefault()},this._onMouseMove=e=>{let t=this._optionFrom(e.target);t&&t.id!==this._activeId&&(this._userChose=!0,this._setActive(t,!1))},this._onInput=e=>{!this.hasAttribute(`filter`)||e.target!==this._input()||(this._applyFilter(),this.refresh())}}connectedCallback(){this._teardown(),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`click`,this._onClick),this.addEventListener(`mousedown`,this._onMouseDown),this.addEventListener(`mousemove`,this._onMouseMove),this.addEventListener(`input`,this._onInput),this._modal=this.closest(`.modal`),this._modal?.addEventListener(`hidden.bs.modal`,this._onModalHidden),this._readPath(),this.hasAttribute(`filter`)&&this._applyFilter(),this.refresh()}disconnectedCallback(){this._teardown()}attributeChangedCallback(e){this.isConnected&&(e===`path`&&this._readPath(),this.hasAttribute(`filter`)&&this._applyFilter(),this.refresh())}get filter(){return this.hasAttribute(`filter`)}set filter(e){this.toggleAttribute(`filter`,!!e)}get highlight(){return this.getAttribute(`highlight`)!==`false`}set highlight(e){this.setAttribute(`highlight`,e?`true`:`false`)}get emptyText(){return this.getAttribute(`empty-text`)??s}set emptyText(e){this.setAttribute(`empty-text`,String(e??``))}refresh(){this._renderRecents(),this._renderCrumbs();let e=this._input(),t=e?e.value:``,n=t!==this._lastQuery;this._lastQuery=t;let r=this._selectableOptions(),i=r.map(e=>e.id).join(`
1
+ (function(e,t,n,r,i){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var a=globalThis.WeborityUiElementsInternal?.version;if(a!==`0.80.9`)throw Error(`[webority-ui] command-palette expects ui-elements 0.80.9 but the page loaded `+a+`.`);var o=`[role="option"]`,s=`No results`,c=`All`,l=`Recent`,u=5,d=20,f=`.wui-cmd-back, [data-depth]`,p=0,m=class extends n.ElementBase{static get observedAttributes(){return[`filter`,`highlight`,`empty-text`,`path`,`root-label`,`recents-key`,`recents-limit`,`recents-label`]}constructor(){super(),this._path=[],this._crumbSig=null,this._modal=null,this._recentsId=`wui-cmd-recents-${++p}`,this._onModalHidden=()=>this._reset(),this._activeId=null,this._lastQuery=null,this._lastIds=null,this._userChose=!1,this._onKeyDown=e=>this._handleKeyDown(e),this._onClick=e=>{let t=e.target?.closest?.(f);if(t&&this.contains(t)){let e=t.matches(`.wui-cmd-back`)?this._path.length-1:Number(t.dataset.depth);this._goTo(this._path.slice(0,e));return}let n=this._optionFrom(e.target);n&&this._select(n)},this._onMouseDown=e=>{let t=e.target?.closest?.(f);(t&&this.contains(t)||this._optionFrom(e.target,!0))&&e.preventDefault()},this._onMouseMove=e=>{let t=this._optionFrom(e.target);t&&t.id!==this._activeId&&(this._userChose=!0,this._setActive(t,!1))},this._onInput=e=>{!this.hasAttribute(`filter`)||e.target!==this._input()||(this._applyFilter(),this.refresh())}}connectedCallback(){this._teardown(),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`click`,this._onClick),this.addEventListener(`mousedown`,this._onMouseDown),this.addEventListener(`mousemove`,this._onMouseMove),this.addEventListener(`input`,this._onInput),this._modal=this.closest(`.modal`),this._modal?.addEventListener(`hidden.bs.modal`,this._onModalHidden),this._readPath(),this.hasAttribute(`filter`)&&this._applyFilter(),this.refresh()}disconnectedCallback(){this._teardown()}attributeChangedCallback(e){this.isConnected&&(e===`path`&&this._readPath(),this.hasAttribute(`filter`)&&this._applyFilter(),this.refresh())}get filter(){return this.hasAttribute(`filter`)}set filter(e){this.toggleAttribute(`filter`,!!e)}get highlight(){return this.getAttribute(`highlight`)!==`false`}set highlight(e){this.setAttribute(`highlight`,e?`true`:`false`)}get emptyText(){return this.getAttribute(`empty-text`)??s}set emptyText(e){this.setAttribute(`empty-text`,String(e??``))}refresh(){this._renderRecents(),this._renderCrumbs();let e=this._input(),t=e?e.value:``,n=t!==this._lastQuery;this._lastQuery=t;let r=this._selectableOptions(),i=r.map(e=>e.id).join(`
2
2
  `),a=i!==this._lastIds;this._lastIds=i;let o=!n&&(this._userChose||!a)?r.find(e=>e.id===this._activeId):null;o||(this._userChose=!1),this._setActive(o??r[0]??null,n)}_input(){return this.querySelector(`[role="combobox"]`)}_optionFrom(e,t=!1){let n=e?.closest?.(o);return n&&this.contains(n)&&!this._isHidden(n)&&(t||!this._isDisabled(n))?n:null}_isDisabled(e){return e.getAttribute(`aria-disabled`)===`true`}_isHidden(e){return e.hidden||!!e.closest(`[role="group"]`)?.hidden}_selectableOptions(){return[...this.querySelectorAll(o)].filter(e=>!this._isHidden(e)&&!this._isDisabled(e))}_setActive(e,t){this._activeId=e?e.id:null;for(let t of this.querySelectorAll(o))t.setAttribute(`aria-selected`,t===e?`true`:`false`);let n=this._input();n&&(e?n.setAttribute(`aria-activedescendant`,e.id):n.removeAttribute(`aria-activedescendant`)),e&&t&&e.scrollIntoView({block:`nearest`})}_move(e){let t=this._selectableOptions();if(!t.length)return;let n=t.findIndex(e=>e.id===this._activeId),r=n<0?e>0?0:t.length-1:(n+e+t.length)%t.length;this._userChose=!0,this._setActive(t[r],!0)}_handleKeyDown(e){if(e.target===this._input()){if(e.key===`ArrowDown`||e.key===`ArrowUp`)e.preventDefault(),this._move(e.key===`ArrowDown`?1:-1);else if(e.key===`Backspace`&&!e.isComposing&&this._path.length&&!e.target.value)e.preventDefault(),this._goTo(this._path.slice(0,-1));else if(e.key===`Enter`&&!e.isComposing){let t=this._selectableOptions().find(e=>e.id===this._activeId);if(!t)return;e.preventDefault(),this._select(t)}}}_select(e){this._remember(e),this.dispatchEvent(new CustomEvent(`wui-command-palette:select`,{bubbles:!0,cancelable:!0,detail:{key:e.dataset.key??null,groupKey:e.dataset.groupKey??null,id:e.id}}))&&(e.dataset.opens?this._open(e.dataset.opens):e.dataset.href&&this._navigate(e.dataset.href))}_open(e){let t=[...this.querySelectorAll(`.wui-cmd-page`)].find(t=>t.dataset.page===e);this._goTo([...this._path,{key:e,label:t?.dataset.label??e}])}_goTo(e){this._input()?.focus(),this.dispatchEvent(new CustomEvent(`wui-command-palette:navigate`,{bubbles:!0,cancelable:!0,detail:{path:e}}))&&(this._path=e,this._restart())}_restart(){let e=this._input();e&&(e.value=``),this.hasAttribute(`filter`)&&this._applyFilter(),this.refresh()}_reset(){this.hasAttribute(`path`)||(this._path=[],this._restart())}_readPath(){let e=this.getAttribute(`path`);if(e==null)return;let t=JSON.parse(e);this._path=Array.isArray(t)?t.filter(e=>e&&typeof e.key==`string`&&typeof e.label==`string`):[]}_renderCrumbs(){let e=this.querySelector(`.wui-cmd-crumbs`);if(!e)return;let t=this.getAttribute(`root-label`)??c,n=JSON.stringify([t,this._path]);if(e.hidden=this._path.length===0,n===this._crumbSig)return;this._crumbSig=n;let r=e.querySelector(`.wui-cmd-trail`);if(!r)return;let i=[t,...this._path.map(e=>e.label)];r.replaceChildren(...i.map((e,t)=>{let n=document.createElement(`li`),r=t===i.length-1,a=document.createElement(r?`span`:`button`);return a.className=`wui-cmd-crumb`,a.textContent=e,r?a.setAttribute(`aria-current`,`page`):(a.type=`button`,a.dataset.depth=String(t)),n.append(a),n}))}_recentsHost(){return this.querySelector(`.wui-cmd-recents`)}_realOptions(){let e=this._recentsHost();return[...this.querySelectorAll(o)].filter(t=>!e?.contains(t))}_recentEntries(){let e=this.getAttribute(`recents-key`);if(!e)return[];let t;try{t=JSON.parse(globalThis.localStorage?.getItem(e)??`[]`)}catch{return[]}return Array.isArray(t)?t.filter(e=>e&&typeof e.g==`string`&&typeof e.k==`string`):[]}_recentsLimit(){let e=Number.parseInt(this.getAttribute(`recents-limit`)??``,10);return Number.isFinite(e)&&e>0?Math.min(e,d):u}_remember(e){let t=this.getAttribute(`recents-key`),{groupKey:n,key:r,opens:i}=e.dataset;if(!t||i||n==null||r==null)return;let a=[{g:n,k:r},...this._recentEntries().filter(e=>!(e.g===n&&e.k===r))];try{globalThis.localStorage?.setItem(t,JSON.stringify(a.slice(0,this._recentsLimit())))}catch{}}_renderRecents(){let e=this._recentsHost();if(!e)return;let t=this._input(),n=this._path.length===0&&!(t?.value??``).trim()?this._recentEntries():[],r=this._realOptions(),i=[];for(let e of n){let t=r.find(t=>t.dataset.groupKey===e.g&&t.dataset.key===e.k);if(t&&!t.dataset.opens&&!this._isDisabled(t)&&i.push(t),i.length>=this._recentsLimit())break}if(!i.length){e.firstChild&&e.replaceChildren();return}let a=`${this._recentsId}-label`,o=document.createElement(`div`);o.className=`wui-cmd-group`,o.setAttribute(`role`,`group`),o.setAttribute(`aria-labelledby`,a);let s=document.createElement(`div`);s.className=`wui-cmd-group-label`,s.setAttribute(`role`,`presentation`),s.id=a,s.textContent=this.getAttribute(`recents-label`)??l,o.append(s);for(let e of i){let t=e.cloneNode(!0);t.id=`${this._recentsId}-${e.id}`,t.hidden=!1,t.removeAttribute(`aria-selected`),o.append(t)}e.replaceChildren(o)}_inScope(e,t){return!t||(e.closest(`.wui-cmd-page`)?.dataset.page??null)===(this._path.at(-1)?.key??null)}_navigate(e){window.location.assign(e)}_applyFilter(){let e=this._input(),t=(e?e.value:``).trim(),n=t.toLowerCase(),a=this.highlight,s=[...this.querySelectorAll(`.wui-cmd-page`)],c=s.length>0,l=this._path.at(-1)?.key??null;for(let e of s)e.hidden=e.dataset.page!==l;let u=0;for(let e of this._realOptions()){let o=e.querySelector(`.wui-cmd-item-label`),s=e.dataset.label??o?.textContent??``,l=this._inScope(e,c)&&(!n||s.toLowerCase().includes(n));e.hidden=!l,l&&u++,o&&(o.innerHTML=(0,i.matchSegments)(s,a?t:``).map(e=>e.match?`<mark class="wui-cmd-mark">${(0,r.escapeHtml)(e.text)}</mark>`:(0,r.escapeHtml)(e.text)).join(``))}let d=this._recentsHost();for(let e of this.querySelectorAll(`[role="group"]`))d?.contains(e)||(e.hidden=![...e.querySelectorAll(o)].some(e=>!e.hidden));let f=this.querySelector(`[role="listbox"]`);f&&(f.hidden=u===0);let p=this.querySelector(`.wui-cmd-empty`);p&&(p.textContent=n&&u===0?this.emptyText:``)}_teardown(){this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`mousedown`,this._onMouseDown),this.removeEventListener(`mousemove`,this._onMouseMove),this.removeEventListener(`input`,this._onInput),this._modal?.removeEventListener(`hidden.bs.modal`,this._onModalHidden),this._modal=null}};(0,t.defineElement)(`wui-command-palette`,m),e.WuiCommandPalette=m})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.optionLabel,WeborityUiElementsInternal.modules.textMatch);
@@ -1 +1 @@
1
- (function(e,t,n,r,i,a,o,s){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var c=globalThis.WeborityUiElementsInternal?.version;if(c!==`0.80.8`)throw Error(`[webority-ui] comment-thread expects ui-elements 0.80.8 but the page loaded `+c+`.`);var l=Object.freeze([`👍`,`❤️`,`🎉`,`😄`,`👀`,`🙏`]),u=Object.freeze([`post`,`reply`,`edit`,`delete`,`react`]),d=Object.freeze({listName:`Comments`,empty:`No comments yet.`,deleted:`This comment was deleted.`,edited:`Edited`,reply:`Reply`,edit:`Edit`,delete:`Delete`,cancel:`Cancel`,save:`Save`,post:`Comment`,confirmDelete:`Delete this comment?`,composerLabel:`Add a comment`,composerPlaceholder:`Write a comment. Type @ to mention someone.`,replyLabel:e=>`Reply to ${e}`,replyPlaceholder:`Write a reply`,editLabel:`Edit comment`,repliesName:e=>`Replies to ${e}`,reactions:`Reactions`,addReaction:`Add a reaction`,pickerName:`Choose a reaction`,emptyBody:`Write something first.`,done:Object.freeze({post:`Comment posted.`,reply:`Reply posted.`,edit:`Comment saved.`,delete:`Comment deleted.`,react:``}),failed:Object.freeze({forbidden:`You do not have permission to do this.`,client:`This did not go through. Refresh the page and try again.`,validation:`This was not accepted. Check it and try again.`,server:`Something went wrong on our side. Try again in a moment.`,network:`Could not reach the server. Check your connection and try again.`})}),f=`[data-wui-items]`,p=`[data-wui-picker]`,m=`[data-wui-composer]`,h=`[data-wui-comment]`,g=`[data-wui-live]`,_=e=>typeof e?.message==`string`&&e.message?e.message:d.failed.server,v=class extends r.ElementBase{constructor(){super(),this._wired=!1,this._busy=!1,this._peopleProp=null,this._pickerFor=null,this._onClick=this._onClick.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onSubmitKey=this._onSubmitKey.bind(this),this._onDocClick=e=>{this._pickerFor&&!this.querySelector(p)?.contains(e.target)&&!this._pickerFor.button.contains(e.target)&&this._closePicker(!1)},this._repositionPicker=()=>{this._pickerFor&&(0,n.anchorOverlay)(this._pickerFor.button,this.querySelector(p))}}connectedCallback(){if(Object.hasOwn(this,`people`)){let e=this.people;delete this.people,this.people=e}this._wired||(this._wired=!0,this.addEventListener(`click`,this._onClick),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`wui:mention-input:submit`,this._onSubmitKey),this._handPeople(this.querySelector(`${m} wui-mention-input`)))}disconnectedCallback(){this._closePicker(!1)}get people(){return this._peopleProp?this._peopleProp:[...this.querySelectorAll(`:scope > [data-wui-people] > wui-option`)].map(e=>({value:e.getAttribute(`value`)??``,label:e.textContent.trim(),description:e.getAttribute(`data-description`)||void 0,src:e.getAttribute(`data-src`)||void 0}))}set people(e){this._peopleProp=Array.isArray(e)?e:[];for(let e of this.querySelectorAll(`wui-mention-input`))e.people=this._peopleProp}_handPeople(e){!e||this.hasAttribute(`remote`)||this.hasAttribute(`source`)||(e.people=this.people)}_reactionChoices(){let e=this.getAttribute(`reaction-choices`),t=e?e.split(/\s+/).filter(Boolean):[];return t.length?t:l}_onClick(e){let t=e.target.closest?.(`[data-wui-emoji]`);if(t&&this.contains(t)&&!t.disabled){let e=t.closest(p),n=e?this._pickerFor?.comment:t.closest(h);e&&this._closePicker(!0),n&&this._react(n,t.getAttribute(`data-wui-emoji`));return}let n=e.target.closest?.(`[data-wui-action]`);if(!n||!this.contains(n)||n.disabled)return;let r=n.closest(h);switch(n.getAttribute(`data-wui-action`)){case`reply`:this._openReply(r,n);break;case`edit`:this._openEditor(r,n);break;case`delete`:this._askDelete(r);break;case`cancel-delete`:this._closeConfirm(r,!0);break;case`confirm-delete`:this._send(`delete`,{commentId:r.getAttribute(`data-wui-comment`)},{comment:r,scope:r});break;case`react-menu`:this._pickerFor?.button===n?this._closePicker(!0):this._openPicker(r,n);break;case`cancel`:this._closeSlot(n.closest(`[data-wui-reply], [data-wui-editor]`),!0);break;case`post`:case`send`:this._sendFrom(n);break}}_onKeyDown(e){let t=this.querySelector(p);if(this._pickerFor&&t?.contains(e.target)){let n=[...t.querySelectorAll(`[data-wui-emoji]`)],r=n.indexOf(e.target);e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),this._closePicker(!0)):e.key===`ArrowRight`||e.key===`ArrowLeft`?(e.preventDefault(),n[(r+(e.key===`ArrowRight`?1:-1)+n.length)%n.length]?.focus()):e.key===`Tab`&&this._closePicker(!1);return}if(e.key!==`Escape`)return;let n=e.target.closest?.(`[data-wui-reply], [data-wui-editor]`);if(n&&this.contains(n)){e.preventDefault(),e.stopPropagation(),this._closeSlot(n,!0);return}let r=e.target.closest?.(`[data-wui-confirm]`);r&&(e.preventDefault(),e.stopPropagation(),this._closeConfirm(r.closest(h),!0))}_onSubmitKey(e){let t=(e.target.closest?.(`[data-wui-reply], [data-wui-editor], [data-wui-composer]`))?.querySelector(`[data-wui-action="send"], [data-wui-action="post"]`);t&&!t.disabled&&this._sendFrom(t)}_openReply(e,t){let n=e?.querySelector(`:scope > [data-wui-reply]`);if(!n)return;if(!n.hidden){n.querySelector(`wui-mention-input`)?.focus();return}let r=e.querySelector(`.wui-comment-author`)?.textContent.trim()||``;this._fillSlot(n,{label:d.replyLabel(r),placeholder:d.replyPlaceholder,value:``,send:d.reply,opener:t})}_openEditor(e,t){let n=e?.querySelector(`:scope > .wui-comment-row [data-wui-editor]`);if(!n||!n.hidden)return;let r=n.parentElement.querySelector(`:scope > [data-wui-text]`);r&&(r.hidden=!0),this._fillSlot(n,{label:d.editLabel,placeholder:``,value:e.getAttribute(`data-value`)??``,send:d.save,opener:t})}_fillSlot(e,{label:t,placeholder:n,value:r,send:i,opener:a}){let o=this.ownerDocument,s=o.createElement(`wui-mention-input`);s.className=`wui-mention-input`,s.setAttribute(`label`,t),n&&s.setAttribute(`placeholder`,n),s.setAttribute(`rows`,`2`),s.setAttribute(`value`,r);for(let e of[`remote`,`source`,`min-chars`,`debounce`])this.hasAttribute(e)&&s.setAttribute(e,this.getAttribute(e));let c=o.createElement(`div`);c.className=`wui-comment-form-actions`,c.append(this._button(`btn btn-primary btn-sm`,`send`,i),this._button(`btn btn-ghost btn-sm`,`cancel`,d.cancel));let l=o.createElement(`div`);l.className=`wui-comment-error`,l.setAttribute(`data-wui-error`,``),l.hidden=!0,e.replaceChildren(s,c,l),this._handPeople(s),e.hidden=!1,this._openers??=new WeakMap,this._openers.set(e,a),s.focus();let u=s.querySelector(`textarea`);u?.setSelectionRange(u.value.length,u.value.length)}_button(e,t,n){let r=this.ownerDocument.createElement(`button`);return r.type=`button`,r.className=e,r.setAttribute(`data-wui-action`,t),r.textContent=n,r}_closeSlot(e,t){if(!e||e.hidden)return;if(e.hidden=!0,e.replaceChildren(),e.hasAttribute(`data-wui-editor`)){let t=e.parentElement?.querySelector(`:scope > [data-wui-text]`);t&&(t.hidden=!1)}let n=this._openers?.get(e);t&&n?.isConnected&&n.focus()}_askDelete(e){let t=e?.querySelector(`:scope > .wui-comment-row`),n=t?.querySelector(`[data-wui-confirm]`),r=t?.querySelector(`[data-wui-actions]`);n&&(n.hidden=!1,r&&(r.hidden=!0),n.querySelector(`[data-wui-action="cancel-delete"]`)?.focus())}_closeConfirm(e,t){let n=e?.querySelector(`:scope > .wui-comment-row`),r=n?.querySelector(`[data-wui-confirm]`),i=n?.querySelector(`[data-wui-actions]`);r&&(r.hidden=!0),i&&(i.hidden=!1),t&&i?.querySelector(`[data-wui-action="delete"]`)?.focus()}_openPicker(e,t){let r=this.querySelector(p);!r||!e||(this._closePicker(!1),this._pickerFor={comment:e,button:t},t.setAttribute(`aria-expanded`,`true`),r.hidden=!1,(0,n.anchorOverlay)(t,r),(0,n.bindReanchor)(this,this._repositionPicker),this.ownerDocument.addEventListener(`click`,this._onDocClick,!0),r.querySelector(`[data-wui-emoji]`)?.focus())}_closePicker(e){let t=this._pickerFor;if(!t)return;this._pickerFor=null;let r=this.querySelector(p);r&&(r.hidden=!0),t.button.setAttribute(`aria-expanded`,`false`),(0,n.unbindReanchor)(this),this.ownerDocument.removeEventListener(`click`,this._onDocClick,!0),e&&t.button.isConnected&&t.button.focus()}_react(e,t){t&&this._send(`react`,{commentId:e.getAttribute(`data-wui-comment`),emoji:t},{comment:e,scope:e})}_sendFrom(e){let t=e.closest(`[data-wui-reply], [data-wui-editor], [data-wui-composer]`);if(!t)return;let n=t.querySelector(`wui-mention-input`),r=n?.value??``;if(!r.trim()){this._showError(t,d.emptyBody),n?.focus();return}let i=t.closest(h);t.hasAttribute(`data-wui-composer`)?this._send(`post`,{body:r},{scope:t,form:t}):t.hasAttribute(`data-wui-reply`)?this._send(`reply`,{parentId:i.getAttribute(`data-wui-comment`),body:r},{comment:i,scope:t,form:t}):this._send(`edit`,{commentId:i.getAttribute(`data-wui-comment`),body:r},{comment:i,scope:t,form:t})}async _send(e,t,{comment:n,scope:r,form:i}){if(this._busy)return;this._busy=!0,this.setAttribute(`aria-busy`,`true`);let a=i??n?.querySelector(`:scope > .wui-comment-row`)??this;this._showError(a,null);let o=[...r.querySelectorAll(`button, textarea`)].filter(e=>!e.disabled);for(let e of o)e.disabled=!0;let s=await this._persist({intent:e,...t});for(let e of o)e.isConnected&&(e.disabled=!1);this._busy=!1,this.removeAttribute(`aria-busy`);let c=t.commentId??null,l=t.parentId??null;if(s.ok){s.html!=null&&this._swapItems(s.html),e===`post`?i?.querySelector(`wui-mention-input`)?.clear():i?.isConnected&&this._closeSlot(i,!1),e===`delete`&&n?.isConnected&&this._closeConfirm(n,!1),this._restoreFocus(e,t,i),d.done[e]&&this._announce(d.done[e]),this.dispatchEvent(new CustomEvent(`wui:comment-thread:done`,{bubbles:!0,detail:{intent:e,commentId:c,parentId:l}}));return}s.kind===`session`||s.kind===`aborted`||(this._showError(a.isConnected?a:this,s.message),this._announce(s.message),this.dispatchEvent(new CustomEvent(`wui:comment-thread:failed`,{bubbles:!0,detail:{intent:e,kind:s.kind,message:s.message}})))}async _persist(e){if(this.hasAttribute(`controlled`)){if(typeof this.submit!=`function`)return{ok:!0,html:null};try{return await this.submit(e),{ok:!0,html:null}}catch(e){return{ok:!1,kind:`server`,message:_(e)}}}let t=this.getAttribute(`action`);if(!t)return{ok:!1,kind:`client`,message:d.failed.client};let n=new URLSearchParams;for(let[t,r]of Object.entries(e))r!=null&&n.set(t,r);let r=await(0,i.wuiFetch)(t,{method:`POST`,body:n});return r.ok?{ok:!0,html:r.html}:{ok:!1,kind:r.kind,message:r.message||d.failed[r.kind]||d.failed.server}}_swapItems(e){let t=this.querySelector(f);if(!t||!e.trim())return;let n=this.ownerDocument.createElement(`template`);n.innerHTML=e;let r=n.content.querySelector(f);t.replaceChildren(...r?r.childNodes:n.content.childNodes)}_restoreFocus(e,t,n){let r=this.ownerDocument,i=r.activeElement;if(i&&i!==r.body&&i.isConnected&&this.contains(i)&&!i.disabled)return;let a=e=>e?[...this.querySelectorAll(h)].find(t=>t.getAttribute(`data-wui-comment`)===e):null,o=e=>a(e)?.querySelector(`:scope > .wui-comment-row`),s=null;if(e===`post`)s=n?.querySelector(`textarea`);else if(e===`reply`)s=o(t.parentId)?.querySelector(`[data-wui-action="reply"]`);else if(e===`edit`)s=o(t.commentId)?.querySelector(`[data-wui-action="edit"]`);else if(e===`react`){let e=o(t.commentId);s=[...e?.querySelectorAll(`button[data-wui-emoji]`)??[]].find(e=>e.getAttribute(`data-wui-emoji`)===t.emoji)??e?.querySelector(`[data-wui-action="react-menu"]`)}s??=this.querySelector(`${m} textarea`),s?.focus()}_showError(e,t){let n=e?.querySelector?.(`:scope > [data-wui-error], :scope > .wui-comment-main > [data-wui-error]`);n&&(n.textContent=t||``,n.hidden=!t)}_announce(e){let t=this.querySelector(`:scope > ${g}`);!t||!e||(t.textContent=``,t.textContent=e)}},y=Object.freeze({listName:`People`,searching:`Searching…`,noMatch:`No one matches`,found:e=>`${e===1?`1 person`:`${(0,o.formatNumber)(e,{decimals:0})} people`}. Up and down to choose, Enter to mention.`,mentioned:e=>`Mentioned ${e}.`}),b=`[data-wui-control]`,x=`[data-wui-field]`,S=`[data-wui-menu]`,C=`[data-wui-live]`,w=0,T=e=>e&&a.MENTION_ID_PATTERN.test(String(e.value??``))&&(0,a.mentionLabel)(e.label)!==``;function E(e){let t=e.ownerDocument;e.id||=`wui-mention-${++w}`;let n=t.createElement(`textarea`);n.id=`${e.id}-text`,n.className=`form-control textarea wui-mention-input-text`,n.rows=Number(e.getAttribute(`rows`))>0?Number(e.getAttribute(`rows`)):3,n.setAttribute(`data-wui-control`,``),n.setAttribute(`aria-autocomplete`,`list`),n.setAttribute(`aria-controls`,`${e.id}-people`);let r=e.getAttribute(`label`);r&&n.setAttribute(`aria-label`,r);let i=e.getAttribute(`placeholder`);i&&(n.placeholder=i);for(let t of[`aria-describedby`,`aria-invalid`]){let r=e.getAttribute(t);r&&n.setAttribute(t,r)}n.disabled=e.hasAttribute(`disabled`),e.appendChild(n);let a=e.getAttribute(`name`);if(a){let n=t.createElement(`input`);n.type=`hidden`,n.name=a,n.value=e.getAttribute(`value`)??``,n.setAttribute(`data-wui-field`,``),e.appendChild(n)}let o=t.createElement(`div`);o.className=`wui-mention-menu`,o.id=`${e.id}-people`,o.setAttribute(`role`,`listbox`),o.setAttribute(`aria-label`,y.listName),o.setAttribute(`data-wui-menu`,``),o.hidden=!0,e.appendChild(o);let s=t.createElement(`span`);s.className=`visually-hidden`,s.setAttribute(`data-wui-live`,``),s.setAttribute(`aria-live`,`polite`),s.setAttribute(`aria-atomic`,`true`),e.appendChild(s)}var D=class extends r.ElementBase{static get observedAttributes(){return[`disabled`,`aria-invalid`,`aria-describedby`]}constructor(){super(),this._wired=!1,this._text=``,this._mentions=[],this._peopleProp=null,this._declared=null,this._loading=!1,this._query=null,this._results=[],this._active=-1,this._timer=null,this._searchSeq=0,this._abort=null,this._onInput=this._onInput.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onCaret=this._onCaret.bind(this),this._onFocusOut=this._onFocusOut.bind(this),this._onMenuDown=e=>e.preventDefault(),this._onMenuClick=this._onMenuClick.bind(this),this._reposition=()=>{this._isOpen()&&this._position()}}connectedCallback(){for(let e of[`people`,`loading`,`value`])if(Object.hasOwn(this,e)){let t=this[e];delete this[e],this[e]=t}if(this._wired)return;this._wired=!0,this.querySelector(b)||E(this);let e=this._control(),t=this.querySelector(x)?.value??this.getAttribute(`value`)??``;this._pendingValue===void 0?this._load(t):this._load(this._pendingValue),this._pendingValue=void 0,e.addEventListener(`input`,this._onInput),e.addEventListener(`keydown`,this._onKeyDown),e.addEventListener(`click`,this._onCaret),e.addEventListener(`keyup`,this._onCaret),this.addEventListener(`focusout`,this._onFocusOut);let n=this._menu();n.addEventListener(`mousedown`,this._onMenuDown),n.addEventListener(`click`,this._onMenuClick),n.addEventListener(`mousemove`,e=>{let t=e.target.closest?.(`.wui-mention-option`);t&&Number(t.dataset.index)!==this._active&&this._setActive(Number(t.dataset.index),{reveal:!1})})}disconnectedCallback(){this._close(),clearTimeout(this._timer),this._abort?.abort()}attributeChangedCallback(e,t,n){let r=this._control();r&&(e===`disabled`?(r.disabled=n!==null,n!==null&&this._close()):n===null?r.removeAttribute(e):r.setAttribute(e,n))}get value(){return(0,a.mentionValueFromText)(this._text,this._mentions)}set value(e){let t=e==null?``:String(e);if(!this._wired){this._pendingValue=t;return}t!==this.value&&this._load(t)}get mentions(){let e=new Set,t=[];for(let n of[...this._mentions].sort((e,t)=>e.start-t.start))e.has(n.id)||(e.add(n.id),t.push({id:n.id,label:n.label}));return t}get people(){return this._peopleProp?this._peopleProp:(this._declared||=[...this.querySelectorAll(`[data-wui-people] > wui-option`)].map(e=>({value:e.getAttribute(`value`)??``,label:e.textContent.trim(),description:e.getAttribute(`data-description`)||void 0,src:e.getAttribute(`data-src`)||void 0})),this._declared)}set people(e){this._peopleProp=Array.isArray(e)?e.filter(T):[],(this._isOpen()||this._query!==null)&&this._refresh()}get loading(){return this._loading}set loading(e){this._loading=!!e,this._query!==null&&this._renderMenu()}focus(e){this._control()?.focus(e)}clear(){this._load(``),this._emit()}_control(){return this.querySelector(b)}_menu(){return this.querySelector(S)}_load(e){let{text:t,mentions:n}=(0,a.mentionTextFromValue)(e);this._text=t,this._mentions=n;let r=this._control();r&&(r.defaultValue=t,r.value=t),this._syncField(),this._close()}_syncField(){let e=this.querySelector(x);e&&(e.value=this.value)}_emit(){this._syncField(),this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,detail:{value:this.value,mentions:this.mentions}}))}_onInput(){let e=this._control(),t=e.value,n=this._text,r=t.length-n.length,i=Math.min(n.length,t.length),a=Math.max(0,Math.min(i,e.selectionEnd-Math.max(r,0))),o=0;for(;o<a&&n[o]===t[o];)o++;let s=0;for(;s<i-o&&n[n.length-1-s]===t[t.length-1-s];)s++;let c=n.length-s;this._mentions=this._mentions.filter(e=>e.end<=o||e.start>=c).map(e=>e.start>=c?{...e,start:e.start+r,end:e.end+r}:e),this._text=t,this._emit(),this._onCaret()}_onCaret(e){if(e?.type===`keyup`&&[`ArrowUp`,`ArrowDown`,`Enter`,`Tab`,`Escape`].includes(e.key))return;let t=this._queryAtCaret();if(!t){this._close();return}this._query&&t.text===this._query.text&&t.start===this._query.start||(this._query=t,this._refresh())}_queryAtCaret(){let e=this._control();if(!e||e.disabled||e.selectionStart!==e.selectionEnd)return null;let t=e.selectionStart,n=this._text,r=n.lastIndexOf(`@`,t-1);if(r<0||r>0&&!/[\s([{"'“‘]/.test(n[r-1]))return null;let i=n.slice(r+1,t);return i.length>40||/[\n@]/.test(i)||/^\s/.test(i)||/\s{2}/.test(i)||this._mentions.some(e=>r>=e.start&&r<e.end)?null:{start:r,end:t,text:i}}_refresh(){if(!this._query)return;let e=this.hasAttribute(`remote`)||this.hasAttribute(`source`);if(e&&this._query.text.length<this._minChars()){this._results=[],this._close();return}e&&!this._answered(this._query.text)&&this._search(this._query.text);let t=this._query.text.toLowerCase(),n=e?this.people:this.people.filter(e=>(0,a.mentionLabel)(e.label).toLowerCase().includes(t));this._results=n.slice(0,8),this._renderMenu()}_answered(e){return this._lastSearch===e}_minChars(){let e=this.getAttribute(`min-chars`),t=e==null||e===``?1:Number(e);return Number.isFinite(t)&&t>=0?t:1}_debounce(){let e=this.getAttribute(`debounce`),t=e==null||e===``?250:Number(e);return Number.isFinite(t)&&t>=0?t:250}_search(e){this._lastSearch=e,clearTimeout(this._timer);let t=++this._searchSeq;this._timer=setTimeout(()=>{let n=this.getAttribute(`source`);if(!n){this.dispatchEvent(new CustomEvent(`search`,{bubbles:!0,detail:{query:e,seq:t}}));return}this._fetchPeople(n,e,t)},this._debounce())}async _fetchPeople(e,t,n){this._abort?.abort();let r=new AbortController;this._abort=r,this.loading=!0;let a=await(0,i.wuiFetch)(`${e}${e.includes(`?`)?`&`:`?`}q=${encodeURIComponent(t)}`,{signal:r.signal});if(n!==this._searchSeq)return;if(this._abort=null,!a.ok){this._peopleProp=[],this.loading=!1;return}let o=this.ownerDocument.createElement(`template`);o.innerHTML=a.html,this._peopleProp=[...o.content.querySelectorAll(`wui-option`)].map(e=>({value:e.getAttribute(`value`)??``,label:e.textContent.trim(),description:e.getAttribute(`data-description`)||void 0,src:e.getAttribute(`data-src`)||void 0})).filter(T),this.loading=!1,this._refresh()}_isOpen(){let e=this._menu();return!!(e&&!e.hidden)}_renderMenu(){let e=this._menu(),t=this._control();if(!e||!t||!this._query)return;let r=this.ownerDocument;if(e.replaceChildren(),this._results.forEach((t,n)=>{let i=r.createElement(`div`);if(i.className=`wui-mention-option`,i.id=`${e.id}-${n}`,i.setAttribute(`role`,`option`),i.setAttribute(`aria-selected`,`false`),i.dataset.index=String(n),t.src){let e=r.createElement(`img`);e.className=`wui-mention-option-photo`,e.src=t.src,e.alt=``,i.appendChild(e)}let o=r.createElement(`span`);o.className=`wui-mention-option-text`;let s=r.createElement(`span`);if(s.className=`wui-mention-option-label`,s.textContent=(0,a.mentionLabel)(t.label),o.appendChild(s),t.description){let e=r.createElement(`span`);e.className=`wui-mention-option-description`,e.textContent=String(t.description),o.appendChild(e)}i.appendChild(o),e.appendChild(i)}),!this._results.length){let t=r.createElement(`div`);t.className=`wui-mention-empty`,t.textContent=this._loading?y.searching:`${y.noMatch} “${this._query.text}”`,e.appendChild(t)}let i=this._isOpen();e.hidden=!1,i||(0,n.bindReanchor)(this,this._reposition),this._position(),this._setActive(this._results.length?0:-1),this._loading||this._announce(this._results.length?y.found(this._results.length):`${y.noMatch}.`)}_position(){(0,n.anchorOverlay)(this._control(),this._menu())}_close(){this._query=null,this._lastSearch=void 0,clearTimeout(this._timer);let e=this._menu();e&&!e.hidden&&(e.hidden=!0,e.replaceChildren()),this._active=-1,this._control()?.removeAttribute(`aria-activedescendant`),(0,n.unbindReanchor)(this)}_setActive(e,{reveal:t=!0}={}){let n=this._menu(),r=[...n.querySelectorAll(`.wui-mention-option`)];this._active=e>=0&&e<r.length?e:-1;let i=this._active>=0?r[this._active]:null;for(let e of r)e.setAttribute(`aria-selected`,e===i?`true`:`false`);(0,s.moveActiveRow)(n,i),i?(t&&i.scrollIntoView?.({block:`nearest`}),this._control().setAttribute(`aria-activedescendant`,i.id)):this._control().removeAttribute(`aria-activedescendant`)}_onKeyDown(e){if(this._isOpen()&&this._query){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=this._results.length;if(!t)return;let n=e.key===`ArrowDown`?1:-1;this._setActive((this._active+n+t)%t);return}if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey&&this._active>=0){e.preventDefault(),this._pick(this._results[this._active]);return}if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),this._close();return}}if(e.key===`Enter`&&(e.ctrlKey||e.metaKey)){e.preventDefault(),this.dispatchEvent(new CustomEvent(`wui:mention-input:submit`,{bubbles:!0,detail:{value:this.value}}));return}e.key===`Backspace`&&this._removeWholeMention(e)}_removeWholeMention(e){let t=this._control();if(t.selectionStart!==t.selectionEnd)return;let n=t.selectionStart,r=this._mentions.find(e=>e.end===n);r&&(e.preventDefault(),this._replace(r.start,r.end,``))}_onMenuClick(e){let t=e.target.closest?.(`.wui-mention-option`);t&&this._pick(this._results[Number(t.dataset.index)])}_pick(e){if(!e||!this._query)return;let t=(0,a.mentionLabel)(e.label),{start:n,end:r}=this._query,i=this._text.slice(r),o=`@${t}${/^\s/.test(i)?``:` `}`;this._replace(n,r,o,{id:String(e.value),label:t}),this._announce(y.mentioned(t))}_replace(e,t,n,r){let i=this._control(),a=n.length-(t-e);this._mentions=this._mentions.filter(n=>n.end<=e||n.start>=t).map(e=>e.start>=t?{...e,start:e.start+a,end:e.end+a}:e),r&&this._mentions.push({start:e,end:e+1+r.label.length,id:r.id,label:r.label}),this._text=this._text.slice(0,e)+n+this._text.slice(t),i.value=this._text;let o=e+n.length;i.setSelectionRange(o,o),this._close(),i.focus(),this._emit()}_onFocusOut(e){e.relatedTarget&&this.contains(e.relatedTarget)||this._close()}_announce(e){let t=this.querySelector(C);t&&(t.textContent=``,t.textContent=e)}};(0,t.defineElement)(`wui-mention-input`,D),(0,t.defineElement)(`wui-comment-thread`,v),e.COMMENT_INTENTS=u,e.COMMENT_REACTIONS=l,e.COMMENT_TEXT=d,e.WuiCommentThread=v})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.anchorOverlay,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.wuiHttp,WeborityUiElementsInternal.modules.mentionText,WeborityUiElementsInternal.modules.formatters,WeborityUiElementsInternal.modules.listboxKeyNav);
1
+ (function(e,t,n,r,i,a,o,s){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var c=globalThis.WeborityUiElementsInternal?.version;if(c!==`0.80.9`)throw Error(`[webority-ui] comment-thread expects ui-elements 0.80.9 but the page loaded `+c+`.`);var l=Object.freeze([`👍`,`❤️`,`🎉`,`😄`,`👀`,`🙏`]),u=Object.freeze([`post`,`reply`,`edit`,`delete`,`react`]),d=Object.freeze({listName:`Comments`,empty:`No comments yet.`,deleted:`This comment was deleted.`,edited:`Edited`,reply:`Reply`,edit:`Edit`,delete:`Delete`,cancel:`Cancel`,save:`Save`,post:`Comment`,confirmDelete:`Delete this comment?`,composerLabel:`Add a comment`,composerPlaceholder:`Write a comment. Type @ to mention someone.`,replyLabel:e=>`Reply to ${e}`,replyPlaceholder:`Write a reply`,editLabel:`Edit comment`,repliesName:e=>`Replies to ${e}`,reactions:`Reactions`,addReaction:`Add a reaction`,pickerName:`Choose a reaction`,emptyBody:`Write something first.`,done:Object.freeze({post:`Comment posted.`,reply:`Reply posted.`,edit:`Comment saved.`,delete:`Comment deleted.`,react:``}),failed:Object.freeze({forbidden:`You do not have permission to do this.`,client:`This did not go through. Refresh the page and try again.`,validation:`This was not accepted. Check it and try again.`,server:`Something went wrong on our side. Try again in a moment.`,network:`Could not reach the server. Check your connection and try again.`})}),f=`[data-wui-items]`,p=`[data-wui-picker]`,m=`[data-wui-composer]`,h=`[data-wui-comment]`,g=`[data-wui-live]`,_=e=>typeof e?.message==`string`&&e.message?e.message:d.failed.server,v=class extends r.ElementBase{constructor(){super(),this._wired=!1,this._busy=!1,this._peopleProp=null,this._pickerFor=null,this._onClick=this._onClick.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onSubmitKey=this._onSubmitKey.bind(this),this._onDocClick=e=>{this._pickerFor&&!this.querySelector(p)?.contains(e.target)&&!this._pickerFor.button.contains(e.target)&&this._closePicker(!1)},this._repositionPicker=()=>{this._pickerFor&&(0,n.anchorOverlay)(this._pickerFor.button,this.querySelector(p))}}connectedCallback(){if(Object.hasOwn(this,`people`)){let e=this.people;delete this.people,this.people=e}this._wired||(this._wired=!0,this.addEventListener(`click`,this._onClick),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`wui:mention-input:submit`,this._onSubmitKey),this._handPeople(this.querySelector(`${m} wui-mention-input`)))}disconnectedCallback(){this._closePicker(!1)}get people(){return this._peopleProp?this._peopleProp:[...this.querySelectorAll(`:scope > [data-wui-people] > wui-option`)].map(e=>({value:e.getAttribute(`value`)??``,label:e.textContent.trim(),description:e.getAttribute(`data-description`)||void 0,src:e.getAttribute(`data-src`)||void 0}))}set people(e){this._peopleProp=Array.isArray(e)?e:[];for(let e of this.querySelectorAll(`wui-mention-input`))e.people=this._peopleProp}_handPeople(e){!e||this.hasAttribute(`remote`)||this.hasAttribute(`source`)||(e.people=this.people)}_reactionChoices(){let e=this.getAttribute(`reaction-choices`),t=e?e.split(/\s+/).filter(Boolean):[];return t.length?t:l}_onClick(e){let t=e.target.closest?.(`[data-wui-emoji]`);if(t&&this.contains(t)&&!t.disabled){let e=t.closest(p),n=e?this._pickerFor?.comment:t.closest(h);e&&this._closePicker(!0),n&&this._react(n,t.getAttribute(`data-wui-emoji`));return}let n=e.target.closest?.(`[data-wui-action]`);if(!n||!this.contains(n)||n.disabled)return;let r=n.closest(h);switch(n.getAttribute(`data-wui-action`)){case`reply`:this._openReply(r,n);break;case`edit`:this._openEditor(r,n);break;case`delete`:this._askDelete(r);break;case`cancel-delete`:this._closeConfirm(r,!0);break;case`confirm-delete`:this._send(`delete`,{commentId:r.getAttribute(`data-wui-comment`)},{comment:r,scope:r});break;case`react-menu`:this._pickerFor?.button===n?this._closePicker(!0):this._openPicker(r,n);break;case`cancel`:this._closeSlot(n.closest(`[data-wui-reply], [data-wui-editor]`),!0);break;case`post`:case`send`:this._sendFrom(n);break}}_onKeyDown(e){let t=this.querySelector(p);if(this._pickerFor&&t?.contains(e.target)){let n=[...t.querySelectorAll(`[data-wui-emoji]`)],r=n.indexOf(e.target);e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),this._closePicker(!0)):e.key===`ArrowRight`||e.key===`ArrowLeft`?(e.preventDefault(),n[(r+(e.key===`ArrowRight`?1:-1)+n.length)%n.length]?.focus()):e.key===`Tab`&&this._closePicker(!1);return}if(e.key!==`Escape`)return;let n=e.target.closest?.(`[data-wui-reply], [data-wui-editor]`);if(n&&this.contains(n)){e.preventDefault(),e.stopPropagation(),this._closeSlot(n,!0);return}let r=e.target.closest?.(`[data-wui-confirm]`);r&&(e.preventDefault(),e.stopPropagation(),this._closeConfirm(r.closest(h),!0))}_onSubmitKey(e){let t=(e.target.closest?.(`[data-wui-reply], [data-wui-editor], [data-wui-composer]`))?.querySelector(`[data-wui-action="send"], [data-wui-action="post"]`);t&&!t.disabled&&this._sendFrom(t)}_openReply(e,t){let n=e?.querySelector(`:scope > [data-wui-reply]`);if(!n)return;if(!n.hidden){n.querySelector(`wui-mention-input`)?.focus();return}let r=e.querySelector(`.wui-comment-author`)?.textContent.trim()||``;this._fillSlot(n,{label:d.replyLabel(r),placeholder:d.replyPlaceholder,value:``,send:d.reply,opener:t})}_openEditor(e,t){let n=e?.querySelector(`:scope > .wui-comment-row [data-wui-editor]`);if(!n||!n.hidden)return;let r=n.parentElement.querySelector(`:scope > [data-wui-text]`);r&&(r.hidden=!0),this._fillSlot(n,{label:d.editLabel,placeholder:``,value:e.getAttribute(`data-value`)??``,send:d.save,opener:t})}_fillSlot(e,{label:t,placeholder:n,value:r,send:i,opener:a}){let o=this.ownerDocument,s=o.createElement(`wui-mention-input`);s.className=`wui-mention-input`,s.setAttribute(`label`,t),n&&s.setAttribute(`placeholder`,n),s.setAttribute(`rows`,`2`),s.setAttribute(`value`,r);for(let e of[`remote`,`source`,`min-chars`,`debounce`])this.hasAttribute(e)&&s.setAttribute(e,this.getAttribute(e));let c=o.createElement(`div`);c.className=`wui-comment-form-actions`,c.append(this._button(`btn btn-primary btn-sm`,`send`,i),this._button(`btn btn-ghost btn-sm`,`cancel`,d.cancel));let l=o.createElement(`div`);l.className=`wui-comment-error`,l.setAttribute(`data-wui-error`,``),l.hidden=!0,e.replaceChildren(s,c,l),this._handPeople(s),e.hidden=!1,this._openers??=new WeakMap,this._openers.set(e,a),s.focus();let u=s.querySelector(`textarea`);u?.setSelectionRange(u.value.length,u.value.length)}_button(e,t,n){let r=this.ownerDocument.createElement(`button`);return r.type=`button`,r.className=e,r.setAttribute(`data-wui-action`,t),r.textContent=n,r}_closeSlot(e,t){if(!e||e.hidden)return;if(e.hidden=!0,e.replaceChildren(),e.hasAttribute(`data-wui-editor`)){let t=e.parentElement?.querySelector(`:scope > [data-wui-text]`);t&&(t.hidden=!1)}let n=this._openers?.get(e);t&&n?.isConnected&&n.focus()}_askDelete(e){let t=e?.querySelector(`:scope > .wui-comment-row`),n=t?.querySelector(`[data-wui-confirm]`),r=t?.querySelector(`[data-wui-actions]`);n&&(n.hidden=!1,r&&(r.hidden=!0),n.querySelector(`[data-wui-action="cancel-delete"]`)?.focus())}_closeConfirm(e,t){let n=e?.querySelector(`:scope > .wui-comment-row`),r=n?.querySelector(`[data-wui-confirm]`),i=n?.querySelector(`[data-wui-actions]`);r&&(r.hidden=!0),i&&(i.hidden=!1),t&&i?.querySelector(`[data-wui-action="delete"]`)?.focus()}_openPicker(e,t){let r=this.querySelector(p);!r||!e||(this._closePicker(!1),this._pickerFor={comment:e,button:t},t.setAttribute(`aria-expanded`,`true`),r.hidden=!1,(0,n.anchorOverlay)(t,r),(0,n.bindReanchor)(this,this._repositionPicker),this.ownerDocument.addEventListener(`click`,this._onDocClick,!0),r.querySelector(`[data-wui-emoji]`)?.focus())}_closePicker(e){let t=this._pickerFor;if(!t)return;this._pickerFor=null;let r=this.querySelector(p);r&&(r.hidden=!0),t.button.setAttribute(`aria-expanded`,`false`),(0,n.unbindReanchor)(this),this.ownerDocument.removeEventListener(`click`,this._onDocClick,!0),e&&t.button.isConnected&&t.button.focus()}_react(e,t){t&&this._send(`react`,{commentId:e.getAttribute(`data-wui-comment`),emoji:t},{comment:e,scope:e})}_sendFrom(e){let t=e.closest(`[data-wui-reply], [data-wui-editor], [data-wui-composer]`);if(!t)return;let n=t.querySelector(`wui-mention-input`),r=n?.value??``;if(!r.trim()){this._showError(t,d.emptyBody),n?.focus();return}let i=t.closest(h);t.hasAttribute(`data-wui-composer`)?this._send(`post`,{body:r},{scope:t,form:t}):t.hasAttribute(`data-wui-reply`)?this._send(`reply`,{parentId:i.getAttribute(`data-wui-comment`),body:r},{comment:i,scope:t,form:t}):this._send(`edit`,{commentId:i.getAttribute(`data-wui-comment`),body:r},{comment:i,scope:t,form:t})}async _send(e,t,{comment:n,scope:r,form:i}){if(this._busy)return;this._busy=!0,this.setAttribute(`aria-busy`,`true`);let a=i??n?.querySelector(`:scope > .wui-comment-row`)??this;this._showError(a,null);let o=[...r.querySelectorAll(`button, textarea`)].filter(e=>!e.disabled);for(let e of o)e.disabled=!0;let s=await this._persist({intent:e,...t});for(let e of o)e.isConnected&&(e.disabled=!1);this._busy=!1,this.removeAttribute(`aria-busy`);let c=t.commentId??null,l=t.parentId??null;if(s.ok){s.html!=null&&this._swapItems(s.html),e===`post`?i?.querySelector(`wui-mention-input`)?.clear():i?.isConnected&&this._closeSlot(i,!1),e===`delete`&&n?.isConnected&&this._closeConfirm(n,!1),this._restoreFocus(e,t,i),d.done[e]&&this._announce(d.done[e]),this.dispatchEvent(new CustomEvent(`wui:comment-thread:done`,{bubbles:!0,detail:{intent:e,commentId:c,parentId:l}}));return}s.kind===`session`||s.kind===`aborted`||(this._showError(a.isConnected?a:this,s.message),this._announce(s.message),this.dispatchEvent(new CustomEvent(`wui:comment-thread:failed`,{bubbles:!0,detail:{intent:e,kind:s.kind,message:s.message}})))}async _persist(e){if(this.hasAttribute(`controlled`)){if(typeof this.submit!=`function`)return{ok:!0,html:null};try{return await this.submit(e),{ok:!0,html:null}}catch(e){return{ok:!1,kind:`server`,message:_(e)}}}let t=this.getAttribute(`action`);if(!t)return{ok:!1,kind:`client`,message:d.failed.client};let n=new URLSearchParams;for(let[t,r]of Object.entries(e))r!=null&&n.set(t,r);let r=await(0,i.wuiFetch)(t,{method:`POST`,body:n});return r.ok?{ok:!0,html:r.html}:{ok:!1,kind:r.kind,message:r.message||d.failed[r.kind]||d.failed.server}}_swapItems(e){let t=this.querySelector(f);if(!t||!e.trim())return;let n=this.ownerDocument.createElement(`template`);n.innerHTML=e;let r=n.content.querySelector(f);t.replaceChildren(...r?r.childNodes:n.content.childNodes)}_restoreFocus(e,t,n){let r=this.ownerDocument,i=r.activeElement;if(i&&i!==r.body&&i.isConnected&&this.contains(i)&&!i.disabled)return;let a=e=>e?[...this.querySelectorAll(h)].find(t=>t.getAttribute(`data-wui-comment`)===e):null,o=e=>a(e)?.querySelector(`:scope > .wui-comment-row`),s=null;if(e===`post`)s=n?.querySelector(`textarea`);else if(e===`reply`)s=o(t.parentId)?.querySelector(`[data-wui-action="reply"]`);else if(e===`edit`)s=o(t.commentId)?.querySelector(`[data-wui-action="edit"]`);else if(e===`react`){let e=o(t.commentId);s=[...e?.querySelectorAll(`button[data-wui-emoji]`)??[]].find(e=>e.getAttribute(`data-wui-emoji`)===t.emoji)??e?.querySelector(`[data-wui-action="react-menu"]`)}s??=this.querySelector(`${m} textarea`),s?.focus()}_showError(e,t){let n=e?.querySelector?.(`:scope > [data-wui-error], :scope > .wui-comment-main > [data-wui-error]`);n&&(n.textContent=t||``,n.hidden=!t)}_announce(e){let t=this.querySelector(`:scope > ${g}`);!t||!e||(t.textContent=``,t.textContent=e)}},y=Object.freeze({listName:`People`,searching:`Searching…`,noMatch:`No one matches`,found:e=>`${e===1?`1 person`:`${(0,o.formatNumber)(e,{decimals:0})} people`}. Up and down to choose, Enter to mention.`,mentioned:e=>`Mentioned ${e}.`}),b=`[data-wui-control]`,x=`[data-wui-field]`,S=`[data-wui-menu]`,C=`[data-wui-live]`,w=0,T=e=>e&&a.MENTION_ID_PATTERN.test(String(e.value??``))&&(0,a.mentionLabel)(e.label)!==``;function E(e){let t=e.ownerDocument;e.id||=`wui-mention-${++w}`;let n=t.createElement(`textarea`);n.id=`${e.id}-text`,n.className=`form-control textarea wui-mention-input-text`,n.rows=Number(e.getAttribute(`rows`))>0?Number(e.getAttribute(`rows`)):3,n.setAttribute(`data-wui-control`,``),n.setAttribute(`aria-autocomplete`,`list`),n.setAttribute(`aria-controls`,`${e.id}-people`);let r=e.getAttribute(`label`);r&&n.setAttribute(`aria-label`,r);let i=e.getAttribute(`placeholder`);i&&(n.placeholder=i);for(let t of[`aria-describedby`,`aria-invalid`]){let r=e.getAttribute(t);r&&n.setAttribute(t,r)}n.disabled=e.hasAttribute(`disabled`),e.appendChild(n);let a=e.getAttribute(`name`);if(a){let n=t.createElement(`input`);n.type=`hidden`,n.name=a,n.value=e.getAttribute(`value`)??``,n.setAttribute(`data-wui-field`,``),e.appendChild(n)}let o=t.createElement(`div`);o.className=`wui-mention-menu`,o.id=`${e.id}-people`,o.setAttribute(`role`,`listbox`),o.setAttribute(`aria-label`,y.listName),o.setAttribute(`data-wui-menu`,``),o.hidden=!0,e.appendChild(o);let s=t.createElement(`span`);s.className=`visually-hidden`,s.setAttribute(`data-wui-live`,``),s.setAttribute(`aria-live`,`polite`),s.setAttribute(`aria-atomic`,`true`),e.appendChild(s)}var D=class extends r.ElementBase{static get observedAttributes(){return[`disabled`,`aria-invalid`,`aria-describedby`]}constructor(){super(),this._wired=!1,this._text=``,this._mentions=[],this._peopleProp=null,this._declared=null,this._loading=!1,this._query=null,this._results=[],this._active=-1,this._timer=null,this._searchSeq=0,this._abort=null,this._onInput=this._onInput.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onCaret=this._onCaret.bind(this),this._onFocusOut=this._onFocusOut.bind(this),this._onMenuDown=e=>e.preventDefault(),this._onMenuClick=this._onMenuClick.bind(this),this._reposition=()=>{this._isOpen()&&this._position()}}connectedCallback(){for(let e of[`people`,`loading`,`value`])if(Object.hasOwn(this,e)){let t=this[e];delete this[e],this[e]=t}if(this._wired)return;this._wired=!0,this.querySelector(b)||E(this);let e=this._control(),t=this.querySelector(x)?.value??this.getAttribute(`value`)??``;this._pendingValue===void 0?this._load(t):this._load(this._pendingValue),this._pendingValue=void 0,e.addEventListener(`input`,this._onInput),e.addEventListener(`keydown`,this._onKeyDown),e.addEventListener(`click`,this._onCaret),e.addEventListener(`keyup`,this._onCaret),this.addEventListener(`focusout`,this._onFocusOut);let n=this._menu();n.addEventListener(`mousedown`,this._onMenuDown),n.addEventListener(`click`,this._onMenuClick),n.addEventListener(`mousemove`,e=>{let t=e.target.closest?.(`.wui-mention-option`);t&&Number(t.dataset.index)!==this._active&&this._setActive(Number(t.dataset.index),{reveal:!1})})}disconnectedCallback(){this._close(),clearTimeout(this._timer),this._abort?.abort()}attributeChangedCallback(e,t,n){let r=this._control();r&&(e===`disabled`?(r.disabled=n!==null,n!==null&&this._close()):n===null?r.removeAttribute(e):r.setAttribute(e,n))}get value(){return(0,a.mentionValueFromText)(this._text,this._mentions)}set value(e){let t=e==null?``:String(e);if(!this._wired){this._pendingValue=t;return}t!==this.value&&this._load(t)}get mentions(){let e=new Set,t=[];for(let n of[...this._mentions].sort((e,t)=>e.start-t.start))e.has(n.id)||(e.add(n.id),t.push({id:n.id,label:n.label}));return t}get people(){return this._peopleProp?this._peopleProp:(this._declared||=[...this.querySelectorAll(`[data-wui-people] > wui-option`)].map(e=>({value:e.getAttribute(`value`)??``,label:e.textContent.trim(),description:e.getAttribute(`data-description`)||void 0,src:e.getAttribute(`data-src`)||void 0})),this._declared)}set people(e){this._peopleProp=Array.isArray(e)?e.filter(T):[],(this._isOpen()||this._query!==null)&&this._refresh()}get loading(){return this._loading}set loading(e){this._loading=!!e,this._query!==null&&this._renderMenu()}focus(e){this._control()?.focus(e)}clear(){this._load(``),this._emit()}_control(){return this.querySelector(b)}_menu(){return this.querySelector(S)}_load(e){let{text:t,mentions:n}=(0,a.mentionTextFromValue)(e);this._text=t,this._mentions=n;let r=this._control();r&&(r.defaultValue=t,r.value=t),this._syncField(),this._close()}_syncField(){let e=this.querySelector(x);e&&(e.value=this.value)}_emit(){this._syncField(),this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,detail:{value:this.value,mentions:this.mentions}}))}_onInput(){let e=this._control(),t=e.value,n=this._text,r=t.length-n.length,i=Math.min(n.length,t.length),a=Math.max(0,Math.min(i,e.selectionEnd-Math.max(r,0))),o=0;for(;o<a&&n[o]===t[o];)o++;let s=0;for(;s<i-o&&n[n.length-1-s]===t[t.length-1-s];)s++;let c=n.length-s;this._mentions=this._mentions.filter(e=>e.end<=o||e.start>=c).map(e=>e.start>=c?{...e,start:e.start+r,end:e.end+r}:e),this._text=t,this._emit(),this._onCaret()}_onCaret(e){if(e?.type===`keyup`&&[`ArrowUp`,`ArrowDown`,`Enter`,`Tab`,`Escape`].includes(e.key))return;let t=this._queryAtCaret();if(!t){this._close();return}this._query&&t.text===this._query.text&&t.start===this._query.start||(this._query=t,this._refresh())}_queryAtCaret(){let e=this._control();if(!e||e.disabled||e.selectionStart!==e.selectionEnd)return null;let t=e.selectionStart,n=this._text,r=n.lastIndexOf(`@`,t-1);if(r<0||r>0&&!/[\s([{"'“‘]/.test(n[r-1]))return null;let i=n.slice(r+1,t);return i.length>40||/[\n@]/.test(i)||/^\s/.test(i)||/\s{2}/.test(i)||this._mentions.some(e=>r>=e.start&&r<e.end)?null:{start:r,end:t,text:i}}_refresh(){if(!this._query)return;let e=this.hasAttribute(`remote`)||this.hasAttribute(`source`);if(e&&this._query.text.length<this._minChars()){this._results=[],this._close();return}e&&!this._answered(this._query.text)&&this._search(this._query.text);let t=this._query.text.toLowerCase(),n=e?this.people:this.people.filter(e=>(0,a.mentionLabel)(e.label).toLowerCase().includes(t));this._results=n.slice(0,8),this._renderMenu()}_answered(e){return this._lastSearch===e}_minChars(){let e=this.getAttribute(`min-chars`),t=e==null||e===``?1:Number(e);return Number.isFinite(t)&&t>=0?t:1}_debounce(){let e=this.getAttribute(`debounce`),t=e==null||e===``?250:Number(e);return Number.isFinite(t)&&t>=0?t:250}_search(e){this._lastSearch=e,clearTimeout(this._timer);let t=++this._searchSeq;this._timer=setTimeout(()=>{let n=this.getAttribute(`source`);if(!n){this.dispatchEvent(new CustomEvent(`search`,{bubbles:!0,detail:{query:e,seq:t}}));return}this._fetchPeople(n,e,t)},this._debounce())}async _fetchPeople(e,t,n){this._abort?.abort();let r=new AbortController;this._abort=r,this.loading=!0;let a=await(0,i.wuiFetch)(`${e}${e.includes(`?`)?`&`:`?`}q=${encodeURIComponent(t)}`,{signal:r.signal});if(n!==this._searchSeq)return;if(this._abort=null,!a.ok){this._peopleProp=[],this.loading=!1;return}let o=this.ownerDocument.createElement(`template`);o.innerHTML=a.html,this._peopleProp=[...o.content.querySelectorAll(`wui-option`)].map(e=>({value:e.getAttribute(`value`)??``,label:e.textContent.trim(),description:e.getAttribute(`data-description`)||void 0,src:e.getAttribute(`data-src`)||void 0})).filter(T),this.loading=!1,this._refresh()}_isOpen(){let e=this._menu();return!!(e&&!e.hidden)}_renderMenu(){let e=this._menu(),t=this._control();if(!e||!t||!this._query)return;let r=this.ownerDocument;if(e.replaceChildren(),this._results.forEach((t,n)=>{let i=r.createElement(`div`);if(i.className=`wui-mention-option`,i.id=`${e.id}-${n}`,i.setAttribute(`role`,`option`),i.setAttribute(`aria-selected`,`false`),i.dataset.index=String(n),t.src){let e=r.createElement(`img`);e.className=`wui-mention-option-photo`,e.src=t.src,e.alt=``,i.appendChild(e)}let o=r.createElement(`span`);o.className=`wui-mention-option-text`;let s=r.createElement(`span`);if(s.className=`wui-mention-option-label`,s.textContent=(0,a.mentionLabel)(t.label),o.appendChild(s),t.description){let e=r.createElement(`span`);e.className=`wui-mention-option-description`,e.textContent=String(t.description),o.appendChild(e)}i.appendChild(o),e.appendChild(i)}),!this._results.length){let t=r.createElement(`div`);t.className=`wui-mention-empty`,t.textContent=this._loading?y.searching:`${y.noMatch} “${this._query.text}”`,e.appendChild(t)}let i=this._isOpen();e.hidden=!1,i||(0,n.bindReanchor)(this,this._reposition),this._position(),this._setActive(this._results.length?0:-1),this._loading||this._announce(this._results.length?y.found(this._results.length):`${y.noMatch}.`)}_position(){(0,n.anchorOverlay)(this._control(),this._menu())}_close(){this._query=null,this._lastSearch=void 0,clearTimeout(this._timer);let e=this._menu();e&&!e.hidden&&(e.hidden=!0,e.replaceChildren()),this._active=-1,this._control()?.removeAttribute(`aria-activedescendant`),(0,n.unbindReanchor)(this)}_setActive(e,{reveal:t=!0}={}){let n=this._menu(),r=[...n.querySelectorAll(`.wui-mention-option`)];this._active=e>=0&&e<r.length?e:-1;let i=this._active>=0?r[this._active]:null;for(let e of r)e.setAttribute(`aria-selected`,e===i?`true`:`false`);(0,s.moveActiveRow)(n,i),i?(t&&i.scrollIntoView?.({block:`nearest`}),this._control().setAttribute(`aria-activedescendant`,i.id)):this._control().removeAttribute(`aria-activedescendant`)}_onKeyDown(e){if(this._isOpen()&&this._query){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=this._results.length;if(!t)return;let n=e.key===`ArrowDown`?1:-1;this._setActive((this._active+n+t)%t);return}if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey&&this._active>=0){e.preventDefault(),this._pick(this._results[this._active]);return}if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),this._close();return}}if(e.key===`Enter`&&(e.ctrlKey||e.metaKey)){e.preventDefault(),this.dispatchEvent(new CustomEvent(`wui:mention-input:submit`,{bubbles:!0,detail:{value:this.value}}));return}e.key===`Backspace`&&this._removeWholeMention(e)}_removeWholeMention(e){let t=this._control();if(t.selectionStart!==t.selectionEnd)return;let n=t.selectionStart,r=this._mentions.find(e=>e.end===n);r&&(e.preventDefault(),this._replace(r.start,r.end,``))}_onMenuClick(e){let t=e.target.closest?.(`.wui-mention-option`);t&&this._pick(this._results[Number(t.dataset.index)])}_pick(e){if(!e||!this._query)return;let t=(0,a.mentionLabel)(e.label),{start:n,end:r}=this._query,i=this._text.slice(r),o=`@${t}${/^\s/.test(i)?``:` `}`;this._replace(n,r,o,{id:String(e.value),label:t}),this._announce(y.mentioned(t))}_replace(e,t,n,r){let i=this._control(),a=n.length-(t-e);this._mentions=this._mentions.filter(n=>n.end<=e||n.start>=t).map(e=>e.start>=t?{...e,start:e.start+a,end:e.end+a}:e),r&&this._mentions.push({start:e,end:e+1+r.label.length,id:r.id,label:r.label}),this._text=this._text.slice(0,e)+n+this._text.slice(t),i.value=this._text;let o=e+n.length;i.setSelectionRange(o,o),this._close(),i.focus(),this._emit()}_onFocusOut(e){e.relatedTarget&&this.contains(e.relatedTarget)||this._close()}_announce(e){let t=this.querySelector(C);t&&(t.textContent=``,t.textContent=e)}};(0,t.defineElement)(`wui-mention-input`,D),(0,t.defineElement)(`wui-comment-thread`,v),e.COMMENT_INTENTS=u,e.COMMENT_REACTIONS=l,e.COMMENT_TEXT=d,e.WuiCommentThread=v})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.anchorOverlay,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.wuiHttp,WeborityUiElementsInternal.modules.mentionText,WeborityUiElementsInternal.modules.formatters,WeborityUiElementsInternal.modules.listboxKeyNav);
@@ -1 +1 @@
1
- (function(e,t,n,r){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var i=globalThis.WeborityUiElementsInternal?.version;if(i!==`0.80.8`)throw Error(`[webority-ui] consent-banner expects ui-elements 0.80.8 but the page loaded `+i+`.`);var a={"--color-primary":`#4F46E5`,"--color-primary-hover":`#4338CA`,"--color-primary-ink":`#4F46E5`,"--color-primary-text":`#FFFFFF`,"--color-text":`#071437`,"--color-text-muted":`#4B5675`,"--color-border":`#EBEDF3`,"--color-surface":`#FFFFFF`,"--wui-radius-lg":`14px`,"--wui-shadow-overlay-lg":`0 24px 60px -16px rgba(7, 20, 55, 0.28)`,"--wui-z-fixed":`1030`},o=e=>`var(${e}, ${a[e]})`,s=` :host { all: initial; position: fixed; bottom: 20px; left: 20px; right: auto; z-index: ${o(`--wui-z-fixed`)}; display: block; width: 420px; max-width: calc(100vw - 40px); font-family: inherit; font-size: 16px; line-height: 1.5; color: ${o(`--color-text`)}; } :host([position="bottom-right"]) { right: 20px; left: auto; } :host([position="bar"]) { left: 0; right: 0; bottom: 0; width: auto; max-width: none; } :host([position="bar"]) .wui-consent-banner-panel { padding: 12px 24px calc(12px + env(safe-area-inset-bottom, 0px)); border-width: 1px 0 0; border-radius: 0; } :host(:not([open])) { pointer-events: none; } :host([tour-open]) { visibility: hidden; } *, *::before, *::after { box-sizing: border-box; } [hidden] { display: none !important; } .wui-consent-banner-panel { padding: 20px; background: ${o(`--color-surface`)}; border: 1px solid ${o(`--color-border`)}; border-radius: ${o(`--wui-radius-lg`)}; box-shadow: ${o(`--wui-shadow-overlay-lg`)}; text-align: start; pointer-events: auto; } .wui-consent-banner-heading { margin: 0 0 8px; font-size: 18px; font-weight: 600; line-height: 1.3; color: ${o(`--color-text`)}; } .wui-consent-banner-description { margin: 0 0 16px; font-size: 14px; line-height: 1.5; color: ${o(`--color-text-muted`)}; } .wui-consent-banner-policy { color: ${o(`--color-primary-ink`)}; font-weight: 500; } .wui-consent-banner-settings { display: grid; gap: 12px; max-height: 50vh; margin: 0 0 16px; padding: 12px 0; overflow-y: auto; border-top: 1px solid ${o(`--color-border`)}; border-bottom: 1px solid ${o(`--color-border`)}; } .wui-consent-banner-category-description { margin: 2px 0 0; padding-inline-start: 2.5em; font-size: 12px; line-height: 1.4; color: ${o(`--color-text-muted`)}; } .form-check { display: flex; align-items: center; gap: 0.5em; margin: 0; font-size: 14px; } .form-check-input { appearance: none; flex: none; width: 2em; height: 1em; margin: 0; border: 1px solid rgba(0, 0, 0, 0.25); border-radius: 2em; background: ${o(`--color-surface`)} radial-gradient(circle, rgba(0, 0, 0, 0.25) 0.35em, transparent 0.4em) left / 1em 1em no-repeat; cursor: pointer; transition: background-position 0.15s ease-in-out; } .form-check-input:checked { border-color: ${o(`--color-primary`)}; background: ${o(`--color-primary`)} radial-gradient(circle, #fff 0.35em, transparent 0.4em) right / 1em 1em no-repeat; } .form-check-input:disabled { opacity: 0.5; cursor: default; } .form-check-input:focus-visible { outline: 2px solid ${o(`--color-primary`)}; outline-offset: 2px; } .form-check-label { cursor: pointer; } .wui-consent-banner-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; } .btn { display: inline-block; padding: 0.25rem 0.5rem; border: 1px solid transparent; border-radius: 0.375rem; background: transparent; font: inherit; font-size: 0.875rem; font-weight: 500; line-height: 1.5; text-align: center; white-space: nowrap; cursor: pointer; } .btn:focus-visible { outline: 2px solid ${o(`--color-primary`)}; outline-offset: 2px; } .btn-primary { background: ${o(`--color-primary`)}; border-color: ${o(`--color-primary`)}; color: ${o(`--color-primary-text`)}; } .btn-primary:hover { background: ${o(`--color-primary-hover`)}; border-color: ${o(`--color-primary-hover`)}; } .btn-outline-secondary { border-color: ${o(`--color-text-muted`)}; color: ${o(`--color-text-muted`)}; } .btn-outline-secondary:hover { background: ${o(`--color-bg-muted`)}; color: ${o(`--color-text`)}; } .btn-link { font-weight: 400; color: ${o(`--color-primary-ink`)}; text-decoration: underline; } .btn-link:hover { color: ${o(`--color-primary-hover`)}; } .wui-consent-banner-settings-toggle { margin-inline-end: auto; padding-inline: 0; } .wui-consent-banner-save { flex: 1 1 100%; } @media (max-width: 575.98px) { :host, :host([position="bottom-right"]) { left: 0; right: 0; bottom: 0; width: auto; max-width: none; } .wui-consent-banner-panel { padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-width: 1px 0 0; border-radius: 0; } /* Hidden on phones, but it stays the dialog's accessible name. */ .wui-consent-banner-heading { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; } .wui-consent-banner-description { margin: 0 0 8px; font-size: 13px; line-height: 1.4; } .wui-consent-banner-actions { gap: 6px; } } @media (min-width: 576px) { :host([position="bar"]) .wui-consent-banner-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; } /* Hidden on the bar, but it stays the dialog's accessible name. */ :host([position="bar"]) .wui-consent-banner-heading { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; } :host([position="bar"]) .wui-consent-banner-description { margin: 0; flex: 1 1 320px; } :host([position="bar"]) .wui-consent-banner-actions { flex: none; } :host([position="bar"]) .wui-consent-banner-settings { flex-basis: 100%; margin: 0; } } `,c=`data-wui-tour-open`,l=`wui-consent-save`,u=`[data-consent-settings]`,d=`tour-open`,f=`--wui-consent-banner-block`,p=`--wui-consent-banner-inline`,m={heading:`Cookies on this site`,description:`We use cookies to understand how the site is used and to measure our campaigns. You can change your choice at any time.`,policyLabel:`Cookie policy`,essentialLabel:`Essential cookies`,essentialDescription:`Required for the site to work and stay secure. Always on.`,analyticsLabel:`Analytics cookies`,analyticsDescription:`Help us understand how visitors use the site.`,functionalLabel:`Functional cookies`,functionalDescription:`Remember choices you make, such as your preferences.`,marketingLabel:`Marketing cookies`,marketingDescription:`Measure how well our campaigns work.`,settingsLabel:`Cookie settings`,rejectLabel:`Reject all`,acceptLabel:`Accept all`,saveLabel:`Save preferences`},h=[`analytics`,`functional`,`marketing`],g={analytics:{label:m.analyticsLabel,description:`analyticsDescription`},functional:{label:m.functionalLabel,description:`functionalDescription`},marketing:{label:m.marketingLabel,description:`marketingDescription`}},_=new Set;function v(e){_.has(e)||(_.add(e),(0,n.devWarn)(`[@webority/ui-elements] <wui-consent-banner> received categories containing "${e}", which is not one of ${h.map(e=>`"${e}"`).join(` | `)}. It is ignored.`))}var y=0,b=null;function x(e){b||(b=new CSSStyleSheet,b.replaceSync(s)),e.adoptedStyleSheets=[b]}var S=class extends r.ElementBase{static get observedAttributes(){return[`heading`,`description`,`policy-href`,`policy-label`,`analytics-description`,`functional-description`,`marketing-description`,`categories`]}constructor(){super(),y+=1,this._uid=`wui-consent-${y}`,this._preferences={analytics:!1,functional:!1,marketing:!1},this._settings=!1,this._onDocumentClick=e=>{e.target instanceof Element&&e.target.closest(u)&&(e.preventDefault(),this.open({settings:!0,focus:!0}))},this._tourWatch=null,this._roomObserver=null,this._onWindowResize=()=>this._reserveRoom()}get position(){let e=this.getAttribute(`position`);return e===`bottom-right`||e===`bar`?e:`bottom-left`}set position(e){this.setAttribute(`position`,String(e??`bottom-left`))}get standalone(){return this.hasAttribute(`standalone`)}set standalone(e){this.toggleAttribute(`standalone`,e===!0||e===``||e===`true`)}get heading(){return this.getAttribute(`heading`)||m.heading}set heading(e){this.setAttribute(`heading`,String(e??``))}get description(){return this.getAttribute(`description`)||m.description}set description(e){this.setAttribute(`description`,String(e??``))}get policyHref(){return this.getAttribute(`policy-href`)||``}set policyHref(e){this.setAttribute(`policy-href`,String(e??``))}get policyLabel(){return this.getAttribute(`policy-label`)||m.policyLabel}set policyLabel(e){this.setAttribute(`policy-label`,String(e??``))}get analyticsDescription(){return this.getAttribute(`analytics-description`)||m.analyticsDescription}set analyticsDescription(e){this.setAttribute(`analytics-description`,String(e??``))}get functionalDescription(){return this.getAttribute(`functional-description`)||m.functionalDescription}set functionalDescription(e){this.setAttribute(`functional-description`,String(e??``))}get marketingDescription(){return this.getAttribute(`marketing-description`)||m.marketingDescription}set marketingDescription(e){this.setAttribute(`marketing-description`,String(e??``))}get categories(){let e=this.getAttribute(`categories`);if(!e?.trim())return[...h];let t=e.split(/\s+/).filter(Boolean);for(let e of t)h.includes(e)||v(e);let n=h.filter(e=>t.includes(e));return n.length?n:[...h]}set categories(e){e==null?this.removeAttribute(`categories`):this.setAttribute(`categories`,Array.isArray(e)?e.join(` `):String(e))}get preferences(){let e=this.categories;return Object.fromEntries(h.map(t=>[t,e.includes(t)&&this._preferences[t]]))}set preferences(e){this._preferences={analytics:e?.analytics===!0,functional:e?.functional===!0,marketing:e?.marketing===!0},this._applyPreferences()}get isOpen(){return this.hasAttribute(`open`)}connectedCallback(){this._rendered||this.render(),document.addEventListener(`click`,this._onDocumentClick),this._syncTour(),this._tourWatch??=new MutationObserver(()=>this._syncTour()),this._tourWatch.observe(document.documentElement,{attributes:!0,attributeFilter:[c]}),this.isOpen&&this._trackRoom()}disconnectedCallback(){document.removeEventListener(`click`,this._onDocumentClick),this._tourWatch?.disconnect(),this._untrackRoom()}_syncTour(){this.toggleAttribute(d,document.documentElement.hasAttribute(c))}attributeChangedCallback(){this._rendered&&this.render()}render(){let e=this.isOpen,t=this._uid,n=this.policyHref?` <a class="wui-consent-banner-policy" href="${T(this.policyHref)}">${w(this.policyLabel)}</a>`:``,r=this._root();r!==this&&x(r),r.innerHTML=` <div class="wui-consent-banner-panel" role="dialog" aria-labelledby="${t}-heading" aria-describedby="${t}-description" hidden> <h2 class="wui-consent-banner-heading" id="${t}-heading">${w(this.heading)}</h2> <p class="wui-consent-banner-description" id="${t}-description">${w(this.description)}${n}</p> <div class="wui-consent-banner-settings" hidden> ${C(t,`essential`,m.essentialLabel,m.essentialDescription,!0)} ${this.categories.map(e=>C(t,e,g[e].label,this[g[e].description],!1)).join(` `)} </div> <div class="wui-consent-banner-actions"> <button type="button" class="btn btn-sm btn-link wui-consent-banner-settings-toggle" aria-expanded="false">${m.settingsLabel}</button> <button type="button" class="btn btn-sm btn-outline-secondary wui-consent-banner-reject">${m.rejectLabel}</button> <button type="button" class="btn btn-sm btn-primary wui-consent-banner-accept">${m.acceptLabel}</button> <button type="button" class="btn btn-sm btn-primary wui-consent-banner-save" hidden>${m.saveLabel}</button> </div> </div>`,this._rendered=!0,this._wire(),this._applyPreferences(),this._showSettings(this._settings),e&&(this._panel().hidden=!1)}open({settings:e=!1,focus:t=!1}={}){this._rendered||this.render(),this._applyPreferences(),this._showSettings(e),this._panel().hidden=!1,this.setAttribute(`open`,``),this._trackRoom(),t&&(e?this._root().querySelector(`.wui-consent-banner-category input:not([disabled])`):this._root().querySelector(`.wui-consent-banner-accept`))?.focus()}close(){let e=this._panel();e&&(e.hidden=!0),this.removeAttribute(`open`),this._showSettings(!1),this._untrackRoom()}_trackRoom(){this.isConnected&&(typeof ResizeObserver<`u`&&(this._roomObserver??=new ResizeObserver(()=>this._reserveRoom()),this._roomObserver.observe(this)),window.addEventListener(`resize`,this._onWindowResize),this._reserveRoom())}_untrackRoom(){this._roomObserver?.disconnect(),window.removeEventListener(`resize`,this._onWindowResize),document.documentElement.style.removeProperty(f),document.documentElement.style.removeProperty(p)}_reserveRoom(){let e=this.getBoundingClientRect(),t=this.position===`bar`?0:this.position===`bottom-right`?window.innerWidth-e.left:e.right,n=document.documentElement.style;n.setProperty(f,`${Math.ceil(window.innerHeight-e.top)}px`),n.setProperty(p,`${Math.ceil(t)}px`)}_root(){return this.shadowRoot?this.shadowRoot:this.standalone?this.attachShadow({mode:`open`}):this}_panel(){return this._root().querySelector(`.wui-consent-banner-panel`)}_wire(){let e=this._root();e.querySelector(`.wui-consent-banner-accept`)?.addEventListener(`click`,()=>this._save(this._choiceForShown(!0))),e.querySelector(`.wui-consent-banner-reject`)?.addEventListener(`click`,()=>this._save(this._choiceForShown(!1))),e.querySelector(`.wui-consent-banner-save`)?.addEventListener(`click`,()=>this._save(this._switchValues())),e.querySelector(`.wui-consent-banner-settings-toggle`)?.addEventListener(`click`,()=>this._showSettings(!this._settings))}_save(e){this._preferences={...e},this.dispatchEvent(new CustomEvent(l,{bubbles:!0,composed:!0,detail:{...e}})),this.close()}_choiceForShown(e){let t=this.categories;return Object.fromEntries(h.map(n=>[n,e&&t.includes(n)]))}_switchValues(){let e={};for(let t of h)e[t]=this._root().querySelector(`input[data-category="${t}"]`)?.checked===!0;return e}_applyPreferences(){for(let e of h){let t=this._root().querySelector(`input[data-category="${e}"]`);t&&(t.checked=this._preferences[e])}}_showSettings(e){this._settings=e;let t=this._root(),n=t.querySelector(`.wui-consent-banner-settings`);if(!n)return;n.hidden=!e,t.querySelector(`.wui-consent-banner-settings-toggle`)?.setAttribute(`aria-expanded`,e?`true`:`false`);let r=t.querySelector(`.wui-consent-banner-save`);r&&(r.hidden=!e);for(let n of[`.wui-consent-banner-reject`,`.wui-consent-banner-accept`]){let r=t.querySelector(n);r&&(r.hidden=e)}}};function C(e,t,n,r,i){let a=`${e}-${t}`;return`<div class="wui-consent-banner-category"> <div class="form-check form-switch"> <input class="form-check-input" type="checkbox" role="switch" id="${a}" data-category="${t}"${i?` checked disabled`:``} /> <label class="form-check-label" for="${a}">${w(n)}</label> </div> <p class="wui-consent-banner-category-description">${w(r)}</p> </div>`}var w=e=>String(e??``).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`),T=e=>String(e??``).replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`);(0,t.defineElement)(`wui-consent-banner`,S),e.WuiConsentBanner=S})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.devWarn,WeborityUiElementsInternal.modules.elementBase);
1
+ (function(e,t,n,r){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var i=globalThis.WeborityUiElementsInternal?.version;if(i!==`0.80.9`)throw Error(`[webority-ui] consent-banner expects ui-elements 0.80.9 but the page loaded `+i+`.`);var a={"--color-primary":`#4F46E5`,"--color-primary-hover":`#4338CA`,"--color-primary-ink":`#4F46E5`,"--color-primary-text":`#FFFFFF`,"--color-text":`#071437`,"--color-text-muted":`#4B5675`,"--color-border":`#EBEDF3`,"--color-surface":`#FFFFFF`,"--wui-radius-lg":`14px`,"--wui-shadow-overlay-lg":`0 24px 60px -16px rgba(7, 20, 55, 0.28)`,"--wui-z-fixed":`1030`},o=e=>`var(${e}, ${a[e]})`,s=` :host { all: initial; position: fixed; bottom: 20px; left: 20px; right: auto; z-index: ${o(`--wui-z-fixed`)}; display: block; width: 420px; max-width: calc(100vw - 40px); font-family: inherit; font-size: 16px; line-height: 1.5; color: ${o(`--color-text`)}; } :host([position="bottom-right"]) { right: 20px; left: auto; } :host([position="bar"]) { left: 0; right: 0; bottom: 0; width: auto; max-width: none; } :host([position="bar"]) .wui-consent-banner-panel { padding: 12px 24px calc(12px + env(safe-area-inset-bottom, 0px)); border-width: 1px 0 0; border-radius: 0; } :host(:not([open])) { pointer-events: none; } :host([tour-open]) { visibility: hidden; } *, *::before, *::after { box-sizing: border-box; } [hidden] { display: none !important; } .wui-consent-banner-panel { padding: 20px; background: ${o(`--color-surface`)}; border: 1px solid ${o(`--color-border`)}; border-radius: ${o(`--wui-radius-lg`)}; box-shadow: ${o(`--wui-shadow-overlay-lg`)}; text-align: start; pointer-events: auto; } .wui-consent-banner-heading { margin: 0 0 8px; font-size: 18px; font-weight: 600; line-height: 1.3; color: ${o(`--color-text`)}; } .wui-consent-banner-description { margin: 0 0 16px; font-size: 14px; line-height: 1.5; color: ${o(`--color-text-muted`)}; } .wui-consent-banner-policy { color: ${o(`--color-primary-ink`)}; font-weight: 500; } .wui-consent-banner-settings { display: grid; gap: 12px; max-height: 50vh; margin: 0 0 16px; padding: 12px 0; overflow-y: auto; border-top: 1px solid ${o(`--color-border`)}; border-bottom: 1px solid ${o(`--color-border`)}; } .wui-consent-banner-category-description { margin: 2px 0 0; padding-inline-start: 2.5em; font-size: 12px; line-height: 1.4; color: ${o(`--color-text-muted`)}; } .form-check { display: flex; align-items: center; gap: 0.5em; margin: 0; font-size: 14px; } .form-check-input { appearance: none; flex: none; width: 2em; height: 1em; margin: 0; border: 1px solid rgba(0, 0, 0, 0.25); border-radius: 2em; background: ${o(`--color-surface`)} radial-gradient(circle, rgba(0, 0, 0, 0.25) 0.35em, transparent 0.4em) left / 1em 1em no-repeat; cursor: pointer; transition: background-position 0.15s ease-in-out; } .form-check-input:checked { border-color: ${o(`--color-primary`)}; background: ${o(`--color-primary`)} radial-gradient(circle, #fff 0.35em, transparent 0.4em) right / 1em 1em no-repeat; } .form-check-input:disabled { opacity: 0.5; cursor: default; } .form-check-input:focus-visible { outline: 2px solid ${o(`--color-primary`)}; outline-offset: 2px; } .form-check-label { cursor: pointer; } .wui-consent-banner-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; } .btn { display: inline-block; padding: 0.25rem 0.5rem; border: 1px solid transparent; border-radius: 0.375rem; background: transparent; font: inherit; font-size: 0.875rem; font-weight: 500; line-height: 1.5; text-align: center; white-space: nowrap; cursor: pointer; } .btn:focus-visible { outline: 2px solid ${o(`--color-primary`)}; outline-offset: 2px; } .btn-primary { background: ${o(`--color-primary`)}; border-color: ${o(`--color-primary`)}; color: ${o(`--color-primary-text`)}; } .btn-primary:hover { background: ${o(`--color-primary-hover`)}; border-color: ${o(`--color-primary-hover`)}; } .btn-outline-secondary { border-color: ${o(`--color-text-muted`)}; color: ${o(`--color-text-muted`)}; } .btn-outline-secondary:hover { background: ${o(`--color-bg-muted`)}; color: ${o(`--color-text`)}; } .btn-link { font-weight: 400; color: ${o(`--color-primary-ink`)}; text-decoration: underline; } .btn-link:hover { color: ${o(`--color-primary-hover`)}; } .wui-consent-banner-settings-toggle { margin-inline-end: auto; padding-inline: 0; } .wui-consent-banner-save { flex: 1 1 100%; } @media (max-width: 575.98px) { :host, :host([position="bottom-right"]) { left: 0; right: 0; bottom: 0; width: auto; max-width: none; } .wui-consent-banner-panel { padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-width: 1px 0 0; border-radius: 0; } /* Hidden on phones, but it stays the dialog's accessible name. */ .wui-consent-banner-heading { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; } .wui-consent-banner-description { margin: 0 0 8px; font-size: 13px; line-height: 1.4; } .wui-consent-banner-actions { gap: 6px; } } @media (min-width: 576px) { :host([position="bar"]) .wui-consent-banner-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; } /* Hidden on the bar, but it stays the dialog's accessible name. */ :host([position="bar"]) .wui-consent-banner-heading { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; } :host([position="bar"]) .wui-consent-banner-description { margin: 0; flex: 1 1 320px; } :host([position="bar"]) .wui-consent-banner-actions { flex: none; } :host([position="bar"]) .wui-consent-banner-settings { flex-basis: 100%; margin: 0; } } `,c=`data-wui-tour-open`,l=`wui-consent-save`,u=`[data-consent-settings]`,d=`tour-open`,f=`--wui-consent-banner-block`,p=`--wui-consent-banner-inline`,m={heading:`Cookies on this site`,description:`We use cookies to understand how the site is used and to measure our campaigns. You can change your choice at any time.`,policyLabel:`Cookie policy`,essentialLabel:`Essential cookies`,essentialDescription:`Required for the site to work and stay secure. Always on.`,analyticsLabel:`Analytics cookies`,analyticsDescription:`Help us understand how visitors use the site.`,functionalLabel:`Functional cookies`,functionalDescription:`Remember choices you make, such as your preferences.`,marketingLabel:`Marketing cookies`,marketingDescription:`Measure how well our campaigns work.`,settingsLabel:`Cookie settings`,rejectLabel:`Reject all`,acceptLabel:`Accept all`,saveLabel:`Save preferences`},h=[`analytics`,`functional`,`marketing`],g={analytics:{label:m.analyticsLabel,description:`analyticsDescription`},functional:{label:m.functionalLabel,description:`functionalDescription`},marketing:{label:m.marketingLabel,description:`marketingDescription`}},_=new Set;function v(e){_.has(e)||(_.add(e),(0,n.devWarn)(`[@webority/ui-elements] <wui-consent-banner> received categories containing "${e}", which is not one of ${h.map(e=>`"${e}"`).join(` | `)}. It is ignored.`))}var y=0,b=null;function x(e){b||(b=new CSSStyleSheet,b.replaceSync(s)),e.adoptedStyleSheets=[b]}var S=class extends r.ElementBase{static get observedAttributes(){return[`heading`,`description`,`policy-href`,`policy-label`,`analytics-description`,`functional-description`,`marketing-description`,`categories`]}constructor(){super(),y+=1,this._uid=`wui-consent-${y}`,this._preferences={analytics:!1,functional:!1,marketing:!1},this._settings=!1,this._onDocumentClick=e=>{e.target instanceof Element&&e.target.closest(u)&&(e.preventDefault(),this.open({settings:!0,focus:!0}))},this._tourWatch=null,this._roomObserver=null,this._onWindowResize=()=>this._reserveRoom()}get position(){let e=this.getAttribute(`position`);return e===`bottom-right`||e===`bar`?e:`bottom-left`}set position(e){this.setAttribute(`position`,String(e??`bottom-left`))}get standalone(){return this.hasAttribute(`standalone`)}set standalone(e){this.toggleAttribute(`standalone`,e===!0||e===``||e===`true`)}get heading(){return this.getAttribute(`heading`)||m.heading}set heading(e){this.setAttribute(`heading`,String(e??``))}get description(){return this.getAttribute(`description`)||m.description}set description(e){this.setAttribute(`description`,String(e??``))}get policyHref(){return this.getAttribute(`policy-href`)||``}set policyHref(e){this.setAttribute(`policy-href`,String(e??``))}get policyLabel(){return this.getAttribute(`policy-label`)||m.policyLabel}set policyLabel(e){this.setAttribute(`policy-label`,String(e??``))}get analyticsDescription(){return this.getAttribute(`analytics-description`)||m.analyticsDescription}set analyticsDescription(e){this.setAttribute(`analytics-description`,String(e??``))}get functionalDescription(){return this.getAttribute(`functional-description`)||m.functionalDescription}set functionalDescription(e){this.setAttribute(`functional-description`,String(e??``))}get marketingDescription(){return this.getAttribute(`marketing-description`)||m.marketingDescription}set marketingDescription(e){this.setAttribute(`marketing-description`,String(e??``))}get categories(){let e=this.getAttribute(`categories`);if(!e?.trim())return[...h];let t=e.split(/\s+/).filter(Boolean);for(let e of t)h.includes(e)||v(e);let n=h.filter(e=>t.includes(e));return n.length?n:[...h]}set categories(e){e==null?this.removeAttribute(`categories`):this.setAttribute(`categories`,Array.isArray(e)?e.join(` `):String(e))}get preferences(){let e=this.categories;return Object.fromEntries(h.map(t=>[t,e.includes(t)&&this._preferences[t]]))}set preferences(e){this._preferences={analytics:e?.analytics===!0,functional:e?.functional===!0,marketing:e?.marketing===!0},this._applyPreferences()}get isOpen(){return this.hasAttribute(`open`)}connectedCallback(){this._rendered||this.render(),document.addEventListener(`click`,this._onDocumentClick),this._syncTour(),this._tourWatch??=new MutationObserver(()=>this._syncTour()),this._tourWatch.observe(document.documentElement,{attributes:!0,attributeFilter:[c]}),this.isOpen&&this._trackRoom()}disconnectedCallback(){document.removeEventListener(`click`,this._onDocumentClick),this._tourWatch?.disconnect(),this._untrackRoom()}_syncTour(){this.toggleAttribute(d,document.documentElement.hasAttribute(c))}attributeChangedCallback(){this._rendered&&this.render()}render(){let e=this.isOpen,t=this._uid,n=this.policyHref?` <a class="wui-consent-banner-policy" href="${T(this.policyHref)}">${w(this.policyLabel)}</a>`:``,r=this._root();r!==this&&x(r),r.innerHTML=` <div class="wui-consent-banner-panel" role="dialog" aria-labelledby="${t}-heading" aria-describedby="${t}-description" hidden> <h2 class="wui-consent-banner-heading" id="${t}-heading">${w(this.heading)}</h2> <p class="wui-consent-banner-description" id="${t}-description">${w(this.description)}${n}</p> <div class="wui-consent-banner-settings" hidden> ${C(t,`essential`,m.essentialLabel,m.essentialDescription,!0)} ${this.categories.map(e=>C(t,e,g[e].label,this[g[e].description],!1)).join(` `)} </div> <div class="wui-consent-banner-actions"> <button type="button" class="btn btn-sm btn-link wui-consent-banner-settings-toggle" aria-expanded="false">${m.settingsLabel}</button> <button type="button" class="btn btn-sm btn-outline-secondary wui-consent-banner-reject">${m.rejectLabel}</button> <button type="button" class="btn btn-sm btn-primary wui-consent-banner-accept">${m.acceptLabel}</button> <button type="button" class="btn btn-sm btn-primary wui-consent-banner-save" hidden>${m.saveLabel}</button> </div> </div>`,this._rendered=!0,this._wire(),this._applyPreferences(),this._showSettings(this._settings),e&&(this._panel().hidden=!1)}open({settings:e=!1,focus:t=!1}={}){this._rendered||this.render(),this._applyPreferences(),this._showSettings(e),this._panel().hidden=!1,this.setAttribute(`open`,``),this._trackRoom(),t&&(e?this._root().querySelector(`.wui-consent-banner-category input:not([disabled])`):this._root().querySelector(`.wui-consent-banner-accept`))?.focus()}close(){let e=this._panel();e&&(e.hidden=!0),this.removeAttribute(`open`),this._showSettings(!1),this._untrackRoom()}_trackRoom(){this.isConnected&&(typeof ResizeObserver<`u`&&(this._roomObserver??=new ResizeObserver(()=>this._reserveRoom()),this._roomObserver.observe(this)),window.addEventListener(`resize`,this._onWindowResize),this._reserveRoom())}_untrackRoom(){this._roomObserver?.disconnect(),window.removeEventListener(`resize`,this._onWindowResize),document.documentElement.style.removeProperty(f),document.documentElement.style.removeProperty(p)}_reserveRoom(){let e=this.getBoundingClientRect(),t=this.position===`bar`?0:this.position===`bottom-right`?window.innerWidth-e.left:e.right,n=document.documentElement.style;n.setProperty(f,`${Math.ceil(window.innerHeight-e.top)}px`),n.setProperty(p,`${Math.ceil(t)}px`)}_root(){return this.shadowRoot?this.shadowRoot:this.standalone?this.attachShadow({mode:`open`}):this}_panel(){return this._root().querySelector(`.wui-consent-banner-panel`)}_wire(){let e=this._root();e.querySelector(`.wui-consent-banner-accept`)?.addEventListener(`click`,()=>this._save(this._choiceForShown(!0))),e.querySelector(`.wui-consent-banner-reject`)?.addEventListener(`click`,()=>this._save(this._choiceForShown(!1))),e.querySelector(`.wui-consent-banner-save`)?.addEventListener(`click`,()=>this._save(this._switchValues())),e.querySelector(`.wui-consent-banner-settings-toggle`)?.addEventListener(`click`,()=>this._showSettings(!this._settings))}_save(e){this._preferences={...e},this.dispatchEvent(new CustomEvent(l,{bubbles:!0,composed:!0,detail:{...e}})),this.close()}_choiceForShown(e){let t=this.categories;return Object.fromEntries(h.map(n=>[n,e&&t.includes(n)]))}_switchValues(){let e={};for(let t of h)e[t]=this._root().querySelector(`input[data-category="${t}"]`)?.checked===!0;return e}_applyPreferences(){for(let e of h){let t=this._root().querySelector(`input[data-category="${e}"]`);t&&(t.checked=this._preferences[e])}}_showSettings(e){this._settings=e;let t=this._root(),n=t.querySelector(`.wui-consent-banner-settings`);if(!n)return;n.hidden=!e,t.querySelector(`.wui-consent-banner-settings-toggle`)?.setAttribute(`aria-expanded`,e?`true`:`false`);let r=t.querySelector(`.wui-consent-banner-save`);r&&(r.hidden=!e);for(let n of[`.wui-consent-banner-reject`,`.wui-consent-banner-accept`]){let r=t.querySelector(n);r&&(r.hidden=e)}}};function C(e,t,n,r,i){let a=`${e}-${t}`;return`<div class="wui-consent-banner-category"> <div class="form-check form-switch"> <input class="form-check-input" type="checkbox" role="switch" id="${a}" data-category="${t}"${i?` checked disabled`:``} /> <label class="form-check-label" for="${a}">${w(n)}</label> </div> <p class="wui-consent-banner-category-description">${w(r)}</p> </div>`}var w=e=>String(e??``).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`),T=e=>String(e??``).replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`);(0,t.defineElement)(`wui-consent-banner`,S),e.WuiConsentBanner=S})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.devWarn,WeborityUiElementsInternal.modules.elementBase);
@@ -1 +1 @@
1
- (function(e,t,n,r,i){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var a=globalThis.WeborityUiElementsInternal?.version;if(a!==`0.80.8`)throw Error(`[webority-ui] context-menu expects ui-elements 0.80.8 but the page loaded `+a+`.`);var o=`[role="menuitem"]`,s=`input, textarea, select, [contenteditable=""], [contenteditable="true"]`,c=`data-open`,l=500,u=10,d=400,f=null,p=null,m=new WeakMap;function h(e,t,n){let r=m.get(e);if(r){if(r.region===t||t.contains(r.region))return!1;r.cancel()}return m.set(e,{region:t,cancel:n}),!0}var g=e=>e instanceof Element?e:e?.parentElement??null,_=class extends r.ElementBase{static get observedAttributes(){return[`disabled`]}constructor(){super(),this._region=null,this._origin=null,this._returnFocus=null,this._press=null,this._swallowClick=!1,this._nav=(0,i.createListboxKeyNav)({getVisibleOptions:()=>this._items(),getActive:()=>this._items().indexOf(document.activeElement),setActive:e=>this._items()[e]?.focus({preventScroll:!0})}),this._onContextMenu=e=>this._handleContextMenu(e),this._onContextMenuCapture=e=>{this.isOpen&&!this._inPanel(e.target)&&!this._isKeyEcho()&&this.close()},this._onDocKeyDown=e=>this._handleDocKeyDown(e),this._onPointerDown=e=>this._handlePointerDown(e),this._onPressMove=e=>{this._press&&Math.hypot(e.clientX-this._press.x,e.clientY-this._press.y)>u&&this._cancelPress()},this._onPressEnd=()=>this._cancelPress(),this._onClickCapture=e=>{!this._swallowClick||!this._region?.contains(e.target)||(this._swallowClick=!1,e.preventDefault(),e.stopImmediatePropagation())},this._onKeyDown=e=>{this._inPanel(e.target)&&this._handleMenuKey(e)},this._onClick=e=>this._handleClick(e),this._onMouseMove=e=>{let t=g(e.target)?.closest(o);t&&this._inPanel(t)&&!this._isDisabled(t)&&t!==document.activeElement&&t.focus({preventScroll:!0})},this._onDismiss=e=>{e.type===`scroll`&&this._inPanel(e.target)||this.close()},this._onPointerDownCapture=e=>{this._swallowClick=!1,this.isOpen&&!this._inPanel(e.target)&&this.close()}}connectedCallback(){this._teardown(),document.addEventListener(`contextmenu`,this._onContextMenuCapture,!0),document.addEventListener(`contextmenu`,this._onContextMenu),document.addEventListener(`keydown`,this._onDocKeyDown),document.addEventListener(`pointerdown`,this._onPointerDownCapture,!0),document.addEventListener(`pointerdown`,this._onPointerDown),document.addEventListener(`click`,this._onClickCapture,!0),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`click`,this._onClick),this.addEventListener(`mousemove`,this._onMouseMove)}disconnectedCallback(){this._teardown()}attributeChangedCallback(){this.disabled&&this.close()}get target(){return this.getAttribute(`target`)}set target(e){e==null||e===``?this.removeAttribute(`target`):this.setAttribute(`target`,String(e))}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){this.toggleAttribute(`disabled`,!!e)}get isOpen(){return this._panel()?.hasAttribute(c)??!1}open(e,t,{region:r=this,origin:i=r,keyboard:a=!1}={}){let o=this._panel();if(o){if(f&&f!==this&&f.close(!0),!this.isOpen){let e=document.activeElement;this._returnFocus=e&&e!==document.body&&!this._inPanel(e)?e:null}this._region=r,this._origin=i,p=null,o.setAttribute(c,``),f=this,(0,n.anchorOverlay)({getBoundingClientRect:()=>({left:e,right:e,top:t,bottom:t,width:0,height:0})},o,{clampHeight:!0}),window.addEventListener(`scroll`,this._onDismiss,!0),window.addEventListener(`resize`,this._onDismiss),window.addEventListener(`blur`,this._onDismiss),((a?this._items()[0]:null)??o).focus({preventScroll:!0}),this.dispatchEvent(new CustomEvent(`wui-context-menu:open`,{bubbles:!0,detail:{region:r,origin:i,x:e,y:t}}))}}close(e=!1){let t=this._panel();if(!t?.hasAttribute(c))return;t.removeAttribute(c),f===this&&(f=null),window.removeEventListener(`scroll`,this._onDismiss,!0),window.removeEventListener(`resize`,this._onDismiss),window.removeEventListener(`blur`,this._onDismiss),this._nav.teardown();let n=this._returnFocus;this._returnFocus=null,e&&n?.isConnected&&n.focus({preventScroll:!0})}_panel(){return[...this.children].find(e=>e.getAttribute(`role`)===`menu`)??null}_inPanel(e){return!!e&&!!this._panel()?.contains(e)}_items(){return[...this._panel()?.querySelectorAll(o)??[]].filter(e=>!this._isDisabled(e))}_isDisabled(e){return e.getAttribute(`aria-disabled`)===`true`}_regionFor(e){let t=g(e);if(!t||this.disabled||!this._panel()||this._inPanel(t)||t.closest(s))return null;let n=this.target;return n?t.closest(n):this.contains(t)?this:null}_isKeyEcho(){return p?.menu===this&&this.isOpen&&performance.now()-p.at<d}_handleContextMenu(e){if(this._inPanel(e.target)){e.preventDefault();return}if(e.defaultPrevented&&!m.has(e))return;let t=this._regionFor(e.target);if(t){if(this._isKeyEcho()){e.preventDefault();return}e.shiftKey||h(e,t,()=>this.close(!0))&&(e.preventDefault(),this.open(e.clientX,e.clientY,{region:t,origin:g(e.target)}))}}_handleDocKeyDown(e){if(e.defaultPrevented&&!m.has(e)||!(e.key===`ContextMenu`||e.key===`F10`&&e.shiftKey)||this._inPanel(e.target))return;let t=this._regionFor(e.target);if(!t||!h(e,t,()=>this.close(!0)))return;e.preventDefault();let n=g(e.target),r=n.getBoundingClientRect();this.open(r.left+Math.min(16,r.width/2),r.bottom,{region:t,origin:n,keyboard:!0}),p={menu:this,at:performance.now()}}_handlePointerDown(e){if(e.pointerType!==`touch`)return;let t=this._regionFor(e.target);if(!t||!h(e,t,()=>this._cancelPress()))return;this._cancelPress();let{clientX:n,clientY:r}=e,i=g(e.target);this._press={x:n,y:r,timer:setTimeout(()=>{this._cancelPress(),this._swallowClick=!0,this.open(n,r,{region:t,origin:i})},l)},document.addEventListener(`pointermove`,this._onPressMove,{passive:!0}),document.addEventListener(`pointerup`,this._onPressEnd),document.addEventListener(`pointercancel`,this._onPressEnd),window.addEventListener(`scroll`,this._onPressEnd,!0)}_cancelPress(){this._press&&(clearTimeout(this._press.timer),this._press=null,document.removeEventListener(`pointermove`,this._onPressMove),document.removeEventListener(`pointerup`,this._onPressEnd),document.removeEventListener(`pointercancel`,this._onPressEnd),window.removeEventListener(`scroll`,this._onPressEnd,!0))}_handleMenuKey(e){if(this.isOpen)if(e.key===`Escape`)e.preventDefault(),e.stopPropagation(),this.close(!0);else if(e.key===`Tab`)this.close(!0);else if(e.key===`ArrowDown`||e.key===`ArrowUp`)e.preventDefault(),this._step(e.key===`ArrowDown`?1:-1);else if(e.key===` `){let t=g(e.target)?.closest(o);e.preventDefault(),t&&t.click()}else this._nav.handler(e)}_step(e){let t=this._items();if(!t.length)return;let n=t.indexOf(document.activeElement);t[n<0?e>0?0:t.length-1:(n+e+t.length)%t.length].focus({preventScroll:!0})}_handleClick(e){let t=g(e.target)?.closest(o);if(!(!t||!this._inPanel(t))){if(this._isDisabled(t)){e.preventDefault(),e.stopPropagation();return}this.close(!0),this.dispatchEvent(new CustomEvent(`wui-context-menu:select`,{bubbles:!0,detail:{key:t.dataset.key??null,item:t,region:this._region,origin:this._origin}}))}}_teardown(){this.close(),this._cancelPress(),document.removeEventListener(`contextmenu`,this._onContextMenuCapture,!0),document.removeEventListener(`contextmenu`,this._onContextMenu),document.removeEventListener(`keydown`,this._onDocKeyDown),document.removeEventListener(`pointerdown`,this._onPointerDownCapture,!0),document.removeEventListener(`pointerdown`,this._onPointerDown),document.removeEventListener(`click`,this._onClickCapture,!0),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`mousemove`,this._onMouseMove)}};(0,t.defineElement)(`wui-context-menu`,_),e.WuiContextMenu=_})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.anchorOverlay,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.listboxKeyNav);
1
+ (function(e,t,n,r,i){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var a=globalThis.WeborityUiElementsInternal?.version;if(a!==`0.80.9`)throw Error(`[webority-ui] context-menu expects ui-elements 0.80.9 but the page loaded `+a+`.`);var o=`[role="menuitem"]`,s=`input, textarea, select, [contenteditable=""], [contenteditable="true"]`,c=`data-open`,l=500,u=10,d=400,f=null,p=null,m=new WeakMap;function h(e,t,n){let r=m.get(e);if(r){if(r.region===t||t.contains(r.region))return!1;r.cancel()}return m.set(e,{region:t,cancel:n}),!0}var g=e=>e instanceof Element?e:e?.parentElement??null,_=class extends r.ElementBase{static get observedAttributes(){return[`disabled`]}constructor(){super(),this._region=null,this._origin=null,this._returnFocus=null,this._press=null,this._swallowClick=!1,this._nav=(0,i.createListboxKeyNav)({getVisibleOptions:()=>this._items(),getActive:()=>this._items().indexOf(document.activeElement),setActive:e=>this._items()[e]?.focus({preventScroll:!0})}),this._onContextMenu=e=>this._handleContextMenu(e),this._onContextMenuCapture=e=>{this.isOpen&&!this._inPanel(e.target)&&!this._isKeyEcho()&&this.close()},this._onDocKeyDown=e=>this._handleDocKeyDown(e),this._onPointerDown=e=>this._handlePointerDown(e),this._onPressMove=e=>{this._press&&Math.hypot(e.clientX-this._press.x,e.clientY-this._press.y)>u&&this._cancelPress()},this._onPressEnd=()=>this._cancelPress(),this._onClickCapture=e=>{!this._swallowClick||!this._region?.contains(e.target)||(this._swallowClick=!1,e.preventDefault(),e.stopImmediatePropagation())},this._onKeyDown=e=>{this._inPanel(e.target)&&this._handleMenuKey(e)},this._onClick=e=>this._handleClick(e),this._onMouseMove=e=>{let t=g(e.target)?.closest(o);t&&this._inPanel(t)&&!this._isDisabled(t)&&t!==document.activeElement&&t.focus({preventScroll:!0})},this._onDismiss=e=>{e.type===`scroll`&&this._inPanel(e.target)||this.close()},this._onPointerDownCapture=e=>{this._swallowClick=!1,this.isOpen&&!this._inPanel(e.target)&&this.close()}}connectedCallback(){this._teardown(),document.addEventListener(`contextmenu`,this._onContextMenuCapture,!0),document.addEventListener(`contextmenu`,this._onContextMenu),document.addEventListener(`keydown`,this._onDocKeyDown),document.addEventListener(`pointerdown`,this._onPointerDownCapture,!0),document.addEventListener(`pointerdown`,this._onPointerDown),document.addEventListener(`click`,this._onClickCapture,!0),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`click`,this._onClick),this.addEventListener(`mousemove`,this._onMouseMove)}disconnectedCallback(){this._teardown()}attributeChangedCallback(){this.disabled&&this.close()}get target(){return this.getAttribute(`target`)}set target(e){e==null||e===``?this.removeAttribute(`target`):this.setAttribute(`target`,String(e))}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){this.toggleAttribute(`disabled`,!!e)}get isOpen(){return this._panel()?.hasAttribute(c)??!1}open(e,t,{region:r=this,origin:i=r,keyboard:a=!1}={}){let o=this._panel();if(o){if(f&&f!==this&&f.close(!0),!this.isOpen){let e=document.activeElement;this._returnFocus=e&&e!==document.body&&!this._inPanel(e)?e:null}this._region=r,this._origin=i,p=null,o.setAttribute(c,``),f=this,(0,n.anchorOverlay)({getBoundingClientRect:()=>({left:e,right:e,top:t,bottom:t,width:0,height:0})},o,{clampHeight:!0}),window.addEventListener(`scroll`,this._onDismiss,!0),window.addEventListener(`resize`,this._onDismiss),window.addEventListener(`blur`,this._onDismiss),((a?this._items()[0]:null)??o).focus({preventScroll:!0}),this.dispatchEvent(new CustomEvent(`wui-context-menu:open`,{bubbles:!0,detail:{region:r,origin:i,x:e,y:t}}))}}close(e=!1){let t=this._panel();if(!t?.hasAttribute(c))return;t.removeAttribute(c),f===this&&(f=null),window.removeEventListener(`scroll`,this._onDismiss,!0),window.removeEventListener(`resize`,this._onDismiss),window.removeEventListener(`blur`,this._onDismiss),this._nav.teardown();let n=this._returnFocus;this._returnFocus=null,e&&n?.isConnected&&n.focus({preventScroll:!0})}_panel(){return[...this.children].find(e=>e.getAttribute(`role`)===`menu`)??null}_inPanel(e){return!!e&&!!this._panel()?.contains(e)}_items(){return[...this._panel()?.querySelectorAll(o)??[]].filter(e=>!this._isDisabled(e))}_isDisabled(e){return e.getAttribute(`aria-disabled`)===`true`}_regionFor(e){let t=g(e);if(!t||this.disabled||!this._panel()||this._inPanel(t)||t.closest(s))return null;let n=this.target;return n?t.closest(n):this.contains(t)?this:null}_isKeyEcho(){return p?.menu===this&&this.isOpen&&performance.now()-p.at<d}_handleContextMenu(e){if(this._inPanel(e.target)){e.preventDefault();return}if(e.defaultPrevented&&!m.has(e))return;let t=this._regionFor(e.target);if(t){if(this._isKeyEcho()){e.preventDefault();return}e.shiftKey||h(e,t,()=>this.close(!0))&&(e.preventDefault(),this.open(e.clientX,e.clientY,{region:t,origin:g(e.target)}))}}_handleDocKeyDown(e){if(e.defaultPrevented&&!m.has(e)||!(e.key===`ContextMenu`||e.key===`F10`&&e.shiftKey)||this._inPanel(e.target))return;let t=this._regionFor(e.target);if(!t||!h(e,t,()=>this.close(!0)))return;e.preventDefault();let n=g(e.target),r=n.getBoundingClientRect();this.open(r.left+Math.min(16,r.width/2),r.bottom,{region:t,origin:n,keyboard:!0}),p={menu:this,at:performance.now()}}_handlePointerDown(e){if(e.pointerType!==`touch`)return;let t=this._regionFor(e.target);if(!t||!h(e,t,()=>this._cancelPress()))return;this._cancelPress();let{clientX:n,clientY:r}=e,i=g(e.target);this._press={x:n,y:r,timer:setTimeout(()=>{this._cancelPress(),this._swallowClick=!0,this.open(n,r,{region:t,origin:i})},l)},document.addEventListener(`pointermove`,this._onPressMove,{passive:!0}),document.addEventListener(`pointerup`,this._onPressEnd),document.addEventListener(`pointercancel`,this._onPressEnd),window.addEventListener(`scroll`,this._onPressEnd,!0)}_cancelPress(){this._press&&(clearTimeout(this._press.timer),this._press=null,document.removeEventListener(`pointermove`,this._onPressMove),document.removeEventListener(`pointerup`,this._onPressEnd),document.removeEventListener(`pointercancel`,this._onPressEnd),window.removeEventListener(`scroll`,this._onPressEnd,!0))}_handleMenuKey(e){if(this.isOpen)if(e.key===`Escape`)e.preventDefault(),e.stopPropagation(),this.close(!0);else if(e.key===`Tab`)this.close(!0);else if(e.key===`ArrowDown`||e.key===`ArrowUp`)e.preventDefault(),this._step(e.key===`ArrowDown`?1:-1);else if(e.key===` `){let t=g(e.target)?.closest(o);e.preventDefault(),t&&t.click()}else this._nav.handler(e)}_step(e){let t=this._items();if(!t.length)return;let n=t.indexOf(document.activeElement);t[n<0?e>0?0:t.length-1:(n+e+t.length)%t.length].focus({preventScroll:!0})}_handleClick(e){let t=g(e.target)?.closest(o);if(!(!t||!this._inPanel(t))){if(this._isDisabled(t)){e.preventDefault(),e.stopPropagation();return}this.close(!0),this.dispatchEvent(new CustomEvent(`wui-context-menu:select`,{bubbles:!0,detail:{key:t.dataset.key??null,item:t,region:this._region,origin:this._origin}}))}}_teardown(){this.close(),this._cancelPress(),document.removeEventListener(`contextmenu`,this._onContextMenuCapture,!0),document.removeEventListener(`contextmenu`,this._onContextMenu),document.removeEventListener(`keydown`,this._onDocKeyDown),document.removeEventListener(`pointerdown`,this._onPointerDownCapture,!0),document.removeEventListener(`pointerdown`,this._onPointerDown),document.removeEventListener(`click`,this._onClickCapture,!0),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`mousemove`,this._onMouseMove)}};(0,t.defineElement)(`wui-context-menu`,_),e.WuiContextMenu=_})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.anchorOverlay,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.listboxKeyNav);
@@ -1,4 +1,4 @@
1
- (function(e,t,n,r,i,a,o,s){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var c=globalThis.WeborityUiElementsInternal?.version;if(c!==`0.80.8`)throw Error(`[webority-ui] date-range expects ui-elements 0.80.8 but the page loaded `+c+`.`);var l=`Asia/Kolkata`,u=3,d=[`today`,`yesterday`,`last7Days`,`last30Days`,`thisMonth`,`lastMonth`,`thisFinancialYear`],f={today:`Today`,yesterday:`Yesterday`,last7Days:`Last 7 days`,last30Days:`Last 30 days`,thisMonth:`This month`,lastMonth:`Last month`,thisFinancialYear:`This financial year`},p=e=>String(e).padStart(2,`0`),m=e=>`${e.getUTCFullYear()}-${p(e.getUTCMonth()+1)}-${p(e.getUTCDate())}`;function h(e=new Date){let t=new Intl.DateTimeFormat(`en-US`,{timeZone:l,year:`numeric`,month:`2-digit`,day:`2-digit`}).formatToParts(e),n=e=>t.find(t=>t.type===e).value;return`${n(`year`)}-${n(`month`)}-${n(`day`)}`}function g(e,t=new Date){let{y:n,m:i,d:a}=(0,r.parseIso)(h(t)),o=(e,t,n)=>m(new Date(Date.UTC(e,t,n))),s=f[e];switch(e){case`today`:return{label:s,start:o(n,i,a),end:o(n,i,a)};case`yesterday`:return{label:s,start:o(n,i,a-1),end:o(n,i,a-1)};case`last7Days`:return{label:s,start:o(n,i,a-6),end:o(n,i,a)};case`last30Days`:return{label:s,start:o(n,i,a-29),end:o(n,i,a)};case`thisMonth`:return{label:s,start:o(n,i,1),end:o(n,i+1,0)};case`lastMonth`:return{label:s,start:o(n,i-1,1),end:o(n,i,0)};case`thisFinancialYear`:{let e=i>=u?n:n-1;return{label:s,start:o(e,u,1),end:o(e+1,u,0)}}default:return null}}function _(e){(0,i.devWarn)(`[@webority/ui-elements] <wui-date-range> presets: ${e}`)}function v(e,t=new Date){let n=String(e??``).trim();if(!n)return[];let i;if(n.startsWith(`[`))try{i=JSON.parse(n)}catch{return _(`the attribute is not valid JSON`),[]}else i=n.split(`,`).map(e=>e.trim());let a=[];for(let e of i)if(typeof e==`string`){let n=g(e,t);n?a.push(n):_(`"${e}" is not one of ${d.join(`, `)}`)}else e&&typeof e.label==`string`&&e.label&&(0,r.parseIso)(e.start)&&(0,r.parseIso)(e.end)?a.push({label:e.label,start:e.start,end:e.end}):_(`an item needs a label and ISO start and end dates, or a preset name`);return a}var y=class extends a.ElementBase{static formAssociated=!0;static get observedAttributes(){return[`start`,`end`,`min`,`max`,`placeholder`,`disabled`,`first-day`,`size`,`aria-label`,`aria-describedby`,`name`,`start-name`,`end-name`,`presets`,`aria-invalid`]}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._start=``,this._end=``,this._hover=``;let e=new Date(2e3,0,1);this._viewY=e.getFullYear(),this._viewM=e.getMonth()}connectedCallback(){if(!this._rendered){this.render();return}this._bindGlobal?.()}attributeChangedCallback(e,t,n){if(e===`aria-invalid`){this._syncInvalid();return}this._rendered&&(e===`start`||e===`end`?(this._start=this.getAttribute(`start`)||``,this._end=this.getAttribute(`end`)||``,this._syncTrigger(),this._syncMirrors()):this.render())}_syncInvalid(){let e=this.querySelector(`.daterange-trigger`);e&&(this.hasAttribute(`aria-invalid`)?e.setAttribute(`aria-invalid`,`true`):e.removeAttribute(`aria-invalid`))}get value(){return{start:this._start,end:this._end}}set value(e){this._start=e?.start||``,this._end=e?.end||``,this._syncTrigger(),this._syncMirrors()}_firstDay(){return(0,r.firstWeekday)(this)}_label(){let e=this.getAttribute(`placeholder`)||`Start to End`;return!this._start&&!this._end?{text:e,empty:!0}:{text:`${(0,r.fmt)(this._start)||`Start`} to ${(0,r.fmt)(this._end)||`End`}`,empty:!1}}render(){this._defaultStart===void 0&&(this._defaultStart=this.getAttribute(`start`)||``,this._defaultEnd=this.getAttribute(`end`)||``,this._start=this._defaultStart||this._start,this._end=this._defaultEnd||this._end);let e=(0,r.parseIso)(this._start);e&&(this._viewY=e.y,this._viewM=e.m);let t=this.getAttribute(`size`),n=t===`sm`?` input-sm`:t===`lg`?` input-lg`:``,{text:i,empty:a}=this._label(),c=this.getAttribute(`aria-label`),l=this.getAttribute(`aria-describedby`);this.innerHTML=`
1
+ (function(e,t,n,r,i,a,o,s){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var c=globalThis.WeborityUiElementsInternal?.version;if(c!==`0.80.9`)throw Error(`[webority-ui] date-range expects ui-elements 0.80.9 but the page loaded `+c+`.`);var l=`Asia/Kolkata`,u=3,d=[`today`,`yesterday`,`last7Days`,`last30Days`,`thisMonth`,`lastMonth`,`thisFinancialYear`],f={today:`Today`,yesterday:`Yesterday`,last7Days:`Last 7 days`,last30Days:`Last 30 days`,thisMonth:`This month`,lastMonth:`Last month`,thisFinancialYear:`This financial year`},p=e=>String(e).padStart(2,`0`),m=e=>`${e.getUTCFullYear()}-${p(e.getUTCMonth()+1)}-${p(e.getUTCDate())}`;function h(e=new Date){let t=new Intl.DateTimeFormat(`en-US`,{timeZone:l,year:`numeric`,month:`2-digit`,day:`2-digit`}).formatToParts(e),n=e=>t.find(t=>t.type===e).value;return`${n(`year`)}-${n(`month`)}-${n(`day`)}`}function g(e,t=new Date){let{y:n,m:i,d:a}=(0,r.parseIso)(h(t)),o=(e,t,n)=>m(new Date(Date.UTC(e,t,n))),s=f[e];switch(e){case`today`:return{label:s,start:o(n,i,a),end:o(n,i,a)};case`yesterday`:return{label:s,start:o(n,i,a-1),end:o(n,i,a-1)};case`last7Days`:return{label:s,start:o(n,i,a-6),end:o(n,i,a)};case`last30Days`:return{label:s,start:o(n,i,a-29),end:o(n,i,a)};case`thisMonth`:return{label:s,start:o(n,i,1),end:o(n,i+1,0)};case`lastMonth`:return{label:s,start:o(n,i-1,1),end:o(n,i,0)};case`thisFinancialYear`:{let e=i>=u?n:n-1;return{label:s,start:o(e,u,1),end:o(e+1,u,0)}}default:return null}}function _(e){(0,i.devWarn)(`[@webority/ui-elements] <wui-date-range> presets: ${e}`)}function v(e,t=new Date){let n=String(e??``).trim();if(!n)return[];let i;if(n.startsWith(`[`))try{i=JSON.parse(n)}catch{return _(`the attribute is not valid JSON`),[]}else i=n.split(`,`).map(e=>e.trim());let a=[];for(let e of i)if(typeof e==`string`){let n=g(e,t);n?a.push(n):_(`"${e}" is not one of ${d.join(`, `)}`)}else e&&typeof e.label==`string`&&e.label&&(0,r.parseIso)(e.start)&&(0,r.parseIso)(e.end)?a.push({label:e.label,start:e.start,end:e.end}):_(`an item needs a label and ISO start and end dates, or a preset name`);return a}var y=class extends a.ElementBase{static formAssociated=!0;static get observedAttributes(){return[`start`,`end`,`min`,`max`,`placeholder`,`disabled`,`first-day`,`size`,`aria-label`,`aria-describedby`,`name`,`start-name`,`end-name`,`presets`,`aria-invalid`]}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._start=``,this._end=``,this._hover=``;let e=new Date(2e3,0,1);this._viewY=e.getFullYear(),this._viewM=e.getMonth()}connectedCallback(){if(!this._rendered){this.render();return}this._bindGlobal?.()}attributeChangedCallback(e,t,n){if(e===`aria-invalid`){this._syncInvalid();return}this._rendered&&(e===`start`||e===`end`?(this._start=this.getAttribute(`start`)||``,this._end=this.getAttribute(`end`)||``,this._syncTrigger(),this._syncMirrors()):this.render())}_syncInvalid(){let e=this.querySelector(`.daterange-trigger`);e&&(this.hasAttribute(`aria-invalid`)?e.setAttribute(`aria-invalid`,`true`):e.removeAttribute(`aria-invalid`))}get value(){return{start:this._start,end:this._end}}set value(e){this._start=e?.start||``,this._end=e?.end||``,this._syncTrigger(),this._syncMirrors()}_firstDay(){return(0,r.firstWeekday)(this)}_label(){let e=this.getAttribute(`placeholder`)||`Start to End`;return!this._start&&!this._end?{text:e,empty:!0}:{text:`${(0,r.fmt)(this._start)||`Start`} to ${(0,r.fmt)(this._end)||`End`}`,empty:!1}}render(){this._defaultStart===void 0&&(this._defaultStart=this.getAttribute(`start`)||``,this._defaultEnd=this.getAttribute(`end`)||``,this._start=this._defaultStart||this._start,this._end=this._defaultEnd||this._end);let e=(0,r.parseIso)(this._start);e&&(this._viewY=e.y,this._viewM=e.m);let t=this.getAttribute(`size`),n=t===`sm`?` input-sm`:t===`lg`?` input-lg`:``,{text:i,empty:a}=this._label(),c=this.getAttribute(`aria-label`),l=this.getAttribute(`aria-describedby`);this.innerHTML=`
2
2
  <div class="daterange">
3
3
  <button type="button" class="input daterange-trigger${n}${a?``:` has-value`}" aria-haspopup="dialog" aria-expanded="false"${this.hasAttribute(`aria-invalid`)?` aria-invalid="true"`:``}${this.hasAttribute(`disabled`)?` disabled`:``}${c?` aria-label="${(0,s.escapeHtml)(c)}"`:``}${l?` aria-describedby="${(0,s.escapeHtml)(l)}"`:``}>
4
4
  <span data-range-label class="${a?`search-select-placeholder`:``}">${(0,s.escapeHtml)(i)}</span>