@webority/ui-elements 0.66.0 → 0.68.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/{WuiAutocomplete-B2SKLPOV.js → WuiAutocomplete-5pVUMbGl.js} +3 -3
  2. package/dist/{WuiCommentThread-Dc2l9Fti.js → WuiCommentThread-BrCd4o4b.js} +1 -1
  3. package/dist/{WuiCountrySelect-D-K0dm77.js → WuiCountrySelect-B4O8uijt.js} +1 -1
  4. package/dist/WuiDataTable-Bqs6FW2t.js +1 -0
  5. package/dist/{WuiDatePicker-DONFTIvZ.js → WuiDatePicker-CeqLTVTD.js} +11 -11
  6. package/dist/{WuiDateRange-BuVA1MK5.js → WuiDateRange-Bk45QgnB.js} +1 -1
  7. package/dist/{WuiInlineEdit-CsyxcqXm.js → WuiInlineEdit-2XnVPzY-.js} +1 -1
  8. package/dist/{WuiMentionInput-BGVjGS4C.js → WuiMentionInput-U87MXi2S.js} +1 -1
  9. package/dist/{WuiMultiSelect-BGZOG93I.js → WuiMultiSelect-CR4meVOZ.js} +10 -10
  10. package/dist/{WuiNotificationCenter-CUmWy8QX.js → WuiNotificationCenter-BLsM1WkE.js} +1 -1
  11. package/dist/{WuiPhone-BoLywT_W.js → WuiPhone-Cbt2ekvK.js} +4 -4
  12. package/dist/{WuiSelect-U5Owq3wT.js → WuiSelect-C-NN9ZSX.js} +6 -6
  13. package/dist/WuiTagInput-DQ79rmjZ.js +6 -0
  14. package/dist/{WuiTimePicker-UjvUcDrS.js → WuiTimePicker-F0KkpOGq.js} +3 -3
  15. package/dist/{WuiTree-p6XmhW5x.js → WuiTree-BSx5pKJo.js} +1 -1
  16. package/dist/dataTable-Cd_IJQcs.js +1 -0
  17. package/dist/elements/autocomplete.js +1 -1
  18. package/dist/elements/comment-thread.js +1 -1
  19. package/dist/elements/country-select.js +1 -1
  20. package/dist/elements/data-table.js +1 -1
  21. package/dist/elements/date-range.js +1 -1
  22. package/dist/elements/datepicker.js +1 -1
  23. package/dist/elements/inline-edit.js +1 -1
  24. package/dist/elements/kanban.js +1 -1
  25. package/dist/elements/mention-input.js +1 -1
  26. package/dist/elements/multiselect.js +1 -1
  27. package/dist/elements/notification-center.js +1 -1
  28. package/dist/elements/phone.js +1 -1
  29. package/dist/elements/select.js +1 -1
  30. package/dist/elements/taginput.js +1 -1
  31. package/dist/elements/timepicker.js +1 -1
  32. package/dist/elements/tree.js +1 -1
  33. package/dist/helpers.js +1 -1
  34. package/dist/{kanban-kV9UbpnO.js → kanban-DclZZohi.js} +1 -1
  35. package/dist/themeTransition-Bzcxp2cy.js +1 -0
  36. package/dist/ui-calendar.global.js +1 -1
  37. package/dist/ui-calendar.js +1 -1
  38. package/dist/ui-chat.global.js +2 -2
  39. package/dist/ui-chat.js +2 -2
  40. package/dist/ui-elements.global.js +117 -117
  41. package/dist/ui-elements.js +1 -1
  42. package/dist/wuiHttp-0pGmgUIV.js +1 -0
  43. package/package.json +1 -1
  44. package/dist/WuiDataTable-tR8Lp4XZ.js +0 -1
  45. package/dist/WuiTagInput-DzEZooIn.js +0 -6
  46. package/dist/themeTransition-DO95LPdz.js +0 -1
  47. package/dist/wuiHttp-DgU5Jp47.js +0 -1
@@ -1 +1 @@
1
- import{t as e}from"./elementBase-BlsR4tqa.js";import{m as t,s as n,t as r}from"./formatters-BAE__8ye.js";import{c as i,o as a}from"./wuiHttp-DgU5Jp47.js";var o=`wui-remote-modal`,s=`wui-remote-drawer`,c=Object.freeze({sm:360,md:480,lg:640}),l=`wui-modal-fullscreen`,u=Object.freeze({sm:380,md:440,lg:640,xl:880}),d=Object.freeze({loading:`Loading`,close:`Close`,retry:`Try again`,errorTitle:`This could not be loaded`,forbidden:`You do not have access to this.`,client:`It may have been moved or deleted.`,server:`Something went wrong on our side. Try again in a moment.`,network:`Could not reach the server. Check your connection and try again.`,submitFailed:`Your changes were not saved.`,invalid:`Some fields need attention.`}),f=`a[href],button:not([disabled]),input:not([disabled]):not([type="hidden"]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`,p=`[aria-invalid="true"], .is-invalid, .input-validation-error`,m=`.wui-error-summary, [data-wui-form-errors], .validation-summary-errors, [data-valmsg-summary]`,h=`[data-wui-modal-content]`,g=`<button type="button" class="wui-modal-close" data-bs-dismiss="modal" aria-label="Close"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 6 6 18M6 6l12 12"></path></svg></button>`,_=new WeakMap,ee=new WeakSet,v=()=>Object.assign(Error(`The remote modal load was aborted.`),{name:`AbortError`}),te=e=>{let t=window.bootstrap?.Modal;if(!t)throw Error(`WUI.modal.load(${String(e)}): Bootstrap's bundle (window.bootstrap) is not loaded on this page.`);return t},y=e=>{let t=document.createElement(`span`);return t.textContent=e??``,t.innerHTML};function b(e){if(e==null||e===``)return null;if(e===`fullscreen`)return{fullscreen:!0};if(Object.hasOwn(u,e))return{px:u[e]};let t=typeof e==`number`?e:/^\d+$/.test(String(e))?Number(e):NaN;if(Number.isInteger(t)&&t>0)return{px:t};throw TypeError(`Unsupported modal size "${String(e)}". Use sm, md, lg, xl, fullscreen or a px number.`)}var ne=e=>{if(e.classList.contains(`wui-modal-fullscreen`))return{fullscreen:!0};let t=Number.parseInt(e.style.getPropertyValue(`--wui-modal-max-width`),10);return{px:t>0?t:u.md}},x=(e,t)=>{e.classList.toggle(l,!!t.fullscreen),t.fullscreen?e.style.removeProperty(`--wui-modal-max-width`):e.style.setProperty(`--wui-modal-max-width`,`${t.px}px`)},re=[`center`,`top`];function ie(e){if(Object.hasOwn(c,e??``))return{px:c[e]};let t=b(e);if(t?.fullscreen||e===`xl`)throw TypeError(`Unsupported drawer size "${String(e)}". Use sm, md, lg or a px number.`);return t}var ae=e=>e.container===`drawer`,oe=(e,t)=>ae(e)?ie(t):b(t);function se(e=`modal`){let t=e===`drawer`,n=t?s:o,r=document.getElementById(n);return r||(r=document.createElement(`div`),r.id=n,r.className=t?`modal fade wui-modal-shell wui-remote-drawer`:`modal fade wui-modal-shell`,r.tabIndex=-1,r.setAttribute(`aria-hidden`,`true`),r.setAttribute(`role`,`dialog`),r.setAttribute(`aria-modal`,`true`),r.style.setProperty(`--wui-modal-max-width`,`${t?c.md:u.md}px`),r.innerHTML=t?`<div class="modal-dialog wui-remote-drawer-dialog"><div class="modal-content wui-modal"></div></div>`:`<div class="modal-dialog modal-dialog-centered wui-rb-dialog"><div class="modal-content wui-modal"></div></div>`,document.body.appendChild(r),r)}var S=e=>`<div class="wui-modal-header"><div class="wui-modal-heading"><div class="wui-modal-headtext"><div class="wui-modal-title">${y(e)}</div></div></div>${g}</div>`,ce=e=>`<div class="modal-content wui-modal" aria-busy="true">${S(e)}<div class="wui-modal-body"><div class="wui-modal-loading" role="status"><span class="visually-hidden">${y(d.loading)}</span><div class="skeleton wui-modal-skeleton"></div><div class="skeleton wui-modal-skeleton"></div><div class="skeleton wui-modal-skeleton wui-modal-skeleton--short"></div></div></div></div>`,le=(e,t)=>`<div class="modal-content wui-modal" data-wui-modal-error="${y(t)}">${S(e)}<div class="wui-modal-body"><div class="wui-modal-state" role="alert"><p class="wui-modal-state-title">${y(d.errorTitle)}</p><p class="wui-modal-state-text">${y(d[t]||d.server)}</p><div class="wui-modal-state-actions"><button type="button" class="btn btn-secondary" data-bs-dismiss="modal">${y(d.close)}</button><button type="button" class="btn btn-primary" data-wui-modal-retry>${y(d.retry)}</button></div></div></div></div>`,C=e=>{let t=document.createElement(`template`);return t.innerHTML=e,t.content.querySelector(`.modal-content`)},w=e=>e.shell.querySelector(`.modal-content`);function ue(e){if(!e)return;e.dispatchEvent(new CustomEvent(`wui:teardown`,{bubbles:!0}));let t=window.bootstrap,n=[t?.Tooltip,t?.Popover,t?.Dropdown].filter(e=>e?.getInstance);for(let t of[e,...e.querySelectorAll(`*`)])for(let e of n)e.getInstance(t)?.dispose()}function T(e,t){let n=w(e);ue(n),n?n.replaceWith(t):e.shell.querySelector(`.modal-dialog`).appendChild(t),window.WUI?.refresh?.()}var E=e=>e.shell.classList.contains(`show`);function D(e,t){let n=t&&e.querySelector(p),r=n?n.matches(f)?n:n.querySelector(f)||n:null;if(!r){let t=[...e.querySelectorAll(f)];r=e.querySelector(`[data-autofocus]`)||t.find(e=>!e.classList.contains(`wui-modal-close`))||t[0]||e}r.focus?.()}function de(e,t){let n=e.shell.querySelector(`[data-wui-modal-live]`);n||(n=document.createElement(`div`),n.className=`visually-hidden`,n.setAttribute(`aria-live`,`assertive`),n.setAttribute(`data-wui-modal-live`,``),e.shell.querySelector(`.modal-dialog`).appendChild(n)),n.textContent=``,n.textContent=t}var fe=e=>{let t=e.shell.querySelector(`[data-wui-modal-live]`);t&&(t.textContent=``)},pe=(e,t,n)=>e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n}));function O(e,t,n,r){let i={...r,container:e.container};pe(t,`wui:modal:${n}`,i),ae(e)&&pe(t,`wui:drawer:${n}`,i)}function me(e){let t=_.get(e);return t||(t={shell:e,container:e.classList.contains(`wui-remote-drawer`)?`drawer`:`modal`,queue:a(),defaultSize:ne(e),defaultLabel:e.getAttribute(`aria-label`),placeholder:w({shell:e})?.outerHTML||`<div class="modal-content wui-modal"></div>`,remoteUrl:e.getAttribute(`data-wui-remote-url`),cache:e.getAttribute(`data-wui-remote-cache`)===`true`,loadedUrl:null,session:null},_.set(e,t),e.addEventListener(`submit`,e=>Se(t,e)),e.addEventListener(`click`,e=>{!e.target.closest?.(`[data-wui-modal-retry]`)||!t.session||(e.preventDefault(),A(t,t.session))}),e.addEventListener(`hidden.bs.modal`,n=>{n.target===e&&ge(t)}),e.addEventListener(`shown.bs.modal`,n=>{let r=w(t);n.target===e&&t.session&&r?.matches(h)&&!r.contains(document.activeElement)&&D(r,!1)}),t.remoteUrl&&e.addEventListener(`show.bs.modal`,n=>{n.target===e&&_e(t,n)}),t)}function he(e,t,n){e.session&&(e.queue.abort(),e.session.resolveClosed({status:`dismissed`,detail:{replaced:!0}}));let r,i=new Promise(e=>{r=e}),a={url:t,method:(n.method||`GET`).toUpperCase(),body:n.body,options:n,trigger:n.trigger||null,explicitSize:null,closing:null,resolveClosed:r,handle:null};return a.handle={el:e.shell,closed:i,close:()=>k(e,a,`dismissed`,null),reload:()=>A(e,a)},e.session=a,a}function k(e,t,n,r){e.session===t&&(t.closing={status:n,detail:r},window.bootstrap?.Modal?.getOrCreateInstance(e.shell).hide())}function ge(e){let t=e.session;if(e.queue.abort(),e.session=null,fe(e),t){let{status:n,detail:r}=t.closing||{status:`dismissed`,detail:null};t.resolveClosed({status:n,detail:r}),O(e,e.shell,`closed`,{status:n,url:t.url});let i=document.activeElement;t.trigger?.isConnected&&(!i||i===document.body||e.shell.contains(i))&&t.trigger.focus?.()}e.cache||(T(e,C(e.placeholder)),e.loadedUrl=null,x(e.shell,e.defaultSize),e.defaultLabel?e.shell.setAttribute(`aria-label`,e.defaultLabel):e.shell.removeAttribute(`aria-label`))}function _e(e,t){let n=t.relatedTarget instanceof Element?t.relatedTarget:null,r=n?.getAttribute(`data-wui-url`)||e.remoteUrl,i=he(e,r,{trigger:n});i.explicitSize=ve(e,n?.getAttribute(`data-wui-size`)),i.explicitSize&&x(e.shell,i.explicitSize),!(e.cache&&e.loadedUrl===r)&&(e.loadedUrl&&T(e,C(e.placeholder)),A(e,i,{keepPlaceholder:!0}))}function ve(e,t){try{return oe(e,t)}catch(e){return console.error(e),null}}async function A(e,t,{keepPlaceholder:n=!1}={}){n||T(e,C(ce(t.options.title||j(e))));let r=await e.queue.run(t.url,{method:t.method,body:t.body,navigate:t.options.navigate});if(e.session!==t||r.kind===`aborted`||r.kind===`stale`)return`aborted`;if(r.kind===`session`)return`session`;if((r.kind===`ok`||r.kind===`validation`)&&M(e,t,r.html,!1))return e.loadedUrl=t.url,O(e,e.shell,`loaded`,{url:t.url,handle:t.handle}),`loaded`;let i=r.kind===`ok`||r.kind===`validation`?`server`:r.kind;return T(e,C(le(t.options.title||j(e),i))),E(e)&&D(w(e),!1),O(e,e.shell,`error`,{url:t.url,kind:i,status:r.status}),`error`}var j=e=>w(e)?.querySelector(`.wui-modal-title`)?.textContent||e.shell.getAttribute(`aria-label`)||``;function M(e,t,n,r){let i=document.createElement(`template`);i.innerHTML=n;let a=i.content.querySelectorAll(`script`);if(a.length){console.warn(`WUI.modal: ${t.url} returned a fragment with script; it was removed. Keep page behaviour in the page.`);for(let e of a)e.remove()}let o=i.content.querySelector(h);if(!o)return console.error(`WUI.modal: ${t.url} did not answer with an <app-modal-content> fragment.`),!1;T(e,o),r||fe(e),x(e.shell,t.explicitSize||ve(e,o.getAttribute(`data-wui-size`))||e.defaultSize);let s=o.getAttribute(`data-wui-title`);return s&&e.shell.setAttribute(`aria-label`,s),E(e)&&D(o,r),!0}var ye=`button[type="submit"], button:not([type]), input[type="submit"], input[type="image"]`;function N(e,t,n){let r=[...e.elements].filter(e=>e.matches(ye));if(n){e.setAttribute(`data-wui-submitting`,``);let n=t&&r.includes(t)?t:r[0];for(let e of r)e.toggleAttribute(`data-wui-was-disabled`,e.disabled),e.disabled=!0;n&&(n.classList.add(`is-loading`),n.setAttribute(`aria-busy`,`true`),n.tagName===`BUTTON`&&n.insertAdjacentHTML(`afterbegin`,`<span class="spinner-border spinner-border-sm me-2" aria-hidden="true" data-wui-submit-spinner></span>`));return}e.removeAttribute(`data-wui-submitting`);for(let e of r)e.disabled=e.hasAttribute(`data-wui-was-disabled`),e.removeAttribute(`data-wui-was-disabled`),e.classList.remove(`is-loading`),e.removeAttribute(`aria-busy`),e.querySelector(`[data-wui-submit-spinner]`)?.remove()}function be(e,t,n){let r=t.closest(`.wui-modal-body`)||t;r.querySelector(`[data-wui-modal-submit-error]`)?.remove();let i=document.createElement(`div`);i.className=`alert alert-danger wui-modal-submit-error`,i.setAttribute(`role`,`alert`),i.setAttribute(`data-wui-modal-submit-error`,``),i.textContent=`${d.submitFailed} ${d[n]||d.server}`,r.prepend(i),de(e,i.textContent)}var xe=(e,t)=>{let n=new URL(e,window.location.href);for(let[e,r]of t)typeof r==`string`&&n.searchParams.append(e,r);return n.origin===window.location.origin?n.pathname+n.search:n.href};async function Se(e,t){let n=t.target,r=e.session;if(!(n instanceof HTMLFormElement)||!r||n.hasAttribute(`data-wui-native`)||!n.closest(h)||(t.preventDefault(),n.hasAttribute(`data-wui-submitting`)))return;let i=t.submitter||null,a=i?.getAttribute(`formaction`)||n.getAttribute(`action`)||r.url,o=(i?.getAttribute(`formmethod`)||n.getAttribute(`method`)||`GET`).toUpperCase(),s=new FormData(n);i?.name&&!s.has(i.name)&&s.append(i.name,i.value);let c=o===`GET`;N(n,i,!0);let l=await e.queue.run(c?xe(a,s):a,{method:o,body:c?void 0:s,navigate:r.options.navigate});if(e.session===r){if(n.isConnected&&N(n,i,!1),l.kind===`ok`&&l.result===`success`){Ce(e,r,l);return}if(!(l.kind===`aborted`||l.kind===`stale`||l.kind===`session`)){if(l.kind===`validation`&&M(e,r,l.html,!0)){let t=w(e).querySelector(m)?.textContent.replace(/\s+/g,` `).trim();de(e,t||d.invalid);return}l.kind===`ok`&&l.html&&M(e,r,l.html,!1)||be(e,n,l.kind===`ok`||l.kind===`validation`?`server`:l.kind)}}}function Ce(e,t,n){let r=n.message,i=n.redirect||null,a={url:t.url,trigger:t.trigger,handle:t.handle,message:r,redirect:i,data:n.data??null,container:e.container};if(r&&window.WUI?.toast?.(r,{variant:`success`}),O(e,t.trigger?.isConnected?t.trigger:document,`success`,a),t.options.onSuccess?.(a,t.handle),i&&(t.options.navigate||(e=>window.location.assign(e)))(i),n.next&&!i){t.url=n.next,t.method=`GET`,t.body=void 0,A(e,t);return}if(n.keepOpen){n.html&&M(e,t,n.html,!1);return}k(e,t,`success`,a)}function we(e){let t=e.target.closest?.(`[data-wui-modal], [data-wui-drawer]`);if(t&&!(t.matches(`a[href]`)&&(e.ctrlKey||e.metaKey||e.shiftKey||e.button!==0))){if(e.preventDefault(),!t.hasAttribute(`data-wui-modal`)){I(t.getAttribute(`data-wui-drawer`),{size:t.getAttribute(`data-wui-drawer-size`)||void 0,title:t.getAttribute(`data-wui-title`)||void 0,trigger:t}).catch(e=>{e?.name!==`AbortError`&&console.error(e)});return}F(t.getAttribute(`data-wui-modal`),{size:t.getAttribute(`data-wui-size`)||void 0,title:t.getAttribute(`data-wui-title`)||void 0,trigger:t}).catch(e=>{e?.name!==`AbortError`&&console.error(e)})}}function P(e=document){let t=e.ownerDocument||e;ee.has(t)||(ee.add(t),t.addEventListener(`click`,we));let n=[...e.querySelectorAll?.(`.modal[data-wui-remote-url]`)||[]];e.matches?.(`.modal[data-wui-remote-url]`)&&n.unshift(e);for(let e of n)me(e)}function F(e,t={}){try{if(!e)throw TypeError(`WUI.modal.load: a fragment url is required.`);let n=te(e),r=t.container===`drawer`,i=r?ie(t.size):b(t.size),a=t.placement||`center`;if(!re.includes(a))throw TypeError(`WUI.modal.load: unsupported placement "${a}". Use center or top.`);if(t.signal?.aborted)return Promise.reject(v());let o=se(r?`drawer`:`modal`);P(document);let s=me(o),c=E(s),l=he(s,e,t);l.explicitSize=i,x(o,i||s.defaultSize),r||o.querySelector(`.modal-dialog`).classList.toggle(`modal-dialog-centered`,a===`center`),t.title&&o.setAttribute(`aria-label`,t.title),c||(n.getInstance(o)?.dispose(),n.getOrCreateInstance(o,{backdrop:!t.staticBackdrop||`static`,keyboard:!t.staticBackdrop}));let u=c?Promise.resolve():new Promise(e=>o.addEventListener(`shown.bs.modal`,()=>e(),{once:!0})),d=A(s,l);c||n.getOrCreateInstance(o).show();let f=new Promise((e,n)=>{t.signal?.addEventListener(`abort`,()=>{s.session===l&&(s.queue.abort(),k(s,l,`dismissed`,{aborted:!0})),n(v())},{once:!0})}),p=Promise.all([u,d]).then(([,t])=>{if(t===`aborted`)throw v();if(t===`session`)throw Error(`WUI.modal.load(${e}): the session expired; the browser is signing in again.`);return l.handle});return Promise.race([p,f])}catch(e){return Promise.reject(e)}}function I(e,t={}){return F(e,{...t,container:`drawer`,placement:void 0})}var Te=Object.freeze([`neutral`,`primary`,`info`,`success`,`warning`,`danger`]),L=Object.freeze([`number`,`currency`,`compact`]),Ee=`wui-kanban:`,De=`(max-width: 767.98px)`,Oe=400,ke=6,R=Object.freeze({help:`Press Space to pick up the card. Use the Left and Right arrow keys to choose a column, then Space to drop it, or Escape to cancel.`,empty:`Nothing here`,collapse:e=>`Collapse ${e}`,expand:e=>`Expand ${e}`,lifted:(e,t)=>`Picked up ${e} in ${t}. Use the Left and Right arrow keys to choose a column.`,over:(e,t)=>`${e}, ${t===1?`1 card`:`${t} cards`}. Drop allowed.`,overSource:e=>`${e}, where the card started.`,overRefused:(e,t)=>`${e}. ${t}`,dropHere:(e,t)=>`Drop here to move ${e} to ${t}.`,refused:(e,t)=>`Cards in ${e} cannot move to ${t}.`,moved:(e,t)=>`Moved ${e} to ${t}.`,saving:(e,t)=>`Moving ${e} to ${t}.`,cancelled:e=>`${e} was not moved.`,rolledBack:(e,t)=>`${e} went back to ${t}.`,locked:e=>`${e} cannot be moved.`,more:e=>`Show ${e} more`,fewer:`Show fewer`,swipeHint:`Swipe sideways or tap a column`,busy:`This card is still saving. Try again in a moment.`,failed:Object.freeze({forbidden:`You do not have permission to move this card.`,client:`This card could not be moved. Refresh the board and try again.`,validation:`This card could not be moved. Refresh the board and try again.`,server:`Something went wrong on our side, so the card went back. Try again in a moment.`,network:`Could not reach the server, so the card went back. Check your connection and try again.`})}),z=`[data-wui-column]`,B=`[data-wui-body]`,V=`[data-wui-card]`,Ae=`[data-wui-count]`,je=`[data-wui-summary]`,Me=`[data-wui-empty]`,Ne=`[data-wui-drop-note]`,Pe=`[data-wui-live]`,Fe=`[data-wui-help]`,H=`[data-wui-switch]`,Ie=`[data-wui-scroller]`,Le=`[data-wui-collapse]`,Re=`[data-wui-more]`,ze=`data-wui-visible-limit`,U=`data-wui-overflow`,Be=`input, select, textarea, [contenteditable=""], [contenteditable="true"], [data-wui-no-drag]`,W=48,G=16,K=e=>e.getAttribute(`data-wui-column`),q=e=>e.getAttribute(`data-wui-card`),J=e=>e.hidden||e.hasAttribute(`hidden`),Ve=e=>J(e)||e.hasAttribute(U);function Y(e){if(e==null||e===``)return null;let t=typeof e==`number`?e:Number(e);if(!Number.isInteger(t)||t<1)throw TypeError(`Unsupported kanban visible limit "${String(e)}". Use a whole number of 1 or more.`);return t}function He(e,t,n,r){let i=new Set;if(t==null||n)return i;let a=0;for(let n of e)r.has(n)||(a<t?a++:i.add(n));return i}function X(e){let t=(e.getAttribute(`aria-label`)||e.textContent||``).replace(/\s+/g,` `).trim();return t.length>80?`${t.slice(0,79)}…`:t||q(e)||`Card`}function Z(e){return e?`${Ee}${e}`:null}function Q(e,t=globalThis.localStorage){let n=Z(e);if(!n||!t)return{};try{let e=JSON.parse(t.getItem(n)||`null`);return e&&typeof e.collapsed==`object`&&e.collapsed?e.collapsed:{}}catch{return{}}}function Ue(e,t,n,r=globalThis.localStorage){let i=Z(e);if(!i||!r)return;let a={...Q(e,r),[t]:!!n};try{r.setItem(i,JSON.stringify({collapsed:a}))}catch{}}function We(e,t){if(!L.includes(e))throw TypeError(`Unsupported kanban summary format "${String(e)}". Use ${L.join(`, `)}.`);if(t!=null&&t!==``&&!n.includes(t))throw TypeError(`Unsupported kanban summary unit "${String(t)}". Use ${n.join(`, `)}.`);return e===`currency`?{style:`currency`,unit:t||`rupees`}:e===`compact`?{style:`compact`,currency:r[0],unit:t||`rupees`}:{style:`number`,decimals:0}}function Ge(e){let t=0;for(let n of e){if(n==null||n===``)continue;let e=typeof n==`number`?n:Number(n);Number.isFinite(e)&&(t+=e)}return t}var $=(e,t)=>{e&&window.WUI?.toast?.(e,{variant:t})},Ke=class extends e{constructor(){super(),this._wired=!1,this._filter=null,this._expanded=new Set,this._revealed=new Set,this._press=null,this._drag=null,this._kbd=null,this._suppressClick=!1,this._observer=null,this._refreshQueued=!1,this._scrollTimer=0,this._onPointerMove=e=>this._pointerMove(e),this._onPointerUp=e=>this._pointerUp(e),this._onPointerCancel=()=>this._endPointer(!1),this._onDocKeyDown=e=>{e.key===`Escape`&&this._drag&&(e.preventDefault(),this._endPointer(!1))},this._onScroll=()=>{clearTimeout(this._scrollTimer),this._scrollTimer=setTimeout(()=>this._syncSwitcherFromScroll(),80)}}_controlled(){return this.hasAttribute(`controlled`)}connectedCallback(){if(!this._wired){this._wired=!0,this.addEventListener(`pointerdown`,e=>this._pointerDown(e)),this.addEventListener(`keydown`,e=>this._keyDown(e)),this.addEventListener(`click`,e=>this._click(e),!0),this.addEventListener(`dragstart`,e=>{e.target.closest?.(V)&&e.preventDefault()}),this.addEventListener(`touchmove`,e=>{this._drag&&e.preventDefault()},{passive:!1}),this._scroller()?.addEventListener(`scroll`,this._onScroll,{passive:!0}),this._restoreCollapsed();for(let e of this._allCards())this._prepareCard(e);if(typeof MutationObserver==`function`){this._observer=new MutationObserver(e=>{for(let t of e)for(let e of t.addedNodes)e.nodeType===1&&e.matches(V)&&this._prepareCard(e);this._queueRefresh()});for(let e of this.querySelectorAll(B))this._observer.observe(e,{childList:!0})}this.refresh()}}disconnectedCallback(){this._endPointer(!1),this._observer?.disconnect(),this._observer=null,this._scroller()?.removeEventListener(`scroll`,this._onScroll),clearTimeout(this._scrollTimer),this._wired=!1}setFilter(e){if(e!=null&&typeof e!=`function`)throw TypeError(`wui-kanban setFilter: pass a function or null.`);if(this._filter=e,!e)for(let e of this._allCards())e.hidden=!1;this.refresh()}refresh(){if(this._controlled())return;this._refreshQueued=!1;let e=this._summaryFormat();for(let n of this._columns()){let r=K(n),i=Y(n.getAttribute(ze)),a=[],o=[];for(let e of this._cardsIn(n)){if(this._filter&&(e.hidden=this._filter(e)===!1),J(e)){e.removeAttribute(U);continue}a.push(e),o.push(e.getAttribute(`data-wui-value`))}let s=this._expanded.has(r),c=He(a.map(q),i,s,this._revealed);for(let e of a)e.toggleAttribute(U,c.has(q(e)));let l=String(a.length);for(let e of this._countsOf(n))e.textContent!==l&&(e.textContent=l);let u=n.querySelector(Me);if(u&&(u.hidden=a.length>0),e){let r=n.querySelector(je);r&&(r.textContent=t(Ge(o),e))}let d=n.querySelector(Re);if(d){d.hidden=i==null||(s?a.length<=i:c.size===0),d.setAttribute(`aria-expanded`,s?`true`:`false`);let e=s?R.fewer:R.more(c.size);d.textContent!==e&&(d.textContent=e)}}}moveCard(e,t,n){let r=this._cardByKey(e);if(!r)throw Error(`wui-kanban moveCard: no card "${String(e)}" on this board.`);if(!this._columnByKey(t))throw Error(`wui-kanban moveCard: no column "${String(t)}" on this board.`);return this._commit(r,t,n)}_columns(){return[...this.querySelectorAll(z)]}_columnByKey(e){return this._columns().find(t=>K(t)===e)||null}_columnOf(e){return e.closest(z)}_titleOf(e){return(e.querySelector(`.wui-kanban-title`)?.textContent||K(e)||``).replace(/\s+/g,` `).trim()}_bodyOf(e){return e.querySelector(B)}_cardsIn(e){let t=this._bodyOf(e);return t?[...t.children].filter(e=>e.matches(V)):[]}_visibleCardsIn(e){return this._cardsIn(e).filter(e=>!Ve(e))}_allCards(){return[...this.querySelectorAll(`${B} > ${V}`)]}_cardByKey(e){return this._allCards().find(t=>q(t)===e)||null}_countsOf(e){let t=K(e),n=[...this.querySelectorAll(H)].filter(e=>e.getAttribute(`data-wui-switch`)===t);return[...e.querySelectorAll(Ae),...n.flatMap(e=>[...e.querySelectorAll(Ae)])]}_scroller(){return this.querySelector(Ie)}_summaryFormat(){let e=this.getAttribute(`summary-format`);return e?We(e,this.getAttribute(`summary-unit`)):null}_queueRefresh(){this._refreshQueued||(this._refreshQueued=!0,queueMicrotask(()=>{this._refreshQueued&&this.refresh()}))}_prepareCard(e){let t=this.querySelector(Fe);t?.id&&!e.hasAttribute(`aria-describedby`)&&e.setAttribute(`aria-describedby`,t.id),e.hasAttribute(`tabindex`)||(e.tabIndex=0)}_announce(e){let t=this.querySelector(Pe);!t||!e||(t.textContent=``,t.textContent=e)}_fire(e,t,n=!1){return this.dispatchEvent(new CustomEvent(e,{bubbles:!0,cancelable:n,detail:t}))}_canLift(e){let t=X(e),n=this.hasAttribute(`readonly`);return n||e.hasAttribute(`data-wui-locked`)?(this._announce(R.locked(t)),this._fire(`wui:kanban:locked`,{key:q(e),card:e,reason:n?`readonly`:`locked`},!0),!1):e.getAttribute(`aria-busy`)===`true`?(this._announce(R.busy),$(R.busy,`info`),!1):!0}_check(e,t,n){if(t===n)return{ok:!1,source:!0,reason:null};let r=this._columnByKey(t),i=this._columnByKey(n),a=R.refused(r?this._titleOf(r):t,i?this._titleOf(i):n),o=i?.getAttribute(`data-accept-from`);if(o!=null&&!o.split(/\s+/).filter(Boolean).includes(t))return{ok:!1,reason:a};if(typeof this.accept==`function`){let r=this.accept(e,t,n);if(r===!1)return{ok:!1,reason:a};if(typeof r==`string`&&r)return{ok:!1,reason:r}}return{ok:!0,reason:null}}_markTargets(e,t){let n=X(e),r=new Map;for(let i of this._columns()){let a=K(i),o=this._check(e,t,a);r.set(a,o),i.setAttribute(`data-wui-drop`,o.source?`source`:o.ok?`ok`:`refused`);let s=i.querySelector(Ne);s&&!o.source&&(s.textContent=o.ok?R.dropHere(n,this._titleOf(i)):o.reason,s.hidden=!1)}return r}_clearTargets(){for(let e of this._columns()){e.removeAttribute(`data-wui-drop`),e.removeAttribute(`data-wui-over`),e.removeAttribute(`data-wui-target`);let t=e.querySelector(Ne);t&&(t.hidden=!0,t.textContent=``)}}async _commit(e,t,n){let r=this._columnOf(e),a=K(r),o=this._columnByKey(t),s=X(e);if(a===t||!this._canLift(e))return!1;let c=this._check(e,a,t);if(!c.ok)return this._announce(c.reason),$(c.reason,`info`),!1;let l=this._cardsIn(o),u=Number.isInteger(n)?Math.max(0,Math.min(n,l.length)):l.length,d={key:q(e),card:e,from:a,to:t,index:u},f=e.contains(document.activeElement);if(this._controlled())return this._fire(`wui:kanban:move`,d),this._announce(R.moved(s,this._titleOf(o))),f&&this._refocusSoon(d.key),!0;if(!this._fire(`wui:kanban:move`,d,!0))return!1;let p=o.hasAttribute(ze)&&!this._revealed.has(d.key);p&&this._revealed.add(d.key);let m={parent:e.parentNode,next:e.nextSibling,column:r,revealed:p};this._bodyOf(o).insertBefore(e,l[u]||null),f&&this._focusMoved(e),this.refresh();let h=o.getAttribute(`data-wui-step`);if(h)return this._runStep(e,d,m,h,o.getAttribute(`data-wui-step-size`));let g=this.getAttribute(`move-url`);if(!g)return this._announce(R.moved(s,this._titleOf(o))),this._fire(`wui:kanban:moved`,{...d,result:null}),!0;this._lock(e,!0),this._announce(R.saving(s,this._titleOf(o)));let _=await i(g,{method:`POST`,body:new URLSearchParams({card:d.key,from:a,to:t,index:String(u)})});if(this._lock(e,!1),_.kind===`session`)return!1;if(_.ok){let t=this._applyFragment(_.html)||e;return $(_.message,`success`),this._announce(R.moved(X(t),this._titleOf(o))),this._fire(`wui:kanban:moved`,{...d,card:t,result:_}),!0}return this._rollback(e,m),_.kind!==`aborted`&&$(_.message||R.failed[_.kind]||R.failed.server,`danger`),this._fire(`wui:kanban:failed`,{...d,kind:_.kind,status:_.status,message:_.message}),!1}async _runStep(e,t,n,r,a){let o=X(e),s=this._columnByKey(t.to),c=new URLSearchParams({card:t.key,from:t.from,to:t.to}).toString(),l=r+(r.includes(`?`)?`&`:`?`)+c;this._lock(e,!0);let u;try{u=await(await F(l,{trigger:e,size:a||void 0})).closed}catch(r){return this._lock(e,!1),this._rollback(e,n),r?.name!==`AbortError`&&$(R.failed.server,`danger`),this._fire(`wui:kanban:failed`,{...t,kind:`step`,status:0,message:r?.message??null}),!1}if(u?.status!==`success`)return this._lock(e,!1),this._rollback(e,n),this._announce(R.cancelled(o)),this._fire(`wui:kanban:failed`,{...t,kind:`dismissed`,status:0,message:null}),!1;let d=e,f=this.getAttribute(`card-url`);if(f){let n=await i(`${f}${f.includes(`?`)?`&`:`?`}${new URLSearchParams({card:t.key})}`);n.ok&&(d=this._applyFragment(n.html)||e)}return this._lock(d,!1),this._announce(R.moved(X(d),this._titleOf(s))),this._fire(`wui:kanban:moved`,{...t,card:d,result:u}),!0}_lock(e,t){t?(e.setAttribute(`aria-busy`,`true`),e.setAttribute(`data-wui-saving`,``)):(e.removeAttribute(`aria-busy`),e.removeAttribute(`data-wui-saving`))}_rollback(e,t){let n=e.contains(document.activeElement),r=t.next&&t.next.parentNode===t.parent?t.next:null;t.revealed&&this._revealed.delete(q(e)),t.parent.insertBefore(e,r),n&&e.focus(),this.refresh(),this._announce(R.rolledBack(X(e),this._titleOf(t.column)))}_applyFragment(e){if(!e)return null;let t=document.createElement(`template`);t.innerHTML=e;for(let e of t.content.querySelectorAll(`script`))console.warn(`[@webority/ui-elements] A kanban fragment carried a script tag; it was removed, not run.`),e.remove();let n=null;for(let e of[...t.content.querySelectorAll(V)]){if(e.closest(`template`))continue;let t=this._cardByKey(q(e));if(!t)continue;let r=t.contains(document.activeElement);t.dispatchEvent(new CustomEvent(`wui:teardown`,{bubbles:!0})),t.hidden&&(e.hidden=!0),t.replaceWith(e),this._prepareCard(e),r&&e.focus(),n??=e}for(let e of t.content.querySelectorAll(`template[data-wui-kanban-summary]`))this._columnByKey(e.getAttribute(`data-wui-kanban-summary`))?.querySelector(je)?.replaceChildren(e.content.cloneNode(!0));return this.refresh(),window.WUI?.refresh?.(),n}_refocusSoon(e){let t=()=>{let t=this._cardByKey(e);t&&this._focusMoved(t)};typeof requestAnimationFrame==`function`?requestAnimationFrame(t):setTimeout(t,0)}_focusMoved(e){e.focus({preventScroll:!0}),e.scrollIntoView?.({block:`nearest`})}_pointerDown(e){if(e.button!==0||e.isPrimary===!1||this._drag||this._kbd)return;let t=e.target.closest?.(V);if(!t||!this.contains(t)||e.target.closest(Be))return;let n={card:t,id:e.pointerId,x:e.clientX,y:e.clientY,type:e.pointerType,timer:0};this._press=n,e.pointerType===`touch`&&(n.timer=setTimeout(()=>{this._press===n&&this._startDrag(n,n.x,n.y)},400)),window.addEventListener(`pointermove`,this._onPointerMove),window.addEventListener(`pointerup`,this._onPointerUp),window.addEventListener(`pointercancel`,this._onPointerCancel)}_pointerMove(e){let t=this._press;if(!(!t||e.pointerId!==t.id)){if(!this._drag){if(!(Math.hypot(e.clientX-t.x,e.clientY-t.y)>6))return;if(t.type===`touch`){this._endPointer(!1);return}if(this._startDrag(t,e.clientX,e.clientY),!this._drag)return}this._dragTo(e.clientX,e.clientY)}}_pointerUp(e){!this._press||e.pointerId!==this._press.id||this._endPointer(!!this._drag)}_startDrag(e,t,n){let r=e.card;if(!this._canLift(r)){this._endPointer(!1);return}let i=K(this._columnOf(r)),a=r.getBoundingClientRect(),o=r.cloneNode(!0);for(let e of[o,...o.querySelectorAll(`[id]`)])e.removeAttribute(`id`);o.removeAttribute(`data-wui-card`),o.removeAttribute(`tabindex`),o.setAttribute(`aria-hidden`,`true`),o.classList.add(`wui-kanban-ghost`),o.style.width=`${a.width}px`,this.appendChild(o),r.setAttribute(`data-wui-dragging`,``),this.setAttribute(`data-wui-dragging`,``),this._drag={card:r,from:i,ghost:o,dx:t-a.left,dy:n-a.top,over:null,verdicts:this._markTargets(r,i)},this._announce(R.lifted(X(r),this._titleOf(this._columnOf(r)))),document.addEventListener(`keydown`,this._onDocKeyDown),this._dragTo(t,n)}_dragTo(e,t){let n=this._drag;n.x=e,n.y=t,n.ghost.style.transform=`translate(${e-n.dx}px, ${t-n.dy}px)`;let r=this._columnAt(e,t);r!==n.over&&(n.over?.removeAttribute(`data-wui-over`),r?.setAttribute(`data-wui-over`,``),n.over=r),this._autoScroll(e,t,r)}_columnAt(e,t){for(let n of this._columns()){let r=n.getBoundingClientRect();if(e>=r.left&&e<=r.right&&t>=r.top&&t<=r.bottom)return n}return null}_indexAt(e,t){let n=this._visibleCardsIn(e).filter(e=>e!==this._drag?.card).find(e=>{let n=e.getBoundingClientRect();return t<n.top+n.height/2}),r=this._cardsIn(e).filter(e=>e!==this._drag?.card);return n?r.indexOf(n):r.length}_autoScroll(e,t,n){let r=this._scroller();if(r){let t=r.getBoundingClientRect();t.width>0&&(e<t.left+W?r.scrollBy?.({left:-16}):e>t.right-W&&r.scrollBy?.({left:G}))}if(n&&this._scrollColumn(n,t))return;let i=window.innerHeight||0;i>0&&(t<W?window.scrollBy?.({top:-16}):t>i-W&&window.scrollBy?.({top:G}))}_scrollColumn(e,t){let n=this._bodyOf(e);if(!n||e.hasAttribute(`data-collapsed`)||n.scrollHeight<=n.clientHeight)return!1;let r=n.getBoundingClientRect();return t<r.top+W&&n.scrollTop>0?(n.scrollBy?.({top:-16}),!0):t>r.bottom-W&&n.scrollTop+n.clientHeight<n.scrollHeight-1?(n.scrollBy?.({top:G}),!0):!1}_endPointer(e){let t=this._press,n=this._drag;if(t&&clearTimeout(t.timer),this._press=null,this._drag=null,window.removeEventListener(`pointermove`,this._onPointerMove),window.removeEventListener(`pointerup`,this._onPointerUp),window.removeEventListener(`pointercancel`,this._onPointerCancel),document.removeEventListener(`keydown`,this._onDocKeyDown),!n)return;n.ghost.remove(),n.card.removeAttribute(`data-wui-dragging`),this.removeAttribute(`data-wui-dragging`),this._suppressClick=!0,setTimeout(()=>{this._suppressClick=!1},0);let r=n.over;if(this._clearTargets(),!e||!r){this._announce(R.cancelled(X(n.card)));return}let i=K(r),a=n.verdicts.get(i);if(a?.source){this._announce(R.cancelled(X(n.card)));return}if(!a?.ok){this._announce(a?.reason),$(a?.reason,`info`);return}this._commit(n.card,i,this._indexAt(r,n.y))}_click(e){if(this._suppressClick&&e.target.closest?.(V)){e.preventDefault(),e.stopPropagation(),this._suppressClick=!1;return}let t=e.target.closest?.(Le);if(t&&this.contains(t)){let e=t.closest(z);e&&this._setCollapsed(e,!e.hasAttribute(`data-collapsed`),!0);return}let n=e.target.closest?.(Re);if(n&&this.contains(n)){this._controlled()||this._toggleMore(n.closest(z));return}let r=e.target.closest?.(H);r&&this.contains(r)&&this._showColumn(r.getAttribute(`data-wui-switch`))}_keyDown(e){if(this._kbd){this._liftedKey(e);return}let t=e.target;if(!t.matches?.(V)||!this.contains(t))return;let n=this._columnOf(t);switch(e.key){case` `:case`Spacebar`:{if(e.preventDefault(),!this._canLift(t))return;let r=K(n),i=this._columns();this._kbd={card:t,from:r,target:i.indexOf(n),verdicts:this._markTargets(t,r)},t.setAttribute(`data-wui-lifted`,``),this.setAttribute(`data-wui-dragging`,``),n.setAttribute(`data-wui-target`,``),this._announce(R.lifted(X(t),this._titleOf(n)));return}case`ArrowDown`:case`ArrowUp`:{let r=this._visibleCardsIn(n),i=r[r.indexOf(t)+(e.key===`ArrowDown`?1:-1)];i&&(e.preventDefault(),i.focus());return}case`ArrowLeft`:case`ArrowRight`:{let t=this._columns(),r=e.key===`ArrowRight`?1:-1;for(let i=t.indexOf(n)+r;i>=0&&i<t.length;i+=r){let n=this._visibleCardsIn(t[i])[0];if(n&&!t[i].hasAttribute(`data-collapsed`)){e.preventDefault(),n.focus();return}}return}default:}}_liftedKey(e){let t=this._kbd,n=this._columns();switch(e.key){case`ArrowLeft`:case`ArrowRight`:{e.preventDefault();let r=t.target+(e.key===`ArrowRight`?1:-1);if(r<0||r>=n.length)return;n[t.target]?.removeAttribute(`data-wui-target`),t.target=r;let i=n[r];i.setAttribute(`data-wui-target`,``),this._showColumn(K(i),!1);let a=t.verdicts.get(K(i)),o=this._titleOf(i);this._announce(a.source?R.overSource(o):a.ok?R.over(o,this._cardsIn(i).filter(e=>!J(e)).length):R.overRefused(o,a.reason));return}case` `:case`Spacebar`:case`Enter`:{e.preventDefault();let r=n[t.target],i=K(r),a=t.verdicts.get(i);if(!a.source&&!a.ok){this._announce(a.reason);return}this._endKeyboard(),a.source?this._announce(R.cancelled(X(t.card))):this._commit(t.card,i);return}case`Escape`:case`Tab`:e.key===`Escape`&&e.preventDefault(),this._endKeyboard(),this._showColumn(t.from,!1),this._announce(R.cancelled(X(t.card)));return;default:}}_endKeyboard(){let e=this._kbd;this._kbd=null,e&&(e.card.removeAttribute(`data-wui-lifted`),this.removeAttribute(`data-wui-dragging`),this._clearTargets())}_restoreCollapsed(){let e=Q(this.getAttribute(`board-id`));for(let t of this._columns()){let n=K(t);t.hasAttribute(`data-collapsible`)&&Object.hasOwn(e,n)&&this._setCollapsed(t,e[n],!1)}}_setCollapsed(e,t,n){let r=K(e);e.toggleAttribute(`data-collapsed`,t);let i=this._titleOf(e);for(let n of e.querySelectorAll(Le))n.setAttribute(`aria-expanded`,t?`false`:`true`),n.setAttribute(`aria-label`,t?R.expand(i):R.collapse(i));n&&(Ue(this.getAttribute(`board-id`),r,t),this._fire(`wui:kanban:collapse`,{column:r,collapsed:t}))}_toggleMore(e){if(!e)return;let t=K(e);if(this._expanded.delete(t))for(let t of this._cardsIn(e))this._revealed.delete(q(t));else this._expanded.add(t);this.refresh()}_isPhone(){return typeof matchMedia==`function`&&matchMedia(`(max-width: 767.98px)`).matches}_showColumn(e,t=!0){for(let t of this.querySelectorAll(H))t.getAttribute(`data-wui-switch`)===e?t.setAttribute(`aria-current`,`true`):t.removeAttribute(`aria-current`);let n=this._columnByKey(e),r=this._scroller();if(!n||!r||!t&&!this._isPhone())return;let i=typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches;r.scrollTo?.({left:n.offsetLeft-r.offsetLeft,behavior:i?`auto`:`smooth`})}_syncSwitcherFromScroll(){let e=this._scroller();if(!e||!this._isPhone())return;let t=e.clientWidth||1,n=this._columns()[Math.round(e.scrollLeft/t)];if(n)for(let e of this.querySelectorAll(H))e.getAttribute(`data-wui-switch`)===K(n)?e.setAttribute(`aria-current`,`true`):e.removeAttribute(`aria-current`)}};export{u as _,L as a,F as b,Ke as c,Z as d,We as f,Ue as g,Ge as h,Ee as i,X as l,Q as m,Oe as n,R as o,Y as p,De as r,Te as s,ke as t,He as u,P as v,I as y};
1
+ import{t as e}from"./elementBase-BlsR4tqa.js";import{m as t,s as n,t as r}from"./formatters-BAE__8ye.js";import{c as i,o as a}from"./wuiHttp-0pGmgUIV.js";var o=`wui-remote-modal`,s=`wui-remote-drawer`,c=Object.freeze({sm:360,md:480,lg:640}),l=`wui-modal-fullscreen`,u=Object.freeze({sm:380,md:440,lg:640,xl:880}),d=Object.freeze({loading:`Loading`,close:`Close`,retry:`Try again`,errorTitle:`This could not be loaded`,forbidden:`You do not have access to this.`,client:`It may have been moved or deleted.`,server:`Something went wrong on our side. Try again in a moment.`,network:`Could not reach the server. Check your connection and try again.`,submitFailed:`Your changes were not saved.`,invalid:`Some fields need attention.`}),f=`a[href],button:not([disabled]),input:not([disabled]):not([type="hidden"]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`,p=`[aria-invalid="true"], .is-invalid, .input-validation-error`,m=`.wui-error-summary, [data-wui-form-errors], .validation-summary-errors, [data-valmsg-summary]`,h=`[data-wui-modal-content]`,g=`<button type="button" class="wui-modal-close" data-bs-dismiss="modal" aria-label="Close"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 6 6 18M6 6l12 12"></path></svg></button>`,_=new WeakMap,ee=new WeakSet,v=()=>Object.assign(Error(`The remote modal load was aborted.`),{name:`AbortError`}),te=e=>{let t=window.bootstrap?.Modal;if(!t)throw Error(`WUI.modal.load(${String(e)}): Bootstrap's bundle (window.bootstrap) is not loaded on this page.`);return t},y=e=>{let t=document.createElement(`span`);return t.textContent=e??``,t.innerHTML};function b(e){if(e==null||e===``)return null;if(e===`fullscreen`)return{fullscreen:!0};if(Object.hasOwn(u,e))return{px:u[e]};let t=typeof e==`number`?e:/^\d+$/.test(String(e))?Number(e):NaN;if(Number.isInteger(t)&&t>0)return{px:t};throw TypeError(`Unsupported modal size "${String(e)}". Use sm, md, lg, xl, fullscreen or a px number.`)}var ne=e=>{if(e.classList.contains(`wui-modal-fullscreen`))return{fullscreen:!0};let t=Number.parseInt(e.style.getPropertyValue(`--wui-modal-max-width`),10);return{px:t>0?t:u.md}},x=(e,t)=>{e.classList.toggle(l,!!t.fullscreen),t.fullscreen?e.style.removeProperty(`--wui-modal-max-width`):e.style.setProperty(`--wui-modal-max-width`,`${t.px}px`)},re=[`center`,`top`];function ie(e){if(Object.hasOwn(c,e??``))return{px:c[e]};let t=b(e);if(t?.fullscreen||e===`xl`)throw TypeError(`Unsupported drawer size "${String(e)}". Use sm, md, lg or a px number.`);return t}var ae=e=>e.container===`drawer`,oe=(e,t)=>ae(e)?ie(t):b(t);function se(e=`modal`){let t=e===`drawer`,n=t?s:o,r=document.getElementById(n);return r||(r=document.createElement(`div`),r.id=n,r.className=t?`modal fade wui-modal-shell wui-remote-drawer`:`modal fade wui-modal-shell`,r.tabIndex=-1,r.setAttribute(`aria-hidden`,`true`),r.setAttribute(`role`,`dialog`),r.setAttribute(`aria-modal`,`true`),r.style.setProperty(`--wui-modal-max-width`,`${t?c.md:u.md}px`),r.innerHTML=t?`<div class="modal-dialog wui-remote-drawer-dialog"><div class="modal-content wui-modal"></div></div>`:`<div class="modal-dialog modal-dialog-centered wui-rb-dialog"><div class="modal-content wui-modal"></div></div>`,document.body.appendChild(r),r)}var S=e=>`<div class="wui-modal-header"><div class="wui-modal-heading"><div class="wui-modal-headtext"><div class="wui-modal-title">${y(e)}</div></div></div>${g}</div>`,ce=e=>`<div class="modal-content wui-modal" aria-busy="true">${S(e)}<div class="wui-modal-body"><div class="wui-modal-loading" role="status"><span class="visually-hidden">${y(d.loading)}</span><div class="skeleton wui-modal-skeleton"></div><div class="skeleton wui-modal-skeleton"></div><div class="skeleton wui-modal-skeleton wui-modal-skeleton--short"></div></div></div></div>`,le=(e,t)=>`<div class="modal-content wui-modal" data-wui-modal-error="${y(t)}">${S(e)}<div class="wui-modal-body"><div class="wui-modal-state" role="alert"><p class="wui-modal-state-title">${y(d.errorTitle)}</p><p class="wui-modal-state-text">${y(d[t]||d.server)}</p><div class="wui-modal-state-actions"><button type="button" class="btn btn-secondary" data-bs-dismiss="modal">${y(d.close)}</button><button type="button" class="btn btn-primary" data-wui-modal-retry>${y(d.retry)}</button></div></div></div></div>`,C=e=>{let t=document.createElement(`template`);return t.innerHTML=e,t.content.querySelector(`.modal-content`)},w=e=>e.shell.querySelector(`.modal-content`);function ue(e){if(!e)return;e.dispatchEvent(new CustomEvent(`wui:teardown`,{bubbles:!0}));let t=window.bootstrap,n=[t?.Tooltip,t?.Popover,t?.Dropdown].filter(e=>e?.getInstance);for(let t of[e,...e.querySelectorAll(`*`)])for(let e of n)e.getInstance(t)?.dispose()}function T(e,t){let n=w(e);ue(n),n?n.replaceWith(t):e.shell.querySelector(`.modal-dialog`).appendChild(t),window.WUI?.refresh?.()}var E=e=>e.shell.classList.contains(`show`);function D(e,t){let n=t&&e.querySelector(p),r=n?n.matches(f)?n:n.querySelector(f)||n:null;if(!r){let t=[...e.querySelectorAll(f)];r=e.querySelector(`[data-autofocus]`)||t.find(e=>!e.classList.contains(`wui-modal-close`))||t[0]||e}r.focus?.()}function de(e,t){let n=e.shell.querySelector(`[data-wui-modal-live]`);n||(n=document.createElement(`div`),n.className=`visually-hidden`,n.setAttribute(`aria-live`,`assertive`),n.setAttribute(`data-wui-modal-live`,``),e.shell.querySelector(`.modal-dialog`).appendChild(n)),n.textContent=``,n.textContent=t}var fe=e=>{let t=e.shell.querySelector(`[data-wui-modal-live]`);t&&(t.textContent=``)},pe=(e,t,n)=>e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n}));function O(e,t,n,r){let i={...r,container:e.container};pe(t,`wui:modal:${n}`,i),ae(e)&&pe(t,`wui:drawer:${n}`,i)}function me(e){let t=_.get(e);return t||(t={shell:e,container:e.classList.contains(`wui-remote-drawer`)?`drawer`:`modal`,queue:a(),defaultSize:ne(e),defaultLabel:e.getAttribute(`aria-label`),placeholder:w({shell:e})?.outerHTML||`<div class="modal-content wui-modal"></div>`,remoteUrl:e.getAttribute(`data-wui-remote-url`),cache:e.getAttribute(`data-wui-remote-cache`)===`true`,loadedUrl:null,session:null},_.set(e,t),e.addEventListener(`submit`,e=>Se(t,e)),e.addEventListener(`click`,e=>{!e.target.closest?.(`[data-wui-modal-retry]`)||!t.session||(e.preventDefault(),A(t,t.session))}),e.addEventListener(`hidden.bs.modal`,n=>{n.target===e&&ge(t)}),e.addEventListener(`shown.bs.modal`,n=>{let r=w(t);n.target===e&&t.session&&r?.matches(h)&&!r.contains(document.activeElement)&&D(r,!1)}),t.remoteUrl&&e.addEventListener(`show.bs.modal`,n=>{n.target===e&&_e(t,n)}),t)}function he(e,t,n){e.session&&(e.queue.abort(),e.session.resolveClosed({status:`dismissed`,detail:{replaced:!0}}));let r,i=new Promise(e=>{r=e}),a={url:t,method:(n.method||`GET`).toUpperCase(),body:n.body,options:n,trigger:n.trigger||null,explicitSize:null,closing:null,resolveClosed:r,handle:null};return a.handle={el:e.shell,closed:i,close:()=>k(e,a,`dismissed`,null),reload:()=>A(e,a)},e.session=a,a}function k(e,t,n,r){e.session===t&&(t.closing={status:n,detail:r},window.bootstrap?.Modal?.getOrCreateInstance(e.shell).hide())}function ge(e){let t=e.session;if(e.queue.abort(),e.session=null,fe(e),t){let{status:n,detail:r}=t.closing||{status:`dismissed`,detail:null};t.resolveClosed({status:n,detail:r}),O(e,e.shell,`closed`,{status:n,url:t.url});let i=document.activeElement;t.trigger?.isConnected&&(!i||i===document.body||e.shell.contains(i))&&t.trigger.focus?.()}e.cache||(T(e,C(e.placeholder)),e.loadedUrl=null,x(e.shell,e.defaultSize),e.defaultLabel?e.shell.setAttribute(`aria-label`,e.defaultLabel):e.shell.removeAttribute(`aria-label`))}function _e(e,t){let n=t.relatedTarget instanceof Element?t.relatedTarget:null,r=n?.getAttribute(`data-wui-url`)||e.remoteUrl,i=he(e,r,{trigger:n});i.explicitSize=ve(e,n?.getAttribute(`data-wui-size`)),i.explicitSize&&x(e.shell,i.explicitSize),!(e.cache&&e.loadedUrl===r)&&(e.loadedUrl&&T(e,C(e.placeholder)),A(e,i,{keepPlaceholder:!0}))}function ve(e,t){try{return oe(e,t)}catch(e){return console.error(e),null}}async function A(e,t,{keepPlaceholder:n=!1}={}){n||T(e,C(ce(t.options.title||j(e))));let r=await e.queue.run(t.url,{method:t.method,body:t.body,navigate:t.options.navigate});if(e.session!==t||r.kind===`aborted`||r.kind===`stale`)return`aborted`;if(r.kind===`session`)return`session`;if((r.kind===`ok`||r.kind===`validation`)&&M(e,t,r.html,!1))return e.loadedUrl=t.url,O(e,e.shell,`loaded`,{url:t.url,handle:t.handle}),`loaded`;let i=r.kind===`ok`||r.kind===`validation`?`server`:r.kind;return T(e,C(le(t.options.title||j(e),i))),E(e)&&D(w(e),!1),O(e,e.shell,`error`,{url:t.url,kind:i,status:r.status}),`error`}var j=e=>w(e)?.querySelector(`.wui-modal-title`)?.textContent||e.shell.getAttribute(`aria-label`)||``;function M(e,t,n,r){let i=document.createElement(`template`);i.innerHTML=n;let a=i.content.querySelectorAll(`script`);if(a.length){console.warn(`WUI.modal: ${t.url} returned a fragment with script; it was removed. Keep page behaviour in the page.`);for(let e of a)e.remove()}let o=i.content.querySelector(h);if(!o)return console.error(`WUI.modal: ${t.url} did not answer with an <app-modal-content> fragment.`),!1;T(e,o),r||fe(e),x(e.shell,t.explicitSize||ve(e,o.getAttribute(`data-wui-size`))||e.defaultSize);let s=o.getAttribute(`data-wui-title`);return s&&e.shell.setAttribute(`aria-label`,s),E(e)&&D(o,r),!0}var ye=`button[type="submit"], button:not([type]), input[type="submit"], input[type="image"]`;function N(e,t,n){let r=[...e.elements].filter(e=>e.matches(ye));if(n){e.setAttribute(`data-wui-submitting`,``);let n=t&&r.includes(t)?t:r[0];for(let e of r)e.toggleAttribute(`data-wui-was-disabled`,e.disabled),e.disabled=!0;n&&(n.classList.add(`is-loading`),n.setAttribute(`aria-busy`,`true`),n.tagName===`BUTTON`&&n.insertAdjacentHTML(`afterbegin`,`<span class="spinner-border spinner-border-sm me-2" aria-hidden="true" data-wui-submit-spinner></span>`));return}e.removeAttribute(`data-wui-submitting`);for(let e of r)e.disabled=e.hasAttribute(`data-wui-was-disabled`),e.removeAttribute(`data-wui-was-disabled`),e.classList.remove(`is-loading`),e.removeAttribute(`aria-busy`),e.querySelector(`[data-wui-submit-spinner]`)?.remove()}function be(e,t,n){let r=t.closest(`.wui-modal-body`)||t;r.querySelector(`[data-wui-modal-submit-error]`)?.remove();let i=document.createElement(`div`);i.className=`alert alert-danger wui-modal-submit-error`,i.setAttribute(`role`,`alert`),i.setAttribute(`data-wui-modal-submit-error`,``),i.textContent=`${d.submitFailed} ${d[n]||d.server}`,r.prepend(i),de(e,i.textContent)}var xe=(e,t)=>{let n=new URL(e,window.location.href);for(let[e,r]of t)typeof r==`string`&&n.searchParams.append(e,r);return n.origin===window.location.origin?n.pathname+n.search:n.href};async function Se(e,t){let n=t.target,r=e.session;if(!(n instanceof HTMLFormElement)||!r||n.hasAttribute(`data-wui-native`)||!n.closest(h)||(t.preventDefault(),n.hasAttribute(`data-wui-submitting`)))return;let i=t.submitter||null,a=i?.getAttribute(`formaction`)||n.getAttribute(`action`)||r.url,o=(i?.getAttribute(`formmethod`)||n.getAttribute(`method`)||`GET`).toUpperCase(),s=new FormData(n);i?.name&&!s.has(i.name)&&s.append(i.name,i.value);let c=o===`GET`;N(n,i,!0);let l=await e.queue.run(c?xe(a,s):a,{method:o,body:c?void 0:s,navigate:r.options.navigate});if(e.session===r){if(n.isConnected&&N(n,i,!1),l.kind===`ok`&&l.result===`success`){Ce(e,r,l);return}if(!(l.kind===`aborted`||l.kind===`stale`||l.kind===`session`)){if(l.kind===`validation`&&M(e,r,l.html,!0)){let t=w(e).querySelector(m)?.textContent.replace(/\s+/g,` `).trim();de(e,t||d.invalid);return}l.kind===`ok`&&l.html&&M(e,r,l.html,!1)||be(e,n,l.kind===`ok`||l.kind===`validation`?`server`:l.kind)}}}function Ce(e,t,n){let r=n.message,i=n.redirect||null,a={url:t.url,trigger:t.trigger,handle:t.handle,message:r,redirect:i,data:n.data??null,container:e.container};if(r&&window.WUI?.toast?.(r,{variant:`success`}),O(e,t.trigger?.isConnected?t.trigger:document,`success`,a),t.options.onSuccess?.(a,t.handle),i&&(t.options.navigate||(e=>window.location.assign(e)))(i),n.next&&!i){t.url=n.next,t.method=`GET`,t.body=void 0,A(e,t);return}if(n.keepOpen){n.html&&M(e,t,n.html,!1);return}k(e,t,`success`,a)}function we(e){let t=e.target.closest?.(`[data-wui-modal], [data-wui-drawer]`);if(t&&!(t.matches(`a[href]`)&&(e.ctrlKey||e.metaKey||e.shiftKey||e.button!==0))){if(e.preventDefault(),!t.hasAttribute(`data-wui-modal`)){I(t.getAttribute(`data-wui-drawer`),{size:t.getAttribute(`data-wui-drawer-size`)||void 0,title:t.getAttribute(`data-wui-title`)||void 0,trigger:t}).catch(e=>{e?.name!==`AbortError`&&console.error(e)});return}F(t.getAttribute(`data-wui-modal`),{size:t.getAttribute(`data-wui-size`)||void 0,title:t.getAttribute(`data-wui-title`)||void 0,trigger:t}).catch(e=>{e?.name!==`AbortError`&&console.error(e)})}}function P(e=document){let t=e.ownerDocument||e;ee.has(t)||(ee.add(t),t.addEventListener(`click`,we));let n=[...e.querySelectorAll?.(`.modal[data-wui-remote-url]`)||[]];e.matches?.(`.modal[data-wui-remote-url]`)&&n.unshift(e);for(let e of n)me(e)}function F(e,t={}){try{if(!e)throw TypeError(`WUI.modal.load: a fragment url is required.`);let n=te(e),r=t.container===`drawer`,i=r?ie(t.size):b(t.size),a=t.placement||`center`;if(!re.includes(a))throw TypeError(`WUI.modal.load: unsupported placement "${a}". Use center or top.`);if(t.signal?.aborted)return Promise.reject(v());let o=se(r?`drawer`:`modal`);P(document);let s=me(o),c=E(s),l=he(s,e,t);l.explicitSize=i,x(o,i||s.defaultSize),r||o.querySelector(`.modal-dialog`).classList.toggle(`modal-dialog-centered`,a===`center`),t.title&&o.setAttribute(`aria-label`,t.title),c||(n.getInstance(o)?.dispose(),n.getOrCreateInstance(o,{backdrop:!t.staticBackdrop||`static`,keyboard:!t.staticBackdrop}));let u=c?Promise.resolve():new Promise(e=>o.addEventListener(`shown.bs.modal`,()=>e(),{once:!0})),d=A(s,l);c||n.getOrCreateInstance(o).show();let f=new Promise((e,n)=>{t.signal?.addEventListener(`abort`,()=>{s.session===l&&(s.queue.abort(),k(s,l,`dismissed`,{aborted:!0})),n(v())},{once:!0})}),p=Promise.all([u,d]).then(([,t])=>{if(t===`aborted`)throw v();if(t===`session`)throw Error(`WUI.modal.load(${e}): the session expired; the browser is signing in again.`);return l.handle});return Promise.race([p,f])}catch(e){return Promise.reject(e)}}function I(e,t={}){return F(e,{...t,container:`drawer`,placement:void 0})}var Te=Object.freeze([`neutral`,`primary`,`info`,`success`,`warning`,`danger`]),L=Object.freeze([`number`,`currency`,`compact`]),Ee=`wui-kanban:`,De=`(max-width: 767.98px)`,Oe=400,ke=6,R=Object.freeze({help:`Press Space to pick up the card. Use the Left and Right arrow keys to choose a column, then Space to drop it, or Escape to cancel.`,empty:`Nothing here`,collapse:e=>`Collapse ${e}`,expand:e=>`Expand ${e}`,lifted:(e,t)=>`Picked up ${e} in ${t}. Use the Left and Right arrow keys to choose a column.`,over:(e,t)=>`${e}, ${t===1?`1 card`:`${t} cards`}. Drop allowed.`,overSource:e=>`${e}, where the card started.`,overRefused:(e,t)=>`${e}. ${t}`,dropHere:(e,t)=>`Drop here to move ${e} to ${t}.`,refused:(e,t)=>`Cards in ${e} cannot move to ${t}.`,moved:(e,t)=>`Moved ${e} to ${t}.`,saving:(e,t)=>`Moving ${e} to ${t}.`,cancelled:e=>`${e} was not moved.`,rolledBack:(e,t)=>`${e} went back to ${t}.`,locked:e=>`${e} cannot be moved.`,more:e=>`Show ${e} more`,fewer:`Show fewer`,swipeHint:`Swipe sideways or tap a column`,busy:`This card is still saving. Try again in a moment.`,failed:Object.freeze({forbidden:`You do not have permission to move this card.`,client:`This card could not be moved. Refresh the board and try again.`,validation:`This card could not be moved. Refresh the board and try again.`,server:`Something went wrong on our side, so the card went back. Try again in a moment.`,network:`Could not reach the server, so the card went back. Check your connection and try again.`})}),z=`[data-wui-column]`,B=`[data-wui-body]`,V=`[data-wui-card]`,Ae=`[data-wui-count]`,je=`[data-wui-summary]`,Me=`[data-wui-empty]`,Ne=`[data-wui-drop-note]`,Pe=`[data-wui-live]`,Fe=`[data-wui-help]`,H=`[data-wui-switch]`,Ie=`[data-wui-scroller]`,Le=`[data-wui-collapse]`,Re=`[data-wui-more]`,ze=`data-wui-visible-limit`,U=`data-wui-overflow`,Be=`input, select, textarea, [contenteditable=""], [contenteditable="true"], [data-wui-no-drag]`,W=48,G=16,K=e=>e.getAttribute(`data-wui-column`),q=e=>e.getAttribute(`data-wui-card`),J=e=>e.hidden||e.hasAttribute(`hidden`),Ve=e=>J(e)||e.hasAttribute(U);function Y(e){if(e==null||e===``)return null;let t=typeof e==`number`?e:Number(e);if(!Number.isInteger(t)||t<1)throw TypeError(`Unsupported kanban visible limit "${String(e)}". Use a whole number of 1 or more.`);return t}function He(e,t,n,r){let i=new Set;if(t==null||n)return i;let a=0;for(let n of e)r.has(n)||(a<t?a++:i.add(n));return i}function X(e){let t=(e.getAttribute(`aria-label`)||e.textContent||``).replace(/\s+/g,` `).trim();return t.length>80?`${t.slice(0,79)}…`:t||q(e)||`Card`}function Z(e){return e?`${Ee}${e}`:null}function Q(e,t=globalThis.localStorage){let n=Z(e);if(!n||!t)return{};try{let e=JSON.parse(t.getItem(n)||`null`);return e&&typeof e.collapsed==`object`&&e.collapsed?e.collapsed:{}}catch{return{}}}function Ue(e,t,n,r=globalThis.localStorage){let i=Z(e);if(!i||!r)return;let a={...Q(e,r),[t]:!!n};try{r.setItem(i,JSON.stringify({collapsed:a}))}catch{}}function We(e,t){if(!L.includes(e))throw TypeError(`Unsupported kanban summary format "${String(e)}". Use ${L.join(`, `)}.`);if(t!=null&&t!==``&&!n.includes(t))throw TypeError(`Unsupported kanban summary unit "${String(t)}". Use ${n.join(`, `)}.`);return e===`currency`?{style:`currency`,unit:t||`rupees`}:e===`compact`?{style:`compact`,currency:r[0],unit:t||`rupees`}:{style:`number`,decimals:0}}function Ge(e){let t=0;for(let n of e){if(n==null||n===``)continue;let e=typeof n==`number`?n:Number(n);Number.isFinite(e)&&(t+=e)}return t}var $=(e,t)=>{e&&window.WUI?.toast?.(e,{variant:t})},Ke=class extends e{constructor(){super(),this._wired=!1,this._filter=null,this._expanded=new Set,this._revealed=new Set,this._press=null,this._drag=null,this._kbd=null,this._suppressClick=!1,this._observer=null,this._refreshQueued=!1,this._scrollTimer=0,this._onPointerMove=e=>this._pointerMove(e),this._onPointerUp=e=>this._pointerUp(e),this._onPointerCancel=()=>this._endPointer(!1),this._onDocKeyDown=e=>{e.key===`Escape`&&this._drag&&(e.preventDefault(),this._endPointer(!1))},this._onScroll=()=>{clearTimeout(this._scrollTimer),this._scrollTimer=setTimeout(()=>this._syncSwitcherFromScroll(),80)}}_controlled(){return this.hasAttribute(`controlled`)}connectedCallback(){if(!this._wired){this._wired=!0,this.addEventListener(`pointerdown`,e=>this._pointerDown(e)),this.addEventListener(`keydown`,e=>this._keyDown(e)),this.addEventListener(`click`,e=>this._click(e),!0),this.addEventListener(`dragstart`,e=>{e.target.closest?.(V)&&e.preventDefault()}),this.addEventListener(`touchmove`,e=>{this._drag&&e.preventDefault()},{passive:!1}),this._scroller()?.addEventListener(`scroll`,this._onScroll,{passive:!0}),this._restoreCollapsed();for(let e of this._allCards())this._prepareCard(e);if(typeof MutationObserver==`function`){this._observer=new MutationObserver(e=>{for(let t of e)for(let e of t.addedNodes)e.nodeType===1&&e.matches(V)&&this._prepareCard(e);this._queueRefresh()});for(let e of this.querySelectorAll(B))this._observer.observe(e,{childList:!0})}this.refresh()}}disconnectedCallback(){this._endPointer(!1),this._observer?.disconnect(),this._observer=null,this._scroller()?.removeEventListener(`scroll`,this._onScroll),clearTimeout(this._scrollTimer),this._wired=!1}setFilter(e){if(e!=null&&typeof e!=`function`)throw TypeError(`wui-kanban setFilter: pass a function or null.`);if(this._filter=e,!e)for(let e of this._allCards())e.hidden=!1;this.refresh()}refresh(){if(this._controlled())return;this._refreshQueued=!1;let e=this._summaryFormat();for(let n of this._columns()){let r=K(n),i=Y(n.getAttribute(ze)),a=[],o=[];for(let e of this._cardsIn(n)){if(this._filter&&(e.hidden=this._filter(e)===!1),J(e)){e.removeAttribute(U);continue}a.push(e),o.push(e.getAttribute(`data-wui-value`))}let s=this._expanded.has(r),c=He(a.map(q),i,s,this._revealed);for(let e of a)e.toggleAttribute(U,c.has(q(e)));let l=String(a.length);for(let e of this._countsOf(n))e.textContent!==l&&(e.textContent=l);let u=n.querySelector(Me);if(u&&(u.hidden=a.length>0),e){let r=n.querySelector(je);r&&(r.textContent=t(Ge(o),e))}let d=n.querySelector(Re);if(d){d.hidden=i==null||(s?a.length<=i:c.size===0),d.setAttribute(`aria-expanded`,s?`true`:`false`);let e=s?R.fewer:R.more(c.size);d.textContent!==e&&(d.textContent=e)}}}moveCard(e,t,n){let r=this._cardByKey(e);if(!r)throw Error(`wui-kanban moveCard: no card "${String(e)}" on this board.`);if(!this._columnByKey(t))throw Error(`wui-kanban moveCard: no column "${String(t)}" on this board.`);return this._commit(r,t,n)}_columns(){return[...this.querySelectorAll(z)]}_columnByKey(e){return this._columns().find(t=>K(t)===e)||null}_columnOf(e){return e.closest(z)}_titleOf(e){return(e.querySelector(`.wui-kanban-title`)?.textContent||K(e)||``).replace(/\s+/g,` `).trim()}_bodyOf(e){return e.querySelector(B)}_cardsIn(e){let t=this._bodyOf(e);return t?[...t.children].filter(e=>e.matches(V)):[]}_visibleCardsIn(e){return this._cardsIn(e).filter(e=>!Ve(e))}_allCards(){return[...this.querySelectorAll(`${B} > ${V}`)]}_cardByKey(e){return this._allCards().find(t=>q(t)===e)||null}_countsOf(e){let t=K(e),n=[...this.querySelectorAll(H)].filter(e=>e.getAttribute(`data-wui-switch`)===t);return[...e.querySelectorAll(Ae),...n.flatMap(e=>[...e.querySelectorAll(Ae)])]}_scroller(){return this.querySelector(Ie)}_summaryFormat(){let e=this.getAttribute(`summary-format`);return e?We(e,this.getAttribute(`summary-unit`)):null}_queueRefresh(){this._refreshQueued||(this._refreshQueued=!0,queueMicrotask(()=>{this._refreshQueued&&this.refresh()}))}_prepareCard(e){let t=this.querySelector(Fe);t?.id&&!e.hasAttribute(`aria-describedby`)&&e.setAttribute(`aria-describedby`,t.id),e.hasAttribute(`tabindex`)||(e.tabIndex=0)}_announce(e){let t=this.querySelector(Pe);!t||!e||(t.textContent=``,t.textContent=e)}_fire(e,t,n=!1){return this.dispatchEvent(new CustomEvent(e,{bubbles:!0,cancelable:n,detail:t}))}_canLift(e){let t=X(e),n=this.hasAttribute(`readonly`);return n||e.hasAttribute(`data-wui-locked`)?(this._announce(R.locked(t)),this._fire(`wui:kanban:locked`,{key:q(e),card:e,reason:n?`readonly`:`locked`},!0),!1):e.getAttribute(`aria-busy`)===`true`?(this._announce(R.busy),$(R.busy,`info`),!1):!0}_check(e,t,n){if(t===n)return{ok:!1,source:!0,reason:null};let r=this._columnByKey(t),i=this._columnByKey(n),a=R.refused(r?this._titleOf(r):t,i?this._titleOf(i):n),o=i?.getAttribute(`data-accept-from`);if(o!=null&&!o.split(/\s+/).filter(Boolean).includes(t))return{ok:!1,reason:a};if(typeof this.accept==`function`){let r=this.accept(e,t,n);if(r===!1)return{ok:!1,reason:a};if(typeof r==`string`&&r)return{ok:!1,reason:r}}return{ok:!0,reason:null}}_markTargets(e,t){let n=X(e),r=new Map;for(let i of this._columns()){let a=K(i),o=this._check(e,t,a);r.set(a,o),i.setAttribute(`data-wui-drop`,o.source?`source`:o.ok?`ok`:`refused`);let s=i.querySelector(Ne);s&&!o.source&&(s.textContent=o.ok?R.dropHere(n,this._titleOf(i)):o.reason,s.hidden=!1)}return r}_clearTargets(){for(let e of this._columns()){e.removeAttribute(`data-wui-drop`),e.removeAttribute(`data-wui-over`),e.removeAttribute(`data-wui-target`);let t=e.querySelector(Ne);t&&(t.hidden=!0,t.textContent=``)}}async _commit(e,t,n){let r=this._columnOf(e),a=K(r),o=this._columnByKey(t),s=X(e);if(a===t||!this._canLift(e))return!1;let c=this._check(e,a,t);if(!c.ok)return this._announce(c.reason),$(c.reason,`info`),!1;let l=this._cardsIn(o),u=Number.isInteger(n)?Math.max(0,Math.min(n,l.length)):l.length,d={key:q(e),card:e,from:a,to:t,index:u},f=e.contains(document.activeElement);if(this._controlled())return this._fire(`wui:kanban:move`,d),this._announce(R.moved(s,this._titleOf(o))),f&&this._refocusSoon(d.key),!0;if(!this._fire(`wui:kanban:move`,d,!0))return!1;let p=o.hasAttribute(ze)&&!this._revealed.has(d.key);p&&this._revealed.add(d.key);let m={parent:e.parentNode,next:e.nextSibling,column:r,revealed:p};this._bodyOf(o).insertBefore(e,l[u]||null),f&&this._focusMoved(e),this.refresh();let h=o.getAttribute(`data-wui-step`);if(h)return this._runStep(e,d,m,h,o.getAttribute(`data-wui-step-size`));let g=this.getAttribute(`move-url`);if(!g)return this._announce(R.moved(s,this._titleOf(o))),this._fire(`wui:kanban:moved`,{...d,result:null}),!0;this._lock(e,!0),this._announce(R.saving(s,this._titleOf(o)));let _=await i(g,{method:`POST`,body:new URLSearchParams({card:d.key,from:a,to:t,index:String(u)})});if(this._lock(e,!1),_.kind===`session`)return!1;if(_.ok){let t=this._applyFragment(_.html)||e;return $(_.message,`success`),this._announce(R.moved(X(t),this._titleOf(o))),this._fire(`wui:kanban:moved`,{...d,card:t,result:_}),!0}return this._rollback(e,m),_.kind!==`aborted`&&$(_.message||R.failed[_.kind]||R.failed.server,`danger`),this._fire(`wui:kanban:failed`,{...d,kind:_.kind,status:_.status,message:_.message}),!1}async _runStep(e,t,n,r,a){let o=X(e),s=this._columnByKey(t.to),c=new URLSearchParams({card:t.key,from:t.from,to:t.to}).toString(),l=r+(r.includes(`?`)?`&`:`?`)+c;this._lock(e,!0);let u;try{u=await(await F(l,{trigger:e,size:a||void 0})).closed}catch(r){return this._lock(e,!1),this._rollback(e,n),r?.name!==`AbortError`&&$(R.failed.server,`danger`),this._fire(`wui:kanban:failed`,{...t,kind:`step`,status:0,message:r?.message??null}),!1}if(u?.status!==`success`)return this._lock(e,!1),this._rollback(e,n),this._announce(R.cancelled(o)),this._fire(`wui:kanban:failed`,{...t,kind:`dismissed`,status:0,message:null}),!1;let d=e,f=this.getAttribute(`card-url`);if(f){let n=await i(`${f}${f.includes(`?`)?`&`:`?`}${new URLSearchParams({card:t.key})}`);n.ok&&(d=this._applyFragment(n.html)||e)}return this._lock(d,!1),this._announce(R.moved(X(d),this._titleOf(s))),this._fire(`wui:kanban:moved`,{...t,card:d,result:u}),!0}_lock(e,t){t?(e.setAttribute(`aria-busy`,`true`),e.setAttribute(`data-wui-saving`,``)):(e.removeAttribute(`aria-busy`),e.removeAttribute(`data-wui-saving`))}_rollback(e,t){let n=e.contains(document.activeElement),r=t.next&&t.next.parentNode===t.parent?t.next:null;t.revealed&&this._revealed.delete(q(e)),t.parent.insertBefore(e,r),n&&e.focus(),this.refresh(),this._announce(R.rolledBack(X(e),this._titleOf(t.column)))}_applyFragment(e){if(!e)return null;let t=document.createElement(`template`);t.innerHTML=e;for(let e of t.content.querySelectorAll(`script`))console.warn(`[@webority/ui-elements] A kanban fragment carried a script tag; it was removed, not run.`),e.remove();let n=null;for(let e of[...t.content.querySelectorAll(V)]){if(e.closest(`template`))continue;let t=this._cardByKey(q(e));if(!t)continue;let r=t.contains(document.activeElement);t.dispatchEvent(new CustomEvent(`wui:teardown`,{bubbles:!0})),t.hidden&&(e.hidden=!0),t.replaceWith(e),this._prepareCard(e),r&&e.focus(),n??=e}for(let e of t.content.querySelectorAll(`template[data-wui-kanban-summary]`))this._columnByKey(e.getAttribute(`data-wui-kanban-summary`))?.querySelector(je)?.replaceChildren(e.content.cloneNode(!0));return this.refresh(),window.WUI?.refresh?.(),n}_refocusSoon(e){let t=()=>{let t=this._cardByKey(e);t&&this._focusMoved(t)};typeof requestAnimationFrame==`function`?requestAnimationFrame(t):setTimeout(t,0)}_focusMoved(e){e.focus({preventScroll:!0}),e.scrollIntoView?.({block:`nearest`})}_pointerDown(e){if(e.button!==0||e.isPrimary===!1||this._drag||this._kbd)return;let t=e.target.closest?.(V);if(!t||!this.contains(t)||e.target.closest(Be))return;let n={card:t,id:e.pointerId,x:e.clientX,y:e.clientY,type:e.pointerType,timer:0};this._press=n,e.pointerType===`touch`&&(n.timer=setTimeout(()=>{this._press===n&&this._startDrag(n,n.x,n.y)},400)),window.addEventListener(`pointermove`,this._onPointerMove),window.addEventListener(`pointerup`,this._onPointerUp),window.addEventListener(`pointercancel`,this._onPointerCancel)}_pointerMove(e){let t=this._press;if(!(!t||e.pointerId!==t.id)){if(!this._drag){if(!(Math.hypot(e.clientX-t.x,e.clientY-t.y)>6))return;if(t.type===`touch`){this._endPointer(!1);return}if(this._startDrag(t,e.clientX,e.clientY),!this._drag)return}this._dragTo(e.clientX,e.clientY)}}_pointerUp(e){!this._press||e.pointerId!==this._press.id||this._endPointer(!!this._drag)}_startDrag(e,t,n){let r=e.card;if(!this._canLift(r)){this._endPointer(!1);return}let i=K(this._columnOf(r)),a=r.getBoundingClientRect(),o=r.cloneNode(!0);for(let e of[o,...o.querySelectorAll(`[id]`)])e.removeAttribute(`id`);o.removeAttribute(`data-wui-card`),o.removeAttribute(`tabindex`),o.setAttribute(`aria-hidden`,`true`),o.classList.add(`wui-kanban-ghost`),o.style.width=`${a.width}px`,this.appendChild(o),r.setAttribute(`data-wui-dragging`,``),this.setAttribute(`data-wui-dragging`,``),this._drag={card:r,from:i,ghost:o,dx:t-a.left,dy:n-a.top,over:null,verdicts:this._markTargets(r,i)},this._announce(R.lifted(X(r),this._titleOf(this._columnOf(r)))),document.addEventListener(`keydown`,this._onDocKeyDown),this._dragTo(t,n)}_dragTo(e,t){let n=this._drag;n.x=e,n.y=t,n.ghost.style.transform=`translate(${e-n.dx}px, ${t-n.dy}px)`;let r=this._columnAt(e,t);r!==n.over&&(n.over?.removeAttribute(`data-wui-over`),r?.setAttribute(`data-wui-over`,``),n.over=r),this._autoScroll(e,t,r)}_columnAt(e,t){for(let n of this._columns()){let r=n.getBoundingClientRect();if(e>=r.left&&e<=r.right&&t>=r.top&&t<=r.bottom)return n}return null}_indexAt(e,t){let n=this._visibleCardsIn(e).filter(e=>e!==this._drag?.card).find(e=>{let n=e.getBoundingClientRect();return t<n.top+n.height/2}),r=this._cardsIn(e).filter(e=>e!==this._drag?.card);return n?r.indexOf(n):r.length}_autoScroll(e,t,n){let r=this._scroller();if(r){let t=r.getBoundingClientRect();t.width>0&&(e<t.left+W?r.scrollBy?.({left:-16}):e>t.right-W&&r.scrollBy?.({left:G}))}if(n&&this._scrollColumn(n,t))return;let i=window.innerHeight||0;i>0&&(t<W?window.scrollBy?.({top:-16}):t>i-W&&window.scrollBy?.({top:G}))}_scrollColumn(e,t){let n=this._bodyOf(e);if(!n||e.hasAttribute(`data-collapsed`)||n.scrollHeight<=n.clientHeight)return!1;let r=n.getBoundingClientRect();return t<r.top+W&&n.scrollTop>0?(n.scrollBy?.({top:-16}),!0):t>r.bottom-W&&n.scrollTop+n.clientHeight<n.scrollHeight-1?(n.scrollBy?.({top:G}),!0):!1}_endPointer(e){let t=this._press,n=this._drag;if(t&&clearTimeout(t.timer),this._press=null,this._drag=null,window.removeEventListener(`pointermove`,this._onPointerMove),window.removeEventListener(`pointerup`,this._onPointerUp),window.removeEventListener(`pointercancel`,this._onPointerCancel),document.removeEventListener(`keydown`,this._onDocKeyDown),!n)return;n.ghost.remove(),n.card.removeAttribute(`data-wui-dragging`),this.removeAttribute(`data-wui-dragging`),this._suppressClick=!0,setTimeout(()=>{this._suppressClick=!1},0);let r=n.over;if(this._clearTargets(),!e||!r){this._announce(R.cancelled(X(n.card)));return}let i=K(r),a=n.verdicts.get(i);if(a?.source){this._announce(R.cancelled(X(n.card)));return}if(!a?.ok){this._announce(a?.reason),$(a?.reason,`info`);return}this._commit(n.card,i,this._indexAt(r,n.y))}_click(e){if(this._suppressClick&&e.target.closest?.(V)){e.preventDefault(),e.stopPropagation(),this._suppressClick=!1;return}let t=e.target.closest?.(Le);if(t&&this.contains(t)){let e=t.closest(z);e&&this._setCollapsed(e,!e.hasAttribute(`data-collapsed`),!0);return}let n=e.target.closest?.(Re);if(n&&this.contains(n)){this._controlled()||this._toggleMore(n.closest(z));return}let r=e.target.closest?.(H);r&&this.contains(r)&&this._showColumn(r.getAttribute(`data-wui-switch`))}_keyDown(e){if(this._kbd){this._liftedKey(e);return}let t=e.target;if(!t.matches?.(V)||!this.contains(t))return;let n=this._columnOf(t);switch(e.key){case` `:case`Spacebar`:{if(e.preventDefault(),!this._canLift(t))return;let r=K(n),i=this._columns();this._kbd={card:t,from:r,target:i.indexOf(n),verdicts:this._markTargets(t,r)},t.setAttribute(`data-wui-lifted`,``),this.setAttribute(`data-wui-dragging`,``),n.setAttribute(`data-wui-target`,``),this._announce(R.lifted(X(t),this._titleOf(n)));return}case`ArrowDown`:case`ArrowUp`:{let r=this._visibleCardsIn(n),i=r[r.indexOf(t)+(e.key===`ArrowDown`?1:-1)];i&&(e.preventDefault(),i.focus());return}case`ArrowLeft`:case`ArrowRight`:{let t=this._columns(),r=e.key===`ArrowRight`?1:-1;for(let i=t.indexOf(n)+r;i>=0&&i<t.length;i+=r){let n=this._visibleCardsIn(t[i])[0];if(n&&!t[i].hasAttribute(`data-collapsed`)){e.preventDefault(),n.focus();return}}return}default:}}_liftedKey(e){let t=this._kbd,n=this._columns();switch(e.key){case`ArrowLeft`:case`ArrowRight`:{e.preventDefault();let r=t.target+(e.key===`ArrowRight`?1:-1);if(r<0||r>=n.length)return;n[t.target]?.removeAttribute(`data-wui-target`),t.target=r;let i=n[r];i.setAttribute(`data-wui-target`,``),this._showColumn(K(i),!1);let a=t.verdicts.get(K(i)),o=this._titleOf(i);this._announce(a.source?R.overSource(o):a.ok?R.over(o,this._cardsIn(i).filter(e=>!J(e)).length):R.overRefused(o,a.reason));return}case` `:case`Spacebar`:case`Enter`:{e.preventDefault();let r=n[t.target],i=K(r),a=t.verdicts.get(i);if(!a.source&&!a.ok){this._announce(a.reason);return}this._endKeyboard(),a.source?this._announce(R.cancelled(X(t.card))):this._commit(t.card,i);return}case`Escape`:case`Tab`:e.key===`Escape`&&e.preventDefault(),this._endKeyboard(),this._showColumn(t.from,!1),this._announce(R.cancelled(X(t.card)));return;default:}}_endKeyboard(){let e=this._kbd;this._kbd=null,e&&(e.card.removeAttribute(`data-wui-lifted`),this.removeAttribute(`data-wui-dragging`),this._clearTargets())}_restoreCollapsed(){let e=Q(this.getAttribute(`board-id`));for(let t of this._columns()){let n=K(t);t.hasAttribute(`data-collapsible`)&&Object.hasOwn(e,n)&&this._setCollapsed(t,e[n],!1)}}_setCollapsed(e,t,n){let r=K(e);e.toggleAttribute(`data-collapsed`,t);let i=this._titleOf(e);for(let n of e.querySelectorAll(Le))n.setAttribute(`aria-expanded`,t?`false`:`true`),n.setAttribute(`aria-label`,t?R.expand(i):R.collapse(i));n&&(Ue(this.getAttribute(`board-id`),r,t),this._fire(`wui:kanban:collapse`,{column:r,collapsed:t}))}_toggleMore(e){if(!e)return;let t=K(e);if(this._expanded.delete(t))for(let t of this._cardsIn(e))this._revealed.delete(q(t));else this._expanded.add(t);this.refresh()}_isPhone(){return typeof matchMedia==`function`&&matchMedia(`(max-width: 767.98px)`).matches}_showColumn(e,t=!0){for(let t of this.querySelectorAll(H))t.getAttribute(`data-wui-switch`)===e?t.setAttribute(`aria-current`,`true`):t.removeAttribute(`aria-current`);let n=this._columnByKey(e),r=this._scroller();if(!n||!r||!t&&!this._isPhone())return;let i=typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches;r.scrollTo?.({left:n.offsetLeft-r.offsetLeft,behavior:i?`auto`:`smooth`})}_syncSwitcherFromScroll(){let e=this._scroller();if(!e||!this._isPhone())return;let t=e.clientWidth||1,n=this._columns()[Math.round(e.scrollLeft/t)];if(n)for(let e of this.querySelectorAll(H))e.getAttribute(`data-wui-switch`)===K(n)?e.setAttribute(`aria-current`,`true`):e.removeAttribute(`aria-current`)}};export{u as _,L as a,F as b,Ke as c,Z as d,We as f,Ue as g,Ge as h,Ee as i,X as l,Q as m,Oe as n,R as o,Y as p,De as r,Te as s,ke as t,He as u,P as v,I as y};
@@ -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`,".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);return`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*]/,ee=new Set([`text`,`tel`,`search`,`url`,`password`]),te=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},w=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},T=e=>e.length<=3?e:`${e.slice(0,-3).replace(/\B(?=(\d{2})+(?!\d))/g,`,`)},${e.slice(-3)}`,E=e=>{let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e.trim());return t?`${t[3]}-${t[2]}-${t[1]}`:e};function D(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 O(){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=T(t)+(e.includes(`.`)?`.${n}`:``);return{text:r,isRaw:[...r].map(e=>e!==`,`)}},isValid:e=>/^\d+(\.\d{1,2})?$/.test(e)}}var k={"phone-in":()=>D(`99999 99999`,{normalize:te,valid:e=>/^[6-9]/.test(e),message:`Enter a 10-digit mobile number`}),pan:()=>D(`AAAAA9999A`,{upper:!0,valid:e=>/^[A-Z]{5}\d{4}[A-Z]$/.test(e),message:`Enter a valid PAN`}),gstin:()=>D(`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:()=>D(`9999 9999 9999`,{valid:e=>/^[2-9]/.test(e),message:`Enter a valid 12-digit Aadhaar number`}),ifsc:()=>D(`AAAA*******`,{upper:!0,valid:e=>/^[A-Z]{4}0[A-Z0-9]{6}$/.test(e),message:`Enter a valid IFSC`}),"pin-code":()=>D(`999999`,{valid:e=>/^[1-9]/.test(e),message:`Enter a valid 6-digit PIN code`}),date:()=>D(`99-99-9999`,{normalize:E,valid:w,post:(e,t)=>e.length===8&&w(e)?`${e.slice(4)}-${e.slice(2,4)}-${e.slice(0,2)}`:t,message:`Enter a valid date as DD-MM-YYYY`}),amount:O},A=Object.keys(k),j=e=>{let t=String(e).toLowerCase();return Object.hasOwn(k,t)?t:void 0},ne=e=>C.test(String(e))&&j(e)===void 0,M=new Map;function N(e){if(e==null||e===``)return null;let t=String(e);return M.has(t)||(ne(t)?M.set(t,D(t)):M.set(t,Object.hasOwn(k,t)?k[t]():null)),M.get(t)}var P=(e,t)=>e.normalize?e.normalize(t):t;function re(e,t){let n=N(e);return n?n.extract(P(n,String(t??``))):String(t??``)}function ie(e,t){let n=N(e);if(!n)return String(t??``);let r=n.extract(P(n,String(t??``)));return n.post(r,n.layout(r).text)}function ae(e,t){let n=N(e);return n?n.layout(n.extract(P(n,String(t??``)))).text:String(t??``)}var oe=(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},se=new WeakMap,ce=e=>se.get(e)?.(),le=new WeakMap;function ue(e,t,n,r){let i=e.getAll(t),a=le.get(e);a||le.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 de(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 fe(e,{mask:t,postFormatted:n=!1,onChange:r,onInvalidChange:i}={}){let a=N(t);if(!a||!ee.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??de(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&&ee.has(e.type))){let t=oe(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=P(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:P(a,e.value);v(n,e.selectionStart??n.length,!0)},C=()=>{f=!0},te=()=>{f=!1;let t=P(a,e.value);v(t,e.selectionStart??t.length,!0),x()},w=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()))},T=t=>{if(e.readOnly||e.disabled)return;let n=t.clipboardData?.getData(`text`);if(n==null)return;t.preventDefault();let r=P(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()},E=()=>{let t=a.extract(e.value);return a.post(t,a.layout(t).text)},D=()=>{p=!0,_()};e.addEventListener(`input`,S),e.addEventListener(`beforeinput`,w),e.addEventListener(`paste`,T),e.addEventListener(`compositionstart`,C),e.addEventListener(`compositionend`,te),e.addEventListener(`blur`,D),e.addEventListener(`invalid`,D);let O=e.form,k=t=>{e.name&&!e.disabled&&ue(t.formData,e.name,e.value,E())},A=()=>{clearTimeout(g),g=setTimeout(()=>{p=!1,v(P(a,e.value),e.value.length,!0)},0)};n||(O?.addEventListener(`formdata`,k),se.set(e,E)),O?.addEventListener(`reset`,A),O?.addEventListener(`submit`,D);let j=P(a,e.value);return v(j,j.length,!1),()=>{clearTimeout(g),e.removeEventListener(`input`,S),e.removeEventListener(`beforeinput`,w),e.removeEventListener(`paste`,T),e.removeEventListener(`compositionstart`,C),e.removeEventListener(`compositionend`,te),e.removeEventListener(`blur`,D),e.removeEventListener(`invalid`,D),O?.removeEventListener(`formdata`,k),O?.removeEventListener(`reset`,A),O?.removeEventListener(`submit`,D),se.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 pe(){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=ce(e);return n===void 0?t.call(this,e):n},e.wuiMaskHook=!0}var F=new WeakMap,I,me=e=>{F.has(e)||F.set(e,fe(e,{mask:e.dataset.appMask,postFormatted:e.hasAttribute(`data-mask-post-formatted`)}))},he=e=>e.nodeType===1?[...e.matches(`input[data-app-mask]`)?[e]:[],...e.querySelectorAll(`input[data-app-mask]`)]:[];function ge(){I||typeof MutationObserver>`u`||(I=new MutationObserver(e=>{for(let t of e){for(let e of t.removedNodes)for(let t of he(e))F.get(t)?.(),F.delete(t);for(let e of t.addedNodes)for(let t of he(e))me(t)}}),I.observe(document.documentElement,{childList:!0,subtree:!0}))}function _e(e=document){pe();for(let t of e.querySelectorAll(`input[data-app-mask]`))me(t);e===document&&ge()}var L={minLength:10,uppercase:!0,lowercase:!0,digit:!0,special:!0,uniqueChars:0,customRules:[]},ve=`Password requirements`;function ye(e){return e===!0||e==null?{...L}:{...L,...e}}function be(e){let t=ye(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 xe(e,t){let n=e==null?``:String(e);return be(t).map(e=>({key:e.key,label:e.label,met:e.test(n)}))}function Se(e,t){return xe(e,t).every(e=>e.met)}var Ce=`wui:row-drop`,R=`is-drop-over`,we=`application/x-wui-rows`,Te=`wui-row-dragging`,z=`[data-wui-drop-target]`,Ee=`tbody tr[data-row-key]`,De=`input, button, a, select, textarea, label`,Oe=`.wui-select-cell .wui-check`,B=new WeakMap,ke=new WeakSet,V=null,H=null;function Ae(e){return e.querySelector(Oe)?.checked===!0}function U(e){return[...e.querySelectorAll(`tbody tr`)].filter(Ae).map(e=>e.dataset.rowKey)}function W(){V=null,document.body.classList.remove(Te);for(let e of document.querySelectorAll(`${z}.${R}`))e.classList.remove(R)}function je(e,t,n){e.dispatchEvent(new CustomEvent(Ce,{bubbles:!0,detail:{keys:t,target:n.dataset.wuiDropTarget}}))}function Me(e){let t=e.target.closest?.(z);!t||!V||(e.preventDefault(),e.dataTransfer.dropEffect=`move`,t.classList.add(R))}function Ne(e){let t=e.target.closest?.(z);!t||t.contains(e.relatedTarget)||t.classList.remove(R)}function Pe(e){let t=e.target.closest?.(z);if(!t||!V)return;e.preventDefault(),t.classList.remove(R);let{root:n,keys:r}=V;je(n,r,t),W()}function Fe(e){let t=e.target.closest?.(z);!t||!H?.keys.length||(e.preventDefault(),je(H.root,H.keys,t))}function Ie(e){(e.key===`Enter`||e.key===` `)&&Fe(e)}function Le(e){ke.has(e)||(ke.add(e),e.addEventListener(`dragover`,Me),e.addEventListener(`dragenter`,Me),e.addEventListener(`dragleave`,Ne),e.addEventListener(`drop`,Pe),e.addEventListener(`click`,Fe),e.addEventListener(`keydown`,Ie))}function Re(e){let t=B.get(e);if(t)return t;Le(e.ownerDocument||e);let n=t=>{let n=t.target.closest?.(Ee);if(!n||!e.contains(n))return;let r=t.target.closest(De);r&&n.contains(r)||(n.draggable=!0)},r=t=>{let n=t.target.closest?.(Ee);if(!n||!e.contains(n))return;let r=Ae(n)?U(e):[n.dataset.rowKey];t.dataTransfer.setData(we,JSON.stringify(r)),t.dataTransfer.setData(`text/plain`,r.join(`,`)),t.dataTransfer.effectAllowed=`move`,V={root:e,keys:r},document.body.classList.add(Te)},i=t=>{let n=t.detail?.selected;n>0?H={root:e,keys:t.detail.keys??U(e)}:n===0&&(H=null),G(document)};e.addEventListener(`pointerdown`,n),e.addEventListener(`dragstart`,r),e.addEventListener(`dragend`,W),e.addEventListener(`selectionchange`,i);let a=()=>{e.removeEventListener(`pointerdown`,n),e.removeEventListener(`dragstart`,r),e.removeEventListener(`dragend`,W),e.removeEventListener(`selectionchange`,i),B.delete(e)};return B.set(e,a),a}function G(e=document){let t=e.querySelector(`[data-wui-row-drag] tbody tr ${Oe}:checked`)!==null;for(let n of e.querySelectorAll(z)){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 ze(e=document){for(let t of e.querySelectorAll(`[data-wui-row-drag]`))Re(t);G(e.ownerDocument||e)}var K=`.table-wrap, .table-responsive, [class*="table-responsive-"]`,q=1;function Be(e){let t=()=>{let t=e.scrollWidth-e.clientWidth,n=Math.abs(e.scrollLeft);e.toggleAttribute(`data-wui-overflow-start`,t>q&&n>q),e.toggleAttribute(`data-wui-overflow-end`,t>q&&n<t-q),e.toggleAttribute(`data-wui-overflow-top`,e.scrollTop>q)},n=()=>{if(e.scrollWidth-e.clientWidth>q){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 J=new WeakMap,Y,Ve=e=>{J.has(e)||J.set(e,Be(e))},He=e=>e.nodeType===1?[...e.matches(`.table-wrap, .table-responsive, [class*="table-responsive-"]`)?[e]:[],...e.querySelectorAll(K)]:[];function Ue(){Y||typeof MutationObserver>`u`||(Y=new MutationObserver(e=>{for(let t of e){for(let e of t.removedNodes)for(let t of He(e))J.get(t)?.(),J.delete(t);for(let e of t.addedNodes)for(let t of He(e))Ve(t)}}),Y.observe(document.documentElement,{childList:!0,subtree:!0}))}function We(e=document){for(let t of e.querySelectorAll(K))Ve(t);e===document&&Ue()}var Ge=[`light`,`dark`,`auto`],Ke=[`wave`,`circle`,`slide`,`blinds`,`fade`,`none`],qe=`wave`,X=`theme`,Z={wave:1100,circle:700,slide:600,blinds:900,fade:350,none:0},Je=`wui-theme-switching`,Ye=`wui:theme:change`,Xe=`wui-theme-toggle`,Ze=`(prefers-color-scheme: dark)`,Qe=e=>typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(e).matches,$e=e=>Ge.includes(e);function et(e){return e===`dark`||e===`auto`&&Qe(Ze)?`dark`:`light`}function tt(e=X){let t=null;try{t=window.localStorage.getItem(e)}catch{}return $e(t)?t:`auto`}function nt(e,t=X){try{window.localStorage.setItem(t,e)}catch{}}function rt(e){let t=document.documentElement,n=et(e);t.setAttribute(`data-theme`,e),t.setAttribute(`data-bs-theme`,n),document.dispatchEvent(new CustomEvent(Ye,{detail:{mode:n,preference:e}}))}var it=`(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 at(e=X){return`${it}${JSON.stringify(String(e)).replace(/</g,`\\u003c`)})`}function ot(e,{includeAuto:t=!1}={}){return e===`light`?`dark`:e===`dark`&&t?`auto`:`light`}function st(e){if(typeof window>`u`||typeof window.matchMedia!=`function`)return()=>{};let t=window.matchMedia(Ze),n=()=>e(t.matches?`dark`:`light`);return t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)}var ct=60,lt=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`,ut={amplitude:22,segments:36,cycles:1.5,ripples:2},dt=6,ft=(e,t,n,r,i)=>{let{amplitude:a,segments:o,cycles:s}=ut,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(`, `)})`},pt=(e,t,n,r)=>{let i=t/dt,a=[];for(let t=0;t<dt;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 mt(e,{width:t,height:n,to:r=`dark`,origin:i}={}){let a=r===`dark`,o=[];for(let r=0;r<=ct;r++){let s=r/ct,c=lt(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:pt(t,n,c,a)});break;case`fade`:o.push({clipPath:`none`,opacity:c});break;case`none`:return[];default:o.push({clipPath:ft(t,n,c,s*ut.ripples*2*Math.PI,a)})}}return o}function ht(e,{effect:t=qe,to:n,origin:r,duration:i,live:a}={}){let o=document.documentElement,s=n!==void 0&&o.getAttribute(`data-bs-theme`)===n;if(t===`none`||s||Qe(`(prefers-reduced-motion: reduce)`)||typeof document.startViewTransition!=`function`||typeof o.animate!=`function`)return e(),Promise.resolve(!1);o.classList.add(Je);let c=a instanceof Element?a:null;c&&(c.style.viewTransitionName=Xe);let l=document.startViewTransition(e),u=i??Z[t]??Z.wave;return l.ready.then(()=>{let e=mt(t,{width:window.innerWidth,height:window.innerHeight,to:n,origin:r});o.animate(e,{duration:u,easing:`linear`,fill:`both`,pseudoElement:`::view-transition-new(root)`})}).catch(()=>{}),l.finished.catch(()=>{}).then(()=>(o.classList.remove(Je),c&&(c.style.viewTransitionName=``),!0))}export{t as $,ve as A,ce as B,we as C,G as D,ze as E,A as F,u as G,re as H,fe as I,_ as J,v as K,ae as L,xe as M,Se as N,U as O,ee as P,e as Q,_e as R,R as S,Re as T,N as U,ie as V,l as W,y as X,g as Y,b as Z,ht as _,Ke as a,s as at,Be as b,Ge as c,ot as d,n as et,tt as f,mt as g,at as h,Ye as i,c as it,be as j,L as k,Je as l,nt as m,X as n,i as nt,Z as o,o as ot,et as p,h as q,it as r,a as rt,Xe as s,qe as t,r as tt,rt as u,st as v,Ce as w,We as x,K as y,ne as z};