@gjsify/example-gtk-adwaita-storybook 0.41.0 → 0.43.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/browser-main.js +33 -26
- package/dist/gjs.js +19 -7
- package/dist/gjs.node.mjs +11 -2
- package/package.json +5 -5
- package/src/browser/buttons/toggle-group.web.ts +8 -4
- package/src/browser/layout/toolbar-view.web.ts +1 -1
- package/src/browser/rows/entry-row.web.ts +1 -0
- package/src/browser/view-switching/tab-view.web.ts +6 -3
package/dist/browser-main.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
var e=Object.defineProperty,__name=(t,n)=>e(t,`name`,{value:n,configurable:!0});let t=function(e){return e.TEXT=`text`,e.NUMBER=`number`,e.BOOLEAN=`boolean`,e.SELECT=`select`,e.RANGE=`range`,e.COLOR=`color`,e}({});function argsFromControls(e=[]){let t={};for(let n of e)t[n.name]=defaultFor(n);return t}function defaultFor(e){if(e.defaultValue!==void 0)return e.defaultValue;switch(e.type){case`text`:return``;case`color`:return`#000000`;case`boolean`:return!1;case`number`:case`range`:return e.min??0;case`select`:return e.options[0]?.value??null;default:return null}}const n=[`Overview`,`Presentation`,`Boxed Lists`,`Controls`,`Buttons`,`Layout`,`View Switching`,`Navigation`,`Feedback`];function orderCategories(e){let t=new Map(n.map((e,t)=>[e,t])),r=[...e].filter(e=>t.has(e));r.sort((e,n)=>t.get(e)-t.get(n));let i=e.filter(e=>!t.has(e));return[...r,...i]}var StoryRegistry=class{constructor(){this.modules=[]}registerStory(e){if(!e||!Array.isArray(e.stories)){console.warn(`Invalid story module provided to registerStory`);return}this.modules.push(e)}registerStories(e){if(!Array.isArray(e)){console.warn(`Invalid story modules array provided to registerStories`);return}let t=e.filter(e=>e&&Array.isArray(e.stories));this.modules.push(...t)}getStories(){return[...this.modules]}createStoryInstances(){for(let e of this.modules)this.instantiateStoriesForModule(e);return[...this.modules]}instantiateStoriesForModule(e){e.instances=[];let t=e.decorators??[];for(let n of e.stories)try{let r=new n,build=()=>{typeof r.initialize==`function`&&r.initialize()};t.reduceRight((e,t)=>()=>t(e,r),build)(),e.instances.push(r)}catch(e){console.error(`Failed to instantiate story: ${n.name||`Unknown`}`,e)}}},StorybookController=class{constructor(e,t){this._registry=new StoryRegistry,this._activeStory=null,this._unsubArgs=null,this._view=e,this._buildControls=t}mount(e,t=!0){this._registry.registerStories(e);let n=this._registry.createStoryInstances(),r=this._groupByCategory(n);if(this._view.renderSidebar(r,e=>this.select(e)),t){let e=r[0]?.stories[0]?.instance??null;e&&this.select(e)}}select(e){this._view.setPreviewTitle(`${e.meta.title} — ${e.story}`),this._view.showPreview(e),this._view.markSelected(e.meta.title),this._wireControls(e),this._activeStory=e}_wireControls(e){this._unsubArgs&&=(this._unsubArgs(),null);let t=this._buildControls(e),n=t.map(e=>e.refresh);this._view.renderControls(t),this._unsubArgs=e.onArgsChanged(e=>{for(let t of n)t(e)})}_groupByCategory(e){let t=new Map;for(let n of e)for(let e of n.instances??[]){let n=e.meta.title.split(`/`),r=n[0],i=n.length>1?n[1]:e.meta.title;t.has(r)||t.set(r,[]),t.get(r).push({instance:e,name:i||`Unnamed`})}return orderCategories([...t.keys()]).map(e=>({category:e,stories:t.get(e)}))}get activeStory(){return this._activeStory}listStories(){return this._registry.getStories().flatMap(e=>(e.instances??[]).map(e=>({title:e.meta.title,story:e.story,category:e.meta.title.split(`/`)[0],controls:e.meta.controls??[]})))}openStoryByTitle(e){let t=this._findByTitle(e);return t?(this.select(t),!0):!1}getCurrentStory(){let e=this._activeStory;return e?{title:e.meta.title,story:e.story,args:e.args}:null}setActiveArg(e,t){let n=this._activeStory;return n?(n.setArg(e,t),!0):!1}_findByTitle(e){for(let t of this._registry.getStories())for(let n of t.instances??[])if(n.meta.title===e)return n;return null}};function controlLabel(e){return e.label||e.name}function bindControl(e,n,r){let i=n.name,a=n.description;switch(n.type){case t.TEXT:{let t=r.text(controlLabel(n),a),o=e.args[i];return t.set(typeof o==`string`?o:``),t.onChange(t=>e.setArg(i,t)),{view:t.node,refresh:e=>{let n=typeof e[i]==`string`?e[i]:``;t.get()!==n&&t.set(n)}}}case t.COLOR:{let t=r.color(controlLabel(n),a),o=e.args[i];return t.set(typeof o==`string`?o:`#000000`),t.onChange(t=>e.setArg(i,t)),{view:t.node,refresh:e=>{let n=typeof e[i]==`string`?e[i]:`#000000`;t.get()!==n&&t.set(n)}}}case t.BOOLEAN:{let t=r.boolean(controlLabel(n),a);return t.set(!!e.args[i]),t.onChange(t=>e.setArg(i,t)),{view:t.node,refresh:e=>{let n=!!e[i];t.get()!==n&&t.set(n)}}}case t.NUMBER:{let t=r.number(n),a=e.args[i];return t.set(typeof a==`number`?a:n.min??0),t.onChange(t=>e.setArg(i,t)),{view:t.node,refresh:e=>{let n=typeof e[i]==`number`?e[i]:0;t.get()!==n&&t.set(n)}}}case t.RANGE:{let t=r.range(n),a=e.args[i],o=typeof a==`number`?a:n.min??0;return t.set(o),t.onChange(t=>e.setArg(i,t)),{view:t.node,refresh:e=>{let n=typeof e[i]==`number`?e[i]:o;t.get()!==n&&t.set(n)}}}case t.SELECT:{let t=n.options;if(!t?.length)return console.warn(`SELECT control "${i}" has no options`),null;let a=r.select(n),o=e.args[i],s=Math.max(0,t.findIndex(e=>e.value===o));return a.set(s),a.onChange(n=>{n>=0&&n<t.length&&e.setArg(i,t[n].value)}),{view:a.node,refresh:e=>{let n=e[i],r=t.findIndex(e=>e.value===n);r>=0&&a.get()!==r&&a.set(r)}}}default:return console.warn(`Unsupported control type: ${n.type}`),null}}var StoryViewBase=class{constructor(){this._listeners=new Set}initBase(e,t,n){this._meta=e,this._story=t,this._args=argsFromControls(e.controls),this._chrome=this.createChrome(e,n),this.refreshChromeText()}get meta(){return this._meta}get story(){return this._story}get args(){return this._args}get root(){return this._chrome.root}set args(e){this._args!==e&&(this._args=e,this.updateArgs(e),this.emitArgs(e))}emitArgs(e){for(let t of this._listeners)t(e)}onArgsChanged(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}setArg(e,t){this.args={...this._args,[e]:t}}initialize(){}updateArgs(e){}teardown(){}addContent(e){this._chrome.hasStage&&this._chrome.setStageContent(e)}refreshChromeText(){let e=this._story?`${this._meta.title} — ${this._story}`:this._meta.title;this._chrome.setChromeText(e,this._meta.description??``)}};const r=[`system`,`light`,`dark`];var StorybookSettings=class{constructor(e=()=>!1){this._colorScheme=`system`,this._accentMode=`system`,this._accent=`blue`,this._listeners=new Set,this._systemDark=e}get colorScheme(){return this._colorScheme}set colorScheme(e){!r.includes(e)||e===this._colorScheme||(this._colorScheme=e,this._notify())}get accentMode(){return this._accentMode}set accentMode(e){e!==this._accentMode&&(this._accentMode=e,this._notify())}get accent(){return this._accent}set accent(e){e!==this._accent&&(this._accent=e,this._notify())}get resolvedAccent(){return this._accentMode===`custom`?this._accent:null}get resolvedDark(){return this._colorScheme===`dark`?!0:this._colorScheme===`light`?!1:this._systemDark()}get state(){return{colorScheme:this._colorScheme,accentMode:this._accentMode,accent:this._accent}}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}systemChanged(){this._colorScheme===`system`&&this._notify()}_notify(){let e=this.state;for(let t of[...this._listeners])try{t(e)}catch{}}},StoryElement=class extends StoryViewBase{constructor(e,t=`Default`,n){super(),this.initBase(e,t,n)}get element(){return this.root}createChrome(e,t){return t?{root:t,hasStage:!1,setStageContent:()=>{},setChromeText:()=>{}}:this._installDefaultChrome()}_installDefaultChrome(){let e=document.createElement(`div`);e.className=`sb-story-page`;let t=document.createElement(`div`);t.className=`sb-story-clamp`;let n=document.createElement(`div`);n.className=`sb-story-group`;let r=document.createElement(`div`);r.className=`sb-story-group-header`;let i=document.createElement(`span`);i.className=`sb-story-group-title`;let a=document.createElement(`span`);a.className=`sb-story-group-description`,r.append(i,a);let o=document.createElement(`div`);return o.className=`story-stage`,n.append(r,o),t.append(n),e.append(t),{root:e,hasStage:!0,setStageContent:e=>o.replaceChildren(e),setChromeText:(e,t)=>{i.textContent=e,a.textContent=t,a.hidden=t.length===0}}}};function createControlRow(e,t){return bindControl(e,t,i)}const i={text(e){let t=document.createElement(`adw-entry-row`);t.setAttribute(`title`,e);let cb=()=>{};return t.addEventListener(`changed`,e=>cb(e.detail.text)),{node:t,get:()=>t.text??``,set:e=>{t.text=e},onChange:e=>{cb=e}}},color(e,t){let n=document.createElement(`adw-action-row`);n.setAttribute(`title`,e),t&&n.setAttribute(`subtitle`,t);let r=document.createElement(`input`);r.type=`color`,r.className=`sb-color-input`,r.slot=`suffix`,n.appendChild(r);let cb=()=>{};return r.addEventListener(`input`,()=>cb(r.value)),{node:n,get:()=>r.value,set:e=>{r.value=e},onChange:e=>{cb=e}}},boolean(e){let t=document.createElement(`adw-switch-row`);t.setAttribute(`title`,e);let cb=()=>{};return t.addEventListener(`notify::active`,e=>cb(e.detail.active)),{node:t,get:()=>t.hasAttribute(`active`),set:e=>{t.toggleAttribute(`active`,e)},onChange:e=>{cb=e}}},number(e){let t=document.createElement(`adw-spin-row`);t.setAttribute(`title`,label(e)),t.setAttribute(`min`,String(e.min??0)),t.setAttribute(`max`,String(e.max??100)),t.setAttribute(`step`,String(e.step??1));let cb=()=>{};return t.addEventListener(`notify::value`,e=>cb(e.detail.value)),{node:t,get:()=>t.value??0,set:e=>{t.value=e},onChange:e=>{cb=e}}},select(e){let t=e.options??[],n=document.createElement(`adw-combo-row`);n.setAttribute(`title`,label(e)),n.setAttribute(`items`,JSON.stringify(t.map(e=>e.label)));let cb=()=>{};return n.addEventListener(`notify::selected`,e=>cb(e.detail.selected)),{node:n,get:()=>n.selected??0,set:e=>{n.selected=e},onChange:e=>{cb=e}}},range(e){let t=e.min??0,n=e.max??100,r=e.step??1,i=Number.isInteger(r),format=e=>i?String(Math.round(e)):e.toFixed(2),a=document.createElement(`div`);a.className=`sb-range-row`;let o=document.createElement(`div`);o.className=`sb-range-header`;let s=document.createElement(`span`);s.className=`sb-range-title`,s.textContent=label(e);let c=document.createElement(`span`);c.className=`sb-range-value`,o.append(s,c);let l=document.createElement(`input`);if(l.type=`range`,l.className=`sb-range-input`,l.min=String(t),l.max=String(n),l.step=String(r),e.description){let t=document.createElement(`span`);t.className=`sb-range-description`,t.textContent=e.description,a.append(o,t,l)}else a.append(o,l);let cb=()=>{};return l.addEventListener(`input`,()=>{let e=parseFloat(l.value);c.textContent=format(e),cb(e)}),{node:a,get:()=>parseFloat(l.value),set:e=>{l.value=String(e),c.textContent=format(e)},onChange:e=>{cb=e}}}};function label(e){return e.label||e.name}const a=/^[ \t\n\v\f\r]+|[ \t\n\v\f\r]+$/g;function gStrStrip(e){return e.replace(a,``)}function stringIsNotEmpty(e){return e!=null&&e.length>0}function glibClamp(e,t,n){return e>n?n:e<t?t:e}function stripMnemonic(e){let t=[...e],n=``,r=0;for(;r<t.length;){if(t[r]!==`_`){n+=t[r],r+=1;continue}let e=t[r+1];if(e===void 0)return n;n+=e===`_`?`_`:e,r+=2}return n}const o={UNKNOWN:0,CUSTOM:1,GPL_2_0:2,GPL_3_0:3,LGPL_2_1:4,LGPL_3_0:5,BSD:6,MIT_X11:7,ARTISTIC:8,GPL_2_0_ONLY:9,GPL_3_0_ONLY:10,LGPL_2_1_ONLY:11,LGPL_3_0_ONLY:12,AGPL_3_0:13,AGPL_3_0_ONLY:14,BSD_3:15,APACHE_2_0:16,MPL_2_0:17,"0BSD":18},s=[{name:null,url:null,spdxId:null},{name:null,url:null,spdxId:null},{name:`GNU General Public License, version 2 or later`,url:`https://www.gnu.org/licenses/old-licenses/gpl-2.0.html`,spdxId:`GPL-2.0-or-later`},{name:`GNU General Public License, version 3 or later`,url:`https://www.gnu.org/licenses/gpl-3.0.html`,spdxId:`GPL-3.0-or-later`},{name:`GNU Lesser General Public License, version 2.1 or later`,url:`https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html`,spdxId:`LGPL-2.1-or-later`},{name:`GNU Lesser General Public License, version 3 or later`,url:`https://www.gnu.org/licenses/lgpl-3.0.html`,spdxId:`LGPL-3.0-or-later`},{name:`BSD 2-Clause License`,url:`https://opensource.org/licenses/bsd-license.php`,spdxId:`BSD-2-Clause`},{name:`The MIT License (MIT)`,url:`https://opensource.org/licenses/mit-license.php`,spdxId:`MIT`},{name:`Artistic License 2.0`,url:`https://opensource.org/licenses/artistic-license-2.0.php`,spdxId:`Artistic-2.0`},{name:`GNU General Public License, version 2 only`,url:`https://www.gnu.org/licenses/old-licenses/gpl-2.0.html`,spdxId:`GPL-2.0-only`},{name:`GNU General Public License, version 3 only`,url:`https://www.gnu.org/licenses/gpl-3.0.html`,spdxId:`GPL-3.0-only`},{name:`GNU Lesser General Public License, version 2.1 only`,url:`https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html`,spdxId:`LGPL-2.1-only`},{name:`GNU Lesser General Public License, version 3 only`,url:`https://www.gnu.org/licenses/lgpl-3.0.html`,spdxId:`LGPL-3.0-only`},{name:`GNU Affero General Public License, version 3 or later`,url:`https://www.gnu.org/licenses/agpl-3.0.html`,spdxId:`AGPL-3.0-or-later`},{name:`GNU Affero General Public License, version 3 only`,url:`https://www.gnu.org/licenses/agpl-3.0.html`,spdxId:`AGPL-3.0-only`},{name:`BSD 3-Clause License`,url:`https://opensource.org/licenses/BSD-3-Clause`,spdxId:`BSD-3-Clause`},{name:`Apache License, Version 2.0`,url:`https://opensource.org/licenses/Apache-2.0`,spdxId:`Apache-2.0`},{name:`Mozilla Public License 2.0`,url:`https://opensource.org/licenses/MPL-2.0`,spdxId:`MPL-2.0`},{name:`BSD Zero-Clause License`,url:`https://opensource.org/license/0bsd`,spdxId:`0BSD`}];o.GPL_2_0_ONLY,o.GPL_3_0_ONLY;function licenseText(e,t){if(e===o.UNKNOWN)return null;if(e===o.CUSTOM)return t;let n=s[e];return`This application comes with absolutely no warranty. See the <a href="%s">%s</a> for details.`.replace(`%s`,()=>n.url??``).replace(`%s`,()=>n.name??``)}o.UNKNOWN;function indexOfUrlEnd(e,t){for(let n=t;n<e.length;n++)if(`
|
|
2
2
|
>`.includes(e[n]))return n;return-1}function parseCreditPerson(e){let t=e.indexOf(`<`),n=t<0?-1:e.indexOf(`>`,t),r=e.indexOf(`http://`),i=e.indexOf(`https://`),a=r;(r<0||i>=0&&i<r)&&(a=i);let o=-1;a>=0&&(o=indexOfUrlEnd(e,a),o<0&&(o=e.length)),a>=0&&(t<0||n<0||a<=t+1)&&(t=a,n=o);let s,c,l;return t>=0&&n>=0?(s=e.slice(0,t),l=e[t]===`<`,c=l?e.slice(t+1,n):e.slice(t,n)):(s=e,c=null,l=!1),s=gStrStrip(s),{name:s,link:c,isEmail:l,uri:c===null?null:l?`mailto:${c}`:c}}const c=[`translator_credits`,`translator-credits`];function translatorCreditsPeople(e){return e==null||c.includes(e)||e.length===0?[]:e.split(`
|
|
3
|
-
`)}const l={developers:`Code by`,designers:`Design by`,artists:`Artwork by`,documenters:`Documentation by`,translators:`Translated by`};function creditsSections(e={}){return[{title:l.developers,people:e.developers??[]},{title:l.designers,people:e.designers??[]},{title:l.artists,people:e.artists??[]},{title:l.documenters,people:e.documenters??[]},{title:l.translators,people:translatorCreditsPeople(e.translatorCredits)},...e.creditSections??[]].filter(e=>e.people.length>0).map(e=>({title:e.title,people:e.people.map(parseCreditPerson)}))}const u={dialogTitle:`About`,whatsNewRow:`What’s _New`,detailsRow:`_Details`,websiteRow:`_Website`,supportRow:`_Support Questions`,issueRow:`_Report an Issue`,troubleshootingRow:`_Troubleshooting`,creditsRow:`_Credits`,legalRow:`_Legal`,acknowledgementsRow:`_Acknowledgements`,whatsNewPage:`What’s New`,detailsPage:`Details`,troubleshootingPage:`Troubleshooting`,creditsPage:`Credits`,legalPage:`Legal`,acknowledgementsPage:`Acknowledgements`};function aboutDialogVisibility(e={}){let t=(e.website??``).length>0,n=(e.comments??``).length>0,r=(e.releaseNotes??``).length>0,i=e.hasCustomLinks??!1,a=n||i,o=t&&n||i,s=(e.supportUrl??``).length>0,c=(e.issueUrl??``).length>0,l=(e.debugInfo??``).length>0,u=e.hasCredits??!1,d=e.hasLegal??!1,f=e.hasAcknowledgements??!1;return{appIcon:(e.applicationIcon??``).length>0,appName:(e.applicationName??``).length>0,developerName:(e.developerName??``).length>0,version:(e.version??``).length>0,detailsGroup:t||n||o||r,whatsNewRow:r,detailsRow:n||o,websiteRow:t&&!a,supportGroup:s||c||l,supportRow:s,issueRow:c,troubleshootingRow:l,creditsLegalGroup:u||d||f,creditsRow:u,legalRow:d,acknowledgementsRow:f,commentsLabel:n,linksGroup:o,detailsWebsiteRow:t&&a}}function legalSectionVisible(e,t,n){let r=licenseText(t,n);return e.length>0||r!==null&&r.length>0}const d=[`blue`,`teal`,`green`,`yellow`,`orange`,`red`,`pink`,`purple`,`slate`],f={blue:`#3584e4`,teal:`#2190a4`,green:`#3a944a`,yellow:`#c88800`,orange:`#ed5b00`,red:`#e62d42`,pink:`#d56199`,purple:`#9141ac`,slate:`#6f8396`};function parseHex(e){let t=/^#([0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;let n=Number.parseInt(t[1],16);return[(n>>16&255)/255,(n>>8&255)/255,(n&255)/255]}function toHex(e,t,n){let channel=e=>Math.round(Math.min(1,Math.max(0,e))*255).toString(16).padStart(2,`0`);return`#${channel(e)}${channel(t)}${channel(n)}`}const toLinear=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4,fromLinear=e=>e<=.0031308?e*12.92:1.055*e**(1/2.4)-.055;function linearToOklab(e,t,n){let r=Math.cbrt(.4122214708*e+.5363325363*t+.0514459929*n),i=Math.cbrt(.2119034982*e+.6806995451*t+.1073969566*n),a=Math.cbrt(.0883024619*e+.2817188376*t+.6299787005*n);return[.2104542553*r+.793617785*i-.0040720468*a,1.9779984951*r-2.428592205*i+.4505937099*a,.0259040371*r+.7827717662*i-.808675766*a]}function oklabToLinear(e,t,n){let r=(e+.3963377774*t+.2158037573*n)**3,i=(e-.1055613458*t-.0638541728*n)**3,a=(e-.0894841775*t-1.291485548*n)**3;return[4.0767416621*r-3.3077115913*i+.2309699292*a,-1.2684380046*r+2.6097574011*i-.3413193965*a,-.0041960863*r-.7034186147*i+1.707614701*a]}function adwaitaStandaloneColor(e,t){let n=parseHex(e);if(!n)return e;let[r,i,a]=linearToOklab(toLinear(n[0]),toLinear(n[1]),toLinear(n[2])),[o,s,c]=oklabToLinear(t?Math.max(r,.85):Math.min(r,.5),i,a);return toHex(fromLinear(o),fromLinear(s),fromLinear(c))}function adwaitaAccentBgColor(e){return f[e]}function adwaitaAccentColor(e,t){return adwaitaStandaloneColor(f[e],t)}function deriveRowLabels(e){let t=e.title??``,n=e.subtitle??``;return{title:t,titleVisible:stringIsNotEmpty(t),subtitle:n,subtitleVisible:stringIsNotEmpty(n)}}var ActionRowState=class{constructor(){this._title=``,this._subtitle=``,this._activatableWidget=null,this._activatable=!1,this._widgetSensitive=!0}get state(){return{...deriveRowLabels({title:this._title,subtitle:this._subtitle}),activatable:this._activatable}}get title(){return this._title}setTitle(e){let t=e??``;return t===this._title?!1:(this._title=t,!0)}get subtitle(){return this._subtitle}setSubtitle(e){let t=e??``;return t===this._subtitle?!1:(this._subtitle=t,!0)}get activatableWidget(){return this._activatableWidget}setActivatableWidget(e,t=!0){return e===this._activatableWidget?!1:(this._activatableWidget=e,this._widgetSensitive=t,e!==null&&(this._activatable=t),!0)}setActivatableWidgetSensitive(e){if(this._activatableWidget===null)return!1;let t=!!e;return t===this._widgetSensitive?!1:(this._widgetSensitive=t,this.setActivatable(t))}get activatable(){return this._activatable}setActivatable(e){let t=!!e;return t===this._activatable?!1:(this._activatable=t,!0)}activate(){return this._activatableWidget}},SwitchRowState=class{constructor(){this._active=!1}get active(){return this._active}setActive(e){let t=!!e;return t===this._active?!1:(this._active=t,!0)}activate(){return this.setActive(!this._active)}},ButtonRowState=class{constructor(){this._title=``,this._startIconName=``,this._endIconName=``}get state(){return{title:this._title,titleVisible:stringIsNotEmpty(this._title),startIconName:this._startIconName,startIconVisible:stringIsNotEmpty(this._startIconName),endIconName:this._endIconName,endIconVisible:stringIsNotEmpty(this._endIconName),activatable:!0}}get title(){return this._title}setTitle(e){let t=e??``;return t===this._title?!1:(this._title=t,!0)}get startIconName(){return this._startIconName}setStartIconName(e){let t=e??``;return t===this._startIconName?!1:(this._startIconName=t,!0)}get endIconName(){return this._endIconName}setEndIconName(e){let t=e??``;return t===this._endIconName?!1:(this._endIconName=t,!0)}},WindowTitleState=class{constructor(){this._title=``,this._subtitle=``}get state(){return deriveRowLabels({title:this._title,subtitle:this._subtitle})}get title(){return this._title}setTitle(e){let t=e??``;return t===this._title?!1:(this._title=t,!0)}get subtitle(){return this._subtitle}setSubtitle(e){let t=e??``;return t===this._subtitle?!1:(this._subtitle=t,!0)}};const ee=[{fg:`#cfe1f5`,start:`#83b6ec`,stop:`#337fdc`},{fg:`#caeaf2`,start:`#7ad9f1`,stop:`#0f9ac8`},{fg:`#cef8d8`,start:`#8de6b1`,stop:`#29ae74`},{fg:`#e6f9d7`,start:`#b5e98a`,stop:`#6ab85b`},{fg:`#f9f4e1`,start:`#f8e359`,stop:`#d29d09`},{fg:`#ffead1`,start:`#ffcb62`,stop:`#d68400`},{fg:`#ffe5c5`,start:`#ffa95a`,stop:`#ed5b00`},{fg:`#f8d2ce`,start:`#f78773`,stop:`#e62d42`},{fg:`#fac7de`,start:`#e973ab`,stop:`#e33b6a`},{fg:`#e7c2e8`,start:`#cb78d4`,stop:`#9945b5`},{fg:`#d5d2f5`,start:`#9e91e8`,stop:`#7a59ca`},{fg:`#f2eade`,start:`#e3cf9c`,stop:`#b08952`},{fg:`#e5d6ca`,start:`#be916d`,stop:`#785336`},{fg:`#d8d7d3`,start:`#c0bfbc`,stop:`#6e6d71`}];function*utf8Bytes(e){for(let t of e){let e=t.codePointAt(0)??0;e>=55296&&e<=57343&&(e=65533),e<128?yield e:e<2048?(yield 192|e>>6,yield 128|e&63):e<65536?(yield 224|e>>12,yield 128|e>>6&63,yield 128|e&63):(yield 240|e>>18,yield 128|e>>12&63,yield 128|e>>6&63,yield 128|e&63)}}function gStrHash(e){let t=5381;for(let n of utf8Bytes(e)){if(n===0)break;t=Math.imul(t,33)+(n>127?n-256:n)>>>0}return t>>>0}function avatarInitials(e){let t=gStrStrip((e??``).toUpperCase()).normalize(`NFC`);if(t.length===0)return``;let n=firstCodePoint(t),r=t.lastIndexOf(` `);return r<0?n:n+firstCodePoint(t.slice(r+1))}function firstCodePoint(e){let t=e.codePointAt(0);return t===void 0?``:String.fromCodePoint(t)}function avatarColorClass(e){return e?gStrHash(e)%14+1:null}function avatarColor(e){let t=avatarColorClass(e);return ee[(t??1)-1]}function avatarMode(e){return e.hasCustomImage?`image`:e.showInitials&&e.text.length>0?`initials`:`icon`}function avatarMaxFontSize(e){return e/1.4142-Math.max(e*.4-5,0)}function avatarFontSize(e,t){let n=avatarMaxFontSize(e);return t.width>0?glibClamp(t.height*(n/t.width),0,n):n}const p=[`suggested-action`],te={title:``,buttonLabel:``,revealed:!1,useMarkup:!0,buttonStyle:`default`};function isBannerButtonStyle(e){return e==="default"||e===`suggested`}function parseBannerButtonStyle(e){return isBannerButtonStyle(e)?e:te.buttonStyle}function bannerButtonStyleClasses(e){return e===`suggested`?p:[]}function bannerButtonVisible(e){return typeof e==`string`&&e.length>0}function bannerButtonText(e){return stripMnemonic(e)}const ne=/^(min|max)-(width|height)\s*:\s*(\d+(?:\.\d+)?)\s*(px|sp|pt)?$/i;function isLeaf(e){return e.op===void 0}function splitOn(e,t){let n=0;for(let r=e.length-1;r>=0;r--){let i=e[r];if(i===`)`)n++;else if(i===`(`)n--;else if(n===0){let n=r-t.length+1;if(n>0&&r+1<e.length&&/\s/.test(e[n-1])&&/\s/.test(e[r+1])&&e.slice(n,r+1).toLowerCase()===t)return{left:e.slice(0,n),right:e.slice(r+1)}}}return null}function splitTopLevel(e){for(let t of[`or`,`and`]){let n=splitOn(e,t);if(n)return{op:t,...n}}return null}function parseBreakpointCondition(e){let t=e.trim();if(!t)return null;let n=splitTopLevel(t);if(n){let e=parseBreakpointCondition(n.left),t=parseBreakpointCondition(n.right);return!e||!t?null:{op:n.op,left:e,right:t}}if(t.startsWith(`(`)&&t.endsWith(`)`))return parseBreakpointCondition(t.slice(1,-1));let r=ne.exec(t);return r?{bound:r[1].toLowerCase(),dimension:r[2].toLowerCase(),value:Number.parseFloat(r[3])}:null}function evaluateBreakpointCondition(e,t){if(isLeaf(e)){let n=e.dimension===`width`?t.width:t.height;return e.bound===`max`?n<=e.value:n>=e.value}let n=evaluateBreakpointCondition(e.left,t);return e.op===`and`?n&&evaluateBreakpointCondition(e.right,t):n||evaluateBreakpointCondition(e.right,t)}var AdwBreakpoint=class{constructor(e,t){this._applied=!1,this.condition=typeof e==`string`?parseBreakpointCondition(e):e??null,this._handlers=t}get applied(){return this._applied}evaluate(e){let t=this.condition?evaluateBreakpointCondition(this.condition,e):!1;return t===this._applied?this._applied:(this._applied=t,t?this._handlers.onApply():this._handlers.onUnapply?.(),this._applied)}};const m=`image-text-button`;function buttonContentIconIsEmpty(e){return e.length===0}function buttonContentIconName(e){return buttonContentIconIsEmpty(e)?`image-missing`:e}function buttonContentLabelText(e,t){return t?stripMnemonic(e):e}const re=[`flat`,`suggested-action`,`destructive-action`,`circular`,`pill`],ie={flat:`flat`,suggested:`suggested-action`,"suggested-action":`suggested-action`,destructive:`destructive-action`,"destructive-action":`destructive-action`,circular:`circular`,pill:`pill`};function buttonStyleClass(e){return e?ie[e]??null:null}function buttonStyleClasses(e){let t=new Set;for(let n of e){let e=buttonStyleClass(n);e&&t.add(e)}return re.filter(e=>t.has(e))}function approx(e,t){return Math.abs(e-t)<2**-52}function carouselSnapPoints(e){let t=0;return e.map(e=>{let n=t+e-1;return t+=e,n})}function carouselPageAllocation(e,t){let n=0;for(let r of t){let t=r.expand?e:glibClamp(r.natural,r.minimum??0,e);n=Math.max(n,t)}return{pageSize:n,leadingInset:(e-n)/2}}function carouselRange(e,t=0){let n=e.length>0?e[e.length-1]:0;return{lower:0,upper:Math.max(0,t+n)}}function carouselClampPosition(e,t,n=0){let r=carouselRange(t,n);return glibClamp(e,r.lower,r.upper)}function carouselClosestSnapPoint(e,t){if(t.length===0)return-1;let n=0;for(let r=1;r<t.length;r++)Math.abs(t[n]-e)>Math.abs(t[r]-e)&&(n=r);return n}function carouselPageAtPosition(e,t){return carouselClosestSnapPoint(carouselClampPosition(e,t),t)}function cRound(e){return Math.sign(e)*Math.round(Math.abs(e))}function carouselNavigateTarget(e,t,n){if(t<=0)return null;let r=cRound(e);return n===`back`?r>0?r-1:null:r<t-1?r+1:null}function carouselWheelStep(e){if(e.source===`touchpad`)return 0;let t=e.source===`mouse`,n=0;return(e.orientation===`vertical`||t)&&(e.deltaY>0?n=1:e.deltaY<0&&(n=-1)),e.orientation===`horizontal`&&n===0&&(e.deltaX>0?n=1:e.deltaX<0&&(n=-1)),n}function carouselReorderShift(e){let{closestPoint:t,oldPoint:n,newPoint:r,size:i}=e;return approx(t,n)?r-n:(approx(n,t)||n>t)&&(approx(t,r)||t>r)?i:(approx(r,t)||r>t)&&(approx(t,n)||t>n)?-i:0}function nthPageDiagnostic(e,t){return`adw_carousel_get_nth_page: assertion 'n < adw_carousel_get_n_pages (self)' failed (n = ${e}, n_pages = ${t})`}function positionDiagnostic(e,t){return`${e}: assertion 'position >= -1' failed (position = ${t})`}function unknownPageDiagnostic(e){return`AdwCarousel: no page with id '${e}'`}function nonFiniteDiagnostic(e,t){return`AdwCarousel: ${e} must be a finite double (got ${t})`}var CarouselState=class{constructor(e={}){this._children=[],this._position=0,this._wheelLockedAt=null,this._settledPage=null,this._listeners=new Set,this._pageChangedListeners=new Set,this._diagnostics=[],this._orientation=e.orientation??`horizontal`,this._interactive=e.interactive??!0,this._allowScrollWheel=e.allowScrollWheel??!0,this._allowLongSwipes=e.allowLongSwipes??!1,this._spacing=e.spacing??0,this._revealDuration=e.revealDuration??0,this._now=e.now??(()=>Date.now()),this._onScrollTo=e.onScrollTo,this._animateScroll=e.animateScroll??!1}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}onPageChanged(e){return this._pageChangedListeners.add(e),()=>{this._pageChangedListeners.delete(e)}}_emit(e,t){let n={position:this._position,nPages:this.nPages,page:this.pageAt(this._position),interactive:t,reason:e};for(let e of[...this._listeners])e(n)}get nPages(){let e=0;for(let t of this._children)t.removing||e++;return e}get ids(){return this._children.filter(e=>!e.removing).map(e=>e.id)}get position(){return this._position}get sizes(){return this._children.map(e=>e.size)}get snapPoints(){return carouselSnapPoints(this.sizes)}get range(){return carouselRange(this.snapPoints)}_visibleSnapPoints(){return this.snapPoints.filter((e,t)=>!this._children[t].removing)}pageAt(e){return carouselPageAtPosition(e,this._visibleSnapPoints())}indexOf(e){let t=0;for(let n of this._children)if(!n.removing){if(n.id===e)return t;t++}return-1}snapPointOf(e){let t=this._nthLink(e);return t<0?void 0:this.snapPoints[t]}_nthLink(e){let t=e;for(let e=0;e<this._children.length;e++)if(!this._children[e].removing&&t--===0)return e;return-1}_closestChildIndex(e,t,n){let r=this.snapPoints,i=[],a=[];this._children.forEach((e,o)=>{e.adding&&!t||e.removing&&!n||(i.push(o),a.push(r[o]))});let o=carouselClosestSnapPoint(e,a);return o<0?-1:i[o]}_updateShiftPositionFlag(e){let t=this._closestChildIndex(this._position,!1,!0);t<0||(this._children[e].shiftPosition=t>=e)}_updateShiftFlags(){this._children.forEach((e,t)=>{(e.adding||e.removing)&&this._updateShiftPositionFlag(t)})}setPosition(e,t=!1){if(!Number.isFinite(e))return this._diagnostics.push(nonFiniteDiagnostic(`position`,e)),!1;let n=carouselClampPosition(e,this.snapPoints),r=n!==this._position;return this._position=n,this._updateShiftFlags(),this._emit(`position`,t),r}scrollTo(e,t={}){let n=this.nPages;if(!Number.isInteger(e)||e<0||e>=n)return this._diagnostics.push(nthPageDiagnostic(e,n)),!1;let r=t.interactive??!1,i=t.animate??this._animateScroll,a=this.snapPointOf(e);return this._onScrollTo?.({index:e,position:a,interactive:r,animate:i}),i||(this.setPosition(a,r),this.settle()),!0}settle(){let e=this.pageAt(this._position);this._settledPage=e;for(let t of[...this._pageChangedListeners])t(e)}settleIfArrived(e=.01){let t=this.pageAt(this._position),n=this.snapPointOf(t);return n===void 0||Math.abs(this._position-n)>=e?(this._settledPage=null,!1):this._settledPage===t?!1:(this.settle(),!0)}navigate(e){if(!this._interactive)return!1;let t=carouselNavigateTarget(this._position,this.nPages,e);return t===null?!1:this.scrollTo(t,{interactive:!0})}handleWheel(e){if(!this._allowScrollWheel||this._wheelLockedAt!==null&&this._now()-this._wheelLockedAt<150||!this._interactive)return 0;let t=this.nPages;if(t===0)return 0;let n=carouselWheelStep({...e,orientation:this._orientation});if(n===0)return 0;let r=glibClamp(this.pageAt(this._position)+n,0,t-1);return this.scrollTo(r,{interactive:!0}),this._wheelLockedAt=this._now(),n}insertPage(e,t=-1){if(!Number.isInteger(t)||t<-1)return this._diagnostics.push(positionDiagnostic(`adw_carousel_insert`,t)),!1;let n={id:e,size:0,adding:!0,removing:!1,shiftPosition:!1},r=t>=0?this._nthLink(t):-1,i=r<0?this._children.length:r;return this._children.splice(i,0,n),this._updateShiftPositionFlag(i),this._emit(`n-pages`,!1),!0}removePage(e){let t=this._children.findIndex(t=>t.id===e&&!t.removing);if(t<0)return this._diagnostics.push(unknownPageDiagnostic(e)),!1;let n=this._children[t];return n.removing=!0,this._updateShiftPositionFlag(t),n.adding&&this._children.splice(t,1),this._emit(`n-pages`,!1),!0}reorderPage(e,t){if(!Number.isInteger(t)||t<-1)return this._diagnostics.push(positionDiagnostic(`adw_carousel_reorder`,t)),!1;let n=this._children.findIndex(t=>t.id===e);if(n<0)return this._diagnostics.push(unknownPageDiagnostic(e)),!1;if(t===n)return!1;let r=this._closestChildIndex(this._position,!0,!0),i=this.snapPoints,a=r<0?0:i[r],o=i[n],s=this.nPages,c=t<0||t>s?s:t;if(n===s-1&&c===s)return!1;let l;l=c===s?-1:c>n?this._nthLink(c+1):this._nthLink(c);let u;u=l>=0?c>n?i[l-1]:i[l]:i[i.length-1];let[d]=this._children.splice(n,1);l<0?this._children.push(d):this._children.splice(l>n?l-1:l,0,d);let f=carouselReorderShift({closestPoint:a,oldPoint:o,newPoint:u,size:d.size});return f===0?(this._emit(`geometry`,!1),!0):(this._position=carouselClampPosition(this._position+f,this.snapPoints),this._updateShiftFlags(),this._emit(`position`,!1),!0)}setPageSize(e,t){if(!Number.isFinite(t))return this._diagnostics.push(nonFiniteDiagnostic(`size of page '${e}'`,t)),!1;let n=this._children.findIndex(t=>t.id===e);if(n<0)return this._diagnostics.push(unknownPageDiagnostic(e)),!1;let r=this._children[n],i=t-r.size,a=r.shiftPosition&&i!==0;return r.size=t,r.removing&&t<=0?this._children.splice(n,1):r.adding&&t>=1&&(r.adding=!1),a?(this._position=carouselClampPosition(this._position+i,this.snapPoints),this._updateShiftFlags(),this._emit(`position`,!1),!0):(this._emit(`geometry`,!1),!0)}skipReveal(e){let t=this._children.find(t=>t.id===e);return!t||!t.adding&&!t.removing?!1:this.setPageSize(e,+!t.removing)}get orientation(){return this._orientation}setOrientation(e){return e===this._orientation?!1:(this._orientation=e,this._emit(`geometry`,!1),!0)}get interactive(){return this._interactive}setInteractive(e){let t=!!e;return t===this._interactive?!1:(this._interactive=t,!0)}get allowScrollWheel(){return this._allowScrollWheel}setAllowScrollWheel(e){let t=!!e;return t===this._allowScrollWheel?!1:(this._allowScrollWheel=t,!0)}get allowLongSwipes(){return this._allowLongSwipes}setAllowLongSwipes(e){let t=!!e;return t===this._allowLongSwipes?!1:(this._allowLongSwipes=t,!0)}get spacing(){return this._spacing}setSpacing(e){return!Number.isFinite(e)||e<0?(this._diagnostics.push(nonFiniteDiagnostic(`spacing`,e)),!1):e===this._spacing?!1:(this._spacing=e,this._emit(`geometry`,!1),!0)}get revealDuration(){return this._revealDuration}setRevealDuration(e){return!Number.isFinite(e)||e<0?(this._diagnostics.push(nonFiniteDiagnostic(`reveal-duration`,e)),!1):e===this._revealDuration?!1:(this._revealDuration=e,!0)}pageDistance(e){return e+this._spacing}get diagnostics(){return this._diagnostics}};function resolveCheckState(e,t){return t?`indeterminate`:e?`checked`:`unchecked`}var RadioGroupState=class{constructor(){this._selected=new Map,this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(e){for(let t of[...this._listeners])t(e)}selected(e){return this._selected.get(e)??null}select(e,t){let n=this._selected.get(e);return n===t?!1:(this._selected.set(e,t),this._emit({name:e,selected:t,deselected:n??null}),!0)}};function adwLerp(e,t,n){return e*(1-n)+t*n}function inverseLerp(e,t,n){return(n-e)/(t-e)}function easeOutCubic(e){let t=e-1;return t*t*t+1}function easeInOutSine(e){return-.5*(Math.cos(Math.PI*e)-1)}const g={maximumSize:600,tighteningThreshold:400};function clampThresholds(e){let t=Math.max(Math.min(e.tighteningThreshold,e.maximumSize),e.childMin),n=Math.max(t,e.maximumSize);return{lower:t,max:n,upper:t+3*(n-t)}}function childSizeFrom(e,t,n){let{lower:r,max:i,upper:a}=t;return e<0?Math.min(n,Math.ceil(i)):e<=r?e:e>=a?Math.ceil(i):Math.floor(adwLerp(r,i,easeOutCubic(inverseLerp(r,a,e))))}const ae=[`small`,`medium`,`large`];function clampAllocate(e,t){let n=clampThresholds(t),r=Math.ceil(n.max),i=Math.ceil(n.lower),a=childSizeFrom(e,n,t.childNat);return{childSize:a,childMaximum:r,lowerThreshold:i,sizeClass:a>=r?`large`:a<=i?`small`:`medium`,offset:Math.trunc((e-a)/2)}}function normalizeClampSize(e,t){let n=typeof e==`string`?Number.parseFloat(e):e??NaN;return Number.isFinite(n)?Math.max(0,Math.trunc(n)):t}const oe={topBarStyle:`flat`,bottomBarStyle:`flat`,extendContentToTopEdge:!1,extendContentToBottomEdge:!1};function parseToolbarStyle(e){return e===`raised`||e===`raised-border`?e:oe.topBarStyle}function toolbarBarStyleClasses(e){switch(e){case`raised`:return[`raised`];case`raised-border`:return[`raised`,`border`];default:return[]}}const se=[`undershoot-top`,`undershoot-bottom`],ce=[`raised`,`border`];function toolbarViewClasses(e){let t=[];return e.topBarStyle===`flat`&&!e.extendContentToTopEdge&&e.topBarHeight>0&&t.push(`undershoot-top`),e.bottomBarStyle===`flat`&&!e.extendContentToBottomEdge&&e.bottomBarHeight>0&&t.push(`undershoot-bottom`),{view:t,topBar:toolbarBarStyleClasses(e.topBarStyle),bottomBar:toolbarBarStyleClasses(e.bottomBarStyle)}}function spinnerGeometry(e,t){let n=Math.min(Math.floor(Math.min(e,t)/2),64/2),r=n*2;return{radius:n,diameter:r,lineWidth:r/8,centerX:Math.round(e/2),centerY:Math.round(t/2)}}function resolveSpinnerSize(e){let t=typeof e==`string`?Number.parseFloat(e):e??NaN;return Number.isFinite(t)?Math.max(t,16):16}const le=new Set([`normal`,`section`,`subtotal`,`total`]);function dataGridTracks(e){let t=e.some(e=>e.width!==void 0||e.flex!==void 0);return e.map((e,n)=>e.width===void 0?e.flex===void 0?!t&&n===0?{kind:`slack`}:{kind:`auto`}:{kind:`flex`,weight:e.flex}:{kind:`fixed`,css:e.width})}function dataGridTrackTemplate(e){return e.map(e=>{switch(e.kind){case`fixed`:return e.css;case`flex`:return`${e.weight}fr`;case`slack`:return`minmax(0px, 1fr)`;case`auto`:return`auto`}}).join(` `)}function dataGridColumnAlign(e){return e.align??(e.numeric?`end`:`start`)}function dataGridColumnClasses(e){let t=[`adw-data-grid-cell`,`align-${dataGridColumnAlign(e)}`];return e.numeric&&t.push(`numeric`),e.monospace&&t.push(`mono`),t}function dataGridCellText(e){return e==null?``:String(e)}function normalizeDataGridVariant(e){return typeof e==`string`&&le.has(e)?e:`normal`}function normalizeDataGridColumns(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&`key`in e).map(e=>({key:String(e.key),label:e.label===void 0?void 0:String(e.label),align:e.align,width:e.width===void 0?void 0:String(e.width),flex:typeof e.flex==`number`?e.flex:void 0,monospace:e.monospace===!0,numeric:e.numeric===!0})):[]}function dataGridRowInteractive(e,t,n){return e===`normal`&&t!==!1&&(t===!0||n)}var AdwAlertResponses=class{constructor(e=``,t=``){this._responses=[],this._defaultResponse=null,this._closeResponse=`close`,this._heading=e??``,this._body=t??``}get heading(){return this._heading}set heading(e){this._heading=e??``}get body(){return this._body}set body(e){this._body=e??``}addResponse(e,t,n={}){let r=this._responses.find(t=>t.id===e);if(r){r.label=t,n.appearance!==void 0&&(r.appearance=n.appearance),n.enabled!==void 0&&(r.enabled=n.enabled);return}this._responses.push({id:e,label:t,appearance:n.appearance??`default`,enabled:n.enabled??!0})}addResponses(...e){for(let t=0;t+1<e.length;t+=2)this.addResponse(e[t],e[t+1])}hasResponse(e){return this._responses.some(t=>t.id===e)}setResponseAppearance(e,t){let n=this._responses.find(t=>t.id===e);n&&(n.appearance=t)}getResponseAppearance(e){return this._responses.find(t=>t.id===e)?.appearance??`default`}setResponseEnabled(e,t){let n=this._responses.find(t=>t.id===e);n&&(n.enabled=t)}getResponseEnabled(e){return this._responses.find(t=>t.id===e)?.enabled??!0}get responses(){return this._responses}get defaultResponse(){return this._defaultResponse}set defaultResponse(e){this._defaultResponse=e}get closeResponse(){return this._closeResponse}set closeResponse(e){this._closeResponse=e||`close`}get usesActionSheet(){return this._responses.length>3}orderResponses(){let e=this._responses.find(e=>e.id===this._defaultResponse)??this._responses[0],t=this._responses.filter(t=>t!==e);return{ok:e,cancel:t[t.length-1],neutral:t.length>=2?t[0]:void 0}}resolveById(e){return e!=null&&this.hasResponse(e)?e:this._closeResponse}resolveLabel(e){return e==null?this._closeResponse:this.resolveById(this._responses.find(t=>t.label===e)?.id)}};function resolveBottomSheetClose(e,t){let n=!!t.open,r=!!t.canClose;switch(e){case`drag-handle`:return`ignored`;case`swipe`:return n&&r?`close`:`ignored`;case`dimming`:return n?r?`close`:`close-attempt`:`ignored`;case`close-button`:return r?n?`close`:`delegate`:`close-attempt`;case`escape`:return r&&n?`close`:`close-attempt`}}var BottomSheetPresentation=class{constructor(e={}){this._open=!1,this._canClose=!0,this._hasBeenOpen=!1,this._listeners=new Set,this._onClosing=e.onClosing,this._onClosed=e.onClosed}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(){for(let e of[...this._listeners])e(this._open)}get open(){return this._open}get canClose(){return this._canClose}get hasBeenOpen(){return this._hasBeenOpen}setCanClose(e){let t=!!e;return t===this._canClose?!1:(this._canClose=t,!0)}setOpen(e){let t=!!e;return this._open===t?(!this._hasBeenOpen&&!t&&(this._onClosing?.(),this._onClosed?.()),!1):(this._open=t,t&&(this._hasBeenOpen=!0),!t&&(this._onClosing?.(),this._open!==t)?!1:(this._emit(),!0))}requestClose(e){let t=resolveBottomSheetClose(e,this);return t===`close`&&this.setOpen(!1),t}finishClose(){return this._open?!1:(this._onClosed?.(),!0)}};const _=65535,v=`Apply`;function entryTextLength(e){return[...e??``].length}function clampEntryText(e,t){let n=e??``;if(!Number.isFinite(t)||t<=0)return n;let r=``,i=0;for(let e of n){if(i>=t)break;r+=e,i++}return r}var EntryRowState=class{constructor(){this._text=``,this._maxLength=0,this._editing=!1,this._editable=!0,this._showApplyButton=!1,this._showIndicator=!1,this._textChanged=!1,this._activatesDefault=!1,this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_update(){let e=this.state;for(let t of[...this._listeners])t(e)}get state(){let e=entryTextLength(this._text),t=e===0&&!(this._editing&&this._editable)&&!this._textChanged;return{text:this._text,textLength:e,empty:t,editing:this._editing,editable:this._editable,textChanged:this._textChanged,editIconVisible:!this._textChanged&&(!this._editing||!this._editable),editIconSensitive:this._editable,indicatorVisible:this._editing&&this._showIndicator,applyButtonVisible:this._textChanged,emptyTarget:+!t}}get text(){return this._text}setText(e){let t=clampEntryText(e??``,this._maxLength);return t===this._text?!1:(this._text=t,this._latchAndUpdate(),!0)}_latchAndUpdate(){this._showApplyButton&&this._editing&&(this._textChanged=!0),this._update()}get textLength(){return entryTextLength(this._text)}get maxLength(){return this._maxLength}setMaxLength(e){let t=Number.isFinite(e)?Math.min(_,Math.max(0,Math.trunc(e))):0;if(t===this._maxLength)return!1;this._maxLength=t;let n=clampEntryText(this._text,t);return n!==this._text&&(this._text=n,this._latchAndUpdate()),!0}get editing(){return this._editing}setEditing(e){let t=!!e;return t===this._editing?!1:(this._editing=t,this._update(),!0)}get editable(){return this._editable}setEditable(e){let t=!!e;return t===this._editable?!1:(this._editable=t,this._update(),!0)}get showApplyButton(){return this._showApplyButton}setShowApplyButton(e){let t=!!e;return t===this._showApplyButton?!1:(this._showApplyButton=t,!t&&this._textChanged&&(this._textChanged=!1,this._update()),!0)}setShowIndicator(e){this._showIndicator=!!e,this._update()}get activatesDefault(){return this._activatesDefault}setActivatesDefault(e){let t=!!e;return t===this._activatesDefault?!1:(this._activatesDefault=t,!0)}get textChanged(){return this._textChanged}apply(){this._textChanged=!1,this._update()}activate(){return this._textChanged?(this.apply(),{signal:`apply`}):{signal:`entry-activated`,activateDefault:this._activatesDefault}}},PasswordEntryRowState=class{constructor(e){this._revealed=!1,this._capsLockOn=!1,this._listeners=new Set,this._entry=e}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(){let e=this.state;for(let t of[...this._listeners])t(e)}get state(){return{revealed:this._revealed,capsLockOn:this._capsLockOn,peekIconName:this._revealed?`view-conceal-symbolic`:`view-reveal-symbolic`,peekLabel:this._revealed?`Hide Password`:`Show Password`,indicatorIconName:`caps-lock-symbolic`,indicatorTooltip:`Caps Lock is on`}}get revealed(){return this._revealed}setRevealed(e){let t=!!e;return t===this._revealed?!1:(this._revealed=t,this._pushIndicator(),this._emit(),!0)}togglePeek(){return this.setRevealed(!this._revealed)}get capsLockOn(){return this._capsLockOn}setCapsLockOn(e){let t=!!e;return t===this._capsLockOn?!1:(this._capsLockOn=t,this._pushIndicator(),this._emit(),!0)}_pushIndicator(){this._entry.setShowIndicator(!this._revealed&&this._capsLockOn)}},AdwToast=class{constructor(e=``,t={}){this.title=e,this.timeout=t.timeout??5e3,this.buttonLabel=t.buttonLabel??``}get hasButton(){return this.buttonLabel.length>0}},AdwToastQueue=class{constructor(e){this._pending=[],this._current=null,this._timer=null,this._scheduler=e.scheduler,this._handlers={onShow:e.onShow,onHide:e.onHide}}get current(){return this._current}get showing(){return this._current!==null}get pending(){return this._pending.length}add(e){this._current===null?this._show(e):this._pending.push(e)}dismiss(){if(this._current===null)return;let e=this._current;this._clearTimer(),this._current=null,this._handlers.onHide(e);let t=this._pending.shift();t&&this._show(t)}clear(){if(this._pending.length=0,this._current===null)return;let e=this._current;this._clearTimer(),this._current=null,this._handlers.onHide(e)}_show(e){this._current=e,this._handlers.onShow(e),e.timeout>0&&(this._timer=this._scheduler.schedule(()=>{this._current===e&&this.dismiss()},e.timeout))}_clearTimer(){this._timer!==null&&(this._scheduler.cancel(this._timer),this._timer=null)}},ExpanderState=class{constructor(){this._expanded=!1,this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(){for(let e of[...this._listeners])e(this._expanded)}get expanded(){return this._expanded}setExpanded(e){let t=!!e;return t===this._expanded?!1:(this._expanded=t,this._emit(),!0)}toggle(){return this.setExpanded(!this._expanded)}expand(){return this.setExpanded(!0)}collapse(){return this.setExpanded(!1)}};function normalizeComboOptions(e){return Array.isArray(e)?e.map(e=>{if(typeof e==`string`)return{value:e,label:e};let t=e?.value===void 0?String(e?.label??``):String(e.value);return{value:t,label:e?.label===void 0?t:String(e.label)}}):[]}var ComboState=class{constructor(){this._options=[],this._selected=0,this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(e){let t={selected:this._selected,value:this.selectedValue,label:this.selectedLabel,interactive:e};for(let e of[...this._listeners])e(t)}_setIndex(e,t){return e===this._selected?!1:(this._selected=e,this._emit(t),!0)}get options(){return this._options}setOptions(e){this._options=Array.isArray(e)?e:[],this.hasIndex(this._selected)||(this._selected=this._options.length===0?-1:0),this._emit(!1)}get selectedIndex(){return this._selected}get presentsChooser(){return this._options.length>1}setSelectedIndex(e){return this._setIndex(Number.isFinite(e)?e:0,!1)}get selectedValue(){return this._options[this._selected]?.value??``}get selectedLabel(){return this._options[this._selected]?.label??``}setSelectedValue(e){let t=this._options.findIndex(t=>t.value===e);return t>=0?this.setSelectedIndex(t):!1}hasIndex(e){return Number.isFinite(e)&&e>=0&&e<this._options.length}select(e){return!this.hasIndex(e)||e===this._selected?!1:this._setIndex(e,!0)}get count(){return this._options.length}},SpinState=class{constructor(){this._value=0,this._min=0,this._max=100,this._step=1,this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(e){let t={value:this._value,interactive:e};for(let e of[...this._listeners])e(t)}_clamp(e){return Math.min(this._max,Math.max(this._min,e))}_bump(e){let t=this._clamp(this._value+e);return t===this._value?!1:(this._value=t,this._emit(!0),!0)}_reclamp(){let e=this._clamp(this._value);return e===this._value?!1:(this._value=e,this._emit(!1),!0)}get value(){return this._value}get min(){return this._min}get max(){return this._max}get step(){return this._step}setValue(e){let t=this._clamp(Number.isFinite(e)?e:0);return t===this._value?!1:(this._value=t,this._emit(!1),!0)}setMin(e){return this._min=Number.isFinite(e)?e:0,this._reclamp()}setMax(e){return this._max=Number.isFinite(e)?e:0,this._reclamp()}setStep(e){this._step=Number.isFinite(e)&&e>0?e:1}increment(){return this._bump(this._step)}decrement(){return this._bump(-this._step)}},ToggleGroupState=class{constructor(){this._labels=[],this._selected=0,this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(){let e={selected:this._selected,value:this.selectedValue};for(let t of[...this._listeners])t(e)}get labels(){return this._labels}setLabels(e){this._labels=Array.isArray(e)?e:[],this._selected>=this._labels.length&&(this._selected=0)}get selected(){return this._selected}setSelected(e){let t=Number.isFinite(e)?e:0;return t===this._selected||t<0||t>=this._labels.length?!1:(this._selected=t,this._emit(),!0)}get selectedValue(){return this._labels[this._selected]??``}get count(){return this._labels.length}};function resolvePageTitle(e,t){return e??t}const ue=/^[A-Za-z0-9_-]+$/;function normalizeIconName(e){let t=(e??``).replace(/-symbolic$/,``);return ue.test(t)?t:``}function nameNotFoundDiagnostic(e){return`Child name '${e}' not found in AdwViewStack`}function duplicateNameDiagnostic(e){return`While adding page: duplicate child name in AdwViewStack: ${e}`}var ViewStackState=class{constructor(){this._pages=[],this._visibleIndex=-1,this._listeners=new Set,this._diagnostics=[],this._pagesView=null}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(e){let t=this._pageAt(this._visibleIndex),n={index:this._visibleIndex,name:t?.name??``,title:t?.title??``,page:t,interactive:e};for(let e of[...this._listeners])e(n)}_pageAt(e){return e>=0&&e<this._pages.length?this._pages[e]:void 0}_firstVisibleIndex(){return this._pages.findIndex(e=>e.visible)}_record(e){return{name:e.name,title:resolvePageTitle(e.title,e.name),icon:normalizeIconName(e.icon),content:e.content,visible:e.visible??!0,badgeNumber:Number.isFinite(e.badgeNumber)?Math.trunc(e.badgeNumber):0,needsAttention:e.needsAttention===!0,useUnderline:e.useUnderline===!0}}get pages(){return this._pagesView??=Object.freeze(this._pages.slice()),this._pagesView}get count(){return this._pages.length}indexOfName(e){return this._pages.findIndex(t=>t.name===e)}isSelected(e){return!Number.isInteger(e)||e<0||e>=this._pages.length?!1:e===this._visibleIndex}addPage(e){return this._insertRecord(this._record(e),this._pages.length)}insertPage(e,t){return!Number.isInteger(t)||t<0||t>this._pages.length?null:this._insertRecord(this._record(e),t)}_insertRecord(e,t){return this.indexOfName(e.name)>=0&&this._diagnostics.push(duplicateNameDiagnostic(e.name)),this._pages.splice(t,0,e),this._pagesView=null,this._visibleIndex<0?(e.visible&&(this._visibleIndex=t,this._emit(!1)),e):(t<=this._visibleIndex&&(this._visibleIndex+=1),e)}movePage(e,t){if(!Number.isInteger(e)||!Number.isInteger(t)||e<0||e>=this._pages.length||t<0||t>=this._pages.length||e===t)return!1;let[n]=this._pages.splice(e,1);if(this._pages.splice(t,0,n),this._pagesView=null,this._visibleIndex===e)this._visibleIndex=t;else{let n=this._visibleIndex;n>e&&--n,n>=t&&(n+=1),this._visibleIndex=n}return!0}removePage(e){let t=this.indexOfName(e);return t<0?!1:(this._pages.splice(t,1),this._pagesView=null,t===this._visibleIndex?this._visibleIndex=-1:t<this._visibleIndex&&--this._visibleIndex,!0)}get visibleIndex(){return this._visibleIndex}setVisibleIndex(e,t=!0){return!Number.isInteger(e)||e<0||e>=this._pages.length||e===this._visibleIndex||!this._pages[e].visible?!1:(this._visibleIndex=e,this._emit(t),!0)}get visibleName(){return this._pageAt(this._visibleIndex)?.name??``}setVisibleName(e,t=!0){if(e==null)return!1;let n=this.indexOfName(e);return n<0?(this._diagnostics.push(nameNotFoundDiagnostic(e)),!1):this.setVisibleIndex(n,t)}get visiblePage(){return this._pageAt(this._visibleIndex)}get visibleTitle(){return this._pageAt(this._visibleIndex)?.title??``}setPageVisible(e,t){let n=this.indexOfName(e);if(n<0)return this._diagnostics.push(nameNotFoundDiagnostic(e)),!1;let r=this._pages[n],i=!!t;return r.visible===i?!1:(r.visible=i,this._visibleIndex<0&&i?(this._visibleIndex=n,this._emit(!1),!0):this._visibleIndex===n&&!i?(this._visibleIndex=this._firstVisibleIndex(),this._emit(!1),!0):!1)}get duplicateNames(){let e=new Set,t=[];for(let n of this._pages)e.has(n.name)?t.includes(n.name)||t.push(n.name):e.add(n.name);return t}get diagnostics(){return this._diagnostics}};const y=`Back`;function describeNavigationDiagnostic(e){switch(e.code){case`duplicate-tag`:return`Duplicate page tag in AdwNavigationView: ${e.tag}`;case`already-in-stack`:return e.tag===void 0?`Page '${e.title}' is already in navigation stack`:`Page with the tag '${e.tag}' is already in navigation stack`;case`tag-not-found`:return`No page with the tag '${e.tag}' found in AdwNavigationView`;case`not-in-stack`:return`Page '${e.title}' is not in the navigation stack`}}var NavigationViewState=class{constructor(e={}){this._registry=new Map,this._tags=new Map,this._stack=[],this._listeners=new Set,this._pendingRemoval=null,this._animateTransitions=e.animateTransitions??!0,this._popOnEscape=e.popOnEscape??!0,this._onDiagnostic=e.onDiagnostic??null}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}get stack(){return[...this._stack]}get depth(){return this._stack.length}get pages(){return[...this._registry.keys()]}get visiblePage(){return this._stack.length===0?null:this._stack[this._stack.length-1]}get visiblePageTag(){let e=this.visiblePage;return e===null?null:this.tagOf(e)}get animateTransitions(){return this._animateTransitions}get popOnEscape(){return this._popOnEscape}setAnimateTransitions(e){let t=!!e;return t===this._animateTransitions?!1:(this._animateTransitions=t,!0)}setPopOnEscape(e){let t=!!e;return t===this._popOnEscape?!1:(this._popOnEscape=t,!0)}isRegistered(e){return this._registry.has(e)}isInStack(e){return this._stack.includes(e)}isRemoveOnPop(e){return this._registry.get(e)?.removeOnPop===!0}tagOf(e){return this._registry.get(e)?.tag??null}titleOf(e){return this._registry.get(e)?.title??``}canPopOf(e){return this._registry.get(e)?.canPop??!0}findPage(e){return this._tags.get(e)??null}getPreviousPage(e){let t=this._stack.indexOf(e);return t<=0?null:this._stack[t-1]}add(e,t={}){let n=this._registry.get(e);return n===void 0?this._addPage(e,t,!0):n.removeOnPop&&this._stack.includes(e)?(n.removeOnPop=!1,!0):(n.tag!==null&&this._diagnose({code:`duplicate-tag`,tag:n.tag}),!1)}remove(e){let t=this._registry.get(e);return t===void 0?!1:(this._pendingRemoval===e&&(this._pendingRemoval=null),this._stack.includes(e)?(t.removeOnPop=!0,!0):(this._unregister(e),!0))}setTag(e,t){let n=this._registry.get(e);if(n===void 0)return!1;let r=t??null;return r===n.tag?!1:r!==null&&this._tags.has(r)?(this._diagnose({code:`duplicate-tag`,tag:r}),!1):(n.tag!==null&&this._tags.delete(n.tag),n.tag=r,r!==null&&this._tags.set(r,e),!0)}setTitle(e,t){if(typeof t!=`string`)return!1;let n=this._registry.get(e);return n===void 0||n.title===t?!1:(n.title=t,!0)}setCanPop(e,t){let n=this._registry.get(e);if(n===void 0)return!1;let r=!!t;return r===n.canPop?!1:(n.canPop=r,!0)}push(e,t={}){return this._maybeAddPage(e,t)?this._pushToStack(e,`push`,this._animateTransitions,!1):!1}pushByTag(e){let t=this.findPage(e);return t===null?(this._diagnose({code:`tag-not-found`,tag:e}),!1):this._pushToStack(t,`push`,this._animateTransitions,!0)}pop(){let e=this.visiblePage;if(e===null)return!1;let t=this.getPreviousPage(e);return t===null?!1:(this._popFromStack(t,this._animateTransitions),!0)}popToPage(e){return e===this.visiblePage?!1:this._stack.includes(e)?(this._popFromStack(e,this._animateTransitions),!0):(this._diagnose({code:`not-in-stack`,title:this.titleOf(e)}),!1)}popToTag(e){let t=this.findPage(e);return t===null?(this._diagnose({code:`tag-not-found`,tag:e}),!1):this.popToPage(t)}replace(e,t){let n=this.visiblePage,r=n,i=n!==null,a=!1,o=[],s=new Set;for(let t of e)t!=null&&s.add(t);for(let e=this._stack.length-1;e>=0;e--){let t=this._stack[e],n=this._registry.get(t);n===void 0||!n.removeOnPop||s.has(t)||(t===r&&(a=n.tag!==null,r=null),this._unregister(t)&&o.push(t))}this._stack.length=0;let c=new Set;for(let n of e)if(n!=null){if(c.has(n)){this._diagnose({code:`already-in-stack`,title:this.titleOf(n)});continue}this._maybeAddPage(n,t?.(n)??{})&&(c.add(n),this._stack.push(n))}let l=this.visiblePage,u;u=l===null?r===null?{animate:!1,tagNotify:i&&a,removeAfterTransition:null}:this._beginSwitch(r,null,!0,!1,o):r===l?{animate:!1,tagNotify:!1,removeAfterTransition:null}:this._beginSwitch(r,l,!0,!1,o),this._emitChange(`replace`,n,!0,[],o,u)}replaceWithTags(e){let t=e.map(e=>{let t=this.findPage(e);return t===null&&this._diagnose({code:`tag-not-found`,tag:e}),t});this.replace(t)}finishTransition(){let e=this._resolvePendingRemoval();return e===null?[]:[e]}canGoBack(){let e=this.visiblePage;return e===null||!this.canPopOf(e)?!1:this.getPreviousPage(e)!==null}backButtonTooltip(e=y){if(!this.canGoBack())return null;let t=this.getPreviousPage(this.visiblePage);if(t===null)return null;let n=this.titleOf(t);return n.length>0?n:e}popFromShortcut(){let e=this.visiblePage;return e===null?`propagate`:this.canPopOf(e)?this.pop()?`stop`:`propagate`:`stop`}popFromEscape(){return this._popOnEscape?this.popFromShortcut():`propagate`}_diagnose(e){this._onDiagnostic?.(e)}_emit(e){for(let t of[...this._listeners])t(e)}_emitChange(e,t,n,r,i,a){let o=this.visiblePage;this._emit({stack:[...this._stack],visiblePage:o,visiblePageTag:o===null?null:this.tagOf(o),previousVisiblePage:t,reason:e,popped:[...r],removed:[...i],removeAfterTransition:a.removeAfterTransition,animate:a.animate,pop:n,tagNotify:a.tagNotify})}_addPage(e,t,n){let r=t.tag??null;return r!==null&&this._tags.has(r)?(this._diagnose({code:`duplicate-tag`,tag:r}),!1):(this._registry.set(e,{tag:r,title:t.title??``,canPop:t.canPop===void 0?!0:!!t.canPop,removeOnPop:!1}),r!==null&&this._tags.set(r,e),n&&this._stack.length===0&&this._pushToStack(e,`add`,!1,!1),!0)}_maybeAddPage(e,t){if(this._registry.has(e))return!0;let n=t.tag??null;if(n!==null&&this._tags.has(n))return this._diagnose({code:`duplicate-tag`,tag:n}),!1;if(!this._addPage(e,t,!1))return!1;let r=this._registry.get(e);return r!==void 0&&(r.removeOnPop=!0),!0}_pushToStack(e,t,n,r){if(this._stack.includes(e))return this._diagnose(r?{code:`already-in-stack`,tag:this.tagOf(e)}:{code:`already-in-stack`,title:this.titleOf(e)}),!1;let i=this.visiblePage,a=[];this._stack.push(e);let o=this._beginSwitch(i,e,!1,n,a);return this._emitChange(t,i,!1,[],a,o),!0}_popFromStack(e,t){let n=this.visiblePage;if(e===n)return;let r=this._stack.indexOf(e),i=this._stack.slice(r+1).reverse();this._stack.length=r+1;let a=[],o=this._beginSwitch(n,e,!0,t,a);for(let e of i)e!==n&&this._registry.get(e)?.removeOnPop===!0&&this._unregister(e)&&a.push(e);this._emitChange(`pop`,n,!0,i,a,o)}_beginSwitch(e,t,n,r,i){if(this._pendingRemoval!==null&&this._pendingRemoval!==e){let e=this._resolvePendingRemoval();e!==null&&i.push(e)}let a=null;return n&&e!==null&&this._registry.get(e)?.removeOnPop===!0&&!this._stack.includes(e)&&(a=e,this._pendingRemoval=e),{animate:r&&e!==null,tagNotify:e!==null&&this.tagOf(e)!==null||t!==null&&this.tagOf(t)!==null,removeAfterTransition:a}}_resolvePendingRemoval(){let e=this._pendingRemoval;if(e===null)return null;if(this._pendingRemoval=null,this._stack.includes(e)){let t=this._registry.get(e);return t!==void 0&&(t.removeOnPop=!0),null}return this._unregister(e)?e:null}_unregister(e){let t=this._registry.get(e);return t===void 0?!1:(t.tag!==null&&this._tags.get(t.tag)===e&&this._tags.delete(t.tag),this._registry.delete(e),!0)}};function clampSidebarSelection(e,t){return!Number.isInteger(e)||e<0||e>=t?-1:e}function adjustSidebarSelection(e,t,n,r,i,a){if(t===0&&n>0)return clampSidebarSelection(0,n);let o=e>>>0,s=r>>>0;return s<=o&&s+i>o?-1:s<=o?clampSidebarSelection(o+a-i>>>0,n):e}function flattenSidebarItems(e,t){let n=[],r=[],i=0;return e.forEach((e,a)=>{r.push(i),e.items.forEach((e,r)=>{let o=i+r;t&&!t(e,o)||n.push({index:o,sectionIndex:a,sectionItemIndex:r,item:e,titleVisible:stringIsNotEmpty(e.title),subtitleVisible:stringIsNotEmpty(e.subtitle),iconVisible:stringIsNotEmpty(e.iconName)})}),i+=e.items.length}),{items:n,sectionFirstIndex:r}}function deriveSidebarHeaders(e,t){let n=[],r=null;for(let i of t){if(r===i.sectionIndex)continue;let t=r===null;r=i.sectionIndex;let a=e[i.sectionIndex]?.title??``;t&&a.length===0||n.push({sectionIndex:i.sectionIndex,kind:a.length>0?`title`:`separator`,title:a,first:t})}return n}var SidebarState=class{constructor(){this._mode=`sidebar`,this._sections=[],this._filter=null,this._selected=-1,this._items=[],this._sectionFirstIndex=[],this._visibleItems=[],this._headers=[],this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(e,t){let n={selected:this._selected,previous:e,item:this.selectedItem,interactive:t};for(let e of[...this._listeners])e(n)}_applySelected(e,t){if(e===this._selected)return!1;let n=this._selected;return this._selected=e,this._emit(n,t),!0}_invalidate(){let e=flattenSidebarItems(this._sections),t=this._filter;this._items=e.items,this._sectionFirstIndex=e.sectionFirstIndex,this._visibleItems=t?this._items.filter(e=>t(e.item,e.index)):this._items,this._headers=deriveSidebarHeaders(this._sections,this._visibleItems)}get mode(){return this._mode}setMode(e){return e===this._mode?!1:(this._mode=e,!0)}get selectionVisible(){return this._mode===`sidebar`}get sections(){return this._sections}setSections(e){let t=this.count;this._sections=[...e],this._invalidate();let n=adjustSidebarSelection(adjustSidebarSelection(this._selected,t,0,0,t,0),0,this.count,0,0,this.count);this._applySelected(n,!1)}insertSection(e,t){let n=this.count,r=this._sections.length,i=Number.isInteger(t)&&t>=0&&t<r?t:r;this._sections.splice(i,0,e),this._invalidate();let a=this._sectionFirstIndex[i]??0,o=adjustSidebarSelection(this._selected,n,this.count,a,0,e.items.length);return this._applySelected(o,!1),i}removeSectionAt(e){let t=this.sectionAt(e);if(!t)return!1;let n=this.count,r=this._sectionFirstIndex[e]??0,i=t.items.length;return this._sections.splice(e,1),this._invalidate(),this._applySelected(adjustSidebarSelection(this._selected,n,this.count,r,i,0),!1),!0}removeAllSections(){let e=this.count;this._sections=[],this._invalidate(),this._applySelected(adjustSidebarSelection(this._selected,e,0,0,e,0),!1)}refresh(){this._invalidate()}sectionAt(e){if(!(!Number.isInteger(e)||e<0))return this._sections[e]}sectionFirstIndex(e){return this._sectionFirstIndex[e]??0}get count(){return this._items.length}get items(){return this._items}itemAt(e){if(!(!Number.isInteger(e)||e<0))return this._items[e]?.item}get filter(){return this._filter}setFilter(e){e!==this._filter&&(this._filter=e,this._invalidate())}get visibleItems(){return this._visibleItems}get headers(){return this._headers}get isEmpty(){return this._visibleItems.length===0}get selected(){return this._selected}get selectedItem(){return this.itemAt(this._selected)}setSelected(e){return this._applySelected(clampSidebarSelection(e,this.count),!1)}activate(e){let t=this._visibleItems.find(t=>t.index===e);return!t||t.item.visible===!1||t.item.enabled===!1?{index:e,activated:!1,selectionChanged:!1}:{index:e,activated:!0,selectionChanged:this._applySelected(clampSidebarSelection(e,this.count),!0)}}};const b=1200,x=Math.PI*.35,S=Math.PI*.015,C=Math.PI*.9,w=Math.PI*.9,T=Math.PI*.7,E=Math.PI*1.1,de=Math.PI*1.35,D=w+E+de-T;53*Math.PI*2/D;const fe=E-T/2;function normalizeSpinnerAngle(e){let t=e;for(;t<0;)t+=Math.PI*2;for(;t>Math.PI*2;)t-=Math.PI*2;return t}function spinnerArcStart(e){let t=e%D,n=t>E?1:easeInOutSine(t/E);return adwLerp(S,C,n)-t*C/D}function spinnerArcEnd(e){let t=e%D,n=E-T,r;return r=t<n?0:t>D-w?1:easeInOutSine((t-n)/de),adwLerp(0,C-S,r)-t*C/D}function spinnerArc(e){let t=e,n=normalizeSpinnerAngle(t+spinnerArcStart(t)+x),r=normalizeSpinnerAngle(t+spinnerArcEnd(t)+x),i=n-r;for(;i<=0;)i+=Math.PI*2;return{start:n,end:r,length:i}}function spinnerProgressAt(e){let t=b*53;return(e%t+t)%t/b*Math.PI*2}const pe={shift:`shift`,shft:`shift`,control:`control`,ctrl:`control`,ctl:`control`,alt:`alt`,mod1:`alt`,meta:`meta`,super:`super`,hyper:`hyper`,primary:`primary`},me=[`hyper`,`super`,`control`,`alt`,`shift`,`meta`],he={hyper:{default:`Hyper`,apple:`Hyper`},super:{default:`Super`,apple:`Super`},control:{default:`Ctrl`,apple:`⌃`},alt:{default:`Alt`,apple:`⌥`},shift:{default:`Shift`,apple:`⇧`},meta:{default:`Meta`,apple:`⌘`}},ge={Shift:`shift`,Control:`control`,Alt:`alt`,Meta:`meta`,Super:`super`,Hyper:`hyper`},_e={exclam:`!`,quotedbl:`"`,numbersign:`#`,dollar:`$`,percent:`%`,ampersand:`&`,apostrophe:`'`,parenleft:`(`,parenright:`)`,asterisk:`*`,plus:`+`,comma:`,`,minus:`-`,period:`.`,slash:`/`,colon:`:`,semicolon:`;`,less:`<`,equal:`=`,greater:`>`,question:`?`,at:`@`,bracketleft:`[`,backslash:`\\`,bracketright:`]`,asciicircum:`^`,underscore:`_`,grave:"`",braceleft:`{`,bar:`|`,braceright:`}`,asciitilde:`~`},ve={Left:{default:`←`},Up:{default:`↑`},Right:{default:`→`},Down:{default:`↓`},space:{default:`␣`},Return:{default:`⏎`},Page_Up:{default:`Page_Up`},Page_Down:{default:`Page_Down`},Escape:{apple:`⎋`},Tab:{apple:`⇥`},BackSpace:{apple:`⌫`},Delete:{apple:`⌦`}};function parseAccelerator(e,t=`default`){let n=new Set,r=e;for(;r.startsWith(`<`);){let e=r.indexOf(`>`);if(e===-1)return null;let i=r.slice(1,e).toLowerCase();if(r=r.slice(e+1),i===`release`)continue;let a=pe[i];if(!a)return null;n.add(a===`primary`?t===`apple`?`meta`:`control`:a)}return r.length===0?null:{modifiers:n,key:r}}function keycapForKey(e,t){let n=/^([A-Za-z]+)_([LR])$/.exec(e);if(n&&ge[n[1]]){let e=ge[n[1]];return{label:he[e][t],sideMarker:n[2]}}let r=ve[e];if(r){let e=t===`apple`?r.apple??r.default:r.default;if(e)return{label:e}}let i=/^KP_(.+)$/.exec(e);if(i){let e=printableFor(i[1]);if(e)return{label:`KP ${e.toUpperCase()}`}}let a=printableFor(e);return a?{label:a===`\\`?`Backslash`:a.toUpperCase()}:{label:e.length===1?e.toUpperCase():e}}function printableFor(e){if(e.length===1){let t=e.codePointAt(0)??0;return t>32&&t<127?e:null}return _e[e]??null}function shortcutKeycaps(e,t=`default`){let n=parseAccelerator(e,t);if(!n)return null;let r=[];for(let e of me)n.modifiers.has(e)&&r.push({label:he[e][t]});return r.push(keycapForKey(n.key,t)),r}function accessibleFor(e){return e.map(e=>e.sideMarker?`${e.label} ${e.sideMarker}`:e.label).join(`+`)}function parseShortcutLabel(e,t={}){let{disabledText:n=``,direction:r=`ltr`,platform:i=`default`}=t;if(e.length===0)return{nodes:[{kind:`disabled`,text:n}],accessibleLabel:n,error:null};let a=[],o=``,s=null,combination=e=>{for(let t of e.split(`&`)){let e=shortcutKeycaps(t,i);if(!e)return s=t,!1;a.push({kind:`keys`,keys:e}),o+=accessibleFor(e)}return!0},sequence=e=>{let t=r===`rtl`?`←`:`→`,n=e.split(`+`);for(let[e,r]of n.entries())if(e>0&&(a.push({kind:`separator`,text:t}),o+=t),!combination(r))return!1;return!0},range=e=>{let t=e.indexOf(`...`);return t===-1?sequence(e):sequence(e.slice(0,t))?(a.push({kind:`separator`,text:`⋯`}),o+=`…`,sequence(e.slice(t+3))):!1};for(let[t,n]of e.split(` `).entries())if(t>0&&(a.push({kind:`separator`,text:`/`}),o+=` `),!range(n))break;return{nodes:a,accessibleLabel:o,error:s}}const ye=[`px`,`pt`,`sp`];function adwLengthToPx(e,t,n=96){switch(e){case`pt`:return t*n/72;case`sp`:return t*n/96;default:return t}}function normalizeLengthUnit(e,t){return ye.includes(e)?e:t}function isSidebarAtVisualStart(e,t=`ltr`){return e===`start`==(t!==`rtl`)}function fractionOf(e){return e.sidebarWidthFraction??.25}function resolveSidebarBounds(e,t=0,n={}){let r=e.sidebarWidthUnit??`sp`,i=e.dpi??96,a=n.ceil?Math.ceil:Math.trunc,o=adwLengthToPx(r,e.minSidebarWidth??180,i),s=adwLengthToPx(r,e.maxSidebarWidth??280,i),c=a(Math.max(t,o));return{min:c,max:a(Math.max(c,s))}}function resolveOverlaySidebarWidth(e){let t=resolveSidebarBounds(e,e.sidebarChildMin??0,{ceil:!0});if(e.collapsed)return glibClamp(e.totalWidth,t.min,t.max);let n=glibClamp(Math.trunc(e.totalWidth*fractionOf(e)),t.min,t.max);return Math.min(n,e.totalWidth-(e.contentMin??0))}function layoutOverlaySplitView(e){let{totalWidth:t,showProgress:n,collapsed:r}=e,i=e.sidebarWidth,a=isSidebarAtVisualStart(e.sidebarPosition??`start`,e.direction??`ltr`),o=i,s=Math.trunc(i*n),c=s>i,l={shieldVisible:r&&n>0,sidebarPainted:n>0,shadowProgress:1-Math.min(n,+!!r),shadowSide:a?`left`:`right`};return r?(c&&(o=s),{sidebar:{x:a?c?0:s-i:t-s,width:o},content:{x:0,width:t},...l}):(c&&(o=s,s=i),a?{sidebar:{x:s-i,width:o},content:{x:s,width:t-s},...l}:{sidebar:{x:t-(c?o:s),width:o},content:{x:0,width:t-s},...l})}function tagsConflict(e,t){return e==null||t==null?!1:e===t}function resolveNavigationStack(e){let{hasSidebar:t,hasContent:n,showContent:r}=e,i=e.sidebarPosition===`end`;if(e.changingPage&&t&&n)return r?i?{stack:[`content`],transition:`pop`,page:`sidebar`}:{stack:[`sidebar`,`content`],transition:`push`,page:`content`}:i?{stack:[`content`,`sidebar`],transition:`push`,page:`sidebar`}:{stack:[`sidebar`],transition:`pop`,page:`content`};let a=[];return i?(n&&a.push(`content`),t&&(!r||!n)&&a.push(`sidebar`)):(t&&a.push(`sidebar`),n&&(r||!t)&&a.push(`content`)),{stack:a,transition:`replace`,page:null}}function resolveNavigationAction(e){if(e.action===`pop`)return e.showContent&&e.hasSidebar&&e.hasContent?{kind:`set-show-content`,showContent:!1}:{kind:`delegate`};let{tag:t}=e;return e.contentTag!==null&&e.contentTag!==void 0&&t===e.contentTag?e.showContent&&e.collapsed?{kind:`already-in-stack`,tag:t}:{kind:`set-show-content`,showContent:!0}:e.sidebarTag!==null&&e.sidebarTag!==void 0&&t===e.sidebarTag?{kind:`already-in-stack`,tag:t}:{kind:`delegate`}}const O={alreadyInStack:e=>`Page with the tag '${e}' is already in the navigation stack`,notFound:e=>`No page with the tag '${e}' found in AdwNavigationSplitView`,sidebarCollision:e=>`Trying to add sidebar with the tag '${e}' to AdwNavigationSplitView, but content already has the same tag`,contentCollision:e=>`Trying to add content with the tag '${e}' to AdwNavigationSplitView, but sidebar already has the same tag`,sidebarTagCollision:e=>`Trying to set the sidebar's tag to '${e}', but the content already has the same tag`,contentTagCollision:e=>`Trying to set the content's tag to '${e}', but the sidebar already has the same tag`};var NavigationSplitViewState=class{constructor(e={}){this._sidebar=null,this._content=null,this._sidebarTag=null,this._contentTag=null,this._listeners=new Set,this._sidebarPosition=e.sidebarPosition??`start`,this._collapsed=e.collapsed??!1,this._showContent=e.showContent??!1,this._handlers={onCritical:e.onCritical,onDelegate:e.onDelegate}}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(e,t,n=!1){let r={property:e,interactive:n,plan:t};for(let e of[...this._listeners])e(r)}_critical(e){this._handlers.onCritical?.(e)}_plan(e=!1){return resolveNavigationStack({hasSidebar:this._sidebar!==null,hasContent:this._content!==null,sidebarPosition:this._sidebarPosition,showContent:this._showContent,changingPage:e})}get collapsed(){return this._collapsed}get showContent(){return this._showContent}get sidebarPosition(){return this._sidebarPosition}get sidebar(){return this._sidebar}get content(){return this._content}get sidebarTag(){return this._sidebarTag}get contentTag(){return this._contentTag}get stack(){return this._plan()}get visiblePane(){let{stack:e}=this._plan();return e[e.length-1]??null}setSidebar(e){if(e===this._sidebar)return!1;let t=e?.tag??null;return tagsConflict(t,this._contentTag)?(this._critical(O.sidebarCollision(t)),!1):(this._sidebar=e,this._sidebarTag=t,this._emit(`sidebar`,this._plan()),!0)}setContent(e){if(e===this._content)return!1;let t=e?.tag??null;return tagsConflict(this._sidebarTag,t)?(this._critical(O.contentCollision(t)),!1):(this._content=e,this._contentTag=t,this._emit(`content`,this._plan()),!0)}setTag(e,t){return e===`sidebar`?(this._sidebarTag=t,tagsConflict(this._sidebarTag,this._contentTag)?(this._critical(O.sidebarTagCollision(t)),this._sidebarTag=null,!1):!0):(this._contentTag=t,tagsConflict(this._sidebarTag,this._contentTag)?(this._critical(O.contentTagCollision(t)),this._contentTag=null,!1):!0)}setSidebarPosition(e){return e===this._sidebarPosition?!1:(this._sidebarPosition=e,this._emit(`sidebar-position`,this._plan()),!0)}setCollapsed(e){let t=!!e;return t===this._collapsed?!1:(this._collapsed=t,this._emit(`collapsed`,this._plan()),!0)}setShowContent(e,t=!1){let n=!!e;if(n===this._showContent)return!1;this._showContent=n;let r=this._collapsed&&this._sidebar!==null&&this._content!==null;return this._emit(`show-content`,this._plan(r),t),!0}push(e){return this._runAction(resolveNavigationAction({action:`push`,tag:e,sidebarTag:this._sidebarTag,contentTag:this._contentTag,showContent:this._showContent,collapsed:this._collapsed}),`push`,e)}pop(){return this._runAction(resolveNavigationAction({action:`pop`,hasSidebar:this._sidebar!==null,hasContent:this._content!==null,showContent:this._showContent}),`pop`)}_runAction(e,t,n){switch(e.kind){case`set-show-content`:return this.setShowContent(e.showContent,!0),e;case`already-in-stack`:return this._critical(O.alreadyInStack(e.tag)),e;default:return this._handlers.onDelegate?.(t,n)||t===`pop`?e:(this._critical(O.notFound(n??``)),{kind:`not-found`,tag:n??``})}}};const be={animate(e){return e.onValue(e.to),e.onDone(),{cancel:()=>{}}}};var OverlaySplitViewState=class{constructor(e={}){this._swipeActive=!1,this._animation=null,this._listeners=new Set,this._showSidebar=e.showSidebar??!0,this._collapsed=e.collapsed??!1,this._pinSidebar=e.pinSidebar??!1,this._sidebarPosition=e.sidebarPosition??`start`,this._enableShowGesture=e.enableShowGesture??!0,this._enableHideGesture=e.enableHideGesture??!0,this._showProgress=+!!this._showSidebar,this._animator=e.animator??be}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(e,t=!1){let n={property:e,showSidebar:this._showSidebar,collapsed:this._collapsed,showProgress:this._showProgress,shieldVisible:this.shieldVisible,interactive:t};for(let e of[...this._listeners])e(n)}get showSidebar(){return this._showSidebar}get collapsed(){return this._collapsed}get pinSidebar(){return this._pinSidebar}get sidebarPosition(){return this._sidebarPosition}get enableShowGesture(){return this._enableShowGesture}get enableHideGesture(){return this._enableHideGesture}get showProgress(){return this._showProgress}get shieldVisible(){return this._collapsed&&this._showProgress>0}get sidebarPainted(){return this._showProgress>0}get sidebarFocusable(){return!this._collapsed||this._showSidebar}get contentFocusable(){return!this._collapsed||!this._showSidebar}setShowSidebar(e,t={}){let n=!!e;if(n===this._showSidebar)return!1;this._showSidebar=n;let r=+!!n,i=t.animate??!0;return i||(this._cancelAnimation(),this._showProgress=r),this._emit(`show-sidebar`,t.interactive??!1),i&&!this._swipeActive&&this._startAnimation(r,t.velocity??0),!0}setCollapsed(e){let t=!!e;return t===this._collapsed?!1:(this._collapsed=t,this._pinSidebar||this.setShowSidebar(!t,{animate:!1}),this._emit(`collapsed`),!0)}setPinSidebar(e){let t=!!e;return t===this._pinSidebar?!1:(this._pinSidebar=t,this._emit(`pin-sidebar`),!0)}setSidebarPosition(e){return e===this._sidebarPosition?!1:(this._sidebarPosition=e,this._emit(`sidebar-position`),!0)}setEnableShowGesture(e){let t=!!e;return t===this._enableShowGesture?!1:(this._enableShowGesture=t,!0)}setEnableHideGesture(e){let t=!!e;return t===this._enableHideGesture?!1:(this._enableHideGesture=t,!0)}setShowProgress(e){this._showProgress=e,this._emit(`show-progress`)}escape(){return this._showProgress<2**-52||!this._collapsed?!1:(this.setShowSidebar(!1,{interactive:!0}),!0)}dismissShield(){return this.setShowSidebar(!1,{interactive:!0})}get swipeActive(){return this._swipeActive}beginSwipe(){this._cancelAnimation(),this._swipeActive=!0}endSwipe(e,t=0){if(!this._swipeActive)return{kind:`animate`,to:this._showProgress};this._swipeActive=!1;let n=resolveSwipeRelease({to:e,showSidebar:this._showSidebar});return n.kind===`animate`?this._startAnimation(n.to,t):this.setShowSidebar(n.showSidebar,{velocity:t,interactive:!0}),n}get snapPoints(){return resolveSwipeSnapPoints({showProgress:this._showProgress,enableShowGesture:this._enableShowGesture,enableHideGesture:this._enableHideGesture,swipeActive:this._swipeActive})}_cancelAnimation(){this._animation?.cancel(),this._animation=null}_startAnimation(e,t){this._cancelAnimation();let n=!1,r=this._animator.animate({from:this._showProgress,to:e,velocity:t,clamp:e<.5,onValue:e=>this.setShowProgress(e),onDone:()=>{n=!0,this._animation=null}});n||(this._animation=r)}};function resolveSwipeSnapPoints(e){let t=e.showProgress>0||e.enableShowGesture||e.swipeActive,n=e.showProgress<1||e.enableHideGesture||e.swipeActive;return t&&n?[0,1]:[+!!t]}function resolveSwipeStart(e){let t=Math.abs(e.showProgress-1)<2**-52||e.showProgress>1,n=Math.abs(e.showProgress)<2**-52||e.showProgress<0;return!(t&&!e.collapsed&&e.direction===`forward`||n&&!e.enableShowGesture||t&&!e.enableHideGesture)}function resolveSwipeRelease(e){return e.to>0===e.showSidebar?{kind:`animate`,to:e.to}:{kind:`set-show-sidebar`,showSidebar:e.to>0}}function swipeCancelProgress(e){let t=e<0?-Math.round(-e):Math.round(e);return t===0?0:t}function resolveSwipeArea(e){if(!e.isDrag)return{x:0,y:0,width:0,height:0};let t=Math.max(Math.trunc(e.sidebarWidth*e.showProgress),32);return{x:isSidebarAtVisualStart(e.sidebarPosition??`start`,e.direction??`ltr`)?0:e.totalWidth-t,y:0,width:t,height:e.totalHeight}}const k={none:`open-menu-symbolic`,down:`pan-down-symbolic`,up:`pan-up-symbolic`,left:`pan-start-symbolic`,right:`pan-end-symbolic`,none:`pan-down-symbolic`},A=[`none`,`up`,`down`,`left`,`right`];function splitButtonStyleClasses(e,t){let n=[];return t!==null&&t.length>0&&n.push(`image-button`),e!==null&&e.length>0&&n.push(`text-button`),n}function resolveDropdownTooltip(e){return typeof e==`string`&&e.length>0?{text:e,markup:!0}:{text:`More Options`,markup:!1}}function splitButtonArrowIcon(e){return k[e]??k.down}function splitButtonPopupDirection(e){return e===`none`||!A.includes(e)?`down`:e}const xe=splitButtonPopupDirection;function isSplitButtonDirection(e){return typeof e==`string`&&A.includes(e)}function splitButtonRootState(e,t){return{active:e.active||t.active||e.keyboardActivating||t.keyboardActivating,checked:e.checked||t.checked}}function parseMenuEntries(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return[]}if(!Array.isArray(t))return[];let n=[];for(let e of t){if(typeof e!=`object`||!e||!(`label`in e))continue;let t=e,r={label:String(t.label)};typeof t.action==`string`&&(r.action=t.action),typeof t.id==`string`&&(r.id=t.id),typeof t.icon==`string`&&(r.icon=t.icon),n.push(r)}return n}function internalContent(e){return Object.freeze({adwInternalContent:e})}function derivedPopover(){return Object.freeze({adwDerivedPopover:!0})}var SplitButtonState=class{constructor(){this._mode=`empty`,this._label=null,this._iconName=null,this._child=null,this._useUnderline=!1,this._menuModel=null,this._popover=null,this._direction=`down`,this._dropdownTooltip=``,this._open=!1,this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(e,t){let n={mode:this._mode,label:this._label,iconName:this._iconName,child:this._child,styleClasses:this.styleClasses,dropdownEnabled:this.dropdownEnabled,open:this._open,notified:e,interactive:t};for(let e of[...this._listeners])e(n)}get mode(){return this._mode}get label(){return this._label}setLabel(e){if(typeof e!=`string`||e===this._label)return!1;let t=[];return this._iconName!==null&&t.push(`icon-name`),this._child!==null&&t.push(`child`),this._child=this._mode===`label`?this._child:internalContent(`label`),this._mode=`label`,this._label=e,this._iconName=null,t.push(`label`),this._emit(t,!1),!0}get iconName(){return this._iconName}setIconName(e){if(typeof e!=`string`||e===this._iconName)return!1;let t=[];return this._label!==null&&t.push(`label`),this._child!==null&&t.push(`child`),this._child=this._mode===`icon`?this._child:internalContent(`icon`),this._mode=`icon`,this._iconName=e,this._label=null,t.push(`icon-name`),this._emit(t,!1),!0}get child(){return this._child}setChild(e){let t=e??null;if(t===this._child)return!1;let n=[];return this._label!==null&&n.push(`label`),this._iconName!==null&&n.push(`icon-name`),this._mode=t===null?`empty`:`child`,this._child=t,this._label=null,this._iconName=null,n.push(`child`),this._emit(n,!1),!0}get styleClasses(){return splitButtonStyleClasses(this._label,this._iconName)}get useUnderline(){return this._useUnderline}setUseUnderline(e){let t=!!e;return t===this._useUnderline?!1:(this._useUnderline=t,this._emit([`use-underline`],!1),!0)}get menuModel(){return this._menuModel}setMenuModel(e){let t=e&&e.length>0?e:null;if(t===this._menuModel)return!1;let n=t===null?null:derivedPopover(),r=[];return n!==this._popover&&r.push(`popover`),r.push(`menu-model`),this._menuModel=t,this._popover=n,this.dropdownEnabled||(this._open=!1),this._emit(r,!1),!0}get popover(){return this._popover}setPopover(e){let t=e??null;if(t===this._popover)return!1;let n=[];return this._menuModel!==null&&n.push(`menu-model`),n.push(`popover`),this._menuModel=null,this._popover=t,this.dropdownEnabled||(this._open=!1),this._emit(n,!1),!0}get dropdownEnabled(){return this._menuModel!==null||this._popover!==null}get direction(){return this._direction}setDirection(e){return!isSplitButtonDirection(e)||e===this._direction?!1:(this._direction=e,this._emit([`direction`],!1),!0)}get arrowIcon(){return splitButtonArrowIcon(this._direction)}get dropdownTooltip(){return this._dropdownTooltip}setDropdownTooltip(e){return typeof e!=`string`||e===this._dropdownTooltip?!1:(this._dropdownTooltip=e,this._emit([`dropdown-tooltip`],!1),!0)}get open(){return this._open}_setOpen(e,t){return e&&!this.dropdownEnabled||e===this._open?!1:(this._open=e,this._emit([],t),!0)}openMenu(){return this._setOpen(!0,!1)}closeMenu(){return this._setOpen(!1,!1)}toggleMenu(){return this._setOpen(!this._open,!0)}activateMenuEntry(e){let t=this._menuModel;if(t===null||!Number.isInteger(e)||e<0||e>=t.length)return null;let n=t[e];return this._setOpen(!1,!0),n}};const Se=[`narrow`,`wide`],Ce=[`labels`,`icons`,`both`];function isViewSwitcherPolicy(e){return e===`narrow`||e===`wide`}function isInlineViewSwitcherDisplayMode(e){return e===`labels`||e===`icons`||e===`both`}function createViewSwitcherPage(e){return{name:e.name,title:e.title??null,iconName:e.iconName??null,visible:e.visible??!0,useUnderline:e.useUnderline??!1,badgeNumber:normalizeBadgeNumber(e.badgeNumber),needsAttention:e.needsAttention??!1}}function viewSwitcherPageFromStackPage(e){return createViewSwitcherPage({name:e.name,title:e.title,iconName:e.icon.length>0?e.icon:null,visible:e.visible,badgeNumber:e.badgeNumber,needsAttention:e.needsAttention,useUnderline:e.useUnderline})}function viewSwitcherPagesFromStack(e){return e.map(e=>viewSwitcherPageFromStackPage(e))}function isViewSwitcherButtonVisible(e){return e.visible&&(isPresent(e.title)||isPresent(e.iconName))}function viewSwitcherIconName(e){return isPresent(e)&&e.length>0?e:`image-missing`}function viewSwitcherLabel(e){return isPresent(e.title)?e.useUnderline?stripMnemonic(e.title):e.title:``}function viewSwitcherBadgeLabel(e){let t=normalizeBadgeNumber(e);return t>999?`999+`:t===0?``:String(t)}const j={attentionRequested:`Attention requested.`,badgeOverflow:`Has a badge: more than 999.`,badge:e=>`Has a badge: ${e}.`};function viewSwitcherIndicatorDescription(e,t,n=j){let r=normalizeBadgeNumber(t),i=e?n.attentionRequested:``,a=``;return r>999?a=n.badgeOverflow:r>0&&(a=n.badge(r)),i&&a?`${a} ${i}`:i||a}function inlineToggleTooltip(e,t){return t===`icons`?viewSwitcherLabel(e):``}function shouldRevealViewSwitcherBar(e,t){if(!e)return!1;let n=0;for(let e of t)if(e.visible&&(n++,n>1))return!0;return!1}function viewSwitcherButtonOrientation(e){return e===`wide`?`horizontal`:`vertical`}function buildViewSwitcherButtons(e,t,n,r=j){let i=viewSwitcherButtonOrientation(n);return e.map((e,n)=>({pageIndex:n,name:e.name,label:viewSwitcherLabel(e),iconName:viewSwitcherIconName(e.iconName),visible:isViewSwitcherButtonVisible(e),selected:n===t,orientation:i,badgeLabel:viewSwitcherBadgeLabel(e.badgeNumber),needsAttention:e.needsAttention,description:viewSwitcherIndicatorDescription(e.needsAttention,e.badgeNumber,r)}))}function buildInlineToggles(e,t,n=j){let r=t!==`labels`,i=t!==`icons`,a=[];return e.forEach((e,o)=>{e.visible&&a.push({toggleIndex:a.length,pageIndex:o,name:e.name,label:viewSwitcherLabel(e),iconName:viewSwitcherIconName(e.iconName),showIcon:r,showLabel:i,tooltip:inlineToggleTooltip(e,t),badgeLabel:viewSwitcherBadgeLabel(e.badgeNumber),needsAttention:e.needsAttention,description:viewSwitcherIndicatorDescription(e.needsAttention,e.badgeNumber,n)})}),a}function toggleIndexForPage(e,t){if(!Number.isInteger(t)||t<0||t>=e.length||!e[t].visible)return-1;let n=0;for(let r=0;r<t;r++)e[r].visible&&n++;return n}var ViewSwitcherDragSwitch=class{constructor(e){this._timers=new Map,this._scheduler=e.scheduler,this._onSwitch=e.onSwitch,this._delay=e.delay??500}enter(e,t){if(!Number.isInteger(e)||e<0||e===t||this._timers.has(e))return!1;let n=this._scheduler.schedule(()=>{this._timers.delete(e),this._onSwitch(e)},this._delay);return this._timers.set(e,n),!0}leave(e){let t=this._timers.get(e);t!==void 0&&(this._timers.delete(e),this._scheduler.cancel(t))}cancel(){for(let e of this._timers.values())this._scheduler.cancel(e);this._timers.clear()}get pending(){return[...this._timers.keys()].sort((e,t)=>e-t)}},ViewSwitcherState=class{constructor(e={}){this._pages=[],this._pagesView=null,this._stack=new ViewStackState,this._listeners=new Set,this._drag=e.scheduler?new ViewSwitcherDragSwitch({scheduler:e.scheduler,delay:e.dragSwitchDelay,onSwitch:e=>{this.setSelected(e)}}):null,this._subscribeStack()}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}get pages(){return this._pagesView??=Object.freeze(this._pages.slice()),this._pagesView}setPages(e){let t=this.selected,n=t>=0?this.selectedName:null;this._pages=e.map(e=>createViewSwitcherPage(e)),this._pagesView=null;let r=new ViewStackState;for(let e of this._pages)r.addPage({name:e.name,title:e.title,visible:e.visible});if(n!==null){let e=r.indexOfName(n);e>=0&&r.setVisibleIndex(e,!1)}this._stack=r,this._subscribeStack(),this._drag?.cancel(),(this.selected!==t||this.selectedName!==(n??``))&&this._emit(!1)}get selected(){return this._stack.visibleIndex}get selectedName(){return this._stack.visibleName}get selectedPage(){return this._pages[this.selected]}get count(){return this._pages.length}setSelected(e,t=!0){return this._stack.setVisibleIndex(e,t)}selectName(e,t=!0){return this._stack.setVisibleName(e,t)}setPageVisible(e,t){let n=this._pages.findIndex(t=>t.name===e);if(n<0)return!1;let r=this._pages[n],i=!!t;return r.visible===i?!1:(this._pages[n]={...r,visible:i},this._pagesView=null,this._stack.setPageVisible(e,i))}dragEnter(e){this._drag?.enter(e,this.selected)}dragLeave(e){this._drag?.leave(e)}cancelDrag(){this._drag?.cancel()}get pendingDragSwitches(){return this._drag?.pending??[]}get diagnostics(){return this._stack.diagnostics}_subscribeStack(){this._stack.subscribe(e=>this._emit(e.interactive))}_emit(e){let t=this.selectedPage,n={selected:this.selected,name:t?.name??``,title:t?viewSwitcherLabel(t):``,interactive:e};for(let e of[...this._listeners])e(n)}},ViewSwitcherBarState=class{constructor(){this._reveal=!1,this._revealed=!1,this._pages=[],this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}get reveal(){return this._reveal}get revealed(){return this._revealed}setReveal(e){let t=!!e;return t===this._reveal?!1:(this._reveal=t,this._refresh(),!0)}setPages(e){return this._pages=e,this._refresh()}_refresh(){let e=shouldRevealViewSwitcherBar(this._reveal,this._pages);if(e===this._revealed)return!1;this._revealed=e;let t={reveal:this._reveal,revealed:this._revealed};for(let e of[...this._listeners])e(t);return!0}};function isPresent(e){return e!=null}function normalizeBadgeNumber(e){return typeof e!=`number`||!Number.isFinite(e)?0:Math.max(0,Math.trunc(e))}function tabsRevealed(e){return e.autohide?e.nPages>1||e.nPinnedPages>=1||e.isTransferringPage:!0}function tabCloseVisible(e){return e.pinned?!1:e.hovering&&e.fullyVisible||e.selected||e.dragging}function tabTooltip(e){return e.tooltip===``?e.title:e.tooltip}function tabIconState(e,t){let n=e.indicatorIcon,r=e.icon;return!e.loading&&e.pinned&&r===null&&(r=t),{icon:r,spinner:e.loading,iconVisible:(r!==null||e.loading)&&(!e.pinned||n===null),indicatorVisible:n!==null}}function isDescendantOfPage(e,t,n){let r=t;for(;r!==null&&r!==n;)r=e.find(e=>e.id===r)?.parentId??null;return r===n}function successorAfterClose(e,t,n){if(t!==n)return n;let r=e.findIndex(e=>e.id===t);if(r<0)return n;let i=e[r].parentId;if(i!==null&&r>0){let t=e[r-1];if(isDescendantOfPage(e,t.id,i))return t.id;let n=e.find(e=>e.id===i);if(n&&t.pinned&&n.pinned)return n.id}return r<e.length-1?e[r+1].id:r>0?e[r-1].id:null}function assertionDiagnostic(e,t){return`${e}: assertion '${t}' failed`}var TabViewState=class{constructor(e={}){this._stack=new ViewStackState,this._selectionListeners=new Set,this._pagesListeners=new Set,this._diagnostics=[],this._selectedId=null,this._deferSelection=!1,this._deferredSelection=null,this._pagesSource=null,this._pagesView=null,this._handlers=e,this._stack.subscribe(e=>{let t=this._selectedId,n=e.page?.content?.id??null;this._selectedId=n;let r={selectedId:n,selectedIndex:e.index,previousId:t,interactive:e.interactive};this._deferSelection?this._deferredSelection=r:this._emitSelection(r)})}subscribe(e){return this._selectionListeners.add(e),()=>{this._selectionListeners.delete(e)}}subscribePages(e){return this._pagesListeners.add(e),()=>{this._pagesListeners.delete(e)}}_emitSelection(e){for(let t of[...this._selectionListeners])t(e)}_emitPages(e){for(let t of[...this._pagesListeners])t(e)}_flushDeferredSelection(){let e=this._deferredSelection;e&&(this._deferredSelection=null,this._emitSelection(e))}get pages(){let e=this._stack.pages;return(this._pagesSource!==e||this._pagesView===null)&&(this._pagesSource=e,this._pagesView=Object.freeze(e.map(e=>e.content))),this._pagesView}get nPages(){return this._stack.count}get nPinnedPages(){let e=this.pages.findIndex(e=>!e.pinned);return e<0?this.pages.length:e}getNthPage(e){return!Number.isInteger(e)||e<0||e>=this.nPages?null:this.pages[e]}getPagePosition(e){return this._stack.indexOfName(e)}getPage(e){return this._recordOf(e)}isClosing(e){return this._recordOf(e)?.closing??!1}get diagnostics(){return this._diagnostics}get selectedId(){return this._stack.visiblePage?.content?.id??null}get selectedIndex(){return this._stack.visibleIndex}get selectedPage(){return this._stack.visiblePage?.content??null}setSelectedPage(e,t=!0){if(e===null)return this.nPages>0&&this._diagnostics.push(assertionDiagnostic(`adw_tab_view_set_selected_page`,`ADW_IS_TAB_PAGE (selected_page)`)),!1;let n=this.getPagePosition(e);return n<0?(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_set_selected_page`,`page_belongs_to_this_view (self, selected_page)`)),!1):this._stack.setVisibleIndex(n,t)}selectNthPage(e){return this._stack.setVisibleIndex(e,!0)}selectPreviousPage(){let e=this.selectedIndex;return e<=0?!1:this._stack.setVisibleIndex(e-1,!0)}selectNextPage(){let e=this.selectedIndex;return e<0||e>=this.nPages-1?!1:this._stack.setVisibleIndex(e+1,!0)}selectFirstPage(){let e=this.selectedPage;if(!e)return!1;let t=e.pinned,n=this.getNthPage(t?0:this.nPinnedPages);return n===e&&!t&&(n=this.getNthPage(0)),!n||n===e?!1:this.setSelectedPage(n.id)}selectLastPage(){let e=this.selectedPage;if(!e)return!1;let t=e.pinned,n=this.getNthPage((t?this.nPinnedPages:this.nPages)-1);return n===e&&t&&(n=this.getNthPage(this.nPages-1)),!n||n===e?!1:this.setSelectedPage(n.id)}cycleNextPage(){return!this.selectedPage||this.nPages<=1?!1:this.selectNextPage()?!0:this._stack.setVisibleIndex(0,!0)}cyclePreviousPage(){return!this.selectedPage||this.nPages<=1?!1:this.selectPreviousPage()?!0:this._stack.setVisibleIndex(this.nPages-1,!0)}addPage(e,t=null){if(t===null)return this._insert(e,this.nPages,!1,null);let n=this.getPagePosition(t);if(n<0)return this._diagnostics.push(assertionDiagnostic(`adw_tab_view_add_page`,`page_belongs_to_this_view (self, parent)`)),-1;let r=this.pages[n].pinned?this.nPinnedPages-1:n;do if(r++,r>=this.nPages)break;while(isDescendantOfPage(this.pages,this.pages[r].id,t));return this._insert(e,r,!1,t)}insertPage(e,t){return!Number.isInteger(t)||t<this.nPinnedPages?(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_insert`,`position >= self->n_pinned_pages`)),-1):t>this.nPages?(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_insert`,`position <= self->n_pages`)),-1):this._insert(e,t,!1,null)}prependPage(e){return this._insert(e,this.nPinnedPages,!1,null)}appendPage(e){return this._insert(e,this.nPages,!1,null)}insertPinnedPage(e,t){return!Number.isInteger(t)||t<0?(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_insert_pinned`,`position >= 0`)),-1):t>this.nPinnedPages?(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_insert_pinned`,`position <= self->n_pinned_pages`)),-1):this._insert(e,t,!0,null)}prependPinnedPage(e){return this._insert(e,0,!0,null)}appendPinnedPage(e){return this._insert(e,this.nPinnedPages,!0,null)}_insert(e,t,n,r){if(this.getPagePosition(e.id)>=0)return this._diagnostics.push(assertionDiagnostic(`adw_tab_view_insert`,`page id '${e.id}' is unique`)),-1;let i={id:e.id,title:e.title??``,tooltip:e.tooltip??``,icon:e.icon??null,indicatorIcon:e.indicatorIcon??null,loading:e.loading??!1,needsAttention:e.needsAttention??!1,pinned:n,parentId:r,closing:!1,content:e.content};return this._deferSelection=!0,this._stack.insertPage({name:i.id,content:i},t),this._deferSelection=!1,this._emitPages({kind:`attached`,id:i.id,position:t,previousPosition:-1}),this._flushDeferredSelection(),t}setPagePinned(e,t){let n=this.getPagePosition(e);if(n<0)return this._diagnostics.push(assertionDiagnostic(`adw_tab_view_set_page_pinned`,`page_belongs_to_this_view (self, page)`)),-1;let r=this._recordAt(n),i=!!t;if(r.pinned===i)return-1;let a=i?this.nPinnedPages:this.nPinnedPages-1;return r.pinned=i,n!==a&&this._stack.movePage(n,a),this._emitPages({kind:`pinned`,id:e,position:a,previousPosition:n}),a}closePage(e){let t=this._recordOf(e);if(!t)return this._diagnostics.push(assertionDiagnostic(`adw_tab_view_close_page`,`page_belongs_to_this_view (self, page)`)),!1;if(t.closing)return!1;t.closing=!0;let n=this._handlers.onClosePage?this._handlers.onClosePage(t):!t.pinned;return n!==`defer`&&this.closePageFinish(e,n),!0}closePageFinish(e,t){let n=this._recordOf(e);return n?n.closing?(n.closing=!1,t?this.detachPage(e)!==null:!1):(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_close_page_finish`,`page->closing`)),!1):(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_close_page_finish`,`page_belongs_to_this_view (self, page)`)),!1)}detachPage(e){let t=this.getPagePosition(e);if(t<0)return this._diagnostics.push(assertionDiagnostic(`adw_tab_view_detach_page`,`page_belongs_to_this_view (self, page)`)),null;let n=this._recordAt(t),r=successorAfterClose(this.pages,e,this.selectedId);r!==null&&r!==this.selectedId&&this.setSelectedPage(r,!1);let i=this.selectedId===e;this._stack.removePage(e);for(let t of this._records())t.parentId===e&&(t.parentId=n.parentId);return i&&(this._selectedId=null,this._emitSelection({selectedId:null,selectedIndex:-1,previousId:e,interactive:!1})),this._emitPages({kind:`detached`,id:e,position:t,previousPosition:t}),n}closeOtherPages(e){let t=this.getPagePosition(e);if(t<0){this._diagnostics.push(assertionDiagnostic(`adw_tab_view_close_other_pages`,`page_belongs_to_this_view (self, page)`));return}let n=this.pages.map(e=>e.id);for(let e=n.length-1;e>=0;e--)e!==t&&this.closePage(n[e])}closePagesBefore(e){let t=this.getPagePosition(e);if(t<0){this._diagnostics.push(assertionDiagnostic(`adw_tab_view_close_pages_before`,`page_belongs_to_this_view (self, page)`));return}let n=this.pages.map(e=>e.id);for(let e=t-1;e>=0;e--)this.closePage(n[e])}closePagesAfter(e){let t=this.getPagePosition(e);if(t<0){this._diagnostics.push(assertionDiagnostic(`adw_tab_view_close_pages_after`,`page_belongs_to_this_view (self, page)`));return}let n=this.pages.map(e=>e.id);for(let e=n.length-1;e>t;e--)this.closePage(n[e])}reorderPage(e,t){let n=this.getPagePosition(e);if(n<0)return this._diagnostics.push(assertionDiagnostic(`adw_tab_view_reorder_page`,`page_belongs_to_this_view (self, page)`)),!1;let r=this.pages[n].pinned,i=r?0:this.nPinnedPages,a=r?this.nPinnedPages:this.nPages;return!Number.isInteger(t)||t<i||t>=a?(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_reorder_page`,r?`position < self->n_pinned_pages`:`position >= self->n_pinned_pages`)),!1):n===t?!1:(this._stack.movePage(n,t),this._emitPages({kind:`reordered`,id:e,position:t,previousPosition:n}),!0)}reorderBackward(e){let t=this.getPagePosition(e);return t<0?this._reorderMissing(e):t<=(this.pages[t].pinned?0:this.nPinnedPages)?!1:this.reorderPage(e,t-1)}reorderForward(e){let t=this.getPagePosition(e);return t<0?this._reorderMissing(e):t>=(this.pages[t].pinned?this.nPinnedPages:this.nPages)-1?!1:this.reorderPage(e,t+1)}reorderFirst(e){let t=this.getPagePosition(e);return t<0?this._reorderMissing(e):this.reorderPage(e,this.pages[t].pinned?0:this.nPinnedPages)}reorderLast(e){let t=this.getPagePosition(e);return t<0?this._reorderMissing(e):this.reorderPage(e,(this.pages[t].pinned?this.nPinnedPages:this.nPages)-1)}_reorderMissing(e){return this._diagnostics.push(assertionDiagnostic(`adw_tab_view_reorder_page`,`page_belongs_to_this_view (self, '${e}')`)),!1}setPageTitle(e,t){return this._update(e,e=>{let n=t??``;return e.title===n?!1:(e.title=n,!0)})}setPageTooltip(e,t){return this._update(e,e=>{let n=t??``;return e.tooltip===n?!1:(e.tooltip=n,!0)})}setPageIcon(e,t){return this._update(e,e=>e.icon===t?!1:(e.icon=t,!0))}setPageIndicatorIcon(e,t){return this._update(e,e=>e.indicatorIcon===t?!1:(e.indicatorIcon=t,!0))}setPageLoading(e,t){return this._update(e,e=>{let n=!!t;return e.loading===n?!1:(e.loading=n,!0)})}setPageNeedsAttention(e,t){return this._update(e,e=>{let n=!!t;return e.needsAttention===n?!1:(e.needsAttention=n,!0)})}_update(e,t){let n=this.getPagePosition(e);return n<0?(this._diagnostics.push(assertionDiagnostic(`adw_tab_page_set_property`,`ADW_IS_TAB_PAGE (self)`)),!1):t(this._recordAt(n))?(this._emitPages({kind:`updated`,id:e,position:n,previousPosition:n}),!0):!1}_records(){return this._stack.pages.map(e=>e.content)}_recordAt(e){return this._stack.pages[e].content}_recordOf(e){let t=this.getPagePosition(e);return t<0?null:this._recordAt(t)}};const we=new Map([[`µ`,`μ`],[`ß`,`ss`],[`ʼn`,`ʼn`],[`ſ`,`s`],[`ǰ`,`ǰ`],[`ͅ`,`ι`],[`ΐ`,`ΐ`],[`ΰ`,`ΰ`],[`ς`,`σ`],[`ϐ`,`β`],[`ϑ`,`θ`],[`ϕ`,`φ`],[`ϖ`,`π`],[`ϰ`,`κ`],[`ϱ`,`ρ`],[`ϵ`,`ε`],[`և`,`եւ`],[`ᲀ`,`в`],[`ᲁ`,`д`],[`ᲂ`,`о`],[`ᲃ`,`с`],[`ᲄ`,`т`],[`ᲅ`,`т`],[`ᲆ`,`ъ`],[`ᲇ`,`ѣ`],[`ᲈ`,`ꙋ`],[`ẖ`,`ẖ`],[`ẗ`,`ẗ`],[`ẘ`,`ẘ`],[`ẙ`,`ẙ`],[`ẚ`,`aʾ`],[`ẛ`,`ṡ`],[`ὐ`,`ὐ`],[`ὒ`,`ὒ`],[`ὔ`,`ὔ`],[`ὖ`,`ὖ`],[`ᾀ`,`ἀι`],[`ᾁ`,`ἁι`],[`ᾂ`,`ἂι`],[`ᾃ`,`ἃι`],[`ᾄ`,`ἄι`],[`ᾅ`,`ἅι`],[`ᾆ`,`ἆι`],[`ᾇ`,`ἇι`],[`ᾐ`,`ἠι`],[`ᾑ`,`ἡι`],[`ᾒ`,`ἢι`],[`ᾓ`,`ἣι`],[`ᾔ`,`ἤι`],[`ᾕ`,`ἥι`],[`ᾖ`,`ἦι`],[`ᾗ`,`ἧι`],[`ᾠ`,`ὠι`],[`ᾡ`,`ὡι`],[`ᾢ`,`ὢι`],[`ᾣ`,`ὣι`],[`ᾤ`,`ὤι`],[`ᾥ`,`ὥι`],[`ᾦ`,`ὦι`],[`ᾧ`,`ὧι`],[`ᾲ`,`ὰι`],[`ᾳ`,`αι`],[`ᾴ`,`άι`],[`ᾶ`,`ᾶ`],[`ᾷ`,`ᾶι`],[`ι`,`ι`],[`ῂ`,`ὴι`],[`ῃ`,`ηι`],[`ῄ`,`ήι`],[`ῆ`,`ῆ`],[`ῇ`,`ῆι`],[`ῒ`,`ῒ`],[`ΐ`,`ΐ`],[`ῖ`,`ῖ`],[`ῗ`,`ῗ`],[`ῢ`,`ῢ`],[`ΰ`,`ΰ`],[`ῤ`,`ῤ`],[`ῦ`,`ῦ`],[`ῧ`,`ῧ`],[`ῲ`,`ὼι`],[`ῳ`,`ωι`],[`ῴ`,`ώι`],[`ῶ`,`ῶ`],[`ῷ`,`ῶι`],[`ff`,`ff`],[`fi`,`fi`],[`fl`,`fl`],[`ffi`,`ffi`],[`ffl`,`ffl`],[`ſt`,`st`],[`st`,`st`],[`ﬓ`,`մն`],[`ﬔ`,`մե`],[`ﬕ`,`մի`],[`ﬖ`,`վն`],[`ﬗ`,`մխ`]]);function foldCherokee(e){if(e>=43888&&e<=43967)return String.fromCodePoint(e-43888+5024);if(e>=5112&&e<=5117)return String.fromCodePoint(e-8)}const defaultCaseFolder=e=>{let t=``;for(let n of e.toLowerCase()){let e=n.codePointAt(0);if(e<181){t+=n;continue}t+=we.get(n)??foldCherokee(e)??n}return t},Te=new Set([`markup`,`span`,`b`,`big`,`i`,`s`,`sub`,`sup`,`small`,`tt`,`u`]),Ee=new Map([[`amp`,`&`],[`lt`,`<`],[`gt`,`>`],[`quot`,`"`],[`apos`,`'`]]),M=/[A-Za-z_:]/,N=/[A-Za-z0-9._:-]/,P=/[ \t\r\n]/;function escapeMarkup(e){let t=``;for(let n of e)switch(n){case`&`:t+=`&`;break;case`<`:t+=`<`;break;case`>`:t+=`>`;break;case`'`:t+=`'`;break;case`"`:t+=`"`;break;default:{let e=n.codePointAt(0);t+=e>=1&&e<=8||e>=11&&e<=12||e>=14&&e<=31||e===127?`&#x${e.toString(16)};`:n}}return t}function passthroughEnd(e,t){return e.startsWith(`<!--`,t)?{terminator:`-->`}:e.startsWith(`<![CDATA[`,t)?{terminator:`]]>`}:e.startsWith(`<!`,t)||e.startsWith(`<?`,t)?{terminator:`>`}:null}function readEntity(e,t){let n=e.indexOf(`;`,t);if(n<0)return null;let r=e.slice(t+1,n);if(r.length===0)return null;if(r.startsWith(`#`)){let e=r[1]===`x`||r[1]===`X`,t=e?r.slice(2):r.slice(1);if(t.length===0||!(e?/^[0-9a-fA-F]+$/:/^[0-9]+$/).test(t))return null;let i=Number.parseInt(t,e?16:10);return i<=0||i>1114111||i>=55296&&i<=57343?null:{value:String.fromCodePoint(i),next:n+1}}let i=Ee.get(r);return i===void 0?null:{value:i,next:n+1}}function readTag(e,t){let n=t+1,r=e[n]===`/`;if(r&&(n+=1),n>=e.length||!M.test(e[n]))return null;let i=n;for(;n<e.length&&N.test(e[n]);)n+=1;let a=e.slice(i,n),o=!1,s=!1;for(;n<e.length;){for(;n<e.length&&P.test(e[n]);)n+=1;let t=e[n];if(t===void 0)return null;if(t===`>`)return{name:a,closing:r,selfClosing:s,hasAttributes:o,next:n+1};if(t===`/`)return r||e[n+1]!==`>`?null:(s=!0,{name:a,closing:r,selfClosing:s,hasAttributes:o,next:n+2});if(r||!M.test(t))return null;for(;n<e.length&&N.test(e[n]);)n+=1;for(;n<e.length&&P.test(e[n]);)n+=1;if(e[n]!==`=`)return null;for(n+=1;n<e.length&&P.test(e[n]);)n+=1;let i=e[n];if(i!==`"`&&i!==`'`)return null;let c=e.indexOf(i,n+1);if(c<0)return null;n=c+1,o=!0}return null}function stripMarkup(e){let t=``,n=[],r=0;for(;r<e.length;){let i=e[r];if(i===`&`){let n=readEntity(e,r);if(!n)return null;t+=n.value,r=n.next;continue}if(i!==`<`){t+=i,r+=1;continue}let a=passthroughEnd(e,r);if(a){let t=e.indexOf(a.terminator,r+2);if(t<0)return null;r=t+a.terminator.length;continue}let o=readTag(e,r);if(!o||!Te.has(o.name)||o.hasAttributes&&o.name!==`span`)return null;if(o.closing){if(n.pop()!==o.name)return null}else o.selfClosing||n.push(o.name);r=o.next}return n.length===0?t:null}function makeComparable(e,t={},n=defaultCaseFolder){let r=n(e??``);return(t.useMarkup??!0)&&(r=stripMarkup(r)??r),(t.allowUnderline??!0)&&(t.useUnderline??!1)&&(r=stripMnemonic(r)),r}function displayedLabelText(e,t){let n=e??``;return t?stripMarkup(n)??n:n}function derivePreferencesGroupHeader(e){let t=e.useMarkup??!0,n=stringIsNotEmpty(displayedLabelText(e.title,t)),r=stringIsNotEmpty(displayedLabelText(e.description,t)),i=e.hasHeaderSuffix??!1;return{titleVisible:n,descriptionVisible:r,headerVisible:n||r||i,singleLine:!r&&(i||n),listboxVisible:(e.rowCount??0)>0}}function countVisiblePages(e){let t=0;for(let n of e)n.visible!==!1&&(t+=1);return t}function collectSearchRows(e){let t=[];for(let n of e)if(n.visible!==!1){for(let e of n.groups)if(e.visible!==!1)for(let r of e.rows)r.visible!==!1&&r.title!==``&&t.push({page:n,group:e,row:r})}return t}function rowMatchesQuery(e,t,n=defaultCaseFolder){let r=n(t??``),i={useMarkup:e.useMarkup,useUnderline:e.useUnderline};return makeComparable(e.title,{...i,allowUnderline:!0},n).includes(r)?!0:e.isActionRow?makeComparable(e.subtitle,{...i,allowUnderline:!1},n).includes(r):!1}function createSearchRowSubtitle(e){let t=e.groupTitle??null;t===``&&(t=null);let n=null;return e.pageTitle!==void 0&&e.pageTitle!==null&&(n=e.pageUseUnderline?stripMnemonic(e.pageTitle):e.pageTitle,(e.rowUseMarkup??!0)&&(n=escapeMarkup(n)),n===``&&(n=null)),t===null?n:e.nVisiblePages<=1?t:`${n??e.untitledPageLabel??`Untitled page`} → ${t}`}function searchPreferences(e,t,n={}){let r=n.fold??defaultCaseFolder,i=countVisiblePages(e),a=[];for(let{page:o,group:s,row:c}of collectSearchRows(e))rowMatchesQuery(c,t,r)&&a.push({title:c.title,subtitle:createSearchRowSubtitle({groupTitle:s.title,pageTitle:o.title??``,pageUseUnderline:o.useUnderline,rowUseMarkup:c.useMarkup,nVisiblePages:i,untitledPageLabel:n.untitledPageLabel}),useMarkup:c.useMarkup??!0,useUnderline:c.useUnderline??!1,page:o,group:s,row:c});return a}function scrollMaxValue(e){return e.upper-e.pageSize}function isScrolledFromStart(e){return e.value>e.lower}function isScrolledFromEnd(e){return e.value<scrollMaxValue(e)}const F=[`undershoot-top`,`undershoot-bottom`,`undershoot-start`,`undershoot-end`];function scrollUndershootClasses(e){let t=[],{vertical:n,horizontal:r}=e;return n&&(isScrolledFromStart(n)&&t.push(`undershoot-top`),isScrolledFromEnd(n)&&t.push(`undershoot-bottom`)),r&&(isScrolledFromStart(r)&&t.push(`undershoot-start`),isScrolledFromEnd(r)&&t.push(`undershoot-end`)),t}function overshootDistance(e,t){let n=scrollMaxValue(t);return e<t.lower?e-t.lower:e>n?e-n:0}function accumulateOvershoot(e,t,n){let r=n.lower-100,i=scrollMaxValue(n)+100;return Math.min(Math.max(e+t,r),i)}var PopoverState=class{constructor(){this._open=!1,this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(e){let t={open:this._open,interactive:e};for(let e of[...this._listeners])e(t)}_setOpen(e,t){return e===this._open?!1:(this._open=e,this._emit(t),!0)}get open(){return this._open}popup(){return this._setOpen(!0,!1)}popdown(){return this._setOpen(!1,!1)}toggle(){return this._setOpen(!this._open,!0)}dismiss(){return this._setOpen(!1,!0)}};function resolvePopoverKey(e,t){if(e===`Escape`)return{action:`close`,index:-1};let n=Number.isFinite(t.itemCount)?Math.max(0,Math.trunc(t.itemCount)):0;if(n===0)return{action:`none`,index:-1};let r=t.currentIndex,i=Number.isFinite(r)&&r>=0&&r<n?Math.trunc(r):-1,a=t.hasSearch===!0&&i<0;switch(e){case`ArrowDown`:return{action:`focus`,index:i<0?0:(i+1)%n};case`ArrowUp`:return{action:`focus`,index:i<0?n-1:(i-1+n)%n};case`Home`:return a?{action:`none`,index:-1}:{action:`focus`,index:0};case`End`:return a?{action:`none`,index:-1}:{action:`focus`,index:n-1};case`Enter`:case` `:return i<0?{action:`none`,index:-1}:{action:`activate`,index:i};default:return{action:`none`,index:-1}}}const De=[`none`,`fill`,`spread`],Oe=[`minimum`,`natural`],ke=[`start-to-end`,`end-to-start`];function normalizeWrapBoxSpacing(e){let t=typeof e==`number`?e:Number.parseFloat(String(e??``));return!Number.isFinite(t)||t<0?0:t}function normalizeWrapBoxAlign(e){let t=typeof e==`number`?e:Number.parseFloat(String(e??``));return Number.isFinite(t)?Math.min(1,Math.max(0,t)):0}function normalizeWrapBoxJustify(e){return De.includes(e)?e:`none`}function normalizeWrapPolicy(e){return Oe.includes(e)?e:`natural`}function normalizeNaturalLineLength(e){let t=typeof e==`number`?e:Number.parseFloat(String(e??``));return!Number.isFinite(t)||t<0?-1:Math.trunc(t)}function normalizeWrapBoxLengthUnit(e){return normalizeLengthUnit(e,`px`)}function normalizeWrapBoxPackDirection(e){return ke.includes(e)?e:`start-to-end`}function wrapBoxLengthToPx(e,t,n=96){return e<0?-1:adwLengthToPx(t,e,n)}function resolveWrapBoxLine(e){let t=e.lastLine&&!e.justifyLastLine?`none`:e.justify;if(t===`none`)return{justify:`none`,growChildren:!1,growGaps:!1,align:e.align};let n=t===`spread`&&e.childrenInLine>1;return{justify:t,growChildren:!n,growGaps:n,align:0}}function wrapPolicyFlexShrink(e){return+(e===`minimum`)}function resolveWrapBoxChildOrder(e){let{children:t,child:n,op:r}=e,i=e.sibling??null;if(i!==null&&i===n)return null;let a=t.indexOf(n);if(r===`insert-after`&&a!==-1||r===`reorder-after`&&a===-1)return null;let o=a===-1?[...t]:t.filter((e,t)=>t!==a);if(i===null)return[n,...o];let s=o.indexOf(i);return s===-1?null:[...o.slice(0,s+1),n,...o.slice(s+1)]}function addBreakpoints(e,t){let n=new ResizeObserver(e=>{let n=e[e.length-1];if(!n)return;let r=n.borderBoxSize?.[0],i=r?{width:r.inlineSize,height:r.blockSize}:{width:n.contentRect.width,height:n.contentRect.height};for(let e of t)e.evaluate(i)});return n.observe(e),()=>n.disconnect()}function bindBreakpointSetter(e,t,n){return t?addBreakpoints(e,[new AdwBreakpoint(t,{onApply:()=>n(!0),onUnapply:()=>n(!1)})]):()=>{}}const I=`--accent-bg-color`,L=`--accent-color`;function isAdwaitaDark(e){return e.closest(`.theme-dark`)?!0:e.closest(`.theme-light`)?!1:globalThis.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1}function applyAdwaitaAccent(e,t={}){let n=t.target??document.documentElement,r=t.dark??isAdwaitaDark(n);n.style.setProperty(I,adwaitaAccentBgColor(e)),n.style.setProperty(L,adwaitaAccentColor(e,r))}function clearAdwaitaAccent(e=document.documentElement){e.style.removeProperty(I),e.style.removeProperty(L)}const R=`adw-scroll-shaded`,z=`--adw-overshoot`,Ae=[`overshoot-top`,`overshoot-bottom`],B=new Set([`auto`,`scroll`,`overlay`]);function adjustmentsOf(e){let t=getComputedStyle(e);return{vertical:B.has(t.overflowY)?{value:e.scrollTop,lower:0,upper:e.scrollHeight,pageSize:e.clientHeight}:void 0,horizontal:B.has(t.overflowX)?{value:e.scrollLeft,lower:0,upper:e.scrollWidth,pageSize:e.clientWidth}:void 0}}function isScroller(e){let t=getComputedStyle(e);return B.has(t.overflowY)||B.has(t.overflowX)}function wheelDeltaPx(e,t){return e.deltaMode===WheelEvent.DOM_DELTA_LINE?e.deltaY*16:e.deltaMode===WheelEvent.DOM_DELTA_PAGE?e.deltaY*t:e.deltaY}var AdwScrollShading=class{_root;_mutations=null;_resize=null;_unclamped=new WeakMap;_settleTimers=new WeakMap;_shaded=new Set;_pendingScan=0;_undershootEdges={top:!0,bottom:!0};constructor(e){this._root=e}setUndershootEdges(e){if(!(e.top===this._undershootEdges.top&&e.bottom===this._undershootEdges.bottom)){this._undershootEdges={...e};for(let e of this._shaded)this._update(e)}}connect(){this._mutations||(this._root.addEventListener(`scroll`,this._onScroll,{capture:!0,passive:!0}),this._root.addEventListener(`wheel`,this._onWheel,{capture:!0,passive:!0}),this._mutations=new MutationObserver(()=>this._scheduleRefresh()),this._mutations.observe(this._root,{childList:!0,subtree:!0}),this._resize=new ResizeObserver(()=>this._scheduleRefresh()),this._resize.observe(this._root),this.refresh())}disconnect(){this._root.removeEventListener(`scroll`,this._onScroll,{capture:!0}),this._root.removeEventListener(`wheel`,this._onWheel,{capture:!0}),this._mutations?.disconnect(),this._mutations=null,this._resize?.disconnect(),this._resize=null,this._pendingScan&&cancelAnimationFrame(this._pendingScan),this._pendingScan=0;for(let e of this._shaded)this._clear(e);this._shaded.clear()}_scheduleRefresh(){this._pendingScan||=requestAnimationFrame(()=>{this._pendingScan=0,this.refresh()})}refresh(){let e=new Set;isScroller(this._root)&&e.add(this._root);for(let t of this._root.querySelectorAll(`*`))isScroller(t)&&e.add(t);for(let t of this._shaded)e.has(t)||this._clear(t);this._shaded=e;for(let t of e)this._update(t)}_clear(e){e.classList.remove(R,...F,...Ae),e.style.removeProperty(z)}_update(e){e.classList.add(R);let t=scrollUndershootClasses(adjustmentsOf(e));for(let n of F){let r=(n!==`undershoot-top`||this._undershootEdges.top)&&(n!==`undershoot-bottom`||this._undershootEdges.bottom);e.classList.toggle(n,r&&t.includes(n))}}_onScroll=e=>{let t=e.target;t instanceof HTMLElement&&this._shaded.has(t)&&this._update(t)};_onWheel=e=>{let t=e.target instanceof HTMLElement?this._scrollerFor(e.target):null;if(!t)return;let{vertical:n}=adjustmentsOf(t);if(!n)return;let r=this._unclamped.get(t)??n.value,i=accumulateOvershoot(overshootDistance(r,n)===0?n.value:r,wheelDeltaPx(e,n.pageSize),n);this._unclamped.set(t,i),this._applyOvershoot(t,overshootDistance(i,n)),clearTimeout(this._settleTimers.get(t)),this._settleTimers.set(t,setTimeout(()=>{this._unclamped.set(t,t.scrollTop),this._applyOvershoot(t,0)},50))};_applyOvershoot(e,t){e.classList.toggle(`overshoot-top`,t<0),e.classList.toggle(`overshoot-bottom`,t>0),t===0?e.style.removeProperty(z):e.style.setProperty(z,`${Math.abs(t)}px`)}_scrollerFor(e){for(let t=e;t;t=t.parentElement){if(this._shaded.has(t))return t;if(t===this._root)break}return null}};const V=`adw-icon--`;var AdwIcon=class extends HTMLElement{static get observedAttributes(){return[`icon-name`,`size`]}get iconName(){return this.getAttribute(`icon-name`)??``}set iconName(e){e===null?this.removeAttribute(`icon-name`):this.setAttribute(`icon-name`,e)}get resolvedIconName(){return normalizeIconName(this.getAttribute(`icon-name`))}get size(){let e=Number.parseFloat(this.getAttribute(`size`)??``);return Number.isFinite(e)&&e>0?e:null}set size(e){e===null?this.removeAttribute(`size`):this.setAttribute(`size`,String(e))}connectedCallback(){this._render()}attributeChangedCallback(){this._render()}_render(){this.classList.add(`adw-icon`);let e=[...this.classList].filter(e=>e.startsWith(V));this.classList.remove(...e);let t=this.resolvedIconName;t!==``&&this.classList.add(`${V}${t}`),this.setAttribute(`aria-hidden`,`true`);let n=this.size;if(n===null)this.style.removeProperty(`width`),this.style.removeProperty(`height`),this.style.removeProperty(`mask-size`),this.style.removeProperty(`-webkit-mask-size`);else{let e=`${n}px`;this.style.width=e,this.style.height=e,this.style.setProperty(`mask-size`,e),this.style.setProperty(`-webkit-mask-size`,e)}}};function createAdwIcon(e,...t){let n=document.createElement(`adw-icon`);return e!==null&&n.setAttribute(`icon-name`,e),t.length>0&&n.classList.add(...t),n}customElements.define(`adw-icon`,AdwIcon);var AdwAvatar=class extends HTMLElement{_textEl;_iconEl;_imageEl;_initialized=!1;static get observedAttributes(){return[`text`,`size`,`show-initials`,`icon`,`custom-image`]}connectedCallback(){this._initialized||(this._initialized=!0,this._textEl=document.createElement(`span`),this._textEl.className=`adw-avatar-text`,this._iconEl=createAdwIcon(null,`adw-avatar-icon`),this._imageEl=document.createElement(`img`),this._imageEl.className=`adw-avatar-custom-image`,this._imageEl.alt=``,this.replaceChildren(this._textEl,this._iconEl,this._imageEl),this._render())}attributeChangedCallback(){this._initialized&&this._render()}_render(){let e=parseFloat(this.getAttribute(`size`)||`48`);this.style.width=`${e}px`,this.style.height=`${e}px`;let t=this.getAttribute(`text`)??``,n=this.getAttribute(`custom-image`)??``,r=avatarMode({hasCustomImage:n.length>0,showInitials:this.hasAttribute(`show-initials`),text:t});if(this._imageEl.hidden=r!==`image`,r===`image`)this._imageEl.getAttribute(`src`)!==n&&(this._imageEl.src=n),this.style.backgroundImage=``,this.style.color=``,this._textEl.hidden=!0,this._iconEl.hidden=!0;else if(r===`initials`){let{fg:n,start:r,stop:i}=avatarColor(t);this.style.backgroundImage=`linear-gradient(${r}, ${i})`,this.style.color=n,this._textEl.textContent=avatarInitials(t),this._textEl.hidden=!1,this._iconEl.hidden=!0,this._applyFontSize(e)}else this.style.backgroundImage=``,this.style.color=``,this._textEl.hidden=!0,this._iconEl.iconName=this.getAttribute(`icon`)??`avatar-default`,this._iconEl.size=Math.round(e*.55),this._iconEl.hidden=!1}_applyFontSize(e){let t=avatarMaxFontSize(e);this._textEl.style.fontSize=`${t}px`;let{width:n,height:r}=this._textEl.getBoundingClientRect();this._textEl.style.fontSize=`${avatarFontSize(e,{width:n,height:r})}px`}};customElements.define(`adw-avatar`,AdwAvatar);var AdwBanner=class extends HTMLElement{_titleEl;_button;_initialized=!1;static get observedAttributes(){return[`title`,`button-label`,`revealed`,`use-markup`,`button-style`]}connectedCallback(){this._initialized||(this._initialized=!0,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-banner-title`,this._button=document.createElement(`button`),this._button.className=`adw-banner-button`,this._button.addEventListener(`click`,()=>{this.dispatchEvent(new CustomEvent(`button-clicked`,{bubbles:!0}))}),this.replaceChildren(this._titleEl,this._button),this._render())}attributeChangedCallback(){this._initialized&&this._render()}_render(){let e=this.getAttribute(`title`)??``;this.hasAttribute(`use-markup`)?this._titleEl.innerHTML=e:this._titleEl.textContent=e;let t=this.getAttribute(`button-label`)??``;this._button.textContent=bannerButtonText(t),this._button.hidden=!bannerButtonVisible(t);let n=bannerButtonStyleClasses(parseBannerButtonStyle(this.getAttribute(`button-style`)));for(let e of p)this._button.classList.toggle(e,n.includes(e));this.classList.toggle(`revealed`,this.hasAttribute(`revealed`))}};customElements.define(`adw-banner`,AdwBanner);var AdwCard=class extends HTMLElement{connectedCallback(){this.classList.add(`adw-card`)}};customElements.define(`adw-card`,AdwCard);var AdwDataGrid=class extends HTMLElement{_captionEl;_scrollEl;_tableEl;_columns=[];_rows=[];_initialized=!1;static get observedAttributes(){return[`columns`,`rows`,`caption`,`interactive`]}get columns(){return this._columns}set columns(e){this._columns=normalizeDataGridColumns(e),this._initialized&&this._render()}get rows(){return this._rows}set rows(e){this._rows=Array.isArray(e)?e.map(e=>({...e})):[],this._initialized&&this._render()}get caption(){return this.getAttribute(`caption`)??``}set caption(e){e?this.setAttribute(`caption`,e):this.removeAttribute(`caption`)}get interactive(){return this.hasAttribute(`interactive`)}set interactive(e){e?this.setAttribute(`interactive`,``):this.removeAttribute(`interactive`)}connectedCallback(){this._initialized||(this._initialized=!0,this.classList.add(`adw-data-grid`),this._captionEl=document.createElement(`div`),this._captionEl.className=`adw-data-grid-caption`,this._captionEl.hidden=!0,this._scrollEl=document.createElement(`div`),this._scrollEl.className=`adw-data-grid-scroll`,this._tableEl=document.createElement(`div`),this._tableEl.className=`adw-data-grid-table`,this._tableEl.setAttribute(`role`,`table`),this._scrollEl.appendChild(this._tableEl),this._columns.length===0&&(this._columns=this._parseJsonAttr(`columns`,normalizeDataGridColumns)),this._rows.length===0&&(this._rows=this._parseJsonAttr(`rows`,e=>Array.isArray(e)?e:[])),this.replaceChildren(this._captionEl,this._scrollEl),this._render())}attributeChangedCallback(e,t,n){this._initialized&&(e===`columns`?(this._columns=this._parseJsonAttr(`columns`,normalizeDataGridColumns),this._render()):e===`rows`?(this._rows=this._parseJsonAttr(`rows`,e=>Array.isArray(e)?e:[]),this._render()):e===`caption`?this._renderCaption():e===`interactive`&&this._render())}_parseJsonAttr(e,t){let n=this.getAttribute(e);if(!n)return t(void 0);try{return t(JSON.parse(n))}catch{return t(void 0)}}_renderCaption(){let e=this.getAttribute(`caption`)??``;this._captionEl.textContent=e,this._captionEl.hidden=e.length===0}_trackTemplate(){return dataGridTrackTemplate(dataGridTracks(this._columns))}_columnClasses(e){return dataGridColumnClasses(e).join(` `)}_render(){if(!this._tableEl||(this._renderCaption(),this._tableEl.style.gridTemplateColumns=this._trackTemplate(),this._tableEl.replaceChildren(),this._columns.length===0))return;let e=document.createElement(`div`);e.className=`adw-data-grid-row header`,e.setAttribute(`role`,`row`);for(let t of this._columns){let n=document.createElement(`div`);n.className=`${this._columnClasses(t)} header-cell`,n.setAttribute(`role`,`columnheader`),n.textContent=t.label??t.key,e.appendChild(n)}this._tableEl.appendChild(e);let t=this.hasAttribute(`interactive`);this._rows.forEach((e,n)=>{let r=normalizeDataGridVariant(e.variant),i=document.createElement(`div`);if(i.className=`adw-data-grid-row variant-${r}`,i.setAttribute(`role`,`row`),r===`section`){let t=this._columns[0]?.key??``,n=document.createElement(`div`);n.className=`adw-data-grid-cell align-start section-cell`,n.setAttribute(`role`,`cell`),n.style.gridColumn=`1 / -1`,n.textContent=dataGridCellText(e[t]),i.appendChild(n)}else for(let t of this._columns){let n=document.createElement(`div`);n.className=this._columnClasses(t),n.setAttribute(`role`,`cell`),n.textContent=dataGridCellText(e[t.key]),i.appendChild(n)}dataGridRowInteractive(r,e.interactive,t)&&(i.classList.add(`interactive`),i.tabIndex=0,i.addEventListener(`click`,()=>this._activate(n,e)),i.addEventListener(`keydown`,t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),this._activate(n,e))})),this._tableEl.appendChild(i)})}_activate(e,t){this.dispatchEvent(new CustomEvent(`row-activated`,{bubbles:!0,detail:{index:e,row:t}}))}};customElements.define(`adw-data-grid`,AdwDataGrid);var AdwClamp=class extends HTMLElement{_resize=null;_mutations=null;static get observedAttributes(){return[`maximum-size`,`tightening-threshold`]}connectedCallback(){this._resize=new ResizeObserver(()=>this._allocate()),this._resize.observe(this),this._mutations=new MutationObserver(()=>this._allocate()),this._mutations.observe(this,{childList:!0}),this._allocate()}disconnectedCallback(){this._resize?.disconnect(),this._resize=null,this._mutations?.disconnect(),this._mutations=null}attributeChangedCallback(){this._allocate()}_allocate(){let e={maximumSize:normalizeClampSize(this.getAttribute(`maximum-size`),g.maximumSize),tighteningThreshold:normalizeClampSize(this.getAttribute(`tightening-threshold`),g.tighteningThreshold),childMin:0,childNat:0},t=this.clientWidth,n=Array.from(this.children);if(t<=0){for(let e of n){e.style.maxWidth=``,e.style.marginInline=``;for(let t of ae)e.classList.remove(t)}return}let{childSize:r,sizeClass:i}=clampAllocate(t,e);for(let e of n){e.style.maxWidth=`${r}px`,e.style.marginInline=`auto`;for(let t of ae)e.classList.toggle(t,t===i)}}};customElements.define(`adw-clamp`,AdwClamp);const H=`http://www.w3.org/2000/svg`,U=new Set;let W=0;function tick(e){for(let t of U)t.drawAt(e);W=U.size>0?requestAnimationFrame(tick):0}function startTicking(){W===0&&U.size>0&&(W=requestAnimationFrame(tick))}var AdwSpinner=class extends HTMLElement{static get observedAttributes(){return[`size`]}_svg=null;_track=null;_arc=null;_circumference=0;_radius=0;_origin=null;connectedCallback(){this._build(),U.add(this),this._origin=null,startTicking()}disconnectedCallback(){U.delete(this)}attributeChangedCallback(){this._sync()}drawAt(e){this._origin===null&&(this._origin=e),this._paint(spinnerProgressAt(e-this._origin))}_build(){if(this._svg)return;let e=document.createElementNS(H,`svg`);e.setAttribute(`fill`,`none`),e.setAttribute(`aria-hidden`,`true`);let t=document.createElementNS(H,`circle`);t.setAttribute(`stroke`,`currentColor`),t.setAttribute(`stroke-opacity`,`0.15`);let n=document.createElementNS(H,`circle`);n.setAttribute(`stroke`,`currentColor`),n.setAttribute(`stroke-linecap`,`round`),e.append(t,n),this._svg=e,this._track=t,this._arc=n,this.replaceChildren(e),this.setAttribute(`role`,`progressbar`),this.setAttribute(`aria-busy`,`true`),this._sync()}_sync(){let e=this._svg,t=this._track,n=this._arc;if(!e||!t||!n)return;let r=resolveSpinnerSize(this.getAttribute(`size`)),{diameter:i,lineWidth:a}=spinnerGeometry(r,r);this.style.width=`${r}px`,this.style.height=`${r}px`,e.setAttribute(`width`,String(i)),e.setAttribute(`height`,String(i)),e.setAttribute(`viewBox`,`0 0 ${i} ${i}`);let o=(i-a)/2;this._radius=o,this._circumference=2*Math.PI*o;for(let e of[t,n])e.setAttribute(`cx`,String(i/2)),e.setAttribute(`cy`,String(i/2)),e.setAttribute(`r`,String(o)),e.setAttribute(`stroke-width`,String(a));this._paint(this._origin===null?fe:this._lastProgress)}_lastProgress=fe;_paint(e){let t=this._arc;if(!t||this._radius<=0)return;this._lastProgress=e;let{end:n,length:r}=spinnerArc(e),i=r*this._radius;t.setAttribute(`stroke-dasharray`,`${i} ${Math.max(this._circumference-i,0)}`),t.setAttribute(`stroke-dashoffset`,String(-n*this._radius))}};customElements.define(`adw-spinner`,AdwSpinner);var AdwStatusPage=class extends HTMLElement{_iconEl;_titleEl;_descEl;_childEl;_initialized=!1;static get observedAttributes(){return[`icon`,`title`,`description`]}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=Array.from(this.childNodes);this._iconEl=createAdwIcon(null,`adw-status-page-icon`),this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-status-page-title`,this._descEl=document.createElement(`span`),this._descEl.className=`adw-status-page-description`,this._childEl=document.createElement(`div`),this._childEl.className=`adw-status-page-child`;for(let t of e)this._childEl.appendChild(t);this.replaceChildren(this._iconEl,this._titleEl,this._descEl,this._childEl),this._render()}attributeChangedCallback(){this._initialized&&this._render()}_render(){this._iconEl.iconName=this.getAttribute(`icon`),this._iconEl.hidden=this._iconEl.resolvedIconName===``;let e=this.getAttribute(`title`)??``;this._titleEl.textContent=e,this._titleEl.hidden=!stringIsNotEmpty(e);let t=this.getAttribute(`description`)??``;this._descEl.textContent=t,this._descEl.hidden=!stringIsNotEmpty(t),this._childEl.hidden=this._childEl.childElementCount===0}};customElements.define(`adw-status-page`,AdwStatusPage);var AdwWindow=class extends HTMLElement{connectedCallback(){let e=this.getAttribute(`width`),t=this.getAttribute(`height`);e&&(this.style.width=`${e}px`),t&&(this.style.height=`${t}px`)}};customElements.define(`adw-window`,AdwWindow);var AdwWindowTitle=class extends HTMLElement{_titleEl;_subtitleEl;_state=new WindowTitleState;_initialized=!1;static get observedAttributes(){return[`title`,`subtitle`]}connectedCallback(){this._initialized||(this._initialized=!0,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-window-title-title`,this._subtitleEl=document.createElement(`span`),this._subtitleEl.className=`adw-window-title-subtitle`,this.replaceChildren(this._titleEl,this._subtitleEl),this._state.setTitle(this.getAttribute(`title`)),this._state.setSubtitle(this.getAttribute(`subtitle`)),this._render())}attributeChangedCallback(e,t,n){this._initialized&&(e===`title`?this._state.setTitle(n):this._state.setSubtitle(n))&&(this._render(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:e===`title`?this._state.title:this._state.subtitle}})))}_render(){let{title:e,titleVisible:t,subtitle:n,subtitleVisible:r}=this._state.state;this._titleEl.textContent=e,this._titleEl.hidden=!t,this._subtitleEl.textContent=n,this._subtitleEl.hidden=!r}};customElements.define(`adw-window-title`,AdwWindowTitle);var AdwHeaderBar=class extends HTMLElement{_initialized=!1;_startEl=null;_centerEl=null;_endEl=null;_titleEl=null;static get observedAttributes(){return[`title`,`subtitle`]}get startSection(){return this._startEl}get centerSection(){return this._centerEl}get endSection(){return this._endEl}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=Array.from(this.querySelectorAll(`:scope > [slot="start"]`)),t=Array.from(this.querySelectorAll(`:scope > [slot="center"]`)),n=Array.from(this.querySelectorAll(`:scope > [slot="end"]`));this._startEl=document.createElement(`div`),this._startEl.className=`adw-header-bar-start`;for(let t of e)this._startEl.appendChild(t);if(this._centerEl=document.createElement(`div`),this._centerEl.className=`adw-header-bar-center`,t.length>0)for(let e of t)this._centerEl.appendChild(e);else this._titleEl=document.createElement(`adw-window-title`),this._titleEl.className=`adw-header-bar-title`,this._centerEl.appendChild(this._titleEl);this._endEl=document.createElement(`div`),this._endEl.className=`adw-header-bar-end`;for(let e of n)this._endEl.appendChild(e);this.replaceChildren(this._startEl,this._centerEl,this._endEl),this._renderTitle()}attributeChangedCallback(){this._initialized&&this._renderTitle()}_renderTitle(){if(this._titleEl)for(let e of[`title`,`subtitle`]){let t=this.getAttribute(e);t===null?this._titleEl.removeAttribute(e):this._titleEl.setAttribute(e,t)}}};customElements.define(`adw-header-bar`,AdwHeaderBar);const je=[`flat`,`suggested`,`destructive`,`circular`,`pill`];var AdwButton=class extends HTMLElement{_button;_label=``;_initialized=!1;static get observedAttributes(){return[`icon`,`label`,`tooltip`,`disabled`,`flat`,`suggested`,`destructive`,`circular`,`pill`]}get button(){return this._button}connectedCallback(){this._initialized||(this._initialized=!0,this._label=(this.getAttribute(`label`)??this.textContent??``).trim(),this._button=document.createElement(`button`),this.replaceChildren(this._button),this._render())}attributeChangedCallback(){this._initialized&&this._render()}_render(){let e=this._button;e.className=`adw-button`,e.classList.add(...buttonStyleClasses(je.filter(e=>this.hasAttribute(e))));let t=this.getAttribute(`icon`),n=(this.getAttribute(`label`)??this._label).trim();t&&!n&&e.classList.add(`icon-only`),e.replaceChildren(),t&&e.appendChild(createAdwIcon(t)),n&&e.appendChild(document.createTextNode(n));let r=this.getAttribute(`tooltip`);e.title=r??``,t&&!n?e.setAttribute(`aria-label`,r??t):e.removeAttribute(`aria-label`),e.disabled=this.hasAttribute(`disabled`)}};customElements.define(`adw-button`,AdwButton);var AdwButtonContent=class extends HTMLElement{_boxEl;_iconEl;_labelEl;_initialized=!1;_styledHost=null;static get observedAttributes(){return[`icon-name`,`label`,`use-underline`,`can-shrink`]}connectedCallback(){this._initialized||(this._initialized=!0,this._boxEl=document.createElement(`div`),this._boxEl.className=`adw-button-content-box`,this._iconEl=createAdwIcon(null),this._labelEl=document.createElement(`span`),this._labelEl.className=`adw-button-content-label`,this._boxEl.append(this._iconEl,this._labelEl),this.replaceChildren(this._boxEl),this._render()),this._root()}disconnectedCallback(){this._unroot()}attributeChangedCallback(e){this._initialized&&(this._render(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0})))}_hostButton(){let e=this.parentElement?.closest(`button, .adw-button`)??null;if(!e)return null;let t=e.parentElement;return t?.matches(`adw-split-button, .adw-split-button`)?t:e}_root(){let e=this._hostButton();e!==this._styledHost&&(this._unroot(),e&&(e.classList.add(m),this._styledHost=e))}_unroot(){this._styledHost?.classList.remove(m),this._styledHost=null}_render(){this._iconEl.iconName=buttonContentIconName(this.getAttribute(`icon-name`)??``),this._iconEl.hidden=!1;let e=this.getAttribute(`label`)??``;this._labelEl.textContent=buttonContentLabelText(e,this.hasAttribute(`use-underline`)),this._labelEl.hidden=e.length===0,this.classList.toggle(`can-shrink`,this.hasAttribute(`can-shrink`))}};customElements.define(`adw-button-content`,AdwButtonContent);var AdwSwitch=class extends HTMLElement{_input;_slider;_initialized=!1;static get observedAttributes(){return[`active`,`disabled`]}get active(){return this.hasAttribute(`active`)}set active(e){this.toggleAttribute(`active`,!!e)}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){this.toggleAttribute(`disabled`,!!e)}connectedCallback(){this._initialized||(this._initialized=!0,this.classList.add(`adw-switch`),this._input=document.createElement(`input`),this._input.type=`checkbox`,this._slider=document.createElement(`span`),this._slider.className=`adw-switch-slider`,this.replaceChildren(this._input,this._slider),this._input.addEventListener(`change`,()=>{this.active=this._input.checked}),this.addEventListener(`click`,e=>{this.disabled||e.target!==this._input&&(this.active=!this.active)}),this._render())}attributeChangedCallback(e){this._initialized&&(this._render(),e===`active`&&this.dispatchEvent(new CustomEvent(`notify::active`,{bubbles:!0,detail:{active:this.active}})))}_render(){let e=this.disabled;this._input.checked=this.active,this._input.disabled=e,this.classList.toggle(`disabled`,e)}};customElements.define(`adw-switch`,AdwSwitch);const G=new RadioGroupState;var AdwCheckBase=class extends HTMLElement{_input;_indicator;_label;_initialized=!1;get checked(){return this.hasAttribute(`checked`)}set checked(e){this.toggleAttribute(`checked`,!!e)}get indeterminate(){return this.hasAttribute(`indeterminate`)}set indeterminate(e){this.toggleAttribute(`indeterminate`,!!e)}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){this.toggleAttribute(`disabled`,!!e)}get label(){return this.getAttribute(`label`)??this._label?.textContent??``}set label(e){this.setAttribute(`label`,e)}connectedCallback(){if(this._initialized){this.onConnected();return}this._initialized=!0;let e=[...this.childNodes];this._input=document.createElement(`input`),this._input.type=this.inputType,this._input.className=`adw-check-input`,this._indicator=document.createElement(`span`),this._indicator.className=`adw-check-indicator`,this._label=document.createElement(`span`),this._label.className=`adw-check-label`;let t=this.getAttribute(`label`);t===null?this._label.append(...e):this._label.textContent=t,this.replaceChildren(this._input,this._indicator,this._label),this._input.addEventListener(`change`,()=>this.activate()),this.addEventListener(`click`,e=>{this.disabled||e.target!==this._input&&this.activate()}),this.onConnected(),this.render()}disconnectedCallback(){this.onDisconnected()}attributeChangedCallback(e){this._initialized&&(e===`label`&&(this._label.textContent=this.getAttribute(`label`)??``),this.render(),e===`checked`&&this.dispatchEvent(new CustomEvent(`notify::checked`,{bubbles:!0,detail:{checked:this.checked}})))}onConnected(){}onDisconnected(){}render(){let e=resolveCheckState(this.checked,this.indeterminate);this._input.checked=e===`checked`,this._input.indeterminate=e===`indeterminate`,this._input.setAttribute(`aria-checked`,e===`indeterminate`?`mixed`:String(e===`checked`)),this._input.disabled=this.disabled,this._label.hidden=this._label.childNodes.length===0}},AdwCheckbox=class extends AdwCheckBase{static get observedAttributes(){return[`checked`,`indeterminate`,`disabled`,`label`]}get inputType(){return`checkbox`}activate(){this.indeterminate=!1,this.checked=!this.checked}},AdwRadio=class extends AdwCheckBase{_unsubscribe=null;static get observedAttributes(){return[`checked`,`indeterminate`,`disabled`,`label`,`name`,`value`]}get inputType(){return`radio`}get name(){return this.getAttribute(`name`)??``}set name(e){this.setAttribute(`name`,e)}get value(){return this.getAttribute(`value`)??this.label.trim()}set value(e){this.setAttribute(`value`,e)}activate(){if(this.indeterminate=!1,this.name===``){this.checked=!0;return}G.select(this.name,this.value)}onConnected(){this._input.name=this.name,this.name!==``&&(this._unsubscribe??=G.subscribe(e=>{e.name===this.name&&(this.checked=e.selected===this.value)}),this.checked&&G.select(this.name,this.value))}onDisconnected(){this._unsubscribe?.(),this._unsubscribe=null}render(){super.render(),this._input.name=this.name}};customElements.define(`adw-checkbox`,AdwCheckbox),customElements.define(`adw-radio`,AdwRadio);var AdwProgressBar=class extends HTMLElement{_trough;_progress;_text;_initialized=!1;static get observedAttributes(){return[`fraction`,`pulsing`,`show-text`,`text`,`inverted`,`osd`,`disabled`]}get fraction(){let e=Number.parseFloat(this.getAttribute(`fraction`)??``);return Number.isFinite(e)?glibClamp(e,0,1):0}set fraction(e){this.setAttribute(`fraction`,String(e))}get pulsing(){return this.hasAttribute(`pulsing`)}set pulsing(e){this.toggleAttribute(`pulsing`,!!e)}get showText(){return this.hasAttribute(`show-text`)}set showText(e){this.toggleAttribute(`show-text`,!!e)}get text(){let e=this.getAttribute(`text`);return e===null?`${Math.round(this.fraction*100)}%`:e}set text(e){this.setAttribute(`text`,e)}get inverted(){return this.hasAttribute(`inverted`)}set inverted(e){this.toggleAttribute(`inverted`,!!e)}get osd(){return this.hasAttribute(`osd`)}set osd(e){this.toggleAttribute(`osd`,!!e)}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){this.toggleAttribute(`disabled`,!!e)}pulse(){this.pulsing=!0}connectedCallback(){this._initialized||(this._initialized=!0,this._trough=document.createElement(`span`),this._trough.className=`adw-progress-bar-trough`,this._progress=document.createElement(`span`),this._progress.className=`adw-progress-bar-progress`,this._trough.appendChild(this._progress),this._text=document.createElement(`span`),this._text.className=`adw-progress-bar-text`,this.replaceChildren(this._trough,this._text),this.setAttribute(`role`,`progressbar`),this.setAttribute(`aria-valuemin`,`0`),this.setAttribute(`aria-valuemax`,`1`),this._render())}attributeChangedCallback(){this._initialized&&this._render()}_render(){let e=this.fraction,t=this.pulsing,n=!t&&e===0;this._trough.classList.toggle(`empty`,n),this._progress.style.width=t||n?``:`${e*100}%`,this._text.textContent=this.text,this._text.hidden=!this.showText,t?this.removeAttribute(`aria-valuenow`):this.setAttribute(`aria-valuenow`,String(e))}};customElements.define(`adw-progress-bar`,AdwProgressBar);var AdwShortcutLabel=class extends HTMLElement{_initialized=!1;static get observedAttributes(){return[`accelerator`,`disabled-text`]}connectedCallback(){this._initialized||(this._initialized=!0,this.hasAttribute(`role`)||this.setAttribute(`role`,`img`)),this._render()}attributeChangedCallback(e){this._initialized&&(this._render(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0})))}get accelerator(){return this.getAttribute(`accelerator`)??``}set accelerator(e){this.setAttribute(`accelerator`,e)}get disabledText(){return this.getAttribute(`disabled-text`)??``}set disabledText(e){this.setAttribute(`disabled-text`,e)}_render(){let{nodes:e,accessibleLabel:t,error:n}=parseShortcutLabel(this.accelerator,{disabledText:this.disabledText,direction:this._direction()});this.replaceChildren(...e.map(e=>this._nodeElement(e))),this.setAttribute(`aria-label`,t),n&&console.warn(`adw-shortcut-label: failed to parse ${n}, part of accelerator '${this.accelerator}'`)}_direction(){let e=this.isConnected?getComputedStyle(this).direction:``;return e===`rtl`||e===`ltr`?e:this.closest(`[dir="rtl"]`)?`rtl`:`ltr`}_nodeElement(e){if(e.kind===`separator`||e.kind===`disabled`){let t=document.createElement(`span`);return t.className=e.kind===`disabled`?`dimmed adw-shortcut-label-disabled`:`dimmed`,t.textContent=e.text,t}let t=document.createElement(`span`);t.className=`adw-shortcut-label-keys`,t.setAttribute(`dir`,`ltr`);for(let n of e.keys){let e=document.createElement(`span`);if(e.className=`keycap`,e.textContent=n.label,n.sideMarker){let t=document.createElement(`sub`);t.className=`adw-shortcut-label-side`,t.textContent=n.sideMarker,e.append(t)}t.append(e)}return t}};customElements.define(`adw-shortcut-label`,AdwShortcutLabel);const Me=[`bottom`,`top`,`start`,`end`],Ne=[`start`,`end`],Pe=[`menu`,`listbox`];var AdwPopover=class extends HTMLElement{_state=new PopoverState;_anchor=null;_initialized=!1;_reflecting=!1;_onDocumentPointerDown=e=>{let t=e.target;this.contains(t)||this.anchor?.contains(t)!==!0&&this._state.dismiss()};_onDocumentKeyDown=e=>{e.key===`Escape`&&(e.stopPropagation(),this._state.dismiss(),this.anchor?.focus())};static get observedAttributes(){return[`open`,`position`,`align`,`role`,`menu`]}get open(){return this._state.open}set open(e){e?this._state.popup():this._state.popdown()}get anchor(){return this._anchor??this.parentElement}set anchor(e){this._anchor=e}get position(){let e=this.getAttribute(`position`);return Me.includes(e)?e:`bottom`}set position(e){this.setAttribute(`position`,e)}get align(){let e=this.getAttribute(`align`);return Ne.includes(e)?e:`start`}set align(e){this.setAttribute(`align`,e)}get popoverRole(){let e=this.getAttribute(`role`);return Pe.includes(e)?e:`menu`}get items(){return[...this.querySelectorAll(`.adw-popover-item`)].filter(e=>!e.hidden)}popup(){this._state.popup()}popdown(){this._state.popdown()}subscribe(e){return this._state.subscribe(t=>e(t.open))}connectedCallback(){this._initialized||(this._initialized=!0,this.classList.add(`adw-popover`),this.hasAttribute(`role`)||this.setAttribute(`role`,`menu`),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),this._state.subscribe(e=>this._onStateChange(e.open)),this.hasAttribute(`open`)&&this._state.popup(),this._render())}disconnectedCallback(){this._unbindDocument()}attributeChangedCallback(e,t,n){if(this._initialized){if(e===`open`){if(this._reflecting)return;n===null?this._state.popdown():this._state.popup();return}if(e===`role`&&n===null){this.setAttribute(`role`,`menu`);return}this._render()}}_onStateChange(e){e?this._bindDocument():this._unbindDocument(),this._reflecting=!0,e?this.setAttribute(`open`,``):this.removeAttribute(`open`),this._reflecting=!1,this._render(),this.dispatchEvent(new CustomEvent(`notify::open`,{bubbles:!0,detail:{open:e}}))}_bindDocument(){document.addEventListener(`pointerdown`,this._onDocumentPointerDown),document.addEventListener(`keydown`,this._onDocumentKeyDown,!0)}_unbindDocument(){document.removeEventListener(`pointerdown`,this._onDocumentPointerDown),document.removeEventListener(`keydown`,this._onDocumentKeyDown,!0)}_render(){this.hidden=!this._state.open,this.dataset.position=this.position,this.dataset.align=this.align}_onKeyDown(e){if(!this._state.open)return;let t=this.items,n=document.activeElement,r=n===null?-1:t.indexOf(n),i=this.querySelector(`input, textarea`)!==null,{action:a,index:o}=resolvePopoverKey(e.key,{itemCount:t.length,currentIndex:r,hasSearch:i});if(a===`focus`){e.preventDefault(),t[o]?.focus();return}a===`activate`&&(e.preventDefault(),t[o]?.click(),this.dispatchEvent(new CustomEvent(`popover-item-activated`,{bubbles:!0,detail:{index:o}})))}};customElements.define(`adw-popover`,AdwPopover);const Fe={flat:`flat`,suggested:`suggested-action`,destructive:`destructive-action`},Ie={"open-menu-symbolic":`open-menu`,"pan-down-symbolic":`go-down`,"pan-up-symbolic":`go-down`,"pan-start-symbolic":`go-previous`,"pan-end-symbolic":`go-next`},Le={down:`bottom`,up:`top`,left:`start`,right:`end`};var AdwSplitButton=class extends HTMLElement{_state=new SplitButtonState;_actionEl;_dropdownEl;_arrowEl;_menuEl;_inlineLabel=``;_openReflected=!1;_initialized=!1;static get observedAttributes(){return[`label`,`icon-name`,`use-underline`,`tooltip`,`dropdown-tooltip`,`direction`,`menu`,`disabled`,`flat`,`suggested`,`destructive`]}get active(){return this._state.open}get dropdownEnabled(){return this._state.dropdownEnabled}get label(){return this._state.label}set label(e){this.setAttribute(`label`,e??``),this.removeAttribute(`icon-name`)}get iconName(){return this._state.iconName}set iconName(e){this.setAttribute(`icon-name`,e??``),this.removeAttribute(`label`)}get menuItems(){return this._state.menuModel??[]}set menuItems(e){this._state.setMenuModel(Array.isArray(e)?e.map(e=>({...e})):null),this._initialized&&this._render()}get dropdownTooltip(){return this._state.dropdownTooltip}set dropdownTooltip(e){this.setAttribute(`dropdown-tooltip`,e??``)}get direction(){return this._state.direction}set direction(e){this.setAttribute(`direction`,e)}get useUnderline(){return this._state.useUnderline}set useUnderline(e){e?this.setAttribute(`use-underline`,``):this.removeAttribute(`use-underline`)}popup(){this._state.openMenu()}popdown(){this._state.closeMenu()}connectedCallback(){this._initialized||(this._initialized=!0,this._inlineLabel=(this.textContent??``).trim(),this.classList.add(`adw-split-button`),this._actionEl=document.createElement(`button`),this._actionEl.type=`button`,this._actionEl.className=`adw-split-button-action`,this._dropdownEl=document.createElement(`button`),this._dropdownEl.type=`button`,this._dropdownEl.className=`adw-split-button-dropdown`,this._dropdownEl.setAttribute(`aria-haspopup`,`menu`),this._arrowEl=createAdwIcon(null),this._dropdownEl.appendChild(this._arrowEl),this._menuEl=document.createElement(`adw-popover`),this._menuEl.classList.add(`adw-split-button-menu`),this._menuEl.setAttribute(`role`,`menu`),this._menuEl.setAttribute(`menu`,``),this._menuEl.setAttribute(`align`,`end`),this.replaceChildren(this._actionEl,this._dropdownEl,this._menuEl),this._menuEl.anchor=this._dropdownEl,this._menuEl.subscribe(e=>{e||this._state.closeMenu()}),this._actionEl.addEventListener(`click`,()=>{this.hasAttribute(`disabled`)||this.dispatchEvent(new CustomEvent(`clicked`,{bubbles:!0}))}),this._dropdownEl.addEventListener(`click`,()=>{this.hasAttribute(`disabled`)||this._state.toggleMenu()}),this._syncStateFromAttributes(),this._state.subscribe(e=>this._onStateChange(e)),this._render())}attributeChangedCallback(e,t,n){if(this._initialized){switch(e){case`label`:case`icon-name`:this._applyContentAttribute(e,n);break;case`use-underline`:this._state.setUseUnderline(n!==null);break;case`direction`:this._state.setDirection(isSplitButtonDirection(n)?n:`down`);break;case`dropdown-tooltip`:this._state.setDropdownTooltip(n??``);break;case`menu`:this._state.setMenuModel(parseMenuEntries(n));break;default:break}this._render()}}_syncStateFromAttributes(){let e=this.getAttribute(`label`)??(this._inlineLabel.length>0?this._inlineLabel:null),t=this.getAttribute(`icon-name`);e!==null&&this._state.setLabel(e),t!==null&&this._state.setIconName(t),this._state.setUseUnderline(this.hasAttribute(`use-underline`));let n=this.getAttribute(`direction`);isSplitButtonDirection(n)&&this._state.setDirection(n),this._state.setDropdownTooltip(this.getAttribute(`dropdown-tooltip`)??``),this._state.menuModel===null&&this._state.setMenuModel(parseMenuEntries(this.getAttribute(`menu`)))}_applyContentAttribute(e,t){if(t!==null){e===`label`?this._state.setLabel(t):this._state.setIconName(t);return}let n=this.getAttribute(e===`label`?`icon-name`:`label`);n===null?this._state.setChild(null):e===`label`?this._state.setIconName(n):this._state.setLabel(n)}_onStateChange(e){for(let t of e.notified)this.dispatchEvent(new CustomEvent(`notify::${t}`,{bubbles:!0}));let t=e.open&&!this._openReflected;e.open!==this._openReflected&&(this._openReflected=e.open,this.dispatchEvent(new CustomEvent(`notify::active`,{bubbles:!0,detail:{active:e.open}}))),this._render(),t&&this._menuEl.items[0]?.focus()}_render(){let e=this.hasAttribute(`disabled`);this.classList.toggle(`disabled`,e),this._actionEl.disabled=e,this._dropdownEl.disabled=e||!this._state.dropdownEnabled,this.classList.remove(`flat`,`suggested-action`,`destructive-action`);for(let[e,t]of Object.entries(Fe))this.hasAttribute(e)&&this.classList.add(t);this._renderContent(),this._renderDropdown(),this._renderMenu()}_renderContent(){let{mode:e,label:t,iconName:n,styleClasses:r}=this._state;this.classList.toggle(`image-button`,r.includes(`image-button`)),this.classList.toggle(`text-button`,r.includes(`text-button`)),this._actionEl.replaceChildren(),this._actionEl.classList.toggle(`icon-only`,e===`icon`),e===`icon`&&n!==null?this._actionEl.appendChild(createAdwIcon(n)):e===`label`&&t!==null&&this._actionEl.appendChild(document.createTextNode(t));let i=this.getAttribute(`tooltip`);this._actionEl.title=i??``,e===`icon`?this._actionEl.setAttribute(`aria-label`,i??(n||`Action`)):this._actionEl.removeAttribute(`aria-label`)}_renderDropdown(){let{direction:e,open:t}=this._state,n=splitButtonArrowIcon(e);this._arrowEl.iconName=Ie[n],this._arrowEl.style.transform=n===`pan-up-symbolic`?`rotate(180deg)`:``,this._menuEl.position=Le[splitButtonPopupDirection(e)];let{text:r}=resolveDropdownTooltip(this._state.dropdownTooltip);this._dropdownEl.title=r,this._dropdownEl.setAttribute(`aria-label`,r),this._dropdownEl.setAttribute(`aria-expanded`,String(t));let{checked:i}=splitButtonRootState({active:!1,checked:!1,keyboardActivating:!1},{active:!1,checked:t,keyboardActivating:!1});this.classList.toggle(`checked`,i),this.classList.toggle(`active`,t)}_renderMenu(){this._menuEl.replaceChildren(),this._menuEl.open=this._state.open;for(let[e,t]of(this._state.menuModel??[]).entries()){let n=document.createElement(`button`);n.type=`button`,n.className=`adw-popover-item adw-split-button-menu-item`,n.setAttribute(`role`,`menuitem`),n.tabIndex=-1,n.textContent=t.label,n.addEventListener(`click`,()=>{let t=this._state.activateMenuEntry(e);t!==null&&this.dispatchEvent(new CustomEvent(`menu-activated`,{bubbles:!0,detail:{label:t.label,action:t.action,index:e}}))}),this._menuEl.appendChild(n)}}};customElements.define(`adw-split-button`,AdwSplitButton);var AdwToggle=class extends HTMLElement{static get observedAttributes(){return[`label`,`icon-name`]}},AdwToggleGroup=class extends HTMLElement{_innerEl;_buttons=[];_state=new ToggleGroupState;_initialized=!1;static get observedAttributes(){return[`active`,`flat`,`round`]}get active(){return this._state.selected}set active(e){this.setAttribute(`active`,String(e))}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=Array.from(this.querySelectorAll(`adw-toggle`));this._innerEl=document.createElement(`div`),this._innerEl.className=`adw-toggle-group-inner`,this._buttons=e.map((e,t)=>{let n=document.createElement(`button`);n.type=`button`,n.className=`adw-toggle`;let r=e.getAttribute(`label`)??``,i=e.getAttribute(`icon-name`)??``;return i&&n.appendChild(createAdwIcon(i)),r&&n.appendChild(document.createTextNode(r)),i&&!r&&n.setAttribute(`aria-label`,i),n.addEventListener(`click`,()=>this._selectIndex(t)),n}),this._innerEl.append(...this._buttons),this.replaceChildren(this._innerEl),this._state.setLabels(e.map(e=>e.getAttribute(`label`)||e.getAttribute(`icon-name`)||``)),this._state.subscribe(()=>this._render()),this._state.setSelected(this._readActiveAttr()),this._render()}attributeChangedCallback(e){if(this._initialized){if(e===`active`){this._state.setSelected(this._readActiveAttr());return}this._render()}}_readActiveAttr(){let e=Number.parseInt(this.getAttribute(`active`)??`0`,10);if(Number.isNaN(e))return 0;let t=Math.max(0,this._state.count-1);return Math.min(Math.max(e,0),t)}_selectIndex(e){this._state.setSelected(e)&&(this.setAttribute(`active`,String(e)),this.dispatchEvent(new CustomEvent(`notify::active`,{bubbles:!0,detail:{active:e}})))}_render(){this.classList.toggle(`flat`,this.hasAttribute(`flat`)),this.classList.toggle(`round`,this.hasAttribute(`round`));let e=this._state.selected;this._buttons.forEach((t,n)=>{let r=n===e;t.classList.toggle(`active`,r),t.setAttribute(`aria-pressed`,String(r))})}};customElements.define(`adw-toggle`,AdwToggle),customElements.define(`adw-toggle-group`,AdwToggleGroup);var AdwEntry=class extends HTMLElement{_input;_initialized=!1;_maxLength=0;static get observedAttributes(){return[`value`,`placeholder`,`type`,`disabled`,`maxlength`]}get value(){return this._input?this._input.value:this.getAttribute(`value`)??``}set value(e){let t=clampEntryText(e??``,this._maxLength);this._input?this._input.value=t:this.setAttribute(`value`,t)}get maxLength(){return this._maxLength}set maxLength(e){this._maxLength=Number.isFinite(e)?Math.min(_,Math.max(0,Math.trunc(e))):0,this._input&&(this._input.value=clampEntryText(this._input.value,this._maxLength))}get textLength(){return entryTextLength(this.value)}get input(){return this._input}connectedCallback(){if(this._initialized)return;this._initialized=!0,this.maxLength=Number(this.getAttribute(`maxlength`)??0);let e=document.createElement(`input`);e.className=`adw-entry`,e.type=this.getAttribute(`type`)||`text`,e.value=clampEntryText(this.getAttribute(`value`)??``,this._maxLength),e.placeholder=this.getAttribute(`placeholder`)??``,e.disabled=this.hasAttribute(`disabled`),e.addEventListener(`input`,()=>{let t=clampEntryText(e.value,this._maxLength);t!==e.value&&(e.value=t)}),e.addEventListener(`keydown`,t=>{t.key===`Enter`&&this.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0,detail:{value:e.value}}))}),this._input=e,this.replaceChildren(e)}attributeChangedCallback(e,t,n){if(e===`maxlength`){this.maxLength=Number(n??0);return}this._input&&(e===`value`?this._input.value=clampEntryText(n??``,this._maxLength):e===`placeholder`?this._input.placeholder=n??``:e===`type`?this._input.type=n||`text`:e===`disabled`&&(this._input.disabled=n!==null))}};customElements.define(`adw-entry`,AdwEntry);function isHeaderSuffix(e){return e instanceof Element&&e.getAttribute(`slot`)===`header-suffix`}var AdwPreferencesGroup=class extends HTMLElement{_headerEl;_titleEl;_descriptionEl;_suffixEl;_listboxEl;_initialized=!1;_observer=null;static get observedAttributes(){return[`title`,`description`]}get description(){return this.getAttribute(`description`)??``}set description(e){e?this.setAttribute(`description`,e):this.removeAttribute(`description`)}addRow(e){isHeaderSuffix(e)?this._suffixEl.appendChild(e):this._listboxEl.appendChild(e),this._renderHeader()}removeRow(e){let t=e.parentNode;return t!==this._listboxEl&&t!==this._suffixEl?!1:(t.removeChild(e),this._renderHeader(),!0)}connectedCallback(){if(this._initialized){this._observeHost();return}this._initialized=!0;let e=Array.from(this.childNodes),t=e.filter(isHeaderSuffix),n=e.filter(e=>!t.includes(e));this._headerEl=document.createElement(`div`),this._headerEl.className=`adw-preferences-group-header`;let r=document.createElement(`div`);r.className=`adw-preferences-group-labels`,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-preferences-group-title`,this._descriptionEl=document.createElement(`span`),this._descriptionEl.className=`adw-preferences-group-description`,r.append(this._titleEl,this._descriptionEl),this._suffixEl=document.createElement(`div`),this._suffixEl.className=`adw-preferences-group-suffix`;for(let e of t)this._suffixEl.appendChild(e);this._headerEl.append(r,this._suffixEl),this._listboxEl=document.createElement(`div`),this._listboxEl.className=`adw-preferences-group-listbox`;for(let e of n)this._listboxEl.appendChild(e);this.replaceChildren(this._headerEl,this._listboxEl),this._renderHeader(),this._observeHost()}disconnectedCallback(){this._observer?.disconnect(),this._observer=null}attributeChangedCallback(){this._initialized&&this._renderHeader()}_observeHost(){this._observer||(this._observer=new MutationObserver(e=>{for(let t of e)if(t.target===this)for(let e of t.addedNodes)e instanceof Element&&(e===this._headerEl||e===this._listboxEl||this.addRow(e));this._renderHeader()}),this._observer.observe(this,{childList:!0}),this._observer.observe(this._listboxEl,{childList:!0}))}_renderHeader(){let e=this.getAttribute(`title`)??``,t=this.getAttribute(`description`)??``;this._titleEl.textContent=e,this._descriptionEl.textContent=t;let n=derivePreferencesGroupHeader({title:e,description:t,hasHeaderSuffix:this._suffixEl.childElementCount>0,rowCount:this._listboxEl.childElementCount,useMarkup:!1});this._titleEl.hidden=!n.titleVisible,this._descriptionEl.hidden=!n.descriptionVisible,this._headerEl.hidden=!n.headerVisible,this._headerEl.classList.toggle(`single-line`,n.singleLine),this._listboxEl.hidden=!n.listboxVisible}};customElements.define(`adw-preferences-group`,AdwPreferencesGroup);const Re=[`disabled`,`aria-disabled`];function isSensitive(e){return e.disabled===!0?!1:e.getAttribute(`aria-disabled`)!==`true`}var AdwActionRow=class extends HTMLElement{_titleEl;_subtitleEl;_suffixEl;_prefixEl;_state=new ActionRowState;_sensitivityObserver=null;_initialized=!1;static get observedAttributes(){return[`title`,`subtitle`,`activatable`]}get suffixSection(){return this._suffixEl}get prefixSection(){return this._prefixEl}get activatableWidget(){return this._state.activatableWidget}set activatableWidget(e){this._state.setActivatableWidget(e,e?isSensitive(e):!0)&&(this._observeSensitivity(e),this._syncActivatable())}get activatable(){return this._state.activatable}connectedCallback(){if(this._initialized){this._observeSensitivity(this._state.activatableWidget);return}this._initialized=!0;let e=Array.from(this.querySelectorAll(`:scope > [slot="prefix"]`)),t=Array.from(this.querySelectorAll(`:scope > [slot="suffix"]`));this._prefixEl=document.createElement(`div`),this._prefixEl.className=`adw-action-row-prefix`;for(let t of e)this._prefixEl.appendChild(t);let n=document.createElement(`div`);n.className=`adw-action-row-text`,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-row-title`,this._subtitleEl=document.createElement(`span`),this._subtitleEl.className=`adw-row-subtitle`,n.append(this._titleEl,this._subtitleEl),this._suffixEl=document.createElement(`div`),this._suffixEl.className=`adw-action-row-suffix`;for(let e of t)this._suffixEl.appendChild(e);this.replaceChildren(this._prefixEl,n,this._suffixEl),this._adoptAttributes(),this._render(),this.addEventListener(`click`,e=>this._onClick(e))}_adoptAttributes(){this._state.setTitle(this.getAttribute(`title`)),this._state.setSubtitle(this.getAttribute(`subtitle`)),this._state.setActivatable(this.hasAttribute(`activatable`))}disconnectedCallback(){this._sensitivityObserver?.disconnect(),this._sensitivityObserver=null}attributeChangedCallback(){this._initialized&&(this._adoptAttributes(),this._render())}_onClick(e){if(!this._state.activatable)return;let t=this._state.activate();t&&e.target instanceof Node&&t.contains(e.target)||(t?.click(),this.dispatchEvent(new CustomEvent(`activated`,{bubbles:!0})))}_observeSensitivity(e){if(this._sensitivityObserver?.disconnect(),!e){this._sensitivityObserver=null;return}this._sensitivityObserver??=new MutationObserver(()=>{let e=this._state.activatableWidget;e&&this._state.setActivatableWidgetSensitive(isSensitive(e))&&this._syncActivatable()}),this._sensitivityObserver.observe(e,{attributeFilter:Re})}_syncActivatable(){this.toggleAttribute(`activatable`,this._state.activatable),this._initialized&&this._render()}_render(){let{title:e,titleVisible:t,subtitle:n,subtitleVisible:r}=this._state.state;this._titleEl.textContent=e,this._titleEl.hidden=!t,this._subtitleEl.textContent=n,this._subtitleEl.hidden=!r,this._prefixEl.hidden=this._prefixEl.childElementCount===0,this._suffixEl.hidden=this._suffixEl.childElementCount===0,this.classList.toggle(`activatable`,this._state.activatable)}};customElements.define(`adw-action-row`,AdwActionRow);function setPartVisible(e,t){e.hidden=!t,e.style.display=t?``:`none`}function boolAttribute(e){return e!==null&&e!==`false`}var AdwEntryRow=class extends HTMLElement{_state=new EntryRowState;_input;_emptyTitle;_title;_area;_editIcon;_indicator;_applyButton;_prefixes;_suffixes;_initialized=!1;_authored=[];_lastText=``;_lastLength=0;static get observedAttributes(){return[`title`,`text`,`editable`,`max-length`,`show-apply-button`,`activates-default`]}get _classPrefix(){return`adw-entry-row`}get text(){return this._state.text}set text(e){this._state.setText(e??``)}get textLength(){return this._state.textLength}get maxLength(){return this._state.maxLength}set maxLength(e){this._state.setMaxLength(e)}get editable(){return this._state.editable}set editable(e){this._state.setEditable(e)}get showApplyButton(){return this._state.showApplyButton}set showApplyButton(e){this._state.setShowApplyButton(e)}get activatesDefault(){return this._state.activatesDefault}set activatesDefault(e){this._state.setActivatesDefault(e)}get editing(){return this._state.editing}connectedCallback(){this._initialized||(this._initialized=!0,this._build(),this._state.setMaxLength(Number.parseInt(this.getAttribute(`max-length`)??``,10)),this._state.setEditable(this.getAttribute(`editable`)!==`false`),this._state.setShowApplyButton(boolAttribute(this.getAttribute(`show-apply-button`))),this._state.setActivatesDefault(boolAttribute(this.getAttribute(`activates-default`))),this.hasAttribute(`text`)&&this._state.setText(this.getAttribute(`text`)??``),this._renderTitle(),this._onConnected(),this._adoptAuthored(),this._lastText=this._state.text,this._lastLength=this._state.textLength,this._render(this._state.state),this._state.subscribe(e=>this._onStateChanged(e)))}attributeChangedCallback(e,t,n){if(this._initialized)switch(e){case`title`:this._renderTitle();break;case`text`:this._state.setText(n??``);break;case`editable`:this._state.setEditable(n!==`false`);break;case`max-length`:this._state.setMaxLength(Number.parseInt(n??``,10));break;case`show-apply-button`:this._state.setShowApplyButton(boolAttribute(n));break;case`activates-default`:this._state.setActivatesDefault(boolAttribute(n));break}}addSuffix(e){this._suffixes.append(e),setPartVisible(this._suffixes,!0)}addPrefix(e){this._prefixes.prepend(e),setPartVisible(this._prefixes,!0)}setShowIndicator(e){this._state.setShowIndicator(e)}setIndicatorIconName(e){this._indicator.dataset.iconName=e}setIndicatorTooltip(e){this._indicator.title=e,this._indicator.setAttribute(`aria-label`,e)}apply(){this._state.apply(),this.dispatchEvent(new CustomEvent(`apply`,{bubbles:!0}))}grabFocusWithoutSelecting(){return this._input.focus(),this._state.editing}_onConnected(){}_build(){let e=this._classPrefix;this._authored=[...this.children],this._prefixes=document.createElement(`div`),this._prefixes.className=`${e}-prefixes`,this._suffixes=document.createElement(`div`),this._suffixes.className=`${e}-suffixes`,this._emptyTitle=document.createElement(`span`),this._emptyTitle.className=`adw-row-title ${e}-empty-title`,this._title=document.createElement(`span`),this._title.className=`adw-row-title ${e}-title`,this._input=document.createElement(`input`),this._input.className=`${e}-input`,this._input.type=`text`,this._input.addEventListener(`input`,()=>{this._state.setText(this._input.value),this._input.value!==this._state.text&&(this._input.value=this._state.text)}),this._input.addEventListener(`focus`,()=>this._state.setEditing(!0)),this._input.addEventListener(`blur`,()=>this._state.setEditing(!1)),this._input.addEventListener(`keydown`,e=>{e.key===`Enter`&&(e.preventDefault(),this._activate())}),this._area=document.createElement(`div`),this._area.className=`${e}-text`,this._area.append(this._emptyTitle,this._title,this._input),this._indicator=document.createElement(`span`),this._indicator.className=`${e}-indicator`,this._indicator.setAttribute(`role`,`img`),this._indicator.textContent=`⇪`,this._applyButton=document.createElement(`button`),this._applyButton.type=`button`,this._applyButton.className=`adw-button suggested-action circular icon-only ${e}-apply`,this._applyButton.dataset.iconName=`adw-entry-apply-symbolic`,this._applyButton.title=v,this._applyButton.setAttribute(`aria-label`,v),this._applyButton.textContent=`✓`,this._applyButton.addEventListener(`click`,()=>this.apply()),this._editIcon=createAdwIcon(`document-edit`,`adw-row-edit`,`${e}-edit`),this._editIcon.dataset.iconName=`adw-entry-edit-symbolic`,this.replaceChildren(this._prefixes,this._area,this._indicator,this._applyButton,this._editIcon,this._suffixes),setPartVisible(this._prefixes,!1),setPartVisible(this._suffixes,!1),this.addEventListener(`click`,e=>this._maybeFocus(e))}_adoptAuthored(){for(let e of this._authored)e.getAttribute(`slot`)===`prefix`?this.addPrefix(e):this.addSuffix(e);this._authored=[]}_maybeFocus(e){let t=e.target;(t===this||t===this._area||t===this._emptyTitle||t===this._title||t===this._editIcon||t===this._indicator||t===this._prefixes||t===this._suffixes)&&this._input.focus()}_activate(){let e=this._state.activate();if(e.signal===`apply`){this.dispatchEvent(new CustomEvent(`apply`,{bubbles:!0}));return}e.activateDefault&&this.closest(`form`)?.requestSubmit(),this.dispatchEvent(new CustomEvent(`entry-activated`,{bubbles:!0}))}_renderTitle(){let e=this.getAttribute(`title`)??``;this._emptyTitle.textContent=e,this._title.textContent=e}_render(e){this._input.value!==e.text&&(this._input.value=e.text),this._input.readOnly=!e.editable,this.classList.toggle(`focused`,e.editing),this.classList.toggle(`empty`,e.empty),setPartVisible(this._emptyTitle,e.emptyTarget===0),setPartVisible(this._title,e.emptyTarget===1),setPartVisible(this._editIcon,e.editIconVisible),this._editIcon.classList.toggle(`disabled`,!e.editIconSensitive),this._editIcon.setAttribute(`aria-disabled`,String(!e.editIconSensitive)),setPartVisible(this._indicator,e.indicatorVisible),setPartVisible(this._applyButton,e.applyButtonVisible),this.setAttribute(`text-length`,String(e.textLength))}_onStateChanged(e){if(this._render(e),e.text!==this._lastText){this._lastText=e.text;let t={text:e.text};this.dispatchEvent(new CustomEvent(`changed`,{bubbles:!0,detail:t})),this.dispatchEvent(new CustomEvent(`notify::text`,{bubbles:!0,detail:t}))}e.textLength!==this._lastLength&&(this._lastLength=e.textLength,this.dispatchEvent(new CustomEvent(`notify::text-length`,{bubbles:!0,detail:{textLength:e.textLength}})))}};customElements.define(`adw-entry-row`,AdwEntryRow);var AdwSwitchRow=class extends HTMLElement{_switchEl;_titleEl;_subtitleEl;_state=new SwitchRowState;_initialized=!1;static get observedAttributes(){return[`title`,`subtitle`,`active`]}get active(){return this._initialized?this._state.active:this.hasAttribute(`active`)}set active(e){this.toggleAttribute(`active`,!!e)}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=document.createElement(`div`);e.className=`adw-row-text`,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-row-title`,this._subtitleEl=document.createElement(`span`),this._subtitleEl.className=`adw-row-subtitle`,e.append(this._titleEl,this._subtitleEl),this._switchEl=document.createElement(`adw-switch`),this.replaceChildren(e,this._switchEl),this._state.setActive(this.hasAttribute(`active`)),this._switchEl.active=this._state.active,this.setAttribute(`role`,`switch`),this.setAttribute(`aria-checked`,String(this._state.active)),this._switchEl.addEventListener(`notify::active`,e=>{e.stopPropagation(),this._apply(this._state.setActive(this._switchEl.active))}),this.addEventListener(`click`,e=>{e.target instanceof Node&&this._switchEl.contains(e.target)||this._apply(this._state.activate())}),this._renderText()}attributeChangedCallback(e){this._initialized&&(e===`active`?this._apply(this._state.setActive(this.hasAttribute(`active`))):this._renderText())}_apply(e){e&&(this._switchEl.active=this._state.active,this.toggleAttribute(`active`,this._state.active),this.setAttribute(`aria-checked`,String(this._state.active)),this.dispatchEvent(new CustomEvent(`notify::active`,{bubbles:!0,detail:{active:this._state.active}})))}_renderText(){let{title:e,titleVisible:t,subtitle:n,subtitleVisible:r}=deriveRowLabels({title:this.getAttribute(`title`),subtitle:this.getAttribute(`subtitle`)});this._titleEl.textContent=e,this._titleEl.hidden=!t,this._subtitleEl.textContent=n,this._subtitleEl.hidden=!r}};customElements.define(`adw-switch-row`,AdwSwitchRow);var AdwComboRow=class extends HTMLElement{_select;_valueEl;_titleEl;_subtitleEl;_state=new ComboState;_initialized=!1;static get observedAttributes(){return[`title`,`subtitle`,`selected`]}get selected(){return this._initialized?this._state.selectedIndex:parseInt(this.getAttribute(`selected`)||`0`,10)}set selected(e){this.setAttribute(`selected`,String(e))}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=JSON.parse(this.getAttribute(`items`)||`[]`);this._state.setOptions(normalizeComboOptions(e)),this._state.setSelectedIndex(parseInt(this.getAttribute(`selected`)||`0`,10));let t=this._state.selectedIndex,n=document.createElement(`div`);n.className=`adw-row-text`,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-row-title`,this._subtitleEl=document.createElement(`span`),this._subtitleEl.className=`adw-row-subtitle`,n.append(this._titleEl,this._subtitleEl),this._valueEl=document.createElement(`span`),this._valueEl.className=`adw-row-value`,this._valueEl.textContent=this._state.selectedLabel;let r=document.createElement(`select`);e.forEach((e,n)=>{let i=document.createElement(`option`);i.value=String(n),i.textContent=e,n===t&&(i.selected=!0),r.appendChild(i)}),this.replaceChildren(n,this._valueEl,r),this._select=r,this._state.subscribe(e=>{this._valueEl.textContent=e.label,this._select.selectedIndex!==e.selected&&(this._select.selectedIndex=e.selected),this._syncChooser(),e.interactive&&(this.setAttribute(`selected`,String(e.selected)),this.dispatchEvent(new CustomEvent(`notify::selected`,{bubbles:!0,detail:{selected:e.selected}})))}),this._select.addEventListener(`change`,()=>{this._state.select(this._select.selectedIndex)}),this._syncChooser(),this._renderText()}attributeChangedCallback(e,t,n){this._initialized&&(e===`selected`?this._state.setSelectedIndex(parseInt(n||`0`,10)):this._renderText())}_syncChooser(){let e=this._state.presentsChooser;this.dataset.presentsChooser=e?`true`:`false`,this._select.disabled=!e}_renderText(){let e=deriveRowLabels({title:this.getAttribute(`title`),subtitle:this.getAttribute(`subtitle`)});this._titleEl.textContent=e.title,this._titleEl.hidden=!e.titleVisible,this._subtitleEl.textContent=e.subtitle,this._subtitleEl.hidden=!e.subtitleVisible}};customElements.define(`adw-combo-row`,AdwComboRow);var AdwSpinRow=class extends HTMLElement{_input;_titleEl;_subtitleEl;_state=new SpinState;_initialized=!1;static get observedAttributes(){return[`title`,`subtitle`,`value`,`min`,`max`,`step`]}get value(){return this._state.value}set value(e){this._state.setValue(this._roundToStep(e)),this._syncValue()}connectedCallback(){if(this._initialized)return;this._initialized=!0,this._state.setMin(parseFloat(this.getAttribute(`min`)||`0`)),this._state.setMax(parseFloat(this.getAttribute(`max`)||`100`)),this._state.setStep(parseFloat(this.getAttribute(`step`)||`1`)),this._state.setValue(this._roundToStep(parseFloat(this.getAttribute(`value`)||String(this._state.min))));let e=document.createElement(`div`);e.className=`adw-row-text`,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-row-title`,this._subtitleEl=document.createElement(`span`),this._subtitleEl.className=`adw-row-subtitle`,e.append(this._titleEl,this._subtitleEl);let t=document.createElement(`div`);t.className=`adw-spin-control`;let n=document.createElement(`button`);n.className=`adw-spin-dec`,n.textContent=`−`,n.addEventListener(`click`,()=>this._adjust(-this._state.step));let r=document.createElement(`input`);r.type=`text`,r.value=this._formatValue(this._state.value),r.addEventListener(`change`,()=>{let e=parseFloat(r.value);Number.isNaN(e)?r.value=this._formatValue(this._state.value):(this.value=e,this._emitChange())});let i=document.createElement(`button`);i.className=`adw-spin-inc`,i.textContent=`+`,i.addEventListener(`click`,()=>this._adjust(this._state.step)),t.append(n,r,i),this.replaceChildren(e,t),this._input=r,this._state.subscribe(()=>this._syncValue()),this._renderText()}attributeChangedCallback(e,t,n){if(!this._initialized)return;if(e===`title`||e===`subtitle`){this._renderText();return}let r=parseFloat(n||`0`);switch(e){case`value`:this._state.setValue(this._roundToStep(r));break;case`min`:this._state.setMin(r);break;case`max`:this._state.setMax(r);break;case`step`:this._state.setStep(r);break}}_renderText(){let e=deriveRowLabels({title:this.getAttribute(`title`),subtitle:this.getAttribute(`subtitle`)});this._titleEl.textContent=e.title,this._titleEl.hidden=!e.titleVisible,this._subtitleEl.textContent=e.subtitle,this._subtitleEl.hidden=!e.subtitleVisible}_adjust(e){this.value=this._state.value+e,this._emitChange()}_emitChange(){this.dispatchEvent(new CustomEvent(`notify::value`,{bubbles:!0,detail:{value:this._state.value}}))}_syncValue(){this._input&&(this._input.value=this._formatValue(this._state.value)),this.setAttribute(`value`,String(this._state.value))}_roundToStep(e){if(!Number.isFinite(e))return e;let t=this._countDecimals(this._state.step);return t>0?parseFloat(e.toFixed(t)):e}_countDecimals(e){let t=String(e),n=t.indexOf(`.`);return n===-1?0:t.length-n-1}_formatValue(e){let t=this._countDecimals(this._state.step);return t>0?e.toFixed(t):String(e)}};customElements.define(`adw-spin-row`,AdwSpinRow);var AdwButtonRow=class extends HTMLElement{_contentsEl;_startIconEl;_endIconEl;_titleEl;_state=new ButtonRowState;_initialized=!1;static get observedAttributes(){return[`title`,`start-icon-name`,`end-icon-name`]}connectedCallback(){this._initialized||(this._contentsEl=document.createElement(`div`),this._contentsEl.className=`adw-button-row-contents`,this._startIconEl=createAdwIcon(null,`start`),this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-button-row-title`,this._endIconEl=createAdwIcon(null,`end`),this._contentsEl.append(this._startIconEl,this._titleEl,this._endIconEl),this.replaceChildren(this._contentsEl),this._initialized=!0,this._render(),this.addEventListener(`click`,()=>{this.dispatchEvent(new CustomEvent(`activated`,{bubbles:!0}))}))}attributeChangedCallback(){this._initialized&&this._render()}_render(){this._state.setTitle(this.getAttribute(`title`)),this._state.setStartIconName(this.getAttribute(`start-icon-name`)),this._state.setEndIconName(this.getAttribute(`end-icon-name`));let e=this._state.state;this._titleEl.textContent=e.title,this._titleEl.hidden=!e.titleVisible,this._paintIcon(this._startIconEl,e.startIconName,e.startIconVisible),this._paintIcon(this._endIconEl,e.endIconName,e.endIconVisible),this.classList.toggle(`activatable`,!0)}_paintIcon(e,t,n){e.iconName=n?t:null,e.hidden=!n}};customElements.define(`adw-button-row`,AdwButtonRow);var AdwExpanderRow=class extends HTMLElement{_headerEl;_titleEl;_subtitleEl;_enableSwitch;_chevronEl;_contentEl;_prefixEl;_suffixEl;_state=new ExpanderState;_initialized=!1;_reflectingEnable=!1;constructor(){super(),this._state.subscribe(e=>{e?this.setAttribute(`expanded`,``):this.removeAttribute(`expanded`),this._initialized&&this._render()})}static get observedAttributes(){return[`title`,`subtitle`,`expanded`,`enable-expansion`,`show-enable-switch`]}get expanded(){return this._state.expanded}set expanded(e){this._state.setExpanded(e)}get enableExpansion(){return!this.hasAttribute(`enable-expansion`)||this.getAttribute(`enable-expansion`)!==`false`}set enableExpansion(e){this.setAttribute(`enable-expansion`,e?`true`:`false`)}get contentSection(){return this._contentEl}get suffixSection(){return this._suffixEl}get prefixSection(){return this._prefixEl}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=Array.from(this.querySelectorAll(`:scope > [slot="prefix"]`)),t=Array.from(this.querySelectorAll(`:scope > [slot="suffix"]`)),n=new Set([...e,...t]),r=Array.from(this.childNodes).filter(e=>!n.has(e));this._headerEl=document.createElement(`div`),this._headerEl.className=`adw-expander-row-header`;let i=document.createElement(`div`);i.className=`adw-row-text`,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-row-title`,this._subtitleEl=document.createElement(`span`),this._subtitleEl.className=`adw-row-subtitle`,i.append(this._titleEl,this._subtitleEl),this._enableSwitch=document.createElement(`adw-switch`),this._enableSwitch.classList.add(`adw-expander-row-enable-switch`),this._enableSwitch.active=this.enableExpansion,this._chevronEl=createAdwIcon(`go-down`,`adw-expander-row-chevron`),this._prefixEl=document.createElement(`div`),this._prefixEl.className=`adw-expander-row-prefix`;for(let t of e)this._prefixEl.appendChild(t);this._suffixEl=document.createElement(`div`),this._suffixEl.className=`adw-expander-row-suffix`;for(let e of t)this._suffixEl.appendChild(e);this._headerEl.append(this._prefixEl,i,this._suffixEl,this._enableSwitch,this._chevronEl),this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-expander-row-content`;for(let e of r)this._contentEl.appendChild(e);this.replaceChildren(this._headerEl,this._contentEl),this._headerEl.addEventListener(`click`,e=>{this._enableSwitch.contains(e.target)||this._state.toggle()&&this.dispatchEvent(new CustomEvent(`notify::expanded`,{bubbles:!0,detail:{expanded:this.expanded}}))}),this._enableSwitch.addEventListener(`notify::active`,e=>{if(e.stopPropagation(),this._reflectingEnable)return;let t=this._enableSwitch.active;this.setAttribute(`enable-expansion`,t?`true`:`false`),this.dispatchEvent(new CustomEvent(`notify::enable-expansion`,{bubbles:!0,detail:{enableExpansion:t}}))}),this._state.setExpanded(this.hasAttribute(`expanded`)),this._render()}attributeChangedCallback(e){this._initialized&&(e===`expanded`&&this._state.setExpanded(this.hasAttribute(`expanded`)),this._render())}_render(){let e=deriveRowLabels({title:this.getAttribute(`title`),subtitle:this.getAttribute(`subtitle`)});this._titleEl.textContent=e.title,this._titleEl.hidden=!e.titleVisible,this._subtitleEl.textContent=e.subtitle,this._subtitleEl.hidden=!e.subtitleVisible;let t=this.hasAttribute(`show-enable-switch`);this._enableSwitch.hidden=!t,this._reflectingEnable=!0,this._enableSwitch.active=this.enableExpansion,this._reflectingEnable=!1,this._prefixEl.hidden=this._prefixEl.childElementCount===0,this._suffixEl.hidden=this._suffixEl.childElementCount===0,this.classList.toggle(`expanded`,this.expanded),this._contentEl.classList.toggle(`expanded`,this.expanded)}};customElements.define(`adw-expander-row`,AdwExpanderRow);var AdwPasswordEntryRow=class extends AdwEntryRow{_password=new PasswordEntryRowState(this._state);_toggle;_toggleIcon;static get observedAttributes(){return[...AdwEntryRow.observedAttributes,`revealed`]}get _classPrefix(){return`adw-password-entry-row`}get revealed(){return this._password.revealed}set revealed(e){this._password.setRevealed(e)}get capsLockOn(){return this._password.capsLockOn}setCapsLockOn(e){this._password.setCapsLockOn(e)}_onConnected(){this._input.type=`password`,this._input.autocomplete=`off`,this._toggle=document.createElement(`button`),this._toggle.type=`button`,this._toggle.className=`adw-button flat circular icon-only ${this._classPrefix}-toggle`,this._toggleIcon=createAdwIcon(null),this._toggle.append(this._toggleIcon),this._toggle.addEventListener(`click`,()=>this._password.togglePeek()),this.addSuffix(this._toggle);let readCapsLock=e=>this._password.setCapsLockOn(e.getModifierState(`CapsLock`));this._input.addEventListener(`keydown`,readCapsLock),this._input.addEventListener(`keyup`,readCapsLock);let e=this._password.state;this.setIndicatorIconName(e.indicatorIconName),this.setIndicatorTooltip(e.indicatorTooltip),this.hasAttribute(`revealed`)&&this._password.setRevealed(this.getAttribute(`revealed`)!==`false`),this._renderPassword(this._password.state),this._password.subscribe(e=>{this._renderPassword(e),this.dispatchEvent(new CustomEvent(`notify::revealed`,{bubbles:!0,detail:{revealed:e.revealed}}))})}attributeChangedCallback(e,t,n){if(e!==`revealed`){super.attributeChangedCallback(e,t,n);return}this._initialized&&this._password.setRevealed(n!==null&&n!==`false`)}_renderPassword(e){this._input.type=e.revealed?`text`:`password`,this._toggleIcon.dataset.iconName=e.peekIconName,this._toggleIcon.iconName=e.peekIconName,this._toggle.title=e.peekLabel,this._toggle.setAttribute(`aria-label`,e.peekLabel),this._toggle.setAttribute(`aria-pressed`,String(e.revealed)),e.revealed?this.setAttribute(`revealed`,``):this.removeAttribute(`revealed`)}};customElements.define(`adw-password-entry-row`,AdwPasswordEntryRow);const ze={schedule:(e,t)=>setTimeout(e,t),cancel:e=>clearTimeout(e)};var AdwToastOverlay=class extends HTMLElement{_toasts;_initialized=!1;_queue;_scheduler=ze;_currentEl=null;_actions=new WeakMap;constructor(){super(),this._queue=new AdwToastQueue({scheduler:{schedule:(e,t)=>this._scheduler.schedule(e,t),cancel:e=>this._scheduler.cancel(e)},onShow:e=>this._mountToast(e),onHide:()=>this._unmountToast(this._queue.pending>0)})}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=document.createElement(`div`);e.className=`adw-toast-overlay-content`;for(let t of Array.from(this.childNodes))e.appendChild(t);this._toasts=document.createElement(`div`),this._toasts.className=`adw-toast-overlay-toasts`,this.replaceChildren(e,this._toasts)}get scheduler(){return this._scheduler}set scheduler(e){this._scheduler=e}get currentToast(){return this._queue.current}get pendingToasts(){return this._queue.pending}addToast(e,t={}){this._toasts||this.connectedCallback();let n=typeof t==`number`?{timeout:t/1e3}:t,r=new AdwToast(e,{timeout:(n.timeout??5)*1e3,buttonLabel:n.buttonLabel});n.onAction&&this._actions.set(r,n.onAction),this._queue.add(r)}dismiss(){this._queue.dismiss()}clearToasts(){this._queue.clear()}_mountToast(e){let t=document.createElement(`div`);t.className=`adw-toast`;let n=document.createElement(`div`);n.className=`adw-toast-content-wrapper`;let r=document.createElement(`span`);if(r.className=`adw-toast-title`,r.textContent=e.title,n.appendChild(r),t.appendChild(n),e.hasButton){let n=document.createElement(`button`);n.type=`button`,n.className=`adw-toast-action-button`,n.textContent=e.buttonLabel,n.addEventListener(`click`,()=>{this._actions.get(e)?.(),this._queue.dismiss()}),t.appendChild(n)}let i=document.createElement(`button`);i.type=`button`,i.className=`adw-toast-close-button`,i.setAttribute(`aria-label`,`Close`),i.addEventListener(`click`,()=>this._queue.dismiss()),t.appendChild(i),this._toasts.appendChild(t),this._currentEl=t,requestAnimationFrame(()=>{t.classList.add(`visible`)})}_unmountToast(e){let t=this._currentEl;if(this._currentEl=null,t){if(e){t.remove();return}t.classList.remove(`visible`),t.classList.add(`hiding`),t.addEventListener(`transitionend`,()=>t.remove(),{once:!0}),this._scheduler.schedule(()=>{t.parentNode&&t.remove()},300)}}};customElements.define(`adw-toast-overlay`,AdwToastOverlay);var AdwToolbarView=class extends HTMLElement{_topEl;_contentEl;_bottomEl;_initialized=!1;_resize=null;_shading=null;static get observedAttributes(){return[`top-bar-style`,`bottom-bar-style`,`extend-content-to-top-edge`,`extend-content-to-bottom-edge`]}get topBar(){return this._topEl}get contentArea(){return this._contentEl}get bottomBar(){return this._bottomEl}connectedCallback(){if(!this._initialized){this._initialized=!0;let e=Array.from(this.querySelectorAll(`:scope > [slot="top"]`)),t=Array.from(this.querySelectorAll(`:scope > [slot="bottom"]`)),n=Array.from(this.childNodes).filter(n=>!e.includes(n)&&!t.includes(n));this._topEl=document.createElement(`div`),this._topEl.className=`adw-toolbar-view-top`;for(let t of e)this._topEl.appendChild(t);this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-toolbar-view-content`;for(let e of n)this._contentEl.appendChild(e);this._bottomEl=document.createElement(`div`),this._bottomEl.className=`adw-toolbar-view-bottom`;for(let e of t)this._bottomEl.appendChild(e);this._topEl.hidden=this._topEl.childElementCount===0,this._bottomEl.hidden=this._bottomEl.childElementCount===0,this.replaceChildren(this._topEl,this._contentEl,this._bottomEl)}this._shading=new AdwScrollShading(this._contentEl),this._shading.connect(),this._resize=new ResizeObserver(()=>this._syncClasses()),this._resize.observe(this._topEl),this._resize.observe(this._bottomEl),this._syncClasses()}disconnectedCallback(){this._resize?.disconnect(),this._resize=null,this._shading?.disconnect(),this._shading=null}attributeChangedCallback(){this._initialized&&this._syncClasses()}_syncClasses(){let{view:e,topBar:t,bottomBar:n}=toolbarViewClasses({topBarStyle:parseToolbarStyle(this.getAttribute(`top-bar-style`)),bottomBarStyle:parseToolbarStyle(this.getAttribute(`bottom-bar-style`)),extendContentToTopEdge:this.hasAttribute(`extend-content-to-top-edge`),extendContentToBottomEdge:this.hasAttribute(`extend-content-to-bottom-edge`),topBarHeight:this._topEl.offsetHeight,bottomBarHeight:this._bottomEl.offsetHeight});for(let t of se)this.classList.toggle(t,e.includes(t));for(let e of ce)this._topEl.classList.toggle(e,t.includes(e)),this._bottomEl.classList.toggle(e,n.includes(e));this._shading?.setUndershootEdges({top:e.includes(`undershoot-top`),bottom:e.includes(`undershoot-bottom`)})}};customElements.define(`adw-toolbar-view`,AdwToolbarView);const Be=[`child-spacing`,`child-spacing-unit`,`pack-direction`,`align`,`justify`,`justify-last-line`,`line-spacing`,`line-spacing-unit`,`line-homogeneous`,`natural-line-length`,`natural-line-length-unit`,`wrap-reverse`,`wrap-policy`,`orientation`];function alignToJustifyContent(e){return e<.25?`flex-start`:e<.75?`center`:`flex-end`}var AdwWrapBox=class extends HTMLElement{_initialized=!1;static get observedAttributes(){return[...Be]}get childSpacing(){return normalizeWrapBoxSpacing(this.getAttribute(`child-spacing`))}set childSpacing(e){this.setAttribute(`child-spacing`,String(e))}get childSpacingUnit(){return normalizeWrapBoxLengthUnit(this.getAttribute(`child-spacing-unit`))}set childSpacingUnit(e){this.setAttribute(`child-spacing-unit`,e)}get lineSpacing(){return normalizeWrapBoxSpacing(this.getAttribute(`line-spacing`))}set lineSpacing(e){this.setAttribute(`line-spacing`,String(e))}get lineSpacingUnit(){return normalizeWrapBoxLengthUnit(this.getAttribute(`line-spacing-unit`))}set lineSpacingUnit(e){this.setAttribute(`line-spacing-unit`,e)}get align(){return normalizeWrapBoxAlign(this.getAttribute(`align`))}set align(e){this.setAttribute(`align`,String(e))}get justify(){return normalizeWrapBoxJustify(this.getAttribute(`justify`))}set justify(e){this.setAttribute(`justify`,e)}get justifyLastLine(){return this.hasAttribute(`justify-last-line`)}set justifyLastLine(e){this.toggleAttribute(`justify-last-line`,!!e)}get wrapPolicy(){return normalizeWrapPolicy(this.getAttribute(`wrap-policy`))}set wrapPolicy(e){this.setAttribute(`wrap-policy`,e)}get packDirection(){return normalizeWrapBoxPackDirection(this.getAttribute(`pack-direction`))}set packDirection(e){this.setAttribute(`pack-direction`,e)}get wrapReverse(){return this.hasAttribute(`wrap-reverse`)}set wrapReverse(e){this.toggleAttribute(`wrap-reverse`,!!e)}get lineHomogeneous(){return this.hasAttribute(`line-homogeneous`)}set lineHomogeneous(e){this.toggleAttribute(`line-homogeneous`,!!e)}get naturalLineLength(){return normalizeNaturalLineLength(this.getAttribute(`natural-line-length`))}set naturalLineLength(e){this.setAttribute(`natural-line-length`,String(e))}get naturalLineLengthUnit(){return normalizeWrapBoxLengthUnit(this.getAttribute(`natural-line-length-unit`))}set naturalLineLengthUnit(e){this.setAttribute(`natural-line-length-unit`,e)}get orientation(){return this.getAttribute(`orientation`)===`vertical`?`vertical`:`horizontal`}set orientation(e){this.setAttribute(`orientation`,e)}get _children(){return[...this.children]}insertChildAfter(e,t=null){return this._applyOrder(`insert-after`,e,t)}reorderChildAfter(e,t=null){return this._applyOrder(`reorder-after`,e,t)}removeAll(){for(let e of this._children)this.removeChild(e)}_applyOrder(e,t,n){let r=resolveWrapBoxChildOrder({children:this._children,child:t,sibling:n,op:e});if(r===null)return!1;let i=r.indexOf(t);return this.insertBefore(t,r[i+1]??null),!0}connectedCallback(){this._initialized||(this._initialized=!0,this._sync())}attributeChangedCallback(e,t,n){if(!this._initialized)return;this._sync();let r=this._normalized(e,n);r!==this._normalized(e,t)&&this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:r}}))}_normalized(e,t){switch(e){case`child-spacing`:case`line-spacing`:return normalizeWrapBoxSpacing(t);case`child-spacing-unit`:case`line-spacing-unit`:case`natural-line-length-unit`:return normalizeWrapBoxLengthUnit(t);case`align`:return normalizeWrapBoxAlign(t);case`justify`:return normalizeWrapBoxJustify(t);case`wrap-policy`:return normalizeWrapPolicy(t);case`pack-direction`:return normalizeWrapBoxPackDirection(t);case`natural-line-length`:return normalizeNaturalLineLength(t);case`orientation`:return t===`vertical`?`vertical`:`horizontal`;default:return t!==null}}_sync(){let e=this.style,t=this.orientation===`vertical`,n=t?`column`:`row`;e.flexDirection=this.packDirection===`end-to-start`?`${n}-reverse`:n,e.flexWrap=this.wrapReverse?`wrap-reverse`:`wrap`;let r=`${wrapBoxLengthToPx(this.childSpacing,this.childSpacingUnit)}px`,i=`${wrapBoxLengthToPx(this.lineSpacing,this.lineSpacingUnit)}px`;t?(e.rowGap=r,e.columnGap=i):(e.columnGap=r,e.rowGap=i),e.setProperty(`--adw-wrap-box-child-spacing`,r);let a=this.justify,o=this.justifyLastLine,s=this.align,c=resolveWrapBoxLine({justify:a,justifyLastLine:o,align:s,lastLine:!1,childrenInLine:2}),l=resolveWrapBoxLine({justify:a,justifyLastLine:o,align:s,lastLine:!0,childrenInLine:2});this.dataset.lineJustify=c.justify,this.dataset.lastLineJustify=l.justify,e.justifyContent=c.growGaps?`space-between`:alignToJustifyContent(c.align),e.alignContent=this.lineHomogeneous?`stretch`:`flex-start`,e.setProperty(`--adw-wrap-box-child-shrink`,String(wrapPolicyFlexShrink(this.wrapPolicy)));let u=wrapBoxLengthToPx(this.naturalLineLength,this.naturalLineLengthUnit),d=u===-1?``:`${u}px`;e.maxWidth=t?``:d,e.maxHeight=t?d:``}};customElements.define(`adw-wrap-box`,AdwWrapBox);const Ve={animate(e){let t=0,n=!1,r=performance.now(),step=i=>{if(n)return;let a=Math.min((i-r)/250,1),o=1-(1-a)*(1-a);if(e.onValue(e.from+(e.to-e.from)*o),a<1){t=requestAnimationFrame(step);return}e.onValue(e.to),e.onDone()};return t=requestAnimationFrame(step),{cancel(){n=!0,t&&cancelAnimationFrame(t)}}}};function readTriStateAttr(e,t,n){let r=e.getAttribute(t);return r===null?n:r!==`false`&&r!==`0`}var AdwOverlaySplitView=class extends HTMLElement{_initialized=!1;_sidebarEl;_contentEl;_backdropEl;_disposeBreakpoint;_state=new OverlaySplitViewState;_reflecting=!1;_measuredWidth=0;_resizeObserver;_swipePointer=null;_swipeOrigin={x:0,progress:0};static get observedAttributes(){return[`show-sidebar`,`collapsed`,`pin-sidebar`,`sidebar-position`,`min-sidebar-width`,`max-sidebar-width`,`sidebar-width-fraction`,`enable-show-gesture`,`enable-hide-gesture`,`breakpoint`]}get showSidebar(){return this._state.showSidebar}set showSidebar(e){this.setAttribute(`show-sidebar`,e?``:`false`)}get collapsed(){return this._state.collapsed}set collapsed(e){e?this.setAttribute(`collapsed`,``):this.removeAttribute(`collapsed`)}get minSidebarWidth(){return parseFloat(this.getAttribute(`min-sidebar-width`)||`180`)}get maxSidebarWidth(){return parseFloat(this.getAttribute(`max-sidebar-width`)||`280`)}get sidebarWidthFraction(){return parseFloat(this.getAttribute(`sidebar-width-fraction`)||`0.25`)}connectedCallback(){this._buildOnce(),this._bindToDocument(),this._reflectShowSidebar(),this._syncClasses(),this._syncSidebarWidth(),this._syncBreakpoint()}_buildOnce(){if(this._initialized)return;this._initialized=!0;let e=Array.from(this.querySelectorAll(`[slot="sidebar"]`)),t=Array.from(this.querySelectorAll(`[slot="content"]`)),n=Array.from(this.childNodes).filter(n=>!e.includes(n)&&!t.includes(n));this.replaceChildren(),this._sidebarEl=document.createElement(`div`),this._sidebarEl.className=`adw-osv-sidebar`,e.forEach(e=>this._sidebarEl.appendChild(e)),this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-osv-content`,t.forEach(e=>this._contentEl.appendChild(e)),n.forEach(e=>this._contentEl.appendChild(e)),this._backdropEl=document.createElement(`div`),this._backdropEl.className=`adw-osv-backdrop`,this._backdropEl.addEventListener(`click`,()=>this.hideSidebar()),this.append(this._sidebarEl,this._contentEl,this._backdropEl),this._state=new OverlaySplitViewState({collapsed:this.hasAttribute(`collapsed`),showSidebar:readTriStateAttr(this,`show-sidebar`,!0),pinSidebar:this.hasAttribute(`pin-sidebar`),sidebarPosition:this.getAttribute(`sidebar-position`)===`end`?`end`:`start`,enableShowGesture:readTriStateAttr(this,`enable-show-gesture`,!0),enableHideGesture:readTriStateAttr(this,`enable-hide-gesture`,!0),animator:Ve}),this._state.subscribe(()=>{this._reflectShowSidebar(),this._syncClasses()}),this.addEventListener(`keydown`,this._onKeyDown),this._bindSwipe()}_bindToDocument(){this._resizeObserver?.disconnect(),this._resizeObserver=new ResizeObserver(e=>{let t=e[e.length-1];if(!t)return;let n=t.borderBoxSize?.[0];this._measuredWidth=n?n.inlineSize:t.contentRect.width,this._syncSidebarWidth(),this._syncClasses()}),this._resizeObserver.observe(this),this._measuredWidth=this.offsetWidth}disconnectedCallback(){this._disposeBreakpoint?.(),this._disposeBreakpoint=void 0,this._resizeObserver?.disconnect(),this._resizeObserver=void 0}_onKeyDown=e=>{e.key!==`Escape`||e.defaultPrevented||this._state.escape()&&e.preventDefault()};attributeChangedCallback(e,t,n){if(this._initialized){if(e===`breakpoint`){this._syncBreakpoint();return}this._readAttribute(e),(e===`min-sidebar-width`||e===`max-sidebar-width`||e===`sidebar-width-fraction`||e===`collapsed`)&&this._syncSidebarWidth(),this._syncClasses()}}_readAttribute(e){let t=this._state;if(e===`pin-sidebar`&&t.setPinSidebar(this.hasAttribute(`pin-sidebar`)),e===`sidebar-position`){let e=this.getAttribute(`sidebar-position`);t.setSidebarPosition(e===`end`?`end`:`start`)}e===`show-sidebar`&&t.setShowSidebar(readTriStateAttr(this,`show-sidebar`,!0)),e===`enable-show-gesture`&&t.setEnableShowGesture(readTriStateAttr(this,`enable-show-gesture`,!0)),e===`enable-hide-gesture`&&t.setEnableHideGesture(readTriStateAttr(this,`enable-hide-gesture`,!0)),e===`collapsed`&&t.setCollapsed(this.hasAttribute(`collapsed`)),this._reflectShowSidebar()}_reflectShowSidebar(){if(this._reflecting)return;let e=this._state.showSidebar?``:`false`;if(this.getAttribute(`show-sidebar`)!==e){this._reflecting=!0;try{this.setAttribute(`show-sidebar`,e)}finally{this._reflecting=!1}}}_syncBreakpoint(){this._disposeBreakpoint?.(),this._disposeBreakpoint=bindBreakpointSetter(this,this.getAttribute(`breakpoint`),e=>{this.collapsed=e})}openSidebar(){this.showSidebar=!0,this.dispatchEvent(new CustomEvent(`sidebar-toggled`,{detail:{isVisible:!0}}))}hideSidebar(){this.showSidebar=!1,this.dispatchEvent(new CustomEvent(`sidebar-toggled`,{detail:{isVisible:!1}}))}toggleSidebar(){this.showSidebar=!this.showSidebar,this.dispatchEvent(new CustomEvent(`sidebar-toggled`,{detail:{isVisible:this.showSidebar}}))}get _direction(){return getComputedStyle(this).direction===`rtl`?`rtl`:`ltr`}get _widthSpec(){return{minSidebarWidth:this.minSidebarWidth,maxSidebarWidth:this.maxSidebarWidth,sidebarWidthFraction:this.sidebarWidthFraction}}get _sidebarWidth(){return resolveOverlaySidebarWidth({...this._widthSpec,totalWidth:this._measuredWidth,collapsed:this._state.collapsed})}_syncClasses(){let e=this._state;this.classList.toggle(`collapsed`,e.collapsed),this.classList.toggle(`show-sidebar`,e.showSidebar);let t=isSidebarAtVisualStart(e.sidebarPosition,this._direction);this.classList.toggle(`sidebar-start`,e.sidebarPosition===`start`),this.classList.toggle(`sidebar-end`,e.sidebarPosition===`end`),this.classList.toggle(`sidebar-at-visual-start`,t),this._sidebarEl?.classList.toggle(`sidebar-pane`,!e.collapsed),this._sidebarEl?.classList.toggle(`overlay-pane`,e.collapsed),this._contentEl?.classList.toggle(`content-pane`,!e.collapsed),this._backdropEl&&(this._backdropEl.hidden=!e.shieldVisible),this._sidebarEl?.setAttribute(`aria-hidden`,String(!e.sidebarFocusable)),this._contentEl?.setAttribute(`aria-hidden`,String(!e.contentFocusable)),this._syncGeometry()}_syncGeometry(){let e=this._sidebarEl;if(!e)return;if(this._measuredWidth<=0){for(let t of[`left`,`marginLeft`,`marginRight`,`width`,`minWidth`,`maxWidth`,`opacity`,`pointerEvents`])e.style[t]=``;this._backdropEl&&(this._backdropEl.style.opacity=``);return}let t=this._state,n=this._sidebarWidth,r=layoutOverlaySplitView({totalWidth:this._measuredWidth,sidebarWidth:n,showProgress:t.showProgress,collapsed:t.collapsed,sidebarPosition:t.sidebarPosition,direction:this._direction}),i=isSidebarAtVisualStart(t.sidebarPosition,this._direction);if(e.style.width=`${r.sidebar.width}px`,t.collapsed)e.style.marginLeft=``,e.style.marginRight=``,e.style.insetInlineStart=``,e.style.left=`${r.sidebar.x}px`;else{e.style.left=``;let r=n-Math.trunc(n*Math.min(t.showProgress,1));e.style.marginLeft=i?`${-r}px`:``,e.style.marginRight=i?``:`${-r}px`}e.style.opacity=t.showProgress<=0?`0`:`1`,e.style.pointerEvents=t.sidebarPainted?``:`none`,this._backdropEl&&(this._backdropEl.style.opacity=String(1-r.shadowProgress))}_syncSidebarWidth(){if(!this._sidebarEl)return;let e=resolveSidebarBounds(this._widthSpec,0,{ceil:!0});this._sidebarEl.style.minWidth=`${e.min}px`,this._sidebarEl.style.maxWidth=`${e.max}px`,this._syncGeometry()}_bindSwipe(){this.addEventListener(`pointerdown`,e=>{if(this._swipePointer!==null||e.button!==0)return;let t=this._state,n=this.getBoundingClientRect(),r=resolveSwipeArea({isDrag:!0,sidebarWidth:this._sidebarWidth,showProgress:t.showProgress,totalWidth:n.width,totalHeight:n.height,sidebarPosition:t.sidebarPosition,direction:this._direction}),i=e.clientX-n.left,a=e.clientY-n.top;i<r.x||i>r.x+r.width||a<r.y||a>r.y+r.height||(this._swipePointer=e.pointerId,this._swipeOrigin={x:e.clientX,progress:t.showProgress})}),this.addEventListener(`pointermove`,e=>{if(e.pointerId!==this._swipePointer)return;let t=this._state,n=this._sidebarWidth||1,r=isSidebarAtVisualStart(t.sidebarPosition,this._direction),i=(e.clientX-this._swipeOrigin.x)/n*(r?1:-1);if(!t.swipeActive){if(!resolveSwipeStart({showProgress:t.showProgress,collapsed:t.collapsed,direction:i>=0?`forward`:`back`,enableShowGesture:t.enableShowGesture,enableHideGesture:t.enableHideGesture})){this._swipePointer=null;return}t.beginSwipe();try{this.setPointerCapture(e.pointerId)}catch{}}t.setShowProgress(this._swipeOrigin.progress+i)});let release=(e,t)=>{if(e.pointerId!==this._swipePointer)return;this._swipePointer=null;let n=this._state;if(!n.swipeActive)return;this.hasPointerCapture(e.pointerId)&&this.releasePointerCapture(e.pointerId);let r=resolveSwipeSnapPoints({showProgress:n.showProgress,enableShowGesture:n.enableShowGesture,enableHideGesture:n.enableHideGesture,swipeActive:!0}),i=t?swipeCancelProgress(n.showProgress):r.reduce((e,t)=>Math.abs(t-n.showProgress)<Math.abs(e-n.showProgress)?t:e);n.endSwipe(i)};this.addEventListener(`pointerup`,e=>release(e,!1)),this.addEventListener(`pointercancel`,e=>release(e,!0))}};customElements.define(`adw-overlay-split-view`,AdwOverlaySplitView);var AdwNavigationSplitView=class extends HTMLElement{_sidebarEl;_contentEl;_initialized=!1;_disposeBreakpoint;_state=new NavigationSplitViewState;_reflecting=!1;static get observedAttributes(){return[`collapsed`,`show-content`,`sidebar-position`,`min-sidebar-width`,`max-sidebar-width`,`breakpoint`]}get collapsed(){return this._initialized?this._state.collapsed:this.hasAttribute(`collapsed`)}set collapsed(e){this.toggleAttribute(`collapsed`,e)}get showContent(){return this._initialized?this._state.showContent:this.hasAttribute(`show-content`)}set showContent(e){this.toggleAttribute(`show-content`,e)}get sidebarPosition(){return this.getAttribute(`sidebar-position`)===`end`?`end`:`start`}set sidebarPosition(e){this.setAttribute(`sidebar-position`,e)}get sidebarTag(){return this._state.sidebarTag}get contentTag(){return this._state.contentTag}push(e){return this._state.push(e)}pop(){return this._state.pop()}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=Array.from(this.querySelectorAll(`:scope > [slot="sidebar"]`)),t=Array.from(this.querySelectorAll(`:scope > [slot="content"]`));this._sidebarEl=document.createElement(`div`),this._sidebarEl.className=`adw-nsv-sidebar`;for(let t of e)this._sidebarEl.appendChild(t);this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-nsv-content`;for(let e of t)this._contentEl.appendChild(e);this.replaceChildren(this._sidebarEl,this._contentEl),this._state=new NavigationSplitViewState({sidebarPosition:this.sidebarPosition,collapsed:this.hasAttribute(`collapsed`),showContent:this.hasAttribute(`show-content`),onCritical:e=>console.error(e),onDelegate:(e,t)=>{let n={tag:t,handled:!1};return this.dispatchEvent(new CustomEvent(`navigation-${e}`,{bubbles:!0,detail:n})),n.handled}}),this._state.setSidebar(e.length>0?{tag:this._tagOf(e)}:null),this._state.setContent(t.length>0?{tag:this._tagOf(t)}:null),this._state.subscribe(()=>{this._reflectShowContent(),this._syncClasses()}),this._syncWidth(),this._syncClasses(),this._syncBreakpoint()}_tagOf(e){for(let t of e){let e=t.getAttribute(`tag`);if(e!==null)return e}return null}_reflectShowContent(){if(this._reflecting)return;let e=this._state.showContent;if(this.hasAttribute(`show-content`)!==e){this._reflecting=!0;try{this.toggleAttribute(`show-content`,e)}finally{this._reflecting=!1}}}disconnectedCallback(){this._disposeBreakpoint?.(),this._disposeBreakpoint=void 0}attributeChangedCallback(e){if(this._initialized){if(e===`breakpoint`){this._syncBreakpoint();return}if(e===`min-sidebar-width`||e===`max-sidebar-width`){this._syncWidth();return}e===`collapsed`&&this._state.setCollapsed(this.hasAttribute(`collapsed`)),e===`show-content`&&this._state.setShowContent(this.hasAttribute(`show-content`)),e===`sidebar-position`&&this._state.setSidebarPosition(this.sidebarPosition),this._syncClasses(),this._syncWidth()}}_syncWidth(){if(this.collapsed){this._sidebarEl.style.minWidth=``,this._sidebarEl.style.maxWidth=``;return}let e=resolveSidebarBounds({minSidebarWidth:this._widthAttr(`min-sidebar-width`,180),maxSidebarWidth:this._widthAttr(`max-sidebar-width`,280)},0,{ceil:!0});this._sidebarEl.style.minWidth=`${e.min}px`,this._sidebarEl.style.maxWidth=`${e.max}px`}_widthAttr(e,t){let n=this.getAttribute(e);if(n===null)return t;let r=parseFloat(n);return Number.isFinite(r)?r:t}get _direction(){return getComputedStyle(this).direction===`rtl`?`rtl`:`ltr`}_syncClasses(){let e=this._state;this.classList.toggle(`collapsed`,e.collapsed),this.classList.toggle(`show-content`,e.showContent),this.classList.toggle(`sidebar-end`,e.sidebarPosition===`end`),this.classList.toggle(`sidebar-at-visual-start`,isSidebarAtVisualStart(e.sidebarPosition,this._direction)),this._sidebarEl?.classList.toggle(`sidebar-pane`,!e.collapsed),this._contentEl?.classList.toggle(`content-pane`,!e.collapsed);let{stack:t}=e.stack,n=t[t.length-1]??null;this._sidebarEl&&(this._sidebarEl.dataset.paneVisible=String(!e.collapsed||n===`sidebar`)),this._contentEl&&(this._contentEl.dataset.paneVisible=String(!e.collapsed||n===`content`))}_syncBreakpoint(){this._disposeBreakpoint?.(),this._disposeBreakpoint=bindBreakpointSetter(this,this.getAttribute(`breakpoint`),e=>{this.collapsed=e})}};customElements.define(`adw-navigation-split-view`,AdwNavigationSplitView);function wheelSource(e){if(e.deltaMode!==0)return`mouse`;let t=Math.abs(e.deltaY),n=Math.abs(e.deltaX);if(n>0&&t>0)return`touchpad`;let r=Math.max(n,t);return!Number.isInteger(r)||r<40?`touchpad`:`mouse`}var AdwCarousel=class extends HTMLElement{_state=new CarouselState({animateScroll:!0,onScrollTo:e=>this._performScroll(e)});_trackEl;_slots=new Map;_nextPageId=0;_scrollRaf=0;_initialized=!1;_pendingPosition=null;_pendingLayout;_layoutObserver;_pendingInteractive=null;_scrollTargetId=null;static get observedAttributes(){return[`allow-scroll-wheel`,`allow-long-swipes`,`interactive`,`spacing`,`position`]}constructor(){super(),this._state.subscribe(e=>this._onStateChange(e)),this._state.onPageChanged(e=>{this.dispatchEvent(new CustomEvent(`page-changed`,{bubbles:!0,detail:{index:e}}))})}get nPages(){return this._state.nPages}get position(){return this._state.position}set position(e){this._scrollToPosition(e)}get currentPage(){return this._state.pageAt(this._state.position)}get allowScrollWheel(){return this._state.allowScrollWheel}set allowScrollWheel(e){this.setAttribute(`allow-scroll-wheel`,e?`true`:`false`)}get allowLongSwipes(){return this._state.allowLongSwipes}set allowLongSwipes(e){this.toggleAttribute(`allow-long-swipes`,e)}get interactive(){return this._state.interactive}set interactive(e){this.setAttribute(`interactive`,e?`true`:`false`)}get spacing(){return this._state.spacing}set spacing(e){this.setAttribute(`spacing`,String(e))}connectedCallback(){this._initialized||this._build(),this._observeLayout()}_build(){this._initialized=!0,this._trackEl=document.createElement(`div`),this._trackEl.className=`adw-carousel-track`,this._trackEl.style.setProperty(`scroll-behavior`,`smooth`),this._applyAttribute(`allow-scroll-wheel`,this.getAttribute(`allow-scroll-wheel`)),this._applyAttribute(`allow-long-swipes`,this.getAttribute(`allow-long-swipes`)),this._applyAttribute(`interactive`,this.getAttribute(`interactive`)),this._applyAttribute(`spacing`,this.getAttribute(`spacing`));let e=Array.from(this.children).filter(e=>e instanceof HTMLElement);this.replaceChildren(this._trackEl);for(let t of e)this._insert(t,-1);this._trackEl.addEventListener(`scroll`,this._onScroll,{passive:!0}),this._trackEl.addEventListener(`wheel`,this._onWheel,{passive:!1}),this._applyAttribute(`position`,this.getAttribute(`position`))}attributeChangedCallback(e,t,n){this._initialized&&this._applyAttribute(e,n)}disconnectedCallback(){this._cancelPendingPosition(),this._layoutObserver?.disconnect(),this._layoutObserver=void 0}_observeLayout(){this._layoutObserver||(this._layoutObserver=new ResizeObserver(()=>{this._allocatePages()&&this._applyScrollFromModel()}),this._layoutObserver.observe(this._trackEl,{box:`border-box`}))}_applyAttribute(e,t){switch(e){case`allow-scroll-wheel`:this._state.setAllowScrollWheel(t!==`false`);return;case`allow-long-swipes`:this._state.setAllowLongSwipes(t!==null&&t!==`false`),this._applySnapStop();return;case`interactive`:this._state.setInteractive(t!==`false`);return;case`spacing`:{let e=t===null?0:Number.parseFloat(t);Number.isFinite(e)&&this._state.setSpacing(Math.max(0,e)),this._trackEl.style.columnGap=`${this._state.spacing}px`;return}case`position`:t!==null&&this._positionWhenMeasurable(Number.parseFloat(t))}}_positionWhenMeasurable(e){if(Number.isFinite(e)){if(this._trackEl.clientWidth>0){this._cancelPendingPosition(),this._scrollInstantly(e);return}this._pendingPosition=e,!this._pendingLayout&&(this._pendingLayout=new ResizeObserver(()=>{if(this._trackEl.clientWidth<=0)return;let e=this._pendingPosition;this._cancelPendingPosition(),e!==null&&this._scrollInstantly(e)}),this._pendingLayout.observe(this._trackEl))}}_scrollInstantly(e){let t=this._trackEl.style.getPropertyValue(`scroll-behavior`);this._trackEl.style.setProperty(`scroll-behavior`,`auto`);try{this._scrollToPosition(e)}finally{t?this._trackEl.style.setProperty(`scroll-behavior`,t):this._trackEl.style.removeProperty(`scroll-behavior`)}}_cancelPendingPosition(){this._pendingLayout?.disconnect(),this._pendingLayout=void 0,this._pendingPosition=null}_scrollToPosition(e){if(!Number.isFinite(e))return;let t=this._state.pageAt(e);t>=0&&this.scrollToPage(t)}insertPage(e,t=-1){return this._initialized?this._insert(e,t):(this.appendChild(e),!0)}appendPage(e){return this.insertPage(e,-1)}prependPage(e){return this.insertPage(e,0)}removePage(e){let t=this._idOf(e);return t===null||!this._state.removePage(t)?!1:(this._state.skipReveal(t),this._syncTrack(),!0)}reorderPage(e,t){let n=this._idOf(e);return n===null||!this._state.reorderPage(n,t)?!1:(this._syncTrack(),!0)}scrollToPage(e){this._state.scrollTo(e)}navigate(e){return this._state.navigate(e)}_insert(e,t){let n=`page-${this._nextPageId++}`;if(!this._state.insertPage(n,t))return!1;let r=document.createElement(`div`);return r.className=`adw-carousel-page`,r.appendChild(e),this._slots.set(n,r),this._state.skipReveal(n),this._syncTrack(),!0}_idOf(e){for(let[t,n]of this._slots)if(n.contains(e))return t;return null}_syncTrack(){let e=this._state.ids,t=new Set(e);for(let[e,n]of this._slots)t.has(e)||(n.remove(),this._slots.delete(e));e.forEach((e,t)=>{let n=this._slots.get(e);n&&this._trackEl.children[t]!==n&&this._trackEl.insertBefore(n,this._trackEl.children[t]??null)}),this._applySnapStop(),this._allocatePages(),this._applyScrollFromModel()}_allocatePages(){let e=[...this._slots.values()];if(e.length===0)return!1;let t=e[0].getBoundingClientRect().width;this._trackEl.style.removeProperty(`padding-inline`);for(let t of e)t.style.removeProperty(`flex-basis`);let n=this._trackEl.clientWidth;if(!(n>0))return!1;let{pageSize:r,leadingInset:i}=carouselPageAllocation(n,e.map(e=>({natural:e.firstElementChild?.getBoundingClientRect().width??0})));if(!(r>0))return!1;for(let t of e)t.style.flexBasis=`${r}px`;return i>0&&(this._trackEl.style.paddingInline=`${i}px`),Math.round(r)!==Math.round(t)}_applyScrollFromModel(){let e=this._distance();e>0&&this._trackEl.scrollTo({left:this._restorePosition()*e,behavior:`instant`})}_restorePosition(){if(this._scrollTargetId===null)return this._state.position;let e=this._state.ids.indexOf(this._scrollTargetId);return e<0?this._state.position:this._state.snapPointOf(e)??this._state.position}_applySnapStop(){let e=this._state.allowLongSwipes?`normal`:`always`;for(let t of this._slots.values())t.style.setProperty(`scroll-snap-stop`,e)}_distance(){let e=this._trackEl?.firstElementChild;return e?this._state.pageDistance(e.getBoundingClientRect().width):0}_performScroll(e){if(!this._trackEl)return;let t=this._distance();t>0&&(this._pendingInteractive=e.interactive,this._scrollTargetId=this._state.ids[e.index]??null,this._trackEl.scrollTo({left:e.index*t}))}_onScroll=()=>{this._scrollRaf||=requestAnimationFrame(()=>{this._scrollRaf=0,this._updatePositionFromScroll()})};_onWheel=e=>{this._state.handleWheel({deltaX:e.deltaX,deltaY:e.deltaY,source:wheelSource(e)})!==0&&e.preventDefault()};_updatePositionFromScroll(){let e=this._distance();if(!(e>0))return;let t=this._trackEl.scrollLeft/e;this._state.setPosition(t,this._pendingInteractive??!0)&&this._state.settleIfArrived()&&(this._pendingInteractive=null,this._scrollTargetId=null)}_onStateChange(e){if(e.reason===`n-pages`){this.dispatchEvent(new CustomEvent(`notify::n-pages`,{bubbles:!0,detail:{nPages:e.nPages}}));return}e.reason===`position`&&this.dispatchEvent(new CustomEvent(`notify::position`,{bubbles:!0,detail:{position:e.position,page:e.page,interactive:e.interactive}}))}},AdwCarouselIndicator=class extends HTMLElement{_carousel=null;_initialized=!1;static get observedAttributes(){return[`for`]}get carousel(){return this._carousel}set carousel(e){e!==this._carousel&&(this._detach(),this._carousel=e,this._attach())}connectedCallback(){this._initialized=!0,this._carousel||this._resolveForAttr(),this._attach(),this._render()}disconnectedCallback(){this._detach()}attributeChangedCallback(e){e===`for`&&this._initialized&&(this._detach(),this._carousel=null,this._resolveForAttr(),this._attach(),this._render())}_resolveForAttr(){let e=this.getAttribute(`for`);if(!e)return;let t=this.getRootNode().getElementById?.(e)??document.getElementById(e);t instanceof AdwCarousel&&(this._carousel=t)}_attach(){!this._carousel||!this._initialized||(this._carousel.addEventListener(`notify::position`,this._onChange),this._carousel.addEventListener(`notify::n-pages`,this._onChange),this._render())}_detach(){this._carousel&&(this._carousel.removeEventListener(`notify::position`,this._onChange),this._carousel.removeEventListener(`notify::n-pages`,this._onChange))}_onChange=()=>{this._render()};nPages(){return this._carousel?.nPages??0}position(){return this._carousel?.position??0}currentPage(){return this._carousel?.currentPage??-1}goTo(e){this._carousel?.scrollToPage(e)}},AdwCarouselIndicatorDots=class extends AdwCarouselIndicator{_render(){renderIndicator(this,`adw-carousel-dot`,this.nPages(),this.position(),this.currentPage(),e=>this.goTo(e))}},AdwCarouselIndicatorLines=class extends AdwCarouselIndicator{_render(){renderIndicator(this,`adw-carousel-line`,this.nPages(),this.position(),this.currentPage(),e=>this.goTo(e))}};function renderIndicator(e,t,n,r,i,a){if(e.childElementCount!==n){let r=[];for(let e=0;e<n;e++){let n=document.createElement(`button`);n.type=`button`,n.className=t,n.setAttribute(`aria-label`,`Page ${e+1}`),n.addEventListener(`click`,()=>a(e)),r.push(n)}e.replaceChildren(...r)}Array.from(e.children).forEach((e,t)=>{let n=Math.max(0,1-Math.abs(r-t)),a=e;a.style.setProperty(`--adw-carousel-progress`,n.toFixed(3)),a.classList.toggle(`active`,t===i),a.setAttribute(`aria-current`,t===i?`true`:`false`)})}customElements.define(`adw-carousel`,AdwCarousel),customElements.define(`adw-carousel-indicator-dots`,AdwCarouselIndicatorDots),customElements.define(`adw-carousel-indicator-lines`,AdwCarouselIndicatorLines);const He=[`title`,`tooltip`,`icon`,`indicator-icon`,`loading`,`needs-attention`,`pinned`];var AdwTabPage=class extends HTMLElement{static get observedAttributes(){return He}attributeChangedCallback(e,t,n){this.closest(`adw-tab-view`)?.syncDeclaredPage(this,e,n)}},AdwTabView=class extends HTMLElement{_state=new TabViewState({onClosePage:e=>this._requestClose(e)});_barEl;_tabBoxEl;_pagesEl;_tabs=new Map;_panels=new Map;_hovered=new Set;_initialized=!1;_generatedIds=0;_reflecting=!1;static get observedAttributes(){return[`selected`,`autohide`,`expand-tabs`,`no-close`]}constructor(){super(),this._barEl=document.createElement(`div`),this._barEl.className=`adw-tab-bar`,this._barEl.setAttribute(`role`,`tablist`),this._tabBoxEl=document.createElement(`div`),this._tabBoxEl.className=`adw-tab-box`,this._barEl.appendChild(this._tabBoxEl),this._pagesEl=document.createElement(`div`),this._pagesEl.className=`adw-tab-view-pages`,this._state.subscribePages(e=>this._onPagesChange(e)),this._state.subscribe(e=>this._onSelectionChange(e))}get selected(){return this._state.selectedIndex}set selected(e){this._state.selectNthPage(e)}get autohide(){return this.hasAttribute(`autohide`)}set autohide(e){e?this.setAttribute(`autohide`,``):this.removeAttribute(`autohide`)}get expandTabs(){return this.hasAttribute(`expand-tabs`)}set expandTabs(e){e?this.setAttribute(`expand-tabs`,``):this.removeAttribute(`expand-tabs`)}get noClose(){return this.hasAttribute(`no-close`)}set noClose(e){e?this.setAttribute(`no-close`,``):this.removeAttribute(`no-close`)}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=this.getAttribute(`selected`),t=Array.from(this.querySelectorAll(`:scope > adw-tab-page`));this.replaceChildren(this._barEl,this._pagesEl);for(let e of t)this._adoptDeclaredPage(e);e!==null&&this._applySelectedAttribute(e),this._applyBarVisibility(),this._reflectSelected(),this.addEventListener(`keydown`,e=>this._onKeyDown(e))}attributeChangedCallback(e,t,n){if(this._initialized){if(e===`selected`){if(this._reflecting)return;let e=this.getAttribute(`selected`);e!==null&&this._applySelectedAttribute(e);return}this._applyBarVisibility()}}syncDeclaredPage(e,t,n){let r=e.dataset.pageId;if(r!==void 0)switch(t){case`title`:this._state.setPageTitle(r,n);return;case`tooltip`:this._state.setPageTooltip(r,n);return;case`icon`:this._state.setPageIcon(r,n);return;case`indicator-icon`:this._state.setPageIndicatorIcon(r,n);return;case`loading`:this._state.setPageLoading(r,n!==null);return;case`needs-attention`:this._state.setPageNeedsAttention(r,n!==null);return;case`pinned`:this._state.setPagePinned(r,n!==null);return}}get pages(){return this._state.pages}get nPages(){return this._state.nPages}get nPinnedPages(){return this._state.nPinnedPages}get selectedId(){return this._state.selectedId}get selectedIndex(){return this._state.selectedIndex}get selectedContent(){return this._state.selectedPage?.content??null}isClosing(e){return this._state.isClosing(e)}setSelectedPage(e){return this._state.setSelectedPage(e)}selectNthPage(e){return this._state.selectNthPage(e)}selectPreviousPage(){return this._state.selectPreviousPage()}selectNextPage(){return this._state.selectNextPage()}selectFirstPage(){return this._state.selectFirstPage()}selectLastPage(){return this._state.selectLastPage()}cycleNextPage(){return this._state.cycleNextPage()}cyclePreviousPage(){return this._state.cyclePreviousPage()}addPage(e,t=null){return this._state.addPage(this._withPanel(e),t)}insertPage(e,t){return this._state.insertPage(this._withPanel(e),t)}prependPage(e){return this._state.prependPage(this._withPanel(e))}appendPage(e){return this._state.appendPage(this._withPanel(e))}insertPinnedPage(e,t){return this._state.insertPinnedPage(this._withPanel(e),t)}prependPinnedPage(e){return this._state.prependPinnedPage(this._withPanel(e))}appendPinnedPage(e){return this._state.appendPinnedPage(this._withPanel(e))}setPagePinned(e,t){return this._state.setPagePinned(e,t)}closePage(e){return this._state.closePage(e)}closePageFinish(e,t){return this._state.closePageFinish(e,t)}closeOtherPages(e){this._state.closeOtherPages(e)}closePagesBefore(e){this._state.closePagesBefore(e)}closePagesAfter(e){this._state.closePagesAfter(e)}detachPage(e){return this._state.detachPage(e)}reorderPage(e,t){return this._state.reorderPage(e,t)}reorderBackward(e){return this._state.reorderBackward(e)}reorderForward(e){return this._state.reorderForward(e)}reorderFirst(e){return this._state.reorderFirst(e)}reorderLast(e){return this._state.reorderLast(e)}setPageTitle(e,t){return this._state.setPageTitle(e,t)}setPageTooltip(e,t){return this._state.setPageTooltip(e,t)}setPageIcon(e,t){return this._state.setPageIcon(e,t)}setPageLoading(e,t){return this._state.setPageLoading(e,t)}setPageNeedsAttention(e,t){return this._state.setPageNeedsAttention(e,t)}get diagnostics(){return this._state.diagnostics}_adoptDeclaredPage(e){let t={id:e.getAttribute(`page-id`)??this._nextId(),title:e.getAttribute(`title`),tooltip:e.getAttribute(`tooltip`),icon:e.getAttribute(`icon`),indicatorIcon:e.getAttribute(`indicator-icon`),loading:e.hasAttribute(`loading`),needsAttention:e.hasAttribute(`needs-attention`),content:e};e.hasAttribute(`pinned`)?this.appendPinnedPage(t):this.appendPage(t)}_withPanel(e){let t=e.content??document.createElement(`adw-tab-page`);return t.classList.add(`adw-tab-page`),t.setAttribute(`role`,`tabpanel`),t.dataset.pageId=e.id,{...e,content:t}}_nextId(){return this._generatedIds+=1,`tab-${this._generatedIds}`}_onPagesChange(e){switch(e.kind){case`attached`:{let t=this._state.getPage(e.id);t&&this._insertTab(t,e.position);break}case`detached`:this._tabs.get(e.id)?.remove(),this._tabs.delete(e.id),this._hovered.delete(e.id),this._panels.get(e.id)?.remove(),this._panels.delete(e.id);break;case`reordered`:case`pinned`:this._moveTab(e.id,e.position),this._refreshTab(e.id);break;case`updated`:this._refreshTab(e.id);break}this._applyBarVisibility(),this._applyActiveState(),this.dispatchEvent(new CustomEvent(`page-${e.kind}`,{bubbles:!0,detail:{id:e.id,position:e.position,previousPosition:e.previousPosition}}))}_insertTab(e,t){let n=document.createElement(`button`);n.type=`button`,n.className=`adw-tab`,n.setAttribute(`role`,`tab`),n.dataset.pageId=e.id;let r=createAdwIcon(null,`adw-tab-icon`);n.appendChild(r);let i=document.createElement(`adw-spinner`);i.className=`adw-tab-spinner`,i.setAttribute(`size`,`16`),i.hidden=!0,n.appendChild(i);let a=document.createElement(`span`);a.className=`adw-tab-title`,n.appendChild(a),n.appendChild(createAdwIcon(null,`adw-tab-indicator`));let o=document.createElement(`button`);o.type=`button`,o.className=`adw-tab-close`,o.tabIndex=-1,o.setAttribute(`aria-label`,`Close tab`),o.addEventListener(`click`,t=>{t.stopPropagation(),this._state.closePage(e.id)}),n.appendChild(o),n.addEventListener(`click`,()=>this._state.setSelectedPage(e.id)),n.addEventListener(`pointerenter`,()=>{this._hovered.add(e.id),this._refreshCloseVisibility(e.id)}),n.addEventListener(`pointerleave`,()=>{this._hovered.delete(e.id),this._refreshCloseVisibility(e.id)}),this._tabBoxEl.insertBefore(n,this._tabBoxEl.children[t]??null),this._tabs.set(e.id,n);let s=e.content;s&&(this._panels.set(e.id,s),this._pagesEl.insertBefore(s,this._pagesEl.children[t]??null)),this._refreshTab(e.id)}_moveTab(e,t){let n=this._tabs.get(e);n&&(n.remove(),this._tabBoxEl.insertBefore(n,this._tabBoxEl.children[t]??null));let r=this._panels.get(e);r&&(r.remove(),this._pagesEl.insertBefore(r,this._pagesEl.children[t]??null))}_refreshTab(e){let t=this._state.getPage(e),n=this._tabs.get(e);if(!t||!n)return;let r=n.querySelector(`.adw-tab-title`);r&&(r.textContent=t.title),n.title=tabTooltip(t),n.classList.toggle(`pinned`,t.pinned),n.classList.toggle(`needs-attention`,t.needsAttention),n.classList.toggle(`closing`,t.closing);let i=tabIconState(t,this.getAttribute(`default-icon`)),a=n.querySelector(`.adw-tab-icon`);a&&(a.iconName=i.icon,a.hidden=!i.iconVisible||i.spinner);let o=n.querySelector(`.adw-tab-spinner`);o&&(o.hidden=!(i.spinner&&i.iconVisible));let s=n.querySelector(`.adw-tab-indicator`);s&&(s.iconName=t.indicatorIcon,s.hidden=!i.indicatorVisible),this._refreshCloseVisibility(e)}_tabPosition(e){return e.getBoundingClientRect().left-this._barEl.getBoundingClientRect().left+this._barEl.scrollLeft}_refreshCloseVisibility(e){let t=this._state.getPage(e),n=this._tabs.get(e);if(!t||!n)return;let r=n.querySelector(`.adw-tab-close`);if(!r)return;let i=this._barEl.scrollLeft,a=this._tabPosition(n),o=a>=i&&a+n.offsetWidth<=i+this._barEl.clientWidth;r.hidden=!tabCloseVisible({hovering:this._hovered.has(e),fullyVisible:o,selected:this._state.selectedId===e,dragging:!1,pinned:t.pinned})}_onSelectionChange(e){this._applyActiveState(),this._scrollSelectedTabIntoBar(),this._reflectSelected(),this.dispatchEvent(new CustomEvent(`notify::selected-page`,{bubbles:!0,detail:{selected:e.selectedIndex,selectedId:e.selectedId,previousId:e.previousId,interactive:e.interactive}}))}_applyActiveState(){let e=this._state.selectedId;for(let t of this._state.pages){let n=t.id===e,r=this._tabs.get(t.id);r&&(r.classList.toggle(`active`,n),r.setAttribute(`aria-selected`,String(n)),r.tabIndex=n?0:-1);let i=t.content;i&&(i.classList.toggle(`active-page`,n),i.hidden=!n),this._refreshCloseVisibility(t.id)}}_scrollSelectedTabIntoBar(){let e=this._state.selectedId,t=e===null?void 0:this._tabs.get(e);if(!t)return;let n=this._barEl.clientWidth,r=t.offsetWidth;if(n<=0||r<=0)return;let i=this._barEl.scrollLeft,a=this._tabPosition(t),o=Math.min(r,n-r)/2;a-5<i?this._barEl.scrollLeft=a-o:a+r+5>i+n&&(this._barEl.scrollLeft=a+r+o-n)}_applyBarVisibility(){let e=tabsRevealed({autohide:this.autohide,nPages:this._state.nPages,nPinnedPages:this._state.nPinnedPages,isTransferringPage:!1});this._barEl.hidden=!e,this._barEl.classList.toggle(`single-tab`,this._state.nPages<=1)}_reflectSelected(){this._reflecting=!0;let e=this._state.selectedIndex;e<0?this.removeAttribute(`selected`):this.getAttribute(`selected`)!==String(e)&&this.setAttribute(`selected`,String(e)),this._reflecting=!1}_applySelectedAttribute(e){let t=Number.parseInt(e,10);Number.isNaN(t)||this._state.selectNthPage(t)}_onKeyDown(e){let t=e.target instanceof Node&&this._barEl.contains(e.target),n=!1;if(e.ctrlKey&&e.key===`Tab`)n=e.shiftKey?this._state.cyclePreviousPage():this._state.cycleNextPage();else if(e.ctrlKey&&e.shiftKey&&(e.key===`PageUp`||e.key===`PageDown`)){let t=this._state.selectedId;t!==null&&(n=e.key===`PageUp`?this._state.reorderBackward(t):this._state.reorderForward(t))}else if(e.ctrlKey&&e.shiftKey&&(e.key===`Home`||e.key===`End`)){let t=this._state.selectedId;t!==null&&(n=e.key===`Home`?this._state.reorderFirst(t):this._state.reorderLast(t))}else if(e.ctrlKey&&(e.key===`PageUp`||e.key===`PageDown`))n=e.key===`PageUp`?this._state.selectPreviousPage():this._state.selectNextPage();else if(e.ctrlKey&&(e.key===`Home`||e.key===`End`))n=e.key===`Home`?this._state.selectFirstPage():this._state.selectLastPage();else if(e.altKey&&/^[0-9]$/.test(e.key)){let t=Number.parseInt(e.key,10);n=this._state.selectNthPage(t===0?9:t-1)}else t&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)?n=e.key===`ArrowLeft`?this._state.selectPreviousPage():this._state.selectNextPage():t&&(e.key===`Home`||e.key===`End`)&&(n=e.key===`Home`?this._state.selectFirstPage():this._state.selectLastPage());if(n&&(e.preventDefault(),t)){let e=this._state.selectedId;e!==null&&this._tabs.get(e)?.focus({preventScroll:!0})}}_requestClose(e){return this.dispatchEvent(new CustomEvent(`close-page`,{bubbles:!0,cancelable:!0,detail:{index:this._state.getPagePosition(e.id),id:e.id}}))?!e.pinned:`defer`}};customElements.define(`adw-tab-page`,AdwTabPage),customElements.define(`adw-tab-view`,AdwTabView);const K={schedule(e,t){return setTimeout(e,t)},cancel(e){clearTimeout(e)}};function createSwitcherIcon(e,t){return createAdwIcon(viewSwitcherIconName(e),t)}function applySwitcherIcon(e,t){e.iconName=viewSwitcherIconName(t)}function readSwitcherPage(e){let t=Number.parseInt(e.getAttribute(`badge-number`)??``,10);return{name:e.getAttribute(`name`)??``,title:e.getAttribute(`title`),iconName:e.getAttribute(`icon-name`),visible:!e.hasAttribute(`hidden`),useUnderline:e.hasAttribute(`use-underline`),badgeNumber:Number.isNaN(t)?0:t,needsAttention:e.hasAttribute(`needs-attention`)}}function applyIndicator(e,t,n){e.textContent=t,e.classList.toggle(`needs-attention`,n&&t.length===0),e.hidden=t.length===0&&!n}function applyDescription(e,t){t?e.setAttribute(`aria-description`,t):e.removeAttribute(`aria-description`)}var AdwViewSwitcherPage=class extends HTMLElement{},AdwViewSwitcher=class extends HTMLElement{scheduler=K;_stateInstance=null;get _state(){return this._stateInstance||(this._stateInstance=new ViewSwitcherState({scheduler:this.scheduler}),this._stateInstance.subscribe(e=>this._onStateChange(e))),this._stateInstance}_barEl;_contentEl;_nodes=[];_declared=[];_pageObserver;_policy=`narrow`;_initialized=!1;static get observedAttributes(){return[`policy`,`active`]}constructor(){super()}get policy(){return this._policy}set policy(e){this.setAttribute(`policy`,e)}get active(){return this._state.selected}set active(e){this._state.setSelected(e),this._reflectActive()}get visibleChildName(){return this._state.selectedName}set visibleChildName(e){this._state.selectName(e)}get pages(){return this._state.pages}setPageVisible(e,t){let n=this._state.setPageVisible(e,t);return this._render(),n}connectedCallback(){if(this._initialized){this._watchPages();return}let e=Array.from(this.querySelectorAll(`:scope > adw-view-switcher-page`)),t=this.getAttribute(`active`);if(this._barEl=document.createElement(`div`),this._barEl.className=`adw-view-switcher-bar`,this._barEl.setAttribute(`role`,`tablist`),this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-view-switcher-content`,this._declared=e,this._watchPages(),this._nodes=e.map((e,t)=>this._buildPage(e,t)),this._barEl.append(...this._nodes.map(e=>e.button)),this._contentEl.append(...this._nodes.map(e=>e.body)),this.replaceChildren(this._barEl,this._contentEl),this._policy=this._readPolicyAttr(),this._initialized=!0,this._state.setPages(e.map(e=>readSwitcherPage(e))),t!==null){let e=Number.parseInt(t,10);Number.isNaN(e)||this._state.setSelected(e,!1)}this._render()}disconnectedCallback(){this._state.cancelDrag(),this._pageObserver?.disconnect(),this._pageObserver=void 0}refreshPages(){this._initialized&&(this._state.setPages(this._declared.map(e=>readSwitcherPage(e))),this._render())}_watchPages(){this._pageObserver?.disconnect(),this._pageObserver=new MutationObserver(()=>this.refreshPages());for(let e of this._declared)this._pageObserver.observe(e,{attributes:!0})}attributeChangedCallback(e){if(this._initialized){if(e===`policy`){let e=this._readPolicyAttr();if(e===this._policy)return;this._policy=e,this._render(),this.dispatchEvent(new CustomEvent(`notify::policy`,{bubbles:!0,detail:{policy:e}}));return}if(e===`active`){let e=this.getAttribute(`active`),t=e===null?NaN:Number.parseInt(e,10);Number.isNaN(t)||this._state.setSelected(t),this._reflectActive()}}}_buildPage(e,t){let n=document.createElement(`button`);n.type=`button`,n.className=`adw-view-switcher-button`,n.setAttribute(`role`,`tab`);let r=createAdwIcon(null,`adw-view-switcher-icon`),i=document.createElement(`span`);i.className=`adw-view-switcher-label`;let a=document.createElement(`span`);a.className=`adw-view-switcher-indicator`,a.setAttribute(`aria-hidden`,`true`),n.append(r,i,a),n.addEventListener(`click`,()=>{this._state.setSelected(t)}),n.addEventListener(`dragenter`,e=>{n.contains(e.relatedTarget)||this._state.dragEnter(t)}),n.addEventListener(`dragleave`,e=>{n.contains(e.relatedTarget)||this._state.dragLeave(t)});let o=document.createElement(`div`);o.className=`adw-view-switcher-page`,o.dataset.name=e.getAttribute(`name`)??``;for(let t of Array.from(e.childNodes))o.appendChild(t);return{button:n,icon:r,label:i,indicator:a,body:o}}_readPolicyAttr(){let e=this.getAttribute(`policy`);return e===null?`narrow`:isViewSwitcherPolicy(e)?e:this._policy}_onStateChange(e){this._render(),this.dispatchEvent(new CustomEvent(`notify::visible-child`,{bubbles:!0,detail:{index:e.selected,name:e.name,title:e.title,interactive:e.interactive}}))}_render(){if(this._initialized){for(let e of Se)this.classList.toggle(e,e===this._policy);buildViewSwitcherButtons(this._state.pages,this._state.selected,this._policy).forEach((e,t)=>{let n=this._nodes[t];n&&(n.button.hidden=!e.visible,n.button.classList.toggle(`active`,e.selected),n.button.setAttribute(`aria-selected`,String(e.selected)),n.button.tabIndex=e.selected?0:-1,applySwitcherIcon(n.icon,e.iconName),n.label.textContent=e.label,n.label.hidden=e.label.length===0,applyIndicator(n.indicator,e.badgeLabel,e.needsAttention),applyDescription(n.button,e.description),e.label?n.button.removeAttribute(`aria-label`):n.button.setAttribute(`aria-label`,e.iconName),n.body.classList.toggle(`active-view`,e.selected),n.body.hidden=!e.selected)}),this._reflectActive()}}_reflectActive(){let e=String(this._state.selected);this.getAttribute(`active`)!==e&&this.setAttribute(`active`,e)}};customElements.define(`adw-view-switcher-page`,AdwViewSwitcherPage),customElements.define(`adw-view-switcher`,AdwViewSwitcher);var AdwViewStackPage=class extends HTMLElement{static get observedAttributes(){return[`name`,`title`,`icon-name`,`badge-number`,`needs-attention`,`use-underline`]}},AdwInlineViewSwitcher=class extends HTMLElement{scheduler=K;_stateInstance=null;get _state(){return this._stateInstance||(this._stateInstance=new ViewSwitcherState({scheduler:this.scheduler}),this._stateInstance.subscribe(e=>this._onStateChange(e))),this._stateInstance}_groupEl;_pagesEl;_panels=[];_toggles=[];_displayMode=`labels`;_initialized=!1;_declared=[];_pageObserver;static get observedAttributes(){return[`active`,`display-mode`,`flat`,`round`,`osd`]}constructor(){super()}get active(){return this._state.selected}set active(e){this._state.setSelected(e),this._reflectActive()}get activeToggle(){return toggleIndexForPage(this._state.pages,this._state.selected)}get displayMode(){return this._displayMode}set displayMode(e){this.setAttribute(`display-mode`,e)}get visibleChildName(){return this._state.selectedName}set visibleChildName(e){this._state.selectName(e)}get pages(){return this._state.pages}setPageVisible(e,t){let n=this._state.setPageVisible(e,t);return this._rebuildToggles(),n}connectedCallback(){if(this._initialized){this._watchPages();return}let e=Array.from(this.querySelectorAll(`:scope > adw-view-stack-page`)),t=this.getAttribute(`active`);if(this._groupEl=document.createElement(`div`),this._groupEl.className=`adw-inline-view-switcher-group`,this._groupEl.setAttribute(`role`,`tablist`),this._pagesEl=document.createElement(`div`),this._pagesEl.className=`adw-inline-view-switcher-pages`,this._panels=e.map(e=>{let t=document.createElement(`div`);t.className=`adw-inline-view-switcher-page`,t.setAttribute(`role`,`tabpanel`),t.dataset.name=e.getAttribute(`name`)??``;for(let n of Array.from(e.childNodes))t.appendChild(n);return this._pagesEl.appendChild(t),t}),this.replaceChildren(this._groupEl,this._pagesEl),this._displayMode=this._readDisplayModeAttr(),this._initialized=!0,this._declared=e,this._watchPages(),this._state.setPages(e.map(e=>readSwitcherPage(e))),t!==null){let e=Number.parseInt(t,10);Number.isNaN(e)||this._state.setSelected(e,!1)}this._rebuildToggles()}disconnectedCallback(){this._state.cancelDrag(),this._pageObserver?.disconnect(),this._pageObserver=void 0}refreshPages(){this._initialized&&(this._state.setPages(this._declared.map(e=>readSwitcherPage(e))),this._rebuildToggles())}_watchPages(){this._pageObserver?.disconnect(),this._pageObserver=new MutationObserver(()=>this.refreshPages());for(let e of this._declared)this._pageObserver.observe(e,{attributes:!0})}attributeChangedCallback(e){if(this._initialized){if(e===`active`){let e=this.getAttribute(`active`),t=e===null?NaN:Number.parseInt(e,10);Number.isNaN(t)||this._state.setSelected(t),this._reflectActive();return}if(e===`display-mode`){let e=this._readDisplayModeAttr();if(e===this._displayMode)return;this._displayMode=e,this._rebuildToggles(),this.dispatchEvent(new CustomEvent(`notify::display-mode`,{bubbles:!0,detail:{displayMode:e}}));return}this._applyStyleClasses()}}_readDisplayModeAttr(){let e=this.getAttribute(`display-mode`);return e===null?`labels`:isInlineViewSwitcherDisplayMode(e)?e:this._displayMode}_rebuildToggles(){if(!this._initialized)return;let e=buildInlineToggles(this._state.pages,this._displayMode);this._groupEl.replaceChildren(),this._toggles=e.map(e=>{let t=document.createElement(`button`);if(t.type=`button`,t.className=`adw-inline-view-switcher-toggle`,t.setAttribute(`role`,`tab`),t.dataset.pageIndex=String(e.pageIndex),t.dataset.toggleIndex=String(e.toggleIndex),e.showIcon&&t.appendChild(createSwitcherIcon(e.iconName,`adw-inline-view-switcher-icon`)),e.showLabel){let n=document.createElement(`span`);n.className=`adw-inline-view-switcher-label`,n.textContent=e.label,t.appendChild(n)}let n=document.createElement(`span`);return n.className=`adw-inline-view-switcher-indicator`,n.setAttribute(`aria-hidden`,`true`),applyIndicator(n,e.badgeLabel,e.needsAttention),t.appendChild(n),e.tooltip&&(t.title=e.tooltip),e.showLabel||t.setAttribute(`aria-label`,e.tooltip||e.iconName),applyDescription(t,e.description),t.addEventListener(`click`,()=>{this._state.setSelected(e.pageIndex)}),t.addEventListener(`dragenter`,n=>{t.contains(n.relatedTarget)||this._state.dragEnter(e.pageIndex)}),t.addEventListener(`dragleave`,n=>{t.contains(n.relatedTarget)||this._state.dragLeave(e.pageIndex)}),this._groupEl.appendChild(t),t}),this._render()}_onStateChange(e){this._render(),this.dispatchEvent(new CustomEvent(`notify::active`,{bubbles:!0,detail:{active:e.selected,name:e.name,toggleIndex:this.activeToggle,interactive:e.interactive}}))}_render(){if(!this._initialized)return;this._applyStyleClasses();let e=this.activeToggle;this._toggles.forEach((t,n)=>{let r=n===e&&e!==-1;t.classList.toggle(`active`,r),t.setAttribute(`aria-selected`,String(r)),t.tabIndex=r?0:-1});let t=this._state.selected;this._panels.forEach((e,n)=>{let r=n===t;e.classList.toggle(`active-view`,r),e.hidden=!r}),this._reflectActive()}_applyStyleClasses(){for(let e of[`flat`,`round`,`osd`]){let t=this.hasAttribute(e);this.classList.toggle(e,t),this._groupEl?.classList.toggle(e,t)}for(let e of Ce)this._groupEl.classList.toggle(e,e===this._displayMode)}_reflectActive(){let e=String(this._state.selected);this.getAttribute(`active`)!==e&&this.setAttribute(`active`,e)}};customElements.define(`adw-view-stack-page`,AdwViewStackPage),customElements.define(`adw-inline-view-switcher`,AdwInlineViewSwitcher);var AdwViewStack=class extends HTMLElement{_state=new ViewStackState;_initialized=!1;static get observedAttributes(){return[`visible-child-name`]}constructor(){super(),this._state.subscribe(e=>this._onStateChange(e))}get pages(){return this._state.pages}get visibleChildIndex(){return this._state.visibleIndex}set visibleChildIndex(e){this._state.setVisibleIndex(e)}get visibleChildName(){return this._state.visibleName}set visibleChildName(e){this._state.setVisibleName(e)}get visibleChild(){return this._state.visiblePage?.content??null}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=this.getAttribute(`visible-child-name`);for(let e of Array.from(this.querySelectorAll(`:scope > adw-view-stack-page`))){let t=e.getAttribute(`name`)??``,n=document.createElement(`div`);n.className=`adw-view-stack-child`,n.dataset.name=t;for(let t of Array.from(e.childNodes))n.appendChild(t);this._state.addPage({name:t,title:e.getAttribute(`title`),icon:e.getAttribute(`icon-name`),content:n,visible:!e.hasAttribute(`hidden`)}),this.replaceChild(n,e)}e!==null&&this._state.setVisibleName(e,!1),this._applyVisibility(),this._reflectName()}attributeChangedCallback(e,t,n){this._initialized&&e===`visible-child-name`&&n!==null&&n!==this._state.visibleName&&this._state.setVisibleName(n)}add(e,t,n,r){e.classList.add(`adw-view-stack-child`),e.dataset.name=t;let i=this._state.addPage({name:t,title:n,icon:r,content:e});return this.appendChild(e),this._applyVisibility(),this._reflectName(),this._emitItemsChanged(),i}addTitled(e,t,n){return this.add(e,t,n)}removePage(e){let t=this._state.pages[this._state.indexOfName(e)]?.content;return this._state.removePage(e)?(t?.remove(),this._applyVisibility(),this._reflectName(),this._emitItemsChanged(),!0):!1}setPageVisible(e,t){let n=this._state.setPageVisible(e,t);return this._applyVisibility(),this._emitItemsChanged(),n}_emitItemsChanged(){this.dispatchEvent(new CustomEvent(`items-changed`,{bubbles:!0,detail:{count:this.pages.length}}))}_onStateChange(e){this._applyVisibility(),this._reflectName(),this.dispatchEvent(new CustomEvent(`notify::visible-child`,{bubbles:!0,detail:{index:e.index,name:e.name,title:e.title,interactive:e.interactive}}))}_applyVisibility(){let e=this._state.visibleIndex;this._state.pages.forEach((t,n)=>{let r=t.content;if(!r)return;let i=n===e;r.classList.toggle(`active-view`,i),r.hidden=!i})}_reflectName(){if(this._state.visibleIndex<0){this.removeAttribute(`visible-child-name`);return}let e=this._state.visibleName;this.getAttribute(`visible-child-name`)!==e&&this.setAttribute(`visible-child-name`,e)}};customElements.define(`adw-view-stack`,AdwViewStack);var AdwViewSwitcherBar=class extends HTMLElement{_barState=new ViewSwitcherBarState;_barEl;_nodes=[];_stack=null;_initialized=!1;_onStackNotify=()=>this._rebuild();static get observedAttributes(){return[`stack`,`reveal`,`revealed`]}constructor(){super(),this._barState.subscribe(()=>this._applyRevealed())}get stack(){return this._stack}set stack(e){this.setStack(this._resolveStack(e))}get reveal(){return this._barState.reveal}set reveal(e){e?this.setAttribute(`reveal`,``):(this.removeAttribute(`reveal`),this.removeAttribute(`revealed`))}get revealed(){return this._barState.revealed}connectedCallback(){this._initialized||(this._initialized=!0,this._barEl=document.createElement(`div`),this._barEl.className=`adw-view-switcher-bar-box`,this._barEl.setAttribute(`role`,`tablist`),this.replaceChildren(this._barEl)),this._barState.setReveal(this._readReveal());let e=this.getAttribute(`stack`);if(e&&!this._stack){this.setStack(this._resolveStack(e));return}this._bindStack(),this._rebuild()}disconnectedCallback(){this._unbindStack()}attributeChangedCallback(e,t,n){if(this._initialized){if(e===`reveal`||e===`revealed`){this._barState.setReveal(this._readReveal());return}e===`stack`&&this.setStack(this._resolveStack(n))}}setStack(e){this._unbindStack(),this._stack=e,this._bindStack(),this._rebuild()}refresh(){this._rebuild()}_readReveal(){return this.hasAttribute(`reveal`)||this.hasAttribute(`revealed`)}_bindStack(){this._stack?.addEventListener(`notify::visible-child`,this._onStackNotify),this._stack?.addEventListener(`items-changed`,this._onStackNotify)}_unbindStack(){this._stack?.removeEventListener(`notify::visible-child`,this._onStackNotify),this._stack?.removeEventListener(`items-changed`,this._onStackNotify)}_resolveStack(e){return e===null?null:typeof e==`string`?document.getElementById(e)??null:e}_rebuild(){if(!this._initialized)return;let e=this._stack?.pages??[];this._barState.setPages(e);let t=buildViewSwitcherButtons(viewSwitcherPagesFromStack(e),this._stack?.visibleChildIndex??-1,`narrow`);t.length!==this._nodes.length&&(this._barEl.replaceChildren(),this._nodes=t.map(e=>this._buildButton(e.pageIndex)),this._barEl.append(...this._nodes.map(e=>e.button))),t.forEach((e,t)=>{let n=this._nodes[t];n&&(n.button.hidden=!e.visible,n.button.classList.toggle(`active`,e.selected),n.button.setAttribute(`aria-selected`,String(e.selected)),n.button.tabIndex=e.selected?0:-1,applySwitcherIcon(n.icon,e.iconName),n.label.textContent=e.label,n.label.hidden=e.label.length===0,applyIndicator(n.indicator,e.badgeLabel,e.needsAttention),applyDescription(n.button,e.description),e.label?n.button.removeAttribute(`aria-label`):n.button.setAttribute(`aria-label`,e.iconName))}),this._applyRevealed()}_buildButton(e){let t=document.createElement(`button`);t.type=`button`,t.className=`adw-view-switcher-bar-button`,t.setAttribute(`role`,`tab`);let n=createAdwIcon(null,`adw-view-switcher-bar-icon`),r=document.createElement(`span`);r.className=`adw-view-switcher-bar-label`;let i=document.createElement(`span`);return i.className=`adw-view-switcher-bar-indicator`,i.setAttribute(`aria-hidden`,`true`),t.append(n,r,i),t.addEventListener(`click`,()=>{this._stack&&(this._stack.visibleChildIndex=e)}),{button:t,icon:n,label:r,indicator:i}}_applyRevealed(){this.hidden=!this._barState.revealed}};customElements.define(`adw-view-switcher-bar`,AdwViewSwitcherBar);const Ue={down:`bottom`,up:`top`,left:`start`,right:`end`};var AdwMenuButton=class extends HTMLElement{_buttonEl;_popoverEl;_items=[];_menuTitle=``;_initialized=!1;_itemButtons=[];static get observedAttributes(){return[`icon-name`,`menu-title`,`menu`,`disabled`,`flat`,`circular`,`direction`]}get active(){return this._popoverEl?.open??!1}get menuItems(){return this._items}set menuItems(e){this._items=Array.isArray(e)?e.map(e=>({...e})):[],this._initialized&&this._renderMenu()}get menuTitle(){return this.getAttribute(`menu-title`)??this._menuTitle}set menuTitle(e){this._menuTitle=e??``,this.setAttribute(`menu-title`,this._menuTitle)}get direction(){let e=this.getAttribute(`direction`);return isSplitButtonDirection(e)?e:`down`}set direction(e){this.setAttribute(`direction`,e)}connectedCallback(){this._initialized||(this._initialized=!0,this.classList.add(`adw-menu-button`),this._buttonEl=document.createElement(`button`),this._buttonEl.type=`button`,this._buttonEl.className=`adw-menu-button-button`,this._buttonEl.setAttribute(`aria-haspopup`,`menu`),this._buttonEl.setAttribute(`aria-expanded`,`false`),this._popoverEl=document.createElement(`adw-popover`),this._popoverEl.classList.add(`adw-menu-button-popover`),this._popoverEl.setAttribute(`role`,`menu`),this._popoverEl.setAttribute(`menu`,``),this._popoverEl.setAttribute(`align`,`end`),this.replaceChildren(this._buttonEl,this._popoverEl),this._popoverEl.anchor=this._buttonEl,this._popoverEl.subscribe(e=>this._onPopoverToggled(e)),this._buttonEl.addEventListener(`click`,()=>{this.hasAttribute(`disabled`)||!this._popoverEl.open&&this._items.length===0||(this._popoverEl.open=!this._popoverEl.open)}),this._items.length===0&&(this._items=this._parseMenuAttr()),!this.hasAttribute(`flat`)&&!this.hasAttribute(`circular`)&&this.setAttribute(`flat`,``),this._render())}attributeChangedCallback(e){if(!(!this._initialized||!this._buttonEl)){if(e===`menu`){this._items=this._parseMenuAttr(),this._renderMenu();return}this._render()}}_parseMenuAttr(){return parseMenuEntries(this.getAttribute(`menu`))}_onPopoverToggled(e){this.classList.toggle(`active`,e),this._buttonEl.setAttribute(`aria-expanded`,String(e)),e&&this._itemButtons[0]?.focus()}_render(){let e=this.hasAttribute(`disabled`);this.classList.toggle(`disabled`,e),this._buttonEl.disabled=e,e&&this._popoverEl.popdown(),this.classList.toggle(`flat`,this.hasAttribute(`flat`)),this.classList.toggle(`circular`,this.hasAttribute(`circular`)),this._popoverEl.position=Ue[xe(this.direction)],this._buttonEl.replaceChildren(),this._buttonEl.appendChild(createAdwIcon(this.getAttribute(`icon-name`)??`open-menu`,`adw-menu-button-icon`)),this._buttonEl.setAttribute(`aria-label`,this.getAttribute(`menu-title`)||`Menu`),this._renderMenu()}_renderMenu(){this._popoverEl.replaceChildren(),this._itemButtons=[];let e=this.getAttribute(`menu-title`)??this._menuTitle;if(e){let t=document.createElement(`div`);t.className=`adw-popover-title adw-menu-button-title`,t.textContent=e,this._popoverEl.appendChild(t)}for(let[e,t]of this._items.entries()){let n=document.createElement(`button`);n.type=`button`,n.className=`adw-popover-item adw-menu-button-item`,n.setAttribute(`role`,`menuitem`),n.tabIndex=-1;let r=createAdwIcon(t.icon??null,`adw-menu-button-item-icon`);r.resolvedIconName!==``&&n.appendChild(r);let i=document.createElement(`span`);i.className=`adw-menu-button-item-label`,i.textContent=t.label,n.appendChild(i),n.addEventListener(`click`,()=>{this._popoverEl.popdown(),this._buttonEl.focus(),this.dispatchEvent(new CustomEvent(`menu-item-activated`,{bubbles:!0,detail:{id:t.id??t.label,label:t.label,index:e}}))}),this._popoverEl.appendChild(n),this._itemButtons.push(n)}this._items.length===0&&this._popoverEl.popdown()}};customElements.define(`adw-menu-button`,AdwMenuButton);var AdwDropDown=class extends HTMLElement{_buttonEl;_labelEl;_popoverEl;_listEl;_searchEl=null;_itemButtons=[];_state=new ComboState;_initialized=!1;_typeAheadBuffer=``;_typeAheadTimer=null;static get observedAttributes(){return[`options`,`items`,`selected`,`enable-search`,`disabled`]}get options(){return this._state.options}set options(e){this._state.setOptions(normalizeComboOptions(e)),this._initialized&&this._renderAll()}get items(){return this._state.options}set items(e){this.options=e}get selected(){return this._state.selectedIndex}set selected(e){this._selectIndex(e)}get selectedValue(){return this._state.selectedValue}set selectedValue(e){let t=this._state.options.findIndex(t=>t.value===e);t>=0&&this._selectIndex(t)}get selectedItem(){return this._state.options[this._state.selectedIndex]??null}get enableSearch(){return this.hasAttribute(`enable-search`)}set enableSearch(e){e?this.setAttribute(`enable-search`,``):this.removeAttribute(`enable-search`)}get active(){return this._popoverEl?.open??!1}connectedCallback(){if(this._initialized)return;this._initialized=!0,this.classList.add(`adw-drop-down`),this._buttonEl=document.createElement(`button`),this._buttonEl.type=`button`,this._buttonEl.className=`adw-drop-down-button`,this._buttonEl.setAttribute(`aria-haspopup`,`listbox`),this._buttonEl.setAttribute(`aria-expanded`,`false`),this._labelEl=document.createElement(`span`),this._labelEl.className=`adw-drop-down-label`,this._buttonEl.append(this._labelEl,createAdwIcon(`go-down`,`adw-drop-down-arrow`)),this._buttonEl.addEventListener(`click`,()=>{this.hasAttribute(`disabled`)||!this._popoverEl.open&&this._state.count===0||(this._popoverEl.open=!this._popoverEl.open)}),this._buttonEl.addEventListener(`keydown`,e=>this._onButtonKeyDown(e)),this._popoverEl=document.createElement(`adw-popover`),this._popoverEl.classList.add(`adw-drop-down-popover`),this._popoverEl.setAttribute(`role`,`listbox`),this._popoverEl.setAttribute(`menu`,``),this._listEl=document.createElement(`div`),this._listEl.className=`adw-drop-down-list`,this._popoverEl.appendChild(this._listEl),this._state.count===0&&this._state.setOptions(this._parseOptionsAttr());let e=Number.parseInt(this.getAttribute(`selected`)??``,10);this._state.hasIndex(e)&&this._state.setSelectedIndex(e),this.replaceChildren(this._buttonEl,this._popoverEl),this._popoverEl.anchor=this._buttonEl,this._popoverEl.subscribe(e=>this._onPopoverToggled(e)),this._popoverEl.addEventListener(`keydown`,e=>this._onPopoverTypeAhead(e)),this._renderAll()}attributeChangedCallback(e,t,n){if(!(!this._initialized||!this._buttonEl))if(e===`options`||e===`items`)this._state.setOptions(this._parseOptionsAttr()),this._renderAll();else if(e===`selected`){let e=Number.parseInt(n??``,10);Number.isNaN(e)||this._selectIndex(e,{fromAttr:!0})}else e===`enable-search`?this._renderPopover():e===`disabled`&&(this._buttonEl.disabled=this.hasAttribute(`disabled`),this.hasAttribute(`disabled`)&&this._popoverEl.popdown())}_parseOptionsAttr(){let e=this.getAttribute(`options`)??this.getAttribute(`items`);if(!e)return[];try{return normalizeComboOptions(JSON.parse(e))}catch{return[]}}_selectIndex(e,t={}){if(!this._state.hasIndex(e))return;let n=t.fromUser?this._state.select(e):this._state.setSelectedIndex(e);if(this._updateLabel(),this._updateSelectedStates(),!t.fromAttr&&this.getAttribute(`selected`)!==String(e)&&this.setAttribute(`selected`,String(e)),n){let n=this._state.options[e];this.dispatchEvent(new CustomEvent(`notify::selected`,{bubbles:!0,detail:{selected:e}})),t.fromUser&&this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,detail:{index:e,value:n?.value??``,label:n?.label??``}}))}}_onPopoverToggled(e){if(this.classList.toggle(`active`,e),this._buttonEl.setAttribute(`aria-expanded`,String(e)),e)if(this._filter(``),this._searchEl)this._searchEl.value=``,this._searchEl.focus();else{let e=this._visibleItems();(e[this._state.selectedIndex]??e[0])?.focus()}}_onButtonKeyDown(e){this.hasAttribute(`disabled`)||(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`Enter`||e.key===` `?(e.preventDefault(),this._state.count>0&&this._popoverEl.popup()):e.key.length===1&&!this._popoverEl.open&&this._typeAhead(e.key))}_onPopoverTypeAhead(e){this._searchEl||e.key.length===1&&this._typeAhead(e.key)}_typeAhead(e){this._typeAheadBuffer+=e.toLowerCase(),this._typeAheadTimer&&clearTimeout(this._typeAheadTimer),this._typeAheadTimer=setTimeout(()=>this._typeAheadBuffer=``,800);let t=this._state.options.findIndex(e=>e.label.toLowerCase().startsWith(this._typeAheadBuffer));t<0||(this._popoverEl.open?this._itemButtons[t]?.focus():this._selectIndex(t,{fromUser:!0}))}_filter(e){let t=e.trim().toLowerCase();this._itemButtons.forEach((e,n)=>{e.hidden=!(t.length===0||(this._state.options[n]?.label.toLowerCase().includes(t)??!1))})}_visibleItems(){return this._itemButtons.filter(e=>!e.hidden)}_renderAll(){this._buttonEl.disabled=this.hasAttribute(`disabled`),this.classList.toggle(`disabled`,this.hasAttribute(`disabled`)),this._renderPopover(),this._updateLabel()}_updateLabel(){this._labelEl&&(this._labelEl.textContent=this._state.selectedLabel)}_updateSelectedStates(){this._itemButtons.forEach((e,t)=>{let n=t===this._state.selectedIndex;e.classList.toggle(`selected`,n),e.setAttribute(`aria-selected`,String(n))})}_renderPopover(){if(this._listEl.replaceChildren(),this._itemButtons=[],this._searchEl=null,this.enableSearch)this._searchEl=document.createElement(`input`),this._searchEl.type=`text`,this._searchEl.className=`adw-drop-down-search adw-entry`,this._searchEl.placeholder=`Search…`,this._searchEl.setAttribute(`aria-label`,`Search`),this._searchEl.addEventListener(`input`,()=>this._filter(this._searchEl?.value??``)),this._popoverEl.insertBefore(this._searchEl,this._listEl);else{let e=this._popoverEl.querySelector(`.adw-drop-down-search`);e&&e.remove()}for(let[e,t]of this._state.options.entries()){let n=document.createElement(`button`);n.type=`button`,n.className=`adw-popover-item adw-drop-down-item`,n.setAttribute(`role`,`option`),n.tabIndex=-1;let r=document.createElement(`span`);r.className=`adw-drop-down-item-label`,r.textContent=t.label;let i=document.createElement(`span`);i.className=`adw-drop-down-item-check`,i.setAttribute(`aria-hidden`,`true`),n.append(r,i),n.addEventListener(`click`,()=>{this._selectIndex(e,{fromUser:!0}),this._popoverEl.popdown(),this._buttonEl.focus()}),this._listEl.appendChild(n),this._itemButtons.push(n)}this._updateSelectedStates(),this._state.count===0&&this._popoverEl.popdown()}};customElements.define(`adw-drop-down`,AdwDropDown);function readPageProps(e){return{tag:e.tag,title:e.title,canPop:e.canPop}}var AdwNavigationPage=class extends HTMLElement{_syncing=!1;static get observedAttributes(){return[`title`,`tag`,`can-pop`,`no-back-button`]}get title(){return this.getAttribute(`title`)??``}set title(e){this.setAttribute(`title`,e)}get tag(){return this.getAttribute(`tag`)}set tag(e){e===null?this.removeAttribute(`tag`):this.setAttribute(`tag`,e)}get canPop(){return this.getAttribute(`can-pop`)!==`false`}set canPop(e){this.setAttribute(`can-pop`,e?`true`:`false`)}attributeChangedCallback(e,t){this._syncing||this.closest(`adw-navigation-view`)?.syncPageProperty(this,e,t)}revertAttribute(e,t){this._syncing=!0,t===null?this.removeAttribute(e):this.setAttribute(e,t),this._syncing=!1}},AdwNavigationView=class extends HTMLElement{_pagesEl;_backButtons=new WeakMap;_initialized=!1;_diagnose=e=>{console.warn(`[adw-navigation-view] ${describeNavigationDiagnostic(e)}`)};_state=new NavigationViewState({onDiagnostic:this._diagnose});static get observedAttributes(){return[`animate-transitions`,`pop-on-escape`]}get animateTransitions(){return this.getAttribute(`animate-transitions`)!==`false`}set animateTransitions(e){this.setAttribute(`animate-transitions`,e?`true`:`false`)}get popOnEscape(){return this.getAttribute(`pop-on-escape`)!==`false`}set popOnEscape(e){this.setAttribute(`pop-on-escape`,e?`true`:`false`)}get visiblePage(){return this._state.visiblePage}get visiblePageTag(){return this._state.visiblePageTag}get depth(){return this._state.depth}get navigationStack(){return this._state.stack}get pages(){return this._state.pages}get canGoBack(){return this._state.canGoBack()}get backButtonTooltip(){return this._state.backButtonTooltip()}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=Array.from(this.querySelectorAll(`:scope > adw-navigation-page`));this._pagesEl=document.createElement(`div`),this._pagesEl.className=`adw-navigation-view-pages`;for(let t of e)t.classList.add(`adw-navigation-page`),this._pagesEl.appendChild(t);this.replaceChildren(this._pagesEl),this._state.subscribe(e=>this._onChange(e)),this._state.setAnimateTransitions(this.animateTransitions),this._state.setPopOnEscape(this.popOnEscape),this.addEventListener(`keydown`,this._onKeyDown);for(let t of e)this._state.add(t,readPageProps(t));for(let t of e)this._state.isRegistered(t)||this._detach(t);this._syncClasses(),this._render()}attributeChangedCallback(e){if(this._initialized){if(e===`pop-on-escape`){this._state.setPopOnEscape(this.popOnEscape);return}this._state.setAnimateTransitions(this.animateTransitions),this._syncClasses()}}syncPageProperty(e,t,n){this._state.isRegistered(e)&&(t===`tag`?(this._state.setTag(e,e.tag),this._state.tagOf(e)!==e.tag&&e.revertAttribute(`tag`,n)):t===`title`?this._state.setTitle(e,e.title):t===`can-pop`&&this._state.setCanPop(e,e.canPop),this._render())}addPage(e){let t=this._state.add(e,readPageProps(e));return this._render(),t}removePage(e){let t=this._state.remove(e);return t&&!this._state.isRegistered(e)&&this._detach(e),this._render(),t}push(e){if(typeof e==`string`)return this.pushByTag(e);let t=this._state.push(e,readPageProps(e));return this._render(),t}pushByTag(e){let t=this._state.pushByTag(e);return this._render(),t}pop(){let e=this._state.pop();return this._render(),e}popToPage(e){let t=this._state.popToPage(e);return this._render(),t}popToTag(e){let t=this._state.popToTag(e);return this._render(),t}replace(e){let t=e.map(e=>{if(typeof e!=`string`)return e??null;let t=this._state.findPage(e);return t===null&&this._diagnose({code:`tag-not-found`,tag:e}),t});this._state.replace(t,readPageProps),this._render()}replaceWithTags(e){this._state.replaceWithTags(e),this._render()}findPage(e){return this._state.findPage(e)}getPreviousPage(e){return this._state.getPreviousPage(e)}_onChange(e){for(let t of e.removed)this._detach(t);for(let e of this._state.finishTransition())this._detach(e);if(this._render(),e.reason===`add`||e.reason===`push`)this._dispatch(`pushed`,e.visiblePage);else if(e.reason===`pop`)for(let t of e.popped)this._dispatch(`popped`,t);else this._dispatch(`replaced`,null);e.previousVisiblePage!==e.visiblePage&&this._dispatch(`notify::visible-page`,e.visiblePage)}_dispatch(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:{page:t,tag:t?.tag??null}}))}_onKeyDown=e=>{if(e.defaultPrevented)return;let t;if(e.key===`Escape`)t=this._state.popFromEscape();else if(e.altKey&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)){let n=getComputedStyle(this).direction===`rtl`?`ArrowRight`:`ArrowLeft`;if(e.key!==n)return;t=this._state.popFromShortcut()}else return;t===`stop`&&(e.preventDefault(),e.stopPropagation())};_syncClasses(){this.classList.toggle(`animated`,this.animateTransitions)}_render(){let e=this._state.visiblePage;for(let t of this._state.pages){this._attach(t);let n=t===e;t.classList.toggle(`visible-page`,n),t.hidden=!n,n||this._removeBackButton(t)}e&&this._syncBackButton(e)}_attach(e){e.parentNode!==this._pagesEl&&(e.classList.add(`adw-navigation-page`),this._pagesEl.appendChild(e))}_detach(e){this._removeBackButton(e),e.classList.remove(`visible-page`),e.parentNode===this._pagesEl&&this._pagesEl.removeChild(e)}_syncBackButton(e){if(!this._state.canGoBack()||e.hasAttribute(`no-back-button`)){this._removeBackButton(e);return}let t=this._state.backButtonTooltip()??y,n=this._backButtons.get(e);if(n){n.setAttribute(`tooltip`,t);return}let r=e.querySelector(`adw-header-bar`);if(!r)return;let i=r.startSection??null;if(!i)return;let a=document.createElement(`adw-button`);a.classList.add(`adw-navigation-back-button`),a.setAttribute(`icon`,`go-previous`),a.setAttribute(`flat`,``),a.setAttribute(`tooltip`,t),a.addEventListener(`click`,()=>this.pop()),i.insertBefore(a,i.firstChild),this._backButtons.set(e,a)}_removeBackButton(e){let t=this._backButtons.get(e);t&&(t.parentNode&&t.parentNode.removeChild(t),this._backButtons.delete(e))}};customElements.define(`adw-navigation-page`,AdwNavigationPage),customElements.define(`adw-navigation-view`,AdwNavigationView);var AdwBottomSheetContent=class extends HTMLElement{},AdwBottomSheetSheet=class extends HTMLElement{},AdwBottomSheet=class extends HTMLElement{_initialized=!1;_contentEl;_dimmingEl;_sheetEl;_dragHandleEl;_state=new BottomSheetPresentation;_reflecting=!1;static get observedAttributes(){return[`open`,`modal`,`can-close`,`show-drag-handle`]}get open(){return this._state.open}set open(e){this._setOpen(!!e)}get modal(){return this._boolAttr(`modal`,!0)}set modal(e){this._setBoolAttr(`modal`,e)}get canClose(){return this._state.canClose}set canClose(e){this._setBoolAttr(`can-close`,e)}get showDragHandle(){return this._boolAttr(`show-drag-handle`,!0)}set showDragHandle(e){this._setBoolAttr(`show-drag-handle`,e)}requestClose(e){let t=this._state.requestClose(e);return t===`close-attempt`?this.dispatchEvent(new CustomEvent(`close-attempt`,{bubbles:!0})):t===`delegate`&&this.dispatchEvent(new CustomEvent(`sheet.close`,{bubbles:!0})),t}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=new Set,t=this._collectSlot(`adw-bottom-sheet-sheet`,`sheet`,e),n=this._collectSlot(`adw-bottom-sheet-content`,`content`,e),r=Array.from(this.childNodes).filter(t=>!e.has(t));this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-bottom-sheet-content`;for(let e of n)this._contentEl.appendChild(e);for(let e of r)this._contentEl.appendChild(e);this._dimmingEl=document.createElement(`div`),this._dimmingEl.className=`adw-bottom-sheet-dimming`,this._dimmingEl.addEventListener(`click`,()=>this.requestClose(`dimming`)),this._sheetEl=document.createElement(`div`),this._sheetEl.className=`adw-bottom-sheet-sheet`,this._dragHandleEl=document.createElement(`div`),this._dragHandleEl.className=`adw-bottom-sheet-drag-handle`,this._dragHandleEl.setAttribute(`aria-hidden`,`true`);let i=document.createElement(`div`);i.className=`adw-bottom-sheet-sheet-body`;for(let e of t)i.appendChild(e);this._sheetEl.append(this._dragHandleEl,i),this.replaceChildren(this._contentEl,this._dimmingEl,this._sheetEl),this.addEventListener(`keydown`,e=>{e.key===`Escape`&&(!this.open&&!this._sheetEl.contains(e.target)||(e.stopPropagation(),this.requestClose(`escape`)))}),this._state.setCanClose(this._boolAttr(`can-close`,!0)),this._state.setOpen(this._boolAttr(`open`,!1)),this._state.subscribe(e=>{this._render(),this.dispatchEvent(new CustomEvent(`notify::open`,{bubbles:!0,detail:{open:e}}))}),this._render()}attributeChangedCallback(e,t,n){if(!this._reflecting&&t!==n){if(e===`open`){this._state.setOpen(this._boolAttr(`open`,!1));return}e===`can-close`&&this._state.setCanClose(this._boolAttr(`can-close`,!0)),this._initialized&&this._render()}}_setOpen(e){this._state.setOpen(e)&&(this._initialized||this._reflectOpen(e))}_render(){let e=this._state.open;this._reflectOpen(e),this.classList.toggle(`open`,e),this.classList.toggle(`modal`,this.modal),this.classList.toggle(`has-drag-handle`,this.showDragHandle),this._dimmingEl.classList.toggle(`visible`,e&&this.modal),this._dragHandleEl.hidden=!this.showDragHandle}_reflectOpen(e){this._reflecting=!0,e?this.setAttribute(`open`,``):this.removeAttribute(`open`),this._reflecting=!1}_boolAttr(e,t){let n=this.getAttribute(e);return n===null?t:n!==`false`}_setBoolAttr(e,t){t?this.setAttribute(e,``):this.setAttribute(e,`false`)}_collectSlot(e,t,n){let r=[];for(let i of Array.from(this.children))i.tagName.toLowerCase()===e?(n.add(i),r.push(...Array.from(i.childNodes))):i.getAttribute(`slot`)===t&&(n.add(i),r.push(i));return r}};customElements.define(`adw-bottom-sheet-content`,AdwBottomSheetContent),customElements.define(`adw-bottom-sheet-sheet`,AdwBottomSheetSheet),customElements.define(`adw-bottom-sheet`,AdwBottomSheet);const q=new WeakMap,J=new WeakMap;var AdwSidebarItem=class extends HTMLElement{static get observedAttributes(){return[`title`,`subtitle`,`icon-name`,`disabled`,`hidden`]}attributeChangedCallback(e,t,n){let r=q.get(this);if(!r)return;let i=n??``;e===`title`?r.spec.title=i:e===`subtitle`?r.spec.subtitle=i:e===`icon-name`?r.spec.iconName=i:e===`disabled`?r.spec.enabled=n===null:e===`hidden`&&(r.spec.visible=n===null),r.sidebar.refresh()}},AdwSidebarSection=class extends HTMLElement{static get observedAttributes(){return[`title`]}attributeChangedCallback(e,t,n){let r=J.get(this);r&&(r.spec.title=n??``,r.sidebar.refresh())}},AdwSidebar=class extends HTMLElement{_state=new SidebarState;_listEl;_rows=[];_initialized=!1;_reflecting=!1;static get observedAttributes(){return[`mode`,`selected`]}get selected(){return this._state.selected}set selected(e){this.setAttribute(`selected`,String(e))}get selectedItem(){return this._state.selectedItem}get mode(){return this._state.mode}set mode(e){this.setAttribute(`mode`,e)}get sections(){return this._state.sections}set sections(e){this._state.setSections(e),this._rebuild()}get filter(){return this._state.filter}set filter(e){this._state.setFilter(e),this._rebuild()}connectedCallback(){this._initialized||(this._initialized=!0,this._listEl=document.createElement(`div`),this._listEl.className=`adw-sidebar-list`,this._listEl.setAttribute(`role`,`listbox`),this._state.setSections(this._readDeclaredSections()),this._state.setMode(this._readModeAttr()),this.hasAttribute(`selected`)&&this._state.setSelected(this._readSelectedAttr()),this._state.subscribe(e=>this._onSelectionChanged(e)),this.replaceChildren(this._listEl),this._applyMode(),this._rebuild(),this._reflectSelected())}attributeChangedCallback(e){if(!(!this._initialized||this._reflecting)){if(e===`selected`){this._state.setSelected(this._readSelectedAttr()),this._reflectSelected();return}e===`mode`&&this._state.setMode(this._readModeAttr())&&(this._applyMode(),this._applySelection())}}refresh(){this._initialized&&(this._state.refresh(),this._rebuild())}_readDeclaredSections(){let e=[];for(let t of Array.from(this.querySelectorAll(`adw-sidebar-section`))){let n=[];for(let e of Array.from(t.querySelectorAll(`adw-sidebar-item`))){let t={title:e.getAttribute(`title`)??``,subtitle:e.getAttribute(`subtitle`)??``,iconName:e.getAttribute(`icon-name`)??``,enabled:!e.hasAttribute(`disabled`),visible:!e.hasAttribute(`hidden`)};q.set(e,{sidebar:this,spec:t}),n.push(t)}let r={title:t.getAttribute(`title`)??``,items:n};J.set(t,{sidebar:this,spec:r}),e.push(r)}return e}_readModeAttr(){return this.getAttribute(`mode`)===`page`?`page`:`sidebar`}_readSelectedAttr(){return Number.parseFloat(this.getAttribute(`selected`)??``)}_reflectSelected(){this._reflecting=!0,this.setAttribute(`selected`,String(this._state.selected)),this._reflecting=!1}_onSelectionChanged(e){this._reflectSelected(),this._applySelection(),this.dispatchEvent(new CustomEvent(`notify::selected`,{bubbles:!0,detail:{selected:e.selected,previous:e.previous,interactive:e.interactive}}))}_activate(e){this._state.activate(e).activated&&this.dispatchEvent(new CustomEvent(`activated`,{bubbles:!0,detail:{index:e}}))}_rebuild(){let e=new Map;for(let t of this._state.headers)e.set(t.sectionIndex,t);let t=[];for(let e of this._state.visibleItems){let n=t[t.length-1];n&&n.sectionIndex===e.sectionIndex?n.items.push(e):t.push({sectionIndex:e.sectionIndex,items:[e]})}this._rows=[];let n=[];for(let r of t){let t=e.get(r.sectionIndex);t&&n.push(this._createHeader(t));let i=document.createElement(`div`);i.className=`adw-sidebar-section`;for(let e of r.items){let t=this._createRow(e);i.appendChild(t),this._rows.push({el:t,index:e.index})}n.push(i)}this._listEl.replaceChildren(...n),this.classList.toggle(`empty`,this._state.isEmpty),this._applySelection()}_createHeader(e){let t=document.createElement(`div`);if(t.className=`adw-sidebar-section-header`,e.kind===`title`){t.classList.add(`has-title`);let n=document.createElement(`span`);n.className=`adw-sidebar-section-heading`,n.textContent=e.title,t.appendChild(n)}else t.classList.add(`separator`);return e.first&&t.classList.add(`first`),t}_createRow(e){let t=e.item,n=document.createElement(`button`);n.type=`button`,n.className=`adw-sidebar-item`,n.setAttribute(`role`,`option`),n.hidden=t.visible===!1,n.disabled=t.enabled===!1;let r=createAdwIcon(t.iconName??null,`adw-sidebar-item-icon`);r.hidden=!e.iconVisible,n.appendChild(r);let i=document.createElement(`span`);i.className=`adw-sidebar-item-text`;let a=document.createElement(`span`);a.className=`adw-sidebar-item-title`,a.textContent=t.title,a.hidden=!e.titleVisible,i.appendChild(a);let o=document.createElement(`span`);return o.className=`adw-sidebar-item-subtitle`,o.textContent=t.subtitle??``,o.hidden=!e.subtitleVisible,i.appendChild(o),n.appendChild(i),n.appendChild(createAdwIcon(`go-next`,`adw-sidebar-item-arrow`)),n.addEventListener(`click`,()=>this._activate(e.index)),n}_applyMode(){let e=this._state.mode===`page`;this.classList.toggle(`page`,e),this.classList.toggle(`mode-sidebar`,!e)}_applySelection(){let e=this._state.selected,t=this._state.selectionVisible;this._rows.forEach((n,r)=>{let i=n.index===e;n.el.classList.toggle(`selected`,i&&t),n.el.setAttribute(`aria-selected`,String(i)),n.el.tabIndex=i||e===-1&&r===0?0:-1})}};customElements.define(`adw-sidebar-item`,AdwSidebarItem),customElements.define(`adw-sidebar-section`,AdwSidebarSection),customElements.define(`adw-sidebar`,AdwSidebar);function rowLabel(e){return stripMnemonic(u[e])}var AdwAboutDialog=class extends HTMLElement{_initialized=!1;_scrimEl;_sheetEl;_navView;_scrollEl;_mainToolbarEl;_developers=[];_designers=[];_artists=[];_documenters=[];static get observedAttributes(){return[`application-name`,`application-icon`,`developer-name`,`version`,`comments`,`website`,`support-url`,`issue-url`,`copyright`,`license`,`license-url`,`open`]}get applicationName(){return this.getAttribute(`application-name`)??``}set applicationName(e){this.setAttribute(`application-name`,e)}get applicationIcon(){return this.getAttribute(`application-icon`)??``}set applicationIcon(e){this.setAttribute(`application-icon`,e)}get developerName(){return this.getAttribute(`developer-name`)??``}set developerName(e){this.setAttribute(`developer-name`,e)}get version(){return this.getAttribute(`version`)??``}set version(e){this.setAttribute(`version`,e)}get comments(){return this.getAttribute(`comments`)??``}set comments(e){this.setAttribute(`comments`,e)}get website(){return this.getAttribute(`website`)??``}set website(e){this.setAttribute(`website`,e)}get supportUrl(){return this.getAttribute(`support-url`)??``}set supportUrl(e){this.setAttribute(`support-url`,e)}get issueUrl(){return this.getAttribute(`issue-url`)??``}set issueUrl(e){this.setAttribute(`issue-url`,e)}get copyright(){return this.getAttribute(`copyright`)??``}set copyright(e){this.setAttribute(`copyright`,e)}get license(){return this.getAttribute(`license`)??``}set license(e){this.setAttribute(`license`,e)}get licenseUrl(){return this.getAttribute(`license-url`)??``}set licenseUrl(e){this.setAttribute(`license-url`,e)}get open(){return this.hasAttribute(`open`)}set open(e){e?this.setAttribute(`open`,``):this.removeAttribute(`open`)}get developers(){return this._developers}set developers(e){this._developers=[...e],this._initialized&&this._render()}get designers(){return this._designers}set designers(e){this._designers=[...e],this._initialized&&this._render()}get artists(){return this._artists}set artists(e){this._artists=[...e],this._initialized&&this._render()}get documenters(){return this._documenters}set documenters(e){this._documenters=[...e],this._initialized&&this._render()}present(){this.open=!0}close(){this.open=!1}connectedCallback(){this._initialized||(this._initialized=!0,this._scrimEl=document.createElement(`div`),this._scrimEl.className=`adw-about-dialog-scrim`,this._scrimEl.addEventListener(`click`,()=>this.close()),this._sheetEl=document.createElement(`div`),this._sheetEl.className=`adw-about-dialog-sheet`,this._sheetEl.setAttribute(`role`,`dialog`),this._sheetEl.setAttribute(`aria-modal`,`true`),this._sheetEl.setAttribute(`aria-label`,u.dialogTitle),this.replaceChildren(this._scrimEl,this._sheetEl),this.addEventListener(`keydown`,e=>{e.key===`Escape`&&this.open&&(e.stopPropagation(),this.close())}),this._render())}attributeChangedCallback(e,t,n){if(this._initialized&&t!==n){if(e===`open`){this._syncOpen(),this.dispatchEvent(new CustomEvent(`notify::open`,{bubbles:!0,detail:{open:this.open}})),this.open||this.dispatchEvent(new CustomEvent(`closed`,{bubbles:!0}));return}this._render()}}_syncOpen(){this.classList.toggle(`open`,this.open),this.open&&(this._navView.replace?.([`main`]),this._scrollEl.scrollTop=0,this._updateHeaderTitle(),requestAnimationFrame(()=>this._sheetEl.focus()))}_creditsSections(){return creditsSections({developers:this._developers,designers:this._designers,artists:this._artists,documenters:this._documenters})}_hasLegal(){let e=this.license.length>0?o.CUSTOM:o.UNKNOWN;return legalSectionVisible(this.copyright,e,this.license)}_render(){let e=this._creditsSections(),t=aboutDialogVisibility({applicationIcon:this.applicationIcon,applicationName:this.applicationName,developerName:this.developerName,version:this.version,comments:this.comments,website:this.website,supportUrl:this.supportUrl,issueUrl:this.issueUrl,hasCredits:e.length>0,hasLegal:this._hasLegal()});this._navView=document.createElement(`adw-navigation-view`),this._navView.append(this._buildMainPage(t)),t.detailsRow&&this._navView.append(this._buildDetailsPage(t)),t.creditsRow&&this._navView.append(this._buildCreditsPage(e)),t.legalRow&&this._navView.append(this._buildLegalPage()),this._sheetEl.replaceChildren(this._navView),this._sheetEl.tabIndex=-1,this.classList.toggle(`open`,this.open)}_buildPage(e,t,n,r=t){let i=document.createElement(`adw-navigation-page`);i.setAttribute(`title`,t),i.setAttribute(`tag`,e);let a=document.createElement(`adw-header-bar`);if(a.setAttribute(`title`,r),n){let e=document.createElement(`button`);e.type=`button`,e.className=`adw-button flat circular adw-about-dialog-close`,e.setAttribute(`aria-label`,`Close`),e.addEventListener(`click`,()=>this.close());let endApply=()=>{let t=a.endSection??null;t&&t.appendChild(e)};queueMicrotask(endApply)}let o=document.createElement(`div`);o.className=`adw-about-dialog-scroll`;let s=document.createElement(`div`);s.className=`adw-about-dialog-clamp`;let c=document.createElement(`div`);c.className=`adw-about-dialog-page-body`,s.appendChild(c),o.appendChild(s);let l=document.createElement(`div`);return l.className=`adw-about-dialog-toolbar-view`,l.append(a,o),i.appendChild(l),e===`main`&&(this._scrollEl=o,this._mainToolbarEl=l,l.classList.add(`main-page`),o.addEventListener(`scroll`,()=>this._updateHeaderTitle())),{page:i,body:c,header:a}}_buildMainPage(e){let{page:t,body:n}=this._buildPage(`main`,u.dialogTitle,!0,this.applicationName);if(e.appIcon&&n.appendChild(createAdwIcon(this.applicationIcon,`adw-about-dialog-icon`)),e.appName){let e=document.createElement(`span`);e.className=`adw-about-dialog-name`,e.textContent=this.applicationName,n.appendChild(e)}if(e.developerName){let e=document.createElement(`span`);e.className=`adw-about-dialog-developer`,e.textContent=this.developerName,n.appendChild(e)}if(e.version){let e=document.createElement(`span`);e.className=`adw-about-dialog-version`,e.textContent=this.version,n.appendChild(e)}let r=[];e.detailsRow&&r.push(this._buildNavRow(rowLabel(`detailsRow`),`details`)),e.websiteRow&&r.push(this._buildLinkRow(rowLabel(`websiteRow`),this.website));let i=[];e.supportRow&&i.push(this._buildLinkRow(rowLabel(`supportRow`),this.supportUrl)),e.issueRow&&i.push(this._buildLinkRow(rowLabel(`issueRow`),this.issueUrl));let a=[];return e.creditsRow&&a.push(this._buildNavRow(rowLabel(`creditsRow`),`credits`)),e.legalRow&&a.push(this._buildNavRow(rowLabel(`legalRow`),`legal`)),e.detailsGroup&&n.appendChild(this._buildGroup(`details`,r)),e.supportGroup&&n.appendChild(this._buildGroup(`support`,i)),e.creditsLegalGroup&&n.appendChild(this._buildGroup(`credits-legal`,a)),t}_buildGroup(e,t,n){let r=document.createElement(`adw-preferences-group`);e!==null&&r.setAttribute(`data-group`,e),n!==void 0&&r.setAttribute(`title`,n);for(let e of t)r.appendChild(e);let i=document.createElement(`div`);return i.className=`adw-about-dialog-rows`,i.appendChild(r),i}_buildNavRow(e,t){let n=document.createElement(`adw-action-row`);n.setAttribute(`title`,e),n.setAttribute(`activatable`,``);let r=createAdwIcon(`go-next`,`adw-about-dialog-chevron`);return r.setAttribute(`slot`,`suffix`),n.appendChild(r),n.addEventListener(`activated`,()=>{this._navView.push?.(t)}),n}_activateLink(e){let t=new CustomEvent(`activate-link`,{bubbles:!0,cancelable:!0,detail:{uri:e}});this.dispatchEvent(t)&&globalThis.open(e,`_blank`,`noopener,noreferrer`)}_buildDetailsPage(e){let{page:t,body:n}=this._buildPage(`details`,u.detailsPage,!1);if(e.commentsLabel){let e=document.createElement(`p`);e.className=`adw-about-dialog-comments`,e.textContent=this.comments,n.appendChild(e)}if(e.linksGroup){let t=[];e.detailsWebsiteRow&&t.push(this._buildLinkRow(rowLabel(`websiteRow`),this.website)),n.appendChild(this._buildGroup(`links`,t))}return t}_buildLinkRow(e,t){let n=document.createElement(`adw-action-row`);n.setAttribute(`title`,e),n.setAttribute(`activatable`,``),n.classList.add(`adw-about-dialog-link-row`);let r=createAdwIcon(`go-next`,`adw-about-dialog-chevron`);return r.setAttribute(`slot`,`suffix`),n.appendChild(r),n.addEventListener(`activated`,()=>this._activateLink(t)),n}_buildCreditsPage(e){let{page:t,body:n}=this._buildPage(`credits`,u.creditsPage,!1);for(let t of e){let e=t.people.map(e=>this._buildCreditRow(e));n.appendChild(this._buildGroup(null,e,t.title??void 0))}return t}_buildCreditRow(e){let t=document.createElement(`adw-action-row`);if(t.setAttribute(`title`,e.name),e.link!==null){let n=e.uri??``;t.setAttribute(`activatable`,``),t.classList.add(`adw-about-dialog-link-row`);let r=createAdwIcon(`go-next`,`adw-about-dialog-chevron`);r.setAttribute(`slot`,`suffix`),t.appendChild(r),t.addEventListener(`activated`,()=>this._activateLink(n))}return t}_buildLegalPage(){let{page:e,body:t}=this._buildPage(`legal`,u.legalPage,!1);if(this.copyright){let e=document.createElement(`p`);e.className=`adw-about-dialog-copyright`,e.textContent=this.copyright,t.appendChild(e)}if(this.license){let e=document.createElement(`p`);if(e.className=`adw-about-dialog-license`,this.licenseUrl){let t=document.createElement(`a`);t.href=this.licenseUrl,t.rel=`noopener noreferrer`,t.textContent=this.license,t.addEventListener(`click`,e=>{e.preventDefault(),this._activateLink(this.licenseUrl)}),e.appendChild(t)}else e.textContent=this.license;t.appendChild(e)}return e}_updateHeaderTitle(){!this._scrollEl||!this._mainToolbarEl||this._mainToolbarEl.classList.toggle(`scrolled`,this._scrollEl.scrollTop>0)}};customElements.define(`adw-about-dialog`,AdwAboutDialog);var AdwAlertResponse=class extends HTMLElement{static get observedAttributes(){return[`id`,`appearance`,`enabled`]}},AdwAlertDialog=class extends HTMLElement{_initialized=!1;_scrimEl;_dialogEl;_headingEl;_bodyEl;_childEl;_responseAreaEl;_model=new AdwAlertResponses;_buttons=new Map;_blockCloseResponse=!1;static get observedAttributes(){return[`heading`,`body`,`open`,`prefer-wide-layout`]}get heading(){return this.getAttribute(`heading`)??``}set heading(e){this.setAttribute(`heading`,e)}get body(){return this.getAttribute(`body`)??``}set body(e){this.setAttribute(`body`,e)}get open(){return this.hasAttribute(`open`)}set open(e){e?this.setAttribute(`open`,``):this.removeAttribute(`open`)}get preferWideLayout(){return this.hasAttribute(`prefer-wide-layout`)}set preferWideLayout(e){e?this.setAttribute(`prefer-wide-layout`,``):this.removeAttribute(`prefer-wide-layout`)}get defaultResponse(){return this._model.defaultResponse}set defaultResponse(e){this.setDefaultResponse(e)}get closeResponse(){return this._model.closeResponse}set closeResponse(e){this.setCloseResponse(e)}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=Array.from(this.querySelectorAll(`:scope > adw-alert-response`)),t=new Set(e),n=Array.from(this.childNodes).filter(e=>!t.has(e));this._scrimEl=document.createElement(`div`),this._scrimEl.className=`adw-alert-dialog-scrim`,this._scrimEl.addEventListener(`click`,()=>this._dismiss()),this._dialogEl=document.createElement(`div`),this._dialogEl.className=`adw-alert-dialog-box`,this._dialogEl.setAttribute(`role`,`alertdialog`),this._dialogEl.setAttribute(`aria-modal`,`true`),this._dialogEl.addEventListener(`click`,e=>e.stopPropagation());let r=document.createElement(`div`);r.className=`adw-alert-dialog-message`,this._headingEl=document.createElement(`h2`),this._headingEl.className=`adw-alert-dialog-heading`,this._bodyEl=document.createElement(`p`),this._bodyEl.className=`adw-alert-dialog-body`,this._childEl=document.createElement(`div`),this._childEl.className=`adw-alert-dialog-child`;for(let e of n)this._childEl.appendChild(e);r.append(this._headingEl,this._bodyEl,this._childEl),this._responseAreaEl=document.createElement(`div`),this._responseAreaEl.className=`adw-alert-dialog-responses`,this._dialogEl.append(r,this._responseAreaEl),this.replaceChildren(this._scrimEl,this._dialogEl),this.addEventListener(`keydown`,e=>{e.key===`Escape`&&this.open&&(e.stopPropagation(),this._dismiss())});for(let t of e){let e=t.getAttribute(`id`);if(!e)continue;let n=t.getAttribute(`appearance`)??`default`;this.addResponse(e,(t.textContent??``).trim()),n!=="default"&&this.setResponseAppearance(e,n),t.getAttribute(`enabled`)===`false`&&this.setResponseEnabled(e,!1)}this._model.heading=this.heading,this._model.body=this.body,this._render()}attributeChangedCallback(e,t,n){this._initialized&&t!==n&&(this._render(),e===`heading`?(this._model.heading=this.heading,this.dispatchEvent(new CustomEvent(`notify::heading`,{bubbles:!0,detail:{heading:this.heading}}))):e===`body`?(this._model.body=this.body,this.dispatchEvent(new CustomEvent(`notify::body`,{bubbles:!0,detail:{body:this.body}}))):e===`open`&&(this.dispatchEvent(new CustomEvent(`notify::open`,{bubbles:!0,detail:{open:this.open}})),this.open&&this._focusInitial()))}present(e){this.open=!0}addResponse(e,t){if(this._model.hasResponse(e)){console.warn(`[adw-alert-dialog] Trying to add a response with id '${e}', but such a response already exists`);return}let n=document.createElement(`button`);n.type=`button`,n.className=`adw-button adw-alert-dialog-response`,n.textContent=t,n.addEventListener(`click`,()=>this._activateResponse(e)),this._model.addResponse(e,t),this._buttons.set(e,n),this._responseAreaEl&&this._responseAreaEl.appendChild(n),this._render()}addResponses(...e){for(let t=0;t+1<e.length;t+=2)this.addResponse(e[t],e[t+1])}removeResponse(e){if(!this._model.hasResponse(e))return;this._buttons.get(e)?.remove(),this._buttons.delete(e);let t=this._model.responses.filter(t=>t.id!==e),n=new AdwAlertResponses(this._model.heading,this._model.body);for(let e of t)n.addResponse(e.id,e.label,{appearance:e.appearance,enabled:e.enabled});n.closeResponse=this._model.closeResponse,n.defaultResponse=this._model.defaultResponse===e?null:this._model.defaultResponse,this._model=n,this._render()}hasResponse(e){return this._model.hasResponse(e)}getResponseLabel(e){return this._model.responses.find(t=>t.id===e)?.label??null}setResponseLabel(e,t){let n=this._buttons.get(e);n&&(this._model.addResponse(e,t),n.textContent=t)}getResponseAppearance(e){return this._model.hasResponse(e)?this._model.getResponseAppearance(e):null}setResponseAppearance(e,t){let n=this._buttons.get(e);n&&(this._model.setResponseAppearance(e,t),n.classList.toggle(`suggested-action`,t===`suggested`),n.classList.toggle(`destructive-action`,t===`destructive`))}getResponseEnabled(e){return this._model.hasResponse(e)?this._model.getResponseEnabled(e):!1}setResponseEnabled(e,t){let n=this._buttons.get(e);n&&(this._model.setResponseEnabled(e,t),n.disabled=!t)}setDefaultResponse(e){this._model.defaultResponse=e,this._render()}setCloseResponse(e){this._model.closeResponse=e}_activateResponse(e){this._model.getResponseEnabled(e)&&(this._blockCloseResponse=!0,this.open=!1,this._blockCloseResponse=!1,this._emitResponse(this._model.resolveById(e)))}_dismiss(){this.open&&(this.open=!1,!this._blockCloseResponse&&this._emitResponse(this._model.resolveById(null)))}_emitResponse(e){this.dispatchEvent(new CustomEvent(`response`,{bubbles:!0,detail:{response:e}}))}_focusInitial(){let e=this._model.defaultResponse,t=this._model.responses.find(e=>e.enabled)?.id;((e?this._buttons.get(e):void 0)??(t?this._buttons.get(t):void 0))?.focus()}_render(){this.classList.toggle(`open`,this.open);let e=this.heading;this._headingEl.textContent=e,this._headingEl.hidden=e.length===0;let t=this.body;this._bodyEl.textContent=t,this._bodyEl.hidden=t.length===0,this._childEl.hidden=this._childEl.childElementCount===0;let n=this.preferWideLayout&&this._model.responses.length<=2;this._responseAreaEl.classList.toggle(`horizontal`,n);let r=this._model.defaultResponse;for(let e of this._model.responses){let t=e.id===r&&e.appearance==="default";this._buttons.get(e.id)?.classList.toggle(`default-response`,t)}}};customElements.define(`adw-alert-response`,AdwAlertResponse),customElements.define(`adw-alert-dialog`,AdwAlertDialog);const Y=new Set([`adw-action-row`,`adw-switch-row`,`adw-combo-row`,`adw-spin-row`]),We=new Set([...Y,`adw-entry-row`,`adw-password-entry-row`,`adw-expander-row`,`adw-button-row`]);function isVisible(e){return!(e instanceof HTMLElement&&e.hidden)}function groupRows(e){let t=e.querySelector(`:scope > .adw-preferences-group-listbox`);return Array.from((t??e).children).filter(e=>We.has(e.tagName.toLowerCase()))}function describeRow(e){let t=e.getAttribute(`subtitle`);return{title:e.getAttribute(`title`)??``,subtitle:t,visible:isVisible(e),isActionRow:Y.has(e.tagName.toLowerCase()),useMarkup:!1,useUnderline:!1,ref:e}}function describeGroup(e){return{title:e.getAttribute(`title`)??``,visible:isVisible(e),rows:groupRows(e).map(describeRow),ref:e}}function describePreferencesPages(e){return Array.from(e.querySelectorAll(`adw-preferences-page`)).map(e=>({name:e.getAttribute(`name`),title:e.getAttribute(`title`)??``,iconName:e.getAttribute(`icon-name`),useUnderline:e.hasAttribute(`use-underline`),visible:isVisible(e),description:e.getAttribute(`description`)??``,groups:Array.from(e.querySelectorAll(`adw-preferences-group`)).map(describeGroup),ref:e}))}function searchPreferencesDom(e,t,n){return searchPreferences(describePreferencesPages(e),t,n)}var AdwPreferencesPage=class extends HTMLElement{static get observedAttributes(){return[`title`,`icon-name`,`name`,`use-underline`,`open`]}get name(){return this.getAttribute(`name`)??``}set name(e){this.setAttribute(`name`,e)}get iconName(){return this.getAttribute(`icon-name`)??``}set iconName(e){this.setAttribute(`icon-name`,e)}get useUnderline(){return this.hasAttribute(`use-underline`)}set useUnderline(e){this.toggleAttribute(`use-underline`,e)}get groups(){return Array.from(this.querySelectorAll(`adw-preferences-group`))}},AdwPreferencesDialog=class extends HTMLElement{_initialized=!1;_scrimEl;_dialogEl;_titleEl;_bodyEl;_pagesEl;_closeBtn;static get observedAttributes(){return[`title`,`open`,`can-close`,`content-width`]}get open(){return this.hasAttribute(`open`)}set open(e){e?this.setAttribute(`open`,``):this.removeAttribute(`open`)}get canClose(){let e=this.getAttribute(`can-close`);return e===null?!0:e!==`false`}set canClose(e){e?this.setAttribute(`can-close`,``):this.setAttribute(`can-close`,`false`)}get contentWidth(){let e=Number.parseInt(this.getAttribute(`content-width`)??``,10);return Number.isNaN(e)?640:e}set contentWidth(e){this.setAttribute(`content-width`,String(e))}present(){this.open=!0}close(){this._attemptClose()}forceClose(){this.open&&=!1}add(e){this._pagesEl.appendChild(e)}removePage(e){return e.parentNode===this._pagesEl?(this._pagesEl.removeChild(e),!0):!1}get pages(){return Array.from(this._pagesEl.querySelectorAll(`adw-preferences-page`))}search(e,t){return searchPreferencesDom(this._pagesEl,e,t)}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=Array.from(this.childNodes);this._scrimEl=document.createElement(`div`),this._scrimEl.className=`adw-preferences-dialog-scrim`,this._scrimEl.addEventListener(`click`,()=>this._attemptClose()),this._dialogEl=document.createElement(`div`),this._dialogEl.className=`adw-preferences-dialog-box`,this._dialogEl.setAttribute(`role`,`dialog`),this._dialogEl.setAttribute(`aria-modal`,`true`),this._dialogEl.addEventListener(`click`,e=>e.stopPropagation());let t=document.createElement(`div`);t.className=`adw-preferences-dialog-header`;let n=document.createElement(`div`);n.className=`adw-preferences-dialog-header-side`,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-preferences-dialog-title`;let r=document.createElement(`div`);r.className=`adw-preferences-dialog-header-side adw-preferences-dialog-header-side--end`,this._closeBtn=document.createElement(`button`),this._closeBtn.type=`button`,this._closeBtn.className=`adw-preferences-dialog-close`,this._closeBtn.setAttribute(`aria-label`,`Close`),this._closeBtn.addEventListener(`click`,()=>this._attemptClose()),r.appendChild(this._closeBtn),t.append(n,this._titleEl,r),this._bodyEl=document.createElement(`div`),this._bodyEl.className=`adw-preferences-dialog-body`,this._pagesEl=document.createElement(`div`),this._pagesEl.className=`adw-preferences-dialog-pages`;for(let t of e)this._pagesEl.appendChild(t);this._bodyEl.appendChild(this._pagesEl),this._dialogEl.append(t,this._bodyEl),this.replaceChildren(this._scrimEl,this._dialogEl),this.hasAttribute(`tabindex`)||(this.tabIndex=-1),this.addEventListener(`keydown`,e=>{e.key===`Escape`&&this.open&&(e.stopPropagation(),this._attemptClose())}),this._render()}attributeChangedCallback(e,t,n){this._initialized&&t!==n&&(this._render(),e===`open`&&(this.dispatchEvent(new CustomEvent(`notify::open`,{bubbles:!0,detail:{open:this.open}})),this.open||this.dispatchEvent(new CustomEvent(`closed`,{bubbles:!0}))))}_attemptClose(){if(this.open){if(!this.canClose){this.dispatchEvent(new CustomEvent(`close-attempt`,{bubbles:!0}));return}this.open=!1}}_render(){this.classList.toggle(`open`,this.open);let e=this.getAttribute(`title`)??``;this._titleEl.textContent=e,this._dialogEl.style.setProperty(`--adw-dialog-content-width`,`${this.contentWidth}px`);let t=!this.canClose;this._closeBtn.disabled=t,this._closeBtn.classList.toggle(`locked`,t),this.open&&this.focus()}};customElements.define(`adw-preferences-page`,AdwPreferencesPage),customElements.define(`adw-preferences-dialog`,AdwPreferencesDialog);const Ge=[`auto`,`floating`,`bottom-sheet`],Ke=[`a[href]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`,`);var AdwDialog=class extends HTMLElement{_initialized=!1;_scrimEl;_boxEl;_headerEl;_titleEl;_closeBtn;_contentEl;_previouslyFocused=null;static get observedAttributes(){return[`title`,`open`,`can-close`,`content-width`,`content-height`,`presentation-mode`,`show-header`]}get open(){return this.hasAttribute(`open`)}set open(e){e?this.setAttribute(`open`,``):this.removeAttribute(`open`)}get title(){return this.getAttribute(`title`)??``}set title(e){this.setAttribute(`title`,e)}get canClose(){let e=this.getAttribute(`can-close`);return e===null?!0:e!==`false`}set canClose(e){e?this.setAttribute(`can-close`,``):this.setAttribute(`can-close`,`false`)}get contentWidth(){let e=Number.parseInt(this.getAttribute(`content-width`)??``,10);return Number.isNaN(e)?360:e}set contentWidth(e){this.setAttribute(`content-width`,String(e))}get contentHeight(){let e=Number.parseInt(this.getAttribute(`content-height`)??``,10);return Number.isNaN(e)?0:e}set contentHeight(e){e>0?this.setAttribute(`content-height`,String(e)):this.removeAttribute(`content-height`)}get presentationMode(){let e=this.getAttribute(`presentation-mode`);return e&&Ge.includes(e)?e:`auto`}set presentationMode(e){this.setAttribute(`presentation-mode`,e)}get contentArea(){return this._contentEl}present(e){this.isConnected||(e??document.body).appendChild(this),this.open=!0}close(){this._attemptClose()}forceClose(){this.open&&=!1}connectedCallback(){if(this._initialized)return;this._initialized=!0,this.classList.add(`adw-dialog`);let e=Array.from(this.childNodes);this._scrimEl=document.createElement(`div`),this._scrimEl.className=`adw-dialog-scrim`,this._scrimEl.addEventListener(`click`,()=>this._attemptClose()),this._boxEl=document.createElement(`div`),this._boxEl.className=`adw-dialog-box`,this._boxEl.setAttribute(`role`,`dialog`),this._boxEl.setAttribute(`aria-modal`,`true`),this._boxEl.tabIndex=-1,this._boxEl.addEventListener(`click`,e=>e.stopPropagation()),this._boxEl.addEventListener(`keydown`,e=>this._onBoxKeyDown(e)),this._headerEl=document.createElement(`div`),this._headerEl.className=`adw-dialog-header`;let t=document.createElement(`div`);t.className=`adw-dialog-header-side`,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-dialog-title`;let n=document.createElement(`div`);n.className=`adw-dialog-header-side adw-dialog-header-side--end`,this._closeBtn=document.createElement(`button`),this._closeBtn.type=`button`,this._closeBtn.className=`adw-dialog-close`,this._closeBtn.setAttribute(`aria-label`,`Close`),this._closeBtn.addEventListener(`click`,()=>this._attemptClose()),n.appendChild(this._closeBtn),this._headerEl.append(t,this._titleEl,n),this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-dialog-content`;for(let t of e)this._contentEl.appendChild(t);this._boxEl.append(this._headerEl,this._contentEl),this._scrimEl.appendChild(this._boxEl),this.replaceChildren(this._scrimEl),this._render()}attributeChangedCallback(e,t,n){this._initialized&&t!==n&&(this._render(),e===`open`&&(this.dispatchEvent(new CustomEvent(`notify::open`,{bubbles:!0,detail:{open:this.open}})),this.open?this._onPresented():this._onClosed()))}_attemptClose(){if(this.open){if(!this.canClose){this.dispatchEvent(new CustomEvent(`close-attempt`,{bubbles:!0}));return}this.open=!1}}_onBoxKeyDown(e){if(e.key===`Escape`&&this.open){e.stopPropagation(),this._attemptClose();return}if(e.key!==`Tab`)return;let t=this._focusables();if(t.length===0){e.preventDefault(),this._boxEl.focus();return}let n=t[0],r=t[t.length-1],i=document.activeElement;e.shiftKey&&(i===n||i===this._boxEl)?(e.preventDefault(),r.focus()):!e.shiftKey&&i===r&&(e.preventDefault(),n.focus())}_focusables(){return Array.from(this._boxEl.querySelectorAll(Ke)).filter(e=>!e.hasAttribute(`disabled`)&&!e.hidden)}_onPresented(){let e=document.activeElement;this._previouslyFocused=e instanceof HTMLElement&&e!==this?e:null,(this._focusables()[0]??this._boxEl).focus()}_onClosed(){this.dispatchEvent(new CustomEvent(`closed`,{bubbles:!0}));let e=this._previouslyFocused;this._previouslyFocused=null,e&&e.isConnected&&e.focus()}_render(){this.classList.toggle(`open`,this.open);let e=this.title;this._titleEl.textContent=e;let t=e.length>0||this.hasAttribute(`show-header`);this._headerEl.hidden=!t,this.dataset.presentation=this.presentationMode,this._boxEl.style.setProperty(`--adw-dialog-content-width`,`${this.contentWidth}px`);let n=this.contentHeight;n>0?this._boxEl.style.setProperty(`--adw-dialog-content-height`,`${n}px`):this._boxEl.style.removeProperty(`--adw-dialog-content-height`);let r=!this.canClose;this._closeBtn.disabled=r,this._closeBtn.classList.toggle(`locked`,r)}};if(customElements.define(`adw-dialog`,AdwDialog),typeof document<`u`&&!document.getElementById(`adwaita-web-style`)){let e=document.createElement(`style`);e.id=`adwaita-web-style`,e.textContent=`@charset "UTF-8";
|
|
3
|
+
`)}const l={developers:`Code by`,designers:`Design by`,artists:`Artwork by`,documenters:`Documentation by`,translators:`Translated by`};function creditsSections(e={}){return[{title:l.developers,people:e.developers??[]},{title:l.designers,people:e.designers??[]},{title:l.artists,people:e.artists??[]},{title:l.documenters,people:e.documenters??[]},{title:l.translators,people:translatorCreditsPeople(e.translatorCredits)},...e.creditSections??[]].filter(e=>e.people.length>0).map(e=>({title:e.title,people:e.people.map(parseCreditPerson)}))}const u={dialogTitle:`About`,whatsNewRow:`What’s _New`,detailsRow:`_Details`,websiteRow:`_Website`,supportRow:`_Support Questions`,issueRow:`_Report an Issue`,troubleshootingRow:`_Troubleshooting`,creditsRow:`_Credits`,legalRow:`_Legal`,acknowledgementsRow:`_Acknowledgements`,whatsNewPage:`What’s New`,detailsPage:`Details`,troubleshootingPage:`Troubleshooting`,creditsPage:`Credits`,legalPage:`Legal`,acknowledgementsPage:`Acknowledgements`};function aboutDialogVisibility(e={}){let t=(e.website??``).length>0,n=(e.comments??``).length>0,r=(e.releaseNotes??``).length>0,i=e.hasCustomLinks??!1,a=n||i,o=t&&n||i,s=(e.supportUrl??``).length>0,c=(e.issueUrl??``).length>0,l=(e.debugInfo??``).length>0,u=e.hasCredits??!1,d=e.hasLegal??!1,f=e.hasAcknowledgements??!1;return{appIcon:(e.applicationIcon??``).length>0,appName:(e.applicationName??``).length>0,developerName:(e.developerName??``).length>0,version:(e.version??``).length>0,detailsGroup:t||n||o||r,whatsNewRow:r,detailsRow:n||o,websiteRow:t&&!a,supportGroup:s||c||l,supportRow:s,issueRow:c,troubleshootingRow:l,creditsLegalGroup:u||d||f,creditsRow:u,legalRow:d,acknowledgementsRow:f,commentsLabel:n,linksGroup:o,detailsWebsiteRow:t&&a}}function legalSectionVisible(e,t,n){let r=licenseText(t,n);return e.length>0||r!==null&&r.length>0}const d=[`blue`,`teal`,`green`,`yellow`,`orange`,`red`,`pink`,`purple`,`slate`],f={blue:`#3584e4`,teal:`#2190a4`,green:`#3a944a`,yellow:`#c88800`,orange:`#ed5b00`,red:`#e62d42`,pink:`#d56199`,purple:`#9141ac`,slate:`#6f8396`};function parseHex(e){let t=/^#([0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;let n=Number.parseInt(t[1],16);return[(n>>16&255)/255,(n>>8&255)/255,(n&255)/255]}function toHex(e,t,n){let channel=e=>Math.round(Math.min(1,Math.max(0,e))*255).toString(16).padStart(2,`0`);return`#${channel(e)}${channel(t)}${channel(n)}`}const toLinear=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4,fromLinear=e=>e<=.0031308?e*12.92:1.055*e**(1/2.4)-.055;function linearToOklab(e,t,n){let r=Math.cbrt(.4122214708*e+.5363325363*t+.0514459929*n),i=Math.cbrt(.2119034982*e+.6806995451*t+.1073969566*n),a=Math.cbrt(.0883024619*e+.2817188376*t+.6299787005*n);return[.2104542553*r+.793617785*i-.0040720468*a,1.9779984951*r-2.428592205*i+.4505937099*a,.0259040371*r+.7827717662*i-.808675766*a]}function oklabToLinear(e,t,n){let r=(e+.3963377774*t+.2158037573*n)**3,i=(e-.1055613458*t-.0638541728*n)**3,a=(e-.0894841775*t-1.291485548*n)**3;return[4.0767416621*r-3.3077115913*i+.2309699292*a,-1.2684380046*r+2.6097574011*i-.3413193965*a,-.0041960863*r-.7034186147*i+1.707614701*a]}function adwaitaStandaloneColor(e,t){let n=parseHex(e);if(!n)return e;let[r,i,a]=linearToOklab(toLinear(n[0]),toLinear(n[1]),toLinear(n[2])),[o,s,c]=oklabToLinear(t?Math.max(r,.85):Math.min(r,.5),i,a);return toHex(fromLinear(o),fromLinear(s),fromLinear(c))}function adwaitaAccentBgColor(e){return f[e]}function adwaitaAccentColor(e,t){return adwaitaStandaloneColor(f[e],t)}function deriveRowLabels(e){let t=e.title??``,n=e.subtitle??``;return{title:t,titleVisible:stringIsNotEmpty(t),subtitle:n,subtitleVisible:stringIsNotEmpty(n)}}var ActionRowState=class{constructor(){this._title=``,this._subtitle=``,this._activatableWidget=null,this._activatable=!1,this._widgetSensitive=!0}get state(){return{...deriveRowLabels({title:this._title,subtitle:this._subtitle}),activatable:this._activatable}}get title(){return this._title}setTitle(e){let t=e??``;return t===this._title?!1:(this._title=t,!0)}get subtitle(){return this._subtitle}setSubtitle(e){let t=e??``;return t===this._subtitle?!1:(this._subtitle=t,!0)}get activatableWidget(){return this._activatableWidget}setActivatableWidget(e,t=!0){return e===this._activatableWidget?!1:(this._activatableWidget=e,this._widgetSensitive=t,e!==null&&(this._activatable=t),!0)}setActivatableWidgetSensitive(e){if(this._activatableWidget===null)return!1;let t=!!e;return t===this._widgetSensitive?!1:(this._widgetSensitive=t,this.setActivatable(t))}get activatable(){return this._activatable}setActivatable(e){let t=!!e;return t===this._activatable?!1:(this._activatable=t,!0)}activate(){return this._activatableWidget}},SwitchRowState=class{constructor(){this._active=!1}get active(){return this._active}setActive(e){let t=!!e;return t===this._active?!1:(this._active=t,!0)}activate(){return this.setActive(!this._active)}},ButtonRowState=class{constructor(){this._title=``,this._startIconName=``,this._endIconName=``}get state(){return{title:this._title,titleVisible:stringIsNotEmpty(this._title),startIconName:this._startIconName,startIconVisible:stringIsNotEmpty(this._startIconName),endIconName:this._endIconName,endIconVisible:stringIsNotEmpty(this._endIconName),activatable:!0}}get title(){return this._title}setTitle(e){let t=e??``;return t===this._title?!1:(this._title=t,!0)}get startIconName(){return this._startIconName}setStartIconName(e){let t=e??``;return t===this._startIconName?!1:(this._startIconName=t,!0)}get endIconName(){return this._endIconName}setEndIconName(e){let t=e??``;return t===this._endIconName?!1:(this._endIconName=t,!0)}},WindowTitleState=class{constructor(){this._title=``,this._subtitle=``}get state(){return deriveRowLabels({title:this._title,subtitle:this._subtitle})}get title(){return this._title}setTitle(e){let t=e??``;return t===this._title?!1:(this._title=t,!0)}get subtitle(){return this._subtitle}setSubtitle(e){let t=e??``;return t===this._subtitle?!1:(this._subtitle=t,!0)}};const p=[{fg:`#cfe1f5`,start:`#83b6ec`,stop:`#337fdc`},{fg:`#caeaf2`,start:`#7ad9f1`,stop:`#0f9ac8`},{fg:`#cef8d8`,start:`#8de6b1`,stop:`#29ae74`},{fg:`#e6f9d7`,start:`#b5e98a`,stop:`#6ab85b`},{fg:`#f9f4e1`,start:`#f8e359`,stop:`#d29d09`},{fg:`#ffead1`,start:`#ffcb62`,stop:`#d68400`},{fg:`#ffe5c5`,start:`#ffa95a`,stop:`#ed5b00`},{fg:`#f8d2ce`,start:`#f78773`,stop:`#e62d42`},{fg:`#fac7de`,start:`#e973ab`,stop:`#e33b6a`},{fg:`#e7c2e8`,start:`#cb78d4`,stop:`#9945b5`},{fg:`#d5d2f5`,start:`#9e91e8`,stop:`#7a59ca`},{fg:`#f2eade`,start:`#e3cf9c`,stop:`#b08952`},{fg:`#e5d6ca`,start:`#be916d`,stop:`#785336`},{fg:`#d8d7d3`,start:`#c0bfbc`,stop:`#6e6d71`}];function*utf8Bytes(e){for(let t of e){let e=t.codePointAt(0)??0;e>=55296&&e<=57343&&(e=65533),e<128?yield e:e<2048?(yield 192|e>>6,yield 128|e&63):e<65536?(yield 224|e>>12,yield 128|e>>6&63,yield 128|e&63):(yield 240|e>>18,yield 128|e>>12&63,yield 128|e>>6&63,yield 128|e&63)}}function gStrHash(e){let t=5381;for(let n of utf8Bytes(e)){if(n===0)break;t=Math.imul(t,33)+(n>127?n-256:n)>>>0}return t>>>0}function avatarInitials(e){let t=gStrStrip((e??``).toUpperCase()).normalize(`NFC`);if(t.length===0)return``;let n=firstCodePoint(t),r=t.lastIndexOf(` `);return r<0?n:n+firstCodePoint(t.slice(r+1))}function firstCodePoint(e){let t=e.codePointAt(0);return t===void 0?``:String.fromCodePoint(t)}function avatarColorClass(e){return e?gStrHash(e)%14+1:null}function avatarColor(e){let t=avatarColorClass(e);return p[(t??1)-1]}function avatarMode(e){return e.hasCustomImage?`image`:e.showInitials&&e.text.length>0?`initials`:`icon`}function avatarMaxFontSize(e){return e/1.4142-Math.max(e*.4-5,0)}function avatarFontSize(e,t){let n=avatarMaxFontSize(e);return t.width>0?glibClamp(t.height*(n/t.width),0,n):n}const m=[`suggested-action`],ee={title:``,buttonLabel:``,revealed:!1,useMarkup:!0,buttonStyle:`default`};function isBannerButtonStyle(e){return e==="default"||e===`suggested`}function parseBannerButtonStyle(e){return isBannerButtonStyle(e)?e:ee.buttonStyle}function bannerButtonStyleClasses(e){return e===`suggested`?m:[]}function bannerButtonVisible(e){return typeof e==`string`&&e.length>0}function bannerButtonText(e){return stripMnemonic(e)}const te=/^(min|max)-(width|height)\s*:\s*(\d+(?:\.\d+)?)\s*(px|sp|pt)?$/i;function isLeaf(e){return e.op===void 0}function splitOn(e,t){let n=0;for(let r=e.length-1;r>=0;r--){let i=e[r];if(i===`)`)n++;else if(i===`(`)n--;else if(n===0){let n=r-t.length+1;if(n>0&&r+1<e.length&&/\s/.test(e[n-1])&&/\s/.test(e[r+1])&&e.slice(n,r+1).toLowerCase()===t)return{left:e.slice(0,n),right:e.slice(r+1)}}}return null}function splitTopLevel(e){for(let t of[`or`,`and`]){let n=splitOn(e,t);if(n)return{op:t,...n}}return null}function parseBreakpointCondition(e){let t=e.trim();if(!t)return null;let n=splitTopLevel(t);if(n){let e=parseBreakpointCondition(n.left),t=parseBreakpointCondition(n.right);return!e||!t?null:{op:n.op,left:e,right:t}}if(t.startsWith(`(`)&&t.endsWith(`)`))return parseBreakpointCondition(t.slice(1,-1));let r=te.exec(t);return r?{bound:r[1].toLowerCase(),dimension:r[2].toLowerCase(),value:Number.parseFloat(r[3])}:null}function evaluateBreakpointCondition(e,t){if(isLeaf(e)){let n=e.dimension===`width`?t.width:t.height;return e.bound===`max`?n<=e.value:n>=e.value}let n=evaluateBreakpointCondition(e.left,t);return e.op===`and`?n&&evaluateBreakpointCondition(e.right,t):n||evaluateBreakpointCondition(e.right,t)}var AdwBreakpoint=class{constructor(e,t,n=!1){this._applied=!1,this.condition=typeof e==`string`?parseBreakpointCondition(e):e??null,this._handlers=t,this._applied=n}get applied(){return this._applied}evaluate(e){let t=this.condition?evaluateBreakpointCondition(this.condition,e):!1;return t===this._applied?this._applied:(this._applied=t,t?this._handlers.onApply():this._handlers.onUnapply?.(),this._applied)}};const g=`image-text-button`;function buttonContentIconIsEmpty(e){return e.length===0}function buttonContentIconName(e){return buttonContentIconIsEmpty(e)?`image-missing`:e}function buttonContentLabelText(e,t){return t?stripMnemonic(e):e}const ne=[`flat`,`suggested-action`,`destructive-action`,`circular`,`pill`],re={flat:`flat`,suggested:`suggested-action`,"suggested-action":`suggested-action`,destructive:`destructive-action`,"destructive-action":`destructive-action`,circular:`circular`,pill:`pill`};function buttonStyleClass(e){return e?re[e]??null:null}function buttonStyleClasses(e){let t=new Set;for(let n of e){let e=buttonStyleClass(n);e&&t.add(e)}return ne.filter(e=>t.has(e))}const _=.35;function clamp(e,t,n){return e>n?n:e<t?t:e}function swipeSlope(e){let t=e===`touchpad`?.997:.998;return t/(1-t)/1e3}function swipeVelocityThreshold(e){return e===`touchpad`?.6:.3}function swipeClosestPointIndex(e,t){let n=0;for(let r=1;r<e.length;r++)Math.abs(e[r]-t)<Math.abs(e[n]-t)&&(n=r);return n}function swipeNextPointIndex(e,t){for(let n=0;n<e.length;n++)if(Math.abs(e[n]-t)<2**-52||e[n]>t)return n;return-1}function swipePreviousPointIndex(e,t){for(let n=e.length-1;n>=0;n--)if(Math.abs(e[n]-t)<2**-52||e[n]<t)return n;return-1}function swipeBounds(e,t,n){if(e.length===0)return{lower:0,upper:0};if(n)return{lower:e[0],upper:e[e.length-1]};let r=swipeClosestPointIndex(e,t),i,a;return Math.abs(e[r]-t)<.005?(i=r,a=r):(i=swipePreviousPointIndex(e,t),a=swipeNextPointIndex(e,t)),{lower:e[Math.max(i-1,0)],upper:e[Math.min(a+1,e.length-1)]}}function swipeEndProgress(e){let{points:t,progress:n,velocity:r,source:i}=e;if(e.cancelled===!0)return e.cancelProgress??n;if(t.length===0)return n;let{lower:a,upper:o}=swipeBounds(t,e.initialProgress,e.allowLongSwipes);if(Math.abs(r)<swipeVelocityThreshold(i))return clamp(t[swipeClosestPointIndex(t,n)],a,o);let s=swipeSlope(i),c;if(Math.abs(r)>2){let e=s/2/_,t=Math.abs(r)-2+e;c=_*t*t-_*e*e+s*2}else c=Math.abs(r)*s;return t[swipeProjectedPointIndex(t,clamp(c*Math.sign(r)+n,a,o),e.initialProgress,r)]}function swipeProjectedPointIndex(e,t,n,r){let i=swipeClosestPointIndex(e,n),a=swipePreviousPointIndex(e,t),o=swipeNextPointIndex(e,t);if((r>0?a:o)===i){let e=r>0?o:a;if(e>=0)return e}return swipeClosestPointIndex(e,t)}var SwipeTracker=class{constructor(e){this._options=e,this._history=[],this._initialProgress=0,this._progress=0,this._cancelled=!1}get progress(){return this._progress}get initialProgress(){return this._initialProgress}prepare(e){this._initialProgress=e,this._progress=e,this._cancelled=!1}record(e,t){this._trimHistory(t),this._history.push({delta:e,time:t})}advance(e,t){if(!(t>0))return this._progress;let{lower:n,upper:r}=swipeBounds(this._options.points(),this._initialProgress,this._options.allowLongSwipes());return this._progress=clamp(this._progress+e/t,n,r),this._progress}reset(){this._history.length=0,this._initialProgress=0,this._progress=0,this._cancelled=!1}cancel(){this._cancelled=!0}end(e,t=`touch`){this._trimHistory(e);let n=this._velocity(),r=swipeEndProgress({points:this._options.points(),initialProgress:this._initialProgress,progress:this._progress,velocity:n,allowLongSwipes:this._options.allowLongSwipes(),source:t,cancelled:this._cancelled,cancelProgress:this._options.cancelProgress?.()??this._initialProgress});return this.reset(),{velocity:n,to:r}}_trimHistory(e){let t=e-150,n=0;for(;n<this._history.length&&this._history[n].time<t;)n++;n>0&&this._history.splice(0,n)}_velocity(){if(this._history.length<2)return 0;let e=this._history[0].time,t=this._history[this._history.length-1].time;if(e===t)return 0;let n=0;for(let e=1;e<this._history.length;e++)n+=this._history[e].delta;let r=n/(t-e),{lower:i,upper:a}=swipeBounds(this._options.points(),this._initialProgress,this._options.allowLongSwipes());return this._progress<=i&&r<0||this._progress>=a&&r>0?0:r}};function approx(e,t){return Math.abs(e-t)<2**-52}function carouselSnapPoints(e){let t=0;return e.map(e=>{let n=t+e-1;return t+=e,n})}function carouselPageAllocation(e,t){let n=0;for(let r of t){let t=r.expand?e:glibClamp(r.natural,r.minimum??0,e);n=Math.max(n,t)}return{pageSize:n,leadingInset:(e-n)/2}}function carouselRange(e,t=0){let n=e.length>0?e[e.length-1]:0;return{lower:0,upper:Math.max(0,t+n)}}function carouselClampPosition(e,t,n=0){let r=carouselRange(t,n);return glibClamp(e,r.lower,r.upper)}function carouselClosestSnapPoint(e,t){return t.length===0?-1:swipeClosestPointIndex(t,e)}function carouselPageAtPosition(e,t){return carouselClosestSnapPoint(carouselClampPosition(e,t),t)}function cRound(e){return Math.sign(e)*Math.round(Math.abs(e))}function carouselNavigateTarget(e,t,n){if(t<=0)return null;let r=cRound(e);return n===`back`?r>0?r-1:null:r<t-1?r+1:null}function carouselWheelStep(e){if(e.source===`touchpad`)return 0;let t=e.source===`mouse`,n=0;return(e.orientation===`vertical`||t)&&(e.deltaY>0?n=1:e.deltaY<0&&(n=-1)),e.orientation===`horizontal`&&n===0&&(e.deltaX>0?n=1:e.deltaX<0&&(n=-1)),n}function carouselReorderShift(e){let{closestPoint:t,oldPoint:n,newPoint:r,size:i}=e;return approx(t,n)?r-n:(approx(n,t)||n>t)&&(approx(t,r)||t>r)?i:(approx(r,t)||r>t)&&(approx(t,n)||t>n)?-i:0}function nthPageDiagnostic(e,t){return`adw_carousel_get_nth_page: assertion 'n < adw_carousel_get_n_pages (self)' failed (n = ${e}, n_pages = ${t})`}function positionDiagnostic(e,t){return`${e}: assertion 'position >= -1' failed (position = ${t})`}function unknownPageDiagnostic(e){return`AdwCarousel: no page with id '${e}'`}function nonFiniteDiagnostic(e,t){return`AdwCarousel: ${e} must be a finite double (got ${t})`}var CarouselState=class{constructor(e={}){this._children=[],this._position=0,this._wheelLockedAt=null,this._settledPage=null,this._listeners=new Set,this._pageChangedListeners=new Set,this._diagnostics=[],this._orientation=e.orientation??`horizontal`,this._interactive=e.interactive??!0,this._allowScrollWheel=e.allowScrollWheel??!0,this._allowMouseDrag=e.allowMouseDrag??!0,this._allowLongSwipes=e.allowLongSwipes??!1,this._spacing=e.spacing??0,this._revealDuration=e.revealDuration??0,this._now=e.now??(()=>Date.now()),this._onScrollTo=e.onScrollTo,this._animateScroll=e.animateScroll??!1}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}onPageChanged(e){return this._pageChangedListeners.add(e),()=>{this._pageChangedListeners.delete(e)}}_emit(e,t){let n={position:this._position,nPages:this.nPages,page:this.pageAt(this._position),interactive:t,reason:e};for(let e of[...this._listeners])e(n)}get nPages(){let e=0;for(let t of this._children)t.removing||e++;return e}get ids(){return this._children.filter(e=>!e.removing).map(e=>e.id)}get position(){return this._position}get sizes(){return this._children.map(e=>e.size)}get snapPoints(){return carouselSnapPoints(this.sizes)}get range(){return carouselRange(this.snapPoints)}_visibleSnapPoints(){return this.snapPoints.filter((e,t)=>!this._children[t].removing)}pageAt(e){return carouselPageAtPosition(e,this._visibleSnapPoints())}indexOf(e){let t=0;for(let n of this._children)if(!n.removing){if(n.id===e)return t;t++}return-1}snapPointOf(e){let t=this._nthLink(e);return t<0?void 0:this.snapPoints[t]}_nthLink(e){let t=e;for(let e=0;e<this._children.length;e++)if(!this._children[e].removing&&t--===0)return e;return-1}_closestChildIndex(e,t,n){let r=this.snapPoints,i=[],a=[];this._children.forEach((e,o)=>{e.adding&&!t||e.removing&&!n||(i.push(o),a.push(r[o]))});let o=carouselClosestSnapPoint(e,a);return o<0?-1:i[o]}_updateShiftPositionFlag(e){let t=this._closestChildIndex(this._position,!1,!0);t<0||(this._children[e].shiftPosition=t>=e)}_updateShiftFlags(){this._children.forEach((e,t)=>{(e.adding||e.removing)&&this._updateShiftPositionFlag(t)})}setPosition(e,t=!1){if(!Number.isFinite(e))return this._diagnostics.push(nonFiniteDiagnostic(`position`,e)),!1;let n=carouselClampPosition(e,this.snapPoints),r=n!==this._position;return this._position=n,this._updateShiftFlags(),this._emit(`position`,t),r}scrollTo(e,t={}){let n=this.nPages;if(!Number.isInteger(e)||e<0||e>=n)return this._diagnostics.push(nthPageDiagnostic(e,n)),!1;let r=t.interactive??!1,i=t.animate??this._animateScroll,a=this.snapPointOf(e);return this._onScrollTo?.({index:e,position:a,interactive:r,animate:i}),i||(this.setPosition(a,r),this.settle()),!0}settle(){let e=this.pageAt(this._position);this._settledPage=e;for(let t of[...this._pageChangedListeners])t(e)}settleIfArrived(e=.01){let t=this.pageAt(this._position),n=this.snapPointOf(t);return n===void 0||Math.abs(this._position-n)>=e?(this._settledPage=null,!1):this._settledPage===t?!1:(this.settle(),!0)}navigate(e){if(!this._interactive)return!1;let t=carouselNavigateTarget(this._position,this.nPages,e);return t===null?!1:this.scrollTo(t,{interactive:!0})}handleWheel(e){if(!this._allowScrollWheel||this._wheelLockedAt!==null&&this._now()-this._wheelLockedAt<150||!this._interactive)return 0;let t=this.nPages;if(t===0)return 0;let n=carouselWheelStep({...e,orientation:this._orientation});if(n===0)return 0;let r=glibClamp(this.pageAt(this._position)+n,0,t-1);return this.scrollTo(r,{interactive:!0}),this._wheelLockedAt=this._now(),n}insertPage(e,t=-1){if(!Number.isInteger(t)||t<-1)return this._diagnostics.push(positionDiagnostic(`adw_carousel_insert`,t)),!1;let n={id:e,size:0,adding:!0,removing:!1,shiftPosition:!1},r=t>=0?this._nthLink(t):-1,i=r<0?this._children.length:r;return this._children.splice(i,0,n),this._updateShiftPositionFlag(i),this._emit(`n-pages`,!1),!0}removePage(e){let t=this._children.findIndex(t=>t.id===e&&!t.removing);if(t<0)return this._diagnostics.push(unknownPageDiagnostic(e)),!1;let n=this._children[t];return n.removing=!0,this._updateShiftPositionFlag(t),n.adding&&this._children.splice(t,1),this._emit(`n-pages`,!1),!0}reorderPage(e,t){if(!Number.isInteger(t)||t<-1)return this._diagnostics.push(positionDiagnostic(`adw_carousel_reorder`,t)),!1;let n=this._children.findIndex(t=>t.id===e);if(n<0)return this._diagnostics.push(unknownPageDiagnostic(e)),!1;if(t===n)return!1;let r=this._closestChildIndex(this._position,!0,!0),i=this.snapPoints,a=r<0?0:i[r],o=i[n],s=this.nPages,c=t<0||t>s?s:t;if(n===s-1&&c===s)return!1;let l;l=c===s?-1:c>n?this._nthLink(c+1):this._nthLink(c);let u;u=l>=0?c>n?i[l-1]:i[l]:i[i.length-1];let[d]=this._children.splice(n,1);l<0?this._children.push(d):this._children.splice(l>n?l-1:l,0,d);let f=carouselReorderShift({closestPoint:a,oldPoint:o,newPoint:u,size:d.size});return f===0?(this._emit(`geometry`,!1),!0):(this._position=carouselClampPosition(this._position+f,this.snapPoints),this._updateShiftFlags(),this._emit(`position`,!1),!0)}setPageSize(e,t){if(!Number.isFinite(t))return this._diagnostics.push(nonFiniteDiagnostic(`size of page '${e}'`,t)),!1;let n=this._children.findIndex(t=>t.id===e);if(n<0)return this._diagnostics.push(unknownPageDiagnostic(e)),!1;let r=this._children[n],i=t-r.size,a=r.shiftPosition&&i!==0;return r.size=t,r.removing&&t<=0?this._children.splice(n,1):r.adding&&t>=1&&(r.adding=!1),a?(this._position=carouselClampPosition(this._position+i,this.snapPoints),this._updateShiftFlags(),this._emit(`position`,!1),!0):(this._emit(`geometry`,!1),!0)}skipReveal(e){let t=this._children.find(t=>t.id===e);return!t||!t.adding&&!t.removing?!1:this.setPageSize(e,+!t.removing)}get orientation(){return this._orientation}setOrientation(e){return e===this._orientation?!1:(this._orientation=e,this._emit(`geometry`,!1),!0)}get interactive(){return this._interactive}setInteractive(e){let t=!!e;return t===this._interactive?!1:(this._interactive=t,!0)}get allowScrollWheel(){return this._allowScrollWheel}setAllowScrollWheel(e){let t=!!e;return t===this._allowScrollWheel?!1:(this._allowScrollWheel=t,!0)}get allowMouseDrag(){return this._allowMouseDrag}setAllowMouseDrag(e){let t=!!e;return t===this._allowMouseDrag?!1:(this._allowMouseDrag=t,!0)}get allowLongSwipes(){return this._allowLongSwipes}setAllowLongSwipes(e){let t=!!e;return t===this._allowLongSwipes?!1:(this._allowLongSwipes=t,!0)}get spacing(){return this._spacing}setSpacing(e){return!Number.isFinite(e)||e<0?(this._diagnostics.push(nonFiniteDiagnostic(`spacing`,e)),!1):e===this._spacing?!1:(this._spacing=e,this._emit(`geometry`,!1),!0)}get revealDuration(){return this._revealDuration}setRevealDuration(e){return!Number.isFinite(e)||e<0?(this._diagnostics.push(nonFiniteDiagnostic(`reveal-duration`,e)),!1):e===this._revealDuration?!1:(this._revealDuration=e,!0)}pageDistance(e){return e+this._spacing}get diagnostics(){return this._diagnostics}};function resolveCheckState(e,t){return t?`indeterminate`:e?`checked`:`unchecked`}var RadioGroupState=class{constructor(){this._selected=new Map,this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(e){for(let t of[...this._listeners])t(e)}selected(e){return this._selected.get(e)??null}select(e,t){let n=this._selected.get(e);return n===t?!1:(this._selected.set(e,t),this._emit({name:e,selected:t,deselected:n??null}),!0)}};function adwLerp(e,t,n){return e*(1-n)+t*n}function inverseLerp(e,t,n){return(n-e)/(t-e)}function easeOutCubic(e){let t=e-1;return t*t*t+1}function easeInOutSine(e){return-.5*(Math.cos(Math.PI*e)-1)}const v={maximumSize:600,tighteningThreshold:400};function clampThresholds(e){let t=Math.max(Math.min(e.tighteningThreshold,e.maximumSize),e.childMin),n=Math.max(t,e.maximumSize);return{lower:t,max:n,upper:t+3*(n-t)}}function childSizeFrom(e,t,n){let{lower:r,max:i,upper:a}=t;return e<0?Math.min(n,Math.ceil(i)):e<=r?e:e>=a?Math.ceil(i):Math.floor(adwLerp(r,i,easeOutCubic(inverseLerp(r,a,e))))}const y=[`small`,`medium`,`large`];function clampAllocate(e,t){let n=clampThresholds(t),r=Math.ceil(n.max),i=Math.ceil(n.lower),a=childSizeFrom(e,n,t.childNat);return{childSize:a,childMaximum:r,lowerThreshold:i,sizeClass:a>=r?`large`:a<=i?`small`:`medium`,offset:Math.trunc((e-a)/2)}}function normalizeClampSize(e,t){let n=typeof e==`string`?Number.parseFloat(e):e??NaN;return Number.isFinite(n)?Math.max(0,Math.trunc(n)):t}const ie={topBarStyle:`flat`,bottomBarStyle:`flat`,extendContentToTopEdge:!1,extendContentToBottomEdge:!1};function parseToolbarStyle(e){return e===`raised`||e===`raised-border`?e:ie.topBarStyle}function toolbarBarStyleClasses(e){switch(e){case`raised`:return[`raised`];case`raised-border`:return[`raised`,`border`];default:return[]}}const ae=[`undershoot-top`,`undershoot-bottom`],oe=[`raised`,`border`];function toolbarViewClasses(e){let t=[];return e.topBarStyle===`flat`&&!e.extendContentToTopEdge&&e.topBarHeight>0&&t.push(`undershoot-top`),e.bottomBarStyle===`flat`&&!e.extendContentToBottomEdge&&e.bottomBarHeight>0&&t.push(`undershoot-bottom`),{view:t,topBar:toolbarBarStyleClasses(e.topBarStyle),bottomBar:toolbarBarStyleClasses(e.bottomBarStyle)}}function spinnerGeometry(e,t){let n=Math.min(Math.floor(Math.min(e,t)/2),64/2),r=n*2;return{radius:n,diameter:r,lineWidth:r/8,centerX:Math.round(e/2),centerY:Math.round(t/2)}}function resolveSpinnerSize(e){let t=typeof e==`string`?Number.parseFloat(e):e??NaN;return Number.isFinite(t)?Math.max(t,16):16}const se=new Set([`normal`,`section`,`subtotal`,`total`]);function dataGridTracks(e){let t=e.some(e=>e.width!==void 0||e.flex!==void 0);return e.map((e,n)=>e.width===void 0?e.flex===void 0?!t&&n===0?{kind:`slack`}:{kind:`auto`}:{kind:`flex`,weight:e.flex}:{kind:`fixed`,css:e.width})}function dataGridTrackTemplate(e){return e.map(e=>{switch(e.kind){case`fixed`:return e.css;case`flex`:return`${e.weight}fr`;case`slack`:return`minmax(0px, 1fr)`;case`auto`:return`auto`}}).join(` `)}function dataGridColumnAlign(e){return e.align??(e.numeric?`end`:`start`)}function dataGridColumnClasses(e){let t=[`adw-data-grid-cell`,`align-${dataGridColumnAlign(e)}`];return e.numeric&&t.push(`numeric`),e.monospace&&t.push(`mono`),t}function dataGridCellText(e){return e==null?``:String(e)}function normalizeDataGridVariant(e){return typeof e==`string`&&se.has(e)?e:`normal`}function normalizeDataGridColumns(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&`key`in e).map(e=>({key:String(e.key),label:e.label===void 0?void 0:String(e.label),align:e.align,width:e.width===void 0?void 0:String(e.width),flex:typeof e.flex==`number`?e.flex:void 0,monospace:e.monospace===!0,numeric:e.numeric===!0})):[]}function dataGridRowInteractive(e,t,n){return e===`normal`&&t!==!1&&(t===!0||n)}var AdwAlertResponses=class{constructor(e=``,t=``){this._responses=[],this._defaultResponse=null,this._closeResponse=`close`,this._heading=e??``,this._body=t??``}get heading(){return this._heading}set heading(e){this._heading=e??``}get body(){return this._body}set body(e){this._body=e??``}addResponse(e,t,n={}){let r=this._responses.find(t=>t.id===e);if(r){r.label=t,n.appearance!==void 0&&(r.appearance=n.appearance),n.enabled!==void 0&&(r.enabled=n.enabled);return}this._responses.push({id:e,label:t,appearance:n.appearance??`default`,enabled:n.enabled??!0})}addResponses(...e){for(let t=0;t+1<e.length;t+=2)this.addResponse(e[t],e[t+1])}hasResponse(e){return this._responses.some(t=>t.id===e)}setResponseAppearance(e,t){let n=this._responses.find(t=>t.id===e);n&&(n.appearance=t)}getResponseAppearance(e){return this._responses.find(t=>t.id===e)?.appearance??`default`}setResponseEnabled(e,t){let n=this._responses.find(t=>t.id===e);n&&(n.enabled=t)}getResponseEnabled(e){return this._responses.find(t=>t.id===e)?.enabled??!0}get responses(){return this._responses}get defaultResponse(){return this._defaultResponse}set defaultResponse(e){this._defaultResponse=e}get closeResponse(){return this._closeResponse}set closeResponse(e){this._closeResponse=e||`close`}get usesActionSheet(){return this._responses.length>3}orderResponses(){let e=this._responses.find(e=>e.id===this._defaultResponse)??this._responses[0],t=this._responses.filter(t=>t!==e);return{ok:e,cancel:t[t.length-1],neutral:t.length>=2?t[0]:void 0}}resolveById(e){return e!=null&&this.hasResponse(e)?e:this._closeResponse}resolveLabel(e){return e==null?this._closeResponse:this.resolveById(this._responses.find(t=>t.label===e)?.id)}};function resolveBottomSheetClose(e,t){let n=!!t.open,r=!!t.canClose;switch(e){case`drag-handle`:return`ignored`;case`swipe`:return n&&r?`close`:`ignored`;case`dimming`:return n?r?`close`:`close-attempt`:`ignored`;case`close-button`:return r?n?`close`:`delegate`:`close-attempt`;case`escape`:return r&&n?`close`:`close-attempt`}}var BottomSheetPresentation=class{constructor(e={}){this._open=!1,this._canClose=!0,this._hasBeenOpen=!1,this._listeners=new Set,this._onClosing=e.onClosing,this._onClosed=e.onClosed}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(){for(let e of[...this._listeners])e(this._open)}get open(){return this._open}get canClose(){return this._canClose}get hasBeenOpen(){return this._hasBeenOpen}setCanClose(e){let t=!!e;return t===this._canClose?!1:(this._canClose=t,!0)}setOpen(e){let t=!!e;return this._open===t?(!this._hasBeenOpen&&!t&&(this._onClosing?.(),this._onClosed?.()),!1):(this._open=t,t&&(this._hasBeenOpen=!0),!t&&(this._onClosing?.(),this._open!==t)?!1:(this._emit(),!0))}requestClose(e){let t=resolveBottomSheetClose(e,this);return t===`close`&&this.setOpen(!1),t}finishClose(){return this._open?!1:(this._onClosed?.(),!0)}};const b=65535,ce=`Apply`;function entryTextLength(e){return[...e??``].length}function clampEntryText(e,t){let n=e??``;if(!Number.isFinite(t)||t<=0)return n;let r=``,i=0;for(let e of n){if(i>=t)break;r+=e,i++}return r}var EntryRowState=class{constructor(){this._text=``,this._maxLength=0,this._editing=!1,this._editable=!0,this._showApplyButton=!1,this._showIndicator=!1,this._textChanged=!1,this._activatesDefault=!1,this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_update(){let e=this.state;for(let t of[...this._listeners])t(e)}get state(){let e=entryTextLength(this._text),t=e===0&&!(this._editing&&this._editable)&&!this._textChanged;return{text:this._text,textLength:e,empty:t,editing:this._editing,editable:this._editable,textChanged:this._textChanged,editIconVisible:!this._textChanged&&(!this._editing||!this._editable),editIconSensitive:this._editable,indicatorVisible:this._editing&&this._showIndicator,applyButtonVisible:this._textChanged,emptyTarget:+!t}}get text(){return this._text}setText(e){let t=clampEntryText(e??``,this._maxLength);return t===this._text?!1:(this._text=t,this._latchAndUpdate(),!0)}_latchAndUpdate(){this._showApplyButton&&this._editing&&(this._textChanged=!0),this._update()}get textLength(){return entryTextLength(this._text)}get maxLength(){return this._maxLength}setMaxLength(e){let t=Number.isFinite(e)?Math.min(b,Math.max(0,Math.trunc(e))):0;if(t===this._maxLength)return!1;this._maxLength=t;let n=clampEntryText(this._text,t);return n!==this._text&&(this._text=n,this._latchAndUpdate()),!0}get editing(){return this._editing}setEditing(e){let t=!!e;return t===this._editing?!1:(this._editing=t,this._update(),!0)}get editable(){return this._editable}setEditable(e){let t=!!e;return t===this._editable?!1:(this._editable=t,this._update(),!0)}get showApplyButton(){return this._showApplyButton}setShowApplyButton(e){let t=!!e;return t===this._showApplyButton?!1:(this._showApplyButton=t,!t&&this._textChanged&&(this._textChanged=!1,this._update()),!0)}setShowIndicator(e){this._showIndicator=!!e,this._update()}get activatesDefault(){return this._activatesDefault}setActivatesDefault(e){let t=!!e;return t===this._activatesDefault?!1:(this._activatesDefault=t,!0)}get textChanged(){return this._textChanged}apply(){this._textChanged=!1,this._update()}activate(){return this._textChanged?(this.apply(),{signal:`apply`}):{signal:`entry-activated`,activateDefault:this._activatesDefault}}},PasswordEntryRowState=class{constructor(e){this._revealed=!1,this._capsLockOn=!1,this._listeners=new Set,this._entry=e}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(){let e=this.state;for(let t of[...this._listeners])t(e)}get state(){return{revealed:this._revealed,capsLockOn:this._capsLockOn,peekIconName:this._revealed?`view-conceal-symbolic`:`view-reveal-symbolic`,peekLabel:this._revealed?`Hide Password`:`Show Password`,indicatorIconName:`caps-lock-symbolic`,indicatorTooltip:`Caps Lock is on`}}get revealed(){return this._revealed}setRevealed(e){let t=!!e;return t===this._revealed?!1:(this._revealed=t,this._pushIndicator(),this._emit(),!0)}togglePeek(){return this.setRevealed(!this._revealed)}get capsLockOn(){return this._capsLockOn}setCapsLockOn(e){let t=!!e;return t===this._capsLockOn?!1:(this._capsLockOn=t,this._pushIndicator(),this._emit(),!0)}_pushIndicator(){this._entry.setShowIndicator(!this._revealed&&this._capsLockOn)}},AdwToast=class{constructor(e=``,t={}){this.title=e,this.timeout=t.timeout??5e3,this.buttonLabel=t.buttonLabel??``}get hasButton(){return this.buttonLabel.length>0}},AdwToastQueue=class{constructor(e){this._pending=[],this._current=null,this._timer=null,this._scheduler=e.scheduler,this._handlers={onShow:e.onShow,onHide:e.onHide}}get current(){return this._current}get showing(){return this._current!==null}get pending(){return this._pending.length}add(e){this._current===null?this._show(e):this._pending.push(e)}dismiss(){if(this._current===null)return;let e=this._current;this._clearTimer(),this._current=null,this._handlers.onHide(e);let t=this._pending.shift();t&&this._show(t)}clear(){if(this._pending.length=0,this._current===null)return;let e=this._current;this._clearTimer(),this._current=null,this._handlers.onHide(e)}_show(e){this._current=e,this._handlers.onShow(e),e.timeout>0&&(this._timer=this._scheduler.schedule(()=>{this._current===e&&this.dismiss()},e.timeout))}_clearTimer(){this._timer!==null&&(this._scheduler.cancel(this._timer),this._timer=null)}},ExpanderState=class{constructor(){this._expanded=!1,this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(){for(let e of[...this._listeners])e(this._expanded)}get expanded(){return this._expanded}setExpanded(e){let t=!!e;return t===this._expanded?!1:(this._expanded=t,this._emit(),!0)}toggle(){return this.setExpanded(!this._expanded)}expand(){return this.setExpanded(!0)}collapse(){return this.setExpanded(!1)}};function normalizeComboOptions(e){return Array.isArray(e)?e.map(e=>{if(typeof e==`string`)return{value:e,label:e};let t=e?.value===void 0?String(e?.label??``):String(e.value);return{value:t,label:e?.label===void 0?t:String(e.label)}}):[]}var ComboState=class{constructor(){this._options=[],this._selected=0,this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(e){let t={selected:this._selected,value:this.selectedValue,label:this.selectedLabel,interactive:e};for(let e of[...this._listeners])e(t)}_setIndex(e,t){return e===this._selected?!1:(this._selected=e,this._emit(t),!0)}get options(){return this._options}setOptions(e){this._options=Array.isArray(e)?e:[],this.hasIndex(this._selected)||(this._selected=this._options.length===0?-1:0),this._emit(!1)}get selectedIndex(){return this._selected}get presentsChooser(){return this._options.length>1}setSelectedIndex(e){return this._setIndex(Number.isFinite(e)?e:0,!1)}get selectedValue(){return this._options[this._selected]?.value??``}get selectedLabel(){return this._options[this._selected]?.label??``}setSelectedValue(e){let t=this._options.findIndex(t=>t.value===e);return t>=0?this.setSelectedIndex(t):!1}hasIndex(e){return Number.isFinite(e)&&e>=0&&e<this._options.length}select(e){return!this.hasIndex(e)||e===this._selected?!1:this._setIndex(e,!0)}get count(){return this._options.length}},SpinState=class{constructor(){this._value=0,this._min=0,this._max=100,this._step=1,this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(e){let t={value:this._value,interactive:e};for(let e of[...this._listeners])e(t)}_clamp(e){return Math.min(this._max,Math.max(this._min,e))}_bump(e){let t=this._clamp(this._value+e);return t===this._value?!1:(this._value=t,this._emit(!0),!0)}_reclamp(){let e=this._clamp(this._value);return e===this._value?!1:(this._value=e,this._emit(!1),!0)}get value(){return this._value}get min(){return this._min}get max(){return this._max}get step(){return this._step}setValue(e){let t=this._clamp(Number.isFinite(e)?e:0);return t===this._value?!1:(this._value=t,this._emit(!1),!0)}setMin(e){return this._min=Number.isFinite(e)?e:0,this._reclamp()}setMax(e){return this._max=Number.isFinite(e)?e:0,this._reclamp()}setStep(e){this._step=Number.isFinite(e)&&e>0?e:1}increment(){return this._bump(this._step)}decrement(){return this._bump(-this._step)}},ToggleGroupState=class{constructor(){this._labels=[],this._selected=0,this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(){let e={selected:this._selected,value:this.selectedValue};for(let t of[...this._listeners])t(e)}get labels(){return this._labels}setLabels(e){this._labels=Array.isArray(e)?e:[],this._selected>=this._labels.length&&(this._selected=0)}get selected(){return this._selected}setSelected(e){let t=Number.isFinite(e)?e:0;return t===this._selected||t<0||t>=this._labels.length?!1:(this._selected=t,this._emit(),!0)}get selectedValue(){return this._labels[this._selected]??``}get count(){return this._labels.length}};function resolvePageTitle(e,t){return e??t}const le=/^[A-Za-z0-9_-]+$/;function normalizeIconName(e){let t=(e??``).replace(/-symbolic$/,``);return le.test(t)?t:``}function nameNotFoundDiagnostic(e){return`Child name '${e}' not found in AdwViewStack`}function duplicateNameDiagnostic(e){return`While adding page: duplicate child name in AdwViewStack: ${e}`}var ViewStackState=class{constructor(){this._pages=[],this._visibleIndex=-1,this._listeners=new Set,this._diagnostics=[],this._pagesView=null}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(e){let t=this._pageAt(this._visibleIndex),n={index:this._visibleIndex,name:t?.name??``,title:t?.title??``,page:t,interactive:e};for(let e of[...this._listeners])e(n)}_pageAt(e){return e>=0&&e<this._pages.length?this._pages[e]:void 0}_firstVisibleIndex(){return this._pages.findIndex(e=>e.visible)}_record(e){return{name:e.name,title:resolvePageTitle(e.title,e.name),icon:normalizeIconName(e.icon),content:e.content,visible:e.visible??!0,badgeNumber:Number.isFinite(e.badgeNumber)?Math.trunc(e.badgeNumber):0,needsAttention:e.needsAttention===!0,useUnderline:e.useUnderline===!0}}get pages(){return this._pagesView??=Object.freeze(this._pages.slice()),this._pagesView}get count(){return this._pages.length}indexOfName(e){return this._pages.findIndex(t=>t.name===e)}isSelected(e){return!Number.isInteger(e)||e<0||e>=this._pages.length?!1:e===this._visibleIndex}addPage(e){return this._insertRecord(this._record(e),this._pages.length)}insertPage(e,t){return!Number.isInteger(t)||t<0||t>this._pages.length?null:this._insertRecord(this._record(e),t)}_insertRecord(e,t){return this.indexOfName(e.name)>=0&&this._diagnostics.push(duplicateNameDiagnostic(e.name)),this._pages.splice(t,0,e),this._pagesView=null,this._visibleIndex<0?(e.visible&&(this._visibleIndex=t,this._emit(!1)),e):(t<=this._visibleIndex&&(this._visibleIndex+=1),e)}movePage(e,t){if(!Number.isInteger(e)||!Number.isInteger(t)||e<0||e>=this._pages.length||t<0||t>=this._pages.length||e===t)return!1;let[n]=this._pages.splice(e,1);if(this._pages.splice(t,0,n),this._pagesView=null,this._visibleIndex===e)this._visibleIndex=t;else{let n=this._visibleIndex;n>e&&--n,n>=t&&(n+=1),this._visibleIndex=n}return!0}removePage(e){let t=this.indexOfName(e);return t<0?!1:(this._pages.splice(t,1),this._pagesView=null,t===this._visibleIndex?this._visibleIndex=-1:t<this._visibleIndex&&--this._visibleIndex,!0)}get visibleIndex(){return this._visibleIndex}setVisibleIndex(e,t=!0){return!Number.isInteger(e)||e<0||e>=this._pages.length||e===this._visibleIndex||!this._pages[e].visible?!1:(this._visibleIndex=e,this._emit(t),!0)}get visibleName(){return this._pageAt(this._visibleIndex)?.name??``}setVisibleName(e,t=!0){if(e==null)return!1;let n=this.indexOfName(e);return n<0?(this._diagnostics.push(nameNotFoundDiagnostic(e)),!1):this.setVisibleIndex(n,t)}get visiblePage(){return this._pageAt(this._visibleIndex)}get visibleTitle(){return this._pageAt(this._visibleIndex)?.title??``}setPageVisible(e,t){let n=this.indexOfName(e);if(n<0)return this._diagnostics.push(nameNotFoundDiagnostic(e)),!1;let r=this._pages[n],i=!!t;return r.visible===i?!1:(r.visible=i,this._visibleIndex<0&&i?(this._visibleIndex=n,this._emit(!1),!0):this._visibleIndex===n&&!i?(this._visibleIndex=this._firstVisibleIndex(),this._emit(!1),!0):!1)}get duplicateNames(){let e=new Set,t=[];for(let n of this._pages)e.has(n.name)?t.includes(n.name)||t.push(n.name):e.add(n.name);return t}get diagnostics(){return this._diagnostics}};const ue=`Back`;function describeNavigationDiagnostic(e){switch(e.code){case`duplicate-tag`:return`Duplicate page tag in AdwNavigationView: ${e.tag}`;case`already-in-stack`:return e.tag===void 0?`Page '${e.title}' is already in navigation stack`:`Page with the tag '${e.tag}' is already in navigation stack`;case`tag-not-found`:return`No page with the tag '${e.tag}' found in AdwNavigationView`;case`not-in-stack`:return`Page '${e.title}' is not in the navigation stack`}}var NavigationViewState=class{constructor(e={}){this._registry=new Map,this._tags=new Map,this._stack=[],this._listeners=new Set,this._pendingRemoval=null,this._animateTransitions=e.animateTransitions??!0,this._popOnEscape=e.popOnEscape??!0,this._onDiagnostic=e.onDiagnostic??null}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}get stack(){return[...this._stack]}get depth(){return this._stack.length}get pages(){return[...this._registry.keys()]}get visiblePage(){return this._stack.length===0?null:this._stack[this._stack.length-1]}get visiblePageTag(){let e=this.visiblePage;return e===null?null:this.tagOf(e)}get animateTransitions(){return this._animateTransitions}get popOnEscape(){return this._popOnEscape}setAnimateTransitions(e){let t=!!e;return t===this._animateTransitions?!1:(this._animateTransitions=t,!0)}setPopOnEscape(e){let t=!!e;return t===this._popOnEscape?!1:(this._popOnEscape=t,!0)}isRegistered(e){return this._registry.has(e)}isInStack(e){return this._stack.includes(e)}isRemoveOnPop(e){return this._registry.get(e)?.removeOnPop===!0}tagOf(e){return this._registry.get(e)?.tag??null}titleOf(e){return this._registry.get(e)?.title??``}canPopOf(e){return this._registry.get(e)?.canPop??!0}findPage(e){return this._tags.get(e)??null}getPreviousPage(e){let t=this._stack.indexOf(e);return t<=0?null:this._stack[t-1]}add(e,t={}){let n=this._registry.get(e);return n===void 0?this._addPage(e,t,!0):n.removeOnPop&&this._stack.includes(e)?(n.removeOnPop=!1,!0):(n.tag!==null&&this._diagnose({code:`duplicate-tag`,tag:n.tag}),!1)}remove(e){let t=this._registry.get(e);return t===void 0?!1:(this._pendingRemoval===e&&(this._pendingRemoval=null),this._stack.includes(e)?(t.removeOnPop=!0,!0):(this._unregister(e),!0))}setTag(e,t){let n=this._registry.get(e);if(n===void 0)return!1;let r=t??null;return r===n.tag?!1:r!==null&&this._tags.has(r)?(this._diagnose({code:`duplicate-tag`,tag:r}),!1):(n.tag!==null&&this._tags.delete(n.tag),n.tag=r,r!==null&&this._tags.set(r,e),!0)}setTitle(e,t){if(typeof t!=`string`)return!1;let n=this._registry.get(e);return n===void 0||n.title===t?!1:(n.title=t,!0)}setCanPop(e,t){let n=this._registry.get(e);if(n===void 0)return!1;let r=!!t;return r===n.canPop?!1:(n.canPop=r,!0)}push(e,t={}){return this._maybeAddPage(e,t)?this._pushToStack(e,`push`,this._animateTransitions,!1):!1}pushByTag(e){let t=this.findPage(e);return t===null?(this._diagnose({code:`tag-not-found`,tag:e}),!1):this._pushToStack(t,`push`,this._animateTransitions,!0)}pop(){let e=this.visiblePage;if(e===null)return!1;let t=this.getPreviousPage(e);return t===null?!1:(this._popFromStack(t,this._animateTransitions),!0)}popToPage(e){return e===this.visiblePage?!1:this._stack.includes(e)?(this._popFromStack(e,this._animateTransitions),!0):(this._diagnose({code:`not-in-stack`,title:this.titleOf(e)}),!1)}popToTag(e){let t=this.findPage(e);return t===null?(this._diagnose({code:`tag-not-found`,tag:e}),!1):this.popToPage(t)}replace(e,t){let n=this.visiblePage,r=n,i=n!==null,a=!1,o=[],s=new Set;for(let t of e)t!=null&&s.add(t);for(let e=this._stack.length-1;e>=0;e--){let t=this._stack[e],n=this._registry.get(t);n===void 0||!n.removeOnPop||s.has(t)||(t===r&&(a=n.tag!==null,r=null),this._unregister(t)&&o.push(t))}this._stack.length=0;let c=new Set;for(let n of e)if(n!=null){if(c.has(n)){this._diagnose({code:`already-in-stack`,title:this.titleOf(n)});continue}this._maybeAddPage(n,t?.(n)??{})&&(c.add(n),this._stack.push(n))}let l=this.visiblePage,u;u=l===null?r===null?{animate:!1,tagNotify:i&&a,removeAfterTransition:null}:this._beginSwitch(r,null,!0,!1,o):r===l?{animate:!1,tagNotify:!1,removeAfterTransition:null}:this._beginSwitch(r,l,!0,!1,o),this._emitChange(`replace`,n,!0,[],o,u)}replaceWithTags(e){let t=e.map(e=>{let t=this.findPage(e);return t===null&&this._diagnose({code:`tag-not-found`,tag:e}),t});this.replace(t)}finishTransition(){let e=this._resolvePendingRemoval();return e===null?[]:[e]}canGoBack(){let e=this.visiblePage;return e===null||!this.canPopOf(e)?!1:this.getPreviousPage(e)!==null}backButtonTooltip(e=ue){if(!this.canGoBack())return null;let t=this.getPreviousPage(this.visiblePage);if(t===null)return null;let n=this.titleOf(t);return n.length>0?n:e}popFromShortcut(){let e=this.visiblePage;return e===null?`propagate`:this.canPopOf(e)?this.pop()?`stop`:`propagate`:`stop`}popFromEscape(){return this._popOnEscape?this.popFromShortcut():`propagate`}_diagnose(e){this._onDiagnostic?.(e)}_emit(e){for(let t of[...this._listeners])t(e)}_emitChange(e,t,n,r,i,a){let o=this.visiblePage;this._emit({stack:[...this._stack],visiblePage:o,visiblePageTag:o===null?null:this.tagOf(o),previousVisiblePage:t,reason:e,popped:[...r],removed:[...i],removeAfterTransition:a.removeAfterTransition,animate:a.animate,pop:n,tagNotify:a.tagNotify})}_addPage(e,t,n){let r=t.tag??null;return r!==null&&this._tags.has(r)?(this._diagnose({code:`duplicate-tag`,tag:r}),!1):(this._registry.set(e,{tag:r,title:t.title??``,canPop:t.canPop===void 0?!0:!!t.canPop,removeOnPop:!1}),r!==null&&this._tags.set(r,e),n&&this._stack.length===0&&this._pushToStack(e,`add`,!1,!1),!0)}_maybeAddPage(e,t){if(this._registry.has(e))return!0;let n=t.tag??null;if(n!==null&&this._tags.has(n))return this._diagnose({code:`duplicate-tag`,tag:n}),!1;if(!this._addPage(e,t,!1))return!1;let r=this._registry.get(e);return r!==void 0&&(r.removeOnPop=!0),!0}_pushToStack(e,t,n,r){if(this._stack.includes(e))return this._diagnose(r?{code:`already-in-stack`,tag:this.tagOf(e)}:{code:`already-in-stack`,title:this.titleOf(e)}),!1;let i=this.visiblePage,a=[];this._stack.push(e);let o=this._beginSwitch(i,e,!1,n,a);return this._emitChange(t,i,!1,[],a,o),!0}_popFromStack(e,t){let n=this.visiblePage;if(e===n)return;let r=this._stack.indexOf(e),i=this._stack.slice(r+1).reverse();this._stack.length=r+1;let a=[],o=this._beginSwitch(n,e,!0,t,a);for(let e of i)e!==n&&this._registry.get(e)?.removeOnPop===!0&&this._unregister(e)&&a.push(e);this._emitChange(`pop`,n,!0,i,a,o)}_beginSwitch(e,t,n,r,i){if(this._pendingRemoval!==null&&this._pendingRemoval!==e){let e=this._resolvePendingRemoval();e!==null&&i.push(e)}let a=null;return n&&e!==null&&this._registry.get(e)?.removeOnPop===!0&&!this._stack.includes(e)&&(a=e,this._pendingRemoval=e),{animate:r&&e!==null,tagNotify:e!==null&&this.tagOf(e)!==null||t!==null&&this.tagOf(t)!==null,removeAfterTransition:a}}_resolvePendingRemoval(){let e=this._pendingRemoval;if(e===null)return null;if(this._pendingRemoval=null,this._stack.includes(e)){let t=this._registry.get(e);return t!==void 0&&(t.removeOnPop=!0),null}return this._unregister(e)?e:null}_unregister(e){let t=this._registry.get(e);return t===void 0?!1:(t.tag!==null&&this._tags.get(t.tag)===e&&this._tags.delete(t.tag),this._registry.delete(e),!0)}};function clampSidebarSelection(e,t){return!Number.isInteger(e)||e<0||e>=t?-1:e}function adjustSidebarSelection(e,t,n,r,i,a){if(t===0&&n>0)return clampSidebarSelection(0,n);let o=e>>>0,s=r>>>0;return s<=o&&s+i>o?-1:s<=o?clampSidebarSelection(o+a-i>>>0,n):e}function flattenSidebarItems(e,t){let n=[],r=[],i=0;return e.forEach((e,a)=>{r.push(i),e.items.forEach((e,r)=>{let o=i+r;t&&!t(e,o)||n.push({index:o,sectionIndex:a,sectionItemIndex:r,item:e,titleVisible:stringIsNotEmpty(e.title),subtitleVisible:stringIsNotEmpty(e.subtitle),iconVisible:stringIsNotEmpty(e.iconName)})}),i+=e.items.length}),{items:n,sectionFirstIndex:r}}function deriveSidebarHeaders(e,t){let n=[],r=null;for(let i of t){if(r===i.sectionIndex)continue;let t=r===null;r=i.sectionIndex;let a=e[i.sectionIndex]?.title??``;t&&a.length===0||n.push({sectionIndex:i.sectionIndex,kind:a.length>0?`title`:`separator`,title:a,first:t})}return n}var SidebarState=class{constructor(){this._mode=`sidebar`,this._sections=[],this._filter=null,this._selected=-1,this._items=[],this._sectionFirstIndex=[],this._visibleItems=[],this._headers=[],this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(e,t){let n={selected:this._selected,previous:e,item:this.selectedItem,interactive:t};for(let e of[...this._listeners])e(n)}_applySelected(e,t){if(e===this._selected)return!1;let n=this._selected;return this._selected=e,this._emit(n,t),!0}_invalidate(){let e=flattenSidebarItems(this._sections),t=this._filter;this._items=e.items,this._sectionFirstIndex=e.sectionFirstIndex,this._visibleItems=t?this._items.filter(e=>t(e.item,e.index)):this._items,this._headers=deriveSidebarHeaders(this._sections,this._visibleItems)}get mode(){return this._mode}setMode(e){return e===this._mode?!1:(this._mode=e,!0)}get selectionVisible(){return this._mode===`sidebar`}get sections(){return this._sections}setSections(e){let t=this.count;this._sections=[...e],this._invalidate();let n=adjustSidebarSelection(adjustSidebarSelection(this._selected,t,0,0,t,0),0,this.count,0,0,this.count);this._applySelected(n,!1)}insertSection(e,t){let n=this.count,r=this._sections.length,i=Number.isInteger(t)&&t>=0&&t<r?t:r;this._sections.splice(i,0,e),this._invalidate();let a=this._sectionFirstIndex[i]??0,o=adjustSidebarSelection(this._selected,n,this.count,a,0,e.items.length);return this._applySelected(o,!1),i}removeSectionAt(e){let t=this.sectionAt(e);if(!t)return!1;let n=this.count,r=this._sectionFirstIndex[e]??0,i=t.items.length;return this._sections.splice(e,1),this._invalidate(),this._applySelected(adjustSidebarSelection(this._selected,n,this.count,r,i,0),!1),!0}removeAllSections(){let e=this.count;this._sections=[],this._invalidate(),this._applySelected(adjustSidebarSelection(this._selected,e,0,0,e,0),!1)}refresh(){this._invalidate()}sectionAt(e){if(!(!Number.isInteger(e)||e<0))return this._sections[e]}sectionFirstIndex(e){return this._sectionFirstIndex[e]??0}get count(){return this._items.length}get items(){return this._items}itemAt(e){if(!(!Number.isInteger(e)||e<0))return this._items[e]?.item}get filter(){return this._filter}setFilter(e){e!==this._filter&&(this._filter=e,this._invalidate())}get visibleItems(){return this._visibleItems}get headers(){return this._headers}get isEmpty(){return this._visibleItems.length===0}get selected(){return this._selected}get selectedItem(){return this.itemAt(this._selected)}setSelected(e){return this._applySelected(clampSidebarSelection(e,this.count),!1)}activate(e){let t=this._visibleItems.find(t=>t.index===e);return!t||t.item.visible===!1||t.item.enabled===!1?{index:e,activated:!1,selectionChanged:!1}:{index:e,activated:!0,selectionChanged:this._applySelected(clampSidebarSelection(e,this.count),!0)}}};const de=1200,fe=Math.PI*.35,x=Math.PI*.015,S=Math.PI*.9,C=Math.PI*.9,w=Math.PI*.7,T=Math.PI*1.1,E=Math.PI*1.35,D=C+T+E-w;53*Math.PI*2/D;const O=T-w/2;function normalizeSpinnerAngle(e){let t=e;for(;t<0;)t+=Math.PI*2;for(;t>Math.PI*2;)t-=Math.PI*2;return t}function spinnerArcStart(e){let t=e%D,n=t>T?1:easeInOutSine(t/T);return adwLerp(x,S,n)-t*S/D}function spinnerArcEnd(e){let t=e%D,n=T-w,r;return r=t<n?0:t>D-C?1:easeInOutSine((t-n)/E),adwLerp(0,S-x,r)-t*S/D}function spinnerArc(e){let t=e,n=normalizeSpinnerAngle(t+spinnerArcStart(t)+fe),r=normalizeSpinnerAngle(t+spinnerArcEnd(t)+fe),i=n-r;for(;i<=0;)i+=Math.PI*2;return{start:n,end:r,length:i}}function spinnerProgressAt(e){let t=de*53;return(e%t+t)%t/de*Math.PI*2}const pe={shift:`shift`,shft:`shift`,control:`control`,ctrl:`control`,ctl:`control`,alt:`alt`,mod1:`alt`,meta:`meta`,super:`super`,hyper:`hyper`,primary:`primary`},me=[`hyper`,`super`,`control`,`alt`,`shift`,`meta`],k={hyper:{default:`Hyper`,apple:`Hyper`},super:{default:`Super`,apple:`Super`},control:{default:`Ctrl`,apple:`⌃`},alt:{default:`Alt`,apple:`⌥`},shift:{default:`Shift`,apple:`⇧`},meta:{default:`Meta`,apple:`⌘`}},A={Shift:`shift`,Control:`control`,Alt:`alt`,Meta:`meta`,Super:`super`,Hyper:`hyper`},he={exclam:`!`,quotedbl:`"`,numbersign:`#`,dollar:`$`,percent:`%`,ampersand:`&`,apostrophe:`'`,parenleft:`(`,parenright:`)`,asterisk:`*`,plus:`+`,comma:`,`,minus:`-`,period:`.`,slash:`/`,colon:`:`,semicolon:`;`,less:`<`,equal:`=`,greater:`>`,question:`?`,at:`@`,bracketleft:`[`,backslash:`\\`,bracketright:`]`,asciicircum:`^`,underscore:`_`,grave:"`",braceleft:`{`,bar:`|`,braceright:`}`,asciitilde:`~`},ge={Left:{default:`←`},Up:{default:`↑`},Right:{default:`→`},Down:{default:`↓`},space:{default:`␣`},Return:{default:`⏎`},Page_Up:{default:`Page_Up`},Page_Down:{default:`Page_Down`},Escape:{apple:`⎋`},Tab:{apple:`⇥`},BackSpace:{apple:`⌫`},Delete:{apple:`⌦`}};function parseAccelerator(e,t=`default`){let n=new Set,r=e;for(;r.startsWith(`<`);){let e=r.indexOf(`>`);if(e===-1)return null;let i=r.slice(1,e).toLowerCase();if(r=r.slice(e+1),i===`release`)continue;let a=pe[i];if(!a)return null;n.add(a===`primary`?t===`apple`?`meta`:`control`:a)}return r.length===0?null:{modifiers:n,key:r}}function keycapForKey(e,t){let n=/^([A-Za-z]+)_([LR])$/.exec(e);if(n&&A[n[1]]){let e=A[n[1]];return{label:k[e][t],sideMarker:n[2]}}let r=ge[e];if(r){let e=t===`apple`?r.apple??r.default:r.default;if(e)return{label:e}}let i=/^KP_(.+)$/.exec(e);if(i){let e=printableFor(i[1]);if(e)return{label:`KP ${e.toUpperCase()}`}}let a=printableFor(e);return a?{label:a===`\\`?`Backslash`:a.toUpperCase()}:{label:e.length===1?e.toUpperCase():e}}function printableFor(e){if(e.length===1){let t=e.codePointAt(0)??0;return t>32&&t<127?e:null}return he[e]??null}function shortcutKeycaps(e,t=`default`){let n=parseAccelerator(e,t);if(!n)return null;let r=[];for(let e of me)n.modifiers.has(e)&&r.push({label:k[e][t]});return r.push(keycapForKey(n.key,t)),r}function accessibleFor(e){return e.map(e=>e.sideMarker?`${e.label} ${e.sideMarker}`:e.label).join(`+`)}function parseShortcutLabel(e,t={}){let{disabledText:n=``,direction:r=`ltr`,platform:i=`default`}=t;if(e.length===0)return{nodes:[{kind:`disabled`,text:n}],accessibleLabel:n,error:null};let a=[],o=``,s=null,combination=e=>{for(let t of e.split(`&`)){let e=shortcutKeycaps(t,i);if(!e)return s=t,!1;a.push({kind:`keys`,keys:e}),o+=accessibleFor(e)}return!0},sequence=e=>{let t=r===`rtl`?`←`:`→`,n=e.split(`+`);for(let[e,r]of n.entries())if(e>0&&(a.push({kind:`separator`,text:t}),o+=t),!combination(r))return!1;return!0},range=e=>{let t=e.indexOf(`...`);return t===-1?sequence(e):sequence(e.slice(0,t))?(a.push({kind:`separator`,text:`⋯`}),o+=`…`,sequence(e.slice(t+3))):!1};for(let[t,n]of e.split(` `).entries())if(t>0&&(a.push({kind:`separator`,text:`/`}),o+=` `),!range(n))break;return{nodes:a,accessibleLabel:o,error:s}}const _e=[`px`,`pt`,`sp`];function adwLengthToPx(e,t,n=96){switch(e){case`pt`:return t*n/72;case`sp`:return t*n/96;default:return t}}function normalizeLengthUnit(e,t){return _e.includes(e)?e:t}function isSidebarAtVisualStart(e,t=`ltr`){return e===`start`==(t!==`rtl`)}function fractionOf(e){return e.sidebarWidthFraction??.25}function resolveSidebarBounds(e,t=0,n={}){let r=e.sidebarWidthUnit??`sp`,i=e.dpi??96,a=n.ceil?Math.ceil:Math.trunc,o=adwLengthToPx(r,e.minSidebarWidth??180,i),s=adwLengthToPx(r,e.maxSidebarWidth??280,i),c=a(Math.max(t,o));return{min:c,max:a(Math.max(c,s))}}function resolveOverlaySidebarWidth(e){let t=resolveSidebarBounds(e,e.sidebarChildMin??0,{ceil:!0});if(e.collapsed)return glibClamp(e.totalWidth,t.min,t.max);let n=glibClamp(Math.trunc(e.totalWidth*fractionOf(e)),t.min,t.max);return Math.min(n,e.totalWidth-(e.contentMin??0))}function layoutOverlaySplitView(e){let{totalWidth:t,showProgress:n,collapsed:r}=e,i=e.sidebarWidth,a=isSidebarAtVisualStart(e.sidebarPosition??`start`,e.direction??`ltr`),o=i,s=Math.trunc(i*n),c=s>i,l={shieldVisible:r&&n>0,sidebarPainted:n>0,shadowProgress:1-Math.min(n,+!!r),shadowSide:a?`left`:`right`};return r?(c&&(o=s),{sidebar:{x:a?c?0:s-i:t-s,width:o},content:{x:0,width:t},...l}):(c&&(o=s,s=i),a?{sidebar:{x:s-i,width:o},content:{x:s,width:t-s},...l}:{sidebar:{x:t-(c?o:s),width:o},content:{x:0,width:t-s},...l})}function tagsConflict(e,t){return e==null||t==null?!1:e===t}function resolveNavigationStack(e){let{hasSidebar:t,hasContent:n,showContent:r}=e,i=e.sidebarPosition===`end`;if(e.changingPage&&t&&n)return r?i?{stack:[`content`],transition:`pop`,page:`sidebar`}:{stack:[`sidebar`,`content`],transition:`push`,page:`content`}:i?{stack:[`content`,`sidebar`],transition:`push`,page:`sidebar`}:{stack:[`sidebar`],transition:`pop`,page:`content`};let a=[];return i?(n&&a.push(`content`),t&&(!r||!n)&&a.push(`sidebar`)):(t&&a.push(`sidebar`),n&&(r||!t)&&a.push(`content`)),{stack:a,transition:`replace`,page:null}}function resolveNavigationAction(e){if(e.action===`pop`)return e.showContent&&e.hasSidebar&&e.hasContent?{kind:`set-show-content`,showContent:!1}:{kind:`delegate`};let{tag:t}=e;return e.contentTag!==null&&e.contentTag!==void 0&&t===e.contentTag?e.showContent&&e.collapsed?{kind:`already-in-stack`,tag:t}:{kind:`set-show-content`,showContent:!0}:e.sidebarTag!==null&&e.sidebarTag!==void 0&&t===e.sidebarTag?{kind:`already-in-stack`,tag:t}:{kind:`delegate`}}const j={alreadyInStack:e=>`Page with the tag '${e}' is already in the navigation stack`,notFound:e=>`No page with the tag '${e}' found in AdwNavigationSplitView`,sidebarCollision:e=>`Trying to add sidebar with the tag '${e}' to AdwNavigationSplitView, but content already has the same tag`,contentCollision:e=>`Trying to add content with the tag '${e}' to AdwNavigationSplitView, but sidebar already has the same tag`,sidebarTagCollision:e=>`Trying to set the sidebar's tag to '${e}', but the content already has the same tag`,contentTagCollision:e=>`Trying to set the content's tag to '${e}', but the sidebar already has the same tag`};var NavigationSplitViewState=class{constructor(e={}){this._sidebar=null,this._content=null,this._sidebarTag=null,this._contentTag=null,this._listeners=new Set,this._sidebarPosition=e.sidebarPosition??`start`,this._collapsed=e.collapsed??!1,this._showContent=e.showContent??!1,this._handlers={onCritical:e.onCritical,onDelegate:e.onDelegate}}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(e,t,n=!1){let r={property:e,interactive:n,plan:t};for(let e of[...this._listeners])e(r)}_critical(e){this._handlers.onCritical?.(e)}_plan(e=!1){return resolveNavigationStack({hasSidebar:this._sidebar!==null,hasContent:this._content!==null,sidebarPosition:this._sidebarPosition,showContent:this._showContent,changingPage:e})}get collapsed(){return this._collapsed}get showContent(){return this._showContent}get sidebarPosition(){return this._sidebarPosition}get sidebar(){return this._sidebar}get content(){return this._content}get sidebarTag(){return this._sidebarTag}get contentTag(){return this._contentTag}get stack(){return this._plan()}get visiblePane(){let{stack:e}=this._plan();return e[e.length-1]??null}setSidebar(e){if(e===this._sidebar)return!1;let t=e?.tag??null;return tagsConflict(t,this._contentTag)?(this._critical(j.sidebarCollision(t)),!1):(this._sidebar=e,this._sidebarTag=t,this._emit(`sidebar`,this._plan()),!0)}setContent(e){if(e===this._content)return!1;let t=e?.tag??null;return tagsConflict(this._sidebarTag,t)?(this._critical(j.contentCollision(t)),!1):(this._content=e,this._contentTag=t,this._emit(`content`,this._plan()),!0)}setTag(e,t){return e===`sidebar`?(this._sidebarTag=t,tagsConflict(this._sidebarTag,this._contentTag)?(this._critical(j.sidebarTagCollision(t)),this._sidebarTag=null,!1):!0):(this._contentTag=t,tagsConflict(this._sidebarTag,this._contentTag)?(this._critical(j.contentTagCollision(t)),this._contentTag=null,!1):!0)}setSidebarPosition(e){return e===this._sidebarPosition?!1:(this._sidebarPosition=e,this._emit(`sidebar-position`,this._plan()),!0)}setCollapsed(e){let t=!!e;return t===this._collapsed?!1:(this._collapsed=t,this._emit(`collapsed`,this._plan()),!0)}setShowContent(e,t=!1){let n=!!e;if(n===this._showContent)return!1;this._showContent=n;let r=this._collapsed&&this._sidebar!==null&&this._content!==null;return this._emit(`show-content`,this._plan(r),t),!0}push(e){return this._runAction(resolveNavigationAction({action:`push`,tag:e,sidebarTag:this._sidebarTag,contentTag:this._contentTag,showContent:this._showContent,collapsed:this._collapsed}),`push`,e)}pop(){return this._runAction(resolveNavigationAction({action:`pop`,hasSidebar:this._sidebar!==null,hasContent:this._content!==null,showContent:this._showContent}),`pop`)}_runAction(e,t,n){switch(e.kind){case`set-show-content`:return this.setShowContent(e.showContent,!0),e;case`already-in-stack`:return this._critical(j.alreadyInStack(e.tag)),e;default:return this._handlers.onDelegate?.(t,n)||t===`pop`?e:(this._critical(j.notFound(n??``)),{kind:`not-found`,tag:n??``})}}};const ve={animate(e){return e.onValue(e.to),e.onDone(),{cancel:()=>{}}}};var OverlaySplitViewState=class{constructor(e={}){this._swipeActive=!1,this._animation=null,this._listeners=new Set,this._showSidebar=e.showSidebar??!0,this._collapsed=e.collapsed??!1,this._pinSidebar=e.pinSidebar??!1,this._sidebarPosition=e.sidebarPosition??`start`,this._enableShowGesture=e.enableShowGesture??!0,this._enableHideGesture=e.enableHideGesture??!0,this._showProgress=+!!this._showSidebar,this._animator=e.animator??ve}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(e,t=!1){let n={property:e,showSidebar:this._showSidebar,collapsed:this._collapsed,showProgress:this._showProgress,shieldVisible:this.shieldVisible,interactive:t};for(let e of[...this._listeners])e(n)}get showSidebar(){return this._showSidebar}get collapsed(){return this._collapsed}get pinSidebar(){return this._pinSidebar}get sidebarPosition(){return this._sidebarPosition}get enableShowGesture(){return this._enableShowGesture}get enableHideGesture(){return this._enableHideGesture}get showProgress(){return this._showProgress}get shieldVisible(){return this._collapsed&&this._showProgress>0}get sidebarPainted(){return this._showProgress>0}get sidebarFocusable(){return!this._collapsed||this._showSidebar}get contentFocusable(){return!this._collapsed||!this._showSidebar}setShowSidebar(e,t={}){let n=!!e;if(n===this._showSidebar)return!1;this._showSidebar=n;let r=+!!n,i=t.animate??!0;return i||(this._cancelAnimation(),this._showProgress=r),this._emit(`show-sidebar`,t.interactive??!1),i&&!this._swipeActive&&this._startAnimation(r,t.velocity??0),!0}setCollapsed(e){let t=!!e;return t===this._collapsed?!1:(this._collapsed=t,this._pinSidebar||this.setShowSidebar(!t,{animate:!1}),this._emit(`collapsed`),!0)}setPinSidebar(e){let t=!!e;return t===this._pinSidebar?!1:(this._pinSidebar=t,this._emit(`pin-sidebar`),!0)}setSidebarPosition(e){return e===this._sidebarPosition?!1:(this._sidebarPosition=e,this._emit(`sidebar-position`),!0)}setEnableShowGesture(e){let t=!!e;return t===this._enableShowGesture?!1:(this._enableShowGesture=t,!0)}setEnableHideGesture(e){let t=!!e;return t===this._enableHideGesture?!1:(this._enableHideGesture=t,!0)}setShowProgress(e){this._showProgress=e,this._emit(`show-progress`)}escape(){return this._showProgress<2**-52||!this._collapsed?!1:(this.setShowSidebar(!1,{interactive:!0}),!0)}dismissShield(){return this.setShowSidebar(!1,{interactive:!0})}get swipeActive(){return this._swipeActive}beginSwipe(){this._cancelAnimation(),this._swipeActive=!0}endSwipe(e,t=0){if(!this._swipeActive)return{kind:`animate`,to:this._showProgress};this._swipeActive=!1;let n=resolveSwipeRelease({to:e,showSidebar:this._showSidebar});return n.kind===`animate`?this._startAnimation(n.to,t):this.setShowSidebar(n.showSidebar,{velocity:t,interactive:!0}),n}get snapPoints(){return resolveSwipeSnapPoints({showProgress:this._showProgress,enableShowGesture:this._enableShowGesture,enableHideGesture:this._enableHideGesture,swipeActive:this._swipeActive})}_cancelAnimation(){this._animation?.cancel(),this._animation=null}_startAnimation(e,t){this._cancelAnimation();let n=!1,r=this._animator.animate({from:this._showProgress,to:e,velocity:t,clamp:e<.5,onValue:e=>this.setShowProgress(e),onDone:()=>{n=!0,this._animation=null}});n||(this._animation=r)}};function resolveSwipeSnapPoints(e){let t=e.showProgress>0||e.enableShowGesture||e.swipeActive,n=e.showProgress<1||e.enableHideGesture||e.swipeActive;return t&&n?[0,1]:[+!!t]}function resolveSwipeStart(e){let t=Math.abs(e.showProgress-1)<2**-52||e.showProgress>1,n=Math.abs(e.showProgress)<2**-52||e.showProgress<0;return!(t&&!e.collapsed&&e.direction===`forward`||n&&!e.enableShowGesture||t&&!e.enableHideGesture)}function resolveSwipeRelease(e){return e.to>0===e.showSidebar?{kind:`animate`,to:e.to}:{kind:`set-show-sidebar`,showSidebar:e.to>0}}function swipeCancelProgress(e){let t=e<0?-Math.round(-e):Math.round(e);return t===0?0:t}function resolveSwipeArea(e){if(!e.isDrag)return{x:0,y:0,width:0,height:0};let t=Math.max(Math.trunc(e.sidebarWidth*e.showProgress),32);return{x:isSidebarAtVisualStart(e.sidebarPosition??`start`,e.direction??`ltr`)?0:e.totalWidth-t,y:0,width:t,height:e.totalHeight}}const ye={none:`open-menu-symbolic`,down:`pan-down-symbolic`,up:`pan-up-symbolic`,left:`pan-start-symbolic`,right:`pan-end-symbolic`,none:`pan-down-symbolic`},M=[`none`,`up`,`down`,`left`,`right`];function splitButtonStyleClasses(e,t){let n=[];return t!==null&&t.length>0&&n.push(`image-button`),e!==null&&e.length>0&&n.push(`text-button`),n}function resolveDropdownTooltip(e){return typeof e==`string`&&e.length>0?{text:e,markup:!0}:{text:`More Options`,markup:!1}}function splitButtonArrowIcon(e){return ye[e]??ye.down}function splitButtonPopupDirection(e){return e===`none`||!M.includes(e)?`down`:e}const be=splitButtonPopupDirection;function isSplitButtonDirection(e){return typeof e==`string`&&M.includes(e)}function splitButtonRootState(e,t){return{active:e.active||t.active||e.keyboardActivating||t.keyboardActivating,checked:e.checked||t.checked}}function parseMenuEntries(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return[]}if(!Array.isArray(t))return[];let n=[];for(let e of t){if(typeof e!=`object`||!e||!(`label`in e))continue;let t=e,r={label:String(t.label)};typeof t.action==`string`&&(r.action=t.action),typeof t.id==`string`&&(r.id=t.id),typeof t.icon==`string`&&(r.icon=t.icon),n.push(r)}return n}function internalContent(e){return Object.freeze({adwInternalContent:e})}function derivedPopover(){return Object.freeze({adwDerivedPopover:!0})}var SplitButtonState=class{constructor(){this._mode=`empty`,this._label=null,this._iconName=null,this._child=null,this._useUnderline=!1,this._menuModel=null,this._popover=null,this._direction=`down`,this._dropdownTooltip=``,this._open=!1,this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(e,t){let n={mode:this._mode,label:this._label,iconName:this._iconName,child:this._child,styleClasses:this.styleClasses,dropdownEnabled:this.dropdownEnabled,open:this._open,notified:e,interactive:t};for(let e of[...this._listeners])e(n)}get mode(){return this._mode}get label(){return this._label}setLabel(e){if(typeof e!=`string`||e===this._label)return!1;let t=[];return this._iconName!==null&&t.push(`icon-name`),this._child!==null&&t.push(`child`),this._child=this._mode===`label`?this._child:internalContent(`label`),this._mode=`label`,this._label=e,this._iconName=null,t.push(`label`),this._emit(t,!1),!0}get iconName(){return this._iconName}setIconName(e){if(typeof e!=`string`||e===this._iconName)return!1;let t=[];return this._label!==null&&t.push(`label`),this._child!==null&&t.push(`child`),this._child=this._mode===`icon`?this._child:internalContent(`icon`),this._mode=`icon`,this._iconName=e,this._label=null,t.push(`icon-name`),this._emit(t,!1),!0}get child(){return this._child}setChild(e){let t=e??null;if(t===this._child)return!1;let n=[];return this._label!==null&&n.push(`label`),this._iconName!==null&&n.push(`icon-name`),this._mode=t===null?`empty`:`child`,this._child=t,this._label=null,this._iconName=null,n.push(`child`),this._emit(n,!1),!0}get styleClasses(){return splitButtonStyleClasses(this._label,this._iconName)}get useUnderline(){return this._useUnderline}setUseUnderline(e){let t=!!e;return t===this._useUnderline?!1:(this._useUnderline=t,this._emit([`use-underline`],!1),!0)}get menuModel(){return this._menuModel}setMenuModel(e){let t=e&&e.length>0?e:null;if(t===this._menuModel)return!1;let n=t===null?null:derivedPopover(),r=[];return n!==this._popover&&r.push(`popover`),r.push(`menu-model`),this._menuModel=t,this._popover=n,this.dropdownEnabled||(this._open=!1),this._emit(r,!1),!0}get popover(){return this._popover}setPopover(e){let t=e??null;if(t===this._popover)return!1;let n=[];return this._menuModel!==null&&n.push(`menu-model`),n.push(`popover`),this._menuModel=null,this._popover=t,this.dropdownEnabled||(this._open=!1),this._emit(n,!1),!0}get dropdownEnabled(){return this._menuModel!==null||this._popover!==null}get direction(){return this._direction}setDirection(e){return!isSplitButtonDirection(e)||e===this._direction?!1:(this._direction=e,this._emit([`direction`],!1),!0)}get arrowIcon(){return splitButtonArrowIcon(this._direction)}get dropdownTooltip(){return this._dropdownTooltip}setDropdownTooltip(e){return typeof e!=`string`||e===this._dropdownTooltip?!1:(this._dropdownTooltip=e,this._emit([`dropdown-tooltip`],!1),!0)}get open(){return this._open}_setOpen(e,t){return e&&!this.dropdownEnabled||e===this._open?!1:(this._open=e,this._emit([],t),!0)}openMenu(){return this._setOpen(!0,!1)}closeMenu(){return this._setOpen(!1,!1)}toggleMenu(){return this._setOpen(!this._open,!0)}activateMenuEntry(e){let t=this._menuModel;if(t===null||!Number.isInteger(e)||e<0||e>=t.length)return null;let n=t[e];return this._setOpen(!1,!0),n}};const xe=[`narrow`,`wide`],Se=[`labels`,`icons`,`both`];function isViewSwitcherPolicy(e){return e===`narrow`||e===`wide`}function isInlineViewSwitcherDisplayMode(e){return e===`labels`||e===`icons`||e===`both`}function createViewSwitcherPage(e){return{name:e.name,title:e.title??null,iconName:e.iconName??null,visible:e.visible??!0,useUnderline:e.useUnderline??!1,badgeNumber:normalizeBadgeNumber(e.badgeNumber),needsAttention:e.needsAttention??!1}}function viewSwitcherPageFromStackPage(e){return createViewSwitcherPage({name:e.name,title:e.title,iconName:e.icon.length>0?e.icon:null,visible:e.visible,badgeNumber:e.badgeNumber,needsAttention:e.needsAttention,useUnderline:e.useUnderline})}function viewSwitcherPagesFromStack(e){return e.map(e=>viewSwitcherPageFromStackPage(e))}function isViewSwitcherButtonVisible(e){return e.visible&&(isPresent(e.title)||isPresent(e.iconName))}function viewSwitcherIconName(e){return isPresent(e)&&e.length>0?e:`image-missing`}function viewSwitcherLabel(e){return isPresent(e.title)?e.useUnderline?stripMnemonic(e.title):e.title:``}function viewSwitcherBadgeLabel(e){let t=normalizeBadgeNumber(e);return t>999?`999+`:t===0?``:String(t)}const N={attentionRequested:`Attention requested.`,badgeOverflow:`Has a badge: more than 999.`,badge:e=>`Has a badge: ${e}.`};function viewSwitcherIndicatorDescription(e,t,n=N){let r=normalizeBadgeNumber(t),i=e?n.attentionRequested:``,a=``;return r>999?a=n.badgeOverflow:r>0&&(a=n.badge(r)),i&&a?`${a} ${i}`:i||a}function inlineToggleTooltip(e,t){return t===`icons`?viewSwitcherLabel(e):``}function shouldRevealViewSwitcherBar(e,t){if(!e)return!1;let n=0;for(let e of t)if(e.visible&&(n++,n>1))return!0;return!1}function viewSwitcherButtonOrientation(e){return e===`wide`?`horizontal`:`vertical`}function buildViewSwitcherButtons(e,t,n,r=N){let i=viewSwitcherButtonOrientation(n);return e.map((e,n)=>({pageIndex:n,name:e.name,label:viewSwitcherLabel(e),iconName:viewSwitcherIconName(e.iconName),visible:isViewSwitcherButtonVisible(e),selected:n===t,orientation:i,badgeLabel:viewSwitcherBadgeLabel(e.badgeNumber),needsAttention:e.needsAttention,description:viewSwitcherIndicatorDescription(e.needsAttention,e.badgeNumber,r)}))}function buildInlineToggles(e,t,n=N){let r=t!==`labels`,i=t!==`icons`,a=[];return e.forEach((e,o)=>{e.visible&&a.push({toggleIndex:a.length,pageIndex:o,name:e.name,label:viewSwitcherLabel(e),iconName:viewSwitcherIconName(e.iconName),showIcon:r,showLabel:i,tooltip:inlineToggleTooltip(e,t),badgeLabel:viewSwitcherBadgeLabel(e.badgeNumber),needsAttention:e.needsAttention,description:viewSwitcherIndicatorDescription(e.needsAttention,e.badgeNumber,n)})}),a}function toggleIndexForPage(e,t){if(!Number.isInteger(t)||t<0||t>=e.length||!e[t].visible)return-1;let n=0;for(let r=0;r<t;r++)e[r].visible&&n++;return n}var ViewSwitcherDragSwitch=class{constructor(e){this._timers=new Map,this._scheduler=e.scheduler,this._onSwitch=e.onSwitch,this._delay=e.delay??500}enter(e,t){if(!Number.isInteger(e)||e<0||e===t||this._timers.has(e))return!1;let n=this._scheduler.schedule(()=>{this._timers.delete(e),this._onSwitch(e)},this._delay);return this._timers.set(e,n),!0}leave(e){let t=this._timers.get(e);t!==void 0&&(this._timers.delete(e),this._scheduler.cancel(t))}cancel(){for(let e of this._timers.values())this._scheduler.cancel(e);this._timers.clear()}get pending(){return[...this._timers.keys()].sort((e,t)=>e-t)}},ViewSwitcherState=class{constructor(e={}){this._pages=[],this._pagesView=null,this._stack=new ViewStackState,this._listeners=new Set,this._drag=e.scheduler?new ViewSwitcherDragSwitch({scheduler:e.scheduler,delay:e.dragSwitchDelay,onSwitch:e=>{this.setSelected(e)}}):null,this._subscribeStack()}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}get pages(){return this._pagesView??=Object.freeze(this._pages.slice()),this._pagesView}setPages(e){let t=this.selected,n=t>=0?this.selectedName:null;this._pages=e.map(e=>createViewSwitcherPage(e)),this._pagesView=null;let r=new ViewStackState;for(let e of this._pages)r.addPage({name:e.name,title:e.title,visible:e.visible});if(n!==null){let e=r.indexOfName(n);e>=0&&r.setVisibleIndex(e,!1)}this._stack=r,this._subscribeStack(),this._drag?.cancel(),(this.selected!==t||this.selectedName!==(n??``))&&this._emit(!1)}get selected(){return this._stack.visibleIndex}get selectedName(){return this._stack.visibleName}get selectedPage(){return this._pages[this.selected]}get count(){return this._pages.length}setSelected(e,t=!0){return this._stack.setVisibleIndex(e,t)}selectName(e,t=!0){return this._stack.setVisibleName(e,t)}setPageVisible(e,t){let n=this._pages.findIndex(t=>t.name===e);if(n<0)return!1;let r=this._pages[n],i=!!t;return r.visible===i?!1:(this._pages[n]={...r,visible:i},this._pagesView=null,this._stack.setPageVisible(e,i))}dragEnter(e){this._drag?.enter(e,this.selected)}dragLeave(e){this._drag?.leave(e)}cancelDrag(){this._drag?.cancel()}get pendingDragSwitches(){return this._drag?.pending??[]}get diagnostics(){return this._stack.diagnostics}_subscribeStack(){this._stack.subscribe(e=>this._emit(e.interactive))}_emit(e){let t=this.selectedPage,n={selected:this.selected,name:t?.name??``,title:t?viewSwitcherLabel(t):``,interactive:e};for(let e of[...this._listeners])e(n)}},ViewSwitcherBarState=class{constructor(){this._reveal=!1,this._revealed=!1,this._pages=[],this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}get reveal(){return this._reveal}get revealed(){return this._revealed}setReveal(e){let t=!!e;return t===this._reveal?!1:(this._reveal=t,this._refresh(),!0)}setPages(e){return this._pages=e,this._refresh()}_refresh(){let e=shouldRevealViewSwitcherBar(this._reveal,this._pages);if(e===this._revealed)return!1;this._revealed=e;let t={reveal:this._reveal,revealed:this._revealed};for(let e of[...this._listeners])e(t);return!0}};function isPresent(e){return e!=null}function normalizeBadgeNumber(e){return typeof e!=`number`||!Number.isFinite(e)?0:Math.max(0,Math.trunc(e))}function tabsRevealed(e){return e.autohide?e.nPages>1||e.nPinnedPages>=1||e.isTransferringPage:!0}function tabCloseVisible(e){return e.pinned?!1:e.hovering&&e.fullyVisible||e.selected||e.dragging}function tabTooltip(e){return e.tooltip===``?e.title:e.tooltip}function tabIconState(e,t){let n=e.indicatorIcon,r=e.icon;return!e.loading&&e.pinned&&r===null&&(r=t),{icon:r,spinner:e.loading,iconVisible:(r!==null||e.loading)&&(!e.pinned||n===null),indicatorVisible:n!==null}}function isDescendantOfPage(e,t,n){let r=t;for(;r!==null&&r!==n;)r=e.find(e=>e.id===r)?.parentId??null;return r===n}function successorAfterClose(e,t,n){if(t!==n)return n;let r=e.findIndex(e=>e.id===t);if(r<0)return n;let i=e[r].parentId;if(i!==null&&r>0){let t=e[r-1];if(isDescendantOfPage(e,t.id,i))return t.id;let n=e.find(e=>e.id===i);if(n&&t.pinned&&n.pinned)return n.id}return r<e.length-1?e[r+1].id:r>0?e[r-1].id:null}function assertionDiagnostic(e,t){return`${e}: assertion '${t}' failed`}var TabViewState=class{constructor(e={}){this._stack=new ViewStackState,this._selectionListeners=new Set,this._pagesListeners=new Set,this._diagnostics=[],this._selectedId=null,this._deferSelection=!1,this._deferredSelection=null,this._pagesSource=null,this._pagesView=null,this._handlers=e,this._stack.subscribe(e=>{let t=this._selectedId,n=e.page?.content?.id??null;this._selectedId=n;let r={selectedId:n,selectedIndex:e.index,previousId:t,interactive:e.interactive};this._deferSelection?this._deferredSelection=r:this._emitSelection(r)})}subscribe(e){return this._selectionListeners.add(e),()=>{this._selectionListeners.delete(e)}}subscribePages(e){return this._pagesListeners.add(e),()=>{this._pagesListeners.delete(e)}}_emitSelection(e){for(let t of[...this._selectionListeners])t(e)}_emitPages(e){for(let t of[...this._pagesListeners])t(e)}_flushDeferredSelection(){let e=this._deferredSelection;e&&(this._deferredSelection=null,this._emitSelection(e))}get pages(){let e=this._stack.pages;return(this._pagesSource!==e||this._pagesView===null)&&(this._pagesSource=e,this._pagesView=Object.freeze(e.map(e=>e.content))),this._pagesView}get nPages(){return this._stack.count}get nPinnedPages(){let e=this.pages.findIndex(e=>!e.pinned);return e<0?this.pages.length:e}getNthPage(e){return!Number.isInteger(e)||e<0||e>=this.nPages?null:this.pages[e]}getPagePosition(e){return this._stack.indexOfName(e)}getPage(e){return this._recordOf(e)}isClosing(e){return this._recordOf(e)?.closing??!1}get diagnostics(){return this._diagnostics}get selectedId(){return this._stack.visiblePage?.content?.id??null}get selectedIndex(){return this._stack.visibleIndex}get selectedPage(){return this._stack.visiblePage?.content??null}setSelectedPage(e,t=!0){if(e===null)return this.nPages>0&&this._diagnostics.push(assertionDiagnostic(`adw_tab_view_set_selected_page`,`ADW_IS_TAB_PAGE (selected_page)`)),!1;let n=this.getPagePosition(e);return n<0?(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_set_selected_page`,`page_belongs_to_this_view (self, selected_page)`)),!1):this._stack.setVisibleIndex(n,t)}selectNthPage(e){return this._stack.setVisibleIndex(e,!0)}selectPreviousPage(){let e=this.selectedIndex;return e<=0?!1:this._stack.setVisibleIndex(e-1,!0)}selectNextPage(){let e=this.selectedIndex;return e<0||e>=this.nPages-1?!1:this._stack.setVisibleIndex(e+1,!0)}selectFirstPage(){let e=this.selectedPage;if(!e)return!1;let t=e.pinned,n=this.getNthPage(t?0:this.nPinnedPages);return n===e&&!t&&(n=this.getNthPage(0)),!n||n===e?!1:this.setSelectedPage(n.id)}selectLastPage(){let e=this.selectedPage;if(!e)return!1;let t=e.pinned,n=this.getNthPage((t?this.nPinnedPages:this.nPages)-1);return n===e&&t&&(n=this.getNthPage(this.nPages-1)),!n||n===e?!1:this.setSelectedPage(n.id)}cycleNextPage(){return!this.selectedPage||this.nPages<=1?!1:this.selectNextPage()?!0:this._stack.setVisibleIndex(0,!0)}cyclePreviousPage(){return!this.selectedPage||this.nPages<=1?!1:this.selectPreviousPage()?!0:this._stack.setVisibleIndex(this.nPages-1,!0)}addPage(e,t=null){if(t===null)return this._insert(e,this.nPages,!1,null);let n=this.getPagePosition(t);if(n<0)return this._diagnostics.push(assertionDiagnostic(`adw_tab_view_add_page`,`page_belongs_to_this_view (self, parent)`)),-1;let r=this.pages[n].pinned?this.nPinnedPages-1:n;do if(r++,r>=this.nPages)break;while(isDescendantOfPage(this.pages,this.pages[r].id,t));return this._insert(e,r,!1,t)}insertPage(e,t){return!Number.isInteger(t)||t<this.nPinnedPages?(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_insert`,`position >= self->n_pinned_pages`)),-1):t>this.nPages?(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_insert`,`position <= self->n_pages`)),-1):this._insert(e,t,!1,null)}prependPage(e){return this._insert(e,this.nPinnedPages,!1,null)}appendPage(e){return this._insert(e,this.nPages,!1,null)}insertPinnedPage(e,t){return!Number.isInteger(t)||t<0?(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_insert_pinned`,`position >= 0`)),-1):t>this.nPinnedPages?(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_insert_pinned`,`position <= self->n_pinned_pages`)),-1):this._insert(e,t,!0,null)}prependPinnedPage(e){return this._insert(e,0,!0,null)}appendPinnedPage(e){return this._insert(e,this.nPinnedPages,!0,null)}_insert(e,t,n,r){if(this.getPagePosition(e.id)>=0)return this._diagnostics.push(assertionDiagnostic(`adw_tab_view_insert`,`page id '${e.id}' is unique`)),-1;let i={id:e.id,title:e.title??``,tooltip:e.tooltip??``,icon:e.icon??null,indicatorIcon:e.indicatorIcon??null,loading:e.loading??!1,needsAttention:e.needsAttention??!1,pinned:n,parentId:r,closing:!1,content:e.content};return this._deferSelection=!0,this._stack.insertPage({name:i.id,content:i},t),this._deferSelection=!1,this._emitPages({kind:`attached`,id:i.id,position:t,previousPosition:-1}),this._flushDeferredSelection(),t}setPagePinned(e,t){let n=this.getPagePosition(e);if(n<0)return this._diagnostics.push(assertionDiagnostic(`adw_tab_view_set_page_pinned`,`page_belongs_to_this_view (self, page)`)),-1;let r=this._recordAt(n),i=!!t;if(r.pinned===i)return-1;let a=i?this.nPinnedPages:this.nPinnedPages-1;return r.pinned=i,n!==a&&this._stack.movePage(n,a),this._emitPages({kind:`pinned`,id:e,position:a,previousPosition:n}),a}closePage(e){let t=this._recordOf(e);if(!t)return this._diagnostics.push(assertionDiagnostic(`adw_tab_view_close_page`,`page_belongs_to_this_view (self, page)`)),!1;if(t.closing)return!1;t.closing=!0;let n=this._handlers.onClosePage?this._handlers.onClosePage(t):!t.pinned;return n!==`defer`&&this.closePageFinish(e,n),!0}closePageFinish(e,t){let n=this._recordOf(e);return n?n.closing?(n.closing=!1,t?this.detachPage(e)!==null:!1):(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_close_page_finish`,`page->closing`)),!1):(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_close_page_finish`,`page_belongs_to_this_view (self, page)`)),!1)}detachPage(e){let t=this.getPagePosition(e);if(t<0)return this._diagnostics.push(assertionDiagnostic(`adw_tab_view_detach_page`,`page_belongs_to_this_view (self, page)`)),null;let n=this._recordAt(t),r=successorAfterClose(this.pages,e,this.selectedId);r!==null&&r!==this.selectedId&&this.setSelectedPage(r,!1);let i=this.selectedId===e;this._stack.removePage(e);for(let t of this._records())t.parentId===e&&(t.parentId=n.parentId);return i&&(this._selectedId=null,this._emitSelection({selectedId:null,selectedIndex:-1,previousId:e,interactive:!1})),this._emitPages({kind:`detached`,id:e,position:t,previousPosition:t}),n}closeOtherPages(e){let t=this.getPagePosition(e);if(t<0){this._diagnostics.push(assertionDiagnostic(`adw_tab_view_close_other_pages`,`page_belongs_to_this_view (self, page)`));return}let n=this.pages.map(e=>e.id);for(let e=n.length-1;e>=0;e--)e!==t&&this.closePage(n[e])}closePagesBefore(e){let t=this.getPagePosition(e);if(t<0){this._diagnostics.push(assertionDiagnostic(`adw_tab_view_close_pages_before`,`page_belongs_to_this_view (self, page)`));return}let n=this.pages.map(e=>e.id);for(let e=t-1;e>=0;e--)this.closePage(n[e])}closePagesAfter(e){let t=this.getPagePosition(e);if(t<0){this._diagnostics.push(assertionDiagnostic(`adw_tab_view_close_pages_after`,`page_belongs_to_this_view (self, page)`));return}let n=this.pages.map(e=>e.id);for(let e=n.length-1;e>t;e--)this.closePage(n[e])}reorderPage(e,t){let n=this.getPagePosition(e);if(n<0)return this._diagnostics.push(assertionDiagnostic(`adw_tab_view_reorder_page`,`page_belongs_to_this_view (self, page)`)),!1;let r=this.pages[n].pinned,i=r?0:this.nPinnedPages,a=r?this.nPinnedPages:this.nPages;return!Number.isInteger(t)||t<i||t>=a?(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_reorder_page`,r?`position < self->n_pinned_pages`:`position >= self->n_pinned_pages`)),!1):n===t?!1:(this._stack.movePage(n,t),this._emitPages({kind:`reordered`,id:e,position:t,previousPosition:n}),!0)}reorderBackward(e){let t=this.getPagePosition(e);return t<0?this._reorderMissing(e):t<=(this.pages[t].pinned?0:this.nPinnedPages)?!1:this.reorderPage(e,t-1)}reorderForward(e){let t=this.getPagePosition(e);return t<0?this._reorderMissing(e):t>=(this.pages[t].pinned?this.nPinnedPages:this.nPages)-1?!1:this.reorderPage(e,t+1)}reorderFirst(e){let t=this.getPagePosition(e);return t<0?this._reorderMissing(e):this.reorderPage(e,this.pages[t].pinned?0:this.nPinnedPages)}reorderLast(e){let t=this.getPagePosition(e);return t<0?this._reorderMissing(e):this.reorderPage(e,(this.pages[t].pinned?this.nPinnedPages:this.nPages)-1)}_reorderMissing(e){return this._diagnostics.push(assertionDiagnostic(`adw_tab_view_reorder_page`,`page_belongs_to_this_view (self, '${e}')`)),!1}setPageTitle(e,t){return this._update(e,e=>{let n=t??``;return e.title===n?!1:(e.title=n,!0)})}setPageTooltip(e,t){return this._update(e,e=>{let n=t??``;return e.tooltip===n?!1:(e.tooltip=n,!0)})}setPageIcon(e,t){return this._update(e,e=>e.icon===t?!1:(e.icon=t,!0))}setPageIndicatorIcon(e,t){return this._update(e,e=>e.indicatorIcon===t?!1:(e.indicatorIcon=t,!0))}setPageLoading(e,t){return this._update(e,e=>{let n=!!t;return e.loading===n?!1:(e.loading=n,!0)})}setPageNeedsAttention(e,t){return this._update(e,e=>{let n=!!t;return e.needsAttention===n?!1:(e.needsAttention=n,!0)})}_update(e,t){let n=this.getPagePosition(e);return n<0?(this._diagnostics.push(assertionDiagnostic(`adw_tab_page_set_property`,`ADW_IS_TAB_PAGE (self)`)),!1):t(this._recordAt(n))?(this._emitPages({kind:`updated`,id:e,position:n,previousPosition:n}),!0):!1}_records(){return this._stack.pages.map(e=>e.content)}_recordAt(e){return this._stack.pages[e].content}_recordOf(e){let t=this.getPagePosition(e);return t<0?null:this._recordAt(t)}};const Ce=new Map([[`µ`,`μ`],[`ß`,`ss`],[`ʼn`,`ʼn`],[`ſ`,`s`],[`ǰ`,`ǰ`],[`ͅ`,`ι`],[`ΐ`,`ΐ`],[`ΰ`,`ΰ`],[`ς`,`σ`],[`ϐ`,`β`],[`ϑ`,`θ`],[`ϕ`,`φ`],[`ϖ`,`π`],[`ϰ`,`κ`],[`ϱ`,`ρ`],[`ϵ`,`ε`],[`և`,`եւ`],[`ᲀ`,`в`],[`ᲁ`,`д`],[`ᲂ`,`о`],[`ᲃ`,`с`],[`ᲄ`,`т`],[`ᲅ`,`т`],[`ᲆ`,`ъ`],[`ᲇ`,`ѣ`],[`ᲈ`,`ꙋ`],[`ẖ`,`ẖ`],[`ẗ`,`ẗ`],[`ẘ`,`ẘ`],[`ẙ`,`ẙ`],[`ẚ`,`aʾ`],[`ẛ`,`ṡ`],[`ὐ`,`ὐ`],[`ὒ`,`ὒ`],[`ὔ`,`ὔ`],[`ὖ`,`ὖ`],[`ᾀ`,`ἀι`],[`ᾁ`,`ἁι`],[`ᾂ`,`ἂι`],[`ᾃ`,`ἃι`],[`ᾄ`,`ἄι`],[`ᾅ`,`ἅι`],[`ᾆ`,`ἆι`],[`ᾇ`,`ἇι`],[`ᾐ`,`ἠι`],[`ᾑ`,`ἡι`],[`ᾒ`,`ἢι`],[`ᾓ`,`ἣι`],[`ᾔ`,`ἤι`],[`ᾕ`,`ἥι`],[`ᾖ`,`ἦι`],[`ᾗ`,`ἧι`],[`ᾠ`,`ὠι`],[`ᾡ`,`ὡι`],[`ᾢ`,`ὢι`],[`ᾣ`,`ὣι`],[`ᾤ`,`ὤι`],[`ᾥ`,`ὥι`],[`ᾦ`,`ὦι`],[`ᾧ`,`ὧι`],[`ᾲ`,`ὰι`],[`ᾳ`,`αι`],[`ᾴ`,`άι`],[`ᾶ`,`ᾶ`],[`ᾷ`,`ᾶι`],[`ι`,`ι`],[`ῂ`,`ὴι`],[`ῃ`,`ηι`],[`ῄ`,`ήι`],[`ῆ`,`ῆ`],[`ῇ`,`ῆι`],[`ῒ`,`ῒ`],[`ΐ`,`ΐ`],[`ῖ`,`ῖ`],[`ῗ`,`ῗ`],[`ῢ`,`ῢ`],[`ΰ`,`ΰ`],[`ῤ`,`ῤ`],[`ῦ`,`ῦ`],[`ῧ`,`ῧ`],[`ῲ`,`ὼι`],[`ῳ`,`ωι`],[`ῴ`,`ώι`],[`ῶ`,`ῶ`],[`ῷ`,`ῶι`],[`ff`,`ff`],[`fi`,`fi`],[`fl`,`fl`],[`ffi`,`ffi`],[`ffl`,`ffl`],[`ſt`,`st`],[`st`,`st`],[`ﬓ`,`մն`],[`ﬔ`,`մե`],[`ﬕ`,`մի`],[`ﬖ`,`վն`],[`ﬗ`,`մխ`]]);function foldCherokee(e){if(e>=43888&&e<=43967)return String.fromCodePoint(e-43888+5024);if(e>=5112&&e<=5117)return String.fromCodePoint(e-8)}const defaultCaseFolder=e=>{let t=``;for(let n of e.toLowerCase()){let e=n.codePointAt(0);if(e<181){t+=n;continue}t+=Ce.get(n)??foldCherokee(e)??n}return t},we=new Set([`markup`,`span`,`b`,`big`,`i`,`s`,`sub`,`sup`,`small`,`tt`,`u`]),Te=new Map([[`amp`,`&`],[`lt`,`<`],[`gt`,`>`],[`quot`,`"`],[`apos`,`'`]]),P=/[A-Za-z_:]/,F=/[A-Za-z0-9._:-]/,I=/[ \t\r\n]/;function escapeMarkup(e){let t=``;for(let n of e)switch(n){case`&`:t+=`&`;break;case`<`:t+=`<`;break;case`>`:t+=`>`;break;case`'`:t+=`'`;break;case`"`:t+=`"`;break;default:{let e=n.codePointAt(0);t+=e>=1&&e<=8||e>=11&&e<=12||e>=14&&e<=31||e===127?`&#x${e.toString(16)};`:n}}return t}function passthroughEnd(e,t){return e.startsWith(`<!--`,t)?{terminator:`-->`}:e.startsWith(`<![CDATA[`,t)?{terminator:`]]>`}:e.startsWith(`<!`,t)||e.startsWith(`<?`,t)?{terminator:`>`}:null}function readEntity(e,t){let n=e.indexOf(`;`,t);if(n<0)return null;let r=e.slice(t+1,n);if(r.length===0)return null;if(r.startsWith(`#`)){let e=r[1]===`x`||r[1]===`X`,t=e?r.slice(2):r.slice(1);if(t.length===0||!(e?/^[0-9a-fA-F]+$/:/^[0-9]+$/).test(t))return null;let i=Number.parseInt(t,e?16:10);return i<=0||i>1114111||i>=55296&&i<=57343?null:{value:String.fromCodePoint(i),next:n+1}}let i=Te.get(r);return i===void 0?null:{value:i,next:n+1}}function readTag(e,t){let n=t+1,r=e[n]===`/`;if(r&&(n+=1),n>=e.length||!P.test(e[n]))return null;let i=n;for(;n<e.length&&F.test(e[n]);)n+=1;let a=e.slice(i,n),o=!1,s=!1;for(;n<e.length;){for(;n<e.length&&I.test(e[n]);)n+=1;let t=e[n];if(t===void 0)return null;if(t===`>`)return{name:a,closing:r,selfClosing:s,hasAttributes:o,next:n+1};if(t===`/`)return r||e[n+1]!==`>`?null:(s=!0,{name:a,closing:r,selfClosing:s,hasAttributes:o,next:n+2});if(r||!P.test(t))return null;for(;n<e.length&&F.test(e[n]);)n+=1;for(;n<e.length&&I.test(e[n]);)n+=1;if(e[n]!==`=`)return null;for(n+=1;n<e.length&&I.test(e[n]);)n+=1;let i=e[n];if(i!==`"`&&i!==`'`)return null;let c=e.indexOf(i,n+1);if(c<0)return null;n=c+1,o=!0}return null}function stripMarkup(e){let t=``,n=[],r=0;for(;r<e.length;){let i=e[r];if(i===`&`){let n=readEntity(e,r);if(!n)return null;t+=n.value,r=n.next;continue}if(i!==`<`){t+=i,r+=1;continue}let a=passthroughEnd(e,r);if(a){let t=e.indexOf(a.terminator,r+2);if(t<0)return null;r=t+a.terminator.length;continue}let o=readTag(e,r);if(!o||!we.has(o.name)||o.hasAttributes&&o.name!==`span`)return null;if(o.closing){if(n.pop()!==o.name)return null}else o.selfClosing||n.push(o.name);r=o.next}return n.length===0?t:null}function makeComparable(e,t={},n=defaultCaseFolder){let r=n(e??``);return(t.useMarkup??!0)&&(r=stripMarkup(r)??r),(t.allowUnderline??!0)&&(t.useUnderline??!1)&&(r=stripMnemonic(r)),r}function displayedLabelText(e,t){let n=e??``;return t?stripMarkup(n)??n:n}function derivePreferencesGroupHeader(e){let t=e.useMarkup??!0,n=stringIsNotEmpty(displayedLabelText(e.title,t)),r=stringIsNotEmpty(displayedLabelText(e.description,t)),i=e.hasHeaderSuffix??!1;return{titleVisible:n,descriptionVisible:r,headerVisible:n||r||i,singleLine:!r&&(i||n),listboxVisible:(e.rowCount??0)>0}}function countVisiblePages(e){let t=0;for(let n of e)n.visible!==!1&&(t+=1);return t}function collectSearchRows(e){let t=[];for(let n of e)if(n.visible!==!1){for(let e of n.groups)if(e.visible!==!1)for(let r of e.rows)r.visible!==!1&&r.title!==``&&t.push({page:n,group:e,row:r})}return t}function rowMatchesQuery(e,t,n=defaultCaseFolder){let r=n(t??``),i={useMarkup:e.useMarkup,useUnderline:e.useUnderline};return makeComparable(e.title,{...i,allowUnderline:!0},n).includes(r)?!0:e.isActionRow?makeComparable(e.subtitle,{...i,allowUnderline:!1},n).includes(r):!1}function createSearchRowSubtitle(e){let t=e.groupTitle??null;t===``&&(t=null);let n=null;return e.pageTitle!==void 0&&e.pageTitle!==null&&(n=e.pageUseUnderline?stripMnemonic(e.pageTitle):e.pageTitle,(e.rowUseMarkup??!0)&&(n=escapeMarkup(n)),n===``&&(n=null)),t===null?n:e.nVisiblePages<=1?t:`${n??e.untitledPageLabel??`Untitled page`} → ${t}`}function searchPreferences(e,t,n={}){let r=n.fold??defaultCaseFolder,i=countVisiblePages(e),a=[];for(let{page:o,group:s,row:c}of collectSearchRows(e))rowMatchesQuery(c,t,r)&&a.push({title:c.title,subtitle:createSearchRowSubtitle({groupTitle:s.title,pageTitle:o.title??``,pageUseUnderline:o.useUnderline,rowUseMarkup:c.useMarkup,nVisiblePages:i,untitledPageLabel:n.untitledPageLabel}),useMarkup:c.useMarkup??!0,useUnderline:c.useUnderline??!1,page:o,group:s,row:c});return a}function scrollMaxValue(e){return e.upper-e.pageSize}function isScrolledFromStart(e){return e.value>e.lower}function isScrolledFromEnd(e){return e.value<scrollMaxValue(e)}const L=[`undershoot-top`,`undershoot-bottom`,`undershoot-start`,`undershoot-end`];function scrollUndershootClasses(e){let t=[],{vertical:n,horizontal:r}=e;return n&&(isScrolledFromStart(n)&&t.push(`undershoot-top`),isScrolledFromEnd(n)&&t.push(`undershoot-bottom`)),r&&(isScrolledFromStart(r)&&t.push(`undershoot-start`),isScrolledFromEnd(r)&&t.push(`undershoot-end`)),t}function overshootDistance(e,t){let n=scrollMaxValue(t);return e<t.lower?e-t.lower:e>n?e-n:0}function accumulateOvershoot(e,t,n){let r=n.lower-100,i=scrollMaxValue(n)+100;return Math.min(Math.max(e+t,r),i)}var PopoverState=class{constructor(){this._open=!1,this._listeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}_emit(e){let t={open:this._open,interactive:e};for(let e of[...this._listeners])e(t)}_setOpen(e,t){return e===this._open?!1:(this._open=e,this._emit(t),!0)}get open(){return this._open}popup(){return this._setOpen(!0,!1)}popdown(){return this._setOpen(!1,!1)}toggle(){return this._setOpen(!this._open,!0)}dismiss(){return this._setOpen(!1,!0)}};function resolvePopoverKey(e,t){if(e===`Escape`)return{action:`close`,index:-1};let n=Number.isFinite(t.itemCount)?Math.max(0,Math.trunc(t.itemCount)):0;if(n===0)return{action:`none`,index:-1};let r=t.currentIndex,i=Number.isFinite(r)&&r>=0&&r<n?Math.trunc(r):-1,a=t.hasSearch===!0&&i<0;switch(e){case`ArrowDown`:return{action:`focus`,index:i<0?0:(i+1)%n};case`ArrowUp`:return{action:`focus`,index:i<0?n-1:(i-1+n)%n};case`Home`:return a?{action:`none`,index:-1}:{action:`focus`,index:0};case`End`:return a?{action:`none`,index:-1}:{action:`focus`,index:n-1};case`Enter`:case` `:return i<0?{action:`none`,index:-1}:{action:`activate`,index:i};default:return{action:`none`,index:-1}}}const Ee=[`none`,`fill`,`spread`],De=[`minimum`,`natural`],Oe=[`start-to-end`,`end-to-start`];function normalizeWrapBoxSpacing(e){let t=typeof e==`number`?e:Number.parseFloat(String(e??``));return!Number.isFinite(t)||t<0?0:t}function normalizeWrapBoxAlign(e){let t=typeof e==`number`?e:Number.parseFloat(String(e??``));return Number.isFinite(t)?Math.min(1,Math.max(0,t)):0}function normalizeWrapBoxJustify(e){return Ee.includes(e)?e:`none`}function normalizeWrapPolicy(e){return De.includes(e)?e:`natural`}function normalizeNaturalLineLength(e){let t=typeof e==`number`?e:Number.parseFloat(String(e??``));return!Number.isFinite(t)||t<0?-1:Math.trunc(t)}function normalizeWrapBoxLengthUnit(e){return normalizeLengthUnit(e,`px`)}function normalizeWrapBoxPackDirection(e){return Oe.includes(e)?e:`start-to-end`}function wrapBoxLengthToPx(e,t,n=96){return e<0?-1:adwLengthToPx(t,e,n)}function resolveWrapBoxLine(e){let t=e.lastLine&&!e.justifyLastLine?`none`:e.justify;if(t===`none`)return{justify:`none`,growChildren:!1,growGaps:!1,align:e.align};let n=t===`spread`&&e.childrenInLine>1;return{justify:t,growChildren:!n,growGaps:n,align:0}}function wrapPolicyFlexShrink(e){return+(e===`minimum`)}function resolveWrapBoxChildOrder(e){let{children:t,child:n,op:r}=e,i=e.sibling??null;if(i!==null&&i===n)return null;let a=t.indexOf(n);if(r===`insert-after`&&a!==-1||r===`reorder-after`&&a===-1)return null;let o=a===-1?[...t]:t.filter((e,t)=>t!==a);if(i===null)return[n,...o];let s=o.indexOf(i);return s===-1?null:[...o.slice(0,s+1),n,...o.slice(s+1)]}function addBreakpoints(e,t){let n=new ResizeObserver(e=>{let n=e[e.length-1];if(!n)return;let r=n.borderBoxSize?.[0],i=r?{width:r.inlineSize,height:r.blockSize}:{width:n.contentRect.width,height:n.contentRect.height};for(let e of t)e.evaluate(i)});return n.observe(e),()=>n.disconnect()}function bindBreakpointSetter(e,t,n,r=!1){return t?addBreakpoints(e,[new AdwBreakpoint(t,{onApply:()=>n(!0),onUnapply:()=>n(!1)},r)]):()=>{}}const R=`--accent-bg-color`,z=`--accent-color`;function isAdwaitaDark(e){return e.closest(`.theme-dark`)?!0:e.closest(`.theme-light`)?!1:globalThis.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1}function applyAdwaitaAccent(e,t={}){let n=t.target??document.documentElement,r=t.dark??isAdwaitaDark(n);n.style.setProperty(R,adwaitaAccentBgColor(e)),n.style.setProperty(z,adwaitaAccentColor(e,r))}function clearAdwaitaAccent(e=document.documentElement){e.style.removeProperty(R),e.style.removeProperty(z)}const B=`adw-scroll-shaded`,V=`--adw-overshoot`,ke=[`overshoot-top`,`overshoot-bottom`],H=new Set([`auto`,`scroll`,`overlay`]);function adjustmentsOf(e){let t=getComputedStyle(e);return{vertical:H.has(t.overflowY)?{value:e.scrollTop,lower:0,upper:e.scrollHeight,pageSize:e.clientHeight}:void 0,horizontal:H.has(t.overflowX)?{value:e.scrollLeft,lower:0,upper:e.scrollWidth,pageSize:e.clientWidth}:void 0}}function isScroller(e){let t=getComputedStyle(e);return H.has(t.overflowY)||H.has(t.overflowX)}function wheelDeltaPx(e,t){return e.deltaMode===WheelEvent.DOM_DELTA_LINE?e.deltaY*16:e.deltaMode===WheelEvent.DOM_DELTA_PAGE?e.deltaY*t:e.deltaY}var AdwScrollShading=class{_root;_mutations=null;_resize=null;_unclamped=new WeakMap;_settleTimers=new WeakMap;_shaded=new Set;_pendingScan=0;_undershootEdges={top:!0,bottom:!0};constructor(e){this._root=e}setUndershootEdges(e){if(!(e.top===this._undershootEdges.top&&e.bottom===this._undershootEdges.bottom)){this._undershootEdges={...e};for(let e of this._shaded)this._update(e)}}connect(){this._mutations||(this._root.addEventListener(`scroll`,this._onScroll,{capture:!0,passive:!0}),this._root.addEventListener(`wheel`,this._onWheel,{capture:!0,passive:!0}),this._mutations=new MutationObserver(()=>this._scheduleRefresh()),this._mutations.observe(this._root,{childList:!0,subtree:!0}),this._resize=new ResizeObserver(()=>this._scheduleRefresh()),this._resize.observe(this._root),this.refresh())}disconnect(){this._root.removeEventListener(`scroll`,this._onScroll,{capture:!0}),this._root.removeEventListener(`wheel`,this._onWheel,{capture:!0}),this._mutations?.disconnect(),this._mutations=null,this._resize?.disconnect(),this._resize=null,this._pendingScan&&cancelAnimationFrame(this._pendingScan),this._pendingScan=0;for(let e of this._shaded)this._clear(e);this._shaded.clear()}_scheduleRefresh(){this._pendingScan||=requestAnimationFrame(()=>{this._pendingScan=0,this.refresh()})}refresh(){let e=new Set;isScroller(this._root)&&e.add(this._root);for(let t of this._root.querySelectorAll(`*`))isScroller(t)&&e.add(t);for(let t of this._shaded)e.has(t)||this._clear(t);this._shaded=e;for(let t of e)this._update(t)}_clear(e){e.classList.remove(B,...L,...ke),e.style.removeProperty(V)}_update(e){e.classList.add(B);let t=scrollUndershootClasses(adjustmentsOf(e));for(let n of L){let r=(n!==`undershoot-top`||this._undershootEdges.top)&&(n!==`undershoot-bottom`||this._undershootEdges.bottom);e.classList.toggle(n,r&&t.includes(n))}}_onScroll=e=>{let t=e.target;t instanceof HTMLElement&&this._shaded.has(t)&&this._update(t)};_onWheel=e=>{let t=e.target instanceof HTMLElement?this._scrollerFor(e.target):null;if(!t)return;let{vertical:n}=adjustmentsOf(t);if(!n)return;let r=this._unclamped.get(t)??n.value,i=accumulateOvershoot(overshootDistance(r,n)===0?n.value:r,wheelDeltaPx(e,n.pageSize),n);this._unclamped.set(t,i),this._applyOvershoot(t,overshootDistance(i,n)),clearTimeout(this._settleTimers.get(t)),this._settleTimers.set(t,setTimeout(()=>{this._unclamped.set(t,t.scrollTop),this._applyOvershoot(t,0)},50))};_applyOvershoot(e,t){e.classList.toggle(`overshoot-top`,t<0),e.classList.toggle(`overshoot-bottom`,t>0),t===0?e.style.removeProperty(V):e.style.setProperty(V,`${Math.abs(t)}px`)}_scrollerFor(e){for(let t=e;t;t=t.parentElement){if(this._shaded.has(t))return t;if(t===this._root)break}return null}};const U=`adw-icon--`;var AdwIcon=class extends HTMLElement{static get observedAttributes(){return[`icon-name`,`size`]}get iconName(){return this.getAttribute(`icon-name`)??``}set iconName(e){e===null?this.removeAttribute(`icon-name`):this.setAttribute(`icon-name`,e)}get resolvedIconName(){return normalizeIconName(this.getAttribute(`icon-name`))}get size(){let e=Number.parseFloat(this.getAttribute(`size`)??``);return Number.isFinite(e)&&e>0?e:null}set size(e){e===null?this.removeAttribute(`size`):this.setAttribute(`size`,String(e))}connectedCallback(){this._render()}attributeChangedCallback(){this._render()}_render(){this.classList.add(`adw-icon`);let e=[...this.classList].filter(e=>e.startsWith(U));this.classList.remove(...e);let t=this.resolvedIconName;t===``?stringIsNotEmpty(this.getAttribute(`icon-name`))&&this.classList.add(`${U}image-missing`):this.classList.add(`${U}${t}`),this.setAttribute(`aria-hidden`,`true`);let n=this.size;if(n===null)this.style.removeProperty(`width`),this.style.removeProperty(`height`),this.style.removeProperty(`mask-size`),this.style.removeProperty(`-webkit-mask-size`);else{let e=`${n}px`;this.style.width=e,this.style.height=e,this.style.setProperty(`mask-size`,e),this.style.setProperty(`-webkit-mask-size`,e)}}};function createAdwIcon(e,...t){let n=document.createElement(`adw-icon`);return e!==null&&n.setAttribute(`icon-name`,e),t.length>0&&n.classList.add(...t),n}customElements.define(`adw-icon`,AdwIcon);var AdwAvatar=class extends HTMLElement{_textEl;_iconEl;_imageEl;_initialized=!1;static get observedAttributes(){return[`text`,`size`,`show-initials`,`icon`,`custom-image`]}connectedCallback(){this._initialized||(this._initialized=!0,this._textEl=document.createElement(`span`),this._textEl.className=`adw-avatar-text`,this._iconEl=createAdwIcon(null,`adw-avatar-icon`),this._imageEl=document.createElement(`img`),this._imageEl.className=`adw-avatar-custom-image`,this._imageEl.alt=``,this.replaceChildren(this._textEl,this._iconEl,this._imageEl),this._render())}attributeChangedCallback(){this._initialized&&this._render()}_render(){let e=parseFloat(this.getAttribute(`size`)||`48`);this.style.width=`${e}px`,this.style.height=`${e}px`;let t=this.getAttribute(`text`)??``,n=this.getAttribute(`custom-image`)??``,r=avatarMode({hasCustomImage:n.length>0,showInitials:this.hasAttribute(`show-initials`),text:t});if(this._imageEl.hidden=r!==`image`,r===`image`)this._imageEl.getAttribute(`src`)!==n&&(this._imageEl.src=n),this.style.backgroundImage=``,this.style.color=``,this._textEl.hidden=!0,this._iconEl.hidden=!0;else if(r===`initials`){let{fg:n,start:r,stop:i}=avatarColor(t);this.style.backgroundImage=`linear-gradient(${r}, ${i})`,this.style.color=n,this._textEl.textContent=avatarInitials(t),this._textEl.hidden=!1,this._iconEl.hidden=!0,this._applyFontSize(e)}else this.style.backgroundImage=``,this.style.color=``,this._textEl.hidden=!0,this._iconEl.iconName=this.getAttribute(`icon`)??`avatar-default`,this._iconEl.size=Math.round(e*.55),this._iconEl.hidden=!1}_applyFontSize(e){let t=avatarMaxFontSize(e);this._textEl.style.fontSize=`${t}px`;let{width:n,height:r}=this._textEl.getBoundingClientRect();this._textEl.style.fontSize=`${avatarFontSize(e,{width:n,height:r})}px`}};customElements.define(`adw-avatar`,AdwAvatar);var AdwBanner=class extends HTMLElement{_titleEl;_button;_initialized=!1;static get observedAttributes(){return[`title`,`button-label`,`revealed`,`use-markup`,`button-style`]}connectedCallback(){this._initialized||(this._initialized=!0,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-banner-title`,this._button=document.createElement(`button`),this._button.className=`adw-banner-button`,this._button.addEventListener(`click`,()=>{this.dispatchEvent(new CustomEvent(`button-clicked`,{bubbles:!0}))}),this.replaceChildren(this._titleEl,this._button),this._render())}attributeChangedCallback(){this._initialized&&this._render()}_render(){let e=this.getAttribute(`title`)??``;this.hasAttribute(`use-markup`)?this._titleEl.innerHTML=e:this._titleEl.textContent=e;let t=this.getAttribute(`button-label`)??``;this._button.textContent=bannerButtonText(t),this._button.hidden=!bannerButtonVisible(t);let n=bannerButtonStyleClasses(parseBannerButtonStyle(this.getAttribute(`button-style`)));for(let e of m)this._button.classList.toggle(e,n.includes(e));this.classList.toggle(`revealed`,this.hasAttribute(`revealed`))}};customElements.define(`adw-banner`,AdwBanner);var AdwCard=class extends HTMLElement{connectedCallback(){this.classList.add(`adw-card`)}};customElements.define(`adw-card`,AdwCard);var AdwDataGrid=class extends HTMLElement{_captionEl;_scrollEl;_tableEl;_columns=[];_rows=[];_initialized=!1;static get observedAttributes(){return[`columns`,`rows`,`caption`,`interactive`]}get columns(){return this._columns}set columns(e){this._columns=normalizeDataGridColumns(e),this._initialized&&this._render()}get rows(){return this._rows}set rows(e){this._rows=Array.isArray(e)?e.map(e=>({...e})):[],this._initialized&&this._render()}get caption(){return this.getAttribute(`caption`)??``}set caption(e){e?this.setAttribute(`caption`,e):this.removeAttribute(`caption`)}get interactive(){return this.hasAttribute(`interactive`)}set interactive(e){e?this.setAttribute(`interactive`,``):this.removeAttribute(`interactive`)}connectedCallback(){this._initialized||(this._initialized=!0,this.classList.add(`adw-data-grid`),this._captionEl=document.createElement(`div`),this._captionEl.className=`adw-data-grid-caption`,this._captionEl.hidden=!0,this._scrollEl=document.createElement(`div`),this._scrollEl.className=`adw-data-grid-scroll`,this._tableEl=document.createElement(`div`),this._tableEl.className=`adw-data-grid-table`,this._tableEl.setAttribute(`role`,`table`),this._scrollEl.appendChild(this._tableEl),this._columns.length===0&&(this._columns=this._parseJsonAttr(`columns`,normalizeDataGridColumns)),this._rows.length===0&&(this._rows=this._parseJsonAttr(`rows`,e=>Array.isArray(e)?e:[])),this.replaceChildren(this._captionEl,this._scrollEl),this._render())}attributeChangedCallback(e,t,n){this._initialized&&(e===`columns`?(this._columns=this._parseJsonAttr(`columns`,normalizeDataGridColumns),this._render()):e===`rows`?(this._rows=this._parseJsonAttr(`rows`,e=>Array.isArray(e)?e:[]),this._render()):e===`caption`?this._renderCaption():e===`interactive`&&this._render())}_parseJsonAttr(e,t){let n=this.getAttribute(e);if(!n)return t(void 0);try{return t(JSON.parse(n))}catch{return t(void 0)}}_renderCaption(){let e=this.getAttribute(`caption`)??``;this._captionEl.textContent=e,this._captionEl.hidden=e.length===0}_trackTemplate(){return dataGridTrackTemplate(dataGridTracks(this._columns))}_columnClasses(e){return dataGridColumnClasses(e).join(` `)}_render(){if(!this._tableEl||(this._renderCaption(),this._tableEl.style.gridTemplateColumns=this._trackTemplate(),this._tableEl.replaceChildren(),this._columns.length===0))return;let e=document.createElement(`div`);e.className=`adw-data-grid-row header`,e.setAttribute(`role`,`row`);for(let t of this._columns){let n=document.createElement(`div`);n.className=`${this._columnClasses(t)} header-cell`,n.setAttribute(`role`,`columnheader`),n.textContent=t.label??t.key,e.appendChild(n)}this._tableEl.appendChild(e);let t=this.hasAttribute(`interactive`);this._rows.forEach((e,n)=>{let r=normalizeDataGridVariant(e.variant),i=document.createElement(`div`);if(i.className=`adw-data-grid-row variant-${r}`,i.setAttribute(`role`,`row`),r===`section`){let t=this._columns[0]?.key??``,n=document.createElement(`div`);n.className=`adw-data-grid-cell align-start section-cell`,n.setAttribute(`role`,`cell`),n.style.gridColumn=`1 / -1`,n.textContent=dataGridCellText(e[t]),i.appendChild(n)}else for(let t of this._columns){let n=document.createElement(`div`);n.className=this._columnClasses(t),n.setAttribute(`role`,`cell`),n.textContent=dataGridCellText(e[t.key]),i.appendChild(n)}dataGridRowInteractive(r,e.interactive,t)&&(i.classList.add(`interactive`),i.tabIndex=0,i.addEventListener(`click`,()=>this._activate(n,e)),i.addEventListener(`keydown`,t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),this._activate(n,e))})),this._tableEl.appendChild(i)})}_activate(e,t){this.dispatchEvent(new CustomEvent(`row-activated`,{bubbles:!0,detail:{index:e,row:t}}))}};customElements.define(`adw-data-grid`,AdwDataGrid);var AdwClamp=class extends HTMLElement{_resize=null;_mutations=null;static get observedAttributes(){return[`maximum-size`,`tightening-threshold`]}connectedCallback(){this._resize=new ResizeObserver(()=>this._allocate()),this._resize.observe(this),this._mutations=new MutationObserver(()=>this._allocate()),this._mutations.observe(this,{childList:!0}),this._allocate()}disconnectedCallback(){this._resize?.disconnect(),this._resize=null,this._mutations?.disconnect(),this._mutations=null}attributeChangedCallback(){this._allocate()}_allocate(){let e={maximumSize:normalizeClampSize(this.getAttribute(`maximum-size`),v.maximumSize),tighteningThreshold:normalizeClampSize(this.getAttribute(`tightening-threshold`),v.tighteningThreshold),childMin:0,childNat:0},t=this.clientWidth,n=Array.from(this.children);if(t<=0){for(let e of n){e.style.maxWidth=``,e.style.marginInline=``;for(let t of y)e.classList.remove(t)}return}let{childSize:r,sizeClass:i}=clampAllocate(t,e);for(let e of n){e.style.maxWidth=`${r}px`,e.style.marginInline=`auto`;for(let t of y)e.classList.toggle(t,t===i)}}};customElements.define(`adw-clamp`,AdwClamp);const W=`http://www.w3.org/2000/svg`,G=new Set;let K=0;function tick(e){for(let t of G)t.drawAt(e);K=G.size>0?requestAnimationFrame(tick):0}function startTicking(){K===0&&G.size>0&&(K=requestAnimationFrame(tick))}var AdwSpinner=class extends HTMLElement{static get observedAttributes(){return[`size`]}_svg=null;_track=null;_arc=null;_circumference=0;_radius=0;_origin=null;connectedCallback(){this._build(),G.add(this),this._origin=null,startTicking()}disconnectedCallback(){G.delete(this)}attributeChangedCallback(){this._sync()}drawAt(e){this._origin===null&&(this._origin=e),this._paint(spinnerProgressAt(e-this._origin))}_build(){if(this._svg)return;let e=document.createElementNS(W,`svg`);e.setAttribute(`fill`,`none`),e.setAttribute(`aria-hidden`,`true`);let t=document.createElementNS(W,`circle`);t.setAttribute(`stroke`,`currentColor`),t.setAttribute(`stroke-opacity`,`0.15`);let n=document.createElementNS(W,`circle`);n.setAttribute(`stroke`,`currentColor`),n.setAttribute(`stroke-linecap`,`round`),e.append(t,n),this._svg=e,this._track=t,this._arc=n,this.replaceChildren(e),this.setAttribute(`role`,`progressbar`),this.setAttribute(`aria-busy`,`true`),this._sync()}_sync(){let e=this._svg,t=this._track,n=this._arc;if(!e||!t||!n)return;let r=resolveSpinnerSize(this.getAttribute(`size`)),{diameter:i,lineWidth:a}=spinnerGeometry(r,r);this.style.width=`${r}px`,this.style.height=`${r}px`,e.setAttribute(`width`,String(i)),e.setAttribute(`height`,String(i)),e.setAttribute(`viewBox`,`0 0 ${i} ${i}`);let o=(i-a)/2;this._radius=o,this._circumference=2*Math.PI*o;for(let e of[t,n])e.setAttribute(`cx`,String(i/2)),e.setAttribute(`cy`,String(i/2)),e.setAttribute(`r`,String(o)),e.setAttribute(`stroke-width`,String(a));this._paint(this._origin===null?O:this._lastProgress)}_lastProgress=O;_paint(e){let t=this._arc;if(!t||this._radius<=0)return;this._lastProgress=e;let{end:n,length:r}=spinnerArc(e),i=r*this._radius;t.setAttribute(`stroke-dasharray`,`${i} ${Math.max(this._circumference-i,0)}`),t.setAttribute(`stroke-dashoffset`,String(-n*this._radius))}};customElements.define(`adw-spinner`,AdwSpinner);function bindEmptySections(...e){let derive=()=>{for(let t of e)t.hidden=t.childElementCount===0},t=new MutationObserver(derive);for(let n of e)t.observe(n,{childList:!0});derive()}var AdwStatusPage=class extends HTMLElement{_iconEl;_titleEl;_descEl;_childEl;_initialized=!1;static get observedAttributes(){return[`icon`,`title`,`description`]}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=Array.from(this.childNodes);this._iconEl=createAdwIcon(null,`adw-status-page-icon`),this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-status-page-title`,this._descEl=document.createElement(`span`),this._descEl.className=`adw-status-page-description`,this._childEl=document.createElement(`div`),this._childEl.className=`adw-status-page-child`;for(let t of e)this._childEl.appendChild(t);this.replaceChildren(this._iconEl,this._titleEl,this._descEl,this._childEl),bindEmptySections(this._childEl),this._render()}attributeChangedCallback(){this._initialized&&this._render()}_render(){this._iconEl.iconName=this.getAttribute(`icon`),this._iconEl.hidden=!stringIsNotEmpty(this.getAttribute(`icon`));let e=this.getAttribute(`title`)??``;this._titleEl.textContent=e,this._titleEl.hidden=!stringIsNotEmpty(e);let t=this.getAttribute(`description`)??``;this._descEl.textContent=t,this._descEl.hidden=!stringIsNotEmpty(t)}};customElements.define(`adw-status-page`,AdwStatusPage);var AdwWindow=class extends HTMLElement{connectedCallback(){let e=this.getAttribute(`width`),t=this.getAttribute(`height`);e&&(this.style.width=`${e}px`),t&&(this.style.height=`${t}px`)}};customElements.define(`adw-window`,AdwWindow);var AdwWindowTitle=class extends HTMLElement{_titleEl;_subtitleEl;_state=new WindowTitleState;_initialized=!1;static get observedAttributes(){return[`title`,`subtitle`]}connectedCallback(){this._initialized||(this._initialized=!0,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-window-title-title`,this._subtitleEl=document.createElement(`span`),this._subtitleEl.className=`adw-window-title-subtitle`,this.replaceChildren(this._titleEl,this._subtitleEl),this._state.setTitle(this.getAttribute(`title`)),this._state.setSubtitle(this.getAttribute(`subtitle`)),this._render())}attributeChangedCallback(e,t,n){this._initialized&&(e===`title`?this._state.setTitle(n):this._state.setSubtitle(n))&&(this._render(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:e===`title`?this._state.title:this._state.subtitle}})))}_render(){let{title:e,titleVisible:t,subtitle:n,subtitleVisible:r}=this._state.state;this._titleEl.textContent=e,this._titleEl.hidden=!t,this._subtitleEl.textContent=n,this._subtitleEl.hidden=!r}};customElements.define(`adw-window-title`,AdwWindowTitle);var AdwHeaderBar=class extends HTMLElement{_initialized=!1;_startEl=null;_centerEl=null;_endEl=null;_titleEl=null;static get observedAttributes(){return[`title`,`subtitle`]}get startSection(){return this._startEl}get centerSection(){return this._centerEl}get endSection(){return this._endEl}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=Array.from(this.querySelectorAll(`:scope > [slot="start"]`)),t=Array.from(this.querySelectorAll(`:scope > [slot="center"]`)),n=Array.from(this.querySelectorAll(`:scope > [slot="end"]`));this._startEl=document.createElement(`div`),this._startEl.className=`adw-header-bar-start`;for(let t of e)this._startEl.appendChild(t);if(this._centerEl=document.createElement(`div`),this._centerEl.className=`adw-header-bar-center`,t.length>0)for(let e of t)this._centerEl.appendChild(e);else this._titleEl=document.createElement(`adw-window-title`),this._titleEl.className=`adw-header-bar-title`,this._centerEl.appendChild(this._titleEl);this._endEl=document.createElement(`div`),this._endEl.className=`adw-header-bar-end`;for(let e of n)this._endEl.appendChild(e);this.replaceChildren(this._startEl,this._centerEl,this._endEl),this._renderTitle()}attributeChangedCallback(){this._initialized&&this._renderTitle()}_renderTitle(){if(this._titleEl)for(let e of[`title`,`subtitle`]){let t=this.getAttribute(e);t===null?this._titleEl.removeAttribute(e):this._titleEl.setAttribute(e,t)}}};customElements.define(`adw-header-bar`,AdwHeaderBar);const Ae=[`flat`,`suggested`,`destructive`,`circular`,`pill`];var AdwButton=class extends HTMLElement{_button;_label=``;_initialized=!1;static get observedAttributes(){return[`icon`,`label`,`tooltip`,`disabled`,`flat`,`suggested`,`destructive`,`circular`,`pill`]}get button(){return this._button}connectedCallback(){this._initialized||(this._initialized=!0,this._label=(this.getAttribute(`label`)??this.textContent??``).trim(),this._button=document.createElement(`button`),this.replaceChildren(this._button),this._render())}attributeChangedCallback(){this._initialized&&this._render()}_render(){let e=this._button;e.className=`adw-button`,e.classList.add(...buttonStyleClasses(Ae.filter(e=>this.hasAttribute(e))));let t=this.getAttribute(`icon`),n=(this.getAttribute(`label`)??this._label).trim();t&&!n&&e.classList.add(`icon-only`),e.replaceChildren(),t&&e.appendChild(createAdwIcon(t)),n&&e.appendChild(document.createTextNode(n));let r=this.getAttribute(`tooltip`);e.title=r??``,t&&!n?e.setAttribute(`aria-label`,r??t):e.removeAttribute(`aria-label`),e.disabled=this.hasAttribute(`disabled`)}};customElements.define(`adw-button`,AdwButton);var AdwButtonContent=class extends HTMLElement{_boxEl;_iconEl;_labelEl;_initialized=!1;_styledHost=null;static get observedAttributes(){return[`icon-name`,`label`,`use-underline`,`can-shrink`]}connectedCallback(){this._initialized||(this._initialized=!0,this._boxEl=document.createElement(`div`),this._boxEl.className=`adw-button-content-box`,this._iconEl=createAdwIcon(null),this._labelEl=document.createElement(`span`),this._labelEl.className=`adw-button-content-label`,this._boxEl.append(this._iconEl,this._labelEl),this.replaceChildren(this._boxEl),this._render()),this._root()}disconnectedCallback(){this._unroot()}attributeChangedCallback(e){this._initialized&&(this._render(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0})))}_hostButton(){let e=this.parentElement?.closest(`button, .adw-button`)??null;if(!e)return null;let t=e.parentElement;return t?.matches(`adw-split-button, .adw-split-button`)?t:e}_root(){let e=this._hostButton();e!==this._styledHost&&(this._unroot(),e&&(e.classList.add(g),this._styledHost=e))}_unroot(){this._styledHost?.classList.remove(g),this._styledHost=null}_render(){this._iconEl.iconName=buttonContentIconName(this.getAttribute(`icon-name`)??``),this._iconEl.hidden=!1;let e=this.getAttribute(`label`)??``;this._labelEl.textContent=buttonContentLabelText(e,this.hasAttribute(`use-underline`)),this._labelEl.hidden=e.length===0,this.classList.toggle(`can-shrink`,this.hasAttribute(`can-shrink`))}};customElements.define(`adw-button-content`,AdwButtonContent);var AdwSwitch=class extends HTMLElement{_input;_slider;_initialized=!1;static get observedAttributes(){return[`active`,`disabled`,`unfocusable`]}get unfocusable(){return this.hasAttribute(`unfocusable`)}set unfocusable(e){this.toggleAttribute(`unfocusable`,!!e)}get active(){return this.hasAttribute(`active`)}set active(e){this.toggleAttribute(`active`,!!e)}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){this.toggleAttribute(`disabled`,!!e)}connectedCallback(){this._initialized||(this._initialized=!0,this.classList.add(`adw-switch`),this._input=document.createElement(`input`),this._input.type=`checkbox`,this._slider=document.createElement(`span`),this._slider.className=`adw-switch-slider`,this.replaceChildren(this._input,this._slider),this._input.addEventListener(`change`,()=>{this.active=this._input.checked}),this.addEventListener(`click`,e=>{this.disabled||e.target!==this._input&&(this.active=!this.active)}),this._render())}attributeChangedCallback(e){this._initialized&&(this._render(),e===`active`&&this.dispatchEvent(new CustomEvent(`notify::active`,{bubbles:!0,detail:{active:this.active}})))}_render(){let e=this.disabled;this._input.checked=this.active,this._input.disabled=e,this.unfocusable?this._input.tabIndex=-1:this._input.removeAttribute(`tabindex`),this.classList.toggle(`disabled`,e)}};customElements.define(`adw-switch`,AdwSwitch);const q=new RadioGroupState;var AdwCheckBase=class extends HTMLElement{_input;_indicator;_label;_initialized=!1;get checked(){return this.hasAttribute(`checked`)}set checked(e){this.toggleAttribute(`checked`,!!e)}get indeterminate(){return this.hasAttribute(`indeterminate`)}set indeterminate(e){this.toggleAttribute(`indeterminate`,!!e)}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){this.toggleAttribute(`disabled`,!!e)}get label(){return this.getAttribute(`label`)??this._label?.textContent??``}set label(e){this.setAttribute(`label`,e)}connectedCallback(){if(this._initialized){this.onConnected();return}this._initialized=!0;let e=[...this.childNodes];this._input=document.createElement(`input`),this._input.type=this.inputType,this._input.className=`adw-check-input`,this._indicator=document.createElement(`span`),this._indicator.className=`adw-check-indicator`,this._label=document.createElement(`span`),this._label.className=`adw-check-label`;let t=this.getAttribute(`label`);t===null?this._label.append(...e):this._label.textContent=t,this.replaceChildren(this._input,this._indicator,this._label),this._input.addEventListener(`change`,()=>this.activate()),this.addEventListener(`click`,e=>{this.disabled||e.target!==this._input&&this.activate()}),this.onConnected(),this.render()}disconnectedCallback(){this.onDisconnected()}attributeChangedCallback(e){this._initialized&&(e===`label`&&(this._label.textContent=this.getAttribute(`label`)??``),this.render(),e===`checked`&&this.dispatchEvent(new CustomEvent(`notify::checked`,{bubbles:!0,detail:{checked:this.checked}})))}onConnected(){}onDisconnected(){}render(){let e=resolveCheckState(this.checked,this.indeterminate);this._input.checked=e===`checked`,this._input.indeterminate=e===`indeterminate`,this._input.setAttribute(`aria-checked`,e===`indeterminate`?`mixed`:String(e===`checked`)),this._input.disabled=this.disabled,this._label.hidden=this._label.childNodes.length===0}},AdwCheckbox=class extends AdwCheckBase{static get observedAttributes(){return[`checked`,`indeterminate`,`disabled`,`label`]}get inputType(){return`checkbox`}activate(){this.indeterminate=!1,this.checked=!this.checked}},AdwRadio=class extends AdwCheckBase{_unsubscribe=null;static get observedAttributes(){return[`checked`,`indeterminate`,`disabled`,`label`,`name`,`value`]}get inputType(){return`radio`}get name(){return this.getAttribute(`name`)??``}set name(e){this.setAttribute(`name`,e)}get value(){return this.getAttribute(`value`)??this.label.trim()}set value(e){this.setAttribute(`value`,e)}activate(){if(this.indeterminate=!1,this.name===``){this.checked=!0;return}q.select(this.name,this.value)}onConnected(){this._input.name=this.name,this.name!==``&&(this._unsubscribe??=q.subscribe(e=>{e.name===this.name&&(this.checked=e.selected===this.value)}),this.checked&&q.select(this.name,this.value))}onDisconnected(){this._unsubscribe?.(),this._unsubscribe=null}render(){super.render(),this._input.name=this.name}};customElements.define(`adw-checkbox`,AdwCheckbox),customElements.define(`adw-radio`,AdwRadio);var AdwProgressBar=class extends HTMLElement{_trough;_progress;_text;_initialized=!1;static get observedAttributes(){return[`fraction`,`pulsing`,`show-text`,`text`,`inverted`,`osd`,`disabled`]}get fraction(){let e=Number.parseFloat(this.getAttribute(`fraction`)??``);return Number.isFinite(e)?glibClamp(e,0,1):0}set fraction(e){this.setAttribute(`fraction`,String(e))}get pulsing(){return this.hasAttribute(`pulsing`)}set pulsing(e){this.toggleAttribute(`pulsing`,!!e)}get showText(){return this.hasAttribute(`show-text`)}set showText(e){this.toggleAttribute(`show-text`,!!e)}get text(){let e=this.getAttribute(`text`);return e===null?`${Math.round(this.fraction*100)}%`:e}set text(e){this.setAttribute(`text`,e)}get inverted(){return this.hasAttribute(`inverted`)}set inverted(e){this.toggleAttribute(`inverted`,!!e)}get osd(){return this.hasAttribute(`osd`)}set osd(e){this.toggleAttribute(`osd`,!!e)}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){this.toggleAttribute(`disabled`,!!e)}pulse(){this.pulsing=!0}connectedCallback(){this._initialized||(this._initialized=!0,this._trough=document.createElement(`span`),this._trough.className=`adw-progress-bar-trough`,this._progress=document.createElement(`span`),this._progress.className=`adw-progress-bar-progress`,this._trough.appendChild(this._progress),this._text=document.createElement(`span`),this._text.className=`adw-progress-bar-text`,this.replaceChildren(this._trough,this._text),this.setAttribute(`role`,`progressbar`),this.setAttribute(`aria-valuemin`,`0`),this.setAttribute(`aria-valuemax`,`1`),this._render())}attributeChangedCallback(){this._initialized&&this._render()}_render(){let e=this.fraction,t=this.pulsing,n=!t&&e===0;this._trough.classList.toggle(`empty`,n),this._progress.style.width=t||n?``:`${e*100}%`,this._text.textContent=this.text,this._text.hidden=!this.showText,t?this.removeAttribute(`aria-valuenow`):this.setAttribute(`aria-valuenow`,String(e))}};customElements.define(`adw-progress-bar`,AdwProgressBar);var AdwShortcutLabel=class extends HTMLElement{_initialized=!1;static get observedAttributes(){return[`accelerator`,`disabled-text`]}connectedCallback(){this._initialized||(this._initialized=!0,this.hasAttribute(`role`)||this.setAttribute(`role`,`img`)),this._render()}attributeChangedCallback(e){this._initialized&&(this._render(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0})))}get accelerator(){return this.getAttribute(`accelerator`)??``}set accelerator(e){this.setAttribute(`accelerator`,e)}get disabledText(){return this.getAttribute(`disabled-text`)??``}set disabledText(e){this.setAttribute(`disabled-text`,e)}_render(){let{nodes:e,accessibleLabel:t,error:n}=parseShortcutLabel(this.accelerator,{disabledText:this.disabledText,direction:this._direction()});this.replaceChildren(...e.map(e=>this._nodeElement(e))),this.setAttribute(`aria-label`,t),n&&console.warn(`adw-shortcut-label: failed to parse ${n}, part of accelerator '${this.accelerator}'`)}_direction(){let e=this.isConnected?getComputedStyle(this).direction:``;return e===`rtl`||e===`ltr`?e:this.closest(`[dir="rtl"]`)?`rtl`:`ltr`}_nodeElement(e){if(e.kind===`separator`||e.kind===`disabled`){let t=document.createElement(`span`);return t.className=e.kind===`disabled`?`dimmed adw-shortcut-label-disabled`:`dimmed`,t.textContent=e.text,t}let t=document.createElement(`span`);t.className=`adw-shortcut-label-keys`,t.setAttribute(`dir`,`ltr`);for(let n of e.keys){let e=document.createElement(`span`);if(e.className=`keycap`,e.textContent=n.label,n.sideMarker){let t=document.createElement(`sub`);t.className=`adw-shortcut-label-side`,t.textContent=n.sideMarker,e.append(t)}t.append(e)}return t}};customElements.define(`adw-shortcut-label`,AdwShortcutLabel);const je=[`bottom`,`top`,`start`,`end`],Me=[`start`,`end`],Ne=[`menu`,`listbox`];var AdwPopover=class extends HTMLElement{_state=new PopoverState;_anchor=null;_initialized=!1;_reflecting=!1;_onDocumentPointerDown=e=>{let t=e.target;this.contains(t)||this.anchor?.contains(t)!==!0&&this._state.dismiss()};_onDocumentKeyDown=e=>{e.key===`Escape`&&(e.stopPropagation(),this._state.dismiss(),this.anchor?.focus())};static get observedAttributes(){return[`open`,`position`,`align`,`role`,`menu`]}get open(){return this._state.open}set open(e){e?this._state.popup():this._state.popdown()}get anchor(){return this._anchor??this.parentElement}set anchor(e){this._anchor=e}get position(){let e=this.getAttribute(`position`);return je.includes(e)?e:`bottom`}set position(e){this.setAttribute(`position`,e)}get align(){let e=this.getAttribute(`align`);return Me.includes(e)?e:`start`}set align(e){this.setAttribute(`align`,e)}get popoverRole(){let e=this.getAttribute(`role`);return Ne.includes(e)?e:`menu`}get items(){return[...this.querySelectorAll(`.adw-popover-item`)].filter(e=>!e.hidden)}popup(){this._state.popup()}popdown(){this._state.popdown()}subscribe(e){return this._state.subscribe(t=>e(t.open))}connectedCallback(){this._buildOnce(),this._state.open&&this._bindDocument()}_buildOnce(){this._initialized||(this._initialized=!0,this.classList.add(`adw-popover`),this.hasAttribute(`role`)||this.setAttribute(`role`,`menu`),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),this._state.subscribe(e=>this._onStateChange(e.open)),this.hasAttribute(`open`)&&this._state.popup(),this._render())}disconnectedCallback(){this._unbindDocument()}attributeChangedCallback(e,t,n){if(this._initialized){if(e===`open`){if(this._reflecting)return;n===null?this._state.popdown():this._state.popup();return}if(e===`role`&&n===null){this.setAttribute(`role`,`menu`);return}this._render()}}_onStateChange(e){e?this._bindDocument():this._unbindDocument(),this._reflecting=!0,e?this.setAttribute(`open`,``):this.removeAttribute(`open`),this._reflecting=!1,this._render(),this.dispatchEvent(new CustomEvent(`notify::open`,{bubbles:!0,detail:{open:e}}))}_bindDocument(){document.addEventListener(`pointerdown`,this._onDocumentPointerDown),document.addEventListener(`keydown`,this._onDocumentKeyDown,!0)}_unbindDocument(){document.removeEventListener(`pointerdown`,this._onDocumentPointerDown),document.removeEventListener(`keydown`,this._onDocumentKeyDown,!0)}_render(){this.hidden=!this._state.open,this.dataset.position=this.position,this.dataset.align=this.align}_onKeyDown(e){if(!this._state.open)return;let t=this.items,n=document.activeElement,r=n===null?-1:t.indexOf(n),i=this.querySelector(`input, textarea`)!==null,{action:a,index:o}=resolvePopoverKey(e.key,{itemCount:t.length,currentIndex:r,hasSearch:i});if(a===`focus`){e.preventDefault(),t[o]?.focus();return}a===`activate`&&(e.preventDefault(),t[o]?.click(),this.dispatchEvent(new CustomEvent(`popover-item-activated`,{bubbles:!0,detail:{index:o}})))}};customElements.define(`adw-popover`,AdwPopover);const Pe={flat:`flat`,suggested:`suggested-action`,destructive:`destructive-action`},Fe={"open-menu-symbolic":`open-menu`,"pan-down-symbolic":`go-down`,"pan-up-symbolic":`go-down`,"pan-start-symbolic":`go-previous`,"pan-end-symbolic":`go-next`},Ie={down:`bottom`,up:`top`,left:`start`,right:`end`};var AdwSplitButton=class extends HTMLElement{_state=new SplitButtonState;_actionEl;_dropdownEl;_arrowEl;_menuEl;_inlineLabel=``;_openReflected=!1;_initialized=!1;static get observedAttributes(){return[`label`,`icon-name`,`use-underline`,`tooltip`,`dropdown-tooltip`,`direction`,`menu`,`disabled`,`flat`,`suggested`,`destructive`]}get active(){return this._state.open}get dropdownEnabled(){return this._state.dropdownEnabled}get label(){return this._state.label}set label(e){this.setAttribute(`label`,e??``),this.removeAttribute(`icon-name`)}get iconName(){return this._state.iconName}set iconName(e){this.setAttribute(`icon-name`,e??``),this.removeAttribute(`label`)}get menuItems(){return this._state.menuModel??[]}set menuItems(e){this._state.setMenuModel(Array.isArray(e)?e.map(e=>({...e})):null),this._initialized&&this._render()}get dropdownTooltip(){return this._state.dropdownTooltip}set dropdownTooltip(e){this.setAttribute(`dropdown-tooltip`,e??``)}get direction(){return this._state.direction}set direction(e){this.setAttribute(`direction`,e)}get useUnderline(){return this._state.useUnderline}set useUnderline(e){e?this.setAttribute(`use-underline`,``):this.removeAttribute(`use-underline`)}popup(){this._state.openMenu()}popdown(){this._state.closeMenu()}connectedCallback(){this._initialized||(this._initialized=!0,this._inlineLabel=(this.textContent??``).trim(),this.classList.add(`adw-split-button`),this._actionEl=document.createElement(`button`),this._actionEl.type=`button`,this._actionEl.className=`adw-split-button-action`,this._dropdownEl=document.createElement(`button`),this._dropdownEl.type=`button`,this._dropdownEl.className=`adw-split-button-dropdown`,this._dropdownEl.setAttribute(`aria-haspopup`,`menu`),this._arrowEl=createAdwIcon(null),this._dropdownEl.appendChild(this._arrowEl),this._menuEl=document.createElement(`adw-popover`),this._menuEl.classList.add(`adw-split-button-menu`),this._menuEl.setAttribute(`role`,`menu`),this._menuEl.setAttribute(`menu`,``),this._menuEl.setAttribute(`align`,`end`),this.replaceChildren(this._actionEl,this._dropdownEl,this._menuEl),this._menuEl.anchor=this._dropdownEl,this._menuEl.subscribe(e=>{e||this._state.closeMenu()}),this._actionEl.addEventListener(`click`,()=>{this.hasAttribute(`disabled`)||this.dispatchEvent(new CustomEvent(`clicked`,{bubbles:!0}))}),this._dropdownEl.addEventListener(`click`,()=>{this.hasAttribute(`disabled`)||this._state.toggleMenu()}),this._syncStateFromAttributes(),this._state.subscribe(e=>this._onStateChange(e)),this._render())}attributeChangedCallback(e,t,n){if(this._initialized){switch(e){case`label`:case`icon-name`:this._applyContentAttribute(e,n);break;case`use-underline`:this._state.setUseUnderline(n!==null);break;case`direction`:this._state.setDirection(isSplitButtonDirection(n)?n:`down`);break;case`dropdown-tooltip`:this._state.setDropdownTooltip(n??``);break;case`menu`:this._state.setMenuModel(parseMenuEntries(n));break;default:break}this._render()}}_syncStateFromAttributes(){let e=this.getAttribute(`label`)??(this._inlineLabel.length>0?this._inlineLabel:null),t=this.getAttribute(`icon-name`);e!==null&&this._state.setLabel(e),t!==null&&this._state.setIconName(t),this._state.setUseUnderline(this.hasAttribute(`use-underline`));let n=this.getAttribute(`direction`);isSplitButtonDirection(n)&&this._state.setDirection(n),this._state.setDropdownTooltip(this.getAttribute(`dropdown-tooltip`)??``),this._state.menuModel===null&&this._state.setMenuModel(parseMenuEntries(this.getAttribute(`menu`)))}_applyContentAttribute(e,t){if(t!==null){e===`label`?this._state.setLabel(t):this._state.setIconName(t);return}let n=this.getAttribute(e===`label`?`icon-name`:`label`);n===null?this._state.setChild(null):e===`label`?this._state.setIconName(n):this._state.setLabel(n)}_onStateChange(e){for(let t of e.notified)this.dispatchEvent(new CustomEvent(`notify::${t}`,{bubbles:!0}));let t=e.open&&!this._openReflected;e.open!==this._openReflected&&(this._openReflected=e.open,this.dispatchEvent(new CustomEvent(`notify::active`,{bubbles:!0,detail:{active:e.open}}))),this._render(),t&&this._menuEl.items[0]?.focus()}_render(){let e=this.hasAttribute(`disabled`);this.classList.toggle(`disabled`,e),this._actionEl.disabled=e,this._dropdownEl.disabled=e||!this._state.dropdownEnabled,this.classList.remove(`flat`,`suggested-action`,`destructive-action`);for(let[e,t]of Object.entries(Pe))this.hasAttribute(e)&&this.classList.add(t);this._renderContent(),this._renderDropdown(),this._renderMenu()}_renderContent(){let{mode:e,label:t,iconName:n,styleClasses:r}=this._state;this.classList.toggle(`image-button`,r.includes(`image-button`)),this.classList.toggle(`text-button`,r.includes(`text-button`)),this._actionEl.replaceChildren(),this._actionEl.classList.toggle(`icon-only`,e===`icon`),e===`icon`&&n!==null?this._actionEl.appendChild(createAdwIcon(n)):e===`label`&&t!==null&&this._actionEl.appendChild(document.createTextNode(t));let i=this.getAttribute(`tooltip`);this._actionEl.title=i??``,e===`icon`?this._actionEl.setAttribute(`aria-label`,i??(n||`Action`)):this._actionEl.removeAttribute(`aria-label`)}_renderDropdown(){let{direction:e,open:t}=this._state,n=splitButtonArrowIcon(e);this._arrowEl.iconName=Fe[n],this._arrowEl.style.transform=n===`pan-up-symbolic`?`rotate(180deg)`:``,this._menuEl.position=Ie[splitButtonPopupDirection(e)];let{text:r}=resolveDropdownTooltip(this._state.dropdownTooltip);this._dropdownEl.title=r,this._dropdownEl.setAttribute(`aria-label`,r),this._dropdownEl.setAttribute(`aria-expanded`,String(t));let{checked:i}=splitButtonRootState({active:!1,checked:!1,keyboardActivating:!1},{active:!1,checked:t,keyboardActivating:!1});this.classList.toggle(`checked`,i),this.classList.toggle(`active`,t)}_renderMenu(){this._menuEl.replaceChildren(),this._menuEl.open=this._state.open;for(let[e,t]of(this._state.menuModel??[]).entries()){let n=document.createElement(`button`);n.type=`button`,n.className=`adw-popover-item adw-split-button-menu-item`,n.setAttribute(`role`,`menuitem`),n.tabIndex=-1,n.textContent=t.label,n.addEventListener(`click`,()=>{let t=this._state.activateMenuEntry(e);t!==null&&this.dispatchEvent(new CustomEvent(`menu-activated`,{bubbles:!0,detail:{label:t.label,action:t.action,index:e}}))}),this._menuEl.appendChild(n)}}};customElements.define(`adw-split-button`,AdwSplitButton);const Le={horizontal:{previous:`ArrowLeft`,next:`ArrowRight`},vertical:{previous:`ArrowUp`,next:`ArrowDown`}};function attachRovingFocus(e){let{previous:t,next:n}=Le[e.orientation];e.host.addEventListener(`keydown`,r=>{if(r.altKey||r.ctrlKey||r.metaKey)return;let i=e.items(),a=i.findIndex(e=>e===r.target||e.contains(r.target));if(a<0)return;let o;switch(r.key){case t:o=a-1;break;case n:o=a+1;break;case`Home`:o=0;break;case`End`:o=i.length-1;break;default:return}r.preventDefault();let s=i[o];s===void 0||s===i[a]||(e.select(s),e.items()[o]?.focus())})}var AdwToggle=class extends HTMLElement{static get observedAttributes(){return[`label`,`icon-name`]}},AdwToggleGroup=class extends HTMLElement{_innerEl;_buttons=[];_state=new ToggleGroupState;_initialized=!1;_stateAttr=`aria-checked`;static get observedAttributes(){return[`active`,`flat`,`round`]}get active(){return this._state.selected}set active(e){this.setAttribute(`active`,String(e))}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=Array.from(this.querySelectorAll(`adw-toggle`)),t=this.getAttribute(`role`)?.trim()||null;t===null&&this.setAttribute(`role`,`radiogroup`);let n=t===`tablist`,r=n?`tab`:`radio`;this._stateAttr=n?`aria-selected`:`aria-checked`,this._innerEl=document.createElement(`div`),this._innerEl.className=`adw-toggle-group-inner`,this._innerEl.setAttribute(`role`,`none`),this._buttons=e.map((e,t)=>{let n=document.createElement(`button`);n.type=`button`,n.className=`adw-toggle`,n.setAttribute(`role`,r);let i=e.getAttribute(`label`)??``,a=e.getAttribute(`icon-name`)??``;return a&&n.appendChild(createAdwIcon(a)),i&&n.appendChild(document.createTextNode(i)),a&&!i&&n.setAttribute(`aria-label`,a),n.addEventListener(`click`,()=>this._selectIndex(t)),n}),this._innerEl.append(...this._buttons),this.replaceChildren(this._innerEl),this._state.setLabels(e.map(e=>e.getAttribute(`label`)||e.getAttribute(`icon-name`)||``)),this._state.subscribe(()=>this._render()),this._state.setSelected(this._readActiveAttr()),this._render(),attachRovingFocus({host:this,orientation:`horizontal`,items:()=>this._buttons,select:e=>this._selectIndex(this._buttons.findIndex(t=>t===e))})}attributeChangedCallback(e){if(this._initialized){if(e===`active`){this._state.setSelected(this._readActiveAttr());return}this._render()}}_readActiveAttr(){let e=Number.parseInt(this.getAttribute(`active`)??`0`,10);if(Number.isNaN(e))return 0;let t=Math.max(0,this._state.count-1);return Math.min(Math.max(e,0),t)}_selectIndex(e){this._state.setSelected(e)&&(this.setAttribute(`active`,String(e)),this.dispatchEvent(new CustomEvent(`notify::active`,{bubbles:!0,detail:{active:e}})))}_render(){this.classList.toggle(`flat`,this.hasAttribute(`flat`)),this.classList.toggle(`round`,this.hasAttribute(`round`));let e=this._state.selected;this._buttons.forEach((t,n)=>{let r=n===e;t.classList.toggle(`active`,r),t.setAttribute(this._stateAttr,String(r)),t.tabIndex=r?0:-1})}};customElements.define(`adw-toggle`,AdwToggle),customElements.define(`adw-toggle-group`,AdwToggleGroup);var AdwEntry=class extends HTMLElement{_input;_initialized=!1;_maxLength=0;static get observedAttributes(){return[`value`,`placeholder`,`type`,`disabled`,`maxlength`]}get value(){return this._input?this._input.value:this.getAttribute(`value`)??``}set value(e){let t=clampEntryText(e??``,this._maxLength);this._input?this._input.value=t:this.setAttribute(`value`,t)}get maxLength(){return this._maxLength}set maxLength(e){this._maxLength=Number.isFinite(e)?Math.min(b,Math.max(0,Math.trunc(e))):0,this._input&&(this._input.value=clampEntryText(this._input.value,this._maxLength))}get textLength(){return entryTextLength(this.value)}get input(){return this._input}connectedCallback(){if(this._initialized)return;this._initialized=!0,this.maxLength=Number(this.getAttribute(`maxlength`)??0);let e=document.createElement(`input`);e.className=`adw-entry`,e.type=this.getAttribute(`type`)||`text`,e.value=clampEntryText(this.getAttribute(`value`)??``,this._maxLength),e.placeholder=this.getAttribute(`placeholder`)??``,e.disabled=this.hasAttribute(`disabled`),e.addEventListener(`input`,()=>{let t=clampEntryText(e.value,this._maxLength);t!==e.value&&(e.value=t)}),e.addEventListener(`keydown`,t=>{t.key===`Enter`&&this.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0,detail:{value:e.value}}))}),this._input=e,this.replaceChildren(e)}attributeChangedCallback(e,t,n){if(e===`maxlength`){this.maxLength=Number(n??0);return}this._input&&(e===`value`?this._input.value=clampEntryText(n??``,this._maxLength):e===`placeholder`?this._input.placeholder=n??``:e===`type`?this._input.type=n||`text`:e===`disabled`&&(this._input.disabled=n!==null))}};customElements.define(`adw-entry`,AdwEntry);function isHeaderSuffix(e){return e instanceof Element&&e.getAttribute(`slot`)===`header-suffix`}var AdwPreferencesGroup=class extends HTMLElement{_headerEl;_titleEl;_descriptionEl;_suffixEl;_listboxEl;_initialized=!1;_observer=null;static get observedAttributes(){return[`title`,`description`]}get description(){return this.getAttribute(`description`)??``}set description(e){e?this.setAttribute(`description`,e):this.removeAttribute(`description`)}addRow(e){isHeaderSuffix(e)?this._suffixEl.appendChild(e):this._listboxEl.appendChild(e),this._renderHeader()}removeRow(e){let t=e.parentNode;return t!==this._listboxEl&&t!==this._suffixEl?!1:(t.removeChild(e),this._renderHeader(),!0)}connectedCallback(){if(this._initialized){this._observeHost();return}this._initialized=!0;let e=Array.from(this.childNodes),t=e.filter(isHeaderSuffix),n=e.filter(e=>!t.includes(e));this._headerEl=document.createElement(`div`),this._headerEl.className=`adw-preferences-group-header`;let r=document.createElement(`div`);r.className=`adw-preferences-group-labels`,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-preferences-group-title`,this._descriptionEl=document.createElement(`span`),this._descriptionEl.className=`adw-preferences-group-description`,r.append(this._titleEl,this._descriptionEl),this._suffixEl=document.createElement(`div`),this._suffixEl.className=`adw-preferences-group-suffix`;for(let e of t)this._suffixEl.appendChild(e);this._headerEl.append(r,this._suffixEl),this._listboxEl=document.createElement(`div`),this._listboxEl.className=`adw-preferences-group-listbox`;for(let e of n)this._listboxEl.appendChild(e);this.replaceChildren(this._headerEl,this._listboxEl),this.setAttribute(`role`,`group`),this._renderHeader(),this._observeHost()}disconnectedCallback(){this._observer?.disconnect(),this._observer=null}attributeChangedCallback(){this._initialized&&this._renderHeader()}_observeHost(){this._observer||(this._observer=new MutationObserver(e=>{for(let t of e)if(t.target===this)for(let e of t.addedNodes)e instanceof Element&&(e===this._headerEl||e===this._listboxEl||this.addRow(e));this._renderHeader()}),this._observer.observe(this,{childList:!0}),this._observer.observe(this._listboxEl,{childList:!0}),this._observer.observe(this._suffixEl,{childList:!0}))}_renderHeader(){let e=this.getAttribute(`title`)??``,t=this.getAttribute(`description`)??``;this._titleEl.textContent=e,this._descriptionEl.textContent=t;let n=derivePreferencesGroupHeader({title:e,description:t,hasHeaderSuffix:this._suffixEl.childElementCount>0,rowCount:this._listboxEl.childElementCount,useMarkup:!1});this._titleEl.hidden=!n.titleVisible,this._descriptionEl.hidden=!n.descriptionVisible,this._headerEl.hidden=!n.headerVisible,this._headerEl.classList.toggle(`single-line`,n.singleLine),this._listboxEl.hidden=!n.listboxVisible}};customElements.define(`adw-preferences-group`,AdwPreferencesGroup);function attachRowActivation(e){let{row:t,activatable:n}=e,r=e.activate??(()=>t.click());t.addEventListener(`keydown`,e=>{e.target===t&&n()&&(e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),r()))});let sync=()=>{n()?t.tabIndex=0:t.removeAttribute(`tabindex`)};return sync(),{sync}}const Re=[`disabled`,`aria-disabled`];function isSensitive(e){return e.disabled===!0?!1:e.getAttribute(`aria-disabled`)!==`true`}var AdwActionRow=class extends HTMLElement{_titleEl;_subtitleEl;_suffixEl;_prefixEl;_state=new ActionRowState;_sensitivityObserver=null;_initialized=!1;_activation;static get observedAttributes(){return[`title`,`subtitle`,`activatable`]}get suffixSection(){return this._suffixEl}get prefixSection(){return this._prefixEl}get activatableWidget(){return this._state.activatableWidget}set activatableWidget(e){this._state.setActivatableWidget(e,e?isSensitive(e):!0)&&(this._observeSensitivity(e),this._syncActivatable())}get activatable(){return this._state.activatable}connectedCallback(){if(this._initialized){this._observeSensitivity(this._state.activatableWidget);return}this._initialized=!0;let e=Array.from(this.querySelectorAll(`:scope > [slot="prefix"]`)),t=Array.from(this.querySelectorAll(`:scope > [slot="suffix"]`));this._prefixEl=document.createElement(`div`),this._prefixEl.className=`adw-action-row-prefix`;for(let t of e)this._prefixEl.appendChild(t);let n=document.createElement(`div`);n.className=`adw-action-row-text`,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-row-title`,this._subtitleEl=document.createElement(`span`),this._subtitleEl.className=`adw-row-subtitle`,n.append(this._titleEl,this._subtitleEl),this._suffixEl=document.createElement(`div`),this._suffixEl.className=`adw-action-row-suffix`;for(let e of t)this._suffixEl.appendChild(e);this.replaceChildren(this._prefixEl,n,this._suffixEl),bindEmptySections(this._prefixEl,this._suffixEl),this._adoptAttributes(),this._render(),this.addEventListener(`click`,e=>this._onClick(e)),this._activation=attachRowActivation({row:this,activatable:()=>this._state.activatable})}_adoptAttributes(){this._state.setTitle(this.getAttribute(`title`)),this._state.setSubtitle(this.getAttribute(`subtitle`)),this._state.setActivatable(this.hasAttribute(`activatable`))}disconnectedCallback(){this._sensitivityObserver?.disconnect(),this._sensitivityObserver=null}attributeChangedCallback(){this._initialized&&(this._adoptAttributes(),this._render())}_onClick(e){if(!this._state.activatable)return;let t=this._state.activate();t&&e.target instanceof Node&&t.contains(e.target)||(t?.click(),this.dispatchEvent(new CustomEvent(`activated`,{bubbles:!0})))}_observeSensitivity(e){if(this._sensitivityObserver?.disconnect(),!e){this._sensitivityObserver=null;return}this._sensitivityObserver??=new MutationObserver(()=>{let e=this._state.activatableWidget;e&&this._state.setActivatableWidgetSensitive(isSensitive(e))&&this._syncActivatable()}),this._sensitivityObserver.observe(e,{attributeFilter:Re})}_syncActivatable(){this.toggleAttribute(`activatable`,this._state.activatable),this._initialized&&this._render()}_render(){let{title:e,titleVisible:t,subtitle:n,subtitleVisible:r}=this._state.state;this._titleEl.textContent=e,this._titleEl.hidden=!t,this._subtitleEl.textContent=n,this._subtitleEl.hidden=!r,this.classList.toggle(`activatable`,this._state.activatable),this._activation?.sync()}};customElements.define(`adw-action-row`,AdwActionRow);function setPartVisible(e,t){e.hidden=!t,e.style.display=t?``:`none`}function boolAttribute(e){return e!==null&&e!==`false`}var AdwEntryRow=class extends HTMLElement{_state=new EntryRowState;_input;_emptyTitle;_title;_area;_editIcon;_indicator;_applyButton;_prefixes;_suffixes;_initialized=!1;_authored=[];_lastText=``;_lastLength=0;static get observedAttributes(){return[`title`,`text`,`editable`,`max-length`,`show-apply-button`,`activates-default`]}get _classPrefix(){return`adw-entry-row`}get text(){return this._state.text}set text(e){this._state.setText(e??``)}get textLength(){return this._state.textLength}get maxLength(){return this._state.maxLength}set maxLength(e){this._state.setMaxLength(e)}get editable(){return this._state.editable}set editable(e){this._state.setEditable(e)}get showApplyButton(){return this._state.showApplyButton}set showApplyButton(e){this._state.setShowApplyButton(e)}get activatesDefault(){return this._state.activatesDefault}set activatesDefault(e){this._state.setActivatesDefault(e)}get editing(){return this._state.editing}connectedCallback(){this._initialized||(this._initialized=!0,this._build(),this._state.setMaxLength(Number.parseInt(this.getAttribute(`max-length`)??``,10)),this._state.setEditable(this.getAttribute(`editable`)!==`false`),this._state.setShowApplyButton(boolAttribute(this.getAttribute(`show-apply-button`))),this._state.setActivatesDefault(boolAttribute(this.getAttribute(`activates-default`))),this.hasAttribute(`text`)&&this._state.setText(this.getAttribute(`text`)??``),this._renderTitle(),this._onConnected(),this._adoptAuthored(),this._lastText=this._state.text,this._lastLength=this._state.textLength,this._render(this._state.state),this._state.subscribe(e=>this._onStateChanged(e)))}attributeChangedCallback(e,t,n){if(this._initialized)switch(e){case`title`:this._renderTitle();break;case`text`:this._state.setText(n??``);break;case`editable`:this._state.setEditable(n!==`false`);break;case`max-length`:this._state.setMaxLength(Number.parseInt(n??``,10));break;case`show-apply-button`:this._state.setShowApplyButton(boolAttribute(n));break;case`activates-default`:this._state.setActivatesDefault(boolAttribute(n));break}}addSuffix(e){this._suffixes.append(e),setPartVisible(this._suffixes,!0)}addPrefix(e){this._prefixes.prepend(e),setPartVisible(this._prefixes,!0)}setShowIndicator(e){this._state.setShowIndicator(e)}setIndicatorIconName(e){this._indicator.dataset.iconName=e}setIndicatorTooltip(e){this._indicator.title=e,this._indicator.setAttribute(`aria-label`,e)}apply(){this._state.apply(),this.dispatchEvent(new CustomEvent(`apply`,{bubbles:!0}))}grabFocusWithoutSelecting(){return this._input.focus(),this._state.editing}_onConnected(){}_build(){let e=this._classPrefix;this._authored=[...this.children],this._prefixes=document.createElement(`div`),this._prefixes.className=`${e}-prefixes`,this._suffixes=document.createElement(`div`),this._suffixes.className=`${e}-suffixes`,this._emptyTitle=document.createElement(`span`),this._emptyTitle.className=`adw-row-title ${e}-empty-title`,this._title=document.createElement(`span`),this._title.className=`adw-row-title ${e}-title`,this._input=document.createElement(`input`),this._input.className=`${e}-input`,this._input.type=`text`,this._input.addEventListener(`input`,()=>{this._state.setText(this._input.value),this._input.value!==this._state.text&&(this._input.value=this._state.text)}),this._input.addEventListener(`focus`,()=>this._state.setEditing(!0)),this._input.addEventListener(`blur`,()=>this._state.setEditing(!1)),this._input.addEventListener(`keydown`,e=>{e.key===`Enter`&&(e.preventDefault(),this._activate())}),this._area=document.createElement(`div`),this._area.className=`${e}-text`,this._area.append(this._emptyTitle,this._title,this._input),this._indicator=document.createElement(`span`),this._indicator.className=`${e}-indicator`,this._indicator.setAttribute(`role`,`img`),this._indicator.textContent=`⇪`,this._applyButton=document.createElement(`button`),this._applyButton.type=`button`,this._applyButton.className=`adw-button suggested-action circular icon-only ${e}-apply`,this._applyButton.dataset.iconName=`adw-entry-apply-symbolic`,this._applyButton.title=ce,this._applyButton.setAttribute(`aria-label`,ce),this._applyButton.textContent=`✓`,this._applyButton.addEventListener(`click`,()=>this.apply()),this._editIcon=createAdwIcon(`document-edit`,`adw-row-edit`,`${e}-edit`),this._editIcon.dataset.iconName=`adw-entry-edit-symbolic`,this.replaceChildren(this._prefixes,this._area,this._indicator,this._applyButton,this._editIcon,this._suffixes),setPartVisible(this._prefixes,!1),setPartVisible(this._suffixes,!1),this.addEventListener(`click`,e=>this._maybeFocus(e))}_adoptAuthored(){for(let e of this._authored)e.getAttribute(`slot`)===`prefix`?this.addPrefix(e):this.addSuffix(e);this._authored=[]}_maybeFocus(e){let t=e.target;(t===this||t===this._area||t===this._emptyTitle||t===this._title||t===this._editIcon||t===this._indicator||t===this._prefixes||t===this._suffixes)&&this._input.focus()}_activate(){let e=this._state.activate();if(e.signal===`apply`){this.dispatchEvent(new CustomEvent(`apply`,{bubbles:!0}));return}e.activateDefault&&this.closest(`form`)?.requestSubmit(),this.dispatchEvent(new CustomEvent(`entry-activated`,{bubbles:!0}))}_renderTitle(){let e=this.getAttribute(`title`)??``;this._emptyTitle.textContent=e,this._title.textContent=e}_render(e){this._input.value!==e.text&&(this._input.value=e.text),this._input.readOnly=!e.editable,this.classList.toggle(`focused`,e.editing),this.classList.toggle(`empty`,e.empty),setPartVisible(this._emptyTitle,e.emptyTarget===0),setPartVisible(this._title,e.emptyTarget===1),setPartVisible(this._editIcon,e.editIconVisible),this._editIcon.classList.toggle(`disabled`,!e.editIconSensitive),this._editIcon.setAttribute(`aria-disabled`,String(!e.editIconSensitive)),setPartVisible(this._indicator,e.indicatorVisible),setPartVisible(this._applyButton,e.applyButtonVisible),this.setAttribute(`text-length`,String(e.textLength))}_onStateChanged(e){if(this._render(e),e.text!==this._lastText){this._lastText=e.text;let t={text:e.text};this.dispatchEvent(new CustomEvent(`changed`,{bubbles:!0,detail:t})),this.dispatchEvent(new CustomEvent(`notify::text`,{bubbles:!0,detail:t}))}e.textLength!==this._lastLength&&(this._lastLength=e.textLength,this.dispatchEvent(new CustomEvent(`notify::text-length`,{bubbles:!0,detail:{textLength:e.textLength}})))}};customElements.define(`adw-entry-row`,AdwEntryRow);var AdwSwitchRow=class extends HTMLElement{_switchEl;_titleEl;_subtitleEl;_state=new SwitchRowState;_initialized=!1;static get observedAttributes(){return[`title`,`subtitle`,`active`]}get active(){return this._initialized?this._state.active:this.hasAttribute(`active`)}set active(e){this.toggleAttribute(`active`,!!e)}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=document.createElement(`div`);e.className=`adw-row-text`,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-row-title`,this._subtitleEl=document.createElement(`span`),this._subtitleEl.className=`adw-row-subtitle`,e.append(this._titleEl,this._subtitleEl),this._switchEl=document.createElement(`adw-switch`),this._switchEl.unfocusable=!0,this.replaceChildren(e,this._switchEl),this._state.setActive(this.hasAttribute(`active`)),this._switchEl.active=this._state.active,this.setAttribute(`role`,`switch`),this.setAttribute(`aria-checked`,String(this._state.active)),this._switchEl.addEventListener(`notify::active`,e=>{e.stopPropagation(),this._apply(this._state.setActive(this._switchEl.active))}),this.addEventListener(`click`,e=>{e.target instanceof Node&&this._switchEl.contains(e.target)||this._apply(this._state.activate())}),attachRowActivation({row:this,activatable:()=>!0}),this._renderText()}attributeChangedCallback(e){this._initialized&&(e===`active`?this._apply(this._state.setActive(this.hasAttribute(`active`))):this._renderText())}_apply(e){e&&(this._switchEl.active=this._state.active,this.toggleAttribute(`active`,this._state.active),this.setAttribute(`aria-checked`,String(this._state.active)),this.dispatchEvent(new CustomEvent(`notify::active`,{bubbles:!0,detail:{active:this._state.active}})))}_renderText(){let{title:e,titleVisible:t,subtitle:n,subtitleVisible:r}=deriveRowLabels({title:this.getAttribute(`title`),subtitle:this.getAttribute(`subtitle`)});this._titleEl.textContent=e,this._titleEl.hidden=!t,this._subtitleEl.textContent=n,this._subtitleEl.hidden=!r}};customElements.define(`adw-switch-row`,AdwSwitchRow);var AdwComboRow=class extends HTMLElement{_select;_valueEl;_titleEl;_subtitleEl;_state=new ComboState;_initialized=!1;static get observedAttributes(){return[`title`,`subtitle`,`selected`]}get selected(){return this._initialized?this._state.selectedIndex:parseInt(this.getAttribute(`selected`)||`0`,10)}set selected(e){this.setAttribute(`selected`,String(e))}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=JSON.parse(this.getAttribute(`items`)||`[]`);this._state.setOptions(normalizeComboOptions(e)),this._state.setSelectedIndex(parseInt(this.getAttribute(`selected`)||`0`,10));let t=this._state.selectedIndex,n=document.createElement(`div`);n.className=`adw-row-text`,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-row-title`,this._subtitleEl=document.createElement(`span`),this._subtitleEl.className=`adw-row-subtitle`,n.append(this._titleEl,this._subtitleEl),this._valueEl=document.createElement(`span`),this._valueEl.className=`adw-row-value`,this._valueEl.textContent=this._state.selectedLabel;let r=document.createElement(`select`);e.forEach((e,n)=>{let i=document.createElement(`option`);i.value=String(n),i.textContent=e,n===t&&(i.selected=!0),r.appendChild(i)}),this.replaceChildren(n,this._valueEl,r),this._select=r,this._state.subscribe(e=>{this._valueEl.textContent=e.label,this._select.selectedIndex!==e.selected&&(this._select.selectedIndex=e.selected),this._syncChooser(),e.interactive&&(this.setAttribute(`selected`,String(e.selected)),this.dispatchEvent(new CustomEvent(`notify::selected`,{bubbles:!0,detail:{selected:e.selected}})))}),this._select.addEventListener(`change`,()=>{this._state.select(this._select.selectedIndex)}),this._syncChooser(),this._renderText()}attributeChangedCallback(e,t,n){this._initialized&&(e===`selected`?this._state.setSelectedIndex(parseInt(n||`0`,10)):this._renderText())}_syncChooser(){let e=this._state.presentsChooser;this.dataset.presentsChooser=e?`true`:`false`,this._select.disabled=!e}_renderText(){let e=deriveRowLabels({title:this.getAttribute(`title`),subtitle:this.getAttribute(`subtitle`)});this._titleEl.textContent=e.title,this._titleEl.hidden=!e.titleVisible,this._subtitleEl.textContent=e.subtitle,this._subtitleEl.hidden=!e.subtitleVisible}};customElements.define(`adw-combo-row`,AdwComboRow);var AdwSpinRow=class extends HTMLElement{_input;_titleEl;_subtitleEl;_state=new SpinState;_initialized=!1;static get observedAttributes(){return[`title`,`subtitle`,`value`,`min`,`max`,`step`]}get value(){return this._state.value}set value(e){this._state.setValue(this._roundToStep(e)),this._syncValue()}connectedCallback(){if(this._initialized)return;this._initialized=!0,this._state.setMin(parseFloat(this.getAttribute(`min`)||`0`)),this._state.setMax(parseFloat(this.getAttribute(`max`)||`100`)),this._state.setStep(parseFloat(this.getAttribute(`step`)||`1`)),this._state.setValue(this._roundToStep(parseFloat(this.getAttribute(`value`)||String(this._state.min))));let e=document.createElement(`div`);e.className=`adw-row-text`,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-row-title`,this._subtitleEl=document.createElement(`span`),this._subtitleEl.className=`adw-row-subtitle`,e.append(this._titleEl,this._subtitleEl);let t=document.createElement(`div`);t.className=`adw-spin-control`;let n=document.createElement(`button`);n.className=`adw-spin-dec`,n.textContent=`−`,n.addEventListener(`click`,()=>this._adjust(-this._state.step));let r=document.createElement(`input`);r.type=`text`,r.value=this._formatValue(this._state.value),r.addEventListener(`change`,()=>{let e=parseFloat(r.value);Number.isNaN(e)?r.value=this._formatValue(this._state.value):(this.value=e,this._emitChange())});let i=document.createElement(`button`);i.className=`adw-spin-inc`,i.textContent=`+`,i.addEventListener(`click`,()=>this._adjust(this._state.step)),t.append(n,r,i),this.replaceChildren(e,t),this._input=r,this._state.subscribe(()=>this._syncValue()),this._renderText()}attributeChangedCallback(e,t,n){if(!this._initialized)return;if(e===`title`||e===`subtitle`){this._renderText();return}let r=parseFloat(n||`0`);switch(e){case`value`:this._state.setValue(this._roundToStep(r));break;case`min`:this._state.setMin(r);break;case`max`:this._state.setMax(r);break;case`step`:this._state.setStep(r);break}}_renderText(){let e=deriveRowLabels({title:this.getAttribute(`title`),subtitle:this.getAttribute(`subtitle`)});this._titleEl.textContent=e.title,this._titleEl.hidden=!e.titleVisible,this._subtitleEl.textContent=e.subtitle,this._subtitleEl.hidden=!e.subtitleVisible}_adjust(e){this.value=this._state.value+e,this._emitChange()}_emitChange(){this.dispatchEvent(new CustomEvent(`notify::value`,{bubbles:!0,detail:{value:this._state.value}}))}_syncValue(){this._input&&(this._input.value=this._formatValue(this._state.value)),this.setAttribute(`value`,String(this._state.value))}_roundToStep(e){if(!Number.isFinite(e))return e;let t=this._countDecimals(this._state.step);return t>0?parseFloat(e.toFixed(t)):e}_countDecimals(e){let t=String(e),n=t.indexOf(`.`);return n===-1?0:t.length-n-1}_formatValue(e){let t=this._countDecimals(this._state.step);return t>0?e.toFixed(t):String(e)}};customElements.define(`adw-spin-row`,AdwSpinRow);var AdwButtonRow=class extends HTMLElement{_contentsEl;_startIconEl;_endIconEl;_titleEl;_state=new ButtonRowState;_initialized=!1;static get observedAttributes(){return[`title`,`start-icon-name`,`end-icon-name`]}connectedCallback(){this._initialized||(this._contentsEl=document.createElement(`div`),this._contentsEl.className=`adw-button-row-contents`,this._startIconEl=createAdwIcon(null,`start`),this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-button-row-title`,this._endIconEl=createAdwIcon(null,`end`),this._contentsEl.append(this._startIconEl,this._titleEl,this._endIconEl),this.replaceChildren(this._contentsEl),this._initialized=!0,this._render(),this.addEventListener(`click`,()=>{this.dispatchEvent(new CustomEvent(`activated`,{bubbles:!0}))}),attachRowActivation({row:this,activatable:()=>!0}))}attributeChangedCallback(){this._initialized&&this._render()}_render(){this._state.setTitle(this.getAttribute(`title`)),this._state.setStartIconName(this.getAttribute(`start-icon-name`)),this._state.setEndIconName(this.getAttribute(`end-icon-name`));let e=this._state.state;this._titleEl.textContent=e.title,this._titleEl.hidden=!e.titleVisible,this._paintIcon(this._startIconEl,e.startIconName,e.startIconVisible),this._paintIcon(this._endIconEl,e.endIconName,e.endIconVisible),this.classList.toggle(`activatable`,!0)}_paintIcon(e,t,n){e.iconName=n?t:null,e.hidden=!n}};customElements.define(`adw-button-row`,AdwButtonRow);var AdwExpanderRow=class extends HTMLElement{_headerEl;_titleEl;_subtitleEl;_enableSwitch;_chevronEl;_contentEl;_prefixEl;_suffixEl;_state=new ExpanderState;_initialized=!1;_reflectingEnable=!1;constructor(){super(),this._state.subscribe(e=>{e?this.setAttribute(`expanded`,``):this.removeAttribute(`expanded`),this._initialized&&this._render()})}static get observedAttributes(){return[`title`,`subtitle`,`expanded`,`enable-expansion`,`show-enable-switch`]}get expanded(){return this._state.expanded}set expanded(e){this._state.setExpanded(e)}get enableExpansion(){return!this.hasAttribute(`enable-expansion`)||this.getAttribute(`enable-expansion`)!==`false`}set enableExpansion(e){this.setAttribute(`enable-expansion`,e?`true`:`false`)}get contentSection(){return this._contentEl}get suffixSection(){return this._suffixEl}get prefixSection(){return this._prefixEl}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=Array.from(this.querySelectorAll(`:scope > [slot="prefix"]`)),t=Array.from(this.querySelectorAll(`:scope > [slot="suffix"]`)),n=new Set([...e,...t]),r=Array.from(this.childNodes).filter(e=>!n.has(e));this._headerEl=document.createElement(`div`),this._headerEl.className=`adw-expander-row-header`;let i=document.createElement(`div`);i.className=`adw-row-text`,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-row-title`,this._subtitleEl=document.createElement(`span`),this._subtitleEl.className=`adw-row-subtitle`,i.append(this._titleEl,this._subtitleEl),this._enableSwitch=document.createElement(`adw-switch`),this._enableSwitch.classList.add(`adw-expander-row-enable-switch`),this._enableSwitch.active=this.enableExpansion,this._chevronEl=createAdwIcon(`go-down`,`adw-expander-row-chevron`),this._prefixEl=document.createElement(`div`),this._prefixEl.className=`adw-expander-row-prefix`;for(let t of e)this._prefixEl.appendChild(t);this._suffixEl=document.createElement(`div`),this._suffixEl.className=`adw-expander-row-suffix`;for(let e of t)this._suffixEl.appendChild(e);bindEmptySections(this._prefixEl,this._suffixEl),this._headerEl.append(this._prefixEl,i,this._suffixEl,this._enableSwitch,this._chevronEl),this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-expander-row-content`;for(let e of r)this._contentEl.appendChild(e);this.replaceChildren(this._headerEl,this._contentEl),this._headerEl.addEventListener(`click`,e=>{this._enableSwitch.contains(e.target)||this._state.toggle()&&this.dispatchEvent(new CustomEvent(`notify::expanded`,{bubbles:!0,detail:{expanded:this.expanded}}))}),attachRowActivation({row:this._headerEl,activatable:()=>!0}),this._enableSwitch.addEventListener(`notify::active`,e=>{if(e.stopPropagation(),this._reflectingEnable)return;let t=this._enableSwitch.active;this.setAttribute(`enable-expansion`,t?`true`:`false`),this.dispatchEvent(new CustomEvent(`notify::enable-expansion`,{bubbles:!0,detail:{enableExpansion:t}}))}),this._state.setExpanded(this.hasAttribute(`expanded`)),this._render()}attributeChangedCallback(e){this._initialized&&(e===`expanded`&&this._state.setExpanded(this.hasAttribute(`expanded`)),this._render())}_render(){let e=deriveRowLabels({title:this.getAttribute(`title`),subtitle:this.getAttribute(`subtitle`)});this._titleEl.textContent=e.title,this._titleEl.hidden=!e.titleVisible,this._subtitleEl.textContent=e.subtitle,this._subtitleEl.hidden=!e.subtitleVisible;let t=this.hasAttribute(`show-enable-switch`);this._enableSwitch.hidden=!t,this._reflectingEnable=!0,this._enableSwitch.active=this.enableExpansion,this._reflectingEnable=!1,this.classList.toggle(`expanded`,this.expanded),this._headerEl.setAttribute(`aria-expanded`,String(this.expanded)),this._contentEl.classList.toggle(`expanded`,this.expanded)}};customElements.define(`adw-expander-row`,AdwExpanderRow);var AdwPasswordEntryRow=class extends AdwEntryRow{_password=new PasswordEntryRowState(this._state);_toggle;_toggleIcon;static get observedAttributes(){return[...AdwEntryRow.observedAttributes,`revealed`]}get _classPrefix(){return`adw-password-entry-row`}get revealed(){return this._password.revealed}set revealed(e){this._password.setRevealed(e)}get capsLockOn(){return this._password.capsLockOn}setCapsLockOn(e){this._password.setCapsLockOn(e)}_onConnected(){this._input.type=`password`,this._input.autocomplete=`off`,this._toggle=document.createElement(`button`),this._toggle.type=`button`,this._toggle.className=`adw-button flat circular icon-only ${this._classPrefix}-toggle`,this._toggleIcon=createAdwIcon(null),this._toggle.append(this._toggleIcon),this._toggle.addEventListener(`click`,()=>this._password.togglePeek()),this.addSuffix(this._toggle);let readCapsLock=e=>this._password.setCapsLockOn(e.getModifierState(`CapsLock`));this._input.addEventListener(`keydown`,readCapsLock),this._input.addEventListener(`keyup`,readCapsLock);let e=this._password.state;this.setIndicatorIconName(e.indicatorIconName),this.setIndicatorTooltip(e.indicatorTooltip),this.hasAttribute(`revealed`)&&this._password.setRevealed(this.getAttribute(`revealed`)!==`false`),this._renderPassword(this._password.state),this._password.subscribe(e=>{this._renderPassword(e),this.dispatchEvent(new CustomEvent(`notify::revealed`,{bubbles:!0,detail:{revealed:e.revealed}}))})}attributeChangedCallback(e,t,n){if(e!==`revealed`){super.attributeChangedCallback(e,t,n);return}this._initialized&&this._password.setRevealed(n!==null&&n!==`false`)}_renderPassword(e){this._input.type=e.revealed?`text`:`password`,this._toggleIcon.dataset.iconName=e.peekIconName,this._toggleIcon.iconName=e.peekIconName,this._toggle.title=e.peekLabel,this._toggle.setAttribute(`aria-label`,e.peekLabel),this._toggle.setAttribute(`aria-pressed`,String(e.revealed)),e.revealed?this.setAttribute(`revealed`,``):this.removeAttribute(`revealed`)}};customElements.define(`adw-password-entry-row`,AdwPasswordEntryRow);const ze={schedule:(e,t)=>setTimeout(e,t),cancel:e=>clearTimeout(e)};var AdwToastOverlay=class extends HTMLElement{_toasts;_initialized=!1;_queue;_scheduler=ze;_currentEl=null;_actions=new WeakMap;constructor(){super(),this._queue=new AdwToastQueue({scheduler:{schedule:(e,t)=>this._scheduler.schedule(e,t),cancel:e=>this._scheduler.cancel(e)},onShow:e=>this._mountToast(e),onHide:()=>this._unmountToast(this._queue.pending>0)})}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=document.createElement(`div`);e.className=`adw-toast-overlay-content`;for(let t of Array.from(this.childNodes))e.appendChild(t);this._toasts=document.createElement(`div`),this._toasts.className=`adw-toast-overlay-toasts`,this.replaceChildren(e,this._toasts)}get scheduler(){return this._scheduler}set scheduler(e){this._scheduler=e}get currentToast(){return this._queue.current}get pendingToasts(){return this._queue.pending}addToast(e,t={}){this._toasts||this.connectedCallback();let n=typeof t==`number`?{timeout:t/1e3}:t,r=new AdwToast(e,{timeout:(n.timeout??5)*1e3,buttonLabel:n.buttonLabel});n.onAction&&this._actions.set(r,n.onAction),this._queue.add(r)}dismiss(){this._queue.dismiss()}clearToasts(){this._queue.clear()}_mountToast(e){let t=document.createElement(`div`);t.className=`adw-toast`;let n=document.createElement(`div`);n.className=`adw-toast-content-wrapper`;let r=document.createElement(`span`);if(r.className=`adw-toast-title`,r.textContent=e.title,n.appendChild(r),t.appendChild(n),e.hasButton){let n=document.createElement(`button`);n.type=`button`,n.className=`adw-toast-action-button`,n.textContent=e.buttonLabel,n.addEventListener(`click`,()=>{this._actions.get(e)?.(),this._queue.dismiss()}),t.appendChild(n)}let i=document.createElement(`button`);i.type=`button`,i.className=`adw-toast-close-button`,i.setAttribute(`aria-label`,`Close`),i.appendChild(createAdwIcon(`window-close`)),i.addEventListener(`click`,()=>this._queue.dismiss()),t.appendChild(i),this._toasts.appendChild(t),this._currentEl=t,requestAnimationFrame(()=>{t.classList.add(`visible`)})}_unmountToast(e){let t=this._currentEl;if(this._currentEl=null,t){if(e){t.remove();return}t.classList.remove(`visible`),t.classList.add(`hiding`),t.addEventListener(`transitionend`,()=>t.remove(),{once:!0}),this._scheduler.schedule(()=>{t.parentNode&&t.remove()},300)}}};customElements.define(`adw-toast-overlay`,AdwToastOverlay);var AdwToolbarView=class extends HTMLElement{_topEl;_contentEl;_bottomEl;_initialized=!1;_resize=null;_shading=null;static get observedAttributes(){return[`top-bar-style`,`bottom-bar-style`,`extend-content-to-top-edge`,`extend-content-to-bottom-edge`]}get topBar(){return this._topEl}get contentArea(){return this._contentEl}get bottomBar(){return this._bottomEl}connectedCallback(){if(!this._initialized){this._initialized=!0;let e=Array.from(this.querySelectorAll(`:scope > [slot="top"]`)),t=Array.from(this.querySelectorAll(`:scope > [slot="bottom"]`)),n=Array.from(this.childNodes).filter(n=>!e.includes(n)&&!t.includes(n));this._topEl=document.createElement(`div`),this._topEl.className=`adw-toolbar-view-top`;for(let t of e)this._topEl.appendChild(t);this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-toolbar-view-content`;for(let e of n)this._contentEl.appendChild(e);this._bottomEl=document.createElement(`div`),this._bottomEl.className=`adw-toolbar-view-bottom`;for(let e of t)this._bottomEl.appendChild(e);bindEmptySections(this._topEl,this._bottomEl),this.replaceChildren(this._topEl,this._contentEl,this._bottomEl)}this._shading=new AdwScrollShading(this._contentEl),this._shading.connect(),this._resize=new ResizeObserver(()=>this._syncClasses()),this._resize.observe(this._topEl),this._resize.observe(this._bottomEl),this._syncClasses()}disconnectedCallback(){this._resize?.disconnect(),this._resize=null,this._shading?.disconnect(),this._shading=null}attributeChangedCallback(){this._initialized&&this._syncClasses()}_syncClasses(){let{view:e,topBar:t,bottomBar:n}=toolbarViewClasses({topBarStyle:parseToolbarStyle(this.getAttribute(`top-bar-style`)),bottomBarStyle:parseToolbarStyle(this.getAttribute(`bottom-bar-style`)),extendContentToTopEdge:this.hasAttribute(`extend-content-to-top-edge`),extendContentToBottomEdge:this.hasAttribute(`extend-content-to-bottom-edge`),topBarHeight:this._topEl.offsetHeight,bottomBarHeight:this._bottomEl.offsetHeight});for(let t of ae)this.classList.toggle(t,e.includes(t));for(let e of oe)this._topEl.classList.toggle(e,t.includes(e)),this._bottomEl.classList.toggle(e,n.includes(e));this._shading?.setUndershootEdges({top:e.includes(`undershoot-top`),bottom:e.includes(`undershoot-bottom`)})}};customElements.define(`adw-toolbar-view`,AdwToolbarView);const Be=[`child-spacing`,`child-spacing-unit`,`pack-direction`,`align`,`justify`,`justify-last-line`,`line-spacing`,`line-spacing-unit`,`line-homogeneous`,`natural-line-length`,`natural-line-length-unit`,`wrap-reverse`,`wrap-policy`,`orientation`];function alignToJustifyContent(e){return e<.25?`flex-start`:e<.75?`center`:`flex-end`}var AdwWrapBox=class extends HTMLElement{_initialized=!1;static get observedAttributes(){return[...Be]}get childSpacing(){return normalizeWrapBoxSpacing(this.getAttribute(`child-spacing`))}set childSpacing(e){this.setAttribute(`child-spacing`,String(e))}get childSpacingUnit(){return normalizeWrapBoxLengthUnit(this.getAttribute(`child-spacing-unit`))}set childSpacingUnit(e){this.setAttribute(`child-spacing-unit`,e)}get lineSpacing(){return normalizeWrapBoxSpacing(this.getAttribute(`line-spacing`))}set lineSpacing(e){this.setAttribute(`line-spacing`,String(e))}get lineSpacingUnit(){return normalizeWrapBoxLengthUnit(this.getAttribute(`line-spacing-unit`))}set lineSpacingUnit(e){this.setAttribute(`line-spacing-unit`,e)}get align(){return normalizeWrapBoxAlign(this.getAttribute(`align`))}set align(e){this.setAttribute(`align`,String(e))}get justify(){return normalizeWrapBoxJustify(this.getAttribute(`justify`))}set justify(e){this.setAttribute(`justify`,e)}get justifyLastLine(){return this.hasAttribute(`justify-last-line`)}set justifyLastLine(e){this.toggleAttribute(`justify-last-line`,!!e)}get wrapPolicy(){return normalizeWrapPolicy(this.getAttribute(`wrap-policy`))}set wrapPolicy(e){this.setAttribute(`wrap-policy`,e)}get packDirection(){return normalizeWrapBoxPackDirection(this.getAttribute(`pack-direction`))}set packDirection(e){this.setAttribute(`pack-direction`,e)}get wrapReverse(){return this.hasAttribute(`wrap-reverse`)}set wrapReverse(e){this.toggleAttribute(`wrap-reverse`,!!e)}get lineHomogeneous(){return this.hasAttribute(`line-homogeneous`)}set lineHomogeneous(e){this.toggleAttribute(`line-homogeneous`,!!e)}get naturalLineLength(){return normalizeNaturalLineLength(this.getAttribute(`natural-line-length`))}set naturalLineLength(e){this.setAttribute(`natural-line-length`,String(e))}get naturalLineLengthUnit(){return normalizeWrapBoxLengthUnit(this.getAttribute(`natural-line-length-unit`))}set naturalLineLengthUnit(e){this.setAttribute(`natural-line-length-unit`,e)}get orientation(){return this.getAttribute(`orientation`)===`vertical`?`vertical`:`horizontal`}set orientation(e){this.setAttribute(`orientation`,e)}get _children(){return[...this.children]}insertChildAfter(e,t=null){return this._applyOrder(`insert-after`,e,t)}reorderChildAfter(e,t=null){return this._applyOrder(`reorder-after`,e,t)}removeAll(){for(let e of this._children)this.removeChild(e)}_applyOrder(e,t,n){let r=resolveWrapBoxChildOrder({children:this._children,child:t,sibling:n,op:e});if(r===null)return!1;let i=r.indexOf(t);return this.insertBefore(t,r[i+1]??null),!0}connectedCallback(){this._initialized||(this._initialized=!0,this._sync())}attributeChangedCallback(e,t,n){if(!this._initialized)return;this._sync();let r=this._normalized(e,n);r!==this._normalized(e,t)&&this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:r}}))}_normalized(e,t){switch(e){case`child-spacing`:case`line-spacing`:return normalizeWrapBoxSpacing(t);case`child-spacing-unit`:case`line-spacing-unit`:case`natural-line-length-unit`:return normalizeWrapBoxLengthUnit(t);case`align`:return normalizeWrapBoxAlign(t);case`justify`:return normalizeWrapBoxJustify(t);case`wrap-policy`:return normalizeWrapPolicy(t);case`pack-direction`:return normalizeWrapBoxPackDirection(t);case`natural-line-length`:return normalizeNaturalLineLength(t);case`orientation`:return t===`vertical`?`vertical`:`horizontal`;default:return t!==null}}_sync(){let e=this.style,t=this.orientation===`vertical`,n=t?`column`:`row`;e.flexDirection=this.packDirection===`end-to-start`?`${n}-reverse`:n,e.flexWrap=this.wrapReverse?`wrap-reverse`:`wrap`;let r=`${wrapBoxLengthToPx(this.childSpacing,this.childSpacingUnit)}px`,i=`${wrapBoxLengthToPx(this.lineSpacing,this.lineSpacingUnit)}px`;t?(e.rowGap=r,e.columnGap=i):(e.columnGap=r,e.rowGap=i),e.setProperty(`--adw-wrap-box-child-spacing`,r);let a=this.justify,o=this.justifyLastLine,s=this.align,c=resolveWrapBoxLine({justify:a,justifyLastLine:o,align:s,lastLine:!1,childrenInLine:2}),l=resolveWrapBoxLine({justify:a,justifyLastLine:o,align:s,lastLine:!0,childrenInLine:2});this.dataset.lineJustify=c.justify,this.dataset.lastLineJustify=l.justify,e.justifyContent=c.growGaps?`space-between`:alignToJustifyContent(c.align),e.alignContent=this.lineHomogeneous?`stretch`:`flex-start`,e.setProperty(`--adw-wrap-box-child-shrink`,String(wrapPolicyFlexShrink(this.wrapPolicy)));let u=wrapBoxLengthToPx(this.naturalLineLength,this.naturalLineLengthUnit),d=u===-1?``:`${u}px`;e.maxWidth=t?``:d,e.maxHeight=t?d:``}};customElements.define(`adw-wrap-box`,AdwWrapBox);const Ve={animate(e){let t=0,n=!1,r=performance.now(),step=i=>{if(n)return;let a=Math.min((i-r)/250,1),o=1-(1-a)*(1-a);if(e.onValue(e.from+(e.to-e.from)*o),a<1){t=requestAnimationFrame(step);return}e.onValue(e.to),e.onDone()};return t=requestAnimationFrame(step),{cancel(){n=!0,t&&cancelAnimationFrame(t)}}}};function readTriStateAttr(e,t,n){let r=e.getAttribute(t);return r===null?n:r!==`false`&&r!==`0`}var AdwOverlaySplitView=class extends HTMLElement{_initialized=!1;_sidebarEl;_contentEl;_backdropEl;_disposeBreakpoint;_breakpointApplied=!1;_state=new OverlaySplitViewState;_reflecting=!1;_measuredWidth=0;_resizeObserver;_swipePointer=null;_swipeOrigin={x:0,progress:0};static get observedAttributes(){return[`show-sidebar`,`collapsed`,`pin-sidebar`,`sidebar-position`,`min-sidebar-width`,`max-sidebar-width`,`sidebar-width-fraction`,`enable-show-gesture`,`enable-hide-gesture`,`breakpoint`]}get showSidebar(){return this._state.showSidebar}set showSidebar(e){this.setAttribute(`show-sidebar`,e?``:`false`)}get collapsed(){return this._state.collapsed}set collapsed(e){e?this.setAttribute(`collapsed`,``):this.removeAttribute(`collapsed`)}get minSidebarWidth(){return parseFloat(this.getAttribute(`min-sidebar-width`)||`180`)}get maxSidebarWidth(){return parseFloat(this.getAttribute(`max-sidebar-width`)||`280`)}get sidebarWidthFraction(){return parseFloat(this.getAttribute(`sidebar-width-fraction`)||`0.25`)}connectedCallback(){this._buildOnce(),this._bindToDocument(),this._reflectShowSidebar(),this._syncClasses(),this._syncSidebarWidth(),this._syncBreakpoint()}_buildOnce(){if(this._initialized)return;this._initialized=!0;let e=Array.from(this.querySelectorAll(`[slot="sidebar"]`)),t=Array.from(this.querySelectorAll(`[slot="content"]`)),n=Array.from(this.childNodes).filter(n=>!e.includes(n)&&!t.includes(n));this.replaceChildren(),this._sidebarEl=document.createElement(`div`),this._sidebarEl.className=`adw-osv-sidebar`,e.forEach(e=>this._sidebarEl.appendChild(e)),this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-osv-content`,t.forEach(e=>this._contentEl.appendChild(e)),n.forEach(e=>this._contentEl.appendChild(e)),this._backdropEl=document.createElement(`div`),this._backdropEl.className=`adw-osv-backdrop`,this._backdropEl.addEventListener(`click`,()=>this.hideSidebar()),this.append(this._sidebarEl,this._contentEl,this._backdropEl),this._state=new OverlaySplitViewState({collapsed:this.hasAttribute(`collapsed`),showSidebar:readTriStateAttr(this,`show-sidebar`,!0),pinSidebar:this.hasAttribute(`pin-sidebar`),sidebarPosition:this.getAttribute(`sidebar-position`)===`end`?`end`:`start`,enableShowGesture:readTriStateAttr(this,`enable-show-gesture`,!0),enableHideGesture:readTriStateAttr(this,`enable-hide-gesture`,!0),animator:Ve}),this._state.subscribe(()=>{this._reflectShowSidebar(),this._syncClasses()}),this.addEventListener(`keydown`,this._onKeyDown),this._bindSwipe()}_bindToDocument(){this._resizeObserver?.disconnect(),this._resizeObserver=new ResizeObserver(e=>{let t=e[e.length-1];if(!t)return;let n=t.borderBoxSize?.[0];this._measuredWidth=n?n.inlineSize:t.contentRect.width,this._syncSidebarWidth(),this._syncClasses()}),this._resizeObserver.observe(this),this._measuredWidth=this.offsetWidth}disconnectedCallback(){this._disposeBreakpoint?.(),this._disposeBreakpoint=void 0,this._resizeObserver?.disconnect(),this._resizeObserver=void 0}_onKeyDown=e=>{e.key!==`Escape`||e.defaultPrevented||this._state.escape()&&e.preventDefault()};attributeChangedCallback(e,t,n){if(this._initialized){if(e===`breakpoint`){this._syncBreakpoint();return}this._readAttribute(e),(e===`min-sidebar-width`||e===`max-sidebar-width`||e===`sidebar-width-fraction`||e===`collapsed`)&&this._syncSidebarWidth(),this._syncClasses()}}_readAttribute(e){let t=this._state;if(e===`pin-sidebar`&&t.setPinSidebar(this.hasAttribute(`pin-sidebar`)),e===`sidebar-position`){let e=this.getAttribute(`sidebar-position`);t.setSidebarPosition(e===`end`?`end`:`start`)}e===`show-sidebar`&&t.setShowSidebar(readTriStateAttr(this,`show-sidebar`,!0)),e===`enable-show-gesture`&&t.setEnableShowGesture(readTriStateAttr(this,`enable-show-gesture`,!0)),e===`enable-hide-gesture`&&t.setEnableHideGesture(readTriStateAttr(this,`enable-hide-gesture`,!0)),e===`collapsed`&&t.setCollapsed(this.hasAttribute(`collapsed`)),this._reflectShowSidebar()}_reflectShowSidebar(){if(this._reflecting)return;let e=this._state.showSidebar?``:`false`;if(this.getAttribute(`show-sidebar`)!==e){this._reflecting=!0;try{this.setAttribute(`show-sidebar`,e)}finally{this._reflecting=!1}}}_syncBreakpoint(){this._disposeBreakpoint?.(),this._disposeBreakpoint=bindBreakpointSetter(this,this.getAttribute(`breakpoint`),e=>{this._breakpointApplied=e,this.collapsed=e},this._breakpointApplied)}openSidebar(){this.showSidebar=!0,this.dispatchEvent(new CustomEvent(`sidebar-toggled`,{detail:{isVisible:!0}}))}hideSidebar(){this.showSidebar=!1,this.dispatchEvent(new CustomEvent(`sidebar-toggled`,{detail:{isVisible:!1}}))}toggleSidebar(){this.showSidebar=!this.showSidebar,this.dispatchEvent(new CustomEvent(`sidebar-toggled`,{detail:{isVisible:this.showSidebar}}))}get _direction(){return getComputedStyle(this).direction===`rtl`?`rtl`:`ltr`}get _widthSpec(){return{minSidebarWidth:this.minSidebarWidth,maxSidebarWidth:this.maxSidebarWidth,sidebarWidthFraction:this.sidebarWidthFraction}}get _sidebarWidth(){return resolveOverlaySidebarWidth({...this._widthSpec,totalWidth:this._measuredWidth,collapsed:this._state.collapsed})}_syncClasses(){let e=this._state;this.classList.toggle(`collapsed`,e.collapsed),this.classList.toggle(`show-sidebar`,e.showSidebar);let t=isSidebarAtVisualStart(e.sidebarPosition,this._direction);this.classList.toggle(`sidebar-start`,e.sidebarPosition===`start`),this.classList.toggle(`sidebar-end`,e.sidebarPosition===`end`),this.classList.toggle(`sidebar-at-visual-start`,t),this._sidebarEl?.classList.toggle(`sidebar-pane`,!e.collapsed),this._sidebarEl?.classList.toggle(`overlay-pane`,e.collapsed),this._contentEl?.classList.toggle(`content-pane`,!e.collapsed),this._backdropEl&&(this._backdropEl.hidden=!e.shieldVisible),this._sidebarEl?.setAttribute(`aria-hidden`,String(!e.sidebarFocusable)),this._contentEl?.setAttribute(`aria-hidden`,String(!e.contentFocusable)),this._syncGeometry()}_syncGeometry(){let e=this._sidebarEl;if(!e)return;if(this._measuredWidth<=0){for(let t of[`left`,`marginLeft`,`marginRight`,`width`,`minWidth`,`maxWidth`,`opacity`,`pointerEvents`])e.style[t]=``;this._backdropEl&&(this._backdropEl.style.opacity=``);return}let t=this._state,n=this._sidebarWidth,r=layoutOverlaySplitView({totalWidth:this._measuredWidth,sidebarWidth:n,showProgress:t.showProgress,collapsed:t.collapsed,sidebarPosition:t.sidebarPosition,direction:this._direction}),i=isSidebarAtVisualStart(t.sidebarPosition,this._direction);if(e.style.width=`${r.sidebar.width}px`,t.collapsed)e.style.marginLeft=``,e.style.marginRight=``,e.style.insetInlineStart=``,e.style.left=`${r.sidebar.x}px`;else{e.style.left=``;let r=n-Math.trunc(n*Math.min(t.showProgress,1));e.style.marginLeft=i?`${-r}px`:``,e.style.marginRight=i?``:`${-r}px`}e.style.opacity=t.showProgress<=0?`0`:`1`,e.style.pointerEvents=t.sidebarPainted?``:`none`,this._backdropEl&&(this._backdropEl.style.opacity=String(1-r.shadowProgress))}_syncSidebarWidth(){if(!this._sidebarEl)return;let e=resolveSidebarBounds(this._widthSpec,0,{ceil:!0});this._sidebarEl.style.minWidth=`${e.min}px`,this._sidebarEl.style.maxWidth=`${e.max}px`,this._syncGeometry()}_bindSwipe(){this.addEventListener(`pointerdown`,e=>{if(this._swipePointer!==null||e.button!==0)return;let t=this._state,n=this.getBoundingClientRect(),r=resolveSwipeArea({isDrag:!0,sidebarWidth:this._sidebarWidth,showProgress:t.showProgress,totalWidth:n.width,totalHeight:n.height,sidebarPosition:t.sidebarPosition,direction:this._direction}),i=e.clientX-n.left,a=e.clientY-n.top;i<r.x||i>r.x+r.width||a<r.y||a>r.y+r.height||(this._swipePointer=e.pointerId,this._swipeOrigin={x:e.clientX,progress:t.showProgress})}),this.addEventListener(`pointermove`,e=>{if(e.pointerId!==this._swipePointer)return;let t=this._state,n=this._sidebarWidth||1,r=isSidebarAtVisualStart(t.sidebarPosition,this._direction),i=(e.clientX-this._swipeOrigin.x)/n*(r?1:-1);if(!t.swipeActive){if(!resolveSwipeStart({showProgress:t.showProgress,collapsed:t.collapsed,direction:i>=0?`forward`:`back`,enableShowGesture:t.enableShowGesture,enableHideGesture:t.enableHideGesture})){this._swipePointer=null;return}t.beginSwipe();try{this.setPointerCapture(e.pointerId)}catch{}}t.setShowProgress(this._swipeOrigin.progress+i)});let release=(e,t)=>{if(e.pointerId!==this._swipePointer)return;this._swipePointer=null;let n=this._state;if(!n.swipeActive)return;this.hasPointerCapture(e.pointerId)&&this.releasePointerCapture(e.pointerId);let r=resolveSwipeSnapPoints({showProgress:n.showProgress,enableShowGesture:n.enableShowGesture,enableHideGesture:n.enableHideGesture,swipeActive:!0}),i=t?swipeCancelProgress(n.showProgress):r.reduce((e,t)=>Math.abs(t-n.showProgress)<Math.abs(e-n.showProgress)?t:e);n.endSwipe(i)};this.addEventListener(`pointerup`,e=>release(e,!1)),this.addEventListener(`pointercancel`,e=>release(e,!0))}};customElements.define(`adw-overlay-split-view`,AdwOverlaySplitView);var AdwNavigationSplitView=class extends HTMLElement{_sidebarEl;_contentEl;_initialized=!1;_disposeBreakpoint;_breakpointApplied=!1;_state=new NavigationSplitViewState;_reflecting=!1;static get observedAttributes(){return[`collapsed`,`show-content`,`sidebar-position`,`min-sidebar-width`,`max-sidebar-width`,`breakpoint`]}get collapsed(){return this._initialized?this._state.collapsed:this.hasAttribute(`collapsed`)}set collapsed(e){this.toggleAttribute(`collapsed`,e)}get showContent(){return this._initialized?this._state.showContent:this.hasAttribute(`show-content`)}set showContent(e){this.toggleAttribute(`show-content`,e)}get sidebarPosition(){return this.getAttribute(`sidebar-position`)===`end`?`end`:`start`}set sidebarPosition(e){this.setAttribute(`sidebar-position`,e)}get sidebarTag(){return this._state.sidebarTag}get contentTag(){return this._state.contentTag}push(e){return this._state.push(e)}pop(){return this._state.pop()}connectedCallback(){this._buildOnce(),this._reflectShowContent(),this._syncWidth(),this._syncClasses(),this._syncBreakpoint()}_buildOnce(){if(this._initialized)return;this._initialized=!0;let e=Array.from(this.querySelectorAll(`:scope > [slot="sidebar"]`)),t=Array.from(this.querySelectorAll(`:scope > [slot="content"]`));this._sidebarEl=document.createElement(`div`),this._sidebarEl.className=`adw-nsv-sidebar`;for(let t of e)this._sidebarEl.appendChild(t);this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-nsv-content`;for(let e of t)this._contentEl.appendChild(e);this.replaceChildren(this._sidebarEl,this._contentEl),this._state=new NavigationSplitViewState({sidebarPosition:this.sidebarPosition,collapsed:this.hasAttribute(`collapsed`),showContent:this.hasAttribute(`show-content`),onCritical:e=>console.error(e),onDelegate:(e,t)=>{let n={tag:t,handled:!1};return this.dispatchEvent(new CustomEvent(`navigation-${e}`,{bubbles:!0,detail:n})),n.handled}}),this._state.setSidebar(e.length>0?{tag:this._tagOf(e)}:null),this._state.setContent(t.length>0?{tag:this._tagOf(t)}:null),this._state.subscribe(()=>{this._reflectShowContent(),this._syncClasses()})}_tagOf(e){for(let t of e){let e=t.getAttribute(`tag`);if(e!==null)return e}return null}_reflectShowContent(){if(this._reflecting)return;let e=this._state.showContent;if(this.hasAttribute(`show-content`)!==e){this._reflecting=!0;try{this.toggleAttribute(`show-content`,e)}finally{this._reflecting=!1}}}disconnectedCallback(){this._disposeBreakpoint?.(),this._disposeBreakpoint=void 0}attributeChangedCallback(e){if(this._initialized){if(e===`breakpoint`){this._syncBreakpoint();return}if(e===`min-sidebar-width`||e===`max-sidebar-width`){this._syncWidth();return}e===`collapsed`&&this._state.setCollapsed(this.hasAttribute(`collapsed`)),e===`show-content`&&this._state.setShowContent(this.hasAttribute(`show-content`)),e===`sidebar-position`&&this._state.setSidebarPosition(this.sidebarPosition),this._syncClasses(),this._syncWidth()}}_syncWidth(){if(this.collapsed){this._sidebarEl.style.minWidth=``,this._sidebarEl.style.maxWidth=``;return}let e=resolveSidebarBounds({minSidebarWidth:this._widthAttr(`min-sidebar-width`,180),maxSidebarWidth:this._widthAttr(`max-sidebar-width`,280)},0,{ceil:!0});this._sidebarEl.style.minWidth=`${e.min}px`,this._sidebarEl.style.maxWidth=`${e.max}px`}_widthAttr(e,t){let n=this.getAttribute(e);if(n===null)return t;let r=parseFloat(n);return Number.isFinite(r)?r:t}get _direction(){return getComputedStyle(this).direction===`rtl`?`rtl`:`ltr`}_syncClasses(){let e=this._state;this.classList.toggle(`collapsed`,e.collapsed),this.classList.toggle(`show-content`,e.showContent),this.classList.toggle(`sidebar-end`,e.sidebarPosition===`end`),this.classList.toggle(`sidebar-at-visual-start`,isSidebarAtVisualStart(e.sidebarPosition,this._direction)),this._sidebarEl?.classList.toggle(`sidebar-pane`,!e.collapsed),this._contentEl?.classList.toggle(`content-pane`,!e.collapsed);let{stack:t}=e.stack,n=t[t.length-1]??null;this._sidebarEl&&(this._sidebarEl.dataset.paneVisible=String(!e.collapsed||n===`sidebar`)),this._contentEl&&(this._contentEl.dataset.paneVisible=String(!e.collapsed||n===`content`))}_syncBreakpoint(){this._disposeBreakpoint?.(),this._disposeBreakpoint=bindBreakpointSetter(this,this.getAttribute(`breakpoint`),e=>{this._breakpointApplied=e,this.collapsed=e},this._breakpointApplied)}};customElements.define(`adw-navigation-split-view`,AdwNavigationSplitView);function attachSwipeDrag(e){let t=new SwipeTracker({points:e.points,allowLongSwipes:e.allowLongSwipes,cancelProgress:e.cancelProgress}),n=null,r=0,i=0,a=0,o=0,s=0,c=`none`,l=null,u=!1,axisOffset=(t,n)=>e.orientation===`vertical`?n:t,progressOffset=(e,t)=>-axisOffset(e,t),release=()=>{let r=n;n=null,c=`none`,t.reset(),globalThis.removeEventListener(`pointermove`,onMove,!0),globalThis.removeEventListener(`pointerup`,onFinish,!0),globalThis.removeEventListener(`pointercancel`,onCancel,!0),globalThis.removeEventListener(`lostpointercapture`,onLostCapture,!0),r!==null&&e.host.hasPointerCapture(r)&&e.host.releasePointerCapture(r),l!==null&&(e.host.style.scrollSnapType=l.scrollSnapType,e.host.style.scrollBehavior=l.scrollBehavior,e.host.style.userSelect=l.userSelect,l=null)},claimAllowed=t=>{let n=e.points();if(n.length===0)return!1;let a=n[0],c=n[n.length-1];if(Math.abs(a-c)<2**-52)return!1;let l=e.progress(),u=t<0&&(Math.abs(l-a)<2**-52||l<a),d=t>0&&(Math.abs(l-c)<2**-52||l>c);return u||d?!1:e.claimable===void 0?!0:e.claimable({x:r,y:i})||e.claimable({x:o,y:s})},claim=()=>{c=`scrolling`,n!==null&&e.host.setPointerCapture(n),l={scrollSnapType:e.host.style.scrollSnapType,scrollBehavior:e.host.style.scrollBehavior,userSelect:e.host.style.userSelect},e.host.style.scrollSnapType=`none`,e.host.style.scrollBehavior=`auto`,e.host.style.userSelect=`none`},arm=()=>{globalThis.addEventListener(`pointermove`,onMove,!0),globalThis.addEventListener(`pointerup`,onFinish,!0),globalThis.addEventListener(`pointercancel`,onCancel,!0),globalThis.addEventListener(`lostpointercapture`,onLostCapture,!0)};e.host.addEventListener(`pointerdown`,t=>{if(u=!1,n!==null){if(t.pointerId!==n)return;release()}t.pointerType!==`mouse`||t.button!==0||e.enabled()&&t.target?.closest(`select, textarea, input[type="range"], [contenteditable=""], [contenteditable="true"]`)===null&&(n=t.pointerId,r=t.clientX,i=t.clientY,o=t.clientX,s=t.clientY,a=0,c=`pending`,arm())});function onMove(l){if(n!==l.pointerId)return;o=l.clientX,s=l.clientY;let u=l.clientX-r,d=l.clientY-i,f=progressOffset(u,d),p=f-a;a=f;let m=Math.trunc(l.timeStamp);if(t.record(p,m),!(l.buttons&1)){release();return}if(c===`pending`){if(Math.abs(d)>Math.abs(u)!=(e.orientation===`vertical`)){release();return}if(Math.hypot(u,d)<16)return;if(!claimAllowed(f)){release();return}t.prepare(e.progress()),claim(),a=f;return}c===`scrolling`&&(l.preventDefault(),e.onUpdate(t.advance(p,e.pitch())))}function finish(r,i){if(n!==r.pointerId)return;if(c!==`scrolling`){release();return}i&&t.cancel();let{to:a,velocity:o}=t.end(Math.trunc(r.timeStamp));release(),u=!0,e.onEnd(a,o)}function onFinish(e){finish(e,!1)}function onCancel(e){finish(e,!0)}function onLostCapture(e){finish(e,!1)}return e.host.addEventListener(`click`,e=>{u&&(u=!1,e.stopPropagation(),e.preventDefault())},{capture:!0}),{get dragging(){return c===`scrolling`}}}function wheelSource(e){if(e.deltaMode!==0)return`mouse`;let t=Math.abs(e.deltaY),n=Math.abs(e.deltaX);if(n>0&&t>0)return`touchpad`;let r=Math.max(n,t);return!Number.isInteger(r)||r<40?`touchpad`:`mouse`}var AdwCarousel=class extends HTMLElement{_state=new CarouselState({animateScroll:!0,onScrollTo:e=>this._performScroll(e)});_trackEl;_slots=new Map;_nextPageId=0;_scrollRaf=0;_initialized=!1;_pendingPosition=null;_pendingLayout;_layoutObserver;_pendingInteractive=null;_scrollTargetId=null;_drag;static get observedAttributes(){return[`allow-scroll-wheel`,`allow-mouse-drag`,`allow-long-swipes`,`interactive`,`spacing`,`position`]}constructor(){super(),this._state.subscribe(e=>this._onStateChange(e)),this._state.onPageChanged(e=>{this.dispatchEvent(new CustomEvent(`page-changed`,{bubbles:!0,detail:{index:e}}))})}get nPages(){return this._state.nPages}get position(){return this._state.position}set position(e){this._scrollToPosition(e)}get currentPage(){return this._state.pageAt(this._state.position)}get allowMouseDrag(){return this._state.allowMouseDrag}set allowMouseDrag(e){this.setAttribute(`allow-mouse-drag`,e?`true`:`false`)}get allowScrollWheel(){return this._state.allowScrollWheel}set allowScrollWheel(e){this.setAttribute(`allow-scroll-wheel`,e?`true`:`false`)}get allowLongSwipes(){return this._state.allowLongSwipes}set allowLongSwipes(e){this.toggleAttribute(`allow-long-swipes`,e)}get interactive(){return this._state.interactive}set interactive(e){this.setAttribute(`interactive`,e?`true`:`false`)}get spacing(){return this._state.spacing}set spacing(e){this.setAttribute(`spacing`,String(e))}connectedCallback(){this._initialized||this._build(),this._observeLayout()}_build(){this._initialized=!0,this._trackEl=document.createElement(`div`),this._trackEl.className=`adw-carousel-track`,this._trackEl.style.setProperty(`scroll-behavior`,`smooth`),this._applyAttribute(`allow-scroll-wheel`,this.getAttribute(`allow-scroll-wheel`)),this._applyAttribute(`allow-mouse-drag`,this.getAttribute(`allow-mouse-drag`)),this._applyAttribute(`allow-long-swipes`,this.getAttribute(`allow-long-swipes`)),this._applyAttribute(`interactive`,this.getAttribute(`interactive`)),this._applyAttribute(`spacing`,this.getAttribute(`spacing`));let e=Array.from(this.children).filter(e=>e instanceof HTMLElement);this.replaceChildren(this._trackEl);for(let t of e)this._insert(t,-1);this._trackEl.addEventListener(`scroll`,this._onScroll,{passive:!0}),this._trackEl.addEventListener(`wheel`,this._onWheel,{passive:!1}),this._drag=attachSwipeDrag({host:this._trackEl,orientation:`horizontal`,enabled:()=>this._state.interactive&&this._state.allowMouseDrag,pitch:()=>this._distance(),points:()=>this._state.snapPoints,progress:()=>this._state.position,allowLongSwipes:()=>this._state.allowLongSwipes,cancelProgress:()=>{let e=this._state.snapPoints;return e[carouselClosestSnapPoint(this._state.position,e)]??this._state.position},onUpdate:e=>{let t=this._distance();t>0&&(this._trackEl.scrollLeft=e*t)},onEnd:e=>{let t=this._distance();t>0&&this._trackEl.scrollTo({left:e*t})}}),this._applyAttribute(`position`,this.getAttribute(`position`))}attributeChangedCallback(e,t,n){this._initialized&&this._applyAttribute(e,n)}disconnectedCallback(){this._cancelPendingPosition(),this._layoutObserver?.disconnect(),this._layoutObserver=void 0}_observeLayout(){this._layoutObserver||(this._layoutObserver=new ResizeObserver(()=>{this._allocatePages()&&this._applyScrollFromModel()}),this._layoutObserver.observe(this._trackEl,{box:`border-box`}))}_applyAttribute(e,t){switch(e){case`allow-scroll-wheel`:this._state.setAllowScrollWheel(t!==`false`);return;case`allow-mouse-drag`:this._state.setAllowMouseDrag(t!==`false`);return;case`allow-long-swipes`:this._state.setAllowLongSwipes(t!==null&&t!==`false`),this._applySnapStop();return;case`interactive`:this._state.setInteractive(t!==`false`);return;case`spacing`:{let e=t===null?0:Number.parseFloat(t);Number.isFinite(e)&&this._state.setSpacing(Math.max(0,e)),this._trackEl.style.columnGap=`${this._state.spacing}px`;return}case`position`:t!==null&&this._positionWhenMeasurable(Number.parseFloat(t))}}_positionWhenMeasurable(e){if(Number.isFinite(e)){if(this._trackEl.clientWidth>0){this._cancelPendingPosition(),this._scrollInstantly(e);return}this._pendingPosition=e,!this._pendingLayout&&(this._pendingLayout=new ResizeObserver(()=>{if(this._trackEl.clientWidth<=0)return;let e=this._pendingPosition;this._cancelPendingPosition(),e!==null&&this._scrollInstantly(e)}),this._pendingLayout.observe(this._trackEl))}}_scrollInstantly(e){let t=this._trackEl.style.getPropertyValue(`scroll-behavior`);this._trackEl.style.setProperty(`scroll-behavior`,`auto`);try{this._scrollToPosition(e)}finally{t?this._trackEl.style.setProperty(`scroll-behavior`,t):this._trackEl.style.removeProperty(`scroll-behavior`)}}_cancelPendingPosition(){this._pendingLayout?.disconnect(),this._pendingLayout=void 0,this._pendingPosition=null}_scrollToPosition(e){if(!Number.isFinite(e))return;let t=this._state.pageAt(e);t>=0&&this.scrollToPage(t)}insertPage(e,t=-1){return this._initialized?this._insert(e,t):(this.appendChild(e),!0)}appendPage(e){return this.insertPage(e,-1)}prependPage(e){return this.insertPage(e,0)}removePage(e){let t=this._idOf(e);return t===null||!this._state.removePage(t)?!1:(this._state.skipReveal(t),this._syncTrack(),!0)}reorderPage(e,t){let n=this._idOf(e);return n===null||!this._state.reorderPage(n,t)?!1:(this._syncTrack(),!0)}scrollToPage(e){this._state.scrollTo(e)}navigate(e){return this._state.navigate(e)}_insert(e,t){let n=`page-${this._nextPageId++}`;if(!this._state.insertPage(n,t))return!1;let r=document.createElement(`div`);return r.className=`adw-carousel-page`,r.appendChild(e),this._slots.set(n,r),this._state.skipReveal(n),this._syncTrack(),!0}_idOf(e){for(let[t,n]of this._slots)if(n.contains(e))return t;return null}_syncTrack(){let e=this._state.ids,t=new Set(e);for(let[e,n]of this._slots)t.has(e)||(n.remove(),this._slots.delete(e));e.forEach((e,t)=>{let n=this._slots.get(e);n&&this._trackEl.children[t]!==n&&this._trackEl.insertBefore(n,this._trackEl.children[t]??null)}),this._applySnapStop(),this._allocatePages(),this._applyScrollFromModel()}_allocatePages(){let e=[...this._slots.values()];if(e.length===0)return!1;let t=e[0].getBoundingClientRect().width;this._trackEl.style.removeProperty(`padding-inline`);for(let t of e)t.style.removeProperty(`flex-basis`);let n=this._trackEl.clientWidth;if(!(n>0))return!1;let{pageSize:r,leadingInset:i}=carouselPageAllocation(n,e.map(e=>({natural:e.firstElementChild?.getBoundingClientRect().width??0})));if(!(r>0))return!1;for(let t of e)t.style.flexBasis=`${r}px`;return i>0&&(this._trackEl.style.paddingInline=`${i}px`),Math.round(r)!==Math.round(t)}_applyScrollFromModel(){let e=this._distance();e>0&&this._trackEl.scrollTo({left:this._restorePosition()*e,behavior:`instant`})}_restorePosition(){if(this._scrollTargetId===null)return this._state.position;let e=this._state.ids.indexOf(this._scrollTargetId);return e<0?this._state.position:this._state.snapPointOf(e)??this._state.position}_applySnapStop(){let e=this._state.allowLongSwipes?`normal`:`always`;for(let t of this._slots.values())t.style.setProperty(`scroll-snap-stop`,e)}_distance(){let e=this._trackEl?.firstElementChild;return e?this._state.pageDistance(e.getBoundingClientRect().width):0}_performScroll(e){if(!this._trackEl)return;let t=this._distance();t>0&&(this._pendingInteractive=e.interactive,this._scrollTargetId=this._state.ids[e.index]??null,this._trackEl.scrollTo({left:e.index*t}))}_onScroll=()=>{this._scrollRaf||=requestAnimationFrame(()=>{this._scrollRaf=0,this._updatePositionFromScroll()})};_onWheel=e=>{if(this._drag?.dragging===!0){e.preventDefault();return}this._state.handleWheel({deltaX:e.deltaX,deltaY:e.deltaY,source:wheelSource(e)})!==0&&e.preventDefault()};_updatePositionFromScroll(){let e=this._distance();if(!(e>0))return;let t=this._trackEl.scrollLeft/e;this._state.setPosition(t,this._pendingInteractive??!0)&&this._state.settleIfArrived()&&(this._pendingInteractive=null,this._scrollTargetId=null)}_onStateChange(e){if(e.reason===`n-pages`){this.dispatchEvent(new CustomEvent(`notify::n-pages`,{bubbles:!0,detail:{nPages:e.nPages}}));return}e.reason===`position`&&this.dispatchEvent(new CustomEvent(`notify::position`,{bubbles:!0,detail:{position:e.position,page:e.page,interactive:e.interactive}}))}},AdwCarouselIndicator=class extends HTMLElement{_carousel=null;_initialized=!1;static get observedAttributes(){return[`for`]}get carousel(){return this._carousel}set carousel(e){e!==this._carousel&&(this._detach(),this._carousel=e,this._attach())}connectedCallback(){this._initialized=!0,this._carousel||this._resolveForAttr(),this._attach(),this._render()}disconnectedCallback(){this._detach()}attributeChangedCallback(e){e===`for`&&this._initialized&&(this._detach(),this._carousel=null,this._resolveForAttr(),this._attach(),this._render())}_resolveForAttr(){let e=this.getAttribute(`for`);if(!e)return;let t=this.getRootNode().getElementById?.(e)??document.getElementById(e);t instanceof AdwCarousel&&(this._carousel=t)}_attach(){!this._carousel||!this._initialized||(this._carousel.addEventListener(`notify::position`,this._onChange),this._carousel.addEventListener(`notify::n-pages`,this._onChange),this._render())}_detach(){this._carousel&&(this._carousel.removeEventListener(`notify::position`,this._onChange),this._carousel.removeEventListener(`notify::n-pages`,this._onChange))}_onChange=()=>{this._render()};nPages(){return this._carousel?.nPages??0}position(){return this._carousel?.position??0}currentPage(){return this._carousel?.currentPage??-1}goTo(e){this._carousel?.scrollToPage(e)}},AdwCarouselIndicatorDots=class extends AdwCarouselIndicator{_render(){renderIndicator(this,`adw-carousel-dot`,this.nPages(),this.position(),this.currentPage(),e=>this.goTo(e))}},AdwCarouselIndicatorLines=class extends AdwCarouselIndicator{_render(){renderIndicator(this,`adw-carousel-line`,this.nPages(),this.position(),this.currentPage(),e=>this.goTo(e))}};function renderIndicator(e,t,n,r,i,a){if(e.childElementCount!==n){let r=[];for(let e=0;e<n;e++){let n=document.createElement(`button`);n.type=`button`,n.className=t,n.setAttribute(`aria-label`,`Page ${e+1}`),n.addEventListener(`click`,()=>a(e)),r.push(n)}e.replaceChildren(...r)}Array.from(e.children).forEach((e,t)=>{let n=Math.max(0,1-Math.abs(r-t)),a=e;a.style.setProperty(`--adw-carousel-progress`,n.toFixed(3)),a.classList.toggle(`active`,t===i),a.setAttribute(`aria-current`,t===i?`true`:`false`)})}customElements.define(`adw-carousel`,AdwCarousel),customElements.define(`adw-carousel-indicator-dots`,AdwCarouselIndicatorDots),customElements.define(`adw-carousel-indicator-lines`,AdwCarouselIndicatorLines);const He=[`title`,`tooltip`,`icon`,`indicator-icon`,`loading`,`needs-attention`,`pinned`];var AdwTabPage=class extends HTMLElement{static get observedAttributes(){return He}attributeChangedCallback(e,t,n){this.closest(`adw-tab-view`)?.syncDeclaredPage(this,e,n)}},AdwTabView=class extends HTMLElement{_state=new TabViewState({onClosePage:e=>this._requestClose(e)});_barEl;_tabBoxEl;_pagesEl;_tabs=new Map;_panels=new Map;_hovered=new Set;_initialized=!1;_generatedIds=0;_reflecting=!1;static get observedAttributes(){return[`selected`,`autohide`,`expand-tabs`,`no-close`]}constructor(){super(),this._barEl=document.createElement(`div`),this._barEl.className=`adw-tab-bar`,this._barEl.setAttribute(`role`,`tablist`),this._tabBoxEl=document.createElement(`div`),this._tabBoxEl.className=`adw-tab-box`,this._barEl.appendChild(this._tabBoxEl),this._pagesEl=document.createElement(`div`),this._pagesEl.className=`adw-tab-view-pages`,this._state.subscribePages(e=>this._onPagesChange(e)),this._state.subscribe(e=>this._onSelectionChange(e))}get selected(){return this._state.selectedIndex}set selected(e){this._state.selectNthPage(e)}get autohide(){return this.hasAttribute(`autohide`)}set autohide(e){e?this.setAttribute(`autohide`,``):this.removeAttribute(`autohide`)}get expandTabs(){return this.hasAttribute(`expand-tabs`)}set expandTabs(e){e?this.setAttribute(`expand-tabs`,``):this.removeAttribute(`expand-tabs`)}get noClose(){return this.hasAttribute(`no-close`)}set noClose(e){e?this.setAttribute(`no-close`,``):this.removeAttribute(`no-close`)}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=this.getAttribute(`selected`),t=Array.from(this.querySelectorAll(`:scope > adw-tab-page`));this.replaceChildren(this._barEl,this._pagesEl);for(let e of t)this._adoptDeclaredPage(e);e!==null&&this._applySelectedAttribute(e),this._applyBarVisibility(),this._reflectSelected(),this.addEventListener(`keydown`,e=>this._onKeyDown(e))}attributeChangedCallback(e,t,n){if(this._initialized){if(e===`selected`){if(this._reflecting)return;let e=this.getAttribute(`selected`);e!==null&&this._applySelectedAttribute(e);return}this._applyBarVisibility()}}syncDeclaredPage(e,t,n){let r=e.dataset.pageId;if(r!==void 0)switch(t){case`title`:this._state.setPageTitle(r,n);return;case`tooltip`:this._state.setPageTooltip(r,n);return;case`icon`:this._state.setPageIcon(r,n);return;case`indicator-icon`:this._state.setPageIndicatorIcon(r,n);return;case`loading`:this._state.setPageLoading(r,n!==null);return;case`needs-attention`:this._state.setPageNeedsAttention(r,n!==null);return;case`pinned`:this._state.setPagePinned(r,n!==null);return}}get pages(){return this._state.pages}get nPages(){return this._state.nPages}get nPinnedPages(){return this._state.nPinnedPages}get selectedId(){return this._state.selectedId}get selectedIndex(){return this._state.selectedIndex}get selectedContent(){return this._state.selectedPage?.content??null}isClosing(e){return this._state.isClosing(e)}setSelectedPage(e){return this._state.setSelectedPage(e)}selectNthPage(e){return this._state.selectNthPage(e)}selectPreviousPage(){return this._state.selectPreviousPage()}selectNextPage(){return this._state.selectNextPage()}selectFirstPage(){return this._state.selectFirstPage()}selectLastPage(){return this._state.selectLastPage()}cycleNextPage(){return this._state.cycleNextPage()}cyclePreviousPage(){return this._state.cyclePreviousPage()}addPage(e,t=null){return this._state.addPage(this._withPanel(e),t)}insertPage(e,t){return this._state.insertPage(this._withPanel(e),t)}prependPage(e){return this._state.prependPage(this._withPanel(e))}appendPage(e){return this._state.appendPage(this._withPanel(e))}insertPinnedPage(e,t){return this._state.insertPinnedPage(this._withPanel(e),t)}prependPinnedPage(e){return this._state.prependPinnedPage(this._withPanel(e))}appendPinnedPage(e){return this._state.appendPinnedPage(this._withPanel(e))}setPagePinned(e,t){return this._state.setPagePinned(e,t)}closePage(e){return this._state.closePage(e)}closePageFinish(e,t){return this._state.closePageFinish(e,t)}closeOtherPages(e){this._state.closeOtherPages(e)}closePagesBefore(e){this._state.closePagesBefore(e)}closePagesAfter(e){this._state.closePagesAfter(e)}detachPage(e){return this._state.detachPage(e)}reorderPage(e,t){return this._state.reorderPage(e,t)}reorderBackward(e){return this._state.reorderBackward(e)}reorderForward(e){return this._state.reorderForward(e)}reorderFirst(e){return this._state.reorderFirst(e)}reorderLast(e){return this._state.reorderLast(e)}setPageTitle(e,t){return this._state.setPageTitle(e,t)}setPageTooltip(e,t){return this._state.setPageTooltip(e,t)}setPageIcon(e,t){return this._state.setPageIcon(e,t)}setPageLoading(e,t){return this._state.setPageLoading(e,t)}setPageNeedsAttention(e,t){return this._state.setPageNeedsAttention(e,t)}get diagnostics(){return this._state.diagnostics}_adoptDeclaredPage(e){let t={id:e.getAttribute(`page-id`)??this._nextId(),title:e.getAttribute(`title`),tooltip:e.getAttribute(`tooltip`),icon:e.getAttribute(`icon`),indicatorIcon:e.getAttribute(`indicator-icon`),loading:e.hasAttribute(`loading`),needsAttention:e.hasAttribute(`needs-attention`),content:e};e.hasAttribute(`pinned`)?this.appendPinnedPage(t):this.appendPage(t)}_withPanel(e){let t=e.content??document.createElement(`adw-tab-page`);return t.classList.add(`adw-tab-page`),t.setAttribute(`role`,`tabpanel`),t.dataset.pageId=e.id,{...e,content:t}}_nextId(){return this._generatedIds+=1,`tab-${this._generatedIds}`}_onPagesChange(e){switch(e.kind){case`attached`:{let t=this._state.getPage(e.id);t&&this._insertTab(t,e.position);break}case`detached`:this._tabs.get(e.id)?.remove(),this._tabs.delete(e.id),this._hovered.delete(e.id),this._panels.get(e.id)?.remove(),this._panels.delete(e.id);break;case`reordered`:case`pinned`:this._moveTab(e.id,e.position),this._refreshTab(e.id);break;case`updated`:this._refreshTab(e.id);break}this._applyBarVisibility(),this._applyActiveState(),this.dispatchEvent(new CustomEvent(`page-${e.kind}`,{bubbles:!0,detail:{id:e.id,position:e.position,previousPosition:e.previousPosition}}))}_insertTab(e,t){let n=document.createElement(`button`);n.type=`button`,n.className=`adw-tab`,n.setAttribute(`role`,`tab`),n.dataset.pageId=e.id;let r=createAdwIcon(null,`adw-tab-icon`);n.appendChild(r);let i=document.createElement(`adw-spinner`);i.className=`adw-tab-spinner`,i.setAttribute(`size`,`16`),i.hidden=!0,n.appendChild(i);let a=document.createElement(`span`);a.className=`adw-tab-title`,n.appendChild(a),n.appendChild(createAdwIcon(null,`adw-tab-indicator`));let o=document.createElement(`button`);o.type=`button`,o.className=`adw-tab-close`,o.tabIndex=-1,o.setAttribute(`aria-label`,`Close tab`),o.addEventListener(`click`,t=>{t.stopPropagation(),this._state.closePage(e.id)}),n.appendChild(o),n.addEventListener(`click`,()=>this._state.setSelectedPage(e.id)),n.addEventListener(`pointerenter`,()=>{this._hovered.add(e.id),this._refreshCloseVisibility(e.id)}),n.addEventListener(`pointerleave`,()=>{this._hovered.delete(e.id),this._refreshCloseVisibility(e.id)}),this._tabBoxEl.insertBefore(n,this._tabBoxEl.children[t]??null),this._tabs.set(e.id,n);let s=e.content;s&&(this._panels.set(e.id,s),this._pagesEl.insertBefore(s,this._pagesEl.children[t]??null)),this._refreshTab(e.id)}_moveTab(e,t){let n=this._tabs.get(e);n&&(n.remove(),this._tabBoxEl.insertBefore(n,this._tabBoxEl.children[t]??null));let r=this._panels.get(e);r&&(r.remove(),this._pagesEl.insertBefore(r,this._pagesEl.children[t]??null))}_refreshTab(e){let t=this._state.getPage(e),n=this._tabs.get(e);if(!t||!n)return;let r=n.querySelector(`.adw-tab-title`);r&&(r.textContent=t.title),n.title=tabTooltip(t),n.classList.toggle(`pinned`,t.pinned),n.classList.toggle(`needs-attention`,t.needsAttention),n.classList.toggle(`closing`,t.closing);let i=tabIconState(t,this.getAttribute(`default-icon`)),a=n.querySelector(`.adw-tab-icon`);a&&(a.iconName=i.icon,a.hidden=!i.iconVisible||i.spinner);let o=n.querySelector(`.adw-tab-spinner`);o&&(o.hidden=!(i.spinner&&i.iconVisible));let s=n.querySelector(`.adw-tab-indicator`);s&&(s.iconName=t.indicatorIcon,s.hidden=!i.indicatorVisible),this._refreshCloseVisibility(e)}_tabPosition(e){return e.getBoundingClientRect().left-this._barEl.getBoundingClientRect().left+this._barEl.scrollLeft}_refreshCloseVisibility(e){let t=this._state.getPage(e),n=this._tabs.get(e);if(!t||!n)return;let r=n.querySelector(`.adw-tab-close`);if(!r)return;let i=this._barEl.scrollLeft,a=this._tabPosition(n),o=a>=i&&a+n.offsetWidth<=i+this._barEl.clientWidth;r.hidden=!tabCloseVisible({hovering:this._hovered.has(e),fullyVisible:o,selected:this._state.selectedId===e,dragging:!1,pinned:t.pinned})}_onSelectionChange(e){this._applyActiveState(),this._scrollSelectedTabIntoBar(),this._reflectSelected(),this.dispatchEvent(new CustomEvent(`notify::selected-page`,{bubbles:!0,detail:{selected:e.selectedIndex,selectedId:e.selectedId,previousId:e.previousId,interactive:e.interactive}}))}_applyActiveState(){let e=this._state.selectedId;for(let t of this._state.pages){let n=t.id===e,r=this._tabs.get(t.id);r&&(r.classList.toggle(`active`,n),r.setAttribute(`aria-selected`,String(n)),r.tabIndex=n?0:-1);let i=t.content;i&&(i.classList.toggle(`active-page`,n),i.hidden=!n),this._refreshCloseVisibility(t.id)}}_scrollSelectedTabIntoBar(){let e=this._state.selectedId,t=e===null?void 0:this._tabs.get(e);if(!t)return;let n=this._barEl.clientWidth,r=t.offsetWidth;if(n<=0||r<=0)return;let i=this._barEl.scrollLeft,a=this._tabPosition(t),o=Math.min(r,n-r)/2;a-5<i?this._barEl.scrollLeft=a-o:a+r+5>i+n&&(this._barEl.scrollLeft=a+r+o-n)}_applyBarVisibility(){let e=tabsRevealed({autohide:this.autohide,nPages:this._state.nPages,nPinnedPages:this._state.nPinnedPages,isTransferringPage:!1});this._barEl.hidden=!e,this._barEl.classList.toggle(`single-tab`,this._state.nPages<=1)}_reflectSelected(){this._reflecting=!0;let e=this._state.selectedIndex;e<0?this.removeAttribute(`selected`):this.getAttribute(`selected`)!==String(e)&&this.setAttribute(`selected`,String(e)),this._reflecting=!1}_applySelectedAttribute(e){let t=Number.parseInt(e,10);Number.isNaN(t)||this._state.selectNthPage(t)}_onKeyDown(e){let t=e.target instanceof Node&&this._barEl.contains(e.target),n=!1;if(e.ctrlKey&&e.key===`Tab`)n=e.shiftKey?this._state.cyclePreviousPage():this._state.cycleNextPage();else if(e.ctrlKey&&e.shiftKey&&(e.key===`PageUp`||e.key===`PageDown`)){let t=this._state.selectedId;t!==null&&(n=e.key===`PageUp`?this._state.reorderBackward(t):this._state.reorderForward(t))}else if(e.ctrlKey&&e.shiftKey&&(e.key===`Home`||e.key===`End`)){let t=this._state.selectedId;t!==null&&(n=e.key===`Home`?this._state.reorderFirst(t):this._state.reorderLast(t))}else if(e.ctrlKey&&(e.key===`PageUp`||e.key===`PageDown`))n=e.key===`PageUp`?this._state.selectPreviousPage():this._state.selectNextPage();else if(e.ctrlKey&&(e.key===`Home`||e.key===`End`))n=e.key===`Home`?this._state.selectFirstPage():this._state.selectLastPage();else if(e.altKey&&/^[0-9]$/.test(e.key)){let t=Number.parseInt(e.key,10);n=this._state.selectNthPage(t===0?9:t-1)}else t&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)?n=e.key===`ArrowLeft`?this._state.selectPreviousPage():this._state.selectNextPage():t&&(e.key===`Home`||e.key===`End`)&&(n=e.key===`Home`?this._state.selectFirstPage():this._state.selectLastPage());if(n&&(e.preventDefault(),t)){let e=this._state.selectedId;e!==null&&this._tabs.get(e)?.focus({preventScroll:!0})}}_requestClose(e){return this.dispatchEvent(new CustomEvent(`close-page`,{bubbles:!0,cancelable:!0,detail:{index:this._state.getPagePosition(e.id),id:e.id}}))?!e.pinned:`defer`}};customElements.define(`adw-tab-page`,AdwTabPage),customElements.define(`adw-tab-view`,AdwTabView);const J={schedule(e,t){return setTimeout(e,t)},cancel(e){clearTimeout(e)}};function createSwitcherIcon(e,t){return createAdwIcon(viewSwitcherIconName(e),t)}function applySwitcherIcon(e,t){e.iconName=viewSwitcherIconName(t)}function readSwitcherPage(e){let t=Number.parseInt(e.getAttribute(`badge-number`)??``,10);return{name:e.getAttribute(`name`)??``,title:e.getAttribute(`title`),iconName:e.getAttribute(`icon-name`),visible:!e.hasAttribute(`hidden`),useUnderline:e.hasAttribute(`use-underline`),badgeNumber:Number.isNaN(t)?0:t,needsAttention:e.hasAttribute(`needs-attention`)}}function applyIndicator(e,t,n){e.textContent=t,e.classList.toggle(`needs-attention`,n&&t.length===0),e.hidden=t.length===0&&!n}function applyDescription(e,t){t?e.setAttribute(`aria-description`,t):e.removeAttribute(`aria-description`)}var AdwViewSwitcherPage=class extends HTMLElement{},AdwViewSwitcher=class extends HTMLElement{scheduler=J;_stateInstance=null;get _state(){return this._stateInstance||(this._stateInstance=new ViewSwitcherState({scheduler:this.scheduler}),this._stateInstance.subscribe(e=>this._onStateChange(e))),this._stateInstance}_barEl;_contentEl;_nodes=[];_declared=[];_pageObserver;_policy=`narrow`;_initialized=!1;static get observedAttributes(){return[`policy`,`active`]}constructor(){super()}get policy(){return this._policy}set policy(e){this.setAttribute(`policy`,e)}get active(){return this._state.selected}set active(e){this._state.setSelected(e),this._reflectActive()}get visibleChildName(){return this._state.selectedName}set visibleChildName(e){this._state.selectName(e)}get pages(){return this._state.pages}setPageVisible(e,t){let n=this._state.setPageVisible(e,t);return this._render(),n}connectedCallback(){if(this._initialized){this._watchPages();return}let e=Array.from(this.querySelectorAll(`:scope > adw-view-switcher-page`)),t=this.getAttribute(`active`);if(this._barEl=document.createElement(`div`),this._barEl.className=`adw-view-switcher-bar`,this._barEl.setAttribute(`role`,`tablist`),attachRovingFocus({host:this,orientation:`horizontal`,items:()=>this._nodes.map(e=>e.button).filter(e=>!e.hidden),select:e=>{this._state.setSelected(Number(e.dataset.pageIndex))}}),this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-view-switcher-content`,this._declared=e,this._watchPages(),this._nodes=e.map((e,t)=>this._buildPage(e,t)),this._barEl.append(...this._nodes.map(e=>e.button)),this._contentEl.append(...this._nodes.map(e=>e.body)),this.replaceChildren(this._barEl,this._contentEl),this._policy=this._readPolicyAttr(),this._initialized=!0,this._state.setPages(e.map(e=>readSwitcherPage(e))),t!==null){let e=Number.parseInt(t,10);Number.isNaN(e)||this._state.setSelected(e,!1)}this._render()}disconnectedCallback(){this._state.cancelDrag(),this._pageObserver?.disconnect(),this._pageObserver=void 0}refreshPages(){this._initialized&&(this._state.setPages(this._declared.map(e=>readSwitcherPage(e))),this._render())}_watchPages(){this._pageObserver?.disconnect(),this._pageObserver=new MutationObserver(()=>this.refreshPages());for(let e of this._declared)this._pageObserver.observe(e,{attributes:!0})}attributeChangedCallback(e){if(this._initialized){if(e===`policy`){let e=this._readPolicyAttr();if(e===this._policy)return;this._policy=e,this._render(),this.dispatchEvent(new CustomEvent(`notify::policy`,{bubbles:!0,detail:{policy:e}}));return}if(e===`active`){let e=this.getAttribute(`active`),t=e===null?NaN:Number.parseInt(e,10);Number.isNaN(t)||this._state.setSelected(t),this._reflectActive()}}}_buildPage(e,t){let n=document.createElement(`button`);n.type=`button`,n.className=`adw-view-switcher-button`,n.setAttribute(`role`,`tab`),n.dataset.pageIndex=String(t);let r=createAdwIcon(null,`adw-view-switcher-icon`),i=document.createElement(`span`);i.className=`adw-view-switcher-label`;let a=document.createElement(`span`);a.className=`adw-view-switcher-indicator`,a.setAttribute(`aria-hidden`,`true`),n.append(r,i,a),n.addEventListener(`click`,()=>{this._state.setSelected(t)}),n.addEventListener(`dragenter`,e=>{n.contains(e.relatedTarget)||this._state.dragEnter(t)}),n.addEventListener(`dragleave`,e=>{n.contains(e.relatedTarget)||this._state.dragLeave(t)});let o=document.createElement(`div`);o.className=`adw-view-switcher-page`,o.dataset.name=e.getAttribute(`name`)??``;for(let t of Array.from(e.childNodes))o.appendChild(t);return{button:n,icon:r,label:i,indicator:a,body:o}}_readPolicyAttr(){let e=this.getAttribute(`policy`);return e===null?`narrow`:isViewSwitcherPolicy(e)?e:this._policy}_onStateChange(e){this._render(),this.dispatchEvent(new CustomEvent(`notify::visible-child`,{bubbles:!0,detail:{index:e.selected,name:e.name,title:e.title,interactive:e.interactive}}))}_render(){if(this._initialized){for(let e of xe)this.classList.toggle(e,e===this._policy);buildViewSwitcherButtons(this._state.pages,this._state.selected,this._policy).forEach((e,t)=>{let n=this._nodes[t];n&&(n.button.hidden=!e.visible,n.button.classList.toggle(`active`,e.selected),n.button.setAttribute(`aria-selected`,String(e.selected)),n.button.tabIndex=e.selected?0:-1,applySwitcherIcon(n.icon,e.iconName),n.label.textContent=e.label,n.label.hidden=e.label.length===0,applyIndicator(n.indicator,e.badgeLabel,e.needsAttention),applyDescription(n.button,e.description),e.label?n.button.removeAttribute(`aria-label`):n.button.setAttribute(`aria-label`,e.iconName),n.body.classList.toggle(`active-view`,e.selected),n.body.hidden=!e.selected)}),this._reflectActive()}}_reflectActive(){let e=String(this._state.selected);this.getAttribute(`active`)!==e&&this.setAttribute(`active`,e)}};customElements.define(`adw-view-switcher-page`,AdwViewSwitcherPage),customElements.define(`adw-view-switcher`,AdwViewSwitcher);var AdwViewStackPage=class extends HTMLElement{static get observedAttributes(){return[`name`,`title`,`icon-name`,`badge-number`,`needs-attention`,`use-underline`]}},AdwInlineViewSwitcher=class extends HTMLElement{scheduler=J;_stateInstance=null;get _state(){return this._stateInstance||(this._stateInstance=new ViewSwitcherState({scheduler:this.scheduler}),this._stateInstance.subscribe(e=>this._onStateChange(e))),this._stateInstance}_groupEl;_pagesEl;_panels=[];_toggles=[];_displayMode=`labels`;_initialized=!1;_declared=[];_pageObserver;static get observedAttributes(){return[`active`,`display-mode`,`flat`,`round`,`osd`]}constructor(){super()}get active(){return this._state.selected}set active(e){this._state.setSelected(e),this._reflectActive()}get activeToggle(){return toggleIndexForPage(this._state.pages,this._state.selected)}get displayMode(){return this._displayMode}set displayMode(e){this.setAttribute(`display-mode`,e)}get visibleChildName(){return this._state.selectedName}set visibleChildName(e){this._state.selectName(e)}get pages(){return this._state.pages}setPageVisible(e,t){let n=this._state.setPageVisible(e,t);return this._rebuildToggles(),n}connectedCallback(){if(this._initialized){this._watchPages();return}let e=Array.from(this.querySelectorAll(`:scope > adw-view-stack-page`)),t=this.getAttribute(`active`);if(this._groupEl=document.createElement(`div`),this._groupEl.className=`adw-inline-view-switcher-group`,this._groupEl.setAttribute(`role`,`tablist`),attachRovingFocus({host:this,orientation:`horizontal`,items:()=>this._toggles,select:e=>{this._state.setSelected(Number(e.dataset.pageIndex))}}),this._pagesEl=document.createElement(`div`),this._pagesEl.className=`adw-inline-view-switcher-pages`,this._panels=e.map(e=>{let t=document.createElement(`div`);t.className=`adw-inline-view-switcher-page`,t.setAttribute(`role`,`tabpanel`),t.dataset.name=e.getAttribute(`name`)??``;for(let n of Array.from(e.childNodes))t.appendChild(n);return this._pagesEl.appendChild(t),t}),this.replaceChildren(this._groupEl,this._pagesEl),this._displayMode=this._readDisplayModeAttr(),this._initialized=!0,this._declared=e,this._watchPages(),this._state.setPages(e.map(e=>readSwitcherPage(e))),t!==null){let e=Number.parseInt(t,10);Number.isNaN(e)||this._state.setSelected(e,!1)}this._rebuildToggles()}disconnectedCallback(){this._state.cancelDrag(),this._pageObserver?.disconnect(),this._pageObserver=void 0}refreshPages(){this._initialized&&(this._state.setPages(this._declared.map(e=>readSwitcherPage(e))),this._rebuildToggles())}_watchPages(){this._pageObserver?.disconnect(),this._pageObserver=new MutationObserver(()=>this.refreshPages());for(let e of this._declared)this._pageObserver.observe(e,{attributes:!0})}attributeChangedCallback(e){if(this._initialized){if(e===`active`){let e=this.getAttribute(`active`),t=e===null?NaN:Number.parseInt(e,10);Number.isNaN(t)||this._state.setSelected(t),this._reflectActive();return}if(e===`display-mode`){let e=this._readDisplayModeAttr();if(e===this._displayMode)return;this._displayMode=e,this._rebuildToggles(),this.dispatchEvent(new CustomEvent(`notify::display-mode`,{bubbles:!0,detail:{displayMode:e}}));return}this._applyStyleClasses()}}_readDisplayModeAttr(){let e=this.getAttribute(`display-mode`);return e===null?`labels`:isInlineViewSwitcherDisplayMode(e)?e:this._displayMode}_rebuildToggles(){if(!this._initialized)return;let e=buildInlineToggles(this._state.pages,this._displayMode);this._groupEl.replaceChildren(),this._toggles=e.map(e=>{let t=document.createElement(`button`);if(t.type=`button`,t.className=`adw-inline-view-switcher-toggle`,t.setAttribute(`role`,`tab`),t.dataset.pageIndex=String(e.pageIndex),t.dataset.toggleIndex=String(e.toggleIndex),e.showIcon&&t.appendChild(createSwitcherIcon(e.iconName,`adw-inline-view-switcher-icon`)),e.showLabel){let n=document.createElement(`span`);n.className=`adw-inline-view-switcher-label`,n.textContent=e.label,t.appendChild(n)}let n=document.createElement(`span`);return n.className=`adw-inline-view-switcher-indicator`,n.setAttribute(`aria-hidden`,`true`),applyIndicator(n,e.badgeLabel,e.needsAttention),t.appendChild(n),e.tooltip&&(t.title=e.tooltip),e.showLabel||t.setAttribute(`aria-label`,e.tooltip||e.iconName),applyDescription(t,e.description),t.addEventListener(`click`,()=>{this._state.setSelected(e.pageIndex)}),t.addEventListener(`dragenter`,n=>{t.contains(n.relatedTarget)||this._state.dragEnter(e.pageIndex)}),t.addEventListener(`dragleave`,n=>{t.contains(n.relatedTarget)||this._state.dragLeave(e.pageIndex)}),this._groupEl.appendChild(t),t}),this._render()}_onStateChange(e){this._render(),this.dispatchEvent(new CustomEvent(`notify::active`,{bubbles:!0,detail:{active:e.selected,name:e.name,toggleIndex:this.activeToggle,interactive:e.interactive}}))}_render(){if(!this._initialized)return;this._applyStyleClasses();let e=this.activeToggle;this._toggles.forEach((t,n)=>{let r=n===e&&e!==-1;t.classList.toggle(`active`,r),t.setAttribute(`aria-selected`,String(r)),t.tabIndex=r?0:-1});let t=this._state.selected;this._panels.forEach((e,n)=>{let r=n===t;e.classList.toggle(`active-view`,r),e.hidden=!r}),this._reflectActive()}_applyStyleClasses(){for(let e of[`flat`,`round`,`osd`]){let t=this.hasAttribute(e);this.classList.toggle(e,t),this._groupEl?.classList.toggle(e,t)}for(let e of Se)this._groupEl.classList.toggle(e,e===this._displayMode)}_reflectActive(){let e=String(this._state.selected);this.getAttribute(`active`)!==e&&this.setAttribute(`active`,e)}};customElements.define(`adw-view-stack-page`,AdwViewStackPage),customElements.define(`adw-inline-view-switcher`,AdwInlineViewSwitcher);var AdwViewStack=class extends HTMLElement{_state=new ViewStackState;_initialized=!1;static get observedAttributes(){return[`visible-child-name`]}constructor(){super(),this._state.subscribe(e=>this._onStateChange(e))}get pages(){return this._state.pages}get visibleChildIndex(){return this._state.visibleIndex}set visibleChildIndex(e){this._state.setVisibleIndex(e)}get visibleChildName(){return this._state.visibleName}set visibleChildName(e){this._state.setVisibleName(e)}get visibleChild(){return this._state.visiblePage?.content??null}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=this.getAttribute(`visible-child-name`);for(let e of Array.from(this.querySelectorAll(`:scope > adw-view-stack-page`))){let t=e.getAttribute(`name`)??``,n=document.createElement(`div`);n.className=`adw-view-stack-child`,n.dataset.name=t;for(let t of Array.from(e.childNodes))n.appendChild(t);this._state.addPage({name:t,title:e.getAttribute(`title`),icon:e.getAttribute(`icon-name`),content:n,visible:!e.hasAttribute(`hidden`)}),this.replaceChild(n,e)}e!==null&&this._state.setVisibleName(e,!1),this._applyVisibility(),this._reflectName()}attributeChangedCallback(e,t,n){this._initialized&&e===`visible-child-name`&&n!==null&&n!==this._state.visibleName&&this._state.setVisibleName(n)}add(e,t,n,r){e.classList.add(`adw-view-stack-child`),e.dataset.name=t;let i=this._state.addPage({name:t,title:n,icon:r,content:e});return this.appendChild(e),this._applyVisibility(),this._reflectName(),this._emitItemsChanged(),i}addTitled(e,t,n){return this.add(e,t,n)}removePage(e){let t=this._state.pages[this._state.indexOfName(e)]?.content;return this._state.removePage(e)?(t?.remove(),this._applyVisibility(),this._reflectName(),this._emitItemsChanged(),!0):!1}setPageVisible(e,t){let n=this._state.setPageVisible(e,t);return this._applyVisibility(),this._emitItemsChanged(),n}_emitItemsChanged(){this.dispatchEvent(new CustomEvent(`items-changed`,{bubbles:!0,detail:{count:this.pages.length}}))}_onStateChange(e){this._applyVisibility(),this._reflectName(),this.dispatchEvent(new CustomEvent(`notify::visible-child`,{bubbles:!0,detail:{index:e.index,name:e.name,title:e.title,interactive:e.interactive}}))}_applyVisibility(){let e=this._state.visibleIndex;this._state.pages.forEach((t,n)=>{let r=t.content;if(!r)return;let i=n===e;r.classList.toggle(`active-view`,i),r.hidden=!i})}_reflectName(){if(this._state.visibleIndex<0){this.removeAttribute(`visible-child-name`);return}let e=this._state.visibleName;this.getAttribute(`visible-child-name`)!==e&&this.setAttribute(`visible-child-name`,e)}};customElements.define(`adw-view-stack`,AdwViewStack);var AdwViewSwitcherBar=class extends HTMLElement{_barState=new ViewSwitcherBarState;_barEl;_nodes=[];_stack=null;_initialized=!1;_onStackNotify=()=>this._rebuild();static get observedAttributes(){return[`stack`,`reveal`,`revealed`]}constructor(){super(),this._barState.subscribe(()=>this._applyRevealed())}get stack(){return this._stack}set stack(e){this.setStack(this._resolveStack(e))}get reveal(){return this._barState.reveal}set reveal(e){e?this.setAttribute(`reveal`,``):(this.removeAttribute(`reveal`),this.removeAttribute(`revealed`))}get revealed(){return this._barState.revealed}connectedCallback(){this._initialized||(this._initialized=!0,this._barEl=document.createElement(`div`),this._barEl.className=`adw-view-switcher-bar-box`,this._barEl.setAttribute(`role`,`tablist`),this.replaceChildren(this._barEl),attachRovingFocus({host:this,orientation:`horizontal`,items:()=>this._nodes.map(e=>e.button).filter(e=>!e.hidden),select:e=>{let t=this._stack;if(!t)return;let n=Number(e.dataset.pageIndex);t.visibleChildIndex!==n&&(t.visibleChildIndex=n)}})),this._barState.setReveal(this._readReveal());let e=this.getAttribute(`stack`);if(e&&!this._stack){this.setStack(this._resolveStack(e));return}this._bindStack(),this._rebuild()}disconnectedCallback(){this._unbindStack()}attributeChangedCallback(e,t,n){if(this._initialized){if(e===`reveal`||e===`revealed`){this._barState.setReveal(this._readReveal());return}e===`stack`&&this.setStack(this._resolveStack(n))}}setStack(e){this._unbindStack(),this._stack=e,this._bindStack(),this._rebuild()}refresh(){this._rebuild()}_readReveal(){return this.hasAttribute(`reveal`)||this.hasAttribute(`revealed`)}_bindStack(){this._stack?.addEventListener(`notify::visible-child`,this._onStackNotify),this._stack?.addEventListener(`items-changed`,this._onStackNotify)}_unbindStack(){this._stack?.removeEventListener(`notify::visible-child`,this._onStackNotify),this._stack?.removeEventListener(`items-changed`,this._onStackNotify)}_resolveStack(e){return e===null?null:typeof e==`string`?document.getElementById(e)??null:e}_rebuild(){if(!this._initialized)return;let e=this._stack?.pages??[];this._barState.setPages(e);let t=buildViewSwitcherButtons(viewSwitcherPagesFromStack(e),this._stack?.visibleChildIndex??-1,`narrow`);t.length!==this._nodes.length&&(this._barEl.replaceChildren(),this._nodes=t.map(e=>this._buildButton(e.pageIndex)),this._barEl.append(...this._nodes.map(e=>e.button))),t.forEach((e,t)=>{let n=this._nodes[t];n&&(n.button.hidden=!e.visible,n.button.classList.toggle(`active`,e.selected),n.button.setAttribute(`aria-selected`,String(e.selected)),n.button.tabIndex=e.selected?0:-1,applySwitcherIcon(n.icon,e.iconName),n.label.textContent=e.label,n.label.hidden=e.label.length===0,applyIndicator(n.indicator,e.badgeLabel,e.needsAttention),applyDescription(n.button,e.description),e.label?n.button.removeAttribute(`aria-label`):n.button.setAttribute(`aria-label`,e.iconName))}),this._applyRevealed()}_buildButton(e){let t=document.createElement(`button`);t.type=`button`,t.className=`adw-view-switcher-bar-button`,t.setAttribute(`role`,`tab`),t.dataset.pageIndex=String(e);let n=createAdwIcon(null,`adw-view-switcher-bar-icon`),r=document.createElement(`span`);r.className=`adw-view-switcher-bar-label`;let i=document.createElement(`span`);return i.className=`adw-view-switcher-bar-indicator`,i.setAttribute(`aria-hidden`,`true`),t.append(n,r,i),t.addEventListener(`click`,()=>{this._stack&&(this._stack.visibleChildIndex=e)}),{button:t,icon:n,label:r,indicator:i}}_applyRevealed(){this.hidden=!this._barState.revealed}};customElements.define(`adw-view-switcher-bar`,AdwViewSwitcherBar);const Ue={down:`bottom`,up:`top`,left:`start`,right:`end`};var AdwMenuButton=class extends HTMLElement{_buttonEl;_popoverEl;_items=[];_menuTitle=``;_initialized=!1;_itemButtons=[];static get observedAttributes(){return[`icon-name`,`menu-title`,`menu`,`disabled`,`flat`,`circular`,`direction`]}get active(){return this._popoverEl?.open??!1}get menuItems(){return this._items}set menuItems(e){this._items=Array.isArray(e)?e.map(e=>({...e})):[],this._initialized&&this._renderMenu()}get menuTitle(){return this.getAttribute(`menu-title`)??this._menuTitle}set menuTitle(e){this._menuTitle=e??``,this.setAttribute(`menu-title`,this._menuTitle)}get direction(){let e=this.getAttribute(`direction`);return isSplitButtonDirection(e)?e:`down`}set direction(e){this.setAttribute(`direction`,e)}connectedCallback(){this._initialized||(this._initialized=!0,this.classList.add(`adw-menu-button`),this._buttonEl=document.createElement(`button`),this._buttonEl.type=`button`,this._buttonEl.className=`adw-menu-button-button`,this._buttonEl.setAttribute(`aria-haspopup`,`menu`),this._buttonEl.setAttribute(`aria-expanded`,`false`),this._popoverEl=document.createElement(`adw-popover`),this._popoverEl.classList.add(`adw-menu-button-popover`),this._popoverEl.setAttribute(`role`,`menu`),this._popoverEl.setAttribute(`menu`,``),this._popoverEl.setAttribute(`align`,`end`),this.replaceChildren(this._buttonEl,this._popoverEl),this._popoverEl.anchor=this._buttonEl,this._popoverEl.subscribe(e=>this._onPopoverToggled(e)),this._buttonEl.addEventListener(`click`,()=>{this.hasAttribute(`disabled`)||!this._popoverEl.open&&this._items.length===0||(this._popoverEl.open=!this._popoverEl.open)}),this._items.length===0&&(this._items=this._parseMenuAttr()),!this.hasAttribute(`flat`)&&!this.hasAttribute(`circular`)&&this.setAttribute(`flat`,``),this._render())}attributeChangedCallback(e){if(!(!this._initialized||!this._buttonEl)){if(e===`menu`){this._items=this._parseMenuAttr(),this._renderMenu();return}this._render()}}_parseMenuAttr(){return parseMenuEntries(this.getAttribute(`menu`))}_onPopoverToggled(e){this.classList.toggle(`active`,e),this._buttonEl.setAttribute(`aria-expanded`,String(e)),e&&this._itemButtons[0]?.focus()}_render(){let e=this.hasAttribute(`disabled`);this.classList.toggle(`disabled`,e),this._buttonEl.disabled=e,e&&this._popoverEl.popdown(),this.classList.toggle(`flat`,this.hasAttribute(`flat`)),this.classList.toggle(`circular`,this.hasAttribute(`circular`)),this._popoverEl.position=Ue[be(this.direction)],this._buttonEl.replaceChildren(),this._buttonEl.appendChild(createAdwIcon(this.getAttribute(`icon-name`)??`open-menu`,`adw-menu-button-icon`)),this._buttonEl.setAttribute(`aria-label`,this.getAttribute(`menu-title`)||`Menu`),this._renderMenu()}_renderMenu(){this._popoverEl.replaceChildren(),this._itemButtons=[];let e=this.getAttribute(`menu-title`)??this._menuTitle;if(e){let t=document.createElement(`div`);t.className=`adw-popover-title adw-menu-button-title`,t.textContent=e,this._popoverEl.appendChild(t)}for(let[e,t]of this._items.entries()){let n=document.createElement(`button`);n.type=`button`,n.className=`adw-popover-item adw-menu-button-item`,n.setAttribute(`role`,`menuitem`),n.tabIndex=-1;let r=createAdwIcon(t.icon??null,`adw-menu-button-item-icon`);stringIsNotEmpty(t.icon)&&n.appendChild(r);let i=document.createElement(`span`);i.className=`adw-menu-button-item-label`,i.textContent=t.label,n.appendChild(i),n.addEventListener(`click`,()=>{this._popoverEl.popdown(),this._buttonEl.focus(),this.dispatchEvent(new CustomEvent(`menu-item-activated`,{bubbles:!0,detail:{id:t.id??t.label,label:t.label,index:e}}))}),this._popoverEl.appendChild(n),this._itemButtons.push(n)}this._items.length===0&&this._popoverEl.popdown()}};customElements.define(`adw-menu-button`,AdwMenuButton);var AdwDropDown=class extends HTMLElement{_buttonEl;_labelEl;_popoverEl;_listEl;_searchEl=null;_itemButtons=[];_state=new ComboState;_initialized=!1;_typeAheadBuffer=``;_typeAheadTimer=null;static get observedAttributes(){return[`options`,`items`,`selected`,`enable-search`,`disabled`]}get options(){return this._state.options}set options(e){this._state.setOptions(normalizeComboOptions(e)),this._initialized&&this._renderAll()}get items(){return this._state.options}set items(e){this.options=e}get selected(){return this._state.selectedIndex}set selected(e){this._selectIndex(e)}get selectedValue(){return this._state.selectedValue}set selectedValue(e){let t=this._state.options.findIndex(t=>t.value===e);t>=0&&this._selectIndex(t)}get selectedItem(){return this._state.options[this._state.selectedIndex]??null}get enableSearch(){return this.hasAttribute(`enable-search`)}set enableSearch(e){e?this.setAttribute(`enable-search`,``):this.removeAttribute(`enable-search`)}get active(){return this._popoverEl?.open??!1}connectedCallback(){if(this._initialized)return;this._initialized=!0,this.classList.add(`adw-drop-down`),this._buttonEl=document.createElement(`button`),this._buttonEl.type=`button`,this._buttonEl.className=`adw-drop-down-button`,this._buttonEl.setAttribute(`aria-haspopup`,`listbox`),this._buttonEl.setAttribute(`aria-expanded`,`false`),this._labelEl=document.createElement(`span`),this._labelEl.className=`adw-drop-down-label`,this._buttonEl.append(this._labelEl,createAdwIcon(`go-down`,`adw-drop-down-arrow`)),this._buttonEl.addEventListener(`click`,()=>{this.hasAttribute(`disabled`)||!this._popoverEl.open&&this._state.count===0||(this._popoverEl.open=!this._popoverEl.open)}),this._buttonEl.addEventListener(`keydown`,e=>this._onButtonKeyDown(e)),this._popoverEl=document.createElement(`adw-popover`),this._popoverEl.classList.add(`adw-drop-down-popover`),this._popoverEl.setAttribute(`role`,`listbox`),this._popoverEl.setAttribute(`menu`,``),this._listEl=document.createElement(`div`),this._listEl.className=`adw-drop-down-list`,this._popoverEl.appendChild(this._listEl),this._state.count===0&&this._state.setOptions(this._parseOptionsAttr());let e=Number.parseInt(this.getAttribute(`selected`)??``,10);this._state.hasIndex(e)&&this._state.setSelectedIndex(e),this.replaceChildren(this._buttonEl,this._popoverEl),this._popoverEl.anchor=this._buttonEl,this._popoverEl.subscribe(e=>this._onPopoverToggled(e)),this._popoverEl.addEventListener(`keydown`,e=>this._onPopoverTypeAhead(e)),this._renderAll()}attributeChangedCallback(e,t,n){if(!(!this._initialized||!this._buttonEl))if(e===`options`||e===`items`)this._state.setOptions(this._parseOptionsAttr()),this._renderAll();else if(e===`selected`){let e=Number.parseInt(n??``,10);Number.isNaN(e)||this._selectIndex(e,{fromAttr:!0})}else e===`enable-search`?this._renderPopover():e===`disabled`&&(this._buttonEl.disabled=this.hasAttribute(`disabled`),this.hasAttribute(`disabled`)&&this._popoverEl.popdown())}_parseOptionsAttr(){let e=this.getAttribute(`options`)??this.getAttribute(`items`);if(!e)return[];try{return normalizeComboOptions(JSON.parse(e))}catch{return[]}}_selectIndex(e,t={}){if(!this._state.hasIndex(e))return;let n=t.fromUser?this._state.select(e):this._state.setSelectedIndex(e);if(this._updateLabel(),this._updateSelectedStates(),!t.fromAttr&&this.getAttribute(`selected`)!==String(e)&&this.setAttribute(`selected`,String(e)),n){let n=this._state.options[e];this.dispatchEvent(new CustomEvent(`notify::selected`,{bubbles:!0,detail:{selected:e}})),t.fromUser&&this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,detail:{index:e,value:n?.value??``,label:n?.label??``}}))}}_onPopoverToggled(e){if(this.classList.toggle(`active`,e),this._buttonEl.setAttribute(`aria-expanded`,String(e)),e)if(this._filter(``),this._searchEl)this._searchEl.value=``,this._searchEl.focus();else{let e=this._visibleItems();(e[this._state.selectedIndex]??e[0])?.focus()}}_onButtonKeyDown(e){this.hasAttribute(`disabled`)||(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`Enter`||e.key===` `?(e.preventDefault(),this._state.count>0&&this._popoverEl.popup()):e.key.length===1&&!this._popoverEl.open&&this._typeAhead(e.key))}_onPopoverTypeAhead(e){this._searchEl||e.key.length===1&&this._typeAhead(e.key)}_typeAhead(e){this._typeAheadBuffer+=e.toLowerCase(),this._typeAheadTimer&&clearTimeout(this._typeAheadTimer),this._typeAheadTimer=setTimeout(()=>this._typeAheadBuffer=``,800);let t=this._state.options.findIndex(e=>e.label.toLowerCase().startsWith(this._typeAheadBuffer));t<0||(this._popoverEl.open?this._itemButtons[t]?.focus():this._selectIndex(t,{fromUser:!0}))}_filter(e){let t=e.trim().toLowerCase();this._itemButtons.forEach((e,n)=>{e.hidden=!(t.length===0||(this._state.options[n]?.label.toLowerCase().includes(t)??!1))})}_visibleItems(){return this._itemButtons.filter(e=>!e.hidden)}_renderAll(){this._buttonEl.disabled=this.hasAttribute(`disabled`),this.classList.toggle(`disabled`,this.hasAttribute(`disabled`)),this._renderPopover(),this._updateLabel()}_updateLabel(){this._labelEl&&(this._labelEl.textContent=this._state.selectedLabel)}_updateSelectedStates(){this._itemButtons.forEach((e,t)=>{let n=t===this._state.selectedIndex;e.classList.toggle(`selected`,n),e.setAttribute(`aria-selected`,String(n))})}_renderPopover(){if(this._listEl.replaceChildren(),this._itemButtons=[],this._searchEl=null,this.enableSearch)this._searchEl=document.createElement(`input`),this._searchEl.type=`text`,this._searchEl.className=`adw-drop-down-search adw-entry`,this._searchEl.placeholder=`Search…`,this._searchEl.setAttribute(`aria-label`,`Search`),this._searchEl.addEventListener(`input`,()=>this._filter(this._searchEl?.value??``)),this._popoverEl.insertBefore(this._searchEl,this._listEl);else{let e=this._popoverEl.querySelector(`.adw-drop-down-search`);e&&e.remove()}for(let[e,t]of this._state.options.entries()){let n=document.createElement(`button`);n.type=`button`,n.className=`adw-popover-item adw-drop-down-item`,n.setAttribute(`role`,`option`),n.tabIndex=-1;let r=document.createElement(`span`);r.className=`adw-drop-down-item-label`,r.textContent=t.label;let i=document.createElement(`span`);i.className=`adw-drop-down-item-check`,i.setAttribute(`aria-hidden`,`true`),n.append(r,i),n.addEventListener(`click`,()=>{this._selectIndex(e,{fromUser:!0}),this._popoverEl.popdown(),this._buttonEl.focus()}),this._listEl.appendChild(n),this._itemButtons.push(n)}this._updateSelectedStates(),this._state.count===0&&this._popoverEl.popdown()}};customElements.define(`adw-drop-down`,AdwDropDown);function readPageProps(e){return{tag:e.tag,title:e.title,canPop:e.canPop}}var AdwNavigationPage=class extends HTMLElement{_syncing=!1;static get observedAttributes(){return[`title`,`tag`,`can-pop`,`no-back-button`]}get title(){return this.getAttribute(`title`)??``}set title(e){this.setAttribute(`title`,e)}get tag(){return this.getAttribute(`tag`)}set tag(e){e===null?this.removeAttribute(`tag`):this.setAttribute(`tag`,e)}get canPop(){return this.getAttribute(`can-pop`)!==`false`}set canPop(e){this.setAttribute(`can-pop`,e?`true`:`false`)}attributeChangedCallback(e,t){this._syncing||this.closest(`adw-navigation-view`)?.syncPageProperty(this,e,t)}revertAttribute(e,t){this._syncing=!0,t===null?this.removeAttribute(e):this.setAttribute(e,t),this._syncing=!1}},AdwNavigationView=class extends HTMLElement{_pagesEl;_backButtons=new WeakMap;_initialized=!1;_diagnose=e=>{console.warn(`[adw-navigation-view] ${describeNavigationDiagnostic(e)}`)};_state=new NavigationViewState({onDiagnostic:this._diagnose});static get observedAttributes(){return[`animate-transitions`,`pop-on-escape`]}get animateTransitions(){return this.getAttribute(`animate-transitions`)!==`false`}set animateTransitions(e){this.setAttribute(`animate-transitions`,e?`true`:`false`)}get popOnEscape(){return this.getAttribute(`pop-on-escape`)!==`false`}set popOnEscape(e){this.setAttribute(`pop-on-escape`,e?`true`:`false`)}get visiblePage(){return this._state.visiblePage}get visiblePageTag(){return this._state.visiblePageTag}get depth(){return this._state.depth}get navigationStack(){return this._state.stack}get pages(){return this._state.pages}get canGoBack(){return this._state.canGoBack()}get backButtonTooltip(){return this._state.backButtonTooltip()}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=Array.from(this.querySelectorAll(`:scope > adw-navigation-page`));this._pagesEl=document.createElement(`div`),this._pagesEl.className=`adw-navigation-view-pages`;for(let t of e)t.classList.add(`adw-navigation-page`),this._pagesEl.appendChild(t);this.replaceChildren(this._pagesEl),this._state.subscribe(e=>this._onChange(e)),this._state.setAnimateTransitions(this.animateTransitions),this._state.setPopOnEscape(this.popOnEscape),this.addEventListener(`keydown`,this._onKeyDown);for(let t of e)this._state.add(t,readPageProps(t));for(let t of e)this._state.isRegistered(t)||this._detach(t);this._syncClasses(),this._render()}attributeChangedCallback(e){if(this._initialized){if(e===`pop-on-escape`){this._state.setPopOnEscape(this.popOnEscape);return}this._state.setAnimateTransitions(this.animateTransitions),this._syncClasses()}}syncPageProperty(e,t,n){this._state.isRegistered(e)&&(t===`tag`?(this._state.setTag(e,e.tag),this._state.tagOf(e)!==e.tag&&e.revertAttribute(`tag`,n)):t===`title`?this._state.setTitle(e,e.title):t===`can-pop`&&this._state.setCanPop(e,e.canPop),this._render())}addPage(e){let t=this._state.add(e,readPageProps(e));return this._render(),t}removePage(e){let t=this._state.remove(e);return t&&!this._state.isRegistered(e)&&this._detach(e),this._render(),t}push(e){if(typeof e==`string`)return this.pushByTag(e);let t=this._state.push(e,readPageProps(e));return this._render(),t}pushByTag(e){let t=this._state.pushByTag(e);return this._render(),t}pop(){let e=this._state.pop();return this._render(),e}popToPage(e){let t=this._state.popToPage(e);return this._render(),t}popToTag(e){let t=this._state.popToTag(e);return this._render(),t}replace(e){let t=e.map(e=>{if(typeof e!=`string`)return e??null;let t=this._state.findPage(e);return t===null&&this._diagnose({code:`tag-not-found`,tag:e}),t});this._state.replace(t,readPageProps),this._render()}replaceWithTags(e){this._state.replaceWithTags(e),this._render()}findPage(e){return this._state.findPage(e)}getPreviousPage(e){return this._state.getPreviousPage(e)}_onChange(e){for(let t of e.removed)this._detach(t);for(let e of this._state.finishTransition())this._detach(e);if(this._render(),e.reason===`add`||e.reason===`push`)this._dispatch(`pushed`,e.visiblePage);else if(e.reason===`pop`)for(let t of e.popped)this._dispatch(`popped`,t);else this._dispatch(`replaced`,null);e.previousVisiblePage!==e.visiblePage&&this._dispatch(`notify::visible-page`,e.visiblePage)}_dispatch(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:{page:t,tag:t?.tag??null}}))}_onKeyDown=e=>{if(e.defaultPrevented)return;let t;if(e.key===`Escape`)t=this._state.popFromEscape();else if(e.altKey&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)){let n=getComputedStyle(this).direction===`rtl`?`ArrowRight`:`ArrowLeft`;if(e.key!==n)return;t=this._state.popFromShortcut()}else return;t===`stop`&&(e.preventDefault(),e.stopPropagation())};_syncClasses(){this.classList.toggle(`animated`,this.animateTransitions)}_render(){let e=this._state.visiblePage;for(let t of this._state.pages){this._attach(t);let n=t===e;t.classList.toggle(`visible-page`,n),t.hidden=!n,n||this._removeBackButton(t)}e&&this._syncBackButton(e)}_attach(e){e.parentNode!==this._pagesEl&&(e.classList.add(`adw-navigation-page`),this._pagesEl.appendChild(e))}_detach(e){this._removeBackButton(e),e.classList.remove(`visible-page`),e.parentNode===this._pagesEl&&this._pagesEl.removeChild(e)}_syncBackButton(e){if(!this._state.canGoBack()||e.hasAttribute(`no-back-button`)){this._removeBackButton(e);return}let t=this._state.backButtonTooltip()??ue,n=this._backButtons.get(e);if(n){n.setAttribute(`tooltip`,t);return}let r=e.querySelector(`adw-header-bar`);if(!r)return;let i=r.startSection??null;if(!i)return;let a=document.createElement(`adw-button`);a.classList.add(`adw-navigation-back-button`),a.setAttribute(`icon`,`go-previous`),a.setAttribute(`flat`,``),a.setAttribute(`tooltip`,t),a.addEventListener(`click`,()=>this.pop()),i.insertBefore(a,i.firstChild),this._backButtons.set(e,a)}_removeBackButton(e){let t=this._backButtons.get(e);t&&(t.parentNode&&t.parentNode.removeChild(t),this._backButtons.delete(e))}};customElements.define(`adw-navigation-page`,AdwNavigationPage),customElements.define(`adw-navigation-view`,AdwNavigationView);var AdwBottomSheetContent=class extends HTMLElement{},AdwBottomSheetSheet=class extends HTMLElement{},AdwBottomSheet=class extends HTMLElement{_initialized=!1;_contentEl;_dimmingEl;_sheetEl;_dragHandleEl;_state=new BottomSheetPresentation;_reflecting=!1;static get observedAttributes(){return[`open`,`modal`,`can-close`,`show-drag-handle`]}get open(){return this._state.open}set open(e){this._setOpen(!!e)}get modal(){return this._boolAttr(`modal`,!0)}set modal(e){this._setBoolAttr(`modal`,e)}get canClose(){return this._state.canClose}set canClose(e){this._setBoolAttr(`can-close`,e)}get showDragHandle(){return this._boolAttr(`show-drag-handle`,!0)}set showDragHandle(e){this._setBoolAttr(`show-drag-handle`,e)}requestClose(e){let t=this._state.requestClose(e);return t===`close-attempt`?this.dispatchEvent(new CustomEvent(`close-attempt`,{bubbles:!0})):t===`delegate`&&this.dispatchEvent(new CustomEvent(`sheet.close`,{bubbles:!0})),t}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=new Set,t=this._collectSlot(`adw-bottom-sheet-sheet`,`sheet`,e),n=this._collectSlot(`adw-bottom-sheet-content`,`content`,e),r=Array.from(this.childNodes).filter(t=>!e.has(t));this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-bottom-sheet-content`;for(let e of n)this._contentEl.appendChild(e);for(let e of r)this._contentEl.appendChild(e);this._dimmingEl=document.createElement(`div`),this._dimmingEl.className=`adw-bottom-sheet-dimming`,this._dimmingEl.addEventListener(`click`,()=>this.requestClose(`dimming`)),this._sheetEl=document.createElement(`div`),this._sheetEl.className=`adw-bottom-sheet-sheet`,this._dragHandleEl=document.createElement(`div`),this._dragHandleEl.className=`adw-bottom-sheet-drag-handle`,this._dragHandleEl.setAttribute(`aria-hidden`,`true`);let i=document.createElement(`div`);i.className=`adw-bottom-sheet-sheet-body`;for(let e of t)i.appendChild(e);this._sheetEl.append(this._dragHandleEl,i),this.replaceChildren(this._contentEl,this._dimmingEl,this._sheetEl),this.addEventListener(`keydown`,e=>{e.key===`Escape`&&(!this.open&&!this._sheetEl.contains(e.target)||(e.stopPropagation(),this.requestClose(`escape`)))}),this._state.setCanClose(this._boolAttr(`can-close`,!0)),this._state.setOpen(this._boolAttr(`open`,!1)),this._state.subscribe(e=>{this._render(),this.dispatchEvent(new CustomEvent(`notify::open`,{bubbles:!0,detail:{open:e}}))}),this._render()}attributeChangedCallback(e,t,n){if(!this._reflecting&&t!==n){if(e===`open`){this._state.setOpen(this._boolAttr(`open`,!1));return}e===`can-close`&&this._state.setCanClose(this._boolAttr(`can-close`,!0)),this._initialized&&this._render()}}_setOpen(e){this._state.setOpen(e)&&(this._initialized||this._reflectOpen(e))}_render(){let e=this._state.open;this._reflectOpen(e),this.classList.toggle(`open`,e),this.classList.toggle(`modal`,this.modal),this.classList.toggle(`has-drag-handle`,this.showDragHandle),this._dimmingEl.classList.toggle(`visible`,e&&this.modal),this._dragHandleEl.hidden=!this.showDragHandle}_reflectOpen(e){this._reflecting=!0,e?this.setAttribute(`open`,``):this.removeAttribute(`open`),this._reflecting=!1}_boolAttr(e,t){let n=this.getAttribute(e);return n===null?t:n!==`false`}_setBoolAttr(e,t){t?this.setAttribute(e,``):this.setAttribute(e,`false`)}_collectSlot(e,t,n){let r=[];for(let i of Array.from(this.children))i.tagName.toLowerCase()===e?(n.add(i),r.push(...Array.from(i.childNodes))):i.getAttribute(`slot`)===t&&(n.add(i),r.push(i));return r}};customElements.define(`adw-bottom-sheet-content`,AdwBottomSheetContent),customElements.define(`adw-bottom-sheet-sheet`,AdwBottomSheetSheet),customElements.define(`adw-bottom-sheet`,AdwBottomSheet);const Y=new WeakMap,We=new WeakMap;var AdwSidebarItem=class extends HTMLElement{static get observedAttributes(){return[`title`,`subtitle`,`icon-name`,`disabled`,`hidden`]}attributeChangedCallback(e,t,n){let r=Y.get(this);if(!r)return;let i=n??``;e===`title`?r.spec.title=i:e===`subtitle`?r.spec.subtitle=i:e===`icon-name`?r.spec.iconName=i:e===`disabled`?r.spec.enabled=n===null:e===`hidden`&&(r.spec.visible=n===null),r.sidebar.refresh()}},AdwSidebarSection=class extends HTMLElement{static get observedAttributes(){return[`title`]}attributeChangedCallback(e,t,n){let r=We.get(this);r&&(r.spec.title=n??``,r.sidebar.refresh())}},AdwSidebar=class extends HTMLElement{_state=new SidebarState;_listEl;_rows=[];_initialized=!1;_reflecting=!1;static get observedAttributes(){return[`mode`,`selected`]}get selected(){return this._state.selected}set selected(e){this.setAttribute(`selected`,String(e))}get selectedItem(){return this._state.selectedItem}get mode(){return this._state.mode}set mode(e){this.setAttribute(`mode`,e)}get sections(){return this._state.sections}set sections(e){this._state.setSections(e),this._rebuild()}get filter(){return this._state.filter}set filter(e){this._state.setFilter(e),this._rebuild()}connectedCallback(){this._initialized||(this._initialized=!0,this._listEl=document.createElement(`div`),this._listEl.className=`adw-sidebar-list`,this._listEl.setAttribute(`role`,`listbox`),attachRovingFocus({host:this,orientation:`vertical`,items:()=>this._rows.filter(e=>!e.el.hidden&&!e.el.disabled).map(e=>e.el),select:e=>{let t=this._rows.find(t=>t.el===e);t!==void 0&&this._state.setSelected(t.index)}}),this._state.setSections(this._readDeclaredSections()),this._state.setMode(this._readModeAttr()),this.hasAttribute(`selected`)&&this._state.setSelected(this._readSelectedAttr()),this._state.subscribe(e=>this._onSelectionChanged(e)),this.replaceChildren(this._listEl),this._applyMode(),this._rebuild(),this._reflectSelected())}attributeChangedCallback(e){if(!(!this._initialized||this._reflecting)){if(e===`selected`){this._state.setSelected(this._readSelectedAttr()),this._reflectSelected();return}e===`mode`&&this._state.setMode(this._readModeAttr())&&(this._applyMode(),this._applySelection())}}refresh(){this._initialized&&(this._state.refresh(),this._rebuild())}_readDeclaredSections(){let e=[];for(let t of Array.from(this.querySelectorAll(`adw-sidebar-section`))){let n=[];for(let e of Array.from(t.querySelectorAll(`adw-sidebar-item`))){let t={title:e.getAttribute(`title`)??``,subtitle:e.getAttribute(`subtitle`)??``,iconName:e.getAttribute(`icon-name`)??``,enabled:!e.hasAttribute(`disabled`),visible:!e.hasAttribute(`hidden`)};Y.set(e,{sidebar:this,spec:t}),n.push(t)}let r={title:t.getAttribute(`title`)??``,items:n};We.set(t,{sidebar:this,spec:r}),e.push(r)}return e}_readModeAttr(){return this.getAttribute(`mode`)===`page`?`page`:`sidebar`}_readSelectedAttr(){return Number.parseFloat(this.getAttribute(`selected`)??``)}_reflectSelected(){this._reflecting=!0,this.setAttribute(`selected`,String(this._state.selected)),this._reflecting=!1}_onSelectionChanged(e){this._reflectSelected(),this._applySelection(),this.dispatchEvent(new CustomEvent(`notify::selected`,{bubbles:!0,detail:{selected:e.selected,previous:e.previous,interactive:e.interactive}}))}_activate(e){this._state.activate(e).activated&&this.dispatchEvent(new CustomEvent(`activated`,{bubbles:!0,detail:{index:e}}))}_rebuild(){let e=new Map;for(let t of this._state.headers)e.set(t.sectionIndex,t);let t=[];for(let e of this._state.visibleItems){let n=t[t.length-1];n&&n.sectionIndex===e.sectionIndex?n.items.push(e):t.push({sectionIndex:e.sectionIndex,items:[e]})}this._rows=[];let n=[];for(let r of t){let t=e.get(r.sectionIndex);t&&n.push(this._createHeader(t));let i=document.createElement(`div`);i.className=`adw-sidebar-section`;for(let e of r.items){let t=this._createRow(e);i.appendChild(t),this._rows.push({el:t,index:e.index})}n.push(i)}this._listEl.replaceChildren(...n),this.classList.toggle(`empty`,this._state.isEmpty),this._applySelection()}_createHeader(e){let t=document.createElement(`div`);if(t.className=`adw-sidebar-section-header`,e.kind===`title`){t.classList.add(`has-title`);let n=document.createElement(`span`);n.className=`adw-sidebar-section-heading`,n.textContent=e.title,t.appendChild(n)}else t.classList.add(`separator`);return e.first&&t.classList.add(`first`),t}_createRow(e){let t=e.item,n=document.createElement(`button`);n.type=`button`,n.className=`adw-sidebar-item`,n.setAttribute(`role`,`option`),n.hidden=t.visible===!1,n.disabled=t.enabled===!1;let r=createAdwIcon(t.iconName??null,`adw-sidebar-item-icon`);r.hidden=!e.iconVisible,n.appendChild(r);let i=document.createElement(`span`);i.className=`adw-sidebar-item-text`;let a=document.createElement(`span`);a.className=`adw-sidebar-item-title`,a.textContent=t.title,a.hidden=!e.titleVisible,i.appendChild(a);let o=document.createElement(`span`);return o.className=`adw-sidebar-item-subtitle`,o.textContent=t.subtitle??``,o.hidden=!e.subtitleVisible,i.appendChild(o),n.appendChild(i),n.appendChild(createAdwIcon(`go-next`,`adw-sidebar-item-arrow`)),n.addEventListener(`click`,()=>this._activate(e.index)),n}_applyMode(){let e=this._state.mode===`page`;this.classList.toggle(`page`,e),this.classList.toggle(`mode-sidebar`,!e)}_applySelection(){let e=this._state.selected,t=this._state.selectionVisible;this._rows.forEach((n,r)=>{let i=n.index===e;n.el.classList.toggle(`selected`,i&&t),n.el.setAttribute(`aria-selected`,String(i)),n.el.tabIndex=i||e===-1&&r===0?0:-1})}};customElements.define(`adw-sidebar-item`,AdwSidebarItem),customElements.define(`adw-sidebar-section`,AdwSidebarSection),customElements.define(`adw-sidebar`,AdwSidebar);const Ge=[`a[href]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`,`);var AdwModalSurface=class{_init;_previouslyFocused=null;constructor(e){this._init=e,e.surface.setAttribute(`role`,e.role),e.surface.setAttribute(`aria-modal`,`true`),e.surface.hasAttribute(`tabindex`)||(e.surface.tabIndex=-1),e.host.addEventListener(`keydown`,e=>this._onKeyDown(e))}focusables(){return Array.from(this._init.surface.querySelectorAll(Ge)).filter(e=>!e.hasAttribute(`disabled`)&&!e.hidden&&e.getClientRects().length>0)}present(){let e=document.activeElement;this._previouslyFocused=e instanceof HTMLElement&&e!==this._init.host?e:null;let t=this.focusables(),n=this._init.initialFocus?.(t);((n&&t.includes(n)?n:void 0)??t[0]??this._init.surface).focus()}dismiss(){let e=this._previouslyFocused;this._previouslyFocused=null,e&&e.isConnected&&e.focus()}_onKeyDown(e){if(!this._init.isOpen())return;if(e.key===`Escape`){e.stopPropagation(),this._init.onEscape();return}if(e.key!==`Tab`)return;e.stopPropagation();let t=this.focusables();if(t.length===0){e.preventDefault(),this._init.surface.focus();return}let n=t[0],r=t[t.length-1],i=document.activeElement;e.shiftKey&&(i===n||i===this._init.surface||i===this._init.host)?(e.preventDefault(),r.focus()):!e.shiftKey&&(i===r||i===this._init.host)&&(e.preventDefault(),n.focus())}};function rowLabel(e){return stripMnemonic(u[e])}var AdwAboutDialog=class extends HTMLElement{_initialized=!1;_scrimEl;_sheetEl;_modal;_navView;_scrollEl;_mainToolbarEl;_developers=[];_designers=[];_artists=[];_documenters=[];static get observedAttributes(){return[`application-name`,`application-icon`,`developer-name`,`version`,`comments`,`website`,`support-url`,`issue-url`,`copyright`,`license`,`license-url`,`open`]}get applicationName(){return this.getAttribute(`application-name`)??``}set applicationName(e){this.setAttribute(`application-name`,e)}get applicationIcon(){return this.getAttribute(`application-icon`)??``}set applicationIcon(e){this.setAttribute(`application-icon`,e)}get developerName(){return this.getAttribute(`developer-name`)??``}set developerName(e){this.setAttribute(`developer-name`,e)}get version(){return this.getAttribute(`version`)??``}set version(e){this.setAttribute(`version`,e)}get comments(){return this.getAttribute(`comments`)??``}set comments(e){this.setAttribute(`comments`,e)}get website(){return this.getAttribute(`website`)??``}set website(e){this.setAttribute(`website`,e)}get supportUrl(){return this.getAttribute(`support-url`)??``}set supportUrl(e){this.setAttribute(`support-url`,e)}get issueUrl(){return this.getAttribute(`issue-url`)??``}set issueUrl(e){this.setAttribute(`issue-url`,e)}get copyright(){return this.getAttribute(`copyright`)??``}set copyright(e){this.setAttribute(`copyright`,e)}get license(){return this.getAttribute(`license`)??``}set license(e){this.setAttribute(`license`,e)}get licenseUrl(){return this.getAttribute(`license-url`)??``}set licenseUrl(e){this.setAttribute(`license-url`,e)}get open(){return this.hasAttribute(`open`)}set open(e){e?this.setAttribute(`open`,``):this.removeAttribute(`open`)}get developers(){return this._developers}set developers(e){this._developers=[...e],this._initialized&&this._render()}get designers(){return this._designers}set designers(e){this._designers=[...e],this._initialized&&this._render()}get artists(){return this._artists}set artists(e){this._artists=[...e],this._initialized&&this._render()}get documenters(){return this._documenters}set documenters(e){this._documenters=[...e],this._initialized&&this._render()}present(){this.open=!0}close(){this.open=!1}connectedCallback(){this._initialized||(this._initialized=!0,this._scrimEl=document.createElement(`div`),this._scrimEl.className=`adw-about-dialog-scrim`,this._scrimEl.addEventListener(`click`,()=>this.close()),this._sheetEl=document.createElement(`div`),this._sheetEl.className=`adw-about-dialog-sheet`,this._sheetEl.setAttribute(`aria-label`,u.dialogTitle),this.replaceChildren(this._scrimEl,this._sheetEl),this._modal=new AdwModalSurface({host:this,surface:this._sheetEl,role:`dialog`,isOpen:()=>this.open,onEscape:()=>this.close()}),this._render())}attributeChangedCallback(e,t,n){if(this._initialized&&t!==n){if(e===`open`){this._syncOpen(),this.dispatchEvent(new CustomEvent(`notify::open`,{bubbles:!0,detail:{open:this.open}})),this.open||this.dispatchEvent(new CustomEvent(`closed`,{bubbles:!0}));return}this._render()}}_syncOpen(){this.classList.toggle(`open`,this.open),this.open?(this._navView.replace?.([`main`]),this._scrollEl.scrollTop=0,this._updateHeaderTitle(),this._modal.present()):this._modal.dismiss()}_creditsSections(){return creditsSections({developers:this._developers,designers:this._designers,artists:this._artists,documenters:this._documenters})}_hasLegal(){let e=this.license.length>0?o.CUSTOM:o.UNKNOWN;return legalSectionVisible(this.copyright,e,this.license)}_render(){let e=this._creditsSections(),t=aboutDialogVisibility({applicationIcon:this.applicationIcon,applicationName:this.applicationName,developerName:this.developerName,version:this.version,comments:this.comments,website:this.website,supportUrl:this.supportUrl,issueUrl:this.issueUrl,hasCredits:e.length>0,hasLegal:this._hasLegal()});this._navView=document.createElement(`adw-navigation-view`),this._navView.append(this._buildMainPage(t)),t.detailsRow&&this._navView.append(this._buildDetailsPage(t)),t.creditsRow&&this._navView.append(this._buildCreditsPage(e)),t.legalRow&&this._navView.append(this._buildLegalPage()),this._sheetEl.replaceChildren(this._navView),this.classList.toggle(`open`,this.open)}_buildPage(e,t,n,r=t){let i=document.createElement(`adw-navigation-page`);i.setAttribute(`title`,t),i.setAttribute(`tag`,e);let a=document.createElement(`adw-header-bar`);if(a.setAttribute(`title`,r),n){let e=document.createElement(`button`);e.type=`button`,e.className=`adw-button flat circular adw-about-dialog-close`,e.setAttribute(`aria-label`,`Close`),e.addEventListener(`click`,()=>this.close());let endApply=()=>{let t=a.endSection??null;t&&t.appendChild(e)};queueMicrotask(endApply)}let o=document.createElement(`div`);o.className=`adw-about-dialog-scroll`;let s=document.createElement(`div`);s.className=`adw-about-dialog-clamp`;let c=document.createElement(`div`);c.className=`adw-about-dialog-page-body`,s.appendChild(c),o.appendChild(s);let l=document.createElement(`div`);return l.className=`adw-about-dialog-toolbar-view`,l.append(a,o),i.appendChild(l),e===`main`&&(this._scrollEl=o,this._mainToolbarEl=l,l.classList.add(`main-page`),o.addEventListener(`scroll`,()=>this._updateHeaderTitle())),{page:i,body:c,header:a}}_buildMainPage(e){let{page:t,body:n}=this._buildPage(`main`,u.dialogTitle,!0,this.applicationName);if(e.appIcon&&n.appendChild(createAdwIcon(this.applicationIcon,`adw-about-dialog-icon`)),e.appName){let e=document.createElement(`span`);e.className=`adw-about-dialog-name`,e.textContent=this.applicationName,n.appendChild(e)}if(e.developerName){let e=document.createElement(`span`);e.className=`adw-about-dialog-developer`,e.textContent=this.developerName,n.appendChild(e)}if(e.version){let e=document.createElement(`span`);e.className=`adw-about-dialog-version`,e.textContent=this.version,n.appendChild(e)}let r=[];e.detailsRow&&r.push(this._buildNavRow(rowLabel(`detailsRow`),`details`)),e.websiteRow&&r.push(this._buildLinkRow(rowLabel(`websiteRow`),this.website));let i=[];e.supportRow&&i.push(this._buildLinkRow(rowLabel(`supportRow`),this.supportUrl)),e.issueRow&&i.push(this._buildLinkRow(rowLabel(`issueRow`),this.issueUrl));let a=[];return e.creditsRow&&a.push(this._buildNavRow(rowLabel(`creditsRow`),`credits`)),e.legalRow&&a.push(this._buildNavRow(rowLabel(`legalRow`),`legal`)),e.detailsGroup&&n.appendChild(this._buildGroup(`details`,r)),e.supportGroup&&n.appendChild(this._buildGroup(`support`,i)),e.creditsLegalGroup&&n.appendChild(this._buildGroup(`credits-legal`,a)),t}_buildGroup(e,t,n){let r=document.createElement(`adw-preferences-group`);e!==null&&r.setAttribute(`data-group`,e),n!==void 0&&r.setAttribute(`title`,n);for(let e of t)r.appendChild(e);let i=document.createElement(`div`);return i.className=`adw-about-dialog-rows`,i.appendChild(r),i}_buildNavRow(e,t){let n=document.createElement(`adw-action-row`);n.setAttribute(`title`,e),n.setAttribute(`activatable`,``);let r=createAdwIcon(`go-next`,`adw-about-dialog-chevron`);return r.setAttribute(`slot`,`suffix`),n.appendChild(r),n.addEventListener(`activated`,()=>{this._navView.push?.(t)}),n}_activateLink(e){let t=new CustomEvent(`activate-link`,{bubbles:!0,cancelable:!0,detail:{uri:e}});this.dispatchEvent(t)&&globalThis.open(e,`_blank`,`noopener,noreferrer`)}_buildDetailsPage(e){let{page:t,body:n}=this._buildPage(`details`,u.detailsPage,!1);if(e.commentsLabel){let e=document.createElement(`p`);e.className=`adw-about-dialog-comments`,e.textContent=this.comments,n.appendChild(e)}if(e.linksGroup){let t=[];e.detailsWebsiteRow&&t.push(this._buildLinkRow(rowLabel(`websiteRow`),this.website)),n.appendChild(this._buildGroup(`links`,t))}return t}_buildLinkRow(e,t){let n=document.createElement(`adw-action-row`);n.setAttribute(`title`,e),n.setAttribute(`activatable`,``),n.classList.add(`adw-about-dialog-link-row`);let r=createAdwIcon(`go-next`,`adw-about-dialog-chevron`);return r.setAttribute(`slot`,`suffix`),n.appendChild(r),n.addEventListener(`activated`,()=>this._activateLink(t)),n}_buildCreditsPage(e){let{page:t,body:n}=this._buildPage(`credits`,u.creditsPage,!1);for(let t of e){let e=t.people.map(e=>this._buildCreditRow(e));n.appendChild(this._buildGroup(null,e,t.title??void 0))}return t}_buildCreditRow(e){let t=document.createElement(`adw-action-row`);if(t.setAttribute(`title`,e.name),e.link!==null){let n=e.uri??``;t.setAttribute(`activatable`,``),t.classList.add(`adw-about-dialog-link-row`);let r=createAdwIcon(`go-next`,`adw-about-dialog-chevron`);r.setAttribute(`slot`,`suffix`),t.appendChild(r),t.addEventListener(`activated`,()=>this._activateLink(n))}return t}_buildLegalPage(){let{page:e,body:t}=this._buildPage(`legal`,u.legalPage,!1);if(this.copyright){let e=document.createElement(`p`);e.className=`adw-about-dialog-copyright`,e.textContent=this.copyright,t.appendChild(e)}if(this.license){let e=document.createElement(`p`);if(e.className=`adw-about-dialog-license`,this.licenseUrl){let t=document.createElement(`a`);t.href=this.licenseUrl,t.rel=`noopener noreferrer`,t.textContent=this.license,t.addEventListener(`click`,e=>{e.preventDefault(),this._activateLink(this.licenseUrl)}),e.appendChild(t)}else e.textContent=this.license;t.appendChild(e)}return e}_updateHeaderTitle(){!this._scrollEl||!this._mainToolbarEl||this._mainToolbarEl.classList.toggle(`scrolled`,this._scrollEl.scrollTop>0)}};customElements.define(`adw-about-dialog`,AdwAboutDialog);var AdwAlertResponse=class extends HTMLElement{static get observedAttributes(){return[`id`,`appearance`,`enabled`]}},AdwAlertDialog=class extends HTMLElement{_initialized=!1;_scrimEl;_dialogEl;_headingEl;_bodyEl;_childEl;_responseAreaEl;_modal;_model=new AdwAlertResponses;_buttons=new Map;_blockCloseResponse=!1;static get observedAttributes(){return[`heading`,`body`,`open`,`prefer-wide-layout`]}get heading(){return this.getAttribute(`heading`)??``}set heading(e){this.setAttribute(`heading`,e)}get body(){return this.getAttribute(`body`)??``}set body(e){this.setAttribute(`body`,e)}get open(){return this.hasAttribute(`open`)}set open(e){e?this.setAttribute(`open`,``):this.removeAttribute(`open`)}get preferWideLayout(){return this.hasAttribute(`prefer-wide-layout`)}set preferWideLayout(e){e?this.setAttribute(`prefer-wide-layout`,``):this.removeAttribute(`prefer-wide-layout`)}get defaultResponse(){return this._model.defaultResponse}set defaultResponse(e){this.setDefaultResponse(e)}get closeResponse(){return this._model.closeResponse}set closeResponse(e){this.setCloseResponse(e)}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=Array.from(this.querySelectorAll(`:scope > adw-alert-response`)),t=new Set(e),n=Array.from(this.childNodes).filter(e=>!t.has(e));this._scrimEl=document.createElement(`div`),this._scrimEl.className=`adw-alert-dialog-scrim`,this._scrimEl.addEventListener(`click`,()=>this._dismiss()),this._dialogEl=document.createElement(`div`),this._dialogEl.className=`adw-alert-dialog-box`,this._dialogEl.addEventListener(`click`,e=>e.stopPropagation()),this._modal=new AdwModalSurface({host:this,surface:this._dialogEl,role:`alertdialog`,isOpen:()=>this.open,onEscape:()=>this._dismiss(),initialFocus:e=>this._initialFocusTarget(e)});let r=document.createElement(`div`);r.className=`adw-alert-dialog-message`,this._headingEl=document.createElement(`h2`),this._headingEl.className=`adw-alert-dialog-heading`,this._bodyEl=document.createElement(`p`),this._bodyEl.className=`adw-alert-dialog-body`,this._childEl=document.createElement(`div`),this._childEl.className=`adw-alert-dialog-child`;for(let e of n)this._childEl.appendChild(e);r.append(this._headingEl,this._bodyEl,this._childEl),bindEmptySections(this._childEl),this._responseAreaEl=document.createElement(`div`),this._responseAreaEl.className=`adw-alert-dialog-responses`,this._dialogEl.append(r,this._responseAreaEl),this.replaceChildren(this._scrimEl,this._dialogEl);for(let t of e){let e=t.getAttribute(`id`);if(!e)continue;let n=t.getAttribute(`appearance`)??`default`;this.addResponse(e,(t.textContent??``).trim()),n!=="default"&&this.setResponseAppearance(e,n),t.getAttribute(`enabled`)===`false`&&this.setResponseEnabled(e,!1)}this._model.heading=this.heading,this._model.body=this.body,this._render()}attributeChangedCallback(e,t,n){this._initialized&&t!==n&&(this._render(),e===`heading`?(this._model.heading=this.heading,this.dispatchEvent(new CustomEvent(`notify::heading`,{bubbles:!0,detail:{heading:this.heading}}))):e===`body`?(this._model.body=this.body,this.dispatchEvent(new CustomEvent(`notify::body`,{bubbles:!0,detail:{body:this.body}}))):e===`open`&&(this.dispatchEvent(new CustomEvent(`notify::open`,{bubbles:!0,detail:{open:this.open}})),this.open?this._modal.present():this._modal.dismiss()))}present(e){this.open=!0}addResponse(e,t){if(this._model.hasResponse(e)){console.warn(`[adw-alert-dialog] Trying to add a response with id '${e}', but such a response already exists`);return}let n=document.createElement(`button`);n.type=`button`,n.className=`adw-button adw-alert-dialog-response`,n.textContent=t,n.addEventListener(`click`,()=>this._activateResponse(e)),this._model.addResponse(e,t),this._buttons.set(e,n),this._responseAreaEl&&this._responseAreaEl.appendChild(n),this._render()}addResponses(...e){for(let t=0;t+1<e.length;t+=2)this.addResponse(e[t],e[t+1])}removeResponse(e){if(!this._model.hasResponse(e))return;this._buttons.get(e)?.remove(),this._buttons.delete(e);let t=this._model.responses.filter(t=>t.id!==e),n=new AdwAlertResponses(this._model.heading,this._model.body);for(let e of t)n.addResponse(e.id,e.label,{appearance:e.appearance,enabled:e.enabled});n.closeResponse=this._model.closeResponse,n.defaultResponse=this._model.defaultResponse===e?null:this._model.defaultResponse,this._model=n,this._render()}hasResponse(e){return this._model.hasResponse(e)}getResponseLabel(e){return this._model.responses.find(t=>t.id===e)?.label??null}setResponseLabel(e,t){let n=this._buttons.get(e);n&&(this._model.addResponse(e,t),n.textContent=t)}getResponseAppearance(e){return this._model.hasResponse(e)?this._model.getResponseAppearance(e):null}setResponseAppearance(e,t){let n=this._buttons.get(e);n&&(this._model.setResponseAppearance(e,t),n.classList.toggle(`suggested-action`,t===`suggested`),n.classList.toggle(`destructive-action`,t===`destructive`))}getResponseEnabled(e){return this._model.hasResponse(e)?this._model.getResponseEnabled(e):!1}setResponseEnabled(e,t){let n=this._buttons.get(e);n&&(this._model.setResponseEnabled(e,t),n.disabled=!t)}setDefaultResponse(e){this._model.defaultResponse=e,this._render()}setCloseResponse(e){this._model.closeResponse=e}_activateResponse(e){this._model.getResponseEnabled(e)&&(this._blockCloseResponse=!0,this.open=!1,this._blockCloseResponse=!1,this._emitResponse(this._model.resolveById(e)))}_dismiss(){this.open&&(this.open=!1,!this._blockCloseResponse&&this._emitResponse(this._model.resolveById(null)))}_emitResponse(e){this.dispatchEvent(new CustomEvent(`response`,{bubbles:!0,detail:{response:e}}))}_initialFocusTarget(e){return e.find(e=>this._childEl.contains(e))??this._defaultResponseButton()}_defaultResponseButton(){let e=this._model.defaultResponse,t=this._model.responses.find(e=>e.enabled)?.id;return(e!==null&&this._model.getResponseEnabled(e)?this._buttons.get(e):void 0)??(t?this._buttons.get(t):void 0)}_render(){this.classList.toggle(`open`,this.open);let e=this.heading;this._headingEl.textContent=e,this._headingEl.hidden=e.length===0;let t=this.body;this._bodyEl.textContent=t,this._bodyEl.hidden=t.length===0;let n=this.preferWideLayout&&this._model.responses.length<=2;this._responseAreaEl.classList.toggle(`horizontal`,n);let r=this._model.defaultResponse;for(let e of this._model.responses){let t=e.id===r&&e.appearance==="default";this._buttons.get(e.id)?.classList.toggle(`default-response`,t)}}};customElements.define(`adw-alert-response`,AdwAlertResponse),customElements.define(`adw-alert-dialog`,AdwAlertDialog);const Ke=new Set([`adw-action-row`,`adw-switch-row`,`adw-combo-row`,`adw-spin-row`]),qe=new Set([...Ke,`adw-entry-row`,`adw-password-entry-row`,`adw-expander-row`,`adw-button-row`]);function isVisible(e){return!(e instanceof HTMLElement&&e.hidden)}function groupRows(e){let t=e.querySelector(`:scope > .adw-preferences-group-listbox`);return Array.from((t??e).children).filter(e=>qe.has(e.tagName.toLowerCase()))}function describeRow(e){let t=e.getAttribute(`subtitle`);return{title:e.getAttribute(`title`)??``,subtitle:t,visible:isVisible(e),isActionRow:Ke.has(e.tagName.toLowerCase()),useMarkup:!1,useUnderline:!1,ref:e}}function describeGroup(e){return{title:e.getAttribute(`title`)??``,visible:isVisible(e),rows:groupRows(e).map(describeRow),ref:e}}function describePreferencesPages(e){return Array.from(e.querySelectorAll(`adw-preferences-page`)).map(e=>({name:e.getAttribute(`name`),title:e.getAttribute(`title`)??``,iconName:e.getAttribute(`icon-name`),useUnderline:e.hasAttribute(`use-underline`),visible:isVisible(e),description:e.getAttribute(`description`)??``,groups:Array.from(e.querySelectorAll(`adw-preferences-group`)).map(describeGroup),ref:e}))}function searchPreferencesDom(e,t,n){return searchPreferences(describePreferencesPages(e),t,n)}var AdwPreferencesPage=class extends HTMLElement{static get observedAttributes(){return[`title`,`icon-name`,`name`,`use-underline`,`open`]}get name(){return this.getAttribute(`name`)??``}set name(e){this.setAttribute(`name`,e)}get iconName(){return this.getAttribute(`icon-name`)??``}set iconName(e){this.setAttribute(`icon-name`,e)}get useUnderline(){return this.hasAttribute(`use-underline`)}set useUnderline(e){this.toggleAttribute(`use-underline`,e)}get groups(){return Array.from(this.querySelectorAll(`adw-preferences-group`))}},AdwPreferencesDialog=class extends HTMLElement{_initialized=!1;_scrimEl;_dialogEl;_titleEl;_bodyEl;_pagesEl;_closeBtn;_modal;static get observedAttributes(){return[`title`,`open`,`can-close`,`content-width`]}get open(){return this.hasAttribute(`open`)}set open(e){e?this.setAttribute(`open`,``):this.removeAttribute(`open`)}get canClose(){let e=this.getAttribute(`can-close`);return e===null?!0:e!==`false`}set canClose(e){e?this.setAttribute(`can-close`,``):this.setAttribute(`can-close`,`false`)}get contentWidth(){let e=Number.parseInt(this.getAttribute(`content-width`)??``,10);return Number.isNaN(e)?640:e}set contentWidth(e){this.setAttribute(`content-width`,String(e))}present(){this.open=!0}close(){this._attemptClose()}forceClose(){this.open&&=!1}add(e){this._pagesEl.appendChild(e)}removePage(e){return e.parentNode===this._pagesEl?(this._pagesEl.removeChild(e),!0):!1}get pages(){return Array.from(this._pagesEl.querySelectorAll(`adw-preferences-page`))}search(e,t){return searchPreferencesDom(this._pagesEl,e,t)}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=Array.from(this.childNodes);this._scrimEl=document.createElement(`div`),this._scrimEl.className=`adw-preferences-dialog-scrim`,this._scrimEl.addEventListener(`click`,()=>this._attemptClose()),this._dialogEl=document.createElement(`div`),this._dialogEl.className=`adw-preferences-dialog-box`,this._dialogEl.addEventListener(`click`,e=>e.stopPropagation());let t=document.createElement(`div`);t.className=`adw-preferences-dialog-header`;let n=document.createElement(`div`);n.className=`adw-preferences-dialog-header-side`,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-preferences-dialog-title`;let r=document.createElement(`div`);r.className=`adw-preferences-dialog-header-side adw-preferences-dialog-header-side--end`,this._closeBtn=document.createElement(`button`),this._closeBtn.type=`button`,this._closeBtn.className=`adw-preferences-dialog-close`,this._closeBtn.setAttribute(`aria-label`,`Close`),this._closeBtn.addEventListener(`click`,()=>this._attemptClose()),r.appendChild(this._closeBtn),t.append(n,this._titleEl,r),this._bodyEl=document.createElement(`div`),this._bodyEl.className=`adw-preferences-dialog-body`,this._pagesEl=document.createElement(`div`),this._pagesEl.className=`adw-preferences-dialog-pages`;for(let t of e)this._pagesEl.appendChild(t);this._bodyEl.appendChild(this._pagesEl),this._dialogEl.append(t,this._bodyEl),this.replaceChildren(this._scrimEl,this._dialogEl),this._modal=new AdwModalSurface({host:this,surface:this._dialogEl,role:`dialog`,isOpen:()=>this.open,onEscape:()=>this._attemptClose()}),this._render()}attributeChangedCallback(e,t,n){this._initialized&&t!==n&&(this._render(),e===`open`&&(this.dispatchEvent(new CustomEvent(`notify::open`,{bubbles:!0,detail:{open:this.open}})),this.open?this._modal.present():(this.dispatchEvent(new CustomEvent(`closed`,{bubbles:!0})),this._modal.dismiss())))}_attemptClose(){if(this.open){if(!this.canClose){this.dispatchEvent(new CustomEvent(`close-attempt`,{bubbles:!0}));return}this.open=!1}}_render(){this.classList.toggle(`open`,this.open);let e=this.getAttribute(`title`)??``;this._titleEl.textContent=e,this._dialogEl.style.setProperty(`--adw-dialog-content-width`,`${this.contentWidth}px`);let t=!this.canClose;this._closeBtn.disabled=t,this._closeBtn.classList.toggle(`locked`,t)}};customElements.define(`adw-preferences-page`,AdwPreferencesPage),customElements.define(`adw-preferences-dialog`,AdwPreferencesDialog);const Je=[`auto`,`floating`,`bottom-sheet`];var AdwDialog=class extends HTMLElement{_initialized=!1;_scrimEl;_boxEl;_headerEl;_titleEl;_closeBtn;_contentEl;_modal;static get observedAttributes(){return[`title`,`open`,`can-close`,`content-width`,`content-height`,`presentation-mode`,`show-header`]}get open(){return this.hasAttribute(`open`)}set open(e){e?this.setAttribute(`open`,``):this.removeAttribute(`open`)}get title(){return this.getAttribute(`title`)??``}set title(e){this.setAttribute(`title`,e)}get canClose(){let e=this.getAttribute(`can-close`);return e===null?!0:e!==`false`}set canClose(e){e?this.setAttribute(`can-close`,``):this.setAttribute(`can-close`,`false`)}get contentWidth(){let e=Number.parseInt(this.getAttribute(`content-width`)??``,10);return Number.isNaN(e)?360:e}set contentWidth(e){this.setAttribute(`content-width`,String(e))}get contentHeight(){let e=Number.parseInt(this.getAttribute(`content-height`)??``,10);return Number.isNaN(e)?0:e}set contentHeight(e){e>0?this.setAttribute(`content-height`,String(e)):this.removeAttribute(`content-height`)}get presentationMode(){let e=this.getAttribute(`presentation-mode`);return e&&Je.includes(e)?e:`auto`}set presentationMode(e){this.setAttribute(`presentation-mode`,e)}get contentArea(){return this._contentEl}present(e){this.isConnected||(e??document.body).appendChild(this),this.open=!0}close(){this._attemptClose()}forceClose(){this.open&&=!1}connectedCallback(){if(this._initialized)return;this._initialized=!0,this.classList.add(`adw-dialog`);let e=Array.from(this.childNodes);this._scrimEl=document.createElement(`div`),this._scrimEl.className=`adw-dialog-scrim`,this._scrimEl.addEventListener(`click`,()=>this._attemptClose()),this._boxEl=document.createElement(`div`),this._boxEl.className=`adw-dialog-box`,this._boxEl.addEventListener(`click`,e=>e.stopPropagation()),this._modal=new AdwModalSurface({host:this,surface:this._boxEl,role:`dialog`,isOpen:()=>this.open,onEscape:()=>this._attemptClose()}),this._headerEl=document.createElement(`div`),this._headerEl.className=`adw-dialog-header`;let t=document.createElement(`div`);t.className=`adw-dialog-header-side`,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-dialog-title`;let n=document.createElement(`div`);n.className=`adw-dialog-header-side adw-dialog-header-side--end`,this._closeBtn=document.createElement(`button`),this._closeBtn.type=`button`,this._closeBtn.className=`adw-dialog-close`,this._closeBtn.setAttribute(`aria-label`,`Close`),this._closeBtn.addEventListener(`click`,()=>this._attemptClose()),n.appendChild(this._closeBtn),this._headerEl.append(t,this._titleEl,n),this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-dialog-content`;for(let t of e)this._contentEl.appendChild(t);this._boxEl.append(this._headerEl,this._contentEl),this._scrimEl.appendChild(this._boxEl),this.replaceChildren(this._scrimEl),this._render()}attributeChangedCallback(e,t,n){this._initialized&&t!==n&&(this._render(),e===`open`&&(this.dispatchEvent(new CustomEvent(`notify::open`,{bubbles:!0,detail:{open:this.open}})),this.open?this._modal.present():this._onClosed()))}_attemptClose(){if(this.open){if(!this.canClose){this.dispatchEvent(new CustomEvent(`close-attempt`,{bubbles:!0}));return}this.open=!1}}_onClosed(){this.dispatchEvent(new CustomEvent(`closed`,{bubbles:!0})),this._modal.dismiss()}_render(){this.classList.toggle(`open`,this.open);let e=this.title;this._titleEl.textContent=e;let t=e.length>0||this.hasAttribute(`show-header`);this._headerEl.hidden=!t,this.dataset.presentation=this.presentationMode,this._boxEl.style.setProperty(`--adw-dialog-content-width`,`${this.contentWidth}px`);let n=this.contentHeight;n>0?this._boxEl.style.setProperty(`--adw-dialog-content-height`,`${n}px`):this._boxEl.style.removeProperty(`--adw-dialog-content-height`);let r=!this.canClose;this._closeBtn.disabled=r,this._closeBtn.classList.toggle(`locked`,r)}};if(customElements.define(`adw-dialog`,AdwDialog),typeof document<`u`&&!document.getElementById(`adwaita-web-style`)){let e=document.createElement(`style`);e.id=`adwaita-web-style`,e.textContent=`@charset "UTF-8";
|
|
4
4
|
:root {
|
|
5
|
-
--icon-edit-paste: url("data:image/svg+xml,%3Csvg%20height%3D'16px'%20viewBox%3D'0%200%2016%2016'%20width%3D'16px'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%3E%20%3Cpath%20d%3D'm%207%200%20c%20-0.554688%200%20-1%200.445312%20-1%201%20h%20-2%20c%20-1.644531%200%20-3%201.355469%20-3%203%20v%209%20c%200%201.644531%201.355469%203%203%203%20h%208%20c%201.644531%200%203%20-1.355469%203%20-3%20v%20-9%20c%200%20-1.644531%20-1.355469%20-3%20-3%20-3%20h%20-2%20c%200%20-0.554688%20-0.445312%20-1%20-1%20-1%20z%20m%20-3%203%20h%201%20v%201%20c%200%200.554688%200.445312%201%201%201%20h%204%20c%200.554688%200%201%20-0.445312%201%20-1%20v%20-1%20h%201%20c%200.570312%200%201%200.429688%201%201%20v%209%20c%200%200.570312%20-0.429688%201%20-1%201%20h%20-8%20c%20-0.570312%200%20-1%20-0.429688%20-1%20-1%20v%20-9%20c%200%20-0.570312%200.429688%20-1%201%20-1%20z%20m%200%200'%20fill%3D'currentColor'%2F%3E%20%3C%2Fsvg%3E");
|
|
6
5
|
--icon-go-down: url("data:image/svg+xml,%3Csvg%20height%3D'16px'%20viewBox%3D'0%200%2016%2016'%20width%3D'16px'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%3E%20%3Cpath%20d%3D'm%201%205%20c%200%20-0.265625%200.105469%20-0.519531%200.292969%20-0.707031%20c%200.390625%20-0.390625%201.023437%20-0.390625%201.414062%200%20l%205.292969%205.292969%20l%205.292969%20-5.292969%20c%200.390625%20-0.390625%201.023437%20-0.390625%201.414062%200%20c%200.1875%200.1875%200.292969%200.441406%200.292969%200.707031%20s%20-0.105469%200.519531%20-0.292969%200.707031%20l%20-6%206%20c%20-0.390625%200.390625%20-1.023437%200.390625%20-1.414062%200%20l%20-6%20-6%20c%20-0.1875%20-0.1875%20-0.292969%20-0.441406%20-0.292969%20-0.707031%20z%20m%200%200'%20fill%3D'currentColor'%2F%3E%20%3C%2Fsvg%3E");
|
|
7
6
|
--icon-sidebar-show: url("data:image/svg+xml,%3Csvg%20height%3D'16px'%20viewBox%3D'0%200%2016%2016'%20width%3D'16px'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%3E%20%3Cg%20fill%3D'currentColor'%3E%20%3Cpath%20d%3D'm%206%2013%20v%20-10%20h%20-3%20c%20-0.550781%200%20-1%200.449219%20-1%201%20v%208%20c%200%200.550781%200.449219%201%201%201%20z%20m%200%200'%20fill-opacity%3D'0.34902'%2F%3E%20%3Cpath%20d%3D'm%203%201%20c%20-1.644531%200%20-3%201.355469%20-3%203%20v%208%20c%200%201.644531%201.355469%203%203%203%20h%2010%20c%201.644531%200%203%20-1.355469%203%20-3%20v%20-8%20c%200%20-1.644531%20-1.355469%20-3%20-3%20-3%20z%20m%200%202%20h%203%20v%2010%20h%20-3%20c%20-0.570312%200%20-1%20-0.429688%20-1%20-1%20v%20-8%20c%200%20-0.570312%200.429688%20-1%201%20-1%20z%20m%204%200%20h%206%20c%200.570312%200%201%200.429688%201%201%20v%208%20c%200%200.570312%20-0.429688%201%20-1%201%20h%20-6%20z%20m%200%200'%2F%3E%20%3C%2Fg%3E%20%3C%2Fsvg%3E");
|
|
8
7
|
--icon-go-previous: url("data:image/svg+xml,%3Csvg%20height%3D'16px'%20viewBox%3D'0%200%2016%2016'%20width%3D'16px'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%3E%20%3Cpath%20d%3D'm%2012%202%20c%200%20-0.265625%20-0.105469%20-0.519531%20-0.292969%20-0.707031%20c%20-0.390625%20-0.390625%20-1.023437%20-0.390625%20-1.414062%200%20l%20-6%206%20c%20-0.1875%200.1875%20-0.292969%200.441406%20-0.292969%200.707031%20s%200.105469%200.519531%200.292969%200.707031%20l%206%206%20c%200.390625%200.390625%201.023437%200.390625%201.414062%200%20c%200.1875%20-0.1875%200.292969%20-0.441406%200.292969%20-0.707031%20s%20-0.105469%20-0.519531%20-0.292969%20-0.707031%20l%20-5.292969%20-5.292969%20l%205.292969%20-5.292969%20c%200.1875%20-0.1875%200.292969%20-0.441406%200.292969%20-0.707031%20z%20m%200%200'%20fill%3D'currentColor'%2F%3E%20%3C%2Fsvg%3E");
|
|
@@ -27,9 +26,12 @@ var e=Object.defineProperty,__name=(t,n)=>e(t,`name`,{value:n,configurable:!0});
|
|
|
27
26
|
--icon-document-save: url("data:image/svg+xml,%3Csvg%20height%3D'16px'%20viewBox%3D'0%200%2016%2016'%20width%3D'16px'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%3E%20%3Cpath%20d%3D'm%208%200%20c%20-0.550781%200%20-1%200.449219%20-1%201%20v%208.585938%20l%20-1.292969%20-1.292969%20c%20-0.1875%20-0.1875%20-0.441406%20-0.292969%20-0.707031%20-0.292969%20s%20-0.519531%200.105469%20-0.707031%200.292969%20c%20-0.390625%200.390625%20-0.390625%201.023437%200%201.414062%20l%203%203%20c%200.390625%200.390625%201.023437%200.390625%201.414062%200%20l%203%20-3%20c%200.390625%20-0.390625%200.390625%20-1.023437%200%20-1.414062%20s%20-1.023437%20-0.390625%20-1.414062%200%20l%20-1.292969%201.292969%20v%20-8.585938%20c%200%20-0.550781%20-0.449219%20-1%20-1%20-1%20z%20m%20-7%2014%20v%202%20h%2014%20v%20-2%20z%20m%200%200'%20fill%3D'currentColor'%2F%3E%20%3C%2Fsvg%3E");
|
|
28
27
|
--icon-mail-send: url("data:image/svg+xml,%3Csvg%20height%3D'16px'%20viewBox%3D'0%200%2016%2016'%20width%3D'16px'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%3E%20%3Cpath%20d%3D'm%208%200%20c%20-0.257812%200%20-0.511719%200.0976562%20-0.707031%200.292969%20l%20-1.25%201.25%20l%20-1.761719%201.730469%20c%20-0.191406%200.199218%20-0.28125%200.441406%20-0.28125%200.75%20c%200%200.976562%201%201%201%201%20c%200.257812%200%200.527344%20-0.128907%200.71875%20-0.3125%20l%201.28125%20-1.28125%20v%203.570312%20s%200%201%201%201%20s%201%20-1%201%20-1%20v%20-3.570312%20l%201.28125%201.28125%20c%200.191406%200.183593%200.410156%200.3125%200.71875%200.3125%20c%200%200%201%20-0.023438%201%20-1%20c%200%20-0.308594%20-0.089844%20-0.550782%20-0.28125%20-0.75%20l%20-1.761719%20-1.730469%20l%20-1.25%20-1.25%20c%20-0.195312%20-0.1953128%20-0.449219%20-0.292969%20-0.707031%20-0.292969%20z%20m%20-5%209%20c%20-1.644531%200%20-3%201.355469%20-3%203%20v%204%20h%202%20v%20-3.800781%20l%204.613281%203.078125%20c%200.835938%200.558594%201.9375%200.558594%202.773438%200%20l%204.613281%20-3.078125%20v%203.800781%20h%202%20v%20-4%20c%200%20-1.644531%20-1.355469%20-3%20-3%20-3%20z%20m%200.800781%202%20h%208.398438%20l%20-3.921875%202.613281%20c%20-0.171875%200.113281%20-0.382813%200.113281%20-0.554688%200%20z%20m%200%200'%20fill%3D'currentColor'%2F%3E%20%3C%2Fsvg%3E");
|
|
29
28
|
--icon-mail-reply-sender: url("data:image/svg+xml,%3Csvg%20height%3D'16px'%20viewBox%3D'0%200%2016%2016'%20width%3D'16px'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%3E%20%3Cpath%20d%3D'm%205%202%20c%20-0.265625%200%20-0.519531%200.105469%20-0.707031%200.292969%20l%20-4%204%20c%20-0.3906252%200.390625%20-0.3906252%201.023437%200%201.414062%20l%204%204%20c%200.390625%200.390625%201.023437%200.390625%201.414062%200%20s%200.390625%20-1.023437%200%20-1.414062%20l%20-2.292969%20-2.292969%20h%208.585938%20c%201.117188%200%202%200.882812%202%202%20v%203%20c%200%200.550781%200.449219%201%201%201%20s%201%20-0.449219%201%20-1%20v%20-3%20c%200%20-0.023438%200%20-0.046875%20-0.003906%20-0.070312%20c%20-0.035156%20-2.164063%20-1.820313%20-3.929688%20-3.996094%20-3.929688%20h%20-8.585938%20l%202.292969%20-2.292969%20c%200.390625%20-0.390625%200.390625%20-1.023437%200%20-1.414062%20c%20-0.1875%20-0.1875%20-0.441406%20-0.292969%20-0.707031%20-0.292969%20z%20m%200%200'%20fill%3D'currentColor'%2F%3E%20%3C%2Fsvg%3E");
|
|
29
|
+
--icon-folder-documents: url("data:image/svg+xml,%3Csvg%20height%3D'16px'%20viewBox%3D'0%200%2016%2016'%20width%3D'16px'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%3E%20%3Cpath%20d%3D'm%204.96875%201.003906%20c%20-1.644531%200%20-3%201.355469%20-3%203%20v%209%20c%200%201.644532%201.355469%203%203%203%20h%206%20c%201.644531%200%203%20-1.355468%203%20-3%20v%20-7.5%20c%200%20-0.265625%20-0.105469%20-0.519531%20-0.292969%20-0.707031%20l%20-3.5%20-3.5%20c%20-0.1875%20-0.1875%20-0.441406%20-0.292969%20-0.707031%20-0.292969%20z%20m%200%202%20h%204%20v%201.5%20c%200%201%200.5%201.5%201.5%201.5%20h%201.5%20v%207%20c%200%200.570313%20-0.429688%201%20-1%201%20h%20-6%20c%20-0.570312%200%20-1%20-0.429687%20-1%20-1%20v%20-9%20c%200%20-0.570312%200.429688%20-1%201%20-1%20z%20m%200%200'%20fill%3D'currentColor'%2F%3E%20%3C%2Fsvg%3E");
|
|
30
30
|
--icon-folder-download: url("data:image/svg+xml,%3Csvg%20height%3D'16px'%20viewBox%3D'0%200%2016%2016'%20width%3D'16px'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%3E%20%3Cpath%20d%3D'm%207.984375%200%20c%20-0.550781%200%20-1%200.449219%20-1%201%20v%208.585938%20l%20-2.292969%20-2.292969%20c%20-0.1875%20-0.1875%20-0.441406%20-0.292969%20-0.707031%20-0.292969%20s%20-0.519531%200.105469%20-0.707031%200.292969%20c%20-0.390625%200.390625%20-0.390625%201.023437%200%201.414062%20l%204%204%20c%200.390625%200.390625%201.023437%200.390625%201.414062%200%20l%204%20-4%20c%200.390625%20-0.390625%200.390625%20-1.023437%200%20-1.414062%20s%20-1.023437%20-0.390625%20-1.414062%200%20l%20-2.292969%202.292969%20v%20-8.585938%20c%200%20-0.550781%20-0.449219%20-1%20-1%20-1%20z%20m%20-6%2014%20v%202%20h%2012%20v%20-2%20z%20m%200%200'%20fill%3D'currentColor'%2F%3E%20%3C%2Fsvg%3E");
|
|
31
31
|
--icon-view-grid: url("data:image/svg+xml,%3Csvg%20height%3D'16px'%20viewBox%3D'0%200%2016%2016'%20width%3D'16px'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%3E%20%3Cpath%20d%3D'm%202%201%20c%20-0.554688%200%20-1%200.445312%20-1%201%20v%204%20c%200%200.554688%200.445312%201%201%201%20h%204%20c%200.554688%200%201%20-0.445312%201%20-1%20v%20-4%20c%200%20-0.554688%20-0.445312%20-1%20-1%20-1%20z%20m%208%200%20c%20-0.554688%200%20-1%200.445312%20-1%201%20v%204%20c%200%200.554688%200.445312%201%201%201%20h%204%20c%200.554688%200%201%20-0.445312%201%20-1%20v%20-4%20c%200%20-0.554688%20-0.445312%20-1%20-1%20-1%20z%20m%20-8%208%20c%20-0.554688%200%20-1%200.445312%20-1%201%20v%204%20c%200%200.554688%200.445312%201%201%201%20h%204%20c%200.554688%200%201%20-0.445312%201%20-1%20v%20-4%20c%200%20-0.554688%20-0.445312%20-1%20-1%20-1%20z%20m%208%200%20c%20-0.554688%200%20-1%200.445312%20-1%201%20v%204%20c%200%200.554688%200.445312%201%201%201%20h%204%20c%200.554688%200%201%20-0.445312%201%20-1%20v%20-4%20c%200%20-0.554688%20-0.445312%20-1%20-1%20-1%20z%20m%200%200'%20fill%3D'currentColor'%2F%3E%20%3C%2Fsvg%3E");
|
|
32
32
|
--icon-view-list: url("data:image/svg+xml,%3Csvg%20height%3D'16px'%20viewBox%3D'0%200%2016%2016'%20width%3D'16px'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%3E%20%3Cpath%20d%3D'm%202%201%20c%20-0.554688%200%20-1%200.445312%20-1%201%20v%202%20c%200%200.554688%200.445312%201%201%201%20h%202%20c%200.554688%200%201%20-0.445312%201%20-1%20v%20-2%20c%200%20-0.554688%20-0.445312%20-1%20-1%20-1%20z%20m%205%201%20v%202%20h%208%20v%20-2%20z%20m%20-5%204.015625%20c%20-0.554688%200%20-1%200.445313%20-1%201%20v%201.980469%20c%200%200.550781%200.445312%201%201%201%20h%202%20c%200.554688%200%201%20-0.449219%201%20-1%20v%20-1.980469%20c%200%20-0.554687%20-0.445312%20-1%20-1%20-1%20z%20m%205%200.984375%20v%202%20h%208%20v%20-2%20z%20m%20-5%204%20c%20-0.554688%200%20-1%200.445312%20-1%201%20v%201.980469%20c%200%200.550781%200.445312%201%201%201%20h%202%20c%200.554688%200%201%20-0.449219%201%20-1%20v%20-1.980469%20c%200%20-0.554688%20-0.445312%20-1%20-1%20-1%20z%20m%205%200.984375%20v%202%20h%208%20v%20-2%20z%20m%200%200'%20fill%3D'currentColor'%2F%3E%20%3C%2Fsvg%3E");
|
|
33
|
+
--icon-view-more: url("data:image/svg+xml,%3Csvg%20height%3D'16px'%20viewBox%3D'0%200%2016%2016'%20width%3D'16px'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%3E%20%3Cpath%20d%3D'm%207.996094%200%20c%20-1.105469%200%20-2%200.894531%20-2%202%20s%200.894531%202%202%202%20c%201.101562%200%202%20-0.894531%202%20-2%20s%20-0.898438%20-2%20-2%20-2%20z%20m%200%206%20c%20-1.105469%200%20-2%200.894531%20-2%202%20s%200.894531%202%202%202%20c%201.101562%200%202%20-0.894531%202%20-2%20s%20-0.898438%20-2%20-2%20-2%20z%20m%200%206%20c%20-1.105469%200%20-2%200.894531%20-2%202%20s%200.894531%202%202%202%20c%201.101562%200%202%20-0.894531%202%20-2%20s%20-0.898438%20-2%20-2%20-2%20z%20m%200%200'%20fill%3D'currentColor'%2F%3E%20%3C%2Fsvg%3E");
|
|
34
|
+
--icon-view-paged: url("data:image/svg+xml,%3Csvg%20height%3D'16px'%20viewBox%3D'0%200%2016%2016'%20width%3D'16px'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%3E%20%3Cg%20fill%3D'currentColor'%3E%20%3Cpath%20d%3D'm%209%205.5%20v%20-1%20c%200%20-0.277344%20-0.222656%20-0.5%20-0.5%20-0.5%20h%20-3%20c%20-0.277344%200%20-0.5%200.222656%20-0.5%200.5%20v%201%20c%200%200.277344%200.222656%200.5%200.5%200.5%20h%203%20c%200.277344%200%200.5%20-0.222656%200.5%20-0.5%20z%20m%200%200'%20fill-opacity%3D'0.34902'%2F%3E%20%3Cpath%20d%3D'm%204%200%20c%20-1.644531%200%20-3%201.355469%20-3%203%20v%207%20c%200%201.644531%201.355469%203%203%203%20h%206%20c%201.644531%200%203%20-1.355469%203%20-3%20v%20-7%20c%200%20-1.644531%20-1.355469%20-3%20-3%20-3%20z%20m%200%202%20h%206%20c%200.570312%200%201%200.429688%201%201%20v%207%20c%200%200.570312%20-0.429688%201%20-1%201%20h%20-6%20c%20-0.570312%200%20-1%20-0.429688%20-1%20-1%20v%20-7%20c%200%20-0.570312%200.429688%20-1%201%20-1%20z%20m%2011%202%20c%20-0.550781%200%20-1%200.449219%20-1%201%20v%208%20c%200%200.550781%20-0.449219%201%20-1%201%20h%20-7%20c%20-0.550781%200%20-1%200.449219%20-1%201%20s%200.449219%201%201%201%20h%207%20c%201.65625%200%203%20-1.34375%203%20-3%20v%20-8%20c%200%20-0.550781%20-0.449219%20-1%20-1%20-1%20z%20m%200%200'%2F%3E%20%3Cpath%20d%3D'm%209%208.5%20v%20-1%20c%200%20-0.277344%20-0.222656%20-0.5%20-0.5%20-0.5%20h%20-3%20c%20-0.277344%200%20-0.5%200.222656%20-0.5%200.5%20v%201%20c%200%200.277344%200.222656%200.5%200.5%200.5%20h%203%20c%200.277344%200%200.5%20-0.222656%200.5%20-0.5%20z%20m%200%200'%20fill-opacity%3D'0.34902'%2F%3E%20%3C%2Fg%3E%20%3C%2Fsvg%3E");
|
|
33
35
|
--icon-view-columns: url("data:image/svg+xml,%3Csvg%20height%3D'16px'%20viewBox%3D'0%200%2016%2016'%20width%3D'16px'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%3E%20%3Cpath%20d%3D'm%202%201%20c%20-0.554688%200%20-1%200.445312%20-1%201%20v%2012%20c%200%200.554688%200.445312%201%201%201%20h%202%20c%200.554688%200%201%20-0.445312%201%20-1%20v%20-12%20c%200%20-0.554688%20-0.445312%20-1%20-1%20-1%20z%20m%205%200%20c%20-0.554688%200%20-1%200.445312%20-1%201%20v%2012%20c%200%200.554688%200.445312%201%201%201%20h%202%20c%200.554688%200%201%20-0.445312%201%20-1%20v%20-12%20c%200%20-0.554688%20-0.445312%20-1%20-1%20-1%20z%20m%205%200%20c%20-0.554688%200%20-1%200.445312%20-1%201%20v%2012%20c%200%200.554688%200.445312%201%201%201%20h%202%20c%200.554688%200%201%20-0.445312%201%20-1%20v%20-12%20c%200%20-0.554688%20-0.445312%20-1%20-1%20-1%20z%20m%200%200'%20fill%3D'currentColor'%2F%3E%20%3C%2Fsvg%3E");
|
|
34
36
|
--icon-list-remove: url("data:image/svg+xml,%3Csvg%20height%3D'16px'%20viewBox%3D'0%200%2016%2016'%20width%3D'16px'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%3E%20%3Cpath%20d%3D'm%201%207%20h%2014%20v%202%20h%20-14%20z%20m%200%200'%20fill%3D'currentColor'%2F%3E%20%3C%2Fsvg%3E");
|
|
35
37
|
--icon-send-to: url("data:image/svg+xml,%3Csvg%20height%3D'16px'%20viewBox%3D'0%200%2016%2016'%20width%3D'16px'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%3E%20%3Cpath%20d%3D'm%208%200%20c%20-0.257812%200%20-0.511719%200.0976562%20-0.707031%200.292969%20l%20-1.246094%201.25%20l%20-1.765625%201.730469%20c%20-0.191406%200.199218%20-0.28125%200.441406%20-0.28125%200.75%20c%200%200.976562%201%201%201%201%20c%200.257812%200%200.527344%20-0.128907%200.71875%20-0.3125%20l%201.28125%20-1.28125%20v%207.570312%20s%200%201%201%201%20s%201%20-1%201%20-1%20v%20-7.570312%20l%201.28125%201.28125%20c%200.191406%200.183593%200.410156%200.3125%200.71875%200.3125%20c%200%200%201%20-0.023438%201%20-1%20c%200%20-0.308594%20-0.089844%20-0.550782%20-0.28125%20-0.75%20l%20-1.765625%20-1.730469%20l%20-1.246094%20-1.25%20c%20-0.195312%20-0.1953128%20-0.449219%20-0.292969%20-0.707031%20-0.292969%20z%20m%20-3.96875%206.964844%20c%20-1.660156%20-0.027344%20-3.03125%201.371094%20-3.03125%203.035156%20v%202.972656%20c%200%201.664063%201.371094%203.035156%203.03125%203.035156%20h%207.9375%20c%201.664062%200%203.03125%20-1.371093%203.03125%20-3.035156%20v%20-2.972656%20c%200%20-1.664062%20-1.367188%20-3.0625%20-3.03125%20-3.035156%20l%20-1.96875%200.035156%20v%202%20l%201.96875%20-0.035156%20c%200.589844%20-0.007813%201.03125%200.445312%201.03125%201.035156%20v%202.972656%20c%200%200.589844%20-0.441406%201.035156%20-1.03125%201.035156%20h%20-7.9375%20c%20-0.585938%200%20-1.03125%20-0.445312%20-1.03125%20-1.035156%20v%20-2.972656%20c%200%20-0.589844%200.445312%20-1.042969%201.03125%20-1.035156%20l%201.96875%200.035156%20v%20-2%20z%20m%200%200'%20fill%3D'currentColor'%2F%3E%20%3C%2Fsvg%3E");
|
|
@@ -44,11 +46,6 @@ var e=Object.defineProperty,__name=(t,n)=>e(t,`name`,{value:n,configurable:!0});
|
|
|
44
46
|
--icon-image-missing: url("data:image/svg+xml,%3Csvg%20height%3D'16px'%20viewBox%3D'0%200%2016%2016'%20width%3D'16px'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%3E%20%3Cpath%20d%3D'm%204.015625%201.03125%20c%20-1.644531%200%20-3%201.355469%20-3%203%20v%201%20h%201%20v%20-1%20c%200%20-1.109375%200.890625%20-2%202%20-2%20h%201%20v%20-1%20z%20m%202%200%20v%201%20h%204%20v%20-1%20z%20m%205%200%20v%201%20h%201%20c%201.109375%200%202%200.890625%202%202%20v%201%20h%201%20v%20-1%20c%200%20-1.644531%20-1.355469%20-3%20-3%20-3%20z%20m%20-5%204%20c%20-0.550781%200%20-1%200.449219%20-1%201%20s%200.449219%201%201%201%20s%201%20-0.449219%201%20-1%20s%20-0.449219%20-1%20-1%20-1%20z%20m%20-5%201%20v%204%20h%201%20v%20-4%20z%20m%2013%200%20v%204%20h%201%20v%20-4%20z%20m%20-4.5%202%20l%20-2%202%20l%20-1.5%20-1%20l%20-2%202%20v%200.5%20c%200%200.5%200.5%200.5%200.5%200.5%20h%207%20s%200.472656%20-0.035156%200.5%20-0.5%20v%20-1%20z%20m%20-8.5%203%20v%201%20c%200%201.644531%201.355469%203%203%203%20h%201%20v%20-1%20h%20-1%20c%20-1.109375%200%20-2%20-0.890625%20-2%20-2%20v%20-1%20z%20m%2013%200%20v%201%20c%200%201.109375%20-0.890625%202%20-2%202%20h%20-1%20v%201%20h%201%20c%201.644531%200%203%20-1.355469%203%20-3%20v%20-1%20z%20m%20-8%203%20v%201%20h%204%20v%20-1%20z%20m%200%200'%20fill%3D'currentColor'%20fill-opacity%3D'0.34902'%2F%3E%20%3C%2Fsvg%3E");
|
|
45
47
|
}
|
|
46
48
|
|
|
47
|
-
.adw-icon--edit-paste {
|
|
48
|
-
mask-image: var(--icon-edit-paste);
|
|
49
|
-
-webkit-mask-image: var(--icon-edit-paste);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
49
|
.adw-icon--go-down {
|
|
53
50
|
mask-image: var(--icon-go-down);
|
|
54
51
|
-webkit-mask-image: var(--icon-go-down);
|
|
@@ -169,6 +166,11 @@ var e=Object.defineProperty,__name=(t,n)=>e(t,`name`,{value:n,configurable:!0});
|
|
|
169
166
|
-webkit-mask-image: var(--icon-mail-reply-sender);
|
|
170
167
|
}
|
|
171
168
|
|
|
169
|
+
.adw-icon--folder-documents {
|
|
170
|
+
mask-image: var(--icon-folder-documents);
|
|
171
|
+
-webkit-mask-image: var(--icon-folder-documents);
|
|
172
|
+
}
|
|
173
|
+
|
|
172
174
|
.adw-icon--folder-download {
|
|
173
175
|
mask-image: var(--icon-folder-download);
|
|
174
176
|
-webkit-mask-image: var(--icon-folder-download);
|
|
@@ -184,6 +186,16 @@ var e=Object.defineProperty,__name=(t,n)=>e(t,`name`,{value:n,configurable:!0});
|
|
|
184
186
|
-webkit-mask-image: var(--icon-view-list);
|
|
185
187
|
}
|
|
186
188
|
|
|
189
|
+
.adw-icon--view-more {
|
|
190
|
+
mask-image: var(--icon-view-more);
|
|
191
|
+
-webkit-mask-image: var(--icon-view-more);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.adw-icon--view-paged {
|
|
195
|
+
mask-image: var(--icon-view-paged);
|
|
196
|
+
-webkit-mask-image: var(--icon-view-paged);
|
|
197
|
+
}
|
|
198
|
+
|
|
187
199
|
.adw-icon--view-columns {
|
|
188
200
|
mask-image: var(--icon-view-columns);
|
|
189
201
|
-webkit-mask-image: var(--icon-view-columns);
|
|
@@ -921,6 +933,15 @@ adw-wrap-box *::after {
|
|
|
921
933
|
display: none;
|
|
922
934
|
}
|
|
923
935
|
|
|
936
|
+
:where(.adw-icon) {
|
|
937
|
+
mask-image: var(--icon-image-missing);
|
|
938
|
+
-webkit-mask-image: var(--icon-image-missing);
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
.adw-icon:not([class*=adw-icon--]) {
|
|
942
|
+
background-color: transparent;
|
|
943
|
+
}
|
|
944
|
+
|
|
924
945
|
.dimmed, .adw-data-grid .adw-data-grid-row.header .adw-data-grid-cell, adw-progress-bar .adw-progress-bar-text {
|
|
925
946
|
opacity: var(--dim-opacity);
|
|
926
947
|
}
|
|
@@ -3178,7 +3199,9 @@ adw-toast-overlay .adw-toast-overlay-toasts {
|
|
|
3178
3199
|
.adw-toast .adw-toast-close-button {
|
|
3179
3200
|
box-sizing: border-box;
|
|
3180
3201
|
flex-shrink: 0;
|
|
3181
|
-
|
|
3202
|
+
display: flex;
|
|
3203
|
+
align-items: center;
|
|
3204
|
+
justify-content: center;
|
|
3182
3205
|
width: 24px;
|
|
3183
3206
|
height: 24px;
|
|
3184
3207
|
margin: 0;
|
|
@@ -3199,22 +3222,6 @@ adw-toast-overlay .adw-toast-overlay-toasts {
|
|
|
3199
3222
|
outline: 2px solid var(--accent-color);
|
|
3200
3223
|
outline-offset: 1px;
|
|
3201
3224
|
}
|
|
3202
|
-
.adw-toast .adw-toast-close-button::before, .adw-toast .adw-toast-close-button::after {
|
|
3203
|
-
content: "";
|
|
3204
|
-
position: absolute;
|
|
3205
|
-
top: 50%;
|
|
3206
|
-
left: 50%;
|
|
3207
|
-
width: 11px;
|
|
3208
|
-
height: 1.5px;
|
|
3209
|
-
background-color: currentColor;
|
|
3210
|
-
border-radius: 1px;
|
|
3211
|
-
}
|
|
3212
|
-
.adw-toast .adw-toast-close-button::before {
|
|
3213
|
-
transform: translate(-50%, -50%) rotate(45deg);
|
|
3214
|
-
}
|
|
3215
|
-
.adw-toast .adw-toast-close-button::after {
|
|
3216
|
-
transform: translate(-50%, -50%) rotate(-45deg);
|
|
3217
|
-
}
|
|
3218
3225
|
|
|
3219
3226
|
adw-toolbar-view {
|
|
3220
3227
|
display: flex;
|
|
@@ -5099,7 +5106,7 @@ adw-dialog[data-presentation=bottom-sheet] .adw-dialog-box {
|
|
|
5099
5106
|
}
|
|
5100
5107
|
[hidden] {
|
|
5101
5108
|
display: none !important;
|
|
5102
|
-
}`,document.head.appendChild(e)}const
|
|
5109
|
+
}`,document.head.appendChild(e)}const Ye={system:`Follow system`,light:`Light`,dark:`Dark`},Xe={blue:`Blue`,teal:`Teal`,green:`Green`,yellow:`Yellow`,orange:`Orange`,red:`Red`,pink:`Pink`,purple:`Purple`,slate:`Slate`};var StorybookWebAppearance=class{settings;_root;constructor(e=document.documentElement){this._root=e;let t=globalThis.matchMedia?.(`(prefers-color-scheme: dark)`)??null;this.settings=new StorybookSettings(()=>t?.matches??!1),this.settings.subscribe(()=>this._apply()),t?.addEventListener(`change`,()=>this.settings.systemChanged()),this._apply()}_apply(){let e=this.settings.colorScheme;this._root.classList.toggle(`theme-dark`,e===`dark`),this._root.classList.toggle(`theme-light`,e===`light`);let t=this.settings.resolvedAccent;t?applyAdwaitaAccent(t,{target:this._root,dark:this.settings.resolvedDark}):clearAdwaitaAccent(this._root)}};function buildSwatch(e,t,n,r){let i=document.createElement(`input`);return i.type=`radio`,i.name=e,i.value=t,i.title=n,i.setAttribute(`aria-label`,n),i.classList.add(`sb-swatch`,...r),i}function buildAppearanceDialog(e){let t=e.settings,n=document.createElement(`adw-preferences-dialog`);n.setAttribute(`title`,`Appearance`);let i=document.createElement(`adw-preferences-page`),a=document.createElement(`adw-preferences-group`);a.setAttribute(`title`,`Style`);let o=document.createElement(`div`);o.className=`card sb-swatch-card`;let s=new Map;for(let e of r){let n=buildSwatch(`sb-scheme`,e,Ye[e],[`sb-swatch--scheme`,`sb-swatch--scheme-${e}`]);n.checked=t.colorScheme===e,n.addEventListener(`change`,()=>{n.checked&&(t.colorScheme=e)}),s.set(e,n),o.append(n)}a.append(o),i.append(a);let c=document.createElement(`adw-preferences-group`);c.setAttribute(`title`,`Accent colour`),c.classList.add(`sb-attached-group`);let l=document.createElement(`adw-switch-row`);l.setAttribute(`title`,`Use a custom accent colour`),l.setAttribute(`subtitle`,`Off follows the desktop, which owns the accent`),l.toggleAttribute(`active`,t.accentMode===`custom`),c.append(l);let u=document.createElement(`div`);u.className=`card sb-swatch-card sb-swatch-card--attached`;let f=new Map;for(let e of d){let n=buildSwatch(`sb-accent`,e,Xe[e],[]);n.style.backgroundColor=adwaitaAccentBgColor(e),n.checked=t.accent===e,n.addEventListener(`change`,()=>{n.checked&&(t.accent=e)}),f.set(e,n),u.append(n)}let syncAccentEnabled=e=>{u.classList.toggle(`sb-swatch-card--disabled`,!e);for(let t of f.values())t.disabled=!e};return syncAccentEnabled(t.accentMode===`custom`),l.addEventListener(`notify::active`,()=>{t.accentMode=l.hasAttribute(`active`)?`custom`:`system`}),c.append(u),i.append(c),n.append(i),t.subscribe(e=>{let t=s.get(e.colorScheme);t&&!t.checked&&(t.checked=!0);let n=f.get(e.accent);n&&!n.checked&&(n.checked=!0);let r=e.accentMode===`custom`;l.toggleAttribute(`active`,r),syncAccentEnabled(r)}),n}let X=!1;function injectStorybookStyles(){if(X||typeof document>`u`)return;if(document.getElementById(`adwaita-storybook-style`)){X=!0;return}let e=document.createElement(`style`);e.id=`adwaita-storybook-style`,e.textContent=`
|
|
5103
5110
|
/* Appearance dialog — round swatches with a selection ring. The web twin of the GTK
|
|
5104
5111
|
renderer's rules, themselves adapted from Learn6502.
|
|
5105
5112
|
|
|
@@ -5431,4 +5438,4 @@ adw-dialog[data-presentation=bottom-sheet] .adw-dialog-box {
|
|
|
5431
5438
|
background: none;
|
|
5432
5439
|
cursor: pointer;
|
|
5433
5440
|
}
|
|
5434
|
-
`,document.head.appendChild(e),X=!0}function h(e,t={},n=[]){let r=document.createElement(e);for(let[e,n]of Object.entries(t))r.setAttribute(e,n);for(let e of n)r.append(e);return r}var StorybookWebApp=class{_controller=new StorybookController(this,e=>this._buildControls(e));_options;_container;_appearance;_listEl;_previewEl;_previewTitle;_controlsGroup;_navSplit;_controlsSplit;_backBtn;_rowByTitle=new Map;constructor(e,t){this._container=e,this._options=t,this._appearance=new StorybookWebAppearance(e)}mount(){injectStorybookStyles(),this._buildUI(),this._observeBreakpoint(),this._exposeGlobal(),this._controller.mount(this._options.stories,this._options.openFirst!==!1)}_observeBreakpoint(){let apply=()=>this._applyBreakpoint();typeof ResizeObserver<`u`?new ResizeObserver(apply).observe(this._navSplit):globalThis.addEventListener?.(`resize`,apply),apply()}_applyBreakpoint(){let e=this._navSplit.clientWidth;if(e===0)return;let t=e<620,n=e<1e3,r=this._navSplit,i=this._controlsSplit;r.collapsed!==t&&(r.collapsed=t),i.collapsed!==n&&(i.collapsed=n),this._navSplit.removeAttribute(`show-content`),this._backBtn.hidden=!0,i.showSidebar=!n}get activeStory(){return this._controller.activeStory}listStories(){return this._controller.listStories()}openStoryByTitle(e){return this._controller.openStoryByTitle(e)}getCurrentStory(){return this._controller.getCurrentStory()}setActiveArg(e,t){return this._controller.setActiveArg(e,t)}renderSidebar(e,t){this._listEl.replaceChildren(),this._rowByTitle.clear();for(let{category:n,stories:r}of e){this._listEl.append(h(`div`,{class:`sb-category`},[n]));for(let{instance:e,name:n}of r){let r=h(`div`,{class:`sb-story-row`,role:`button`,tabindex:`0`},[n]);r.addEventListener(`click`,()=>t(e)),r.addEventListener(`keydown`,n=>{(n.key===`Enter`||n.key===` `)&&(n.preventDefault(),t(e))}),this._listEl.append(r),this._rowByTitle.set(e.meta.title,r)}}}markSelected(e){for(let[t,n]of this._rowByTitle)n.classList.toggle(`selected`,t===e)}setPreviewTitle(e){this._previewTitle.setAttribute(`title`,e)}showPreview(e){this._previewEl.replaceChildren(e.element),this._navSplit.collapsed&&this._navSplit.setAttribute(`show-content`,``)}renderControls(e){let t=this._controlsGroup.querySelector(`.adw-preferences-group-listbox`);if(t){t.replaceChildren();for(let n of e)t.append(n.view)}}_buildControls(e){let t=[],n=e.meta.controls;if(Array.isArray(n))for(let r of n){if(!r?.name||!r?.type){console.warn(`Invalid control configuration:`,r);continue}let n=createControlRow(e,r);n&&t.push(n)}return t}_buildUI(){this._listEl=h(`div`,{class:`sb-sidebar-list navigation-sidebar`});let e=h(`div`,{class:`sb-sidebar-scroll`},[this._listEl]),t=h(`div`,{slot:`sidebar`,class:`sb-sidebar-pane`},[h(`adw-toolbar-view`,{},[h(`adw-header-bar`,{slot:`top`},[h(`adw-window-title`,{slot:`center`,title:this._options.title??`Stories`})]),e])]);this._previewEl=h(`div`,{class:`sb-preview-scroll`}),this._controlsGroup=h(`adw-preferences-group`,{title:`Controls`});let n=h(`div`,{slot:`sidebar`,class:`sb-controls-scroll`},[h(`div`,{class:`sb-controls-page`},[this._controlsGroup])]),r=h(`adw-overlay-split-view`,{"sidebar-position":`end`,"show-sidebar":``,"min-sidebar-width":`280`,"max-sidebar-width":`360`},[h(`div`,{slot:`content`,class:`sb-preview-pane`},[this._previewEl]),n]);this._controlsSplit=r,this._backBtn=h(`button`,{class:`adw-header-btn sb-back-btn`,slot:`start`,title:`Back to stories`,"aria-label":`Back to stories`}),this._backBtn.append(h(`span`,{class:`adw-icon adw-icon--go-previous`})),this._backBtn.hidden=!0,this._backBtn.addEventListener(`click`,()=>this._navSplit.removeAttribute(`show-content`)),this._previewTitle=h(`adw-window-title`,{slot:`center`,title:`Preview`});let i=h(`button`,{class:`adw-header-btn sb-toggle-controls`,title:`Toggle Controls`,"aria-label":`Toggle Controls`});i.append(h(`span`,{class:`adw-icon adw-icon--sidebar-show`})),i.setAttribute(`slot`,`end`),i.addEventListener(`click`,()=>{r.showSidebar=!r.showSidebar});let a=h(`button`,{class:`adw-header-btn sb-appearance-btn`,slot:`end`,title:`Appearance`,"aria-label":`Appearance`});a.append(h(`span`,{class:`adw-icon adw-icon--preferences-system`}));let o=buildAppearanceDialog(this._appearance);a.addEventListener(`click`,()=>{o.isConnected||this._container.append(o),o.toggleAttribute(`open`,!0)});let s=h(`div`,{slot:`content`,class:`sb-content-pane`},[h(`adw-toolbar-view`,{},[h(`adw-header-bar`,{slot:`top`},[this._backBtn,this._previewTitle,a,i]),r])]);this._navSplit=h(`adw-navigation-split-view`,{"min-sidebar-width":`220`,"max-sidebar-width":`320`},[t,s]);let c=h(`adw-window`,{class:`sb-window`},[this._navSplit]);this._container.replaceChildren(c)}_exposeGlobal(){globalThis.__storybook={listStories:()=>this.listStories(),openStory:e=>this.openStoryByTitle(e),getCurrentStory:()=>this.getCurrentStory(),setArg:(e,t)=>this.setActiveArg(e,t),getArgs:()=>this.activeStory?.args??null}}};function mountStorybook(e,t){let n=new StorybookWebApp(e,t);return n.mount(),n}const Ye=[{title:`Sync`,kind:`switch`,active:!0},{title:`Export`,kind:`action`}],Xe=[`Blue`,`Teal`,`Green`,`Orange`],Z={appearance:`Appearance`,account:`Account`,shortcuts:`Shortcuts`,actions:`Actions`},Q={bannerTitle:`You have unsaved changes`,bannerButton:`Save`,darkMode:`Dark mode`,darkModeSubtitle:`Use the dark Adwaita palette`,notifications:`Notifications`,notificationsSubtitle:`Show toasts for events`,accentColor:`Accent color`,name:`Name`,nameValue:`Ada Lovelace`,email:`Email`,emailValue:`ada@example.com`,devices:`Devices`,advanced:`Advanced`,advancedSubtitle:`More options`,save:`Save changes`,delete:`Delete account`},$={value:3,lower:1,upper:10,step:1},Ze=[{title:`Copy`,accelerator:`<Control>C`},{title:`Select all`,accelerator:`<Shift><Control>a`},{title:`Switch tab`,accelerator:`<Alt>1...9`}],Qe={title:`Overview/Widgets`,description:`Many widgets at once, the way an app composes them: a banner, preference groups of rows, an expander, buttons and shortcut labels. Use it to judge spacing, alignment and the theme as a whole rather than one widget in isolation.`,controls:[{name:`revealed`,label:`Show banner`,type:t.BOOLEAN,description:`Adw.Banner:revealed — animates in and out`,defaultValue:!0}]};function el(e,t={}){let n=document.createElement(e);for(let[e,r]of Object.entries(t))n.setAttribute(e,r);return n}const $e={stories:[class OverviewWidgetsWebStory extends StoryElement{_banner=null;constructor(){super(OverviewWidgetsWebStory.getMetadata(),`Default`)}static getMetadata(){return Qe}initialize(){let e=document.createElement(`div`);e.style.display=`flex`,e.style.flexDirection=`column`,e.style.width=`100%`,this._banner=el(`adw-banner`,{title:Q.bannerTitle,"button-label":Q.bannerButton}),this._syncBanner(),e.append(this._banner);let t=el(`adw-preferences-page`),n=el(`adw-preferences-group`,{title:Z.appearance});n.append(el(`adw-switch-row`,{title:Q.darkMode,subtitle:Q.darkModeSubtitle}),el(`adw-switch-row`,{title:Q.notifications,subtitle:Q.notificationsSubtitle,active:``}),el(`adw-combo-row`,{title:Q.accentColor,items:JSON.stringify([...Xe]),selected:`0`})),t.append(n);let r=el(`adw-preferences-group`,{title:Z.account});r.append(el(`adw-entry-row`,{title:Q.name,text:Q.nameValue}),el(`adw-entry-row`,{title:Q.email,text:Q.emailValue}),el(`adw-spin-row`,{title:Q.devices,min:String($.lower),max:String($.upper),step:String($.step),value:String($.value)}));let i=el(`adw-expander-row`,{title:Q.advanced,subtitle:Q.advancedSubtitle});i.toggleAttribute(`expanded`,!0);for(let e of Ye)i.append(e.kind===`switch`?el(`adw-switch-row`,e.active?{title:e.title,active:``}:{title:e.title}):el(`adw-action-row`,{title:e.title}));r.append(i),t.append(r);let a=el(`adw-preferences-group`,{title:Z.shortcuts});for(let e of Ze){let t=el(`adw-action-row`,{title:e.title}),n=el(`adw-shortcut-label`,{accelerator:e.accelerator,slot:`suffix`});t.append(n),a.append(t)}t.append(a);let o=el(`adw-preferences-group`,{title:Z.actions}),s=document.createElement(`div`);s.style.display=`flex`,s.style.gap=`12px`,s.style.margin=`6px 0`;let c=document.createElement(`button`);c.className=`adw-button suggested-action`,c.textContent=Q.save;let l=document.createElement(`button`);l.className=`adw-button destructive-action`,l.textContent=Q.delete,s.append(c,l),o.append(s),t.append(o),e.append(t),this.addContent(e)}updateArgs(e){this._syncBanner()}_syncBanner(){this._banner?.toggleAttribute(`revealed`,this.args.revealed)}}]},et={title:`Presentation/Avatar`,description:`A circular avatar that derives initials (and a colour) from a name, or shows a symbolic icon.`,controls:[{name:`text`,label:`Name`,type:t.TEXT,defaultValue:`Ada Lovelace`},{name:`size`,label:`Size`,type:t.RANGE,min:24,max:160,step:8,defaultValue:96},{name:`showInitials`,label:`Show initials`,type:t.BOOLEAN,defaultValue:!0},{name:`iconName`,label:`Fallback icon`,type:t.SELECT,options:[{label:`Person`,value:`avatar-default-symbolic`},{label:`Contact`,value:`contact-new-symbolic`},{label:`Camera`,value:`camera-photo-symbolic`}],defaultValue:`avatar-default-symbolic`}]},tt={stories:[class AvatarWebStory extends StoryElement{_avatar=null;constructor(){super(AvatarWebStory.getMetadata(),`Default`)}static getMetadata(){return et}initialize(){this._avatar=document.createElement(`adw-avatar`),this._sync(),this.addContent(this._avatar)}updateArgs(e){this._sync()}_sync(){this._avatar&&(this._avatar.setAttribute(`text`,this.args.text),this._avatar.setAttribute(`size`,String(this.args.size)),this._avatar.toggleAttribute(`show-initials`,this.args.showInitials),this._avatar.setAttribute(`icon`,this.args.iconName.replace(/-symbolic$/,``)))}}]},nt={title:`Presentation/Banner`,description:`Adw.Banner — a full-width strip carrying a status message and an optional action button.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Metered connection — updates paused`},{name:`buttonLabel`,label:`Button label`,type:t.TEXT,defaultValue:`Resume`},{name:`revealed`,label:`Revealed`,type:t.BOOLEAN,defaultValue:!0},{name:`useMarkup`,label:`Use markup`,type:t.BOOLEAN,defaultValue:!1}]},rt={stories:[class BannerWebStory extends StoryElement{_banner=null;constructor(){super(BannerWebStory.getMetadata(),`Default`)}static getMetadata(){return nt}initialize(){this._banner=document.createElement(`adw-banner`),this._sync();let e=document.createElement(`div`);e.style.cssText=`width:460px;max-width:100%;`,e.append(this._banner),this.addContent(e)}updateArgs(e){this._sync()}_sync(){this._banner&&(this._banner.setAttribute(`title`,this.args.title),this._banner.setAttribute(`button-label`,this.args.buttonLabel),this._banner.toggleAttribute(`revealed`,this.args.revealed),this._banner.toggleAttribute(`use-markup`,this.args.useMarkup))}}]},it=[{label:`Single`,accelerator:`<Control>C`},{label:`Modifier order`,accelerator:`<Shift><Control>a`},{label:`Alternatives`,accelerator:`<Shift>A Home`},{label:`Range`,accelerator:`<Alt>1...9`},{label:`In sequence`,accelerator:`<Control>C+<Control>X`},{label:`Together`,accelerator:`Control_L&Control_R`},{label:`Nested`,accelerator:`<Alt>1...9 <Alt>0`},{label:`Unset`,accelerator:``}],at={title:`Presentation/Shortcut Label`,description:`Adw.ShortcutLabel — an accelerator drawn as keycaps. The four grammar levels: alternatives (space), a range (...), pressed in sequence (+), and pressed together (&).`,controls:[{name:`accelerator`,label:`Accelerator`,type:t.SELECT,options:[{label:`Ctrl+C`,value:`<Control>C`},{label:`Modifier order (Shift+Ctrl+A)`,value:`<Shift><Control>a`},{label:`Alternatives (Shift+A / Home)`,value:`<Shift>A Home`},{label:`Range (Alt+1…9)`,value:`<Alt>1...9`},{label:`In sequence (Ctrl+C → Ctrl+X)`,value:`<Control>C+<Control>X`},{label:`Together (Ctrl L + Ctrl R)`,value:`Control_L&Control_R`},{label:`Nested (Alt+1…9 / Alt+0)`,value:`<Alt>1...9 <Alt>0`},{label:`Glyph key (Ctrl+Space)`,value:`<Control>space`},{label:`Arrow key (Left)`,value:`Left`},{label:`Unset — shows the placeholder`,value:``}],defaultValue:`<Control>C`},{name:`disabledText`,label:`Placeholder`,type:t.TEXT,defaultValue:`Disabled`}]},ot={title:`Presentation/Shortcut Label (All Levels)`,description:`Every Adw.ShortcutLabel grammar level at once: alternatives (space), a range (...), pressed in sequence (+), pressed together (&) — plus GTK's fixed keycap order and the disabled placeholder.`,controls:[{name:`disabledText`,label:`Placeholder`,type:t.TEXT,defaultValue:`Disabled`}]},st={stories:[class ShortcutLabelWebStory extends StoryElement{_widget=null;constructor(){super(ShortcutLabelWebStory.getMetadata(),`Default`)}static getMetadata(){return at}initialize(){this._widget=document.createElement(`adw-shortcut-label`),this._sync(),this.addContent(this._widget)}updateArgs(e){this._sync()}_sync(){this._widget&&(this._widget.setAttribute(`disabled-text`,this.args.disabledText),this._widget.setAttribute(`accelerator`,this.args.accelerator))}},class ShortcutLabelLevelsWebStory extends StoryElement{_widgets=[];constructor(){super(ShortcutLabelLevelsWebStory.getMetadata(),`Default`)}static getMetadata(){return ot}initialize(){let e=document.createElement(`div`);e.style.display=`grid`,e.style.gridTemplateColumns=`auto auto`,e.style.rowGap=`12px`,e.style.columnGap=`24px`,e.style.alignItems=`center`;for(let t of it){let n=document.createElement(`span`);n.className=`dimmed`,n.textContent=t.label,e.append(n);let r=document.createElement(`adw-shortcut-label`);r.style.justifySelf=`end`,r.setAttribute(`disabled-text`,this.args.disabledText),r.setAttribute(`accelerator`,t.accelerator),e.append(r),this._widgets.push(r)}this.addContent(e)}updateArgs(e){for(let e of this._widgets)e.setAttribute(`disabled-text`,this.args.disabledText)}}]},ct={title:`Presentation/Spinner`,description:`Adw.Spinner — a lightweight loading indicator that spins continuously while visible.`,controls:[{name:`size`,label:`Size`,type:t.RANGE,min:16,max:64,step:4,defaultValue:48}]},lt={stories:[class SpinnerWebStory extends StoryElement{_spinner=null;constructor(){super(SpinnerWebStory.getMetadata(),`Default`)}static getMetadata(){return ct}initialize(){this._spinner=document.createElement(`adw-spinner`),this._spinner.setAttribute(`size`,String(this.args.size)),this.addContent(this._spinner)}updateArgs(e){this._spinner&&this._spinner.setAttribute(`size`,String(this.args.size))}}]},ut={title:`Presentation/Status Page`,description:`Adw.StatusPage — a full-page empty state with an icon, title, description and optional action.`,controls:[{name:`iconName`,label:`Icon`,type:t.SELECT,options:[{label:`Folder`,value:`folder-symbolic`},{label:`Mail`,value:`mail-unread-symbolic`},{label:`Search`,value:`system-search-symbolic`},{label:`Star`,value:`starred-symbolic`}],defaultValue:`folder-symbolic`},{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`No Documents`},{name:`description`,label:`Description`,type:t.TEXT,defaultValue:`Documents you create or open will appear here.`}]},dt={stories:[class StatusPageWebStory extends StoryElement{_page=null;constructor(){super(StatusPageWebStory.getMetadata(),`Default`)}static getMetadata(){return ut}initialize(){this._page=document.createElement(`adw-status-page`);let e=document.createElement(`adw-button`);e.setAttribute(`label`,`New Document`),e.setAttribute(`pill`,``),e.setAttribute(`suggested`,``),this._page.appendChild(e),this._sync(),this.addContent(this._page)}updateArgs(e){this._sync()}_sync(){this._page&&(this._page.setAttribute(`icon`,this.args.iconName.replace(/-symbolic$/,``)),this._page.setAttribute(`title`,this.args.title),this._page.setAttribute(`description`,this.args.description))}}]},ft={title:`Presentation/Window Title`,description:`Adw.WindowTitle — a compact title/subtitle widget intended for a window or header bar.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Inbox`},{name:`subtitle`,label:`Subtitle`,type:t.TEXT,defaultValue:`3 unread messages`}]},pt={stories:[class WindowTitleWebStory extends StoryElement{_windowTitle=null;constructor(){super(WindowTitleWebStory.getMetadata(),`Default`)}static getMetadata(){return ft}initialize(){this._windowTitle=document.createElement(`adw-window-title`),this._sync(),this.addContent(this._windowTitle)}updateArgs(e){this._sync()}_sync(){this._windowTitle&&(this._windowTitle.setAttribute(`title`,this.args.title),this._windowTitle.setAttribute(`subtitle`,this.args.subtitle))}}]},mt={title:`Boxed Lists/Action Row`,description:`Adw.ActionRow — a preferences row with a title/subtitle, a prefix icon and a suffix button, shown inside a boxed list.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Wi-Fi`},{name:`subtitle`,label:`Subtitle`,type:t.TEXT,defaultValue:`Connected to Highgarden 5GHz`},{name:`iconName`,label:`Prefix icon`,type:t.SELECT,options:[{label:`Network`,value:`network-wireless-symbolic`},{label:`Folder`,value:`folder-symbolic`},{label:`Starred`,value:`starred-symbolic`}],defaultValue:`network-wireless-symbolic`},{name:`activatable`,label:`Activatable`,type:t.BOOLEAN,defaultValue:!0}]};function iconClass$2(e){return`adw-icon adw-icon--${e.replace(/-symbolic$/,``)}`}__name(iconClass$2,`iconClass`);const ht={stories:[class ActionRowWebStory extends StoryElement{_row=null;_icon=null;constructor(){super(ActionRowWebStory.getMetadata(),`Default`)}static getMetadata(){return mt}initialize(){this._row=document.createElement(`adw-action-row`),this._icon=document.createElement(`span`),this._icon.setAttribute(`slot`,`prefix`),this._icon.className=iconClass$2(this.args.iconName);let e=document.createElement(`adw-button`);e.setAttribute(`slot`,`suffix`),e.setAttribute(`icon`,`go-next`),e.setAttribute(`flat`,``),this._row.append(this._icon,e),this._syncRow();let t=document.createElement(`adw-preferences-group`);t.append(this._row);let n=document.createElement(`adw-clamp`);n.setAttribute(`maximum-size`,`400`),n.append(t),this.addContent(n)}updateArgs(e){this._syncRow(),this._icon&&(this._icon.className=iconClass$2(this.args.iconName))}_syncRow(){this._row&&(this._row.setAttribute(`title`,this.args.title),this._row.setAttribute(`subtitle`,this.args.subtitle),this._row.toggleAttribute(`activatable`,this.args.activatable))}}]},gt={title:`Boxed Lists/Button Row`,description:`Adw.ButtonRow — a full-width row that acts as a button, with an optional icon and style class.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Add account`},{name:`startIconName`,label:`Start icon`,type:t.SELECT,options:[{label:`Add`,value:`list-add-symbolic`},{label:`Trash`,value:`user-trash-symbolic`},{label:`None`,value:``}],defaultValue:`list-add-symbolic`},{name:`style`,label:`Style`,type:t.SELECT,options:[{label:`None`,value:`none`},{label:`Suggested`,value:`suggested-action`},{label:`Destructive`,value:`destructive-action`}],defaultValue:`suggested-action`}]},_t=[`suggested-action`,`destructive-action`];function iconName$1(e){return e.replace(/-symbolic$/,``)}__name(iconName$1,`iconName`);const vt={stories:[class ButtonRowWebStory extends StoryElement{_row=null;constructor(){super(ButtonRowWebStory.getMetadata(),`Default`)}static getMetadata(){return gt}initialize(){this._row=document.createElement(`adw-button-row`),this._syncRow();let e=document.createElement(`adw-preferences-group`);e.append(this._row);let t=document.createElement(`adw-clamp`);t.setAttribute(`maximum-size`,`400`),t.append(e),this.addContent(t)}updateArgs(e){this._syncRow()}_syncRow(){if(!this._row)return;this._row.setAttribute(`title`,this.args.title);let e=iconName$1(this.args.startIconName);e?this._row.setAttribute(`start-icon-name`,e):this._row.removeAttribute(`start-icon-name`),this._applyStyle(this.args.style)}_applyStyle(e){if(this._row){for(let e of _t)this._row.classList.remove(e);e!==`none`&&this._row.classList.add(e)}}}]},yt=[`Blue`,`Teal`,`Green`,`Orange`,`Purple`],bt={title:`Boxed Lists/Combo Row`,description:`Adw.ComboRow — a preferences row with an inline drop-down backed by a Gtk.StringList.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Accent colour`},{name:`subtitle`,label:`Subtitle`,type:t.TEXT,defaultValue:`Used to highlight selected items`},{name:`selected`,label:`Selected`,type:t.NUMBER,min:0,max:4,step:1,defaultValue:1}]},xt={stories:[class ComboRowWebStory extends StoryElement{_row=null;constructor(){super(ComboRowWebStory.getMetadata(),`Default`)}static getMetadata(){return bt}initialize(){this._row=document.createElement(`adw-combo-row`),this._row.setAttribute(`items`,JSON.stringify([...yt])),this._syncRow();let e=document.createElement(`adw-preferences-group`);e.append(this._row);let t=document.createElement(`adw-clamp`);t.setAttribute(`maximum-size`,`400`),t.append(e),this.addContent(t)}updateArgs(e){this._syncRow()}_syncRow(){this._row&&(this._row.setAttribute(`title`,this.args.title),this._row.setAttribute(`subtitle`,this.args.subtitle),this._row.setAttribute(`selected`,String(this.args.selected)))}}]},St={title:`Boxed Lists/Entry Row`,description:`Adw.EntryRow — a preferences row whose title doubles as placeholder text for an inline entry.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Display name`},{name:`text`,label:`Text`,type:t.TEXT,defaultValue:`Ada Lovelace`},{name:`showApplyButton`,label:`Show apply button`,type:t.BOOLEAN,defaultValue:!0}]},Ct={stories:[class EntryRowWebStory extends StoryElement{_row=null;constructor(){super(EntryRowWebStory.getMetadata(),`Default`)}static getMetadata(){return St}initialize(){this._row=document.createElement(`adw-entry-row`),this._syncRow();let e=document.createElement(`adw-preferences-group`);e.append(this._row);let t=document.createElement(`adw-clamp`);t.setAttribute(`maximum-size`,`400`),t.append(e),this.addContent(t)}updateArgs(e){this._syncRow()}_syncRow(){this._row&&(this._row.setAttribute(`title`,this.args.title),this._row.setAttribute(`text`,this.args.text))}}]},wt={title:`Boxed Lists/Expander Row`,description:`Adw.ExpanderRow — a preferences row that discloses nested rows and can carry an enable switch.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Proxy settings`},{name:`subtitle`,label:`Subtitle`,type:t.TEXT,defaultValue:`Route traffic through a custom proxy`},{name:`expanded`,label:`Expanded`,type:t.BOOLEAN,defaultValue:!0},{name:`showEnableSwitch`,label:`Show enable switch`,type:t.BOOLEAN,defaultValue:!1}]},Tt={stories:[class ExpanderRowWebStory extends StoryElement{_row=null;constructor(){super(ExpanderRowWebStory.getMetadata(),`Default`)}static getMetadata(){return wt}initialize(){this._row=document.createElement(`adw-expander-row`);let e=document.createElement(`adw-entry-row`);e.setAttribute(`title`,`Host`),e.setAttribute(`text`,`proxy.example.com`);let t=document.createElement(`adw-switch-row`);t.setAttribute(`title`,`Use authentication`),this._row.append(e,t),this._syncRow();let n=document.createElement(`adw-preferences-group`);n.append(this._row);let r=document.createElement(`adw-clamp`);r.setAttribute(`maximum-size`,`400`),r.append(n),this.addContent(r)}updateArgs(e){this._syncRow()}_syncRow(){this._row&&(this._row.setAttribute(`title`,this.args.title),this._row.setAttribute(`subtitle`,this.args.subtitle),this._row.toggleAttribute(`expanded`,this.args.expanded),this._row.toggleAttribute(`show-enable-switch`,this.args.showEnableSwitch))}}]},Et={title:`Boxed Lists/Password Entry Row`,description:`Adw.PasswordEntryRow — an entry row that masks its contents and shows a peek toggle.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Password`},{name:`text`,label:`Text`,type:t.TEXT,defaultValue:`correct-horse-battery`}]},Dt={stories:[class PasswordEntryRowWebStory extends StoryElement{_row=null;constructor(){super(PasswordEntryRowWebStory.getMetadata(),`Default`)}static getMetadata(){return Et}initialize(){this._row=document.createElement(`adw-password-entry-row`),this._syncRow();let e=document.createElement(`adw-preferences-group`);e.append(this._row);let t=document.createElement(`adw-clamp`);t.setAttribute(`maximum-size`,`400`),t.append(e),this.addContent(t)}updateArgs(e){this._syncRow()}_syncRow(){this._row&&(this._row.setAttribute(`title`,this.args.title),this._row.setAttribute(`text`,this.args.text))}}]},Ot={title:`Boxed Lists/Preferences Group`,description:`Adw.PreferencesGroup — the boxed-list container that gathers a title, description, header-suffix widget and rows.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Account`},{name:`description`,label:`Description`,type:t.TEXT,defaultValue:`Manage how this device signs in and syncs.`}]},kt=[`Europe`,`Americas`,`Asia`,`Oceania`],At={stories:[class PreferencesGroupWebStory extends StoryElement{_group=null;constructor(){super(PreferencesGroupWebStory.getMetadata(),`Default`)}static getMetadata(){return Ot}initialize(){this._group=document.createElement(`adw-preferences-group`);let e=document.createElement(`button`);e.className=`adw-button flat`,e.textContent=`Sign out`,e.setAttribute(`slot`,`header-suffix`),this._group.append(e);let t=document.createElement(`adw-entry-row`);t.setAttribute(`title`,`Display name`),t.setAttribute(`text`,`Grace Hopper`),this._group.append(t);let n=document.createElement(`adw-switch-row`);n.setAttribute(`title`,`Sync over Wi-Fi only`),n.setAttribute(`subtitle`,`Avoid using mobile data for backups`),n.setAttribute(`active`,``),this._group.append(n);let r=document.createElement(`adw-combo-row`);r.setAttribute(`title`,`Region`),r.setAttribute(`items`,JSON.stringify(kt)),r.setAttribute(`selected`,`0`),this._group.append(r),this._syncGroup();let i=document.createElement(`adw-clamp`);i.setAttribute(`maximum-size`,`400`),i.append(this._group),this.addContent(i)}updateArgs(e){this._syncGroup()}_syncGroup(){this._group&&(this._group.setAttribute(`title`,this.args.title),this._group.setAttribute(`description`,this.args.description))}}]},jt={title:`Boxed Lists/Spin Row`,description:`Adw.SpinRow — a preferences row with an inline spin button over a numeric adjustment.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Font size`},{name:`value`,label:`Value`,type:t.NUMBER,min:0,max:100,step:1,defaultValue:16},{name:`digits`,label:`Digits`,type:t.NUMBER,min:0,max:4,step:1,defaultValue:0}]},Mt={stories:[class SpinRowWebStory extends StoryElement{_row=null;constructor(){super(SpinRowWebStory.getMetadata(),`Default`)}static getMetadata(){return jt}initialize(){this._row=document.createElement(`adw-spin-row`),this._row.setAttribute(`min`,`0`),this._row.setAttribute(`max`,`100`),this._syncRow();let e=document.createElement(`adw-preferences-group`);e.append(this._row);let t=document.createElement(`adw-clamp`);t.setAttribute(`maximum-size`,`400`),t.append(e),this.addContent(t)}updateArgs(e){this._syncRow()}_syncRow(){if(!this._row)return;this._row.setAttribute(`title`,this.args.title);let e=this.args.digits;this._row.setAttribute(`step`,String(10**-e)),this._row.setAttribute(`value`,String(this.args.value))}}]},Nt={title:`Boxed Lists/Switch Row`,description:`Adw.SwitchRow — a preferences row with a trailing switch, shown inside a boxed list.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Automatic updates`},{name:`subtitle`,label:`Subtitle`,type:t.TEXT,defaultValue:`Download and install updates without asking`},{name:`active`,label:`Active`,type:t.BOOLEAN,defaultValue:!0}]},Pt={stories:[class SwitchRowWebStory extends StoryElement{_row=null;constructor(){super(SwitchRowWebStory.getMetadata(),`Default`)}static getMetadata(){return Nt}initialize(){this._row=document.createElement(`adw-switch-row`),this._syncRow();let e=document.createElement(`adw-preferences-group`);e.append(this._row);let t=document.createElement(`adw-clamp`);t.setAttribute(`maximum-size`,`400`),t.append(e),this.addContent(t)}updateArgs(e){this._syncRow()}_syncRow(){this._row&&(this._row.setAttribute(`title`,this.args.title),this._row.setAttribute(`subtitle`,this.args.subtitle),this._row.toggleAttribute(`active`,this.args.active))}}]},Ft=[`Automatic`,`Always`,`Never`,`When busy`],It={title:`Controls/Drop Down`,description:`Gtk.DropDown — pick one value from a list. The button shows the selection; the list opens in a popover. Adw.ComboRow is the same choice presented as a boxed-list row.`,controls:[{name:`selected`,label:`Selected`,type:t.SELECT,options:Ft.map((e,t)=>({label:e,value:t})),defaultValue:0},{name:`enableSearch`,label:`Search field`,type:t.BOOLEAN,defaultValue:!1}]},Lt={stories:[class DropDownWebStory extends StoryElement{_dropDown=null;constructor(){super(DropDownWebStory.getMetadata(),`Default`)}static getMetadata(){return It}initialize(){this._dropDown=document.createElement(`adw-drop-down`),this._dropDown.setAttribute(`options`,JSON.stringify(Ft)),this._apply(),this.addContent(this._dropDown)}updateArgs(e){this._apply()}_apply(){this._dropDown&&(this._dropDown.setAttribute(`selected`,String(this.args.selected)),this.args.enableSearch?this._dropDown.setAttribute(`enable-search`,``):this._dropDown.removeAttribute(`enable-search`))}}]},Rt={title:`Controls/Entry`,description:`Gtk.Entry — a single-line text field. Libadwaita ships no AdwEntry; the Adwaita look is the GTK entry styled by the stylesheet, which is why the row variants (Entry Row, Password Entry Row) are the widgets with an Adw prefix.`,controls:[{name:`text`,label:`Text`,type:t.TEXT,defaultValue:``},{name:`placeholder`,label:`Placeholder`,type:t.TEXT,defaultValue:`Search files…`},{name:`editable`,label:`Editable`,type:t.BOOLEAN,defaultValue:!0}]},zt={stories:[class EntryWebStory extends StoryElement{_entry=null;constructor(){super(EntryWebStory.getMetadata(),`Default`)}static getMetadata(){return Rt}initialize(){this._entry=document.createElement(`adw-entry`),this._entry.style.minWidth=`280px`,this._apply(),this.addContent(this._entry)}updateArgs(e){this._apply()}_apply(){this._entry&&(this._entry.setAttribute(`value`,this.args.text),this._entry.setAttribute(`placeholder`,this.args.placeholder),this.args.editable?this._entry.removeAttribute(`disabled`):this._entry.setAttribute(`disabled`,``))}}]},Bt={title:`Buttons/Button Content`,description:`Adw.ButtonContent — pairs a symbolic icon with a label inside a Gtk.Button.`,controls:[{name:`label`,label:`Label`,type:t.TEXT,defaultValue:`Download`},{name:`iconName`,label:`Icon`,type:t.SELECT,options:[{label:`Download`,value:`folder-download-symbolic`},{label:`Add`,value:`list-add-symbolic`},{label:`Send`,value:`mail-send-symbolic`},{label:`Star`,value:`starred-symbolic`}],defaultValue:`folder-download-symbolic`},{name:`canShrink`,label:`Can shrink`,type:t.BOOLEAN,defaultValue:!1}]};function iconName(e){return e.replace(/-symbolic$/,``)}const Vt={stories:[class ButtonContentWebStory extends StoryElement{_content=null;constructor(){super(ButtonContentWebStory.getMetadata(),`Default`)}static getMetadata(){return Bt}initialize(){this._content=document.createElement(`adw-button-content`),this._syncContent();let e=document.createElement(`button`);e.className=`adw-button suggested-action pill`,e.append(this._content),this.addContent(e)}updateArgs(e){this._syncContent()}_syncContent(){this._content&&(this._content.setAttribute(`label`,this.args.label),this._content.setAttribute(`icon-name`,iconName(this.args.iconName)),this.args.canShrink?this._content.setAttribute(`can-shrink`,``):this._content.removeAttribute(`can-shrink`))}}]},Ht={title:`Buttons/Button Styles`,description:`Buttons with Adwaita style classes: .pill, .circular, .suggested-action, .destructive-action, .flat.`,controls:[{name:`label`,label:`Demo label`,type:t.TEXT,defaultValue:`Click me`},{name:`style`,label:`Demo style`,type:t.SELECT,options:[{label:`Pill`,value:`pill`},{label:`Circular (icon)`,value:`circular`},{label:`Suggested`,value:`suggested-action`},{label:`Destructive`,value:`destructive-action`},{label:`Flat`,value:`flat`}],defaultValue:`suggested-action`}]},Ut=[`pill`,`circular`,`suggested`,`destructive`,`flat`],Wt={pill:`pill`,circular:`circular`,"suggested-action":`suggested`,"destructive-action":`destructive`,flat:`flat`};function button(e){let t=document.createElement(`adw-button`);return e.label&&t.setAttribute(`label`,e.label),e.icon&&t.setAttribute(`icon`,e.icon),e.variant&&t.setAttribute(e.variant,``),t}const Gt={stories:[class ButtonStylesWebStory extends StoryElement{_demo=null;constructor(){super(ButtonStylesWebStory.getMetadata(),`Default`)}static getMetadata(){return Ht}initialize(){let e=document.createElement(`div`);e.style.cssText=`display:flex;flex-wrap:wrap;gap:12px;justify-content:center;align-items:center;`,e.append(button({label:`Pill`,variant:`pill`}),button({icon:`list-add`,variant:`circular`}),button({label:`Suggested`,variant:`suggested`}),button({label:`Delete`,variant:`destructive`}),button({label:`Flat`,variant:`flat`})),this._demo=button({label:this.args.label}),this._applyStyle(this.args.style),e.append(this._demo),this.addContent(e)}updateArgs(e){this._demo&&this._applyStyle(this.args.style)}_applyStyle(e){if(!this._demo)return;for(let e of Ut)this._demo.removeAttribute(e);let t=Wt[e];t&&this._demo.setAttribute(t,``),t===`circular`?(this._demo.setAttribute(`icon`,`list-add`),this._demo.removeAttribute(`label`)):(this._demo.removeAttribute(`icon`),this._demo.setAttribute(`label`,this.args.label))}}]},Kt=[`Save as…`,`Export`,`Print`],qt={title:`Buttons/Menu Button`,description:`Gtk.MenuButton — a button whose only action is to open a menu. Where a Split Button has a primary action beside its arrow, this one has none: every choice lives in the popover.`,controls:[{name:`iconName`,label:`Icon`,type:t.SELECT,options:[{label:`Hamburger`,value:`open-menu-symbolic`},{label:`More`,value:`view-more-symbolic`},{label:`Open`,value:`document-open-symbolic`}],defaultValue:`open-menu-symbolic`},{name:`menuTitle`,label:`Menu title`,type:t.TEXT,defaultValue:`Document`}]},Jt={stories:[class MenuButtonWebStory extends StoryElement{_widget=null;constructor(){super(MenuButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return qt}initialize(){this._widget=document.createElement(`adw-menu-button`),this._widget.setAttribute(`menu`,JSON.stringify(Kt.map(e=>({label:e})))),this._apply(),this.addContent(this._widget)}updateArgs(e){this._apply()}_apply(){this._widget&&(this._widget.setAttribute(`icon-name`,this.args.iconName.replace(/-symbolic$/,``)),this._widget.setAttribute(`menu-title`,this.args.menuTitle))}}]},Yt={title:`Buttons/Split Button`,description:`Adw.SplitButton — a primary action button paired with a dropdown menu of related actions.`,controls:[{name:`label`,label:`Label`,type:t.TEXT,defaultValue:`Save`},{name:`iconName`,label:`Icon`,type:t.SELECT,options:[{label:`None`,value:``},{label:`Save`,value:`document-save-symbolic`},{label:`Send`,value:`mail-send-symbolic`},{label:`Add`,value:`list-add-symbolic`}],defaultValue:`document-save-symbolic`}]},Xt={title:`Buttons/Split Button Flat`,description:`Adw.SplitButton with the .flat style class, as used inside header bars and toolbars.`,controls:[{name:`label`,label:`Label`,type:t.TEXT,defaultValue:`Reply`},{name:`iconName`,label:`Icon`,type:t.SELECT,options:[{label:`None`,value:``},{label:`Reply`,value:`mail-reply-sender-symbolic`},{label:`Edit`,value:`document-edit-symbolic`},{label:`Open`,value:`document-open-symbolic`}],defaultValue:`mail-reply-sender-symbolic`}]},Zt=JSON.stringify([{label:`Save as…`,action:`app.save-as`},{label:`Export`,action:`app.export`},{label:`Print`,action:`app.print`}]);function iconBaseName(e){return e.replace(/-symbolic$/,``)}function splitButton(e,t={}){let n=document.createElement(`adw-split-button`);n.setAttribute(`menu`,Zt),n.setAttribute(`label`,e.label);let r=e.iconName;return r&&n.setAttribute(`icon-name`,iconBaseName(r)),t.flat&&n.setAttribute(`flat`,``),n}var SplitButtonWebStoryBase=class extends StoryElement{_widget=null;initialize(){this._widget=splitButton(this.args,{flat:this.flat}),this.addContent(this._widget)}updateArgs(e){if(!this._widget)return;let t=this.args.iconName;t?(this._widget.setAttribute(`icon-name`,iconBaseName(t)),this._widget.removeAttribute(`label`)):(this._widget.removeAttribute(`icon-name`),this._widget.setAttribute(`label`,this.args.label))}};const Qt={stories:[class SplitButtonWebStory extends SplitButtonWebStoryBase{get flat(){return!1}constructor(){super(SplitButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return Yt}},class SplitButtonFlatWebStory extends SplitButtonWebStoryBase{get flat(){return!0}constructor(){super(SplitButtonFlatWebStory.getMetadata(),`Default`)}static getMetadata(){return Xt}}]},$t={title:`Buttons/Toggle Group`,description:`Adw.ToggleGroup — a linked group of Adw.Toggle buttons where exactly one is active.`,controls:[{name:`active`,label:`Active toggle`,type:t.SELECT,options:[{label:`List`,value:0},{label:`Grid`,value:1},{label:`Columns`,value:2}],defaultValue:0},{name:`style`,label:`Style`,type:t.SELECT,options:[{label:`Default`,value:`default`},{label:`Flat`,value:`flat`},{label:`Round`,value:`round`}],defaultValue:`default`}]},en=[`flat`,`round`],tn=[{label:`List`,icon:`view-list`},{label:`Grid`,icon:`view-grid`},{label:`Columns`,icon:`view-columns`}],nn={stories:[class ToggleGroupWebStory extends StoryElement{_group=null;constructor(){super(ToggleGroupWebStory.getMetadata(),`Default`)}static getMetadata(){return $t}initialize(){let e=document.createElement(`adw-toggle-group`);for(let{label:t,icon:n}of tn){let r=document.createElement(`adw-toggle`);r.setAttribute(`label`,t),r.setAttribute(`icon-name`,n),e.appendChild(r)}e.setAttribute(`active`,String(this.args.active)),this._group=e,this._applyStyle(this.args.style),this.addContent(e)}updateArgs(e){this._group&&(this._group.setAttribute(`active`,String(this.args.active)),this._applyStyle(this.args.style))}_applyStyle(e){if(this._group){for(let e of en)this._group.classList.remove(e);e!=="default"&&this._group.classList.add(e)}}}]},rn={title:`Layout/Clamp`,description:`Adw.Clamp limits its child to a maximum width and centres it, tightening the layout as space shrinks.`,controls:[{name:`maximumSize`,label:`Maximum size`,type:t.RANGE,min:200,max:600,step:10,defaultValue:400},{name:`tighteningThreshold`,label:`Tightening threshold`,type:t.RANGE,min:100,max:600,step:10,defaultValue:300}]},an={stories:[class ClampWebStory extends StoryElement{_clamp=null;constructor(){super(ClampWebStory.getMetadata(),`Default`)}static getMetadata(){return rn}initialize(){let e=document.createElement(`adw-card`);e.style.width=`100%`,e.style.boxSizing=`border-box`,e.style.padding=`18px`,e.textContent=`This content is clamped — it stops growing past the maximum size and stays centred.`,this._clamp=document.createElement(`adw-clamp`),this._clamp.append(e),this._syncClamp(),this.addContent(this._clamp)}updateArgs(e){this._syncClamp()}_syncClamp(){this._clamp&&(this._clamp.setAttribute(`maximum-size`,String(this.args.maximumSize)),this._clamp.setAttribute(`tightening-threshold`,String(this.args.tighteningThreshold)))}}]},on={title:`Layout/Header Bar`,description:`Adw.HeaderBar hosts a custom title widget with start and end controls — the standard top chrome of an Adwaita window.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Text Editor`},{name:`subtitle`,label:`Subtitle`,type:t.TEXT,defaultValue:`notes.md`},{name:`showTitle`,label:`Show title`,type:t.BOOLEAN,defaultValue:!0}]},sn={stories:[class HeaderBarWebStory extends StoryElement{_headerBar=null;_title=null;constructor(){super(HeaderBarWebStory.getMetadata(),`Default`)}static getMetadata(){return on}initialize(){this._title=document.createElement(`adw-window-title`),this._title.setAttribute(`slot`,`center`);let e=document.createElement(`adw-button`);e.setAttribute(`slot`,`start`),e.setAttribute(`icon`,`go-previous`),e.setAttribute(`flat`,``);let t=document.createElement(`adw-button`);t.setAttribute(`slot`,`end`),t.setAttribute(`icon`,`open-menu`),t.setAttribute(`flat`,``),this._headerBar=document.createElement(`adw-header-bar`),this._headerBar.style.width=`460px`,this._headerBar.append(e,this._title,t),this._sync(),this.addContent(this._headerBar)}updateArgs(e){this._sync()}_sync(){this._title&&(this._title.setAttribute(`title`,this.args.title),this._title.setAttribute(`subtitle`,this.args.subtitle),this._title.hidden=!this.args.showTitle)}}]},cn={title:`Layout/Toolbar View`,description:`Adw.ToolbarView pins a top header bar and a bottom toolbar around its content, each independently revealable.`,controls:[{name:`revealTopBars`,label:`Reveal top bars`,type:t.BOOLEAN,defaultValue:!0},{name:`revealBottomBars`,label:`Reveal bottom bars`,type:t.BOOLEAN,defaultValue:!0}]},ln={stories:[class ToolbarViewWebStory extends StoryElement{_topBar=null;_bottomBar=null;constructor(){super(ToolbarViewWebStory.getMetadata(),`Default`)}static getMetadata(){return cn}initialize(){let e=document.createElement(`adw-toolbar-view`);e.style.width=`460px`,e.style.height=`320px`;let t=document.createElement(`adw-header-bar`);t.setAttribute(`slot`,`top`);let n=document.createElement(`adw-window-title`);n.setAttribute(`slot`,`center`),n.setAttribute(`title`,`Documents`),n.setAttribute(`subtitle`,`12 items`),t.appendChild(n),e.appendChild(t),this._topBar=t;let r=document.createElement(`adw-status-page`);r.setAttribute(`icon`,`folder`),r.setAttribute(`title`,`Your library`),r.setAttribute(`description`,`Content sits between the toolbars and scrolls independently of them.`),e.appendChild(r);let i=document.createElement(`div`);i.setAttribute(`slot`,`bottom`),i.className=`adw-action-bar`,i.style.display=`flex`,i.style.alignItems=`center`,i.style.gap=`var(--spacing-xs, 6px)`,i.style.padding=`var(--spacing-xs, 6px)`,i.style.borderTop=`1px solid var(--separator-color, rgba(0, 0, 0, 0.15))`;let a=document.createElement(`adw-button`);a.setAttribute(`icon`,`list-add`),a.setAttribute(`flat`,``),a.setAttribute(`tooltip`,`Add`);let o=document.createElement(`adw-button`);o.setAttribute(`icon`,`list-remove`),o.setAttribute(`flat`,``),o.setAttribute(`tooltip`,`Remove`);let s=document.createElement(`span`);s.textContent=`Selection: none`,s.style.flex=`1 1 auto`,s.style.textAlign=`center`;let c=document.createElement(`adw-button`);c.setAttribute(`icon`,`send-to`),c.setAttribute(`flat`,``),c.setAttribute(`tooltip`,`Share`),i.append(a,o,s,c),e.appendChild(i),this._bottomBar=i,this._sync(),this.addContent(e)}updateArgs(e){this._sync()}_sync(){this._topBar&&(this._topBar.hidden=!this.args.revealTopBars),this._bottomBar&&(this._bottomBar.hidden=!this.args.revealBottomBars)}}]},un={title:`Layout/Wrap Box`,description:`Adw.WrapBox flows its children horizontally and wraps them onto new lines when they run out of room.`,controls:[{name:`childSpacing`,label:`Child spacing`,type:t.RANGE,min:0,max:36,step:1,defaultValue:8},{name:`lineSpacing`,label:`Line spacing`,type:t.RANGE,min:0,max:36,step:1,defaultValue:8}]},dn=[`Design`,`Adwaita`,`GNOME`,`GTK`,`Typescript`,`Storybook`,`Wrapping`,`Layout`],fn={stories:[class WrapBoxWebStory extends StoryElement{_wrap=null;constructor(){super(WrapBoxWebStory.getMetadata(),`Default`)}static getMetadata(){return un}initialize(){this._wrap=document.createElement(`adw-wrap-box`),this._wrap.style.width=`460px`;for(let e of dn){let t=document.createElement(`adw-button`);t.setAttribute(`label`,e),t.setAttribute(`pill`,``),this._wrap.append(t)}this._syncWrap(),this.addContent(this._wrap)}updateArgs(e){this._syncWrap()}_syncWrap(){this._wrap&&(this._wrap.setAttribute(`child-spacing`,String(this.args.childSpacing)),this._wrap.setAttribute(`line-spacing`,String(this.args.lineSpacing)))}}]},pn=[{name:`allowScrollWheel`,label:`Allow scroll wheel`,type:t.BOOLEAN,defaultValue:!0},{name:`allowLongSwipes`,label:`Allow long swipes`,type:t.BOOLEAN,defaultValue:!1}],mn={title:`View Switching/Carousel (Dots)`,description:`Adw.Carousel — a horizontally swipeable pager with three pages, paired with Adw.CarouselIndicatorDots.`,controls:pn},hn={title:`View Switching/Carousel (Lines)`,description:`Adw.Carousel — the same swipeable pager paired with Adw.CarouselIndicatorLines instead of dots.`,controls:pn},gn=[{title:`Welcome`,accent:`color-mix(in srgb, var(--accent-bg-color) 14%, var(--window-bg-color))`},{title:`Discover`,accent:`color-mix(in srgb, #2ec27e 14%, var(--window-bg-color))`},{title:`Get started`,accent:`color-mix(in srgb, #e5a50a 14%, var(--window-bg-color))`}];let _n=0;function buildPage(e,t){let n=document.createElement(`adw-card`);n.style.cssText=[`width:440px`,`height:260px`,`display:flex`,`align-items:center`,`justify-content:center`,`background-color:${t}`,`color:#ffffff`,`box-sizing:border-box`].join(`;`);let r=document.createElement(`span`);return r.textContent=e,r.style.cssText=`font-size:24pt;font-weight:800;`,n.appendChild(r),n}function syncCarouselArgs(e,t){e.setAttribute(`allow-scroll-wheel`,t.allowScrollWheel?`true`:`false`),e.setAttribute(`allow-long-swipes`,t.allowLongSwipes?`true`:`false`)}var CarouselWebStoryBase=class extends StoryElement{_carousel=null;initialize(){let e=document.createElement(`adw-carousel`);e.id=`adw-carousel-${_n++}`,e.style.cssText=`width:480px;height:280px;`,syncCarouselArgs(e,this.args);for(let t of gn)e.appendChild(buildPage(t.title,t.accent));this._carousel=e;let t=document.createElement(this.indicatorTag());t.setAttribute(`for`,e.id);let n=document.createElement(`div`);n.style.cssText=`display:flex;flex-direction:column;gap:12px;width:480px;align-items:center;`,n.append(e,t),this.addContent(n)}updateArgs(e){this._carousel&&syncCarouselArgs(this._carousel,this.args)}};const vn={stories:[class CarouselDotsWebStory extends CarouselWebStoryBase{constructor(){super(CarouselDotsWebStory.getMetadata(),`Default`)}static getMetadata(){return mn}indicatorTag(){return`adw-carousel-indicator-dots`}},class CarouselLinesWebStory extends CarouselWebStoryBase{constructor(){super(CarouselLinesWebStory.getMetadata(),`Default`)}static getMetadata(){return hn}indicatorTag(){return`adw-carousel-indicator-lines`}}]},yn={title:`View Switching/Inline View Switcher`,description:`Adw.InlineViewSwitcher — a compact inline switcher that can show labels, icons, or both for an Adw.ViewStack.`,controls:[{name:`displayMode`,label:`Display mode`,type:t.SELECT,options:[{label:`Labels`,value:`labels`},{label:`Icons`,value:`icons`},{label:`Both`,value:`both`}],defaultValue:`both`}]},bn=[{id:`overview`,title:`Overview`,icon:`view-grid`,body:`A quick summary of your project.`},{id:`activity`,title:`Activity`,icon:`document-edit`,body:`Recent edits and changes.`},{id:`settings`,title:`Settings`,icon:`emblem-system`,body:`Configure how things behave.`}],xn={stories:[class InlineViewSwitcherWebStory extends StoryElement{_switcher=null;constructor(){super(InlineViewSwitcherWebStory.getMetadata(),`Default`)}static getMetadata(){return yn}initialize(){let e=document.createElement(`adw-inline-view-switcher`);for(let{id:t,title:n,icon:r,body:i}of bn){let a=document.createElement(`adw-view-stack-page`);a.setAttribute(`title`,n),a.setAttribute(`icon-name`,r);let o=document.createElement(`adw-status-page`);o.id=t,o.setAttribute(`icon`,r),o.setAttribute(`title`,n),o.setAttribute(`description`,i),a.appendChild(o),e.appendChild(a)}e.setAttribute(`display-mode`,this.args.displayMode),this._switcher=e,this.addContent(e)}updateArgs(e){this._switcher&&this._switcher.setAttribute(`display-mode`,this.args.displayMode)}}]},Sn={title:`View Switching/Tab View`,description:`Adw.TabView with an Adw.TabBar header — three tabbed pages; the tab bar can auto-hide when only one tab remains.`,controls:[{name:`autohide`,label:`Autohide tab bar`,type:t.BOOLEAN,defaultValue:!1}]},Cn=[{title:`Overview`,body:`A summary of everything at a glance.`},{title:`Details`,body:`The specifics, broken down line by line.`},{title:`History`,body:`A log of every change made so far.`}],wn={stories:[class TabViewWebStory extends StoryElement{_tabView=null;constructor(){super(TabViewWebStory.getMetadata(),`Default`)}static getMetadata(){return Sn}initialize(){let e=document.createElement(`adw-tab-view`);e.style.width=`480px`,e.style.height=`340px`;for(let t of Cn){let n=document.createElement(`adw-tab-page`);n.setAttribute(`title`,t.title),n.appendChild(this._buildPageBody(t.title,t.body)),e.appendChild(n)}this._tabView=e,this._applyAutohide(this.args.autohide),this.addContent(e)}updateArgs(e){this._tabView&&this._applyAutohide(this.args.autohide)}_buildPageBody(e,t){let n=document.createElement(`adw-status-page`);return n.setAttribute(`icon`,`view-grid`),n.setAttribute(`title`,e),n.setAttribute(`description`,t),n}_applyAutohide(e){this._tabView&&(e?this._tabView.setAttribute(`autohide`,``):this._tabView.removeAttribute(`autohide`))}}]},Tn={title:`View Switching/View Switcher`,description:`Adw.ViewSwitcher — a segmented switcher whose buttons select pages in a paired Adw.ViewStack.`,controls:[{name:`policy`,label:`Policy`,type:t.SELECT,options:[{label:`Wide`,value:`wide`},{label:`Narrow`,value:`narrow`}],defaultValue:`wide`}]},En=[{name:`inbox`,title:`Inbox`,icon:`mail-unread`,description:`You have three unread conversations.`},{name:`starred`,title:`Starred`,icon:`starred`,description:`Messages you have marked as important.`},{name:`archive`,title:`Archive`,icon:`folder`,description:`Older conversations kept for reference.`}],Dn={stories:[class ViewSwitcherWebStory extends StoryElement{_switcher=null;constructor(){super(ViewSwitcherWebStory.getMetadata(),`Default`)}static getMetadata(){return Tn}initialize(){let e=document.createElement(`adw-view-switcher`);for(let{name:t,title:n,icon:r,description:i}of En){let a=document.createElement(`adw-view-switcher-page`);a.setAttribute(`name`,t),a.setAttribute(`title`,n),a.setAttribute(`icon-name`,r);let o=document.createElement(`adw-status-page`);o.setAttribute(`icon`,r),o.setAttribute(`title`,n),o.setAttribute(`description`,i),a.appendChild(o),e.appendChild(a)}e.setAttribute(`policy`,this.args.policy),e.style.width=`480px`,this._switcher=e,this.addContent(e)}updateArgs(e){this._switcher&&this._switcher.setAttribute(`policy`,this.args.policy)}}]},On=[{name:`inbox`,title:`Inbox`,icon:`mail-unread-symbolic`},{name:`starred`,title:`Starred`,icon:`starred-symbolic`},{name:`archive`,title:`Archive`,icon:`folder-symbolic`}],kn={title:`View Switching/View Switcher Bar`,description:"Adw.ViewSwitcherBar — the narrow-window switcher, pinned to the bottom of a toolbar view. `reveal` is a REQUEST, not a state: a stack with fewer than two pages stays collapsed however loudly it is asked.",controls:[{name:`reveal`,label:`Reveal`,type:t.BOOLEAN,defaultValue:!0}]},An={stories:[class ViewSwitcherBarWebStory extends StoryElement{_bar=null;constructor(){super(ViewSwitcherBarWebStory.getMetadata(),`Default`)}static getMetadata(){return kn}initialize(){let e=document.createElement(`adw-view-stack`);e.style.flex=`1`;for(let t of On){let n=document.createElement(`adw-status-page`);n.setAttribute(`icon`,t.icon.replace(/-symbolic$/,``)),n.setAttribute(`title`,t.title),n.setAttribute(`description`,`The ${t.title.toLowerCase()} page.`);let r=document.createElement(`adw-view-stack-page`);r.setAttribute(`name`,t.name),r.setAttribute(`title`,t.title),r.setAttribute(`icon-name`,t.icon.replace(/-symbolic$/,``)),r.appendChild(n),e.appendChild(r)}let t=document.createElement(`adw-view-switcher-bar`);t.setAttribute(`slot`,`bottom`);let n=document.createElement(`adw-toolbar-view`);n.style.width=`360px`,n.style.height=`360px`,n.append(e,t),this.addContent(n),t.setStack(e),this._bar=t,this._apply()}updateArgs(e){this._apply()}_apply(){this._bar&&(this._bar.reveal=this.args.reveal)}}]},jn={title:`Navigation/Bottom Sheet`,description:`Adw.BottomSheet — a sheet that slides up over the content. Toggle "Open" to reveal it.`,controls:[{name:`open`,label:`Open`,type:t.BOOLEAN,defaultValue:!0},{name:`modal`,label:`Modal`,type:t.BOOLEAN,defaultValue:!0},{name:`canClose`,label:`Can close`,type:t.BOOLEAN,defaultValue:!0}]};function iconClass$1(e){return`adw-icon adw-icon--${e.replace(/-symbolic$/,``)}`}__name(iconClass$1,`iconClass`);const Mn={stories:[class BottomSheetWebStory extends StoryElement{_sheet=null;constructor(){super(BottomSheetWebStory.getMetadata(),`Default`)}static getMetadata(){return jn}_buildContent(){let e=document.createElement(`adw-bottom-sheet-content`),t=document.createElement(`div`);t.style.display=`flex`,t.style.alignItems=`center`,t.style.justifyContent=`center`,t.style.width=`100%`,t.style.height=`100%`;let n=document.createElement(`adw-button`);return n.textContent=`Toggle sheet`,n.setAttribute(`pill`,``),n.setAttribute(`suggested`,``),n.addEventListener(`click`,()=>{this._sheet&&this._sheet.toggleAttribute(`open`)}),t.append(n),e.append(t),e}_buildSheet(){let e=document.createElement(`adw-bottom-sheet-sheet`),t=document.createElement(`div`);t.style.display=`flex`,t.style.flexDirection=`column`,t.style.gap=`12px`,t.style.margin=`18px 18px 24px`;let n=document.createElement(`span`);n.textContent=`Share track`,n.style.fontSize=`15pt`,n.style.fontWeight=`800`,t.append(n);let r=document.createElement(`adw-preferences-group`);for(let[e,t]of[[`Copy link`,`edit-copy-symbolic`],[`Send to a friend`,`mail-send-symbolic`],[`Add to playlist`,`list-add-symbolic`]]){let n=document.createElement(`adw-action-row`);n.setAttribute(`title`,e),n.setAttribute(`activatable`,``);let i=document.createElement(`span`);i.setAttribute(`slot`,`prefix`),i.className=iconClass$1(t),n.append(i),r.append(n)}return t.append(r),e.append(t),e}initialize(){this._sheet=document.createElement(`adw-bottom-sheet`),this._sheet.style.width=`480px`,this._sheet.style.height=`340px`,this._sheet.append(this._buildContent(),this._buildSheet()),this._sync(),this.addContent(this._sheet)}updateArgs(e){this._sync()}_sync(){this._sheet&&(this._sheet.toggleAttribute(`open`,this.args.open),this._setBool(`modal`,this.args.modal),this._setBool(`can-close`,this.args.canClose))}_setBool(e,t){this._sheet&&(t?this._sheet.setAttribute(e,``):this._sheet.setAttribute(e,`false`))}}]},Nn={title:`Navigation/Navigation Split View`,description:`Adw.NavigationSplitView — a resizable sidebar beside a content pane. When collapsed it folds into a navigation stack.`,controls:[{name:`showContent`,label:`Show content`,type:t.BOOLEAN,defaultValue:!0},{name:`collapsed`,label:`Collapsed`,type:t.BOOLEAN,defaultValue:!1}]};function iconClass(e){return`adw-icon adw-icon--${e.replace(/-symbolic$/,``)}`}const Pn={stories:[class NavigationSplitViewWebStory extends StoryElement{_view=null;constructor(){super(NavigationSplitViewWebStory.getMetadata(),`Default`)}static getMetadata(){return Nn}buildSidebar(){let e=document.createElement(`adw-preferences-group`);for(let[t,n,r]of[[`All Mail`,`128 messages`,`mail-unread-symbolic`],[`Starred`,`6 messages`,`starred-symbolic`],[`Drafts`,`2 messages`,`document-edit-symbolic`],[`Archive`,`512 messages`,`folder-symbolic`]]){let i=document.createElement(`adw-action-row`);i.setAttribute(`title`,t),i.setAttribute(`subtitle`,n),i.setAttribute(`activatable`,``);let a=document.createElement(`span`);a.setAttribute(`slot`,`prefix`),a.className=iconClass(r),i.appendChild(a),e.appendChild(i)}let t=document.createElement(`adw-header-bar`);t.setAttribute(`slot`,`top`);let n=document.createElement(`adw-window-title`);n.setAttribute(`slot`,`center`),n.setAttribute(`title`,`Mailboxes`),t.appendChild(n);let r=document.createElement(`adw-toolbar-view`);return r.setAttribute(`slot`,`sidebar`),r.append(t,e),r}buildContent(){let e=document.createElement(`adw-status-page`);e.setAttribute(`icon`,`mail-unread-symbolic`),e.setAttribute(`title`,`All Mail`),e.setAttribute(`description`,`Select a conversation from the list to read it here.`);let t=document.createElement(`adw-header-bar`);t.setAttribute(`slot`,`top`);let n=document.createElement(`adw-window-title`);n.setAttribute(`slot`,`center`),n.setAttribute(`title`,`All Mail`),t.appendChild(n);let r=document.createElement(`adw-toolbar-view`);return r.setAttribute(`slot`,`content`),r.append(t,e),r}initialize(){this._view=document.createElement(`adw-navigation-split-view`),this._view.style.width=`480px`,this._view.style.height=`340px`,this._view.append(this.buildSidebar(),this.buildContent()),this._sync(),this.addContent(this._view)}updateArgs(e){this._sync()}_sync(){this._view&&(this._view.toggleAttribute(`show-content`,this.args.showContent),this._view.toggleAttribute(`collapsed`,this.args.collapsed))}}]},Fn={title:`Navigation/Navigation View`,description:`Adw.NavigationView — a navigation stack. The root page pushes a detail page, which gets an automatic back button.`,controls:[{name:`rootTitle`,label:`Root title`,type:t.TEXT,defaultValue:`Contacts`},{name:`detailTitle`,label:`Detail title`,type:t.TEXT,defaultValue:`Ada Lovelace`},{name:`animateTransitions`,label:`Animate transitions`,type:t.BOOLEAN,defaultValue:!0}]},In={stories:[class NavigationViewWebStory extends StoryElement{_view=null;_rootTitle=null;_detailPage=null;_detailTitle=null;_detailStatus=null;constructor(){super(NavigationViewWebStory.getMetadata(),`Default`)}static getMetadata(){return Fn}initialize(){this._view=document.createElement(`adw-navigation-view`),this._view.style.width=`480px`,this._view.style.height=`340px`,this._view.setAttribute(`animate-transitions`,this.args.animateTransitions?`true`:`false`),this._detailTitle=document.createElement(`adw-window-title`),this._detailTitle.setAttribute(`title`,this.args.detailTitle),this._detailTitle.setAttribute(`slot`,`center`),this._detailStatus=document.createElement(`adw-status-page`),this._detailStatus.setAttribute(`icon`,`avatar-default`),this._detailStatus.setAttribute(`title`,this.args.detailTitle),this._detailStatus.setAttribute(`description`,`Mathematician and writer, the first computer programmer.`);let e=document.createElement(`adw-header-bar`);e.setAttribute(`slot`,`top`),e.appendChild(this._detailTitle);let t=document.createElement(`adw-toolbar-view`);t.append(e,this._detailStatus),this._detailPage=document.createElement(`adw-navigation-page`),this._detailPage.setAttribute(`tag`,`detail`),this._detailPage.setAttribute(`title`,this.args.detailTitle),this._detailPage.appendChild(t),this._rootTitle=document.createElement(`adw-window-title`),this._rootTitle.setAttribute(`title`,this.args.rootTitle),this._rootTitle.setAttribute(`slot`,`center`);let n=document.createElement(`adw-button`);n.setAttribute(`label`,`Open contact`),n.setAttribute(`pill`,``),n.setAttribute(`suggested`,``),n.addEventListener(`click`,()=>{this._view?.push(`detail`)});let r=document.createElement(`div`);r.style.cssText=`display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;`,r.appendChild(n);let i=document.createElement(`adw-header-bar`);i.setAttribute(`slot`,`top`),i.appendChild(this._rootTitle);let a=document.createElement(`adw-toolbar-view`);a.append(i,r);let o=document.createElement(`adw-navigation-page`);o.setAttribute(`tag`,`root`),o.setAttribute(`title`,this.args.rootTitle),o.appendChild(a),this._view.append(o,this._detailPage),this.addContent(this._view)}updateArgs(e){if(!this._view)return;this._view.setAttribute(`animate-transitions`,this.args.animateTransitions?`true`:`false`),this._rootTitle?.setAttribute(`title`,this.args.rootTitle);let t=this.args.detailTitle;this._detailTitle?.setAttribute(`title`,t),this._detailStatus?.setAttribute(`title`,t),this._detailPage?.setAttribute(`title`,t)}}]},Ln={title:`Navigation/Overlay Split View`,description:`Adw.OverlaySplitView — a sidebar shown beside the content, or overlaid on top of it when collapsed.`,controls:[{name:`showSidebar`,label:`Show sidebar`,type:t.BOOLEAN,defaultValue:!0},{name:`collapsed`,label:`Collapsed`,type:t.BOOLEAN,defaultValue:!1}]},Rn=[[`Home`,`go-home`],[`Discover`,`system-search`],[`Library`,`folder-music`],[`Settings`,`emblem-system`]],zn={stories:[class OverlaySplitViewWebStory extends StoryElement{_view=null;constructor(){super(OverlaySplitViewWebStory.getMetadata(),`Default`)}static getMetadata(){return Ln}buildSidebar(){let e=document.createElement(`adw-preferences-group`);for(let[t,n]of Rn){let r=document.createElement(`adw-action-row`);r.setAttribute(`title`,t),r.setAttribute(`activatable`,``);let i=document.createElement(`span`);i.setAttribute(`slot`,`prefix`),i.className=`adw-icon adw-icon--${n}`,r.appendChild(i),e.appendChild(r)}let t=document.createElement(`adw-toolbar-view`);t.classList.add(`sidebar`);let n=document.createElement(`adw-header-bar`);return n.setAttribute(`slot`,`top`),t.appendChild(n),t.appendChild(e),t}buildContent(){let e=document.createElement(`adw-status-page`);e.setAttribute(`icon`,`folder-music`),e.setAttribute(`title`,`Your Library`),e.setAttribute(`description`,`Toggle the sidebar to browse sections. Collapse it to overlay the content.`);let t=document.createElement(`adw-toolbar-view`),n=document.createElement(`adw-header-bar`);return n.setAttribute(`slot`,`top`),t.appendChild(n),t.appendChild(e),t}initialize(){this._view=document.createElement(`adw-overlay-split-view`),this._view.style.width=`480px`,this._view.style.height=`340px`;let e=this.buildSidebar();e.setAttribute(`slot`,`sidebar`);let t=this.buildContent();t.setAttribute(`slot`,`content`),this._view.append(e,t),this._sync(),this.addContent(this._view)}updateArgs(e){this._sync()}_sync(){this._view&&(this._view.toggleAttribute(`show-sidebar`,this.args.showSidebar),this._view.toggleAttribute(`collapsed`,this.args.collapsed))}}]},Bn={title:`Navigation/Sidebar`,description:`Adw.Sidebar — a selectable list of Adw.SidebarItem grouped into sections. Selecting an item updates the content.`,controls:[{name:`mode`,label:`Mode`,type:t.SELECT,options:[{label:`Sidebar`,value:`sidebar`},{label:`Page`,value:`page`}],defaultValue:`sidebar`},{name:`selected`,label:`Selected index`,type:t.NUMBER,min:0,max:3,step:1,defaultValue:0}]},Vn={stories:[class SidebarWebStory extends StoryElement{_sidebar=null;_status=null;items=[{title:`Inbox`,subtitle:`3 unread`,icon:`mail-unread-symbolic`},{title:`Starred`,subtitle:`Favourites`,icon:`starred-symbolic`},{title:`Sent`,subtitle:`Outgoing mail`,icon:`mail-send-symbolic`},{title:`Archive`,subtitle:`Older mail`,icon:`folder-symbolic`}];constructor(){super(SidebarWebStory.getMetadata(),`Default`)}static getMetadata(){return Bn}initialize(){let e=document.createElement(`adw-sidebar-section`);e.setAttribute(`title`,`Mailboxes`);for(let t of this.items){let n=document.createElement(`adw-sidebar-item`);n.setAttribute(`title`,t.title),n.setAttribute(`subtitle`,t.subtitle),n.setAttribute(`icon-name`,t.icon),e.append(n)}this._sidebar=document.createElement(`adw-sidebar`),this._sidebar.setAttribute(`mode`,this.args.mode),this._sidebar.setAttribute(`selected`,String(this.args.selected)),this._sidebar.style.width=`220px`,this._sidebar.append(e),this._sidebar.addEventListener(`notify::selected`,()=>this._syncContent()),this._status=document.createElement(`adw-status-page`),this._status.style.flex=`1 1 auto`;let t=document.createElement(`div`);t.style.display=`flex`,t.style.width=`480px`,t.style.height=`340px`,t.style.border=`1px solid var(--card-shade-color)`,t.style.borderRadius=`var(--card-radius, 12px)`,t.style.overflow=`hidden`;let n=document.createElement(`div`);n.style.width=`1px`,n.style.alignSelf=`stretch`,n.style.backgroundColor=`var(--separator-color, var(--card-shade-color))`,t.append(this._sidebar,n,this._status),this._syncContent(),this.addContent(t)}updateArgs(e){this._sidebar&&(this._sidebar.setAttribute(`mode`,this.args.mode),this._sidebar.setAttribute(`selected`,String(this.args.selected)),this._syncContent())}_syncContent(){if(!this._sidebar||!this._status)return;let e=Number(this._sidebar.selected),t=this.items[e]??this.items[0];this._status.setAttribute(`title`,t.title),this._status.setAttribute(`icon`,t.icon.replace(/-symbolic$/,``)),this._status.setAttribute(`description`,t.subtitle)}}]},Hn={title:`Feedback/About Dialog`,description:`Adw.AboutDialog — the standard Adwaita about window with application name, version, credits and license.`,controls:[{name:`applicationName`,label:`Application name`,type:t.TEXT,defaultValue:`Adwaita Storybook`},{name:`version`,label:`Version`,type:t.TEXT,defaultValue:`0.11.0`}]},Un={stories:[class AboutDialogWebStory extends StoryElement{_dialog=null;constructor(){super(AboutDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return Hn}initialize(){let e=document.createElement(`div`);e.style.display=`flex`,e.style.alignItems=`center`,e.style.justifyContent=`center`,e.style.minHeight=`160px`;let t=document.createElement(`adw-button`);t.textContent=`Show dialog`,t.setAttribute(`pill`,``),t.setAttribute(`suggested`,``),t.addEventListener(`click`,()=>this._present()),e.append(t),this._dialog=document.createElement(`adw-about-dialog`),document.body.appendChild(this._dialog),this.addContent(e)}_present(){if(!this._dialog)return;let e=this._dialog;e.setAttribute(`application-name`,this.args.applicationName??`Adwaita Storybook`),e.setAttribute(`application-icon`,`application-x-executable`),e.setAttribute(`developer-name`,`A GJSify Project`),e.setAttribute(`version`,this.args.version??`0.11.0`),e.setAttribute(`comments`,`A live catalogue of native GTK and Adwaita widgets, rendered under GJS.`),e.setAttribute(`website`,`https://github.com/gjsify/gjsify`),e.setAttribute(`issue-url`,`https://github.com/gjsify/gjsify/issues`),e.setAttribute(`license`,`The MIT License (MIT)`),e.setAttribute(`license-url`,`https://opensource.org/licenses/mit-license.php`),e.setAttribute(`copyright`,`© 2026 The GJSify Project`),e.developers=[`Ada Lovelace`,`Grace Hopper`],e.designers=[`Margaret Hamilton`],e.present()}updateArgs(e){}teardown(){this._dialog&&this._dialog.parentNode&&this._dialog.parentNode.removeChild(this._dialog),this._dialog=null}}]},Wn={title:`Feedback/Alert Dialog`,description:`Adw.AlertDialog — a modal dialog with a heading, body text and responses, including a destructive action.`,controls:[{name:`heading`,label:`Heading`,type:t.TEXT,defaultValue:`Delete Project?`},{name:`body`,label:`Body`,type:t.TEXT,defaultValue:`This will permanently remove the project and all of its files. This action cannot be undone.`}]},Gn={stories:[class AlertDialogWebStory extends StoryElement{constructor(){super(AlertDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return Wn}initialize(){let e=document.createElement(`adw-button`);e.textContent=`Show dialog`,e.setAttribute(`pill`,``),e.setAttribute(`suggested`,``),e.addEventListener(`click`,()=>this._present());let t=document.createElement(`div`);t.style.display=`flex`,t.style.alignItems=`center`,t.style.justifyContent=`center`,t.style.minHeight=`160px`,t.append(e),this.addContent(t)}_present(){let e=document.createElement(`adw-alert-dialog`);e.setAttribute(`heading`,this.args.heading),e.setAttribute(`body`,this.args.body),document.body.appendChild(e),e.addResponse(`cancel`,`Cancel`),e.addResponse(`delete`,`Delete`),e.setResponseAppearance(`delete`,`destructive`),e.setDefaultResponse(`cancel`),e.setCloseResponse(`cancel`),e.addEventListener(`response`,()=>e.remove(),{once:!0}),e.present()}updateArgs(e){}}]},Kn={title:`Feedback/Preferences Dialog`,description:`Adw.PreferencesDialog — a preferences window with a page, a group and a handful of boxed-list rows.`,controls:[{name:`pageTitle`,label:`Page title`,type:t.TEXT,defaultValue:`General`},{name:`groupTitle`,label:`Group title`,type:t.TEXT,defaultValue:`Appearance`}]},qn={stories:[class PreferencesDialogWebStory extends StoryElement{_dialog=null;constructor(){super(PreferencesDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return Kn}_buildDialog(){let e=document.createElement(`adw-preferences-dialog`);e.setAttribute(`title`,`Preferences`);let t=document.createElement(`adw-preferences-page`);t.setAttribute(`title`,this.args.pageTitle??`General`),t.setAttribute(`icon-name`,`preferences-system-symbolic`);let n=document.createElement(`adw-preferences-group`);n.setAttribute(`title`,this.args.groupTitle??`Appearance`),n.setAttribute(`description`,`Control how the application looks and behaves.`);let r=document.createElement(`adw-switch-row`);r.setAttribute(`title`,`Dark style`),r.setAttribute(`subtitle`,`Use a dark colour scheme`),r.setAttribute(`active`,``),n.append(r);let i=document.createElement(`adw-combo-row`);i.setAttribute(`title`,`Accent colour`),i.setAttribute(`items`,JSON.stringify([`Blue`,`Teal`,`Green`,`Orange`,`Purple`])),i.setAttribute(`selected`,`0`),n.append(i);let a=document.createElement(`adw-spin-row`);return a.setAttribute(`title`,`Font size`),a.setAttribute(`min`,`8`),a.setAttribute(`max`,`24`),a.setAttribute(`step`,`1`),a.setAttribute(`value`,`12`),n.append(a),t.append(n),e.append(t),e}initialize(){let e=document.createElement(`div`);e.style.display=`flex`,e.style.alignItems=`center`,e.style.justifyContent=`center`,e.style.width=`100%`,e.style.height=`100%`,e.style.minHeight=`200px`;let t=document.createElement(`adw-button`);t.textContent=`Show dialog`,t.setAttribute(`pill`,``),t.setAttribute(`suggested`,``),t.addEventListener(`click`,()=>this._present()),e.append(t),this.addContent(e)}_present(){this._dialog&&this._dialog.remove(),this._dialog=this._buildDialog(),this._dialog.addEventListener(`closed`,()=>{this._dialog?.remove(),this._dialog=null}),document.body.appendChild(this._dialog),requestAnimationFrame(()=>this._dialog?.setAttribute(`open`,``))}updateArgs(e){}teardown(){this._dialog?.remove(),this._dialog=null}}]},Jn={title:`Feedback/Toast`,description:`Adw.Toast — a transient notification, with an optional action button, shown over an Adw.ToastOverlay.`,controls:[{name:`title`,label:`Toast text`,type:t.TEXT,defaultValue:`File moved to Trash`},{name:`timeout`,label:`Timeout (s)`,type:t.NUMBER,min:0,max:10,step:1,defaultValue:3},{name:`hasButton`,label:`Action button`,type:t.BOOLEAN,defaultValue:!0},{name:`buttonLabel`,label:`Button label`,type:t.TEXT,defaultValue:`Undo`}]},Yn=[$e,tt,rt,st,lt,dt,pt,ht,vt,xt,Ct,Tt,Dt,At,Mt,Pt,zt,Lt,Vt,Gt,Jt,Qt,nn,an,sn,ln,fn,vn,xn,wn,Dn,An,Mn,Pn,In,zn,Vn,Un,Gn,qn,{stories:[class ToastWebStory extends StoryElement{_overlay=null;constructor(){super(ToastWebStory.getMetadata(),`Default`)}static getMetadata(){return Jn}initialize(){this._overlay=document.createElement(`adw-toast-overlay`),this._overlay.style.width=`360px`,this._overlay.style.height=`220px`;let e=document.createElement(`div`);e.style.display=`flex`,e.style.alignItems=`center`,e.style.justifyContent=`center`,e.style.width=`100%`,e.style.height=`100%`;let t=document.createElement(`adw-button`);t.textContent=`Show toast`,t.setAttribute(`pill`,``),t.setAttribute(`suggested`,``),t.addEventListener(`click`,()=>this._showToast()),e.append(t),this._overlay.append(e),this.addContent(this._overlay)}_showToast(){if(!this._overlay)return;let e=this.args.hasButton;this._overlay.addToast(this.args.title,{timeout:this.args.timeout,buttonLabel:e?this.args.buttonLabel:void 0})}updateArgs(e){}}]}];mountStorybook(document.body,{title:`Adwaita Storybook`,stories:Yn});
|
|
5441
|
+
`,document.head.appendChild(e),X=!0}function h(e,t={},n=[]){let r=document.createElement(e);for(let[e,n]of Object.entries(t))r.setAttribute(e,n);for(let e of n)r.append(e);return r}var StorybookWebApp=class{_controller=new StorybookController(this,e=>this._buildControls(e));_options;_container;_appearance;_listEl;_previewEl;_previewTitle;_controlsGroup;_navSplit;_controlsSplit;_backBtn;_rowByTitle=new Map;constructor(e,t){this._container=e,this._options=t,this._appearance=new StorybookWebAppearance(e)}mount(){injectStorybookStyles(),this._buildUI(),this._observeBreakpoint(),this._exposeGlobal(),this._controller.mount(this._options.stories,this._options.openFirst!==!1)}_observeBreakpoint(){let apply=()=>this._applyBreakpoint();typeof ResizeObserver<`u`?new ResizeObserver(apply).observe(this._navSplit):globalThis.addEventListener?.(`resize`,apply),apply()}_applyBreakpoint(){let e=this._navSplit.clientWidth;if(e===0)return;let t=e<620,n=e<1e3,r=this._navSplit,i=this._controlsSplit;r.collapsed!==t&&(r.collapsed=t),i.collapsed!==n&&(i.collapsed=n),this._navSplit.removeAttribute(`show-content`),this._backBtn.hidden=!0,i.showSidebar=!n}get activeStory(){return this._controller.activeStory}listStories(){return this._controller.listStories()}openStoryByTitle(e){return this._controller.openStoryByTitle(e)}getCurrentStory(){return this._controller.getCurrentStory()}setActiveArg(e,t){return this._controller.setActiveArg(e,t)}renderSidebar(e,t){this._listEl.replaceChildren(),this._rowByTitle.clear();for(let{category:n,stories:r}of e){this._listEl.append(h(`div`,{class:`sb-category`},[n]));for(let{instance:e,name:n}of r){let r=h(`div`,{class:`sb-story-row`,role:`button`,tabindex:`0`},[n]);r.addEventListener(`click`,()=>t(e)),r.addEventListener(`keydown`,n=>{(n.key===`Enter`||n.key===` `)&&(n.preventDefault(),t(e))}),this._listEl.append(r),this._rowByTitle.set(e.meta.title,r)}}}markSelected(e){for(let[t,n]of this._rowByTitle)n.classList.toggle(`selected`,t===e)}setPreviewTitle(e){this._previewTitle.setAttribute(`title`,e)}showPreview(e){this._previewEl.replaceChildren(e.element),this._navSplit.collapsed&&this._navSplit.setAttribute(`show-content`,``)}renderControls(e){let t=this._controlsGroup.querySelector(`.adw-preferences-group-listbox`);if(t){t.replaceChildren();for(let n of e)t.append(n.view)}}_buildControls(e){let t=[],n=e.meta.controls;if(Array.isArray(n))for(let r of n){if(!r?.name||!r?.type){console.warn(`Invalid control configuration:`,r);continue}let n=createControlRow(e,r);n&&t.push(n)}return t}_buildUI(){this._listEl=h(`div`,{class:`sb-sidebar-list navigation-sidebar`});let e=h(`div`,{class:`sb-sidebar-scroll`},[this._listEl]),t=h(`div`,{slot:`sidebar`,class:`sb-sidebar-pane`},[h(`adw-toolbar-view`,{},[h(`adw-header-bar`,{slot:`top`},[h(`adw-window-title`,{slot:`center`,title:this._options.title??`Stories`})]),e])]);this._previewEl=h(`div`,{class:`sb-preview-scroll`}),this._controlsGroup=h(`adw-preferences-group`,{title:`Controls`});let n=h(`div`,{slot:`sidebar`,class:`sb-controls-scroll`},[h(`div`,{class:`sb-controls-page`},[this._controlsGroup])]),r=h(`adw-overlay-split-view`,{"sidebar-position":`end`,"show-sidebar":``,"min-sidebar-width":`280`,"max-sidebar-width":`360`},[h(`div`,{slot:`content`,class:`sb-preview-pane`},[this._previewEl]),n]);this._controlsSplit=r,this._backBtn=h(`button`,{class:`adw-header-btn sb-back-btn`,slot:`start`,title:`Back to stories`,"aria-label":`Back to stories`}),this._backBtn.append(h(`span`,{class:`adw-icon adw-icon--go-previous`})),this._backBtn.hidden=!0,this._backBtn.addEventListener(`click`,()=>this._navSplit.removeAttribute(`show-content`)),this._previewTitle=h(`adw-window-title`,{slot:`center`,title:`Preview`});let i=h(`button`,{class:`adw-header-btn sb-toggle-controls`,title:`Toggle Controls`,"aria-label":`Toggle Controls`});i.append(h(`span`,{class:`adw-icon adw-icon--sidebar-show`})),i.setAttribute(`slot`,`end`),i.addEventListener(`click`,()=>{r.showSidebar=!r.showSidebar});let a=h(`button`,{class:`adw-header-btn sb-appearance-btn`,slot:`end`,title:`Appearance`,"aria-label":`Appearance`});a.append(h(`span`,{class:`adw-icon adw-icon--preferences-system`}));let o=buildAppearanceDialog(this._appearance);a.addEventListener(`click`,()=>{o.isConnected||this._container.append(o),o.toggleAttribute(`open`,!0)});let s=h(`div`,{slot:`content`,class:`sb-content-pane`},[h(`adw-toolbar-view`,{},[h(`adw-header-bar`,{slot:`top`},[this._backBtn,this._previewTitle,a,i]),r])]);this._navSplit=h(`adw-navigation-split-view`,{"min-sidebar-width":`220`,"max-sidebar-width":`320`},[t,s]);let c=h(`adw-window`,{class:`sb-window`},[this._navSplit]);this._container.replaceChildren(c)}_exposeGlobal(){globalThis.__storybook={listStories:()=>this.listStories(),openStory:e=>this.openStoryByTitle(e),getCurrentStory:()=>this.getCurrentStory(),setArg:(e,t)=>this.setActiveArg(e,t),getArgs:()=>this.activeStory?.args??null}}};function mountStorybook(e,t){let n=new StorybookWebApp(e,t);return n.mount(),n}const Ze=[{title:`Sync`,kind:`switch`,active:!0},{title:`Export`,kind:`action`}],Qe=[`Blue`,`Teal`,`Green`,`Orange`],Z={appearance:`Appearance`,account:`Account`,shortcuts:`Shortcuts`,actions:`Actions`},Q={bannerTitle:`You have unsaved changes`,bannerButton:`Save`,darkMode:`Dark mode`,darkModeSubtitle:`Use the dark Adwaita palette`,notifications:`Notifications`,notificationsSubtitle:`Show toasts for events`,accentColor:`Accent color`,name:`Name`,nameValue:`Ada Lovelace`,email:`Email`,emailValue:`ada@example.com`,devices:`Devices`,advanced:`Advanced`,advancedSubtitle:`More options`,save:`Save changes`,delete:`Delete account`},$={value:3,lower:1,upper:10,step:1},$e=[{title:`Copy`,accelerator:`<Control>C`},{title:`Select all`,accelerator:`<Shift><Control>a`},{title:`Switch tab`,accelerator:`<Alt>1...9`}],et={title:`Overview/Widgets`,description:`Many widgets at once, the way an app composes them: a banner, preference groups of rows, an expander, buttons and shortcut labels. Use it to judge spacing, alignment and the theme as a whole rather than one widget in isolation.`,controls:[{name:`revealed`,label:`Show banner`,type:t.BOOLEAN,description:`Adw.Banner:revealed — animates in and out`,defaultValue:!0}]};function el(e,t={}){let n=document.createElement(e);for(let[e,r]of Object.entries(t))n.setAttribute(e,r);return n}const tt={stories:[class OverviewWidgetsWebStory extends StoryElement{_banner=null;constructor(){super(OverviewWidgetsWebStory.getMetadata(),`Default`)}static getMetadata(){return et}initialize(){let e=document.createElement(`div`);e.style.display=`flex`,e.style.flexDirection=`column`,e.style.width=`100%`,this._banner=el(`adw-banner`,{title:Q.bannerTitle,"button-label":Q.bannerButton}),this._syncBanner(),e.append(this._banner);let t=el(`adw-preferences-page`),n=el(`adw-preferences-group`,{title:Z.appearance});n.append(el(`adw-switch-row`,{title:Q.darkMode,subtitle:Q.darkModeSubtitle}),el(`adw-switch-row`,{title:Q.notifications,subtitle:Q.notificationsSubtitle,active:``}),el(`adw-combo-row`,{title:Q.accentColor,items:JSON.stringify([...Qe]),selected:`0`})),t.append(n);let r=el(`adw-preferences-group`,{title:Z.account});r.append(el(`adw-entry-row`,{title:Q.name,text:Q.nameValue}),el(`adw-entry-row`,{title:Q.email,text:Q.emailValue}),el(`adw-spin-row`,{title:Q.devices,min:String($.lower),max:String($.upper),step:String($.step),value:String($.value)}));let i=el(`adw-expander-row`,{title:Q.advanced,subtitle:Q.advancedSubtitle});i.toggleAttribute(`expanded`,!0);for(let e of Ze)i.append(e.kind===`switch`?el(`adw-switch-row`,e.active?{title:e.title,active:``}:{title:e.title}):el(`adw-action-row`,{title:e.title}));r.append(i),t.append(r);let a=el(`adw-preferences-group`,{title:Z.shortcuts});for(let e of $e){let t=el(`adw-action-row`,{title:e.title}),n=el(`adw-shortcut-label`,{accelerator:e.accelerator,slot:`suffix`});t.append(n),a.append(t)}t.append(a);let o=el(`adw-preferences-group`,{title:Z.actions}),s=document.createElement(`div`);s.style.display=`flex`,s.style.gap=`12px`,s.style.margin=`6px 0`;let c=document.createElement(`button`);c.className=`adw-button suggested-action`,c.textContent=Q.save;let l=document.createElement(`button`);l.className=`adw-button destructive-action`,l.textContent=Q.delete,s.append(c,l),o.append(s),t.append(o),e.append(t),this.addContent(e)}updateArgs(e){this._syncBanner()}_syncBanner(){this._banner?.toggleAttribute(`revealed`,this.args.revealed)}}]},nt={title:`Presentation/Avatar`,description:`A circular avatar that derives initials (and a colour) from a name, or shows a symbolic icon.`,controls:[{name:`text`,label:`Name`,type:t.TEXT,defaultValue:`Ada Lovelace`},{name:`size`,label:`Size`,type:t.RANGE,min:24,max:160,step:8,defaultValue:96},{name:`showInitials`,label:`Show initials`,type:t.BOOLEAN,defaultValue:!0},{name:`iconName`,label:`Fallback icon`,type:t.SELECT,options:[{label:`Person`,value:`avatar-default-symbolic`},{label:`Contact`,value:`contact-new-symbolic`},{label:`Camera`,value:`camera-photo-symbolic`}],defaultValue:`avatar-default-symbolic`}]},rt={stories:[class AvatarWebStory extends StoryElement{_avatar=null;constructor(){super(AvatarWebStory.getMetadata(),`Default`)}static getMetadata(){return nt}initialize(){this._avatar=document.createElement(`adw-avatar`),this._sync(),this.addContent(this._avatar)}updateArgs(e){this._sync()}_sync(){this._avatar&&(this._avatar.setAttribute(`text`,this.args.text),this._avatar.setAttribute(`size`,String(this.args.size)),this._avatar.toggleAttribute(`show-initials`,this.args.showInitials),this._avatar.setAttribute(`icon`,this.args.iconName.replace(/-symbolic$/,``)))}}]},it={title:`Presentation/Banner`,description:`Adw.Banner — a full-width strip carrying a status message and an optional action button.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Metered connection — updates paused`},{name:`buttonLabel`,label:`Button label`,type:t.TEXT,defaultValue:`Resume`},{name:`revealed`,label:`Revealed`,type:t.BOOLEAN,defaultValue:!0},{name:`useMarkup`,label:`Use markup`,type:t.BOOLEAN,defaultValue:!1}]},at={stories:[class BannerWebStory extends StoryElement{_banner=null;constructor(){super(BannerWebStory.getMetadata(),`Default`)}static getMetadata(){return it}initialize(){this._banner=document.createElement(`adw-banner`),this._sync();let e=document.createElement(`div`);e.style.cssText=`width:460px;max-width:100%;`,e.append(this._banner),this.addContent(e)}updateArgs(e){this._sync()}_sync(){this._banner&&(this._banner.setAttribute(`title`,this.args.title),this._banner.setAttribute(`button-label`,this.args.buttonLabel),this._banner.toggleAttribute(`revealed`,this.args.revealed),this._banner.toggleAttribute(`use-markup`,this.args.useMarkup))}}]},ot=[{label:`Single`,accelerator:`<Control>C`},{label:`Modifier order`,accelerator:`<Shift><Control>a`},{label:`Alternatives`,accelerator:`<Shift>A Home`},{label:`Range`,accelerator:`<Alt>1...9`},{label:`In sequence`,accelerator:`<Control>C+<Control>X`},{label:`Together`,accelerator:`Control_L&Control_R`},{label:`Nested`,accelerator:`<Alt>1...9 <Alt>0`},{label:`Unset`,accelerator:``}],st={title:`Presentation/Shortcut Label`,description:`Adw.ShortcutLabel — an accelerator drawn as keycaps. The four grammar levels: alternatives (space), a range (...), pressed in sequence (+), and pressed together (&).`,controls:[{name:`accelerator`,label:`Accelerator`,type:t.SELECT,options:[{label:`Ctrl+C`,value:`<Control>C`},{label:`Modifier order (Shift+Ctrl+A)`,value:`<Shift><Control>a`},{label:`Alternatives (Shift+A / Home)`,value:`<Shift>A Home`},{label:`Range (Alt+1…9)`,value:`<Alt>1...9`},{label:`In sequence (Ctrl+C → Ctrl+X)`,value:`<Control>C+<Control>X`},{label:`Together (Ctrl L + Ctrl R)`,value:`Control_L&Control_R`},{label:`Nested (Alt+1…9 / Alt+0)`,value:`<Alt>1...9 <Alt>0`},{label:`Glyph key (Ctrl+Space)`,value:`<Control>space`},{label:`Arrow key (Left)`,value:`Left`},{label:`Unset — shows the placeholder`,value:``}],defaultValue:`<Control>C`},{name:`disabledText`,label:`Placeholder`,type:t.TEXT,defaultValue:`Disabled`}]},ct={title:`Presentation/Shortcut Label (All Levels)`,description:`Every Adw.ShortcutLabel grammar level at once: alternatives (space), a range (...), pressed in sequence (+), pressed together (&) — plus GTK's fixed keycap order and the disabled placeholder.`,controls:[{name:`disabledText`,label:`Placeholder`,type:t.TEXT,defaultValue:`Disabled`}]},lt={stories:[class ShortcutLabelWebStory extends StoryElement{_widget=null;constructor(){super(ShortcutLabelWebStory.getMetadata(),`Default`)}static getMetadata(){return st}initialize(){this._widget=document.createElement(`adw-shortcut-label`),this._sync(),this.addContent(this._widget)}updateArgs(e){this._sync()}_sync(){this._widget&&(this._widget.setAttribute(`disabled-text`,this.args.disabledText),this._widget.setAttribute(`accelerator`,this.args.accelerator))}},class ShortcutLabelLevelsWebStory extends StoryElement{_widgets=[];constructor(){super(ShortcutLabelLevelsWebStory.getMetadata(),`Default`)}static getMetadata(){return ct}initialize(){let e=document.createElement(`div`);e.style.display=`grid`,e.style.gridTemplateColumns=`auto auto`,e.style.rowGap=`12px`,e.style.columnGap=`24px`,e.style.alignItems=`center`;for(let t of ot){let n=document.createElement(`span`);n.className=`dimmed`,n.textContent=t.label,e.append(n);let r=document.createElement(`adw-shortcut-label`);r.style.justifySelf=`end`,r.setAttribute(`disabled-text`,this.args.disabledText),r.setAttribute(`accelerator`,t.accelerator),e.append(r),this._widgets.push(r)}this.addContent(e)}updateArgs(e){for(let e of this._widgets)e.setAttribute(`disabled-text`,this.args.disabledText)}}]},ut={title:`Presentation/Spinner`,description:`Adw.Spinner — a lightweight loading indicator that spins continuously while visible.`,controls:[{name:`size`,label:`Size`,type:t.RANGE,min:16,max:64,step:4,defaultValue:48}]},dt={stories:[class SpinnerWebStory extends StoryElement{_spinner=null;constructor(){super(SpinnerWebStory.getMetadata(),`Default`)}static getMetadata(){return ut}initialize(){this._spinner=document.createElement(`adw-spinner`),this._spinner.setAttribute(`size`,String(this.args.size)),this.addContent(this._spinner)}updateArgs(e){this._spinner&&this._spinner.setAttribute(`size`,String(this.args.size))}}]},ft={title:`Presentation/Status Page`,description:`Adw.StatusPage — a full-page empty state with an icon, title, description and optional action.`,controls:[{name:`iconName`,label:`Icon`,type:t.SELECT,options:[{label:`Folder`,value:`folder-symbolic`},{label:`Mail`,value:`mail-unread-symbolic`},{label:`Search`,value:`system-search-symbolic`},{label:`Star`,value:`starred-symbolic`}],defaultValue:`folder-symbolic`},{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`No Documents`},{name:`description`,label:`Description`,type:t.TEXT,defaultValue:`Documents you create or open will appear here.`}]},pt={stories:[class StatusPageWebStory extends StoryElement{_page=null;constructor(){super(StatusPageWebStory.getMetadata(),`Default`)}static getMetadata(){return ft}initialize(){this._page=document.createElement(`adw-status-page`);let e=document.createElement(`adw-button`);e.setAttribute(`label`,`New Document`),e.setAttribute(`pill`,``),e.setAttribute(`suggested`,``),this._page.appendChild(e),this._sync(),this.addContent(this._page)}updateArgs(e){this._sync()}_sync(){this._page&&(this._page.setAttribute(`icon`,this.args.iconName.replace(/-symbolic$/,``)),this._page.setAttribute(`title`,this.args.title),this._page.setAttribute(`description`,this.args.description))}}]},mt={title:`Presentation/Window Title`,description:`Adw.WindowTitle — a compact title/subtitle widget intended for a window or header bar.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Inbox`},{name:`subtitle`,label:`Subtitle`,type:t.TEXT,defaultValue:`3 unread messages`}]},ht={stories:[class WindowTitleWebStory extends StoryElement{_windowTitle=null;constructor(){super(WindowTitleWebStory.getMetadata(),`Default`)}static getMetadata(){return mt}initialize(){this._windowTitle=document.createElement(`adw-window-title`),this._sync(),this.addContent(this._windowTitle)}updateArgs(e){this._sync()}_sync(){this._windowTitle&&(this._windowTitle.setAttribute(`title`,this.args.title),this._windowTitle.setAttribute(`subtitle`,this.args.subtitle))}}]},gt={title:`Boxed Lists/Action Row`,description:`Adw.ActionRow — a preferences row with a title/subtitle, a prefix icon and a suffix button, shown inside a boxed list.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Wi-Fi`},{name:`subtitle`,label:`Subtitle`,type:t.TEXT,defaultValue:`Connected to Highgarden 5GHz`},{name:`iconName`,label:`Prefix icon`,type:t.SELECT,options:[{label:`Network`,value:`network-wireless-symbolic`},{label:`Folder`,value:`folder-symbolic`},{label:`Starred`,value:`starred-symbolic`}],defaultValue:`network-wireless-symbolic`},{name:`activatable`,label:`Activatable`,type:t.BOOLEAN,defaultValue:!0}]};function iconClass$2(e){return`adw-icon adw-icon--${e.replace(/-symbolic$/,``)}`}__name(iconClass$2,`iconClass`);const _t={stories:[class ActionRowWebStory extends StoryElement{_row=null;_icon=null;constructor(){super(ActionRowWebStory.getMetadata(),`Default`)}static getMetadata(){return gt}initialize(){this._row=document.createElement(`adw-action-row`),this._icon=document.createElement(`span`),this._icon.setAttribute(`slot`,`prefix`),this._icon.className=iconClass$2(this.args.iconName);let e=document.createElement(`adw-button`);e.setAttribute(`slot`,`suffix`),e.setAttribute(`icon`,`go-next`),e.setAttribute(`flat`,``),this._row.append(this._icon,e),this._syncRow();let t=document.createElement(`adw-preferences-group`);t.append(this._row);let n=document.createElement(`adw-clamp`);n.setAttribute(`maximum-size`,`400`),n.append(t),this.addContent(n)}updateArgs(e){this._syncRow(),this._icon&&(this._icon.className=iconClass$2(this.args.iconName))}_syncRow(){this._row&&(this._row.setAttribute(`title`,this.args.title),this._row.setAttribute(`subtitle`,this.args.subtitle),this._row.toggleAttribute(`activatable`,this.args.activatable))}}]},vt={title:`Boxed Lists/Button Row`,description:`Adw.ButtonRow — a full-width row that acts as a button, with an optional icon and style class.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Add account`},{name:`startIconName`,label:`Start icon`,type:t.SELECT,options:[{label:`Add`,value:`list-add-symbolic`},{label:`Trash`,value:`user-trash-symbolic`},{label:`None`,value:``}],defaultValue:`list-add-symbolic`},{name:`style`,label:`Style`,type:t.SELECT,options:[{label:`None`,value:`none`},{label:`Suggested`,value:`suggested-action`},{label:`Destructive`,value:`destructive-action`}],defaultValue:`suggested-action`}]},yt=[`suggested-action`,`destructive-action`];function iconName$1(e){return e.replace(/-symbolic$/,``)}__name(iconName$1,`iconName`);const bt={stories:[class ButtonRowWebStory extends StoryElement{_row=null;constructor(){super(ButtonRowWebStory.getMetadata(),`Default`)}static getMetadata(){return vt}initialize(){this._row=document.createElement(`adw-button-row`),this._syncRow();let e=document.createElement(`adw-preferences-group`);e.append(this._row);let t=document.createElement(`adw-clamp`);t.setAttribute(`maximum-size`,`400`),t.append(e),this.addContent(t)}updateArgs(e){this._syncRow()}_syncRow(){if(!this._row)return;this._row.setAttribute(`title`,this.args.title);let e=iconName$1(this.args.startIconName);e?this._row.setAttribute(`start-icon-name`,e):this._row.removeAttribute(`start-icon-name`),this._applyStyle(this.args.style)}_applyStyle(e){if(this._row){for(let e of yt)this._row.classList.remove(e);e!==`none`&&this._row.classList.add(e)}}}]},xt=[`Blue`,`Teal`,`Green`,`Orange`,`Purple`],St={title:`Boxed Lists/Combo Row`,description:`Adw.ComboRow — a preferences row with an inline drop-down backed by a Gtk.StringList.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Accent colour`},{name:`subtitle`,label:`Subtitle`,type:t.TEXT,defaultValue:`Used to highlight selected items`},{name:`selected`,label:`Selected`,type:t.NUMBER,min:0,max:4,step:1,defaultValue:1}]},Ct={stories:[class ComboRowWebStory extends StoryElement{_row=null;constructor(){super(ComboRowWebStory.getMetadata(),`Default`)}static getMetadata(){return St}initialize(){this._row=document.createElement(`adw-combo-row`),this._row.setAttribute(`items`,JSON.stringify([...xt])),this._syncRow();let e=document.createElement(`adw-preferences-group`);e.append(this._row);let t=document.createElement(`adw-clamp`);t.setAttribute(`maximum-size`,`400`),t.append(e),this.addContent(t)}updateArgs(e){this._syncRow()}_syncRow(){this._row&&(this._row.setAttribute(`title`,this.args.title),this._row.setAttribute(`subtitle`,this.args.subtitle),this._row.setAttribute(`selected`,String(this.args.selected)))}}]},wt={title:`Boxed Lists/Entry Row`,description:`Adw.EntryRow — a preferences row whose title doubles as placeholder text for an inline entry.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Display name`},{name:`text`,label:`Text`,type:t.TEXT,defaultValue:`Ada Lovelace`},{name:`showApplyButton`,label:`Show apply button`,type:t.BOOLEAN,defaultValue:!0}]},Tt={stories:[class EntryRowWebStory extends StoryElement{_row=null;constructor(){super(EntryRowWebStory.getMetadata(),`Default`)}static getMetadata(){return wt}initialize(){this._row=document.createElement(`adw-entry-row`),this._syncRow();let e=document.createElement(`adw-preferences-group`);e.append(this._row);let t=document.createElement(`adw-clamp`);t.setAttribute(`maximum-size`,`400`),t.append(e),this.addContent(t)}updateArgs(e){this._syncRow()}_syncRow(){this._row&&(this._row.setAttribute(`title`,this.args.title),this._row.setAttribute(`text`,this.args.text),this._row.toggleAttribute(`show-apply-button`,this.args.showApplyButton))}}]},Et={title:`Boxed Lists/Expander Row`,description:`Adw.ExpanderRow — a preferences row that discloses nested rows and can carry an enable switch.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Proxy settings`},{name:`subtitle`,label:`Subtitle`,type:t.TEXT,defaultValue:`Route traffic through a custom proxy`},{name:`expanded`,label:`Expanded`,type:t.BOOLEAN,defaultValue:!0},{name:`showEnableSwitch`,label:`Show enable switch`,type:t.BOOLEAN,defaultValue:!1}]},Dt={stories:[class ExpanderRowWebStory extends StoryElement{_row=null;constructor(){super(ExpanderRowWebStory.getMetadata(),`Default`)}static getMetadata(){return Et}initialize(){this._row=document.createElement(`adw-expander-row`);let e=document.createElement(`adw-entry-row`);e.setAttribute(`title`,`Host`),e.setAttribute(`text`,`proxy.example.com`);let t=document.createElement(`adw-switch-row`);t.setAttribute(`title`,`Use authentication`),this._row.append(e,t),this._syncRow();let n=document.createElement(`adw-preferences-group`);n.append(this._row);let r=document.createElement(`adw-clamp`);r.setAttribute(`maximum-size`,`400`),r.append(n),this.addContent(r)}updateArgs(e){this._syncRow()}_syncRow(){this._row&&(this._row.setAttribute(`title`,this.args.title),this._row.setAttribute(`subtitle`,this.args.subtitle),this._row.toggleAttribute(`expanded`,this.args.expanded),this._row.toggleAttribute(`show-enable-switch`,this.args.showEnableSwitch))}}]},Ot={title:`Boxed Lists/Password Entry Row`,description:`Adw.PasswordEntryRow — an entry row that masks its contents and shows a peek toggle.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Password`},{name:`text`,label:`Text`,type:t.TEXT,defaultValue:`correct-horse-battery`}]},kt={stories:[class PasswordEntryRowWebStory extends StoryElement{_row=null;constructor(){super(PasswordEntryRowWebStory.getMetadata(),`Default`)}static getMetadata(){return Ot}initialize(){this._row=document.createElement(`adw-password-entry-row`),this._syncRow();let e=document.createElement(`adw-preferences-group`);e.append(this._row);let t=document.createElement(`adw-clamp`);t.setAttribute(`maximum-size`,`400`),t.append(e),this.addContent(t)}updateArgs(e){this._syncRow()}_syncRow(){this._row&&(this._row.setAttribute(`title`,this.args.title),this._row.setAttribute(`text`,this.args.text))}}]},At={title:`Boxed Lists/Preferences Group`,description:`Adw.PreferencesGroup — the boxed-list container that gathers a title, description, header-suffix widget and rows.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Account`},{name:`description`,label:`Description`,type:t.TEXT,defaultValue:`Manage how this device signs in and syncs.`}]},jt=[`Europe`,`Americas`,`Asia`,`Oceania`],Mt={stories:[class PreferencesGroupWebStory extends StoryElement{_group=null;constructor(){super(PreferencesGroupWebStory.getMetadata(),`Default`)}static getMetadata(){return At}initialize(){this._group=document.createElement(`adw-preferences-group`);let e=document.createElement(`button`);e.className=`adw-button flat`,e.textContent=`Sign out`,e.setAttribute(`slot`,`header-suffix`),this._group.append(e);let t=document.createElement(`adw-entry-row`);t.setAttribute(`title`,`Display name`),t.setAttribute(`text`,`Grace Hopper`),this._group.append(t);let n=document.createElement(`adw-switch-row`);n.setAttribute(`title`,`Sync over Wi-Fi only`),n.setAttribute(`subtitle`,`Avoid using mobile data for backups`),n.setAttribute(`active`,``),this._group.append(n);let r=document.createElement(`adw-combo-row`);r.setAttribute(`title`,`Region`),r.setAttribute(`items`,JSON.stringify(jt)),r.setAttribute(`selected`,`0`),this._group.append(r),this._syncGroup();let i=document.createElement(`adw-clamp`);i.setAttribute(`maximum-size`,`400`),i.append(this._group),this.addContent(i)}updateArgs(e){this._syncGroup()}_syncGroup(){this._group&&(this._group.setAttribute(`title`,this.args.title),this._group.setAttribute(`description`,this.args.description))}}]},Nt={title:`Boxed Lists/Spin Row`,description:`Adw.SpinRow — a preferences row with an inline spin button over a numeric adjustment.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Font size`},{name:`value`,label:`Value`,type:t.NUMBER,min:0,max:100,step:1,defaultValue:16},{name:`digits`,label:`Digits`,type:t.NUMBER,min:0,max:4,step:1,defaultValue:0}]},Pt={stories:[class SpinRowWebStory extends StoryElement{_row=null;constructor(){super(SpinRowWebStory.getMetadata(),`Default`)}static getMetadata(){return Nt}initialize(){this._row=document.createElement(`adw-spin-row`),this._row.setAttribute(`min`,`0`),this._row.setAttribute(`max`,`100`),this._syncRow();let e=document.createElement(`adw-preferences-group`);e.append(this._row);let t=document.createElement(`adw-clamp`);t.setAttribute(`maximum-size`,`400`),t.append(e),this.addContent(t)}updateArgs(e){this._syncRow()}_syncRow(){if(!this._row)return;this._row.setAttribute(`title`,this.args.title);let e=this.args.digits;this._row.setAttribute(`step`,String(10**-e)),this._row.setAttribute(`value`,String(this.args.value))}}]},Ft={title:`Boxed Lists/Switch Row`,description:`Adw.SwitchRow — a preferences row with a trailing switch, shown inside a boxed list.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Automatic updates`},{name:`subtitle`,label:`Subtitle`,type:t.TEXT,defaultValue:`Download and install updates without asking`},{name:`active`,label:`Active`,type:t.BOOLEAN,defaultValue:!0}]},It={stories:[class SwitchRowWebStory extends StoryElement{_row=null;constructor(){super(SwitchRowWebStory.getMetadata(),`Default`)}static getMetadata(){return Ft}initialize(){this._row=document.createElement(`adw-switch-row`),this._syncRow();let e=document.createElement(`adw-preferences-group`);e.append(this._row);let t=document.createElement(`adw-clamp`);t.setAttribute(`maximum-size`,`400`),t.append(e),this.addContent(t)}updateArgs(e){this._syncRow()}_syncRow(){this._row&&(this._row.setAttribute(`title`,this.args.title),this._row.setAttribute(`subtitle`,this.args.subtitle),this._row.toggleAttribute(`active`,this.args.active))}}]},Lt=[`Automatic`,`Always`,`Never`,`When busy`],Rt={title:`Controls/Drop Down`,description:`Gtk.DropDown — pick one value from a list. The button shows the selection; the list opens in a popover. Adw.ComboRow is the same choice presented as a boxed-list row.`,controls:[{name:`selected`,label:`Selected`,type:t.SELECT,options:Lt.map((e,t)=>({label:e,value:t})),defaultValue:0},{name:`enableSearch`,label:`Search field`,type:t.BOOLEAN,defaultValue:!1}]},zt={stories:[class DropDownWebStory extends StoryElement{_dropDown=null;constructor(){super(DropDownWebStory.getMetadata(),`Default`)}static getMetadata(){return Rt}initialize(){this._dropDown=document.createElement(`adw-drop-down`),this._dropDown.setAttribute(`options`,JSON.stringify(Lt)),this._apply(),this.addContent(this._dropDown)}updateArgs(e){this._apply()}_apply(){this._dropDown&&(this._dropDown.setAttribute(`selected`,String(this.args.selected)),this.args.enableSearch?this._dropDown.setAttribute(`enable-search`,``):this._dropDown.removeAttribute(`enable-search`))}}]},Bt={title:`Controls/Entry`,description:`Gtk.Entry — a single-line text field. Libadwaita ships no AdwEntry; the Adwaita look is the GTK entry styled by the stylesheet, which is why the row variants (Entry Row, Password Entry Row) are the widgets with an Adw prefix.`,controls:[{name:`text`,label:`Text`,type:t.TEXT,defaultValue:``},{name:`placeholder`,label:`Placeholder`,type:t.TEXT,defaultValue:`Search files…`},{name:`editable`,label:`Editable`,type:t.BOOLEAN,defaultValue:!0}]},Vt={stories:[class EntryWebStory extends StoryElement{_entry=null;constructor(){super(EntryWebStory.getMetadata(),`Default`)}static getMetadata(){return Bt}initialize(){this._entry=document.createElement(`adw-entry`),this._entry.style.minWidth=`280px`,this._apply(),this.addContent(this._entry)}updateArgs(e){this._apply()}_apply(){this._entry&&(this._entry.setAttribute(`value`,this.args.text),this._entry.setAttribute(`placeholder`,this.args.placeholder),this.args.editable?this._entry.removeAttribute(`disabled`):this._entry.setAttribute(`disabled`,``))}}]},Ht={title:`Buttons/Button Content`,description:`Adw.ButtonContent — pairs a symbolic icon with a label inside a Gtk.Button.`,controls:[{name:`label`,label:`Label`,type:t.TEXT,defaultValue:`Download`},{name:`iconName`,label:`Icon`,type:t.SELECT,options:[{label:`Download`,value:`folder-download-symbolic`},{label:`Add`,value:`list-add-symbolic`},{label:`Send`,value:`mail-send-symbolic`},{label:`Star`,value:`starred-symbolic`}],defaultValue:`folder-download-symbolic`},{name:`canShrink`,label:`Can shrink`,type:t.BOOLEAN,defaultValue:!1}]};function iconName(e){return e.replace(/-symbolic$/,``)}const Ut={stories:[class ButtonContentWebStory extends StoryElement{_content=null;constructor(){super(ButtonContentWebStory.getMetadata(),`Default`)}static getMetadata(){return Ht}initialize(){this._content=document.createElement(`adw-button-content`),this._syncContent();let e=document.createElement(`button`);e.className=`adw-button suggested-action pill`,e.append(this._content),this.addContent(e)}updateArgs(e){this._syncContent()}_syncContent(){this._content&&(this._content.setAttribute(`label`,this.args.label),this._content.setAttribute(`icon-name`,iconName(this.args.iconName)),this.args.canShrink?this._content.setAttribute(`can-shrink`,``):this._content.removeAttribute(`can-shrink`))}}]},Wt={title:`Buttons/Button Styles`,description:`Buttons with Adwaita style classes: .pill, .circular, .suggested-action, .destructive-action, .flat.`,controls:[{name:`label`,label:`Demo label`,type:t.TEXT,defaultValue:`Click me`},{name:`style`,label:`Demo style`,type:t.SELECT,options:[{label:`Pill`,value:`pill`},{label:`Circular (icon)`,value:`circular`},{label:`Suggested`,value:`suggested-action`},{label:`Destructive`,value:`destructive-action`},{label:`Flat`,value:`flat`}],defaultValue:`suggested-action`}]},Gt=[`pill`,`circular`,`suggested`,`destructive`,`flat`],Kt={pill:`pill`,circular:`circular`,"suggested-action":`suggested`,"destructive-action":`destructive`,flat:`flat`};function button(e){let t=document.createElement(`adw-button`);return e.label&&t.setAttribute(`label`,e.label),e.icon&&t.setAttribute(`icon`,e.icon),e.variant&&t.setAttribute(e.variant,``),t}const qt={stories:[class ButtonStylesWebStory extends StoryElement{_demo=null;constructor(){super(ButtonStylesWebStory.getMetadata(),`Default`)}static getMetadata(){return Wt}initialize(){let e=document.createElement(`div`);e.style.cssText=`display:flex;flex-wrap:wrap;gap:12px;justify-content:center;align-items:center;`,e.append(button({label:`Pill`,variant:`pill`}),button({icon:`list-add`,variant:`circular`}),button({label:`Suggested`,variant:`suggested`}),button({label:`Delete`,variant:`destructive`}),button({label:`Flat`,variant:`flat`})),this._demo=button({label:this.args.label}),this._applyStyle(this.args.style),e.append(this._demo),this.addContent(e)}updateArgs(e){this._demo&&this._applyStyle(this.args.style)}_applyStyle(e){if(!this._demo)return;for(let e of Gt)this._demo.removeAttribute(e);let t=Kt[e];t&&this._demo.setAttribute(t,``),t===`circular`?(this._demo.setAttribute(`icon`,`list-add`),this._demo.removeAttribute(`label`)):(this._demo.removeAttribute(`icon`),this._demo.setAttribute(`label`,this.args.label))}}]},Jt=[`Save as…`,`Export`,`Print`],Yt={title:`Buttons/Menu Button`,description:`Gtk.MenuButton — a button whose only action is to open a menu. Where a Split Button has a primary action beside its arrow, this one has none: every choice lives in the popover.`,controls:[{name:`iconName`,label:`Icon`,type:t.SELECT,options:[{label:`Hamburger`,value:`open-menu-symbolic`},{label:`More`,value:`view-more-symbolic`},{label:`Open`,value:`document-open-symbolic`}],defaultValue:`open-menu-symbolic`},{name:`menuTitle`,label:`Menu title`,type:t.TEXT,defaultValue:`Document`}]},Xt={stories:[class MenuButtonWebStory extends StoryElement{_widget=null;constructor(){super(MenuButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return Yt}initialize(){this._widget=document.createElement(`adw-menu-button`),this._widget.setAttribute(`menu`,JSON.stringify(Jt.map(e=>({label:e})))),this._apply(),this.addContent(this._widget)}updateArgs(e){this._apply()}_apply(){this._widget&&(this._widget.setAttribute(`icon-name`,this.args.iconName.replace(/-symbolic$/,``)),this._widget.setAttribute(`menu-title`,this.args.menuTitle))}}]},Zt={title:`Buttons/Split Button`,description:`Adw.SplitButton — a primary action button paired with a dropdown menu of related actions.`,controls:[{name:`label`,label:`Label`,type:t.TEXT,defaultValue:`Save`},{name:`iconName`,label:`Icon`,type:t.SELECT,options:[{label:`None`,value:``},{label:`Save`,value:`document-save-symbolic`},{label:`Send`,value:`mail-send-symbolic`},{label:`Add`,value:`list-add-symbolic`}],defaultValue:`document-save-symbolic`}]},Qt={title:`Buttons/Split Button Flat`,description:`Adw.SplitButton with the .flat style class, as used inside header bars and toolbars.`,controls:[{name:`label`,label:`Label`,type:t.TEXT,defaultValue:`Reply`},{name:`iconName`,label:`Icon`,type:t.SELECT,options:[{label:`None`,value:``},{label:`Reply`,value:`mail-reply-sender-symbolic`},{label:`Edit`,value:`document-edit-symbolic`},{label:`Open`,value:`document-open-symbolic`}],defaultValue:`mail-reply-sender-symbolic`}]},$t=JSON.stringify([{label:`Save as…`,action:`app.save-as`},{label:`Export`,action:`app.export`},{label:`Print`,action:`app.print`}]);function iconBaseName(e){return e.replace(/-symbolic$/,``)}function splitButton(e,t={}){let n=document.createElement(`adw-split-button`);n.setAttribute(`menu`,$t),n.setAttribute(`label`,e.label);let r=e.iconName;return r&&n.setAttribute(`icon-name`,iconBaseName(r)),t.flat&&n.setAttribute(`flat`,``),n}var SplitButtonWebStoryBase=class extends StoryElement{_widget=null;initialize(){this._widget=splitButton(this.args,{flat:this.flat}),this.addContent(this._widget)}updateArgs(e){if(!this._widget)return;let t=this.args.iconName;t?(this._widget.setAttribute(`icon-name`,iconBaseName(t)),this._widget.removeAttribute(`label`)):(this._widget.removeAttribute(`icon-name`),this._widget.setAttribute(`label`,this.args.label))}};const en={stories:[class SplitButtonWebStory extends SplitButtonWebStoryBase{get flat(){return!1}constructor(){super(SplitButtonWebStory.getMetadata(),`Default`)}static getMetadata(){return Zt}},class SplitButtonFlatWebStory extends SplitButtonWebStoryBase{get flat(){return!0}constructor(){super(SplitButtonFlatWebStory.getMetadata(),`Default`)}static getMetadata(){return Qt}}]},tn={title:`Buttons/Toggle Group`,description:`Adw.ToggleGroup — a linked group of Adw.Toggle buttons where exactly one is active.`,controls:[{name:`active`,label:`Active toggle`,type:t.SELECT,options:[{label:`List`,value:0},{label:`Grid`,value:1},{label:`Columns`,value:2}],defaultValue:0},{name:`style`,label:`Style`,type:t.SELECT,options:[{label:`Default`,value:`default`},{label:`Flat`,value:`flat`},{label:`Round`,value:`round`}],defaultValue:`default`}]},nn=[`flat`,`round`],rn=[{label:`List`,icon:`view-list`},{label:`Grid`,icon:`view-grid`},{label:`Columns`,icon:`view-columns`}],an={stories:[class ToggleGroupWebStory extends StoryElement{_group=null;constructor(){super(ToggleGroupWebStory.getMetadata(),`Default`)}static getMetadata(){return tn}initialize(){let e=document.createElement(`adw-toggle-group`);for(let{label:t,icon:n}of rn){let r=document.createElement(`adw-toggle`);r.setAttribute(`label`,t),r.setAttribute(`icon-name`,n),e.appendChild(r)}e.setAttribute(`active`,String(this.args.active)),this._group=e,this._applyStyle(this.args.style),this.addContent(e)}updateArgs(e){this._group&&(this._group.setAttribute(`active`,String(this.args.active)),this._applyStyle(this.args.style))}_applyStyle(e){if(this._group){for(let e of nn)this._group.classList.remove(e);e!=="default"&&this._group.classList.add(e)}}}]},on={title:`Layout/Clamp`,description:`Adw.Clamp limits its child to a maximum width and centres it, tightening the layout as space shrinks.`,controls:[{name:`maximumSize`,label:`Maximum size`,type:t.RANGE,min:200,max:600,step:10,defaultValue:400},{name:`tighteningThreshold`,label:`Tightening threshold`,type:t.RANGE,min:100,max:600,step:10,defaultValue:300}]},sn={stories:[class ClampWebStory extends StoryElement{_clamp=null;constructor(){super(ClampWebStory.getMetadata(),`Default`)}static getMetadata(){return on}initialize(){let e=document.createElement(`adw-card`);e.style.width=`100%`,e.style.boxSizing=`border-box`,e.style.padding=`18px`,e.textContent=`This content is clamped — it stops growing past the maximum size and stays centred.`,this._clamp=document.createElement(`adw-clamp`),this._clamp.append(e),this._syncClamp(),this.addContent(this._clamp)}updateArgs(e){this._syncClamp()}_syncClamp(){this._clamp&&(this._clamp.setAttribute(`maximum-size`,String(this.args.maximumSize)),this._clamp.setAttribute(`tightening-threshold`,String(this.args.tighteningThreshold)))}}]},cn={title:`Layout/Header Bar`,description:`Adw.HeaderBar hosts a custom title widget with start and end controls — the standard top chrome of an Adwaita window.`,controls:[{name:`title`,label:`Title`,type:t.TEXT,defaultValue:`Text Editor`},{name:`subtitle`,label:`Subtitle`,type:t.TEXT,defaultValue:`notes.md`},{name:`showTitle`,label:`Show title`,type:t.BOOLEAN,defaultValue:!0}]},ln={stories:[class HeaderBarWebStory extends StoryElement{_headerBar=null;_title=null;constructor(){super(HeaderBarWebStory.getMetadata(),`Default`)}static getMetadata(){return cn}initialize(){this._title=document.createElement(`adw-window-title`),this._title.setAttribute(`slot`,`center`);let e=document.createElement(`adw-button`);e.setAttribute(`slot`,`start`),e.setAttribute(`icon`,`go-previous`),e.setAttribute(`flat`,``);let t=document.createElement(`adw-button`);t.setAttribute(`slot`,`end`),t.setAttribute(`icon`,`open-menu`),t.setAttribute(`flat`,``),this._headerBar=document.createElement(`adw-header-bar`),this._headerBar.style.width=`460px`,this._headerBar.append(e,this._title,t),this._sync(),this.addContent(this._headerBar)}updateArgs(e){this._sync()}_sync(){this._title&&(this._title.setAttribute(`title`,this.args.title),this._title.setAttribute(`subtitle`,this.args.subtitle),this._title.hidden=!this.args.showTitle)}}]},un={title:`Layout/Toolbar View`,description:`Adw.ToolbarView pins a top header bar and a bottom toolbar around its content, each independently revealable.`,controls:[{name:`revealTopBars`,label:`Reveal top bars`,type:t.BOOLEAN,defaultValue:!0},{name:`revealBottomBars`,label:`Reveal bottom bars`,type:t.BOOLEAN,defaultValue:!0}]},dn={stories:[class ToolbarViewWebStory extends StoryElement{_topBar=null;_bottomBar=null;constructor(){super(ToolbarViewWebStory.getMetadata(),`Default`)}static getMetadata(){return un}initialize(){let e=document.createElement(`adw-toolbar-view`);e.style.width=`460px`,e.style.height=`320px`;let t=document.createElement(`adw-header-bar`);t.setAttribute(`slot`,`top`);let n=document.createElement(`adw-window-title`);n.setAttribute(`slot`,`center`),n.setAttribute(`title`,`Documents`),n.setAttribute(`subtitle`,`12 items`),t.appendChild(n),e.appendChild(t),this._topBar=t;let r=document.createElement(`adw-status-page`);r.setAttribute(`icon`,`folder-documents`),r.setAttribute(`title`,`Your library`),r.setAttribute(`description`,`Content sits between the toolbars and scrolls independently of them.`),e.appendChild(r);let i=document.createElement(`div`);i.setAttribute(`slot`,`bottom`),i.className=`adw-action-bar`,i.style.display=`flex`,i.style.alignItems=`center`,i.style.gap=`var(--spacing-xs, 6px)`,i.style.padding=`var(--spacing-xs, 6px)`,i.style.borderTop=`1px solid var(--separator-color, rgba(0, 0, 0, 0.15))`;let a=document.createElement(`adw-button`);a.setAttribute(`icon`,`list-add`),a.setAttribute(`flat`,``),a.setAttribute(`tooltip`,`Add`);let o=document.createElement(`adw-button`);o.setAttribute(`icon`,`list-remove`),o.setAttribute(`flat`,``),o.setAttribute(`tooltip`,`Remove`);let s=document.createElement(`span`);s.textContent=`Selection: none`,s.style.flex=`1 1 auto`,s.style.textAlign=`center`;let c=document.createElement(`adw-button`);c.setAttribute(`icon`,`send-to`),c.setAttribute(`flat`,``),c.setAttribute(`tooltip`,`Share`),i.append(a,o,s,c),e.appendChild(i),this._bottomBar=i,this._sync(),this.addContent(e)}updateArgs(e){this._sync()}_sync(){this._topBar&&(this._topBar.hidden=!this.args.revealTopBars),this._bottomBar&&(this._bottomBar.hidden=!this.args.revealBottomBars)}}]},fn={title:`Layout/Wrap Box`,description:`Adw.WrapBox flows its children horizontally and wraps them onto new lines when they run out of room.`,controls:[{name:`childSpacing`,label:`Child spacing`,type:t.RANGE,min:0,max:36,step:1,defaultValue:8},{name:`lineSpacing`,label:`Line spacing`,type:t.RANGE,min:0,max:36,step:1,defaultValue:8}]},pn=[`Design`,`Adwaita`,`GNOME`,`GTK`,`Typescript`,`Storybook`,`Wrapping`,`Layout`],mn={stories:[class WrapBoxWebStory extends StoryElement{_wrap=null;constructor(){super(WrapBoxWebStory.getMetadata(),`Default`)}static getMetadata(){return fn}initialize(){this._wrap=document.createElement(`adw-wrap-box`),this._wrap.style.width=`460px`;for(let e of pn){let t=document.createElement(`adw-button`);t.setAttribute(`label`,e),t.setAttribute(`pill`,``),this._wrap.append(t)}this._syncWrap(),this.addContent(this._wrap)}updateArgs(e){this._syncWrap()}_syncWrap(){this._wrap&&(this._wrap.setAttribute(`child-spacing`,String(this.args.childSpacing)),this._wrap.setAttribute(`line-spacing`,String(this.args.lineSpacing)))}}]},hn=[{name:`allowScrollWheel`,label:`Allow scroll wheel`,type:t.BOOLEAN,defaultValue:!0},{name:`allowLongSwipes`,label:`Allow long swipes`,type:t.BOOLEAN,defaultValue:!1}],gn={title:`View Switching/Carousel (Dots)`,description:`Adw.Carousel — a horizontally swipeable pager with three pages, paired with Adw.CarouselIndicatorDots.`,controls:hn},_n={title:`View Switching/Carousel (Lines)`,description:`Adw.Carousel — the same swipeable pager paired with Adw.CarouselIndicatorLines instead of dots.`,controls:hn},vn=[{title:`Welcome`,accent:`color-mix(in srgb, var(--accent-bg-color) 14%, var(--window-bg-color))`},{title:`Discover`,accent:`color-mix(in srgb, #2ec27e 14%, var(--window-bg-color))`},{title:`Get started`,accent:`color-mix(in srgb, #e5a50a 14%, var(--window-bg-color))`}];let yn=0;function buildPage(e,t){let n=document.createElement(`adw-card`);n.style.cssText=[`width:440px`,`height:260px`,`display:flex`,`align-items:center`,`justify-content:center`,`background-color:${t}`,`color:#ffffff`,`box-sizing:border-box`].join(`;`);let r=document.createElement(`span`);return r.textContent=e,r.style.cssText=`font-size:24pt;font-weight:800;`,n.appendChild(r),n}function syncCarouselArgs(e,t){e.setAttribute(`allow-scroll-wheel`,t.allowScrollWheel?`true`:`false`),e.setAttribute(`allow-long-swipes`,t.allowLongSwipes?`true`:`false`)}var CarouselWebStoryBase=class extends StoryElement{_carousel=null;initialize(){let e=document.createElement(`adw-carousel`);e.id=`adw-carousel-${yn++}`,e.style.cssText=`width:480px;height:280px;`,syncCarouselArgs(e,this.args);for(let t of vn)e.appendChild(buildPage(t.title,t.accent));this._carousel=e;let t=document.createElement(this.indicatorTag());t.setAttribute(`for`,e.id);let n=document.createElement(`div`);n.style.cssText=`display:flex;flex-direction:column;gap:12px;width:480px;align-items:center;`,n.append(e,t),this.addContent(n)}updateArgs(e){this._carousel&&syncCarouselArgs(this._carousel,this.args)}};const bn={stories:[class CarouselDotsWebStory extends CarouselWebStoryBase{constructor(){super(CarouselDotsWebStory.getMetadata(),`Default`)}static getMetadata(){return gn}indicatorTag(){return`adw-carousel-indicator-dots`}},class CarouselLinesWebStory extends CarouselWebStoryBase{constructor(){super(CarouselLinesWebStory.getMetadata(),`Default`)}static getMetadata(){return _n}indicatorTag(){return`adw-carousel-indicator-lines`}}]},xn={title:`View Switching/Inline View Switcher`,description:`Adw.InlineViewSwitcher — a compact inline switcher that can show labels, icons, or both for an Adw.ViewStack.`,controls:[{name:`displayMode`,label:`Display mode`,type:t.SELECT,options:[{label:`Labels`,value:`labels`},{label:`Icons`,value:`icons`},{label:`Both`,value:`both`}],defaultValue:`both`}]},Sn=[{id:`overview`,title:`Overview`,icon:`view-grid`,body:`A quick summary of your project.`},{id:`activity`,title:`Activity`,icon:`document-edit`,body:`Recent edits and changes.`},{id:`settings`,title:`Settings`,icon:`emblem-system`,body:`Configure how things behave.`}],Cn={stories:[class InlineViewSwitcherWebStory extends StoryElement{_switcher=null;constructor(){super(InlineViewSwitcherWebStory.getMetadata(),`Default`)}static getMetadata(){return xn}initialize(){let e=document.createElement(`adw-inline-view-switcher`);for(let{id:t,title:n,icon:r,body:i}of Sn){let a=document.createElement(`adw-view-stack-page`);a.setAttribute(`title`,n),a.setAttribute(`icon-name`,r);let o=document.createElement(`adw-status-page`);o.id=t,o.setAttribute(`icon`,r),o.setAttribute(`title`,n),o.setAttribute(`description`,i),a.appendChild(o),e.appendChild(a)}e.setAttribute(`display-mode`,this.args.displayMode),this._switcher=e,this.addContent(e)}updateArgs(e){this._switcher&&this._switcher.setAttribute(`display-mode`,this.args.displayMode)}}]},wn={title:`View Switching/Tab View`,description:`Adw.TabView with an Adw.TabBar header — three tabbed pages; the tab bar can auto-hide when only one tab remains.`,controls:[{name:`autohide`,label:`Autohide tab bar`,type:t.BOOLEAN,defaultValue:!1}]},Tn=[{title:`Overview`,body:`A summary of everything at a glance.`},{title:`Details`,body:`The specifics, broken down line by line.`},{title:`History`,body:`A log of every change made so far.`}],En={stories:[class TabViewWebStory extends StoryElement{_tabView=null;constructor(){super(TabViewWebStory.getMetadata(),`Default`)}static getMetadata(){return wn}initialize(){let e=document.createElement(`adw-tab-view`);e.style.width=`480px`,e.style.height=`340px`;for(let t of Tn){let n=document.createElement(`adw-tab-page`);n.setAttribute(`title`,t.title),n.appendChild(this._buildPageBody(t.title,t.body)),e.appendChild(n)}this._tabView=e,this._applyAutohide(this.args.autohide),this.addContent(e)}updateArgs(e){this._tabView&&this._applyAutohide(this.args.autohide)}_buildPageBody(e,t){let n=document.createElement(`adw-status-page`);return n.setAttribute(`icon`,`view-paged`),n.setAttribute(`title`,e),n.setAttribute(`description`,t),n}_applyAutohide(e){this._tabView&&(e?this._tabView.setAttribute(`autohide`,``):this._tabView.removeAttribute(`autohide`))}}]},Dn={title:`View Switching/View Switcher`,description:`Adw.ViewSwitcher — a segmented switcher whose buttons select pages in a paired Adw.ViewStack.`,controls:[{name:`policy`,label:`Policy`,type:t.SELECT,options:[{label:`Wide`,value:`wide`},{label:`Narrow`,value:`narrow`}],defaultValue:`wide`}]},On=[{name:`inbox`,title:`Inbox`,icon:`mail-unread`,description:`You have three unread conversations.`},{name:`starred`,title:`Starred`,icon:`starred`,description:`Messages you have marked as important.`},{name:`archive`,title:`Archive`,icon:`folder`,description:`Older conversations kept for reference.`}],kn={stories:[class ViewSwitcherWebStory extends StoryElement{_switcher=null;constructor(){super(ViewSwitcherWebStory.getMetadata(),`Default`)}static getMetadata(){return Dn}initialize(){let e=document.createElement(`adw-view-switcher`);for(let{name:t,title:n,icon:r,description:i}of On){let a=document.createElement(`adw-view-switcher-page`);a.setAttribute(`name`,t),a.setAttribute(`title`,n),a.setAttribute(`icon-name`,r);let o=document.createElement(`adw-status-page`);o.setAttribute(`icon`,r),o.setAttribute(`title`,n),o.setAttribute(`description`,i),a.appendChild(o),e.appendChild(a)}e.setAttribute(`policy`,this.args.policy),e.style.width=`480px`,this._switcher=e,this.addContent(e)}updateArgs(e){this._switcher&&this._switcher.setAttribute(`policy`,this.args.policy)}}]},An=[{name:`inbox`,title:`Inbox`,icon:`mail-unread-symbolic`},{name:`starred`,title:`Starred`,icon:`starred-symbolic`},{name:`archive`,title:`Archive`,icon:`folder-symbolic`}],jn={title:`View Switching/View Switcher Bar`,description:"Adw.ViewSwitcherBar — the narrow-window switcher, pinned to the bottom of a toolbar view. `reveal` is a REQUEST, not a state: a stack with fewer than two pages stays collapsed however loudly it is asked.",controls:[{name:`reveal`,label:`Reveal`,type:t.BOOLEAN,defaultValue:!0}]},Mn={stories:[class ViewSwitcherBarWebStory extends StoryElement{_bar=null;constructor(){super(ViewSwitcherBarWebStory.getMetadata(),`Default`)}static getMetadata(){return jn}initialize(){let e=document.createElement(`adw-view-stack`);e.style.flex=`1`;for(let t of An){let n=document.createElement(`adw-status-page`);n.setAttribute(`icon`,t.icon.replace(/-symbolic$/,``)),n.setAttribute(`title`,t.title),n.setAttribute(`description`,`The ${t.title.toLowerCase()} page.`);let r=document.createElement(`adw-view-stack-page`);r.setAttribute(`name`,t.name),r.setAttribute(`title`,t.title),r.setAttribute(`icon-name`,t.icon.replace(/-symbolic$/,``)),r.appendChild(n),e.appendChild(r)}let t=document.createElement(`adw-view-switcher-bar`);t.setAttribute(`slot`,`bottom`);let n=document.createElement(`adw-toolbar-view`);n.style.width=`360px`,n.style.height=`360px`,n.append(e,t),this.addContent(n),t.setStack(e),this._bar=t,this._apply()}updateArgs(e){this._apply()}_apply(){this._bar&&(this._bar.reveal=this.args.reveal)}}]},Nn={title:`Navigation/Bottom Sheet`,description:`Adw.BottomSheet — a sheet that slides up over the content. Toggle "Open" to reveal it.`,controls:[{name:`open`,label:`Open`,type:t.BOOLEAN,defaultValue:!0},{name:`modal`,label:`Modal`,type:t.BOOLEAN,defaultValue:!0},{name:`canClose`,label:`Can close`,type:t.BOOLEAN,defaultValue:!0}]};function iconClass$1(e){return`adw-icon adw-icon--${e.replace(/-symbolic$/,``)}`}__name(iconClass$1,`iconClass`);const Pn={stories:[class BottomSheetWebStory extends StoryElement{_sheet=null;constructor(){super(BottomSheetWebStory.getMetadata(),`Default`)}static getMetadata(){return Nn}_buildContent(){let e=document.createElement(`adw-bottom-sheet-content`),t=document.createElement(`div`);t.style.display=`flex`,t.style.alignItems=`center`,t.style.justifyContent=`center`,t.style.width=`100%`,t.style.height=`100%`;let n=document.createElement(`adw-button`);return n.textContent=`Toggle sheet`,n.setAttribute(`pill`,``),n.setAttribute(`suggested`,``),n.addEventListener(`click`,()=>{this._sheet&&this._sheet.toggleAttribute(`open`)}),t.append(n),e.append(t),e}_buildSheet(){let e=document.createElement(`adw-bottom-sheet-sheet`),t=document.createElement(`div`);t.style.display=`flex`,t.style.flexDirection=`column`,t.style.gap=`12px`,t.style.margin=`18px 18px 24px`;let n=document.createElement(`span`);n.textContent=`Share track`,n.style.fontSize=`15pt`,n.style.fontWeight=`800`,t.append(n);let r=document.createElement(`adw-preferences-group`);for(let[e,t]of[[`Copy link`,`edit-copy-symbolic`],[`Send to a friend`,`mail-send-symbolic`],[`Add to playlist`,`list-add-symbolic`]]){let n=document.createElement(`adw-action-row`);n.setAttribute(`title`,e),n.setAttribute(`activatable`,``);let i=document.createElement(`span`);i.setAttribute(`slot`,`prefix`),i.className=iconClass$1(t),n.append(i),r.append(n)}return t.append(r),e.append(t),e}initialize(){this._sheet=document.createElement(`adw-bottom-sheet`),this._sheet.style.width=`480px`,this._sheet.style.height=`340px`,this._sheet.append(this._buildContent(),this._buildSheet()),this._sync(),this.addContent(this._sheet)}updateArgs(e){this._sync()}_sync(){this._sheet&&(this._sheet.toggleAttribute(`open`,this.args.open),this._setBool(`modal`,this.args.modal),this._setBool(`can-close`,this.args.canClose))}_setBool(e,t){this._sheet&&(t?this._sheet.setAttribute(e,``):this._sheet.setAttribute(e,`false`))}}]},Fn={title:`Navigation/Navigation Split View`,description:`Adw.NavigationSplitView — a resizable sidebar beside a content pane. When collapsed it folds into a navigation stack.`,controls:[{name:`showContent`,label:`Show content`,type:t.BOOLEAN,defaultValue:!0},{name:`collapsed`,label:`Collapsed`,type:t.BOOLEAN,defaultValue:!1}]};function iconClass(e){return`adw-icon adw-icon--${e.replace(/-symbolic$/,``)}`}const In={stories:[class NavigationSplitViewWebStory extends StoryElement{_view=null;constructor(){super(NavigationSplitViewWebStory.getMetadata(),`Default`)}static getMetadata(){return Fn}buildSidebar(){let e=document.createElement(`adw-preferences-group`);for(let[t,n,r]of[[`All Mail`,`128 messages`,`mail-unread-symbolic`],[`Starred`,`6 messages`,`starred-symbolic`],[`Drafts`,`2 messages`,`document-edit-symbolic`],[`Archive`,`512 messages`,`folder-symbolic`]]){let i=document.createElement(`adw-action-row`);i.setAttribute(`title`,t),i.setAttribute(`subtitle`,n),i.setAttribute(`activatable`,``);let a=document.createElement(`span`);a.setAttribute(`slot`,`prefix`),a.className=iconClass(r),i.appendChild(a),e.appendChild(i)}let t=document.createElement(`adw-header-bar`);t.setAttribute(`slot`,`top`);let n=document.createElement(`adw-window-title`);n.setAttribute(`slot`,`center`),n.setAttribute(`title`,`Mailboxes`),t.appendChild(n);let r=document.createElement(`adw-toolbar-view`);return r.setAttribute(`slot`,`sidebar`),r.append(t,e),r}buildContent(){let e=document.createElement(`adw-status-page`);e.setAttribute(`icon`,`mail-unread-symbolic`),e.setAttribute(`title`,`All Mail`),e.setAttribute(`description`,`Select a conversation from the list to read it here.`);let t=document.createElement(`adw-header-bar`);t.setAttribute(`slot`,`top`);let n=document.createElement(`adw-window-title`);n.setAttribute(`slot`,`center`),n.setAttribute(`title`,`All Mail`),t.appendChild(n);let r=document.createElement(`adw-toolbar-view`);return r.setAttribute(`slot`,`content`),r.append(t,e),r}initialize(){this._view=document.createElement(`adw-navigation-split-view`),this._view.style.width=`480px`,this._view.style.height=`340px`,this._view.append(this.buildSidebar(),this.buildContent()),this._sync(),this.addContent(this._view)}updateArgs(e){this._sync()}_sync(){this._view&&(this._view.toggleAttribute(`show-content`,this.args.showContent),this._view.toggleAttribute(`collapsed`,this.args.collapsed))}}]},Ln={title:`Navigation/Navigation View`,description:`Adw.NavigationView — a navigation stack. The root page pushes a detail page, which gets an automatic back button.`,controls:[{name:`rootTitle`,label:`Root title`,type:t.TEXT,defaultValue:`Contacts`},{name:`detailTitle`,label:`Detail title`,type:t.TEXT,defaultValue:`Ada Lovelace`},{name:`animateTransitions`,label:`Animate transitions`,type:t.BOOLEAN,defaultValue:!0}]},Rn={stories:[class NavigationViewWebStory extends StoryElement{_view=null;_rootTitle=null;_detailPage=null;_detailTitle=null;_detailStatus=null;constructor(){super(NavigationViewWebStory.getMetadata(),`Default`)}static getMetadata(){return Ln}initialize(){this._view=document.createElement(`adw-navigation-view`),this._view.style.width=`480px`,this._view.style.height=`340px`,this._view.setAttribute(`animate-transitions`,this.args.animateTransitions?`true`:`false`),this._detailTitle=document.createElement(`adw-window-title`),this._detailTitle.setAttribute(`title`,this.args.detailTitle),this._detailTitle.setAttribute(`slot`,`center`),this._detailStatus=document.createElement(`adw-status-page`),this._detailStatus.setAttribute(`icon`,`avatar-default`),this._detailStatus.setAttribute(`title`,this.args.detailTitle),this._detailStatus.setAttribute(`description`,`Mathematician and writer, the first computer programmer.`);let e=document.createElement(`adw-header-bar`);e.setAttribute(`slot`,`top`),e.appendChild(this._detailTitle);let t=document.createElement(`adw-toolbar-view`);t.append(e,this._detailStatus),this._detailPage=document.createElement(`adw-navigation-page`),this._detailPage.setAttribute(`tag`,`detail`),this._detailPage.setAttribute(`title`,this.args.detailTitle),this._detailPage.appendChild(t),this._rootTitle=document.createElement(`adw-window-title`),this._rootTitle.setAttribute(`title`,this.args.rootTitle),this._rootTitle.setAttribute(`slot`,`center`);let n=document.createElement(`adw-button`);n.setAttribute(`label`,`Open contact`),n.setAttribute(`pill`,``),n.setAttribute(`suggested`,``),n.addEventListener(`click`,()=>{this._view?.push(`detail`)});let r=document.createElement(`div`);r.style.cssText=`display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;`,r.appendChild(n);let i=document.createElement(`adw-header-bar`);i.setAttribute(`slot`,`top`),i.appendChild(this._rootTitle);let a=document.createElement(`adw-toolbar-view`);a.append(i,r);let o=document.createElement(`adw-navigation-page`);o.setAttribute(`tag`,`root`),o.setAttribute(`title`,this.args.rootTitle),o.appendChild(a),this._view.append(o,this._detailPage),this.addContent(this._view)}updateArgs(e){if(!this._view)return;this._view.setAttribute(`animate-transitions`,this.args.animateTransitions?`true`:`false`),this._rootTitle?.setAttribute(`title`,this.args.rootTitle);let t=this.args.detailTitle;this._detailTitle?.setAttribute(`title`,t),this._detailStatus?.setAttribute(`title`,t),this._detailPage?.setAttribute(`title`,t)}}]},zn={title:`Navigation/Overlay Split View`,description:`Adw.OverlaySplitView — a sidebar shown beside the content, or overlaid on top of it when collapsed.`,controls:[{name:`showSidebar`,label:`Show sidebar`,type:t.BOOLEAN,defaultValue:!0},{name:`collapsed`,label:`Collapsed`,type:t.BOOLEAN,defaultValue:!1}]},Bn=[[`Home`,`go-home`],[`Discover`,`system-search`],[`Library`,`folder-music`],[`Settings`,`emblem-system`]],Vn={stories:[class OverlaySplitViewWebStory extends StoryElement{_view=null;constructor(){super(OverlaySplitViewWebStory.getMetadata(),`Default`)}static getMetadata(){return zn}buildSidebar(){let e=document.createElement(`adw-preferences-group`);for(let[t,n]of Bn){let r=document.createElement(`adw-action-row`);r.setAttribute(`title`,t),r.setAttribute(`activatable`,``);let i=document.createElement(`span`);i.setAttribute(`slot`,`prefix`),i.className=`adw-icon adw-icon--${n}`,r.appendChild(i),e.appendChild(r)}let t=document.createElement(`adw-toolbar-view`);t.classList.add(`sidebar`);let n=document.createElement(`adw-header-bar`);return n.setAttribute(`slot`,`top`),t.appendChild(n),t.appendChild(e),t}buildContent(){let e=document.createElement(`adw-status-page`);e.setAttribute(`icon`,`folder-music`),e.setAttribute(`title`,`Your Library`),e.setAttribute(`description`,`Toggle the sidebar to browse sections. Collapse it to overlay the content.`);let t=document.createElement(`adw-toolbar-view`),n=document.createElement(`adw-header-bar`);return n.setAttribute(`slot`,`top`),t.appendChild(n),t.appendChild(e),t}initialize(){this._view=document.createElement(`adw-overlay-split-view`),this._view.style.width=`480px`,this._view.style.height=`340px`;let e=this.buildSidebar();e.setAttribute(`slot`,`sidebar`);let t=this.buildContent();t.setAttribute(`slot`,`content`),this._view.append(e,t),this._sync(),this.addContent(this._view)}updateArgs(e){this._sync()}_sync(){this._view&&(this._view.toggleAttribute(`show-sidebar`,this.args.showSidebar),this._view.toggleAttribute(`collapsed`,this.args.collapsed))}}]},Hn={title:`Navigation/Sidebar`,description:`Adw.Sidebar — a selectable list of Adw.SidebarItem grouped into sections. Selecting an item updates the content.`,controls:[{name:`mode`,label:`Mode`,type:t.SELECT,options:[{label:`Sidebar`,value:`sidebar`},{label:`Page`,value:`page`}],defaultValue:`sidebar`},{name:`selected`,label:`Selected index`,type:t.NUMBER,min:0,max:3,step:1,defaultValue:0}]},Un={stories:[class SidebarWebStory extends StoryElement{_sidebar=null;_status=null;items=[{title:`Inbox`,subtitle:`3 unread`,icon:`mail-unread-symbolic`},{title:`Starred`,subtitle:`Favourites`,icon:`starred-symbolic`},{title:`Sent`,subtitle:`Outgoing mail`,icon:`mail-send-symbolic`},{title:`Archive`,subtitle:`Older mail`,icon:`folder-symbolic`}];constructor(){super(SidebarWebStory.getMetadata(),`Default`)}static getMetadata(){return Hn}initialize(){let e=document.createElement(`adw-sidebar-section`);e.setAttribute(`title`,`Mailboxes`);for(let t of this.items){let n=document.createElement(`adw-sidebar-item`);n.setAttribute(`title`,t.title),n.setAttribute(`subtitle`,t.subtitle),n.setAttribute(`icon-name`,t.icon),e.append(n)}this._sidebar=document.createElement(`adw-sidebar`),this._sidebar.setAttribute(`mode`,this.args.mode),this._sidebar.setAttribute(`selected`,String(this.args.selected)),this._sidebar.style.width=`220px`,this._sidebar.append(e),this._sidebar.addEventListener(`notify::selected`,()=>this._syncContent()),this._status=document.createElement(`adw-status-page`),this._status.style.flex=`1 1 auto`;let t=document.createElement(`div`);t.style.display=`flex`,t.style.width=`480px`,t.style.height=`340px`,t.style.border=`1px solid var(--card-shade-color)`,t.style.borderRadius=`var(--card-radius, 12px)`,t.style.overflow=`hidden`;let n=document.createElement(`div`);n.style.width=`1px`,n.style.alignSelf=`stretch`,n.style.backgroundColor=`var(--separator-color, var(--card-shade-color))`,t.append(this._sidebar,n,this._status),this._syncContent(),this.addContent(t)}updateArgs(e){this._sidebar&&(this._sidebar.setAttribute(`mode`,this.args.mode),this._sidebar.setAttribute(`selected`,String(this.args.selected)),this._syncContent())}_syncContent(){if(!this._sidebar||!this._status)return;let e=Number(this._sidebar.selected),t=this.items[e]??this.items[0];this._status.setAttribute(`title`,t.title),this._status.setAttribute(`icon`,t.icon.replace(/-symbolic$/,``)),this._status.setAttribute(`description`,t.subtitle)}}]},Wn={title:`Feedback/About Dialog`,description:`Adw.AboutDialog — the standard Adwaita about window with application name, version, credits and license.`,controls:[{name:`applicationName`,label:`Application name`,type:t.TEXT,defaultValue:`Adwaita Storybook`},{name:`version`,label:`Version`,type:t.TEXT,defaultValue:`0.11.0`}]},Gn={stories:[class AboutDialogWebStory extends StoryElement{_dialog=null;constructor(){super(AboutDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return Wn}initialize(){let e=document.createElement(`div`);e.style.display=`flex`,e.style.alignItems=`center`,e.style.justifyContent=`center`,e.style.minHeight=`160px`;let t=document.createElement(`adw-button`);t.textContent=`Show dialog`,t.setAttribute(`pill`,``),t.setAttribute(`suggested`,``),t.addEventListener(`click`,()=>this._present()),e.append(t),this._dialog=document.createElement(`adw-about-dialog`),document.body.appendChild(this._dialog),this.addContent(e)}_present(){if(!this._dialog)return;let e=this._dialog;e.setAttribute(`application-name`,this.args.applicationName??`Adwaita Storybook`),e.setAttribute(`application-icon`,`application-x-executable`),e.setAttribute(`developer-name`,`A GJSify Project`),e.setAttribute(`version`,this.args.version??`0.11.0`),e.setAttribute(`comments`,`A live catalogue of native GTK and Adwaita widgets, rendered under GJS.`),e.setAttribute(`website`,`https://github.com/gjsify/gjsify`),e.setAttribute(`issue-url`,`https://github.com/gjsify/gjsify/issues`),e.setAttribute(`license`,`The MIT License (MIT)`),e.setAttribute(`license-url`,`https://opensource.org/licenses/mit-license.php`),e.setAttribute(`copyright`,`© 2026 The GJSify Project`),e.developers=[`Ada Lovelace`,`Grace Hopper`],e.designers=[`Margaret Hamilton`],e.present()}updateArgs(e){}teardown(){this._dialog&&this._dialog.parentNode&&this._dialog.parentNode.removeChild(this._dialog),this._dialog=null}}]},Kn={title:`Feedback/Alert Dialog`,description:`Adw.AlertDialog — a modal dialog with a heading, body text and responses, including a destructive action.`,controls:[{name:`heading`,label:`Heading`,type:t.TEXT,defaultValue:`Delete Project?`},{name:`body`,label:`Body`,type:t.TEXT,defaultValue:`This will permanently remove the project and all of its files. This action cannot be undone.`}]},qn={stories:[class AlertDialogWebStory extends StoryElement{constructor(){super(AlertDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return Kn}initialize(){let e=document.createElement(`adw-button`);e.textContent=`Show dialog`,e.setAttribute(`pill`,``),e.setAttribute(`suggested`,``),e.addEventListener(`click`,()=>this._present());let t=document.createElement(`div`);t.style.display=`flex`,t.style.alignItems=`center`,t.style.justifyContent=`center`,t.style.minHeight=`160px`,t.append(e),this.addContent(t)}_present(){let e=document.createElement(`adw-alert-dialog`);e.setAttribute(`heading`,this.args.heading),e.setAttribute(`body`,this.args.body),document.body.appendChild(e),e.addResponse(`cancel`,`Cancel`),e.addResponse(`delete`,`Delete`),e.setResponseAppearance(`delete`,`destructive`),e.setDefaultResponse(`cancel`),e.setCloseResponse(`cancel`),e.addEventListener(`response`,()=>e.remove(),{once:!0}),e.present()}updateArgs(e){}}]},Jn={title:`Feedback/Preferences Dialog`,description:`Adw.PreferencesDialog — a preferences window with a page, a group and a handful of boxed-list rows.`,controls:[{name:`pageTitle`,label:`Page title`,type:t.TEXT,defaultValue:`General`},{name:`groupTitle`,label:`Group title`,type:t.TEXT,defaultValue:`Appearance`}]},Yn={stories:[class PreferencesDialogWebStory extends StoryElement{_dialog=null;constructor(){super(PreferencesDialogWebStory.getMetadata(),`Default`)}static getMetadata(){return Jn}_buildDialog(){let e=document.createElement(`adw-preferences-dialog`);e.setAttribute(`title`,`Preferences`);let t=document.createElement(`adw-preferences-page`);t.setAttribute(`title`,this.args.pageTitle??`General`),t.setAttribute(`icon-name`,`preferences-system-symbolic`);let n=document.createElement(`adw-preferences-group`);n.setAttribute(`title`,this.args.groupTitle??`Appearance`),n.setAttribute(`description`,`Control how the application looks and behaves.`);let r=document.createElement(`adw-switch-row`);r.setAttribute(`title`,`Dark style`),r.setAttribute(`subtitle`,`Use a dark colour scheme`),r.setAttribute(`active`,``),n.append(r);let i=document.createElement(`adw-combo-row`);i.setAttribute(`title`,`Accent colour`),i.setAttribute(`items`,JSON.stringify([`Blue`,`Teal`,`Green`,`Orange`,`Purple`])),i.setAttribute(`selected`,`0`),n.append(i);let a=document.createElement(`adw-spin-row`);return a.setAttribute(`title`,`Font size`),a.setAttribute(`min`,`8`),a.setAttribute(`max`,`24`),a.setAttribute(`step`,`1`),a.setAttribute(`value`,`12`),n.append(a),t.append(n),e.append(t),e}initialize(){let e=document.createElement(`div`);e.style.display=`flex`,e.style.alignItems=`center`,e.style.justifyContent=`center`,e.style.width=`100%`,e.style.height=`100%`,e.style.minHeight=`200px`;let t=document.createElement(`adw-button`);t.textContent=`Show dialog`,t.setAttribute(`pill`,``),t.setAttribute(`suggested`,``),t.addEventListener(`click`,()=>this._present()),e.append(t),this.addContent(e)}_present(){this._dialog&&this._dialog.remove(),this._dialog=this._buildDialog(),this._dialog.addEventListener(`closed`,()=>{this._dialog?.remove(),this._dialog=null}),document.body.appendChild(this._dialog),requestAnimationFrame(()=>this._dialog?.setAttribute(`open`,``))}updateArgs(e){}teardown(){this._dialog?.remove(),this._dialog=null}}]},Xn={title:`Feedback/Toast`,description:`Adw.Toast — a transient notification, with an optional action button, shown over an Adw.ToastOverlay.`,controls:[{name:`title`,label:`Toast text`,type:t.TEXT,defaultValue:`File moved to Trash`},{name:`timeout`,label:`Timeout (s)`,type:t.NUMBER,min:0,max:10,step:1,defaultValue:3},{name:`hasButton`,label:`Action button`,type:t.BOOLEAN,defaultValue:!0},{name:`buttonLabel`,label:`Button label`,type:t.TEXT,defaultValue:`Undo`}]},Zn=[tt,rt,at,lt,dt,pt,ht,_t,bt,Ct,Tt,Dt,kt,Mt,Pt,It,Vt,zt,Ut,qt,Xt,en,an,sn,ln,dn,mn,bn,Cn,En,kn,Mn,Pn,In,Rn,Vn,Un,Gn,qn,Yn,{stories:[class ToastWebStory extends StoryElement{_overlay=null;constructor(){super(ToastWebStory.getMetadata(),`Default`)}static getMetadata(){return Xn}initialize(){this._overlay=document.createElement(`adw-toast-overlay`),this._overlay.style.width=`360px`,this._overlay.style.height=`220px`;let e=document.createElement(`div`);e.style.display=`flex`,e.style.alignItems=`center`,e.style.justifyContent=`center`,e.style.width=`100%`,e.style.height=`100%`;let t=document.createElement(`adw-button`);t.textContent=`Show toast`,t.setAttribute(`pill`,``),t.setAttribute(`suggested`,``),t.addEventListener(`click`,()=>this._showToast()),e.append(t),this._overlay.append(e),this.addContent(this._overlay)}_showToast(){if(!this._overlay)return;let e=this.args.hasButton;this._overlay.addToast(this.args.title,{timeout:this.args.timeout,buttonLabel:e?this.args.buttonLabel:void 0})}updateArgs(e){}}]}];mountStorybook(document.body,{title:`Adwaita Storybook`,stories:Zn});
|