@webority/ui-elements 0.143.1 → 0.144.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/{WuiDrawer-BJ8zqtQ2.js → WuiDrawer-SkxcDhgf.js} +1 -1
  2. package/dist/drawerDiscard-DdoTN5aX.js +1 -0
  3. package/dist/elements/drawer.js +1 -1
  4. package/dist/helpers.js +1 -1
  5. package/dist/server.js +1 -1
  6. package/dist/ui-elements/carousel.global.js +1 -1
  7. package/dist/ui-elements/code-block.global.js +1 -1
  8. package/dist/ui-elements/command-palette.global.js +1 -1
  9. package/dist/ui-elements/comment-thread.global.js +1 -1
  10. package/dist/ui-elements/consent-banner.global.js +1 -1
  11. package/dist/ui-elements/context-menu.global.js +1 -1
  12. package/dist/ui-elements/date-range.global.js +1 -1
  13. package/dist/ui-elements/drawer.global.js +1 -1
  14. package/dist/ui-elements/image-crop.global.js +1 -1
  15. package/dist/ui-elements/inline-edit.global.js +1 -1
  16. package/dist/ui-elements/kanban.global.js +1 -1
  17. package/dist/ui-elements/lead-popup.global.js +1 -1
  18. package/dist/ui-elements/lightbox.global.js +1 -1
  19. package/dist/ui-elements/markdown.global.js +1 -1
  20. package/dist/ui-elements/org-tree.global.js +1 -1
  21. package/dist/ui-elements/phone.global.js +1 -1
  22. package/dist/ui-elements/resizable.global.js +1 -1
  23. package/dist/ui-elements/saved-views.global.js +1 -1
  24. package/dist/ui-elements/select-chips.global.js +1 -1
  25. package/dist/ui-elements/select-search.global.js +1 -1
  26. package/dist/ui-elements/slider.global.js +1 -1
  27. package/dist/ui-elements/sortable.global.js +1 -1
  28. package/dist/ui-elements/status-icon.global.js +1 -1
  29. package/dist/ui-elements/timepicker.global.js +1 -1
  30. package/dist/ui-elements/tour.global.js +1 -1
  31. package/dist/ui-elements/tree.global.js +1 -1
  32. package/dist/ui-elements/wizard.global.js +1 -1
  33. package/dist/ui-elements.global.js +18 -18
  34. package/dist/ui-elements.js +1 -1
  35. package/package.json +3 -3
  36. package/dist/drawerDiscard-B5J5OEeg.js +0 -1
@@ -1 +1 @@
1
- import{t as e}from"./elementBase-DV9IZZCu.js";var t=[50,90],n=10,r=100;function i(e,i=t){let a=Array.isArray(e)?e:String(e??``).split(`,`),o=[];for(let e of a){if(typeof e==`string`&&e.trim()===``)return i;let t=Number(e);if(!Number.isFinite(t)||t<n||t>r)return i;o.includes(t)||o.push(t)}return o.length?o.sort((e,t)=>e-t):i}function a({points:e,index:t,visible:n,velocity:r,canDismiss:i}){let a=i?-1:0;if(Math.abs(r)>=.5)return r>0?Math.max(t-1,a):Math.min(t+1,e.length-1);if(i&&n<e[0]/2)return-1;let o=0;for(let t=1;t<e.length;t++)Math.abs(e[t]-n)<Math.abs(e[o]-n)&&(o=t);return o}var o=`(max-width: 767.98px)`,s=`a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`,c=4,l=0,u=/* @__PURE__ */ new WeakSet;function d(e){u.has(e)||(u.add(e),e.addEventListener(`click`,t=>{let n=t.target?.closest?.(`[data-wui-drawer-open]`);if(!n)return;let r=n.getAttribute(`data-wui-drawer-open`).replace(/^#/,``),i=e.getElementById(r);typeof i?.show==`function`&&(t.preventDefault(),i.show(n))}))}var f=class extends e{static get observedAttributes(){return[`open`,`snap-points`,`no-sheet`]}constructor(){super(),this._doc=null,this._media=null,this._shown=!1,this._locked=!1,this._opener=null,this._snap=0,this._drag=null,this._onMedia=()=>this._syncMode(),this._onClick=e=>this._click(e),this._onPointerDown=e=>this._pointerDown(e),this._onPointerMove=e=>this._pointerMove(e),this._onPointerUp=e=>this._pointerUp(e),this._onKeyDown=e=>this._keyDown(e),this._onHostKey=e=>{e.key===`Escape`&&this._keyDown(e)},this._onTransitionEnd=e=>{e.target===this._panel()&&e.propertyName===`transform`&&this._announce()},this._announced=!1}connectedCallback(){this._doc=this.ownerDocument,d(this._doc),this.addEventListener(`click`,this._onClick),this.addEventListener(`pointerdown`,this._onPointerDown),this.addEventListener(`transitionend`,this._onTransitionEnd),this._media=typeof matchMedia==`function`?matchMedia(o):null,this._media?.addEventListener?.(`change`,this._onMedia),this._syncMode(),this._applyPoints(),this.hasAttribute(`open`)?this._open():this.setAttribute(`inert`,``)}disconnectedCallback(){this._endDrag(),this._shown&&this._release(),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`pointerdown`,this._onPointerDown),this.removeEventListener(`transitionend`,this._onTransitionEnd),this._media?.removeEventListener?.(`change`,this._onMedia),this._media=null,this._doc=null}attributeChangedCallback(e){this._doc&&(e===`open`?this.hasAttribute(`open`)?this._open():this._close():e===`no-sheet`?this._syncMode():(this._snap=Math.min(this._snap,this._points().length-1),this._applyPoints()))}get isOpen(){return this.hasAttribute(`open`)}show(e){e&&(this._opener=e),this.setAttribute(`open`,``)}hide(){this.removeAttribute(`open`)}_points(){return i(this.getAttribute(`snap-points`),t)}_sheet(){return!!this._media?.matches&&!this.hasAttribute(`no-sheet`)}_syncMode(){this.setAttribute(`data-mode`,this._sheet()?`sheet`:`side`)}_applyPoints(){let e=this._points();this._snap=Math.min(Math.max(this._snap,0),e.length-1),this.style.setProperty(`--wui-drawer-max`,String(e[e.length-1])),this.style.setProperty(`--wui-drawer-snap`,String(e[this._snap])),this.setAttribute(`data-snap`,String(this._snap));let t=this.querySelector(`.wui-drawer-handle`);if(!t)return;let n=e[this._snap];t.setAttribute(`aria-valuemin`,String(e[0])),t.setAttribute(`aria-valuemax`,String(e[e.length-1])),t.setAttribute(`aria-valuenow`,String(n)),t.setAttribute(`aria-valuetext`,`${n}% of the screen`)}_setSnap(e){let t=this._points(),n=Math.min(Math.max(e,0),t.length-1),r=n!==this._snap;this._snap=n,this._applyPoints(),r&&this.dispatchEvent(new CustomEvent(`wui-drawer-snap`,{bubbles:!0,detail:{index:n,percent:t[n]}}))}_open(){if(this._shown)return;this._shown=!0;let e=this._doc;this._opener??=e.activeElement;let t=Number.parseInt(this.getAttribute(`default-snap`)??`0`,10);this._snap=Number.isFinite(t)?t:0,this._syncMode(),this._applyPoints(),this.removeAttribute(`inert`),this._locked||(this._locked=!0,l++,e.body.classList.add(`wui-drawer-locked`)),e.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`keydown`,this._onHostKey),this._focusIn(),this._settle()}_close(){if(!this._shown)return;this._endDrag(),this.setAttribute(`inert`,``);let e=this._doc,t=this._opener,n=e.activeElement;this._release(),this._opener=null,t?.isConnected&&(n===e.body||this.contains(n))&&t.focus?.(),this._settle()}_settle(){(this._panel()?.getAnimations?.()??[]).length||this._announce()}_announce(){let e=this.isOpen;e!==this._announced&&(this._announced=e,this.dispatchEvent(new CustomEvent(e?`wui-drawer-opened`:`wui-drawer-closed`,{bubbles:!0})))}_release(){this._shown=!1,this._doc?.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`keydown`,this._onHostKey),this._locked&&(this._locked=!1,l--,l<=0&&(l=0,this._doc?.body.classList.remove(`wui-drawer-locked`)))}_panel(){return this.querySelector(`.wui-drawer-panel`)}_focusables(){let e=this._panel();return e?Array.from(e.querySelectorAll(s)).filter(e=>!e.closest(`[hidden],[inert]`)):[]}_focusIn(){let e=this._panel();if(!e)return;let t=e.querySelector(`[data-autofocus]`),n=this._sheet()?null:this._focusables().find(e=>e.closest(`.wui-drawer-body`));(t||n||e).focus?.()}_dismissible(){return!this.hasAttribute(`static`)&&!this.hasAttribute(`no-dismiss`)}_requestClose(){let e=this.dispatchEvent(new CustomEvent(`wui-drawer-close`,{bubbles:!0,cancelable:!0}));return e&&this.hide(),e}_click(e){if(!this.isOpen)return;let t=e.target;(t.closest?.(`[data-wui-drawer-close]`)||t.closest?.(`[data-wui-drawer-backdrop]`)&&this._dismissible())&&this._requestClose()}_keyDown(e){if(e.key===`Escape`){if(e.defaultPrevented||!this._dismissible()||this._doc.querySelector(`.modal.show`))return;e.preventDefault(),e.stopPropagation(),this._requestClose()}else e.key===`Tab`?this._trapTab(e):e.target?.closest?.(`.wui-drawer-handle`)&&this._sheet()&&this._handleKey(e)}_trapTab(e){let t=this._focusables(),n=this._panel();if(!t.length){e.preventDefault(),n?.focus?.();return}let r=t[0],i=t[t.length-1],a=this._doc.activeElement;!n?.contains(a)||a===n?(e.preventDefault(),(e.shiftKey?i:r).focus()):e.shiftKey&&a===r?(e.preventDefault(),i.focus()):!e.shiftKey&&a===i&&(e.preventDefault(),r.focus())}_handleKey(e){let t=this._points().length-1,n={ArrowUp:this._snap+1,ArrowDown:this._snap-1,Home:0,End:t};e.key in n&&(e.preventDefault(),this._setSnap(n[e.key]))}_pointerDown(e){if(!this.isOpen||!this._sheet()||(e.button??0)!==0)return;let t=e.target?.closest?.(`[data-wui-drawer-grip]`);t&&!e.target.closest(`button`)&&(this._drag={grip:t,id:e.pointerId,startY:e.clientY,lastY:e.clientY,lastT:e.timeStamp,velocity:0,moved:!1},t.setPointerCapture?.(e.pointerId),t.addEventListener(`pointermove`,this._onPointerMove),t.addEventListener(`pointerup`,this._onPointerUp),t.addEventListener(`pointercancel`,this._onPointerUp))}_viewport(){return this._doc.defaultView.innerHeight}_pointerMove(e){let t=this._drag;if(!t||e.pointerId!==t.id)return;let n=e.clientY-t.startY;if(!t.moved&&Math.abs(n)<c)return;t.moved=!0,this.classList.add(`is-dragging`);let r=e.timeStamp-t.lastT;r>0&&(t.velocity=(e.clientY-t.lastY)/r),t.lastY=e.clientY,t.lastT=e.timeStamp;let i=this._points(),a=(i[i.length-1]-i[this._snap])/100*this._viewport();t.offset=Math.max(n,-a),this.style.setProperty(`--wui-drawer-drag`,`${t.offset}px`)}_pointerUp(e){let t=this._drag;if(!t||e.pointerId!==t.id)return;let{moved:n,velocity:r,offset:i=0}=t;if(this._endDrag(),!n)return;let o=this._points(),s=this._viewport(),c=(o[this._snap]/100*s-i)/(s/100),l=this._dismissible(),u=a({points:o,index:this._snap,visible:c,velocity:r,canDismiss:l});u>=0?this._setSnap(u):this._requestClose()}_endDrag(){let e=this._drag;e&&(this._drag=null,e.grip.releasePointerCapture?.(e.id),e.grip.removeEventListener(`pointermove`,this._onPointerMove),e.grip.removeEventListener(`pointerup`,this._onPointerUp),e.grip.removeEventListener(`pointercancel`,this._onPointerUp),this.classList.remove(`is-dragging`),this.style.removeProperty(`--wui-drawer-drag`))}};export{f as t};
1
+ import{t as e}from"./elementBase-DV9IZZCu.js";var t=[50,90],n=10,r=100;function i(e,i=t){let a=Array.isArray(e)?e:String(e??``).split(`,`),o=[];for(let e of a){if(typeof e==`string`&&e.trim()===``)return i;let t=Number(e);if(!Number.isFinite(t)||t<n||t>r)return i;o.includes(t)||o.push(t)}return o.length?o.sort((e,t)=>e-t):i}function a({points:e,index:t,visible:n,velocity:r,canDismiss:i}){let a=i?-1:0;if(Math.abs(r)>=.5)return r>0?Math.max(t-1,a):Math.min(t+1,e.length-1);if(i&&n<e[0]/2)return-1;let o=0;for(let t=1;t<e.length;t++)Math.abs(e[t]-n)<Math.abs(e[o]-n)&&(o=t);return o}var o=`(max-width: 767.98px)`,s=`a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`,c=4,l=0,u=/* @__PURE__ */ new WeakSet;function d(e){u.has(e)||(u.add(e),e.addEventListener(`click`,t=>{let n=t.target?.closest?.(`[data-wui-drawer-open]`);if(!n)return;let r=n.getAttribute(`data-wui-drawer-open`).replace(/^#/,``),i=e.getElementById(r);typeof i?.show==`function`&&(t.preventDefault(),i.show(n))}))}var f=class extends e{static get observedAttributes(){return[`open`,`snap-points`,`no-sheet`]}constructor(){super(),this._doc=null,this._media=null,this._shown=!1,this._locked=!1,this._opener=null,this._snap=0,this._drag=null,this._onMedia=()=>this._syncMode(),this._onClick=e=>this._click(e),this._onPointerDown=e=>this._pointerDown(e),this._onPointerMove=e=>this._pointerMove(e),this._onPointerUp=e=>this._pointerUp(e),this._onKeyDown=e=>this._keyDown(e),this._onHostKey=e=>{e.key===`Escape`&&this._keyDown(e)},this._onTransitionEnd=e=>{e.target===this._panel()&&e.propertyName===`transform`&&this._announce()},this._announced=!1}connectedCallback(){this._doc=this.ownerDocument,d(this._doc),this.addEventListener(`click`,this._onClick),this.addEventListener(`pointerdown`,this._onPointerDown),this.addEventListener(`transitionend`,this._onTransitionEnd),this._media=typeof matchMedia==`function`?matchMedia(o):null,this._media?.addEventListener?.(`change`,this._onMedia),this._syncMode(),this._applyPoints(),this.hasAttribute(`open`)?this._open():this.setAttribute(`inert`,``)}disconnectedCallback(){this._endDrag(),this._shown&&this._release(),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`pointerdown`,this._onPointerDown),this.removeEventListener(`transitionend`,this._onTransitionEnd),this._media?.removeEventListener?.(`change`,this._onMedia),this._media=null,this._doc=null}attributeChangedCallback(e){this._doc&&(e===`open`?this.hasAttribute(`open`)?this._open():this._close():e===`no-sheet`?this._syncMode():(this._snap=Math.min(this._snap,this._points().length-1),this._applyPoints()))}get isOpen(){return this.hasAttribute(`open`)}show(e){e&&(this._opener=e),this.setAttribute(`open`,``)}hide(){this.removeAttribute(`open`)}_points(){return i(this.getAttribute(`snap-points`),t)}_sheet(){return!!this._media?.matches&&!this.hasAttribute(`no-sheet`)}_syncMode(){this.setAttribute(`data-mode`,this._sheet()?`sheet`:`side`)}_applyPoints(){let e=this._points();this._snap=Math.min(Math.max(this._snap,0),e.length-1),this.style.setProperty(`--wui-drawer-max`,String(e[e.length-1])),this.style.setProperty(`--wui-drawer-snap`,String(e[this._snap])),this.setAttribute(`data-snap`,String(this._snap));let t=this.querySelector(`.wui-drawer-handle`);if(!t)return;let n=e[this._snap];t.setAttribute(`aria-valuemin`,String(e[0])),t.setAttribute(`aria-valuemax`,String(e[e.length-1])),t.setAttribute(`aria-valuenow`,String(n)),t.setAttribute(`aria-valuetext`,`${n}% of the screen`)}_setSnap(e){let t=this._points(),n=Math.min(Math.max(e,0),t.length-1),r=n!==this._snap;this._snap=n,this._applyPoints(),r&&this.dispatchEvent(new CustomEvent(`wui-drawer-snap`,{bubbles:!0,detail:{index:n,percent:t[n]}}))}_open(){if(this._shown)return;this._shown=!0;let e=this._doc;this._opener??=e.activeElement;let t=Number.parseInt(this.getAttribute(`default-snap`)??`0`,10);this._snap=Number.isFinite(t)?t:0,this._syncMode(),this._applyPoints(),this.removeAttribute(`inert`),this._locked||(this._locked=!0,l++,e.body.classList.add(`wui-drawer-locked`)),e.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`keydown`,this._onHostKey),this._focusIn(),this._settle()}_close(){if(!this._shown)return;this._endDrag(),this.setAttribute(`inert`,``);let e=this._doc,t=this._opener,n=e.activeElement;this._release(),this._opener=null,t?.isConnected&&(n===e.body||this.contains(n))&&t.focus?.(),this._settle()}_settle(){(this._panel()?.getAnimations?.()??[]).length||this._announce()}_announce(){let e=this.isOpen;e!==this._announced&&(this._announced=e,this.dispatchEvent(new CustomEvent(e?`wui-drawer-opened`:`wui-drawer-closed`,{bubbles:!0})))}_release(){this._shown=!1,this._doc?.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`keydown`,this._onHostKey),this._locked&&(this._locked=!1,l--,l<=0&&(l=0,this._doc?.body.classList.remove(`wui-drawer-locked`)))}_panel(){return this.querySelector(`.wui-drawer-panel`)}_focusables(){let e=this._panel();return e?Array.from(e.querySelectorAll(s)).filter(e=>!e.closest(`[hidden],[inert]`)):[]}_focusIn(){let e=this._panel();if(!e)return;let t=e.querySelector(`[data-autofocus]`),n=this._sheet()?null:this._focusables().find(e=>e.closest(`.wui-drawer-body`));(t||n||e).focus?.({preventScroll:!0})}_dismissible(){return!this.hasAttribute(`static`)&&!this.hasAttribute(`no-dismiss`)}_requestClose(){let e=this.dispatchEvent(new CustomEvent(`wui-drawer-close`,{bubbles:!0,cancelable:!0}));return e&&this.hide(),e}_click(e){if(!this.isOpen)return;let t=e.target;(t.closest?.(`[data-wui-drawer-close]`)||t.closest?.(`[data-wui-drawer-backdrop]`)&&this._dismissible())&&this._requestClose()}_keyDown(e){if(e.key===`Escape`){if(e.defaultPrevented||!this._dismissible()||this._doc.querySelector(`.modal.show`))return;e.preventDefault(),e.stopPropagation(),this._requestClose()}else e.key===`Tab`?this._trapTab(e):e.target?.closest?.(`.wui-drawer-handle`)&&this._sheet()&&this._handleKey(e)}_trapTab(e){let t=this._focusables(),n=this._panel();if(!t.length){e.preventDefault(),n?.focus?.();return}let r=t[0],i=t[t.length-1],a=this._doc.activeElement;!n?.contains(a)||a===n?(e.preventDefault(),(e.shiftKey?i:r).focus()):e.shiftKey&&a===r?(e.preventDefault(),i.focus()):!e.shiftKey&&a===i&&(e.preventDefault(),r.focus())}_handleKey(e){let t=this._points().length-1,n={ArrowUp:this._snap+1,ArrowDown:this._snap-1,Home:0,End:t};e.key in n&&(e.preventDefault(),this._setSnap(n[e.key]))}_pointerDown(e){if(!this.isOpen||!this._sheet()||(e.button??0)!==0)return;let t=e.target?.closest?.(`[data-wui-drawer-grip]`);t&&!e.target.closest(`button`)&&(this._drag={grip:t,id:e.pointerId,startY:e.clientY,lastY:e.clientY,lastT:e.timeStamp,velocity:0,moved:!1},t.setPointerCapture?.(e.pointerId),t.addEventListener(`pointermove`,this._onPointerMove),t.addEventListener(`pointerup`,this._onPointerUp),t.addEventListener(`pointercancel`,this._onPointerUp))}_viewport(){return this._doc.defaultView.innerHeight}_pointerMove(e){let t=this._drag;if(!t||e.pointerId!==t.id)return;let n=e.clientY-t.startY;if(!t.moved&&Math.abs(n)<c)return;t.moved=!0,this.classList.add(`is-dragging`);let r=e.timeStamp-t.lastT;r>0&&(t.velocity=(e.clientY-t.lastY)/r),t.lastY=e.clientY,t.lastT=e.timeStamp;let i=this._points(),a=(i[i.length-1]-i[this._snap])/100*this._viewport();t.offset=Math.max(n,-a),this.style.setProperty(`--wui-drawer-drag`,`${t.offset}px`)}_pointerUp(e){let t=this._drag;if(!t||e.pointerId!==t.id)return;let{moved:n,velocity:r,offset:i=0}=t;if(this._endDrag(),!n)return;let o=this._points(),s=this._viewport(),c=(o[this._snap]/100*s-i)/(s/100),l=this._dismissible(),u=a({points:o,index:this._snap,visible:c,velocity:r,canDismiss:l});u>=0?this._setSnap(u):this._requestClose()}_endDrag(){let e=this._drag;e&&(this._drag=null,e.grip.releasePointerCapture?.(e.id),e.grip.removeEventListener(`pointermove`,this._onPointerMove),e.grip.removeEventListener(`pointerup`,this._onPointerUp),e.grip.removeEventListener(`pointercancel`,this._onPointerUp),this.classList.remove(`is-dragging`),this.style.removeProperty(`--wui-drawer-drag`))}};export{f as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./buttonClass-DpG9WzgJ.js";import{t as n}from"./loader-CVFmEPjv.js";import{n as r,t as i}from"./devWarn-DXdRWZs3.js";import{l as a,s as o}from"./wuiHttp-DgnM7K2Q.js";import{E as s,k as c,r as l,w as u,y as ee}from"./dataTable-BGZc5iC1.js";import{t as d}from"./iconGlyphs.g-BlwTSNXS.js";import{LIST_QUERY_RESERVED as te,SEARCH_PARAM as f}from"./listQuery.js";function p(e,t){e&&(e.tip?.isConnected?(t.addEventListener(`hidden${e.constructor.EVENT_KEY}`,()=>e.dispose(),{once:!0}),e.hide()):e.dispose())}var m=`wui-remote-modal`,h=`wui-remote-drawer`,g=Object.freeze({sm:360,md:480,lg:640,xl:720}),_=`wui-modal-fullscreen`,v=Object.freeze({sm:380,md:440,lg:640,xl:880}),y=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.`}),b=`a[href],button:not([disabled]),input:not([disabled]):not([type="hidden"]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`,ne=`input:not([type="hidden"]):not([disabled]),select:not([disabled]),textarea:not([disabled]),[contenteditable="true"]`,x=`[aria-invalid="true"], .is-invalid, .input-validation-error`,S=`.wui-error-summary, [data-wui-form-errors], .validation-summary-errors, [data-valmsg-summary]`,C=`[data-wui-modal-content]`,re=`[data-wui-pane-close], [data-bs-dismiss="modal"]`,ie=`<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>`,w=/* @__PURE__ */ new WeakMap,T=/* @__PURE__ */ new WeakSet,E=()=>Object.assign(/* @__PURE__ */ Error(`The remote modal load was aborted.`),{name:`AbortError`}),ae=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},D=e=>{let t=document.createElement(`span`);return t.textContent=e??``,t.innerHTML};function oe(e){if(e==null||e===``)return null;if(e===`fullscreen`)return{fullscreen:!0};if(Object.hasOwn(v,e))return{px:v[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 se=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:v.md}},O=(e,t)=>{e.classList.toggle(_,!!t.fullscreen),t.fullscreen?e.style.removeProperty(`--wui-modal-max-width`):e.style.setProperty(`--wui-modal-max-width`,`${t.px}px`)},ce=[`center`,`top`];function le(e){if(e==null||e===``)return null;if(Object.hasOwn(g,e))return{px:g[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 drawer size "${String(e)}". Use sm, md, lg, xl or a px number.`)}var k=e=>e.container===`drawer`,A=e=>e.container===`pane`,j=e=>e.container!==`modal`,ue=(e,t)=>k(e)?le(t):oe(t),M=()=>document.getElementById(`wui-remote-drawer`)?.classList.contains(`show`)??!1,de=e=>{let t=typeof e==`string`?document.querySelector(e):e;return t?.matches?.(`[data-wui-pane-host]`)?t:null},fe=e=>A(e)?e.shell:e.shell.querySelector(`.modal-dialog`);function pe(e=`modal`){let t=e===`drawer`,n=t?h:m,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?g.md:v.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 me=e=>`<div class="wui-modal-header"><div class="wui-modal-heading"><div class="wui-modal-headtext"><div class="wui-modal-title">${D(e)}</div></div></div>${ie}</div>`,he=e=>`<div class="modal-content wui-modal" aria-busy="true">${me(e)}<div class="wui-modal-body"><div class="wui-modal-loading" role="status"><span class="visually-hidden">${D(y.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>`,N=(n,r)=>`<div class="modal-content wui-modal" data-wui-modal-error="${D(r)}">${me(n)}<div class="wui-modal-body"><div class="wui-modal-state" role="alert"><p class="wui-modal-state-title">${D(y.errorTitle)}</p><p class="wui-modal-state-text">${D(y[r]||y.server)}</p><div class="wui-modal-state-actions"><button type="button" class="${e(`soft`,`md`)}" data-bs-dismiss="modal" data-wui="${t}">${D(y.close)}</button><button type="button" class="${e(`primary`,`md`)}" data-wui-modal-retry data-wui="${t}">${D(y.retry)}</button></div></div></div></div>`,ge=e=>{let t=document.createElement(`template`);return t.innerHTML=e,t.content.querySelector(`.modal-content`)},P=e=>e.shell.querySelector(`.modal-content`);function _e(e){if(!e)return;e.dispatchEvent(new CustomEvent(`wui:teardown`,{bubbles:!0}));let t=window.bootstrap,n=[t?.Tooltip,t?.Popover].filter(e=>e?.getInstance);for(let r of[e,...e.querySelectorAll(`*`)]){for(let e of n)p(e.getInstance(r),r);t?.Dropdown?.getInstance?.(r)?.dispose()}}function F(e,t){let n=P(e),r=n?ye(n):/* @__PURE__ */ new Map;_e(n),n?n.replaceWith(t):fe(e).appendChild(t),be(t,r),window.WUI?.refresh?.()}var ve=`input[type="file"][name]`;function ye(e){let t=/* @__PURE__ */ new Map;for(let n of e.querySelectorAll(ve))n.files.length>0&&t.set(n.name,[...n.files]);return t}function be(e,t){if(t.size!==0&&typeof DataTransfer<`u`)for(let n of e.querySelectorAll(ve)){let e=t.get(n.name);if(!e)continue;let r=new DataTransfer;for(let t of e)r.items.add(t);n.files=r.files,n.dispatchEvent(new Event(`change`,{bubbles:!0}))}}var xe=e=>A(e)?!e.shell.hidden:e.shell.classList.contains(`show`);function I(e,t,n=!1){let r=t&&e.querySelector(x),i=r?r.matches(b)?r:r.querySelector(b)||r:null;if(!i&&n)i=e.querySelector(`[data-autofocus]`)||e.querySelector(ne)||e.querySelector(`.wui-modal-close`);else if(!i){let t=[...e.querySelectorAll(b)];i=e.querySelector(`[data-autofocus]`)||t.find(e=>!e.classList.contains(`wui-modal-close`))||t[0]||e}r?i?.focus?.():i?.focus?.({preventScroll:!0})}function L(e,t){let n=[...e.querySelectorAll(b)].filter(e=>e.getClientRects().length>0&&getComputedStyle(e).visibility!==`hidden`);if(!n.length){t.preventDefault(),e.focus();return}let r=n[0],i=n[n.length-1],a=document.activeElement;!e.contains(a)||a===e?(t.preventDefault(),(t.shiftKey?i:r).focus()):t.shiftKey&&a===r?(t.preventDefault(),i.focus()):!t.shiftKey&&a===i&&(t.preventDefault(),r.focus())}function Se(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`,``),fe(e).appendChild(n)),n.textContent=``,n.textContent=t}var Ce=e=>{let t=e.shell.querySelector(`[data-wui-modal-live]`);t&&(t.textContent=``)},we=(e,t,n)=>e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n}));function R(e,t,n,r){let i={...r,container:e.container};we(t,`wui:modal:${n}`,i),k(e)&&we(t,`wui:drawer:${n}`,i),A(e)&&we(t,`wui:pane:${n}`,i)}var Te=e=>e.matches(`[data-wui-pane-host]`)?`pane`:e.classList.contains(`wui-remote-drawer`)?`drawer`:`modal`;function z(e){let t=w.get(e);return t||(t={shell:e,container:Te(e),queue:o(),defaultSize:se(e),defaultLabel:e.getAttribute(`aria-label`),placeholder:P({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},w.set(e,t),e.addEventListener(`submit`,e=>Ue(t,e)),e.addEventListener(`click`,e=>{e.target.closest?.(`[data-wui-modal-retry]`)&&t.session&&(e.preventDefault(),H(t,t.session))}),A(t)&&e.addEventListener(`click`,e=>{let n=e.target.closest?.(re);n&&e.currentTarget.contains(n)&&t.session&&V(t,t.session,`dismissed`,null)}),e.addEventListener(`hidden.bs.modal`,n=>{n.target===e&&(e.classList.contains(`wui-modal-stacked`)&&De(t),Oe(t))}),e.addEventListener(`shown.bs.modal`,n=>{if(n.target!==e)return;e.classList.contains(`wui-modal-stacked`)&&[...document.querySelectorAll(`.modal-backdrop`)].at(-1)?.classList.add(`wui-modal-backdrop-stacked`);let r=P(t);t.session&&r?.matches(C)&&!r.contains(document.activeElement)&&I(r,!1,j(t))}),t.remoteUrl&&e.addEventListener(`show.bs.modal`,n=>{n.target===e&&ke(t,n)}),t)}function B(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:()=>V(e,a,`dismissed`,null),reload:()=>H(e,a)},e.session=a,a}function V(e,t,n,r){e.session===t&&(t.closing={status:n,detail:r},A(e)?Ee(e,t):window.bootstrap?.Modal?.getOrCreateInstance(e.shell).hide())}function Ee(e,t){let n=e.shell,{status:r,detail:i}=t.closing,a=n.contains(document.activeElement);e.queue.abort(),e.session=null,_e(P(e)),n.replaceChildren(),n.hidden=!0,n.removeAttribute(`data-open`),t.resolveClosed({status:r,detail:i}),R(e,n,`closed`,{status:r,url:t.url}),a&&t.trigger?.isConnected&&t.trigger.focus?.()}function De(e){e.shell.classList.remove(`wui-modal-stacked`),M()&&(document.body.classList.add(`modal-open`),document.body.style.overflow=`hidden`)}function Oe(e){let t=e.session;if(e.queue.abort(),e.session=null,Ce(e),t){let{status:n,detail:r}=t.closing||{status:`dismissed`,detail:null};t.resolveClosed({status:n,detail:r}),R(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||(F(e,ge(e.placeholder)),e.loadedUrl=null,O(e.shell,e.defaultSize),e.defaultLabel?e.shell.setAttribute(`aria-label`,e.defaultLabel):e.shell.removeAttribute(`aria-label`))}function ke(e,t){let n=t.relatedTarget instanceof Element?t.relatedTarget:null,r=n?.getAttribute(`data-wui-url`)||e.remoteUrl,i=B(e,r,{trigger:n});i.explicitSize=Ae(e,n?.getAttribute(`data-wui-size`)),i.explicitSize&&O(e.shell,i.explicitSize),e.cache&&e.loadedUrl===r||(e.loadedUrl&&F(e,ge(e.placeholder)),H(e,i,{keepPlaceholder:!0}))}function Ae(e,t){try{return ue(e,t)}catch(e){return i(e),null}}async function H(e,t,{keepPlaceholder:n=!1}={}){n||F(e,ge(he(t.options.title||je(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`)&&Fe(e,t,r.html,!1))return e.loadedUrl=t.url,R(e,e.shell,`loaded`,{url:t.url,handle:t.handle}),`loaded`;let i=r.kind===`ok`||r.kind===`validation`?`server`:r.kind;return F(e,ge(N(t.options.title||je(e),i))),xe(e)&&I(P(e),!1,j(e)),R(e,e.shell,`error`,{url:t.url,kind:i,status:r.status}),`error`}var je=e=>P(e)?.querySelector(`.wui-modal-title`)?.textContent||e.shell.getAttribute(`aria-label`)||``,Me=`/_content/Webority.Ui.Razor/js/`,Ne=e=>new URL(e,window.location.href).pathname.includes(Me);function Pe(e){if([...document.scripts].some(t=>t.getAttribute(`src`)===e))return;let t=document.createElement(`script`);t.src=e,document.head.appendChild(t)}function Fe(e,t,n,a){let o=document.createElement(`template`);o.innerHTML=n;let s=!1;for(let e of o.content.querySelectorAll(`script`)){if(e.getAttribute(`type`)===`application/json`)continue;let t=e.getAttribute(`src`);e.remove(),t&&Ne(t)?Pe(t):s=!0}s&&r(`WUI.modal: ${t.url} returned a fragment with script; it was removed. Keep page behaviour in the page.`);let c=o.content.querySelector(C);if(!c)return i(`WUI.modal: ${t.url} did not answer with an <app-modal-content> fragment.`),!1;if(F(e,c),a||Ce(e),!A(e)){O(e.shell,t.explicitSize||Ae(e,c.getAttribute(`data-wui-size`))||e.defaultSize);let n=c.getAttribute(`data-wui-title`);n&&e.shell.setAttribute(`aria-label`,n)}return xe(e)&&I(c,a,j(e)),!0}var Ie=`button[type="submit"], button:not([type]), input[type="submit"], input[type="image"]`;function Le(e,t,n){let r=[...e.elements].filter(e=>e.matches(Ie));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>`))}else{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 Re(e){for(let t of e.querySelectorAll(S))t.remove();for(let t of e.querySelectorAll(x))t.removeAttribute(`aria-invalid`),t.classList.remove(`is-invalid`,`input-validation-error`);for(let t of e.querySelectorAll(`.field-error`))t.textContent=``}var ze=/* @__PURE__ */ new Set(/* @__PURE__ */ `bad request.unauthorized.payment required.forbidden.not found.method not allowed.not acceptable.proxy authentication required.request timeout.conflict.gone.length required.precondition failed.payload too large.uri too long.unsupported media type.range not satisfiable.expectation failed.misdirected request.unprocessable content.unprocessable entity.locked.failed dependency.too early.upgrade required.precondition required.too many requests.request header fields too large.unavailable for legal reasons`.split(`.`));async function Be(e){if(!e||e.status<400||e.status>499||e.status===422||!e.headers.get(`content-type`)?.toLowerCase().includes(`json`))return null;let t;try{t=JSON.parse(await e.text())}catch{return null}let n=e=>typeof e==`string`?e.trim():``,r=n(t?.title),i=(e.statusText||``).trim().toLowerCase(),a=ze.has(r.toLowerCase())||r.toLowerCase()===i;return n(t?.message)||n(t?.detail)||(r&&!a?r:null)}function Ve(e,t,n,r){let i=t.closest(`.wui-modal-body`)||t;i.querySelector(`[data-wui-modal-submit-error]`)?.remove(),Re(i);let a=document.createElement(`div`);a.className=`alert alert-danger wui-modal-submit-error`,a.setAttribute(`role`,`alert`),a.setAttribute(`data-wui-modal-submit-error`,``),a.innerHTML=D(`${y.submitFailed} ${r||y[n]||y.server}`),i.prepend(a),Se(e,a.textContent)}var He=(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 Ue(e,t){let n=t.target,r=e.session;if(!(n instanceof HTMLFormElement)||!r||n.hasAttribute(`data-wui-native`)||!n.closest(C)||(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`;Le(n,i,!0);let l=await e.queue.run(c?He(a,s):a,{method:o,body:c?void 0:s,navigate:r.options.navigate});if(e.session!==r)return;if(n.isConnected&&Le(n,i,!1),l.kind===`ok`&&l.result===`success`){We(e,r,l);return}if(l.kind===`aborted`||l.kind===`stale`||l.kind===`session`)return;if(l.kind===`validation`&&Fe(e,r,l.html,!0)){let t=P(e).querySelector(S)?.textContent.replace(/\s+/g,` `).trim();Se(e,t||y.invalid);return}if(l.kind===`ok`&&l.html&&Fe(e,r,l.html,!1))return;let u=l.kind===`ok`||l.kind===`validation`?`server`:l.kind,ee=await Be(l.response);e.session===r&&Ve(e,n,u,ee)}function We(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};r&&window.WUI?.toast?.(r,{variant:`success`}),R(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,H(e,t)):n.keepOpen?n.html&&Fe(e,t,n.html,!1):V(e,t,`success`,a)}function Ge(e){let t=e.target.closest?.(`[data-wui-modal], [data-wui-drawer], [data-wui-pane]`);t&&(t.matches(`a[href]`)&&(e.ctrlKey||e.metaKey||e.shiftKey||e.button!==0)||(e.preventDefault(),t.hasAttribute(`data-wui-pane`)?$e(t.getAttribute(`data-wui-pane`),{target:t.getAttribute(`data-wui-pane-target`),trigger:t}).catch(e=>{e?.name!==`AbortError`&&i(e)}):t.hasAttribute(`data-wui-modal`)?Ye(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`&&i(e)}):Ze(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`&&i(e)})))}function Ke(e){if(e.key!==`Tab`||e.defaultPrevented)return;let t=e.currentTarget.querySelectorAll(`.modal.show`),n=e.currentTarget.querySelector(`.modal.show.wui-modal-stacked`)??t[t.length-1];n&&L(n,e)}function qe(e){if(e.key!==`Escape`||e.defaultPrevented)return;let t=e.target.closest?.(Qe),n=t&&w.get(t);n?.session&&!e.currentTarget.querySelector(`.modal.show`)&&V(n,n.session,`dismissed`,null)}function Je(e=document){let t=e.ownerDocument||e;T.has(t)||(T.add(t),t.addEventListener(`click`,Ge),t.addEventListener(`keydown`,Ke),t.addEventListener(`keydown`,qe));let n=[...e.querySelectorAll?.(`.modal[data-wui-remote-url]`)||[]];e.matches?.(`.modal[data-wui-remote-url]`)&&n.unshift(e);for(let e of n)z(e)}function Ye(e,t={}){try{if(!e)throw TypeError(`WUI.modal.load: a fragment url is required.`);let n=ae(e),r=t.container===`drawer`,i=r?le(t.size):oe(t.size),a=t.placement||`center`;if(!ce.includes(a))throw TypeError(`WUI.modal.load: unsupported placement "${a}". Use center or top.`);if(t.signal?.aborted)return Promise.reject(E());let o=pe(r?`drawer`:`modal`);Je(document);let s=z(o),c=xe(s),l=B(s,e,t);l.explicitSize=i,O(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||(!r&&M()&&(document.body.appendChild(o),o.classList.add(`wui-modal-stacked`)),n.getInstance(o)?.dispose(),n.getOrCreateInstance(o,{backdrop:t.staticBackdrop===!1||`static`,keyboard:t.staticBackdrop===!1}));let u=c?Promise.resolve():new Promise(e=>o.addEventListener(`shown.bs.modal`,()=>e(),{once:!0})),ee=H(s,l);return c||n.getOrCreateInstance(o).show(),Xe(s,l,t,u,ee,`WUI.modal.load`)}catch(e){return Promise.reject(e)}}function Xe(e,t,n,r,i,a){let o=new Promise((r,i)=>{n.signal?.addEventListener(`abort`,()=>{e.session===t&&(e.queue.abort(),V(e,t,`dismissed`,{aborted:!0})),i(E())},{once:!0})}),s=Promise.all([r,i]).then(([,e])=>{if(e===`aborted`)throw E();if(e===`session`)throw Error(`${a}(${t.url}): the session expired; the browser is signing in again.`);return t.handle});return Promise.race([s,o])}function Ze(e,t={}){return Ye(e,{...t,container:`drawer`,placement:void 0})}var Qe=`[data-wui-pane-host]`;function $e(e,t={}){try{if(!e)throw TypeError(`WUI.pane.load: a fragment url is required.`);let n=de(t.target);if(!n)throw TypeError(`WUI.pane.load: the target is not an <app-detail-pane>.`);if(t.signal?.aborted)return Promise.reject(E());Je(document);let r=z(n),i=B(r,e,t);n.hidden=!1,n.setAttribute(`data-open`,``);let a=H(r,i);return Xe(r,i,t,Promise.resolve(),a,`WUI.pane.load`)}catch(e){return Promise.reject(e)}}function et(e){let t=de(e);if(!t)throw TypeError(`WUI.pane.close: the target is not an <app-detail-pane>.`);let n=w.get(t);n?.session&&V(n,n.session,`dismissed`,null)}var tt=`Select all rows`,nt=`Select row`,U=`wui-select-cell`,rt=(e,t)=>{let n=e.createElement(`input`);return n.type=`checkbox`,n.className=`wui-check`,n.setAttribute(`aria-label`,t),n};function it(e=document){let t=e.createElement(`th`);return t.className=U,t.appendChild(rt(e,tt)),t}function at(e=document,{disabled:t=!1}={}){let n=e.createElement(`td`);n.className=U;let r=rt(e,nt);return r.disabled=t,n.appendChild(r),n}function ot(e=document){let t=e.createElement(`td`);return t.className=U,t}var st=e=>e.firstElementChild?.classList.contains(U),ct=e=>e.matches(`.wui-group-row, .wui-virtual-spacer`);function lt(e){for(let t of e){if(st(t)||ct(t))continue;let e=t.getAttribute(`data-row-selectable`)===`false`;t.insertBefore(at(t.ownerDocument,{disabled:e}),t.firstChild)}}function ut(e){let t=e.querySelector(`thead tr`);if(!t)return null;st(t)||t.insertBefore(it(e.ownerDocument),t.firstChild),lt(e.querySelectorAll(`tbody tr`));for(let t of e.querySelectorAll(`tfoot tr`))st(t)||t.insertBefore(ot(e.ownerDocument),t.firstChild);return t.querySelector(`.${U} .wui-check`)}function dt(e){let t=e.querySelector(`thead .${U} .wui-check`),n=[...e.querySelectorAll(`tbody tr .wui-check:not(:disabled)`)],r=n.length,i=n.filter(e=>e.checked).length;t&&(t.checked=r>0&&i===r,t.indeterminate=i>0&&i<r);for(let t of e.querySelectorAll(`tbody tr`))t.classList.toggle(`is-selected`,!!t.querySelector(`.wui-check`)?.checked);return{selected:i,total:r}}var ft=`tbody .${U} .wui-check:not(:disabled)`;function pt(e,t){let n=null,r=e=>e instanceof Element&&e.matches(`.wui-select-cell .wui-check:not(:disabled)`)&&!!e.closest(`tbody`);e.addEventListener(`mousedown`,e=>{e.shiftKey&&r(e.target)&&e.preventDefault()}),e.addEventListener(`click`,i=>{let a=i.target;if(r(a)){if(i.shiftKey&&n?.isConnected&&n!==a){let r=[...e.querySelectorAll(ft)],i=r.indexOf(n),o=r.indexOf(a);if(i>=0&&o>=0){let e=[];for(let t of r.slice(Math.min(i,o),Math.max(i,o)+1))t!==a&&t.checked!==a.checked&&(t.checked=a.checked,e.push(t));e.length&&t?.(e,a.checked)}}n=a}})}var mt=8e3,ht=`That did not work. Try again.`;function gt(e,t=`success`){if(!e?.message)return;let n=e.toastAction;n?window.WUI?.toast?.(e.message,{variant:t,duration:mt,action:{label:n.label,onClick:()=>_t(n)}}):window.WUI?.toast?.(e.message,{variant:t})}async function _t(e){let t=await a(e.url,{method:e.method});if(t.kind!==`session`&&t.kind!==`aborted`){if(t.ok){gt(t,t.toastVariant||`success`);for(let e of document.querySelectorAll(`[data-wui-server]`))e.dataset.refreshOnSuccess!==`false`&&Dt(e)?.reload()}else window.WUI?.toast?.(t.message||ht,{variant:`danger`})}}var W=Object.freeze({loading:`Loading rows`,error:`These rows did not load. Try again.`,network:`The connection dropped before the rows loaded. Check it and try again.`,forbidden:`You do not have access to these rows.`,retry:`Retry`,actionFailed:`That did not work. Try again.`,actionForbidden:`You do not have permission to do that.`,empty:`No rows`}),vt=5,yt=/* @__PURE__ */ new WeakMap,bt=(e,t)=>{let n=Number(e);return Number.isInteger(n)?n:t},xt=e=>({total:bt(e.dataset.total,0),page:bt(e.dataset.page,1),pageSize:bt(e.dataset.pageSize,0),sortBy:e.dataset.sortBy||``,sortOrder:e.dataset.sortOrder===`desc`?`desc`:`asc`}),St=(e,t)=>{e&&window.WUI?.toast?.(e,{variant:t})},Ct=(e,t)=>{if(!e)return;let n=new Set([...e.elements].filter(e=>e.type!==`hidden`||e.hasAttribute(`data-range-mirror`)).map(e=>e.getAttribute(`name`)).filter(e=>e&&!te.includes(e))),r=[...t].some(([e,t])=>t!==``&&n.has(e));for(let t of e.querySelectorAll(`[data-wui-filter-clear]`))t.hidden=!r},wt=new Intl.NumberFormat(`en-IN`),Tt=(e,t)=>{let n=e.closest(`.wui-list-card`)?.querySelector(`.wui-list-card-count`);n&&(n.textContent=wt.format(t))};function Et(e=document){let t=e.querySelectorAll?[...e.querySelectorAll(`[data-wui-server]`)]:[];e instanceof Element&&e.matches(`[data-wui-server]`)&&t.unshift(e);for(let e of t)yt.has(e)||yt.set(e,Ot(e))}function Dt(e){let t=e instanceof Element?e.closest(`[data-wui-server]`):null;return t&&yt.get(t)||null}function Ot(n){let p=n.querySelector(`.table-wrap`),m=p?.querySelector(`:scope > table`),h=n.dataset.src;if(!m||!h)throw Error(`A server-paged table needs data-src and a .table-wrap > table: render it with <app-data-table src>.`);let g=p.querySelector(`:scope > [data-wui-table-state]`),_=n.querySelector(`[data-wui-table-pager]`),v=n.querySelector(`[data-wui-table-status]`),y={urlState:n.dataset.urlState!==`false`,refreshOnSuccess:n.dataset.refreshOnSuccess!==`false`,filtersForm:n.dataset.filtersForm||null,filtersRegion:n.dataset.filtersRegion||null,searchInput:n.dataset.searchInput||null,loadingText:n.dataset.loadingText||W.loading,errorText:n.dataset.errorText||W.error},b=new URL(h,window.location.href),ne=new Set(b.searchParams.keys()),x=m.hasAttribute(`data-app-datatable-selectable`),S=/* @__PURE__ */ new Set,C=!1,re=o(),ie=new AbortController,w={signal:ie.signal},T=m.querySelector(`:scope > tbody[data-wui-rows]`);if(!T)throw Error(`A server-paged table needs its rows in <app-table-rows> (tbody[data-wui-rows]).`);let E=xt(T),ae=null,D=null,oe=e=>{let t=new URLSearchParams;for(let[n,r]of new URLSearchParams(e))ne.has(n)||t.append(n,r);return t},se=e=>oe(new URL(e,window.location.href).search),O=e=>{let t=e.toString();return`${window.location.pathname}${t?`?${t}`:``}${window.location.hash}`},ce=e=>{let t=new URL(b.href);for(let[n,r]of e)ne.has(n)||t.searchParams.append(n,r);return t.origin===window.location.origin?`${t.pathname}${t.search}`:t.href},le=(e,t)=>{let n=new URLSearchParams(e);return n.has(`page`)&&n.set(`page`,String(t.page)),n.has(`pageSize`)&&n.set(`pageSize`,String(t.pageSize)),n.has(`sortBy`)?t.sortBy?(n.set(`sortBy`,t.sortBy),n.set(`sortOrder`,t.sortOrder)):(n.delete(`sortBy`),n.delete(`sortOrder`)):n.delete(`sortOrder`),n},k=le(y.urlState?oe(window.location.search):new URLSearchParams,E);y.urlState&&O(k)!==`${window.location.pathname}${window.location.search}${window.location.hash}`&&window.history.replaceState(window.history.state,``,O(k));let A=(e,t)=>p.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:t})),j=e=>{v&&(v.textContent=e)},ue=e=>{if(e.total===0)return W.empty;let t=e.pageSize>0?Math.max(1,Math.ceil(e.total/e.pageSize)):1;return`Page ${e.page} of ${t}, ${e.total} ${e.total===1?`row`:`rows`}`},M=()=>[...m.querySelectorAll(`:scope > thead > tr:first-child > th`)],de=e=>{if(x&&[...e.querySelectorAll(`:scope > tr:not(.wui-group-row, .wui-virtual-spacer)`)].some(e=>!e.dataset.rowKey))throw Error(`A selectable server-paged table needs data-row-key on every row, so a selection can span pages.`)},fe=e=>{let t=n.dataset.activeRowKey;if(t!==void 0)for(let n of e){let e=n.classList.contains(`wui-row-active`),r=t!==``&&n.dataset.rowKey===t;n.classList.toggle(`wui-row-active`,r),r?n.setAttribute(`aria-current`,`true`):e&&n.removeAttribute(`aria-current`)}},pe=e=>{if(x){lt(e);for(let t of e){let e=t.querySelector(`.${U} .wui-check:not(:disabled)`);e&&(C&&S.add(t.dataset.rowKey),e.checked=S.has(t.dataset.rowKey))}dt(m)}fe(e);let t=M();if(m.classList.contains(`wui-table-stack`))for(let n of e)[...n.cells].forEach((e,n)=>{let r=t[n]?.textContent.trim();r&&!e.hasAttribute(`data-label`)&&e.setAttribute(`data-label`,r)});t.forEach((t,n)=>{if(t.classList.contains(`wui-col-hidden`))for(let t of e)t.cells[n]?.classList.add(`wui-col-hidden`)})},me=e=>pe([...e.querySelectorAll(`:scope > tr`)]),he=e=>{for(let t of e.querySelectorAll(`:scope > template[data-wui-pager], :scope > template[data-wui-empty], :scope > template[data-wui-filters]`))t.remove()},N=e=>e?.dispatchEvent(new CustomEvent(`wui:teardown`,{bubbles:!0})),ge=(e,t)=>{if(!g)return;let n=e.querySelector(`:scope > template[data-wui-empty]`);N(g),t.total===0&&n?(g.replaceChildren(n.content.cloneNode(!0)),g.hidden=!1):(g.replaceChildren(),g.hidden=!0)},P=e=>{let t=xt(e),n=t.sortBy!==E.sortBy||t.sortOrder!==E.sortOrder?ee(T.rows):null;if(_){let t=e.querySelector(`:scope > template[data-wui-pager]`);N(_),_.replaceChildren(...t?[t.content.cloneNode(!0)]:[]),_.hidden=!1}ge(e,t);let r=e.querySelector(`:scope > template[data-wui-filters]`),i=y.filtersRegion&&r?document.querySelector(y.filtersRegion):null;i&&(N(i),i.replaceChildren(r.content.cloneNode(!0))),he(e),N(T),m.replaceChild(e,T),T=e;let a=C&&t.total!==E.total;return E=t,a&&(C=!1),p.removeAttribute(`data-wui-table-error`),me(e),we(),u(e.rows,n),a&&Te(),i},_e=e=>{let t=document.createElement(`template`);t.innerHTML=`<table>${e}</table>`;let n=t.content.querySelector(`tbody[data-wui-rows]`);return n&&de(n),n?document.importNode(n,!0):null},F=(e,t=M())=>{let n=document.createElement(`tr`);for(let r=0;r<e;r++){let e=t[r],i=e?.classList.contains(`text-center`),a=!i&&(e?.classList.contains(`num`)||e?.classList.contains(`text-end`)||e?.classList.contains(`wui-cell-end`)),o=document.createElement(`td`);i?o.classList.add(`text-center`):a&&o.classList.add(e.classList.contains(`num`)?`num`:`wui-cell-end`);let s=document.createElement(`span`);s.className=`skeleton`,s.setAttribute(`aria-hidden`,`true`);let c=i?44:a?56:60;s.style.cssText=`display:block;width:${c}%;height:12px;border-radius:6px`,o.append(s),n.append(o)}return n},ve=()=>{if(T.querySelector(`:scope > tr:not([data-wui-skeleton])`))return;let e=Math.max(1,M().length);T.replaceChildren(...Array.from({length:vt},()=>{let t=F(e);return t.setAttribute(`data-wui-skeleton`,``),t})),p.removeAttribute(`data-wui-table-error`),g&&(g.hidden=!0)},ye=e=>{e?(p.setAttribute(`aria-busy`,`true`),ve()):p.removeAttribute(`aria-busy`)},be=e=>e===`forbidden`?W.forbidden:e===`network`?W.network:y.errorText,xe=n=>{let r=be(n);if(p.setAttribute(`data-wui-table-error`,n),_&&(_.hidden=!0),g){let i=document.createElement(`div`);i.className=`empty-state wui-empty-state-table wui-table-error`,i.setAttribute(`role`,`alert`);let a=document.createElement(`span`);a.className=`empty-state-icon`,a.innerHTML=d(n===`forbidden`?`lock`:`alert-circle`,{size:24});let o=document.createElement(`div`);o.className=`empty-state-title`,o.textContent=r;let s=document.createElement(`div`);s.className=`empty-state-action`;let c=document.createElement(`button`);c.type=`button`,c.className=e(`outline`,`sm`),c.dataset.wui=t,c.setAttribute(`data-wui-table-retry`,``),c.textContent=W.retry,s.append(c),i.append(a,o,s),N(g),g.replaceChildren(i),g.hidden=!1}j(r)},I=()=>y.filtersForm?document.querySelector(y.filtersForm):null,L=async(e,t=`none`,{quiet:a=!1}={})=>{let o=new URLSearchParams(e);a||(ae={query:o,mode:t},ye(!0),j(y.loadingText)),A(`wui:table:loading`,{query:o.toString()});let s=await re.run(ce(o));if(s.kind===`aborted`||s.kind===`stale`||s.kind===`session`)return s;a||ye(!1);let c=null,l=s.ok?null:s.kind;if(s.ok){try{c=_e(s.html)}catch(e){i(e)}c||(l=`server`)}if(l)return a?r(`A quiet server table refresh failed; the rows on screen are kept.`,l):xe(l),A(`wui:table:error`,{status:s.status,kind:l,message:be(l)}),s;let u=P(c);return k=le(o,E),Ct(I(),k),y.urlState&&t===`push`?window.history.pushState(window.history.state,``,O(k)):y.urlState&&t===`replace`&&window.history.replaceState(window.history.state,``,O(k)),a||j(ue(E)),window.WUI?.refresh?.(p),u&&window.WUI?.refresh?.(u),Tt(n,E.total),A(`wui:table:loaded`,{...E,query:k.toString()}),s},Se=e=>(e.delete(`page`),e),Ce=()=>[...m.querySelectorAll(`:scope > thead th[data-sort-key]`)],we=()=>{for(let e of Ce()){let t=e.dataset.sortKey===E.sortBy;e.setAttribute(`aria-sort`,t?E.sortOrder===`desc`?`descending`:`ascending`:`none`)}};for(let e of Ce())if(e.classList.add(`sortable`),e.tabIndex=0,!e.querySelector(`.sort-icon`)){let t=e.classList.contains(`num`)||e.classList.contains(`text-end`),n=document.createElement(`span`);n.className=t?`sort-icon wui-sort-lead`:`sort-icon`,n.innerHTML=d(`chevrons-up-down`,{size:14}),t?e.prepend(n):e.append(n)}let R=e=>{let t=Se(new URLSearchParams(k)),n=E.sortBy===e&&E.sortOrder===`asc`?`desc`:`asc`;return t.set(`sortBy`,e),t.set(`sortOrder`,n),L(t,`push`)};m.addEventListener(`click`,e=>{let t=e.target.closest(`th[data-sort-key]`);t&&m.tHead?.contains(t)&&R(t.dataset.sortKey)}),m.addEventListener(`keydown`,e=>{if(e.key!==`Enter`&&e.key!==` `)return;let t=e.target.closest?.(`th[data-sort-key]`);t&&m.tHead?.contains(t)&&(e.preventDefault(),R(t.dataset.sortKey))});let Te=()=>{dt(m);let e=C?{selected:E.total,total:E.total,allMatching:C}:{selected:S.size,total:E.total};m.dispatchEvent(new CustomEvent(`selectionchange`,{bubbles:!0,detail:e}))};x&&(pt(m,(e,t)=>{for(let n of e){let e=n.closest(`tr`)?.dataset.rowKey;e&&(t?S.add(e):S.delete(e))}t||(C=!1)}),m.addEventListener(`change`,e=>{let t=e.target;if(t.matches?.(`.wui-select-cell .wui-check:not(:disabled)`)){if(t.checked||(C=!1),m.tHead?.contains(t))for(let e of T.querySelectorAll(`:scope > tr`)){let n=e.querySelector(`.${U} .wui-check:not(:disabled)`);n&&(n.checked=t.checked,t.checked?S.add(e.dataset.rowKey):S.delete(e.dataset.rowKey))}else{let e=t.closest(`tr`)?.dataset.rowKey;if(!e)return;t.checked?S.add(e):S.delete(e)}Te()}})),_&&(_.addEventListener(`click`,e=>{let t=e.target.closest(`a[href]`);!t||e.defaultPrevented||e.button!==0||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey||(e.preventDefault(),L(se(t.getAttribute(`href`)),`push`))}),_.addEventListener(`change`,e=>{e.target.classList?.contains(`tpg-select`)&&e.target.value&&(e.stopPropagation(),L(se(e.target.value),`push`))}));let z=()=>{if(!y.searchInput)return null;let e=document.querySelector(y.searchInput);return e&&(e.matches(`input, textarea`)?e:e.querySelector(`input`))},B=()=>n.isConnected?!0:(ie.abort(),clearTimeout(D),!1),V=(e,t)=>{let n=/* @__PURE__ */ new Set;for(let t of e.elements)t.name&&t.type!==`hidden`&&n.add(t.name);let r=[];for(let t of e.elements)if(t.name&&!t.disabled){if(t.matches(`input[type="hidden"][data-wui-carried]`))n.has(t.name)||r.push([t.name,t.value]);else if(t.matches(`input[type=checkbox], input[type=radio]`))t.checked&&r.push([t.name,t.value]);else if(t.matches(`input, textarea`))t.matches(`[type=submit], [type=button], [type=reset], [type=image], [type=file]`)||r.push([t.name,t.value]);else if(t.localName===`select`)for(let e of t.selectedOptions)r.push([t.name,e.value])}return t?.name&&!t.disabled&&r.push([t.name,t.value]),r},Ee=(e,t)=>{let n=new Set([...e.elements].map(e=>e.name).filter(Boolean)),r=new URLSearchParams,i=e=>e!==`search`&&te.includes(e);for(let[e,t]of k)e!==`page`&&(i(e)||!n.has(e))&&r.append(e,t);for(let[n,a]of V(e,t))a===``||i(n)||ne.has(n)||r.append(n,a);let a=z();if(a){r.delete(f);let e=a.value.trim();e&&r.set(f,e)}return L(r,`push`)},De=e=>y.filtersForm&&e.closest?.(y.filtersForm)||y.filtersRegion&&e.closest?.(y.filtersRegion)||null;document.addEventListener(`submit`,e=>{B()&&y.filtersForm&&e.target instanceof HTMLFormElement&&e.target.matches(y.filtersForm)&&(e.preventDefault(),Ee(e.target,e.submitter))},w),document.addEventListener(`change`,e=>{if(!B()||!y.filtersForm)return;let t=e.target.closest?.(y.filtersForm);!t||e.target===z()||t.hasAttribute(`data-wui-apply-on-change`)||e.target.closest?.(`wui-filter-popover`)||Ee(t)},w);let Oe=(e,t)=>{if(!e)return;let n=e=>t.get(e)??``;for(let r of e.querySelectorAll(`input[name]:not([type=hidden])`))if(r.type===`checkbox`)r.checked=t.getAll(r.name).includes(r.value);else if(r.type===`radio`){let e=n(r.name)===r.value;if(r.checked===e)continue;r.checked=e,e&&r.dispatchEvent(new Event(`change`))}else r.value!==n(r.name)&&(r.value=n(r.name),r.dispatchEvent(new Event(`input`,{bubbles:!0})));for(let r of e.querySelectorAll(`select[name]`))if(!r.multiple)r.value=n(r.name);else for(let e of r.options)e.selected=t.getAll(r.name).includes(e.value);for(let r of e.querySelectorAll(`wui-select[name]`)){let e=r.getAttribute(`name`);r.value=r.mode===`multiple`||r.mode===`tag`?t.getAll(e):n(e)}for(let t of e.querySelectorAll(`wui-date-range`)){let e=t.getAttribute(`start-name`)||t.getAttribute(`name`),r=t.getAttribute(`end-name`);t.value={start:e?n(e):``,end:r?n(r):``}}};document.addEventListener(`click`,e=>{if(!B())return;let t=e.target.closest?.(`a[href]`);if(!t||!De(t)||e.defaultPrevented||e.button!==0||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey)return;let n=new URL(t.getAttribute(`href`),window.location.href);if(n.origin!==window.location.origin||n.pathname!==window.location.pathname)return;e.preventDefault();let r=Se(se(n.href));Oe(t.closest(`form`),r),Ct(t.closest(`form`),r),L(r,`push`)},w),document.addEventListener(`input`,e=>{if(!B())return;let t=z();t&&e.target===t&&(clearTimeout(D),D=setTimeout(()=>{if(!B())return;let e=Se(new URLSearchParams(k)),n=t.value.trim();n?e.set(f,n):e.delete(f),e.toString()!==k.toString()&&L(e,`replace`)},300))},w),y.urlState&&window.addEventListener(`popstate`,()=>{if(!B())return;let e=oe(window.location.search),t=z();t&&(t.value=e.get(`search`)??``),Ct(I(),e),L(e,`none`)},w),document.addEventListener(`wui:modal:success`,()=>{B()&&y.refreshOnSuccess&&L(k,`none`)},w),g?.addEventListener(`click`,e=>{e.target.closest(`[data-wui-table-retry]`)&&ae&&L(ae.query,ae.mode)});let ke=e=>[...T.rows].find(t=>t.dataset.rowKey===e)??null,Ae=e=>{if(!e?.trim())return null;let t=document.createElement(`template`);if(t.innerHTML=`<table><tbody>${e}</tbody></table>`,t.content.querySelector(`tbody[data-wui-rows]`))return null;let n=[...t.content.querySelectorAll(`table > tbody > tr[data-row-key]`)];return n.length?n.map(e=>document.importNode(e,!0)):null},H=(e,t,n)=>{let r=n?e[0]:e.find(e=>e.dataset.rowKey===t.dataset.rowKey);if(!r)return null;let i=[];for(let n of e){let e=n===r?t:ke(n.dataset.rowKey);e&&(N(e),e.replaceWith(n),i.push(n))}return pe(i),window.WUI?.refresh?.(p),r},je=e=>e.message||(e.kind===`forbidden`?W.actionForbidden:W.actionFailed),Me=e=>{e?.isConnected&&e.getAttribute(`data-wui-save-state`)===`saving`&&c(e,null)},Ne=e=>{if(e instanceof HTMLTableRowElement)return e;let t=document.createElement(`template`);t.innerHTML=`<table><tbody>${String(e)}</tbody></table>`;let n=t.content.querySelector(`table > tbody > tr`);if(!n)throw Error("saveRow's `row` is the row as it will read: a <tr> element or its HTML.");return document.importNode(n,!0)},Pe=async({url:e,method:t=`POST`,body:n,key:r,row:i}={})=>{if(!e)throw Error("saveRow needs `url`: the handler that saves the row.");let o=r==null,u=o?null:ke(String(r));if(!o&&!u)throw Error(`saveRow found no row with data-row-key="${r}" on this page.`);let ee=M().filter(e=>!e.classList.contains(U)),d=i?Ne(i):u??F(Math.max(1,ee.length),ee);u&&d!==u?u.replaceWith(d):u||T.insertBefore(d,T.firstChild),d!==u&&pe([d]),g&&!p.hasAttribute(`data-wui-table-error`)&&(g.hidden=!0),c(d,`saving`);let te=s(d),f=await a(e,{method:t.toUpperCase(),body:n});if(f.kind===`session`)return!1;if(f.ok){let e=Ae(f.html),t=e&&d.isConnected?H(e,d,o):null;return t?j(l.saved(s(t)||te)):(await L(k,`none`),Me(d)),gt(f,f.toastVariant||`success`),A(`wui:table:saved`,{key:t?.dataset.rowKey??(o?null:String(r)),added:o,status:f.status}),!0}let m=je(f),h=d;return u&&d!==u&&d.isConnected?(d.replaceWith(u),h=u):o&&!i&&(d.remove(),h=null,g?.childElementCount&&!T.querySelector(`:scope > tr`)&&(g.hidden=!1)),h?.isConnected&&c(h,`error`,m),f.kind!==`aborted`&&St(m,`danger`),j(l.notSaved(te,m)),A(`wui:table:failed`,{key:o?null:String(r),added:o,status:f.status,kind:f.kind,message:m}),!1},Fe=async e=>{let t=e.dataset.url;if(!t)throw Error(`A data-wui-row-action button needs data-url: the handler the action posts to.`);let n=e.closest(`tr`),r=n?.dataset.rowKey??null,i=e.dataset.wuiRowAction||``,o=n?s(n):``;e.disabled=!0,e.setAttribute(`aria-busy`,`true`),n&&c(n,`saving`);let u=await a(t,{method:(e.dataset.method||`post`).toUpperCase()});if(e.disabled=!1,e.removeAttribute(`aria-busy`),u.kind===`session`||u.kind===`aborted`)Me(n);else{if(u.ok){gt(u,u.toastVariant||`success`);let e=n?.isConnected?Ae(u.html):null,t=e?H(e,n,!1):null;t?j(l.saved(s(t)||o)):(await L(k,`none`),Me(n))}else{let e=je(u);St(e,`danger`),n?.isConnected&&c(n,`error`,e),j(l.notSaved(o,e))}A(`wui:table:action`,{action:i,key:r,ok:u.ok,status:u.status})}};return m.addEventListener(`click`,e=>{let t=e.target.closest(`[data-wui-row-action]`);t&&T.contains(t)&&!t.disabled&&(e.preventDefault(),Fe(t))}),de(T),he(T),x&&ut(m),me(T),we(),{el:n,reload:async e=>{let t=e?.quiet===!0;return t&&p.getAttribute(`aria-busy`)===`true`?null:L(k,`none`,{quiet:t})},query:()=>new URLSearchParams(k),setQuery:e=>{let t=new URLSearchParams(k);for(let[n,r]of Object.entries(e??{})){t.delete(n);for(let e of Array.isArray(r)?r:[r])e!=null&&e!==``&&t.append(n,String(e))}return e&&`page`in e||t.delete(`page`),L(t,`push`)},saveRow:Pe,setActiveRow:e=>{n.dataset.activeRowKey=e==null?``:String(e),fe([...T.querySelectorAll(`:scope > tr`)])},selection:{keys:()=>[...S],count:()=>C?E.total:S.size,allMatching:()=>C,selectAllMatching:()=>{C=!0;for(let e of T.querySelectorAll(`:scope > tr`)){let t=e.querySelector(`.${U} .wui-check`);t?.disabled||(t&&(t.checked=!0),e.dataset.rowKey&&S.add(e.dataset.rowKey))}Te()},clear:()=>{C=!1,S.clear();for(let e of T.querySelectorAll(`:scope > tr > .${U} .wui-check:not(:disabled)`))e.checked=!1;Te()}}}}var G=`wuiConfirm`,kt=Object.freeze([`danger`]),At=Object.freeze([`success`,`info`,`warning`,`danger`]),jt=`wui.flash`,K=Object.freeze({confirmTitle:`Are you sure?`,confirmLabel:`Confirm`,cancelLabel:`Cancel`,failed:`That did not work. Try again.`,forbidden:`You do not have permission to do that.`,network:`Could not reach the server. Check your connection and try again.`}),Mt=/* @__PURE__ */ new WeakSet,Nt=/* @__PURE__ */ new WeakSet,Pt=null,Ft=null,It=!1,Lt=e=>{let t=document.createElement(`span`);return t.textContent=e??``,t.innerHTML},Rt=(e,t)=>{e&&window.WUI?.toast?.(e,{variant:t})},zt=()=>{let e=window.bootstrap?.Modal;if(!e)throw Error(`data-wui-confirm: Bootstrap's bundle (window.bootstrap) is not loaded on this page.`);return e};function Bt(){let n=document.getElementById(G);return n||(n=document.createElement(`div`),n.id=G,n.className=`modal fade wui-modal-shell`,n.tabIndex=-1,n.setAttribute(`aria-hidden`,`true`),n.setAttribute(`role`,`dialog`),n.setAttribute(`aria-modal`,`true`),n.style.setProperty(`--wui-modal-max-width`,`${v.md}px`),n.innerHTML=`<div class="modal-dialog modal-dialog-centered wui-rb-dialog"><div class="modal-content wui-modal wui-confirm"><div class="wui-modal-body"><div class="wui-confirm-content"><span class="wui-confirm-icon"><wui-status-icon tone="info" size="120"></wui-status-icon></span><h3 class="wui-confirm-title" tabindex="-1" data-autofocus></h3><p class="wui-confirm-msg"></p></div></div><div class="wui-modal-footer"><div class="wui-confirm-actions"><button type="button" class="${e(`soft`,`md`)}" data-bs-dismiss="modal" data-wui="${t}">${Lt(K.cancelLabel)}</button><button type="button" class="${e(`primary`,`md`)}" data-app-confirm data-wui="${t}"></button></div></div></div></div>`,document.body.appendChild(n),n)}function Vt(e,t){let n=e.getAttribute(`data-wui-confirm-tone`);if(n!==null&&!kt.includes(n))throw TypeError(`data-wui-confirm-tone="${n}" is not supported. Use danger, or leave it off.`);Ht({title:e.getAttribute(`data-wui-confirm-title`),message:e.getAttribute(`data-wui-confirm`),label:e.getAttribute(`data-wui-confirm-label`),danger:n===`danger`},t)}function Ht({title:e,message:t,label:n,danger:r},i){let a=zt(),o=Bt(),s=o.querySelector(`.wui-confirm-title`),c=o.querySelector(`[data-app-confirm]`);if(!s||!c)throw Error(`#${G} is not a confirm dialog with a confirm button. Render <app-confirm-dialog id="${G}"> without confirm-href, or leave the dialog to the library.`);let l=o.querySelector(`.wui-confirm-msg`);l||(l=document.createElement(`p`),l.className=`wui-confirm-msg`,s.after(l)),s.textContent=e||K.confirmTitle,l.textContent=t,c.textContent=n||K.confirmLabel,c.classList.toggle(`btn-danger`,r),c.classList.toggle(`btn-primary`,!r),o.querySelector(`wui-status-icon`)?.setAttribute(`tone`,r?`delete`:`info`),o.setAttribute(`aria-label`,s.textContent),Ft=i,It=!1,a.getOrCreateInstance(o).show()}var Ut=(e,t)=>{Pt=e;try{t()}finally{Pt=null}};function Wt(e,{title:t,message:n,label:r,tone:i},a){if(i!=null&&!kt.includes(i))throw TypeError(`confirmAction: tone "${i}" is not supported. Use danger, or leave it off.`);sn(e.ownerDocument),Ht({title:t,message:n,label:r,danger:i===`danger`},()=>Ut(e,a))}var Gt=e=>e.disabled===!0||e.getAttribute(`aria-disabled`)===`true`;function Kt(e){let t=e.target.closest?.(`[data-wui-confirm]:not(form)`);t&&t!==Pt&&!Gt(t)&&(e.preventDefault(),e.stopImmediatePropagation(),Vt(t,()=>Ut(t,()=>t.click())))}function qt(e){let t=e.target;if(!(t instanceof HTMLFormElement)||!t.hasAttribute(`data-wui-confirm`)||t===Pt||e.submitter&&e.submitter===Pt||t.querySelector(`input[data-app-repeater-hidden]`))return;e.preventDefault(),e.stopImmediatePropagation();let n=e.submitter?.form===t?e.submitter:void 0;Vt(t,()=>Ut(t,()=>t.requestSubmit(n)))}function Jt(e){let t=e.target.closest?.(`#${G} [data-app-confirm]`);t&&!t.disabled&&Ft&&(It=!0,zt().getOrCreateInstance(t.closest(`#${G}`)).hide())}function Yt(e){if(e.target.id!==`wuiConfirm`)return;let t=It?Ft:null;Ft=null,It=!1,t?.()}var Xt=(e,t)=>{e&&window.sessionStorage.setItem(jt,JSON.stringify({message:e,variant:t}))},Zt=e=>e===`forbidden`?K.forbidden:e===`network`?K.network:K.failed;function Qt(){for(let e of document.querySelectorAll(`[data-wui-server]`))e.dataset.refreshOnSuccess!==`false`&&Dt(e)?.reload()}async function $t(e){let t=e.getAttribute(`data-wui-post`);if(!t)throw Error(`A data-wui-post button needs the URL the action posts to.`);return en(t,e)}async function en(e,t,n){let r=t.getAttribute(`data-wui-post-reload`);if(r!==null&&r!==`page`)throw TypeError(`data-wui-post-reload="${r}" is not supported. Use page, or leave it off to reload the server tables.`);t.disabled=!0,t.setAttribute(`aria-busy`,`true`);let i=await a(e,{method:`POST`,body:n});if(i.kind===`session`||i.kind===`aborted`)return;let o=i.toastVariant||`success`;i.ok&&(i.redirect||r===`page`)?(Xt(i.message,o),i.redirect?window.location.assign(i.redirect):window.location.reload()):(t.disabled=!1,t.removeAttribute(`aria-busy`),i.ok?(gt(i,o),Qt()):Rt(i.message||Zt(i.kind),`danger`))}function tn(e){let t=e.target.closest?.(`[data-wui-post]`);t&&(e.preventDefault(),Gt(t)||t.getAttribute(`aria-busy`)===`true`||$t(t).catch(e=>i(e)))}function nn(e){let t=e.target.closest?.(`form[data-wui-post-form]`);if(!t||e.defaultPrevented)return;e.preventDefault();let n=e.submitter||t.querySelector(`button`);n.getAttribute(`aria-busy`)!==`true`&&(en(t.getAttribute(`action`),n,new FormData(t)).catch(e=>i(e)),window.bootstrap?.Dropdown?.getInstance(t.closest(`.dropdown`)?.querySelector(`[data-bs-toggle='dropdown']`))?.hide())}function rn(){let e=window.sessionStorage.getItem(jt);if(!e)return;window.sessionStorage.removeItem(jt);let{message:t,variant:n}=JSON.parse(e);Rt(t,n)}function an(e){let t=e.querySelectorAll?[...e.querySelectorAll(`[data-wui-flash]`)]:[];e instanceof Element&&e.matches(`[data-wui-flash]`)&&t.unshift(e);for(let e of t){let t=e.getAttribute(`data-wui-flash-variant`)||`success`;if(!At.includes(t))throw TypeError(`data-wui-flash-variant="${t}" is not supported. Use ${At.join(`, `)}.`);let n=e.getAttribute(`data-wui-flash`)||e.textContent.trim();e.remove(),Rt(n,t)}}function on(e){let t=e.target instanceof Element?e.target.closest(`[data-wui-auto-submit]`):null,n=t&&(e.target.form||t.closest(`form`));n&&n.requestSubmit()}function sn(e){Nt.has(e)||(Nt.add(e),e.addEventListener(`click`,Jt),e.addEventListener(`hidden.bs.modal`,Yt))}function cn(e=document){let t=e.ownerDocument||e;Mt.has(t)||(Mt.add(t),t.addEventListener(`click`,Kt,!0),t.addEventListener(`submit`,qt,!0),sn(t),t.addEventListener(`click`,tn),t.addEventListener(`submit`,nn),t.addEventListener(`change`,on),rn()),an(e)}var ln=Object.freeze({title:`Leave without saving?`,message:`Your changes on this page are not saved. If you leave now, they are lost.`,leaveLabel:`Leave`}),q=`form[data-wui-unsaved]`,un=`[aria-invalid="true"], .field-error:not(:empty), .field-validation-error, .validation-summary-errors, .wui-error-summary`,dn=`[download], [data-wui-modal], [data-wui-post], [data-bs-toggle]`,fn=/* @__PURE__ */ new Set([`submit`,`button`,`reset`,`image`]),pn=/* @__PURE__ */ new Set([`hidden`,`checkbox`,`radio`,`file`,`submit`,`button`,`reset`,`image`,`range`,`color`]),J=/* @__PURE__ */ new WeakMap,mn=/* @__PURE__ */ new WeakSet,hn=e=>`${e.name}:${e.size}:${e.lastModified}`;function Y(e){let t=[];for(let n of e.elements)!n.name||n.disabled||fn.has(n.type)||(n.type===`checkbox`||n.type===`radio`?t.push([n.name,n.value,n.checked]):n.type===`file`?t.push([n.name,[...n.files||[]].map(hn)]):n.type===`select-multiple`?t.push([n.name,[...n.selectedOptions].map(e=>e.value)]):t.push([n.name,n.value]));return JSON.stringify(t)}function X(e){return Y(e)}function gn(e,t){let n=/* @__PURE__ */ new Map;for(let e of JSON.parse(t)){let t=n.get(e[0]);t?t.push(e):n.set(e[0],[e])}let r=JSON.parse(Y(e)).map(e=>n.get(e[0])?.shift()??e);for(let e of n.values())r.push(...e);return JSON.stringify(r)}function _n(e){for(let t of e.elements)if(t.name&&!t.disabled){if(t.tagName===`TEXTAREA`||t.tagName===`INPUT`&&!pn.has(t.type)){if(t.value.trim()!==``)return!0}else if(t.tagName===`INPUT`&&t.type===`file`&&t.files?.length>0)return!0}return!1}var vn=e=>({saved:e.querySelector(un)&&_n(e)?null:Y(e),engaged:!1,discarded:!1});function yn(e){let t=J.get(e);return!t||t.discarded||!e.isConnected?!1:t.saved===null||t.engaged&&Y(e)!==t.saved}var bn=(e,t)=>[...e.querySelectorAll(q)].filter(e=>e!==t&&yn(e)),xn=()=>!!window.bootstrap?.Modal;function Sn(e,t,n){let r=t.map(e=>e.getAttribute(`data-wui-unsaved`)).find(Boolean)||ln.message;Wt(e,{title:ln.title,message:r,label:ln.leaveLabel,tone:`danger`},()=>{for(let e of t)J.get(e).discarded=!0;n()})}function Cn(e){if(e.matches(dn))return!1;let t=e.getAttribute(`target`);if(t&&t.toLowerCase()!==`_self`)return!1;let n=new URL(e.getAttribute(`href`),window.location.href);if(n.protocol!==`http:`&&n.protocol!==`https:`)return!1;let r=window.location;return!(n.hash&&n.origin===r.origin&&n.pathname===r.pathname&&n.search===r.search)}function wn(e,t){if((t?.getAttribute(`formmethod`)||e.getAttribute(`method`)||`get`).toLowerCase()===`dialog`)return!1;let n=t?.getAttribute(`formtarget`)||e.getAttribute(`target`);return!n||n.toLowerCase()===`_self`}function Tn(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=e.target.closest?.(`a[href]`);if(!t||!Cn(t))return;let n=bn(t.ownerDocument,null);n.length&&xn()&&(e.preventDefault(),Sn(t,n,()=>t.click()))}function En(e){let t=e.target;if(!(t instanceof HTMLFormElement)||e.defaultPrevented||!wn(t,e.submitter))return;let n=bn(t.ownerDocument,t);if(n.length&&xn()){e.preventDefault();let r=e.submitter?.form===t?e.submitter:void 0;Sn(t,n,()=>t.requestSubmit(r));return}let r=J.get(t);r&&(r.saved=Y(t),r.discarded=!1)}function Dn(e){bn(document,null).length&&(e.preventDefault(),e.returnValue=``)}function On(e){let t=e.target.closest?.(q),n=t&&J.get(t);n&&!n.engaged&&(n.saved!==null&&(n.saved=Y(t)),n.engaged=!0)}function kn(e){let t=e.target.closest?.(q),n=t&&J.get(t);n&&(n.discarded=!1,e.isTrusted&&(n.engaged=!0))}function An(e){for(let t of e.currentTarget.querySelectorAll(q)){let e=J.get(t);e?.saved&&(e.saved=gn(t,e.saved))}}function jn(e){let t=e.detail?.handle?.el;if(t instanceof Element)for(let e of t.querySelectorAll(q))Nn(e)}function Mn(e=document){let t=e.ownerDocument||e;if(!mn.has(t)){mn.add(t);for(let e of[`focusin`,`pointerdown`,`drop`])t.addEventListener(e,On,!0);for(let e of[`input`,`change`])t.addEventListener(e,kn,!0);t.addEventListener(`click`,Tn),t.addEventListener(`submit`,En),t.addEventListener(`wui:modal:success`,jn),t.addEventListener(n,An),t.defaultView.addEventListener(`beforeunload`,Dn)}let r=[...e.querySelectorAll?.(q)||[]];e.matches?.(q)&&r.unshift(e);for(let e of r)J.has(e)||J.set(e,vn(e))}function Nn(e){if(!(e instanceof HTMLFormElement)||!e.matches(q))throw TypeError(`resetUnsavedChanges: ${String(e)} is not a <form data-wui-unsaved>.`);J.set(e,{saved:Y(e),engaged:!1,discarded:!1})}var Pn=Object.freeze({question:`Discard your changes?`,discard:`Discard`,keep:`Keep editing`}),Fn=`wui:drawer:discard`,Z=`wui-drawer[confirm-discard]`,In=`.wui-modal-shell`,Ln=`data-wui-no-discard`,Rn=`.wui-drawer-discard`,zn=`input, select, textarea`,Q=/* @__PURE__ */ new WeakMap,Bn=/* @__PURE__ */ new WeakSet,Vn=/* @__PURE__ */ new WeakSet;function Hn(n,r,i,a){let o=n.createElement(`button`);return o.type=`button`,o.className=e(r,`sm`),o.dataset.wui=t,o.setAttribute(i,``),o.textContent=a,o}function Un(e,t){let n=e.createElement(`div`);n.className=`wui-drawer-discard`,n.setAttribute(`role`,`alert`);let r=e.createElement(`span`);return r.className=`wui-drawer-discard-text`,r.textContent=t,n.append(r,Hn(e,`danger`,`data-wui-discard-confirm`,Pn.discard),Hn(e,`soft`,`data-wui-discard-keep`,Pn.keep)),n}function Wn(e){let t=e.closest?.(Z);if(t)return t;let n=e.closest?.(In);return n&&$(n).length?n:null}function Gn(e){return e.closest(Z)??e.closest(In)}function Kn(e,t){return t.hasAttribute(Ln)||e.hasAttribute(Ln)?!1:t.hasAttribute(`confirm-discard`)||e.hasAttribute(`data-wui-confirm-discard`)?!0:(e.getAttribute(`method`)||`get`).toLowerCase()!==`get`}function $(e){return e.matches(Z)?e.querySelectorAll(`form`):[...e.querySelectorAll(`form`)].filter(t=>Kn(t,e))}function qn(e){let t=Q.get(e);return t!=null&&X(e)!==t}function Jn(e){let t=e.ownerDocument.createElement(`div`);return t.className=`wui-drawer-footer`,e.querySelector(`.wui-drawer-panel`).append(t),Vn.add(t),t}function Yn(e){let t=e.ownerDocument.createElement(`div`);return t.className=`wui-modal-footer`,(e.querySelector(`.wui-modal-body`)?.parentElement??e.querySelector(`.modal-content`)??e).append(t),Vn.add(t),t}function Xn(e){e.querySelector(`[data-wui-discard-confirm]`).focus()}function Zn(e,t,n){let r=e.querySelector(Rn);if(r){Xn(r);return}let i=Un(e.ownerDocument,t),a;e.matches(Z)?(a=e.querySelector(`.wui-drawer-footer`)??Jn(e),a.prepend(i)):e.hasAttribute(`confirm-discard`)?(a=e.querySelector(`.wui-modal-footer`)??Yn(e),a.prepend(i)):(a=n.querySelector(`.modal-footer`),a?a.prepend(i):(a=n,n.append(i))),a.classList.add(`wui-drawer-discarding`),Xn(i)}function Qn(e){let t=e.parentElement;e.remove(),t.classList.remove(`wui-drawer-discarding`),Vn.has(t)&&t.remove()}function $n(e){for(let t of $(e)){let e=[...t.querySelectorAll(zn)].find(e=>e.type!==`hidden`&&!e.disabled);if(e){e.focus({preventScroll:!0});return}}}function er(e){let t=Wn(e.target);if(t)for(let e of $(t))Q.get(e)??Q.set(e,X(e))}function tr(e){for(let t of e.currentTarget.querySelectorAll(`form`)){let e=Q.get(t);e!=null&&Q.set(t,gn(t,e))}}function nr(e){let t=e.target;t instanceof HTMLFormElement&&Wn(t)&&Q.set(t,X(t))}function rr(e){let t=e.detail?.handle?.el;if(t instanceof Element)for(let e of t.querySelectorAll(`form`))Q.delete(e)}function ir(e){let t=e.target;t instanceof Element&&t.matches(Z)&&[...$(t)].some(qn)&&(e.preventDefault(),Zn(t,t.getAttribute(`confirm-discard`),null))}function ar(e){let t=e.target;if(!(t instanceof Element)||!t.matches(In))return;let n=[...$(t)].find(qn);n&&(e.preventDefault(),Zn(t,n.getAttribute(`data-wui-confirm-discard`)??t.getAttribute(`confirm-discard`)??Pn.question,n))}function or(e){let t=e.closest(`wui-drawer`);if(t){t.dispatchEvent(new CustomEvent(`wui-drawer-close`,{bubbles:!0,cancelable:!0}))&&t.hide();return}let n=e.closest(In);n&&window.bootstrap?.Modal?.getInstance(n)?.hide()}function sr(e){let t=e.closest(Rn),n=Gn(t);Qn(t);for(let e of $(n))Q.set(e,X(e));n.dispatchEvent(new CustomEvent(Fn,{bubbles:!0})),n.matches(Z)?n.hide():window.bootstrap.Modal.getInstance(n).hide()}function cr(e){let t=e.closest(Rn),n=Gn(t);Qn(t),$n(n)}function lr(e){let t=e.target,n=t.closest?.(`[data-wui-discard-confirm]`);if(n){sr(n);return}let r=t.closest?.(`[data-wui-discard-keep]`);if(r){cr(r);return}let i=t.closest?.(`[data-wui-dismiss]`);i&&or(i)}function ur(e){if(e.key!==`Escape`)return;let t=e.currentTarget.querySelector(Rn);if(!t)return;e.preventDefault(),e.stopPropagation();let n=Gn(t);Qn(t),$n(n)}function dr(e=document){let t=e.ownerDocument||e;Bn.has(t)||(Bn.add(t),t.addEventListener(`focusin`,er),t.addEventListener(`pointerdown`,er),t.addEventListener(`submit`,nr),t.addEventListener(n,tr),t.addEventListener(`wui:modal:success`,rr),t.addEventListener(`wui:modal:loaded`,rr),t.addEventListener(`wui-drawer-close`,ir,!0),t.addEventListener(`hide.bs.modal`,ar),t.addEventListener(`click`,lr),t.addEventListener(`keydown`,ur,!0))}export{Ze as C,Je as S,$e as T,Et as _,ln as a,gt as b,Nn as c,jt as d,At as f,Dt as g,cn as h,dr as i,G as l,Wt as m,Pn as n,X as o,K as p,Un as r,Mn as s,Fn as t,kt as u,mt as v,Ye as w,et as x,_t as y};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-DV9IZZCu.js";import{t}from"../WuiDrawer-BJ8zqtQ2.js";e(`wui-drawer`,t);export{t as WuiDrawer};
1
+ import{n as e}from"../elementBase-DV9IZZCu.js";import{t}from"../WuiDrawer-SkxcDhgf.js";e(`wui-drawer`,t);export{t as WuiDrawer};
package/dist/helpers.js CHANGED
@@ -1 +1 @@
1
- import{n as e,t}from"./copyText-DM5HhXjf.js";import{_ as n,a as r,b as i,c as a,d as o,f as s,g as c,h as l,i as u,l as d,m as f,n as p,o as m,p as h,r as g,s as _,t as v,u as y,v as b,y as x}from"./formatters-Ba0CvsTs.js";import{t as S}from"./iconGlyphs.g-BlwTSNXS.js";import{a as C,c as w,i as T,n as E,o as D,r as O,s as k,t as A}from"./notificationDays-dNQZGLlB.js";import{o as j}from"./optionLabel-CLemms21.js";import{a as M,c as ee,d as te,f as ne,g as re,h as ie,i as ae,l as oe,m as se,n as ce,o as le,p as ue,r as de,s as fe,t as pe,u as me,v as he,y as ge}from"./themeTransition-rHRVbhHB.js";import{a as _e,c as ve,d as ye,f as be,i as xe,l as Se,m as Ce,n as we,o as Te,p as Ee,r as De,s as Oe,t as ke,u as Ae}from"./shortcutKeys-CvxSh3bV.js";import{n as je,t as Me}from"./stepperHeader-yinJ_7Dk.js";import{t as Ne}from"./textMatch-wdY7XLIc.js";import{i as Pe,n as Fe,o as Ie,r as Le,s as Re,t as ze}from"./zone-D82f-GU_.js";var Be=`image/jpeg,image/png,image/webp,image/heic,image/heif,.heic,.heif`,Ve=10,He=512,Ue=`image/webp`,We=[96,48],N={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 Ge(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 Ke(e){return Ge(e)?N.heicUnreadable:N.unreadable}function qe(e,t){let n=Number(t);return{name:e?.name||`photo`,type:Ue,size:Number.isInteger(n)&&n>0?n:512}}var Je=`data-wui-command-shortcut`,Ye=`k`,Xe=/* @__PURE__ */ new WeakSet;function Ze(e,t){return!(e.ctrlKey||e.metaKey)||e.altKey||e.shiftKey||e.repeat?!1:String(e.key).toLowerCase()===String(t).toLowerCase()}function Qe(e){let t=window.bootstrap?.Modal;if(!t)throw Error(`data-wui-command-shortcut: Bootstrap's bundle (window.bootstrap) is not loaded on this page.`);let n=e.closest(`.modal`);n&&t.getOrCreateInstance(n).show()}function $e(e){let t=e.ownerDocument??e;!Xe.has(t)&&e.querySelector(`[data-wui-command-shortcut]`)&&(Xe.add(t),t.addEventListener(`keydown`,e=>{for(let n of t.querySelectorAll(`[${Je}]`))if(Ze(e,n.getAttribute(`data-wui-command-shortcut`)||Ye)){e.preventDefault(),n.localName===`wui-command-palette`||n.classList.contains(`modal`)?Qe(n):(n.focus(),n.select?.());return}}))}var et=`image/png,image/jpeg,image/webp`,tt=5,nt={"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`]},rt={"image/png":`PNG`,"image/jpeg":`JPG`,"image/webp":`WEBP`,"image/gif":`GIF`,"image/svg+xml":`SVG`,"image/heic":`HEIC`,"image/heif":`HEIC`,"application/pdf":`PDF`,"text/plain":`text file`,"image/*":`images`,"video/*":`videos`,"audio/*":`audio`,".png":`PNG`,".jpg":`JPG`,".jpeg":`JPG`,".webp":`WEBP`,".gif":`GIF`,".svg":`SVG`,".heic":`HEIC`,".heif":`HEIC`,".pdf":`PDF`,".txt":`text file`},P=e=>String(e||``).split(`,`).map(e=>e.trim().toLowerCase()).filter(Boolean),it=[`.png`,`.jpg`,`.jpeg`,`.webp`,`.gif`,`.svg`,`.bmp`,`.avif`,`.heic`,`.heif`];function at(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 it.some(e=>r.endsWith(e))}var ot=[`KB`,`MB`,`GB`];function st(e){if(e<1024)return`${e} B`;let t=e/1024,n=0;for(;t>=1024&&n<ot.length-1;)t/=1024,n+=1;return`${t.toFixed(1)} ${ot[n]}`}function ct(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 lt(e){let t=P(e);return t.length?t.every(e=>e.startsWith(`.`)?it.includes(e):e===`image/*`||e.startsWith(`image/`)):!1}function ut(e){let t=[];for(let n of P(e)){let e=rt[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 dt(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&&(nt[e]||[]).some(e=>i.endsWith(e)))}function ft(e,t={}){if(!e)return null;let n=t.accept===void 0?et:t.accept,r=t.maxSizeMb===void 0?5:t.maxSizeMb;if(!dt(e,n)){let e=ut(n),t=P(n).map(e=>[`images`,`videos`,`audio`].includes(rt[e]));return t.every(Boolean)?`Choose ${e}.`:t.some(Boolean)?`Choose ${e.endsWith(` file`)?`${e}s`:`${e} files`}.`:`Choose a ${e.endsWith(` file`)?e:`${e} file`}.`}return r>0&&e.size>r*1024*1024?`Keep the file under ${r} MB.`:null}function pt(e,t){let n=Array.from(e||[]),r=t.multiple?n:n.slice(0,1),i=[],a=[];for(let e of r){let n=ft(e,{accept:t.accept,maxSizeMb:t.maxSizeMb});n?a.push({file:e,message:n}):i.push(e)}return{files:i,rejections:a}}function mt(e,t){let{overClass:n,isDisabled:r=()=>!1,onFiles:i,onReject:a,...o}=t,s=0,c=t=>e.classList.toggle(n,t),l=e=>{e.preventDefault(),r()||(s+=1,c(!0))},u=e=>{e.preventDefault(),r()||c(!0)},d=e=>{e.preventDefault(),r()||(s=Math.max(0,s-1),s===0&&c(!1))},f=e=>{if(e.preventDefault(),s=0,c(!1),r())return;let{files:t,rejections:n}=pt(e.dataTransfer?.files,o);t.length&&i(t),n.length&&a(n[0])};return e.addEventListener(`dragenter`,l),e.addEventListener(`dragover`,u),e.addEventListener(`dragleave`,d),e.addEventListener(`drop`,f),()=>{e.removeEventListener(`dragenter`,l),e.removeEventListener(`dragover`,u),e.removeEventListener(`dragleave`,d),e.removeEventListener(`drop`,f)}}var F=/[0-9]/,ht={9:F,A:/[A-Za-z]/,"*":/[0-9A-Za-z]/},gt=/[9A*]/,I=/* @__PURE__ */ new Set([`text`,`tel`,`search`,`url`,`password`]),_t=e=>{let t=e.replace(/\D/g,``);return t.length===12&&t.startsWith(`91`)?t.slice(2):t.length===11&&t.startsWith(`0`)?t.slice(1):e},vt=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},yt=e=>e.length<=3?e:`${e.slice(0,-3).replace(/\B(?=(\d{2})+(?!\d))/g,`,`)},${e.slice(-3)}`,bt=e=>{let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e.trim());return t?`${t[3]}-${t[2]}-${t[1]}`:e};function L(e,{upper:t=!1,normalize:n,valid:r,post:i=e=>e,message:a=`Enter the full value`}={}){let o=[...e].map(e=>ht[e]?{re:ht[e]}:{lit:e}),s=o.filter(e=>e.re).length;return{inputMode:o.every(e=>!e.re||e.re===F)?`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 xt(){return{inputMode:`decimal`,post:e=>e,message:`Enter a valid amount`,extract(e){let t=``,n=!1,r=0;for(let i of e)F.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=yt(t)+(e.includes(`.`)?`.${n}`:``);return{text:r,isRaw:[...r].map(e=>e!==`,`)}},isValid:e=>/^\d+(\.\d{1,2})?$/.test(e)}}var R={"phone-in":()=>L(`99999 99999`,{normalize:_t,valid:e=>/^[6-9]/.test(e),message:`Enter a 10-digit mobile number`}),pan:()=>L(`AAAAA9999A`,{upper:!0,valid:e=>/^[A-Z]{5}\d{4}[A-Z]$/.test(e),message:`Enter a valid PAN`}),gstin:()=>L(`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:()=>L(`9999 9999 9999`,{valid:e=>/^[2-9]/.test(e),message:`Enter a valid 12-digit Aadhaar number`}),ifsc:()=>L(`AAAA*******`,{upper:!0,valid:e=>/^[A-Z]{4}0[A-Z0-9]{6}$/.test(e),message:`Enter a valid IFSC`}),"pin-code":()=>L(`999999`,{valid:e=>/^[1-9]/.test(e),message:`Enter a valid 6-digit PIN code`}),date:()=>L(`99-99-9999`,{normalize:bt,valid:vt,post:(e,t)=>e.length===8&&vt(e)?`${e.slice(4)}-${e.slice(2,4)}-${e.slice(0,2)}`:t,message:`Enter a valid date as DD-MM-YYYY`}),amount:xt},St=Object.keys(R),Ct=e=>{let t=String(e).toLowerCase();return Object.hasOwn(R,t)?t:void 0},z=e=>gt.test(String(e))&&Ct(e)===void 0,B=/* @__PURE__ */ new Map;function V(e){if(e==null||e===``)return null;let t=String(e);return B.has(t)||(z(t)?B.set(t,L(t)):B.set(t,Object.hasOwn(R,t)?R[t]():null)),B.get(t)}var H=(e,t)=>e.normalize?e.normalize(t):t;function wt(e,t){let n=V(e);return n?n.extract(H(n,String(t??``))):String(t??``)}function Tt(e,t){let n=V(e);if(!n)return String(t??``);let r=n.extract(H(n,String(t??``)));return n.post(r,n.layout(r).text)}function Et(e,t){let n=V(e);return n?n.layout(n.extract(H(n,String(t??``)))).text:String(t??``)}var Dt=(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},U=/* @__PURE__ */ new WeakMap,Ot=e=>U.get(e)?.(),kt=/* @__PURE__ */ new WeakMap;function At(e,t,n,r){let i=e.getAll(t),a=kt.get(e);a||(a=/* @__PURE__ */ new Set,kt.set(e,a));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);else{e.delete(t);for(let n of i)e.append(t,n)}}}function jt(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 Mt(e,{mask:t,postFormatted:n=!1,onChange:r,onInvalidChange:i}={}){let a=V(t);if(!a||!I.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??jt(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&&I.has(e.type))){let t=Dt(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=H(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:H(a,e.value);v(n,e.selectionStart??n.length,!0)},C=()=>{f=!0},w=()=>{f=!1;let t=H(a,e.value);v(t,e.selectionStart??t.length,!0),x()},T=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()))},E=t=>{if(e.readOnly||e.disabled)return;let n=t.clipboardData?.getData(`text`);if(n==null)return;t.preventDefault();let r=H(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()},D=()=>{let t=a.extract(e.value);return a.post(t,a.layout(t).text)},O=()=>{p=!0,_()};e.addEventListener(`input`,S),e.addEventListener(`beforeinput`,T),e.addEventListener(`paste`,E),e.addEventListener(`compositionstart`,C),e.addEventListener(`compositionend`,w),e.addEventListener(`blur`,O),e.addEventListener(`invalid`,O);let k=e.form,A=t=>{e.name&&!e.disabled&&At(t.formData,e.name,e.value,D())},j=()=>{clearTimeout(g),g=setTimeout(()=>{p=!1,v(H(a,e.value),e.value.length,!0)},0)};n||(k?.addEventListener(`formdata`,A),U.set(e,D)),k?.addEventListener(`reset`,j),k?.addEventListener(`submit`,O);let M=H(a,e.value);return v(M,M.length,!1),()=>{clearTimeout(g),e.removeEventListener(`input`,S),e.removeEventListener(`beforeinput`,T),e.removeEventListener(`paste`,E),e.removeEventListener(`compositionstart`,C),e.removeEventListener(`compositionend`,w),e.removeEventListener(`blur`,O),e.removeEventListener(`invalid`,O),k?.removeEventListener(`formdata`,A),k?.removeEventListener(`reset`,j),k?.removeEventListener(`submit`,O),U.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 Nt(){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=Ot(e);return n===void 0?t.call(this,e):n},e.wuiMaskHook=!0}var W=/* @__PURE__ */ new WeakMap,G,Pt=e=>{W.has(e)||W.set(e,Mt(e,{mask:e.dataset.appMask,postFormatted:e.hasAttribute(`data-mask-post-formatted`)}))},Ft=e=>e.nodeType===1?[...e.matches(`input[data-app-mask]`)?[e]:[],...e.querySelectorAll(`input[data-app-mask]`)]:[];function It(){G||typeof MutationObserver>`u`||(G=new MutationObserver(e=>{for(let t of e){for(let e of t.removedNodes)for(let t of Ft(e))W.get(t)?.(),W.delete(t);for(let e of t.addedNodes)for(let t of Ft(e))Pt(t)}}),G.observe(document.documentElement,{childList:!0,subtree:!0}))}function Lt(e=document){Nt();for(let t of e.querySelectorAll(`input[data-app-mask]`))Pt(t);e===document&&It()}function Rt(e){let t=e?.querySelector(`[aria-current="page"]`);if(!t)return;let n=t.getBoundingClientRect();if(n.height===0)return;let r=e.getBoundingClientRect(),i=r.height,a=t=>t.top-r.top-e.clientTop+e.scrollTop,o=a(n),s=o+n.height,c=(t.closest(`.app-nav-group`)?.querySelector(`:scope > .app-nav-group-label`))?.getBoundingClientRect(),l;if(c&&c.height>0)l=Math.min(Math.max(a(c),s-i),o);else if(o<e.scrollTop)l=o;else if(s>e.scrollTop+i)l=s-i;else return;e.scrollTop=Math.max(0,l)}var K={minLength:10,uppercase:!0,lowercase:!0,digit:!0,special:!0,uniqueChars:0,customRules:[]},zt=`Password requirements`;function Bt(e){return e===!0||e==null?{...K}:{...K,...e}}function Vt(e){let t=Bt(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 q(e,t){let n=e==null?``:String(e);return Vt(t).map(e=>({key:e.key,label:e.label,met:e.test(n)}))}function Ht(e,t){return q(e,t).every(e=>e.met)}var J=`.table-wrap, .table-responsive, [class*="table-responsive-"]`,Y=1;function Ut(e){let t=()=>{let t=e.scrollWidth-e.clientWidth,n=Math.abs(e.scrollLeft);e.toggleAttribute(`data-wui-overflow-start`,t>Y&&n>Y),e.toggleAttribute(`data-wui-overflow-end`,t>Y&&n<t-Y),e.toggleAttribute(`data-wui-overflow-top`,e.scrollTop>Y)},n=()=>{if(e.scrollWidth-e.clientWidth>Y){let t=getComputedStyle(e);e.style.setProperty(`--wui-scroll-pad-start`,t.paddingInlineStart),e.style.setProperty(`--wui-scroll-pad-end`,t.paddingInlineEnd)}else e.style.getPropertyValue(`--wui-scroll-pad-end`)&&(e.style.removeProperty(`--wui-scroll-pad-start`),e.style.removeProperty(`--wui-scroll-pad-end`))},r=()=>{n(),t()};e.addEventListener(`scroll`,t,{passive:!0});let i=null;if(typeof ResizeObserver<`u`){i=new ResizeObserver(r),i.observe(e);for(let t of e.children)i.observe(t)}return r(),()=>{e.removeEventListener(`scroll`,t),i?.disconnect(),e.removeAttribute(`data-wui-overflow-start`),e.removeAttribute(`data-wui-overflow-end`),e.removeAttribute(`data-wui-overflow-top`),e.style.getPropertyValue(`--wui-scroll-pad-end`)&&(e.style.removeProperty(`--wui-scroll-pad-start`),e.style.removeProperty(`--wui-scroll-pad-end`))}}var X=/* @__PURE__ */ new WeakMap,Z,Wt=e=>{X.has(e)||X.set(e,Ut(e))},Gt=e=>{if(e.nodeType!==1)return[];let t=e.matches(`.table-wrap, .table-responsive, [class*="table-responsive-"]`)?[e]:[];return e.firstElementChild===null?t:[...t,...e.querySelectorAll(J)]};function Kt(){Z||typeof MutationObserver>`u`||(Z=new MutationObserver(e=>{for(let t of e){for(let e of t.removedNodes)for(let t of Gt(e))X.get(t)?.(),X.delete(t);for(let e of t.addedNodes)for(let t of Gt(e))Wt(t)}}),Z.observe(document.documentElement,{childList:!0,subtree:!0}))}function qt(e=document){for(let t of e.querySelectorAll(J))Wt(t);e===document&&Kt()}var Jt=`data-wui-submit-once`,Q=`data-wui-submit-pending`,Yt=/* @__PURE__ */ new WeakSet,$=/* @__PURE__ */ new WeakMap;function Xt(e){return e.method===`post`&&e.target!==`_blank`&&e.getAttribute(`data-wui-submit-once`)!==`off`}function Zt(e){let t=e.target;if(!(t instanceof HTMLFormElement)||!Xt(t))return;if(t.hasAttribute(Q)){e.preventDefault();return}t.setAttribute(Q,``);let n=e.submitter;setTimeout(()=>{t.hasAttribute(Q)&&(e.defaultPrevented?t.removeAttribute(Q):n&&(n.disabled=!0,$.set(t,n)))},0)}function Qt(e){for(let t of e.querySelectorAll(`form[${Q}]`)){t.removeAttribute(Q);let e=$.get(t);e&&(e.disabled=!1,$.delete(t))}}function $t(e){let t=e.ownerDocument??e;Yt.has(t)||(Yt.add(t),t.addEventListener(`submit`,Zt,!0),t.defaultView?.addEventListener(`pageshow`,()=>Qt(t)))}export{Be as AVATAR_ACCEPT,Ve as AVATAR_MAX_SIZE_MB,He as AVATAR_OUTPUT_SIZE,Ue as AVATAR_OUTPUT_TYPE,We as AVATAR_PREVIEW_SIZES,N as AVATAR_TEXT,Je as COMMAND_SHORTCUT_ATTRIBUTE,t as COPY_FEEDBACK_MS,v as CURRENCIES,n as CURRENCY_SYMBOLS,p as DATE_PATTERNS,b as DEFAULT_CURRENCY,et as DEFAULT_IMAGE_ACCEPT,tt as DEFAULT_MAX_SIZE_MB,K as DEFAULT_PASSWORD_RULES,zt as DEFAULT_REQUIREMENTS_TITLE,pe as DEFAULT_THEME_EFFECT,ce as DEFAULT_THEME_STORAGE_KEY,g as DURATION_UNITS,u as EMPTY_VALUE,r as FORMAT_STYLES,ze as IST_TIME_ZONE,ke as LIST_KEYS,I as MASK_INPUT_TYPES,St as MASK_NAMES,m as MONEY_UNITS,A as NOTIFICATION_COUNT_CAP,E as NOTIFICATION_TEXT,J as SCROLL_EDGE_SELECTOR,we as SELECT_KEY,De as SHORTCUTS_OFF_ATTRIBUTE,xe as SHORTCUT_EVENT,_e as SHORTCUT_SCOPE_ATTRIBUTE,Te as SHORTCUT_TEXT,Jt as SUBMIT_ONCE_ATTRIBUTE,de as THEME_CHANGE_EVENT,ae as THEME_EFFECTS,M as THEME_EFFECT_DURATION,le as THEME_MODES,fe as THEME_SWITCHING_CLASS,pt as acceptDroppedFiles,ut as acceptLabel,ee as applyTheme,Oe as ariaKeyShortcuts,mt as attachFileDrop,Mt as attachInputMask,he as attachRowDrag,Ut as attachScrollEdges,qe as avatarCropOptions,Ke as avatarUnreadableMessage,Vt as buildPasswordRules,e as copyTextToClipboard,x as currencyPrefix,Me as deriveStepStatus,q as evaluatePassword,_ as formatCompact,a as formatCurrency,d as formatDate,y as formatDateTime,o as formatDuration,st as formatFileSize,Et as formatMasked,s as formatNumber,h as formatPercent,f as formatValue,S as glyphSvg,O as groupNotificationsByDay,ve as inShortcutScope,$e as initCommandShortcuts,Lt as initInputMasks,qt as initScrollEdges,$t as initSubmitOnce,Ze as isCommandChord,i as isCurrencyCode,Ge as isHeicFile,at as isImageFile,lt as isImageOnlyAccept,z as isMaskPattern,ct as isPdfFile,Fe as isTimeZone,Se as isTypingTarget,Ot as maskedPostValue,Ne as matchSegments,dt as matchesAccept,Ae as moveFocus,oe as nextTheme,T as notificationCountText,C as notificationDayHeading,D as notificationTime,k as notificationTriggerLabel,w as notificationUnreadAnnouncement,Ht as passwordSatisfies,Tt as postedMasked,wt as rawMasked,me as readStoredTheme,V as resolveMask,te as resolveTheme,Rt as revealActiveNavItem,ye as runShortcut,be as shortcutKey,Ee as shortcutName,Ce as shortcutsOff,je as stepperHeaderItems,ne as storeTheme,ge as syncTargets,ue as themeBootScript,se as themeKeyframes,l as timeZoneLabel,c as toInstant,Le as todayIn,ie as transitionTheme,ft as validateFile,Pe as wallClockOf,re as watchSystemTheme,j as withTrustedLabel,Ie as zoneOffsetMs,Re as zoneParts};
1
+ import{n as e,t}from"./copyText-DM5HhXjf.js";import{_ as n,a as r,b as i,c as a,d as o,f as s,g as c,h as l,i as u,l as d,m as f,n as p,o as m,p as h,r as g,s as _,t as v,u as y,v as b,y as x}from"./formatters-Ba0CvsTs.js";import{t as S}from"./iconGlyphs.g-BlwTSNXS.js";import{a as C,c as w,i as T,n as E,o as D,r as O,s as k,t as A}from"./notificationDays-dNQZGLlB.js";import{o as j}from"./optionLabel-CLemms21.js";import{a as M,c as ee,d as te,f as ne,g as re,h as ie,i as ae,l as oe,m as se,n as ce,o as le,p as ue,r as de,s as fe,t as pe,u as me,v as he,y as ge}from"./themeTransition-rHRVbhHB.js";import{a as _e,c as ve,d as ye,f as be,i as xe,l as Se,m as Ce,n as we,o as Te,p as Ee,r as De,s as Oe,t as ke,u as Ae}from"./shortcutKeys-CvxSh3bV.js";import{n as je,t as Me}from"./stepperHeader-yinJ_7Dk.js";import{t as Ne}from"./textMatch-wdY7XLIc.js";import{i as Pe,n as Fe,o as Ie,r as Le,s as Re,t as ze}from"./zone-D82f-GU_.js";var Be=`image/jpeg,image/png,image/webp,image/heic,image/heif,.heic,.heif`,Ve=10,He=512,Ue=`image/webp`,We=[96,48],N={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 Ge(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 Ke(e){return Ge(e)?N.heicUnreadable:N.unreadable}function qe(e,t){let n=Number(t);return{name:e?.name||`photo`,type:Ue,size:Number.isInteger(n)&&n>0?n:512}}var Je=`data-wui-command-shortcut`,Ye=`k`,Xe=/* @__PURE__ */ new WeakSet;function Ze(e,t){return!(e.ctrlKey||e.metaKey)||e.altKey||e.shiftKey||e.repeat?!1:String(e.key).toLowerCase()===String(t).toLowerCase()}function Qe(e){let t=window.bootstrap?.Modal;if(!t)throw Error(`data-wui-command-shortcut: Bootstrap's bundle (window.bootstrap) is not loaded on this page.`);let n=e.closest(`.modal`);n&&t.getOrCreateInstance(n).show()}function $e(e){let t=e.ownerDocument??e;!Xe.has(t)&&e.querySelector(`[data-wui-command-shortcut]`)&&(Xe.add(t),t.addEventListener(`keydown`,e=>{for(let n of t.querySelectorAll(`[${Je}]`))if(Ze(e,n.getAttribute(`data-wui-command-shortcut`)||Ye)){e.preventDefault(),n.localName===`wui-command-palette`||n.classList.contains(`modal`)?Qe(n):(n.focus(),n.select?.());return}}))}var et=`image/png,image/jpeg,image/webp`,tt=5,nt={"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`]},rt={"image/png":`PNG`,"image/jpeg":`JPG`,"image/webp":`WEBP`,"image/gif":`GIF`,"image/svg+xml":`SVG`,"image/heic":`HEIC`,"image/heif":`HEIC`,"application/pdf":`PDF`,"text/plain":`text file`,"image/*":`images`,"video/*":`videos`,"audio/*":`audio`,".png":`PNG`,".jpg":`JPG`,".jpeg":`JPG`,".webp":`WEBP`,".gif":`GIF`,".svg":`SVG`,".heic":`HEIC`,".heif":`HEIC`,".pdf":`PDF`,".txt":`text file`},P=e=>String(e||``).split(`,`).map(e=>e.trim().toLowerCase()).filter(Boolean),it=[`.png`,`.jpg`,`.jpeg`,`.webp`,`.gif`,`.svg`,`.bmp`,`.avif`,`.heic`,`.heif`];function at(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 it.some(e=>r.endsWith(e))}var ot=[`KB`,`MB`,`GB`];function st(e){if(e<1024)return`${e} B`;let t=e/1024,n=0;for(;t>=1024&&n<ot.length-1;)t/=1024,n+=1;return`${t.toFixed(1)} ${ot[n]}`}function ct(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 lt(e){let t=P(e);return t.length?t.every(e=>e.startsWith(`.`)?it.includes(e):e===`image/*`||e.startsWith(`image/`)):!1}function ut(e){let t=[];for(let n of P(e)){let e=rt[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 dt(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&&(nt[e]||[]).some(e=>i.endsWith(e)))}function ft(e,t={}){if(!e)return null;let n=t.accept===void 0?et:t.accept,r=t.maxSizeMb===void 0?5:t.maxSizeMb;if(!dt(e,n)){let e=ut(n),t=P(n).map(e=>[`images`,`videos`,`audio`].includes(rt[e]));return t.every(Boolean)?`Choose ${e}.`:t.some(Boolean)?`Choose ${e.endsWith(` file`)?`${e}s`:`${e} files`}.`:`Choose a ${e.endsWith(` file`)?e:`${e} file`}.`}return r>0&&e.size>r*1024*1024?`Keep the file under ${r} MB.`:null}function pt(e,t){let n=Array.from(e||[]),r=t.multiple?n:n.slice(0,1),i=[],a=[];for(let e of r){let n=ft(e,{accept:t.accept,maxSizeMb:t.maxSizeMb});n?a.push({file:e,message:n}):i.push(e)}return{files:i,rejections:a}}function mt(e,t){let{overClass:n,isDisabled:r=()=>!1,onFiles:i,onReject:a,...o}=t,s=0,c=t=>e.classList.toggle(n,t),l=e=>{e.preventDefault(),r()||(s+=1,c(!0))},u=e=>{e.preventDefault(),r()||c(!0)},d=e=>{e.preventDefault(),r()||(s=Math.max(0,s-1),s===0&&c(!1))},f=e=>{if(e.preventDefault(),s=0,c(!1),r())return;let{files:t,rejections:n}=pt(e.dataTransfer?.files,o);t.length&&i(t),n.length&&a(n[0])};return e.addEventListener(`dragenter`,l),e.addEventListener(`dragover`,u),e.addEventListener(`dragleave`,d),e.addEventListener(`drop`,f),()=>{e.removeEventListener(`dragenter`,l),e.removeEventListener(`dragover`,u),e.removeEventListener(`dragleave`,d),e.removeEventListener(`drop`,f)}}var F=/[0-9]/,ht={9:F,A:/[A-Za-z]/,"*":/[0-9A-Za-z]/},gt=/[9A*]/,I=/* @__PURE__ */ new Set([`text`,`tel`,`search`,`url`,`password`]),_t=e=>{let t=e.replace(/\D/g,``);return t.length===12&&t.startsWith(`91`)?t.slice(2):t.length===11&&t.startsWith(`0`)?t.slice(1):e},vt=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},yt=e=>e.length<=3?e:`${e.slice(0,-3).replace(/\B(?=(\d{2})+(?!\d))/g,`,`)},${e.slice(-3)}`,bt=e=>{let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e.trim());return t?`${t[3]}-${t[2]}-${t[1]}`:e};function L(e,{upper:t=!1,normalize:n,valid:r,post:i=e=>e,message:a=`Enter the full value`}={}){let o=[...e].map(e=>ht[e]?{re:ht[e]}:{lit:e}),s=o.filter(e=>e.re).length;return{inputMode:o.every(e=>!e.re||e.re===F)?`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 xt(){return{inputMode:`decimal`,post:e=>e,message:`Enter a valid amount`,extract(e){let t=``,n=!1,r=0;for(let i of e)F.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=yt(t)+(e.includes(`.`)?`.${n}`:``);return{text:r,isRaw:[...r].map(e=>e!==`,`)}},isValid:e=>/^\d+(\.\d{1,2})?$/.test(e)}}var R={"phone-in":()=>L(`99999 99999`,{normalize:_t,valid:e=>/^[6-9]/.test(e),message:`Enter a 10-digit mobile number`}),pan:()=>L(`AAAAA9999A`,{upper:!0,valid:e=>/^[A-Z]{5}\d{4}[A-Z]$/.test(e),message:`Enter a valid PAN`}),gstin:()=>L(`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:()=>L(`9999 9999 9999`,{valid:e=>/^[2-9]/.test(e),message:`Enter a valid 12-digit Aadhaar number`}),ifsc:()=>L(`AAAA*******`,{upper:!0,valid:e=>/^[A-Z]{4}0[A-Z0-9]{6}$/.test(e),message:`Enter a valid IFSC`}),"pin-code":()=>L(`999999`,{valid:e=>/^[1-9]/.test(e),message:`Enter a valid 6-digit PIN code`}),date:()=>L(`99-99-9999`,{normalize:bt,valid:vt,post:(e,t)=>e.length===8&&vt(e)?`${e.slice(4)}-${e.slice(2,4)}-${e.slice(0,2)}`:t,message:`Enter a valid date as DD-MM-YYYY`}),amount:xt},St=Object.keys(R),Ct=e=>{let t=String(e).toLowerCase();return Object.hasOwn(R,t)?t:void 0},wt=e=>gt.test(String(e))&&Ct(e)===void 0,z=/* @__PURE__ */ new Map;function B(e){if(e==null||e===``)return null;let t=String(e);return z.has(t)||(wt(t)?z.set(t,L(t)):z.set(t,Object.hasOwn(R,t)?R[t]():null)),z.get(t)}var V=(e,t)=>e.normalize?e.normalize(t):t;function Tt(e,t){let n=B(e);return n?n.extract(V(n,String(t??``))):String(t??``)}function Et(e,t){let n=B(e);if(!n)return String(t??``);let r=n.extract(V(n,String(t??``)));return n.post(r,n.layout(r).text)}function Dt(e,t){let n=B(e);return n?n.layout(n.extract(V(n,String(t??``)))).text:String(t??``)}var Ot=(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},H=/* @__PURE__ */ new WeakMap,kt=e=>H.get(e)?.(),At=/* @__PURE__ */ new WeakMap;function jt(e,t,n,r){let i=e.getAll(t),a=At.get(e);a||(a=/* @__PURE__ */ new Set,At.set(e,a));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);else{e.delete(t);for(let n of i)e.append(t,n)}}}function Mt(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 Nt(e,{mask:t,postFormatted:n=!1,onChange:r,onInvalidChange:i}={}){let a=B(t);if(!a||!I.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??Mt(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&&I.has(e.type))){let t=Ot(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=V(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:V(a,e.value);v(n,e.selectionStart??n.length,!0)},C=()=>{f=!0},w=()=>{f=!1;let t=V(a,e.value);v(t,e.selectionStart??t.length,!0),x()},T=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()))},E=t=>{if(e.readOnly||e.disabled)return;let n=t.clipboardData?.getData(`text`);if(n==null)return;t.preventDefault();let r=V(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()},D=()=>{let t=a.extract(e.value);return a.post(t,a.layout(t).text)},O=()=>{p=!0,_()};e.addEventListener(`input`,S),e.addEventListener(`beforeinput`,T),e.addEventListener(`paste`,E),e.addEventListener(`compositionstart`,C),e.addEventListener(`compositionend`,w),e.addEventListener(`blur`,O),e.addEventListener(`invalid`,O);let k=e.form,A=t=>{e.name&&!e.disabled&&jt(t.formData,e.name,e.value,D())},j=()=>{clearTimeout(g),g=setTimeout(()=>{p=!1,v(V(a,e.value),e.value.length,!0)},0)};n||(k?.addEventListener(`formdata`,A),H.set(e,D)),k?.addEventListener(`reset`,j),k?.addEventListener(`submit`,O);let M=V(a,e.value);return v(M,M.length,!1),()=>{clearTimeout(g),e.removeEventListener(`input`,S),e.removeEventListener(`beforeinput`,T),e.removeEventListener(`paste`,E),e.removeEventListener(`compositionstart`,C),e.removeEventListener(`compositionend`,w),e.removeEventListener(`blur`,O),e.removeEventListener(`invalid`,O),k?.removeEventListener(`formdata`,A),k?.removeEventListener(`reset`,j),k?.removeEventListener(`submit`,O),H.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 Pt(){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=kt(e);return n===void 0?t.call(this,e):n},e.wuiMaskHook=!0}var U=/* @__PURE__ */ new WeakMap,W,Ft=e=>{U.has(e)||U.set(e,Nt(e,{mask:e.dataset.appMask,postFormatted:e.hasAttribute(`data-mask-post-formatted`)}))},It=e=>e.nodeType===1?[...e.matches(`input[data-app-mask]`)?[e]:[],...e.querySelectorAll(`input[data-app-mask]`)]:[];function Lt(){W||typeof MutationObserver>`u`||(W=new MutationObserver(e=>{for(let t of e){for(let e of t.removedNodes)for(let t of It(e))U.get(t)?.(),U.delete(t);for(let e of t.addedNodes)for(let t of It(e))Ft(t)}}),W.observe(document.documentElement,{childList:!0,subtree:!0}))}function Rt(e=document){Pt();for(let t of e.querySelectorAll(`input[data-app-mask]`))Ft(t);e===document&&Lt()}function zt(e){let t=e?.querySelector(`[aria-current="page"]`);if(!t)return;let n=t.getBoundingClientRect();if(n.height===0)return;let r=e.getBoundingClientRect(),i=r.height,a=t=>t.top-r.top-e.clientTop+e.scrollTop,o=a(n),s=o+n.height,c=(t.closest(`.app-nav-group`)?.querySelector(`:scope > .app-nav-group-label`))?.getBoundingClientRect(),l;if(c&&c.height>0)l=Math.min(Math.max(a(c),s-i),o);else if(o<e.scrollTop)l=o;else if(s>e.scrollTop+i)l=s-i;else return;e.scrollTop=Math.max(0,l)}var G={minLength:10,uppercase:!0,lowercase:!0,digit:!0,special:!0,uniqueChars:0,customRules:[]},Bt=`Password requirements`;function Vt(e){return e===!0||e==null?{...G}:{...G,...e}}function Ht(e){let t=Vt(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 Ut(e,t){let n=e==null?``:String(e);return Ht(t).map(e=>({key:e.key,label:e.label,met:e.test(n)}))}function Wt(e,t){return Ut(e,t).every(e=>e.met)}var K=`.table-wrap, .table-responsive, [class*="table-responsive-"]`,q=1;function J(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 Y=/* @__PURE__ */ new WeakMap,X,Gt=e=>{Y.has(e)||Y.set(e,J(e))},Kt=e=>{if(e.nodeType!==1)return[];let t=e.matches(`.table-wrap, .table-responsive, [class*="table-responsive-"]`)?[e]:[];return e.firstElementChild===null?t:[...t,...e.querySelectorAll(K)]};function qt(){X||typeof MutationObserver>`u`||(X=new MutationObserver(e=>{for(let t of e){for(let e of t.removedNodes)for(let t of Kt(e))Y.get(t)?.(),Y.delete(t);for(let e of t.addedNodes)for(let t of Kt(e))Gt(t)}}),X.observe(document.documentElement,{childList:!0,subtree:!0}))}function Jt(e=document){for(let t of e.querySelectorAll(K))Gt(t);e===document&&qt()}var Yt=`data-wui-submit-once`,Z=`data-wui-submit-pending`,Q=`wui-submit-spinner`,Xt=/* @__PURE__ */ new WeakSet,$=/* @__PURE__ */ new WeakMap;function Zt(e){if(e.setAttribute(`aria-busy`,`true`),e.tagName===`INPUT`||e.querySelector(`.${Q}`))return;let t=e.ownerDocument.createElement(`span`);t.className=`spinner-border spinner-border-sm me-2 ${Q}`,t.setAttribute(`aria-hidden`,`true`),e.prepend(t)}function Qt(e){e.removeAttribute(`aria-busy`),e.querySelector(`.${Q}`)?.remove()}function $t(e){return e.method===`post`&&e.target!==`_blank`&&e.getAttribute(`data-wui-submit-once`)!==`off`}function en(e){let t=e.target;if(!(t instanceof HTMLFormElement)||!$t(t))return;if(t.hasAttribute(Z)){e.preventDefault();return}t.setAttribute(Z,``);let n=e.submitter;setTimeout(()=>{t.hasAttribute(Z)&&(e.defaultPrevented?t.removeAttribute(Z):n&&(n.disabled=!0,Zt(n),$.set(t,n)))},0)}function tn(e){for(let t of e.querySelectorAll(`form[${Z}]`)){t.removeAttribute(Z);let e=$.get(t);e&&(e.disabled=!1,Qt(e),$.delete(t))}}function nn(e){let t=e.ownerDocument??e;Xt.has(t)||(Xt.add(t),t.addEventListener(`submit`,en,!0),t.defaultView?.addEventListener(`pageshow`,()=>tn(t)))}export{Be as AVATAR_ACCEPT,Ve as AVATAR_MAX_SIZE_MB,He as AVATAR_OUTPUT_SIZE,Ue as AVATAR_OUTPUT_TYPE,We as AVATAR_PREVIEW_SIZES,N as AVATAR_TEXT,Je as COMMAND_SHORTCUT_ATTRIBUTE,t as COPY_FEEDBACK_MS,v as CURRENCIES,n as CURRENCY_SYMBOLS,p as DATE_PATTERNS,b as DEFAULT_CURRENCY,et as DEFAULT_IMAGE_ACCEPT,tt as DEFAULT_MAX_SIZE_MB,G as DEFAULT_PASSWORD_RULES,Bt as DEFAULT_REQUIREMENTS_TITLE,pe as DEFAULT_THEME_EFFECT,ce as DEFAULT_THEME_STORAGE_KEY,g as DURATION_UNITS,u as EMPTY_VALUE,r as FORMAT_STYLES,ze as IST_TIME_ZONE,ke as LIST_KEYS,I as MASK_INPUT_TYPES,St as MASK_NAMES,m as MONEY_UNITS,A as NOTIFICATION_COUNT_CAP,E as NOTIFICATION_TEXT,K as SCROLL_EDGE_SELECTOR,we as SELECT_KEY,De as SHORTCUTS_OFF_ATTRIBUTE,xe as SHORTCUT_EVENT,_e as SHORTCUT_SCOPE_ATTRIBUTE,Te as SHORTCUT_TEXT,Yt as SUBMIT_ONCE_ATTRIBUTE,de as THEME_CHANGE_EVENT,ae as THEME_EFFECTS,M as THEME_EFFECT_DURATION,le as THEME_MODES,fe as THEME_SWITCHING_CLASS,pt as acceptDroppedFiles,ut as acceptLabel,ee as applyTheme,Oe as ariaKeyShortcuts,mt as attachFileDrop,Nt as attachInputMask,he as attachRowDrag,J as attachScrollEdges,qe as avatarCropOptions,Ke as avatarUnreadableMessage,Ht as buildPasswordRules,e as copyTextToClipboard,x as currencyPrefix,Me as deriveStepStatus,Ut as evaluatePassword,_ as formatCompact,a as formatCurrency,d as formatDate,y as formatDateTime,o as formatDuration,st as formatFileSize,Dt as formatMasked,s as formatNumber,h as formatPercent,f as formatValue,S as glyphSvg,O as groupNotificationsByDay,ve as inShortcutScope,$e as initCommandShortcuts,Rt as initInputMasks,Jt as initScrollEdges,nn as initSubmitOnce,Ze as isCommandChord,i as isCurrencyCode,Ge as isHeicFile,at as isImageFile,lt as isImageOnlyAccept,wt as isMaskPattern,ct as isPdfFile,Fe as isTimeZone,Se as isTypingTarget,kt as maskedPostValue,Ne as matchSegments,dt as matchesAccept,Ae as moveFocus,oe as nextTheme,T as notificationCountText,C as notificationDayHeading,D as notificationTime,k as notificationTriggerLabel,w as notificationUnreadAnnouncement,Wt as passwordSatisfies,Et as postedMasked,Tt as rawMasked,me as readStoredTheme,B as resolveMask,te as resolveTheme,zt as revealActiveNavItem,ye as runShortcut,be as shortcutKey,Ee as shortcutName,Ce as shortcutsOff,je as stepperHeaderItems,ne as storeTheme,ge as syncTargets,ue as themeBootScript,se as themeKeyframes,l as timeZoneLabel,c as toInstant,Le as todayIn,ie as transitionTheme,ft as validateFile,Pe as wallClockOf,re as watchSystemTheme,j as withTrustedLabel,Ie as zoneOffsetMs,Re as zoneParts};
package/dist/server.js CHANGED
@@ -1 +1 @@
1
- import{C as e,S as t,T as n,_ as r,a as i,b as a,c as o,d as s,f as c,g as l,h as u,i as d,l as f,m as p,n as m,o as h,p as g,r as _,s as v,t as y,u as b,v as x,w as S,x as C,y as w}from"./drawerDiscard-B5J5OEeg.js";import{a as T,c as E,d as D,i as O,l as k,n as A,o as j,r as M,s as N,t as P,u as F}from"./wuiHttp-DgnM7K2Q.js";var I=31536e3,L=/* @__PURE__ */ new WeakMap,R=e=>e>99?`99+`:String(e),z=(e,t)=>Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{${t}}`,()=>String(n)),e);function B(e,t,n=document){try{n.cookie=`${e}=${t?`1`:`0`}; Path=/; Max-Age=${I}; SameSite=Lax`}catch(e){if(!(e instanceof DOMException&&e.name===`SecurityError`))throw e}}function V(e,t,n,r=document){try{let i=`${e}=`,a=r.cookie.split(`;`).map(e=>e.trim()).find(e=>e.startsWith(i)),o=new Set(a?a.slice(i.length).split(`.`).filter(Boolean):[]);n?o.add(t):o.delete(t),r.cookie=`${e}=${[...o].join(`.`)}; Path=/; Max-Age=${I}; SameSite=Lax`}catch(e){if(!(e instanceof DOMException&&e.name===`SecurityError`))throw e}}var H=e=>{let t=document.createElement(`template`);return t.innerHTML=e,t.content},U=(e,t)=>{let n=document.createElement(`div`);return n.className=e,n.textContent=t,n};function W(e,t){let n=e.querySelector(`.wui-bell-trigger`),r=e.querySelector(`.wui-bell-count`),i=e.querySelector(`[data-wui-bell-live]`),a=e.querySelector(`[data-wui-bell-list]`),o=e.querySelector(`.wui-bell-menu`),{src:s,readAction:c}=e.dataset,l=e.dataset.label||`Notifications`,u=e.dataset.emptyText||`You are all caught up.`,d=e.dataset.loadingText??`Loading…`,f=e.dataset.noUnreadText??`No unread notifications`,p=e.dataset.unreadText??`{count} unread notifications`,m=e.dataset.bellLabel??`{label}, {count} unread`,h=Number(e.dataset.pollSeconds??60),g=N(),_=Number(e.dataset.unread)||0,v=(t,a=!0)=>{let o=Math.max(0,Number(t)||0),s=o!==_;_=o,e.dataset.unread=String(o),r&&(r.textContent=R(o),r.hidden=o===0),n?.setAttribute(`aria-label`,o===0?l:z(m,{label:l,count:R(o)})),a&&s&&i&&(i.textContent=o===0?f:z(p,{count:R(o)}))},y=()=>o?.classList.contains(`show`)??!1,b=()=>{let e=U(`wui-bell-state`,`Could not load notifications. `),t=document.createElement(`button`);t.type=`button`,t.className=`btn btn-link btn-sm`,t.dataset.wuiBellRetry=``,t.textContent=`Retry`,e.append(t),a.replaceChildren(e)},x=async t=>{t&&(a.setAttribute(`aria-busy`,`true`),a.querySelector(`.wui-bell-item`)||a.replaceChildren(U(`wui-bell-state`,d)));let n=await g.run(s);if(n.kind===`aborted`||n.kind===`stale`||n.kind===`session`)return;if(a.removeAttribute(`aria-busy`),!n.ok){t&&b();return}let r=H(n.html),i=r.querySelector(`[data-wui-unread]`),o=i?Number(i.getAttribute(`data-wui-unread`)):_;v(o),(t||y())&&(r.querySelector(`.wui-bell-item`)?a.replaceChildren(r):a.replaceChildren(U(`wui-bell-state`,u))),e.dispatchEvent(new CustomEvent(`wui:notifications:loaded`,{bubbles:!0,detail:{unread:o}}))};e.addEventListener(`show.bs.dropdown`,()=>x(!0)),e.addEventListener(`click`,async e=>{if(e.target.closest(`[data-wui-bell-retry]`)){x(!0);return}let t=e.target.closest(`[data-wui-bell-read]`);if(!t||!c)return;t.disabled=!0;let n=await k(c,{method:`POST`});t.disabled=!1,n.ok&&(v(0),x(!0))});let S=null,C=()=>{h>0&&S===null&&(S=setInterval(()=>x(y()),h*1e3))},w=()=>{S!==null&&clearInterval(S),S=null},T=()=>{document.hidden?w():(x(y()),C())};return h>0&&(document.addEventListener(`visibilitychange`,T),document.hidden||C()),t.push(()=>{w(),g.abort(),document.removeEventListener(`visibilitychange`,T)}),{setUnread:e=>v(e),refresh:()=>x(y())}}var G=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName)),K=(e,t,n)=>`${e}${e.includes(`?`)?`&`:`?`}${encodeURIComponent(t)}=${encodeURIComponent(n)}`;function q(e,t){let n=e.querySelector(`input.search-input`),r=e.querySelector(`.wui-topsearch-results`),i=e.querySelector(`.wui-topsearch-open`),a=e.querySelector(`[data-wui-topsearch-live]`),{src:o,param:s=`q`,resultsHref:c}=e.dataset,l=Number(e.dataset.minChars??2),u=Number(e.dataset.debounceMs??250),d=e.dataset.noResultsText??`No results`,f=e.dataset.resultsCountText??`{count} results`,p=e.dataset.resultCountText??`{count} result`,m=N(),h=null,g=-1,_=()=>[...r.querySelectorAll(`.wui-topsearch-hit`)],v=e=>{let t=_();g=t.length===0?-1:(e+t.length)%t.length,t.forEach((e,t)=>{let n=t===g;e.classList.toggle(`is-active`,n),e.setAttribute(`aria-selected`,n?`true`:`false`)}),g>=0?(n.setAttribute(`aria-activedescendant`,t[g].id),t[g].scrollIntoView?.({block:`nearest`})):n.removeAttribute(`aria-activedescendant`)},y=()=>{r.hidden=!0,n.setAttribute(`aria-expanded`,`false`),n.removeAttribute(`aria-activedescendant`),g=-1},b=()=>{r.hidden=!1,n.setAttribute(`aria-expanded`,`true`)},x=t=>{e.classList.toggle(`is-open`,t),i?.setAttribute(`aria-expanded`,t?`true`:`false`)},S=t=>{let n=new CustomEvent(`wui:search:select`,{bubbles:!0,cancelable:!0,detail:{href:t}});e.dispatchEvent(n)&&window.location.assign(t)},C=async t=>{e.classList.add(`is-loading`);let n=await m.run(K(o,s,t));if(n.kind!==`aborted`&&n.kind!==`stale`&&n.kind!==`session`){if(e.classList.remove(`is-loading`),n.ok){let e=H(n.html),t=e.querySelector(`[data-wui-count]`);r.replaceChildren(e),_().forEach((e,t)=>{e.id=`${r.id}-opt-${t}`});let i=t?Number(t.getAttribute(`data-wui-count`)):_().length;a&&(a.textContent=i===0?d:z(i===1?p:f,{count:i}))}else r.replaceChildren(U(`wui-topsearch-empty`,`Search is unavailable right now.`));g=-1,b()}};n.addEventListener(`input`,()=>{clearTimeout(h);let t=n.value.trim();t.length<l?(m.abort(),e.classList.remove(`is-loading`),r.replaceChildren(),y()):h=setTimeout(()=>C(t),u)}),n.addEventListener(`keydown`,t=>{if(t.key===`ArrowDown`||t.key===`ArrowUp`){if(r.hidden||_().length===0)return;t.preventDefault(),v(g+(t.key===`ArrowDown`?1:-1))}else if(t.key===`Enter`){let e=_();!r.hidden&&g>=0&&e[g]?(t.preventDefault(),S(e[g].getAttribute(`href`))):c&&n.value.trim()!==``&&(t.preventDefault(),S(K(c,s,n.value.trim())))}else t.key===`Escape`&&(r.hidden?e.classList.contains(`is-open`)&&(t.preventDefault(),t.stopPropagation(),x(!1),i?.focus()):(t.preventDefault(),t.stopPropagation(),y()))}),r.addEventListener(`click`,e=>{let t=e.target.closest(`.wui-topsearch-hit`);!t||e.ctrlKey||e.metaKey||e.shiftKey||e.button===1||(e.preventDefault(),S(t.getAttribute(`href`)))}),i?.addEventListener(`click`,()=>{let t=!e.classList.contains(`is-open`);x(t),t&&n.focus()});let w=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||G(e.target)||(e.preventDefault(),x(!0),n.focus())},T=t=>{e.contains(t.target)||(y(),e.classList.contains(`is-open`)&&x(!1))};document.addEventListener(`keydown`,w),document.addEventListener(`pointerdown`,T),t.push(()=>{clearTimeout(h),m.abort(),document.removeEventListener(`keydown`,w),document.removeEventListener(`pointerdown`,T)})}function J(e){let t=[],n=e.dataset.wuiCollapsedCookie;n&&e.addEventListener(`wui:shell:collapse`,e=>B(n,!!e.detail?.collapsed));let r=e.dataset.wuiFoldedCookie;r&&e.addEventListener(`wui:shell:nav-fold`,e=>V(r,e.detail?.key,!!e.detail?.folded)),e.addEventListener(`click`,t=>{t.target.closest(`[data-wui-tabbar-more]`)&&e.querySelector(`[data-app-shell-menu]`)?.click()});let i=e.querySelector(`[data-wui-bell]`),a=i?W(i,t):null,o=e.querySelector(`[data-wui-topsearch]`);o&&q(o,t);let s={el:e,setUnread(e){if(!a)throw Error(`WUI.shell: this <app-shell> has no <app-shell-notifications>.`);a.setUnread(e)},refreshNotifications(){if(!a)throw Error(`WUI.shell: this <app-shell> has no <app-shell-notifications>.`);return a.refresh()},get collapsed(){return e.classList.contains(`collapsed`)},set collapsed(t){if(!!t===e.classList.contains(`collapsed`))return;let n=e.querySelector(`[data-app-shell-collapse]`);n?n.click():e.classList.toggle(`collapsed`,!!t)}};L.set(e,s);let c=n=>{if(n.target===e||n.target.contains?.(e)){for(let e of t)e();L.delete(e),delete e.dataset.wuiPartsWired,document.removeEventListener(`wui:teardown`,c)}};return document.addEventListener(`wui:teardown`,c),s}function Y(e=document){let t=[];e instanceof Element&&e.matches(`[data-app-shell]`)&&t.push(e),t.push(...e.querySelectorAll(`[data-app-shell]`));for(let e of t)e.dataset.wuiPartsWired||(e.dataset.wuiPartsWired=`1`,J(e))}function X(e){let t=e?.closest?.(`[data-app-shell]`)??null;return t?(L.has(t)||Y(t),L.get(t)??null):null}export{f as CONFIRM_DIALOG_ID,b as CONFIRM_TONES,P as CSRF_META_NAME,A as DEFAULT_CSRF_HEADER,y as DISCARD_EVENT,m as DISCARD_TEXT,s as FLASH_STORAGE_KEY,c as FLASH_VARIANTS,M as HTTP_KINDS,g as SERVER_ACTION_TEXT,F as TOAST_ACTION_METHODS,x as TOAST_ACTION_MS,i as UNSAVED_TEXT,O as WUI_HEADERS,T as classifyStatus,C as closeRemotePane,j as configureCsrf,p as confirmAction,_ as createDiscardPrompt,N as createRequestQueue,h as formValues,l as getServerTable,X as getShell,d as initDrawerDiscard,t as initRemoteModals,u as initServerActions,r as initServerTables,Y as initShellParts,v as initUnsavedChanges,e as loadRemoteDrawer,S as loadRemoteModal,n as loadRemotePane,D as parseToastAction,E as readCsrf,o as resetUnsavedChanges,w as runToastAction,a as showResultToast,k as wuiFetch};
1
+ import{C as e,S as t,T as n,_ as r,a as i,b as a,c as o,d as s,f as c,g as l,h as u,i as d,l as f,m as p,n as m,o as h,p as g,r as _,s as v,t as y,u as b,v as x,w as S,x as C,y as w}from"./drawerDiscard-DdoTN5aX.js";import{a as T,c as E,d as D,i as O,l as k,n as A,o as j,r as M,s as N,t as P,u as F}from"./wuiHttp-DgnM7K2Q.js";var I=31536e3,L=/* @__PURE__ */ new WeakMap,R=e=>e>99?`99+`:String(e),z=(e,t)=>Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{${t}}`,()=>String(n)),e);function B(e,t,n=document){try{n.cookie=`${e}=${t?`1`:`0`}; Path=/; Max-Age=${I}; SameSite=Lax`}catch(e){if(!(e instanceof DOMException&&e.name===`SecurityError`))throw e}}function V(e,t,n,r=document){try{let i=`${e}=`,a=r.cookie.split(`;`).map(e=>e.trim()).find(e=>e.startsWith(i)),o=new Set(a?a.slice(i.length).split(`.`).filter(Boolean):[]);n?o.add(t):o.delete(t),r.cookie=`${e}=${[...o].join(`.`)}; Path=/; Max-Age=${I}; SameSite=Lax`}catch(e){if(!(e instanceof DOMException&&e.name===`SecurityError`))throw e}}var H=e=>{let t=document.createElement(`template`);return t.innerHTML=e,t.content},U=(e,t)=>{let n=document.createElement(`div`);return n.className=e,n.textContent=t,n};function W(e,t){let n=e.querySelector(`.wui-bell-trigger`),r=e.querySelector(`.wui-bell-count`),i=e.querySelector(`[data-wui-bell-live]`),a=e.querySelector(`[data-wui-bell-list]`),o=e.querySelector(`.wui-bell-menu`),{src:s,readAction:c}=e.dataset,l=e.dataset.label||`Notifications`,u=e.dataset.emptyText||`You are all caught up.`,d=e.dataset.loadingText??`Loading…`,f=e.dataset.noUnreadText??`No unread notifications`,p=e.dataset.unreadText??`{count} unread notifications`,m=e.dataset.bellLabel??`{label}, {count} unread`,h=Number(e.dataset.pollSeconds??60),g=N(),_=Number(e.dataset.unread)||0,v=(t,a=!0)=>{let o=Math.max(0,Number(t)||0),s=o!==_;_=o,e.dataset.unread=String(o),r&&(r.textContent=R(o),r.hidden=o===0),n?.setAttribute(`aria-label`,o===0?l:z(m,{label:l,count:R(o)})),a&&s&&i&&(i.textContent=o===0?f:z(p,{count:R(o)}))},y=()=>o?.classList.contains(`show`)??!1,b=()=>{let e=U(`wui-bell-state`,`Could not load notifications. `),t=document.createElement(`button`);t.type=`button`,t.className=`btn btn-link btn-sm`,t.dataset.wuiBellRetry=``,t.textContent=`Retry`,e.append(t),a.replaceChildren(e)},x=async t=>{t&&(a.setAttribute(`aria-busy`,`true`),a.querySelector(`.wui-bell-item`)||a.replaceChildren(U(`wui-bell-state`,d)));let n=await g.run(s);if(n.kind===`aborted`||n.kind===`stale`||n.kind===`session`)return;if(a.removeAttribute(`aria-busy`),!n.ok){t&&b();return}let r=H(n.html),i=r.querySelector(`[data-wui-unread]`),o=i?Number(i.getAttribute(`data-wui-unread`)):_;v(o),(t||y())&&(r.querySelector(`.wui-bell-item`)?a.replaceChildren(r):a.replaceChildren(U(`wui-bell-state`,u))),e.dispatchEvent(new CustomEvent(`wui:notifications:loaded`,{bubbles:!0,detail:{unread:o}}))};e.addEventListener(`show.bs.dropdown`,()=>x(!0)),e.addEventListener(`click`,async e=>{if(e.target.closest(`[data-wui-bell-retry]`)){x(!0);return}let t=e.target.closest(`[data-wui-bell-read]`);if(!t||!c)return;t.disabled=!0;let n=await k(c,{method:`POST`});t.disabled=!1,n.ok&&(v(0),x(!0))});let S=null,C=()=>{h>0&&S===null&&(S=setInterval(()=>x(y()),h*1e3))},w=()=>{S!==null&&clearInterval(S),S=null},T=()=>{document.hidden?w():(x(y()),C())};return h>0&&(document.addEventListener(`visibilitychange`,T),document.hidden||C()),t.push(()=>{w(),g.abort(),document.removeEventListener(`visibilitychange`,T)}),{setUnread:e=>v(e),refresh:()=>x(y())}}var G=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName)),K=(e,t,n)=>`${e}${e.includes(`?`)?`&`:`?`}${encodeURIComponent(t)}=${encodeURIComponent(n)}`;function q(e,t){let n=e.querySelector(`input.search-input`),r=e.querySelector(`.wui-topsearch-results`),i=e.querySelector(`.wui-topsearch-open`),a=e.querySelector(`[data-wui-topsearch-live]`),{src:o,param:s=`q`,resultsHref:c}=e.dataset,l=Number(e.dataset.minChars??2),u=Number(e.dataset.debounceMs??250),d=e.dataset.noResultsText??`No results`,f=e.dataset.resultsCountText??`{count} results`,p=e.dataset.resultCountText??`{count} result`,m=N(),h=null,g=-1,_=()=>[...r.querySelectorAll(`.wui-topsearch-hit`)],v=e=>{let t=_();g=t.length===0?-1:(e+t.length)%t.length,t.forEach((e,t)=>{let n=t===g;e.classList.toggle(`is-active`,n),e.setAttribute(`aria-selected`,n?`true`:`false`)}),g>=0?(n.setAttribute(`aria-activedescendant`,t[g].id),t[g].scrollIntoView?.({block:`nearest`})):n.removeAttribute(`aria-activedescendant`)},y=()=>{r.hidden=!0,n.setAttribute(`aria-expanded`,`false`),n.removeAttribute(`aria-activedescendant`),g=-1},b=()=>{r.hidden=!1,n.setAttribute(`aria-expanded`,`true`)},x=t=>{e.classList.toggle(`is-open`,t),i?.setAttribute(`aria-expanded`,t?`true`:`false`)},S=t=>{let n=new CustomEvent(`wui:search:select`,{bubbles:!0,cancelable:!0,detail:{href:t}});e.dispatchEvent(n)&&window.location.assign(t)},C=async t=>{e.classList.add(`is-loading`);let n=await m.run(K(o,s,t));if(n.kind!==`aborted`&&n.kind!==`stale`&&n.kind!==`session`){if(e.classList.remove(`is-loading`),n.ok){let e=H(n.html),t=e.querySelector(`[data-wui-count]`);r.replaceChildren(e),_().forEach((e,t)=>{e.id=`${r.id}-opt-${t}`});let i=t?Number(t.getAttribute(`data-wui-count`)):_().length;a&&(a.textContent=i===0?d:z(i===1?p:f,{count:i}))}else r.replaceChildren(U(`wui-topsearch-empty`,`Search is unavailable right now.`));g=-1,b()}};n.addEventListener(`input`,()=>{clearTimeout(h);let t=n.value.trim();t.length<l?(m.abort(),e.classList.remove(`is-loading`),r.replaceChildren(),y()):h=setTimeout(()=>C(t),u)}),n.addEventListener(`keydown`,t=>{if(t.key===`ArrowDown`||t.key===`ArrowUp`){if(r.hidden||_().length===0)return;t.preventDefault(),v(g+(t.key===`ArrowDown`?1:-1))}else if(t.key===`Enter`){let e=_();!r.hidden&&g>=0&&e[g]?(t.preventDefault(),S(e[g].getAttribute(`href`))):c&&n.value.trim()!==``&&(t.preventDefault(),S(K(c,s,n.value.trim())))}else t.key===`Escape`&&(r.hidden?e.classList.contains(`is-open`)&&(t.preventDefault(),t.stopPropagation(),x(!1),i?.focus()):(t.preventDefault(),t.stopPropagation(),y()))}),r.addEventListener(`click`,e=>{let t=e.target.closest(`.wui-topsearch-hit`);!t||e.ctrlKey||e.metaKey||e.shiftKey||e.button===1||(e.preventDefault(),S(t.getAttribute(`href`)))}),i?.addEventListener(`click`,()=>{let t=!e.classList.contains(`is-open`);x(t),t&&n.focus()});let w=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||G(e.target)||(e.preventDefault(),x(!0),n.focus())},T=t=>{e.contains(t.target)||(y(),e.classList.contains(`is-open`)&&x(!1))};document.addEventListener(`keydown`,w),document.addEventListener(`pointerdown`,T),t.push(()=>{clearTimeout(h),m.abort(),document.removeEventListener(`keydown`,w),document.removeEventListener(`pointerdown`,T)})}function J(e){let t=[],n=e.dataset.wuiCollapsedCookie;n&&e.addEventListener(`wui:shell:collapse`,e=>B(n,!!e.detail?.collapsed));let r=e.dataset.wuiFoldedCookie;r&&e.addEventListener(`wui:shell:nav-fold`,e=>V(r,e.detail?.key,!!e.detail?.folded)),e.addEventListener(`click`,t=>{t.target.closest(`[data-wui-tabbar-more]`)&&e.querySelector(`[data-app-shell-menu]`)?.click()});let i=e.querySelector(`[data-wui-bell]`),a=i?W(i,t):null,o=e.querySelector(`[data-wui-topsearch]`);o&&q(o,t);let s={el:e,setUnread(e){if(!a)throw Error(`WUI.shell: this <app-shell> has no <app-shell-notifications>.`);a.setUnread(e)},refreshNotifications(){if(!a)throw Error(`WUI.shell: this <app-shell> has no <app-shell-notifications>.`);return a.refresh()},get collapsed(){return e.classList.contains(`collapsed`)},set collapsed(t){if(!!t===e.classList.contains(`collapsed`))return;let n=e.querySelector(`[data-app-shell-collapse]`);n?n.click():e.classList.toggle(`collapsed`,!!t)}};L.set(e,s);let c=n=>{if(n.target===e||n.target.contains?.(e)){for(let e of t)e();L.delete(e),delete e.dataset.wuiPartsWired,document.removeEventListener(`wui:teardown`,c)}};return document.addEventListener(`wui:teardown`,c),s}function Y(e=document){let t=[];e instanceof Element&&e.matches(`[data-app-shell]`)&&t.push(e),t.push(...e.querySelectorAll(`[data-app-shell]`));for(let e of t)e.dataset.wuiPartsWired||(e.dataset.wuiPartsWired=`1`,J(e))}function X(e){let t=e?.closest?.(`[data-app-shell]`)??null;return t?(L.has(t)||Y(t),L.get(t)??null):null}export{f as CONFIRM_DIALOG_ID,b as CONFIRM_TONES,P as CSRF_META_NAME,A as DEFAULT_CSRF_HEADER,y as DISCARD_EVENT,m as DISCARD_TEXT,s as FLASH_STORAGE_KEY,c as FLASH_VARIANTS,M as HTTP_KINDS,g as SERVER_ACTION_TEXT,F as TOAST_ACTION_METHODS,x as TOAST_ACTION_MS,i as UNSAVED_TEXT,O as WUI_HEADERS,T as classifyStatus,C as closeRemotePane,j as configureCsrf,p as confirmAction,_ as createDiscardPrompt,N as createRequestQueue,h as formValues,l as getServerTable,X as getShell,d as initDrawerDiscard,t as initRemoteModals,u as initServerActions,r as initServerTables,Y as initShellParts,v as initUnsavedChanges,e as loadRemoteDrawer,S as loadRemoteModal,n as loadRemotePane,D as parseToastAction,E as readCsrf,o as resetUnsavedChanges,w as runToastAction,a as showResultToast,k as wuiFetch};
@@ -1 +1 @@
1
- (function(e,t,n){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var r=globalThis.WeborityUiElementsInternal?.version;if(r!==`0.143.1`)throw Error(`[webority-ui] carousel expects ui-elements 0.143.1 but the page loaded `+r+`.`);var i=Object.freeze({slide:(e,t)=>`${e} of ${t}`,status:(e,t,n)=>e===t?`Slide ${e} of ${n}`:`Slides ${e} to ${t} of ${n}`,dot:`Go to slide`,pause:`Pause`,play:`Play`}),a=120,o=class extends n.ElementBase{static get observedAttributes(){return[`autoplay`]}constructor(){super(),this._page=0,this._pages=1,this._perView=1,this._paused=!1,this._hover=!1,this._focus=!1,this._timer=null,this._settleTimer=null,this._status=``,this._ready=!1,this._motion=null,this._mutations=null,this._resizer=null,this._doc=null,this._onClick=e=>this._click(e),this._onKeyDown=e=>this._key(e),this._onScroll=()=>{clearTimeout(this._settleTimer),this._settleTimer=setTimeout(()=>this._settle(),a)},this._onEnter=()=>this._hold({hover:!0}),this._onLeave=()=>this._hold({hover:!1}),this._onFocusIn=()=>this._hold({focus:!0}),this._onFocusOut=e=>this._hold({focus:!!e.relatedTarget&&this.contains(e.relatedTarget)}),this._onVisibility=()=>this._sync(),this._onMotion=()=>this._sync(),this._tick=()=>{this._timer=null,this._go(this._page+1<this._pages?this._page+1:0)}}connectedCallback(){if(this._track=this.querySelector(`.wui-carousel-track`),!this._track){this.ownerDocument.readyState===`loading`&&this.ownerDocument.addEventListener(`DOMContentLoaded`,()=>this.isConnected&&this.connectedCallback(),{once:!0});return}this._doc=this.ownerDocument;let e=this.getAttribute(`data-wui-style`);if(e){for(let t of e.split(`;`)){let e=t.indexOf(`:`);e>0&&this.style.setProperty(t.slice(0,e).trim(),t.slice(e+1).trim())}this.removeAttribute(`data-wui-style`)}this._motion=typeof window<`u`&&typeof window.matchMedia==`function`?window.matchMedia(`(prefers-reduced-motion: reduce)`):null,this._motion?.addEventListener(`change`,this._onMotion),this.addEventListener(`click`,this._onClick),this.addEventListener(`mouseenter`,this._onEnter),this.addEventListener(`mouseleave`,this._onLeave),this.addEventListener(`focusin`,this._onFocusIn),this.addEventListener(`focusout`,this._onFocusOut),this._track.addEventListener(`keydown`,this._onKeyDown),this._track.addEventListener(`scroll`,this._onScroll,{passive:!0}),this._doc.addEventListener(`visibilitychange`,this._onVisibility),typeof MutationObserver<`u`&&(this._mutations=new MutationObserver(()=>this._refresh()),this._mutations.observe(this._track,{childList:!0})),typeof ResizeObserver<`u`&&(this._resizer=new ResizeObserver(()=>this._refresh()),this._resizer.observe(this._track)),this._ready=!0,this._refresh()}disconnectedCallback(){this._ready=!1,clearTimeout(this._timer),clearTimeout(this._settleTimer),this._timer=null,this._motion?.removeEventListener(`change`,this._onMotion),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`mouseenter`,this._onEnter),this.removeEventListener(`mouseleave`,this._onLeave),this.removeEventListener(`focusin`,this._onFocusIn),this.removeEventListener(`focusout`,this._onFocusOut),this._track?.removeEventListener(`keydown`,this._onKeyDown),this._track?.removeEventListener(`scroll`,this._onScroll),this._doc?.removeEventListener(`visibilitychange`,this._onVisibility),this._mutations?.disconnect(),this._resizer?.disconnect(),this._mutations=this._resizer=this._motion=this._doc=null}attributeChangedCallback(){this._ready&&this._sync()}get paused(){return this._paused}set paused(e){this._paused=!!e,this._ready&&this._sync()}next(){this._page+1<this._pages?this._go(this._page+1):this.hasAttribute(`loop`)&&this._go(0)}prev(){this._page>0?this._go(this._page-1):this.hasAttribute(`loop`)&&this._go(this._pages-1)}goTo(e){this._go(Number(e))}_interval(){let e=Number.parseInt(this.getAttribute(`autoplay`)??``,10);return e>0?e:0}_slides(){return Array.from(this._track.children).filter(e=>e.classList.contains(`wui-carousel-slide`))}_playing(){return this._interval()>0&&this._pages>1&&!this._paused&&!this._hover&&!this._focus&&!this._motion?.matches&&!this._doc?.hidden}_hold({hover:e=this._hover,focus:t=this._focus}){this._hover=e,this._focus=t,this._sync()}_click(e){let t=e.target.closest?.(`.wui-carousel-pause, .wui-carousel-prev, .wui-carousel-next, .wui-carousel-dot`);t&&this.contains(t)&&!this._track.contains(t)&&(t.classList.contains(`wui-carousel-pause`)?(this._paused=!this._paused,this._hover=!1,this._focus=!1,this._sync()):t.getAttribute(`aria-disabled`)===`true`?e.preventDefault():t.classList.contains(`wui-carousel-prev`)?this.prev():t.classList.contains(`wui-carousel-next`)?this.next():this._go(Number(t.dataset.page)))}_key(e){if(e.target!==this._track||e.altKey||e.ctrlKey||e.metaKey)return;let t={ArrowRight:()=>this.next(),ArrowLeft:()=>this.prev(),Home:()=>this._go(0),End:()=>this._go(this._pages-1)}[e.key];t&&(e.preventDefault(),t())}_perViewNow(){let e=typeof window<`u`?window.getComputedStyle(this._track).getPropertyValue(`--wui-carousel-view`):``,t=Number.parseInt(e,10);return t>=1?t:1}_start(e){return Math.min(e*this._perView,Math.max(0,this._slides().length-this._perView))}_label(){let e=this._slides();return e.forEach((t,n)=>{let r=i.slide(n+1,e.length);t.getAttribute(`aria-label`)!==r&&t.setAttribute(`aria-label`,r)}),e.length}_refresh(){let e=this._label();this._perView=this._perViewNow();let t=Math.max(1,Math.ceil(e/this._perView)),n=this.querySelector(`.wui-carousel-dots`);if(n&&n.children.length!==t){let e=this.getAttribute(`dot-label`)||i.dot;n.replaceChildren(...Array.from({length:t},(t,n)=>{let r=this.ownerDocument.createElement(`button`);return r.type=`button`,r.className=`wui-carousel-dot`,r.dataset.page=String(n),r.setAttribute(`aria-label`,`${e} ${this._start(n)+1}`),r}))}this._pages=t,this._page=Math.min(this._page,t-1),this.toggleAttribute(`data-single`,t<=1),this._render(!1),this._sync()}_settle(){let e=this._track,t=this._slides();if(!t.length)return;let n;if(e.scrollWidth>e.clientWidth&&e.scrollLeft+e.clientWidth>=e.scrollWidth-2)n=this._pages-1;else{let r=0,i=1/0;t.forEach((t,n)=>{let a=Math.abs(t.offsetLeft-e.scrollLeft);a<i&&(i=a,r=n)}),n=Math.min(this._pages-1,Math.round(r/this._perView))}n!==this._page&&(this._page=n,this._render(!0),this._sync())}_go(e){if(!Number.isInteger(e))return;this._page=Math.max(0,Math.min(this._pages-1,e));let t=this._slides()[this._start(this._page)];if(t){let e=this._motion?.matches?`auto`:`smooth`;typeof this._track.scrollTo==`function`?this._track.scrollTo({left:t.offsetLeft,behavior:e}):this._track.scrollLeft=t.offsetLeft}this._render(!0),this._sync()}_render(e){let t=this.hasAttribute(`loop`);for(let e of this.querySelectorAll(`.wui-carousel-dot`))Number(e.dataset.page)===this._page?e.setAttribute(`aria-current`,`true`):e.removeAttribute(`aria-current`);this.querySelector(`.wui-carousel-prev`)?.setAttribute(`aria-disabled`,String(!t&&this._page===0)),this.querySelector(`.wui-carousel-next`)?.setAttribute(`aria-disabled`,String(!t&&this._page===this._pages-1));let n=this._slides().length,r=this._start(this._page)+1,a=Math.min(n,r+this._perView-1),o=i.status(r,a,n);if(o===this._status||(this._status=o,!e))return;let s=this.querySelector(`[data-wui-status]`);s&&!this._playing()&&(s.textContent=o),this.dispatchEvent(new CustomEvent(`wui:carousel:change`,{bubbles:!0,detail:{page:this._page,pages:this._pages}}))}_sync(){clearTimeout(this._timer),this._timer=null;let e=this._interval(),t=this.querySelector(`.wui-carousel-pause`);if(t){t.hidden=e===0||this._pages<=1||!!this._motion?.matches;let n=this._paused?this.getAttribute(`play-label`)||i.play:this.getAttribute(`pause-label`)||i.pause,r=t.querySelector(`.wui-carousel-pause-text`);r&&r.textContent!==n&&(r.textContent=n),this.toggleAttribute(`data-paused`,this._paused)}this._playing()&&(this._timer=setTimeout(this._tick,e))}};(0,t.defineElement)(`wui-carousel`,o),e.WuiCarousel=o})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.elementBase);
1
+ (function(e,t,n){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var r=globalThis.WeborityUiElementsInternal?.version;if(r!==`0.144.1`)throw Error(`[webority-ui] carousel expects ui-elements 0.144.1 but the page loaded `+r+`.`);var i=Object.freeze({slide:(e,t)=>`${e} of ${t}`,status:(e,t,n)=>e===t?`Slide ${e} of ${n}`:`Slides ${e} to ${t} of ${n}`,dot:`Go to slide`,pause:`Pause`,play:`Play`}),a=120,o=class extends n.ElementBase{static get observedAttributes(){return[`autoplay`]}constructor(){super(),this._page=0,this._pages=1,this._perView=1,this._paused=!1,this._hover=!1,this._focus=!1,this._timer=null,this._settleTimer=null,this._status=``,this._ready=!1,this._motion=null,this._mutations=null,this._resizer=null,this._doc=null,this._onClick=e=>this._click(e),this._onKeyDown=e=>this._key(e),this._onScroll=()=>{clearTimeout(this._settleTimer),this._settleTimer=setTimeout(()=>this._settle(),a)},this._onEnter=()=>this._hold({hover:!0}),this._onLeave=()=>this._hold({hover:!1}),this._onFocusIn=()=>this._hold({focus:!0}),this._onFocusOut=e=>this._hold({focus:!!e.relatedTarget&&this.contains(e.relatedTarget)}),this._onVisibility=()=>this._sync(),this._onMotion=()=>this._sync(),this._tick=()=>{this._timer=null,this._go(this._page+1<this._pages?this._page+1:0)}}connectedCallback(){if(this._track=this.querySelector(`.wui-carousel-track`),!this._track){this.ownerDocument.readyState===`loading`&&this.ownerDocument.addEventListener(`DOMContentLoaded`,()=>this.isConnected&&this.connectedCallback(),{once:!0});return}this._doc=this.ownerDocument;let e=this.getAttribute(`data-wui-style`);if(e){for(let t of e.split(`;`)){let e=t.indexOf(`:`);e>0&&this.style.setProperty(t.slice(0,e).trim(),t.slice(e+1).trim())}this.removeAttribute(`data-wui-style`)}this._motion=typeof window<`u`&&typeof window.matchMedia==`function`?window.matchMedia(`(prefers-reduced-motion: reduce)`):null,this._motion?.addEventListener(`change`,this._onMotion),this.addEventListener(`click`,this._onClick),this.addEventListener(`mouseenter`,this._onEnter),this.addEventListener(`mouseleave`,this._onLeave),this.addEventListener(`focusin`,this._onFocusIn),this.addEventListener(`focusout`,this._onFocusOut),this._track.addEventListener(`keydown`,this._onKeyDown),this._track.addEventListener(`scroll`,this._onScroll,{passive:!0}),this._doc.addEventListener(`visibilitychange`,this._onVisibility),typeof MutationObserver<`u`&&(this._mutations=new MutationObserver(()=>this._refresh()),this._mutations.observe(this._track,{childList:!0})),typeof ResizeObserver<`u`&&(this._resizer=new ResizeObserver(()=>this._refresh()),this._resizer.observe(this._track)),this._ready=!0,this._refresh()}disconnectedCallback(){this._ready=!1,clearTimeout(this._timer),clearTimeout(this._settleTimer),this._timer=null,this._motion?.removeEventListener(`change`,this._onMotion),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`mouseenter`,this._onEnter),this.removeEventListener(`mouseleave`,this._onLeave),this.removeEventListener(`focusin`,this._onFocusIn),this.removeEventListener(`focusout`,this._onFocusOut),this._track?.removeEventListener(`keydown`,this._onKeyDown),this._track?.removeEventListener(`scroll`,this._onScroll),this._doc?.removeEventListener(`visibilitychange`,this._onVisibility),this._mutations?.disconnect(),this._resizer?.disconnect(),this._mutations=this._resizer=this._motion=this._doc=null}attributeChangedCallback(){this._ready&&this._sync()}get paused(){return this._paused}set paused(e){this._paused=!!e,this._ready&&this._sync()}next(){this._page+1<this._pages?this._go(this._page+1):this.hasAttribute(`loop`)&&this._go(0)}prev(){this._page>0?this._go(this._page-1):this.hasAttribute(`loop`)&&this._go(this._pages-1)}goTo(e){this._go(Number(e))}_interval(){let e=Number.parseInt(this.getAttribute(`autoplay`)??``,10);return e>0?e:0}_slides(){return Array.from(this._track.children).filter(e=>e.classList.contains(`wui-carousel-slide`))}_playing(){return this._interval()>0&&this._pages>1&&!this._paused&&!this._hover&&!this._focus&&!this._motion?.matches&&!this._doc?.hidden}_hold({hover:e=this._hover,focus:t=this._focus}){this._hover=e,this._focus=t,this._sync()}_click(e){let t=e.target.closest?.(`.wui-carousel-pause, .wui-carousel-prev, .wui-carousel-next, .wui-carousel-dot`);t&&this.contains(t)&&!this._track.contains(t)&&(t.classList.contains(`wui-carousel-pause`)?(this._paused=!this._paused,this._hover=!1,this._focus=!1,this._sync()):t.getAttribute(`aria-disabled`)===`true`?e.preventDefault():t.classList.contains(`wui-carousel-prev`)?this.prev():t.classList.contains(`wui-carousel-next`)?this.next():this._go(Number(t.dataset.page)))}_key(e){if(e.target!==this._track||e.altKey||e.ctrlKey||e.metaKey)return;let t={ArrowRight:()=>this.next(),ArrowLeft:()=>this.prev(),Home:()=>this._go(0),End:()=>this._go(this._pages-1)}[e.key];t&&(e.preventDefault(),t())}_perViewNow(){let e=typeof window<`u`?window.getComputedStyle(this._track).getPropertyValue(`--wui-carousel-view`):``,t=Number.parseInt(e,10);return t>=1?t:1}_start(e){return Math.min(e*this._perView,Math.max(0,this._slides().length-this._perView))}_label(){let e=this._slides();return e.forEach((t,n)=>{let r=i.slide(n+1,e.length);t.getAttribute(`aria-label`)!==r&&t.setAttribute(`aria-label`,r)}),e.length}_refresh(){let e=this._label();this._perView=this._perViewNow();let t=Math.max(1,Math.ceil(e/this._perView)),n=this.querySelector(`.wui-carousel-dots`);if(n&&n.children.length!==t){let e=this.getAttribute(`dot-label`)||i.dot;n.replaceChildren(...Array.from({length:t},(t,n)=>{let r=this.ownerDocument.createElement(`button`);return r.type=`button`,r.className=`wui-carousel-dot`,r.dataset.page=String(n),r.setAttribute(`aria-label`,`${e} ${this._start(n)+1}`),r}))}this._pages=t,this._page=Math.min(this._page,t-1),this.toggleAttribute(`data-single`,t<=1),this._render(!1),this._sync()}_settle(){let e=this._track,t=this._slides();if(!t.length)return;let n;if(e.scrollWidth>e.clientWidth&&e.scrollLeft+e.clientWidth>=e.scrollWidth-2)n=this._pages-1;else{let r=0,i=1/0;t.forEach((t,n)=>{let a=Math.abs(t.offsetLeft-e.scrollLeft);a<i&&(i=a,r=n)}),n=Math.min(this._pages-1,Math.round(r/this._perView))}n!==this._page&&(this._page=n,this._render(!0),this._sync())}_go(e){if(!Number.isInteger(e))return;this._page=Math.max(0,Math.min(this._pages-1,e));let t=this._slides()[this._start(this._page)];if(t){let e=this._motion?.matches?`auto`:`smooth`;typeof this._track.scrollTo==`function`?this._track.scrollTo({left:t.offsetLeft,behavior:e}):this._track.scrollLeft=t.offsetLeft}this._render(!0),this._sync()}_render(e){let t=this.hasAttribute(`loop`);for(let e of this.querySelectorAll(`.wui-carousel-dot`))Number(e.dataset.page)===this._page?e.setAttribute(`aria-current`,`true`):e.removeAttribute(`aria-current`);this.querySelector(`.wui-carousel-prev`)?.setAttribute(`aria-disabled`,String(!t&&this._page===0)),this.querySelector(`.wui-carousel-next`)?.setAttribute(`aria-disabled`,String(!t&&this._page===this._pages-1));let n=this._slides().length,r=this._start(this._page)+1,a=Math.min(n,r+this._perView-1),o=i.status(r,a,n);if(o===this._status||(this._status=o,!e))return;let s=this.querySelector(`[data-wui-status]`);s&&!this._playing()&&(s.textContent=o),this.dispatchEvent(new CustomEvent(`wui:carousel:change`,{bubbles:!0,detail:{page:this._page,pages:this._pages}}))}_sync(){clearTimeout(this._timer),this._timer=null;let e=this._interval(),t=this.querySelector(`.wui-carousel-pause`);if(t){t.hidden=e===0||this._pages<=1||!!this._motion?.matches;let n=this._paused?this.getAttribute(`play-label`)||i.play:this.getAttribute(`pause-label`)||i.pause,r=t.querySelector(`.wui-carousel-pause-text`);r&&r.textContent!==n&&(r.textContent=n),this.toggleAttribute(`data-paused`,this._paused)}this._playing()&&(this._timer=setTimeout(this._tick,e))}};(0,t.defineElement)(`wui-carousel`,o),e.WuiCarousel=o})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.elementBase);
@@ -1 +1 @@
1
- (function(e,t,n,r,i,a){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var o=globalThis.WeborityUiElementsInternal?.version;if(o!==`0.143.1`)throw Error(`[webority-ui] code-block expects ui-elements 0.143.1 but the page loaded `+o+`.`);var s=Object.freeze([`text`,`json`,`js`,`cs`,`sql`,`bash`,`http`,`html`,`css`]),c=Object.freeze({text:``,json:`JSON`,js:`JavaScript`,cs:`C#`,sql:`SQL`,bash:`Bash`,http:`HTTP`,html:`HTML`,css:`CSS`}),l=e=>RegExp(`\\b(?:${e.join(`|`)})\\b`),u=`(?![\\s\\S])`,d=RegExp(`/\\*[\\s\\S]*?(?:\\*/|${u})`).source,f=[[`attr`,/"(?:[^"\\\n]|\\.)*"(?=\s*:)/],[`string`,/"(?:[^"\\\n]|\\.)*"?/],[`number`,/-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?\b/],[`literal`,l([`true`,`false`,`null`])],[`punct`,/[{}[\],:]/]],p=[[`comment`,RegExp(`//[^\\n]*|${d}`)],[`string`,/"(?:[^"\\\n]|\\.)*"?|'(?:[^'\\\n]|\\.)*'?|`(?:[^`\\]|\\[\s\S])*`?/],[`number`,/\b(?:0[xX][\da-fA-F_]+|\d[\d_]*\.?\d*(?:[eE][+-]?\d+)?n?)\b/],[`keyword`,l(`async.await.break.case.catch.class.const.continue.default.delete.do.else.export.extends.finally.for.from.function.if.import.in.instanceof.let.new.of.return.static.super.switch.this.throw.try.typeof.var.void.while.yield`.split(`.`))],[`literal`,l([`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`])],[`function`,/(?<![\w$])[A-Za-z_$][\w$]*(?=\s*\()/],[`type`,/(?<![\w$])[A-Z][\w$]*/],[`punct`,/[{}()[\];,]/]],m=[[`comment`,RegExp(`//[^\\n]*|${d}`)],[`string`,/@"(?:[^"]|"")*"?|\$@?"(?:[^"\\\n]|\\.)*"?|"(?:[^"\\\n]|\\.)*"?|'(?:[^'\\\n]|\\.)*'?/],[`number`,/\b\d[\d_]*\.?\d*(?:[eE][+-]?\d+)?[fFdDmMlLuU]{0,2}\b/],[`keyword`,l(`abstract.as.async.await.base.bool.break.byte.case.catch.char.checked.class.const.continue.decimal.default.delegate.do.double.else.enum.event.explicit.extern.finally.fixed.float.for.foreach.get.goto.if.implicit.in.init.int.interface.internal.is.lock.long.namespace.new.object.operator.out.override.params.private.protected.public.readonly.record.ref.required.return.sbyte.sealed.set.short.sizeof.static.string.struct.switch.this.throw.try.typeof.uint.ulong.unchecked.unsafe.ushort.using.var.virtual.void.volatile.when.while.with`.split(`.`))],[`literal`,l([`true`,`false`,`null`])],[`function`,/(?<!\w)[A-Za-z_]\w*(?=\s*\()/],[`type`,/(?<!\w)[A-Z]\w*/],[`punct`,/[{}()[\];,]/]],h=[[`comment`,RegExp(`--[^\\n]*|${d}`)],[`string`,/'(?:[^']|'')*'?/],[`variable`,/@@?\w+/],[`number`,/\b\d+(?:\.\d+)?\b/],[`keyword`,l(`add.all.alter.and.as.asc.begin.between.by.case.check.column.commit.constraint.create.cross.database.declare.default.delete.desc.distinct.drop.else.end.exec.execute.exists.foreign.from.full.function.group.having.if.in.index.inner.insert.into.is.join.key.left.like.limit.not.null.offset.on.or.order.outer.over.partition.primary.procedure.references.return.returns.right.rollback.select.set.table.then.top.transaction.union.unique.update.values.view.when.where.while.with`.split(`.`))],[`literal`,l([`true`,`false`])],[`type`,l([`bigint`,`bit`,`char`,`date`,`datetime`,`datetime2`,`decimal`,`float`,`int`,`money`,`nchar`,`numeric`,`nvarchar`,`real`,`smallint`,`text`,`time`,`tinyint`,`uniqueidentifier`,`varchar`])],[`function`,/\b[A-Za-z_]\w*(?=\s*\()/],[`punct`,/[(),;]/]],g=[[`comment`,/(?<![^\s;|&(])#[^\n]*/],[`string`,/"(?:[^"\\]|\\[\s\S])*"?|'[^']*'?/],[`variable`,/\$(?:\{[^}\n]*\}?|[A-Za-z_]\w*|[0-9@#?$!*-])/],[`attr`,/(?<![\w-])--?[A-Za-z][\w-]*/],[`number`,/(?<![\w.-])\d+(?:\.\d+)?\b/],[`keyword`,l([`case`,`do`,`done`,`elif`,`else`,`esac`,`exit`,`export`,`fi`,`for`,`function`,`if`,`in`,`local`,`return`,`select`,`then`,`until`,`while`])],[`function`,l(`awk.az.cat.cd.chmod.chown.cp.curl.docker.dotnet.echo.gcloud.git.grep.kubectl.ls.mkdir.mv.npm.npx.pnpm.rm.sed.source.sudo.wget`.split(`.`))],[`punct`,/[|&;<>(){}[\]]+/]],_=[[`comment`,/^#[^\n]*/m],[`keyword`,/^(?:GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS|TRACE|CONNECT)(?= )/m],[`literal`,/HTTP\/\d(?:\.\d)?/],[`number`,/(?<=^HTTP\/\d(?:\.\d)? )\d{3}\b/m],[`function`,/(?<=^[A-Z]+ )\S+/m],[`attr`,/^[A-Za-z][\w-]*(?=:)/m],[`string`,/(?<=^[A-Za-z][\w-]*:[ \t]*)[^\n]+/m]],v=[[`comment`,RegExp(`<!--[\\s\\S]*?(?:-->|${u})`)],[`keyword`,/<![A-Za-z][^>]*>?/],[`tag`,/<\/?[A-Za-z][^<>]*>?/],[`literal`,/&#?\w+;/]],y={json:f,js:p,cs:m,sql:h,bash:g,http:_,css:[[`comment`,new RegExp(d)],[`string`,/"(?:[^"\\\n]|\\.)*"?|'(?:[^'\\\n]|\\.)*'?/],[`keyword`,/@[\w-]+|!important/],[`attr`,/[\w-]+(?=\s*:[^{};]*[;}])/],[`number`,/#[0-9a-fA-F]{3,8}\b|(?<![\w-])-?(?:\d+\.?\d*|\.\d+)(?:%|[A-Za-z]{1,4})?/],[`function`,/[\w-]+(?=\()/],[`type`,/[.#](?!\d)[A-Za-z_][\w-]*/],[`punct`,/[{}();:,]/]],html:v,htmlTag:[[`tag`,/^<\/?[\w:.-]+/],[`string`,/"[^"]*"?|'[^']*'?/],[`attr`,/(?<=\s)[^\s=<>/"']+/],[`punct`,/\/?>|=/]]},b=new Map;function x(e){let t=b.get(e);if(!t){let n=y[e],r=e===`sql`?`gi`:`g`,i=n.map(([,e])=>`(${e.source})`).join(`|`);t={re:new RegExp(i,`${r}m`),types:n.map(([e])=>e)},b.set(e,t)}return t}function S(e,t,n){if(!n)return;let r=e[e.length-1];r&&r[0]===t?r[1]+=n:e.push([t,n])}function C(e,t,n=[]){let{re:r,types:i}=x(e),a=0;for(let o of t.matchAll(r)){if(!o[0])continue;S(n,`plain`,t.slice(a,o.index));let r=i.findIndex((e,t)=>o[t+1]!==void 0);e===`html`&&i[r]===`tag`?C(`htmlTag`,o[0],n):S(n,i[r],o[0]),a=o.index+o[0].length}return S(n,`plain`,t.slice(a)),n}function w(e){let t=/\r?\n\r?\n/.exec(e);if(!t)return C(`http`,e);let n=C(`http`,e.slice(0,t.index+t[0].length)),r=e.slice(t.index+t[0].length),i=r.trimStart()[0];return i===`{`||i===`[`?C(`json`,r,n):i===`<`?C(`html`,r,n):(S(n,`plain`,r),n)}function T(e,t){let n=String(e??``);return!n||n.length>1e5?n?[[`plain`,n]]:[]:t===`http`?w(n):!Object.hasOwn(y,t)||t===`htmlTag`?[[`plain`,n]]:C(t,n)}function E(e,t){let n=[[]];for(let[r,i]of T(e,t))i.split(/\r\n|\r|\n/).forEach((e,t)=>{t>0&&n.push([]),e&&n[n.length-1].push([r,e])});return n.length>1&&n[n.length-1].length===0&&n.pop(),n}var D=class extends i.ElementBase{static get observedAttributes(){return[`language`,`line-numbers`,`wrap`,`label`,`copy-label`,`copied-label`]}constructor(){super(),this._chrome=null,this._title=null,this._view=null,this._codeEl=null,this._copyIcon=null,this._copyText=null,this._copied=!1,this._observer=null,this._timer=0,this._cancelFrame=null}connectedCallback(){this._render(),typeof MutationObserver<`u`&&(this._observer=new MutationObserver(e=>{e.some(e=>!this._chrome?.contains(e.target))&&this._schedule()}),this._observer.observe(this,{childList:!0,subtree:!0,characterData:!0}))}disconnectedCallback(){this._observer?.disconnect(),this._observer=null,this._cancelPending()}attributeChangedCallback(){this.isConnected&&this._render()}_source(){return Array.from(this.children).find(e=>e.classList.contains(`wui-code-source`))}_code(){return(this._source()?.textContent??``).replace(/\r?\n$/,``)}_schedule(){if(this._cancelFrame)return;let e=()=>{this._cancelFrame=null,this._render()};if(typeof requestAnimationFrame==`function`){let t=requestAnimationFrame(e);this._cancelFrame=()=>cancelAnimationFrame(t)}else{let t=!0;queueMicrotask(()=>{t&&e()}),this._cancelFrame=()=>{t=!1}}}_cancelPending(){this._cancelFrame?.(),this._cancelFrame=null}_render(){if(!this._source())return;this._cancelPending();let e=this.ownerDocument;this._chrome||this._build(e);let t=this.getAttribute(`language`),n=s.includes(t)?t:`text`,r=this.getAttribute(`label`)||``,i=E(this._code(),n);this._title.textContent=r||c[n],this._view.setAttribute(`aria-label`,r||`Code`),this._view.style.setProperty(`--wui-code-digits`,String(String(i.length).length)),this._codeEl.replaceChildren(...i.map(t=>O(e,t))),this._copied||(this._copyText.textContent=this._copyLabel()),this.setAttribute(`data-wui-ready`,``),this._observer?.takeRecords()}_build(e){let t=e.createElement(`div`);t.className=`wui-code-chrome`,t.append(this._bar(e));let n=e.createElement(`div`);n.className=`wui-code-view`,n.setAttribute(`role`,`region`),n.tabIndex=0;let r=e.createElement(`pre`);r.className=`wui-code-pre`,this._codeEl=e.createElement(`code`),r.append(this._codeEl),n.append(r),t.append(n),this._chrome=t,this._view=n,this.append(t)}_bar(e){let t=e.createElement(`div`);t.className=`wui-code-bar`,this._title=e.createElement(`span`),this._title.className=`wui-code-title`;let i=e.createElement(`button`);return i.type=`button`,i.className=`${(0,n.buttonClass)(`ghost`,`sm`)} wui-code-copy`,i.dataset.wui=n.APP_BUTTON_MARKER,i.setAttribute(`aria-live`,`polite`),this._copyIcon=e.createElement(`span`),this._copyIcon.className=`wui-code-copy-icon`,this._copyText=e.createElement(`span`),this._setCopied(!1),i.append(this._copyIcon,this._copyText),i.addEventListener(`click`,async()=>{await(0,r.copyTextToClipboard)(this._code())&&(this._setCopied(!0),clearTimeout(this._timer),this._timer=setTimeout(()=>this._setCopied(!1),r.COPY_FEEDBACK_MS))}),t.append(this._title,i),t}_setCopied(e){this._copied=e,this._copyIcon.innerHTML=(0,a.glyphSvg)(e?`check`:`files`,{size:14}),this._copyText.textContent=this._copyLabel()}_copyLabel(){return this._copied?this.getAttribute(`copied-label`)||`Copied`:this.getAttribute(`copy-label`)||`Copy`}};function O(e,t){let n=e.createElement(`span`);n.className=`wui-code-line`;for(let[r,i]of t){if(r===`plain`){n.append(i);continue}let t=e.createElement(`span`);t.className=`wui-code-t-${r}`,t.textContent=i,n.append(t)}return n}(0,t.defineElement)(`wui-code-block`,D),e.WuiCodeBlock=D})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.buttonClass,WeborityUiElementsInternal.modules.copyText,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.iconGlyphs);
1
+ (function(e,t,n,r,i,a){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var o=globalThis.WeborityUiElementsInternal?.version;if(o!==`0.144.1`)throw Error(`[webority-ui] code-block expects ui-elements 0.144.1 but the page loaded `+o+`.`);var s=Object.freeze([`text`,`json`,`js`,`cs`,`sql`,`bash`,`http`,`html`,`css`]),c=Object.freeze({text:``,json:`JSON`,js:`JavaScript`,cs:`C#`,sql:`SQL`,bash:`Bash`,http:`HTTP`,html:`HTML`,css:`CSS`}),l=e=>RegExp(`\\b(?:${e.join(`|`)})\\b`),u=`(?![\\s\\S])`,d=RegExp(`/\\*[\\s\\S]*?(?:\\*/|${u})`).source,f=[[`attr`,/"(?:[^"\\\n]|\\.)*"(?=\s*:)/],[`string`,/"(?:[^"\\\n]|\\.)*"?/],[`number`,/-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?\b/],[`literal`,l([`true`,`false`,`null`])],[`punct`,/[{}[\],:]/]],p=[[`comment`,RegExp(`//[^\\n]*|${d}`)],[`string`,/"(?:[^"\\\n]|\\.)*"?|'(?:[^'\\\n]|\\.)*'?|`(?:[^`\\]|\\[\s\S])*`?/],[`number`,/\b(?:0[xX][\da-fA-F_]+|\d[\d_]*\.?\d*(?:[eE][+-]?\d+)?n?)\b/],[`keyword`,l(`async.await.break.case.catch.class.const.continue.default.delete.do.else.export.extends.finally.for.from.function.if.import.in.instanceof.let.new.of.return.static.super.switch.this.throw.try.typeof.var.void.while.yield`.split(`.`))],[`literal`,l([`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`])],[`function`,/(?<![\w$])[A-Za-z_$][\w$]*(?=\s*\()/],[`type`,/(?<![\w$])[A-Z][\w$]*/],[`punct`,/[{}()[\];,]/]],m=[[`comment`,RegExp(`//[^\\n]*|${d}`)],[`string`,/@"(?:[^"]|"")*"?|\$@?"(?:[^"\\\n]|\\.)*"?|"(?:[^"\\\n]|\\.)*"?|'(?:[^'\\\n]|\\.)*'?/],[`number`,/\b\d[\d_]*\.?\d*(?:[eE][+-]?\d+)?[fFdDmMlLuU]{0,2}\b/],[`keyword`,l(`abstract.as.async.await.base.bool.break.byte.case.catch.char.checked.class.const.continue.decimal.default.delegate.do.double.else.enum.event.explicit.extern.finally.fixed.float.for.foreach.get.goto.if.implicit.in.init.int.interface.internal.is.lock.long.namespace.new.object.operator.out.override.params.private.protected.public.readonly.record.ref.required.return.sbyte.sealed.set.short.sizeof.static.string.struct.switch.this.throw.try.typeof.uint.ulong.unchecked.unsafe.ushort.using.var.virtual.void.volatile.when.while.with`.split(`.`))],[`literal`,l([`true`,`false`,`null`])],[`function`,/(?<!\w)[A-Za-z_]\w*(?=\s*\()/],[`type`,/(?<!\w)[A-Z]\w*/],[`punct`,/[{}()[\];,]/]],h=[[`comment`,RegExp(`--[^\\n]*|${d}`)],[`string`,/'(?:[^']|'')*'?/],[`variable`,/@@?\w+/],[`number`,/\b\d+(?:\.\d+)?\b/],[`keyword`,l(`add.all.alter.and.as.asc.begin.between.by.case.check.column.commit.constraint.create.cross.database.declare.default.delete.desc.distinct.drop.else.end.exec.execute.exists.foreign.from.full.function.group.having.if.in.index.inner.insert.into.is.join.key.left.like.limit.not.null.offset.on.or.order.outer.over.partition.primary.procedure.references.return.returns.right.rollback.select.set.table.then.top.transaction.union.unique.update.values.view.when.where.while.with`.split(`.`))],[`literal`,l([`true`,`false`])],[`type`,l([`bigint`,`bit`,`char`,`date`,`datetime`,`datetime2`,`decimal`,`float`,`int`,`money`,`nchar`,`numeric`,`nvarchar`,`real`,`smallint`,`text`,`time`,`tinyint`,`uniqueidentifier`,`varchar`])],[`function`,/\b[A-Za-z_]\w*(?=\s*\()/],[`punct`,/[(),;]/]],g=[[`comment`,/(?<![^\s;|&(])#[^\n]*/],[`string`,/"(?:[^"\\]|\\[\s\S])*"?|'[^']*'?/],[`variable`,/\$(?:\{[^}\n]*\}?|[A-Za-z_]\w*|[0-9@#?$!*-])/],[`attr`,/(?<![\w-])--?[A-Za-z][\w-]*/],[`number`,/(?<![\w.-])\d+(?:\.\d+)?\b/],[`keyword`,l([`case`,`do`,`done`,`elif`,`else`,`esac`,`exit`,`export`,`fi`,`for`,`function`,`if`,`in`,`local`,`return`,`select`,`then`,`until`,`while`])],[`function`,l(`awk.az.cat.cd.chmod.chown.cp.curl.docker.dotnet.echo.gcloud.git.grep.kubectl.ls.mkdir.mv.npm.npx.pnpm.rm.sed.source.sudo.wget`.split(`.`))],[`punct`,/[|&;<>(){}[\]]+/]],_=[[`comment`,/^#[^\n]*/m],[`keyword`,/^(?:GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS|TRACE|CONNECT)(?= )/m],[`literal`,/HTTP\/\d(?:\.\d)?/],[`number`,/(?<=^HTTP\/\d(?:\.\d)? )\d{3}\b/m],[`function`,/(?<=^[A-Z]+ )\S+/m],[`attr`,/^[A-Za-z][\w-]*(?=:)/m],[`string`,/(?<=^[A-Za-z][\w-]*:[ \t]*)[^\n]+/m]],v=[[`comment`,RegExp(`<!--[\\s\\S]*?(?:-->|${u})`)],[`keyword`,/<![A-Za-z][^>]*>?/],[`tag`,/<\/?[A-Za-z][^<>]*>?/],[`literal`,/&#?\w+;/]],y={json:f,js:p,cs:m,sql:h,bash:g,http:_,css:[[`comment`,new RegExp(d)],[`string`,/"(?:[^"\\\n]|\\.)*"?|'(?:[^'\\\n]|\\.)*'?/],[`keyword`,/@[\w-]+|!important/],[`attr`,/[\w-]+(?=\s*:[^{};]*[;}])/],[`number`,/#[0-9a-fA-F]{3,8}\b|(?<![\w-])-?(?:\d+\.?\d*|\.\d+)(?:%|[A-Za-z]{1,4})?/],[`function`,/[\w-]+(?=\()/],[`type`,/[.#](?!\d)[A-Za-z_][\w-]*/],[`punct`,/[{}();:,]/]],html:v,htmlTag:[[`tag`,/^<\/?[\w:.-]+/],[`string`,/"[^"]*"?|'[^']*'?/],[`attr`,/(?<=\s)[^\s=<>/"']+/],[`punct`,/\/?>|=/]]},b=new Map;function x(e){let t=b.get(e);if(!t){let n=y[e],r=e===`sql`?`gi`:`g`,i=n.map(([,e])=>`(${e.source})`).join(`|`);t={re:new RegExp(i,`${r}m`),types:n.map(([e])=>e)},b.set(e,t)}return t}function S(e,t,n){if(!n)return;let r=e[e.length-1];r&&r[0]===t?r[1]+=n:e.push([t,n])}function C(e,t,n=[]){let{re:r,types:i}=x(e),a=0;for(let o of t.matchAll(r)){if(!o[0])continue;S(n,`plain`,t.slice(a,o.index));let r=i.findIndex((e,t)=>o[t+1]!==void 0);e===`html`&&i[r]===`tag`?C(`htmlTag`,o[0],n):S(n,i[r],o[0]),a=o.index+o[0].length}return S(n,`plain`,t.slice(a)),n}function w(e){let t=/\r?\n\r?\n/.exec(e);if(!t)return C(`http`,e);let n=C(`http`,e.slice(0,t.index+t[0].length)),r=e.slice(t.index+t[0].length),i=r.trimStart()[0];return i===`{`||i===`[`?C(`json`,r,n):i===`<`?C(`html`,r,n):(S(n,`plain`,r),n)}function T(e,t){let n=String(e??``);return!n||n.length>1e5?n?[[`plain`,n]]:[]:t===`http`?w(n):!Object.hasOwn(y,t)||t===`htmlTag`?[[`plain`,n]]:C(t,n)}function E(e,t){let n=[[]];for(let[r,i]of T(e,t))i.split(/\r\n|\r|\n/).forEach((e,t)=>{t>0&&n.push([]),e&&n[n.length-1].push([r,e])});return n.length>1&&n[n.length-1].length===0&&n.pop(),n}var D=class extends i.ElementBase{static get observedAttributes(){return[`language`,`line-numbers`,`wrap`,`label`,`copy-label`,`copied-label`]}constructor(){super(),this._chrome=null,this._title=null,this._view=null,this._codeEl=null,this._copyIcon=null,this._copyText=null,this._copied=!1,this._observer=null,this._timer=0,this._cancelFrame=null}connectedCallback(){this._render(),typeof MutationObserver<`u`&&(this._observer=new MutationObserver(e=>{e.some(e=>!this._chrome?.contains(e.target))&&this._schedule()}),this._observer.observe(this,{childList:!0,subtree:!0,characterData:!0}))}disconnectedCallback(){this._observer?.disconnect(),this._observer=null,this._cancelPending()}attributeChangedCallback(){this.isConnected&&this._render()}_source(){return Array.from(this.children).find(e=>e.classList.contains(`wui-code-source`))}_code(){return(this._source()?.textContent??``).replace(/\r?\n$/,``)}_schedule(){if(this._cancelFrame)return;let e=()=>{this._cancelFrame=null,this._render()};if(typeof requestAnimationFrame==`function`){let t=requestAnimationFrame(e);this._cancelFrame=()=>cancelAnimationFrame(t)}else{let t=!0;queueMicrotask(()=>{t&&e()}),this._cancelFrame=()=>{t=!1}}}_cancelPending(){this._cancelFrame?.(),this._cancelFrame=null}_render(){if(!this._source())return;this._cancelPending();let e=this.ownerDocument;this._chrome||this._build(e);let t=this.getAttribute(`language`),n=s.includes(t)?t:`text`,r=this.getAttribute(`label`)||``,i=E(this._code(),n);this._title.textContent=r||c[n],this._view.setAttribute(`aria-label`,r||`Code`),this._view.style.setProperty(`--wui-code-digits`,String(String(i.length).length)),this._codeEl.replaceChildren(...i.map(t=>O(e,t))),this._copied||(this._copyText.textContent=this._copyLabel()),this.setAttribute(`data-wui-ready`,``),this._observer?.takeRecords()}_build(e){let t=e.createElement(`div`);t.className=`wui-code-chrome`,t.append(this._bar(e));let n=e.createElement(`div`);n.className=`wui-code-view`,n.setAttribute(`role`,`region`),n.tabIndex=0;let r=e.createElement(`pre`);r.className=`wui-code-pre`,this._codeEl=e.createElement(`code`),r.append(this._codeEl),n.append(r),t.append(n),this._chrome=t,this._view=n,this.append(t)}_bar(e){let t=e.createElement(`div`);t.className=`wui-code-bar`,this._title=e.createElement(`span`),this._title.className=`wui-code-title`;let i=e.createElement(`button`);return i.type=`button`,i.className=`${(0,n.buttonClass)(`ghost`,`sm`)} wui-code-copy`,i.dataset.wui=n.APP_BUTTON_MARKER,i.setAttribute(`aria-live`,`polite`),this._copyIcon=e.createElement(`span`),this._copyIcon.className=`wui-code-copy-icon`,this._copyText=e.createElement(`span`),this._setCopied(!1),i.append(this._copyIcon,this._copyText),i.addEventListener(`click`,async()=>{await(0,r.copyTextToClipboard)(this._code())&&(this._setCopied(!0),clearTimeout(this._timer),this._timer=setTimeout(()=>this._setCopied(!1),r.COPY_FEEDBACK_MS))}),t.append(this._title,i),t}_setCopied(e){this._copied=e,this._copyIcon.innerHTML=(0,a.glyphSvg)(e?`check`:`files`,{size:14}),this._copyText.textContent=this._copyLabel()}_copyLabel(){return this._copied?this.getAttribute(`copied-label`)||`Copied`:this.getAttribute(`copy-label`)||`Copy`}};function O(e,t){let n=e.createElement(`span`);n.className=`wui-code-line`;for(let[r,i]of t){if(r===`plain`){n.append(i);continue}let t=e.createElement(`span`);t.className=`wui-code-t-${r}`,t.textContent=i,n.append(t)}return n}(0,t.defineElement)(`wui-code-block`,D),e.WuiCodeBlock=D})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.buttonClass,WeborityUiElementsInternal.modules.copyText,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.iconGlyphs);
@@ -1,2 +1,2 @@
1
- (function(e,t,n,r,i){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var a=globalThis.WeborityUiElementsInternal?.version;if(a!==`0.143.1`)throw Error(`[webority-ui] command-palette expects ui-elements 0.143.1 but the page loaded `+a+`.`);var o=`[role="option"]`,s=`No results`,c=`All`,l=`Recent`,u=5,d=20,f=`.wui-cmd-back, [data-depth]`,p=`[data-group-tab]`,m=0,h=class extends n.ElementBase{static get observedAttributes(){return[`filter`,`group-filter`,`highlight`,`empty-text`,`path`,`root-label`,`recents-key`,`recents-limit`,`recents-label`]}constructor(){super(),this._path=[],this._group=null,this._crumbSig=null,this._modal=null,this._recentsId=`wui-cmd-recents-${++m}`,this._onModalHidden=()=>this._reset(),this._activeId=null,this._lastQuery=null,this._lastIds=null,this._userChose=!1,this._onKeyDown=e=>this._handleKeyDown(e),this._onClick=e=>{let t=e.target?.closest?.(f);if(t&&this.contains(t)){let e=t.matches(`.wui-cmd-back`)?this._path.length-1:Number(t.dataset.depth);this._goTo(this._path.slice(0,e));return}let n=e.target?.closest?.(p);if(n&&this.contains(n)){this._pickGroup(n.dataset.groupTab||null);return}let r=this._optionFrom(e.target);r&&this._select(r)},this._onMouseDown=e=>{let t=e.target?.closest?.(f),n=e.target?.closest?.(p);(t&&this.contains(t)||n&&this.contains(n)||this._optionFrom(e.target,!0))&&e.preventDefault()},this._onMouseMove=e=>{let t=this._optionFrom(e.target);t&&t.id!==this._activeId&&(this._userChose=!0,this._setActive(t,!1))},this._onInput=e=>{this.hasAttribute(`filter`)&&e.target===this._input()&&(this._group=null,this._applyFilter(),this.refresh())}}connectedCallback(){this._teardown(),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`click`,this._onClick),this.addEventListener(`mousedown`,this._onMouseDown),this.addEventListener(`mousemove`,this._onMouseMove),this.addEventListener(`input`,this._onInput),this._modal=this.closest(`.modal`),this._modal?.addEventListener(`hidden.bs.modal`,this._onModalHidden),this._readPath(),this.hasAttribute(`filter`)&&this._applyFilter(),this.refresh()}disconnectedCallback(){this._teardown()}attributeChangedCallback(e){this.isConnected&&(e===`path`&&this._readPath(),this.hasAttribute(`filter`)&&this._applyFilter(),this.refresh())}get filter(){return this.hasAttribute(`filter`)}set filter(e){this.toggleAttribute(`filter`,!!e)}get highlight(){return this.getAttribute(`highlight`)!==`false`}set highlight(e){this.setAttribute(`highlight`,e?`true`:`false`)}get emptyText(){return this.getAttribute(`empty-text`)??s}set emptyText(e){this.setAttribute(`empty-text`,String(e??``))}refresh(){this._renderRecents(),this._renderCrumbs(),this._syncTabs();let e=this._input(),t=e?e.value:``,n=t!==this._lastQuery;this._lastQuery=t;let r=this._selectableOptions(),i=r.map(e=>e.id).join(`
1
+ (function(e,t,n,r,i){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var a=globalThis.WeborityUiElementsInternal?.version;if(a!==`0.144.1`)throw Error(`[webority-ui] command-palette expects ui-elements 0.144.1 but the page loaded `+a+`.`);var o=`[role="option"]`,s=`No results`,c=`All`,l=`Recent`,u=5,d=20,f=`.wui-cmd-back, [data-depth]`,p=`[data-group-tab]`,m=0,h=class extends n.ElementBase{static get observedAttributes(){return[`filter`,`group-filter`,`highlight`,`empty-text`,`path`,`root-label`,`recents-key`,`recents-limit`,`recents-label`]}constructor(){super(),this._path=[],this._group=null,this._crumbSig=null,this._modal=null,this._recentsId=`wui-cmd-recents-${++m}`,this._onModalHidden=()=>this._reset(),this._activeId=null,this._lastQuery=null,this._lastIds=null,this._userChose=!1,this._onKeyDown=e=>this._handleKeyDown(e),this._onClick=e=>{let t=e.target?.closest?.(f);if(t&&this.contains(t)){let e=t.matches(`.wui-cmd-back`)?this._path.length-1:Number(t.dataset.depth);this._goTo(this._path.slice(0,e));return}let n=e.target?.closest?.(p);if(n&&this.contains(n)){this._pickGroup(n.dataset.groupTab||null);return}let r=this._optionFrom(e.target);r&&this._select(r)},this._onMouseDown=e=>{let t=e.target?.closest?.(f),n=e.target?.closest?.(p);(t&&this.contains(t)||n&&this.contains(n)||this._optionFrom(e.target,!0))&&e.preventDefault()},this._onMouseMove=e=>{let t=this._optionFrom(e.target);t&&t.id!==this._activeId&&(this._userChose=!0,this._setActive(t,!1))},this._onInput=e=>{this.hasAttribute(`filter`)&&e.target===this._input()&&(this._group=null,this._applyFilter(),this.refresh())}}connectedCallback(){this._teardown(),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`click`,this._onClick),this.addEventListener(`mousedown`,this._onMouseDown),this.addEventListener(`mousemove`,this._onMouseMove),this.addEventListener(`input`,this._onInput),this._modal=this.closest(`.modal`),this._modal?.addEventListener(`hidden.bs.modal`,this._onModalHidden),this._readPath(),this.hasAttribute(`filter`)&&this._applyFilter(),this.refresh()}disconnectedCallback(){this._teardown()}attributeChangedCallback(e){this.isConnected&&(e===`path`&&this._readPath(),this.hasAttribute(`filter`)&&this._applyFilter(),this.refresh())}get filter(){return this.hasAttribute(`filter`)}set filter(e){this.toggleAttribute(`filter`,!!e)}get highlight(){return this.getAttribute(`highlight`)!==`false`}set highlight(e){this.setAttribute(`highlight`,e?`true`:`false`)}get emptyText(){return this.getAttribute(`empty-text`)??s}set emptyText(e){this.setAttribute(`empty-text`,String(e??``))}refresh(){this._renderRecents(),this._renderCrumbs(),this._syncTabs();let e=this._input(),t=e?e.value:``,n=t!==this._lastQuery;this._lastQuery=t;let r=this._selectableOptions(),i=r.map(e=>e.id).join(`
2
2
  `),a=i!==this._lastIds;this._lastIds=i;let o=!n&&(this._userChose||!a)?r.find(e=>e.id===this._activeId):null;o||(this._userChose=!1),this._setActive(o??r[0]??null,n)}_input(){return this.querySelector(`[role="combobox"]`)}_optionFrom(e,t=!1){let n=e?.closest?.(o);return n&&this.contains(n)&&!this._isHidden(n)&&(t||!this._isDisabled(n))?n:null}_isDisabled(e){return e.getAttribute(`aria-disabled`)===`true`}_isHidden(e){return e.hidden||!!e.closest(`[role="group"]`)?.hidden}_selectableOptions(){return[...this.querySelectorAll(o)].filter(e=>!this._isHidden(e)&&!this._isDisabled(e))}_setActive(e,t){this._activeId=e?e.id:null;for(let t of this.querySelectorAll(o))t.setAttribute(`aria-selected`,t===e?`true`:`false`);let n=this._input();n&&(e?n.setAttribute(`aria-activedescendant`,e.id):n.removeAttribute(`aria-activedescendant`)),e&&t&&e.scrollIntoView({block:`nearest`})}_move(e){let t=this._selectableOptions();if(!t.length)return;let n=t.findIndex(e=>e.id===this._activeId),r=n<0?e>0?0:t.length-1:(n+e+t.length)%t.length;this._userChose=!0,this._setActive(t[r],!0)}_handleKeyDown(e){if(e.target===this._input()){if(e.key===`ArrowDown`||e.key===`ArrowUp`)e.preventDefault(),this._move(e.key===`ArrowDown`?1:-1);else if(e.key===`Tab`&&this._groupActive()&&this._tabs().length)e.preventDefault(),this._cycleGroup(e.shiftKey?-1:1);else if(e.key===`Backspace`&&!e.isComposing&&this._path.length&&!e.target.value)e.preventDefault(),this._goTo(this._path.slice(0,-1));else if(e.key===`Enter`&&!e.isComposing){let t=this._selectableOptions().find(e=>e.id===this._activeId);if(!t)return;e.preventDefault(),this._select(t)}}}_select(e){this._remember(e),this.dispatchEvent(new CustomEvent(`wui-command-palette:select`,{bubbles:!0,cancelable:!0,detail:{key:e.dataset.key??null,groupKey:e.dataset.groupKey??null,id:e.id}}))&&(e.dataset.opens?this._open(e.dataset.opens):e.dataset.href&&this._navigate(e.dataset.href))}_open(e){let t=[...this.querySelectorAll(`.wui-cmd-page`)].find(t=>t.dataset.page===e);this._goTo([...this._path,{key:e,label:t?.dataset.label??e}])}_goTo(e){this._input()?.focus(),this.dispatchEvent(new CustomEvent(`wui-command-palette:navigate`,{bubbles:!0,cancelable:!0,detail:{path:e}}))&&(this._path=e,this._restart())}_tabs(){return[...this.querySelectorAll(p)]}_groupActive(){return this.hasAttribute(`group-filter`)&&this._path.length===0}_pickGroup(e){this._group=e,this._applyFilter(),this.refresh()}_cycleGroup(e){let t=this._tabs().map(e=>e.dataset.groupTab||null),n=Math.max(0,t.indexOf(this._group));this._pickGroup(t[(n+e+t.length)%t.length])}_syncTabs(){if(!this.hasAttribute(`group-filter`))return;let e=this.querySelector(`.wui-cmd-tabs`);e&&(e.hidden=!this._groupActive());for(let e of this._tabs())e.setAttribute(`aria-selected`,String((e.dataset.groupTab||null)===this._group))}_restart(){this._group=null;let e=this._input();e&&(e.value=``),this.hasAttribute(`filter`)&&this._applyFilter(),this.refresh()}_reset(){this.hasAttribute(`path`)||(this._path=[],this._restart())}_readPath(){let e=this.getAttribute(`path`);if(e==null)return;let t=JSON.parse(e);this._path=Array.isArray(t)?t.filter(e=>e&&typeof e.key==`string`&&typeof e.label==`string`):[]}_renderCrumbs(){let e=this.querySelector(`.wui-cmd-crumbs`);if(!e)return;let t=this.getAttribute(`root-label`)??c,n=JSON.stringify([t,this._path]);if(e.hidden=this._path.length===0,n===this._crumbSig)return;this._crumbSig=n;let r=e.querySelector(`.wui-cmd-trail`);if(!r)return;let i=[t,...this._path.map(e=>e.label)];r.replaceChildren(...i.map((e,t)=>{let n=document.createElement(`li`),r=t===i.length-1,a=document.createElement(r?`span`:`button`);return a.className=`wui-cmd-crumb`,a.textContent=e,r?a.setAttribute(`aria-current`,`page`):(a.type=`button`,a.dataset.depth=String(t)),n.append(a),n}))}_recentsHost(){return this.querySelector(`.wui-cmd-recents`)}_realOptions(){let e=this._recentsHost();return[...this.querySelectorAll(o)].filter(t=>!e?.contains(t))}_recentEntries(){let e=this.getAttribute(`recents-key`);if(!e)return[];let t;try{t=JSON.parse(globalThis.localStorage?.getItem(e)??`[]`)}catch{return[]}return Array.isArray(t)?t.filter(e=>e&&typeof e.g==`string`&&typeof e.k==`string`):[]}_recentsLimit(){let e=Number.parseInt(this.getAttribute(`recents-limit`)??``,10);return Number.isFinite(e)&&e>0?Math.min(e,d):u}_remember(e){let t=this.getAttribute(`recents-key`),{groupKey:n,key:r,opens:i}=e.dataset;if(!t||i||n==null||r==null)return;let a=[{g:n,k:r},...this._recentEntries().filter(e=>e.g!==n||e.k!==r)];try{globalThis.localStorage?.setItem(t,JSON.stringify(a.slice(0,this._recentsLimit())))}catch{}}_renderRecents(){let e=this._recentsHost();if(!e)return;let t=this._input(),n=this._groupActive()?this._group:null,r=this._path.length===0&&!(t?.value??``).trim()?this._recentEntries().filter(e=>!n||e.g===n):[],i=this._realOptions(),a=[];for(let e of r){let t=i.find(t=>t.dataset.groupKey===e.g&&t.dataset.key===e.k);if(t&&!t.dataset.opens&&!this._isDisabled(t)&&a.push(t),a.length>=this._recentsLimit())break}if(!a.length){e.firstChild&&e.replaceChildren();return}let o=`${this._recentsId}-label`,s=document.createElement(`div`);s.className=`wui-cmd-group`,s.setAttribute(`role`,`group`),s.setAttribute(`aria-labelledby`,o);let c=document.createElement(`div`);c.className=`wui-cmd-group-label`,c.setAttribute(`role`,`presentation`),c.id=o,c.textContent=this.getAttribute(`recents-label`)??l,s.append(c);for(let e of a){let t=e.cloneNode(!0);t.id=`${this._recentsId}-${e.id}`,t.hidden=!1,t.removeAttribute(`aria-selected`),s.append(t)}e.replaceChildren(s)}_inScope(e,t){return!t||(e.closest(`.wui-cmd-page`)?.dataset.page??null)===(this._path.at(-1)?.key??null)}_navigate(e){window.location.assign(e)}_applyFilter(){let e=this._input(),t=(e?e.value:``).trim(),n=t.toLowerCase(),a=this.highlight,s=[...this.querySelectorAll(`.wui-cmd-page`)],c=s.length>0,l=this._path.at(-1)?.key??null;for(let e of s)e.hidden=e.dataset.page!==l;let u=this._groupActive()?this._group:null,d=0;for(let e of this._realOptions()){let o=e.querySelector(`.wui-cmd-item-label`),s=e.dataset.label??o?.textContent??``,l=(e.dataset.keywords??``).split(/\s+/).filter(Boolean),f=!n||s.toLowerCase().includes(n)||l.some(e=>e.toLowerCase().includes(n)),p=this._inScope(e,c)&&(!u||e.dataset.groupKey===u)&&f;e.hidden=!p,p&&d++,o&&(o.innerHTML=(0,i.matchSegments)(s,a?t:``).map(e=>e.match?`<mark class="wui-cmd-mark">${(0,r.escapeHtml)(e.text)}</mark>`:(0,r.escapeHtml)(e.text)).join(``))}let f=this._recentsHost();for(let e of this.querySelectorAll(`[role="group"]`))f?.contains(e)||(e.hidden=![...e.querySelectorAll(o)].some(e=>!e.hidden));let p=this.querySelector(`[role="listbox"]`);p&&(p.hidden=d===0);let m=this.querySelector(`.wui-cmd-empty`);m&&(m.textContent=n&&d===0?this.emptyText:``)}_teardown(){this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`mousedown`,this._onMouseDown),this.removeEventListener(`mousemove`,this._onMouseMove),this.removeEventListener(`input`,this._onInput),this._modal?.removeEventListener(`hidden.bs.modal`,this._onModalHidden),this._modal=null}};(0,t.defineElement)(`wui-command-palette`,h),e.WuiCommandPalette=h})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.optionLabel,WeborityUiElementsInternal.modules.textMatch);