@webority/ui-elements 0.174.0 → 0.175.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.
- package/dist/{WuiCarousel-CFKmFVzc.js → WuiCarousel-B0yPDH5I.js} +1 -1
- package/dist/WuiCodeBlock-BWYZ1S70.js +1 -0
- package/dist/{WuiCommandPalette-BQCy0bon.js → WuiCommandPalette-u1XD5WMv.js} +2 -2
- package/dist/WuiCommentThread-C5n933uz.js +1 -0
- package/dist/{WuiConsentBanner-DlAE3DTf.js → WuiConsentBanner-nTua-kEd.js} +1 -1
- package/dist/WuiContextMenu-DEWYYFRG.js +1 -0
- package/dist/{WuiDataTable-B-JaTsrI.js → WuiDataTable-Ble3hl5L.js} +1 -1
- package/dist/{WuiDatePicker-4tdWakGX.js → WuiDatePicker-3D33rzH4.js} +1 -1
- package/dist/{WuiDateRange-D7LJuY2F.js → WuiDateRange-qTncGobM.js} +1 -1
- package/dist/{WuiDateTime-BSJfyZ0q.js → WuiDateTime-Vimu6grS.js} +1 -1
- package/dist/{WuiDrawer-D-XfW1kl.js → WuiDrawer-BsY0fs_u.js} +1 -1
- package/dist/{WuiDropdown-5-6E5Q9d.js → WuiDropdown-6g074v1T.js} +1 -1
- package/dist/WuiGantt-BqNhYIr6.js +1 -0
- package/dist/{WuiImageCrop-CIAjHOGk.js → WuiImageCrop-UakcSM2k.js} +1 -1
- package/dist/{WuiInlineEdit-C9FxCWCk.js → WuiInlineEdit-BwB-w61N.js} +1 -1
- package/dist/{WuiLeadPopup-KyguGV-q.js → WuiLeadPopup-DaYZ2zCJ.js} +1 -1
- package/dist/{WuiLightbox-CBiqJmGE.js → WuiLightbox-DpHJAMO3.js} +1 -1
- package/dist/WuiMentionInput-DJv-WwW6.js +1 -0
- package/dist/{WuiNotificationCenter-DZariS2K.js → WuiNotificationCenter-1Hw7W0st.js} +1 -1
- package/dist/{WuiOrgTree-CFxoY9Vr.js → WuiOrgTree-DWSk_LHd.js} +1 -1
- package/dist/{WuiOverflow-CXYk2ubC.js → WuiOverflow-fZKqdsr-.js} +1 -1
- package/dist/{WuiPhone-BI438y4S.js → WuiPhone-CBge7oVA.js} +1 -1
- package/dist/{WuiRecordPager-DAyoD650.js → WuiRecordPager-BXoe4KfU.js} +1 -1
- package/dist/{WuiRelativeTime-CPzs4tjM.js → WuiRelativeTime-CSg9vzfk.js} +1 -1
- package/dist/{WuiSavedViews-BAqHgVj2.js → WuiSavedViews-OjB-ZiCo.js} +1 -1
- package/dist/WuiSelect-D89S-POU.js +1 -0
- package/dist/{WuiShortcuts-DWzmRKEG.js → WuiShortcuts-CRCctX82.js} +1 -1
- package/dist/{WuiShowMore-DyfGnrob.js → WuiShowMore-BoYCrYYf.js} +1 -1
- package/dist/{WuiSlider-LE2wquOo.js → WuiSlider-R_mTula0.js} +1 -1
- package/dist/{WuiSortable-DxwYjicc.js → WuiSortable-x8Mg0tOv.js} +1 -1
- package/dist/{WuiTimePicker-xrPYytjq.js → WuiTimePicker-DYLFaWDc.js} +1 -1
- package/dist/{WuiTour-D-H5sMJS.js → WuiTour-BU00-6Lf.js} +1 -1
- package/dist/WuiTree-CIOM1G59.js +1 -0
- package/dist/WuiTreePicker-DLddmEgG.js +1 -0
- package/dist/{WuiWizardStep-n8Ge5GDI.js → WuiWizardStep-gFtuUzsL.js} +1 -1
- package/dist/buttonClass-C8BRtTk8.js +1 -0
- package/dist/{calendarMath-rI1aBVRd.js → calendarMath-CT99RyhR.js} +1 -1
- package/dist/chips-_rw5Aev4.js +2 -0
- package/dist/copyText-sHWcpcPm.js +1 -0
- package/dist/{country-B7jmc--B.js → country-T7AfpJpN.js} +1 -1
- package/dist/{customRule-BXJdj57A.js → customRule-BpwcjVLb.js} +1 -1
- package/dist/{dataTable-Bz6HxUx0.js → dataTable-VB3nBucm.js} +1 -1
- package/dist/drawerDiscard-D_n8guAp.js +1 -0
- package/dist/elements/carousel.js +1 -1
- package/dist/elements/code-block.js +1 -1
- package/dist/elements/command-palette.js +1 -1
- package/dist/elements/comment-thread.js +1 -1
- package/dist/elements/consent-banner.js +1 -1
- package/dist/elements/context-menu.js +1 -1
- package/dist/elements/data-table.js +1 -1
- package/dist/elements/date-range.js +1 -1
- package/dist/elements/date-time.js +1 -1
- package/dist/elements/datepicker.js +1 -1
- package/dist/elements/drawer.js +1 -1
- package/dist/elements/dropdown.js +1 -1
- package/dist/elements/filter-popover.js +1 -1
- package/dist/elements/gantt.js +1 -1
- package/dist/elements/image-crop.js +1 -1
- package/dist/elements/inline-edit.js +1 -1
- package/dist/elements/kanban.js +1 -1
- package/dist/elements/lead-popup.js +1 -1
- package/dist/elements/lightbox.js +1 -1
- package/dist/elements/mention-input.js +1 -1
- package/dist/elements/notification-center.js +1 -1
- package/dist/elements/org-tree.js +1 -1
- package/dist/elements/overflow.js +1 -1
- package/dist/elements/phone.js +1 -1
- package/dist/elements/record-pager.js +1 -1
- package/dist/elements/relative-time.js +1 -1
- package/dist/elements/saved-views.js +1 -1
- package/dist/elements/select.js +1 -1
- package/dist/elements/shortcuts.js +1 -1
- package/dist/elements/show-more.js +1 -1
- package/dist/elements/slider.js +1 -1
- package/dist/elements/sortable.js +1 -1
- package/dist/elements/timepicker.js +1 -1
- package/dist/elements/tour.js +1 -1
- package/dist/elements/tree-picker.js +1 -1
- package/dist/elements/tree.js +1 -1
- package/dist/elements/wizard.js +1 -1
- package/dist/fileViewer.g-D_zLw_p-.js +1 -0
- package/dist/{fileViewerImage-ItX9j9U9.js → fileViewerImage-DnzDd-rQ.js} +1 -1
- package/dist/{fileViewerMedia-BCqp2Z96.js → fileViewerMedia-Dm99qAjY.js} +1 -1
- package/dist/{fileViewerPdf-aaI2R2nB.js → fileViewerPdf-Tb26qdtM.js} +3 -3
- package/dist/{filterPopover-D7LGrhnO.js → filterPopover-DskHFNLi.js} +1 -1
- package/dist/{formatters-DikbTYA4.js → formatters-DTW53DjY.js} +1 -1
- package/dist/hasOwn-CJsplJ62.js +1 -0
- package/dist/helpers.js +1 -1
- package/dist/iconGlyphs.g-a9FtjPXh.js +1 -0
- package/dist/imeSafeEnter-DeO_3lXy.js +1 -0
- package/dist/{inlineEditText-C6g6qhye.js → inlineEditText-DRBhMnam.js} +1 -1
- package/dist/kanban-DlVHIpxL.js +1 -0
- package/dist/{kanbanModel-CuMgMnSc.js → kanbanModel-BzXK4SkM.js} +1 -1
- package/dist/{listboxKeyNav-DtlIOryj.js → listboxKeyNav-DNtuh6Ob.js} +1 -1
- package/dist/{loader-B3lirubB.js → loader-C2hgZrCR.js} +1 -1
- package/dist/{menuKeyNav-CstMzU08.js → menuKeyNav-BCHtqitp.js} +1 -1
- package/dist/{notificationDays-grsj1DtM.js → notificationDays-wMr8rZko.js} +1 -1
- package/dist/{optionLabel-CmrOSHbD.js → optionLabel-wbpl8OTJ.js} +1 -1
- package/dist/{recents-BQ0fD7Y0.js → recents-B9efQ1Au.js} +1 -1
- package/dist/{relativeTime-vdCXtfKg.js → relativeTime-CNgauvqB.js} +1 -1
- package/dist/{search-DwboX91o.js → search-D-lfoHy9.js} +1 -1
- package/dist/server.js +1 -1
- package/dist/{shortcutKeys-6iLc6oDR.js → shortcutKeys-BMTWgV2g.js} +1 -1
- package/dist/text.js +1 -1
- package/dist/textStore-DBplASiZ.js +1 -0
- package/dist/{themeTransition-D7HJ4A4m.js → themeTransition-DBv2olsl.js} +1 -1
- package/dist/ui-calendar.global.js +1 -1
- package/dist/ui-calendar.js +1 -1
- package/dist/ui-chart.global.js +2 -2
- package/dist/ui-chart.js +2 -2
- package/dist/ui-consent-banner.global.js +1 -1
- package/dist/ui-elements/carousel.global.js +1 -1
- package/dist/ui-elements/code-block.global.js +1 -1
- package/dist/ui-elements/command-palette.global.js +2 -2
- package/dist/ui-elements/comment-thread.global.js +1 -1
- package/dist/ui-elements/consent-banner.global.js +1 -1
- package/dist/ui-elements/context-menu.global.js +1 -1
- package/dist/ui-elements/date-range.global.js +1 -1
- package/dist/ui-elements/date-time.global.js +1 -1
- package/dist/ui-elements/datepicker.global.js +1 -1
- package/dist/ui-elements/drawer.global.js +1 -1
- package/dist/ui-elements/dropdown.global.js +1 -1
- package/dist/ui-elements/entry-grid.global.js +2 -2
- package/dist/ui-elements/gantt.global.js +1 -1
- package/dist/ui-elements/glyphs.global.js +1 -1
- package/dist/ui-elements/image-crop.global.js +1 -1
- package/dist/ui-elements/inline-edit.global.js +1 -1
- package/dist/ui-elements/kanban.global.js +1 -1
- package/dist/ui-elements/lead-popup.global.js +2 -2
- package/dist/ui-elements/lightbox.global.js +1 -1
- package/dist/ui-elements/markdown.global.js +3 -3
- package/dist/ui-elements/org-tree.global.js +1 -1
- package/dist/ui-elements/phone.global.js +1 -1
- package/dist/ui-elements/popover.global.js +1 -1
- package/dist/ui-elements/saved-views.global.js +1 -1
- package/dist/ui-elements/select-chips.global.js +2 -2
- package/dist/ui-elements/select-recents.global.js +1 -1
- package/dist/ui-elements/select-search.global.js +1 -1
- package/dist/ui-elements/select-window.global.js +1 -1
- package/dist/ui-elements/slider.global.js +1 -1
- package/dist/ui-elements/sortable.global.js +1 -1
- package/dist/ui-elements/status-icon.global.js +1 -1
- package/dist/ui-elements/table-export.global.js +1 -1
- package/dist/ui-elements/timepicker.global.js +1 -1
- package/dist/ui-elements/tour.global.js +1 -1
- package/dist/ui-elements/tree-picker.global.js +1 -1
- package/dist/ui-elements/tree.global.js +1 -1
- package/dist/ui-elements/wizard.global.js +1 -1
- package/dist/ui-elements.global.js +1 -1
- package/dist/ui-elements.js +1 -1
- package/dist/ui-file-viewer.global.js +10 -10
- package/dist/ui-file-viewer.js +1 -1
- package/dist/ui-lead-popup.global.js +1 -1
- package/dist/ui-rich-text.global.js +55 -55
- package/dist/ui-rich-text.js +54 -54
- package/dist/ui-tour.global.js +1 -1
- package/package.json +5 -5
- package/types/codeHighlight.d.ts +2 -1
- package/types/copyText.d.ts +2 -3
- package/types/global/shared.d.ts +48 -45
- package/types/hasOwn.d.ts +1 -0
- package/types/imeSafeEnter.d.ts +7 -0
- package/types/razor-js/modules/api.d.ts +8 -5
- package/types/razor-js/modules/look.d.ts +4 -5
- package/types/razor-js/modules/pageListeners.d.ts +1 -1
- package/types/razor-js/webority-ui.d.ts +14 -38
- package/dist/WuiCodeBlock-fBc3Uwsw.js +0 -1
- package/dist/WuiCommentThread-B58UyYGD.js +0 -1
- package/dist/WuiContextMenu-T-pkqJdV.js +0 -1
- package/dist/WuiGantt-XMvgsZsn.js +0 -1
- package/dist/WuiMentionInput-CktKQjQc.js +0 -1
- package/dist/WuiSelect-htggZB0v.js +0 -1
- package/dist/WuiTree-BnlK9fYL.js +0 -1
- package/dist/WuiTreePicker-Bx9nvRrC.js +0 -1
- package/dist/buttonClass-GtEi8hAY.js +0 -1
- package/dist/chips-DrTvHdbb.js +0 -2
- package/dist/copyText-Q-QZKBmx.js +0 -1
- package/dist/drawerDiscard-B33Oc_Sv.js +0 -1
- package/dist/fileViewer.g-B6N9K2xi.js +0 -1
- package/dist/iconGlyphs.g-P04RJkSE.js +0 -1
- package/dist/imeSafeEnter-DPs9qL3S.js +0 -1
- package/dist/kanban-CX6DyApZ.js +0 -1
- package/dist/textStore-opIEM4lu.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t,n,r,i,a,o,s,c,l,u){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var d=globalThis.WeborityUiElementsInternal?.version;if(d!==`0.174.0`)throw Error(`[webority-ui] tour expects ui-elements 0.174.0 but the page loaded `+d+`.`);var f={backLabel:`Back`,doneLabel:`Done`,endMessage:`You know your way around now. Enjoy exploring.`,endTitle:`You're all set`,mediaPauseLabel:`Pause animation`,mediaPlayLabel:`Play animation`,nextLabel:`Next`,progressLabel:`Step {current} of {total}`,skipLabel:`Skip`},p={advanceLabel:`Click {actionName} to continue.`},m=`data-advance`,h=`wui-tour-hint`,g=`wui-tour-pointer`,_=`a[href], button, input, select, textarea, summary, [tabindex], [contenteditable]`,v=()=>(0,c.readText)(`tourAdvance`,p),y=(e,t)=>e?.advanceOn===`click`&&!!t,b=e=>(e??``).replace(/\s+/g,` `).trim(),ee=e=>e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLMeterElement||e instanceof HTMLOutputElement||e instanceof HTMLProgressElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement?e.labels:null,te=e=>e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||e instanceof HTMLFieldSetElement||e instanceof HTMLOptGroupElement||e instanceof HTMLOptionElement?e.disabled:!1;function ne(e){let t=e.ownerDocument,n=(e.getAttribute(`aria-labelledby`)||``).split(/\s+/).filter(Boolean),r=e instanceof HTMLInputElement&&/^(button|submit|reset)$/.test(e.type)?e.value:``,i=[n.map(e=>t.getElementById(e)?.textContent??``).join(` `),e.getAttribute(`aria-label`),Array.from(ee(e)??[],e=>e.textContent).join(` `),e.getAttribute(`alt`),r,e.textContent,e.getAttribute(`title`)];for(let e of i){let t=b(e);if(t)return t}return``}function re(e){for(let t of[e,...e.querySelectorAll(_)])if((t instanceof HTMLElement||t instanceof SVGElement)&&t.tabIndex>=0&&!te(t))return t;return null}function x(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 ie(e,t){let n=e.querySelector(`.${h}`),r=e.querySelector(`.wui-tour-text`)?.id,i=r?`${r.replace(/-text$/,``)}-hint`:``;if(!t)n?.remove(),i&&x(e,i,!1);else{if(!n){n=e.ownerDocument.createElement(`p`),n.className=h,i&&(n.id=i);let t=e.querySelector(`.wui-tour-actions`);if(!t)throw Error(`Tour card has no actions row.`);t.before(n)}n.textContent=t,i&&x(e,i,!0)}}function ae(e,t){let n=e.querySelector(`.${g}`);if(!t){n?.remove();return}if(n)return;let r=e.ownerDocument.createElement(`span`);r.className=g,r.setAttribute(`aria-hidden`,`true`),e.append(r)}var oe=e=>getComputedStyle(e).animationName;function S(e,{layer:t,spot:n,card:r},i,a){let o=y(i,a);t.toggleAttribute(m,o&&!(t.getRootNode()instanceof ShadowRoot)),n.hasAttribute(m)&&(n.removeAttribute(m),o&&oe(n)),o&&n.setAttribute(m,``),ae(n,o);let s=r.querySelector(`.wui-tour-next`);if(!(s instanceof HTMLElement))throw Error(`Tour card has no next button.`);s.classList.toggle(`btn-primary`,!o),s.classList.toggle(`btn-link`,o);let c=o?b(i?.actionLabel)||ne(a):``,l=e.getAttribute(`advance-label`)||v().advanceLabel,u=c?l.replace(/\{actionName\}/g,()=>c):``;return ie(r,u),u}function se(e,t,n){if(!y(e,t))return()=>{};let r,i=()=>{r??=setTimeout(n,0)};return t.addEventListener(`click`,i),()=>{t.removeEventListener(`click`,i),clearTimeout(r)}}function ce(e,t,n,r){return e.contains(r)||y(t,n)&&n.contains(r)}function le(e,{card:t,active:n,step:r,target:i}){let a=Array.from(t.querySelectorAll(`button`)).filter(e=>!e.hidden),o=y(r,i)?re(i):null;o&&a.push(o);let s=a.findIndex(e=>e===n||e===o&&i?.contains(n));e.preventDefault();let c=a[s===-1?e.shiftKey?a.length-1:0:(s+(e.shiftKey?-1:1)+a.length)%a.length];if(!c)throw Error(`Tour card has no focus stop.`);c.focus()}var ue=2/3,de=1e3,fe=new Set([`top`,`left`,`width`,`height`]),C=new WeakMap,w=(e,t)=>typeof e.getAnimations==`function`?e.getAnimations().filter(t):[],T=e=>`transitionProperty`in e&&e.transitionProperty===`opacity`,pe=e=>`transitionProperty`in e&&typeof e.transitionProperty==`string`&&fe.has(e.transitionProperty),me=e=>`animationName`in e&&typeof e.animationName==`string`&&e.animationName.startsWith(`wui-tour-`);function E(e){return e.length===0?null:new Promise(t=>{let n=setTimeout(t,de);Promise.allSettled(e.map(e=>e.finished)).then(()=>{clearTimeout(n),t()})})}function he(e){let t=e.parentElement?.querySelector(`:scope > .wui-tour-spot`),n=0;for(let e of t?w(t,pe):[]){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*ue-r)}return n}function D(e){let t=he(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={};C.set(e,n);let r=()=>{C.get(e)===n&&e.dataset.state===`entering`&&(e.dataset.state=`shown`)},i=w(e,me);i.length===0?r():Promise.allSettled(i.map(e=>e.finished)).then(r)}function O(e){return e.dataset.state=`leaving`,E(w(e,T))}function ge(e){let t=e.shadowRoot?.querySelector(`.wui-tour-layer`),n=e.classList.contains(`wui-tour-layer`)?e:t instanceof HTMLElement?t:null;n&&(n.dataset.state=`leaving`);let r=n?E(w(n,T)):null;r?(e.setAttribute(`inert`,``),r.then(()=>e.remove())):e.remove()}var _e=2,k=12,A=8,j=4,M=20,ve=`(max-width: 575.98px)`,ye=[`bottom`,`top`,`right`,`left`],be=[`bottom`,`top`,`left`,`right`],N=[`top-left`,`top-right`,`bottom-right`,`bottom-left`],P,F=(e,t,n)=>Math.max(t,Math.min(e,n)),I=(e,t,n,r)=>(Math.max(e,n)+Math.min(t,r))/2;function xe(e,t){if(!t?.scrollIntoView)return;e.style.maxHeight=``;let n=R(e),r=e.offsetHeight+k;if(t.getBoundingClientRect().height+4+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 L(e,t,n){let r=e.style,i=t.style,a=Ee(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 N)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`,Se(r,n);let c=t.scrollTop;i.maxHeight=``;let l={width:t.offsetWidth,height:t.offsetHeight},u=R(t),d=u.bottom-u.top,f={bottom:u.bottom-o.bottom-k,top:o.top-k-u.top,right:u.right-o.right-k,left:o.left-k-u.left},p=window.matchMedia(ve).matches,m=((0,s.isRtl)(n)?be:ye).find(e=>e===`top`||e===`bottom`?l.height<=f[e]+1:!p&&l.width<=f[e]+1&&l.height<=d+1),h=Math.min(o.bottom,u.bottom+A)-Math.max(o.top,u.top-A);m?Ce(t,a,m,o,u,l):h>=Math.min(l.height,d)+8?we(t,a,o,u,l):Te(t,a,f.bottom>=f.top?`bottom`:`top`,o,u,l,f),t.scrollTop=c}function Se(e,t){P??=CSS.supports(`corner-top-left-shape`,`squircle`);let n=getComputedStyle(t);for(let t of N)e.setProperty(`border-${t}-radius`,n.getPropertyValue(`border-${t}-radius`)),P&&e.setProperty(`corner-${t}-shape`,n.getPropertyValue(`corner-${t}-shape`))}function Ce(e,t,n,r,i,a){let o=n===`top`||n===`bottom`,s,c,l;if(o){let e=I(r.left,r.right,i.left,i.right);s=F(e-a.width/2,i.left,i.right-a.width),c=n===`bottom`?r.bottom+k:r.top-k-a.height,l=F(e-s,M,a.width-M)}else{let e=I(r.top,r.bottom,i.top,i.bottom);c=F(e-a.height/2,i.top,i.bottom-a.height),s=n===`right`?r.right+k:r.left-k-a.width,l=F(e-c,M,a.height-M)}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 we(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)-j;e.style.top=`${Math.max(r.top,o-Math.min(i.height,a))}px`,e.style.left=`${F(n.left+j,r.left,r.right-i.width)}px`}function Te(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+k:r.top-k-c}px`;let l=I(r.left,r.right,i.left,i.right);e.style.left=`${F(l-a.width/2,i.left,i.right-a.width)}px`}function R(e){let t=e.parentElement,n=t?getComputedStyle(t):null,r=e=>Number.parseFloat(n?.[e]??``)||0;return{top:r(`paddingTop`)+A,bottom:window.innerHeight-r(`paddingBottom`)-A,left:r(`paddingLeft`)+A,right:window.innerWidth-r(`paddingRight`)-A}}function Ee(e){let t=e.querySelector(`:scope > .wui-tour-arrow`);if(t instanceof HTMLElement)return t;let n=document.createElement(`span`);return n.className=`wui-tour-arrow`,n.setAttribute(`aria-hidden`,`true`),n.hidden=!0,e.append(n),n}var De=0,Oe=`btn btn-sm btn-link`;function z(e,t,n){let r=e.querySelector(t);if(!(r instanceof n))throw Error(`Expected "${t}" to match a ${n.name}.`);return r}function ke(e,t){let n=`wui-tour-end-${++De}`,{nextLabel:a,nextHref:o}=e,s=a&&o?(0,i.make)(`a`,{class:`${(0,r.buttonClass)(`primary`,`solid`,`sm`)} wui-tour-end-next`,"data-wui":r.APP_BUTTON_MARKER,href:o},a):null,c=s!==null,l=c?Oe:(0,r.buttonClass)(`primary`,`solid`,`sm`),d=(0,i.make)(`button`,{type:`button`,class:`${l} wui-tour-end-button`,"data-wui":r.APP_BUTTON_MARKER},e.button);return(0,i.make)(t?`dialog`:`div`,{class:`wui-tour-card wui-tour-end`,"data-layout":`center`,"data-next":c||void 0,role:`dialog`,tabindex:-1,"aria-labelledby":`${n}-title`,"aria-describedby":`${n}-message`},(0,i.make)(`div`,{class:`wui-tour-end-mark`,"aria-hidden":`true`},(0,u.svgRoot)({viewBox:`0 0 24 24`,focusable:`false`},[[`path`,{d:`M5 12.5l4.5 4.5L19 7.5`}]])),(0,i.make)(`h2`,{class:`wui-tour-title wui-tour-end-title`,id:`${n}-title`},e.title),(0,i.make)(`p`,{class:`wui-tour-text wui-tour-end-message`,id:`${n}-message`},e.message),(0,i.make)(`div`,{class:`wui-tour-actions`},s,d))}var Ae=e=>e.button===0&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&!e.altKey;function je(e,t,n){let r=e.ownerDocument,i=ke(t,e.getRootNode()===r),a=z(i,`.wui-tour-end-button`,HTMLButtonElement),s=i.querySelector(`.wui-tour-end-next`);if(s!==null&&!(s instanceof HTMLAnchorElement))throw Error(`The end dialog's next link is not a link.`);let c=s,u=c??a,d=new AbortController,f=i instanceof HTMLDialogElement?i:null,p=null;return new Promise(s=>{let m=e=>{if(d.abort(),p&&f){let e=p;p=null,(0,o.closeModalDialog)(f).then(e)}s(e)};if(n?.aborted){m(`done`);return}let h=z(e,`.wui-tour-card:not(.wui-tour-end)`,HTMLElement),g=z(e,`.wui-tour-spot`,HTMLElement),_=z(e,`[role=status]`,HTMLElement),v={signal:d.signal};n?.addEventListener(`abort`,()=>m(`done`),v),a.addEventListener(`click`,()=>m(`done`),v),c&&c.addEventListener(`click`,e=>{Ae(e)&&(e.preventDefault(),m(`next`))},v),r.addEventListener(`keydown`,e=>{if(!(e.altKey||e.ctrlKey||e.metaKey)){if(e.key===`Escape`){if(p)return;e.preventDefault(),e.stopPropagation(),m(`done`)}else(0,l.isImeSafeEnter)(e)&&c&&!e.shiftKey&&(e.composedPath?.()[0]??e.target)===c&&(e.preventDefault(),m(`next`))}},{capture:!0,signal:d.signal});let y=()=>{d.signal.aborted||(h.hidden=!0,L(g,h,null),e.append(i),D(i),f&&(p=(0,o.openModalDialog)(f,{escape:!0,backdrop:!1,focus:`first-control`,onRequestClose:()=>m(`done`)})),_.textContent=[t.title,t.message].filter(Boolean).join(`. `),u.focus())},b=O(h);b===null?y():b.then(y)})}var B=` :host { all: initial; display: revert-layer; position: fixed; inset: 0; ${Object.entries({"--wui-z-tour":`1550`,"--wui-radius-sm":`8px`,"--wui-radius-lg":`14px`,"--wui-shadow-popover":`0px 8px 28px -6px rgba(7, 20, 55, 0.14)`,"--wui-ease-out":`cubic-bezier(0.22, 1, 0.36, 1)`,"--wui-ease-linear":`cubic-bezier(0, 0, 1, 1)`,"--wui-duration-fast":`150ms`,"--wui-duration-default":`250ms`,"--wui-duration-slow":`400ms`,"--wui-space-xs":`4px`,"--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-text":`#4F46E5`,"--color-focus-ring":`#4F46E5`,"--wui-focus-ring-width":`2px`,"--wui-focus-ring-offset":`2px`,"--color-on-primary":`#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-on-primary); } .btn-primary:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); } .btn-outline-neutral { border-color: var(--color-text-muted); color: var(--color-text-muted); } .btn-outline-neutral:hover { background: var(--color-bg-muted); color: var(--color-text); } .btn-link { font-weight: 400; color: var(--color-primary-text); 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); width: auto; height: auto; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; overflow: visible; background: none; } .wui-tour-spot { position: fixed; box-shadow: 0 0 0 2px var(--color-primary), 0 0 4px 2px color-mix(in srgb, var(--color-primary) 30%, transparent), 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-popover); } .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 var(--wui-duration-fast) var(--wui-ease-linear); } .wui-tour-layer[data-state=leaving] { transition: opacity var(--wui-duration-fast) var(--wui-ease-linear); } .wui-tour-card[data-state=entering] { animation: wui-tour-fade-in var(--wui-duration-fast) var(--wui-ease-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-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: var(--wui-focus-ring-offset); } .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); } .wui-tour-pointer { position: absolute; top: 50%; left: 50%; width: 18px; height: 24px; pointer-events: none; } .wui-tour-pointer::before { content: ""; position: absolute; inset: 0; background: var(--color-primary); clip-path: polygon(0 0, 0 75%, 28% 58%, 46% 100%, 62% 92%, 45% 52%, 85% 52%); filter: drop-shadow(1px 0 0 var(--color-surface)) drop-shadow(-1px 0 0 var(--color-surface)) drop-shadow(0 1px 0 var(--color-surface)) drop-shadow(0 -1px 0 var(--color-surface)); } .wui-tour-pointer::after { content: ""; position: absolute; top: -16px; left: -16px; width: 32px; height: 32px; border-radius: 50%; background: var(--color-primary); opacity: 0; display: none; } @media (max-width: 575.98px) { .wui-tour-pointer { width: 24px; height: 24px; translate: -50% -50%; } .wui-tour-pointer::before { clip-path: none; border-radius: 50%; box-shadow: 0 0 0 2px var(--color-surface); filter: none; } .wui-tour-pointer::after { top: -4px; left: -4px; } } @keyframes wui-tour-tap { 0% { opacity: 0; transform: translate(56px, 44px) scale(1); } 10% { opacity: 1; transform: translate(56px, 44px) scale(1); } 45% { transform: translate(0, 0) scale(1); } 52% { transform: translate(0, 0) scale(0.86); } 60% { transform: translate(0, 0) scale(1); } 85% { opacity: 1; transform: translate(0, 0) scale(1); } 100% { opacity: 0; transform: translate(0, 0) scale(1); } } @keyframes wui-tour-tap-rtl { 0% { opacity: 0; transform: translate(-56px, 44px) scale(1); } 10% { opacity: 1; transform: translate(-56px, 44px) scale(1); } 45% { transform: translate(0, 0) scale(1); } 52% { transform: translate(0, 0) scale(0.86); } 60% { transform: translate(0, 0) scale(1); } 85% { opacity: 1; transform: translate(0, 0) scale(1); } 100% { opacity: 0; transform: translate(0, 0) scale(1); } } @keyframes wui-tour-ripple { 0%, 50% { opacity: 0; transform: scale(0.2); } 52% { opacity: 0.35; transform: scale(0.2); } 80%, 100% { opacity: 0; transform: scale(1); } } @media (prefers-reduced-motion: no-preference) { .wui-tour-pointer { opacity: 0; animation: wui-tour-tap calc(var(--wui-duration-slow) * 6) var(--wui-ease-out) var(--wui-tour-spot-duration) infinite; } .wui-tour-pointer:dir(rtl) { animation-name: wui-tour-tap-rtl; } .wui-tour-pointer::after { display: block; animation: wui-tour-ripple calc(var(--wui-duration-slow) * 6) var(--wui-ease-out) var(--wui-tour-spot-duration) infinite; } } @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[data-layout=center][data-next] .wui-tour-actions { flex-direction: column; align-items: stretch; width: 100%; gap: var(--wui-space-xs); } .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-next { 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 var(--wui-duration-default) var(--wui-ease-out) calc(var(--wui-tour-card-delay, 0ms) + var(--wui-duration-fast)) both; } } `,V=()=>(0,c.readText)(`tour`,f),H=`wui-tour-media`,Me=`wui-tour-media-toggle`,U=`http://www.w3.org/2000/svg`,Ne=`M6 5h4v14H6zM14 5h4v14h-4z`,Pe=`M8 5v14l11-7z`,Fe=()=>({pause:V().mediaPauseLabel,play:V().mediaPlayLabel}),Ie=()=>globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`)?.matches===!0;function Le(e){let t=document.createElementNS(U,`svg`);t.setAttribute(`viewBox`,`0 0 24 24`),t.setAttribute(`aria-hidden`,`true`),t.setAttribute(`focusable`,`false`);let n=document.createElementNS(U,`path`);return n.setAttribute(`d`,e),t.appendChild(n),t}function Re(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 ze(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 Be(e,t){let n=document.createElement(`button`);n.type=`button`,n.className=Me;let r=(r=!e.paused)=>{n.setAttribute(`aria-label`,r?t.pause:t.play),n.replaceChildren(Le(r?Ne:Pe))};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 Ve(e){let t=e.querySelector(`:scope > .${H}`);if(!t)return;let n=t.querySelector(`video`);n&&(n.pause(),n.removeAttribute(`src`),n.load()),t.remove()}function He(e,t,n=Fe()){if(Ve(e),!t.media){e.removeAttribute(`data-media`);return}let r=document.createElement(`div`);if(r.className=H,t.mediaType===`video`){let e=ze(t,!Ie());r.append(e,Be(e,n))}else r.appendChild(Re(t));e.prepend(r),e.setAttribute(`data-media`,t.target?`step`:`welcome`)}var W=`data-wui-tour-open`,Ue=()=>(0,c.readText)(`tour`,f);function G(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 We(e,t,n){return(e.getAttribute(`progress-label`)||Ue().progressLabel).replace(/\{(current|total)\}/g,(e,r)=>String(r===`current`?t:n))}function Ge(e,{text:t,position:n,total:r}){let i=e.querySelector(`.wui-tour-position`);if(!(i instanceof HTMLElement))throw Error(`tour position label missing`);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;){let e=a.lastElementChild;if(!e)throw Error(`progress bar segment missing`);e.remove()}for(let e=0;e<o.length;e++){let t=o[e];if(!t)throw Error(`progress bar segment missing`);t.toggleAttribute(`data-filled`,e<n)}}var Ke=`wui-tour-seen:`;function qe(e=Ke,t=globalThis.localStorage){return{isSeen:async n=>t.getItem(e+n)===`1`,markSeen:async n=>{t.setItem(e+n,`1`)}}}var Je=`wui-tour-step`,Ye=`wui-tour-host`,K=`data-tracking`,q=()=>(0,c.readText)(`tour`,f),Xe=()=>({back:q().backLabel,next:q().nextLabel,skip:q().skipLabel,done:q().doneLabel,mediaPause:q().mediaPauseLabel,mediaPlay:q().mediaPlayLabel,endTitle:q().endTitle,endMessage:q().endMessage,endButton:q().doneLabel}),Ze={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`},Qe=[[`media`,`media`],[`mediaAlt`,`media-alt`],[`mediaPoster`,`media-poster`],[`mediaType`,`media-type`],[`advanceOn`,`advance-on`],[`actionLabel`,`action-label`]],J={index:null,position:null,total:null},$e=0,Y=e=>!e?.isConnected||getComputedStyle(e).visibility===`hidden`?!1:e.getClientRects().length>0,X=e=>e instanceof HTMLElement&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));function Z(e,t,n){let r=e.querySelector(t);if(!(r instanceof n))throw Error(`<wui-tour> layer has no ${t}`);return r}var et=()=>{let e=document.activeElement;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e},Q=null;function tt(e){Q||(Q=new CSSStyleSheet,Q.replaceSync(B)),e.adoptedStyleSheets=[Q]}var $=class extends a.ElementBase{seenStore;onBeforeStep;_run;_running;_layer;_outer;_shadow;_unbindAdvance;_ending;_seenMark;_steps=[];_progress=G(0);_firstIndex=0;_returnFocus=null;_current=null;_moving=!1;_card=null;_spot=null;_live=null;_onKey=null;_onFocusIn=null;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 > ${Je}`),e=>{let t={target:e.getAttribute(`target`)||``,title:e.getAttribute(`title`)||void 0,description:(e.textContent??``).trim()};for(let[n,r]of Qe)e.hasAttribute(r)&&(t[n]=e.getAttribute(r)??``);return t})}_stepAt(e){let t=this._steps[e];if(!t)throw RangeError(`<wui-tour> has no step ${e}; it has ${this._steps.length}.`);return t}_store(){return this.seenStore?this.seenStore:this.getAttribute(`seen-store`)===`local`?qe():globalThis.window?.WUI?.tour?.seenStore||null}_label(e){return this.getAttribute(Ze[e])||Xe()[e]}_endDialogText(){if(this.getAttribute(`end-dialog`)===`false`)return null;let e=(this.getAttribute(`end-next-label`)??``).trim(),t=(this.getAttribute(`end-next-href`)??``).trim();return{title:this._label(`endTitle`),message:this._label(`endMessage`),button:this._label(`endButton`),nextLabel:e,nextHref:t}}_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=G(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&&!Y(document.querySelector(t.target))&&this._progress.drop(e);this._returnFocus=document.activeElement;let n=await this._locate(0,1,e);e===this._run&&(n?(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))):this._finish(`noTargets`))}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(!e)break;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),a=t instanceof HTMLElement||t instanceof SVGElement?t:null;if(Y(a))return this._progress.position(i),{index:i,target:a};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-${++$e}`,t=document.createElement(`div`);t.className=`wui-tour-layer`,t.replaceChildren((0,i.make)(`div`,{class:`wui-tour-spot`,"aria-hidden":`true`}),(0,i.make)(`div`,{class:`wui-tour-card`,role:`dialog`,tabindex:`-1`,"aria-labelledby":`${e}-title`,"aria-describedby":`${e}-text`},(0,i.make)(`p`,{class:`wui-tour-position`}),(0,i.make)(`h2`,{class:`wui-tour-title`,id:`${e}-title`}),(0,i.make)(`p`,{class:`wui-tour-text`,id:`${e}-text`}),(0,i.make)(`div`,{class:`wui-tour-actions`},(0,i.make)(`button`,{type:`button`,class:`btn btn-sm btn-link wui-tour-skip`}),(0,i.make)(`div`,{class:`wui-tour-nav`},(0,i.make)(`button`,{type:`button`,class:`${(0,r.buttonClass)(`neutral`,`outline`,`sm`)} wui-tour-back`,"data-wui":r.APP_BUTTON_MARKER}),(0,i.make)(`button`,{type:`button`,class:`${(0,r.buttonClass)(`primary`,`solid`,`sm`)} wui-tour-next`,"data-wui":r.APP_BUTTON_MARKER})))),(0,i.make)(`div`,{class:`visually-hidden`,role:`status`,"aria-live":`polite`}));let a=t;this._shadow=null,this.isolated&&(a=document.createElement(Ye),this._shadow=a.attachShadow({mode:`open`}),tt(this._shadow),this._shadow.appendChild(t)),a.setAttribute(`popover`,`manual`),(0,o.overlayRoot)(document).appendChild(a),document.documentElement.setAttribute(W,``),this._outer=a,this._layer=t;let s=Z(t,`.wui-tour-spot`,HTMLDivElement),c=Z(t,`.wui-tour-card`,HTMLDivElement),l=Z(t,`[role=status]`,HTMLElement);this._spot=s,this._card=c,this._live=l,Z(c,`.wui-tour-skip`,HTMLElement).addEventListener(`click`,()=>this._close(`skipped`,`button`)),Z(c,`.wui-tour-back`,HTMLElement).addEventListener(`click`,()=>this._move(-1)),Z(c,`.wui-tour-next`,HTMLElement).addEventListener(`click`,()=>this._move(1));let u=e=>this._key(e);this._onKey=u;let d=e=>{let t=this._layer;if(!t||this._ending)return;let n=this._current,r=n?this._stepAt(n.index):null;if(!(e.target instanceof Node))throw Error(`<wui-tour> saw a focus change from a non-node target`);ce(t,r,n?.target??null,e.target)||c.focus()};this._onFocusIn=d,document.addEventListener(`keydown`,u,!0),this._shadow||document.addEventListener(`focusin`,d),(0,n.bindReanchor)(a,()=>this._follow())}_active(){return this._shadow?this._shadow.activeElement:document.activeElement}_raise(){let e=this._outer;if(!e)throw Error(`<wui-tour> raises a step before its host is built`);let t=(0,o.overlayRoot)(this.ownerDocument);e.parentElement!==t&&t.appendChild(e),(0,o.raisePopover)(e)}_show(e){this._current=e;let{index:t,target:n}=e,r=this._stepAt(t),i=this._layer,a=this._spot,o=this._card,s=this._live;if(!i||!a||!o||!s)throw Error(`<wui-tour> shows a step before its layer is built`);this._raise();let c=this._progress.position(t),l=this._progress.total(),u=c===l&&!this._endDialogText(),d=We(this,c,l);Ge(o,{text:d,position:c,total:l}),He(o,r,{pause:this._label(`mediaPause`),play:this._label(`mediaPlay`)}),o.toggleAttribute(`data-welcome`,!n);let f=S(this,{layer:i,spot:a,card:o},r,n),p=Z(o,`.wui-tour-title`,HTMLElement);p.textContent=r.title||``,p.hidden=!r.title,Z(o,`.wui-tour-text`,HTMLElement).textContent=r.description||``,Z(o,`.wui-tour-skip`,HTMLElement).textContent=this._label(`skip`);let m=Z(o,`.wui-tour-back`,HTMLElement);m.textContent=this._label(`back`),m.hidden=t<=this._firstIndex,Z(o,`.wui-tour-next`,HTMLElement).textContent=this._label(u?`done`:`next`);let h=[d,r.title,r.description].filter(Boolean).join(`. `);s.textContent=f?[h,f].join(/[.!?]$/.test(h)?` `:`. `):h,xe(o,n),a.removeAttribute(K),this._place(),D(o),this._unbindAdvance?.(),this._unbindAdvance=se(r,n,()=>void this._move(1));let g=this._active();(g!==null&&o.contains(g)?!(g instanceof HTMLElement&&g.hidden):this._shadow!==null&&X(et()))||o.focus(),this.dispatchEvent(new CustomEvent(`wui-tour:step`,{bubbles:!0,detail:{step:r,index:t,position:c,total:l}}))}_place(){if(!this._current||!this._layer)return;let e=this._spot,t=this._card;if(!e||!t)throw Error(`<wui-tour> places a step before its layer is built`);L(e,t,this._current.target)}_follow(){if(!this._current||!this._layer||this._ending)return;let e=this._spot;if(!e)throw Error(`<wui-tour> follows a step before its spot is built`);let t=e.style.cssText;this._place(),e.style.cssText!==t&&e.setAttribute(K,``)}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=this._card;if(!e)throw Error(`<wui-tour> moved with no card showing`);let t=O(e);if(t!==null&&await t,n!==this._run)return;this._show(r)}else if(t>0){let e=this._endDialogText(),t=e?await this._showEnd(e):`done`;if(n!==this._run)return;let r=await this._close(t===`next`?`next`:`finished`);if(t===`next`&&r&&e){let t=this.ownerDocument.defaultView;if(!t)throw Error(`<wui-tour> has no window to follow its next link in`);t.location.assign(e.nextHref)}}}finally{this._moving=!1}}_showEnd(e){this._unbindAdvance?.(),this._unbindAdvance=null;let t=this._layer,n=this._spot,r=this._card;if(!t||!n||!r)throw Error(`<wui-tour> ends a tour before its layer is built`);return S(this,{layer:t,spot:n,card:r},null,null),n.removeAttribute(K),this._ending=new AbortController,this._seenMark=this._markSeen(`finished`),je(t,e,this._ending.signal)}_key(e){if(!this._layer||this._ending||e.altKey||e.ctrlKey||e.metaKey)return;let t=(0,s.mirrorKey)(e.key,(0,s.isRtl)(this));if(e.key===`Escape`)e.preventDefault(),e.stopPropagation(),this._close(`skipped`,`escape`);else if(t===`ArrowRight`||t===`ArrowLeft`){if(X(e.composedPath?.()[0]??e.target))return;if(e.preventDefault(),t===`ArrowRight`)this._move(1);else{let e=this._current;if(!e)throw Error(`<wui-tour> moved back with no step showing`);e.index>this._firstIndex&&this._move(-1)}}else if(e.key===`Tab`&&!this._shadow){let t=this._current,n=this._card;if(!t||!n)throw Error(`<wui-tour> cycled focus with no step showing`);le(e,{card:n,active:this._active(),step:this._stepAt(t.index),target:t.target})}}_teardown(){if(!this._layer)return;this._onKey&&document.removeEventListener(`keydown`,this._onKey,!0),this._onFocusIn&&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;let t=this._outer;if((0,n.unbindReanchor)(t),!t)throw Error(`<wui-tour> has a layer with no host to remove`);ge(t),document.documentElement.removeAttribute(W),this._outer=null,this._shadow=null,this._layer=null,this._current=null;let r=this._returnFocus;this._returnFocus=null,e&&r?.isConnected&&(r instanceof HTMLElement||r instanceof SVGElement)&&r.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()}:J,a=this._seenMark;this._teardown();let o=e===`next`?`finished`:e,s=!1;try{n===this._run&&await(a??this._markSeen(o)),s=n===this._run}finally{this._finish(e,i,t)}return s}_finish(e,t=J,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}}))}};(0,t.defineElement)(`wui-tour`,$),e.WuiTour=$})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.anchorOverlay,WeborityUiElementsInternal.modules.buttonClass,WeborityUiElementsInternal.modules.dom,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.nativeOverlay,WeborityUiElementsInternal.modules.rtl,WeborityUiElementsInternal.modules.textStore,WeborityUiElementsInternal.modules.imeSafeEnter,WeborityUiElementsInternal.modules.svgNodes);
|
|
1
|
+
(function(e,t,n,r,i,a,o,s,c,l,u){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var d=globalThis.WeborityUiElementsInternal?.version;if(d!==`0.175.0`)throw Error(`[webority-ui] tour expects ui-elements 0.175.0 but the page loaded `+d+`.`);var f={backLabel:`Back`,doneLabel:`Done`,endMessage:`You know your way around now. Enjoy exploring.`,endTitle:`You're all set`,mediaPauseLabel:`Pause animation`,mediaPlayLabel:`Play animation`,nextLabel:`Next`,progressLabel:`Step {current} of {total}`,skipLabel:`Skip`},p={advanceLabel:`Click {actionName} to continue.`},m=`data-advance`,h=`wui-tour-hint`,g=`wui-tour-pointer`,_=`a[href], button, input, select, textarea, summary, [tabindex], [contenteditable]`,v=()=>(0,c.readText)(`tourAdvance`,p),y=(e,t)=>e?.advanceOn===`click`&&!!t,b=e=>(e??``).replace(/\s+/g,` `).trim(),ee=e=>e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLMeterElement||e instanceof HTMLOutputElement||e instanceof HTMLProgressElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement?e.labels:null,te=e=>e instanceof HTMLButtonElement||e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement||e instanceof HTMLFieldSetElement||e instanceof HTMLOptGroupElement||e instanceof HTMLOptionElement?e.disabled:!1;function ne(e){let t=e.ownerDocument,n=(e.getAttribute(`aria-labelledby`)||``).split(/\s+/).filter(Boolean),r=e instanceof HTMLInputElement&&/^(button|submit|reset)$/.test(e.type)?e.value:``,i=[n.map(e=>t.getElementById(e)?.textContent??``).join(` `),e.getAttribute(`aria-label`),Array.from(ee(e)??[],e=>e.textContent).join(` `),e.getAttribute(`alt`),r,e.textContent,e.getAttribute(`title`)];for(let e of i){let t=b(e);if(t)return t}return``}function re(e){for(let t of[e,...e.querySelectorAll(_)])if((t instanceof HTMLElement||t instanceof SVGElement)&&t.tabIndex>=0&&!te(t))return t;return null}function x(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 ie(e,t){let n=e.querySelector(`.${h}`),r=e.querySelector(`.wui-tour-text`)?.id,i=r?`${r.replace(/-text$/,``)}-hint`:``;if(!t)n?.remove(),i&&x(e,i,!1);else{if(!n){n=e.ownerDocument.createElement(`p`),n.className=h,i&&(n.id=i);let t=e.querySelector(`.wui-tour-actions`);if(!t)throw Error(`Tour card has no actions row.`);t.before(n)}n.textContent=t,i&&x(e,i,!0)}}function ae(e,t){let n=e.querySelector(`.${g}`);if(!t){n?.remove();return}if(n)return;let r=e.ownerDocument.createElement(`span`);r.className=g,r.setAttribute(`aria-hidden`,`true`),e.append(r)}var oe=e=>getComputedStyle(e).animationName;function S(e,{layer:t,spot:n,card:r},i,a){let o=y(i,a);t.toggleAttribute(m,o&&!(t.getRootNode()instanceof ShadowRoot)),n.hasAttribute(m)&&(n.removeAttribute(m),o&&oe(n)),o&&n.setAttribute(m,``),ae(n,o);let s=r.querySelector(`.wui-tour-next`);if(!(s instanceof HTMLElement))throw Error(`Tour card has no next button.`);s.classList.toggle(`btn-primary`,!o),s.classList.toggle(`btn-link`,o);let c=o?b(i?.actionLabel)||ne(a):``,l=e.getAttribute(`advance-label`)||v().advanceLabel,u=c?l.replace(/\{actionName\}/g,()=>c):``;return ie(r,u),u}function se(e,t,n){if(!y(e,t))return()=>{};let r,i=()=>{r??=setTimeout(n,0)};return t.addEventListener(`click`,i),()=>{t.removeEventListener(`click`,i),clearTimeout(r)}}function ce(e,t,n,r){return e.contains(r)||y(t,n)&&n.contains(r)}function le(e,{card:t,active:n,step:r,target:i}){let a=Array.from(t.querySelectorAll(`button`)).filter(e=>!e.hidden),o=y(r,i)?re(i):null;o&&a.push(o);let s=a.findIndex(e=>e===n||e===o&&i?.contains(n));e.preventDefault();let c=a[s===-1?e.shiftKey?a.length-1:0:(s+(e.shiftKey?-1:1)+a.length)%a.length];if(!c)throw Error(`Tour card has no focus stop.`);c.focus()}var ue=2/3,de=1e3,fe=new Set([`top`,`left`,`width`,`height`]),C=new WeakMap,w=(e,t)=>typeof e.getAnimations==`function`?e.getAnimations().filter(t):[],T=e=>`transitionProperty`in e&&e.transitionProperty===`opacity`,pe=e=>`transitionProperty`in e&&typeof e.transitionProperty==`string`&&fe.has(e.transitionProperty),me=e=>`animationName`in e&&typeof e.animationName==`string`&&e.animationName.startsWith(`wui-tour-`);function E(e){return e.length===0?null:new Promise(t=>{let n=setTimeout(t,de);Promise.allSettled(e.map(e=>e.finished)).then(()=>{clearTimeout(n),t()})})}function he(e){let t=e.parentElement?.querySelector(`:scope > .wui-tour-spot`),n=0;for(let e of t?w(t,pe):[]){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*ue-r)}return n}function D(e){let t=he(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={};C.set(e,n);let r=()=>{C.get(e)===n&&e.dataset.state===`entering`&&(e.dataset.state=`shown`)},i=w(e,me);i.length===0?r():Promise.allSettled(i.map(e=>e.finished)).then(r)}function O(e){return e.dataset.state=`leaving`,E(w(e,T))}function ge(e){let t=e.shadowRoot?.querySelector(`.wui-tour-layer`),n=e.classList.contains(`wui-tour-layer`)?e:t instanceof HTMLElement?t:null;n&&(n.dataset.state=`leaving`);let r=n?E(w(n,T)):null;r?(e.setAttribute(`inert`,``),r.then(()=>e.remove())):e.remove()}var _e=2,k=12,A=8,j=4,M=20,ve=`(max-width: 575.98px)`,ye=[`bottom`,`top`,`right`,`left`],be=[`bottom`,`top`,`left`,`right`],N=[`top-left`,`top-right`,`bottom-right`,`bottom-left`],P,F=(e,t,n)=>Math.max(t,Math.min(e,n)),I=(e,t,n,r)=>(Math.max(e,n)+Math.min(t,r))/2;function xe(e,t){if(!t?.scrollIntoView)return;e.style.maxHeight=``;let n=R(e),r=e.offsetHeight+k;if(t.getBoundingClientRect().height+4+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 L(e,t,n){let r=e.style,i=t.style,a=Ee(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 N)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`,Se(r,n);let c=t.scrollTop;i.maxHeight=``;let l={width:t.offsetWidth,height:t.offsetHeight},u=R(t),d=u.bottom-u.top,f={bottom:u.bottom-o.bottom-k,top:o.top-k-u.top,right:u.right-o.right-k,left:o.left-k-u.left},p=window.matchMedia(ve).matches,m=((0,s.isRtl)(n)?be:ye).find(e=>e===`top`||e===`bottom`?l.height<=f[e]+1:!p&&l.width<=f[e]+1&&l.height<=d+1),h=Math.min(o.bottom,u.bottom+A)-Math.max(o.top,u.top-A);m?Ce(t,a,m,o,u,l):h>=Math.min(l.height,d)+8?we(t,a,o,u,l):Te(t,a,f.bottom>=f.top?`bottom`:`top`,o,u,l,f),t.scrollTop=c}function Se(e,t){P??=CSS.supports(`corner-top-left-shape`,`squircle`);let n=getComputedStyle(t);for(let t of N)e.setProperty(`border-${t}-radius`,n.getPropertyValue(`border-${t}-radius`)),P&&e.setProperty(`corner-${t}-shape`,n.getPropertyValue(`corner-${t}-shape`))}function Ce(e,t,n,r,i,a){let o=n===`top`||n===`bottom`,s,c,l;if(o){let e=I(r.left,r.right,i.left,i.right);s=F(e-a.width/2,i.left,i.right-a.width),c=n===`bottom`?r.bottom+k:r.top-k-a.height,l=F(e-s,M,a.width-M)}else{let e=I(r.top,r.bottom,i.top,i.bottom);c=F(e-a.height/2,i.top,i.bottom-a.height),s=n===`right`?r.right+k:r.left-k-a.width,l=F(e-c,M,a.height-M)}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 we(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)-j;e.style.top=`${Math.max(r.top,o-Math.min(i.height,a))}px`,e.style.left=`${F(n.left+j,r.left,r.right-i.width)}px`}function Te(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+k:r.top-k-c}px`;let l=I(r.left,r.right,i.left,i.right);e.style.left=`${F(l-a.width/2,i.left,i.right-a.width)}px`}function R(e){let t=e.parentElement,n=t?getComputedStyle(t):null,r=e=>Number.parseFloat(n?.[e]??``)||0;return{top:r(`paddingTop`)+A,bottom:window.innerHeight-r(`paddingBottom`)-A,left:r(`paddingLeft`)+A,right:window.innerWidth-r(`paddingRight`)-A}}function Ee(e){let t=e.querySelector(`:scope > .wui-tour-arrow`);if(t instanceof HTMLElement)return t;let n=document.createElement(`span`);return n.className=`wui-tour-arrow`,n.setAttribute(`aria-hidden`,`true`),n.hidden=!0,e.append(n),n}var De=0,Oe=`btn btn-sm btn-link`;function z(e,t,n){let r=e.querySelector(t);if(!(r instanceof n))throw Error(`Expected "${t}" to match a ${n.name}.`);return r}function ke(e,t){let n=`wui-tour-end-${++De}`,{nextLabel:a,nextHref:o}=e,s=a&&o?(0,i.make)(`a`,{class:`${(0,r.buttonClass)(`primary`,`solid`,`sm`)} wui-tour-end-next`,"data-wui":r.APP_BUTTON_MARKER,href:o},a):null,c=s!==null,l=c?Oe:(0,r.buttonClass)(`primary`,`solid`,`sm`),d=(0,i.make)(`button`,{type:`button`,class:`${l} wui-tour-end-button`,"data-wui":r.APP_BUTTON_MARKER},e.button);return(0,i.make)(t?`dialog`:`div`,{class:`wui-tour-card wui-tour-end`,"data-layout":`center`,"data-next":c||void 0,role:`dialog`,tabindex:-1,"aria-labelledby":`${n}-title`,"aria-describedby":`${n}-message`},(0,i.make)(`div`,{class:`wui-tour-end-mark`,"aria-hidden":`true`},(0,u.svgRoot)({viewBox:`0 0 24 24`,focusable:`false`},[[`path`,{d:`M5 12.5l4.5 4.5L19 7.5`}]])),(0,i.make)(`h2`,{class:`wui-tour-title wui-tour-end-title`,id:`${n}-title`},e.title),(0,i.make)(`p`,{class:`wui-tour-text wui-tour-end-message`,id:`${n}-message`},e.message),(0,i.make)(`div`,{class:`wui-tour-actions`},s,d))}var Ae=e=>e.button===0&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&!e.altKey;function je(e,t,n){let r=e.ownerDocument,i=ke(t,e.getRootNode()===r),a=z(i,`.wui-tour-end-button`,HTMLButtonElement),s=i.querySelector(`.wui-tour-end-next`);if(s!==null&&!(s instanceof HTMLAnchorElement))throw Error(`The end dialog's next link is not a link.`);let c=s,u=c??a,d=new AbortController,f=i instanceof HTMLDialogElement?i:null,p=null;return new Promise(s=>{let m=e=>{if(d.abort(),p&&f){let e=p;p=null,(0,o.closeModalDialog)(f).then(e)}s(e)};if(n?.aborted){m(`done`);return}let h=z(e,`.wui-tour-card:not(.wui-tour-end)`,HTMLElement),g=z(e,`.wui-tour-spot`,HTMLElement),_=z(e,`[role=status]`,HTMLElement),v={signal:d.signal};n?.addEventListener(`abort`,()=>m(`done`),v),a.addEventListener(`click`,()=>m(`done`),v),c&&c.addEventListener(`click`,e=>{Ae(e)&&(e.preventDefault(),m(`next`))},v),r.addEventListener(`keydown`,e=>{if(!(e.altKey||e.ctrlKey||e.metaKey)){if(e.key===`Escape`){if(p)return;e.preventDefault(),e.stopPropagation(),m(`done`)}else(0,l.isImeSafeEnter)(e)&&c&&!e.shiftKey&&(e.composedPath?.()[0]??e.target)===c&&(e.preventDefault(),m(`next`))}},{capture:!0,signal:d.signal});let y=()=>{d.signal.aborted||(h.hidden=!0,L(g,h,null),e.append(i),D(i),f&&(p=(0,o.openModalDialog)(f,{escape:!0,backdrop:!1,focus:`first-control`,onRequestClose:()=>m(`done`)})),_.textContent=[t.title,t.message].filter(Boolean).join(`. `),u.focus())},b=O(h);b===null?y():b.then(y)})}var Me=` :host { all: initial; display: revert-layer; position: fixed; inset: 0; ${Object.entries({"--wui-z-tour":`1550`,"--wui-radius-sm":`8px`,"--wui-radius-lg":`14px`,"--wui-shadow-popover":`0px 8px 28px -6px rgba(7, 20, 55, 0.14)`,"--wui-ease-out":`cubic-bezier(0.22, 1, 0.36, 1)`,"--wui-ease-linear":`cubic-bezier(0, 0, 1, 1)`,"--wui-duration-fast":`150ms`,"--wui-duration-default":`250ms`,"--wui-duration-slow":`400ms`,"--wui-space-xs":`4px`,"--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-text":`#4F46E5`,"--color-focus-ring":`#4F46E5`,"--wui-focus-ring-width":`2px`,"--wui-focus-ring-offset":`2px`,"--color-on-primary":`#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-on-primary); } .btn-primary:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); } .btn-outline-neutral { border-color: var(--color-text-muted); color: var(--color-text-muted); } .btn-outline-neutral:hover { background: var(--color-bg-muted); color: var(--color-text); } .btn-link { font-weight: 400; color: var(--color-primary-text); 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); width: auto; height: auto; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; overflow: visible; background: none; } .wui-tour-spot { position: fixed; box-shadow: 0 0 0 2px var(--color-primary), 0 0 4px 2px color-mix(in srgb, var(--color-primary) 30%, transparent), 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-popover); } .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 var(--wui-duration-fast) var(--wui-ease-linear); } .wui-tour-layer[data-state=leaving] { transition: opacity var(--wui-duration-fast) var(--wui-ease-linear); } .wui-tour-card[data-state=entering] { animation: wui-tour-fade-in var(--wui-duration-fast) var(--wui-ease-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-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: var(--wui-focus-ring-offset); } .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); } .wui-tour-pointer { position: absolute; top: 50%; left: 50%; width: 18px; height: 24px; pointer-events: none; } .wui-tour-pointer::before { content: ""; position: absolute; inset: 0; background: var(--color-primary); clip-path: polygon(0 0, 0 75%, 28% 58%, 46% 100%, 62% 92%, 45% 52%, 85% 52%); filter: drop-shadow(1px 0 0 var(--color-surface)) drop-shadow(-1px 0 0 var(--color-surface)) drop-shadow(0 1px 0 var(--color-surface)) drop-shadow(0 -1px 0 var(--color-surface)); } .wui-tour-pointer::after { content: ""; position: absolute; top: -16px; left: -16px; width: 32px; height: 32px; border-radius: 50%; background: var(--color-primary); opacity: 0; display: none; } @media (max-width: 575.98px) { .wui-tour-pointer { width: 24px; height: 24px; translate: -50% -50%; } .wui-tour-pointer::before { clip-path: none; border-radius: 50%; box-shadow: 0 0 0 2px var(--color-surface); filter: none; } .wui-tour-pointer::after { top: -4px; left: -4px; } } @keyframes wui-tour-tap { 0% { opacity: 0; transform: translate(56px, 44px) scale(1); } 10% { opacity: 1; transform: translate(56px, 44px) scale(1); } 45% { transform: translate(0, 0) scale(1); } 52% { transform: translate(0, 0) scale(0.86); } 60% { transform: translate(0, 0) scale(1); } 85% { opacity: 1; transform: translate(0, 0) scale(1); } 100% { opacity: 0; transform: translate(0, 0) scale(1); } } @keyframes wui-tour-tap-rtl { 0% { opacity: 0; transform: translate(-56px, 44px) scale(1); } 10% { opacity: 1; transform: translate(-56px, 44px) scale(1); } 45% { transform: translate(0, 0) scale(1); } 52% { transform: translate(0, 0) scale(0.86); } 60% { transform: translate(0, 0) scale(1); } 85% { opacity: 1; transform: translate(0, 0) scale(1); } 100% { opacity: 0; transform: translate(0, 0) scale(1); } } @keyframes wui-tour-ripple { 0%, 50% { opacity: 0; transform: scale(0.2); } 52% { opacity: 0.35; transform: scale(0.2); } 80%, 100% { opacity: 0; transform: scale(1); } } @media (prefers-reduced-motion: no-preference) { .wui-tour-pointer { opacity: 0; animation: wui-tour-tap calc(var(--wui-duration-slow) * 6) var(--wui-ease-out) var(--wui-tour-spot-duration) infinite; } .wui-tour-pointer:dir(rtl) { animation-name: wui-tour-tap-rtl; } .wui-tour-pointer::after { display: block; animation: wui-tour-ripple calc(var(--wui-duration-slow) * 6) var(--wui-ease-out) var(--wui-tour-spot-duration) infinite; } } @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[data-layout=center][data-next] .wui-tour-actions { flex-direction: column; align-items: stretch; width: 100%; gap: var(--wui-space-xs); } .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-next { 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 var(--wui-duration-default) var(--wui-ease-out) calc(var(--wui-tour-card-delay, 0ms) + var(--wui-duration-fast)) both; } } `,B=()=>(0,c.readText)(`tour`,f),V=`wui-tour-media`,Ne=`wui-tour-media-toggle`,H=`http://www.w3.org/2000/svg`,Pe=`M6 5h4v14H6zM14 5h4v14h-4z`,Fe=`M8 5v14l11-7z`,Ie=()=>({pause:B().mediaPauseLabel,play:B().mediaPlayLabel}),Le=()=>globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`)?.matches===!0;function Re(e){let t=document.createElementNS(H,`svg`);t.setAttribute(`viewBox`,`0 0 24 24`),t.setAttribute(`aria-hidden`,`true`),t.setAttribute(`focusable`,`false`);let n=document.createElementNS(H,`path`);return n.setAttribute(`d`,e),t.appendChild(n),t}function ze(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 Be(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=Ne;let r=(r=!e.paused)=>{n.setAttribute(`aria-label`,r?t.pause:t.play),n.replaceChildren(Re(r?Pe: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 He(e){let t=e.querySelector(`:scope > .${V}`);if(!t)return;let n=t.querySelector(`video`);n&&(n.pause(),n.removeAttribute(`src`),n.load()),t.remove()}function Ue(e,t,n=Ie()){if(He(e),!t.media){e.removeAttribute(`data-media`);return}let r=document.createElement(`div`);if(r.className=V,t.mediaType===`video`){let e=Be(t,!Le());r.append(e,Ve(e,n))}else r.appendChild(ze(t));e.prepend(r),e.setAttribute(`data-media`,t.target?`step`:`welcome`)}var U=`data-wui-tour-open`,We=()=>(0,c.readText)(`tour`,f);function W(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 Ge(e,t,n){return(e.getAttribute(`progress-label`)||We().progressLabel).replace(/\{(current|total)\}/g,(e,r)=>String(r===`current`?t:n))}function Ke(e,{text:t,position:n,total:r}){let i=e.querySelector(`.wui-tour-position`);if(!(i instanceof HTMLElement))throw Error(`tour position label missing`);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;){let e=a.lastElementChild;if(!e)throw Error(`progress bar segment missing`);e.remove()}for(let e=0;e<o.length;e++){let t=o[e];if(!t)throw Error(`progress bar segment missing`);t.toggleAttribute(`data-filled`,e<n)}}var qe=`wui-tour-seen:`;function Je(e=qe,t=globalThis.localStorage){return{isSeen:async n=>t.getItem(e+n)===`1`,markSeen:async n=>{t.setItem(e+n,`1`)}}}function G(e){"@babel/helpers - typeof";return G=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},G(e)}function Ye(e,t){if(G(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(G(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Xe(e){var t=Ye(e,`string`);return G(t)==`symbol`?t:t+``}function K(e,t,n){return(t=Xe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ze=`wui-tour-step`,Qe=`wui-tour-host`,q=`data-tracking`,J=()=>(0,c.readText)(`tour`,f),$e=()=>({back:J().backLabel,next:J().nextLabel,skip:J().skipLabel,done:J().doneLabel,mediaPause:J().mediaPauseLabel,mediaPlay:J().mediaPlayLabel,endTitle:J().endTitle,endMessage:J().endMessage,endButton:J().doneLabel}),et={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`},tt=[[`media`,`media`],[`mediaAlt`,`media-alt`],[`mediaPoster`,`media-poster`],[`mediaType`,`media-type`],[`advanceOn`,`advance-on`],[`actionLabel`,`action-label`]],Y={index:null,position:null,total:null},nt=0,X=e=>!e?.isConnected||getComputedStyle(e).visibility===`hidden`?!1:e.getClientRects().length>0,Z=e=>e instanceof HTMLElement&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));function Q(e,t,n){let r=e.querySelector(t);if(!(r instanceof n))throw Error(`<wui-tour> layer has no ${t}`);return r}var rt=()=>{let e=document.activeElement;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e},$=null;function it(e){$||($=new CSSStyleSheet,$.replaceSync(Me)),e.adoptedStyleSheets=[$]}var at=class extends a.ElementBase{static get observedAttributes(){return[`open`]}constructor(){super(),K(this,`seenStore`,void 0),K(this,`onBeforeStep`,void 0),K(this,`_run`,void 0),K(this,`_running`,void 0),K(this,`_layer`,void 0),K(this,`_outer`,void 0),K(this,`_shadow`,void 0),K(this,`_unbindAdvance`,void 0),K(this,`_ending`,void 0),K(this,`_seenMark`,void 0),K(this,`_steps`,[]),K(this,`_progress`,W(0)),K(this,`_firstIndex`,0),K(this,`_returnFocus`,null),K(this,`_current`,null),K(this,`_moving`,!1),K(this,`_card`,null),K(this,`_spot`,null),K(this,`_live`,null),K(this,`_onKey`,null),K(this,`_onFocusIn`,null),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 > ${Ze}`),e=>{let t={target:e.getAttribute(`target`)||``,title:e.getAttribute(`title`)||void 0,description:(e.textContent??``).trim()};for(let[n,r]of tt)e.hasAttribute(r)&&(t[n]=e.getAttribute(r)??``);return t})}_stepAt(e){let t=this._steps[e];if(!t)throw RangeError(`<wui-tour> has no step ${e}; it has ${this._steps.length}.`);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(et[e])||$e()[e]}_endDialogText(){if(this.getAttribute(`end-dialog`)===`false`)return null;let e=(this.getAttribute(`end-next-label`)??``).trim(),t=(this.getAttribute(`end-next-href`)??``).trim();return{title:this._label(`endTitle`),message:this._label(`endMessage`),button:this._label(`endButton`),nextLabel:e,nextHref:t}}_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=W(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&&!X(document.querySelector(t.target))&&this._progress.drop(e);this._returnFocus=document.activeElement;let n=await this._locate(0,1,e);e===this._run&&(n?(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))):this._finish(`noTargets`))}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(!e)break;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),a=t instanceof HTMLElement||t instanceof SVGElement?t:null;if(X(a))return this._progress.position(i),{index:i,target:a};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-${++nt}`,t=document.createElement(`div`);t.className=`wui-tour-layer`,t.replaceChildren((0,i.make)(`div`,{class:`wui-tour-spot`,"aria-hidden":`true`}),(0,i.make)(`div`,{class:`wui-tour-card`,role:`dialog`,tabindex:`-1`,"aria-labelledby":`${e}-title`,"aria-describedby":`${e}-text`},(0,i.make)(`p`,{class:`wui-tour-position`}),(0,i.make)(`h2`,{class:`wui-tour-title`,id:`${e}-title`}),(0,i.make)(`p`,{class:`wui-tour-text`,id:`${e}-text`}),(0,i.make)(`div`,{class:`wui-tour-actions`},(0,i.make)(`button`,{type:`button`,class:`btn btn-sm btn-link wui-tour-skip`}),(0,i.make)(`div`,{class:`wui-tour-nav`},(0,i.make)(`button`,{type:`button`,class:`${(0,r.buttonClass)(`neutral`,`outline`,`sm`)} wui-tour-back`,"data-wui":r.APP_BUTTON_MARKER}),(0,i.make)(`button`,{type:`button`,class:`${(0,r.buttonClass)(`primary`,`solid`,`sm`)} wui-tour-next`,"data-wui":r.APP_BUTTON_MARKER})))),(0,i.make)(`div`,{class:`visually-hidden`,role:`status`,"aria-live":`polite`}));let a=t;this._shadow=null,this.isolated&&(a=document.createElement(Qe),this._shadow=a.attachShadow({mode:`open`}),it(this._shadow),this._shadow.appendChild(t)),a.setAttribute(`popover`,`manual`),(0,o.overlayRoot)(document).appendChild(a),document.documentElement.setAttribute(U,``),this._outer=a,this._layer=t;let s=Q(t,`.wui-tour-spot`,HTMLDivElement),c=Q(t,`.wui-tour-card`,HTMLDivElement),l=Q(t,`[role=status]`,HTMLElement);this._spot=s,this._card=c,this._live=l,Q(c,`.wui-tour-skip`,HTMLElement).addEventListener(`click`,()=>this._close(`skipped`,`button`)),Q(c,`.wui-tour-back`,HTMLElement).addEventListener(`click`,()=>this._move(-1)),Q(c,`.wui-tour-next`,HTMLElement).addEventListener(`click`,()=>this._move(1));let u=e=>this._key(e);this._onKey=u;let d=e=>{let t=this._layer;if(!t||this._ending)return;let n=this._current,r=n?this._stepAt(n.index):null;if(!(e.target instanceof Node))throw Error(`<wui-tour> saw a focus change from a non-node target`);ce(t,r,n?.target??null,e.target)||c.focus()};this._onFocusIn=d,document.addEventListener(`keydown`,u,!0),this._shadow||document.addEventListener(`focusin`,d),(0,n.bindReanchor)(a,()=>this._follow())}_active(){return this._shadow?this._shadow.activeElement:document.activeElement}_raise(){let e=this._outer;if(!e)throw Error(`<wui-tour> raises a step before its host is built`);let t=(0,o.overlayRoot)(this.ownerDocument);e.parentElement!==t&&t.appendChild(e),(0,o.raisePopover)(e)}_show(e){this._current=e;let{index:t,target:n}=e,r=this._stepAt(t),i=this._layer,a=this._spot,o=this._card,s=this._live;if(!i||!a||!o||!s)throw Error(`<wui-tour> shows a step before its layer is built`);this._raise();let c=this._progress.position(t),l=this._progress.total(),u=c===l&&!this._endDialogText(),d=Ge(this,c,l);Ke(o,{text:d,position:c,total:l}),Ue(o,r,{pause:this._label(`mediaPause`),play:this._label(`mediaPlay`)}),o.toggleAttribute(`data-welcome`,!n);let f=S(this,{layer:i,spot:a,card:o},r,n),p=Q(o,`.wui-tour-title`,HTMLElement);p.textContent=r.title||``,p.hidden=!r.title,Q(o,`.wui-tour-text`,HTMLElement).textContent=r.description||``,Q(o,`.wui-tour-skip`,HTMLElement).textContent=this._label(`skip`);let m=Q(o,`.wui-tour-back`,HTMLElement);m.textContent=this._label(`back`),m.hidden=t<=this._firstIndex,Q(o,`.wui-tour-next`,HTMLElement).textContent=this._label(u?`done`:`next`);let h=[d,r.title,r.description].filter(Boolean).join(`. `);s.textContent=f?[h,f].join(/[.!?]$/.test(h)?` `:`. `):h,xe(o,n),a.removeAttribute(q),this._place(),D(o),this._unbindAdvance?.(),this._unbindAdvance=se(r,n,()=>void this._move(1));let g=this._active();(g!==null&&o.contains(g)?!(g instanceof HTMLElement&&g.hidden):this._shadow!==null&&Z(rt()))||o.focus(),this.dispatchEvent(new CustomEvent(`wui-tour:step`,{bubbles:!0,detail:{step:r,index:t,position:c,total:l}}))}_place(){if(!this._current||!this._layer)return;let e=this._spot,t=this._card;if(!e||!t)throw Error(`<wui-tour> places a step before its layer is built`);L(e,t,this._current.target)}_follow(){if(!this._current||!this._layer||this._ending)return;let e=this._spot;if(!e)throw Error(`<wui-tour> follows a step before its spot is built`);let t=e.style.cssText;this._place(),e.style.cssText!==t&&e.setAttribute(q,``)}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=this._card;if(!e)throw Error(`<wui-tour> moved with no card showing`);let t=O(e);if(t!==null&&await t,n!==this._run)return;this._show(r)}else if(t>0){let e=this._endDialogText(),t=e?await this._showEnd(e):`done`;if(n!==this._run)return;let r=await this._close(t===`next`?`next`:`finished`);if(t===`next`&&r&&e){let t=this.ownerDocument.defaultView;if(!t)throw Error(`<wui-tour> has no window to follow its next link in`);t.location.assign(e.nextHref)}}}finally{this._moving=!1}}_showEnd(e){this._unbindAdvance?.(),this._unbindAdvance=null;let t=this._layer,n=this._spot,r=this._card;if(!t||!n||!r)throw Error(`<wui-tour> ends a tour before its layer is built`);return S(this,{layer:t,spot:n,card:r},null,null),n.removeAttribute(q),this._ending=new AbortController,this._seenMark=this._markSeen(`finished`),je(t,e,this._ending.signal)}_key(e){if(!this._layer||this._ending||e.altKey||e.ctrlKey||e.metaKey)return;let t=(0,s.mirrorKey)(e.key,(0,s.isRtl)(this));if(e.key===`Escape`)e.preventDefault(),e.stopPropagation(),this._close(`skipped`,`escape`);else if(t===`ArrowRight`||t===`ArrowLeft`){if(Z(e.composedPath?.()[0]??e.target))return;if(e.preventDefault(),t===`ArrowRight`)this._move(1);else{let e=this._current;if(!e)throw Error(`<wui-tour> moved back with no step showing`);e.index>this._firstIndex&&this._move(-1)}}else if(e.key===`Tab`&&!this._shadow){let t=this._current,n=this._card;if(!t||!n)throw Error(`<wui-tour> cycled focus with no step showing`);le(e,{card:n,active:this._active(),step:this._stepAt(t.index),target:t.target})}}_teardown(){if(!this._layer)return;this._onKey&&document.removeEventListener(`keydown`,this._onKey,!0),this._onFocusIn&&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;let t=this._outer;if((0,n.unbindReanchor)(t),!t)throw Error(`<wui-tour> has a layer with no host to remove`);ge(t),document.documentElement.removeAttribute(U),this._outer=null,this._shadow=null,this._layer=null,this._current=null;let r=this._returnFocus;this._returnFocus=null,e&&r?.isConnected&&(r instanceof HTMLElement||r instanceof SVGElement)&&r.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();let o=e===`next`?`finished`:e,s=!1;try{n===this._run&&await(a??this._markSeen(o)),s=n===this._run}finally{this._finish(e,i,t)}return s}_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}}))}};(0,t.defineElement)(`wui-tour`,at),e.WuiTour=at})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.anchorOverlay,WeborityUiElementsInternal.modules.buttonClass,WeborityUiElementsInternal.modules.dom,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.nativeOverlay,WeborityUiElementsInternal.modules.rtl,WeborityUiElementsInternal.modules.textStore,WeborityUiElementsInternal.modules.imeSafeEnter,WeborityUiElementsInternal.modules.svgNodes);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t,n,r,i,a,o,s,c,l){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var u=globalThis.WeborityUiElementsInternal?.version;if(u!==`0.174.0`)throw Error(`[webority-ui] tree-picker expects ui-elements 0.174.0 but the page loaded `+u+`.`);var d={chosenTitle:`Chosen`,clearAllLabel:`Clear all`,emptyText:`Tick items in the tree.`,emptyTitle:`Nothing chosen yet`,noMatchText:`No matches for "{query}"`,removeLabel:`Remove {name}`,searchLabel:`Search`,searchPlaceholder:`Search`,selectedText:`{n} selected`},f={type:`none`},p={type:`open`},m=229;function h(e,t){switch(e.key){case`ArrowDown`:case`ArrowUp`:case`Enter`:case` `:return p;case`Backspace`:return t.searchEmpty&&t.mode===`multiple`?{type:`removeLastChip`}:f;default:return f}}function g(e,t){let n=t.row,r=n!==null&&!n.hasChildren,i=n!==null&&!n.disabled;switch(e.key){case`ArrowDown`:return{type:`move`,to:`next`};case`ArrowUp`:return{type:`move`,to:`prev`};case`Home`:return{type:`move`,to:`first`};case`End`:return{type:`move`,to:`last`};case`ArrowRight`:return n===null||!n.hasChildren?f:t.expanded?{type:`focusFirstChild`}:{type:`expand`};case`ArrowLeft`:return n?.hasChildren===!0&&t.expanded?{type:`collapse`}:t.hasParent?{type:`focusParent`}:f;case` `:return i?t.mode===`multiple`?{type:`toggle`}:r?{type:`choose`}:f:f;case`Enter`:return i?t.mode===`multiple`?{type:`toggle`}:r?{type:`choose`}:f:f;case`Escape`:return{type:`close`};default:{let t=e.ctrlKey!==!0&&e.metaKey!==!0&&e.altKey!==!0;return e.key.length===1&&t?{type:`typeahead`,char:e.key}:f}}}function _(e,t){return e.isComposing===!0||e.keyCode===m?f:t.open?g(e,t):h(e,t)}var v=new WeakMap;function y(e){e.replaceChildren(),e.classList.add(`wui-tree-picker`);let t=(0,c.make)(`div`,{class:`search-wrap`},(0,l.glyphNode)(`search`,{size:18,className:`search-icon`})),n=(0,c.make)(`input`,{class:`input search-input wui-tree-picker-search`,type:`search`,"data-wui-action":`search`,autocomplete:`off`});t.append(n);let r=(0,c.make)(`ul`,{class:`wui-tree-picker-tree`,role:`tree`}),i=(0,c.make)(`p`,{class:`wui-tree-picker-nomatch`,role:`presentation`});i.hidden=!0;let a=(0,c.make)(`div`,{class:`wui-tree-picker-pane`});a.append(t,r,i);let o=(0,c.make)(`span`,{class:`wui-tree-picker-title`}),u=(0,c.make)(`span`,{class:`badge`}),d=(0,c.make)(`button`,{class:(0,s.buttonClass)(`neutral`,`ghost`,`sm`),type:`button`,"data-wui-action":`clear`}),f=(0,c.make)(`div`,{class:`wui-tree-picker-rail-head`}),p=(0,c.make)(`span`,{class:`d-inline-flex align-items-center gap-2`});p.append(o,u),f.append(p,d);let m=(0,c.make)(`div`,{class:`wui-tree-picker-rail-body`}),h=(0,c.make)(`div`,{class:`visually-hidden`,role:`status`,"aria-live":`polite`}),g=(0,c.make)(`div`,{class:`wui-tree-picker-rail`});g.append(f,m,h);let _=(0,c.make)(`div`,{class:`wui-tree-picker-surface`});return _.append(a,g),e.append(_),{surface:_,search:n,tree:r,noMatch:i,title:o,count:u,clear:d,body:m,status:h}}function b(e,t){let n=t.selection===`multiple`,r=new Map,i=[];for(let e of t.rows){let a=t.checkOf(e),o=(0,c.make)(`li`,{class:`wui-tree-picker-item`,role:`treeitem`,tabindex:e.id===t.focusId?0:-1,"aria-level":e.level+1,"aria-labelledby":`${t.uid}-${e.index}`,"data-id":e.id}),s=t.expanded.has(e.id);e.hasChildren&&o.setAttribute(`aria-expanded`,String(s)),(e.disabled||t.disabled)&&o.setAttribute(`aria-disabled`,`true`),n?o.setAttribute(`aria-checked`,a===`mixed`?`mixed`:String(a===`checked`)):o.setAttribute(`aria-selected`,String(!e.hasChildren&&a===`checked`));let u=(0,c.make)(`div`,{class:`wui-tree-picker-row`,role:`presentation`});if(u.style.setProperty(`--wui-tree-picker-level`,String(e.level)),e.hasChildren){let t=(0,c.make)(`button`,{class:`wui-tree-picker-toggle`,type:`button`,tabindex:-1,"aria-hidden":`true`,"data-wui-action":`expand`,"data-id":e.id},(0,l.glyphNode)(`chevron-right`,{size:16}));u.append(t)}else u.append((0,c.make)(`span`,{class:`wui-tree-picker-toggle`,"aria-hidden":`true`}));if(n){let n=(0,c.make)(`input`,{class:`form-check-input wui-tree-picker-check`,type:`checkbox`,tabindex:-1,"aria-hidden":`true`,"data-wui-action":`pick`,"data-id":e.id});n.checked=a===`checked`,n.indeterminate=a===`mixed`,n.disabled=e.disabled||t.disabled,u.append(n)}if(e.icon){let t=(0,c.make)(`span`,{class:`wui-tree-icon`,"aria-hidden":`true`},(0,l.glyphNode)(e.icon,{size:16}));u.append(t)}let d=(0,c.make)(`span`,{class:`wui-tree-picker-label`,id:`${t.uid}-${e.index}`,"data-wui-action":`pick`,"data-id":e.id});if(d.textContent=e.label,u.append(d),o.append(u),e.hasChildren&&s){let t=(0,c.make)(`ul`,{class:`wui-tree-picker-group`,role:`group`});o.append(t),r.set(e.id,t)}let f=e.parentId===null?void 0:r.get(e.parentId);f?f.append(o):i.push(o)}e.tree.replaceChildren(...i),n?e.tree.setAttribute(`aria-multiselectable`,`true`):e.tree.removeAttribute(`aria-multiselectable`)}function x(e,t){let n=(0,c.make)(`li`,{class:`wui-tree-picker-chosen-row`}),r=(0,c.make)(`span`,{class:`wui-tree-picker-chosen-label`});r.textContent=t.label;let i=(0,c.make)(`button`,{class:`btn btn-link btn-sm wui-tree-picker-remove`,type:`button`,"aria-label":(0,o.fillText)(e.text.removeLabel,{name:t.label}),"data-wui-action":`remove`,"data-id":t.id},(0,l.glyphNode)(`x`,{size:14}));return i.disabled=e.disabled,n.append(r,i),n}function S(e,t){let{text:n}=t;if(e.title.textContent=n.chosenTitle,e.count.textContent=String(t.chosen.length),e.clear.textContent=n.clearAllLabel,e.clear.disabled=t.disabled||t.chosen.length===0,t.chosen.length===0){let t=(0,c.make)(`div`,{class:`wui-tree-picker-empty`}),r=(0,c.make)(`div`,{class:`fw-semibold`});r.textContent=n.emptyTitle;let i=(0,c.make)(`div`,{class:`small text-body-secondary`});i.textContent=n.emptyText,t.append(r,i),e.body.replaceChildren(t);return}let r=new Map;for(let e of t.chosen){let t=e.group??``,n=r.get(t)??{label:e.group,items:[]};n.items.push(e),r.set(t,n)}let i=[];for(let e of r.values()){let n=(0,c.make)(`div`,{class:`wui-tree-picker-chosen-group`});if(e.label!==null){let t=(0,c.make)(`div`,{class:`small text-body-secondary`});t.textContent=e.label,n.append(t)}let r=(0,c.make)(`ul`,{class:`list-unstyled m-0`});r.append(...e.items.map(e=>x(t,e))),n.append(r),i.push(n)}e.body.replaceChildren(...i)}function C(e){let t=document.activeElement;if(t===e.clear)return`clear`;if(!(t instanceof HTMLButtonElement))return null;let n=[...e.body.querySelectorAll(`[data-wui-action='remove']`)].indexOf(t);return n===-1?null:n}function w(e,t){if(t===null)return;let n=e.body.querySelectorAll(`[data-wui-action='remove']`),r=typeof t==`number`?n[Math.min(t,n.length-1)]:void 0;r?r.focus():e.search.focus()}function T(e,t){let n=v.get(e)??y(e);v.set(e,n);let{text:r}=t;n.surface.classList.toggle(`wui-tree-picker-invalid`,t.invalid),n.search.setAttribute(`aria-label`,r.searchLabel),n.search.placeholder=r.searchPlaceholder,n.search.disabled=t.disabled,n.search.value!==t.query&&(n.search.value=t.query),b(n,t);let i=t.query.trim()!==``;n.noMatch.hidden=!(i&&t.rows.length===0),n.noMatch.textContent=n.noMatch.hidden?``:(0,o.fillText)(r.noMatchText,{query:t.query.trim()});let a=C(n);S(n,t),w(n,a),n.status.textContent=t.status}var E=e=>(e.children?.length??0)>0,D=e=>!E(e)&&e.hasChildren!==!0;function O(e,t,n){let r=[];for(let i of e){if(t.has(i.id))throw Error(`Duplicate tree node id "${i.id}".`);t.add(i.id);let e=D(i)?i.disabled===!0?[]:[i.id]:O(i.children??[],t,n);n.set(i.id,e),r.push(...e)}return r}function k(e,t,n){let r=[],i=(e,a,o)=>{for(let s of e)r.push({id:s.id,label:s.label,icon:s.icon||null,parentId:a,level:o,index:r.length,hasChildren:E(s)||s.hasChildren===!0,disabled:s.disabled===!0,leafIds:t.get(s.id)??[]}),E(s)&&n(s.id)&&i(s.children??[],s.id,o+1)};return i(e,null,0),{rows:r,byId:new Map(r.map(e=>[e.id,e]))}}function A(e){let t=new Map;return O(e,new Set,t),{leavesById:t}}function j(e,t){let{leavesById:n}=A(e);return k(e,n,e=>t.has(e))}function M(e){let{leavesById:t}=A(e);return k(e,t,()=>!0)}function N(e,t){if(e.leafIds.length===0)return`unchecked`;let n=0;for(let r of e.leafIds)t.has(r)&&(n+=1);return n===0?`unchecked`:n===e.leafIds.length?`checked`:`mixed`}function P(e,t){let n=e.byId.get(t);if(n===void 0)throw Error(`Unknown tree node id "${t}".`);return n}function F(e,t,n,r){let i=P(M(e),r),a=[...n];if(t===`single`)return i.hasChildren||i.disabled?a:[r];if(!i.hasChildren)return i.disabled?a:a.includes(r)?a.filter(e=>e!==r):[...a,r];if(i.leafIds.length===0)return a;if(N(i,new Set(a))===`checked`){let e=new Set(i.leafIds);return a.filter(t=>!e.has(t))}let o=new Set(a);return[...a,...i.leafIds.filter(e=>!o.has(e))]}function I(e,t){let n=[],r=new Set;for(let i of t){let t=e.byId.get(i);t===void 0||t.hasChildren||r.has(i)||(r.add(i),n.push(t))}return n}function L(e,t){return I(M(e),t).map(e=>e.id)}function R(){return[]}function z(e,t){return e.filter(e=>e!==t)}function B(e,t){return e===`single`?t[0]??``:[...t]}function V(e,t){let n=t.trim().toLowerCase();if(n===``)return{nodes:[...e],expanded:new Set};let r=new Set,i=e=>{if(E(e)){r.add(e.id);for(let t of e.children??[])i(t)}},a=e=>{if(e.label.toLowerCase().includes(n))return i(e),e;let t=(e.children??[]).flatMap(e=>{let t=a(e);return t===null?[]:[t]});return t.length===0?null:(r.add(e.id),{...e,children:t})};return{nodes:e.flatMap(e=>{let t=a(e);return t===null?[]:[t]}),expanded:r}}var H=[`nodes`,`values`,`selection`,`name`],U={chosenTitle:`chosen-title`,clearAllLabel:`clear-all-label`,emptyTitle:`empty-title`,emptyText:`empty-text`,noMatchText:`no-match-text`,removeLabel:`remove-label`,searchLabel:`search-label`,searchPlaceholder:`search-placeholder`,selectedText:`selected-text`},W=600,G=0;function K(e){return Array.isArray(e)}var q=class extends r.ElementBase{_uid;_nodes;_hasNodes;_valuesSet;_pending;_values;_expanded;_query;_focusId;_rows;_ready;_typed;_unsubscribe;_onClick;_onInput;_onKeyDown;_onFocusIn;static get observedAttributes(){return[`selection`,`name`,`disabled`,`invalid`,`aria-label`,`aria-labelledby`,...Object.values(U)]}constructor(){super(),this._uid=`wui-tree-picker-${++G}`,this._nodes=[],this._hasNodes=!1,this._valuesSet=!1,this._pending=null,this._values=[],this._expanded=new Set,this._query=``,this._focusId=null,this._rows=[],this._ready=!1,this._typed={text:``,at:0},this._unsubscribe=null,this._onClick=e=>this._handleClick(e),this._onInput=e=>this._handleInput(e),this._onKeyDown=e=>this._handleKeyDown(e),this._onFocusIn=e=>{let t=this._rowIdFrom(e.target);t!==null&&t!==this._focusId&&this._setRoving(t)}}connectedCallback(){let e=new Map;for(let t of H)Object.hasOwn(this,t)&&(e.set(t,Reflect.get(this,t)),Reflect.deleteProperty(this,t));if(!this._ready){this._ready=!0;let e=this._readScript();e&&this._adopt(e)}for(let[t,n]of e)Reflect.set(this,t,n);!this._valuesSet&&this._pending===null&&this.hasAttribute(`values`)&&(this._pending=this._readValuesAttribute(),this._hasNodes&&this._adopt(this._nodes)),this.addEventListener(`click`,this._onClick),this.addEventListener(`input`,this._onInput),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`focusin`,this._onFocusIn),this._unsubscribe=(0,o.subscribeText)(()=>this._render()),this._render(),this._syncForm()}disconnectedCallback(){this.removeEventListener(`click`,this._onClick),this.removeEventListener(`input`,this._onInput),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`focusin`,this._onFocusIn),this._unsubscribe?.(),this._unsubscribe=null}attributeChangedCallback(e){e===`selection`&&this._normalise(),this._ready&&this.isConnected&&(this._render(),(e===`selection`||e===`name`)&&this._syncForm())}get nodes(){return[...this._nodes]}set nodes(e){this._adopt(e??[]),this._ready&&this.isConnected&&(this._render(),this._syncForm())}get values(){return[...this._values]}set values(e){this._valuesSet=!0,this._pending=null,this._values=(e??[]).map(String),this._normalise(),this._ready&&this.isConnected&&(this._render(),this._syncForm())}get selection(){return this.getAttribute(`selection`)===`single`?`single`:`multiple`}set selection(e){this.setAttribute(`selection`,String(e))}get name(){return this.getAttribute(`name`)}set name(e){e==null?this.removeAttribute(`name`):this.setAttribute(`name`,String(e))}_readScript(){let e=this.querySelector(`:scope > script[type='application/json']`);if(!e)return null;try{let t=JSON.parse(e.textContent??``);return K(t)?t:((0,n.devError)(`[@webority/ui-elements] <wui-tree-picker> JSON nodes must be an array.`),null)}catch(e){return(0,n.devError)(`[@webority/ui-elements] <wui-tree-picker> could not read its JSON nodes:`,e instanceof Error?e.message:void 0),null}}_adopt(e){if(!K(e))throw Error(`<wui-tree-picker> nodes must be an array.`);let t=M(e),n=this._pending!==null&&!this._valuesSet?this._checkInitial(t.byId,this._pending):null;this._nodes=e,this._hasNodes=!0,n!==null&&(this._values=n,this._pending=null),this._normalise();let r=new Set(M(e).rows.map(e=>e.id));for(let e of[...this._expanded])r.has(e)||this._expanded.delete(e);this._focusId!==null&&!r.has(this._focusId)&&(this._focusId=null)}_readValuesAttribute(){let e=this.getAttribute(`values`)??``,t;try{t=JSON.parse(e)}catch{throw Error(`<wui-tree-picker> values must be a JSON array of leaf ids, got ${e}.`)}if(!Array.isArray(t)||!t.every(e=>typeof e==`string`))throw Error(`<wui-tree-picker> values must be a JSON array of leaf ids, got ${e}.`);if(this.selection===`single`&&t.length>1)throw Error(`<wui-tree-picker> single selection takes one value, got ${t.length}.`);return t}_checkInitial(e,t){for(let n of t){let t=e.get(n);if(t===void 0||t.hasChildren)throw Error(`<wui-tree-picker> values id "${n}" is not a leaf of the tree.`)}return[...new Set(t)]}_normalise(){if(!this._hasNodes)return;let e=L(this._nodes,this._values);this._values=this.selection===`single`?e.slice(0,1):e}_text(){let e=(0,o.readText)(`treePicker`,d),t=t=>this.getAttribute(U[t])??e[t];return{chosenTitle:t(`chosenTitle`),clearAllLabel:t(`clearAllLabel`),emptyTitle:t(`emptyTitle`),emptyText:t(`emptyText`),noMatchText:t(`noMatchText`),removeLabel:t(`removeLabel`),searchLabel:t(`searchLabel`),searchPlaceholder:t(`searchPlaceholder`),selectedText:t(`selectedText`)}}_visible(){let e=V(this._nodes,this._query),t=new Set(this._expanded);for(let n of e.expanded)t.add(n);return j(e.nodes,t).rows}_isOpen(e){return this._expanded.has(e)?!0:this._query.trim()!==``&&V(this._nodes,this._query).expanded.has(e)}_render(){if(!this._ready)return;let e=document.activeElement,t=e instanceof HTMLElement&&this.contains(e)&&e.getAttribute(`role`)===`treeitem`,n=V(this._nodes,this._query),r=new Set(this._expanded);for(let e of n.expanded)r.add(e);let i=j(n.nodes,r).rows;this._rows=i,i.some(e=>e.id===this._focusId)||(this._focusId=i[0]?.id??null);let a=new Set(this._values),s=new Map(M(this._nodes).rows.map(e=>[e.id,e])),c=this._values.flatMap(e=>{let t=s.get(e);if(t===void 0)return[];let n=t.parentId===null?void 0:s.get(t.parentId);return[{id:e,label:t.label,group:n?.label??null}]}),l=this._text();T(this,{rows:i,checkOf:e=>N(s.get(e.id)??e,a),focusId:this._focusId,expanded:r,query:this._query,chosen:c,selection:this.selection,disabled:this.hasAttribute(`disabled`),invalid:this.hasAttribute(`invalid`),status:(0,o.fillText)(l.selectedText,{n:c.length}),text:l,uid:this._uid});let u=this.querySelector(`[role='tree']`),d=this.getAttribute(`aria-label`),f=d?null:this.getAttribute(`aria-labelledby`);d?u?.setAttribute(`aria-label`,d):u?.removeAttribute(`aria-label`),f?u?.setAttribute(`aria-labelledby`,f):u?.removeAttribute(`aria-labelledby`),t&&this._focusRow(this._focusId)}_syncForm(){(0,i.syncFormMirrors)(this,this._values)}_emit(){this.dispatchEvent(new CustomEvent(`wui-tree-picker:change`,{detail:{values:[...this._values],value:B(this.selection,this._values)},bubbles:!0,composed:!0}))}_commit(e){let t=L(this._nodes,e);t.length===this._values.length&&t.every((e,t)=>e===this._values[t])||(this._values=t,this._render(),this._syncForm(),this._emit())}_rowItems(){return[...this.querySelectorAll(`[role='treeitem']`)]}_rowEl(e){return e===null?void 0:this._rowItems().find(t=>t.dataset.id===e)}_rowIdFrom(e){return!(e instanceof HTMLElement)||e.getAttribute(`role`)!==`treeitem`?null:e.dataset.id??null}_setRoving(e){let t=this._rowEl(this._focusId);t&&(t.tabIndex=-1),this._focusId=e;let n=this._rowEl(e);n&&(n.tabIndex=0)}_focusRow(e){e!==null&&(this._setRoving(e),this._rowEl(e)?.focus())}_pick(e){let t=this._rows.find(t=>t.id===e);t!==void 0&&(this._setRoving(e),this.selection===`single`&&t.hasChildren?this._toggleOpen(e):(this._commit(F(this._nodes,this.selection,this._values,e)),this._focusRow(e)))}_toggleOpen(e){this._expanded.has(e)?this._expanded.delete(e):this._expanded.add(e),this._render()}_handleClick(e){if(this.hasAttribute(`disabled`))return;let t=e.target;if(!(t instanceof Element))return;let n=t.closest(`[data-wui-action]`);if(!n||!this.contains(n))return;let r=n.dataset.id??``;switch(n.dataset.wuiAction){case`expand`:this._setRoving(r),this._toggleOpen(r),this._focusRow(r);break;case`pick`:this._pick(r);break;case`remove`:n.focus(),this._commit(z(this._values,r));break;case`clear`:n.focus(),this._commit(R())}}_handleInput(e){if(this.hasAttribute(`disabled`))return;let t=e.target;t instanceof HTMLInputElement&&t.dataset.wuiAction===`search`&&(this._query=t.value,this._render())}_handleKeyDown(e){if(this.hasAttribute(`disabled`))return;let t=e.target;if(!(t instanceof HTMLElement))return;let n={key:(0,a.mirrorKey)(e.key,(0,a.isRtl)(this)),shiftKey:e.shiftKey,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,isComposing:e.isComposing,keyCode:e.keyCode};if(t instanceof HTMLInputElement&&t.dataset.wuiAction===`search`){this._searchKey(e,n);return}let r=this._rowIdFrom(t);if(r===null)return;let i=this._rows.find(e=>e.id===r);if(i===void 0)return;let o=_(n,{mode:this.selection,open:!0,searchEmpty:this._query===``,row:i,expanded:i.hasChildren&&this._isOpen(r),hasParent:i.parentId!==null});if(o.type!==`none`&&o.type!==`open`&&o.type!==`close`)switch(e.preventDefault(),o.type){case`move`:this._move(i,o.to);break;case`expand`:this._expanded.add(r),this._render();break;case`collapse`:this._expanded.delete(r),this._render();break;case`focusParent`:this._focusRow(i.parentId);break;case`focusFirstChild`:{let e=this._rows[i.index+1];e?.parentId===r&&this._focusRow(e.id);break}case`toggle`:case`choose`:this._pick(r);break;case`removeLastChip`:{let e=this._values[this._values.length-1];e!==void 0&&this._commit(z(this._values,e));break}case`typeahead`:this._typeahead(i,o.char)}}_searchKey(e,t){let n=_(t,{mode:this.selection,open:!1,searchEmpty:this._query===``,row:null,expanded:!1,hasParent:!1});if(n.type===`removeLastChip`){let t=this._values[this._values.length-1];if(t===void 0)return;e.preventDefault(),this._commit(z(this._values,t))}else n.type===`open`&&(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),this._focusRow(this._focusId??this._rows[0]?.id??null))}_move(e,t){let n=this._rows,r=t===`first`?n[0]:t===`last`?n[n.length-1]:n[e.index+(t===`next`?1:-1)];r&&this._focusRow(r.id)}_typeahead(e,t){let n=Date.now(),r=n-this._typed.at>W?t:this._typed.text+t;this._typed={text:r,at:n};let i=r.toLowerCase(),a=this._rows,o=r.length===1?e.index+1:e.index;for(let e=0;e<a.length;e++){let t=a[(o+e)%a.length];if(t?.label.toLowerCase().startsWith(i)){this._focusRow(t.id);return}}}};(0,t.defineElement)(`wui-tree-picker`,q),e.WuiTreePicker=q})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.devWarn,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.formMirror,WeborityUiElementsInternal.modules.rtl,WeborityUiElementsInternal.modules.textStore,WeborityUiElementsInternal.modules.buttonClass,WeborityUiElementsInternal.modules.dom,WeborityUiElementsInternal.modules.iconGlyphs);
|
|
1
|
+
(function(e,t,n,r,i,a,o,s,c,l,u,d){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var f=globalThis.WeborityUiElementsInternal?.version;if(f!==`0.175.0`)throw Error(`[webority-ui] tree-picker expects ui-elements 0.175.0 but the page loaded `+f+`.`);var p={chosenTitle:`Chosen`,clearAllLabel:`Clear all`,emptyText:`Tick items in the tree.`,emptyTitle:`Nothing chosen yet`,noMatchText:`No matches for "{query}"`,removeLabel:`Remove {name}`,searchLabel:`Search`,searchPlaceholder:`Search`,selectedText:`{n} selected`},m={type:`none`},h={type:`open`};function g(e,t){switch(e.key){case`ArrowDown`:case`ArrowUp`:case`Enter`:case` `:return h;case`Backspace`:return t.searchEmpty&&t.mode===`multiple`?{type:`removeLastChip`}:m;default:return m}}function _(e,t){let n=t.row,r=n!==null&&!n.hasChildren,i=n!==null&&!n.disabled;switch(e.key){case`ArrowDown`:return{type:`move`,to:`next`};case`ArrowUp`:return{type:`move`,to:`prev`};case`Home`:return{type:`move`,to:`first`};case`End`:return{type:`move`,to:`last`};case`ArrowRight`:return n===null||!n.hasChildren?m:t.expanded?{type:`focusFirstChild`}:{type:`expand`};case`ArrowLeft`:return n?.hasChildren===!0&&t.expanded?{type:`collapse`}:t.hasParent?{type:`focusParent`}:m;case` `:return i?t.mode===`multiple`?{type:`toggle`}:r?{type:`choose`}:m:m;case`Enter`:return i?t.mode===`multiple`?{type:`toggle`}:r?{type:`choose`}:m:m;case`Escape`:return{type:`close`};default:{let t=e.ctrlKey!==!0&&e.metaKey!==!0&&e.altKey!==!0;return e.key.length===1&&t?{type:`typeahead`,char:e.key}:m}}}function v(e,t){return(0,o.isImeComposing)(e)?m:t.open?_(e,t):g(e,t)}var y=new WeakMap;function b(e){e.replaceChildren(),e.classList.add(`wui-tree-picker`);let t=(0,u.make)(`div`,{class:`search-wrap`},(0,d.glyphNode)(`search`,{size:18,className:`search-icon`})),n=(0,u.make)(`input`,{class:`input search-input wui-tree-picker-search`,type:`search`,"data-wui-action":`search`,autocomplete:`off`});t.append(n);let r=(0,u.make)(`ul`,{class:`wui-tree-picker-tree`,role:`tree`}),i=(0,u.make)(`p`,{class:`wui-tree-picker-nomatch`,role:`presentation`});i.hidden=!0;let a=(0,u.make)(`div`,{class:`wui-tree-picker-pane`});a.append(t,r,i);let o=(0,u.make)(`span`,{class:`wui-tree-picker-title`}),s=(0,u.make)(`span`,{class:`badge`}),c=(0,u.make)(`button`,{class:(0,l.buttonClass)(`neutral`,`ghost`,`sm`),type:`button`,"data-wui-action":`clear`}),f=(0,u.make)(`div`,{class:`wui-tree-picker-rail-head`}),p=(0,u.make)(`span`,{class:`d-inline-flex align-items-center gap-2`});p.append(o,s),f.append(p,c);let m=(0,u.make)(`div`,{class:`wui-tree-picker-rail-body`}),h=(0,u.make)(`div`,{class:`visually-hidden`,role:`status`,"aria-live":`polite`}),g=(0,u.make)(`div`,{class:`wui-tree-picker-rail`});g.append(f,m,h);let _=(0,u.make)(`div`,{class:`wui-tree-picker-surface`});return _.append(a,g),e.append(_),{surface:_,search:n,tree:r,noMatch:i,title:o,count:s,clear:c,body:m,status:h}}function x(e,t){let n=t.selection===`multiple`,r=new Map,i=[];for(let e of t.rows){let a=t.checkOf(e),o=(0,u.make)(`li`,{class:`wui-tree-picker-item`,role:`treeitem`,tabindex:e.id===t.focusId?0:-1,"aria-level":e.level+1,"aria-labelledby":`${t.uid}-${e.index}`,"data-id":e.id}),s=t.expanded.has(e.id);e.hasChildren&&o.setAttribute(`aria-expanded`,String(s)),(e.disabled||t.disabled)&&o.setAttribute(`aria-disabled`,`true`),n?o.setAttribute(`aria-checked`,a===`mixed`?`mixed`:String(a===`checked`)):o.setAttribute(`aria-selected`,String(!e.hasChildren&&a===`checked`));let c=(0,u.make)(`div`,{class:`wui-tree-picker-row`,role:`presentation`});if(c.style.setProperty(`--wui-tree-picker-level`,String(e.level)),e.hasChildren){let t=(0,u.make)(`button`,{class:`wui-tree-picker-toggle`,type:`button`,tabindex:-1,"aria-hidden":`true`,"data-wui-action":`expand`,"data-id":e.id},(0,d.glyphNode)(`chevron-right`,{size:16}));c.append(t)}else c.append((0,u.make)(`span`,{class:`wui-tree-picker-toggle`,"aria-hidden":`true`}));if(n){let n=(0,u.make)(`input`,{class:`form-check-input wui-tree-picker-check`,type:`checkbox`,tabindex:-1,"aria-hidden":`true`,"data-wui-action":`pick`,"data-id":e.id});n.checked=a===`checked`,n.indeterminate=a===`mixed`,n.disabled=e.disabled||t.disabled,c.append(n)}if(e.icon){let t=(0,u.make)(`span`,{class:`wui-tree-icon`,"aria-hidden":`true`},(0,d.glyphNode)(e.icon,{size:16}));c.append(t)}let l=(0,u.make)(`span`,{class:`wui-tree-picker-label`,id:`${t.uid}-${e.index}`,"data-wui-action":`pick`,"data-id":e.id});if(l.textContent=e.label,c.append(l),o.append(c),e.hasChildren&&s){let t=(0,u.make)(`ul`,{class:`wui-tree-picker-group`,role:`group`});o.append(t),r.set(e.id,t)}let f=e.parentId===null?void 0:r.get(e.parentId);f?f.append(o):i.push(o)}e.tree.replaceChildren(...i),n?e.tree.setAttribute(`aria-multiselectable`,`true`):e.tree.removeAttribute(`aria-multiselectable`)}function S(e,t){let n=(0,u.make)(`li`,{class:`wui-tree-picker-chosen-row`}),r=(0,u.make)(`span`,{class:`wui-tree-picker-chosen-label`});r.textContent=t.label;let i=(0,u.make)(`button`,{class:`btn btn-link btn-sm wui-tree-picker-remove`,type:`button`,"aria-label":(0,c.fillText)(e.text.removeLabel,{name:t.label}),"data-wui-action":`remove`,"data-id":t.id},(0,d.glyphNode)(`x`,{size:14}));return i.disabled=e.disabled,n.append(r,i),n}function C(e,t){let{text:n}=t;if(e.title.textContent=n.chosenTitle,e.count.textContent=String(t.chosen.length),e.clear.textContent=n.clearAllLabel,e.clear.disabled=t.disabled||t.chosen.length===0,t.chosen.length===0){let t=(0,u.make)(`div`,{class:`wui-tree-picker-empty`}),r=(0,u.make)(`div`,{class:`fw-semibold`});r.textContent=n.emptyTitle;let i=(0,u.make)(`div`,{class:`small text-body-secondary`});i.textContent=n.emptyText,t.append(r,i),e.body.replaceChildren(t);return}let r=new Map;for(let e of t.chosen){let t=e.group??``,n=r.get(t)??{label:e.group,items:[]};n.items.push(e),r.set(t,n)}let i=[];for(let e of r.values()){let n=(0,u.make)(`div`,{class:`wui-tree-picker-chosen-group`});if(e.label!==null){let t=(0,u.make)(`div`,{class:`small text-body-secondary`});t.textContent=e.label,n.append(t)}let r=(0,u.make)(`ul`,{class:`list-unstyled m-0`});r.append(...e.items.map(e=>S(t,e))),n.append(r),i.push(n)}e.body.replaceChildren(...i)}function w(e){let t=document.activeElement;if(t===e.clear)return`clear`;if(!(t instanceof HTMLButtonElement))return null;let n=[...e.body.querySelectorAll(`[data-wui-action='remove']`)].indexOf(t);return n===-1?null:n}function T(e,t){if(t===null)return;let n=e.body.querySelectorAll(`[data-wui-action='remove']`),r=typeof t==`number`?n[Math.min(t,n.length-1)]:void 0;r?r.focus():e.search.focus()}function E(e,t){let n=y.get(e)??b(e);y.set(e,n);let{text:r}=t;n.surface.classList.toggle(`wui-tree-picker-invalid`,t.invalid),n.search.setAttribute(`aria-label`,r.searchLabel),n.search.placeholder=r.searchPlaceholder,n.search.disabled=t.disabled,n.search.value!==t.query&&(n.search.value=t.query),x(n,t);let i=t.query.trim()!==``;n.noMatch.hidden=!(i&&t.rows.length===0),n.noMatch.textContent=n.noMatch.hidden?``:(0,c.fillText)(r.noMatchText,{query:t.query.trim()});let a=w(n);C(n,t),T(n,a),n.status.textContent=t.status}var D=e=>(e.children?.length??0)>0,O=e=>!D(e)&&e.hasChildren!==!0;function k(e,t,n){let r=[];for(let i of e){if(t.has(i.id))throw Error(`Duplicate tree node id "${i.id}".`);t.add(i.id);let e=O(i)?i.disabled===!0?[]:[i.id]:k(i.children??[],t,n);n.set(i.id,e),r.push(...e)}return r}function A(e,t,n){let r=[],i=(e,a,o)=>{for(let s of e)r.push({id:s.id,label:s.label,icon:s.icon||null,parentId:a,level:o,index:r.length,hasChildren:D(s)||s.hasChildren===!0,disabled:s.disabled===!0,leafIds:t.get(s.id)??[]}),D(s)&&n(s.id)&&i(s.children??[],s.id,o+1)};return i(e,null,0),{rows:r,byId:new Map(r.map(e=>[e.id,e]))}}function j(e){let t=new Map;return k(e,new Set,t),{leavesById:t}}function M(e,t){let{leavesById:n}=j(e);return A(e,n,e=>t.has(e))}function N(e){let{leavesById:t}=j(e);return A(e,t,()=>!0)}function P(e,t){if(e.leafIds.length===0)return`unchecked`;let n=0;for(let r of e.leafIds)t.has(r)&&(n+=1);return n===0?`unchecked`:n===e.leafIds.length?`checked`:`mixed`}function F(e,t){let n=e.byId.get(t);if(n===void 0)throw Error(`Unknown tree node id "${t}".`);return n}function I(e,t,n,r){let i=F(N(e),r),a=[...n];if(t===`single`)return i.hasChildren||i.disabled?a:[r];if(!i.hasChildren)return i.disabled?a:a.includes(r)?a.filter(e=>e!==r):[...a,r];if(i.leafIds.length===0)return a;if(P(i,new Set(a))===`checked`){let e=new Set(i.leafIds);return a.filter(t=>!e.has(t))}let o=new Set(a);return[...a,...i.leafIds.filter(e=>!o.has(e))]}function L(e,t){let n=[],r=new Set;for(let i of t){let t=e.byId.get(i);t===void 0||t.hasChildren||r.has(i)||(r.add(i),n.push(t))}return n}function R(e,t){return L(N(e),t).map(e=>e.id)}function z(){return[]}function B(e,t){return e.filter(e=>e!==t)}function V(e,t){return e===`single`?t[0]??``:[...t]}function H(e,t){let n=t.trim().toLowerCase();if(n===``)return{nodes:[...e],expanded:new Set};let r=new Set,i=e=>{if(D(e)){r.add(e.id);for(let t of e.children??[])i(t)}},a=e=>{if(e.label.toLowerCase().includes(n))return i(e),e;let t=(e.children??[]).flatMap(e=>{let t=a(e);return t===null?[]:[t]});return t.length===0?null:(r.add(e.id),{...e,children:t})};return{nodes:e.flatMap(e=>{let t=a(e);return t===null?[]:[t]}),expanded:r}}function U(e){"@babel/helpers - typeof";return U=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},U(e)}function W(e,t){if(U(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(U(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function G(e){var t=W(e,`string`);return U(t)==`symbol`?t:t+``}function K(e,t,n){return(t=G(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var q=[`nodes`,`values`,`selection`,`name`],J={chosenTitle:`chosen-title`,clearAllLabel:`clear-all-label`,emptyTitle:`empty-title`,emptyText:`empty-text`,noMatchText:`no-match-text`,removeLabel:`remove-label`,searchLabel:`search-label`,searchPlaceholder:`search-placeholder`,selectedText:`selected-text`},Y=600,X=0;function Z(e){return Array.isArray(e)}var Q=class extends r.ElementBase{static get observedAttributes(){return[`selection`,`name`,`disabled`,`invalid`,`aria-label`,`aria-labelledby`,...Object.values(J)]}constructor(){super(),K(this,`_uid`,void 0),K(this,`_nodes`,void 0),K(this,`_hasNodes`,void 0),K(this,`_valuesSet`,void 0),K(this,`_pending`,void 0),K(this,`_values`,void 0),K(this,`_expanded`,void 0),K(this,`_query`,void 0),K(this,`_focusId`,void 0),K(this,`_rows`,void 0),K(this,`_ready`,void 0),K(this,`_typed`,void 0),K(this,`_unsubscribe`,void 0),K(this,`_onClick`,void 0),K(this,`_onInput`,void 0),K(this,`_onKeyDown`,void 0),K(this,`_onFocusIn`,void 0),this._uid=`wui-tree-picker-${++X}`,this._nodes=[],this._hasNodes=!1,this._valuesSet=!1,this._pending=null,this._values=[],this._expanded=new Set,this._query=``,this._focusId=null,this._rows=[],this._ready=!1,this._typed={text:``,at:0},this._unsubscribe=null,this._onClick=e=>this._handleClick(e),this._onInput=e=>this._handleInput(e),this._onKeyDown=e=>this._handleKeyDown(e),this._onFocusIn=e=>{let t=this._rowIdFrom(e.target);t!==null&&t!==this._focusId&&this._setRoving(t)}}connectedCallback(){let e=new Map;for(let t of q)(0,a.hasOwn)(this,t)&&(e.set(t,Reflect.get(this,t)),Reflect.deleteProperty(this,t));if(!this._ready){this._ready=!0;let e=this._readScript();e&&this._adopt(e)}for(let[t,n]of e)Reflect.set(this,t,n);!this._valuesSet&&this._pending===null&&this.hasAttribute(`values`)&&(this._pending=this._readValuesAttribute(),this._hasNodes&&this._adopt(this._nodes)),this.addEventListener(`click`,this._onClick),this.addEventListener(`input`,this._onInput),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`focusin`,this._onFocusIn),this._unsubscribe=(0,c.subscribeText)(()=>this._render()),this._render(),this._syncForm()}disconnectedCallback(){this.removeEventListener(`click`,this._onClick),this.removeEventListener(`input`,this._onInput),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`focusin`,this._onFocusIn),this._unsubscribe?.(),this._unsubscribe=null}attributeChangedCallback(e){e===`selection`&&this._normalise(),this._ready&&this.isConnected&&(this._render(),(e===`selection`||e===`name`)&&this._syncForm())}get nodes(){return[...this._nodes]}set nodes(e){this._adopt(e??[]),this._ready&&this.isConnected&&(this._render(),this._syncForm())}get values(){return[...this._values]}set values(e){this._valuesSet=!0,this._pending=null,this._values=(e??[]).map(String),this._normalise(),this._ready&&this.isConnected&&(this._render(),this._syncForm())}get selection(){return this.getAttribute(`selection`)===`single`?`single`:`multiple`}set selection(e){this.setAttribute(`selection`,String(e))}get name(){return this.getAttribute(`name`)}set name(e){e==null?this.removeAttribute(`name`):this.setAttribute(`name`,String(e))}_readScript(){let e=this.querySelector(`:scope > script[type='application/json']`);if(!e)return null;try{let t=JSON.parse(e.textContent??``);return Z(t)?t:((0,n.devError)(`[@webority/ui-elements] <wui-tree-picker> JSON nodes must be an array.`),null)}catch(e){return(0,n.devError)(`[@webority/ui-elements] <wui-tree-picker> could not read its JSON nodes:`,e instanceof Error?e.message:void 0),null}}_adopt(e){if(!Z(e))throw Error(`<wui-tree-picker> nodes must be an array.`);let t=N(e),n=this._pending!==null&&!this._valuesSet?this._checkInitial(t.byId,this._pending):null;this._nodes=e,this._hasNodes=!0,n!==null&&(this._values=n,this._pending=null),this._normalise();let r=new Set(N(e).rows.map(e=>e.id));for(let e of[...this._expanded])r.has(e)||this._expanded.delete(e);this._focusId!==null&&!r.has(this._focusId)&&(this._focusId=null)}_readValuesAttribute(){let e=this.getAttribute(`values`)??``,t;try{t=JSON.parse(e)}catch(t){throw Error(`<wui-tree-picker> values must be a JSON array of leaf ids, got ${e}.`,{cause:t})}if(!Array.isArray(t)||!t.every(e=>typeof e==`string`))throw Error(`<wui-tree-picker> values must be a JSON array of leaf ids, got ${e}.`);if(this.selection===`single`&&t.length>1)throw Error(`<wui-tree-picker> single selection takes one value, got ${t.length}.`);return t}_checkInitial(e,t){for(let n of t){let t=e.get(n);if(t===void 0||t.hasChildren)throw Error(`<wui-tree-picker> values id "${n}" is not a leaf of the tree.`)}return[...new Set(t)]}_normalise(){if(!this._hasNodes)return;let e=R(this._nodes,this._values);this._values=this.selection===`single`?e.slice(0,1):e}_text(){let e=(0,c.readText)(`treePicker`,p),t=t=>this.getAttribute(J[t])??e[t];return{chosenTitle:t(`chosenTitle`),clearAllLabel:t(`clearAllLabel`),emptyTitle:t(`emptyTitle`),emptyText:t(`emptyText`),noMatchText:t(`noMatchText`),removeLabel:t(`removeLabel`),searchLabel:t(`searchLabel`),searchPlaceholder:t(`searchPlaceholder`),selectedText:t(`selectedText`)}}_visible(){let e=H(this._nodes,this._query),t=new Set(this._expanded);for(let n of e.expanded)t.add(n);return M(e.nodes,t).rows}_isOpen(e){return this._expanded.has(e)?!0:this._query.trim()!==``&&H(this._nodes,this._query).expanded.has(e)}_render(){if(!this._ready)return;let e=document.activeElement,t=e instanceof HTMLElement&&this.contains(e)&&e.getAttribute(`role`)===`treeitem`,n=H(this._nodes,this._query),r=new Set(this._expanded);for(let e of n.expanded)r.add(e);let i=M(n.nodes,r).rows;this._rows=i,i.some(e=>e.id===this._focusId)||(this._focusId=i[0]?.id??null);let a=new Set(this._values),o=new Map(N(this._nodes).rows.map(e=>[e.id,e])),s=this._values.flatMap(e=>{let t=o.get(e);if(t===void 0)return[];let n=t.parentId===null?void 0:o.get(t.parentId);return[{id:e,label:t.label,group:n?.label??null}]}),l=this._text();E(this,{rows:i,checkOf:e=>P(o.get(e.id)??e,a),focusId:this._focusId,expanded:r,query:this._query,chosen:s,selection:this.selection,disabled:this.hasAttribute(`disabled`),invalid:this.hasAttribute(`invalid`),status:(0,c.fillText)(l.selectedText,{n:s.length}),text:l,uid:this._uid});let u=this.querySelector(`[role='tree']`),d=this.getAttribute(`aria-label`),f=d?null:this.getAttribute(`aria-labelledby`);d?u?.setAttribute(`aria-label`,d):u?.removeAttribute(`aria-label`),f?u?.setAttribute(`aria-labelledby`,f):u?.removeAttribute(`aria-labelledby`),t&&this._focusRow(this._focusId)}_syncForm(){(0,i.syncFormMirrors)(this,this._values)}_emit(){this.dispatchEvent(new CustomEvent(`wui-tree-picker:change`,{detail:{values:[...this._values],value:V(this.selection,this._values)},bubbles:!0,composed:!0}))}_commit(e){let t=R(this._nodes,e);t.length===this._values.length&&t.every((e,t)=>e===this._values[t])||(this._values=t,this._render(),this._syncForm(),this._emit())}_rowItems(){return[...this.querySelectorAll(`[role='treeitem']`)]}_rowEl(e){return e===null?void 0:this._rowItems().find(t=>t.dataset.id===e)}_rowIdFrom(e){return!(e instanceof HTMLElement)||e.getAttribute(`role`)!==`treeitem`?null:e.dataset.id??null}_setRoving(e){let t=this._rowEl(this._focusId);t&&(t.tabIndex=-1),this._focusId=e;let n=this._rowEl(e);n&&(n.tabIndex=0)}_focusRow(e){e!==null&&(this._setRoving(e),this._rowEl(e)?.focus())}_pick(e){let t=this._rows.find(t=>t.id===e);t!==void 0&&(this._setRoving(e),this.selection===`single`&&t.hasChildren?this._toggleOpen(e):(this._commit(I(this._nodes,this.selection,this._values,e)),this._focusRow(e)))}_toggleOpen(e){this._expanded.has(e)?this._expanded.delete(e):this._expanded.add(e),this._render()}_handleClick(e){if(this.hasAttribute(`disabled`))return;let t=e.target;if(!(t instanceof Element))return;let n=t.closest(`[data-wui-action]`);if(!n||!this.contains(n))return;let r=n.dataset.id??``;switch(n.dataset.wuiAction){case`expand`:this._setRoving(r),this._toggleOpen(r),this._focusRow(r);break;case`pick`:this._pick(r);break;case`remove`:n.focus(),this._commit(B(this._values,r));break;case`clear`:n.focus(),this._commit(z())}}_handleInput(e){if(this.hasAttribute(`disabled`))return;let t=e.target;t instanceof HTMLInputElement&&t.dataset.wuiAction===`search`&&(this._query=t.value,this._render())}_handleKeyDown(e){if(this.hasAttribute(`disabled`))return;let t=e.target;if(!(t instanceof HTMLElement))return;let n={key:(0,s.mirrorKey)(e.key,(0,s.isRtl)(this)),shiftKey:e.shiftKey,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,isComposing:(0,o.isImeComposing)(e)};if(t instanceof HTMLInputElement&&t.dataset.wuiAction===`search`){this._searchKey(e,n);return}let r=this._rowIdFrom(t);if(r===null)return;let i=this._rows.find(e=>e.id===r);if(i===void 0)return;let a=v(n,{mode:this.selection,open:!0,searchEmpty:this._query===``,row:i,expanded:i.hasChildren&&this._isOpen(r),hasParent:i.parentId!==null});if(a.type!==`none`&&a.type!==`open`&&a.type!==`close`)switch(e.preventDefault(),a.type){case`move`:this._move(i,a.to);break;case`expand`:this._expanded.add(r),this._render();break;case`collapse`:this._expanded.delete(r),this._render();break;case`focusParent`:this._focusRow(i.parentId);break;case`focusFirstChild`:{let e=this._rows[i.index+1];e?.parentId===r&&this._focusRow(e.id);break}case`toggle`:case`choose`:this._pick(r);break;case`removeLastChip`:{let e=this._values[this._values.length-1];e!==void 0&&this._commit(B(this._values,e));break}case`typeahead`:this._typeahead(i,a.char)}}_searchKey(e,t){let n=v(t,{mode:this.selection,open:!1,searchEmpty:this._query===``,row:null,expanded:!1,hasParent:!1});if(n.type===`removeLastChip`){let t=this._values[this._values.length-1];if(t===void 0)return;e.preventDefault(),this._commit(B(this._values,t))}else n.type===`open`&&(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),this._focusRow(this._focusId??this._rows[0]?.id??null))}_move(e,t){let n=this._rows,r=t===`first`?n[0]:t===`last`?n[n.length-1]:n[e.index+(t===`next`?1:-1)];r&&this._focusRow(r.id)}_typeahead(e,t){let n=Date.now(),r=n-this._typed.at>Y?t:this._typed.text+t;this._typed={text:r,at:n};let i=r.toLowerCase(),a=this._rows,o=r.length===1?e.index+1:e.index;for(let e=0;e<a.length;e++){let t=a[(o+e)%a.length];if(t?.label.toLowerCase().startsWith(i)){this._focusRow(t.id);return}}}};(0,t.defineElement)(`wui-tree-picker`,Q),e.WuiTreePicker=Q})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.devWarn,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.formMirror,WeborityUiElementsInternal.modules.hasOwn,WeborityUiElementsInternal.modules.imeSafeEnter,WeborityUiElementsInternal.modules.rtl,WeborityUiElementsInternal.modules.textStore,WeborityUiElementsInternal.modules.buttonClass,WeborityUiElementsInternal.modules.dom,WeborityUiElementsInternal.modules.iconGlyphs);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t,n,r,i,a,o,s,c,l,u,d){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var f=globalThis.WeborityUiElementsInternal?.version;if(f!==`0.174.0`)throw Error(`[webority-ui] tree expects ui-elements 0.174.0 but the page loaded `+f+`.`);var p={errorText:`Could not load. Try again.`,loadingText:`Loading`},m=()=>(0,d.readText)(`tree`,p),h=[`none`,`single`,`multiple`],g=e=>h.some(t=>t===e),_=300,v=8,y=300,b=`parentId`,x=`:scope > input[data-wui-mirror]`,S=[`nodes`,`selection`,`selected`,`values`,`loadChildren`,`loadUrl`,`name`],C=0;function w(e){for(let t=e;t&&t!==document.body&&t!==document.documentElement;t=t.parentElement)if(/^(auto|scroll|overlay)$/.test(getComputedStyle(t).overflowY))return t;return null}var T=class extends i.ElementBase{_uid;_seq;_roots;_byId;_prev;_staged;_els;_checked;_selected;_focusId;_loader;_list;_live;_ready;_flat;_win;_rowH;_rowMeasured;_box;_unbind;_frame;_nav;_onKeyDown;_onClick;_onFocusIn;static get observedAttributes(){return[`selection`,`selected`,`name`,`aria-label`,`loading-text`,`error-text`]}constructor(){super(),this._uid=`wui-tree-${++C}`,this._seq=0,this._roots=[],this._byId=new Map,this._prev=null,this._staged=null,this._els=new Map,this._checked=new Set,this._selected=null,this._focusId=null,this._loader=null,this._list=null,this._live=null,this._ready=!1,this._flat=null,this._win=null,this._rowH=l.FALLBACK_ROW_HEIGHT,this._rowMeasured=!1,this._box=null,this._unbind=null,this._frame=0,this._nav=(0,s.createListboxKeyNav)({getVisibleOptions:()=>[...this._els.values()].map(e=>e.row),getActive:()=>this._visible().findIndex(e=>e.id===this._focusId),setActive:e=>this._focusNode(this._visible()[e]),getCount:()=>this._visible().length,getOptionAt:e=>this._els.get(this._visible()[e]?.id??``)?.row,findByPrefix:e=>this._visible().findIndex(t=>t.label.toLowerCase().startsWith(e)),onEnter:()=>{let e=this._focusId===null?void 0:this._byId.get(this._focusId);e&&this._activate(e)}}),this._onKeyDown=e=>this._handleKeyDown(e),this._onClick=e=>this._handleClick(e),this._onFocusIn=e=>{if(e.target===this._list){this._focusNode(this._focusId===null?void 0:this._byId.get(this._focusId));return}let t=this._nodeFrom(e.target);t&&t.id!==this._focusId&&this._setRoving(t)}}connectedCallback(){let e=new Map;for(let t of S)Object.hasOwn(this,t)&&(e.set(t,Reflect.get(this,t)),Reflect.deleteProperty(this,t));if(!this._ready){this._ready=!0;let e=this._readScript();this.replaceChildren(),this._list=(0,r.make)(`ul`,{class:`wui-tree`}),this._list.setAttribute(`role`,`tree`),this._live=(0,r.make)(`div`,{class:`visually-hidden`,role:`status`,"aria-live":`polite`}),this.append(this._list,this._live),e&&this._adoptAll(e)}for(let[t,n]of e)Reflect.set(this,t,n);this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`click`,this._onClick),this.addEventListener(`focusin`,this._onFocusIn),this._render(),this._loadOpenNodes()}disconnectedCallback(){this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`focusin`,this._onFocusIn),this._unbindWindow(),this._nav.teardown()}attributeChangedCallback(e,t,n){e===`selected`&&(this._selected=n),this._ready&&this.isConnected&&this._render()}get nodes(){return this._roots.map(e=>e.raw)}set nodes(e){this._adoptAll(e??[]),this._render(),this._loadOpenNodes()}get selection(){let e=this.getAttribute(`selection`);return g(e)?e:`none`}set selection(e){this.setAttribute(`selection`,String(e))}get selected(){return this._selected}set selected(e){this._selected=e==null?null:String(e),this._render()}get values(){let e=[],t=n=>{for(let r of n)this._state(r)===`checked`&&e.push(r.id),r.children&&t(r.children)};return t(this._roots),[...e,...[...this._checked].filter(e=>!this._byId.has(e))]}set values(e){this._checked.clear();for(let t of e??[]){let e=this._byId.get(String(t));e?this._setChecked(e,!0):this._checked.add(String(t))}this._render()}get loadChildren(){return this._loader}set loadChildren(e){this._loader=typeof e==`function`?e:null}get loadUrl(){return this.getAttribute(`load-url`)}set loadUrl(e){e==null?this.removeAttribute(`load-url`):this.setAttribute(`load-url`,String(e))}get name(){return this.getAttribute(`name`)}set name(e){e==null?this.removeAttribute(`name`):this.setAttribute(`name`,String(e))}get loadingText(){return this.getAttribute(`loading-text`)??m().loadingText}set loadingText(e){this.setAttribute(`loading-text`,String(e??``))}get errorText(){return this.getAttribute(`error-text`)??m().errorText}set errorText(e){this.setAttribute(`error-text`,String(e??``))}_readScript(){let e=this.querySelector(`:scope > script[type='application/json']`);if(!e)return null;try{return JSON.parse(e.textContent??``)}catch(e){return(0,n.devError)(`[@webority/ui-elements] <wui-tree> could not read its JSON nodes:`,e instanceof Error?e.message:void 0),null}}_adoptAll(e){this._flat=null;let t=this._byId;this._prev=t,this._byId=new Map;let n;try{n=this._adoptStaged(e,null,1)}catch(e){throw this._byId=t,e}finally{this._prev=null}this._roots=n;for(let e of t.keys())this._byId.has(e)||this._checked.delete(e);for(let e of this._roots)this._passChecksDown(e);this._focusId&&!this._byId.has(this._focusId)&&(this._focusId=null)}_adoptStaged(e,t,n){let r=[],i=[];this._staged={ids:r,checks:i};try{let r=this._adopt(e,t,n);for(let e of i)this._checked.add(e);return r}catch(e){for(let e of r)this._byId.delete(e);throw e}finally{this._staged=null}}_adopt(e,t,n){if(!Array.isArray(e))throw Error(`<wui-tree> nodes must be an array.`);return e.map((e,r)=>{let i=e?.id==null?``:String(e.id);if(!i)throw Error(`<wui-tree> every node needs an id.`);if(this._byId.has(i))throw Error(`<wui-tree> node id "${i}" is used twice.`);let a=this._prev?.get(i),o={id:i,raw:e,parent:t,level:n,seq:++this._seq,pos:r,label:e.label==null?i:String(e.label),icon:e.icon||null,badge:e.badge==null||e.badge===``?null:String(e.badge),badgeTone:e.badgeTone||null,disabled:!!e.disabled,hasChildren:!!e.hasChildren,children:null,expanded:a?a.expanded:!!e.expanded,loading:!1,failed:!1};this._byId.set(i,o),this._staged?.ids.push(i);let s=e.children??(e.hasChildren?a?.children?.map(e=>e.raw):void 0);return Array.isArray(s)&&(o.children=this._adopt(s,o,n+1)),o.loading=!!a?.loading&&o.children===null&&o.hasChildren,e.checked&&!a&&this._staged?.checks.push(i),o})}_passChecksDown(e){e.children?.length&&this._checked.has(e.id)&&(this._checked.delete(e.id),this._setChecked(e,!0));for(let t of e.children??[])this._passChecksDown(t)}_loadOpenNodes(){queueMicrotask(()=>{if(this.isConnected)for(let e of[...this._byId.values()])e.expanded&&e.children===null&&e.hasChildren&&!e.loading&&this._load(e)})}_isBranch(e){return e.children?e.children.length>0:e.hasChildren}_visible(){if(this._flat)return this._flat;let e=[],t=n=>{for(let r of n)e.push(r),r.expanded&&r.children&&t(r.children)};return t(this._roots),this._flat=e,e}_state(e){if(e.children?.length){let t=0,n=0;for(let r of e.children){let e=this._state(r);e===`checked`?t++:e===`unchecked`&&n++}return t===e.children.length?`checked`:n===e.children.length?`unchecked`:`mixed`}return this._checked.has(e.id)?`checked`:`unchecked`}_setChecked(e,t){if(e.children?.length)for(let n of e.children)n.disabled||this._setChecked(n,t);else t?this._checked.add(e.id):this._checked.delete(e.id)}_nodeFrom(e){if(!(e instanceof Element))return null;let t=e.closest(`li.wui-tree-item`);if(!t)return null;for(let[e,n]of this._els)if(n.li===t)return this._byId.get(e)??null;return null}_emit(e,t){this.dispatchEvent(new CustomEvent(`wui-tree:${e}`,{detail:t,bubbles:!0,composed:!0}))}_announce(e){this._live&&(this._live.textContent=e)}_setRoving(e){let t=this._focusId===null?void 0:this._els.get(this._focusId);t&&(t.li.tabIndex=-1),this._focusId=e.id;let n=this._els.get(e.id);n&&(n.li.tabIndex=0),this._syncTab()}_syncTab(){this._list&&(this._focusId!==null&&!this._els.has(this._focusId)?this._list.tabIndex=0:this._list.removeAttribute(`tabindex`))}_focusNode(e){e&&(this._win&&!this._els.has(e.id)&&this._reveal(e),this._setRoving(e),this._els.get(e.id)?.li.focus())}_activate(e){e.disabled||(this.selection===`single`&&(this._selected=e.id,this._render(),this._syncForm()),this._emit(`select`,{id:e.id,node:e.raw}))}_enabledLeaves(e){return e.disabled?[]:e.children?.length?e.children.flatMap(e=>this._enabledLeaves(e)):[e]}_toggleCheck(e){let t=this._enabledLeaves(e);if(!t.length)return;let n=!t.every(e=>this._checked.has(e.id));this._setChecked(e,n),this._render(),this._syncForm(),this._emit(`check`,{id:e.id,checked:n,values:this.values})}_toggleExpand(e){!e.disabled&&this._isBranch(e)&&(e.expanded?(e.expanded=!1,this._render()):this._expand(e))}_expand(e){e.expanded=!0,e.children===null?this._load(e):this._render()}async _load(e){if(e.loading)return;e.loading=!0,e.failed=!1,this._announce(this.loadingText),this._render();let t=[],n=null;try{t=await this._fetchChildren(e)}catch(e){n=e}let r=this._byId.get(e.id);if(!r)this._announce(``);else if(r.loading){if(r.loading=!1,!n)try{r.children=this._adoptStaged(t,r,r.level+1),this._passChecksDown(r),this._announce(``)}catch(e){n=e}n&&(r.failed=!0,r.expanded=!1,this._announce(this.errorText),this._emit(`error`,{id:r.id,message:n instanceof Error?n.message:String(n)})),this._render(),this._syncForm()}}async _fetchChildren(e){if(this._loader)return this._loader(e.raw);let t=this.getAttribute(`load-url`);if(!t)throw Error(`<wui-tree> has a node with children to load but no loadChildren or load-url.`);let n=new URL(t,window.location.href);n.searchParams.set(b,e.id);let r=await(0,u.wuiFetch)(n.href,{headers:{Accept:`application/json`}});if(!r.ok)throw Error(`Loading children answered ${r.kind}.`);return JSON.parse(r.html)}_handleClick(e){let t=e.target;if(!(t instanceof Element))return;let n=this._nodeFrom(t);n&&!n.disabled&&(this._focusNode(n),t.closest(`.wui-tree-toggle`)?this._toggleExpand(n):t.closest(`.wui-tree-check`)?(e.preventDefault(),this._toggleCheck(n)):this._activate(n))}_handleKeyDown(e){if(e.ctrlKey||e.metaKey||e.altKey)return;let t=this._nodeFrom(e.target);if(!t||e.target!==this._els.get(t.id)?.li)return;let n=(0,c.mirrorKey)(e.key,(0,c.isRtl)(this));if(n===`ArrowRight`){if(e.preventDefault(),!this._isBranch(t)||t.disabled)return;t.expanded?t.children?.length&&this._focusNode(t.children[0]):this._expand(t)}else n===`ArrowLeft`?(e.preventDefault(),t.expanded&&this._isBranch(t)&&!t.disabled?this._toggleExpand(t):t.parent&&this._focusNode(t.parent)):e.key===` `?(e.preventDefault(),this.selection===`multiple`?this._toggleCheck(t):this.selection===`single`&&this._activate(t)):this._nav.handler(e)}_syncForm(){let e=this.selection;if(e===`multiple`)(0,a.syncFormMirrors)(this,this.values);else if(e===`single`)(0,a.syncFormMirror)(this,this._selected??``);else for(let e of this.querySelectorAll(x))e.remove()}_render(){if(!this._list)return;this._flat=null;let e=document.activeElement,t=!!e&&this._list.contains(e),n=this._visible();n.some(e=>e.id===this._focusId)||(this._focusId=(n.find(e=>e.id===this._selected)??n[0])?.id??null);let r=this.getAttribute(`aria-label`);if(r?this._list.setAttribute(`aria-label`,r):this._list.removeAttribute(`aria-label`),n.length>_){this._bindWindow();let e={heights:(0,l.createHeightIndex)(n.length,this._rowH),start:0,end:0};this._win=e,this._paint(n,e)}else this._unbindWindow(),this._win=null,this._list.style.paddingTop=``,this._list.style.paddingBottom=``,this._drawRows(n);t&&this._focusId&&this._els.get(this._focusId)?.li.focus(),this._syncForm()}_drawRows(e){this._list&&(this._els=new Map,this._list.replaceChildren(...e.map(e=>this._buildItem(e))),this._syncTab())}_metrics(){let e=this._box,t=this._list?.getBoundingClientRect().top??0,n=e?e.getBoundingClientRect().top:0,r=(e?e.clientHeight:window.innerHeight)||y;return{scrollTop:Math.max(0,n-t),viewport:r}}_rangeOf(e){return(0,l.windowRange)(e.heights,{...this._metrics(),overscan:v})}_draw(e,t){let{start:n,end:r}=this._rangeOf(t);t.start=n,t.end=r,this._drawRows(e.slice(n,r));let i=this._list?.style;i&&(i.paddingTop=`${t.heights.offsetOf(n)}px`,i.paddingBottom=`${t.heights.total()-t.heights.offsetOf(r)}px`)}_measure(e,t){let{heights:n}=t,r=n.indexAt(this._metrics().scrollTop),i=n.offsetOf(r),a=!1;for(let r=t.start;r<t.end;r++){let t=e[r]?.id,i=t===void 0?void 0:this._els.get(t)?.li,o=i?i.getBoundingClientRect().height:0;if(o>0){if(!this._rowMeasured){this._rowMeasured=!0,this._rowH=o;let e=n.estimate;n.setEstimate(o),n.estimate!==e&&(a=!0)}n.set(r,o)&&(a=!0)}}return a?{changed:a,delta:n.offsetOf(r)-i}:{changed:!1,delta:0}}_scrollBy(e){this._box?this._box.scrollTop+=e:window.scrollBy(0,e)}_paint(e,t){this._draw(e,t);for(let n=0;n<2;n++){let{changed:n,delta:r}=this._measure(e,t);if(!n)return;r&&this._scrollBy(r),this._draw(e,t)}}_repaintWindow(){let e=this._win;if(!e||!this._list)return;let{start:t,end:n}=this._rangeOf(e);if(t===e.start&&n===e.end)return;let r=document.activeElement,i=!!r&&this._list.contains(r);this._paint(this._visible(),e),i&&this._focusId&&this._els.get(this._focusId)?.li.focus({preventScroll:!0})}_schedule(){this._frame||=requestAnimationFrame(()=>{this._frame=0,this._repaintWindow()})}_reveal(e){let t=this._win;if(!t)return;let n=this._visible(),r=n.indexOf(e);if(!(r<0))for(let i=0;i<2;i++){let i=this._metrics(),a=(0,l.scrollTopToReveal)(t.heights,r,i);if(Math.abs(a-i.scrollTop)>.5)this._scrollBy(a-i.scrollTop);else if(this._els.has(e.id))break;this._paint(n,t)}}_bindWindow(){if(this._unbind||!this.isConnected)return;let e=w(this),t=e??window,n=()=>this._schedule();t.addEventListener(`scroll`,n,{passive:!0});let r=null;e?(r=new ResizeObserver(n),r.observe(e)):window.addEventListener(`resize`,n),this._box=e,this._unbind=()=>{t.removeEventListener(`scroll`,n),r?r.disconnect():window.removeEventListener(`resize`,n)}}_unbindWindow(){this._unbind?.(),this._unbind=null,this._box=null,this._frame&&cancelAnimationFrame(this._frame),this._frame=0}_buildItem(e){let t=e.parent?e.parent.children?.length??0:this._roots.length,n=this.selection,i=this._isBranch(e),a=this._state(e),s=(0,r.make)(`li`,{class:`wui-tree-item`,role:`treeitem`,tabindex:e.id===this._focusId?0:-1,"aria-level":e.level,"aria-setsize":t,"aria-posinset":e.pos+1,"aria-labelledby":`${this._uid}-${e.seq}`,"aria-describedby":e.badge?`${this._uid}-${e.seq}-badge`:null});i&&s.setAttribute(`aria-expanded`,String(e.expanded)),e.disabled&&s.setAttribute(`aria-disabled`,`true`),e.loading&&s.setAttribute(`aria-busy`,`true`),n===`single`&&s.setAttribute(`aria-selected`,String(e.id===this._selected)),n===`multiple`&&s.setAttribute(`aria-checked`,a===`mixed`?`mixed`:String(a===`checked`));let c=(0,r.make)(`div`,{class:`wui-tree-row`,role:`presentation`});c.style.setProperty(`--wui-tree-level`,String(e.level-1)),n===`single`&&e.id===this._selected&&c.classList.add(`wui-tree-row-selected`),e.failed&&c.classList.add(`wui-tree-row-error`);let l=(0,r.make)(`span`,{class:i?`wui-tree-toggle`:`wui-tree-toggle wui-tree-toggle-leaf`,"aria-hidden":`true`});if(i){let e=(0,o.glyphNode)(`chevron-right`,{size:16});l.replaceChildren(...e?[e]:[])}if(c.append(l),n===`multiple`){let t=(0,r.make)(`input`,{class:`form-check-input wui-tree-check`,type:`checkbox`,tabindex:-1,"aria-hidden":`true`});t.checked=a===`checked`,t.indeterminate=a===`mixed`,t.disabled=e.disabled,t.addEventListener(`mousedown`,e=>e.preventDefault()),c.append(t)}if(e.icon){let t=(0,r.make)(`span`,{class:`wui-tree-icon`,"aria-hidden":`true`}),n=(0,o.glyphNode)(e.icon,{size:16});t.replaceChildren(...n?[n]:[]),c.append(t)}let u=(0,r.make)(`span`,{class:`wui-tree-label`,id:`${this._uid}-${e.seq}`});if(u.textContent=e.label,c.append(u),e.badge){let t=e.badgeTone&&e.badgeTone!==`neutral`?` badge-${e.badgeTone}`:``,n=(0,r.make)(`span`,{class:`badge wui-tree-badge${t}`,id:`${this._uid}-${e.seq}-badge`});n.textContent=e.badge,c.append(n)}return e.loading&&c.append((0,r.make)(`span`,{class:`wui-tree-spinner`,"aria-hidden":`true`})),s.append(c),this._els.set(e.id,{li:s,row:c}),s}};(0,t.defineElement)(`wui-tree`,T),e.WuiTree=T})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.devWarn,WeborityUiElementsInternal.modules.dom,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.formMirror,WeborityUiElementsInternal.modules.iconGlyphs,WeborityUiElementsInternal.modules.listboxKeyNav,WeborityUiElementsInternal.modules.rtl,WeborityUiElementsInternal.modules.selectWindow,WeborityUiElementsInternal.modules.wuiHttp,WeborityUiElementsInternal.modules.textStore);
|
|
1
|
+
(function(e,t,n,r,i,a,o,s,c,l,u,d,f){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var p=globalThis.WeborityUiElementsInternal?.version;if(p!==`0.175.0`)throw Error(`[webority-ui] tree expects ui-elements 0.175.0 but the page loaded `+p+`.`);var m={errorText:`Could not load. Try again.`,loadingText:`Loading`};function h(e){"@babel/helpers - typeof";return h=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},h(e)}function g(e,t){if(h(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(h(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function _(e){var t=g(e,`string`);return h(t)==`symbol`?t:t+``}function v(e,t,n){return(t=_(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var y=()=>(0,f.readText)(`tree`,m),b=[`none`,`single`,`multiple`],x=e=>b.some(t=>t===e),S=300,C=8,w=300,T=`parentId`,E=`:scope > input[data-wui-mirror]`,D=[`nodes`,`selection`,`selected`,`values`,`loadChildren`,`loadUrl`,`name`],O=0;function k(e){for(let t=e;t&&t!==document.body&&t!==document.documentElement;t=t.parentElement)if(/^(auto|scroll|overlay)$/.test(getComputedStyle(t).overflowY))return t;return null}var A=class extends i.ElementBase{static get observedAttributes(){return[`selection`,`selected`,`name`,`aria-label`,`loading-text`,`error-text`]}constructor(){super(),v(this,`_uid`,void 0),v(this,`_seq`,void 0),v(this,`_roots`,void 0),v(this,`_byId`,void 0),v(this,`_prev`,void 0),v(this,`_staged`,void 0),v(this,`_els`,void 0),v(this,`_checked`,void 0),v(this,`_selected`,void 0),v(this,`_focusId`,void 0),v(this,`_loader`,void 0),v(this,`_list`,void 0),v(this,`_live`,void 0),v(this,`_ready`,void 0),v(this,`_flat`,void 0),v(this,`_win`,void 0),v(this,`_rowH`,void 0),v(this,`_rowMeasured`,void 0),v(this,`_box`,void 0),v(this,`_unbind`,void 0),v(this,`_frame`,void 0),v(this,`_nav`,void 0),v(this,`_onKeyDown`,void 0),v(this,`_onClick`,void 0),v(this,`_onFocusIn`,void 0),this._uid=`wui-tree-${++O}`,this._seq=0,this._roots=[],this._byId=new Map,this._prev=null,this._staged=null,this._els=new Map,this._checked=new Set,this._selected=null,this._focusId=null,this._loader=null,this._list=null,this._live=null,this._ready=!1,this._flat=null,this._win=null,this._rowH=u.FALLBACK_ROW_HEIGHT,this._rowMeasured=!1,this._box=null,this._unbind=null,this._frame=0,this._nav=(0,c.createListboxKeyNav)({getVisibleOptions:()=>[...this._els.values()].map(e=>e.row),getActive:()=>this._visible().findIndex(e=>e.id===this._focusId),setActive:e=>this._focusNode(this._visible()[e]),getCount:()=>this._visible().length,getOptionAt:e=>this._els.get(this._visible()[e]?.id??``)?.row,findByPrefix:e=>this._visible().findIndex(t=>t.label.toLowerCase().startsWith(e)),onEnter:()=>{let e=this._focusId===null?void 0:this._byId.get(this._focusId);e&&this._activate(e)}}),this._onKeyDown=e=>this._handleKeyDown(e),this._onClick=e=>this._handleClick(e),this._onFocusIn=e=>{if(e.target===this._list){this._focusNode(this._focusId===null?void 0:this._byId.get(this._focusId));return}let t=this._nodeFrom(e.target);t&&t.id!==this._focusId&&this._setRoving(t)}}connectedCallback(){let e=new Map;for(let t of D)(0,o.hasOwn)(this,t)&&(e.set(t,Reflect.get(this,t)),Reflect.deleteProperty(this,t));if(!this._ready){this._ready=!0;let e=this._readScript();this.replaceChildren(),this._list=(0,r.make)(`ul`,{class:`wui-tree`}),this._list.setAttribute(`role`,`tree`),this._live=(0,r.make)(`div`,{class:`visually-hidden`,role:`status`,"aria-live":`polite`}),this.append(this._list,this._live),e&&this._adoptAll(e)}for(let[t,n]of e)Reflect.set(this,t,n);this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`click`,this._onClick),this.addEventListener(`focusin`,this._onFocusIn),this._render(),this._loadOpenNodes()}disconnectedCallback(){this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`focusin`,this._onFocusIn),this._unbindWindow(),this._nav.teardown()}attributeChangedCallback(e,t,n){e===`selected`&&(this._selected=n),this._ready&&this.isConnected&&this._render()}get nodes(){return this._roots.map(e=>e.raw)}set nodes(e){this._adoptAll(e??[]),this._render(),this._loadOpenNodes()}get selection(){let e=this.getAttribute(`selection`);return x(e)?e:`none`}set selection(e){this.setAttribute(`selection`,String(e))}get selected(){return this._selected}set selected(e){this._selected=e==null?null:String(e),this._render()}get values(){let e=[],t=n=>{for(let r of n)this._state(r)===`checked`&&e.push(r.id),r.children&&t(r.children)};return t(this._roots),[...e,...[...this._checked].filter(e=>!this._byId.has(e))]}set values(e){this._checked.clear();for(let t of e??[]){let e=this._byId.get(String(t));e?this._setChecked(e,!0):this._checked.add(String(t))}this._render()}get loadChildren(){return this._loader}set loadChildren(e){this._loader=typeof e==`function`?e:null}get loadUrl(){return this.getAttribute(`load-url`)}set loadUrl(e){e==null?this.removeAttribute(`load-url`):this.setAttribute(`load-url`,String(e))}get name(){return this.getAttribute(`name`)}set name(e){e==null?this.removeAttribute(`name`):this.setAttribute(`name`,String(e))}get loadingText(){return this.getAttribute(`loading-text`)??y().loadingText}set loadingText(e){this.setAttribute(`loading-text`,String(e??``))}get errorText(){return this.getAttribute(`error-text`)??y().errorText}set errorText(e){this.setAttribute(`error-text`,String(e??``))}_readScript(){let e=this.querySelector(`:scope > script[type='application/json']`);if(!e)return null;try{return JSON.parse(e.textContent??``)}catch(e){return(0,n.devError)(`[@webority/ui-elements] <wui-tree> could not read its JSON nodes:`,e instanceof Error?e.message:void 0),null}}_adoptAll(e){this._flat=null;let t=this._byId;this._prev=t,this._byId=new Map;let n;try{n=this._adoptStaged(e,null,1)}catch(e){throw this._byId=t,e}finally{this._prev=null}this._roots=n;for(let e of t.keys())this._byId.has(e)||this._checked.delete(e);for(let e of this._roots)this._passChecksDown(e);this._focusId&&!this._byId.has(this._focusId)&&(this._focusId=null)}_adoptStaged(e,t,n){let r=[],i=[];this._staged={ids:r,checks:i};try{let r=this._adopt(e,t,n);for(let e of i)this._checked.add(e);return r}catch(e){for(let e of r)this._byId.delete(e);throw e}finally{this._staged=null}}_adopt(e,t,n){if(!Array.isArray(e))throw Error(`<wui-tree> nodes must be an array.`);return e.map((e,r)=>{let i=e?.id==null?``:String(e.id);if(!i)throw Error(`<wui-tree> every node needs an id.`);if(this._byId.has(i))throw Error(`<wui-tree> node id "${i}" is used twice.`);let a=this._prev?.get(i),o={id:i,raw:e,parent:t,level:n,seq:++this._seq,pos:r,label:e.label==null?i:String(e.label),icon:e.icon||null,badge:e.badge==null||e.badge===``?null:String(e.badge),badgeTone:e.badgeTone||null,disabled:!!e.disabled,hasChildren:!!e.hasChildren,children:null,expanded:a?a.expanded:!!e.expanded,loading:!1,failed:!1};this._byId.set(i,o),this._staged?.ids.push(i);let s=e.children??(e.hasChildren?a?.children?.map(e=>e.raw):void 0);return Array.isArray(s)&&(o.children=this._adopt(s,o,n+1)),o.loading=!!a?.loading&&o.children===null&&o.hasChildren,e.checked&&!a&&this._staged?.checks.push(i),o})}_passChecksDown(e){e.children?.length&&this._checked.has(e.id)&&(this._checked.delete(e.id),this._setChecked(e,!0));for(let t of e.children??[])this._passChecksDown(t)}_loadOpenNodes(){queueMicrotask(()=>{if(this.isConnected)for(let e of[...this._byId.values()])e.expanded&&e.children===null&&e.hasChildren&&!e.loading&&this._load(e)})}_isBranch(e){return e.children?e.children.length>0:e.hasChildren}_visible(){if(this._flat)return this._flat;let e=[],t=n=>{for(let r of n)e.push(r),r.expanded&&r.children&&t(r.children)};return t(this._roots),this._flat=e,e}_state(e){if(e.children?.length){let t=0,n=0;for(let r of e.children){let e=this._state(r);e===`checked`?t++:e===`unchecked`&&n++}return t===e.children.length?`checked`:n===e.children.length?`unchecked`:`mixed`}return this._checked.has(e.id)?`checked`:`unchecked`}_setChecked(e,t){if(e.children?.length)for(let n of e.children)n.disabled||this._setChecked(n,t);else t?this._checked.add(e.id):this._checked.delete(e.id)}_nodeFrom(e){if(!(e instanceof Element))return null;let t=e.closest(`li.wui-tree-item`);if(!t)return null;for(let[e,n]of this._els)if(n.li===t)return this._byId.get(e)??null;return null}_emit(e,t){this.dispatchEvent(new CustomEvent(`wui-tree:${e}`,{detail:t,bubbles:!0,composed:!0}))}_announce(e){this._live&&(this._live.textContent=e)}_setRoving(e){let t=this._focusId===null?void 0:this._els.get(this._focusId);t&&(t.li.tabIndex=-1),this._focusId=e.id;let n=this._els.get(e.id);n&&(n.li.tabIndex=0),this._syncTab()}_syncTab(){this._list&&(this._focusId!==null&&!this._els.has(this._focusId)?this._list.tabIndex=0:this._list.removeAttribute(`tabindex`))}_focusNode(e){e&&(this._win&&!this._els.has(e.id)&&this._reveal(e),this._setRoving(e),this._els.get(e.id)?.li.focus())}_activate(e){e.disabled||(this.selection===`single`&&(this._selected=e.id,this._render(),this._syncForm()),this._emit(`select`,{id:e.id,node:e.raw}))}_enabledLeaves(e){return e.disabled?[]:e.children?.length?e.children.flatMap(e=>this._enabledLeaves(e)):[e]}_toggleCheck(e){let t=this._enabledLeaves(e);if(!t.length)return;let n=!t.every(e=>this._checked.has(e.id));this._setChecked(e,n),this._render(),this._syncForm(),this._emit(`check`,{id:e.id,checked:n,values:this.values})}_toggleExpand(e){!e.disabled&&this._isBranch(e)&&(e.expanded?(e.expanded=!1,this._render()):this._expand(e))}_expand(e){e.expanded=!0,e.children===null?this._load(e):this._render()}async _load(e){if(e.loading)return;e.loading=!0,e.failed=!1,this._announce(this.loadingText),this._render();let t=[],n=null;try{t=await this._fetchChildren(e)}catch(e){n=e}let r=this._byId.get(e.id);if(!r)this._announce(``);else if(r.loading){if(r.loading=!1,!n)try{r.children=this._adoptStaged(t,r,r.level+1),this._passChecksDown(r),this._announce(``)}catch(e){n=e}n&&(r.failed=!0,r.expanded=!1,this._announce(this.errorText),this._emit(`error`,{id:r.id,message:n instanceof Error?n.message:String(n)})),this._render(),this._syncForm()}}async _fetchChildren(e){if(this._loader)return this._loader(e.raw);let t=this.getAttribute(`load-url`);if(!t)throw Error(`<wui-tree> has a node with children to load but no loadChildren or load-url.`);let n=new URL(t,window.location.href);n.searchParams.set(T,e.id);let r=await(0,d.wuiFetch)(n.href,{headers:{Accept:`application/json`}});if(!r.ok)throw Error(`Loading children answered ${r.kind}.`);return JSON.parse(r.html)}_handleClick(e){let t=e.target;if(!(t instanceof Element))return;let n=this._nodeFrom(t);n&&!n.disabled&&(this._focusNode(n),t.closest(`.wui-tree-toggle`)?this._toggleExpand(n):t.closest(`.wui-tree-check`)?(e.preventDefault(),this._toggleCheck(n)):this._activate(n))}_handleKeyDown(e){if(e.ctrlKey||e.metaKey||e.altKey)return;let t=this._nodeFrom(e.target);if(!t||e.target!==this._els.get(t.id)?.li)return;let n=(0,l.mirrorKey)(e.key,(0,l.isRtl)(this));if(n===`ArrowRight`){if(e.preventDefault(),!this._isBranch(t)||t.disabled)return;t.expanded?t.children?.length&&this._focusNode(t.children[0]):this._expand(t)}else n===`ArrowLeft`?(e.preventDefault(),t.expanded&&this._isBranch(t)&&!t.disabled?this._toggleExpand(t):t.parent&&this._focusNode(t.parent)):e.key===` `?(e.preventDefault(),this.selection===`multiple`?this._toggleCheck(t):this.selection===`single`&&this._activate(t)):this._nav.handler(e)}_syncForm(){let e=this.selection;if(e===`multiple`)(0,a.syncFormMirrors)(this,this.values);else if(e===`single`)(0,a.syncFormMirror)(this,this._selected??``);else for(let e of this.querySelectorAll(E))e.remove()}_render(){if(!this._list)return;this._flat=null;let e=document.activeElement,t=!!e&&this._list.contains(e),n=this._visible();n.some(e=>e.id===this._focusId)||(this._focusId=(n.find(e=>e.id===this._selected)??n[0])?.id??null);let r=this.getAttribute(`aria-label`);if(r?this._list.setAttribute(`aria-label`,r):this._list.removeAttribute(`aria-label`),n.length>S){this._bindWindow();let e={heights:(0,u.createHeightIndex)(n.length,this._rowH),start:0,end:0};this._win=e,this._paint(n,e)}else this._unbindWindow(),this._win=null,this._list.style.paddingTop=``,this._list.style.paddingBottom=``,this._drawRows(n);t&&this._focusId&&this._els.get(this._focusId)?.li.focus(),this._syncForm()}_drawRows(e){this._list&&(this._els=new Map,this._list.replaceChildren(...e.map(e=>this._buildItem(e))),this._syncTab())}_metrics(){let e=this._box,t=this._list?.getBoundingClientRect().top??0,n=e?e.getBoundingClientRect().top:0,r=(e?e.clientHeight:window.innerHeight)||w;return{scrollTop:Math.max(0,n-t),viewport:r}}_rangeOf(e){return(0,u.windowRange)(e.heights,{...this._metrics(),overscan:C})}_draw(e,t){let{start:n,end:r}=this._rangeOf(t);t.start=n,t.end=r,this._drawRows(e.slice(n,r));let i=this._list?.style;i&&(i.paddingTop=`${t.heights.offsetOf(n)}px`,i.paddingBottom=`${t.heights.total()-t.heights.offsetOf(r)}px`)}_measure(e,t){let{heights:n}=t,r=n.indexAt(this._metrics().scrollTop),i=n.offsetOf(r),a=!1;for(let r=t.start;r<t.end;r++){let t=e[r]?.id,i=t===void 0?void 0:this._els.get(t)?.li,o=i?i.getBoundingClientRect().height:0;if(o>0){if(!this._rowMeasured){this._rowMeasured=!0,this._rowH=o;let e=n.estimate;n.setEstimate(o),n.estimate!==e&&(a=!0)}n.set(r,o)&&(a=!0)}}return a?{changed:a,delta:n.offsetOf(r)-i}:{changed:!1,delta:0}}_scrollBy(e){this._box?this._box.scrollTop+=e:window.scrollBy(0,e)}_paint(e,t){this._draw(e,t);for(let n=0;n<2;n++){let{changed:n,delta:r}=this._measure(e,t);if(!n)return;r&&this._scrollBy(r),this._draw(e,t)}}_repaintWindow(){let e=this._win;if(!e||!this._list)return;let{start:t,end:n}=this._rangeOf(e);if(t===e.start&&n===e.end)return;let r=document.activeElement,i=!!r&&this._list.contains(r);this._paint(this._visible(),e),i&&this._focusId&&this._els.get(this._focusId)?.li.focus({preventScroll:!0})}_schedule(){this._frame||=requestAnimationFrame(()=>{this._frame=0,this._repaintWindow()})}_reveal(e){let t=this._win;if(!t)return;let n=this._visible(),r=n.indexOf(e);if(!(r<0))for(let i=0;i<2;i++){let i=this._metrics(),a=(0,u.scrollTopToReveal)(t.heights,r,i);if(Math.abs(a-i.scrollTop)>.5)this._scrollBy(a-i.scrollTop);else if(this._els.has(e.id))break;this._paint(n,t)}}_bindWindow(){if(this._unbind||!this.isConnected)return;let e=k(this),t=e??window,n=()=>this._schedule();t.addEventListener(`scroll`,n,{passive:!0});let r=null;e?(r=new ResizeObserver(n),r.observe(e)):window.addEventListener(`resize`,n),this._box=e,this._unbind=()=>{t.removeEventListener(`scroll`,n),r?r.disconnect():window.removeEventListener(`resize`,n)}}_unbindWindow(){this._unbind?.(),this._unbind=null,this._box=null,this._frame&&cancelAnimationFrame(this._frame),this._frame=0}_buildItem(e){let t=e.parent?e.parent.children?.length??0:this._roots.length,n=this.selection,i=this._isBranch(e),a=this._state(e),o=(0,r.make)(`li`,{class:`wui-tree-item`,role:`treeitem`,tabindex:e.id===this._focusId?0:-1,"aria-level":e.level,"aria-setsize":t,"aria-posinset":e.pos+1,"aria-labelledby":`${this._uid}-${e.seq}`,"aria-describedby":e.badge?`${this._uid}-${e.seq}-badge`:null});i&&o.setAttribute(`aria-expanded`,String(e.expanded)),e.disabled&&o.setAttribute(`aria-disabled`,`true`),e.loading&&o.setAttribute(`aria-busy`,`true`),n===`single`&&o.setAttribute(`aria-selected`,String(e.id===this._selected)),n===`multiple`&&o.setAttribute(`aria-checked`,a===`mixed`?`mixed`:String(a===`checked`));let c=(0,r.make)(`div`,{class:`wui-tree-row`,role:`presentation`});c.style.setProperty(`--wui-tree-level`,String(e.level-1)),n===`single`&&e.id===this._selected&&c.classList.add(`wui-tree-row-selected`),e.failed&&c.classList.add(`wui-tree-row-error`);let l=(0,r.make)(`span`,{class:i?`wui-tree-toggle`:`wui-tree-toggle wui-tree-toggle-leaf`,"aria-hidden":`true`});if(i){let e=(0,s.glyphNode)(`chevron-right`,{size:16});l.replaceChildren(...e?[e]:[])}if(c.append(l),n===`multiple`){let t=(0,r.make)(`input`,{class:`form-check-input wui-tree-check`,type:`checkbox`,tabindex:-1,"aria-hidden":`true`});t.checked=a===`checked`,t.indeterminate=a===`mixed`,t.disabled=e.disabled,t.addEventListener(`mousedown`,e=>e.preventDefault()),c.append(t)}if(e.icon){let t=(0,r.make)(`span`,{class:`wui-tree-icon`,"aria-hidden":`true`}),n=(0,s.glyphNode)(e.icon,{size:16});t.replaceChildren(...n?[n]:[]),c.append(t)}let u=(0,r.make)(`span`,{class:`wui-tree-label`,id:`${this._uid}-${e.seq}`});if(u.textContent=e.label,c.append(u),e.badge){let t=e.badgeTone&&e.badgeTone!==`neutral`?` badge-${e.badgeTone}`:``,n=(0,r.make)(`span`,{class:`badge wui-tree-badge${t}`,id:`${this._uid}-${e.seq}-badge`});n.textContent=e.badge,c.append(n)}return e.loading&&c.append((0,r.make)(`span`,{class:`wui-tree-spinner`,"aria-hidden":`true`})),o.append(c),this._els.set(e.id,{li:o,row:c}),o}};(0,t.defineElement)(`wui-tree`,A),e.WuiTree=A})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.devWarn,WeborityUiElementsInternal.modules.dom,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.formMirror,WeborityUiElementsInternal.modules.hasOwn,WeborityUiElementsInternal.modules.iconGlyphs,WeborityUiElementsInternal.modules.listboxKeyNav,WeborityUiElementsInternal.modules.rtl,WeborityUiElementsInternal.modules.selectWindow,WeborityUiElementsInternal.modules.wuiHttp,WeborityUiElementsInternal.modules.textStore);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t,n,r,i,a,o,s,c){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var l=globalThis.WeborityUiElementsInternal?.version;if(l!==`0.174.0`)throw Error(`[webority-ui] wizard expects ui-elements 0.174.0 but the page loaded `+l+`.`);var u={activeLabel:`Current`,backLabel:`Back`,closeLabel:`Close`,doneLabel:`Done`,errorLabel:`Error`,finishLabel:`Finish`,label:`Progress`,nextLabel:`Next`,pendingLabel:`To do`,skipLabel:`Skip`,skippedLabel:`Skipped`,stepOfText:`Step {position} of {total}`,stepText:`Step {position}`},d=()=>(0,c.readText)(`wizard`,u),f=`wui-wizard-step`,p=`:scope > [data-wui-glyphs]`,m=()=>({done:d().doneLabel,active:d().activeLabel,pending:d().pendingLabel,error:d().errorLabel,skipped:d().skippedLabel}),h=[`data-nav`,`data-step`,`data-close`],g=new WeakSet,_=class extends a.ElementBase{_active;_skipped;_invalid;_finished;_rendered;_reflecting;_beforeNext;_header;_footer;_chromeInserted;_topBar;_onTopBarClick;_onHeaderClick;_onFooterClick;_known;_observer;_glyphs;_glyphObserver;static get observedAttributes(){return[`active`,`variant`,`orientation`,`align`,`icon-size`,`non-linear`,`hide-stepper`,`hide-connectors`,`disabled`,`skippable`,`label`,`back-label`,`next-label`,`skip-label`,`finish-label`,`top-bar`,`bar-title`,`close-label`]}constructor(){super(),this._active=0,this._skipped=new Set,this._invalid=new Set,this._finished=!1,this._rendered=!1,this._reflecting=!1,this._beforeNext=null,this._header=document.createElement(`nav`),this._header.className=`stepper wizard-stepper`,this._footer=document.createElement(`div`),this._footer.className=`form-actions wizard-footer form-actions-between`,this._chromeInserted=!1,this._topBar=null,this._onTopBarClick=e=>{let t=e.target;t instanceof Element&&t.closest(`[data-close]`)&&this.dispatchEvent(new CustomEvent(`wui-wizard:close`,{detail:{index:this._active},bubbles:!0}))},this._known=[],this._observer=null,this._glyphs=null,this._glyphObserver=null}get active(){return this._active}set active(e){let t=Number.parseInt(String(e),10);Number.isFinite(t)&&this._go(t,`set`)}get beforeNext(){return this._beforeNext}set beforeNext(e){this._beforeNext=typeof e==`function`?e:null}get _steps(){return[...this.querySelectorAll(`:scope > ${f}`)].filter(e=>e instanceof HTMLElement)}refresh(){this._rendered&&this._renderChrome()}connectedCallback(){if(this._rendered)this._wire(),this._onStepsMutated();else{let e=Number.parseInt(this.getAttribute(`active`)??``,10);this._active=Number.isFinite(e)&&e>=0?e:0,this.render()}}disconnectedCallback(){this._teardown()}attributeChangedCallback(e,t,n){if(this._rendered&&!this._reflecting){if(e===`active`){let e=Number.parseInt(n??``,10);Number.isFinite(e)&&this._go(e,`set`)}else this._renderChrome()}}render(){let e=this._steps;if(!this._chromeInserted){let t=e[0],n=e[e.length-1];t&&n?(this.insertBefore(this._header,t),n.after(this._footer)):(this.prepend(this._header),this.append(this._footer)),this._chromeInserted=!0}this._known=e,this._renderChrome(),this._rendered=!0,this._wire()}_renderChrome(){let e=this._reconcileSteps();this._placeChrome(e),this._clampActive(e),this._syncPanels(e);let t=this._focusedControl();this._syncTopBar(e),this._header.replaceChildren(...this._headerNodes(e)),this._footer.replaceChildren(...this._footerNodes(e)),this._header.hidden=this.hasAttribute(`hide-stepper`),this._restoreFocus(t)}_focusedControl(){let e=document.activeElement;if(!e||![this._topBar,this._header,this._footer].some(t=>t?.contains(e)))return null;let t=h.find(t=>e.hasAttribute(t));return t?{attr:t,value:e.getAttribute(t)}:null}_restoreFocus(e){if(e)for(let t of[this._topBar,this._header,this._footer]){let n=t&&[...t.querySelectorAll(`[${e.attr}]`)].find(t=>t.getAttribute(e.attr)===e.value);if(n){n instanceof HTMLElement&&!(n instanceof HTMLButtonElement&&n.disabled)&&n.focus({preventScroll:!0});return}}}_syncTopBar(e){if(!this.hasAttribute(`top-bar`)){this._topBar?.removeEventListener(`click`,this._onTopBarClick),this._topBar?.remove(),this._topBar=null;return}this._topBar||(this._topBar=document.createElement(`div`),this._topBar.className=`wui-wizard-topbar`,this._rendered&&this._topBar.addEventListener(`click`,this._onTopBarClick)),this._header.previousElementSibling!==this._topBar&&this.insertBefore(this._topBar,this._header);let t=this.getAttribute(`bar-title`)||``,n=this.getAttribute(`close-label`)||d().closeLabel,r=e.length?[(0,i.make)(`span`,{class:`wui-wizard-topbar-count`},(0,c.fillText)(d().stepOfText,{position:this._active+1,total:e.length}))]:[];this._topBar.replaceChildren((0,i.make)(`span`,{class:`wui-wizard-topbar-title`},t||null),...r,(0,i.make)(`button`,{type:`button`,class:`wui-wizard-topbar-close`,"data-close":!0,"aria-label":n},this._glyph(`x`)))}_clampActive(e){let t=Math.max(0,e.length-1);this._active>t&&(this._active=t),this._active<0&&(this._active=0)}_reconcileSteps(){let e=this._steps,t=this._known;if(this._known=e,y(e,t))return e;let n=n=>new Set([...n].map(n=>{let r=t[n];return r?e.indexOf(r):-1}).filter(e=>e>=0));this._skipped=n(this._skipped),this._invalid=n(this._invalid);let r=t[this._active];if(!r)return e;let i=e.indexOf(r);if(i<0){let n=t=>e.includes(t),r=t.slice(this._active+1).find(n)??t.slice(0,this._active).reverse().find(n);i=r?e.indexOf(r):this._active}return i=Math.min(i,Math.max(0,e.length-1)),i!==this._active&&(this._active=i,this._reflectActive(i)),e}_placeChrome(e){let t=e[0],n=e[e.length-1];t&&n&&(this._header.nextElementSibling!==t&&this.insertBefore(this._header,t),this._footer.previousElementSibling!==n&&n.after(this._footer))}_onStepsMutated(){if(!this._rendered)return;let e=this._steps,t=!e.length||this._header.nextElementSibling===e[0]&&this._footer.previousElementSibling===e[e.length-1];this.querySelector(p)!==this._glyphs&&(this._watchGlyphs(),this._renderHeader()),t&&y(e,this._known)||(this._renderChrome(),this._observer?.takeRecords())}_syncPanels(e){e.forEach((e,t)=>{let n=t===this._active;e.classList.add(`wizard-panel`),e.hidden=!n,e.setAttribute(`role`,`tabpanel`),e.setAttribute(`aria-hidden`,n?`false`:`true`)})}_stepStatus(e,t){let n=e?.getAttribute(`status`);if(n){if(!v(n))throw Error(`wui-wizard: status "${n}" is not one of pending, active, done, error, skipped.`);return n}return this._invalid.has(t)?`error`:this._finished?`done`:t===this._active?`active`:t<this._active?this._skipped.has(t)?`skipped`:`done`:`pending`}_headerNodes(e){let t=this.getAttribute(`variant`)===`journey`,n=this.getAttribute(`variant`)===`icons`,a=this.getAttribute(`variant`)===`tiles`,o=this.getAttribute(`orientation`)===`vertical`,l=!this.hasAttribute(`hide-connectors`),u=this.getAttribute(`align`)===`start`;this._header.className=[`stepper`,`wizard-stepper`,t&&`stepper-journey`,n&&`stepper-icons`,a&&`wui-step-tiles`,o&&`stepper-vertical`,!l&&`wui-stepper-no-connectors`,u&&`wui-stepper-start`].filter(Boolean).join(` `),this._header.setAttribute(`aria-label`,this.getAttribute(`label`)||d().label);let f=this.hasAttribute(`non-linear`);for(let t of e)t.getAttribute(`label`)||g.has(t)||(g.add(t),(0,r.devWarn)(`wui-wizard: a <wui-wizard-step> needs a label attribute; its header segment is empty.`));let p=(0,s.stepperHeaderItems)(e.map(e=>({label:e.getAttribute(`label`)||``,icon:e.getAttribute(`icon`)||void 0})),{statusOf:t=>this._stepStatus(e[t],t),journey:t,connectors:l}),h=m(),_=p.flatMap(r=>{let o=r.index,s=e[o];if(!s)return[];let l=r.status,u=s.getAttribute(`label`)||null,p=s.getAttribute(`description`)||``,m=o+1,g=`icon`in r.glyph?this._glyph(r.glyph.icon):r.glyph.number,_=r.className,v=r.current?`step`:void 0,y=f||o<this._active;if(a){let e=[(0,i.make)(`span`,{class:`step-circle`},g),(0,i.make)(`span`,{class:`step-text`},(0,i.make)(`span`,{class:`step-label`},u),(0,i.make)(`span`,{class:`wui-step-tile-state`},h[l]??null))],t=y?(0,i.make)(`button`,{type:`button`,class:`wui-step-tile-body`,"data-step":o,"aria-current":v},...e):(0,i.make)(`div`,{class:`wui-step-tile-body`,"aria-current":v},...e);return[(0,i.make)(`li`,{class:l===`pending`?`wui-step-tile`:`wui-step-tile ${l}`},t)]}let b=p?[(0,i.make)(`span`,{class:`step-desc`},p)]:[],x;x=t?[(0,i.make)(`span`,{class:`step-circle`},g),(0,i.make)(`span`,{class:`step-text`},(0,i.make)(`span`,{class:`step-index`},(0,c.fillText)(d().stepText,{position:m})),(0,i.make)(`span`,{class:`step-label`},u),...b)]:n?[(0,i.make)(`span`,{class:`step-circle`},g),(0,i.make)(`span`,{class:`step-index`},(0,c.fillText)(d().stepText,{position:m})),(0,i.make)(`span`,{class:`step-label`},u),...b]:[(0,i.make)(`span`,{class:`step-circle`},g),(0,i.make)(`span`,{class:`step-label`},u),...b];let S=y?(0,i.make)(`button`,{type:`button`,class:_,"data-step":o,"aria-current":v},...x):(0,i.make)(`div`,{class:_,"aria-current":v},...x);return r.line?[S,(0,i.make)(`span`,{class:`step-line${r.line.done?` done`:``}`,"aria-hidden":`true`})]:[S]});return a?[(0,i.make)(`ol`,null,..._)]:_}_footerNodes(e){let t=this._active,r=e.length-1,a=this.hasAttribute(`disabled`),s=e[t]?.hasAttribute(`optional`)||this.hasAttribute(`skippable`),c=this.getAttribute(`back-label`)||d().backLabel,l=this.getAttribute(`next-label`)||d().nextLabel,u=this.getAttribute(`skip-label`)||d().skipLabel,f=this.getAttribute(`finish-label`)||d().finishLabel,p=t>0?(0,i.make)(`button`,{type:`button`,class:(0,n.buttonClass)(`primary`,`soft`,`md`),"data-nav":`back`,disabled:a,"data-wui":n.APP_BUTTON_MARKER},(0,o.glyphNode)(`arrow-left`,{className:`me-2`}),c):(0,i.make)(`span`),m=s&&t<r?(0,i.make)(`button`,{type:`button`,class:(0,n.buttonClass)(`neutral`,`soft`,`md`),"data-nav":`skip`,disabled:a,"data-wui":n.APP_BUTTON_MARKER},u):null,h=t<r?(0,i.make)(`button`,{type:`button`,class:(0,n.buttonClass)(`primary`,`solid`,`md`),"data-nav":`next`,disabled:a,"data-wui":n.APP_BUTTON_MARKER},l,(0,o.glyphNode)(`arrow-right`,{className:`ms-2`})):(0,i.make)(`button`,{type:`button`,class:(0,n.buttonClass)(`primary`,`solid`,`md`),"data-nav":`finish`,disabled:a,"data-wui":n.APP_BUTTON_MARKER},f);return[p,(0,i.make)(`span`,{class:`wizard-footer-actions`},m,h)]}_wire(){this._teardown(),this._onHeaderClick=e=>{let t=e.target instanceof Element?e.target.closest(`[data-step]`):null;t instanceof HTMLElement&&this.contains(t)&&this._stepTo(Number.parseInt(t.dataset.step??``,10))},this._onFooterClick=e=>{let t=e.target instanceof Element?e.target.closest(`[data-nav]`):null;if(!(t instanceof HTMLElement)||!this.contains(t)||this.hasAttribute(`disabled`))return;let n=t.dataset.nav;n===`back`?this._back():n===`skip`?this._skip():(n===`next`||n===`finish`)&&this._next()},this._header.addEventListener(`click`,this._onHeaderClick),this._footer.addEventListener(`click`,this._onFooterClick),this._topBar?.addEventListener(`click`,this._onTopBarClick),this._observer=new MutationObserver(()=>this._onStepsMutated()),this._observer.observe(this,{childList:!0}),this._watchGlyphs()}_glyph(e){let t=this.querySelector(p),n=t&&[...t.children].find(t=>t.getAttribute(`data-icon`)===e);if(n)return n.cloneNode(!0);let r=Number.parseInt(this.getAttribute(`icon-size`)??``,10);return(0,o.glyphNode)(e,r>0?{size:r}:void 0)}_watchGlyphs(){this._glyphObserver?.disconnect(),this._glyphObserver=null,this._glyphs=this.querySelector(p),this._glyphs&&(this._glyphObserver=new MutationObserver(()=>this._renderHeader()),this._glyphObserver.observe(this._glyphs,{childList:!0,subtree:!0,attributes:!0,characterData:!0}))}_renderHeader(){if(!this._rendered)return;let e=this._focusedControl();this._header.replaceChildren(...this._headerNodes(this._steps)),this._restoreFocus(e)}_teardown(){this._header&&this._onHeaderClick&&this._header.removeEventListener(`click`,this._onHeaderClick),this._footer&&this._onFooterClick&&this._footer.removeEventListener(`click`,this._onFooterClick),this._topBar?.removeEventListener(`click`,this._onTopBarClick),this._observer?.disconnect(),this._observer=null,this._glyphObserver?.disconnect(),this._glyphObserver=null}_stepTo(e){this.hasAttribute(`disabled`)||!this.hasAttribute(`non-linear`)&&e>=this._active||this._go(e,`step`)}_back(){this._active>0&&this._go(this._active-1,`back`)}async _next(){this._reconcileSteps();let e=this._active,t=this._steps,n=e>=t.length-1,r=t[e];if(!this.dispatchEvent(new CustomEvent(`wui-wizard:beforechange`,{detail:n?{index:e,next:e,reason:`finish`}:{index:e,next:e+1,reason:`next`},cancelable:!0})))return this._flagInvalid(e);if(this._beforeNext){let i;try{i=await this._beforeNext(e)}catch{i=!1}if(this._reconcileSteps(),t=this._steps,e=r?t.indexOf(r):-1,e<0)return;if(n=e>=t.length-1,i===!1)return this._flagInvalid(e)}if(this._invalid.delete(e),this._skipped.delete(e),n)return this._finish();this._go(e+1,`next`)}_skip(){let e=this._active,t=this._steps;(t[e]?.hasAttribute(`optional`)||this.hasAttribute(`skippable`))&&(this._invalid.delete(e),this._skipped.add(e),this.dispatchEvent(new CustomEvent(`wui-wizard:skip`,{detail:{index:e}})),e>=t.length-1?this._finish():this._go(e+1,`skip`))}_flagInvalid(e){this._invalid.add(e),this._renderChrome(),this.dispatchEvent(new CustomEvent(`wui-wizard:invalid`,{detail:{index:e}}))}_finish(){this._invalid.delete(this._active),this._finished=!0,this._renderChrome(),this.dispatchEvent(new CustomEvent(`wui-wizard:finish`,{detail:{index:this._active}}))}_go(e,t){let n=this._reconcileSteps(),r=Math.max(0,n.length-1),i=Math.min(Math.max(e,0),r),a=this._active;this._finished=!1,this._invalid.delete(a),this._active=i,this._reflectActive(i),this._renderChrome(),t!==`silent`&&i!==a&&this.dispatchEvent(new CustomEvent(`wui-wizard:change`,{detail:{index:i,previous:a,reason:t}}))}_reflectActive(e){this._reflecting=!0,this.setAttribute(`active`,String(e)),this._reflecting=!1}},v=e=>e===`pending`||e===`active`||e===`done`||e===`error`||e===`skipped`,y=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),b=class extends a.ElementBase{static get observedAttributes(){return[`label`,`description`,`optional`,`icon`,`status`]}attributeChangedCallback(){let e=this.closest(`wui-wizard`);e&&`refresh`in e&&typeof e.refresh==`function`&&e.refresh()}};(0,t.defineElement)(`wui-wizard-step`,b),(0,t.defineElement)(`wui-wizard`,_),e.WuiWizard=_,e.WuiWizardStep=b})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.buttonClass,WeborityUiElementsInternal.modules.devWarn,WeborityUiElementsInternal.modules.dom,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.iconGlyphs,WeborityUiElementsInternal.modules.stepperHeader,WeborityUiElementsInternal.modules.textStore);
|
|
1
|
+
(function(e,t,n,r,i,a,o,s,c){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var l=globalThis.WeborityUiElementsInternal?.version;if(l!==`0.175.0`)throw Error(`[webority-ui] wizard expects ui-elements 0.175.0 but the page loaded `+l+`.`);var u={activeLabel:`Current`,backLabel:`Back`,closeLabel:`Close`,doneLabel:`Done`,errorLabel:`Error`,finishLabel:`Finish`,label:`Progress`,nextLabel:`Next`,pendingLabel:`To do`,skipLabel:`Skip`,skippedLabel:`Skipped`,stepOfText:`Step {position} of {total}`,stepText:`Step {position}`};function d(e){"@babel/helpers - typeof";return d=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},d(e)}function f(e,t){if(d(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(d(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function p(e){var t=f(e,`string`);return d(t)==`symbol`?t:t+``}function m(e,t,n){return(t=p(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var h=()=>(0,c.readText)(`wizard`,u),g=`wui-wizard-step`,_=`:scope > [data-wui-glyphs]`,v=()=>({done:h().doneLabel,active:h().activeLabel,pending:h().pendingLabel,error:h().errorLabel,skipped:h().skippedLabel}),y=[`data-nav`,`data-step`,`data-close`],b=new WeakSet,x=class extends a.ElementBase{static get observedAttributes(){return[`active`,`variant`,`orientation`,`align`,`icon-size`,`non-linear`,`hide-stepper`,`hide-connectors`,`disabled`,`skippable`,`label`,`back-label`,`next-label`,`skip-label`,`finish-label`,`top-bar`,`bar-title`,`close-label`]}constructor(){super(),m(this,`_active`,void 0),m(this,`_skipped`,void 0),m(this,`_invalid`,void 0),m(this,`_finished`,void 0),m(this,`_rendered`,void 0),m(this,`_reflecting`,void 0),m(this,`_beforeNext`,void 0),m(this,`_header`,void 0),m(this,`_footer`,void 0),m(this,`_chromeInserted`,void 0),m(this,`_topBar`,void 0),m(this,`_onTopBarClick`,void 0),m(this,`_onHeaderClick`,void 0),m(this,`_onFooterClick`,void 0),m(this,`_known`,void 0),m(this,`_observer`,void 0),m(this,`_glyphs`,void 0),m(this,`_glyphObserver`,void 0),this._active=0,this._skipped=new Set,this._invalid=new Set,this._finished=!1,this._rendered=!1,this._reflecting=!1,this._beforeNext=null,this._header=document.createElement(`nav`),this._header.className=`stepper wizard-stepper`,this._footer=document.createElement(`div`),this._footer.className=`form-actions wizard-footer form-actions-between`,this._chromeInserted=!1,this._topBar=null,this._onTopBarClick=e=>{let t=e.target;t instanceof Element&&t.closest(`[data-close]`)&&this.dispatchEvent(new CustomEvent(`wui-wizard:close`,{detail:{index:this._active},bubbles:!0}))},this._known=[],this._observer=null,this._glyphs=null,this._glyphObserver=null}get active(){return this._active}set active(e){let t=Number.parseInt(String(e),10);Number.isFinite(t)&&this._go(t,`set`)}get beforeNext(){return this._beforeNext}set beforeNext(e){this._beforeNext=typeof e==`function`?e:null}get _steps(){return[...this.querySelectorAll(`:scope > ${g}`)].filter(e=>e instanceof HTMLElement)}refresh(){this._rendered&&this._renderChrome()}connectedCallback(){if(this._rendered)this._wire(),this._onStepsMutated();else{let e=Number.parseInt(this.getAttribute(`active`)??``,10);this._active=Number.isFinite(e)&&e>=0?e:0,this.render()}}disconnectedCallback(){this._teardown()}attributeChangedCallback(e,t,n){if(this._rendered&&!this._reflecting){if(e===`active`){let e=Number.parseInt(n??``,10);Number.isFinite(e)&&this._go(e,`set`)}else this._renderChrome()}}render(){let e=this._steps;if(!this._chromeInserted){let t=e[0],n=e[e.length-1];t&&n?(this.insertBefore(this._header,t),n.after(this._footer)):(this.prepend(this._header),this.append(this._footer)),this._chromeInserted=!0}this._known=e,this._renderChrome(),this._rendered=!0,this._wire()}_renderChrome(){let e=this._reconcileSteps();this._placeChrome(e),this._clampActive(e),this._syncPanels(e);let t=this._focusedControl();this._syncTopBar(e),this._header.replaceChildren(...this._headerNodes(e)),this._footer.replaceChildren(...this._footerNodes(e)),this._header.hidden=this.hasAttribute(`hide-stepper`),this._restoreFocus(t)}_focusedControl(){let e=document.activeElement;if(!e||![this._topBar,this._header,this._footer].some(t=>t?.contains(e)))return null;let t=y.find(t=>e.hasAttribute(t));return t?{attr:t,value:e.getAttribute(t)}:null}_restoreFocus(e){if(e)for(let t of[this._topBar,this._header,this._footer]){let n=t&&[...t.querySelectorAll(`[${e.attr}]`)].find(t=>t.getAttribute(e.attr)===e.value);if(n){n instanceof HTMLElement&&!(n instanceof HTMLButtonElement&&n.disabled)&&n.focus({preventScroll:!0});return}}}_syncTopBar(e){if(!this.hasAttribute(`top-bar`)){this._topBar?.removeEventListener(`click`,this._onTopBarClick),this._topBar?.remove(),this._topBar=null;return}this._topBar||(this._topBar=document.createElement(`div`),this._topBar.className=`wui-wizard-topbar`,this._rendered&&this._topBar.addEventListener(`click`,this._onTopBarClick)),this._header.previousElementSibling!==this._topBar&&this.insertBefore(this._topBar,this._header);let t=this.getAttribute(`bar-title`)||``,n=this.getAttribute(`close-label`)||h().closeLabel,r=e.length?[(0,i.make)(`span`,{class:`wui-wizard-topbar-count`},(0,c.fillText)(h().stepOfText,{position:this._active+1,total:e.length}))]:[];this._topBar.replaceChildren((0,i.make)(`span`,{class:`wui-wizard-topbar-title`},t||null),...r,(0,i.make)(`button`,{type:`button`,class:`wui-wizard-topbar-close`,"data-close":!0,"aria-label":n},this._glyph(`x`)))}_clampActive(e){let t=Math.max(0,e.length-1);this._active>t&&(this._active=t),this._active<0&&(this._active=0)}_reconcileSteps(){let e=this._steps,t=this._known;if(this._known=e,C(e,t))return e;let n=n=>new Set([...n].map(n=>{let r=t[n];return r?e.indexOf(r):-1}).filter(e=>e>=0));this._skipped=n(this._skipped),this._invalid=n(this._invalid);let r=t[this._active];if(!r)return e;let i=e.indexOf(r);if(i<0){let n=t=>e.includes(t),r=t.slice(this._active+1).find(n)??t.slice(0,this._active).reverse().find(n);i=r?e.indexOf(r):this._active}return i=Math.min(i,Math.max(0,e.length-1)),i!==this._active&&(this._active=i,this._reflectActive(i)),e}_placeChrome(e){let t=e[0],n=e[e.length-1];t&&n&&(this._header.nextElementSibling!==t&&this.insertBefore(this._header,t),this._footer.previousElementSibling!==n&&n.after(this._footer))}_onStepsMutated(){if(!this._rendered)return;let e=this._steps,t=!e.length||this._header.nextElementSibling===e[0]&&this._footer.previousElementSibling===e[e.length-1];this.querySelector(_)!==this._glyphs&&(this._watchGlyphs(),this._renderHeader()),t&&C(e,this._known)||(this._renderChrome(),this._observer?.takeRecords())}_syncPanels(e){e.forEach((e,t)=>{let n=t===this._active;e.classList.add(`wizard-panel`),e.hidden=!n,e.setAttribute(`role`,`tabpanel`),e.setAttribute(`aria-hidden`,n?`false`:`true`)})}_stepStatus(e,t){let n=e?.getAttribute(`status`);if(n){if(!S(n))throw Error(`wui-wizard: status "${n}" is not one of pending, active, done, error, skipped.`);return n}return this._invalid.has(t)?`error`:this._finished?`done`:t===this._active?`active`:t<this._active?this._skipped.has(t)?`skipped`:`done`:`pending`}_headerNodes(e){let t=this.getAttribute(`variant`)===`journey`,n=this.getAttribute(`variant`)===`icons`,a=this.getAttribute(`variant`)===`tiles`,o=this.getAttribute(`orientation`)===`vertical`,l=!this.hasAttribute(`hide-connectors`),u=this.getAttribute(`align`)===`start`;this._header.className=[`stepper`,`wizard-stepper`,t&&`stepper-journey`,n&&`stepper-icons`,a&&`wui-step-tiles`,o&&`stepper-vertical`,!l&&`wui-stepper-no-connectors`,u&&`wui-stepper-start`].filter(Boolean).join(` `),this._header.setAttribute(`aria-label`,this.getAttribute(`label`)||h().label);let d=this.hasAttribute(`non-linear`);for(let t of e)t.getAttribute(`label`)||b.has(t)||(b.add(t),(0,r.devWarn)(`wui-wizard: a <wui-wizard-step> needs a label attribute; its header segment is empty.`));let f=(0,s.stepperHeaderItems)(e.map(e=>({label:e.getAttribute(`label`)||``,icon:e.getAttribute(`icon`)||void 0})),{statusOf:t=>this._stepStatus(e[t],t),journey:t,connectors:l}),p=v(),m=f.flatMap(r=>{let o=r.index,s=e[o];if(!s)return[];let l=r.status,u=s.getAttribute(`label`)||null,f=s.getAttribute(`description`)||``,m=o+1,g=`icon`in r.glyph?this._glyph(r.glyph.icon):r.glyph.number,_=r.className,v=r.current?`step`:void 0,y=d||o<this._active;if(a){let e=[(0,i.make)(`span`,{class:`step-circle`},g),(0,i.make)(`span`,{class:`step-text`},(0,i.make)(`span`,{class:`step-label`},u),(0,i.make)(`span`,{class:`wui-step-tile-state`},p[l]??null))],t=y?(0,i.make)(`button`,{type:`button`,class:`wui-step-tile-body`,"data-step":o,"aria-current":v},...e):(0,i.make)(`div`,{class:`wui-step-tile-body`,"aria-current":v},...e);return[(0,i.make)(`li`,{class:l===`pending`?`wui-step-tile`:`wui-step-tile ${l}`},t)]}let b=f?[(0,i.make)(`span`,{class:`step-desc`},f)]:[],x;x=t?[(0,i.make)(`span`,{class:`step-circle`},g),(0,i.make)(`span`,{class:`step-text`},(0,i.make)(`span`,{class:`step-index`},(0,c.fillText)(h().stepText,{position:m})),(0,i.make)(`span`,{class:`step-label`},u),...b)]:n?[(0,i.make)(`span`,{class:`step-circle`},g),(0,i.make)(`span`,{class:`step-index`},(0,c.fillText)(h().stepText,{position:m})),(0,i.make)(`span`,{class:`step-label`},u),...b]:[(0,i.make)(`span`,{class:`step-circle`},g),(0,i.make)(`span`,{class:`step-label`},u),...b];let S=y?(0,i.make)(`button`,{type:`button`,class:_,"data-step":o,"aria-current":v},...x):(0,i.make)(`div`,{class:_,"aria-current":v},...x);return r.line?[S,(0,i.make)(`span`,{class:`step-line${r.line.done?` done`:``}`,"aria-hidden":`true`})]:[S]});return a?[(0,i.make)(`ol`,null,...m)]:m}_footerNodes(e){let t=this._active,r=e.length-1,a=this.hasAttribute(`disabled`),s=e[t]?.hasAttribute(`optional`)||this.hasAttribute(`skippable`),c=this.getAttribute(`back-label`)||h().backLabel,l=this.getAttribute(`next-label`)||h().nextLabel,u=this.getAttribute(`skip-label`)||h().skipLabel,d=this.getAttribute(`finish-label`)||h().finishLabel,f=t>0?(0,i.make)(`button`,{type:`button`,class:(0,n.buttonClass)(`primary`,`soft`,`md`),"data-nav":`back`,disabled:a,"data-wui":n.APP_BUTTON_MARKER},(0,o.glyphNode)(`arrow-left`,{className:`me-2`}),c):(0,i.make)(`span`),p=s&&t<r?(0,i.make)(`button`,{type:`button`,class:(0,n.buttonClass)(`neutral`,`soft`,`md`),"data-nav":`skip`,disabled:a,"data-wui":n.APP_BUTTON_MARKER},u):null,m=t<r?(0,i.make)(`button`,{type:`button`,class:(0,n.buttonClass)(`primary`,`solid`,`md`),"data-nav":`next`,disabled:a,"data-wui":n.APP_BUTTON_MARKER},l,(0,o.glyphNode)(`arrow-right`,{className:`ms-2`})):(0,i.make)(`button`,{type:`button`,class:(0,n.buttonClass)(`primary`,`solid`,`md`),"data-nav":`finish`,disabled:a,"data-wui":n.APP_BUTTON_MARKER},d);return[f,(0,i.make)(`span`,{class:`wizard-footer-actions`},p,m)]}_wire(){this._teardown(),this._onHeaderClick=e=>{let t=e.target instanceof Element?e.target.closest(`[data-step]`):null;t instanceof HTMLElement&&this.contains(t)&&this._stepTo(Number.parseInt(t.dataset.step??``,10))},this._onFooterClick=e=>{let t=e.target instanceof Element?e.target.closest(`[data-nav]`):null;if(!(t instanceof HTMLElement)||!this.contains(t)||this.hasAttribute(`disabled`))return;let n=t.dataset.nav;n===`back`?this._back():n===`skip`?this._skip():(n===`next`||n===`finish`)&&this._next()},this._header.addEventListener(`click`,this._onHeaderClick),this._footer.addEventListener(`click`,this._onFooterClick),this._topBar?.addEventListener(`click`,this._onTopBarClick),this._observer=new MutationObserver(()=>this._onStepsMutated()),this._observer.observe(this,{childList:!0}),this._watchGlyphs()}_glyph(e){let t=this.querySelector(_),n=t&&[...t.children].find(t=>t.getAttribute(`data-icon`)===e);if(n)return n.cloneNode(!0);let r=Number.parseInt(this.getAttribute(`icon-size`)??``,10);return(0,o.glyphNode)(e,r>0?{size:r}:void 0)}_watchGlyphs(){this._glyphObserver?.disconnect(),this._glyphObserver=null,this._glyphs=this.querySelector(_),this._glyphs&&(this._glyphObserver=new MutationObserver(()=>this._renderHeader()),this._glyphObserver.observe(this._glyphs,{childList:!0,subtree:!0,attributes:!0,characterData:!0}))}_renderHeader(){if(!this._rendered)return;let e=this._focusedControl();this._header.replaceChildren(...this._headerNodes(this._steps)),this._restoreFocus(e)}_teardown(){this._header&&this._onHeaderClick&&this._header.removeEventListener(`click`,this._onHeaderClick),this._footer&&this._onFooterClick&&this._footer.removeEventListener(`click`,this._onFooterClick),this._topBar?.removeEventListener(`click`,this._onTopBarClick),this._observer?.disconnect(),this._observer=null,this._glyphObserver?.disconnect(),this._glyphObserver=null}_stepTo(e){this.hasAttribute(`disabled`)||!this.hasAttribute(`non-linear`)&&e>=this._active||this._go(e,`step`)}_back(){this._active>0&&this._go(this._active-1,`back`)}async _next(){this._reconcileSteps();let e=this._active,t=this._steps,n=e>=t.length-1,r=t[e];if(!this.dispatchEvent(new CustomEvent(`wui-wizard:beforechange`,{detail:n?{index:e,next:e,reason:`finish`}:{index:e,next:e+1,reason:`next`},cancelable:!0})))return this._flagInvalid(e);if(this._beforeNext){let i;try{i=await this._beforeNext(e)}catch{i=!1}if(this._reconcileSteps(),t=this._steps,e=r?t.indexOf(r):-1,e<0)return;if(n=e>=t.length-1,i===!1)return this._flagInvalid(e)}if(this._invalid.delete(e),this._skipped.delete(e),n)return this._finish();this._go(e+1,`next`)}_skip(){let e=this._active,t=this._steps;(t[e]?.hasAttribute(`optional`)||this.hasAttribute(`skippable`))&&(this._invalid.delete(e),this._skipped.add(e),this.dispatchEvent(new CustomEvent(`wui-wizard:skip`,{detail:{index:e}})),e>=t.length-1?this._finish():this._go(e+1,`skip`))}_flagInvalid(e){this._invalid.add(e),this._renderChrome(),this.dispatchEvent(new CustomEvent(`wui-wizard:invalid`,{detail:{index:e}}))}_finish(){this._invalid.delete(this._active),this._finished=!0,this._renderChrome(),this.dispatchEvent(new CustomEvent(`wui-wizard:finish`,{detail:{index:this._active}}))}_go(e,t){let n=this._reconcileSteps(),r=Math.max(0,n.length-1),i=Math.min(Math.max(e,0),r),a=this._active;this._finished=!1,this._invalid.delete(a),this._active=i,this._reflectActive(i),this._renderChrome(),t!==`silent`&&i!==a&&this.dispatchEvent(new CustomEvent(`wui-wizard:change`,{detail:{index:i,previous:a,reason:t}}))}_reflectActive(e){this._reflecting=!0,this.setAttribute(`active`,String(e)),this._reflecting=!1}},S=e=>e===`pending`||e===`active`||e===`done`||e===`error`||e===`skipped`,C=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),w=class extends a.ElementBase{static get observedAttributes(){return[`label`,`description`,`optional`,`icon`,`status`]}attributeChangedCallback(){let e=this.closest(`wui-wizard`);e&&`refresh`in e&&typeof e.refresh==`function`&&e.refresh()}};(0,t.defineElement)(`wui-wizard-step`,w),(0,t.defineElement)(`wui-wizard`,x),e.WuiWizard=x,e.WuiWizardStep=w})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.buttonClass,WeborityUiElementsInternal.modules.devWarn,WeborityUiElementsInternal.modules.dom,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.iconGlyphs,WeborityUiElementsInternal.modules.stepperHeader,WeborityUiElementsInternal.modules.textStore);
|