@webority/ui-elements 0.154.0 → 0.155.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/ui-elements/carousel.global.js +1 -1
  2. package/dist/ui-elements/code-block.global.js +1 -1
  3. package/dist/ui-elements/command-palette.global.js +1 -1
  4. package/dist/ui-elements/comment-thread.global.js +1 -1
  5. package/dist/ui-elements/consent-banner.global.js +1 -1
  6. package/dist/ui-elements/context-menu.global.js +1 -1
  7. package/dist/ui-elements/date-range.global.js +1 -1
  8. package/dist/ui-elements/drawer.global.js +1 -1
  9. package/dist/ui-elements/glyphs.global.js +1 -1
  10. package/dist/ui-elements/image-crop.global.js +1 -1
  11. package/dist/ui-elements/inline-edit.global.js +1 -1
  12. package/dist/ui-elements/kanban.global.js +1 -1
  13. package/dist/ui-elements/lead-popup.global.js +1 -1
  14. package/dist/ui-elements/lightbox.global.js +1 -1
  15. package/dist/ui-elements/markdown.global.js +1 -1
  16. package/dist/ui-elements/org-tree.global.js +1 -1
  17. package/dist/ui-elements/phone.global.js +1 -1
  18. package/dist/ui-elements/resizable.global.js +1 -1
  19. package/dist/ui-elements/saved-views.global.js +1 -1
  20. package/dist/ui-elements/select-chips.global.js +1 -1
  21. package/dist/ui-elements/select-recents.global.js +1 -1
  22. package/dist/ui-elements/select-search.global.js +1 -1
  23. package/dist/ui-elements/slider.global.js +1 -1
  24. package/dist/ui-elements/sortable.global.js +1 -1
  25. package/dist/ui-elements/status-icon.global.js +1 -1
  26. package/dist/ui-elements/timepicker.global.js +1 -1
  27. package/dist/ui-elements/tour.global.js +1 -1
  28. package/dist/ui-elements/tree.global.js +1 -1
  29. package/dist/ui-elements/wizard.global.js +1 -1
  30. package/dist/ui-elements.global.js +2 -2
  31. package/package.json +4 -4
@@ -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.154.0`)throw Error(`[webority-ui] kanban expects ui-elements 0.154.0 but the page loaded `+o+`.`);var s=Object.freeze([`neutral`,`primary`,`info`,`success`,`warning`,`danger`]),c=Object.freeze([`number`,`currency`,`compact`]),l=`wui-kanban:`,u=`(max-width: 767.98px)`,d=400,f=6,p=Object.freeze({help:`Press Space to pick up the card. Use the Left and Right arrow keys to choose a column, then Space to drop it, or Escape to cancel.`,empty:`Nothing here`,collapse:e=>`Collapse ${e}`,expand:e=>`Expand ${e}`,lifted:(e,t)=>`Picked up ${e} in ${t}. Use the Left and Right arrow keys to choose a column.`,over:(e,t)=>`${e}, ${t===1?`1 card`:`${t} cards`}. Drop allowed.`,overSource:e=>`${e}, where the card started.`,overRefused:(e,t)=>`${e}. ${t}`,dropHere:(e,t)=>`Drop here to move ${e} to ${t}.`,refused:(e,t)=>`Cards in ${e} cannot move to ${t}.`,moved:(e,t)=>`Moved ${e} to ${t}.`,saving:(e,t)=>`Moving ${e} to ${t}.`,cancelled:e=>`${e} was not moved.`,rolledBack:(e,t)=>`${e} went back to ${t}.`,locked:e=>`${e} cannot be moved.`,more:e=>`Show ${e} more`,fewer:`Show fewer`,loadMore:e=>`Show more (${e})`,loading:`Loading…`,loadFailed:`More cards could not be loaded. Try again.`,swipeHint:`Swipe sideways or tap a column`,busy:`This card is still saving. Try again in a moment.`,failed:Object.freeze({forbidden:`You do not have permission to move this card.`,client:`This card could not be moved. Refresh the board and try again.`,validation:`This card could not be moved. Refresh the board and try again.`,server:`Something went wrong on our side, so the card went back. Try again in a moment.`,network:`Could not reach the server, so the card went back. Check your connection and try again.`})}),m=e=>typeof e==`object`&&!!e,h=e=>{let t=m(e)?e.collapsed:void 0;return m(t)?Object.fromEntries(Object.entries(t).map(([e,t])=>[e,!!t])):{}};function g(e){if(e==null||e===``)return null;let t=typeof e==`number`?e:Number(e);if(!Number.isInteger(t)||t<1)throw TypeError(`Unsupported kanban visible limit "${String(e)}". Use a whole number of 1 or more.`);return t}function _(e,t,n,r){let i=new Set;if(t==null||n)return i;let a=0;for(let n of e)r.has(n)||(a<t?a++:i.add(n));return i}function v(e){let t=(e.getAttribute(`aria-label`)||e.textContent||``).replace(/\s+/g,` `).trim();return t.length>80?`${t.slice(0,79)}…`:t||e.getAttribute(`data-wui-card`)||`Card`}function y(e){return e?`${l}${e}`:null}function b(e,t=globalThis.localStorage){let n=y(e);if(!n||!t)return{};try{return h(JSON.parse(t.getItem(n)||`null`))}catch{return{}}}function x(e,t,n,r=globalThis.localStorage){let i=y(e);if(!i||!r)return;let a={...b(e,r),[String(t)]:!!n};try{r.setItem(i,JSON.stringify({collapsed:a}))}catch(e){if(!(e instanceof DOMException))throw e}}function S(e,t){if(!c.includes(e))throw TypeError(`Unsupported kanban summary format "${String(e)}". Use ${c.join(`, `)}.`);if(t!=null&&t!==``&&!(0,i.isMoneyUnit)(t))throw TypeError(`Unsupported kanban summary unit "${String(t)}". Use ${i.MONEY_UNITS.join(`, `)}.`);return e===`currency`?{style:`currency`,unit:t||`rupees`}:e===`compact`?{style:`compact`,currency:`INR`,unit:t||`rupees`}:{style:`number`,decimals:0}}function C(e){let t=0;for(let n of e){if(n==null||n===``)continue;let e=typeof n==`number`?n:Number(n);Number.isFinite(e)&&(t+=e)}return t}var ee=p.failed,w=`[data-wui-column]`,T=`[data-wui-body]`,E=`[data-wui-card]`,D=`[data-wui-count]`,O=`[data-wui-summary]`,k=`[data-wui-empty]`,A=`[data-wui-drop-note]`,j=`[data-wui-live]`,te=`[data-wui-help]`,M=`[data-wui-switch]`,ne=`[data-wui-scroller]`,N=`[data-wui-collapse]`,P=`[data-wui-more]`,F=`data-wui-visible-limit`,I=`data-wui-overflow`,re=`input, select, textarea, [contenteditable=""], [contenteditable="true"], [data-wui-no-drag]`,L=`[data-wui-load-more]`,R=`data-wui-more-url`,z=`data-wui-total`,B=`data-wui-unloaded`,V=48,H=16,U=160,W=e=>e.getAttribute(`data-wui-column`),G=e=>e.getAttribute(`data-wui-card`),K=e=>e instanceof HTMLElement&&!!e.hidden||e.hasAttribute(`hidden`),ie=e=>K(e)||e.hasAttribute(I),q=e=>e instanceof Element?e:null,ae=e=>typeof e==`object`&&e&&`name`in e?e.name:void 0,oe=e=>typeof e==`object`&&e&&`message`in e?e.message:void 0,J=(e,t,n)=>{let r=e.querySelector(t);return r instanceof n?r:null},Y=(e,t,n)=>[...e.querySelectorAll(t)].filter(e=>e instanceof n),X=(e,t,n)=>{let r=e.closest(t);return r instanceof n?r:null},Z=()=>window.WUI??null,Q=(e,t)=>{e&&Z()?.toast(e,{variant:t})},$=class extends r.ElementBase{constructor(){super(),this._wired=!1,this._filter=null,this._expanded=new Set,this._revealed=new Set,this._press=null,this._drag=null,this._kbd=null,this._suppressClick=!1,this._observer=null,this._refreshQueued=!1,this._scrollTimer=0,this._onPointerMove=e=>this._pointerMove(e),this._onPointerUp=e=>this._pointerUp(e),this._onPointerCancel=()=>this._endPointer(!1),this._onDocKeyDown=e=>{e.key===`Escape`&&this._drag&&(e.preventDefault(),this._endPointer(!1))},this._onScroll=()=>{clearTimeout(this._scrollTimer),this._scrollTimer=setTimeout(()=>this._syncSwitcherFromScroll(),80)},this.addEventListener(`pointerdown`,e=>this._pointerDown(e)),this.addEventListener(`keydown`,e=>this._keyDown(e)),this.addEventListener(`click`,e=>this._click(e),!0),this.addEventListener(`scroll`,e=>{e.target instanceof Element&&this._loadOnScroll(e.target)},!0),this.addEventListener(`dragstart`,e=>{q(e.target)?.closest(E)&&e.preventDefault()}),this.addEventListener(`touchmove`,e=>{this._drag&&e.preventDefault()},{passive:!1})}_controlled(){return this.hasAttribute(`controlled`)}connectedCallback(){if(!this._wired){this._wired=!0,this._scroller()?.addEventListener(`scroll`,this._onScroll,{passive:!0}),this._restoreCollapsed();for(let e of this._allCards())this._prepareCard(e);if(typeof MutationObserver==`function`){this._observer=new MutationObserver(e=>{for(let t of e)for(let e of t.addedNodes)e instanceof HTMLElement&&e.matches(E)&&this._prepareCard(e);this._queueRefresh()});for(let e of this.querySelectorAll(T))this._observer.observe(e,{childList:!0})}this.refresh()}}disconnectedCallback(){this._endPointer(!1),this._observer?.disconnect(),this._observer=null,this._scroller()?.removeEventListener(`scroll`,this._onScroll),clearTimeout(this._scrollTimer),this._wired=!1}setFilter(e){if(e!=null&&typeof e!=`function`)throw TypeError(`wui-kanban setFilter: pass a function or null.`);if(this._filter=e,!e)for(let e of this._allCards())e.hidden=!1;this.refresh()}refresh(){if(this._controlled())return;this._refreshQueued=!1;let e=this._summaryFormat();for(let t of this._columns()){let n=W(t),r=g(t.getAttribute(F)),a=[],o=[];for(let e of this._cardsIn(t))this._filter&&(e.hidden=this._filter(e)===!1),K(e)?e.removeAttribute(I):(a.push(e),o.push(e.getAttribute(`data-wui-value`)));let s=this._expanded.has(n),c=_(a.map(G),r,s,this._revealed);for(let e of a)e.toggleAttribute(I,c.has(G(e)));let l=this._unloadedIn(t),u=String(a.length+l);for(let e of this._countsOf(t))e.textContent!==u&&(e.textContent=u);let d=J(t,k,HTMLElement);if(d&&(d.hidden=a.length>0),e){let n=t.querySelector(O);n&&(n.textContent=(0,i.formatValue)(C(o),e))}let f=J(t,P,HTMLElement);if(f){f.hidden=r==null||(s?a.length<=r:c.size===0),f.setAttribute(`aria-expanded`,s?`true`:`false`);let e=s?p.fewer:p.more(c.size);f.textContent!==e&&(f.textContent=e)}let m=J(t,L,HTMLButtonElement);if(m&&(m.hidden=l<=0,!t.hasAttribute(`data-wui-loading`))){m.disabled=!1;let e=p.loadMore(l);m.textContent!==e&&(m.textContent=e)}}}moveCard(e,t,n){let r=this._cardByKey(e);if(!r)throw Error(`wui-kanban moveCard: no card "${String(e)}" on this board.`);if(!this._columnByKey(t))throw Error(`wui-kanban moveCard: no column "${String(t)}" on this board.`);return this._commit(r,t,n)}_columns(){return Y(this,w,HTMLElement)}_columnByKey(e){return this._columns().find(t=>W(t)===e)||null}_columnOf(e){return X(e,w,HTMLElement)}_titleOf(e){return(e.querySelector(`.wui-kanban-title`)?.textContent||W(e)||``).replace(/\s+/g,` `).trim()}_bodyOf(e){return J(e,T,HTMLElement)}_cardsIn(e){let t=this._bodyOf(e);return t?[...t.children].filter(e=>e instanceof HTMLElement&&e.matches(E)):[]}_visibleCardsIn(e){return this._cardsIn(e).filter(e=>!ie(e))}_allCards(){return Y(this,`${T} > ${E}`,HTMLElement)}_cardByKey(e){return this._allCards().find(t=>G(t)===e)||null}_countsOf(e){let t=W(e),n=[...this.querySelectorAll(M)].filter(e=>e.getAttribute(`data-wui-switch`)===t);return[...e.querySelectorAll(D),...n.flatMap(e=>[...e.querySelectorAll(D)])]}_scroller(){return J(this,ne,HTMLElement)}_summaryFormat(){let e=this.getAttribute(`summary-format`);return e?S(e,this.getAttribute(`summary-unit`)):null}_queueRefresh(){this._refreshQueued||(this._refreshQueued=!0,queueMicrotask(()=>{this._refreshQueued&&this.refresh()}))}_prepareCard(e){let t=this.querySelector(te);t?.id&&!e.hasAttribute(`aria-describedby`)&&e.setAttribute(`aria-describedby`,t.id),e.hasAttribute(`tabindex`)||(e.tabIndex=0)}_announce(e){let t=J(this,j,HTMLElement);t&&e&&(t.textContent=``,t.textContent=e)}_fire(e,t,n=!1){return this.dispatchEvent(new CustomEvent(e,{bubbles:!0,cancelable:n,detail:t}))}_canLift(e){let t=v(e),n=this.hasAttribute(`readonly`);return n||e.hasAttribute(`data-wui-locked`)?(this._announce(p.locked(t)),this._fire(`wui:kanban:locked`,{key:G(e),card:e,reason:n?`readonly`:`locked`},!0),!1):e.getAttribute(`aria-busy`)!==`true`||(this._announce(p.busy),Q(p.busy,`info`),!1)}_check(e,t,n){if(t===n)return{ok:!1,source:!0,reason:null};let r=this._columnByKey(t),i=this._columnByKey(n),a=p.refused(r?this._titleOf(r):String(t),i?this._titleOf(i):String(n)),o=i?.getAttribute(`data-accept-from`),s=o?.split(/\s+/).filter(Boolean)??[];if(o!=null&&!s.includes(t))return{ok:!1,reason:a};if(typeof this.accept==`function`){let r=this.accept(e,t,n);if(r===!1)return{ok:!1,reason:a};if(typeof r==`string`&&r)return{ok:!1,reason:r}}return{ok:!0,reason:null}}_markTargets(e,t){let n=v(e),r=new Map;for(let i of this._columns()){let a=W(i),o=this._check(e,t,a);r.set(a,o),i.setAttribute(`data-wui-drop`,o.source?`source`:o.ok?`ok`:`refused`);let s=J(i,A,HTMLElement);s&&!o.source&&(s.textContent=o.ok?p.dropHere(n,this._titleOf(i)):o.reason,s.hidden=!1)}return r}_clearTargets(){for(let e of this._columns()){e.removeAttribute(`data-wui-drop`),e.removeAttribute(`data-wui-over`),e.removeAttribute(`data-wui-target`);let t=J(e,A,HTMLElement);t&&(t.hidden=!0,t.textContent=``)}}async _commit(e,t,n){let r=this._columnOf(e);if(!r)throw Error(`wui-kanban: the card is not inside a column.`);let i=W(r),o=this._columnByKey(t),s=v(e);if(i===t||!this._canLift(e))return!1;let c=this._check(e,i,t);if(!c.ok)return this._announce(c.reason),Q(c.reason,`info`),!1;if(!o)throw Error(`wui-kanban: no column "${String(t)}" on this board.`);let l=this._cardsIn(o),u=Number.isInteger(n)?Math.max(0,Math.min(n??0,l.length)):l.length,d={key:G(e),card:e,from:i,to:t,index:u},f=e.contains(document.activeElement);if(this._controlled())return this._fire(`wui:kanban:move`,d),this._announce(p.moved(s,this._titleOf(o))),f&&this._refocusSoon(d.key),!0;if(!this._fire(`wui:kanban:move`,d,!0))return!1;let m=o.hasAttribute(F)&&!this._revealed.has(d.key);m&&this._revealed.add(d.key);let h={parent:e.parentNode,next:e.nextSibling,column:r,revealed:m},g=this._bodyOf(o);if(!g)throw Error(`wui-kanban: the target column has no body.`);g.insertBefore(e,l[u]||null),f&&this._focusMoved(e),this.refresh();let _=o.getAttribute(`data-wui-step`);if(_)return this._runStep(e,d,h,_,o.getAttribute(`data-wui-step-size`));let y=this.getAttribute(`move-url`);if(!y)return this._announce(p.moved(s,this._titleOf(o))),this._fire(`wui:kanban:moved`,{...d,result:null}),!0;this._lock(e,!0),this._announce(p.saving(s,this._titleOf(o)));let b=new URLSearchParams({card:String(d.key),from:String(i),to:String(t),index:String(u)}),x=await(0,a.wuiFetch)(y,{method:`POST`,body:b});if(this._lock(e,!1),x.kind===`session`)return!1;if(x.ok){let t=this._applyFragment(x.html)||e;return Q(x.message,`success`),this._announce(p.moved(v(t),this._titleOf(o))),this._fire(`wui:kanban:moved`,{...d,card:t,result:x}),!0}return this._rollback(e,h),x.kind!==`aborted`&&Q(x.message||ee[x.kind]||p.failed.server,`danger`),this._fire(`wui:kanban:failed`,{...d,kind:x.kind,status:x.status,message:x.message}),!1}async _runStep(e,t,n,r,i){let o=v(e),s=this._columnByKey(t.to),c=new URLSearchParams({card:String(t.key),from:String(t.from),to:String(t.to)}).toString(),l=r+(r.includes(`?`)?`&`:`?`)+c;this._lock(e,!0);let u;try{let t=window.WUI?.modal?.load;if(typeof t!=`function`)throw Error(`<wui-kanban> data-wui-step needs the Razor script webority-ui.js (WUI.modal.load).`);u=await(await t(l,{trigger:e,size:i||void 0})).closed}catch(r){return this._lock(e,!1),this._rollback(e,n),ae(r)!==`AbortError`&&Q(p.failed.server,`danger`),this._fire(`wui:kanban:failed`,{...t,kind:`step`,status:0,message:oe(r)??null}),!1}if(u?.status!==`success`)return this._lock(e,!1),this._rollback(e,n),this._announce(p.cancelled(o)),this._fire(`wui:kanban:failed`,{...t,kind:`dismissed`,status:0,message:null}),!1;let d=e,f=this.getAttribute(`card-url`);if(f){let n=await(0,a.wuiFetch)(`${f}${f.includes(`?`)?`&`:`?`}${new URLSearchParams({card:String(t.key)})}`);n.ok&&(d=this._applyFragment(n.html)||e)}if(this._lock(d,!1),!s)throw Error(`wui-kanban: no column "${String(t.to)}" on this board.`);return this._announce(p.moved(v(d),this._titleOf(s))),this._fire(`wui:kanban:moved`,{...t,card:d,result:u}),!0}_lock(e,t){t?(e.setAttribute(`aria-busy`,`true`),e.setAttribute(`data-wui-saving`,``)):(e.removeAttribute(`aria-busy`),e.removeAttribute(`data-wui-saving`))}_rollback(e,t){let n=e.contains(document.activeElement),r=t.next&&t.next.parentNode===t.parent?t.next:null;if(t.revealed&&this._revealed.delete(G(e)),!t.parent)throw Error(`wui-kanban: the card had no parent to go back to.`);t.parent.insertBefore(e,r),n&&e.focus(),this.refresh(),this._announce(p.rolledBack(v(e),this._titleOf(t.column)))}_applyFragment(e){if(!e)return null;let t=document.createElement(`template`);t.innerHTML=e;for(let e of t.content.querySelectorAll(`script`))(0,n.devWarn)(`[@webority/ui-elements] A kanban fragment carried a script tag; it was removed, not run.`),e.remove();let r=null;for(let e of Y(t.content,E,HTMLElement)){if(e.closest(`template`))continue;let t=this._cardByKey(G(e));if(!t)continue;let n=t.contains(document.activeElement);t.dispatchEvent(new CustomEvent(`wui:teardown`,{bubbles:!0})),t.hidden&&(e.hidden=!0),t.replaceWith(e),this._prepareCard(e),n&&e.focus(),r??=e}for(let e of Y(t.content,`template[data-wui-kanban-summary]`,HTMLTemplateElement))this._columnByKey(e.getAttribute(`data-wui-kanban-summary`))?.querySelector(O)?.replaceChildren(e.content.cloneNode(!0));return this.refresh(),Z()?.refresh(),r}_refocusSoon(e){let t=()=>{let t=this._cardByKey(e);t&&this._focusMoved(t)};typeof requestAnimationFrame==`function`?requestAnimationFrame(t):setTimeout(t,0)}_focusMoved(e){e.focus({preventScroll:!0}),e.scrollIntoView?.({block:`nearest`})}_pointerDown(e){if(e.button!==0||e.isPrimary===!1||this._drag||this._kbd)return;let t=q(e.target),n=t?X(t,E,HTMLElement):null;if(!n||!this.contains(n)||t?.closest(re))return;let r={card:n,id:e.pointerId,x:e.clientX,y:e.clientY,type:e.pointerType,timer:0};this._press=r,e.pointerType===`touch`&&(r.timer=setTimeout(()=>{this._press===r&&this._startDrag(r,r.x,r.y)},400)),window.addEventListener(`pointermove`,this._onPointerMove),window.addEventListener(`pointerup`,this._onPointerUp),window.addEventListener(`pointercancel`,this._onPointerCancel)}_pointerMove(e){let t=this._press;if(t&&e.pointerId===t.id){if(!this._drag){if(!(Math.hypot(e.clientX-t.x,e.clientY-t.y)>6))return;if(t.type===`touch`){this._endPointer(!1);return}if(this._startDrag(t,e.clientX,e.clientY),!this._drag)return}this._dragTo(e.clientX,e.clientY)}}_pointerUp(e){this._press&&e.pointerId===this._press.id&&this._endPointer(!!this._drag)}_startDrag(e,t,n){let r=e.card;if(!this._canLift(r)){this._endPointer(!1);return}let i=this._columnOf(r);if(!i)throw Error(`wui-kanban: the card is not inside a column.`);let a=W(i),o=r.getBoundingClientRect(),s=r.cloneNode(!0);if(!(s instanceof HTMLElement))return;let c=s;for(let e of[c,...c.querySelectorAll(`[id]`)])e.removeAttribute(`id`);c.removeAttribute(`data-wui-card`),c.removeAttribute(`tabindex`),c.setAttribute(`aria-hidden`,`true`),c.classList.add(`wui-kanban-ghost`),c.style.width=`${o.width}px`,this.appendChild(c),r.setAttribute(`data-wui-dragging`,``),this.setAttribute(`data-wui-dragging`,``),this._drag={card:r,from:a,ghost:c,dx:t-o.left,dy:n-o.top,x:t,y:n,over:null,verdicts:this._markTargets(r,a)},this._announce(p.lifted(v(r),this._titleOf(i))),document.addEventListener(`keydown`,this._onDocKeyDown),this._dragTo(t,n)}_dragTo(e,t){let n=this._drag;if(!n)throw Error(`wui-kanban: no drag in progress.`);n.x=e,n.y=t,n.ghost.style.transform=`translate(${e-n.dx}px, ${t-n.dy}px)`;let r=this._columnAt(e,t);r!==n.over&&(n.over?.removeAttribute(`data-wui-over`),r?.setAttribute(`data-wui-over`,``),n.over=r),this._autoScroll(e,t,r)}_columnAt(e,t){for(let n of this._columns()){let r=n.getBoundingClientRect();if(e>=r.left&&e<=r.right&&t>=r.top&&t<=r.bottom)return n}return null}_indexAt(e,t){let n=this._visibleCardsIn(e).filter(e=>e!==this._drag?.card).find(e=>{let n=e.getBoundingClientRect();return t<n.top+n.height/2}),r=this._cardsIn(e).filter(e=>e!==this._drag?.card);return n?r.indexOf(n):r.length}_autoScroll(e,t,n){let r=this._scroller();if(r){let t=r.getBoundingClientRect();t.width>0&&(e<t.left+V?r.scrollBy?.({left:-16}):e>t.right-V&&r.scrollBy?.({left:H}))}if(n&&this._scrollColumn(n,t))return;let i=window.innerHeight||0;i>0&&(t<V?window.scrollBy?.({top:-16}):t>i-V&&window.scrollBy?.({top:H}))}_scrollColumn(e,t){let n=this._bodyOf(e);if(!n||e.hasAttribute(`data-collapsed`)||n.scrollHeight<=n.clientHeight)return!1;let r=n.getBoundingClientRect();return t<r.top+V&&n.scrollTop>0?(n.scrollBy?.({top:-16}),!0):t>r.bottom-V&&n.scrollTop+n.clientHeight<n.scrollHeight-1&&(n.scrollBy?.({top:H}),!0)}_endPointer(e){let t=this._press,n=this._drag;if(t&&clearTimeout(t.timer||void 0),this._press=null,this._drag=null,window.removeEventListener(`pointermove`,this._onPointerMove),window.removeEventListener(`pointerup`,this._onPointerUp),window.removeEventListener(`pointercancel`,this._onPointerCancel),document.removeEventListener(`keydown`,this._onDocKeyDown),!n)return;n.ghost.remove(),n.card.removeAttribute(`data-wui-dragging`),this.removeAttribute(`data-wui-dragging`),this._suppressClick=!0,setTimeout(()=>{this._suppressClick=!1},0);let r=n.over;if(this._clearTargets(),!e||!r){this._announce(p.cancelled(v(n.card)));return}let i=W(r),a=n.verdicts.get(i);a?.source?this._announce(p.cancelled(v(n.card))):a?.ok?this._commit(n.card,i,this._indexAt(r,n.y)):(this._announce(a?.reason),Q(a?.reason,`info`))}_click(e){let t=q(e.target);if(this._suppressClick&&t?.closest(E)){e.preventDefault(),e.stopPropagation(),this._suppressClick=!1;return}let n=t?.closest(N);if(n&&this.contains(n)){let e=X(n,w,HTMLElement);e&&this._setCollapsed(e,!e.hasAttribute(`data-collapsed`),!0);return}let r=t?.closest(L);if(r&&this.contains(r)){this._controlled()||this._loadMore(X(r,w,HTMLElement));return}let i=t?.closest(P);if(i&&this.contains(i)){this._controlled()||this._toggleMore(X(i,w,HTMLElement));return}let a=t?.closest(M);a&&this.contains(a)&&this._showColumn(a.getAttribute(`data-wui-switch`))}_keyDown(e){let t=this._kbd;if(t){this._liftedKey(e,t);return}let n=e.target instanceof HTMLElement?e.target:null;if(!n?.matches(E)||!this.contains(n))return;let r=this._columnOf(n);switch(e.key){case` `:case`Spacebar`:{if(e.preventDefault(),!this._canLift(n))return;if(!r)throw Error(`wui-kanban: the card is not inside a column.`);let t=W(r),i=this._columns();this._kbd={card:n,from:t,target:i.indexOf(r),verdicts:this._markTargets(n,t)},n.setAttribute(`data-wui-lifted`,``),this.setAttribute(`data-wui-dragging`,``),r.setAttribute(`data-wui-target`,``),this._announce(p.lifted(v(n),this._titleOf(r)));return}case`ArrowDown`:case`ArrowUp`:{if(!r)throw Error(`wui-kanban: the card is not inside a column.`);let t=this._visibleCardsIn(r),i=t[t.indexOf(n)+(e.key===`ArrowDown`?1:-1)];i&&(e.preventDefault(),i.focus());return}case`ArrowLeft`:case`ArrowRight`:{let t=this._columns(),n=e.key===`ArrowRight`?1:-1;for(let i=(r?t.indexOf(r):-1)+n;i>=0&&i<t.length;i+=n){let n=t[i],r=n?this._visibleCardsIn(n)[0]:void 0;if(r&&n&&!n.hasAttribute(`data-collapsed`)){e.preventDefault(),r.focus();return}}return}}}_liftedKey(e,t){let n=this._columns();switch(e.key){case`ArrowLeft`:case`ArrowRight`:{e.preventDefault();let r=t.target+(e.key===`ArrowRight`?1:-1);if(r<0||r>=n.length)return;n[t.target]?.removeAttribute(`data-wui-target`),t.target=r;let i=n[r];if(!i)return;i.setAttribute(`data-wui-target`,``),this._showColumn(W(i),!1);let a=t.verdicts.get(W(i));if(!a)throw Error(`wui-kanban: no verdict for the column.`);let o=this._titleOf(i);this._announce(a.source?p.overSource(o):a.ok?p.over(o,this._cardsIn(i).filter(e=>!K(e)).length):p.overRefused(o,a.reason??``));return}case` `:case`Spacebar`:case`Enter`:{e.preventDefault();let r=n[t.target];if(!r)throw Error(`wui-kanban: the lifted card has no target column.`);let i=W(r),a=t.verdicts.get(i);if(!a)throw Error(`wui-kanban: no verdict for the column.`);if(!a.source&&!a.ok){this._announce(a.reason);return}this._endKeyboard(),a.source?this._announce(p.cancelled(v(t.card))):this._commit(t.card,i);return}case`Escape`:case`Tab`:e.key===`Escape`&&e.preventDefault(),this._endKeyboard(),this._showColumn(t.from,!1),this._announce(p.cancelled(v(t.card)));return}}_endKeyboard(){let e=this._kbd;this._kbd=null,e&&(e.card.removeAttribute(`data-wui-lifted`),this.removeAttribute(`data-wui-dragging`),this._clearTargets())}_restoreCollapsed(){let e=b(this.getAttribute(`board-id`));for(let t of this._columns()){let n=W(t);t.hasAttribute(`data-collapsible`)&&Object.hasOwn(e,String(n))&&this._setCollapsed(t,e[String(n)],!1)}}_setCollapsed(e,t,n){let r=W(e);e.toggleAttribute(`data-collapsed`,t);let i=this._titleOf(e);for(let n of e.querySelectorAll(N))n.setAttribute(`aria-expanded`,t?`false`:`true`),n.setAttribute(`aria-label`,t?p.expand(i):p.collapse(i));n&&(x(this.getAttribute(`board-id`),r,t),this._fire(`wui:kanban:collapse`,{column:r,collapsed:t}))}_toggleMore(e){if(!e)return;let t=W(e);if(this._expanded.delete(t))for(let t of this._cardsIn(e))this._revealed.delete(G(t));else this._expanded.add(t);this.refresh()}_unloadedIn(e){return e.hasAttribute(R)?(e.hasAttribute(B)||e.setAttribute(B,String(Math.max(0,Number(e.getAttribute(z))-this._cardsIn(e).length))),Number(e.getAttribute(B))):0}async _loadMore(e){if(!e)throw Error(`wui-kanban: the load-more button is outside a column.`);let t=Number(e.getAttribute(B));if(e.hasAttribute(`data-wui-loading`)||!(t>0))return;e.setAttribute(`data-wui-loading`,``);let r=J(e,L,HTMLButtonElement);r&&(r.disabled=!0,r.textContent=p.loading);let i=new URL(String(e.getAttribute(R)),document.baseURI);i.searchParams.set(`skip`,String(this._cardsIn(e).length));let o=0,s=!1;try{let n=await(0,a.wuiFetch)(i.toString());if(n.ok){let r=document.createElement(`template`);r.innerHTML=n.html;let i=this._bodyOf(e);for(let e of[...r.content.children])if(e.matches(E)&&!this._cardByKey(G(e))){if(!i)throw Error(`wui-kanban: the column has no body.`);i.append(e),o++}let a=n.response?.headers.get(`Wui-Kanban-Remaining`)??``;e.setAttribute(B,String(/^\d+$/.test(a)?Number(a):Math.max(0,t-o))),s=!0}}catch(e){(0,n.devError)(`[@webority/ui-elements] A kanban column could not load its next cards.`,e)}e.removeAttribute(`data-wui-loading`),this.refresh(),s?this._fire(`wui:kanban:loaded`,{key:W(e),added:o}):Q(p.loadFailed,`danger`)}_loadOnScroll(e){if(this._controlled()||!e.matches(T))return;let t=X(e,w,HTMLElement);t?.hasAttribute(R)&&e.scrollTop+e.clientHeight>=e.scrollHeight-U&&this._loadMore(t)}_isPhone(){return typeof matchMedia==`function`&&matchMedia(`(max-width: 767.98px)`).matches}_showColumn(e,t=!0){for(let t of this.querySelectorAll(M))t.getAttribute(`data-wui-switch`)===e?t.setAttribute(`aria-current`,`true`):t.removeAttribute(`aria-current`);let n=this._columnByKey(e),r=this._scroller();if(!n||!r||!t&&!this._isPhone())return;let i=typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches;r.scrollTo?.({left:n.offsetLeft-r.offsetLeft,behavior:i?`auto`:`smooth`})}_syncSwitcherFromScroll(){let e=this._scroller();if(!e||!this._isPhone())return;let t=e.clientWidth||1,n=this._columns()[Math.round(e.scrollLeft/t)];if(n)for(let e of this.querySelectorAll(M))e.getAttribute(`data-wui-switch`)===W(n)?e.setAttribute(`aria-current`,`true`):e.removeAttribute(`aria-current`)}};(0,t.defineElement)(`wui-kanban`,$),e.KANBAN_DRAG_THRESHOLD_PX=f,e.KANBAN_LONG_PRESS_MS=d,e.KANBAN_PHONE_QUERY=u,e.KANBAN_STORAGE_PREFIX=l,e.KANBAN_SUMMARY_FORMATS=c,e.KANBAN_TEXT=p,e.KANBAN_TONES=s,e.WuiKanban=$,e.kanbanCardLabel=v,e.kanbanOverflow=_,e.kanbanStorageKey=y,e.kanbanSummaryFormat=S,e.kanbanVisibleLimit=g,e.readKanbanCollapsed=b,e.sumKanbanValues=C,e.writeKanbanCollapsed=x})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.devWarn,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.formatters,WeborityUiElementsInternal.modules.wuiHttp);
1
+ (function(e,t,n,r,i,a){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var o=globalThis.WeborityUiElementsInternal?.version;if(o!==`0.155.0`)throw Error(`[webority-ui] kanban expects ui-elements 0.155.0 but the page loaded `+o+`.`);var s=Object.freeze([`neutral`,`primary`,`info`,`success`,`warning`,`danger`]),c=Object.freeze([`number`,`currency`,`compact`]),l=`wui-kanban:`,u=`(max-width: 767.98px)`,d=400,f=6,p=Object.freeze({help:`Press Space to pick up the card. Use the Left and Right arrow keys to choose a column, then Space to drop it, or Escape to cancel.`,empty:`Nothing here`,collapse:e=>`Collapse ${e}`,expand:e=>`Expand ${e}`,lifted:(e,t)=>`Picked up ${e} in ${t}. Use the Left and Right arrow keys to choose a column.`,over:(e,t)=>`${e}, ${t===1?`1 card`:`${t} cards`}. Drop allowed.`,overSource:e=>`${e}, where the card started.`,overRefused:(e,t)=>`${e}. ${t}`,dropHere:(e,t)=>`Drop here to move ${e} to ${t}.`,refused:(e,t)=>`Cards in ${e} cannot move to ${t}.`,moved:(e,t)=>`Moved ${e} to ${t}.`,saving:(e,t)=>`Moving ${e} to ${t}.`,cancelled:e=>`${e} was not moved.`,rolledBack:(e,t)=>`${e} went back to ${t}.`,locked:e=>`${e} cannot be moved.`,more:e=>`Show ${e} more`,fewer:`Show fewer`,loadMore:e=>`Show more (${e})`,loading:`Loading…`,loadFailed:`More cards could not be loaded. Try again.`,swipeHint:`Swipe sideways or tap a column`,busy:`This card is still saving. Try again in a moment.`,failed:Object.freeze({forbidden:`You do not have permission to move this card.`,client:`This card could not be moved. Refresh the board and try again.`,validation:`This card could not be moved. Refresh the board and try again.`,server:`Something went wrong on our side, so the card went back. Try again in a moment.`,network:`Could not reach the server, so the card went back. Check your connection and try again.`})}),m=e=>typeof e==`object`&&!!e,h=e=>{let t=m(e)?e.collapsed:void 0;return m(t)?Object.fromEntries(Object.entries(t).map(([e,t])=>[e,!!t])):{}};function g(e){if(e==null||e===``)return null;let t=typeof e==`number`?e:Number(e);if(!Number.isInteger(t)||t<1)throw TypeError(`Unsupported kanban visible limit "${String(e)}". Use a whole number of 1 or more.`);return t}function _(e,t,n,r){let i=new Set;if(t==null||n)return i;let a=0;for(let n of e)r.has(n)||(a<t?a++:i.add(n));return i}function v(e){let t=(e.getAttribute(`aria-label`)||e.textContent||``).replace(/\s+/g,` `).trim();return t.length>80?`${t.slice(0,79)}…`:t||e.getAttribute(`data-wui-card`)||`Card`}function y(e){return e?`${l}${e}`:null}function b(e,t=globalThis.localStorage){let n=y(e);if(!n||!t)return{};try{return h(JSON.parse(t.getItem(n)||`null`))}catch{return{}}}function x(e,t,n,r=globalThis.localStorage){let i=y(e);if(!i||!r)return;let a={...b(e,r),[String(t)]:!!n};try{r.setItem(i,JSON.stringify({collapsed:a}))}catch(e){if(!(e instanceof DOMException))throw e}}function S(e,t){if(!c.includes(e))throw TypeError(`Unsupported kanban summary format "${String(e)}". Use ${c.join(`, `)}.`);if(t!=null&&t!==``&&!(0,i.isMoneyUnit)(t))throw TypeError(`Unsupported kanban summary unit "${String(t)}". Use ${i.MONEY_UNITS.join(`, `)}.`);return e===`currency`?{style:`currency`,unit:t||`rupees`}:e===`compact`?{style:`compact`,currency:`INR`,unit:t||`rupees`}:{style:`number`,decimals:0}}function C(e){let t=0;for(let n of e){if(n==null||n===``)continue;let e=typeof n==`number`?n:Number(n);Number.isFinite(e)&&(t+=e)}return t}var ee=p.failed,w=`[data-wui-column]`,T=`[data-wui-body]`,E=`[data-wui-card]`,D=`[data-wui-count]`,O=`[data-wui-summary]`,k=`[data-wui-empty]`,A=`[data-wui-drop-note]`,j=`[data-wui-live]`,te=`[data-wui-help]`,M=`[data-wui-switch]`,ne=`[data-wui-scroller]`,N=`[data-wui-collapse]`,P=`[data-wui-more]`,F=`data-wui-visible-limit`,I=`data-wui-overflow`,re=`input, select, textarea, [contenteditable=""], [contenteditable="true"], [data-wui-no-drag]`,L=`[data-wui-load-more]`,R=`data-wui-more-url`,z=`data-wui-total`,B=`data-wui-unloaded`,V=48,H=16,U=160,W=e=>e.getAttribute(`data-wui-column`),G=e=>e.getAttribute(`data-wui-card`),K=e=>e instanceof HTMLElement&&!!e.hidden||e.hasAttribute(`hidden`),ie=e=>K(e)||e.hasAttribute(I),q=e=>e instanceof Element?e:null,ae=e=>typeof e==`object`&&e&&`name`in e?e.name:void 0,oe=e=>typeof e==`object`&&e&&`message`in e?e.message:void 0,J=(e,t,n)=>{let r=e.querySelector(t);return r instanceof n?r:null},Y=(e,t,n)=>[...e.querySelectorAll(t)].filter(e=>e instanceof n),X=(e,t,n)=>{let r=e.closest(t);return r instanceof n?r:null},Z=()=>window.WUI??null,Q=(e,t)=>{e&&Z()?.toast(e,{variant:t})},$=class extends r.ElementBase{constructor(){super(),this._wired=!1,this._filter=null,this._expanded=new Set,this._revealed=new Set,this._press=null,this._drag=null,this._kbd=null,this._suppressClick=!1,this._observer=null,this._refreshQueued=!1,this._scrollTimer=0,this._onPointerMove=e=>this._pointerMove(e),this._onPointerUp=e=>this._pointerUp(e),this._onPointerCancel=()=>this._endPointer(!1),this._onDocKeyDown=e=>{e.key===`Escape`&&this._drag&&(e.preventDefault(),this._endPointer(!1))},this._onScroll=()=>{clearTimeout(this._scrollTimer),this._scrollTimer=setTimeout(()=>this._syncSwitcherFromScroll(),80)},this.addEventListener(`pointerdown`,e=>this._pointerDown(e)),this.addEventListener(`keydown`,e=>this._keyDown(e)),this.addEventListener(`click`,e=>this._click(e),!0),this.addEventListener(`scroll`,e=>{e.target instanceof Element&&this._loadOnScroll(e.target)},!0),this.addEventListener(`dragstart`,e=>{q(e.target)?.closest(E)&&e.preventDefault()}),this.addEventListener(`touchmove`,e=>{this._drag&&e.preventDefault()},{passive:!1})}_controlled(){return this.hasAttribute(`controlled`)}connectedCallback(){if(!this._wired){this._wired=!0,this._scroller()?.addEventListener(`scroll`,this._onScroll,{passive:!0}),this._restoreCollapsed();for(let e of this._allCards())this._prepareCard(e);if(typeof MutationObserver==`function`){this._observer=new MutationObserver(e=>{for(let t of e)for(let e of t.addedNodes)e instanceof HTMLElement&&e.matches(E)&&this._prepareCard(e);this._queueRefresh()});for(let e of this.querySelectorAll(T))this._observer.observe(e,{childList:!0})}this.refresh()}}disconnectedCallback(){this._endPointer(!1),this._observer?.disconnect(),this._observer=null,this._scroller()?.removeEventListener(`scroll`,this._onScroll),clearTimeout(this._scrollTimer),this._wired=!1}setFilter(e){if(e!=null&&typeof e!=`function`)throw TypeError(`wui-kanban setFilter: pass a function or null.`);if(this._filter=e,!e)for(let e of this._allCards())e.hidden=!1;this.refresh()}refresh(){if(this._controlled())return;this._refreshQueued=!1;let e=this._summaryFormat();for(let t of this._columns()){let n=W(t),r=g(t.getAttribute(F)),a=[],o=[];for(let e of this._cardsIn(t))this._filter&&(e.hidden=this._filter(e)===!1),K(e)?e.removeAttribute(I):(a.push(e),o.push(e.getAttribute(`data-wui-value`)));let s=this._expanded.has(n),c=_(a.map(G),r,s,this._revealed);for(let e of a)e.toggleAttribute(I,c.has(G(e)));let l=this._unloadedIn(t),u=String(a.length+l);for(let e of this._countsOf(t))e.textContent!==u&&(e.textContent=u);let d=J(t,k,HTMLElement);if(d&&(d.hidden=a.length>0),e){let n=t.querySelector(O);n&&(n.textContent=(0,i.formatValue)(C(o),e))}let f=J(t,P,HTMLElement);if(f){f.hidden=r==null||(s?a.length<=r:c.size===0),f.setAttribute(`aria-expanded`,s?`true`:`false`);let e=s?p.fewer:p.more(c.size);f.textContent!==e&&(f.textContent=e)}let m=J(t,L,HTMLButtonElement);if(m&&(m.hidden=l<=0,!t.hasAttribute(`data-wui-loading`))){m.disabled=!1;let e=p.loadMore(l);m.textContent!==e&&(m.textContent=e)}}}moveCard(e,t,n){let r=this._cardByKey(e);if(!r)throw Error(`wui-kanban moveCard: no card "${String(e)}" on this board.`);if(!this._columnByKey(t))throw Error(`wui-kanban moveCard: no column "${String(t)}" on this board.`);return this._commit(r,t,n)}_columns(){return Y(this,w,HTMLElement)}_columnByKey(e){return this._columns().find(t=>W(t)===e)||null}_columnOf(e){return X(e,w,HTMLElement)}_titleOf(e){return(e.querySelector(`.wui-kanban-title`)?.textContent||W(e)||``).replace(/\s+/g,` `).trim()}_bodyOf(e){return J(e,T,HTMLElement)}_cardsIn(e){let t=this._bodyOf(e);return t?[...t.children].filter(e=>e instanceof HTMLElement&&e.matches(E)):[]}_visibleCardsIn(e){return this._cardsIn(e).filter(e=>!ie(e))}_allCards(){return Y(this,`${T} > ${E}`,HTMLElement)}_cardByKey(e){return this._allCards().find(t=>G(t)===e)||null}_countsOf(e){let t=W(e),n=[...this.querySelectorAll(M)].filter(e=>e.getAttribute(`data-wui-switch`)===t);return[...e.querySelectorAll(D),...n.flatMap(e=>[...e.querySelectorAll(D)])]}_scroller(){return J(this,ne,HTMLElement)}_summaryFormat(){let e=this.getAttribute(`summary-format`);return e?S(e,this.getAttribute(`summary-unit`)):null}_queueRefresh(){this._refreshQueued||(this._refreshQueued=!0,queueMicrotask(()=>{this._refreshQueued&&this.refresh()}))}_prepareCard(e){let t=this.querySelector(te);t?.id&&!e.hasAttribute(`aria-describedby`)&&e.setAttribute(`aria-describedby`,t.id),e.hasAttribute(`tabindex`)||(e.tabIndex=0)}_announce(e){let t=J(this,j,HTMLElement);t&&e&&(t.textContent=``,t.textContent=e)}_fire(e,t,n=!1){return this.dispatchEvent(new CustomEvent(e,{bubbles:!0,cancelable:n,detail:t}))}_canLift(e){let t=v(e),n=this.hasAttribute(`readonly`);return n||e.hasAttribute(`data-wui-locked`)?(this._announce(p.locked(t)),this._fire(`wui:kanban:locked`,{key:G(e),card:e,reason:n?`readonly`:`locked`},!0),!1):e.getAttribute(`aria-busy`)!==`true`||(this._announce(p.busy),Q(p.busy,`info`),!1)}_check(e,t,n){if(t===n)return{ok:!1,source:!0,reason:null};let r=this._columnByKey(t),i=this._columnByKey(n),a=p.refused(r?this._titleOf(r):String(t),i?this._titleOf(i):String(n)),o=i?.getAttribute(`data-accept-from`),s=o?.split(/\s+/).filter(Boolean)??[];if(o!=null&&!s.includes(t))return{ok:!1,reason:a};if(typeof this.accept==`function`){let r=this.accept(e,t,n);if(r===!1)return{ok:!1,reason:a};if(typeof r==`string`&&r)return{ok:!1,reason:r}}return{ok:!0,reason:null}}_markTargets(e,t){let n=v(e),r=new Map;for(let i of this._columns()){let a=W(i),o=this._check(e,t,a);r.set(a,o),i.setAttribute(`data-wui-drop`,o.source?`source`:o.ok?`ok`:`refused`);let s=J(i,A,HTMLElement);s&&!o.source&&(s.textContent=o.ok?p.dropHere(n,this._titleOf(i)):o.reason,s.hidden=!1)}return r}_clearTargets(){for(let e of this._columns()){e.removeAttribute(`data-wui-drop`),e.removeAttribute(`data-wui-over`),e.removeAttribute(`data-wui-target`);let t=J(e,A,HTMLElement);t&&(t.hidden=!0,t.textContent=``)}}async _commit(e,t,n){let r=this._columnOf(e);if(!r)throw Error(`wui-kanban: the card is not inside a column.`);let i=W(r),o=this._columnByKey(t),s=v(e);if(i===t||!this._canLift(e))return!1;let c=this._check(e,i,t);if(!c.ok)return this._announce(c.reason),Q(c.reason,`info`),!1;if(!o)throw Error(`wui-kanban: no column "${String(t)}" on this board.`);let l=this._cardsIn(o),u=Number.isInteger(n)?Math.max(0,Math.min(n??0,l.length)):l.length,d={key:G(e),card:e,from:i,to:t,index:u},f=e.contains(document.activeElement);if(this._controlled())return this._fire(`wui:kanban:move`,d),this._announce(p.moved(s,this._titleOf(o))),f&&this._refocusSoon(d.key),!0;if(!this._fire(`wui:kanban:move`,d,!0))return!1;let m=o.hasAttribute(F)&&!this._revealed.has(d.key);m&&this._revealed.add(d.key);let h={parent:e.parentNode,next:e.nextSibling,column:r,revealed:m},g=this._bodyOf(o);if(!g)throw Error(`wui-kanban: the target column has no body.`);g.insertBefore(e,l[u]||null),f&&this._focusMoved(e),this.refresh();let _=o.getAttribute(`data-wui-step`);if(_)return this._runStep(e,d,h,_,o.getAttribute(`data-wui-step-size`));let y=this.getAttribute(`move-url`);if(!y)return this._announce(p.moved(s,this._titleOf(o))),this._fire(`wui:kanban:moved`,{...d,result:null}),!0;this._lock(e,!0),this._announce(p.saving(s,this._titleOf(o)));let b=new URLSearchParams({card:String(d.key),from:String(i),to:String(t),index:String(u)}),x=await(0,a.wuiFetch)(y,{method:`POST`,body:b});if(this._lock(e,!1),x.kind===`session`)return!1;if(x.ok){let t=this._applyFragment(x.html)||e;return Q(x.message,`success`),this._announce(p.moved(v(t),this._titleOf(o))),this._fire(`wui:kanban:moved`,{...d,card:t,result:x}),!0}return this._rollback(e,h),x.kind!==`aborted`&&Q(x.message||ee[x.kind]||p.failed.server,`danger`),this._fire(`wui:kanban:failed`,{...d,kind:x.kind,status:x.status,message:x.message}),!1}async _runStep(e,t,n,r,i){let o=v(e),s=this._columnByKey(t.to),c=new URLSearchParams({card:String(t.key),from:String(t.from),to:String(t.to)}).toString(),l=r+(r.includes(`?`)?`&`:`?`)+c;this._lock(e,!0);let u;try{let t=window.WUI?.modal?.load;if(typeof t!=`function`)throw Error(`<wui-kanban> data-wui-step needs the Razor script webority-ui.js (WUI.modal.load).`);u=await(await t(l,{trigger:e,size:i||void 0})).closed}catch(r){return this._lock(e,!1),this._rollback(e,n),ae(r)!==`AbortError`&&Q(p.failed.server,`danger`),this._fire(`wui:kanban:failed`,{...t,kind:`step`,status:0,message:oe(r)??null}),!1}if(u?.status!==`success`)return this._lock(e,!1),this._rollback(e,n),this._announce(p.cancelled(o)),this._fire(`wui:kanban:failed`,{...t,kind:`dismissed`,status:0,message:null}),!1;let d=e,f=this.getAttribute(`card-url`);if(f){let n=await(0,a.wuiFetch)(`${f}${f.includes(`?`)?`&`:`?`}${new URLSearchParams({card:String(t.key)})}`);n.ok&&(d=this._applyFragment(n.html)||e)}if(this._lock(d,!1),!s)throw Error(`wui-kanban: no column "${String(t.to)}" on this board.`);return this._announce(p.moved(v(d),this._titleOf(s))),this._fire(`wui:kanban:moved`,{...t,card:d,result:u}),!0}_lock(e,t){t?(e.setAttribute(`aria-busy`,`true`),e.setAttribute(`data-wui-saving`,``)):(e.removeAttribute(`aria-busy`),e.removeAttribute(`data-wui-saving`))}_rollback(e,t){let n=e.contains(document.activeElement),r=t.next&&t.next.parentNode===t.parent?t.next:null;if(t.revealed&&this._revealed.delete(G(e)),!t.parent)throw Error(`wui-kanban: the card had no parent to go back to.`);t.parent.insertBefore(e,r),n&&e.focus(),this.refresh(),this._announce(p.rolledBack(v(e),this._titleOf(t.column)))}_applyFragment(e){if(!e)return null;let t=document.createElement(`template`);t.innerHTML=e;for(let e of t.content.querySelectorAll(`script`))(0,n.devWarn)(`[@webority/ui-elements] A kanban fragment carried a script tag; it was removed, not run.`),e.remove();let r=null;for(let e of Y(t.content,E,HTMLElement)){if(e.closest(`template`))continue;let t=this._cardByKey(G(e));if(!t)continue;let n=t.contains(document.activeElement);t.dispatchEvent(new CustomEvent(`wui:teardown`,{bubbles:!0})),t.hidden&&(e.hidden=!0),t.replaceWith(e),this._prepareCard(e),n&&e.focus(),r??=e}for(let e of Y(t.content,`template[data-wui-kanban-summary]`,HTMLTemplateElement))this._columnByKey(e.getAttribute(`data-wui-kanban-summary`))?.querySelector(O)?.replaceChildren(e.content.cloneNode(!0));return this.refresh(),Z()?.refresh(),r}_refocusSoon(e){let t=()=>{let t=this._cardByKey(e);t&&this._focusMoved(t)};typeof requestAnimationFrame==`function`?requestAnimationFrame(t):setTimeout(t,0)}_focusMoved(e){e.focus({preventScroll:!0}),e.scrollIntoView?.({block:`nearest`})}_pointerDown(e){if(e.button!==0||e.isPrimary===!1||this._drag||this._kbd)return;let t=q(e.target),n=t?X(t,E,HTMLElement):null;if(!n||!this.contains(n)||t?.closest(re))return;let r={card:n,id:e.pointerId,x:e.clientX,y:e.clientY,type:e.pointerType,timer:0};this._press=r,e.pointerType===`touch`&&(r.timer=setTimeout(()=>{this._press===r&&this._startDrag(r,r.x,r.y)},400)),window.addEventListener(`pointermove`,this._onPointerMove),window.addEventListener(`pointerup`,this._onPointerUp),window.addEventListener(`pointercancel`,this._onPointerCancel)}_pointerMove(e){let t=this._press;if(t&&e.pointerId===t.id){if(!this._drag){if(!(Math.hypot(e.clientX-t.x,e.clientY-t.y)>6))return;if(t.type===`touch`){this._endPointer(!1);return}if(this._startDrag(t,e.clientX,e.clientY),!this._drag)return}this._dragTo(e.clientX,e.clientY)}}_pointerUp(e){this._press&&e.pointerId===this._press.id&&this._endPointer(!!this._drag)}_startDrag(e,t,n){let r=e.card;if(!this._canLift(r)){this._endPointer(!1);return}let i=this._columnOf(r);if(!i)throw Error(`wui-kanban: the card is not inside a column.`);let a=W(i),o=r.getBoundingClientRect(),s=r.cloneNode(!0);if(!(s instanceof HTMLElement))return;let c=s;for(let e of[c,...c.querySelectorAll(`[id]`)])e.removeAttribute(`id`);c.removeAttribute(`data-wui-card`),c.removeAttribute(`tabindex`),c.setAttribute(`aria-hidden`,`true`),c.classList.add(`wui-kanban-ghost`),c.style.width=`${o.width}px`,this.appendChild(c),r.setAttribute(`data-wui-dragging`,``),this.setAttribute(`data-wui-dragging`,``),this._drag={card:r,from:a,ghost:c,dx:t-o.left,dy:n-o.top,x:t,y:n,over:null,verdicts:this._markTargets(r,a)},this._announce(p.lifted(v(r),this._titleOf(i))),document.addEventListener(`keydown`,this._onDocKeyDown),this._dragTo(t,n)}_dragTo(e,t){let n=this._drag;if(!n)throw Error(`wui-kanban: no drag in progress.`);n.x=e,n.y=t,n.ghost.style.transform=`translate(${e-n.dx}px, ${t-n.dy}px)`;let r=this._columnAt(e,t);r!==n.over&&(n.over?.removeAttribute(`data-wui-over`),r?.setAttribute(`data-wui-over`,``),n.over=r),this._autoScroll(e,t,r)}_columnAt(e,t){for(let n of this._columns()){let r=n.getBoundingClientRect();if(e>=r.left&&e<=r.right&&t>=r.top&&t<=r.bottom)return n}return null}_indexAt(e,t){let n=this._visibleCardsIn(e).filter(e=>e!==this._drag?.card).find(e=>{let n=e.getBoundingClientRect();return t<n.top+n.height/2}),r=this._cardsIn(e).filter(e=>e!==this._drag?.card);return n?r.indexOf(n):r.length}_autoScroll(e,t,n){let r=this._scroller();if(r){let t=r.getBoundingClientRect();t.width>0&&(e<t.left+V?r.scrollBy?.({left:-16}):e>t.right-V&&r.scrollBy?.({left:H}))}if(n&&this._scrollColumn(n,t))return;let i=window.innerHeight||0;i>0&&(t<V?window.scrollBy?.({top:-16}):t>i-V&&window.scrollBy?.({top:H}))}_scrollColumn(e,t){let n=this._bodyOf(e);if(!n||e.hasAttribute(`data-collapsed`)||n.scrollHeight<=n.clientHeight)return!1;let r=n.getBoundingClientRect();return t<r.top+V&&n.scrollTop>0?(n.scrollBy?.({top:-16}),!0):t>r.bottom-V&&n.scrollTop+n.clientHeight<n.scrollHeight-1&&(n.scrollBy?.({top:H}),!0)}_endPointer(e){let t=this._press,n=this._drag;if(t&&clearTimeout(t.timer||void 0),this._press=null,this._drag=null,window.removeEventListener(`pointermove`,this._onPointerMove),window.removeEventListener(`pointerup`,this._onPointerUp),window.removeEventListener(`pointercancel`,this._onPointerCancel),document.removeEventListener(`keydown`,this._onDocKeyDown),!n)return;n.ghost.remove(),n.card.removeAttribute(`data-wui-dragging`),this.removeAttribute(`data-wui-dragging`),this._suppressClick=!0,setTimeout(()=>{this._suppressClick=!1},0);let r=n.over;if(this._clearTargets(),!e||!r){this._announce(p.cancelled(v(n.card)));return}let i=W(r),a=n.verdicts.get(i);a?.source?this._announce(p.cancelled(v(n.card))):a?.ok?this._commit(n.card,i,this._indexAt(r,n.y)):(this._announce(a?.reason),Q(a?.reason,`info`))}_click(e){let t=q(e.target);if(this._suppressClick&&t?.closest(E)){e.preventDefault(),e.stopPropagation(),this._suppressClick=!1;return}let n=t?.closest(N);if(n&&this.contains(n)){let e=X(n,w,HTMLElement);e&&this._setCollapsed(e,!e.hasAttribute(`data-collapsed`),!0);return}let r=t?.closest(L);if(r&&this.contains(r)){this._controlled()||this._loadMore(X(r,w,HTMLElement));return}let i=t?.closest(P);if(i&&this.contains(i)){this._controlled()||this._toggleMore(X(i,w,HTMLElement));return}let a=t?.closest(M);a&&this.contains(a)&&this._showColumn(a.getAttribute(`data-wui-switch`))}_keyDown(e){let t=this._kbd;if(t){this._liftedKey(e,t);return}let n=e.target instanceof HTMLElement?e.target:null;if(!n?.matches(E)||!this.contains(n))return;let r=this._columnOf(n);switch(e.key){case` `:case`Spacebar`:{if(e.preventDefault(),!this._canLift(n))return;if(!r)throw Error(`wui-kanban: the card is not inside a column.`);let t=W(r),i=this._columns();this._kbd={card:n,from:t,target:i.indexOf(r),verdicts:this._markTargets(n,t)},n.setAttribute(`data-wui-lifted`,``),this.setAttribute(`data-wui-dragging`,``),r.setAttribute(`data-wui-target`,``),this._announce(p.lifted(v(n),this._titleOf(r)));return}case`ArrowDown`:case`ArrowUp`:{if(!r)throw Error(`wui-kanban: the card is not inside a column.`);let t=this._visibleCardsIn(r),i=t[t.indexOf(n)+(e.key===`ArrowDown`?1:-1)];i&&(e.preventDefault(),i.focus());return}case`ArrowLeft`:case`ArrowRight`:{let t=this._columns(),n=e.key===`ArrowRight`?1:-1;for(let i=(r?t.indexOf(r):-1)+n;i>=0&&i<t.length;i+=n){let n=t[i],r=n?this._visibleCardsIn(n)[0]:void 0;if(r&&n&&!n.hasAttribute(`data-collapsed`)){e.preventDefault(),r.focus();return}}return}}}_liftedKey(e,t){let n=this._columns();switch(e.key){case`ArrowLeft`:case`ArrowRight`:{e.preventDefault();let r=t.target+(e.key===`ArrowRight`?1:-1);if(r<0||r>=n.length)return;n[t.target]?.removeAttribute(`data-wui-target`),t.target=r;let i=n[r];if(!i)return;i.setAttribute(`data-wui-target`,``),this._showColumn(W(i),!1);let a=t.verdicts.get(W(i));if(!a)throw Error(`wui-kanban: no verdict for the column.`);let o=this._titleOf(i);this._announce(a.source?p.overSource(o):a.ok?p.over(o,this._cardsIn(i).filter(e=>!K(e)).length):p.overRefused(o,a.reason??``));return}case` `:case`Spacebar`:case`Enter`:{e.preventDefault();let r=n[t.target];if(!r)throw Error(`wui-kanban: the lifted card has no target column.`);let i=W(r),a=t.verdicts.get(i);if(!a)throw Error(`wui-kanban: no verdict for the column.`);if(!a.source&&!a.ok){this._announce(a.reason);return}this._endKeyboard(),a.source?this._announce(p.cancelled(v(t.card))):this._commit(t.card,i);return}case`Escape`:case`Tab`:e.key===`Escape`&&e.preventDefault(),this._endKeyboard(),this._showColumn(t.from,!1),this._announce(p.cancelled(v(t.card)));return}}_endKeyboard(){let e=this._kbd;this._kbd=null,e&&(e.card.removeAttribute(`data-wui-lifted`),this.removeAttribute(`data-wui-dragging`),this._clearTargets())}_restoreCollapsed(){let e=b(this.getAttribute(`board-id`));for(let t of this._columns()){let n=W(t);t.hasAttribute(`data-collapsible`)&&Object.hasOwn(e,String(n))&&this._setCollapsed(t,e[String(n)],!1)}}_setCollapsed(e,t,n){let r=W(e);e.toggleAttribute(`data-collapsed`,t);let i=this._titleOf(e);for(let n of e.querySelectorAll(N))n.setAttribute(`aria-expanded`,t?`false`:`true`),n.setAttribute(`aria-label`,t?p.expand(i):p.collapse(i));n&&(x(this.getAttribute(`board-id`),r,t),this._fire(`wui:kanban:collapse`,{column:r,collapsed:t}))}_toggleMore(e){if(!e)return;let t=W(e);if(this._expanded.delete(t))for(let t of this._cardsIn(e))this._revealed.delete(G(t));else this._expanded.add(t);this.refresh()}_unloadedIn(e){return e.hasAttribute(R)?(e.hasAttribute(B)||e.setAttribute(B,String(Math.max(0,Number(e.getAttribute(z))-this._cardsIn(e).length))),Number(e.getAttribute(B))):0}async _loadMore(e){if(!e)throw Error(`wui-kanban: the load-more button is outside a column.`);let t=Number(e.getAttribute(B));if(e.hasAttribute(`data-wui-loading`)||!(t>0))return;e.setAttribute(`data-wui-loading`,``);let r=J(e,L,HTMLButtonElement);r&&(r.disabled=!0,r.textContent=p.loading);let i=new URL(String(e.getAttribute(R)),document.baseURI);i.searchParams.set(`skip`,String(this._cardsIn(e).length));let o=0,s=!1;try{let n=await(0,a.wuiFetch)(i.toString());if(n.ok){let r=document.createElement(`template`);r.innerHTML=n.html;let i=this._bodyOf(e);for(let e of[...r.content.children])if(e.matches(E)&&!this._cardByKey(G(e))){if(!i)throw Error(`wui-kanban: the column has no body.`);i.append(e),o++}let a=n.response?.headers.get(`Wui-Kanban-Remaining`)??``;e.setAttribute(B,String(/^\d+$/.test(a)?Number(a):Math.max(0,t-o))),s=!0}}catch(e){(0,n.devError)(`[@webority/ui-elements] A kanban column could not load its next cards.`,e)}e.removeAttribute(`data-wui-loading`),this.refresh(),s?this._fire(`wui:kanban:loaded`,{key:W(e),added:o}):Q(p.loadFailed,`danger`)}_loadOnScroll(e){if(this._controlled()||!e.matches(T))return;let t=X(e,w,HTMLElement);t?.hasAttribute(R)&&e.scrollTop+e.clientHeight>=e.scrollHeight-U&&this._loadMore(t)}_isPhone(){return typeof matchMedia==`function`&&matchMedia(`(max-width: 767.98px)`).matches}_showColumn(e,t=!0){for(let t of this.querySelectorAll(M))t.getAttribute(`data-wui-switch`)===e?t.setAttribute(`aria-current`,`true`):t.removeAttribute(`aria-current`);let n=this._columnByKey(e),r=this._scroller();if(!n||!r||!t&&!this._isPhone())return;let i=typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches;r.scrollTo?.({left:n.offsetLeft-r.offsetLeft,behavior:i?`auto`:`smooth`})}_syncSwitcherFromScroll(){let e=this._scroller();if(!e||!this._isPhone())return;let t=e.clientWidth||1,n=this._columns()[Math.round(e.scrollLeft/t)];if(n)for(let e of this.querySelectorAll(M))e.getAttribute(`data-wui-switch`)===W(n)?e.setAttribute(`aria-current`,`true`):e.removeAttribute(`aria-current`)}};(0,t.defineElement)(`wui-kanban`,$),e.KANBAN_DRAG_THRESHOLD_PX=f,e.KANBAN_LONG_PRESS_MS=d,e.KANBAN_PHONE_QUERY=u,e.KANBAN_STORAGE_PREFIX=l,e.KANBAN_SUMMARY_FORMATS=c,e.KANBAN_TEXT=p,e.KANBAN_TONES=s,e.WuiKanban=$,e.kanbanCardLabel=v,e.kanbanOverflow=_,e.kanbanStorageKey=y,e.kanbanSummaryFormat=S,e.kanbanVisibleLimit=g,e.readKanbanCollapsed=b,e.sumKanbanValues=C,e.writeKanbanCollapsed=x})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.devWarn,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.formatters,WeborityUiElementsInternal.modules.wuiHttp);
@@ -1,4 +1,4 @@
1
- (function(e,t,n,r){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var i=globalThis.WeborityUiElementsInternal?.version;if(i!==`0.154.0`)throw Error(`[webority-ui] lead-popup expects ui-elements 0.154.0 but the page loaded `+i+`.`);var a={"--color-primary":`#4F46E5`,"--color-primary-hover":`#4338CA`,"--color-primary-soft":`#E0E7FF`,"--color-primary-text":`#4F46E5`,"--color-on-primary":`#FFFFFF`,"--color-text":`#071437`,"--color-text-muted":`#4B5675`,"--color-border":`#EBEDF3`,"--color-border-strong":`#C4CADA`,"--color-surface":`#FFFFFF`,"--wui-radius-sm":`8px`,"--wui-radius-lg":`14px`,"--wui-shadow-modal":`0px 24px 60px -16px rgba(7, 20, 55, 0.28)`,"--wui-z-modal":`1505`},o=e=>`var(${e}, ${a[e]})`,s=`
1
+ (function(e,t,n,r){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var i=globalThis.WeborityUiElementsInternal?.version;if(i!==`0.155.0`)throw Error(`[webority-ui] lead-popup expects ui-elements 0.155.0 but the page loaded `+i+`.`);var a={"--color-primary":`#4F46E5`,"--color-primary-hover":`#4338CA`,"--color-primary-soft":`#E0E7FF`,"--color-primary-text":`#4F46E5`,"--color-on-primary":`#FFFFFF`,"--color-text":`#071437`,"--color-text-muted":`#4B5675`,"--color-border":`#EBEDF3`,"--color-border-strong":`#C4CADA`,"--color-surface":`#FFFFFF`,"--wui-radius-sm":`8px`,"--wui-radius-lg":`14px`,"--wui-shadow-modal":`0px 24px 60px -16px rgba(7, 20, 55, 0.28)`,"--wui-z-modal":`1505`},o=e=>`var(${e}, ${a[e]})`,s=`
2
2
  :host {
3
3
  all: initial;
4
4
  display: contents;
@@ -1 +1 @@
1
- (function(e,t,n,r,i){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var a=globalThis.WeborityUiElementsInternal?.version;if(a!==`0.154.0`)throw Error(`[webority-ui] lightbox expects ui-elements 0.154.0 but the page loaded `+a+`.`);var o=`a.wui-lightbox-item`,s=1,c=4,l=.5,u=2,d=50,f=6,p=300,m=300;function h(e){return Number.isFinite(e)?Math.min(c,Math.max(s,e)):s}function g(e,t,n,r){let i=(e,n)=>Math.max(0,(e*t-n)/2),a=i(r.width,n.width),o=i(r.height,n.height);return{x:Math.min(a,Math.max(-a,e.x)),y:Math.min(o,Math.max(-o,e.y))}}function _(e,t){return Math.abs(e)<d||Math.abs(e)<Math.abs(t)*1.5?0:e<0?1:-1}function v(e){let t=(String(e??``).split(/[?#]/)[0]??``).split(`/`).filter(Boolean).pop()??``;try{return decodeURIComponent(t)}catch{return t}}function y(e,t,n={}){let r=document.createElement(e);r.className=t;for(let[e,t]of Object.entries(n))r.setAttribute(e,t);return r}function b(e,t,n){let r=y(`button`,`u-action wui-lightbox-btn ${n}`,{type:`button`,"aria-label":t,title:t});return r.style.setProperty(`--wui-action-size`,`40px`),r.innerHTML=(0,i.glyphSvg)(e,{size:20}),r}var x=class extends n.ElementBase{_ui;_index;_zoom;_pan;_pointers;_gesture;_lastTap;_returnTo;_lockedOverflow;_onClick;static get observedAttributes(){return[`open-index`]}constructor(){super(),this._ui=null,this._index=0,this._zoom=s,this._pan={x:0,y:0},this._pointers=new Map,this._gesture=null,this._lastTap=-1/0,this._returnTo=null,this._lockedOverflow=null,this._onClick=e=>{if(e.defaultPrevented||e.button!==0||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey)return;let t=e.target,n=t instanceof Element?t.closest(o):null;if(!(n instanceof HTMLAnchorElement)||!this.contains(n))return;let r=this._links().indexOf(n);r<0||(e.preventDefault(),this.open(r))}}get _view(){if(!this._ui)throw Error(`<wui-lightbox> viewer is not open.`);return this._ui}get download(){return this.hasAttribute(`download`)}set download(e){this.toggleAttribute(`download`,e===!0||e===``||e===`true`)}get label(){return this.getAttribute(`label`)||`Image viewer`}set label(e){this.setAttribute(`label`,String(e??``))}get layout(){return this.getAttribute(`layout`)===`single`?`single`:`gallery`}set layout(e){if(e===`single`)this.setAttribute(`layout`,`single`);else if(e===`gallery`||e===``)this.removeAttribute(`layout`);else throw Error(`<wui-lightbox> layout must be "gallery" or "single", received "${e}".`)}get isOpen(){return this._ui!==null}connectedCallback(){this.addEventListener(`click`,this._onClick),this._syncOpenIndex()}disconnectedCallback(){this.removeEventListener(`click`,this._onClick),this._teardown()}attributeChangedCallback(){this.isConnected&&this._syncOpenIndex()}_syncOpenIndex(){let e=this.getAttribute(`open-index`);e===null?this.close():this.open(Number(e))}_links(){return[...this.querySelectorAll(o)].filter(e=>e instanceof HTMLAnchorElement)}_items(){return this._links().map(e=>{let t=e.getAttribute(`href`)??``;return{link:e,src:t,alt:e.querySelector(`img`)?.getAttribute(`alt`)??``,caption:e.dataset.caption??``,name:e.dataset.name||v(t)}})}open(e=0){let t=this._items();if(!t.length)return!1;if(!this._ui){let t=document.activeElement;this._returnTo=t instanceof HTMLElement||t instanceof SVGElement?t:null,this._build(),this.dispatchEvent(new CustomEvent(`wui-lightbox:open`,{bubbles:!0,detail:{index:e}}))}return this._show(e,t),this._view.close.focus(),!0}close(){if(!this._ui)return;let e=this._index,t=this._links()[e]??this._returnTo;this._teardown(),t?.isConnected&&t.focus(),this._returnTo=null,this.dispatchEvent(new CustomEvent(`wui-lightbox:close`,{bubbles:!0,detail:{index:e}}))}_teardown(){this._ui&&(this._ui.root.remove(),this._ui=null,this._pointers.clear(),this._gesture=null,this._lockedOverflow!==null&&(document.documentElement.style.overflow=this._lockedOverflow,this._lockedOverflow=null))}_build(){let e=y(`div`,`wui-lightbox-overlay`,{role:`dialog`,"aria-modal":`true`,"aria-label":this.label,tabindex:`-1`}),t=y(`div`,`wui-lightbox-bar`),n=y(`span`,`wui-lightbox-count`,{"aria-live":`polite`}),r=y(`div`,`wui-lightbox-tools`),a=b(`zoom-out`,`Zoom out`,`wui-lightbox-zoom-out`),o=b(`zoom-in`,`Zoom in`,`wui-lightbox-zoom-in`),s=y(`a`,`u-action wui-lightbox-btn wui-lightbox-download`,{"aria-label":`Download`,title:`Download`});s.style.setProperty(`--wui-action-size`,`40px`),s.innerHTML=(0,i.glyphSvg)(`download`,{size:20}),s.hidden=!this.download;let c=b(`x`,`Close`,`wui-lightbox-close`);r.append(a,o,s,c),t.append(n,r);let u=y(`div`,`wui-lightbox-stage`),d=b(`chevron-left`,`Previous image`,`wui-lightbox-nav wui-lightbox-prev`),f=b(`chevron-right`,`Next image`,`wui-lightbox-nav wui-lightbox-next`),p=y(`img`,`wui-lightbox-image`,{decoding:`async`,draggable:`false`,alt:``}),m=y(`p`,`wui-lightbox-status`,{role:`status`});u.append(p,m,d,f);let h=y(`p`,`wui-lightbox-caption`);e.append(t,u,h);let g={root:e,count:n,zoomOut:a,zoomIn:o,download:s,close:c,stage:u,prev:d,next:f,image:p,status:m,caption:h};this._ui=g,c.addEventListener(`click`,()=>this.close()),d.addEventListener(`click`,()=>this.step(-1)),f.addEventListener(`click`,()=>this.step(1)),a.addEventListener(`click`,()=>this._setZoom(this._zoom-l)),o.addEventListener(`click`,()=>this._setZoom(this._zoom+l)),e.addEventListener(`keydown`,e=>this._onKeyDown(e)),u.addEventListener(`pointerdown`,e=>this._onPointerDown(e)),u.addEventListener(`pointermove`,e=>this._onPointerMove(e)),u.addEventListener(`pointerup`,e=>this._onPointerEnd(e,!0)),u.addEventListener(`pointercancel`,e=>this._onPointerEnd(e,!1)),u.addEventListener(`wheel`,e=>this._onWheel(e),{passive:!1}),p.addEventListener(`load`,()=>{this._ui===g&&(m.textContent=``,u.removeAttribute(`aria-busy`),p.hidden=!1,this._applyTransform())}),p.addEventListener(`error`,()=>{this._ui===g&&(u.removeAttribute(`aria-busy`),p.hidden=!0,m.textContent=`This image can't be shown.`)}),this.append(e),this._lockedOverflow=document.documentElement.style.overflow,document.documentElement.style.overflow=`hidden`}step(e){if(!this._ui||!e)return;let t=this._items();t.length<2||this._show((this._index+e+t.length)%t.length,t)}_show(e,t){let n=this._view,i=Math.min(t.length-1,Math.max(0,Math.trunc(Number(e))||0)),a=t[i];if(!a)throw Error(`<wui-lightbox> image missing.`);let o=i!==this._index||!n.image.getAttribute(`src`);if(this._index=i,this._zoom=s,this._pan={x:0,y:0},n.count.textContent=`${(0,r.formatNumber)(i+1,{decimals:0})} of ${(0,r.formatNumber)(t.length,{decimals:0})}`,n.caption.textContent=a.caption,n.caption.hidden=!a.caption,n.download.href=a.src,n.download.setAttribute(`download`,a.name),n.prev.hidden=n.next.hidden=t.length<2,n.stage.setAttribute(`aria-busy`,`true`),n.status.textContent=``,n.image.hidden=!1,n.image.alt=a.alt||a.caption,n.image.src=a.src,this._applyTransform(),this._syncZoomButtons(),t.length>1){let e=t[(i+1)%t.length],n=t[(i-1+t.length)%t.length];if(!e||!n)throw Error(`<wui-lightbox> neighbour image missing.`);for(let t of[e,n])new Image().src=t.src}o&&this.dispatchEvent(new CustomEvent(`wui-lightbox:change`,{bubbles:!0,detail:{index:i}}))}_syncZoomButtons(){let e=this._view;e.zoomOut.disabled=this._zoom<=s,e.zoomIn.disabled=this._zoom>=c;let t=document.activeElement;(t===e.zoomOut||t===e.zoomIn)&&t instanceof HTMLButtonElement&&t.disabled&&e.close.focus()}_setZoom(e){this._ui&&(this._zoom=h(e),this._pan=this._clampedPan(this._pan),this._applyTransform(),this._syncZoomButtons())}_clampedPan(e){let{stage:t,image:n}=this._view;return g(e,this._zoom,{width:t.clientWidth,height:t.clientHeight},{width:n.offsetWidth,height:n.offsetHeight})}_applyTransform(){let{image:e,stage:t}=this._view;e.style.transform=`translate(${this._pan.x}px, ${this._pan.y}px) scale(${this._zoom})`,t.classList.toggle(`wui-lightbox-zoomed`,this._zoom>s)}_onKeyDown(e){if(e.key===`Escape`)e.preventDefault(),e.stopPropagation(),this.close();else if(e.key===`Tab`)this._trapTab(e);else if(e.key===`ArrowLeft`||e.key===`ArrowRight`)e.preventDefault(),this.step(e.key===`ArrowRight`?1:-1);else if(e.key===`Home`||e.key===`End`){e.preventDefault();let t=this._items();this._show(e.key===`Home`?0:t.length-1,t)}else e.key===`+`||e.key===`=`?(e.preventDefault(),this._setZoom(this._zoom+l)):e.key===`-`?(e.preventDefault(),this._setZoom(this._zoom-l)):e.key===`0`&&(e.preventDefault(),this._setZoom(s))}_trapTab(e){let t=this._view.root,n=[...t.querySelectorAll(`button, a[href]`)].filter(e=>e instanceof HTMLElement&&!e.hidden&&!(e instanceof HTMLButtonElement&&e.disabled));if(!n.length){e.preventDefault();return}let r=n[0],i=n[n.length-1];if(!r||!i)throw Error(`<wui-lightbox> focus stops missing.`);let a=document.activeElement;e.shiftKey&&(a===r||!t.contains(a))?(e.preventDefault(),i.focus()):e.shiftKey||a!==i&&t.contains(a)||(e.preventDefault(),r.focus())}_onWheel(e){e.preventDefault(),this._setZoom(this._zoom*(e.deltaY<0?1.15:1/1.15))}_onPointerDown(e){let t=e.target;if(t instanceof Element&&t.closest(`.wui-lightbox-nav`))return;let n=this._view;if(n.stage.setPointerCapture?.(e.pointerId),this._pointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),this._pointers.size===2){let e=[...this._pointers.values()],t=e[0],n=e[1];if(!t||!n)throw Error(`<wui-lightbox> pinch needs two pointers.`);this._gesture={kind:`pinch`,distance:Math.hypot(t.x-n.x,t.y-n.y)||1,zoom:this._zoom}}else this._pointers.size===1&&(this._gesture={kind:`drag`,startX:e.clientX,startY:e.clientY,startTime:e.timeStamp,pan:{...this._pan},onImage:e.target===n.image,moved:!1})}_onPointerMove(e){let t=this._gesture;if(t&&this._pointers.has(e.pointerId)){if(this._pointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),t.kind===`pinch`&&this._pointers.size===2){let e=[...this._pointers.values()],n=e[0],r=e[1];if(!n||!r)throw Error(`<wui-lightbox> pinch needs two pointers.`);this._setZoom(t.zoom*Math.hypot(n.x-r.x,n.y-r.y)/t.distance)}else if(t.kind===`drag`){let n=e.clientX-t.startX,r=e.clientY-t.startY;Math.hypot(n,r)>f&&(t.moved=!0),this._zoom>s&&(this._pan=this._clampedPan({x:t.pan.x+n,y:t.pan.y+r}),this._view.stage.classList.add(`is-dragging`),this._applyTransform())}}}_onPointerEnd(e,t){let n=this._gesture;if(this._pointers.delete(e.pointerId),this._ui?.stage.classList.remove(`is-dragging`),!n)return;if(n.kind===`pinch`){this._pointers.size<2&&(this._gesture=null);return}if(this._gesture=null,!t)return;let r=e.clientX-n.startX,i=e.clientY-n.startY;n.moved?this._zoom===s&&this.step(_(r,i)):e.timeStamp-n.startTime>p||(n.onImage?e.timeStamp-this._lastTap<m?(this._lastTap=-1/0,this._setZoom(this._zoom>s?s:u)):this._lastTap=e.timeStamp:this.close())}};(0,t.defineElement)(`wui-lightbox`,x),e.WuiLightbox=x})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.formatters,WeborityUiElementsInternal.modules.iconGlyphs);
1
+ (function(e,t,n,r,i){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var a=globalThis.WeborityUiElementsInternal?.version;if(a!==`0.155.0`)throw Error(`[webority-ui] lightbox expects ui-elements 0.155.0 but the page loaded `+a+`.`);var o=`a.wui-lightbox-item`,s=1,c=4,l=.5,u=2,d=50,f=6,p=300,m=300;function h(e){return Number.isFinite(e)?Math.min(c,Math.max(s,e)):s}function g(e,t,n,r){let i=(e,n)=>Math.max(0,(e*t-n)/2),a=i(r.width,n.width),o=i(r.height,n.height);return{x:Math.min(a,Math.max(-a,e.x)),y:Math.min(o,Math.max(-o,e.y))}}function _(e,t){return Math.abs(e)<d||Math.abs(e)<Math.abs(t)*1.5?0:e<0?1:-1}function v(e){let t=(String(e??``).split(/[?#]/)[0]??``).split(`/`).filter(Boolean).pop()??``;try{return decodeURIComponent(t)}catch{return t}}function y(e,t,n={}){let r=document.createElement(e);r.className=t;for(let[e,t]of Object.entries(n))r.setAttribute(e,t);return r}function b(e,t,n){let r=y(`button`,`u-action wui-lightbox-btn ${n}`,{type:`button`,"aria-label":t,title:t});return r.style.setProperty(`--wui-action-size`,`40px`),r.innerHTML=(0,i.glyphSvg)(e,{size:20}),r}var x=class extends n.ElementBase{_ui;_index;_zoom;_pan;_pointers;_gesture;_lastTap;_returnTo;_lockedOverflow;_onClick;static get observedAttributes(){return[`open-index`]}constructor(){super(),this._ui=null,this._index=0,this._zoom=s,this._pan={x:0,y:0},this._pointers=new Map,this._gesture=null,this._lastTap=-1/0,this._returnTo=null,this._lockedOverflow=null,this._onClick=e=>{if(e.defaultPrevented||e.button!==0||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey)return;let t=e.target,n=t instanceof Element?t.closest(o):null;if(!(n instanceof HTMLAnchorElement)||!this.contains(n))return;let r=this._links().indexOf(n);r<0||(e.preventDefault(),this.open(r))}}get _view(){if(!this._ui)throw Error(`<wui-lightbox> viewer is not open.`);return this._ui}get download(){return this.hasAttribute(`download`)}set download(e){this.toggleAttribute(`download`,e===!0||e===``||e===`true`)}get label(){return this.getAttribute(`label`)||`Image viewer`}set label(e){this.setAttribute(`label`,String(e??``))}get layout(){return this.getAttribute(`layout`)===`single`?`single`:`gallery`}set layout(e){if(e===`single`)this.setAttribute(`layout`,`single`);else if(e===`gallery`||e===``)this.removeAttribute(`layout`);else throw Error(`<wui-lightbox> layout must be "gallery" or "single", received "${e}".`)}get isOpen(){return this._ui!==null}connectedCallback(){this.addEventListener(`click`,this._onClick),this._syncOpenIndex()}disconnectedCallback(){this.removeEventListener(`click`,this._onClick),this._teardown()}attributeChangedCallback(){this.isConnected&&this._syncOpenIndex()}_syncOpenIndex(){let e=this.getAttribute(`open-index`);e===null?this.close():this.open(Number(e))}_links(){return[...this.querySelectorAll(o)].filter(e=>e instanceof HTMLAnchorElement)}_items(){return this._links().map(e=>{let t=e.getAttribute(`href`)??``;return{link:e,src:t,alt:e.querySelector(`img`)?.getAttribute(`alt`)??``,caption:e.dataset.caption??``,name:e.dataset.name||v(t)}})}open(e=0){let t=this._items();if(!t.length)return!1;if(!this._ui){let t=document.activeElement;this._returnTo=t instanceof HTMLElement||t instanceof SVGElement?t:null,this._build(),this.dispatchEvent(new CustomEvent(`wui-lightbox:open`,{bubbles:!0,detail:{index:e}}))}return this._show(e,t),this._view.close.focus(),!0}close(){if(!this._ui)return;let e=this._index,t=this._links()[e]??this._returnTo;this._teardown(),t?.isConnected&&t.focus(),this._returnTo=null,this.dispatchEvent(new CustomEvent(`wui-lightbox:close`,{bubbles:!0,detail:{index:e}}))}_teardown(){this._ui&&(this._ui.root.remove(),this._ui=null,this._pointers.clear(),this._gesture=null,this._lockedOverflow!==null&&(document.documentElement.style.overflow=this._lockedOverflow,this._lockedOverflow=null))}_build(){let e=y(`div`,`wui-lightbox-overlay`,{role:`dialog`,"aria-modal":`true`,"aria-label":this.label,tabindex:`-1`}),t=y(`div`,`wui-lightbox-bar`),n=y(`span`,`wui-lightbox-count`,{"aria-live":`polite`}),r=y(`div`,`wui-lightbox-tools`),a=b(`zoom-out`,`Zoom out`,`wui-lightbox-zoom-out`),o=b(`zoom-in`,`Zoom in`,`wui-lightbox-zoom-in`),s=y(`a`,`u-action wui-lightbox-btn wui-lightbox-download`,{"aria-label":`Download`,title:`Download`});s.style.setProperty(`--wui-action-size`,`40px`),s.innerHTML=(0,i.glyphSvg)(`download`,{size:20}),s.hidden=!this.download;let c=b(`x`,`Close`,`wui-lightbox-close`);r.append(a,o,s,c),t.append(n,r);let u=y(`div`,`wui-lightbox-stage`),d=b(`chevron-left`,`Previous image`,`wui-lightbox-nav wui-lightbox-prev`),f=b(`chevron-right`,`Next image`,`wui-lightbox-nav wui-lightbox-next`),p=y(`img`,`wui-lightbox-image`,{decoding:`async`,draggable:`false`,alt:``}),m=y(`p`,`wui-lightbox-status`,{role:`status`});u.append(p,m,d,f);let h=y(`p`,`wui-lightbox-caption`);e.append(t,u,h);let g={root:e,count:n,zoomOut:a,zoomIn:o,download:s,close:c,stage:u,prev:d,next:f,image:p,status:m,caption:h};this._ui=g,c.addEventListener(`click`,()=>this.close()),d.addEventListener(`click`,()=>this.step(-1)),f.addEventListener(`click`,()=>this.step(1)),a.addEventListener(`click`,()=>this._setZoom(this._zoom-l)),o.addEventListener(`click`,()=>this._setZoom(this._zoom+l)),e.addEventListener(`keydown`,e=>this._onKeyDown(e)),u.addEventListener(`pointerdown`,e=>this._onPointerDown(e)),u.addEventListener(`pointermove`,e=>this._onPointerMove(e)),u.addEventListener(`pointerup`,e=>this._onPointerEnd(e,!0)),u.addEventListener(`pointercancel`,e=>this._onPointerEnd(e,!1)),u.addEventListener(`wheel`,e=>this._onWheel(e),{passive:!1}),p.addEventListener(`load`,()=>{this._ui===g&&(m.textContent=``,u.removeAttribute(`aria-busy`),p.hidden=!1,this._applyTransform())}),p.addEventListener(`error`,()=>{this._ui===g&&(u.removeAttribute(`aria-busy`),p.hidden=!0,m.textContent=`This image can't be shown.`)}),this.append(e),this._lockedOverflow=document.documentElement.style.overflow,document.documentElement.style.overflow=`hidden`}step(e){if(!this._ui||!e)return;let t=this._items();t.length<2||this._show((this._index+e+t.length)%t.length,t)}_show(e,t){let n=this._view,i=Math.min(t.length-1,Math.max(0,Math.trunc(Number(e))||0)),a=t[i];if(!a)throw Error(`<wui-lightbox> image missing.`);let o=i!==this._index||!n.image.getAttribute(`src`);if(this._index=i,this._zoom=s,this._pan={x:0,y:0},n.count.textContent=`${(0,r.formatNumber)(i+1,{decimals:0})} of ${(0,r.formatNumber)(t.length,{decimals:0})}`,n.caption.textContent=a.caption,n.caption.hidden=!a.caption,n.download.href=a.src,n.download.setAttribute(`download`,a.name),n.prev.hidden=n.next.hidden=t.length<2,n.stage.setAttribute(`aria-busy`,`true`),n.status.textContent=``,n.image.hidden=!1,n.image.alt=a.alt||a.caption,n.image.src=a.src,this._applyTransform(),this._syncZoomButtons(),t.length>1){let e=t[(i+1)%t.length],n=t[(i-1+t.length)%t.length];if(!e||!n)throw Error(`<wui-lightbox> neighbour image missing.`);for(let t of[e,n])new Image().src=t.src}o&&this.dispatchEvent(new CustomEvent(`wui-lightbox:change`,{bubbles:!0,detail:{index:i}}))}_syncZoomButtons(){let e=this._view;e.zoomOut.disabled=this._zoom<=s,e.zoomIn.disabled=this._zoom>=c;let t=document.activeElement;(t===e.zoomOut||t===e.zoomIn)&&t instanceof HTMLButtonElement&&t.disabled&&e.close.focus()}_setZoom(e){this._ui&&(this._zoom=h(e),this._pan=this._clampedPan(this._pan),this._applyTransform(),this._syncZoomButtons())}_clampedPan(e){let{stage:t,image:n}=this._view;return g(e,this._zoom,{width:t.clientWidth,height:t.clientHeight},{width:n.offsetWidth,height:n.offsetHeight})}_applyTransform(){let{image:e,stage:t}=this._view;e.style.transform=`translate(${this._pan.x}px, ${this._pan.y}px) scale(${this._zoom})`,t.classList.toggle(`wui-lightbox-zoomed`,this._zoom>s)}_onKeyDown(e){if(e.key===`Escape`)e.preventDefault(),e.stopPropagation(),this.close();else if(e.key===`Tab`)this._trapTab(e);else if(e.key===`ArrowLeft`||e.key===`ArrowRight`)e.preventDefault(),this.step(e.key===`ArrowRight`?1:-1);else if(e.key===`Home`||e.key===`End`){e.preventDefault();let t=this._items();this._show(e.key===`Home`?0:t.length-1,t)}else e.key===`+`||e.key===`=`?(e.preventDefault(),this._setZoom(this._zoom+l)):e.key===`-`?(e.preventDefault(),this._setZoom(this._zoom-l)):e.key===`0`&&(e.preventDefault(),this._setZoom(s))}_trapTab(e){let t=this._view.root,n=[...t.querySelectorAll(`button, a[href]`)].filter(e=>e instanceof HTMLElement&&!e.hidden&&!(e instanceof HTMLButtonElement&&e.disabled));if(!n.length){e.preventDefault();return}let r=n[0],i=n[n.length-1];if(!r||!i)throw Error(`<wui-lightbox> focus stops missing.`);let a=document.activeElement;e.shiftKey&&(a===r||!t.contains(a))?(e.preventDefault(),i.focus()):e.shiftKey||a!==i&&t.contains(a)||(e.preventDefault(),r.focus())}_onWheel(e){e.preventDefault(),this._setZoom(this._zoom*(e.deltaY<0?1.15:1/1.15))}_onPointerDown(e){let t=e.target;if(t instanceof Element&&t.closest(`.wui-lightbox-nav`))return;let n=this._view;if(n.stage.setPointerCapture?.(e.pointerId),this._pointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),this._pointers.size===2){let e=[...this._pointers.values()],t=e[0],n=e[1];if(!t||!n)throw Error(`<wui-lightbox> pinch needs two pointers.`);this._gesture={kind:`pinch`,distance:Math.hypot(t.x-n.x,t.y-n.y)||1,zoom:this._zoom}}else this._pointers.size===1&&(this._gesture={kind:`drag`,startX:e.clientX,startY:e.clientY,startTime:e.timeStamp,pan:{...this._pan},onImage:e.target===n.image,moved:!1})}_onPointerMove(e){let t=this._gesture;if(t&&this._pointers.has(e.pointerId)){if(this._pointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),t.kind===`pinch`&&this._pointers.size===2){let e=[...this._pointers.values()],n=e[0],r=e[1];if(!n||!r)throw Error(`<wui-lightbox> pinch needs two pointers.`);this._setZoom(t.zoom*Math.hypot(n.x-r.x,n.y-r.y)/t.distance)}else if(t.kind===`drag`){let n=e.clientX-t.startX,r=e.clientY-t.startY;Math.hypot(n,r)>f&&(t.moved=!0),this._zoom>s&&(this._pan=this._clampedPan({x:t.pan.x+n,y:t.pan.y+r}),this._view.stage.classList.add(`is-dragging`),this._applyTransform())}}}_onPointerEnd(e,t){let n=this._gesture;if(this._pointers.delete(e.pointerId),this._ui?.stage.classList.remove(`is-dragging`),!n)return;if(n.kind===`pinch`){this._pointers.size<2&&(this._gesture=null);return}if(this._gesture=null,!t)return;let r=e.clientX-n.startX,i=e.clientY-n.startY;n.moved?this._zoom===s&&this.step(_(r,i)):e.timeStamp-n.startTime>p||(n.onImage?e.timeStamp-this._lastTap<m?(this._lastTap=-1/0,this._setZoom(this._zoom>s?s:u)):this._lastTap=e.timeStamp:this.close())}};(0,t.defineElement)(`wui-lightbox`,x),e.WuiLightbox=x})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.formatters,WeborityUiElementsInternal.modules.iconGlyphs);
@@ -1,4 +1,4 @@
1
- (function(e,t,n){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var r=globalThis.WeborityUiElementsInternal?.version;if(r!==`0.154.0`)throw Error(`[webority-ui] markdown expects ui-elements 0.154.0 but the page loaded `+r+`.`);var i=/\[([^[\]\n]+)\](?!\()/g,a=new Set(`!"#$%&'()*+,-./:;<=>?@[\\]^_\`{|}~`),o=/\[([^\]\n]+)\]\(((?:[^()\s]|\([^()\s]*\))+)\)/y,s=/!\[([^\]\n]*)\]\(((?:[^()\s]|\([^()\s]*\))+)\)/y,c=new RegExp(i.source,`y`),l=e=>/[\p{L}\p{N}]/u.test(e);function u(e,t){let n=0;for(let r=t-1;r>=0&&e.charAt(r)===`\\`;--r)n+=1;return n%2==1}function d(e,t,n){let r=n.length===1;for(let i=e.indexOf(n,t);i!==-1;i=e.indexOf(n,i+1)){let a=i>t&&!/\s/.test(e.charAt(t))&&!/\s/.test(e.charAt(i-1)),o=r&&(e.charAt(i+1)===n||e.charAt(i-1)===n),s=n===`_`&&l(e.charAt(i+n.length));if(a&&!o&&!s&&!u(e,i))return i}return-1}function f(e,t){let n=t?.isCitation,r=[],i=``,u=()=>{i&&=(r.push({type:`text`,text:i}),``)},p=0;for(;p<e.length;){let m=e.charAt(p),h=e.charAt(p+1);if(m===`\\`&&a.has(h)){i+=h,p+=2;continue}if(m==="`"){let t=e.indexOf("`",p+1);if(t>p+1){u(),r.push({type:`code`,text:e.slice(p+1,t)}),p=t+1;continue}}let g=m+h;if(g===`**`||g===`__`||g===`~~`){let n=d(e,p+2,g);if(n!==-1&&!(g===`__`&&l(e.charAt(p-1)))){u();let i=f(e.slice(p+2,n),t);g===`~~`?r.push({type:`strike`,children:i}):r.push({type:`strong`,children:i}),p=n+2;continue}i+=g,p+=2}else{if(m===`*`||m===`_`){let n=d(e,p+1,m);if(n!==-1&&!(m===`_`&&l(e.charAt(p-1)))){u(),r.push({type:`em`,children:f(e.slice(p+1,n),t)}),p=n+1;continue}}if(m===`[`){o.lastIndex=p;let t=o.exec(e);if(t){let e=t[1],n=t[2];if(e===void 0||n===void 0)throw Error(`The link pattern always captures its label and href`);u(),r.push({type:`link`,href:n,children:f(e)}),p+=t[0].length;continue}if(n){c.lastIndex=p;let t=c.exec(e);if(t){let e=t[1];if(e===void 0)throw Error(`The citation pattern always captures its inner text`);if(n(e)){u(),r.push({type:`citation`,text:e}),p+=t[0].length;continue}}}}if(m===`!`){s.lastIndex=p;let t=s.exec(e);if(t){let e=t[1];if(e===void 0)throw Error(`The image pattern always captures its alt text`);u(),r.push({type:`image`,children:f(e)}),p+=t[0].length;continue}}i+=m,p+=1}}return u(),r.map((e,t)=>({...e,key:t}))}var p=/^[a-z][a-z0-9+.-]*:[a-z0-9_-]+\/[a-z0-9_.~-]+$/i,m=/^https?:/i,h=/^(mailto|tel):/i,g=/^(?:\/(?![/\\])|#|\?|\.{1,2}\/)/,_=/^https:\/\/[^/?#@\\\s]+$/i,v=/^[a-z][a-z0-9+.-]*:/i;function y(e){if(typeof e!=`string`)return null;let t=e.endsWith(`/`)?e.slice(0,-1):e;return _.test(t)?t:null}function ee(e,t,n,r,i){if(n&&(t===`page`||p.test(e))){let t=n(e);if(t!=null)return{kind:`app`,target:t}}if(t===`app`)return null;let a=i==null?null:y(i),o=a===null?e:te(e,a);return o===null?null:g.test(o)?{kind:`page`,href:o}:t===`page`&&!(m.test(o)&&r&&x(o,r))?null:m.test(o)?{kind:r&&x(o,r)?`page`:`web`,href:o}:h.test(o)?{kind:`contact`,href:o}:null}function te(e,t){if(v.test(e))return e;if(e.startsWith(`//`))return`https:${e}`;if(e===``)return null;let n=e.indexOf(`#`),r=n<0?``:e.slice(n),i=n<0?e:e.slice(0,n),a=i.indexOf(`?`),o=a<0?i:i.slice(0,a),s=a<0?``:i.slice(a);return o===``?`${t}${s}${r}`:`${t}${b(o.startsWith(`/`)?o:`/${o}`)}${s}${r}`}function b(e){let t=e.split(`/`),n=[];return t.forEach((e,r)=>{let i=r===t.length-1;e===`.`?i&&n.push(``):e===`..`?(n.length>1&&n.pop(),i&&n.push(``)):n.push(e)}),n.join(`/`)}function x(e,t){if(e.slice(0,t.length).toLowerCase()!==t.toLowerCase())return!1;let n=e[t.length];return n===void 0||n===`/`||n===`?`||n===`#`}function S(e){return typeof e!=`string`||!e.startsWith(`/`)||e[1]===`/`||e[1]===`\\`?null:e}var C=/^\s*```/,w=/^\s*```\s*(\S*)/,T=/^\s{0,3}(#{1,6})\s+(.*?)(?:\s+#+)?\s*$/,E=/^\s*([-*_])(\s*\1){2,}\s*$/,D=/^(\s*)[-*+]\s+(.*)$/,O=/^(\s*)(\d{1,9})[.)]\s+(.*)$/,k=/^\s*>\s?(.*)$/,ne=/^\s*\|?\s*:?-{3,}:?\s*(\|\s*:?-{3,}:?\s*)*\|?\s*$/,A=[1,2,3,4,5,6],j=e=>e.includes(`|`);function M(e){let t=e.trim();return t.startsWith(`|`)&&(t=t.slice(1)),t.endsWith(`|`)&&(t=t.slice(0,-1)),t.split(`|`).map(e=>e.trim())}function N(e,t){let n=e[t];if(n===void 0)throw Error(`startsTable was called past the last source line`);let r=e[t+1];return r!==void 0&&j(n)&&r.includes(`|`)&&ne.test(r)}function P(e,t){let n=e[t];if(n===void 0)throw Error(`startsBlock was called past the last source line`);return C.test(n)||k.test(n)||D.test(n)||O.test(n)||T.test(n)||E.test(n)||N(e,t)}function F(e){let t=e.replace(/\t/g,` `).length;return Math.min(Math.floor(t/2),4)}function I(e){let t=O.exec(e);if(t){let e=t[1],n=t[2],r=t[3];if(e===void 0||n===void 0||r===void 0)throw Error(`The ordered list pattern always captures its indent, number and text`);return{text:r,depth:F(e),ordered:!0,number:Number(n)}}let n=D.exec(e);if(n){let e=n[1],t=n[2];if(e===void 0||t===void 0)throw Error(`The bullet list pattern always captures its indent and text`);return{text:t,depth:F(e),ordered:!1,number:0}}return null}function L(e){let t=(e??``).replace(/\r\n?/g,`
1
+ (function(e,t,n){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var r=globalThis.WeborityUiElementsInternal?.version;if(r!==`0.155.0`)throw Error(`[webority-ui] markdown expects ui-elements 0.155.0 but the page loaded `+r+`.`);var i=/\[([^[\]\n]+)\](?!\()/g,a=new Set(`!"#$%&'()*+,-./:;<=>?@[\\]^_\`{|}~`),o=/\[([^\]\n]+)\]\(((?:[^()\s]|\([^()\s]*\))+)\)/y,s=/!\[([^\]\n]*)\]\(((?:[^()\s]|\([^()\s]*\))+)\)/y,c=new RegExp(i.source,`y`),l=e=>/[\p{L}\p{N}]/u.test(e);function u(e,t){let n=0;for(let r=t-1;r>=0&&e.charAt(r)===`\\`;--r)n+=1;return n%2==1}function d(e,t,n){let r=n.length===1;for(let i=e.indexOf(n,t);i!==-1;i=e.indexOf(n,i+1)){let a=i>t&&!/\s/.test(e.charAt(t))&&!/\s/.test(e.charAt(i-1)),o=r&&(e.charAt(i+1)===n||e.charAt(i-1)===n),s=n===`_`&&l(e.charAt(i+n.length));if(a&&!o&&!s&&!u(e,i))return i}return-1}function f(e,t){let n=t?.isCitation,r=[],i=``,u=()=>{i&&=(r.push({type:`text`,text:i}),``)},p=0;for(;p<e.length;){let m=e.charAt(p),h=e.charAt(p+1);if(m===`\\`&&a.has(h)){i+=h,p+=2;continue}if(m==="`"){let t=e.indexOf("`",p+1);if(t>p+1){u(),r.push({type:`code`,text:e.slice(p+1,t)}),p=t+1;continue}}let g=m+h;if(g===`**`||g===`__`||g===`~~`){let n=d(e,p+2,g);if(n!==-1&&!(g===`__`&&l(e.charAt(p-1)))){u();let i=f(e.slice(p+2,n),t);g===`~~`?r.push({type:`strike`,children:i}):r.push({type:`strong`,children:i}),p=n+2;continue}i+=g,p+=2}else{if(m===`*`||m===`_`){let n=d(e,p+1,m);if(n!==-1&&!(m===`_`&&l(e.charAt(p-1)))){u(),r.push({type:`em`,children:f(e.slice(p+1,n),t)}),p=n+1;continue}}if(m===`[`){o.lastIndex=p;let t=o.exec(e);if(t){let e=t[1],n=t[2];if(e===void 0||n===void 0)throw Error(`The link pattern always captures its label and href`);u(),r.push({type:`link`,href:n,children:f(e)}),p+=t[0].length;continue}if(n){c.lastIndex=p;let t=c.exec(e);if(t){let e=t[1];if(e===void 0)throw Error(`The citation pattern always captures its inner text`);if(n(e)){u(),r.push({type:`citation`,text:e}),p+=t[0].length;continue}}}}if(m===`!`){s.lastIndex=p;let t=s.exec(e);if(t){let e=t[1];if(e===void 0)throw Error(`The image pattern always captures its alt text`);u(),r.push({type:`image`,children:f(e)}),p+=t[0].length;continue}}i+=m,p+=1}}return u(),r.map((e,t)=>({...e,key:t}))}var p=/^[a-z][a-z0-9+.-]*:[a-z0-9_-]+\/[a-z0-9_.~-]+$/i,m=/^https?:/i,h=/^(mailto|tel):/i,g=/^(?:\/(?![/\\])|#|\?|\.{1,2}\/)/,_=/^https:\/\/[^/?#@\\\s]+$/i,v=/^[a-z][a-z0-9+.-]*:/i;function y(e){if(typeof e!=`string`)return null;let t=e.endsWith(`/`)?e.slice(0,-1):e;return _.test(t)?t:null}function ee(e,t,n,r,i){if(n&&(t===`page`||p.test(e))){let t=n(e);if(t!=null)return{kind:`app`,target:t}}if(t===`app`)return null;let a=i==null?null:y(i),o=a===null?e:te(e,a);return o===null?null:g.test(o)?{kind:`page`,href:o}:t===`page`&&!(m.test(o)&&r&&x(o,r))?null:m.test(o)?{kind:r&&x(o,r)?`page`:`web`,href:o}:h.test(o)?{kind:`contact`,href:o}:null}function te(e,t){if(v.test(e))return e;if(e.startsWith(`//`))return`https:${e}`;if(e===``)return null;let n=e.indexOf(`#`),r=n<0?``:e.slice(n),i=n<0?e:e.slice(0,n),a=i.indexOf(`?`),o=a<0?i:i.slice(0,a),s=a<0?``:i.slice(a);return o===``?`${t}${s}${r}`:`${t}${b(o.startsWith(`/`)?o:`/${o}`)}${s}${r}`}function b(e){let t=e.split(`/`),n=[];return t.forEach((e,r)=>{let i=r===t.length-1;e===`.`?i&&n.push(``):e===`..`?(n.length>1&&n.pop(),i&&n.push(``)):n.push(e)}),n.join(`/`)}function x(e,t){if(e.slice(0,t.length).toLowerCase()!==t.toLowerCase())return!1;let n=e[t.length];return n===void 0||n===`/`||n===`?`||n===`#`}function S(e){return typeof e!=`string`||!e.startsWith(`/`)||e[1]===`/`||e[1]===`\\`?null:e}var C=/^\s*```/,w=/^\s*```\s*(\S*)/,T=/^\s{0,3}(#{1,6})\s+(.*?)(?:\s+#+)?\s*$/,E=/^\s*([-*_])(\s*\1){2,}\s*$/,D=/^(\s*)[-*+]\s+(.*)$/,O=/^(\s*)(\d{1,9})[.)]\s+(.*)$/,k=/^\s*>\s?(.*)$/,ne=/^\s*\|?\s*:?-{3,}:?\s*(\|\s*:?-{3,}:?\s*)*\|?\s*$/,A=[1,2,3,4,5,6],j=e=>e.includes(`|`);function M(e){let t=e.trim();return t.startsWith(`|`)&&(t=t.slice(1)),t.endsWith(`|`)&&(t=t.slice(0,-1)),t.split(`|`).map(e=>e.trim())}function N(e,t){let n=e[t];if(n===void 0)throw Error(`startsTable was called past the last source line`);let r=e[t+1];return r!==void 0&&j(n)&&r.includes(`|`)&&ne.test(r)}function P(e,t){let n=e[t];if(n===void 0)throw Error(`startsBlock was called past the last source line`);return C.test(n)||k.test(n)||D.test(n)||O.test(n)||T.test(n)||E.test(n)||N(e,t)}function F(e){let t=e.replace(/\t/g,` `).length;return Math.min(Math.floor(t/2),4)}function I(e){let t=O.exec(e);if(t){let e=t[1],n=t[2],r=t[3];if(e===void 0||n===void 0||r===void 0)throw Error(`The ordered list pattern always captures its indent, number and text`);return{text:r,depth:F(e),ordered:!0,number:Number(n)}}let n=D.exec(e);if(n){let e=n[1],t=n[2];if(e===void 0||t===void 0)throw Error(`The bullet list pattern always captures its indent and text`);return{text:t,depth:F(e),ordered:!1,number:0}}return null}function L(e){let t=(e??``).replace(/\r\n?/g,`
2
2
  `).split(`
3
3
  `),n=[],r=0;for(;r<t.length;){let e=t[r];if(e===void 0)throw Error(`parseMarkdown read past the last source line`);if(!e.trim()){r+=1;continue}if(C.test(e)){let i=w.exec(e)?.[1]||null,a=[];for(r+=1;r<t.length;){let e=t[r];if(e===void 0)throw Error(`parseMarkdown read past the last source line`);if(C.test(e))break;a.push(e),r+=1}r+=1,n.push({type:`code`,text:a.join(`
4
4
  `),language:i});continue}if(N(t,r)){let i=M(e),a=[];for(r+=2;r<t.length;){let e=t[r];if(e===void 0)throw Error(`parseMarkdown read past the last source line`);if(!e.trim()||!j(e))break;a.push(M(e)),r+=1}n.push({type:`table`,header:i,rows:a});continue}if(E.test(e)){n.push({type:`rule`}),r+=1;continue}let i=T.exec(e);if(i){let e=i[1],t=i[2];if(e===void 0||t===void 0)throw Error(`The heading pattern always captures its hashes and text`);let a=A[e.length-1];if(a===void 0)throw Error(`The heading pattern always captures one to six hashes`);n.push({type:`heading`,level:a,text:t}),r+=1;continue}if(k.test(e)){let e=[];for(;r<t.length;){let n=t[r];if(n===void 0)throw Error(`parseMarkdown read past the last source line`);let i=k.exec(n);if(!i)break;let a=i[1];if(a===void 0)throw Error(`The quote pattern always captures its text`);e.push(a),r+=1}n.push({type:`quote`,lines:e});continue}let a=I(e);if(a){let e=[];for(;r<t.length;){let n=t[r];if(n===void 0)throw Error(`parseMarkdown read past the last source line`);if(!n.trim())break;let i=I(n);if(i){if(i.depth===0&&i.ordered!==a.ordered)break;e.push(i)}else if(P(t,r))break;else{let t=e[e.length-1];if(t===void 0)throw Error(`A list continuation line follows a list with no item`);t.text+=` ${n.trim()}`}r+=1}n.push({type:`list`,ordered:a.ordered,start:a.ordered?a.number:1,items:e});continue}let o=[e];for(r+=1;r<t.length;){let e=t[r];if(e===void 0)throw Error(`parseMarkdown read past the last source line`);if(!e.trim()||P(t,r))break;o.push(e),r+=1}n.push({type:`paragraph`,lines:o})}return n.map((e,t)=>({...e,key:t}))}var R=[`text`,`json`,`js`,`cs`,`sql`,`bash`,`http`,`html`,`css`],z=[`app`,`web`,`page`],B=e=>e!==void 0&&z.includes(e);function V(e,t,n,r,i=null){let a=H(e.ownerDocument,n,r).map((e,n)=>{let r=t[n],i=r?.sig===e.sig?r.nodes:null;return{sig:e.sig,nodes:i??e.build()}}),o=new Set(a.flatMap(e=>e.nodes));for(let e of t)for(let t of e.nodes)o.has(t)||t.parentNode?.removeChild(t);let s=i;for(let t of a.flatMap(e=>e.nodes))(t.parentNode!==e||t.previousSibling!==s)&&e.insertBefore(t,s?s.nextSibling:e.firstChild),s=t;return a}function H(e,t,n){let r={doc:e,links:B(n.links)?n.links:`web`,headings:n.headings===`text`?`text`:`outline`,resolveLink:n.resolveLink,isCitation:n.isCitation,figureText:typeof n.figureText==`function`?n.figureText:void 0,base:typeof n.base==`string`?n.base:void 0},i=n.resolverGeneration??0;return L(t).map(e=>({sig:`${JSON.stringify(e)}|${r.links}|${r.headings}|${r.base??``}|${i}`,build:()=>G(r,e)}))}var U=class extends n.ElementBase{_drawn;_blocks;_observer;_connected;_resolveLink;_isCitation;_resolverGeneration;_figureText;static get observedAttributes(){return[`links`,`headings`,`base`]}constructor(){super(),this._drawn=[],this._blocks=[],this._observer=null,this._connected=!1,this._resolveLink=void 0,this._isCitation=void 0,this._resolverGeneration=0,this._figureText=void 0}connectedCallback(){this._connected=!0,this._render(),typeof MutationObserver<`u`&&(this._observer=new MutationObserver(e=>{e.some(e=>!this._drawn.some(t=>t.contains(e.target)))&&this._render()}),this._observer.observe(this,{childList:!0,subtree:!0,characterData:!0}))}disconnectedCallback(){this._connected=!1,this._observer?.disconnect(),this._observer=null}get resolveLink(){return this._resolveLink}set resolveLink(e){this._resolveLink=typeof e==`function`?e:void 0,this._resolverGeneration+=1,this._connected&&this._render()}get base(){return this.getAttribute(`base`)??void 0}set base(e){e==null?this.removeAttribute(`base`):this.setAttribute(`base`,String(e))}get isCitation(){return this._isCitation}set isCitation(e){this._isCitation=typeof e==`function`?e:void 0,this._resolverGeneration+=1,this._connected&&this._render()}get figureText(){return this._figureText}set figureText(e){this._figureText=typeof e==`function`?e:void 0,this._resolverGeneration+=1,this._connected&&this._render()}attributeChangedCallback(e,t,n){t!==n&&this._connected&&this._render()}_source(){return Array.from(this.children).find(e=>e instanceof HTMLPreElement&&e.classList.contains(`wui-markdown-source`))}_render(){let e=this._source();e&&(this._blocks=V(this,this._blocks,e.textContent??``,{links:this.getAttribute(`links`)??void 0,headings:this.getAttribute(`headings`)??void 0,base:this.getAttribute(`base`)??void 0,resolveLink:this._resolveLink,isCitation:this._isCitation,figureText:this._figureText,resolverGeneration:this._resolverGeneration},e),this._drawn=this._blocks.flatMap(e=>e.nodes),e.hidden=!0,this._observer?.takeRecords())}};function W(e,t,n=[]){let r=e.createElement(t);return r.append(...n),r}function G(e,t){switch(t.type){case`paragraph`:return[W(e.doc,`p`,K(e,t.lines))];case`heading`:return[q(e,t)];case`list`:return J(e,t.items);case`table`:return[X(e,t)];case`code`:return[re(e.doc,t)];case`quote`:return[W(e.doc,`blockquote`,K(e,t.lines))];case`rule`:return[e.doc.createElement(`hr`)];default:return[]}}function K(e,t){let n=[];return t.forEach((t,r)=>{r>0&&n.push(e.doc.createElement(`br`)),n.push(...Z(e,t))}),n}function q(e,t){let n=Z(e,t.text);if(e.headings===`text`){let t=W(e.doc,`p`,n);return t.className=`fw-semibold`,t}return W(e.doc,`h2`,n)}function J(e,t){let n=[];for(let r=0;r<t.length;){let i=Y(e,t,r);n.push(i.list),r=i.next}return n}function Y(e,t,n){let r=t[n];if(!r)throw Error(`List run starts past its items.`);let{depth:i,ordered:a,number:o}=r,s=e.doc.createElement(a?`ol`:`ul`);a&&o!==1&&s.setAttribute(`start`,String(o));let c=null,l=n,u=t[l];for(;u&&u.depth>=i;){if(u.depth===i)c=W(e.doc,`li`,Z(e,u.text)),s.append(c),l+=1;else{let n=Y(e,t,l);if(!c)throw Error(`Nested list has no item before it.`);c.append(n.list),l=n.next}u=t[l]}return{list:s,next:l}}function X(e,t){let n=t.header.map(t=>{let n=W(e.doc,`th`,Z(e,t));return n.setAttribute(`scope`,`col`),n}),r=t.rows.map(n=>W(e.doc,`tr`,t.header.map((t,r)=>W(e.doc,`td`,Z(e,n[r]??``))))),i=W(e.doc,`table`,[W(e.doc,`thead`,[W(e.doc,`tr`,n)]),W(e.doc,`tbody`,r)]);i.className=`table`;let a=W(e.doc,`div`,[i]);return a.className=`table-responsive`,a}function re(e,t){let n=W(e,`pre`,[W(e,`code`,[e.createTextNode(t.text)])]);n.className=`wui-code-source`;let r=W(e,`wui-code-block`,[n]);return r.className=`wui-code-block`,r.setAttribute(`language`,t.language!==null&&R.includes(t.language)?t.language:`text`),r}function Z(e,t){return Q(e,f(t,{isCitation:e.isCitation}))}function Q(e,t){return t.flatMap(t=>ie(e,t))}function ie(e,t){let{doc:n}=e;switch(t.type){case`code`:return[W(n,`code`,[n.createTextNode(t.text)])];case`strong`:return[W(n,`strong`,Q(e,t.children))];case`em`:return[W(n,`em`,Q(e,t.children))];case`strike`:return[W(n,`del`,Q(e,t.children))];case`image`:return[n.createTextNode(`[`),...Q(e,t.children),n.createTextNode(`]`)];case`link`:return ae(e,t);case`citation`:return[se(n,t.text)];case`text`:return e.figureText?oe(e,e.figureText,t.text):[n.createTextNode(t.text)];default:throw Error(`wui-markdown: unknown inline token ${JSON.stringify(t)}`)}}function ae(e,t){let n=Q(e,t.children),r=ee(t.href,e.links,e.resolveLink,globalThis.location?.origin,e.base);if(!r)return n;if(r.kind===`app`){let t=S(r.target);return t?[$(e.doc,t,n,!1)]:n}return[$(e.doc,r.href,n,r.kind===`web`)]}function oe(e,t,n){return t(n).map(t=>t.kind===`sub`||t.kind===`sup`?W(e.doc,t.kind,[e.doc.createTextNode(t.text)]):e.doc.createTextNode(t.text))}function se(e,t){let n=e.createElement(`span`);n.className=`chip primary chip-outline chip-sm chip-clickable wui-markdown-citation`,n.setAttribute(`data-wui`,`AppChip`);let r=e.createElement(`button`);r.type=`button`,r.className=`chip-body`,r.setAttribute(`aria-label`,t),r.addEventListener(`click`,()=>{r.dispatchEvent(new CustomEvent(`wui-markdown-citation`,{bubbles:!0,detail:{citation:t}}))});let i=e.createElement(`span`);return i.className=`chip-label`,i.textContent=t,r.append(i),n.append(r),n}function $(e,t,n,r){let i=W(e,`span`,n);i.className=`wui-link__label`;let a=W(e,`a`,[i]);return a.className=`wui-link wui-link--static`,a.setAttribute(`data-wui`,`AppLink`),a.setAttribute(`href`,t),r&&(a.setAttribute(`target`,`_blank`),a.setAttribute(`rel`,`noopener noreferrer`)),a}(0,t.defineElement)(`wui-markdown`,U),e.WuiMarkdown=U})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.elementBase);
@@ -1 +1 @@
1
- (function(e,t,n,r){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var i=globalThis.WeborityUiElementsInternal?.version;if(i!==`0.154.0`)throw Error(`[webority-ui] org-tree expects ui-elements 0.154.0 but the page loaded `+i+`.`);var a=`li[data-wui-org-node]`,o=`:scope > .wui-org-tree-node`,s=`:scope > .wui-org-tree-node > .wui-org-tree-text > .wui-org-tree-name`,c=`:scope > .wui-org-tree-children`,l=`:scope > .wui-org-tree-node > [data-wui-org-toggle]`,u=`[data-wui-org-toggle]`,d=`a, button, input, select, textarea`,f=`.wui-org-tree-overlay`,p=`[data-wui-org-search]`,m=`[data-wui-org-canvas]`,h=`[data-wui-org-live]`,g=`--wui-org-tree-print-scale`,_=718,v=1e3,y=150,b=`Show {name}'s team`,x=`Hide {name}'s team`,S=`{count} found`,C=`No one found`,w=e=>[...e.querySelectorAll(a)].filter(e=>e instanceof HTMLElement),T=e=>e.querySelector(s)?.textContent?.trim()??``,E=e=>e.getAttribute(`data-wui-org-node`),D=e=>e.getAttribute(`aria-expanded`)===`true`,O=class extends r.ElementBase{static get observedAttributes(){return[`selected`,`selectable`,`expand-label`,`collapse-label`,`search-results-text`,`search-empty-text`]}constructor(){super(),this._query=``,this._snapshot=null,this._observer=null,this._announceTimer=void 0,this._onKeyDown=e=>this._handleKeyDown(e),this._onClick=e=>this._handleClick(e),this._onFocusIn=e=>this._handleFocusIn(e),this._onInput=e=>this._handleInput(e),this._onBeforePrint=()=>this._scaleForPrint(),this._onAfterPrint=()=>this.style.removeProperty(g)}connectedCallback(){this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`click`,this._onClick),this.addEventListener(`focusin`,this._onFocusIn),this.addEventListener(`input`,this._onInput),window.addEventListener(`beforeprint`,this._onBeforePrint),window.addEventListener(`afterprint`,this._onAfterPrint);let e=this.querySelector(m);e?(this._observer=new MutationObserver(()=>{this._query&&this._applySearch(this._query)}),this._observer.observe(e,{childList:!0,subtree:!0})):(0,n.devError)(`[@webority/ui-elements] <wui-org-tree> has no [data-wui-org-canvas]; render the tree markup inside it.`)}disconnectedCallback(){this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`focusin`,this._onFocusIn),this.removeEventListener(`input`,this._onInput),window.removeEventListener(`beforeprint`,this._onBeforePrint),window.removeEventListener(`afterprint`,this._onAfterPrint),this._observer?.disconnect(),this._observer=null,clearTimeout(this._announceTimer)}attributeChangedCallback(e){e===`selected`||e===`selectable`?this._applySelected():(e===`expand-label`||e===`collapse-label`)&&this._syncToggles()}get selected(){return this.getAttribute(`selected`)}set selected(e){e==null?this.removeAttribute(`selected`):this.setAttribute(`selected`,String(e))}get selectable(){return this.hasAttribute(`selectable`)}set selectable(e){this.toggleAttribute(`selectable`,!!e)}_items(){return w(this)}_hasChildren(e){return!!e.querySelector(c)}_isVisible(e){for(let t=e;t&&t!==this;t=t.parentElement)if(t.hasAttribute(`hidden`))return!1;return!0}_visibleItems(){return this._items().filter(e=>this._isVisible(e))}_parentItem(e){let t=e.parentElement?.closest(a);return t instanceof HTMLElement&&this.contains(t)?t:null}_visibleChildren(e){let t=e.querySelector(c);return t?[...t.children].filter(e=>e.matches(a)&&this._isVisible(e)):[]}_isVisibleItem(e){return e instanceof HTMLElement&&e.matches(a)&&this._isVisible(e)}_siblingItem(e,t){let n=e[t];for(;n&&!this._isVisibleItem(n);)n=n[t];return this._isVisibleItem(n)?n:null}_setRoving(e){for(let t of this._items())t.setAttribute(`tabindex`,t===e?`0`:`-1`)}_focusItem(e){e&&(this._setRoving(e),e.focus())}_toggleLabel(e,t){return(t?this.getAttribute(`collapse-label`)??x:this.getAttribute(`expand-label`)??b).split(`{name}`).join(T(e))}_setExpanded(e,t){let n=e.querySelector(c);n instanceof HTMLElement&&(e.setAttribute(`aria-expanded`,String(t)),n.hidden=!t,e.querySelector(l)?.setAttribute(`aria-label`,this._toggleLabel(e,t)),!t&&n.contains(document.activeElement)&&this._focusItem(e))}_toggle(e){this._setExpanded(e,!D(e))}_syncToggles(){for(let e of this._items())this._hasChildren(e)&&this._setExpanded(e,D(e))}_applySelected(){for(let e of this._items())this.selectable?e.setAttribute(`aria-selected`,String(E(e)===this.selected)):e.removeAttribute(`aria-selected`)}_select(e){this.selectable&&(this.selected=E(e),this.dispatchEvent(new CustomEvent(`wui-org-tree:select`,{detail:{id:this.selected},bubbles:!0,composed:!0})))}_activate(e){this.selectable?this._select(e):this._hasChildren(e)&&this._toggle(e)}_handleFocusIn(e){let t=e.target;if(!(t instanceof Element))return;let n=t.closest(a);n instanceof HTMLElement&&this.contains(n)&&this._setRoving(n)}_handleClick(e){let t=e.target;if(!(t instanceof Element))return;let n=t.closest(a);n instanceof HTMLElement&&this.contains(n)&&(this._setRoving(n),t.closest(u)?this._hasChildren(n)&&this._toggle(n):n.querySelector(o)?.contains(t)&&(t.closest(d)?.closest(f)||this._select(n)))}_handleKeyDown(e){if(e.ctrlKey||e.metaKey||e.altKey)return;let t=e.target;if(t instanceof HTMLElement&&t.matches(a)&&this.contains(t))switch(e.key){case`ArrowDown`:if(e.preventDefault(),!this._hasChildren(t))return;D(t)||this._setExpanded(t,!0),this._focusItem(this._visibleChildren(t)[0]);return;case`ArrowUp`:e.preventDefault(),this._focusItem(this._parentItem(t));return;case`ArrowRight`:e.preventDefault(),this._focusItem(this._siblingItem(t,`nextElementSibling`));return;case`ArrowLeft`:e.preventDefault(),this._focusItem(this._siblingItem(t,`previousElementSibling`));return;case`Home`:e.preventDefault(),this._focusItem(this._visibleItems()[0]);return;case`End`:e.preventDefault(),this._focusItem(this._visibleItems().at(-1));return;case`+`:case`=`:if(!this._hasChildren(t))return;e.preventDefault(),this._setExpanded(t,!0);return;case`-`:if(!this._hasChildren(t))return;e.preventDefault(),this._setExpanded(t,!1);return;case`Enter`:case` `:e.preventDefault(),this._activate(t);return}}_handleInput(e){let t=e.target;t instanceof HTMLInputElement&&t.matches(p)&&this._search(t.value.trim().toLocaleLowerCase())}_search(e){clearTimeout(this._announceTimer),e?(this._snapshot||=this._captureExpanded(),this._query=e,this._applySearch(e),this._announceTimer=window.setTimeout(()=>this._announce(this._resultText()),y)):(this._snapshot&&this._restore(this._snapshot),this._snapshot=null,this._query=``,this._announce(``))}_captureExpanded(){return new Map(this._items().filter(e=>this._hasChildren(e)).map(e=>[E(e),D(e)]))}_restore(e){for(let t of this._items()){t.hidden=!1,t.classList.remove(`wui-org-tree-match`);let n=E(t);e.has(n)&&this._setExpanded(t,e.get(n)??!1)}}_applySearch(e){let t=this._items(),n=new Set(t.filter(t=>T(t).toLocaleLowerCase().includes(e))),r=new Set(n);for(let e of n)for(let t=this._parentItem(e);t;t=this._parentItem(t))r.add(t),D(t)||this._setExpanded(t,!0);for(let e of t)e.classList.toggle(`wui-org-tree-match`,n.has(e)),e.hidden=!r.has(e);let i=t.filter(e=>r.has(e)),a=i[0];a&&!i.some(e=>e.getAttribute(`tabindex`)===`0`)&&this._setRoving(a)}_resultText(){let e=this._items().filter(e=>e.classList.contains(`wui-org-tree-match`)).length;return e===0?this.getAttribute(`search-empty-text`)??C:(this.getAttribute(`search-results-text`)??S).split(`{count}`).join(String(e))}_announce(e){let t=this.querySelector(h);t&&(t.textContent=e)}_scaleForPrint(){let e=this.querySelector(m);if(!(e instanceof HTMLElement))return;let t=Math.min(1,_/e.scrollWidth,v/e.scrollHeight);this.style.setProperty(g,String(t))}};(0,t.defineElement)(`wui-org-tree`,O),e.WuiOrgTree=O})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.devWarn,WeborityUiElementsInternal.modules.elementBase);
1
+ (function(e,t,n,r){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var i=globalThis.WeborityUiElementsInternal?.version;if(i!==`0.155.0`)throw Error(`[webority-ui] org-tree expects ui-elements 0.155.0 but the page loaded `+i+`.`);var a=`li[data-wui-org-node]`,o=`:scope > .wui-org-tree-node`,s=`:scope > .wui-org-tree-node > .wui-org-tree-text > .wui-org-tree-name`,c=`:scope > .wui-org-tree-children`,l=`:scope > .wui-org-tree-node > [data-wui-org-toggle]`,u=`[data-wui-org-toggle]`,d=`a, button, input, select, textarea`,f=`.wui-org-tree-overlay`,p=`[data-wui-org-search]`,m=`[data-wui-org-canvas]`,h=`[data-wui-org-live]`,g=`--wui-org-tree-print-scale`,_=718,v=1e3,y=150,b=`Show {name}'s team`,x=`Hide {name}'s team`,S=`{count} found`,C=`No one found`,w=e=>[...e.querySelectorAll(a)].filter(e=>e instanceof HTMLElement),T=e=>e.querySelector(s)?.textContent?.trim()??``,E=e=>e.getAttribute(`data-wui-org-node`),D=e=>e.getAttribute(`aria-expanded`)===`true`,O=class extends r.ElementBase{static get observedAttributes(){return[`selected`,`selectable`,`expand-label`,`collapse-label`,`search-results-text`,`search-empty-text`]}constructor(){super(),this._query=``,this._snapshot=null,this._observer=null,this._announceTimer=void 0,this._onKeyDown=e=>this._handleKeyDown(e),this._onClick=e=>this._handleClick(e),this._onFocusIn=e=>this._handleFocusIn(e),this._onInput=e=>this._handleInput(e),this._onBeforePrint=()=>this._scaleForPrint(),this._onAfterPrint=()=>this.style.removeProperty(g)}connectedCallback(){this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`click`,this._onClick),this.addEventListener(`focusin`,this._onFocusIn),this.addEventListener(`input`,this._onInput),window.addEventListener(`beforeprint`,this._onBeforePrint),window.addEventListener(`afterprint`,this._onAfterPrint);let e=this.querySelector(m);e?(this._observer=new MutationObserver(()=>{this._query&&this._applySearch(this._query)}),this._observer.observe(e,{childList:!0,subtree:!0})):(0,n.devError)(`[@webority/ui-elements] <wui-org-tree> has no [data-wui-org-canvas]; render the tree markup inside it.`)}disconnectedCallback(){this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`focusin`,this._onFocusIn),this.removeEventListener(`input`,this._onInput),window.removeEventListener(`beforeprint`,this._onBeforePrint),window.removeEventListener(`afterprint`,this._onAfterPrint),this._observer?.disconnect(),this._observer=null,clearTimeout(this._announceTimer)}attributeChangedCallback(e){e===`selected`||e===`selectable`?this._applySelected():(e===`expand-label`||e===`collapse-label`)&&this._syncToggles()}get selected(){return this.getAttribute(`selected`)}set selected(e){e==null?this.removeAttribute(`selected`):this.setAttribute(`selected`,String(e))}get selectable(){return this.hasAttribute(`selectable`)}set selectable(e){this.toggleAttribute(`selectable`,!!e)}_items(){return w(this)}_hasChildren(e){return!!e.querySelector(c)}_isVisible(e){for(let t=e;t&&t!==this;t=t.parentElement)if(t.hasAttribute(`hidden`))return!1;return!0}_visibleItems(){return this._items().filter(e=>this._isVisible(e))}_parentItem(e){let t=e.parentElement?.closest(a);return t instanceof HTMLElement&&this.contains(t)?t:null}_visibleChildren(e){let t=e.querySelector(c);return t?[...t.children].filter(e=>e.matches(a)&&this._isVisible(e)):[]}_isVisibleItem(e){return e instanceof HTMLElement&&e.matches(a)&&this._isVisible(e)}_siblingItem(e,t){let n=e[t];for(;n&&!this._isVisibleItem(n);)n=n[t];return this._isVisibleItem(n)?n:null}_setRoving(e){for(let t of this._items())t.setAttribute(`tabindex`,t===e?`0`:`-1`)}_focusItem(e){e&&(this._setRoving(e),e.focus())}_toggleLabel(e,t){return(t?this.getAttribute(`collapse-label`)??x:this.getAttribute(`expand-label`)??b).split(`{name}`).join(T(e))}_setExpanded(e,t){let n=e.querySelector(c);n instanceof HTMLElement&&(e.setAttribute(`aria-expanded`,String(t)),n.hidden=!t,e.querySelector(l)?.setAttribute(`aria-label`,this._toggleLabel(e,t)),!t&&n.contains(document.activeElement)&&this._focusItem(e))}_toggle(e){this._setExpanded(e,!D(e))}_syncToggles(){for(let e of this._items())this._hasChildren(e)&&this._setExpanded(e,D(e))}_applySelected(){for(let e of this._items())this.selectable?e.setAttribute(`aria-selected`,String(E(e)===this.selected)):e.removeAttribute(`aria-selected`)}_select(e){this.selectable&&(this.selected=E(e),this.dispatchEvent(new CustomEvent(`wui-org-tree:select`,{detail:{id:this.selected},bubbles:!0,composed:!0})))}_activate(e){this.selectable?this._select(e):this._hasChildren(e)&&this._toggle(e)}_handleFocusIn(e){let t=e.target;if(!(t instanceof Element))return;let n=t.closest(a);n instanceof HTMLElement&&this.contains(n)&&this._setRoving(n)}_handleClick(e){let t=e.target;if(!(t instanceof Element))return;let n=t.closest(a);n instanceof HTMLElement&&this.contains(n)&&(this._setRoving(n),t.closest(u)?this._hasChildren(n)&&this._toggle(n):n.querySelector(o)?.contains(t)&&(t.closest(d)?.closest(f)||this._select(n)))}_handleKeyDown(e){if(e.ctrlKey||e.metaKey||e.altKey)return;let t=e.target;if(t instanceof HTMLElement&&t.matches(a)&&this.contains(t))switch(e.key){case`ArrowDown`:if(e.preventDefault(),!this._hasChildren(t))return;D(t)||this._setExpanded(t,!0),this._focusItem(this._visibleChildren(t)[0]);return;case`ArrowUp`:e.preventDefault(),this._focusItem(this._parentItem(t));return;case`ArrowRight`:e.preventDefault(),this._focusItem(this._siblingItem(t,`nextElementSibling`));return;case`ArrowLeft`:e.preventDefault(),this._focusItem(this._siblingItem(t,`previousElementSibling`));return;case`Home`:e.preventDefault(),this._focusItem(this._visibleItems()[0]);return;case`End`:e.preventDefault(),this._focusItem(this._visibleItems().at(-1));return;case`+`:case`=`:if(!this._hasChildren(t))return;e.preventDefault(),this._setExpanded(t,!0);return;case`-`:if(!this._hasChildren(t))return;e.preventDefault(),this._setExpanded(t,!1);return;case`Enter`:case` `:e.preventDefault(),this._activate(t);return}}_handleInput(e){let t=e.target;t instanceof HTMLInputElement&&t.matches(p)&&this._search(t.value.trim().toLocaleLowerCase())}_search(e){clearTimeout(this._announceTimer),e?(this._snapshot||=this._captureExpanded(),this._query=e,this._applySearch(e),this._announceTimer=window.setTimeout(()=>this._announce(this._resultText()),y)):(this._snapshot&&this._restore(this._snapshot),this._snapshot=null,this._query=``,this._announce(``))}_captureExpanded(){return new Map(this._items().filter(e=>this._hasChildren(e)).map(e=>[E(e),D(e)]))}_restore(e){for(let t of this._items()){t.hidden=!1,t.classList.remove(`wui-org-tree-match`);let n=E(t);e.has(n)&&this._setExpanded(t,e.get(n)??!1)}}_applySearch(e){let t=this._items(),n=new Set(t.filter(t=>T(t).toLocaleLowerCase().includes(e))),r=new Set(n);for(let e of n)for(let t=this._parentItem(e);t;t=this._parentItem(t))r.add(t),D(t)||this._setExpanded(t,!0);for(let e of t)e.classList.toggle(`wui-org-tree-match`,n.has(e)),e.hidden=!r.has(e);let i=t.filter(e=>r.has(e)),a=i[0];a&&!i.some(e=>e.getAttribute(`tabindex`)===`0`)&&this._setRoving(a)}_resultText(){let e=this._items().filter(e=>e.classList.contains(`wui-org-tree-match`)).length;return e===0?this.getAttribute(`search-empty-text`)??C:(this.getAttribute(`search-results-text`)??S).split(`{count}`).join(String(e))}_announce(e){let t=this.querySelector(h);t&&(t.textContent=e)}_scaleForPrint(){let e=this.querySelector(m);if(!(e instanceof HTMLElement))return;let t=Math.min(1,_/e.scrollWidth,v/e.scrollHeight);this.style.setProperty(g,String(t))}};(0,t.defineElement)(`wui-org-tree`,O),e.WuiOrgTree=O})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.devWarn,WeborityUiElementsInternal.modules.elementBase);
@@ -1,4 +1,4 @@
1
- (function(e,t,n,r,i,a,o,s,c,l,u){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var d=Object.defineProperty,f=(e,t)=>{let n={};for(var r in e)d(n,r,{get:e[r],enumerable:!0});return t||d(n,Symbol.toStringTag,{value:`Module`}),n},p=globalThis.WeborityUiElementsInternal?.version;if(p!==`0.154.0`)throw Error(`[webority-ui] phone expects ui-elements 0.154.0 but the page loaded `+p+`.`);var m=[[`AF`,`Afghanistan`,`93`],[`AX`,`Åland Islands`,`358`],[`AL`,`Albania`,`355`],[`DZ`,`Algeria`,`213`],[`AS`,`American Samoa`,`1`],[`AD`,`Andorra`,`376`],[`AO`,`Angola`,`244`],[`AI`,`Anguilla`,`1`],[`AG`,`Antigua & Barbuda`,`1`],[`AR`,`Argentina`,`54`],[`AM`,`Armenia`,`374`],[`AW`,`Aruba`,`297`],[`AC`,`Ascension Island`,`247`],[`AU`,`Australia`,`61`],[`AT`,`Austria`,`43`],[`AZ`,`Azerbaijan`,`994`],[`BS`,`Bahamas`,`1`],[`BH`,`Bahrain`,`973`],[`BD`,`Bangladesh`,`880`],[`BB`,`Barbados`,`1`],[`BY`,`Belarus`,`375`],[`BE`,`Belgium`,`32`],[`BZ`,`Belize`,`501`],[`BJ`,`Benin`,`229`],[`BM`,`Bermuda`,`1`],[`BT`,`Bhutan`,`975`],[`BO`,`Bolivia`,`591`],[`BA`,`Bosnia & Herzegovina`,`387`],[`BW`,`Botswana`,`267`],[`BR`,`Brazil`,`55`],[`IO`,`British Indian Ocean Territory`,`246`],[`VG`,`British Virgin Islands`,`1`],[`BN`,`Brunei`,`673`],[`BG`,`Bulgaria`,`359`],[`BF`,`Burkina Faso`,`226`],[`BI`,`Burundi`,`257`],[`KH`,`Cambodia`,`855`],[`CM`,`Cameroon`,`237`],[`CA`,`Canada`,`1`],[`CV`,`Cape Verde`,`238`],[`BQ`,`Caribbean Netherlands`,`599`],[`KY`,`Cayman Islands`,`1`],[`CF`,`Central African Republic`,`236`],[`TD`,`Chad`,`235`],[`CL`,`Chile`,`56`],[`CN`,`China`,`86`],[`CX`,`Christmas Island`,`61`],[`CC`,`Cocos (Keeling) Islands`,`61`],[`CO`,`Colombia`,`57`],[`KM`,`Comoros`,`269`],[`CG`,`Congo - Brazzaville`,`242`],[`CD`,`Congo - Kinshasa`,`243`],[`CK`,`Cook Islands`,`682`],[`CR`,`Costa Rica`,`506`],[`CI`,`Côte d’Ivoire`,`225`],[`HR`,`Croatia`,`385`],[`CU`,`Cuba`,`53`],[`CW`,`Curaçao`,`599`],[`CY`,`Cyprus`,`357`],[`CZ`,`Czechia`,`420`],[`DK`,`Denmark`,`45`],[`DJ`,`Djibouti`,`253`],[`DM`,`Dominica`,`1`],[`DO`,`Dominican Republic`,`1`],[`EC`,`Ecuador`,`593`],[`EG`,`Egypt`,`20`],[`SV`,`El Salvador`,`503`],[`GQ`,`Equatorial Guinea`,`240`],[`ER`,`Eritrea`,`291`],[`EE`,`Estonia`,`372`],[`SZ`,`Eswatini`,`268`],[`ET`,`Ethiopia`,`251`],[`FK`,`Falkland Islands`,`500`],[`FO`,`Faroe Islands`,`298`],[`FJ`,`Fiji`,`679`],[`FI`,`Finland`,`358`],[`FR`,`France`,`33`],[`GF`,`French Guiana`,`594`],[`PF`,`French Polynesia`,`689`],[`GA`,`Gabon`,`241`],[`GM`,`Gambia`,`220`],[`GE`,`Georgia`,`995`],[`DE`,`Germany`,`49`],[`GH`,`Ghana`,`233`],[`GI`,`Gibraltar`,`350`],[`GR`,`Greece`,`30`],[`GL`,`Greenland`,`299`],[`GD`,`Grenada`,`1`],[`GP`,`Guadeloupe`,`590`],[`GU`,`Guam`,`1`],[`GT`,`Guatemala`,`502`],[`GG`,`Guernsey`,`44`],[`GN`,`Guinea`,`224`],[`GW`,`Guinea-Bissau`,`245`],[`GY`,`Guyana`,`592`],[`HT`,`Haiti`,`509`],[`HN`,`Honduras`,`504`],[`HK`,`Hong Kong SAR China`,`852`],[`HU`,`Hungary`,`36`],[`IS`,`Iceland`,`354`],[`IN`,`India`,`91`],[`ID`,`Indonesia`,`62`],[`IR`,`Iran`,`98`],[`IQ`,`Iraq`,`964`],[`IE`,`Ireland`,`353`],[`IM`,`Isle of Man`,`44`],[`IL`,`Israel`,`972`],[`IT`,`Italy`,`39`],[`JM`,`Jamaica`,`1`],[`JP`,`Japan`,`81`],[`JE`,`Jersey`,`44`],[`JO`,`Jordan`,`962`],[`KZ`,`Kazakhstan`,`7`],[`KE`,`Kenya`,`254`],[`KI`,`Kiribati`,`686`],[`XK`,`Kosovo`,`383`],[`KW`,`Kuwait`,`965`],[`KG`,`Kyrgyzstan`,`996`],[`LA`,`Laos`,`856`],[`LV`,`Latvia`,`371`],[`LB`,`Lebanon`,`961`],[`LS`,`Lesotho`,`266`],[`LR`,`Liberia`,`231`],[`LY`,`Libya`,`218`],[`LI`,`Liechtenstein`,`423`],[`LT`,`Lithuania`,`370`],[`LU`,`Luxembourg`,`352`],[`MO`,`Macao SAR China`,`853`],[`MG`,`Madagascar`,`261`],[`MW`,`Malawi`,`265`],[`MY`,`Malaysia`,`60`],[`MV`,`Maldives`,`960`],[`ML`,`Mali`,`223`],[`MT`,`Malta`,`356`],[`MH`,`Marshall Islands`,`692`],[`MQ`,`Martinique`,`596`],[`MR`,`Mauritania`,`222`],[`MU`,`Mauritius`,`230`],[`YT`,`Mayotte`,`262`],[`MX`,`Mexico`,`52`],[`FM`,`Micronesia`,`691`],[`MD`,`Moldova`,`373`],[`MC`,`Monaco`,`377`],[`MN`,`Mongolia`,`976`],[`ME`,`Montenegro`,`382`],[`MS`,`Montserrat`,`1`],[`MA`,`Morocco`,`212`],[`MZ`,`Mozambique`,`258`],[`MM`,`Myanmar (Burma)`,`95`],[`NA`,`Namibia`,`264`],[`NR`,`Nauru`,`674`],[`NP`,`Nepal`,`977`],[`NL`,`Netherlands`,`31`],[`NC`,`New Caledonia`,`687`],[`NZ`,`New Zealand`,`64`],[`NI`,`Nicaragua`,`505`],[`NE`,`Niger`,`227`],[`NG`,`Nigeria`,`234`],[`NU`,`Niue`,`683`],[`NF`,`Norfolk Island`,`672`],[`KP`,`North Korea`,`850`],[`MK`,`North Macedonia`,`389`],[`MP`,`Northern Mariana Islands`,`1`],[`NO`,`Norway`,`47`],[`OM`,`Oman`,`968`],[`PK`,`Pakistan`,`92`],[`PW`,`Palau`,`680`],[`PS`,`Palestinian Territories`,`970`],[`PA`,`Panama`,`507`],[`PG`,`Papua New Guinea`,`675`],[`PY`,`Paraguay`,`595`],[`PE`,`Peru`,`51`],[`PH`,`Philippines`,`63`],[`PL`,`Poland`,`48`],[`PT`,`Portugal`,`351`],[`PR`,`Puerto Rico`,`1`],[`QA`,`Qatar`,`974`],[`RE`,`Réunion`,`262`],[`RO`,`Romania`,`40`],[`RU`,`Russia`,`7`],[`RW`,`Rwanda`,`250`],[`WS`,`Samoa`,`685`],[`SM`,`San Marino`,`378`],[`ST`,`São Tomé & Príncipe`,`239`],[`SA`,`Saudi Arabia`,`966`],[`SN`,`Senegal`,`221`],[`RS`,`Serbia`,`381`],[`SC`,`Seychelles`,`248`],[`SL`,`Sierra Leone`,`232`],[`SG`,`Singapore`,`65`],[`SX`,`Sint Maarten`,`1`],[`SK`,`Slovakia`,`421`],[`SI`,`Slovenia`,`386`],[`SB`,`Solomon Islands`,`677`],[`SO`,`Somalia`,`252`],[`ZA`,`South Africa`,`27`],[`KR`,`South Korea`,`82`],[`SS`,`South Sudan`,`211`],[`ES`,`Spain`,`34`],[`LK`,`Sri Lanka`,`94`],[`BL`,`St. Barthélemy`,`590`],[`SH`,`St. Helena, Ascension & Tristan da Cunha`,`290`],[`KN`,`St. Kitts & Nevis`,`1`],[`LC`,`St. Lucia`,`1`],[`MF`,`St. Martin`,`590`],[`PM`,`St. Pierre & Miquelon`,`508`],[`VC`,`St. Vincent & Grenadines`,`1`],[`SD`,`Sudan`,`249`],[`SR`,`Suriname`,`597`],[`SJ`,`Svalbard & Jan Mayen`,`47`],[`SE`,`Sweden`,`46`],[`CH`,`Switzerland`,`41`],[`SY`,`Syria`,`963`],[`TW`,`Taiwan`,`886`],[`TJ`,`Tajikistan`,`992`],[`TZ`,`Tanzania`,`255`],[`TH`,`Thailand`,`66`],[`TL`,`Timor-Leste`,`670`],[`TG`,`Togo`,`228`],[`TK`,`Tokelau`,`690`],[`TO`,`Tonga`,`676`],[`TT`,`Trinidad & Tobago`,`1`],[`TA`,`Tristan da Cunha`,`290`],[`TN`,`Tunisia`,`216`],[`TR`,`Türkiye`,`90`],[`TM`,`Turkmenistan`,`993`],[`TC`,`Turks & Caicos Islands`,`1`],[`TV`,`Tuvalu`,`688`],[`VI`,`U.S. Virgin Islands`,`1`],[`UG`,`Uganda`,`256`],[`UA`,`Ukraine`,`380`],[`AE`,`United Arab Emirates`,`971`],[`GB`,`United Kingdom`,`44`],[`US`,`United States`,`1`],[`UY`,`Uruguay`,`598`],[`UZ`,`Uzbekistan`,`998`],[`VU`,`Vanuatu`,`678`],[`VA`,`Vatican City`,`39`],[`VE`,`Venezuela`,`58`],[`VN`,`Vietnam`,`84`],[`WF`,`Wallis & Futuna`,`681`],[`EH`,`Western Sahara`,`212`],[`YE`,`Yemen`,`967`],[`ZM`,`Zambia`,`260`],[`ZW`,`Zimbabwe`,`263`]],h=e=>m.find(t=>t[0]===e)?.[2]??``,g={AD:[`Europe/Andorra`],AE:[`Asia/Dubai`],AF:[`Asia/Kabul`],AG:[`America/Antigua`],AI:[`America/Anguilla`],AL:[`Europe/Tirane`],AM:[`Asia/Yerevan`],AO:[`Africa/Luanda`],AR:[`America/Argentina/Buenos_Aires`,`America/Argentina/Catamarca`,`America/Argentina/ComodRivadavia`,`America/Argentina/Cordoba`,`America/Argentina/Jujuy`,`America/Argentina/La_Rioja`,`America/Argentina/Mendoza`,`America/Argentina/Rio_Gallegos`,`America/Argentina/Salta`,`America/Argentina/San_Juan`,`America/Argentina/San_Luis`,`America/Argentina/Tucuman`,`America/Argentina/Ushuaia`,`America/Buenos_Aires`,`America/Catamarca`,`America/Cordoba`,`America/Jujuy`,`America/Mendoza`,`America/Rosario`],AS:[`Pacific/Pago_Pago`,`Pacific/Samoa`,`US/Samoa`],AT:[`Europe/Vienna`],AU:[`Antarctica/Macquarie`,`Australia/Adelaide`,`Australia/Brisbane`,`Australia/Broken_Hill`,`Australia/Canberra`,`Australia/Currie`,`Australia/Darwin`,`Australia/Eucla`,`Australia/Hobart`,`Australia/LHI`,`Australia/Lindeman`,`Australia/Lord_Howe`,`Australia/Melbourne`,`Australia/NSW`,`Australia/North`,`Australia/Perth`,`Australia/Queensland`,`Australia/South`,`Australia/Sydney`,`Australia/Tasmania`,`Australia/Victoria`,`Australia/West`,`Australia/Yancowinna`],AW:[`America/Aruba`],AX:[`Europe/Mariehamn`],AZ:[`Asia/Baku`],BA:[`Europe/Sarajevo`],BB:[`America/Barbados`],BD:[`Asia/Dacca`,`Asia/Dhaka`],BE:[`Europe/Brussels`],BF:[`Africa/Ouagadougou`],BG:[`Europe/Sofia`],BH:[`Asia/Bahrain`],BI:[`Africa/Bujumbura`],BJ:[`Africa/Porto-Novo`],BL:[`America/St_Barthelemy`],BM:[`Atlantic/Bermuda`],BN:[`Asia/Brunei`],BO:[`America/La_Paz`],BQ:[`America/Kralendijk`],BR:[`America/Araguaina`,`America/Bahia`,`America/Belem`,`America/Boa_Vista`,`America/Campo_Grande`,`America/Cuiaba`,`America/Eirunepe`,`America/Fortaleza`,`America/Maceio`,`America/Manaus`,`America/Noronha`,`America/Porto_Acre`,`America/Porto_Velho`,`America/Recife`,`America/Rio_Branco`,`America/Santarem`,`America/Sao_Paulo`,`Brazil/DeNoronha`,`Brazil/East`,`Brazil/West`],BS:[`America/Nassau`],BT:[`Asia/Thimbu`,`Asia/Thimphu`],BW:[`Africa/Gaborone`],BY:[`Europe/Minsk`],BZ:[`America/Belize`],CA:`America/Atikokan.America/Blanc-Sablon.America/Cambridge_Bay.America/Coral_Harbour.America/Creston.America/Dawson.America/Dawson_Creek.America/Edmonton.America/Fort_Nelson.America/Glace_Bay.America/Goose_Bay.America/Halifax.America/Inuvik.America/Iqaluit.America/Moncton.America/Montreal.America/Nipigon.America/Pangnirtung.America/Rainy_River.America/Rankin_Inlet.America/Regina.America/Resolute.America/St_Johns.America/Swift_Current.America/Thunder_Bay.America/Toronto.America/Vancouver.America/Whitehorse.America/Winnipeg.America/Yellowknife.Canada/Atlantic.Canada/Central.Canada/Eastern.Canada/Mountain.Canada/Newfoundland.Canada/Pacific.Canada/Saskatchewan.Canada/Yukon`.split(`.`),CC:[`Indian/Cocos`],CD:[`Africa/Kinshasa`,`Africa/Lubumbashi`],CF:[`Africa/Bangui`],CG:[`Africa/Brazzaville`],CH:[`Europe/Zurich`],CI:[`Africa/Abidjan`],CK:[`Pacific/Rarotonga`],CL:[`America/Coyhaique`,`America/Punta_Arenas`,`America/Santiago`,`Chile/Continental`,`Chile/EasterIsland`,`Pacific/Easter`],CM:[`Africa/Douala`],CN:[`Asia/Chongqing`,`Asia/Harbin`,`Asia/Kashgar`,`Asia/Shanghai`,`Asia/Urumqi`],CO:[`America/Bogota`],CR:[`America/Costa_Rica`],CU:[`America/Havana`],CV:[`Atlantic/Cape_Verde`],CW:[`America/Curacao`],CX:[`Indian/Christmas`],CY:[`Asia/Famagusta`,`Asia/Nicosia`,`Europe/Nicosia`],CZ:[`Europe/Prague`],DE:[`Europe/Berlin`,`Europe/Busingen`],DJ:[`Africa/Djibouti`],DK:[`Europe/Copenhagen`],DM:[`America/Dominica`],DO:[`America/Santo_Domingo`],DZ:[`Africa/Algiers`],EC:[`America/Guayaquil`,`Pacific/Galapagos`],EE:[`Europe/Tallinn`],EG:[`Africa/Cairo`],EH:[`Africa/El_Aaiun`],ER:[`Africa/Asmara`,`Africa/Asmera`],ES:[`Africa/Ceuta`,`Atlantic/Canary`,`Europe/Madrid`],ET:[`Africa/Addis_Ababa`],FI:[`Europe/Helsinki`],FJ:[`Pacific/Fiji`],FK:[`Atlantic/Stanley`],FM:[`Pacific/Chuuk`,`Pacific/Kosrae`,`Pacific/Pohnpei`,`Pacific/Ponape`,`Pacific/Truk`,`Pacific/Yap`],FO:[`Atlantic/Faeroe`,`Atlantic/Faroe`],FR:[`Europe/Paris`],GA:[`Africa/Libreville`],GB:[`Europe/Belfast`,`Europe/London`],GD:[`America/Grenada`],GE:[`Asia/Tbilisi`],GF:[`America/Cayenne`],GG:[`Europe/Guernsey`],GH:[`Africa/Accra`],GI:[`Europe/Gibraltar`],GL:[`America/Danmarkshavn`,`America/Godthab`,`America/Nuuk`,`America/Scoresbysund`,`America/Thule`],GM:[`Africa/Banjul`],GN:[`Africa/Conakry`],GP:[`America/Guadeloupe`],GQ:[`Africa/Malabo`],GR:[`Europe/Athens`],GT:[`America/Guatemala`],GU:[`Pacific/Guam`],GW:[`Africa/Bissau`],GY:[`America/Guyana`],HK:[`Asia/Hong_Kong`],HN:[`America/Tegucigalpa`],HR:[`Europe/Zagreb`],HT:[`America/Port-au-Prince`],HU:[`Europe/Budapest`],ID:[`Asia/Jakarta`,`Asia/Jayapura`,`Asia/Makassar`,`Asia/Pontianak`,`Asia/Ujung_Pandang`],IE:[`Europe/Dublin`],IL:[`Asia/Jerusalem`,`Asia/Tel_Aviv`],IM:[`Europe/Isle_of_Man`],IN:[`Asia/Calcutta`,`Asia/Kolkata`],IO:[`Indian/Chagos`],IQ:[`Asia/Baghdad`],IR:[`Asia/Tehran`],IS:[`Atlantic/Reykjavik`],IT:[`Europe/Rome`],JE:[`Europe/Jersey`],JM:[`America/Jamaica`],JO:[`Asia/Amman`],JP:[`Asia/Tokyo`],KE:[`Africa/Nairobi`],KG:[`Asia/Bishkek`],KH:[`Asia/Phnom_Penh`],KI:[`Pacific/Enderbury`,`Pacific/Kanton`,`Pacific/Kiritimati`,`Pacific/Tarawa`],KM:[`Indian/Comoro`],KN:[`America/St_Kitts`],KP:[`Asia/Pyongyang`],KR:[`Asia/Seoul`],KW:[`Asia/Kuwait`],KY:[`America/Cayman`],KZ:[`Asia/Almaty`,`Asia/Aqtau`,`Asia/Aqtobe`,`Asia/Atyrau`,`Asia/Oral`,`Asia/Qostanay`,`Asia/Qyzylorda`],LA:[`Asia/Vientiane`],LB:[`Asia/Beirut`],LC:[`America/St_Lucia`],LI:[`Europe/Vaduz`],LK:[`Asia/Colombo`],LR:[`Africa/Monrovia`],LS:[`Africa/Maseru`],LT:[`Europe/Vilnius`],LU:[`Europe/Luxembourg`],LV:[`Europe/Riga`],LY:[`Africa/Tripoli`],MA:[`Africa/Casablanca`],MC:[`Europe/Monaco`],MD:[`Europe/Chisinau`,`Europe/Tiraspol`],ME:[`Europe/Podgorica`],MF:[`America/Marigot`],MG:[`Indian/Antananarivo`],MH:[`Pacific/Kwajalein`,`Pacific/Majuro`],MK:[`Europe/Skopje`],ML:[`Africa/Bamako`,`Africa/Timbuktu`],MM:[`Asia/Rangoon`,`Asia/Yangon`],MN:[`Asia/Choibalsan`,`Asia/Hovd`,`Asia/Ulaanbaatar`,`Asia/Ulan_Bator`],MO:[`Asia/Macao`,`Asia/Macau`],MP:[`Pacific/Saipan`],MQ:[`America/Martinique`],MR:[`Africa/Nouakchott`],MS:[`America/Montserrat`],MT:[`Europe/Malta`],MU:[`Indian/Mauritius`],MV:[`Indian/Maldives`],MW:[`Africa/Blantyre`],MX:[`America/Bahia_Banderas`,`America/Cancun`,`America/Chihuahua`,`America/Ciudad_Juarez`,`America/Ensenada`,`America/Hermosillo`,`America/Matamoros`,`America/Mazatlan`,`America/Merida`,`America/Mexico_City`,`America/Monterrey`,`America/Ojinaga`,`America/Santa_Isabel`,`America/Tijuana`,`Mexico/BajaNorte`,`Mexico/BajaSur`,`Mexico/General`],MY:[`Asia/Kuala_Lumpur`,`Asia/Kuching`],MZ:[`Africa/Maputo`],NA:[`Africa/Windhoek`],NC:[`Pacific/Noumea`],NE:[`Africa/Niamey`],NF:[`Pacific/Norfolk`],NG:[`Africa/Lagos`],NI:[`America/Managua`],NL:[`Europe/Amsterdam`],NO:[`Europe/Oslo`],NP:[`Asia/Kathmandu`,`Asia/Katmandu`],NR:[`Pacific/Nauru`],NU:[`Pacific/Niue`],NZ:[`Pacific/Auckland`,`Pacific/Chatham`],OM:[`Asia/Muscat`],PA:[`America/Panama`],PE:[`America/Lima`],PF:[`Pacific/Gambier`,`Pacific/Marquesas`,`Pacific/Tahiti`],PG:[`Pacific/Bougainville`,`Pacific/Port_Moresby`],PH:[`Asia/Manila`],PK:[`Asia/Karachi`],PL:[`Europe/Warsaw`],PM:[`America/Miquelon`],PR:[`America/Puerto_Rico`],PS:[`Asia/Gaza`,`Asia/Hebron`],PT:[`Atlantic/Azores`,`Atlantic/Madeira`,`Europe/Lisbon`],PW:[`Pacific/Palau`],PY:[`America/Asuncion`],QA:[`Asia/Qatar`],RE:[`Indian/Reunion`],RO:[`Europe/Bucharest`],RS:[`Europe/Belgrade`],RU:`Asia/Anadyr.Asia/Barnaul.Asia/Chita.Asia/Irkutsk.Asia/Kamchatka.Asia/Khandyga.Asia/Krasnoyarsk.Asia/Magadan.Asia/Novokuznetsk.Asia/Novosibirsk.Asia/Omsk.Asia/Sakhalin.Asia/Srednekolymsk.Asia/Tomsk.Asia/Ust-Nera.Asia/Vladivostok.Asia/Yakutsk.Asia/Yekaterinburg.Europe/Astrakhan.Europe/Kaliningrad.Europe/Kirov.Europe/Moscow.Europe/Samara.Europe/Saratov.Europe/Ulyanovsk.Europe/Volgograd`.split(`.`),RW:[`Africa/Kigali`],SA:[`Asia/Riyadh`],SB:[`Pacific/Guadalcanal`],SC:[`Indian/Mahe`],SD:[`Africa/Khartoum`],SE:[`Europe/Stockholm`],SG:[`Asia/Singapore`],SH:[`Atlantic/St_Helena`],SI:[`Europe/Ljubljana`],SJ:[`Arctic/Longyearbyen`,`Atlantic/Jan_Mayen`],SK:[`Europe/Bratislava`],SL:[`Africa/Freetown`],SM:[`Europe/San_Marino`],SN:[`Africa/Dakar`],SO:[`Africa/Mogadishu`],SR:[`America/Paramaribo`],SS:[`Africa/Juba`],ST:[`Africa/Sao_Tome`],SV:[`America/El_Salvador`],SX:[`America/Lower_Princes`],SY:[`Asia/Damascus`],SZ:[`Africa/Mbabane`],TC:[`America/Grand_Turk`],TD:[`Africa/Ndjamena`],TG:[`Africa/Lome`],TH:[`Asia/Bangkok`],TJ:[`Asia/Dushanbe`],TK:[`Pacific/Fakaofo`],TL:[`Asia/Dili`],TM:[`Asia/Ashgabat`,`Asia/Ashkhabad`],TN:[`Africa/Tunis`],TO:[`Pacific/Tongatapu`],TR:[`Asia/Istanbul`,`Europe/Istanbul`],TT:[`America/Port_of_Spain`],TV:[`Pacific/Funafuti`],TW:[`Asia/Taipei`],TZ:[`Africa/Dar_es_Salaam`],UA:[`Europe/Kiev`,`Europe/Kyiv`,`Europe/Simferopol`,`Europe/Uzhgorod`,`Europe/Zaporozhye`],UG:[`Africa/Kampala`],US:`America/Adak.America/Anchorage.America/Atka.America/Boise.America/Chicago.America/Denver.America/Detroit.America/Fort_Wayne.America/Indiana/Indianapolis.America/Indiana/Knox.America/Indiana/Marengo.America/Indiana/Petersburg.America/Indiana/Tell_City.America/Indiana/Vevay.America/Indiana/Vincennes.America/Indiana/Winamac.America/Indianapolis.America/Juneau.America/Kentucky/Louisville.America/Kentucky/Monticello.America/Knox_IN.America/Los_Angeles.America/Louisville.America/Menominee.America/Metlakatla.America/New_York.America/Nome.America/North_Dakota/Beulah.America/North_Dakota/Center.America/North_Dakota/New_Salem.America/Phoenix.America/Shiprock.America/Sitka.America/Yakutat.Pacific/Honolulu.US/Alaska.US/Aleutian.US/Arizona.US/Central.US/East-Indiana.US/Eastern.US/Hawaii.US/Indiana-Starke.US/Michigan.US/Mountain.US/Pacific`.split(`.`),UY:[`America/Montevideo`],UZ:[`Asia/Samarkand`,`Asia/Tashkent`],VA:[`Europe/Vatican`],VC:[`America/St_Vincent`],VE:[`America/Caracas`],VG:[`America/Tortola`],VI:[`America/St_Thomas`,`America/Virgin`],VN:[`Asia/Ho_Chi_Minh`,`Asia/Saigon`],VU:[`Pacific/Efate`],WF:[`Pacific/Wallis`],WS:[`Pacific/Apia`],YE:[`Asia/Aden`],YT:[`Indian/Mayotte`],ZA:[`Africa/Johannesburg`],ZM:[`Africa/Lusaka`],ZW:[`Africa/Harare`]},_=new Set(m.map(([e])=>e)),v=new Map;for(let[e,t]of Object.entries(g))for(let n of t)v.set(n,e);function y(e){let t=e===void 0?void 0:v.get(e);return t&&_.has(t)?t:null}function b(e){if(!e)return null;let t;try{t=new Intl.Locale(e).region}catch{return null}return t&&_.has(t)?t:null}function x(){let e;try{e=Intl.DateTimeFormat().resolvedOptions().timeZone}catch{e=void 0}let t=typeof navigator>`u`?void 0:navigator.language;return y(e)||b(t)||null}var S=`ui-phone.global.js`;function C(){return window.WeborityPhone?Promise.resolve(window.WeborityPhone):new Promise((e,t)=>{let n=document.querySelector(`script[src*="${S}"]`);if(!n){let e=document.createElement(`script`);try{e.src=(0,l.assetUrl)(S)}catch(e){t(e);return}document.head.append(e),n=e}n.addEventListener(`load`,()=>window.WeborityPhone?e(window.WeborityPhone):t(Error(`The phone metadata script did not load.`))),n.addEventListener(`error`,()=>t(Error(`The phone metadata script failed to load.`)))})}function w(e,t){return e.isSupportedCountry(t)}var T=e=>e?`wui-flag wui-flag-${String(e).toLowerCase()}`:`wui-flag`,E=e=>e?`+${h(e)}`:``,D=null,O=null;function k(){return D?Promise.resolve(D):(O||=C().then(e=>(D=e,D)).catch(e=>((0,r.devError)(`[@webority/ui-elements] <wui-phone> could not load its phone number metadata.`,e),null)),O)}function A(e,t){let n=`+${h(e)}`;return t?.startsWith(n)?t.slice(n.length).trimStart():null}function j(e,t){if(!D||!t||!e||!w(D,e))return t;try{return A(e,new D.AsYouType(e).input(`+${h(e)}${t}`))||t}catch{return t}}function M(e,t){if(t<=0)return 0;let n=0;for(let r=0;r<e.length;r++)if(/[0-9]/.test(e[r]??``)&&(n+=1,n===t))return r+1;return e.length}function N(e){if(!D||!e||!w(D,e))return null;try{return A(e,D.getExampleNumber(e,D.examples)?.formatInternational())||null}catch{return null}}function P(e){let t=N(e);return t?`For example ${t}`:null}function F(e){if(!D||!e)return null;try{if(!D.isValidPhoneNumber(e))return!1;let t=D.parsePhoneNumber(e)?.getType?.();return t===void 0||t===`MOBILE`||t===`FIXED_LINE_OR_MOBILE`}catch{return null}}function I(e){if(!D||!e||!w(D,e))return null;try{let t=D.getExampleNumber(e,D.examples);return t?.nationalNumber?t.nationalNumber.length:null}catch{return null}}function L(e,t,n){if(!D||!w(D,e))return null;try{let r=D.parsePhoneNumber(t,e),i=r?.nationalNumber;return!i||r.country!==e||i.length>n||!t.endsWith(i)?null:i}catch{return null}}function R(e){if(!D||!e?.trim().startsWith(`+`))return null;try{let t=new D.AsYouType;t.input(e.trim());let n=t.getCountry();return!n||!W(t)?null:{country:n,national:t.getNationalNumber()||``}}catch{return null}}function z(e,t){let n=String(t??``).trim();if(!n.startsWith(`+`))return null;let r=n.replace(/[^0-9]/g,``),i=String(h(e));return{country:e,national:r.startsWith(i)?r.slice(i.length):r}}var B=class extends i.ElementBase{static formAssociated=!0;static get observedAttributes(){return[`value`,`country`,`locked-country`,`placeholder`,`disabled`,`readonly`,`loading`,`required`,`aria-label`,`aria-describedby`]}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._defaultCountry=x()||``,this._country=this._defaultCountry,this._national=``,this._active=-1,this._committedValue=``,this._validateOnInput=!1}connectedCallback(){this._rendered?this._bindGlobal?.():this.render()}attributeChangedCallback(e,t,n){if(e===`value`)this.value=n;else if(this._rendered){if(e===`aria-label`){let t=this.querySelector(`input[type=tel]`);t&&(n==null?t.removeAttribute(e):t.setAttribute(e,n))}else if(e===`aria-describedby`)this._syncDescribedBy();else if(e===`country`){if(this._locked)return;let e=this.value;if(this._country=n||this._defaultCountry,this._suppressCountryRender)return;this.render(),this.value!==e&&(this._emitInput(),this._emitChange())}else this.render()}}formResetCallback(){this._validateOnInput=!1,this.value=this._defaultValue||``}get _locked(){return(this.getAttribute(`locked-country`)||``).toUpperCase()||null}get value(){return this._national&&this._country?`+${h(this._country)}${this._national}`:``}set value(e){let t=String(e??``).trim();this._locked&&(this._country=this._locked);let n=this._locked?null:R(t);if(n)this._country=n.country,this._national=n.national.replace(/[^0-9]/g,``);else if(t.startsWith(`+`)){let e=t.replace(/[^0-9]/g,``),n=String(h(this._locked||this.getAttribute(`country`)||this._country));n&&e.startsWith(n)&&(e=e.slice(n.length)),this._national=e}else this._national=t.replace(/[^0-9]/g,``);n&&this.getAttribute(`country`)!==this._country?this.setAttribute(`country`,this._country):this._rendered&&this.render(),this._committedValue=this.value,this._syncMirror()}_syncMirror(){(0,o.syncFormMirror)(this,this.value)}_syncDescribedBy(){let e=this.querySelector(`input[type=tel]`);if(!e)return;let t=[this.getAttribute(`aria-describedby`),this.querySelector(`[data-phone-error]`)?.id].filter(Boolean);t.length?e.setAttribute(`aria-describedby`,t.join(` `)):e.removeAttribute(`aria-describedby`)}_emitInput(){this.dispatchEvent(new Event(`input`,{bubbles:!0}))}_emitChange(){this._committedValue=this.value,this.dispatchEvent(new Event(`change`,{bubbles:!0}))}render(){this._defaultValue===void 0&&(this._defaultValue=this.getAttribute(`value`)||``),this._country=this._locked||this.getAttribute(`country`)||this._country;let e=this.getAttribute(`placeholder`)||P(this._country)||`Enter phone number`;this.id||=`wui-phone-${Math.random().toString(36).slice(2,9)}`;let t=`${this.id}-listbox`;this._listboxId=t;let n=this._locked?`<div class="phone-country-adornment"><span class="wui-phone-prefix"><span class="${T(this._country)}" data-flag aria-hidden="true"></span><span class="phone-dial" data-dial>${E(this._country)}</span></span></div>`:`<div class="phone-country-adornment">
1
+ (function(e,t,n,r,i,a,o,s,c,l,u){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var d=Object.defineProperty,f=(e,t)=>{let n={};for(var r in e)d(n,r,{get:e[r],enumerable:!0});return t||d(n,Symbol.toStringTag,{value:`Module`}),n},p=globalThis.WeborityUiElementsInternal?.version;if(p!==`0.155.0`)throw Error(`[webority-ui] phone expects ui-elements 0.155.0 but the page loaded `+p+`.`);var m=[[`AF`,`Afghanistan`,`93`],[`AX`,`Åland Islands`,`358`],[`AL`,`Albania`,`355`],[`DZ`,`Algeria`,`213`],[`AS`,`American Samoa`,`1`],[`AD`,`Andorra`,`376`],[`AO`,`Angola`,`244`],[`AI`,`Anguilla`,`1`],[`AG`,`Antigua & Barbuda`,`1`],[`AR`,`Argentina`,`54`],[`AM`,`Armenia`,`374`],[`AW`,`Aruba`,`297`],[`AC`,`Ascension Island`,`247`],[`AU`,`Australia`,`61`],[`AT`,`Austria`,`43`],[`AZ`,`Azerbaijan`,`994`],[`BS`,`Bahamas`,`1`],[`BH`,`Bahrain`,`973`],[`BD`,`Bangladesh`,`880`],[`BB`,`Barbados`,`1`],[`BY`,`Belarus`,`375`],[`BE`,`Belgium`,`32`],[`BZ`,`Belize`,`501`],[`BJ`,`Benin`,`229`],[`BM`,`Bermuda`,`1`],[`BT`,`Bhutan`,`975`],[`BO`,`Bolivia`,`591`],[`BA`,`Bosnia & Herzegovina`,`387`],[`BW`,`Botswana`,`267`],[`BR`,`Brazil`,`55`],[`IO`,`British Indian Ocean Territory`,`246`],[`VG`,`British Virgin Islands`,`1`],[`BN`,`Brunei`,`673`],[`BG`,`Bulgaria`,`359`],[`BF`,`Burkina Faso`,`226`],[`BI`,`Burundi`,`257`],[`KH`,`Cambodia`,`855`],[`CM`,`Cameroon`,`237`],[`CA`,`Canada`,`1`],[`CV`,`Cape Verde`,`238`],[`BQ`,`Caribbean Netherlands`,`599`],[`KY`,`Cayman Islands`,`1`],[`CF`,`Central African Republic`,`236`],[`TD`,`Chad`,`235`],[`CL`,`Chile`,`56`],[`CN`,`China`,`86`],[`CX`,`Christmas Island`,`61`],[`CC`,`Cocos (Keeling) Islands`,`61`],[`CO`,`Colombia`,`57`],[`KM`,`Comoros`,`269`],[`CG`,`Congo - Brazzaville`,`242`],[`CD`,`Congo - Kinshasa`,`243`],[`CK`,`Cook Islands`,`682`],[`CR`,`Costa Rica`,`506`],[`CI`,`Côte d’Ivoire`,`225`],[`HR`,`Croatia`,`385`],[`CU`,`Cuba`,`53`],[`CW`,`Curaçao`,`599`],[`CY`,`Cyprus`,`357`],[`CZ`,`Czechia`,`420`],[`DK`,`Denmark`,`45`],[`DJ`,`Djibouti`,`253`],[`DM`,`Dominica`,`1`],[`DO`,`Dominican Republic`,`1`],[`EC`,`Ecuador`,`593`],[`EG`,`Egypt`,`20`],[`SV`,`El Salvador`,`503`],[`GQ`,`Equatorial Guinea`,`240`],[`ER`,`Eritrea`,`291`],[`EE`,`Estonia`,`372`],[`SZ`,`Eswatini`,`268`],[`ET`,`Ethiopia`,`251`],[`FK`,`Falkland Islands`,`500`],[`FO`,`Faroe Islands`,`298`],[`FJ`,`Fiji`,`679`],[`FI`,`Finland`,`358`],[`FR`,`France`,`33`],[`GF`,`French Guiana`,`594`],[`PF`,`French Polynesia`,`689`],[`GA`,`Gabon`,`241`],[`GM`,`Gambia`,`220`],[`GE`,`Georgia`,`995`],[`DE`,`Germany`,`49`],[`GH`,`Ghana`,`233`],[`GI`,`Gibraltar`,`350`],[`GR`,`Greece`,`30`],[`GL`,`Greenland`,`299`],[`GD`,`Grenada`,`1`],[`GP`,`Guadeloupe`,`590`],[`GU`,`Guam`,`1`],[`GT`,`Guatemala`,`502`],[`GG`,`Guernsey`,`44`],[`GN`,`Guinea`,`224`],[`GW`,`Guinea-Bissau`,`245`],[`GY`,`Guyana`,`592`],[`HT`,`Haiti`,`509`],[`HN`,`Honduras`,`504`],[`HK`,`Hong Kong SAR China`,`852`],[`HU`,`Hungary`,`36`],[`IS`,`Iceland`,`354`],[`IN`,`India`,`91`],[`ID`,`Indonesia`,`62`],[`IR`,`Iran`,`98`],[`IQ`,`Iraq`,`964`],[`IE`,`Ireland`,`353`],[`IM`,`Isle of Man`,`44`],[`IL`,`Israel`,`972`],[`IT`,`Italy`,`39`],[`JM`,`Jamaica`,`1`],[`JP`,`Japan`,`81`],[`JE`,`Jersey`,`44`],[`JO`,`Jordan`,`962`],[`KZ`,`Kazakhstan`,`7`],[`KE`,`Kenya`,`254`],[`KI`,`Kiribati`,`686`],[`XK`,`Kosovo`,`383`],[`KW`,`Kuwait`,`965`],[`KG`,`Kyrgyzstan`,`996`],[`LA`,`Laos`,`856`],[`LV`,`Latvia`,`371`],[`LB`,`Lebanon`,`961`],[`LS`,`Lesotho`,`266`],[`LR`,`Liberia`,`231`],[`LY`,`Libya`,`218`],[`LI`,`Liechtenstein`,`423`],[`LT`,`Lithuania`,`370`],[`LU`,`Luxembourg`,`352`],[`MO`,`Macao SAR China`,`853`],[`MG`,`Madagascar`,`261`],[`MW`,`Malawi`,`265`],[`MY`,`Malaysia`,`60`],[`MV`,`Maldives`,`960`],[`ML`,`Mali`,`223`],[`MT`,`Malta`,`356`],[`MH`,`Marshall Islands`,`692`],[`MQ`,`Martinique`,`596`],[`MR`,`Mauritania`,`222`],[`MU`,`Mauritius`,`230`],[`YT`,`Mayotte`,`262`],[`MX`,`Mexico`,`52`],[`FM`,`Micronesia`,`691`],[`MD`,`Moldova`,`373`],[`MC`,`Monaco`,`377`],[`MN`,`Mongolia`,`976`],[`ME`,`Montenegro`,`382`],[`MS`,`Montserrat`,`1`],[`MA`,`Morocco`,`212`],[`MZ`,`Mozambique`,`258`],[`MM`,`Myanmar (Burma)`,`95`],[`NA`,`Namibia`,`264`],[`NR`,`Nauru`,`674`],[`NP`,`Nepal`,`977`],[`NL`,`Netherlands`,`31`],[`NC`,`New Caledonia`,`687`],[`NZ`,`New Zealand`,`64`],[`NI`,`Nicaragua`,`505`],[`NE`,`Niger`,`227`],[`NG`,`Nigeria`,`234`],[`NU`,`Niue`,`683`],[`NF`,`Norfolk Island`,`672`],[`KP`,`North Korea`,`850`],[`MK`,`North Macedonia`,`389`],[`MP`,`Northern Mariana Islands`,`1`],[`NO`,`Norway`,`47`],[`OM`,`Oman`,`968`],[`PK`,`Pakistan`,`92`],[`PW`,`Palau`,`680`],[`PS`,`Palestinian Territories`,`970`],[`PA`,`Panama`,`507`],[`PG`,`Papua New Guinea`,`675`],[`PY`,`Paraguay`,`595`],[`PE`,`Peru`,`51`],[`PH`,`Philippines`,`63`],[`PL`,`Poland`,`48`],[`PT`,`Portugal`,`351`],[`PR`,`Puerto Rico`,`1`],[`QA`,`Qatar`,`974`],[`RE`,`Réunion`,`262`],[`RO`,`Romania`,`40`],[`RU`,`Russia`,`7`],[`RW`,`Rwanda`,`250`],[`WS`,`Samoa`,`685`],[`SM`,`San Marino`,`378`],[`ST`,`São Tomé & Príncipe`,`239`],[`SA`,`Saudi Arabia`,`966`],[`SN`,`Senegal`,`221`],[`RS`,`Serbia`,`381`],[`SC`,`Seychelles`,`248`],[`SL`,`Sierra Leone`,`232`],[`SG`,`Singapore`,`65`],[`SX`,`Sint Maarten`,`1`],[`SK`,`Slovakia`,`421`],[`SI`,`Slovenia`,`386`],[`SB`,`Solomon Islands`,`677`],[`SO`,`Somalia`,`252`],[`ZA`,`South Africa`,`27`],[`KR`,`South Korea`,`82`],[`SS`,`South Sudan`,`211`],[`ES`,`Spain`,`34`],[`LK`,`Sri Lanka`,`94`],[`BL`,`St. Barthélemy`,`590`],[`SH`,`St. Helena, Ascension & Tristan da Cunha`,`290`],[`KN`,`St. Kitts & Nevis`,`1`],[`LC`,`St. Lucia`,`1`],[`MF`,`St. Martin`,`590`],[`PM`,`St. Pierre & Miquelon`,`508`],[`VC`,`St. Vincent & Grenadines`,`1`],[`SD`,`Sudan`,`249`],[`SR`,`Suriname`,`597`],[`SJ`,`Svalbard & Jan Mayen`,`47`],[`SE`,`Sweden`,`46`],[`CH`,`Switzerland`,`41`],[`SY`,`Syria`,`963`],[`TW`,`Taiwan`,`886`],[`TJ`,`Tajikistan`,`992`],[`TZ`,`Tanzania`,`255`],[`TH`,`Thailand`,`66`],[`TL`,`Timor-Leste`,`670`],[`TG`,`Togo`,`228`],[`TK`,`Tokelau`,`690`],[`TO`,`Tonga`,`676`],[`TT`,`Trinidad & Tobago`,`1`],[`TA`,`Tristan da Cunha`,`290`],[`TN`,`Tunisia`,`216`],[`TR`,`Türkiye`,`90`],[`TM`,`Turkmenistan`,`993`],[`TC`,`Turks & Caicos Islands`,`1`],[`TV`,`Tuvalu`,`688`],[`VI`,`U.S. Virgin Islands`,`1`],[`UG`,`Uganda`,`256`],[`UA`,`Ukraine`,`380`],[`AE`,`United Arab Emirates`,`971`],[`GB`,`United Kingdom`,`44`],[`US`,`United States`,`1`],[`UY`,`Uruguay`,`598`],[`UZ`,`Uzbekistan`,`998`],[`VU`,`Vanuatu`,`678`],[`VA`,`Vatican City`,`39`],[`VE`,`Venezuela`,`58`],[`VN`,`Vietnam`,`84`],[`WF`,`Wallis & Futuna`,`681`],[`EH`,`Western Sahara`,`212`],[`YE`,`Yemen`,`967`],[`ZM`,`Zambia`,`260`],[`ZW`,`Zimbabwe`,`263`]],h=e=>m.find(t=>t[0]===e)?.[2]??``,g={AD:[`Europe/Andorra`],AE:[`Asia/Dubai`],AF:[`Asia/Kabul`],AG:[`America/Antigua`],AI:[`America/Anguilla`],AL:[`Europe/Tirane`],AM:[`Asia/Yerevan`],AO:[`Africa/Luanda`],AR:[`America/Argentina/Buenos_Aires`,`America/Argentina/Catamarca`,`America/Argentina/ComodRivadavia`,`America/Argentina/Cordoba`,`America/Argentina/Jujuy`,`America/Argentina/La_Rioja`,`America/Argentina/Mendoza`,`America/Argentina/Rio_Gallegos`,`America/Argentina/Salta`,`America/Argentina/San_Juan`,`America/Argentina/San_Luis`,`America/Argentina/Tucuman`,`America/Argentina/Ushuaia`,`America/Buenos_Aires`,`America/Catamarca`,`America/Cordoba`,`America/Jujuy`,`America/Mendoza`,`America/Rosario`],AS:[`Pacific/Pago_Pago`,`Pacific/Samoa`,`US/Samoa`],AT:[`Europe/Vienna`],AU:[`Antarctica/Macquarie`,`Australia/Adelaide`,`Australia/Brisbane`,`Australia/Broken_Hill`,`Australia/Canberra`,`Australia/Currie`,`Australia/Darwin`,`Australia/Eucla`,`Australia/Hobart`,`Australia/LHI`,`Australia/Lindeman`,`Australia/Lord_Howe`,`Australia/Melbourne`,`Australia/NSW`,`Australia/North`,`Australia/Perth`,`Australia/Queensland`,`Australia/South`,`Australia/Sydney`,`Australia/Tasmania`,`Australia/Victoria`,`Australia/West`,`Australia/Yancowinna`],AW:[`America/Aruba`],AX:[`Europe/Mariehamn`],AZ:[`Asia/Baku`],BA:[`Europe/Sarajevo`],BB:[`America/Barbados`],BD:[`Asia/Dacca`,`Asia/Dhaka`],BE:[`Europe/Brussels`],BF:[`Africa/Ouagadougou`],BG:[`Europe/Sofia`],BH:[`Asia/Bahrain`],BI:[`Africa/Bujumbura`],BJ:[`Africa/Porto-Novo`],BL:[`America/St_Barthelemy`],BM:[`Atlantic/Bermuda`],BN:[`Asia/Brunei`],BO:[`America/La_Paz`],BQ:[`America/Kralendijk`],BR:[`America/Araguaina`,`America/Bahia`,`America/Belem`,`America/Boa_Vista`,`America/Campo_Grande`,`America/Cuiaba`,`America/Eirunepe`,`America/Fortaleza`,`America/Maceio`,`America/Manaus`,`America/Noronha`,`America/Porto_Acre`,`America/Porto_Velho`,`America/Recife`,`America/Rio_Branco`,`America/Santarem`,`America/Sao_Paulo`,`Brazil/DeNoronha`,`Brazil/East`,`Brazil/West`],BS:[`America/Nassau`],BT:[`Asia/Thimbu`,`Asia/Thimphu`],BW:[`Africa/Gaborone`],BY:[`Europe/Minsk`],BZ:[`America/Belize`],CA:`America/Atikokan.America/Blanc-Sablon.America/Cambridge_Bay.America/Coral_Harbour.America/Creston.America/Dawson.America/Dawson_Creek.America/Edmonton.America/Fort_Nelson.America/Glace_Bay.America/Goose_Bay.America/Halifax.America/Inuvik.America/Iqaluit.America/Moncton.America/Montreal.America/Nipigon.America/Pangnirtung.America/Rainy_River.America/Rankin_Inlet.America/Regina.America/Resolute.America/St_Johns.America/Swift_Current.America/Thunder_Bay.America/Toronto.America/Vancouver.America/Whitehorse.America/Winnipeg.America/Yellowknife.Canada/Atlantic.Canada/Central.Canada/Eastern.Canada/Mountain.Canada/Newfoundland.Canada/Pacific.Canada/Saskatchewan.Canada/Yukon`.split(`.`),CC:[`Indian/Cocos`],CD:[`Africa/Kinshasa`,`Africa/Lubumbashi`],CF:[`Africa/Bangui`],CG:[`Africa/Brazzaville`],CH:[`Europe/Zurich`],CI:[`Africa/Abidjan`],CK:[`Pacific/Rarotonga`],CL:[`America/Coyhaique`,`America/Punta_Arenas`,`America/Santiago`,`Chile/Continental`,`Chile/EasterIsland`,`Pacific/Easter`],CM:[`Africa/Douala`],CN:[`Asia/Chongqing`,`Asia/Harbin`,`Asia/Kashgar`,`Asia/Shanghai`,`Asia/Urumqi`],CO:[`America/Bogota`],CR:[`America/Costa_Rica`],CU:[`America/Havana`],CV:[`Atlantic/Cape_Verde`],CW:[`America/Curacao`],CX:[`Indian/Christmas`],CY:[`Asia/Famagusta`,`Asia/Nicosia`,`Europe/Nicosia`],CZ:[`Europe/Prague`],DE:[`Europe/Berlin`,`Europe/Busingen`],DJ:[`Africa/Djibouti`],DK:[`Europe/Copenhagen`],DM:[`America/Dominica`],DO:[`America/Santo_Domingo`],DZ:[`Africa/Algiers`],EC:[`America/Guayaquil`,`Pacific/Galapagos`],EE:[`Europe/Tallinn`],EG:[`Africa/Cairo`],EH:[`Africa/El_Aaiun`],ER:[`Africa/Asmara`,`Africa/Asmera`],ES:[`Africa/Ceuta`,`Atlantic/Canary`,`Europe/Madrid`],ET:[`Africa/Addis_Ababa`],FI:[`Europe/Helsinki`],FJ:[`Pacific/Fiji`],FK:[`Atlantic/Stanley`],FM:[`Pacific/Chuuk`,`Pacific/Kosrae`,`Pacific/Pohnpei`,`Pacific/Ponape`,`Pacific/Truk`,`Pacific/Yap`],FO:[`Atlantic/Faeroe`,`Atlantic/Faroe`],FR:[`Europe/Paris`],GA:[`Africa/Libreville`],GB:[`Europe/Belfast`,`Europe/London`],GD:[`America/Grenada`],GE:[`Asia/Tbilisi`],GF:[`America/Cayenne`],GG:[`Europe/Guernsey`],GH:[`Africa/Accra`],GI:[`Europe/Gibraltar`],GL:[`America/Danmarkshavn`,`America/Godthab`,`America/Nuuk`,`America/Scoresbysund`,`America/Thule`],GM:[`Africa/Banjul`],GN:[`Africa/Conakry`],GP:[`America/Guadeloupe`],GQ:[`Africa/Malabo`],GR:[`Europe/Athens`],GT:[`America/Guatemala`],GU:[`Pacific/Guam`],GW:[`Africa/Bissau`],GY:[`America/Guyana`],HK:[`Asia/Hong_Kong`],HN:[`America/Tegucigalpa`],HR:[`Europe/Zagreb`],HT:[`America/Port-au-Prince`],HU:[`Europe/Budapest`],ID:[`Asia/Jakarta`,`Asia/Jayapura`,`Asia/Makassar`,`Asia/Pontianak`,`Asia/Ujung_Pandang`],IE:[`Europe/Dublin`],IL:[`Asia/Jerusalem`,`Asia/Tel_Aviv`],IM:[`Europe/Isle_of_Man`],IN:[`Asia/Calcutta`,`Asia/Kolkata`],IO:[`Indian/Chagos`],IQ:[`Asia/Baghdad`],IR:[`Asia/Tehran`],IS:[`Atlantic/Reykjavik`],IT:[`Europe/Rome`],JE:[`Europe/Jersey`],JM:[`America/Jamaica`],JO:[`Asia/Amman`],JP:[`Asia/Tokyo`],KE:[`Africa/Nairobi`],KG:[`Asia/Bishkek`],KH:[`Asia/Phnom_Penh`],KI:[`Pacific/Enderbury`,`Pacific/Kanton`,`Pacific/Kiritimati`,`Pacific/Tarawa`],KM:[`Indian/Comoro`],KN:[`America/St_Kitts`],KP:[`Asia/Pyongyang`],KR:[`Asia/Seoul`],KW:[`Asia/Kuwait`],KY:[`America/Cayman`],KZ:[`Asia/Almaty`,`Asia/Aqtau`,`Asia/Aqtobe`,`Asia/Atyrau`,`Asia/Oral`,`Asia/Qostanay`,`Asia/Qyzylorda`],LA:[`Asia/Vientiane`],LB:[`Asia/Beirut`],LC:[`America/St_Lucia`],LI:[`Europe/Vaduz`],LK:[`Asia/Colombo`],LR:[`Africa/Monrovia`],LS:[`Africa/Maseru`],LT:[`Europe/Vilnius`],LU:[`Europe/Luxembourg`],LV:[`Europe/Riga`],LY:[`Africa/Tripoli`],MA:[`Africa/Casablanca`],MC:[`Europe/Monaco`],MD:[`Europe/Chisinau`,`Europe/Tiraspol`],ME:[`Europe/Podgorica`],MF:[`America/Marigot`],MG:[`Indian/Antananarivo`],MH:[`Pacific/Kwajalein`,`Pacific/Majuro`],MK:[`Europe/Skopje`],ML:[`Africa/Bamako`,`Africa/Timbuktu`],MM:[`Asia/Rangoon`,`Asia/Yangon`],MN:[`Asia/Choibalsan`,`Asia/Hovd`,`Asia/Ulaanbaatar`,`Asia/Ulan_Bator`],MO:[`Asia/Macao`,`Asia/Macau`],MP:[`Pacific/Saipan`],MQ:[`America/Martinique`],MR:[`Africa/Nouakchott`],MS:[`America/Montserrat`],MT:[`Europe/Malta`],MU:[`Indian/Mauritius`],MV:[`Indian/Maldives`],MW:[`Africa/Blantyre`],MX:[`America/Bahia_Banderas`,`America/Cancun`,`America/Chihuahua`,`America/Ciudad_Juarez`,`America/Ensenada`,`America/Hermosillo`,`America/Matamoros`,`America/Mazatlan`,`America/Merida`,`America/Mexico_City`,`America/Monterrey`,`America/Ojinaga`,`America/Santa_Isabel`,`America/Tijuana`,`Mexico/BajaNorte`,`Mexico/BajaSur`,`Mexico/General`],MY:[`Asia/Kuala_Lumpur`,`Asia/Kuching`],MZ:[`Africa/Maputo`],NA:[`Africa/Windhoek`],NC:[`Pacific/Noumea`],NE:[`Africa/Niamey`],NF:[`Pacific/Norfolk`],NG:[`Africa/Lagos`],NI:[`America/Managua`],NL:[`Europe/Amsterdam`],NO:[`Europe/Oslo`],NP:[`Asia/Kathmandu`,`Asia/Katmandu`],NR:[`Pacific/Nauru`],NU:[`Pacific/Niue`],NZ:[`Pacific/Auckland`,`Pacific/Chatham`],OM:[`Asia/Muscat`],PA:[`America/Panama`],PE:[`America/Lima`],PF:[`Pacific/Gambier`,`Pacific/Marquesas`,`Pacific/Tahiti`],PG:[`Pacific/Bougainville`,`Pacific/Port_Moresby`],PH:[`Asia/Manila`],PK:[`Asia/Karachi`],PL:[`Europe/Warsaw`],PM:[`America/Miquelon`],PR:[`America/Puerto_Rico`],PS:[`Asia/Gaza`,`Asia/Hebron`],PT:[`Atlantic/Azores`,`Atlantic/Madeira`,`Europe/Lisbon`],PW:[`Pacific/Palau`],PY:[`America/Asuncion`],QA:[`Asia/Qatar`],RE:[`Indian/Reunion`],RO:[`Europe/Bucharest`],RS:[`Europe/Belgrade`],RU:`Asia/Anadyr.Asia/Barnaul.Asia/Chita.Asia/Irkutsk.Asia/Kamchatka.Asia/Khandyga.Asia/Krasnoyarsk.Asia/Magadan.Asia/Novokuznetsk.Asia/Novosibirsk.Asia/Omsk.Asia/Sakhalin.Asia/Srednekolymsk.Asia/Tomsk.Asia/Ust-Nera.Asia/Vladivostok.Asia/Yakutsk.Asia/Yekaterinburg.Europe/Astrakhan.Europe/Kaliningrad.Europe/Kirov.Europe/Moscow.Europe/Samara.Europe/Saratov.Europe/Ulyanovsk.Europe/Volgograd`.split(`.`),RW:[`Africa/Kigali`],SA:[`Asia/Riyadh`],SB:[`Pacific/Guadalcanal`],SC:[`Indian/Mahe`],SD:[`Africa/Khartoum`],SE:[`Europe/Stockholm`],SG:[`Asia/Singapore`],SH:[`Atlantic/St_Helena`],SI:[`Europe/Ljubljana`],SJ:[`Arctic/Longyearbyen`,`Atlantic/Jan_Mayen`],SK:[`Europe/Bratislava`],SL:[`Africa/Freetown`],SM:[`Europe/San_Marino`],SN:[`Africa/Dakar`],SO:[`Africa/Mogadishu`],SR:[`America/Paramaribo`],SS:[`Africa/Juba`],ST:[`Africa/Sao_Tome`],SV:[`America/El_Salvador`],SX:[`America/Lower_Princes`],SY:[`Asia/Damascus`],SZ:[`Africa/Mbabane`],TC:[`America/Grand_Turk`],TD:[`Africa/Ndjamena`],TG:[`Africa/Lome`],TH:[`Asia/Bangkok`],TJ:[`Asia/Dushanbe`],TK:[`Pacific/Fakaofo`],TL:[`Asia/Dili`],TM:[`Asia/Ashgabat`,`Asia/Ashkhabad`],TN:[`Africa/Tunis`],TO:[`Pacific/Tongatapu`],TR:[`Asia/Istanbul`,`Europe/Istanbul`],TT:[`America/Port_of_Spain`],TV:[`Pacific/Funafuti`],TW:[`Asia/Taipei`],TZ:[`Africa/Dar_es_Salaam`],UA:[`Europe/Kiev`,`Europe/Kyiv`,`Europe/Simferopol`,`Europe/Uzhgorod`,`Europe/Zaporozhye`],UG:[`Africa/Kampala`],US:`America/Adak.America/Anchorage.America/Atka.America/Boise.America/Chicago.America/Denver.America/Detroit.America/Fort_Wayne.America/Indiana/Indianapolis.America/Indiana/Knox.America/Indiana/Marengo.America/Indiana/Petersburg.America/Indiana/Tell_City.America/Indiana/Vevay.America/Indiana/Vincennes.America/Indiana/Winamac.America/Indianapolis.America/Juneau.America/Kentucky/Louisville.America/Kentucky/Monticello.America/Knox_IN.America/Los_Angeles.America/Louisville.America/Menominee.America/Metlakatla.America/New_York.America/Nome.America/North_Dakota/Beulah.America/North_Dakota/Center.America/North_Dakota/New_Salem.America/Phoenix.America/Shiprock.America/Sitka.America/Yakutat.Pacific/Honolulu.US/Alaska.US/Aleutian.US/Arizona.US/Central.US/East-Indiana.US/Eastern.US/Hawaii.US/Indiana-Starke.US/Michigan.US/Mountain.US/Pacific`.split(`.`),UY:[`America/Montevideo`],UZ:[`Asia/Samarkand`,`Asia/Tashkent`],VA:[`Europe/Vatican`],VC:[`America/St_Vincent`],VE:[`America/Caracas`],VG:[`America/Tortola`],VI:[`America/St_Thomas`,`America/Virgin`],VN:[`Asia/Ho_Chi_Minh`,`Asia/Saigon`],VU:[`Pacific/Efate`],WF:[`Pacific/Wallis`],WS:[`Pacific/Apia`],YE:[`Asia/Aden`],YT:[`Indian/Mayotte`],ZA:[`Africa/Johannesburg`],ZM:[`Africa/Lusaka`],ZW:[`Africa/Harare`]},_=new Set(m.map(([e])=>e)),v=new Map;for(let[e,t]of Object.entries(g))for(let n of t)v.set(n,e);function y(e){let t=e===void 0?void 0:v.get(e);return t&&_.has(t)?t:null}function b(e){if(!e)return null;let t;try{t=new Intl.Locale(e).region}catch{return null}return t&&_.has(t)?t:null}function x(){let e;try{e=Intl.DateTimeFormat().resolvedOptions().timeZone}catch{e=void 0}let t=typeof navigator>`u`?void 0:navigator.language;return y(e)||b(t)||null}var S=`ui-phone.global.js`;function C(){return window.WeborityPhone?Promise.resolve(window.WeborityPhone):new Promise((e,t)=>{let n=document.querySelector(`script[src*="${S}"]`);if(!n){let e=document.createElement(`script`);try{e.src=(0,l.assetUrl)(S)}catch(e){t(e);return}document.head.append(e),n=e}n.addEventListener(`load`,()=>window.WeborityPhone?e(window.WeborityPhone):t(Error(`The phone metadata script did not load.`))),n.addEventListener(`error`,()=>t(Error(`The phone metadata script failed to load.`)))})}function w(e,t){return e.isSupportedCountry(t)}var T=e=>e?`wui-flag wui-flag-${String(e).toLowerCase()}`:`wui-flag`,E=e=>e?`+${h(e)}`:``,D=null,O=null;function k(){return D?Promise.resolve(D):(O||=C().then(e=>(D=e,D)).catch(e=>((0,r.devError)(`[@webority/ui-elements] <wui-phone> could not load its phone number metadata.`,e),null)),O)}function A(e,t){let n=`+${h(e)}`;return t?.startsWith(n)?t.slice(n.length).trimStart():null}function j(e,t){if(!D||!t||!e||!w(D,e))return t;try{return A(e,new D.AsYouType(e).input(`+${h(e)}${t}`))||t}catch{return t}}function M(e,t){if(t<=0)return 0;let n=0;for(let r=0;r<e.length;r++)if(/[0-9]/.test(e[r]??``)&&(n+=1,n===t))return r+1;return e.length}function N(e){if(!D||!e||!w(D,e))return null;try{return A(e,D.getExampleNumber(e,D.examples)?.formatInternational())||null}catch{return null}}function P(e){let t=N(e);return t?`For example ${t}`:null}function F(e){if(!D||!e)return null;try{if(!D.isValidPhoneNumber(e))return!1;let t=D.parsePhoneNumber(e)?.getType?.();return t===void 0||t===`MOBILE`||t===`FIXED_LINE_OR_MOBILE`}catch{return null}}function I(e){if(!D||!e||!w(D,e))return null;try{let t=D.getExampleNumber(e,D.examples);return t?.nationalNumber?t.nationalNumber.length:null}catch{return null}}function L(e,t,n){if(!D||!w(D,e))return null;try{let r=D.parsePhoneNumber(t,e),i=r?.nationalNumber;return!i||r.country!==e||i.length>n||!t.endsWith(i)?null:i}catch{return null}}function R(e){if(!D||!e?.trim().startsWith(`+`))return null;try{let t=new D.AsYouType;t.input(e.trim());let n=t.getCountry();return!n||!W(t)?null:{country:n,national:t.getNationalNumber()||``}}catch{return null}}function z(e,t){let n=String(t??``).trim();if(!n.startsWith(`+`))return null;let r=n.replace(/[^0-9]/g,``),i=String(h(e));return{country:e,national:r.startsWith(i)?r.slice(i.length):r}}var B=class extends i.ElementBase{static formAssociated=!0;static get observedAttributes(){return[`value`,`country`,`locked-country`,`placeholder`,`disabled`,`readonly`,`loading`,`required`,`aria-label`,`aria-describedby`]}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._defaultCountry=x()||``,this._country=this._defaultCountry,this._national=``,this._active=-1,this._committedValue=``,this._validateOnInput=!1}connectedCallback(){this._rendered?this._bindGlobal?.():this.render()}attributeChangedCallback(e,t,n){if(e===`value`)this.value=n;else if(this._rendered){if(e===`aria-label`){let t=this.querySelector(`input[type=tel]`);t&&(n==null?t.removeAttribute(e):t.setAttribute(e,n))}else if(e===`aria-describedby`)this._syncDescribedBy();else if(e===`country`){if(this._locked)return;let e=this.value;if(this._country=n||this._defaultCountry,this._suppressCountryRender)return;this.render(),this.value!==e&&(this._emitInput(),this._emitChange())}else this.render()}}formResetCallback(){this._validateOnInput=!1,this.value=this._defaultValue||``}get _locked(){return(this.getAttribute(`locked-country`)||``).toUpperCase()||null}get value(){return this._national&&this._country?`+${h(this._country)}${this._national}`:``}set value(e){let t=String(e??``).trim();this._locked&&(this._country=this._locked);let n=this._locked?null:R(t);if(n)this._country=n.country,this._national=n.national.replace(/[^0-9]/g,``);else if(t.startsWith(`+`)){let e=t.replace(/[^0-9]/g,``),n=String(h(this._locked||this.getAttribute(`country`)||this._country));n&&e.startsWith(n)&&(e=e.slice(n.length)),this._national=e}else this._national=t.replace(/[^0-9]/g,``);n&&this.getAttribute(`country`)!==this._country?this.setAttribute(`country`,this._country):this._rendered&&this.render(),this._committedValue=this.value,this._syncMirror()}_syncMirror(){(0,o.syncFormMirror)(this,this.value)}_syncDescribedBy(){let e=this.querySelector(`input[type=tel]`);if(!e)return;let t=[this.getAttribute(`aria-describedby`),this.querySelector(`[data-phone-error]`)?.id].filter(Boolean);t.length?e.setAttribute(`aria-describedby`,t.join(` `)):e.removeAttribute(`aria-describedby`)}_emitInput(){this.dispatchEvent(new Event(`input`,{bubbles:!0}))}_emitChange(){this._committedValue=this.value,this.dispatchEvent(new Event(`change`,{bubbles:!0}))}render(){this._defaultValue===void 0&&(this._defaultValue=this.getAttribute(`value`)||``),this._country=this._locked||this.getAttribute(`country`)||this._country;let e=this.getAttribute(`placeholder`)||P(this._country)||`Enter phone number`;this.id||=`wui-phone-${Math.random().toString(36).slice(2,9)}`;let t=`${this.id}-listbox`;this._listboxId=t;let n=this._locked?`<div class="phone-country-adornment"><span class="wui-phone-prefix"><span class="${T(this._country)}" data-flag aria-hidden="true"></span><span class="phone-dial" data-dial>${E(this._country)}</span></span></div>`:`<div class="phone-country-adornment">
2
2
  <button type="button" class="country-toggle" aria-label="Choose country" aria-haspopup="listbox" aria-expanded="false" aria-controls="${G(t)}"${this.hasAttribute(`disabled`)?` disabled`:``}>
3
3
  <span class="${T(this._country)}" data-flag aria-hidden="true"></span>
4
4
  ${(0,s.glyphSvg)(`chevron-down`,{className:`phone-chevron`})}
@@ -1 +1 @@
1
- (function(e,t,n){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var r=globalThis.WeborityUiElementsInternal?.version;if(r!==`0.154.0`)throw Error(`[webority-ui] resizable expects ui-elements 0.154.0 but the page loaded `+r+`.`);var i=`wui-resizable-panel`,a=`wui-resizable-handle`,o=5,s=20,c=10,l=`wui-resizable:`,u=.001,d=0,f=e=>e.reduce((e,t)=>e+t,0),p=(e,t,n)=>Math.min(Math.max(e,t),n),m=e=>Math.round(e*10)/10,h=(e,t)=>e[t]??NaN,g=(e,t)=>e.length===t.length&&e.every((e,n)=>Math.abs(e-h(t,n))<u);function _(e,t,n){let r=e.map((e,r)=>p(e,h(t,r),h(n,r)));for(let e=0;e<r.length;e++){let e=100-f(r);if(Math.abs(e)<u)break;let i=r.map((r,i)=>e>0?h(n,i)-r:r-h(t,i)),a=f(i);if(a<=0)break;let o=Math.min(Math.abs(e),a);r=r.map((t,n)=>t+Math.sign(e)*o*h(i,n)/a)}return r}function v(e,t,n,r){let i=h(e,t)+h(e,t+1);return[Math.max(h(n,t),i-h(r,t+1)),Math.min(h(r,t),i-h(n,t+1))]}function y(e,t,n,r,i){let[a,o]=v(e,t,r,i);if(a>o)return e;let s=h(e,t)+h(e,t+1),c=p(h(e,t)+n,a,o),l=[...e];return l[t]=c,l[t+1]=s-c,l}function b(e){let t=e.filter(e=>e===null).length,n=f(e.filter(e=>e!==null));if(t>0&&n<100)return e.map(e=>e??(100-n)/t);let r=e.map(e=>e??1),i=f(r);return r.map(e=>e*100/i)}var x=e=>Array.isArray(e)&&e.every(e=>typeof e==`number`),S=(e,t)=>{let n=Number.parseFloat(e.getAttribute(t)??``);return Number.isFinite(n)&&n>0?n:null},C=class extends n.ElementBase{_panels;_handles;_mins;_maxs;_defaults;_sizes;_drag;_observer;_onPointerDown;_onPointerMove;_onPointerUp;_onPointerCancel;_onKeyDown;_onDoubleClick;constructor(){super(),this._panels=[],this._handles=[],this._mins=[],this._maxs=[],this._defaults=[],this._sizes=null,this._drag=null,this._observer=null,this._onPointerDown=e=>this._pointerDown(e),this._onPointerMove=e=>this._pointerMove(e),this._onPointerUp=e=>this._pointerUp(e,!1),this._onPointerCancel=e=>this._pointerUp(e,!0),this._onKeyDown=e=>this._keyDown(e),this._onDoubleClick=e=>this._reset(e)}connectedCallback(){this.addEventListener(`pointerdown`,this._onPointerDown),this.addEventListener(`pointermove`,this._onPointerMove),this.addEventListener(`pointerup`,this._onPointerUp),this.addEventListener(`pointercancel`,this._onPointerCancel),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`dblclick`,this._onDoubleClick),typeof MutationObserver<`u`&&(this._observer=new MutationObserver(()=>this._sync()),this._observer.observe(this,{childList:!0})),this._sync()}disconnectedCallback(){this.removeEventListener(`pointerdown`,this._onPointerDown),this.removeEventListener(`pointermove`,this._onPointerMove),this.removeEventListener(`pointerup`,this._onPointerUp),this.removeEventListener(`pointercancel`,this._onPointerCancel),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`dblclick`,this._onDoubleClick),this._observer?.disconnect(),this._observer=null,this._drag=null}get sizes(){return this._sizes?[...this._sizes]:[]}get _vertical(){return this.getAttribute(`direction`)===`vertical`}_sync(){let e=[...this.children];this._panels=e.filter(e=>e instanceof HTMLElement&&e.classList.contains(i)),this._handles=e.filter(e=>e instanceof HTMLElement&&e.classList.contains(a));let t=this._panels.length;if(t===0)return;this._mins=this._panels.map(e=>S(e,`data-min-size`)??c),this._maxs=this._panels.map(e=>S(e,`data-max-size`)??100),this._defaults=_(b(this._panels.map(e=>S(e,`data-default-size`))),this._mins,this._maxs);let n=this._sizes&&this._sizes.length===t?this._sizes:null;this._sizes=_(n??this._load(t)??this._defaults,this._mins,this._maxs);for(let e of this._panels)e.id||=`wui-resizable-panel-${++d}`;this._render()}_render(){let e=this._sizes??[];this._panels.forEach((t,n)=>{t.style.flex=`${m(e[n]??0)} 1 0px`});for(let t of this._handles){let n=this._indexOf(t);if(n<0)continue;let[r,i]=v(e,n,this._mins,this._maxs),a=this._panels[n];a&&(t.setAttribute(`aria-controls`,a.id),t.setAttribute(`aria-valuenow`,String(Math.round(e[n]??0))),t.setAttribute(`aria-valuemin`,String(Math.ceil(r-u))),t.setAttribute(`aria-valuemax`,String(Math.floor(i+u))))}}_indexOf(e){let t=e.previousElementSibling,n=t instanceof HTMLElement?this._panels.indexOf(t):-1;return n>=0&&e.nextElementSibling===this._panels[n+1]?n:-1}_handleFor(e){let t=e.target instanceof Element?e.target.closest(`.${a}`):null;if(!(t instanceof HTMLElement)||t.parentElement!==this)return null;let n=this._indexOf(t);return n<0?null:{handle:t,index:n}}_storageKey(){let e=this.getAttribute(`storage-key`);return e?l+e:null}_load(e){let t=this._storageKey();if(!t)return null;try{let n=JSON.parse(globalThis.localStorage?.getItem(t)??`null`);return x(n)&&n.length===e&&n.every((e,t)=>Number.isFinite(e)&&e>=h(this._mins,t)-u&&e<=h(this._maxs,t)+u)&&Math.abs(f(n)-100)<.5?n:null}catch{return null}}_save(){let e=this._storageKey();if(e)try{globalThis.localStorage?.setItem(e,JSON.stringify((this._sizes??[]).map(m)))}catch(e){if(!(e instanceof DOMException))throw e}}_commit(e){g(e,this._sizes??[])||(this._save(),this.dispatchEvent(new CustomEvent(`wui-resizable:change`,{bubbles:!0,detail:{sizes:this.sizes}})))}_pointerDown(e){let t=this._handleFor(e);if(!t||e.pointerType===`mouse`&&e.button!==0)return;let n=this._panels.reduce((e,t)=>{let n=t.getBoundingClientRect();return e+(this._vertical?n.height:n.width)},0);n<=0||(e.preventDefault(),t.handle.setPointerCapture?.(e.pointerId),t.handle.focus?.({preventScroll:!0}),this._drag={...t,pointerId:e.pointerId,start:this._vertical?e.clientY:e.clientX,before:[...this._sizes??[]],room:n,flip:!this._vertical&&getComputedStyle(this).direction===`rtl`},this.classList.add(`is-dragging`),t.handle.classList.add(`is-active`))}_pointerMove(e){let t=this._drag;if(!t||e.pointerId!==t.pointerId)return;let n=(this._vertical?e.clientY:e.clientX)-t.start,r=(t.flip?-n:n)*100/t.room;this._sizes=y(t.before,t.index,r,this._mins,this._maxs),this._render()}_pointerUp(e,t){let n=this._drag;n&&e.pointerId===n.pointerId&&(this._drag=null,this.classList.remove(`is-dragging`),n.handle.classList.remove(`is-active`),n.handle.releasePointerCapture?.(e.pointerId),t?(this._sizes=n.before,this._render()):this._commit(n.before))}_keyDown(e){let t=this._handleFor(e);if(!t||e.altKey||e.ctrlKey||e.metaKey)return;let[n,r]=this._vertical?[`ArrowUp`,`ArrowDown`]:[`ArrowLeft`,`ArrowRight`],i=!this._vertical&&getComputedStyle(this).direction===`rtl`,a=e.shiftKey?s:o,c;if(e.key===n)c=i?a:-a;else if(e.key===r)c=i?-a:a;else if(e.key===`Home`)c=-1/0;else if(e.key===`End`)c=1/0;else return;e.preventDefault();let l=[...this._sizes??[]];this._sizes=y(l,t.index,c,this._mins,this._maxs),this._render(),this._commit(l)}_reset(e){if(!this._handleFor(e))return;let t=[...this._sizes??[]];this._sizes=[...this._defaults],this._render(),this._commit(t)}};(0,t.defineElement)(`wui-resizable`,C),e.WuiResizable=C})(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.155.0`)throw Error(`[webority-ui] resizable expects ui-elements 0.155.0 but the page loaded `+r+`.`);var i=`wui-resizable-panel`,a=`wui-resizable-handle`,o=5,s=20,c=10,l=`wui-resizable:`,u=.001,d=0,f=e=>e.reduce((e,t)=>e+t,0),p=(e,t,n)=>Math.min(Math.max(e,t),n),m=e=>Math.round(e*10)/10,h=(e,t)=>e[t]??NaN,g=(e,t)=>e.length===t.length&&e.every((e,n)=>Math.abs(e-h(t,n))<u);function _(e,t,n){let r=e.map((e,r)=>p(e,h(t,r),h(n,r)));for(let e=0;e<r.length;e++){let e=100-f(r);if(Math.abs(e)<u)break;let i=r.map((r,i)=>e>0?h(n,i)-r:r-h(t,i)),a=f(i);if(a<=0)break;let o=Math.min(Math.abs(e),a);r=r.map((t,n)=>t+Math.sign(e)*o*h(i,n)/a)}return r}function v(e,t,n,r){let i=h(e,t)+h(e,t+1);return[Math.max(h(n,t),i-h(r,t+1)),Math.min(h(r,t),i-h(n,t+1))]}function y(e,t,n,r,i){let[a,o]=v(e,t,r,i);if(a>o)return e;let s=h(e,t)+h(e,t+1),c=p(h(e,t)+n,a,o),l=[...e];return l[t]=c,l[t+1]=s-c,l}function b(e){let t=e.filter(e=>e===null).length,n=f(e.filter(e=>e!==null));if(t>0&&n<100)return e.map(e=>e??(100-n)/t);let r=e.map(e=>e??1),i=f(r);return r.map(e=>e*100/i)}var x=e=>Array.isArray(e)&&e.every(e=>typeof e==`number`),S=(e,t)=>{let n=Number.parseFloat(e.getAttribute(t)??``);return Number.isFinite(n)&&n>0?n:null},C=class extends n.ElementBase{_panels;_handles;_mins;_maxs;_defaults;_sizes;_drag;_observer;_onPointerDown;_onPointerMove;_onPointerUp;_onPointerCancel;_onKeyDown;_onDoubleClick;constructor(){super(),this._panels=[],this._handles=[],this._mins=[],this._maxs=[],this._defaults=[],this._sizes=null,this._drag=null,this._observer=null,this._onPointerDown=e=>this._pointerDown(e),this._onPointerMove=e=>this._pointerMove(e),this._onPointerUp=e=>this._pointerUp(e,!1),this._onPointerCancel=e=>this._pointerUp(e,!0),this._onKeyDown=e=>this._keyDown(e),this._onDoubleClick=e=>this._reset(e)}connectedCallback(){this.addEventListener(`pointerdown`,this._onPointerDown),this.addEventListener(`pointermove`,this._onPointerMove),this.addEventListener(`pointerup`,this._onPointerUp),this.addEventListener(`pointercancel`,this._onPointerCancel),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`dblclick`,this._onDoubleClick),typeof MutationObserver<`u`&&(this._observer=new MutationObserver(()=>this._sync()),this._observer.observe(this,{childList:!0})),this._sync()}disconnectedCallback(){this.removeEventListener(`pointerdown`,this._onPointerDown),this.removeEventListener(`pointermove`,this._onPointerMove),this.removeEventListener(`pointerup`,this._onPointerUp),this.removeEventListener(`pointercancel`,this._onPointerCancel),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`dblclick`,this._onDoubleClick),this._observer?.disconnect(),this._observer=null,this._drag=null}get sizes(){return this._sizes?[...this._sizes]:[]}get _vertical(){return this.getAttribute(`direction`)===`vertical`}_sync(){let e=[...this.children];this._panels=e.filter(e=>e instanceof HTMLElement&&e.classList.contains(i)),this._handles=e.filter(e=>e instanceof HTMLElement&&e.classList.contains(a));let t=this._panels.length;if(t===0)return;this._mins=this._panels.map(e=>S(e,`data-min-size`)??c),this._maxs=this._panels.map(e=>S(e,`data-max-size`)??100),this._defaults=_(b(this._panels.map(e=>S(e,`data-default-size`))),this._mins,this._maxs);let n=this._sizes&&this._sizes.length===t?this._sizes:null;this._sizes=_(n??this._load(t)??this._defaults,this._mins,this._maxs);for(let e of this._panels)e.id||=`wui-resizable-panel-${++d}`;this._render()}_render(){let e=this._sizes??[];this._panels.forEach((t,n)=>{t.style.flex=`${m(e[n]??0)} 1 0px`});for(let t of this._handles){let n=this._indexOf(t);if(n<0)continue;let[r,i]=v(e,n,this._mins,this._maxs),a=this._panels[n];a&&(t.setAttribute(`aria-controls`,a.id),t.setAttribute(`aria-valuenow`,String(Math.round(e[n]??0))),t.setAttribute(`aria-valuemin`,String(Math.ceil(r-u))),t.setAttribute(`aria-valuemax`,String(Math.floor(i+u))))}}_indexOf(e){let t=e.previousElementSibling,n=t instanceof HTMLElement?this._panels.indexOf(t):-1;return n>=0&&e.nextElementSibling===this._panels[n+1]?n:-1}_handleFor(e){let t=e.target instanceof Element?e.target.closest(`.${a}`):null;if(!(t instanceof HTMLElement)||t.parentElement!==this)return null;let n=this._indexOf(t);return n<0?null:{handle:t,index:n}}_storageKey(){let e=this.getAttribute(`storage-key`);return e?l+e:null}_load(e){let t=this._storageKey();if(!t)return null;try{let n=JSON.parse(globalThis.localStorage?.getItem(t)??`null`);return x(n)&&n.length===e&&n.every((e,t)=>Number.isFinite(e)&&e>=h(this._mins,t)-u&&e<=h(this._maxs,t)+u)&&Math.abs(f(n)-100)<.5?n:null}catch{return null}}_save(){let e=this._storageKey();if(e)try{globalThis.localStorage?.setItem(e,JSON.stringify((this._sizes??[]).map(m)))}catch(e){if(!(e instanceof DOMException))throw e}}_commit(e){g(e,this._sizes??[])||(this._save(),this.dispatchEvent(new CustomEvent(`wui-resizable:change`,{bubbles:!0,detail:{sizes:this.sizes}})))}_pointerDown(e){let t=this._handleFor(e);if(!t||e.pointerType===`mouse`&&e.button!==0)return;let n=this._panels.reduce((e,t)=>{let n=t.getBoundingClientRect();return e+(this._vertical?n.height:n.width)},0);n<=0||(e.preventDefault(),t.handle.setPointerCapture?.(e.pointerId),t.handle.focus?.({preventScroll:!0}),this._drag={...t,pointerId:e.pointerId,start:this._vertical?e.clientY:e.clientX,before:[...this._sizes??[]],room:n,flip:!this._vertical&&getComputedStyle(this).direction===`rtl`},this.classList.add(`is-dragging`),t.handle.classList.add(`is-active`))}_pointerMove(e){let t=this._drag;if(!t||e.pointerId!==t.pointerId)return;let n=(this._vertical?e.clientY:e.clientX)-t.start,r=(t.flip?-n:n)*100/t.room;this._sizes=y(t.before,t.index,r,this._mins,this._maxs),this._render()}_pointerUp(e,t){let n=this._drag;n&&e.pointerId===n.pointerId&&(this._drag=null,this.classList.remove(`is-dragging`),n.handle.classList.remove(`is-active`),n.handle.releasePointerCapture?.(e.pointerId),t?(this._sizes=n.before,this._render()):this._commit(n.before))}_keyDown(e){let t=this._handleFor(e);if(!t||e.altKey||e.ctrlKey||e.metaKey)return;let[n,r]=this._vertical?[`ArrowUp`,`ArrowDown`]:[`ArrowLeft`,`ArrowRight`],i=!this._vertical&&getComputedStyle(this).direction===`rtl`,a=e.shiftKey?s:o,c;if(e.key===n)c=i?a:-a;else if(e.key===r)c=i?-a:a;else if(e.key===`Home`)c=-1/0;else if(e.key===`End`)c=1/0;else return;e.preventDefault();let l=[...this._sizes??[]];this._sizes=y(l,t.index,c,this._mins,this._maxs),this._render(),this._commit(l)}_reset(e){if(!this._handleFor(e))return;let t=[...this._sizes??[]];this._sizes=[...this._defaults],this._render(),this._commit(t)}};(0,t.defineElement)(`wui-resizable`,C),e.WuiResizable=C})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.elementBase);
@@ -1 +1 @@
1
- (function(e,t,n,r,i){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var a=globalThis.WeborityUiElementsInternal?.version;if(a!==`0.154.0`)throw Error(`[webority-ui] saved-views expects ui-elements 0.154.0 but the page loaded `+a+`.`);var o=`wui-saved-views:`,s=20,c=0,l=e=>typeof e==`object`&&!!e&&`name`in e&&typeof e.name==`string`&&`query`in e&&typeof e.query==`string`,u=class extends r.ElementBase{static get observedAttributes(){return[`key`,`mode`,`action`,`can-share`]}_doc=null;_dom=null;_views;_open;_busy;_error;_trigger;_onTriggerClick;_onKeyDown;_onPointerDown;_onSubmit;constructor(){super(),this._views=[],this._open=!1,this._busy=!1,this._error=null,this._onTriggerClick=()=>this._setOpen(!this._open),this._onKeyDown=e=>{this._open&&e.target instanceof Node&&this.contains(e.target)&&(e.key===`Escape`?(e.stopPropagation(),this._setOpen(!1),this._trigger?.focus()):(e.key===`ArrowDown`||e.key===`ArrowUp`)&&this._ui.menu.contains(e.target)&&!(e.target instanceof Element&&/input|textarea/i.test(e.target.tagName))&&(e.preventDefault(),e.stopPropagation()))},this._onPointerDown=e=>{this._open&&!e.composedPath().includes(this)&&this._setOpen(!1)},this._onSubmit=async e=>{e.preventDefault();let t=this._ui.input.value.trim();if(!t)return;if(this._server()){if(this._busy)return;let e={name:t,query:this._ownerDoc.location.search};this._canShare()&&(e.shared=String(this._ui.share.checked)),await this._request(`save`,e)&&(this._ui.input.value=``,this._ui.share.checked=!1);return}let n=this._ownerDoc.location.search;this._commit([{name:t,query:n},...this._views.filter(e=>e.name!==t)].slice(0,s)),this._ui.input.value=``}}get _ownerDoc(){if(!this._doc)throw Error(`wui-saved-views is not connected`);return this._doc}get _ui(){if(!this._dom)throw Error(`wui-saved-views is not built`);return this._dom}connectedCallback(){this._doc=this.ownerDocument,this._trigger||this._build(),window.addEventListener(`keydown`,this._onKeyDown,!0),this._reload()}disconnectedCallback(){this._setOpen(!1),window.removeEventListener(`keydown`,this._onKeyDown,!0),this._doc=null}attributeChangedCallback(){this._doc&&this._trigger&&this._reload()}_reload(){this._server()?(this._views=[],this._render(),this._request(`list`)):(this._views=this._load(),this._render())}_server(){return this.getAttribute(`mode`)===`server`&&!!this.getAttribute(`action`)&&!!this.getAttribute(`key`)}_canShare(){return this._server()&&this.getAttribute(`can-share`)===`true`}async _request(e,t={}){let n=this.getAttribute(`action`)??``,r=this.getAttribute(`key`)??``,a=n,o;e===`list`?a+=(n.includes(`?`)?`&`:`?`)+new URLSearchParams({intent:`list`,key:r}):o={method:`POST`,body:new URLSearchParams({intent:e,key:r,...t})},this._busy=!0,this._render();let s=await(0,i.wuiFetch)(a,o);if(this._busy=!1,this._doc===null)return!1;if(s.ok){let e=new DOMParser().parseFromString(s.html,`text/html`);return this._views=[...e.querySelectorAll(`[data-wui-saved-views-items] > li`)].filter(e=>e instanceof HTMLLIElement).map(e=>({name:e.dataset.name,query:e.dataset.query,shared:e.dataset.shared===`true`})).filter(l),this._error=null,this._render(),!0}return this._error=s.message||`The views could not be updated. Try again.`,this._render(),!1}_build(){let e=this._ownerDoc;this.classList.add(`dropdown`),this._trigger=e.createElement(`button`),this._trigger.type=`button`,this._trigger.className=(0,n.buttonClass)(`neutral`,`outline`,`sm`),this._trigger.dataset.wui=n.APP_BUTTON_MARKER,this._trigger.textContent=`Views`,this._trigger.setAttribute(`aria-haspopup`,`true`),this._trigger.setAttribute(`aria-expanded`,`false`),this._trigger.addEventListener(`click`,this._onTriggerClick);let t=e.createElement(`div`);t.className=`dropdown-menu`;let r=e.createElement(`div`);r.className=`dropdown-divider`;let i=e.createElement(`input`);i.type=`text`,i.className=`form-control form-control-sm`,i.setAttribute(`aria-label`,`View name`),i.placeholder=`Name this view`;let a=e.createElement(`button`);a.type=`submit`,a.className=(0,n.buttonClass)(`primary`,`solid`,`sm`),a.dataset.wui=n.APP_BUTTON_MARKER,a.textContent=`Save this view`;let o=e.createElement(`form`);o.className=`d-flex gap-2 px-3 py-2`,o.append(i,a),o.addEventListener(`submit`,this._onSubmit);let s=e.createElement(`input`);s.type=`checkbox`,s.className=`form-check-input`,s.setAttribute(`role`,`switch`),s.id=`wui-saved-views-share-${c++}`;let l=e.createElement(`label`);l.className=`form-check-label`,l.htmlFor=s.id,l.textContent=`Share with the team`;let u=e.createElement(`div`);u.className=`form-check form-switch mb-0`,u.append(s,l);let d=e.createElement(`div`);d.className=`px-3 pb-2`,d.hidden=!0,d.append(u),this._dom={menu:t,divider:r,form:o,input:i,save:a,shareRow:d,share:s},this.append(this._trigger,t)}_render(){let e=this._ownerDoc,t=this._ui,n=[];for(let t of this._views){let r=e.createElement(`a`);if(r.className=`dropdown-item`,r.setAttribute(`href`,e.location.pathname+t.query),r.textContent=t.name,t.shared){let t=e.createElement(`span`);t.className=`badge text-bg-secondary ms-2`,t.textContent=`Shared`,r.append(t)}let i=e.createElement(`button`);i.type=`button`,i.className=`btn btn-link btn-sm`,i.textContent=`Delete`,i.setAttribute(`aria-label`,`Delete ${t.name}`),i.disabled=this._busy,i.addEventListener(`click`,()=>this._server()?this._request(`delete`,{name:t.name}):this._commit(this._views.filter(e=>e.name!==t.name))),n.push(r,i)}if(this._error){let t=e.createElement(`div`);t.className=`dropdown-item-text text-danger small`,t.setAttribute(`role`,`alert`),t.textContent=this._error,n.push(t)}t.save.disabled=this._busy,t.share.disabled=this._busy,t.shareRow.hidden=!this._canShare(),t.menu.replaceChildren(...n,t.divider,t.form,t.shareRow)}_commit(e){this._views=e,this._write(e),this._render()}_setOpen(e){e!==this._open&&(this._open=e,this._ui.menu.classList.toggle(`show`,e),this._trigger?.setAttribute(`aria-expanded`,String(e)),e?this._ownerDoc.addEventListener(`pointerdown`,this._onPointerDown,!0):this._ownerDoc.removeEventListener(`pointerdown`,this._onPointerDown,!0))}_storage(){let e=this.getAttribute(`key`);if(!e)return null;try{let t=this._ownerDoc.defaultView;return t?{store:t.localStorage,key:o+e}:null}catch{return null}}_load(){let e=this._storage();if(!e)return[];try{let t=JSON.parse(e.store.getItem(e.key)??`[]`);return Array.isArray(t)?t.filter(l).slice(0,s):[]}catch{return[]}}_write(e){let t=this._storage();if(t)try{t.store.setItem(t.key,JSON.stringify(e))}catch(e){if(!(e instanceof DOMException))throw e}}};(0,t.defineElement)(`wui-saved-views`,u),e.WuiSavedViews=u})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.buttonClass,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.wuiHttp);
1
+ (function(e,t,n,r,i){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var a=globalThis.WeborityUiElementsInternal?.version;if(a!==`0.155.0`)throw Error(`[webority-ui] saved-views expects ui-elements 0.155.0 but the page loaded `+a+`.`);var o=`wui-saved-views:`,s=20,c=0,l=e=>typeof e==`object`&&!!e&&`name`in e&&typeof e.name==`string`&&`query`in e&&typeof e.query==`string`,u=class extends r.ElementBase{static get observedAttributes(){return[`key`,`mode`,`action`,`can-share`]}_doc=null;_dom=null;_views;_open;_busy;_error;_trigger;_onTriggerClick;_onKeyDown;_onPointerDown;_onSubmit;constructor(){super(),this._views=[],this._open=!1,this._busy=!1,this._error=null,this._onTriggerClick=()=>this._setOpen(!this._open),this._onKeyDown=e=>{this._open&&e.target instanceof Node&&this.contains(e.target)&&(e.key===`Escape`?(e.stopPropagation(),this._setOpen(!1),this._trigger?.focus()):(e.key===`ArrowDown`||e.key===`ArrowUp`)&&this._ui.menu.contains(e.target)&&!(e.target instanceof Element&&/input|textarea/i.test(e.target.tagName))&&(e.preventDefault(),e.stopPropagation()))},this._onPointerDown=e=>{this._open&&!e.composedPath().includes(this)&&this._setOpen(!1)},this._onSubmit=async e=>{e.preventDefault();let t=this._ui.input.value.trim();if(!t)return;if(this._server()){if(this._busy)return;let e={name:t,query:this._ownerDoc.location.search};this._canShare()&&(e.shared=String(this._ui.share.checked)),await this._request(`save`,e)&&(this._ui.input.value=``,this._ui.share.checked=!1);return}let n=this._ownerDoc.location.search;this._commit([{name:t,query:n},...this._views.filter(e=>e.name!==t)].slice(0,s)),this._ui.input.value=``}}get _ownerDoc(){if(!this._doc)throw Error(`wui-saved-views is not connected`);return this._doc}get _ui(){if(!this._dom)throw Error(`wui-saved-views is not built`);return this._dom}connectedCallback(){this._doc=this.ownerDocument,this._trigger||this._build(),window.addEventListener(`keydown`,this._onKeyDown,!0),this._reload()}disconnectedCallback(){this._setOpen(!1),window.removeEventListener(`keydown`,this._onKeyDown,!0),this._doc=null}attributeChangedCallback(){this._doc&&this._trigger&&this._reload()}_reload(){this._server()?(this._views=[],this._render(),this._request(`list`)):(this._views=this._load(),this._render())}_server(){return this.getAttribute(`mode`)===`server`&&!!this.getAttribute(`action`)&&!!this.getAttribute(`key`)}_canShare(){return this._server()&&this.getAttribute(`can-share`)===`true`}async _request(e,t={}){let n=this.getAttribute(`action`)??``,r=this.getAttribute(`key`)??``,a=n,o;e===`list`?a+=(n.includes(`?`)?`&`:`?`)+new URLSearchParams({intent:`list`,key:r}):o={method:`POST`,body:new URLSearchParams({intent:e,key:r,...t})},this._busy=!0,this._render();let s=await(0,i.wuiFetch)(a,o);if(this._busy=!1,this._doc===null)return!1;if(s.ok){let e=new DOMParser().parseFromString(s.html,`text/html`);return this._views=[...e.querySelectorAll(`[data-wui-saved-views-items] > li`)].filter(e=>e instanceof HTMLLIElement).map(e=>({name:e.dataset.name,query:e.dataset.query,shared:e.dataset.shared===`true`})).filter(l),this._error=null,this._render(),!0}return this._error=s.message||`The views could not be updated. Try again.`,this._render(),!1}_build(){let e=this._ownerDoc;this.classList.add(`dropdown`),this._trigger=e.createElement(`button`),this._trigger.type=`button`,this._trigger.className=(0,n.buttonClass)(`neutral`,`outline`,`sm`),this._trigger.dataset.wui=n.APP_BUTTON_MARKER,this._trigger.textContent=`Views`,this._trigger.setAttribute(`aria-haspopup`,`true`),this._trigger.setAttribute(`aria-expanded`,`false`),this._trigger.addEventListener(`click`,this._onTriggerClick);let t=e.createElement(`div`);t.className=`dropdown-menu`;let r=e.createElement(`div`);r.className=`dropdown-divider`;let i=e.createElement(`input`);i.type=`text`,i.className=`form-control form-control-sm`,i.setAttribute(`aria-label`,`View name`),i.placeholder=`Name this view`;let a=e.createElement(`button`);a.type=`submit`,a.className=(0,n.buttonClass)(`primary`,`solid`,`sm`),a.dataset.wui=n.APP_BUTTON_MARKER,a.textContent=`Save this view`;let o=e.createElement(`form`);o.className=`d-flex gap-2 px-3 py-2`,o.append(i,a),o.addEventListener(`submit`,this._onSubmit);let s=e.createElement(`input`);s.type=`checkbox`,s.className=`form-check-input`,s.setAttribute(`role`,`switch`),s.id=`wui-saved-views-share-${c++}`;let l=e.createElement(`label`);l.className=`form-check-label`,l.htmlFor=s.id,l.textContent=`Share with the team`;let u=e.createElement(`div`);u.className=`form-check form-switch mb-0`,u.append(s,l);let d=e.createElement(`div`);d.className=`px-3 pb-2`,d.hidden=!0,d.append(u),this._dom={menu:t,divider:r,form:o,input:i,save:a,shareRow:d,share:s},this.append(this._trigger,t)}_render(){let e=this._ownerDoc,t=this._ui,n=[];for(let t of this._views){let r=e.createElement(`a`);if(r.className=`dropdown-item`,r.setAttribute(`href`,e.location.pathname+t.query),r.textContent=t.name,t.shared){let t=e.createElement(`span`);t.className=`badge text-bg-secondary ms-2`,t.textContent=`Shared`,r.append(t)}let i=e.createElement(`button`);i.type=`button`,i.className=`btn btn-link btn-sm`,i.textContent=`Delete`,i.setAttribute(`aria-label`,`Delete ${t.name}`),i.disabled=this._busy,i.addEventListener(`click`,()=>this._server()?this._request(`delete`,{name:t.name}):this._commit(this._views.filter(e=>e.name!==t.name))),n.push(r,i)}if(this._error){let t=e.createElement(`div`);t.className=`dropdown-item-text text-danger small`,t.setAttribute(`role`,`alert`),t.textContent=this._error,n.push(t)}t.save.disabled=this._busy,t.share.disabled=this._busy,t.shareRow.hidden=!this._canShare(),t.menu.replaceChildren(...n,t.divider,t.form,t.shareRow)}_commit(e){this._views=e,this._write(e),this._render()}_setOpen(e){e!==this._open&&(this._open=e,this._ui.menu.classList.toggle(`show`,e),this._trigger?.setAttribute(`aria-expanded`,String(e)),e?this._ownerDoc.addEventListener(`pointerdown`,this._onPointerDown,!0):this._ownerDoc.removeEventListener(`pointerdown`,this._onPointerDown,!0))}_storage(){let e=this.getAttribute(`key`);if(!e)return null;try{let t=this._ownerDoc.defaultView;return t?{store:t.localStorage,key:o+e}:null}catch{return null}}_load(){let e=this._storage();if(!e)return[];try{let t=JSON.parse(e.store.getItem(e.key)??`[]`);return Array.isArray(t)?t.filter(l).slice(0,s):[]}catch{return[]}}_write(e){let t=this._storage();if(t)try{t.store.setItem(t.key,JSON.stringify(e))}catch(e){if(!(e instanceof DOMException))throw e}}};(0,t.defineElement)(`wui-saved-views`,u),e.WuiSavedViews=u})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.buttonClass,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.wuiHttp);
@@ -1,2 +1,2 @@
1
- (function(e,t,n,r,i,a){var o=Object.defineProperty,s=(e,t)=>{let n={};for(var r in e)o(n,r,{get:e[r],enumerable:!0});return t||o(n,Symbol.toStringTag,{value:`Module`}),n},c=globalThis.WeborityUiElementsInternal?.version;if(c!==`0.154.0`)throw Error(`[webority-ui] select-chips expects ui-elements 0.154.0 but the page loaded `+c+`.`);var l={enter:`Enter`,comma:`,`,space:` `,tab:`Tab`},u={enter:`
1
+ (function(e,t,n,r,i,a){var o=Object.defineProperty,s=(e,t)=>{let n={};for(var r in e)o(n,r,{get:e[r],enumerable:!0});return t||o(n,Symbol.toStringTag,{value:`Module`}),n},c=globalThis.WeborityUiElementsInternal?.version;if(c!==`0.155.0`)throw Error(`[webority-ui] select-chips expects ui-elements 0.155.0 but the page loaded `+c+`.`);var l={enter:`Enter`,comma:`,`,space:` `,tab:`Tab`},u={enter:`
2
2
  `,comma:`,`,space:` `,tab:` `},d=e=>l[e],ee=e=>u[e];function f(e,t){let n=[String(e??``)];for(let e of t)n=n.flatMap(t=>t.split(e));return n.map(e=>e.trim()).filter(Boolean)}var p=(e,t)=>t.some(t=>String(e??``).includes(t)),m=new Map,h=e=>{if(m.has(e))return m.get(e)??null;let t=null;try{t=RegExp(`^(?:${e})$`,`u`)}catch{(0,r.devWarn)(`<wui-select> pattern is not a valid regular expression and is ignored: ${e}`)}return m.set(e,t),t},te=(e,t)=>{let n=e.getAttribute(`invalid-message`)||`Enter a valid value.`,r=e.getAttribute(`pattern`);if(r){let e=h(r);if(e&&!e.test(t))return n}let i=e.validate;if(typeof i!=`function`)return``;let a=i(t);return a===!0?``:typeof a==`string`&&a?a:n},g=s({default:()=>y});function _(e,t){if(e===null)throw TypeError(`The chip row needs ${t}, and it is not mounted.`);return e}var v=(e,t)=>{let n=document.createElement(e);return n.className=t,n};function y(){let r,a,o=null,s=null,c=null,l=null,u=null,m=null,h=null,g=null,y=!1,b=()=>_(s,`the draft input`),x=()=>r.mode===`tag`,S=()=>Array.isArray(r.value)?r.value.slice():[],C=()=>(r.getAttribute(`separators`)||`enter,comma`).split(`,`).map(e=>e.trim()).filter(Boolean),w=()=>new Set(C().map(d).filter(Boolean)),T=()=>{let e=parseInt(r.getAttribute(`max-tags`)??``,10);return e>0?e:0},ne=()=>{let e=T();return e>0&&S().length>=e},E=(e,t)=>!r.hasAttribute(`allow-duplicates`)&&e.some(e=>e.toLowerCase()===t.toLowerCase()),D=e=>(r.options||[]).find(t=>String(t.value)===String(e)),O=e=>{let t=e.trim().toLowerCase();return(r.options||[]).find(e=>String(e.value??``).toLowerCase()===t||(0,n.optionText)(e).trim().toLowerCase()===t)},k=e=>{for(let t of C()){let n=ee(t)??t;if(p(e,[n]))return f(e,[n])}return[e.trim()]},A=()=>s?s.value:r._query||``,j=()=>x()||r.hasAttribute(`allow-custom`),M=()=>r.getAttribute(`placeholder`)||(x()?`Add…`:`Select…`),N=()=>{let e=r.getAttribute(`aria-label`);if(e)return e;let t=r.closest(`label`)?.textContent?.trim();if(t)return t;let n=r.id;return(n?[...document.querySelectorAll(`label[for]`)].find(e=>e instanceof HTMLLabelElement&&e.htmlFor===n):void 0)?.textContent?.trim()||(x()?`Add tags`:`Select`)},P=()=>{s&&(s.setAttribute(`aria-expanded`,String(!a.menu.hidden)),a.list.id&&s.setAttribute(`aria-controls`,a.list.id),s.setAttribute(`aria-label`,N()))},re=()=>!(0,e.isReadOnly)(r)&&!r.hasAttribute(`loading`),ie=e=>{y=!0,b().setAttribute(`aria-invalid`,`true`),r.setError(e)},F=()=>{y&&(y=!1,b().removeAttribute(`aria-invalid`),r.setError(null))},I=(e,{quiet:t=!1,strip:n=!1}={})=>{let i=S(),a=i.slice(),o=T(),s=[],c=``,l=!1;for(let t of e){let e=(n?t.trim().replace(/,+$/,``):t).trim();if(!e)continue;if(o&&a.length>=o)break;let i=O(e);if(i){if(i.disabled){s.push(e),c||=i.disabledHint||r.getAttribute(`invalid-message`)||`That option is not available.`;continue}E(a,String(i.value))||a.push(String(i.value));continue}let u=te(r,e);u?(s.push(e),c||=u):E(a,e)||(a.push(e),l=!0)}a.length!==i.length&&(l?r.commit(a,{isCustom:!0}):r.commit(a)),b().value=s.join(`, `),c?t||ie(c):F()},L=t=>{(0,e.isInert)(r)||I([b().value],t)},R=e=>r.commit(S().filter(t=>t!==e)),z=()=>{let e=v(`span`,`wui-select-placeholder`);return e.textContent=r.getAttribute(`placeholder`)||`Select…`,e},B=e=>{let r=D(e),i=v(`span`,`chip chip-sm`),a=v(`span`,`chip-label`);if(a.innerHTML=r?(0,n.optionLabelHtml)(r):(0,n.escapeHtml)(e),i.append(a),re()){let a=v(`button`,`chip-remove`);a.type=`button`,a.dataset.remove=e;let o=r?(0,n.optionText)(r):(0,n.stripTags)(e);a.setAttribute(`aria-label`,`Remove ${o}`),a.innerHTML=(0,t.glyphSvg)(`x`),i.append(a)}return i};function V(){if(!o)return;o.querySelector(`:scope > .chip-more`)?.remove();let e=[...o.querySelectorAll(`:scope > .chip`)].map(e=>{if(!(e instanceof HTMLElement))throw Error(`The chip row holds a node that is not an element.`);return e});for(let t of e)t.style.display=``;let t=e.at(-1);if(!r.hasAttribute(`collapse-chips`)||!t)return;let n=o.clientWidth,i=e=>e.offsetLeft+e.offsetWidth;if(i(t)<=n)return;let a=v(`span`,`chip chip-sm chip-more`);a.textContent=`+${e.length}`,t.after(a);let s=a.offsetWidth+6,c=0;for(let t of e)if(i(t)<=n-s)c+=1;else break;c<1&&(c=1);for(let t of e.slice(c))t.style.display=`none`;a.textContent=`+${e.length-c}`}function H(){if(!o)return!1;o.parentNode!==a.value&&a.value.append(o);for(let e of o.querySelectorAll(`:scope > .chip, :scope > .wui-select-placeholder`))e.remove();let t=S(),n=o,i=e=>{s?n.insertBefore(e,s):n.append(e)};x()||s||t.length||i(z());for(let e of t)i(B(e));return s&&(s.placeholder=x()||!t.length?M():``,s.disabled=r.hasAttribute(`disabled`),s.readOnly=(0,e.isInert)(r),P()),x()||(_(l,`the footer text`).textContent=(r.getAttribute(`selected-text`)||`{n} selected`).replace(`{n}`,()=>String(t.length)),_(u,`the clear-all button`).textContent=r.getAttribute(`clear-all-label`)||`Clear all`),V(),!0}function U(e){if(e.key===`Backspace`){let t=s?!A():!A()&&!a.menu.hidden,n=S().at(-1);return!t||n===void 0?!1:(e.preventDefault(),R(n),!0)}if(!s)return!1;let t=s.value;if(e.key===`Escape`){if(!x())return!1;let n=!a.menu.hidden;return!n&&!t?!1:(n&&(e.preventDefault(),e.stopPropagation()),s.value=``,F(),r.closeMenu({focusControl:!1}),!0)}let n=!x()&&!t.trim(),i=w();return e.key===`Enter`&&i.has(`Enter`)?n||a.list.querySelector(`.is-active`)?!1:(e.preventDefault(),L(),!0):e.key===`,`&&i.has(`,`)?!n&&(e.preventDefault(),L({strip:!0}),!0):e.key===` `&&i.has(` `)&&t.trim()||e.key===`Tab`&&i.has(`Tab`)&&!n?(e.preventDefault(),L(),!0):!1}function W(e){let t=String(e.value);if(x()||s&&!D(t))return I([t]),!0;let n=S();return n.includes(t)?r.commit(n.filter(e=>e!==t)):s?I([t]):r.commit([...n,t]),s?.value&&(s.value=``,F()),!0}function G(e){if(!s)return null;let t=String(e??``).trim().replace(/,+$/,``).trim();if(!t||ne()||O(t)||E(S(),t))return null;let n=r.getAttribute(`create-label`)||`Create '{text}'`;return{position:x()?`top`:`bottom`,label:n.replace(`{text}`,()=>t),value:t}}function K(t){let n=t.target,i=n instanceof Element?n.closest(`[data-remove]`):null;if(i instanceof HTMLElement){if((0,e.isInert)(r))return;t.stopPropagation(),R(i.dataset.remove??``),s?.focus()}else s&&!(0,e.isInert)(r)&&s.focus()}function q(){F();let e=b().value.trim();!x()&&e&&a.menu.hidden&&(G(e)||(0,i.filterOptions)(r.options||[],e).length)&&r.openMenu()}function J(t){t.preventDefault(),(0,e.isInert)(r)||I(k(t.clipboardData?.getData(`text/plain`)??``))}function Y(){b().value.trim()&&L({quiet:!0,strip:!0}),r.closeMenu({focusControl:!1})}function X(e){e.relatedTarget instanceof Node&&r.contains(e.relatedTarget)||Y()}function ae(){return s?(Y(),!0):!1}function Z(){b().value.trim()&&L({strip:!0})}function Q(){(0,e.isInert)(r)||r.commit([])}function $(e){e.target!==s&&e.preventDefault()}function oe(e,t,n={}){r=e,a=t,o=v(`div`,`wui-select-chips`),o.addEventListener(`click`,K),a.value.append(o),j()&&(s=v(`input`,`wui-select-draft`),s.type=`text`,s.setAttribute(`autocomplete`,`off`),s.setAttribute(`role`,`combobox`),s.setAttribute(`aria-autocomplete`,`list`),r.hasAttribute(`required`)&&s.setAttribute(`aria-required`,`true`),g=new MutationObserver(P),g.observe(a.menu,{attributes:!0,attributeFilter:[`hidden`]}),o.append(s),s.value=n.carry?.draft??``,a.input=s,s.addEventListener(`input`,q),s.addEventListener(`paste`,J),s.addEventListener(`blur`,X),o.addEventListener(`mousedown`,$),m=r.closest(`form`),m?.addEventListener(`submit`,Z,!0)),x()||(c=v(`div`,`wui-select-footer`),l=document.createElement(`span`),u=v(`button`,`wui-select-clear-all`),u.type=`button`,u.addEventListener(`click`,Q),c.append(l,u),a.menu.append(c)),typeof ResizeObserver<`u`&&(h=new ResizeObserver(V),h.observe(o)),H()}function se(){o?.removeEventListener(`click`,K),o?.removeEventListener(`mousedown`,$),s&&(s.removeEventListener(`input`,q),s.removeEventListener(`paste`,J),s.removeEventListener(`blur`,X),a.input=null),u&&u.removeEventListener(`click`,Q),m?.removeEventListener(`submit`,Z,!0),m=null,h?.disconnect(),h=null,g?.disconnect(),g=null,c?.remove(),o?.remove(),o=null,s=null,c=null,y=!1}return{mount:oe,onKey:U,onPick:W,renderValue:H,actionRow:G,onQuery:()=>!1,onBlur:ae,teardown:se}}(0,a.registerSelectPart)(`chips`,g)})(WeborityUiElementsInternal.modules.fieldState,WeborityUiElementsInternal.modules.iconGlyphs,WeborityUiElementsInternal.modules.optionLabel,WeborityUiElementsInternal.modules.devWarn,WeborityUiElementsInternal.modules.selectList,WeborityUiElementsInternal.modules.partRegistry);
@@ -1 +1 @@
1
- (function(e,t){var n=Object.defineProperty,r=(e,t)=>{let r={};for(var i in e)n(r,i,{get:e[i],enumerable:!0});return t||n(r,Symbol.toStringTag,{value:`Module`}),r},i=globalThis.WeborityUiElementsInternal?.version;if(i!==`0.154.0`)throw Error(`[webority-ui] select-recents expects ui-elements 0.154.0 but the page loaded `+i+`.`);var a=r({default:()=>l}),o=`Recent`,s=5,c=20;function l(){let e,n=null,r=()=>e.getAttribute(`recents-key`)??``,i=()=>e.mode!==`tag`&&r()!==``,a=(e,r)=>{e!==n&&(n=e,(0,t.devWarn)(`<wui-select> recents-limit "${e}" ${r}.`))},l=()=>{let t=e.getAttribute(`recents-limit`);if(t===null)return s;let n=Number(t);return!Number.isInteger(n)||n<1?(a(t,`is not a whole number from 1 to 20; 5 is used`),s):n>c?(a(t,`is over 20; 20 is used`),c):n},u=()=>{let e;try{e=JSON.parse(globalThis.localStorage?.getItem(r())??`[]`)}catch{return[]}return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]},d=e=>{try{globalThis.localStorage?.setItem(r(),JSON.stringify(e))}catch(e){if(!(e instanceof DOMException))throw e}};return{mount(n){e=n,e.mode===`tag`?(0,t.devWarn)(`<wui-select> recents-key is not used in mode "tag"; it is ignored.`):r()===``&&(0,t.devWarn)(`<wui-select> recents-key is empty; no recents are kept.`)},onPick(t,n){if(!i()||n?.isCustom)return!1;let r=String(t.value);return r===``||Array.isArray(e.value)&&e.value.includes(r)||d([r,...u().filter(e=>e!==r)].slice(0,l())),!1},recents(t){if(!i())return null;let n=l(),r=[];for(let e of u()){let i=t.find(t=>String(t.value)===e);if(i&&!i.disabled&&r.push(i),r.length===n)break}return r.length?{label:e.getAttribute(`recents-label`)||o,options:r}:null},teardown(){}}}(0,e.registerSelectPart)(`recents`,a)})(WeborityUiElementsInternal.modules.partRegistry,WeborityUiElementsInternal.modules.devWarn);
1
+ (function(e,t){var n=Object.defineProperty,r=(e,t)=>{let r={};for(var i in e)n(r,i,{get:e[i],enumerable:!0});return t||n(r,Symbol.toStringTag,{value:`Module`}),r},i=globalThis.WeborityUiElementsInternal?.version;if(i!==`0.155.0`)throw Error(`[webority-ui] select-recents expects ui-elements 0.155.0 but the page loaded `+i+`.`);var a=r({default:()=>l}),o=`Recent`,s=5,c=20;function l(){let e,n=null,r=()=>e.getAttribute(`recents-key`)??``,i=()=>e.mode!==`tag`&&r()!==``,a=(e,r)=>{e!==n&&(n=e,(0,t.devWarn)(`<wui-select> recents-limit "${e}" ${r}.`))},l=()=>{let t=e.getAttribute(`recents-limit`);if(t===null)return s;let n=Number(t);return!Number.isInteger(n)||n<1?(a(t,`is not a whole number from 1 to 20; 5 is used`),s):n>c?(a(t,`is over 20; 20 is used`),c):n},u=()=>{let e;try{e=JSON.parse(globalThis.localStorage?.getItem(r())??`[]`)}catch{return[]}return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]},d=e=>{try{globalThis.localStorage?.setItem(r(),JSON.stringify(e))}catch(e){if(!(e instanceof DOMException))throw e}};return{mount(n){e=n,e.mode===`tag`?(0,t.devWarn)(`<wui-select> recents-key is not used in mode "tag"; it is ignored.`):r()===``&&(0,t.devWarn)(`<wui-select> recents-key is empty; no recents are kept.`)},onPick(t,n){if(!i()||n?.isCustom)return!1;let r=String(t.value);return r===``||Array.isArray(e.value)&&e.value.includes(r)||d([r,...u().filter(e=>e!==r)].slice(0,l())),!1},recents(t){if(!i())return null;let n=l(),r=[];for(let e of u()){let i=t.find(t=>String(t.value)===e);if(i&&!i.disabled&&r.push(i),r.length===n)break}return r.length?{label:e.getAttribute(`recents-label`)||o,options:r}:null},teardown(){}}}(0,e.registerSelectPart)(`recents`,a)})(WeborityUiElementsInternal.modules.partRegistry,WeborityUiElementsInternal.modules.devWarn);
@@ -1 +1 @@
1
- (function(e,t,n,r){var i=Object.defineProperty,a=(e,t)=>{let n={};for(var r in e)i(n,r,{get:e[r],enumerable:!0});return t||i(n,Symbol.toStringTag,{value:`Module`}),n},o=globalThis.WeborityUiElementsInternal?.version;if(o!==`0.154.0`)throw Error(`[webority-ui] select-search expects ui-elements 0.154.0 but the page loaded `+o+`.`);var s=new Map,c=e=>{if(s.has(e))return s.get(e)??null;let n=null;try{n=RegExp(`^(?:${e})$`,`u`)}catch{(0,t.devWarn)(`<wui-select> pattern is not a valid regular expression and is ignored: ${e}`)}return s.set(e,n),n},l=(e,t)=>{let n=e.getAttribute(`invalid-message`)||`Enter a valid value.`,r=e.getAttribute(`pattern`);if(r){let e=c(r);if(e&&!e.test(t))return n}let i=e.validate;if(typeof i!=`function`)return``;let a=i(t);return a===!0?``:typeof a==`string`&&a?a:n},u=a({default:()=>f}),d=(e,t)=>{let r=t.toLowerCase(),i=e.getAttribute(`value-label`);return i&&String(e.value??``)!==``&&i.toLowerCase()===r?!0:e.options.some(e=>(0,n.optionText)(e).toLowerCase()===r||String(e.value??``).toLowerCase()===r)};function f(){let e,n,i=0,a,o=null,s=null,c=``,u=null,f=!1,p=()=>(0,r.searchesRemotely)(e),m=()=>typeof e.loadOptions!=`function`&&!e.getAttribute(`source`),h=(t,n,r)=>{let i=e.getAttribute(t);if(i==null||i.trim()===``)return n;let a=Number(i);return r(a)?a:n},g=()=>h(`min-chars`,1,e=>Number.isInteger(e)&&e>=0),_=()=>h(`debounce`,250,e=>Number.isFinite(e)&&e>=0),v=()=>{o?.abort(),o=null};function y(t,n){if(typeof e.loadOptions==`function`)return e.loadOptions(t,{signal:n});let r=e.getAttribute(`source`);if(r===null)throw Error(`search source attribute missing`);let i=`${r}${r.includes(`?`)?`&`:`?`}q=${encodeURIComponent(t)}`;return fetch(i,{signal:n,credentials:`same-origin`,headers:{Accept:`application/json`}}).then(e=>{if(!e.ok)throw Error(`search request failed with status ${e.status}`);return e.json()})}function b(n,r,i){r?((0,t.devWarn)(`wui-select: search failed`,i),e.setPartOptions([]),e.setStatus(`empty`)):(e.setPartOptions(n),e.setStatus(n.length?`idle`:`empty`))}async function x(e,t,n){let r=[],a=!1,s=null;try{if(r=await y(e,n),!Array.isArray(r))throw TypeError(`search results must be an array`)}catch(e){a=!0,s=e??Error(`search failed`)}finally{t===i&&(o=null,b(r,a,s))}}function S(t){let n=i;v(),m()?(f=!0,e.setStatus(`loading`)):(o=new AbortController,e.setStatus(`loading`),x(t,n,o.signal))}let C=(t,n)=>e.dispatchEvent(new CustomEvent(`search`,{bubbles:!0,detail:{query:t,seq:n}}));function w(t){i+=1,v(),clearTimeout(a),a=void 0,t.trim().length<g()?(e.setPartOptions([]),e.setStatus(`hint`)):(C(t,i),S(t))}return{mount(t,r,i={}){e=t,n=r;let a=n.search?.value??``;n.search&&i.carry?.query&&a===``&&(n.search.value=i.carry.query),a.trim()!==``&&e._onQueryChange(a)},onQuery(t){if(i+=1,v(),clearTimeout(a),a=void 0,c=t,u=null,f=!1,!p())return!1;if(t.trim().length<g())return e.setPartOptions([]),e.setStatus(`hint`),!0;let n=i;return a=setTimeout(()=>{a=void 0,C(t,n),S(t)},_()),!0},onOpen(){if(p()){if(u!==null){let e=u;u=null,w(e)}else g()===0&&e._query.trim()===``&&w(``)}},onOptions(){f&&(f=!1,e.setStatus(e.options.length?`idle`:`empty`))},onBlur(){if(e.mode!==`search`||!e.hasAttribute(`allow-custom`))return!1;let t=(n.search?.value??``).trim();if(!t||t===String(e.value)||d(e,t))return!1;let r=l(e,t);return r?(e.setError(r),!1):(e.commit(t,{isCustom:!0}),!0)},actionRow(t){if(s=null,e.mode===`tag`||!e.hasAttribute(`allow-custom`))return null;let n=t.trim();return!n||d(e,n)?null:(s={position:`bottom`,label:(e.getAttribute(`add-label`)??`Add '{query}'`).replaceAll(`{query}`,n),value:n},s)},onPick(t){if(!s||t.value!==s.value||t.label!==s.label)return!1;let n=s.value;return s=null,e.commit(n,{isCustom:!0}),!0},renderValue(){let t=e.value;if(!t||e.options.some(e=>String(e.value)===String(t)))return!1;let r=e.getAttribute(`value-label`);return r?(n.value.classList.remove(`wui-select-placeholder`),n.value.textContent=r,!0):!1},teardown(){(a!==void 0||o!==null||f)&&(u=c),f=!1,i+=1,clearTimeout(a),a=void 0,v(),s=null}}}(0,e.registerSelectPart)(`search`,u)})(WeborityUiElementsInternal.modules.partRegistry,WeborityUiElementsInternal.modules.devWarn,WeborityUiElementsInternal.modules.optionLabel,WeborityUiElementsInternal.modules.selectRemote);
1
+ (function(e,t,n,r){var i=Object.defineProperty,a=(e,t)=>{let n={};for(var r in e)i(n,r,{get:e[r],enumerable:!0});return t||i(n,Symbol.toStringTag,{value:`Module`}),n},o=globalThis.WeborityUiElementsInternal?.version;if(o!==`0.155.0`)throw Error(`[webority-ui] select-search expects ui-elements 0.155.0 but the page loaded `+o+`.`);var s=new Map,c=e=>{if(s.has(e))return s.get(e)??null;let n=null;try{n=RegExp(`^(?:${e})$`,`u`)}catch{(0,t.devWarn)(`<wui-select> pattern is not a valid regular expression and is ignored: ${e}`)}return s.set(e,n),n},l=(e,t)=>{let n=e.getAttribute(`invalid-message`)||`Enter a valid value.`,r=e.getAttribute(`pattern`);if(r){let e=c(r);if(e&&!e.test(t))return n}let i=e.validate;if(typeof i!=`function`)return``;let a=i(t);return a===!0?``:typeof a==`string`&&a?a:n},u=a({default:()=>f}),d=(e,t)=>{let r=t.toLowerCase(),i=e.getAttribute(`value-label`);return i&&String(e.value??``)!==``&&i.toLowerCase()===r?!0:e.options.some(e=>(0,n.optionText)(e).toLowerCase()===r||String(e.value??``).toLowerCase()===r)};function f(){let e,n,i=0,a,o=null,s=null,c=``,u=null,f=!1,p=()=>(0,r.searchesRemotely)(e),m=()=>typeof e.loadOptions!=`function`&&!e.getAttribute(`source`),h=(t,n,r)=>{let i=e.getAttribute(t);if(i==null||i.trim()===``)return n;let a=Number(i);return r(a)?a:n},g=()=>h(`min-chars`,1,e=>Number.isInteger(e)&&e>=0),_=()=>h(`debounce`,250,e=>Number.isFinite(e)&&e>=0),v=()=>{o?.abort(),o=null};function y(t,n){if(typeof e.loadOptions==`function`)return e.loadOptions(t,{signal:n});let r=e.getAttribute(`source`);if(r===null)throw Error(`search source attribute missing`);let i=`${r}${r.includes(`?`)?`&`:`?`}q=${encodeURIComponent(t)}`;return fetch(i,{signal:n,credentials:`same-origin`,headers:{Accept:`application/json`}}).then(e=>{if(!e.ok)throw Error(`search request failed with status ${e.status}`);return e.json()})}function b(n,r,i){r?((0,t.devWarn)(`wui-select: search failed`,i),e.setPartOptions([]),e.setStatus(`empty`)):(e.setPartOptions(n),e.setStatus(n.length?`idle`:`empty`))}async function x(e,t,n){let r=[],a=!1,s=null;try{if(r=await y(e,n),!Array.isArray(r))throw TypeError(`search results must be an array`)}catch(e){a=!0,s=e??Error(`search failed`)}finally{t===i&&(o=null,b(r,a,s))}}function S(t){let n=i;v(),m()?(f=!0,e.setStatus(`loading`)):(o=new AbortController,e.setStatus(`loading`),x(t,n,o.signal))}let C=(t,n)=>e.dispatchEvent(new CustomEvent(`search`,{bubbles:!0,detail:{query:t,seq:n}}));function w(t){i+=1,v(),clearTimeout(a),a=void 0,t.trim().length<g()?(e.setPartOptions([]),e.setStatus(`hint`)):(C(t,i),S(t))}return{mount(t,r,i={}){e=t,n=r;let a=n.search?.value??``;n.search&&i.carry?.query&&a===``&&(n.search.value=i.carry.query),a.trim()!==``&&e._onQueryChange(a)},onQuery(t){if(i+=1,v(),clearTimeout(a),a=void 0,c=t,u=null,f=!1,!p())return!1;if(t.trim().length<g())return e.setPartOptions([]),e.setStatus(`hint`),!0;let n=i;return a=setTimeout(()=>{a=void 0,C(t,n),S(t)},_()),!0},onOpen(){if(p()){if(u!==null){let e=u;u=null,w(e)}else g()===0&&e._query.trim()===``&&w(``)}},onOptions(){f&&(f=!1,e.setStatus(e.options.length?`idle`:`empty`))},onBlur(){if(e.mode!==`search`||!e.hasAttribute(`allow-custom`))return!1;let t=(n.search?.value??``).trim();if(!t||t===String(e.value)||d(e,t))return!1;let r=l(e,t);return r?(e.setError(r),!1):(e.commit(t,{isCustom:!0}),!0)},actionRow(t){if(s=null,e.mode===`tag`||!e.hasAttribute(`allow-custom`))return null;let n=t.trim();return!n||d(e,n)?null:(s={position:`bottom`,label:(e.getAttribute(`add-label`)??`Add '{query}'`).replaceAll(`{query}`,n),value:n},s)},onPick(t){if(!s||t.value!==s.value||t.label!==s.label)return!1;let n=s.value;return s=null,e.commit(n,{isCustom:!0}),!0},renderValue(){let t=e.value;if(!t||e.options.some(e=>String(e.value)===String(t)))return!1;let r=e.getAttribute(`value-label`);return r?(n.value.classList.remove(`wui-select-placeholder`),n.value.textContent=r,!0):!1},teardown(){(a!==void 0||o!==null||f)&&(u=c),f=!1,i+=1,clearTimeout(a),a=void 0,v(),s=null}}}(0,e.registerSelectPart)(`search`,u)})(WeborityUiElementsInternal.modules.partRegistry,WeborityUiElementsInternal.modules.devWarn,WeborityUiElementsInternal.modules.optionLabel,WeborityUiElementsInternal.modules.selectRemote);
@@ -1,4 +1,4 @@
1
- (function(e,t,n,r,i){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var a=globalThis.WeborityUiElementsInternal?.version;if(a!==`0.154.0`)throw Error(`[webority-ui] slider expects ui-elements 0.154.0 but the page loaded `+a+`.`);var o=class extends n.ElementBase{static formAssociated=!0;_internals;_value;_start;_end;_isDragging;_dragThumb;_pointerDownListener;_pointerMoveListener;_pointerUpListener;_thumbKeyListener;_trackClickListener;_rendered;_defaultsCaptured;_defaultValue;_defaultStart;_defaultEnd;static get observedAttributes(){return[`min`,`max`,`step`,`value`,`start`,`end`,`name`,`start-name`,`end-name`,`disabled`,`readonly`,`loading`,`size`,`show-value`,`unit`,`aria-label`]}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._value=50,this._start=25,this._end=75,this._isDragging=!1,this._dragThumb=null,this._pointerDownListener=null,this._pointerMoveListener=null,this._pointerUpListener=null,this._thumbKeyListener=null,this._trackClickListener=null}connectedCallback(){this._rendered?this._wire():this.render()}get value(){return this._value}set value(e){this._value=this._snapToStep(this._clamp(s(e,this._value))),this._syncValue(),this._syncMirrors()}get start(){return this._start}set start(e){this._start=Math.min(this._snapToStep(this._clamp(s(e,this._start))),this._end),this._syncValue(),this._syncMirrors()}get end(){return this._end}set end(e){this._end=Math.max(this._snapToStep(this._clamp(s(e,this._end))),this._start),this._syncValue(),this._syncMirrors()}attributeChangedCallback(e,t,n){e===`value`||e===`start`||e===`end`||e===`min`||e===`max`||e===`step`?(this._updateFromAttribute(e),this._rendered&&(this._syncValue(),this._syncMirrors())):this._rendered&&this.render()}formResetCallback(){this._isRange()?this._resetRange():this._resetSingle()}_updateFromAttribute(e){e===`value`?this._value=this._snapToStep(this._clamp(s(this.getAttribute(`value`),this._value))):e===`start`?this._start=this._snapToStep(this._clamp(s(this.getAttribute(`start`),this._start))):e===`end`&&(this._end=this._snapToStep(this._clamp(s(this.getAttribute(`end`),this._end))))}_isRange(){return this.hasAttribute(`range`)}_min(){return s(this.getAttribute(`min`),0)}_max(){return s(this.getAttribute(`max`),100)}_step(){return s(this.getAttribute(`step`),1)}_clamp(e){return Math.max(this._min(),Math.min(e,this._max()))}_snapToStep(e){let t=this._step();if(t<=0)return e;let n=this._min();return this._clamp(n+Math.round((e-n)/t)*t)}_captureDefaults(){this._defaultsCaptured||=(this._isRange()?(this._defaultStart=this._start,this._defaultEnd=this._end):this._defaultValue=this._value,!0)}_resetSingle(){this._value=this._defaultValue??50,this._syncValue(),this._syncMirrors()}_resetRange(){this._start=this._defaultStart??25,this._end=this._defaultEnd??75,this._syncValue(),this._syncMirrors()}render(){this._captureDefaults();let e=this._min(),t=this._max(),n=this._isRange(),i=this.getAttribute(`size`),a=i===`sm`?` slider-sm`:i===`lg`?` slider-lg`:``,o=this.hasAttribute(`disabled`),s=this.hasAttribute(`readonly`)?` aria-readonly="true"`:``;n?(this._start=this._clamp(this._start),this._end=this._clamp(this._end),this._start>this._end&&([this._start,this._end]=[this._end,this._start])):this._value=this._clamp(this._value),this.innerHTML=`
1
+ (function(e,t,n,r,i){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var a=globalThis.WeborityUiElementsInternal?.version;if(a!==`0.155.0`)throw Error(`[webority-ui] slider expects ui-elements 0.155.0 but the page loaded `+a+`.`);var o=class extends n.ElementBase{static formAssociated=!0;_internals;_value;_start;_end;_isDragging;_dragThumb;_pointerDownListener;_pointerMoveListener;_pointerUpListener;_thumbKeyListener;_trackClickListener;_rendered;_defaultsCaptured;_defaultValue;_defaultStart;_defaultEnd;static get observedAttributes(){return[`min`,`max`,`step`,`value`,`start`,`end`,`name`,`start-name`,`end-name`,`disabled`,`readonly`,`loading`,`size`,`show-value`,`unit`,`aria-label`]}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._value=50,this._start=25,this._end=75,this._isDragging=!1,this._dragThumb=null,this._pointerDownListener=null,this._pointerMoveListener=null,this._pointerUpListener=null,this._thumbKeyListener=null,this._trackClickListener=null}connectedCallback(){this._rendered?this._wire():this.render()}get value(){return this._value}set value(e){this._value=this._snapToStep(this._clamp(s(e,this._value))),this._syncValue(),this._syncMirrors()}get start(){return this._start}set start(e){this._start=Math.min(this._snapToStep(this._clamp(s(e,this._start))),this._end),this._syncValue(),this._syncMirrors()}get end(){return this._end}set end(e){this._end=Math.max(this._snapToStep(this._clamp(s(e,this._end))),this._start),this._syncValue(),this._syncMirrors()}attributeChangedCallback(e,t,n){e===`value`||e===`start`||e===`end`||e===`min`||e===`max`||e===`step`?(this._updateFromAttribute(e),this._rendered&&(this._syncValue(),this._syncMirrors())):this._rendered&&this.render()}formResetCallback(){this._isRange()?this._resetRange():this._resetSingle()}_updateFromAttribute(e){e===`value`?this._value=this._snapToStep(this._clamp(s(this.getAttribute(`value`),this._value))):e===`start`?this._start=this._snapToStep(this._clamp(s(this.getAttribute(`start`),this._start))):e===`end`&&(this._end=this._snapToStep(this._clamp(s(this.getAttribute(`end`),this._end))))}_isRange(){return this.hasAttribute(`range`)}_min(){return s(this.getAttribute(`min`),0)}_max(){return s(this.getAttribute(`max`),100)}_step(){return s(this.getAttribute(`step`),1)}_clamp(e){return Math.max(this._min(),Math.min(e,this._max()))}_snapToStep(e){let t=this._step();if(t<=0)return e;let n=this._min();return this._clamp(n+Math.round((e-n)/t)*t)}_captureDefaults(){this._defaultsCaptured||=(this._isRange()?(this._defaultStart=this._start,this._defaultEnd=this._end):this._defaultValue=this._value,!0)}_resetSingle(){this._value=this._defaultValue??50,this._syncValue(),this._syncMirrors()}_resetRange(){this._start=this._defaultStart??25,this._end=this._defaultEnd??75,this._syncValue(),this._syncMirrors()}render(){this._captureDefaults();let e=this._min(),t=this._max(),n=this._isRange(),i=this.getAttribute(`size`),a=i===`sm`?` slider-sm`:i===`lg`?` slider-lg`:``,o=this.hasAttribute(`disabled`),s=this.hasAttribute(`readonly`)?` aria-readonly="true"`:``;n?(this._start=this._clamp(this._start),this._end=this._clamp(this._end),this._start>this._end&&([this._start,this._end]=[this._end,this._start])):this._value=this._clamp(this._value),this.innerHTML=`
2
2
  <div class="slider${a}">
3
3
  <div class="wui-slider-rail">
4
4
  <div class="slider-track" role="presentation"></div>