@webority/ui-elements 0.54.0 → 0.55.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{n as e}from"./elementBase-BlsR4tqa.js";import{a as t,c as n,d as r,f as i,h as a,i as o,l as s,m as c,n as l,o as u,p as d,r as f,s as p,t as m,u as h}from"./formatters-BAE__8ye.js";import{a as g,c as _,i as v,n as y,o as ee,r as b,s as x,t as S}from"./wuiHttp-BC8co934.js";import{_ as C,a as te,c as w,d as T,f as E,g as D,h as ne,i as re,l as ie,m as ae,n as oe,o as se,p as ce,r as O,s as le,t as ue,u as de,v as fe,y as pe}from"./kanban-CdELdS3U.js";import{n as k,t as me}from"./statusIcons-2X4iGkKL.js";import{t as he}from"./iconGlyphs.g-CUm_mfze.js";import{i as ge}from"./optionLabel-DOZb8ERB.js";import{t as A}from"./WuiAutocomplete-DvXHihD6.js";import{t as j}from"./WuiCarousel-C33Z8FBt.js";import{t as _e}from"./WuiCodeBlock-BcLJhLBJ.js";import{n as ve,t as ye}from"./copyText-DM5HhXjf.js";import{t as M}from"./textMatch-wdY7XLIc.js";import{t as N}from"./WuiCommandPalette-B5OB6lsf.js";import{i as P,n as be,r as xe,t as Se}from"./WuiCommentThread-Bww7P_cu.js";import{t as F}from"./WuiConsentBanner-DWdHLSx9.js";import{t as I}from"./WuiContextMenu-CBy0O4HT.js";import{t as L}from"./WuiSelect-DcbtqI9s.js";import{t as R}from"./WuiCountrySelect-GJrl6sUP.js";import{A as z,C as B,D as V,E as Ce,M as we,N as Te,O as Ee,S as De,T as Oe,_ as ke,a as Ae,b as je,c as Me,d as Ne,f as Pe,g as Fe,h as Ie,i as H,j as Le,k as Re,l as ze,m as Be,n as Ve,o as He,p as Ue,r as We,s as Ge,t as Ke,u as qe,v as Je,w as Ye,x as Xe,y as Ze}from"./WuiDataTable-tR8Lp4XZ.js";import{t as Qe}from"./WuiDatePicker-CI7wLkmd.js";import{t as $e}from"./WuiDateRange-B5sO9usZ.js";import{t as et}from"./WuiDock-BD2HgMmP.js";import{t as tt}from"./WuiDrawer-BuvDLR6M.js";import{t as nt}from"./WuiHoverCard-CNEawHmO.js";import{t as rt}from"./WuiImageCrop-Cr3D2iPo.js";import{a as it,i as at,n as ot,r as st,t as ct}from"./WuiInlineEdit-CI-3C7yP.js";import{t as lt}from"./WuiLightbox-hluak_-q.js";import{a as ut,c as dt,i as ft,l as pt,n as mt,o as ht,r as gt,s as _t,t as vt,u as yt}from"./WuiMentionInput-DW7N1Zne.js";import{t as bt}from"./WuiMenubar-D2tb_3eU.js";import{t as xt}from"./WuiMultiSelect-BCZE2VHM.js";import{t as St}from"./WuiNavigationMenu-BsLnvz2Y.js";import{a as Ct,c as wt,i as Tt,n as Et,o as Dt,r as Ot,s as kt,t as At}from"./notificationDays-pYmoU0g6.js";import{t as jt}from"./WuiNotificationCenter-DKdvaSbm.js";import{t as Mt}from"./WuiOnboardingChecklist-s2DG6PZ0.js";import{t as Nt}from"./WuiOtp-BbO_75RB.js";import{t as Pt}from"./WuiOverflow-CB3j6q6n.js";import{t as Ft}from"./WuiPhone-CSUVhYSb.js";import{t as It}from"./WuiRating-BzeW6iDC.js";import{a as Lt,c as Rt,d as zt,f as Bt,i as Vt,l as Ht,m as Ut,n as Wt,o as Gt,p as Kt,r as qt,s as Jt,t as Yt,u as Xt}from"./shortcutKeys-BQiDpsTJ.js";import{t as Zt}from"./WuiRecordPager-yXv4g2ZR.js";import{n as Qt,r as $t,t as en}from"./WuiRelativeTime-Cfc8TMd8.js";import{t as tn}from"./WuiResizable-m2Ypa-zD.js";import{t as nn}from"./WuiRollingNumber-DBgi_3l7.js";import{t as rn}from"./WuiShortcuts-CMibF1XM.js";import{t as an}from"./WuiShowMore-Bu7IQcXS.js";import{t as on}from"./WuiSlider-Br6V2amU.js";import{t as sn}from"./WuiSortable-Bd7Fz5Ox.js";import{t as cn}from"./WuiTagInput-DzEZooIn.js";import{t as ln}from"./WuiTimePicker-Bolpp93P.js";import{n as un,t as dn}from"./WuiTour-CUWrh5MD.js";import{t as fn}from"./WuiTree-SA0QU9AF.js";import{t as pn}from"./WuiTruncate-BLl2u3b-.js";import{n as mn,t as hn}from"./WuiWhatsNew-BO78119Z.js";import{n as gn,t as _n}from"./WuiWizardStep-DIHxrXn9.js";import{$ as vn,A as yn,B as bn,C as xn,D as Sn,E as Cn,F as wn,G as Tn,H as En,I as Dn,J as On,K as kn,L as An,M as jn,N as Mn,O as Nn,P as Pn,Q as Fn,R as In,S as Ln,T as Rn,U as zn,V as Bn,W as Vn,X as Hn,Y as Un,Z as Wn,_ as Gn,a as Kn,b as qn,c as Jn,d as Yn,f as Xn,g as Zn,h as Qn,i as $n,j as er,k as tr,l as nr,m as rr,n as ir,o as ar,p as or,q as sr,r as cr,s as lr,t as ur,u as dr,v as fr,w as pr,x as mr,y as hr,z as gr}from"./themeTransition-C61cbmZ4.js";var _r=`Select all rows`,vr=`Select row`,U=`wui-select-cell`,yr=(e,t)=>{let n=e.createElement(`input`);return n.type=`checkbox`,n.className=`wui-check`,n.setAttribute(`aria-label`,t),n};function br(e=document){let t=e.createElement(`th`);return t.className=U,t.appendChild(yr(e,_r)),t}function xr(e=document){let t=e.createElement(`td`);return t.className=U,t.appendChild(yr(e,vr)),t}function Sr(e=document){let t=e.createElement(`td`);return t.className=U,t}var Cr=e=>e.firstElementChild?.classList.contains(U),wr=e=>e.matches(`.wui-group-row, .wui-virtual-spacer`);function Tr(e){for(let t of e)!Cr(t)&&!wr(t)&&t.insertBefore(xr(t.ownerDocument),t.firstChild)}function Er(e){let t=e.querySelector(`thead tr`);if(!t)return null;Cr(t)||t.insertBefore(br(e.ownerDocument),t.firstChild),Tr(e.querySelectorAll(`tbody tr`));for(let t of e.querySelectorAll(`tfoot tr`))Cr(t)||t.insertBefore(Sr(e.ownerDocument),t.firstChild);return t.querySelector(`.${U} .wui-check`)}function Dr(e){let t=e.querySelector(`thead .${U} .wui-check`),n=[...e.querySelectorAll(`tbody tr .wui-check`)],r=n.length,i=n.filter(e=>e.checked).length;t&&(t.checked=r>0&&i===r,t.indeterminate=i>0&&i<r);for(let t of e.querySelectorAll(`tbody tr`))t.classList.toggle(`is-selected`,!!t.querySelector(`.wui-check`)?.checked);return{selected:i,total:r}}var Or=`tbody .${U} .wui-check`;function kr(e,t){let n=null,r=e=>e instanceof Element&&e.matches(`.wui-select-cell .wui-check`)&&!!e.closest(`tbody`);e.addEventListener(`mousedown`,e=>{e.shiftKey&&r(e.target)&&e.preventDefault()}),e.addEventListener(`click`,i=>{let a=i.target;if(r(a)){if(i.shiftKey&&n?.isConnected&&n!==a){let r=[...e.querySelectorAll(Or)],i=r.indexOf(n),o=r.indexOf(a);if(i>=0&&o>=0){let e=[];for(let t of r.slice(Math.min(i,o),Math.max(i,o)+1))t===a||t.checked===a.checked||(t.checked=a.checked,e.push(t));e.length&&t?.(e,a.checked)}}n=a}})}var Ar=Object.freeze([`page`,`pageSize`,`sortBy`,`sortOrder`]),W=`search`,G=Object.freeze({loading:`Loading rows`,error:`These rows did not load. Try again.`,network:`The connection dropped before the rows loaded. Check it and try again.`,forbidden:`You do not have access to these rows.`,retry:`Retry`,actionFailed:`That did not work. Try again.`,actionForbidden:`You do not have permission to do that.`,empty:`No rows`}),jr=5,Mr=new WeakMap,Nr=(e,t)=>{let n=Number(e);return Number.isInteger(n)?n:t},Pr=e=>({total:Nr(e.dataset.total,0),page:Nr(e.dataset.page,1),pageSize:Nr(e.dataset.pageSize,0),sortBy:e.dataset.sortBy||``,sortOrder:e.dataset.sortOrder===`desc`?`desc`:`asc`}),Fr=(e,t)=>{e&&window.WUI?.toast?.(e,{variant:t})};function Ir(e=document){let t=e.querySelectorAll?[...e.querySelectorAll(`[data-wui-server]`)]:[];e instanceof Element&&e.matches(`[data-wui-server]`)&&t.unshift(e);for(let e of t)Mr.has(e)||Mr.set(e,Rr(e))}function Lr(e){let t=e instanceof Element?e.closest(`[data-wui-server]`):null;return t&&Mr.get(t)||null}function Rr(e){let t=e.querySelector(`.table-wrap`),n=t?.querySelector(`:scope > table`),r=e.dataset.src;if(!n||!r)throw Error(`A server-paged table needs data-src and a .table-wrap > table: render it with <app-data-table src>.`);let i=t.querySelector(`:scope > [data-wui-table-state]`),a=e.querySelector(`[data-wui-table-pager]`),o=e.querySelector(`[data-wui-table-status]`),s={urlState:e.dataset.urlState!==`false`,refreshOnSuccess:e.dataset.refreshOnSuccess!==`false`,filtersForm:e.dataset.filtersForm||null,filtersRegion:e.dataset.filtersRegion||null,searchInput:e.dataset.searchInput||null,loadingText:e.dataset.loadingText||G.loading,errorText:e.dataset.errorText||G.error},c=new URL(r,window.location.href),l=new Set(c.searchParams.keys()),u=n.hasAttribute(`data-app-datatable-selectable`),d=new Set,f=!1,p=ee(),m=new AbortController,h={signal:m.signal},g=n.querySelector(`:scope > tbody[data-wui-rows]`);if(!g)throw Error(`A server-paged table needs its rows in <app-table-rows> (tbody[data-wui-rows]).`);let v=Pr(g),y=null,b=null,x=e=>{let t=new URLSearchParams;for(let[n,r]of new URLSearchParams(e))l.has(n)||t.append(n,r);return t},S=e=>x(new URL(e,window.location.href).search),C=e=>{let t=e.toString();return`${window.location.pathname}${t?`?${t}`:``}${window.location.hash}`},te=e=>{let t=new URL(c.href);for(let[n,r]of e)l.has(n)||t.searchParams.append(n,r);return t.origin===window.location.origin?`${t.pathname}${t.search}`:t.href},w=(e,t)=>{let n=new URLSearchParams(e);return n.has(`page`)&&n.set(`page`,String(t.page)),n.has(`pageSize`)&&n.set(`pageSize`,String(t.pageSize)),n.has(`sortBy`)?t.sortBy?(n.set(`sortBy`,t.sortBy),n.set(`sortOrder`,t.sortOrder)):(n.delete(`sortBy`),n.delete(`sortOrder`)):n.delete(`sortOrder`),n},T=w(s.urlState?x(window.location.search):new URLSearchParams,v);s.urlState&&C(T)!==`${window.location.pathname}${window.location.search}${window.location.hash}`&&window.history.replaceState(window.history.state,``,C(T));let E=(e,n)=>t.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:n})),D=e=>{o&&(o.textContent=e)},ne=e=>{if(e.total===0)return G.empty;let t=e.pageSize>0?Math.max(1,Math.ceil(e.total/e.pageSize)):1;return`Page ${e.page} of ${t}, ${e.total} ${e.total===1?`row`:`rows`}`},re=()=>[...n.querySelectorAll(`:scope > thead > tr:first-child > th`)],ie=e=>{if(u&&[...e.querySelectorAll(`:scope > tr`)].some(e=>!e.dataset.rowKey))throw Error(`A selectable server-paged table needs data-row-key on every row, so a selection can span pages.`)},ae=t=>{let n=e.dataset.activeRowKey;if(n!==void 0)for(let e of t){let t=e.classList.contains(`wui-row-active`),r=n!==``&&e.dataset.rowKey===n;e.classList.toggle(`wui-row-active`,r),r?e.setAttribute(`aria-current`,`true`):t&&e.removeAttribute(`aria-current`)}},oe=e=>{if(u){Tr(e);for(let t of e){let e=t.querySelector(`.${U} .wui-check`);e&&(f&&d.add(t.dataset.rowKey),e.checked=d.has(t.dataset.rowKey))}Dr(n)}ae(e);let t=re();if(n.classList.contains(`wui-table-stack`))for(let n of e)[...n.cells].forEach((e,n)=>{let r=t[n]?.textContent.trim();r&&!e.hasAttribute(`data-label`)&&e.setAttribute(`data-label`,r)});t.forEach((t,n)=>{if(t.classList.contains(`wui-col-hidden`))for(let t of e)t.cells[n]?.classList.add(`wui-col-hidden`)})},se=e=>oe([...e.querySelectorAll(`:scope > tr`)]),ce=e=>{for(let t of e.querySelectorAll(`:scope > template[data-wui-pager], :scope > template[data-wui-empty], :scope > template[data-wui-filters]`))t.remove()},O=e=>e?.dispatchEvent(new CustomEvent(`wui:teardown`,{bubbles:!0})),le=(e,t)=>{if(!i)return;let n=e.querySelector(`:scope > template[data-wui-empty]`);O(i),t.total===0&&n?(i.replaceChildren(n.content.cloneNode(!0)),i.hidden=!1):(i.replaceChildren(),i.hidden=!0)},ue=e=>{let r=Pr(e),i=r.sortBy!==v.sortBy||r.sortOrder!==v.sortOrder?je(g.rows):null;if(a){let t=e.querySelector(`:scope > template[data-wui-pager]`);O(a),a.replaceChildren(...t?[t.content.cloneNode(!0)]:[]),a.hidden=!1}le(e,r);let o=e.querySelector(`:scope > template[data-wui-filters]`),c=s.filtersRegion&&o?document.querySelector(s.filtersRegion):null;c&&(O(c),c.replaceChildren(o.content.cloneNode(!0))),ce(e),O(g),n.replaceChild(e,g),g=e;let l=f&&r.total!==v.total;v=r,l&&(f=!1),t.removeAttribute(`data-wui-table-error`),se(e),ve(),Oe(e.rows,i),l&&M()},de=e=>{let t=document.createElement(`template`);t.innerHTML=`<table>${e}</table>`;let n=t.content.querySelector(`tbody[data-wui-rows]`);return n&&ie(n),n?document.importNode(n,!0):null},fe=e=>{let t=document.createElement(`tr`);for(let n=0;n<e;n++){let e=document.createElement(`td`),r=document.createElement(`span`);r.className=`skeleton`,r.setAttribute(`aria-hidden`,`true`),r.style.cssText=`display:block;width:${n===0?70:50}%;height:12px;border-radius:6px`,e.append(r),t.append(e)}return t},pe=()=>{if(g.querySelector(`:scope > tr:not([data-wui-skeleton])`))return;let e=Math.max(1,re().length);g.replaceChildren(...Array.from({length:jr},()=>{let t=fe(e);return t.setAttribute(`data-wui-skeleton`,``),t})),t.removeAttribute(`data-wui-table-error`),i&&(i.hidden=!0)},k=e=>{e?(t.setAttribute(`aria-busy`,`true`),pe()):t.removeAttribute(`aria-busy`)},me=e=>e===`forbidden`?G.forbidden:e===`network`?G.network:s.errorText,ge=e=>{let n=me(e);if(t.setAttribute(`data-wui-table-error`,e),a&&(a.hidden=!0),i){let t=document.createElement(`div`);t.className=`tbl-empty wui-table-error`,t.setAttribute(`role`,`alert`);let r=document.createElement(`span`);r.className=`tbl-empty-icon`,r.innerHTML=he(e===`forbidden`?`lock`:`alert-circle`,{size:24});let a=document.createElement(`div`);a.className=`tbl-empty-title`,a.textContent=n;let o=document.createElement(`div`);o.className=`tbl-empty-action`;let s=document.createElement(`button`);s.type=`button`,s.className=`btn btn-outline-primary btn-sm`,s.setAttribute(`data-wui-table-retry`,``),s.textContent=G.retry,o.append(s),t.append(r,a,o),O(i),i.replaceChildren(t),i.hidden=!1}D(n)},A=async(e,t=`none`)=>{let n=new URLSearchParams(e);y={query:n,mode:t},k(!0),D(s.loadingText),E(`wui:table:loading`,{query:n.toString()});let r=await p.run(te(n));if(r.kind===`aborted`||r.kind===`stale`||r.kind===`session`)return r;k(!1);let i=null,a=r.ok?null:r.kind;if(r.ok){try{i=de(r.html)}catch(e){console.error(e)}i||(a=`server`)}return a?(ge(a),E(`wui:table:error`,{status:r.status,kind:a,message:me(a)}),r):(ue(i),T=w(n,v),s.urlState&&t===`push`?window.history.pushState(window.history.state,``,C(T)):s.urlState&&t===`replace`&&window.history.replaceState(window.history.state,``,C(T)),D(ne(v)),window.WUI?.refresh?.(),E(`wui:table:loaded`,{...v,query:T.toString()}),r)},j=e=>(e.delete(`page`),e),_e=()=>[...n.querySelectorAll(`:scope > thead th[data-sort-key]`)],ve=()=>{for(let e of _e()){let t=e.dataset.sortKey===v.sortBy;e.setAttribute(`aria-sort`,t?v.sortOrder===`desc`?`descending`:`ascending`:`none`)}};for(let e of _e())if(e.classList.add(`sortable`),e.tabIndex=0,!e.querySelector(`.sort-icon`)){let t=e.classList.contains(`num`)||e.classList.contains(`text-end`),n=document.createElement(`span`);n.className=t?`sort-icon wui-sort-lead`:`sort-icon`,n.innerHTML=he(`chevrons-up-down`,{size:14}),t?e.prepend(n):e.append(n)}let ye=e=>{let t=j(new URLSearchParams(T)),n=v.sortBy===e&&v.sortOrder===`asc`?`desc`:`asc`;return t.set(`sortBy`,e),t.set(`sortOrder`,n),A(t,`push`)};n.addEventListener(`click`,e=>{let t=e.target.closest(`th[data-sort-key]`);t&&n.tHead?.contains(t)&&ye(t.dataset.sortKey)}),n.addEventListener(`keydown`,e=>{if(e.key!==`Enter`&&e.key!==` `)return;let t=e.target.closest?.(`th[data-sort-key]`);!t||!n.tHead?.contains(t)||(e.preventDefault(),ye(t.dataset.sortKey))});let M=()=>{Dr(n);let e=f?{selected:v.total,total:v.total,allMatching:f}:{selected:d.size,total:v.total};n.dispatchEvent(new CustomEvent(`selectionchange`,{bubbles:!0,detail:e}))};u&&(kr(n,(e,t)=>{for(let n of e){let e=n.closest(`tr`)?.dataset.rowKey;e&&(t?d.add(e):d.delete(e))}t||(f=!1)}),n.addEventListener(`change`,e=>{let t=e.target;if(t.matches?.(`.wui-select-cell .wui-check`)){if(t.checked||(f=!1),n.tHead?.contains(t))for(let e of g.querySelectorAll(`:scope > tr`)){let n=e.querySelector(`.${U} .wui-check`);n&&(n.checked=t.checked,t.checked?d.add(e.dataset.rowKey):d.delete(e.dataset.rowKey))}else{let e=t.closest(`tr`)?.dataset.rowKey;if(!e)return;t.checked?d.add(e):d.delete(e)}M()}})),a&&(a.addEventListener(`click`,e=>{let t=e.target.closest(`a[href]`);!t||e.defaultPrevented||e.button!==0||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey||(e.preventDefault(),A(S(t.getAttribute(`href`)),`push`))}),a.addEventListener(`change`,e=>{!e.target.classList?.contains(`tpg-select`)||!e.target.value||(e.stopPropagation(),A(S(e.target.value),`push`))}));let N=()=>{if(!s.searchInput)return null;let e=document.querySelector(s.searchInput);return e&&(e.matches(`input, textarea`)?e:e.querySelector(`input`))},P=()=>e.isConnected?!0:(m.abort(),clearTimeout(b),!1),be=(e,t)=>{let n=t?.name?new FormData(e,t):new FormData(e),r=new Set([...e.querySelectorAll(`[name]`)].map(e=>e.getAttribute(`name`))),i=new URLSearchParams;for(let[e,t]of T)e!==`page`&&(Ar.includes(e)||!r.has(e))&&i.append(e,t);for(let[e,t]of n)typeof t!=`string`||t===``||Ar.includes(e)||l.has(e)||i.append(e,t);let a=N();if(a){i.delete(W);let e=a.value.trim();e&&i.set(W,e)}return A(i,`push`)},xe=e=>s.filtersForm&&e.closest?.(s.filtersForm)||s.filtersRegion&&e.closest?.(s.filtersRegion)||null;document.addEventListener(`submit`,e=>{!P()||!s.filtersForm||!(e.target instanceof HTMLFormElement)||!e.target.matches(s.filtersForm)||(e.preventDefault(),be(e.target,e.submitter))},h),document.addEventListener(`change`,e=>{if(!P()||!s.filtersForm)return;let t=e.target.closest?.(s.filtersForm);!t||e.target===N()||be(t)},h);let Se=(e,t)=>{if(!e)return;let n=e=>t.get(e)??``;for(let r of e.querySelectorAll(`input[name]:not([type=hidden])`))if(r.type===`checkbox`)r.checked=t.getAll(r.name).includes(r.value);else if(r.type===`radio`){let e=n(r.name)===r.value;if(r.checked===e)continue;r.checked=e,e&&r.dispatchEvent(new Event(`change`))}else r.value!==n(r.name)&&(r.value=n(r.name),r.dispatchEvent(new Event(`input`,{bubbles:!0})));for(let r of e.querySelectorAll(`select[name]`))if(!r.multiple)r.value=n(r.name);else for(let e of r.options)e.selected=t.getAll(r.name).includes(e.value);for(let t of e.querySelectorAll(`wui-select[name]`))t.value=n(t.getAttribute(`name`));for(let n of e.querySelectorAll(`wui-multiselect[name]`))n.values=t.getAll(n.getAttribute(`name`));for(let t of e.querySelectorAll(`wui-date-range`)){let e=t.getAttribute(`start-name`)||t.getAttribute(`name`),r=t.getAttribute(`end-name`);t.value={start:e?n(e):``,end:r?n(r):``}}};document.addEventListener(`click`,e=>{if(!P())return;let t=e.target.closest?.(`a[href]`);if(!t||!xe(t)||e.defaultPrevented||e.button!==0||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey)return;let n=new URL(t.getAttribute(`href`),window.location.href);if(n.origin!==window.location.origin||n.pathname!==window.location.pathname)return;e.preventDefault();let r=j(S(n.href));Se(t.closest(`form`),r),A(r,`push`)},h),document.addEventListener(`input`,e=>{if(!P())return;let t=N();!t||e.target!==t||(clearTimeout(b),b=setTimeout(()=>{let e=j(new URLSearchParams(T)),n=t.value.trim();n?e.set(W,n):e.delete(W),e.toString()!==T.toString()&&A(e,`replace`)},300))},h),s.urlState&&window.addEventListener(`popstate`,()=>{if(!P())return;let e=x(window.location.search),t=N();t&&(t.value=e.get(`search`)??``),A(e,`none`)},h),document.addEventListener(`wui:modal:success`,()=>{P()&&s.refreshOnSuccess&&A(T,`none`)},h),i?.addEventListener(`click`,e=>{e.target.closest(`[data-wui-table-retry]`)&&y&&A(y.query,y.mode)});let F=e=>[...g.rows].find(t=>t.dataset.rowKey===e)??null,I=e=>{if(!e?.trim())return null;let t=document.createElement(`template`);if(t.innerHTML=`<table><tbody>${e}</tbody></table>`,t.content.querySelector(`tbody[data-wui-rows]`))return null;let n=[...t.content.querySelectorAll(`table > tbody > tr[data-row-key]`)];return n.length?n.map(e=>document.importNode(e,!0)):null},L=(e,t,n)=>{let r=n?e[0]:e.find(e=>e.dataset.rowKey===t.dataset.rowKey);if(!r)return null;let i=[];for(let n of e){let e=n===r?t:F(n.dataset.rowKey);e&&(O(e),e.replaceWith(n),i.push(n))}return oe(i),window.WUI?.refresh?.(),r},R=e=>e.message||(e.kind===`forbidden`?G.actionForbidden:G.actionFailed),B=e=>{e?.isConnected&&e.getAttribute(`data-wui-save-state`)===`saving`&&z(e,null)},Ce=e=>{if(e instanceof HTMLTableRowElement)return e;let t=document.createElement(`template`);t.innerHTML=`<table><tbody>${String(e)}</tbody></table>`;let n=t.content.querySelector(`table > tbody > tr`);if(!n)throw Error("saveRow's `row` is the row as it will read: a <tr> element or its HTML.");return document.importNode(n,!0)},we=async({url:e,method:n=`POST`,body:r,key:a,row:o}={})=>{if(!e)throw Error("saveRow needs `url`: the handler that saves the row.");let s=a==null,c=s?null:F(String(a));if(!s&&!c)throw Error(`saveRow found no row with data-row-key="${a}" on this page.`);let l=re().filter(e=>!e.classList.contains(U)).length,u=o?Ce(o):c??fe(Math.max(1,l));c&&u!==c?c.replaceWith(u):c||g.insertBefore(u,g.firstChild),u!==c&&oe([u]),i&&!t.hasAttribute(`data-wui-table-error`)&&(i.hidden=!0),z(u,`saving`);let d=V(u),f=await _(e,{method:n.toUpperCase(),body:r});if(f.kind===`session`)return!1;if(f.ok){let e=I(f.html),t=e&&u.isConnected?L(e,u,s):null;return t?D(H.saved(V(t)||d)):(await A(T,`none`),B(u)),Fr(f.message,f.toastVariant||`success`),E(`wui:table:saved`,{key:t?.dataset.rowKey??(s?null:String(a)),added:s,status:f.status}),!0}let p=R(f),m=u;return c&&u!==c&&u.isConnected?(u.replaceWith(c),m=c):s&&!o&&(u.remove(),m=null,i?.childElementCount&&!g.querySelector(`:scope > tr`)&&(i.hidden=!1)),m?.isConnected&&z(m,`error`,p),f.kind!==`aborted`&&Fr(p,`danger`),D(H.notSaved(d,p)),E(`wui:table:failed`,{key:s?null:String(a),added:s,status:f.status,kind:f.kind,message:p}),!1},Te=async e=>{let t=e.dataset.url;if(!t)throw Error(`A data-wui-row-action button needs data-url: the handler the action posts to.`);let n=e.closest(`tr`),r=n?.dataset.rowKey??null,i=e.dataset.wuiRowAction||``,a=n?V(n):``;e.disabled=!0,e.setAttribute(`aria-busy`,`true`),n&&z(n,`saving`);let o=await _(t,{method:(e.dataset.method||`post`).toUpperCase()});if(e.disabled=!1,e.removeAttribute(`aria-busy`),o.kind===`session`||o.kind===`aborted`){B(n);return}if(o.ok){Fr(o.message,o.toastVariant||`success`);let e=n?.isConnected?I(o.html):null,t=e?L(e,n,!1):null;t?D(H.saved(V(t)||a)):(await A(T,`none`),B(n))}else{let e=R(o);Fr(e,`danger`),n?.isConnected&&z(n,`error`,e),D(H.notSaved(a,e))}E(`wui:table:action`,{action:i,key:r,ok:o.ok,status:o.status})};return n.addEventListener(`click`,e=>{let t=e.target.closest(`[data-wui-row-action]`);!t||!g.contains(t)||t.disabled||(e.preventDefault(),Te(t))}),ie(g),ce(g),u&&Er(n),se(g),ve(),{el:e,reload:()=>A(T,`none`),query:()=>new URLSearchParams(T),setQuery:e=>{let t=new URLSearchParams(T);for(let[n,r]of Object.entries(e??{})){t.delete(n);for(let e of Array.isArray(r)?r:[r])e!=null&&e!==``&&t.append(n,String(e))}return(!e||!(`page`in e))&&t.delete(`page`),A(t,`push`)},saveRow:we,setActiveRow:t=>{e.dataset.activeRowKey=t==null?``:String(t),ae([...g.querySelectorAll(`:scope > tr`)])},selection:{keys:()=>[...d],count:()=>f?v.total:d.size,allMatching:()=>f,selectAllMatching:()=>{f=!0;for(let e of g.querySelectorAll(`:scope > tr`)){let t=e.querySelector(`.${U} .wui-check`);t&&(t.checked=!0),e.dataset.rowKey&&d.add(e.dataset.rowKey)}M()},clear:()=>{f=!1,d.clear();for(let e of g.querySelectorAll(`:scope > tr > .${U} .wui-check`))e.checked=!1;M()}}}}var K=`wuiConfirm`,zr=Object.freeze([`danger`]),Br=Object.freeze([`success`,`info`,`warning`,`danger`]),Vr=`wui.flash`,q=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.`}),Hr=new WeakSet,Ur=new WeakSet,J=null,Wr=null,Gr=!1,Kr=e=>{let t=document.createElement(`span`);return t.textContent=e??``,t.innerHTML},qr=(e,t)=>{e&&window.WUI?.toast?.(e,{variant:t})},Jr=()=>{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 Yr(){let e=document.getElementById(K);return e||(e=document.createElement(`div`),e.id=K,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`,`${C.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">${Kr(q.cancelLabel)}</button><button type="button" class="btn btn-primary" data-app-confirm></button></div></div></div></div>`,document.body.appendChild(e),e)}function Xr(e,t){let n=e.getAttribute(`data-wui-confirm-tone`);if(n!==null&&!zr.includes(n))throw TypeError(`data-wui-confirm-tone="${n}" is not supported. Use danger, or leave it off.`);Zr({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 Zr({title:e,message:t,label:n,danger:r},i){let a=Jr(),o=Yr(),s=o.querySelector(`.wui-confirm-title`),c=o.querySelector(`[data-app-confirm]`);if(!s||!c)throw Error(`#${K} is not a confirm dialog with a confirm button. Render <app-confirm-dialog id="${K}"> 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||q.confirmTitle,l.textContent=t,c.textContent=n||q.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),Wr=i,Gr=!1,a.getOrCreateInstance(o).show()}var Qr=(e,t)=>{J=e;try{t()}finally{J=null}};function $r(e,{title:t,message:n,label:r,tone:i},a){if(i!=null&&!zr.includes(i))throw TypeError(`confirmAction: tone "${i}" is not supported. Use danger, or leave it off.`);fi(e.ownerDocument),Zr({title:t,message:n,label:r,danger:i===`danger`},()=>Qr(e,a))}var ei=e=>e.disabled===!0||e.getAttribute(`aria-disabled`)===`true`;function ti(e){let t=e.target.closest?.(`[data-wui-confirm]:not(form)`);!t||t===J||ei(t)||(e.preventDefault(),e.stopImmediatePropagation(),Xr(t,()=>Qr(t,()=>t.click())))}function ni(e){let t=e.target;if(!(t instanceof HTMLFormElement)||!t.hasAttribute(`data-wui-confirm`)||t===J||e.submitter&&e.submitter===J)return;e.preventDefault(),e.stopImmediatePropagation();let n=e.submitter?.form===t?e.submitter:void 0;Xr(t,()=>Qr(t,()=>t.requestSubmit(n)))}function ri(e){let t=e.target.closest?.(`#${K} [data-app-confirm]`);!t||t.disabled||!Wr||(Gr=!0,Jr().getOrCreateInstance(t.closest(`#${K}`)).hide())}function ii(e){if(e.target.id!==`wuiConfirm`)return;let t=Gr?Wr:null;Wr=null,Gr=!1,t?.()}var ai=(e,t)=>{e&&window.sessionStorage.setItem(Vr,JSON.stringify({message:e,variant:t}))},oi=e=>e===`forbidden`?q.forbidden:e===`network`?q.network:q.failed;function si(){for(let e of document.querySelectorAll(`[data-wui-server]`))e.dataset.refreshOnSuccess!==`false`&&Lr(e)?.reload()}async function ci(e){let t=e.getAttribute(`data-wui-post`);if(!t)throw Error(`A data-wui-post button needs the URL the action posts to.`);let n=e.getAttribute(`data-wui-post-reload`);if(n!==null&&n!==`page`)throw TypeError(`data-wui-post-reload="${n}" is not supported. Use page, or leave it off to reload the server tables.`);e.disabled=!0,e.setAttribute(`aria-busy`,`true`);let r=await _(t,{method:`POST`});if(r.kind===`session`||r.kind===`aborted`)return;let i=r.toastVariant||`success`;if(r.ok&&(r.redirect||n===`page`)){ai(r.message,i),r.redirect?window.location.assign(r.redirect):window.location.reload();return}if(e.disabled=!1,e.removeAttribute(`aria-busy`),r.ok){qr(r.message,i),si();return}qr(r.message||oi(r.kind),`danger`)}function li(e){let t=e.target.closest?.(`[data-wui-post]`);t&&(e.preventDefault(),!(ei(t)||t.getAttribute(`aria-busy`)===`true`)&&ci(t).catch(e=>console.error(e)))}function ui(){let e=window.sessionStorage.getItem(Vr);if(!e)return;window.sessionStorage.removeItem(Vr);let{message:t,variant:n}=JSON.parse(e);qr(t,n)}function di(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(!Br.includes(t))throw TypeError(`data-wui-flash-variant="${t}" is not supported. Use ${Br.join(`, `)}.`);let n=e.getAttribute(`data-wui-flash`)||e.textContent.trim();e.remove(),qr(n,t)}}function fi(e){Ur.has(e)||(Ur.add(e),e.addEventListener(`click`,ri),e.addEventListener(`hidden.bs.modal`,ii))}function pi(e=document){let t=e.ownerDocument||e;Hr.has(t)||(Hr.add(t),t.addEventListener(`click`,ti,!0),t.addEventListener(`submit`,ni,!0),fi(t),t.addEventListener(`click`,li),ui()),di(e)}var mi=31536e3,Y=new WeakMap,hi=e=>e>99?`99+`:String(e);function gi(e,t,n=document){n.cookie=`${e}=${t?`1`:`0`}; Path=/; Max-Age=${mi}; SameSite=Lax`}var _i=e=>{let t=document.createElement(`template`);return t.innerHTML=e,t.content},vi=(e,t)=>{let n=document.createElement(`div`);return n.className=e,n.textContent=t,n};function yi(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=ee(),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=hi(o),r.hidden=o===0),n?.setAttribute(`aria-label`,o===0?l:`${l}, ${hi(o)} unread`),a&&s&&i&&(i.textContent=o===0?`No unread notifications`:`${hi(o)} unread notifications`)},h=()=>o?.classList.contains(`show`)??!1,g=()=>{let e=vi(`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)},v=async t=>{t&&(a.setAttribute(`aria-busy`,`true`),a.querySelector(`.wui-bell-item`)||a.replaceChildren(vi(`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=_i(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(vi(`wui-bell-state`,u))),e.dispatchEvent(new CustomEvent(`wui:notifications:loaded`,{bubbles:!0,detail:{unread:o}}))};e.addEventListener(`show.bs.dropdown`,()=>v(!0)),e.addEventListener(`click`,async e=>{if(e.target.closest(`[data-wui-bell-retry]`)){v(!0);return}let t=e.target.closest(`[data-wui-bell-read]`);if(!t||!c)return;t.disabled=!0;let n=await _(c,{method:`POST`});t.disabled=!1,n.ok&&(m(0),v(!0))});let y=null,b=()=>{d>0&&y===null&&(y=setInterval(()=>v(h()),d*1e3))},x=()=>{y!==null&&clearInterval(y),y=null},S=()=>{document.hidden?x():(v(h()),b())};return d>0&&(document.addEventListener(`visibilitychange`,S),document.hidden||b()),t.push(()=>{x(),f.abort(),document.removeEventListener(`visibilitychange`,S)}),{setUnread:e=>m(e),refresh:()=>v(h())}}var bi=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName)),xi=(e,t,n)=>`${e}${e.includes(`?`)?`&`:`?`}${encodeURIComponent(t)}=${encodeURIComponent(n)}`;function Si(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=ee(),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(xi(o,s,t));if(!(n.kind===`aborted`||n.kind===`stale`||n.kind===`session`)){if(e.classList.remove(`is-loading`),n.ok){let e=_i(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(vi(`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(xi(c,s,n.value.trim())))}else t.key===`Escape`&&(r.hidden?e.classList.contains(`is-open`)&&(t.preventDefault(),v(!1),i?.focus()):(t.preventDefault(),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||bi(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 Ci(e){let t=[],n=e.dataset.wuiCollapsedCookie;n&&e.addEventListener(`wui:shell:collapse`,e=>gi(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?yi(r,t):null,a=e.querySelector(`[data-wui-topsearch]`);a&&Si(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)}};Y.set(e,o);let s=n=>{if(n.target===e||n.target.contains?.(e)){for(let e of t)e();Y.delete(e),delete e.dataset.wuiPartsWired,document.removeEventListener(`wui:teardown`,s)}};return document.addEventListener(`wui:teardown`,s),o}function wi(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`,Ci(e))}function Ti(e){let t=e?.closest?.(`[data-app-shell]`)??null;return t?(Y.has(t)||wi(t),Y.get(t)??null):null}var X=Object.freeze({title:`Leave without saving?`,message:`Your changes on this page are not saved. If you leave now, they are lost.`,leaveLabel:`Leave`}),Z=`form[data-wui-unsaved]`,Ei=`[aria-invalid="true"], .field-error:not(:empty), .field-validation-error, .validation-summary-errors, .wui-error-summary`,Di=`[download], [data-wui-modal], [data-wui-post], [data-bs-toggle]`,Oi=new Set([`submit`,`button`,`reset`,`image`]),Q=new WeakMap,ki=new WeakSet,Ai=e=>`${e.name}:${e.size}:${e.lastModified}`;function $(e){let t=[];for(let n of e.elements)!n.name||n.disabled||Oi.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(Ai)]):n.type===`select-multiple`?t.push([n.name,[...n.selectedOptions].map(e=>e.value)]):t.push([n.name,n.value]));return JSON.stringify(t)}var ji=e=>({saved:e.querySelector(Ei)?null:$(e),engaged:!1,discarded:!1});function Mi(e){let t=Q.get(e);return!t||t.discarded||!e.isConnected?!1:t.saved===null||t.engaged&&$(e)!==t.saved}var Ni=(e,t)=>[...e.querySelectorAll(Z)].filter(e=>e!==t&&Mi(e)),Pi=()=>!!window.bootstrap?.Modal;function Fi(e,t,n){let r=t.map(e=>e.getAttribute(`data-wui-unsaved`)).find(Boolean)||X.message;$r(e,{title:X.title,message:r,label:X.leaveLabel,tone:`danger`},()=>{for(let e of t)Q.get(e).discarded=!0;n()})}function Ii(e){if(e.matches(Di))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 Li(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 Ri(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||!Ii(t))return;let n=Ni(t.ownerDocument,null);!n.length||!Pi()||(e.preventDefault(),Fi(t,n,()=>t.click()))}function zi(e){let t=e.target;if(!(t instanceof HTMLFormElement)||e.defaultPrevented||!Li(t,e.submitter))return;let n=Ni(t.ownerDocument,t);if(n.length&&Pi()){e.preventDefault();let r=e.submitter?.form===t?e.submitter:void 0;Fi(t,n,()=>t.requestSubmit(r));return}let r=Q.get(t);r&&(r.saved=$(t),r.discarded=!1)}function Bi(e){Ni(document,null).length&&(e.preventDefault(),e.returnValue=``)}function Vi(e){let t=e.target.closest?.(Z),n=t&&Q.get(t);!n||n.engaged||(n.saved!==null&&(n.saved=$(t)),n.engaged=!0)}function Hi(e){let t=e.target.closest?.(Z),n=t&&Q.get(t);n&&(n.discarded=!1,e.isTrusted&&(n.engaged=!0))}function Ui(e){let t=e.detail?.handle?.el;if(t instanceof Element)for(let e of t.querySelectorAll(Z))Gi(e)}function Wi(e=document){let t=e.ownerDocument||e;if(!ki.has(t)){ki.add(t);for(let e of[`focusin`,`pointerdown`,`drop`])t.addEventListener(e,Vi,!0);for(let e of[`input`,`change`])t.addEventListener(e,Hi,!0);t.addEventListener(`click`,Ri),t.addEventListener(`submit`,zi),t.addEventListener(`wui:modal:success`,Ui),t.defaultView.addEventListener(`beforeunload`,Bi)}let n=[...e.querySelectorAll?.(Z)||[]];e.matches?.(Z)&&n.unshift(e);for(let e of n)Q.has(e)||Q.set(e,ji(e))}function Gi(e){if(!(e instanceof HTMLFormElement)||!e.matches(Z))throw TypeError(`resetUnsavedChanges: ${String(e)} is not a <form data-wui-unsaved>.`);Q.set(e,{saved:$(e),engaged:!1,discarded:!1})}function Ki(){e(`wui-select`,L),e(`wui-country-select`,R),e(`wui-phone`,Ft),e(`wui-datepicker`,Qe),e(`wui-date-range`,$e),e(`wui-dock`,et),e(`wui-image-crop`,rt),e(`wui-kanban`,w),e(`wui-inline-edit`,at),e(`wui-consent-banner`,F),e(`wui-slider`,on),e(`wui-sortable`,sn),e(`wui-timepicker`,ln),e(`wui-tour`,dn),e(`wui-tree`,fn),e(`wui-autocomplete`,A),e(`wui-command-palette`,N),e(`wui-context-menu`,I),e(`wui-multiselect`,xt),e(`wui-taginput`,cn),e(`wui-otp`,Nt),e(`wui-status-icon`,k),e(`wui-shortcuts`,rn),e(`wui-record-pager`,Zt),e(`wui-carousel`,j),e(`wui-code-block`,_e),e(`wui-data-table`,Ke),e(`wui-drawer`,tt),e(`wui-hover-card`,nt),e(`wui-lightbox`,lt),e(`wui-menubar`,bt),e(`wui-navigation-menu`,St),e(`wui-notification-center`,jt),e(`wui-onboarding-checklist`,Mt),e(`wui-overflow`,Pt),e(`wui-rating`,It),e(`wui-relative-time`,en),e(`wui-resizable`,tn),e(`wui-rolling-number`,nn),e(`wui-show-more`,an),e(`wui-truncate`,pn),e(`wui-whats-new`,mn),e(`wui-mention-input`,ft),e(`wui-comment-thread`,P),e(`wui-wizard-step`,_n),e(`wui-wizard`,gn)}Ki();export{Tn as AVATAR_ACCEPT,kn as AVATAR_MAX_SIZE_MB,sr as AVATAR_OUTPUT_SIZE,On as AVATAR_OUTPUT_TYPE,Un as AVATAR_PREVIEW_SIZES,Hn as AVATAR_TEXT,Ve as COLUMN_MAX_WIDTH,We as COLUMN_MIN_WIDTH,Se as COMMENT_INTENTS,be as COMMENT_REACTIONS,xe as COMMENT_TEXT,K as CONFIRM_DIALOG_ID,zr as CONFIRM_TONES,ye as COPY_FEEDBACK_MS,S as CSRF_META_NAME,m as CURRENCIES,H as DATA_TABLE_TEXT,l as DATE_PATTERNS,y as DEFAULT_CSRF_HEADER,An as DEFAULT_IMAGE_ACCEPT,In as DEFAULT_MAX_SIZE_MB,Ln as DEFAULT_PASSWORD_RULES,xn as DEFAULT_REQUIREMENTS_TITLE,ur as DEFAULT_THEME_EFFECT,ir as DEFAULT_THEME_STORAGE_KEY,f as DURATION_UNITS,o as EMPTY_VALUE,Vr as FLASH_STORAGE_KEY,Br as FLASH_VARIANTS,t as FORMAT_STYLES,b as HTTP_KINDS,ct as INLINE_EDIT_SAVED_MS,ot as INLINE_EDIT_TEXT,st as INLINE_EDIT_TYPES,u as IST_TIME_ZONE,ue as KANBAN_DRAG_THRESHOLD_PX,oe as KANBAN_LONG_PRESS_MS,O as KANBAN_PHONE_QUERY,re as KANBAN_STORAGE_PREFIX,te as KANBAN_SUMMARY_FORMATS,se as KANBAN_TEXT,le as KANBAN_TONES,Yt as LIST_KEYS,Sn as MASK_INPUT_TYPES,Nn as MASK_NAMES,ut as MENTION_ID_PATTERN,vt as MENTION_MAX_QUERY,mt as MENTION_MAX_RESULTS,gt as MENTION_TEXT,p as MONEY_UNITS,At as NOTIFICATION_COUNT_CAP,Et as NOTIFICATION_TEXT,Ae as PIN_AT_VAR,He as PIN_SIDES,Ge as RESIZE_STEP,Me as RESIZE_STEP_LARGE,ze as ROW_HEIGHTS,qe as ROW_MOVE_LIMIT,Ne as ROW_MOVE_MS,Pe as ROW_SAVE_ATTR,Ue as ROW_SAVE_ERROR_CLASS,Be as ROW_SAVE_STATES,hr as SCROLL_EDGE_SELECTOR,_r as SELECT_ALL_LABEL,U as SELECT_CELL_CLASS,Wt as SELECT_KEY,vr as SELECT_ROW_LABEL,q as SERVER_ACTION_TEXT,qt as SHORTCUTS_OFF_ATTRIBUTE,Vt as SHORTCUT_EVENT,Lt as SHORTCUT_SCOPE_ATTRIBUTE,Gt as SHORTCUT_TEXT,me as STATUS_TONES,cr as THEME_BOOT_SCRIPT_BODY,$n as THEME_CHANGE_EVENT,Kn as THEME_EFFECTS,ar as THEME_EFFECT_DURATION,lr as THEME_LIVE_NAME,Jn as THEME_MODES,nr as THEME_SWITCHING_CLASS,X as UNSAVED_TEXT,Ie as VIRTUAL_OVERSCAN,hn as WHATS_NEW_READ_EVENT,v as WUI_HEADERS,A as WuiAutocomplete,j as WuiCarousel,_e as WuiCodeBlock,N as WuiCommandPalette,P as WuiCommentThread,F as WuiConsentBanner,I as WuiContextMenu,R as WuiCountrySelect,Ke as WuiDataTable,Qe as WuiDatePicker,$e as WuiDateRange,et as WuiDock,tt as WuiDrawer,nt as WuiHoverCard,rt as WuiImageCrop,at as WuiInlineEdit,w as WuiKanban,lt as WuiLightbox,ft as WuiMentionInput,bt as WuiMenubar,xt as WuiMultiSelect,St as WuiNavigationMenu,jt as WuiNotificationCenter,Mt as WuiOnboardingChecklist,Nt as WuiOtp,Pt as WuiOverflow,Ft as WuiPhone,It as WuiRating,Zt as WuiRecordPager,en as WuiRelativeTime,tn as WuiResizable,nn as WuiRollingNumber,L as WuiSelect,rn as WuiShortcuts,an as WuiShowMore,on as WuiSlider,sn as WuiSortable,k as WuiStatusIcon,cn as WuiTagInput,ln as WuiTimePicker,dn as WuiTour,fn as WuiTree,pn as WuiTruncate,mn as WuiWhatsNew,gn as WuiWizard,_n as WuiWizardStep,gr as acceptLabel,Tr as addRowSelectCells,Er as addSelectColumn,dr as applyTheme,Jt as ariaKeyShortcuts,tr as attachInputMask,qn as attachScrollEdges,kr as attachShiftRange,Wn as avatarCropOptions,Fn as avatarUnreadableMessage,pr as buildPasswordRules,Fe as clampColumnWidth,g as classifyStatus,$r as confirmAction,ve as copyTextToClipboard,un as createLocalSeenStore,ee as createRequestQueue,br as createSelectHeaderCell,xr as createSelectRowCell,Sr as createSelectSpacerCell,Ki as defineWeborityElements,Rn as evaluatePassword,n as formatCompact,s as formatCurrency,h as formatDate,r as formatDuration,yn as formatMasked,i as formatNumber,d as formatPercent,Qt as formatRelativeTime,c as formatValue,Lr as getServerTable,Ti as getShell,he as glyphSvg,ke as groupCount,Je as groupItems,Ot as groupNotificationsByDay,Ze as identityCell,Rt as inShortcutScope,er as initInputMasks,fe as initRemoteModals,mr as initScrollEdges,pi as initServerActions,Ir as initServerTables,wi as initShellParts,Wi as initUnsavedChanges,it as inlineEditText,vn as isHeicFile,bn as isImageFile,Bn as isImageOnlyAccept,jn as isMaskPattern,En as isPdfFile,Ht as isTypingTarget,ie as kanbanCardLabel,de as kanbanOverflow,T as kanbanStorageKey,E as kanbanSummaryFormat,ce as kanbanVisibleLimit,pe as loadRemoteModal,Mn as maskedPostValue,M as matchSegments,zn as matchesAccept,je as measureRows,ht as mentionLabel,_t as mentionTextFromValue,dt as mentionValueFromText,pt as mentionedIds,Xt as moveFocus,Yn as nextTheme,Tt as notificationCountText,Ct as notificationDayHeading,Dt as notificationTime,kt as notificationTriggerLabel,wt as notificationUnreadAnnouncement,yt as parseMentionValue,Cn as passwordSatisfies,Xe as pinAtValue,De as pinClasses,B as pinOffsetVar,Ye as planPins,Oe as playRowMoves,Pn as postedMasked,wn as rawMasked,Ce as readColumnWidths,x as readCsrf,ae as readKanbanCollapsed,Xn as readStoredTheme,$t as relativeTimeTitle,Gi as resetUnsavedChanges,Dn as resolveMask,or as resolveTheme,V as rowLabel,Ee as rowOrderChanged,zt as runShortcut,Re as saveOutcomeText,z as setRowSaveState,Le as settledRows,Bt as shortcutKey,Kt as shortcutName,Ut as shortcutsOff,rr as storeTheme,ne as sumKanbanValues,Dr as syncSelectAll,Qn as themeBootScript,Zn as themeKeyframes,a as toInstant,Gn as transitionTheme,Vn as validateFile,we as virtualRange,fr as watchSystemTheme,ge as withTrustedLabel,Te as writeColumnWidths,D as writeKanbanCollapsed,_ as wuiFetch};
1
+ import{n as e}from"./elementBase-BlsR4tqa.js";import{a as t,c as n,d as r,f as i,h as a,i as o,l as s,m as c,n as l,o as u,p as d,r as f,s as p,t as m,u as h}from"./formatters-BAE__8ye.js";import{a as g,c as _,i as v,n as y,o as ee,r as b,s as x,t as S}from"./wuiHttp-BC8co934.js";import{_ as C,a as te,c as w,d as T,f as E,g as D,h as ne,i as re,l as ie,m as ae,n as oe,o as se,p as ce,r as O,s as le,t as ue,u as de,v as fe,y as pe}from"./kanban-CdELdS3U.js";import{n as k,t as me}from"./statusIcons-2X4iGkKL.js";import{t as he}from"./iconGlyphs.g-CUm_mfze.js";import{o as ge}from"./optionLabel-BBaur8Bs.js";import{t as A}from"./WuiAutocomplete-CE7wT-Vc.js";import{t as j}from"./WuiCarousel-C33Z8FBt.js";import{t as _e}from"./WuiCodeBlock-BcLJhLBJ.js";import{n as ve,t as ye}from"./copyText-DM5HhXjf.js";import{t as M}from"./textMatch-wdY7XLIc.js";import{t as N}from"./WuiCommandPalette-CcmFOWNc.js";import{i as P,n as be,r as xe,t as Se}from"./WuiCommentThread-Bww7P_cu.js";import{t as F}from"./WuiConsentBanner-DWdHLSx9.js";import{t as I}from"./WuiContextMenu-CBy0O4HT.js";import{t as L}from"./WuiSelect-CT8tgsxL.js";import{t as R}from"./WuiCountrySelect-D92rrSvW.js";import{A as z,C as B,D as V,E as Ce,M as we,N as Te,O as Ee,S as De,T as Oe,_ as ke,a as Ae,b as je,c as Me,d as Ne,f as Pe,g as Fe,h as Ie,i as H,j as Le,k as Re,l as ze,m as Be,n as Ve,o as He,p as Ue,r as We,s as Ge,t as Ke,u as qe,v as Je,w as Ye,x as Xe,y as Ze}from"./WuiDataTable-tR8Lp4XZ.js";import{t as Qe}from"./WuiDatePicker-_BzQ2m1e.js";import{t as $e}from"./WuiDateRange-CrVodISl.js";import{t as et}from"./WuiDock-BD2HgMmP.js";import{t as tt}from"./WuiDrawer-BuvDLR6M.js";import{t as nt}from"./WuiHoverCard-CNEawHmO.js";import{t as rt}from"./WuiImageCrop-Cr3D2iPo.js";import{a as it,i as at,n as ot,r as st,t as ct}from"./WuiInlineEdit-CI-3C7yP.js";import{t as lt}from"./WuiLightbox-hluak_-q.js";import{a as ut,c as dt,i as ft,l as pt,n as mt,o as ht,r as gt,s as _t,t as vt,u as yt}from"./WuiMentionInput-DW7N1Zne.js";import{t as bt}from"./WuiMenubar-D2tb_3eU.js";import{t as xt}from"./WuiMultiSelect-WUNCdkzW.js";import{t as St}from"./WuiNavigationMenu-BsLnvz2Y.js";import{a as Ct,c as wt,i as Tt,n as Et,o as Dt,r as Ot,s as kt,t as At}from"./notificationDays-pYmoU0g6.js";import{t as jt}from"./WuiNotificationCenter-DKdvaSbm.js";import{t as Mt}from"./WuiOnboardingChecklist-s2DG6PZ0.js";import{t as Nt}from"./WuiOtp-BbO_75RB.js";import{t as Pt}from"./WuiOverflow-CB3j6q6n.js";import{t as Ft}from"./WuiPhone-CSUVhYSb.js";import{t as It}from"./WuiRating-BzeW6iDC.js";import{a as Lt,c as Rt,d as zt,f as Bt,i as Vt,l as Ht,m as Ut,n as Wt,o as Gt,p as Kt,r as qt,s as Jt,t as Yt,u as Xt}from"./shortcutKeys-BQiDpsTJ.js";import{t as Zt}from"./WuiRecordPager-yXv4g2ZR.js";import{n as Qt,r as $t,t as en}from"./WuiRelativeTime-Cfc8TMd8.js";import{t as tn}from"./WuiResizable-m2Ypa-zD.js";import{t as nn}from"./WuiRollingNumber-DBgi_3l7.js";import{t as rn}from"./WuiShortcuts-CMibF1XM.js";import{t as an}from"./WuiShowMore-Bu7IQcXS.js";import{t as on}from"./WuiSlider-Br6V2amU.js";import{t as sn}from"./WuiSortable-Bd7Fz5Ox.js";import{t as cn}from"./WuiTagInput-DzEZooIn.js";import{t as ln}from"./WuiTimePicker-Bolpp93P.js";import{n as un,t as dn}from"./WuiTour-DW3kPaR9.js";import{t as fn}from"./WuiTree-SA0QU9AF.js";import{t as pn}from"./WuiTruncate-BLl2u3b-.js";import{n as mn,t as hn}from"./WuiWhatsNew-BO78119Z.js";import{n as gn,t as _n}from"./WuiWizardStep-DIHxrXn9.js";import{$ as vn,A as yn,B as bn,C as xn,D as Sn,E as Cn,F as wn,G as Tn,H as En,I as Dn,J as On,K as kn,L as An,M as jn,N as Mn,O as Nn,P as Pn,Q as Fn,R as In,S as Ln,T as Rn,U as zn,V as Bn,W as Vn,X as Hn,Y as Un,Z as Wn,_ as Gn,a as Kn,b as qn,c as Jn,d as Yn,f as Xn,g as Zn,h as Qn,i as $n,j as er,k as tr,l as nr,m as rr,n as ir,o as ar,p as or,q as sr,r as cr,s as lr,t as ur,u as dr,v as fr,w as pr,x as mr,y as hr,z as gr}from"./themeTransition-C61cbmZ4.js";var _r=`Select all rows`,vr=`Select row`,U=`wui-select-cell`,yr=(e,t)=>{let n=e.createElement(`input`);return n.type=`checkbox`,n.className=`wui-check`,n.setAttribute(`aria-label`,t),n};function br(e=document){let t=e.createElement(`th`);return t.className=U,t.appendChild(yr(e,_r)),t}function xr(e=document){let t=e.createElement(`td`);return t.className=U,t.appendChild(yr(e,vr)),t}function Sr(e=document){let t=e.createElement(`td`);return t.className=U,t}var Cr=e=>e.firstElementChild?.classList.contains(U),wr=e=>e.matches(`.wui-group-row, .wui-virtual-spacer`);function Tr(e){for(let t of e)!Cr(t)&&!wr(t)&&t.insertBefore(xr(t.ownerDocument),t.firstChild)}function Er(e){let t=e.querySelector(`thead tr`);if(!t)return null;Cr(t)||t.insertBefore(br(e.ownerDocument),t.firstChild),Tr(e.querySelectorAll(`tbody tr`));for(let t of e.querySelectorAll(`tfoot tr`))Cr(t)||t.insertBefore(Sr(e.ownerDocument),t.firstChild);return t.querySelector(`.${U} .wui-check`)}function Dr(e){let t=e.querySelector(`thead .${U} .wui-check`),n=[...e.querySelectorAll(`tbody tr .wui-check`)],r=n.length,i=n.filter(e=>e.checked).length;t&&(t.checked=r>0&&i===r,t.indeterminate=i>0&&i<r);for(let t of e.querySelectorAll(`tbody tr`))t.classList.toggle(`is-selected`,!!t.querySelector(`.wui-check`)?.checked);return{selected:i,total:r}}var Or=`tbody .${U} .wui-check`;function kr(e,t){let n=null,r=e=>e instanceof Element&&e.matches(`.wui-select-cell .wui-check`)&&!!e.closest(`tbody`);e.addEventListener(`mousedown`,e=>{e.shiftKey&&r(e.target)&&e.preventDefault()}),e.addEventListener(`click`,i=>{let a=i.target;if(r(a)){if(i.shiftKey&&n?.isConnected&&n!==a){let r=[...e.querySelectorAll(Or)],i=r.indexOf(n),o=r.indexOf(a);if(i>=0&&o>=0){let e=[];for(let t of r.slice(Math.min(i,o),Math.max(i,o)+1))t===a||t.checked===a.checked||(t.checked=a.checked,e.push(t));e.length&&t?.(e,a.checked)}}n=a}})}var Ar=Object.freeze([`page`,`pageSize`,`sortBy`,`sortOrder`]),W=`search`,G=Object.freeze({loading:`Loading rows`,error:`These rows did not load. Try again.`,network:`The connection dropped before the rows loaded. Check it and try again.`,forbidden:`You do not have access to these rows.`,retry:`Retry`,actionFailed:`That did not work. Try again.`,actionForbidden:`You do not have permission to do that.`,empty:`No rows`}),jr=5,Mr=new WeakMap,Nr=(e,t)=>{let n=Number(e);return Number.isInteger(n)?n:t},Pr=e=>({total:Nr(e.dataset.total,0),page:Nr(e.dataset.page,1),pageSize:Nr(e.dataset.pageSize,0),sortBy:e.dataset.sortBy||``,sortOrder:e.dataset.sortOrder===`desc`?`desc`:`asc`}),Fr=(e,t)=>{e&&window.WUI?.toast?.(e,{variant:t})};function Ir(e=document){let t=e.querySelectorAll?[...e.querySelectorAll(`[data-wui-server]`)]:[];e instanceof Element&&e.matches(`[data-wui-server]`)&&t.unshift(e);for(let e of t)Mr.has(e)||Mr.set(e,Rr(e))}function Lr(e){let t=e instanceof Element?e.closest(`[data-wui-server]`):null;return t&&Mr.get(t)||null}function Rr(e){let t=e.querySelector(`.table-wrap`),n=t?.querySelector(`:scope > table`),r=e.dataset.src;if(!n||!r)throw Error(`A server-paged table needs data-src and a .table-wrap > table: render it with <app-data-table src>.`);let i=t.querySelector(`:scope > [data-wui-table-state]`),a=e.querySelector(`[data-wui-table-pager]`),o=e.querySelector(`[data-wui-table-status]`),s={urlState:e.dataset.urlState!==`false`,refreshOnSuccess:e.dataset.refreshOnSuccess!==`false`,filtersForm:e.dataset.filtersForm||null,filtersRegion:e.dataset.filtersRegion||null,searchInput:e.dataset.searchInput||null,loadingText:e.dataset.loadingText||G.loading,errorText:e.dataset.errorText||G.error},c=new URL(r,window.location.href),l=new Set(c.searchParams.keys()),u=n.hasAttribute(`data-app-datatable-selectable`),d=new Set,f=!1,p=ee(),m=new AbortController,h={signal:m.signal},g=n.querySelector(`:scope > tbody[data-wui-rows]`);if(!g)throw Error(`A server-paged table needs its rows in <app-table-rows> (tbody[data-wui-rows]).`);let v=Pr(g),y=null,b=null,x=e=>{let t=new URLSearchParams;for(let[n,r]of new URLSearchParams(e))l.has(n)||t.append(n,r);return t},S=e=>x(new URL(e,window.location.href).search),C=e=>{let t=e.toString();return`${window.location.pathname}${t?`?${t}`:``}${window.location.hash}`},te=e=>{let t=new URL(c.href);for(let[n,r]of e)l.has(n)||t.searchParams.append(n,r);return t.origin===window.location.origin?`${t.pathname}${t.search}`:t.href},w=(e,t)=>{let n=new URLSearchParams(e);return n.has(`page`)&&n.set(`page`,String(t.page)),n.has(`pageSize`)&&n.set(`pageSize`,String(t.pageSize)),n.has(`sortBy`)?t.sortBy?(n.set(`sortBy`,t.sortBy),n.set(`sortOrder`,t.sortOrder)):(n.delete(`sortBy`),n.delete(`sortOrder`)):n.delete(`sortOrder`),n},T=w(s.urlState?x(window.location.search):new URLSearchParams,v);s.urlState&&C(T)!==`${window.location.pathname}${window.location.search}${window.location.hash}`&&window.history.replaceState(window.history.state,``,C(T));let E=(e,n)=>t.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:n})),D=e=>{o&&(o.textContent=e)},ne=e=>{if(e.total===0)return G.empty;let t=e.pageSize>0?Math.max(1,Math.ceil(e.total/e.pageSize)):1;return`Page ${e.page} of ${t}, ${e.total} ${e.total===1?`row`:`rows`}`},re=()=>[...n.querySelectorAll(`:scope > thead > tr:first-child > th`)],ie=e=>{if(u&&[...e.querySelectorAll(`:scope > tr`)].some(e=>!e.dataset.rowKey))throw Error(`A selectable server-paged table needs data-row-key on every row, so a selection can span pages.`)},ae=t=>{let n=e.dataset.activeRowKey;if(n!==void 0)for(let e of t){let t=e.classList.contains(`wui-row-active`),r=n!==``&&e.dataset.rowKey===n;e.classList.toggle(`wui-row-active`,r),r?e.setAttribute(`aria-current`,`true`):t&&e.removeAttribute(`aria-current`)}},oe=e=>{if(u){Tr(e);for(let t of e){let e=t.querySelector(`.${U} .wui-check`);e&&(f&&d.add(t.dataset.rowKey),e.checked=d.has(t.dataset.rowKey))}Dr(n)}ae(e);let t=re();if(n.classList.contains(`wui-table-stack`))for(let n of e)[...n.cells].forEach((e,n)=>{let r=t[n]?.textContent.trim();r&&!e.hasAttribute(`data-label`)&&e.setAttribute(`data-label`,r)});t.forEach((t,n)=>{if(t.classList.contains(`wui-col-hidden`))for(let t of e)t.cells[n]?.classList.add(`wui-col-hidden`)})},se=e=>oe([...e.querySelectorAll(`:scope > tr`)]),ce=e=>{for(let t of e.querySelectorAll(`:scope > template[data-wui-pager], :scope > template[data-wui-empty], :scope > template[data-wui-filters]`))t.remove()},O=e=>e?.dispatchEvent(new CustomEvent(`wui:teardown`,{bubbles:!0})),le=(e,t)=>{if(!i)return;let n=e.querySelector(`:scope > template[data-wui-empty]`);O(i),t.total===0&&n?(i.replaceChildren(n.content.cloneNode(!0)),i.hidden=!1):(i.replaceChildren(),i.hidden=!0)},ue=e=>{let r=Pr(e),i=r.sortBy!==v.sortBy||r.sortOrder!==v.sortOrder?je(g.rows):null;if(a){let t=e.querySelector(`:scope > template[data-wui-pager]`);O(a),a.replaceChildren(...t?[t.content.cloneNode(!0)]:[]),a.hidden=!1}le(e,r);let o=e.querySelector(`:scope > template[data-wui-filters]`),c=s.filtersRegion&&o?document.querySelector(s.filtersRegion):null;c&&(O(c),c.replaceChildren(o.content.cloneNode(!0))),ce(e),O(g),n.replaceChild(e,g),g=e;let l=f&&r.total!==v.total;v=r,l&&(f=!1),t.removeAttribute(`data-wui-table-error`),se(e),ve(),Oe(e.rows,i),l&&M()},de=e=>{let t=document.createElement(`template`);t.innerHTML=`<table>${e}</table>`;let n=t.content.querySelector(`tbody[data-wui-rows]`);return n&&ie(n),n?document.importNode(n,!0):null},fe=e=>{let t=document.createElement(`tr`);for(let n=0;n<e;n++){let e=document.createElement(`td`),r=document.createElement(`span`);r.className=`skeleton`,r.setAttribute(`aria-hidden`,`true`),r.style.cssText=`display:block;width:${n===0?70:50}%;height:12px;border-radius:6px`,e.append(r),t.append(e)}return t},pe=()=>{if(g.querySelector(`:scope > tr:not([data-wui-skeleton])`))return;let e=Math.max(1,re().length);g.replaceChildren(...Array.from({length:jr},()=>{let t=fe(e);return t.setAttribute(`data-wui-skeleton`,``),t})),t.removeAttribute(`data-wui-table-error`),i&&(i.hidden=!0)},k=e=>{e?(t.setAttribute(`aria-busy`,`true`),pe()):t.removeAttribute(`aria-busy`)},me=e=>e===`forbidden`?G.forbidden:e===`network`?G.network:s.errorText,ge=e=>{let n=me(e);if(t.setAttribute(`data-wui-table-error`,e),a&&(a.hidden=!0),i){let t=document.createElement(`div`);t.className=`tbl-empty wui-table-error`,t.setAttribute(`role`,`alert`);let r=document.createElement(`span`);r.className=`tbl-empty-icon`,r.innerHTML=he(e===`forbidden`?`lock`:`alert-circle`,{size:24});let a=document.createElement(`div`);a.className=`tbl-empty-title`,a.textContent=n;let o=document.createElement(`div`);o.className=`tbl-empty-action`;let s=document.createElement(`button`);s.type=`button`,s.className=`btn btn-outline-primary btn-sm`,s.setAttribute(`data-wui-table-retry`,``),s.textContent=G.retry,o.append(s),t.append(r,a,o),O(i),i.replaceChildren(t),i.hidden=!1}D(n)},A=async(e,t=`none`)=>{let n=new URLSearchParams(e);y={query:n,mode:t},k(!0),D(s.loadingText),E(`wui:table:loading`,{query:n.toString()});let r=await p.run(te(n));if(r.kind===`aborted`||r.kind===`stale`||r.kind===`session`)return r;k(!1);let i=null,a=r.ok?null:r.kind;if(r.ok){try{i=de(r.html)}catch(e){console.error(e)}i||(a=`server`)}return a?(ge(a),E(`wui:table:error`,{status:r.status,kind:a,message:me(a)}),r):(ue(i),T=w(n,v),s.urlState&&t===`push`?window.history.pushState(window.history.state,``,C(T)):s.urlState&&t===`replace`&&window.history.replaceState(window.history.state,``,C(T)),D(ne(v)),window.WUI?.refresh?.(),E(`wui:table:loaded`,{...v,query:T.toString()}),r)},j=e=>(e.delete(`page`),e),_e=()=>[...n.querySelectorAll(`:scope > thead th[data-sort-key]`)],ve=()=>{for(let e of _e()){let t=e.dataset.sortKey===v.sortBy;e.setAttribute(`aria-sort`,t?v.sortOrder===`desc`?`descending`:`ascending`:`none`)}};for(let e of _e())if(e.classList.add(`sortable`),e.tabIndex=0,!e.querySelector(`.sort-icon`)){let t=e.classList.contains(`num`)||e.classList.contains(`text-end`),n=document.createElement(`span`);n.className=t?`sort-icon wui-sort-lead`:`sort-icon`,n.innerHTML=he(`chevrons-up-down`,{size:14}),t?e.prepend(n):e.append(n)}let ye=e=>{let t=j(new URLSearchParams(T)),n=v.sortBy===e&&v.sortOrder===`asc`?`desc`:`asc`;return t.set(`sortBy`,e),t.set(`sortOrder`,n),A(t,`push`)};n.addEventListener(`click`,e=>{let t=e.target.closest(`th[data-sort-key]`);t&&n.tHead?.contains(t)&&ye(t.dataset.sortKey)}),n.addEventListener(`keydown`,e=>{if(e.key!==`Enter`&&e.key!==` `)return;let t=e.target.closest?.(`th[data-sort-key]`);!t||!n.tHead?.contains(t)||(e.preventDefault(),ye(t.dataset.sortKey))});let M=()=>{Dr(n);let e=f?{selected:v.total,total:v.total,allMatching:f}:{selected:d.size,total:v.total};n.dispatchEvent(new CustomEvent(`selectionchange`,{bubbles:!0,detail:e}))};u&&(kr(n,(e,t)=>{for(let n of e){let e=n.closest(`tr`)?.dataset.rowKey;e&&(t?d.add(e):d.delete(e))}t||(f=!1)}),n.addEventListener(`change`,e=>{let t=e.target;if(t.matches?.(`.wui-select-cell .wui-check`)){if(t.checked||(f=!1),n.tHead?.contains(t))for(let e of g.querySelectorAll(`:scope > tr`)){let n=e.querySelector(`.${U} .wui-check`);n&&(n.checked=t.checked,t.checked?d.add(e.dataset.rowKey):d.delete(e.dataset.rowKey))}else{let e=t.closest(`tr`)?.dataset.rowKey;if(!e)return;t.checked?d.add(e):d.delete(e)}M()}})),a&&(a.addEventListener(`click`,e=>{let t=e.target.closest(`a[href]`);!t||e.defaultPrevented||e.button!==0||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey||(e.preventDefault(),A(S(t.getAttribute(`href`)),`push`))}),a.addEventListener(`change`,e=>{!e.target.classList?.contains(`tpg-select`)||!e.target.value||(e.stopPropagation(),A(S(e.target.value),`push`))}));let N=()=>{if(!s.searchInput)return null;let e=document.querySelector(s.searchInput);return e&&(e.matches(`input, textarea`)?e:e.querySelector(`input`))},P=()=>e.isConnected?!0:(m.abort(),clearTimeout(b),!1),be=(e,t)=>{let n=t?.name?new FormData(e,t):new FormData(e),r=new Set([...e.querySelectorAll(`[name]`)].map(e=>e.getAttribute(`name`))),i=new URLSearchParams;for(let[e,t]of T)e!==`page`&&(Ar.includes(e)||!r.has(e))&&i.append(e,t);for(let[e,t]of n)typeof t!=`string`||t===``||Ar.includes(e)||l.has(e)||i.append(e,t);let a=N();if(a){i.delete(W);let e=a.value.trim();e&&i.set(W,e)}return A(i,`push`)},xe=e=>s.filtersForm&&e.closest?.(s.filtersForm)||s.filtersRegion&&e.closest?.(s.filtersRegion)||null;document.addEventListener(`submit`,e=>{!P()||!s.filtersForm||!(e.target instanceof HTMLFormElement)||!e.target.matches(s.filtersForm)||(e.preventDefault(),be(e.target,e.submitter))},h),document.addEventListener(`change`,e=>{if(!P()||!s.filtersForm)return;let t=e.target.closest?.(s.filtersForm);!t||e.target===N()||be(t)},h);let Se=(e,t)=>{if(!e)return;let n=e=>t.get(e)??``;for(let r of e.querySelectorAll(`input[name]:not([type=hidden])`))if(r.type===`checkbox`)r.checked=t.getAll(r.name).includes(r.value);else if(r.type===`radio`){let e=n(r.name)===r.value;if(r.checked===e)continue;r.checked=e,e&&r.dispatchEvent(new Event(`change`))}else r.value!==n(r.name)&&(r.value=n(r.name),r.dispatchEvent(new Event(`input`,{bubbles:!0})));for(let r of e.querySelectorAll(`select[name]`))if(!r.multiple)r.value=n(r.name);else for(let e of r.options)e.selected=t.getAll(r.name).includes(e.value);for(let t of e.querySelectorAll(`wui-select[name]`))t.value=n(t.getAttribute(`name`));for(let n of e.querySelectorAll(`wui-multiselect[name]`))n.values=t.getAll(n.getAttribute(`name`));for(let t of e.querySelectorAll(`wui-date-range`)){let e=t.getAttribute(`start-name`)||t.getAttribute(`name`),r=t.getAttribute(`end-name`);t.value={start:e?n(e):``,end:r?n(r):``}}};document.addEventListener(`click`,e=>{if(!P())return;let t=e.target.closest?.(`a[href]`);if(!t||!xe(t)||e.defaultPrevented||e.button!==0||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey)return;let n=new URL(t.getAttribute(`href`),window.location.href);if(n.origin!==window.location.origin||n.pathname!==window.location.pathname)return;e.preventDefault();let r=j(S(n.href));Se(t.closest(`form`),r),A(r,`push`)},h),document.addEventListener(`input`,e=>{if(!P())return;let t=N();!t||e.target!==t||(clearTimeout(b),b=setTimeout(()=>{let e=j(new URLSearchParams(T)),n=t.value.trim();n?e.set(W,n):e.delete(W),e.toString()!==T.toString()&&A(e,`replace`)},300))},h),s.urlState&&window.addEventListener(`popstate`,()=>{if(!P())return;let e=x(window.location.search),t=N();t&&(t.value=e.get(`search`)??``),A(e,`none`)},h),document.addEventListener(`wui:modal:success`,()=>{P()&&s.refreshOnSuccess&&A(T,`none`)},h),i?.addEventListener(`click`,e=>{e.target.closest(`[data-wui-table-retry]`)&&y&&A(y.query,y.mode)});let F=e=>[...g.rows].find(t=>t.dataset.rowKey===e)??null,I=e=>{if(!e?.trim())return null;let t=document.createElement(`template`);if(t.innerHTML=`<table><tbody>${e}</tbody></table>`,t.content.querySelector(`tbody[data-wui-rows]`))return null;let n=[...t.content.querySelectorAll(`table > tbody > tr[data-row-key]`)];return n.length?n.map(e=>document.importNode(e,!0)):null},L=(e,t,n)=>{let r=n?e[0]:e.find(e=>e.dataset.rowKey===t.dataset.rowKey);if(!r)return null;let i=[];for(let n of e){let e=n===r?t:F(n.dataset.rowKey);e&&(O(e),e.replaceWith(n),i.push(n))}return oe(i),window.WUI?.refresh?.(),r},R=e=>e.message||(e.kind===`forbidden`?G.actionForbidden:G.actionFailed),B=e=>{e?.isConnected&&e.getAttribute(`data-wui-save-state`)===`saving`&&z(e,null)},Ce=e=>{if(e instanceof HTMLTableRowElement)return e;let t=document.createElement(`template`);t.innerHTML=`<table><tbody>${String(e)}</tbody></table>`;let n=t.content.querySelector(`table > tbody > tr`);if(!n)throw Error("saveRow's `row` is the row as it will read: a <tr> element or its HTML.");return document.importNode(n,!0)},we=async({url:e,method:n=`POST`,body:r,key:a,row:o}={})=>{if(!e)throw Error("saveRow needs `url`: the handler that saves the row.");let s=a==null,c=s?null:F(String(a));if(!s&&!c)throw Error(`saveRow found no row with data-row-key="${a}" on this page.`);let l=re().filter(e=>!e.classList.contains(U)).length,u=o?Ce(o):c??fe(Math.max(1,l));c&&u!==c?c.replaceWith(u):c||g.insertBefore(u,g.firstChild),u!==c&&oe([u]),i&&!t.hasAttribute(`data-wui-table-error`)&&(i.hidden=!0),z(u,`saving`);let d=V(u),f=await _(e,{method:n.toUpperCase(),body:r});if(f.kind===`session`)return!1;if(f.ok){let e=I(f.html),t=e&&u.isConnected?L(e,u,s):null;return t?D(H.saved(V(t)||d)):(await A(T,`none`),B(u)),Fr(f.message,f.toastVariant||`success`),E(`wui:table:saved`,{key:t?.dataset.rowKey??(s?null:String(a)),added:s,status:f.status}),!0}let p=R(f),m=u;return c&&u!==c&&u.isConnected?(u.replaceWith(c),m=c):s&&!o&&(u.remove(),m=null,i?.childElementCount&&!g.querySelector(`:scope > tr`)&&(i.hidden=!1)),m?.isConnected&&z(m,`error`,p),f.kind!==`aborted`&&Fr(p,`danger`),D(H.notSaved(d,p)),E(`wui:table:failed`,{key:s?null:String(a),added:s,status:f.status,kind:f.kind,message:p}),!1},Te=async e=>{let t=e.dataset.url;if(!t)throw Error(`A data-wui-row-action button needs data-url: the handler the action posts to.`);let n=e.closest(`tr`),r=n?.dataset.rowKey??null,i=e.dataset.wuiRowAction||``,a=n?V(n):``;e.disabled=!0,e.setAttribute(`aria-busy`,`true`),n&&z(n,`saving`);let o=await _(t,{method:(e.dataset.method||`post`).toUpperCase()});if(e.disabled=!1,e.removeAttribute(`aria-busy`),o.kind===`session`||o.kind===`aborted`){B(n);return}if(o.ok){Fr(o.message,o.toastVariant||`success`);let e=n?.isConnected?I(o.html):null,t=e?L(e,n,!1):null;t?D(H.saved(V(t)||a)):(await A(T,`none`),B(n))}else{let e=R(o);Fr(e,`danger`),n?.isConnected&&z(n,`error`,e),D(H.notSaved(a,e))}E(`wui:table:action`,{action:i,key:r,ok:o.ok,status:o.status})};return n.addEventListener(`click`,e=>{let t=e.target.closest(`[data-wui-row-action]`);!t||!g.contains(t)||t.disabled||(e.preventDefault(),Te(t))}),ie(g),ce(g),u&&Er(n),se(g),ve(),{el:e,reload:()=>A(T,`none`),query:()=>new URLSearchParams(T),setQuery:e=>{let t=new URLSearchParams(T);for(let[n,r]of Object.entries(e??{})){t.delete(n);for(let e of Array.isArray(r)?r:[r])e!=null&&e!==``&&t.append(n,String(e))}return(!e||!(`page`in e))&&t.delete(`page`),A(t,`push`)},saveRow:we,setActiveRow:t=>{e.dataset.activeRowKey=t==null?``:String(t),ae([...g.querySelectorAll(`:scope > tr`)])},selection:{keys:()=>[...d],count:()=>f?v.total:d.size,allMatching:()=>f,selectAllMatching:()=>{f=!0;for(let e of g.querySelectorAll(`:scope > tr`)){let t=e.querySelector(`.${U} .wui-check`);t&&(t.checked=!0),e.dataset.rowKey&&d.add(e.dataset.rowKey)}M()},clear:()=>{f=!1,d.clear();for(let e of g.querySelectorAll(`:scope > tr > .${U} .wui-check`))e.checked=!1;M()}}}}var K=`wuiConfirm`,zr=Object.freeze([`danger`]),Br=Object.freeze([`success`,`info`,`warning`,`danger`]),Vr=`wui.flash`,q=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.`}),Hr=new WeakSet,Ur=new WeakSet,J=null,Wr=null,Gr=!1,Kr=e=>{let t=document.createElement(`span`);return t.textContent=e??``,t.innerHTML},qr=(e,t)=>{e&&window.WUI?.toast?.(e,{variant:t})},Jr=()=>{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 Yr(){let e=document.getElementById(K);return e||(e=document.createElement(`div`),e.id=K,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`,`${C.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">${Kr(q.cancelLabel)}</button><button type="button" class="btn btn-primary" data-app-confirm></button></div></div></div></div>`,document.body.appendChild(e),e)}function Xr(e,t){let n=e.getAttribute(`data-wui-confirm-tone`);if(n!==null&&!zr.includes(n))throw TypeError(`data-wui-confirm-tone="${n}" is not supported. Use danger, or leave it off.`);Zr({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 Zr({title:e,message:t,label:n,danger:r},i){let a=Jr(),o=Yr(),s=o.querySelector(`.wui-confirm-title`),c=o.querySelector(`[data-app-confirm]`);if(!s||!c)throw Error(`#${K} is not a confirm dialog with a confirm button. Render <app-confirm-dialog id="${K}"> 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||q.confirmTitle,l.textContent=t,c.textContent=n||q.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),Wr=i,Gr=!1,a.getOrCreateInstance(o).show()}var Qr=(e,t)=>{J=e;try{t()}finally{J=null}};function $r(e,{title:t,message:n,label:r,tone:i},a){if(i!=null&&!zr.includes(i))throw TypeError(`confirmAction: tone "${i}" is not supported. Use danger, or leave it off.`);fi(e.ownerDocument),Zr({title:t,message:n,label:r,danger:i===`danger`},()=>Qr(e,a))}var ei=e=>e.disabled===!0||e.getAttribute(`aria-disabled`)===`true`;function ti(e){let t=e.target.closest?.(`[data-wui-confirm]:not(form)`);!t||t===J||ei(t)||(e.preventDefault(),e.stopImmediatePropagation(),Xr(t,()=>Qr(t,()=>t.click())))}function ni(e){let t=e.target;if(!(t instanceof HTMLFormElement)||!t.hasAttribute(`data-wui-confirm`)||t===J||e.submitter&&e.submitter===J)return;e.preventDefault(),e.stopImmediatePropagation();let n=e.submitter?.form===t?e.submitter:void 0;Xr(t,()=>Qr(t,()=>t.requestSubmit(n)))}function ri(e){let t=e.target.closest?.(`#${K} [data-app-confirm]`);!t||t.disabled||!Wr||(Gr=!0,Jr().getOrCreateInstance(t.closest(`#${K}`)).hide())}function ii(e){if(e.target.id!==`wuiConfirm`)return;let t=Gr?Wr:null;Wr=null,Gr=!1,t?.()}var ai=(e,t)=>{e&&window.sessionStorage.setItem(Vr,JSON.stringify({message:e,variant:t}))},oi=e=>e===`forbidden`?q.forbidden:e===`network`?q.network:q.failed;function si(){for(let e of document.querySelectorAll(`[data-wui-server]`))e.dataset.refreshOnSuccess!==`false`&&Lr(e)?.reload()}async function ci(e){let t=e.getAttribute(`data-wui-post`);if(!t)throw Error(`A data-wui-post button needs the URL the action posts to.`);let n=e.getAttribute(`data-wui-post-reload`);if(n!==null&&n!==`page`)throw TypeError(`data-wui-post-reload="${n}" is not supported. Use page, or leave it off to reload the server tables.`);e.disabled=!0,e.setAttribute(`aria-busy`,`true`);let r=await _(t,{method:`POST`});if(r.kind===`session`||r.kind===`aborted`)return;let i=r.toastVariant||`success`;if(r.ok&&(r.redirect||n===`page`)){ai(r.message,i),r.redirect?window.location.assign(r.redirect):window.location.reload();return}if(e.disabled=!1,e.removeAttribute(`aria-busy`),r.ok){qr(r.message,i),si();return}qr(r.message||oi(r.kind),`danger`)}function li(e){let t=e.target.closest?.(`[data-wui-post]`);t&&(e.preventDefault(),!(ei(t)||t.getAttribute(`aria-busy`)===`true`)&&ci(t).catch(e=>console.error(e)))}function ui(){let e=window.sessionStorage.getItem(Vr);if(!e)return;window.sessionStorage.removeItem(Vr);let{message:t,variant:n}=JSON.parse(e);qr(t,n)}function di(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(!Br.includes(t))throw TypeError(`data-wui-flash-variant="${t}" is not supported. Use ${Br.join(`, `)}.`);let n=e.getAttribute(`data-wui-flash`)||e.textContent.trim();e.remove(),qr(n,t)}}function fi(e){Ur.has(e)||(Ur.add(e),e.addEventListener(`click`,ri),e.addEventListener(`hidden.bs.modal`,ii))}function pi(e=document){let t=e.ownerDocument||e;Hr.has(t)||(Hr.add(t),t.addEventListener(`click`,ti,!0),t.addEventListener(`submit`,ni,!0),fi(t),t.addEventListener(`click`,li),ui()),di(e)}var mi=31536e3,Y=new WeakMap,hi=e=>e>99?`99+`:String(e);function gi(e,t,n=document){n.cookie=`${e}=${t?`1`:`0`}; Path=/; Max-Age=${mi}; SameSite=Lax`}var _i=e=>{let t=document.createElement(`template`);return t.innerHTML=e,t.content},vi=(e,t)=>{let n=document.createElement(`div`);return n.className=e,n.textContent=t,n};function yi(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=ee(),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=hi(o),r.hidden=o===0),n?.setAttribute(`aria-label`,o===0?l:`${l}, ${hi(o)} unread`),a&&s&&i&&(i.textContent=o===0?`No unread notifications`:`${hi(o)} unread notifications`)},h=()=>o?.classList.contains(`show`)??!1,g=()=>{let e=vi(`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)},v=async t=>{t&&(a.setAttribute(`aria-busy`,`true`),a.querySelector(`.wui-bell-item`)||a.replaceChildren(vi(`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=_i(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(vi(`wui-bell-state`,u))),e.dispatchEvent(new CustomEvent(`wui:notifications:loaded`,{bubbles:!0,detail:{unread:o}}))};e.addEventListener(`show.bs.dropdown`,()=>v(!0)),e.addEventListener(`click`,async e=>{if(e.target.closest(`[data-wui-bell-retry]`)){v(!0);return}let t=e.target.closest(`[data-wui-bell-read]`);if(!t||!c)return;t.disabled=!0;let n=await _(c,{method:`POST`});t.disabled=!1,n.ok&&(m(0),v(!0))});let y=null,b=()=>{d>0&&y===null&&(y=setInterval(()=>v(h()),d*1e3))},x=()=>{y!==null&&clearInterval(y),y=null},S=()=>{document.hidden?x():(v(h()),b())};return d>0&&(document.addEventListener(`visibilitychange`,S),document.hidden||b()),t.push(()=>{x(),f.abort(),document.removeEventListener(`visibilitychange`,S)}),{setUnread:e=>m(e),refresh:()=>v(h())}}var bi=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName)),xi=(e,t,n)=>`${e}${e.includes(`?`)?`&`:`?`}${encodeURIComponent(t)}=${encodeURIComponent(n)}`;function Si(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=ee(),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(xi(o,s,t));if(!(n.kind===`aborted`||n.kind===`stale`||n.kind===`session`)){if(e.classList.remove(`is-loading`),n.ok){let e=_i(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(vi(`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(xi(c,s,n.value.trim())))}else t.key===`Escape`&&(r.hidden?e.classList.contains(`is-open`)&&(t.preventDefault(),v(!1),i?.focus()):(t.preventDefault(),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||bi(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 Ci(e){let t=[],n=e.dataset.wuiCollapsedCookie;n&&e.addEventListener(`wui:shell:collapse`,e=>gi(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?yi(r,t):null,a=e.querySelector(`[data-wui-topsearch]`);a&&Si(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)}};Y.set(e,o);let s=n=>{if(n.target===e||n.target.contains?.(e)){for(let e of t)e();Y.delete(e),delete e.dataset.wuiPartsWired,document.removeEventListener(`wui:teardown`,s)}};return document.addEventListener(`wui:teardown`,s),o}function wi(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`,Ci(e))}function Ti(e){let t=e?.closest?.(`[data-app-shell]`)??null;return t?(Y.has(t)||wi(t),Y.get(t)??null):null}var X=Object.freeze({title:`Leave without saving?`,message:`Your changes on this page are not saved. If you leave now, they are lost.`,leaveLabel:`Leave`}),Z=`form[data-wui-unsaved]`,Ei=`[aria-invalid="true"], .field-error:not(:empty), .field-validation-error, .validation-summary-errors, .wui-error-summary`,Di=`[download], [data-wui-modal], [data-wui-post], [data-bs-toggle]`,Oi=new Set([`submit`,`button`,`reset`,`image`]),Q=new WeakMap,ki=new WeakSet,Ai=e=>`${e.name}:${e.size}:${e.lastModified}`;function $(e){let t=[];for(let n of e.elements)!n.name||n.disabled||Oi.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(Ai)]):n.type===`select-multiple`?t.push([n.name,[...n.selectedOptions].map(e=>e.value)]):t.push([n.name,n.value]));return JSON.stringify(t)}var ji=e=>({saved:e.querySelector(Ei)?null:$(e),engaged:!1,discarded:!1});function Mi(e){let t=Q.get(e);return!t||t.discarded||!e.isConnected?!1:t.saved===null||t.engaged&&$(e)!==t.saved}var Ni=(e,t)=>[...e.querySelectorAll(Z)].filter(e=>e!==t&&Mi(e)),Pi=()=>!!window.bootstrap?.Modal;function Fi(e,t,n){let r=t.map(e=>e.getAttribute(`data-wui-unsaved`)).find(Boolean)||X.message;$r(e,{title:X.title,message:r,label:X.leaveLabel,tone:`danger`},()=>{for(let e of t)Q.get(e).discarded=!0;n()})}function Ii(e){if(e.matches(Di))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 Li(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 Ri(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||!Ii(t))return;let n=Ni(t.ownerDocument,null);!n.length||!Pi()||(e.preventDefault(),Fi(t,n,()=>t.click()))}function zi(e){let t=e.target;if(!(t instanceof HTMLFormElement)||e.defaultPrevented||!Li(t,e.submitter))return;let n=Ni(t.ownerDocument,t);if(n.length&&Pi()){e.preventDefault();let r=e.submitter?.form===t?e.submitter:void 0;Fi(t,n,()=>t.requestSubmit(r));return}let r=Q.get(t);r&&(r.saved=$(t),r.discarded=!1)}function Bi(e){Ni(document,null).length&&(e.preventDefault(),e.returnValue=``)}function Vi(e){let t=e.target.closest?.(Z),n=t&&Q.get(t);!n||n.engaged||(n.saved!==null&&(n.saved=$(t)),n.engaged=!0)}function Hi(e){let t=e.target.closest?.(Z),n=t&&Q.get(t);n&&(n.discarded=!1,e.isTrusted&&(n.engaged=!0))}function Ui(e){let t=e.detail?.handle?.el;if(t instanceof Element)for(let e of t.querySelectorAll(Z))Gi(e)}function Wi(e=document){let t=e.ownerDocument||e;if(!ki.has(t)){ki.add(t);for(let e of[`focusin`,`pointerdown`,`drop`])t.addEventListener(e,Vi,!0);for(let e of[`input`,`change`])t.addEventListener(e,Hi,!0);t.addEventListener(`click`,Ri),t.addEventListener(`submit`,zi),t.addEventListener(`wui:modal:success`,Ui),t.defaultView.addEventListener(`beforeunload`,Bi)}let n=[...e.querySelectorAll?.(Z)||[]];e.matches?.(Z)&&n.unshift(e);for(let e of n)Q.has(e)||Q.set(e,ji(e))}function Gi(e){if(!(e instanceof HTMLFormElement)||!e.matches(Z))throw TypeError(`resetUnsavedChanges: ${String(e)} is not a <form data-wui-unsaved>.`);Q.set(e,{saved:$(e),engaged:!1,discarded:!1})}function Ki(){e(`wui-select`,L),e(`wui-country-select`,R),e(`wui-phone`,Ft),e(`wui-datepicker`,Qe),e(`wui-date-range`,$e),e(`wui-dock`,et),e(`wui-image-crop`,rt),e(`wui-kanban`,w),e(`wui-inline-edit`,at),e(`wui-consent-banner`,F),e(`wui-slider`,on),e(`wui-sortable`,sn),e(`wui-timepicker`,ln),e(`wui-tour`,dn),e(`wui-tree`,fn),e(`wui-autocomplete`,A),e(`wui-command-palette`,N),e(`wui-context-menu`,I),e(`wui-multiselect`,xt),e(`wui-taginput`,cn),e(`wui-otp`,Nt),e(`wui-status-icon`,k),e(`wui-shortcuts`,rn),e(`wui-record-pager`,Zt),e(`wui-carousel`,j),e(`wui-code-block`,_e),e(`wui-data-table`,Ke),e(`wui-drawer`,tt),e(`wui-hover-card`,nt),e(`wui-lightbox`,lt),e(`wui-menubar`,bt),e(`wui-navigation-menu`,St),e(`wui-notification-center`,jt),e(`wui-onboarding-checklist`,Mt),e(`wui-overflow`,Pt),e(`wui-rating`,It),e(`wui-relative-time`,en),e(`wui-resizable`,tn),e(`wui-rolling-number`,nn),e(`wui-show-more`,an),e(`wui-truncate`,pn),e(`wui-whats-new`,mn),e(`wui-mention-input`,ft),e(`wui-comment-thread`,P),e(`wui-wizard-step`,_n),e(`wui-wizard`,gn)}Ki();export{Tn as AVATAR_ACCEPT,kn as AVATAR_MAX_SIZE_MB,sr as AVATAR_OUTPUT_SIZE,On as AVATAR_OUTPUT_TYPE,Un as AVATAR_PREVIEW_SIZES,Hn as AVATAR_TEXT,Ve as COLUMN_MAX_WIDTH,We as COLUMN_MIN_WIDTH,Se as COMMENT_INTENTS,be as COMMENT_REACTIONS,xe as COMMENT_TEXT,K as CONFIRM_DIALOG_ID,zr as CONFIRM_TONES,ye as COPY_FEEDBACK_MS,S as CSRF_META_NAME,m as CURRENCIES,H as DATA_TABLE_TEXT,l as DATE_PATTERNS,y as DEFAULT_CSRF_HEADER,An as DEFAULT_IMAGE_ACCEPT,In as DEFAULT_MAX_SIZE_MB,Ln as DEFAULT_PASSWORD_RULES,xn as DEFAULT_REQUIREMENTS_TITLE,ur as DEFAULT_THEME_EFFECT,ir as DEFAULT_THEME_STORAGE_KEY,f as DURATION_UNITS,o as EMPTY_VALUE,Vr as FLASH_STORAGE_KEY,Br as FLASH_VARIANTS,t as FORMAT_STYLES,b as HTTP_KINDS,ct as INLINE_EDIT_SAVED_MS,ot as INLINE_EDIT_TEXT,st as INLINE_EDIT_TYPES,u as IST_TIME_ZONE,ue as KANBAN_DRAG_THRESHOLD_PX,oe as KANBAN_LONG_PRESS_MS,O as KANBAN_PHONE_QUERY,re as KANBAN_STORAGE_PREFIX,te as KANBAN_SUMMARY_FORMATS,se as KANBAN_TEXT,le as KANBAN_TONES,Yt as LIST_KEYS,Sn as MASK_INPUT_TYPES,Nn as MASK_NAMES,ut as MENTION_ID_PATTERN,vt as MENTION_MAX_QUERY,mt as MENTION_MAX_RESULTS,gt as MENTION_TEXT,p as MONEY_UNITS,At as NOTIFICATION_COUNT_CAP,Et as NOTIFICATION_TEXT,Ae as PIN_AT_VAR,He as PIN_SIDES,Ge as RESIZE_STEP,Me as RESIZE_STEP_LARGE,ze as ROW_HEIGHTS,qe as ROW_MOVE_LIMIT,Ne as ROW_MOVE_MS,Pe as ROW_SAVE_ATTR,Ue as ROW_SAVE_ERROR_CLASS,Be as ROW_SAVE_STATES,hr as SCROLL_EDGE_SELECTOR,_r as SELECT_ALL_LABEL,U as SELECT_CELL_CLASS,Wt as SELECT_KEY,vr as SELECT_ROW_LABEL,q as SERVER_ACTION_TEXT,qt as SHORTCUTS_OFF_ATTRIBUTE,Vt as SHORTCUT_EVENT,Lt as SHORTCUT_SCOPE_ATTRIBUTE,Gt as SHORTCUT_TEXT,me as STATUS_TONES,cr as THEME_BOOT_SCRIPT_BODY,$n as THEME_CHANGE_EVENT,Kn as THEME_EFFECTS,ar as THEME_EFFECT_DURATION,lr as THEME_LIVE_NAME,Jn as THEME_MODES,nr as THEME_SWITCHING_CLASS,X as UNSAVED_TEXT,Ie as VIRTUAL_OVERSCAN,hn as WHATS_NEW_READ_EVENT,v as WUI_HEADERS,A as WuiAutocomplete,j as WuiCarousel,_e as WuiCodeBlock,N as WuiCommandPalette,P as WuiCommentThread,F as WuiConsentBanner,I as WuiContextMenu,R as WuiCountrySelect,Ke as WuiDataTable,Qe as WuiDatePicker,$e as WuiDateRange,et as WuiDock,tt as WuiDrawer,nt as WuiHoverCard,rt as WuiImageCrop,at as WuiInlineEdit,w as WuiKanban,lt as WuiLightbox,ft as WuiMentionInput,bt as WuiMenubar,xt as WuiMultiSelect,St as WuiNavigationMenu,jt as WuiNotificationCenter,Mt as WuiOnboardingChecklist,Nt as WuiOtp,Pt as WuiOverflow,Ft as WuiPhone,It as WuiRating,Zt as WuiRecordPager,en as WuiRelativeTime,tn as WuiResizable,nn as WuiRollingNumber,L as WuiSelect,rn as WuiShortcuts,an as WuiShowMore,on as WuiSlider,sn as WuiSortable,k as WuiStatusIcon,cn as WuiTagInput,ln as WuiTimePicker,dn as WuiTour,fn as WuiTree,pn as WuiTruncate,mn as WuiWhatsNew,gn as WuiWizard,_n as WuiWizardStep,gr as acceptLabel,Tr as addRowSelectCells,Er as addSelectColumn,dr as applyTheme,Jt as ariaKeyShortcuts,tr as attachInputMask,qn as attachScrollEdges,kr as attachShiftRange,Wn as avatarCropOptions,Fn as avatarUnreadableMessage,pr as buildPasswordRules,Fe as clampColumnWidth,g as classifyStatus,$r as confirmAction,ve as copyTextToClipboard,un as createLocalSeenStore,ee as createRequestQueue,br as createSelectHeaderCell,xr as createSelectRowCell,Sr as createSelectSpacerCell,Ki as defineWeborityElements,Rn as evaluatePassword,n as formatCompact,s as formatCurrency,h as formatDate,r as formatDuration,yn as formatMasked,i as formatNumber,d as formatPercent,Qt as formatRelativeTime,c as formatValue,Lr as getServerTable,Ti as getShell,he as glyphSvg,ke as groupCount,Je as groupItems,Ot as groupNotificationsByDay,Ze as identityCell,Rt as inShortcutScope,er as initInputMasks,fe as initRemoteModals,mr as initScrollEdges,pi as initServerActions,Ir as initServerTables,wi as initShellParts,Wi as initUnsavedChanges,it as inlineEditText,vn as isHeicFile,bn as isImageFile,Bn as isImageOnlyAccept,jn as isMaskPattern,En as isPdfFile,Ht as isTypingTarget,ie as kanbanCardLabel,de as kanbanOverflow,T as kanbanStorageKey,E as kanbanSummaryFormat,ce as kanbanVisibleLimit,pe as loadRemoteModal,Mn as maskedPostValue,M as matchSegments,zn as matchesAccept,je as measureRows,ht as mentionLabel,_t as mentionTextFromValue,dt as mentionValueFromText,pt as mentionedIds,Xt as moveFocus,Yn as nextTheme,Tt as notificationCountText,Ct as notificationDayHeading,Dt as notificationTime,kt as notificationTriggerLabel,wt as notificationUnreadAnnouncement,yt as parseMentionValue,Cn as passwordSatisfies,Xe as pinAtValue,De as pinClasses,B as pinOffsetVar,Ye as planPins,Oe as playRowMoves,Pn as postedMasked,wn as rawMasked,Ce as readColumnWidths,x as readCsrf,ae as readKanbanCollapsed,Xn as readStoredTheme,$t as relativeTimeTitle,Gi as resetUnsavedChanges,Dn as resolveMask,or as resolveTheme,V as rowLabel,Ee as rowOrderChanged,zt as runShortcut,Re as saveOutcomeText,z as setRowSaveState,Le as settledRows,Bt as shortcutKey,Kt as shortcutName,Ut as shortcutsOff,rr as storeTheme,ne as sumKanbanValues,Dr as syncSelectAll,Qn as themeBootScript,Zn as themeKeyframes,a as toInstant,Gn as transitionTheme,Vn as validateFile,we as virtualRange,fr as watchSystemTheme,ge as withTrustedLabel,Te as writeColumnWidths,D as writeKanbanCollapsed,_ as wuiFetch};
@@ -1 +1 @@
1
- (function(){function e(e,t){typeof customElements<`u`&&!customElements.get(e)&&customElements.define(e,t)}var t=typeof HTMLElement>`u`?class{}:HTMLElement,n=4,r=300,i=400;function a(e,t,a={}){if(!e||!t)return;let o=e.getBoundingClientRect(),s=a.clampHeight?t.scrollTop:0;a.clampHeight&&(t.style.maxHeight=``);let c=t.offsetHeight,l=window.innerHeight-o.bottom,u=l<c+n&&o.top>l;if(t.classList.toggle(`drop-up`,u),t.style.position=`fixed`,t.style.top=u?`${Math.max(n,o.top-c-n)}px`:`${o.bottom+n}px`,a.clampHeight){let e=u?o.top-n*2:window.innerHeight-o.bottom-n*2;e<c&&(t.style.maxHeight=`${Math.max(e,0)}px`),t.scrollTop=s}a.matchWidth&&(o.width>=r?(t.style.minWidth=`${o.width}px`,t.style.width=`${o.width}px`,t.style.maxWidth=`${o.width}px`):(t.style.minWidth=`${o.width}px`,t.style.width=`max-content`,t.style.maxWidth=`${Math.min(i,window.innerWidth-n*2)}px`));let d=t.offsetWidth,f=Math.min(o.left,window.innerWidth-d-n);t.style.left=`${Math.max(n,f)}px`}function o(e,t){s(e),e._reanchor=t,e._reanchorScroll=n=>{n.target instanceof Node&&typeof e.contains==`function`&&e.contains(n.target)||t()},window.addEventListener(`resize`,e._reanchor),window.addEventListener(`scroll`,e._reanchorScroll,!0)}function s(e){e?._reanchor&&(window.removeEventListener(`resize`,e._reanchor),window.removeEventListener(`scroll`,e._reanchorScroll,!0),e._reanchor=null,e._reanchorScroll=null)}var c=` :host { all: initial; ${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)`,"--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-scrim-strong":`color-mix(in srgb, #071437 62%, transparent)`,"--color-surface":`#FFFFFF`,"--color-text":`#071437`,"--color-text-muted":`#4B5675`,"--color-border":`#EBEDF3`}).map(([e,t])=>` ${e}: ${t};`).join(` `)} } *, *::before, *::after { box-sizing: border-box; } [hidden] { display: none !important; } .visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; } .btn { display: inline-block; margin: 0; padding: 0.25rem 0.5rem; border: 1px solid transparent; border-radius: 0.375rem; background: transparent; font: inherit; font-size: 0.875rem; font-weight: 500; line-height: 1.5; text-align: center; text-decoration: none; white-space: nowrap; cursor: pointer; } .btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; } .btn-primary { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-primary-text); } .btn-primary:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); } .btn-outline-secondary { border-color: var(--color-text-muted); color: var(--color-text-muted); } .btn-outline-secondary:hover { background: var(--color-bg-muted); color: var(--color-text); } .btn-link { font-weight: 400; color: var(--color-primary-ink); text-decoration: underline; } .btn-link:hover { color: var(--color-primary-hover); } .wui-tour-layer { position: fixed; inset: 0; z-index: var(--wui-z-tour); pointer-events: none; font-family: "Webority Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 16px; font-weight: 400; line-height: 1.5; color: var(--color-text); text-align: start; } .wui-tour-spot { position: fixed; border-radius: var(--wui-radius-sm); box-shadow: 0 0 0 2px var(--color-primary), 0 0 0 100vmax var(--color-scrim-strong); pointer-events: none; } @media (prefers-reduced-motion: no-preference) { .wui-tour-spot { transition: top 160ms ease, left 160ms ease, width 160ms ease, height 160ms ease; } } .wui-tour-card { display: flex; flex-direction: column; gap: 8px; width: min(360px, 100vw - 16px); padding: 16px; overflow-y: auto; background: var(--color-surface); color: var(--color-text); border: 1px solid var(--color-border); border-radius: var(--wui-radius-lg); corner-shape: squircle; box-shadow: var(--wui-shadow-overlay); pointer-events: auto; } .wui-tour-card:focus { outline: none; } .wui-tour-card:focus-visible { outline: var(--wui-focus-ring-width) solid var(--color-focus-ring); outline-offset: var(--wui-focus-ring-offset); } .wui-tour-position { margin: 0; font-size: 12px; color: var(--color-text-muted); } .wui-tour-title { margin: 0; font-size: 16px; font-weight: 600; } .wui-tour-text { margin: 0; font-size: 14px; color: var(--color-text-muted); } .wui-tour-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; } .wui-tour-nav { display: flex; gap: 8px; } .wui-tour-skip { color: var(--color-text-muted); } .wui-tour-back, .wui-tour-next { min-width: 64px; } `,l=`data-wui-tour-open`,u=`wui-tour-step`,d=`wui-tour-host`,f=`wui-tour-seen:`,p={back:`Back`,next:`Next`,skip:`Skip`,done:`Done`},m={back:`back-label`,next:`next-label`,skip:`skip-label`,done:`done-label`},h=4,g=4,_=0;function v(e=f,t=globalThis.localStorage){return{isSeen:async n=>t.getItem(e+n)===`1`,markSeen:async n=>{t.setItem(e+n,`1`)}}}var y=e=>!e?.isConnected||getComputedStyle(e).visibility===`hidden`?!1:e.getClientRects().length>0,b=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName)),x=()=>{let e=document.activeElement;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e},S=null;function C(e){if(`adoptedStyleSheets`in e&&typeof CSSStyleSheet==`function`&&`replaceSync`in CSSStyleSheet.prototype){S||(S=new CSSStyleSheet,S.replaceSync(c)),e.adoptedStyleSheets=[S];return}let t=document.createElement(`style`);t.textContent=c,e.appendChild(t)}var w=class extends t{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}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 > ${u}`),e=>({target:e.getAttribute(`target`)||``,title:e.getAttribute(`title`)||void 0,description:e.textContent.trim()}))}_store(){return this.seenStore?this.seenStore:this.getAttribute(`seen-store`)===`local`?v():globalThis.window?.WUI?.tour?.seenStore||null}_label(e){return this.getAttribute(m[e])||p[e]}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();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}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._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(y(t))return{index:i,target:t}}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-${++_}`,t=document.createElement(`div`);t.className=`wui-tour-layer`,t.innerHTML=` <div class="wui-tour-spot" aria-hidden="true"></div> <div class="wui-tour-card" role="dialog" aria-modal="true" tabindex="-1" aria-labelledby="${e}-title" aria-describedby="${e}-text"> <p class="wui-tour-position"></p> <h2 class="wui-tour-title" id="${e}-title"></h2> <p class="wui-tour-text" id="${e}-text"></p> <div class="wui-tour-actions"> <button type="button" class="btn btn-sm btn-link wui-tour-skip"></button> <div class="wui-tour-nav"> <button type="button" class="btn btn-sm btn-outline-secondary wui-tour-back"></button> <button type="button" class="btn btn-sm btn-primary wui-tour-next"></button> </div> </div> </div> <div class="visually-hidden" role="status" aria-live="polite"></div>`;let n=t;this._shadow=null,this.isolated&&(n=document.createElement(d),this._shadow=n.attachShadow({mode:`open`}),C(this._shadow),this._shadow.appendChild(t)),document.body.appendChild(n),document.documentElement.setAttribute(l,``),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`)),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=>{this._layer&&!this._layer.contains(e.target)&&this._card.focus()},document.addEventListener(`keydown`,this._onKey,!0),this._shadow||document.addEventListener(`focusin`,this._onFocusIn),o(n,()=>this._place())}_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._steps,a=t===i.length-1,o=this._card;o.querySelector(`.wui-tour-position`).textContent=`Step ${t+1} of ${i.length}`;let s=o.querySelector(`.wui-tour-title`);s.textContent=r.title||``,s.hidden=!r.title,o.querySelector(`.wui-tour-text`).textContent=r.description||``,o.querySelector(`.wui-tour-skip`).textContent=this._label(`skip`),o.querySelector(`.wui-tour-back`).textContent=this._label(`back`),o.querySelector(`.wui-tour-back`).hidden=t<=this._firstIndex,o.querySelector(`.wui-tour-next`).textContent=this._label(a?`done`:`next`),this._live.textContent=[`Step ${t+1} of ${i.length}`,r.title,r.description].filter(Boolean).join(`. `),this._scrollTo(n),this._place();let c=this._active();(o.contains(c)?!c.hidden:this._shadow!==null&&b(x()))||o.focus(),this.dispatchEvent(new CustomEvent(`wui-tour:step`,{bubbles:!0,detail:{step:r,index:t}}))}_scrollTo(e){if(!e?.scrollIntoView)return;this._card.style.maxHeight=``;let t=this._card.offsetHeight+g*2;if(e.getBoundingClientRect().height+h*2+t*2<=window.innerHeight){e.scrollIntoView({block:`center`,inline:`nearest`});return}let n=e.style.scrollMarginTop;e.style.scrollMarginTop=`${t+h}px`,e.scrollIntoView({block:`start`,inline:`nearest`}),e.style.scrollMarginTop=n}_place(){if(!this._current||!this._layer)return;let e=this._spot.style,t=this._card.style;if(!this._current.target){e.top=`50%`,e.left=`50%`,e.width=`0px`,e.height=`0px`,e.boxShadow=`0 0 0 100vmax var(--color-scrim-strong)`,this._card.classList.remove(`drop-up`),t.position=`fixed`,t.top=`50%`,t.left=`50%`,t.transform=`translate(-50%, -50%)`,t.maxHeight=`calc(100vh - 16px)`;return}e.boxShadow=``,t.transform=``;let n=this._current.target.getBoundingClientRect(),r={top:n.top-h,left:n.left-h,width:n.width+h*2,height:n.height+h*2,bottom:n.bottom+h,right:n.right+h};e.top=`${r.top}px`,e.left=`${r.left}px`,e.width=`${r.width}px`,e.height=`${r.height}px`;let i=this._card.scrollTop;t.maxHeight=``;let o=this._card.offsetHeight,s=window.innerHeight-g*2,c=Math.max(r.top,window.innerHeight-r.bottom)-g*2,l=Math.min(n.bottom,window.innerHeight)-Math.max(n.top,0);o<=c+1||l<Math.min(o,s)+g*2?a({getBoundingClientRect:()=>r},this._card,{clampHeight:!0}):this._placeOver(n,o,s),this._card.scrollTop=i}_placeOver(e,t,n){let r=this._card;r.classList.remove(`drop-up`),r.style.position=`fixed`,r.style.maxHeight=t>n?`${Math.max(n,0)}px`:``;let i=Math.min(e.bottom,window.innerHeight)-g;r.style.top=`${Math.max(g,i-Math.min(t,n))}px`;let a=Math.min(e.left+g,window.innerWidth-r.offsetWidth-g);r.style.left=`${Math.max(g,a)}px`}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;r?this._show(r):t>0&&await this._close(`finished`)}finally{this._moving=!1}}_key(e){if(!(!this._layer||e.altKey||e.ctrlKey||e.metaKey)){if(e.key===`Escape`)e.preventDefault(),e.stopPropagation(),this._close(`skipped`);else if(e.key===`ArrowRight`||e.key===`ArrowLeft`){if(this._shadow&&b(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 t=Array.from(this._card.querySelectorAll(`button`)).filter(e=>!e.hidden),n=t[0],r=t[t.length-1],i=this._active();!this._card.contains(i)||e.shiftKey&&(i===n||i===this._card)?(e.preventDefault(),(e.shiftKey?r:n).focus()):!e.shiftKey&&i===r&&(e.preventDefault(),n.focus())}}}_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;s(this._outer),this._outer.remove(),document.documentElement.removeAttribute(l),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){let t=this._run;this._teardown();let n=this._store();try{n&&t===this._run&&await n.markSeen(this.tourId)}finally{this._finish(e)}}_finish(e){this._run++,this._running=!1,this.hasAttribute(`open`)&&this.removeAttribute(`open`),this.dispatchEvent(new CustomEvent(`wui-tour:close`,{bubbles:!0,detail:{reason:e}}))}},T=class extends t{constructor(){super(),this.shadowRoot||this.attachShadow({mode:`open`})}};e(`wui-tour`,w),e(`wui-tour-step`,T)})();
1
+ (function(){function e(e,t){typeof customElements<`u`&&!customElements.get(e)&&customElements.define(e,t)}var t=typeof HTMLElement>`u`?class{}:HTMLElement;function n(e,t){r(e),e._reanchor=t,e._reanchorScroll=n=>{n.target instanceof Node&&typeof e.contains==`function`&&e.contains(n.target)||t()},window.addEventListener(`resize`,e._reanchor),window.addEventListener(`scroll`,e._reanchorScroll,!0)}function r(e){e?._reanchor&&(window.removeEventListener(`resize`,e._reanchor),window.removeEventListener(`scroll`,e._reanchorScroll,!0),e._reanchor=null,e._reanchorScroll=null)}var i=`data-advance`,a=`wui-tour-hint`,o=`Click {actionName} to continue.`,s=`a[href], button, input, select, textarea, summary, [tabindex], [contenteditable]`,c=(e,t)=>e?.advanceOn===`click`&&!!t,l=e=>(e??``).replace(/\s+/g,` `).trim();function u(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=l(e);if(t)return t}return``}function d(e){for(let t of[e,...e.querySelectorAll(s)])if(t.tabIndex>=0&&!t.disabled)return t;return null}function f(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 p(e,t){let n=e.querySelector(`.${a}`),r=e.querySelector(`.wui-tour-text`)?.id,i=r?`${r.replace(/-text$/,``)}-hint`:``;if(!t){n?.remove(),i&&f(e,i,!1);return}n||(n=e.ownerDocument.createElement(`p`),n.className=a,i&&(n.id=i),e.querySelector(`.wui-tour-actions`).before(n)),n.textContent=t,i&&f(e,i,!0)}var m=e=>getComputedStyle(e).animationName;function h(e,{layer:t,spot:n,card:r},a,s){let d=c(a,s);t.toggleAttribute(i,d&&!(t.getRootNode()instanceof ShadowRoot)),n.hasAttribute(i)&&(n.removeAttribute(i),d&&m(n)),d&&n.setAttribute(i,``);let f=r.querySelector(`.wui-tour-next`);f.classList.toggle(`btn-primary`,!d),f.classList.toggle(`btn-link`,d);let h=d?l(a.actionLabel)||u(s):``,g=e.getAttribute(`advance-label`)||o,_=h?g.replace(/\{actionName\}/g,()=>h):``;return p(r,_),_}function g(e,t,n){if(!c(e,t))return()=>{};let r=null,i=()=>{r??=setTimeout(n,0)};return t.addEventListener(`click`,i),()=>{t.removeEventListener(`click`,i),clearTimeout(r)}}function _(e,t,n,r){return e.contains(r)||c(t,n)&&n.contains(r)}function ee(e,{card:t,active:n,step:r,target:i}){let a=Array.from(t.querySelectorAll(`button`)).filter(e=>!e.hidden),o=c(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 te=2/3,ne=1e3,v=new Set([`top`,`left`,`width`,`height`]),y=new WeakMap,b=(e,t)=>typeof e.getAnimations==`function`?e.getAnimations().filter(t):[],x=e=>e.transitionProperty===`opacity`,re=e=>v.has(e.transitionProperty),S=e=>typeof e.animationName==`string`&&e.animationName.startsWith(`wui-tour-`);function C(e){return e.length===0?null:new Promise(t=>{let n=setTimeout(t,ne);Promise.allSettled(e.map(e=>e.finished)).then(()=>{clearTimeout(n),t()})})}function ie(e){let t=e.parentElement?.querySelector(`:scope > .wui-tour-spot`),n=0;for(let e of t?b(t,re):[]){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*te-r)}return n}function w(e){let t=ie(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={};y.set(e,n);let r=()=>{y.get(e)===n&&e.dataset.state===`entering`&&(e.dataset.state=`shown`)},i=b(e,S);i.length===0?r():Promise.allSettled(i.map(e=>e.finished)).then(r)}function T(e){return e.dataset.state=`leaving`,C(b(e,x))}function ae(e){let t=e.classList.contains(`wui-tour-layer`)?e:e.shadowRoot?.querySelector(`.wui-tour-layer`);t&&(t.dataset.state=`leaving`);let n=t?C(b(t,x)):null;if(!n){e.remove();return}e.setAttribute(`inert`,``),n.then(()=>e.remove())}var E=2,D=12,O=8,k=4,A=20,oe=`(max-width: 575.98px)`,se=[`bottom`,`top`,`right`,`left`],j=[`top-left`,`top-right`,`bottom-right`,`bottom-left`],M,N=(e,t,n)=>Math.max(t,Math.min(e,n)),P=(e,t,n,r)=>(Math.max(e,n)+Math.min(t,r))/2;function ce(e,t){if(!t?.scrollIntoView)return;e.style.maxHeight=``;let n=z(e),r=e.offsetHeight+D;if(t.getBoundingClientRect().height+E*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+E}px`,t.scrollIntoView({block:`start`,inline:`nearest`}),t.style.scrollMarginTop=i}function F(e,t,n){let r=e.style,i=t.style,a=B(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 j)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`,le(r,n);let s=t.scrollTop;i.maxHeight=``;let c={width:t.offsetWidth,height:t.offsetHeight},l=z(t),u=l.bottom-l.top,d={bottom:l.bottom-o.bottom-D,top:o.top-D-l.top,right:l.right-o.right-D,left:o.left-D-l.left},f=window.matchMedia(oe).matches,p=se.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+O)-Math.max(o.top,l.top-O);p?I(t,a,p,o,l,c):m>=Math.min(c.height,u)+k*2?L(t,a,o,l,c):R(t,a,d.bottom>=d.top?`bottom`:`top`,o,l,c,d),t.scrollTop=s}function le(e,t){M??=CSS.supports(`corner-top-left-shape`,`squircle`);let n=getComputedStyle(t);for(let t of j)e.setProperty(`border-${t}-radius`,n.getPropertyValue(`border-${t}-radius`)),M&&e.setProperty(`corner-${t}-shape`,n.getPropertyValue(`corner-${t}-shape`))}function I(e,t,n,r,i,a){let o=n===`top`||n===`bottom`,s,c,l;if(o){let e=P(r.left,r.right,i.left,i.right);s=N(e-a.width/2,i.left,i.right-a.width),c=n===`bottom`?r.bottom+D:r.top-D-a.height,l=N(e-s,A,a.width-A)}else{let e=P(r.top,r.bottom,i.top,i.bottom);c=N(e-a.height/2,i.top,i.bottom-a.height),s=n===`right`?r.right+D:r.left-D-a.width,l=N(e-c,A,a.height-A)}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 L(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)-k;e.style.top=`${Math.max(r.top,o-Math.min(i.height,a))}px`,e.style.left=`${N(n.left+k,r.left,r.right-i.width)}px`}function R(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+D:r.top-D-c}px`;let l=P(r.left,r.right,i.left,i.right);e.style.left=`${N(l-a.width/2,i.left,i.right-a.width)}px`}function z(e){let t=e.parentElement,n=t?getComputedStyle(t):null,r=e=>Number.parseFloat(n?.[e])||0;return{top:r(`paddingTop`)+O,bottom:window.innerHeight-r(`paddingBottom`)-O,left:r(`paddingLeft`)+O,right:window.innerWidth-r(`paddingRight`)-O}}function B(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 V=0;function H(e,t,n){let r=`wui-tour-end-${++V}`,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=` <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> <h2 class="wui-tour-title wui-tour-end-title" id="${r}-title"></h2> <p class="wui-tour-text wui-tour-end-message" id="${r}-message"></p> <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 U(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=H(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,F(o,a,null),e.append(c),w(c),s.textContent=[t.title,t.message].filter(Boolean).join(`. `),l.focus())},h=T(a);h?h.then(m):m()})}var W=` :host { all: initial; ${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(` `)} } *, *::before, *::after { box-sizing: border-box; } [hidden] { display: none !important; } .visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; } .btn { display: inline-block; margin: 0; padding: 0.25rem 0.5rem; border: 1px solid transparent; border-radius: 0.375rem; background: transparent; font: inherit; font-size: 0.875rem; font-weight: 500; line-height: 1.5; text-align: center; text-decoration: none; white-space: nowrap; cursor: pointer; } .btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; } .btn-primary { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-primary-text); } .btn-primary:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); } .btn-outline-secondary { border-color: var(--color-text-muted); color: var(--color-text-muted); } .btn-outline-secondary:hover { background: var(--color-bg-muted); color: var(--color-text); } .btn-link { font-weight: 400; color: var(--color-primary-ink); text-decoration: underline; } .btn-link:hover { color: var(--color-primary-hover); } .wui-tour-layer { pointer-events: none; font-family: "Webority Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 16px; font-weight: 400; line-height: 1.5; color: var(--color-text); text-align: start; } .wui-tour-card { pointer-events: auto; } .wui-tour-layer { position: fixed; inset: 0; z-index: var(--wui-z-tour); } .wui-tour-spot { position: fixed; box-shadow: 0 0 0 2px var(--color-primary), 0 0 0 100vmax var(--color-scrim-strong); pointer-events: none; } .wui-tour-card { display: flex; flex-direction: column; gap: 8px; width: min(360px, 100vw - 16px); padding: 16px; overflow-y: auto; background: var(--color-surface); color: var(--color-text); border: 1px solid var(--color-border); border-radius: var(--wui-radius-lg); corner-shape: squircle; box-shadow: var(--wui-shadow-overlay); } .wui-tour-card:focus { outline: none; } .wui-tour-card:focus-visible { outline: var(--wui-focus-ring-width) solid var(--color-focus-ring); outline-offset: var(--wui-focus-ring-offset); } .wui-tour-title { margin: 0; font-size: 16px; font-weight: 600; } .wui-tour-text { margin: 0; font-size: 14px; color: var(--color-text-muted); } .wui-tour-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; } .wui-tour-nav { display: flex; gap: 8px; } .wui-tour-skip { color: var(--color-text-muted); } .wui-tour-back, .wui-tour-next { min-width: 64px; } @keyframes wui-tour-fade-in { from { opacity: 0; } to { opacity: 1; } } @keyframes wui-tour-card-enter { from { opacity: 0; scale: 0.96; translate: var(--wui-tour-card-lift, 0 6px); } to { opacity: 1; scale: 1; translate: 0 0; } } .wui-tour-layer[data-state=leaving], .wui-tour-card[data-state=leaving] { opacity: 0; } .wui-tour-layer[data-state=leaving], .wui-tour-layer[data-state=leaving] * { pointer-events: none; } @media (prefers-reduced-motion: no-preference) { .wui-tour-layer { animation: wui-tour-fade-in var(--wui-tour-motion-duration) var(--wui-tour-motion-ease); } .wui-tour-layer[data-state=leaving] { transition: opacity var(--wui-tour-motion-duration) var(--wui-tour-motion-ease); } .wui-tour-spot { transition: top var(--wui-tour-spot-duration) var(--wui-tour-spot-ease), left var(--wui-tour-spot-duration) var(--wui-tour-spot-ease), width var(--wui-tour-spot-duration) var(--wui-tour-spot-ease), height var(--wui-tour-spot-duration) var(--wui-tour-spot-ease), border-radius var(--wui-tour-spot-duration) var(--wui-tour-spot-ease); } .wui-tour-spot[data-tracking] { transition: none; } .wui-tour-card { --wui-tour-card-lift: 0 6px; transform-origin: top center; } .wui-tour-card[data-placement=top] { --wui-tour-card-lift: 0 -6px; transform-origin: bottom center; } .wui-tour-card[data-placement=bottom] { --wui-tour-card-lift: 0 6px; transform-origin: top center; } .wui-tour-card[data-placement=left] { --wui-tour-card-lift: -6px 0; transform-origin: right center; } .wui-tour-card[data-placement=right] { --wui-tour-card-lift: 6px 0; transform-origin: left center; } .wui-tour-card[data-placement=overlap], .wui-tour-card[data-placement=center] { --wui-tour-card-lift: 0 0; transform-origin: center; } .wui-tour-card[data-state=entering] { animation: wui-tour-card-enter var(--wui-tour-motion-duration) var(--wui-tour-motion-ease) var(--wui-tour-card-delay, 0ms) both; } .wui-tour-card[data-state=leaving] { transition: opacity calc(var(--wui-tour-motion-duration) / 2) var(--wui-tour-motion-ease); } } @media (prefers-reduced-motion: reduce) { .wui-tour-layer { animation: wui-tour-fade-in 120ms linear; } .wui-tour-layer[data-state=leaving] { transition: opacity 120ms linear; } .wui-tour-card[data-state=entering] { animation: wui-tour-fade-in 120ms linear both; } } .wui-tour-progress-bar { display: flex; gap: 4px; } .wui-tour-progress-segment { flex: 1 1 0; height: 4px; border-radius: 999px; background: var(--color-border); } .wui-tour-progress-segment[data-filled] { background: var(--color-primary); } .wui-tour-position { margin: 0; font-size: 12px; color: var(--color-text-muted); } .wui-tour-layer { padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); } .wui-tour-card:has(.wui-tour-arrow:not([hidden])) { overflow: visible; } .wui-tour-arrow { position: absolute; width: 8px; height: 8px; background: var(--color-surface); border: 1px solid var(--color-border); rotate: 45deg; pointer-events: none; } .wui-tour-card[data-placement=bottom] .wui-tour-arrow { top: -5px; border-right-color: rgba(0, 0, 0, 0); border-bottom-color: rgba(0, 0, 0, 0); } .wui-tour-card[data-placement=top] .wui-tour-arrow { bottom: -5px; border-top-color: rgba(0, 0, 0, 0); border-left-color: rgba(0, 0, 0, 0); } .wui-tour-card[data-placement=right] .wui-tour-arrow { left: -5px; border-top-color: rgba(0, 0, 0, 0); border-right-color: rgba(0, 0, 0, 0); } .wui-tour-card[data-placement=left] .wui-tour-arrow { right: -5px; border-bottom-color: rgba(0, 0, 0, 0); border-left-color: rgba(0, 0, 0, 0); } @media (max-width: 575.98px) { .wui-tour-card { width: calc(100vw - 16px); } .wui-tour-actions .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; } } .wui-tour-media { position: relative; order: -1; flex: none; aspect-ratio: 16/9; margin: -16px -16px 4px; overflow: hidden; background: var(--color-border); } .wui-tour-media>img, .wui-tour-media>video { display: block; width: 100%; height: 100%; object-fit: cover; } .wui-tour-card[data-media=welcome] { width: min(420px, 100vw - 16px); } .wui-tour-media-toggle { position: absolute; inset-block-end: 8px; inset-inline-end: 8px; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: var(--color-scrim-strong); color: var(--color-on-scrim); cursor: pointer; } .wui-tour-media-toggle>svg { width: 20px; height: 20px; fill: currentColor; } .wui-tour-media-toggle:focus-visible { outline: 2px solid var(--color-on-scrim); outline-offset: 2px; } .wui-tour-layer[data-advance] { pointer-events: none; } .wui-tour-layer[data-advance]:not([data-state=leaving]) .wui-tour-card { pointer-events: auto; } .wui-tour-layer[data-advance]:not([data-state=leaving]) .wui-tour-spot::before { content: ""; position: absolute; inset: -100vmax; pointer-events: auto; clip-path: polygon(evenodd, 0 0, 100% 0, 100% 100%, 0 100%, 0 0, 100vmax 100vmax, calc(100% - 100vmax) 100vmax, calc(100% - 100vmax) calc(100% - 100vmax), 100vmax calc(100% - 100vmax), 100vmax 100vmax); } .wui-tour-hint { margin: 0; font-size: 14px; font-weight: 600; color: var(--color-text); } @keyframes wui-tour-pulse { from { box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary) 85%, transparent); } to { box-shadow: 0 0 0 14px color-mix(in srgb, var(--color-primary) 0%, transparent); } } @media (prefers-reduced-motion: no-preference) { .wui-tour-spot[data-advance]::after { content: ""; position: absolute; inset: 0; border-radius: inherit; corner-shape: inherit; pointer-events: none; animation: wui-tour-pulse 600ms var(--wui-ease-out-quart) var(--wui-tour-spot-duration); } } @keyframes wui-tour-check { from { stroke-dashoffset: 24; } to { stroke-dashoffset: 0; } } .wui-tour-end[data-layout=center] { --wui-tour-card-lift: 0 0; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); transform-origin: center; align-items: center; gap: 8px; width: min(420px, 100vw - 16px); max-height: calc(100vh - 16px); padding: 24px; text-align: center; } .wui-tour-end[data-layout=center] .wui-tour-actions { justify-content: center; margin-top: 8px; } .wui-tour-end-mark { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 50%; background: var(--color-success-soft); color: var(--color-success-text); } .wui-tour-end-mark>svg { width: 26px; height: 26px; } .wui-tour-end-mark path { fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 24; } .wui-tour-end-title { font-size: 18px; } .wui-tour-end-message { text-wrap: balance; } .wui-tour-end-button { min-width: 120px; } @media (prefers-reduced-motion: no-preference) { .wui-tour-end-mark path { animation: wui-tour-check 300ms var(--wui-ease-out-quart) calc(var(--wui-tour-card-delay, 0ms) + 120ms) both; } } `,G=`wui-tour-media`,ue=`wui-tour-media-toggle`,K=`http://www.w3.org/2000/svg`,de=`M6 5h4v14H6zM14 5h4v14h-4z`,fe=`M8 5v14l11-7z`,pe={pause:`Pause animation`,play:`Play animation`},me=()=>globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`)?.matches===!0;function he(e){let t=document.createElementNS(K,`svg`);t.setAttribute(`viewBox`,`0 0 24 24`),t.setAttribute(`aria-hidden`,`true`),t.setAttribute(`focusable`,`false`);let n=document.createElementNS(K,`path`);return n.setAttribute(`d`,e),t.appendChild(n),t}function ge(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 _e(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 ve(e,t){let n=document.createElement(`button`);n.type=`button`,n.className=ue;let r=(r=!e.paused)=>{n.setAttribute(`aria-label`,r?t.pause:t.play),n.replaceChildren(he(r?de:fe))};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 ye(e){let t=e.querySelector(`:scope > .${G}`);if(!t)return;let n=t.querySelector(`video`);n&&(n.pause(),n.removeAttribute(`src`),n.load()),t.remove()}function be(e,t,n=pe){if(ye(e),!t.media){e.removeAttribute(`data-media`);return}let r=document.createElement(`div`);if(r.className=G,t.mediaType===`video`){let e=_e(t,!me());r.append(e,ve(e,n))}else r.appendChild(ge(t));e.prepend(r),e.setAttribute(`data-media`,t.target?`step`:`welcome`)}var q=`data-wui-tour-open`,xe=`Step {current} of {total}`;function Se(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 Ce(e,t,n){return(e.getAttribute(`progress-label`)||xe).replace(/\{(current|total)\}/g,(e,r)=>String(r===`current`?t:n))}function we(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 Te=`wui-tour-step`,Ee=`wui-tour-host`,De=`wui-tour-seen:`,J=`data-tracking`,Oe={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`},ke={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`},Ae=[[`media`,`media`],[`mediaAlt`,`media-alt`],[`mediaPoster`,`media-poster`],[`mediaType`,`media-type`],[`advanceOn`,`advance-on`],[`actionLabel`,`action-label`]],Y={index:null,position:null,total:null},X=0;function je(e=De,t=globalThis.localStorage){return{isSeen:async n=>t.getItem(e+n)===`1`,markSeen:async n=>{t.setItem(e+n,`1`)}}}var Z=e=>!e?.isConnected||getComputedStyle(e).visibility===`hidden`?!1:e.getClientRects().length>0,Q=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName)),Me=()=>{let e=document.activeElement;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e},$=null;function Ne(e){if(`adoptedStyleSheets`in e&&typeof CSSStyleSheet==`function`&&`replaceSync`in CSSStyleSheet.prototype){$||($=new CSSStyleSheet,$.replaceSync(W)),e.adoptedStyleSheets=[$];return}let t=document.createElement(`style`);t.textContent=W,e.appendChild(t)}var Pe=class extends t{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 > ${Te}`),e=>{let t={target:e.getAttribute(`target`)||``,title:e.getAttribute(`title`)||void 0,description:e.textContent.trim()};for(let[n,r]of Ae)e.hasAttribute(r)&&(t[n]=e.getAttribute(r));return t})}_store(){return this.seenStore?this.seenStore:this.getAttribute(`seen-store`)===`local`?je():globalThis.window?.WUI?.tour?.seenStore||null}_label(e){return this.getAttribute(ke[e])||Oe[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=Se(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&&!Z(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(Z(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-${++X}`,t=document.createElement(`div`);t.className=`wui-tour-layer`,t.innerHTML=` <div class="wui-tour-spot" aria-hidden="true"></div> <div class="wui-tour-card" role="dialog" aria-modal="true" tabindex="-1" aria-labelledby="${e}-title" aria-describedby="${e}-text"> <p class="wui-tour-position"></p> <h2 class="wui-tour-title" id="${e}-title"></h2> <p class="wui-tour-text" id="${e}-text"></p> <div class="wui-tour-actions"> <button type="button" class="btn btn-sm btn-link wui-tour-skip"></button> <div class="wui-tour-nav"> <button type="button" class="btn btn-sm btn-outline-secondary wui-tour-back"></button> <button type="button" class="btn btn-sm btn-primary wui-tour-next"></button> </div> </div> </div> <div class="visually-hidden" role="status" aria-live="polite"></div>`;let r=t;this._shadow=null,this.isolated&&(r=document.createElement(Ee),this._shadow=r.attachShadow({mode:`open`}),Ne(this._shadow),this._shadow.appendChild(t)),document.body.appendChild(r),document.documentElement.setAttribute(q,``),this._outer=r,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;_(this._layer,n,t?.target??null,e.target)||this._card.focus()},document.addEventListener(`keydown`,this._onKey,!0),this._shadow||document.addEventListener(`focusin`,this._onFocusIn),n(r,()=>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=Ce(this,a,o);we(i,{text:c,position:a,total:o}),be(i,r,{pause:this._label(`mediaPause`),play:this._label(`mediaPlay`)});let l=h(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,ce(i,n),this._spot.removeAttribute(J),this._place(),w(i),this._unbindAdvance?.(),this._unbindAdvance=g(r,n,()=>this._move(1));let f=this._active();(i.contains(f)?!f.hidden:this._shadow!==null&&Q(Me()))||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||F(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(J,``)}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=T(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,h(this,{layer:this._layer,spot:this._spot,card:this._card},null,null),this._spot.removeAttribute(J),this._ending=new AbortController,this._seenMark=this._markSeen(`finished`),U(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(Q(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;ee(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,r(this._outer),ae(this._outer),document.documentElement.removeAttribute(q),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()}:Y,a=this._seenMark;this._teardown();try{n===this._run&&await(a??this._markSeen(e))}finally{this._finish(e,i,t)}}_finish(e,t=Y,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}}))}},Fe=class extends t{constructor(){super(),this.shadowRoot||this.attachShadow({mode:`open`})}};e(`wui-tour`,Pe),e(`wui-tour-step`,Fe)})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/ui-elements",
3
- "version": "0.54.0",
3
+ "version": "0.55.0",
4
4
  "description": "Webority framework-agnostic UI custom elements (<wui-*>) — the single implementation of the interactive components, styled by @webority/theme. Used natively in Razor and wrapped by @webority/ui-react.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",
@@ -1,13 +0,0 @@
1
- import{t as e}from"./elementBase-BlsR4tqa.js";import{n as t,r as n,t as r}from"./anchorOverlay-WcDeH46q.js";import{n as i,t as a}from"./focusOrigin-2imUSs-u.js";import{t as o}from"./formMirror-BgY7zkC3.js";import{t as s}from"./iconGlyphs.g-CUm_mfze.js";import{n as c,t as l}from"./listboxKeyNav-DMIvs9d6.js";import{n as u,r as d,t as f}from"./optionLabel-DOZb8ERB.js";var p=class extends e{static formAssociated=!0;_accessibleName(){return this.getAttribute(`aria-label`)||this.getAttribute(`placeholder`)||`Select`}static get observedAttributes(){return[`value`,`placeholder`,`disabled`,`min-chars`,`debounce`,`remote`,`size`,`aria-label`,`allow-custom`,`aria-invalid`]}constructor(){super(),this._value=``,this._label=``,this._optionsProp=null,this._loading=!1,this._active=-1,this._timer=null,this._reqSeq=0,this._pendingSearch=null,this._typeahead=``,this._typeaheadTimer=null;try{this._internals=this.attachInternals()}catch{this._internals=null}}connectedCallback(){if(!this._rendered){this._defaultCaptured||=(this._defaultValue=this._value,!0),this.render();return}if(this._bindGlobal?.(),this._pendingSearch){let{query:e,seq:t}=this._pendingSearch;clearTimeout(this._timer),this._timer=setTimeout(()=>this._fireSearch(e,t),this._debounceMs)}}formResetCallback(){this.value=this._defaultValue||``}attributeChangedCallback(e,t,n){if(e===`value`){this.value=n;return}if(e===`aria-invalid`){this._syncInvalid();return}this._rendered&&this.render()}_syncInvalid(){let e=this.querySelector(`.search-select-control`);e&&(this.hasAttribute(`aria-invalid`)?e.setAttribute(`aria-invalid`,`true`):e.removeAttribute(`aria-invalid`))}get value(){return this._value}set value(e){this._value=e==null?``:String(e),o(this,this._value);let t=this._readOptions().find(e=>String(e.value)===this._value);this._label=t?h(t.label):``,this._syncInput(),this._renderOptions(``)}set options(e){this._optionsProp=Array.isArray(e)?e:[];let t=this._readOptions().find(e=>String(e.value)===this._value);t&&(this._label=h(t.label)),this._renderOptions(),this._syncInput()}get options(){return this._readOptions()}set loading(e){this._loading=!!e,this._renderLoading(),this._renderOptions()}get loading(){return this._loading}get _remote(){return this.hasAttribute(`remote`)}get _allowCustom(){return this.hasAttribute(`allow-custom`)}_matchesKnownOption(e){let t=e.toLowerCase();return this._readOptions().some(e=>h(e.label).toLowerCase()===t||String(e.value??``).toLowerCase()===t)}get _minChars(){return Math.max(0,Number(this.getAttribute(`min-chars`))||+!!this._remote)}get _debounceMs(){let e=this.getAttribute(`debounce`);if(e==null||e===``)return 250;let t=Number(e);return Number.isFinite(t)&&t>=0?t:250}_snapshotDeclared(){if(this._declared)return;let e=[...this.querySelectorAll(`:scope > wui-option`)];e.length&&(this._declared=e.map(e=>({value:e.getAttribute(`value`)??e.textContent.trim(),label:e.innerHTML,icon:e.getAttribute(`icon`)||void 0,[f]:!0,selected:e.hasAttribute(`selected`)})))}_readOptions(){return this._optionsProp?this._optionsProp:(this._snapshotDeclared(),this._declared||[])}render(){this._snapshotDeclared();let e=this.getAttribute(`placeholder`)||`Search…`,t=this.getAttribute(`size`),n=t===`sm`?` search-select-sm`:t===`lg`?` search-select-lg`:``;this.id||=`wui-autocomplete-${Math.random().toString(36).slice(2,9)}`;let r=`${this.id}-listbox`;this._listboxId=r,this.innerHTML=`
2
- <div class="search-select${n}">
3
- <div class="input search-select-control search-select-ac" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="${m(r)}" aria-label="${m(this._accessibleName())}"${this.hasAttribute(`aria-invalid`)?` aria-invalid="true"`:``}>
4
- <input class="search-select-input search-select-ac-input" placeholder="${m(e)}" aria-autocomplete="list" autocomplete="off"${this.hasAttribute(`disabled`)?` disabled`:``} />
5
- <span class="search-select-spinner spinner-border spinner-border-sm" role="status" aria-hidden="true" hidden></span>
6
- <button type="button" class="search-select-clear" aria-label="Clear" hidden>${s(`x`)}</button>
7
- </div>
8
- <div class="search-select-menu search-select-menu-fixed" role="listbox" id="${m(r)}" tabindex="-1" hidden>
9
- <div class="search-select-options"></div>
10
- <div class="search-select-empty" hidden>No matches</div>
11
- <div class="search-select-hint" hidden>Type to search…</div>
12
- </div>
13
- </div>`,this._rendered=!0,o(this,this._value),this._wire(),this._syncInput(),this._renderOptions()}_refs(){return{control:this.querySelector(`.search-select-control`),input:this.querySelector(`.search-select-ac-input`),menu:this.querySelector(`.search-select-menu`),spinner:this.querySelector(`.search-select-spinner`),clear:this.querySelector(`.search-select-clear`),optionsWrap:this.querySelector(`.search-select-options`),empty:this.querySelector(`.search-select-empty`),hint:this.querySelector(`.search-select-hint`)}}_optionEls(){return[...this.querySelectorAll(`.search-select-option`)]}_syncInput(){let{input:e,clear:t}=this._refs();e&&document.activeElement!==e&&(e.value=this._label),t&&(t.hidden=!this._value&&!e?.value)}_renderLoading(){let{spinner:e}=this._refs();e&&(e.hidden=!this._loading)}_renderOptions(e){let t=this._refs();if(!t.optionsWrap)return;let n=e??(t.input?t.input.value:``),r=n.trim().toLowerCase(),i=this._readOptions();!this._remote&&r&&(i=i.filter(e=>h(e.label).toLowerCase().includes(r)));let a=n.trim(),o=this._allowCustom&&a&&!this._matchesKnownOption(a)?[...i,{value:a,custom:!0}]:i,s=this._listboxId||`${this.id||`wui-autocomplete`}-listbox`;t.optionsWrap.innerHTML=o.map((e,t)=>{let n=`${s}-opt-${t}`;if(e.custom){let t=`Add “${u(e.value)}”`;return`<button type="button" role="option" id="${m(n)}" class="search-select-option search-select-option-custom" data-value="${m(e.value)}" data-custom="true" aria-selected="false">${t}</button>`}let r=String(e.value)===String(this._value);return`<button type="button" role="option" id="${m(n)}" class="search-select-option${r?` selected`:``}" data-value="${m(e.value)}" aria-selected="${r}">${d(e)}</button>`}).join(``),this._active=-1,t.control?.removeAttribute(`aria-activedescendant`);let c=r.length<this._minChars;t.hint&&(t.hint.hidden=!(this._remote&&c&&!i.length)),t.empty&&(t.empty.hidden=this._loading||o.length>0||this._remote&&c),this._reanchor?.()}_wire(){this._teardown();let e=this._refs();if(!e.control||!e.input)return;let s=()=>r(e.control,e.menu,{matchWidth:!0}),u=()=>this._optionEls().filter(e=>!e.hidden),d=(t,{reveal:n=!0}={})=>{let r=u();this._active=t,c(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`)},f=()=>!e.menu.hidden,p=()=>{f()&&s()},m=()=>{e.menu.hidden=!1,e.control.setAttribute(`aria-expanded`,`true`),e.control.classList.add(`open`),s(),t(this,p),this._renderOptions()},g=()=>{e.menu.hidden=!0,e.control.setAttribute(`aria-expanded`,`false`),e.control.classList.remove(`open`),d(-1),clearTimeout(this._typeaheadTimer),this._typeaheadTimer=null,this._typeahead=``,this._syncInput(),n(this)},_=t=>{let n=t.dataset.custom===`true`;this._value=t.dataset.value,this._label=n?t.dataset.value:h(t.innerHTML),o(this,this._value),e.input.value=this._label,this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,detail:{isCustom:n}})),g(),e.input.focus()},v=t=>{this._value=t,this._label=t,o(this,t),e.input.value=t,this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,detail:{isCustom:!0}})),g()},y=()=>{let t=e.input.value;if(e.clear&&(e.clear.hidden=!t),f()||m(),this._remote){if(this._renderOptions(t),clearTimeout(this._timer),t.trim().length<this._minChars){this._pendingSearch=null;return}let e=++this._reqSeq;this._pendingSearch={query:t,seq:e},this._timer=setTimeout(()=>this._fireSearch(t,e),this._debounceMs)}else this._renderOptions(t)};this._navHandler=l({getVisibleOptions:u,getActive:()=>this._active,setActive:e=>d(e),onEnter:(t,n)=>{if(n[this._active])_(n[this._active]);else if(this._allowCustom){let t=e.input.value.trim();t&&!this._matchesKnownOption(t)&&v(t)}},onEscape:()=>{this._navHandler.clearTypeahead(),g()}});let b=e=>{let t=e.target?.tagName===`INPUT`||e.target?.tagName===`TEXTAREA`;if(e.key===`ArrowDown`){e.preventDefault(),f()||m();let t=u();d(Math.min(this._active+1,t.length-1));return}else if(e.key===`ArrowUp`){e.preventDefault(),d(Math.max(this._active-1,0));return}else if((e.key===`Home`||e.key===`End`||e.key===`PageDown`||e.key===`PageUp`)&&(!f()||t))return;else if(e.key.length===1&&(e.ctrlKey||e.metaKey||e.altKey||!f()||e.target?.tagName===`INPUT`||e.target?.tagName===`TEXTAREA`)&&(!f()||e.target?.tagName===`INPUT`||e.target?.tagName===`TEXTAREA`))return;this._navHandler.handler(e)};i(),e.input.addEventListener(`focus`,()=>{a()&&m()}),e.control.addEventListener(`click`,t=>{e.input.disabled||t.target.closest(`.search-select-clear`)||(t.target!==e.input&&e.input.focus(),f()||m())}),e.input.addEventListener(`input`,y),e.input.addEventListener(`keydown`,b),e.menu.addEventListener(`keydown`,b),e.input.addEventListener(`blur`,t=>{if(!this._allowCustom||t.relatedTarget&&this.contains(t.relatedTarget))return;let n=e.input.value.trim();!n||n===this._label||this._matchesKnownOption(n)||v(n)}),e.optionsWrap.addEventListener(`click`,e=>{let t=e.target.closest(`.search-select-option`);t&&_(t)}),e.optionsWrap.addEventListener(`mousemove`,e=>{let t=e.target.closest(`.search-select-option`);t&&!t.classList.contains(`is-active`)&&d(this._optionEls().indexOf(t),{reveal:!1})}),e.optionsWrap.addEventListener(`mouseleave`,()=>d(-1)),e.clear?.addEventListener(`click`,()=>{this._value=``,this._label=``,o(this,``),e.input.value=``,e.clear.hidden=!0,this._renderOptions(``),this.dispatchEvent(new Event(`change`,{bubbles:!0})),e.input.focus(),f()||m()}),this._bindGlobal=()=>{this._teardown(),this._onDocClick=e=>{f()&&!this.contains(e.target)&&g()},document.addEventListener(`click`,this._onDocClick),f()&&t(this,p)},this._bindGlobal()}_fireSearch(e,t){this._pendingSearch=null,this.dispatchEvent(new CustomEvent(`search`,{bubbles:!0,detail:{query:e,seq:t}}))}_teardown(){this._onDocClick&&=(document.removeEventListener(`click`,this._onDocClick),null),n(this),clearTimeout(this._timer),this._navHandler?.teardown()}disconnectedCallback(){this._teardown()}},m=e=>String(e??``).replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`),h=e=>String(e??``).replace(/<[^>]*>/g,``);export{p as t};
@@ -1,25 +0,0 @@
1
- import{t as e}from"./elementBase-BlsR4tqa.js";import{n as t,r as n,t as r}from"./anchorOverlay-WcDeH46q.js";import{n as i,t as a}from"./focusOrigin-2imUSs-u.js";import{n as o}from"./formMirror-BgY7zkC3.js";import{t as s}from"./iconGlyphs.g-CUm_mfze.js";import{n as c,t as l}from"./listboxKeyNav-DMIvs9d6.js";import{n as u,r as d,t as f}from"./optionLabel-DOZb8ERB.js";import{i as p,t as m}from"./tokenCommit-BKckxgtg.js";var h=class extends e{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):[],o(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,[f]:!0,selected:e.hasAttribute(`selected`)};for(let[n,r]of _){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?t.label:e}_labelHtmlFor(e){let t=this._readOptions().find(t=>String(t.value)===String(e));return t?d(t):u(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`:``;o(this,this._values),this.id||=`wui-multiselect-${Math.random().toString(36).slice(2,9)}`;let c=`${this.id}-listbox`;this._listboxId=c;let l=this.hasAttribute(`disabled`);if(e){let e=`${this.id}-custom-error`;this.innerHTML=`
2
- <div class="search-select${a}">
3
- <div class="input search-select-control search-select-multi"${this.hasAttribute(`aria-invalid`)?` aria-invalid="true"`:``}${l?` aria-disabled="true"`:``}>
4
- ${r?s(r,{className:`search-select-icon`}):``}
5
- <div class="ms-chips" data-chips><input type="text" class="ms-input" data-input role="combobox" aria-autocomplete="list" aria-haspopup="listbox" aria-expanded="false" aria-controls="${w(c)}" aria-label="${w(this._accessibleName())}" aria-describedby="${w(e)}" autocomplete="off"${l?` disabled`:``} /></div>
6
- ${s(`chevron-down`,{className:`search-select-caret`})}
7
- </div>
8
- <div class="search-select-menu search-select-menu-fixed" role="listbox" id="${w(c)}" aria-multiselectable="true" tabindex="-1" hidden>
9
- <div class="search-select-options"></div>
10
- </div>
11
- </div>
12
- <div class="field-error wui-ms-custom-error" id="${w(e)}" aria-live="polite" hidden></div>`}else this.innerHTML=`
13
- <div class="search-select${a}">
14
- <div class="input search-select-control search-select-multi" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="${w(c)}" aria-label="${w(this._accessibleName())}"${this.hasAttribute(`aria-invalid`)?` aria-invalid="true"`:``}${l?` aria-disabled="true"`:` tabindex="0"`}>
15
- ${r?s(r,{className:`search-select-icon`}):``}
16
- <div class="ms-chips" data-chips></div>
17
- ${s(`chevron-down`,{className:`search-select-caret`})}
18
- </div>
19
- <div class="search-select-menu search-select-menu-fixed" role="listbox" id="${w(c)}" aria-multiselectable="true" tabindex="-1" hidden>
20
- ${t?`<div class="search-select-search">${s(`search`)}<input class="search-select-input" placeholder="${w(n)}" aria-autocomplete="list" /><button type="button" class="search-select-clear" aria-label="Clear search" hidden>${s(`x`)}</button></div>`:``}
21
- <div class="search-select-options"></div>
22
- <div class="search-select-empty" hidden>No matches</div>
23
- </div>
24
- </div>`;this._rendered=!0,this._customError=``,o(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="${w(e)}" aria-label="Remove ${w(T(this._labelFor(e)))}">${s(`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">${u(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 T(e.label).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||T(e.label).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`,c=this._allowCustom&&r&&!this._optionNamed(r),l=a.map((e,t)=>{let n=this._values.includes(String(e.value)),r=`${o}-opt-${t}`;return v(e)?x(e,r,n):`<button type="button" role="option" id="${w(r)}" class="search-select-option${n?` selected`:``}" data-value="${w(e.value)}" aria-selected="${n}"><span class="ms-opt-label">${d(e)}</span><span class="ms-check">${s(`check`)}</span></button>`});c&&l.push(`<button type="button" role="option" id="${w(`${o}-opt-${a.length}`)}" class="search-select-option search-select-option-custom" data-value="${w(r)}" data-custom="true" aria-selected="false">Add “${u(r)}”</button>`),t.innerHTML=l.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=C(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`),s=this.querySelector(`.search-select-menu`),u=this.querySelector(`.search-select-input`),d=this.querySelector(`.search-select-clear`),f=this.querySelector(`.search-select-options`),h=this._allowCustom,_=h?this.querySelector(`[data-input]`):null,v=_||e;if(!e||!s)return;let y=()=>this.hasAttribute(`disabled`),b=()=>r(e,s,{matchWidth:!0}),x=()=>[...this.querySelectorAll(`.search-select-option`)],S=()=>x().filter(e=>!e.hidden),C=(e,{reveal:t=!0}={})=>{let n=S();this._active=e,c(f,e>=0&&n[e]||null),e>=0&&n[e]?(t&&n[e].scrollIntoView({block:`nearest`}),v.setAttribute(`aria-activedescendant`,n[e].id)):v.removeAttribute(`aria-activedescendant`)},w=!1,T=()=>h?w:!s.hidden,E=()=>{let t=w&&x().length>0,n=s.hidden;s.hidden=!t,v.setAttribute(`aria-expanded`,String(t)),e.classList.toggle(`open`,t),t&&n&&b()};this._syncCustomMenu=h?E:null;let D=()=>{T()&&b()},O=()=>{if(!y()){if(t(this,D),h){w=!0,E();return}s.hidden=!1,e.setAttribute(`aria-expanded`,`true`),e.classList.add(`open`),b(),u&&(u.value=``,this._renderOptions(``),u.focus())}},k=()=>{h?(w=!1,E()):(s.hidden=!0,e.setAttribute(`aria-expanded`,`false`),e.classList.remove(`open`)),C(-1),clearTimeout(this._typeaheadTimer),this._typeaheadTimer=null,this._typeahead=``,n(this)},A=()=>{o(this,this._values),this.dispatchEvent(new Event(`change`,{bubbles:!0}))},j=e=>{let t=String(e);if(this._values.includes(t))this._values=this._values.filter(e=>e!==t);else if(h&&this._values.some(e=>e.toLowerCase()===t.toLowerCase()))return;else this._values=[...this._values,t];this._renderControl(),this._renderOptions(this._query()),A()},M=e=>{this._values=this._values.filter(t=>t!==String(e)),this._renderControl(),this._renderOptions(this._query()),A()},N=(e,{quiet:t=!1}={})=>{let n=this._values.length,r=m(e,g)?p(e,g):[e],i=[],a=``;for(let e of r){let t=this._commitTyped(e);t&&(i.push(e.trim()),a||=t)}t&&i.length||(_.value=i.join(`, `),this._setCustomError(a),this._values.length!==n&&(this._renderControl(),A()),this._renderOptions(_.value))},P=e=>{if(!(!e||e.getAttribute(`aria-disabled`)===`true`)){if(e.dataset.custom===`true`){N(e.dataset.value);return}j(e.dataset.value),_?.value&&(_.value=``,this._setCustomError(``),this._renderOptions(``))}};e.addEventListener(`click`,e=>{if(y())return;let t=e.target.closest(`[data-remove]`);if(t){e.stopPropagation(),M(t.dataset.remove),_?.focus();return}if(_){let t=T();e.target!==_&&_.focus(),e.target===_||!t?O():k();return}T()?k():O()}),f.addEventListener(`click`,e=>{let t=e.target.closest(`.search-select-option`);t&&(P(t),(_||u)?.focus())}),f.addEventListener(`mousemove`,e=>{let t=e.target.closest(`.search-select-option`);t&&!t.classList.contains(`is-active`)&&C(S().indexOf(t),{reveal:!1})}),f.addEventListener(`mouseleave`,()=>C(-1)),f.addEventListener(`error`,e=>{e.target?.classList?.contains(`avatar-img`)&&e.target.remove()},!0),u?.addEventListener(`input`,()=>{this._renderOptions(u.value),d&&(d.hidden=!u.value),C(-1)}),this._navHandler=l({getVisibleOptions:S,getActive:()=>this._active,setActive:e=>C(e),onEnter:e=>{e?P(e):_?.value.trim()&&N(_.value)},onEscape:()=>{this._navHandler.clearTypeahead(),k(),_||e.focus()}});let F=e=>{let t=_||u;if(e.key===`Backspace`&&!t?.value&&this._values.length){M(this._values[this._values.length-1]);return}this._navHandler.handler(e)};if(u?.addEventListener(`keydown`,F),d?.addEventListener(`click`,()=>{u.value=``,this._renderOptions(``),d.hidden=!0,u.focus()}),_){let t=e=>{e.target!==_&&e.preventDefault()};f.addEventListener(`mousedown`,t),e.addEventListener(`mousedown`,t),i(),_.addEventListener(`focus`,()=>{a()&&O()}),_.addEventListener(`input`,()=>{this._customError&&this._setCustomError(``),this._renderOptions(_.value),O()}),_.addEventListener(`keydown`,e=>{if(e.key===`,`&&_.value.trim()){e.preventDefault(),N(_.value);return}if(e.key===`Enter`){if(this._active<0&&!_.value.trim())return;this._navHandler.handler(e);return}(e.key===`ArrowDown`||e.key===`ArrowUp`)&&!T()&&O(),F(e)}),_.addEventListener(`paste`,e=>{let t=e.clipboardData?.getData(`text/plain`)??``;m(t,g)&&(e.preventDefault(),N(`${_.value}${t}`))}),_.addEventListener(`blur`,e=>{e.relatedTarget&&this.contains(e.relatedTarget)||(_.value.trim()&&N(_.value,{quiet:!0}),k())})}else e.addEventListener(`keydown`,e=>{if(T()){F(e);return}(e.key===`ArrowDown`||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),O())});this._bindGlobal=()=>{this._teardown(),!this._ro&&typeof ResizeObserver<`u`&&(this._ro=new ResizeObserver(()=>this._collapseChips()),this._ro.observe(this)),this._onDocClick=e=>{T()&&!this.contains(e.target)&&k()},document.addEventListener(`click`,this._onDocClick),T()&&t(this,D)},this._bindGlobal()}_teardown(){this._onDocClick&&=(document.removeEventListener(`click`,this._onDocClick),null),n(this),this._navHandler?.teardown()}disconnectedCallback(){this._teardown(),this._ro?.disconnect(),this._ro=null}},g=[`,`,`;`,`
25
- `,` `],_=[[`description`,`description`],[`avatar`,`avatar`],[`initials`,`initials`],[`disabled-hint`,`disabledHint`]],v=e=>!!(e.description||e.avatar||e.initials||e.disabled||e.disabledHint),y=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:``},b=e=>{let t=y(e.avatar);return!t&&!e.initials?``:`<span class="avatar wui-opt-avatar" aria-hidden="true"><span class="avatar-face">${u(e.initials??``)}</span>${t?`<img class="avatar-img" src="${w(t)}" alt="" />`:``}</span>`},x=(e,t,n)=>{let r=!!e.disabled,i=e.description?`<span class="wui-opt-desc">${u(e.description)}</span>`:``,a=e.disabledHint&&r?`<span class="wui-opt-hint">${u(e.disabledHint)}</span>`:``;return`<button type="button" role="option" id="${w(t)}" class="search-select-option wui-opt-rich${n?` selected`:``}" data-value="${w(e.value)}" aria-selected="${n}"${r?` aria-disabled="true"`:``}><span class="ms-opt-label"><span class="wui-opt-name">${d(e)}</span>${i}</span>${a}${b(e)}<span class="ms-check">${s(`check`)}</span></button>`},S=new Map,C=e=>{if(S.has(e))return S.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 S.set(e,t),t},w=e=>String(e??``).replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`),T=e=>String(e??``).replace(/<[^>]*>/g,``);export{h as t};