@webority/ui-elements 0.74.0 → 0.75.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -226,13 +226,13 @@ var WeborityUiElements=(function(e){Object.defineProperty(e,Symbol.toStringTag,{
226
226
  gap: 6px;
227
227
  }
228
228
  }
229
- `,ha=`data-wui-tour-open`,ga=`wui-consent-save`,_a=`[data-consent-settings]`,va=`tour-open`,G={heading:`Cookies on this site`,description:`We use cookies to understand how the site is used and to measure our campaigns. You can change your choice at any time.`,policyLabel:`Cookie policy`,essentialLabel:`Essential cookies`,essentialDescription:`Required for the site to work and stay secure. Always on.`,analyticsLabel:`Analytics cookies`,analyticsDescription:`Help us understand how visitors use the site.`,functionalLabel:`Functional cookies`,functionalDescription:`Remember choices you make, such as your preferences.`,marketingLabel:`Marketing cookies`,marketingDescription:`Measure how well our campaigns work.`,settingsLabel:`Cookie settings`,rejectLabel:`Reject all`,acceptLabel:`Accept all`,saveLabel:`Save preferences`},ya=[`analytics`,`functional`,`marketing`],ba={analytics:{label:G.analyticsLabel,description:`analyticsDescription`},functional:{label:G.functionalLabel,description:`functionalDescription`},marketing:{label:G.marketingLabel,description:`marketingDescription`}},xa=new Set;function Sa(e){xa.has(e)||(xa.add(e),console.warn(`[@webority/ui-elements] <wui-consent-banner> received categories containing "${e}", which is not one of ${ya.map(e=>`"${e}"`).join(` | `)}. It is ignored.`))}var Ca=0,wa=class extends l{static get observedAttributes(){return[`heading`,`description`,`policy-href`,`policy-label`,`analytics-description`,`functional-description`,`marketing-description`,`categories`]}constructor(){super(),Ca+=1,this._uid=`wui-consent-${Ca}`,this._preferences={analytics:!1,functional:!1,marketing:!1},this._settings=!1,this._onDocumentClick=e=>{e.target instanceof Element&&e.target.closest(_a)&&(e.preventDefault(),this.open({settings:!0,focus:!0}))},this._tourWatch=null}get position(){return this.getAttribute(`position`)===`bottom-right`?`bottom-right`:`bottom-left`}set position(e){this.setAttribute(`position`,String(e??`bottom-left`))}get standalone(){return this.hasAttribute(`standalone`)}set standalone(e){this.toggleAttribute(`standalone`,e===!0||e===``||e===`true`)}get heading(){return this.getAttribute(`heading`)||G.heading}set heading(e){this.setAttribute(`heading`,String(e??``))}get description(){return this.getAttribute(`description`)||G.description}set description(e){this.setAttribute(`description`,String(e??``))}get policyHref(){return this.getAttribute(`policy-href`)||``}set policyHref(e){this.setAttribute(`policy-href`,String(e??``))}get policyLabel(){return this.getAttribute(`policy-label`)||G.policyLabel}set policyLabel(e){this.setAttribute(`policy-label`,String(e??``))}get analyticsDescription(){return this.getAttribute(`analytics-description`)||G.analyticsDescription}set analyticsDescription(e){this.setAttribute(`analytics-description`,String(e??``))}get functionalDescription(){return this.getAttribute(`functional-description`)||G.functionalDescription}set functionalDescription(e){this.setAttribute(`functional-description`,String(e??``))}get marketingDescription(){return this.getAttribute(`marketing-description`)||G.marketingDescription}set marketingDescription(e){this.setAttribute(`marketing-description`,String(e??``))}get categories(){let e=this.getAttribute(`categories`);if(!e?.trim())return[...ya];let t=e.split(/\s+/).filter(Boolean);for(let e of t)ya.includes(e)||Sa(e);let n=ya.filter(e=>t.includes(e));return n.length?n:[...ya]}set categories(e){e==null?this.removeAttribute(`categories`):this.setAttribute(`categories`,Array.isArray(e)?e.join(` `):String(e))}get preferences(){let e=this.categories;return Object.fromEntries(ya.map(t=>[t,e.includes(t)&&this._preferences[t]]))}set preferences(e){this._preferences={analytics:e?.analytics===!0,functional:e?.functional===!0,marketing:e?.marketing===!0},this._applyPreferences()}get isOpen(){return this.hasAttribute(`open`)}connectedCallback(){this._rendered||this.render(),document.addEventListener(`click`,this._onDocumentClick),this._syncTour(),this._tourWatch??=new MutationObserver(()=>this._syncTour()),this._tourWatch.observe(document.documentElement,{attributes:!0,attributeFilter:[ha]})}disconnectedCallback(){document.removeEventListener(`click`,this._onDocumentClick),this._tourWatch?.disconnect()}_syncTour(){this.toggleAttribute(va,document.documentElement.hasAttribute(ha))}attributeChangedCallback(){this._rendered&&this.render()}render(){let e=this.isOpen,t=this._uid,n=this.policyHref?` <a class="wui-consent-banner-policy" href="${Da(this.policyHref)}">${Ea(this.policyLabel)}</a>`:``,r=this._root();r.innerHTML=`${r===this?``:`<style>${ma}</style>`}
229
+ `,ha=`data-wui-tour-open`,ga=`wui-consent-save`,_a=`[data-consent-settings]`,va=`tour-open`,ya=`--wui-consent-banner-block`,ba=`--wui-consent-banner-inline`,G={heading:`Cookies on this site`,description:`We use cookies to understand how the site is used and to measure our campaigns. You can change your choice at any time.`,policyLabel:`Cookie policy`,essentialLabel:`Essential cookies`,essentialDescription:`Required for the site to work and stay secure. Always on.`,analyticsLabel:`Analytics cookies`,analyticsDescription:`Help us understand how visitors use the site.`,functionalLabel:`Functional cookies`,functionalDescription:`Remember choices you make, such as your preferences.`,marketingLabel:`Marketing cookies`,marketingDescription:`Measure how well our campaigns work.`,settingsLabel:`Cookie settings`,rejectLabel:`Reject all`,acceptLabel:`Accept all`,saveLabel:`Save preferences`},xa=[`analytics`,`functional`,`marketing`],Sa={analytics:{label:G.analyticsLabel,description:`analyticsDescription`},functional:{label:G.functionalLabel,description:`functionalDescription`},marketing:{label:G.marketingLabel,description:`marketingDescription`}},Ca=new Set;function wa(e){Ca.has(e)||(Ca.add(e),console.warn(`[@webority/ui-elements] <wui-consent-banner> received categories containing "${e}", which is not one of ${xa.map(e=>`"${e}"`).join(` | `)}. It is ignored.`))}var Ta=0,Ea=class extends l{static get observedAttributes(){return[`heading`,`description`,`policy-href`,`policy-label`,`analytics-description`,`functional-description`,`marketing-description`,`categories`]}constructor(){super(),Ta+=1,this._uid=`wui-consent-${Ta}`,this._preferences={analytics:!1,functional:!1,marketing:!1},this._settings=!1,this._onDocumentClick=e=>{e.target instanceof Element&&e.target.closest(_a)&&(e.preventDefault(),this.open({settings:!0,focus:!0}))},this._tourWatch=null,this._roomObserver=null,this._onWindowResize=()=>this._reserveRoom()}get position(){return this.getAttribute(`position`)===`bottom-right`?`bottom-right`:`bottom-left`}set position(e){this.setAttribute(`position`,String(e??`bottom-left`))}get standalone(){return this.hasAttribute(`standalone`)}set standalone(e){this.toggleAttribute(`standalone`,e===!0||e===``||e===`true`)}get heading(){return this.getAttribute(`heading`)||G.heading}set heading(e){this.setAttribute(`heading`,String(e??``))}get description(){return this.getAttribute(`description`)||G.description}set description(e){this.setAttribute(`description`,String(e??``))}get policyHref(){return this.getAttribute(`policy-href`)||``}set policyHref(e){this.setAttribute(`policy-href`,String(e??``))}get policyLabel(){return this.getAttribute(`policy-label`)||G.policyLabel}set policyLabel(e){this.setAttribute(`policy-label`,String(e??``))}get analyticsDescription(){return this.getAttribute(`analytics-description`)||G.analyticsDescription}set analyticsDescription(e){this.setAttribute(`analytics-description`,String(e??``))}get functionalDescription(){return this.getAttribute(`functional-description`)||G.functionalDescription}set functionalDescription(e){this.setAttribute(`functional-description`,String(e??``))}get marketingDescription(){return this.getAttribute(`marketing-description`)||G.marketingDescription}set marketingDescription(e){this.setAttribute(`marketing-description`,String(e??``))}get categories(){let e=this.getAttribute(`categories`);if(!e?.trim())return[...xa];let t=e.split(/\s+/).filter(Boolean);for(let e of t)xa.includes(e)||wa(e);let n=xa.filter(e=>t.includes(e));return n.length?n:[...xa]}set categories(e){e==null?this.removeAttribute(`categories`):this.setAttribute(`categories`,Array.isArray(e)?e.join(` `):String(e))}get preferences(){let e=this.categories;return Object.fromEntries(xa.map(t=>[t,e.includes(t)&&this._preferences[t]]))}set preferences(e){this._preferences={analytics:e?.analytics===!0,functional:e?.functional===!0,marketing:e?.marketing===!0},this._applyPreferences()}get isOpen(){return this.hasAttribute(`open`)}connectedCallback(){this._rendered||this.render(),document.addEventListener(`click`,this._onDocumentClick),this._syncTour(),this._tourWatch??=new MutationObserver(()=>this._syncTour()),this._tourWatch.observe(document.documentElement,{attributes:!0,attributeFilter:[ha]}),this.isOpen&&this._trackRoom()}disconnectedCallback(){document.removeEventListener(`click`,this._onDocumentClick),this._tourWatch?.disconnect(),this._untrackRoom()}_syncTour(){this.toggleAttribute(va,document.documentElement.hasAttribute(ha))}attributeChangedCallback(){this._rendered&&this.render()}render(){let e=this.isOpen,t=this._uid,n=this.policyHref?` <a class="wui-consent-banner-policy" href="${ka(this.policyHref)}">${Oa(this.policyLabel)}</a>`:``,r=this._root();r.innerHTML=`${r===this?``:`<style>${ma}</style>`}
230
230
  <div class="wui-consent-banner-panel" role="dialog" aria-labelledby="${t}-heading" aria-describedby="${t}-description" hidden>
231
- <h2 class="wui-consent-banner-heading" id="${t}-heading">${Ea(this.heading)}</h2>
232
- <p class="wui-consent-banner-description" id="${t}-description">${Ea(this.description)}${n}</p>
231
+ <h2 class="wui-consent-banner-heading" id="${t}-heading">${Oa(this.heading)}</h2>
232
+ <p class="wui-consent-banner-description" id="${t}-description">${Oa(this.description)}${n}</p>
233
233
  <div class="wui-consent-banner-settings" hidden>
234
- ${Ta(t,`essential`,G.essentialLabel,G.essentialDescription,!0)}
235
- ${this.categories.map(e=>Ta(t,e,ba[e].label,this[ba[e].description],!1)).join(`
234
+ ${Da(t,`essential`,G.essentialLabel,G.essentialDescription,!0)}
235
+ ${this.categories.map(e=>Da(t,e,Sa[e].label,this[Sa[e].description],!1)).join(`
236
236
  `)}
237
237
  </div>
238
238
  <div class="wui-consent-banner-actions">
@@ -241,36 +241,36 @@ var WeborityUiElements=(function(e){Object.defineProperty(e,Symbol.toStringTag,{
241
241
  <button type="button" class="btn btn-sm btn-primary wui-consent-banner-accept">${G.acceptLabel}</button>
242
242
  <button type="button" class="btn btn-sm btn-primary wui-consent-banner-save" hidden>${G.saveLabel}</button>
243
243
  </div>
244
- </div>`,this._rendered=!0,this._wire(),this._applyPreferences(),this._showSettings(this._settings),e&&(this._panel().hidden=!1)}open({settings:e=!1,focus:t=!1}={}){this._rendered||this.render(),this._applyPreferences(),this._showSettings(e),this._panel().hidden=!1,this.setAttribute(`open`,``),t&&(e?this._root().querySelector(`.wui-consent-banner-category input:not([disabled])`):this._root().querySelector(`.wui-consent-banner-accept`))?.focus()}close(){let e=this._panel();e&&(e.hidden=!0),this.removeAttribute(`open`),this._showSettings(!1)}_root(){return this.shadowRoot?this.shadowRoot:this.standalone?this.attachShadow({mode:`open`}):this}_panel(){return this._root().querySelector(`.wui-consent-banner-panel`)}_wire(){let e=this._root();e.querySelector(`.wui-consent-banner-accept`)?.addEventListener(`click`,()=>this._save(this._choiceForShown(!0))),e.querySelector(`.wui-consent-banner-reject`)?.addEventListener(`click`,()=>this._save(this._choiceForShown(!1))),e.querySelector(`.wui-consent-banner-save`)?.addEventListener(`click`,()=>this._save(this._switchValues())),e.querySelector(`.wui-consent-banner-settings-toggle`)?.addEventListener(`click`,()=>this._showSettings(!this._settings))}_save(e){this._preferences={...e},this.dispatchEvent(new CustomEvent(ga,{bubbles:!0,composed:!0,detail:{...e}})),this.close()}_choiceForShown(e){let t=this.categories;return Object.fromEntries(ya.map(n=>[n,e&&t.includes(n)]))}_switchValues(){let e={};for(let t of ya)e[t]=this._root().querySelector(`input[data-category="${t}"]`)?.checked===!0;return e}_applyPreferences(){for(let e of ya){let t=this._root().querySelector(`input[data-category="${e}"]`);t&&(t.checked=this._preferences[e])}}_showSettings(e){this._settings=e;let t=this._root(),n=t.querySelector(`.wui-consent-banner-settings`);if(!n)return;n.hidden=!e,t.querySelector(`.wui-consent-banner-settings-toggle`)?.setAttribute(`aria-expanded`,e?`true`:`false`);let r=t.querySelector(`.wui-consent-banner-save`);r&&(r.hidden=!e);for(let n of[`.wui-consent-banner-reject`,`.wui-consent-banner-accept`]){let r=t.querySelector(n);r&&(r.hidden=e)}}};function Ta(e,t,n,r,i){let a=`${e}-${t}`;return`<div class="wui-consent-banner-category">
244
+ </div>`,this._rendered=!0,this._wire(),this._applyPreferences(),this._showSettings(this._settings),e&&(this._panel().hidden=!1)}open({settings:e=!1,focus:t=!1}={}){this._rendered||this.render(),this._applyPreferences(),this._showSettings(e),this._panel().hidden=!1,this.setAttribute(`open`,``),this._trackRoom(),t&&(e?this._root().querySelector(`.wui-consent-banner-category input:not([disabled])`):this._root().querySelector(`.wui-consent-banner-accept`))?.focus()}close(){let e=this._panel();e&&(e.hidden=!0),this.removeAttribute(`open`),this._showSettings(!1),this._untrackRoom()}_trackRoom(){this.isConnected&&(typeof ResizeObserver<`u`&&(this._roomObserver??=new ResizeObserver(()=>this._reserveRoom()),this._roomObserver.observe(this)),window.addEventListener(`resize`,this._onWindowResize),this._reserveRoom())}_untrackRoom(){this._roomObserver?.disconnect(),window.removeEventListener(`resize`,this._onWindowResize),document.documentElement.style.removeProperty(ya),document.documentElement.style.removeProperty(ba)}_reserveRoom(){let e=this.getBoundingClientRect(),t=this.position===`bottom-right`?window.innerWidth-e.left:e.right,n=document.documentElement.style;n.setProperty(ya,`${Math.ceil(window.innerHeight-e.top)}px`),n.setProperty(ba,`${Math.ceil(t)}px`)}_root(){return this.shadowRoot?this.shadowRoot:this.standalone?this.attachShadow({mode:`open`}):this}_panel(){return this._root().querySelector(`.wui-consent-banner-panel`)}_wire(){let e=this._root();e.querySelector(`.wui-consent-banner-accept`)?.addEventListener(`click`,()=>this._save(this._choiceForShown(!0))),e.querySelector(`.wui-consent-banner-reject`)?.addEventListener(`click`,()=>this._save(this._choiceForShown(!1))),e.querySelector(`.wui-consent-banner-save`)?.addEventListener(`click`,()=>this._save(this._switchValues())),e.querySelector(`.wui-consent-banner-settings-toggle`)?.addEventListener(`click`,()=>this._showSettings(!this._settings))}_save(e){this._preferences={...e},this.dispatchEvent(new CustomEvent(ga,{bubbles:!0,composed:!0,detail:{...e}})),this.close()}_choiceForShown(e){let t=this.categories;return Object.fromEntries(xa.map(n=>[n,e&&t.includes(n)]))}_switchValues(){let e={};for(let t of xa)e[t]=this._root().querySelector(`input[data-category="${t}"]`)?.checked===!0;return e}_applyPreferences(){for(let e of xa){let t=this._root().querySelector(`input[data-category="${e}"]`);t&&(t.checked=this._preferences[e])}}_showSettings(e){this._settings=e;let t=this._root(),n=t.querySelector(`.wui-consent-banner-settings`);if(!n)return;n.hidden=!e,t.querySelector(`.wui-consent-banner-settings-toggle`)?.setAttribute(`aria-expanded`,e?`true`:`false`);let r=t.querySelector(`.wui-consent-banner-save`);r&&(r.hidden=!e);for(let n of[`.wui-consent-banner-reject`,`.wui-consent-banner-accept`]){let r=t.querySelector(n);r&&(r.hidden=e)}}};function Da(e,t,n,r,i){let a=`${e}-${t}`;return`<div class="wui-consent-banner-category">
245
245
  <div class="form-check form-switch">
246
246
  <input class="form-check-input" type="checkbox" role="switch" id="${a}" data-category="${t}"${i?` checked disabled`:``} />
247
- <label class="form-check-label" for="${a}">${Ea(n)}</label>
247
+ <label class="form-check-label" for="${a}">${Oa(n)}</label>
248
248
  </div>
249
- <p class="wui-consent-banner-category-description">${Ea(r)}</p>
250
- </div>`}var Ea=e=>String(e??``).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`),Da=e=>String(e??``).replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`),Oa=`[role="menuitem"]`,ka=`input, textarea, select, [contenteditable=""], [contenteditable="true"]`,Aa=`data-open`,ja=500,Ma=10,Na=400,Pa=null,Fa=null,Ia=new WeakMap;function La(e,t,n){let r=Ia.get(e);if(r){if(r.region===t||t.contains(r.region))return!1;r.cancel()}return Ia.set(e,{region:t,cancel:n}),!0}var Ra=e=>e instanceof Element?e:e?.parentElement??null,za=class extends l{static get observedAttributes(){return[`disabled`]}constructor(){super(),this._region=null,this._origin=null,this._returnFocus=null,this._press=null,this._swallowClick=!1,this._nav=ui({getVisibleOptions:()=>this._items(),getActive:()=>this._items().indexOf(document.activeElement),setActive:e=>this._items()[e]?.focus({preventScroll:!0})}),this._onContextMenu=e=>this._handleContextMenu(e),this._onContextMenuCapture=e=>{this.isOpen&&!this._inPanel(e.target)&&!this._isKeyEcho()&&this.close()},this._onDocKeyDown=e=>this._handleDocKeyDown(e),this._onPointerDown=e=>this._handlePointerDown(e),this._onPressMove=e=>{this._press&&Math.hypot(e.clientX-this._press.x,e.clientY-this._press.y)>Ma&&this._cancelPress()},this._onPressEnd=()=>this._cancelPress(),this._onClickCapture=e=>{!this._swallowClick||!this._region?.contains(e.target)||(this._swallowClick=!1,e.preventDefault(),e.stopImmediatePropagation())},this._onKeyDown=e=>{this._inPanel(e.target)&&this._handleMenuKey(e)},this._onClick=e=>this._handleClick(e),this._onMouseMove=e=>{let t=Ra(e.target)?.closest(Oa);t&&this._inPanel(t)&&!this._isDisabled(t)&&t!==document.activeElement&&t.focus({preventScroll:!0})},this._onDismiss=e=>{e.type===`scroll`&&this._inPanel(e.target)||this.close()},this._onPointerDownCapture=e=>{this._swallowClick=!1,this.isOpen&&!this._inPanel(e.target)&&this.close()}}connectedCallback(){this._teardown(),document.addEventListener(`contextmenu`,this._onContextMenuCapture,!0),document.addEventListener(`contextmenu`,this._onContextMenu),document.addEventListener(`keydown`,this._onDocKeyDown),document.addEventListener(`pointerdown`,this._onPointerDownCapture,!0),document.addEventListener(`pointerdown`,this._onPointerDown),document.addEventListener(`click`,this._onClickCapture,!0),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`click`,this._onClick),this.addEventListener(`mousemove`,this._onMouseMove)}disconnectedCallback(){this._teardown()}attributeChangedCallback(){this.disabled&&this.close()}get target(){return this.getAttribute(`target`)}set target(e){e==null||e===``?this.removeAttribute(`target`):this.setAttribute(`target`,String(e))}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){this.toggleAttribute(`disabled`,!!e)}get isOpen(){return this._panel()?.hasAttribute(Aa)??!1}open(e,t,{region:n=this,origin:r=n,keyboard:i=!1}={}){let a=this._panel();if(a){if(Pa&&Pa!==this&&Pa.close(!0),!this.isOpen){let e=document.activeElement;this._returnFocus=e&&e!==document.body&&!this._inPanel(e)?e:null}this._region=n,this._origin=r,Fa=null,a.setAttribute(Aa,``),Pa=this,o({getBoundingClientRect:()=>({left:e,right:e,top:t,bottom:t,width:0,height:0})},a,{clampHeight:!0}),window.addEventListener(`scroll`,this._onDismiss,!0),window.addEventListener(`resize`,this._onDismiss),window.addEventListener(`blur`,this._onDismiss),((i?this._items()[0]:null)??a).focus({preventScroll:!0}),this.dispatchEvent(new CustomEvent(`wui-context-menu:open`,{bubbles:!0,detail:{region:n,origin:r,x:e,y:t}}))}}close(e=!1){let t=this._panel();if(!t?.hasAttribute(Aa))return;t.removeAttribute(Aa),Pa===this&&(Pa=null),window.removeEventListener(`scroll`,this._onDismiss,!0),window.removeEventListener(`resize`,this._onDismiss),window.removeEventListener(`blur`,this._onDismiss),this._nav.teardown();let n=this._returnFocus;this._returnFocus=null,e&&n?.isConnected&&n.focus({preventScroll:!0})}_panel(){return[...this.children].find(e=>e.getAttribute(`role`)===`menu`)??null}_inPanel(e){return!!e&&!!this._panel()?.contains(e)}_items(){return[...this._panel()?.querySelectorAll(Oa)??[]].filter(e=>!this._isDisabled(e))}_isDisabled(e){return e.getAttribute(`aria-disabled`)===`true`}_regionFor(e){let t=Ra(e);if(!t||this.disabled||!this._panel()||this._inPanel(t)||t.closest(ka))return null;let n=this.target;return n?t.closest(n):this.contains(t)?this:null}_isKeyEcho(){return Fa?.menu===this&&this.isOpen&&performance.now()-Fa.at<Na}_handleContextMenu(e){if(this._inPanel(e.target)){e.preventDefault();return}if(e.defaultPrevented&&!Ia.has(e))return;let t=this._regionFor(e.target);if(t){if(this._isKeyEcho()){e.preventDefault();return}e.shiftKey||La(e,t,()=>this.close(!0))&&(e.preventDefault(),this.open(e.clientX,e.clientY,{region:t,origin:Ra(e.target)}))}}_handleDocKeyDown(e){if(e.defaultPrevented&&!Ia.has(e)||!(e.key===`ContextMenu`||e.key===`F10`&&e.shiftKey)||this._inPanel(e.target))return;let t=this._regionFor(e.target);if(!t||!La(e,t,()=>this.close(!0)))return;e.preventDefault();let n=Ra(e.target),r=n.getBoundingClientRect();this.open(r.left+Math.min(16,r.width/2),r.bottom,{region:t,origin:n,keyboard:!0}),Fa={menu:this,at:performance.now()}}_handlePointerDown(e){if(e.pointerType!==`touch`)return;let t=this._regionFor(e.target);if(!t||!La(e,t,()=>this._cancelPress()))return;this._cancelPress();let{clientX:n,clientY:r}=e,i=Ra(e.target);this._press={x:n,y:r,timer:setTimeout(()=>{this._cancelPress(),this._swallowClick=!0,this.open(n,r,{region:t,origin:i})},ja)},document.addEventListener(`pointermove`,this._onPressMove,{passive:!0}),document.addEventListener(`pointerup`,this._onPressEnd),document.addEventListener(`pointercancel`,this._onPressEnd),window.addEventListener(`scroll`,this._onPressEnd,!0)}_cancelPress(){this._press&&(clearTimeout(this._press.timer),this._press=null,document.removeEventListener(`pointermove`,this._onPressMove),document.removeEventListener(`pointerup`,this._onPressEnd),document.removeEventListener(`pointercancel`,this._onPressEnd),window.removeEventListener(`scroll`,this._onPressEnd,!0))}_handleMenuKey(e){if(this.isOpen)if(e.key===`Escape`)e.preventDefault(),e.stopPropagation(),this.close(!0);else if(e.key===`Tab`)this.close(!0);else if(e.key===`ArrowDown`||e.key===`ArrowUp`)e.preventDefault(),this._step(e.key===`ArrowDown`?1:-1);else if(e.key===` `){let t=Ra(e.target)?.closest(Oa);e.preventDefault(),t&&t.click()}else this._nav.handler(e)}_step(e){let t=this._items();if(!t.length)return;let n=t.indexOf(document.activeElement);t[n<0?e>0?0:t.length-1:(n+e+t.length)%t.length].focus({preventScroll:!0})}_handleClick(e){let t=Ra(e.target)?.closest(Oa);if(!(!t||!this._inPanel(t))){if(this._isDisabled(t)){e.preventDefault(),e.stopPropagation();return}this.close(!0),this.dispatchEvent(new CustomEvent(`wui-context-menu:select`,{bubbles:!0,detail:{key:t.dataset.key??null,item:t,region:this._region,origin:this._origin}}))}}_teardown(){this.close(),this._cancelPress(),document.removeEventListener(`contextmenu`,this._onContextMenuCapture,!0),document.removeEventListener(`contextmenu`,this._onContextMenu),document.removeEventListener(`keydown`,this._onDocKeyDown),document.removeEventListener(`pointerdown`,this._onPointerDownCapture,!0),document.removeEventListener(`pointerdown`,this._onPointerDown),document.removeEventListener(`click`,this._onClickCapture,!0),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`mousemove`,this._onMouseMove)}},Ba=[[`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`,`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`]],Va=e=>(Ba.find(t=>t[0]===e)||[``,``,``])[2],Ha=class extends l{static formAssociated=!0;static get observedAttributes(){return[`value`,`placeholder`,`search-placeholder`,`searchable`,`disabled`,`compact`,`size`,`clearable`,`icon`,`prefix`,`aria-label`,`aria-invalid`]}_accessibleName(){return this.getAttribute(`aria-label`)||this.getAttribute(`placeholder`)||`Select`}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._value=``,this._optionsProp=null,this._active=-1,this._typeahead=``,this._typeaheadTimer=null}connectedCallback(){if(!this._rendered){this.render();return}this._bindGlobal?.()}attributeChangedCallback(e,t,n){if(e===`value`){this.value=n;return}if(e===`aria-invalid`){this._syncInvalid();return}this._rendered&&this.render()}_syncInvalid(){let e=this.querySelector(`.search-select-control`);e&&(this.hasAttribute(`aria-invalid`)?e.setAttribute(`aria-invalid`,`true`):e.removeAttribute(`aria-invalid`))}formResetCallback(){this.value=this._defaultValue||``}get value(){return this._value}set value(e){this._value=e==null?``:String(e),z(this,this._value),this._syncSelected(),this._syncReset()}set options(e){this._optionsProp=Array.isArray(e)?e:null,this.isConnected&&this.render()}get options(){return this._readOptions()}_snapshotDeclared(){if(this._declared)return;let e=[...this.querySelectorAll(`:scope > wui-option`)];e.length&&(this._declared=e.map(e=>({value:e.getAttribute(`value`)??e.textContent.trim(),label:e.innerHTML,icon:e.getAttribute(`icon`)||void 0,[fi]:!0,selected:e.hasAttribute(`selected`)})))}_readOptions(){return this._optionsProp?this._optionsProp:(this._snapshotDeclared(),this._declared||[])}render(){this._defaultValue===void 0&&(this._defaultValue=this.getAttribute(`value`)||``),this._snapshotDeclared();let e=this._readOptions(),t=this.hasAttribute(`searchable`),n=this.hasAttribute(`clearable`),r=this.getAttribute(`size`),i=r===`sm`?` search-select-sm`:r===`lg`?` search-select-lg`:``,a=this.getAttribute(`icon`),o=this.getAttribute(`prefix`),s=this.getAttribute(`placeholder`)||`Select...`,c=this.getAttribute(`search-placeholder`)||`Search...`,l=e.find(e=>String(e.value)===String(this._value))||e.find(e=>e.selected);l&&(this._value=String(l.value)),z(this,this._value),this.id||=`wui-select-${Math.random().toString(36).slice(2,9)}`;let u=`${this.id}-listbox`;this._listboxId=u;let d=e.map((e,t)=>{let n=String(e.value)===String(this._value);return`<button type="button" role="option" id="${Ua(`${u}-opt-${t}`)}" class="search-select-option${n?` selected`:``}" data-value="${Ua(e.value)}" aria-selected="${n}">${_i(e)}</button>`}).join(``);this.innerHTML=`
249
+ <p class="wui-consent-banner-category-description">${Oa(r)}</p>
250
+ </div>`}var Oa=e=>String(e??``).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`),ka=e=>String(e??``).replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`),Aa=`[role="menuitem"]`,ja=`input, textarea, select, [contenteditable=""], [contenteditable="true"]`,Ma=`data-open`,Na=500,Pa=10,Fa=400,Ia=null,La=null,Ra=new WeakMap;function za(e,t,n){let r=Ra.get(e);if(r){if(r.region===t||t.contains(r.region))return!1;r.cancel()}return Ra.set(e,{region:t,cancel:n}),!0}var Ba=e=>e instanceof Element?e:e?.parentElement??null,Va=class extends l{static get observedAttributes(){return[`disabled`]}constructor(){super(),this._region=null,this._origin=null,this._returnFocus=null,this._press=null,this._swallowClick=!1,this._nav=ui({getVisibleOptions:()=>this._items(),getActive:()=>this._items().indexOf(document.activeElement),setActive:e=>this._items()[e]?.focus({preventScroll:!0})}),this._onContextMenu=e=>this._handleContextMenu(e),this._onContextMenuCapture=e=>{this.isOpen&&!this._inPanel(e.target)&&!this._isKeyEcho()&&this.close()},this._onDocKeyDown=e=>this._handleDocKeyDown(e),this._onPointerDown=e=>this._handlePointerDown(e),this._onPressMove=e=>{this._press&&Math.hypot(e.clientX-this._press.x,e.clientY-this._press.y)>Pa&&this._cancelPress()},this._onPressEnd=()=>this._cancelPress(),this._onClickCapture=e=>{!this._swallowClick||!this._region?.contains(e.target)||(this._swallowClick=!1,e.preventDefault(),e.stopImmediatePropagation())},this._onKeyDown=e=>{this._inPanel(e.target)&&this._handleMenuKey(e)},this._onClick=e=>this._handleClick(e),this._onMouseMove=e=>{let t=Ba(e.target)?.closest(Aa);t&&this._inPanel(t)&&!this._isDisabled(t)&&t!==document.activeElement&&t.focus({preventScroll:!0})},this._onDismiss=e=>{e.type===`scroll`&&this._inPanel(e.target)||this.close()},this._onPointerDownCapture=e=>{this._swallowClick=!1,this.isOpen&&!this._inPanel(e.target)&&this.close()}}connectedCallback(){this._teardown(),document.addEventListener(`contextmenu`,this._onContextMenuCapture,!0),document.addEventListener(`contextmenu`,this._onContextMenu),document.addEventListener(`keydown`,this._onDocKeyDown),document.addEventListener(`pointerdown`,this._onPointerDownCapture,!0),document.addEventListener(`pointerdown`,this._onPointerDown),document.addEventListener(`click`,this._onClickCapture,!0),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`click`,this._onClick),this.addEventListener(`mousemove`,this._onMouseMove)}disconnectedCallback(){this._teardown()}attributeChangedCallback(){this.disabled&&this.close()}get target(){return this.getAttribute(`target`)}set target(e){e==null||e===``?this.removeAttribute(`target`):this.setAttribute(`target`,String(e))}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){this.toggleAttribute(`disabled`,!!e)}get isOpen(){return this._panel()?.hasAttribute(Ma)??!1}open(e,t,{region:n=this,origin:r=n,keyboard:i=!1}={}){let a=this._panel();if(a){if(Ia&&Ia!==this&&Ia.close(!0),!this.isOpen){let e=document.activeElement;this._returnFocus=e&&e!==document.body&&!this._inPanel(e)?e:null}this._region=n,this._origin=r,La=null,a.setAttribute(Ma,``),Ia=this,o({getBoundingClientRect:()=>({left:e,right:e,top:t,bottom:t,width:0,height:0})},a,{clampHeight:!0}),window.addEventListener(`scroll`,this._onDismiss,!0),window.addEventListener(`resize`,this._onDismiss),window.addEventListener(`blur`,this._onDismiss),((i?this._items()[0]:null)??a).focus({preventScroll:!0}),this.dispatchEvent(new CustomEvent(`wui-context-menu:open`,{bubbles:!0,detail:{region:n,origin:r,x:e,y:t}}))}}close(e=!1){let t=this._panel();if(!t?.hasAttribute(Ma))return;t.removeAttribute(Ma),Ia===this&&(Ia=null),window.removeEventListener(`scroll`,this._onDismiss,!0),window.removeEventListener(`resize`,this._onDismiss),window.removeEventListener(`blur`,this._onDismiss),this._nav.teardown();let n=this._returnFocus;this._returnFocus=null,e&&n?.isConnected&&n.focus({preventScroll:!0})}_panel(){return[...this.children].find(e=>e.getAttribute(`role`)===`menu`)??null}_inPanel(e){return!!e&&!!this._panel()?.contains(e)}_items(){return[...this._panel()?.querySelectorAll(Aa)??[]].filter(e=>!this._isDisabled(e))}_isDisabled(e){return e.getAttribute(`aria-disabled`)===`true`}_regionFor(e){let t=Ba(e);if(!t||this.disabled||!this._panel()||this._inPanel(t)||t.closest(ja))return null;let n=this.target;return n?t.closest(n):this.contains(t)?this:null}_isKeyEcho(){return La?.menu===this&&this.isOpen&&performance.now()-La.at<Fa}_handleContextMenu(e){if(this._inPanel(e.target)){e.preventDefault();return}if(e.defaultPrevented&&!Ra.has(e))return;let t=this._regionFor(e.target);if(t){if(this._isKeyEcho()){e.preventDefault();return}e.shiftKey||za(e,t,()=>this.close(!0))&&(e.preventDefault(),this.open(e.clientX,e.clientY,{region:t,origin:Ba(e.target)}))}}_handleDocKeyDown(e){if(e.defaultPrevented&&!Ra.has(e)||!(e.key===`ContextMenu`||e.key===`F10`&&e.shiftKey)||this._inPanel(e.target))return;let t=this._regionFor(e.target);if(!t||!za(e,t,()=>this.close(!0)))return;e.preventDefault();let n=Ba(e.target),r=n.getBoundingClientRect();this.open(r.left+Math.min(16,r.width/2),r.bottom,{region:t,origin:n,keyboard:!0}),La={menu:this,at:performance.now()}}_handlePointerDown(e){if(e.pointerType!==`touch`)return;let t=this._regionFor(e.target);if(!t||!za(e,t,()=>this._cancelPress()))return;this._cancelPress();let{clientX:n,clientY:r}=e,i=Ba(e.target);this._press={x:n,y:r,timer:setTimeout(()=>{this._cancelPress(),this._swallowClick=!0,this.open(n,r,{region:t,origin:i})},Na)},document.addEventListener(`pointermove`,this._onPressMove,{passive:!0}),document.addEventListener(`pointerup`,this._onPressEnd),document.addEventListener(`pointercancel`,this._onPressEnd),window.addEventListener(`scroll`,this._onPressEnd,!0)}_cancelPress(){this._press&&(clearTimeout(this._press.timer),this._press=null,document.removeEventListener(`pointermove`,this._onPressMove),document.removeEventListener(`pointerup`,this._onPressEnd),document.removeEventListener(`pointercancel`,this._onPressEnd),window.removeEventListener(`scroll`,this._onPressEnd,!0))}_handleMenuKey(e){if(this.isOpen)if(e.key===`Escape`)e.preventDefault(),e.stopPropagation(),this.close(!0);else if(e.key===`Tab`)this.close(!0);else if(e.key===`ArrowDown`||e.key===`ArrowUp`)e.preventDefault(),this._step(e.key===`ArrowDown`?1:-1);else if(e.key===` `){let t=Ba(e.target)?.closest(Aa);e.preventDefault(),t&&t.click()}else this._nav.handler(e)}_step(e){let t=this._items();if(!t.length)return;let n=t.indexOf(document.activeElement);t[n<0?e>0?0:t.length-1:(n+e+t.length)%t.length].focus({preventScroll:!0})}_handleClick(e){let t=Ba(e.target)?.closest(Aa);if(!(!t||!this._inPanel(t))){if(this._isDisabled(t)){e.preventDefault(),e.stopPropagation();return}this.close(!0),this.dispatchEvent(new CustomEvent(`wui-context-menu:select`,{bubbles:!0,detail:{key:t.dataset.key??null,item:t,region:this._region,origin:this._origin}}))}}_teardown(){this.close(),this._cancelPress(),document.removeEventListener(`contextmenu`,this._onContextMenuCapture,!0),document.removeEventListener(`contextmenu`,this._onContextMenu),document.removeEventListener(`keydown`,this._onDocKeyDown),document.removeEventListener(`pointerdown`,this._onPointerDownCapture,!0),document.removeEventListener(`pointerdown`,this._onPointerDown),document.removeEventListener(`click`,this._onClickCapture,!0),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`mousemove`,this._onMouseMove)}},Ha=[[`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`,`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`]],Ua=e=>(Ha.find(t=>t[0]===e)||[``,``,``])[2],Wa=class extends l{static formAssociated=!0;static get observedAttributes(){return[`value`,`placeholder`,`search-placeholder`,`searchable`,`disabled`,`compact`,`size`,`clearable`,`icon`,`prefix`,`aria-label`,`aria-invalid`]}_accessibleName(){return this.getAttribute(`aria-label`)||this.getAttribute(`placeholder`)||`Select`}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._value=``,this._optionsProp=null,this._active=-1,this._typeahead=``,this._typeaheadTimer=null}connectedCallback(){if(!this._rendered){this.render();return}this._bindGlobal?.()}attributeChangedCallback(e,t,n){if(e===`value`){this.value=n;return}if(e===`aria-invalid`){this._syncInvalid();return}this._rendered&&this.render()}_syncInvalid(){let e=this.querySelector(`.search-select-control`);e&&(this.hasAttribute(`aria-invalid`)?e.setAttribute(`aria-invalid`,`true`):e.removeAttribute(`aria-invalid`))}formResetCallback(){this.value=this._defaultValue||``}get value(){return this._value}set value(e){this._value=e==null?``:String(e),z(this,this._value),this._syncSelected(),this._syncReset()}set options(e){this._optionsProp=Array.isArray(e)?e:null,this.isConnected&&this.render()}get options(){return this._readOptions()}_snapshotDeclared(){if(this._declared)return;let e=[...this.querySelectorAll(`:scope > wui-option`)];e.length&&(this._declared=e.map(e=>({value:e.getAttribute(`value`)??e.textContent.trim(),label:e.innerHTML,icon:e.getAttribute(`icon`)||void 0,[fi]:!0,selected:e.hasAttribute(`selected`)})))}_readOptions(){return this._optionsProp?this._optionsProp:(this._snapshotDeclared(),this._declared||[])}render(){this._defaultValue===void 0&&(this._defaultValue=this.getAttribute(`value`)||``),this._snapshotDeclared();let e=this._readOptions(),t=this.hasAttribute(`searchable`),n=this.hasAttribute(`clearable`),r=this.getAttribute(`size`),i=r===`sm`?` search-select-sm`:r===`lg`?` search-select-lg`:``,a=this.getAttribute(`icon`),o=this.getAttribute(`prefix`),s=this.getAttribute(`placeholder`)||`Select...`,c=this.getAttribute(`search-placeholder`)||`Search...`,l=e.find(e=>String(e.value)===String(this._value))||e.find(e=>e.selected);l&&(this._value=String(l.value)),z(this,this._value),this.id||=`wui-select-${Math.random().toString(36).slice(2,9)}`;let u=`${this.id}-listbox`;this._listboxId=u;let d=e.map((e,t)=>{let n=String(e.value)===String(this._value);return`<button type="button" role="option" id="${Ga(`${u}-opt-${t}`)}" class="search-select-option${n?` selected`:``}" data-value="${Ga(e.value)}" aria-selected="${n}">${_i(e)}</button>`}).join(``);this.innerHTML=`
251
251
  <div class="search-select${this.hasAttribute(`compact`)?` search-select-compact`:``}${i}">
252
- <button type="button" role="combobox" class="input search-select-control" aria-haspopup="listbox" aria-expanded="false" aria-controls="${Ua(u)}" aria-label="${Ua(this._accessibleName())}"${this.hasAttribute(`aria-invalid`)?` aria-invalid="true"`:``}${this.hasAttribute(`disabled`)?` disabled`:``}>
252
+ <button type="button" role="combobox" class="input search-select-control" aria-haspopup="listbox" aria-expanded="false" aria-controls="${Ga(u)}" aria-label="${Ga(this._accessibleName())}"${this.hasAttribute(`aria-invalid`)?` aria-invalid="true"`:``}${this.hasAttribute(`disabled`)?` disabled`:``}>
253
253
  ${a?j(a,{className:`search-select-icon`}):``}
254
254
  ${o?`<span class="search-select-prefix">${V(o)}</span>`:``}
255
255
  <span class="${l?``:`search-select-placeholder`}" data-label>${l?_i(l):V(s)}</span>
256
256
  ${n?`<span class="search-select-reset" role="button" aria-label="Clear selection" hidden>${j(`x`)}</span>`:``}
257
257
  ${j(`chevron-down`,{className:`search-select-caret`})}
258
258
  </button>
259
- <div class="search-select-menu search-select-menu-fixed" role="listbox" id="${Ua(u)}" tabindex="-1" hidden>
260
- ${t?`<div class="search-select-search">${j(`search`)}<input class="search-select-input" placeholder="${Ua(c)}" aria-autocomplete="list" /><button type="button" class="search-select-clear" aria-label="Clear search" hidden>${j(`x`)}</button></div>`:``}
259
+ <div class="search-select-menu search-select-menu-fixed" role="listbox" id="${Ga(u)}" tabindex="-1" hidden>
260
+ ${t?`<div class="search-select-search">${j(`search`)}<input class="search-select-input" placeholder="${Ga(c)}" aria-autocomplete="list" /><button type="button" class="search-select-clear" aria-label="Clear search" hidden>${j(`x`)}</button></div>`:``}
261
261
  <div class="search-select-options">${d}<div class="search-select-empty" hidden>No matches</div></div>
262
262
  </div>
263
- </div>`,this._rendered=!0,z(this,this._value),this._wire(),this._syncReset()}_refs(){return{control:this.querySelector(`.search-select-control`),menu:this.querySelector(`.search-select-menu`),label:this.querySelector(`[data-label]`),reset:this.querySelector(`.search-select-reset`),search:this.querySelector(`.search-select-input`),clear:this.querySelector(`.search-select-clear`),empty:this.querySelector(`.search-select-empty`),optionsWrap:this.querySelector(`.search-select-options`)}}_optionEls(){return[...this.querySelectorAll(`.search-select-option`)]}_visible(){return this._optionEls().filter(e=>!e.hidden)}_syncSelected(){let{label:e}=this._refs(),t=this._readOptions().find(e=>String(e.value)===String(this._value));for(let e of this._optionEls()){let t=e.dataset.value===String(this._value);e.classList.toggle(`selected`,t),e.setAttribute(`aria-selected`,String(t))}e&&(e.innerHTML=t?_i(t):V(this.getAttribute(`placeholder`)||`Select...`),e.classList.toggle(`search-select-placeholder`,!t))}_syncReset(){let{reset:e}=this._refs();e&&(e.hidden=!(this.hasAttribute(`clearable`)&&this._value!==``&&!this.hasAttribute(`disabled`)))}_wire(){this._teardown();let e=this._refs();if(!e.control||!e.menu)return;let t=()=>{if(this.hasAttribute(`compact`)){let t=e.control.getBoundingClientRect();e.menu.style.width=`max-content`,e.menu.style.minWidth=`${t.width}px`,e.menu.style.maxWidth=`280px`,o(e.control,e.menu)}else o(e.control,e.menu,{matchWidth:!0})},n=(t,{reveal:n=!0}={})=>{let r=this._visible();this._active=t,di(e.optionsWrap,t>=0&&r[t]||null),t>=0&&r[t]?(n&&r[t].scrollIntoView({block:`nearest`}),e.control.setAttribute(`aria-activedescendant`,r[t].id)):e.control.removeAttribute(`aria-activedescendant`)},r=n=>{let r=n.trim().toLowerCase(),i=0;for(let e of this._optionEls()){let t=!r||e.textContent.toLowerCase().includes(r);e.hidden=!t,t&&(i+=1)}e.empty&&(e.empty.hidden=i>0),e.clear&&(e.clear.hidden=!r),e.menu.hidden||t()},i=()=>!e.menu.hidden,a=()=>{i()&&t()},l=()=>{e.menu.hidden=!1,e.control.setAttribute(`aria-expanded`,`true`),e.control.classList.add(`open`),t(),s(this,a),e.search&&(e.search.value=``,r(``),e.search.focus()),n(this._optionEls().findIndex(e=>e.classList.contains(`selected`)))},u=()=>{e.menu.hidden=!0,e.control.setAttribute(`aria-expanded`,`false`),e.control.classList.remove(`open`),n(-1),c(this)},d=t=>{this.value=t.dataset.value,this.dispatchEvent(new Event(`change`,{bubbles:!0})),u(),e.control.focus()};this._navHandler=ui({getVisibleOptions:()=>this._visible(),getActive:()=>this._active,setActive:e=>n(e),onEnter:e=>{e&&d(e)},onEscape:()=>{this._navHandler.clearTypeahead(),u(),e.control.focus()}});let f=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation()),this._navHandler.handler(e)};e.reset?.addEventListener(`click`,t=>{t.stopPropagation(),this.value=``,this.dispatchEvent(new Event(`change`,{bubbles:!0})),e.control.focus()}),e.control.addEventListener(`click`,()=>i()?u():l()),e.control.addEventListener(`keydown`,e=>{if(i()){f(e);return}(e.key===`ArrowDown`||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),l())}),e.optionsWrap.addEventListener(`click`,e=>{let t=e.target.closest(`.search-select-option`);t&&d(t)}),e.optionsWrap.addEventListener(`mousemove`,e=>{let t=e.target.closest(`.search-select-option`);t&&!t.classList.contains(`is-active`)&&n(this._visible().indexOf(t),{reveal:!1})}),e.optionsWrap.addEventListener(`mouseleave`,()=>n(-1)),e.search?.addEventListener(`input`,()=>{r(e.search.value),n(-1)}),e.clear?.addEventListener(`click`,()=>{e.search.value=``,r(``),e.search.focus()}),e.menu.addEventListener(`keydown`,f),this._bindGlobal=()=>{this._teardown(),this._onDocClick=e=>{i()&&!this.contains(e.target)&&u()},document.addEventListener(`click`,this._onDocClick),i()&&s(this,a)},this._bindGlobal()}_teardown(){this._onDocClick&&=(document.removeEventListener(`click`,this._onDocClick),null),c(this),this._navHandler?.teardown()}disconnectedCallback(){this._teardown()}},Ua=e=>String(e??``).replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`),Wa=e=>{if(e==null)return null;let t=String(e).split(`,`).map(e=>e.trim().toUpperCase()).filter(Boolean);return t.length?new Set(t):null},Ga=e=>{let t=Wa(e);return Ba.filter(([e])=>!t||t.has(e)).map(([e,t])=>({value:e,label:t,flag:e}))},Ka=class extends Ha{static get observedAttributes(){return[...Ha.observedAttributes,`countries`]}_readOptions(){let e=this.getAttribute(`countries`);return this._countryCache?.attr!==e&&(this._countryCache={attr:e,options:Ga(e)}),this._countryCache.options}},qa=`.wui-col-resize`,Ja=`.wui-group-row, .wui-virtual-spacer`,Ya=`.wui-select-cell, .wui-expand-cell`,Xa=`<svg class="wui-icon" data-icon="chevron-down" width="16" height="16" viewBox="0 0 24 24" fill="none" aria-hidden="true" style="vertical-align:-.125em"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="1.5" d="M19.92 8.95l-6.52 6.52c-.77.77-2.03.77-2.8 0L4.08 8.95"></path></svg>`,Za=e=>e.hasAttribute(`data-wui-skeleton`)||!!e.querySelector(`:scope > td > .skeleton`),Qa=class extends l{constructor(){super(),this._frame=0,this._headDirty=!0,this._rowsDirty=!0,this._frozenSig=null,this._natural=[],this._widths={},this._collapsed=new Set,this._groupOrder=[],this._items=[],this._range=null,this._drag=null,this._userSized=!1,this._swallowClick=!1,this._mo=null,this._ro=null,this._fonts=null,this._onPointerDown=e=>this._startDrag(e),this._onKeyDown=e=>this._key(e),this._onClick=e=>this._click(e),this._onDblClick=e=>{let t=e.target.closest?.(qa);t&&this.contains(t)&&this._reset(t.closest(`th`))},this._onScroll=()=>{this.hasAttribute(`virtual`)&&this._schedule()},this._onFonts=()=>{this._userSized||this._drag||this._frozenSig===null||!this.hasAttribute(`resizable`)||(this._frozenSig=null,this._schedule())}}connectedCallback(){this._widths=$e(this.getAttribute(`view-key`)),this.addEventListener(`pointerdown`,this._onPointerDown,!0),this.addEventListener(`keydown`,this._onKeyDown,!0),this.addEventListener(`click`,this._onClick,!0),this.addEventListener(`dblclick`,this._onDblClick),this.addEventListener(`scroll`,this._onScroll,{passive:!0}),this._fonts=this.ownerDocument.fonts??null,this._fonts?.addEventListener(`loadingdone`,this._onFonts),typeof MutationObserver<`u`&&(this._mo=new MutationObserver(e=>this._mutated(e)),this._mo.observe(this,{childList:!0,subtree:!0})),typeof ResizeObserver<`u`&&(this._ro=new ResizeObserver(()=>this._schedule()),this._ro.observe(this)),this._headDirty=!0,this._rowsDirty=!0,this._schedule()}disconnectedCallback(){this.removeEventListener(`pointerdown`,this._onPointerDown,!0),this.removeEventListener(`keydown`,this._onKeyDown,!0),this.removeEventListener(`click`,this._onClick,!0),this.removeEventListener(`dblclick`,this._onDblClick),this.removeEventListener(`scroll`,this._onScroll),this._fonts?.removeEventListener(`loadingdone`,this._onFonts),this._fonts=null,this._mo?.disconnect(),this._ro?.disconnect(),this._mo=null,this._ro=null,this._frame&&cancelAnimationFrame(this._frame),this._frame=0,this._drag=null}refresh(){this._headDirty=!0,this._rowsDirty=!0,this._run()}get _table(){return this.querySelector(`:scope > table`)}_headCells(e){let t=e.tHead?.rows[0];return t?[...t.cells]:[]}_schedule(){this._frame||=requestAnimationFrame(()=>{this._frame=0,this._run()})}_mutated(e){for(let t of e){let e=t.target.nodeType===1?t.target:t.target.parentElement;e&&((e.closest(`thead`)||e===this._table||e===this)&&(this._headDirty=!0),(e.closest(`tbody, tfoot`)||e===this._table||e===this)&&(this._rowsDirty=!0))}this._schedule()}_run(){let e=this._table;if(!e)return;let t=this._headDirty,n=this._rowsDirty;this._headDirty=!1,this._rowsDirty=!1,n&&this.hasAttribute(`group-by`)&&this._group(e),this._pins(e,t||n),this.hasAttribute(`resizable`)&&(t&&this._handles(e),this._layout(e)),this.hasAttribute(`virtual`)&&this._virtual(e,t||n),this._mo?.takeRecords()}_pins(e,t){let n=this._headCells(e),r=n.map(e=>{let t=e.dataset.pin;return t===`start`||t===`end`?t:e.matches(Ya)?`lead`:null});if(!r.some(e=>e===`start`||e===`end`))return;let i=it(r);i.forEach((e,t)=>{e&&this._ro?.observe(n[t])});let a=e=>n[e].getBoundingClientRect().width,o=0;i.forEach((t,n)=>{t?.side===`start`&&(this._setVar(e,tt(`start`,t.ordinal),o),o+=a(n))}),o=0;for(let t=i.length-1;t>=0;t--){let n=i[t];n?.side===`end`&&(this._setVar(e,tt(`end`,n.ordinal),o),o+=a(t))}if(t)for(let t of e.rows)t.matches(`${Ja}, .wui-row-expanded`)||t.cells.length!==n.length||i.forEach((e,n)=>{if(!e)return;let r=t.cells[n];r.classList.contains(`wui-pin-${e.side}`)||r.classList.add(`wui-pin-${e.side}`),e.edge&&!r.classList.contains(`wui-pin-${e.side}-edge`)&&r.classList.add(`wui-pin-${e.side}-edge`);let i=rt(e.side,e.ordinal);r.style.getPropertyValue(`--wui-pin-at`)!==i&&r.style.setProperty(nt,i)})}_setVar(e,t,n){let r=`${Math.round(n*100)/100}px`;e.style.getPropertyValue(t)!==r&&e.style.setProperty(t,r)}_resizable(e){return e.map((t,n)=>n<e.length-1&&!t.matches(Ya))}_handles(e){let t=this._headCells(e),n=this._resizable(t);t.forEach((e,t)=>{if(!n[t]||e.querySelector(qa))return;let r=e.ownerDocument.createElement(`span`);r.className=`wui-col-resize`,r.setAttribute(`role`,`separator`),r.setAttribute(`aria-orientation`,`vertical`),r.setAttribute(`aria-valuemin`,`48`),r.setAttribute(`aria-valuemax`,String(He)),r.setAttribute(`tabindex`,`0`);let i=e.textContent.trim();r.setAttribute(`aria-label`,A.resize(i)),i&&!e.hasAttribute(`aria-label`)&&e.setAttribute(`aria-label`,i),e.classList.add(`wui-col-resizable`),e.appendChild(r)})}_hasRows(e){for(let t of e.tBodies)for(let e of t.rows)if(!e.matches(Ja)&&!Za(e))return!0;return!1}_signature(e){return e.map(e=>e.dataset.key||e.textContent.trim()).join(``)}_layout(e){let t=this._headCells(e),n=this._signature(t);!t.length||n===this._frozenSig||(this._hasRows(e)?this._freeze(e,t,n):this._applyRemembered(t))}_applyRemembered(e){for(let t of e){let e=t.dataset.key&&this._widths[t.dataset.key];e&&(t.style.width=`${e}px`);let n=t.querySelector(qa);n&&this._handleValue(n,Ye(e||t.getBoundingClientRect().width))}}_freeze(e,t,n){e.style.tableLayout=``,e.style.width=``,e.removeAttribute(`data-wui-fixed`);for(let e of t)e.hasAttribute(`data-wui-width`)&&(e.style.width=``,e.removeAttribute(`data-wui-width`));this._natural=t.map(e=>e.getBoundingClientRect().width),t.forEach((e,n)=>{if(n===t.length-1||e.matches(Ya))return;let r=e.dataset.key&&this._widths[e.dataset.key];this._setWidth(e,r||this._natural[n])}),e.style.tableLayout=`fixed`,e.setAttribute(`data-wui-fixed`,``),this._frozenSig=n,this._fitTable(e,t)}_setWidth(e,t){let n=Ye(t);e.style.width=`${n}px`,e.setAttribute(`data-wui-width`,``);let r=e.querySelector(qa);return r&&this._handleValue(r,n),n}_handleValue(e,t){e.setAttribute(`aria-valuenow`,String(t)),e.setAttribute(`aria-valuetext`,A.width(t))}_fitTable(e,t){let n=t.length-1,r=this._natural[n]||0;for(let e=0;e<n;e++)r+=Number.parseFloat(t[e].style.width)||this._natural[e]||0;e.style.width=`max(100%, ${Math.round(r)}px)`}_ensureFrozen(e){let t=this._headCells(e),n=this._signature(t);return n!==this._frozenSig&&this._freeze(e,t,n),t}_resizeTo(e,t,n){let r=this._table;if(!r)return;let i=this._ensureFrozen(r);this._userSized=!0,this._setWidth(e,t),this._fitTable(r,i),n&&this._remember(e),this._pins(r,!1)}_remember(e){let t=e.dataset.key;t&&(this._widths={...this._widths,[t]:Number.parseFloat(e.style.width)},et(this.getAttribute(`view-key`),this._widths))}_reset(e){let t=this._table;if(!e||!t)return;let n=this._ensureFrozen(t);this._userSized=!0;let r=e.dataset.key;if(r&&r in this._widths){let{[r]:e,...t}=this._widths;this._widths=t,et(this.getAttribute(`view-key`),this._widths)}this._setWidth(e,this._natural[n.indexOf(e)]||0),this._fitTable(t,n),this._pins(t,!1)}_rtl(){return getComputedStyle(this).direction===`rtl`}_startDrag(e){let t=e.target.closest?.(qa);if(!t||!this.contains(t)||e.button!==0)return;e.preventDefault(),e.stopPropagation();let n=t.closest(`th`),r=this._table;if(!n||!r)return;this._ensureFrozen(r);let i={th:n,x:e.clientX,from:n.getBoundingClientRect().width,dir:this._rtl()?-1:1,moved:!1};this._drag=i,t.setPointerCapture?.(e.pointerId),t.classList.add(`is-dragging`);let a=e=>{let t=(e.clientX-i.x)*i.dir;Math.abs(t)>1&&(i.moved=!0),this._resizeTo(n,i.from+t,!1)},o=e=>{t.removeEventListener(`pointermove`,a),t.removeEventListener(`pointerup`,o),t.removeEventListener(`pointercancel`,o),t.classList.remove(`is-dragging`),this._drag=null,e.type===`pointercancel`?this._resizeTo(n,i.from,!1):i.moved&&this._remember(n),this._swallowClick=!0,setTimeout(()=>{this._swallowClick=!1},0)};t.addEventListener(`pointermove`,a),t.addEventListener(`pointerup`,o),t.addEventListener(`pointercancel`,o)}_key(e){let t=e.target.closest?.(qa);if(!t||!this.contains(t))return;let n=t.closest(`th`);if(e.key===`Enter`||e.key===` `){e.preventDefault(),e.stopPropagation();return}if(e.key===`Home`){e.preventDefault(),e.stopPropagation(),this._reset(n);return}if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault(),e.stopPropagation();let r=this._table;if(!r)return;this._ensureFrozen(r);let i=e.shiftKey?50:10,a=e.key===`ArrowRight`!==this._rtl(),o=Number.parseFloat(n.style.width)||n.getBoundingClientRect().width;this._resizeTo(n,o+(a?i:-i),!0)}_click(e){let t=!!e.target.closest?.(qa);if(this._swallowClick||t){e.stopPropagation(),(t||this._swallowClick)&&e.preventDefault(),this._swallowClick=!1;return}if(!this.hasAttribute(`group-by`))return;let n=(e.target.closest?.(`.wui-group-toggle`))?.closest(`.wui-group-row`);if(!n||!this.contains(n))return;let r=n.dataset.groupKey;this._collapsed.has(r)?this._collapsed.delete(r):this._collapsed.add(r),this._showGroup(n,!this._collapsed.has(r));let i=this._table;i&&this.hasAttribute(`virtual`)&&(this._virtual(i,!0),this._mo?.takeRecords())}_group(e){let t=this.getAttribute(`group-by`),n=this._headCells(e),r=n.findIndex(e=>e.dataset.key===t);if(r<0)throw Error(`<wui-data-table group-by="${t}"> needs a header cell with data-key="${t}".`);let i=e.tBodies[0];if(!i)return;let a=[...i.rows].filter(e=>!e.matches(Ja));if(a.some(Za))return;let o=this.ownerDocument,s=new Map([...i.querySelectorAll(`:scope > tr.wui-group-row`)].map(e=>[e.dataset.groupKey,e])),c=Xe(a,e=>e.dataset.group??e.cells[r]?.textContent.trim()??``,this._groupOrder);this._groupOrder=c.map(e=>e.key);let l=o.createDocumentFragment(),u=c.map(e=>{let t=s.get(e.key)??this._groupRow(o,e.key);return s.delete(e.key),t.querySelector(`.wui-group-cell`).colSpan=n.length,t.querySelector(`.wui-group-count`).textContent=Je(e.items.length),t.querySelector(`.wui-group-rows`).textContent=`, ${A.rows(e.items.length)}`,l.append(t,...e.items),[t,e.key]});for(let e of s.values())e.remove();i.insertBefore(l,this._bottom?.parentNode===i?this._bottom:null);for(let[e,t]of u)this._showGroup(e,!this._collapsed.has(t))}_groupRow(e,t){let n=e.createElement(`tr`);n.className=`wui-group-row`,n.dataset.groupKey=t;let r=e.createElement(`th`);r.className=`wui-group-cell`,r.scope=`rowgroup`;let i=e.createElement(`button`);i.type=`button`,i.className=`wui-group-toggle`,i.innerHTML=Xa;let a=e.createElement(`span`);a.className=`wui-group-label`,a.textContent=t;let o=e.createElement(`span`);o.className=`wui-group-count`,o.setAttribute(`aria-hidden`,`true`);let s=e.createElement(`span`);return s.className=`visually-hidden wui-group-rows`,i.append(a,o,s),r.append(i),n.append(r),n}_showGroup(e,t){if(e){e.querySelector(`.wui-group-toggle`)?.setAttribute(`aria-expanded`,String(t));for(let n=e.nextElementSibling;n&&!n.matches(Ja);n=n.nextElementSibling)n.hidden=!t}}_spacer(e,t){if(t?.parentNode===e)return t;let n=e.ownerDocument,r=n.createElement(`tr`);return r.className=`wui-virtual-spacer`,r.setAttribute(`aria-hidden`,`true`),r.append(n.createElement(`td`)),r}_virtual(e,t){let n=e.tBodies[0];if(!n)return;if(t){this._top=this._spacer(n,this._top),this._bottom=this._spacer(n,this._bottom),n.firstElementChild!==this._top&&n.insertBefore(this._top,n.firstChild),n.lastElementChild!==this._bottom&&n.append(this._bottom);let t=Math.max(1,this._headCells(e).length);this._top.cells[0].colSpan=t,this._bottom.cells[0].colSpan=t,this._items=[...n.rows].filter(e=>!e.classList.contains(`wui-virtual-spacer`)&&!e.hidden),this._range=null,e.setAttribute(`aria-rowcount`,String(this._items.length+1)),e.tHead?.rows[0]?.setAttribute(`aria-rowindex`,`1`),this._items.forEach((e,t)=>e.setAttribute(`aria-rowindex`,String(t+2))),this._rowHeight>0||(this._rowHeight=this._measureRow(e))}let r=e.tHead?.getBoundingClientRect().height||0,i=Ze({scrollTop:this.scrollTop-r,viewport:this.clientHeight,rowHeight:this._rowHeight,count:this._items.length}),a=this._range;if(a&&a.start===i.start&&a.end===i.end)return;let o=a?Math.min(a.start,i.start):0,s=a?Math.max(a.end,i.end):this._items.length;for(let e=o;e<s;e++){let t=e<i.start||e>=i.end,n=this._items[e];n.classList.contains(`wui-virtual-off`)!==t&&n.classList.toggle(`wui-virtual-off`,t)}this._range=i,this._top.hidden=i.before===0,this._bottom.hidden=i.after===0,this._top.cells[0].style.height=`${i.before}px`,this._bottom.cells[0].style.height=`${i.after}px`}_measureRow(e){let t=this._items.find(e=>!e.classList.contains(`wui-group-row`)&&!e.classList.contains(`wui-virtual-off`))?.getBoundingClientRect().height;return t>0?t:e.classList.contains(`wui-table-compact`)?qe.compact:e.classList.contains(`wui-table-cozy`)?qe.cozy:qe.comfortable}},$a=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],eo=[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],to=e=>{let t=String(e??``).trim();return/^[0-6]$/.test(t)?Number(t):null},no=e=>to(e.getAttribute(`first-day`))??to(getComputedStyle(e).getPropertyValue(`--wui-first-day`))??1,ro=e=>String(e).padStart(2,`0`),io=(e,t,n)=>`${e}-${ro(t+1)}-${ro(n)}`,K=e=>{let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e||``);return t?{y:+t[1],m:t[2]-1,d:+t[3]}:null},ao=`dd-MMM-yyyy`,oo=(e,t=ao)=>{let n=K(e);if(!n)return``;let r={yyyy:n.y,MMMM:$a[n.m],MMM:$a[n.m].slice(0,3),MM:ro(n.m+1),dd:ro(n.d),d:n.d};return(t||`dd-MMM-yyyy`).replace(/yyyy|MMMM|MMM|MM|dd|d/g,e=>r[e])},so=(e,t)=>new Date(e,t+1,0).getDate(),q=(e,t)=>{for(;t<0;)t+=12,--e;for(;t>11;)t-=12,e+=1;return{y:e,m:t}},co=class extends l{static formAssociated=!0;static get observedAttributes(){return[`value`,`min`,`max`,`placeholder`,`disabled`,`first-day`,`disabled-weekdays`,`display-format`,`size`,`aria-label`,`aria-describedby`,`aria-invalid`]}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._value=``;let e=new Date(2e3,0,1);this._viewY=e.getFullYear(),this._viewM=e.getMonth(),this._mode=`days`,this._focus=null,this._slide=``}connectedCallback(){if(!this._rendered){this.render();return}this._bindGlobal?.()}attributeChangedCallback(e,t,n){if(e===`aria-invalid`){this._syncInvalid();return}this._rendered&&(e===`value`?(this._value=n||``,this._syncFormValue(),this._syncTrigger()):e===`display-format`?this._syncTrigger():e===`first-day`?this.querySelector(`.datepicker-pop`)?.hidden||this._renderView():this.render())}_syncInvalid(){let e=this.querySelector(`.datepicker-trigger`);e&&(this.hasAttribute(`aria-invalid`)?e.setAttribute(`aria-invalid`,`true`):e.removeAttribute(`aria-invalid`))}formResetCallback(){this.value=this._defaultValue||``}get value(){return this._value}set value(e){this._value=e||``,z(this,this._value),this._syncTrigger()}_firstDay(){return no(this)}render(){this._defaultValue===void 0&&(this._defaultValue=this.getAttribute(`value`)||``,this._value=this._defaultValue||this._value);let e=this.getAttribute(`placeholder`)||`Choose a date`,t=K(this._value);t&&(this._viewY=t.y,this._viewM=t.m);let n=this.getAttribute(`size`),r=n===`sm`?` input-sm`:n===`lg`?` input-lg`:``,i=this.getAttribute(`aria-label`),a=this.getAttribute(`aria-describedby`);this.innerHTML=`
263
+ </div>`,this._rendered=!0,z(this,this._value),this._wire(),this._syncReset()}_refs(){return{control:this.querySelector(`.search-select-control`),menu:this.querySelector(`.search-select-menu`),label:this.querySelector(`[data-label]`),reset:this.querySelector(`.search-select-reset`),search:this.querySelector(`.search-select-input`),clear:this.querySelector(`.search-select-clear`),empty:this.querySelector(`.search-select-empty`),optionsWrap:this.querySelector(`.search-select-options`)}}_optionEls(){return[...this.querySelectorAll(`.search-select-option`)]}_visible(){return this._optionEls().filter(e=>!e.hidden)}_syncSelected(){let{label:e}=this._refs(),t=this._readOptions().find(e=>String(e.value)===String(this._value));for(let e of this._optionEls()){let t=e.dataset.value===String(this._value);e.classList.toggle(`selected`,t),e.setAttribute(`aria-selected`,String(t))}e&&(e.innerHTML=t?_i(t):V(this.getAttribute(`placeholder`)||`Select...`),e.classList.toggle(`search-select-placeholder`,!t))}_syncReset(){let{reset:e}=this._refs();e&&(e.hidden=!(this.hasAttribute(`clearable`)&&this._value!==``&&!this.hasAttribute(`disabled`)))}_wire(){this._teardown();let e=this._refs();if(!e.control||!e.menu)return;let t=()=>{if(this.hasAttribute(`compact`)){let t=e.control.getBoundingClientRect();e.menu.style.width=`max-content`,e.menu.style.minWidth=`${t.width}px`,e.menu.style.maxWidth=`280px`,o(e.control,e.menu)}else o(e.control,e.menu,{matchWidth:!0})},n=(t,{reveal:n=!0}={})=>{let r=this._visible();this._active=t,di(e.optionsWrap,t>=0&&r[t]||null),t>=0&&r[t]?(n&&r[t].scrollIntoView({block:`nearest`}),e.control.setAttribute(`aria-activedescendant`,r[t].id)):e.control.removeAttribute(`aria-activedescendant`)},r=n=>{let r=n.trim().toLowerCase(),i=0;for(let e of this._optionEls()){let t=!r||e.textContent.toLowerCase().includes(r);e.hidden=!t,t&&(i+=1)}e.empty&&(e.empty.hidden=i>0),e.clear&&(e.clear.hidden=!r),e.menu.hidden||t()},i=()=>!e.menu.hidden,a=()=>{i()&&t()},l=()=>{e.menu.hidden=!1,e.control.setAttribute(`aria-expanded`,`true`),e.control.classList.add(`open`),t(),s(this,a),e.search&&(e.search.value=``,r(``),e.search.focus()),n(this._optionEls().findIndex(e=>e.classList.contains(`selected`)))},u=()=>{e.menu.hidden=!0,e.control.setAttribute(`aria-expanded`,`false`),e.control.classList.remove(`open`),n(-1),c(this)},d=t=>{this.value=t.dataset.value,this.dispatchEvent(new Event(`change`,{bubbles:!0})),u(),e.control.focus()};this._navHandler=ui({getVisibleOptions:()=>this._visible(),getActive:()=>this._active,setActive:e=>n(e),onEnter:e=>{e&&d(e)},onEscape:()=>{this._navHandler.clearTypeahead(),u(),e.control.focus()}});let f=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation()),this._navHandler.handler(e)};e.reset?.addEventListener(`click`,t=>{t.stopPropagation(),this.value=``,this.dispatchEvent(new Event(`change`,{bubbles:!0})),e.control.focus()}),e.control.addEventListener(`click`,()=>i()?u():l()),e.control.addEventListener(`keydown`,e=>{if(i()){f(e);return}(e.key===`ArrowDown`||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),l())}),e.optionsWrap.addEventListener(`click`,e=>{let t=e.target.closest(`.search-select-option`);t&&d(t)}),e.optionsWrap.addEventListener(`mousemove`,e=>{let t=e.target.closest(`.search-select-option`);t&&!t.classList.contains(`is-active`)&&n(this._visible().indexOf(t),{reveal:!1})}),e.optionsWrap.addEventListener(`mouseleave`,()=>n(-1)),e.search?.addEventListener(`input`,()=>{r(e.search.value),n(-1)}),e.clear?.addEventListener(`click`,()=>{e.search.value=``,r(``),e.search.focus()}),e.menu.addEventListener(`keydown`,f),this._bindGlobal=()=>{this._teardown(),this._onDocClick=e=>{i()&&!this.contains(e.target)&&u()},document.addEventListener(`click`,this._onDocClick),i()&&s(this,a)},this._bindGlobal()}_teardown(){this._onDocClick&&=(document.removeEventListener(`click`,this._onDocClick),null),c(this),this._navHandler?.teardown()}disconnectedCallback(){this._teardown()}},Ga=e=>String(e??``).replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`),Ka=e=>{if(e==null)return null;let t=String(e).split(`,`).map(e=>e.trim().toUpperCase()).filter(Boolean);return t.length?new Set(t):null},qa=e=>{let t=Ka(e);return Ha.filter(([e])=>!t||t.has(e)).map(([e,t])=>({value:e,label:t,flag:e}))},Ja=class extends Wa{static get observedAttributes(){return[...Wa.observedAttributes,`countries`]}_readOptions(){let e=this.getAttribute(`countries`);return this._countryCache?.attr!==e&&(this._countryCache={attr:e,options:qa(e)}),this._countryCache.options}},Ya=`.wui-col-resize`,Xa=`.wui-group-row, .wui-virtual-spacer`,Za=`.wui-select-cell, .wui-expand-cell`,Qa=`<svg class="wui-icon" data-icon="chevron-down" width="16" height="16" viewBox="0 0 24 24" fill="none" aria-hidden="true" style="vertical-align:-.125em"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="1.5" d="M19.92 8.95l-6.52 6.52c-.77.77-2.03.77-2.8 0L4.08 8.95"></path></svg>`,$a=e=>e.hasAttribute(`data-wui-skeleton`)||!!e.querySelector(`:scope > td > .skeleton`),eo=class extends l{constructor(){super(),this._frame=0,this._headDirty=!0,this._rowsDirty=!0,this._frozenSig=null,this._natural=[],this._widths={},this._collapsed=new Set,this._groupOrder=[],this._items=[],this._range=null,this._drag=null,this._userSized=!1,this._swallowClick=!1,this._mo=null,this._ro=null,this._fonts=null,this._onPointerDown=e=>this._startDrag(e),this._onKeyDown=e=>this._key(e),this._onClick=e=>this._click(e),this._onDblClick=e=>{let t=e.target.closest?.(Ya);t&&this.contains(t)&&this._reset(t.closest(`th`))},this._onScroll=()=>{this.hasAttribute(`virtual`)&&this._schedule()},this._onFonts=()=>{this._userSized||this._drag||this._frozenSig===null||!this.hasAttribute(`resizable`)||(this._frozenSig=null,this._schedule())}}connectedCallback(){this._widths=$e(this.getAttribute(`view-key`)),this.addEventListener(`pointerdown`,this._onPointerDown,!0),this.addEventListener(`keydown`,this._onKeyDown,!0),this.addEventListener(`click`,this._onClick,!0),this.addEventListener(`dblclick`,this._onDblClick),this.addEventListener(`scroll`,this._onScroll,{passive:!0}),this._fonts=this.ownerDocument.fonts??null,this._fonts?.addEventListener(`loadingdone`,this._onFonts),typeof MutationObserver<`u`&&(this._mo=new MutationObserver(e=>this._mutated(e)),this._mo.observe(this,{childList:!0,subtree:!0})),typeof ResizeObserver<`u`&&(this._ro=new ResizeObserver(()=>this._schedule()),this._ro.observe(this)),this._headDirty=!0,this._rowsDirty=!0,this._schedule()}disconnectedCallback(){this.removeEventListener(`pointerdown`,this._onPointerDown,!0),this.removeEventListener(`keydown`,this._onKeyDown,!0),this.removeEventListener(`click`,this._onClick,!0),this.removeEventListener(`dblclick`,this._onDblClick),this.removeEventListener(`scroll`,this._onScroll),this._fonts?.removeEventListener(`loadingdone`,this._onFonts),this._fonts=null,this._mo?.disconnect(),this._ro?.disconnect(),this._mo=null,this._ro=null,this._frame&&cancelAnimationFrame(this._frame),this._frame=0,this._drag=null}refresh(){this._headDirty=!0,this._rowsDirty=!0,this._run()}get _table(){return this.querySelector(`:scope > table`)}_headCells(e){let t=e.tHead?.rows[0];return t?[...t.cells]:[]}_schedule(){this._frame||=requestAnimationFrame(()=>{this._frame=0,this._run()})}_mutated(e){for(let t of e){let e=t.target.nodeType===1?t.target:t.target.parentElement;e&&((e.closest(`thead`)||e===this._table||e===this)&&(this._headDirty=!0),(e.closest(`tbody, tfoot`)||e===this._table||e===this)&&(this._rowsDirty=!0))}this._schedule()}_run(){let e=this._table;if(!e)return;let t=this._headDirty,n=this._rowsDirty;this._headDirty=!1,this._rowsDirty=!1,n&&this.hasAttribute(`group-by`)&&this._group(e),this._pins(e,t||n),this.hasAttribute(`resizable`)&&(t&&this._handles(e),this._layout(e)),this.hasAttribute(`virtual`)&&this._virtual(e,t||n),this._mo?.takeRecords()}_pins(e,t){let n=this._headCells(e),r=n.map(e=>{let t=e.dataset.pin;return t===`start`||t===`end`?t:e.matches(Za)?`lead`:null});if(!r.some(e=>e===`start`||e===`end`))return;let i=it(r);i.forEach((e,t)=>{e&&this._ro?.observe(n[t])});let a=e=>n[e].getBoundingClientRect().width,o=0;i.forEach((t,n)=>{t?.side===`start`&&(this._setVar(e,tt(`start`,t.ordinal),o),o+=a(n))}),o=0;for(let t=i.length-1;t>=0;t--){let n=i[t];n?.side===`end`&&(this._setVar(e,tt(`end`,n.ordinal),o),o+=a(t))}if(t)for(let t of e.rows)t.matches(`${Xa}, .wui-row-expanded`)||t.cells.length!==n.length||i.forEach((e,n)=>{if(!e)return;let r=t.cells[n];r.classList.contains(`wui-pin-${e.side}`)||r.classList.add(`wui-pin-${e.side}`),e.edge&&!r.classList.contains(`wui-pin-${e.side}-edge`)&&r.classList.add(`wui-pin-${e.side}-edge`);let i=rt(e.side,e.ordinal);r.style.getPropertyValue(`--wui-pin-at`)!==i&&r.style.setProperty(nt,i)})}_setVar(e,t,n){let r=`${Math.round(n*100)/100}px`;e.style.getPropertyValue(t)!==r&&e.style.setProperty(t,r)}_resizable(e){return e.map((t,n)=>n<e.length-1&&!t.matches(Za))}_handles(e){let t=this._headCells(e),n=this._resizable(t);t.forEach((e,t)=>{if(!n[t]||e.querySelector(Ya))return;let r=e.ownerDocument.createElement(`span`);r.className=`wui-col-resize`,r.setAttribute(`role`,`separator`),r.setAttribute(`aria-orientation`,`vertical`),r.setAttribute(`aria-valuemin`,`48`),r.setAttribute(`aria-valuemax`,String(He)),r.setAttribute(`tabindex`,`0`);let i=e.textContent.trim();r.setAttribute(`aria-label`,A.resize(i)),i&&!e.hasAttribute(`aria-label`)&&e.setAttribute(`aria-label`,i),e.classList.add(`wui-col-resizable`),e.appendChild(r)})}_hasRows(e){for(let t of e.tBodies)for(let e of t.rows)if(!e.matches(Xa)&&!$a(e))return!0;return!1}_signature(e){return e.map(e=>e.dataset.key||e.textContent.trim()).join(``)}_layout(e){let t=this._headCells(e),n=this._signature(t);!t.length||n===this._frozenSig||(this._hasRows(e)?this._freeze(e,t,n):this._applyRemembered(t))}_applyRemembered(e){for(let t of e){let e=t.dataset.key&&this._widths[t.dataset.key];e&&(t.style.width=`${e}px`);let n=t.querySelector(Ya);n&&this._handleValue(n,Ye(e||t.getBoundingClientRect().width))}}_freeze(e,t,n){e.style.tableLayout=``,e.style.width=``,e.removeAttribute(`data-wui-fixed`);for(let e of t)e.hasAttribute(`data-wui-width`)&&(e.style.width=``,e.removeAttribute(`data-wui-width`));this._natural=t.map(e=>e.getBoundingClientRect().width),t.forEach((e,n)=>{if(n===t.length-1||e.matches(Za))return;let r=e.dataset.key&&this._widths[e.dataset.key];this._setWidth(e,r||this._natural[n])}),e.style.tableLayout=`fixed`,e.setAttribute(`data-wui-fixed`,``),this._frozenSig=n,this._fitTable(e,t)}_setWidth(e,t){let n=Ye(t);e.style.width=`${n}px`,e.setAttribute(`data-wui-width`,``);let r=e.querySelector(Ya);return r&&this._handleValue(r,n),n}_handleValue(e,t){e.setAttribute(`aria-valuenow`,String(t)),e.setAttribute(`aria-valuetext`,A.width(t))}_fitTable(e,t){let n=t.length-1,r=this._natural[n]||0;for(let e=0;e<n;e++)r+=Number.parseFloat(t[e].style.width)||this._natural[e]||0;e.style.width=`max(100%, ${Math.round(r)}px)`}_ensureFrozen(e){let t=this._headCells(e),n=this._signature(t);return n!==this._frozenSig&&this._freeze(e,t,n),t}_resizeTo(e,t,n){let r=this._table;if(!r)return;let i=this._ensureFrozen(r);this._userSized=!0,this._setWidth(e,t),this._fitTable(r,i),n&&this._remember(e),this._pins(r,!1)}_remember(e){let t=e.dataset.key;t&&(this._widths={...this._widths,[t]:Number.parseFloat(e.style.width)},et(this.getAttribute(`view-key`),this._widths))}_reset(e){let t=this._table;if(!e||!t)return;let n=this._ensureFrozen(t);this._userSized=!0;let r=e.dataset.key;if(r&&r in this._widths){let{[r]:e,...t}=this._widths;this._widths=t,et(this.getAttribute(`view-key`),this._widths)}this._setWidth(e,this._natural[n.indexOf(e)]||0),this._fitTable(t,n),this._pins(t,!1)}_rtl(){return getComputedStyle(this).direction===`rtl`}_startDrag(e){let t=e.target.closest?.(Ya);if(!t||!this.contains(t)||e.button!==0)return;e.preventDefault(),e.stopPropagation();let n=t.closest(`th`),r=this._table;if(!n||!r)return;this._ensureFrozen(r);let i={th:n,x:e.clientX,from:n.getBoundingClientRect().width,dir:this._rtl()?-1:1,moved:!1};this._drag=i,t.setPointerCapture?.(e.pointerId),t.classList.add(`is-dragging`);let a=e=>{let t=(e.clientX-i.x)*i.dir;Math.abs(t)>1&&(i.moved=!0),this._resizeTo(n,i.from+t,!1)},o=e=>{t.removeEventListener(`pointermove`,a),t.removeEventListener(`pointerup`,o),t.removeEventListener(`pointercancel`,o),t.classList.remove(`is-dragging`),this._drag=null,e.type===`pointercancel`?this._resizeTo(n,i.from,!1):i.moved&&this._remember(n),this._swallowClick=!0,setTimeout(()=>{this._swallowClick=!1},0)};t.addEventListener(`pointermove`,a),t.addEventListener(`pointerup`,o),t.addEventListener(`pointercancel`,o)}_key(e){let t=e.target.closest?.(Ya);if(!t||!this.contains(t))return;let n=t.closest(`th`);if(e.key===`Enter`||e.key===` `){e.preventDefault(),e.stopPropagation();return}if(e.key===`Home`){e.preventDefault(),e.stopPropagation(),this._reset(n);return}if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault(),e.stopPropagation();let r=this._table;if(!r)return;this._ensureFrozen(r);let i=e.shiftKey?50:10,a=e.key===`ArrowRight`!==this._rtl(),o=Number.parseFloat(n.style.width)||n.getBoundingClientRect().width;this._resizeTo(n,o+(a?i:-i),!0)}_click(e){let t=!!e.target.closest?.(Ya);if(this._swallowClick||t){e.stopPropagation(),(t||this._swallowClick)&&e.preventDefault(),this._swallowClick=!1;return}if(!this.hasAttribute(`group-by`))return;let n=(e.target.closest?.(`.wui-group-toggle`))?.closest(`.wui-group-row`);if(!n||!this.contains(n))return;let r=n.dataset.groupKey;this._collapsed.has(r)?this._collapsed.delete(r):this._collapsed.add(r),this._showGroup(n,!this._collapsed.has(r));let i=this._table;i&&this.hasAttribute(`virtual`)&&(this._virtual(i,!0),this._mo?.takeRecords())}_group(e){let t=this.getAttribute(`group-by`),n=this._headCells(e),r=n.findIndex(e=>e.dataset.key===t);if(r<0)throw Error(`<wui-data-table group-by="${t}"> needs a header cell with data-key="${t}".`);let i=e.tBodies[0];if(!i)return;let a=[...i.rows].filter(e=>!e.matches(Xa));if(a.some($a))return;let o=this.ownerDocument,s=new Map([...i.querySelectorAll(`:scope > tr.wui-group-row`)].map(e=>[e.dataset.groupKey,e])),c=Xe(a,e=>e.dataset.group??e.cells[r]?.textContent.trim()??``,this._groupOrder);this._groupOrder=c.map(e=>e.key);let l=o.createDocumentFragment(),u=c.map(e=>{let t=s.get(e.key)??this._groupRow(o,e.key);return s.delete(e.key),t.querySelector(`.wui-group-cell`).colSpan=n.length,t.querySelector(`.wui-group-count`).textContent=Je(e.items.length),t.querySelector(`.wui-group-rows`).textContent=`, ${A.rows(e.items.length)}`,l.append(t,...e.items),[t,e.key]});for(let e of s.values())e.remove();i.insertBefore(l,this._bottom?.parentNode===i?this._bottom:null);for(let[e,t]of u)this._showGroup(e,!this._collapsed.has(t))}_groupRow(e,t){let n=e.createElement(`tr`);n.className=`wui-group-row`,n.dataset.groupKey=t;let r=e.createElement(`th`);r.className=`wui-group-cell`,r.scope=`rowgroup`;let i=e.createElement(`button`);i.type=`button`,i.className=`wui-group-toggle`,i.innerHTML=Qa;let a=e.createElement(`span`);a.className=`wui-group-label`,a.textContent=t;let o=e.createElement(`span`);o.className=`wui-group-count`,o.setAttribute(`aria-hidden`,`true`);let s=e.createElement(`span`);return s.className=`visually-hidden wui-group-rows`,i.append(a,o,s),r.append(i),n.append(r),n}_showGroup(e,t){if(e){e.querySelector(`.wui-group-toggle`)?.setAttribute(`aria-expanded`,String(t));for(let n=e.nextElementSibling;n&&!n.matches(Xa);n=n.nextElementSibling)n.hidden=!t}}_spacer(e,t){if(t?.parentNode===e)return t;let n=e.ownerDocument,r=n.createElement(`tr`);return r.className=`wui-virtual-spacer`,r.setAttribute(`aria-hidden`,`true`),r.append(n.createElement(`td`)),r}_virtual(e,t){let n=e.tBodies[0];if(!n)return;if(t){this._top=this._spacer(n,this._top),this._bottom=this._spacer(n,this._bottom),n.firstElementChild!==this._top&&n.insertBefore(this._top,n.firstChild),n.lastElementChild!==this._bottom&&n.append(this._bottom);let t=Math.max(1,this._headCells(e).length);this._top.cells[0].colSpan=t,this._bottom.cells[0].colSpan=t,this._items=[...n.rows].filter(e=>!e.classList.contains(`wui-virtual-spacer`)&&!e.hidden),this._range=null,e.setAttribute(`aria-rowcount`,String(this._items.length+1)),e.tHead?.rows[0]?.setAttribute(`aria-rowindex`,`1`),this._items.forEach((e,t)=>e.setAttribute(`aria-rowindex`,String(t+2))),this._rowHeight>0||(this._rowHeight=this._measureRow(e))}let r=e.tHead?.getBoundingClientRect().height||0,i=Ze({scrollTop:this.scrollTop-r,viewport:this.clientHeight,rowHeight:this._rowHeight,count:this._items.length}),a=this._range;if(a&&a.start===i.start&&a.end===i.end)return;let o=a?Math.min(a.start,i.start):0,s=a?Math.max(a.end,i.end):this._items.length;for(let e=o;e<s;e++){let t=e<i.start||e>=i.end,n=this._items[e];n.classList.contains(`wui-virtual-off`)!==t&&n.classList.toggle(`wui-virtual-off`,t)}this._range=i,this._top.hidden=i.before===0,this._bottom.hidden=i.after===0,this._top.cells[0].style.height=`${i.before}px`,this._bottom.cells[0].style.height=`${i.after}px`}_measureRow(e){let t=this._items.find(e=>!e.classList.contains(`wui-group-row`)&&!e.classList.contains(`wui-virtual-off`))?.getBoundingClientRect().height;return t>0?t:e.classList.contains(`wui-table-compact`)?qe.compact:e.classList.contains(`wui-table-cozy`)?qe.cozy:qe.comfortable}},to=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],no=[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],ro=e=>{let t=String(e??``).trim();return/^[0-6]$/.test(t)?Number(t):null},io=e=>ro(e.getAttribute(`first-day`))??ro(getComputedStyle(e).getPropertyValue(`--wui-first-day`))??1,ao=e=>String(e).padStart(2,`0`),oo=(e,t,n)=>`${e}-${ao(t+1)}-${ao(n)}`,K=e=>{let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e||``);return t?{y:+t[1],m:t[2]-1,d:+t[3]}:null},so=`dd-MMM-yyyy`,co=(e,t=so)=>{let n=K(e);if(!n)return``;let r={yyyy:n.y,MMMM:to[n.m],MMM:to[n.m].slice(0,3),MM:ao(n.m+1),dd:ao(n.d),d:n.d};return(t||`dd-MMM-yyyy`).replace(/yyyy|MMMM|MMM|MM|dd|d/g,e=>r[e])},lo=(e,t)=>new Date(e,t+1,0).getDate(),q=(e,t)=>{for(;t<0;)t+=12,--e;for(;t>11;)t-=12,e+=1;return{y:e,m:t}},uo=class extends l{static formAssociated=!0;static get observedAttributes(){return[`value`,`min`,`max`,`placeholder`,`disabled`,`first-day`,`disabled-weekdays`,`display-format`,`size`,`aria-label`,`aria-describedby`,`aria-invalid`]}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._value=``;let e=new Date(2e3,0,1);this._viewY=e.getFullYear(),this._viewM=e.getMonth(),this._mode=`days`,this._focus=null,this._slide=``}connectedCallback(){if(!this._rendered){this.render();return}this._bindGlobal?.()}attributeChangedCallback(e,t,n){if(e===`aria-invalid`){this._syncInvalid();return}this._rendered&&(e===`value`?(this._value=n||``,this._syncFormValue(),this._syncTrigger()):e===`display-format`?this._syncTrigger():e===`first-day`?this.querySelector(`.datepicker-pop`)?.hidden||this._renderView():this.render())}_syncInvalid(){let e=this.querySelector(`.datepicker-trigger`);e&&(this.hasAttribute(`aria-invalid`)?e.setAttribute(`aria-invalid`,`true`):e.removeAttribute(`aria-invalid`))}formResetCallback(){this.value=this._defaultValue||``}get value(){return this._value}set value(e){this._value=e||``,z(this,this._value),this._syncTrigger()}_firstDay(){return io(this)}render(){this._defaultValue===void 0&&(this._defaultValue=this.getAttribute(`value`)||``,this._value=this._defaultValue||this._value);let e=this.getAttribute(`placeholder`)||`Choose a date`,t=K(this._value);t&&(this._viewY=t.y,this._viewM=t.m);let n=this.getAttribute(`size`),r=n===`sm`?` input-sm`:n===`lg`?` input-lg`:``,i=this.getAttribute(`aria-label`),a=this.getAttribute(`aria-describedby`);this.innerHTML=`
264
264
  <div class="datepicker">
265
265
  <button type="button" class="input datepicker-trigger${r}${t?` has-value`:``}" aria-haspopup="dialog" aria-expanded="false"${this.hasAttribute(`aria-invalid`)?` aria-invalid="true"`:``}${this.hasAttribute(`disabled`)?` disabled`:``}${i?` aria-label="${V(i)}"`:``}${a?` aria-describedby="${V(a)}"`:``}>
266
- <span data-trigger-label class="${t?``:`search-select-placeholder`}">${V(t?oo(this._value,this.getAttribute(`display-format`)):e)}</span>
266
+ <span data-trigger-label class="${t?``:`search-select-placeholder`}">${V(t?co(this._value,this.getAttribute(`display-format`)):e)}</span>
267
267
  ${j(`calendar-dots`)}
268
268
  </button>
269
269
  <div class="datepicker-pop" role="dialog" aria-modal="false" hidden></div>
270
- </div>`,this._rendered=!0,z(this,this._value),this._wire()}_syncFormValue(){z(this,this._value)}_syncTrigger(){let e=this.querySelector(`.datepicker-trigger`),t=this.querySelector(`[data-trigger-label]`);if(!t)return;let n=K(this._value);t.textContent=n?oo(this._value,this.getAttribute(`display-format`)):this.getAttribute(`placeholder`)||`Choose a date`,t.classList.toggle(`search-select-placeholder`,!n),e?.classList.toggle(`has-value`,!!n)}_limits(){let e=K(this.getAttribute(`min`)),t=K(this.getAttribute(`max`)),n=e?new Date(e.y,e.m,e.d).getTime():-1/0,r=t?new Date(t.y,t.m,t.d).getTime():1/0,i=new Set;for(let e of(this.getAttribute(`disabled-weekdays`)||``).split(`,`)){let t=e.trim();/^[0-6]$/.test(t)&&i.add(Number(t))}return{dayDisabled:(e,t,a)=>{let o=new Date(e,t,a),s=o.getTime();return s<n||s>r||i.has(o.getDay())},monthDisabled:(e,t)=>{let i=new Date(e,t,1).getTime();return new Date(e,t,so(e,t)).getTime()<n||i>r},yearDisabled:e=>{let t=new Date(e,0,1).getTime();return new Date(e,11,31).getTime()<n||t>r}}}_renderView(){let e=this.querySelector(`.datepicker-pop`);e&&(this._mode===`months`?e.innerHTML=this._monthsHtml():this._mode===`years`?e.innerHTML=this._yearsHtml():e.innerHTML=this._daysHtml(),this._focusActive())}_daysHtml(){let e=this._firstDay(),t=(new Date(this._viewY,this._viewM,1).getDay()-e+7)%7,n=so(this._viewY,this._viewM),r=K(this._value),i=new Date,{dayDisabled:a}=this._limits(),o=this._focus||r||{y:this._viewY,m:this._viewM,d:1},s=(e,t,n,s)=>{let c=io(e,t,n),l=r&&r.y===e&&r.m===t&&r.d===n,u=i.getFullYear()===e&&i.getMonth()===t&&i.getDate()===n,d=o.y===e&&o.m===t&&o.d===n,f=a(e,t,n);return`<button type="button" class="${[`datepicker-day`,s?`is-outside`:``,u?`is-today`:``,l?`is-selected`:``].filter(Boolean).join(` `)}" data-iso="${c}" role="gridcell" tabindex="${d&&!f?`0`:`-1`}"${l?` aria-selected="true"`:``}${f?` disabled aria-disabled="true"`:``}>${n}</button>`},c=``,l=q(this._viewY,this._viewM-1),u=so(l.y,l.m);for(let e=t-1;e>=0;e--)c+=s(l.y,l.m,u-e,!0);for(let e=1;e<=n;e++)c+=s(this._viewY,this._viewM,e,!1);let d=q(this._viewY,this._viewM+1),f=(7-(t+n)%7)%7;for(let e=1;e<=f;e++)c+=s(d.y,d.m,e,!0);let p=a(i.getFullYear(),i.getMonth(),i.getDate()),m=eo.map((t,n)=>eo[(n+e)%7]).map(e=>`<span>${e}</span>`).join(``);return`
270
+ </div>`,this._rendered=!0,z(this,this._value),this._wire()}_syncFormValue(){z(this,this._value)}_syncTrigger(){let e=this.querySelector(`.datepicker-trigger`),t=this.querySelector(`[data-trigger-label]`);if(!t)return;let n=K(this._value);t.textContent=n?co(this._value,this.getAttribute(`display-format`)):this.getAttribute(`placeholder`)||`Choose a date`,t.classList.toggle(`search-select-placeholder`,!n),e?.classList.toggle(`has-value`,!!n)}_limits(){let e=K(this.getAttribute(`min`)),t=K(this.getAttribute(`max`)),n=e?new Date(e.y,e.m,e.d).getTime():-1/0,r=t?new Date(t.y,t.m,t.d).getTime():1/0,i=new Set;for(let e of(this.getAttribute(`disabled-weekdays`)||``).split(`,`)){let t=e.trim();/^[0-6]$/.test(t)&&i.add(Number(t))}return{dayDisabled:(e,t,a)=>{let o=new Date(e,t,a),s=o.getTime();return s<n||s>r||i.has(o.getDay())},monthDisabled:(e,t)=>{let i=new Date(e,t,1).getTime();return new Date(e,t,lo(e,t)).getTime()<n||i>r},yearDisabled:e=>{let t=new Date(e,0,1).getTime();return new Date(e,11,31).getTime()<n||t>r}}}_renderView(){let e=this.querySelector(`.datepicker-pop`);e&&(this._mode===`months`?e.innerHTML=this._monthsHtml():this._mode===`years`?e.innerHTML=this._yearsHtml():e.innerHTML=this._daysHtml(),this._focusActive())}_daysHtml(){let e=this._firstDay(),t=(new Date(this._viewY,this._viewM,1).getDay()-e+7)%7,n=lo(this._viewY,this._viewM),r=K(this._value),i=new Date,{dayDisabled:a}=this._limits(),o=this._focus||r||{y:this._viewY,m:this._viewM,d:1},s=(e,t,n,s)=>{let c=oo(e,t,n),l=r&&r.y===e&&r.m===t&&r.d===n,u=i.getFullYear()===e&&i.getMonth()===t&&i.getDate()===n,d=o.y===e&&o.m===t&&o.d===n,f=a(e,t,n);return`<button type="button" class="${[`datepicker-day`,s?`is-outside`:``,u?`is-today`:``,l?`is-selected`:``].filter(Boolean).join(` `)}" data-iso="${c}" role="gridcell" tabindex="${d&&!f?`0`:`-1`}"${l?` aria-selected="true"`:``}${f?` disabled aria-disabled="true"`:``}>${n}</button>`},c=``,l=q(this._viewY,this._viewM-1),u=lo(l.y,l.m);for(let e=t-1;e>=0;e--)c+=s(l.y,l.m,u-e,!0);for(let e=1;e<=n;e++)c+=s(this._viewY,this._viewM,e,!1);let d=q(this._viewY,this._viewM+1),f=(7-(t+n)%7)%7;for(let e=1;e<=f;e++)c+=s(d.y,d.m,e,!0);let p=a(i.getFullYear(),i.getMonth(),i.getDate()),m=no.map((t,n)=>no[(n+e)%7]).map(e=>`<span>${e}</span>`).join(``);return`
271
271
  <div class="datepicker-head">
272
272
  <button type="button" class="datepicker-nav-btn" data-nav="-1" aria-label="Previous month">${j(`chevron-left`)}</button>
273
- <button type="button" class="datepicker-month" data-view="months" aria-label="Choose month and year">${$a[this._viewM]} ${this._viewY}</button>
273
+ <button type="button" class="datepicker-month" data-view="months" aria-label="Choose month and year">${to[this._viewM]} ${this._viewY}</button>
274
274
  <button type="button" class="datepicker-nav-btn" data-nav="1" aria-label="Next month">${j(`chevron-right`)}</button>
275
275
  </div>
276
276
  <div class="datepicker-weekdays">${m}</div>
@@ -278,7 +278,7 @@ var WeborityUiElements=(function(e){Object.defineProperty(e,Symbol.toStringTag,{
278
278
  <div class="datepicker-foot">
279
279
  <button type="button" class="datepicker-link" data-today${p?` disabled`:``}>Today</button>
280
280
  <button type="button" class="datepicker-link" data-clear>Clear</button>
281
- </div>`}_monthsHtml(){let e=K(this._value),t=new Date,{monthDisabled:n}=this._limits(),r=``;for(let i=0;i<12;i++){let a=e&&e.y===this._viewY&&e.m===i,o=t.getFullYear()===this._viewY&&t.getMonth()===i,s=n(this._viewY,i),c=[`datepicker-cell`,o?`is-today`:``,a?`is-selected`:``].filter(Boolean).join(` `);r+=`<button type="button" class="${c}" data-month="${i}"${s?` disabled`:``}>${$a[i].slice(0,3)}</button>`}return`
281
+ </div>`}_monthsHtml(){let e=K(this._value),t=new Date,{monthDisabled:n}=this._limits(),r=``;for(let i=0;i<12;i++){let a=e&&e.y===this._viewY&&e.m===i,o=t.getFullYear()===this._viewY&&t.getMonth()===i,s=n(this._viewY,i),c=[`datepicker-cell`,o?`is-today`:``,a?`is-selected`:``].filter(Boolean).join(` `);r+=`<button type="button" class="${c}" data-month="${i}"${s?` disabled`:``}>${to[i].slice(0,3)}</button>`}return`
282
282
  <div class="datepicker-head">
283
283
  <button type="button" class="datepicker-nav-btn" data-nav-year="-1" aria-label="Previous year">${j(`chevron-left`)}</button>
284
284
  <button type="button" class="datepicker-month" data-view="years" aria-label="Choose year">${this._viewY}</button>
@@ -290,16 +290,16 @@ var WeborityUiElements=(function(e){Object.defineProperty(e,Symbol.toStringTag,{
290
290
  <span class="datepicker-month">${r+1} to ${r+10}</span>
291
291
  <button type="button" class="datepicker-nav-btn" data-nav-decade="1" aria-label="Next decade">${j(`chevron-right`)}</button>
292
292
  </div>
293
- <div class="datepicker-cells">${i}</div>`}_focusActive(){let e=this.querySelector(`.datepicker-pop`),t=e?.querySelector(`[tabindex="0"]`)||e?.querySelector(`.is-selected`)||e?.querySelector(`.datepicker-day:not(:disabled), .datepicker-cell:not(:disabled)`);t&&e.contains(document.activeElement)&&t.focus()}_position(e,t){o(e,t,{clampHeight:!0})}_setFocus(e,t,n,r){let{y:i,m:a}=q(e,t);this._focus={y:i,m:a,d:n};let o=i!==this._viewY||a!==this._viewM;this._viewY=i,this._viewM=a,this._slide=o&&r||``,this._renderView(),this._slide=``,this.querySelector(`.datepicker-day[data-iso="${io(i,a,n)}"]`)?.focus()}_seek(e,t,n,r){let{dayDisabled:i}=this._limits(),a=new Date(e,t,n);for(let e=0;e<400;e++,a.setDate(a.getDate()+r))if(!i(a.getFullYear(),a.getMonth(),a.getDate()))return new Date(a);return null}_onKey(e){if(this._mode!==`days`)return;let t=this._focus||K(this._value)||{y:this._viewY,m:this._viewM,d:1},n=(e,t,n,r,i)=>{let a=this._seek(e,t,n,r);a&&this._setFocus(a.getFullYear(),a.getMonth(),a.getDate(),i)},r=(r,i,a=r<0?-1:1)=>{e.preventDefault(),n(t.y,t.m,t.d+r,a,i)};switch(e.key){case`ArrowLeft`:return r(-1,`slide-prev`);case`ArrowRight`:return r(1,`slide-next`);case`ArrowUp`:return r(-7,`slide-prev`);case`ArrowDown`:return r(7,`slide-next`);case`Home`:return r(-((new Date(t.y,t.m,t.d).getDay()-this._firstDay()+7)%7),`slide-prev`,1);case`End`:return r(6-(new Date(t.y,t.m,t.d).getDay()-this._firstDay()+7)%7,`slide-next`,-1);case`PageUp`:{e.preventDefault();let r=q(t.y,t.m-(e.shiftKey?12:1));return n(r.y,r.m,Math.min(t.d,so(r.y,r.m)),-1,`slide-prev`)}case`PageDown`:{e.preventDefault();let r=q(t.y,t.m+(e.shiftKey?12:1));return n(r.y,r.m,Math.min(t.d,so(r.y,r.m)),1,`slide-next`)}case`Enter`:case` `:e.preventDefault(),this._limits().dayDisabled(t.y,t.m,t.d)||(this.value=io(t.y,t.m,t.d),this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close());return;default:}}_wire(){this._teardown();let e=this.querySelector(`.datepicker-trigger`),t=this.querySelector(`.datepicker-pop`),n=this.querySelector(`.datepicker`);if(!e||!t)return;let r=()=>!t.hidden,i=()=>{r()&&this._position(e,t)};this._open=()=>{let r=new Date,a=K(this._value);(a||!this._viewNavigated)&&(this._viewY=r.getFullYear(),this._viewM=r.getMonth()),this._mode=`days`;let o=r.getFullYear()===this._viewY&&r.getMonth()===this._viewM,c=a&&a.y===this._viewY&&a.m===this._viewM;if(this._focus=c?a:{y:this._viewY,m:this._viewM,d:o?r.getDate():1},this._limits().dayDisabled(this._focus.y,this._focus.m,this._focus.d)){let e=this._focus,t=[1,-1].map(t=>this._seek(e.y,e.m,e.d,t)).find(t=>t&&t.getMonth()===e.m);t&&(this._focus={y:t.getFullYear(),m:t.getMonth(),d:t.getDate()})}this._renderView(),t.hidden=!1,n?.classList.add(`open`),this._position(e,t),s(this,i),e.setAttribute(`aria-expanded`,`true`),t.querySelector(`[tabindex="0"]`)?.focus()},this._close=()=>{t.hidden=!0,n?.classList.remove(`open`),e.setAttribute(`aria-expanded`,`false`),c(this),e.focus()},e.addEventListener(`click`,()=>r()?this._close():this._open()),t.addEventListener(`click`,e=>{this._popClick=!0;let t=e.target.closest(`[data-nav]`);if(t){this._viewNavigated=!0,this._slide=Number(t.dataset.nav)<0?`slide-prev`:`slide-next`;let e=q(this._viewY,this._viewM+Number(t.dataset.nav));this._viewY=e.y,this._viewM=e.m,this._focus={y:e.y,m:e.m,d:1},this._renderView(),this._slide=``;return}let n=e.target.closest(`[data-nav-year]`);if(n){this._viewY+=Number(n.dataset.navYear),this._renderView();return}let r=e.target.closest(`[data-nav-decade]`);if(r){this._viewY+=Number(r.dataset.navDecade)*10,this._renderView();return}let i=e.target.closest(`[data-view]`);if(i){this._mode=i.dataset.view,this._renderView();return}let a=e.target.closest(`[data-month]`);if(a&&!a.disabled){this._viewNavigated=!0,this._viewM=Number(a.dataset.month),this._mode=`days`,this._focus={y:this._viewY,m:this._viewM,d:1},this._renderView();return}let o=e.target.closest(`[data-year]`);if(o&&!o.disabled){this._viewNavigated=!0,this._viewY=Number(o.dataset.year),this._mode=`months`,this._renderView();return}if(e.target.closest(`[data-today]`)){let e=new Date;if(this._limits().dayDisabled(e.getFullYear(),e.getMonth(),e.getDate()))return;this.value=io(e.getFullYear(),e.getMonth(),e.getDate()),this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close();return}if(e.target.closest(`[data-clear]`)){this.value=``,this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close();return}let s=e.target.closest(`.datepicker-day[data-iso]`);s&&!s.disabled&&(this.value=s.dataset.iso,this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close())}),this._onKeyBound=e=>{r()&&this._onKey(e)},t.addEventListener(`keydown`,this._onKeyBound),this._bindGlobal=()=>{this._teardown(),this._onDocClick=e=>{let t=this._popClick;this._popClick=!1,r()&&!t&&!this.contains(e.target)&&this._close()},document.addEventListener(`click`,this._onDocClick),this._onDocKey=e=>{r()&&e.key===`Escape`&&this._close()},document.addEventListener(`keydown`,this._onDocKey),this._onHostKey=e=>{!r()||e.key!==`Escape`||(e.preventDefault(),e.stopPropagation(),this._close())},this.addEventListener(`keydown`,this._onHostKey),r()&&s(this,i)},this._bindGlobal(),this._syncFormValue()}_teardown(){this._onDocClick&&=(document.removeEventListener(`click`,this._onDocClick),null),this._onDocKey&&=(document.removeEventListener(`keydown`,this._onDocKey),null),this._onHostKey&&=(this.removeEventListener(`keydown`,this._onHostKey),null),c(this)}disconnectedCallback(){this._teardown()}},lo=`Asia/Kolkata`,uo=3,fo=[`today`,`yesterday`,`last7Days`,`last30Days`,`thisMonth`,`lastMonth`,`thisFinancialYear`],po={today:`Today`,yesterday:`Yesterday`,last7Days:`Last 7 days`,last30Days:`Last 30 days`,thisMonth:`This month`,lastMonth:`Last month`,thisFinancialYear:`This financial year`},mo=e=>String(e).padStart(2,`0`),ho=e=>`${e.getUTCFullYear()}-${mo(e.getUTCMonth()+1)}-${mo(e.getUTCDate())}`;function go(e=new Date){let t=new Intl.DateTimeFormat(`en-US`,{timeZone:lo,year:`numeric`,month:`2-digit`,day:`2-digit`}).formatToParts(e),n=e=>t.find(t=>t.type===e).value;return`${n(`year`)}-${n(`month`)}-${n(`day`)}`}function _o(e,t=new Date){let{y:n,m:r,d:i}=K(go(t)),a=(e,t,n)=>ho(new Date(Date.UTC(e,t,n))),o=po[e];switch(e){case`today`:return{label:o,start:a(n,r,i),end:a(n,r,i)};case`yesterday`:return{label:o,start:a(n,r,i-1),end:a(n,r,i-1)};case`last7Days`:return{label:o,start:a(n,r,i-6),end:a(n,r,i)};case`last30Days`:return{label:o,start:a(n,r,i-29),end:a(n,r,i)};case`thisMonth`:return{label:o,start:a(n,r,1),end:a(n,r+1,0)};case`lastMonth`:return{label:o,start:a(n,r-1,1),end:a(n,r,0)};case`thisFinancialYear`:{let e=r>=uo?n:n-1;return{label:o,start:a(e,uo,1),end:a(e+1,uo,0)}}default:return null}}function vo(e){console.warn(`[@webority/ui-elements] <wui-date-range> presets: ${e}`)}function yo(e,t=new Date){let n=String(e??``).trim();if(!n)return[];let r;if(n.startsWith(`[`))try{r=JSON.parse(n)}catch{return vo(`the attribute is not valid JSON`),[]}else r=n.split(`,`).map(e=>e.trim());let i=[];for(let e of r)if(typeof e==`string`){let n=_o(e,t);n?i.push(n):vo(`"${e}" is not one of ${fo.join(`, `)}`)}else e&&typeof e.label==`string`&&e.label&&K(e.start)&&K(e.end)?i.push({label:e.label,start:e.start,end:e.end}):vo(`an item needs a label and ISO start and end dates, or a preset name`);return i}var bo=class extends l{static formAssociated=!0;static get observedAttributes(){return[`start`,`end`,`min`,`max`,`placeholder`,`disabled`,`first-day`,`size`,`aria-label`,`aria-describedby`,`name`,`start-name`,`end-name`,`presets`,`aria-invalid`]}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._start=``,this._end=``,this._hover=``;let e=new Date(2e3,0,1);this._viewY=e.getFullYear(),this._viewM=e.getMonth()}connectedCallback(){if(!this._rendered){this.render();return}this._bindGlobal?.()}attributeChangedCallback(e,t,n){if(e===`aria-invalid`){this._syncInvalid();return}this._rendered&&(e===`start`||e===`end`?(this._start=this.getAttribute(`start`)||``,this._end=this.getAttribute(`end`)||``,this._syncTrigger(),this._syncMirrors()):this.render())}_syncInvalid(){let e=this.querySelector(`.daterange-trigger`);e&&(this.hasAttribute(`aria-invalid`)?e.setAttribute(`aria-invalid`,`true`):e.removeAttribute(`aria-invalid`))}get value(){return{start:this._start,end:this._end}}set value(e){this._start=e?.start||``,this._end=e?.end||``,this._syncTrigger(),this._syncMirrors()}_firstDay(){return no(this)}_label(){let e=this.getAttribute(`placeholder`)||`Start to End`;return!this._start&&!this._end?{text:e,empty:!0}:{text:`${oo(this._start)||`Start`} to ${oo(this._end)||`End`}`,empty:!1}}render(){this._defaultStart===void 0&&(this._defaultStart=this.getAttribute(`start`)||``,this._defaultEnd=this.getAttribute(`end`)||``,this._start=this._defaultStart||this._start,this._end=this._defaultEnd||this._end);let e=K(this._start);e&&(this._viewY=e.y,this._viewM=e.m);let t=this.getAttribute(`size`),n=t===`sm`?` input-sm`:t===`lg`?` input-lg`:``,{text:r,empty:i}=this._label(),a=this.getAttribute(`aria-label`),o=this.getAttribute(`aria-describedby`);this.innerHTML=`
293
+ <div class="datepicker-cells">${i}</div>`}_focusActive(){let e=this.querySelector(`.datepicker-pop`),t=e?.querySelector(`[tabindex="0"]`)||e?.querySelector(`.is-selected`)||e?.querySelector(`.datepicker-day:not(:disabled), .datepicker-cell:not(:disabled)`);t&&e.contains(document.activeElement)&&t.focus()}_position(e,t){o(e,t,{clampHeight:!0})}_setFocus(e,t,n,r){let{y:i,m:a}=q(e,t);this._focus={y:i,m:a,d:n};let o=i!==this._viewY||a!==this._viewM;this._viewY=i,this._viewM=a,this._slide=o&&r||``,this._renderView(),this._slide=``,this.querySelector(`.datepicker-day[data-iso="${oo(i,a,n)}"]`)?.focus()}_seek(e,t,n,r){let{dayDisabled:i}=this._limits(),a=new Date(e,t,n);for(let e=0;e<400;e++,a.setDate(a.getDate()+r))if(!i(a.getFullYear(),a.getMonth(),a.getDate()))return new Date(a);return null}_onKey(e){if(this._mode!==`days`)return;let t=this._focus||K(this._value)||{y:this._viewY,m:this._viewM,d:1},n=(e,t,n,r,i)=>{let a=this._seek(e,t,n,r);a&&this._setFocus(a.getFullYear(),a.getMonth(),a.getDate(),i)},r=(r,i,a=r<0?-1:1)=>{e.preventDefault(),n(t.y,t.m,t.d+r,a,i)};switch(e.key){case`ArrowLeft`:return r(-1,`slide-prev`);case`ArrowRight`:return r(1,`slide-next`);case`ArrowUp`:return r(-7,`slide-prev`);case`ArrowDown`:return r(7,`slide-next`);case`Home`:return r(-((new Date(t.y,t.m,t.d).getDay()-this._firstDay()+7)%7),`slide-prev`,1);case`End`:return r(6-(new Date(t.y,t.m,t.d).getDay()-this._firstDay()+7)%7,`slide-next`,-1);case`PageUp`:{e.preventDefault();let r=q(t.y,t.m-(e.shiftKey?12:1));return n(r.y,r.m,Math.min(t.d,lo(r.y,r.m)),-1,`slide-prev`)}case`PageDown`:{e.preventDefault();let r=q(t.y,t.m+(e.shiftKey?12:1));return n(r.y,r.m,Math.min(t.d,lo(r.y,r.m)),1,`slide-next`)}case`Enter`:case` `:e.preventDefault(),this._limits().dayDisabled(t.y,t.m,t.d)||(this.value=oo(t.y,t.m,t.d),this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close());return;default:}}_wire(){this._teardown();let e=this.querySelector(`.datepicker-trigger`),t=this.querySelector(`.datepicker-pop`),n=this.querySelector(`.datepicker`);if(!e||!t)return;let r=()=>!t.hidden,i=()=>{r()&&this._position(e,t)};this._open=()=>{let r=new Date,a=K(this._value);(a||!this._viewNavigated)&&(this._viewY=r.getFullYear(),this._viewM=r.getMonth()),this._mode=`days`;let o=r.getFullYear()===this._viewY&&r.getMonth()===this._viewM,c=a&&a.y===this._viewY&&a.m===this._viewM;if(this._focus=c?a:{y:this._viewY,m:this._viewM,d:o?r.getDate():1},this._limits().dayDisabled(this._focus.y,this._focus.m,this._focus.d)){let e=this._focus,t=[1,-1].map(t=>this._seek(e.y,e.m,e.d,t)).find(t=>t&&t.getMonth()===e.m);t&&(this._focus={y:t.getFullYear(),m:t.getMonth(),d:t.getDate()})}this._renderView(),t.hidden=!1,n?.classList.add(`open`),this._position(e,t),s(this,i),e.setAttribute(`aria-expanded`,`true`),t.querySelector(`[tabindex="0"]`)?.focus()},this._close=()=>{t.hidden=!0,n?.classList.remove(`open`),e.setAttribute(`aria-expanded`,`false`),c(this),e.focus()},e.addEventListener(`click`,()=>r()?this._close():this._open()),t.addEventListener(`click`,e=>{this._popClick=!0;let t=e.target.closest(`[data-nav]`);if(t){this._viewNavigated=!0,this._slide=Number(t.dataset.nav)<0?`slide-prev`:`slide-next`;let e=q(this._viewY,this._viewM+Number(t.dataset.nav));this._viewY=e.y,this._viewM=e.m,this._focus={y:e.y,m:e.m,d:1},this._renderView(),this._slide=``;return}let n=e.target.closest(`[data-nav-year]`);if(n){this._viewY+=Number(n.dataset.navYear),this._renderView();return}let r=e.target.closest(`[data-nav-decade]`);if(r){this._viewY+=Number(r.dataset.navDecade)*10,this._renderView();return}let i=e.target.closest(`[data-view]`);if(i){this._mode=i.dataset.view,this._renderView();return}let a=e.target.closest(`[data-month]`);if(a&&!a.disabled){this._viewNavigated=!0,this._viewM=Number(a.dataset.month),this._mode=`days`,this._focus={y:this._viewY,m:this._viewM,d:1},this._renderView();return}let o=e.target.closest(`[data-year]`);if(o&&!o.disabled){this._viewNavigated=!0,this._viewY=Number(o.dataset.year),this._mode=`months`,this._renderView();return}if(e.target.closest(`[data-today]`)){let e=new Date;if(this._limits().dayDisabled(e.getFullYear(),e.getMonth(),e.getDate()))return;this.value=oo(e.getFullYear(),e.getMonth(),e.getDate()),this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close();return}if(e.target.closest(`[data-clear]`)){this.value=``,this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close();return}let s=e.target.closest(`.datepicker-day[data-iso]`);s&&!s.disabled&&(this.value=s.dataset.iso,this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close())}),this._onKeyBound=e=>{r()&&this._onKey(e)},t.addEventListener(`keydown`,this._onKeyBound),this._bindGlobal=()=>{this._teardown(),this._onDocClick=e=>{let t=this._popClick;this._popClick=!1,r()&&!t&&!this.contains(e.target)&&this._close()},document.addEventListener(`click`,this._onDocClick),this._onDocKey=e=>{r()&&e.key===`Escape`&&this._close()},document.addEventListener(`keydown`,this._onDocKey),this._onHostKey=e=>{!r()||e.key!==`Escape`||(e.preventDefault(),e.stopPropagation(),this._close())},this.addEventListener(`keydown`,this._onHostKey),r()&&s(this,i)},this._bindGlobal(),this._syncFormValue()}_teardown(){this._onDocClick&&=(document.removeEventListener(`click`,this._onDocClick),null),this._onDocKey&&=(document.removeEventListener(`keydown`,this._onDocKey),null),this._onHostKey&&=(this.removeEventListener(`keydown`,this._onHostKey),null),c(this)}disconnectedCallback(){this._teardown()}},fo=`Asia/Kolkata`,po=3,mo=[`today`,`yesterday`,`last7Days`,`last30Days`,`thisMonth`,`lastMonth`,`thisFinancialYear`],ho={today:`Today`,yesterday:`Yesterday`,last7Days:`Last 7 days`,last30Days:`Last 30 days`,thisMonth:`This month`,lastMonth:`Last month`,thisFinancialYear:`This financial year`},go=e=>String(e).padStart(2,`0`),_o=e=>`${e.getUTCFullYear()}-${go(e.getUTCMonth()+1)}-${go(e.getUTCDate())}`;function vo(e=new Date){let t=new Intl.DateTimeFormat(`en-US`,{timeZone:fo,year:`numeric`,month:`2-digit`,day:`2-digit`}).formatToParts(e),n=e=>t.find(t=>t.type===e).value;return`${n(`year`)}-${n(`month`)}-${n(`day`)}`}function yo(e,t=new Date){let{y:n,m:r,d:i}=K(vo(t)),a=(e,t,n)=>_o(new Date(Date.UTC(e,t,n))),o=ho[e];switch(e){case`today`:return{label:o,start:a(n,r,i),end:a(n,r,i)};case`yesterday`:return{label:o,start:a(n,r,i-1),end:a(n,r,i-1)};case`last7Days`:return{label:o,start:a(n,r,i-6),end:a(n,r,i)};case`last30Days`:return{label:o,start:a(n,r,i-29),end:a(n,r,i)};case`thisMonth`:return{label:o,start:a(n,r,1),end:a(n,r+1,0)};case`lastMonth`:return{label:o,start:a(n,r-1,1),end:a(n,r,0)};case`thisFinancialYear`:{let e=r>=po?n:n-1;return{label:o,start:a(e,po,1),end:a(e+1,po,0)}}default:return null}}function bo(e){console.warn(`[@webority/ui-elements] <wui-date-range> presets: ${e}`)}function xo(e,t=new Date){let n=String(e??``).trim();if(!n)return[];let r;if(n.startsWith(`[`))try{r=JSON.parse(n)}catch{return bo(`the attribute is not valid JSON`),[]}else r=n.split(`,`).map(e=>e.trim());let i=[];for(let e of r)if(typeof e==`string`){let n=yo(e,t);n?i.push(n):bo(`"${e}" is not one of ${mo.join(`, `)}`)}else e&&typeof e.label==`string`&&e.label&&K(e.start)&&K(e.end)?i.push({label:e.label,start:e.start,end:e.end}):bo(`an item needs a label and ISO start and end dates, or a preset name`);return i}var So=class extends l{static formAssociated=!0;static get observedAttributes(){return[`start`,`end`,`min`,`max`,`placeholder`,`disabled`,`first-day`,`size`,`aria-label`,`aria-describedby`,`name`,`start-name`,`end-name`,`presets`,`aria-invalid`]}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._start=``,this._end=``,this._hover=``;let e=new Date(2e3,0,1);this._viewY=e.getFullYear(),this._viewM=e.getMonth()}connectedCallback(){if(!this._rendered){this.render();return}this._bindGlobal?.()}attributeChangedCallback(e,t,n){if(e===`aria-invalid`){this._syncInvalid();return}this._rendered&&(e===`start`||e===`end`?(this._start=this.getAttribute(`start`)||``,this._end=this.getAttribute(`end`)||``,this._syncTrigger(),this._syncMirrors()):this.render())}_syncInvalid(){let e=this.querySelector(`.daterange-trigger`);e&&(this.hasAttribute(`aria-invalid`)?e.setAttribute(`aria-invalid`,`true`):e.removeAttribute(`aria-invalid`))}get value(){return{start:this._start,end:this._end}}set value(e){this._start=e?.start||``,this._end=e?.end||``,this._syncTrigger(),this._syncMirrors()}_firstDay(){return io(this)}_label(){let e=this.getAttribute(`placeholder`)||`Start to End`;return!this._start&&!this._end?{text:e,empty:!0}:{text:`${co(this._start)||`Start`} to ${co(this._end)||`End`}`,empty:!1}}render(){this._defaultStart===void 0&&(this._defaultStart=this.getAttribute(`start`)||``,this._defaultEnd=this.getAttribute(`end`)||``,this._start=this._defaultStart||this._start,this._end=this._defaultEnd||this._end);let e=K(this._start);e&&(this._viewY=e.y,this._viewM=e.m);let t=this.getAttribute(`size`),n=t===`sm`?` input-sm`:t===`lg`?` input-lg`:``,{text:r,empty:i}=this._label(),a=this.getAttribute(`aria-label`),o=this.getAttribute(`aria-describedby`);this.innerHTML=`
294
294
  <div class="daterange">
295
295
  <button type="button" class="input daterange-trigger${n}${i?``:` has-value`}" aria-haspopup="dialog" aria-expanded="false"${this.hasAttribute(`aria-invalid`)?` aria-invalid="true"`:``}${this.hasAttribute(`disabled`)?` disabled`:``}${a?` aria-label="${V(a)}"`:``}${o?` aria-describedby="${V(o)}"`:``}>
296
296
  <span data-range-label class="${i?`search-select-placeholder`:``}">${V(r)}</span>
297
297
  ${j(`calendar`)}
298
298
  </button>
299
299
  <div class="daterange-pop" role="dialog" aria-modal="false" hidden></div>
300
- </div>`,this._rendered=!0,this._syncMirrors(),this._wire()}formResetCallback(){this.value={start:this._defaultStart||``,end:this._defaultEnd||``}}_syncTrigger(){let e=this.querySelector(`.daterange-trigger`),t=this.querySelector(`[data-range-label]`);if(!t)return;let{text:n,empty:r}=this._label();t.textContent=n,t.classList.toggle(`search-select-placeholder`,r),e?.classList.toggle(`has-value`,!r)}_syncMirrors(){let e=this.getAttribute(`start-name`)||this.getAttribute(`name`),t=this.getAttribute(`end-name`);this._mirror(`start`,e,this._start),this._mirror(`end`,t,this._end)}_mirror(e,t,n){if(!t)return;let r=this.querySelector(`input[type="hidden"][data-range-mirror="${e}"]`);r||(r=document.createElement(`input`),r.type=`hidden`,r.setAttribute(`data-range-mirror`,e),this.appendChild(r)),r.name=t,r.value=n||``,r.disabled=this.hasAttribute(`disabled`)}_limits(){let e=K(this.getAttribute(`min`)),t=K(this.getAttribute(`max`)),n=e?new Date(e.y,e.m,e.d).getTime():-1/0,r=t?new Date(t.y,t.m,t.d).getTime():1/0;return(e,t,i)=>{let a=new Date(e,t,i).getTime();return a<n||a>r}}_monthHtml(e,t){let n=this._firstDay(),r=(new Date(e,t,1).getDay()-n+7)%7,i=so(e,t),a=this._limits(),o=eo.map((e,t)=>eo[(t+n)%7]).map(e=>`<span>${e}</span>`).join(``),s=(e,t,n,r)=>{let i=io(e,t,n),o=a(e,t,n);return`<button type="button" class="${[`datepicker-day`,r?`is-outside`:``].filter(Boolean).join(` `)}" data-iso="${i}"${o?` disabled`:``}>${n}</button>`},c=``,l=q(e,t-1),u=so(l.y,l.m);for(let e=r-1;e>=0;e--)c+=s(l.y,l.m,u-e,!0);for(let n=1;n<=i;n++)c+=s(e,t,n,!1);let d=q(e,t+1),f=(7-(r+i)%7)%7;for(let e=1;e<=f;e++)c+=s(d.y,d.m,e,!0);return`
300
+ </div>`,this._rendered=!0,this._syncMirrors(),this._wire()}formResetCallback(){this.value={start:this._defaultStart||``,end:this._defaultEnd||``}}_syncTrigger(){let e=this.querySelector(`.daterange-trigger`),t=this.querySelector(`[data-range-label]`);if(!t)return;let{text:n,empty:r}=this._label();t.textContent=n,t.classList.toggle(`search-select-placeholder`,r),e?.classList.toggle(`has-value`,!r)}_syncMirrors(){let e=this.getAttribute(`start-name`)||this.getAttribute(`name`),t=this.getAttribute(`end-name`);this._mirror(`start`,e,this._start),this._mirror(`end`,t,this._end)}_mirror(e,t,n){if(!t)return;let r=this.querySelector(`input[type="hidden"][data-range-mirror="${e}"]`);r||(r=document.createElement(`input`),r.type=`hidden`,r.setAttribute(`data-range-mirror`,e),this.appendChild(r)),r.name=t,r.value=n||``,r.disabled=this.hasAttribute(`disabled`)}_limits(){let e=K(this.getAttribute(`min`)),t=K(this.getAttribute(`max`)),n=e?new Date(e.y,e.m,e.d).getTime():-1/0,r=t?new Date(t.y,t.m,t.d).getTime():1/0;return(e,t,i)=>{let a=new Date(e,t,i).getTime();return a<n||a>r}}_monthHtml(e,t){let n=this._firstDay(),r=(new Date(e,t,1).getDay()-n+7)%7,i=lo(e,t),a=this._limits(),o=no.map((e,t)=>no[(t+n)%7]).map(e=>`<span>${e}</span>`).join(``),s=(e,t,n,r)=>{let i=oo(e,t,n),o=a(e,t,n);return`<button type="button" class="${[`datepicker-day`,r?`is-outside`:``].filter(Boolean).join(` `)}" data-iso="${i}"${o?` disabled`:``}>${n}</button>`},c=``,l=q(e,t-1),u=lo(l.y,l.m);for(let e=r-1;e>=0;e--)c+=s(l.y,l.m,u-e,!0);for(let n=1;n<=i;n++)c+=s(e,t,n,!1);let d=q(e,t+1),f=(7-(r+i)%7)%7;for(let e=1;e<=f;e++)c+=s(d.y,d.m,e,!0);return`
301
301
  <div class="daterange-cal">
302
- <div class="datepicker-month-label">${$a[t]} ${e}</div>
302
+ <div class="datepicker-month-label">${to[t]} ${e}</div>
303
303
  <div class="datepicker-weekdays">${o}</div>
304
304
  <div class="datepicker-grid" role="grid">${c}</div>
305
305
  </div>`}_presetsHtml(){if(!this._presetList?.length)return``;let e=this._limits(),t=t=>{let n=K(t);return e(n.y,n.m,n.d)};return`<div class="wui-daterange-presets" role="group" aria-label="Quick ranges">${this._presetList.map((e,n)=>`<button type="button" class="wui-daterange-preset" data-preset="${n}"${t(e.start)||t(e.end)?` disabled`:``}>${V(e.label)}</button>`).join(``)}</div>`}_renderView(){let e=this.querySelector(`.daterange-pop`);if(!e)return;let t=q(this._viewY,this._viewM+1),n=this._presetsHtml(),r=`
@@ -314,24 +314,24 @@ var WeborityUiElements=(function(e){Object.defineProperty(e,Symbol.toStringTag,{
314
314
  <div class="datepicker-foot">
315
315
  <span class="daterange-hint" data-range-hint></span>
316
316
  <button type="button" class="datepicker-link" data-clear>Clear</button>
317
- </div>`;e.classList.toggle(`wui-daterange-pop--presets`,n!==``),e.innerHTML=n?`${n}<div class="wui-daterange-main">${r}</div>`:r,this._paint()}_paint(){let e=this.querySelector(`.daterange-pop`);if(!e)return;let t=this._start?new Date(this._start).getTime():null,n=this._end;t&&!this._end&&this._hover&&new Date(this._hover).getTime()>=t&&(n=this._hover);let r=n?new Date(n).getTime():null;for(let n of e.querySelectorAll(`.datepicker-day[data-iso]`)){let e=new Date(n.dataset.iso).getTime(),i=t!=null&&e===t,a=r!=null&&e===r,o=t!=null&&r!=null&&e>t&&e<r;n.classList.toggle(`is-range-start`,i),n.classList.toggle(`is-range-end`,a),n.classList.toggle(`in-range`,o)}e.querySelectorAll(`[data-preset]`).forEach(e=>{let t=this._presetList?.[Number(e.dataset.preset)],n=!!t&&t.start===this._start&&t.end===this._end;e.classList.toggle(`is-active`,n),e.setAttribute(`aria-pressed`,String(n))});let i=e.querySelector(`[data-range-hint]`);i&&(i.textContent=this._start?this._end?`${oo(this._start)} to ${oo(this._end)}`:`Pick an end date`:`Pick a start date`)}_position(e,t){o(e,t,{clampHeight:!0})}_pick(e){if(!this._start||this._start&&this._end){this._start=e,this._end=``,this._hover=``,this._syncTrigger(),this._syncMirrors(),this._paint();return}if(new Date(e).getTime()<new Date(this._start).getTime()){this._start=e,this._syncTrigger(),this._syncMirrors(),this._paint(),this.dispatchEvent(new Event(`change`,{bubbles:!0}));return}this._end=e,this._syncTrigger(),this._syncMirrors(),this._paint(),this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close()}_applyPreset({start:e,end:t}){this._start=e,this._end=t,this._hover=``,this._syncTrigger(),this._syncMirrors(),this._paint(),this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close()}_wire(){this._teardown();let e=this.querySelector(`.daterange-trigger`),t=this.querySelector(`.daterange-pop`),n=this.querySelector(`.daterange`);if(!e||!t)return;let r=()=>!t.hidden,i=()=>{r()&&this._position(e,t)};this._open=()=>{let r=K(this._start);if(r)this._viewY=r.y,this._viewM=r.m;else{let e=new Date;this._viewY=e.getFullYear(),this._viewM=e.getMonth()}this._presetList=yo(this.getAttribute(`presets`)),this._renderView(),t.hidden=!1,n?.classList.add(`open`),this._position(e,t),s(this,i),e.setAttribute(`aria-expanded`,`true`)},this._close=()=>{t.hidden=!0,this._hover=``,n?.classList.remove(`open`),e.setAttribute(`aria-expanded`,`false`),c(this)},e.addEventListener(`click`,()=>r()?this._close():this._open()),t.addEventListener(`click`,e=>{this._popClick=!0;let t=e.target.closest(`[data-nav]`);if(t){let e=q(this._viewY,this._viewM+Number(t.dataset.nav));this._viewY=e.y,this._viewM=e.m,this._renderView();return}if(e.target.closest(`[data-clear]`)){this._start=``,this._end=``,this._hover=``,this._syncTrigger(),this._syncMirrors(),this._renderView(),this.dispatchEvent(new Event(`change`,{bubbles:!0}));return}let n=e.target.closest(`[data-preset]`);if(n&&!n.disabled){let e=this._presetList?.[Number(n.dataset.preset)];e&&this._applyPreset(e);return}let r=e.target.closest(`.datepicker-day[data-iso]`);r&&!r.disabled&&this._pick(r.dataset.iso)}),t.addEventListener(`mouseover`,e=>{let t=e.target.closest(`.datepicker-day[data-iso]`);t&&this._start&&!this._end&&(this._hover=t.dataset.iso,this._paint())}),this._bindGlobal=()=>{this._teardown(),this._onDocClick=e=>{let t=this._popClick;this._popClick=!1,r()&&!t&&!this.contains(e.target)&&this._close()},document.addEventListener(`click`,this._onDocClick),this._onDocKey=e=>{r()&&e.key===`Escape`&&this._close()},document.addEventListener(`keydown`,this._onDocKey),this._onHostKey=e=>{!r()||e.key!==`Escape`||(e.preventDefault(),e.stopPropagation(),this._close())},this.addEventListener(`keydown`,this._onHostKey),r()&&s(this,i)},this._bindGlobal(),this._syncMirrors()}_teardown(){this._onDocClick&&=(document.removeEventListener(`click`,this._onDocClick),null),this._onDocKey&&=(document.removeEventListener(`keydown`,this._onDocKey),null),this._onHostKey&&=(this.removeEventListener(`keydown`,this._onHostKey),null),c(this)}disconnectedCallback(){this._teardown()}},xo=class extends l{static get observedAttributes(){return[`static`,`max-scale`,`radius`]}constructor(){super(),this._pointerMoveListener=null,this._pointerLeaveListener=null,this._frame=0,this._pointerX=0}connectedCallback(){this._wire()}disconnectedCallback(){this._teardown()}attributeChangedCallback(e,t,n){e===`static`&&this.isConnected&&this._wire()}_maxScale(){return So(this.getAttribute(`max-scale`),1.6)}_radius(){return So(this.getAttribute(`radius`),100)}_magnifyEnabled(){return!(this.hasAttribute(`static`)||typeof matchMedia==`function`&&(matchMedia(`(pointer: coarse)`).matches||matchMedia(`(prefers-reduced-motion: reduce)`).matches))}_applyMagnification(){this._frame=0;let e=this._maxScale(),t=this._radius();for(let n of this.querySelectorAll(`.dock-item`)){let r=n.getBoundingClientRect(),i=Math.abs(this._pointerX-(r.left+r.width/2)),a=Math.max(0,1-i/t),o=1+(e-1)*a;n.style.setProperty(`--wui-dock-mag`,o.toFixed(3))}}_resetMagnification(){this._frame&&=(cancelAnimationFrame(this._frame),0);for(let e of this.querySelectorAll(`.dock-item`))e.style.removeProperty(`--wui-dock-mag`)}_wire(){this._teardown(),this._magnifyEnabled()&&(this._pointerMoveListener=e=>{this._pointerX=e.clientX,this._frame||=requestAnimationFrame(()=>this._applyMagnification())},this._pointerLeaveListener=()=>this._resetMagnification(),this.addEventListener(`pointermove`,this._pointerMoveListener),this.addEventListener(`pointerleave`,this._pointerLeaveListener))}_teardown(){this._pointerMoveListener&&=(this.removeEventListener(`pointermove`,this._pointerMoveListener),null),this._pointerLeaveListener&&=(this.removeEventListener(`pointerleave`,this._pointerLeaveListener),null),this._resetMagnification()}},So=(e,t)=>{let n=Number.parseFloat(e);return Number.isFinite(n)?n:t},Co=[50,90],wo=10,To=100;function Eo(e,t=Co){let n=Array.isArray(e)?e:String(e??``).split(`,`),r=[];for(let e of n){if(typeof e==`string`&&e.trim()===``)return t;let n=Number(e);if(!Number.isFinite(n)||n<wo||n>To)return t;r.includes(n)||r.push(n)}return r.length?r.sort((e,t)=>e-t):t}function Do({points:e,index:t,visible:n,velocity:r,canDismiss:i}){let a=i?-1:0;if(Math.abs(r)>=.5)return r>0?Math.max(t-1,a):Math.min(t+1,e.length-1);if(i&&n<e[0]/2)return-1;let o=0;for(let t=1;t<e.length;t++)Math.abs(e[t]-n)<Math.abs(e[o]-n)&&(o=t);return o}var Oo=`(max-width: 767.98px)`,ko=`a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`,Ao=4,jo=0,Mo=new WeakSet;function No(e){Mo.has(e)||(Mo.add(e),e.addEventListener(`click`,t=>{let n=t.target?.closest?.(`[data-wui-drawer-open]`);if(!n)return;let r=n.getAttribute(`data-wui-drawer-open`).replace(/^#/,``),i=e.getElementById(r);typeof i?.show==`function`&&(t.preventDefault(),i.show(n))}))}var Po=class extends l{static get observedAttributes(){return[`open`,`snap-points`]}constructor(){super(),this._doc=null,this._media=null,this._shown=!1,this._locked=!1,this._opener=null,this._snap=0,this._drag=null,this._onMedia=()=>this._syncMode(),this._onClick=e=>this._click(e),this._onPointerDown=e=>this._pointerDown(e),this._onPointerMove=e=>this._pointerMove(e),this._onPointerUp=e=>this._pointerUp(e),this._onKeyDown=e=>this._keyDown(e),this._onHostKey=e=>{e.key===`Escape`&&this._keyDown(e)}}connectedCallback(){this._doc=this.ownerDocument,No(this._doc),this.addEventListener(`click`,this._onClick),this.addEventListener(`pointerdown`,this._onPointerDown),this._media=typeof matchMedia==`function`?matchMedia(Oo):null,this._media?.addEventListener?.(`change`,this._onMedia),this._syncMode(),this._applyPoints(),this.hasAttribute(`open`)?this._open():this.setAttribute(`inert`,``)}disconnectedCallback(){this._endDrag(),this._shown&&this._release(),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`pointerdown`,this._onPointerDown),this._media?.removeEventListener?.(`change`,this._onMedia),this._media=null,this._doc=null}attributeChangedCallback(e){this._doc&&(e===`open`?this.hasAttribute(`open`)?this._open():this._close():(this._snap=Math.min(this._snap,this._points().length-1),this._applyPoints()))}get isOpen(){return this.hasAttribute(`open`)}show(e){e&&(this._opener=e),this.setAttribute(`open`,``)}hide(){this.removeAttribute(`open`)}_points(){return Eo(this.getAttribute(`snap-points`),Co)}_sheet(){return!!this._media?.matches}_syncMode(){this.setAttribute(`data-mode`,this._sheet()?`sheet`:`side`)}_applyPoints(){let e=this._points();this._snap=Math.min(Math.max(this._snap,0),e.length-1),this.style.setProperty(`--wui-drawer-max`,String(e[e.length-1])),this.style.setProperty(`--wui-drawer-snap`,String(e[this._snap])),this.setAttribute(`data-snap`,String(this._snap));let t=this.querySelector(`.wui-drawer-handle`);if(!t)return;let n=e[this._snap];t.setAttribute(`aria-valuemin`,String(e[0])),t.setAttribute(`aria-valuemax`,String(e[e.length-1])),t.setAttribute(`aria-valuenow`,String(n)),t.setAttribute(`aria-valuetext`,`${n}% of the screen`)}_setSnap(e){let t=this._points(),n=Math.min(Math.max(e,0),t.length-1),r=n!==this._snap;this._snap=n,this._applyPoints(),r&&this.dispatchEvent(new CustomEvent(`wui-drawer-snap`,{bubbles:!0,detail:{index:n,percent:t[n]}}))}_open(){if(this._shown)return;this._shown=!0;let e=this._doc;this._opener??=e.activeElement;let t=Number.parseInt(this.getAttribute(`default-snap`)??`0`,10);this._snap=Number.isFinite(t)?t:0,this._syncMode(),this._applyPoints(),this.removeAttribute(`inert`),this._locked||(this._locked=!0,jo++,e.body.classList.add(`wui-drawer-locked`)),e.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`keydown`,this._onHostKey),this._focusIn()}_close(){if(!this._shown)return;this._endDrag(),this.setAttribute(`inert`,``);let e=this._doc,t=this._opener,n=e.activeElement;this._release(),this._opener=null,t?.isConnected&&(n===e.body||this.contains(n))&&t.focus?.()}_release(){this._shown=!1,this._doc?.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`keydown`,this._onHostKey),this._locked&&(this._locked=!1,jo--,jo<=0&&(jo=0,this._doc?.body.classList.remove(`wui-drawer-locked`)))}_panel(){return this.querySelector(`.wui-drawer-panel`)}_focusables(){let e=this._panel();return e?Array.from(e.querySelectorAll(ko)).filter(e=>!e.closest(`[hidden],[inert]`)):[]}_focusIn(){let e=this._panel();if(!e)return;let t=e.querySelector(`[data-autofocus]`),n=this._sheet()?null:this._focusables().find(e=>e.closest(`.wui-drawer-body`));(t||n||e).focus?.()}_requestClose(){let e=this.dispatchEvent(new CustomEvent(`wui-drawer-close`,{bubbles:!0,cancelable:!0}));return e&&this.hide(),e}_click(e){if(!this.isOpen)return;let t=e.target;(t.closest?.(`[data-wui-drawer-close]`)||t.closest?.(`[data-wui-drawer-backdrop]`)&&!this.hasAttribute(`static`))&&this._requestClose()}_keyDown(e){if(e.key===`Escape`){if(e.defaultPrevented||this.hasAttribute(`static`))return;e.preventDefault(),e.stopPropagation(),this._requestClose();return}if(e.key===`Tab`){this._trapTab(e);return}e.target?.closest?.(`.wui-drawer-handle`)&&this._sheet()&&this._handleKey(e)}_trapTab(e){let t=this._focusables(),n=this._panel();if(!t.length){e.preventDefault(),n?.focus?.();return}let r=t[0],i=t[t.length-1],a=this._doc.activeElement;!n?.contains(a)||a===n?(e.preventDefault(),(e.shiftKey?i:r).focus()):e.shiftKey&&a===r?(e.preventDefault(),i.focus()):!e.shiftKey&&a===i&&(e.preventDefault(),r.focus())}_handleKey(e){let t=this._points().length-1,n={ArrowUp:this._snap+1,ArrowDown:this._snap-1,Home:0,End:t};e.key in n&&(e.preventDefault(),this._setSnap(n[e.key]))}_pointerDown(e){if(!this.isOpen||!this._sheet()||(e.button??0)!==0)return;let t=e.target?.closest?.(`[data-wui-drawer-grip]`);!t||e.target.closest(`button`)||(this._drag={grip:t,id:e.pointerId,startY:e.clientY,lastY:e.clientY,lastT:e.timeStamp,velocity:0,moved:!1},t.setPointerCapture?.(e.pointerId),t.addEventListener(`pointermove`,this._onPointerMove),t.addEventListener(`pointerup`,this._onPointerUp),t.addEventListener(`pointercancel`,this._onPointerUp))}_viewport(){return this._doc.defaultView.innerHeight}_pointerMove(e){let t=this._drag;if(!t||e.pointerId!==t.id)return;let n=e.clientY-t.startY;if(!t.moved&&Math.abs(n)<Ao)return;t.moved=!0,this.classList.add(`is-dragging`);let r=e.timeStamp-t.lastT;r>0&&(t.velocity=(e.clientY-t.lastY)/r),t.lastY=e.clientY,t.lastT=e.timeStamp;let i=this._points(),a=(i[i.length-1]-i[this._snap])/100*this._viewport();t.offset=Math.max(n,-a),this.style.setProperty(`--wui-drawer-drag`,`${t.offset}px`)}_pointerUp(e){let t=this._drag;if(!t||e.pointerId!==t.id)return;let{moved:n,velocity:r,offset:i=0}=t;if(this._endDrag(),!n)return;let a=this._points(),o=this._viewport(),s=(a[this._snap]/100*o-i)/(o/100),c=!this.hasAttribute(`static`),l=Do({points:a,index:this._snap,visible:s,velocity:r,canDismiss:c});l>=0?this._setSnap(l):this._requestClose()}_endDrag(){let e=this._drag;e&&(this._drag=null,e.grip.releasePointerCapture?.(e.id),e.grip.removeEventListener(`pointermove`,this._onPointerMove),e.grip.removeEventListener(`pointerup`,this._onPointerUp),e.grip.removeEventListener(`pointercancel`,this._onPointerUp),this.classList.remove(`is-dragging`),this.style.removeProperty(`--wui-drawer-drag`))}},Fo=300,Io=150,Lo=`.wui-hover-card-trigger`,Ro=`.wui-hover-card-panel`,zo=`a[href],button,input,select,textarea,[tabindex]`,Bo=0,Vo=class extends l{constructor(){super(),this._doc=null,this._timer=null,this._described=null,this._refocusing=!1,this._onOver=e=>{if(e.pointerType===`touch`||e.pointerType===`pen`)return;let t=this._zone(e.target);t===`panel`?this._clear():t===`trigger`&&this._schedule(!0)},this._onOut=e=>{e.pointerType===`touch`||e.pointerType===`pen`||this._zone(e.target)&&!this._zone(e.relatedTarget)&&this._schedule(!1)},this._onFocusIn=e=>{this._refocusing||(this._zone(e.target)===`trigger`?this._schedule(!0):this._zone(e.target)===`panel`&&this._clear())},this._onFocusOut=e=>{this._zone(e.target)&&!this._zone(e.relatedTarget)&&this._schedule(!1)},this._onKeyDown=e=>{if(e.key!==`Escape`||!this.isOpen)return;e.stopPropagation();let t=this._panel?.contains(this.ownerDocument.activeElement);this._clear(),this._setOpen(!1),t&&(this._refocusing=!0,this._anchor?.focus(),this._refocusing=!1)}}get isOpen(){return this._panel?.hasAttribute(`data-open`)??!1}connectedCallback(){this._doc=this.ownerDocument,this.addEventListener(`pointerover`,this._onOver),this.addEventListener(`pointerout`,this._onOut),this.addEventListener(`focusin`,this._onFocusIn),this.addEventListener(`focusout`,this._onFocusOut)}disconnectedCallback(){this._clear(),this.removeEventListener(`pointerover`,this._onOver),this.removeEventListener(`pointerout`,this._onOut),this.removeEventListener(`focusin`,this._onFocusIn),this.removeEventListener(`focusout`,this._onFocusOut),this._doc?.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`keydown`,this._onKeyDown),c(this),this._doc=null}get _trigger(){return this.querySelector(Lo)}get _panel(){return this.querySelector(Ro)}get _anchor(){let e=this._trigger;return e?.querySelector(zo)??e}_zone(e){if(!(e instanceof Node)||!this.contains(e))return null;let t=e instanceof Element?e:e.parentElement;return this._panel?.contains(t)?`panel`:this._trigger?.contains(t)?`trigger`:null}_delay(e,t){let n=Number(this.getAttribute(e));return this.hasAttribute(e)&&Number.isFinite(n)&&n>=0?n:t}_clear(){this._timer!==null&&clearTimeout(this._timer),this._timer=null}_schedule(e){if(this._clear(),this.isOpen===e)return;let t=e?this._delay(`open-delay`,Fo):this._delay(`close-delay`,Io);this._timer=setTimeout(()=>{this._timer=null,this._setOpen(e)},t)}_setOpen(e){let t=this._panel;!t||this.isOpen===e||(e?(t.setAttribute(`data-open`,``),this._reposition(),s(this,()=>this._reposition()),this._doc?.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`keydown`,this._onKeyDown),this._describe(t)):(t.removeAttribute(`data-open`),c(this),this._doc?.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`keydown`,this._onKeyDown),this._described?.removeAttribute(`aria-describedby`),this._described=null),this.dispatchEvent(new CustomEvent(e?`wui:hover-card:open`:`wui:hover-card:close`,{bubbles:!0})))}_reposition(){this.isOpen&&o(this._trigger,this._panel,{clampHeight:!0})}_describe(e){let t=this._anchor;t&&(e.id||=`wui-hover-card-${++Bo}`,t.setAttribute(`aria-describedby`,e.id),this._described=t)}},Ho=4096,Uo=[.92,.8,.65,.5],Wo=.8,Go=8;function Ko(e){if(e==null||e===``||e===`free`)return null;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)&&t>0?t:null}function qo(e,t,n){if(!n)return{x:0,y:0,w:e,h:t};let r=e,i=r/n;return i>t&&(i=t,r=i*n),{x:(e-r)/2,y:(t-i)/2,w:r,h:i}}function Jo(e,t,n){return{...e,x:Math.min(Math.max(e.x,0),Math.max(t-e.w,0)),y:Math.min(Math.max(e.y,0),Math.max(n-e.h,0))}}function Yo(e,t,n,r,i){return Jo({...e,x:e.x+t,y:e.y+n},r,i)}function Xo(e,t){return Math.min(32,e,t)}function Zo(e,t){return t.w/e.w}function Qo(e,t){return Math.max(4,Zo(e,t))}function $o(e,t,n,r,i){let a=Math.min(Math.max(n,1),Qo(e,t)),o=e.h/e.w,s=Math.min(r,i/o),c=Math.min(Math.max(Xo(r,i),Xo(r,i)/o),s),l=Math.min(Math.max(t.w/a,c),s),u=l*o,d=e.x+e.w/2,f=e.y+e.h/2;return Jo({x:d-l/2,y:f-u/2,w:l,h:u},r,i)}var es=[`nw`,`ne`,`sw`,`se`];function ts(e,t,n,r,i,a){let o=Xo(i,a),s=t.endsWith(`w`),c=t.startsWith(`n`),l=s?e.x+e.w:e.x,u=c?e.y+e.h:e.y,d=Math.min(Math.max(n,0),i),f=Math.min(Math.max(r,0),a);return d=s?Math.min(d,l-o):Math.max(d,l+o),f=c?Math.min(f,u-o):Math.max(f,u+o),{x:Math.min(d,l),y:Math.min(f,u),w:Math.abs(d-l),h:Math.abs(f-u)}}function ns(e,t=Ho){let n=Math.min(1,t/Math.max(e.w,e.h));return{width:Math.max(1,Math.round(e.w*n)),height:Math.max(1,Math.round(e.h*n))}}function rs(e,t){let n=t/Math.max(e.w,e.h);return{width:Math.max(1,Math.round(e.w*n)),height:Math.max(1,Math.round(e.h*n))}}function is(e,t,n){return n%180==0?{w:e,h:t}:{w:t,h:e}}function as(e,t,n){return Jo({x:n-(e.y+e.h),y:e.x,w:e.h,h:e.w},n,t)}function os(e){return String(e||``).split(/[\s,]+/).map(Number).filter(e=>Number.isInteger(e)&&e>0)}var ss=[`image/png`,`image/jpeg`,`image/webp`],cs={"image/png":`.png`,"image/jpeg":`.jpg`,"image/webp":`.webp`};function ls(e){let t=String(e||``).toLowerCase();return ss.includes(t)?t:`image/png`}function us(e,t){let n=String(e||`image`),r=cs[t];return(t===`image/jpeg`?/\.jpe?g$/i.test(n):n.toLowerCase().endsWith(r))?n:`${n.replace(/\.[^./\\]+$/,``)||`image`}${r}`}async function ds(e,{width:t,height:n,type:r,maxBytes:i}){let a=r,o=t,s=n,c=null;for(let t=0;t<=Go;t++){let n=a===`image/png`?[void 0]:t===0?Uo:[Uo[1]];for(let t of n){if(c=await e(o,s,a,t),!c||(c.type&&c.type!==a&&(a=c.type),!(i>0)||c.size<=i))return c;if(a===`image/png`)break}o=Math.max(1,Math.round(o*Wo)),s=Math.max(1,Math.round(s*Wo))}return c}var fs=.05,ps=.2,ms={w:320,h:240},hs={nw:`top left`,ne:`top right`,sw:`bottom left`,se:`bottom right`},gs=`<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M5 12h14"/></svg>`,_s=`<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M5 12h14M12 5v14"/></svg>`,vs=`<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/></svg>`,ys=`<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/></svg>`,bs=(e,t)=>Math.hypot(e.x-t.x,e.y-t.y),xs=class extends l{static get observedAttributes(){return[`src`,`aspect`,`round`,`rotatable`,`previews`]}constructor(){super(),this._rect=null,this._base=null,this._natural=null,this._source=null,this._rotation=0,this._drag=null,this._pointers=new Map,this._pinch=null,this._previewPending=!1,this._resizeObserver=null}get src(){return this.getAttribute(`src`)||``}set src(e){e==null||e===``?this.removeAttribute(`src`):this.setAttribute(`src`,String(e))}get aspect(){return Ko(this.getAttribute(`aspect`))}set aspect(e){e==null||e===``?this.removeAttribute(`aspect`):this.setAttribute(`aspect`,String(e))}get round(){return this.hasAttribute(`round`)}set round(e){this.toggleAttribute(`round`,!!e)}get rotatable(){return this.hasAttribute(`rotatable`)}set rotatable(e){this.toggleAttribute(`rotatable`,!!e)}get previews(){return this.getAttribute(`previews`)||``}set previews(e){e==null||e===``?this.removeAttribute(`previews`):this.setAttribute(`previews`,Array.isArray(e)?e.join(` `):String(e))}get rect(){return this._rect?{...this._rect}:null}get rotation(){return this._rotation}set rotation(e){if(!this._rect)return;let t=(Math.round(Number(e)/90)*90%360+360)%360;if(!Number.isNaN(t))for(;this._rotation!==t;)this.rotate()}get zoom(){return this._rect?Zo(this._rect,this._base):1}set zoom(e){this._rect&&(this._rect=$o(this._rect,this._base,Number(e)||1,this._natural.w,this._natural.h),this._paint(),this._announce())}connectedCallback(){if(!this._rendered){this.render();return}this._observe()}disconnectedCallback(){this._resizeObserver?.disconnect(),this._resizeObserver=null}attributeChangedCallback(e){this._rendered&&(e===`src`?this._loadImage():e===`aspect`?(this._rebuildHandles(),this._resetRect()):e===`rotatable`?this._tools.hidden=!this.rotatable:e===`previews`?this._renderPreviews():this._applyRound())}render(){this.innerHTML=`<div>
317
+ </div>`;e.classList.toggle(`wui-daterange-pop--presets`,n!==``),e.innerHTML=n?`${n}<div class="wui-daterange-main">${r}</div>`:r,this._paint()}_paint(){let e=this.querySelector(`.daterange-pop`);if(!e)return;let t=this._start?new Date(this._start).getTime():null,n=this._end;t&&!this._end&&this._hover&&new Date(this._hover).getTime()>=t&&(n=this._hover);let r=n?new Date(n).getTime():null;for(let n of e.querySelectorAll(`.datepicker-day[data-iso]`)){let e=new Date(n.dataset.iso).getTime(),i=t!=null&&e===t,a=r!=null&&e===r,o=t!=null&&r!=null&&e>t&&e<r;n.classList.toggle(`is-range-start`,i),n.classList.toggle(`is-range-end`,a),n.classList.toggle(`in-range`,o)}e.querySelectorAll(`[data-preset]`).forEach(e=>{let t=this._presetList?.[Number(e.dataset.preset)],n=!!t&&t.start===this._start&&t.end===this._end;e.classList.toggle(`is-active`,n),e.setAttribute(`aria-pressed`,String(n))});let i=e.querySelector(`[data-range-hint]`);i&&(i.textContent=this._start?this._end?`${co(this._start)} to ${co(this._end)}`:`Pick an end date`:`Pick a start date`)}_position(e,t){o(e,t,{clampHeight:!0})}_pick(e){if(!this._start||this._start&&this._end){this._start=e,this._end=``,this._hover=``,this._syncTrigger(),this._syncMirrors(),this._paint();return}if(new Date(e).getTime()<new Date(this._start).getTime()){this._start=e,this._syncTrigger(),this._syncMirrors(),this._paint(),this.dispatchEvent(new Event(`change`,{bubbles:!0}));return}this._end=e,this._syncTrigger(),this._syncMirrors(),this._paint(),this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close()}_applyPreset({start:e,end:t}){this._start=e,this._end=t,this._hover=``,this._syncTrigger(),this._syncMirrors(),this._paint(),this.dispatchEvent(new Event(`change`,{bubbles:!0})),this._close()}_wire(){this._teardown();let e=this.querySelector(`.daterange-trigger`),t=this.querySelector(`.daterange-pop`),n=this.querySelector(`.daterange`);if(!e||!t)return;let r=()=>!t.hidden,i=()=>{r()&&this._position(e,t)};this._open=()=>{let r=K(this._start);if(r)this._viewY=r.y,this._viewM=r.m;else{let e=new Date;this._viewY=e.getFullYear(),this._viewM=e.getMonth()}this._presetList=xo(this.getAttribute(`presets`)),this._renderView(),t.hidden=!1,n?.classList.add(`open`),this._position(e,t),s(this,i),e.setAttribute(`aria-expanded`,`true`)},this._close=()=>{t.hidden=!0,this._hover=``,n?.classList.remove(`open`),e.setAttribute(`aria-expanded`,`false`),c(this)},e.addEventListener(`click`,()=>r()?this._close():this._open()),t.addEventListener(`click`,e=>{this._popClick=!0;let t=e.target.closest(`[data-nav]`);if(t){let e=q(this._viewY,this._viewM+Number(t.dataset.nav));this._viewY=e.y,this._viewM=e.m,this._renderView();return}if(e.target.closest(`[data-clear]`)){this._start=``,this._end=``,this._hover=``,this._syncTrigger(),this._syncMirrors(),this._renderView(),this.dispatchEvent(new Event(`change`,{bubbles:!0}));return}let n=e.target.closest(`[data-preset]`);if(n&&!n.disabled){let e=this._presetList?.[Number(n.dataset.preset)];e&&this._applyPreset(e);return}let r=e.target.closest(`.datepicker-day[data-iso]`);r&&!r.disabled&&this._pick(r.dataset.iso)}),t.addEventListener(`mouseover`,e=>{let t=e.target.closest(`.datepicker-day[data-iso]`);t&&this._start&&!this._end&&(this._hover=t.dataset.iso,this._paint())}),this._bindGlobal=()=>{this._teardown(),this._onDocClick=e=>{let t=this._popClick;this._popClick=!1,r()&&!t&&!this.contains(e.target)&&this._close()},document.addEventListener(`click`,this._onDocClick),this._onDocKey=e=>{r()&&e.key===`Escape`&&this._close()},document.addEventListener(`keydown`,this._onDocKey),this._onHostKey=e=>{!r()||e.key!==`Escape`||(e.preventDefault(),e.stopPropagation(),this._close())},this.addEventListener(`keydown`,this._onHostKey),r()&&s(this,i)},this._bindGlobal(),this._syncMirrors()}_teardown(){this._onDocClick&&=(document.removeEventListener(`click`,this._onDocClick),null),this._onDocKey&&=(document.removeEventListener(`keydown`,this._onDocKey),null),this._onHostKey&&=(this.removeEventListener(`keydown`,this._onHostKey),null),c(this)}disconnectedCallback(){this._teardown()}},Co=class extends l{static get observedAttributes(){return[`static`,`max-scale`,`radius`]}constructor(){super(),this._pointerMoveListener=null,this._pointerLeaveListener=null,this._frame=0,this._pointerX=0}connectedCallback(){this._wire()}disconnectedCallback(){this._teardown()}attributeChangedCallback(e,t,n){e===`static`&&this.isConnected&&this._wire()}_maxScale(){return wo(this.getAttribute(`max-scale`),1.6)}_radius(){return wo(this.getAttribute(`radius`),100)}_magnifyEnabled(){return!(this.hasAttribute(`static`)||typeof matchMedia==`function`&&(matchMedia(`(pointer: coarse)`).matches||matchMedia(`(prefers-reduced-motion: reduce)`).matches))}_applyMagnification(){this._frame=0;let e=this._maxScale(),t=this._radius();for(let n of this.querySelectorAll(`.dock-item`)){let r=n.getBoundingClientRect(),i=Math.abs(this._pointerX-(r.left+r.width/2)),a=Math.max(0,1-i/t),o=1+(e-1)*a;n.style.setProperty(`--wui-dock-mag`,o.toFixed(3))}}_resetMagnification(){this._frame&&=(cancelAnimationFrame(this._frame),0);for(let e of this.querySelectorAll(`.dock-item`))e.style.removeProperty(`--wui-dock-mag`)}_wire(){this._teardown(),this._magnifyEnabled()&&(this._pointerMoveListener=e=>{this._pointerX=e.clientX,this._frame||=requestAnimationFrame(()=>this._applyMagnification())},this._pointerLeaveListener=()=>this._resetMagnification(),this.addEventListener(`pointermove`,this._pointerMoveListener),this.addEventListener(`pointerleave`,this._pointerLeaveListener))}_teardown(){this._pointerMoveListener&&=(this.removeEventListener(`pointermove`,this._pointerMoveListener),null),this._pointerLeaveListener&&=(this.removeEventListener(`pointerleave`,this._pointerLeaveListener),null),this._resetMagnification()}},wo=(e,t)=>{let n=Number.parseFloat(e);return Number.isFinite(n)?n:t},To=[50,90],Eo=10,Do=100;function Oo(e,t=To){let n=Array.isArray(e)?e:String(e??``).split(`,`),r=[];for(let e of n){if(typeof e==`string`&&e.trim()===``)return t;let n=Number(e);if(!Number.isFinite(n)||n<Eo||n>Do)return t;r.includes(n)||r.push(n)}return r.length?r.sort((e,t)=>e-t):t}function ko({points:e,index:t,visible:n,velocity:r,canDismiss:i}){let a=i?-1:0;if(Math.abs(r)>=.5)return r>0?Math.max(t-1,a):Math.min(t+1,e.length-1);if(i&&n<e[0]/2)return-1;let o=0;for(let t=1;t<e.length;t++)Math.abs(e[t]-n)<Math.abs(e[o]-n)&&(o=t);return o}var Ao=`(max-width: 767.98px)`,jo=`a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`,Mo=4,No=0,Po=new WeakSet;function Fo(e){Po.has(e)||(Po.add(e),e.addEventListener(`click`,t=>{let n=t.target?.closest?.(`[data-wui-drawer-open]`);if(!n)return;let r=n.getAttribute(`data-wui-drawer-open`).replace(/^#/,``),i=e.getElementById(r);typeof i?.show==`function`&&(t.preventDefault(),i.show(n))}))}var Io=class extends l{static get observedAttributes(){return[`open`,`snap-points`]}constructor(){super(),this._doc=null,this._media=null,this._shown=!1,this._locked=!1,this._opener=null,this._snap=0,this._drag=null,this._onMedia=()=>this._syncMode(),this._onClick=e=>this._click(e),this._onPointerDown=e=>this._pointerDown(e),this._onPointerMove=e=>this._pointerMove(e),this._onPointerUp=e=>this._pointerUp(e),this._onKeyDown=e=>this._keyDown(e),this._onHostKey=e=>{e.key===`Escape`&&this._keyDown(e)}}connectedCallback(){this._doc=this.ownerDocument,Fo(this._doc),this.addEventListener(`click`,this._onClick),this.addEventListener(`pointerdown`,this._onPointerDown),this._media=typeof matchMedia==`function`?matchMedia(Ao):null,this._media?.addEventListener?.(`change`,this._onMedia),this._syncMode(),this._applyPoints(),this.hasAttribute(`open`)?this._open():this.setAttribute(`inert`,``)}disconnectedCallback(){this._endDrag(),this._shown&&this._release(),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`pointerdown`,this._onPointerDown),this._media?.removeEventListener?.(`change`,this._onMedia),this._media=null,this._doc=null}attributeChangedCallback(e){this._doc&&(e===`open`?this.hasAttribute(`open`)?this._open():this._close():(this._snap=Math.min(this._snap,this._points().length-1),this._applyPoints()))}get isOpen(){return this.hasAttribute(`open`)}show(e){e&&(this._opener=e),this.setAttribute(`open`,``)}hide(){this.removeAttribute(`open`)}_points(){return Oo(this.getAttribute(`snap-points`),To)}_sheet(){return!!this._media?.matches}_syncMode(){this.setAttribute(`data-mode`,this._sheet()?`sheet`:`side`)}_applyPoints(){let e=this._points();this._snap=Math.min(Math.max(this._snap,0),e.length-1),this.style.setProperty(`--wui-drawer-max`,String(e[e.length-1])),this.style.setProperty(`--wui-drawer-snap`,String(e[this._snap])),this.setAttribute(`data-snap`,String(this._snap));let t=this.querySelector(`.wui-drawer-handle`);if(!t)return;let n=e[this._snap];t.setAttribute(`aria-valuemin`,String(e[0])),t.setAttribute(`aria-valuemax`,String(e[e.length-1])),t.setAttribute(`aria-valuenow`,String(n)),t.setAttribute(`aria-valuetext`,`${n}% of the screen`)}_setSnap(e){let t=this._points(),n=Math.min(Math.max(e,0),t.length-1),r=n!==this._snap;this._snap=n,this._applyPoints(),r&&this.dispatchEvent(new CustomEvent(`wui-drawer-snap`,{bubbles:!0,detail:{index:n,percent:t[n]}}))}_open(){if(this._shown)return;this._shown=!0;let e=this._doc;this._opener??=e.activeElement;let t=Number.parseInt(this.getAttribute(`default-snap`)??`0`,10);this._snap=Number.isFinite(t)?t:0,this._syncMode(),this._applyPoints(),this.removeAttribute(`inert`),this._locked||(this._locked=!0,No++,e.body.classList.add(`wui-drawer-locked`)),e.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`keydown`,this._onHostKey),this._focusIn()}_close(){if(!this._shown)return;this._endDrag(),this.setAttribute(`inert`,``);let e=this._doc,t=this._opener,n=e.activeElement;this._release(),this._opener=null,t?.isConnected&&(n===e.body||this.contains(n))&&t.focus?.()}_release(){this._shown=!1,this._doc?.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`keydown`,this._onHostKey),this._locked&&(this._locked=!1,No--,No<=0&&(No=0,this._doc?.body.classList.remove(`wui-drawer-locked`)))}_panel(){return this.querySelector(`.wui-drawer-panel`)}_focusables(){let e=this._panel();return e?Array.from(e.querySelectorAll(jo)).filter(e=>!e.closest(`[hidden],[inert]`)):[]}_focusIn(){let e=this._panel();if(!e)return;let t=e.querySelector(`[data-autofocus]`),n=this._sheet()?null:this._focusables().find(e=>e.closest(`.wui-drawer-body`));(t||n||e).focus?.()}_requestClose(){let e=this.dispatchEvent(new CustomEvent(`wui-drawer-close`,{bubbles:!0,cancelable:!0}));return e&&this.hide(),e}_click(e){if(!this.isOpen)return;let t=e.target;(t.closest?.(`[data-wui-drawer-close]`)||t.closest?.(`[data-wui-drawer-backdrop]`)&&!this.hasAttribute(`static`))&&this._requestClose()}_keyDown(e){if(e.key===`Escape`){if(e.defaultPrevented||this.hasAttribute(`static`))return;e.preventDefault(),e.stopPropagation(),this._requestClose();return}if(e.key===`Tab`){this._trapTab(e);return}e.target?.closest?.(`.wui-drawer-handle`)&&this._sheet()&&this._handleKey(e)}_trapTab(e){let t=this._focusables(),n=this._panel();if(!t.length){e.preventDefault(),n?.focus?.();return}let r=t[0],i=t[t.length-1],a=this._doc.activeElement;!n?.contains(a)||a===n?(e.preventDefault(),(e.shiftKey?i:r).focus()):e.shiftKey&&a===r?(e.preventDefault(),i.focus()):!e.shiftKey&&a===i&&(e.preventDefault(),r.focus())}_handleKey(e){let t=this._points().length-1,n={ArrowUp:this._snap+1,ArrowDown:this._snap-1,Home:0,End:t};e.key in n&&(e.preventDefault(),this._setSnap(n[e.key]))}_pointerDown(e){if(!this.isOpen||!this._sheet()||(e.button??0)!==0)return;let t=e.target?.closest?.(`[data-wui-drawer-grip]`);!t||e.target.closest(`button`)||(this._drag={grip:t,id:e.pointerId,startY:e.clientY,lastY:e.clientY,lastT:e.timeStamp,velocity:0,moved:!1},t.setPointerCapture?.(e.pointerId),t.addEventListener(`pointermove`,this._onPointerMove),t.addEventListener(`pointerup`,this._onPointerUp),t.addEventListener(`pointercancel`,this._onPointerUp))}_viewport(){return this._doc.defaultView.innerHeight}_pointerMove(e){let t=this._drag;if(!t||e.pointerId!==t.id)return;let n=e.clientY-t.startY;if(!t.moved&&Math.abs(n)<Mo)return;t.moved=!0,this.classList.add(`is-dragging`);let r=e.timeStamp-t.lastT;r>0&&(t.velocity=(e.clientY-t.lastY)/r),t.lastY=e.clientY,t.lastT=e.timeStamp;let i=this._points(),a=(i[i.length-1]-i[this._snap])/100*this._viewport();t.offset=Math.max(n,-a),this.style.setProperty(`--wui-drawer-drag`,`${t.offset}px`)}_pointerUp(e){let t=this._drag;if(!t||e.pointerId!==t.id)return;let{moved:n,velocity:r,offset:i=0}=t;if(this._endDrag(),!n)return;let a=this._points(),o=this._viewport(),s=(a[this._snap]/100*o-i)/(o/100),c=!this.hasAttribute(`static`),l=ko({points:a,index:this._snap,visible:s,velocity:r,canDismiss:c});l>=0?this._setSnap(l):this._requestClose()}_endDrag(){let e=this._drag;e&&(this._drag=null,e.grip.releasePointerCapture?.(e.id),e.grip.removeEventListener(`pointermove`,this._onPointerMove),e.grip.removeEventListener(`pointerup`,this._onPointerUp),e.grip.removeEventListener(`pointercancel`,this._onPointerUp),this.classList.remove(`is-dragging`),this.style.removeProperty(`--wui-drawer-drag`))}},Lo=300,Ro=150,zo=`.wui-hover-card-trigger`,Bo=`.wui-hover-card-panel`,Vo=`a[href],button,input,select,textarea,[tabindex]`,Ho=0,Uo=class extends l{constructor(){super(),this._doc=null,this._timer=null,this._described=null,this._refocusing=!1,this._onOver=e=>{if(e.pointerType===`touch`||e.pointerType===`pen`)return;let t=this._zone(e.target);t===`panel`?this._clear():t===`trigger`&&this._schedule(!0)},this._onOut=e=>{e.pointerType===`touch`||e.pointerType===`pen`||this._zone(e.target)&&!this._zone(e.relatedTarget)&&this._schedule(!1)},this._onFocusIn=e=>{this._refocusing||(this._zone(e.target)===`trigger`?this._schedule(!0):this._zone(e.target)===`panel`&&this._clear())},this._onFocusOut=e=>{this._zone(e.target)&&!this._zone(e.relatedTarget)&&this._schedule(!1)},this._onKeyDown=e=>{if(e.key!==`Escape`||!this.isOpen)return;e.stopPropagation();let t=this._panel?.contains(this.ownerDocument.activeElement);this._clear(),this._setOpen(!1),t&&(this._refocusing=!0,this._anchor?.focus(),this._refocusing=!1)}}get isOpen(){return this._panel?.hasAttribute(`data-open`)??!1}connectedCallback(){this._doc=this.ownerDocument,this.addEventListener(`pointerover`,this._onOver),this.addEventListener(`pointerout`,this._onOut),this.addEventListener(`focusin`,this._onFocusIn),this.addEventListener(`focusout`,this._onFocusOut)}disconnectedCallback(){this._clear(),this.removeEventListener(`pointerover`,this._onOver),this.removeEventListener(`pointerout`,this._onOut),this.removeEventListener(`focusin`,this._onFocusIn),this.removeEventListener(`focusout`,this._onFocusOut),this._doc?.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`keydown`,this._onKeyDown),c(this),this._doc=null}get _trigger(){return this.querySelector(zo)}get _panel(){return this.querySelector(Bo)}get _anchor(){let e=this._trigger;return e?.querySelector(Vo)??e}_zone(e){if(!(e instanceof Node)||!this.contains(e))return null;let t=e instanceof Element?e:e.parentElement;return this._panel?.contains(t)?`panel`:this._trigger?.contains(t)?`trigger`:null}_delay(e,t){let n=Number(this.getAttribute(e));return this.hasAttribute(e)&&Number.isFinite(n)&&n>=0?n:t}_clear(){this._timer!==null&&clearTimeout(this._timer),this._timer=null}_schedule(e){if(this._clear(),this.isOpen===e)return;let t=e?this._delay(`open-delay`,Lo):this._delay(`close-delay`,Ro);this._timer=setTimeout(()=>{this._timer=null,this._setOpen(e)},t)}_setOpen(e){let t=this._panel;!t||this.isOpen===e||(e?(t.setAttribute(`data-open`,``),this._reposition(),s(this,()=>this._reposition()),this._doc?.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`keydown`,this._onKeyDown),this._describe(t)):(t.removeAttribute(`data-open`),c(this),this._doc?.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`keydown`,this._onKeyDown),this._described?.removeAttribute(`aria-describedby`),this._described=null),this.dispatchEvent(new CustomEvent(e?`wui:hover-card:open`:`wui:hover-card:close`,{bubbles:!0})))}_reposition(){this.isOpen&&o(this._trigger,this._panel,{clampHeight:!0})}_describe(e){let t=this._anchor;t&&(e.id||=`wui-hover-card-${++Ho}`,t.setAttribute(`aria-describedby`,e.id),this._described=t)}},Wo=4096,Go=[.92,.8,.65,.5],Ko=.8,qo=8;function Jo(e){if(e==null||e===``||e===`free`)return null;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)&&t>0?t:null}function Yo(e,t,n){if(!n)return{x:0,y:0,w:e,h:t};let r=e,i=r/n;return i>t&&(i=t,r=i*n),{x:(e-r)/2,y:(t-i)/2,w:r,h:i}}function Xo(e,t,n){return{...e,x:Math.min(Math.max(e.x,0),Math.max(t-e.w,0)),y:Math.min(Math.max(e.y,0),Math.max(n-e.h,0))}}function Zo(e,t,n,r,i){return Xo({...e,x:e.x+t,y:e.y+n},r,i)}function Qo(e,t){return Math.min(32,e,t)}function $o(e,t){return t.w/e.w}function es(e,t){return Math.max(4,$o(e,t))}function ts(e,t,n,r,i){let a=Math.min(Math.max(n,1),es(e,t)),o=e.h/e.w,s=Math.min(r,i/o),c=Math.min(Math.max(Qo(r,i),Qo(r,i)/o),s),l=Math.min(Math.max(t.w/a,c),s),u=l*o,d=e.x+e.w/2,f=e.y+e.h/2;return Xo({x:d-l/2,y:f-u/2,w:l,h:u},r,i)}var ns=[`nw`,`ne`,`sw`,`se`];function rs(e,t,n,r,i,a){let o=Qo(i,a),s=t.endsWith(`w`),c=t.startsWith(`n`),l=s?e.x+e.w:e.x,u=c?e.y+e.h:e.y,d=Math.min(Math.max(n,0),i),f=Math.min(Math.max(r,0),a);return d=s?Math.min(d,l-o):Math.max(d,l+o),f=c?Math.min(f,u-o):Math.max(f,u+o),{x:Math.min(d,l),y:Math.min(f,u),w:Math.abs(d-l),h:Math.abs(f-u)}}function is(e,t=Wo){let n=Math.min(1,t/Math.max(e.w,e.h));return{width:Math.max(1,Math.round(e.w*n)),height:Math.max(1,Math.round(e.h*n))}}function as(e,t){let n=t/Math.max(e.w,e.h);return{width:Math.max(1,Math.round(e.w*n)),height:Math.max(1,Math.round(e.h*n))}}function os(e,t,n){return n%180==0?{w:e,h:t}:{w:t,h:e}}function ss(e,t,n){return Xo({x:n-(e.y+e.h),y:e.x,w:e.h,h:e.w},n,t)}function cs(e){return String(e||``).split(/[\s,]+/).map(Number).filter(e=>Number.isInteger(e)&&e>0)}var ls=[`image/png`,`image/jpeg`,`image/webp`],us={"image/png":`.png`,"image/jpeg":`.jpg`,"image/webp":`.webp`};function ds(e){let t=String(e||``).toLowerCase();return ls.includes(t)?t:`image/png`}function fs(e,t){let n=String(e||`image`),r=us[t];return(t===`image/jpeg`?/\.jpe?g$/i.test(n):n.toLowerCase().endsWith(r))?n:`${n.replace(/\.[^./\\]+$/,``)||`image`}${r}`}async function ps(e,{width:t,height:n,type:r,maxBytes:i}){let a=r,o=t,s=n,c=null;for(let t=0;t<=qo;t++){let n=a===`image/png`?[void 0]:t===0?Go:[Go[1]];for(let t of n){if(c=await e(o,s,a,t),!c||(c.type&&c.type!==a&&(a=c.type),!(i>0)||c.size<=i))return c;if(a===`image/png`)break}o=Math.max(1,Math.round(o*Ko)),s=Math.max(1,Math.round(s*Ko))}return c}var ms=.05,hs=.2,gs={w:320,h:240},_s={nw:`top left`,ne:`top right`,sw:`bottom left`,se:`bottom right`},vs=`<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M5 12h14"/></svg>`,ys=`<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><path d="M5 12h14M12 5v14"/></svg>`,bs=`<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/></svg>`,xs=`<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/></svg>`,Ss=(e,t)=>Math.hypot(e.x-t.x,e.y-t.y),Cs=class extends l{static get observedAttributes(){return[`src`,`aspect`,`round`,`rotatable`,`previews`]}constructor(){super(),this._rect=null,this._base=null,this._natural=null,this._source=null,this._rotation=0,this._drag=null,this._pointers=new Map,this._pinch=null,this._previewPending=!1,this._resizeObserver=null}get src(){return this.getAttribute(`src`)||``}set src(e){e==null||e===``?this.removeAttribute(`src`):this.setAttribute(`src`,String(e))}get aspect(){return Jo(this.getAttribute(`aspect`))}set aspect(e){e==null||e===``?this.removeAttribute(`aspect`):this.setAttribute(`aspect`,String(e))}get round(){return this.hasAttribute(`round`)}set round(e){this.toggleAttribute(`round`,!!e)}get rotatable(){return this.hasAttribute(`rotatable`)}set rotatable(e){this.toggleAttribute(`rotatable`,!!e)}get previews(){return this.getAttribute(`previews`)||``}set previews(e){e==null||e===``?this.removeAttribute(`previews`):this.setAttribute(`previews`,Array.isArray(e)?e.join(` `):String(e))}get rect(){return this._rect?{...this._rect}:null}get rotation(){return this._rotation}set rotation(e){if(!this._rect)return;let t=(Math.round(Number(e)/90)*90%360+360)%360;if(!Number.isNaN(t))for(;this._rotation!==t;)this.rotate()}get zoom(){return this._rect?$o(this._rect,this._base):1}set zoom(e){this._rect&&(this._rect=ts(this._rect,this._base,Number(e)||1,this._natural.w,this._natural.h),this._paint(),this._announce())}connectedCallback(){if(!this._rendered){this.render();return}this._observe()}disconnectedCallback(){this._resizeObserver?.disconnect(),this._resizeObserver=null}attributeChangedCallback(e){this._rendered&&(e===`src`?this._loadImage():e===`aspect`?(this._rebuildHandles(),this._resetRect()):e===`rotatable`?this._tools.hidden=!this.rotatable:e===`previews`?this._renderPreviews():this._applyRound())}render(){this.innerHTML=`<div>
318
318
  <div class="wui-crop-stage" tabindex="0" role="group" aria-label="Crop area. Drag the frame or use the arrow keys to move it, and plus or minus to zoom.">
319
319
  <img class="wui-crop-img" alt="" draggable="false">
320
320
  <div class="wui-crop-frame"></div>
321
321
  </div>
322
322
  <div class="wui-crop-controls">
323
- <button type="button" class="wui-crop-zoombtn" data-zoom="out" aria-label="Zoom out">${gs}</button>
323
+ <button type="button" class="wui-crop-zoombtn" data-zoom="out" aria-label="Zoom out">${vs}</button>
324
324
  <input type="range" class="form-range wui-crop-zoom" min="1" max="4" step="0.01" value="1" aria-label="Zoom">
325
- <button type="button" class="wui-crop-zoombtn" data-zoom="in" aria-label="Zoom in">${_s}</button>
325
+ <button type="button" class="wui-crop-zoombtn" data-zoom="in" aria-label="Zoom in">${ys}</button>
326
326
  </div>
327
327
  <div class="wui-crop-tools" hidden>
328
- <button type="button" class="wui-crop-toolbtn" data-crop-action="rotate" aria-label="Rotate 90 degrees clockwise">${vs}<span>Rotate</span></button>
329
- <button type="button" class="wui-crop-toolbtn" data-crop-action="reset" aria-label="Reset the crop">${ys}<span>Reset</span></button>
328
+ <button type="button" class="wui-crop-toolbtn" data-crop-action="rotate" aria-label="Rotate 90 degrees clockwise">${bs}<span>Rotate</span></button>
329
+ <button type="button" class="wui-crop-toolbtn" data-crop-action="reset" aria-label="Reset the crop">${xs}<span>Reset</span></button>
330
330
  </div>
331
331
  <div class="wui-crop-previews" aria-hidden="true" hidden></div>
332
332
  <div class="visually-hidden" data-wui-crop-live aria-live="polite"></div>
333
- </div>`,this._stage=this.querySelector(`.wui-crop-stage`),this._img=this.querySelector(`.wui-crop-img`),this._frame=this.querySelector(`.wui-crop-frame`),this._slider=this.querySelector(`.wui-crop-zoom`),this._tools=this.querySelector(`.wui-crop-tools`),this._previewBox=this.querySelector(`.wui-crop-previews`),this._live=this.querySelector(`[data-wui-crop-live]`),this._rendered=!0,this._tools.hidden=!this.rotatable,this._applyRound(),this._rebuildHandles(),this._renderPreviews(),this._wire(),this._observe(),this._loadImage()}_applyRound(){this._frame.classList.toggle(`wui-crop-frame--round`,this.round),this._previewBox.classList.toggle(`wui-crop-previews--round`,this.round)}_rebuildHandles(){for(let e of this._frame.querySelectorAll(`.wui-crop-handle`))e.remove();if(!this.aspect)for(let e of es){let t=document.createElement(`button`);t.type=`button`,t.className=`wui-crop-handle wui-crop-handle--${e}`,t.dataset.handle=e,t.setAttribute(`aria-label`,`Resize ${hs[e]} corner`),this._frame.appendChild(t)}}_renderPreviews(){let e=os(this.previews);this._previewBox.replaceChildren(),this._previewBox.hidden=e.length===0;for(let t of e){let e=document.createElement(`canvas`);e.className=`wui-crop-preview`,e.dataset.size=String(t),e.style.width=`${t}px`,e.style.height=`${t}px`,this._previewBox.appendChild(e)}this._schedulePreviews()}_loadImage(){this._rect=null,this._natural=null,this._source=null,this._rotation=0,this._drag=null,this._pinch=null,this._pointers.clear();let e=this.src;this._img.hidden=!e,this._frame.hidden=!0,e&&(this._img.onload=()=>{this._source={w:this._img.naturalWidth,h:this._img.naturalHeight},this._natural={...this._source},this._resetRect(),this.dispatchEvent(new Event(`load`))},this._img.onerror=()=>{this._frame.hidden=!0,this.dispatchEvent(new Event(`error`))},this._img.src=e)}_resetRect(){this._natural&&(this._base=qo(this._natural.w,this._natural.h,this.aspect),this._rect={...this._base},this._frame.hidden=!1,this._paint())}_observe(){typeof ResizeObserver>`u`||this._resizeObserver||(this._resizeObserver=new ResizeObserver(()=>this._paint()),this._resizeObserver.observe(this._stage))}_view(){let e=this._stage.clientWidth||ms.w,t=this._stage.clientHeight||ms.h,n=Math.min(e/this._natural.w,t/this._natural.h),r=this._natural.w*n,i=this._natural.h*n;return{scale:n,left:(e-r)/2,top:(t-i)/2,iw:r,ih:i}}_paint(){if(!this._rect)return;let e=this._view(),t=this._rotation%180!=0,n=t?e.ih:e.iw,r=t?e.iw:e.ih;Object.assign(this._img.style,{left:`${e.left+(e.iw-n)/2}px`,top:`${e.top+(e.ih-r)/2}px`,width:`${n}px`,height:`${r}px`,transform:this._rotation?`rotate(${this._rotation}deg)`:``});let i=this._rect;Object.assign(this._frame.style,{left:`${e.left+i.x*e.scale}px`,top:`${e.top+i.y*e.scale}px`,width:`${i.w*e.scale}px`,height:`${i.h*e.scale}px`});let a=Zo(i,this._base),o=Qo(i,this._base);this._slider.max=String(o),this._slider.value=String(Math.min(Math.max(a,1),o)),this._slider.setAttribute(`aria-valuetext`,`${Math.round(a*100)}%`),this._schedulePreviews()}_schedulePreviews(){if(!this._rect||this._previewBox.hidden||this._previewPending)return;this._previewPending=!0;let e=()=>{this._previewPending=!1,this._drawPreviews()};typeof requestAnimationFrame==`function`?requestAnimationFrame(e):e()}_drawPreviews(){if(!this._rect)return;let e=Jo(this._rect,this._natural.w,this._natural.h),t=typeof window<`u`&&window.devicePixelRatio||1;for(let n of this._previewBox.children){let r=Number(n.dataset.size),i=Math.max(1,Math.round(r*e.h/e.w));n.style.width=`${r}px`,n.style.height=`${i}px`,n.width=Math.round(r*t),n.height=Math.round(i*t);let a=n.getContext(`2d`);a&&this._drawCrop(a,e,n.width,n.height)}}_drawCrop(e,t,n,r){if(!this._rotation){e.drawImage(this._img,t.x,t.y,t.w,t.h,0,0,n,r);return}let i=this._source;e.save(),e.scale(n/t.w,r/t.h),e.translate(-t.x,-t.y),e.translate(this._natural.w/2,this._natural.h/2),e.rotate(this._rotation*Math.PI/180),e.drawImage(this._img,-i.w/2,-i.h/2,i.w,i.h),e.restore()}_announce(){this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,detail:this.rect}))}_say(){let e=this._rect,t=this._rotation?`, turned ${this._rotation} degrees`:``,n=`Frame ${Math.round(e.w)} by ${Math.round(e.h)} pixels, ${Math.round(e.x)} from the left, ${Math.round(e.y)} from the top, zoom ${Math.round(Zo(e,this._base)*100)}%${t}.`;this._live.textContent=n===this._live.textContent?`${n} `:n}rotate(){if(!this._rect)return;let e=as(this._rect,this._natural.w,this._natural.h);this._rotation=(this._rotation+90)%360,this._natural=is(this._source.w,this._source.h,this._rotation),this._base=qo(this._natural.w,this._natural.h,this.aspect);let t=this.aspect;this._rect=t&&t!==1?{...this._base}:e,this._paint(),this._announce()}reset(){this._source&&(this._rotation=0,this._natural={...this._source},this._resetRect(),this._announce())}_wire(){let e=this._stage;e.addEventListener(`pointerdown`,t=>{if(!this._rect||t.button>0)return;if(this._pointers.set(t.pointerId,{x:t.clientX,y:t.clientY}),e.setPointerCapture?.(t.pointerId),this._pointers.size===2){let[e,n]=[...this._pointers.values()];this._drag=null,this._pinch={distance:bs(e,n)||1,zoom:this.zoom,done:!1},t.preventDefault();return}if(this._pinch)return;let n=t.target.closest?.(`.wui-crop-handle`);this._drag={id:t.pointerId,corner:n?n.dataset.handle:null,x:t.clientX,y:t.clientY,start:{...this._rect}},n||e.focus(),t.preventDefault()}),e.addEventListener(`pointermove`,t=>{if(this._pointers.has(t.pointerId)&&this._pointers.set(t.pointerId,{x:t.clientX,y:t.clientY}),this._pinch){if(this._pinch.done||this._pointers.size<2||!this._pointers.has(t.pointerId))return;let[e,n]=[...this._pointers.values()],r=this._pinch.zoom*bs(e,n)/this._pinch.distance;this._rect=$o(this._rect,this._base,r,this._natural.w,this._natural.h),this._paint();return}let n=this._drag;if(!n||n.id!==t.pointerId)return;let r=this._view(),{w:i,h:a}=this._natural;if(n.corner){let o=e.getBoundingClientRect(),s=(t.clientX-o.left-e.clientLeft-r.left)/r.scale,c=(t.clientY-o.top-e.clientTop-r.top)/r.scale;this._rect=ts(this._rect,n.corner,s,c,i,a)}else this._rect=Yo(n.start,(t.clientX-n.x)/r.scale,(t.clientY-n.y)/r.scale,i,a);this._paint()});let t=t=>{if(this._pointers.delete(t.pointerId)&&e.releasePointerCapture?.(t.pointerId),this._pinch){!this._pinch.done&&this._pointers.size<2&&(this._pinch.done=!0,this._announce()),this._pointers.size===0&&(this._pinch=null);return}let n=this._drag;!n||n.id!==t.pointerId||(this._drag=null,this._announce())};e.addEventListener(`pointerup`,t),e.addEventListener(`pointercancel`,t),e.addEventListener(`keydown`,e=>this._onKey(e)),e.addEventListener(`wheel`,e=>{!this._rect||!this.contains(document.activeElement)||(e.preventDefault(),this.zoom*=e.deltaY<0?1.1:1/1.1)},{passive:!1});for(let e of[`input`,`change`])this._slider.addEventListener(e,e=>e.stopPropagation());this._slider.addEventListener(`input`,()=>{this.zoom=Number(this._slider.value)});for(let e of this.querySelectorAll(`.wui-crop-zoombtn`))e.addEventListener(`click`,()=>{this.zoom*=e.dataset.zoom===`in`?1.25:.8});this.querySelector(`[data-crop-action="rotate"]`).addEventListener(`click`,()=>this.rotate()),this.querySelector(`[data-crop-action="reset"]`).addEventListener(`click`,()=>this.reset())}_onKey(e){if(!this._rect||e.altKey||e.ctrlKey||e.metaKey)return;let{w:t,h:n}=this._natural;if(e.key===`+`||e.key===`=`)this.zoom*=1.25,this._say();else if(e.key===`-`||e.key===`_`)this.zoom*=.8,this._say();else if((e.key===`r`||e.key===`R`)&&this.rotatable)this.rotate(),this._say();else if(e.key.startsWith(`Arrow`)){let r=e.shiftKey?ps:fs,i=e.key===`ArrowRight`?1:e.key===`ArrowLeft`?-1:0,a=e.key===`ArrowDown`?1:e.key===`ArrowUp`?-1:0,o=e.target.closest?.(`.wui-crop-handle`)?.dataset.handle;if(o){let e=this._rect,s=(o.endsWith(`w`)?e.x:e.x+e.w)+i*r*e.w,c=(o.startsWith(`n`)?e.y:e.y+e.h)+a*r*e.h;this._rect=ts(e,o,s,c,t,n)}else this._rect=Yo(this._rect,i*r*this._rect.w,a*r*this._rect.h,t,n);this._paint(),this._announce(),this._say()}else return;e.preventDefault()}async toBlob({type:e,maxBytes:t=0,size:n=0}={}){if(!this._rect)return null;let r=ls(e),i=Jo(this._rect,this._natural.w,this._natural.h),{width:a,height:o}=n>0?rs(i,n):ns(i);return ds((e,t,n,r)=>new Promise(a=>{let o=document.createElement(`canvas`);o.width=e,o.height=t;let s=o.getContext(`2d`);if(!s){a(null);return}n===`image/jpeg`&&(s.fillStyle=`#fff`,s.fillRect(0,0,e,t)),this._drawCrop(s,i,e,t),o.toBlob(a,n,r)}),{width:a,height:o,type:r,maxBytes:t})}async toFile({name:e,type:t,maxBytes:n=0,size:r=0}={}){let i=await this.toBlob({type:t,maxBytes:n,size:r});return i?new File([i],us(e,i.type),{type:i.type}):null}},Ss=Object.freeze([`text`,`number`,`select`,`date`,`textarea`]),Cs=2e3,ws=Object.freeze({edit:e=>`Edit ${e}: `,readOnly:e=>`${e}: `,saved:e=>`${e} saved.`,notSaved:(e,t)=>`${e} was not saved. ${t}`,failed:Object.freeze({forbidden:`You do not have permission to change this.`,client:`This could not be saved. Refresh the page and try again.`,validation:`This value was not accepted. Check it and try again.`,server:`Something went wrong on our side, so this was not saved. Try again in a moment.`,network:`Could not reach the server, so this was not saved. Check your connection and try again.`})});function Ts(e,{type:t=`text`,options:n,placeholder:r}={}){let i=e==null?``:String(e);if(i===``)return{text:r||`-`,empty:!0};if(t===`date`)return{text:oo(i)||i,empty:!1};if(t===`select`){let e=n?.find(e=>String(e.value)===i);return{text:typeof e?.label==`string`?e.label:i,empty:!1}}return{text:i,empty:!1}}var Es=`[data-wui-display]`,Ds=`[data-wui-value]`,Os=`[data-wui-editor]`,ks=`[data-wui-control]`,As=`[data-wui-error]`,js=`[data-wui-live]`,Ms=`[aria-expanded="true"]`,Ns=new Set([`select`,`date`]),Ps=e=>typeof e?.message==`string`&&e.message?e.message:ws.failed.server,Fs=class extends l{static get observedAttributes(){return[`disabled`]}constructor(){super(),this._wired=!1,this._editing=!1,this._busy=!1,this._draft=null,this._pressed=!1,this._popupOpen=!1,this._savedTimer=null,this._onClick=this._onClick.bind(this),this._onKeyCapture=this._onKeyCapture.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onFocusOut=this._onFocusOut.bind(this),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onChange=this._onChange.bind(this)}connectedCallback(){this._wired||(this._wired=!0,this.addEventListener(`click`,this._onClick),this.addEventListener(`auxclick`,this._onClick),this.addEventListener(`keydown`,this._onKeyCapture,!0),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`focusout`,this._onFocusOut),this.addEventListener(`pointerdown`,this._onPointerDown),this.addEventListener(`change`,this._onChange))}disconnectedCallback(){clearTimeout(this._savedTimer),this._savedTimer=null,this._releasePress()}attributeChangedCallback(e){e===`disabled`&&this.hasAttribute(`disabled`)&&this.cancel()}edit(){if(this._editing||this._busy||this.hasAttribute(`disabled`))return;let e=this.querySelector(Es),t=this.querySelector(Os),n=this._control();!e||!t||!n||(this._editing=!0,this._setState(null),n.value=this._draft??this._value(),e.hidden=!0,t.hidden=!1,this.setAttribute(`data-wui-editing`,``),this._focusControl(n))}cancel(){this._editing&&(this._draft=null,this._setError(null),this.getAttribute(`data-wui-state`)===`error`&&this._setState(null),this._close())}_onClick(e){e.stopPropagation(),e.type===`click`&&!this._editing&&this.querySelector(Es)?.contains(e.target)&&this.edit()}_onKeyCapture(){this._popupOpen=!!(this._editing&&this.querySelector(Os)?.querySelector(Ms))}_onKeyDown(e){if(!this._editing){(e.key===`Enter`||e.key===` `)&&e.stopPropagation();return}if(e.stopPropagation(),this._popupOpen)return;if(e.key===`Escape`){e.preventDefault(),this.cancel();return}let t=this._type();e.key!==`Enter`||Ns.has(t)||t===`textarea`&&!(e.ctrlKey||e.metaKey)||(e.preventDefault(),this._commit(this._control()?.value??``))}_onFocusOut(e){if(!this._editing||this._pressed)return;let t=e.relatedTarget;t&&this.contains(t)||document.hasFocus()&&this._commit(this._control()?.value??``)}_onPointerDown(){this._editing&&(this._pressed=!0,document.addEventListener(`pointerup`,this._onPointerUp,!0),document.addEventListener(`pointercancel`,this._onPointerUp,!0))}_onPointerUp(){this._releasePress(),setTimeout(()=>{this._pressed=!1,this._editing&&!this.contains(document.activeElement)&&document.hasFocus()&&this._commit(this._control()?.value??``)},0)}_releasePress(){document.removeEventListener(`pointerup`,this._onPointerUp,!0),document.removeEventListener(`pointercancel`,this._onPointerUp,!0)}_onChange(e){if(!this._editing||!Ns.has(this._type()))return;let t=this._control();!t||e.target!==t||queueMicrotask(()=>this._commit(t.value))}async _commit(e){if(!this._editing||this._busy)return;let t=this._value();if(e===t){this.cancel();return}let n=typeof this.validate==`function`?this.validate(e):null;if(n){this._setError(n),this._announce(n);return}let r=this.hasAttribute(`controlled`);this._draft=null,this._setError(null),this._busy=!0,this._setState(`saving`),this.setAttribute(`aria-busy`,`true`);let i=r?null:this._readShown();r||this._showValue(e),this._close();let a=await this._persist(e,r);this._busy=!1,this.removeAttribute(`aria-busy`);let o=this.getAttribute(`label`)||``;if(a.ok){this.setAttribute(`value`,e),!r&&a.text&&this._showText(a.text,!1),this._setState(`saved`),this._savedTimer=setTimeout(()=>this._setState(null),Cs),this._announce(ws.saved(o)),this._fire(`wui:inline-edit:saved`,{value:e,previous:t});return}if(i&&this._restoreShown(i),a.kind===`session`||a.kind===`aborted`){this._setState(null);return}this._draft=e,this._setState(`error`),this._setError(a.message),this._announce(ws.notSaved(o,a.message)),this._fire(`wui:inline-edit:failed`,{value:e,previous:t,kind:a.kind,message:a.message})}async _persist(e,t){if(t){if(typeof this.save!=`function`)return{ok:!0};try{return await this.save(e),{ok:!0}}catch(e){return{ok:!1,kind:`server`,message:Ps(e)}}}let n=this.getAttribute(`action`);if(!n)return{ok:!0};let r=await P(n,{method:`POST`,body:new URLSearchParams({[this.getAttribute(`name`)||`value`]:e})});return r.ok?{ok:!0,text:r.html.trim()}:{ok:!1,kind:r.kind,message:r.message||ws.failed[r.kind]||ws.failed.server}}_close(){let e=this.querySelector(Es),t=this.querySelector(Os),n=this.contains(document.activeElement);this._editing=!1,this.removeAttribute(`data-wui-editing`),t&&(t.hidden=!0),e&&(e.hidden=!1),t?.querySelector(Ms)?.click(),n&&e?.focus()}_focusControl(e){if(!Ns.has(this._type())){e.focus(),e.select?.();return}let t=e.querySelector(`button`);t&&(t.focus(),t.getAttribute(`aria-expanded`)!==`true`&&t.click())}_showValue(e){if(e===``){this._showText(this.getAttribute(`placeholder`)||`-`,!0);return}let t=this._type(),n=e;if(t===`date`)n=oo(e)||e;else if(t===`select`){let t=[...this._control()?.querySelectorAll(`[data-value]`)??[]].find(t=>t.getAttribute(`data-value`)===e);t&&(n=t.textContent.trim())}this._showText(n,!1)}_readShown(){let e=this.querySelector(Ds);return e?{html:e.innerHTML,empty:e.hasAttribute(`data-wui-empty`)}:null}_restoreShown(e){let t=this.querySelector(Ds);t&&(t.innerHTML=e.html,t.toggleAttribute(`data-wui-empty`,e.empty))}_showText(e,t){let n=this.querySelector(Ds);n&&(n.textContent=e,n.toggleAttribute(`data-wui-empty`,t))}_setError(e){let t=this.querySelector(As),n=this._control();t&&(t.textContent=e||``,t.hidden=!e),e?n?.setAttribute(`aria-invalid`,`true`):n?.removeAttribute(`aria-invalid`)}_setState(e){clearTimeout(this._savedTimer),this._savedTimer=null,e?this.setAttribute(`data-wui-state`,e):this.removeAttribute(`data-wui-state`)}_announce(e){let t=this.querySelector(js);!t||!e||(t.textContent=``,t.textContent=e)}_fire(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:t}))}_control(){return this.querySelector(ks)}_value(){return this.getAttribute(`value`)??``}_type(){let e=this.getAttribute(`type`);return Ss.includes(e)?e:`text`}},Is=`a.wui-lightbox-item`,J=1,Ls=4,Rs=.5,zs=2,Bs=50,Vs=6,Hs=300,Us=300;function Ws(e){return Number.isFinite(e)?Math.min(Ls,Math.max(J,e)):J}function Gs(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 Ks(e,t){return Math.abs(e)<Bs||Math.abs(e)<Math.abs(t)*1.5?0:e<0?1:-1}function qs(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 Js(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=j(e,{size:20}),r}var Ys=class extends l{constructor(){super(),this._ui=null,this._index=0,this._zoom=J,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?.closest?.(Is);if(!t||!this.contains(t))return;let n=this._links().indexOf(t);n<0||(e.preventDefault(),this.open(n))}}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 isOpen(){return this._ui!==null}connectedCallback(){this.addEventListener(`click`,this._onClick)}disconnectedCallback(){this.removeEventListener(`click`,this._onClick),this._teardown()}_links(){return[...this.querySelectorAll(Is)]}_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||qs(t)}})}open(e=0){let t=this._items();return t.length?(this._ui||(this._returnTo=document.activeElement,this._build(),this.dispatchEvent(new CustomEvent(`wui-lightbox:open`,{bubbles:!0,detail:{index:e}}))),this._show(e,t),this._ui.close.focus(),!0):!1}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`),i=Js(`zoom-out`,`Zoom out`,`wui-lightbox-zoom-out`),a=Js(`zoom-in`,`Zoom in`,`wui-lightbox-zoom-in`),o=Y(`a`,`u-action wui-lightbox-btn wui-lightbox-download`,{"aria-label":`Download`,title:`Download`});o.style.setProperty(`--wui-action-size`,`40px`),o.innerHTML=j(`download`,{size:20}),o.hidden=!this.download;let s=Js(`x`,`Close`,`wui-lightbox-close`);r.append(i,a,o,s),t.append(n,r);let c=Y(`div`,`wui-lightbox-stage`),l=Js(`chevron-left`,`Previous image`,`wui-lightbox-nav wui-lightbox-prev`),u=Js(`chevron-right`,`Next image`,`wui-lightbox-nav wui-lightbox-next`),d=Y(`img`,`wui-lightbox-image`,{decoding:`async`,draggable:`false`,alt:``}),f=Y(`p`,`wui-lightbox-status`,{role:`status`});c.append(d,f,l,u);let p=Y(`p`,`wui-lightbox-caption`);e.append(t,c,p);let m={root:e,count:n,zoomOut:i,zoomIn:a,download:o,close:s,stage:c,prev:l,next:u,image:d,status:f,caption:p};this._ui=m,s.addEventListener(`click`,()=>this.close()),l.addEventListener(`click`,()=>this.step(-1)),u.addEventListener(`click`,()=>this.step(1)),i.addEventListener(`click`,()=>this._setZoom(this._zoom-Rs)),a.addEventListener(`click`,()=>this._setZoom(this._zoom+Rs)),e.addEventListener(`keydown`,e=>this._onKeyDown(e)),c.addEventListener(`pointerdown`,e=>this._onPointerDown(e)),c.addEventListener(`pointermove`,e=>this._onPointerMove(e)),c.addEventListener(`pointerup`,e=>this._onPointerEnd(e,!0)),c.addEventListener(`pointercancel`,e=>this._onPointerEnd(e,!1)),c.addEventListener(`wheel`,e=>this._onWheel(e),{passive:!1}),d.addEventListener(`load`,()=>{this._ui===m&&(f.textContent=``,c.removeAttribute(`aria-busy`),d.hidden=!1,this._applyTransform())}),d.addEventListener(`error`,()=>{this._ui===m&&(c.removeAttribute(`aria-busy`),d.hidden=!0,f.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._ui,r=Math.min(t.length-1,Math.max(0,Math.trunc(Number(e))||0)),i=t[r],a=r!==this._index||!n.image.getAttribute(`src`);if(this._index=r,this._zoom=J,this._pan={x:0,y:0},n.count.textContent=`${k(r+1,{decimals:0})} of ${k(t.length,{decimals:0})}`,n.caption.textContent=i.caption,n.caption.hidden=!i.caption,n.download.href=i.src,n.download.setAttribute(`download`,i.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=i.alt||i.caption,n.image.src=i.src,this._applyTransform(),this._syncZoomButtons(),t.length>1)for(let e of[t[(r+1)%t.length],t[(r-1+t.length)%t.length]])new Image().src=e.src;a&&this.dispatchEvent(new CustomEvent(`wui-lightbox:change`,{bubbles:!0,detail:{index:r}}))}_syncZoomButtons(){this._ui.zoomOut.disabled=this._zoom<=J,this._ui.zoomIn.disabled=this._zoom>=Ls;let e=document.activeElement;(e===this._ui.zoomOut||e===this._ui.zoomIn)&&e.disabled&&this._ui.close.focus()}_setZoom(e){this._ui&&(this._zoom=Ws(e),this._pan=this._clampedPan(this._pan),this._applyTransform(),this._syncZoomButtons())}_clampedPan(e){let{stage:t,image:n}=this._ui;return Gs(e,this._zoom,{width:t.clientWidth,height:t.clientHeight},{width:n.offsetWidth,height:n.offsetHeight})}_applyTransform(){let{image:e,stage:t}=this._ui;e.style.transform=`translate(${this._pan.x}px, ${this._pan.y}px) scale(${this._zoom})`,t.classList.toggle(`wui-lightbox-zoomed`,this._zoom>J)}_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+Rs)):e.key===`-`?(e.preventDefault(),this._setZoom(this._zoom-Rs)):e.key===`0`&&(e.preventDefault(),this._setZoom(J))}_trapTab(e){let t=[...this._ui.root.querySelectorAll(`button, a[href]`)].filter(e=>!e.hidden&&!e.disabled);if(!t.length){e.preventDefault();return}let n=t[0],r=t[t.length-1],i=document.activeElement;e.shiftKey&&(i===n||!this._ui.root.contains(i))?(e.preventDefault(),r.focus()):!e.shiftKey&&(i===r||!this._ui.root.contains(i))&&(e.preventDefault(),n.focus())}_onWheel(e){e.preventDefault(),this._setZoom(this._zoom*(e.deltaY<0?1.15:1/1.15))}_onPointerDown(e){if(!e.target.closest(`.wui-lightbox-nav`))if(this._ui.stage.setPointerCapture?.(e.pointerId),this._pointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),this._pointers.size===2){let[e,t]=[...this._pointers.values()];this._gesture={kind:`pinch`,distance:Math.hypot(e.x-t.x,e.y-t.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===this._ui.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,n]=[...this._pointers.values()];this._setZoom(t.zoom*Math.hypot(e.x-n.x,e.y-n.y)/t.distance)}else if(t.kind===`drag`){let n=e.clientX-t.startX,r=e.clientY-t.startY;Math.hypot(n,r)>Vs&&(t.moved=!0),this._zoom>J&&(this._pan=this._clampedPan({x:t.pan.x+n,y:t.pan.y+r}),this._ui.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;if(n.moved){this._zoom===J&&this.step(Ks(r,i));return}if(!(e.timeStamp-n.startTime>Hs)){if(!n.onImage){this.close();return}e.timeStamp-this._lastTap<Us?(this._lastTap=-1/0,this._setZoom(this._zoom>J?J:zs)):this._lastTap=e.timeStamp}}},Xs=/^[A-Za-z0-9_.:-]{1,64}$/,Zs=/@(\\+)\[|@\[([^[\]\n]{1,100})\]\(([A-Za-z0-9_.:-]{1,64})\)/g,Qs=/@(\\*)\[/g;function $s(e){return String(e??``).replace(/[[\]\r\n]+/g,` `).replace(/\s+/g,` `).trim().slice(0,100)}var ec=e=>e.replace(Qs,(e,t)=>`@\\${t}[`);function tc(e){let t=String(e??``),n=[],r=e=>{if(!e)return;let t=n[n.length-1];t&&`text`in t?t.text+=e:n.push({text:e})},i=0;for(let e of t.matchAll(Zs))r(t.slice(i,e.index)),e[1]===void 0?n.push({id:e[3],label:e[2]}):r(`@${e[1].slice(1)}[`),i=e.index+e[0].length;return r(t.slice(i)),n}function nc(e){let t=``,n=[];for(let r of tc(e)){if(`text`in r){t+=r.text;continue}let e=`@${r.label}`;n.push({start:t.length,end:t.length+e.length,id:r.id,label:r.label}),t+=e}return{text:t,mentions:n}}function rc(e,t=[]){let n=String(e??``),r=[...t].sort((e,t)=>e.start-t.start),i=``,a=0;for(let e of r)e.start<a||n.slice(e.start,e.end)!==`@${e.label}`||!Xs.test(e.id)||(i+=ec(n.slice(a,e.start)),i+=`@[${e.label}](${e.id})`,a=e.end);return i+ec(n.slice(a))}function ic(e){let t=[];for(let n of tc(e))`id`in n&&!t.includes(n.id)&&t.push(n.id);return t}var ac=8,oc=40,sc=Object.freeze({listName:`People`,searching:`Searching…`,noMatch:`No one matches`,found:e=>`${e===1?`1 person`:`${k(e,{decimals:0})} people`}. Up and down to choose, Enter to mention.`,mentioned:e=>`Mentioned ${e}.`}),cc=`[data-wui-control]`,lc=`[data-wui-field]`,uc=`[data-wui-menu]`,dc=`[data-wui-live]`,fc=0,pc=e=>e&&Xs.test(String(e.value??``))&&$s(e.label)!==``;function mc(e){let t=e.ownerDocument;e.id||=`wui-mention-${++fc}`;let n=t.createElement(`textarea`);n.id=`${e.id}-text`,n.className=`form-control textarea wui-mention-input-text`,n.rows=Number(e.getAttribute(`rows`))>0?Number(e.getAttribute(`rows`)):3,n.setAttribute(`data-wui-control`,``),n.setAttribute(`aria-autocomplete`,`list`),n.setAttribute(`aria-controls`,`${e.id}-people`);let r=e.getAttribute(`label`);r&&n.setAttribute(`aria-label`,r);let i=e.getAttribute(`placeholder`);i&&(n.placeholder=i);for(let t of[`aria-describedby`,`aria-invalid`]){let r=e.getAttribute(t);r&&n.setAttribute(t,r)}n.disabled=e.hasAttribute(`disabled`),e.appendChild(n);let a=e.getAttribute(`name`);if(a){let n=t.createElement(`input`);n.type=`hidden`,n.name=a,n.value=e.getAttribute(`value`)??``,n.setAttribute(`data-wui-field`,``),e.appendChild(n)}let o=t.createElement(`div`);o.className=`wui-mention-menu`,o.id=`${e.id}-people`,o.setAttribute(`role`,`listbox`),o.setAttribute(`aria-label`,sc.listName),o.setAttribute(`data-wui-menu`,``),o.hidden=!0,e.appendChild(o);let s=t.createElement(`span`);s.className=`visually-hidden`,s.setAttribute(`data-wui-live`,``),s.setAttribute(`aria-live`,`polite`),s.setAttribute(`aria-atomic`,`true`),e.appendChild(s)}var hc=class extends l{static get observedAttributes(){return[`disabled`,`aria-invalid`,`aria-describedby`]}constructor(){super(),this._wired=!1,this._text=``,this._mentions=[],this._peopleProp=null,this._declared=null,this._loading=!1,this._query=null,this._results=[],this._active=-1,this._timer=null,this._searchSeq=0,this._abort=null,this._onInput=this._onInput.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onCaret=this._onCaret.bind(this),this._onFocusOut=this._onFocusOut.bind(this),this._onMenuDown=e=>e.preventDefault(),this._onMenuClick=this._onMenuClick.bind(this),this._reposition=()=>{this._isOpen()&&this._position()}}connectedCallback(){for(let e of[`people`,`loading`,`value`])if(Object.hasOwn(this,e)){let t=this[e];delete this[e],this[e]=t}if(this._wired)return;this._wired=!0,this.querySelector(cc)||mc(this);let e=this._control(),t=this.querySelector(lc)?.value??this.getAttribute(`value`)??``;this._pendingValue===void 0?this._load(t):this._load(this._pendingValue),this._pendingValue=void 0,e.addEventListener(`input`,this._onInput),e.addEventListener(`keydown`,this._onKeyDown),e.addEventListener(`click`,this._onCaret),e.addEventListener(`keyup`,this._onCaret),this.addEventListener(`focusout`,this._onFocusOut);let n=this._menu();n.addEventListener(`mousedown`,this._onMenuDown),n.addEventListener(`click`,this._onMenuClick),n.addEventListener(`mousemove`,e=>{let t=e.target.closest?.(`.wui-mention-option`);t&&Number(t.dataset.index)!==this._active&&this._setActive(Number(t.dataset.index),{reveal:!1})})}disconnectedCallback(){this._close(),clearTimeout(this._timer),this._abort?.abort()}attributeChangedCallback(e,t,n){let r=this._control();r&&(e===`disabled`?(r.disabled=n!==null,n!==null&&this._close()):n===null?r.removeAttribute(e):r.setAttribute(e,n))}get value(){return rc(this._text,this._mentions)}set value(e){let t=e==null?``:String(e);if(!this._wired){this._pendingValue=t;return}t!==this.value&&this._load(t)}get mentions(){let e=new Set,t=[];for(let n of[...this._mentions].sort((e,t)=>e.start-t.start))e.has(n.id)||(e.add(n.id),t.push({id:n.id,label:n.label}));return t}get people(){return this._peopleProp?this._peopleProp:(this._declared||=[...this.querySelectorAll(`[data-wui-people] > wui-option`)].map(e=>({value:e.getAttribute(`value`)??``,label:e.textContent.trim(),description:e.getAttribute(`data-description`)||void 0,src:e.getAttribute(`data-src`)||void 0})),this._declared)}set people(e){this._peopleProp=Array.isArray(e)?e.filter(pc):[],(this._isOpen()||this._query!==null)&&this._refresh()}get loading(){return this._loading}set loading(e){this._loading=!!e,this._query!==null&&this._renderMenu()}focus(e){this._control()?.focus(e)}clear(){this._load(``),this._emit()}_control(){return this.querySelector(cc)}_menu(){return this.querySelector(uc)}_load(e){let{text:t,mentions:n}=nc(e);this._text=t,this._mentions=n;let r=this._control();r&&(r.defaultValue=t,r.value=t),this._syncField(),this._close()}_syncField(){let e=this.querySelector(lc);e&&(e.value=this.value)}_emit(){this._syncField(),this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,detail:{value:this.value,mentions:this.mentions}}))}_onInput(){let e=this._control(),t=e.value,n=this._text,r=t.length-n.length,i=Math.min(n.length,t.length),a=Math.max(0,Math.min(i,e.selectionEnd-Math.max(r,0))),o=0;for(;o<a&&n[o]===t[o];)o++;let s=0;for(;s<i-o&&n[n.length-1-s]===t[t.length-1-s];)s++;let c=n.length-s;this._mentions=this._mentions.filter(e=>e.end<=o||e.start>=c).map(e=>e.start>=c?{...e,start:e.start+r,end:e.end+r}:e),this._text=t,this._emit(),this._onCaret()}_onCaret(e){if(e?.type===`keyup`&&[`ArrowUp`,`ArrowDown`,`Enter`,`Tab`,`Escape`].includes(e.key))return;let t=this._queryAtCaret();if(!t){this._close();return}this._query&&t.text===this._query.text&&t.start===this._query.start||(this._query=t,this._refresh())}_queryAtCaret(){let e=this._control();if(!e||e.disabled||e.selectionStart!==e.selectionEnd)return null;let t=e.selectionStart,n=this._text,r=n.lastIndexOf(`@`,t-1);if(r<0||r>0&&!/[\s([{"'“‘]/.test(n[r-1]))return null;let i=n.slice(r+1,t);return i.length>40||/[\n@]/.test(i)||/^\s/.test(i)||/\s{2}/.test(i)||this._mentions.some(e=>r>=e.start&&r<e.end)?null:{start:r,end:t,text:i}}_refresh(){if(!this._query)return;let e=this.hasAttribute(`remote`)||this.hasAttribute(`source`);if(e&&this._query.text.length<this._minChars()){this._results=[],this._close();return}e&&!this._answered(this._query.text)&&this._search(this._query.text);let t=this._query.text.toLowerCase(),n=e?this.people:this.people.filter(e=>$s(e.label).toLowerCase().includes(t));this._results=n.slice(0,8),this._renderMenu()}_answered(e){return this._lastSearch===e}_minChars(){let e=this.getAttribute(`min-chars`),t=e==null||e===``?1:Number(e);return Number.isFinite(t)&&t>=0?t:1}_debounce(){let e=this.getAttribute(`debounce`),t=e==null||e===``?250:Number(e);return Number.isFinite(t)&&t>=0?t:250}_search(e){this._lastSearch=e,clearTimeout(this._timer);let t=++this._searchSeq;this._timer=setTimeout(()=>{let n=this.getAttribute(`source`);if(!n){this.dispatchEvent(new CustomEvent(`search`,{bubbles:!0,detail:{query:e,seq:t}}));return}this._fetchPeople(n,e,t)},this._debounce())}async _fetchPeople(e,t,n){this._abort?.abort();let r=new AbortController;this._abort=r,this.loading=!0;let i=await P(`${e}${e.includes(`?`)?`&`:`?`}q=${encodeURIComponent(t)}`,{signal:r.signal});if(n!==this._searchSeq)return;if(this._abort=null,!i.ok){this._peopleProp=[],this.loading=!1;return}let a=this.ownerDocument.createElement(`template`);a.innerHTML=i.html,this._peopleProp=[...a.content.querySelectorAll(`wui-option`)].map(e=>({value:e.getAttribute(`value`)??``,label:e.textContent.trim(),description:e.getAttribute(`data-description`)||void 0,src:e.getAttribute(`data-src`)||void 0})).filter(pc),this.loading=!1,this._refresh()}_isOpen(){let e=this._menu();return!!(e&&!e.hidden)}_renderMenu(){let e=this._menu(),t=this._control();if(!e||!t||!this._query)return;let n=this.ownerDocument;if(e.replaceChildren(),this._results.forEach((t,r)=>{let i=n.createElement(`div`);if(i.className=`wui-mention-option`,i.id=`${e.id}-${r}`,i.setAttribute(`role`,`option`),i.setAttribute(`aria-selected`,`false`),i.dataset.index=String(r),t.src){let e=n.createElement(`img`);e.className=`wui-mention-option-photo`,e.src=t.src,e.alt=``,i.appendChild(e)}let a=n.createElement(`span`);a.className=`wui-mention-option-text`;let o=n.createElement(`span`);if(o.className=`wui-mention-option-label`,o.textContent=$s(t.label),a.appendChild(o),t.description){let e=n.createElement(`span`);e.className=`wui-mention-option-description`,e.textContent=String(t.description),a.appendChild(e)}i.appendChild(a),e.appendChild(i)}),!this._results.length){let t=n.createElement(`div`);t.className=`wui-mention-empty`,t.textContent=this._loading?sc.searching:`${sc.noMatch} “${this._query.text}”`,e.appendChild(t)}let r=this._isOpen();e.hidden=!1,r||s(this,this._reposition),this._position(),this._setActive(this._results.length?0:-1),this._loading||this._announce(this._results.length?sc.found(this._results.length):`${sc.noMatch}.`)}_position(){o(this._control(),this._menu())}_close(){this._query=null,this._lastSearch=void 0,clearTimeout(this._timer);let e=this._menu();e&&!e.hidden&&(e.hidden=!0,e.replaceChildren()),this._active=-1,this._control()?.removeAttribute(`aria-activedescendant`),c(this)}_setActive(e,{reveal:t=!0}={}){let n=this._menu(),r=[...n.querySelectorAll(`.wui-mention-option`)];this._active=e>=0&&e<r.length?e:-1;let i=this._active>=0?r[this._active]:null;for(let e of r)e.setAttribute(`aria-selected`,e===i?`true`:`false`);di(n,i),i?(t&&i.scrollIntoView?.({block:`nearest`}),this._control().setAttribute(`aria-activedescendant`,i.id)):this._control().removeAttribute(`aria-activedescendant`)}_onKeyDown(e){if(this._isOpen()&&this._query){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=this._results.length;if(!t)return;let n=e.key===`ArrowDown`?1:-1;this._setActive((this._active+n+t)%t);return}if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey&&this._active>=0){e.preventDefault(),this._pick(this._results[this._active]);return}if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),this._close();return}}if(e.key===`Enter`&&(e.ctrlKey||e.metaKey)){e.preventDefault(),this.dispatchEvent(new CustomEvent(`wui:mention-input:submit`,{bubbles:!0,detail:{value:this.value}}));return}e.key===`Backspace`&&this._removeWholeMention(e)}_removeWholeMention(e){let t=this._control();if(t.selectionStart!==t.selectionEnd)return;let n=t.selectionStart,r=this._mentions.find(e=>e.end===n);r&&(e.preventDefault(),this._replace(r.start,r.end,``))}_onMenuClick(e){let t=e.target.closest?.(`.wui-mention-option`);t&&this._pick(this._results[Number(t.dataset.index)])}_pick(e){if(!e||!this._query)return;let t=$s(e.label),{start:n,end:r}=this._query,i=this._text.slice(r),a=`@${t}${/^\s/.test(i)?``:` `}`;this._replace(n,r,a,{id:String(e.value),label:t}),this._announce(sc.mentioned(t))}_replace(e,t,n,r){let i=this._control(),a=n.length-(t-e);this._mentions=this._mentions.filter(n=>n.end<=e||n.start>=t).map(e=>e.start>=t?{...e,start:e.start+a,end:e.end+a}:e),r&&this._mentions.push({start:e,end:e+1+r.label.length,id:r.id,label:r.label}),this._text=this._text.slice(0,e)+n+this._text.slice(t),i.value=this._text;let o=e+n.length;i.setSelectionRange(o,o),this._close(),i.focus(),this._emit()}_onFocusOut(e){e.relatedTarget&&this.contains(e.relatedTarget)||this._close()}_announce(e){let t=this.querySelector(dc);t&&(t.textContent=``,t.textContent=e)}},gc=`[role="menuitem"]`,_c=`data-open`,vc=4,yc=e=>e instanceof Element?e:e?.parentElement??null,bc=e=>e.getAttribute(`aria-disabled`)===`true`,xc=class extends l{constructor(){super(),this._navPanel=null,this._nav=ui({getVisibleOptions:()=>this._navPanel?this._rows(this._navPanel):[],getActive:()=>this._navPanel?this._rows(this._navPanel).indexOf(document.activeElement):-1,setActive:e=>this._rows(this._navPanel)[e]?.focus({preventScroll:!0})}),this._onKeyDown=e=>this._handleKeyDown(e),this._onClick=e=>this._handleClick(e),this._onMouseOver=e=>this._handleMouseOver(e),this._onFocusIn=e=>this._handleFocusIn(e),this._onFocusOut=e=>{let t=e.relatedTarget;this._openMenu()&&t instanceof Node&&!this.contains(t)&&this.close()},this._onPointerDown=e=>{this._openMenu()&&!this.contains(e.target)&&this.close()}}connectedCallback(){this._teardown(),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`click`,this._onClick),this.addEventListener(`mouseover`,this._onMouseOver),this.addEventListener(`focusin`,this._onFocusIn),this.addEventListener(`focusout`,this._onFocusOut),document.addEventListener(`pointerdown`,this._onPointerDown,!0)}disconnectedCallback(){this._teardown()}open(e,{focus:t=null}={}){let n=this._menus().find(t=>this._triggerOf(t).dataset.key===e);n&&this._openTop(n,t)}close(e=!1){let t=this._openMenu();if(t){for(let e of this._panelOf(t).querySelectorAll(`.wui-menubar-sub > [${_c}]`))this._setSub(e.parentElement,!1);this._setTop(t,!1),c(this),this._nav.teardown(),e&&this._triggerOf(t).focus({preventScroll:!0})}}_menus(){return[...this.children].filter(e=>e.classList.contains(`wui-menubar-menu`))}_triggerOf(e){return e.children[0]}_panelOf(e){return e.children[1]}_openMenu(){return this._menus().find(e=>this._panelOf(e)?.hasAttribute(_c))??null}_rows(e){let t=[];for(let n of e.children){let e=n.getAttribute(`role`)===`menuitem`?n:n.classList.contains(`wui-menubar-sub`)?n.children[0]:null;e&&!bc(e)&&t.push(e)}return t}_setTop(e,t){this._panelOf(e).toggleAttribute(_c,t),this._triggerOf(e).setAttribute(`aria-expanded`,String(t))}_setSub(e,t){let n=e.children[1];if(!t)for(let e of n.querySelectorAll(`.wui-menubar-sub > [${_c}]`))this._setSub(e.parentElement,!1);n.toggleAttribute(_c,t),e.children[0].setAttribute(`aria-expanded`,String(t)),t?this._placeSub(n):(n.removeAttribute(`data-side`),n.style.removeProperty(`--wui-menubar-sub-offset`))}_openTop(e,t){let n=this._openMenu();n&&n!==e&&this.close();let r=this._triggerOf(e),i=this._panelOf(e);if(this._setTop(e,!0),o(r,i),s(this,()=>{let e=this._openMenu();e&&o(this._triggerOf(e),this._panelOf(e))}),t){let e=this._rows(i);(t===`last`?e[e.length-1]:e[0])?.focus({preventScroll:!0})}}_openSub(e,t){let n=e.parentElement;for(let t of n.children)t!==e&&t.classList.contains(`wui-menubar-sub`)&&this._setSub(t,!1);this._setSub(e,!0),t&&this._rows(e.children[1])[0]?.focus({preventScroll:!0})}_placeSub(e){e.removeAttribute(`data-side`),e.style.removeProperty(`--wui-menubar-sub-offset`),e.getBoundingClientRect().right>window.innerWidth-vc&&e.setAttribute(`data-side`,`start`);let t=e.getBoundingClientRect().bottom-(window.innerHeight-vc);t>0&&e.style.setProperty(`--wui-menubar-sub-offset`,`${-t}px`)}_handleFocusIn(e){let t=yc(e.target)?.closest(`.wui-menubar-trigger`);if(!(!t||!this.contains(t)))for(let e of this._menus())this._triggerOf(e).tabIndex=this._triggerOf(e)===t?0:-1}_handleKeyDown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=yc(e.target)?.closest(gc);!t||!this.contains(t)||(t.classList.contains(`wui-menubar-trigger`)?this._barKey(e,t):this._menuKey(e,t))}_barKey(e,t){let n=this._menus(),r=n.findIndex(e=>this._triggerOf(e)===t),i=this._openMenu()!==null,a=t=>{e.preventDefault(),i&&!bc(this._triggerOf(t))?this._openTop(t,`first`):this._triggerOf(t).focus({preventScroll:!0})};e.key===`ArrowRight`?a(n[(r+1)%n.length]):e.key===`ArrowLeft`?a(n[(r-1+n.length)%n.length]):e.key===`Home`?a(n[0]):e.key===`End`?a(n[n.length-1]):(e.key===`ArrowDown`||e.key===`ArrowUp`)&&!bc(t)?(e.preventDefault(),this._openTop(n[r],e.key===`ArrowDown`?`first`:`last`)):e.key===`Escape`&&i&&(e.preventDefault(),e.stopPropagation(),this.close(!0))}_menuKey(e,t){let n=t.closest(`[role="menu"]`);if(!n)return;let r=n.classList.contains(`wui-menubar-subpanel`),i=t.closest(`.wui-menubar-menu`),a=this._rows(n),o=a.indexOf(t);if(e.key===`ArrowDown`||e.key===`ArrowUp`)e.preventDefault(),a.length&&a[(o+(e.key===`ArrowDown`?1:-1)+a.length)%a.length].focus({preventScroll:!0});else if(e.key===`ArrowRight`)e.preventDefault(),t.hasAttribute(`aria-haspopup`)?this._openSub(t.parentElement,!0):this._adjacent(i,1);else if(e.key===`ArrowLeft`)if(e.preventDefault(),r){let e=n.parentElement;this._setSub(e,!1),e.children[0].focus({preventScroll:!0})}else this._adjacent(i,-1);else if(e.key===`Escape`)if(e.preventDefault(),e.stopPropagation(),r){let e=n.parentElement;this._setSub(e,!1),e.children[0].focus({preventScroll:!0})}else this.close(!0);else e.key===`Tab`?this.close(!0):e.key===` `?(e.preventDefault(),t.click()):(this._navPanel=n,this._nav.handler(e))}_adjacent(e,t){let n=this._menus(),r=n[(n.indexOf(e)+t+n.length)%n.length];r&&r!==e&&!bc(this._triggerOf(r))&&this._openTop(r,`first`)}_handleClick(e){let t=yc(e.target)?.closest(gc);if(!t||!this.contains(t))return;let n=e.detail===0;if(t.classList.contains(`wui-menubar-trigger`)){if(bc(t))return;let e=t.parentElement;this._openMenu()===e?this.close():this._openTop(e,n?`first`:null),(!n||!this._openMenu())&&t.focus({preventScroll:!0});return}if(bc(t)){e.preventDefault(),e.stopPropagation();return}if(t.hasAttribute(`aria-haspopup`)){e.preventDefault(),this._openSub(t.parentElement,n);return}let r=t.closest(`.wui-menubar-menu`),i=r?this._triggerOf(r).dataset.key:void 0;this.close(!0),this.dispatchEvent(new CustomEvent(`wui-menubar:select`,{bubbles:!0,detail:{key:t.dataset.key??null,item:t,menu:i??null}}))}_handleMouseOver(e){let t=yc(e.target)?.closest(gc);if(!t||!this.contains(t)||bc(t))return;if(t.classList.contains(`wui-menubar-trigger`)){let e=t.parentElement;this._openMenu()&&this._openMenu()!==e&&(this._openTop(e,null),t.focus({preventScroll:!0}));return}t!==document.activeElement&&t.focus({preventScroll:!0});let n=t.parentElement.classList.contains(`wui-menubar-sub`)&&t.parentElement.children[0]===t?t.parentElement:null;if(n)n.children[1].hasAttribute(_c)||this._openSub(n,!1);else{let e=t.closest(`[role="menu"]`);for(let t of e.children)t.classList.contains(`wui-menubar-sub`)&&this._setSub(t,!1)}}_teardown(){this.close(),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`mouseover`,this._onMouseOver),this.removeEventListener(`focusin`,this._onFocusIn),this.removeEventListener(`focusout`,this._onFocusOut),document.removeEventListener(`pointerdown`,this._onPointerDown,!0)}},Sc={enter:`Enter`,comma:`,`,space:` `,tab:`Tab`},Cc={enter:`
334
- `,comma:`,`,space:` `,tab:` `},wc=e=>Sc[e],Tc=e=>Cc[e];function Ec(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 Dc=(e,t)=>t.some(t=>String(e??``).includes(t)),Oc=class extends l{static formAssociated=!0;_accessibleName(){return this.getAttribute(`aria-label`)||this.getAttribute(`placeholder`)||`Select`}static get observedAttributes(){return[`placeholder`,`search-placeholder`,`searchable`,`disabled`,`icon`,`size`,`collapse-chips`,`aria-label`,`aria-invalid`,`allow-custom`,`custom-pattern`,`custom-invalid-message`]}constructor(){super(),this._values=[],this._optionsProp=null,this._active=-1,this._typeahead=``,this._typeaheadTimer=null,this._customError=``;try{this._internals=this.attachInternals()}catch{this._internals=null}}connectedCallback(){if(!this._rendered){if(!this._valuesInit&&!this._optionsProp&&!this._values.length){let e=this.getAttribute(`value`);if(e!=null&&e!==``)this._values=e.split(`,`).map(e=>e.trim()).filter(Boolean);else{let e=[...this.querySelectorAll(`:scope > wui-option[selected]`)].map(e=>e.getAttribute(`value`)??e.textContent.trim());e.length&&(this._values=e.map(String))}}this._valuesInit=!0,this._defaultCaptured||=(this._defaultValues=this._values.slice(),!0),this.render();return}this._bindGlobal?.()}formResetCallback(){this.values=(this._defaultValues||[]).slice();let e=this.querySelector(`[data-input]`);e&&(e.value=``),this._setCustomError(``)}attributeChangedCallback(e){if(e===`aria-invalid`){this._syncInvalid();return}e===`custom-pattern`||e===`custom-invalid-message`||this._rendered&&this.render()}_syncInvalid(){let e=this.querySelector(`.search-select-control`);e&&(this.hasAttribute(`aria-invalid`)||this._customError?e.setAttribute(`aria-invalid`,`true`):e.removeAttribute(`aria-invalid`))}get values(){return this._values.slice()}set values(e){this._values=Array.isArray(e)?e.map(String):[],B(this,this._values),this._rendered&&(this._renderControl(),this._renderOptions(this._query()))}set options(e){if(this._optionsProp=Array.isArray(e)?e:null,this._rendered&&this._allowCustom){this._renderControl(),this._renderOptions(this._query());return}this.isConnected&&this.render()}get options(){return this._readOptions()}get validateCustom(){return this._validateCustom??null}set validateCustom(e){this._validateCustom=typeof e==`function`?e:null}get _allowCustom(){return this.hasAttribute(`allow-custom`)}_query(){let e=this.querySelector(this._allowCustom?`[data-input]`:`.search-select-input`);return e?e.value:``}_snapshotDeclared(){if(this._declared)return;let e=[...this.querySelectorAll(`:scope > wui-option`)];e.length&&(this._declared=e.map(e=>{let t={value:e.getAttribute(`value`)??e.textContent.trim(),label:e.innerHTML,icon:e.getAttribute(`icon`)||void 0,[fi]:!0,selected:e.hasAttribute(`selected`)};for(let[n,r]of Ac){let i=e.getAttribute(n);i&&(t[r]=i)}return e.hasAttribute(`disabled`)&&(t.disabled=!0),t}))}_readOptions(){return this._optionsProp?this._optionsProp:(this._snapshotDeclared(),this._declared||[])}_labelFor(e){let t=this._readOptions().find(t=>String(t.value)===String(e));return t?bi(t):vi(e)}_labelHtmlFor(e){let t=this._readOptions().find(t=>String(t.value)===String(e));return t?_i(t):V(e)}render(){this._snapshotDeclared();let e=this._allowCustom,t=this.hasAttribute(`searchable`)&&!e,n=this.getAttribute(`search-placeholder`)||`Search…`,r=this.getAttribute(`icon`),i=this.getAttribute(`size`),a=i===`sm`?` search-select-sm`:i===`lg`?` search-select-lg`:``;B(this,this._values),this.id||=`wui-multiselect-${Math.random().toString(36).slice(2,9)}`;let o=`${this.id}-listbox`;this._listboxId=o;let s=this.hasAttribute(`disabled`);if(e){let e=`${this.id}-custom-error`;this.innerHTML=`
333
+ </div>`,this._stage=this.querySelector(`.wui-crop-stage`),this._img=this.querySelector(`.wui-crop-img`),this._frame=this.querySelector(`.wui-crop-frame`),this._slider=this.querySelector(`.wui-crop-zoom`),this._tools=this.querySelector(`.wui-crop-tools`),this._previewBox=this.querySelector(`.wui-crop-previews`),this._live=this.querySelector(`[data-wui-crop-live]`),this._rendered=!0,this._tools.hidden=!this.rotatable,this._applyRound(),this._rebuildHandles(),this._renderPreviews(),this._wire(),this._observe(),this._loadImage()}_applyRound(){this._frame.classList.toggle(`wui-crop-frame--round`,this.round),this._previewBox.classList.toggle(`wui-crop-previews--round`,this.round)}_rebuildHandles(){for(let e of this._frame.querySelectorAll(`.wui-crop-handle`))e.remove();if(!this.aspect)for(let e of ns){let t=document.createElement(`button`);t.type=`button`,t.className=`wui-crop-handle wui-crop-handle--${e}`,t.dataset.handle=e,t.setAttribute(`aria-label`,`Resize ${_s[e]} corner`),this._frame.appendChild(t)}}_renderPreviews(){let e=cs(this.previews);this._previewBox.replaceChildren(),this._previewBox.hidden=e.length===0;for(let t of e){let e=document.createElement(`canvas`);e.className=`wui-crop-preview`,e.dataset.size=String(t),e.style.width=`${t}px`,e.style.height=`${t}px`,this._previewBox.appendChild(e)}this._schedulePreviews()}_loadImage(){this._rect=null,this._natural=null,this._source=null,this._rotation=0,this._drag=null,this._pinch=null,this._pointers.clear();let e=this.src;this._img.hidden=!e,this._frame.hidden=!0,e&&(this._img.onload=()=>{this._source={w:this._img.naturalWidth,h:this._img.naturalHeight},this._natural={...this._source},this._resetRect(),this.dispatchEvent(new Event(`load`))},this._img.onerror=()=>{this._frame.hidden=!0,this.dispatchEvent(new Event(`error`))},this._img.src=e)}_resetRect(){this._natural&&(this._base=Yo(this._natural.w,this._natural.h,this.aspect),this._rect={...this._base},this._frame.hidden=!1,this._paint())}_observe(){typeof ResizeObserver>`u`||this._resizeObserver||(this._resizeObserver=new ResizeObserver(()=>this._paint()),this._resizeObserver.observe(this._stage))}_view(){let e=this._stage.clientWidth||gs.w,t=this._stage.clientHeight||gs.h,n=Math.min(e/this._natural.w,t/this._natural.h),r=this._natural.w*n,i=this._natural.h*n;return{scale:n,left:(e-r)/2,top:(t-i)/2,iw:r,ih:i}}_paint(){if(!this._rect)return;let e=this._view(),t=this._rotation%180!=0,n=t?e.ih:e.iw,r=t?e.iw:e.ih;Object.assign(this._img.style,{left:`${e.left+(e.iw-n)/2}px`,top:`${e.top+(e.ih-r)/2}px`,width:`${n}px`,height:`${r}px`,transform:this._rotation?`rotate(${this._rotation}deg)`:``});let i=this._rect;Object.assign(this._frame.style,{left:`${e.left+i.x*e.scale}px`,top:`${e.top+i.y*e.scale}px`,width:`${i.w*e.scale}px`,height:`${i.h*e.scale}px`});let a=$o(i,this._base),o=es(i,this._base);this._slider.max=String(o),this._slider.value=String(Math.min(Math.max(a,1),o)),this._slider.setAttribute(`aria-valuetext`,`${Math.round(a*100)}%`),this._schedulePreviews()}_schedulePreviews(){if(!this._rect||this._previewBox.hidden||this._previewPending)return;this._previewPending=!0;let e=()=>{this._previewPending=!1,this._drawPreviews()};typeof requestAnimationFrame==`function`?requestAnimationFrame(e):e()}_drawPreviews(){if(!this._rect)return;let e=Xo(this._rect,this._natural.w,this._natural.h),t=typeof window<`u`&&window.devicePixelRatio||1;for(let n of this._previewBox.children){let r=Number(n.dataset.size),i=Math.max(1,Math.round(r*e.h/e.w));n.style.width=`${r}px`,n.style.height=`${i}px`,n.width=Math.round(r*t),n.height=Math.round(i*t);let a=n.getContext(`2d`);a&&this._drawCrop(a,e,n.width,n.height)}}_drawCrop(e,t,n,r){if(!this._rotation){e.drawImage(this._img,t.x,t.y,t.w,t.h,0,0,n,r);return}let i=this._source;e.save(),e.scale(n/t.w,r/t.h),e.translate(-t.x,-t.y),e.translate(this._natural.w/2,this._natural.h/2),e.rotate(this._rotation*Math.PI/180),e.drawImage(this._img,-i.w/2,-i.h/2,i.w,i.h),e.restore()}_announce(){this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,detail:this.rect}))}_say(){let e=this._rect,t=this._rotation?`, turned ${this._rotation} degrees`:``,n=`Frame ${Math.round(e.w)} by ${Math.round(e.h)} pixels, ${Math.round(e.x)} from the left, ${Math.round(e.y)} from the top, zoom ${Math.round($o(e,this._base)*100)}%${t}.`;this._live.textContent=n===this._live.textContent?`${n} `:n}rotate(){if(!this._rect)return;let e=ss(this._rect,this._natural.w,this._natural.h);this._rotation=(this._rotation+90)%360,this._natural=os(this._source.w,this._source.h,this._rotation),this._base=Yo(this._natural.w,this._natural.h,this.aspect);let t=this.aspect;this._rect=t&&t!==1?{...this._base}:e,this._paint(),this._announce()}reset(){this._source&&(this._rotation=0,this._natural={...this._source},this._resetRect(),this._announce())}_wire(){let e=this._stage;e.addEventListener(`pointerdown`,t=>{if(!this._rect||t.button>0)return;if(this._pointers.set(t.pointerId,{x:t.clientX,y:t.clientY}),e.setPointerCapture?.(t.pointerId),this._pointers.size===2){let[e,n]=[...this._pointers.values()];this._drag=null,this._pinch={distance:Ss(e,n)||1,zoom:this.zoom,done:!1},t.preventDefault();return}if(this._pinch)return;let n=t.target.closest?.(`.wui-crop-handle`);this._drag={id:t.pointerId,corner:n?n.dataset.handle:null,x:t.clientX,y:t.clientY,start:{...this._rect}},n||e.focus(),t.preventDefault()}),e.addEventListener(`pointermove`,t=>{if(this._pointers.has(t.pointerId)&&this._pointers.set(t.pointerId,{x:t.clientX,y:t.clientY}),this._pinch){if(this._pinch.done||this._pointers.size<2||!this._pointers.has(t.pointerId))return;let[e,n]=[...this._pointers.values()],r=this._pinch.zoom*Ss(e,n)/this._pinch.distance;this._rect=ts(this._rect,this._base,r,this._natural.w,this._natural.h),this._paint();return}let n=this._drag;if(!n||n.id!==t.pointerId)return;let r=this._view(),{w:i,h:a}=this._natural;if(n.corner){let o=e.getBoundingClientRect(),s=(t.clientX-o.left-e.clientLeft-r.left)/r.scale,c=(t.clientY-o.top-e.clientTop-r.top)/r.scale;this._rect=rs(this._rect,n.corner,s,c,i,a)}else this._rect=Zo(n.start,(t.clientX-n.x)/r.scale,(t.clientY-n.y)/r.scale,i,a);this._paint()});let t=t=>{if(this._pointers.delete(t.pointerId)&&e.releasePointerCapture?.(t.pointerId),this._pinch){!this._pinch.done&&this._pointers.size<2&&(this._pinch.done=!0,this._announce()),this._pointers.size===0&&(this._pinch=null);return}let n=this._drag;!n||n.id!==t.pointerId||(this._drag=null,this._announce())};e.addEventListener(`pointerup`,t),e.addEventListener(`pointercancel`,t),e.addEventListener(`keydown`,e=>this._onKey(e)),e.addEventListener(`wheel`,e=>{!this._rect||!this.contains(document.activeElement)||(e.preventDefault(),this.zoom*=e.deltaY<0?1.1:1/1.1)},{passive:!1});for(let e of[`input`,`change`])this._slider.addEventListener(e,e=>e.stopPropagation());this._slider.addEventListener(`input`,()=>{this.zoom=Number(this._slider.value)});for(let e of this.querySelectorAll(`.wui-crop-zoombtn`))e.addEventListener(`click`,()=>{this.zoom*=e.dataset.zoom===`in`?1.25:.8});this.querySelector(`[data-crop-action="rotate"]`).addEventListener(`click`,()=>this.rotate()),this.querySelector(`[data-crop-action="reset"]`).addEventListener(`click`,()=>this.reset())}_onKey(e){if(!this._rect||e.altKey||e.ctrlKey||e.metaKey)return;let{w:t,h:n}=this._natural;if(e.key===`+`||e.key===`=`)this.zoom*=1.25,this._say();else if(e.key===`-`||e.key===`_`)this.zoom*=.8,this._say();else if((e.key===`r`||e.key===`R`)&&this.rotatable)this.rotate(),this._say();else if(e.key.startsWith(`Arrow`)){let r=e.shiftKey?hs:ms,i=e.key===`ArrowRight`?1:e.key===`ArrowLeft`?-1:0,a=e.key===`ArrowDown`?1:e.key===`ArrowUp`?-1:0,o=e.target.closest?.(`.wui-crop-handle`)?.dataset.handle;if(o){let e=this._rect,s=(o.endsWith(`w`)?e.x:e.x+e.w)+i*r*e.w,c=(o.startsWith(`n`)?e.y:e.y+e.h)+a*r*e.h;this._rect=rs(e,o,s,c,t,n)}else this._rect=Zo(this._rect,i*r*this._rect.w,a*r*this._rect.h,t,n);this._paint(),this._announce(),this._say()}else return;e.preventDefault()}async toBlob({type:e,maxBytes:t=0,size:n=0}={}){if(!this._rect)return null;let r=ds(e),i=Xo(this._rect,this._natural.w,this._natural.h),{width:a,height:o}=n>0?as(i,n):is(i);return ps((e,t,n,r)=>new Promise(a=>{let o=document.createElement(`canvas`);o.width=e,o.height=t;let s=o.getContext(`2d`);if(!s){a(null);return}n===`image/jpeg`&&(s.fillStyle=`#fff`,s.fillRect(0,0,e,t)),this._drawCrop(s,i,e,t),o.toBlob(a,n,r)}),{width:a,height:o,type:r,maxBytes:t})}async toFile({name:e,type:t,maxBytes:n=0,size:r=0}={}){let i=await this.toBlob({type:t,maxBytes:n,size:r});return i?new File([i],fs(e,i.type),{type:i.type}):null}},ws=Object.freeze([`text`,`number`,`select`,`date`,`textarea`]),Ts=2e3,Es=Object.freeze({edit:e=>`Edit ${e}: `,readOnly:e=>`${e}: `,saved:e=>`${e} saved.`,notSaved:(e,t)=>`${e} was not saved. ${t}`,failed:Object.freeze({forbidden:`You do not have permission to change this.`,client:`This could not be saved. Refresh the page and try again.`,validation:`This value was not accepted. Check it and try again.`,server:`Something went wrong on our side, so this was not saved. Try again in a moment.`,network:`Could not reach the server, so this was not saved. Check your connection and try again.`})});function Ds(e,{type:t=`text`,options:n,placeholder:r}={}){let i=e==null?``:String(e);if(i===``)return{text:r||`-`,empty:!0};if(t===`date`)return{text:co(i)||i,empty:!1};if(t===`select`){let e=n?.find(e=>String(e.value)===i);return{text:typeof e?.label==`string`?e.label:i,empty:!1}}return{text:i,empty:!1}}var Os=`[data-wui-display]`,ks=`[data-wui-value]`,As=`[data-wui-editor]`,js=`[data-wui-control]`,Ms=`[data-wui-error]`,Ns=`[data-wui-live]`,Ps=`[aria-expanded="true"]`,Fs=new Set([`select`,`date`]),Is=e=>typeof e?.message==`string`&&e.message?e.message:Es.failed.server,Ls=class extends l{static get observedAttributes(){return[`disabled`]}constructor(){super(),this._wired=!1,this._editing=!1,this._busy=!1,this._draft=null,this._pressed=!1,this._popupOpen=!1,this._savedTimer=null,this._onClick=this._onClick.bind(this),this._onKeyCapture=this._onKeyCapture.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onFocusOut=this._onFocusOut.bind(this),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onChange=this._onChange.bind(this)}connectedCallback(){this._wired||(this._wired=!0,this.addEventListener(`click`,this._onClick),this.addEventListener(`auxclick`,this._onClick),this.addEventListener(`keydown`,this._onKeyCapture,!0),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`focusout`,this._onFocusOut),this.addEventListener(`pointerdown`,this._onPointerDown),this.addEventListener(`change`,this._onChange))}disconnectedCallback(){clearTimeout(this._savedTimer),this._savedTimer=null,this._releasePress()}attributeChangedCallback(e){e===`disabled`&&this.hasAttribute(`disabled`)&&this.cancel()}edit(){if(this._editing||this._busy||this.hasAttribute(`disabled`))return;let e=this.querySelector(Os),t=this.querySelector(As),n=this._control();!e||!t||!n||(this._editing=!0,this._setState(null),n.value=this._draft??this._value(),e.hidden=!0,t.hidden=!1,this.setAttribute(`data-wui-editing`,``),this._focusControl(n))}cancel(){this._editing&&(this._draft=null,this._setError(null),this.getAttribute(`data-wui-state`)===`error`&&this._setState(null),this._close())}_onClick(e){e.stopPropagation(),e.type===`click`&&!this._editing&&this.querySelector(Os)?.contains(e.target)&&this.edit()}_onKeyCapture(){this._popupOpen=!!(this._editing&&this.querySelector(As)?.querySelector(Ps))}_onKeyDown(e){if(!this._editing){(e.key===`Enter`||e.key===` `)&&e.stopPropagation();return}if(e.stopPropagation(),this._popupOpen)return;if(e.key===`Escape`){e.preventDefault(),this.cancel();return}let t=this._type();e.key!==`Enter`||Fs.has(t)||t===`textarea`&&!(e.ctrlKey||e.metaKey)||(e.preventDefault(),this._commit(this._control()?.value??``))}_onFocusOut(e){if(!this._editing||this._pressed)return;let t=e.relatedTarget;t&&this.contains(t)||document.hasFocus()&&this._commit(this._control()?.value??``)}_onPointerDown(){this._editing&&(this._pressed=!0,document.addEventListener(`pointerup`,this._onPointerUp,!0),document.addEventListener(`pointercancel`,this._onPointerUp,!0))}_onPointerUp(){this._releasePress(),setTimeout(()=>{this._pressed=!1,this._editing&&!this.contains(document.activeElement)&&document.hasFocus()&&this._commit(this._control()?.value??``)},0)}_releasePress(){document.removeEventListener(`pointerup`,this._onPointerUp,!0),document.removeEventListener(`pointercancel`,this._onPointerUp,!0)}_onChange(e){if(!this._editing||!Fs.has(this._type()))return;let t=this._control();!t||e.target!==t||queueMicrotask(()=>this._commit(t.value))}async _commit(e){if(!this._editing||this._busy)return;let t=this._value();if(e===t){this.cancel();return}let n=typeof this.validate==`function`?this.validate(e):null;if(n){this._setError(n),this._announce(n);return}let r=this.hasAttribute(`controlled`);this._draft=null,this._setError(null),this._busy=!0,this._setState(`saving`),this.setAttribute(`aria-busy`,`true`);let i=r?null:this._readShown();r||this._showValue(e),this._close();let a=await this._persist(e,r);this._busy=!1,this.removeAttribute(`aria-busy`);let o=this.getAttribute(`label`)||``;if(a.ok){this.setAttribute(`value`,e),!r&&a.text&&this._showText(a.text,!1),this._setState(`saved`),this._savedTimer=setTimeout(()=>this._setState(null),Ts),this._announce(Es.saved(o)),this._fire(`wui:inline-edit:saved`,{value:e,previous:t});return}if(i&&this._restoreShown(i),a.kind===`session`||a.kind===`aborted`){this._setState(null);return}this._draft=e,this._setState(`error`),this._setError(a.message),this._announce(Es.notSaved(o,a.message)),this._fire(`wui:inline-edit:failed`,{value:e,previous:t,kind:a.kind,message:a.message})}async _persist(e,t){if(t){if(typeof this.save!=`function`)return{ok:!0};try{return await this.save(e),{ok:!0}}catch(e){return{ok:!1,kind:`server`,message:Is(e)}}}let n=this.getAttribute(`action`);if(!n)return{ok:!0};let r=await P(n,{method:`POST`,body:new URLSearchParams({[this.getAttribute(`name`)||`value`]:e})});return r.ok?{ok:!0,text:r.html.trim()}:{ok:!1,kind:r.kind,message:r.message||Es.failed[r.kind]||Es.failed.server}}_close(){let e=this.querySelector(Os),t=this.querySelector(As),n=this.contains(document.activeElement);this._editing=!1,this.removeAttribute(`data-wui-editing`),t&&(t.hidden=!0),e&&(e.hidden=!1),t?.querySelector(Ps)?.click(),n&&e?.focus()}_focusControl(e){if(!Fs.has(this._type())){e.focus(),e.select?.();return}let t=e.querySelector(`button`);t&&(t.focus(),t.getAttribute(`aria-expanded`)!==`true`&&t.click())}_showValue(e){if(e===``){this._showText(this.getAttribute(`placeholder`)||`-`,!0);return}let t=this._type(),n=e;if(t===`date`)n=co(e)||e;else if(t===`select`){let t=[...this._control()?.querySelectorAll(`[data-value]`)??[]].find(t=>t.getAttribute(`data-value`)===e);t&&(n=t.textContent.trim())}this._showText(n,!1)}_readShown(){let e=this.querySelector(ks);return e?{html:e.innerHTML,empty:e.hasAttribute(`data-wui-empty`)}:null}_restoreShown(e){let t=this.querySelector(ks);t&&(t.innerHTML=e.html,t.toggleAttribute(`data-wui-empty`,e.empty))}_showText(e,t){let n=this.querySelector(ks);n&&(n.textContent=e,n.toggleAttribute(`data-wui-empty`,t))}_setError(e){let t=this.querySelector(Ms),n=this._control();t&&(t.textContent=e||``,t.hidden=!e),e?n?.setAttribute(`aria-invalid`,`true`):n?.removeAttribute(`aria-invalid`)}_setState(e){clearTimeout(this._savedTimer),this._savedTimer=null,e?this.setAttribute(`data-wui-state`,e):this.removeAttribute(`data-wui-state`)}_announce(e){let t=this.querySelector(Ns);!t||!e||(t.textContent=``,t.textContent=e)}_fire(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:t}))}_control(){return this.querySelector(js)}_value(){return this.getAttribute(`value`)??``}_type(){let e=this.getAttribute(`type`);return ws.includes(e)?e:`text`}},Rs=`a.wui-lightbox-item`,J=1,zs=4,Bs=.5,Vs=2,Hs=50,Us=6,Ws=300,Gs=300;function Ks(e){return Number.isFinite(e)?Math.min(zs,Math.max(J,e)):J}function qs(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 Js(e,t){return Math.abs(e)<Hs||Math.abs(e)<Math.abs(t)*1.5?0:e<0?1:-1}function Ys(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 Xs(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=j(e,{size:20}),r}var Zs=class extends l{constructor(){super(),this._ui=null,this._index=0,this._zoom=J,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?.closest?.(Rs);if(!t||!this.contains(t))return;let n=this._links().indexOf(t);n<0||(e.preventDefault(),this.open(n))}}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 isOpen(){return this._ui!==null}connectedCallback(){this.addEventListener(`click`,this._onClick)}disconnectedCallback(){this.removeEventListener(`click`,this._onClick),this._teardown()}_links(){return[...this.querySelectorAll(Rs)]}_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||Ys(t)}})}open(e=0){let t=this._items();return t.length?(this._ui||(this._returnTo=document.activeElement,this._build(),this.dispatchEvent(new CustomEvent(`wui-lightbox:open`,{bubbles:!0,detail:{index:e}}))),this._show(e,t),this._ui.close.focus(),!0):!1}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`),i=Xs(`zoom-out`,`Zoom out`,`wui-lightbox-zoom-out`),a=Xs(`zoom-in`,`Zoom in`,`wui-lightbox-zoom-in`),o=Y(`a`,`u-action wui-lightbox-btn wui-lightbox-download`,{"aria-label":`Download`,title:`Download`});o.style.setProperty(`--wui-action-size`,`40px`),o.innerHTML=j(`download`,{size:20}),o.hidden=!this.download;let s=Xs(`x`,`Close`,`wui-lightbox-close`);r.append(i,a,o,s),t.append(n,r);let c=Y(`div`,`wui-lightbox-stage`),l=Xs(`chevron-left`,`Previous image`,`wui-lightbox-nav wui-lightbox-prev`),u=Xs(`chevron-right`,`Next image`,`wui-lightbox-nav wui-lightbox-next`),d=Y(`img`,`wui-lightbox-image`,{decoding:`async`,draggable:`false`,alt:``}),f=Y(`p`,`wui-lightbox-status`,{role:`status`});c.append(d,f,l,u);let p=Y(`p`,`wui-lightbox-caption`);e.append(t,c,p);let m={root:e,count:n,zoomOut:i,zoomIn:a,download:o,close:s,stage:c,prev:l,next:u,image:d,status:f,caption:p};this._ui=m,s.addEventListener(`click`,()=>this.close()),l.addEventListener(`click`,()=>this.step(-1)),u.addEventListener(`click`,()=>this.step(1)),i.addEventListener(`click`,()=>this._setZoom(this._zoom-Bs)),a.addEventListener(`click`,()=>this._setZoom(this._zoom+Bs)),e.addEventListener(`keydown`,e=>this._onKeyDown(e)),c.addEventListener(`pointerdown`,e=>this._onPointerDown(e)),c.addEventListener(`pointermove`,e=>this._onPointerMove(e)),c.addEventListener(`pointerup`,e=>this._onPointerEnd(e,!0)),c.addEventListener(`pointercancel`,e=>this._onPointerEnd(e,!1)),c.addEventListener(`wheel`,e=>this._onWheel(e),{passive:!1}),d.addEventListener(`load`,()=>{this._ui===m&&(f.textContent=``,c.removeAttribute(`aria-busy`),d.hidden=!1,this._applyTransform())}),d.addEventListener(`error`,()=>{this._ui===m&&(c.removeAttribute(`aria-busy`),d.hidden=!0,f.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._ui,r=Math.min(t.length-1,Math.max(0,Math.trunc(Number(e))||0)),i=t[r],a=r!==this._index||!n.image.getAttribute(`src`);if(this._index=r,this._zoom=J,this._pan={x:0,y:0},n.count.textContent=`${k(r+1,{decimals:0})} of ${k(t.length,{decimals:0})}`,n.caption.textContent=i.caption,n.caption.hidden=!i.caption,n.download.href=i.src,n.download.setAttribute(`download`,i.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=i.alt||i.caption,n.image.src=i.src,this._applyTransform(),this._syncZoomButtons(),t.length>1)for(let e of[t[(r+1)%t.length],t[(r-1+t.length)%t.length]])new Image().src=e.src;a&&this.dispatchEvent(new CustomEvent(`wui-lightbox:change`,{bubbles:!0,detail:{index:r}}))}_syncZoomButtons(){this._ui.zoomOut.disabled=this._zoom<=J,this._ui.zoomIn.disabled=this._zoom>=zs;let e=document.activeElement;(e===this._ui.zoomOut||e===this._ui.zoomIn)&&e.disabled&&this._ui.close.focus()}_setZoom(e){this._ui&&(this._zoom=Ks(e),this._pan=this._clampedPan(this._pan),this._applyTransform(),this._syncZoomButtons())}_clampedPan(e){let{stage:t,image:n}=this._ui;return qs(e,this._zoom,{width:t.clientWidth,height:t.clientHeight},{width:n.offsetWidth,height:n.offsetHeight})}_applyTransform(){let{image:e,stage:t}=this._ui;e.style.transform=`translate(${this._pan.x}px, ${this._pan.y}px) scale(${this._zoom})`,t.classList.toggle(`wui-lightbox-zoomed`,this._zoom>J)}_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+Bs)):e.key===`-`?(e.preventDefault(),this._setZoom(this._zoom-Bs)):e.key===`0`&&(e.preventDefault(),this._setZoom(J))}_trapTab(e){let t=[...this._ui.root.querySelectorAll(`button, a[href]`)].filter(e=>!e.hidden&&!e.disabled);if(!t.length){e.preventDefault();return}let n=t[0],r=t[t.length-1],i=document.activeElement;e.shiftKey&&(i===n||!this._ui.root.contains(i))?(e.preventDefault(),r.focus()):!e.shiftKey&&(i===r||!this._ui.root.contains(i))&&(e.preventDefault(),n.focus())}_onWheel(e){e.preventDefault(),this._setZoom(this._zoom*(e.deltaY<0?1.15:1/1.15))}_onPointerDown(e){if(!e.target.closest(`.wui-lightbox-nav`))if(this._ui.stage.setPointerCapture?.(e.pointerId),this._pointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),this._pointers.size===2){let[e,t]=[...this._pointers.values()];this._gesture={kind:`pinch`,distance:Math.hypot(e.x-t.x,e.y-t.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===this._ui.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,n]=[...this._pointers.values()];this._setZoom(t.zoom*Math.hypot(e.x-n.x,e.y-n.y)/t.distance)}else if(t.kind===`drag`){let n=e.clientX-t.startX,r=e.clientY-t.startY;Math.hypot(n,r)>Us&&(t.moved=!0),this._zoom>J&&(this._pan=this._clampedPan({x:t.pan.x+n,y:t.pan.y+r}),this._ui.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;if(n.moved){this._zoom===J&&this.step(Js(r,i));return}if(!(e.timeStamp-n.startTime>Ws)){if(!n.onImage){this.close();return}e.timeStamp-this._lastTap<Gs?(this._lastTap=-1/0,this._setZoom(this._zoom>J?J:Vs)):this._lastTap=e.timeStamp}}},Qs=/^[A-Za-z0-9_.:-]{1,64}$/,$s=/@(\\+)\[|@\[([^[\]\n]{1,100})\]\(([A-Za-z0-9_.:-]{1,64})\)/g,ec=/@(\\*)\[/g;function tc(e){return String(e??``).replace(/[[\]\r\n]+/g,` `).replace(/\s+/g,` `).trim().slice(0,100)}var nc=e=>e.replace(ec,(e,t)=>`@\\${t}[`);function rc(e){let t=String(e??``),n=[],r=e=>{if(!e)return;let t=n[n.length-1];t&&`text`in t?t.text+=e:n.push({text:e})},i=0;for(let e of t.matchAll($s))r(t.slice(i,e.index)),e[1]===void 0?n.push({id:e[3],label:e[2]}):r(`@${e[1].slice(1)}[`),i=e.index+e[0].length;return r(t.slice(i)),n}function ic(e){let t=``,n=[];for(let r of rc(e)){if(`text`in r){t+=r.text;continue}let e=`@${r.label}`;n.push({start:t.length,end:t.length+e.length,id:r.id,label:r.label}),t+=e}return{text:t,mentions:n}}function ac(e,t=[]){let n=String(e??``),r=[...t].sort((e,t)=>e.start-t.start),i=``,a=0;for(let e of r)e.start<a||n.slice(e.start,e.end)!==`@${e.label}`||!Qs.test(e.id)||(i+=nc(n.slice(a,e.start)),i+=`@[${e.label}](${e.id})`,a=e.end);return i+nc(n.slice(a))}function oc(e){let t=[];for(let n of rc(e))`id`in n&&!t.includes(n.id)&&t.push(n.id);return t}var sc=8,cc=40,lc=Object.freeze({listName:`People`,searching:`Searching…`,noMatch:`No one matches`,found:e=>`${e===1?`1 person`:`${k(e,{decimals:0})} people`}. Up and down to choose, Enter to mention.`,mentioned:e=>`Mentioned ${e}.`}),uc=`[data-wui-control]`,dc=`[data-wui-field]`,fc=`[data-wui-menu]`,pc=`[data-wui-live]`,mc=0,hc=e=>e&&Qs.test(String(e.value??``))&&tc(e.label)!==``;function gc(e){let t=e.ownerDocument;e.id||=`wui-mention-${++mc}`;let n=t.createElement(`textarea`);n.id=`${e.id}-text`,n.className=`form-control textarea wui-mention-input-text`,n.rows=Number(e.getAttribute(`rows`))>0?Number(e.getAttribute(`rows`)):3,n.setAttribute(`data-wui-control`,``),n.setAttribute(`aria-autocomplete`,`list`),n.setAttribute(`aria-controls`,`${e.id}-people`);let r=e.getAttribute(`label`);r&&n.setAttribute(`aria-label`,r);let i=e.getAttribute(`placeholder`);i&&(n.placeholder=i);for(let t of[`aria-describedby`,`aria-invalid`]){let r=e.getAttribute(t);r&&n.setAttribute(t,r)}n.disabled=e.hasAttribute(`disabled`),e.appendChild(n);let a=e.getAttribute(`name`);if(a){let n=t.createElement(`input`);n.type=`hidden`,n.name=a,n.value=e.getAttribute(`value`)??``,n.setAttribute(`data-wui-field`,``),e.appendChild(n)}let o=t.createElement(`div`);o.className=`wui-mention-menu`,o.id=`${e.id}-people`,o.setAttribute(`role`,`listbox`),o.setAttribute(`aria-label`,lc.listName),o.setAttribute(`data-wui-menu`,``),o.hidden=!0,e.appendChild(o);let s=t.createElement(`span`);s.className=`visually-hidden`,s.setAttribute(`data-wui-live`,``),s.setAttribute(`aria-live`,`polite`),s.setAttribute(`aria-atomic`,`true`),e.appendChild(s)}var _c=class extends l{static get observedAttributes(){return[`disabled`,`aria-invalid`,`aria-describedby`]}constructor(){super(),this._wired=!1,this._text=``,this._mentions=[],this._peopleProp=null,this._declared=null,this._loading=!1,this._query=null,this._results=[],this._active=-1,this._timer=null,this._searchSeq=0,this._abort=null,this._onInput=this._onInput.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onCaret=this._onCaret.bind(this),this._onFocusOut=this._onFocusOut.bind(this),this._onMenuDown=e=>e.preventDefault(),this._onMenuClick=this._onMenuClick.bind(this),this._reposition=()=>{this._isOpen()&&this._position()}}connectedCallback(){for(let e of[`people`,`loading`,`value`])if(Object.hasOwn(this,e)){let t=this[e];delete this[e],this[e]=t}if(this._wired)return;this._wired=!0,this.querySelector(uc)||gc(this);let e=this._control(),t=this.querySelector(dc)?.value??this.getAttribute(`value`)??``;this._pendingValue===void 0?this._load(t):this._load(this._pendingValue),this._pendingValue=void 0,e.addEventListener(`input`,this._onInput),e.addEventListener(`keydown`,this._onKeyDown),e.addEventListener(`click`,this._onCaret),e.addEventListener(`keyup`,this._onCaret),this.addEventListener(`focusout`,this._onFocusOut);let n=this._menu();n.addEventListener(`mousedown`,this._onMenuDown),n.addEventListener(`click`,this._onMenuClick),n.addEventListener(`mousemove`,e=>{let t=e.target.closest?.(`.wui-mention-option`);t&&Number(t.dataset.index)!==this._active&&this._setActive(Number(t.dataset.index),{reveal:!1})})}disconnectedCallback(){this._close(),clearTimeout(this._timer),this._abort?.abort()}attributeChangedCallback(e,t,n){let r=this._control();r&&(e===`disabled`?(r.disabled=n!==null,n!==null&&this._close()):n===null?r.removeAttribute(e):r.setAttribute(e,n))}get value(){return ac(this._text,this._mentions)}set value(e){let t=e==null?``:String(e);if(!this._wired){this._pendingValue=t;return}t!==this.value&&this._load(t)}get mentions(){let e=new Set,t=[];for(let n of[...this._mentions].sort((e,t)=>e.start-t.start))e.has(n.id)||(e.add(n.id),t.push({id:n.id,label:n.label}));return t}get people(){return this._peopleProp?this._peopleProp:(this._declared||=[...this.querySelectorAll(`[data-wui-people] > wui-option`)].map(e=>({value:e.getAttribute(`value`)??``,label:e.textContent.trim(),description:e.getAttribute(`data-description`)||void 0,src:e.getAttribute(`data-src`)||void 0})),this._declared)}set people(e){this._peopleProp=Array.isArray(e)?e.filter(hc):[],(this._isOpen()||this._query!==null)&&this._refresh()}get loading(){return this._loading}set loading(e){this._loading=!!e,this._query!==null&&this._renderMenu()}focus(e){this._control()?.focus(e)}clear(){this._load(``),this._emit()}_control(){return this.querySelector(uc)}_menu(){return this.querySelector(fc)}_load(e){let{text:t,mentions:n}=ic(e);this._text=t,this._mentions=n;let r=this._control();r&&(r.defaultValue=t,r.value=t),this._syncField(),this._close()}_syncField(){let e=this.querySelector(dc);e&&(e.value=this.value)}_emit(){this._syncField(),this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,detail:{value:this.value,mentions:this.mentions}}))}_onInput(){let e=this._control(),t=e.value,n=this._text,r=t.length-n.length,i=Math.min(n.length,t.length),a=Math.max(0,Math.min(i,e.selectionEnd-Math.max(r,0))),o=0;for(;o<a&&n[o]===t[o];)o++;let s=0;for(;s<i-o&&n[n.length-1-s]===t[t.length-1-s];)s++;let c=n.length-s;this._mentions=this._mentions.filter(e=>e.end<=o||e.start>=c).map(e=>e.start>=c?{...e,start:e.start+r,end:e.end+r}:e),this._text=t,this._emit(),this._onCaret()}_onCaret(e){if(e?.type===`keyup`&&[`ArrowUp`,`ArrowDown`,`Enter`,`Tab`,`Escape`].includes(e.key))return;let t=this._queryAtCaret();if(!t){this._close();return}this._query&&t.text===this._query.text&&t.start===this._query.start||(this._query=t,this._refresh())}_queryAtCaret(){let e=this._control();if(!e||e.disabled||e.selectionStart!==e.selectionEnd)return null;let t=e.selectionStart,n=this._text,r=n.lastIndexOf(`@`,t-1);if(r<0||r>0&&!/[\s([{"'“‘]/.test(n[r-1]))return null;let i=n.slice(r+1,t);return i.length>40||/[\n@]/.test(i)||/^\s/.test(i)||/\s{2}/.test(i)||this._mentions.some(e=>r>=e.start&&r<e.end)?null:{start:r,end:t,text:i}}_refresh(){if(!this._query)return;let e=this.hasAttribute(`remote`)||this.hasAttribute(`source`);if(e&&this._query.text.length<this._minChars()){this._results=[],this._close();return}e&&!this._answered(this._query.text)&&this._search(this._query.text);let t=this._query.text.toLowerCase(),n=e?this.people:this.people.filter(e=>tc(e.label).toLowerCase().includes(t));this._results=n.slice(0,8),this._renderMenu()}_answered(e){return this._lastSearch===e}_minChars(){let e=this.getAttribute(`min-chars`),t=e==null||e===``?1:Number(e);return Number.isFinite(t)&&t>=0?t:1}_debounce(){let e=this.getAttribute(`debounce`),t=e==null||e===``?250:Number(e);return Number.isFinite(t)&&t>=0?t:250}_search(e){this._lastSearch=e,clearTimeout(this._timer);let t=++this._searchSeq;this._timer=setTimeout(()=>{let n=this.getAttribute(`source`);if(!n){this.dispatchEvent(new CustomEvent(`search`,{bubbles:!0,detail:{query:e,seq:t}}));return}this._fetchPeople(n,e,t)},this._debounce())}async _fetchPeople(e,t,n){this._abort?.abort();let r=new AbortController;this._abort=r,this.loading=!0;let i=await P(`${e}${e.includes(`?`)?`&`:`?`}q=${encodeURIComponent(t)}`,{signal:r.signal});if(n!==this._searchSeq)return;if(this._abort=null,!i.ok){this._peopleProp=[],this.loading=!1;return}let a=this.ownerDocument.createElement(`template`);a.innerHTML=i.html,this._peopleProp=[...a.content.querySelectorAll(`wui-option`)].map(e=>({value:e.getAttribute(`value`)??``,label:e.textContent.trim(),description:e.getAttribute(`data-description`)||void 0,src:e.getAttribute(`data-src`)||void 0})).filter(hc),this.loading=!1,this._refresh()}_isOpen(){let e=this._menu();return!!(e&&!e.hidden)}_renderMenu(){let e=this._menu(),t=this._control();if(!e||!t||!this._query)return;let n=this.ownerDocument;if(e.replaceChildren(),this._results.forEach((t,r)=>{let i=n.createElement(`div`);if(i.className=`wui-mention-option`,i.id=`${e.id}-${r}`,i.setAttribute(`role`,`option`),i.setAttribute(`aria-selected`,`false`),i.dataset.index=String(r),t.src){let e=n.createElement(`img`);e.className=`wui-mention-option-photo`,e.src=t.src,e.alt=``,i.appendChild(e)}let a=n.createElement(`span`);a.className=`wui-mention-option-text`;let o=n.createElement(`span`);if(o.className=`wui-mention-option-label`,o.textContent=tc(t.label),a.appendChild(o),t.description){let e=n.createElement(`span`);e.className=`wui-mention-option-description`,e.textContent=String(t.description),a.appendChild(e)}i.appendChild(a),e.appendChild(i)}),!this._results.length){let t=n.createElement(`div`);t.className=`wui-mention-empty`,t.textContent=this._loading?lc.searching:`${lc.noMatch} “${this._query.text}”`,e.appendChild(t)}let r=this._isOpen();e.hidden=!1,r||s(this,this._reposition),this._position(),this._setActive(this._results.length?0:-1),this._loading||this._announce(this._results.length?lc.found(this._results.length):`${lc.noMatch}.`)}_position(){o(this._control(),this._menu())}_close(){this._query=null,this._lastSearch=void 0,clearTimeout(this._timer);let e=this._menu();e&&!e.hidden&&(e.hidden=!0,e.replaceChildren()),this._active=-1,this._control()?.removeAttribute(`aria-activedescendant`),c(this)}_setActive(e,{reveal:t=!0}={}){let n=this._menu(),r=[...n.querySelectorAll(`.wui-mention-option`)];this._active=e>=0&&e<r.length?e:-1;let i=this._active>=0?r[this._active]:null;for(let e of r)e.setAttribute(`aria-selected`,e===i?`true`:`false`);di(n,i),i?(t&&i.scrollIntoView?.({block:`nearest`}),this._control().setAttribute(`aria-activedescendant`,i.id)):this._control().removeAttribute(`aria-activedescendant`)}_onKeyDown(e){if(this._isOpen()&&this._query){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=this._results.length;if(!t)return;let n=e.key===`ArrowDown`?1:-1;this._setActive((this._active+n+t)%t);return}if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey&&this._active>=0){e.preventDefault(),this._pick(this._results[this._active]);return}if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),this._close();return}}if(e.key===`Enter`&&(e.ctrlKey||e.metaKey)){e.preventDefault(),this.dispatchEvent(new CustomEvent(`wui:mention-input:submit`,{bubbles:!0,detail:{value:this.value}}));return}e.key===`Backspace`&&this._removeWholeMention(e)}_removeWholeMention(e){let t=this._control();if(t.selectionStart!==t.selectionEnd)return;let n=t.selectionStart,r=this._mentions.find(e=>e.end===n);r&&(e.preventDefault(),this._replace(r.start,r.end,``))}_onMenuClick(e){let t=e.target.closest?.(`.wui-mention-option`);t&&this._pick(this._results[Number(t.dataset.index)])}_pick(e){if(!e||!this._query)return;let t=tc(e.label),{start:n,end:r}=this._query,i=this._text.slice(r),a=`@${t}${/^\s/.test(i)?``:` `}`;this._replace(n,r,a,{id:String(e.value),label:t}),this._announce(lc.mentioned(t))}_replace(e,t,n,r){let i=this._control(),a=n.length-(t-e);this._mentions=this._mentions.filter(n=>n.end<=e||n.start>=t).map(e=>e.start>=t?{...e,start:e.start+a,end:e.end+a}:e),r&&this._mentions.push({start:e,end:e+1+r.label.length,id:r.id,label:r.label}),this._text=this._text.slice(0,e)+n+this._text.slice(t),i.value=this._text;let o=e+n.length;i.setSelectionRange(o,o),this._close(),i.focus(),this._emit()}_onFocusOut(e){e.relatedTarget&&this.contains(e.relatedTarget)||this._close()}_announce(e){let t=this.querySelector(pc);t&&(t.textContent=``,t.textContent=e)}},vc=`[role="menuitem"]`,yc=`data-open`,bc=4,xc=e=>e instanceof Element?e:e?.parentElement??null,Sc=e=>e.getAttribute(`aria-disabled`)===`true`,Cc=class extends l{constructor(){super(),this._navPanel=null,this._nav=ui({getVisibleOptions:()=>this._navPanel?this._rows(this._navPanel):[],getActive:()=>this._navPanel?this._rows(this._navPanel).indexOf(document.activeElement):-1,setActive:e=>this._rows(this._navPanel)[e]?.focus({preventScroll:!0})}),this._onKeyDown=e=>this._handleKeyDown(e),this._onClick=e=>this._handleClick(e),this._onMouseOver=e=>this._handleMouseOver(e),this._onFocusIn=e=>this._handleFocusIn(e),this._onFocusOut=e=>{let t=e.relatedTarget;this._openMenu()&&t instanceof Node&&!this.contains(t)&&this.close()},this._onPointerDown=e=>{this._openMenu()&&!this.contains(e.target)&&this.close()}}connectedCallback(){this._teardown(),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`click`,this._onClick),this.addEventListener(`mouseover`,this._onMouseOver),this.addEventListener(`focusin`,this._onFocusIn),this.addEventListener(`focusout`,this._onFocusOut),document.addEventListener(`pointerdown`,this._onPointerDown,!0)}disconnectedCallback(){this._teardown()}open(e,{focus:t=null}={}){let n=this._menus().find(t=>this._triggerOf(t).dataset.key===e);n&&this._openTop(n,t)}close(e=!1){let t=this._openMenu();if(t){for(let e of this._panelOf(t).querySelectorAll(`.wui-menubar-sub > [${yc}]`))this._setSub(e.parentElement,!1);this._setTop(t,!1),c(this),this._nav.teardown(),e&&this._triggerOf(t).focus({preventScroll:!0})}}_menus(){return[...this.children].filter(e=>e.classList.contains(`wui-menubar-menu`))}_triggerOf(e){return e.children[0]}_panelOf(e){return e.children[1]}_openMenu(){return this._menus().find(e=>this._panelOf(e)?.hasAttribute(yc))??null}_rows(e){let t=[];for(let n of e.children){let e=n.getAttribute(`role`)===`menuitem`?n:n.classList.contains(`wui-menubar-sub`)?n.children[0]:null;e&&!Sc(e)&&t.push(e)}return t}_setTop(e,t){this._panelOf(e).toggleAttribute(yc,t),this._triggerOf(e).setAttribute(`aria-expanded`,String(t))}_setSub(e,t){let n=e.children[1];if(!t)for(let e of n.querySelectorAll(`.wui-menubar-sub > [${yc}]`))this._setSub(e.parentElement,!1);n.toggleAttribute(yc,t),e.children[0].setAttribute(`aria-expanded`,String(t)),t?this._placeSub(n):(n.removeAttribute(`data-side`),n.style.removeProperty(`--wui-menubar-sub-offset`))}_openTop(e,t){let n=this._openMenu();n&&n!==e&&this.close();let r=this._triggerOf(e),i=this._panelOf(e);if(this._setTop(e,!0),o(r,i),s(this,()=>{let e=this._openMenu();e&&o(this._triggerOf(e),this._panelOf(e))}),t){let e=this._rows(i);(t===`last`?e[e.length-1]:e[0])?.focus({preventScroll:!0})}}_openSub(e,t){let n=e.parentElement;for(let t of n.children)t!==e&&t.classList.contains(`wui-menubar-sub`)&&this._setSub(t,!1);this._setSub(e,!0),t&&this._rows(e.children[1])[0]?.focus({preventScroll:!0})}_placeSub(e){e.removeAttribute(`data-side`),e.style.removeProperty(`--wui-menubar-sub-offset`),e.getBoundingClientRect().right>window.innerWidth-bc&&e.setAttribute(`data-side`,`start`);let t=e.getBoundingClientRect().bottom-(window.innerHeight-bc);t>0&&e.style.setProperty(`--wui-menubar-sub-offset`,`${-t}px`)}_handleFocusIn(e){let t=xc(e.target)?.closest(`.wui-menubar-trigger`);if(!(!t||!this.contains(t)))for(let e of this._menus())this._triggerOf(e).tabIndex=this._triggerOf(e)===t?0:-1}_handleKeyDown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=xc(e.target)?.closest(vc);!t||!this.contains(t)||(t.classList.contains(`wui-menubar-trigger`)?this._barKey(e,t):this._menuKey(e,t))}_barKey(e,t){let n=this._menus(),r=n.findIndex(e=>this._triggerOf(e)===t),i=this._openMenu()!==null,a=t=>{e.preventDefault(),i&&!Sc(this._triggerOf(t))?this._openTop(t,`first`):this._triggerOf(t).focus({preventScroll:!0})};e.key===`ArrowRight`?a(n[(r+1)%n.length]):e.key===`ArrowLeft`?a(n[(r-1+n.length)%n.length]):e.key===`Home`?a(n[0]):e.key===`End`?a(n[n.length-1]):(e.key===`ArrowDown`||e.key===`ArrowUp`)&&!Sc(t)?(e.preventDefault(),this._openTop(n[r],e.key===`ArrowDown`?`first`:`last`)):e.key===`Escape`&&i&&(e.preventDefault(),e.stopPropagation(),this.close(!0))}_menuKey(e,t){let n=t.closest(`[role="menu"]`);if(!n)return;let r=n.classList.contains(`wui-menubar-subpanel`),i=t.closest(`.wui-menubar-menu`),a=this._rows(n),o=a.indexOf(t);if(e.key===`ArrowDown`||e.key===`ArrowUp`)e.preventDefault(),a.length&&a[(o+(e.key===`ArrowDown`?1:-1)+a.length)%a.length].focus({preventScroll:!0});else if(e.key===`ArrowRight`)e.preventDefault(),t.hasAttribute(`aria-haspopup`)?this._openSub(t.parentElement,!0):this._adjacent(i,1);else if(e.key===`ArrowLeft`)if(e.preventDefault(),r){let e=n.parentElement;this._setSub(e,!1),e.children[0].focus({preventScroll:!0})}else this._adjacent(i,-1);else if(e.key===`Escape`)if(e.preventDefault(),e.stopPropagation(),r){let e=n.parentElement;this._setSub(e,!1),e.children[0].focus({preventScroll:!0})}else this.close(!0);else e.key===`Tab`?this.close(!0):e.key===` `?(e.preventDefault(),t.click()):(this._navPanel=n,this._nav.handler(e))}_adjacent(e,t){let n=this._menus(),r=n[(n.indexOf(e)+t+n.length)%n.length];r&&r!==e&&!Sc(this._triggerOf(r))&&this._openTop(r,`first`)}_handleClick(e){let t=xc(e.target)?.closest(vc);if(!t||!this.contains(t))return;let n=e.detail===0;if(t.classList.contains(`wui-menubar-trigger`)){if(Sc(t))return;let e=t.parentElement;this._openMenu()===e?this.close():this._openTop(e,n?`first`:null),(!n||!this._openMenu())&&t.focus({preventScroll:!0});return}if(Sc(t)){e.preventDefault(),e.stopPropagation();return}if(t.hasAttribute(`aria-haspopup`)){e.preventDefault(),this._openSub(t.parentElement,n);return}let r=t.closest(`.wui-menubar-menu`),i=r?this._triggerOf(r).dataset.key:void 0;this.close(!0),this.dispatchEvent(new CustomEvent(`wui-menubar:select`,{bubbles:!0,detail:{key:t.dataset.key??null,item:t,menu:i??null}}))}_handleMouseOver(e){let t=xc(e.target)?.closest(vc);if(!t||!this.contains(t)||Sc(t))return;if(t.classList.contains(`wui-menubar-trigger`)){let e=t.parentElement;this._openMenu()&&this._openMenu()!==e&&(this._openTop(e,null),t.focus({preventScroll:!0}));return}t!==document.activeElement&&t.focus({preventScroll:!0});let n=t.parentElement.classList.contains(`wui-menubar-sub`)&&t.parentElement.children[0]===t?t.parentElement:null;if(n)n.children[1].hasAttribute(yc)||this._openSub(n,!1);else{let e=t.closest(`[role="menu"]`);for(let t of e.children)t.classList.contains(`wui-menubar-sub`)&&this._setSub(t,!1)}}_teardown(){this.close(),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`mouseover`,this._onMouseOver),this.removeEventListener(`focusin`,this._onFocusIn),this.removeEventListener(`focusout`,this._onFocusOut),document.removeEventListener(`pointerdown`,this._onPointerDown,!0)}},wc={enter:`Enter`,comma:`,`,space:` `,tab:`Tab`},Tc={enter:`
334
+ `,comma:`,`,space:` `,tab:` `},Ec=e=>wc[e],Dc=e=>Tc[e];function Oc(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 kc=(e,t)=>t.some(t=>String(e??``).includes(t)),Ac=class extends l{static formAssociated=!0;_accessibleName(){return this.getAttribute(`aria-label`)||this.getAttribute(`placeholder`)||`Select`}static get observedAttributes(){return[`placeholder`,`search-placeholder`,`searchable`,`disabled`,`icon`,`size`,`collapse-chips`,`aria-label`,`aria-invalid`,`allow-custom`,`custom-pattern`,`custom-invalid-message`]}constructor(){super(),this._values=[],this._optionsProp=null,this._active=-1,this._typeahead=``,this._typeaheadTimer=null,this._customError=``;try{this._internals=this.attachInternals()}catch{this._internals=null}}connectedCallback(){if(!this._rendered){if(!this._valuesInit&&!this._optionsProp&&!this._values.length){let e=this.getAttribute(`value`);if(e!=null&&e!==``)this._values=e.split(`,`).map(e=>e.trim()).filter(Boolean);else{let e=[...this.querySelectorAll(`:scope > wui-option[selected]`)].map(e=>e.getAttribute(`value`)??e.textContent.trim());e.length&&(this._values=e.map(String))}}this._valuesInit=!0,this._defaultCaptured||=(this._defaultValues=this._values.slice(),!0),this.render();return}this._bindGlobal?.()}formResetCallback(){this.values=(this._defaultValues||[]).slice();let e=this.querySelector(`[data-input]`);e&&(e.value=``),this._setCustomError(``)}attributeChangedCallback(e){if(e===`aria-invalid`){this._syncInvalid();return}e===`custom-pattern`||e===`custom-invalid-message`||this._rendered&&this.render()}_syncInvalid(){let e=this.querySelector(`.search-select-control`);e&&(this.hasAttribute(`aria-invalid`)||this._customError?e.setAttribute(`aria-invalid`,`true`):e.removeAttribute(`aria-invalid`))}get values(){return this._values.slice()}set values(e){this._values=Array.isArray(e)?e.map(String):[],B(this,this._values),this._rendered&&(this._renderControl(),this._renderOptions(this._query()))}set options(e){if(this._optionsProp=Array.isArray(e)?e:null,this._rendered&&this._allowCustom){this._renderControl(),this._renderOptions(this._query());return}this.isConnected&&this.render()}get options(){return this._readOptions()}get validateCustom(){return this._validateCustom??null}set validateCustom(e){this._validateCustom=typeof e==`function`?e:null}get _allowCustom(){return this.hasAttribute(`allow-custom`)}_query(){let e=this.querySelector(this._allowCustom?`[data-input]`:`.search-select-input`);return e?e.value:``}_snapshotDeclared(){if(this._declared)return;let e=[...this.querySelectorAll(`:scope > wui-option`)];e.length&&(this._declared=e.map(e=>{let t={value:e.getAttribute(`value`)??e.textContent.trim(),label:e.innerHTML,icon:e.getAttribute(`icon`)||void 0,[fi]:!0,selected:e.hasAttribute(`selected`)};for(let[n,r]of Mc){let i=e.getAttribute(n);i&&(t[r]=i)}return e.hasAttribute(`disabled`)&&(t.disabled=!0),t}))}_readOptions(){return this._optionsProp?this._optionsProp:(this._snapshotDeclared(),this._declared||[])}_labelFor(e){let t=this._readOptions().find(t=>String(t.value)===String(e));return t?bi(t):vi(e)}_labelHtmlFor(e){let t=this._readOptions().find(t=>String(t.value)===String(e));return t?_i(t):V(e)}render(){this._snapshotDeclared();let e=this._allowCustom,t=this.hasAttribute(`searchable`)&&!e,n=this.getAttribute(`search-placeholder`)||`Search…`,r=this.getAttribute(`icon`),i=this.getAttribute(`size`),a=i===`sm`?` search-select-sm`:i===`lg`?` search-select-lg`:``;B(this,this._values),this.id||=`wui-multiselect-${Math.random().toString(36).slice(2,9)}`;let o=`${this.id}-listbox`;this._listboxId=o;let s=this.hasAttribute(`disabled`);if(e){let e=`${this.id}-custom-error`;this.innerHTML=`
335
335
  <div class="search-select${a}">
336
336
  <div class="input search-select-control search-select-multi"${this.hasAttribute(`aria-invalid`)?` aria-invalid="true"`:``}${s?` aria-disabled="true"`:``}>
337
337
  ${r?j(r,{className:`search-select-icon`}):``}
@@ -354,8 +354,8 @@ var WeborityUiElements=(function(e){Object.defineProperty(e,Symbol.toStringTag,{
354
354
  <div class="search-select-options"></div>
355
355
  <div class="search-select-empty" hidden>No matches</div>
356
356
  </div>
357
- </div>`;this._rendered=!0,this._customError=``,B(this,this._values),this._renderControl(),this._renderOptions(),this._wire()}_renderControl(){let e=this.querySelector(`[data-chips]`);if(!e)return;let t=this.getAttribute(`placeholder`)||`Select…`,n=this._allowCustom?e.querySelector(`[data-input]`):null,r=this._values.map(e=>`<span class="chip chip-sm"><span class="chip-label">${this._labelHtmlFor(e)}</span><button type="button" class="chip-remove" data-remove="${X(e)}" aria-label="Remove ${X(this._labelFor(e))}">${j(`x`)}</button></span>`).join(``);if(n){for(let t of[...e.querySelectorAll(`:scope > .chip`)])t.remove();n.insertAdjacentHTML(`beforebegin`,r),n.placeholder=this._values.length?``:t,this._collapseChips();return}if(!this._values.length){e.innerHTML=`<span class="search-select-placeholder">${V(t)}</span>`;return}e.innerHTML=r,this._collapseChips()}_collapseChips(){let e=this.querySelector(`[data-chips]`);if(!e||!this.hasAttribute(`collapse-chips`)||!this._values.length)return;e.querySelector(`.chip-more`)?.remove();let t=[...e.querySelectorAll(`:scope > .chip:not(.chip-more)`)];for(let e of t)e.style.display=``;if(!t.length)return;let n=e.clientWidth,r=e=>e.offsetLeft+e.offsetWidth;if(r(t[t.length-1])<=n)return;let i=document.createElement(`span`);i.className=`chip chip-sm chip-more`,i.textContent=`+${t.length}`,t[t.length-1].after(i);let a=i.offsetWidth+6,o=0;for(let e of t)if(r(e)<=n-a)o+=1;else break;o<1&&(o=1);for(let e=o;e<t.length;e+=1)t[e].style.display=`none`;i.textContent=`+${t.length-o}`}_matches(e,t){return bi(e).toLowerCase().includes(t)||String(e.description??``).toLowerCase().includes(t)}_optionNamed(e){let t=e.trim().toLowerCase();return this._readOptions().find(e=>String(e.value??``).toLowerCase()===t||bi(e).trim().toLowerCase()===t)}_renderOptions(e){let t=this.querySelector(`.search-select-options`),n=this.querySelector(`.search-select-empty`);if(!t)return;let r=(e||``).trim(),i=r.toLowerCase(),a=this._readOptions();i&&(a=a.filter(e=>this._matches(e,i)));let o=this._listboxId||`${this.id||`wui-multiselect`}-listbox`,s=this._allowCustom&&r&&!this._optionNamed(r),c=a.map((e,t)=>{let n=this._values.includes(String(e.value)),r=`${o}-opt-${t}`;return jc(e)?Pc(e,r,n):`<button type="button" role="option" id="${X(r)}" class="search-select-option${n?` selected`:``}" data-value="${X(e.value)}" aria-selected="${n}"><span class="ms-opt-label">${_i(e)}</span><span class="ms-check">${j(`check`)}</span></button>`});s&&c.push(`<button type="button" role="option" id="${X(`${o}-opt-${a.length}`)}" class="search-select-option search-select-option-custom" data-value="${X(r)}" data-custom="true" aria-selected="false">Add “${V(r)}”</button>`),t.innerHTML=c.join(``),n&&(n.hidden=a.length>0),this._active=-1,this._combobox()?.removeAttribute(`aria-activedescendant`),this._allowCustom&&this._syncCustomMenu?.(),this._reanchor?.()}_combobox(){return this._allowCustom?this.querySelector(`[data-input]`):this.querySelector(`.search-select-control`)}_setCustomError(e){this._customError=e||``;let t=this.querySelector(`.wui-ms-custom-error`),n=this.querySelector(`[data-input]`);t&&(t.textContent=this._customError,t.hidden=!this._customError),n&&(this._customError?n.setAttribute(`aria-invalid`,`true`):n.removeAttribute(`aria-invalid`)),this._syncInvalid()}_customRefusal(e){let t=this.getAttribute(`custom-invalid-message`)||`Enter a valid value.`,n=this.getAttribute(`custom-pattern`);if(n){let r=Ic(n);if(r&&!r.test(e))return t}let r=this._validateCustom;if(r){let n=r(e);return n===!0?``:typeof n==`string`&&n?n:t}return``}_commitTyped(e){let t=e.trim().replace(/,+$/,``).trim();if(!t)return``;let n=this._optionNamed(t),r;if(n){if(n.disabled)return n.disabledHint||this.getAttribute(`custom-invalid-message`)||`That option is not available.`;r=String(n.value)}else{let e=this._customRefusal(t);if(e)return e;r=t}let i=r.toLowerCase();return this._values.some(e=>e.toLowerCase()===i)||(this._values=[...this._values,r]),``}_wire(){this._teardown();let e=this.querySelector(`.search-select-control`),t=this.querySelector(`.search-select-menu`),n=this.querySelector(`.search-select-input`),r=this.querySelector(`.search-select-clear`),i=this.querySelector(`.search-select-options`),a=this._allowCustom,l=a?this.querySelector(`[data-input]`):null,u=l||e;if(!e||!t)return;let d=()=>this.hasAttribute(`disabled`),f=()=>o(e,t,{matchWidth:!0}),p=()=>[...this.querySelectorAll(`.search-select-option`)],m=()=>p().filter(e=>!e.hidden),h=(e,{reveal:t=!0}={})=>{let n=m();this._active=e,di(i,e>=0&&n[e]||null),e>=0&&n[e]?(t&&n[e].scrollIntoView({block:`nearest`}),u.setAttribute(`aria-activedescendant`,n[e].id)):u.removeAttribute(`aria-activedescendant`)},g=!1,_=()=>a?g:!t.hidden,v=()=>{let n=g&&p().length>0,r=t.hidden;t.hidden=!n,u.setAttribute(`aria-expanded`,String(n)),e.classList.toggle(`open`,n),n&&r&&f()};this._syncCustomMenu=a?v:null;let y=()=>{_()&&f()},b=()=>{if(!d()){if(s(this,y),a){g=!0,v();return}t.hidden=!1,e.setAttribute(`aria-expanded`,`true`),e.classList.add(`open`),f(),n&&(n.value=``,this._renderOptions(``),n.focus())}},x=()=>{a?(g=!1,v()):(t.hidden=!0,e.setAttribute(`aria-expanded`,`false`),e.classList.remove(`open`)),h(-1),clearTimeout(this._typeaheadTimer),this._typeaheadTimer=null,this._typeahead=``,c(this)},S=()=>{B(this,this._values),this.dispatchEvent(new Event(`change`,{bubbles:!0}))},ee=e=>{let t=String(e);if(this._values.includes(t))this._values=this._values.filter(e=>e!==t);else if(a&&this._values.some(e=>e.toLowerCase()===t.toLowerCase()))return;else this._values=[...this._values,t];this._renderControl(),this._renderOptions(this._query()),S()},te=e=>{this._values=this._values.filter(t=>t!==String(e)),this._renderControl(),this._renderOptions(this._query()),S()},C=(e,{quiet:t=!1}={})=>{let n=this._values.length,r=Dc(e,kc)?Ec(e,kc):[e],i=[],a=``;for(let e of r){let t=this._commitTyped(e);t&&(i.push(e.trim()),a||=t)}t&&i.length||(l.value=i.join(`, `),this._setCustomError(a),this._values.length!==n&&(this._renderControl(),S()),this._renderOptions(l.value))},w=e=>{if(!(!e||e.getAttribute(`aria-disabled`)===`true`)){if(e.dataset.custom===`true`){C(e.dataset.value);return}ee(e.dataset.value),l?.value&&(l.value=``,this._setCustomError(``),this._renderOptions(``))}};e.addEventListener(`click`,e=>{if(d())return;let t=e.target.closest(`[data-remove]`);if(t){e.stopPropagation(),te(t.dataset.remove),l?.focus();return}if(l){let t=_();e.target!==l&&l.focus(),e.target===l||!t?b():x();return}_()?x():b()}),i.addEventListener(`click`,e=>{let t=e.target.closest(`.search-select-option`);t&&(w(t),(l||n)?.focus())}),i.addEventListener(`mousemove`,e=>{let t=e.target.closest(`.search-select-option`);t&&!t.classList.contains(`is-active`)&&h(m().indexOf(t),{reveal:!1})}),i.addEventListener(`mouseleave`,()=>h(-1)),i.addEventListener(`error`,e=>{e.target?.classList?.contains(`avatar-img`)&&e.target.remove()},!0),n?.addEventListener(`input`,()=>{this._renderOptions(n.value),r&&(r.hidden=!n.value),h(-1)}),this._navHandler=ui({getVisibleOptions:m,getActive:()=>this._active,setActive:e=>h(e),onEnter:e=>{e?w(e):l?.value.trim()&&C(l.value)},onEscape:()=>{this._navHandler.clearTypeahead(),x(),l||e.focus()}});let T=e=>{let t=l||n;if(e.key===`Backspace`&&!t?.value&&this._values.length){te(this._values[this._values.length-1]);return}e.key===`Escape`&&_()&&(e.preventDefault(),e.stopPropagation()),this._navHandler.handler(e)};if(n?.addEventListener(`keydown`,T),r?.addEventListener(`click`,()=>{n.value=``,this._renderOptions(``),r.hidden=!0,n.focus()}),l){let t=e=>{e.target!==l&&e.preventDefault()};i.addEventListener(`mousedown`,t),e.addEventListener(`mousedown`,t),ai(),l.addEventListener(`focus`,()=>{oi()&&b()}),l.addEventListener(`input`,()=>{this._customError&&this._setCustomError(``),this._renderOptions(l.value),b()}),l.addEventListener(`keydown`,e=>{if(e.key===`,`&&l.value.trim()){e.preventDefault(),C(l.value);return}if(e.key===`Enter`){if(this._active<0&&!l.value.trim())return;this._navHandler.handler(e);return}(e.key===`ArrowDown`||e.key===`ArrowUp`)&&!_()&&b(),T(e)}),l.addEventListener(`paste`,e=>{let t=e.clipboardData?.getData(`text/plain`)??``;Dc(t,kc)&&(e.preventDefault(),C(`${l.value}${t}`))}),l.addEventListener(`blur`,e=>{e.relatedTarget&&this.contains(e.relatedTarget)||(l.value.trim()&&C(l.value,{quiet:!0}),x())})}else e.addEventListener(`keydown`,e=>{if(_()){T(e);return}(e.key===`ArrowDown`||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),b())});this._bindGlobal=()=>{this._teardown(),!this._ro&&typeof ResizeObserver<`u`&&(this._ro=new ResizeObserver(()=>this._collapseChips()),this._ro.observe(this)),this._onDocClick=e=>{_()&&!this.contains(e.target)&&x()},document.addEventListener(`click`,this._onDocClick),_()&&s(this,y)},this._bindGlobal()}_teardown(){this._onDocClick&&=(document.removeEventListener(`click`,this._onDocClick),null),c(this),this._navHandler?.teardown()}disconnectedCallback(){this._teardown(),this._ro?.disconnect(),this._ro=null}},kc=[`,`,`;`,`
358
- `,` `],Ac=[[`description`,`description`],[`avatar`,`avatar`],[`initials`,`initials`],[`disabled-hint`,`disabledHint`]],jc=e=>!!(e.description||e.avatar||e.initials||e.disabled||e.disabledHint),Mc=e=>{let t=String(e??``).trim();return/^(https?:)?\/\//i.test(t)||/^\/(?!\/)/.test(t)||/^data:image\/(png|jpe?g|gif|webp|avif);/i.test(t)?t:``},Nc=e=>{let t=Mc(e.avatar);return!t&&!e.initials?``:`<span class="avatar wui-opt-avatar" aria-hidden="true"><span class="avatar-face">${V(e.initials??``)}</span>${t?`<img class="avatar-img" src="${X(t)}" alt="" />`:``}</span>`},Pc=(e,t,n)=>{let r=!!e.disabled,i=e.description?`<span class="wui-opt-desc">${V(e.description)}</span>`:``,a=e.disabledHint&&r?`<span class="wui-opt-hint">${V(e.disabledHint)}</span>`:``;return`<button type="button" role="option" id="${X(t)}" class="search-select-option wui-opt-rich${n?` selected`:``}" data-value="${X(e.value)}" aria-selected="${n}"${r?` aria-disabled="true"`:``}><span class="ms-opt-label"><span class="wui-opt-name">${_i(e)}</span>${i}</span>${a}${Nc(e)}<span class="ms-check">${j(`check`)}</span></button>`},Fc=new Map,Ic=e=>{if(Fc.has(e))return Fc.get(e);let t=null;try{t=RegExp(`^(?:${e})$`,`u`)}catch{console.warn(`<wui-multiselect> custom-pattern is not a valid regular expression and is ignored: ${e}`)}return Fc.set(e,t),t},X=e=>String(e??``).replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`),Lc=`data-open`,Rc=8,zc=`.wui-nav-menu-link`,Bc=e=>e instanceof Element?e:e?.parentElement??null,Vc=class extends l{constructor(){super(),this._onClick=e=>this._handleClick(e),this._onKeyDown=e=>this._handleKeyDown(e),this._onFocusOut=e=>{let t=this._openItem(),n=e.relatedTarget;t&&n instanceof Node&&!t.contains(n)&&this._set(t,!1)},this._onPointerDown=e=>{let t=this._openItem();t&&!t.contains(e.target)&&this._set(t,!1)},this._onResize=()=>{let e=this._openItem();e&&this._align(e.children[1])}}connectedCallback(){this._teardown(),this.addEventListener(`click`,this._onClick),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`focusout`,this._onFocusOut),document.addEventListener(`pointerdown`,this._onPointerDown,!0)}disconnectedCallback(){this._teardown()}open(e){let t=this._items().find(t=>this._isTrigger(t.children[0])&&t.children[0].dataset.key===e);t&&this._set(t,!0)}close(e=!1){let t=this._openItem();t&&(this._set(t,!1),e&&t.children[0].focus({preventScroll:!0}))}_items(){return[...this.querySelectorAll(`.wui-nav-menu-item`)]}_openItem(){return this._items().find(e=>e.children[1]?.hasAttribute(Lc))??null}_isTrigger(e){return!!e?.classList.contains(`wui-nav-menu-trigger`)}_entries(){return this._items().map(e=>e.children[0])}_links(e){return[...e.children[1]?.querySelectorAll(zc)??[]]}_set(e,t){let n=e.children[0],r=e.children[1];if(r){if(t){let t=this._openItem();t&&t!==e&&this._set(t,!1)}r.hasAttribute(Lc)!==t&&(r.toggleAttribute(Lc,t),n.setAttribute(`aria-expanded`,String(t)),t?(this._align(r),window.addEventListener(`resize`,this._onResize)):(r.removeAttribute(`data-align`),this._openItem()||window.removeEventListener(`resize`,this._onResize)),this.dispatchEvent(new CustomEvent(`wui-navigation-menu:toggle`,{bubbles:!0,detail:{key:n.dataset.key??null,open:t}})))}}_align(e){e.removeAttribute(`data-align`),e.getBoundingClientRect().right>window.innerWidth-Rc&&e.setAttribute(`data-align`,`end`)}_handleClick(e){let t=Bc(e.target),n=t?.closest(`.wui-nav-menu-trigger`);if(n&&this.contains(n)){let e=n.parentElement;this._set(e,!e.children[1].hasAttribute(Lc));return}let r=t?.closest(zc);r&&this.contains(r)&&this.close()}_handleKeyDown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=Bc(e.target)?.closest(`.wui-nav-menu-trigger, .wui-nav-menu-toplink, .wui-nav-menu-link`);if(!t||!this.contains(t))return;let n=this._openItem();if(e.key===`Escape`){if(!n)return;e.preventDefault(),e.stopPropagation();let r=n.contains(t);this._set(n,!1),r&&n.children[0].focus({preventScroll:!0});return}if(t.matches(zc)){this._linkKey(e,t);return}let r=this._entries(),i=r.indexOf(t);if(e.key===`ArrowRight`||e.key===`ArrowLeft`||e.key===`Home`||e.key===`End`){e.preventDefault();let t=e.key===`Home`?0:e.key===`End`?r.length-1:(i+(e.key===`ArrowRight`?1:-1)+r.length)%r.length;n&&this._set(n,!1),r[t].focus({preventScroll:!0})}else if(e.key===`ArrowDown`&&this._isTrigger(t)){e.preventDefault();let n=t.parentElement;this._set(n,!0),this._links(n)[0]?.focus({preventScroll:!0})}}_linkKey(e,t){let n=t.closest(`.wui-nav-menu-item`),r=this._links(n),i=r.indexOf(t);e.key===`ArrowDown`||e.key===`ArrowUp`?(e.preventDefault(),r[(i+(e.key===`ArrowDown`?1:-1)+r.length)%r.length].focus({preventScroll:!0})):e.key===`Home`?(e.preventDefault(),r[0].focus({preventScroll:!0})):e.key===`End`&&(e.preventDefault(),r[r.length-1].focus({preventScroll:!0}))}_teardown(){let e=this._openItem();e&&this._set(e,!1),window.removeEventListener(`resize`,this._onResize),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`focusout`,this._onFocusOut),document.removeEventListener(`pointerdown`,this._onPointerDown,!0)}},Hc=99,Uc=1440*60*1e3,Wc=Object.freeze({label:`Notifications`,empty:`You are all caught up.`,markAll:`Mark all read`,viewAll:`View all`,unreadPrefix:`Unread: `,today:`Today`,yesterday:`Yesterday`,allRead:`All notifications marked as read.`,noneUnread:`No unread notifications`,failed:Object.freeze({forbidden:`You do not have permission to mark these as read.`,client:`These could not be marked as read. Refresh the page and try again.`,validation:`These could not be marked as read. Refresh the page and try again.`,server:`Something went wrong on our side, so these were not marked as read. Try again in a moment.`,network:`Could not reach the server, so these were not marked as read. Check your connection and try again.`})});function Gc(e){return e>99?`99+`:String(e)}function Kc(e,t){return t===0?e:`${e}, ${Gc(t)} unread`}function qc(e){return e===0?Wc.noneUnread:`${Gc(e)} unread notifications`}function Jc(e){return ze(e,{pattern:`time`})}function Yc(e,t=Date.now()){let n=ze(e);return n===ze(t)?Wc.today:n===ze(Le(t)-Uc)?Wc.yesterday:n}function Xc(e,t=Date.now()){let n=new Map;for(let r of e){if(!Number.isFinite(Le(r.at)))throw Error(`<AppNotificationCenter> item "${r.id}": at must be an ISO date-time with its zone (or a YYYY-MM-DD day), got ${String(r.at)}.`);let e=ze(r.at);n.has(e)||n.set(e,{key:e,heading:Yc(r.at,t),items:[]}),n.get(e).items.push(r)}return[...n.values()]}var Zc=`.wui-notification-center-trigger`,Qc=`.wui-notification-center-panel`,$c=`.wui-notification-center-count`,el=`.wui-notification-center-live`,tl=`.wui-notification-center-markall`,nl=`.wui-notification-center-item`,rl=`wui-notification-center-item-read`,il=`.wui-notification-center-unread-label`,al=class extends l{constructor(){super(),this._doc=null,this._unread=0,this._busy=!1,this._onClick=e=>this._click(e),this._onKeyDown=e=>this._key(e),this._onOutside=e=>{this.contains(e.target)||this.close()},this._onFocusOut=e=>{let t=e.relatedTarget;t instanceof Node&&!this.contains(t)&&this.close()}}connectedCallback(){this._doc=this.ownerDocument,this._unread=this._initialUnread(),this.addEventListener(`click`,this._onClick),this.addEventListener(`keydown`,this._onKeyDown),this._doc.addEventListener(`mousedown`,this._onOutside),this.addEventListener(`focusout`,this._onFocusOut),this._syncOpen()}disconnectedCallback(){this.removeEventListener(`click`,this._onClick),this.removeEventListener(`keydown`,this._onKeyDown),this._doc?.removeEventListener(`mousedown`,this._onOutside),this.removeEventListener(`focusout`,this._onFocusOut),this._doc=null}get isOpen(){return this.hasAttribute(`open`)}open(){this.isOpen||(this.setAttribute(`open`,``),this._syncOpen(),this.querySelector(Qc)?.focus(),this._announceToggle())}close({restoreFocus:e=!1}={}){this.isOpen&&(this.removeAttribute(`open`),this._syncOpen(),e&&this.querySelector(Zc)?.focus(),this._announceToggle())}toggle(){this.isOpen?this.close():this.open()}_announceToggle(){this.dispatchEvent(new CustomEvent(`wui:notification-center:toggle`,{bubbles:!0,detail:{open:this.isOpen}}))}_syncOpen(){this.querySelector(Zc)?.setAttribute(`aria-expanded`,this.isOpen?`true`:`false`)}_initialUnread(){let e=Number.parseInt(this.getAttribute(`unread`)??``,10);return Number.isInteger(e)&&e>=0?e:this.querySelectorAll(`${nl}:not(.${rl})`).length}_click(e){let t=e.target.closest?.(`${Zc}, ${tl}, ${nl}`);if(!(!t||!this.contains(t))){if(t.matches(Zc)){this.toggle();return}this.hasAttribute(`controlled`)||(t.matches(tl)?this._markAll():this._markItem(t))}}_key(e){if(e.key===`Escape`&&this.isOpen){e.preventDefault(),e.stopPropagation(),this.close({restoreFocus:!0});return}if(!this.isOpen||!this.querySelector(Qc)?.contains(e.target))return;let t={ArrowDown:1,ArrowUp:-1,Home:`first`,End:`last`}[e.key];if(t===void 0)return;let n=[...this.querySelectorAll(nl)];if(n.length===0)return;let r=n.indexOf(e.target.closest(nl)),i;i=t===`first`?0:t===`last`?n.length-1:r===-1?t===1?0:n.length-1:Math.min(n.length-1,Math.max(0,r+t)),e.preventDefault(),n[i].focus()}_markItem(e){e.classList.contains(rl)||(this._applyRead(e),this._unread=Math.max(0,this._unread-1),this._render(),this._say(qc(this._unread)),this._emitRead([e.dataset.id].filter(Boolean),!1))}async _markAll(){if(this._busy)return;let e=[...this.querySelectorAll(`${nl}:not(.${rl})`)];if(e.length===0&&this._unread===0)return;let t=e.map(e=>e.dataset.id).filter(Boolean),n=this.getAttribute(`read-action`);if(n){this._setBusy(!0);let e=new URLSearchParams;for(let n of t)e.append(`ids`,n);let r=await P(n,{method:`POST`,body:e});if(this._setBusy(!1),!r.ok){if(r.kind===`session`||r.kind===`aborted`)return;let e=r.message||Wc.failed[r.kind]||Wc.failed.server;this._say(e),this.dispatchEvent(new CustomEvent(`wui:notification-center:failed`,{bubbles:!0,detail:{kind:r.kind,message:e}}));return}}for(let t of e)this._applyRead(t);this._unread=0,this._render(),this._say(Wc.allRead),this._emitRead(t,!0)}_applyRead(e){e.classList.add(rl),e.querySelector(il)?.remove()}_setBusy(e){this._busy=e;let t=this.querySelector(tl);t&&(t.disabled=e||this._unread===0,e?t.setAttribute(`aria-busy`,`true`):t.removeAttribute(`aria-busy`))}_render(){let e=this.querySelector($c);e&&(e.textContent=Gc(this._unread),e.hidden=this._unread===0),this.querySelector(Zc)?.setAttribute(`aria-label`,Kc(this.getAttribute(`label`)||Wc.label,this._unread));let t=this.querySelector(tl);t&&(t.disabled=this._unread===0)}_say(e){let t=this.querySelector(el);t&&(t.textContent=e)}_emitRead(e,t){this.dispatchEvent(new CustomEvent(`wui:notification-center:read`,{bubbles:!0,detail:{ids:e,all:t}}))}},ol=`.wui-onboarding-card`,sl=`.wui-onboarding-steps`,cl=`.wui-onboarding-toggle`,ll=`.wui-onboarding-dismiss`,ul=`.wui-onboarding-restore`,dl=`wui-onboarding:`,fl=class extends l{constructor(){super(),this._onClick=e=>{let t=e.target instanceof Element?e.target:null;t&&(t.closest(ll)?this.dismiss():t.closest(ul)?this.restore():t.closest(cl)&&this.toggle())}}connectedCallback(){this.addEventListener(`click`,this._onClick),this._stored()===`dismissed`&&this._setDismissed(!0)}disconnectedCallback(){this.removeEventListener(`click`,this._onClick)}get dismissed(){return this.querySelector(ol)?.hidden===!0}get collapsed(){return this.querySelector(sl)?.hidden===!0}dismiss(){this.dismissed||(this._setDismissed(!0),this._store(`dismissed`),this.querySelector(ul)?.focus(),this.dispatchEvent(new CustomEvent(`wui:onboarding:dismiss`,{bubbles:!0})))}restore(){this.dismissed&&(this._setDismissed(!1),this._store(null),this.querySelector(cl)?.focus(),this.dispatchEvent(new CustomEvent(`wui:onboarding:restore`,{bubbles:!0})))}toggle(){let e=this.querySelector(sl);if(!e)return;let t=!e.hidden;e.hidden=t,this.querySelector(cl)?.setAttribute(`aria-expanded`,String(!t)),this.dispatchEvent(new CustomEvent(`wui:onboarding:collapse`,{bubbles:!0,detail:{collapsed:t}}))}_setDismissed(e){let t=this.querySelector(ol),n=this.querySelector(ul);t&&(t.hidden=e),n&&(n.hidden=!e)}_key(){let e=this.getAttribute(`storage-key`);return e?dl+e:null}_stored(){let e=this._key();if(!e)return null;try{return window.localStorage.getItem(e)}catch{return null}}_store(e){let t=this._key();if(t)try{e?window.localStorage.setItem(t,e):window.localStorage.removeItem(t)}catch{}}},pl=/[^0-9]/g,ml=/[^0-9a-zA-Z]/g,hl=class extends l{static formAssociated=!0;static get observedAttributes(){return[`value`,`length`,`mode`,`disabled`,`aria-label`]}get length(){let e=Number.parseInt(this.getAttribute(`length`)??`6`,10);return Number.isFinite(e)&&e>0?e:6}set length(e){this.setAttribute(`length`,String(e))}get mode(){return this.getAttribute(`mode`)===`alphanumeric`?`alphanumeric`:`numeric`}set mode(e){this.setAttribute(`mode`,String(e??`numeric`))}get value(){return this._value??``}set value(e){this._value=this._clean(e),z(this,this._value),this._paint()}_clean(e){return(e==null?``:String(e)).replace(this.mode===`alphanumeric`?ml:pl,``).slice(0,this.length)}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}}connectedCallback(){this._rendered?this._onSelectionChange&&document.addEventListener(`selectionchange`,this._onSelectionChange):(this._defaultCaptured||=(this._defaultValue=this._value,!0),this.render())}formResetCallback(){this._value=this._defaultValue||``,z(this,this._value),this._paint()}attributeChangedCallback(e,t,n){this._rendered&&(e===`value`?(this._value=this._clean(n),z(this,this._value),this._paint()):this.render())}render(){this._value=this._clean(this.getAttribute(`value`)??this._value);let e=this.length,t=this.mode===`numeric`,n=this.hasAttribute(`disabled`),r=Array.from({length:e},()=>`<span class="otp-slot" aria-hidden="true"></span>`).join(``),i=this.getAttribute(`aria-label`),a=i?` aria-label="${i.replace(/"/g,`&quot;`)}"`:``;this.innerHTML=`
357
+ </div>`;this._rendered=!0,this._customError=``,B(this,this._values),this._renderControl(),this._renderOptions(),this._wire()}_renderControl(){let e=this.querySelector(`[data-chips]`);if(!e)return;let t=this.getAttribute(`placeholder`)||`Select…`,n=this._allowCustom?e.querySelector(`[data-input]`):null,r=this._values.map(e=>`<span class="chip chip-sm"><span class="chip-label">${this._labelHtmlFor(e)}</span><button type="button" class="chip-remove" data-remove="${X(e)}" aria-label="Remove ${X(this._labelFor(e))}">${j(`x`)}</button></span>`).join(``);if(n){for(let t of[...e.querySelectorAll(`:scope > .chip`)])t.remove();n.insertAdjacentHTML(`beforebegin`,r),n.placeholder=this._values.length?``:t,this._collapseChips();return}if(!this._values.length){e.innerHTML=`<span class="search-select-placeholder">${V(t)}</span>`;return}e.innerHTML=r,this._collapseChips()}_collapseChips(){let e=this.querySelector(`[data-chips]`);if(!e||!this.hasAttribute(`collapse-chips`)||!this._values.length)return;e.querySelector(`.chip-more`)?.remove();let t=[...e.querySelectorAll(`:scope > .chip:not(.chip-more)`)];for(let e of t)e.style.display=``;if(!t.length)return;let n=e.clientWidth,r=e=>e.offsetLeft+e.offsetWidth;if(r(t[t.length-1])<=n)return;let i=document.createElement(`span`);i.className=`chip chip-sm chip-more`,i.textContent=`+${t.length}`,t[t.length-1].after(i);let a=i.offsetWidth+6,o=0;for(let e of t)if(r(e)<=n-a)o+=1;else break;o<1&&(o=1);for(let e=o;e<t.length;e+=1)t[e].style.display=`none`;i.textContent=`+${t.length-o}`}_matches(e,t){return bi(e).toLowerCase().includes(t)||String(e.description??``).toLowerCase().includes(t)}_optionNamed(e){let t=e.trim().toLowerCase();return this._readOptions().find(e=>String(e.value??``).toLowerCase()===t||bi(e).trim().toLowerCase()===t)}_renderOptions(e){let t=this.querySelector(`.search-select-options`),n=this.querySelector(`.search-select-empty`);if(!t)return;let r=(e||``).trim(),i=r.toLowerCase(),a=this._readOptions();i&&(a=a.filter(e=>this._matches(e,i)));let o=this._listboxId||`${this.id||`wui-multiselect`}-listbox`,s=this._allowCustom&&r&&!this._optionNamed(r),c=a.map((e,t)=>{let n=this._values.includes(String(e.value)),r=`${o}-opt-${t}`;return Nc(e)?Ic(e,r,n):`<button type="button" role="option" id="${X(r)}" class="search-select-option${n?` selected`:``}" data-value="${X(e.value)}" aria-selected="${n}"><span class="ms-opt-label">${_i(e)}</span><span class="ms-check">${j(`check`)}</span></button>`});s&&c.push(`<button type="button" role="option" id="${X(`${o}-opt-${a.length}`)}" class="search-select-option search-select-option-custom" data-value="${X(r)}" data-custom="true" aria-selected="false">Add “${V(r)}”</button>`),t.innerHTML=c.join(``),n&&(n.hidden=a.length>0),this._active=-1,this._combobox()?.removeAttribute(`aria-activedescendant`),this._allowCustom&&this._syncCustomMenu?.(),this._reanchor?.()}_combobox(){return this._allowCustom?this.querySelector(`[data-input]`):this.querySelector(`.search-select-control`)}_setCustomError(e){this._customError=e||``;let t=this.querySelector(`.wui-ms-custom-error`),n=this.querySelector(`[data-input]`);t&&(t.textContent=this._customError,t.hidden=!this._customError),n&&(this._customError?n.setAttribute(`aria-invalid`,`true`):n.removeAttribute(`aria-invalid`)),this._syncInvalid()}_customRefusal(e){let t=this.getAttribute(`custom-invalid-message`)||`Enter a valid value.`,n=this.getAttribute(`custom-pattern`);if(n){let r=Rc(n);if(r&&!r.test(e))return t}let r=this._validateCustom;if(r){let n=r(e);return n===!0?``:typeof n==`string`&&n?n:t}return``}_commitTyped(e){let t=e.trim().replace(/,+$/,``).trim();if(!t)return``;let n=this._optionNamed(t),r;if(n){if(n.disabled)return n.disabledHint||this.getAttribute(`custom-invalid-message`)||`That option is not available.`;r=String(n.value)}else{let e=this._customRefusal(t);if(e)return e;r=t}let i=r.toLowerCase();return this._values.some(e=>e.toLowerCase()===i)||(this._values=[...this._values,r]),``}_wire(){this._teardown();let e=this.querySelector(`.search-select-control`),t=this.querySelector(`.search-select-menu`),n=this.querySelector(`.search-select-input`),r=this.querySelector(`.search-select-clear`),i=this.querySelector(`.search-select-options`),a=this._allowCustom,l=a?this.querySelector(`[data-input]`):null,u=l||e;if(!e||!t)return;let d=()=>this.hasAttribute(`disabled`),f=()=>o(e,t,{matchWidth:!0}),p=()=>[...this.querySelectorAll(`.search-select-option`)],m=()=>p().filter(e=>!e.hidden),h=(e,{reveal:t=!0}={})=>{let n=m();this._active=e,di(i,e>=0&&n[e]||null),e>=0&&n[e]?(t&&n[e].scrollIntoView({block:`nearest`}),u.setAttribute(`aria-activedescendant`,n[e].id)):u.removeAttribute(`aria-activedescendant`)},g=!1,_=()=>a?g:!t.hidden,v=()=>{let n=g&&p().length>0,r=t.hidden;t.hidden=!n,u.setAttribute(`aria-expanded`,String(n)),e.classList.toggle(`open`,n),n&&r&&f()};this._syncCustomMenu=a?v:null;let y=()=>{_()&&f()},b=()=>{if(!d()){if(s(this,y),a){g=!0,v();return}t.hidden=!1,e.setAttribute(`aria-expanded`,`true`),e.classList.add(`open`),f(),n&&(n.value=``,this._renderOptions(``),n.focus())}},x=()=>{a?(g=!1,v()):(t.hidden=!0,e.setAttribute(`aria-expanded`,`false`),e.classList.remove(`open`)),h(-1),clearTimeout(this._typeaheadTimer),this._typeaheadTimer=null,this._typeahead=``,c(this)},S=()=>{B(this,this._values),this.dispatchEvent(new Event(`change`,{bubbles:!0}))},ee=e=>{let t=String(e);if(this._values.includes(t))this._values=this._values.filter(e=>e!==t);else if(a&&this._values.some(e=>e.toLowerCase()===t.toLowerCase()))return;else this._values=[...this._values,t];this._renderControl(),this._renderOptions(this._query()),S()},te=e=>{this._values=this._values.filter(t=>t!==String(e)),this._renderControl(),this._renderOptions(this._query()),S()},C=(e,{quiet:t=!1}={})=>{let n=this._values.length,r=kc(e,jc)?Oc(e,jc):[e],i=[],a=``;for(let e of r){let t=this._commitTyped(e);t&&(i.push(e.trim()),a||=t)}t&&i.length||(l.value=i.join(`, `),this._setCustomError(a),this._values.length!==n&&(this._renderControl(),S()),this._renderOptions(l.value))},w=e=>{if(!(!e||e.getAttribute(`aria-disabled`)===`true`)){if(e.dataset.custom===`true`){C(e.dataset.value);return}ee(e.dataset.value),l?.value&&(l.value=``,this._setCustomError(``),this._renderOptions(``))}};e.addEventListener(`click`,e=>{if(d())return;let t=e.target.closest(`[data-remove]`);if(t){e.stopPropagation(),te(t.dataset.remove),l?.focus();return}if(l){let t=_();e.target!==l&&l.focus(),e.target===l||!t?b():x();return}_()?x():b()}),i.addEventListener(`click`,e=>{let t=e.target.closest(`.search-select-option`);t&&(w(t),(l||n)?.focus())}),i.addEventListener(`mousemove`,e=>{let t=e.target.closest(`.search-select-option`);t&&!t.classList.contains(`is-active`)&&h(m().indexOf(t),{reveal:!1})}),i.addEventListener(`mouseleave`,()=>h(-1)),i.addEventListener(`error`,e=>{e.target?.classList?.contains(`avatar-img`)&&e.target.remove()},!0),n?.addEventListener(`input`,()=>{this._renderOptions(n.value),r&&(r.hidden=!n.value),h(-1)}),this._navHandler=ui({getVisibleOptions:m,getActive:()=>this._active,setActive:e=>h(e),onEnter:e=>{e?w(e):l?.value.trim()&&C(l.value)},onEscape:()=>{this._navHandler.clearTypeahead(),x(),l||e.focus()}});let T=e=>{let t=l||n;if(e.key===`Backspace`&&!t?.value&&this._values.length){te(this._values[this._values.length-1]);return}e.key===`Escape`&&_()&&(e.preventDefault(),e.stopPropagation()),this._navHandler.handler(e)};if(n?.addEventListener(`keydown`,T),r?.addEventListener(`click`,()=>{n.value=``,this._renderOptions(``),r.hidden=!0,n.focus()}),l){let t=e=>{e.target!==l&&e.preventDefault()};i.addEventListener(`mousedown`,t),e.addEventListener(`mousedown`,t),ai(),l.addEventListener(`focus`,()=>{oi()&&b()}),l.addEventListener(`input`,()=>{this._customError&&this._setCustomError(``),this._renderOptions(l.value),b()}),l.addEventListener(`keydown`,e=>{if(e.key===`,`&&l.value.trim()){e.preventDefault(),C(l.value);return}if(e.key===`Enter`){if(this._active<0&&!l.value.trim())return;this._navHandler.handler(e);return}(e.key===`ArrowDown`||e.key===`ArrowUp`)&&!_()&&b(),T(e)}),l.addEventListener(`paste`,e=>{let t=e.clipboardData?.getData(`text/plain`)??``;kc(t,jc)&&(e.preventDefault(),C(`${l.value}${t}`))}),l.addEventListener(`blur`,e=>{e.relatedTarget&&this.contains(e.relatedTarget)||(l.value.trim()&&C(l.value,{quiet:!0}),x())})}else e.addEventListener(`keydown`,e=>{if(_()){T(e);return}(e.key===`ArrowDown`||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),b())});this._bindGlobal=()=>{this._teardown(),!this._ro&&typeof ResizeObserver<`u`&&(this._ro=new ResizeObserver(()=>this._collapseChips()),this._ro.observe(this)),this._onDocClick=e=>{_()&&!this.contains(e.target)&&x()},document.addEventListener(`click`,this._onDocClick),_()&&s(this,y)},this._bindGlobal()}_teardown(){this._onDocClick&&=(document.removeEventListener(`click`,this._onDocClick),null),c(this),this._navHandler?.teardown()}disconnectedCallback(){this._teardown(),this._ro?.disconnect(),this._ro=null}},jc=[`,`,`;`,`
358
+ `,` `],Mc=[[`description`,`description`],[`avatar`,`avatar`],[`initials`,`initials`],[`disabled-hint`,`disabledHint`]],Nc=e=>!!(e.description||e.avatar||e.initials||e.disabled||e.disabledHint),Pc=e=>{let t=String(e??``).trim();return/^(https?:)?\/\//i.test(t)||/^\/(?!\/)/.test(t)||/^data:image\/(png|jpe?g|gif|webp|avif);/i.test(t)?t:``},Fc=e=>{let t=Pc(e.avatar);return!t&&!e.initials?``:`<span class="avatar wui-opt-avatar" aria-hidden="true"><span class="avatar-face">${V(e.initials??``)}</span>${t?`<img class="avatar-img" src="${X(t)}" alt="" />`:``}</span>`},Ic=(e,t,n)=>{let r=!!e.disabled,i=e.description?`<span class="wui-opt-desc">${V(e.description)}</span>`:``,a=e.disabledHint&&r?`<span class="wui-opt-hint">${V(e.disabledHint)}</span>`:``;return`<button type="button" role="option" id="${X(t)}" class="search-select-option wui-opt-rich${n?` selected`:``}" data-value="${X(e.value)}" aria-selected="${n}"${r?` aria-disabled="true"`:``}><span class="ms-opt-label"><span class="wui-opt-name">${_i(e)}</span>${i}</span>${a}${Fc(e)}<span class="ms-check">${j(`check`)}</span></button>`},Lc=new Map,Rc=e=>{if(Lc.has(e))return Lc.get(e);let t=null;try{t=RegExp(`^(?:${e})$`,`u`)}catch{console.warn(`<wui-multiselect> custom-pattern is not a valid regular expression and is ignored: ${e}`)}return Lc.set(e,t),t},X=e=>String(e??``).replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`),zc=`data-open`,Bc=8,Vc=`.wui-nav-menu-link`,Hc=e=>e instanceof Element?e:e?.parentElement??null,Uc=class extends l{constructor(){super(),this._onClick=e=>this._handleClick(e),this._onKeyDown=e=>this._handleKeyDown(e),this._onFocusOut=e=>{let t=this._openItem(),n=e.relatedTarget;t&&n instanceof Node&&!t.contains(n)&&this._set(t,!1)},this._onPointerDown=e=>{let t=this._openItem();t&&!t.contains(e.target)&&this._set(t,!1)},this._onResize=()=>{let e=this._openItem();e&&this._align(e.children[1])}}connectedCallback(){this._teardown(),this.addEventListener(`click`,this._onClick),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`focusout`,this._onFocusOut),document.addEventListener(`pointerdown`,this._onPointerDown,!0)}disconnectedCallback(){this._teardown()}open(e){let t=this._items().find(t=>this._isTrigger(t.children[0])&&t.children[0].dataset.key===e);t&&this._set(t,!0)}close(e=!1){let t=this._openItem();t&&(this._set(t,!1),e&&t.children[0].focus({preventScroll:!0}))}_items(){return[...this.querySelectorAll(`.wui-nav-menu-item`)]}_openItem(){return this._items().find(e=>e.children[1]?.hasAttribute(zc))??null}_isTrigger(e){return!!e?.classList.contains(`wui-nav-menu-trigger`)}_entries(){return this._items().map(e=>e.children[0])}_links(e){return[...e.children[1]?.querySelectorAll(Vc)??[]]}_set(e,t){let n=e.children[0],r=e.children[1];if(r){if(t){let t=this._openItem();t&&t!==e&&this._set(t,!1)}r.hasAttribute(zc)!==t&&(r.toggleAttribute(zc,t),n.setAttribute(`aria-expanded`,String(t)),t?(this._align(r),window.addEventListener(`resize`,this._onResize)):(r.removeAttribute(`data-align`),this._openItem()||window.removeEventListener(`resize`,this._onResize)),this.dispatchEvent(new CustomEvent(`wui-navigation-menu:toggle`,{bubbles:!0,detail:{key:n.dataset.key??null,open:t}})))}}_align(e){e.removeAttribute(`data-align`),e.getBoundingClientRect().right>window.innerWidth-Bc&&e.setAttribute(`data-align`,`end`)}_handleClick(e){let t=Hc(e.target),n=t?.closest(`.wui-nav-menu-trigger`);if(n&&this.contains(n)){let e=n.parentElement;this._set(e,!e.children[1].hasAttribute(zc));return}let r=t?.closest(Vc);r&&this.contains(r)&&this.close()}_handleKeyDown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=Hc(e.target)?.closest(`.wui-nav-menu-trigger, .wui-nav-menu-toplink, .wui-nav-menu-link`);if(!t||!this.contains(t))return;let n=this._openItem();if(e.key===`Escape`){if(!n)return;e.preventDefault(),e.stopPropagation();let r=n.contains(t);this._set(n,!1),r&&n.children[0].focus({preventScroll:!0});return}if(t.matches(Vc)){this._linkKey(e,t);return}let r=this._entries(),i=r.indexOf(t);if(e.key===`ArrowRight`||e.key===`ArrowLeft`||e.key===`Home`||e.key===`End`){e.preventDefault();let t=e.key===`Home`?0:e.key===`End`?r.length-1:(i+(e.key===`ArrowRight`?1:-1)+r.length)%r.length;n&&this._set(n,!1),r[t].focus({preventScroll:!0})}else if(e.key===`ArrowDown`&&this._isTrigger(t)){e.preventDefault();let n=t.parentElement;this._set(n,!0),this._links(n)[0]?.focus({preventScroll:!0})}}_linkKey(e,t){let n=t.closest(`.wui-nav-menu-item`),r=this._links(n),i=r.indexOf(t);e.key===`ArrowDown`||e.key===`ArrowUp`?(e.preventDefault(),r[(i+(e.key===`ArrowDown`?1:-1)+r.length)%r.length].focus({preventScroll:!0})):e.key===`Home`?(e.preventDefault(),r[0].focus({preventScroll:!0})):e.key===`End`&&(e.preventDefault(),r[r.length-1].focus({preventScroll:!0}))}_teardown(){let e=this._openItem();e&&this._set(e,!1),window.removeEventListener(`resize`,this._onResize),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`focusout`,this._onFocusOut),document.removeEventListener(`pointerdown`,this._onPointerDown,!0)}},Wc=99,Gc=1440*60*1e3,Kc=Object.freeze({label:`Notifications`,empty:`You are all caught up.`,markAll:`Mark all read`,viewAll:`View all`,unreadPrefix:`Unread: `,today:`Today`,yesterday:`Yesterday`,allRead:`All notifications marked as read.`,noneUnread:`No unread notifications`,failed:Object.freeze({forbidden:`You do not have permission to mark these as read.`,client:`These could not be marked as read. Refresh the page and try again.`,validation:`These could not be marked as read. Refresh the page and try again.`,server:`Something went wrong on our side, so these were not marked as read. Try again in a moment.`,network:`Could not reach the server, so these were not marked as read. Check your connection and try again.`})});function qc(e){return e>99?`99+`:String(e)}function Jc(e,t){return t===0?e:`${e}, ${qc(t)} unread`}function Yc(e){return e===0?Kc.noneUnread:`${qc(e)} unread notifications`}function Xc(e){return ze(e,{pattern:`time`})}function Zc(e,t=Date.now()){let n=ze(e);return n===ze(t)?Kc.today:n===ze(Le(t)-Gc)?Kc.yesterday:n}function Qc(e,t=Date.now()){let n=new Map;for(let r of e){if(!Number.isFinite(Le(r.at)))throw Error(`<AppNotificationCenter> item "${r.id}": at must be an ISO date-time with its zone (or a YYYY-MM-DD day), got ${String(r.at)}.`);let e=ze(r.at);n.has(e)||n.set(e,{key:e,heading:Zc(r.at,t),items:[]}),n.get(e).items.push(r)}return[...n.values()]}var $c=`.wui-notification-center-trigger`,el=`.wui-notification-center-panel`,tl=`.wui-notification-center-count`,nl=`.wui-notification-center-live`,rl=`.wui-notification-center-markall`,il=`.wui-notification-center-item`,al=`wui-notification-center-item-read`,ol=`.wui-notification-center-unread-label`,sl=class extends l{constructor(){super(),this._doc=null,this._unread=0,this._busy=!1,this._onClick=e=>this._click(e),this._onKeyDown=e=>this._key(e),this._onOutside=e=>{this.contains(e.target)||this.close()},this._onFocusOut=e=>{let t=e.relatedTarget;t instanceof Node&&!this.contains(t)&&this.close()}}connectedCallback(){this._doc=this.ownerDocument,this._unread=this._initialUnread(),this.addEventListener(`click`,this._onClick),this.addEventListener(`keydown`,this._onKeyDown),this._doc.addEventListener(`mousedown`,this._onOutside),this.addEventListener(`focusout`,this._onFocusOut),this._syncOpen()}disconnectedCallback(){this.removeEventListener(`click`,this._onClick),this.removeEventListener(`keydown`,this._onKeyDown),this._doc?.removeEventListener(`mousedown`,this._onOutside),this.removeEventListener(`focusout`,this._onFocusOut),this._doc=null}get isOpen(){return this.hasAttribute(`open`)}open(){this.isOpen||(this.setAttribute(`open`,``),this._syncOpen(),this.querySelector(el)?.focus(),this._announceToggle())}close({restoreFocus:e=!1}={}){this.isOpen&&(this.removeAttribute(`open`),this._syncOpen(),e&&this.querySelector($c)?.focus(),this._announceToggle())}toggle(){this.isOpen?this.close():this.open()}_announceToggle(){this.dispatchEvent(new CustomEvent(`wui:notification-center:toggle`,{bubbles:!0,detail:{open:this.isOpen}}))}_syncOpen(){this.querySelector($c)?.setAttribute(`aria-expanded`,this.isOpen?`true`:`false`)}_initialUnread(){let e=Number.parseInt(this.getAttribute(`unread`)??``,10);return Number.isInteger(e)&&e>=0?e:this.querySelectorAll(`${il}:not(.${al})`).length}_click(e){let t=e.target.closest?.(`${$c}, ${rl}, ${il}`);if(!(!t||!this.contains(t))){if(t.matches($c)){this.toggle();return}this.hasAttribute(`controlled`)||(t.matches(rl)?this._markAll():this._markItem(t))}}_key(e){if(e.key===`Escape`&&this.isOpen){e.preventDefault(),e.stopPropagation(),this.close({restoreFocus:!0});return}if(!this.isOpen||!this.querySelector(el)?.contains(e.target))return;let t={ArrowDown:1,ArrowUp:-1,Home:`first`,End:`last`}[e.key];if(t===void 0)return;let n=[...this.querySelectorAll(il)];if(n.length===0)return;let r=n.indexOf(e.target.closest(il)),i;i=t===`first`?0:t===`last`?n.length-1:r===-1?t===1?0:n.length-1:Math.min(n.length-1,Math.max(0,r+t)),e.preventDefault(),n[i].focus()}_markItem(e){e.classList.contains(al)||(this._applyRead(e),this._unread=Math.max(0,this._unread-1),this._render(),this._say(Yc(this._unread)),this._emitRead([e.dataset.id].filter(Boolean),!1))}async _markAll(){if(this._busy)return;let e=[...this.querySelectorAll(`${il}:not(.${al})`)];if(e.length===0&&this._unread===0)return;let t=e.map(e=>e.dataset.id).filter(Boolean),n=this.getAttribute(`read-action`);if(n){this._setBusy(!0);let e=new URLSearchParams;for(let n of t)e.append(`ids`,n);let r=await P(n,{method:`POST`,body:e});if(this._setBusy(!1),!r.ok){if(r.kind===`session`||r.kind===`aborted`)return;let e=r.message||Kc.failed[r.kind]||Kc.failed.server;this._say(e),this.dispatchEvent(new CustomEvent(`wui:notification-center:failed`,{bubbles:!0,detail:{kind:r.kind,message:e}}));return}}for(let t of e)this._applyRead(t);this._unread=0,this._render(),this._say(Kc.allRead),this._emitRead(t,!0)}_applyRead(e){e.classList.add(al),e.querySelector(ol)?.remove()}_setBusy(e){this._busy=e;let t=this.querySelector(rl);t&&(t.disabled=e||this._unread===0,e?t.setAttribute(`aria-busy`,`true`):t.removeAttribute(`aria-busy`))}_render(){let e=this.querySelector(tl);e&&(e.textContent=qc(this._unread),e.hidden=this._unread===0),this.querySelector($c)?.setAttribute(`aria-label`,Jc(this.getAttribute(`label`)||Kc.label,this._unread));let t=this.querySelector(rl);t&&(t.disabled=this._unread===0)}_say(e){let t=this.querySelector(nl);t&&(t.textContent=e)}_emitRead(e,t){this.dispatchEvent(new CustomEvent(`wui:notification-center:read`,{bubbles:!0,detail:{ids:e,all:t}}))}},cl=`.wui-onboarding-card`,ll=`.wui-onboarding-steps`,ul=`.wui-onboarding-toggle`,dl=`.wui-onboarding-dismiss`,fl=`.wui-onboarding-restore`,pl=`wui-onboarding:`,ml=class extends l{constructor(){super(),this._onClick=e=>{let t=e.target instanceof Element?e.target:null;t&&(t.closest(dl)?this.dismiss():t.closest(fl)?this.restore():t.closest(ul)&&this.toggle())}}connectedCallback(){this.addEventListener(`click`,this._onClick),this._stored()===`dismissed`&&this._setDismissed(!0)}disconnectedCallback(){this.removeEventListener(`click`,this._onClick)}get dismissed(){return this.querySelector(cl)?.hidden===!0}get collapsed(){return this.querySelector(ll)?.hidden===!0}dismiss(){this.dismissed||(this._setDismissed(!0),this._store(`dismissed`),this.querySelector(fl)?.focus(),this.dispatchEvent(new CustomEvent(`wui:onboarding:dismiss`,{bubbles:!0})))}restore(){this.dismissed&&(this._setDismissed(!1),this._store(null),this.querySelector(ul)?.focus(),this.dispatchEvent(new CustomEvent(`wui:onboarding:restore`,{bubbles:!0})))}toggle(){let e=this.querySelector(ll);if(!e)return;let t=!e.hidden;e.hidden=t,this.querySelector(ul)?.setAttribute(`aria-expanded`,String(!t)),this.dispatchEvent(new CustomEvent(`wui:onboarding:collapse`,{bubbles:!0,detail:{collapsed:t}}))}_setDismissed(e){let t=this.querySelector(cl),n=this.querySelector(fl);t&&(t.hidden=e),n&&(n.hidden=!e)}_key(){let e=this.getAttribute(`storage-key`);return e?pl+e:null}_stored(){let e=this._key();if(!e)return null;try{return window.localStorage.getItem(e)}catch{return null}}_store(e){let t=this._key();if(t)try{e?window.localStorage.setItem(t,e):window.localStorage.removeItem(t)}catch{}}},hl=/[^0-9]/g,gl=/[^0-9a-zA-Z]/g,_l=class extends l{static formAssociated=!0;static get observedAttributes(){return[`value`,`length`,`mode`,`disabled`,`aria-label`]}get length(){let e=Number.parseInt(this.getAttribute(`length`)??`6`,10);return Number.isFinite(e)&&e>0?e:6}set length(e){this.setAttribute(`length`,String(e))}get mode(){return this.getAttribute(`mode`)===`alphanumeric`?`alphanumeric`:`numeric`}set mode(e){this.setAttribute(`mode`,String(e??`numeric`))}get value(){return this._value??``}set value(e){this._value=this._clean(e),z(this,this._value),this._paint()}_clean(e){return(e==null?``:String(e)).replace(this.mode===`alphanumeric`?gl:hl,``).slice(0,this.length)}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}}connectedCallback(){this._rendered?this._onSelectionChange&&document.addEventListener(`selectionchange`,this._onSelectionChange):(this._defaultCaptured||=(this._defaultValue=this._value,!0),this.render())}formResetCallback(){this._value=this._defaultValue||``,z(this,this._value),this._paint()}attributeChangedCallback(e,t,n){this._rendered&&(e===`value`?(this._value=this._clean(n),z(this,this._value),this._paint()):this.render())}render(){this._value=this._clean(this.getAttribute(`value`)??this._value);let e=this.length,t=this.mode===`numeric`,n=this.hasAttribute(`disabled`),r=Array.from({length:e},()=>`<span class="otp-slot" aria-hidden="true"></span>`).join(``),i=this.getAttribute(`aria-label`),a=i?` aria-label="${i.replace(/"/g,`&quot;`)}"`:``;this.innerHTML=`
359
359
  <div class="otp">
360
360
  <input
361
361
  class="otp-field"
@@ -368,21 +368,21 @@ var WeborityUiElements=(function(e){Object.defineProperty(e,Symbol.toStringTag,{
368
368
  spellcheck="false"
369
369
  ${n?`disabled`:``} />
370
370
  <div class="otp-slots" aria-hidden="true">${r}</div>
371
- </div>`,this._rendered=!0,z(this,this._value),this._wire(),this._paint()}_refs(){return{input:this.querySelector(`.otp-field`),slots:[...this.querySelectorAll(`.otp-slot`)]}}_paint(){let{input:e,slots:t}=this._refs();if(!e||!t.length)return;e.value!==this._value&&(e.value=this._value);let n=e.selectionStart??this._value.length,r=Math.min(n,t.length-1),i=document.activeElement===e;t.forEach((e,t)=>{e.textContent=this._value[t]??``,e.classList.toggle(`filled`,!!this._value[t]),e.classList.toggle(`active`,i&&t===r)})}_wire(){let{input:e}=this._refs();if(!e)return;let t=e=>{let t=this._clean(e),n=t!==this._value;this._value=t,z(this,this._value),this._paint(),n&&this.dispatchEvent(new Event(`change`,{bubbles:!0})),n&&t.length===this.length&&this.dispatchEvent(new CustomEvent(`complete`,{bubbles:!0,detail:t}))};e.addEventListener(`input`,()=>{let n=e.value;if(this._value.length===this.length&&n.length>this._value.length&&n.startsWith(this._value)){let e=this._clean(n.slice(this._value.length));if(e){t(e);return}}t(n)}),e.addEventListener(`paste`,e=>{let n=e.clipboardData?.getData(`text`);n!=null&&(e.preventDefault(),t(n))});for(let t of[`keyup`,`click`,`blur`,`select`])e.addEventListener(t,()=>this._paint());e.addEventListener(`focus`,()=>{this._value.length===this.length&&e.select(),this._paint()}),this._onSelectionChange&&document.removeEventListener(`selectionchange`,this._onSelectionChange),this._onSelectionChange=()=>{document.activeElement===e&&this._paint()},document.addEventListener(`selectionchange`,this._onSelectionChange)}disconnectedCallback(){this._onSelectionChange&&document.removeEventListener(`selectionchange`,this._onSelectionChange)}},gl=`data-wui-overflow-hidden`,_l=`[aria-selected="true"], .active`,vl=`.chip-body, input, a[href], button:not(.chip-remove)`,yl=1,bl=0,xl=e=>Number.parseFloat(e)||0,Sl=e=>{let t=e.getAttribute(`data-overflow-label`);if(t)return t;let n=[],r=e=>{for(let t of e.childNodes)if(t.nodeType===3){let e=t.textContent.trim();e&&n.push(e)}else t.nodeType===1&&!t.matches(`svg, img, [aria-hidden='true']`)&&r(t)};return r(e),n.join(` `)},Cl=e=>e.matches(`button, a[href], label, input`)?e:e.querySelector(vl),wl=class extends l{constructor(){super(),this._more=null,this._menu=null,this._hiddenKey=``,this._ro=null,this._mo=null,this._observedList=null,this._doc=null,this._onDocDown=e=>{!this._menu.hidden&&!this.contains(e.target)&&this._close(!1)}}connectedCallback(){this.classList.add(`wui-overflow`),this._build(),this._doc=this.ownerDocument,this._doc.addEventListener(`pointerdown`,this._onDocDown,!0),typeof ResizeObserver<`u`&&(this._ro=new ResizeObserver(()=>this.layout()),this._ro.observe(this)),typeof MutationObserver<`u`&&(this._mo=new MutationObserver(()=>this.layout()),this._watch()),this.layout()}disconnectedCallback(){this._ro?.disconnect(),this._mo?.disconnect(),this._ro=null,this._mo=null,this._observedList=null,this._doc?.removeEventListener(`pointerdown`,this._onDocDown,!0),this._doc=null,c(this)}static get observedAttributes(){return[`label`]}attributeChangedCallback(){this._more&&(this._more.firstChild.textContent=this._label())}_label(){return this.getAttribute(`label`)||`More`}_list(){return this.querySelector(`[data-wui-overflow-list]`)}_items(e){return[...e.children].filter(e=>!e.hasAttribute(`data-wui-overflow-skip`))}_build(){if(this._more)return;let e=`wui-overflow-menu-${++bl}`,t=this.ownerDocument.createElement(`button`);t.type=`button`,t.className=`wui-overflow-more`,t.hidden=!0,t.setAttribute(`aria-haspopup`,`menu`),t.setAttribute(`aria-expanded`,`false`),t.setAttribute(`aria-controls`,e),t.append(this._label());let n=this.ownerDocument.createElement(`div`);n.className=`wui-overflow-menu`,n.id=e,n.setAttribute(`role`,`menu`),n.hidden=!0,this.append(t,n),this._more=t,this._menu=n,t.addEventListener(`click`,()=>this._menu.hidden?this._open(!1):this._close(!0)),t.addEventListener(`keydown`,e=>{e.key!==`ArrowDown`&&e.key!==`ArrowUp`||(e.preventDefault(),this._open(!0))}),n.addEventListener(`keydown`,e=>this._onMenuKey(e))}_watch(){let e=this._list();!this._mo||e===this._observedList||(this._mo.disconnect(),this._observedList=e,e&&this._mo.observe(e,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:[`class`,`aria-selected`,`disabled`,`aria-disabled`,`data-overflow-label`]}))}layout(){let e=this._list();if(this._watch(),!e||!this._more)return;let t=this._items(e);for(let e of t)e.removeAttribute(gl);this._more.hidden=!0;let n=this.clientWidth,r=[];if(n>0&&t.length){let i=getComputedStyle(e),a=xl(i.columnGap),o=xl(i.paddingLeft)+xl(i.paddingRight)+xl(i.borderLeftWidth)+xl(i.borderRightWidth),s=t.map(e=>e.offsetWidth);if(s.reduce((e,t)=>e+t,0)+a*(t.length-1)>n-o+yl){this._more.hidden=!1;let e=n-o-this._more.offsetWidth-xl(getComputedStyle(this).columnGap),i=this.hasAttribute(`keep`)?this.getAttribute(`keep`):_l,c=new Set(i?t.filter(e=>e.matches(i)):[]),l=0,u=0;for(let e of c)l+=s[t.indexOf(e)]+(u?a:0),u+=1;for(let n=0;n<t.length;n+=1){if(c.has(t[n]))continue;let r=l+s[n]+(u?a:0);if(r>e)break;c.add(t[n]),l=r,u+=1}r=t.filter(e=>!c.has(e))}}for(let e of r)e.setAttribute(gl,``);this._more.hidden=r.length===0,r.length?this._menu.hidden||this._fill(r):this._close(!1);let i=r.map(e=>t.indexOf(e)).join(`,`);i!==this._hiddenKey&&(this._hiddenKey=i,this.dispatchEvent(new CustomEvent(`wui-overflow-change`,{bubbles:!0,detail:{hidden:r.length}})))}_hiddenItems(){let e=this._list();return e?this._items(e).filter(e=>e.hasAttribute(gl)):[]}_fill(e){this._menu.replaceChildren();for(let t of e){let e=this.ownerDocument.createElement(`button`);e.type=`button`,e.className=`wui-overflow-item`,e.tabIndex=-1;let n=t.querySelector(`input[type=checkbox], input[type=radio]`);n?(e.setAttribute(`role`,n.type===`radio`?`menuitemradio`:`menuitemcheckbox`),e.setAttribute(`aria-checked`,String(n.checked))):e.setAttribute(`role`,`menuitem`);let r=Cl(t),i=!r||r.disabled||r.getAttribute(`aria-disabled`)===`true`||t.matches(`.disabled, [aria-disabled='true']`);i&&e.setAttribute(`aria-disabled`,`true`),e.textContent=Sl(t),e.addEventListener(`click`,()=>{i||this._choose(t,r)}),this._menu.append(e)}}_choose(e,t){this._close(!1),t.click(),this.layout();let n=!e.hasAttribute(gl)&&e.matches(`button, a[href]`)?e:this._more;n.hidden||n.focus()}_open(e){let t=this._hiddenItems();if(!t.length)return;this._fill(t),this._menu.hidden=!1,this._more.setAttribute(`aria-expanded`,`true`);let n=()=>o(this._more,this._menu);n(),s(this,n),e&&this._menu.firstElementChild?.focus()}_close(e){!this._menu||this._menu.hidden||(this._menu.hidden=!0,this._more.setAttribute(`aria-expanded`,`false`),c(this),e&&this._more.focus())}_onMenuKey(e){let t=[...this._menu.children],n=t.indexOf(this.ownerDocument.activeElement),r=null;if(e.key===`ArrowDown`)r=t[(n+1)%t.length];else if(e.key===`ArrowUp`)r=t[(n-1+t.length)%t.length];else if(e.key===`Home`)r=t[0];else if(e.key===`End`)r=t[t.length-1];else if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),this._close(!0);return}else if(e.key===`Tab`){this._close(!1);return}else return;e.preventDefault(),r?.focus()}},Tl={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`]},El=new Set(Ba.map(([e])=>e)),Dl=new Map;for(let[e,t]of Object.entries(Tl))for(let n of t)Dl.set(n,e);function Ol(e){let t=Dl.get(e);return t&&El.has(t)?t:null}function kl(e){if(!e)return null;let t;try{t=new Intl.Locale(e).region}catch{return null}return t&&El.has(t)?t:null}function Al(){let e;try{e=Intl.DateTimeFormat().resolvedOptions().timeZone}catch{e=void 0}let t=typeof navigator>`u`?void 0:navigator.language;return Ol(e)||kl(t)||null}var jl=`ui-phone.global.js`,Ml=typeof document>`u`?``:document.currentScript?.src||``;function Nl(e=Ml){return window.WeborityPhone?Promise.resolve(window.WeborityPhone):new Promise((t,n)=>{let r=document.querySelector(`script[src*="${jl}"]`);if(!r){if(!e){n(Error(`The phone metadata script has no address to load from.`));return}let t=new URL(e);r=document.createElement(`script`),r.src=new URL(jl,t).href+t.search,document.head.append(r)}r.addEventListener(`load`,()=>window.WeborityPhone?t(window.WeborityPhone):n(Error(`The phone metadata script did not load.`))),r.addEventListener(`error`,()=>n(Error(`The phone metadata script failed to load.`)))})}var Pl=e=>e?`wui-flag wui-flag-${String(e).toLowerCase()}`:`wui-flag`,Fl=e=>e?`+${Va(e)}`:``,Z=null,Il=null;function Ll(){return Z?Promise.resolve(Z):(Il||=Nl().then(e=>(Z=e,Z)).catch(()=>null),Il)}function Rl(e,t){let n=`+${Va(e)}`;return t?.startsWith(n)?t.slice(n.length).trimStart():null}function zl(e,t){if(!Z||!t||!e)return t;try{return Rl(e,new Z.AsYouType(e).input(`+${Va(e)}${t}`))||t}catch{return t}}function Bl(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 Vl(e){if(!Z||!e)return null;try{return Rl(e,Z.getExampleNumber(e,Z.examples)?.formatInternational())||null}catch{return null}}function Hl(e){let t=Vl(e);return t?`For example ${t}`:null}function Ul(e){if(!Z||!e)return null;try{if(!Z.isValidPhoneNumber(e))return!1;let t=Z.parsePhoneNumber(e)?.getType?.();return t===void 0||t===`MOBILE`||t===`FIXED_LINE_OR_MOBILE`}catch{return null}}function Wl(e){if(!Z||!e)return null;try{let t=Z.getExampleNumber(e,Z.examples);return t?.nationalNumber?t.nationalNumber.length:null}catch{return null}}function Gl(e,t,n){try{let r=Z.parsePhoneNumber(t,e),i=r?.nationalNumber;return!i||r.country!==e||i.length>n||!t.endsWith(i)?null:i}catch{return null}}function Kl(e){if(!Z||!e?.trim().startsWith(`+`))return null;try{let t=new Z.AsYouType;t.input(e.trim());let n=t.getCountry();return n?{country:n,national:t.getNationalNumber()||``}:null}catch{return null}}var ql=class extends l{static formAssociated=!0;static get observedAttributes(){return[`value`,`country`,`placeholder`,`disabled`,`required`,`aria-label`,`aria-describedby`]}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._defaultCountry=Al()||``,this._country=this._defaultCountry,this._national=``,this._active=-1,this._committedValue=``,this._validateOnInput=!1}connectedCallback(){if(!this._rendered){this.render();return}this._bindGlobal?.()}attributeChangedCallback(e,t,n){if(e===`value`){this.value=n;return}if(this._rendered){if(e===`aria-label`){let t=this.querySelector(`input[type=tel]`);t&&(n==null?t.removeAttribute(e):t.setAttribute(e,n));return}if(e===`aria-describedby`){this._syncDescribedBy();return}e===`country`&&(this._country=n||this._defaultCountry,this._suppressCountryRender)||this.render()}}formResetCallback(){this._validateOnInput=!1,this.value=this._defaultValue||``}get value(){return this._national&&this._country?`+${Va(this._country)}${this._national}`:``}set value(e){let t=String(e??``).trim(),n=Kl(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(Va(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(){z(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.getAttribute(`country`)||this._country;let e=this.getAttribute(`placeholder`)||Hl(this._country)||`Enter phone number`;this.id||=`wui-phone-${Math.random().toString(36).slice(2,9)}`;let t=`${this.id}-listbox`;this._listboxId=t,this.innerHTML=`
371
+ </div>`,this._rendered=!0,z(this,this._value),this._wire(),this._paint()}_refs(){return{input:this.querySelector(`.otp-field`),slots:[...this.querySelectorAll(`.otp-slot`)]}}_paint(){let{input:e,slots:t}=this._refs();if(!e||!t.length)return;e.value!==this._value&&(e.value=this._value);let n=e.selectionStart??this._value.length,r=Math.min(n,t.length-1),i=document.activeElement===e;t.forEach((e,t)=>{e.textContent=this._value[t]??``,e.classList.toggle(`filled`,!!this._value[t]),e.classList.toggle(`active`,i&&t===r)})}_wire(){let{input:e}=this._refs();if(!e)return;let t=e=>{let t=this._clean(e),n=t!==this._value;this._value=t,z(this,this._value),this._paint(),n&&this.dispatchEvent(new Event(`change`,{bubbles:!0})),n&&t.length===this.length&&this.dispatchEvent(new CustomEvent(`complete`,{bubbles:!0,detail:t}))};e.addEventListener(`input`,()=>{let n=e.value;if(this._value.length===this.length&&n.length>this._value.length&&n.startsWith(this._value)){let e=this._clean(n.slice(this._value.length));if(e){t(e);return}}t(n)}),e.addEventListener(`paste`,e=>{let n=e.clipboardData?.getData(`text`);n!=null&&(e.preventDefault(),t(n))});for(let t of[`keyup`,`click`,`blur`,`select`])e.addEventListener(t,()=>this._paint());e.addEventListener(`focus`,()=>{this._value.length===this.length&&e.select(),this._paint()}),this._onSelectionChange&&document.removeEventListener(`selectionchange`,this._onSelectionChange),this._onSelectionChange=()=>{document.activeElement===e&&this._paint()},document.addEventListener(`selectionchange`,this._onSelectionChange)}disconnectedCallback(){this._onSelectionChange&&document.removeEventListener(`selectionchange`,this._onSelectionChange)}},vl=`data-wui-overflow-hidden`,yl=`[aria-selected="true"], .active`,bl=`.chip-body, input, a[href], button:not(.chip-remove)`,xl=1,Sl=0,Cl=e=>Number.parseFloat(e)||0,wl=e=>{let t=e.getAttribute(`data-overflow-label`);if(t)return t;let n=[],r=e=>{for(let t of e.childNodes)if(t.nodeType===3){let e=t.textContent.trim();e&&n.push(e)}else t.nodeType===1&&!t.matches(`svg, img, [aria-hidden='true']`)&&r(t)};return r(e),n.join(` `)},Tl=e=>e.matches(`button, a[href], label, input`)?e:e.querySelector(bl),El=class extends l{constructor(){super(),this._more=null,this._menu=null,this._hiddenKey=``,this._ro=null,this._mo=null,this._observedList=null,this._doc=null,this._onDocDown=e=>{!this._menu.hidden&&!this.contains(e.target)&&this._close(!1)}}connectedCallback(){this.classList.add(`wui-overflow`),this._build(),this._doc=this.ownerDocument,this._doc.addEventListener(`pointerdown`,this._onDocDown,!0),typeof ResizeObserver<`u`&&(this._ro=new ResizeObserver(()=>this.layout()),this._ro.observe(this)),typeof MutationObserver<`u`&&(this._mo=new MutationObserver(()=>this.layout()),this._watch()),this.layout()}disconnectedCallback(){this._ro?.disconnect(),this._mo?.disconnect(),this._ro=null,this._mo=null,this._observedList=null,this._doc?.removeEventListener(`pointerdown`,this._onDocDown,!0),this._doc=null,c(this)}static get observedAttributes(){return[`label`]}attributeChangedCallback(){this._more&&(this._more.firstChild.textContent=this._label())}_label(){return this.getAttribute(`label`)||`More`}_list(){return this.querySelector(`[data-wui-overflow-list]`)}_items(e){return[...e.children].filter(e=>!e.hasAttribute(`data-wui-overflow-skip`))}_build(){if(this._more)return;let e=`wui-overflow-menu-${++Sl}`,t=this.ownerDocument.createElement(`button`);t.type=`button`,t.className=`wui-overflow-more`,t.hidden=!0,t.setAttribute(`aria-haspopup`,`menu`),t.setAttribute(`aria-expanded`,`false`),t.setAttribute(`aria-controls`,e),t.append(this._label());let n=this.ownerDocument.createElement(`div`);n.className=`wui-overflow-menu`,n.id=e,n.setAttribute(`role`,`menu`),n.hidden=!0,this.append(t,n),this._more=t,this._menu=n,t.addEventListener(`click`,()=>this._menu.hidden?this._open(!1):this._close(!0)),t.addEventListener(`keydown`,e=>{e.key!==`ArrowDown`&&e.key!==`ArrowUp`||(e.preventDefault(),this._open(!0))}),n.addEventListener(`keydown`,e=>this._onMenuKey(e))}_watch(){let e=this._list();!this._mo||e===this._observedList||(this._mo.disconnect(),this._observedList=e,e&&this._mo.observe(e,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:[`class`,`aria-selected`,`disabled`,`aria-disabled`,`data-overflow-label`]}))}layout(){let e=this._list();if(this._watch(),!e||!this._more)return;let t=this._items(e);for(let e of t)e.removeAttribute(vl);this._more.hidden=!0;let n=this.clientWidth,r=[];if(n>0&&t.length){let i=getComputedStyle(e),a=Cl(i.columnGap),o=Cl(i.paddingLeft)+Cl(i.paddingRight)+Cl(i.borderLeftWidth)+Cl(i.borderRightWidth),s=t.map(e=>e.offsetWidth);if(s.reduce((e,t)=>e+t,0)+a*(t.length-1)>n-o+xl){this._more.hidden=!1;let e=n-o-this._more.offsetWidth-Cl(getComputedStyle(this).columnGap),i=this.hasAttribute(`keep`)?this.getAttribute(`keep`):yl,c=new Set(i?t.filter(e=>e.matches(i)):[]),l=0,u=0;for(let e of c)l+=s[t.indexOf(e)]+(u?a:0),u+=1;for(let n=0;n<t.length;n+=1){if(c.has(t[n]))continue;let r=l+s[n]+(u?a:0);if(r>e)break;c.add(t[n]),l=r,u+=1}r=t.filter(e=>!c.has(e))}}for(let e of r)e.setAttribute(vl,``);this._more.hidden=r.length===0,r.length?this._menu.hidden||this._fill(r):this._close(!1);let i=r.map(e=>t.indexOf(e)).join(`,`);i!==this._hiddenKey&&(this._hiddenKey=i,this.dispatchEvent(new CustomEvent(`wui-overflow-change`,{bubbles:!0,detail:{hidden:r.length}})))}_hiddenItems(){let e=this._list();return e?this._items(e).filter(e=>e.hasAttribute(vl)):[]}_fill(e){this._menu.replaceChildren();for(let t of e){let e=this.ownerDocument.createElement(`button`);e.type=`button`,e.className=`wui-overflow-item`,e.tabIndex=-1;let n=t.querySelector(`input[type=checkbox], input[type=radio]`);n?(e.setAttribute(`role`,n.type===`radio`?`menuitemradio`:`menuitemcheckbox`),e.setAttribute(`aria-checked`,String(n.checked))):e.setAttribute(`role`,`menuitem`);let r=Tl(t),i=!r||r.disabled||r.getAttribute(`aria-disabled`)===`true`||t.matches(`.disabled, [aria-disabled='true']`);i&&e.setAttribute(`aria-disabled`,`true`),e.textContent=wl(t),e.addEventListener(`click`,()=>{i||this._choose(t,r)}),this._menu.append(e)}}_choose(e,t){this._close(!1),t.click(),this.layout();let n=!e.hasAttribute(vl)&&e.matches(`button, a[href]`)?e:this._more;n.hidden||n.focus()}_open(e){let t=this._hiddenItems();if(!t.length)return;this._fill(t),this._menu.hidden=!1,this._more.setAttribute(`aria-expanded`,`true`);let n=()=>o(this._more,this._menu);n(),s(this,n),e&&this._menu.firstElementChild?.focus()}_close(e){!this._menu||this._menu.hidden||(this._menu.hidden=!0,this._more.setAttribute(`aria-expanded`,`false`),c(this),e&&this._more.focus())}_onMenuKey(e){let t=[...this._menu.children],n=t.indexOf(this.ownerDocument.activeElement),r=null;if(e.key===`ArrowDown`)r=t[(n+1)%t.length];else if(e.key===`ArrowUp`)r=t[(n-1+t.length)%t.length];else if(e.key===`Home`)r=t[0];else if(e.key===`End`)r=t[t.length-1];else if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),this._close(!0);return}else if(e.key===`Tab`){this._close(!1);return}else return;e.preventDefault(),r?.focus()}},Dl={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`]},Ol=new Set(Ha.map(([e])=>e)),kl=new Map;for(let[e,t]of Object.entries(Dl))for(let n of t)kl.set(n,e);function Al(e){let t=kl.get(e);return t&&Ol.has(t)?t:null}function jl(e){if(!e)return null;let t;try{t=new Intl.Locale(e).region}catch{return null}return t&&Ol.has(t)?t:null}function Ml(){let e;try{e=Intl.DateTimeFormat().resolvedOptions().timeZone}catch{e=void 0}let t=typeof navigator>`u`?void 0:navigator.language;return Al(e)||jl(t)||null}var Nl=`ui-phone.global.js`,Pl=typeof document>`u`?``:document.currentScript?.src||``;function Fl(e=Pl){return window.WeborityPhone?Promise.resolve(window.WeborityPhone):new Promise((t,n)=>{let r=document.querySelector(`script[src*="${Nl}"]`);if(!r){if(!e){n(Error(`The phone metadata script has no address to load from.`));return}let t=new URL(e);r=document.createElement(`script`),r.src=new URL(Nl,t).href+t.search,document.head.append(r)}r.addEventListener(`load`,()=>window.WeborityPhone?t(window.WeborityPhone):n(Error(`The phone metadata script did not load.`))),r.addEventListener(`error`,()=>n(Error(`The phone metadata script failed to load.`)))})}var Il=e=>e?`wui-flag wui-flag-${String(e).toLowerCase()}`:`wui-flag`,Ll=e=>e?`+${Ua(e)}`:``,Z=null,Rl=null;function zl(){return Z?Promise.resolve(Z):(Rl||=Fl().then(e=>(Z=e,Z)).catch(()=>null),Rl)}function Bl(e,t){let n=`+${Ua(e)}`;return t?.startsWith(n)?t.slice(n.length).trimStart():null}function Vl(e,t){if(!Z||!t||!e)return t;try{return Bl(e,new Z.AsYouType(e).input(`+${Ua(e)}${t}`))||t}catch{return t}}function Hl(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 Ul(e){if(!Z||!e)return null;try{return Bl(e,Z.getExampleNumber(e,Z.examples)?.formatInternational())||null}catch{return null}}function Wl(e){let t=Ul(e);return t?`For example ${t}`:null}function Gl(e){if(!Z||!e)return null;try{if(!Z.isValidPhoneNumber(e))return!1;let t=Z.parsePhoneNumber(e)?.getType?.();return t===void 0||t===`MOBILE`||t===`FIXED_LINE_OR_MOBILE`}catch{return null}}function Kl(e){if(!Z||!e)return null;try{let t=Z.getExampleNumber(e,Z.examples);return t?.nationalNumber?t.nationalNumber.length:null}catch{return null}}function ql(e,t,n){try{let r=Z.parsePhoneNumber(t,e),i=r?.nationalNumber;return!i||r.country!==e||i.length>n||!t.endsWith(i)?null:i}catch{return null}}function Jl(e){if(!Z||!e?.trim().startsWith(`+`))return null;try{let t=new Z.AsYouType;t.input(e.trim());let n=t.getCountry();return n?{country:n,national:t.getNationalNumber()||``}:null}catch{return null}}var Yl=class extends l{static formAssociated=!0;static get observedAttributes(){return[`value`,`country`,`placeholder`,`disabled`,`required`,`aria-label`,`aria-describedby`]}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._defaultCountry=Ml()||``,this._country=this._defaultCountry,this._national=``,this._active=-1,this._committedValue=``,this._validateOnInput=!1}connectedCallback(){if(!this._rendered){this.render();return}this._bindGlobal?.()}attributeChangedCallback(e,t,n){if(e===`value`){this.value=n;return}if(this._rendered){if(e===`aria-label`){let t=this.querySelector(`input[type=tel]`);t&&(n==null?t.removeAttribute(e):t.setAttribute(e,n));return}if(e===`aria-describedby`){this._syncDescribedBy();return}e===`country`&&(this._country=n||this._defaultCountry,this._suppressCountryRender)||this.render()}}formResetCallback(){this._validateOnInput=!1,this.value=this._defaultValue||``}get value(){return this._national&&this._country?`+${Ua(this._country)}${this._national}`:``}set value(e){let t=String(e??``).trim(),n=Jl(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(Ua(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(){z(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.getAttribute(`country`)||this._country;let e=this.getAttribute(`placeholder`)||Wl(this._country)||`Enter phone number`;this.id||=`wui-phone-${Math.random().toString(36).slice(2,9)}`;let t=`${this.id}-listbox`;this._listboxId=t,this.innerHTML=`
372
372
  <div class="phone-input-wrap">
373
373
  <div class="phone-country-adornment">
374
- <button type="button" class="country-toggle" aria-label="Choose country" aria-haspopup="listbox" aria-expanded="false" aria-controls="${Jl(t)}"${this.hasAttribute(`disabled`)?` disabled`:``}>
375
- <span class="${Pl(this._country)}" data-flag aria-hidden="true"></span>
374
+ <button type="button" class="country-toggle" aria-label="Choose country" aria-haspopup="listbox" aria-expanded="false" aria-controls="${Xl(t)}"${this.hasAttribute(`disabled`)?` disabled`:``}>
375
+ <span class="${Il(this._country)}" data-flag aria-hidden="true"></span>
376
376
  ${j(`chevron-down`,{className:`phone-chevron`})}
377
- <span class="phone-dial" data-dial>${Fl(this._country)}</span>
377
+ <span class="phone-dial" data-dial>${Ll(this._country)}</span>
378
378
  </button>
379
- <div class="country-dropdown-menu" role="listbox" id="${Jl(t)}" tabindex="-1" hidden>
380
- <div class="dropdown-search-wrapper"><span class="dropdown-search-icon">${j(`search`)}</span><input type="text" class="dropdown-search-input" placeholder="Search country or code" aria-label="Search countries" aria-controls="${Jl(t)}" aria-autocomplete="list" /></div>
379
+ <div class="country-dropdown-menu" role="listbox" id="${Xl(t)}" tabindex="-1" hidden>
380
+ <div class="dropdown-search-wrapper"><span class="dropdown-search-icon">${j(`search`)}</span><input type="text" class="dropdown-search-input" placeholder="Search country or code" aria-label="Search countries" aria-controls="${Xl(t)}" aria-autocomplete="list" /></div>
381
381
  <div class="country-list-scroll"><div class="country-empty" hidden>No countries found</div></div>
382
382
  </div>
383
383
  </div>
384
- <input type="tel" class="input" placeholder="${Jl(e)}" value="${Jl(zl(this._country,this._national))}"${this.getAttribute(`aria-label`)?` aria-label="${Jl(this.getAttribute(`aria-label`))}"`:``}${this.getAttribute(`aria-describedby`)?` aria-describedby="${Jl(this.getAttribute(`aria-describedby`))}"`:``}${this.hasAttribute(`required`)?` required aria-required="true"`:``}${this.hasAttribute(`disabled`)?` disabled`:``} />
385
- </div>`,this._rendered=!0,z(this,this.value),this._wire()}_ensureItems(){let e=this.querySelector(`.country-list-scroll`);if(!e||e.querySelector(`.country-dropdown-item`))return;let t=this._listboxId,n=Ba.map(([e,n,r],i)=>`<button type="button" role="option" id="${Jl(`${t}-opt-${i}`)}" class="country-dropdown-item${e===this._country?` selected`:``}" data-iso="${e}" aria-selected="${e===this._country}"><span class="${Pl(e)}" aria-hidden="true"></span><span class="country-name-text">${n}<span class="country-code-text">+${r}</span></span></button>`).join(``);e.insertAdjacentHTML(`afterbegin`,n)}_itemEls(){return[...this.querySelectorAll(`.country-dropdown-item`)]}_visibleItems(){return this._itemEls().filter(e=>!e.hidden)}_wire(){this._teardown();let e=this.querySelector(`.country-toggle`),t=this.querySelector(`.phone-input-wrap`),n=this.querySelector(`.country-dropdown-menu`),r=this.querySelector(`.dropdown-search-input`),i=this.querySelector(`.country-list-scroll`),a=this.querySelector(`.country-empty`),l=this.querySelector(`input[type=tel]`),u=this.querySelector(`[data-flag]`),d=this.querySelector(`[data-dial]`);if(!e||!n)return;let f=()=>!n.hidden,p=()=>o(t||e,n),m=(e,{reveal:t=!0}={})=>{let n=this._visibleItems();this._active=e,di(i,e>=0&&n[e]||null),e>=0&&n[e]?(t&&n[e].scrollIntoView({block:`nearest`}),r?.setAttribute(`aria-activedescendant`,n[e].id)):r?.removeAttribute(`aria-activedescendant`)},h=()=>{f()&&p()},g=()=>{this._ensureItems(),n.hidden=!1,e.setAttribute(`aria-expanded`,`true`),r.value=``,v(``),p(),s(this,h),r.focus(),m(this._visibleItems().findIndex(e=>e.classList.contains(`selected`)))},_=()=>{n.hidden=!0,e.setAttribute(`aria-expanded`,`false`),m(-1),c(this)},v=e=>{let t=e.trim().toLowerCase(),n=0;for(let e of this._itemEls()){let r=!t||e.textContent.toLowerCase().includes(t);e.hidden=!r,r&&(n+=1)}a&&(a.hidden=n>0)},y=e=>{this._country=e,this.getAttribute(`country`)!==e&&(this._suppressCountryRender=!0,this.setAttribute(`country`,e),this._suppressCountryRender=!1),u&&(u.className=Pl(e)),d&&(d.textContent=`+${Va(e)}`);for(let t of this._itemEls()){let n=t.dataset.iso===e;t.classList.toggle(`selected`,n),t.setAttribute(`aria-selected`,String(n))}!this.getAttribute(`placeholder`)&&l&&(l.placeholder=Hl(e)||`Enter phone number`),l&&this._national&&(l.value=zl(e,this._national)),_(),this._syncMirror(),this._emitChange(),this._validateOnInput&&x(S()),l?.focus()},b=t=>{let n=this._visibleItems();if(t.key===`ArrowDown`){if(t.preventDefault(),!f()){g();return}m(Math.min(this._active+1,n.length-1))}else if(t.key===`ArrowUp`){if(t.preventDefault(),!f())return;m(Math.max(this._active-1,0))}else t.key===`Enter`?(t.preventDefault(),f()&&n[this._active]&&y(n[this._active].dataset.iso)):t.key===`Escape`&&f()&&(t.preventDefault(),t.stopPropagation(),_(),e.focus())};e.addEventListener(`click`,()=>f()?_():g()),e.addEventListener(`keydown`,e=>{if(f()){b(e);return}(e.key===`ArrowDown`||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),g())}),r.addEventListener(`input`,()=>{v(r.value);let e=this._visibleItems();m(e.length?0:-1)}),i.addEventListener(`click`,e=>{let t=e.target.closest(`.country-dropdown-item`);t&&y(t.dataset.iso)}),i.addEventListener(`mousemove`,e=>{let t=e.target.closest(`.country-dropdown-item`);t&&!t.classList.contains(`is-active`)&&m(this._visibleItems().indexOf(t),{reveal:!1})}),i.addEventListener(`mouseleave`,()=>m(-1)),n.addEventListener(`keydown`,b);let x=e=>{l.classList.toggle(`is-invalid`,e),e?l.setAttribute(`aria-invalid`,`true`):l.removeAttribute(`aria-invalid`);let n=this.querySelector(`[data-phone-error]`);if(e){n||(n=document.createElement(`div`),n.className=`field-error`,n.id=`${this.id}-phone-error`,n.setAttribute(`data-phone-error`,``),t.after(n));let e=Vl(this._country);n.textContent=this._country?e?`Enter a valid phone number, e.g. ${e}`:`Enter a valid phone number`:`Choose a country`}else n?.remove();this._syncDescribedBy()},S=()=>this._national.length>0&&(!this._country||Ul(this.value)===!1);l.addEventListener(`input`,e=>{e.stopPropagation();let t=l.selectionStart??l.value.length,n=l.value.slice(0,t).replace(/[^0-9]/g,``).length,r=l.value.replace(/[^0-9]/g,``),i=Wl(this._country);if(i&&r.length>i){let e=Gl(this._country,r,i);e?(n=Math.max(0,n-(r.length-e.length)),r=e):r=r.slice(0,i)}this._national=r;let a=zl(this._country,this._national);if(l.value!==a){l.value=a;let e=Bl(a,Math.min(n,r.length));l.setSelectionRange(e,e)}this._syncMirror(),this._emitInput(),this._validateOnInput&&x(S())}),l.addEventListener(`change`,e=>e.stopPropagation()),l.addEventListener(`blur`,()=>{let e=S();x(e),e&&(this._validateOnInput=!0),this.value!==this._committedValue&&this._emitChange()}),l.addEventListener(`paste`,e=>{let t=Kl(e.clipboardData?.getData(`text`));t&&(e.preventDefault(),this._national=t.national.replace(/[^0-9]/g,``),t.country===this._country?l.value=zl(this._country,this._national):this.setAttribute(`country`,t.country),this._syncMirror(),this._emitInput(),this._emitChange(),this._validateOnInput&&l.isConnected&&x(S()),this.querySelector(`input[type=tel]`)?.focus())}),this._bindGlobal=()=>{this._teardownGlobals?.(),this._onDocClick=e=>{f()&&!this.contains(e.target)&&_()},document.addEventListener(`click`,this._onDocClick),f()&&s(this,h)},this._teardownGlobals=()=>{this._onDocClick&&=(document.removeEventListener(`click`,this._onDocClick),null),c(this)},this._bindGlobal(),this._validateOnInput&&x(S()),Ll().then(e=>{if(!(!e||!l.isConnected)&&(this._national&&(l.value=zl(this._country,this._national)),!this.getAttribute(`placeholder`))){let e=Hl(this._country);e&&(l.placeholder=e)}}),this._syncMirror()}_teardown(){this._teardownGlobals?.()}disconnectedCallback(){this._teardown()}},Jl=e=>String(e??``).replace(/"/g,`&quot;`).replace(/</g,`&lt;`),Yl=`.wui-rating-star`,Xl=`wui-rating-star-preview`,Zl=`wui-rating-previewing`,Ql=[`wui-rating-star-full`,`wui-rating-star-half`,`wui-rating-star-empty`],$l=class extends l{constructor(){super(),this._onChange=e=>{let t=e.target;t?.type===`radio`&&this._fill(Number(t.value))},this._onOver=e=>{if(this.hasAttribute(`disabled`))return;let t=e.target.closest?.(Yl);t&&this._preview(Number(t.dataset.value))},this._onLeave=()=>this._preview(0)}connectedCallback(){this.addEventListener(`change`,this._onChange),this.addEventListener(`mouseover`,this._onOver),this.addEventListener(`mouseleave`,this._onLeave)}disconnectedCallback(){this.removeEventListener(`change`,this._onChange),this.removeEventListener(`mouseover`,this._onOver),this.removeEventListener(`mouseleave`,this._onLeave)}_fill(e){for(let t of this.querySelectorAll(Yl))t.classList.remove(...Ql),t.classList.add(Number(t.dataset.value)<=e?Ql[0]:Ql[2])}_preview(e){this.classList.toggle(Zl,e>0);for(let t of this.querySelectorAll(Yl))t.classList.toggle(Xl,e>0&&Number(t.dataset.value)<=e)}},eu=class extends l{constructor(){super(),this._doc=null,this._onKeyDown=e=>{this.hasAttribute(`keys`)&&E(e,{j:()=>this._press(`.wui-record-pager-next`),k:()=>this._press(`.wui-record-pager-prev`)},this.closest(`[${d}]`))}}connectedCallback(){this._doc=this.ownerDocument,this._doc.addEventListener(`keydown`,this._onKeyDown)}disconnectedCallback(){this._doc?.removeEventListener(`keydown`,this._onKeyDown),this._doc=null}_press(e){let t=this.querySelector(e);!t||t.disabled||t.getAttribute(`aria-disabled`)===`true`||t.click()}},tu=6e4,nu=60*tu,ru=24*nu,iu=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function au(e,t=Date.now()){let n=Le(e);if(!Number.isFinite(n))return`-`;let r=t-n,i=Math.abs(r);if(i>=7*ru)return ze(n);if(i<tu)return`just now`;let[a,o]=i<nu?[Math.floor(i/tu),`minute`]:i<ru?[Math.floor(i/nu),`hour`]:[Math.floor(i/ru),`day`];return r>0?`${iu(a,o)} ago`:`in ${iu(a,o)}`}function ou(e){let t=Le(e);return Number.isFinite(t)?`${ze(t,{pattern:`datetime`})} IST`:`-`}var su=3e4,cu=new Set,lu=null,uu=()=>{if(!(typeof document<`u`&&document.hidden))for(let e of cu)e.refresh()},du=e=>{cu.add(e),cu.size===1&&(lu=setInterval(uu,su),document.addEventListener(`visibilitychange`,uu))},fu=e=>{cu.delete(e),cu.size===0&&(clearInterval(lu),lu=null,document.removeEventListener(`visibilitychange`,uu))},pu=class extends l{constructor(){super(),this._observer=null}connectedCallback(){this.refresh(),du(this),this._observer=new MutationObserver(()=>this.refresh()),this._observer.observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:[`datetime`]})}disconnectedCallback(){fu(this),this._observer?.disconnect(),this._observer=null}refresh(){let e=this.querySelector(`time[datetime]`);if(!e)return;let t=au(e.getAttribute(`datetime`));e.textContent!==t&&(e.textContent=t)}},mu=`wui-resizable-panel`,hu=`wui-resizable-handle`,gu=5,_u=20,vu=10,yu=`wui-resizable:`,bu=.001,xu=0,Su=e=>e.reduce((e,t)=>e+t,0),Cu=(e,t,n)=>Math.min(Math.max(e,t),n),wu=e=>Math.round(e*10)/10,Tu=(e,t)=>e.length===t.length&&e.every((e,n)=>Math.abs(e-t[n])<bu);function Eu(e,t,n){let r=e.map((e,r)=>Cu(e,t[r],n[r]));for(let e=0;e<r.length;e++){let e=100-Su(r);if(Math.abs(e)<bu)break;let i=r.map((r,i)=>e>0?n[i]-r:r-t[i]),a=Su(i);if(a<=0)break;let o=Math.min(Math.abs(e),a);r=r.map((t,n)=>t+Math.sign(e)*o*i[n]/a)}return r}function Du(e,t,n,r){let i=e[t]+e[t+1];return[Math.max(n[t],i-r[t+1]),Math.min(r[t],i-n[t+1])]}function Ou(e,t,n,r,i){let[a,o]=Du(e,t,r,i);if(a>o)return e;let s=e[t]+e[t+1],c=Cu(e[t]+n,a,o),l=[...e];return l[t]=c,l[t+1]=s-c,l}function ku(e){let t=e.filter(e=>e===null).length,n=Su(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=Su(r);return r.map(e=>e*100/i)}var Au=(e,t)=>{let n=Number.parseFloat(e.getAttribute(t));return Number.isFinite(n)&&n>0?n:null},ju=class extends l{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.classList.contains(mu)),this._handles=e.filter(e=>e.classList.contains(hu));let t=this._panels.length;if(t===0)return;this._mins=this._panels.map(e=>Au(e,`data-min-size`)??vu),this._maxs=this._panels.map(e=>Au(e,`data-max-size`)??100),this._defaults=Eu(ku(this._panels.map(e=>Au(e,`data-default-size`))),this._mins,this._maxs);let n=this._sizes&&this._sizes.length===t?this._sizes:null;this._sizes=Eu(n??this._load(t)??this._defaults,this._mins,this._maxs);for(let e of this._panels)e.id||=`wui-resizable-panel-${++xu}`;this._render()}_render(){this._panels.forEach((e,t)=>{e.style.flex=`${wu(this._sizes[t])} 1 0px`});for(let e of this._handles){let t=this._indexOf(e);if(t<0)continue;let[n,r]=Du(this._sizes,t,this._mins,this._maxs);e.setAttribute(`aria-controls`,this._panels[t].id),e.setAttribute(`aria-valuenow`,String(Math.round(this._sizes[t]))),e.setAttribute(`aria-valuemin`,String(Math.ceil(n-bu))),e.setAttribute(`aria-valuemax`,String(Math.floor(r+bu)))}}_indexOf(e){let t=this._panels.indexOf(e.previousElementSibling);return t>=0&&e.nextElementSibling===this._panels[t+1]?t:-1}_handleFor(e){let t=e.target instanceof Element?e.target.closest(`.${hu}`):null;if(!t||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?yu+e:null}_load(e){let t=this._storageKey();if(!t)return null;try{let n=JSON.parse(globalThis.localStorage?.getItem(t)??`null`);return Array.isArray(n)&&n.length===e&&n.every((e,t)=>Number.isFinite(e)&&e>=this._mins[t]-bu&&e<=this._maxs[t]+bu)&&Math.abs(Su(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(wu)))}catch{}}_commit(e){Tu(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=Ou(t.before,t.index,r,this._mins,this._maxs),this._render()}_pointerUp(e,t){let n=this._drag;if(!(!n||e.pointerId!==n.pointerId)){if(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();return}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?_u:gu,o;if(e.key===n)o=i?a:-a;else if(e.key===r)o=i?-a:a;else if(e.key===`Home`)o=-1/0;else if(e.key===`End`)o=1/0;else return;e.preventDefault();let s=[...this._sizes];this._sizes=Ou(s,t.index,o,this._mins,this._maxs),this._render(),this._commit(s)}_reset(e){if(!this._handleFor(e))return;let t=[...this._sizes];this._sizes=[...this._defaults],this._render(),this._commit(t)}},Mu=/^[0-9]$/,Nu=()=>typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches,Pu=class extends l{static get observedAttributes(){return[`value`,`format`,`unit`,`decimals`,`duration`]}constructor(){super(),this._connected=!1,this._signature=null,this._digits=[],this._reels=[]}connectedCallback(){this._connected=!0,this._draw(!1)}disconnectedCallback(){this._connected=!1}attributeChangedCallback(){this._connected&&this._draw(!0)}_text(){let e=this.getAttribute(`value`),t=e===null||e.trim()===``?NaN:Number(e);if(!Number.isFinite(t))return null;let n=this.getAttribute(`decimals`);return Be(t,{style:this.getAttribute(`format`)||`number`,unit:this.getAttribute(`unit`)||void 0,decimals:n===null||n===``?void 0:Number(n)})}_showText(e){let t=this.querySelector(`.wui-rolling-number-text`);!t||t.textContent===e||(t.firstChild?t.firstChild.nodeValue=e:t.append(e))}_clear(e){e.replaceChildren(),this.removeAttribute(`data-ready`),this._signature=null,this._digits=[],this._reels=[]}_draw(e){let t=this.querySelector(`.wui-rolling-number-roll`);if(!t)return;let n=this._text();if(n===null){this._clear(t);return}if(this._showText(n),Nu()){this._clear(t);return}let r=Number(this.getAttribute(`duration`));this.getAttribute(`duration`)&&Number.isFinite(r)&&r>=0?this.style.setProperty(`--wui-roll-duration`,`${r}ms`):this.style.removeProperty(`--wui-roll-duration`);let i=[...n],a=i.filter(e=>Mu.test(e)).map(Number),o=i.map(e=>Mu.test(e)?`#`:e).join(``);if(e&&o===this._signature){this._reels.forEach((e,t)=>e.style.setProperty(`--wui-roll-digit`,String(a[t]))),this._digits=a;return}let s=this._digits,c=[],l=[],u=0;for(let t of i){if(!Mu.test(t)){let e=document.createElement(`span`);e.className=`wui-rolling-number-char`,e.textContent=t,l.push(e);continue}let n=document.createElement(`span`);n.className=`wui-rolling-number-digit`;let r=document.createElement(`span`);r.className=`wui-rolling-number-reel`;for(let e=0;e<10;e+=1){let t=document.createElement(`span`);t.textContent=String(e),r.append(t)}let i=a.length-1-u,o=e?s[s.length-1-i]??0:a[u];r.style.setProperty(`--wui-roll-digit`,String(o)),n.append(r),l.push(n),c.push(r),u+=1}t.replaceChildren(...l),e&&(t.offsetWidth,c.forEach((e,t)=>e.style.setProperty(`--wui-roll-digit`,String(a[t])))),this._signature=o,this._digits=a,this._reels=c,this.setAttribute(`data-ready`,``)}},Fu=class extends l{constructor(){super(),this._doc=null,this._onKeyDown=e=>this._keydown(e),this._onClick=e=>this._click(e),this._onDocClick=e=>{this.open&&!this.contains(e.target)&&this.setOpen(!1,{focus:!1})}}connectedCallback(){this._doc=this.ownerDocument,this._doc.addEventListener(`keydown`,this._onKeyDown),this._doc.addEventListener(`click`,this._onDocClick),this.addEventListener(`click`,this._onClick)}disconnectedCallback(){this._doc?.removeEventListener(`keydown`,this._onKeyDown),this._doc?.removeEventListener(`click`,this._onDocClick),this.removeEventListener(`click`,this._onClick),this._doc=null}get open(){let e=this._sheet();return!!(e&&!e.hidden)}set open(e){let t=e===!0||e===``||e===`true`;t!==this.open&&this.setOpen(t)}setOpen(e,{focus:t=!0}={}){let n=this._sheet();if(!n)return;n.hidden=!e;let r=this.querySelector(`.wui-shortcut-toggle`);r?.setAttribute(`aria-expanded`,String(e)),t&&(e?n.querySelector(`.wui-shortcut-close`)?.focus():r?.focus())}_sheet(){return this.querySelector(`.wui-shortcut-sheet`)}_scope(){return this.closest(`[${d}]`)}_items(){let e=this.getAttribute(`items`);return e?[...(this._scope()??this._doc).querySelectorAll(e)]:[]}_click(e){let t=e.target;t instanceof Element&&(t.closest(`.wui-shortcut-toggle`)?this.setOpen(!this.open):t.closest(`.wui-shortcut-close`)&&this.setOpen(!1))}_tickFocused(){let e=this._items(),t=this._doc.activeElement,n=t?.closest?.(`li, tr`),r=e.find(e=>e===t||e.contains(t)||n?.contains(e));(r?.closest(`li, tr`)??r)?.querySelector(`input[type="checkbox"]`)?.click()}_focusSearch(){let e=this.getAttribute(`search`);((this._scope()??this._doc).querySelector(e)??this._doc.querySelector(e))?.focus()}_keydown(e){if(e.defaultPrevented)return;let t=S(e);if(!t)return;if(t===`esc`&&this.open){e.preventDefault(),this.setOpen(!1);return}let n=this._scope(),r={help:()=>this.setOpen(!this.open)};if(this.getAttribute(`items`)&&(r.j=()=>D(this._items(),1),r.k=()=>D(this._items(),-1),r.x=()=>this._tickFocused()),this.getAttribute(`search`)&&(r.slash=()=>this._focusSearch()),r[t]){E(e,r,n);return}if(t===`enter`||w(this._doc)||!T(e.target,n)||C(e.target))return;let i=ee(t),a=[...this.querySelectorAll(`.wui-shortcut-keys [data-shortcut]`)].find(e=>e.dataset.shortcut===i);if(!a)return;let o=(n??this._doc).querySelector(`[aria-current="true"]`)?.closest(`[data-key]`)?.dataset.key??null;if(!this.dispatchEvent(new CustomEvent(`wui:shortcut`,{bubbles:!0,cancelable:!0,detail:{key:i,itemKey:o}}))){e.preventDefault();return}let s=a.dataset.target?this._doc.querySelector(a.dataset.target):null;s&&(e.preventDefault(),s.click())}},Iu=3,Lu=`Show more`,Ru=`Show less`,zu=class extends l{constructor(){super(),this._width=-1,this._observer=null,this._toggle=null,this._onClick=()=>this.toggle()}connectedCallback(){if(this._toggle=this.querySelector(`.wui-show-more-toggle`),!this._toggle)return;let e=Number.parseInt(this.getAttribute(`lines`),10);this.style.setProperty(`--wui-show-more-lines`,String(e>=1?e:Iu)),this._toggle.addEventListener(`click`,this._onClick),this._sync(),this._check(),typeof ResizeObserver<`u`&&(this._observer=new ResizeObserver(()=>{this.clientWidth!==this._width&&this._check()}),this._observer.observe(this))}disconnectedCallback(){this._observer?.disconnect(),this._observer=null,this._toggle?.removeEventListener(`click`,this._onClick),this._toggle=null}get expanded(){return this.hasAttribute(`expanded`)}toggle(e=!this.expanded){this.toggleAttribute(`expanded`,!!e),this._sync(),this.dispatchEvent(new CustomEvent(`wui:show-more:toggle`,{bubbles:!0,detail:{expanded:this.expanded}}))}_sync(){let e=this.expanded;this._toggle.setAttribute(`aria-expanded`,String(e)),this._toggle.textContent=e?this.getAttribute(`less-label`)||Ru:this.getAttribute(`more-label`)||Lu}_check(){let e=this.querySelector(`.wui-show-more-body`);if(!e)return;this._width=this.clientWidth;let t=this.expanded;t&&this.removeAttribute(`expanded`);let n=e.scrollHeight>e.clientHeight+1;t&&this.setAttribute(`expanded`,``),this._toggle.hidden=!n}},Bu=class extends l{static formAssociated=!0;static get observedAttributes(){return[`min`,`max`,`step`,`value`,`start`,`end`,`name`,`start-name`,`end-name`,`disabled`,`size`,`show-value`,`unit`,`aria-label`]}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._value=50,this._start=25,this._end=75,this._isDragging=!1,this._dragThumb=null,this._pointerDownListener=null,this._pointerMoveListener=null,this._pointerUpListener=null,this._thumbKeyListener=null,this._trackClickListener=null}connectedCallback(){if(!this._rendered){this.render();return}this._wire()}get value(){return this._value}set value(e){this._value=this._snapToStep(this._clamp(Vu(e,this._value))),this._syncValue(),this._syncMirrors()}get start(){return this._start}set start(e){this._start=Math.min(this._snapToStep(this._clamp(Vu(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(Vu(e,this._end))),this._start),this._syncValue(),this._syncMirrors()}attributeChangedCallback(e,t,n){if(e===`value`||e===`start`||e===`end`||e===`min`||e===`max`||e===`step`){this._updateFromAttribute(e),this._rendered&&(this._syncValue(),this._syncMirrors());return}this._rendered&&this.render()}formResetCallback(){this._isRange()?this._resetRange():this._resetSingle()}_updateFromAttribute(e){e===`value`?this._value=this._snapToStep(this._clamp(Vu(this.getAttribute(`value`),this._value))):e===`start`?this._start=this._snapToStep(this._clamp(Vu(this.getAttribute(`start`),this._start))):e===`end`&&(this._end=this._snapToStep(this._clamp(Vu(this.getAttribute(`end`),this._end))))}_isRange(){return this.hasAttribute(`range`)}_min(){return Vu(this.getAttribute(`min`),0)}_max(){return Vu(this.getAttribute(`max`),100)}_step(){return Vu(this.getAttribute(`step`),1)}_clamp(e){return Math.max(this._min(),Math.min(e,this._max()))}_snapToStep(e){let t=this._step();if(t<=0)return e;let n=this._min();return this._clamp(n+Math.round((e-n)/t)*t)}_captureDefaults(){this._defaultsCaptured||=(this._isRange()?(this._defaultStart=this._start,this._defaultEnd=this._end):this._defaultValue=this._value,!0)}_resetSingle(){this._value=this._defaultValue??50,this._syncValue(),this._syncMirrors()}_resetRange(){this._start=this._defaultStart??25,this._end=this._defaultEnd??75,this._syncValue(),this._syncMirrors()}render(){this._captureDefaults();let e=this._min(),t=this._max(),n=this._isRange(),r=this.getAttribute(`size`),i=r===`sm`?` slider-sm`:r===`lg`?` slider-lg`:``,a=this.hasAttribute(`disabled`);n?(this._start=this._clamp(this._start),this._end=this._clamp(this._end),this._start>this._end&&([this._start,this._end]=[this._end,this._start])):this._value=this._clamp(this._value);let o=n=>t===e?0:(n-e)/(t-e)*100,s=n?o(this._start):0,c=o(n?this._end:this._value);this.innerHTML=`
384
+ <input type="tel" class="input" placeholder="${Xl(e)}" value="${Xl(Vl(this._country,this._national))}"${this.getAttribute(`aria-label`)?` aria-label="${Xl(this.getAttribute(`aria-label`))}"`:``}${this.getAttribute(`aria-describedby`)?` aria-describedby="${Xl(this.getAttribute(`aria-describedby`))}"`:``}${this.hasAttribute(`required`)?` required aria-required="true"`:``}${this.hasAttribute(`disabled`)?` disabled`:``} />
385
+ </div>`,this._rendered=!0,z(this,this.value),this._wire()}_ensureItems(){let e=this.querySelector(`.country-list-scroll`);if(!e||e.querySelector(`.country-dropdown-item`))return;let t=this._listboxId,n=Ha.map(([e,n,r],i)=>`<button type="button" role="option" id="${Xl(`${t}-opt-${i}`)}" class="country-dropdown-item${e===this._country?` selected`:``}" data-iso="${e}" aria-selected="${e===this._country}"><span class="${Il(e)}" aria-hidden="true"></span><span class="country-name-text">${n}<span class="country-code-text">+${r}</span></span></button>`).join(``);e.insertAdjacentHTML(`afterbegin`,n)}_itemEls(){return[...this.querySelectorAll(`.country-dropdown-item`)]}_visibleItems(){return this._itemEls().filter(e=>!e.hidden)}_wire(){this._teardown();let e=this.querySelector(`.country-toggle`),t=this.querySelector(`.phone-input-wrap`),n=this.querySelector(`.country-dropdown-menu`),r=this.querySelector(`.dropdown-search-input`),i=this.querySelector(`.country-list-scroll`),a=this.querySelector(`.country-empty`),l=this.querySelector(`input[type=tel]`),u=this.querySelector(`[data-flag]`),d=this.querySelector(`[data-dial]`);if(!e||!n)return;let f=()=>!n.hidden,p=()=>o(t||e,n),m=(e,{reveal:t=!0}={})=>{let n=this._visibleItems();this._active=e,di(i,e>=0&&n[e]||null),e>=0&&n[e]?(t&&n[e].scrollIntoView({block:`nearest`}),r?.setAttribute(`aria-activedescendant`,n[e].id)):r?.removeAttribute(`aria-activedescendant`)},h=()=>{f()&&p()},g=()=>{this._ensureItems(),n.hidden=!1,e.setAttribute(`aria-expanded`,`true`),r.value=``,v(``),p(),s(this,h),r.focus(),m(this._visibleItems().findIndex(e=>e.classList.contains(`selected`)))},_=()=>{n.hidden=!0,e.setAttribute(`aria-expanded`,`false`),m(-1),c(this)},v=e=>{let t=e.trim().toLowerCase(),n=0;for(let e of this._itemEls()){let r=!t||e.textContent.toLowerCase().includes(t);e.hidden=!r,r&&(n+=1)}a&&(a.hidden=n>0)},y=e=>{this._country=e,this.getAttribute(`country`)!==e&&(this._suppressCountryRender=!0,this.setAttribute(`country`,e),this._suppressCountryRender=!1),u&&(u.className=Il(e)),d&&(d.textContent=`+${Ua(e)}`);for(let t of this._itemEls()){let n=t.dataset.iso===e;t.classList.toggle(`selected`,n),t.setAttribute(`aria-selected`,String(n))}!this.getAttribute(`placeholder`)&&l&&(l.placeholder=Wl(e)||`Enter phone number`),l&&this._national&&(l.value=Vl(e,this._national)),_(),this._syncMirror(),this._emitChange(),this._validateOnInput&&x(S()),l?.focus()},b=t=>{let n=this._visibleItems();if(t.key===`ArrowDown`){if(t.preventDefault(),!f()){g();return}m(Math.min(this._active+1,n.length-1))}else if(t.key===`ArrowUp`){if(t.preventDefault(),!f())return;m(Math.max(this._active-1,0))}else t.key===`Enter`?(t.preventDefault(),f()&&n[this._active]&&y(n[this._active].dataset.iso)):t.key===`Escape`&&f()&&(t.preventDefault(),t.stopPropagation(),_(),e.focus())};e.addEventListener(`click`,()=>f()?_():g()),e.addEventListener(`keydown`,e=>{if(f()){b(e);return}(e.key===`ArrowDown`||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),g())}),r.addEventListener(`input`,()=>{v(r.value);let e=this._visibleItems();m(e.length?0:-1)}),i.addEventListener(`click`,e=>{let t=e.target.closest(`.country-dropdown-item`);t&&y(t.dataset.iso)}),i.addEventListener(`mousemove`,e=>{let t=e.target.closest(`.country-dropdown-item`);t&&!t.classList.contains(`is-active`)&&m(this._visibleItems().indexOf(t),{reveal:!1})}),i.addEventListener(`mouseleave`,()=>m(-1)),n.addEventListener(`keydown`,b);let x=e=>{l.classList.toggle(`is-invalid`,e),e?l.setAttribute(`aria-invalid`,`true`):l.removeAttribute(`aria-invalid`);let n=this.querySelector(`[data-phone-error]`);if(e){n||(n=document.createElement(`div`),n.className=`field-error`,n.id=`${this.id}-phone-error`,n.setAttribute(`data-phone-error`,``),t.after(n));let e=Ul(this._country);n.textContent=this._country?e?`Enter a valid phone number, e.g. ${e}`:`Enter a valid phone number`:`Choose a country`}else n?.remove();this._syncDescribedBy()},S=()=>this._national.length>0&&(!this._country||Gl(this.value)===!1);l.addEventListener(`input`,e=>{e.stopPropagation();let t=l.selectionStart??l.value.length,n=l.value.slice(0,t).replace(/[^0-9]/g,``).length,r=l.value.replace(/[^0-9]/g,``),i=Kl(this._country);if(i&&r.length>i){let e=ql(this._country,r,i);e?(n=Math.max(0,n-(r.length-e.length)),r=e):r=r.slice(0,i)}this._national=r;let a=Vl(this._country,this._national);if(l.value!==a){l.value=a;let e=Hl(a,Math.min(n,r.length));l.setSelectionRange(e,e)}this._syncMirror(),this._emitInput(),this._validateOnInput&&x(S())}),l.addEventListener(`change`,e=>e.stopPropagation()),l.addEventListener(`blur`,()=>{let e=S();x(e),e&&(this._validateOnInput=!0),this.value!==this._committedValue&&this._emitChange()}),l.addEventListener(`paste`,e=>{let t=Jl(e.clipboardData?.getData(`text`));t&&(e.preventDefault(),this._national=t.national.replace(/[^0-9]/g,``),t.country===this._country?l.value=Vl(this._country,this._national):this.setAttribute(`country`,t.country),this._syncMirror(),this._emitInput(),this._emitChange(),this._validateOnInput&&l.isConnected&&x(S()),this.querySelector(`input[type=tel]`)?.focus())}),this._bindGlobal=()=>{this._teardownGlobals?.(),this._onDocClick=e=>{f()&&!this.contains(e.target)&&_()},document.addEventListener(`click`,this._onDocClick),f()&&s(this,h)},this._teardownGlobals=()=>{this._onDocClick&&=(document.removeEventListener(`click`,this._onDocClick),null),c(this)},this._bindGlobal(),this._validateOnInput&&x(S()),zl().then(e=>{if(!(!e||!l.isConnected)&&(this._national&&(l.value=Vl(this._country,this._national)),!this.getAttribute(`placeholder`))){let e=Wl(this._country);e&&(l.placeholder=e)}}),this._syncMirror()}_teardown(){this._teardownGlobals?.()}disconnectedCallback(){this._teardown()}},Xl=e=>String(e??``).replace(/"/g,`&quot;`).replace(/</g,`&lt;`),Zl=`.wui-rating-star`,Ql=`wui-rating-star-preview`,$l=`wui-rating-previewing`,eu=[`wui-rating-star-full`,`wui-rating-star-half`,`wui-rating-star-empty`],tu=class extends l{constructor(){super(),this._onChange=e=>{let t=e.target;t?.type===`radio`&&this._fill(Number(t.value))},this._onOver=e=>{if(this.hasAttribute(`disabled`))return;let t=e.target.closest?.(Zl);t&&this._preview(Number(t.dataset.value))},this._onLeave=()=>this._preview(0)}connectedCallback(){this.addEventListener(`change`,this._onChange),this.addEventListener(`mouseover`,this._onOver),this.addEventListener(`mouseleave`,this._onLeave)}disconnectedCallback(){this.removeEventListener(`change`,this._onChange),this.removeEventListener(`mouseover`,this._onOver),this.removeEventListener(`mouseleave`,this._onLeave)}_fill(e){for(let t of this.querySelectorAll(Zl))t.classList.remove(...eu),t.classList.add(Number(t.dataset.value)<=e?eu[0]:eu[2])}_preview(e){this.classList.toggle($l,e>0);for(let t of this.querySelectorAll(Zl))t.classList.toggle(Ql,e>0&&Number(t.dataset.value)<=e)}},nu=class extends l{constructor(){super(),this._doc=null,this._onKeyDown=e=>{this.hasAttribute(`keys`)&&E(e,{j:()=>this._press(`.wui-record-pager-next`),k:()=>this._press(`.wui-record-pager-prev`)},this.closest(`[${d}]`))}}connectedCallback(){this._doc=this.ownerDocument,this._doc.addEventListener(`keydown`,this._onKeyDown)}disconnectedCallback(){this._doc?.removeEventListener(`keydown`,this._onKeyDown),this._doc=null}_press(e){let t=this.querySelector(e);!t||t.disabled||t.getAttribute(`aria-disabled`)===`true`||t.click()}},ru=6e4,iu=60*ru,au=24*iu,ou=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function su(e,t=Date.now()){let n=Le(e);if(!Number.isFinite(n))return`-`;let r=t-n,i=Math.abs(r);if(i>=7*au)return ze(n);if(i<ru)return`just now`;let[a,o]=i<iu?[Math.floor(i/ru),`minute`]:i<au?[Math.floor(i/iu),`hour`]:[Math.floor(i/au),`day`];return r>0?`${ou(a,o)} ago`:`in ${ou(a,o)}`}function cu(e){let t=Le(e);return Number.isFinite(t)?`${ze(t,{pattern:`datetime`})} IST`:`-`}var lu=3e4,uu=new Set,du=null,fu=()=>{if(!(typeof document<`u`&&document.hidden))for(let e of uu)e.refresh()},pu=e=>{uu.add(e),uu.size===1&&(du=setInterval(fu,lu),document.addEventListener(`visibilitychange`,fu))},mu=e=>{uu.delete(e),uu.size===0&&(clearInterval(du),du=null,document.removeEventListener(`visibilitychange`,fu))},hu=class extends l{constructor(){super(),this._observer=null}connectedCallback(){this.refresh(),pu(this),this._observer=new MutationObserver(()=>this.refresh()),this._observer.observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:[`datetime`]})}disconnectedCallback(){mu(this),this._observer?.disconnect(),this._observer=null}refresh(){let e=this.querySelector(`time[datetime]`);if(!e)return;let t=su(e.getAttribute(`datetime`));e.textContent!==t&&(e.textContent=t)}},gu=`wui-resizable-panel`,_u=`wui-resizable-handle`,vu=5,yu=20,bu=10,xu=`wui-resizable:`,Su=.001,Cu=0,wu=e=>e.reduce((e,t)=>e+t,0),Tu=(e,t,n)=>Math.min(Math.max(e,t),n),Eu=e=>Math.round(e*10)/10,Du=(e,t)=>e.length===t.length&&e.every((e,n)=>Math.abs(e-t[n])<Su);function Ou(e,t,n){let r=e.map((e,r)=>Tu(e,t[r],n[r]));for(let e=0;e<r.length;e++){let e=100-wu(r);if(Math.abs(e)<Su)break;let i=r.map((r,i)=>e>0?n[i]-r:r-t[i]),a=wu(i);if(a<=0)break;let o=Math.min(Math.abs(e),a);r=r.map((t,n)=>t+Math.sign(e)*o*i[n]/a)}return r}function ku(e,t,n,r){let i=e[t]+e[t+1];return[Math.max(n[t],i-r[t+1]),Math.min(r[t],i-n[t+1])]}function Au(e,t,n,r,i){let[a,o]=ku(e,t,r,i);if(a>o)return e;let s=e[t]+e[t+1],c=Tu(e[t]+n,a,o),l=[...e];return l[t]=c,l[t+1]=s-c,l}function ju(e){let t=e.filter(e=>e===null).length,n=wu(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=wu(r);return r.map(e=>e*100/i)}var Mu=(e,t)=>{let n=Number.parseFloat(e.getAttribute(t));return Number.isFinite(n)&&n>0?n:null},Nu=class extends l{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.classList.contains(gu)),this._handles=e.filter(e=>e.classList.contains(_u));let t=this._panels.length;if(t===0)return;this._mins=this._panels.map(e=>Mu(e,`data-min-size`)??bu),this._maxs=this._panels.map(e=>Mu(e,`data-max-size`)??100),this._defaults=Ou(ju(this._panels.map(e=>Mu(e,`data-default-size`))),this._mins,this._maxs);let n=this._sizes&&this._sizes.length===t?this._sizes:null;this._sizes=Ou(n??this._load(t)??this._defaults,this._mins,this._maxs);for(let e of this._panels)e.id||=`wui-resizable-panel-${++Cu}`;this._render()}_render(){this._panels.forEach((e,t)=>{e.style.flex=`${Eu(this._sizes[t])} 1 0px`});for(let e of this._handles){let t=this._indexOf(e);if(t<0)continue;let[n,r]=ku(this._sizes,t,this._mins,this._maxs);e.setAttribute(`aria-controls`,this._panels[t].id),e.setAttribute(`aria-valuenow`,String(Math.round(this._sizes[t]))),e.setAttribute(`aria-valuemin`,String(Math.ceil(n-Su))),e.setAttribute(`aria-valuemax`,String(Math.floor(r+Su)))}}_indexOf(e){let t=this._panels.indexOf(e.previousElementSibling);return t>=0&&e.nextElementSibling===this._panels[t+1]?t:-1}_handleFor(e){let t=e.target instanceof Element?e.target.closest(`.${_u}`):null;if(!t||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?xu+e:null}_load(e){let t=this._storageKey();if(!t)return null;try{let n=JSON.parse(globalThis.localStorage?.getItem(t)??`null`);return Array.isArray(n)&&n.length===e&&n.every((e,t)=>Number.isFinite(e)&&e>=this._mins[t]-Su&&e<=this._maxs[t]+Su)&&Math.abs(wu(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(Eu)))}catch{}}_commit(e){Du(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=Au(t.before,t.index,r,this._mins,this._maxs),this._render()}_pointerUp(e,t){let n=this._drag;if(!(!n||e.pointerId!==n.pointerId)){if(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();return}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?yu:vu,o;if(e.key===n)o=i?a:-a;else if(e.key===r)o=i?-a:a;else if(e.key===`Home`)o=-1/0;else if(e.key===`End`)o=1/0;else return;e.preventDefault();let s=[...this._sizes];this._sizes=Au(s,t.index,o,this._mins,this._maxs),this._render(),this._commit(s)}_reset(e){if(!this._handleFor(e))return;let t=[...this._sizes];this._sizes=[...this._defaults],this._render(),this._commit(t)}},Pu=/^[0-9]$/,Fu=()=>typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches,Iu=class extends l{static get observedAttributes(){return[`value`,`format`,`unit`,`decimals`,`duration`]}constructor(){super(),this._connected=!1,this._signature=null,this._digits=[],this._reels=[]}connectedCallback(){this._connected=!0,this._draw(!1)}disconnectedCallback(){this._connected=!1}attributeChangedCallback(){this._connected&&this._draw(!0)}_text(){let e=this.getAttribute(`value`),t=e===null||e.trim()===``?NaN:Number(e);if(!Number.isFinite(t))return null;let n=this.getAttribute(`decimals`);return Be(t,{style:this.getAttribute(`format`)||`number`,unit:this.getAttribute(`unit`)||void 0,decimals:n===null||n===``?void 0:Number(n)})}_showText(e){let t=this.querySelector(`.wui-rolling-number-text`);!t||t.textContent===e||(t.firstChild?t.firstChild.nodeValue=e:t.append(e))}_clear(e){e.replaceChildren(),this.removeAttribute(`data-ready`),this._signature=null,this._digits=[],this._reels=[]}_draw(e){let t=this.querySelector(`.wui-rolling-number-roll`);if(!t)return;let n=this._text();if(n===null){this._clear(t);return}if(this._showText(n),Fu()){this._clear(t);return}let r=Number(this.getAttribute(`duration`));this.getAttribute(`duration`)&&Number.isFinite(r)&&r>=0?this.style.setProperty(`--wui-roll-duration`,`${r}ms`):this.style.removeProperty(`--wui-roll-duration`);let i=[...n],a=i.filter(e=>Pu.test(e)).map(Number),o=i.map(e=>Pu.test(e)?`#`:e).join(``);if(e&&o===this._signature){this._reels.forEach((e,t)=>e.style.setProperty(`--wui-roll-digit`,String(a[t]))),this._digits=a;return}let s=this._digits,c=[],l=[],u=0;for(let t of i){if(!Pu.test(t)){let e=document.createElement(`span`);e.className=`wui-rolling-number-char`,e.textContent=t,l.push(e);continue}let n=document.createElement(`span`);n.className=`wui-rolling-number-digit`;let r=document.createElement(`span`);r.className=`wui-rolling-number-reel`;for(let e=0;e<10;e+=1){let t=document.createElement(`span`);t.textContent=String(e),r.append(t)}let i=a.length-1-u,o=e?s[s.length-1-i]??0:a[u];r.style.setProperty(`--wui-roll-digit`,String(o)),n.append(r),l.push(n),c.push(r),u+=1}t.replaceChildren(...l),e&&(t.offsetWidth,c.forEach((e,t)=>e.style.setProperty(`--wui-roll-digit`,String(a[t])))),this._signature=o,this._digits=a,this._reels=c,this.setAttribute(`data-ready`,``)}},Lu=class extends l{constructor(){super(),this._doc=null,this._onKeyDown=e=>this._keydown(e),this._onClick=e=>this._click(e),this._onDocClick=e=>{this.open&&!this.contains(e.target)&&this.setOpen(!1,{focus:!1})}}connectedCallback(){this._doc=this.ownerDocument,this._doc.addEventListener(`keydown`,this._onKeyDown),this._doc.addEventListener(`click`,this._onDocClick),this.addEventListener(`click`,this._onClick)}disconnectedCallback(){this._doc?.removeEventListener(`keydown`,this._onKeyDown),this._doc?.removeEventListener(`click`,this._onDocClick),this.removeEventListener(`click`,this._onClick),this._doc=null}get open(){let e=this._sheet();return!!(e&&!e.hidden)}set open(e){let t=e===!0||e===``||e===`true`;t!==this.open&&this.setOpen(t)}setOpen(e,{focus:t=!0}={}){let n=this._sheet();if(!n)return;n.hidden=!e;let r=this.querySelector(`.wui-shortcut-toggle`);r?.setAttribute(`aria-expanded`,String(e)),t&&(e?n.querySelector(`.wui-shortcut-close`)?.focus():r?.focus())}_sheet(){return this.querySelector(`.wui-shortcut-sheet`)}_scope(){return this.closest(`[${d}]`)}_items(){let e=this.getAttribute(`items`);return e?[...(this._scope()??this._doc).querySelectorAll(e)]:[]}_click(e){let t=e.target;t instanceof Element&&(t.closest(`.wui-shortcut-toggle`)?this.setOpen(!this.open):t.closest(`.wui-shortcut-close`)&&this.setOpen(!1))}_tickFocused(){let e=this._items(),t=this._doc.activeElement,n=t?.closest?.(`li, tr`),r=e.find(e=>e===t||e.contains(t)||n?.contains(e));(r?.closest(`li, tr`)??r)?.querySelector(`input[type="checkbox"]`)?.click()}_focusSearch(){let e=this.getAttribute(`search`);((this._scope()??this._doc).querySelector(e)??this._doc.querySelector(e))?.focus()}_keydown(e){if(e.defaultPrevented)return;let t=S(e);if(!t)return;if(t===`esc`&&this.open){e.preventDefault(),this.setOpen(!1);return}let n=this._scope(),r={help:()=>this.setOpen(!this.open)};if(this.getAttribute(`items`)&&(r.j=()=>D(this._items(),1),r.k=()=>D(this._items(),-1),r.x=()=>this._tickFocused()),this.getAttribute(`search`)&&(r.slash=()=>this._focusSearch()),r[t]){E(e,r,n);return}if(t===`enter`||w(this._doc)||!T(e.target,n)||C(e.target))return;let i=ee(t),a=[...this.querySelectorAll(`.wui-shortcut-keys [data-shortcut]`)].find(e=>e.dataset.shortcut===i);if(!a)return;let o=(n??this._doc).querySelector(`[aria-current="true"]`)?.closest(`[data-key]`)?.dataset.key??null;if(!this.dispatchEvent(new CustomEvent(`wui:shortcut`,{bubbles:!0,cancelable:!0,detail:{key:i,itemKey:o}}))){e.preventDefault();return}let s=a.dataset.target?this._doc.querySelector(a.dataset.target):null;s&&(e.preventDefault(),s.click())}},Ru=3,zu=`Show more`,Bu=`Show less`,Vu=class extends l{constructor(){super(),this._width=-1,this._observer=null,this._toggle=null,this._onClick=()=>this.toggle()}connectedCallback(){if(this._toggle=this.querySelector(`.wui-show-more-toggle`),!this._toggle)return;let e=Number.parseInt(this.getAttribute(`lines`),10);this.style.setProperty(`--wui-show-more-lines`,String(e>=1?e:Ru)),this._toggle.addEventListener(`click`,this._onClick),this._sync(),this._check(),typeof ResizeObserver<`u`&&(this._observer=new ResizeObserver(()=>{this.clientWidth!==this._width&&this._check()}),this._observer.observe(this))}disconnectedCallback(){this._observer?.disconnect(),this._observer=null,this._toggle?.removeEventListener(`click`,this._onClick),this._toggle=null}get expanded(){return this.hasAttribute(`expanded`)}toggle(e=!this.expanded){this.toggleAttribute(`expanded`,!!e),this._sync(),this.dispatchEvent(new CustomEvent(`wui:show-more:toggle`,{bubbles:!0,detail:{expanded:this.expanded}}))}_sync(){let e=this.expanded;this._toggle.setAttribute(`aria-expanded`,String(e)),this._toggle.textContent=e?this.getAttribute(`less-label`)||Bu:this.getAttribute(`more-label`)||zu}_check(){let e=this.querySelector(`.wui-show-more-body`);if(!e)return;this._width=this.clientWidth;let t=this.expanded;t&&this.removeAttribute(`expanded`);let n=e.scrollHeight>e.clientHeight+1;t&&this.setAttribute(`expanded`,``),this._toggle.hidden=!n}},Hu=class extends l{static formAssociated=!0;static get observedAttributes(){return[`min`,`max`,`step`,`value`,`start`,`end`,`name`,`start-name`,`end-name`,`disabled`,`size`,`show-value`,`unit`,`aria-label`]}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._value=50,this._start=25,this._end=75,this._isDragging=!1,this._dragThumb=null,this._pointerDownListener=null,this._pointerMoveListener=null,this._pointerUpListener=null,this._thumbKeyListener=null,this._trackClickListener=null}connectedCallback(){if(!this._rendered){this.render();return}this._wire()}get value(){return this._value}set value(e){this._value=this._snapToStep(this._clamp(Uu(e,this._value))),this._syncValue(),this._syncMirrors()}get start(){return this._start}set start(e){this._start=Math.min(this._snapToStep(this._clamp(Uu(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(Uu(e,this._end))),this._start),this._syncValue(),this._syncMirrors()}attributeChangedCallback(e,t,n){if(e===`value`||e===`start`||e===`end`||e===`min`||e===`max`||e===`step`){this._updateFromAttribute(e),this._rendered&&(this._syncValue(),this._syncMirrors());return}this._rendered&&this.render()}formResetCallback(){this._isRange()?this._resetRange():this._resetSingle()}_updateFromAttribute(e){e===`value`?this._value=this._snapToStep(this._clamp(Uu(this.getAttribute(`value`),this._value))):e===`start`?this._start=this._snapToStep(this._clamp(Uu(this.getAttribute(`start`),this._start))):e===`end`&&(this._end=this._snapToStep(this._clamp(Uu(this.getAttribute(`end`),this._end))))}_isRange(){return this.hasAttribute(`range`)}_min(){return Uu(this.getAttribute(`min`),0)}_max(){return Uu(this.getAttribute(`max`),100)}_step(){return Uu(this.getAttribute(`step`),1)}_clamp(e){return Math.max(this._min(),Math.min(e,this._max()))}_snapToStep(e){let t=this._step();if(t<=0)return e;let n=this._min();return this._clamp(n+Math.round((e-n)/t)*t)}_captureDefaults(){this._defaultsCaptured||=(this._isRange()?(this._defaultStart=this._start,this._defaultEnd=this._end):this._defaultValue=this._value,!0)}_resetSingle(){this._value=this._defaultValue??50,this._syncValue(),this._syncMirrors()}_resetRange(){this._start=this._defaultStart??25,this._end=this._defaultEnd??75,this._syncValue(),this._syncMirrors()}render(){this._captureDefaults();let e=this._min(),t=this._max(),n=this._isRange(),r=this.getAttribute(`size`),i=r===`sm`?` slider-sm`:r===`lg`?` slider-lg`:``,a=this.hasAttribute(`disabled`);n?(this._start=this._clamp(this._start),this._end=this._clamp(this._end),this._start>this._end&&([this._start,this._end]=[this._end,this._start])):this._value=this._clamp(this._value);let o=n=>t===e?0:(n-e)/(t-e)*100,s=n?o(this._start):0,c=o(n?this._end:this._value);this.innerHTML=`
386
386
  <div class="slider${i}">
387
387
  <div class="slider-track" role="presentation"></div>
388
388
  <div class="slider-fill" style="left: ${s}%; right: ${100-c}%;" role="presentation"></div>
@@ -425,17 +425,17 @@ var WeborityUiElements=(function(e){Object.defineProperty(e,Symbol.toStringTag,{
425
425
  aria-valuenow="${this._value}"
426
426
  aria-valuetext="${this._formatValue(this._value)}"
427
427
  ${a?`disabled`:``}
428
- aria-label="${Hu(this.getAttribute(`aria-label`)||`Value`)}"
428
+ aria-label="${Wu(this.getAttribute(`aria-label`)||`Value`)}"
429
429
  ></button>
430
430
  `}
431
431
  ${this.hasAttribute(`show-value`)?n?`<span class="slider-value">${this._formatValue(this._start)} to ${this._formatValue(this._end)}</span>`:`<span class="slider-value">${this._formatValue(this._value)}</span>`:``}
432
432
  </div>
433
- `,this._rendered=!0,this._placeParts(),this._syncMirrors(),this._wire()}_formatValue(e){return`${e}${this.getAttribute(`unit`)||``}`}_placeParts(){let e=this._min(),t=this._max(),n=n=>t===e?0:(n-e)/(t-e),r=this._isRange(),i=r?n(this._start):0,a=n(r?this._end:this._value),o=this.querySelector(`.slider-fill`);o&&(o.style.left=`${i*100}%`,o.style.right=`${100-a*100}%`,r&&o.style.setProperty(`--wui-fill-start`,String(i)),o.style.setProperty(`--wui-fill-end`,String(a)));let s=(e,t)=>{e&&(e.style.left=`${t*100}%`,e.style.setProperty(`--wui-t`,String(t)))};r?(s(this.querySelector(`[data-thumb="start"]`),i),s(this.querySelector(`[data-thumb="end"]`),a)):s(this.querySelector(`.slider-thumb`),a)}_syncValue(){if(this._rendered)if(this._placeParts(),this._isRange()){let e=this.querySelector(`[data-thumb="start"]`),t=this.querySelector(`[data-thumb="end"]`);e&&(e.setAttribute(`aria-valuenow`,String(this._start)),e.setAttribute(`aria-valuetext`,this._formatValue(this._start))),t&&(t.setAttribute(`aria-valuenow`,String(this._end)),t.setAttribute(`aria-valuetext`,this._formatValue(this._end)));let n=this.querySelector(`.slider-value`);n&&(n.textContent=`${this._formatValue(this._start)} to ${this._formatValue(this._end)}`)}else{let e=this.querySelector(`.slider-thumb`);e&&(e.setAttribute(`aria-valuenow`,String(this._value)),e.setAttribute(`aria-valuetext`,this._formatValue(this._value)));let t=this.querySelector(`.slider-value`);t&&(t.textContent=this._formatValue(this._value))}}_syncMirrors(){this._isRange()?this._syncRangeMirrors():this._syncSingleMirror()}_syncSingleMirror(){this.getAttribute(`name`)&&z(this,String(this._value))}_syncRangeMirrors(){let e=this.getAttribute(`start-name`)||this.getAttribute(`name`),t=this.getAttribute(`end-name`);this._mirrorRange(`start`,e,this._start),this._mirrorRange(`end`,t,this._end)}_mirrorRange(e,t,n){if(!t)return;let r=this.querySelector(`input[type="hidden"][data-slider-mirror="${e}"]`);r||(r=document.createElement(`input`),r.type=`hidden`,r.setAttribute(`data-slider-mirror`,e),this.appendChild(r)),r.name=t,r.value=String(n),r.disabled=this.hasAttribute(`disabled`)}_valueAtPosition(e){let t=this.querySelector(`.slider-track`);if(!t)return this._min();let n=t.getBoundingClientRect(),r=this.querySelector(`.slider-thumb`),i=r?r.offsetWidth/2:0,a=n.width-i*2,o=a>0?Math.max(0,Math.min(1,(e-n.left-i)/a)):0,s=this._min()+o*(this._max()-this._min());return this._snapToStep(s)}_nearestThumb(e){return Math.abs(e-this._start)<=Math.abs(e-this._end)?`start`:`end`}_wire(){if(this._teardown(),this.hasAttribute(`disabled`))return;let e=this.querySelectorAll(`.slider-thumb`),t=this.querySelector(`.slider-track`),n=this._isRange();this._pointerDownListener=e=>{if(this.hasAttribute(`disabled`))return;let t=e.target.closest(`.slider-thumb`);t&&(e.preventDefault(),this._isDragging=!0,this._dragThumb=t.getAttribute(`data-thumb`),document.addEventListener(`pointermove`,this._pointerMoveListener),document.addEventListener(`pointerup`,this._pointerUpListener),document.addEventListener(`pointercancel`,this._pointerUpListener))},this._pointerMoveListener=e=>{if(!this._isDragging)return;e.preventDefault();let t=this._valueAtPosition(e.clientX);if(this._dragThumb===`single`)this._value=this._clamp(t),this._syncValue(),this.dispatchEvent(new CustomEvent(`slide`,{detail:{value:this._value}}));else if(this._dragThumb===`start`){let e=Math.min(t,this._end);this._start=this._clamp(e),this._syncValue(),this.dispatchEvent(new CustomEvent(`slide`,{detail:{start:this._start,end:this._end}}))}else if(this._dragThumb===`end`){let e=Math.max(t,this._start);this._end=this._clamp(e),this._syncValue(),this.dispatchEvent(new CustomEvent(`slide`,{detail:{start:this._start,end:this._end}}))}},this._pointerUpListener=()=>{this._isDragging&&(this._isDragging=!1,this._dragThumb=null,document.removeEventListener(`pointermove`,this._pointerMoveListener),document.removeEventListener(`pointerup`,this._pointerUpListener),document.removeEventListener(`pointercancel`,this._pointerUpListener),this._syncMirrors(),this.dispatchEvent(new Event(`change`,{bubbles:!0})))},this._thumbKeyListener=e=>{let t=e.currentTarget;if(this.hasAttribute(`disabled`))return;let n=this._step(),r=n*10,i=null,a=t.getAttribute(`data-thumb`),o=a===`end`?this._end:a===`start`?this._start:this._value;e.key===`ArrowLeft`||e.key===`ArrowDown`?(e.preventDefault(),i=o-n):e.key===`ArrowRight`||e.key===`ArrowUp`?(e.preventDefault(),i=o+n):e.key===`PageDown`?(e.preventDefault(),i=o-r):e.key===`PageUp`?(e.preventDefault(),i=o+r):e.key===`Home`?(e.preventDefault(),i=this._min()):e.key===`End`&&(e.preventDefault(),i=this._max()),i!=null&&(i=this._clamp(i),a===`single`?this._value=i:a===`start`?this._start=Math.min(i,this._end):a===`end`&&(this._end=Math.max(i,this._start)),this._syncValue(),this._syncMirrors(),this.dispatchEvent(new Event(`change`,{bubbles:!0})))},this._trackClickListener=e=>{if(this.hasAttribute(`disabled`))return;let t=this._valueAtPosition(e.clientX);n?this._nearestThumb(t)===`start`?this._start=Math.min(this._clamp(t),this._end):this._end=Math.max(this._clamp(t),this._start):this._value=this._clamp(t),this._syncValue(),this._syncMirrors(),this.dispatchEvent(new Event(`change`,{bubbles:!0}))},e.forEach(e=>{e.addEventListener(`pointerdown`,this._pointerDownListener),e.addEventListener(`keydown`,this._thumbKeyListener)}),t?.addEventListener(`click`,this._trackClickListener)}_teardown(){for(let e of this.querySelectorAll(`.slider-thumb`))e.removeEventListener(`pointerdown`,this._pointerDownListener),e.removeEventListener(`keydown`,this._thumbKeyListener);document.removeEventListener(`pointermove`,this._pointerMoveListener),document.removeEventListener(`pointerup`,this._pointerUpListener),document.removeEventListener(`pointercancel`,this._pointerUpListener),this._isDragging=!1,this._dragThumb=null,this.querySelector(`.slider-track`)?.removeEventListener(`click`,this._trackClickListener)}disconnectedCallback(){this._teardown()}},Vu=(e,t)=>{let n=Number.parseFloat(e);return Number.isFinite(n)?n:t},Hu=e=>String(e??``).replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`),Uu=new Set,Wu=`.wui-sortable-handle`,Gu=`a[href],button,input,select,textarea,label,summary,[contenteditable='true'],[role='button'],[role='link']`,Ku=4,qu=8,Ju=250,Yu=48,Xu=18,Zu=class extends l{static get observedAttributes(){return[`name`,`disabled`]}constructor(){super(),this._drag=null,this._kb=null,this._moving=!1,this.controlled=!1,this._observer=null,this._onPointerDown=this._onPointerDown.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onFocusOut=this._onFocusOut.bind(this),this._onDragStart=e=>e.preventDefault(),this._onDocMove=this._onDocMove.bind(this),this._onDocUp=this._onDocUp.bind(this),this._onDocCancel=this._onDocCancel.bind(this),this._onDocKey=this._onDocKey.bind(this),this._onDocTouchMove=e=>{this._drag?.started&&e.preventDefault()},this._onSelectStart=e=>e.preventDefault(),this._scrollTick=this._scrollTick.bind(this)}connectedCallback(){Uu.add(this),this.addEventListener(`pointerdown`,this._onPointerDown),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`focusout`,this._onFocusOut),this.addEventListener(`dragstart`,this._onDragStart),this._observer=new MutationObserver(()=>this._syncMirrors()),this._observer.observe(this,{childList:!0}),this._syncMirrors()}disconnectedCallback(){Uu.delete(this),this.removeEventListener(`pointerdown`,this._onPointerDown),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`focusout`,this._onFocusOut),this.removeEventListener(`dragstart`,this._onDragStart),this._observer?.disconnect(),this._observer=null,this._abort()}attributeChangedCallback(e){e===`disabled`&&this._abort(),this.isConnected&&this._syncMirrors()}get order(){return this._items().map(e=>e.getAttribute(`data-id`))}set order(e){if(this._drag?.started||this._kb)return;let t=this._items(),n=new Map(t.map(e=>[e.getAttribute(`data-id`),e])),r=[];for(let t of e??[]){let e=n.get(String(t));e&&!r.includes(e)&&r.push(e)}[...r,...t.filter(e=>!r.includes(e))].forEach((e,t)=>{let n=this._items()[t];n!==e&&this.insertBefore(e,n)}),this._syncMirrors()}_items(){return[...this.querySelectorAll(`:scope > [data-id]`)]}_itemFrom(e){let t=e;for(;t&&t.parentElement!==this;)t=t.parentElement;return t?.hasAttribute(`data-id`)?t:null}_itemDisabled(e){return e.hasAttribute(`data-disabled`)}_horizontal(){return this.getAttribute(`orientation`)===`horizontal`}_syncMirrors(){B(this,this.order)}_insertAt(e,t){let n=this._items();if(n.indexOf(e)===t)return;let r=n.filter(t=>t!==e),i=r[t]??null;i?this.insertBefore(e,i):r.length>0?r[r.length-1].after(e):this.appendChild(e)}_indexFor(e,t,n){let r=this._items().filter(t=>t!==e),i=this._horizontal();for(let e=0;e<r.length;e++){let a=r[e].getBoundingClientRect();if(i?n<a.top||n<=a.bottom&&t<a.left+a.width/2:n<a.top+a.height/2)return e}return r.length}_peers(){let e=this.getAttribute(`group`);return[...Uu].filter(t=>t===this||e&&t.getAttribute(`group`)===e&&!t.hasAttribute(`disabled`))}_labelOf(e){return e.getAttribute(`data-label`)||e.textContent.replace(/\s+/g,` `).trim()||e.getAttribute(`data-id`)}_announce(e){let t=this.querySelector(`:scope > .wui-sortable-live`);t||(t=document.createElement(`div`),t.className=`wui-sortable-live`,t.setAttribute(`role`,`status`),t.setAttribute(`aria-live`,`polite`),t.setAttribute(`aria-atomic`,`true`),this.appendChild(t)),t.textContent=e}_position(e){let t=this._items();return`position ${t.indexOf(e)+1} of ${t.length}`}_onPointerDown(e){if(this._drag||this._kb||this.hasAttribute(`disabled`)||e.pointerType===`mouse`&&e.button!==0)return;let t=this._itemFrom(e.target);if(!t||this._itemDisabled(t))return;let n=t.querySelector(`:scope > ${Wu}`),r=!!n&&n.contains(e.target);if(this.hasAttribute(`handle`)&&!r)return;if(!r){let n=e.target.closest?.(Gu);if(n&&n!==t&&t.contains(n))return}let i=e.pointerType===`touch`&&!r,a={item:t,pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,x:e.clientX,y:e.clientY,slop:e.pointerType===`touch`?qu:Ku,ready:!i,started:!1,timer:null,raf:0,list:this,ghost:null};this._drag=a,i&&(a.timer=setTimeout(()=>{a.timer=null,a.ready=!0,this._begin()},Ju)),document.addEventListener(`pointermove`,this._onDocMove),document.addEventListener(`pointerup`,this._onDocUp),document.addEventListener(`pointercancel`,this._onDocCancel),document.addEventListener(`keydown`,this._onDocKey,!0),document.addEventListener(`touchmove`,this._onDocTouchMove,{passive:!1})}_onDocMove(e){let t=this._drag;if(!(!t||e.pointerId!==t.pointerId)){if(t.x=e.clientX,t.y=e.clientY,!t.started){let e=Math.hypot(t.x-t.startX,t.y-t.startY);if(!t.ready){e>t.slop&&this._finish(!0);return}if(e<t.slop||(this._begin(),!this._drag?.started))return}e.preventDefault?.(),this._moveGhost(),this._update()}}_onDocUp(e){this._drag&&e.pointerId===this._drag.pointerId&&this._finish(!1)}_onDocCancel(e){this._drag&&e.pointerId===this._drag.pointerId&&this._finish(!0)}_onDocKey(e){e.key!==`Escape`||!this._drag||(e.preventDefault(),e.stopPropagation(),this._finish(!0))}_begin(){let e=this._drag;if(!e||e.started)return;e.started=!0;let t=e.item.getBoundingClientRect();e.offsetX=e.startX-t.left,e.offsetY=e.startY-t.top,e.fromIndex=this._items().indexOf(e.item);let n=e.item.cloneNode(!0);for(let e of[n,...n.querySelectorAll(`[id],[data-id]`)])e.removeAttribute(`id`),e.removeAttribute(`data-id`);n.classList.add(`wui-sortable-ghost`),n.setAttribute(`aria-hidden`,`true`),n.inert=!0,n.style.width=`${t.width}px`,n.style.height=`${t.height}px`,e.ghost=n,e.item.classList.add(`wui-sortable-dragging`),document.body.appendChild(n),document.documentElement.classList.add(`wui-sortable-active`),document.addEventListener(`selectstart`,this._onSelectStart),this._moveGhost(),e.raf=requestAnimationFrame(this._scrollTick),this._emit(this,`wui-sortable:start`,{id:e.item.getAttribute(`data-id`)})}_moveGhost(){let e=this._drag;e?.ghost&&(e.ghost.style.transform=`translate(${e.x-e.offsetX}px, ${e.y-e.offsetY}px)`)}_update(){let e=this._drag;if(!e?.started)return;let t=e.list;for(let n of this._peers()){let r=n.getBoundingClientRect();if(e.x>=r.left&&e.x<=r.right&&e.y>=r.top&&e.y<=r.bottom){t=n;break}}let n=t._indexFor(e.item,e.x,e.y);(t!==e.list||n!==t._items().indexOf(e.item))&&t._insertAt(e.item,n),e.list=t}_scrollTick(){let e=this._drag;if(!e?.started)return;let t=$u(e.list),n=t?t.getBoundingClientRect():null,r=Math.max(n?.top??0,0),i=Math.min(n?.bottom??window.innerHeight,window.innerHeight),a=Math.max(n?.left??0,0),o=Math.min(n?.right??window.innerWidth,window.innerWidth),s=Qu(e.y,r,i),c=Qu(e.x,a,o);(c||s)&&(t?(t.scrollTop+=s,t.scrollLeft+=c):window.scrollBy(c,s),this._update()),e.raf=requestAnimationFrame(this._scrollTick)}_finish(e){let t=this._drag;if(!t||(this._drag=null,clearTimeout(t.timer),cancelAnimationFrame(t.raf),document.removeEventListener(`pointermove`,this._onDocMove),document.removeEventListener(`pointerup`,this._onDocUp),document.removeEventListener(`pointercancel`,this._onDocCancel),document.removeEventListener(`keydown`,this._onDocKey,!0),document.removeEventListener(`touchmove`,this._onDocTouchMove),document.removeEventListener(`selectstart`,this._onSelectStart),!t.started))return;t.ghost?.remove(),document.documentElement.classList.remove(`wui-sortable-active`),t.item.classList.remove(`wui-sortable-dragging`);let n=t.item.getAttribute(`data-id`);e?(this._insertAt(t.item,t.fromIndex),this._syncMirrors(),t.list!==this&&t.list._syncMirrors()):this._settle(t.item,this,t.fromIndex,t.list),this._emit(this,`wui-sortable:end`,{id:n,cancelled:e})}_settle(e,t,n,r){let i=r._items().indexOf(e);if(r===t&&i===n)return;let a=e.getAttribute(`data-id`),o=r.order,s=r!==t,c=t.order;s&&(t.controlled||r.controlled)&&t._insertAt(e,n),t._syncMirrors(),r._syncMirrors();let l=r._labelOf(e),u=s&&r.getAttribute(`aria-label`)?` to ${r.getAttribute(`aria-label`)}`:``,d={id:a,fromIndex:n,toIndex:i,from:t,to:r};s&&this._emit(t,`wui-sortable:change`,{...d,ids:c}),this._emit(r,`wui-sortable:change`,{...d,ids:o}),r._announce(`${l} moved${u}, position ${i+1} of ${o.length}.`)}_emit(e,t,n){e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n}))}_abort(){this._drag&&this._finish(!0),this._kb&&this._dropKeyboard(!0)}_onKeyDown(e){if(this.hasAttribute(`disabled`))return;let t=e.target.closest?.(Wu),n=t&&t.parentElement?.parentElement===this?t.parentElement:null;if(!n||this._itemDisabled(n)||this._drag)return;let r=e.key;if(!this._kb){if(r!==` `&&r!==`Enter`)return;e.preventDefault(),this._liftKeyboard(n,t);return}if(this._kb.item===n){if(r===` `||r===`Enter`)e.preventDefault(),this._dropKeyboard(!1);else if(r===`Escape`)e.preventDefault(),e.stopPropagation(),this._dropKeyboard(!0);else if([`ArrowUp`,`ArrowLeft`,`ArrowDown`,`ArrowRight`,`Home`,`End`].includes(r)){e.preventDefault();let i=this._items(),a=i.indexOf(n),o=i.length-1,s=r===`Home`?0:r===`End`?o:Math.max(0,Math.min(o,a+(r===`ArrowUp`||r===`ArrowLeft`?-1:1)));if(s===a){this._announce(`${this._labelOf(n)} is already ${a===0?`first`:`last`}, ${this._position(n)}.`);return}this._moveFocused(()=>this._insertAt(n,s),t),this._announce(`${this._labelOf(n)} moved to ${this._position(n)}.`)}}}_onFocusOut(e){!this._kb||this._moving||e.relatedTarget&&this._kb.handle.contains(e.relatedTarget)||this._dropKeyboard(!1)}_liftKeyboard(e,t){this._kb={item:e,handle:t,fromIndex:this._items().indexOf(e)},t.setAttribute(`aria-pressed`,`true`),this._announce(`${this._labelOf(e)} lifted, ${this._position(e)}. Use the arrow keys to move it, Space to drop it, Escape to cancel.`)}_dropKeyboard(e){let t=this._kb;if(t){if(this._kb=null,t.handle.removeAttribute(`aria-pressed`),e){this._moveFocused(()=>this._insertAt(t.item,t.fromIndex),t.handle),this._announce(`Reorder cancelled. ${this._labelOf(t.item)} is back at ${this._position(t.item)}.`);return}if(this._items().indexOf(t.item)===t.fromIndex){this._announce(`${this._labelOf(t.item)} dropped, ${this._position(t.item)}.`);return}this._settle(t.item,this,t.fromIndex,this)}}_moveFocused(e,t){this._moving=!0;let n=this.contains(document.activeElement);e(),n&&document.activeElement!==t&&t.focus(),this._moving=!1}};function Qu(e,t,n){return e<t+Yu?-Math.ceil(Xu*Math.min(1,(t+Yu-e)/Yu)):e>n-Yu?Math.ceil(Xu*Math.min(1,(e-(n-Yu))/Yu)):0}function $u(e){for(let t=e.parentElement;t&&t!==document.body&&t!==document.documentElement;t=t.parentElement){let e=getComputedStyle(t),n=/(auto|scroll)/.test(e.overflowY)&&t.scrollHeight>t.clientHeight,r=/(auto|scroll)/.test(e.overflowX)&&t.scrollWidth>t.clientWidth;if(n||r)return t}return null}var ed=class extends l{static formAssociated=!0;_accessibleName(){return this.getAttribute(`aria-label`)||this.getAttribute(`placeholder`)||`Add tags`}static get observedAttributes(){return[`placeholder`,`disabled`,`size`,`max-tags`,`aria-label`,`separators`,`allow-duplicates`,`aria-invalid`]}constructor(){super(),this._values=[],this._draftText=``;try{this._internals=this.attachInternals()}catch{this._internals=null}}connectedCallback(){if(!this._rendered){if(!this._valuesInit&&!this._values.length){let e=this.getAttribute(`value`);if(e!=null&&e!==``)this._values=e.split(`,`).map(e=>e.trim()).filter(Boolean);else{let e=[...this.querySelectorAll(`:scope > wui-tag`)].map(e=>e.textContent.trim());e.length&&(this._values=e.map(String))}}this._valuesInit=!0,this._defaultCaptured||=(this._defaultValues=this._values.slice(),!0),this.render();return}this._wire()}formResetCallback(){this.values=(this._defaultValues||[]).slice(),this._draftText=``;let e=this.querySelector(`[data-input]`);e&&(e.value=``)}attributeChangedCallback(e){if(e===`aria-invalid`){this._syncInvalid();return}if(this._rendered){if(e===`separators`||e===`allow-duplicates`){this._wire();return}this.render()}}_syncInvalid(){let e=this.querySelector(`.search-select-control`);e&&(this.hasAttribute(`aria-invalid`)?e.setAttribute(`aria-invalid`,`true`):e.removeAttribute(`aria-invalid`))}get values(){return this._values.slice()}set values(e){this._values=Array.isArray(e)?e.map(String):[],B(this,this._values),this._rendered&&this._renderControl()}render(){let e=this.getAttribute(`size`),t=e===`sm`?` search-select-sm`:e===`lg`?` search-select-lg`:``;B(this,this._values),this.innerHTML=`
433
+ `,this._rendered=!0,this._placeParts(),this._syncMirrors(),this._wire()}_formatValue(e){return`${e}${this.getAttribute(`unit`)||``}`}_placeParts(){let e=this._min(),t=this._max(),n=n=>t===e?0:(n-e)/(t-e),r=this._isRange(),i=r?n(this._start):0,a=n(r?this._end:this._value),o=this.querySelector(`.slider-fill`);o&&(o.style.left=`${i*100}%`,o.style.right=`${100-a*100}%`,r&&o.style.setProperty(`--wui-fill-start`,String(i)),o.style.setProperty(`--wui-fill-end`,String(a)));let s=(e,t)=>{e&&(e.style.left=`${t*100}%`,e.style.setProperty(`--wui-t`,String(t)))};r?(s(this.querySelector(`[data-thumb="start"]`),i),s(this.querySelector(`[data-thumb="end"]`),a)):s(this.querySelector(`.slider-thumb`),a)}_syncValue(){if(this._rendered)if(this._placeParts(),this._isRange()){let e=this.querySelector(`[data-thumb="start"]`),t=this.querySelector(`[data-thumb="end"]`);e&&(e.setAttribute(`aria-valuenow`,String(this._start)),e.setAttribute(`aria-valuetext`,this._formatValue(this._start))),t&&(t.setAttribute(`aria-valuenow`,String(this._end)),t.setAttribute(`aria-valuetext`,this._formatValue(this._end)));let n=this.querySelector(`.slider-value`);n&&(n.textContent=`${this._formatValue(this._start)} to ${this._formatValue(this._end)}`)}else{let e=this.querySelector(`.slider-thumb`);e&&(e.setAttribute(`aria-valuenow`,String(this._value)),e.setAttribute(`aria-valuetext`,this._formatValue(this._value)));let t=this.querySelector(`.slider-value`);t&&(t.textContent=this._formatValue(this._value))}}_syncMirrors(){this._isRange()?this._syncRangeMirrors():this._syncSingleMirror()}_syncSingleMirror(){this.getAttribute(`name`)&&z(this,String(this._value))}_syncRangeMirrors(){let e=this.getAttribute(`start-name`)||this.getAttribute(`name`),t=this.getAttribute(`end-name`);this._mirrorRange(`start`,e,this._start),this._mirrorRange(`end`,t,this._end)}_mirrorRange(e,t,n){if(!t)return;let r=this.querySelector(`input[type="hidden"][data-slider-mirror="${e}"]`);r||(r=document.createElement(`input`),r.type=`hidden`,r.setAttribute(`data-slider-mirror`,e),this.appendChild(r)),r.name=t,r.value=String(n),r.disabled=this.hasAttribute(`disabled`)}_valueAtPosition(e){let t=this.querySelector(`.slider-track`);if(!t)return this._min();let n=t.getBoundingClientRect(),r=this.querySelector(`.slider-thumb`),i=r?r.offsetWidth/2:0,a=n.width-i*2,o=a>0?Math.max(0,Math.min(1,(e-n.left-i)/a)):0,s=this._min()+o*(this._max()-this._min());return this._snapToStep(s)}_nearestThumb(e){return Math.abs(e-this._start)<=Math.abs(e-this._end)?`start`:`end`}_wire(){if(this._teardown(),this.hasAttribute(`disabled`))return;let e=this.querySelectorAll(`.slider-thumb`),t=this.querySelector(`.slider-track`),n=this._isRange();this._pointerDownListener=e=>{if(this.hasAttribute(`disabled`))return;let t=e.target.closest(`.slider-thumb`);t&&(e.preventDefault(),this._isDragging=!0,this._dragThumb=t.getAttribute(`data-thumb`),document.addEventListener(`pointermove`,this._pointerMoveListener),document.addEventListener(`pointerup`,this._pointerUpListener),document.addEventListener(`pointercancel`,this._pointerUpListener))},this._pointerMoveListener=e=>{if(!this._isDragging)return;e.preventDefault();let t=this._valueAtPosition(e.clientX);if(this._dragThumb===`single`)this._value=this._clamp(t),this._syncValue(),this.dispatchEvent(new CustomEvent(`slide`,{detail:{value:this._value}}));else if(this._dragThumb===`start`){let e=Math.min(t,this._end);this._start=this._clamp(e),this._syncValue(),this.dispatchEvent(new CustomEvent(`slide`,{detail:{start:this._start,end:this._end}}))}else if(this._dragThumb===`end`){let e=Math.max(t,this._start);this._end=this._clamp(e),this._syncValue(),this.dispatchEvent(new CustomEvent(`slide`,{detail:{start:this._start,end:this._end}}))}},this._pointerUpListener=()=>{this._isDragging&&(this._isDragging=!1,this._dragThumb=null,document.removeEventListener(`pointermove`,this._pointerMoveListener),document.removeEventListener(`pointerup`,this._pointerUpListener),document.removeEventListener(`pointercancel`,this._pointerUpListener),this._syncMirrors(),this.dispatchEvent(new Event(`change`,{bubbles:!0})))},this._thumbKeyListener=e=>{let t=e.currentTarget;if(this.hasAttribute(`disabled`))return;let n=this._step(),r=n*10,i=null,a=t.getAttribute(`data-thumb`),o=a===`end`?this._end:a===`start`?this._start:this._value;e.key===`ArrowLeft`||e.key===`ArrowDown`?(e.preventDefault(),i=o-n):e.key===`ArrowRight`||e.key===`ArrowUp`?(e.preventDefault(),i=o+n):e.key===`PageDown`?(e.preventDefault(),i=o-r):e.key===`PageUp`?(e.preventDefault(),i=o+r):e.key===`Home`?(e.preventDefault(),i=this._min()):e.key===`End`&&(e.preventDefault(),i=this._max()),i!=null&&(i=this._clamp(i),a===`single`?this._value=i:a===`start`?this._start=Math.min(i,this._end):a===`end`&&(this._end=Math.max(i,this._start)),this._syncValue(),this._syncMirrors(),this.dispatchEvent(new Event(`change`,{bubbles:!0})))},this._trackClickListener=e=>{if(this.hasAttribute(`disabled`))return;let t=this._valueAtPosition(e.clientX);n?this._nearestThumb(t)===`start`?this._start=Math.min(this._clamp(t),this._end):this._end=Math.max(this._clamp(t),this._start):this._value=this._clamp(t),this._syncValue(),this._syncMirrors(),this.dispatchEvent(new Event(`change`,{bubbles:!0}))},e.forEach(e=>{e.addEventListener(`pointerdown`,this._pointerDownListener),e.addEventListener(`keydown`,this._thumbKeyListener)}),t?.addEventListener(`click`,this._trackClickListener)}_teardown(){for(let e of this.querySelectorAll(`.slider-thumb`))e.removeEventListener(`pointerdown`,this._pointerDownListener),e.removeEventListener(`keydown`,this._thumbKeyListener);document.removeEventListener(`pointermove`,this._pointerMoveListener),document.removeEventListener(`pointerup`,this._pointerUpListener),document.removeEventListener(`pointercancel`,this._pointerUpListener),this._isDragging=!1,this._dragThumb=null,this.querySelector(`.slider-track`)?.removeEventListener(`click`,this._trackClickListener)}disconnectedCallback(){this._teardown()}},Uu=(e,t)=>{let n=Number.parseFloat(e);return Number.isFinite(n)?n:t},Wu=e=>String(e??``).replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`),Gu=new Set,Ku=`.wui-sortable-handle`,qu=`a[href],button,input,select,textarea,label,summary,[contenteditable='true'],[role='button'],[role='link']`,Ju=4,Yu=8,Xu=250,Zu=48,Qu=18,$u=class extends l{static get observedAttributes(){return[`name`,`disabled`]}constructor(){super(),this._drag=null,this._kb=null,this._moving=!1,this.controlled=!1,this._observer=null,this._onPointerDown=this._onPointerDown.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onFocusOut=this._onFocusOut.bind(this),this._onDragStart=e=>e.preventDefault(),this._onDocMove=this._onDocMove.bind(this),this._onDocUp=this._onDocUp.bind(this),this._onDocCancel=this._onDocCancel.bind(this),this._onDocKey=this._onDocKey.bind(this),this._onDocTouchMove=e=>{this._drag?.started&&e.preventDefault()},this._onSelectStart=e=>e.preventDefault(),this._scrollTick=this._scrollTick.bind(this)}connectedCallback(){Gu.add(this),this.addEventListener(`pointerdown`,this._onPointerDown),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`focusout`,this._onFocusOut),this.addEventListener(`dragstart`,this._onDragStart),this._observer=new MutationObserver(()=>this._syncMirrors()),this._observer.observe(this,{childList:!0}),this._syncMirrors()}disconnectedCallback(){Gu.delete(this),this.removeEventListener(`pointerdown`,this._onPointerDown),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`focusout`,this._onFocusOut),this.removeEventListener(`dragstart`,this._onDragStart),this._observer?.disconnect(),this._observer=null,this._abort()}attributeChangedCallback(e){e===`disabled`&&this._abort(),this.isConnected&&this._syncMirrors()}get order(){return this._items().map(e=>e.getAttribute(`data-id`))}set order(e){if(this._drag?.started||this._kb)return;let t=this._items(),n=new Map(t.map(e=>[e.getAttribute(`data-id`),e])),r=[];for(let t of e??[]){let e=n.get(String(t));e&&!r.includes(e)&&r.push(e)}[...r,...t.filter(e=>!r.includes(e))].forEach((e,t)=>{let n=this._items()[t];n!==e&&this.insertBefore(e,n)}),this._syncMirrors()}_items(){return[...this.querySelectorAll(`:scope > [data-id]`)]}_itemFrom(e){let t=e;for(;t&&t.parentElement!==this;)t=t.parentElement;return t?.hasAttribute(`data-id`)?t:null}_itemDisabled(e){return e.hasAttribute(`data-disabled`)}_horizontal(){return this.getAttribute(`orientation`)===`horizontal`}_syncMirrors(){B(this,this.order)}_insertAt(e,t){let n=this._items();if(n.indexOf(e)===t)return;let r=n.filter(t=>t!==e),i=r[t]??null;i?this.insertBefore(e,i):r.length>0?r[r.length-1].after(e):this.appendChild(e)}_indexFor(e,t,n){let r=this._items().filter(t=>t!==e),i=this._horizontal();for(let e=0;e<r.length;e++){let a=r[e].getBoundingClientRect();if(i?n<a.top||n<=a.bottom&&t<a.left+a.width/2:n<a.top+a.height/2)return e}return r.length}_peers(){let e=this.getAttribute(`group`);return[...Gu].filter(t=>t===this||e&&t.getAttribute(`group`)===e&&!t.hasAttribute(`disabled`))}_labelOf(e){return e.getAttribute(`data-label`)||e.textContent.replace(/\s+/g,` `).trim()||e.getAttribute(`data-id`)}_announce(e){let t=this.querySelector(`:scope > .wui-sortable-live`);t||(t=document.createElement(`div`),t.className=`wui-sortable-live`,t.setAttribute(`role`,`status`),t.setAttribute(`aria-live`,`polite`),t.setAttribute(`aria-atomic`,`true`),this.appendChild(t)),t.textContent=e}_position(e){let t=this._items();return`position ${t.indexOf(e)+1} of ${t.length}`}_onPointerDown(e){if(this._drag||this._kb||this.hasAttribute(`disabled`)||e.pointerType===`mouse`&&e.button!==0)return;let t=this._itemFrom(e.target);if(!t||this._itemDisabled(t))return;let n=t.querySelector(`:scope > ${Ku}`),r=!!n&&n.contains(e.target);if(this.hasAttribute(`handle`)&&!r)return;if(!r){let n=e.target.closest?.(qu);if(n&&n!==t&&t.contains(n))return}let i=e.pointerType===`touch`&&!r,a={item:t,pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,x:e.clientX,y:e.clientY,slop:e.pointerType===`touch`?Yu:Ju,ready:!i,started:!1,timer:null,raf:0,list:this,ghost:null};this._drag=a,i&&(a.timer=setTimeout(()=>{a.timer=null,a.ready=!0,this._begin()},Xu)),document.addEventListener(`pointermove`,this._onDocMove),document.addEventListener(`pointerup`,this._onDocUp),document.addEventListener(`pointercancel`,this._onDocCancel),document.addEventListener(`keydown`,this._onDocKey,!0),document.addEventListener(`touchmove`,this._onDocTouchMove,{passive:!1})}_onDocMove(e){let t=this._drag;if(!(!t||e.pointerId!==t.pointerId)){if(t.x=e.clientX,t.y=e.clientY,!t.started){let e=Math.hypot(t.x-t.startX,t.y-t.startY);if(!t.ready){e>t.slop&&this._finish(!0);return}if(e<t.slop||(this._begin(),!this._drag?.started))return}e.preventDefault?.(),this._moveGhost(),this._update()}}_onDocUp(e){this._drag&&e.pointerId===this._drag.pointerId&&this._finish(!1)}_onDocCancel(e){this._drag&&e.pointerId===this._drag.pointerId&&this._finish(!0)}_onDocKey(e){e.key!==`Escape`||!this._drag||(e.preventDefault(),e.stopPropagation(),this._finish(!0))}_begin(){let e=this._drag;if(!e||e.started)return;e.started=!0;let t=e.item.getBoundingClientRect();e.offsetX=e.startX-t.left,e.offsetY=e.startY-t.top,e.fromIndex=this._items().indexOf(e.item);let n=e.item.cloneNode(!0);for(let e of[n,...n.querySelectorAll(`[id],[data-id]`)])e.removeAttribute(`id`),e.removeAttribute(`data-id`);n.classList.add(`wui-sortable-ghost`),n.setAttribute(`aria-hidden`,`true`),n.inert=!0,n.style.width=`${t.width}px`,n.style.height=`${t.height}px`,e.ghost=n,e.item.classList.add(`wui-sortable-dragging`),document.body.appendChild(n),document.documentElement.classList.add(`wui-sortable-active`),document.addEventListener(`selectstart`,this._onSelectStart),this._moveGhost(),e.raf=requestAnimationFrame(this._scrollTick),this._emit(this,`wui-sortable:start`,{id:e.item.getAttribute(`data-id`)})}_moveGhost(){let e=this._drag;e?.ghost&&(e.ghost.style.transform=`translate(${e.x-e.offsetX}px, ${e.y-e.offsetY}px)`)}_update(){let e=this._drag;if(!e?.started)return;let t=e.list;for(let n of this._peers()){let r=n.getBoundingClientRect();if(e.x>=r.left&&e.x<=r.right&&e.y>=r.top&&e.y<=r.bottom){t=n;break}}let n=t._indexFor(e.item,e.x,e.y);(t!==e.list||n!==t._items().indexOf(e.item))&&t._insertAt(e.item,n),e.list=t}_scrollTick(){let e=this._drag;if(!e?.started)return;let t=td(e.list),n=t?t.getBoundingClientRect():null,r=Math.max(n?.top??0,0),i=Math.min(n?.bottom??window.innerHeight,window.innerHeight),a=Math.max(n?.left??0,0),o=Math.min(n?.right??window.innerWidth,window.innerWidth),s=ed(e.y,r,i),c=ed(e.x,a,o);(c||s)&&(t?(t.scrollTop+=s,t.scrollLeft+=c):window.scrollBy(c,s),this._update()),e.raf=requestAnimationFrame(this._scrollTick)}_finish(e){let t=this._drag;if(!t||(this._drag=null,clearTimeout(t.timer),cancelAnimationFrame(t.raf),document.removeEventListener(`pointermove`,this._onDocMove),document.removeEventListener(`pointerup`,this._onDocUp),document.removeEventListener(`pointercancel`,this._onDocCancel),document.removeEventListener(`keydown`,this._onDocKey,!0),document.removeEventListener(`touchmove`,this._onDocTouchMove),document.removeEventListener(`selectstart`,this._onSelectStart),!t.started))return;t.ghost?.remove(),document.documentElement.classList.remove(`wui-sortable-active`),t.item.classList.remove(`wui-sortable-dragging`);let n=t.item.getAttribute(`data-id`);e?(this._insertAt(t.item,t.fromIndex),this._syncMirrors(),t.list!==this&&t.list._syncMirrors()):this._settle(t.item,this,t.fromIndex,t.list),this._emit(this,`wui-sortable:end`,{id:n,cancelled:e})}_settle(e,t,n,r){let i=r._items().indexOf(e);if(r===t&&i===n)return;let a=e.getAttribute(`data-id`),o=r.order,s=r!==t,c=t.order;s&&(t.controlled||r.controlled)&&t._insertAt(e,n),t._syncMirrors(),r._syncMirrors();let l=r._labelOf(e),u=s&&r.getAttribute(`aria-label`)?` to ${r.getAttribute(`aria-label`)}`:``,d={id:a,fromIndex:n,toIndex:i,from:t,to:r};s&&this._emit(t,`wui-sortable:change`,{...d,ids:c}),this._emit(r,`wui-sortable:change`,{...d,ids:o}),r._announce(`${l} moved${u}, position ${i+1} of ${o.length}.`)}_emit(e,t,n){e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n}))}_abort(){this._drag&&this._finish(!0),this._kb&&this._dropKeyboard(!0)}_onKeyDown(e){if(this.hasAttribute(`disabled`))return;let t=e.target.closest?.(Ku),n=t&&t.parentElement?.parentElement===this?t.parentElement:null;if(!n||this._itemDisabled(n)||this._drag)return;let r=e.key;if(!this._kb){if(r!==` `&&r!==`Enter`)return;e.preventDefault(),this._liftKeyboard(n,t);return}if(this._kb.item===n){if(r===` `||r===`Enter`)e.preventDefault(),this._dropKeyboard(!1);else if(r===`Escape`)e.preventDefault(),e.stopPropagation(),this._dropKeyboard(!0);else if([`ArrowUp`,`ArrowLeft`,`ArrowDown`,`ArrowRight`,`Home`,`End`].includes(r)){e.preventDefault();let i=this._items(),a=i.indexOf(n),o=i.length-1,s=r===`Home`?0:r===`End`?o:Math.max(0,Math.min(o,a+(r===`ArrowUp`||r===`ArrowLeft`?-1:1)));if(s===a){this._announce(`${this._labelOf(n)} is already ${a===0?`first`:`last`}, ${this._position(n)}.`);return}this._moveFocused(()=>this._insertAt(n,s),t),this._announce(`${this._labelOf(n)} moved to ${this._position(n)}.`)}}}_onFocusOut(e){!this._kb||this._moving||e.relatedTarget&&this._kb.handle.contains(e.relatedTarget)||this._dropKeyboard(!1)}_liftKeyboard(e,t){this._kb={item:e,handle:t,fromIndex:this._items().indexOf(e)},t.setAttribute(`aria-pressed`,`true`),this._announce(`${this._labelOf(e)} lifted, ${this._position(e)}. Use the arrow keys to move it, Space to drop it, Escape to cancel.`)}_dropKeyboard(e){let t=this._kb;if(t){if(this._kb=null,t.handle.removeAttribute(`aria-pressed`),e){this._moveFocused(()=>this._insertAt(t.item,t.fromIndex),t.handle),this._announce(`Reorder cancelled. ${this._labelOf(t.item)} is back at ${this._position(t.item)}.`);return}if(this._items().indexOf(t.item)===t.fromIndex){this._announce(`${this._labelOf(t.item)} dropped, ${this._position(t.item)}.`);return}this._settle(t.item,this,t.fromIndex,this)}}_moveFocused(e,t){this._moving=!0;let n=this.contains(document.activeElement);e(),n&&document.activeElement!==t&&t.focus(),this._moving=!1}};function ed(e,t,n){return e<t+Zu?-Math.ceil(Qu*Math.min(1,(t+Zu-e)/Zu)):e>n-Zu?Math.ceil(Qu*Math.min(1,(e-(n-Zu))/Zu)):0}function td(e){for(let t=e.parentElement;t&&t!==document.body&&t!==document.documentElement;t=t.parentElement){let e=getComputedStyle(t),n=/(auto|scroll)/.test(e.overflowY)&&t.scrollHeight>t.clientHeight,r=/(auto|scroll)/.test(e.overflowX)&&t.scrollWidth>t.clientWidth;if(n||r)return t}return null}var nd=class extends l{static formAssociated=!0;_accessibleName(){return this.getAttribute(`aria-label`)||this.getAttribute(`placeholder`)||`Add tags`}static get observedAttributes(){return[`placeholder`,`disabled`,`size`,`max-tags`,`aria-label`,`separators`,`allow-duplicates`,`aria-invalid`]}constructor(){super(),this._values=[],this._draftText=``;try{this._internals=this.attachInternals()}catch{this._internals=null}}connectedCallback(){if(!this._rendered){if(!this._valuesInit&&!this._values.length){let e=this.getAttribute(`value`);if(e!=null&&e!==``)this._values=e.split(`,`).map(e=>e.trim()).filter(Boolean);else{let e=[...this.querySelectorAll(`:scope > wui-tag`)].map(e=>e.textContent.trim());e.length&&(this._values=e.map(String))}}this._valuesInit=!0,this._defaultCaptured||=(this._defaultValues=this._values.slice(),!0),this.render();return}this._wire()}formResetCallback(){this.values=(this._defaultValues||[]).slice(),this._draftText=``;let e=this.querySelector(`[data-input]`);e&&(e.value=``)}attributeChangedCallback(e){if(e===`aria-invalid`){this._syncInvalid();return}if(this._rendered){if(e===`separators`||e===`allow-duplicates`){this._wire();return}this.render()}}_syncInvalid(){let e=this.querySelector(`.search-select-control`);e&&(this.hasAttribute(`aria-invalid`)?e.setAttribute(`aria-invalid`,`true`):e.removeAttribute(`aria-invalid`))}get values(){return this._values.slice()}set values(e){this._values=Array.isArray(e)?e.map(String):[],B(this,this._values),this._rendered&&this._renderControl()}render(){let e=this.getAttribute(`size`),t=e===`sm`?` search-select-sm`:e===`lg`?` search-select-lg`:``;B(this,this._values),this.innerHTML=`
434
434
  <div class="search-select${t}">
435
435
  <div class="input search-select-control search-select-multi"${this.hasAttribute(`aria-invalid`)?` aria-invalid="true"`:``}${this.hasAttribute(`disabled`)?` aria-disabled="true"`:``}>
436
- <div class="ms-chips" data-chips><input type="text" class="ms-input" data-input aria-label="${nd(this._accessibleName())}" placeholder="${nd(this.getAttribute(`placeholder`)||`Add…`)}" autocomplete="off"${this.hasAttribute(`disabled`)?` disabled`:``}/></div>
436
+ <div class="ms-chips" data-chips><input type="text" class="ms-input" data-input aria-label="${id(this._accessibleName())}" placeholder="${id(this.getAttribute(`placeholder`)||`Add…`)}" autocomplete="off"${this.hasAttribute(`disabled`)?` disabled`:``}/></div>
437
437
  </div>
438
- </div>`,this._rendered=!0,B(this,this._values),this._renderControl(),this._wire()}_renderControl(){let e=this.querySelector(`[data-chips]`);if(e){for(let t of e.querySelectorAll(`:scope > .chip`))t.remove();this._values.length&&e.querySelector(`[data-input]`).insertAdjacentHTML(`beforebegin`,this._values.map(e=>`<span class="chip chip-sm"><span class="chip-label">${td(e)}</span><button type="button" class="chip-remove" data-remove="${nd(e)}" aria-label="Remove ${nd(e)}">${j(`x`)}</button></span>`).join(``))}}_wire(){this._teardown();let e=this.querySelector(`.search-select-control`),t=this.querySelector(`[data-input]`);if(!e||!t)return;let n=()=>this.hasAttribute(`disabled`),r=(this.getAttribute(`separators`)||`enter,comma`).split(`,`).map(e=>e.trim()),i=this.getAttribute(`max-tags`),a=this.hasAttribute(`allow-duplicates`),o=new Set(r.map(wc).filter(Boolean)),s=()=>{B(this,this._values),this.dispatchEvent(new Event(`change`,{bubbles:!0}))},c=e=>{let t=e.trim();if(!t||i&&this._values.length>=parseInt(i,10))return;let n=a?t:t.toLowerCase();(!this._values.some(e=>a?e===t:e.toLowerCase()===n)||a)&&(this._values.push(t),this._renderControl(),s())},l=e=>{this._values=this._values.filter(t=>t!==e),this._renderControl(),s()},u=e=>{if(e.key===`Enter`&&o.has(`Enter`)){e.preventDefault(),c(t.value),t.value=``;return}if(e.key===`,`&&o.has(`,`)){e.preventDefault(),c(t.value.replace(/,+$/,``)),t.value=``;return}if(e.key===` `&&o.has(` `)){let n=t.value.trim();n&&(e.preventDefault(),c(n),t.value=``);return}if(e.key===`Tab`&&o.has(`Tab`)){e.preventDefault(),c(t.value),t.value=``;return}e.key===`Backspace`&&!t.value&&this._values.length&&(e.preventDefault(),l(this._values[this._values.length-1])),e.key===`Escape`&&(t.value=``)},d=e=>{e.preventDefault();let n=e.clipboardData.getData(`text/plain`),a=[];for(let e of r){let t=Tc(e)??e;if(Dc(n,[t])){a.push(...Ec(n,[t]));break}}a.length||a.push(n.trim());for(let e of a)if(c(e),i&&this._values.length>=parseInt(i,10))break;t.value=``};this._onControlClick=e=>{if(n())return;let r=e.target.closest(`[data-remove]`);if(r){e.stopPropagation(),l(r.dataset.remove),t.focus();return}t.focus()},this._onInputKey=u,this._onInputPaste=d,e.addEventListener(`click`,this._onControlClick),t.addEventListener(`keydown`,this._onInputKey),t.addEventListener(`paste`,this._onInputPaste),this._onDocClick=e=>{this.contains(e.target)||t.blur()},document.addEventListener(`click`,this._onDocClick)}_teardown(){this._onDocClick&&=(document.removeEventListener(`click`,this._onDocClick),null);let e=this.querySelector(`.search-select-control`),t=this.querySelector(`[data-input]`);e&&this._onControlClick&&e.removeEventListener(`click`,this._onControlClick),t&&this._onInputKey&&(t.removeEventListener(`keydown`,this._onInputKey),t.removeEventListener(`paste`,this._onInputPaste))}disconnectedCallback(){this._teardown()}},td=e=>String(e??``).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`),nd=e=>String(e??``).replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`),rd=e=>String(e).padStart(2,`0`),id=(e,t)=>`${rd(e)}:${rd(t)}`,ad=e=>{let t=/^(\d{2}):(\d{2})$/.exec(e||``);return t?{h:+t[1],m:+t[2]}:null},od=(e,t=`24`)=>{if(!e)return``;if(t===`24`)return id(e.h,e.m);let n=e.h%12||12,r=e.h>=12?`PM`:`AM`;return`${n}:${rd(e.m)} ${r}`},sd=e=>{let t=String(e||``).trim().toLowerCase(),n=/^(\d{1,2})(?:[:.](\d{2})|(\d{2}))?\s*(?:([ap])\.?\s*(?:m\.?)?)?$/.exec(t);if(!n)return null;let r=+n[1],i=+(n[2]??n[3]??`0`);if(i>59)return null;if(n[4]){if(r<1||r>12)return null;r=r%12+(n[4]===`p`?12:0)}else if(r>23)return null;return{h:r,m:i}},cd=0,ld=class extends l{static formAssociated=!0;static get observedAttributes(){return[`value`,`min`,`max`,`step`,`format`,`placeholder`,`disabled`,`required`,`size`,`aria-label`,`aria-describedby`,`aria-invalid`]}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._value=``,this._uid=`wui-tp-${++cd}`,this._typedError=``,this._typeahead=``,this._typeaheadTimer=null,this.addEventListener(`focusout`,e=>{this._isOpen?.()&&e.relatedTarget&&!this.contains(e.relatedTarget)&&this._close({commit:!0})})}connectedCallback(){if(!this._rendered){this.render();return}this._bindGlobal?.()}attributeChangedCallback(e,t,n){if(this._rendered)switch(e){case`value`:this._value=n||``,this._typedError=``,this._syncFormValue(),this._syncText(),this._syncInvalid();return;case`aria-invalid`:case`aria-describedby`:this._syncInvalid();return;case`aria-label`:case`placeholder`:case`disabled`:case`required`:this._syncAttrs();return;default:this.render()}}formResetCallback(){this.value=this._defaultValue||``}get value(){return this._value}set value(e){this._value=e||``,this._typedError=``,z(this,this._value),this._syncText(),this._syncInvalid()}_format(){return this.getAttribute(`format`)||`24`}_step(){return Math.max(1,parseInt(this.getAttribute(`step`)||`30`,10)||30)}_bounds(){let e=ad(this.getAttribute(`min`))||{h:0,m:0},t=ad(this.getAttribute(`max`))||{h:23,m:59};return{min:e.h*60+e.m,max:t.h*60+t.m}}_allowed(e,t){let n=e*60+t,{min:r,max:i}=this._bounds();return n>=r&&n<=i&&n%this._step()===0}_times(){let e=[];for(let t=0;t<1440;t+=this._step()){let n=Math.floor(t/60),r=t%60;this._allowed(n,r)&&e.push({h:n,m:r})}return e}_refusal(e){if(this._allowed(e.h,e.m))return``;let t=this._format(),{min:n,max:r}=this._bounds(),i=e.h*60+e.m,a=e=>od({h:Math.floor(e/60),m:e%60},t);if(i<n||i>r){let e=!!ad(this.getAttribute(`min`)),t=!!ad(this.getAttribute(`max`));return e&&t?`Enter a time between ${a(n)} and ${a(r)}.`:e?`Enter a time at or after ${a(n)}.`:`Enter a time at or before ${a(r)}.`}return`Enter a time in ${this._step()}-minute steps.`}render(){this._defaultValue===void 0&&(this._defaultValue=this.getAttribute(`value`)||``,this._value=this._defaultValue||this._value),this._isOpen=null;let e=this.getAttribute(`size`),t=e===`sm`?` input-sm`:e===`lg`?` input-lg`:``,n=this._uid;this.innerHTML=`
438
+ </div>`,this._rendered=!0,B(this,this._values),this._renderControl(),this._wire()}_renderControl(){let e=this.querySelector(`[data-chips]`);if(e){for(let t of e.querySelectorAll(`:scope > .chip`))t.remove();this._values.length&&e.querySelector(`[data-input]`).insertAdjacentHTML(`beforebegin`,this._values.map(e=>`<span class="chip chip-sm"><span class="chip-label">${rd(e)}</span><button type="button" class="chip-remove" data-remove="${id(e)}" aria-label="Remove ${id(e)}">${j(`x`)}</button></span>`).join(``))}}_wire(){this._teardown();let e=this.querySelector(`.search-select-control`),t=this.querySelector(`[data-input]`);if(!e||!t)return;let n=()=>this.hasAttribute(`disabled`),r=(this.getAttribute(`separators`)||`enter,comma`).split(`,`).map(e=>e.trim()),i=this.getAttribute(`max-tags`),a=this.hasAttribute(`allow-duplicates`),o=new Set(r.map(Ec).filter(Boolean)),s=()=>{B(this,this._values),this.dispatchEvent(new Event(`change`,{bubbles:!0}))},c=e=>{let t=e.trim();if(!t||i&&this._values.length>=parseInt(i,10))return;let n=a?t:t.toLowerCase();(!this._values.some(e=>a?e===t:e.toLowerCase()===n)||a)&&(this._values.push(t),this._renderControl(),s())},l=e=>{this._values=this._values.filter(t=>t!==e),this._renderControl(),s()},u=e=>{if(e.key===`Enter`&&o.has(`Enter`)){e.preventDefault(),c(t.value),t.value=``;return}if(e.key===`,`&&o.has(`,`)){e.preventDefault(),c(t.value.replace(/,+$/,``)),t.value=``;return}if(e.key===` `&&o.has(` `)){let n=t.value.trim();n&&(e.preventDefault(),c(n),t.value=``);return}if(e.key===`Tab`&&o.has(`Tab`)){e.preventDefault(),c(t.value),t.value=``;return}e.key===`Backspace`&&!t.value&&this._values.length&&(e.preventDefault(),l(this._values[this._values.length-1])),e.key===`Escape`&&(t.value=``)},d=e=>{e.preventDefault();let n=e.clipboardData.getData(`text/plain`),a=[];for(let e of r){let t=Dc(e)??e;if(kc(n,[t])){a.push(...Oc(n,[t]));break}}a.length||a.push(n.trim());for(let e of a)if(c(e),i&&this._values.length>=parseInt(i,10))break;t.value=``};this._onControlClick=e=>{if(n())return;let r=e.target.closest(`[data-remove]`);if(r){e.stopPropagation(),l(r.dataset.remove),t.focus();return}t.focus()},this._onInputKey=u,this._onInputPaste=d,e.addEventListener(`click`,this._onControlClick),t.addEventListener(`keydown`,this._onInputKey),t.addEventListener(`paste`,this._onInputPaste),this._onDocClick=e=>{this.contains(e.target)||t.blur()},document.addEventListener(`click`,this._onDocClick)}_teardown(){this._onDocClick&&=(document.removeEventListener(`click`,this._onDocClick),null);let e=this.querySelector(`.search-select-control`),t=this.querySelector(`[data-input]`);e&&this._onControlClick&&e.removeEventListener(`click`,this._onControlClick),t&&this._onInputKey&&(t.removeEventListener(`keydown`,this._onInputKey),t.removeEventListener(`paste`,this._onInputPaste))}disconnectedCallback(){this._teardown()}},rd=e=>String(e??``).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`),id=e=>String(e??``).replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`),ad=e=>String(e).padStart(2,`0`),od=(e,t)=>`${ad(e)}:${ad(t)}`,sd=e=>{let t=/^(\d{2}):(\d{2})$/.exec(e||``);return t?{h:+t[1],m:+t[2]}:null},cd=(e,t=`24`)=>{if(!e)return``;if(t===`24`)return od(e.h,e.m);let n=e.h%12||12,r=e.h>=12?`PM`:`AM`;return`${n}:${ad(e.m)} ${r}`},ld=e=>{let t=String(e||``).trim().toLowerCase(),n=/^(\d{1,2})(?:[:.](\d{2})|(\d{2}))?\s*(?:([ap])\.?\s*(?:m\.?)?)?$/.exec(t);if(!n)return null;let r=+n[1],i=+(n[2]??n[3]??`0`);if(i>59)return null;if(n[4]){if(r<1||r>12)return null;r=r%12+(n[4]===`p`?12:0)}else if(r>23)return null;return{h:r,m:i}},ud=0,dd=class extends l{static formAssociated=!0;static get observedAttributes(){return[`value`,`min`,`max`,`step`,`format`,`placeholder`,`disabled`,`required`,`size`,`aria-label`,`aria-describedby`,`aria-invalid`]}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._value=``,this._uid=`wui-tp-${++ud}`,this._typedError=``,this._typeahead=``,this._typeaheadTimer=null,this.addEventListener(`focusout`,e=>{this._isOpen?.()&&e.relatedTarget&&!this.contains(e.relatedTarget)&&this._close({commit:!0})})}connectedCallback(){if(!this._rendered){this.render();return}this._bindGlobal?.()}attributeChangedCallback(e,t,n){if(this._rendered)switch(e){case`value`:this._value=n||``,this._typedError=``,this._syncFormValue(),this._syncText(),this._syncInvalid();return;case`aria-invalid`:case`aria-describedby`:this._syncInvalid();return;case`aria-label`:case`placeholder`:case`disabled`:case`required`:this._syncAttrs();return;default:this.render()}}formResetCallback(){this.value=this._defaultValue||``}get value(){return this._value}set value(e){this._value=e||``,this._typedError=``,z(this,this._value),this._syncText(),this._syncInvalid()}_format(){return this.getAttribute(`format`)||`24`}_step(){return Math.max(1,parseInt(this.getAttribute(`step`)||`30`,10)||30)}_bounds(){let e=sd(this.getAttribute(`min`))||{h:0,m:0},t=sd(this.getAttribute(`max`))||{h:23,m:59};return{min:e.h*60+e.m,max:t.h*60+t.m}}_allowed(e,t){let n=e*60+t,{min:r,max:i}=this._bounds();return n>=r&&n<=i&&n%this._step()===0}_times(){let e=[];for(let t=0;t<1440;t+=this._step()){let n=Math.floor(t/60),r=t%60;this._allowed(n,r)&&e.push({h:n,m:r})}return e}_refusal(e){if(this._allowed(e.h,e.m))return``;let t=this._format(),{min:n,max:r}=this._bounds(),i=e.h*60+e.m,a=e=>cd({h:Math.floor(e/60),m:e%60},t);if(i<n||i>r){let e=!!sd(this.getAttribute(`min`)),t=!!sd(this.getAttribute(`max`));return e&&t?`Enter a time between ${a(n)} and ${a(r)}.`:e?`Enter a time at or after ${a(n)}.`:`Enter a time at or before ${a(r)}.`}return`Enter a time in ${this._step()}-minute steps.`}render(){this._defaultValue===void 0&&(this._defaultValue=this.getAttribute(`value`)||``,this._value=this._defaultValue||this._value),this._isOpen=null;let e=this.getAttribute(`size`),t=e===`sm`?` input-sm`:e===`lg`?` input-lg`:``,n=this._uid;this.innerHTML=`
439
439
  <div class="timepicker">
440
440
  <div class="wui-timepicker-field">
441
441
  <input type="text" class="input timepicker-trigger${t}" id="${n}-input" role="combobox" aria-haspopup="dialog" aria-expanded="false" aria-controls="${n}-pop" aria-autocomplete="none" autocomplete="off" spellcheck="false">
@@ -443,11 +443,11 @@ var WeborityUiElements=(function(e){Object.defineProperty(e,Symbol.toStringTag,{
443
443
  </div>
444
444
  <div class="timepicker-pop" id="${n}-pop" role="dialog" aria-label="Choose time" hidden></div>
445
445
  <div class="field-error wui-timepicker-error" id="${n}-error" hidden></div>
446
- </div>`,this._rendered=!0,this._syncAttrs(),this._syncText(),this._syncInvalid(),z(this,this._value),this._wire()}_input(){return this.querySelector(`.timepicker-trigger`)}_pop(){return this.querySelector(`.timepicker-pop`)}_syncFormValue(){z(this,this._value)}_syncAttrs(){let e=this._input(),t=this.querySelector(`.wui-timepicker-toggle`);if(!e)return;let n=this.hasAttribute(`disabled`);e.disabled=n,t&&(t.disabled=n),e.placeholder=this.getAttribute(`placeholder`)||`Select time`,this.hasAttribute(`required`)?e.setAttribute(`aria-required`,`true`):e.removeAttribute(`aria-required`);let r=this.getAttribute(`aria-label`);r?e.setAttribute(`aria-label`,r):e.removeAttribute(`aria-label`),z(this,this._value),n&&this._isOpen?.()&&this._close({commit:!1})}_syncText(){let e=this._input();e&&(e.value=od(ad(this._value),this._format()),this._isOpen?.()&&this._syncColumns())}_syncInvalid(){let e=this._input(),t=this.querySelector(`.wui-timepicker-error`);if(!e||!t)return;let n=this._typedError;t.textContent=n,t.hidden=!n,this.hasAttribute(`aria-invalid`)||n?e.setAttribute(`aria-invalid`,`true`):e.removeAttribute(`aria-invalid`);let r=[this.getAttribute(`aria-describedby`),n?t.id:null].filter(Boolean).join(` `);r?e.setAttribute(`aria-describedby`,r):e.removeAttribute(`aria-describedby`),e.setCustomValidity?.(n)}_commitText(){let e=this._input();if(!e||e.value===od(ad(this._value),this._format()))return!0;let t=e.value.trim(),n=``;if(t){let e=sd(t),r=e?this._refusal(e):`Enter a time like ${this._format()===`12`?`7:45 PM`:`19:45`}.`;if(r)return this._typedError=r,this._syncInvalid(),!1;n=id(e.h,e.m)}let r=n!==this._value;return this.value=n,r&&this.dispatchEvent(new Event(`change`,{bubbles:!0})),!0}_pending(){let e=sd(this._input()?.value);return e&&this._allowed(e.h,e.m)?e:null}_columnsHtml(){let e=this._format(),t=this._times(),n=(e,t,n)=>`<div class="wui-timepicker-col" role="listbox" aria-label="${t}" data-col="${e}">${n.map(e=>`<button type="button" class="timepicker-option" role="option" tabindex="-1" aria-selected="false" data-v="${e.v}">${e.text}</button>`).join(``)}</div>`,r=[...new Set(t.map(e=>e.h))],i=[...new Set(t.map(e=>e.m))].sort((e,t)=>e-t),a;if(e===`12`){let e=[...new Set(r.map(e=>e%12))].sort((e,t)=>e-t),t=[...new Set(r.map(e=>e>=12?`pm`:`am`))].sort();a=n(`hour`,`Hour`,e.map(e=>({v:e,text:String(e||12)})))+n(`minute`,`Minute`,i.map(e=>({v:e,text:rd(e)})))+n(`period`,`AM or PM`,t.map(e=>({v:e,text:e.toUpperCase()})))}else a=n(`hour`,`Hour`,r.map(e=>({v:e,text:rd(e)})))+n(`minute`,`Minute`,i.map(e=>({v:e,text:rd(e)})));return`<div class="wui-timepicker-cols">${a}</div>`}_selectedIn(e,t){return t?e===`minute`?String(t.m):e===`period`?t.h>=12?`pm`:`am`:String(this._format()===`12`?t.h%12:t.h):null}_optionEnabled(e,t,n){if(!n)return!0;let r=this._format()===`12`,i=n.h>=12,a=e=>r?[e+(i?12:0)]:[e],o=Array.from({length:60},(e,t)=>t);if(e===`hour`)return a(+t).some(e=>o.some(t=>this._allowed(e,t)));if(e===`minute`)return this._allowed(n.h,+t);let s=t===`pm`?12:0;return Array.from({length:12},(e,t)=>s+t).some(e=>o.some(t=>this._allowed(e,t)))}_syncColumns({scroll:e=!1}={}){let t=this._pop();if(!t)return;let n=this._pending();for(let r of t.querySelectorAll(`.wui-timepicker-col`)){let t=r.dataset.col,i=this._selectedIn(t,n),a=[...r.querySelectorAll(`.timepicker-option`)],o=null;for(let e of a){let r=e.dataset.v===i;e.classList.toggle(`is-selected`,r),e.setAttribute(`aria-selected`,r?`true`:`false`),e.disabled=!r&&!this._optionEnabled(t,e.dataset.v,n),r&&(o=e)}o=o||a.find(e=>!e.disabled)||null;for(let e of a)e.tabIndex=e===o?0:-1;e&&o&&(r.scrollTop=o.offsetTop-(r.clientHeight-o.offsetHeight)/2)}}_pick(e,t){let n=this._times();if(!n.length)return;let r=this._pending()||n[0],i=this._format()===`12`,a=r.h,o=r.m;if(e===`minute`?o=+t:a=e===`period`?a%12+(t===`pm`?12:0):i?+t+(r.h>=12?12:0):+t,!this._allowed(a,o)){let t=a*60+o,r=n.filter(t=>e===`minute`?t.m===o:e===`period`?t.h>=12==a>=12:i?t.h%12==a%12&&t.h>=12==a>=12:t.h===a).sort((e,n)=>Math.abs(e.h*60+e.m-t)-Math.abs(n.h*60+n.m-t))[0];if(!r)return;a=r.h,o=r.m}let s=this._input();s.value=od({h:a,m:o},this._format()),this._typedError=``,this._syncInvalid(),this._syncColumns()}_position(){o(this.querySelector(`.wui-timepicker-field`),this._pop())}_onColumnKey(e){let t=e.target.closest?.(`.timepicker-option`),n=t?.closest(`.wui-timepicker-col`);if(!t||!n)return;let r=[...n.querySelectorAll(`.timepicker-option`)].filter(e=>!e.disabled),i=r.indexOf(t),a=[...this._pop().querySelectorAll(`.wui-timepicker-col`)],o=e=>{e&&(this._pick(n.dataset.col,e.dataset.v),(n.querySelector(`.timepicker-option.is-selected`)||e).focus())};switch(e.key){case`ArrowDown`:e.preventDefault(),o(r[Math.min(i+1,r.length-1)]);return;case`ArrowUp`:e.preventDefault(),o(r[Math.max(i-1,0)]);return;case`Home`:e.preventDefault(),o(r[0]);return;case`End`:e.preventDefault(),o(r[r.length-1]);return;case`PageDown`:e.preventDefault(),o(r[Math.min(i+8,r.length-1)]);return;case`PageUp`:e.preventDefault(),o(r[Math.max(i-8,0)]);return;case`ArrowRight`:case`ArrowLeft`:e.preventDefault(),a[a.indexOf(n)+(e.key===`ArrowRight`?1:-1)]?.querySelector(`.timepicker-option[tabindex="0"]`)?.focus();return;case`Enter`:e.preventDefault(),this._close({commit:!0,refocus:!0});return;case` `:e.preventDefault(),o(t);return;case`Escape`:e.preventDefault(),e.stopPropagation(),this._close({commit:!1,refocus:!0});return;default:e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&(e.preventDefault(),clearTimeout(this._typeaheadTimer),this._typeahead+=e.key.toLowerCase(),this._typeaheadTimer=setTimeout(()=>{this._typeahead=``,this._typeaheadTimer=null},500),o(r.find(e=>e.textContent.trim().toLowerCase().startsWith(this._typeahead))))}}_wire(){this._teardown();let e=this._input(),t=this.querySelector(`.wui-timepicker-toggle`),n=this._pop(),r=this.querySelector(`.timepicker`);if(!e||!n)return;let i=()=>!n.hidden;this._isOpen=i;let a=()=>{i()&&this._position()},o=()=>n.querySelector(`.wui-timepicker-col .timepicker-option[tabindex="0"]`)?.focus();this._open=({focus:c=!1}={})=>{this.hasAttribute(`disabled`)||(i()||(n.innerHTML=this._columnsHtml(),n.hidden=!1,r?.classList.add(`open`),e.setAttribute(`aria-expanded`,`true`),t?.setAttribute(`aria-expanded`,`true`),this._position(),s(this,a),this._syncColumns({scroll:!0})),c&&o())},this._close=({commit:a=!0,refocus:o=!1}={})=>{if(!i())return;let s=n.contains(document.activeElement);n.hidden=!0,n.innerHTML=``,r?.classList.remove(`open`),e.setAttribute(`aria-expanded`,`false`),t?.setAttribute(`aria-expanded`,`false`),c(this),clearTimeout(this._typeaheadTimer),this._typeaheadTimer=null,this._typeahead=``,a?this._commitText():(this._typedError=``,this._syncText(),this._syncInvalid()),(o||s)&&e.focus()},e.addEventListener(`pointerdown`,e=>{this._lastPointer=e.pointerType}),e.addEventListener(`click`,()=>{this._lastPointer!==`touch`&&!i()&&this._open(),this._lastPointer=null}),t?.addEventListener(`click`,()=>{i()?this._close({commit:!0,refocus:!0}):this._open({focus:!0})}),e.addEventListener(`keydown`,e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`)e.preventDefault(),this._open({focus:!0});else if(e.key===`Enter`){let t=i(),n=this._commitText();t&&n&&this._close({commit:!1}),(!n||t)&&e.preventDefault()}else e.key===`Escape`&&i()?(e.preventDefault(),e.stopPropagation(),this._close({commit:!1})):e.key===`Tab`&&i()&&this._close({commit:!0})}),e.addEventListener(`input`,e=>{e.stopPropagation(),this._typedError&&(this._typedError=``,this._syncInvalid()),i()&&this._syncColumns({scroll:!0})}),e.addEventListener(`change`,e=>{e.stopPropagation(),i()||this._commitText()}),n.addEventListener(`click`,e=>{this._popClick=!0;let t=e.target.closest(`.timepicker-option`),n=t?.closest(`.wui-timepicker-col`);t&&n&&!t.disabled&&this._pick(n.dataset.col,t.dataset.v)}),n.addEventListener(`keydown`,e=>{i()&&this._onColumnKey(e)}),this._bindGlobal=()=>{this._teardown(),this._onDocClick=e=>{let t=this._popClick;this._popClick=!1,i()&&!t&&!this.contains(e.target)&&this._close({commit:!0})},document.addEventListener(`click`,this._onDocClick),this._onDocKey=e=>{i()&&e.key===`Escape`&&this._close({commit:!1})},document.addEventListener(`keydown`,this._onDocKey),this._onHostKey=e=>{!i()||e.key!==`Escape`||(e.preventDefault(),e.stopPropagation(),this._close({commit:!1,refocus:!0}))},this.addEventListener(`keydown`,this._onHostKey),i()&&s(this,a)},this._bindGlobal()}_teardown(){this._onDocClick&&=(document.removeEventListener(`click`,this._onDocClick),null),this._onDocKey&&=(document.removeEventListener(`keydown`,this._onDocKey),null),this._onHostKey&&=(this.removeEventListener(`keydown`,this._onHostKey),null),c(this),clearTimeout(this._typeaheadTimer),this._typeaheadTimer=null,this._typeahead=``}disconnectedCallback(){this._teardown()}},ud=`data-advance`,dd=`wui-tour-hint`,fd=`Click {actionName} to continue.`,pd=`a[href], button, input, select, textarea, summary, [tabindex], [contenteditable]`,md=(e,t)=>e?.advanceOn===`click`&&!!t,hd=e=>(e??``).replace(/\s+/g,` `).trim();function gd(e){let t=e.ownerDocument,n=(e.getAttribute(`aria-labelledby`)||``).split(/\s+/).filter(Boolean),r=e.tagName===`INPUT`&&/^(button|submit|reset)$/.test(e.type)?e.value:``,i=[n.map(e=>t.getElementById(e)?.textContent??``).join(` `),e.getAttribute(`aria-label`),Array.from(e.labels??[],e=>e.textContent).join(` `),e.getAttribute(`alt`),r,e.textContent,e.getAttribute(`title`)];for(let e of i){let t=hd(e);if(t)return t}return``}function _d(e){for(let t of[e,...e.querySelectorAll(pd)])if(t.tabIndex>=0&&!t.disabled)return t;return null}function vd(e,t,n){let r=(e.getAttribute(`aria-describedby`)||``).split(/\s+/).filter(e=>e&&e!==t);n&&r.push(t),r.length>0?e.setAttribute(`aria-describedby`,r.join(` `)):e.removeAttribute(`aria-describedby`)}function yd(e,t){let n=e.querySelector(`.${dd}`),r=e.querySelector(`.wui-tour-text`)?.id,i=r?`${r.replace(/-text$/,``)}-hint`:``;if(!t){n?.remove(),i&&vd(e,i,!1);return}n||(n=e.ownerDocument.createElement(`p`),n.className=dd,i&&(n.id=i),e.querySelector(`.wui-tour-actions`).before(n)),n.textContent=t,i&&vd(e,i,!0)}var bd=e=>getComputedStyle(e).animationName;function xd(e,{layer:t,spot:n,card:r},i,a){let o=md(i,a);t.toggleAttribute(ud,o&&!(t.getRootNode()instanceof ShadowRoot)),n.hasAttribute(ud)&&(n.removeAttribute(ud),o&&bd(n)),o&&n.setAttribute(ud,``);let s=r.querySelector(`.wui-tour-next`);s.classList.toggle(`btn-primary`,!o),s.classList.toggle(`btn-link`,o);let c=o?hd(i.actionLabel)||gd(a):``,l=e.getAttribute(`advance-label`)||fd,u=c?l.replace(/\{actionName\}/g,()=>c):``;return yd(r,u),u}function Sd(e,t,n){if(!md(e,t))return()=>{};let r=null,i=()=>{r??=setTimeout(n,0)};return t.addEventListener(`click`,i),()=>{t.removeEventListener(`click`,i),clearTimeout(r)}}function Cd(e,t,n,r){return e.contains(r)||md(t,n)&&n.contains(r)}function wd(e,{card:t,active:n,step:r,target:i}){let a=Array.from(t.querySelectorAll(`button`)).filter(e=>!e.hidden),o=md(r,i)?_d(i):null;o&&a.push(o);let s=a.findIndex(e=>e===n||e===o&&i.contains(n));e.preventDefault(),a[s===-1?e.shiftKey?a.length-1:0:(s+(e.shiftKey?-1:1)+a.length)%a.length].focus()}var Td=2/3,Ed=1e3,Dd=new Set([`top`,`left`,`width`,`height`]),Od=new WeakMap,kd=(e,t)=>typeof e.getAnimations==`function`?e.getAnimations().filter(t):[],Ad=e=>e.transitionProperty===`opacity`,jd=e=>Dd.has(e.transitionProperty),Md=e=>typeof e.animationName==`string`&&e.animationName.startsWith(`wui-tour-`);function Nd(e){return e.length===0?null:new Promise(t=>{let n=setTimeout(t,Ed);Promise.allSettled(e.map(e=>e.finished)).then(()=>{clearTimeout(n),t()})})}function Pd(e){let t=e.parentElement?.querySelector(`:scope > .wui-tour-spot`),n=0;for(let e of t?kd(t,jd):[]){let t=e.effect?.getComputedTiming?.();if(typeof t?.duration!=`number`)continue;let r=typeof e.currentTime==`number`?e.currentTime:0;n=Math.max(n,(t.delay??0)+t.duration*Td-r)}return n}function Fd(e){let t=Pd(e);t>0?e.style.setProperty(`--wui-tour-card-delay`,`${Math.round(t)}ms`):e.style.removeProperty(`--wui-tour-card-delay`),e.dataset.state=`entering`;let n={};Od.set(e,n);let r=()=>{Od.get(e)===n&&e.dataset.state===`entering`&&(e.dataset.state=`shown`)},i=kd(e,Md);i.length===0?r():Promise.allSettled(i.map(e=>e.finished)).then(r)}function Id(e){return e.dataset.state=`leaving`,Nd(kd(e,Ad))}function Ld(e){let t=e.classList.contains(`wui-tour-layer`)?e:e.shadowRoot?.querySelector(`.wui-tour-layer`);t&&(t.dataset.state=`leaving`);let n=t?Nd(kd(t,Ad)):null;if(!n){e.remove();return}e.setAttribute(`inert`,``),n.then(()=>e.remove())}var Rd=2,Q=12,zd=8,Bd=4,Vd=20,Hd=`(max-width: 575.98px)`,Ud=[`bottom`,`top`,`right`,`left`],Wd=[`top-left`,`top-right`,`bottom-right`,`bottom-left`],Gd,Kd=(e,t,n)=>Math.max(t,Math.min(e,n)),qd=(e,t,n,r)=>(Math.max(e,n)+Math.min(t,r))/2;function Jd(e,t){if(!t?.scrollIntoView)return;e.style.maxHeight=``;let n=ef(e),r=e.offsetHeight+Q;if(t.getBoundingClientRect().height+Rd*2+r*2<=n.bottom-n.top){t.scrollIntoView({block:`center`,inline:`nearest`});return}let i=t.style.scrollMarginTop;t.style.scrollMarginTop=`${n.top+r+Rd}px`,t.scrollIntoView({block:`start`,inline:`nearest`}),t.style.scrollMarginTop=i}function Yd(e,t,n){let r=e.style,i=t.style,a=tf(t);if(!n){r.top=`50%`,r.left=`50%`,r.width=`0px`,r.height=`0px`,r.boxShadow=`0 0 0 100vmax var(--color-scrim-strong)`;for(let e of Wd)r.removeProperty(`border-${e}-radius`),r.removeProperty(`corner-${e}-shape`);t.dataset.placement=`center`,a.hidden=!0,i.position=`fixed`,i.top=`50%`,i.left=`50%`,i.transform=`translate(-50%, -50%)`,i.maxHeight=`calc(100vh - 16px)`;return}r.boxShadow=``,i.transform=``,i.position=`fixed`;let o=n.getBoundingClientRect();r.top=`${o.top}px`,r.left=`${o.left}px`,r.width=`${o.width}px`,r.height=`${o.height}px`,Xd(r,n);let s=t.scrollTop;i.maxHeight=``;let c={width:t.offsetWidth,height:t.offsetHeight},l=ef(t),u=l.bottom-l.top,d={bottom:l.bottom-o.bottom-Q,top:o.top-Q-l.top,right:l.right-o.right-Q,left:o.left-Q-l.left},f=window.matchMedia(Hd).matches,p=Ud.find(e=>e===`top`||e===`bottom`?c.height<=d[e]+1:!f&&c.width<=d[e]+1&&c.height<=u+1),m=Math.min(o.bottom,l.bottom+zd)-Math.max(o.top,l.top-zd);p?Zd(t,a,p,o,l,c):m>=Math.min(c.height,u)+Bd*2?Qd(t,a,o,l,c):$d(t,a,d.bottom>=d.top?`bottom`:`top`,o,l,c,d),t.scrollTop=s}function Xd(e,t){Gd??=CSS.supports(`corner-top-left-shape`,`squircle`);let n=getComputedStyle(t);for(let t of Wd)e.setProperty(`border-${t}-radius`,n.getPropertyValue(`border-${t}-radius`)),Gd&&e.setProperty(`corner-${t}-shape`,n.getPropertyValue(`corner-${t}-shape`))}function Zd(e,t,n,r,i,a){let o=n===`top`||n===`bottom`,s,c,l;if(o){let e=qd(r.left,r.right,i.left,i.right);s=Kd(e-a.width/2,i.left,i.right-a.width),c=n===`bottom`?r.bottom+Q:r.top-Q-a.height,l=Kd(e-s,Vd,a.width-Vd)}else{let e=qd(r.top,r.bottom,i.top,i.bottom);c=Kd(e-a.height/2,i.top,i.bottom-a.height),s=n===`right`?r.right+Q:r.left-Q-a.width,l=Kd(e-c,Vd,a.height-Vd)}e.dataset.placement=n,e.style.top=`${c}px`,e.style.left=`${s}px`,t.hidden=!1,t.style.left=o?`${l-e.clientLeft-t.offsetWidth/2}px`:``,t.style.top=o?``:`${l-e.clientTop-t.offsetHeight/2}px`}function Qd(e,t,n,r,i){let a=r.bottom-r.top;e.dataset.placement=`overlap`,t.hidden=!0,e.style.maxHeight=i.height>a?`${Math.max(a,0)}px`:``;let o=Math.min(n.bottom,r.bottom)-Bd;e.style.top=`${Math.max(r.top,o-Math.min(i.height,a))}px`,e.style.left=`${Kd(n.left+Bd,r.left,r.right-i.width)}px`}function $d(e,t,n,r,i,a,o){let s=Math.max(o[n],0),c=Math.min(a.height,s);e.dataset.placement=n,t.hidden=!0,e.style.maxHeight=a.height>s?`${s}px`:``,e.style.top=`${n===`bottom`?r.bottom+Q:r.top-Q-c}px`;let l=qd(r.left,r.right,i.left,i.right);e.style.left=`${Kd(l-a.width/2,i.left,i.right-a.width)}px`}function ef(e){let t=e.parentElement,n=t?getComputedStyle(t):null,r=e=>Number.parseFloat(n?.[e])||0;return{top:r(`paddingTop`)+zd,bottom:window.innerHeight-r(`paddingBottom`)-zd,left:r(`paddingLeft`)+zd,right:window.innerWidth-r(`paddingRight`)-zd}}function tf(e){let t=e.querySelector(`:scope > .wui-tour-arrow`);return t||(t=document.createElement(`span`),t.className=`wui-tour-arrow`,t.setAttribute(`aria-hidden`,`true`),t.hidden=!0,e.append(t)),t}var nf=0;function rf(e,t,n){let r=`wui-tour-end-${++nf}`,i=e.createElement(`div`);return i.className=`wui-tour-card wui-tour-end`,i.dataset.layout=`center`,i.setAttribute(`role`,`dialog`),n&&i.setAttribute(`aria-modal`,`true`),i.tabIndex=-1,i.setAttribute(`aria-labelledby`,`${r}-title`),i.setAttribute(`aria-describedby`,`${r}-message`),i.innerHTML=`
446
+ </div>`,this._rendered=!0,this._syncAttrs(),this._syncText(),this._syncInvalid(),z(this,this._value),this._wire()}_input(){return this.querySelector(`.timepicker-trigger`)}_pop(){return this.querySelector(`.timepicker-pop`)}_syncFormValue(){z(this,this._value)}_syncAttrs(){let e=this._input(),t=this.querySelector(`.wui-timepicker-toggle`);if(!e)return;let n=this.hasAttribute(`disabled`);e.disabled=n,t&&(t.disabled=n),e.placeholder=this.getAttribute(`placeholder`)||`Select time`,this.hasAttribute(`required`)?e.setAttribute(`aria-required`,`true`):e.removeAttribute(`aria-required`);let r=this.getAttribute(`aria-label`);r?e.setAttribute(`aria-label`,r):e.removeAttribute(`aria-label`),z(this,this._value),n&&this._isOpen?.()&&this._close({commit:!1})}_syncText(){let e=this._input();e&&(e.value=cd(sd(this._value),this._format()),this._isOpen?.()&&this._syncColumns())}_syncInvalid(){let e=this._input(),t=this.querySelector(`.wui-timepicker-error`);if(!e||!t)return;let n=this._typedError;t.textContent=n,t.hidden=!n,this.hasAttribute(`aria-invalid`)||n?e.setAttribute(`aria-invalid`,`true`):e.removeAttribute(`aria-invalid`);let r=[this.getAttribute(`aria-describedby`),n?t.id:null].filter(Boolean).join(` `);r?e.setAttribute(`aria-describedby`,r):e.removeAttribute(`aria-describedby`),e.setCustomValidity?.(n)}_commitText(){let e=this._input();if(!e||e.value===cd(sd(this._value),this._format()))return!0;let t=e.value.trim(),n=``;if(t){let e=ld(t),r=e?this._refusal(e):`Enter a time like ${this._format()===`12`?`7:45 PM`:`19:45`}.`;if(r)return this._typedError=r,this._syncInvalid(),!1;n=od(e.h,e.m)}let r=n!==this._value;return this.value=n,r&&this.dispatchEvent(new Event(`change`,{bubbles:!0})),!0}_pending(){let e=ld(this._input()?.value);return e&&this._allowed(e.h,e.m)?e:null}_columnsHtml(){let e=this._format(),t=this._times(),n=(e,t,n)=>`<div class="wui-timepicker-col" role="listbox" aria-label="${t}" data-col="${e}">${n.map(e=>`<button type="button" class="timepicker-option" role="option" tabindex="-1" aria-selected="false" data-v="${e.v}">${e.text}</button>`).join(``)}</div>`,r=[...new Set(t.map(e=>e.h))],i=[...new Set(t.map(e=>e.m))].sort((e,t)=>e-t),a;if(e===`12`){let e=[...new Set(r.map(e=>e%12))].sort((e,t)=>e-t),t=[...new Set(r.map(e=>e>=12?`pm`:`am`))].sort();a=n(`hour`,`Hour`,e.map(e=>({v:e,text:String(e||12)})))+n(`minute`,`Minute`,i.map(e=>({v:e,text:ad(e)})))+n(`period`,`AM or PM`,t.map(e=>({v:e,text:e.toUpperCase()})))}else a=n(`hour`,`Hour`,r.map(e=>({v:e,text:ad(e)})))+n(`minute`,`Minute`,i.map(e=>({v:e,text:ad(e)})));return`<div class="wui-timepicker-cols">${a}</div>`}_selectedIn(e,t){return t?e===`minute`?String(t.m):e===`period`?t.h>=12?`pm`:`am`:String(this._format()===`12`?t.h%12:t.h):null}_optionEnabled(e,t,n){if(!n)return!0;let r=this._format()===`12`,i=n.h>=12,a=e=>r?[e+(i?12:0)]:[e],o=Array.from({length:60},(e,t)=>t);if(e===`hour`)return a(+t).some(e=>o.some(t=>this._allowed(e,t)));if(e===`minute`)return this._allowed(n.h,+t);let s=t===`pm`?12:0;return Array.from({length:12},(e,t)=>s+t).some(e=>o.some(t=>this._allowed(e,t)))}_syncColumns({scroll:e=!1}={}){let t=this._pop();if(!t)return;let n=this._pending();for(let r of t.querySelectorAll(`.wui-timepicker-col`)){let t=r.dataset.col,i=this._selectedIn(t,n),a=[...r.querySelectorAll(`.timepicker-option`)],o=null;for(let e of a){let r=e.dataset.v===i;e.classList.toggle(`is-selected`,r),e.setAttribute(`aria-selected`,r?`true`:`false`),e.disabled=!r&&!this._optionEnabled(t,e.dataset.v,n),r&&(o=e)}o=o||a.find(e=>!e.disabled)||null;for(let e of a)e.tabIndex=e===o?0:-1;e&&o&&(r.scrollTop=o.offsetTop-(r.clientHeight-o.offsetHeight)/2)}}_pick(e,t){let n=this._times();if(!n.length)return;let r=this._pending()||n[0],i=this._format()===`12`,a=r.h,o=r.m;if(e===`minute`?o=+t:a=e===`period`?a%12+(t===`pm`?12:0):i?+t+(r.h>=12?12:0):+t,!this._allowed(a,o)){let t=a*60+o,r=n.filter(t=>e===`minute`?t.m===o:e===`period`?t.h>=12==a>=12:i?t.h%12==a%12&&t.h>=12==a>=12:t.h===a).sort((e,n)=>Math.abs(e.h*60+e.m-t)-Math.abs(n.h*60+n.m-t))[0];if(!r)return;a=r.h,o=r.m}let s=this._input();s.value=cd({h:a,m:o},this._format()),this._typedError=``,this._syncInvalid(),this._syncColumns()}_position(){o(this.querySelector(`.wui-timepicker-field`),this._pop())}_onColumnKey(e){let t=e.target.closest?.(`.timepicker-option`),n=t?.closest(`.wui-timepicker-col`);if(!t||!n)return;let r=[...n.querySelectorAll(`.timepicker-option`)].filter(e=>!e.disabled),i=r.indexOf(t),a=[...this._pop().querySelectorAll(`.wui-timepicker-col`)],o=e=>{e&&(this._pick(n.dataset.col,e.dataset.v),(n.querySelector(`.timepicker-option.is-selected`)||e).focus())};switch(e.key){case`ArrowDown`:e.preventDefault(),o(r[Math.min(i+1,r.length-1)]);return;case`ArrowUp`:e.preventDefault(),o(r[Math.max(i-1,0)]);return;case`Home`:e.preventDefault(),o(r[0]);return;case`End`:e.preventDefault(),o(r[r.length-1]);return;case`PageDown`:e.preventDefault(),o(r[Math.min(i+8,r.length-1)]);return;case`PageUp`:e.preventDefault(),o(r[Math.max(i-8,0)]);return;case`ArrowRight`:case`ArrowLeft`:e.preventDefault(),a[a.indexOf(n)+(e.key===`ArrowRight`?1:-1)]?.querySelector(`.timepicker-option[tabindex="0"]`)?.focus();return;case`Enter`:e.preventDefault(),this._close({commit:!0,refocus:!0});return;case` `:e.preventDefault(),o(t);return;case`Escape`:e.preventDefault(),e.stopPropagation(),this._close({commit:!1,refocus:!0});return;default:e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&(e.preventDefault(),clearTimeout(this._typeaheadTimer),this._typeahead+=e.key.toLowerCase(),this._typeaheadTimer=setTimeout(()=>{this._typeahead=``,this._typeaheadTimer=null},500),o(r.find(e=>e.textContent.trim().toLowerCase().startsWith(this._typeahead))))}}_wire(){this._teardown();let e=this._input(),t=this.querySelector(`.wui-timepicker-toggle`),n=this._pop(),r=this.querySelector(`.timepicker`);if(!e||!n)return;let i=()=>!n.hidden;this._isOpen=i;let a=()=>{i()&&this._position()},o=()=>n.querySelector(`.wui-timepicker-col .timepicker-option[tabindex="0"]`)?.focus();this._open=({focus:c=!1}={})=>{this.hasAttribute(`disabled`)||(i()||(n.innerHTML=this._columnsHtml(),n.hidden=!1,r?.classList.add(`open`),e.setAttribute(`aria-expanded`,`true`),t?.setAttribute(`aria-expanded`,`true`),this._position(),s(this,a),this._syncColumns({scroll:!0})),c&&o())},this._close=({commit:a=!0,refocus:o=!1}={})=>{if(!i())return;let s=n.contains(document.activeElement);n.hidden=!0,n.innerHTML=``,r?.classList.remove(`open`),e.setAttribute(`aria-expanded`,`false`),t?.setAttribute(`aria-expanded`,`false`),c(this),clearTimeout(this._typeaheadTimer),this._typeaheadTimer=null,this._typeahead=``,a?this._commitText():(this._typedError=``,this._syncText(),this._syncInvalid()),(o||s)&&e.focus()},e.addEventListener(`pointerdown`,e=>{this._lastPointer=e.pointerType}),e.addEventListener(`click`,()=>{this._lastPointer!==`touch`&&!i()&&this._open(),this._lastPointer=null}),t?.addEventListener(`click`,()=>{i()?this._close({commit:!0,refocus:!0}):this._open({focus:!0})}),e.addEventListener(`keydown`,e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`)e.preventDefault(),this._open({focus:!0});else if(e.key===`Enter`){let t=i(),n=this._commitText();t&&n&&this._close({commit:!1}),(!n||t)&&e.preventDefault()}else e.key===`Escape`&&i()?(e.preventDefault(),e.stopPropagation(),this._close({commit:!1})):e.key===`Tab`&&i()&&this._close({commit:!0})}),e.addEventListener(`input`,e=>{e.stopPropagation(),this._typedError&&(this._typedError=``,this._syncInvalid()),i()&&this._syncColumns({scroll:!0})}),e.addEventListener(`change`,e=>{e.stopPropagation(),i()||this._commitText()}),n.addEventListener(`click`,e=>{this._popClick=!0;let t=e.target.closest(`.timepicker-option`),n=t?.closest(`.wui-timepicker-col`);t&&n&&!t.disabled&&this._pick(n.dataset.col,t.dataset.v)}),n.addEventListener(`keydown`,e=>{i()&&this._onColumnKey(e)}),this._bindGlobal=()=>{this._teardown(),this._onDocClick=e=>{let t=this._popClick;this._popClick=!1,i()&&!t&&!this.contains(e.target)&&this._close({commit:!0})},document.addEventListener(`click`,this._onDocClick),this._onDocKey=e=>{i()&&e.key===`Escape`&&this._close({commit:!1})},document.addEventListener(`keydown`,this._onDocKey),this._onHostKey=e=>{!i()||e.key!==`Escape`||(e.preventDefault(),e.stopPropagation(),this._close({commit:!1,refocus:!0}))},this.addEventListener(`keydown`,this._onHostKey),i()&&s(this,a)},this._bindGlobal()}_teardown(){this._onDocClick&&=(document.removeEventListener(`click`,this._onDocClick),null),this._onDocKey&&=(document.removeEventListener(`keydown`,this._onDocKey),null),this._onHostKey&&=(this.removeEventListener(`keydown`,this._onHostKey),null),c(this),clearTimeout(this._typeaheadTimer),this._typeaheadTimer=null,this._typeahead=``}disconnectedCallback(){this._teardown()}},fd=`data-advance`,pd=`wui-tour-hint`,md=`Click {actionName} to continue.`,hd=`a[href], button, input, select, textarea, summary, [tabindex], [contenteditable]`,gd=(e,t)=>e?.advanceOn===`click`&&!!t,_d=e=>(e??``).replace(/\s+/g,` `).trim();function vd(e){let t=e.ownerDocument,n=(e.getAttribute(`aria-labelledby`)||``).split(/\s+/).filter(Boolean),r=e.tagName===`INPUT`&&/^(button|submit|reset)$/.test(e.type)?e.value:``,i=[n.map(e=>t.getElementById(e)?.textContent??``).join(` `),e.getAttribute(`aria-label`),Array.from(e.labels??[],e=>e.textContent).join(` `),e.getAttribute(`alt`),r,e.textContent,e.getAttribute(`title`)];for(let e of i){let t=_d(e);if(t)return t}return``}function yd(e){for(let t of[e,...e.querySelectorAll(hd)])if(t.tabIndex>=0&&!t.disabled)return t;return null}function bd(e,t,n){let r=(e.getAttribute(`aria-describedby`)||``).split(/\s+/).filter(e=>e&&e!==t);n&&r.push(t),r.length>0?e.setAttribute(`aria-describedby`,r.join(` `)):e.removeAttribute(`aria-describedby`)}function xd(e,t){let n=e.querySelector(`.${pd}`),r=e.querySelector(`.wui-tour-text`)?.id,i=r?`${r.replace(/-text$/,``)}-hint`:``;if(!t){n?.remove(),i&&bd(e,i,!1);return}n||(n=e.ownerDocument.createElement(`p`),n.className=pd,i&&(n.id=i),e.querySelector(`.wui-tour-actions`).before(n)),n.textContent=t,i&&bd(e,i,!0)}var Sd=e=>getComputedStyle(e).animationName;function Cd(e,{layer:t,spot:n,card:r},i,a){let o=gd(i,a);t.toggleAttribute(fd,o&&!(t.getRootNode()instanceof ShadowRoot)),n.hasAttribute(fd)&&(n.removeAttribute(fd),o&&Sd(n)),o&&n.setAttribute(fd,``);let s=r.querySelector(`.wui-tour-next`);s.classList.toggle(`btn-primary`,!o),s.classList.toggle(`btn-link`,o);let c=o?_d(i.actionLabel)||vd(a):``,l=e.getAttribute(`advance-label`)||md,u=c?l.replace(/\{actionName\}/g,()=>c):``;return xd(r,u),u}function wd(e,t,n){if(!gd(e,t))return()=>{};let r=null,i=()=>{r??=setTimeout(n,0)};return t.addEventListener(`click`,i),()=>{t.removeEventListener(`click`,i),clearTimeout(r)}}function Td(e,t,n,r){return e.contains(r)||gd(t,n)&&n.contains(r)}function Ed(e,{card:t,active:n,step:r,target:i}){let a=Array.from(t.querySelectorAll(`button`)).filter(e=>!e.hidden),o=gd(r,i)?yd(i):null;o&&a.push(o);let s=a.findIndex(e=>e===n||e===o&&i.contains(n));e.preventDefault(),a[s===-1?e.shiftKey?a.length-1:0:(s+(e.shiftKey?-1:1)+a.length)%a.length].focus()}var Dd=2/3,Od=1e3,kd=new Set([`top`,`left`,`width`,`height`]),Ad=new WeakMap,jd=(e,t)=>typeof e.getAnimations==`function`?e.getAnimations().filter(t):[],Md=e=>e.transitionProperty===`opacity`,Nd=e=>kd.has(e.transitionProperty),Pd=e=>typeof e.animationName==`string`&&e.animationName.startsWith(`wui-tour-`);function Fd(e){return e.length===0?null:new Promise(t=>{let n=setTimeout(t,Od);Promise.allSettled(e.map(e=>e.finished)).then(()=>{clearTimeout(n),t()})})}function Id(e){let t=e.parentElement?.querySelector(`:scope > .wui-tour-spot`),n=0;for(let e of t?jd(t,Nd):[]){let t=e.effect?.getComputedTiming?.();if(typeof t?.duration!=`number`)continue;let r=typeof e.currentTime==`number`?e.currentTime:0;n=Math.max(n,(t.delay??0)+t.duration*Dd-r)}return n}function Ld(e){let t=Id(e);t>0?e.style.setProperty(`--wui-tour-card-delay`,`${Math.round(t)}ms`):e.style.removeProperty(`--wui-tour-card-delay`),e.dataset.state=`entering`;let n={};Ad.set(e,n);let r=()=>{Ad.get(e)===n&&e.dataset.state===`entering`&&(e.dataset.state=`shown`)},i=jd(e,Pd);i.length===0?r():Promise.allSettled(i.map(e=>e.finished)).then(r)}function Rd(e){return e.dataset.state=`leaving`,Fd(jd(e,Md))}function zd(e){let t=e.classList.contains(`wui-tour-layer`)?e:e.shadowRoot?.querySelector(`.wui-tour-layer`);t&&(t.dataset.state=`leaving`);let n=t?Fd(jd(t,Md)):null;if(!n){e.remove();return}e.setAttribute(`inert`,``),n.then(()=>e.remove())}var Bd=2,Q=12,Vd=8,Hd=4,Ud=20,Wd=`(max-width: 575.98px)`,Gd=[`bottom`,`top`,`right`,`left`],Kd=[`top-left`,`top-right`,`bottom-right`,`bottom-left`],qd,Jd=(e,t,n)=>Math.max(t,Math.min(e,n)),Yd=(e,t,n,r)=>(Math.max(e,n)+Math.min(t,r))/2;function Xd(e,t){if(!t?.scrollIntoView)return;e.style.maxHeight=``;let n=nf(e),r=e.offsetHeight+Q;if(t.getBoundingClientRect().height+Bd*2+r*2<=n.bottom-n.top){t.scrollIntoView({block:`center`,inline:`nearest`});return}let i=t.style.scrollMarginTop;t.style.scrollMarginTop=`${n.top+r+Bd}px`,t.scrollIntoView({block:`start`,inline:`nearest`}),t.style.scrollMarginTop=i}function Zd(e,t,n){let r=e.style,i=t.style,a=rf(t);if(!n){r.top=`50%`,r.left=`50%`,r.width=`0px`,r.height=`0px`,r.boxShadow=`0 0 0 100vmax var(--color-scrim-strong)`;for(let e of Kd)r.removeProperty(`border-${e}-radius`),r.removeProperty(`corner-${e}-shape`);t.dataset.placement=`center`,a.hidden=!0,i.position=`fixed`,i.top=`50%`,i.left=`50%`,i.transform=`translate(-50%, -50%)`,i.maxHeight=`calc(100vh - 16px)`;return}r.boxShadow=``,i.transform=``,i.position=`fixed`;let o=n.getBoundingClientRect();r.top=`${o.top}px`,r.left=`${o.left}px`,r.width=`${o.width}px`,r.height=`${o.height}px`,Qd(r,n);let s=t.scrollTop;i.maxHeight=``;let c={width:t.offsetWidth,height:t.offsetHeight},l=nf(t),u=l.bottom-l.top,d={bottom:l.bottom-o.bottom-Q,top:o.top-Q-l.top,right:l.right-o.right-Q,left:o.left-Q-l.left},f=window.matchMedia(Wd).matches,p=Gd.find(e=>e===`top`||e===`bottom`?c.height<=d[e]+1:!f&&c.width<=d[e]+1&&c.height<=u+1),m=Math.min(o.bottom,l.bottom+Vd)-Math.max(o.top,l.top-Vd);p?$d(t,a,p,o,l,c):m>=Math.min(c.height,u)+Hd*2?ef(t,a,o,l,c):tf(t,a,d.bottom>=d.top?`bottom`:`top`,o,l,c,d),t.scrollTop=s}function Qd(e,t){qd??=CSS.supports(`corner-top-left-shape`,`squircle`);let n=getComputedStyle(t);for(let t of Kd)e.setProperty(`border-${t}-radius`,n.getPropertyValue(`border-${t}-radius`)),qd&&e.setProperty(`corner-${t}-shape`,n.getPropertyValue(`corner-${t}-shape`))}function $d(e,t,n,r,i,a){let o=n===`top`||n===`bottom`,s,c,l;if(o){let e=Yd(r.left,r.right,i.left,i.right);s=Jd(e-a.width/2,i.left,i.right-a.width),c=n===`bottom`?r.bottom+Q:r.top-Q-a.height,l=Jd(e-s,Ud,a.width-Ud)}else{let e=Yd(r.top,r.bottom,i.top,i.bottom);c=Jd(e-a.height/2,i.top,i.bottom-a.height),s=n===`right`?r.right+Q:r.left-Q-a.width,l=Jd(e-c,Ud,a.height-Ud)}e.dataset.placement=n,e.style.top=`${c}px`,e.style.left=`${s}px`,t.hidden=!1,t.style.left=o?`${l-e.clientLeft-t.offsetWidth/2}px`:``,t.style.top=o?``:`${l-e.clientTop-t.offsetHeight/2}px`}function ef(e,t,n,r,i){let a=r.bottom-r.top;e.dataset.placement=`overlap`,t.hidden=!0,e.style.maxHeight=i.height>a?`${Math.max(a,0)}px`:``;let o=Math.min(n.bottom,r.bottom)-Hd;e.style.top=`${Math.max(r.top,o-Math.min(i.height,a))}px`,e.style.left=`${Jd(n.left+Hd,r.left,r.right-i.width)}px`}function tf(e,t,n,r,i,a,o){let s=Math.max(o[n],0),c=Math.min(a.height,s);e.dataset.placement=n,t.hidden=!0,e.style.maxHeight=a.height>s?`${s}px`:``,e.style.top=`${n===`bottom`?r.bottom+Q:r.top-Q-c}px`;let l=Yd(r.left,r.right,i.left,i.right);e.style.left=`${Jd(l-a.width/2,i.left,i.right-a.width)}px`}function nf(e){let t=e.parentElement,n=t?getComputedStyle(t):null,r=e=>Number.parseFloat(n?.[e])||0;return{top:r(`paddingTop`)+Vd,bottom:window.innerHeight-r(`paddingBottom`)-Vd,left:r(`paddingLeft`)+Vd,right:window.innerWidth-r(`paddingRight`)-Vd}}function rf(e){let t=e.querySelector(`:scope > .wui-tour-arrow`);return t||(t=document.createElement(`span`),t.className=`wui-tour-arrow`,t.setAttribute(`aria-hidden`,`true`),t.hidden=!0,e.append(t)),t}var af=0;function of(e,t,n){let r=`wui-tour-end-${++af}`,i=e.createElement(`div`);return i.className=`wui-tour-card wui-tour-end`,i.dataset.layout=`center`,i.setAttribute(`role`,`dialog`),n&&i.setAttribute(`aria-modal`,`true`),i.tabIndex=-1,i.setAttribute(`aria-labelledby`,`${r}-title`),i.setAttribute(`aria-describedby`,`${r}-message`),i.innerHTML=`
447
447
  <div class="wui-tour-end-mark" aria-hidden="true"><svg viewBox="0 0 24 24" focusable="false"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></div>
448
448
  <h2 class="wui-tour-title wui-tour-end-title" id="${r}-title"></h2>
449
449
  <p class="wui-tour-text wui-tour-end-message" id="${r}-message"></p>
450
- <div class="wui-tour-actions"><button type="button" class="btn btn-sm btn-primary wui-tour-end-button"></button></div>`,i.querySelector(`.wui-tour-end-title`).textContent=t.title,i.querySelector(`.wui-tour-end-message`).textContent=t.message,i.querySelector(`.wui-tour-end-button`).textContent=t.button,i}function af(e,t,n){let r=e.ownerDocument,i=e.getRootNode()===r,a=e.querySelector(`.wui-tour-card:not(.wui-tour-end)`),o=e.querySelector(`.wui-tour-spot`),s=e.querySelector(`[role=status]`),c=rf(r,t,i),l=c.querySelector(`.wui-tour-end-button`),u=new AbortController;return new Promise(d=>{let f=()=>{u.abort(),d()};if(n?.aborted){f();return}let p={signal:u.signal};n?.addEventListener(`abort`,f,p),l.addEventListener(`click`,f,p),r.addEventListener(`keydown`,e=>{e.altKey||e.ctrlKey||e.metaKey||(e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),f()):e.key===`Tab`&&i&&(e.preventDefault(),l.focus()))},{capture:!0,signal:u.signal}),i&&r.addEventListener(`focusin`,e=>{c.contains(e.target)||l.focus()},p);let m=()=>{u.signal.aborted||(a.hidden=!0,Yd(o,a,null),e.append(c),Fd(c),s.textContent=[t.title,t.message].filter(Boolean).join(`. `),l.focus())},h=Id(a);h?h.then(m):m()})}var of=`
450
+ <div class="wui-tour-actions"><button type="button" class="btn btn-sm btn-primary wui-tour-end-button"></button></div>`,i.querySelector(`.wui-tour-end-title`).textContent=t.title,i.querySelector(`.wui-tour-end-message`).textContent=t.message,i.querySelector(`.wui-tour-end-button`).textContent=t.button,i}function sf(e,t,n){let r=e.ownerDocument,i=e.getRootNode()===r,a=e.querySelector(`.wui-tour-card:not(.wui-tour-end)`),o=e.querySelector(`.wui-tour-spot`),s=e.querySelector(`[role=status]`),c=of(r,t,i),l=c.querySelector(`.wui-tour-end-button`),u=new AbortController;return new Promise(d=>{let f=()=>{u.abort(),d()};if(n?.aborted){f();return}let p={signal:u.signal};n?.addEventListener(`abort`,f,p),l.addEventListener(`click`,f,p),r.addEventListener(`keydown`,e=>{e.altKey||e.ctrlKey||e.metaKey||(e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),f()):e.key===`Tab`&&i&&(e.preventDefault(),l.focus()))},{capture:!0,signal:u.signal}),i&&r.addEventListener(`focusin`,e=>{c.contains(e.target)||l.focus()},p);let m=()=>{u.signal.aborted||(a.hidden=!0,Zd(o,a,null),e.append(c),Ld(c),s.textContent=[t.title,t.message].filter(Boolean).join(`. `),l.focus())},h=Rd(a);h?h.then(m):m()})}var cf=`
451
451
  :host {
452
452
  all: initial;
453
453
  ${Object.entries({"--wui-z-tour":`1550`,"--wui-radius-sm":`8px`,"--wui-radius-lg":`14px`,"--wui-shadow-overlay":`0 8px 28px -6px rgba(7, 20, 55, 0.14)`,"--wui-ease-out-quart":`cubic-bezier(0.22, 1, 0.36, 1)`,"--wui-tour-motion-duration":`200ms`,"--wui-tour-motion-ease":`cubic-bezier(0.22, 1, 0.36, 1)`,"--wui-tour-spot-duration":`240ms`,"--wui-tour-spot-ease":`cubic-bezier(0.32, 0.72, 0, 1)`,"--color-primary":`#4F46E5`,"--color-primary-hover":`#4338CA`,"--color-primary-ink":`#4F46E5`,"--color-focus-ring":`#4F46E5`,"--wui-focus-ring-width":`2px`,"--wui-focus-ring-offset":`2px`,"--color-primary-text":`#FFFFFF`,"--color-success-soft":`#E8FAEE`,"--color-success-text":`#0e7531`,"--color-on-scrim":`#FFFFFF`,"--color-scrim-strong":`color-mix(in srgb, #071437 62%, transparent)`,"--color-surface":`#FFFFFF`,"--color-text":`#071437`,"--color-text-muted":`#4B5675`,"--color-border":`#EBEDF3`,"--color-bg-muted":`#F5F6FA`}).map(([e,t])=>` ${e}: ${t};`).join(`
@@ -916,7 +916,7 @@ ${Object.entries({"--wui-z-tour":`1550`,"--wui-radius-sm":`8px`,"--wui-radius-lg
916
916
  }
917
917
  }
918
918
 
919
- `,sf=`wui-tour-media`,cf=`wui-tour-media-toggle`,lf=`http://www.w3.org/2000/svg`,uf=`M6 5h4v14H6zM14 5h4v14h-4z`,df=`M8 5v14l11-7z`,ff={pause:`Pause animation`,play:`Play animation`},pf=()=>globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`)?.matches===!0;function mf(e){let t=document.createElementNS(lf,`svg`);t.setAttribute(`viewBox`,`0 0 24 24`),t.setAttribute(`aria-hidden`,`true`),t.setAttribute(`focusable`,`false`);let n=document.createElementNS(lf,`path`);return n.setAttribute(`d`,e),t.appendChild(n),t}function hf(e){let t=document.createElement(`img`);return t.setAttribute(`alt`,e.mediaAlt??``),t.setAttribute(`width`,`1280`),t.setAttribute(`height`,`720`),t.setAttribute(`loading`,`lazy`),t.setAttribute(`decoding`,`async`),t.setAttribute(`src`,e.media),t}function gf(e,t){let n=document.createElement(`video`);return n.muted=!0,n.setAttribute(`muted`,``),n.loop=!0,n.setAttribute(`playsinline`,``),t&&n.setAttribute(`autoplay`,``),n.setAttribute(`preload`,t?`auto`:`metadata`),e.mediaAlt&&n.setAttribute(`aria-label`,e.mediaAlt),e.mediaPoster&&n.setAttribute(`poster`,e.mediaPoster),n.setAttribute(`src`,e.media),n}function _f(e,t){let n=document.createElement(`button`);n.type=`button`,n.className=cf;let r=(r=!e.paused)=>{n.setAttribute(`aria-label`,r?t.pause:t.play),n.replaceChildren(mf(r?uf:df))};return e.addEventListener(`play`,()=>r()),e.addEventListener(`pause`,()=>r()),n.addEventListener(`click`,()=>{e.paused?e.play()?.catch(()=>r()):e.pause()}),r(e.hasAttribute(`autoplay`)),n}function vf(e){let t=e.querySelector(`:scope > .${sf}`);if(!t)return;let n=t.querySelector(`video`);n&&(n.pause(),n.removeAttribute(`src`),n.load()),t.remove()}function yf(e,t,n=ff){if(vf(e),!t.media){e.removeAttribute(`data-media`);return}let r=document.createElement(`div`);if(r.className=sf,t.mediaType===`video`){let e=gf(t,!pf());r.append(e,_f(e,n))}else r.appendChild(hf(t));e.prepend(r),e.setAttribute(`data-media`,t.target?`step`:`welcome`)}var bf=`Step {current} of {total}`;function xf(e){let t=new Set;return{drop:e=>{t.add(e)},position:e=>{t.delete(e);let n=0;for(let r of t)r<e&&n++;return e+1-n},total:()=>e-t.size}}function Sf(e,t,n){return(e.getAttribute(`progress-label`)||bf).replace(/\{(current|total)\}/g,(e,r)=>String(r===`current`?t:n))}function Cf(e,{text:t,position:n,total:r}){let i=e.querySelector(`.wui-tour-position`);i.textContent=t;let a=e.querySelector(`.wui-tour-progress-bar`);if(!a){let t=e.ownerDocument,n=t.createElement(`div`);n.className=`wui-tour-progress`,n.setAttribute(`aria-hidden`,`true`),a=t.createElement(`div`),a.className=`wui-tour-progress-bar`,n.append(a),i.before(n)}let o=a.children;for(;o.length<r;){let t=e.ownerDocument.createElement(`span`);t.className=`wui-tour-progress-segment`,a.append(t)}for(;o.length>r;)a.lastElementChild.remove();for(let e=0;e<o.length;e++)o[e].toggleAttribute(`data-filled`,e<n)}var wf=`wui-tour-step`,Tf=`wui-tour-host`,Ef=`wui-tour-seen:`,Df=`data-tracking`,Of={back:`Back`,next:`Next`,skip:`Skip`,done:`Done`,mediaPause:`Pause animation`,mediaPlay:`Play animation`,endTitle:`You're all set`,endMessage:`You know your way around now. Enjoy exploring.`,endButton:`Done`},kf={back:`back-label`,next:`next-label`,skip:`skip-label`,done:`done-label`,mediaPause:`media-pause-label`,mediaPlay:`media-play-label`,endTitle:`end-title`,endMessage:`end-message`,endButton:`end-button`},Af=[[`media`,`media`],[`mediaAlt`,`media-alt`],[`mediaPoster`,`media-poster`],[`mediaType`,`media-type`],[`advanceOn`,`advance-on`],[`actionLabel`,`action-label`]],jf={index:null,position:null,total:null},Mf=0;function Nf(e=Ef,t=globalThis.localStorage){return{isSeen:async n=>t.getItem(e+n)===`1`,markSeen:async n=>{t.setItem(e+n,`1`)}}}var Pf=e=>!e?.isConnected||getComputedStyle(e).visibility===`hidden`?!1:e.getClientRects().length>0,Ff=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName)),If=()=>{let e=document.activeElement;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e},Lf=null;function Rf(e){if(`adoptedStyleSheets`in e&&typeof CSSStyleSheet==`function`&&`replaceSync`in CSSStyleSheet.prototype){Lf||(Lf=new CSSStyleSheet,Lf.replaceSync(of)),e.adoptedStyleSheets=[Lf];return}let t=document.createElement(`style`);t.textContent=of,e.appendChild(t)}var zf=class extends l{static get observedAttributes(){return[`open`]}constructor(){super(),this.seenStore=null,this.onBeforeStep=null,this._run=0,this._running=!1,this._layer=null,this._outer=null,this._shadow=null,this._unbindAdvance=null,this._ending=null,this._seenMark=null}connectedCallback(){this.hasAttribute(`open`)&&this.start()}disconnectedCallback(){this.stop()}attributeChangedCallback(e,t,n){e!==`open`||!this.isConnected||(n===null?this.stop():this.start())}get tourId(){return this.getAttribute(`tour-id`)||``}set tourId(e){e==null||e===``?this.removeAttribute(`tour-id`):this.setAttribute(`tour-id`,String(e))}get isolated(){return this.hasAttribute(`isolated`)}set isolated(e){this.toggleAttribute(`isolated`,e===!0||e===``||e===`true`)}_stepList(){return Array.from(this.querySelectorAll(`:scope > ${wf}`),e=>{let t={target:e.getAttribute(`target`)||``,title:e.getAttribute(`title`)||void 0,description:e.textContent.trim()};for(let[n,r]of Af)e.hasAttribute(r)&&(t[n]=e.getAttribute(r));return t})}_store(){return this.seenStore?this.seenStore:this.getAttribute(`seen-store`)===`local`?Nf():globalThis.window?.WUI?.tour?.seenStore||null}_label(e){return this.getAttribute(kf[e])||Of[e]}_endDialogText(){return this.getAttribute(`end-dialog`)===`false`?null:{title:this._label(`endTitle`),message:this._label(`endMessage`),button:this._label(`endButton`)}}_markSeen(e){let t=this._store();return t?t.markSeen(this.tourId,e):null}async start(){if(this._running)return;this._running=!0;let e=++this._run;this.hasAttribute(`open`)||this.setAttribute(`open`,``);try{await this._start(e)}catch(t){throw e===this._run&&(this._running=!1),t}}async _start(e){this._steps=this._stepList(),this._progress=xf(this._steps.length);let t=this._store();if(t&&!this.tourId)throw Error(`<wui-tour> needs a tour-id to use a seen store.`);if(t&&await t.isSeen(this.tourId)){e===this._run&&this._finish(`alreadySeen`);return}for(let[e,t]of this._steps.entries())t.target&&!Pf(document.querySelector(t.target))&&this._progress.drop(e);this._returnFocus=document.activeElement;let n=await this._locate(0,1,e);if(e===this._run){if(!n){this._finish(`noTargets`);return}this._firstIndex=n.index,this.dispatchEvent(new CustomEvent(`wui-tour:start`,{bubbles:!0,detail:{total:this._progress.total()}})),e===this._run&&(this._build(),this._show(n))}}next(){return this._move(1)}back(){return!this._current||this._current.index<=this._firstIndex?Promise.resolve():this._move(-1)}async goTo(e){if(this._current){if(!Number.isInteger(e)||e<0||e>=this._steps.length)throw RangeError(`<wui-tour> has no step ${e}; it has ${this._steps.length}.`);await this._go(e,1)}}stop(){this._running&&(this._run++,this._teardown(),this._running=!1,this.hasAttribute(`open`)&&this.removeAttribute(`open`))}async _locate(e,t,n){let r=this._steps;for(let i=e;i>=0&&i<r.length;i+=t){let e=r[i];if(await this._beforeStep(e,i),n!==this._run)return null;if(!e.target)return{index:i,target:null};let t=document.querySelector(e.target);if(Pf(t))return this._progress.position(i),{index:i,target:t};this._progress.drop(i)}return null}async _beforeStep(e,t){let n=[];this.dispatchEvent(new CustomEvent(`wui-tour:beforestep`,{bubbles:!0,detail:{step:e,index:t,wait:e=>n.push(e)}})),await Promise.all(n),typeof this.onBeforeStep==`function`&&await this.onBeforeStep(e,t)}_build(){let e=`wui-tour-${++Mf}`,t=document.createElement(`div`);t.className=`wui-tour-layer`,t.innerHTML=`
919
+ `,lf=`wui-tour-media`,uf=`wui-tour-media-toggle`,df=`http://www.w3.org/2000/svg`,ff=`M6 5h4v14H6zM14 5h4v14h-4z`,pf=`M8 5v14l11-7z`,mf={pause:`Pause animation`,play:`Play animation`},hf=()=>globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`)?.matches===!0;function gf(e){let t=document.createElementNS(df,`svg`);t.setAttribute(`viewBox`,`0 0 24 24`),t.setAttribute(`aria-hidden`,`true`),t.setAttribute(`focusable`,`false`);let n=document.createElementNS(df,`path`);return n.setAttribute(`d`,e),t.appendChild(n),t}function _f(e){let t=document.createElement(`img`);return t.setAttribute(`alt`,e.mediaAlt??``),t.setAttribute(`width`,`1280`),t.setAttribute(`height`,`720`),t.setAttribute(`loading`,`lazy`),t.setAttribute(`decoding`,`async`),t.setAttribute(`src`,e.media),t}function vf(e,t){let n=document.createElement(`video`);return n.muted=!0,n.setAttribute(`muted`,``),n.loop=!0,n.setAttribute(`playsinline`,``),t&&n.setAttribute(`autoplay`,``),n.setAttribute(`preload`,t?`auto`:`metadata`),e.mediaAlt&&n.setAttribute(`aria-label`,e.mediaAlt),e.mediaPoster&&n.setAttribute(`poster`,e.mediaPoster),n.setAttribute(`src`,e.media),n}function yf(e,t){let n=document.createElement(`button`);n.type=`button`,n.className=uf;let r=(r=!e.paused)=>{n.setAttribute(`aria-label`,r?t.pause:t.play),n.replaceChildren(gf(r?ff:pf))};return e.addEventListener(`play`,()=>r()),e.addEventListener(`pause`,()=>r()),n.addEventListener(`click`,()=>{e.paused?e.play()?.catch(()=>r()):e.pause()}),r(e.hasAttribute(`autoplay`)),n}function bf(e){let t=e.querySelector(`:scope > .${lf}`);if(!t)return;let n=t.querySelector(`video`);n&&(n.pause(),n.removeAttribute(`src`),n.load()),t.remove()}function xf(e,t,n=mf){if(bf(e),!t.media){e.removeAttribute(`data-media`);return}let r=document.createElement(`div`);if(r.className=lf,t.mediaType===`video`){let e=vf(t,!hf());r.append(e,yf(e,n))}else r.appendChild(_f(t));e.prepend(r),e.setAttribute(`data-media`,t.target?`step`:`welcome`)}var Sf=`Step {current} of {total}`;function Cf(e){let t=new Set;return{drop:e=>{t.add(e)},position:e=>{t.delete(e);let n=0;for(let r of t)r<e&&n++;return e+1-n},total:()=>e-t.size}}function wf(e,t,n){return(e.getAttribute(`progress-label`)||Sf).replace(/\{(current|total)\}/g,(e,r)=>String(r===`current`?t:n))}function Tf(e,{text:t,position:n,total:r}){let i=e.querySelector(`.wui-tour-position`);i.textContent=t;let a=e.querySelector(`.wui-tour-progress-bar`);if(!a){let t=e.ownerDocument,n=t.createElement(`div`);n.className=`wui-tour-progress`,n.setAttribute(`aria-hidden`,`true`),a=t.createElement(`div`),a.className=`wui-tour-progress-bar`,n.append(a),i.before(n)}let o=a.children;for(;o.length<r;){let t=e.ownerDocument.createElement(`span`);t.className=`wui-tour-progress-segment`,a.append(t)}for(;o.length>r;)a.lastElementChild.remove();for(let e=0;e<o.length;e++)o[e].toggleAttribute(`data-filled`,e<n)}var Ef=`wui-tour-step`,Df=`wui-tour-host`,Of=`wui-tour-seen:`,kf=`data-tracking`,Af={back:`Back`,next:`Next`,skip:`Skip`,done:`Done`,mediaPause:`Pause animation`,mediaPlay:`Play animation`,endTitle:`You're all set`,endMessage:`You know your way around now. Enjoy exploring.`,endButton:`Done`},jf={back:`back-label`,next:`next-label`,skip:`skip-label`,done:`done-label`,mediaPause:`media-pause-label`,mediaPlay:`media-play-label`,endTitle:`end-title`,endMessage:`end-message`,endButton:`end-button`},Mf=[[`media`,`media`],[`mediaAlt`,`media-alt`],[`mediaPoster`,`media-poster`],[`mediaType`,`media-type`],[`advanceOn`,`advance-on`],[`actionLabel`,`action-label`]],Nf={index:null,position:null,total:null},Pf=0;function Ff(e=Of,t=globalThis.localStorage){return{isSeen:async n=>t.getItem(e+n)===`1`,markSeen:async n=>{t.setItem(e+n,`1`)}}}var If=e=>!e?.isConnected||getComputedStyle(e).visibility===`hidden`?!1:e.getClientRects().length>0,Lf=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName)),Rf=()=>{let e=document.activeElement;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e},zf=null;function Bf(e){if(`adoptedStyleSheets`in e&&typeof CSSStyleSheet==`function`&&`replaceSync`in CSSStyleSheet.prototype){zf||(zf=new CSSStyleSheet,zf.replaceSync(cf)),e.adoptedStyleSheets=[zf];return}let t=document.createElement(`style`);t.textContent=cf,e.appendChild(t)}var Vf=class extends l{static get observedAttributes(){return[`open`]}constructor(){super(),this.seenStore=null,this.onBeforeStep=null,this._run=0,this._running=!1,this._layer=null,this._outer=null,this._shadow=null,this._unbindAdvance=null,this._ending=null,this._seenMark=null}connectedCallback(){this.hasAttribute(`open`)&&this.start()}disconnectedCallback(){this.stop()}attributeChangedCallback(e,t,n){e!==`open`||!this.isConnected||(n===null?this.stop():this.start())}get tourId(){return this.getAttribute(`tour-id`)||``}set tourId(e){e==null||e===``?this.removeAttribute(`tour-id`):this.setAttribute(`tour-id`,String(e))}get isolated(){return this.hasAttribute(`isolated`)}set isolated(e){this.toggleAttribute(`isolated`,e===!0||e===``||e===`true`)}_stepList(){return Array.from(this.querySelectorAll(`:scope > ${Ef}`),e=>{let t={target:e.getAttribute(`target`)||``,title:e.getAttribute(`title`)||void 0,description:e.textContent.trim()};for(let[n,r]of Mf)e.hasAttribute(r)&&(t[n]=e.getAttribute(r));return t})}_store(){return this.seenStore?this.seenStore:this.getAttribute(`seen-store`)===`local`?Ff():globalThis.window?.WUI?.tour?.seenStore||null}_label(e){return this.getAttribute(jf[e])||Af[e]}_endDialogText(){return this.getAttribute(`end-dialog`)===`false`?null:{title:this._label(`endTitle`),message:this._label(`endMessage`),button:this._label(`endButton`)}}_markSeen(e){let t=this._store();return t?t.markSeen(this.tourId,e):null}async start(){if(this._running)return;this._running=!0;let e=++this._run;this.hasAttribute(`open`)||this.setAttribute(`open`,``);try{await this._start(e)}catch(t){throw e===this._run&&(this._running=!1),t}}async _start(e){this._steps=this._stepList(),this._progress=Cf(this._steps.length);let t=this._store();if(t&&!this.tourId)throw Error(`<wui-tour> needs a tour-id to use a seen store.`);if(t&&await t.isSeen(this.tourId)){e===this._run&&this._finish(`alreadySeen`);return}for(let[e,t]of this._steps.entries())t.target&&!If(document.querySelector(t.target))&&this._progress.drop(e);this._returnFocus=document.activeElement;let n=await this._locate(0,1,e);if(e===this._run){if(!n){this._finish(`noTargets`);return}this._firstIndex=n.index,this.dispatchEvent(new CustomEvent(`wui-tour:start`,{bubbles:!0,detail:{total:this._progress.total()}})),e===this._run&&(this._build(),this._show(n))}}next(){return this._move(1)}back(){return!this._current||this._current.index<=this._firstIndex?Promise.resolve():this._move(-1)}async goTo(e){if(this._current){if(!Number.isInteger(e)||e<0||e>=this._steps.length)throw RangeError(`<wui-tour> has no step ${e}; it has ${this._steps.length}.`);await this._go(e,1)}}stop(){this._running&&(this._run++,this._teardown(),this._running=!1,this.hasAttribute(`open`)&&this.removeAttribute(`open`))}async _locate(e,t,n){let r=this._steps;for(let i=e;i>=0&&i<r.length;i+=t){let e=r[i];if(await this._beforeStep(e,i),n!==this._run)return null;if(!e.target)return{index:i,target:null};let t=document.querySelector(e.target);if(If(t))return this._progress.position(i),{index:i,target:t};this._progress.drop(i)}return null}async _beforeStep(e,t){let n=[];this.dispatchEvent(new CustomEvent(`wui-tour:beforestep`,{bubbles:!0,detail:{step:e,index:t,wait:e=>n.push(e)}})),await Promise.all(n),typeof this.onBeforeStep==`function`&&await this.onBeforeStep(e,t)}_build(){let e=`wui-tour-${++Pf}`,t=document.createElement(`div`);t.className=`wui-tour-layer`,t.innerHTML=`
920
920
  <div class="wui-tour-spot" aria-hidden="true"></div>
921
921
  <div class="wui-tour-card" role="dialog" aria-modal="true" tabindex="-1" aria-labelledby="${e}-title" aria-describedby="${e}-text">
922
922
  <p class="wui-tour-position"></p>
@@ -930,4 +930,4 @@ ${Object.entries({"--wui-z-tour":`1550`,"--wui-radius-sm":`8px`,"--wui-radius-lg
930
930
  </div>
931
931
  </div>
932
932
  </div>
933
- <div class="visually-hidden" role="status" aria-live="polite"></div>`;let n=t;this._shadow=null,this.isolated&&(n=document.createElement(Tf),this._shadow=n.attachShadow({mode:`open`}),Rf(this._shadow),this._shadow.appendChild(t)),document.body.appendChild(n),document.documentElement.setAttribute(ha,``),this._outer=n,this._layer=t,this._spot=t.querySelector(`.wui-tour-spot`),this._card=t.querySelector(`.wui-tour-card`),this._live=t.querySelector(`[role=status]`),this._card.querySelector(`.wui-tour-skip`).addEventListener(`click`,()=>this._close(`skipped`,`button`)),this._card.querySelector(`.wui-tour-back`).addEventListener(`click`,()=>this._move(-1)),this._card.querySelector(`.wui-tour-next`).addEventListener(`click`,()=>this._move(1)),this._shadow&&this._card.removeAttribute(`aria-modal`),this._onKey=e=>this._key(e),this._onFocusIn=e=>{if(!this._layer||this._ending)return;let t=this._current,n=t?this._steps[t.index]:null;Cd(this._layer,n,t?.target??null,e.target)||this._card.focus()},document.addEventListener(`keydown`,this._onKey,!0),this._shadow||document.addEventListener(`focusin`,this._onFocusIn),s(n,()=>this._follow())}_active(){return this._shadow?this._shadow.activeElement:document.activeElement}_show(e){this._current=e;let{index:t,target:n}=e,r=this._steps[t],i=this._card,a=this._progress.position(t),o=this._progress.total(),s=a===o&&!this._endDialogText(),c=Sf(this,a,o);Cf(i,{text:c,position:a,total:o}),yf(i,r,{pause:this._label(`mediaPause`),play:this._label(`mediaPlay`)});let l=xd(this,{layer:this._layer,spot:this._spot,card:i},r,n),u=i.querySelector(`.wui-tour-title`);u.textContent=r.title||``,u.hidden=!r.title,i.querySelector(`.wui-tour-text`).textContent=r.description||``,i.querySelector(`.wui-tour-skip`).textContent=this._label(`skip`),i.querySelector(`.wui-tour-back`).textContent=this._label(`back`),i.querySelector(`.wui-tour-back`).hidden=t<=this._firstIndex,i.querySelector(`.wui-tour-next`).textContent=this._label(s?`done`:`next`);let d=[c,r.title,r.description].filter(Boolean).join(`. `);this._live.textContent=l?[d,l].join(/[.!?]$/.test(d)?` `:`. `):d,Jd(i,n),this._spot.removeAttribute(Df),this._place(),Fd(i),this._unbindAdvance?.(),this._unbindAdvance=Sd(r,n,()=>this._move(1));let f=this._active();(i.contains(f)?!f.hidden:this._shadow!==null&&Ff(If()))||i.focus(),this.dispatchEvent(new CustomEvent(`wui-tour:step`,{bubbles:!0,detail:{step:r,index:t,position:a,total:o}}))}_place(){!this._current||!this._layer||Yd(this._spot,this._card,this._current.target)}_follow(){if(!this._current||!this._layer||this._ending)return;let e=this._spot.style.cssText;this._place(),this._spot.style.cssText!==e&&this._spot.setAttribute(Df,``)}async _move(e){this._current&&await this._go(this._current.index+e,e)}async _go(e,t){if(!this._current||this._moving)return;this._moving=!0;let n=this._run;try{let r=await this._locate(e,t,n);if(n!==this._run)return;if(r){let e=Id(this._card);if(e&&await e,n!==this._run)return;this._show(r)}else if(t>0){let e=this._endDialogText();if(e&&await this._showEnd(e),n!==this._run)return;await this._close(`finished`)}}finally{this._moving=!1}}_showEnd(e){return this._unbindAdvance?.(),this._unbindAdvance=null,xd(this,{layer:this._layer,spot:this._spot,card:this._card},null,null),this._spot.removeAttribute(Df),this._ending=new AbortController,this._seenMark=this._markSeen(`finished`),af(this._layer,e,this._ending.signal)}_key(e){if(!(!this._layer||this._ending||e.altKey||e.ctrlKey||e.metaKey)){if(e.key===`Escape`)e.preventDefault(),e.stopPropagation(),this._close(`skipped`,`escape`);else if(e.key===`ArrowRight`||e.key===`ArrowLeft`){if(Ff(e.composedPath?.()[0]??e.target))return;e.preventDefault(),e.key===`ArrowRight`?this._move(1):this._current.index>this._firstIndex&&this._move(-1)}else if(e.key===`Tab`&&!this._shadow){let{index:t,target:n}=this._current;wd(e,{card:this._card,active:this._active(),step:this._steps[t],target:n})}}}_teardown(){if(!this._layer)return;document.removeEventListener(`keydown`,this._onKey,!0),document.removeEventListener(`focusin`,this._onFocusIn);let e=!this._shadow||this._shadow.activeElement!==null||!document.activeElement||document.activeElement===document.body;this._unbindAdvance?.(),this._unbindAdvance=null,this._ending?.abort(),this._ending=null,this._seenMark=null,c(this._outer),Ld(this._outer),document.documentElement.removeAttribute(ha),this._outer=null,this._shadow=null,this._layer=null,this._current=null;let t=this._returnFocus;this._returnFocus=null,e&&t?.isConnected&&t.focus?.()}async _close(e,t=null){let n=this._run,r=this._current,i=r?{index:r.index,position:this._progress.position(r.index),total:this._progress.total()}:jf,a=this._seenMark;this._teardown();try{n===this._run&&await(a??this._markSeen(e))}finally{this._finish(e,i,t)}}_finish(e,t=jf,n=null){this._run++,this._running=!1,this.hasAttribute(`open`)&&this.removeAttribute(`open`),this.dispatchEvent(new CustomEvent(`wui-tour:close`,{bubbles:!0,detail:{reason:e,...t,via:n}}))}},Bf=[`none`,`single`,`multiple`],Vf=`parentId`,Hf=`Loading`,Uf=`Could not load. Try again.`,Wf=`:scope > input[data-wui-mirror]`,Gf=[`nodes`,`selection`,`selected`,`values`,`loadChildren`,`loadUrl`,`name`],Kf=0;function $(e,t,n){let r=document.createElement(e);t&&(r.className=t);for(let[e,t]of Object.entries(n??{}))t!=null&&r.setAttribute(e,String(t));return r}var qf=class extends l{static get observedAttributes(){return[`selection`,`selected`,`name`,`aria-label`,`loading-text`,`error-text`]}constructor(){super(),this._uid=`wui-tree-${++Kf}`,this._seq=0,this._roots=[],this._byId=new Map,this._prev=null,this._staged=null,this._els=new Map,this._checked=new Set,this._selected=null,this._focusId=null,this._loader=null,this._list=null,this._live=null,this._ready=!1,this._nav=ui({getVisibleOptions:()=>this._visible().map(e=>this._els.get(e.id)?.row),getActive:()=>this._visible().findIndex(e=>e.id===this._focusId),setActive:e=>this._focusNode(this._visible()[e]),onEnter:()=>{let e=this._byId.get(this._focusId);e&&this._activate(e)}}),this._onKeyDown=e=>this._handleKeyDown(e),this._onClick=e=>this._handleClick(e),this._onFocusIn=e=>{let t=this._nodeFrom(e.target);t&&t.id!==this._focusId&&this._setRoving(t)}}connectedCallback(){let e={};for(let t of Gf)Object.hasOwn(this,t)&&(e[t]=this[t],delete this[t]);if(!this._ready){this._ready=!0;let e=this._readScript();this.replaceChildren(),this._list=$(`ul`,`wui-tree`),this._list.setAttribute(`role`,`tree`),this._live=$(`div`,`visually-hidden`,{role:`status`,"aria-live":`polite`}),this.append(this._list,this._live),e&&this._adoptAll(e)}for(let[t,n]of Object.entries(e))this[t]=n;this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`click`,this._onClick),this.addEventListener(`focusin`,this._onFocusIn),this._render(),this._loadOpenNodes()}disconnectedCallback(){this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`focusin`,this._onFocusIn),this._nav.teardown()}attributeChangedCallback(e,t,n){e===`selected`&&(this._selected=n),this._ready&&this.isConnected&&this._render()}get nodes(){return this._roots.map(e=>e.raw)}set nodes(e){this._adoptAll(e??[]),this._render(),this._loadOpenNodes()}get selection(){let e=this.getAttribute(`selection`);return Bf.includes(e)?e:`none`}set selection(e){this.setAttribute(`selection`,String(e))}get selected(){return this._selected}set selected(e){this._selected=e==null?null:String(e),this._render()}get values(){let e=[],t=n=>{for(let r of n)this._state(r)===`checked`&&e.push(r.id),r.children&&t(r.children)};return t(this._roots),[...e,...[...this._checked].filter(e=>!this._byId.has(e))]}set values(e){this._checked.clear();for(let t of e??[]){let e=this._byId.get(String(t));e?this._setChecked(e,!0):this._checked.add(String(t))}this._render()}get loadChildren(){return this._loader}set loadChildren(e){this._loader=typeof e==`function`?e:null}get loadUrl(){return this.getAttribute(`load-url`)}set loadUrl(e){e==null?this.removeAttribute(`load-url`):this.setAttribute(`load-url`,String(e))}get name(){return this.getAttribute(`name`)}set name(e){e==null?this.removeAttribute(`name`):this.setAttribute(`name`,String(e))}get loadingText(){return this.getAttribute(`loading-text`)??Hf}set loadingText(e){this.setAttribute(`loading-text`,String(e??``))}get errorText(){return this.getAttribute(`error-text`)??Uf}set errorText(e){this.setAttribute(`error-text`,String(e??``))}_readScript(){let e=this.querySelector(`:scope > script[type='application/json']`);if(!e)return null;try{return JSON.parse(e.textContent)}catch(e){return console.error(`[@webority/ui-elements] <wui-tree> could not read its JSON nodes:`,e?.message),null}}_adoptAll(e){let t=this._byId;this._prev=t,this._byId=new Map;let n;try{n=this._adoptStaged(e,null,1)}catch(e){throw this._byId=t,e}finally{this._prev=null}this._roots=n;for(let e of t.keys())this._byId.has(e)||this._checked.delete(e);for(let e of this._roots)this._passChecksDown(e);this._focusId&&!this._byId.has(this._focusId)&&(this._focusId=null)}_adoptStaged(e,t,n){let r=[],i=[];this._staged={ids:r,checks:i};try{let r=this._adopt(e,t,n);for(let e of i)this._checked.add(e);return r}catch(e){for(let e of r)this._byId.delete(e);throw e}finally{this._staged=null}}_adopt(e,t,n){if(!Array.isArray(e))throw Error(`<wui-tree> nodes must be an array.`);return e.map(e=>{let r=e?.id==null?``:String(e.id);if(!r)throw Error(`<wui-tree> every node needs an id.`);if(this._byId.has(r))throw Error(`<wui-tree> node id "${r}" is used twice.`);let i=this._prev?.get(r),a={id:r,raw:e,parent:t,level:n,seq:++this._seq,label:e.label==null?r:String(e.label),icon:e.icon||null,badge:e.badge==null||e.badge===``?null:String(e.badge),badgeTone:e.badgeTone||null,disabled:!!e.disabled,hasChildren:!!e.hasChildren,children:null,expanded:i?i.expanded:!!e.expanded,loading:!1,failed:!1};this._byId.set(r,a),this._staged.ids.push(r);let o=e.children??(e.hasChildren?i?.children?.map(e=>e.raw):void 0);return Array.isArray(o)&&(a.children=this._adopt(o,a,n+1)),a.loading=!!i?.loading&&a.children===null&&a.hasChildren,e.checked&&!i&&this._staged.checks.push(r),a})}_passChecksDown(e){e.children?.length&&this._checked.has(e.id)&&(this._checked.delete(e.id),this._setChecked(e,!0));for(let t of e.children??[])this._passChecksDown(t)}_loadOpenNodes(){queueMicrotask(()=>{if(this.isConnected)for(let e of[...this._byId.values()])e.expanded&&e.children===null&&e.hasChildren&&!e.loading&&this._load(e)})}_isBranch(e){return e.children?e.children.length>0:e.hasChildren}_visible(){let e=[],t=n=>{for(let r of n)e.push(r),r.expanded&&r.children&&t(r.children)};return t(this._roots),e}_state(e){if(e.children?.length){let t=0,n=0;for(let r of e.children){let e=this._state(r);e===`checked`?t++:e===`unchecked`&&n++}return t===e.children.length?`checked`:n===e.children.length?`unchecked`:`mixed`}return this._checked.has(e.id)?`checked`:`unchecked`}_setChecked(e,t){if(e.children?.length)for(let n of e.children)n.disabled||this._setChecked(n,t);else t?this._checked.add(e.id):this._checked.delete(e.id)}_nodeFrom(e){let t=e?.closest?.(`li.wui-tree-item`);if(!t)return null;for(let[e,n]of this._els)if(n.li===t)return this._byId.get(e)??null;return null}_emit(e,t){this.dispatchEvent(new CustomEvent(`wui-tree:${e}`,{detail:t,bubbles:!0,composed:!0}))}_announce(e){this._live&&(this._live.textContent=e)}_setRoving(e){let t=this._els.get(this._focusId);t&&(t.li.tabIndex=-1),this._focusId=e.id;let n=this._els.get(e.id);n&&(n.li.tabIndex=0)}_focusNode(e){e&&(this._setRoving(e),this._els.get(e.id)?.li.focus())}_activate(e){e.disabled||(this.selection===`single`&&(this._selected=e.id,this._render(),this._syncForm()),this._emit(`select`,{id:e.id,node:e.raw}))}_enabledLeaves(e){return e.disabled?[]:e.children?.length?e.children.flatMap(e=>this._enabledLeaves(e)):[e]}_toggleCheck(e){let t=this._enabledLeaves(e);if(!t.length)return;let n=!t.every(e=>this._checked.has(e.id));this._setChecked(e,n),this._render(),this._syncForm(),this._emit(`check`,{id:e.id,checked:n,values:this.values})}_toggleExpand(e){e.disabled||!this._isBranch(e)||(e.expanded?(e.expanded=!1,this._render()):this._expand(e))}_expand(e){e.expanded=!0,e.children===null?this._load(e):this._render()}async _load(e){if(e.loading)return;e.loading=!0,e.failed=!1,this._announce(this.loadingText),this._render();let t,n=null;try{t=await this._fetchChildren(e)}catch(e){n=e}let r=this._byId.get(e.id);if(!r){this._announce(``);return}if(r.loading){if(r.loading=!1,!n)try{r.children=this._adoptStaged(t,r,r.level+1),this._passChecksDown(r),this._announce(``)}catch(e){n=e}n&&(r.failed=!0,r.expanded=!1,this._announce(this.errorText),this._emit(`error`,{id:r.id,message:n?.message??String(n)})),this._render(),this._syncForm()}}async _fetchChildren(e){if(this._loader)return this._loader(e.raw);let t=this.getAttribute(`load-url`);if(!t)throw Error(`<wui-tree> has a node with children to load but no loadChildren or load-url.`);let n=new URL(t,window.location.href);n.searchParams.set(Vf,e.id);let r=await P(n.href,{headers:{Accept:`application/json`}});if(!r.ok)throw Error(`Loading children answered ${r.kind}.`);return JSON.parse(r.html)}_handleClick(e){let t=this._nodeFrom(e.target);!t||t.disabled||(this._focusNode(t),e.target.closest(`.wui-tree-toggle`)?this._toggleExpand(t):e.target.closest(`.wui-tree-check`)?(e.preventDefault(),this._toggleCheck(t)):this._activate(t))}_handleKeyDown(e){if(e.ctrlKey||e.metaKey||e.altKey)return;let t=this._nodeFrom(e.target);if(!(!t||e.target!==this._els.get(t.id)?.li))if(e.key===`ArrowRight`){if(e.preventDefault(),!this._isBranch(t)||t.disabled)return;t.expanded?t.children?.length&&this._focusNode(t.children[0]):this._expand(t)}else e.key===`ArrowLeft`?(e.preventDefault(),t.expanded&&this._isBranch(t)&&!t.disabled?this._toggleExpand(t):t.parent&&this._focusNode(t.parent)):e.key===` `?(e.preventDefault(),this.selection===`multiple`?this._toggleCheck(t):this.selection===`single`&&this._activate(t)):this._nav.handler(e)}_syncForm(){let e=this.selection;if(e===`multiple`)B(this,this.values);else if(e===`single`)z(this,this._selected??``);else for(let e of this.querySelectorAll(Wf))e.remove()}_render(){if(!this._list)return;let e=document.activeElement,t=!!e&&this._list.contains(e),n=this._visible();n.some(e=>e.id===this._focusId)||(this._focusId=(n.find(e=>e.id===this._selected)??n[0])?.id??null),this._els=new Map;let r=this.getAttribute(`aria-label`);r?this._list.setAttribute(`aria-label`,r):this._list.removeAttribute(`aria-label`),this._list.replaceChildren(...this._buildLevel(this._roots)),t&&this._focusId&&this._els.get(this._focusId)?.li.focus(),this._syncForm()}_buildLevel(e){return e.map((t,n)=>this._buildItem(t,n+1,e.length))}_buildItem(e,t,n){let r=this.selection,i=this._isBranch(e),a=this._state(e),o=$(`li`,`wui-tree-item`,{role:`treeitem`,tabindex:e.id===this._focusId?0:-1,"aria-level":e.level,"aria-setsize":n,"aria-posinset":t,"aria-labelledby":`${this._uid}-${e.seq}`,"aria-describedby":e.badge?`${this._uid}-${e.seq}-badge`:null});i&&o.setAttribute(`aria-expanded`,String(e.expanded)),e.disabled&&o.setAttribute(`aria-disabled`,`true`),e.loading&&o.setAttribute(`aria-busy`,`true`),r===`single`&&o.setAttribute(`aria-selected`,String(e.id===this._selected)),r===`multiple`&&o.setAttribute(`aria-checked`,a===`mixed`?`mixed`:String(a===`checked`));let s=$(`div`,`wui-tree-row`,{role:`presentation`});s.style.setProperty(`--wui-tree-level`,String(e.level-1)),r===`single`&&e.id===this._selected&&s.classList.add(`wui-tree-row-selected`),e.failed&&s.classList.add(`wui-tree-row-error`);let c=$(`span`,i?`wui-tree-toggle`:`wui-tree-toggle wui-tree-toggle-leaf`,{"aria-hidden":`true`});if(i&&(c.innerHTML=j(`chevron-right`,{size:16})),s.append(c),r===`multiple`){let t=$(`input`,`form-check-input wui-tree-check`,{type:`checkbox`,tabindex:-1,"aria-hidden":`true`});t.checked=a===`checked`,t.indeterminate=a===`mixed`,t.disabled=e.disabled,t.addEventListener(`mousedown`,e=>e.preventDefault()),s.append(t)}if(e.icon){let t=$(`span`,`wui-tree-icon`,{"aria-hidden":`true`});t.innerHTML=j(e.icon,{size:16}),s.append(t)}let l=$(`span`,`wui-tree-label`,{id:`${this._uid}-${e.seq}`});if(l.textContent=e.label,s.append(l),e.badge){let t=$(`span`,`badge wui-tree-badge${e.badgeTone&&e.badgeTone!==`neutral`?` badge-${e.badgeTone}`:``}`,{id:`${this._uid}-${e.seq}-badge`});t.textContent=e.badge,s.append(t)}if(e.loading&&s.append($(`span`,`wui-tree-spinner`,{"aria-hidden":`true`})),o.append(s),e.expanded&&e.children?.length){let t=$(`ul`,`wui-tree-group`,{role:`group`});t.append(...this._buildLevel(e.children)),o.append(t)}return this._els.set(e.id,{li:o,row:s}),o}},Jf=class extends l{constructor(){super(),this._measure=()=>this.measure(),this._resize=null,this._mutation=null,this._ownTabindex=!1}connectedCallback(){this.measure(),this.addEventListener(`mouseover`,this._measure),typeof ResizeObserver<`u`&&(this._resize=new ResizeObserver(this._measure),this._resize.observe(this)),this._mutation=new MutationObserver(this._measure),this._mutation.observe(this,{childList:!0,subtree:!0,characterData:!0})}disconnectedCallback(){this.removeEventListener(`mouseover`,this._measure),this._resize?.disconnect(),this._mutation?.disconnect(),this._resize=null,this._mutation=null}measure(){let e=this.querySelector(`.wui-truncate-text`);if(e){if(e.scrollWidth>e.clientWidth||e.scrollHeight>e.clientHeight){this.setAttribute(`data-wui-tip`,e.textContent.replace(/\s+/g,` `).trim()),this.hasAttribute(`tabindex`)||(this.setAttribute(`tabindex`,`0`),this._ownTabindex=!0);return}this.removeAttribute(`data-wui-tip`),this._ownTabindex&&=(this.removeAttribute(`tabindex`),!1)}}},Yf=`wui-whats-new-read`,Xf=`wui-whats-new:`,Zf=`data-open`,Qf=`data-wui-unread`,$f=0,ep=class extends l{static get observedAttributes(){return[`storage-key`]}constructor(){super(),this._doc=null,this._seen=``,this._observer=null,this._onTriggerClick=()=>this.isOpen?this.close(!0):this.open(),this._onKeyDown=e=>{e.key===`Escape`&&this.isOpen&&(e.stopPropagation(),this.close(!0))},this._onPointerDown=e=>{this.isOpen&&!this.contains(e.target)&&this.close(!1)}}get isOpen(){return this.hasAttribute(Zf)}get _trigger(){return this.querySelector(`.wui-whats-new-trigger`)}get _panel(){return this.querySelector(`.wui-whats-new-panel`)}connectedCallback(){this._doc=this.ownerDocument;let e=this._panel,t=this._trigger;!e||!t||(e.id||=`wui-whats-new-${++$f}`,t.setAttribute(`aria-controls`,e.id),t.setAttribute(`aria-expanded`,`false`),t.addEventListener(`click`,this._onTriggerClick),this.addEventListener(`keydown`,this._onKeyDown),this._seen=this._load(),this._refresh(),typeof MutationObserver<`u`&&(this._observer=new MutationObserver(()=>this._refresh()),this._observer.observe(e,{childList:!0,subtree:!0})))}disconnectedCallback(){this._observer?.disconnect(),this._observer=null,this._trigger?.removeEventListener(`click`,this._onTriggerClick),this.removeEventListener(`keydown`,this._onKeyDown),this._doc?.removeEventListener(`pointerdown`,this._onPointerDown,!0),c(this),this.removeAttribute(Zf),this._doc=null}attributeChangedCallback(e,t,n){t===n||!this._doc||(this._seen=this._load(),this._refresh())}open(){let e=this._panel;!e||this.isOpen||(this.setAttribute(Zf,``),this._trigger?.setAttribute(`aria-expanded`,`true`),this._place(),s(this,()=>this._place()),this._doc.addEventListener(`pointerdown`,this._onPointerDown,!0),e.focus({preventScroll:!0}),this._markRead())}close(e){this.isOpen&&(this.removeAttribute(Zf),this._trigger?.setAttribute(`aria-expanded`,`false`),this._doc.removeEventListener(`pointerdown`,this._onPointerDown,!0),c(this),this._refresh(),e&&this._trigger?.focus())}_place(){o(this._trigger,this._panel,{clampHeight:!0})}_entries(){return[...this.querySelectorAll(`.wui-whats-new-entry`)].map(e=>({entry:e,date:e.querySelector(`time[datetime]`)?.getAttribute(`datetime`)??``}))}_newest(){return this._entries().reduce((e,{date:t})=>t>e?t:e,``)}_refresh(){let e=this._entries(),t=0;for(let{entry:n,date:r}of e){let e=r>this._seen;e&&t++,!(this.isOpen&&n.hasAttribute(Qf))&&n.toggleAttribute(Qf,e)}this.toggleAttribute(Qf,t>0)}_markRead(){let e=this._newest();!e||e<=this._seen||(this._seen=e,this._save(e),this.toggleAttribute(Qf,!1),this.dispatchEvent(new CustomEvent(Yf,{bubbles:!0,detail:{through:e}})))}_storage(){let e=this.getAttribute(`storage-key`);if(!e)return null;try{return{store:this.ownerDocument.defaultView.localStorage,key:Xf+e}}catch{return null}}_load(){let e=this._storage();return e?e.store.getItem(e.key)??``:this._seen}_save(e){let t=this._storage();t&&t.store.setItem(t.key,e)}},tp=`wui-wizard-step`,np=`:scope > [data-wui-glyphs]`,rp=class extends l{static get observedAttributes(){return[`active`,`variant`,`orientation`,`icon-size`,`non-linear`,`hide-stepper`,`hide-connectors`,`disabled`,`skippable`,`label`,`back-label`,`next-label`,`skip-label`,`finish-label`]}constructor(){super(),this._active=0,this._skipped=new Set,this._invalid=new Set,this._finished=!1,this._rendered=!1,this._reflecting=!1,this._beforeNext=null,this._header=null,this._footer=null,this._known=[],this._observer=null,this._glyphs=null,this._glyphObserver=null}get active(){return this._active}set active(e){let t=Number.parseInt(e,10);Number.isFinite(t)&&this._go(t,`set`)}get beforeNext(){return this._beforeNext}set beforeNext(e){this._beforeNext=typeof e==`function`?e:null}get _steps(){return[...this.querySelectorAll(`:scope > ${tp}`)]}refresh(){this._rendered&&this._renderChrome()}connectedCallback(){if(this._rendered)this._wire(),this._onStepsMutated();else{let e=Number.parseInt(this.getAttribute(`active`),10);this._active=Number.isFinite(e)&&e>=0?e:0,this.render()}}disconnectedCallback(){this._teardown()}attributeChangedCallback(e,t,n){if(!(!this._rendered||this._reflecting)){if(e===`active`){let e=Number.parseInt(n,10);Number.isFinite(e)&&this._go(e,`set`);return}this._renderChrome()}}render(){let e=this._steps;this._header||(this._header=document.createElement(`nav`),this._header.className=`stepper wizard-stepper`,this._footer=document.createElement(`div`),this._footer.className=`form-actions wizard-footer form-actions-between`,e.length?(this.insertBefore(this._header,e[0]),e[e.length-1].after(this._footer)):(this.prepend(this._header),this.append(this._footer))),this._known=e,this._renderChrome(),this._rendered=!0,this._wire()}_renderChrome(){let e=this._reconcileSteps();this._placeChrome(e),this._clampActive(e),this._syncPanels(e),this._header.innerHTML=this._headerHtml(e),this._footer.innerHTML=this._footerHtml(e),this._header.hidden=this.hasAttribute(`hide-stepper`)}_clampActive(e){let t=Math.max(0,e.length-1);this._active>t&&(this._active=t),this._active<0&&(this._active=0)}_reconcileSteps(){let e=this._steps,t=this._known;if(this._known=e,ip(e,t))return e;let n=n=>new Set([...n].map(n=>e.indexOf(t[n])).filter(e=>e>=0));this._skipped=n(this._skipped),this._invalid=n(this._invalid);let r=t[this._active];if(!r)return e;let i=e.indexOf(r);if(i<0){let n=t=>e.includes(t),r=t.slice(this._active+1).find(n)??t.slice(0,this._active).reverse().find(n);i=r?e.indexOf(r):this._active}return i=Math.min(i,Math.max(0,e.length-1)),i!==this._active&&(this._active=i,this._reflectActive(i)),e}_placeChrome(e){if(!e.length)return;let t=e[e.length-1];this._header.nextElementSibling!==e[0]&&this.insertBefore(this._header,e[0]),this._footer.previousElementSibling!==t&&t.after(this._footer)}_onStepsMutated(){if(!this._rendered)return;let e=this._steps,t=!e.length||this._header.nextElementSibling===e[0]&&this._footer.previousElementSibling===e[e.length-1];this.querySelector(np)!==this._glyphs&&(this._watchGlyphs(),this._renderHeader()),!(t&&ip(e,this._known))&&(this._renderChrome(),this._observer?.takeRecords())}_syncPanels(e){e.forEach((e,t)=>{let n=t===this._active;e.classList.add(`wizard-panel`),e.hidden=!n,e.setAttribute(`role`,`tabpanel`),e.setAttribute(`aria-hidden`,n?`false`:`true`)})}_stepStatus(e,t){return e.getAttribute(`status`)||(this._invalid.has(t)?`error`:this._finished?`done`:t===this._active?`active`:t<this._active?this._skipped.has(t)?`skipped`:`done`:`pending`)}_headerHtml(e){let t=this.getAttribute(`variant`)===`journey`,n=this.getAttribute(`variant`)===`icons`,r=this.getAttribute(`orientation`)===`vertical`,i=!this.hasAttribute(`hide-connectors`);this._header.className=[`stepper`,`wizard-stepper`,t&&`stepper-journey`,n&&`stepper-icons`,r&&`stepper-vertical`,!i&&`wui-stepper-no-connectors`].filter(Boolean).join(` `),this._header.setAttribute(`aria-label`,this.getAttribute(`label`)||`Progress`);let a=this.hasAttribute(`non-linear`);return e.map((r,o)=>{let s=this._stepStatus(r,o),c=r.getAttribute(`label`)||``,l=r.getAttribute(`description`)||``,u=r.getAttribute(`icon`)||``,d=o+1,f;f=s===`done`?this._glyph(`check`):s===`error`?this._glyph(`alert-triangle`):s===`skipped`?this._glyph(`minus`):u?this._glyph(u):String(d);let p=s===`pending`?`step`:`step ${s}`,m=s===`active`?` aria-current="step"`:``,h=a||o<this._active,g=l?`<span class="step-desc">${ap(l)}</span>`:``,_;_=t?`<span class="step-circle">${f}</span><span class="step-text"><span class="step-index">Step ${d}</span><span class="step-label">${ap(c)}</span>${g}</span>`:n?`<span class="step-circle">${f}</span><span class="step-index">Step ${d}</span><span class="step-label">${ap(c)}</span>${g}`:`<span class="step-circle">${f}</span><span class="step-label">${ap(c)}</span>${g}`;let v=h?`<button type="button" class="${p}" data-step="${o}"${m}>${_}</button>`:`<div class="${p}"${m}>${_}</div>`;return t&&i&&o<e.length-1?`${v}<span class="step-line${s===`done`?` done`:``}" aria-hidden="true"></span>`:v}).join(``)}_footerHtml(e){let t=this._active,n=e.length-1,r=this.hasAttribute(`disabled`)?` disabled`:``,i=e[t]?.hasAttribute(`optional`)||this.hasAttribute(`skippable`),a=this.getAttribute(`back-label`)||`Back`,o=this.getAttribute(`next-label`)||`Next`,s=this.getAttribute(`skip-label`)||`Skip`,c=this.getAttribute(`finish-label`)||`Finish`;return`${t>0?`<button type="button" class="btn btn-secondary" data-nav="back"${r}>${j(`arrow-left`,{className:`me-2`})}${ap(a)}</button>`:`<span></span>`}<span class="wizard-footer-actions">${i&&t<n?`<button type="button" class="btn btn-neutral" data-nav="skip"${r}>${ap(s)}</button>`:``}${t<n?`<button type="button" class="btn btn-primary" data-nav="next"${r}>${ap(o)}${j(`arrow-right`,{className:`ms-2`})}</button>`:`<button type="button" class="btn btn-primary" data-nav="finish"${r}>${ap(c)}</button>`}</span>`}_wire(){this._teardown(),this._onHeaderClick=e=>{let t=e.target.closest(`[data-step]`);t&&this.contains(t)&&this._stepTo(Number.parseInt(t.dataset.step,10))},this._onFooterClick=e=>{let t=e.target.closest(`[data-nav]`);if(!t||!this.contains(t)||this.hasAttribute(`disabled`))return;let n=t.dataset.nav;n===`back`?this._back():n===`skip`?this._skip():(n===`next`||n===`finish`)&&this._next()},this._header.addEventListener(`click`,this._onHeaderClick),this._footer.addEventListener(`click`,this._onFooterClick),this._observer=new MutationObserver(()=>this._onStepsMutated()),this._observer.observe(this,{childList:!0}),this._watchGlyphs()}_glyph(e){let t=this.querySelector(np),n=t&&[...t.children].find(t=>t.getAttribute(`data-icon`)===e);if(n)return n.outerHTML;let r=Number.parseInt(this.getAttribute(`icon-size`),10);return j(e,r>0?{size:r}:void 0)}_watchGlyphs(){this._glyphObserver?.disconnect(),this._glyphObserver=null,this._glyphs=this.querySelector(np),this._glyphs&&(this._glyphObserver=new MutationObserver(()=>this._renderHeader()),this._glyphObserver.observe(this._glyphs,{childList:!0,subtree:!0,attributes:!0,characterData:!0}))}_renderHeader(){this._rendered&&(this._header.innerHTML=this._headerHtml(this._steps))}_teardown(){this._header&&this._onHeaderClick&&this._header.removeEventListener(`click`,this._onHeaderClick),this._footer&&this._onFooterClick&&this._footer.removeEventListener(`click`,this._onFooterClick),this._observer?.disconnect(),this._observer=null,this._glyphObserver?.disconnect(),this._glyphObserver=null}_stepTo(e){this.hasAttribute(`disabled`)||!this.hasAttribute(`non-linear`)&&e>=this._active||this._go(e,`step`)}_back(){this._active>0&&this._go(this._active-1,`back`)}async _next(){this._reconcileSteps();let e=this._active,t=this._steps,n=e>=t.length-1,r=t[e];if(!this.dispatchEvent(new CustomEvent(`wui-wizard:beforechange`,{detail:n?{index:e,next:e,reason:`finish`}:{index:e,next:e+1,reason:`next`},cancelable:!0})))return this._flagInvalid(e);if(this._beforeNext){let i;try{i=await this._beforeNext(e)}catch{i=!1}if(this._reconcileSteps(),t=this._steps,e=t.indexOf(r),e<0)return;if(n=e>=t.length-1,i===!1)return this._flagInvalid(e)}if(this._invalid.delete(e),this._skipped.delete(e),n)return this._finish();this._go(e+1,`next`)}_skip(){let e=this._active,t=this._steps;if(!(!t[e]?.hasAttribute(`optional`)&&!this.hasAttribute(`skippable`))){if(this._invalid.delete(e),this._skipped.add(e),this.dispatchEvent(new CustomEvent(`wui-wizard:skip`,{detail:{index:e}})),e>=t.length-1)return this._finish();this._go(e+1,`skip`)}}_flagInvalid(e){this._invalid.add(e),this._renderChrome(),this.dispatchEvent(new CustomEvent(`wui-wizard:invalid`,{detail:{index:e}}))}_finish(){this._invalid.delete(this._active),this._finished=!0,this._renderChrome(),this.dispatchEvent(new CustomEvent(`wui-wizard:finish`,{detail:{index:this._active}}))}_go(e,t){let n=this._reconcileSteps(),r=Math.max(0,n.length-1),i=Math.min(Math.max(e,0),r),a=this._active;this._finished=!1,this._invalid.delete(a),this._active=i,this._reflectActive(i),this._renderChrome(),t!==`silent`&&i!==a&&this.dispatchEvent(new CustomEvent(`wui-wizard:change`,{detail:{index:i,previous:a,reason:t}}))}_reflectActive(e){this._reflecting=!0,this.setAttribute(`active`,String(e)),this._reflecting=!1}},ip=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),ap=e=>String(e??``).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`),op=class extends l{static get observedAttributes(){return[`label`,`description`,`optional`,`icon`,`status`]}attributeChangedCallback(){let e=this.closest(`wui-wizard`);e&&typeof e.refresh==`function`&&e.refresh()}},sp=`image/jpeg,image/png,image/webp,image/heic,image/heif,.heic,.heif`,cp=10,lp=512,up=`image/webp`,dp=[96,48],fp={dialogTitle:`Edit photo`,dialogSubtitle:`Drag to position the photo, then zoom or rotate it.`,save:`Save photo`,cancel:`Cancel`,choose:`Upload photo`,change:`Change photo`,camera:`Take photo`,remove:`Remove photo`,unreadable:`That photo could not be opened. Choose a JPG, PNG or WebP image.`,heicUnreadable:`This browser cannot open HEIC photos. Choose a JPG, PNG or WebP image instead.`,cropFailed:`That photo could not be saved. Try again, or choose another one.`};function pp(e){if(!e)return!1;let t=String(e.type||``).toLowerCase();return t===`image/heic`||t===`image/heif`||/\.hei[cf]$/i.test(String(e.name||``))}function mp(e){return pp(e)?fp.heicUnreadable:fp.unreadable}function hp(e,t){let n=Number(t);return{name:e?.name||`photo`,type:up,size:Number.isInteger(n)&&n>0?n:512}}var gp=`/`,_p=`.search-wrap.wui-search-collapsible`,vp=`.wui-topsearch-panel`,yp=`.modal, wui-drawer[open]`,bp=new WeakSet,xp=e=>e.querySelector(`.wui-search-toggle`),Sp=e=>e.querySelector(`.search-input`);function Cp(e){e.classList.remove(`is-collapsed`),xp(e)?.setAttribute(`aria-expanded`,`true`),Sp(e)?.focus()}function wp(e){Sp(e)?.value||(e.classList.add(`is-collapsed`),xp(e)?.setAttribute(`aria-expanded`,`false`))}function Tp(e){if(e.dataset.wuiCollapseWired)return;e.dataset.wuiCollapseWired=`1`;let t=xp(e),n=Sp(e);t?.addEventListener(`click`,()=>Cp(e)),n?.addEventListener(`keydown`,r=>{r.key!==`Escape`||n.value||(r.preventDefault(),wp(e),t?.focus())}),e.addEventListener(`focusout`,t=>{e.contains(t.relatedTarget)||wp(e)})}function Ep(e){bp.has(e)||(bp.add(e),e.addEventListener(`keydown`,t=>{if(t.key!==`/`||t.ctrlKey||t.altKey||t.metaKey||t.defaultPrevented||C(t.target)||t.target?.closest?.(yp)||e.querySelector(vp))return;let n=[...e.querySelectorAll(_p)].find(e=>e.offsetParent!==null);n&&(t.preventDefault(),Cp(n))}))}function Dp(e=document){for(let t of e.querySelectorAll(_p))Tp(t);Ep(e.ownerDocument??e)}var Op=`wuiConfirm`,kp=Object.freeze([`danger`]),Ap=Object.freeze([`success`,`info`,`warning`,`danger`]),jp=`wui.flash`,Mp=Object.freeze({confirmTitle:`Are you sure?`,confirmLabel:`Confirm`,cancelLabel:`Cancel`,failed:`That did not work. Try again.`,forbidden:`You do not have permission to do that.`,network:`Could not reach the server. Check your connection and try again.`}),Np=new WeakSet,Pp=new WeakSet,Fp=null,Ip=null,Lp=!1,Rp=e=>{let t=document.createElement(`span`);return t.textContent=e??``,t.innerHTML},zp=(e,t)=>{e&&window.WUI?.toast?.(e,{variant:t})},Bp=()=>{let e=window.bootstrap?.Modal;if(!e)throw Error(`data-wui-confirm: Bootstrap's bundle (window.bootstrap) is not loaded on this page.`);return e};function Vp(){let e=document.getElementById(Op);return e||(e=document.createElement(`div`),e.id=Op,e.className=`modal fade wui-modal-shell`,e.tabIndex=-1,e.setAttribute(`aria-hidden`,`true`),e.setAttribute(`role`,`dialog`),e.setAttribute(`aria-modal`,`true`),e.style.setProperty(`--wui-modal-max-width`,`${gn.md}px`),e.innerHTML=`<div class="modal-dialog modal-dialog-centered wui-rb-dialog"><div class="modal-content wui-modal wui-confirm"><div class="wui-modal-body"><div class="wui-confirm-content"><span class="wui-confirm-icon"><wui-status-icon tone="info" size="120"></wui-status-icon></span><h3 class="wui-confirm-title" tabindex="-1" data-autofocus></h3><p class="wui-confirm-msg"></p></div></div><div class="wui-modal-footer"><div class="wui-confirm-actions"><button type="button" class="btn btn-secondary" data-bs-dismiss="modal">${Rp(Mp.cancelLabel)}</button><button type="button" class="btn btn-primary" data-app-confirm></button></div></div></div></div>`,document.body.appendChild(e),e)}function Hp(e,t){let n=e.getAttribute(`data-wui-confirm-tone`);if(n!==null&&!kp.includes(n))throw TypeError(`data-wui-confirm-tone="${n}" is not supported. Use danger, or leave it off.`);Up({title:e.getAttribute(`data-wui-confirm-title`),message:e.getAttribute(`data-wui-confirm`),label:e.getAttribute(`data-wui-confirm-label`),danger:n===`danger`},t)}function Up({title:e,message:t,label:n,danger:r},i){let a=Bp(),o=Vp(),s=o.querySelector(`.wui-confirm-title`),c=o.querySelector(`[data-app-confirm]`);if(!s||!c)throw Error(`#${Op} is not a confirm dialog with a confirm button. Render <app-confirm-dialog id="${Op}"> without confirm-href, or leave the dialog to the library.`);let l=o.querySelector(`.wui-confirm-msg`);l||(l=document.createElement(`p`),l.className=`wui-confirm-msg`,s.after(l)),s.textContent=e||Mp.confirmTitle,l.textContent=t,c.textContent=n||Mp.confirmLabel,c.classList.toggle(`btn-danger`,r),c.classList.toggle(`btn-primary`,!r),o.querySelector(`wui-status-icon`)?.setAttribute(`tone`,r?`delete`:`info`),o.setAttribute(`aria-label`,s.textContent),Ip=i,Lp=!1,a.getOrCreateInstance(o).show()}var Wp=(e,t)=>{Fp=e;try{t()}finally{Fp=null}};function Gp(e,{title:t,message:n,label:r,tone:i},a){if(i!=null&&!kp.includes(i))throw TypeError(`confirmAction: tone "${i}" is not supported. Use danger, or leave it off.`);om(e.ownerDocument),Up({title:t,message:n,label:r,danger:i===`danger`},()=>Wp(e,a))}var Kp=e=>e.disabled===!0||e.getAttribute(`aria-disabled`)===`true`;function qp(e){let t=e.target.closest?.(`[data-wui-confirm]:not(form)`);!t||t===Fp||Kp(t)||(e.preventDefault(),e.stopImmediatePropagation(),Hp(t,()=>Wp(t,()=>t.click())))}function Jp(e){let t=e.target;if(!(t instanceof HTMLFormElement)||!t.hasAttribute(`data-wui-confirm`)||t===Fp||e.submitter&&e.submitter===Fp)return;e.preventDefault(),e.stopImmediatePropagation();let n=e.submitter?.form===t?e.submitter:void 0;Hp(t,()=>Wp(t,()=>t.requestSubmit(n)))}function Yp(e){let t=e.target.closest?.(`#${Op} [data-app-confirm]`);!t||t.disabled||!Ip||(Lp=!0,Bp().getOrCreateInstance(t.closest(`#${Op}`)).hide())}function Xp(e){if(e.target.id!==`wuiConfirm`)return;let t=Lp?Ip:null;Ip=null,Lp=!1,t?.()}var Zp=(e,t)=>{e&&window.sessionStorage.setItem(jp,JSON.stringify({message:e,variant:t}))},Qp=e=>e===`forbidden`?Mp.forbidden:e===`network`?Mp.network:Mp.failed;function $p(){for(let e of document.querySelectorAll(`[data-wui-server]`))e.dataset.refreshOnSuccess!==`false`&&Gt(e)?.reload()}async function em(e){let t=e.getAttribute(`data-wui-post`);if(!t)throw Error(`A data-wui-post button needs the URL the action posts to.`);return tm(t,e)}async function tm(e,t,n){let r=t.getAttribute(`data-wui-post-reload`);if(r!==null&&r!==`page`)throw TypeError(`data-wui-post-reload="${r}" is not supported. Use page, or leave it off to reload the server tables.`);t.disabled=!0,t.setAttribute(`aria-busy`,`true`);let i=await P(e,{method:`POST`,body:n});if(i.kind===`session`||i.kind===`aborted`)return;let a=i.toastVariant||`success`;if(i.ok&&(i.redirect||r===`page`)){Zp(i.message,a),i.redirect?window.location.assign(i.redirect):window.location.reload();return}if(t.disabled=!1,t.removeAttribute(`aria-busy`),i.ok){Qt(i,a),$p();return}zp(i.message||Qp(i.kind),`danger`)}function nm(e){let t=e.target.closest?.(`[data-wui-post]`);t&&(e.preventDefault(),!(Kp(t)||t.getAttribute(`aria-busy`)===`true`)&&em(t).catch(e=>console.error(e)))}function rm(e){let t=e.target.closest?.(`form[data-wui-post-form]`);if(!t||e.defaultPrevented)return;e.preventDefault();let n=e.submitter||t.querySelector(`button`);n.getAttribute(`aria-busy`)!==`true`&&(tm(t.getAttribute(`action`),n,new FormData(t)).catch(e=>console.error(e)),window.bootstrap?.Dropdown?.getInstance(t.closest(`.dropdown`)?.querySelector(`[data-bs-toggle='dropdown']`))?.hide())}function im(){let e=window.sessionStorage.getItem(jp);if(!e)return;window.sessionStorage.removeItem(jp);let{message:t,variant:n}=JSON.parse(e);zp(t,n)}function am(e){let t=e.querySelectorAll?[...e.querySelectorAll(`[data-wui-flash]`)]:[];e instanceof Element&&e.matches(`[data-wui-flash]`)&&t.unshift(e);for(let e of t){let t=e.getAttribute(`data-wui-flash-variant`)||`success`;if(!Ap.includes(t))throw TypeError(`data-wui-flash-variant="${t}" is not supported. Use ${Ap.join(`, `)}.`);let n=e.getAttribute(`data-wui-flash`)||e.textContent.trim();e.remove(),zp(n,t)}}function om(e){Pp.has(e)||(Pp.add(e),e.addEventListener(`click`,Yp),e.addEventListener(`hidden.bs.modal`,Xp))}function sm(e=document){let t=e.ownerDocument||e;Np.has(t)||(Np.add(t),t.addEventListener(`click`,qp,!0),t.addEventListener(`submit`,Jp,!0),om(t),t.addEventListener(`click`,nm),t.addEventListener(`submit`,rm),im()),am(e)}var cm=Object.freeze({title:`Leave without saving?`,message:`Your changes on this page are not saved. If you leave now, they are lost.`,leaveLabel:`Leave`}),lm=`form[data-wui-unsaved]`,um=`[aria-invalid="true"], .field-error:not(:empty), .field-validation-error, .validation-summary-errors, .wui-error-summary`,dm=`[download], [data-wui-modal], [data-wui-post], [data-bs-toggle]`,fm=new Set([`submit`,`button`,`reset`,`image`]),pm=new WeakMap,mm=new WeakSet,hm=e=>`${e.name}:${e.size}:${e.lastModified}`;function gm(e){let t=[];for(let n of e.elements)!n.name||n.disabled||fm.has(n.type)||(n.type===`checkbox`||n.type===`radio`?t.push([n.name,n.value,n.checked]):n.type===`file`?t.push([n.name,[...n.files||[]].map(hm)]):n.type===`select-multiple`?t.push([n.name,[...n.selectedOptions].map(e=>e.value)]):t.push([n.name,n.value]));return JSON.stringify(t)}function _m(e){return gm(e)}var vm=e=>({saved:e.querySelector(um)?null:gm(e),engaged:!1,discarded:!1});function ym(e){let t=pm.get(e);return!t||t.discarded||!e.isConnected?!1:t.saved===null||t.engaged&&gm(e)!==t.saved}var bm=(e,t)=>[...e.querySelectorAll(lm)].filter(e=>e!==t&&ym(e)),xm=()=>!!window.bootstrap?.Modal;function Sm(e,t,n){let r=t.map(e=>e.getAttribute(`data-wui-unsaved`)).find(Boolean)||cm.message;Gp(e,{title:cm.title,message:r,label:cm.leaveLabel,tone:`danger`},()=>{for(let e of t)pm.get(e).discarded=!0;n()})}function Cm(e){if(e.matches(dm))return!1;let t=e.getAttribute(`target`);if(t&&t.toLowerCase()!==`_self`)return!1;let n=new URL(e.getAttribute(`href`),window.location.href);if(n.protocol!==`http:`&&n.protocol!==`https:`)return!1;let r=window.location;return!(n.hash&&n.origin===r.origin&&n.pathname===r.pathname&&n.search===r.search)}function wm(e,t){if((t?.getAttribute(`formmethod`)||e.getAttribute(`method`)||`get`).toLowerCase()===`dialog`)return!1;let n=t?.getAttribute(`formtarget`)||e.getAttribute(`target`);return!n||n.toLowerCase()===`_self`}function Tm(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=e.target.closest?.(`a[href]`);if(!t||!Cm(t))return;let n=bm(t.ownerDocument,null);!n.length||!xm()||(e.preventDefault(),Sm(t,n,()=>t.click()))}function Em(e){let t=e.target;if(!(t instanceof HTMLFormElement)||e.defaultPrevented||!wm(t,e.submitter))return;let n=bm(t.ownerDocument,t);if(n.length&&xm()){e.preventDefault();let r=e.submitter?.form===t?e.submitter:void 0;Sm(t,n,()=>t.requestSubmit(r));return}let r=pm.get(t);r&&(r.saved=gm(t),r.discarded=!1)}function Dm(e){bm(document,null).length&&(e.preventDefault(),e.returnValue=``)}function Om(e){let t=e.target.closest?.(lm),n=t&&pm.get(t);!n||n.engaged||(n.saved!==null&&(n.saved=gm(t)),n.engaged=!0)}function km(e){let t=e.target.closest?.(lm),n=t&&pm.get(t);n&&(n.discarded=!1,e.isTrusted&&(n.engaged=!0))}function Am(e){let t=e.detail?.handle?.el;if(t instanceof Element)for(let e of t.querySelectorAll(lm))Mm(e)}function jm(e=document){let t=e.ownerDocument||e;if(!mm.has(t)){mm.add(t);for(let e of[`focusin`,`pointerdown`,`drop`])t.addEventListener(e,Om,!0);for(let e of[`input`,`change`])t.addEventListener(e,km,!0);t.addEventListener(`click`,Tm),t.addEventListener(`submit`,Em),t.addEventListener(`wui:modal:success`,Am),t.defaultView.addEventListener(`beforeunload`,Dm)}let n=[...e.querySelectorAll?.(lm)||[]];e.matches?.(lm)&&n.unshift(e);for(let e of n)pm.has(e)||pm.set(e,vm(e))}function Mm(e){if(!(e instanceof HTMLFormElement)||!e.matches(lm))throw TypeError(`resetUnsavedChanges: ${String(e)} is not a <form data-wui-unsaved>.`);pm.set(e,{saved:gm(e),engaged:!1,discarded:!1})}var Nm=Object.freeze({discard:`Discard`,keep:`Keep editing`}),Pm=`wui:drawer:discard`,Fm=`wui-drawer[confirm-discard]`,Im=`.wui-modal-shell`,Lm=`form[data-wui-confirm-discard]`,Rm=`.wui-drawer-discard`,zm=`input, select, textarea`,Bm=new WeakMap,Vm=new WeakSet,Hm=new WeakSet;function Um(e,t,n,r){let i=e.createElement(`button`);return i.type=`button`,i.className=t,i.setAttribute(n,``),i.textContent=r,i}function Wm(e,t){let n=e.createElement(`div`);n.className=`wui-drawer-discard`,n.setAttribute(`role`,`alert`);let r=e.createElement(`span`);return r.className=`wui-drawer-discard-text`,r.textContent=t,n.append(r,Um(e,`btn btn-danger btn-sm`,`data-wui-discard-confirm`,Nm.discard),Um(e,`btn btn-secondary btn-sm`,`data-wui-discard-keep`,Nm.keep)),n}function Gm(e){let t=e.closest?.(Fm);if(t)return t;let n=e.closest?.(Im);return n&&(n.hasAttribute(`confirm-discard`)||n.querySelector(Lm))?n:null}function Km(e){return e.closest(Fm)??e.closest(Im)}function qm(e){return e.matches(Fm)||e.hasAttribute(`confirm-discard`)?e.querySelectorAll(`form`):e.querySelectorAll(Lm)}function Jm(e){let t=Bm.get(e);return t!=null&&_m(e)!==t}function Ym(e){let t=e.ownerDocument.createElement(`div`);return t.className=`wui-drawer-footer`,e.querySelector(`.wui-drawer-panel`).append(t),Hm.add(t),t}function Xm(e){let t=e.ownerDocument.createElement(`div`);return t.className=`wui-modal-footer`,(e.querySelector(`.wui-modal-body`)?.parentElement??e.querySelector(`.modal-content`)).append(t),Hm.add(t),t}function Zm(e){e.querySelector(`[data-wui-discard-confirm]`).focus()}function Qm(e,t){let n=e.querySelector(Rm);if(n){Zm(n);return}let r=Wm(e.ownerDocument,t),i;if(e.matches(Fm))i=e.querySelector(`.wui-drawer-footer`)??Ym(e),i.prepend(r);else if(e.hasAttribute(`confirm-discard`))i=e.querySelector(`.wui-modal-footer`)??Xm(e),i.prepend(r);else{let t=e.querySelector(Lm);i=t.querySelector(`.modal-footer`),i?i.prepend(r):(i=t,t.append(r))}i.classList.add(`wui-drawer-discarding`),Zm(r)}function $m(e){let t=e.parentElement;e.remove(),t.classList.remove(`wui-drawer-discarding`),Hm.has(t)&&t.remove()}function eh(e){for(let t of qm(e)){let e=[...t.querySelectorAll(zm)].find(e=>e.type!==`hidden`&&!e.disabled);if(e){e.focus();return}}}function th(e){let t=Gm(e.target);if(t)for(let e of qm(t))Bm.get(e)??Bm.set(e,_m(e))}function nh(e){let t=e.target;!(t instanceof HTMLFormElement)||!Gm(t)||Bm.set(t,_m(t))}function rh(e){let t=e.detail?.handle?.el;if(t instanceof Element)for(let e of t.querySelectorAll(`form`))Bm.delete(e)}function ih(e){let t=e.target;!(t instanceof Element)||!t.matches(Fm)||[...qm(t)].some(Jm)&&(e.preventDefault(),Qm(t,t.getAttribute(`confirm-discard`)))}function ah(e){let t=e.target;if(!(t instanceof Element)||!t.matches(Im))return;let n=[...qm(t)].find(Jm);n&&(e.preventDefault(),Qm(t,t.getAttribute(`confirm-discard`)??n.getAttribute(`data-wui-confirm-discard`)))}function oh(e){let t=e.closest(`wui-drawer`);if(t){t.dispatchEvent(new CustomEvent(`wui-drawer-close`,{bubbles:!0,cancelable:!0}))&&t.hide();return}let n=e.closest(Im);n&&window.bootstrap?.Modal?.getInstance(n)?.hide()}function sh(e){let t=e.closest(Rm),n=Km(t);$m(t);for(let e of qm(n))Bm.set(e,_m(e));n.dispatchEvent(new CustomEvent(Pm,{bubbles:!0})),n.matches(Fm)?n.hide():window.bootstrap.Modal.getInstance(n).hide()}function ch(e){let t=e.closest(Rm),n=Km(t);$m(t),eh(n)}function lh(e){let t=e.target,n=t.closest?.(`[data-wui-discard-confirm]`);if(n){sh(n);return}let r=t.closest?.(`[data-wui-discard-keep]`);if(r){ch(r);return}let i=t.closest?.(`[data-wui-dismiss]`);i&&oh(i)}function uh(e){if(e.key!==`Escape`)return;let t=e.currentTarget.querySelector(Rm);if(!t)return;e.preventDefault(),e.stopPropagation();let n=Km(t);$m(t),eh(n)}function dh(e=document){let t=e.ownerDocument||e;Vm.has(t)||(Vm.add(t),t.addEventListener(`focusin`,th),t.addEventListener(`pointerdown`,th),t.addEventListener(`submit`,nh),t.addEventListener(`wui:modal:success`,rh),t.addEventListener(`wui:modal:loaded`,rh),t.addEventListener(`wui-drawer-close`,ih,!0),t.addEventListener(`hide.bs.modal`,ah),t.addEventListener(`click`,lh),t.addEventListener(`keydown`,uh,!0))}var fh=`image/png,image/jpeg,image/webp`,ph=5,mh={"image/png":[`.png`],"image/jpeg":[`.jpg`,`.jpeg`],"image/webp":[`.webp`],"image/gif":[`.gif`],"image/svg+xml":[`.svg`],"image/heic":[`.heic`],"image/heif":[`.heif`],"application/pdf":[`.pdf`],"text/plain":[`.txt`]},hh={"image/png":`PNG`,"image/jpeg":`JPG`,"image/webp":`WEBP`,"image/gif":`GIF`,"image/svg+xml":`SVG`,"image/heic":`HEIC`,"image/heif":`HEIC`,"application/pdf":`PDF`,"text/plain":`text file`,".png":`PNG`,".jpg":`JPG`,".jpeg":`JPG`,".webp":`WEBP`,".gif":`GIF`,".svg":`SVG`,".heic":`HEIC`,".heif":`HEIC`,".pdf":`PDF`,".txt":`text file`},gh=e=>String(e||``).split(`,`).map(e=>e.trim().toLowerCase()).filter(Boolean),_h=[`.png`,`.jpg`,`.jpeg`,`.webp`,`.gif`,`.svg`,`.bmp`,`.avif`,`.heic`,`.heif`];function vh(e){if(!e)return!1;let t=typeof e==`object`&&e.type?String(e.type).toLowerCase():``;if(t)return t.startsWith(`image/`);let n=typeof e==`string`?e:e.name||e.url||``,r=String(n).toLowerCase();return _h.some(e=>r.endsWith(e))}function yh(e){if(!e)return!1;let t=typeof e==`object`&&e.type?String(e.type).toLowerCase():``;if(t)return t===`application/pdf`;let n=typeof e==`string`?e:e.name||e.url||``;return String(n).toLowerCase().split(/[?#]/)[0].endsWith(`.pdf`)}function bh(e){let t=gh(e);return t.length?t.every(e=>e.startsWith(`.`)?_h.includes(e):e===`image/*`||e.startsWith(`image/`)):!1}function xh(e){let t=[];for(let n of gh(e)){let e=hh[n]||(n.startsWith(`.`)?n.slice(1).toUpperCase():n.toUpperCase());t.includes(e)||t.push(e)}return t.length<=1?t[0]||`supported`:`${t.slice(0,-1).join(`, `)} or ${t[t.length-1]}`}function Sh(e,t){let n=gh(t);if(!n.length)return!0;let r=(e.type||``).toLowerCase(),i=(e.name||``).toLowerCase();return n.some(e=>e.startsWith(`.`)?i.endsWith(e):e.endsWith(`/*`)?r.startsWith(e.slice(0,-1)):r&&r===e?!0:!r&&(mh[e]||[]).some(e=>i.endsWith(e)))}function Ch(e,t={}){if(!e)return null;let n=t.accept===void 0?fh:t.accept,r=t.maxSizeMb===void 0?5:t.maxSizeMb;if(!Sh(e,n)){let e=xh(n);return`Choose a ${e.endsWith(` file`)?e:`${e} file`}.`}return r>0&&e.size>r*1024*1024?`Keep the file under ${r} MB.`:null}var wh=/[0-9]/,Th={9:wh,A:/[A-Za-z]/,"*":/[0-9A-Za-z]/},Eh=/[9A*]/,Dh=new Set([`text`,`tel`,`search`,`url`,`password`]),Oh=e=>{let t=e.replace(/\D/g,``);return t.length===12&&t.startsWith(`91`)?t.slice(2):t.length===11&&t.startsWith(`0`)?t.slice(1):e},kh=e=>{let t=Number(e.slice(0,2)),n=Number(e.slice(2,4)),r=Number(e.slice(4,8));if(r<1)return!1;let i=new Date(Date.UTC(r,n-1,t));return i.getUTCFullYear()===r&&i.getUTCMonth()===n-1&&i.getUTCDate()===t},Ah=e=>e.length<=3?e:`${e.slice(0,-3).replace(/\B(?=(\d{2})+(?!\d))/g,`,`)},${e.slice(-3)}`,jh=e=>{let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e.trim());return t?`${t[3]}-${t[2]}-${t[1]}`:e};function Mh(e,{upper:t=!1,normalize:n,valid:r,post:i=e=>e,message:a=`Enter the full value`}={}){let o=[...e].map(e=>Th[e]?{re:Th[e]}:{lit:e}),s=o.filter(e=>e.re).length;return{inputMode:o.every(e=>!e.re||e.re===wh)?`numeric`:`text`,normalize:n,post:i,message:a,extract(e){let n=``,r=0;for(let i of e){for(;r<o.length&&o[r].lit!==void 0&&o[r].lit!==i;)r++;if(r>=o.length)break;let e=o[r];e.lit===void 0?e.re.test(i)&&(n+=t?i.toUpperCase():i,r++):r++}return n},layout(e){let t=``,n=[],r=0;for(let i=0;i<o.length&&r<e.length;i++)o[i].lit===void 0?(t+=e[r++],n.push(!0)):(t+=o[i].lit,n.push(!1));return{text:t,isRaw:n}},isValid:e=>e.length===s&&(!r||r(e))}}function Nh(){return{inputMode:`decimal`,post:e=>e,message:`Enter a valid amount`,extract(e){let t=``,n=!1,r=0;for(let i of e)wh.test(i)?n?r<2&&(t+=i,r++):t+=i:i===`.`&&!n&&(n=!0,t+=i);return t.startsWith(`.`)&&(t=`0${t}`),t.replace(/^0+(?=\d)/,``)},layout(e){let[t,n]=e.split(`.`),r=Ah(t)+(e.includes(`.`)?`.${n}`:``);return{text:r,isRaw:[...r].map(e=>e!==`,`)}},isValid:e=>/^\d+(\.\d{1,2})?$/.test(e)}}var Ph={"phone-in":()=>Mh(`99999 99999`,{normalize:Oh,valid:e=>/^[6-9]/.test(e),message:`Enter a 10-digit mobile number`}),pan:()=>Mh(`AAAAA9999A`,{upper:!0,valid:e=>/^[A-Z]{5}\d{4}[A-Z]$/.test(e),message:`Enter a valid PAN`}),gstin:()=>Mh(`99AAAAA9999A***`,{upper:!0,valid:e=>/^\d{2}[A-Z]{5}\d{4}[A-Z][1-9A-Z]Z[0-9A-Z]$/.test(e),message:`Enter a valid GSTIN`}),aadhaar:()=>Mh(`9999 9999 9999`,{valid:e=>/^[2-9]/.test(e),message:`Enter a valid 12-digit Aadhaar number`}),ifsc:()=>Mh(`AAAA*******`,{upper:!0,valid:e=>/^[A-Z]{4}0[A-Z0-9]{6}$/.test(e),message:`Enter a valid IFSC`}),"pin-code":()=>Mh(`999999`,{valid:e=>/^[1-9]/.test(e),message:`Enter a valid 6-digit PIN code`}),date:()=>Mh(`99-99-9999`,{normalize:jh,valid:kh,post:(e,t)=>e.length===8&&kh(e)?`${e.slice(4)}-${e.slice(2,4)}-${e.slice(0,2)}`:t,message:`Enter a valid date as DD-MM-YYYY`}),amount:Nh},Fh=Object.keys(Ph),Ih=e=>{let t=String(e).toLowerCase();return Object.hasOwn(Ph,t)?t:void 0},Lh=e=>Eh.test(String(e))&&Ih(e)===void 0,Rh=new Map;function zh(e){if(e==null||e===``)return null;let t=String(e);return Rh.has(t)||(Lh(t)?Rh.set(t,Mh(t)):Rh.set(t,Object.hasOwn(Ph,t)?Ph[t]():null)),Rh.get(t)}var Bh=(e,t)=>e.normalize?e.normalize(t):t;function Vh(e,t){let n=zh(e);return n?n.extract(Bh(n,String(t??``))):String(t??``)}function Hh(e,t){let n=zh(e);if(!n)return String(t??``);let r=n.extract(Bh(n,String(t??``)));return n.post(r,n.layout(r).text)}function Uh(e,t){let n=zh(e);return n?n.layout(n.extract(Bh(n,String(t??``)))).text:String(t??``)}var Wh=(e,t)=>{if(t<=0)return 0;let n=0;for(let r=0;r<e.length;r++)if(e[r]&&++n===t)return r+1;return e.length},Gh=new WeakMap,Kh=e=>Gh.get(e)?.(),qh=new WeakMap;function Jh(e,t,n,r){let i=e.getAll(t),a=qh.get(e);a||qh.set(e,a=new Set);let o=i.findIndex((e,r)=>e===n&&!a.has(`${t}\u0000${r}`));if(!(o<0)){if(a.add(`${t}\u0000${o}`),i[o]=r,i.length===1){e.set(t,r);return}e.delete(t);for(let n of i)e.append(t,n)}}function Yh(e){let t=null,n=null,r=!1,i=(t,n)=>n===null?e.removeAttribute(t):e.setAttribute(t,n),a,o,s=()=>{t?.remove(),t=null,n&&(n.hidden=!1),n=null,r&&e.classList.remove(`error`),r=!1,a!==void 0&&i(`aria-invalid`,a),o!==void 0&&i(`aria-describedby`,o),a=void 0,o=void 0};return i=>{if(!i){s();return}let c=e.closest(`.field`),l=c?.querySelector(`.field-error`);l&&l!==t&&l.textContent.trim()||(t||(r=!e.classList.contains(`error`),e.classList.add(`error`),a=e.getAttribute(`aria-invalid`),o=e.getAttribute(`aria-describedby`),c&&(t=document.createElement(`div`),t.className=`field-error`,e.id&&(t.id=`${e.id}-error`),n=c.querySelector(`.field-hint`),n&&(n.hidden=!0),c.insertBefore(t,[...c.children].find(e=>e.classList.contains(`field-count`))??null),t.id&&e.setAttribute(`aria-describedby`,t.id)),e.setAttribute(`aria-invalid`,`true`)),t&&(t.textContent=i))}}function Xh(e,{mask:t,postFormatted:n=!1,onChange:r,onInvalidChange:i}={}){let a=zh(t);if(!a||!Dh.has(e.type))return()=>{};let o=Object.getPrototypeOf(e),s=Object.getOwnPropertyDescriptor(o,`value`).set,c=!e.hasAttribute(`inputmode`);c&&e.setAttribute(`inputmode`,a.inputMode);let l=i??Yh(e),u=null,d=!1,f=!1,p=!1,m=``,h=``,g,_=()=>{let e=p?m:``;e!==h&&(h=e,l(h))},v=(t,n,i)=>{let o=a.extract(t.slice(0,n)).length,c=a.extract(t),{text:l,isRaw:d}=a.layout(c);if(e.value!==l&&(s.call(e,l),document.activeElement===e&&Dh.has(e.type))){let t=Wh(d,o);e.setSelectionRange(t,t)}e.dataset.maskRaw=c,m=c&&!a.isValid(c)?a.message:``,e.setCustomValidity(m),_(),i&&c!==u&&r?.(c,l),u=c},y=Object.getOwnPropertyDescriptor(e,`value`),b=y??Object.getOwnPropertyDescriptor(o,`value`);Object.defineProperty(e,"value",{configurable:!0,enumerable:b.enumerable,get:()=>b.get.call(e),set:t=>{if(b.set.call(e,t),f)return;let n=Bh(a,e.value);v(n,n.length,!0)}});let x=()=>{d=!0,e.dispatchEvent(new Event(`input`,{bubbles:!0})),d=!1},S=t=>{if(d||f||t.isComposing)return;let n=t.inputType===`insertText`&&(t.data?.length??0)<=1||t.inputType?.startsWith(`delete`)?e.value:Bh(a,e.value);v(n,e.selectionStart??n.length,!0)},ee=()=>{f=!0},te=()=>{f=!1;let t=Bh(a,e.value);v(t,e.selectionStart??t.length,!0),x()},C=t=>{let n=t.inputType===`deleteContentBackward`;if(!n&&t.inputType!==`deleteContentForward`||t.isComposing)return;let r=e.selectionStart;if(r==null||r!==e.selectionEnd)return;let{isRaw:i}=a.layout(a.extract(e.value)),o=n?r-1:r;for(;o>=0&&o<i.length&&!i[o];)o+=n?-1:1;o!==(n?r-1:r)&&(t.preventDefault(),!(o<0||o>=i.length)&&(v(e.value.slice(0,o)+e.value.slice(o+1),n?o:r,!0),x()))},w=t=>{if(e.readOnly||e.disabled)return;let n=t.clipboardData?.getData(`text`);if(n==null)return;t.preventDefault();let r=Bh(a,n),i=e.selectionStart??e.value.length,o=e.selectionEnd??i;v(e.value.slice(0,i)+r+e.value.slice(o),i+r.length,!0),x()},T=()=>{let t=a.extract(e.value);return a.post(t,a.layout(t).text)},E=()=>{p=!0,_()};e.addEventListener(`input`,S),e.addEventListener(`beforeinput`,C),e.addEventListener(`paste`,w),e.addEventListener(`compositionstart`,ee),e.addEventListener(`compositionend`,te),e.addEventListener(`blur`,E),e.addEventListener(`invalid`,E);let D=e.form,ne=t=>{e.name&&!e.disabled&&Jh(t.formData,e.name,e.value,T())},re=()=>{clearTimeout(g),g=setTimeout(()=>{p=!1,v(Bh(a,e.value),e.value.length,!0)},0)};n||(D?.addEventListener(`formdata`,ne),Gh.set(e,T)),D?.addEventListener(`reset`,re),D?.addEventListener(`submit`,E);let ie=Bh(a,e.value);return v(ie,ie.length,!1),()=>{clearTimeout(g),e.removeEventListener(`input`,S),e.removeEventListener(`beforeinput`,C),e.removeEventListener(`paste`,w),e.removeEventListener(`compositionstart`,ee),e.removeEventListener(`compositionend`,te),e.removeEventListener(`blur`,E),e.removeEventListener(`invalid`,E),D?.removeEventListener(`formdata`,ne),D?.removeEventListener(`reset`,re),D?.removeEventListener(`submit`,E),Gh.delete(e),y?Object.defineProperty(e,"value",y):delete e.value,p=!1,m=``,_(),e.setCustomValidity(``),delete e.dataset.maskRaw,c&&e.removeAttribute(`inputmode`)}}function Zh(){let e=typeof window>`u`?void 0:window.jQuery?.validator?.prototype;if(!e||e.wuiMaskHook)return;let t=e.elementValue;e.elementValue=function(e){let n=Kh(e);return n===void 0?t.call(this,e):n},e.wuiMaskHook=!0}var Qh=new WeakMap,$h,eg=e=>{Qh.has(e)||Qh.set(e,Xh(e,{mask:e.dataset.appMask,postFormatted:e.hasAttribute(`data-mask-post-formatted`)}))},tg=e=>e.nodeType===1?[...e.matches(`input[data-app-mask]`)?[e]:[],...e.querySelectorAll(`input[data-app-mask]`)]:[];function ng(){$h||typeof MutationObserver>`u`||($h=new MutationObserver(e=>{for(let t of e){for(let e of t.removedNodes)for(let t of tg(e))Qh.get(t)?.(),Qh.delete(t);for(let e of t.addedNodes)for(let t of tg(e))eg(t)}}),$h.observe(document.documentElement,{childList:!0,subtree:!0}))}function rg(e=document){Zh();for(let t of e.querySelectorAll(`input[data-app-mask]`))eg(t);e===document&&ng()}var ig=`data-wui-bulk-in-bar`,ag=`[data-wui-page-header-bar][data-wui-bulk-for]`,og=new WeakSet;function sg(e){return`${k(e,{decimals:0})} selected`}function cg(e,t){for(let n of e.querySelectorAll(`[data-wui-bar-swap]`))n.hidden=t>0;let n=e.querySelector(`[data-wui-bar-bulk]`);n&&(n.hidden=t===0,n.querySelector(`.page-header-bar-bulk-count`).textContent=t>0?sg(t):``)}function lg(e=document){for(let t of e.querySelectorAll(ag))document.getElementById(t.dataset.wuiBulkFor)?.setAttribute(ig,``);og.has(document)||(og.add(document),document.addEventListener(`selectionchange`,e=>{if(typeof e.detail?.selected==`number`)for(let t of document.querySelectorAll(ag))document.getElementById(t.dataset.wuiBulkFor)?.contains(e.target)&&cg(t,e.detail.selected)}))}var ug={minLength:10,uppercase:!0,lowercase:!0,digit:!0,special:!0,uniqueChars:0,customRules:[]},dg=`Password requirements`;function fg(e){return e===!0||e==null?{...ug}:{...ug,...e}}function pg(e){let t=fg(e),n=[];if(t.minLength>0&&n.push({key:`length`,label:`At least ${t.minLength} characters long`,test:e=>e.length>=t.minLength}),t.uppercase&&n.push({key:`uppercase`,label:`At least one uppercase letter`,test:e=>/[A-Z]/.test(e)}),t.lowercase&&n.push({key:`lowercase`,label:`At least one lowercase letter`,test:e=>/[a-z]/.test(e)}),t.digit&&n.push({key:`digit`,label:`At least one digit`,test:e=>/[0-9]/.test(e)}),t.special&&n.push({key:`special`,label:`At least one special character`,test:e=>/[^A-Za-z0-9]/.test(e)}),t.uniqueChars>0){let e=t.uniqueChars;n.push({key:`unique`,label:`At least ${e} unique character${e>1?`s`:``}`,test:t=>new Set(t).size>=e})}for(let[e,r]of(t.customRules??[]).entries()){let t=new RegExp(r.pattern);n.push({key:`custom-${e}`,label:r.label,test:e=>t.test(e)})}return n}function mg(e,t){let n=e==null?``:String(e);return pg(t).map(e=>({key:e.key,label:e.label,met:e.test(n)}))}function hg(e,t){return mg(e,t).every(e=>e.met)}var gg=`wui:row-drop`,_g=`is-drop-over`,vg=`application/x-wui-rows`,yg=`wui-row-dragging`,bg=`[data-wui-drop-target]`,xg=`tbody tr[data-row-key]`,Sg=`input, button, a, select, textarea, label`,Cg=`.wui-select-cell .wui-check`,wg=new WeakMap,Tg=new WeakSet,Eg=null,Dg=null;function Og(e){return e.querySelector(Cg)?.checked===!0}function kg(e){return[...e.querySelectorAll(`tbody tr`)].filter(Og).map(e=>e.dataset.rowKey)}function Ag(){Eg=null,document.body.classList.remove(yg);for(let e of document.querySelectorAll(`${bg}.${_g}`))e.classList.remove(_g)}function jg(e,t,n){e.dispatchEvent(new CustomEvent(gg,{bubbles:!0,detail:{keys:t,target:n.dataset.wuiDropTarget}}))}function Mg(e){let t=e.target.closest?.(bg);!t||!Eg||(e.preventDefault(),e.dataTransfer.dropEffect=`move`,t.classList.add(_g))}function Ng(e){let t=e.target.closest?.(bg);!t||t.contains(e.relatedTarget)||t.classList.remove(_g)}function Pg(e){let t=e.target.closest?.(bg);if(!t||!Eg)return;e.preventDefault(),t.classList.remove(_g);let{root:n,keys:r}=Eg;jg(n,r,t),Ag()}function Fg(e){let t=e.target.closest?.(bg);!t||!Dg?.keys.length||(e.preventDefault(),jg(Dg.root,Dg.keys,t))}function Ig(e){(e.key===`Enter`||e.key===` `)&&Fg(e)}function Lg(e){Tg.has(e)||(Tg.add(e),e.addEventListener(`dragover`,Mg),e.addEventListener(`dragenter`,Mg),e.addEventListener(`dragleave`,Ng),e.addEventListener(`drop`,Pg),e.addEventListener(`click`,Fg),e.addEventListener(`keydown`,Ig))}function Rg(e){let t=wg.get(e);if(t)return t;Lg(e.ownerDocument||e);let n=t=>{let n=t.target.closest?.(xg);if(!n||!e.contains(n))return;let r=t.target.closest(Sg);r&&n.contains(r)||(n.draggable=!0)},r=t=>{let n=t.target.closest?.(xg);if(!n||!e.contains(n))return;let r=Og(n)?kg(e):[n.dataset.rowKey];t.dataTransfer.setData(vg,JSON.stringify(r)),t.dataTransfer.setData(`text/plain`,r.join(`,`)),t.dataTransfer.effectAllowed=`move`,Eg={root:e,keys:r},document.body.classList.add(yg)},i=t=>{let n=t.detail?.selected;n>0?Dg={root:e,keys:t.detail.keys??kg(e)}:n===0&&(Dg=null),zg(document)};e.addEventListener(`pointerdown`,n),e.addEventListener(`dragstart`,r),e.addEventListener(`dragend`,Ag),e.addEventListener(`selectionchange`,i);let a=()=>{e.removeEventListener(`pointerdown`,n),e.removeEventListener(`dragstart`,r),e.removeEventListener(`dragend`,Ag),e.removeEventListener(`selectionchange`,i),wg.delete(e)};return wg.set(e,a),a}function zg(e=document){let t=e.querySelector(`[data-wui-row-drag] tbody tr ${Cg}:checked`)!==null;for(let n of e.querySelectorAll(bg)){n.tagName!==`BUTTON`&&(n.setAttribute(`role`,`button`),n.setAttribute(`tabindex`,`0`)),t?n.removeAttribute(`aria-disabled`):n.setAttribute(`aria-disabled`,`true`);let e=n.getAttribute(`data-wui-drop-label`)||n.textContent.trim();n.setAttribute(`aria-label`,`Move to ${e}`)}for(let t of e.querySelectorAll(`.wui-drop-tray`))t.hasAttribute(`role`)||(t.setAttribute(`role`,`toolbar`),t.setAttribute(`aria-label`,`Move to`))}function Bg(e=document){for(let t of e.querySelectorAll(`[data-wui-row-drag]`))Rg(t);zg(e.ownerDocument||e)}var Vg=`.table-wrap, .table-responsive, [class*="table-responsive-"]`,Hg=1;function Ug(e){let t=()=>{let t=e.scrollWidth-e.clientWidth,n=Math.abs(e.scrollLeft);e.toggleAttribute(`data-wui-overflow-start`,t>Hg&&n>Hg),e.toggleAttribute(`data-wui-overflow-end`,t>Hg&&n<t-Hg),e.toggleAttribute(`data-wui-overflow-top`,e.scrollTop>Hg)},n=()=>{if(e.scrollWidth-e.clientWidth>Hg){let t=getComputedStyle(e);e.style.setProperty(`--wui-scroll-pad-start`,t.paddingInlineStart),e.style.setProperty(`--wui-scroll-pad-end`,t.paddingInlineEnd)}else e.style.getPropertyValue(`--wui-scroll-pad-end`)&&(e.style.removeProperty(`--wui-scroll-pad-start`),e.style.removeProperty(`--wui-scroll-pad-end`))},r=()=>{n(),t()};e.addEventListener(`scroll`,t,{passive:!0});let i=null;if(typeof ResizeObserver<`u`){i=new ResizeObserver(r),i.observe(e);for(let t of e.children)i.observe(t)}return r(),()=>{e.removeEventListener(`scroll`,t),i?.disconnect(),e.removeAttribute(`data-wui-overflow-start`),e.removeAttribute(`data-wui-overflow-end`),e.removeAttribute(`data-wui-overflow-top`),e.style.getPropertyValue(`--wui-scroll-pad-end`)&&(e.style.removeProperty(`--wui-scroll-pad-start`),e.style.removeProperty(`--wui-scroll-pad-end`))}}var Wg=new WeakMap,Gg,Kg=e=>{Wg.has(e)||Wg.set(e,Ug(e))},qg=e=>e.nodeType===1?[...e.matches(`.table-wrap, .table-responsive, [class*="table-responsive-"]`)?[e]:[],...e.querySelectorAll(Vg)]:[];function Jg(){Gg||typeof MutationObserver>`u`||(Gg=new MutationObserver(e=>{for(let t of e){for(let e of t.removedNodes)for(let t of qg(e))Wg.get(t)?.(),Wg.delete(t);for(let e of t.addedNodes)for(let t of qg(e))Kg(t)}}),Gg.observe(document.documentElement,{childList:!0,subtree:!0}))}function Yg(e=document){for(let t of e.querySelectorAll(Vg))Kg(t);e===document&&Jg()}var Xg=31536e3,Zg=new WeakMap,Qg=e=>e>99?`99+`:String(e);function $g(e,t,n=document){n.cookie=`${e}=${t?`1`:`0`}; Path=/; Max-Age=${Xg}; SameSite=Lax`}var e_=e=>{let t=document.createElement(`template`);return t.innerHTML=e,t.content},t_=(e,t)=>{let n=document.createElement(`div`);return n.className=e,n.textContent=t,n};function n_(e,t){let n=e.querySelector(`.wui-bell-trigger`),r=e.querySelector(`.wui-bell-count`),i=e.querySelector(`[data-wui-bell-live]`),a=e.querySelector(`[data-wui-bell-list]`),o=e.querySelector(`.wui-bell-menu`),{src:s,readAction:c}=e.dataset,l=e.dataset.label||`Notifications`,u=e.dataset.emptyText||`You are all caught up.`,d=Number(e.dataset.pollSeconds??60),f=dn(),p=Number(e.dataset.unread)||0,m=(t,a=!0)=>{let o=Math.max(0,Number(t)||0),s=o!==p;p=o,e.dataset.unread=String(o),r&&(r.textContent=Qg(o),r.hidden=o===0),n?.setAttribute(`aria-label`,o===0?l:`${l}, ${Qg(o)} unread`),a&&s&&i&&(i.textContent=o===0?`No unread notifications`:`${Qg(o)} unread notifications`)},h=()=>o?.classList.contains(`show`)??!1,g=()=>{let e=t_(`wui-bell-state`,`Could not load notifications. `),t=document.createElement(`button`);t.type=`button`,t.className=`btn btn-link btn-sm`,t.dataset.wuiBellRetry=``,t.textContent=`Retry`,e.append(t),a.replaceChildren(e)},_=async t=>{t&&(a.setAttribute(`aria-busy`,`true`),a.querySelector(`.wui-bell-item`)||a.replaceChildren(t_(`wui-bell-state`,`Loading…`)));let n=await f.run(s);if(n.kind===`aborted`||n.kind===`stale`||n.kind===`session`)return;if(a.removeAttribute(`aria-busy`),!n.ok){t&&g();return}let r=e_(n.html),i=r.querySelector(`[data-wui-unread]`),o=i?Number(i.getAttribute(`data-wui-unread`)):p;m(o),(t||h())&&(r.querySelector(`.wui-bell-item`)?a.replaceChildren(r):a.replaceChildren(t_(`wui-bell-state`,u))),e.dispatchEvent(new CustomEvent(`wui:notifications:loaded`,{bubbles:!0,detail:{unread:o}}))};e.addEventListener(`show.bs.dropdown`,()=>_(!0)),e.addEventListener(`click`,async e=>{if(e.target.closest(`[data-wui-bell-retry]`)){_(!0);return}let t=e.target.closest(`[data-wui-bell-read]`);if(!t||!c)return;t.disabled=!0;let n=await P(c,{method:`POST`});t.disabled=!1,n.ok&&(m(0),_(!0))});let v=null,y=()=>{d>0&&v===null&&(v=setInterval(()=>_(h()),d*1e3))},b=()=>{v!==null&&clearInterval(v),v=null},x=()=>{document.hidden?b():(_(h()),y())};return d>0&&(document.addEventListener(`visibilitychange`,x),document.hidden||y()),t.push(()=>{b(),f.abort(),document.removeEventListener(`visibilitychange`,x)}),{setUnread:e=>m(e),refresh:()=>_(h())}}var r_=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName)),i_=(e,t,n)=>`${e}${e.includes(`?`)?`&`:`?`}${encodeURIComponent(t)}=${encodeURIComponent(n)}`;function a_(e,t){let n=e.querySelector(`input.search-input`),r=e.querySelector(`.wui-topsearch-results`),i=e.querySelector(`.wui-topsearch-open`),a=e.querySelector(`[data-wui-topsearch-live]`),{src:o,param:s=`q`,resultsHref:c}=e.dataset,l=Number(e.dataset.minChars??2),u=Number(e.dataset.debounceMs??250),d=dn(),f=null,p=-1,m=()=>[...r.querySelectorAll(`.wui-topsearch-hit`)],h=e=>{let t=m();p=t.length===0?-1:(e+t.length)%t.length,t.forEach((e,t)=>{let n=t===p;e.classList.toggle(`is-active`,n),e.setAttribute(`aria-selected`,n?`true`:`false`)}),p>=0?(n.setAttribute(`aria-activedescendant`,t[p].id),t[p].scrollIntoView?.({block:`nearest`})):n.removeAttribute(`aria-activedescendant`)},g=()=>{r.hidden=!0,n.setAttribute(`aria-expanded`,`false`),n.removeAttribute(`aria-activedescendant`),p=-1},_=()=>{r.hidden=!1,n.setAttribute(`aria-expanded`,`true`)},v=t=>{e.classList.toggle(`is-open`,t),i?.setAttribute(`aria-expanded`,t?`true`:`false`)},y=t=>{let n=new CustomEvent(`wui:search:select`,{bubbles:!0,cancelable:!0,detail:{href:t}});e.dispatchEvent(n)&&window.location.assign(t)},b=async t=>{e.classList.add(`is-loading`);let n=await d.run(i_(o,s,t));if(!(n.kind===`aborted`||n.kind===`stale`||n.kind===`session`)){if(e.classList.remove(`is-loading`),n.ok){let e=e_(n.html),t=e.querySelector(`[data-wui-count]`);r.replaceChildren(e),m().forEach((e,t)=>{e.id=`${r.id}-opt-${t}`});let i=t?Number(t.getAttribute(`data-wui-count`)):m().length;a&&(a.textContent=i===0?`No results`:`${i} ${i===1?`result`:`results`}`)}else r.replaceChildren(t_(`wui-topsearch-empty`,`Search is unavailable right now.`));p=-1,_()}};n.addEventListener(`input`,()=>{clearTimeout(f);let t=n.value.trim();if(t.length<l){d.abort(),e.classList.remove(`is-loading`),r.replaceChildren(),g();return}f=setTimeout(()=>b(t),u)}),n.addEventListener(`keydown`,t=>{if(t.key===`ArrowDown`||t.key===`ArrowUp`){if(r.hidden||m().length===0)return;t.preventDefault(),h(p+(t.key===`ArrowDown`?1:-1))}else if(t.key===`Enter`){let e=m();!r.hidden&&p>=0&&e[p]?(t.preventDefault(),y(e[p].getAttribute(`href`))):c&&n.value.trim()!==``&&(t.preventDefault(),y(i_(c,s,n.value.trim())))}else t.key===`Escape`&&(r.hidden?e.classList.contains(`is-open`)&&(t.preventDefault(),t.stopPropagation(),v(!1),i?.focus()):(t.preventDefault(),t.stopPropagation(),g()))}),r.addEventListener(`click`,e=>{let t=e.target.closest(`.wui-topsearch-hit`);!t||e.ctrlKey||e.metaKey||e.shiftKey||e.button===1||(e.preventDefault(),y(t.getAttribute(`href`)))}),i?.addEventListener(`click`,()=>{let t=!e.classList.contains(`is-open`);v(t),t&&n.focus()});let x=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||r_(e.target)||(e.preventDefault(),v(!0),n.focus())},S=t=>{e.contains(t.target)||(g(),e.classList.contains(`is-open`)&&v(!1))};document.addEventListener(`keydown`,x),document.addEventListener(`pointerdown`,S),t.push(()=>{clearTimeout(f),d.abort(),document.removeEventListener(`keydown`,x),document.removeEventListener(`pointerdown`,S)})}function o_(e){let t=[],n=e.dataset.wuiCollapsedCookie;n&&e.addEventListener(`wui:shell:collapse`,e=>$g(n,!!e.detail?.collapsed)),e.addEventListener(`click`,t=>{t.target.closest(`[data-wui-tabbar-more]`)&&e.querySelector(`[data-app-shell-menu]`)?.click()});let r=e.querySelector(`[data-wui-bell]`),i=r?n_(r,t):null,a=e.querySelector(`[data-wui-topsearch]`);a&&a_(a,t);let o={el:e,setUnread(e){if(!i)throw Error(`WUI.shell: this <app-shell> has no <app-shell-notifications>.`);i.setUnread(e)},refreshNotifications(){if(!i)throw Error(`WUI.shell: this <app-shell> has no <app-shell-notifications>.`);return i.refresh()},get collapsed(){return e.classList.contains(`collapsed`)},set collapsed(t){if(!!t===e.classList.contains(`collapsed`))return;let n=e.querySelector(`[data-app-shell-collapse]`);n?n.click():e.classList.toggle(`collapsed`,!!t)}};Zg.set(e,o);let s=n=>{if(n.target===e||n.target.contains?.(e)){for(let e of t)e();Zg.delete(e),delete e.dataset.wuiPartsWired,document.removeEventListener(`wui:teardown`,s)}};return document.addEventListener(`wui:teardown`,s),o}function s_(e=document){let t=[];e instanceof Element&&e.matches(`[data-app-shell]`)&&t.push(e),t.push(...e.querySelectorAll(`[data-app-shell]`));for(let e of t)e.dataset.wuiPartsWired||(e.dataset.wuiPartsWired=`1`,o_(e))}function c_(e){let t=e?.closest?.(`[data-app-shell]`)??null;return t?(Zg.has(t)||s_(t),Zg.get(t)??null):null}var l_=[`light`,`dark`,`auto`],u_=[`wave`,`circle`,`slide`,`blinds`,`fade`,`none`],d_=`wave`,f_=`theme`,p_={wave:1100,circle:700,slide:600,blinds:900,fade:350,none:0},m_=`wui-theme-switching`,h_=`wui:theme:change`,g_=`(prefers-color-scheme: dark)`,__=e=>typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(e).matches,v_=e=>l_.includes(e);function y_(e){return e===`dark`||e===`auto`&&__(g_)?`dark`:`light`}function b_(e=f_){let t=null;try{t=window.localStorage.getItem(e)}catch{}return v_(t)?t:`auto`}function x_(e,t=f_){try{window.localStorage.setItem(t,e)}catch{}}function S_(e){let t=document.documentElement,n=y_(e);t.setAttribute(`data-theme`,e),t.setAttribute(`data-bs-theme`,n),document.dispatchEvent(new CustomEvent(h_,{detail:{mode:n,preference:e}}))}var C_=`(function(k){var m;try{m=localStorage.getItem(k)}catch{}if(m!=='light'&&m!=='dark')m='auto';var r=document.documentElement,q=window.matchMedia?window.matchMedia('(prefers-color-scheme: dark)'):null;function s(){var t=r.getAttribute('data-theme');r.setAttribute('data-bs-theme',t==='auto'?(q&&q.matches?'dark':'light'):t)}r.setAttribute('data-theme',m);s();if(q&&q.addEventListener)q.addEventListener('change',function(){if(r.getAttribute('data-theme')==='auto')s()})})(`;function w_(e=f_){return`${C_}${JSON.stringify(String(e)).replace(/</g,`\\u003c`)})`}function T_(e,{includeAuto:t=!1}={}){return e===`light`?`dark`:e===`dark`&&t?`auto`:`light`}function E_(e){if(typeof window>`u`||typeof window.matchMedia!=`function`)return()=>{};let t=window.matchMedia(g_),n=()=>e(t.matches?`dark`:`light`);return t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)}var D_=60,O_=e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2,k_=e=>e.toFixed(1),A_=(e,t)=>`${k_(e)}px ${k_(t)}px`,j_={amplitude:22,segments:36,cycles:1.5,ripples:2},M_=6,N_=(e,t,n,r,i)=>{let{amplitude:a,segments:o,cycles:s}=j_,c=n*(t+2*a),l=i?t+a-c:c-a,u=i?t+2*a:-2*a,d=[A_(0,u)];for(let t=0;t<=o;t++){let n=e*t/o,i=l+a*Math.sin(2*Math.PI*s*t/o+r);d.push(A_(n,i))}return d.push(A_(e,u)),`polygon(${d.join(`, `)})`},P_=(e,t,n,r)=>{let i=t/M_,a=[];for(let t=0;t<M_;t++){let o=t*i,s=i*n,c=r?o+i-s:o,l=r?o+i:o+s;a.push(A_(0,c),A_(e,c),A_(e,l),A_(0,l))}return`polygon(${a.join(`, `)})`};function F_(e,{width:t,height:n,to:r=`dark`,origin:i}={}){let a=r===`dark`,o=[];for(let r=0;r<=D_;r++){let s=r/D_,c=O_(s);switch(e){case`circle`:{let e=i?.x??t/2,r=i?.y??n/2,a=Math.hypot(Math.max(e,t-e),Math.max(r,n-r));o.push({clipPath:`circle(${k_(a*c)}px at ${k_(e)}px ${k_(r)}px)`});break}case`slide`:{let e=n*(1-c);o.push({clipPath:a?`inset(${k_(e)}px 0px 0px 0px)`:`inset(0px 0px ${k_(e)}px 0px)`});break}case`blinds`:o.push({clipPath:P_(t,n,c,a)});break;case`fade`:o.push({clipPath:`none`,opacity:c});break;case`none`:return[];default:o.push({clipPath:N_(t,n,c,s*j_.ripples*2*Math.PI,a)})}}return o}function I_(e,{effect:t=d_,to:n,origin:r,duration:i}={}){let a=document.documentElement,o=n!==void 0&&a.getAttribute(`data-bs-theme`)===n;if(t===`none`||o||__(`(prefers-reduced-motion: reduce)`)||typeof document.startViewTransition!=`function`||typeof a.animate!=`function`)return e(),Promise.resolve(!1);a.classList.add(m_);let s=document.startViewTransition(e),c=i??p_[t]??p_.wave;return s.ready.then(()=>{let e=F_(t,{width:window.innerWidth,height:window.innerHeight,to:n,origin:r});a.animate(e,{duration:c,easing:`linear`,fill:`both`,pseudoElement:`::view-transition-new(root)`})}).catch(()=>{}),s.finished.catch(()=>{}).then(()=>(a.classList.remove(m_),!0))}function L_(){fe(),t(`wui-select`,Ha),t(`wui-country-select`,Ka),t(`wui-phone`,ql),t(`wui-datepicker`,co),t(`wui-date-range`,bo),t(`wui-dock`,xo),t(`wui-image-crop`,xs),t(`wui-kanban`,Qr),t(`wui-inline-edit`,Fs),t(`wui-consent-banner`,wa),t(`wui-slider`,Bu),t(`wui-sortable`,Zu),t(`wui-timepicker`,ld),t(`wui-tour`,zf),t(`wui-tree`,qf),t(`wui-autocomplete`,xi),t(`wui-command-palette`,ra),t(`wui-context-menu`,za),t(`wui-multiselect`,Oc),t(`wui-taginput`,ed),t(`wui-otp`,hl),t(`wui-status-icon`,ni),t(`wui-shortcuts`,Fu),t(`wui-record-pager`,eu),t(`wui-carousel`,Ti),t(`wui-code-block`,qi),t(`wui-data-table`,Qa),t(`wui-drawer`,Po),t(`wui-hover-card`,Vo),t(`wui-lightbox`,Ys),t(`wui-menubar`,xc),t(`wui-navigation-menu`,Vc),t(`wui-notification-center`,al),t(`wui-onboarding-checklist`,fl),t(`wui-overflow`,wl),t(`wui-rating`,$l),t(`wui-relative-time`,pu),t(`wui-resizable`,ju),t(`wui-rolling-number`,Pu),t(`wui-show-more`,zu),t(`wui-truncate`,Jf),t(`wui-whats-new`,ep),t(`wui-mention-input`,hc),t(`wui-comment-thread`,fa),t(`wui-wizard-step`,op),t(`wui-wizard`,rp)}return L_(),e.AVATAR_ACCEPT=sp,e.AVATAR_MAX_SIZE_MB=cp,e.AVATAR_OUTPUT_SIZE=lp,e.AVATAR_OUTPUT_TYPE=up,e.AVATAR_PREVIEW_SIZES=dp,e.AVATAR_TEXT=fp,e.BAR_BULK_IN_BAR_ATTRIBUTE=ig,e.COLUMN_MAX_WIDTH=He,e.COLUMN_MIN_WIDTH=Ve,e.COMMENT_INTENTS=aa,e.COMMENT_REACTIONS=ia,e.COMMENT_TEXT=U,e.CONFIRM_DIALOG_ID=Op,e.CONFIRM_TONES=kp,e.COPY_FEEDBACK_MS=Gi,e.CSRF_META_NAME=en,e.CURRENCIES=me,e.DATA_TABLE_TEXT=A,e.DATE_PATTERNS=ge,e.DEFAULT_CSRF_HEADER=tn,e.DEFAULT_IMAGE_ACCEPT=fh,e.DEFAULT_MAX_SIZE_MB=ph,e.DEFAULT_PASSWORD_RULES=ug,e.DEFAULT_REQUIREMENTS_TITLE=dg,e.DEFAULT_THEME_EFFECT=d_,e.DEFAULT_THEME_STORAGE_KEY=f_,e.DISCARD_EVENT=Pm,e.DISCARD_TEXT=Nm,e.DROP_OVER_CLASS=_g,e.DURATION_UNITS=O,e.EMPTY_VALUE=ve,e.FILTER_POPOVER_MAX_CHIPS=ne,e.FLASH_STORAGE_KEY=jp,e.FLASH_VARIANTS=Ap,e.FORMAT_STYLES=pe,e.HTTP_KINDS=rn,e.INLINE_EDIT_SAVED_MS=Cs,e.INLINE_EDIT_TEXT=ws,e.INLINE_EDIT_TYPES=Ss,e.IST_TIME_ZONE=_e,e.KANBAN_DRAG_THRESHOLD_PX=Sr,e.KANBAN_LONG_PRESS_MS=xr,e.KANBAN_PHONE_QUERY=br,e.KANBAN_STORAGE_PREFIX=yr,e.KANBAN_SUMMARY_FORMATS=vr,e.KANBAN_TEXT=I,e.KANBAN_TONES=_r,e.LIST_KEYS=m,e.MASK_INPUT_TYPES=Dh,e.MASK_NAMES=Fh,e.MENTION_ID_PATTERN=Xs,e.MENTION_MAX_QUERY=oc,e.MENTION_MAX_RESULTS=ac,e.MENTION_TEXT=sc,e.MONEY_UNITS=he,e.NOTIFICATION_COUNT_CAP=Hc,e.NOTIFICATION_TEXT=Wc,e.PIN_AT_VAR=nt,e.PIN_SIDES=Ge,e.RESIZE_STEP=Ue,e.RESIZE_STEP_LARGE=We,e.ROW_DRAG_TYPE=vg,e.ROW_DROP_EVENT=gg,e.ROW_HEIGHTS=qe,e.ROW_MOVE_LIMIT=ot,e.ROW_MOVE_MS=st,e.ROW_SAVE_ATTR=ht,e.ROW_SAVE_ERROR_CLASS=gt,e.ROW_SAVE_STATES=mt,e.SCROLL_EDGE_SELECTOR=Vg,e.SEARCH_OPEN_KEY=gp,e.SELECT_ALL_LABEL=Ct,e.SELECT_CELL_CLASS=M,e.SELECT_KEY=h,e.SELECT_ROW_LABEL=wt,e.SERVER_ACTION_TEXT=Mp,e.SHORTCUTS_OFF_ATTRIBUTE=u,e.SHORTCUT_EVENT=f,e.SHORTCUT_SCOPE_ATTRIBUTE=d,e.SHORTCUT_TEXT=p,e.STATUS_TONES=ti,e.THEME_BOOT_SCRIPT_BODY=C_,e.THEME_CHANGE_EVENT=h_,e.THEME_EFFECTS=u_,e.THEME_EFFECT_DURATION=p_,e.THEME_MODES=l_,e.THEME_SWITCHING_CLASS=m_,e.TOAST_ACTION_METHODS=Jt,e.TOAST_ACTION_MS=qt,e.UNSAVED_TEXT=cm,e.VIRTUAL_OVERSCAN=Ke,e.WHATS_NEW_READ_EVENT=Yf,e.WUI_HEADERS=N,e.WuiAutocomplete=xi,e.WuiCarousel=Ti,e.WuiCodeBlock=qi,e.WuiCommandPalette=ra,e.WuiCommentThread=fa,e.WuiConsentBanner=wa,e.WuiContextMenu=za,e.WuiCountrySelect=Ka,e.WuiDataTable=Qa,e.WuiDatePicker=co,e.WuiDateRange=bo,e.WuiDock=xo,e.WuiDrawer=Po,e.WuiHoverCard=Vo,e.WuiImageCrop=xs,e.WuiInlineEdit=Fs,e.WuiKanban=Qr,e.WuiLightbox=Ys,e.WuiMentionInput=hc,e.WuiMenubar=xc,e.WuiMultiSelect=Oc,e.WuiNavigationMenu=Vc,e.WuiNotificationCenter=al,e.WuiOnboardingChecklist=fl,e.WuiOtp=hl,e.WuiOverflow=wl,e.WuiPhone=ql,e.WuiRating=$l,e.WuiRecordPager=eu,e.WuiRelativeTime=pu,e.WuiResizable=ju,e.WuiRollingNumber=Pu,e.WuiSelect=Ha,e.WuiShortcuts=Fu,e.WuiShowMore=zu,e.WuiSlider=Bu,e.WuiSortable=Zu,e.WuiStatusIcon=ni,e.WuiTagInput=ed,e.WuiTimePicker=ld,e.WuiTour=zf,e.WuiTree=qf,e.WuiTruncate=Jf,e.WuiWhatsNew=ep,e.WuiWizard=rp,e.WuiWizardStep=op,e.acceptLabel=xh,e.addRowSelectCells=jt,e.addSelectColumn=Mt,e.applyBarBulk=cg,e.applyTheme=S_,e.ariaKeyShortcuts=te,e.attachInputMask=Xh,e.attachRowDrag=Rg,e.attachScrollEdges=Ug,e.attachShiftRange=Ft,e.avatarCropOptions=hp,e.avatarUnreadableMessage=mp,e.barBulkCountText=sg,e.buildPasswordRules=pg,e.clampColumnWidth=Ye,e.classifyStatus=cn,e.collapseSearch=wp,e.confirmAction=Gp,e.copyTextToClipboard=Ki,e.createDiscardPrompt=Wm,e.createLocalSeenStore=Nf,e.createRequestQueue=dn,e.createSelectHeaderCell=Et,e.createSelectRowCell=Dt,e.createSelectSpacerCell=Ot,e.defineWeborityElements=L_,e.evaluatePassword=mg,e.formValues=_m,e.formatCompact=Pe,e.formatCurrency=Me,e.formatDate=ze,e.formatDuration=Ie,e.formatMasked=Uh,e.formatNumber=k,e.formatPercent=Fe,e.formatRelativeTime=au,e.formatValue=Be,e.getServerTable=Gt,e.getShell=c_,e.glyphSvg=j,e.groupCount=Je,e.groupItems=Xe,e.groupNotificationsByDay=Xc,e.identityCell=_t,e.inShortcutScope=T,e.initCollapsibleSearch=Dp,e.initDrawerDiscard=dh,e.initInputMasks=rg,e.initPageBarBulk=lg,e.initRemoteModals=mr,e.initRowDrag=Bg,e.initScrollEdges=Yg,e.initServerActions=sm,e.initServerTables=Wt,e.initShellParts=s_,e.initUnsavedChanges=jm,e.inlineEditText=Ts,e.isHeicFile=pp,e.isImageFile=vh,e.isImageOnlyAccept=bh,e.isMaskPattern=Lh,e.isPdfFile=yh,e.isTypingTarget=C,e.kanbanCardLabel=R,e.kanbanOverflow=Gr,e.kanbanStorageKey=Kr,e.kanbanSummaryFormat=Yr,e.kanbanVisibleLimit=Wr,e.loadRemoteDrawer=gr,e.loadRemoteModal=hr,e.maskedPostValue=Kh,e.matchSegments=Ji,e.matchesAccept=Sh,e.measureRows=dt,e.mentionLabel=$s,e.mentionTextFromValue=nc,e.mentionValueFromText=rc,e.mentionedIds=ic,e.moveFocus=D,e.nextTheme=T_,e.notificationCountText=Gc,e.notificationDayHeading=Yc,e.notificationTime=Jc,e.notificationTriggerLabel=Kc,e.notificationUnreadAnnouncement=qc,e.openSearch=Cp,e.parseMentionValue=tc,e.parseToastAction=Zt,e.passwordSatisfies=hg,e.pinAtValue=rt,e.pinClasses=at,e.pinOffsetVar=tt,e.planPins=it,e.playRowMoves=ft,e.postedMasked=Hh,e.rawMasked=Vh,e.readColumnWidths=$e,e.readCsrf=on,e.readKanbanCollapsed=qr,e.readStoredTheme=b_,e.relativeTimeTitle=ou,e.resetUnsavedChanges=Mm,e.resolveMask=zh,e.resolveTheme=y_,e.rowLabel=vt,e.rowOrderChanged=pt,e.runShortcut=E,e.runToastAction=$t,e.saveOutcomeText=xt,e.setRowSaveState=yt,e.settledRows=bt,e.shortcutKey=ee,e.shortcutName=S,e.shortcutsOff=w,e.showResultToast=Qt,e.storeTheme=x_,e.sumKanbanValues=Xr,e.syncSelectAll=Nt,e.syncTargets=zg,e.themeBootScript=w_,e.themeKeyframes=F_,e.tickedKeys=kg,e.toInstant=Le,e.transitionTheme=I_,e.validateFile=Ch,e.virtualRange=Ze,e.watchSystemTheme=E_,e.withTrustedLabel=pi,e.writeColumnWidths=et,e.writeKanbanCollapsed=Jr,e.wuiFetch=P,e})({});
933
+ <div class="visually-hidden" role="status" aria-live="polite"></div>`;let n=t;this._shadow=null,this.isolated&&(n=document.createElement(Df),this._shadow=n.attachShadow({mode:`open`}),Bf(this._shadow),this._shadow.appendChild(t)),document.body.appendChild(n),document.documentElement.setAttribute(ha,``),this._outer=n,this._layer=t,this._spot=t.querySelector(`.wui-tour-spot`),this._card=t.querySelector(`.wui-tour-card`),this._live=t.querySelector(`[role=status]`),this._card.querySelector(`.wui-tour-skip`).addEventListener(`click`,()=>this._close(`skipped`,`button`)),this._card.querySelector(`.wui-tour-back`).addEventListener(`click`,()=>this._move(-1)),this._card.querySelector(`.wui-tour-next`).addEventListener(`click`,()=>this._move(1)),this._shadow&&this._card.removeAttribute(`aria-modal`),this._onKey=e=>this._key(e),this._onFocusIn=e=>{if(!this._layer||this._ending)return;let t=this._current,n=t?this._steps[t.index]:null;Td(this._layer,n,t?.target??null,e.target)||this._card.focus()},document.addEventListener(`keydown`,this._onKey,!0),this._shadow||document.addEventListener(`focusin`,this._onFocusIn),s(n,()=>this._follow())}_active(){return this._shadow?this._shadow.activeElement:document.activeElement}_show(e){this._current=e;let{index:t,target:n}=e,r=this._steps[t],i=this._card,a=this._progress.position(t),o=this._progress.total(),s=a===o&&!this._endDialogText(),c=wf(this,a,o);Tf(i,{text:c,position:a,total:o}),xf(i,r,{pause:this._label(`mediaPause`),play:this._label(`mediaPlay`)});let l=Cd(this,{layer:this._layer,spot:this._spot,card:i},r,n),u=i.querySelector(`.wui-tour-title`);u.textContent=r.title||``,u.hidden=!r.title,i.querySelector(`.wui-tour-text`).textContent=r.description||``,i.querySelector(`.wui-tour-skip`).textContent=this._label(`skip`),i.querySelector(`.wui-tour-back`).textContent=this._label(`back`),i.querySelector(`.wui-tour-back`).hidden=t<=this._firstIndex,i.querySelector(`.wui-tour-next`).textContent=this._label(s?`done`:`next`);let d=[c,r.title,r.description].filter(Boolean).join(`. `);this._live.textContent=l?[d,l].join(/[.!?]$/.test(d)?` `:`. `):d,Xd(i,n),this._spot.removeAttribute(kf),this._place(),Ld(i),this._unbindAdvance?.(),this._unbindAdvance=wd(r,n,()=>this._move(1));let f=this._active();(i.contains(f)?!f.hidden:this._shadow!==null&&Lf(Rf()))||i.focus(),this.dispatchEvent(new CustomEvent(`wui-tour:step`,{bubbles:!0,detail:{step:r,index:t,position:a,total:o}}))}_place(){!this._current||!this._layer||Zd(this._spot,this._card,this._current.target)}_follow(){if(!this._current||!this._layer||this._ending)return;let e=this._spot.style.cssText;this._place(),this._spot.style.cssText!==e&&this._spot.setAttribute(kf,``)}async _move(e){this._current&&await this._go(this._current.index+e,e)}async _go(e,t){if(!this._current||this._moving)return;this._moving=!0;let n=this._run;try{let r=await this._locate(e,t,n);if(n!==this._run)return;if(r){let e=Rd(this._card);if(e&&await e,n!==this._run)return;this._show(r)}else if(t>0){let e=this._endDialogText();if(e&&await this._showEnd(e),n!==this._run)return;await this._close(`finished`)}}finally{this._moving=!1}}_showEnd(e){return this._unbindAdvance?.(),this._unbindAdvance=null,Cd(this,{layer:this._layer,spot:this._spot,card:this._card},null,null),this._spot.removeAttribute(kf),this._ending=new AbortController,this._seenMark=this._markSeen(`finished`),sf(this._layer,e,this._ending.signal)}_key(e){if(!(!this._layer||this._ending||e.altKey||e.ctrlKey||e.metaKey)){if(e.key===`Escape`)e.preventDefault(),e.stopPropagation(),this._close(`skipped`,`escape`);else if(e.key===`ArrowRight`||e.key===`ArrowLeft`){if(Lf(e.composedPath?.()[0]??e.target))return;e.preventDefault(),e.key===`ArrowRight`?this._move(1):this._current.index>this._firstIndex&&this._move(-1)}else if(e.key===`Tab`&&!this._shadow){let{index:t,target:n}=this._current;Ed(e,{card:this._card,active:this._active(),step:this._steps[t],target:n})}}}_teardown(){if(!this._layer)return;document.removeEventListener(`keydown`,this._onKey,!0),document.removeEventListener(`focusin`,this._onFocusIn);let e=!this._shadow||this._shadow.activeElement!==null||!document.activeElement||document.activeElement===document.body;this._unbindAdvance?.(),this._unbindAdvance=null,this._ending?.abort(),this._ending=null,this._seenMark=null,c(this._outer),zd(this._outer),document.documentElement.removeAttribute(ha),this._outer=null,this._shadow=null,this._layer=null,this._current=null;let t=this._returnFocus;this._returnFocus=null,e&&t?.isConnected&&t.focus?.()}async _close(e,t=null){let n=this._run,r=this._current,i=r?{index:r.index,position:this._progress.position(r.index),total:this._progress.total()}:Nf,a=this._seenMark;this._teardown();try{n===this._run&&await(a??this._markSeen(e))}finally{this._finish(e,i,t)}}_finish(e,t=Nf,n=null){this._run++,this._running=!1,this.hasAttribute(`open`)&&this.removeAttribute(`open`),this.dispatchEvent(new CustomEvent(`wui-tour:close`,{bubbles:!0,detail:{reason:e,...t,via:n}}))}},Hf=[`none`,`single`,`multiple`],Uf=`parentId`,Wf=`Loading`,Gf=`Could not load. Try again.`,Kf=`:scope > input[data-wui-mirror]`,qf=[`nodes`,`selection`,`selected`,`values`,`loadChildren`,`loadUrl`,`name`],Jf=0;function $(e,t,n){let r=document.createElement(e);t&&(r.className=t);for(let[e,t]of Object.entries(n??{}))t!=null&&r.setAttribute(e,String(t));return r}var Yf=class extends l{static get observedAttributes(){return[`selection`,`selected`,`name`,`aria-label`,`loading-text`,`error-text`]}constructor(){super(),this._uid=`wui-tree-${++Jf}`,this._seq=0,this._roots=[],this._byId=new Map,this._prev=null,this._staged=null,this._els=new Map,this._checked=new Set,this._selected=null,this._focusId=null,this._loader=null,this._list=null,this._live=null,this._ready=!1,this._nav=ui({getVisibleOptions:()=>this._visible().map(e=>this._els.get(e.id)?.row),getActive:()=>this._visible().findIndex(e=>e.id===this._focusId),setActive:e=>this._focusNode(this._visible()[e]),onEnter:()=>{let e=this._byId.get(this._focusId);e&&this._activate(e)}}),this._onKeyDown=e=>this._handleKeyDown(e),this._onClick=e=>this._handleClick(e),this._onFocusIn=e=>{let t=this._nodeFrom(e.target);t&&t.id!==this._focusId&&this._setRoving(t)}}connectedCallback(){let e={};for(let t of qf)Object.hasOwn(this,t)&&(e[t]=this[t],delete this[t]);if(!this._ready){this._ready=!0;let e=this._readScript();this.replaceChildren(),this._list=$(`ul`,`wui-tree`),this._list.setAttribute(`role`,`tree`),this._live=$(`div`,`visually-hidden`,{role:`status`,"aria-live":`polite`}),this.append(this._list,this._live),e&&this._adoptAll(e)}for(let[t,n]of Object.entries(e))this[t]=n;this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`click`,this._onClick),this.addEventListener(`focusin`,this._onFocusIn),this._render(),this._loadOpenNodes()}disconnectedCallback(){this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`focusin`,this._onFocusIn),this._nav.teardown()}attributeChangedCallback(e,t,n){e===`selected`&&(this._selected=n),this._ready&&this.isConnected&&this._render()}get nodes(){return this._roots.map(e=>e.raw)}set nodes(e){this._adoptAll(e??[]),this._render(),this._loadOpenNodes()}get selection(){let e=this.getAttribute(`selection`);return Hf.includes(e)?e:`none`}set selection(e){this.setAttribute(`selection`,String(e))}get selected(){return this._selected}set selected(e){this._selected=e==null?null:String(e),this._render()}get values(){let e=[],t=n=>{for(let r of n)this._state(r)===`checked`&&e.push(r.id),r.children&&t(r.children)};return t(this._roots),[...e,...[...this._checked].filter(e=>!this._byId.has(e))]}set values(e){this._checked.clear();for(let t of e??[]){let e=this._byId.get(String(t));e?this._setChecked(e,!0):this._checked.add(String(t))}this._render()}get loadChildren(){return this._loader}set loadChildren(e){this._loader=typeof e==`function`?e:null}get loadUrl(){return this.getAttribute(`load-url`)}set loadUrl(e){e==null?this.removeAttribute(`load-url`):this.setAttribute(`load-url`,String(e))}get name(){return this.getAttribute(`name`)}set name(e){e==null?this.removeAttribute(`name`):this.setAttribute(`name`,String(e))}get loadingText(){return this.getAttribute(`loading-text`)??Wf}set loadingText(e){this.setAttribute(`loading-text`,String(e??``))}get errorText(){return this.getAttribute(`error-text`)??Gf}set errorText(e){this.setAttribute(`error-text`,String(e??``))}_readScript(){let e=this.querySelector(`:scope > script[type='application/json']`);if(!e)return null;try{return JSON.parse(e.textContent)}catch(e){return console.error(`[@webority/ui-elements] <wui-tree> could not read its JSON nodes:`,e?.message),null}}_adoptAll(e){let t=this._byId;this._prev=t,this._byId=new Map;let n;try{n=this._adoptStaged(e,null,1)}catch(e){throw this._byId=t,e}finally{this._prev=null}this._roots=n;for(let e of t.keys())this._byId.has(e)||this._checked.delete(e);for(let e of this._roots)this._passChecksDown(e);this._focusId&&!this._byId.has(this._focusId)&&(this._focusId=null)}_adoptStaged(e,t,n){let r=[],i=[];this._staged={ids:r,checks:i};try{let r=this._adopt(e,t,n);for(let e of i)this._checked.add(e);return r}catch(e){for(let e of r)this._byId.delete(e);throw e}finally{this._staged=null}}_adopt(e,t,n){if(!Array.isArray(e))throw Error(`<wui-tree> nodes must be an array.`);return e.map(e=>{let r=e?.id==null?``:String(e.id);if(!r)throw Error(`<wui-tree> every node needs an id.`);if(this._byId.has(r))throw Error(`<wui-tree> node id "${r}" is used twice.`);let i=this._prev?.get(r),a={id:r,raw:e,parent:t,level:n,seq:++this._seq,label:e.label==null?r:String(e.label),icon:e.icon||null,badge:e.badge==null||e.badge===``?null:String(e.badge),badgeTone:e.badgeTone||null,disabled:!!e.disabled,hasChildren:!!e.hasChildren,children:null,expanded:i?i.expanded:!!e.expanded,loading:!1,failed:!1};this._byId.set(r,a),this._staged.ids.push(r);let o=e.children??(e.hasChildren?i?.children?.map(e=>e.raw):void 0);return Array.isArray(o)&&(a.children=this._adopt(o,a,n+1)),a.loading=!!i?.loading&&a.children===null&&a.hasChildren,e.checked&&!i&&this._staged.checks.push(r),a})}_passChecksDown(e){e.children?.length&&this._checked.has(e.id)&&(this._checked.delete(e.id),this._setChecked(e,!0));for(let t of e.children??[])this._passChecksDown(t)}_loadOpenNodes(){queueMicrotask(()=>{if(this.isConnected)for(let e of[...this._byId.values()])e.expanded&&e.children===null&&e.hasChildren&&!e.loading&&this._load(e)})}_isBranch(e){return e.children?e.children.length>0:e.hasChildren}_visible(){let e=[],t=n=>{for(let r of n)e.push(r),r.expanded&&r.children&&t(r.children)};return t(this._roots),e}_state(e){if(e.children?.length){let t=0,n=0;for(let r of e.children){let e=this._state(r);e===`checked`?t++:e===`unchecked`&&n++}return t===e.children.length?`checked`:n===e.children.length?`unchecked`:`mixed`}return this._checked.has(e.id)?`checked`:`unchecked`}_setChecked(e,t){if(e.children?.length)for(let n of e.children)n.disabled||this._setChecked(n,t);else t?this._checked.add(e.id):this._checked.delete(e.id)}_nodeFrom(e){let t=e?.closest?.(`li.wui-tree-item`);if(!t)return null;for(let[e,n]of this._els)if(n.li===t)return this._byId.get(e)??null;return null}_emit(e,t){this.dispatchEvent(new CustomEvent(`wui-tree:${e}`,{detail:t,bubbles:!0,composed:!0}))}_announce(e){this._live&&(this._live.textContent=e)}_setRoving(e){let t=this._els.get(this._focusId);t&&(t.li.tabIndex=-1),this._focusId=e.id;let n=this._els.get(e.id);n&&(n.li.tabIndex=0)}_focusNode(e){e&&(this._setRoving(e),this._els.get(e.id)?.li.focus())}_activate(e){e.disabled||(this.selection===`single`&&(this._selected=e.id,this._render(),this._syncForm()),this._emit(`select`,{id:e.id,node:e.raw}))}_enabledLeaves(e){return e.disabled?[]:e.children?.length?e.children.flatMap(e=>this._enabledLeaves(e)):[e]}_toggleCheck(e){let t=this._enabledLeaves(e);if(!t.length)return;let n=!t.every(e=>this._checked.has(e.id));this._setChecked(e,n),this._render(),this._syncForm(),this._emit(`check`,{id:e.id,checked:n,values:this.values})}_toggleExpand(e){e.disabled||!this._isBranch(e)||(e.expanded?(e.expanded=!1,this._render()):this._expand(e))}_expand(e){e.expanded=!0,e.children===null?this._load(e):this._render()}async _load(e){if(e.loading)return;e.loading=!0,e.failed=!1,this._announce(this.loadingText),this._render();let t,n=null;try{t=await this._fetchChildren(e)}catch(e){n=e}let r=this._byId.get(e.id);if(!r){this._announce(``);return}if(r.loading){if(r.loading=!1,!n)try{r.children=this._adoptStaged(t,r,r.level+1),this._passChecksDown(r),this._announce(``)}catch(e){n=e}n&&(r.failed=!0,r.expanded=!1,this._announce(this.errorText),this._emit(`error`,{id:r.id,message:n?.message??String(n)})),this._render(),this._syncForm()}}async _fetchChildren(e){if(this._loader)return this._loader(e.raw);let t=this.getAttribute(`load-url`);if(!t)throw Error(`<wui-tree> has a node with children to load but no loadChildren or load-url.`);let n=new URL(t,window.location.href);n.searchParams.set(Uf,e.id);let r=await P(n.href,{headers:{Accept:`application/json`}});if(!r.ok)throw Error(`Loading children answered ${r.kind}.`);return JSON.parse(r.html)}_handleClick(e){let t=this._nodeFrom(e.target);!t||t.disabled||(this._focusNode(t),e.target.closest(`.wui-tree-toggle`)?this._toggleExpand(t):e.target.closest(`.wui-tree-check`)?(e.preventDefault(),this._toggleCheck(t)):this._activate(t))}_handleKeyDown(e){if(e.ctrlKey||e.metaKey||e.altKey)return;let t=this._nodeFrom(e.target);if(!(!t||e.target!==this._els.get(t.id)?.li))if(e.key===`ArrowRight`){if(e.preventDefault(),!this._isBranch(t)||t.disabled)return;t.expanded?t.children?.length&&this._focusNode(t.children[0]):this._expand(t)}else e.key===`ArrowLeft`?(e.preventDefault(),t.expanded&&this._isBranch(t)&&!t.disabled?this._toggleExpand(t):t.parent&&this._focusNode(t.parent)):e.key===` `?(e.preventDefault(),this.selection===`multiple`?this._toggleCheck(t):this.selection===`single`&&this._activate(t)):this._nav.handler(e)}_syncForm(){let e=this.selection;if(e===`multiple`)B(this,this.values);else if(e===`single`)z(this,this._selected??``);else for(let e of this.querySelectorAll(Kf))e.remove()}_render(){if(!this._list)return;let e=document.activeElement,t=!!e&&this._list.contains(e),n=this._visible();n.some(e=>e.id===this._focusId)||(this._focusId=(n.find(e=>e.id===this._selected)??n[0])?.id??null),this._els=new Map;let r=this.getAttribute(`aria-label`);r?this._list.setAttribute(`aria-label`,r):this._list.removeAttribute(`aria-label`),this._list.replaceChildren(...this._buildLevel(this._roots)),t&&this._focusId&&this._els.get(this._focusId)?.li.focus(),this._syncForm()}_buildLevel(e){return e.map((t,n)=>this._buildItem(t,n+1,e.length))}_buildItem(e,t,n){let r=this.selection,i=this._isBranch(e),a=this._state(e),o=$(`li`,`wui-tree-item`,{role:`treeitem`,tabindex:e.id===this._focusId?0:-1,"aria-level":e.level,"aria-setsize":n,"aria-posinset":t,"aria-labelledby":`${this._uid}-${e.seq}`,"aria-describedby":e.badge?`${this._uid}-${e.seq}-badge`:null});i&&o.setAttribute(`aria-expanded`,String(e.expanded)),e.disabled&&o.setAttribute(`aria-disabled`,`true`),e.loading&&o.setAttribute(`aria-busy`,`true`),r===`single`&&o.setAttribute(`aria-selected`,String(e.id===this._selected)),r===`multiple`&&o.setAttribute(`aria-checked`,a===`mixed`?`mixed`:String(a===`checked`));let s=$(`div`,`wui-tree-row`,{role:`presentation`});s.style.setProperty(`--wui-tree-level`,String(e.level-1)),r===`single`&&e.id===this._selected&&s.classList.add(`wui-tree-row-selected`),e.failed&&s.classList.add(`wui-tree-row-error`);let c=$(`span`,i?`wui-tree-toggle`:`wui-tree-toggle wui-tree-toggle-leaf`,{"aria-hidden":`true`});if(i&&(c.innerHTML=j(`chevron-right`,{size:16})),s.append(c),r===`multiple`){let t=$(`input`,`form-check-input wui-tree-check`,{type:`checkbox`,tabindex:-1,"aria-hidden":`true`});t.checked=a===`checked`,t.indeterminate=a===`mixed`,t.disabled=e.disabled,t.addEventListener(`mousedown`,e=>e.preventDefault()),s.append(t)}if(e.icon){let t=$(`span`,`wui-tree-icon`,{"aria-hidden":`true`});t.innerHTML=j(e.icon,{size:16}),s.append(t)}let l=$(`span`,`wui-tree-label`,{id:`${this._uid}-${e.seq}`});if(l.textContent=e.label,s.append(l),e.badge){let t=$(`span`,`badge wui-tree-badge${e.badgeTone&&e.badgeTone!==`neutral`?` badge-${e.badgeTone}`:``}`,{id:`${this._uid}-${e.seq}-badge`});t.textContent=e.badge,s.append(t)}if(e.loading&&s.append($(`span`,`wui-tree-spinner`,{"aria-hidden":`true`})),o.append(s),e.expanded&&e.children?.length){let t=$(`ul`,`wui-tree-group`,{role:`group`});t.append(...this._buildLevel(e.children)),o.append(t)}return this._els.set(e.id,{li:o,row:s}),o}},Xf=class extends l{constructor(){super(),this._measure=()=>this.measure(),this._resize=null,this._mutation=null,this._ownTabindex=!1}connectedCallback(){this.measure(),this.addEventListener(`mouseover`,this._measure),typeof ResizeObserver<`u`&&(this._resize=new ResizeObserver(this._measure),this._resize.observe(this)),this._mutation=new MutationObserver(this._measure),this._mutation.observe(this,{childList:!0,subtree:!0,characterData:!0})}disconnectedCallback(){this.removeEventListener(`mouseover`,this._measure),this._resize?.disconnect(),this._mutation?.disconnect(),this._resize=null,this._mutation=null}measure(){let e=this.querySelector(`.wui-truncate-text`);if(e){if(e.scrollWidth>e.clientWidth||e.scrollHeight>e.clientHeight){this.setAttribute(`data-wui-tip`,e.textContent.replace(/\s+/g,` `).trim()),this.hasAttribute(`tabindex`)||(this.setAttribute(`tabindex`,`0`),this._ownTabindex=!0);return}this.removeAttribute(`data-wui-tip`),this._ownTabindex&&=(this.removeAttribute(`tabindex`),!1)}}},Zf=`wui-whats-new-read`,Qf=`wui-whats-new:`,$f=`data-open`,ep=`data-wui-unread`,tp=0,np=class extends l{static get observedAttributes(){return[`storage-key`]}constructor(){super(),this._doc=null,this._seen=``,this._observer=null,this._onTriggerClick=()=>this.isOpen?this.close(!0):this.open(),this._onKeyDown=e=>{e.key===`Escape`&&this.isOpen&&(e.stopPropagation(),this.close(!0))},this._onPointerDown=e=>{this.isOpen&&!this.contains(e.target)&&this.close(!1)}}get isOpen(){return this.hasAttribute($f)}get _trigger(){return this.querySelector(`.wui-whats-new-trigger`)}get _panel(){return this.querySelector(`.wui-whats-new-panel`)}connectedCallback(){this._doc=this.ownerDocument;let e=this._panel,t=this._trigger;!e||!t||(e.id||=`wui-whats-new-${++tp}`,t.setAttribute(`aria-controls`,e.id),t.setAttribute(`aria-expanded`,`false`),t.addEventListener(`click`,this._onTriggerClick),this.addEventListener(`keydown`,this._onKeyDown),this._seen=this._load(),this._refresh(),typeof MutationObserver<`u`&&(this._observer=new MutationObserver(()=>this._refresh()),this._observer.observe(e,{childList:!0,subtree:!0})))}disconnectedCallback(){this._observer?.disconnect(),this._observer=null,this._trigger?.removeEventListener(`click`,this._onTriggerClick),this.removeEventListener(`keydown`,this._onKeyDown),this._doc?.removeEventListener(`pointerdown`,this._onPointerDown,!0),c(this),this.removeAttribute($f),this._doc=null}attributeChangedCallback(e,t,n){t===n||!this._doc||(this._seen=this._load(),this._refresh())}open(){let e=this._panel;!e||this.isOpen||(this.setAttribute($f,``),this._trigger?.setAttribute(`aria-expanded`,`true`),this._place(),s(this,()=>this._place()),this._doc.addEventListener(`pointerdown`,this._onPointerDown,!0),e.focus({preventScroll:!0}),this._markRead())}close(e){this.isOpen&&(this.removeAttribute($f),this._trigger?.setAttribute(`aria-expanded`,`false`),this._doc.removeEventListener(`pointerdown`,this._onPointerDown,!0),c(this),this._refresh(),e&&this._trigger?.focus())}_place(){o(this._trigger,this._panel,{clampHeight:!0})}_entries(){return[...this.querySelectorAll(`.wui-whats-new-entry`)].map(e=>({entry:e,date:e.querySelector(`time[datetime]`)?.getAttribute(`datetime`)??``}))}_newest(){return this._entries().reduce((e,{date:t})=>t>e?t:e,``)}_refresh(){let e=this._entries(),t=0;for(let{entry:n,date:r}of e){let e=r>this._seen;e&&t++,!(this.isOpen&&n.hasAttribute(ep))&&n.toggleAttribute(ep,e)}this.toggleAttribute(ep,t>0)}_markRead(){let e=this._newest();!e||e<=this._seen||(this._seen=e,this._save(e),this.toggleAttribute(ep,!1),this.dispatchEvent(new CustomEvent(Zf,{bubbles:!0,detail:{through:e}})))}_storage(){let e=this.getAttribute(`storage-key`);if(!e)return null;try{return{store:this.ownerDocument.defaultView.localStorage,key:Qf+e}}catch{return null}}_load(){let e=this._storage();return e?e.store.getItem(e.key)??``:this._seen}_save(e){let t=this._storage();t&&t.store.setItem(t.key,e)}},rp=`wui-wizard-step`,ip=`:scope > [data-wui-glyphs]`,ap=class extends l{static get observedAttributes(){return[`active`,`variant`,`orientation`,`icon-size`,`non-linear`,`hide-stepper`,`hide-connectors`,`disabled`,`skippable`,`label`,`back-label`,`next-label`,`skip-label`,`finish-label`]}constructor(){super(),this._active=0,this._skipped=new Set,this._invalid=new Set,this._finished=!1,this._rendered=!1,this._reflecting=!1,this._beforeNext=null,this._header=null,this._footer=null,this._known=[],this._observer=null,this._glyphs=null,this._glyphObserver=null}get active(){return this._active}set active(e){let t=Number.parseInt(e,10);Number.isFinite(t)&&this._go(t,`set`)}get beforeNext(){return this._beforeNext}set beforeNext(e){this._beforeNext=typeof e==`function`?e:null}get _steps(){return[...this.querySelectorAll(`:scope > ${rp}`)]}refresh(){this._rendered&&this._renderChrome()}connectedCallback(){if(this._rendered)this._wire(),this._onStepsMutated();else{let e=Number.parseInt(this.getAttribute(`active`),10);this._active=Number.isFinite(e)&&e>=0?e:0,this.render()}}disconnectedCallback(){this._teardown()}attributeChangedCallback(e,t,n){if(!(!this._rendered||this._reflecting)){if(e===`active`){let e=Number.parseInt(n,10);Number.isFinite(e)&&this._go(e,`set`);return}this._renderChrome()}}render(){let e=this._steps;this._header||(this._header=document.createElement(`nav`),this._header.className=`stepper wizard-stepper`,this._footer=document.createElement(`div`),this._footer.className=`form-actions wizard-footer form-actions-between`,e.length?(this.insertBefore(this._header,e[0]),e[e.length-1].after(this._footer)):(this.prepend(this._header),this.append(this._footer))),this._known=e,this._renderChrome(),this._rendered=!0,this._wire()}_renderChrome(){let e=this._reconcileSteps();this._placeChrome(e),this._clampActive(e),this._syncPanels(e),this._header.innerHTML=this._headerHtml(e),this._footer.innerHTML=this._footerHtml(e),this._header.hidden=this.hasAttribute(`hide-stepper`)}_clampActive(e){let t=Math.max(0,e.length-1);this._active>t&&(this._active=t),this._active<0&&(this._active=0)}_reconcileSteps(){let e=this._steps,t=this._known;if(this._known=e,op(e,t))return e;let n=n=>new Set([...n].map(n=>e.indexOf(t[n])).filter(e=>e>=0));this._skipped=n(this._skipped),this._invalid=n(this._invalid);let r=t[this._active];if(!r)return e;let i=e.indexOf(r);if(i<0){let n=t=>e.includes(t),r=t.slice(this._active+1).find(n)??t.slice(0,this._active).reverse().find(n);i=r?e.indexOf(r):this._active}return i=Math.min(i,Math.max(0,e.length-1)),i!==this._active&&(this._active=i,this._reflectActive(i)),e}_placeChrome(e){if(!e.length)return;let t=e[e.length-1];this._header.nextElementSibling!==e[0]&&this.insertBefore(this._header,e[0]),this._footer.previousElementSibling!==t&&t.after(this._footer)}_onStepsMutated(){if(!this._rendered)return;let e=this._steps,t=!e.length||this._header.nextElementSibling===e[0]&&this._footer.previousElementSibling===e[e.length-1];this.querySelector(ip)!==this._glyphs&&(this._watchGlyphs(),this._renderHeader()),!(t&&op(e,this._known))&&(this._renderChrome(),this._observer?.takeRecords())}_syncPanels(e){e.forEach((e,t)=>{let n=t===this._active;e.classList.add(`wizard-panel`),e.hidden=!n,e.setAttribute(`role`,`tabpanel`),e.setAttribute(`aria-hidden`,n?`false`:`true`)})}_stepStatus(e,t){return e.getAttribute(`status`)||(this._invalid.has(t)?`error`:this._finished?`done`:t===this._active?`active`:t<this._active?this._skipped.has(t)?`skipped`:`done`:`pending`)}_headerHtml(e){let t=this.getAttribute(`variant`)===`journey`,n=this.getAttribute(`variant`)===`icons`,r=this.getAttribute(`orientation`)===`vertical`,i=!this.hasAttribute(`hide-connectors`);this._header.className=[`stepper`,`wizard-stepper`,t&&`stepper-journey`,n&&`stepper-icons`,r&&`stepper-vertical`,!i&&`wui-stepper-no-connectors`].filter(Boolean).join(` `),this._header.setAttribute(`aria-label`,this.getAttribute(`label`)||`Progress`);let a=this.hasAttribute(`non-linear`);return e.map((r,o)=>{let s=this._stepStatus(r,o),c=r.getAttribute(`label`)||``,l=r.getAttribute(`description`)||``,u=r.getAttribute(`icon`)||``,d=o+1,f;f=s===`done`?this._glyph(`check`):s===`error`?this._glyph(`alert-triangle`):s===`skipped`?this._glyph(`minus`):u?this._glyph(u):String(d);let p=s===`pending`?`step`:`step ${s}`,m=s===`active`?` aria-current="step"`:``,h=a||o<this._active,g=l?`<span class="step-desc">${sp(l)}</span>`:``,_;_=t?`<span class="step-circle">${f}</span><span class="step-text"><span class="step-index">Step ${d}</span><span class="step-label">${sp(c)}</span>${g}</span>`:n?`<span class="step-circle">${f}</span><span class="step-index">Step ${d}</span><span class="step-label">${sp(c)}</span>${g}`:`<span class="step-circle">${f}</span><span class="step-label">${sp(c)}</span>${g}`;let v=h?`<button type="button" class="${p}" data-step="${o}"${m}>${_}</button>`:`<div class="${p}"${m}>${_}</div>`;return t&&i&&o<e.length-1?`${v}<span class="step-line${s===`done`?` done`:``}" aria-hidden="true"></span>`:v}).join(``)}_footerHtml(e){let t=this._active,n=e.length-1,r=this.hasAttribute(`disabled`)?` disabled`:``,i=e[t]?.hasAttribute(`optional`)||this.hasAttribute(`skippable`),a=this.getAttribute(`back-label`)||`Back`,o=this.getAttribute(`next-label`)||`Next`,s=this.getAttribute(`skip-label`)||`Skip`,c=this.getAttribute(`finish-label`)||`Finish`;return`${t>0?`<button type="button" class="btn btn-secondary" data-nav="back"${r}>${j(`arrow-left`,{className:`me-2`})}${sp(a)}</button>`:`<span></span>`}<span class="wizard-footer-actions">${i&&t<n?`<button type="button" class="btn btn-neutral" data-nav="skip"${r}>${sp(s)}</button>`:``}${t<n?`<button type="button" class="btn btn-primary" data-nav="next"${r}>${sp(o)}${j(`arrow-right`,{className:`ms-2`})}</button>`:`<button type="button" class="btn btn-primary" data-nav="finish"${r}>${sp(c)}</button>`}</span>`}_wire(){this._teardown(),this._onHeaderClick=e=>{let t=e.target.closest(`[data-step]`);t&&this.contains(t)&&this._stepTo(Number.parseInt(t.dataset.step,10))},this._onFooterClick=e=>{let t=e.target.closest(`[data-nav]`);if(!t||!this.contains(t)||this.hasAttribute(`disabled`))return;let n=t.dataset.nav;n===`back`?this._back():n===`skip`?this._skip():(n===`next`||n===`finish`)&&this._next()},this._header.addEventListener(`click`,this._onHeaderClick),this._footer.addEventListener(`click`,this._onFooterClick),this._observer=new MutationObserver(()=>this._onStepsMutated()),this._observer.observe(this,{childList:!0}),this._watchGlyphs()}_glyph(e){let t=this.querySelector(ip),n=t&&[...t.children].find(t=>t.getAttribute(`data-icon`)===e);if(n)return n.outerHTML;let r=Number.parseInt(this.getAttribute(`icon-size`),10);return j(e,r>0?{size:r}:void 0)}_watchGlyphs(){this._glyphObserver?.disconnect(),this._glyphObserver=null,this._glyphs=this.querySelector(ip),this._glyphs&&(this._glyphObserver=new MutationObserver(()=>this._renderHeader()),this._glyphObserver.observe(this._glyphs,{childList:!0,subtree:!0,attributes:!0,characterData:!0}))}_renderHeader(){this._rendered&&(this._header.innerHTML=this._headerHtml(this._steps))}_teardown(){this._header&&this._onHeaderClick&&this._header.removeEventListener(`click`,this._onHeaderClick),this._footer&&this._onFooterClick&&this._footer.removeEventListener(`click`,this._onFooterClick),this._observer?.disconnect(),this._observer=null,this._glyphObserver?.disconnect(),this._glyphObserver=null}_stepTo(e){this.hasAttribute(`disabled`)||!this.hasAttribute(`non-linear`)&&e>=this._active||this._go(e,`step`)}_back(){this._active>0&&this._go(this._active-1,`back`)}async _next(){this._reconcileSteps();let e=this._active,t=this._steps,n=e>=t.length-1,r=t[e];if(!this.dispatchEvent(new CustomEvent(`wui-wizard:beforechange`,{detail:n?{index:e,next:e,reason:`finish`}:{index:e,next:e+1,reason:`next`},cancelable:!0})))return this._flagInvalid(e);if(this._beforeNext){let i;try{i=await this._beforeNext(e)}catch{i=!1}if(this._reconcileSteps(),t=this._steps,e=t.indexOf(r),e<0)return;if(n=e>=t.length-1,i===!1)return this._flagInvalid(e)}if(this._invalid.delete(e),this._skipped.delete(e),n)return this._finish();this._go(e+1,`next`)}_skip(){let e=this._active,t=this._steps;if(!(!t[e]?.hasAttribute(`optional`)&&!this.hasAttribute(`skippable`))){if(this._invalid.delete(e),this._skipped.add(e),this.dispatchEvent(new CustomEvent(`wui-wizard:skip`,{detail:{index:e}})),e>=t.length-1)return this._finish();this._go(e+1,`skip`)}}_flagInvalid(e){this._invalid.add(e),this._renderChrome(),this.dispatchEvent(new CustomEvent(`wui-wizard:invalid`,{detail:{index:e}}))}_finish(){this._invalid.delete(this._active),this._finished=!0,this._renderChrome(),this.dispatchEvent(new CustomEvent(`wui-wizard:finish`,{detail:{index:this._active}}))}_go(e,t){let n=this._reconcileSteps(),r=Math.max(0,n.length-1),i=Math.min(Math.max(e,0),r),a=this._active;this._finished=!1,this._invalid.delete(a),this._active=i,this._reflectActive(i),this._renderChrome(),t!==`silent`&&i!==a&&this.dispatchEvent(new CustomEvent(`wui-wizard:change`,{detail:{index:i,previous:a,reason:t}}))}_reflectActive(e){this._reflecting=!0,this.setAttribute(`active`,String(e)),this._reflecting=!1}},op=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),sp=e=>String(e??``).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`),cp=class extends l{static get observedAttributes(){return[`label`,`description`,`optional`,`icon`,`status`]}attributeChangedCallback(){let e=this.closest(`wui-wizard`);e&&typeof e.refresh==`function`&&e.refresh()}},lp=`image/jpeg,image/png,image/webp,image/heic,image/heif,.heic,.heif`,up=10,dp=512,fp=`image/webp`,pp=[96,48],mp={dialogTitle:`Edit photo`,dialogSubtitle:`Drag to position the photo, then zoom or rotate it.`,save:`Save photo`,cancel:`Cancel`,choose:`Upload photo`,change:`Change photo`,camera:`Take photo`,remove:`Remove photo`,unreadable:`That photo could not be opened. Choose a JPG, PNG or WebP image.`,heicUnreadable:`This browser cannot open HEIC photos. Choose a JPG, PNG or WebP image instead.`,cropFailed:`That photo could not be saved. Try again, or choose another one.`};function hp(e){if(!e)return!1;let t=String(e.type||``).toLowerCase();return t===`image/heic`||t===`image/heif`||/\.hei[cf]$/i.test(String(e.name||``))}function gp(e){return hp(e)?mp.heicUnreadable:mp.unreadable}function _p(e,t){let n=Number(t);return{name:e?.name||`photo`,type:fp,size:Number.isInteger(n)&&n>0?n:512}}var vp=`/`,yp=`.search-wrap.wui-search-collapsible`,bp=`.wui-topsearch-panel`,xp=`.modal, wui-drawer[open]`,Sp=new WeakSet,Cp=e=>e.querySelector(`.wui-search-toggle`),wp=e=>e.querySelector(`.search-input`);function Tp(e){e.classList.remove(`is-collapsed`),Cp(e)?.setAttribute(`aria-expanded`,`true`),wp(e)?.focus()}function Ep(e){wp(e)?.value||(e.classList.add(`is-collapsed`),Cp(e)?.setAttribute(`aria-expanded`,`false`))}function Dp(e){if(e.dataset.wuiCollapseWired)return;e.dataset.wuiCollapseWired=`1`;let t=Cp(e),n=wp(e);t?.addEventListener(`click`,()=>Tp(e)),n?.addEventListener(`keydown`,r=>{r.key!==`Escape`||n.value||(r.preventDefault(),Ep(e),t?.focus())}),e.addEventListener(`focusout`,t=>{e.contains(t.relatedTarget)||Ep(e)})}function Op(e){Sp.has(e)||(Sp.add(e),e.addEventListener(`keydown`,t=>{if(t.key!==`/`||t.ctrlKey||t.altKey||t.metaKey||t.defaultPrevented||C(t.target)||t.target?.closest?.(xp)||e.querySelector(bp))return;let n=[...e.querySelectorAll(yp)].find(e=>e.offsetParent!==null);n&&(t.preventDefault(),Tp(n))}))}function kp(e=document){for(let t of e.querySelectorAll(yp))Dp(t);Op(e.ownerDocument??e)}var Ap=`wuiConfirm`,jp=Object.freeze([`danger`]),Mp=Object.freeze([`success`,`info`,`warning`,`danger`]),Np=`wui.flash`,Pp=Object.freeze({confirmTitle:`Are you sure?`,confirmLabel:`Confirm`,cancelLabel:`Cancel`,failed:`That did not work. Try again.`,forbidden:`You do not have permission to do that.`,network:`Could not reach the server. Check your connection and try again.`}),Fp=new WeakSet,Ip=new WeakSet,Lp=null,Rp=null,zp=!1,Bp=e=>{let t=document.createElement(`span`);return t.textContent=e??``,t.innerHTML},Vp=(e,t)=>{e&&window.WUI?.toast?.(e,{variant:t})},Hp=()=>{let e=window.bootstrap?.Modal;if(!e)throw Error(`data-wui-confirm: Bootstrap's bundle (window.bootstrap) is not loaded on this page.`);return e};function Up(){let e=document.getElementById(Ap);return e||(e=document.createElement(`div`),e.id=Ap,e.className=`modal fade wui-modal-shell`,e.tabIndex=-1,e.setAttribute(`aria-hidden`,`true`),e.setAttribute(`role`,`dialog`),e.setAttribute(`aria-modal`,`true`),e.style.setProperty(`--wui-modal-max-width`,`${gn.md}px`),e.innerHTML=`<div class="modal-dialog modal-dialog-centered wui-rb-dialog"><div class="modal-content wui-modal wui-confirm"><div class="wui-modal-body"><div class="wui-confirm-content"><span class="wui-confirm-icon"><wui-status-icon tone="info" size="120"></wui-status-icon></span><h3 class="wui-confirm-title" tabindex="-1" data-autofocus></h3><p class="wui-confirm-msg"></p></div></div><div class="wui-modal-footer"><div class="wui-confirm-actions"><button type="button" class="btn btn-secondary" data-bs-dismiss="modal">${Bp(Pp.cancelLabel)}</button><button type="button" class="btn btn-primary" data-app-confirm></button></div></div></div></div>`,document.body.appendChild(e),e)}function Wp(e,t){let n=e.getAttribute(`data-wui-confirm-tone`);if(n!==null&&!jp.includes(n))throw TypeError(`data-wui-confirm-tone="${n}" is not supported. Use danger, or leave it off.`);Gp({title:e.getAttribute(`data-wui-confirm-title`),message:e.getAttribute(`data-wui-confirm`),label:e.getAttribute(`data-wui-confirm-label`),danger:n===`danger`},t)}function Gp({title:e,message:t,label:n,danger:r},i){let a=Hp(),o=Up(),s=o.querySelector(`.wui-confirm-title`),c=o.querySelector(`[data-app-confirm]`);if(!s||!c)throw Error(`#${Ap} is not a confirm dialog with a confirm button. Render <app-confirm-dialog id="${Ap}"> without confirm-href, or leave the dialog to the library.`);let l=o.querySelector(`.wui-confirm-msg`);l||(l=document.createElement(`p`),l.className=`wui-confirm-msg`,s.after(l)),s.textContent=e||Pp.confirmTitle,l.textContent=t,c.textContent=n||Pp.confirmLabel,c.classList.toggle(`btn-danger`,r),c.classList.toggle(`btn-primary`,!r),o.querySelector(`wui-status-icon`)?.setAttribute(`tone`,r?`delete`:`info`),o.setAttribute(`aria-label`,s.textContent),Rp=i,zp=!1,a.getOrCreateInstance(o).show()}var Kp=(e,t)=>{Lp=e;try{t()}finally{Lp=null}};function qp(e,{title:t,message:n,label:r,tone:i},a){if(i!=null&&!jp.includes(i))throw TypeError(`confirmAction: tone "${i}" is not supported. Use danger, or leave it off.`);cm(e.ownerDocument),Gp({title:t,message:n,label:r,danger:i===`danger`},()=>Kp(e,a))}var Jp=e=>e.disabled===!0||e.getAttribute(`aria-disabled`)===`true`;function Yp(e){let t=e.target.closest?.(`[data-wui-confirm]:not(form)`);!t||t===Lp||Jp(t)||(e.preventDefault(),e.stopImmediatePropagation(),Wp(t,()=>Kp(t,()=>t.click())))}function Xp(e){let t=e.target;if(!(t instanceof HTMLFormElement)||!t.hasAttribute(`data-wui-confirm`)||t===Lp||e.submitter&&e.submitter===Lp)return;e.preventDefault(),e.stopImmediatePropagation();let n=e.submitter?.form===t?e.submitter:void 0;Wp(t,()=>Kp(t,()=>t.requestSubmit(n)))}function Zp(e){let t=e.target.closest?.(`#${Ap} [data-app-confirm]`);!t||t.disabled||!Rp||(zp=!0,Hp().getOrCreateInstance(t.closest(`#${Ap}`)).hide())}function Qp(e){if(e.target.id!==`wuiConfirm`)return;let t=zp?Rp:null;Rp=null,zp=!1,t?.()}var $p=(e,t)=>{e&&window.sessionStorage.setItem(Np,JSON.stringify({message:e,variant:t}))},em=e=>e===`forbidden`?Pp.forbidden:e===`network`?Pp.network:Pp.failed;function tm(){for(let e of document.querySelectorAll(`[data-wui-server]`))e.dataset.refreshOnSuccess!==`false`&&Gt(e)?.reload()}async function nm(e){let t=e.getAttribute(`data-wui-post`);if(!t)throw Error(`A data-wui-post button needs the URL the action posts to.`);return rm(t,e)}async function rm(e,t,n){let r=t.getAttribute(`data-wui-post-reload`);if(r!==null&&r!==`page`)throw TypeError(`data-wui-post-reload="${r}" is not supported. Use page, or leave it off to reload the server tables.`);t.disabled=!0,t.setAttribute(`aria-busy`,`true`);let i=await P(e,{method:`POST`,body:n});if(i.kind===`session`||i.kind===`aborted`)return;let a=i.toastVariant||`success`;if(i.ok&&(i.redirect||r===`page`)){$p(i.message,a),i.redirect?window.location.assign(i.redirect):window.location.reload();return}if(t.disabled=!1,t.removeAttribute(`aria-busy`),i.ok){Qt(i,a),tm();return}Vp(i.message||em(i.kind),`danger`)}function im(e){let t=e.target.closest?.(`[data-wui-post]`);t&&(e.preventDefault(),!(Jp(t)||t.getAttribute(`aria-busy`)===`true`)&&nm(t).catch(e=>console.error(e)))}function am(e){let t=e.target.closest?.(`form[data-wui-post-form]`);if(!t||e.defaultPrevented)return;e.preventDefault();let n=e.submitter||t.querySelector(`button`);n.getAttribute(`aria-busy`)!==`true`&&(rm(t.getAttribute(`action`),n,new FormData(t)).catch(e=>console.error(e)),window.bootstrap?.Dropdown?.getInstance(t.closest(`.dropdown`)?.querySelector(`[data-bs-toggle='dropdown']`))?.hide())}function om(){let e=window.sessionStorage.getItem(Np);if(!e)return;window.sessionStorage.removeItem(Np);let{message:t,variant:n}=JSON.parse(e);Vp(t,n)}function sm(e){let t=e.querySelectorAll?[...e.querySelectorAll(`[data-wui-flash]`)]:[];e instanceof Element&&e.matches(`[data-wui-flash]`)&&t.unshift(e);for(let e of t){let t=e.getAttribute(`data-wui-flash-variant`)||`success`;if(!Mp.includes(t))throw TypeError(`data-wui-flash-variant="${t}" is not supported. Use ${Mp.join(`, `)}.`);let n=e.getAttribute(`data-wui-flash`)||e.textContent.trim();e.remove(),Vp(n,t)}}function cm(e){Ip.has(e)||(Ip.add(e),e.addEventListener(`click`,Zp),e.addEventListener(`hidden.bs.modal`,Qp))}function lm(e=document){let t=e.ownerDocument||e;Fp.has(t)||(Fp.add(t),t.addEventListener(`click`,Yp,!0),t.addEventListener(`submit`,Xp,!0),cm(t),t.addEventListener(`click`,im),t.addEventListener(`submit`,am),om()),sm(e)}var um=Object.freeze({title:`Leave without saving?`,message:`Your changes on this page are not saved. If you leave now, they are lost.`,leaveLabel:`Leave`}),dm=`form[data-wui-unsaved]`,fm=`[aria-invalid="true"], .field-error:not(:empty), .field-validation-error, .validation-summary-errors, .wui-error-summary`,pm=`[download], [data-wui-modal], [data-wui-post], [data-bs-toggle]`,mm=new Set([`submit`,`button`,`reset`,`image`]),hm=new WeakMap,gm=new WeakSet,_m=e=>`${e.name}:${e.size}:${e.lastModified}`;function vm(e){let t=[];for(let n of e.elements)!n.name||n.disabled||mm.has(n.type)||(n.type===`checkbox`||n.type===`radio`?t.push([n.name,n.value,n.checked]):n.type===`file`?t.push([n.name,[...n.files||[]].map(_m)]):n.type===`select-multiple`?t.push([n.name,[...n.selectedOptions].map(e=>e.value)]):t.push([n.name,n.value]));return JSON.stringify(t)}function ym(e){return vm(e)}var bm=e=>({saved:e.querySelector(fm)?null:vm(e),engaged:!1,discarded:!1});function xm(e){let t=hm.get(e);return!t||t.discarded||!e.isConnected?!1:t.saved===null||t.engaged&&vm(e)!==t.saved}var Sm=(e,t)=>[...e.querySelectorAll(dm)].filter(e=>e!==t&&xm(e)),Cm=()=>!!window.bootstrap?.Modal;function wm(e,t,n){let r=t.map(e=>e.getAttribute(`data-wui-unsaved`)).find(Boolean)||um.message;qp(e,{title:um.title,message:r,label:um.leaveLabel,tone:`danger`},()=>{for(let e of t)hm.get(e).discarded=!0;n()})}function Tm(e){if(e.matches(pm))return!1;let t=e.getAttribute(`target`);if(t&&t.toLowerCase()!==`_self`)return!1;let n=new URL(e.getAttribute(`href`),window.location.href);if(n.protocol!==`http:`&&n.protocol!==`https:`)return!1;let r=window.location;return!(n.hash&&n.origin===r.origin&&n.pathname===r.pathname&&n.search===r.search)}function Em(e,t){if((t?.getAttribute(`formmethod`)||e.getAttribute(`method`)||`get`).toLowerCase()===`dialog`)return!1;let n=t?.getAttribute(`formtarget`)||e.getAttribute(`target`);return!n||n.toLowerCase()===`_self`}function Dm(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=e.target.closest?.(`a[href]`);if(!t||!Tm(t))return;let n=Sm(t.ownerDocument,null);!n.length||!Cm()||(e.preventDefault(),wm(t,n,()=>t.click()))}function Om(e){let t=e.target;if(!(t instanceof HTMLFormElement)||e.defaultPrevented||!Em(t,e.submitter))return;let n=Sm(t.ownerDocument,t);if(n.length&&Cm()){e.preventDefault();let r=e.submitter?.form===t?e.submitter:void 0;wm(t,n,()=>t.requestSubmit(r));return}let r=hm.get(t);r&&(r.saved=vm(t),r.discarded=!1)}function km(e){Sm(document,null).length&&(e.preventDefault(),e.returnValue=``)}function Am(e){let t=e.target.closest?.(dm),n=t&&hm.get(t);!n||n.engaged||(n.saved!==null&&(n.saved=vm(t)),n.engaged=!0)}function jm(e){let t=e.target.closest?.(dm),n=t&&hm.get(t);n&&(n.discarded=!1,e.isTrusted&&(n.engaged=!0))}function Mm(e){let t=e.detail?.handle?.el;if(t instanceof Element)for(let e of t.querySelectorAll(dm))Pm(e)}function Nm(e=document){let t=e.ownerDocument||e;if(!gm.has(t)){gm.add(t);for(let e of[`focusin`,`pointerdown`,`drop`])t.addEventListener(e,Am,!0);for(let e of[`input`,`change`])t.addEventListener(e,jm,!0);t.addEventListener(`click`,Dm),t.addEventListener(`submit`,Om),t.addEventListener(`wui:modal:success`,Mm),t.defaultView.addEventListener(`beforeunload`,km)}let n=[...e.querySelectorAll?.(dm)||[]];e.matches?.(dm)&&n.unshift(e);for(let e of n)hm.has(e)||hm.set(e,bm(e))}function Pm(e){if(!(e instanceof HTMLFormElement)||!e.matches(dm))throw TypeError(`resetUnsavedChanges: ${String(e)} is not a <form data-wui-unsaved>.`);hm.set(e,{saved:vm(e),engaged:!1,discarded:!1})}var Fm=Object.freeze({discard:`Discard`,keep:`Keep editing`}),Im=`wui:drawer:discard`,Lm=`wui-drawer[confirm-discard]`,Rm=`.wui-modal-shell`,zm=`form[data-wui-confirm-discard]`,Bm=`.wui-drawer-discard`,Vm=`input, select, textarea`,Hm=new WeakMap,Um=new WeakSet,Wm=new WeakSet;function Gm(e,t,n,r){let i=e.createElement(`button`);return i.type=`button`,i.className=t,i.setAttribute(n,``),i.textContent=r,i}function Km(e,t){let n=e.createElement(`div`);n.className=`wui-drawer-discard`,n.setAttribute(`role`,`alert`);let r=e.createElement(`span`);return r.className=`wui-drawer-discard-text`,r.textContent=t,n.append(r,Gm(e,`btn btn-danger btn-sm`,`data-wui-discard-confirm`,Fm.discard),Gm(e,`btn btn-secondary btn-sm`,`data-wui-discard-keep`,Fm.keep)),n}function qm(e){let t=e.closest?.(Lm);if(t)return t;let n=e.closest?.(Rm);return n&&(n.hasAttribute(`confirm-discard`)||n.querySelector(zm))?n:null}function Jm(e){return e.closest(Lm)??e.closest(Rm)}function Ym(e){return e.matches(Lm)||e.hasAttribute(`confirm-discard`)?e.querySelectorAll(`form`):e.querySelectorAll(zm)}function Xm(e){let t=Hm.get(e);return t!=null&&ym(e)!==t}function Zm(e){let t=e.ownerDocument.createElement(`div`);return t.className=`wui-drawer-footer`,e.querySelector(`.wui-drawer-panel`).append(t),Wm.add(t),t}function Qm(e){let t=e.ownerDocument.createElement(`div`);return t.className=`wui-modal-footer`,(e.querySelector(`.wui-modal-body`)?.parentElement??e.querySelector(`.modal-content`)).append(t),Wm.add(t),t}function $m(e){e.querySelector(`[data-wui-discard-confirm]`).focus()}function eh(e,t){let n=e.querySelector(Bm);if(n){$m(n);return}let r=Km(e.ownerDocument,t),i;if(e.matches(Lm))i=e.querySelector(`.wui-drawer-footer`)??Zm(e),i.prepend(r);else if(e.hasAttribute(`confirm-discard`))i=e.querySelector(`.wui-modal-footer`)??Qm(e),i.prepend(r);else{let t=e.querySelector(zm);i=t.querySelector(`.modal-footer`),i?i.prepend(r):(i=t,t.append(r))}i.classList.add(`wui-drawer-discarding`),$m(r)}function th(e){let t=e.parentElement;e.remove(),t.classList.remove(`wui-drawer-discarding`),Wm.has(t)&&t.remove()}function nh(e){for(let t of Ym(e)){let e=[...t.querySelectorAll(Vm)].find(e=>e.type!==`hidden`&&!e.disabled);if(e){e.focus();return}}}function rh(e){let t=qm(e.target);if(t)for(let e of Ym(t))Hm.get(e)??Hm.set(e,ym(e))}function ih(e){let t=e.target;!(t instanceof HTMLFormElement)||!qm(t)||Hm.set(t,ym(t))}function ah(e){let t=e.detail?.handle?.el;if(t instanceof Element)for(let e of t.querySelectorAll(`form`))Hm.delete(e)}function oh(e){let t=e.target;!(t instanceof Element)||!t.matches(Lm)||[...Ym(t)].some(Xm)&&(e.preventDefault(),eh(t,t.getAttribute(`confirm-discard`)))}function sh(e){let t=e.target;if(!(t instanceof Element)||!t.matches(Rm))return;let n=[...Ym(t)].find(Xm);n&&(e.preventDefault(),eh(t,t.getAttribute(`confirm-discard`)??n.getAttribute(`data-wui-confirm-discard`)))}function ch(e){let t=e.closest(`wui-drawer`);if(t){t.dispatchEvent(new CustomEvent(`wui-drawer-close`,{bubbles:!0,cancelable:!0}))&&t.hide();return}let n=e.closest(Rm);n&&window.bootstrap?.Modal?.getInstance(n)?.hide()}function lh(e){let t=e.closest(Bm),n=Jm(t);th(t);for(let e of Ym(n))Hm.set(e,ym(e));n.dispatchEvent(new CustomEvent(Im,{bubbles:!0})),n.matches(Lm)?n.hide():window.bootstrap.Modal.getInstance(n).hide()}function uh(e){let t=e.closest(Bm),n=Jm(t);th(t),nh(n)}function dh(e){let t=e.target,n=t.closest?.(`[data-wui-discard-confirm]`);if(n){lh(n);return}let r=t.closest?.(`[data-wui-discard-keep]`);if(r){uh(r);return}let i=t.closest?.(`[data-wui-dismiss]`);i&&ch(i)}function fh(e){if(e.key!==`Escape`)return;let t=e.currentTarget.querySelector(Bm);if(!t)return;e.preventDefault(),e.stopPropagation();let n=Jm(t);th(t),nh(n)}function ph(e=document){let t=e.ownerDocument||e;Um.has(t)||(Um.add(t),t.addEventListener(`focusin`,rh),t.addEventListener(`pointerdown`,rh),t.addEventListener(`submit`,ih),t.addEventListener(`wui:modal:success`,ah),t.addEventListener(`wui:modal:loaded`,ah),t.addEventListener(`wui-drawer-close`,oh,!0),t.addEventListener(`hide.bs.modal`,sh),t.addEventListener(`click`,dh),t.addEventListener(`keydown`,fh,!0))}var mh=`image/png,image/jpeg,image/webp`,hh=5,gh={"image/png":[`.png`],"image/jpeg":[`.jpg`,`.jpeg`],"image/webp":[`.webp`],"image/gif":[`.gif`],"image/svg+xml":[`.svg`],"image/heic":[`.heic`],"image/heif":[`.heif`],"application/pdf":[`.pdf`],"text/plain":[`.txt`]},_h={"image/png":`PNG`,"image/jpeg":`JPG`,"image/webp":`WEBP`,"image/gif":`GIF`,"image/svg+xml":`SVG`,"image/heic":`HEIC`,"image/heif":`HEIC`,"application/pdf":`PDF`,"text/plain":`text file`,".png":`PNG`,".jpg":`JPG`,".jpeg":`JPG`,".webp":`WEBP`,".gif":`GIF`,".svg":`SVG`,".heic":`HEIC`,".heif":`HEIC`,".pdf":`PDF`,".txt":`text file`},vh=e=>String(e||``).split(`,`).map(e=>e.trim().toLowerCase()).filter(Boolean),yh=[`.png`,`.jpg`,`.jpeg`,`.webp`,`.gif`,`.svg`,`.bmp`,`.avif`,`.heic`,`.heif`];function bh(e){if(!e)return!1;let t=typeof e==`object`&&e.type?String(e.type).toLowerCase():``;if(t)return t.startsWith(`image/`);let n=typeof e==`string`?e:e.name||e.url||``,r=String(n).toLowerCase();return yh.some(e=>r.endsWith(e))}function xh(e){if(!e)return!1;let t=typeof e==`object`&&e.type?String(e.type).toLowerCase():``;if(t)return t===`application/pdf`;let n=typeof e==`string`?e:e.name||e.url||``;return String(n).toLowerCase().split(/[?#]/)[0].endsWith(`.pdf`)}function Sh(e){let t=vh(e);return t.length?t.every(e=>e.startsWith(`.`)?yh.includes(e):e===`image/*`||e.startsWith(`image/`)):!1}function Ch(e){let t=[];for(let n of vh(e)){let e=_h[n]||(n.startsWith(`.`)?n.slice(1).toUpperCase():n.toUpperCase());t.includes(e)||t.push(e)}return t.length<=1?t[0]||`supported`:`${t.slice(0,-1).join(`, `)} or ${t[t.length-1]}`}function wh(e,t){let n=vh(t);if(!n.length)return!0;let r=(e.type||``).toLowerCase(),i=(e.name||``).toLowerCase();return n.some(e=>e.startsWith(`.`)?i.endsWith(e):e.endsWith(`/*`)?r.startsWith(e.slice(0,-1)):r&&r===e?!0:!r&&(gh[e]||[]).some(e=>i.endsWith(e)))}function Th(e,t={}){if(!e)return null;let n=t.accept===void 0?mh:t.accept,r=t.maxSizeMb===void 0?5:t.maxSizeMb;if(!wh(e,n)){let e=Ch(n);return`Choose a ${e.endsWith(` file`)?e:`${e} file`}.`}return r>0&&e.size>r*1024*1024?`Keep the file under ${r} MB.`:null}var Eh=/[0-9]/,Dh={9:Eh,A:/[A-Za-z]/,"*":/[0-9A-Za-z]/},Oh=/[9A*]/,kh=new Set([`text`,`tel`,`search`,`url`,`password`]),Ah=e=>{let t=e.replace(/\D/g,``);return t.length===12&&t.startsWith(`91`)?t.slice(2):t.length===11&&t.startsWith(`0`)?t.slice(1):e},jh=e=>{let t=Number(e.slice(0,2)),n=Number(e.slice(2,4)),r=Number(e.slice(4,8));if(r<1)return!1;let i=new Date(Date.UTC(r,n-1,t));return i.getUTCFullYear()===r&&i.getUTCMonth()===n-1&&i.getUTCDate()===t},Mh=e=>e.length<=3?e:`${e.slice(0,-3).replace(/\B(?=(\d{2})+(?!\d))/g,`,`)},${e.slice(-3)}`,Nh=e=>{let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e.trim());return t?`${t[3]}-${t[2]}-${t[1]}`:e};function Ph(e,{upper:t=!1,normalize:n,valid:r,post:i=e=>e,message:a=`Enter the full value`}={}){let o=[...e].map(e=>Dh[e]?{re:Dh[e]}:{lit:e}),s=o.filter(e=>e.re).length;return{inputMode:o.every(e=>!e.re||e.re===Eh)?`numeric`:`text`,normalize:n,post:i,message:a,extract(e){let n=``,r=0;for(let i of e){for(;r<o.length&&o[r].lit!==void 0&&o[r].lit!==i;)r++;if(r>=o.length)break;let e=o[r];e.lit===void 0?e.re.test(i)&&(n+=t?i.toUpperCase():i,r++):r++}return n},layout(e){let t=``,n=[],r=0;for(let i=0;i<o.length&&r<e.length;i++)o[i].lit===void 0?(t+=e[r++],n.push(!0)):(t+=o[i].lit,n.push(!1));return{text:t,isRaw:n}},isValid:e=>e.length===s&&(!r||r(e))}}function Fh(){return{inputMode:`decimal`,post:e=>e,message:`Enter a valid amount`,extract(e){let t=``,n=!1,r=0;for(let i of e)Eh.test(i)?n?r<2&&(t+=i,r++):t+=i:i===`.`&&!n&&(n=!0,t+=i);return t.startsWith(`.`)&&(t=`0${t}`),t.replace(/^0+(?=\d)/,``)},layout(e){let[t,n]=e.split(`.`),r=Mh(t)+(e.includes(`.`)?`.${n}`:``);return{text:r,isRaw:[...r].map(e=>e!==`,`)}},isValid:e=>/^\d+(\.\d{1,2})?$/.test(e)}}var Ih={"phone-in":()=>Ph(`99999 99999`,{normalize:Ah,valid:e=>/^[6-9]/.test(e),message:`Enter a 10-digit mobile number`}),pan:()=>Ph(`AAAAA9999A`,{upper:!0,valid:e=>/^[A-Z]{5}\d{4}[A-Z]$/.test(e),message:`Enter a valid PAN`}),gstin:()=>Ph(`99AAAAA9999A***`,{upper:!0,valid:e=>/^\d{2}[A-Z]{5}\d{4}[A-Z][1-9A-Z]Z[0-9A-Z]$/.test(e),message:`Enter a valid GSTIN`}),aadhaar:()=>Ph(`9999 9999 9999`,{valid:e=>/^[2-9]/.test(e),message:`Enter a valid 12-digit Aadhaar number`}),ifsc:()=>Ph(`AAAA*******`,{upper:!0,valid:e=>/^[A-Z]{4}0[A-Z0-9]{6}$/.test(e),message:`Enter a valid IFSC`}),"pin-code":()=>Ph(`999999`,{valid:e=>/^[1-9]/.test(e),message:`Enter a valid 6-digit PIN code`}),date:()=>Ph(`99-99-9999`,{normalize:Nh,valid:jh,post:(e,t)=>e.length===8&&jh(e)?`${e.slice(4)}-${e.slice(2,4)}-${e.slice(0,2)}`:t,message:`Enter a valid date as DD-MM-YYYY`}),amount:Fh},Lh=Object.keys(Ih),Rh=e=>{let t=String(e).toLowerCase();return Object.hasOwn(Ih,t)?t:void 0},zh=e=>Oh.test(String(e))&&Rh(e)===void 0,Bh=new Map;function Vh(e){if(e==null||e===``)return null;let t=String(e);return Bh.has(t)||(zh(t)?Bh.set(t,Ph(t)):Bh.set(t,Object.hasOwn(Ih,t)?Ih[t]():null)),Bh.get(t)}var Hh=(e,t)=>e.normalize?e.normalize(t):t;function Uh(e,t){let n=Vh(e);return n?n.extract(Hh(n,String(t??``))):String(t??``)}function Wh(e,t){let n=Vh(e);if(!n)return String(t??``);let r=n.extract(Hh(n,String(t??``)));return n.post(r,n.layout(r).text)}function Gh(e,t){let n=Vh(e);return n?n.layout(n.extract(Hh(n,String(t??``)))).text:String(t??``)}var Kh=(e,t)=>{if(t<=0)return 0;let n=0;for(let r=0;r<e.length;r++)if(e[r]&&++n===t)return r+1;return e.length},qh=new WeakMap,Jh=e=>qh.get(e)?.(),Yh=new WeakMap;function Xh(e,t,n,r){let i=e.getAll(t),a=Yh.get(e);a||Yh.set(e,a=new Set);let o=i.findIndex((e,r)=>e===n&&!a.has(`${t}\u0000${r}`));if(!(o<0)){if(a.add(`${t}\u0000${o}`),i[o]=r,i.length===1){e.set(t,r);return}e.delete(t);for(let n of i)e.append(t,n)}}function Zh(e){let t=null,n=null,r=!1,i=(t,n)=>n===null?e.removeAttribute(t):e.setAttribute(t,n),a,o,s=()=>{t?.remove(),t=null,n&&(n.hidden=!1),n=null,r&&e.classList.remove(`error`),r=!1,a!==void 0&&i(`aria-invalid`,a),o!==void 0&&i(`aria-describedby`,o),a=void 0,o=void 0};return i=>{if(!i){s();return}let c=e.closest(`.field`),l=c?.querySelector(`.field-error`);l&&l!==t&&l.textContent.trim()||(t||(r=!e.classList.contains(`error`),e.classList.add(`error`),a=e.getAttribute(`aria-invalid`),o=e.getAttribute(`aria-describedby`),c&&(t=document.createElement(`div`),t.className=`field-error`,e.id&&(t.id=`${e.id}-error`),n=c.querySelector(`.field-hint`),n&&(n.hidden=!0),c.insertBefore(t,[...c.children].find(e=>e.classList.contains(`field-count`))??null),t.id&&e.setAttribute(`aria-describedby`,t.id)),e.setAttribute(`aria-invalid`,`true`)),t&&(t.textContent=i))}}function Qh(e,{mask:t,postFormatted:n=!1,onChange:r,onInvalidChange:i}={}){let a=Vh(t);if(!a||!kh.has(e.type))return()=>{};let o=Object.getPrototypeOf(e),s=Object.getOwnPropertyDescriptor(o,`value`).set,c=!e.hasAttribute(`inputmode`);c&&e.setAttribute(`inputmode`,a.inputMode);let l=i??Zh(e),u=null,d=!1,f=!1,p=!1,m=``,h=``,g,_=()=>{let e=p?m:``;e!==h&&(h=e,l(h))},v=(t,n,i)=>{let o=a.extract(t.slice(0,n)).length,c=a.extract(t),{text:l,isRaw:d}=a.layout(c);if(e.value!==l&&(s.call(e,l),document.activeElement===e&&kh.has(e.type))){let t=Kh(d,o);e.setSelectionRange(t,t)}e.dataset.maskRaw=c,m=c&&!a.isValid(c)?a.message:``,e.setCustomValidity(m),_(),i&&c!==u&&r?.(c,l),u=c},y=Object.getOwnPropertyDescriptor(e,`value`),b=y??Object.getOwnPropertyDescriptor(o,`value`);Object.defineProperty(e,"value",{configurable:!0,enumerable:b.enumerable,get:()=>b.get.call(e),set:t=>{if(b.set.call(e,t),f)return;let n=Hh(a,e.value);v(n,n.length,!0)}});let x=()=>{d=!0,e.dispatchEvent(new Event(`input`,{bubbles:!0})),d=!1},S=t=>{if(d||f||t.isComposing)return;let n=t.inputType===`insertText`&&(t.data?.length??0)<=1||t.inputType?.startsWith(`delete`)?e.value:Hh(a,e.value);v(n,e.selectionStart??n.length,!0)},ee=()=>{f=!0},te=()=>{f=!1;let t=Hh(a,e.value);v(t,e.selectionStart??t.length,!0),x()},C=t=>{let n=t.inputType===`deleteContentBackward`;if(!n&&t.inputType!==`deleteContentForward`||t.isComposing)return;let r=e.selectionStart;if(r==null||r!==e.selectionEnd)return;let{isRaw:i}=a.layout(a.extract(e.value)),o=n?r-1:r;for(;o>=0&&o<i.length&&!i[o];)o+=n?-1:1;o!==(n?r-1:r)&&(t.preventDefault(),!(o<0||o>=i.length)&&(v(e.value.slice(0,o)+e.value.slice(o+1),n?o:r,!0),x()))},w=t=>{if(e.readOnly||e.disabled)return;let n=t.clipboardData?.getData(`text`);if(n==null)return;t.preventDefault();let r=Hh(a,n),i=e.selectionStart??e.value.length,o=e.selectionEnd??i;v(e.value.slice(0,i)+r+e.value.slice(o),i+r.length,!0),x()},T=()=>{let t=a.extract(e.value);return a.post(t,a.layout(t).text)},E=()=>{p=!0,_()};e.addEventListener(`input`,S),e.addEventListener(`beforeinput`,C),e.addEventListener(`paste`,w),e.addEventListener(`compositionstart`,ee),e.addEventListener(`compositionend`,te),e.addEventListener(`blur`,E),e.addEventListener(`invalid`,E);let D=e.form,ne=t=>{e.name&&!e.disabled&&Xh(t.formData,e.name,e.value,T())},re=()=>{clearTimeout(g),g=setTimeout(()=>{p=!1,v(Hh(a,e.value),e.value.length,!0)},0)};n||(D?.addEventListener(`formdata`,ne),qh.set(e,T)),D?.addEventListener(`reset`,re),D?.addEventListener(`submit`,E);let ie=Hh(a,e.value);return v(ie,ie.length,!1),()=>{clearTimeout(g),e.removeEventListener(`input`,S),e.removeEventListener(`beforeinput`,C),e.removeEventListener(`paste`,w),e.removeEventListener(`compositionstart`,ee),e.removeEventListener(`compositionend`,te),e.removeEventListener(`blur`,E),e.removeEventListener(`invalid`,E),D?.removeEventListener(`formdata`,ne),D?.removeEventListener(`reset`,re),D?.removeEventListener(`submit`,E),qh.delete(e),y?Object.defineProperty(e,"value",y):delete e.value,p=!1,m=``,_(),e.setCustomValidity(``),delete e.dataset.maskRaw,c&&e.removeAttribute(`inputmode`)}}function $h(){let e=typeof window>`u`?void 0:window.jQuery?.validator?.prototype;if(!e||e.wuiMaskHook)return;let t=e.elementValue;e.elementValue=function(e){let n=Jh(e);return n===void 0?t.call(this,e):n},e.wuiMaskHook=!0}var eg=new WeakMap,tg,ng=e=>{eg.has(e)||eg.set(e,Qh(e,{mask:e.dataset.appMask,postFormatted:e.hasAttribute(`data-mask-post-formatted`)}))},rg=e=>e.nodeType===1?[...e.matches(`input[data-app-mask]`)?[e]:[],...e.querySelectorAll(`input[data-app-mask]`)]:[];function ig(){tg||typeof MutationObserver>`u`||(tg=new MutationObserver(e=>{for(let t of e){for(let e of t.removedNodes)for(let t of rg(e))eg.get(t)?.(),eg.delete(t);for(let e of t.addedNodes)for(let t of rg(e))ng(t)}}),tg.observe(document.documentElement,{childList:!0,subtree:!0}))}function ag(e=document){$h();for(let t of e.querySelectorAll(`input[data-app-mask]`))ng(t);e===document&&ig()}var og=`data-wui-bulk-in-bar`,sg=`[data-wui-page-header-bar][data-wui-bulk-for]`,cg=new WeakSet;function lg(e){return`${k(e,{decimals:0})} selected`}function ug(e,t){for(let n of e.querySelectorAll(`[data-wui-bar-swap]`))n.hidden=t>0;let n=e.querySelector(`[data-wui-bar-bulk]`);n&&(n.hidden=t===0,n.querySelector(`.page-header-bar-bulk-count`).textContent=t>0?lg(t):``)}function dg(e=document){for(let t of e.querySelectorAll(sg))document.getElementById(t.dataset.wuiBulkFor)?.setAttribute(og,``);cg.has(document)||(cg.add(document),document.addEventListener(`selectionchange`,e=>{if(typeof e.detail?.selected==`number`)for(let t of document.querySelectorAll(sg))document.getElementById(t.dataset.wuiBulkFor)?.contains(e.target)&&ug(t,e.detail.selected)}))}var fg={minLength:10,uppercase:!0,lowercase:!0,digit:!0,special:!0,uniqueChars:0,customRules:[]},pg=`Password requirements`;function mg(e){return e===!0||e==null?{...fg}:{...fg,...e}}function hg(e){let t=mg(e),n=[];if(t.minLength>0&&n.push({key:`length`,label:`At least ${t.minLength} characters long`,test:e=>e.length>=t.minLength}),t.uppercase&&n.push({key:`uppercase`,label:`At least one uppercase letter`,test:e=>/[A-Z]/.test(e)}),t.lowercase&&n.push({key:`lowercase`,label:`At least one lowercase letter`,test:e=>/[a-z]/.test(e)}),t.digit&&n.push({key:`digit`,label:`At least one digit`,test:e=>/[0-9]/.test(e)}),t.special&&n.push({key:`special`,label:`At least one special character`,test:e=>/[^A-Za-z0-9]/.test(e)}),t.uniqueChars>0){let e=t.uniqueChars;n.push({key:`unique`,label:`At least ${e} unique character${e>1?`s`:``}`,test:t=>new Set(t).size>=e})}for(let[e,r]of(t.customRules??[]).entries()){let t=new RegExp(r.pattern);n.push({key:`custom-${e}`,label:r.label,test:e=>t.test(e)})}return n}function gg(e,t){let n=e==null?``:String(e);return hg(t).map(e=>({key:e.key,label:e.label,met:e.test(n)}))}function _g(e,t){return gg(e,t).every(e=>e.met)}var vg=`wui:row-drop`,yg=`is-drop-over`,bg=`application/x-wui-rows`,xg=`wui-row-dragging`,Sg=`[data-wui-drop-target]`,Cg=`tbody tr[data-row-key]`,wg=`input, button, a, select, textarea, label`,Tg=`.wui-select-cell .wui-check`,Eg=new WeakMap,Dg=new WeakSet,Og=null,kg=null;function Ag(e){return e.querySelector(Tg)?.checked===!0}function jg(e){return[...e.querySelectorAll(`tbody tr`)].filter(Ag).map(e=>e.dataset.rowKey)}function Mg(){Og=null,document.body.classList.remove(xg);for(let e of document.querySelectorAll(`${Sg}.${yg}`))e.classList.remove(yg)}function Ng(e,t,n){e.dispatchEvent(new CustomEvent(vg,{bubbles:!0,detail:{keys:t,target:n.dataset.wuiDropTarget}}))}function Pg(e){let t=e.target.closest?.(Sg);!t||!Og||(e.preventDefault(),e.dataTransfer.dropEffect=`move`,t.classList.add(yg))}function Fg(e){let t=e.target.closest?.(Sg);!t||t.contains(e.relatedTarget)||t.classList.remove(yg)}function Ig(e){let t=e.target.closest?.(Sg);if(!t||!Og)return;e.preventDefault(),t.classList.remove(yg);let{root:n,keys:r}=Og;Ng(n,r,t),Mg()}function Lg(e){let t=e.target.closest?.(Sg);!t||!kg?.keys.length||(e.preventDefault(),Ng(kg.root,kg.keys,t))}function Rg(e){(e.key===`Enter`||e.key===` `)&&Lg(e)}function zg(e){Dg.has(e)||(Dg.add(e),e.addEventListener(`dragover`,Pg),e.addEventListener(`dragenter`,Pg),e.addEventListener(`dragleave`,Fg),e.addEventListener(`drop`,Ig),e.addEventListener(`click`,Lg),e.addEventListener(`keydown`,Rg))}function Bg(e){let t=Eg.get(e);if(t)return t;zg(e.ownerDocument||e);let n=t=>{let n=t.target.closest?.(Cg);if(!n||!e.contains(n))return;let r=t.target.closest(wg);r&&n.contains(r)||(n.draggable=!0)},r=t=>{let n=t.target.closest?.(Cg);if(!n||!e.contains(n))return;let r=Ag(n)?jg(e):[n.dataset.rowKey];t.dataTransfer.setData(bg,JSON.stringify(r)),t.dataTransfer.setData(`text/plain`,r.join(`,`)),t.dataTransfer.effectAllowed=`move`,Og={root:e,keys:r},document.body.classList.add(xg)},i=t=>{let n=t.detail?.selected;n>0?kg={root:e,keys:t.detail.keys??jg(e)}:n===0&&(kg=null),Vg(document)};e.addEventListener(`pointerdown`,n),e.addEventListener(`dragstart`,r),e.addEventListener(`dragend`,Mg),e.addEventListener(`selectionchange`,i);let a=()=>{e.removeEventListener(`pointerdown`,n),e.removeEventListener(`dragstart`,r),e.removeEventListener(`dragend`,Mg),e.removeEventListener(`selectionchange`,i),Eg.delete(e)};return Eg.set(e,a),a}function Vg(e=document){let t=e.querySelector(`[data-wui-row-drag] tbody tr ${Tg}:checked`)!==null;for(let n of e.querySelectorAll(Sg)){n.tagName!==`BUTTON`&&(n.setAttribute(`role`,`button`),n.setAttribute(`tabindex`,`0`)),t?n.removeAttribute(`aria-disabled`):n.setAttribute(`aria-disabled`,`true`);let e=n.getAttribute(`data-wui-drop-label`)||n.textContent.trim();n.setAttribute(`aria-label`,`Move to ${e}`)}for(let t of e.querySelectorAll(`.wui-drop-tray`))t.hasAttribute(`role`)||(t.setAttribute(`role`,`toolbar`),t.setAttribute(`aria-label`,`Move to`))}function Hg(e=document){for(let t of e.querySelectorAll(`[data-wui-row-drag]`))Bg(t);Vg(e.ownerDocument||e)}var Ug=`.table-wrap, .table-responsive, [class*="table-responsive-"]`,Wg=1;function Gg(e){let t=()=>{let t=e.scrollWidth-e.clientWidth,n=Math.abs(e.scrollLeft);e.toggleAttribute(`data-wui-overflow-start`,t>Wg&&n>Wg),e.toggleAttribute(`data-wui-overflow-end`,t>Wg&&n<t-Wg),e.toggleAttribute(`data-wui-overflow-top`,e.scrollTop>Wg)},n=()=>{if(e.scrollWidth-e.clientWidth>Wg){let t=getComputedStyle(e);e.style.setProperty(`--wui-scroll-pad-start`,t.paddingInlineStart),e.style.setProperty(`--wui-scroll-pad-end`,t.paddingInlineEnd)}else e.style.getPropertyValue(`--wui-scroll-pad-end`)&&(e.style.removeProperty(`--wui-scroll-pad-start`),e.style.removeProperty(`--wui-scroll-pad-end`))},r=()=>{n(),t()};e.addEventListener(`scroll`,t,{passive:!0});let i=null;if(typeof ResizeObserver<`u`){i=new ResizeObserver(r),i.observe(e);for(let t of e.children)i.observe(t)}return r(),()=>{e.removeEventListener(`scroll`,t),i?.disconnect(),e.removeAttribute(`data-wui-overflow-start`),e.removeAttribute(`data-wui-overflow-end`),e.removeAttribute(`data-wui-overflow-top`),e.style.getPropertyValue(`--wui-scroll-pad-end`)&&(e.style.removeProperty(`--wui-scroll-pad-start`),e.style.removeProperty(`--wui-scroll-pad-end`))}}var Kg=new WeakMap,qg,Jg=e=>{Kg.has(e)||Kg.set(e,Gg(e))},Yg=e=>e.nodeType===1?[...e.matches(`.table-wrap, .table-responsive, [class*="table-responsive-"]`)?[e]:[],...e.querySelectorAll(Ug)]:[];function Xg(){qg||typeof MutationObserver>`u`||(qg=new MutationObserver(e=>{for(let t of e){for(let e of t.removedNodes)for(let t of Yg(e))Kg.get(t)?.(),Kg.delete(t);for(let e of t.addedNodes)for(let t of Yg(e))Jg(t)}}),qg.observe(document.documentElement,{childList:!0,subtree:!0}))}function Zg(e=document){for(let t of e.querySelectorAll(Ug))Jg(t);e===document&&Xg()}var Qg=31536e3,$g=new WeakMap,e_=e=>e>99?`99+`:String(e);function t_(e,t,n=document){n.cookie=`${e}=${t?`1`:`0`}; Path=/; Max-Age=${Qg}; SameSite=Lax`}var n_=e=>{let t=document.createElement(`template`);return t.innerHTML=e,t.content},r_=(e,t)=>{let n=document.createElement(`div`);return n.className=e,n.textContent=t,n};function i_(e,t){let n=e.querySelector(`.wui-bell-trigger`),r=e.querySelector(`.wui-bell-count`),i=e.querySelector(`[data-wui-bell-live]`),a=e.querySelector(`[data-wui-bell-list]`),o=e.querySelector(`.wui-bell-menu`),{src:s,readAction:c}=e.dataset,l=e.dataset.label||`Notifications`,u=e.dataset.emptyText||`You are all caught up.`,d=Number(e.dataset.pollSeconds??60),f=dn(),p=Number(e.dataset.unread)||0,m=(t,a=!0)=>{let o=Math.max(0,Number(t)||0),s=o!==p;p=o,e.dataset.unread=String(o),r&&(r.textContent=e_(o),r.hidden=o===0),n?.setAttribute(`aria-label`,o===0?l:`${l}, ${e_(o)} unread`),a&&s&&i&&(i.textContent=o===0?`No unread notifications`:`${e_(o)} unread notifications`)},h=()=>o?.classList.contains(`show`)??!1,g=()=>{let e=r_(`wui-bell-state`,`Could not load notifications. `),t=document.createElement(`button`);t.type=`button`,t.className=`btn btn-link btn-sm`,t.dataset.wuiBellRetry=``,t.textContent=`Retry`,e.append(t),a.replaceChildren(e)},_=async t=>{t&&(a.setAttribute(`aria-busy`,`true`),a.querySelector(`.wui-bell-item`)||a.replaceChildren(r_(`wui-bell-state`,`Loading…`)));let n=await f.run(s);if(n.kind===`aborted`||n.kind===`stale`||n.kind===`session`)return;if(a.removeAttribute(`aria-busy`),!n.ok){t&&g();return}let r=n_(n.html),i=r.querySelector(`[data-wui-unread]`),o=i?Number(i.getAttribute(`data-wui-unread`)):p;m(o),(t||h())&&(r.querySelector(`.wui-bell-item`)?a.replaceChildren(r):a.replaceChildren(r_(`wui-bell-state`,u))),e.dispatchEvent(new CustomEvent(`wui:notifications:loaded`,{bubbles:!0,detail:{unread:o}}))};e.addEventListener(`show.bs.dropdown`,()=>_(!0)),e.addEventListener(`click`,async e=>{if(e.target.closest(`[data-wui-bell-retry]`)){_(!0);return}let t=e.target.closest(`[data-wui-bell-read]`);if(!t||!c)return;t.disabled=!0;let n=await P(c,{method:`POST`});t.disabled=!1,n.ok&&(m(0),_(!0))});let v=null,y=()=>{d>0&&v===null&&(v=setInterval(()=>_(h()),d*1e3))},b=()=>{v!==null&&clearInterval(v),v=null},x=()=>{document.hidden?b():(_(h()),y())};return d>0&&(document.addEventListener(`visibilitychange`,x),document.hidden||y()),t.push(()=>{b(),f.abort(),document.removeEventListener(`visibilitychange`,x)}),{setUnread:e=>m(e),refresh:()=>_(h())}}var a_=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName)),o_=(e,t,n)=>`${e}${e.includes(`?`)?`&`:`?`}${encodeURIComponent(t)}=${encodeURIComponent(n)}`;function s_(e,t){let n=e.querySelector(`input.search-input`),r=e.querySelector(`.wui-topsearch-results`),i=e.querySelector(`.wui-topsearch-open`),a=e.querySelector(`[data-wui-topsearch-live]`),{src:o,param:s=`q`,resultsHref:c}=e.dataset,l=Number(e.dataset.minChars??2),u=Number(e.dataset.debounceMs??250),d=dn(),f=null,p=-1,m=()=>[...r.querySelectorAll(`.wui-topsearch-hit`)],h=e=>{let t=m();p=t.length===0?-1:(e+t.length)%t.length,t.forEach((e,t)=>{let n=t===p;e.classList.toggle(`is-active`,n),e.setAttribute(`aria-selected`,n?`true`:`false`)}),p>=0?(n.setAttribute(`aria-activedescendant`,t[p].id),t[p].scrollIntoView?.({block:`nearest`})):n.removeAttribute(`aria-activedescendant`)},g=()=>{r.hidden=!0,n.setAttribute(`aria-expanded`,`false`),n.removeAttribute(`aria-activedescendant`),p=-1},_=()=>{r.hidden=!1,n.setAttribute(`aria-expanded`,`true`)},v=t=>{e.classList.toggle(`is-open`,t),i?.setAttribute(`aria-expanded`,t?`true`:`false`)},y=t=>{let n=new CustomEvent(`wui:search:select`,{bubbles:!0,cancelable:!0,detail:{href:t}});e.dispatchEvent(n)&&window.location.assign(t)},b=async t=>{e.classList.add(`is-loading`);let n=await d.run(o_(o,s,t));if(!(n.kind===`aborted`||n.kind===`stale`||n.kind===`session`)){if(e.classList.remove(`is-loading`),n.ok){let e=n_(n.html),t=e.querySelector(`[data-wui-count]`);r.replaceChildren(e),m().forEach((e,t)=>{e.id=`${r.id}-opt-${t}`});let i=t?Number(t.getAttribute(`data-wui-count`)):m().length;a&&(a.textContent=i===0?`No results`:`${i} ${i===1?`result`:`results`}`)}else r.replaceChildren(r_(`wui-topsearch-empty`,`Search is unavailable right now.`));p=-1,_()}};n.addEventListener(`input`,()=>{clearTimeout(f);let t=n.value.trim();if(t.length<l){d.abort(),e.classList.remove(`is-loading`),r.replaceChildren(),g();return}f=setTimeout(()=>b(t),u)}),n.addEventListener(`keydown`,t=>{if(t.key===`ArrowDown`||t.key===`ArrowUp`){if(r.hidden||m().length===0)return;t.preventDefault(),h(p+(t.key===`ArrowDown`?1:-1))}else if(t.key===`Enter`){let e=m();!r.hidden&&p>=0&&e[p]?(t.preventDefault(),y(e[p].getAttribute(`href`))):c&&n.value.trim()!==``&&(t.preventDefault(),y(o_(c,s,n.value.trim())))}else t.key===`Escape`&&(r.hidden?e.classList.contains(`is-open`)&&(t.preventDefault(),t.stopPropagation(),v(!1),i?.focus()):(t.preventDefault(),t.stopPropagation(),g()))}),r.addEventListener(`click`,e=>{let t=e.target.closest(`.wui-topsearch-hit`);!t||e.ctrlKey||e.metaKey||e.shiftKey||e.button===1||(e.preventDefault(),y(t.getAttribute(`href`)))}),i?.addEventListener(`click`,()=>{let t=!e.classList.contains(`is-open`);v(t),t&&n.focus()});let x=e=>{e.key!==`/`||e.ctrlKey||e.metaKey||e.altKey||a_(e.target)||(e.preventDefault(),v(!0),n.focus())},S=t=>{e.contains(t.target)||(g(),e.classList.contains(`is-open`)&&v(!1))};document.addEventListener(`keydown`,x),document.addEventListener(`pointerdown`,S),t.push(()=>{clearTimeout(f),d.abort(),document.removeEventListener(`keydown`,x),document.removeEventListener(`pointerdown`,S)})}function c_(e){let t=[],n=e.dataset.wuiCollapsedCookie;n&&e.addEventListener(`wui:shell:collapse`,e=>t_(n,!!e.detail?.collapsed)),e.addEventListener(`click`,t=>{t.target.closest(`[data-wui-tabbar-more]`)&&e.querySelector(`[data-app-shell-menu]`)?.click()});let r=e.querySelector(`[data-wui-bell]`),i=r?i_(r,t):null,a=e.querySelector(`[data-wui-topsearch]`);a&&s_(a,t);let o={el:e,setUnread(e){if(!i)throw Error(`WUI.shell: this <app-shell> has no <app-shell-notifications>.`);i.setUnread(e)},refreshNotifications(){if(!i)throw Error(`WUI.shell: this <app-shell> has no <app-shell-notifications>.`);return i.refresh()},get collapsed(){return e.classList.contains(`collapsed`)},set collapsed(t){if(!!t===e.classList.contains(`collapsed`))return;let n=e.querySelector(`[data-app-shell-collapse]`);n?n.click():e.classList.toggle(`collapsed`,!!t)}};$g.set(e,o);let s=n=>{if(n.target===e||n.target.contains?.(e)){for(let e of t)e();$g.delete(e),delete e.dataset.wuiPartsWired,document.removeEventListener(`wui:teardown`,s)}};return document.addEventListener(`wui:teardown`,s),o}function l_(e=document){let t=[];e instanceof Element&&e.matches(`[data-app-shell]`)&&t.push(e),t.push(...e.querySelectorAll(`[data-app-shell]`));for(let e of t)e.dataset.wuiPartsWired||(e.dataset.wuiPartsWired=`1`,c_(e))}function u_(e){let t=e?.closest?.(`[data-app-shell]`)??null;return t?($g.has(t)||l_(t),$g.get(t)??null):null}var d_=[`light`,`dark`,`auto`],f_=[`wave`,`circle`,`slide`,`blinds`,`fade`,`none`],p_=`wave`,m_=`theme`,h_={wave:1100,circle:700,slide:600,blinds:900,fade:350,none:0},g_=`wui-theme-switching`,__=`wui:theme:change`,v_=`(prefers-color-scheme: dark)`,y_=e=>typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(e).matches,b_=e=>d_.includes(e);function x_(e){return e===`dark`||e===`auto`&&y_(v_)?`dark`:`light`}function S_(e=m_){let t=null;try{t=window.localStorage.getItem(e)}catch{}return b_(t)?t:`auto`}function C_(e,t=m_){try{window.localStorage.setItem(t,e)}catch{}}function w_(e){let t=document.documentElement,n=x_(e);t.setAttribute(`data-theme`,e),t.setAttribute(`data-bs-theme`,n),document.dispatchEvent(new CustomEvent(__,{detail:{mode:n,preference:e}}))}var T_=`(function(k){var m;try{m=localStorage.getItem(k)}catch{}if(m!=='light'&&m!=='dark')m='auto';var r=document.documentElement,q=window.matchMedia?window.matchMedia('(prefers-color-scheme: dark)'):null;function s(){var t=r.getAttribute('data-theme');r.setAttribute('data-bs-theme',t==='auto'?(q&&q.matches?'dark':'light'):t)}r.setAttribute('data-theme',m);s();if(q&&q.addEventListener)q.addEventListener('change',function(){if(r.getAttribute('data-theme')==='auto')s()})})(`;function E_(e=m_){return`${T_}${JSON.stringify(String(e)).replace(/</g,`\\u003c`)})`}function D_(e,{includeAuto:t=!1}={}){return e===`light`?`dark`:e===`dark`&&t?`auto`:`light`}function O_(e){if(typeof window>`u`||typeof window.matchMedia!=`function`)return()=>{};let t=window.matchMedia(v_),n=()=>e(t.matches?`dark`:`light`);return t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)}var k_=60,A_=e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2,j_=e=>e.toFixed(1),M_=(e,t)=>`${j_(e)}px ${j_(t)}px`,N_={amplitude:22,segments:36,cycles:1.5,ripples:2},P_=6,F_=(e,t,n,r,i)=>{let{amplitude:a,segments:o,cycles:s}=N_,c=n*(t+2*a),l=i?t+a-c:c-a,u=i?t+2*a:-2*a,d=[M_(0,u)];for(let t=0;t<=o;t++){let n=e*t/o,i=l+a*Math.sin(2*Math.PI*s*t/o+r);d.push(M_(n,i))}return d.push(M_(e,u)),`polygon(${d.join(`, `)})`},I_=(e,t,n,r)=>{let i=t/P_,a=[];for(let t=0;t<P_;t++){let o=t*i,s=i*n,c=r?o+i-s:o,l=r?o+i:o+s;a.push(M_(0,c),M_(e,c),M_(e,l),M_(0,l))}return`polygon(${a.join(`, `)})`};function L_(e,{width:t,height:n,to:r=`dark`,origin:i}={}){let a=r===`dark`,o=[];for(let r=0;r<=k_;r++){let s=r/k_,c=A_(s);switch(e){case`circle`:{let e=i?.x??t/2,r=i?.y??n/2,a=Math.hypot(Math.max(e,t-e),Math.max(r,n-r));o.push({clipPath:`circle(${j_(a*c)}px at ${j_(e)}px ${j_(r)}px)`});break}case`slide`:{let e=n*(1-c);o.push({clipPath:a?`inset(${j_(e)}px 0px 0px 0px)`:`inset(0px 0px ${j_(e)}px 0px)`});break}case`blinds`:o.push({clipPath:I_(t,n,c,a)});break;case`fade`:o.push({clipPath:`none`,opacity:c});break;case`none`:return[];default:o.push({clipPath:F_(t,n,c,s*N_.ripples*2*Math.PI,a)})}}return o}function R_(e,{effect:t=p_,to:n,origin:r,duration:i}={}){let a=document.documentElement,o=n!==void 0&&a.getAttribute(`data-bs-theme`)===n;if(t===`none`||o||y_(`(prefers-reduced-motion: reduce)`)||typeof document.startViewTransition!=`function`||typeof a.animate!=`function`)return e(),Promise.resolve(!1);a.classList.add(g_);let s=document.startViewTransition(e),c=i??h_[t]??h_.wave;return s.ready.then(()=>{let e=L_(t,{width:window.innerWidth,height:window.innerHeight,to:n,origin:r});a.animate(e,{duration:c,easing:`linear`,fill:`both`,pseudoElement:`::view-transition-new(root)`})}).catch(()=>{}),s.finished.catch(()=>{}).then(()=>(a.classList.remove(g_),!0))}function z_(){fe(),t(`wui-select`,Wa),t(`wui-country-select`,Ja),t(`wui-phone`,Yl),t(`wui-datepicker`,uo),t(`wui-date-range`,So),t(`wui-dock`,Co),t(`wui-image-crop`,Cs),t(`wui-kanban`,Qr),t(`wui-inline-edit`,Ls),t(`wui-consent-banner`,Ea),t(`wui-slider`,Hu),t(`wui-sortable`,$u),t(`wui-timepicker`,dd),t(`wui-tour`,Vf),t(`wui-tree`,Yf),t(`wui-autocomplete`,xi),t(`wui-command-palette`,ra),t(`wui-context-menu`,Va),t(`wui-multiselect`,Ac),t(`wui-taginput`,nd),t(`wui-otp`,_l),t(`wui-status-icon`,ni),t(`wui-shortcuts`,Lu),t(`wui-record-pager`,nu),t(`wui-carousel`,Ti),t(`wui-code-block`,qi),t(`wui-data-table`,eo),t(`wui-drawer`,Io),t(`wui-hover-card`,Uo),t(`wui-lightbox`,Zs),t(`wui-menubar`,Cc),t(`wui-navigation-menu`,Uc),t(`wui-notification-center`,sl),t(`wui-onboarding-checklist`,ml),t(`wui-overflow`,El),t(`wui-rating`,tu),t(`wui-relative-time`,hu),t(`wui-resizable`,Nu),t(`wui-rolling-number`,Iu),t(`wui-show-more`,Vu),t(`wui-truncate`,Xf),t(`wui-whats-new`,np),t(`wui-mention-input`,_c),t(`wui-comment-thread`,fa),t(`wui-wizard-step`,cp),t(`wui-wizard`,ap)}return z_(),e.AVATAR_ACCEPT=lp,e.AVATAR_MAX_SIZE_MB=up,e.AVATAR_OUTPUT_SIZE=dp,e.AVATAR_OUTPUT_TYPE=fp,e.AVATAR_PREVIEW_SIZES=pp,e.AVATAR_TEXT=mp,e.BAR_BULK_IN_BAR_ATTRIBUTE=og,e.COLUMN_MAX_WIDTH=He,e.COLUMN_MIN_WIDTH=Ve,e.COMMENT_INTENTS=aa,e.COMMENT_REACTIONS=ia,e.COMMENT_TEXT=U,e.CONFIRM_DIALOG_ID=Ap,e.CONFIRM_TONES=jp,e.COPY_FEEDBACK_MS=Gi,e.CSRF_META_NAME=en,e.CURRENCIES=me,e.DATA_TABLE_TEXT=A,e.DATE_PATTERNS=ge,e.DEFAULT_CSRF_HEADER=tn,e.DEFAULT_IMAGE_ACCEPT=mh,e.DEFAULT_MAX_SIZE_MB=hh,e.DEFAULT_PASSWORD_RULES=fg,e.DEFAULT_REQUIREMENTS_TITLE=pg,e.DEFAULT_THEME_EFFECT=p_,e.DEFAULT_THEME_STORAGE_KEY=m_,e.DISCARD_EVENT=Im,e.DISCARD_TEXT=Fm,e.DROP_OVER_CLASS=yg,e.DURATION_UNITS=O,e.EMPTY_VALUE=ve,e.FILTER_POPOVER_MAX_CHIPS=ne,e.FLASH_STORAGE_KEY=Np,e.FLASH_VARIANTS=Mp,e.FORMAT_STYLES=pe,e.HTTP_KINDS=rn,e.INLINE_EDIT_SAVED_MS=Ts,e.INLINE_EDIT_TEXT=Es,e.INLINE_EDIT_TYPES=ws,e.IST_TIME_ZONE=_e,e.KANBAN_DRAG_THRESHOLD_PX=Sr,e.KANBAN_LONG_PRESS_MS=xr,e.KANBAN_PHONE_QUERY=br,e.KANBAN_STORAGE_PREFIX=yr,e.KANBAN_SUMMARY_FORMATS=vr,e.KANBAN_TEXT=I,e.KANBAN_TONES=_r,e.LIST_KEYS=m,e.MASK_INPUT_TYPES=kh,e.MASK_NAMES=Lh,e.MENTION_ID_PATTERN=Qs,e.MENTION_MAX_QUERY=cc,e.MENTION_MAX_RESULTS=sc,e.MENTION_TEXT=lc,e.MONEY_UNITS=he,e.NOTIFICATION_COUNT_CAP=Wc,e.NOTIFICATION_TEXT=Kc,e.PIN_AT_VAR=nt,e.PIN_SIDES=Ge,e.RESIZE_STEP=Ue,e.RESIZE_STEP_LARGE=We,e.ROW_DRAG_TYPE=bg,e.ROW_DROP_EVENT=vg,e.ROW_HEIGHTS=qe,e.ROW_MOVE_LIMIT=ot,e.ROW_MOVE_MS=st,e.ROW_SAVE_ATTR=ht,e.ROW_SAVE_ERROR_CLASS=gt,e.ROW_SAVE_STATES=mt,e.SCROLL_EDGE_SELECTOR=Ug,e.SEARCH_OPEN_KEY=vp,e.SELECT_ALL_LABEL=Ct,e.SELECT_CELL_CLASS=M,e.SELECT_KEY=h,e.SELECT_ROW_LABEL=wt,e.SERVER_ACTION_TEXT=Pp,e.SHORTCUTS_OFF_ATTRIBUTE=u,e.SHORTCUT_EVENT=f,e.SHORTCUT_SCOPE_ATTRIBUTE=d,e.SHORTCUT_TEXT=p,e.STATUS_TONES=ti,e.THEME_BOOT_SCRIPT_BODY=T_,e.THEME_CHANGE_EVENT=__,e.THEME_EFFECTS=f_,e.THEME_EFFECT_DURATION=h_,e.THEME_MODES=d_,e.THEME_SWITCHING_CLASS=g_,e.TOAST_ACTION_METHODS=Jt,e.TOAST_ACTION_MS=qt,e.UNSAVED_TEXT=um,e.VIRTUAL_OVERSCAN=Ke,e.WHATS_NEW_READ_EVENT=Zf,e.WUI_HEADERS=N,e.WuiAutocomplete=xi,e.WuiCarousel=Ti,e.WuiCodeBlock=qi,e.WuiCommandPalette=ra,e.WuiCommentThread=fa,e.WuiConsentBanner=Ea,e.WuiContextMenu=Va,e.WuiCountrySelect=Ja,e.WuiDataTable=eo,e.WuiDatePicker=uo,e.WuiDateRange=So,e.WuiDock=Co,e.WuiDrawer=Io,e.WuiHoverCard=Uo,e.WuiImageCrop=Cs,e.WuiInlineEdit=Ls,e.WuiKanban=Qr,e.WuiLightbox=Zs,e.WuiMentionInput=_c,e.WuiMenubar=Cc,e.WuiMultiSelect=Ac,e.WuiNavigationMenu=Uc,e.WuiNotificationCenter=sl,e.WuiOnboardingChecklist=ml,e.WuiOtp=_l,e.WuiOverflow=El,e.WuiPhone=Yl,e.WuiRating=tu,e.WuiRecordPager=nu,e.WuiRelativeTime=hu,e.WuiResizable=Nu,e.WuiRollingNumber=Iu,e.WuiSelect=Wa,e.WuiShortcuts=Lu,e.WuiShowMore=Vu,e.WuiSlider=Hu,e.WuiSortable=$u,e.WuiStatusIcon=ni,e.WuiTagInput=nd,e.WuiTimePicker=dd,e.WuiTour=Vf,e.WuiTree=Yf,e.WuiTruncate=Xf,e.WuiWhatsNew=np,e.WuiWizard=ap,e.WuiWizardStep=cp,e.acceptLabel=Ch,e.addRowSelectCells=jt,e.addSelectColumn=Mt,e.applyBarBulk=ug,e.applyTheme=w_,e.ariaKeyShortcuts=te,e.attachInputMask=Qh,e.attachRowDrag=Bg,e.attachScrollEdges=Gg,e.attachShiftRange=Ft,e.avatarCropOptions=_p,e.avatarUnreadableMessage=gp,e.barBulkCountText=lg,e.buildPasswordRules=hg,e.clampColumnWidth=Ye,e.classifyStatus=cn,e.collapseSearch=Ep,e.confirmAction=qp,e.copyTextToClipboard=Ki,e.createDiscardPrompt=Km,e.createLocalSeenStore=Ff,e.createRequestQueue=dn,e.createSelectHeaderCell=Et,e.createSelectRowCell=Dt,e.createSelectSpacerCell=Ot,e.defineWeborityElements=z_,e.evaluatePassword=gg,e.formValues=ym,e.formatCompact=Pe,e.formatCurrency=Me,e.formatDate=ze,e.formatDuration=Ie,e.formatMasked=Gh,e.formatNumber=k,e.formatPercent=Fe,e.formatRelativeTime=su,e.formatValue=Be,e.getServerTable=Gt,e.getShell=u_,e.glyphSvg=j,e.groupCount=Je,e.groupItems=Xe,e.groupNotificationsByDay=Qc,e.identityCell=_t,e.inShortcutScope=T,e.initCollapsibleSearch=kp,e.initDrawerDiscard=ph,e.initInputMasks=ag,e.initPageBarBulk=dg,e.initRemoteModals=mr,e.initRowDrag=Hg,e.initScrollEdges=Zg,e.initServerActions=lm,e.initServerTables=Wt,e.initShellParts=l_,e.initUnsavedChanges=Nm,e.inlineEditText=Ds,e.isHeicFile=hp,e.isImageFile=bh,e.isImageOnlyAccept=Sh,e.isMaskPattern=zh,e.isPdfFile=xh,e.isTypingTarget=C,e.kanbanCardLabel=R,e.kanbanOverflow=Gr,e.kanbanStorageKey=Kr,e.kanbanSummaryFormat=Yr,e.kanbanVisibleLimit=Wr,e.loadRemoteDrawer=gr,e.loadRemoteModal=hr,e.maskedPostValue=Jh,e.matchSegments=Ji,e.matchesAccept=wh,e.measureRows=dt,e.mentionLabel=tc,e.mentionTextFromValue=ic,e.mentionValueFromText=ac,e.mentionedIds=oc,e.moveFocus=D,e.nextTheme=D_,e.notificationCountText=qc,e.notificationDayHeading=Zc,e.notificationTime=Xc,e.notificationTriggerLabel=Jc,e.notificationUnreadAnnouncement=Yc,e.openSearch=Tp,e.parseMentionValue=rc,e.parseToastAction=Zt,e.passwordSatisfies=_g,e.pinAtValue=rt,e.pinClasses=at,e.pinOffsetVar=tt,e.planPins=it,e.playRowMoves=ft,e.postedMasked=Wh,e.rawMasked=Uh,e.readColumnWidths=$e,e.readCsrf=on,e.readKanbanCollapsed=qr,e.readStoredTheme=S_,e.relativeTimeTitle=cu,e.resetUnsavedChanges=Pm,e.resolveMask=Vh,e.resolveTheme=x_,e.rowLabel=vt,e.rowOrderChanged=pt,e.runShortcut=E,e.runToastAction=$t,e.saveOutcomeText=xt,e.setRowSaveState=yt,e.settledRows=bt,e.shortcutKey=ee,e.shortcutName=S,e.shortcutsOff=w,e.showResultToast=Qt,e.storeTheme=C_,e.sumKanbanValues=Xr,e.syncSelectAll=Nt,e.syncTargets=Vg,e.themeBootScript=E_,e.themeKeyframes=L_,e.tickedKeys=jg,e.toInstant=Le,e.transitionTheme=R_,e.validateFile=Th,e.virtualRange=Ze,e.watchSystemTheme=O_,e.withTrustedLabel=pi,e.writeColumnWidths=et,e.writeKanbanCollapsed=Jr,e.wuiFetch=P,e})({});