@gjsify/example-gtk-adwaita-storybook 0.63.0 → 0.63.1-next.236

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.
@@ -2,10 +2,10 @@ var e=Object.defineProperty,__name=(t,n)=>e(t,`name`,{value:n,configurable:!0});
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
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}var UnsupportedGObjectError=class extends Error{constructor(e,t){super(t),this.name=`UnsupportedGObjectError`,this.feature=e}};const d=new WeakSet;function makeType(e){let t=Object.freeze({name:e});return d.add(t),t}const f=makeType(`gchararray`),p=makeType(`gboolean`),m=makeType(`gint`),g=makeType(`guint`),_=makeType(`gdouble`),v=new WeakMap;var Value$1=class{static{__name(this,`Value`)}init(e){if(e!==f)throw new UnsupportedGObjectError(`GObject.Value of ${describeType(e)}`,`GObject.Value holds only TYPE_STRING in this subset (ADR 0096 Amendment 2); '${describeType(e)}' is not supported`);return v.set(this,{type:e,string:null}),this}set_string(e){let t=v.get(this);if(e!==null&&typeof e!=`string`)throw TypeError(`Expected type string for argument 'v_string' but got type ${typeof e}`);t&&(t.string=e)}get_string(){return v.get(this)?.string??null}};function readValue(e){let t=typeof e==`object`&&e?v.get(e):void 0;return t?{...t}:null}const ee=[f,p,m,g,_],y={READABLE:1,WRITABLE:2,READWRITE:3,CONSTRUCT:4,CONSTRUCT_ONLY:8};var b=class ParamSpec{constructor(e,t,n,r,i,a,o,s){this.kind=e,this.name=t,this.nick=n,this.blurb=r,this.flags=i,this.defaultValue=a,this.minimum=o,this.maximum=s}static boolean(e,t,n,r,i){return new ParamSpec(`boolean`,e,t,n,r,i)}static string(e,t,n,r,i){return new ParamSpec(`string`,e,t,n,r,i)}static int(e,t,n,r,i,a,o){return new ParamSpec(`int`,e,t,n,r,o,i,a)}static uint(e,t,n,r,i,a,o){return new ParamSpec(`uint`,e,t,n,r,o,i,a)}static double(e,t,n,r,i,a,o){return new ParamSpec(`double`,e,t,n,r,o,i,a)}get_default_value(){return this.defaultValue}};const x={GTypeName:Symbol(`GType name`),GTypeFlags:Symbol(`GType flags`),interfaces:Symbol(`GType interfaces`),properties:Symbol(`GObject properties`),signals:Symbol(`GObject signals`),requires:Symbol(`GObject interface requires`),template:Symbol(`GTK widget template`),cssName:Symbol(`GTK widget CSS name`),children:Symbol(`GTK widget template children`),internalChildren:Symbol(`GTK widget template internal children`)},te={GTypeName:x.GTypeName,Template:x.template,InternalChildren:x.internalChildren,Properties:x.properties,Signals:x.signals,CssName:x.cssName},ne={Children:x.children,Implements:x.interfaces,Requires:x.requires,GTypeFlags:x.GTypeFlags},re=new WeakMap;function chainOf(e){let t=[];for(let n=e;typeof n==`function`;n=Object.getPrototypeOf(n)){let e=re.get(n);e&&t.push(e)}return t}function chainOfInstance(e){return chainOf(e.constructor)}function typeNameOf(e,t){return t[0]?.typeName??e.constructor.name}function aliasesOf(e){return[e,e.replace(/-/g,`_`),e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())]}function findProperty(e,t){for(let n of e)for(let e of n.properties)if(aliasesOf(e.name).includes(t))return e}function findSignal(e,t){for(let n of e)if(Object.prototype.hasOwnProperty.call(n.signals,t))return n.signals[t]}function parseSignal(e){let t=e.indexOf(`::`);return t===-1?{name:e}:{name:e.slice(0,t),detail:e.slice(t+2)}}const ie=new WeakMap;function stateOf$2(e){let t=ie.get(e);return t||(t={values:new Map,handlers:new Map,connections:new Map,emissions:[]},ie.set(e,t)),t}__name(stateOf$2,`stateOf`);function runHandlers(e,t,n){let r=stateOf$2(e),i={key:t,stopped:!1};r.emissions.push(i);try{for(let{id:a,handler:o}of(r.handlers.get(t)??[]).slice()){if(i.stopped)break;r.connections.has(a)&&o(e,...n)}}finally{r.emissions.pop()}}const ae={name:`pure-js`,register(){},getValue(e,t){let{values:n}=stateOf$2(e);return n.has(t.name)||n.set(t.name,t.get_default_value()),n.get(t.name)},setValue(e,t,n){let{values:r}=stateOf$2(e),i=n!==r.get(t.name);return r.set(t.name,n),i},addHandler(e,t,n,r){let i=stateOf$2(e),a=i.handlers.get(n)??[];a.push({id:t,handler:r}),i.handlers.set(n,a),i.connections.set(t,()=>{a.splice(a.findIndex(e=>e.id===t),1)})},removeHandler(e,t){let n=stateOf$2(e),r=n.connections.get(t);return r?(n.connections.delete(t),r(),!0):!1},emit(e,t,n){runHandlers(e,t,n)},notify(e,t){runHandlers(e,`notify::${t.name}`,[t])},stopEmission(e,t){let{emissions:n}=stateOf$2(e);for(let e=n.length-1;e>=0;e--){let r=n[e];if(r.key===t&&!r.stopped)return r.stopped=!0,!0}return!1},bind(e,t,n,r,i){return bindProperties(e,t,n,r,i)}},oe=new WeakMap;function engineOf(e){let t=oe.get(e);return t||(t=chainOfInstance(e)[0]?.engine??ae,oe.set(e,t)),t}let se=0;const ce=new WeakMap,S=Symbol.for(`@gjsify/adwaita-core/stop-emission`);function isStoppable(e){return typeof e[S]==`function`}function stopEmissionByName(e,t){if(typeof e!=`object`||!e)throw TypeError(`GObject.signal_stop_emission_by_name: not a GObject instance`);if(isStoppable(e)){e[S](t);return}let n=chainOfInstance(e),r=typeNameOf(e,n),{name:i,detail:a}=parseSignal(t),o;if(i===`notify`&&a!==void 0){let e=findProperty(n,a);e&&(o=`notify::${e.name}`)}else a===void 0&&findSignal(n,i)&&(o=i);if(o===void 0){if(!n[0])throw new UnsupportedGObjectError(`signal_stop_emission_by_name`,`'${t}' on '${r}' is not a signal of a registered class; only those can be stopped.`);console.warn(`signal '${t}' is invalid for instance of type '${r}'`);return}engineOf(e).stopEmission(e,o)||console.warn(`no emission of signal "${t}" to stop for instance of type '${r}'`)}function connectInstance(e,t,n){let r=chainOfInstance(e),i=typeNameOf(e,r),{name:a,detail:o}=parseSignal(t),own=t=>{let r=++se;return engineOf(e).addHandler(e,r,t,n),r},foreign=()=>{let a=r[0]?.door;if(!a)throw Error(`No signal '${t}' on object '${i}'`);let o=++se,s=a.listen(e,t,n),c=ce.get(e);return c||ce.set(e,c=new Map),c.set(o,s),o};if(a===`notify`){if(o===void 0)throw new UnsupportedGObjectError(`connect("notify")`,`connect('notify') without a property is outside the GObject subset; connect 'notify::<property>' on '${i}'.`);let e=findProperty(r,o);return e?own(`notify::${e.name}`):foreign()}if(findSignal(r,a)){if(o!==void 0)throw Error(`Signal '${a}' on object '${i}' has no detail`);return own(a)}return foreign()}function disconnectInstance(e,t){let n=ce.get(e)?.get(t);if(n){ce.get(e).delete(t),n();return}if(!engineOf(e).removeHandler(e,t))throw Error(`No handler with id ${t} is connected to ${String(e)}`)}function emitInstance(e,t,...n){let r=chainOfInstance(e),i=typeNameOf(e,r),a=findSignal(r,t);if(a){if(n.length!==a.length)throw Error(`Signal '${t}' on ${i} requires ${a.length} args got ${n.length}`);engineOf(e).emit(e,t,n);return}let o=r[0]?.door;if(!o)throw Error(`No signal '${t}' on object '${i}'`);o.dispatch(e,t,n)}function notifyInstance(e,t){let n=chainOfInstance(e),r=findProperty(n,t);if(r){engineOf(e).notify(e,r);return}let i=n[0]?.door;if(!i)throw Error(`No property ${t} on ${typeNameOf(e,n)}`);i.dispatch(e,`notify::${t}`,[])}function generateAccessors(e,t){let{name:n,flags:r}=e,i=r&y.READABLE,a=r&y.WRITABLE,o=t??{configurable:!0,enumerable:!0};return i&&a?!o.get&&!o.set?(o.get=function(){return engineOf(this).getValue(this,e)},o.set=function(t){engineOf(this).setValue(this,e,t)&&this.notify(n)}):o.get?o.set||=function(){throw Error(`getter defined without setter for property ${n}`)}:o.get=function(){throw Error(`setter defined without getter for property ${n}`)}:i&&!o.get?o.get=function(){throw Error(`missing getter for read-only property ${n}`)}:a&&!o.set&&(o.set=function(){throw Error(`missing setter for write-only property ${n}`)}),o}function checkAccessors(e,t){let{name:n,flags:r}=t;if(r&y.CONSTRUCT_ONLY)return;let[,i,a]=aliasesOf(n),own=t=>Object.getOwnPropertyDescriptor(e,t),o=own(n),s=o,c=n.includes(`-`),l,u;c&&(l=own(i),u=own(a),o??=l,o??=u);let d=r&y.READABLE,f=r&y.WRITABLE;(!o||d&&!o.get||f&&!o.set)&&(o=generateAccessors(t,o)),s||Object.defineProperty(e,n,o),c&&(l||Object.defineProperty(e,i,o),u||Object.defineProperty(e,a,o))}function defineConstructOnly(e,t,n){let r=engineOf(e);r.setValue(e,t,n);for(let n of new Set(aliasesOf(t.name)))Object.defineProperty(e,n,{get:()=>r.getValue(e,t),enumerable:!0,configurable:!0})}function bindProperties(e,t,n,r,i=[]){let a=i.includes(`invert-boolean`),o=!1,transfer=(e,t,n,r)=>()=>{if(!o){o=!0;try{let i=e[t];n[r]=a?!i:i}finally{o=!1}}},s=transfer(e,t,n,r),c=[[e,e.connect(`notify::${t}`,s)]];if(i.includes(`bidirectional`)){let i=transfer(n,r,e,t);c.push([n,n.connect(`notify::${r}`,i)])}return i.includes(`sync-create`)&&s(),{unbind(){for(let[e,t]of c.splice(0))e.disconnect(t)}}}function createClosure(e,t,n,r){let i=r??e;if(n)throw new UnsupportedGObjectError(`swapped`,`Unsupported template signal flag "swapped"`);let a=e[t];if(a===void 0)throw Error(`A handler called ${t} was not defined on ${String(e)}`);return a.bind(i)}function scopeOf(e){let t=engineOf(e);return{instance:e,handler:(t,n)=>createClosure(e,t,n?.flags?.includes(`swapped`)??!1,n?.object),bind:(e,n,r,i,a)=>t.bind(e,n,r,i,a??[])}}function constructRegistered(e,t={}){let n=chainOfInstance(e),r={},i=new Map;for(let[e,a]of Object.entries(t)){let t=findProperty(n,e);t?i.set(t,a):r[e]=a}let a=[];for(let t of[...n].reverse())t.template&&a.push([t,t.door.createFromTree(t.template,scopeOf(e),e)]);for(let t of n)for(let n of t.properties)n.flags&y.CONSTRUCT_ONLY&&defineConstructOnly(e,n,i.has(n)?i.get(n):n.get_default_value());for(let[t,n]of i)t.flags&y.CONSTRUCT_ONLY||(e[t.name]=n);for(let[t,n]of a){for(let r of t.internalChildren){let i=n.objects[r];if(i===void 0)throw Error(`Template of ${t.typeName} has no child object '${r}' for InternalChildren`);e[`_${r.replace(/-/g,`_`)}`]=i}t.door.attach(e,n)}return r}const own=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),C=Symbol(`GIR type`),le={"Gio.Application":[`vfunc_startup`,`vfunc_activate`],"GtkSource.GutterRenderer":[`vfunc_query_data`]};function unlockedVfuncsOf(e){let t=new Set;for(let n=e;typeof n==`function`;n=Object.getPrototypeOf(n)){let e=own(n,C)?n[C]:void 0;if(typeof e==`string`)for(let n of le[e]??[])t.add(n)}return t}function refusal(e,t,n=``){return new UnsupportedGObjectError(t,`GObject.registerClass: ${e} uses '${t}'${n}, which is outside the GObject subset (ADR 0096 § 2).`)}function describeType(e){return e?.name?.toString()??String(e)}let ue=0;function registerWith(e,t,n){let r=n.length===2?n[1]:n[0];if(typeof r!=`function`)throw TypeError(`GObject.registerClass() needs a class`);let i=r,a=i.name||`anonymous class`;if(n.length===2){let e=n[0];for(let t of Object.keys(e))if(!own(te,t))throw refusal(a,t);for(let[t,n]of Object.entries(te))t in e&&(i[n]=e[t])}for(let[e,t]of Object.entries(ne))if(own(i,t))throw refusal(a,e);let o=unlockedVfuncsOf(i);for(let e of[i,i.prototype])for(let t of Object.getOwnPropertyNames(e))if(t.startsWith(`vfunc_`)&&typeof Object.getOwnPropertyDescriptor(e,t)?.value==`function`&&!o.has(t))throw refusal(a,t,` (a virtual function override that UNLOCKED_VFUNCS does not list, ADR 0098 § 1a)`);let declared=e=>own(i,e)?i[e]:void 0,s=declared(x.GTypeName),c=String(s??`Gjs_${i.name||`anonymous_${++ue}`}`).replace(/[^a-z0-9+_-]/gi,`_`),l=Object.values(declared(x.properties)??{}).map(e=>{if(!(e instanceof b))throw TypeError(`GObject.registerClass: ${a} declares a property that is not a ParamSpec`);return e}),u={};for(let[e,t]of Object.entries(declared(x.signals)??{})){for(let n of Object.keys(t))if(n!==`param_types`)throw refusal(a,`Signals.${e}.${n}`);let n=t.param_types??[];for(let t of n)if(!ee.includes(t))throw refusal(a,`Signals.${e}.param_types`,` with the type '${describeType(t)}' (only TYPE_STRING, TYPE_BOOLEAN, TYPE_INT, TYPE_UINT and TYPE_DOUBLE)`);u[e]=n}let d=declared(x.template);if(d!==void 0&&(typeof d!=`object`||!d))throw new UnsupportedGObjectError(`Template`,`GObject.registerClass: ${a} has a Template that is not a '?template' value; a string, URI or bytes stay GJS-only (ADR 0096 § 4).`);let f=makeType(c),p={klass:i,typeName:c,gtype:f,properties:l,signals:u,template:d,internalChildren:declared(x.internalChildren)??[],cssName:declared(x.cssName),door:e,engine:t};Object.defineProperty(i,"$gtype",{get:()=>f,enumerable:!1,configurable:!1});for(let e of l)checkAccessors(i.prototype,e);return installInstanceApi(i.prototype),re.set(i,p),t.register(p),e.register(p.klass,p),p.klass}function registerBaseClass(e,t,n,r=[],i=ae){let missing=e=>{throw Error(`No signal '${e}' on object '${t}'`)},a=makeType(t);Object.defineProperty(e,"$gtype",{get:()=>a,enumerable:!1,configurable:!1});for(let t of r)checkAccessors(e.prototype,t);let o={klass:e,typeName:t,gtype:a,properties:r,signals:n,internalChildren:[],engine:i,door:{name:t,dispatch:(e,t)=>missing(t),listen:(e,t)=>missing(t),createFromTree:()=>missing(`template`),attach(){},register(){}}};re.set(e,o),i.register(o)}var GObjectObject$1=class{static{__name(this,`GObjectObject`)}constructor(e){let t=constructRegistered(this,e),n=Object.keys(t)[0];if(n!==void 0)throw Error(`No property ${n} on ${typeNameOf(this,chainOfInstance(this))}`)}notify(e){notifyInstance(this,e)}connect(e,t){return connectInstance(this,e,t)}disconnect(e){disconnectInstance(this,e)}emit(e,...t){emitInstance(this,e,...t)}};function installInstanceApi(e){for(let t of[`notify`,`connect`,`disconnect`,`emit`])typeof e[t]!=`function`&&Object.defineProperty(e,t,{value:GObjectObject$1.prototype[t],writable:!0,configurable:!0,enumerable:!1})}function createGObject(e,t=ae){return{engineName:t.name,Object:GObjectObject$1,registerClass:((...n)=>registerWith(e,t,n)),ParamSpec:b,ParamFlags:y,Value:Value$1,TYPE_STRING:f,TYPE_BOOLEAN:p,TYPE_INT:m,TYPE_UINT:g,TYPE_DOUBLE:_,GTypeName:x.GTypeName,GTypeFlags:x.GTypeFlags,interfaces:x.interfaces,properties:x.properties,signals:x.signals,requires:x.requires,__gtkTemplate__:x.template,__gtkCssName__:x.cssName,__gtkChildren__:x.children,__gtkInternalChildren__:x.internalChildren,type_ensure(e){if(!d.has(e))throw TypeError(`GObject.type_ensure: not a GType of this GObject`)},signal_stop_emission_by_name:stopEmissionByName}}const w=Object.freeze({SHIFT:1,CONTROL:4,ALT:8,SUPER:1<<26,HYPER:1<<27,META:1<<28}),de=w.SHIFT|w.CONTROL|w.ALT|w.SUPER|w.HYPER|w.META,fe={primary:w.CONTROL,control:w.CONTROL,ctrl:w.CONTROL,ctl:w.CONTROL,shift:w.SHIFT,shft:w.SHIFT,alt:w.ALT,mod1:w.ALT,meta:w.META,super:w.SUPER,hyper:w.HYPER},pe=[[w.SHIFT,`<Shift>`],[w.CONTROL,`<Control>`],[w.ALT,`<Alt>`],[w.META,`<Meta>`],[w.SUPER,`<Super>`],[w.HYPER,`<Hyper>`]],me=Object.freeze({space:32,exclam:33,quotedbl:34,numbersign:35,dollar:36,percent:37,ampersand:38,apostrophe:39,parenleft:40,parenright:41,asterisk:42,plus:43,comma:44,minus:45,period:46,slash:47,colon:58,semicolon:59,less:60,equal:61,greater:62,question:63,at:64,bracketleft:91,backslash:92,bracketright:93,asciicircum:94,underscore:95,grave:96,braceleft:123,bar:124,braceright:125,asciitilde:126,BackSpace:65288,Tab:65289,Return:65293,Escape:65307,Home:65360,Left:65361,Up:65362,Right:65363,Down:65364,Page_Up:65365,Page_Down:65366,End:65367,Insert:65379,KP_Enter:65421,KP_Multiply:65450,KP_Add:65451,KP_Subtract:65453,KP_Divide:65455,ISO_Left_Tab:65056,Delete:65535,F1:65470,F2:65471,F3:65472,F4:65473,F5:65474,F6:65475,F7:65476,F8:65477,F9:65478,F10:65479,F11:65480,F12:65481}),he=new Map(Object.entries(me).map(([e,t])=>[t,e]));function keyvalFromName(e){return/^[A-Za-z0-9]$/.test(e)?e.toLowerCase().charCodeAt(0):me[e]??null}function keyvalName(e){return e===0?``:e>=48&&e<=57||e>=97&&e<=122?String.fromCharCode(e):he.get(e)??``}function parseAcceleratorKeyval(e){let t=0,n=e.trim();for(;n.startsWith(`<`);){let e=n.indexOf(`>`);if(e===-1)return null;let r=fe[n.slice(1,e).toLowerCase()];if(r===void 0)return null;t|=r,n=n.slice(e+1)}if(n===``)return{keyval:0,modifiers:t};let r=keyvalFromName(n);if(r===null)throw new UnsupportedGObjectError(`accelerator key '${n}'`,`The key name '${n}' is outside the keysym subset of the Gtk.Application accelerators (ADR 0098 § 1).`);return{keyval:r,modifiers:t}}function acceleratorName({keyval:e,modifiers:t}){let n=``;for(let[e,r]of pe)t&e&&(n+=r);return n+keyvalName(e)}function consumesShift(e){return e>=32&&e<=126&&!(e>=97&&e<=122)}function significant({keyval:e,modifiers:t}){let n=t&de;return{keyval:e,modifiers:consumesShift(e)?n&~w.SHIFT:n}}function canonicalDetailedName(e){let t=e.indexOf(`::`);if(t<=0)return e;let n=e.slice(t+2).replace(/\\/g,`\\\\`).replace(/'/g,`\\'`);return`${e.slice(0,t)}('${n}')`}var AcceleratorMap=class{#e=new Map;setAccels(e,t){let n=canonicalDetailedName(e),r=[];for(let e of t){let t=parseAcceleratorKeyval(e);if(t===null){console.error(`Gtk-CRITICAL **: Unable to parse accelerator '${e}': ignored request to install accelerators`);return}r.push(t)}r.length===0?this.#e.delete(n):this.#e.set(n,{names:r.map(acceleratorName),parsed:r})}getAccels(e){return[...this.#e.get(canonicalDetailedName(e))?.names??[]]}listActions(){return[...this.#e.keys()]}actionsFor(e){let t=parseAcceleratorKeyval(e);return t===null?(console.error(`Gtk-CRITICAL **: Unable to parse accelerator '${e}'`),[]):this.#t(t)}matching(e,t){return this.#t({keyval:e,modifiers:t})}#t(e){let t=significant(e),n=[];for(let[e,{parsed:r}]of this.#e)r.some(e=>e.keyval===t.keyval&&significant(e).modifiers===t.modifiers)&&n.push(e);return n}};const ge=[`blue`,`teal`,`green`,`yellow`,`orange`,`red`,`pink`,`purple`,`slate`],_e={blue:`#3584e4`,teal:`#2190a4`,green:`#3a944a`,yellow:`#c88800`,orange:`#ed5b00`,red:`#e62d42`,pink:`#d56199`,purple:`#9141ac`,slate:`#6f8396`};function isAdwAccentColorName(e){return ge.includes(e)}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]}const ve=/^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)\s*(?:[,/]\s*[\d.]+%?\s*)?\)$/i;function parseAdwRgb(e){let t=e.trim(),n=/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(t);if(n)return parseAdwRgb(`#${n[1]}${n[1]}${n[2]}${n[2]}${n[3]}${n[3]}`);let r=parseHex(t);if(r)return{red:r[0],green:r[1],blue:r[2]};let i=ve.exec(t);if(!i)return null;let a=[i[1],i[2],i[3]].map(Number);return a.some(e=>!Number.isFinite(e)||e<0||e>255)?null:{red:a[0]/255,green:a[1]/255,blue:a[2]/255}}function formatAdwRgb(e){return toHex(e.red,e.green,e.blue)}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 nearestAccent(e){let[,t,n]=linearToOklab(toLinear(e.red),toLinear(e.green),toLinear(e.blue)),r=Math.hypot(t,n),i=Math.atan2(n,t)*180/Math.PI%360;return i<0&&(i+=360),r<.04?`slate`:i>345?`pink`:i>280?`purple`:i>230?`blue`:i>175?`teal`:i>115?`green`:i>75.5?`yellow`:i>35?`orange`:i>10?`red`:`pink`}function adwaitaAccentBgColor(e){return _e[e]}function adwaitaAccentColor(e,t){return adwaitaStandaloneColor(_e[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 ye={value:0,lower:0,upper:100,stepIncrement:1,pageIncrement:1,pageSize:0},be={...ye,value:NaN};function finite(e,t){return typeof e==`number`&&Number.isFinite(e)?e:t}function adjustmentRange(e){return[e.lower,Math.max(e.lower,e.upper-e.pageSize)]}function clampAdjustmentValue(e,t){let[n,r]=adjustmentRange(e);return typeof t!=`number`||Number.isNaN(t)?n:Math.min(r,Math.max(n,t))}function snapAdjustmentValue(e,t){let n=clampAdjustmentValue(e,t),[r,i]=adjustmentRange(e),a=(i-r)/e.stepIncrement,o=Math.floor(a+Math.max(1,Math.abs(a))*1e-12),s=Math.min(o,Math.max(0,Math.round((n-r)/e.stepIncrement)));return Math.min(i,Math.max(r,r+s*e.stepIncrement))}function normalizeAdjustment(e,t=be){let n=e??{},r=finite(n.lower,t.lower),i=Math.max(r,finite(n.upper,t.upper)),a=finite(n.stepIncrement,t.stepIncrement),o=a>0?a:t.stepIncrement>0?t.stepIncrement:ye.stepIncrement,s=t.pageIncrement===t.stepIncrement,c=finite(n.pageIncrement,s?o:t.pageIncrement),l={value:0,lower:r,upper:i,stepIncrement:o,pageIncrement:c>0?c:o,pageSize:Math.max(0,finite(n.pageSize,t.pageSize))};return l.value=clampAdjustmentValue(l,typeof n.value==`number`?n.value:t.value),l}const xe=[`value`,`lower`,`upper`,`stepIncrement`,`pageIncrement`,`pageSize`];function parseAdjustment(e){if(!e)return{};let t;try{t=JSON.parse(e)}catch{return{}}if(typeof t!=`object`||!t||Array.isArray(t))return{};let n=t,r={};for(let e of xe){let t=n[e];typeof t==`number`&&(r[e]=t)}return r}var SpinState=class{constructor(){this._adjustment=normalizeAdjustment(),this._valueSet=!1,this._listeners=new Set,this._rangeListeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}subscribeChanged(e){return this._rangeListeners.add(e),()=>{this._rangeListeners.delete(e)}}_emit(e){let t={value:this._adjustment.value,interactive:e};for(let e of[...this._listeners])e(t)}_emitChanged(){let e=this._adjustment;for(let t of[...this._rangeListeners])t(e)}_bump(e){let t=clampAdjustmentValue(this._adjustment,this._adjustment.value+e);return t===this._adjustment.value?!1:(this._valueSet=!0,this._adjustment={...this._adjustment,value:t},this._emit(!0),!0)}get adjustment(){return{...this._adjustment}}get value(){return this._adjustment.value}configure(e){let t=this._adjustment,n=normalizeAdjustment(e,this._valueSet?t:{...t,value:NaN});typeof e?.value==`number`&&Number.isFinite(e.value)&&(this._valueSet=!0);let r=n.lower!==t.lower||n.upper!==t.upper||n.stepIncrement!==t.stepIncrement||n.pageIncrement!==t.pageIncrement||n.pageSize!==t.pageSize,i=n.value!==t.value;return!r&&!i?!1:(this._adjustment=n,r&&this._emitChanged(),i&&this._emit(!1),!0)}setValue(e){Number.isFinite(e)&&(this._valueSet=!0);let t=clampAdjustmentValue(this._adjustment,e);return t===this._adjustment.value?!1:(this._adjustment={...this._adjustment,value:t},this._emit(!1),!0)}setValueInteractive(e){Number.isFinite(e)&&(this._valueSet=!0);let t=clampAdjustmentValue(this._adjustment,e);return t===this._adjustment.value?!1:(this._adjustment={...this._adjustment,value:t},this._emit(!0),!0)}increment(){return this._bump(this._adjustment.stepIncrement)}decrement(){return this._bump(-this._adjustment.stepIncrement)}};const Se=[`light`,`dark`,`no-preference`],Ce=`system`;function isAdwSystemColorScheme(e){return typeof e==`string`&&Se.includes(e)}function appearanceFromMeta(e){let t=e(`adw-accent`)?.trim().toLowerCase(),n=e(`adw-color-scheme`)?.trim().toLowerCase();return{...t&&(t===`system`||isAdwAccentColorName(t))?{accent:t}:{},...isAdwSystemColorScheme(n)?{colorScheme:n}:{}}}function refuse$4(e,t){return new UnsupportedGObjectError(e,`${e} ${t}, which is outside the Gio subset (ADR 0098 § 1).`)}__name(refuse$4,`refuse`);var ActionRegistry=class{constructor(){this._actions=new Map}add(e){this._actions.set(e.name,e)}remove(e){this._actions.delete(e)}lookup_action(e){return this._actions.get(e)??null}has(e){return this._actions.has(e)}list(){return[...this._actions.keys()]}};const we=new WeakMap;function actionRegistryOf(e,t=!0){let n=we.get(e);return n===void 0&&t&&(n=new ActionRegistry,we.set(e,n)),n}function requireAction(e){let t=e;if(typeof t?.name!=`string`||typeof t.activate!=`function`)throw TypeError(`add_action: needs a Gio.Action (a Gio.SimpleAction)`);return t}const Te={add_action(e){actionRegistryOf(this).add(requireAction(e))},lookup_action(e){return actionRegistryOf(this,!1)?.lookup_action(e)??null},remove_action(e){actionRegistryOf(this,!1)?.remove(e)}},Ee={has_action(e){return actionRegistryOf(this,!1)?.has(e)??!1},list_actions(){return actionRegistryOf(this,!1)?.list()??[]},activate_action(e,t=null){if(t!==null)throw refuse$4(`activate_action with a parameter`,`needs a GLib.Variant`);actionRegistryOf(this,!1)?.lookup_action(e)?.activate(null)},get_action_enabled(e){return actionRegistryOf(this,!1)?.lookup_action(e)?.enabled??!1}};function installActionMap(e,t=!1){let n=t?{...Te,...Ee}:{...Te};for(let[t,r]of Object.entries(n))Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0,enumerable:!1})}const De=new WeakMap,Oe=new WeakMap;function insertActionGroup(e,t,n){let r=De.get(e);if(n===null){r?.delete(t);return}r===void 0&&De.set(e,r=new Map),r.set(t,n)}function applicationOfWindow(e){return Oe.get(e)??null}function linkWindow(e,t){t===null?Oe.delete(e):Oe.set(e,t)}function findActionGroup(e,t,n){for(let r=e;r;r=n(r)){let e=De.get(r)?.get(t);if(e!==void 0)return e;if(t===`win`){let e=actionRegistryOf(r,!1);if(e!==void 0)return e}if(t===`app`){let e=Oe.get(r);if(e!==void 0)return e}}return null}function activateWidgetAction(e,t,n,r=null){let i=t.indexOf(`.`);if(i<=0)return!1;let a=findActionGroup(e,t.slice(0,i),n)?.lookup_action(t.slice(i+1));return!a||!a.enabled?!1:(a.activate(r),!0)}const T=Object.freeze({KEY_space:32,KEY_a:97,KEY_d:100,KEY_e:101,KEY_q:113,KEY_s:115,KEY_w:119,KEY_Return:65293,KEY_Escape:65307,KEY_Left:65361,KEY_Up:65362,KEY_Right:65363,KEY_Down:65364}),ke={" ":T.KEY_space,Enter:T.KEY_Return,Escape:T.KEY_Escape,ArrowLeft:T.KEY_Left,ArrowUp:T.KEY_Up,ArrowRight:T.KEY_Right,ArrowDown:T.KEY_Down};function keyvalOfKey(e){let t=ke[e];if(t!==void 0)return t;let[n]=Array.from(e);if(n===void 0||e.length>2)return 0;let r=n.toLowerCase().codePointAt(0)??0;return r>=32&&r<=255?r:16777216+r}var CssProvider$1=class{static{__name(this,`CssProvider`)}#e=``;#t=null;load_from_string(e){this.#e=String(e),this.#t?.()}to_string(){return this.#e}static bind(e,t){e.#t=t}},StyleBook=class{#e;#t=[];constructor(e){this.#e=e}add(e,t){this.remove(e,!1),this.#t.push({provider:e,priority:t}),CssProvider$1.bind(e,()=>this.#n()),this.#n()}remove(e,t=!0){let n=this.#t.findIndex(t=>t.provider===e);n<0||(this.#t.splice(n,1),CssProvider$1.bind(e,null),t&&this.#n())}#n(){let e=this.#t.map((e,t)=>({entry:e,order:t})).sort((e,t)=>e.entry.priority-t.entry.priority||e.order-t.order);this.#e.setStyles(e.map(({entry:e})=>({owner:e.provider,css:e.provider.to_string(),priority:e.priority})))}},GtkSettings=class{#e;#t;constructor(e){this.#e=e}get gtk_font_name(){return this.#t===void 0?this.#e.fontName():this.#t}set gtk_font_name(e){this.#t=e}},IconTheme$1=class{static{__name(this,`IconTheme`)}#e=[];add_resource_path(e){this.#e.includes(e)||this.#e.push(e)}get_resource_path(){return[...this.#e]}},EventControllerKey$1=class{static{__name(this,`EventControllerKey`)}#e=new Map;#t=1;#n=null;connect(e,t){if(e!==`key-pressed`&&e!==`key-released`)throw Error(`No signal '${e}' on object 'GtkEventControllerKey'`);let n=this.#t++;return this.#e.set(n,{signal:e,handler:t}),n}disconnect(e){if(!this.#e.delete(e))throw Error(`No handler with id ${e} is connected to ${String(this)}`)}static attach(e,t){e.#n?.(),e.#n=t}static dispatch(e,t){let n=t.pressed?`key-pressed`:`key-released`,r=keyvalOfKey(t.key),i=!1;for(let{signal:a,handler:o}of Array.from(e.#e.values()))if(a===n&&o(e,r,t.keycode,t.state)===!0){i=!0;break}return i}};function createGtkPlatform(e){let t=new StyleBook(e),n=new GtkSettings(e),r=new IconTheme$1;return{CssProvider:CssProvider$1,StyleContext:{add_provider_for_display:(e,n,r)=>t.add(n,r),remove_provider_for_display:(e,n)=>t.remove(n)},Settings:{get_default:()=>n},IconTheme:{get_for_display:()=>r},EventControllerKey:EventControllerKey$1,show_uri:(t,n)=>e.openUri(n)}}function widgetControllerMembers(e){return{add_controller(t){EventControllerKey$1.attach(t,e.listenKeys(this,e=>EventControllerKey$1.dispatch(t,e)))},remove_controller(e){EventControllerKey$1.attach(e,null)}}}const Ae=[`action-disabled`,`action-missing`,`macos-menubar`],je=[`horizontal-buttons`,`circular-buttons`,`inline-buttons`],Me=[`ltr`,`rtl`,`none`],str=e=>typeof e==`string`?e:void 0;function oneOf(e,t){return typeof t==`string`&&e.includes(t)?t:void 0}function put(e,t,n){n!==void 0&&(e[t]=n)}function normalizeMenuModel(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){let e=normalizeEntry(n);e!==null&&t.push(e)}return t}function normalizeEntry(e){if(typeof e==`string`)return{kind:`item`,label:e};if(typeof e!=`object`||!e)return null;let t=e;if(Array.isArray(t.items)&&(t.kind===`section`||t.kind===`submenu`)){let{items:e,kind:n,...r}=t;return normalizeEntry({...r,[n]:e})}if(Array.isArray(t.section)){let e={kind:`section`,items:normalizeMenuModel(t.section)},n=e;return put(n,`label`,str(t.label)),put(n,`displayHint`,oneOf(je,t.displayHint)),put(n,`textDirection`,oneOf(Me,t.textDirection)),e}if(Array.isArray(t.submenu)){let e={kind:`submenu`,label:str(t.label)??``,items:normalizeMenuModel(t.submenu)},n=e;return put(n,`icon`,str(t.icon)),put(n,`submenuAction`,str(t.submenuAction)),put(n,`macosSpecial`,str(t.macosSpecial)),e}let n=str(t.label),r={kind:`item`,label:n??``},i=r;return put(i,`action`,str(t.action)||void 0),put(i,`icon`,str(t.icon)),put(i,`verbIcon`,str(t.verbIcon)),put(i,`accel`,str(t.accel)),put(i,`hiddenWhen`,oneOf(Ae,t.hiddenWhen)),put(i,`custom`,str(t.custom)),put(i,`id`,str(t.id)),t.useMarkup===!0&&(i.useMarkup=!0),n===void 0&&Object.keys(r).length===2?null:r}function parseMenuModel(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return[]}return Array.isArray(t)?normalizeMenuModel(t):[]}function menuNodeAt(e,t){if(!Array.isArray(t)||t.length===0)return null;let n=e,r=null;for(let e of t){if(!Number.isInteger(e)||e<0||e>=n.length)return null;r=n[e],n=r.kind===`item`?[]:r.items}return r}function menuItemAt(e,t){let n=menuNodeAt(e,t);return n!==null&&n.kind===`item`?n:null}function flattenMenu(e,t=[]){let n=[],r=!1;return e.forEach((e,i)=>{let a=[...t,i];if(e.kind===`section`){let t=flattenMenu(e.items,a);if(t.length===0)return;n.push({...t[0],separated:n.length>0}),n.push(...t.slice(1)),r=!0;return}n.push({node:e,path:a,separated:r&&n.length>0}),r=!1}),n}function parseDetailedAction(e){if(typeof e!=`string`||e.length===0)return null;let t=e.indexOf(`::`);if(t>0)return{name:e.slice(0,t),target:e.slice(t+2)};let n=e.indexOf(`(`);return n>0&&e.endsWith(`)`)?{name:e.slice(0,n),target:unquote(e.slice(n+1,-1))}:{name:e}}function unquote(e){let t=e[0];if(!(e.length>=2&&(t===`'`||t===`"`)&&e[e.length-1]===t))return e;let n=e.slice(1,-1),r=``;for(let e=0;e<n.length;e+=1){let i=n[e],a=n[e+1];if(i===`\\`&&(a===t||a===`\\`)){r+=a,e+=1;continue}r+=i}return r}function resolveMenuItemState(e,t){let n=parseDetailedAction(e.action);if(t===void 0)return{sensitive:!0,toggled:!1,role:`normal`,visible:visibility(e,!0,!0)};if(n===null)return{sensitive:!0,toggled:!1,role:`normal`,visible:visibility(e,!1,!0)};let r=t?.[n.name];if(r===void 0)return{sensitive:!1,toggled:!1,role:`normal`,visible:visibility(e,!1,!1)};let i=r.enabled!==!1,a=`normal`,o=!1;return n.target!==void 0&&r.state!==void 0?(a=`radio`,o=r.state===n.target):(r.state===`true`||r.state===`false`)&&(a=`check`,o=r.state===`true`),{sensitive:i,toggled:o,role:a,visible:visibility(e,!0,i)}}function visibility(e,t,n){switch(e.hiddenWhen){case`action-missing`:return t;case`action-disabled`:return n;case`macos-menubar`:return!0;default:return!0}}const E={name:`adwaita-web`,custom:!1};function menuRefusals(e,t,n=[]){let r=[];return e.forEach((e,i)=>{let a=[...n,i];if(e.kind===`item`){e.custom!==void 0&&!t.custom&&r.push({path:a,what:`custom`,message:`menu item custom="${e.custom}" names an application widget, which ${t.name} cannot host: it has no gtk_popover_menu_add_child. Give the item a label and an action, or keep this menu on GTK.`});return}r.push(...menuRefusals(e.items,t,a))}),r}function assertMenuRenderable(e,t){let n=menuRefusals(e,t);if(n.length===0)return;let r=n.map(e=>` [${e.path.join(`.`)}] ${e.message}`);throw Error(`${t.name} cannot render this menu:\n${r.join(`
4
4
  `)}`)}const Ne={NONE:0,FLAGS_NONE:0,DEFAULT_FLAGS:0,IS_SERVICE:1,IS_LAUNCHER:2,HANDLES_OPEN:4,HANDLES_COMMAND_LINE:8,SEND_ENVIRONMENT:16,NON_UNIQUE:32,CAN_OVERRIDE_APP_ID:64,ALLOW_REPLACEMENT:128,REPLACE:256};function isValidApplicationId(e){if(typeof e!=`string`||e.length>255||e===``)return!1;let t=e.split(`.`);return t.length>=2&&t.every(e=>/^[A-Za-z_-][A-Za-z0-9_-]*$/.test(e))}function refuse$3(e,t){return new UnsupportedGObjectError(e,`${e} ${t}, which is outside the Gio subset (ADR 0098 § 1).`)}__name(refuse$3,`refuse`);const Pe=`register.hold.release.mark_busy.unmark_busy.open.set_inactivity_timeout.send_notification.withdraw_notification.register_session.set_option_context_parameter_string.set_option_context_summary.set_option_context_description.add_main_option.add_main_option_entries.add_option_group.set_resource_base_path.get_resource_base_path.set_flags.get_is_remote.get_is_registered.get_dbus_connection.get_dbus_object_path.bind_busy_property.add_action_entries.set_default`.split(`.`),Fe=[`is_remote`,`is_registered`,`is_busy`,`resource_base_path`,`inactivity_timeout`,`action_group`],Ie=[`open`,`command-line`,`handle-local-options`,`shutdown`,`name-lost`],Le=[`set_menubar`,`get_menubar`,`get_menu_by_id`,`set_app_menu`,`get_app_menu`,`get_menu_by_id`,`inhibit`,`uninhibit`],Re=new WeakMap;let ze=null;function rememberDefault(e){ze??=e}function stateOf$1(e){let t=Re.get(e);return t===void 0&&(t={id:null,windows:[],running:!1,resolve:()=>{}},Re.set(e,t)),t}__name(stateOf$1,`stateOf`);const Be=new WeakMap;function acceleratorsOf(e){let t=Be.get(e);return t===void 0&&(t=new AcceleratorMap,Be.set(e,t)),t}function dispatchAccelerator(e,t,n){if(!t.pressed)return!1;let r=applicationOfWindow(e);if(r===null)return!1;for(let i of acceleratorsOf(r).matching(keyvalOfKey(t.key),t.state)){let t=parseDetailedAction(i),r=t?.name.indexOf(`.`)??-1;if(t===null||r<=0)continue;let a=findActionGroup(e,t.name.slice(0,r),n)?.lookup_action(t.name.slice(r+1));if(!(!a||!a.enabled))return a.activate(t.target??null),!0}return!1}function hostOf(e){let t=e.constructor.host;if(t===void 0)throw Error(`Gio.Application: this class has no ApplicationHost; use the Gtk.Application of a port.`);return t}var GioApplicationBase=class extends GObjectObject$1{static{this[C]=`Gio.Application`}static id_is_valid(e){return isValidApplicationId(e)}static get_default(){return ze}constructor(e){super(e),rememberDefault(this)}get application_id(){return stateOf$1(this).id}set application_id(e){let t=e??null;if(t!==null&&!isValidApplicationId(t))throw Error(`Gio.Application: '${String(t)}' is not a valid application id (g_application_id_is_valid)`);let n=stateOf$1(this);if(n.running)throw Error(`Gio.Application: the application id cannot change while it runs`);n.id!==t&&(n.id=t,this.notify(`application-id`))}get flags(){return 0}set flags(e){if(e!==void 0&&e!==Ne.NONE)throw refuse$3(`Gio.ApplicationFlags value ${String(e)}`,`is a flag other than the default`)}get_application_id(){return this.application_id}set_application_id(e){this.application_id=e}get_flags(){return 0}vfunc_startup(){}vfunc_activate(){}run(){throw refuse$3(`Gio.Application.run()`,`blocks, and a page cannot; use runAsync()`)}connect(e,t){let n=e.split(`::`)[0]??e;if(Ie.includes(n))throw refuse$3(`the '${n}' signal`,`is not emitted`);return super.connect(e,t)}async runAsync(e=[]){let t=stateOf$1(this);if(t.running)throw Error(`Gio.Application.runAsync(): the application is already running`);let n=hostOf(this);t.running=!0;let r=new Promise(e=>{t.resolve=e}),i,a=!1,body=()=>{try{if(this.vfunc_startup(),this.emit(`startup`),this.emit(`activate`),this.vfunc_activate(),t.running&&t.windows.length===0&&n.requiresWindow)throw Error(`Gio.Application.runAsync(): activate added no window on ${n.name}; a window must be added synchronously by activate (ADR 0098 § 3).`)}catch(e){i=e,a=!0}return t.windows[0]??null};try{await n.start(body)}catch(e){i=e,a=!0}if(a)throw t.running=!1,n.exit(),i;return t.windows.length===0&&this._finish(0),r}quit(){let e=stateOf$1(this);if(e.running){for(let t of e.windows.splice(0))linkWindow(t,null),hostOf(this).detach(t);this._finish(0)}}_finish(e){let t=stateOf$1(this);t.running&&(t.running=!1,t.resolve(e),hostOf(this).exit())}};registerBaseClass(GioApplicationBase,`GApplication`,{startup:[],activate:[]},[b.string(`application-id`,``,``,y.READWRITE|y.CONSTRUCT,null),b.uint(`flags`,``,``,y.READWRITE|y.CONSTRUCT,0,4294967295,0)]),installActionMap(GioApplicationBase.prototype,!0);function refuseMembers$1(e,t,n){for(let n of t)Object.defineProperty(e,n,{value:()=>{throw refuse$3(`${n}()`,`is not implemented`)},writable:!0,configurable:!0,enumerable:!1});for(let t of n)Object.defineProperty(e,t,{get(){throw refuse$3(`the '${t}' property`,`is not implemented`)},configurable:!0,enumerable:!1})}__name(refuseMembers$1,`refuseMembers`),refuseMembers$1(GioApplicationBase.prototype,Pe,Fe);function withGtkApplication(e){class GtkApplication extends e{get active_window(){return stateOf$1(this).windows[0]??null}get_active_window(){return this.active_window}set_accels_for_action(e,t){acceleratorsOf(this).setAccels(e,t)}get_accels_for_action(e){return acceleratorsOf(this).getAccels(e)}get_actions_for_accel(e){return acceleratorsOf(this).actionsFor(e)}list_action_descriptions(){return acceleratorsOf(this).listActions()}get_windows(){return[...stateOf$1(this).windows]}add_window(e){let t=stateOf$1(this);t.windows.includes(e)||(t.windows.unshift(e),linkWindow(e,this))}remove_window(e){let t=stateOf$1(this),n=t.windows.indexOf(e);n!==-1&&(t.windows.splice(n,1),linkWindow(e,null),t.windows.length===0&&this._finish(0))}}return refuseMembers$1(GtkApplication.prototype,Le,[]),GtkApplication}withGtkApplication(GioApplicationBase);const Ve=[{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 Ve[(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}function avatarIconSize(e){return Math.trunc(e/2)}const He=[`suggested-action`],Ue={title:``,buttonLabel:``,revealed:!1,useMarkup:!0,buttonStyle:`default`};function isBannerButtonStyle(e){return e==="default"||e===`suggested`}function parseBannerButtonStyle(e){return isBannerButtonStyle(e)?e:Ue.buttonStyle}function bannerButtonStyleClasses(e){return e===`suggested`?He:[]}function bannerButtonVisible(e){return typeof e==`string`&&e.length>0}function bannerButtonText(e){return stripMnemonic(e)}const We=new Set([`none`,`single`,`browse`,`multiple`]);function normalizeBoxSelectionMode(e){return typeof e==`string`&&We.has(e)?e:`single`}function normalize(e,t){let n=new Set;for(let r of e)Number.isInteger(r)&&r>=0&&r<t&&n.add(r);return[...n].sort((e,t)=>e-t)}function spanBetween(e,t,n){let r=Math.max(0,Math.min(e,t)),i=Math.min(n-1,Math.max(e,t)),a=[];for(let e=r;e<=i;e++)a.push(e);return a}function isLiveAnchor(e,t){return Number.isInteger(e)&&e>=0&&e<t}function listBoxSelect(e,t,n,r,i,a={},o=!0){let s=normalize(e,r),unchanged=()=>({selection:s,anchor:t});if(i===`none`||!o||!Number.isInteger(n)||n<0||n>=r)return unchanged();let c=new Set(s);if(i===`browse`)return{selection:[n],anchor:n};if(i===`single`){let e=c.has(n);return{selection:a.modify===!0&&e?[]:[n],anchor:a.modify===!0&&e?-1:n}}return a.extend===!0?isLiveAnchor(t,r)?{selection:spanBetween(t,n,r),anchor:t}:{selection:[n],anchor:n}:a.modify===!0?(c.has(n)?c.delete(n):c.add(n),{selection:normalize(c,r),anchor:t}):{selection:[n],anchor:n}}function listBoxSelectRow(e,t,n,r,i,a=!0){let o=normalize(e,r);return i===`none`?{selection:o,anchor:t}:n===null?{selection:[],anchor:-1}:!a||!Number.isInteger(n)||n<0||n>=r||o.includes(n)?{selection:o,anchor:t}:i===`multiple`?{selection:normalize([...o,n],r),anchor:n}:{selection:[n],anchor:n}}function listBoxUnselectRow(e,t,n,r,i){let a=normalize(e,r);return i===`none`||!a.includes(n)?{selection:a,anchor:t}:{selection:i===`multiple`?a.filter(e=>e!==n):[],anchor:t}}function listBoxSelectAll(e,t){return t!==`multiple`||e<=0?null:Array.from({length:e},(e,t)=>t)}function listBoxUnselectAll(e,t){return t===`browse`||t===`none`||e.length===0?null:[]}function normalizeBoxSpacing(e){let t=typeof e==`number`?e:Number.parseFloat(String(e));return Number.isFinite(t)&&t>0?t:0}function normalizeBoxOrientation(e){return e===`vertical`?`vertical`:`horizontal`}const Ge=/^(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=Ge.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)}},BreakpointBinState=class{constructor(){this._breakpoints=[],this._current=null,this._hasChild=!0}add(e){let t=this._breakpoints.length;return this._breakpoints.push({index:t,condition:parseBreakpointCondition(e.condition),setters:e.setters}),t}setHasChild(e){this._hasChild=e}get current(){return this._current?.index??null}get length(){return this._breakpoints.length}evaluate(e){if(!this._hasChild)return null;let t=null;for(let n=this._breakpoints.length-1;n>=0;n--){let r=this._breakpoints[n];if(r.condition&&evaluateBreakpointCondition(r.condition,e)){t=r;break}}if(t===this._current)return null;let n=this._current;return this._current=t,{from:n?.index??null,to:t?.index??null,writes:transitionWrites(n,t)}}inherit(e){if(e===null){this._current=null;return}let t=this._breakpoints[e];if(!t)throw RangeError(`BreakpointBinState.inherit: no breakpoint at index ${e}; ${this._breakpoints.length} added.`);this._current=t}};function transitionWrites(e,t){let n=[];if(e)for(let r of e.setters)t?.setters.some(e=>e.object===r.object&&e.property===r.property)||n.push({object:r.object,property:r.property,value:r.originalValue});if(t)for(let e of t.setters)n.push({object:e.object,property:e.property,value:e.value});return n}function createBreakpointDriver(e,t){let n=new BreakpointBinState;for(let r of e)n.add({condition:r.condition,setters:r.setters.map(e=>({...e,originalValue:t.read(e.object,e.property)}))});return{evaluate(e){let r=n.evaluate(e);if(r!==null)for(let e of r.writes)t.write(e.object,e.property,e.value)},get current(){return n.current}}}const Ke=`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 qe=[`flat`,`suggested-action`,`destructive-action`,`circular`,`pill`],Je={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?Je[e]??null:null}function buttonStyleClasses(e){let t=new Set;for(let n of e){let e=buttonStyleClass(n);e&&t.add(e)}return qe.filter(e=>t.has(e))}const D=9999;function calendarIsLeapYear(e){return e%4==0&&e%100!=0||e%400==0}function calendarDaysInMonth(e,t){let n=glibClamp(Math.trunc(t),1,12);return n===2?calendarIsLeapYear(e)?29:28:[0,31,28,31,30,31,30,31,31,30,31,30,31][n]}function calendarWeekStart(e,t){let n=(t+e-1)%7;return n<0||n>6?0:n}function calendarDays(e,t,n){let r=glibClamp(Math.trunc(t),1,12),i=glibClamp(Math.trunc(e),1,D),a=glibClamp(Math.trunc(n),0,6),o=calendarDaysInMonth(i,r),s=r===1?12:r-1,c=r===1?i-1:i,l=calendarDaysInMonth(c,s),u=(weekdayOfWeek(i,r,1)-a+7)%7;u===0&&(u=7);let d=[],f=l-u+1;for(let e=0;e<u;e++)d.push({date:{year:c,month:s,day:f},month:`previous`}),f+=1;let p=Math.trunc(u/7),m=u%7;for(let e=1;e<=o;e++)d.push({date:{year:i,month:r,day:e},month:`current`}),m+=1,m===7&&(p+=1,m=0);f=1;let g=r===12?1:r+1,_=r===12?i+1:i;for(;p<=5;p++){for(;m<=6;m++)d.push({date:{year:_,month:g,day:f},month:`next`}),f+=1;m=0}return d}function weekdayOfWeek(e,t,n){return((daysFromCivil(e,t,n)+4)%7+7)%7}function daysFromCivil(e,t,n){let r=t<=2?e-1:e,i=Math.floor((r>=0?r:r-399)/400),a=r-i*400,o=Math.floor((153*(t+(t>2?-3:9))+2)/5)+n-1,s=a*365+Math.floor(a/4)-Math.floor(a/100)+o;return i*146097+s-719468}function civilFromDays(e){let t=e+719468,n=Math.floor((t>=0?t:t-146096)/146097),r=t-n*146097,i=Math.floor((r-Math.floor(r/1460)+Math.floor(r/36524)-Math.floor(r/146096))/365),a=i+n*400,o=r-(365*i+Math.floor(i/4)-Math.floor(i/100)),s=Math.floor((5*o+2)/153),c=o-Math.floor((153*s+2)/5)+1,l=s+(s<10?3:-9);return{year:a+ +(l<=2),month:l,day:c}}function calendarWeekNumber(e){let t=glibClamp(Math.trunc(e.year),1,D),n=glibClamp(Math.trunc(e.month),1,12),r=glibClamp(Math.trunc(e.day),1,calendarDaysInMonth(t,n)),i=thursdayOfWeek(daysFromCivil(t,n,r),weekdayOfWeek(t,n,r)),a=civilFromDays(i).year;return 1+Math.round((i-thursdayOfJanuaryFirst(a))/7)}function thursdayOfWeek(e,t){return e-(t+6)%7+3}function thursdayOfJanuaryFirst(e){return thursdayOfWeek(daysFromCivil(e,1,4),weekdayOfWeek(e,1,4))}function calendarNavigationButtons(e){let t=glibClamp(Math.trunc(e.year),1,D),n=glibClamp(Math.trunc(e.month),1,12),r=t===1,i=t===D;return{previousMonth:!r||n!==1,nextMonth:!i||n!==12,previousYear:!r,nextYear:!i}}function calendarStep(e,t){let n=glibClamp(Math.trunc(e.year),1,D),r=glibClamp(Math.trunc(e.month),1,12),i=glibClamp(Math.trunc(e.day),1,calendarDaysInMonth(n,r));if(t===`previous-year`||t===`next-year`){let e=n+(t===`next-year`?1:-1);return{year:glibClamp(e,1,D),month:r,day:Math.min(i,calendarDaysInMonth(e,r))}}let a=t===`next-month`?1:-1,o=glibClamp(n*12+(r-1)+a,12,119999),s=Math.floor(o/12),c=o%12+1;return{year:s,month:c,day:Math.min(i,calendarDaysInMonth(s,c))}}function calendarSelectDay(e,t,n=!0){let r=glibClamp(Math.trunc(t.year),1,D),i=glibClamp(Math.trunc(t.month),1,12),a={year:r,month:i,day:glibClamp(Math.trunc(t.day),1,calendarDaysInMonth(r,i))},o=e.day!==a.day;return{date:a,dayChanged:o,monthChanged:e.month!==a.month,yearChanged:e.year!==a.year,emitDaySignal:n&&o}}function calendarMarkDay(e,t,n){let r=Math.trunc(t);if(r<1||r>31||e[r-1]===!0===n)return e;let i=e.slice();return i[r-1]=n,i}function calendarDayIsMarked(e,t){let n=Math.trunc(t);return n<1||n>31?!1:e[n-1]===!0}function calendarClearMarks(){return Array.from({length:31},()=>!1)}const Ye=.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/Ye,t=Math.abs(r)-2+e;c=Ye*t*t-Ye*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 Xe={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 Ze=[`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 Qe={topBarStyle:`flat`,bottomBarStyle:`flat`,extendContentToTopEdge:!1,extendContentToBottomEdge:!1};function parseToolbarStyle(e){return e===`raised`||e===`raised-border`?e:Qe.topBarStyle}function toolbarBarStyleClasses(e){switch(e){case`raised`:return[`raised`];case`raised-border`:return[`raised`,`border`];default:return[]}}const $e=[`undershoot-top`,`undershoot-bottom`],et=[`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 tt=new Set;function adwaitaColorScheme(){return`light`}function onAdwaitaColorSchemeChanged(e){return tt.add(e),()=>{tt.delete(e)}}function resolvePageTitle(e,t){return e??t}const nt=/^[A-Za-z0-9_-]+$/;function normalizeIconName(e){let t=(e??``).replace(/-symbolic$/,``);return nt.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,startsSection:e.startsSection===!0,sectionTitle:e.sectionTitle??``}}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}};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 tabSearchMatches(e,t){if(t===``)return!0;let n=foldForSearch(t);return[e.title,e.tooltip,e.keyword].some(e=>e===``?!1:foldForSearch(e).includes(n))}function foldForSearch(e){return e.normalize(`NFKC`).toLocaleLowerCase()}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&&typeof e!=`string`)return this.pages.includes(e)?this.setSelectedPage(e.id,t):(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_set_selected_page`,`page_belongs_to_this_view (self, selected_page)`)),!1);let n=typeof e==`string`?e:null;if(n===null)return this.nPages>0&&this._diagnostics.push(assertionDiagnostic(`adw_tab_view_set_selected_page`,`ADW_IS_TAB_PAGE (selected_page)`)),!1;let r=this.getPagePosition(n);return r<0?(this._diagnostics.push(assertionDiagnostic(`adw_tab_view_set_selected_page`,`page_belongs_to_this_view (self, selected_page)`)),!1):this._stack.setVisibleIndex(r,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??``,keyword:e.keyword??``,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)})}setPageKeyword(e,t){return this._update(e,e=>{let n=t??``;return e.keyword===n?!1:(e.keyword=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)}};function menuActionsFor(e,t,n){let r={},visit=e=>{for(let i of e){if(i.kind!==`item`){visit(i.items);continue}let e=parseDetailedAction(i.action)?.name;if(e===void 0||e in r)continue;let a=e.indexOf(`.`),o=a>0?findActionGroup(t,e.slice(0,a),n):null;if(o===null)continue;let s=o.lookup_action(e.slice(a+1));s!==null&&(r[e]={enabled:s.enabled})}};return visit(e),r}function activateMenuItem(e,t,n){let r=parseDetailedAction(e.action);return r===null?!1:activateWidgetAction(t,r.name,n,r.target??null)}const rt=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`&&rt.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`}}function resolveBottomSheetOpen(e,t){if(e===`drag-handle`)return`ignored`;let n=resolveBottomSheetChrome(t);return n.layer!==`bottom-bar`||!n.surfaceVisible||n.bottomBarInert?`ignored`:`open`}function resolveBottomSheetChrome(e){let t=!!e.open,n=!!e.hasBottomBar,r=e.revealBottomBar??!0;return{layer:t||!n?`sheet`:`bottom-bar`,surfaceVisible:t||n&&r,bottomBarInert:!e.canOpen,dimmed:t&&(e.modal??!0)}}var BottomSheetPresentation=class{constructor(e={}){this._open=!1,this._canClose=!0,this._canOpen=!0,this._hasBottomBar=!1,this._revealBottomBar=!0,this._modal=!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}get canOpen(){return this._canOpen}get hasBottomBar(){return this._hasBottomBar}get revealBottomBar(){return this._revealBottomBar}get modal(){return this._modal}get chrome(){return resolveBottomSheetChrome(this)}setCanClose(e){let t=!!e;return t===this._canClose?!1:(this._canClose=t,!0)}setCanOpen(e){let t=!!e;return t===this._canOpen?!1:(this._canOpen=t,!0)}setHasBottomBar(e){let t=!!e;return t===this._hasBottomBar?!1:(this._hasBottomBar=t,!0)}setModal(e){let t=!!e;return t===this._modal?!1:(this._modal=t,!0)}setRevealBottomBar(e){let t=!!e;return t===this._revealBottomBar?!1:(this._revealBottomBar=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}requestOpen(e){let t=resolveBottomSheetOpen(e,this);return t===`open`&&this.setOpen(!0),t}finishClose(){return this._open?!1:(this._onClosed?.(),!0)}};const it=65535,at=`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(it,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)}};function refuse$2(e){return new UnsupportedGObjectError(e,`${e} is outside the GLib.Bytes subset (ADR 0100 § 3).`)}__name(refuse$2,`refuse`);const ot=[`slice`,`hash`,`compare`,`equal`,`unref_to_data`,`unref_to_array`,`get_region`,`toArray`];var O=class Bytes{#e;constructor(e){if(!(e instanceof Uint8Array))throw refuse$2(`new GLib.Bytes(${typeof e})`);this.#e=e.slice()}static new(e){return new Bytes(e)}static new_take(){throw refuse$2(`GLib.Bytes.new_take()`)}static new_static(){throw refuse$2(`GLib.Bytes.new_static()`)}get_size(){return this.#e.length}get_data(){return this.#e.slice()}static view(e){return e.#e}};for(let e of ot)Object.defineProperty(O.prototype,e,{value:()=>{throw refuse$2(`GLib.Bytes.${e}()`)},writable:!0,configurable:!0,enumerable:!1});function refuse$1(e){return new UnsupportedGObjectError(e,`${e} is outside the GLib.Error subset (ADR 0100 § 5).`)}__name(refuse$1,`refuse`);const st=new WeakMap,ct=new Map;function errorDomain(e,t,n){let r=Object.freeze({...n}),i={quark:t,name:e};return st.set(r,i),ct.set(t,i),r}const k=errorDomain(`Gtk.DialogError`,1001,{FAILED:0,CANCELLED:1,DISMISSED:2}),A=errorDomain(`Gio.IOErrorEnum`,1002,{FAILED:0,NOT_FOUND:1,NOT_SUPPORTED:15,CLOSED:18,CANCELLED:19,PENDING:20});function domainOf(e){let t=typeof e==`number`?ct.get(e):typeof e==`object`&&e?st.get(e):void 0;if(!t)throw refuse$1(`GLib.Error domain ${String(e)}`);return t}var GLibError=class{constructor(e,t,n){this.domain=domainOf(e).quark,this.code=t,this.message=String(n),this.stack=Error(this.message).stack??``}matches(e,t){return domainOf(e).quark===this.domain&&t===this.code}toString(){return`${domainOf(this.domain).name}: ${this.message}`}static new_literal(){throw refuse$1(`GLib.Error.new_literal()`)}copy(){throw refuse$1(`GLib.Error.copy()`)}};function asGLibError(e,t,n){return e instanceof GLibError?e:new GLibError(t,n,e instanceof Error?`${e.name}: ${e.message}`:String(e))}function refuse(e,t=`is outside the file-chooser subset`){return new UnsupportedGObjectError(e,`${e} ${t} (ADR 0100).`)}function refuseMembers(e,t,n){for(let r of n)Object.defineProperty(e,r,{value:()=>{throw refuse(`${t}.${r}()`)},writable:!0,configurable:!0,enumerable:!1})}let lt=null;function registerFileChooserDriver(e){let t=lt;return lt=e,t}function dismissedError(e=`Dismissed by user`){return new GLibError(k,k.DISMISSED,e)}function dialogFailedError(e){return new GLibError(k,k.FAILED,e)}var j=class AsyncResult{#e;#t;#n;constructor(e,t,n){this.#e=e,this.#t=t,this.#n=n}get_source_object(){return this.#e}static take(e,t,n){if(!(e instanceof AsyncResult)||e.#e!==t||e.#t!==n)throw TypeError(`${n}_finish: the result is not one of ${n}`);if(!e.#n.ok)throw e.#n.error;return e.#n.value}};function requireArgs(e,t,n){if(n<t)throw TypeError(`method ${e}: At least ${t} arguments required, but only ${n} passed`)}function isCancelled(e){let t=e;return typeof t?.is_cancelled==`function`&&t.is_cancelled()===!0}function cancelledError(){return new GLibError(A,A.CANCELLED,`Operation was cancelled`)}function runAsync(e,t,n,r,i,a){(isCancelled(n)?Promise.reject(cancelledError()):Promise.resolve().then(i)).then(e=>({ok:!0,value:e}),e=>({ok:!1,error:a(e)})).then(n=>{typeof r==`function`&&r(e,new j(e,t,n))})}const ioError=e=>asGLibError(e,A,A.FAILED),dialogError=e=>asGLibError(e,k,k.FAILED),ut=/[*?[\]]/,dt=new WeakMap;function filterState(e){let t=typeof e==`object`&&e?dt.get(e):void 0;if(!t)throw refuse(`a ${typeof e} where a Gtk.FileFilter is expected`,`is not a Gtk.FileFilter`);return t}var ft=class FileFilter{constructor(e={}){dt.set(this,{name:null,patterns:[],suffixes:[],mimeTypes:[],acceptAll:!1});for(let[t,n]of Object.entries(e))if(t===`name`)this.set_name(n);else throw refuse(`the Gtk.FileFilter '${t}' property`)}static new(){return new FileFilter}get name(){return filterState(this).name}set name(e){this.set_name(e)}get_name(){return this.name}set_name(e){filterState(this).name=e==null?null:String(e)}add_pattern(e){let t=filterState(this);if(e===`*`){t.acceptAll=!0;return}let n=e.startsWith(`*.`)?e.slice(2):null;if(n===null||n===``||ut.test(n))throw refuse(`Gtk.FileFilter.add_pattern('${e}')`,`is a glob other than '*' or '*.ext'`);t.patterns.push(n)}add_suffix(e){if(typeof e!=`string`||e===``||ut.test(e))throw refuse(`Gtk.FileFilter.add_suffix('${String(e)}')`,`is not a plain suffix`);filterState(this).suffixes.push(e)}add_mime_type(e){let t=filterState(this);if(e===`*/*`){t.acceptAll=!0;return}if(typeof e!=`string`||!/^[\w.+-]+\/(\*|[\w.+-]+)$/.test(e))throw refuse(`Gtk.FileFilter.add_mime_type('${String(e)}')`,`is not a MIME type`);t.mimeTypes.push(e)}};refuseMembers(ft.prototype,`Gtk.FileFilter`,[`add_pixbuf_formats`,`get_attributes`,`to_gvariant`,`match`,`get_strictness`,`changed`]),registerBaseClass(ft,`GtkFileFilter`,{});function fileFilterSpec(e){let{name:t,patterns:n,suffixes:r,mimeTypes:i,acceptAll:a}=filterState(e);return{name:t,patterns:[...n],suffixes:[...r],mimeTypes:[...i],acceptAll:a}}function fileFilterAccepts(e,t){if(e.acceptAll||e.patterns.length===0&&e.suffixes.length===0)return!0;let n=t.toLowerCase();return e.patterns.some(e=>t.endsWith(`.${e}`))||e.suffixes.some(e=>n.endsWith(`.${e.toLowerCase()}`))}var GioListStore=class{#e=[];#t;constructor(e={}){let t=e.item_type??e.itemType;if(t!==ft.$gtype)throw refuse(`Gio.ListStore of ${String(t?.name??t)}`,`holds no Gtk.FileFilter`);this.#t=t}get item_type(){return this.#t}get n_items(){return this.#e.length}append(e){filterState(e),this.#e.push(e)}get_n_items(){return this.#e.length}get_item(e){return this.#e[e]??null}get_item_type(){return this.#t}};refuseMembers(GioListStore.prototype,`Gio.ListStore`,[`insert`,`insert_sorted`,`remove`,`remove_all`,`splice`,`sort`,`find`,`find_with_equal_func`,`items_changed`]);const pt=Object.freeze({NONE:0,PRIVATE:1,REPLACE_DESTINATION:2}),mt=new WeakMap;function streamState(e){let t=mt.get(e);if(!t)throw refuse(`Gio.OutputStream`,`is only made by Gio.File.replace_async`);return t}function streamOp(e,t,n){return async()=>{let r=streamState(e);if(r.closed)throw new GLibError(A,A.CLOSED,`Stream is already closed`);if(r.pending)throw new GLibError(A,A.PENDING,`Stream has outstanding operation`);r.pending=!0;try{let e=await n(r.writer);return t&&(r.closed=!0),e}finally{r.pending=!1}}}var OutputStream=class{constructor(e){mt.set(this,{writer:e,closed:!1,pending:!1})}write_bytes_async(e,t,n,r){if(requireArgs(`Gio.OutputStream.write_bytes_async`,4,arguments.length),!(e instanceof O))throw refuse(`write_bytes_async of a non-GLib.Bytes`,`is not a GLib.Bytes`);let i=O.view(e),a=streamOp(this,!1,async e=>(await e.write(i),i.length));runAsync(this,`write_bytes`,n,r,a,ioError)}write_bytes_finish(e){return j.take(e,this,`write_bytes`)}close_async(e,t,n){requireArgs(`Gio.OutputStream.close_async`,3,arguments.length);let r=streamOp(this,!0,async e=>(await e.close(),!0));runAsync(this,`close`,t,n,r,ioError)}close_finish(e){return j.take(e,this,`close`)}is_closed(){return streamState(this).closed}},FileOutputStream=class extends OutputStream{};refuseMembers(OutputStream.prototype,`Gio.OutputStream`,[`write`,`write_all`,`write_bytes`,`write_async`,`write_all_async`,`writev`,`splice`,`splice_async`,`flush`,`flush_async`,`close`,`printf`]),refuseMembers(FileOutputStream.prototype,`Gio.FileOutputStream`,[`seek`,`truncate`,`query_info`,`get_etag`]);const ht=new WeakMap;function handleOf(e){let t=ht.get(e);if(!t)throw refuse(`Gio.File`,`is only made by Gtk.FileDialog`);return t}function checkReplaceArgs(e,t,n,r){if(t!=null)throw refuse(`${e} with an etag`);if(n!==!1)throw refuse(`${e} with make_backup`);if(r!==pt.NONE)throw refuse(`${e} with flags ${String(r)}`)}var GioFile=class{constructor(e){ht.set(this,e)}static new_for_path(){throw refuse(`Gio.File.new_for_path()`,`names a path, and a page or an Android app has none`)}static new_for_uri(){throw refuse(`Gio.File.new_for_uri()`,`names a URI the platform cannot open`)}static new_for_commandline_arg(){throw refuse(`Gio.File.new_for_commandline_arg()`)}get_basename(){return handleOf(this).basename}get_path(){return handleOf(this),null}get_uri(){let{uri:e}=handleOf(this);if(e===void 0)throw refuse(`Gio.File.get_uri()`,`has no URI to give on this platform`);return e}load_contents_async(e,t){requireArgs(`Gio.File.load_contents_async`,2,arguments.length);let n=handleOf(this);runAsync(this,`load_contents`,e,t,()=>n.read(),ioError)}load_contents_finish(e){return[!0,j.take(e,this,`load_contents`),null]}replace_contents_async(e,t,n,r,i,a){requireArgs(`Gio.File.replace_contents_async`,6,arguments.length),checkReplaceArgs(`Gio.File.replace_contents_async`,t,n,r);let o=e instanceof O?O.view(e):e;if(!(o instanceof Uint8Array))throw refuse(`replace_contents_async of a non-Uint8Array`);let s=o.slice(),c=handleOf(this),work=async()=>{let e=await c.openWriter();await e.write(s),await e.close()};runAsync(this,`replace_contents`,i,a,work,ioError)}replace_contents_finish(e){return j.take(e,this,`replace_contents`),[!0,null]}replace_async(e,t,n,r,i,a){requireArgs(`Gio.File.replace_async`,6,arguments.length),checkReplaceArgs(`Gio.File.replace_async`,e,t,n);let o=handleOf(this),work=async()=>new FileOutputStream(await o.openWriter());runAsync(this,`replace`,i,a,work,ioError)}replace_finish(e){return j.take(e,this,`replace`)}};refuseMembers(GioFile.prototype,`Gio.File`,`read.read_async.load_contents.load_bytes.load_bytes_async.replace.replace_contents.create.create_async.append_to.append_to_async.query_info.query_info_async.query_exists.query_file_type.delete.delete_async.trash.move.move_async.copy.copy_async.get_parent.get_child.resolve_relative_path.enumerate_children.enumerate_children_async.make_directory.monitor.monitor_file.monitor_directory.equal.hash.dup`.split(`.`));const gt=new Set([`title`,`modal`,`filters`,`initial_name`,`default_filter`]),_t=[`initial_folder`,`initial_file`,`accept_label`],snake=e=>e.replace(/-/g,`_`).replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`);var vt=class FileDialog{#e=null;#t=!0;#n=null;#r=null;#i=null;constructor(e={}){for(let[t,n]of Object.entries(e)){let e=snake(t);if(!gt.has(e))throw refuse(`the Gtk.FileDialog '${e}' property`);this[e]=n}}static new(){return new FileDialog}get title(){return this.#e}set title(e){this.#e=e==null?null:String(e)}get_title(){return this.#e}set_title(e){this.title=e}get modal(){return this.#t}set modal(e){if(e!==!0)throw refuse(`Gtk.FileDialog modal: false`,`cannot open non-modally on this platform`);this.#t=!0}get_modal(){return this.#t}set_modal(e){this.modal=e}get filters(){return this.#n}set filters(e){if(e!==null&&!(e instanceof GioListStore))throw refuse(`Gtk.FileDialog filters of another type`);this.#n=e}get_filters(){return this.#n}set_filters(e){this.filters=e}get initial_name(){return this.#r}set initial_name(e){this.#r=e==null?null:String(e)}get initialName(){return this.initial_name}set initialName(e){this.initial_name=e}get_initial_name(){return this.#r}set_initial_name(e){this.initial_name=e}get default_filter(){return this.#i}set default_filter(e){e!==null&&filterState(e),this.#i=e}get defaultFilter(){return this.default_filter}set defaultFilter(e){this.default_filter=e}get_default_filter(){return this.#i}set_default_filter(e){this.default_filter=e}open(e,t,n){requireArgs(`Gtk.FileDialog.open`,3,arguments.length),this.#a(`open`,e,t,n)}open_finish(e){return j.take(e,this,`open`)}save(e,t,n){requireArgs(`Gtk.FileDialog.save`,3,arguments.length),this.#a(`save`,e,t,n)}save_finish(e){return j.take(e,this,`save`)}#a(e,t,n,r){let i=this.#o(t),work=async()=>{if(!lt)throw dialogFailedError(`No file chooser driver is registered on this platform`);return new GioFile(await lt[e](i))};runAsync(this,e,n,r,work,dialogError)}#o(e){let t=[],n=this.#n;for(let e=0;n&&e<n.get_n_items();e++)t.push(fileFilterSpec(n.get_item(e)));return{title:this.#e,filters:t,defaultFilter:this.#i?fileFilterSpec(this.#i):null,initialName:this.#r,parent:e}}};refuseMembers(vt.prototype,`Gtk.FileDialog`,[`open_multiple`,`open_multiple_finish`,`open_multiple_text_files`,`open_multiple_text_files_finish`,`open_text_file`,`open_text_file_finish`,`save_text_file`,`save_text_file_finish`,`select_folder`,`select_folder_finish`,`select_multiple_folders`,`select_multiple_folders_finish`,`set_initial_folder`,`get_initial_folder`,`set_initial_file`,`get_initial_file`,`set_accept_label`,`get_accept_label`]);for(let e of _t)Object.defineProperty(vt.prototype,e,{get(){throw refuse(`the Gtk.FileDialog '${e}' property`,`names a folder or label the platform does not take`)},set(){throw refuse(`the Gtk.FileDialog '${e}' property`,`names a folder or label the platform does not take`)},configurable:!0,enumerable:!1});registerBaseClass(vt,`GtkFileDialog`,{});const yt=[`text/plain;charset=utf-8`,`text/plain`];var ContentFormats$1=class{static{__name(this,`ContentFormats`)}#e;#t;constructor(e,t){this.#e=e,this.#t=t}to_string(){return[...this.#e.map(e=>e.name),...this.#t].join(` `)}contain_gtype(e){return this.#e.includes(e)}contain_mime_type(e){return this.#t.includes(e)}},bt=class ContentProvider{#e;#t;constructor(e,t){this.#e=e,this.#t=t}static new_for_value(e){let t=readValue(e);return t?new ContentProvider(t.type,t.string):null}ref_formats(){return new ContentFormats$1([this.#e],[])}static text(e){return e.#t}};const xt=new ContentFormats$1([],[]);var Clipboard$1=class{static{__name(this,`Clipboard`)}#e;#t=null;constructor(e){this.#e=e}set_content(e){this.#t=e;let t=e?bt.text(e):null;return t!==null&&this.#n(t),!0}set(e){this.set_content(bt.new_for_value(stringValue(e)))}get_formats(){if(!this.#t)return xt;let e=this.#t.ref_formats();return e.contain_gtype(f)?new ContentFormats$1([f],yt):e}#n(e){try{let t=this.#e.writeText(e);t&&typeof t.then==`function`&&t.then(void 0,e=>console.warn(`Gdk.Clipboard: publishing failed:`,e))}catch(e){console.warn(`Gdk.Clipboard: publishing failed:`,e)}}},Display$1=class{static{__name(this,`Display`)}#e;constructor(e){this.#e=new Clipboard$1(e)}get_clipboard(){return this.#e}};function createGdk(e){let t=new Display$1(e);return{Display:{get_default:()=>t},Clipboard:Clipboard$1,ContentProvider:bt,ContentFormats:ContentFormats$1}}function stringValue(e){let t=new Value$1().init(f);return t.set_string(e),t}function widgetDisplayMembers(e){return{get_display:()=>e.Display.get_default(),get_clipboard:()=>e.Display.get_default().get_clipboard()}}function checkPriority(e,t){if(typeof t!=`number`||!Number.isInteger(t))throw TypeError(`${e}: priority has to be an integer, got ${String(t)}`)}function checkCallback(e,t){if(typeof t!=`function`)throw TypeError(`${e}: expected function for callback argument function, got ${String(t)}`)}function runSource(e){try{return!!e()}catch(e){return console.error(`JS ERROR:`,e),!1}}const St={setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e)};function createGLibTimers(e=St){let t=1,n=new Map,r=new Map,i,schedulePump=()=>{i!==void 0||r.size===0||(i=e.setTimeout(dispatchIdles,0))};function dispatchIdles(){i=void 0;let e=1/0;for(let t of r.values())e=Math.min(e,t.priority);let t=[...r].filter(([,t])=>t.priority===e);try{for(let[e,n]of t)r.has(e)&&(runSource(n.run)||r.delete(e))}finally{schedulePump()}}return{PRIORITY_HIGH:-100,PRIORITY_DEFAULT:0,PRIORITY_HIGH_IDLE:100,PRIORITY_DEFAULT_IDLE:200,PRIORITY_LOW:300,SOURCE_REMOVE:!1,SOURCE_CONTINUE:!0,idle_add(e,n){checkPriority(`GLib.idle_add`,e),checkCallback(`GLib.idle_add`,n);let i=t++;return r.set(i,{priority:e,run:n}),schedulePump(),i},timeout_add(r,i,a){if(checkPriority(`GLib.timeout_add`,r),typeof i!=`number`||!Number.isInteger(i)||i<0)throw TypeError(`GLib.timeout_add: interval has to be a non-negative integer, got ${String(i)}`);checkCallback(`GLib.timeout_add`,a);let o=t++,arm=()=>{n.set(o,e.setTimeout(tick,i))};function tick(){runSource(a)&&n.has(o)?arm():n.delete(o)}return arm(),o},source_remove(t){return n.has(t)?(e.clearTimeout(n.get(t)),n.delete(t),!0):r.delete(t)?!0:(console.warn(`GLib-CRITICAL: Source ID ${String(t)} was not found when attempting to remove it`),!1)}}}function gridColumns(e,t=1){if(e.length===0)return 0;let n=e[0],r=1;for(;r<e.length&&Math.abs(e[r]-n)<=t;)r++;return r}function gridNavigate(e,t,n,r){if(n<=0||t<0||t>=n)return null;let i=Math.max(1,Math.floor(r)),a;switch(e){case`ArrowLeft`:a=t-1;break;case`ArrowRight`:a=t+1;break;case`ArrowUp`:a=t-i;break;case`ArrowDown`:a=t+i;break;case`Home`:a=0;break;case`End`:a=n-1;break;default:return null}return a<0||a>=n||a===t?null:a}var GtkAdjustment=class{constructor(e){let t=normalizeAdjustment(e);this.value=t.value,this.lower=t.lower,this.upper=t.upper,this.stepIncrement=t.stepIncrement,this.pageIncrement=t.pageIncrement,this.pageSize=t.pageSize}_write(e){let t=normalizeAdjustment(e,this);this.value=t.value,this.lower=t.lower,this.upper=t.upper,this.stepIncrement=t.stepIncrement,this.pageIncrement=t.pageIncrement,this.pageSize=t.pageSize}configure(e,t,n,r,i,a){this._write({value:e,lower:t,upper:n,stepIncrement:r,pageIncrement:i,pageSize:a})}get_value(){return this.value}set_value(e){this._write({value:e})}get_lower(){return this.lower}set_lower(e){this._write({lower:e})}get_upper(){return this.upper}set_upper(e){this._write({upper:e})}get_step_increment(){return this.stepIncrement}set_step_increment(e){this._write({stepIncrement:e})}get_page_increment(){return this.pageIncrement}set_page_increment(e){this._write({pageIncrement:e})}get_page_size(){return this.pageSize}set_page_size(e){this._write({pageSize:e})}get_minimum_increment(){return Math.min(this.stepIncrement,this.pageIncrement)}},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)}};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)}}):[]}function parseListModel(e){if(!e)return[];try{return normalizeComboOptions(JSON.parse(e))}catch{return[]}}function clampListSelection(e,t){return Number.isFinite(e)&&e>=0&&e<t?e:t===0?-1:0}function sameItem(e,t){return e!==void 0&&t!==void 0&&e.value===t.value&&e.label===t.label}function listItemsChanged(e,t){let n=e??[],r=t??[],i=Math.min(n.length,r.length),a=0;for(;a<i&&sameItem(n[a],r[a]);)a++;let o=0;for(;o<i-a&&sameItem(n[n.length-1-o],r[r.length-1-o]);)o++;let s=n.length-a-o,c=r.length-a-o;return s===0&&c===0?null:{position:a,removed:s,added:c}}const Ct=new Set([`none`,`single`,`multiple`]);function normalizeListSelectionMode(e){return typeof e==`string`&&Ct.has(e)?e:`single`}function normalizeSelection(e,t){let n=new Set;for(let r of e)Number.isInteger(r)&&r>=0&&r<t&&n.add(r);return[...n].sort((e,t)=>e-t)}function listViewSelect(e,t,n,r,i,a={}){let o=normalizeSelection(e,r);if(i===`none`)return{selection:[],anchor:t};if(!Number.isInteger(n)||n<0||n>=r)return{selection:o,anchor:t};let s=new Set(o);if(i===`multiple`&&a.extend&&t>=0&&t<r){let e=Math.min(t,n),i=Math.max(t,n),o=[];for(let t=e;t<=i;t++)o.push(t);if(a.modify)if(s.has(t))for(let e of o)s.add(e);else for(let e of o)s.delete(e);else{s.clear();for(let e of o)s.add(e)}return{selection:normalizeSelection(s,r),anchor:n}}return a.modify?s.has(n)?i===`multiple`&&s.delete(n):(i===`multiple`||s.clear(),s.add(n)):(s.clear(),s.add(n)),{selection:normalizeSelection(s,r),anchor:n}}function listViewSelectAll(e,t){return t===`multiple`?Array.from({length:e},(e,t)=>t):[]}var ListViewState=class{constructor(){this._model=[],this._selection=[],this._anchor=-1,this._mode=`single`,this._itemListeners=new Set,this._selectionListeners=new Set}subscribeItems(e){return this._itemListeners.add(e),()=>{this._itemListeners.delete(e)}}subscribeSelection(e){return this._selectionListeners.add(e),()=>{this._selectionListeners.delete(e)}}get model(){return this._model.map(e=>({value:e.value,label:e.label}))}get count(){return this._model.length}get selection(){return[...this._selection]}get selectionMode(){return this._mode}setModel(e){let t=Array.isArray(e)?e:[],n=listItemsChanged(this._model,t);this._model=t.map(e=>({value:e.value,label:e.label}));let r=normalizeSelection(this._selection,this._model.length),i=r.length!==this._selection.length;if(this._selection=r,this._anchor>=this._model.length&&(this._anchor=-1),n)for(let e of[...this._itemListeners])e(n);i&&this._emitSelection(!1)}setSelectionMode(e){e!==this._mode&&(this._mode=e,e===`none`&&this._selection.length>0?(this._selection=[],this._emitSelection(!1)):e===`single`&&this._selection.length>1&&(this._selection=this._selection.includes(this._anchor)?[this._anchor]:[this._selection[0]],this._emitSelection(!1)))}isSelected(e){return this._selection.includes(e)}selectItem(e,t={},n=!0){let r=listViewSelect(this._selection,this._anchor,e,this._model.length,this._mode,t);return this._anchor=r.anchor,this._applySelection(r.selection,n)}selectAll(e=!1){return this._applySelection(listViewSelectAll(this._model.length,this._mode),e)}unselectAll(e=!1){return this._applySelection([],e)}setSelection(e,t=!1){let n=normalizeSelection(e,this._model.length),r=this._mode===`none`?[]:this._mode===`single`?n.slice(0,1):n;return r.length>0&&(this._anchor=r[r.length-1]),this._applySelection(r,t)}itemContext(e){let t=this._model[e];return t===void 0?null:{item:{value:t.value,label:t.label},position:e,selected:this.isSelected(e)}}_applySelection(e,t){return e.length===this._selection.length&&e.every((e,t)=>e===this._selection[t])?!1:(this._selection=e,this._emitSelection(t),!0)}_emitSelection(e){let t={selection:[...this._selection],interactive:e};for(let e of[...this._selectionListeners])e(t)}};function gridViewColumns(e,t,n,r=1,i=7){let a=Math.max(1,Math.floor(r)),o=Math.max(1,Math.floor(i)),s=Math.floor((e+n)/Math.max(1,t+n));return Math.min(Math.max(s,a),Math.max(a,o))}function listItemField(e,t){return t===`value`?e.value:e.label}function normalizeColumnViewColumns(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&`key`in e).map(e=>{let t=e.key===`value`?`value`:`label`;return{key:t,title:e.title===void 0?t:String(e.title),id:e.id===void 0?t:String(e.id),expand:e.expand===!0,fixedWidth:typeof e.fixedWidth==`number`?e.fixedWidth:-1,visible:e.visible!==!1,sortable:e.sortable===!0}}):[]}function parseColumnViewColumns(e){if(!e)return[];try{return normalizeColumnViewColumns(JSON.parse(e))}catch{return[]}}function columnViewSort(e,t){if(t.sortable!==!0)return e;let n=t.id??t.key;return e!==null&&e.column===n?{column:n,descending:!e.descending}:{column:n,descending:!1}}function columnViewTracks(e){return e.filter(e=>e.visible!==!1).map(e=>{let t=e.fixedWidth??-1;return t>0?{kind:`fixed`,css:`${t}px`}:e.expand===!0?{kind:`flex`,weight:1}:{kind:`auto`}})}const wt={indents:0,expander:`none`,level:1};function treeExpanderLayout(e,t={}){if(!e)return wt;let n=t.indentForDepth!==!1,r=t.indentForIcon!==!1,i=t.hideExpander===!0,a=n?Math.max(0,Math.floor(e.depth)):0,o=e.expandable&&!i;return!o&&r&&a++,{indents:a,expander:o?e.expanded?`expanded`:`collapsed`:`none`,level:a+1}}function treeExpanderAction(e,t={}){if(e===`+`||e===`*`)return`expand`;if(e===`-`||e===`/`)return`collapse`;if(e===` `&&t.ctrlKey===!0)return`toggle`;if(t.shiftKey!==!0)return`none`;let n=t.rtl===!0;return e===`ArrowRight`?n?`collapse`:`expand`:e===`ArrowLeft`?n?`expand`:`collapse`:`none`}function treeExpanderExpanded(e,t){switch(t){case`expand`:return!0;case`collapse`:return!1;case`toggle`:return!e;case`none`:return e}}var 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)}},ComboState=class{constructor(){this._options=[],this._selected=0,this._listeners=new Set,this._itemListeners=new Set}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}subscribeItems(e){return this._itemListeners.add(e),()=>{this._itemListeners.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 model(){return this._options.map(e=>({value:e.value,label:e.label}))}setModel(e){let t=this._options,n=Array.isArray(e)?e:[],r=listItemsChanged(t,n);if(this._options=n.map(e=>({value:e.value,label:e.label})),this._selected=clampListSelection(this._selected,n.length),r)for(let e of[...this._itemListeners])e(r);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}},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 keptToggles(e){let t=new Set,n=[];for(let r of e){let e=r.name??null;e!==null&&t.has(e)||(e!==null&&t.add(e),n.push(r))}return n}function toggleIndexOfName(e,t){return e.indexOf(t)}const Tt=new Set([`markup`,`span`,`b`,`big`,`i`,`s`,`sub`,`sup`,`small`,`tt`,`u`]),Et=new Map([[`amp`,`&`],[`lt`,`<`],[`gt`,`>`],[`quot`,`"`],[`apos`,`'`]]),Dt=/[A-Za-z_:]/,Ot=/[A-Za-z0-9._:-]/,kt=/[ \t\r\n]/;function escapeMarkup(e){let t=``;for(let n of e)switch(n){case`&`:t+=`&amp;`;break;case`<`:t+=`&lt;`;break;case`>`:t+=`&gt;`;break;case`'`:t+=`&#39;`;break;case`"`:t+=`&#34;`;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=Et.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||!Dt.test(e[n]))return null;let i=n;for(;n<e.length&&Ot.test(e[n]);)n+=1;let a=e.slice(i,n),o={},s=!1;for(;n<e.length;){for(;n<e.length&&kt.test(e[n]);)n+=1;let t=e[n];if(t===void 0)return null;if(t===`>`)return{name:a,closing:r,selfClosing:s,attributes:o,next:n+1};if(t===`/`)return r||e[n+1]!==`>`?null:(s=!0,{name:a,closing:r,selfClosing:s,attributes:o,next:n+2});if(r||!Dt.test(t))return null;let i=n;for(;n<e.length&&Ot.test(e[n]);)n+=1;let c=e.slice(i,n);for(;n<e.length&&kt.test(e[n]);)n+=1;if(e[n]!==`=`)return null;for(n+=1;n<e.length&&kt.test(e[n]);)n+=1;let l=e[n];if(l!==`"`&&l!==`'`)return null;let u=e.indexOf(l,n+1);if(u<0)return null;let d=decodeEntities$1(e.slice(n+1,u));if(d===null)return null;o[c]=d,n=u+1}return null}function decodeEntities$1(e){if(!e.includes(`&`))return e;let t=``,n=0;for(;n<e.length;){let r=e.indexOf(`&`,n);if(r===-1){t+=e.slice(n);break}t+=e.slice(n,r);let i=readEntity(e,r);if(!i)return null;t+=i.value,n=i.next}return t}__name(decodeEntities$1,`decodeEntities`);function parsePangoMarkup(e){let t=[],n=[],r=``,i=0,current=()=>n.length>0?n[n.length-1].children:t,flush=()=>{if(r===``)return;let e=current(),t=e[e.length-1];t!==void 0&&t.kind===`text`?e[e.length-1]={kind:`text`,text:t.text+r}:e.push({kind:`text`,text:r}),r=``};for(;i<e.length;){let t=e[i];if(t===`&`){let t=readEntity(e,i);if(!t)return null;r+=t.value,i=t.next;continue}if(t!==`<`){r+=t,i+=1;continue}let a=passthroughEnd(e,i);if(a){let t=e.indexOf(a.terminator,i+2);if(t<0)return null;i=t+a.terminator.length;continue}let o=readTag(e,i);if(!o||!Tt.has(o.name)||Object.keys(o.attributes).length>0&&o.name!==`span`)return null;if(flush(),o.closing){let e=n.pop();if(e===void 0||e.tag!==o.name)return null;current().push({kind:`element`,...e})}else o.selfClosing||n.push({tag:o.name,attributes:o.attributes,children:[]});i=o.next}return n.length>0?null:(flush(),t)}function stripMarkup(e){let t=parsePangoMarkup(e);if(t===null)return null;let n=``,r=[...t].reverse();for(;r.length>0;){let e=r.pop();if(e.kind===`text`)n+=e.text;else for(let t=e.children.length-1;t>=0;--t)r.push(e.children[t])}return n}const At=[`left`,`right`,`center`,`fill`];function labelDisplayText(e,t,n){let r=e??``,i=t?stripMarkup(r)??r:r;return n?stripMnemonic(i):i}function normalizeLabelXalign$1(e){let t=typeof e==`number`?e:Number.parseFloat(String(e??``));return Number.isFinite(t)?glibClamp(t,0,1):.5}__name(normalizeLabelXalign$1,`normalizeLabelXalign`);function normalizeLabelJustify(e){return At.includes(e)?e:`left`}function normalizeLabelYalign(e){let t=typeof e==`number`?e:Number.parseFloat(String(e??``));return Number.isFinite(t)?glibClamp(t,0,1):.5}function labelYalignAlignItems(e){return e<.25?`flex-start`:e>.75?`flex-end`:`center`}const jt=[`none`,`start`,`middle`,`end`];function normalizeLabelEllipsize(e){return jt.includes(e)?e:`none`}function labelEllipsizeOverflowValue(e){return e===`none`?`clip`:`ellipsis`}const Mt=[`word`,`char`,`word-char`];function normalizeLabelWrapMode(e){return Mt.includes(e)?e:`word`}function normalizeLabelCharCount(e,t){let n=typeof e==`number`?e:Number.parseInt(String(e??``),10);return Number.isFinite(n)?Math.max(t,Math.trunc(n)):t}function normalizeLabelWidthChars(e){return normalizeLabelCharCount(e,-1)}function normalizeLabelMaxWidthChars(e){return normalizeLabelCharCount(e,-1)}function normalizeLabelLines(e){return normalizeLabelCharCount(e,-1)}function labelEffectiveLines(e,t){return t===`none`?null:e>0?e:1}function labelWidthCharsExtent(e,t){return{minCh:e>=0?e:null,maxCh:t>=0?Math.max(e,t):null}}const Nt=[0,1,2],Pt=new WeakMap;function syncDirection(e){let t=Pt.get(e);t===void 0||!e.isConnected||(t===0?e.removeAttribute(`dir`):e.dir=t===2?`rtl`:`ltr`)}function widgetTreeMembers(){return{set_direction(e){if(!Nt.includes(e))throw TypeError(`${e} is not a valid value for enum argument dir`);Pt.set(this,e),syncDirection(this)},get_direction(){return Pt.get(this)??1},get_first_child(){return this.firstElementChild},get_last_child(){return this.lastElementChild},get_next_sibling(){return this.nextElementSibling},get_prev_sibling(){return this.previousElementSibling},get_parent(){return this.parentElement},add_css_class(e){this.classList.add(e)},remove_css_class(e){this.classList.remove(e)},has_css_class(e){return this.classList.contains(e)},insert_action_group(e,t){insertActionGroup(this,e,t)}}}const Ft=`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=Ft){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 It=1200,Lt=Math.PI*.35,Rt=Math.PI*.015,M=Math.PI*.9,zt=Math.PI*.9,Bt=Math.PI*.7,N=Math.PI*1.1,Vt=Math.PI*1.35,P=zt+N+Vt-Bt;53*Math.PI*2/P;const Ht=N-Bt/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%P,n=t>N?1:easeInOutSine(t/N);return adwLerp(Rt,M,n)-t*M/P}function spinnerArcEnd(e){let t=e%P,n=N-Bt,r;return r=t<n?0:t>P-zt?1:easeInOutSine((t-n)/Vt),adwLerp(0,M-Rt,r)-t*M/P}function spinnerArc(e){let t=e,n=normalizeSpinnerAngle(t+spinnerArcStart(t)+Lt),r=normalizeSpinnerAngle(t+spinnerArcEnd(t)+Lt),i=n-r;for(;i<=0;)i+=Math.PI*2;return{start:n,end:r,length:i}}function spinnerProgressAt(e){let t=It*53;return(e%t+t)%t/It*Math.PI*2}const Ut={shift:`shift`,shft:`shift`,control:`control`,ctrl:`control`,ctl:`control`,alt:`alt`,mod1:`alt`,meta:`meta`,super:`super`,hyper:`hyper`,primary:`primary`},Wt=[`hyper`,`super`,`control`,`alt`,`shift`,`meta`],Gt={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:`⌘`}},Kt={Shift:`shift`,Control:`control`,Alt:`alt`,Meta:`meta`,Super:`super`,Hyper:`hyper`},qt={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:`~`},Jt={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=Ut[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&&Kt[n[1]]){let e=Kt[n[1]];return{label:Gt[e][t],sideMarker:n[2]}}let r=Jt[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 qt[e]??null}function shortcutKeycaps(e,t=`default`){let n=parseAccelerator(e,t);if(!n)return null;let r=[];for(let e of Wt)n.modifiers.has(e)&&r.push({label:Gt[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 Yt=[`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 Yt.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 F={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(F.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(F.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(F.sidebarTagCollision(t)),this._sidebarTag=null,!1):!0):(this._contentTag=t,tagsConflict(this._sidebarTag,this._contentTag)?(this._critical(F.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(F.alreadyInStack(e.tag)),e;default:return this._handlers.onDelegate?.(t,n)||t===`pop`?e:(this._critical(F.notFound(n??``)),{kind:`not-found`,tag:n??``})}}};const Xt={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??Xt}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 Zt={none:`open-menu-symbolic`,down:`pan-down-symbolic`,up:`pan-up-symbolic`,left:`pan-start-symbolic`,right:`pan-end-symbolic`,none:`pan-down-symbolic`},Qt=[`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 Zt[e]??Zt.down}function splitButtonPopupDirection(e){return e===`none`||!Qt.includes(e)?`down`:e}const $t=splitButtonPopupDirection;function isSplitButtonDirection(e){return typeof e==`string`&&Qt.includes(e)}function splitButtonRootState(e,t){return{active:e.active||t.active||e.keyboardActivating||t.keyboardActivating,checked:e.checked||t.checked}}const menuKey=e=>e===null?``:JSON.stringify(e);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=normalizeMenuModel(e),n=t.length>0?t:null;if(menuKey(n)===menuKey(this._menuModel))return!1;let r=n===null?null:derivedPopover(),i=[];return r!==this._popover&&i.push(`popover`),i.push(`menu-model`),this._menuModel=n,this._popover=r,this.dropdownEnabled||(this._open=!1),this._emit(i,!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)}activateMenuItem(e){if(this._menuModel===null)return null;let t=menuItemAt(this._menuModel,e);return t===null?null:(this._setOpen(!1,!0),t)}};function menuAssignments(e,t){let n=[],r=e.props?.[`menu-model`];if(r!==void 0){let i=typeof r==`string`?t?.[r]:void 0;if(i===void 0)throw Error(`${e.tag} menu-model: ${JSON.stringify(r)} names no menu: the file declares [${Object.keys(t??{}).join(`, `)}] (ADR 0097 § 1).`);n.push([`menu-model`,normalizeMenuModel(i)])}for(let[t,r]of Object.entries(e.menuModels??{}))n.push([t,normalizeMenuModel(r)]);return n}const en=[`narrow`,`wide`],tn=[`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,startsSection:e.startsSection??!1,sectionTitle:e.sectionTitle??null}}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,startsSection:e.startsSection,sectionTitle:e.sectionTitle})}function viewSwitcherPagesFromStack(e){return e.map(e=>viewSwitcherPageFromStackPage(e))}function viewSwitcherSidebarSections(e){let t=[];for(let n of e)t.length===0||n.startsSection===!0?t.push({title:n.sectionTitle??``,pages:[n]}):t[t.length-1].pages.push(n);return t}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 nn={attentionRequested:`Attention requested.`,badgeOverflow:`Has a badge: more than 999.`,badge:e=>`Has a badge: ${e}.`};function viewSwitcherIndicatorDescription(e,t,n=nn){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=nn){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=nn){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))}const rn=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+=rn.get(n)??foldCherokee(e)??n}return t};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 an=[`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 sn=[`none`,`fill`,`spread`],cn=[`minimum`,`natural`],ln=[`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 sn.includes(e)?e:`none`}function normalizeWrapPolicy(e){return cn.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 ln.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)]}new Set(`ADC.AND.ASL.BCC.BCS.BEQ.BIT.BMI.BNE.BPL.BRK.BVC.BVS.CLC.CLD.CLI.CLV.CMP.CPX.CPY.DEC.DEX.DEY.EOR.INC.INX.INY.JMP.JSR.LDA.LDX.LDY.LSR.NOP.ORA.PHA.PHP.PLA.PLP.ROL.ROR.RTI.RTS.SBC.SEC.SED.SEI.STA.STX.STY.TAX.TAY.TSX.TXA.TXS.TYA`.split(`.`));var WindowMemberState=class{constructor(e,t={}){this._active=!1,this._focus=null,this._notify=e,this._maximized=t.maximized??!1}get active(){return this._active}get maximized(){return this._maximized}get focus(){return this._focus}reportActive(e){return this._active===e?!1:(this._active=e,this._notify(`is-active`),!0)}reportMaximized(e){return this._maximized===e?!1:(this._maximized=e,this._notify(`maximized`),!0)}reportFocus(e){return this._focus===e?!1:(this._focus=e,this._notify(`focus-widget`),!0)}},CloseRequestState=class{constructor(){this._emitting=!1}get emitting(){return this._emitting}close(e){if(!e.realized||this._emitting)return`ignored`;let t;this._emitting=!0;try{e.emit()?t=`handled`:e.hideOnClose?(e.hide(),t=`hidden`):t=`destroyed`}finally{this._emitting=!1}return t===`destroyed`&&e.destroy(),t}};const un={DEFAULT:0,FORCE_LIGHT:1,PREFER_LIGHT:2,PREFER_DARK:3,FORCE_DARK:4},dn=new WeakMap,fn=new WeakMap,pn=new WeakMap;function refresh(e){if(!dn.has(e))return;let t=sourceOf(e).dark();dn.get(e)!==t&&(dn.set(e,t),e.notify(`dark`))}function sourceOf(e){let t=e.constructor.source;if(t===void 0)throw Error(`Adw.StyleManager: this class has no StyleSource; use the Adw.StyleManager of a port.`);return t}var StyleManagerBase=class extends GObjectObject$1{static{this[C]=`Adw.StyleManager`}static get_default(){let e=fn.get(this);if(e===void 0){e=new this,fn.set(this,e);let t=sourceOf(e);dn.set(e,t.dark()),t.subscribe(()=>refresh(e))}return e}get dark(){return sourceOf(this).dark()}get_dark(){return this.dark}get color_scheme(){return pn.get(this)??un.DEFAULT}set color_scheme(e){if(!Object.values(un).includes(e))throw Error(`Adw.StyleManager: ${e} is not an Adw.ColorScheme`);if(e===this.color_scheme)return;pn.set(this,e);let t=e===un.FORCE_DARK?!0:e===un.FORCE_LIGHT?!1:null;sourceOf(this).force?.(t),this.notify(`color-scheme`),refresh(this)}get_color_scheme(){return this.color_scheme}set_color_scheme(e){this.color_scheme=e}};registerBaseClass(StyleManagerBase,`AdwStyleManager`,{},[b.boolean(`dark`,``,``,y.READABLE,!1),b.int(`color-scheme`,``,``,y.READWRITE,0,4,0)]);const mn=`--accent-bg-color`,hn=`--accent-color`;function isAdwaitaDark(e){return e.closest(`.theme-dark`)?!0:e.closest(`.theme-light`)?!1:globalThis.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1}const gn=new WeakSet;function hasAppChosenAccent(e){return gn.has(e)}function writeAdwaitaAccent(e,t,n){t.style.setProperty(mn,adwaitaAccentBgColor(e)),t.style.setProperty(hn,adwaitaAccentColor(e,n))}function applyAdwaitaAccent(e,t={}){let n=t.target??document.documentElement;gn.add(n),writeAdwaitaAccent(e,n,t.dark??isAdwaitaDark(n))}function clearAdwaitaAccent(e=document.documentElement){gn.delete(e),e.style.removeProperty(mn),e.style.removeProperty(hn)}let I={},_n=!1,L=null,vn=!1;function readSystemAccent(){if(typeof CSS>`u`||!CSS.supports(`color`,`AccentColor`))return null;let e=document.createElement(`span`);e.style.color=`AccentColor`,e.style.display=`none`,document.documentElement.append(e);let t=getComputedStyle(e).color;e.remove();let n=parseAdwRgb(t);return n?{accent:nearestAccent(n),accentRgb:formatAdwRgb(n)}:null}function resolve(){if(I.accent&&I.accent!==Ce)return{accent:I.accent,source:`handoff`};let e=I.accentRgb?parseAdwRgb(I.accentRgb):null;if(e)return{accent:nearestAccent(e),source:`handoff`};if(I.accent===Ce){let e=readSystemAccent();if(e)return{accent:e.accent,source:`system`}}return null}function syncScheme(e){let t=I.colorScheme,n=t===`dark`?`theme-dark`:t===`light`?`theme-light`:null;n!==L&&(L&&e.classList.remove(L),L=null,n&&!e.classList.contains(`theme-dark`)&&!e.classList.contains(`theme-light`)&&(e.classList.add(n),L=n))}function sync(){let e=document.documentElement;if(syncScheme(e),hasAppChosenAccent(e))return;let t=resolve();t?(writeAdwaitaAccent(t.accent,e,isAdwaitaDark(e)),_n=!0):_n&&=(clearAdwaitaAccent(e),!1)}const isHandoffMeta=e=>e.nodeName===`META`&&e.getAttribute(`name`)?.startsWith(`adw-`)===!0;function touchesHandoffMeta(e){return e.type===`attributes`?isHandoffMeta(e.target)||e.attributeName===`name`&&e.oldValue?.startsWith(`adw-`)===!0:[...e.addedNodes,...e.removedNodes].some(isHandoffMeta)}function readMetaHandoff(){I=appearanceFromMeta(e=>document.head.querySelector(`meta[name="${e}"]`)?.getAttribute(`content`)??null)}function followDesktopAppearance(){vn||typeof document>`u`||(vn=!0,readMetaHandoff(),sync(),new MutationObserver(e=>{e.some(touchesHandoffMeta)&&(readMetaHandoff(),sync())}).observe(document.head,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`content`,`name`],attributeOldValue:!0}),globalThis.matchMedia?.(`(prefers-color-scheme: dark)`).addEventListener(`change`,sync),globalThis.addEventListener(`focus`,()=>{I.accent===Ce&&sync()}))}function observeAdaptiveSize(e,t){let n=new ResizeObserver(e=>{let n=e[e.length-1];if(!n)return;let r=n.borderBoxSize?.[0];t(r?{width:r.inlineSize,height:r.blockSize}:{width:n.contentRect.width,height:n.contentRect.height})});return n.observe(e),()=>n.disconnect()}function addBreakpoints(e,t){return observeAdaptiveSize(e,e=>{for(let n of t)n.evaluate(e)})}function bindBreakpointSetter(e,t,n,r=!1){return t?addBreakpoints(e,[new AdwBreakpoint(t,{onApply:()=>n(!0),onUnapply:()=>n(!1)},r)]):()=>{}}const yn=`adw-scroll-shaded`,bn=`--adw-overshoot`,xn=[`overshoot-top`,`overshoot-bottom`],Sn=new Set([`auto`,`scroll`,`overlay`]);function adjustmentsOf(e){let t=getComputedStyle(e);return{vertical:Sn.has(t.overflowY)?{value:e.scrollTop,lower:0,upper:e.scrollHeight,pageSize:e.clientHeight}:void 0,horizontal:Sn.has(t.overflowX)?{value:e.scrollLeft,lower:0,upper:e.scrollWidth,pageSize:e.clientWidth}:void 0}}function isScroller(e){let t=getComputedStyle(e);return Sn.has(t.overflowY)||Sn.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};_onOvershoot;constructor(e,t={}){this._root=e,this._onOvershoot=t.onOvershoot??null}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(yn,...an,...xn),e.style.removeProperty(bn)}_update(e){e.classList.add(yn);let t=scrollUndershootClasses(adjustmentsOf(e));for(let n of an){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(bn):e.style.setProperty(bn,`${Math.abs(t)}px`),this._onOvershoot?.(t)}_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 R={value:0,lower:0,upper:100,stepIncrement:1,pageIncrement:1,pageSize:0};({...R}),{...R},{...R},{...R},{...R},{...R},{...R};let Cn=0;const idOf=()=>`org.gjsify.vec.App${++Cn}`;function attempt$1(e){try{return e(),null}catch(e){return e instanceof Error?e.message:String(e)}}__name(attempt$1,`attempt`);const refusedBy=(e,t)=>({row:`refusal`,rule:`${e} is refused, by name`,holds:`subset`,observe(n){let r=new n.Application({application_id:idOf()});return(attempt$1(()=>void t(r))??``).includes(e)},shows:!0});refusedBy(`hold()`,e=>e.hold()),refusedBy(`release()`,e=>e.release()),refusedBy(`open()`,e=>e.open()),refusedBy(`the 'open' signal`,e=>e.connect(`open`,()=>{})),refusedBy(`the 'shutdown' signal`,e=>e.connect(`shutdown`,()=>{})),refusedBy(`the 'command-line' signal`,e=>e.connect(`command-line`,()=>{})),refusedBy(`send_notification()`,e=>e.send_notification());const withDay=e=>{let t=Array.from({length:31},()=>!1);for(let n of e)t[n-1]=!0;return t};withDay([]),withDay([14]),withDay([14]),withDay([14]),withDay([]),withDay([]),withDay([1]),withDay([1]),withDay([31]),withDay([31]),withDay([]),withDay([31]);const z={topBarStyle:`flat`,bottomBarStyle:`flat`,extendContentToTopEdge:!1,extendContentToBottomEdge:!1};({...z}),{...z},{...z},{...z},{...z},{...z};function walk(e,t,n){n(e,t),(e.children??[]).forEach((e,r)=>walk(e,`${t} > ${e.tag}[${r}]`,n))}function authoredNodes(e,t=e.tag){let n=[];return walk(e,t,(e,t)=>n.push({node:e,path:t})),n}function constructUsesOf(e){let t=[];return[{tree:e,address:e.tag},...(e.siblings??[]).map((t,n)=>({tree:t,address:`${e.tag} > sibling[${n}] ${t.tag}`}))].forEach(({tree:e,address:n},r)=>{r>0&&t.push({kind:`sibling-object`,path:n}),collectUses(e,n,t)}),t}function collectUses(e,t,n){for(let{node:r,path:i}of authoredNodes(e,t))r.layout!==void 0&&n.push({kind:`layout`,path:i}),r.extensions?.strings!==void 0&&n.push({kind:`strings`,path:i}),r.extensions?.responses!==void 0&&n.push({kind:`responses`,path:i}),r.page!==void 0&&n.push({kind:`page`,path:i}),r.extern===!0&&n.push({kind:`extern`,path:i}),r.signals?.forEach(()=>n.push({kind:`signal`,path:i})),Object.keys(r.bindings??{}).forEach(()=>n.push({kind:`bind`,path:i})),r.breakpoints?.forEach(()=>n.push({kind:`breakpoint`,path:i}))}var UnsupportedConstructError=class extends Error{constructor(e,t){let n=t.map(e=>` ${e.kind} at ${e.path} — ${e.reason}`).join(`
5
- `);super(`this tree cannot be rendered by ${e}: ${t.length} construct(s) it refuses.\n${n}`),this.name=`UnsupportedConstructError`,this.renderer=e,this.refused=t}};function assertTreeConstructs(e,t,n){let r=[];for(let i of constructUsesOf(n)){let n=t[i.kind];if(n===void 0)throw Error(`${e}'s capabilities declare no row for the construct '${i.kind}'.`);n!==`implemented`&&r.push({...i,reason:n.refused})}if(r.length>0)throw new UnsupportedConstructError(e,r)}function attempt(e){try{return e(),null}catch(e){return e instanceof Error?e.message:String(e)}}function count$1(e,t){let n={n:0};return e.connect(t,()=>{n.n++}),n}__name(count$1,`count`),[...[`Children`,`Implements`,`Requires`,`GTypeFlags`].map(e=>({row:`registerClass`,rule:`the meta key ${e} is refused at registration, by name`,holds:`subset`,observe(t){let{GObject:n}=t;return(attempt(()=>n.registerClass({GTypeName:`GoVecRefuse${e}`,[e]:[]},class extends n.Object{}))??``).includes(e)},shows:!0}))];const B={active:!1,checked:!1,keyboardActivating:!1};({...B}),{...B},{...B},{...B},{...B},{...B};const wn=[{value:`a`,label:`A`},{value:`b`,label:`B`},{value:`c`,label:`C`}];[...wn],[...wn],Math.PI*.015,Math.PI*.35,Math.PI*.015,Math.PI*.9;const RADIO=(e,t,n)=>({label:n,action:`${e}::${t}`});RADIO(`win.view`,`list`,`List`),RADIO(`win.view`,`grid`,`Grid`),RADIO(`win.view`,`list`,`List`),RADIO(`win.view`,`list`,`List`),RADIO(`win.view`,`grid`,`Grid`),RADIO(`win.sort`,`name`,`Name`);const hostTagOf=e=>{if(!/^(?:Adw|Gtk)[A-Z]\w*$/.test(e))throw Error(`hostTagOf: ${e} is not a GIR class name`);let t=[];for(let n=0;n<e.length;n++){let r=e.charAt(n);if(r>=`A`&&r<=`Z`&&n>0){let r=e.charAt(n-1),i=e.charAt(n+1);(!(r>=`A`&&r<=`Z`)||i>=`a`&&i<=`z`)&&t.push(`-`)}t.push(r.toLowerCase())}return t.join(``)},attributeOf=e=>e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),propertyOf=e=>e.replace(/[-_]([a-z0-9])/g,(e,t)=>t.toUpperCase()),Tn={"margin-start":`margin-inline-start`,"margin-end":`margin-inline-end`,"margin-top":`margin-top`,"margin-bottom":`margin-bottom`},En=[`hexpand`,`vexpand`],Dn={"width-request":`min-width`,"height-request":`min-height`};function widgetLengthStyle(e,t){let n=Tn[e];if(n!==void 0)return[n,`${Number(t)}px`];let r=Dn[e];if(r!==void 0)return[r,Number(t)<0?null:`${Number(t)}px`]}const On=new Map([[`adw-toggle-group`,new Set([`sensitive`])],[`adw-toggle`,new Set([`enabled`])],[`adw-alert-response`,new Set([`enabled`])],[`adw-sidebar-item`,new Set([`enabled`,`visible`])],[`gtk-editable-label`,new Set([`editable`])],[`adw-entry-row`,new Set([`editable`,`show-apply-button`])],[`gtk-text`,new Set([`editable`])],[`gtk-text-view`,new Set([`editable`])],[`adw-navigation-page`,new Set([`can-pop`])],[`gtk-action-bar`,new Set([`revealed`])],[`adw-password-entry-row`,new Set([`revealed`])]]);function isValueBasedBooleanAttr(e,t){let n=On.get(e);return n!==void 0&&n.has(t)}const kn={layout:`implemented`,strings:`implemented`,responses:`implemented`,page:`implemented`,extern:`implemented`,signal:`implemented`,bind:`implemented`,breakpoint:`implemented`,"sibling-object":{refused:`the web builder mounts one root element and has no consumer for a second root yet (ADR 0093)`}};function dispatchedSignalsOf(e){return e.constructor.signals??{}}const An=new WeakSet,jn=new WeakMap,Mn=new WeakSet;let Nn=0;function hasElementApi(e){return Mn.has(e)}function eventOf(e,t){let n=dispatchedSignalsOf(e),r=n[t]??(t.startsWith(`notify::`)?n[`notify::${attributeOf(t.slice(8))}`]:void 0);if(r===void 0)throw Error(`<${e.localName}> declares no signal '${t}'. It dispatches: ${Object.keys(n).join(`, `)||`none`}.`);return r}function inheritedDescriptor(e,t){for(let n=Object.getPrototypeOf(e);n!==null;n=Object.getPrototypeOf(n)){let e=Object.getOwnPropertyDescriptor(n,t);if(e!==void 0)return e}}function notifyElement(e,t){let n=propertyOf(t);e.dispatchEvent(new CustomEvent(eventOf(e,`notify::${t}`),{bubbles:!0,detail:{[n]:e[n]}}))}function ensureNotifying(e,t){let n=propertyOf(t),r=jn.get(e)??new Set;if(r.has(n)||(r.add(n),jn.set(e,r),Object.getOwnPropertyDescriptor(e,n)!==void 0))return;let i=inheritedDescriptor(e,n);if(i?.get===void 0||i.set===void 0)return;let{get:a,set:o}=i,s=eventOf(e,`notify::${t}`);Object.defineProperty(e,n,{configurable:!0,enumerable:!1,get(){return a.call(this)},set(e){let n=a.call(this),r=!1,mark=e=>{e.target===this&&(r=!0)};this.addEventListener(s,mark);try{o.call(this,e)}finally{this.removeEventListener(s,mark)}!r&&a.call(this)!==n&&notifyElement(this,t)}})}function listenElement(e,t,n){let r=eventOf(e,t),i=t.startsWith(`notify::`);i&&ensureNotifying(e,t.slice(8));let listener=t=>{i&&t.target!==e||n(e,...An.has(t)?t.detail:[])};return e.addEventListener(r,listener),()=>e.removeEventListener(r,listener)}function dispatchElement(e,t,n){let r=eventOf(e,t),i=new CustomEvent(r,{detail:n,bubbles:r.startsWith(`notify::`)});An.add(i),e.dispatchEvent(i)}function installElementApi(e){if(typeof e.connect==`function`)return;Mn.add(e);let t=new Map,define=(t,n)=>Object.defineProperty(e,t,{value:n,configurable:!0,writable:!0,enumerable:!1});define(`connect`,(n,r)=>{let i=listenElement(e,n,r),a=++Nn;return t.set(a,i),a}),define(`disconnect`,n=>{let r=t.get(n);if(r===void 0)throw Error(`No handler with id ${n} is connected to <${e.localName}>`);t.delete(n),r()}),define(`emit`,(t,...n)=>dispatchElement(e,t,n)),define(`notify`,t=>notifyElement(e,t)),define(`add_css_class`,t=>e.classList.add(t)),define(`remove_css_class`,t=>e.classList.remove(t)),define(`has_css_class`,t=>e.classList.contains(t))}const Pn=new Set([`connect`,`disconnect`,`emit`,`notify`]);function endpointOf(e){return hasElementApi(e)?new Proxy(e,{get(e,t){if(typeof t!=`string`||Pn.has(t))return Reflect.get(e,t,e);let n=Reflect.get(e,propertyOf(t),e);return typeof n==`function`?n.bind(e):n},set(e,t,n){return Reflect.set(e,typeof t==`string`?propertyOf(t):t,n,e)}}):e}const Fn=new WeakMap;function bindSlottedChildren(e,t,n){let r=new Map,i=[],a=null;for(let e of t){let t=e.claims;e.name!==void 0&&r.set(e.name,e),t!==void 0&&i.push([t,e]),e.name===void 0&&t===void 0&&(a=e)}let o=new Set,s=null,slotFor=e=>{if(o.has(e))return null;let t=e instanceof Element?e.getAttribute(`slot`)??``:``;if(t!==``)return r.get(t)??null;for(let[t,n]of i)if(t(e))return n;return a},route=t=>{let n=slotFor(t);return n===null?null:`into`in n?(n.into.appendChild(t),n):(n.consume(t),t.parentNode===e&&e.removeChild(t),n)},c={slots:t,slotFor,install(...t){for(let t of Array.from(e.childNodes))route(t);o=new Set(t),e.replaceChildren(...t),s?.disconnect(),s=new MutationObserver(t=>{for(let r of t)if(r.target===e)for(let e of r.addedNodes){let t=route(e);t!==null&&n?.(e,t)}}),s.observe(e,{childList:!0})}};return Fn.set(e,c),c}const In=new Map;function registerTemplateClass(e,t){let n=In.get(e);if(n!==void 0&&n!==t)throw Error(`the template class '${e}' is already registered as <${n}>.`);In.set(e,t)}function isTemplateTag(e){for(let t of In.values())if(t===e)return!0;return!1}function templateTagFor(e){let t=In.get(e);if(t===void 0)throw Error(`the tree uses the class '$${e}', which no registerTemplateClass() call registered: adwaita-web cannot build a class it does not know.`);if(customElements.get(t)===void 0)throw Error(`the class '$${e}' is registered as <${t}>, which nothing has defined in the custom element registry, so the element would stay an empty unknown tag.`);return t}function booleanAttribute$2(e,t){return e===null?t:e!==`false`}__name(booleanAttribute$2,`booleanAttribute`);function writeBooleanAttribute$1(e,t,n){n?e.setAttribute(t,`true`):e.setAttribute(t,`false`)}__name(writeBooleanAttribute$1,`writeBooleanAttribute`);function isWritable(e,t){for(let n=e;n!==null;n=Object.getPrototypeOf(n)){let e=Object.getOwnPropertyDescriptor(n,t);if(e!==void 0)return e.set!==void 0||e.writable===!0}return!1}function newRecord(e,t,n){return{placed:[],extended:[],ids:new Map,binds:[],breakpointHosts:[],disposers:[],...e===void 0?{}:{scope:e},...t===void 0?{}:{observeSize:t},...n===void 0?{}:{template:n}}}function bindBreakpoints(e,t,n){let r=createBreakpointDriver((t.breakpoints??[]).map(t=>{if(parseBreakpointCondition(t.condition)===null)throw Error(`<${e.localName}> \`condition ("${t.condition}")\` is not an Adwaita breakpoint condition.`);return{condition:t.condition,setters:t.setters.map(t=>{let r=n.ids.get(t.object);if(r===void 0)throw Error(`<${e.localName}> breakpoint setter \`${t.object}.${t.property}\` names no object: nothing in this tree has the id '${t.object}'.`);return{object:r,property:t.property,value:t.value}})}}),{read(e,t){let n=propertyOf(t),r=e[n];return typeof r==`boolean`&&isWritable(e,n)?{member:r}:{attribute:e.getAttribute(attributeOf(t))}},write(e,t,n){let r=propertyOf(t);if(typeof n==`object`&&n&&`member`in n)e[r]=n.member;else if(typeof n==`object`&&n&&`attribute`in n){let r=n.attribute;r===null?e.removeAttribute(attributeOf(t)):e.setAttribute(attributeOf(t),r)}else typeof n==`boolean`&&isWritable(e,r)?e[r]=n:writeProp(e,t,n)}});n.disposers.push((n.observeSize??observeAdaptiveSize)(e,e=>r.evaluate(e)))}function bindProperty(e,t){if(t.template!==void 0)return bindThroughEngine(e,t.template,t);let{el:n,property:r,source:i,sourceProperty:a,flags:o}=e,s=`<${n.localName}> \`${r}: bind ${i}.${a}\``,c=t.ids.get(i);if(c===void 0)throw Error(`${s} names no object: nothing in this tree has the id '${i}'.`);if(o.length>0)throw Error(`${s} carries ${o.join(`, `)}: adwaita-web binds the plain form only until each flag is verified against GObject.`);let l=`notify::${a}`,u=dispatchedSignalsOf(c),d=u[l];if(d===void 0)throw Error(`${s}: <${c.localName}> dispatches no '${l}', so the target would follow the source once and never again. It dispatches: ${Object.keys(u).join(`, `)||`none`}.`);let f=propertyOf(r),p=propertyOf(a);if(!isWritable(n,f))throw Error(`${s}: <${n.localName}> has no writable property '${f}'.`);let follow=()=>{n[f]=c[p]};follow(),c.addEventListener(d,follow)}function bindThroughEngine(e,t,n){let{el:r,property:i,source:a,sourceProperty:o,flags:s}=e,c=`<${r.localName}> \`${i}: bind ${a}.${o}\``,l=a===`template`?t.instance:n.ids.get(a);if(l===void 0)throw Error(`${c} names no object: nothing in this tree has the id '${a}'.`);let u=[`bidirectional`,`inverted`,`no-sync-create`],d=s.filter(e=>!u.includes(e));if(d.length>0)throw Error(`${c} carries ${d.join(`, `)}, which is not a bind flag.`);if(hasElementApi(r)&&!isWritable(r,propertyOf(i)))throw Error(`${c}: <${r.localName}> has no writable property '${propertyOf(i)}'.`);let f=[];s.includes(`bidirectional`)&&f.push(`bidirectional`),s.includes(`inverted`)&&f.push(`invert-boolean`),s.includes(`no-sync-create`)||f.push(`sync-create`),t.bind(endpointOf(l),o,endpointOf(r),i,f)}function writeProp(e,t,n){let r=attributeOf(t),i=propertyOf(t),a=En.find(e=>e===r);a!==void 0&&typeof n==`boolean`?e.setAttribute(a,n?``:`false`):isTemplateTag(e.localName)&&i in e?e[i]=n:typeof n==`boolean`&&isValueBasedBooleanAttr(e.localName,r)?writeBooleanAttribute$1(e,r,n):n===!1&&isWritable(e,i)?e[i]=!1:typeof n==`boolean`?e.toggleAttribute(r,n):e.setAttribute(r,String(n));let o=widgetLengthStyle(r,n);o!==void 0&&(o[1]===null?e.style.removeProperty(o[0]):e.style.setProperty(o[0],o[1]))}function buildNode$1(e,t){let n=document.createElement(e.extern===!0?templateTagFor(e.tag):hostTagOf(e.tag));t.template!==void 0&&installElementApi(n),e.id!==void 0&&(n.id=e.id,t.ids.set(e.id,n)),collectNode(n,e,t),writeLook(n,e,t.menus),bindSignals(n,e,t),e.extensions!==void 0&&t.extended.push({el:n,node:e});for(let r of buildChildren(n,e,t))n.append(r);return n}__name(buildNode$1,`buildNode`);function collectNode(e,t,n){for(let[r,i]of Object.entries(t.bindings??{}))n.binds.push({el:e,property:r,source:i.source,sourceProperty:i.property,flags:i.flags??[]});t.breakpoints!==void 0&&n.breakpointHosts.push({el:e,node:t})}function writeLook(e,t,n){for(let[n,r]of Object.entries(t.props??{}))n!==`menu-model`&&writeProp(e,n,r);for(let[r,i]of menuAssignments(t,n))e[propertyOf(r)]=i;t.styleClasses!==void 0&&t.styleClasses.length>0&&e.classList.add(...t.styleClasses),writeExtensions(e,t)}const Ln={row:{property:`gridRow`,span:!1},column:{property:`gridColumn`,span:!1},"row-span":{property:`gridRow`,span:!0},"column-span":{property:`gridColumn`,span:!0}};function writeGridCell(e,t,n){let r=n.layout??{};if(e.localName!==`gtk-grid`)throw Error(`layout (${Object.keys(r).join(`, `)}) on \`${n.tag}\` under \`${e.localName}\`: this renderer's only layout manager is the grid, so the placement would be dropped.`);let i={row:0,column:0,"row-span":1,"column-span":1};for(let[e,t]of Object.entries(r)){if(Ln[e]===void 0)throw Error(`layout \`${e}\` on \`${n.tag}\` reaches nothing: a grid child takes ${Object.keys(Ln).join(`, `)}.`);if(typeof t!=`number`||!Number.isInteger(t))throw Error(`layout \`${e}: ${String(t)}\` on \`${n.tag}\` is not a whole number.`);i[e]=t}t.style.gridRow=`${i.row+1} / span ${i[`row-span`]}`,t.style.gridColumn=`${i.column+1} / span ${i[`column-span`]}`}function buildChildren(e,t,n){let r=[];for(let i of t.children??[]){let t=buildNode$1(i,n);i.layout!==void 0&&writeGridCell(e,t,i),i.page!==void 0&&writePage(e,t,i),i.slot!==void 0&&(t.setAttribute(`slot`,i.slot),n.placed.push({parent:e,child:t,slot:i.slot})),r.push(t)}return r}function buildTemplateTree(e,t,n){assertTreeConstructs(`adwaita-web`,kn,e);let r=newRecord(void 0,void 0,t);r.menus=e.menus,e.id!==void 0&&r.ids.set(e.id,n),collectNode(n,e,r),bindSignals(n,e,r);let i=buildChildren(n,e,r);for(let e of r.binds)bindProperty(e,r);for(let e of r.breakpointHosts)bindBreakpoints(e.el,e.node,r);return{children:i,objects:Object.fromEntries(r.ids),finish:()=>writeLook(n,e,e.menus)}}function bindSignals(e,t,n){let r=dispatchedSignalsOf(e);for(let i of t.signals??[]){let t=i.detail===void 0?i.name:`${i.name}::${i.detail}`,a=r[t];if(a===void 0)throw Error(`<${e.localName}> declares no signal '${t}', so the handler '${i.handler}' would never run. It dispatches: ${Object.keys(r).join(`, `)||`none`}.`);if(n.template!==void 0){if(i.flags?.includes(`after`)===!0)throw Error(`the handler '${i.handler}' for '${t}' uses after, which is not in the GObject subset.`);let r=i.object===void 0?void 0:i.object===`template`?n.template.instance:n.ids.get(i.object);if(i.object!==void 0&&r===void 0)throw Error(`the handler '${i.handler}' for '${t}' names the object '${i.object}', which nothing in this tree has.`);e.connect(t,n.template.handler(i.handler,{object:r,flags:i.flags}));continue}if(i.object!==void 0||(i.flags?.length??0)>0)throw Error(`the handler '${i.handler}' for '${t}' uses ${i.object===void 0?``:`an object `}${(i.flags??[]).join(`, `)}: adwaita-web binds plain handlers only until each of those is verified against GTK.`);let o=n.scope?.[i.handler];if(typeof o!=`function`)throw Error(`the tree binds the handler '${i.handler}' for '${t}', and the scope ${n.scope===void 0?"was not given (pass `scope`)":`has no such function`}.`);e.addEventListener(a,e=>o.call(n.scope,e))}}function writeExtensions(e,t){let n=t.extensions?.strings;n!==void 0&&e.setAttribute(`strings`,JSON.stringify(n.map(e=>e.value)));for(let n of t.extensions?.responses??[]){let t=document.createElement(`adw-alert-response`);t.id=n.id,n.appearance!==void 0&&t.setAttribute(`appearance`,n.appearance),n.enabled===!1&&t.setAttribute(`enabled`,`false`),t.textContent=n.label,e.append(t)}}function writePage(e,t,n){let{page:r}=n;if(e.localName===`gtk-notebook`)r?.label!==void 0&&t.setAttribute(`tab-label`,r.label);else if(e.localName===`gtk-stack`)r?.name!==void 0&&t.setAttribute(`name`,r.name),r?.label!==void 0&&t.setAttribute(`title`,r.label);else throw Error(`adwaita-web's shared-tree builder: <${n.tag}> has a page, and <${e.localName}> has no pages.`)}const Rn=`adw-icon--`;var GtkImage=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(Rn));this.classList.remove(...e);let t=this.resolvedIconName;t===``?stringIsNotEmpty(this.getAttribute(`icon-name`))&&this.classList.add(`${Rn}image-missing`):this.classList.add(`${Rn}${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 createGtkImage(e,...t){let n=document.createElement(`gtk-image`);return e!==null&&n.setAttribute(`icon-name`,e),t.length>0&&n.classList.add(...t),n}customElements.define(`gtk-image`,GtkImage);const zn=[`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(zn)).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(createGtkImage(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=createGtkImage(`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=createGtkImage(`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=createGtkImage(`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);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()}function applyRowTooltip(e,t){let n=e.getAttribute(`tooltip-text`)??``;for(let e of t)n?(e.getAttribute(`title`)!==n&&e.setAttribute(`title`,n),e.hasAttribute(Bn)||e.setAttribute(Bn,``)):(e.removeAttribute(`title`),e.removeAttribute(Bn))}const Bn=`data-row-tooltip`;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}}function applyRowLineClamp(e){let{titleEl:t,subtitleEl:n,textContainerEl:r,getTitleLines:i,getSubtitleLines:a}=e,o=i(),s=a(),c=o>0,l=s>0,u=c||l;r.classList.toggle(`adw-row-clamp`,u),c?t.style.setProperty(`--adw-row-title-lines`,String(o)):t.style.removeProperty(`--adw-row-title-lines`),l?n.style.setProperty(`--adw-row-subtitle-lines`,String(s)):n.style.removeProperty(`--adw-row-subtitle-lines`),u?r.style.setProperty(`--adw-row-ellipsize-overflow`,`ellipsis`):r.style.removeProperty(`--adw-row-ellipsize-overflow`)}function parseRowLinesAttribute(e){if(e===null||e===``)return 0;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:0}const Vn=[`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;_textEl;_state=new ActionRowState;_sensitivityObserver=null;_initialized=!1;_activation;static get observedAttributes(){return[`title`,`subtitle`,`activatable`,`tooltip-text`,`title-lines`,`subtitle-lines`]}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,this._prefixEl=document.createElement(`div`),this._prefixEl.className=`adw-action-row-prefix`;let e=document.createElement(`div`);e.className=`adw-row-text`,this._textEl=e,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._suffixEl=document.createElement(`div`),this._suffixEl.className=`adw-action-row-suffix`,bindSlottedChildren(this,[{name:`prefix`,into:this._prefixEl},{name:`suffix`,into:this._suffixEl}]).install(this._prefixEl,e,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`)),this._applyLineClamping()}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:Vn})}_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),applyRowTooltip(this,[this._prefixEl,this._textEl,this._suffixEl]),this._activation?.sync()}_applyLineClamping(){applyRowLineClamp({titleEl:this._titleEl,subtitleEl:this._subtitleEl,textContainerEl:this._titleEl.parentElement,getTitleLines:()=>parseRowLinesAttribute(this.getAttribute(`title-lines`)),getSubtitleLines:()=>parseRowLinesAttribute(this.getAttribute(`subtitle-lines`))})}};customElements.define(`adw-action-row`,AdwActionRow);const Hn={b:{element:`b`},i:{element:`i`},u:{element:`u`},s:{element:`s`},tt:{element:`span`,style:{"font-family":`monospace`}},big:{element:`span`,style:{"font-size":`larger`}},small:{element:`span`,style:{"font-size":`smaller`}},sub:{element:`sub`},sup:{element:`sup`},markup:{element:`span`,style:{display:`contents`}},span:{element:`span`}},Un={weight:`font-weight`,style:`font-style`,underline:`text-decoration-line`,strikethrough:`text-decoration-line`,font_family:`font-family`,size:`font-size`},Wn={font_weight:`weight`,font_style:`style`,face:`font_family`,font_size:`size`},Gn={weight:{ultralight:`100`,light:`300`,normal:`400`,medium:`500`,semibold:`600`,bold:`bold`,ultrabold:`700`,heavy:`900`},style:{normal:`normal`,oblique:`oblique`,italic:`italic`}};function buildNode(e,t){if(e.kind===`text`)return t.createTextNode(e.text);let n=Hn[e.tag];if(n===void 0)return null;let r=t.createElement(n.element);if(n.style!==void 0)for(let[e,t]of Object.entries(n.style))r.style.setProperty(e,t);e.tag===`span`&&applySpanAttributes(r,e.attributes);for(let n of e.children){let e=buildNode(n,t);e!==null&&r.append(e)}return r}function applySpanAttributes(e,t){let n=[];for(let[r,i]of Object.entries(t)){let t=Wn[r]??r,a=Un[t];if(a===void 0)continue;if(t===`underline`){i!==`none`&&n.push(`underline`);continue}if(t===`strikethrough`){i!==`false`&&i!==`none`&&n.push(`line-through`);continue}if(t===`font_family`){let t=sanitizeFontFamily(i);t!==null&&e.style.setProperty(a,t);continue}if(t===`size`){let t=sanitizeFontSize(i);t!==null&&e.style.setProperty(a,t);continue}if(t===`weight`&&/^[0-9]{1,4}$/.test(i)&&+i>=1&&+i<=1e3){e.style.setProperty(a,i);continue}let o=Gn[t]?.[i];o!==void 0&&e.style.setProperty(a,o)}n.length>0&&e.style.setProperty(`text-decoration-line`,n.join(` `))}const Kn=new Set([`serif`,`sans-serif`,`monospace`,`cursive`,`fantasy`,`system-ui`,`ui-serif`,`ui-sans-serif`,`ui-monospace`,`ui-rounded`]);function sanitizeFontFamily(e){let t=[];for(let n of e.split(`,`)){let e=n.trim();if(e!==``){if(!Kn.has(e.toLowerCase())&&!/^["']?[A-Za-z0-9 _-]+["']?$/.test(e))return null;t.push(e)}}return t.length>0?t.join(`, `):null}function sanitizeFontSize(e){let t=e.trim(),n={"xx-small":`xx-small`,"x-small":`x-small`,small:`small`,medium:`medium`,large:`large`,"x-large":`x-large`,"xx-large":`xx-large`,smaller:`smaller`,larger:`larger`}[t];return n===void 0?/^[0-9]+$/.test(t)?`${t/1024}pt`:/^[0-9]+(\.[0-9]+)?pt$/.test(t)||/^[0-9]+(\.[0-9]+)?%$/.test(t)?t:null:n}function renderPangoMarkup(e,t){let n=parsePangoMarkup(t);if(n===null){e.textContent=t;return}let r=e.ownerDocument??document;e.replaceChildren(...n.map(e=>buildNode(e,r)).filter(e=>e!==null))}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`,`heading-use-markup`,`body-use-markup`,`close-response`,`default-response`,`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 headingUseMarkup(){return this.hasAttribute(`heading-use-markup`)}set headingUseMarkup(e){e?this.setAttribute(`heading-use-markup`,``):this.removeAttribute(`heading-use-markup`)}get bodyUseMarkup(){return this.hasAttribute(`body-use-markup`)}set bodyUseMarkup(e){e?this.setAttribute(`body-use-markup`,``):this.removeAttribute(`body-use-markup`)}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,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 e=document.createElement(`div`);e.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`,e.append(this._headingEl,this._bodyEl,this._childEl),this._responseAreaEl=document.createElement(`div`),this._responseAreaEl.className=`adw-alert-dialog-responses`,this._dialogEl.append(e,this._responseAreaEl),bindSlottedChildren(this,[{claims:e=>e instanceof Element&&e.localName===`adw-alert-response`,consume:e=>this._adoptResponse(e)},{into:this._childEl}]).install(this._scrimEl,this._dialogEl),bindEmptySections(this._childEl),this._model.heading=this.heading,this._model.body=this.body;let t=this.getAttribute(`close-response`);t!==null&&(this._model.closeResponse=t),this._model.defaultResponse=this.getAttribute(`default-response`),this._render()}_adoptResponse(e){let t=e.getAttribute(`id`);if(!t)return;let n=e.getAttribute(`appearance`)??`default`;this.addResponse(t,(e.textContent??``).trim()),n!=="default"&&this.setResponseAppearance(t,n),booleanAttribute$2(e.getAttribute(`enabled`),!0)||this.setResponseEnabled(t,!1)}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===`close-response`?n!==null&&this.setCloseResponse(n):e===`default-response`?this.setDefaultResponse(n):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.headingUseMarkup?renderPangoMarkup(this._headingEl,e):this._headingEl.textContent=e,this._headingEl.hidden=e.length===0;let t=this.body;this.bodyUseMarkup?renderPangoMarkup(this._bodyEl,t):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);var AdwWindow=class extends HTMLElement{_initialized=!1;_contentEl;_breakpoints=[];_disposeBreakpoints=null;_openDialogs=[];static get observedAttributes(){return[`width`,`height`,`default-width`,`default-height`]}get contentArea(){return this._contentEl}get content(){return this._contentEl.firstElementChild}set content(e){e&&this._contentEl.appendChild(e)}get breakpoints(){return this._breakpoints}get currentBreakpoint(){return this._breakpoints.find(e=>e.applied)??null}get dialogs(){return this._openDialogs=this._openDialogs.filter(e=>e.isConnected),this._openDialogs}get visibleDialog(){let e=this.dialogs;return e.length>0?e[e.length-1]:null}addBreakpoint(e){let t=new AdwBreakpoint(e,{onApply:()=>this.dataset.breakpoint=e,onUnapply:()=>{this.dataset.breakpoint===e&&delete this.dataset.breakpoint}});return this._breakpoints.push(t),this._bindBreakpoints(),t}connectedCallback(){this._buildOnce(),this._bindBreakpoints()}disconnectedCallback(){this._disposeBreakpoints?.(),this._disposeBreakpoints=null}attributeChangedCallback(e){(e===`width`||e===`height`||e===`default-width`||e===`default-height`)&&this._applySizeRequest()}_buildOnce(){this._initialized||(this._initialized=!0,this._applySizeRequest(),this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-window-content`,bindSlottedChildren(this,[{name:`content`,into:this._contentEl},{into:this._contentEl}]).install(this._contentEl),this.addEventListener(`notify::open`,e=>{let t=e.target;t!==this&&(t.hasAttribute(`open`)?this._openDialogs.includes(t)||this._openDialogs.push(t):this._openDialogs=this._openDialogs.filter(e=>e!==t))}))}_bindBreakpoints(){this._disposeBreakpoints?.(),this._disposeBreakpoints=null,this._initialized&&this._breakpoints.length>0&&(this._disposeBreakpoints=addBreakpoints(this,this._breakpoints))}_applySizeRequest(){let e=this.getAttribute(`default-width`)??this.getAttribute(`width`),t=this.getAttribute(`default-height`)??this.getAttribute(`height`);this.style.width=e?`${e}px`:`360px`,this.style.height=t?`${t}px`:`200px`}};customElements.define(`adw-window`,AdwWindow);const qn=new Map;function modifierState(e){return!!e.shiftKey|(e.ctrlKey?4:0)|(e.altKey?8:0)|(e.metaKey?67108864:0)}const Jn={setStyles(e){if(typeof document>`u`)return;let t=new Set(e.map(e=>e.owner));for(let[e,n]of qn)t.has(e)||(n.remove(),qn.delete(e));for(let{owner:t,css:n,priority:r}of e){let e=qn.get(t);e||(e=document.createElement(`style`),qn.set(t,e)),e.dataset.gtkPriority=String(r),e.textContent!==n&&(e.textContent=n),document.head.append(e)}},openUri(e){typeof globalThis>`u`||globalThis.open(e,`_blank`,`noopener`)},fontName(){if(typeof document>`u`||!document.body)return null;let e=getComputedStyle(document.body),t=e.fontFamily.split(`,`)[0]?.trim().replace(/^["']|["']$/g,``),n=Number.parseFloat(e.fontSize);return!t||!Number.isFinite(n)?null:`${t} ${Math.round(n*.75*10)/10}`},listenKeys(e,t){let n=e;n.hasAttribute(`tabindex`)||n.setAttribute(`tabindex`,`-1`);let listen=e=>n=>{let r=n;t({key:r.key,keycode:r.keyCode,state:modifierState(r),pressed:e})&&r.preventDefault()},r=listen(!0),i=listen(!1);return n.addEventListener(`keydown`,r),n.addEventListener(`keyup`,i),()=>{n.removeEventListener(`keydown`,r),n.removeEventListener(`keyup`,i)}}},Yn={name:`adwaita-web`,requiresWindow:!1,start(e){return new Promise(t=>{let go=()=>{e(),t()};document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,go,{once:!0}):go()})},detach(e){e.remove()},exit(){}};function parentOfElement(e){if(!(e instanceof Element))return null;let t=e.anchor;return t instanceof Element?t:e.parentElement}function menuActionsOfElement(e,t){return menuActionsFor(t,e,parentOfElement)}function activateElementMenuItem(e,t){return activateMenuItem(t,e,parentOfElement)}var GioApplication=class extends GioApplicationBase{static host=Yn};withGtkApplication(GioApplication);const Xn=new WeakMap;function followAccelerators(e,t){Xn.get(e)?.(),Xn.delete(e),t!==null&&Xn.set(e,Jn.listenKeys(e,t=>dispatchAccelerator(e,t,parentOfElement)))}function defineWindowApplication(e){installActionMap(e),Object.defineProperty(e,"application",{configurable:!0,enumerable:!0,get(){return applicationOfWindow(this)},set(e){let t=applicationOfWindow(this);t!==e&&(t?.remove_window(this),e?.add_window(this),followAccelerators(this,e))}})}var AdwApplicationWindow=class extends AdwWindow{_menubarEl=null;_model=[];static get observedAttributes(){return[...AdwWindow.observedAttributes,`show-menubar`,`menu-model`]}get showMenubar(){return this.hasAttribute(`show-menubar`)}set showMenubar(e){e?this.setAttribute(`show-menubar`,``):this.removeAttribute(`show-menubar`)}get menuModel(){return this._model}set menuModel(e){this._model=normalizeMenuModel(e),this._renderMenubar()}get menubar(){return this._menubarEl}connectedCallback(){super.connectedCallback(),this._buildMenubar()}attributeChangedCallback(e){super.attributeChangedCallback(e),e===`menu-model`&&(this._model=parseMenuModel(this.getAttribute(`menu-model`))),(e===`show-menubar`||e===`menu-model`)&&this._renderMenubar()}_buildMenubar(){this._menubarEl||(this._menubarEl=document.createElement(`div`),this._menubarEl.className=`adw-application-window-menubar`,this.contentArea.prepend(this._menubarEl),this._renderMenubar())}_renderMenubar(){let e=this._menubarEl;if(e!==null){e.replaceChildren(),e.hidden=!this.showMenubar||this._model.length===0;for(let t of flattenMenu(this._model)){let n=t.node;if(n.kind===`submenu`){let t=document.createElement(`gtk-menu-button`);t.setAttribute(`menu-title`,n.label),t.menuModel=n.items,e.appendChild(t);continue}let r=document.createElement(`gtk-button`);r.setAttribute(`label`,n.label??``),r.setAttribute(`flat`,``),r.addEventListener(`click`,()=>{this.dispatchEvent(new CustomEvent(`menu-item-activated`,{bubbles:!0,detail:{id:n.id??n.label,label:n.label,path:[...t.path]}}))}),e.appendChild(r)}}}};customElements.define(`adw-application-window`,AdwApplicationWindow),defineWindowApplication(AdwApplicationWindow.prototype);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=createGtkImage(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=avatarIconSize(e),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`)?renderPangoMarkup(this._titleEl,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 He)this._button.classList.toggle(e,n.includes(e));this.classList.toggle(`revealed`,this.hasAttribute(`revealed`))}};customElements.define(`adw-banner`,AdwBanner);var AdwBin=class extends HTMLElement{_observer=null;get child(){return this.lastElementChild}set child(e){this.setChild(e)}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this}]),this._enforceSingleChild(),this._observer??=new MutationObserver(()=>this._enforceSingleChild()),this._observer.observe(this,{childList:!0})}disconnectedCallback(){this._observer?.disconnect()}_enforceSingleChild(){let e=this.lastElementChild;if(e!==null)for(let t of Array.from(this.children)){if(t===e)break;t.remove()}}setChild(e){if(e!==null&&e.parentElement!==null&&e.parentElement!==this)throw Error(`AdwBin.setChild: the child already has a parent.`);if(e===this.child)return;let t=this.child;e===null?t?.remove():this.replaceChildren(e),this.dispatchEvent(new CustomEvent(`notify::child`,{bubbles:!0,detail:{child:e}}))}};customElements.define(`adw-bin`,AdwBin);var AdwBottomSheetContent=class extends HTMLElement{},AdwBottomSheetSheet=class extends HTMLElement{},AdwBottomSheetBottomBar=class extends HTMLElement{},AdwBottomSheet=class extends HTMLElement{_initialized=!1;_contentEl;_dimmingEl;_sheetEl;_sheetBodyEl;_bottomBarEl;_dragHandleEl;_pendingBottomBar=null;_state=new BottomSheetPresentation;_reflecting=!1;static get observedAttributes(){return[`open`,`modal`,`can-close`,`can-open`,`reveal-bottom-bar`,`show-drag-handle`]}get open(){return this._state.open}set open(e){this._setOpen(!!e)}get modal(){return this._state.modal}set modal(e){this._setBoolAttr(`modal`,e)}get canClose(){return this._state.canClose}set canClose(e){this._setBoolAttr(`can-close`,e)}get canOpen(){return this._state.canOpen}set canOpen(e){this._setBoolAttr(`can-open`,e)}get revealBottomBar(){return this._state.revealBottomBar}set revealBottomBar(e){this._setBoolAttr(`reveal-bottom-bar`,e)}get showDragHandle(){return this._boolAttr(`show-drag-handle`,!0)}set showDragHandle(e){this._setBoolAttr(`show-drag-handle`,e)}get bottomBar(){return this._initialized?this._bottomBarEl.firstChild:this._pendingBottomBar}setBottomBar(e){if(this._state.setHasBottomBar(e!==null),!this._initialized){this._pendingBottomBar=e;return}e?this._bottomBarEl.replaceChildren(e):this._bottomBarEl.replaceChildren(),this._render()}requestOpen(e){return this._state.requestOpen(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,this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-bottom-sheet-content`,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`),this._sheetBodyEl=document.createElement(`div`),this._sheetBodyEl.className=`adw-bottom-sheet-sheet-body`,this._bottomBarEl=document.createElement(`button`),this._bottomBarEl.type=`button`,this._bottomBarEl.className=`adw-bottom-sheet-bottom-bar`,this._bottomBarEl.addEventListener(`click`,()=>this.requestOpen(`bottom-bar`)),this._sheetEl.append(this._bottomBarEl,this._dragHandleEl,this._sheetBodyEl);let layer=(e,t)=>({claims:t=>t instanceof Element&&t.localName===e,consume:e=>{for(let n of Array.from(e.childNodes))t.appendChild(n)}});bindSlottedChildren(this,[{name:`sheet`,into:this._sheetBodyEl},{name:`bottom-bar`,into:this._bottomBarEl},{name:`content`,into:this._contentEl},layer(`adw-bottom-sheet-sheet`,this._sheetBodyEl),layer(`adw-bottom-sheet-bottom-bar`,this._bottomBarEl),layer(`adw-bottom-sheet-content`,this._contentEl),{into:this._contentEl}],(e,t)=>{!(`into`in t)||t.into!==this._bottomBarEl||(this._state.setHasBottomBar(!0),this._render())}).install(this._contentEl,this._dimmingEl,this._sheetEl),this._pendingBottomBar&&this._bottomBarEl.replaceChildren(this._pendingBottomBar),this._pendingBottomBar=null,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.setCanOpen(this._boolAttr(`can-open`,!0)),this._state.setRevealBottomBar(this._boolAttr(`reveal-bottom-bar`,!0)),this._state.setHasBottomBar(this._bottomBarEl.childNodes.length>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===`modal`&&this._state.setModal(this._boolAttr(`modal`,!0)),e===`can-close`&&this._state.setCanClose(this._boolAttr(`can-close`,!0)),e===`can-open`&&this._state.setCanOpen(this._boolAttr(`can-open`,!0)),e===`reveal-bottom-bar`&&this._state.setRevealBottomBar(this._boolAttr(`reveal-bottom-bar`,!0)),this._initialized&&this._render()}}_setOpen(e){this._state.setOpen(e)&&(this._initialized||this._reflectOpen(e))}_render(){let e=this._state.open,t=this._state.chrome,n=t.layer===`bottom-bar`;this._reflectOpen(e),this.classList.toggle(`open`,e),this.classList.toggle(`modal`,this._state.modal),this.classList.toggle(`has-drag-handle`,this.showDragHandle),this.classList.toggle(`showing-bottom-bar`,n&&t.surfaceVisible),this._dimmingEl.classList.toggle(`visible`,t.dimmed),this._bottomBarEl.hidden=!n,this._bottomBarEl.classList.toggle(`inert`,t.bottomBarInert),this._sheetBodyEl.hidden=n,this._dragHandleEl.hidden=!this.showDragHandle||n}_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`)}};customElements.define(`adw-bottom-sheet-content`,AdwBottomSheetContent),customElements.define(`adw-bottom-sheet-sheet`,AdwBottomSheetSheet),customElements.define(`adw-bottom-sheet-bottom-bar`,AdwBottomSheetBottomBar),customElements.define(`adw-bottom-sheet`,AdwBottomSheet);function parseBreakpoints(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return console.error("<adw-breakpoint-bin>: `breakpoints` is not JSON; no breakpoint is applied."),[]}return Array.isArray(t)?t.flatMap(e=>{if(typeof e!=`object`||!e)return[];let{condition:t,setters:n}=e;return typeof t==`string`?[{condition:t,setters:Array.isArray(n)?n:[]}]:[]}):[]}var AdwBreakpointBin=class extends HTMLElement{_state=new BreakpointBinState;_dispose;_applied=null;_pendingSync=!1;_originals=new Map;static get observedAttributes(){return[`breakpoints`]}get currentBreakpoint(){return this._state.current}get currentBreakpointAttribute(){let e=this._state.current;return e===null?null:String(e)}get child(){return this.firstElementChild}connectedCallback(){this.setAttribute(`role`,`group`),this.style.display=`block`,this._syncSizing(),this._pendingSync=!0,this._observe()}disconnectedCallback(){this._dispose?.(),this._dispose=void 0}attributeChangedCallback(e){e!==`breakpoints`||!this.isConnected||(this._originals.clear(),this._syncBreakpoints())}_syncBreakpoints(){this._pendingSync=!1;let e=parseBreakpoints(this.getAttribute(`breakpoints`));this._state=new BreakpointBinState;for(let t of e){let e=[];for(let n of t.setters){if(typeof n?.target!=`string`||typeof n.property!=`string`)continue;let t=this.querySelector(n.target);if(t===null)continue;let r=`${n.target}\u0000${n.property}\u0000${n.value}`;this._originals.has(r)||this._originals.set(r,t.getAttribute(n.property)),e.push({object:t,property:n.property,value:n.value,originalValue:this._originals.get(r)??null})}this._state.add({condition:t.condition,setters:e})}this._state.inherit(this._applied),this._state.setHasChild(this.child!==null),this._write(this._state.current),this._syncSizing()}_observe(){this._dispose?.(),this._dispose=observeAdaptiveSize(this,e=>{this._pendingSync&&this._syncBreakpoints(),this._state.setHasChild(this.child!==null);let t=this._state.evaluate(e);t!==null&&(this._emit(t.from,`breakpoint-unapply`),this._perform(t.writes),this._write(t.to),this._emit(t.to,`breakpoint-apply`),this.dispatchEvent(new CustomEvent(`notify::current-breakpoint`,{bubbles:!0,detail:{currentBreakpoint:this.currentBreakpointAttribute}})))})}_perform(e){for(let t of e)t.value===null?t.object.removeAttribute(t.property):t.object.setAttribute(t.property,String(t.value))}_write(e){this._applied=e}_emit(e,t){e!==null&&this.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:{index:e}}))}_syncSizing(){let e=this._state.length>0;this.style.minWidth=e?`0px`:``,this.style.minHeight=e?`0px`:``,e&&(this.style.overflow=`hidden`)}};customElements.define(`adw-breakpoint-bin`,AdwBreakpointBin);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=createGtkImage(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(Ke),this._styledHost=e))}_unroot(){this._styledHost?.classList.remove(Ke),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 AdwButtonRow=class extends HTMLElement{_contentsEl;_startIconEl;_endIconEl;_titleEl;_state=new ButtonRowState;_initialized=!1;static get observedAttributes(){return[`title`,`start-icon-name`,`end-icon-name`,`tooltip-text`]}connectedCallback(){this._initialized||(this._contentsEl=document.createElement(`div`),this._contentsEl.className=`adw-button-row-contents`,this._startIconEl=createGtkImage(null,`start`),this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-button-row-title`,this._endIconEl=createGtkImage(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),applyRowTooltip(this,[this._contentsEl])}_paintIcon(e,t,n){e.iconName=n?t:null,e.hidden=!n}};customElements.define(`adw-button-row`,AdwButtonRow);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`,`carousel`]}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`||e===`carousel`)&&this._initialized&&(this._detach(),this._carousel=null,this._resolveForAttr(),this._attach(),this._render())}_resolveForAttr(){let e=this.getAttribute(`carousel`)??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);var AdwClamp=class extends HTMLElement{_resize=null;_mutations=null;static get observedAttributes(){return[`maximum-size`,`tightening-threshold`]}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this}]),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`),Xe.maximumSize),tighteningThreshold:normalizeClampSize(this.getAttribute(`tightening-threshold`),Xe.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 Ze)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 Ze)e.classList.toggle(t,t===i)}}};customElements.define(`adw-clamp`,AdwClamp);const Zn={automatic:`auto`,always:`scroll`,never:`hidden`};var AdwClampScrollable=class extends HTMLElement{_resize=null;_mutations=null;static get observedAttributes(){return[`maximum-size`,`tightening-threshold`,`unit`,`orientation`,`hscroll-policy`,`vscroll-policy`]}get maximumSize(){return normalizeClampSize(this.getAttribute(`maximum-size`),Xe.maximumSize)}set maximumSize(e){this.setAttribute(`maximum-size`,String(e))}get tighteningThreshold(){return normalizeClampSize(this.getAttribute(`tightening-threshold`),Xe.tighteningThreshold)}set tighteningThreshold(e){this.setAttribute(`tightening-threshold`,String(e))}get unit(){return normalizeLengthUnit(this.getAttribute(`unit`),`sp`)}set unit(e){this.setAttribute(`unit`,e)}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this.setAttribute(`orientation`,e)}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this}]),this._resize=new ResizeObserver(()=>this._allocate()),this._resize.observe(this),this._mutations=new MutationObserver(()=>this._allocate()),this._mutations.observe(this,{childList:!0}),this._applyOverflow(),this._allocate()}disconnectedCallback(){this._resize?.disconnect(),this._resize=null,this._mutations?.disconnect(),this._mutations=null}attributeChangedCallback(){this._applyOverflow(),this._allocate()}_applyOverflow(){let e=this.getAttribute(`hscroll-policy`),t=this.getAttribute(`vscroll-policy`);this.style.overflowX=e===null?`auto`:Zn[e]??`auto`,this.style.overflowY=t===null?`auto`:Zn[t]??`auto`}_allocate(){let e=this.orientation===`vertical`,t=this.unit,n=e?this.clientHeight:this.clientWidth,r={maximumSize:adwLengthToPx(t,this.maximumSize),tighteningThreshold:adwLengthToPx(t,this.tighteningThreshold),childMin:0,childNat:0};for(let t of Array.from(this.children)){if(n<=0){t.style.maxWidth=``,t.style.maxHeight=``,t.style.marginInline=``,t.style.marginBlock=``;for(let e of Ze)t.classList.remove(e);continue}let{childSize:i,sizeClass:a}=clampAllocate(n,r);e?(t.style.maxWidth=``,t.style.maxHeight=`${i}px`,t.style.marginInline=``,t.style.marginBlock=`auto`):(t.style.maxWidth=`${i}px`,t.style.maxHeight=``,t.style.marginInline=`auto`,t.style.marginBlock=``);for(let e of Ze)t.classList.toggle(e,e===a)}}};customElements.define(`adw-clamp-scrollable`,AdwClampScrollable);function stringListSlot(e){return{name:`model`,consume:t=>e(parseListModel(t instanceof Element?t.getAttribute(`strings`):null))}}var AdwComboRow=class extends HTMLElement{_select;_valueEl;_textEl;_titleEl;_subtitleEl;_state=new ComboState;_initialized=!1;static get observedAttributes(){return[`title`,`subtitle`,`model`,`selected`,`tooltip-text`,`title-lines`,`subtitle-lines`]}get model(){return this._state.model}set model(e){this._state.setModel(normalizeComboOptions(e))}get selected(){return this._initialized?this._state.selectedIndex:parseInt(this.getAttribute(`selected`)||`0`,10)}set selected(e){this.setAttribute(`selected`,String(e))}get selectedValue(){return this._state.selectedValue}set selectedValue(e){let t=this._state.model.findIndex(t=>t.value===e);t>=0&&(this.selected=t)}get selectedItem(){return this._state.model[this._state.selectedIndex]??null}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=document.createElement(`div`);e.className=`adw-row-text`,this._textEl=e,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._valueEl=document.createElement(`span`),this._valueEl.className=`adw-row-value`,this._select=document.createElement(`select`),bindSlottedChildren(this,[stringListSlot(e=>this._state.setModel(e))]).install(e,this._valueEl,this._select),this._state.count===0&&this._state.setModel(parseListModel(this.getAttribute(`model`))),this._state.setSelectedIndex(parseInt(this.getAttribute(`selected`)||`0`,10)),this._state.subscribeItems(e=>this._applyItemsChanged(e)),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._renderOptions(),this._renderText()}attributeChangedCallback(e,t,n){this._initialized&&(e===`model`?this._state.setModel(parseListModel(n)):e===`selected`?this._state.setSelectedIndex(parseInt(n||`0`,10)):this._renderText())}_createOption(e){let t=document.createElement(`option`);return t.value=e.value,t.textContent=e.label,t}_applyItemsChanged(e){if(!this._initialized)return;for(let t=0;t<e.removed;t++)this._select.remove(e.position);let t=this._select.options[e.position]??null,n=this._state.model;for(let r=0;r<e.added;r++){let i=n[e.position+r];i&&this._select.insertBefore(this._createOption(i),t)}}_renderOptions(){this._initialized&&(this._select.replaceChildren(...this._state.model.map(e=>this._createOption(e))),this._select.selectedIndex=this._state.selectedIndex,this._valueEl.textContent=this._state.selectedLabel,this._syncChooser())}_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,applyRowTooltip(this,[this._textEl,this._valueEl,this._select]),this._applyLineClamping()}_applyLineClamping(){applyRowLineClamp({titleEl:this._titleEl,subtitleEl:this._subtitleEl,textContainerEl:this._titleEl.parentElement,getTitleLines:()=>parseRowLinesAttribute(this.getAttribute(`title-lines`)),getSubtitleLines:()=>parseRowLinesAttribute(this.getAttribute(`subtitle-lines`))})}};customElements.define(`adw-combo-row`,AdwComboRow);const Qn=[`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&&Qn.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`),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 e=document.createElement(`div`);e.className=`adw-dialog-header-side`,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-dialog-title`;let t=document.createElement(`div`);t.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()),t.appendChild(this._closeBtn),this._headerEl.append(e,this._titleEl,t),this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-dialog-content`,this._boxEl.append(this._headerEl,this._contentEl),this._scrimEl.appendChild(this._boxEl),bindSlottedChildren(this,[{into:this._contentEl}]).install(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()}decorateHeader(e){}_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),this.decorateHeader(this._headerEl)}};customElements.define(`adw-dialog`,AdwDialog);function setPartVisible(e,t){e.hidden=!t,e.style.display=t?``:`none`}var AdwEntryRow=class extends HTMLElement{_state=new EntryRowState;_input;_emptyTitle;_title;_area;_editIcon;_indicator;_applyButton;_prefixes;_suffixes;_initialized=!1;_slots;_lastText=``;_lastLength=0;static get observedAttributes(){return[`title`,`text`,`editable`,`max-length`,`show-apply-button`,`activates-default`,`tooltip-text`]}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(booleanAttribute$2(this.getAttribute(`show-apply-button`),!1)),this._state.setActivatesDefault(booleanAttribute$2(this.getAttribute(`activates-default`),!1)),this.hasAttribute(`text`)&&this._state.setText(this.getAttribute(`text`)??``),this._renderTitle(),this._onConnected(),this._slots.install(this._prefixes,this._area,this._indicator,this._applyButton,this._editIcon,this._suffixes),this._lastText=this._state.text,this._lastLength=this._state.textLength,this._render(this._state.state),applyRowTooltip(this,this._tooltipParts()),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(booleanAttribute$2(n,!1));break;case`activates-default`:this._state.setActivatesDefault(booleanAttribute$2(n,!1));break;case`tooltip-text`:applyRowTooltip(this,this._tooltipParts());break}}_tooltipParts(){return[this._prefixes,this._area,this._suffixes]}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._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=at,this._applyButton.setAttribute(`aria-label`,at),this._applyButton.textContent=`✓`,this._applyButton.addEventListener(`click`,()=>this.apply()),this._editIcon=createGtkImage(`document-edit`,`adw-row-edit`,`${e}-edit`),this._editIcon.dataset.iconName=`adw-entry-edit-symbolic`,this._slots=bindSlottedChildren(this,[{name:`prefix`,consume:e=>this.addPrefix(e)},{name:`suffix`,claims:e=>e instanceof Element,consume:e=>this.addSuffix(e)}]),setPartVisible(this._prefixes,!1),setPartVisible(this._suffixes,!1),this.addEventListener(`click`,e=>this._maybeFocus(e))}_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 GtkSwitch=class extends HTMLElement{static signals={"notify::active":`notify::active`,"notify::state":`notify::state`};_input;_slider;_initialized=!1;static get observedAttributes(){return[`active`,`state`,`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),this.state=this.active}get state(){return this.hasAttribute(`state`)}set state(e){this.toggleAttribute(`state`,!!e)}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){this.toggleAttribute(`disabled`,!!e)}connectedCallback(){if(this._initialized){this._render();return}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.active&&(this.state=!0),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}})):e===`state`&&this.dispatchEvent(new CustomEvent(`notify::state`,{bubbles:!0,detail:{state:this.state}})))}_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(`checked`,this.state),this.classList.toggle(`disabled`,e)}};customElements.define(`gtk-switch`,GtkSwitch);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`,`tooltip-text`,`title-lines`,`subtitle-lines`]}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,this._headerEl=document.createElement(`div`),this._headerEl.className=`adw-expander-row-header`;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._enableSwitch=document.createElement(`gtk-switch`),this._enableSwitch.classList.add(`adw-expander-row-enable-switch`),this._enableSwitch.active=this.enableExpansion,this._chevronEl=createGtkImage(`go-down`,`adw-expander-row-chevron`),this._prefixEl=document.createElement(`div`),this._prefixEl.className=`adw-expander-row-prefix`,this._suffixEl=document.createElement(`div`),this._suffixEl.className=`adw-expander-row-suffix`,this._headerEl.append(this._prefixEl,e,this._suffixEl,this._enableSwitch,this._chevronEl),this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-expander-row-content`,bindSlottedChildren(this,[{name:`prefix`,into:this._prefixEl},{name:`suffix`,into:this._suffixEl},{into:this._contentEl}]).install(this._headerEl,this._contentEl),bindEmptySections(this._prefixEl,this._suffixEl),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),applyRowTooltip(this,[this._headerEl]),this._applyLineClamping()}_applyLineClamping(){applyRowLineClamp({titleEl:this._titleEl,subtitleEl:this._subtitleEl,textContainerEl:this._titleEl.parentElement,getTitleLines:()=>parseRowLinesAttribute(this.getAttribute(`title-lines`)),getSubtitleLines:()=>parseRowLinesAttribute(this.getAttribute(`subtitle-lines`))})}};customElements.define(`adw-expander-row`,AdwExpanderRow);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;_page=null;_window=null;_pageObserver=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){this._followPage(),this._renderTitle();return}this._initialized=!0,this._startEl=document.createElement(`div`),this._startEl.className=`adw-header-bar-start`,this._centerEl=document.createElement(`div`),this._centerEl.className=`adw-header-bar-center`,this._endEl=document.createElement(`div`),this._endEl.className=`adw-header-bar-end`,bindSlottedChildren(this,[{name:`start`,into:this._startEl},{name:`center`,into:this._centerEl},{name:`title-widget`,into:this._centerEl},{name:`end`,into:this._endEl}],(e,t)=>{`into`in t&&t.into===this._centerEl&&this._dropDerivedTitle()}).install(this._startEl,this._centerEl,this._endEl),this._centerEl.childElementCount===0&&(this._titleEl=document.createElement(`adw-window-title`),this._titleEl.className=`adw-header-bar-title`,this._centerEl.appendChild(this._titleEl)),this._followPage(),this._renderTitle()}disconnectedCallback(){this._pageObserver?.disconnect(),this._pageObserver=null,this._page=null,this._window=null}_followPage(){this._page=this.closest(`adw-navigation-page`),this._window=this.closest(`adw-window, adw-application-window`),this._pageObserver??=new MutationObserver(()=>this._renderTitle());for(let e of[this._page,this._window])e!==null&&this._pageObserver.observe(e,{attributes:!0,attributeFilter:[`title`]})}attributeChangedCallback(){this._initialized&&this._renderTitle()}_dropDerivedTitle(){this._titleEl?.remove(),this._titleEl=null}_renderTitle(){if(this._titleEl)for(let e of[`title`,`subtitle`]){let t=this.getAttribute(e)??(e===`title`?this._page?.getAttribute(`title`)??this._window?.getAttribute(`title`)??null:null);t===null?this._titleEl.removeAttribute(e):this._titleEl.setAttribute(e,t)}}};customElements.define(`adw-header-bar`,AdwHeaderBar);const $n={schedule(e,t){return setTimeout(e,t)},cancel(e){clearTimeout(e)}};function createSwitcherIcon(e,t){return createGtkImage(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`)}const er={horizontal:{previous:`ArrowLeft`,next:`ArrowRight`},vertical:{previous:`ArrowUp`,next:`ArrowDown`}},adjacentStep=(e,t,n)=>{let r=t+n;return r<0||r>=e.length?null:r};function attachRovingFocus(e){let keysOf=e=>er[typeof e==`function`?e():e];e.host.addEventListener(`keydown`,t=>{let{previous:n,next:r}=keysOf(e.orientation),i=e.crossAxis===void 0?null:keysOf(e.crossAxis.orientation);if(t.altKey||t.ctrlKey||t.metaKey)return;let a=e.items(),o=a.findIndex(e=>e===t.target||e.contains(t.target));if(o<0)return;let s=e.step??adjacentStep,c;if(t.key===n)c=s(a,o,-1);else if(t.key===r)c=s(a,o,1);else if(i!==null&&t.key===i.previous)c=e.crossAxis.step(a,o,-1);else if(i!==null&&t.key===i.next)c=e.crossAxis.step(a,o,1);else if(t.key===`Home`)c=0;else if(t.key===`End`)c=a.length-1;else return;t.preventDefault();let l=c===null?void 0:a[c];l===void 0||l===a[o]||(e.select(l),l.focus())})}var AdwViewStackPage=class extends HTMLElement{static get observedAttributes(){return[`name`,`title`,`icon-name`,`badge-number`,`needs-attention`,`use-underline`]}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this}])}},AdwInlineViewSwitcher=class extends HTMLElement{scheduler=$n;_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 tn)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 AdwMultiLayoutView=class extends HTMLElement{_layouts=[];_children=new Map;_slots=new Map;_current=null;_acceptingSlots=!1;_observer=null;static get observedAttributes(){return[`layout-name`]}get layoutName(){return this._current?.name??null}set layoutName(e){e!==null&&this.setAttribute(`layout-name`,e)}get layout(){return this._current?.content??null}connectedCallback(){this.setAttribute(`role`,`group`),this.style.display=`block`,this._observer?.disconnect(),this._observer=new MutationObserver(()=>this._rebuild()),this._observer.observe(this,{childList:!0}),this._rebuild()}disconnectedCallback(){this._observer?.disconnect(),this._observer=null}attributeChangedCallback(e){!this.isConnected||e!==`layout-name`||this._setLayoutByName(this.getAttribute(`layout-name`))}getChild(e){return this._children.get(e)??null}getLayoutByName(e){return this._layouts.find(t=>t.name===e)?.content??null}registerSlot(e,t){if(this._acceptingSlots&&this._slots.get(e)!==t){if(this._slots.has(e)){console.warn(`Duplicate slot ID in AdwLayout ${this.layoutName}: ${e}`);return}this._slots.set(e,t)}}_rebuild(){if(this.isConnected){this._observer?.disconnect();try{this._readAuthoredTree()}finally{this.isConnected&&this._observer?.observe(this,{childList:!0})}}}_readAuthoredTree(){let e=[];for(let t of Array.from(this.children)){let n=t.getAttribute(`name`);if(n!==null){e.push({name:n,content:t});continue}let r=t.getAttribute(`slot`);r===null||r===``||(this._children.has(r)&&console.warn(`While adding child: duplicate slot ${r} in AdwMultiLayoutView; kept the first`),this._children.set(r,t))}this._layouts=e;let t=this.getAttribute(`layout-name`);t===null?this._setLayout(e[0]??null):this._setLayoutByName(t)}_setLayout(e){if(e===this._current){e!==null&&this._mount(e);return}this._current=e,e===null?this._destroy():this._mount(e),this.dispatchEvent(new CustomEvent(`notify::layout`,{bubbles:!0,detail:{layout:this.layoutName}})),this.dispatchEvent(new CustomEvent(`notify::layout-name`,{bubbles:!0,detail:{layoutName:this.layoutName}}))}_setLayoutByName(e){if(e===null)return;let t=this._layouts.find(t=>t.name===e);if(t===void 0){console.error(`Layout name '${e}' not found in AdwMultiLayoutView`);return}this._setLayout(t)}_destroy(){this._slots.clear(),this.replaceChildren()}_mount(e){for(this._destroy(),this._acceptingSlots=!0,this.appendChild(e.content);;){let t=this._slots.size;for(let t of e.content.querySelectorAll(`adw-layout-slot`)){let e=t.getAttribute(`id`);e!==null&&e!==``&&!this._slots.has(e)&&this.registerSlot(e,t)}for(let[e,t]of this._children)this._parent(e,t);if(this._slots.size===t)break}this._acceptingSlots=!1}_parent(e,t){let n=this._slots.get(e);n!==void 0&&t.parentElement!==n&&(this._mirrorVisible(n,t),n.appendChild(t))}_mirrorVisible(e,t){let apply=()=>{e.toggleAttribute(`hidden`,t.hidden===!0)};apply(),new MutationObserver(apply).observe(t,{attributes:!0,attributeFilter:[`hidden`]})}};customElements.define(`adw-multi-layout-view`,AdwMultiLayoutView);var AdwLayoutSlot=class extends HTMLElement{_registered=!1;static get observedAttributes(){return[`id`]}get slotId(){return this.getAttribute(`id`)}connectedCallback(){this.setAttribute(`role`,`group`),this.style.display=`contents`,this._register()}disconnectedCallback(){this._registered=!1}attributeChangedCallback(e){!this.isConnected||e!==`id`||(this._registered&&console.warn("<adw-layout-slot>: `id` is construct-only upstream; re-registering the slot."),this._register())}_register(){let e=this.slotId;if(e===null||e===``){console.error("<adw-layout-slot> created without an `id` — libadwaita refuses this with g_error.");return}let t=this.closest(`adw-multi-layout-view`);t instanceof AdwMultiLayoutView&&t.registerSlot(e,this),this._registered=!0}};customElements.define(`adw-layout-slot`,AdwLayoutSlot);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`]}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this}])}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){if(this._syncing)return;let n=this.closest(`adw-navigation-view`);n instanceof AdwNavigationView&&n.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()??Ft,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(`gtk-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-view`,AdwNavigationView),customElements.define(`adw-navigation-page`,AdwNavigationPage);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(){this._initialized||(this._initialized=!0,this._sidebarEl=document.createElement(`div`),this._sidebarEl.className=`adw-nsv-sidebar`,this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-nsv-content`,bindSlottedChildren(this,[{name:`sidebar`,into:this._sidebarEl},{name:`content`,into:this._contentEl}],(e,t)=>this._mountPane(t.name===`sidebar`?`sidebar`:`content`)).install(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._mountPane(`sidebar`),this._mountPane(`content`),this._state.subscribe(()=>{this._reflectShowContent(),this._syncClasses()}))}_mountPane(e){let t=e===`sidebar`?this._sidebarEl:this._contentEl,n=Array.from(t.children),r=n.length>0?{tag:this._tagOf(n)}:null;e===`sidebar`?this._state.setSidebar(r):this._state.setContent(r)}_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);const tr={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{static signals={"notify::show-sidebar":`notify::show-sidebar`};_initialized=!1;_sidebarEl;_contentEl;_backdropEl;_disposeBreakpoint;_breakpointApplied=!1;_state=new OverlaySplitViewState;_notifiedShowSidebar=null;_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(){this._initialized||(this._initialized=!0,this._sidebarEl=document.createElement(`div`),this._sidebarEl.className=`adw-osv-sidebar`,this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-osv-content`,this._backdropEl=document.createElement(`div`),this._backdropEl.className=`adw-osv-backdrop`,this._backdropEl.addEventListener(`click`,()=>this.hideSidebar()),bindSlottedChildren(this,[{name:`sidebar`,into:this._sidebarEl},{name:`content`,into:this._contentEl},{into:this._contentEl}]).install(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:tr}),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}}this._notifyShowSidebar()}_notifyShowSidebar(){let e=this._state.showSidebar,t=this._notifiedShowSidebar;this._notifiedShowSidebar=e,!(t===null||t===e)&&this.dispatchEvent(new CustomEvent(`notify::show-sidebar`,{bubbles:!0,detail:{showSidebar:e}}))}_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 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=createGtkImage(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 nr=new Set([`adw-action-row`,`adw-switch-row`,`adw-combo-row`,`adw-spin-row`]),rr=new Set([...nr,`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=>rr.has(e.tagName.toLowerCase()))}function describeRow(e){let t=e.getAttribute(`subtitle`);return{title:e.getAttribute(`title`)??``,subtitle:t,visible:isVisible(e),isActionRow:nr.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,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 e=document.createElement(`div`);e.className=`adw-preferences-dialog-header`;let t=document.createElement(`div`);t.className=`adw-preferences-dialog-header-side`,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-preferences-dialog-title`;let n=document.createElement(`div`);n.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()),n.appendChild(this._closeBtn),e.append(t,this._titleEl,n),this._bodyEl=document.createElement(`div`),this._bodyEl.className=`adw-preferences-dialog-body`,this._pagesEl=document.createElement(`div`),this._pagesEl.className=`adw-preferences-dialog-pages`,this._bodyEl.appendChild(this._pagesEl),this._dialogEl.append(e,this._bodyEl),bindSlottedChildren(this,[{into:this._pagesEl}]).install(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);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._observeBoxes();return}this._initialized=!0,this._headerEl=document.createElement(`div`),this._headerEl.className=`adw-preferences-group-header`;let e=document.createElement(`div`);e.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`,e.append(this._titleEl,this._descriptionEl),this._suffixEl=document.createElement(`div`),this._suffixEl.className=`adw-preferences-group-suffix`,this._headerEl.append(e,this._suffixEl),this._listboxEl=document.createElement(`div`),this._listboxEl.className=`adw-preferences-group-listbox`,bindSlottedChildren(this,[{name:`header-suffix`,into:this._suffixEl},{into:this._listboxEl}],()=>this._renderHeader()).install(this._headerEl,this._listboxEl),this.setAttribute(`role`,`group`),this._observeBoxes()}disconnectedCallback(){this._observer?.disconnect(),this._observer=null}attributeChangedCallback(){this._initialized&&this._renderHeader()}_observeBoxes(){this._observer||(this._observer=new MutationObserver(()=>this._renderHeader()),this._observer.observe(this._listboxEl,{childList:!0}),this._observer.observe(this._suffixEl,{childList:!0}),this._renderHeader())}_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);var AdwPreferencesRow=class extends HTMLElement{_titleEl;_contentEl;_initialized=!1;static get observedAttributes(){return[`title`,`title-selectable`,`use-markup`,`use-underline`,`tooltip-text`]}get title(){return this.getAttribute(`title`)??``}set title(e){e===``?this.removeAttribute(`title`):this.setAttribute(`title`,e)}get titleSelectable(){return this.hasAttribute(`title-selectable`)}set titleSelectable(e){this.toggleAttribute(`title-selectable`,e)}get useMarkup(){return this.hasAttribute(`use-markup`)}set useMarkup(e){this.toggleAttribute(`use-markup`,e)}get useUnderline(){return this.hasAttribute(`use-underline`)}set useUnderline(e){this.toggleAttribute(`use-underline`,e)}get child(){return this._contentEl?.firstElementChild??null}set child(e){this._contentEl?.replaceChildren(...e===null?[]:[e])}connectedCallback(){this._initialized||(this._initialized=!0,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-row-title`,this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-preferences-row-content`,bindSlottedChildren(this,[{name:`child`,into:this._contentEl}]).install(this._titleEl,this._contentEl),bindEmptySections(this._contentEl),this.setAttribute(`role`,`listitem`),this._render())}attributeChangedCallback(e,t,n){this._initialized&&(this._render(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:n}})))}_render(){let e=labelDisplayText(this.title,this.useMarkup,this.useUnderline);this._titleEl.textContent=e,this._titleEl.hidden=!stringIsNotEmpty(e),this._titleEl.style.userSelect=this.titleSelectable?`text`:``,applyRowTooltip(this,[this._titleEl,this._contentEl])}};customElements.define(`adw-preferences-row`,AdwPreferencesRow);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);var AdwShortcutsDialog=class extends AdwDialog{get sections(){return[...this.contentArea.children].filter(e=>e.localName===`adw-shortcuts-section`)}connectedCallback(){super.connectedCallback(),this.classList.add(`adw-shortcuts-dialog`)}};customElements.define(`adw-shortcuts-dialog`,AdwShortcutsDialog);const ir=new WeakMap,ar=new WeakMap;var AdwSidebarItem=class extends HTMLElement{static get observedAttributes(){return[`title`,`subtitle`,`icon-name`,`disabled`,`hidden`,`enabled`,`visible`,`needs-attention`,`badge-number`]}get enabled(){let e=this.getAttribute(`enabled`);return e===null?!this.hasAttribute(`disabled`):booleanAttribute$2(e,!0)}set enabled(e){this.setAttribute(`enabled`,e?`true`:`false`),this.toggleAttribute(`disabled`,!e)}get visible(){let e=this.getAttribute(`visible`);return e===null?!this.hasAttribute(`hidden`):booleanAttribute$2(e,!0)}set visible(e){this.setAttribute(`visible`,e?`true`:`false`),this.toggleAttribute(`hidden`,!e)}attributeChangedCallback(e,t,n){let r=ir.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===`enabled`?r.spec.enabled=booleanAttribute$2(n,!0):e===`hidden`?r.spec.visible=n===null:e===`visible`?r.spec.visible=booleanAttribute$2(n,!0):e===`needs-attention`?r.spec.needsAttention=n===null:e===`badge-number`&&(r.spec.badgeNumber=Number.parseInt(i,10)||0),r.sidebar.refresh()}},AdwSidebarSection=class extends HTMLElement{static get observedAttributes(){return[`title`]}attributeChangedCallback(e,t,n){let r=ar.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.enabled,visible:e.visible,badgeNumber:Number.parseInt(e.getAttribute(`badge-number`)??`0`,10)||0,needsAttention:e.hasAttribute(`needs-attention`)};ir.set(e,{sidebar:this,spec:t}),n.push(t)}let r={title:t.getAttribute(`title`)??``,items:n};ar.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=createGtkImage(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(this._createIndicator(t)),n.appendChild(createGtkImage(`go-next`,`adw-sidebar-item-arrow`)),n.addEventListener(`click`,()=>this._activate(e.index)),n}_createIndicator(e){let t=e.badgeNumber??0,n=e.needsAttention===!0,r=document.createElement(`span`);if(r.className=`indicator`,r.hidden=!n&&t===0,r.classList.toggle(`dot`,t===0),r.classList.toggle(`needs-attention`,n),t>0){let e=document.createElement(`span`);e.className=`numeric`,e.textContent=viewSwitcherBadgeLabel(t),r.appendChild(e)}return r}_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 or=[`value`,`lower`,`upper`,`stepIncrement`,`pageIncrement`,`pageSize`];function authoredAdjustment(e){let t={};if(!(e instanceof Element))return t;for(let n of or){let r=e.getAttribute(attributeOf(n)),i=r===null?NaN:Number.parseFloat(r);Number.isFinite(i)&&(t[n]=i)}return t}var AdwSpinRow=class extends HTMLElement{_input;_textEl;_controlEl;_titleEl;_subtitleEl;_state=new SpinState;_initialized=!1;static get observedAttributes(){return[`title`,`subtitle`,`value`,`adjustment`,`tooltip-text`,`title-lines`,`subtitle-lines`]}get value(){return this._state.value}set value(e){this._state.setValue(this._roundToStep(e)),this._syncValue()}get adjustment(){return this._state.adjustment}set adjustment(e){this._state.configure(typeof e==`string`?parseAdjustment(e):e)}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=normalizeAdjustment(parseAdjustment(this.getAttribute(`adjustment`)));this._state.configure(e);let t=document.createElement(`div`);t.className=`adw-row-text`,this._textEl=t,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-row-title`,this._subtitleEl=document.createElement(`span`),this._subtitleEl.className=`adw-row-subtitle`,t.append(this._titleEl,this._subtitleEl);let n=document.createElement(`div`);n.className=`adw-spin-control`,this._controlEl=n;let r=document.createElement(`button`);r.className=`adw-spin-dec`,r.textContent=`−`,r.addEventListener(`click`,()=>this._adjust(-this._state.adjustment.stepIncrement));let i=document.createElement(`input`);i.type=`text`,i.value=this._formatValue(this._state.value),i.addEventListener(`change`,()=>{let e=parseFloat(i.value);Number.isNaN(e)?i.value=this._formatValue(this._state.value):(this.value=e,this._emitChange())});let a=document.createElement(`button`);a.className=`adw-spin-inc`,a.textContent=`+`,a.addEventListener(`click`,()=>this._adjust(this._state.adjustment.stepIncrement)),n.append(r,i,a),bindSlottedChildren(this,[{name:`adjustment`,consume:e=>this._state.configure(normalizeAdjustment(authoredAdjustment(e)))}]).install(t,n);let o=this.getAttribute(`value`);this._state.setValue(this._roundToStep(o===null?this._state.value:Number.parseFloat(o))),i.value=this._formatValue(this._state.value),this._input=i,this._state.subscribe(()=>this._syncValue()),this._renderText()}attributeChangedCallback(e,t,n){if(this._initialized){if(e===`title`||e===`subtitle`||e===`tooltip-text`||e===`title-lines`||e===`subtitle-lines`){this._renderText();return}if(e===`adjustment`){this._state.configure(parseAdjustment(n));return}this._state.setValue(this._roundToStep(Number.parseFloat(n||`0`)))}}_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,applyRowTooltip(this,[this._textEl,this._controlEl]),this._applyLineClamping()}_applyLineClamping(){applyRowLineClamp({titleEl:this._titleEl,subtitleEl:this._subtitleEl,textContainerEl:this._titleEl.parentElement,getTitleLines:()=>parseRowLinesAttribute(this.getAttribute(`title-lines`)),getSubtitleLines:()=>parseRowLinesAttribute(this.getAttribute(`subtitle-lines`))})}_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.adjustment.stepIncrement);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.adjustment.stepIncrement);return t>0?e.toFixed(t):String(e)}};customElements.define(`adw-spin-row`,AdwSpinRow);const sr=`http://www.w3.org/2000/svg`,V=new Set;let cr=0;function tick(e){for(let t of V)t.drawAt(e);cr=V.size>0?requestAnimationFrame(tick):0}function startTicking(){cr===0&&V.size>0&&(cr=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(),V.add(this),this._origin=null,startTicking()}disconnectedCallback(){V.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(sr,`svg`);e.setAttribute(`fill`,`none`),e.setAttribute(`aria-hidden`,`true`);let t=document.createElementNS(sr,`circle`);t.setAttribute(`stroke`,`currentColor`),t.setAttribute(`stroke-opacity`,`0.15`);let n=document.createElementNS(sr,`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?Ht:this._lastProgress)}_lastProgress=Ht;_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 PopoverMenuView=class{surface;prefix;onActivate;_model=[];_actions=null;_title=``;_page=[];_openers=new Set;_backRow=null;_key=`[]`;_rows=[];constructor(e,t,n){this.surface=e,this.prefix=t,this.onActivate=n,this.surface.addEventListener(`keydown`,e=>this._onKeyDown(e))}_onKeyDown(e){let t=document.activeElement;if(!(t===null||!this.surface.contains(t))){if(e.key===`ArrowRight`&&this._openers.has(t)){e.preventDefault(),t.click();return}e.key===`ArrowLeft`&&t===this._backRow&&(e.preventDefault(),t.click())}}get rows(){return this._rows}get page(){return this._page}showPage(e){this._page=[...e]}get focusableRows(){return this._rows.filter(e=>!e.hidden&&!e.disabled)}focusPage(e){let t=this.focusableRows;(t[e]??t[0])?.focus()}setMenuModel(e){let t=JSON.stringify(e);t!==this._key&&(this._key=t,this._page=[]),this._model=e}setActions(e){this._actions=e}setTitle(e){this._title=e}reset(){this._page=[]}currentItems(){if(this._page.length===0)return this._model;let e=menuNodeAt(this._model,this._page);return e!==null&&e.kind!==`item`?e.items:this._model}render(){this.surface.replaceChildren(),this._rows=[],this._openers=new Set,this._backRow=null;let e=menuNodeAt(this._model,this._page);this._page.length>0&&e!==null&&e.kind===`submenu`?this.surface.appendChild(this.backRow(e.label)):this._title.length>0&&this.surface.appendChild(this.heading(this._title,`${this.prefix}-title`));let t=``;for(let e of flattenMenu(this.currentItems(),this._page)){e.separated&&this.surface.appendChild(this.separator());let n=e.path.slice(0,-1),r=n.join(`.`);if(r!==t){t=r;let e=this.sectionHeading(n);e!==null&&this.surface.appendChild(this.heading(e,`adw-popover-section-title`))}e.node.kind===`submenu`?this.surface.appendChild(this.submenuRow(e.node.label,e.node.icon,e.path)):this.surface.appendChild(this.itemRow(e.node,e.path))}}sectionHeading(e){if(e.length<=this._page.length)return null;let t=menuNodeAt(this._model,e);return t!==null&&t.kind===`section`&&t.label!==void 0?t.label:null}heading(e,t){let n=document.createElement(`div`);return n.className=`adw-popover-title ${t}`,n.textContent=e,n}separator(){let e=document.createElement(`div`);return e.className=`adw-popover-separator`,e.setAttribute(`role`,`separator`),e}baseRow(e){let t=document.createElement(`button`);return t.type=`button`,t.className=`adw-popover-item ${e}`,t.tabIndex=-1,this._rows.push(t),t}backRow(e){let t=this.baseRow(`${this.prefix}-item adw-popover-back`);t.setAttribute(`role`,`menuitem`),t.appendChild(createGtkImage(`go-previous`,`${this.prefix}-item-icon`));let n=document.createElement(`span`);return n.className=`${this.prefix}-item-label`,n.textContent=e.length>0?e:`Back`,t.appendChild(n),t.addEventListener(`click`,()=>{this._page=this._page.slice(0,-1),this.render(),this.focusPage(0)}),this._backRow=t,t}submenuRow(e,t,n){let r=this.baseRow(`${this.prefix}-item`);r.setAttribute(`role`,`menuitem`),r.setAttribute(`aria-haspopup`,`menu`),t!==void 0&&t.length>0&&r.appendChild(createGtkImage(t,`${this.prefix}-item-icon`));let i=document.createElement(`span`);return i.className=`${this.prefix}-item-label`,i.textContent=e,r.appendChild(i),r.appendChild(createGtkImage(`go-next`,`adw-popover-item-arrow`)),r.addEventListener(`click`,()=>{this._page=[...n],this.render(),this.focusPage(1)}),this._openers.add(r),r}itemRow(e,t){let n=resolveMenuItemState(e,this._actions??void 0),r=this.baseRow(`${this.prefix}-item`);if(r.hidden=!n.visible,r.disabled=!n.sensitive,n.sensitive||r.setAttribute(`aria-disabled`,`true`),n.role===`normal`)r.setAttribute(`role`,`menuitem`);else{r.setAttribute(`role`,n.role===`check`?`menuitemcheckbox`:`menuitemradio`),r.setAttribute(`aria-checked`,String(n.toggled));let e=document.createElement(`span`);e.className=`adw-popover-item-check ${n.role===`radio`?`radio`:``}`.trim(),r.appendChild(e)}e.icon!==void 0&&e.icon.length>0&&r.appendChild(createGtkImage(e.icon,`${this.prefix}-item-icon`));let i=document.createElement(`span`);if(i.className=`${this.prefix}-item-label`,i.textContent=e.label,r.appendChild(i),e.accel!==void 0&&e.accel.length>0){let t=document.createElement(`span`);t.className=`adw-popover-item-accel`,t.textContent=e.accel,r.appendChild(t)}return r.addEventListener(`click`,()=>{n.sensitive&&this.onActivate(t)}),r}};const lr=[`bottom`,`top`,`start`,`end`],ur=[`start`,`end`],dr=[`menu`,`listbox`],fr=[...dr,`dialog`];var GtkPopover=class extends HTMLElement{_state=new PopoverState;_anchor=null;_initialized=!1;_reflecting=!1;_onDocumentPointerDown=e=>{if(!this.autohide)return;let t=e.target;this.contains(t)||this.anchor?.contains(t)!==!0&&this._state.dismiss()};_onDocumentKeyDown=e=>{e.key===`Escape`&&this.autohide&&(e.stopPropagation(),this._state.dismiss(),this.anchor?.focus())};static get observedAttributes(){return[`open`,`position`,`align`,`role`,`menu`,`autohide`]}get open(){return this._state.open}set open(e){e?this._state.popup():this._state.popdown()}get autohide(){return this.getAttribute(`autohide`)!==`false`}set autohide(e){this.setAttribute(`autohide`,String(e))}get anchor(){return this._anchor??this.parentElement}set anchor(e){this._anchor=e}get position(){let e=this.getAttribute(`position`);return lr.includes(e)?e:`bottom`}set position(e){this.setAttribute(`position`,e)}get align(){let e=this.getAttribute(`align`);return ur.includes(e)?e:`start`}set align(e){this.setAttribute(`align`,e)}get popoverRole(){let e=this.getAttribute(`role`);return fr.includes(e)?e:`menu`}get items(){return[...this.querySelectorAll(`.adw-popover-item`)].filter(e=>!e.hidden&&!e.disabled)}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||!dr.includes(this.popoverRole))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(`gtk-popover`,GtkPopover);const pr={flat:`flat`,suggested:`suggested-action`,destructive:`destructive-action`},mr={"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`},hr={down:`bottom`,up:`top`,left:`start`,right:`end`};var AdwSplitButton=class extends HTMLElement{_state=new SplitButtonState;_actionEl;_dropdownEl;_arrowEl;_menuEl;_menuView;_actions=null;_inlineLabel=``;_openReflected=!1;_initialized=!1;static get observedAttributes(){return[`label`,`icon-name`,`use-underline`,`tooltip`,`dropdown-tooltip`,`direction`,`menu-model`,`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 menuModel(){return this._state.menuModel??[]}set menuModel(e){this._state.setMenuModel(this._acceptMenu(e)),this._initialized&&this._render()}_acceptMenu(e,t=!0){let n=normalizeMenuModel(e);if(t)return assertMenuRenderable(n,E),n;let r=menuRefusals(n,E);if(r.length===0)return n;console.error(`${E.name} cannot render this menu, so it has none:`);for(let e of r)console.error(` [${e.path.join(`.`)}] ${e.message}`);return[]}get actions(){return this._actions}set actions(e){this._actions=e??null,this._menuView?.setActions(this._actions),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=createGtkImage(null),this._dropdownEl.appendChild(this._arrowEl),this._menuEl=document.createElement(`gtk-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._menuView.reset())}),this._menuView=new PopoverMenuView(this._menuEl,`adw-split-button-menu`,e=>{let t=this._state.activateMenuItem(e);t!==null&&(activateElementMenuItem(this,t),this.dispatchEvent(new CustomEvent(`menu-activated`,{bubbles:!0,detail:{label:t.label,action:t.action,id:t.id??t.label,path:[...e]}})))}),this._menuView.setActions(this._actions),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-model`:this._state.setMenuModel(this._acceptMenu(parseMenuModel(n),!1));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(this._acceptMenu(parseMenuModel(this.getAttribute(`menu-model`)),!1))}_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._menuView.focusableRows[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(pr))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(createGtkImage(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=mr[n],this._arrowEl.style.transform=n===`pan-up-symbolic`?`rotate(180deg)`:``,this._menuEl.position=hr[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.open=this._state.open;let e=this._state.menuModel??[];this._menuView.setMenuModel(e),this._menuView.setActions(this._actions??menuActionsOfElement(this,e)),this._menuView.render()}};customElements.define(`adw-split-button`,AdwSplitButton);var AdwStatusPage=class extends HTMLElement{_iconEl;_titleEl;_descEl;_childEl;_initialized=!1;static get observedAttributes(){return[`icon`,`icon-name`,`title`,`description`,`compact`]}connectedCallback(){this._initialized||(this._initialized=!0,this._iconEl=createGtkImage(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`,bindSlottedChildren(this,[{name:`child`,into:this._childEl},{into:this._childEl}]).install(this._iconEl,this._titleEl,this._descEl,this._childEl),bindEmptySections(this._childEl),this._render())}attributeChangedCallback(){this._initialized&&this._render()}_render(){this.hasAttribute(`compact`)&&this.classList.add(`compact`);let e=this.getAttribute(`icon`)??this.getAttribute(`icon-name`);this._iconEl.iconName=e,this._iconEl.hidden=!stringIsNotEmpty(e);let t=this.getAttribute(`title`)??``;this._titleEl.textContent=t,this._titleEl.hidden=!stringIsNotEmpty(t);let n=this.getAttribute(`description`)??``;this._descEl.textContent=n,this._descEl.hidden=!stringIsNotEmpty(n)}};customElements.define(`adw-status-page`,AdwStatusPage);var AdwSwitchRow=class extends HTMLElement{_switchEl;_prefixEl;_textEl;_titleEl;_subtitleEl;_state=new SwitchRowState;_initialized=!1;static get observedAttributes(){return[`title`,`subtitle`,`active`,`tooltip-text`,`title-lines`,`subtitle-lines`]}get prefixSection(){return this._prefixEl}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._textEl=e,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._prefixEl=document.createElement(`div`),this._prefixEl.className=`adw-switch-row-prefix`,this._switchEl=document.createElement(`gtk-switch`),this._switchEl.unfocusable=!0,bindSlottedChildren(this,[{name:`prefix`,into:this._prefixEl}]).install(this._prefixEl,e,this._switchEl),bindEmptySections(this._prefixEl),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,applyRowTooltip(this,[this._prefixEl,this._textEl]),this._applyLineClamping()}_applyLineClamping(){applyRowLineClamp({titleEl:this._titleEl,subtitleEl:this._subtitleEl,textContainerEl:this._titleEl.parentElement,getTitleLines:()=>parseRowLinesAttribute(this.getAttribute(`title-lines`)),getSubtitleLines:()=>parseRowLinesAttribute(this.getAttribute(`subtitle-lines`))})}};customElements.define(`adw-switch-row`,AdwSwitchRow);const createTabChip=e=>{let t=document.createElement(`button`);t.type=`button`,t.className=`adw-tab`,t.setAttribute(`role`,`tab`);let n=createGtkImage(null,`adw-tab-icon`),r=document.createElement(`adw-spinner`);r.className=`adw-tab-spinner`,r.setAttribute(`size`,`16`),r.hidden=!0;let i=document.createElement(`span`);i.className=`adw-tab-title`;let a=createGtkImage(null,`adw-tab-indicator`),o=document.createElement(`button`);return o.type=`button`,o.className=`adw-tab-close`,o.setAttribute(`aria-label`,`Close tab`),o.addEventListener(`click`,t=>{t.stopPropagation(),e.onClose()}),t.append(n,r,i,a,o),t.addEventListener(`click`,()=>e.onSelect()),t.addEventListener(`pointerenter`,()=>e.onHover(!0)),t.addEventListener(`pointerleave`,()=>e.onHover(!1)),{el:t,icon:n,spinner:r,label:i,indicator:a,close:o}},refreshTabChip=(e,t,n)=>{e.label.textContent=t.title,e.el.title=tabTooltip(t),e.el.classList.toggle(`pinned`,t.pinned),e.el.classList.toggle(`needs-attention`,t.needsAttention),e.el.classList.toggle(`closing`,t.closing);let r=tabIconState(t,n);e.icon.iconName=r.icon,e.icon.hidden=!r.iconVisible||r.spinner,e.spinner.hidden=!(r.spinner&&r.iconVisible),e.indicator.iconName=t.indicatorIcon,e.indicator.hidden=!r.indicatorVisible},chipPosition=(e,t)=>t.getBoundingClientRect().left-e.getBoundingClientRect().left+e.scrollLeft,refreshTabChipClose=(e,t,n,r)=>{let i=e.scrollLeft,a=chipPosition(e,t.el),o=a>=i&&a+t.el.offsetWidth<=i+e.clientWidth;t.close.hidden=!tabCloseVisible({hovering:r.hovering,fullyVisible:o,selected:r.selected,dragging:!1,pinned:n.pinned})},scrollChipIntoBar=(e,t)=>{let n=e.clientWidth,r=t.offsetWidth;if(n<=0||r<=0)return;let i=e.scrollLeft,a=chipPosition(e,t),o=Math.min(r,n-r)/2;a-5<i?e.scrollLeft=a-o:a+r+5>i+n&&(e.scrollLeft=a+r+o-n)},gr=[`page-attached`,`page-detached`,`page-reordered`,`page-updated`,`page-pinned`,`notify::selected-page`];var AdwTabBar=class extends HTMLElement{_boxEl;_startEl;_endEl;_indicatorEl;_chips=new Map;_hovered=new Set;_view=null;_initialized=!1;_preferredAction=null;_dropTypes=[];_dropActions=[];_dropArmed=!1;static get observedAttributes(){return[`view`,`autohide`,`expand-tabs`,`inverted`,`extra-drag-preload`]}get view(){return this._view}set view(e){this.setView(e===null?null:typeof e==`string`?this._resolveView(e):e)}get startActionWidget(){return this._startEl?.firstElementChild??null}set startActionWidget(e){this.startActionWidget!==e&&(this._startEl.replaceChildren(...e===null?[]:[e]),this.dispatchEvent(new CustomEvent(`notify::start-action-widget`,{bubbles:!0,detail:{widget:e}})))}get endActionWidget(){return this._endEl?.firstElementChild??null}set endActionWidget(e){this.endActionWidget!==e&&(this._endEl.replaceChildren(...e===null?[]:[e]),this.dispatchEvent(new CustomEvent(`notify::end-action-widget`,{bubbles:!0,detail:{widget: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 inverted(){return this.hasAttribute(`inverted`)}set inverted(e){e?this.setAttribute(`inverted`,``):this.removeAttribute(`inverted`)}get extraDragPreload(){return this.hasAttribute(`extra-drag-preload`)}set extraDragPreload(e){e?this.setAttribute(`extra-drag-preload`,``):this.removeAttribute(`extra-drag-preload`)}get tabsRevealed(){return tabsRevealed({autohide:this.autohide,nPages:this._view?.nPages??0,nPinnedPages:this._view?.nPinnedPages??0,isTransferringPage:!1})}get isOverflowing(){return this._initialized?this.scrollWidth>this.clientWidth:!1}get extraDragPreferredAction(){return this._preferredAction}setView(e){this._view!==e&&(this._unbindView(),this._view=e,this._bindView(),this._syncChips(),this._applyRevealed(),this.dispatchEvent(new CustomEvent(`notify::view`,{bubbles:!0,detail:{view:e}})))}connectedCallback(){if(this._initialized){this._bindView(),this._syncChips();return}this._initialized=!0,this.classList.add(`adw-tab-bar`),this.setAttribute(`role`,`tablist`),this._startEl=document.createElement(`div`),this._startEl.className=`adw-tab-bar-start-action`,this._boxEl=document.createElement(`div`),this._boxEl.className=`adw-tab-box`,this._indicatorEl=document.createElement(`div`),this._indicatorEl.className=`adw-tab-box-overflow`,this._indicatorEl.hidden=!0,this._boxEl.appendChild(this._indicatorEl),this._endEl=document.createElement(`div`),this._endEl.className=`adw-tab-bar-end-action`,bindSlottedChildren(this,[{name:`start-action-widget`,into:this._startEl},{name:`end-action-widget`,into:this._endEl}]).install(this._startEl,this._boxEl,this._endEl);let e=this.getAttribute(`view`);this.setView(e===null?null:this._resolveView(e)),this._bindView(),this._syncChips(),this._applyRevealed(),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),this.addEventListener(`dragover`,this._onDragOver),this.addEventListener(`drop`,this._onDrop)}disconnectedCallback(){this._unbindView()}attributeChangedCallback(e,t,n){if(this._initialized){switch(e){case`view`:this.setView(n===null?null:this._resolveView(n));return;case`autohide`:this._applyRevealed();break;case`expand-tabs`:case`inverted`:case`extra-drag-preload`:break}(n!==null||e===`view`)&&this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:n}}))}}setupExtraDropTarget(e,t=[`copy`,`move`]){this._dropTypes=e,this._dropActions=t}_resolveView(e){return document.getElementById(e)??null}_bindView(){this._unbindView();for(let e of gr)this._view?.addEventListener(e,this._onViewChange)}_unbindView(){for(let e of gr)this._view?.removeEventListener(e,this._onViewChange)}_onViewChange=()=>{this._syncChips(),this._applyRevealed()};_syncChips(){let e=this._view?.pages??[],t=new Set;e.forEach((e,n)=>{t.add(e.id);let r=this._chips.get(e.id);if(r===void 0){let t=createTabChip({onSelect:()=>this._view?.setSelectedPage(e.id),onClose:()=>this._view?.closePage(e.id),onHover:t=>{t?this._hovered.add(e.id):this._hovered.delete(e.id),this._refreshOne(e.id)}});t.el.dataset.pageId=e.id,t.close.tabIndex=-1,this._chips.set(e.id,t),this._boxEl.insertBefore(t.el,this._boxEl.children[n]??null)}else this._boxEl.children[n]!==r.el&&this._boxEl.insertBefore(r.el,this._boxEl.children[n]??null);this._refreshOne(e.id)});for(let[e,n]of this._chips)t.has(e)||(n.el.remove(),this._chips.delete(e),this._hovered.delete(e));this._applyActiveState(),this._boxEl.classList.toggle(`single-tab`,e.length<=1),this._applyOverflow()}_refreshOne(e){let t=this._view?.pages.find(t=>t.id===e),n=this._chips.get(e);t===void 0||n===void 0||(refreshTabChip(n,t,this._view?.getAttribute(`default-icon`)),refreshTabChipClose(this,n,t,{hovering:this._hovered.has(e),selected:this._view?.selectedId===e}))}_applyActiveState(){let e=this._view?.selectedId??null;for(let[t,n]of this._chips){let r=t===e;n.el.classList.toggle(`active`,r),n.el.setAttribute(`aria-selected`,String(r)),n.el.tabIndex=r?0:-1;let i=this._view?.pages.find(e=>e.id===t);i!==void 0&&refreshTabChipClose(this,n,i,{hovering:this._hovered.has(t),selected:r})}if(e===null)return;let t=this._chips.get(e);t!==void 0&&scrollChipIntoBar(this,t.el)}_applyRevealed(){this.hidden=!this.tabsRevealed}_applyOverflow(){this._indicatorEl.hidden=!this.isOverflowing}_onKeyDown(e){let t=this._view;if(t===null)return;let n=!1;if(e.ctrlKey&&e.key===`Tab`)n=e.shiftKey?t.cyclePreviousPage():t.cycleNextPage();else if(e.ctrlKey&&(e.key===`PageUp`||e.key===`PageDown`))n=e.key===`PageUp`?t.selectPreviousPage():t.selectNextPage();else if(e.ctrlKey&&(e.key===`Home`||e.key===`End`))n=e.key===`Home`?t.selectFirstPage():t.selectLastPage();else if(e.altKey&&/^[0-9]$/.test(e.key)){let r=Number.parseInt(e.key,10);n=t.selectNthPage(r===0?9:r-1)}else e.key===`ArrowLeft`||e.key===`ArrowRight`?n=e.key===`ArrowLeft`?t.selectPreviousPage():t.selectNextPage():(e.key===`Home`||e.key===`End`)&&(n=e.key===`Home`?t.selectFirstPage():t.selectLastPage());if(!n)return;e.preventDefault();let r=t.selectedId;r!==null&&this._chips.get(r)?.el.focus({preventScroll:!0})}_onDragOver=e=>{this._dropTypes.length===0||e.dataTransfer===null||[...this._dropTypes].find(t=>e.dataTransfer?.types.includes(t))!==void 0&&(e.preventDefault(),e.dataTransfer.dropEffect!==`none`&&(e.dataTransfer.dropEffect=this._dropEffects(e)),this._armHoverValue())};_onDrop=e=>{if(this._dropTypes.length===0||e.dataTransfer===null)return;let t=[...this._dropTypes].find(t=>e.dataTransfer?.types.includes(t));if(t===void 0)return;e.preventDefault();let n=this._dropEffects(e),r=this.dispatchEvent(new CustomEvent(`extra-drag-drop`,{bubbles:!0,cancelable:!0,detail:{action:n,data:e.dataTransfer.getData(t)}}));e.dataTransfer.dropEffect=r?n:`none`};_dropEffects(e){let t=this._preferredAction;return t!==null&&this._dropActions.includes(t)?t:this._dropActions[0]??`copy`}_armHoverValue(){if(this._dropArmed)return;this._dropArmed=!0;let e=new CustomEvent(`extra-drag-value`,{bubbles:!0,cancelable:!0,detail:{action:null}});this.dispatchEvent(e);let t=e.detail.action;t!==this._preferredAction&&(this._preferredAction=t,this.dispatchEvent(new CustomEvent(`notify::extra-drag-preferred-action`,{bubbles:!0,detail:{action:t}})))}};customElements.define(`adw-tab-bar`,AdwTabBar);const _r=[`page-attached`,`page-detached`,`page-updated`,`notify::selected-page`];var AdwTabButton=class extends HTMLElement{_button;_binEl;_labelEl;_indicatorEl;_view=null;_initialized=!1;static get observedAttributes(){return[`view`]}get view(){return this._view}set view(e){this.setView(e===null?null:typeof e==`string`?this._resolveView(e):e)}setView(e){this._view!==e&&(this._unbindView(),this._view=e,this._bindView(),this._render(),this.dispatchEvent(new CustomEvent(`notify::view`,{bubbles:!0,detail:{view:e}})))}connectedCallback(){if(this._initialized){this._bindView(),this._render();return}this._initialized=!0,this._button=document.createElement(`button`),this._button.type=`button`,this._button.className=`adw-button image-button`,this._button.title=`View Open Tabs`,this._binEl=document.createElement(`span`),this._binEl.className=`adw-tab-button-indicatorbin`;let e=document.createElement(`span`);e.className=`adw-tab-button-plate`,this._labelEl=document.createElement(`span`),this._labelEl.className=`adw-tab-button-label numeric`,this._indicatorEl=document.createElement(`span`),this._indicatorEl.className=`adw-tab-button-indicator`,this._binEl.append(e,this._labelEl),this._button.append(this._binEl,this._indicatorEl),this.replaceChildren(this._button),this.setAttribute(`role`,`button`);let t=this.getAttribute(`view`);this.setView(t===null?null:this._resolveView(t)),this._bindView(),this._render()}disconnectedCallback(){this._unbindView()}attributeChangedCallback(e,t,n){!this._initialized||e!==`view`||this.setView(n===null?null:this._resolveView(n))}_resolveView(e){return document.getElementById(e)??null}_onViewChange=()=>this._render();_bindView(){this._unbindView();for(let e of _r)this._view?.addEventListener(e,this._onViewChange)}_unbindView(){for(let e of _r)this._view?.removeEventListener(e,this._onViewChange)}_render(){let e=this._view,t=e?.nPages??0,n=t<100;this._labelEl.textContent=n?String(t):``,this._labelEl.hidden=!n,this._labelEl.classList.toggle(`small`,t>=10),this._binEl.classList.toggle(`overflow`,!n);let r=e?.selectedId??null,i=e?.pages.some(e=>e.needsAttention&&e.id!==r)??!1;this._indicatorEl.classList.toggle(`needs-attention`,i),this._indicatorEl.hidden=!i,this._button.setAttribute(`aria-label`,`View Open Tabs (${t})`)}};customElements.define(`adw-tab-button`,AdwTabButton);var AdwTabOverview=class extends HTMLElement{_childEl;_overviewEl;_headerEl;_startButtonsEl;_endButtonsEl;_titleEl;_searchBtn;_searchEntry;_searchClamp;_searchBar;_menuBtn;_gridEl;_pinnedGridEl;_emptyState;_searchEmptyState;_newTabBtn;_thumbs=new Map;_view=null;_model=[];_searchActive=!1;_initialized=!1;_appliedOpen=!1;_reflecting=!1;static get observedAttributes(){return[`view`,`open`,`inverted`,`enable-search`,`enable-new-tab`,`secondary-menu`,`show-start-title-buttons`,`show-end-title-buttons`,`extra-drag-preload`]}get view(){return this._view}set view(e){this.setView(e===null?null:typeof e==`string`?this._resolveView(e):e)}setView(e){this._view!==e&&(this._unbindView(),this._view=e,this._bindView(),this._initialized&&this._syncAll(),this.dispatchEvent(new CustomEvent(`notify::view`,{bubbles:!0,detail:{view:e}})))}get child(){return this._childEl.firstElementChild}get open(){return this.hasAttribute(`open`)}set open(e){this.setOpen(e)}get inverted(){return this.hasAttribute(`inverted`)}set inverted(e){this.toggleAttribute(`inverted`,e)}get enableSearch(){return this.getAttribute(`enable-search`)!==`false`}set enableSearch(e){this.setAttribute(`enable-search`,String(e))}get searchActive(){return this._searchActive}get enableNewTab(){return this.hasAttribute(`enable-new-tab`)}set enableNewTab(e){this.toggleAttribute(`enable-new-tab`,e)}get secondaryMenu(){return this._model}set secondaryMenu(e){let t=normalizeMenuModel(e);assertMenuRenderable(t,E),this._model=t,this._applyMenu()}get showStartTitleButtons(){return this.getAttribute(`show-start-title-buttons`)!==`false`}set showStartTitleButtons(e){this.setAttribute(`show-start-title-buttons`,String(e))}get showEndTitleButtons(){return this.getAttribute(`show-end-title-buttons`)!==`false`}set showEndTitleButtons(e){this.setAttribute(`show-end-title-buttons`,String(e))}get extraDragPreload(){return this.hasAttribute(`extra-drag-preload`)}set extraDragPreload(e){this.toggleAttribute(`extra-drag-preload`,e)}get extraDragPreferredAction(){return 0}activateOverviewOpen(){return this.open||this._view===null?!1:(this.setOpen(!0),!0)}activateOverviewClose(){return!this.open||this._view===null||this._view.nPages===0?!1:(this.setOpen(!1),!0)}connectedCallback(){if(this._initialized){this._bindView(),this._syncAll();return}this._initialized=!0,this._childEl=document.createElement(`div`),this._childEl.className=`adw-tab-overview-child`,this._overviewEl=document.createElement(`div`),this._overviewEl.className=`overview adw-tab-overview-toolbar`,this._headerEl=document.createElement(`div`),this._headerEl.className=`adw-header-bar overview-header-bar`,this._startButtonsEl=document.createElement(`div`),this._startButtonsEl.className=`overview-title-buttons start`,this._endButtonsEl=document.createElement(`div`),this._endButtonsEl.className=`overview-title-buttons end`,this._searchBtn=document.createElement(`button`),this._searchBtn.type=`button`,this._searchBtn.className=`adw-button image-button search-button`,this._searchBtn.title=`Search Tabs`,this._searchBtn.appendChild(createGtkImage(`system-search`,`search-button-icon`)),this._titleEl=document.createElement(`div`),this._titleEl.className=`adw-window-title numeric overview-title`,this._menuBtn=document.createElement(`gtk-menu-button`),this._menuBtn.setAttribute(`icon-name`,`view-more`),this._menuBtn.className=`secondary-menu-button`,this._menuBtn.hidden=!0,this._headerEl.append(this._startButtonsEl,this._searchBtn,this._titleEl,this._endButtonsEl,this._menuBtn),this._searchBar=document.createElement(`div`),this._searchBar.className=`adw-search-bar overview-search-bar`,this._searchClamp=document.createElement(`div`),this._searchClamp.className=`adw-clamp overview-search-clamp`,this._searchEntry=document.createElement(`input`),this._searchEntry.type=`search`,this._searchEntry.className=`adw-entry overview-search-entry`,this._searchEntry.placeholder=`Search tabs`,this._searchEntry.setAttribute(`aria-label`,`Search tabs`),this._searchClamp.appendChild(this._searchEntry),this._searchBar.appendChild(this._searchClamp);let e=document.createElement(`div`);e.className=`adw-tab-overview-content`;let t=document.createElement(`div`);t.className=`adw-tab-overview-scroll`,this._pinnedGridEl=this._createGrid(`adw-tab-grid pinned-grid`,`Pinned tabs`),this._gridEl=this._createGrid(`adw-tab-grid`,`Open tabs`),t.append(this._pinnedGridEl,this._gridEl),this._emptyState=document.createElement(`adw-status-page`),this._emptyState.className=`overview-empty-state`,this._emptyState.setAttribute(`icon`,`view-grid`),this._emptyState.setAttribute(`title`,`No Open Tabs`),this._emptyState.hidden=!0,this._searchEmptyState=document.createElement(`adw-status-page`),this._searchEmptyState.className=`overview-search-empty-state`,this._searchEmptyState.setAttribute(`icon`,`system-search`),this._searchEmptyState.setAttribute(`title`,`No Tabs Found`),this._searchEmptyState.setAttribute(`description`,`Try a different search`),this._searchEmptyState.hidden=!0,this._newTabBtn=document.createElement(`button`),this._newTabBtn.type=`button`,this._newTabBtn.className=`adw-button pill suggested-action new-tab-button`,this._newTabBtn.append(createGtkImage(`list-add`,`new-tab-button-icon`),document.createTextNode(`New Tab`)),e.append(t,this._emptyState,this._searchEmptyState,this._newTabBtn),this._overviewEl.append(this._headerEl,this._searchBar,e);let n=Array.from(this.children);this.replaceChildren(this._childEl,this._overviewEl);for(let e of n)this._childEl.appendChild(e);this._searchEntry.addEventListener(`input`,()=>this._onSearchChanged()),this._searchEntry.addEventListener(`keydown`,e=>this._onSearchKeyDown(e)),this._searchBtn.addEventListener(`click`,()=>this._toggleSearchMode()),this._newTabBtn.addEventListener(`click`,()=>this._requestCreateTab()),this.addEventListener(`keydown`,e=>this._onKeyDown(e));let r=this.getAttribute(`view`);this.setView(r===null?this._findView():this._resolveView(r)),r!==null&&this.removeAttribute(`view`);let i=this.getAttribute(`secondary-menu`);i!==null&&(this.secondaryMenu=JSON.parse(i),this.removeAttribute(`secondary-menu`)),this._applyOpen(),this._syncAll()}disconnectedCallback(){this._unbindView()}attributeChangedCallback(e,t,n){if(this._initialized)switch(e){case`view`:this.setView(n===null?this._findView():this._resolveView(n));return;case`open`:this._reflecting||this._applyOpen();return;case`secondary-menu`:if(n===null)return;try{this.secondaryMenu=JSON.parse(n)}catch(e){console.error(`<adw-tab-overview secondary-menu> is not valid JSON: ${String(e)}`)}return;case`enable-new-tab`:this._applyNewTabButton();return;case`inverted`:this._syncGrids();return;case`enable-search`:case`show-start-title-buttons`:case`show-end-title-buttons`:this._applyHeaderBar();return}}_resolveView(e){return document.getElementById(e)??this._findView()}_findView(){return this.querySelector(`adw-tab-view`)}_bindView(){this._unbindView();for(let e of yr)this._view?.addEventListener(e,this._onViewChange)}_unbindView(){for(let e of yr)this._view?.removeEventListener(e,this._onViewChange)}_onViewChange=()=>{this._syncAll()};_syncAll(){this._applyTitle(),this._syncGrids(),this._applyEmptyStates(),this._applyNewTabButton(),this._applyHeaderBar()}_applyTitle(){let e=this._view;this._titleEl.textContent=e===null?``:e.nPages===1?`1 Tab`:`${e.nPages} Tabs`}_syncGrids(){let e=this._view,t=this._searchActive?this._searchEntry.value:``,n=new Set,r=[],i=[];if(e!==null)for(let a of e.pages){if(!tabSearchMatches(a,t)){this._thumbs.get(a.id)?.root.remove(),this._thumbs.delete(a.id);continue}n.add(a.id);let e=this._thumbFor(a.id);this._refreshThumb(e,a),(a.pinned?r:i).push(e.root)}for(let[e,t]of this._thumbs)n.has(e)||(t.root.remove(),this._thumbs.delete(e));this._pinnedGridEl.replaceChildren(...r),this._gridEl.replaceChildren(...i),this._pinnedGridEl.hidden=r.length===0}_applyEmptyStates(){let e=this._pinnedGridEl.childElementCount===0&&this._gridEl.childElementCount===0;this._emptyState.hidden=!(e&&!this._searchActive),this._searchEmptyState.hidden=!(e&&this._searchActive)}_applyNewTabButton(){this._newTabBtn.hidden=!(this.enableNewTab&&!this._searchActive)}_applyHeaderBar(){let e=this._model.length>0;this._headerEl.hidden=!(this.enableSearch||e||this.showStartTitleButtons||this.showEndTitleButtons),this._startButtonsEl.hidden=!this.showStartTitleButtons,this._endButtonsEl.hidden=!this.showEndTitleButtons,this._searchBtn.hidden=!this.enableSearch,this._searchBar.hidden=!this.enableSearch||!this._searchMode,this._menuBtn.hidden=!e}_applyMenu(){let e=this._menuBtn;this._model.length>0&&(e.menuModel=this._model),this._applyHeaderBar()}_applyOpen(){let e=this.open;this._overviewEl.hidden=!e,this._childEl.classList.toggle(`background`,e),this._childEl.inert=e,e!==this._appliedOpen&&(this._appliedOpen=e,this._reflecting=!0,e?this.hasAttribute(`open`)||this.setAttribute(`open`,``):this.hasAttribute(`open`)&&(this._searchMode=!1,this._setSearchActive(!1),this._searchEntry.value=``,this.removeAttribute(`open`)),this._reflecting=!1,this.dispatchEvent(new CustomEvent(`notify::open`,{bubbles:!0,detail:{open:e}})))}setOpen(e){this.open!==e&&(this._reflecting=!0,this.toggleAttribute(`open`,e),this._reflecting=!1,this._applyOpen(),e&&this._syncAll())}_searchMode=!1;_toggleSearchMode(){this._searchMode=!this._searchMode,this._searchBar.hidden=!this.enableSearch||!this._searchMode,this._searchMode?this._searchEntry.focus():this._stopSearch()}_onSearchChanged(){this._setSearchActive(this._searchEntry.value!==``),this._syncGrids(),this._applyEmptyStates(),this._applyNewTabButton()}_stopSearch(){this._searchEntry.value=``,this._setSearchActive(!1),this._syncGrids(),this._applyEmptyStates(),this._applyNewTabButton()}_setSearchActive(e){e!==this._searchActive&&(this._searchActive=e,this.dispatchEvent(new CustomEvent(`notify::search-active`,{bubbles:!0,detail:{searchActive:e}})))}_onSearchKeyDown(e){if(e.key===`Escape`){this._stopSearch(),this._searchMode=!1,this._searchBar.hidden=!this.enableSearch||!this._searchMode;return}e.key===`Enter`&&this._searchActive&&(this._focusFirstRow(this._pinnedGridEl)||this._focusFirstRow(this._gridEl))&&e.preventDefault()}_onKeyDown(e){if(!this.open)return;let t=e.target;if(t instanceof Node&&!this._onGridKey(e,t)&&!(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)){if(e.key===`ArrowDown`){if(this._searchBar.contains(t)||this._searchBtn.contains(t)){(this._focusFirstRow(this._pinnedGridEl)||this._focusFirstRow(this._gridEl))&&e.preventDefault();return}if(this._menuBtn.contains(t)){(this._focusLastRow(this._pinnedGridEl)||this._focusLastRow(this._gridEl))&&e.preventDefault();return}if(this._newTabBtn.contains(t))return;(this._gridEl.contains(t)||this._pinnedGridEl.contains(t))&&this._newTabBtn.hidden===!1&&(e.preventDefault(),this._newTabBtn.focus());return}this._newTabBtn.contains(t)&&(this._focusLastRow(this._gridEl)||this._focusLastRow(this._pinnedGridEl))&&e.preventDefault()}}_onGridKey(e,t){if(e.altKey||e.ctrlKey||e.metaKey)return!1;let n=[this._pinnedGridEl,this._gridEl].find(e=>e.contains(t));if(n===void 0)return!1;let r=[...n.children].filter(e=>e instanceof HTMLElement),i=r.findIndex(e=>e.contains(t));if(i<0||t instanceof Element&&t.closest(`button`)!==null)return!1;let a=this._view;if(a===null)return!1;if(e.key===`Enter`||e.key===` `){let t=r[i].dataset.pageId;return t===void 0?!1:(e.preventDefault(),a.setSelectedPage(t),this.setOpen(!1),!0)}let o=gridColumns(r.map(e=>e.getBoundingClientRect().top)),s=gridNavigate(e.key,i,r.length,o);if(s===null){let t=[`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key);return t&&e.preventDefault(),t}let c=r[s].dataset.pageId;return c===void 0?!1:(e.preventDefault(),a.setSelectedPage(c),r[s].focus(),!0)}_focusFirstRow(e){let t=e.querySelector(`.adw-tab-thumbnail`);return t===null?!1:(t.focus(),!0)}_focusLastRow(e){let t=e.querySelectorAll(`.adw-tab-thumbnail`),n=t[t.length-1];return n===void 0?!1:(n.focus(),!0)}_requestCreateTab(){let e=this._view;if(e===null)return;let t={page:null};if(this.dispatchEvent(new CustomEvent(`create-tab`,{bubbles:!0,detail:t})),t.page===null){console.error("<adw-tab-overview>: the create-tab handler must not leave `detail.page` unset.");return}e.setSelectedPage(t.page.id),this.setOpen(!1),t.page.content?.focus?.()}_createGrid(e,t){let n=document.createElement(`div`);return n.className=e,n.setAttribute(`role`,`grid`),n.setAttribute(`aria-label`,t),n}_thumbFor(e){let t=this._thumbs.get(e);if(t!==void 0)return t;let n=document.createElement(`div`);n.className=`adw-tab-thumbnail`,n.dataset.pageId=e,n.setAttribute(`role`,`gridcell`),n.tabIndex=-1;let r=document.createElement(`div`);r.className=`contents`;let i=document.createElement(`div`);i.className=`thumbnail`;let a=document.createElement(`div`);a.className=`card`;let o=document.createElement(`div`);o.className=`picture`;let s=document.createElement(`span`);s.className=`picture-portrait`,o.appendChild(s);let c=document.createElement(`button`);c.type=`button`,c.className=`tab-close-button adw-button image-button`,c.title=`Close Tab`,c.setAttribute(`aria-label`,`Close Tab`),c.tabIndex=-1,c.appendChild(createGtkImage(`window-close`,`tab-close-icon`));let l=document.createElement(`button`);l.type=`button`,l.className=`tab-unpin-icon`,l.tabIndex=-1,l.title=`Unpin Tab`,l.setAttribute(`aria-label`,`Unpin Tab`),l.dataset.iconName=`adw-tab-unpin-symbolic`;let u=document.createElement(`button`);u.type=`button`,u.className=`tab-indicator adw-button image-button`,u.tabIndex=-1;let d=createGtkImage(null,`tab-indicator-icon`);u.appendChild(d),a.append(o,c,l,u);let f=document.createElement(`div`);f.className=`needs-attention`;let p=document.createElement(`div`);p.className=`gizmo`,f.appendChild(p),i.append(a,f);let m=document.createElement(`div`);m.className=`icon-title-box`;let g=createGtkImage(null,`tab-icon`),_=document.createElement(`span`);_.className=`tab-label`,m.append(g,_),r.append(i,m),n.appendChild(r),n.addEventListener(`click`,()=>{let t=this._view;t!==null&&(t.setSelectedPage(e),this.setOpen(!1))}),n.addEventListener(`auxclick`,t=>{t.button===1&&(t.preventDefault(),this._view?.closePage(e))}),c.addEventListener(`click`,t=>{t.stopPropagation(),this._view?.closePage(e)}),l.addEventListener(`click`,t=>{t.stopPropagation(),this._view?.setPagePinned(e,!1)}),u.addEventListener(`click`,t=>{t.stopPropagation(),this._view?.dispatchEvent(new CustomEvent(`indicator-activated`,{bubbles:!0,detail:{id:e}}))});let v={root:n,label:_,icon:g,spinner:null,picture:o,portrait:s,closeBtn:c,unpinIcon:l,indicatorBtn:u,indicatorIcon:d,attention:f};return this._thumbs.set(e,v),v}_refreshThumb(e,t){if(e.root.title=tabTooltip(t),e.root.setAttribute(`aria-label`,tabTooltip(t)),e.icon.hidden=t.icon===null&&!t.loading,e.root.classList.toggle(`loading`,t.loading),t.loading&&e.spinner===null){let t=document.createElement(`adw-spinner`);t.className=`tab-spinner`,t.setAttribute(`size`,String(vr)),e.icon.replaceWith(t),e.spinner=t}else!t.loading&&e.spinner!==null&&(e.spinner.replaceWith(e.icon),e.spinner=null);e.indicatorBtn.hidden=t.indicatorIcon===null,e.indicatorIcon.iconName=t.indicatorIcon,e.attention.hidden=!t.needsAttention,e.root.classList.toggle(`inverted`,this.inverted),e.closeBtn.hidden=t.pinned,e.unpinIcon.hidden=!t.pinned,e.label.textContent=t.title,e.portrait.textContent=t.title;let n=this._view?.selectedId===t.id;e.root.classList.toggle(`selected`,n),e.root.setAttribute(`aria-selected`,String(n))}};const vr=`16`,yr=[`page-attached`,`page-detached`,`page-reordered`,`page-pinned`,`page-updated`,`notify::selected-page`];customElements.define(`adw-tab-overview`,AdwTabOverview);const br=[`title`,`tooltip`,`icon`,`indicator-icon`,`keyword`,`loading`,`needs-attention`,`pinned`];var AdwTabPage=class extends HTMLElement{static get observedAttributes(){return br}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this}])}attributeChangedCallback(e,t,n){let r=this.closest(`adw-tab-view`);r instanceof AdwTabView&&r.syncDeclaredPage(this,e,n)}},AdwTabView=class extends HTMLElement{_state=new TabViewState({onClosePage:e=>this._requestClose(e)});_barEl;_tabBoxEl;_pagesEl;_tabs=new Map;_chips=new Map;_panels=new Map;_hovered=new Set;_initialized=!1;_generatedIds=0;_reflecting=!1;static get observedAttributes(){return[`selected-page`,`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 selectedPage(){return this._state.selectedPage}set selectedPage(e){this._state.setSelectedPage(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-page`),t=Array.from(this.children);this.replaceChildren(this._barEl,this._pagesEl);for(let e of t)e.localName===`adw-tab-page`?this._adoptDeclaredPage(e):this.appendPage({id:this._nextId(),content: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-page`){if(this._reflecting)return;let e=this.getAttribute(`selected-page`);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`keyword`:this._state.setPageKeyword(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)}setPageKeyword(e,t){return this._state.setPageKeyword(e,t)}setPageIcon(e,t){return this._state.setPageIcon(e,t)}setPageIndicatorIcon(e,t){return this._state.setPageIndicatorIcon(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._chips.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=createTabChip({onSelect:()=>this._state.setSelectedPage(e.id),onClose:()=>this._state.closePage(e.id),onHover:t=>{t?this._hovered.add(e.id):this._hovered.delete(e.id),this._refreshCloseVisibility(e.id)}});n.el.dataset.pageId=e.id,n.close.tabIndex=-1,this._tabBoxEl.insertBefore(n.el,this._tabBoxEl.children[t]??null),this._tabs.set(e.id,n.el),this._chips.set(e.id,n);let r=e.content;r&&(this._panels.set(e.id,r),this._pagesEl.insertBefore(r,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);!t||!n||(refreshTabChip(this._chips.get(e),t,this.getAttribute(`default-icon`)),this._refreshCloseVisibility(e))}_refreshCloseVisibility(e){let t=this._state.getPage(e),n=this._chips.get(e);!t||!n||refreshTabChipClose(this._barEl,n,t,{hovering:this._hovered.has(e),selected:this._state.selectedId===e})}_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);t&&scrollChipIntoBar(this._barEl,t)}_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.selectedId;e===null?this.removeAttribute(`selected-page`):this.getAttribute(`selected-page`)!==e&&this.setAttribute(`selected-page`,e),this._reflecting=!1}_applySelectedAttribute(e){this._state.setSelectedPage(e)}_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-view`,AdwTabView),customElements.define(`adw-tab-page`,AdwTabPage);const xr={schedule:(e,t)=>setTimeout(e,t),cancel:e=>clearTimeout(e)};var AdwToastOverlay=class extends HTMLElement{_toasts;_initialized=!1;_queue;_scheduler=xr;_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`,this._toasts=document.createElement(`div`),this._toasts.className=`adw-toast-overlay-toasts`,bindSlottedChildren(this,[{into:e}]).install(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(createGtkImage(`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 AdwToggle=class extends HTMLElement{static get observedAttributes(){return[`label`,`icon-name`,`tooltip`,`enabled`]}attributeChangedCallback(e,t,n){e===`enabled`&&t!==n&&this.dispatchEvent(new CustomEvent(`toggle-enabled-changed`,{bubbles:!0,composed:!0,detail:{enabled:n!==`false`}}))}},AdwToggleGroup=class extends HTMLElement{_innerEl;_buttons=[];_state=new ToggleGroupState;_initialized=!1;_stateAttr=`aria-checked`;_names=[];_enabled=[];_toggles=[];static get observedAttributes(){return[`active`,`active-name`,`flat`,`round`,`sensitive`]}get sensitive(){return booleanAttribute$2(this.getAttribute(`sensitive`),!0)}set sensitive(e){this.setAttribute(`sensitive`,e?`true`:`false`)}isToggleEnabled(e){return this._enabled[e]??!1}get active(){return this._state.selected}set active(e){this.setAttribute(`active`,String(e))}get activeName(){return this._names[this._state.selected]??null}set activeName(e){e===null?this.removeAttribute(`active-name`):this.setAttribute(`active-name`,e)}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=Array.from(this.querySelectorAll(`adw-toggle`)),t=keptToggles(e.map(e=>({el:e,name:e.getAttribute(`name`)}))).map(e=>e.el);t.length<e.length&&console.warn(`[adw-toggle-group] a toggle name already exists; the later toggle is not added`);let n=this.getAttribute(`role`)?.trim()||null;n===null&&this.setAttribute(`role`,`radiogroup`);let r=n===`tablist`,i=r?`tab`:`radio`;this._stateAttr=r?`aria-selected`:`aria-checked`,this._innerEl=document.createElement(`div`),this._innerEl.className=`adw-toggle-group-inner`,this._innerEl.setAttribute(`role`,`none`),this._toggles=t,this._buttons=t.map((e,t)=>{let n=document.createElement(`button`);n.type=`button`,n.className=`adw-toggle`,n.setAttribute(`role`,i),this._enabled[t]=booleanAttribute$2(e.getAttribute(`enabled`),!0);let r=e.getAttribute(`label`)??``,a=e.getAttribute(`icon-name`)??``,o=e.getAttribute(`tooltip`)??``;return a&&n.appendChild(createGtkImage(a)),r&&n.appendChild(document.createTextNode(r)),n.title=o,!r&&o?n.setAttribute(`aria-label`,o):a&&!r&&n.setAttribute(`aria-label`,a),n.addEventListener(`click`,()=>this._selectIndex(t)),n}),this._innerEl.append(...this._buttons),this.replaceChildren(this._innerEl);for(let e=0;e<this._toggles.length;e++)this._toggles[e].addEventListener(`toggle-enabled-changed`,t=>{let{enabled:n}=t.detail;this._enabled[e]!==n&&(this._enabled[e]=n,this._render())});this._state.setLabels(t.map(e=>e.getAttribute(`label`)||e.getAttribute(`icon-name`)||``)),this._names=t.map(e=>e.getAttribute(`name`)),this._state.subscribe(()=>this._render()),this._state.setSelected(this._readActiveAttr()),this._applyActiveName(),this._render(),attachRovingFocus({host:this,orientation:`horizontal`,items:()=>this._buttons.filter(e=>!e.disabled),select:e=>this._selectIndex(this._buttons.findIndex(t=>t===e))})}attributeChangedCallback(e){if(this._initialized){if(e===`active`){this._state.setSelected(this._readActiveAttr());return}if(e===`active-name`){this._applyActiveName();return}this._render()}}_applyActiveName(){let e=this.getAttribute(`active-name`);if(e===null)return;let t=toggleIndexOfName(this._names,e);t!==-1&&this._state.setSelected(t)}_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._enabled[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,t=this.sensitive;this.toggleAttribute(`disabled`,!t),this._buttons.forEach((n,r)=>{let i=r===e;n.classList.toggle(`active`,i),n.setAttribute(this._stateAttr,String(i)),n.disabled=!t||!this._enabled[r],n.tabIndex=i?0:-1}),this._enabled[e]||this._activateFirstEnabled()}_activateFirstEnabled(){let e=this._enabled.findIndex(e=>e);e!==-1&&(this._state.setSelected(e),this.setAttribute(`active`,String(e)),this.dispatchEvent(new CustomEvent(`notify::active`,{bubbles:!0,detail:{active:e}})))}};customElements.define(`adw-toggle`,AdwToggle),customElements.define(`adw-toggle-group`,AdwToggleGroup);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(){this._initialized||(this._initialized=!0,this._topEl=document.createElement(`div`),this._topEl.className=`adw-toolbar-view-top`,this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-toolbar-view-content`,this._bottomEl=document.createElement(`div`),this._bottomEl.className=`adw-toolbar-view-bottom`,bindSlottedChildren(this,[{name:`top`,into:this._topEl},{name:`bottom`,into:this._bottomEl},{name:`content`,into:this._contentEl},{into:this._contentEl}]).install(this._topEl,this._contentEl,this._bottomEl),bindEmptySections(this._topEl,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 $e)this.classList.toggle(t,e.includes(t));for(let e of et)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);var AdwViewStack=class extends HTMLElement{static signals={"notify::visible-child":`notify::visible-child`,"notify::visible-child-name":`notify::visible-child-name`};_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}selectNthPage(e){return 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`),badgeNumber:e.hasAttribute(`badge-number`)?Number.parseInt(e.getAttribute(`badge-number`)??`0`,10):0,needsAttention:e.hasAttribute(`needs-attention`),useUnderline:e.hasAttribute(`use-underline`),startsSection:e.hasAttribute(`starts-section`),sectionTitle:e.getAttribute(`section-title`)}),this.replaceChild(n,e)}e!==null&&this._state.setVisibleName(e,!1),this._applyVisibility(),this._reflectName(),this._emitItemsChanged()}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}})),this.dispatchEvent(new CustomEvent(`notify::visible-child-name`,{bubbles:!0,detail:{"visible-child-name":e.name}}))}_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 AdwViewSwitcherPage=class extends HTMLElement{},AdwViewSwitcher=class extends HTMLElement{scheduler=$n;_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=createGtkImage(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 en)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 AdwViewSwitcherSidebar=class extends HTMLElement{_sidebar;_placeholderEl;_prefixEl;_suffixEl;_stack=null;_filter=null;_initialized=!1;static get observedAttributes(){return[`stack`,`mode`]}get stack(){return this._stack}set stack(e){this.setStack(e===null?null:typeof e==`string`?this._resolveStack(e):e)}setStack(e){e!==null&&this._stack!==e&&(this._unbindStack(),this._stack=e,this._bindStack(),this._populate(),this._syncSelection(),this.dispatchEvent(new CustomEvent(`notify::stack`,{bubbles:!0,detail:{stack:e}})))}get mode(){return this.getAttribute(`mode`)===`page`?`page`:`sidebar`}set mode(e){this.setAttribute(`mode`,e)}get filter(){return this._filter}set filter(e){this._filter=e,this._initialized&&(this._sidebar.filter=e,this._applyEmptyState())}get placeholder(){return this._placeholderEl.firstElementChild}set placeholder(e){e===null?this._placeholderEl.replaceChildren():this._placeholderEl.replaceChildren(e),this._applyEmptyState()}get prefixWidget(){return this._prefixEl.firstElementChild}set prefixWidget(e){e===null?this._prefixEl.replaceChildren():this._prefixEl.replaceChildren(e)}get suffixWidget(){return this._suffixEl.firstElementChild}set suffixWidget(e){e===null?this._suffixEl.replaceChildren():this._suffixEl.replaceChildren(e)}connectedCallback(){if(this._initialized){this._bindStack(),this._populate();return}this._initialized=!0,this._prefixEl=document.createElement(`div`),this._prefixEl.className=`view-switcher-sidebar-prefix`,this._suffixEl=document.createElement(`div`),this._suffixEl.className=`view-switcher-sidebar-suffix`,this._placeholderEl=document.createElement(`div`),this._placeholderEl.className=`view-switcher-sidebar-placeholder`,this._placeholderEl.hidden=!0,this._sidebar=document.createElement(`adw-sidebar`),this._sidebar.addEventListener(`activated`,this._onSidebarActivated);let e=document.createElement(`div`);e.className=`view-switcher-sidebar-box`,e.append(this._sidebar,this._placeholderEl),bindSlottedChildren(this,[{name:`placeholder`,into:this._placeholderEl},{name:`prefix`,into:this._prefixEl},{name:`suffix`,into:this._suffixEl}]).install(this._prefixEl,e,this._suffixEl),this._applyMode();let t=this.getAttribute(`stack`);this.setStack(t===null?this._findStack():this._resolveStack(t)),this._applyEmptyState()}disconnectedCallback(){this._unbindStack()}attributeChangedCallback(e,t,n){this._initialized&&(e===`stack`?this.setStack(n===null?this._findStack():this._resolveStack(n)):e===`mode`&&this._applyMode())}_resolveStack(e){return document.getElementById(e)??this._findStack()}_findStack(){return this.parentElement?.querySelector(`adw-view-stack`)??null}_bindStack(){this._unbindStack();for(let e of Sr)this._stack?.addEventListener(e,this._onStackChange)}_unbindStack(){for(let e of Sr)this._stack?.removeEventListener(e,this._onStackChange)}_onStackChange=()=>{this._populate(),this._syncSelection()};_onSidebarActivated=e=>{e.stopPropagation();let t=e.detail.index,n=this._stack;n!==null&&(n.selectNthPage(t),this.dispatchEvent(new CustomEvent(`activated`,{bubbles:!0,detail:{index:t}})))};_populate(){let e=this._stack;if(e===null){this._sidebar.sections=[],this._applyEmptyState();return}let t=viewSwitcherPagesFromStack(e.pages);this._sidebar.sections=viewSwitcherSidebarSections(t).map(e=>this._toSectionSpec(e)),this._applyEmptyState()}_toSectionSpec(e){let t=e.pages.map(e=>({title:e.title??``,iconName:e.iconName??``,visible:e.visible,badgeNumber:e.badgeNumber,needsAttention:e.needsAttention}));return{title:e.title,items:t}}_syncSelection(){let e=this._stack;if(e===null)return;let t=e.visibleChildIndex;t<0||this._sidebar.selected!==t&&(this._sidebar.selected=t)}_applyMode(){let e=this.mode===`page`;this.classList.toggle(`page`,e),this._sidebar.mode=this.mode}_applyEmptyState(){let e=this._sidebar.classList.contains(`empty`);this._placeholderEl.hidden=!e,this.classList.toggle(`empty`,e)}};const Sr=[`items-changed`,`notify::visible-child`];customElements.define(`adw-view-switcher-sidebar`,AdwViewSwitcherSidebar);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.selectNthPage(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=createGtkImage(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?.selectNthPage(e)}),{button:t,icon:n,label:r,indicator:i}}_applyRevealed(){this.hidden=!this._barState.revealed}};customElements.define(`adw-view-switcher-bar`,AdwViewSwitcherBar);const Cr=[`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[...Cr]}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 wr={dark:()=>typeof document<`u`&&isAdwaitaDark(document.documentElement),subscribe(e){if(typeof document>`u`)return()=>{};let t=globalThis.matchMedia?.(`(prefers-color-scheme: dark)`);t?.addEventListener(`change`,e);let n=new MutationObserver(e);return n.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}),()=>{t?.removeEventListener(`change`,e),n.disconnect()}}};wr.force=e=>{if(typeof document>`u`)return;let t=document.documentElement;t.classList.remove(`theme-dark`,`theme-light`),e!==null&&t.classList.add(e?`theme-dark`:`theme-light`)},Object.freeze({ALWAYS:0,AUTOMATIC:1,NEVER:2,EXTERNAL:3}),Object.freeze({NONE:0,LTR:1,RTL:2}),Object.freeze({WIDGET:1,TEXT:2,LEFT:3,RIGHT:4,TOP:5,BOTTOM:6}),Object.freeze({WORD:0,LINE:1});const Tr={main:`About`,credits:`Credits`,license:`License`,system:`System`},Er=[`credits`,`license`,`system`],Dr=[`unknown`,`custom`,`gpl-2-0`,`gpl-3-0`,`lgpl-2-1`,`lgpl-3-0`,`bsd`,`mit-x11`,`artistic`,`gpl-2-0-only`,`gpl-3-0-only`,`lgpl-2-1-only`,`lgpl-3-0-only`,`agpl-3-0`,`agpl-3-0-only`,`bsd-3`,`apache-2-0`,`mpl-2-0`,`0bsd`];var GtkAboutDialog=class extends AdwDialog{_built=!1;_logo=``;_switcherEl;_stackEl;_pages=new Map;_populated=new Set;_authors=[];_documenters=[];_artists=[];_creditSections=[];static get observedAttributes(){return[...AdwDialog.observedAttributes,`program-name`,`version`,`copyright`,`comments`,`license`,`license-type`,`system-information`,`website`,`website-label`,`translator-credits`,`logo-icon-name`,`wrap-license`]}get programName(){return this.getAttribute(`program-name`)??``}set programName(e){this.setAttribute(`program-name`,e)}get version(){return this.getAttribute(`version`)??``}set version(e){this.setAttribute(`version`,e)}get copyright(){return this.getAttribute(`copyright`)??``}set copyright(e){this.setAttribute(`copyright`,e)}get comments(){return this.getAttribute(`comments`)??``}set comments(e){this.setAttribute(`comments`,e)}get license(){return this.getAttribute(`license`)??``}set license(e){this.setAttribute(`license`,e),this.setAttribute(`license-type`,`custom`)}get licenseType(){let e=this.getAttribute(`license-type`);return e!==null&&Dr.includes(e)?e:`unknown`}set licenseType(e){Dr.includes(e)?this.setAttribute(`license-type`,e):this.removeAttribute(`license-type`)}get systemInformation(){return this.getAttribute(`system-information`)??``}set systemInformation(e){this.setAttribute(`system-information`,e)}get website(){return this.getAttribute(`website`)??``}set website(e){this.setAttribute(`website`,e)}get websiteLabel(){return this.getAttribute(`website-label`)??``}set websiteLabel(e){this.setAttribute(`website-label`,e)}get translatorCredits(){return this.getAttribute(`translator-credits`)??``}set translatorCredits(e){this.setAttribute(`translator-credits`,e)}get logoIconName(){return this.getAttribute(`logo-icon-name`)??``}set logoIconName(e){this.setAttribute(`logo-icon-name`,e)}get wrapLicense(){return this.hasAttribute(`wrap-license`)}set wrapLicense(e){this.toggleAttribute(`wrap-license`,e)}get logo(){return this._logo}set logo(e){this._logo=e,this._built&&this._renderLogo()}get authors(){return[...this._authors]}set authors(e){this._authors=[...e],this._creditsChanged()}get documenters(){return[...this._documenters]}set documenters(e){this._documenters=[...e],this._creditsChanged()}get artists(){return[...this._artists]}set artists(e){this._artists=[...e],this._creditsChanged()}addCreditSection(e,t){this._creditSections.push({name:e,people:[...t]}),this._creditsChanged()}_creditsChanged(){this._populated.delete(`credits`),this._built&&this._renderAbout()}connectedCallback(){if(this._built){super.connectedCallback();return}this._switcherEl=document.createElement(`div`),this._switcherEl.className=`adw-gtk-about-dialog-switcher`,this._switcherEl.setAttribute(`role`,`tablist`),this._switcherEl.setAttribute(`aria-label`,`Pages`),super.connectedCallback(),this._stackEl=document.createElement(`div`),this._stackEl.className=`adw-gtk-about-dialog-stack`,this._stackEl.dataset.transitionType=`crossfade`,this.setAttribute(`title`,`About ${this.programName||document.title}`);let e=[...this.contentArea.childNodes];this.contentArea.replaceChildren(this._build());for(let t of e)this.contentArea.appendChild(t);this._renderAbout(),this._built=!0}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),this._built&&t!==n&&((e===`license`||e===`license-type`||e===`website`)&&this._populated.delete(`license`),e===`system-information`&&this._populated.delete(`system`),(e===`website`||e===`website-label`||e===`license`||e===`license-type`)&&(this._renderMain(),this._populateLicense()),e===`wrap-license`&&this._populateLicense(),e===`system-information`&&this._populateSystem(),this._renderAbout())}decorateHeader(e){let t=e.querySelector(`.adw-dialog-title`);t===null?e.prepend(this._switcherEl):t.replaceWith(this._switcherEl),this._renderSwitcher()}get visiblePage(){return this._stackEl.dataset.visible??`main`}showPage(e){this._populatePage(e);for(let[t,n]of this._pages)n.hidden=t!==e;this._stackEl.dataset.visible=e,this._renderSwitcher()}_build(){let e=document.createElement(`div`);e.className=`adw-gtk-about-dialog-box`;let t=document.createElement(`div`);t.className=`adw-gtk-about-dialog-head`;let n=document.createElement(`div`);n.className=`adw-gtk-about-dialog-logo-slot`,t.appendChild(n),this._renderLogo();let r=document.createElement(`div`);r.className=`adw-gtk-about-dialog-name`,r.textContent=this.programName||document.title,t.appendChild(r);for(let e of[`main`,...Er]){let t=document.createElement(`div`);t.className=`adw-gtk-about-dialog-page`,t.dataset.page=e,t.hidden=e!==`main`,this._pages.set(e,t),this._stackEl.appendChild(t)}return this._renderMain(),t.appendChild(this._stackEl),e.appendChild(t),e}_renderAbout(){this.setAttribute(`title`,`About ${this.programName||document.title}`);for(let e of Er){let t=this._pages.get(e);if(t===void 0)continue;let n=this._pageVisible(e);t.hidden!==!n&&(t.hidden=!n,n||this._populated.delete(e))}this._pages.get(this._stackEl.dataset.visible??`main`)?.hidden!==!1&&(this._stackEl.dataset.visible=`main`,this._pages.get(`main`).hidden=!1),this._renderMain(),this._renderSwitcher()}_pageVisible(e){return e===`credits`?this._creditsPeople().length>0:e===`license`?this.licenseType===`custom`&&this.license.length>0:this.systemInformation.length>0}_creditsPeople(){let e=[];this._authors.length>0&&e.push({title:`Created by`,people:this._authors}),this._documenters.length>0&&e.push({title:`Documented by`,people:this._documenters});let t=translatorCreditsPeople(this.translatorCredits);t.length>0&&e.push({title:`Translated by`,people:t}),this._artists.length>0&&e.push({title:`Design by`,people:this._artists});for(let t of this._creditSections)e.push({title:t.name,people:t.people});return e}_visiblePages(){return Er.filter(e=>this._pages.get(e)?.hidden===!1)}_renderSwitcher(){if(this._switcherEl===void 0)return;let e=this._visiblePages();this._switcherEl.hidden=e.length===0,this._switcherEl.replaceChildren(...e.map(e=>{let t=document.createElement(`button`);return t.type=`button`,t.className=`adw-gtk-about-dialog-switcher-item`,t.setAttribute(`role`,`tab`),t.textContent=Tr[e],t.classList.toggle(`checked`,this._stackEl.dataset.visible===e),t.setAttribute(`aria-selected`,String(this._stackEl.dataset.visible===e)),t.addEventListener(`click`,()=>this.showPage(e)),t}))}_renderLogo(){let e=this.contentArea.querySelector(`.adw-gtk-about-dialog-logo-slot`);if(e!==null){if(this.logoIconName.length>0){e.replaceChildren(createGtkImage(this.logoIconName,`adw-gtk-about-dialog-logo`));return}if(this._logo.length>0){let t=document.createElement(`img`);t.className=`adw-gtk-about-dialog-logo`,t.src=this._logo,t.alt=``,e.replaceChildren(t);return}e.replaceChildren()}}_renderMain(){let e=this._pages.get(`main`);if(e===void 0)return;let t=[],label=(e,t)=>{let n=document.createElement(`div`);return n.className=t,n.textContent=e,n};this.version.length>0&&t.push(label(this.version,`adw-gtk-about-dialog-version`)),this.comments.length>0&&t.push(label(this.comments,`adw-gtk-about-dialog-comments`)),this.website.length>0?t.push(this.websiteLabel.length>0?this._link(this.websiteLabel,this.website,`adw-gtk-about-dialog-website`):this._link(`Website`,this.website,`adw-gtk-about-dialog-website`)):this.websiteLabel.length>0&&t.push(label(this.websiteLabel,`adw-gtk-about-dialog-website`)),this.copyright.length>0&&t.push(label(this.copyright,`adw-gtk-about-dialog-copyright`));let n=this._licenseMarkup();n!==null&&t.push(n),e.replaceChildren(...t)}_licenseMarkup(){let e=this.licenseType,t=Dr.indexOf(e),n=t>=0?t:o.UNKNOWN,r=document.createElement(`div`);if(r.className=`adw-gtk-about-dialog-license`,n!==o.CUSTOM&&n!==o.UNKNOWN){let e=s[n],t=e.url??this.website;return r.append(document.createTextNode(`This program comes with absolutely no warranty.
6
- See the `),this._link(e.name??``,t,`adw-gtk-about-dialog-license-link`),document.createTextNode(` for details.`)),r}return n===o.UNKNOWN||this.license.length===0?null:(this._fillWithLinks(r,this.license),r)}_populateLicense(){let e=this._pages.get(`license`);if(e===void 0)return;let t=document.createElement(`div`);t.className=`adw-gtk-about-dialog-text-view`,this.wrapLicense&&t.classList.add(`wrap`);let n=this._licenseMarkup();if(n!==null){let e=document.createElement(`div`);e.className=`adw-gtk-about-dialog-text`,e.replaceChildren(...[...n.childNodes].map(e=>e.cloneNode(!0))),t.appendChild(e)}e.replaceChildren(this._frame(t))}_populateSystem(){let e=this._pages.get(`system`);if(e===void 0)return;let t=document.createElement(`div`);t.className=`adw-gtk-about-dialog-text-view`;let n=document.createElement(`div`);n.className=`adw-gtk-about-dialog-text`,this._fillWithLinks(n,this.systemInformation),t.appendChild(n),e.replaceChildren(this._frame(t))}_populateCredits(){let e=this._pages.get(`credits`);if(e===void 0)return;let t=document.createElement(`div`);t.className=`adw-gtk-about-dialog-credits-grid`,t.setAttribute(`role`,`group`),t.setAttribute(`aria-label`,Tr.credits);for(let e of this._creditsPeople()){let n=document.createElement(`div`);n.className=`adw-gtk-about-dialog-credits-heading`,n.textContent=e.title,t.appendChild(n);for(let n of e.people){let e=parseCreditPerson(n),r=document.createElement(`div`);r.className=`adw-gtk-about-dialog-credits-person`,e.link===null?r.textContent=e.name:r.appendChild(this._link(e.name,e.uri??``,`adw-gtk-about-dialog-credits-link`)),t.appendChild(r)}t.appendChild(document.createElement(`div`))}e.replaceChildren(this._frame(t))}_populatePage(e){this._populated.has(e)||(this._populated.add(e),e===`credits`?this._populateCredits():e===`license`?this._populateLicense():e===`system`&&this._populateSystem())}_frame(e){let t=document.createElement(`div`);t.className=`adw-gtk-about-dialog-scrolled`;let n=document.createElement(`div`);return n.className=`adw-view`,n.appendChild(e),t.appendChild(n),t}_link(e,t,n){let r=document.createElement(`a`);return r.className=n,r.href=t,r.rel=`noopener noreferrer`,r.textContent=e,r.addEventListener(`click`,e=>{e.preventDefault(),this._activateLink(t)}),r}_fillWithLinks(e,t){for(let n of splitLinks(t)){if(n.uri===null){e.appendChild(document.createTextNode(n.text));continue}let t=document.createElement(`a`);t.href=n.uri,t.rel=`noopener noreferrer`,t.textContent=n.text,t.addEventListener(`click`,e=>{e.preventDefault(),this._activateLink(n.uri)}),e.appendChild(t)}}_activateLink(e){let t=new CustomEvent(`activate-link`,{bubbles:!0,cancelable:!0,detail:{uri:e}});this.dispatchEvent(t)&&globalThis.open(e,`_blank`,`noopener,noreferrer`)}};function splitLinks(e){let t=[],n=e;for(;n.length>0;){let e=n.indexOf(`<`),r=e<0?-1:n.indexOf(`>`,e),i=n.indexOf(`http://`),a=n.indexOf(`https://`),o=i;(i<0||a>=0&&a<i)&&(o=a);let s=-1;if(o>=0&&(s=`
7
- >`.split(``).reduce((e,t)=>{if(e>=0)return e;let r=n.indexOf(t,o);return r<0?-1:r},-1),s<0&&(s=n.length)),o>=0&&(e<0||r<0||o<=e+1)&&(e=o,r=s),e<0||r<0){t.push({text:n,uri:null});break}e>0&&t.push({text:n.slice(0,e),uri:null});let c=n[e]===`<`,l=c?n.slice(e+1,r):n.slice(e,r);t.push({text:l,uri:c?`mailto:${l}`:l}),n=n.slice(r+ +!!c)}return t}customElements.define(`gtk-about-dialog`,GtkAboutDialog);var GtkActionBar=class extends HTMLElement{_initialized=!1;_startEl=null;_centerEl=null;_endEl=null;static get observedAttributes(){return[`revealed`]}get revealed(){return this.getAttribute(`revealed`)!==`false`}set revealed(e){this.setAttribute(`revealed`,e?`true`:`false`)}get startSection(){return this._startEl}get centerSection(){return this._centerEl}get endSection(){return this._endEl}connectedCallback(){if(this._initialized)return;this._initialized=!0,this._startEl=document.createElement(`div`),this._startEl.className=`adw-action-bar-start`,this._centerEl=document.createElement(`div`),this._centerEl.className=`adw-action-bar-center`,this._endEl=document.createElement(`div`),this._endEl.className=`adw-action-bar-end`;let e=this._endEl;bindSlottedChildren(this,[{name:`start`,into:this._startEl},{name:`center`,into:this._centerEl},{name:`end`,consume:t=>e.prepend(t)},{into:this._startEl}]).install(this._startEl,this._centerEl,this._endEl),this._renderRevealed()}attributeChangedCallback(){this._initialized&&this._renderRevealed()}_renderRevealed(){this.hidden=!this.revealed}};customElements.define(`gtk-action-bar`,GtkActionBar);const Or={minimize:{className:`minimize`,icon:`window-minimize-symbolic`,label:`Minimize`,action:`minimize`},maximize:{className:`maximize`,icon:`window-maximize-symbolic`,label:`Maximize`,action:`toggle-maximized`},close:{className:`close`,icon:`window-close-symbolic`,label:`Close`,action:`close`}},kr=[`decoration-layout`,`deletable`,`icon-name`,`maximized`,`modal`,`resizable`,`transient-for`];var GtkWindowControls=class extends HTMLElement{_initialized=!1;_empty=!0;_window=null;_windowObserver=null;static get observedAttributes(){return[`decoration-layout`,`side`,`use-native-controls`]}get side(){return this.getAttribute(`side`)===`end`?`end`:`start`}set side(e){this._write(`side`,e)}get useNativeControls(){return this.hasAttribute(`use-native-controls`)}get empty(){return this._empty}_write(e,t){this.getAttribute(e)!==t&&this.setAttribute(e,t)}connectedCallback(){if(this._initialized){this._followWindow();return}this._initialized=!0,this.setAttribute(`role`,`group`),this._followWindow()}disconnectedCallback(){this._windowObserver?.disconnect(),this._windowObserver=null,this._window=null}attributeChangedCallback(e){this._initialized&&(this._render(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}})))}_property(e){return e===`side`?this.side:this.hasAttribute(e)}_followWindow(){this._windowObserver?.disconnect(),this._applyEmptyClass(),this._window=this.closest(`gtk-window, adw-window`),this._window!==null&&(this._windowObserver??=new MutationObserver(()=>this._render()),this._windowObserver.observe(this._window,{attributes:!0,attributeFilter:kr})),this._render()}_isSovereign(e){return!e.hasAttribute(`modal`)&&!e.hasAttribute(`transient-for`)}_windowFlag(e,t){return e.getAttribute(t)!==`false`}_layoutHalf(){let e=this.getAttribute(`decoration-layout`)??this._window?.getAttribute(`decoration-layout`)??`:minimize,maximize,close`;if(e===``)return null;let t=e.indexOf(`:`);return t===-1?e:this.side===`start`?e.slice(0,t):e.slice(t+1)}_render(){this.classList.toggle(`start`,this.side===`start`),this.classList.toggle(`end`,this.side===`end`),this.replaceChildren(),this._applyEmptyClass();let e=this._window;if(e===null){this._setEmpty(!0);return}let t=this._isSovereign(e),n=this._layoutHalf();if(n===null){this._setEmpty(!0);return}let r=!0;for(let i of n.split(`,`)){let n=this._buttonFor(i,e,t);n!==null&&(this.appendChild(n),r=!1)}this._setEmpty(r)}_applyEmptyClass(){this.classList.toggle(`empty`,this._empty)}_buttonFor(e,t,n){if(e===`icon`)return n?this._windowIcon(t):null;if(e===`minimize`)return n?this._controlButton(Or.minimize):null;if(e===`maximize`){if(!n||!this._windowFlag(t,`resizable`))return null;let e=t.hasAttribute(`maximized`);return this._controlButton(e?{...Or.maximize,icon:`window-restore-symbolic`,label:`Restore`}:Or.maximize)}return e===`close`&&this._windowFlag(t,`deletable`)?this._controlButton(Or.close):null}_windowIcon(e){let t=e.getAttribute(`icon-name`);return t===null||t===``?null:createGtkImage(t,`icon`)}_controlButton(e){let t=document.createElement(`button`);return t.className=`adw-window-controls-button ${e.className}`,t.setAttribute(`aria-label`,e.label),t.title=e.label,t.appendChild(createGtkImage(e.icon)),t.addEventListener(`click`,()=>this.dispatchEvent(new CustomEvent(`window-action`,{bubbles:!0,detail:{action:e.action}}))),t}_setEmpty(e){e!==this._empty&&(this._empty=e,this._applyEmptyClass(),this.dispatchEvent(new CustomEvent(`notify::empty`,{bubbles:!0,detail:{empty:e}})))}};customElements.define(`gtk-window-controls`,GtkWindowControls);var GtkWindow=class extends HTMLElement{_initialized=!1;_titlebar;_content;_startControls=null;_endControls=null;_titleLabel=null;_titlebarObserver=null;_members=new WindowMemberState(e=>this._notifyMember(e));_closing=new CloseRequestState;_syncActive=()=>void this._members.reportActive(this._documentIsActive());_onFocusIn=e=>{e.target instanceof Element&&this._members.reportFocus(e.target)};_onFocusOut=e=>{let t=e.relatedTarget;t instanceof Node&&this.contains(t)||t===null&&!document.hasFocus()||this._members.reportFocus(null)};static get observedAttributes(){return[`decorated`,`default-width`,`default-height`,`deletable`,`fullscreened`,`hide-on-close`,`icon-name`,`maximized`,`modal`,`resizable`,`title`,`transient-for`,`hidden`]}get title(){return this.getAttribute(`title`)??``}set title(e){this._write(`title`,e)}get decorated(){return this._onByDefault(`decorated`)}set decorated(e){this._write(`decorated`,String(e))}get maximized(){return this._offByDefault(`maximized`)}set maximized(e){this._write(`maximized`,String(e))}get resizable(){return this._onByDefault(`resizable`)}set resizable(e){this._write(`resizable`,String(e))}get deletable(){return this._onByDefault(`deletable`)}set deletable(e){this._write(`deletable`,String(e))}_write(e,t){t===null?this.removeAttribute(e):this.getAttribute(e)!==t&&this.setAttribute(e,t)}_onByDefault(e){return this.getAttribute(e)!==`false`}_offByDefault(e){return this.hasAttribute(e)}connectedCallback(){if(this._initialized){this._watchActivity(),this._watchTitlebar(),this._render();return}this._initialized=!0,this._watchActivity(),this._titlebar=document.createElement(`div`),this._titlebar.className=`adw-gtk-window-titlebar`,this._content=document.createElement(`div`),this._content.className=`adw-gtk-window-content`,bindSlottedChildren(this,[{name:`titlebar`,into:this._titlebar},...this.extraSlots(),{into:this._content}]).install(...this.strips()),this.addEventListener(`window-action`,e=>this._onWindowAction(e)),this._watchTitlebar(),this._render()}disconnectedCallback(){this._titlebarObserver?.disconnect(),this._titlebarObserver=null,globalThis.removeEventListener(`focus`,this._syncActive),globalThis.removeEventListener(`blur`,this._syncActive),document.removeEventListener(`visibilitychange`,this._syncActive),this.removeEventListener(`focusin`,this._onFocusIn),this.removeEventListener(`focusout`,this._onFocusOut),this._members.reportActive(!1),this._members.reportFocus(null)}_watchActivity(){globalThis.addEventListener(`focus`,this._syncActive),globalThis.addEventListener(`blur`,this._syncActive),document.addEventListener(`visibilitychange`,this._syncActive),this.addEventListener(`focusin`,this._onFocusIn),this.addEventListener(`focusout`,this._onFocusOut),this._syncActive()}_documentIsActive(){return this.isConnected&&!this.hidden&&document.visibilityState!==`hidden`&&document.hasFocus()}_notifyMember(e){let t=e===`is-active`?this._members.active:e===`focus-widget`?this._members.focus:this.maximized;this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:t}}))}_watchTitlebar(){this._titlebarObserver?.disconnect(),this._titlebarObserver=new MutationObserver(()=>this._render()),this._titlebarObserver.observe(this._titlebar,{childList:!0})}strips(){return[this._titlebar,this._content]}extraSlots(){return[]}attributeChangedCallback(e){if(e===`hidden`){this._syncActive();return}this._initialized&&this._render(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}}))}_property(e){if(e===`default-width`||e===`default-height`){let t=Number.parseFloat(this.getAttribute(e)??``);return Number.isFinite(t)?t:null}return e===`title`||e===`icon-name`||e===`transient-for`?this.getAttribute(e):e===`decorated`||e===`resizable`||e===`deletable`?this._onByDefault(e):this._offByDefault(e)}_render(){this._titlebar.hidden=!this.decorated,this.classList.toggle(`maximized`,this.decorated&&this.maximized),this.classList.toggle(`fullscreen`,this.decorated&&this._offByDefault(`fullscreened`));let e=Number.parseFloat(this.getAttribute(`default-width`)??``),t=Number.parseFloat(this.getAttribute(`default-height`)??``);for(let[n,r]of[[`width`,e],[`height`,t]])Number.isFinite(r)&&r>0?this.style.setProperty(n,`${r}px`):this.style.removeProperty(n);let n=this.getAttribute(`title`);n===null?this.removeAttribute(`aria-label`):this.setAttribute(`aria-label`,n),this._renderTitlebar()}_renderTitlebar(){if([...this._titlebar.children].some(e=>e!==this._startControls&&e!==this._endControls&&e!==this._titleLabel)){for(let e of[this._startControls,this._endControls,this._titleLabel])e?.remove();this._startControls=null,this._endControls=null,this._titleLabel=null;return}if(!this.decorated)return;this._startControls===null&&(this._startControls=document.createElement(`gtk-window-controls`),this._startControls.setAttribute(`side`,`start`),this._endControls=document.createElement(`gtk-window-controls`),this._endControls.setAttribute(`side`,`end`),this._titleLabel=document.createElement(`span`),this._titleLabel.className=`adw-gtk-window-title`,this._titlebar.append(this._startControls,this._titleLabel,this._endControls));let e=this.getAttribute(`title`);e===null?this._titleLabel?.removeAttribute(`title`):this._titleLabel?.setAttribute(`title`,e??``)}_onWindowAction(e){let t=e.detail?.action;if(t===`toggle-maximized`){this._write(`maximized`,String(!this._offByDefault(`maximized`)));return}t===`close`&&this.close()}close(){let e=this._closing.close({realized:this.isConnected,hideOnClose:this._offByDefault(`hide-on-close`),emit:()=>{let e=new CustomEvent(`close-request`,{bubbles:!0,cancelable:!0});return this.dispatchEvent(e),e.defaultPrevented},hide:()=>void(this.hidden=!0),destroy:()=>this.remove()});return e===`hidden`||e===`destroyed`}present(){this.hidden=!1}get isActive(){return this._members.active}is_active(){return this._members.active}get focusWidget(){return this.get_focus()}get_focus(){let e=document.activeElement;return e!==null&&e!==this&&this.contains(e)?e:null}set_focus(e){if(e===null){let e=this.get_focus();(e instanceof HTMLElement||e instanceof SVGElement)&&e.blur(),this._members.reportFocus(null);return}if(e===this||!this.contains(e))throw Error(`<gtk-window>.set_focus: the widget is not inside this window`);(e instanceof HTMLElement||e instanceof SVGElement)&&e.focus(),this._members.reportFocus(this.get_focus())}is_maximized(){return this.maximized}maximize(){this._write(`maximized`,`true`)}unmaximize(){this._write(`maximized`,`false`)}};customElements.define(`gtk-window`,GtkWindow);var GtkApplicationWindow=class extends GtkWindow{_menubar=null;_menubarObserver=null;static get observedAttributes(){return[...GtkWindow.observedAttributes,`show-menubar`]}get showMenubar(){return this.getAttribute(`show-menubar`)===`true`}set showMenubar(e){this._write(`show-menubar`,String(e))}menubarSection(){if(this._menubar===null){let e=document.createElement(`div`);e.className=`adw-gtk-application-window-menubar`,this._menubar=e}return this._menubar}strips(){return[this._titlebar,this.menubarSection(),this._content]}extraSlots(){return[{name:`menubar`,into:this.menubarSection()}]}connectedCallback(){super.connectedCallback(),this._followMenubar()}disconnectedCallback(){this._menubarObserver?.disconnect(),this._menubarObserver=null}attributeChangedCallback(e){super.attributeChangedCallback(e),e===`show-menubar`&&this._renderMenubar()}_followMenubar(){this._menubarObserver?.disconnect(),this._menubarObserver=new MutationObserver(()=>this._renderMenubar()),this._menubarObserver.observe(this.menubarSection(),{childList:!0}),this._renderMenubar()}_renderMenubar(){let e=this.menubarSection();e.hidden=!this.showMenubar||e.childElementCount===0}};customElements.define(`gtk-application-window`,GtkApplicationWindow),defineWindowApplication(GtkApplicationWindow.prototype);function normalizeAlign(e){let t=Number.parseFloat(e??``);return Number.isFinite(t)?glibClamp(t,0,1):.5}function normalizeRatio(e){let t=Number.parseFloat(e??``);return Number.isFinite(t)?glibClamp(t,1e-4,1e4):1}var GtkAspectFrame=class extends HTMLElement{static get observedAttributes(){return[`ratio`,`xalign`,`yalign`,`obey-child`]}get ratio(){return normalizeRatio(this.getAttribute(`ratio`))}set ratio(e){this.setAttribute(`ratio`,String(e))}get xalign(){return normalizeAlign(this.getAttribute(`xalign`))}set xalign(e){this.setAttribute(`xalign`,String(e))}get yalign(){return normalizeAlign(this.getAttribute(`yalign`))}set yalign(e){this.setAttribute(`yalign`,String(e))}get obeyChild(){let e=this.getAttribute(`obey-child`);return e===null||e!==`false`&&e!==`0`}set obeyChild(e){e?this.setAttribute(`obey-child`,`true`):this.setAttribute(`obey-child`,`false`)}get child(){return this.firstElementChild??null}set child(e){this.firstElementChild!==null&&this.firstElementChild.remove(),e!==null&&this.append(e),this._sync()}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this}]),this.setAttribute(`role`,`generic`),this._sync()}attributeChangedCallback(e,t,n){if(this._sync(),!this.isConnected)return;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){return e===`ratio`?normalizeRatio(t):e===`xalign`||e===`yalign`?normalizeAlign(t):t!==null&&t!==`false`&&t!==`0`}_sync(){let e=this.child;if(e===null)return;let t=e.style;this.obeyChild?t.removeProperty(`aspect-ratio`):t.aspectRatio=String(this.ratio),t.flex=`1 1 auto`,t.maxWidth=`100%`,t.maxHeight=`100%`,this.style.justifyContent=labelYalignAlignItems(this.xalign),this.style.alignItems=labelYalignAlignItems(this.yalign)}};customElements.define(`gtk-aspect-frame`,GtkAspectFrame);const Ar=[`orientation`,`spacing`,`homogeneous`];var GtkBox=class extends HTMLElement{static get observedAttributes(){return[...Ar]}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this.setAttribute(`orientation`,e)}get spacing(){return normalizeBoxSpacing(this.getAttribute(`spacing`))}set spacing(e){this.setAttribute(`spacing`,String(e))}get homogeneous(){return this.hasAttribute(`homogeneous`)}set homogeneous(e){this.toggleAttribute(`homogeneous`,!!e)}connectedCallback(){this._sync()}attributeChangedCallback(e,t,n){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){return e===`orientation`?normalizeBoxOrientation(t):e===`spacing`?normalizeBoxSpacing(t):t!==null}_sync(){this.style.flexDirection=this.orientation===`vertical`?`column`:`row`,this.style.gap=`${this.spacing}px`}};customElements.define(`gtk-box`,GtkBox);const jr=[`flat`,`suggested`,`destructive`,`circular`,`pill`];var GtkButton=class extends HTMLElement{static signals={clicked:`click`};_button;_label=``;_initialized=!1;_child=null;static get observedAttributes(){return[`icon`,`icon-name`,`label`,`tooltip`,`tooltip-text`,`disabled`,`flat`,`suggested`,`destructive`,`circular`,`pill`,`class`]}get icon_name(){return this.getAttribute(`icon-name`)}set icon_name(e){this.reflect(`icon-name`,e)}get iconName(){return this.icon_name}set iconName(e){this.icon_name=e}get tooltip_text(){return this.getAttribute(`tooltip-text`)}set tooltip_text(e){this.reflect(`tooltip-text`,e)}get tooltipText(){return this.tooltip_text}set tooltipText(e){this.tooltip_text=e}reflect(e,t){t==null?this.removeAttribute(e):this.setAttribute(e,t)}get button(){return this._button}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=Array.from(this.childNodes).filter(e=>e.nodeType===Node.TEXT_NODE).map(e=>e.textContent??``).join(``);this._label=(this.getAttribute(`label`)??e).trim(),this._button=document.createElement(`button`),bindSlottedChildren(this,[{name:`child`,claims:e=>e instanceof Element,consume:e=>{this._child=e,this._render()}}]).install(this._button),this._render()}attributeChangedCallback(){this._initialized&&this._render()}_render(){let e=this._button;e.className=`adw-button`;let t=[...jr.filter(e=>this.hasAttribute(e)),...this.classList];e.classList.add(...buttonStyleClasses(t));let n=this._child,r=n?null:this.getAttribute(`icon`)??this.getAttribute(`icon-name`),i=n?``:(this.getAttribute(`label`)??this._label).trim();r&&!i&&e.classList.add(`icon-only`),i&&!r&&e.classList.add(`text-button`),n?e.replaceChildren(n):e.replaceChildren(),r&&e.appendChild(createGtkImage(r)),i&&e.appendChild(document.createTextNode(i));let a=this.getAttribute(`tooltip`)??this.getAttribute(`tooltip-text`);e.title=a??``,r&&!i?e.setAttribute(`aria-label`,a??r):e.removeAttribute(`aria-label`),e.disabled=this.hasAttribute(`disabled`),this.decorate(e)}decorate(e){}};customElements.define(`gtk-button`,GtkButton);const Mr=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],Nr=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],H=[{step:`previous-month`,icon:`go-previous`,tooltip:`Previous Month`},{step:`next-month`,icon:`go-next`,tooltip:`Next Month`},{step:`previous-year`,icon:`go-up`,tooltip:`Previous Year`},{step:`next-year`,icon:`go-down`,tooltip:`Next Year`}];var GtkCalendar=class extends HTMLElement{_headerEl;_monthEl;_yearEl;_arrowEls={};_gridEl;_dayNameEls=[];_weekNumberEls=[];_cellEls=[];_marked=calendarClearMarks();_date;_focus=-1;_initialized=!1;static get observedAttributes(){return[`date`,`year`,`month`,`day`,`show-heading`,`show-day-names`,`show-week-numbers`,`week-start`]}get date(){return toIsoDate(this._date)}set date(e){this.setAttribute(`date`,e)}get year(){return this._date.year}set year(e){this.setAttribute(`year`,String(e))}get month(){return this._date.month-1}set month(e){this.setAttribute(`month`,String(e))}get day(){return this._date.day}set day(e){this.setAttribute(`day`,String(e))}get showHeading(){return this.getAttribute(`show-heading`)!==`false`}set showHeading(e){this.setAttribute(`show-heading`,String(!!e))}get showDayNames(){return this.getAttribute(`show-day-names`)!==`false`}set showDayNames(e){this.setAttribute(`show-day-names`,String(!!e))}get showWeekNumbers(){return this.hasAttribute(`show-week-numbers`)}set showWeekNumbers(e){this.toggleAttribute(`show-week-numbers`,!!e)}get weekStart(){let e=this.getAttribute(`week-start`);if(e!==null){let t=Number.parseInt(e,10);if(Number.isFinite(t)&&t>=0&&t<=6)return t}return localeWeekStart()}set weekStart(e){this.setAttribute(`week-start`,String(e))}get markedDays(){return this._marked.flatMap((e,t)=>e?[t+1]:[])}constructor(){super(),this._date=today()}connectedCallback(){this._initialized||(this._initialized=!0,this._buildHeader(),this._buildGrid(),this.replaceChildren(this._headerEl,this._gridEl),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),this._adoptAttributes(),this._render())}attributeChangedCallback(e){if(!this._initialized)return;let t=this._adoptAttributes(e);this._render(),(e===`date`||e===`year`||e===`month`||e===`day`)&&this._emitDaySelected(t)}markDay(e){let t=calendarMarkDay(this._marked,e,!0);t!==this._marked&&(this._marked=t,this._paintStates(),this.dispatchEvent(new CustomEvent(`notify::marked-days`,{bubbles:!0,detail:{markedDays:this.markedDays}})))}unmarkDay(e){let t=calendarMarkDay(this._marked,e,!1);t!==this._marked&&(this._marked=t,this._paintStates(),this.dispatchEvent(new CustomEvent(`notify::marked-days`,{bubbles:!0,detail:{markedDays:this.markedDays}})))}dayIsMarked(e){return calendarDayIsMarked(this._marked,e)}clearMarks(){this._marked=calendarClearMarks(),this._paintStates(),this.dispatchEvent(new CustomEvent(`notify::marked-days`,{bubbles:!0,detail:{markedDays:[]}}))}get cells(){return calendarDays(this._date.year,this._date.month,this.weekStart)}get selectedDate(){return{...this._date}}_buildHeader(){this._headerEl=document.createElement(`div`),this._headerEl.className=`adw-calendar-header`;let e={previousMonth:{icon:H[0].icon,tooltip:H[0].tooltip},nextMonth:{icon:H[1].icon,tooltip:H[1].tooltip},previousYear:{icon:H[2].icon,tooltip:H[2].tooltip},nextYear:{icon:H[3].icon,tooltip:H[3].tooltip}},button=(t,n,r)=>{let i=document.createElement(`button`);return i.type=`button`,i.className=`adw-calendar-nav-button flat`,i.title=e[t].tooltip,i.setAttribute(`aria-label`,e[t].tooltip),n&&i.classList.add(`expand`),i.style.justifySelf=r,i.addEventListener(`click`,()=>this._onArrow(t)),i.appendChild(createGtkImage(e[t].icon,`adw-calendar-nav-icon`)),this._arrowEls[t]=i,i};this._monthEl=document.createElement(`span`),this._monthEl.className=`adw-calendar-month`,this._yearEl=document.createElement(`span`),this._yearEl.className=`adw-calendar-year`,this._headerEl.append(button(`previousMonth`,!1,`start`),this._monthEl,button(`nextMonth`,!0,`start`),button(`previousYear`,!1,`center`),this._yearEl,button(`nextYear`,!1,`end`)),this._monthEl.style.flex=`1`,this._yearEl.style.paddingInline=`6px`}_buildGrid(){this._gridEl=document.createElement(`div`),this._gridEl.className=`adw-calendar-grid`;for(let e=0;e<7;e++){let e=document.createElement(`span`);e.className=`adw-calendar-day-name`,this._dayNameEls.push(e),this._gridEl.appendChild(e)}let e=document.createElement(`span`);e.className=`adw-calendar-week-spacer`,e.setAttribute(`aria-hidden`,`true`),this._gridEl.appendChild(e);for(let e=0;e<6;e++){let e=document.createElement(`span`);e.className=`adw-calendar-week-number`,this._weekNumberEls.push(e),this._gridEl.appendChild(e);for(let e=0;e<7;e++){let e=document.createElement(`button`);e.type=`button`,e.className=`adw-calendar-cell day-number`,e.addEventListener(`click`,()=>this._onCellClick(Number(e.dataset.index??`0`))),this._cellEls.push(e),this._gridEl.appendChild(e)}}}_adoptAttributes(e){let t=this.getAttribute(`date`);if(t!==null&&!(e===`year`||e===`month`||e===`day`)){let e=parseIsoDate(t);if(e!==null){let t=calendarSelectDay(this._date,e,!1);return this._date=t.date,t}}let n={year:integer(this.getAttribute(`year`),this._date.year),month:integer(this.getAttribute(`month`),this._date.month-1)+1,day:integer(this.getAttribute(`day`),this._date.day)},r=calendarSelectDay(this._date,n,!1);return this._date=r.date,r}_render(){this._monthEl.textContent=Nr[this._date.month-1],this._yearEl.textContent=String(this._date.year);let e=calendarDays(this._date.year,this._date.month,this.weekStart);e.forEach((e,t)=>{let n=this._cellEls[t];n.dataset.index=String(t),n.textContent=String(e.date.day),n.setAttribute(`aria-label`,`${Nr[e.date.month-1]} ${e.date.day}, ${e.date.year}`),n.classList.toggle(`other-month`,e.month!==`current`)}),this._paintWeekNumbers(e),this._paintStates(),this._paintArrows(),this._paintDayNames(),this._paintVisibility()}_paintWeekNumbers(e){for(let t=0;t<6;t++){let n=e[t*7+6];this._weekNumberEls[t].textContent=String(calendarWeekNumber(n.date))}}_paintStates(){let e=calendarDays(this._date.year,this._date.month,this.weekStart),t=today(),n=t.year===this._date.year&&t.month===this._date.month?t.day:-1;e.forEach((e,t)=>{let r=this._cellEls[t],i=e.month===`current`&&e.date.day===this._date.day,a=e.month===`previous`&&this._date.year===1&&this._date.month===1||e.month===`next`&&this._date.year===9999&&this._date.month===12;r.classList.toggle(`selected`,i),r.classList.toggle(`marked`,e.month===`current`&&calendarDayIsMarked(this._marked,e.date.day)),r.classList.toggle(`today`,e.date.day===n&&e.month===`current`),r.classList.toggle(`focused`,t===this._focus),r.disabled=a,a?r.textContent=``:r.textContent=String(e.date.day)})}_paintArrows(){let e=calendarNavigationButtons(this._date);for(let t of[`previousMonth`,`nextMonth`,`previousYear`,`nextYear`])this._arrowEls[t].disabled=!e[t]}_paintDayNames(){for(let e=0;e<7;e++)this._dayNameEls[e].textContent=Mr[(e+this.weekStart)%7]}_paintVisibility(){this._headerEl.hidden=!this.showHeading;for(let e of this._dayNameEls)e.hidden=!this.showDayNames;for(let e of this._weekNumberEls)e.hidden=!this.showWeekNumbers}_onArrow(e){let t=H.find(t=>arrowNameOf(t.step)===e)?.step;t===void 0||this._arrowEls[e].disabled||this._navigate(t)}_navigate(e){let t=this._date;if(this._date=calendarSelectDay(t,calendarStep(t,e),!1).date,this._focus>=0){let e=this.cells,t=e[this._focus],n=e.findIndex(e=>e.month===t?.month&&e.date.day===t.date.day);this._focus=n>=0?n:-1}this._render(),this.dispatchEvent(new CustomEvent(`notify::date`,{bubbles:!0,detail:{date:this.date}})),this.dispatchEvent(new CustomEvent({"previous-month":`prev-month`,"next-month":`next-month`,"previous-year":`prev-year`,"next-year":`next-year`}[e],{bubbles:!0}))}_emitDaySelected(e){let notify=(e,t)=>this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:t}}));e.dayChanged&&(this.dispatchEvent(new CustomEvent(`day-selected`,{bubbles:!0})),notify(`day`,this._date.day)),e.monthChanged&&notify(`month`,this._date.month-1),e.yearChanged&&notify(`year`,this._date.year),notify(`date`,this.date)}_onCellClick(e){let t=this.cells[e];t!==void 0&&(this._focus=e,t.month===`previous`?this._navigate(`previous-month`):t.month===`next`&&this._navigate(`next-month`),this._selectDate(t.date,!0))}_selectDate(e,t){let n=calendarSelectDay(this._date,e,t);if(!n.dayChanged&&!n.monthChanged&&!n.yearChanged){this._render();return}this._date=n.date;let r=this.cells.findIndex(e=>e.month===`current`&&e.date.day===this._date.day);r>=0&&(this._focus=r),this._render(),this._emitDaySelected(n)}_onKeyDown(e){let t={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,1],ArrowDown:[0,-1]};if(e.ctrlKey){let t={ArrowLeft:`previous-month`,ArrowRight:`next-month`,ArrowUp:`previous-year`,ArrowDown:`next-year`}[e.key];if(t===void 0||(e.preventDefault(),!calendarNavigationButtons(this._date)[arrowNameOf(t)]))return;this._navigate(t);return}if(e.altKey||e.metaKey)return;if(e.key===` `){if(this._focus<0)return;e.preventDefault();let t=this.cells[this._focus];if(t===void 0)return;t.month===`previous`?this._navigate(`previous-month`):t.month===`next`&&this._navigate(`next-month`),this._selectDate(t.date,!0);return}let n=t[e.key];n!==void 0&&(e.preventDefault(),this._moveFocus(n[0],n[1]))}_moveFocus(e,t){if(this.cells.length===0)return;let n=this._focus<0?-1:Math.trunc(this._focus/7),r=this._focus<0?-1:this._focus%7;t===1?(n>0&&n--,n<0&&(n=5),r<0&&(r=6)):t===-1?(n<5&&n++,r<0&&(r=0)):e===-1?(r>0?r--:n>0&&(r=6,n--),r<0&&(r=6),n<0&&(n=5)):(r<6?r++:n<5&&(r=0,n++),r<0&&(r=0),n<0&&(n=0));let i=n*7+r;this._cellEls[i]?.disabled!==!0&&(this._focus=i,this._paintStates(),this._cellEls[i]?.focus())}};function arrowNameOf(e){switch(e){case`previous-month`:return`previousMonth`;case`next-month`:return`nextMonth`;case`previous-year`:return`previousYear`;default:return`nextYear`}}function localeWeekStart(){let e=globalThis.navigator?.language;if(typeof e!=`string`)return calendarWeekStart(0,0);let t=Intl.Locale;if(t===void 0)return calendarWeekStart(0,0);let n=new t(e).getWeekInfo?.();return n===void 0?calendarWeekStart(0,0):calendarWeekStart(n.firstDay%7,n.firstDay===7?0:1)}function today(){let e=new Date;return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}}function toIsoDate(e){return`${String(e.year).padStart(4,`0`)}-${String(e.month).padStart(2,`0`)}-${String(e.day).padStart(2,`0`)}`}function parseIsoDate(e){let t=/^(-?\d{1,6})-(\d{1,2})-(\d{1,2})$/.exec(e.trim());if(t===null)return null;let n=Number(t[1]),r=Number(t[2]),i=Number(t[3]);return r<1||r>12||i<1||i>31||n<1||n>9999?null:{year:n,month:r,day:i}}function integer(e,t){let n=Number.parseInt(e??``,10);return Number.isFinite(n)?n:t}customElements.define(`gtk-calendar`,GtkCalendar);const Pr={top:0,center:.5,bottom:1};var GtkCenterBox=class extends HTMLElement{static get observedAttributes(){return[`baseline-position`,`shrink-center-last`]}get baselinePosition(){let e=this.getAttribute(`baseline-position`);return e!==null&&e in Pr?e:`center`}set baselinePosition(e){this.setAttribute(`baseline-position`,e)}get shrinkCenterLast(){let e=this.getAttribute(`shrink-center-last`);return e===null||e!==`false`&&e!==`0`}set shrinkCenterLast(e){e?this.removeAttribute(`shrink-center-last`):this.setAttribute(`shrink-center-last`,`false`)}get startWidget(){return this.querySelector(`[slot="start-widget"]`)}set startWidget(e){this._assign(`start-widget`,e)}get centerWidget(){return this.querySelector(`[slot="center-widget"]`)}set centerWidget(e){this._assign(`center-widget`,e)}get endWidget(){return this.querySelector(`[slot="end-widget"]`)}set endWidget(e){this._assign(`end-widget`,e)}connectedCallback(){bindSlottedChildren(this,[{name:`start-widget`,into:this},{name:`center-widget`,into:this},{name:`end-widget`,into:this}]),this.setAttribute(`role`,`generic`),this._sync()}attributeChangedCallback(e,t,n){if(this._sync(),!this.isConnected)return;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){return e===`shrink-center-last`?t===null||t!==`false`&&t!==`0`:t!==null&&t in Pr?t:`center`}_assign(e,t){let n=this.querySelector(`[slot="${e}"]`);n!==null&&(n.removeAttribute(`slot`),n.remove()),t!==null&&(t.setAttribute(`slot`,e),this.append(t)),this._sync()}_sync(){let e=this.shrinkCenterLast;for(let t of this.children){let n=t.getAttribute(`slot`),r=n===`center-widget`?!e:n===`start-widget`||n===`end-widget`?e:!1;t.style.flexShrink=String(r?100:1)}this.hasAttribute(`baseline-position`)?this.style.alignItems=labelYalignAlignItems(Pr[this.baselinePosition]):this.style.removeProperty(`align-items`)}};customElements.define(`gtk-center-box`,GtkCenterBox);const Fr=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 active(){return this.checked}set active(e){this.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===`active`&&(this.checked=this.hasAttribute(`active`)),e===`checked`&&(this.dispatchEvent(new CustomEvent(`notify::checked`,{bubbles:!0,detail:{checked:this.checked}})),this.dispatchEvent(new CustomEvent(`toggled`,{bubbles:!0})),this.dispatchEvent(new CustomEvent(`notify::active`,{bubbles:!0,detail:{active: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}},GtkCheckButton=class extends AdwCheckBase{static signals={toggled:`toggled`,"notify::active":`notify::active`};static get observedAttributes(){return[`checked`,`active`,`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}Fr.select(this.name,this.value)}onConnected(){this._input.name=this.name,this.name!==``&&(this._unsubscribe??=Fr.subscribe(e=>{e.name===this.name&&(this.checked=e.selected===this.value)}),this.checked&&Fr.select(this.name,this.value))}onDisconnected(){this._unsubscribe?.(),this._unsubscribe=null}render(){super.render(),this._input.name=this.name}};customElements.define(`gtk-check-button`,GtkCheckButton),customElements.define(`adw-radio`,AdwRadio);const Ir={red:.75,green:.25,blue:.25,alpha:1};var GtkColorDialogButton=class extends HTMLElement{_buttonEl;_swatchEl;_inputEl;_dialog=null;_rgba={...Ir};_pending=!1;_initialized=!1;static get observedAttributes(){return[`rgba`,`dialog`,`disabled`]}get rgba(){return{...this._rgba}}set rgba(e){let t=typeof e==`string`?parseCssColor(e):e;t===null||rgbaEqual(t,this._rgba)||(this._rgba=t,this._renderSwatch(),this.dispatchEvent(new CustomEvent(`notify::rgba`,{bubbles:!0,detail:{rgba:this.rgba}})))}get dialog(){return this._dialog}set dialog(e){this._dialog!==e&&(this._dialog=e,e?.title!=null&&(this._inputEl.title=e.title),this._renderSensitivity(),this.dispatchEvent(new CustomEvent(`notify::dialog`,{bubbles:!0,detail:{dialog:e}})))}connectedCallback(){if(this._initialized)return;this._initialized=!0,this.setAttribute(`role`,`group`),this._swatchEl=document.createElement(`span`),this._swatchEl.className=`color-button-swatch`,this._buttonEl=document.createElement(`button`),this._buttonEl.type=`button`,this._buttonEl.className=`adw-button color icon-only`,this._buttonEl.setAttribute(`aria-haspopup`,`dialog`),this._buttonEl.appendChild(this._swatchEl),this._inputEl=document.createElement(`input`),this._inputEl.type=`color`,this._inputEl.className=`color-button-input`,this._inputEl.tabIndex=-1,this._inputEl.setAttribute(`aria-hidden`,`true`),this.replaceChildren(this._buttonEl,this._inputEl),this._buttonEl.addEventListener(`click`,()=>this.activate()),this._inputEl.addEventListener(`change`,()=>{this._pending=!1;let e=parseCssColor(this._inputEl.value);e!==null&&(this.rgba={...e,alpha:this._rgba.alpha}),this._renderSensitivity()}),this.hasAttribute(`dialog`)&&(this.dialog={});let e=this.getAttribute(`rgba`);e!==null&&(this.rgba=e),this._renderSwatch(),this._renderSensitivity()}attributeChangedCallback(e){if(this._initialized){if(e===`rgba`){let e=this.getAttribute(`rgba`);e!==null&&(this.rgba=e);return}if(e===`dialog`){this.dialog=this.hasAttribute(`dialog`)?this._dialog??{}:null;return}this._renderSensitivity()}}activate(){this.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0})),this._choose()}_choose(){this._dialog===null||this._pending||(this._pending=!0,this._renderSensitivity(),this._inputEl.value=formatHex(this._rgba),this._inputEl.click())}_renderSensitivity(){let e=this._dialog!==null&&!this.hasAttribute(`disabled`);this._buttonEl.disabled=!e,this._buttonEl.classList.toggle(`disabled`,!e)}_renderSwatch(){this._swatchEl.style.backgroundColor=formatCssColor(this._rgba),this._swatchEl.dataset.translucent=String(this._rgba.alpha<1);let e=describeColor(this._rgba);this._swatchEl.setAttribute(`aria-label`,e),this._buttonEl.setAttribute(`aria-label`,e)}};customElements.define(`gtk-color-dialog-button`,GtkColorDialogButton);function rgbaEqual(e,t){return e.red===t.red&&e.green===t.green&&e.blue===t.blue&&e.alpha===t.alpha}function scaleRound(e,t){return Math.min(t,Math.max(0,Math.floor(e*t+.5)))}function describeColor(e){let t=[`Red ${scaleRound(e.red,100)}%`,`Green ${scaleRound(e.green,100)}%`,`Blue ${scaleRound(e.blue,100)}%`];return e.alpha<1&&t.push(`Alpha ${scaleRound(e.alpha,100)}%`),t.join(`, `)}function formatHex(e){let channel=e=>Math.round(Math.min(1,Math.max(0,e))*255).toString(16).padStart(2,`0`);return`#${channel(e.red)}${channel(e.green)}${channel(e.blue)}`}function formatCssColor(e){let t=formatHex(e);return e.alpha<1?`${t}${Math.round(e.alpha*255).toString(16).padStart(2,`0`)}`:t}const Lr=/^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:\s*[,/]\s*([\d.]+%?))?\s*\)$/i;function parseCssColor(e){let t=document.createElement(`span`);t.style.color=``,t.style.color=e.trim();let n=t.style.color;if(n===``)return null;let r=Lr.exec(n);if(r===null)return null;let i=r[4];return{red:Number(r[1])/255,green:Number(r[2])/255,blue:Number(r[3])/255,alpha:i===void 0?1:i.endsWith(`%`)?Number.parseFloat(i)/100:Number(i)}}const Rr=`adw-list-item-label`,defaultListItemFactory=e=>{let t=document.createElement(`span`);return t.className=Rr,t.textContent=e.item.label,t};function attachRubberBand(e){let t=null,n=null,r=null,stop=()=>{t?.remove(),t=null,n=null,r!==null&&e.host.hasPointerCapture(r)&&e.host.releasePointerCapture(r),r=null};e.host.addEventListener(`pointerdown`,i=>{if(i.button!==0||!e.enabled())return;let a=i.target;a!==null&&e.rows().some(e=>e===a||e.contains(a))||(n={x:i.clientX,y:i.clientY},r=i.pointerId,e.host.setPointerCapture(i.pointerId),t=document.createElement(`div`),t.className=`adw-rubberband`,t.setAttribute(`aria-hidden`,`true`),e.surface.appendChild(t))}),e.host.addEventListener(`pointermove`,r=>{if(n===null||t===null)return;let i=e.surface.getBoundingClientRect(),a=Math.min(n.x,r.clientX),o=Math.min(n.y,r.clientY),s=Math.abs(r.clientX-n.x),c=Math.abs(r.clientY-n.y);t.style.left=`${a-i.left}px`,t.style.top=`${o-i.top}px`,t.style.width=`${s}px`,t.style.height=`${c}px`;let l=[];e.rows().forEach((e,t)=>{let n=e.getBoundingClientRect();n.right>=a&&n.left<=a+s&&n.bottom>=o&&n.top<=o+c&&l.push(t)}),e.selectPositions(l)});for(let t of[`pointerup`,`pointercancel`,`lostpointercapture`])e.host.addEventListener(t,stop)}const zr=new Set([`all`,`item`,`cell`]);function normalizeListTabBehavior$1(e){return e!=null&&zr.has(e)?e:`all`}__name(normalizeListTabBehavior$1,`normalizeListTabBehavior`);var GtkListView=class extends HTMLElement{_listEl;_rows=[];_state=new ListViewState;_factory=defaultListItemFactory;_initialized=!1;static get observedAttributes(){return[`model`,`selection-mode`,`show-separators`,`single-click-activate`,`enable-rubberband`,`tab-behavior`,`orientation`]}get model(){return this._state.model}set model(e){this._state.setModel(normalizeComboOptions(e))}get factory(){return this._factory}set factory(e){this._factory=typeof e==`function`?e:defaultListItemFactory,this._renderRows()}get selected(){return this._state.selection}set selected(e){let t=typeof e==`number`?[e]:e??[];this._state.setSelection(t)}get selectionMode(){return normalizeListSelectionMode(this.getAttribute(`selection-mode`))}set selectionMode(e){this.setAttribute(`selection-mode`,e)}get showSeparators(){return this.hasAttribute(`show-separators`)}set showSeparators(e){this.toggleAttribute(`show-separators`,!!e)}get singleClickActivate(){return this.hasAttribute(`single-click-activate`)}set singleClickActivate(e){this.toggleAttribute(`single-click-activate`,!!e)}get enableRubberband(){return this.hasAttribute(`enable-rubberband`)}set enableRubberband(e){this.toggleAttribute(`enable-rubberband`,!!e)}get tabBehavior(){return normalizeListTabBehavior$1(this.getAttribute(`tab-behavior`))}set tabBehavior(e){this.setAttribute(`tab-behavior`,e)}get orientation(){return this.getAttribute(`orientation`)===`horizontal`?`horizontal`:`vertical`}set orientation(e){this.setAttribute(`orientation`,e)}connectedCallback(){this._initialized||(this._initialized=!0,this.classList.add(this._viewClass,`view`),this._listEl=document.createElement(`div`),this._listEl.className=`adw-list-view-rows`,this.appendChild(this._listEl),bindSlottedChildren(this,[stringListSlot(e=>this._state.setModel(e))]).install(this._listEl),this._state.count===0&&this._state.setModel(parseListModel(this.getAttribute(`model`))),this._state.setSelectionMode(this.selectionMode),this._state.subscribeItems(e=>this._applyItemsChanged(e)),this._state.subscribeSelection(()=>this._onSelectionChanged()),attachRovingFocus({host:this,orientation:()=>this.orientation,items:()=>this._rows,select:e=>this._selectRow(e,{})}),attachRubberBand({host:this,surface:this._listEl,enabled:()=>this.enableRubberband&&this._state.selectionMode===`multiple`,rows:()=>this._rows,selectPositions:e=>this._state.setSelection(e,!0)}),this._applyAttributes(),this._renderRows())}attributeChangedCallback(e){if(this._initialized){if(e===`model`){this._state.setModel(parseListModel(this.getAttribute(`model`)));return}e===`selection-mode`&&this._state.setSelectionMode(this.selectionMode),this._applyAttributes(),(e===`selection-mode`||e===`tab-behavior`)&&this._renderRows()}}_applyAttributes(){let e=this.orientation;this.classList.toggle(`separators`,this.showSeparators),this.classList.toggle(`horizontal`,e===`horizontal`);let t=this._state.selectionMode!==`none`;this.setAttribute(`role`,t?`listbox`:`list`),this._state.selectionMode===`multiple`?this.setAttribute(`aria-multiselectable`,`true`):this.removeAttribute(`aria-multiselectable`)}get _viewClass(){return`adw-list-view`}get _rowClass(){return`adw-list-view-row`}_renderRows(){if(this._initialized){this._listEl.replaceChildren(),this._rows=[];for(let e=0;e<this._state.count;e++){let t=this._createRow(e);t!==null&&(this._listEl.appendChild(t),this._rows.push(t))}this._syncSelectedStates()}}_createRow(e){let t=this._state.itemContext(e);if(t===null)return null;let n=document.createElement(`div`);return n.className=`${this._rowClass} activatable`,n.setAttribute(`role`,this._state.selectionMode===`none`?`listitem`:`option`),n.tabIndex=this.tabBehavior===`all`?0:-1,n.appendChild(this._factory(t)),n.addEventListener(`click`,e=>{this._selectRow(n,{modify:e.ctrlKey||e.metaKey,extend:e.shiftKey}),this.singleClickActivate&&this._activateRow(n)}),n.addEventListener(`dblclick`,()=>{this.singleClickActivate||this._activateRow(n)}),n.addEventListener(`pointerenter`,()=>{this.singleClickActivate&&this._selectRow(n,{})}),n.addEventListener(`keydown`,e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),e.key===` `?this._selectRow(n,{modify:e.ctrlKey,extend:e.shiftKey}):this._activateRow(n))}),n}_selectRow(e,t){let n=this._rows.indexOf(e);n<0||this._state.selectItem(n,t)}_activateRow(e){let t=this._rows.indexOf(e);t<0||this.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0,detail:{position:t}}))}_onSelectionChanged(){this._syncSelectedStates(),this.dispatchEvent(new CustomEvent(`notify::selected`,{bubbles:!0,detail:{selected:this._state.selection}}))}_syncSelectedStates(){let e=new Set(this._state.selection),t=this.tabBehavior!==`all`,n=e.size>0?Math.min(...e):0;this._rows.forEach((r,i)=>{let a=e.has(i);r.classList.toggle(`selected`,a),this._state.selectionMode===`none`?r.removeAttribute(`aria-selected`):r.setAttribute(`aria-selected`,String(a)),t&&(r.tabIndex=i===n?0:-1)})}_applyItemsChanged(e){if(!this._initialized)return;for(let t of this._rows.splice(e.position,e.removed))t.remove();let t=this._rows[e.position]??null,n=[];for(let r=0;r<e.added;r++){let i=this._createRow(e.position+r);i!==null&&(this._listEl.insertBefore(i,t),n.push(i))}this._rows.splice(e.position,0,...n),this._syncSelectedStates()}};customElements.define(`gtk-list-view`,GtkListView);var GtkColumnView=class extends GtkListView{_headerEl;_columns=[];_factories={};_sorter=null;_dragged=null;static get observedAttributes(){return[`model`,`columns`,`selection-mode`,`single-click-activate`,`enable-rubberband`,`tab-behavior`,`show-row-separators`,`show-column-separators`,`reorderable`]}get columns(){return this._columns.map(e=>({...e}))}set columns(e){this._columns=normalizeColumnViewColumns(e),this._renderHeader(),this._renderRows()}get columnFactories(){return this._factories}set columnFactories(e){this._factories=e??{},this._renderRows()}get sorter(){return this._sorter===null?null:{...this._sorter}}set sorter(e){this._applySorter(e)}get showRowSeparators(){return this.hasAttribute(`show-row-separators`)}set showRowSeparators(e){this.toggleAttribute(`show-row-separators`,!!e)}get showColumnSeparators(){return this.hasAttribute(`show-column-separators`)}set showColumnSeparators(e){this.toggleAttribute(`show-column-separators`,!!e)}get reorderable(){return this.hasAttribute(`reorderable`)}set reorderable(e){this.toggleAttribute(`reorderable`,!!e)}connectedCallback(){let e=this._headerEl===void 0;e&&(this._columns=parseColumnViewColumns(this.getAttribute(`columns`)),this._headerEl=document.createElement(`div`),this._headerEl.className=`adw-column-view-header`,this._headerEl.setAttribute(`role`,`row`)),super.connectedCallback(),e&&this.insertBefore(this._headerEl,this.firstChild),this._renderHeader(),this._renderRows()}attributeChangedCallback(e){if(e===`columns`){this._columns=parseColumnViewColumns(this.getAttribute(`columns`)),this._renderHeader(),this._renderRows();return}super.attributeChangedCallback(e)}_applyAttributes(){super._applyAttributes(),this.classList.toggle(`separators`,this.showRowSeparators),this.classList.toggle(`column-separators`,this.showColumnSeparators),this.setAttribute(`role`,`grid`),this.removeAttribute(`aria-multiselectable`),this.classList.remove(`horizontal`),this._headerEl!==void 0&&this._applyTracks(this._headerEl)}get _viewClass(){return`adw-column-view`}get _rowClass(){return`adw-column-view-row`}_createRow(e){let t=super._createRow(e);if(t===null)return null;t.setAttribute(`role`,`row`),t.replaceChildren();let n=this._state.itemContext(e);if(n!==null)for(let e of this._columns)e.visible!==!1&&t.appendChild(this._createCell(e,n));return this._applyTracks(t),t}_createCell(e,t){let n=document.createElement(`div`);n.className=`adw-column-view-cell`,n.setAttribute(`role`,`gridcell`);let r=this._factories[e.id??e.key];if(r!==void 0)n.appendChild(r(t));else{let r=document.createElement(`span`);r.className=Rr,r.textContent=listItemField(t.item,e.key),n.appendChild(r)}return n}_renderHeader(){if(this._headerEl!==void 0){this._headerEl.replaceChildren();for(let e of this._columns)e.visible!==!1&&this._headerEl.appendChild(this._createHeaderCell(e));this._applyTracks(this._headerEl)}}_createHeaderCell(e){let t=e.id??e.key,n=document.createElement(`button`);n.type=`button`,n.className=`adw-column-view-header-cell`,n.setAttribute(`role`,`columnheader`),n.dataset.columnId=t;let r=document.createElement(`span`);if(r.className=`adw-column-view-header-title`,r.textContent=e.title??e.key,n.appendChild(r),e.sortable===!0){let r=this._sorter!==null&&this._sorter.column===t,i=createGtkImage(`go-down`,`adw-column-view-sort-indicator`);i.classList.toggle(`ascending`,r&&!this._sorter.descending),i.classList.toggle(`descending`,r&&this._sorter.descending),i.hidden=!r,n.appendChild(i),n.setAttribute(`aria-sort`,r?this._sorter.descending?`descending`:`ascending`:`none`),n.addEventListener(`click`,()=>this._applySorter(columnViewSort(this._sorter,e)))}else n.disabled=!0;return this.reorderable&&this._makeDraggable(n,t),n}_makeDraggable(e,t){e.draggable=!0,e.addEventListener(`dragstart`,e=>{this._dragged=t,e.dataTransfer?.setData(`text/plain`,t)}),e.addEventListener(`dragover`,e=>e.preventDefault()),e.addEventListener(`drop`,e=>{e.preventDefault();let n=this._columns.findIndex(e=>(e.id??e.key)===this._dragged),r=this._columns.findIndex(e=>(e.id??e.key)===t);if(this._dragged=null,n<0||r<0||n===r)return;let i=this._columns.splice(n,1);this._columns.splice(r,0,...i),this._renderHeader(),this._renderRows()})}_applySorter(e){let t=e===null&&this._sorter===null||e!==null&&this._sorter!==null&&e.column===this._sorter.column&&e.descending===this._sorter.descending;this._sorter=e===null?null:{...e},!t&&(this._renderHeader(),this.dispatchEvent(new CustomEvent(`notify::sorter`,{bubbles:!0,detail:{sorter:this.sorter}})))}_applyTracks(e){e.style.gridTemplateColumns=dataGridTrackTemplate(columnViewTracks(this._columns))}};customElements.define(`gtk-column-view`,GtkColumnView);var GtkDropDown=class extends HTMLElement{static signals={"notify::selected":`notify::selected`,"notify::selected-item":`notify::selected-item`};_buttonEl;_labelEl;_popoverEl;_listEl;_searchEl=null;_itemButtons=[];_state=new ComboState;_initialized=!1;_typeAheadBuffer=``;_typeAheadTimer=null;static get observedAttributes(){return[`model`,`selected`,`enable-search`,`disabled`]}get model(){return this._state.model}set model(e){this._state.setModel(normalizeComboOptions(e))}get selected(){return this._state.selectedIndex}set selected(e){this._selectIndex(e)}get_selected(){return this.selected}set_selected(e){this.selected=e}get selectedValue(){return this._state.selectedValue}set selectedValue(e){let t=this._state.model.findIndex(t=>t.value===e);t>=0&&this._selectIndex(t)}get selectedItem(){return this._state.model[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,createGtkImage(`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(`gtk-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),bindSlottedChildren(this,[stringListSlot(e=>this._state.setModel(e))]).install(this._buttonEl,this._popoverEl),this._state.count===0&&this._state.setModel(parseListModel(this.getAttribute(`model`)));let e=Number.parseInt(this.getAttribute(`selected`)??``,10);this._state.hasIndex(e)&&this._state.setSelectedIndex(e),this._state.subscribeItems(e=>this._applyItemsChanged(e)),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===`model`)this._state.setModel(parseListModel(n));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())}_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.model[e];this.dispatchEvent(new CustomEvent(`notify::selected`,{bubbles:!0,detail:{selected:e}})),this.dispatchEvent(new CustomEvent(`notify::selected-item`,{bubbles:!0,detail:{"selected-item":n??null}})),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.model.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(),n=this._state.model;this._itemButtons.forEach((e,r)=>{e.hidden=!(t.length===0||(n[r]?.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 of this._state.model){let t=this._createItem(e);this._listEl.appendChild(t),this._itemButtons.push(t)}this._updateSelectedStates(),this._state.count===0&&this._popoverEl.popdown()}_createItem(e){let t=document.createElement(`button`);t.type=`button`,t.className=`adw-popover-item adw-drop-down-item`,t.setAttribute(`role`,`option`),t.tabIndex=-1;let n=document.createElement(`span`);n.className=`adw-drop-down-item-label`,n.textContent=e.label;let r=document.createElement(`span`);return r.className=`adw-drop-down-item-check`,r.setAttribute(`aria-hidden`,`true`),t.append(n,r),t.addEventListener(`click`,()=>{let e=this._itemButtons.indexOf(t);e<0||(this._selectIndex(e,{fromUser:!0}),this._popoverEl.popdown(),this._buttonEl.focus())}),t}_applyItemsChanged(e){if(!this._initialized)return;for(let t of this._itemButtons.splice(e.position,e.removed))t.remove();let t=this._itemButtons[e.position]??null,n=[],r=this._state.model;for(let i=0;i<e.added;i++){let a=r[e.position+i];if(!a)continue;let o=this._createItem(a);this._listEl.insertBefore(o,t),n.push(o)}this._itemButtons.splice(e.position,0,...n),this._updateSelectedStates(),this._updateLabel(),this._state.count===0&&this._popoverEl.popdown()}};customElements.define(`gtk-drop-down`,GtkDropDown);const Br=2147483647;function intAttribute(e,t){let n=Number.parseInt(e.getAttribute(t)??``,10);return Number.isFinite(n)?n:0}var GtkDrawingArea=class extends HTMLElement{_canvas;_context=null;_initialized=!1;_drawFunc=null;_width=-1;_height=-1;_scale=1;_resize=null;_frame=null;static get observedAttributes(){return[`content-width`,`content-height`]}get contentWidth(){return intAttribute(this,`content-width`)}set contentWidth(e){this._write(`content-width`,String(glibClamp(Math.trunc(e)||0,0,Br)))}get contentHeight(){return intAttribute(this,`content-height`)}set contentHeight(e){this._write(`content-height`,String(glibClamp(Math.trunc(e)||0,0,Br)))}_write(e,t){this.getAttribute(e)!==t&&this.setAttribute(e,t)}get drawFunc(){return this._drawFunc}set drawFunc(e){this.setDrawFunc(e)}setDrawFunc(e){this._drawFunc=e,this.queueDraw()}queueDraw(){!this._initialized||this._frame!==null||(this._frame=requestAnimationFrame(()=>{this._frame=null,this._draw()}))}connectedCallback(){if(this._initialized){this._observe();return}this._initialized=!0,this._canvas=document.createElement(`canvas`),this._canvas.className=`adw-drawing-area-canvas`,this._context=this._canvas.getContext(`2d`),this.replaceChildren(this._canvas),this._publishSize(),this._observe()}disconnectedCallback(){this._resize?.disconnect(),this._resize=null,this._frame!==null&&cancelAnimationFrame(this._frame),this._frame=null}attributeChangedCallback(e){this._initialized&&((e===`content-width`||e===`content-height`)&&this._publishSize(),this._notify(e),(e===`content-width`||e===`content-height`)&&this.queueDraw())}_publishSize(){let e=[[`--adw-drawing-width`,this.contentWidth],[`--adw-drawing-height`,this.contentHeight]];for(let[t,n]of e)n>0?this.style.setProperty(t,`${n}px`):this.style.removeProperty(t)}_observe(){this._resize||(this._resize=new ResizeObserver(e=>{for(let t of e){let e=t.borderBoxSize?.[0];this._allocated(e?e.inlineSize:t.contentRect.width,e?e.blockSize:t.contentRect.height)}}),this._resize.observe(this))}_allocated(e,t){let n=e!==this._width||t!==this._height;this._width=e,this._height=t,n&&this.dispatchEvent(new CustomEvent(`resize`,{bubbles:!0,detail:{width:e,height:t}})),this._draw()}_draw(){if(!this._canvas||this._width<0)return;let e=this._width,t=this._height,n=this._devicePixelRatio(),r=Math.round(e*n),i=Math.round(t*n);this._canvas.width!==r&&(this._canvas.width=r),this._canvas.height!==i&&(this._canvas.height=i),this._scale=n;let a=this._context;a&&(a.setTransform(n,0,0,n,0,0),a.clearRect(0,0,e,t),this._drawFunc&&this._drawFunc(this,a,e,t))}_devicePixelRatio(){return typeof globalThis>`u`?1:globalThis.devicePixelRatio||1}_notify(e){let t=e===`content-width`?this.contentWidth:this.contentHeight;this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:t}}))}get allocation(){return{width:this._width,height:this._height}}get pixelScale(){return this._scale}};customElements.define(`gtk-drawing-area`,GtkDrawingArea);const Vr=new WeakMap;var Hr=class GtkDragIcon extends HTMLElement{_pointerX=0;_pointerY=0;_dragging=!1;_onDragOver=null;_onDragEnd=null;_transfer=null;static get observedAttributes(){return[]}static getForDrag(e){let t=e.dataTransfer,n=t===null?void 0:Vr.get(t);if(n!==void 0)return n;let r=document.querySelector(`gtk-drag-icon`),i=r instanceof GtkDragIcon&&!r.dragging?r:null,a=i??document.createElement(`gtk-drag-icon`);return i===null&&document.body.appendChild(a),t!==null&&Vr.set(t,a),a.beginDrag(e),a}static createWidgetForValue(e){if(typeof e==`string`){let t=document.createElement(`gtk-label`);return t.setAttribute(`label`,e),t}if(e===null)return null;let t=document.createElement(`div`);t.className=`adw-drag-icon-swatch`;let n=e.alpha??1;return t.style.backgroundColor=`rgba(${Math.round(e.red*255)}, ${Math.round(e.green*255)}, ${Math.round(e.blue*255)}, ${n})`,t}get child(){return this.firstElementChild}set child(e){this.child!==e&&(this.replaceChildren(),e!==null&&this.appendChild(e),this.dispatchEvent(new CustomEvent(`notify::child`,{bubbles:!0,detail:{child:e}})))}setChild(e){this.child=e,e!==null&&this._render()}connectedCallback(){this.style.pointerEvents=`none`,this._dragging&&this._observe()}disconnectedCallback(){this._unobserve()}beginDrag(e){let t=e.dataTransfer;if(t!==null)try{let e=document.createElement(`canvas`);e.width=1,e.height=1,t.setDragImage(e,0,0)}catch{}this._pointerX=e.clientX,this._pointerY=e.clientY,this._transfer=t,this._dragging=!0,this._observe(),this._render()}endDrag(){this._dragging=!1,this._transfer=null,this._unobserve(),this.hidden=!0}get dragging(){return this._dragging}_observe(){this._onDragOver===null&&(this._onDragOver=e=>{this._pointerX=e.clientX,this._pointerY=e.clientY,this._render()},this._onDragEnd=e=>{(e.dataTransfer===null||e.dataTransfer===this._transfer)&&this.endDrag()},document.addEventListener(`dragover`,this._onDragOver),document.addEventListener(`dragend`,this._onDragEnd))}_unobserve(){this._onDragOver!==null&&document.removeEventListener(`dragover`,this._onDragOver),this._onDragEnd!==null&&document.removeEventListener(`dragend`,this._onDragEnd),this._onDragOver=null,this._onDragEnd=null}_render(){this.hidden=!this._dragging,this._dragging&&(this.style.left=`0px`,this.style.top=`0px`,this.style.transform=`translate3d(${Math.round(this._pointerX)}px, ${Math.round(this._pointerY)}px, 0)`)}};customElements.define(`gtk-drag-icon`,Hr);var GtkEditableLabel=class extends HTMLElement{_label;_entry;_initialized=!1;_grace=null;static get observedAttributes(){return[`text`,`editable`,`editing`]}get text(){return this.getAttribute(`text`)??``}set text(e){this.setAttribute(`text`,e??``)}get editable(){let e=this.getAttribute(`editable`);return e===null?!0:e!==`false`}set editable(e){e?this.removeAttribute(`editable`):this.setAttribute(`editable`,`false`)}get editing(){return this.hasAttribute(`editing`)}set editing(e){this.toggleAttribute(`editing`,!!e)}startEditing(){this.editable&&(this.editing=!0)}stopEditing(e=!1){this.editing&&=(e&&this.setAttribute(`text`,this._entry.value),!1)}get entry(){return this._entry}connectedCallback(){this._initialized||(this._initialized=!0,this._label=document.createElement(`span`),this._label.className=`adw-editable-label-label`,this._label.addEventListener(`click`,()=>this.startEditing()),this._entry=document.createElement(`input`),this._entry.className=`adw-editable-label-entry`,this._entry.type=`text`,this._entry.tabIndex=-1,this._entry.addEventListener(`keydown`,e=>{e.key===`Enter`?(e.preventDefault(),e.stopPropagation(),this.stopEditing(!0)):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),this.stopEditing(!1))}),this.replaceChildren(this._label,this._entry),this.addEventListener(`keydown`,e=>{this.editing||e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),this.startEditing())}),this.addEventListener(`focusout`,e=>{let t=e.relatedTarget;t instanceof Node&&this.contains(t)||(this._grace!==null&&clearTimeout(this._grace),this._grace=setTimeout(()=>{this._grace=null,this.editing&&this.stopEditing(!0)},100))}),this._render())}disconnectedCallback(){this._grace!==null&&clearTimeout(this._grace),this._grace=null}attributeChangedCallback(e,t,n){if(this._initialized)switch(e){case`text`:this.editing||this._render();break;case`editable`:n===`false`&&this.stopEditing(!1);break;case`editing`:this._render(),this.editing?this._entry.focus():this.focus(),this.dispatchEvent(new CustomEvent(`notify::editing`,{bubbles:!0,detail:{editing:this.editing}}));break}}_render(){let e=this.editing;this.classList.toggle(`editing`,e),this._label.hidden=e,this._entry.hidden=!e,this._label.textContent=this.text,this._entry.value=this.text,e?this.removeAttribute(`tabindex`):this.setAttribute(`tabindex`,`0`)}};customElements.define(`gtk-editable-label`,GtkEditableLabel);function row(e,t,n=``){return{text:e,name:t,keywords:n===``?[]:n.split(` `)}}const Ur=[`🏻`,`🏼`,`🏽`,`🏾`,`🏿`];function hasVariations(e){return[...e.text].some(e=>Ur.includes(e))}const Wr=[row(`😀`,`grinning face`,`smile happy joy grin`),row(`😃`,`grinning face with big eyes`,`smile happy joy`),row(`😄`,`grinning face with smiling eyes`,`smile happy joy`),row(`😁`,`beaming face with smiling eyes`,`smile happy`),row(`😂`,`face with tears of joy`,`laugh joy cry`),row(`🤣`,`rolling on the floor laughing`,`laugh rofl joy`),row(`🙂`,`slightly smiling face`,`smile`),row(`😉`,`winking face`,`wink joke flirt`),row(`😊`,`smiling face with smiling eyes`,`blush happy`),row(`😇`,`smiling face with halo`,`angel innocent`),row(`🥰`,`smiling face with hearts`,`love affection`),row(`😍`,`smiling face with heart-eyes`,`love crush`),row(`😘`,`face blowing a kiss`,`kiss love`),row(`😗`,`kissing face`,`kiss love`),row(`☺️`,`smiling face`,`smile happy`),row(`😋`,`face savoring food`,`yum delicious tasty`),row(`😛`,`face with tongue`,`tongue silly`),row(`🤪`,`zany face`,`crazy goofy wild`),row(`😟`,`worried face`,`worried sad`),row(`🙁`,`slightly frowning face`,`sad frown`),row(`☹️`,`frowning face`,`sad frown`),row(`😮`,`face with open mouth`,`surprised wow`),row(`😲`,`astonished face`,`surprised wow`),row(`😳`,`flushed face`,`blush embarrassed`),row(`🥺`,`pleading face`,`please puppy`),row(`😦`,`frowning face with open mouth`,`frown disappointed`),row(`😨`,`fearful face`,`fear scared`),row(`😰`,`anxious face with sweat`,`nervous anxious`),row(`😢`,`crying face`,`cry sad tear`),row(`😭`,`loudly crying face`,`cry sad sob`),row(`😶`,`face without mouth`,`silent speechless`),row(`😏`,`smirking face`,`smirk`),row(`😒`,`unamused face`,`meh unhappy`),row(`🙄`,`face with rolling eyes`,`eyeroll annoyed`),row(`😬`,`grimacing face`,`grimace awkward`),row(`🤥`,`lying face`,`liar pinocchio`),row(`😎`,`smiling face with sunglasses`,`cool sunglasses`),row(`🤓`,`nerd face`,`nerd geek glasses`),row(`🧐`,`face with monocle`,`fancy monocle`),row(`🧑`,`person`,`adult human`),row(`👨`,`man`,`adult male`),row(`👩`,`woman`,`adult female`),row(`👧`,`girl`,`child female`),row(`👦`,`boy`,`child male`),row(`👶`,`baby`,`child infant`),row(`👶🏻`,`child: light skin tone`,`child skin tone`),row(`🧑‍💻`,`technologist`,`coder computer`),row(`👷`,`construction worker`,`builder work`),row(`🕵️`,`detective`,`spy sleuth`),row(`🤴`,`prince`,`crown royal`),row(`👸`,`princess`,`crown royal`),row(`👰`,`person with veil`,`bride wedding`),row(`🤵`,`person in tuxedo`,`formal groom`),row(`🎅`,`Santa Claus`,`christmas santa`),row(`🤶`,`Mrs. Claus`,`christmas santa`),row(`🦸`,`superhero`,`hero power`),row(`🦹`,`supervillain`,`villain power`),row(`🧙`,`mage`,`wizard magic`),row(`🧚`,`fairy`,`magic wings`),row(`🧛`,`vampire`,`dracula horror`),row(`🧜`,`merperson`,`mermaid merman`),row(`🧝`,`elf`,`fantasy pointy`),row(`🧟`,`zombie`,`undead horror`),row(`💆`,`person getting massage`,`spa head`),row(`💇`,`person getting haircut`,`barber salon`),row(`🚶`,`person walking`,`walk pedestrian`),row(`🏃`,`person running`,`run marathon`),row(`💃`,`woman dancing`,`dance ballet`),row(`👪`,`family`,`parents child`),row(`🧑‍🤝‍🧑`,`people holding hands`,`family couple`)],Gr=[row(`👋`,`waving hand`,`wave hello goodbye`),row(`✋️`,`raised hand`,`stop highfive`),row(`👍`,`thumbs up`,`like yes approve`),row(`👎`,`thumbs down`,`dislike no`),row(`👌`,`OK hand`,`ok perfect`),row(`👏`,`clapping hands`,`applause praise`),row(`👐`,`open hands`,`hug open`),row(`🙌`,`raising hands`,`celebrate praise`),row(`🙏`,`folded hands`,`pray thanks`),row(`🤝`,`handshake`,`deal agreement`),row(`🤘`,`sign of the horns`,`rock metal`),row(`👈`,`backhand index pointing left`,`point direction`),row(`👉`,`backhand index pointing right`,`point direction`),row(`☝️`,`index pointing up`,`point one`),row(`✍️`,`writing hand`,`write pen`),row(`🤞`,`crossed fingers`,`luck hope`),row(`💪`,`flexed biceps`,`muscle strong`),row(`🧠`,`brain`,`mind smart`),row(`👀`,`eyes`,`look see watch`),row(`🧣`,`ear`,`hear listen`),row(`👃`,`nose`,`smell`),row(`🦰`,`red hair`,`ginger hair`),row(`🛀`,`bathing`,`bath shower`),row(`🛍`,`shower`,`bath clean`),row(`🦽`,`probing cane`,`blind accessibility`),row(`🦼`,`motorized wheelchair`,`accessibility`),row(`🦯`,`person with white cane`,`blind accessibility`),row(`🏋️`,`weight lifting`,`gym sport`),row(`👫`,`woman and man holding hands`,`couple family`),row(`👬`,`men holding hands`,`couple`),row(`👭`,`women holding hands`,`couple`),row(`💏`,`kiss`,`love couple`),row(`💑`,`couple with heart`,`love wedding`),row(`👮`,`police officer`,`cop law`),row(`👷`,`person with skullcap`,`worker`),row(`🥷`,`ninja`,`martialarts`),row(`🧗`,`person climbing`,`sport`),row(`🤸`,`person cartwheeling`,`gymnastics`),row(`🤼`,`people wrestling`,`sport wrestle`),row(`👯`,`people with bunny ears`,`costume`),row(`🧕`,`woman with headscarf`,`hijab clothing`),row(`👞`,`man’s shoe`,`clothing`),row(`👕`,`t-shirt`,`clothing shirt`),row(`👖`,`jeans`,`clothing trousers`),row(`👔`,`necktie`,`clothing formal`),row(`👗`,`dress`,`clothing`),row(`👘`,`kimono`,`clothing`),row(`🥻`,`sari`,`clothing`),row(`👙`,`bikini`,`clothing swimsuit`),row(`👚`,`woman’s clothes`,`clothing dress`),row(`🩱`,`one-piece swimsuit`,`clothing swimsuit`),row(`👑`,`woman’s hat`,`clothing`),row(`👒`,`glasses`,`clothing eyewear`),row(`🎩`,`top hat`,`clothing`),row(`🎓`,`graduation cap`,`clothing education`),row(`🧢`,`billed cap`,`clothing hat`),row(`👜`,`running shoe`,`clothing sneaker`),row(`👡`,`woman’s heel`,`clothing shoe`),row(`🛠️`,`hammer and wrench`,`tool repair`)],Kr=[row(`🐒`,`monkey`,`animal primate`),row(`🦍`,`gorilla`,`animal ape`),row(`🐕`,`dog`,`animal pet`),row(`🐶`,`dog face`,`animal pet`),row(`🐩`,`poodle`,`dog animal`),row(`🐺`,`wolf`,`animal`),row(`🦊`,`fox`,`animal`),row(`🐱`,`cat face`,`animal pet`),row(`🦁`,`lion`,`animal cat`),row(`🐯`,`tiger face`,`animal cat`),row(`🐅`,`tiger`,`animal`),row(`🐆`,`leopard`,`animal cat`),row(`🐴`,`horse face`,`animal`),row(`🦄`,`unicorn`,`animal fantasy`),row(`ᾬ`,`unicorn face`,`animal fantasy`),row(`🦓`,`zebra`,`animal`),row(`🦌`,`deer`,`animal`),row(`🐮`,`cow face`,`animal`),row(`🐷`,`pig face`,`animal`),row(`🐪`,`camel`,`animal desert`),row(`🦒`,`giraffe`,`animal`),row(`🐘`,`elephant`,`animal`),row(`🦛`,`rhinoceros`,`animal`),row(`🐰`,`rabbit face`,`animal pet`),row(`🐻`,`bear`,`animal`),row(`🐨`,`koala`,`animal`),row(`🐼`,`panda`,`animal`),row(`🦥`,`sloth`,`animal`),row(`🦦`,`otter`,`animal`),row(`🦘`,`kangaroo`,`animal`),row(`🐔`,`chicken`,`bird animal`),row(`🐧`,`penguin`,`bird animal`),row(`🦆`,`duck`,`bird animal`),row(`🦉`,`owl`,`bird animal`),row(`🐸`,`frog`,`animal`),row(`🐢`,`turtle`,`animal reptile`),row(`🐍`,`snake`,`animal reptile`),row(`🐳`,`dragon face`,`animal fantasy`),row(`🦖`,`T-Rex`,`animal dinosaur`),row(`🐬`,`dolphin`,`animal sea`),row(`🦈`,`shark`,`animal sea`),row(`🐙`,`octopus`,`animal sea`),row(`🐛`,`bug`,`animal insect`),row(`🦋`,`butterfly`,`animal insect`),row(`🕷️`,`spider`,`animal insect`),row(`🌸`,`cherry blossom`,`flower spring`),row(`🌺`,`hibiscus`,`flower`),row(`🌻`,`sunflower`,`flower sun`),row(`🌷`,`tulip`,`flower`),row(`🌱`,`seedling`,`plant nature`),row(`🌲`,`evergreen tree`,`plant nature`),row(`🌳`,`deciduous tree`,`plant nature`),row(`🌴`,`palm tree`,`plant nature`),row(`🌵`,`cactus`,`plant`),row(`🍀`,`four leaf clover`,`plant luck`),row(`🍁`,`maple leaf`,`plant autumn`),row(`🍂`,`fallen leaf`,`plant autumn`),row(`🍃`,`leaf fluttering in wind`,`plant wind`)],qr=[row(`🍇`,`grapes`,`fruit`),row(`🍈`,`melon`,`fruit`),row(`🍉`,`watermelon`,`fruit`),row(`🍊`,`tangerine`,`fruit citrus`),row(`🍋`,`lemon`,`fruit citrus`),row(`🍌`,`banana`,`fruit`),row(`🍍`,`pineapple`,`fruit`),row(`🍎`,`red apple`,`fruit`),row(`🍐`,`pear`,`fruit`),row(`🍑`,`peach`,`fruit`),row(`🍒`,`cherries`,`fruit`),row(`🍓`,`strawberry`,`fruit`),row(`🥝`,`kiwi fruit`,`fruit`),row(`🍏`,`tomato`,`fruit vegetable`),row(`🥐`,`croissant`,`food bread`),row(`🥖`,`flatbread`,`food bread`),row(`🥨`,`pretzel`,`food`),row(`🥯`,`bagel`,`food bread`),row(`🥞`,`pancakes`,`food breakfast`),row(`🧀`,`cheese wedge`,`food dairy`),row(`🍖`,`meat on bone`,`food`),row(`🍗`,`poultry leg`,`food chicken`),row(`🥩`,`cut of meat`,`food`),row(`🥓`,`bacon`,`food`),row(`🍔`,`hamburger`,`food`),row(`🍟`,`french fries`,`food`),row(`🍕`,`pizza`,`food`),row(`🌭`,`hot dog`,`food`),row(`🥪`,`sandwich`,`food lunch`),row(`🌮`,`taco`,`food`),row(`🌯`,`burrito`,`food`),row(`🥗`,`green salad`,`food vegetable`),row(`🍿`,`popcorn`,`food snack`),row(`🍣`,`sushi`,`food japanese`),row(`🍤`,`fish cake with swirl`,`food`),row(`🍥`,`soft ice cream`,`food dessert`),row(`🍦`,`soft serve`,`food dessert`),row(`🍨`,`ice cream`,`food dessert`),row(`🎂`,`birthday cake`,`food dessert`),row(`🧁`,`cupcake`,`food dessert`),row(`🥧`,`pie`,`food dessert`),row(`🍫`,`chocolate bar`,`food dessert`),row(`🍬`,`candy`,`food sweet`),row(`🍭`,`lollipop`,`food sweet`),row(`☕`,`hot beverage`,`drink coffee tea`),row(`🫖`,`teapot`,`drink tea`),row(`🍶`,`teacup without handle`,`drink tea`),row(`🍷`,`wine glass`,`drink`),row(`🍸`,`cocktail glass`,`drink`),row(`🍺`,`beer mug`,`drink`),row(`🥂`,`clinking glasses`,`drink cheers`),row(`🥢`,`chopsticks`,`food utensil`),row(`🍴`,`fork and knife`,`food utensil`),row(`🥄`,`spoon`,`food utensil`)],Jr=[row(`🌍`,`globe showing Europe-Africa`,`world earth`),row(`🌎`,`globe showing Americas`,`world earth`),row(`🌏`,`globe showing Asia-Australia`,`world earth`),row(`🗺️`,`world map`,`map`),row(`⛰️`,`mountain`,`travel nature`),row(`🌋`,`volcano`,`travel nature`),row(`🏕️`,`camping`,`travel nature`),row(`🏖️`,`beach with umbrella`,`travel sea`),row(`🏜`,`desert`,`travel nature`),row(`🏝️`,`desert island`,`travel sea`),row(`🏞️`,`national park`,`travel nature`),row(`🏟️`,`stadium`,`travel sport`),row(`🏛️`,`classical building`,`travel`),row(`🏗️`,`buildings`,`travel`),row(`🏠`,`house`,`home building`),row(`🏡`,`house with garden`,`home`),row(`🏢`,`office building`,`work`),row(`🏤`,`post office`,`building`),row(`🏥`,`hospital`,`building health`),row(`🏨`,`hotel`,`travel building`),row(`🏪`,`convenience store`,`building shop`),row(`🏫`,`school`,`building education`),row(`🏯`,`castle`,`building`),row(`⛪`,`church`,`building religion`),row(`⛩️`,`shinto torii gate`,`japan`),row(`🛑`,`fountain`,`building`),row(`🗼️`,`tower`,`building`),row(`🗽`,`Statue of Liberty`,`travel usa`),row(`🗛️`,`Mount Rushmore`,`travel usa`),row(`🧲`,`carousel horse`,`travel fair`),row(`🚀`,`rocket`,`travel space`),row(`🛸`,`flying saucer`,`travel space`),row(`🛎️`,`bellhop bell`,`travel hotel`),row(`🧳`,`luggage`,`travel`),row(`🧭`,`compass`,`travel navigate`),row(`⌛️`,`hourglass done`,`time`),row(`⏰`,`alarm clock`,`time`),row(`🚂`,`locomotive`,`travel train`),row(`🚆`,`train`,`travel`),row(`🚇`,`metro`,`travel subway`),row(`🚉`,`station`,`travel`),row(`🚌`,`bus`,`travel`),row(`🚑`,`ambulance`,`emergency`),row(`🚓`,`police car`,`emergency`),row(`🚕`,`taxi`,`travel`),row(`🚗`,`automobile`,`travel car`),row(`🚙`,`sport utility vehicle`,`car`),row(`🚲`,`bicycle`,`vehicle`),row(`🛴`,`kick scooter`,`vehicle`),row(`⛺`,`tent`,`travel camping`)],Yr=[row(`🎃`,`jack-o-lantern`,`halloween pumpkin`),row(`🎄`,`Christmas tree`,`christmas`),row(`🎆`,`fireworks`,`celebration`),row(`✨`,`sparkles`,`celebration magic`),row(`🎈`,`balloon`,`party`),row(`🎉`,`party popper`,`party celebration`),row(`🎊`,`confetti ball`,`party`),row(`🎁`,`wrapped gift`,`present birthday`),row(`🎗️`,`reminder ribbon`,`awareness`),row(`🎫`,`ticket`,`event`),row(`🏆`,`trophy`,`award win`),row(`🥇`,`1st place medal`,`award win`),row(`🎾`,`tennis`,`sport`),row(`🏈`,`American football`,`sport`),row(`🏑`,`field hockey`,`sport`),row(`🏒`,`ice hockey`,`sport`),row(`🎳`,`bowling`,`sport`),row(`🏐`,`volleyball`,`sport`),row(`🥎`,`lacrosse`,`sport`),row(`⚽`,`soccer ball`,`sport football`),row(`⚾`,`baseball`,`sport`),row(`🏊`,`swimming`,`sport`),row(`🎿`,`skis`,`sport winter`),row(`⛷️`,`skier`,`sport winter`),row(`🛹`,`skateboard`,`sport`),row(`🎽`,`running shirt`,`sport`),row(`🎯`,`bullseye`,`sport game target`),row(`🎱`,`pool 8 ball`,`game`),row(`🎲`,`game die`,`game dice`),row(`🃏`,`joker`,`game cards`),row(`🕹️`,`joystick`,`game`),row(`🎮`,`video game`,`game`),row(`🧩`,`puzzle piece`,`game`),row(`🧸`,`teddy bear`,`toy`),row(`🪅`,`pinata`,`toy party`),row(`🪆`,`nesting dolls`,`toy`),row(`🎭`,`performing arts`,`theatre`),row(`🎼`,`musical score`,`music`),row(`🎤`,`microphone`,`music sing`),row(`🎧`,`headphones`,`music listen`),row(`🎸`,`guitar`,`music`),row(`🥁`,`drum`,`music`),row(`🎨`,`artist palette`,`art paint`),row(`🖌️`,`paintbrush`,`art paint`),row(`🧵`,`thread`,`sew`),row(`🪡`,`sewing needle`,`sew`)],Xr=[row(`🧱`,`brick`,`object build`),row(`🪑`,`shovel`,`object tool`),row(`🪩`,`mirror ball`,`object`),row(`🧯`,`fire extinguisher`,`object safety`),row(`🛠️`,`hammer and wrench`,`tool`),row(`⚒️`,`hammer and pick`,`tool`),row(`🔧`,`wrench`,`tool`),row(`🪛`,`screwdriver`,`tool`),row(`⚙️`,`gear`,`tool cog`),row(`🗜️`,`clamp`,`tool`),row(`🔒`,`locked with key`,`object security`),row(`🔓`,`unlocked`,`object security`),row(`🔑`,`key`,`object`),row(`🗝️`,`old key`,`object`),row(`🔨`,`hammer`,`tool`),row(`🔫`,`water pistol`,`object toy`),row(`🪓`,`carpentry saw`,`tool`),row(`💡`,`light bulb`,`object idea`),row(`🔦`,`flashlight`,`object`),row(`🔬`,`microscope`,`object lab`),row(`🔭`,`telescope`,`object`),row(`💻`,`laptop`,`object computer`),row(`🖥️`,`desktop computer`,`object computer`),row(`🖨️`,`printer`,`object office`),row(`⌨️`,`keyboard`,`object computer`),row(`🖱️`,`computer mouse`,`object computer`),row(`💾`,`floppy disk`,`object`),row(`📚`,`books`,`object reading`),row(`📓`,`notebook`,`object writing`),row(`📊`,`bar chart`,`object data`),row(`📋`,`clipboard`,`object office`),row(`📌`,`pushpin`,`object office`),row(`📎`,`paperclip`,`object office`),row(`📏`,`straight ruler`,`object office`),row(`✂️`,`scissors`,`object office`),row(`🗑️`,`card file box`,`object office`),row(`🗒️`,`file cabinet`,`object office`),row(`🗓️`,`wastebasket`,`object office`),row(`🧼`,`window`,`object house`),row(`🛙`,`elevator`,`object building`),row(`🛝`,`radio`,`object`),row(`🛞`,`video camera`,`object record`),row(`⚯`,`white flag`,`object surrender`)],Zr=[row(`🔠`,`input latin letters`,`symbol text`),row(`🔡`,`lowercase`,`symbol text`),row(`🔢`,`uppercase`,`symbol text`),row(`🅰️`,`A button`,`symbol letter`),row(`🆎`,`AB button`,`symbol letters`),row(`🆑️`,`CL button`,`symbol`),row(`🆒️`,`COOL button`,`symbol`),row(`🆓️`,`FREE button`,`symbol`),row(`🆔️`,`ID button`,`symbol`),row(`🆕️`,`NEW button`,`symbol`),row(`🆖️`,`OK button`,`symbol`),row(`🆗️`,`SOS button`,`symbol`),row(`🆘️`,`VS button`,`symbol`),row(`🆙️`,`UP button`,`symbol`),row(`🔴`,`red circle`,`symbol shape`),row(`🟠`,`orange circle`,`symbol shape`),row(`🟡`,`yellow circle`,`symbol shape`),row(`🟢`,`green circle`,`symbol shape`),row(`🔵`,`blue circle`,`symbol shape`),row(`🟣`,`purple circle`,`symbol shape`),row(`⚪`,`black circle`,`symbol shape`),row(`⚫`,`white circle`,`symbol shape`),row(`🟧`,`red square`,`symbol shape`),row(`🟨`,`yellow square`,`symbol shape`),row(`🟩`,`green square`,`symbol shape`),row(`🟦`,`blue square`,`symbol shape`),row(`🟪`,`purple square`,`symbol shape`),row(`⬛`,`black large square`,`symbol shape`),row(`⬜`,`white large square`,`symbol shape`),row(`🔶`,`large orange diamond`,`symbol shape`),row(`🔷`,`large blue diamond`,`symbol shape`),row(`🔺`,`red triangle pointed up`,`symbol shape`),row(`🔻`,`red triangle pointed down`,`symbol shape`),row(`▶️`,`black right-pointing triangle`,`symbol shape`),row(`◀️`,`black left-pointing triangle`,`symbol shape`),row(`▲️`,`black up-pointing triangle`,`symbol shape`),row(`▼️`,`black down-pointing triangle`,`symbol shape`),row(`❓`,`red question mark`,`symbol`),row(`❗`,`red exclamation mark`,`symbol`),row(`⁉️`,`red exclamation question mark`,`symbol`),row(`💤`,`zzz`,`symbol sleep`),row(`♻`,`recycling symbol`,`symbol green`),row(`☮`,`information`,`symbol info`),row(`⚠️`,`warning`,`symbol caution`),row(`✔️`,`check mark button`,`symbol done yes`),row(`✖️`,`multiply`,`symbol no`),row(`➕`,`plus`,`symbol math`),row(`➖`,`minus`,`symbol math`),row(`➗`,`divide`,`symbol math`),row(`🚫`,`prohibited`,`symbol no`),row(`🚳`,`no bicycles`,`symbol no`),row(`🚭`,`no smoking`,`symbol no`),row(`🚯`,`no littering`,`symbol no`),row(`🚱`,`non-potable water`,`symbol no`),row(`🔞`,`no one under eighteen`,`symbol age`),row(`🏁`,`chequered flag`,`symbol sport`),row(`🚩`,`triangular flag`,`symbol`),row(`🎌`,`crossed flags`,`symbol`),row(`🏴`,`black flag`,`symbol`),row(`🏳️`,`white flag`,`symbol surrender`),row(`🏳‍🌈`,`rainbow flag`,`symbol pride`)],Qr=[row(`🇦🇨`,`flag: Bolivia`,`flag country`),row(`🇧🇷`,`flag: Brazil`,`flag country`),row(`🇩🇪`,`flag: Germany`,`flag country deutschland`),row(`🇫🇷`,`flag: France`,`flag country`),row(`🇮🇳`,`flag: United Kingdom`,`flag country britain uk`),row(`🇯🇵`,`flag: Japan`,`flag country japan`),row(`🇳🇱`,`flag: United States`,`flag country usa`),row(`🇸🇪`,`flag: Sweden`,`flag country`),row(`🇸🇰`,`flag: Denmark`,`flag country`),row(`🇹🇷`,`flag: Turkey`,`flag country`),row(`🇺🇸`,`flag: Spain`,`flag country`)],$r=[{id:`people`,heading:`Smileys & People`,tooltip:`Smileys & People`,entries:Wr},{id:`body`,heading:`Body & Clothing`,tooltip:`Body & Clothing`,entries:Gr},{id:`nature`,heading:`Animals & Nature`,tooltip:`Animals & Nature`,entries:Kr},{id:`food`,heading:`Food & Drink`,tooltip:`Food & Drink`,entries:qr},{id:`travel`,heading:`Travel & Places`,tooltip:`Travel & Places`,entries:Jr},{id:`activities`,heading:`Activities`,tooltip:`Activities`,entries:Yr},{id:`objects`,heading:`Objects`,tooltip:`Objects`,entries:Xr},{id:`symbols`,heading:`Symbols`,tooltip:`Symbols`,entries:Zr},{id:`flags`,heading:`Flags`,tooltip:`Flags`,entries:Qr}];[...$r.map(e=>e.id)];function emojiTooltip(e){return e===`recent`?`Recent`:$r.find(t=>t.id===e)?.tooltip??``}var GtkEmojiChooser=class extends GtkPopover{_built=!1;_entry;_listEl;_emptyEl;_sections=new Map;_entryOf=new WeakMap;_recent=[];_ctrl=!1;connectedCallback(){if(super.connectedCallback(),this._built)return;this._built=!0,this.hasAttribute(`role`)||this.setAttribute(`role`,`listbox`);let e=document.createElement(`div`);e.className=`emoji-picker-root`,e.appendChild(this._buildSearchbar()),this._listEl=document.createElement(`div`),this._listEl.className=`emoji-list`,this._emptyEl=this._buildEmptyPage();let t=document.createElement(`div`);t.className=`emoji-stack`,t.append(this._listEl,this._emptyEl),e.appendChild(t),this.replaceChildren(e);let n=document.createElement(`div`);n.className=`emoji-flowbox emoji-recent-box`,n.dataset.section=`recent`,this._listEl.appendChild(n),this._sections.set(`recent`,{id:`recent`,heading:null,box:n,button:null,empty:!0}),this._buildSections(),this._buildToolbar(e),this._renderRecents(),this._listEl.addEventListener(`scroll`,()=>this._markSection(this._currentSection())),this.addEventListener(`keydown`,e=>this._ctrl=e.ctrlKey),this.addEventListener(`keyup`,e=>this._ctrl=e.ctrlKey),this.subscribe(e=>{e&&(this._entry.value=``,this._filter(),this._listEl.scrollTop=0,this._markSection(`recent`))}),this._markSection(`recent`)}get recentEmoji(){return[...this._recent]}pick(e,t=!1){this._activate(e,null,t)}_buildSearchbar(){let e=document.createElement(`div`);e.className=`emoji-searchbar`;let t=createGtkImage(`edit-find`,`emoji-search-icon`);return this._entry=document.createElement(`input`),this._entry.type=`search`,this._entry.className=`emoji-search-entry`,this._entry.placeholder=`Search emoji`,this._entry.setAttribute(`aria-label`,`Search emoji`),this._entry.addEventListener(`input`,()=>this._filter()),this._entry.addEventListener(`keydown`,e=>{if(e.key===`Enter`){e.preventDefault(),this._activateFirstResult();return}e.ctrlKey&&(e.key===`n`||e.key===`p`)&&(e.preventDefault(),this._scrollSection(e.key===`n`?1:-1))}),e.append(t,this._entry),e}_buildEmptyPage(){let e=document.createElement(`div`);e.className=`emoji-empty`,e.hidden=!0,e.appendChild(createGtkImage(`edit-find`,`emoji-empty-icon`));let t=document.createElement(`div`);t.className=`emoji-empty-title`,t.textContent=`No Results Found`;let n=document.createElement(`div`);return n.className=`emoji-empty-hint`,n.textContent=`Try a different search`,e.append(t,n),e}_buildSections(){for(let e of $r){let t=document.createElement(`div`);t.className=`emoji-heading`,t.textContent=e.heading;let n=document.createElement(`div`);n.className=`emoji-flowbox`,n.dataset.section=e.id;for(let t of e.entries)n.appendChild(this._emojiButton(t));this._listEl.append(t,n),this._sections.set(e.id,{id:e.id,heading:t,box:n,button:null,empty:!0})}}_buildToolbar(e){let t=document.createElement(`div`);t.className=`emoji-toolbar`;let n=[[`recent`,this._sectionButton(`recent`,createGtkImage(`emoji-recent`,`emoji-section-icon`),emojiTooltip(`recent`))],[`people`,this._sectionButton(`people`,createGtkImage(`emoji-people`,`emoji-section-icon`),emojiTooltip(`people`))],[`body`,this._sectionButton(`body`,createGtkImage(`emoji-body`,`emoji-section-icon`),emojiTooltip(`body`))],[`nature`,this._sectionButton(`nature`,createGtkImage(`emoji-nature`,`emoji-section-icon`),emojiTooltip(`nature`))],[`food`,this._sectionButton(`food`,createGtkImage(`emoji-food`,`emoji-section-icon`),emojiTooltip(`food`))],[`travel`,this._sectionButton(`travel`,createGtkImage(`emoji-travel`,`emoji-section-icon`),emojiTooltip(`travel`))],[`activities`,this._sectionButton(`activities`,createGtkImage(`emoji-activities`,`emoji-section-icon`),emojiTooltip(`activities`))],[`objects`,this._sectionButton(`objects`,createGtkImage(`emoji-objects`,`emoji-section-icon`),emojiTooltip(`objects`))],[`symbols`,this._sectionButton(`symbols`,createGtkImage(`emoji-symbols`,`emoji-section-icon`),emojiTooltip(`symbols`))],[`flags`,this._sectionButton(`flags`,createGtkImage(`emoji-flags`,`emoji-section-icon`),emojiTooltip(`flags`))]];for(let[e,t]of n){t.addEventListener(`click`,()=>this._scrollTo(e));let n=this._sections.get(e);n!==void 0&&this._sections.set(e,{...n,button:t})}t.append(...n.map(([,e])=>e)),e.appendChild(t)}_sectionButton(e,t,n){let r=document.createElement(`button`);return r.type=`button`,r.className=`emoji-section`,r.dataset.section=e,r.title=n,r.setAttribute(`aria-label`,n),r.appendChild(t),r}_emojiButton(e){let t=document.createElement(`button`);return t.type=`button`,t.className=`emoji`,t.textContent=e.text,t.title=e.name,t.setAttribute(`aria-label`,e.name),this._entryOf.set(t,e),t.addEventListener(`click`,n=>{if(this._closeVariations(),n.detail>1&&hasVariations(e)){this._showVariations(e,t);return}this._activate(e,t)}),t}_matches(e,t){if(t.length===0)return!0;let n=`${e.name} ${e.keywords.join(` `)}`.toLowerCase().split(/\s+/);return t.every(e=>n.some(t=>t.startsWith(e)))}_filter(){let e=this._entry.value.toLowerCase().split(/\s+/).filter(e=>e.length>0);for(let t of this._sections.values()){let n=0;for(let r of t.box.querySelectorAll(`.emoji`)){let t=this._entryOf.get(r),i=t!==void 0&&this._matches(t,e);r.hidden=!i,i&&(n+=1)}t.empty=n===0,t.heading!==null&&(t.heading.hidden=t.empty),t.id!==`recent`&&(t.box.hidden=t.empty)}let t=[...this._sections.values()].every(e=>e.empty);this._listEl.hidden=t,this._emptyEl.hidden=!t,this._markSection(this._currentSection())}_activate(e,t,n=!1){!n&&t?.parentElement?.dataset.section!==`recent`&&this._remember(e),this.dispatchEvent(new CustomEvent(`emoji-picked`,{bubbles:!0,detail:{text:e.text}})),this._ctrl||this.popdown()}_remember(e){this._recent=[e,...this._recent.filter(t=>t.text!==e.text)].slice(0,21),this._renderRecents()}_renderRecents(){let e=this._sections.get(`recent`);if(e===void 0)return;e.box.replaceChildren(...this._recent.map(e=>this._emojiButton(e)));let t=this._recent.length===0;e.box.hidden=t,e.empty=t,e.button!==null&&(e.button.disabled=t)}_showVariations(e,t){this._closeVariations();let n=document.createElement(`div`);n.className=`emoji-variations`;let r=document.createElement(`div`);r.className=`emoji-variations-row`;let i=[...e.text].filter(e=>!Ur.includes(e)).join(``);for(let t of[i,...Ur.map(e=>i+e)]){let n=document.createElement(`button`);n.type=`button`,n.className=`emoji`,n.textContent=t,n.addEventListener(`click`,r=>{r.stopPropagation(),this._closeVariations(),this._activate({...e,text:t},n)}),r.appendChild(n)}n.appendChild(r),t.insertAdjacentElement(`afterend`,n)}_closeVariations(){for(let e of this.querySelectorAll(`.emoji-variations`))e.remove()}_scrollTo(e){let t=this._sections.get(e);if(t===void 0||t.empty)return;let n=t.heading??t.box;this._listEl.scrollTo({top:n.offsetTop-6,behavior:`smooth`}),this._markSection(e)}_scrollSection(e){let t=[...this._sections.values()].filter(e=>!e.empty);if(t.length===0)return;let n=t.findIndex(e=>e.id===this._currentSection()),r=t[Math.min(Math.max((n<0?0:n)+e,0),t.length-1)];this._scrollTo(r.id)}_activateFirstResult(){for(let e of this._sections.values()){if(e.empty)continue;let t=[...e.box.querySelectorAll(`.emoji`)].find(e=>!e.hidden);if(t!==void 0){this._activate(this._entryOf.get(t)??{text:t.textContent??``,name:``,keywords:[]},t);return}}}_sectionAt(e){let t=`recent`;for(let n of this._sections.values())if(!(n.empty||n.box.hidden)){if(e<(n.heading??n.box).offsetTop-6)break;t=n.id}return t}_currentSection(){return this._sectionAt(this._listEl.scrollTop)}_markSection(e){for(let t of this._sections.values())t.button?.classList.toggle(`checked`,t.id===e)}};customElements.define(`gtk-emoji-chooser`,GtkEmojiChooser);var GtkEntry=class extends HTMLElement{_input;_initialized=!1;_maxLength=0;_announced=``;static signals={changed:`changed`,"notify::text":`notify::text`,activate:`activate`};static get observedAttributes(){return[`value`,`text`,`placeholder-text`,`placeholder`,`width-request`,`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._announceText()):this.setAttribute(`value`,t)}get text(){return this.value}set text(e){this.value=e}_announceText(){let e=this._input.value;e!==this._announced&&(this._announced=e,this.dispatchEvent(new CustomEvent(`changed`,{bubbles:!0})),this.dispatchEvent(new CustomEvent(`notify::text`,{bubbles:!0,detail:{text:e}})))}get maxLength(){return this._maxLength}set maxLength(e){this._maxLength=Number.isFinite(e)?Math.min(it,Math.max(0,Math.trunc(e))):0,this._input&&(this._input.value=clampEntryText(this._input.value,this._maxLength),this._announceText())}get textLength(){return entryTextLength(this.value)}placeholderAttribute(){return this.getAttribute(`placeholder-text`)??this.getAttribute(`placeholder`)??``}applyWidthRequest(){let e=Number(this.getAttribute(`width-request`)??-1);this.style.minWidth=Number.isFinite(e)&&e>0?`${e}px`:``}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.getAttribute(`text`)??``,this._maxLength),e.placeholder=this.placeholderAttribute(),this.applyWidthRequest(),e.disabled=this.hasAttribute(`disabled`),e.addEventListener(`input`,()=>{let t=clampEntryText(e.value,this._maxLength);t!==e.value&&(e.value=t),this._announceText()}),e.addEventListener(`keydown`,t=>{t.key===`Enter`&&this.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0,detail:{value:e.value}}))}),this._input=e,this._announced=e.value,this.replaceChildren(e)}disconnectedCallback(){}attributeChangedCallback(e,t,n){if(e===`maxlength`){this.maxLength=Number(n??0);return}if(e===`width-request`){this.applyWidthRequest();return}this._input&&(e===`value`||e===`text`?(this._input.value=clampEntryText(n??``,this._maxLength),this._announceText()):e===`placeholder-text`||e===`placeholder`?this._input.placeholder=this.placeholderAttribute():e===`type`?this._input.type=n||`text`:e===`disabled`&&(this._input.disabled=n!==null))}};customElements.define(`gtk-entry`,GtkEntry);const ei={left:`start`,right:`end`,center:`center`,fill:`justify`},ti=[`label`,`use-markup`,`use-underline`,`justify`,`xalign`,`yalign`,`wrap`,`wrap-mode`,`ellipsize`,`lines`,`width-chars`,`max-width-chars`,`selectable`];var GtkLabel=class extends HTMLElement{_wrapSpan=null;_resizes=null;_wroteMinWidth=!1;_wroteMaxWidth=!1;static get observedAttributes(){return[...ti]}get label(){return this.getAttribute(`label`)??``}set label(e){this.setAttribute(`label`,e??``)}get useMarkup(){return this.hasAttribute(`use-markup`)}set useMarkup(e){this.toggleAttribute(`use-markup`,!!e)}get useUnderline(){return this.hasAttribute(`use-underline`)}set useUnderline(e){this.toggleAttribute(`use-underline`,!!e)}get justify(){return normalizeLabelJustify(this.getAttribute(`justify`))}set justify(e){this.setAttribute(`justify`,e)}get xalign(){return normalizeLabelXalign$1(this.getAttribute(`xalign`))}set xalign(e){this.setAttribute(`xalign`,String(e))}get yalign(){return normalizeLabelYalign(this.getAttribute(`yalign`))}set yalign(e){this.setAttribute(`yalign`,String(e))}get wrap(){return this.hasAttribute(`wrap`)}set wrap(e){this.toggleAttribute(`wrap`,!!e)}get wrapMode(){return normalizeLabelWrapMode(this.getAttribute(`wrap-mode`))}set wrapMode(e){this.setAttribute(`wrap-mode`,e)}get ellipsize(){return normalizeLabelEllipsize(this.getAttribute(`ellipsize`))}set ellipsize(e){this.setAttribute(`ellipsize`,e)}get lines(){return normalizeLabelLines(this.getAttribute(`lines`))}set lines(e){this.setAttribute(`lines`,String(e))}get widthChars(){return normalizeLabelWidthChars(this.getAttribute(`width-chars`))}set widthChars(e){this.setAttribute(`width-chars`,String(e))}get maxWidthChars(){return normalizeLabelMaxWidthChars(this.getAttribute(`max-width-chars`))}set maxWidthChars(e){this.setAttribute(`max-width-chars`,String(e))}get selectable(){return this.hasAttribute(`selectable`)}set selectable(e){this.toggleAttribute(`selectable`,!!e)}get_label(){return this.label}set_label(e){this.label=e}getText(){return labelDisplayText(this.label,this.useMarkup,this.useUnderline)}connectedCallback(){this._render(),this._resizes=new ResizeObserver(()=>this._remeasure()),this._resizes.observe(this),document.fonts?.ready.then(()=>this._remeasure())}disconnectedCallback(){this._resizes?.disconnect(),this._resizes=null}_remeasure(){if(!this._wrapSpan||!this.isConnected)return;this._wrapSpan.style.width=``;let e=measuredWrapWidth(this._wrapSpan);this._wrapSpan.style.width=e===null?``:`${e}px`}attributeChangedCallback(e,t,n){this._render();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){return e===`label`?t??``:e===`justify`?normalizeLabelJustify(t):e===`xalign`?normalizeLabelXalign$1(t):e===`yalign`?normalizeLabelYalign(t):e===`wrap-mode`?normalizeLabelWrapMode(t):e===`ellipsize`?normalizeLabelEllipsize(t):e===`lines`?normalizeLabelLines(t):e===`width-chars`?normalizeLabelWidthChars(t):e===`max-width-chars`?normalizeLabelMaxWidthChars(t):t!==null}_render(){let e=this.getText(),t=this.wrap,n=this.ellipsize,r=n!==`none`;t||r?this._renderSpan(e,r):this._renderSingleLine(e),this.style.setProperty(`--gtk-label-xalign`,String(this.xalign)),this.style.textAlign=ei[this.justify],this.style.setProperty(`--gtk-label-align-items`,labelYalignAlignItems(this.yalign));let i=labelEllipsizeOverflowValue(n);i===`ellipsis`?this.style.setProperty(`--gtk-label-ellipsize-overflow`,i):this.style.removeProperty(`--gtk-label-ellipsize-overflow`);let a=labelEffectiveLines(this.lines,n);a===null?this.style.removeProperty(`--gtk-label-lines`):this.style.setProperty(`--gtk-label-lines`,String(a));let o=labelWidthCharsExtent(this.widthChars,this.maxWidthChars);o.minCh===null?this._wroteMinWidth&&this.style.removeProperty(`min-width`):this.style.minWidth=`${o.minCh}ch`,o.maxCh===null?this._wroteMaxWidth&&this.style.removeProperty(`max-width`):this.style.maxWidth=`${o.maxCh}ch`,this._wroteMinWidth=o.minCh!==null,this._wroteMaxWidth=o.maxCh!==null}_renderSingleLine(e){this._wrapSpan?.remove(),this._wrapSpan=null,this.textContent!==e&&(this.textContent=e)}_renderSpan(e,t){this._wrapSpan||(this.textContent=``,this._wrapSpan=document.createElement(`span`),this._wrapSpan.className=`adw-label-text`,this.appendChild(this._wrapSpan)),this._wrapSpan.classList.toggle(`adw-label-clamp`,t),this._wrapSpan.textContent!==e&&(this._wrapSpan.textContent=e),this._remeasure()}};function measuredWrapWidth(e){let t=document.createRange();t.selectNodeContents(e);let n=0;for(let e of t.getClientRects())n=Math.max(n,e.width);return n>0?Math.ceil(n):null}customElements.define(`gtk-label`,GtkLabel);let ni=0;var GtkExpander=class extends HTMLElement{_box;_titleEl;_arrowEl;_labelEl;_labelSection;_contentEl;_initialized=!1;static get observedAttributes(){return[`expanded`,`label`,`use-markup`,`use-underline`,`resize-toplevel`]}get expanded(){return this.hasAttribute(`expanded`)}set expanded(e){this.toggleAttribute(`expanded`,!!e)}get label(){return this.labelWidget===null?this.getAttribute(`label`):null}set label(e){e===null?this.removeAttribute(`label`):this.setAttribute(`label`,e)}get useMarkup(){return this.hasAttribute(`use-markup`)}set useMarkup(e){this.toggleAttribute(`use-markup`,!!e)}get useUnderline(){return this.hasAttribute(`use-underline`)}set useUnderline(e){this.toggleAttribute(`use-underline`,!!e)}get resizeToplevel(){return this.hasAttribute(`resize-toplevel`)}set resizeToplevel(e){this.toggleAttribute(`resize-toplevel`,!!e)}get child(){return this._contentEl?.firstElementChild??null}get labelWidget(){return this._labelSection?.firstElementChild??null}connectedCallback(){this._initialized||(this._initialized=!0,this._arrowEl=createGtkImage(`pan-end`,`adw-expander-arrow`),this._labelEl=document.createElement(`gtk-label`),this._labelSection=document.createElement(`div`),this._labelSection.className=`adw-expander-label`,this._titleEl=document.createElement(`div`),this._titleEl.className=`adw-expander-title`,this._titleEl.setAttribute(`role`,`button`),this._titleEl.append(this._arrowEl,this._labelEl,this._labelSection),this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-expander-content`,this._box=document.createElement(`div`),this._box.className=`adw-expander-box`,this._box.append(this._titleEl,this._contentEl),bindSlottedChildren(this,[{name:`label-widget`,into:this._labelSection},{name:`label`,into:this._labelSection},{name:`child`,into:this._contentEl},{into:this._contentEl}]).install(this._box),bindEmptySections(this._labelSection),this._titleEl.addEventListener(`click`,()=>this._activate()),attachRowActivation({row:this._titleEl,activatable:()=>!0}),this._titleEl.addEventListener(`keydown`,this._onKeyDown),this._render())}attributeChangedCallback(e){this._initialized&&(this._render(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._detail(e)}})))}_detail(e){switch(e){case`expanded`:return this.expanded;case`label`:return this.label;case`use-markup`:return this.useMarkup;case`use-underline`:return this.useUnderline;default:return this.resizeToplevel}}_activate(){this.expanded=!this.expanded,this.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0,detail:{expanded:this.expanded}}))}_onKeyDown=e=>{if(!this.useUnderline||!e.altKey||e.ctrlKey||e.metaKey)return;let t=this._mnemonic();t===null||(e.key.length===1?e.key.toUpperCase():``)!==t||(e.preventDefault(),this._activate())};_mnemonic(){let e=[...this.getAttribute(`label`)??``];for(let t=0;t<e.length;t+=1){if(e[t]!==`_`)continue;let n=e[t+1];if(n===void 0)return null;if(t+=1,n!==`_`)return n.toUpperCase()}return null}_render(){this._arrowEl.classList.toggle(`checked`,this.expanded),this.classList.toggle(`expanded`,this.expanded),this._titleEl.setAttribute(`aria-expanded`,String(this.expanded)),this._contentEl.hidden=!this.expanded;let e=this.labelWidget;this._labelEl.hidden=e!==null||this.label===null,e===null&&(this._labelEl.setAttribute(`label`,labelDisplayText(this.label??``,this.useMarkup,this.useUnderline)),this._labelEl.toggleAttribute(`use-markup`,this.useMarkup),this._labelEl.toggleAttribute(`use-underline`,this.useUnderline));let t=this.child;t===null?this._titleEl.removeAttribute(`aria-controls`):this._titleEl.getAttribute(`aria-controls`)===null&&(t.id===``&&(t.id=`gtk-expander-content-${ni++}`),this._titleEl.setAttribute(`aria-controls`,t.id)),this.classList.toggle(`resize-toplevel`,this.resizeToplevel)}};customElements.define(`gtk-expander`,GtkExpander);var GtkFixed=class extends HTMLElement{_resize=null;_mutations=null;connectedCallback(){this._resize=new ResizeObserver(()=>this._size()),this._resize.observe(this),this._mutations=new MutationObserver(()=>{this._observeChildren(),this._size()}),this._mutations.observe(this,{childList:!0}),this._observeChildren(),this._size()}disconnectedCallback(){this._resize?.disconnect(),this._resize=null,this._mutations?.disconnect(),this._mutations=null}put(e,t,n){e.parentNode!==this&&this.append(e),this.move(e,t,n)}move(e,t,n){e.style.left=`${t}px`,e.style.top=`${n}px`}_observeChildren(){if(this._resize!==null)for(let e of this.children)e instanceof HTMLElement&&this._resize.observe(e)}_size(){let e=0,t=0;for(let n of this.children)n instanceof HTMLElement&&(e=Math.max(e,n.offsetLeft+n.offsetWidth),t=Math.max(t,n.offsetTop+n.offsetHeight));let n=`${e}px`,r=`${t}px`;this.style.minWidth!==n&&(this.style.minWidth=n),this.style.minHeight!==r&&(this.style.minHeight=r)}};customElements.define(`gtk-fixed`,GtkFixed);var GtkFlowBoxChild=class extends HTMLElement{_contentsEl;_initialized=!1;connectedCallback(){this._initialized||(this._initialized=!0,this._contentsEl=document.createElement(`div`),this._contentsEl.className=`adw-flow-box-child-contents`,bindSlottedChildren(this,[{into:this._contentsEl}]).install(this._contentsEl),this.setAttribute(`role`,`gridcell`),this.tabIndex=0)}get child(){return this._contentsEl.firstElementChild}get index(){return this.parentElement?[...this.parentElement.children].indexOf(this):-1}get selected(){return this.classList.contains(`selected`)}};customElements.define(`gtk-flow-box-child`,GtkFlowBoxChild);var GtkFlowBox=class extends HTMLElement{_children=[];_selection=[];_anchor=-1;_initialized=!1;static get observedAttributes(){return[`selection-mode`,`activate-on-single-click`,`accept-unpaired-release`,`homogeneous`,`min-children-per-line`,`max-children-per-line`,`row-spacing`,`column-spacing`,`orientation`]}get selectionMode(){return normalizeBoxSelectionMode(this.getAttribute(`selection-mode`))}set selectionMode(e){this.setAttribute(`selection-mode`,e)}get activateOnSingleClick(){return this.getAttribute(`activate-on-single-click`)!==`false`}set activateOnSingleClick(e){this.setAttribute(`activate-on-single-click`,String(!!e))}get acceptUnpairedRelease(){return this.hasAttribute(`accept-unpaired-release`)}set acceptUnpairedRelease(e){this.toggleAttribute(`accept-unpaired-release`,!!e)}get homogeneous(){return this.hasAttribute(`homogeneous`)}set homogeneous(e){this.toggleAttribute(`homogeneous`,!!e)}get minChildrenPerLine(){return count(this.getAttribute(`min-children-per-line`),0)}set minChildrenPerLine(e){this.setAttribute(`min-children-per-line`,String(e))}get maxChildrenPerLine(){return Math.max(1,count(this.getAttribute(`max-children-per-line`),7))}set maxChildrenPerLine(e){this.setAttribute(`max-children-per-line`,String(e))}get rowSpacing(){return count(this.getAttribute(`row-spacing`),0)}set rowSpacing(e){this.setAttribute(`row-spacing`,String(e))}get columnSpacing(){return count(this.getAttribute(`column-spacing`),0)}set columnSpacing(e){this.setAttribute(`column-spacing`,String(e))}get orientation(){return this.getAttribute(`orientation`)===`vertical`?`vertical`:`horizontal`}set orientation(e){this.setAttribute(`orientation`,e)}get cells(){return this._children}get selectedChildren(){return[...this._selection]}set selectedChildren(e){for(let t of typeof e==`number`?[e]:e??[])this.selectChild(this._children[t]??null)}get selectedChildElements(){return this._selection.map(e=>this._children[e]).filter(e=>e!==void 0)}connectedCallback(){this._initialized||(this._initialized=!0,this.addEventListener(`click`,e=>this._onClick(e)),this.addEventListener(`dblclick`,e=>this._onDoubleClick(e)),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),attachRovingFocus({host:this,orientation:()=>this.orientation,items:()=>this._children,step:(e,t,n)=>{let r=t+n;return r<0||r>=e.length?null:r},crossAxis:{orientation:()=>this.orientation===`horizontal`?`vertical`:`horizontal`,step:(e,t,n)=>visualStep(e,t,n,this.orientation)},select:e=>this._updateSelection(e,{})}),new MutationObserver(()=>this._collectChildren()).observe(this,{childList:!0}),this._applyAttributes(),this._collectChildren())}attributeChangedCallback(){this._initialized&&(this._applyAttributes(),this._syncChildren())}selectChild(e){let t=listBoxSelectRow(this._selection,this._anchor,e===null?null:this._children.indexOf(e),this._children.length,this.selectionMode);same$1(t.selection,this._selection)&&t.anchor===this._anchor||(this._selection=t.selection,this._anchor=t.anchor,this._emitSelection(e))}unselectChild(e){let t=listBoxUnselectRow(this._selection,this._anchor,this._children.indexOf(e),this._children.length,this.selectionMode);same$1(t.selection,this._selection)||(this._selection=t.selection,this._emitSelection(null))}selectAll(){let e=listBoxSelectAll(this._children.length,this.selectionMode);e!==null&&(this._selection=e,this._anchor=e.length>0?e[0]:-1,this._emitSelection(this.selectedChildElements[0]??null))}unselectAll(){listBoxUnselectAll(this._selection,this.selectionMode)!==null&&(this._selection=[],this._anchor=-1,this._emitSelection(null))}_applyAttributes(){this.classList.toggle(`homogeneous`,this.homogeneous),this.classList.toggle(`vertical`,this.orientation===`vertical`),this.style.setProperty(`--adw-flow-box-row-spacing`,`${this.rowSpacing}px`),this.style.setProperty(`--adw-flow-box-column-spacing`,`${this.columnSpacing}px`),this.style.setProperty(`--adw-flow-box-max-children-per-line`,String(this.maxChildrenPerLine)),this.minChildrenPerLine>0?this.style.setProperty(`--adw-flow-box-min-children-per-line`,String(this.minChildrenPerLine)):this.style.removeProperty(`--adw-flow-box-min-children-per-line`);let e=this.selectionMode!==`none`;this.setAttribute(`role`,`grid`),this.selectionMode===`multiple`?this.setAttribute(`aria-multiselectable`,`true`):this.removeAttribute(`aria-multiselectable`),e?this.removeAttribute(`aria-readonly`):this.setAttribute(`aria-readonly`,`true`)}_collectChildren(){let e=[...this.querySelectorAll(`:scope > gtk-flow-box-child`)];e.length===this._children.length&&e.every((e,t)=>e===this._children[t])||(this._children=e,this._selection=this._selection.filter(e=>e<this._children.length),this._anchor>=this._children.length&&(this._anchor=-1),this._syncChildren())}_syncChildren(){let e=this.selectionMode!==`none`,t=new Set(this._selection);this._children.forEach((n,r)=>{let i=t.has(r);n.classList.toggle(`selected`,i),n.classList.toggle(`activatable`,e),e?n.setAttribute(`aria-selected`,String(i)):n.removeAttribute(`aria-selected`)})}_onClick(e){let t=this._childAt(e.target);t===null&&!this.acceptUnpairedRelease||(t!==null&&this._updateSelection(t,{modify:e.ctrlKey||e.metaKey,extend:e.shiftKey}),!(e.detail<(this.activateOnSingleClick?1:2))&&t!==null&&this._activate(t))}_onDoubleClick(e){if(this.activateOnSingleClick)return;let t=this._childAt(e.target);t!==null&&this._activate(t)}_onKeyDown(e){if(!e.ctrlKey||e.altKey||e.metaKey||e.key!==` `)return;let t=this._childAt(e.target);t!==null&&(e.preventDefault(),this._updateSelection(t,{modify:!0}))}_childAt(e){if(!(e instanceof Element))return null;let t=e.closest(`gtk-flow-box-child`);return this.contains(t)?t:null}_updateSelection(e,t){let n=listBoxSelect(this._selection,this._anchor,this._children.indexOf(e),this._children.length,this.selectionMode,t);same$1(n.selection,this._selection)||(this._selection=n.selection,this._anchor=n.anchor,this._emitSelection(n.selection.includes(this._children.indexOf(e))?e:null))}_activate(e){this.dispatchEvent(new CustomEvent(`child-activated`,{bubbles:!0,detail:{child:e}})),e.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0}))}_emitSelection(e){this._syncChildren(),this.dispatchEvent(new CustomEvent(`selected-children-changed`,{bubbles:!0})),this.dispatchEvent(new CustomEvent(`child-selected`,{bubbles:!0,detail:{child:e}})),this.dispatchEvent(new CustomEvent(`notify::selected-children`,{bubbles:!0,detail:{selectedChildren:[...this._selection]}}))}};const visualStep=(e,t,n,r)=>{if(e.length<2)return null;let i=r===`vertical`,alongLine=e=>i?e.offsetLeft:e.offsetTop,acrossLine=e=>i?e.offsetTop:e.offsetLeft,a=e[t],o=alongLine(a),s=acrossLine(a),c=n>0?o+1:o-1,l=null,u=1/0;for(let t=0;t<e.length;t++){let n=e[t];if(alongLine(n)!==c)continue;let r=Math.abs(acrossLine(n)-s);(l===null||r<u)&&(l=t,u=r)}if(l!==null)return l;let d=t+n;return d<0||d>=e.length?null:alongLine(e[d])===o?d:null};function same$1(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}__name(same$1,`same`);function count(e,t){let n=Number.parseInt(e??``,10);return Number.isFinite(n)&&n>=0?n:t}customElements.define(`gtk-flow-box`,GtkFlowBox);const ri={family:`Sans`,slant:`normal`,weight:400,width:`normal`,size:12,absolute:!1},ii=[{word:`Thin`,set:{weight:100}},{word:`UltraLight`,set:{weight:200}},{word:`Light`,set:{weight:300}},{word:`SemiLight`,set:{weight:350}},{word:`Book`,set:{weight:375}},{word:`Medium`,set:{weight:500}},{word:`SemiBold`,set:{weight:600}},{word:`Bold`,set:{weight:700}},{word:`UltraBold`,set:{weight:800}},{word:`Heavy`,set:{weight:900}},{word:`Black`,set:{weight:1e3}},{word:`Italic`,set:{slant:`italic`}},{word:`Oblique`,set:{slant:`oblique`}},{word:`Condensed`,set:{width:`condensed`}},{word:`Expanded`,set:{width:`expanded`}}];function parseFontDescription(e){let t={...ri,family:``},n=e.trim().split(/\s+/).filter(e=>e!==``);for(let e=n.length;e>0;e--){let r=/^(-?\d+(?:\.\d+)?)(px)?$/.exec(n[e-1]);if(r!==null){t.size=Number(r[1]),t.absolute=r[2]===`px`,n.length=e-1;break}}let r=[];for(let e of n){let n=ii.find(t=>t.word.toLowerCase()===e.toLowerCase());if(n===void 0){r.push(e);continue}Object.assign(t,n.set)}return t.family=r.join(` `),t}function formatFontDescription(e){let t=[];for(let{word:n,set:r}of ii)Object.entries(r).every(([t,n])=>e[t]===n)&&!t.includes(n)&&t.push(n);let n=`${e.size}${e.absolute?`px`:``}`;return[e.family,...t,n].filter(e=>e!==``).join(` `)}function fontDescriptionEqual(e,t){return e.family===t.family&&e.slant===t.slant&&e.weight===t.weight&&e.width===t.width&&e.size===t.size&&e.absolute===t.absolute}function formatFontSize(e,t){return`${Number(e.toPrecision(4))}${t?`px`:``}`}function cssFontParts(e,t){return{fontFamily:e.family===``?`sans-serif`:`"${e.family}"`,fontWeight:String(e.weight),fontStyle:e.slant,fontStretch:e.width,fontSize:t?`${e.size}${e.absolute?`px`:`pt`}`:``}}function cssFontShorthand(e,t){let n=cssFontParts(e,t),r=[];return n.fontStyle!==`normal`&&r.push(n.fontStyle),n.fontWeight!==`400`&&r.push(n.fontWeight),n.fontStretch!==`normal`&&r.push(n.fontStretch),n.fontSize!==``&&r.push(n.fontSize),r.length>0&&r.push(``),`${r.join(` `)}${n.fontFamily}`.trim()}function cssFontFeatureTags(e){return e.split(`,`).map(e=>e.trim()).filter(e=>e!==``).map(e=>`"${e}"`)}var GtkSeparator=class extends HTMLElement{static get observedAttributes(){return[`orientation`]}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this.setAttribute(`orientation`,e)}connectedCallback(){this.setAttribute(`role`,`separator`),this._render()}attributeChangedCallback(){this.isConnected&&this._render()}_render(){let e=this.orientation;this.classList.toggle(`horizontal`,e===`horizontal`),this.classList.toggle(`vertical`,e===`vertical`),this.setAttribute(`aria-orientation`,e)}};customElements.define(`gtk-separator`,GtkSeparator);const ai=[`family`,`face`,`font`,`features`],oi=[{weight:400,slant:`normal`},{weight:700,slant:`normal`},{weight:400,slant:`italic`},{weight:700,slant:`italic`}];var GtkFontDialogButton=class extends HTMLElement{_buttonEl;_labelEl;_sizeBoxEl;_sizeLabelEl;_dockEl;_selectEl;_desc={...ri};_dialog=null;_features=``;_language=null;_pending=!1;_initialized=!1;static get observedAttributes(){return[`font-desc`,`font-features`,`language`,`level`,`use-font`,`use-size`,`dialog`,`disabled`]}get fontDesc(){return{...this._desc}}set fontDesc(e){let t=typeof e==`string`?parseFontDescription(e):e;fontDescriptionEqual(t,this._desc)||(this._desc={...t},this._render(),this.dispatchEvent(new CustomEvent(`notify::font-desc`,{bubbles:!0,detail:{fontDesc:this.fontDesc}})))}get fontFeatures(){return this._features}set fontFeatures(e){this._features!==e&&(this._features=e,this._render(),this.dispatchEvent(new CustomEvent(`notify::font-features`,{bubbles:!0,detail:{value:e}})))}get language(){return this._language}set language(e){this._language!==e&&(this._language=e,this._render(),this.dispatchEvent(new CustomEvent(`notify::language`,{bubbles:!0,detail:{value:e}})))}get level(){let e=this.getAttribute(`level`);return ai.find(t=>t===e)??`font`}set level(e){this.setAttribute(`level`,e)}get useFont(){return this.hasAttribute(`use-font`)}set useFont(e){this.toggleAttribute(`use-font`,!!e)}get useSize(){return this.hasAttribute(`use-size`)}set useSize(e){this.toggleAttribute(`use-size`,!!e)}get dialog(){return this._dialog}set dialog(e){this._dialog!==e&&(this._dialog=e,this._renderSensitivity(),this.dispatchEvent(new CustomEvent(`notify::dialog`,{bubbles:!0,detail:{dialog:e}})))}connectedCallback(){if(this._initialized)return;this._initialized=!0,this.setAttribute(`role`,`group`),this._labelEl=document.createElement(`span`),this._labelEl.className=`font-button-label`,this._sizeLabelEl=document.createElement(`span`),this._sizeLabelEl.className=`font-button-size-label`;let e=document.createElement(`gtk-separator`);e.setAttribute(`orientation`,`vertical`),this._sizeBoxEl=document.createElement(`span`),this._sizeBoxEl.className=`font-button-size`,this._sizeBoxEl.append(e,this._sizeLabelEl),this._buttonEl=document.createElement(`button`),this._buttonEl.type=`button`,this._buttonEl.className=`adw-button font`,this._buttonEl.setAttribute(`aria-haspopup`,`dialog`),this._buttonEl.append(this._labelEl,this._sizeBoxEl),this._selectEl=document.createElement(`select`),this._selectEl.className=`font-button-chooser`,this._selectEl.addEventListener(`change`,()=>this._choose()),this._dockEl=document.createElement(`gtk-popover`),this._dockEl.classList.add(`font-button-popover`),this._dockEl.replaceChildren(this._selectEl),this._dockEl.anchor=this._buttonEl,this.replaceChildren(this._buttonEl,this._dockEl),this._buttonEl.addEventListener(`click`,()=>this.activate()),this._dockEl.subscribe(e=>{e||(this._pending=!1),this._renderSensitivity()}),this.hasAttribute(`dialog`)&&(this.dialog={});for(let e of[`font-desc`,`font-features`,`language`]){let t=this.getAttribute(e);t!==null&&(e===`font-desc`?this.fontDesc=t:e===`font-features`?this.fontFeatures=t:this.language=t)}this._render()}attributeChangedCallback(e){if(this._initialized)switch(e){case`font-desc`:{let e=this.getAttribute(`font-desc`);e!==null&&(this.fontDesc=e);return}case`font-features`:this.fontFeatures=this.getAttribute(`font-features`)??``;return;case`language`:this.language=this.getAttribute(`language`);return;case`dialog`:this.dialog=this.hasAttribute(`dialog`)?this._dialog??{}:null;return;case`disabled`:this._renderSensitivity();return;default:this._render()}}activate(){this.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0})),this._openChooser()}_openChooser(){this._dialog===null||this._pending||(this._pending=!0,this._renderSensitivity(),this._selectEl.replaceChildren(...this._options()),this._dockEl.popup())}_options(){let e=new Set;for(let t of document.fonts)t.family&&e.add(t.family);this._desc.family!==``&&e.add(this._desc.family);let t=[],n=new Set,add=e=>{let r=formatFontDescription(e);if(n.has(r))return;n.add(r);let i=document.createElement(`option`);i.value=r,i.textContent=r,t.push(i)};add(this._desc);for(let t of[...e].sort())for(let{weight:e,slant:n}of oi){let r={...this._desc,family:t,weight:e,slant:n};document.fonts.check(cssFontShorthand(r,!0))&&add(r)}return t}_choose(){let e=parseFontDescription(this._selectEl.value),t=this.level;t===`family`?this.fontDesc={...ri,family:e.family}:t===`face`?this.fontDesc={...e,size:this._desc.size,absolute:this._desc.absolute}:this.fontDesc=e,this._pending=!1,this._dockEl.popdown(),this._renderSensitivity()}_renderSensitivity(){let e=this._dialog!==null&&!this.hasAttribute(`disabled`);this._buttonEl.disabled=!e,this._buttonEl.classList.toggle(`disabled`,!e)}_render(){if(!this._initialized)return;let e=this.level,t=this._faceName(),n=[this._desc.family===``?`None`:this._desc.family];e!==`family`&&t!==``&&n.push(t),this._labelEl.textContent=n.join(` `),this._sizeBoxEl.hidden=e===`family`||e===`face`,this._sizeBoxEl.hidden||(this._sizeLabelEl.textContent=formatFontSize(this._desc.size,this._desc.absolute));let r=this._labelEl.style;if(this.useFont){let e=cssFontParts(this._desc,this.useSize);r.fontFamily=e.fontFamily,r.fontWeight=e.fontWeight,r.fontStyle=e.fontStyle,r.fontStretch=e.fontStretch,r.fontSize=e.fontSize,r.fontFeatureSettings=``;for(let e of cssFontFeatureTags(this._features))if(r.fontFeatureSettings=e,r.fontFeatureSettings!==``)break;this._labelEl.lang=this._language??this._dialog?.language??``}else r.fontFamily=``,r.fontWeight=``,r.fontStyle=``,r.fontStretch=``,r.fontSize=``,r.fontFeatureSettings=``,this._labelEl.lang=``;this._renderSensitivity()}_faceName(){let e=cssFontShorthand(this._desc,!0);if(this._desc.family===``||!document.fonts.check(e))return``;let t=[];return this._desc.slant===`italic`?t.push(`Italic`):this._desc.slant===`oblique`&&t.push(`Oblique`),this._desc.weight!==400&&t.push(this._desc.weight>=700?`Bold`:`Light`),this._desc.width===`condensed`?t.push(`Condensed`):this._desc.width===`expanded`&&t.push(`Expanded`),t.join(` `)}};customElements.define(`gtk-font-dialog-button`,GtkFontDialogButton);function normalizeLabelXalign(e){let t=Number.parseFloat(e??``);return Number.isFinite(t)?glibClamp(t,0,1):0}var GtkFrame=class extends HTMLElement{_mutations=null;static get observedAttributes(){return[`label`,`label-xalign`]}_labelEl=null;_writingLabel=!1;get label(){return this.getAttribute(`label`)}set label(e){e===null?this.removeAttribute(`label`):this.setAttribute(`label`,e)}get labelXalign(){return normalizeLabelXalign(this.getAttribute(`label-xalign`))}set labelXalign(e){this.setAttribute(`label-xalign`,String(e))}get labelWidget(){let e=this.querySelector(`[slot="label-widget"]`);return e===null?this._labelEl?.parentNode===this?this._labelEl:null:e}set labelWidget(e){let t=this.querySelector(`[slot="label-widget"]`);t!==null&&(t.removeAttribute(`slot`),t.remove()),e!==null&&(e.setAttribute(`slot`,`label-widget`),this.prepend(e),this._sync())}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this},{name:`label-widget`,into:this}]),this._mutations=new MutationObserver(()=>this._sync()),this._mutations.observe(this,{childList:!0}),this.setAttribute(`role`,`group`),this._sync()}disconnectedCallback(){this._mutations?.disconnect(),this._mutations=null}attributeChangedCallback(e,t,n){if(this._sync(),!this.isConnected)return;let r=e===`label-xalign`?String(normalizeLabelXalign(n)):n;r!==(e===`label-xalign`?String(normalizeLabelXalign(t)):t)&&this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:r}}))}_sync(){let e=this.querySelector(`[slot="label-widget"]`),t=this.getAttribute(`label`);e===null&&t!==null?(this._labelEl===null&&(this._labelEl=document.createElement(`gtk-label`),this._labelEl.addEventListener(`notify::label`,e=>{this._writingLabel&&e.stopPropagation()})),this._writingLabel=!0,this._labelEl.setAttribute(`label`,t),this._writingLabel=!1,this._labelEl.parentNode!==this&&this.prepend(this._labelEl)):this._labelEl?.parentNode===this&&this._labelEl.remove();let n=this.labelWidget;n!==null&&(n.classList.add(`adw-frame-label`),n.style.alignSelf=labelYalignAlignItems(this.labelXalign))}};customElements.define(`gtk-frame`,GtkFrame);const U=[`gl`,`gles`];function parseApis(e){let t=e.getAttribute(`allowed-apis`);if(t===null)return[...U];let n=t.split(/[\s,|]+/).filter(e=>U.includes(e));return U.filter(e=>n.includes(e))}function booleanAttribute$1(e,t,n){let r=e.getAttribute(t);return r===null?n:r!==`false`&&r!==`0`}__name(booleanAttribute$1,`booleanAttribute`);var GtkGLArea=class extends HTMLElement{_canvas;_messageEl=null;_initialized=!1;_context=null;_error=null;_needsResize=!1;_allowedApis=[...U];_needsRender=!0;_haveBuffers=!1;_width=0;_height=0;_scale=1;_resize=null;_frame=null;static get observedAttributes(){return[`auto-render`,`has-depth-buffer`,`has-stencil-buffer`,`allowed-apis`]}get autoRender(){return booleanAttribute$1(this,`auto-render`,!0)}set autoRender(e){this.autoRender!==!!e&&this._write(`auto-render`,String(!!e))}get hasDepthBuffer(){return booleanAttribute$1(this,`has-depth-buffer`,!1)}set hasDepthBuffer(e){this.hasDepthBuffer!==!!e&&this._write(`has-depth-buffer`,String(!!e))}get hasStencilBuffer(){return booleanAttribute$1(this,`has-stencil-buffer`,!1)}set hasStencilBuffer(e){this.hasStencilBuffer!==!!e&&this._write(`has-stencil-buffer`,String(!!e))}get allowedApis(){return[...this._allowedApis]}set allowedApis(e){if(this._context!==null){this._write(`allowed-apis`,this._allowedApis.join(` `));return}this._allowedApis=U.filter(t=>e.includes(t)),this._write(`allowed-apis`,this._allowedApis.join(` `))}_write(e,t){this.getAttribute(e)!==t&&this.setAttribute(e,t)}get api(){return this._context===null?`gl`:`gles`}get context(){return this._context}get error(){return this._error}setError(e){let t=e===null?null:typeof e==`string`?e:e.message;this._error!==t&&(this._error=t,this._renderMessage(),this._queueDraw())}makeCurrent(){return this._context}queueRender(){this._needsRender=!0,this._queueDraw()}connectedCallback(){if(this._initialized){this._observe();return}this._initialized=!0,this.hasAttribute(`allowed-apis`)&&(this._allowedApis=parseApis(this)),this._canvas=document.createElement(`canvas`),this._canvas.className=`adw-gl-area-canvas`,this.replaceChildren(this._canvas),this._observe()}disconnectedCallback(){this._resize?.disconnect(),this._resize=null,this._frame!==null&&cancelAnimationFrame(this._frame),this._frame=null}_queueDraw(){!this._initialized||this._frame!==null||(this._frame=requestAnimationFrame(()=>{this._frame=null,this._draw()}))}attributeChangedCallback(e){if(this._initialized){switch(e){case`auto-render`:this.autoRender&&this._queueDraw();break;case`has-depth-buffer`:case`has-stencil-buffer`:this._haveBuffers=!1;break;case`allowed-apis`:if(this._context!==null){this._write(`allowed-apis`,this._allowedApis.join(` `));return}this._allowedApis=parseApis(this);break;default:break}this._notify(e)}}_notify(e){let t=e===`allowed-apis`?this.allowedApis.join(` `):e===`auto-render`?this.autoRender:e===`has-depth-buffer`?this.hasDepthBuffer:this.hasStencilBuffer;this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:t}}))}_observe(){this._resize||(this._resize=new ResizeObserver(e=>{for(let t of e){let e=t.borderBoxSize?.[0],n=e?e.inlineSize:t.contentRect.width,r=e?e.blockSize:t.contentRect.height;n===this._width&&r===this._height||(this._width=n,this._height=r,this._needsResize=!0,this._queueDraw())}}),this._resize.observe(this))}_draw(){if(!this._canvas)return;let e=typeof globalThis>`u`?1:globalThis.devicePixelRatio||1;this._scale=e;let t=Math.round(this._width*e),n=Math.round(this._height*e);if(t===0||n===0)return;if(this._error!==null){this._renderMessage();return}let r=this._context??this._createContext();r!==null&&(this.makeCurrent(),this.attachBuffers(r),this.hasDepthBuffer?r.enable?.(r.DEPTH_TEST):r.disable?.(r.DEPTH_TEST),(this._needsRender||this.autoRender)&&(this._needsResize&&(this._needsResize=!1,this.dispatchEvent(new CustomEvent(`resize`,{bubbles:!0,detail:{width:t,height:n}}))),this.dispatchEvent(new CustomEvent(`render`,{bubbles:!0,detail:{context:r}}))),this._needsRender=!1)}attachBuffers(e=this._context){e!==null&&(this.hasStencilBuffer?e.enable?.(e.STENCIL_TEST):e.disable?.(e.STENCIL_TEST),this._haveBuffers=!0)}_createContext(){let e=this.allowedApis;if(e.length===0)return null;let t={context:null};if(this.dispatchEvent(new CustomEvent(`create-context`,{bubbles:!0,detail:t})),t.context!==null)return this._context=t.context,this._context;let n={preserveDrawingBuffer:!0,depth:this.hasDepthBuffer,stencil:this.hasStencilBuffer},r=e.includes(`gles`)?[`webgl2`,`webgl`]:[`webgl`];for(let e of r){let t=this._canvas.getContext(e,n);if(t!==null)return this._context=t,t}return null}_renderMessage(){if(this._error===null){this._messageEl?.remove(),this._messageEl=null;return}this._messageEl||(this._messageEl=document.createElement(`div`),this._messageEl.className=`adw-gl-area-error`,this.append(this._messageEl)),this._messageEl.textContent=this._error}get viewport(){return{width:Math.round(this._width*this._scale),height:Math.round(this._height*this._scale)}}get pixelScale(){return this._scale}};customElements.define(`gtk-gl-area`,GtkGLArea);function booleanAttribute(e,t,n){let r=e.getAttribute(t);return r===null?n:r!==`false`&&r!==`0`}var GtkGraphicsOffload=class extends HTMLElement{_childEl;_initialized=!1;static get observedAttributes(){return[`enabled`,`black-background`]}get child(){return this._childEl?.firstElementChild??null}get enabled(){return this.getAttribute(`enabled`)===`disabled`?`disabled`:`enabled`}set enabled(e){this.enabled!==e&&this.setAttribute(`enabled`,e)}get blackBackground(){return booleanAttribute(this,`black-background`,!1)}set blackBackground(e){this.blackBackground!==!!e&&this.setAttribute(`black-background`,String(!!e))}connectedCallback(){this._initialized||(this._initialized=!0,this._childEl=document.createElement(`div`),this._childEl.className=`adw-graphics-offload-child`,bindSlottedChildren(this,[{into:this._childEl}]).install(this._childEl),this.replaceChildren(this._childEl),this._render())}attributeChangedCallback(e){this._initialized&&((e===`enabled`||e===`black-background`)&&this._render(),this._notify(e))}_render(){let e=this.enabled!==`disabled`;this.style.willChange=e?`transform`:``,this.style.backgroundColor=this.blackBackground?`#000000`:``}_notify(e){let t=e===`enabled`?this.enabled:this.blackBackground;this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:t}}))}};customElements.define(`gtk-graphics-offload`,GtkGraphicsOffload);var GtkGrid=class extends HTMLElement{static get observedAttributes(){return[`column-spacing`,`row-spacing`,`column-homogeneous`,`row-homogeneous`,`orientation`]}get columnSpacing(){return normalizeBoxSpacing(this.getAttribute(`column-spacing`))}set columnSpacing(e){this.setAttribute(`column-spacing`,String(e))}get rowSpacing(){return normalizeBoxSpacing(this.getAttribute(`row-spacing`))}set rowSpacing(e){this.setAttribute(`row-spacing`,String(e))}get columnHomogeneous(){return this.hasAttribute(`column-homogeneous`)}set columnHomogeneous(e){this.toggleAttribute(`column-homogeneous`,!!e)}get rowHomogeneous(){return this.hasAttribute(`row-homogeneous`)}set rowHomogeneous(e){this.toggleAttribute(`row-homogeneous`,!!e)}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this.setAttribute(`orientation`,e)}connectedCallback(){this.setAttribute(`role`,`generic`),this._sync()}attributeChangedCallback(e,t,n){if(this._sync(),!this.isConnected)return;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){return e===`column-spacing`||e===`row-spacing`?normalizeBoxSpacing(t):e===`orientation`?normalizeBoxOrientation(t):t!==null}_sync(){this.style.rowGap=`${this.rowSpacing}px`,this.style.columnGap=`${this.columnSpacing}px`,this.style.gridAutoRows=this.rowHomogeneous?`1fr`:``,this.style.gridAutoColumns=this.columnHomogeneous?`1fr`:``,this.style.gridAutoFlow=this.orientation===`vertical`?`row`:`column`}};customElements.define(`gtk-grid`,GtkGrid);function cssPixels(e,t){let n=Number.parseFloat(e);return Number.isFinite(n)?n:t}var GtkGridView=class extends GtkListView{_observer=null;static get observedAttributes(){return[`model`,`selection-mode`,`single-click-activate`,`enable-rubberband`,`tab-behavior`,`orientation`,`min-columns`,`max-columns`]}get minColumns(){return this._columnBound(`min-columns`,1)}set minColumns(e){this.setAttribute(`min-columns`,String(e))}get maxColumns(){return this._columnBound(`max-columns`,7)}set maxColumns(e){this.setAttribute(`max-columns`,String(e))}connectedCallback(){super.connectedCallback(),this._observer===null&&(this._observer=new ResizeObserver(()=>this._applyColumns()),this._observer.observe(this),this._applyColumns())}disconnectedCallback(){this._observer?.disconnect(),this._observer=null}attributeChangedCallback(e){super.attributeChangedCallback(e),this._applyColumns()}get _viewClass(){return`adw-grid-view`}get _rowClass(){return`adw-grid-view-child`}_renderRows(){super._renderRows(),this._applyColumns()}_columnBound(e,t){let n=Number.parseInt(this.getAttribute(e)??``,10);return Number.isFinite(n)&&n>=1?n:t}_applyColumns(){let e=this._rows[0];if(e===void 0)return;let t=cssPixels(globalThis.getComputedStyle(e).minWidth,120),n=cssPixels(globalThis.getComputedStyle(this._listEl).columnGap,6),r=gridViewColumns(Math.round(this.getBoundingClientRect().width),t,n,this.minColumns,this.maxColumns);this._listEl.style.gridTemplateColumns=`repeat(${r}, 1fr)`}};customElements.define(`gtk-grid-view`,GtkGridView);var GtkHeaderBar=class extends HTMLElement{_initialized=!1;_handle;_box;_startBox;_endBox;_startControls=null;_endControls=null;_titleLabel=null;_centre=null;_centreObserver=null;static get observedAttributes(){return[`decoration-layout`,`show-title-buttons`]}get decorationLayout(){return this.getAttribute(`decoration-layout`)}set decorationLayout(e){e===null?this.removeAttribute(`decoration-layout`):this._write(`decoration-layout`,e)}get showTitleButtons(){return this.getAttribute(`show-title-buttons`)!==`false`}set showTitleButtons(e){this._write(`show-title-buttons`,String(e))}get titleWidget(){return this._centre}_write(e,t){this.getAttribute(e)!==t&&this.setAttribute(e,t)}connectedCallback(){if(this._initialized){this._followCentre();return}this._initialized=!0,this.setAttribute(`role`,`group`),this._startBox=document.createElement(`div`),this._startBox.className=`adw-gtk-header-bar-start`,this._endBox=document.createElement(`div`),this._endBox.className=`adw-gtk-header-bar-end`,this._box=document.createElement(`div`),this._box.className=`adw-gtk-header-bar-box`,this._box.append(this._startBox,this._endBox),this._handle=document.createElement(`div`),this._handle.className=`adw-gtk-header-bar-handle`,this._handle.appendChild(this._box),this._renderTitleButtons(),bindSlottedChildren(this,[{name:`start`,into:this._startBox},{name:`title`,into:this._box},{name:`title-widget`,into:this._box},{name:`end`,consume:e=>this._endBox.prepend(e)},{into:this._startBox}]).install(this._handle),this._followCentre()}disconnectedCallback(){this._centreObserver?.disconnect(),this._centreObserver=null}attributeChangedCallback(e){this._initialized&&(e===`show-title-buttons`?this._renderTitleButtons():this._bindDecorationLayout(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}})))}_property(e){return e===`show-title-buttons`?this.showTitleButtons:this.decorationLayout}_renderTitleButtons(){if(!this.showTitleButtons){this._startControls?.remove(),this._endControls?.remove(),this._startControls=null,this._endControls=null;return}this._startControls===null&&(this._startControls=document.createElement(`gtk-window-controls`),this._startControls.setAttribute(`side`,`start`),this._startBox.prepend(this._startControls),this._endControls=document.createElement(`gtk-window-controls`),this._endControls.setAttribute(`side`,`end`),this._endBox.appendChild(this._endControls)),this._bindDecorationLayout()}_bindDecorationLayout(){for(let e of[this._startControls,this._endControls]){if(e===null)continue;let t=this.decorationLayout;t===null?e.removeAttribute(`decoration-layout`):e.setAttribute(`decoration-layout`,t)}}_followCentre(){this._centreObserver?.disconnect(),this._centreObserver=new MutationObserver(()=>this._syncCentre()),this._centreObserver.observe(this._box,{childList:!0});let e=this.closest(`gtk-window, adw-window`);e!==null&&this._centreObserver.observe(e,{attributes:!0,attributeFilter:[`title`]}),this._syncCentre()}_centreChild(){for(let e of this._box.children)if(!(e===this._startBox||e===this._endBox||e===this._titleLabel)&&e instanceof HTMLElement)return e;return null}_syncCentre(){this._centre=this._centreChild(),this._centre===null?this._titleLabel===null?this._constructTitleLabel():this._updateTitle():this._dropTitleLabel()}_constructTitleLabel(){let e=document.createElement(`gtk-label`);e.className=`title adw-gtk-header-bar-title`,this._titleLabel=e,this._box.appendChild(e),this._updateTitle()}_dropTitleLabel(){this._titleLabel?.remove(),this._titleLabel=null}_updateTitle(){let e=this._titleLabel;if(e===null)return;let t=this.closest(`gtk-window, adw-window`)?.getAttribute(`title`)??document.title;t===``?e.removeAttribute(`label`):e.setAttribute(`label`,t)}};customElements.define(`gtk-header-bar`,GtkHeaderBar);var GtkLinkButton=class extends GtkButton{_wired=!1;static get observedAttributes(){return[...GtkButton.observedAttributes,`uri`,`visited`]}get uri(){return this.getAttribute(`uri`)??``}set uri(e){this.setAttribute(`uri`,e)}get visited(){return this.hasAttribute(`visited`)}set visited(e){this.toggleAttribute(`visited`,!!e)}connectedCallback(){super.connectedCallback(),!this._wired&&(this._wired=!0,this.button.addEventListener(`click`,()=>this._activateLink()))}attributeChangedCallback(e){e===`uri`&&this.isConnected&&(this.visited=!1),super.attributeChangedCallback(),e===`visited`&&this.isConnected&&this.dispatchEvent(new CustomEvent(`notify::visited`,{bubbles:!0,detail:{visited:this.visited}}))}_activateLink(){let e=new CustomEvent(`activate-link`,{bubbles:!0,cancelable:!0});if(this.dispatchEvent(e),e.defaultPrevented)return;let{uri:t}=this;t!==``&&(this.launch(t),this.visited=!0)}launch(e){globalThis.open(e,`_blank`,`noopener`)}decorate(e){e.classList.add(`link`),e.classList.toggle(`visited`,this.visited);let t=(this.getAttribute(`label`)??``).trim();(this.getAttribute(`tooltip`)??this.getAttribute(`tooltip-text`))===null&&t!==``&&this.uri!==``&&this.uri!==t&&(e.title=this.uri)}};customElements.define(`gtk-link-button`,GtkLinkButton);const si=[`clip`,`ellipsize-start`,`ellipsize-middle`,`ellipsize-end`];function normalizeInscriptionOverflow(e){return si.includes(e)?e:`clip`}function normalizeInscriptionWrapMode(e){return Mt.includes(e)?e:`word-char`}function normalizeAlignment(e,t){let n=typeof e==`number`?e:Number.parseFloat(String(e??``));return Number.isFinite(n)?Math.min(1,Math.max(0,n)):t}function normalizeCount(e){let t=typeof e==`number`?e:Number.parseInt(String(e??``),10);return Number.isFinite(t)?Math.max(0,Math.trunc(t)):0}var GtkInscription=class extends HTMLElement{_initialized=!1;static get observedAttributes(){return[`markup`,`min-chars`,`min-lines`,`nat-chars`,`nat-lines`,`text`,`text-overflow`,`wrap-mode`,`xalign`,`yalign`]}get text(){return this.getAttribute(`text`)??``}set text(e){this._write(`text`,e)}get markup(){return this.getAttribute(`markup`)??``}set markup(e){this._write(`markup`,e)}get minChars(){let e=this.getAttribute(`min-chars`);return e===null?3:normalizeCount(e)}set minChars(e){this._write(`min-chars`,String(e))}get natChars(){return normalizeCount(this.getAttribute(`nat-chars`))}set natChars(e){this._write(`nat-chars`,String(e))}get minLines(){let e=this.getAttribute(`min-lines`);return e===null?1:normalizeCount(e)}set minLines(e){this._write(`min-lines`,String(e))}get natLines(){return normalizeCount(this.getAttribute(`nat-lines`))}set natLines(e){this._write(`nat-lines`,String(e))}get textOverflow(){return normalizeInscriptionOverflow(this.getAttribute(`text-overflow`))}set textOverflow(e){this._write(`text-overflow`,e)}get wrapMode(){return normalizeInscriptionWrapMode(this.getAttribute(`wrap-mode`))}set wrapMode(e){this._write(`wrap-mode`,e)}get xalign(){return normalizeAlignment(this.getAttribute(`xalign`),0)}set xalign(e){this._write(`xalign`,String(e))}get yalign(){return normalizeAlignment(this.getAttribute(`yalign`),.5)}set yalign(e){this._write(`yalign`,String(e))}_write(e,t){this.getAttribute(e)!==t&&this.setAttribute(e,t)}connectedCallback(){if(this._initialized){this._render();return}this._initialized=!0,this._render()}attributeChangedCallback(e){this._initialized&&(this._render(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}})))}_property(e){switch(e){case`text`:return this.text;case`markup`:return this.markup;case`min-chars`:return this.minChars;case`nat-chars`:return this.natChars;case`min-lines`:return this.minLines;case`nat-lines`:return this.natLines;case`text-overflow`:return this.textOverflow;case`wrap-mode`:return this.wrapMode;case`xalign`:return this.xalign;default:return this.yalign}}_render(){let e=this.text,t=this.markup;this.textContent=e||!t?e:labelDisplayText(t,!0,!1);let n=this.minChars,r=this.natChars;if(n===0&&r===0)this.style.setProperty(`--gtk-inscription-min-ch`,`auto`),this.style.setProperty(`--gtk-inscription-width`,`auto`);else{let{minCh:e,maxCh:t}=labelWidthCharsExtent(n,r);this.style.setProperty(`--gtk-inscription-min-ch`,`${e}ch`),this.style.setProperty(`--gtk-inscription-width`,`${t}ch`)}let i=this.minLines,a=this.natLines;this.style.setProperty(`--gtk-inscription-min-lh`,i===0&&a===0?`auto`:`${i}lh`),this.style.setProperty(`--gtk-inscription-height`,i===0&&a===0?`auto`:`${Math.max(i,a)}lh`),this.style.setProperty(`--gtk-inscription-xalign`,String(this.xalign)),this.style.setProperty(`--gtk-inscription-align-items`,labelYalignAlignItems(this.yalign));let o=this.textOverflow;this.style.setProperty(`--gtk-inscription-text-overflow`,labelEllipsizeOverflowValue(o===`clip`?`none`:`end`)),this.classList.toggle(`clip`,o===`clip`),this.classList.toggle(`ellipsized`,o!==`clip`)}};customElements.define(`gtk-inscription`,GtkInscription);const ci=[[`low`,.25],[`high`,.75],[`full`,1]];function levelClassFor(e,t){for(let n=0;n<e.length;n++){let[r,i]=e[n];if(t>i)continue;let a=n===0?null:e[n-1][1];if(a===null||a<t)return r}return null}function numberAttribute(e,t,n){let r=Number.parseFloat(e.getAttribute(t)??``);return Number.isFinite(r)?r:n}var GtkLevelBar=class extends HTMLElement{_trough;_initialized=!1;_offsets=ci.map(e=>[...e]);static get observedAttributes(){return[`value`,`min-value`,`max-value`,`mode`,`inverted`,`orientation`,`disabled`]}get value(){return numberAttribute(this,`value`,0)}set value(e){this._write(`value`,String(e))}get minValue(){return numberAttribute(this,`min-value`,0)}set minValue(e){this._write(`min-value`,String(e))}get maxValue(){return numberAttribute(this,`max-value`,1)}set maxValue(e){this._write(`max-value`,String(e))}get mode(){return this.getAttribute(`mode`)===`discrete`?`discrete`:`continuous`}set mode(e){this._write(`mode`,e)}get inverted(){return this.hasAttribute(`inverted`)}set inverted(e){this.toggleAttribute(`inverted`,!!e)}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this._write(`orientation`,e)}_write(e,t){this.getAttribute(e)!==t&&this.setAttribute(e,t)}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){this.toggleAttribute(`disabled`,!!e)}addOffsetValue(e,t){if(t<this.minValue||t>this.maxValue)return;let n=this._offsets.findIndex(([t])=>t===e);n!==-1&&this._offsets[n][1]===t||(n!==-1&&this._offsets.splice(n,1),this._offsets.push([e,t]),this._offsets.sort((e,t)=>e[1]-t[1]),this._render(),this.dispatchEvent(new CustomEvent(`offset-changed`,{bubbles:!0,detail:{name:e}})))}removeOffsetValue(e){let t=this._offsets.findIndex(([t])=>t===e);t!==-1&&(this._offsets.splice(t,1),this._render())}offsetValue(e){return this._offsets.find(([t])=>t===e)?.[1]??null}connectedCallback(){if(this._initialized){this._render();return}this._initialized=!0,this._trough=document.createElement(`span`),this._trough.className=`adw-level-bar-trough`,this.replaceChildren(this._trough),this.setAttribute(`role`,`meter`),this._render()}attributeChangedCallback(e){if(!(!this._initialized||e===`disabled`)){if(e===`min-value`&&this.value<this.minValue){this._write(`value`,String(this.minValue)),this._notify(e);return}if(e===`max-value`&&(this._clampOffsets(),this.value>this.maxValue)){this._write(`value`,String(this.maxValue)),this._notify(e);return}this._render(),this._notify(e)}}_notify(e){this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}}))}_clampOffsets(){for(let e=0;e<this._offsets.length;e++){let[t,n]=this._offsets[e];n<this.minValue?this._offsets[e]=[t,this.minValue]:n>this.maxValue&&(this._offsets[e]=[t,this.maxValue])}}_property(e){switch(e){case`value`:return this.value;case`min-value`:return this.minValue;case`max-value`:return this.maxValue;case`mode`:return this.mode;case`inverted`:return this.inverted;default:return this.orientation}}_render(){if(!this._trough)return;let e=this.mode===`discrete`,t=this.orientation===`vertical`;this.classList.toggle(`continuous`,!e),this.classList.toggle(`discrete`,e),this.classList.toggle(`vertical`,t),this.classList.toggle(`horizontal`,!t);let n=this.minValue,r=this.maxValue,i=this.value,a=e?Math.max(1,Math.round(r)-Math.round(n)):1,o=levelClassFor(this._offsets,i);if(this._trough.replaceChildren(),e){let e=Math.min(a,Math.max(0,Math.round(i)-Math.round(n)));for(let t=0;t<a;t++){let n=this.inverted?t>=a-e:t<e;this._trough.append(this._block(n?`filled`:`empty`,n?o:null))}}else{let e=this._block(`empty`,null),t=this._block(`filled`,o);t.style.setProperty(`--level-fraction`,String(r>n?(i-n)/(r-n):0)),t.hidden=i===0,this._trough.append(e,t)}this.setAttribute(`aria-valuemin`,String(n)),this.setAttribute(`aria-valuemax`,String(r)),this.setAttribute(`aria-valuenow`,String(i))}_block(e,t){let n=document.createElement(`span`);return n.className=`adw-level-bar-block ${e}`,e===`filled`&&t&&n.classList.add(t),n}};customElements.define(`gtk-level-bar`,GtkLevelBar);var GtkListBoxRow=class extends HTMLElement{_contentsEl;_activation;_initialized=!1;static get observedAttributes(){return[`activatable`,`selectable`]}get activatable(){return this.getAttribute(`activatable`)!==`false`}set activatable(e){this.setAttribute(`activatable`,String(!!e))}get selectable(){return this.getAttribute(`selectable`)!==`false`}set selectable(e){this.setAttribute(`selectable`,String(!!e))}get index(){return this.parentElement?[...this.parentElement.children].indexOf(this):-1}get selected(){return this.classList.contains(`selected`)}get child(){return this._contentsEl.firstElementChild}connectedCallback(){this._initialized||(this._initialized=!0,this._contentsEl=document.createElement(`div`),this._contentsEl.className=`adw-list-box-row-contents`,bindSlottedChildren(this,[{into:this._contentsEl}]).install(this._contentsEl),this.setAttribute(`role`,`listitem`),this._claimed?this._syncActivation():this.syncClasses(!0))}claim(){this._claimed=!0}release(){this._claimed=!1,this.syncClasses(!1)}_canSelect=!0;_claimed=!1;attributeChangedCallback(){this._initialized&&this.syncClasses(this._canSelect)}syncClasses(e){this._canSelect=e,this.classList.toggle(`activatable`,this.activatable||this.selectable&&e),this._syncActivation()}_syncActivation(){this._activation??=attachRowActivation({row:this,activatable:()=>this.classList.contains(`activatable`),activate:()=>this.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0}))}),this._claimed||this._activation.sync()}};customElements.define(`gtk-list-box-row`,GtkListBoxRow);const li=new Set([`all`,`item`,`cell`]);function normalizeListTabBehavior(e){return e!=null&&li.has(e)?e:`all`}var GtkListBox=class extends HTMLElement{_rows=[];_selection=[];_anchor=-1;_initialized=!1;static get observedAttributes(){return[`selection-mode`,`activate-on-single-click`,`accept-unpaired-release`,`show-separators`,`tab-behavior`]}get selectionMode(){return normalizeBoxSelectionMode(this.getAttribute(`selection-mode`))}set selectionMode(e){this.setAttribute(`selection-mode`,e)}get activateOnSingleClick(){return this.getAttribute(`activate-on-single-click`)!==`false`}set activateOnSingleClick(e){this.setAttribute(`activate-on-single-click`,String(!!e))}get acceptUnpairedRelease(){return this.hasAttribute(`accept-unpaired-release`)}set acceptUnpairedRelease(e){this.toggleAttribute(`accept-unpaired-release`,!!e)}get showSeparators(){return this.hasAttribute(`show-separators`)}set showSeparators(e){this.toggleAttribute(`show-separators`,!!e)}get tabBehavior(){return normalizeListTabBehavior(this.getAttribute(`tab-behavior`))}set tabBehavior(e){this.setAttribute(`tab-behavior`,e)}get rows(){return this._rows}get selectedRows(){return[...this._selection]}set selectedRows(e){for(let t of typeof e==`number`?[e]:e??[])this.selectRow(this._rows[t]??null)}get selectedRowElements(){return this._selection.map(e=>this._rows[e]).filter(e=>e!==void 0)}connectedCallback(){this._initialized||(this._initialized=!0,this.addEventListener(`click`,e=>this._onClick(e)),this.addEventListener(`dblclick`,e=>this._onDoubleClick(e)),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),attachRovingFocus({host:this,orientation:`vertical`,items:()=>this._rows,select:e=>this._updateSelection(e,{})}),new MutationObserver(()=>this._collectRows()).observe(this,{childList:!0}),this._applyAttributes(),this._collectRows())}attributeChangedCallback(e){this._initialized&&(this._applyAttributes(),e===`selection-mode`&&this._syncRows(),e===`tab-behavior`&&this._syncTabIndexes())}selectRow(e){let t=e===null?null:this._rows.indexOf(e),n=listBoxSelectRow(this._selection,this._anchor,t,this._rows.length,this.selectionMode,e===null||e.selectable);same(n.selection,this._selection)&&n.anchor===this._anchor||(this._selection=n.selection,this._anchor=n.anchor,this._emitSelection(e))}unselectRow(e){let t=listBoxUnselectRow(this._selection,this._anchor,this._rows.indexOf(e),this._rows.length,this.selectionMode);same(t.selection,this._selection)||(this._selection=t.selection,this._emitSelection(null))}selectAll(){let e=listBoxSelectAll(this._rows.length,this.selectionMode);e!==null&&(this._selection=e,this._anchor=e.length>0?e[0]:-1,this._emitSelection(this.selectedRowElements[0]??null))}unselectAll(){listBoxUnselectAll(this._selection,this.selectionMode)!==null&&(this._selection=[],this._anchor=-1,this._emitSelection(null))}_applyAttributes(){this.classList.toggle(`separators`,this.showSeparators);let e=this.selectionMode!==`none`;this.setAttribute(`role`,e?`listbox`:`list`),this.selectionMode===`multiple`?this.setAttribute(`aria-multiselectable`,`true`):this.removeAttribute(`aria-multiselectable`)}_collectRows(){let e=[...this.querySelectorAll(`:scope > gtk-list-box-row`)];if(!(e.length===this._rows.length&&e.every((e,t)=>e===this._rows[t]))){for(let t of this._rows)e.includes(t)||t.release();for(let t of e)t.claim();this._rows=e,this._selection=this._selection.filter(e=>e<this._rows.length),this._anchor>=this._rows.length&&(this._anchor=-1),this._syncRows()}}_syncRows(){let e=this.selectionMode!==`none`,t=new Set(this._selection);this._rows.forEach((n,r)=>{n.syncClasses(e),n.selectable&&e?n.setAttribute(`aria-selected`,String(t.has(r))):n.removeAttribute(`aria-selected`)}),this._syncTabIndexes()}_syncTabIndexes(){let e=this.tabBehavior!==`all`,t=this._selection.length>0?this._selection[0]:0;this._rows.forEach((n,r)=>{n.tabIndex=e?r===t?0:-1:n.classList.contains(`activatable`)?0:-1})}_onClick(e){let t=this._rowAt(e.target);t===null&&!this.acceptUnpairedRelease||(t!==null&&this._updateSelection(t,{modify:e.ctrlKey||e.metaKey,extend:e.shiftKey}),!(e.detail<(this.activateOnSingleClick?1:2))&&t!==null&&this._activate(t))}_onDoubleClick(e){if(this.activateOnSingleClick)return;let t=this._rowAt(e.target);t!==null&&this._activate(t)}_onKeyDown(e){if(!e.ctrlKey||e.altKey||e.metaKey||e.key!==` `)return;let t=this._rowAt(e.target);t!==null&&(e.preventDefault(),this._updateSelection(t,{modify:!0}))}_rowAt(e){if(!(e instanceof Element))return null;let t=e.closest(`gtk-list-box-row`);return this.contains(t)?t:null}_updateSelection(e,t){let n=listBoxSelect(this._selection,this._anchor,this._rows.indexOf(e),this._rows.length,this.selectionMode,t,e.selectable);same(n.selection,this._selection)||(this._selection=n.selection,this._anchor=n.anchor,this._emitSelection(n.selection.includes(this._rows.indexOf(e))?e:null))}_activate(e){e.activatable&&(this.dispatchEvent(new CustomEvent(`row-activated`,{bubbles:!0,detail:{row:e}})),e.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0})))}_emitSelection(e){this._syncRows(),this.dispatchEvent(new CustomEvent(`selected-rows-changed`,{bubbles:!0})),this.dispatchEvent(new CustomEvent(`row-selected`,{bubbles:!0,detail:{row:e}})),this.dispatchEvent(new CustomEvent(`notify::selected-rows`,{bubbles:!0,detail:{selectedRows:[...this._selection]}}))}};function same(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}customElements.define(`gtk-list-box`,GtkListBox);function volumeIconFor(e){let t=Math.min(1,Math.max(0,Number.isFinite(e)?e:1));return t===0?`audio-volume-muted-symbolic`:t===1?`audio-volume-high-symbolic`:Math.trunc((t-0)/.5)+2===2?`audio-volume-low-symbolic`:`audio-volume-medium-symbolic`}function mediaTimeToString(e,t=!1,n=!1){let r=Math.trunc(e);t&&r++;let i=r%60;r-=i;let a=r%3600/60;r-=a*60;let o=r/3600;return o>0||n?t?`-${o}:${String(a).padStart(2,`0`)}:${String(i).padStart(2,`0`)}`:`${o}:${String(a).padStart(2,`0`)}:${String(i).padStart(2,`0`)}`:t?`-${a}:${String(i).padStart(2,`0`)}`:`${a}:${String(i).padStart(2,`0`)}`}var GtkMediaControls=class extends HTMLElement{_initialized=!1;_playButton;_timeLabel;_seekScale;_durationLabel;_volumeButton;_volumeIcon;_volumePopover;_volumeScale;_media=null;_seeking=!1;_volume=1;connectedCallback(){if(this._initialized){this._adoptMedia();return}this._initialized=!0;let e=document.createElement(`div`);e.className=`adw-media-controls-box`,this._playButton=document.createElement(`button`),this._playButton.className=`adw-media-controls-button adw-flat`,this._playButton.type=`button`,this._playButton.title=`Play`,this._playButton.setAttribute(`aria-label`,`Play`),this._playButton.addEventListener(`click`,()=>this._togglePlay());let t=document.createElement(`div`);t.className=`adw-media-controls-time-box`,this._timeLabel=document.createElement(`span`),this._timeLabel.className=`adw-media-controls-time-label`,this._seekScale=document.createElement(`input`),this._seekScale.className=`adw-media-controls-seek-scale`,this._seekScale.type=`range`,this._seekScale.min=`0`,this._seekScale.max=`10`,this._seekScale.step=`1`,this._seekScale.value=`0`,this._seekScale.setAttribute(`aria-label`,`Position`),this._seekScale.addEventListener(`input`,()=>this._onSeekInput()),this._durationLabel=document.createElement(`span`),this._durationLabel.className=`adw-media-controls-duration-label`,t.append(this._timeLabel,this._seekScale,this._durationLabel),this._volumeButton=document.createElement(`button`),this._volumeButton.className=`adw-media-controls-button adw-media-controls-volume-button adw-flat`,this._volumeButton.type=`button`,this._volumeButton.setAttribute(`aria-label`,`Volume`),this._volumeButton.addEventListener(`click`,()=>this._toggleVolumePopover()),this._volumeIcon=document.createElement(`span`),this._volumeIcon.className=`adw-media-controls-volume-icon`,this._volumePopover=document.createElement(`gtk-popover`),this._volumePopover.className=`adw-media-controls-volume-popover`,this._volumeScale=document.createElement(`input`),this._volumeScale.className=`adw-media-controls-volume-scale`,this._volumeScale.type=`range`,this._volumeScale.min=`0`,this._volumeScale.max=`1`,this._volumeScale.step=`0.1`,this._volumeScale.value=`1`,this._volumeScale.setAttribute(`aria-label`,`Volume`),this._volumeScale.addEventListener(`input`,()=>this._onVolumeInput()),this._volumePopover.append(this._volumeScale),this._volumePopover.addEventListener(`click`,e=>e.stopPropagation()),this._volumeButton.append(this._volumeIcon,this._volumePopover),e.append(this._playButton,t,this._volumeButton),this.replaceChildren(e),this._renderVolume(),this._adoptMedia()}get media(){return this._media}get timestamp(){return this._media?.currentTime??0}get duration(){let e=this._media?.duration??0;return Number.isFinite(e)?e:0}get volume(){return this._volume}set volume(e){this._setVolume(e)}get sensitive(){return this._media!=null}_togglePlay(){let e=this._media??null;e!==null&&(e.paused?e.play().catch(()=>{}):e.pause())}_onSeekInput(){this._seeking=!0,this._media&&(this._media.currentTime=Number.parseFloat(this._seekScale.value)),this._seeking=!1,this._updateTimestamp()}_onVolumeInput(){this._setVolume(Number.parseFloat(this._volumeScale.value))}_setVolume(e){let t=Math.min(1,Math.max(0,Number.isFinite(e)?e:1));this._volume=t,this._media&&(this._media.volume=t),this._renderVolume()}_renderVolume(){this._volumeScale&&(this._volumeScale.value=String(this._volume));let e=document.createElement(`gtk-image`);e.setAttribute(`icon-name`,volumeIconFor(this._volume)),this._volumeIcon?.replaceChildren(e)}_toggleVolumePopover(){this._volumePopover&&(this._volumePopover.hidden=!this._volumePopover.hidden)}_adoptMedia(){let e=this.getAttribute(`for`),t=e?this.ownerDocument.getElementById(e):null,n=(t instanceof HTMLVideoElement?t:null)??this.closest(`gtk-video`)?.querySelector(`video`)??null;if(n===this._media){this._render();return}if(this._media&&this._detachMedia(),this._media=n,n){this._mediaListeners=[[`timeupdate`,()=>this._updateTimestamp()],[`durationchange`,()=>this._updateDuration()],[`play`,()=>this._updatePlaying(!0)],[`pause`,()=>this._updatePlaying(!1)],[`seeked`,()=>this._updateTimestamp()]];for(let[e,t]of this._mediaListeners)n.addEventListener(e,t);this._setVolume(n.volume)}this._render()}_mediaListeners=[];_detachMedia(){if(this._media)for(let[e,t]of this._mediaListeners)this._media.removeEventListener(e,t);this._mediaListeners=[]}_updateTimestamp(){if(!this._initialized)return;let e=this.timestamp,t=this.duration;!this._seeking&&t>0&&(this._seekScale.value=String(e)),this._timeLabel.textContent=mediaTimeToString(e),this._durationLabel.textContent=mediaTimeToString(t>e?t-e:0,!0),this._durationLabel.hidden=t<=0}_updateDuration(){this._initialized&&(this._seekScale.max=String(this.duration>0?this.duration:10),this._updateTimestamp())}_updatePlaying(e){if(!this._initialized)return;let t=document.createElement(`gtk-image`);t.setAttribute(`icon-name`,e?`media-playback-pause-symbolic`:`media-playback-start-symbolic`),this._playButton.replaceChildren(t),this._playButton.title=e?`Pause`:`Play`,this._playButton.setAttribute(`aria-label`,e?`Pause`:`Play`)}_render(){if(!this._initialized)return;let e=this._media??null,t=e!==null;this.classList.toggle(`insensitive`,!t),this._playButton.disabled=!t,this._seekScale.disabled=!t,this._volumeButton.disabled=!t,this._volumeScale.disabled=!t,this._updateDuration(),this._updateTimestamp(),this._updatePlaying(t&&!e.paused)}};customElements.define(`gtk-media-controls`,GtkMediaControls);const ui={down:`bottom`,up:`top`,left:`start`,right:`end`};var GtkMenuButton=class extends HTMLElement{_buttonEl;_popoverEl;_model=[];_actions=null;_menuTitle=``;_initialized=!1;_menuView;static get observedAttributes(){return[`icon-name`,`menu-title`,`menu-model`,`disabled`,`flat`,`circular`,`direction`]}get active(){return this._popoverEl?.open??!1}get menuModel(){return this._model}set menuModel(e){this._model=this._acceptMenu(e),this._initialized&&this._renderMenu()}_acceptMenu(e,t=!0){let n=normalizeMenuModel(e);if(t)return assertMenuRenderable(n,E),n;let r=menuRefusals(n,E);if(r.length===0)return n;console.error(`${E.name} cannot render this menu, so it has none:`);for(let e of r)console.error(` [${e.path.join(`.`)}] ${e.message}`);return[]}get actions(){return this._actions}set actions(e){this._actions=e??null,this._menuView?.setActions(this._actions),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(`gtk-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._menuView=new PopoverMenuView(this._popoverEl,`adw-menu-button`,e=>{let t=menuItemAt(this._model,e);t!==null&&(this._popoverEl.popdown(),this._buttonEl.focus(),activateElementMenuItem(this,t),this.dispatchEvent(new CustomEvent(`menu-item-activated`,{bubbles:!0,detail:{id:t.id??t.label,label:t.label,path:[...e]}})))}),this._menuView.setActions(this._actions),this._buttonEl.addEventListener(`click`,()=>{this.hasAttribute(`disabled`)||!this._popoverEl.open&&this._model.length===0||(this._popoverEl.open=!this._popoverEl.open)}),this._model.length===0&&(this._model=this._parseMenuAttr()),!this.hasAttribute(`flat`)&&!this.hasAttribute(`circular`)&&this.setAttribute(`flat`,``),this._render())}attributeChangedCallback(e){if(!(!this._initialized||!this._buttonEl)){if(e===`menu-model`){this._model=this._parseMenuAttr(),this._renderMenu();return}this._render()}}_parseMenuAttr(){return this._acceptMenu(parseMenuModel(this.getAttribute(`menu-model`)),!1)}_onPopoverToggled(e){this.classList.toggle(`active`,e),this._buttonEl.setAttribute(`aria-expanded`,String(e)),e?(this._refreshActions(),this._menuView.focusableRows[0]?.focus()):this._menuView.reset()}_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=ui[$t(this.direction)],this._buttonEl.replaceChildren(),this._buttonEl.appendChild(createGtkImage(this.getAttribute(`icon-name`)??`open-menu`,`adw-menu-button-icon`)),this._buttonEl.setAttribute(`aria-label`,this.getAttribute(`menu-title`)||`Menu`),this._renderMenu()}_refreshActions(){this._menuView.setActions(this._actions??menuActionsOfElement(this,this._model)),this._menuView.render()}_renderMenu(){this._menuView.setMenuModel(this._model),this._menuView.setTitle(this.getAttribute(`menu-title`)??this._menuTitle),this._menuView.render(),this._model.length===0&&this._popoverEl.popdown()}};customElements.define(`gtk-menu-button`,GtkMenuButton);const di=[`top`,`bottom`,`left`,`right`],fi=[`tab-label`,`menu-label`,`tab-fill`,`tab-expand`,`reorderable`,`detachable`];var GtkNotebook=class extends HTMLElement{_current=null;_initialized=!1;_initializedChildren=new WeakSet;_header;_tabs;_observer=null;_tabNodes=[];_menu=null;static get observedAttributes(){return[`page`,`tab-pos`,`show-tabs`,`show-border`,`scrollable`,`enable-popup`,`group-name`]}get page(){return this._current?this._pages().indexOf(this._current):-1}set page(e){this.setCurrentPage(e)}get tabPos(){let e=this.getAttribute(`tab-pos`);return e!==null&&di.includes(e)?e:`top`}set tabPos(e){this._write(`tab-pos`,e)}get showTabs(){return this._flag(`show-tabs`,!0)}set showTabs(e){this._write(`show-tabs`,e?``:`false`)}get showBorder(){return this._flag(`show-border`,!0)}set showBorder(e){this._write(`show-border`,e?``:`false`)}get scrollable(){return this._flag(`scrollable`,!1)}set scrollable(e){this._write(`scrollable`,e?``:`false`)}get enablePopup(){return this._flag(`enable-popup`,!1)}set enablePopup(e){this._write(`enable-popup`,e?``:`false`)}get groupName(){return this.getAttribute(`group-name`)}set groupName(e){this._write(`group-name`,e)}get currentPage(){return this._current}get nPages(){return this._pages().length}getNthPage(e){let t=this._pages();return t[e<0?t.length-1:e]??null}pageNum(e){return this._pages().indexOf(e)}getPage(e){return this._pages().includes(e)?this._page(e):null}setPage(e){let t=this._pages().indexOf(e);return t===-1?!1:this.setCurrentPage(t)}nextPage(){return this._searchPage(1)}prevPage(){return this._searchPage(-1)}setCurrentPage(e){let t=this._pages(),n=t[e<0?t.length-1:e];return n?this._switchTo(n):!1}appendPage(e,t){return this.insertPage(e,-1,t)}insertPage(e,t,n){let r=t<0?this._pages().length:t;return n!=null&&e.setAttribute(`tab-label`,n),this._initChild(e),this.insertBefore(e,this._pages()[r]??null),this.dispatchEvent(new CustomEvent(`page-added`,{bubbles:!0,detail:{position:r,nPages:this._pages().length}})),this._current||this._switchTo(e),this._render(),r}removePage(e){let t=this._pages().indexOf(e);return t===-1?!1:(e===this._current&&(this._current=null),e.remove(),this.dispatchEvent(new CustomEvent(`page-removed`,{bubbles:!0,detail:{position:t,nPages:this._pages().length}})),this._current||this._takeOver(t),this._render(),!0)}refresh(){this._render()}connectedCallback(){if(this._initialized)this._observer=new MutationObserver(e=>this._onMutations(e));else{this._initialized=!0,this._header=document.createElement(`div`),this._header.className=`adw-notebook-header`,this._tabs=document.createElement(`div`),this._tabs.className=`adw-notebook-tabs`,this._tabs.setAttribute(`role`,`tablist`),this._header.appendChild(this._tabs);for(let e of this._pages())this._initChild(e)}this._header.parentNode!==this&&this.prepend(this._header),this._observer?.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[...fi,`hidden`]}),this._current||this._switchTo(this._firstVisible()),this.addEventListener(`contextmenu`,this._onContextMenu),this._render()}disconnectedCallback(){this._observer?.disconnect(),this._observer=null,this.removeEventListener(`contextmenu`,this._onContextMenu),this._closeMenu()}attributeChangedCallback(e){if(this._initialized){if(e===`page`){let t=this.getAttribute(e);t!==null&&this.setCurrentPage(Number.parseInt(t,10));return}this._render(),this._notify(e)}}_switchTo(e){let t=this._pages().indexOf(e);if(t===-1||!this._page(e).visible||this._current===e)return!1;let n=new CustomEvent(`switch-page`,{bubbles:!0,cancelable:!0,detail:{page:t,child:e}});return this.dispatchEvent(n),n.defaultPrevented?!1:(this._current=e,this._render(),this._notify(`page`),!0)}_notify(e){this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}}))}_property(e){switch(e){case`page`:return this.page;case`tab-pos`:return this.tabPos;case`show-tabs`:return this.showTabs;case`show-border`:return this.showBorder;case`scrollable`:return this.scrollable;case`enable-popup`:return this.enablePopup;default:return this.groupName}}_write(e,t){t===null?this.removeAttribute(e):this.getAttribute(e)!==t&&this.setAttribute(e,t)}_flag(e,t){let n=this.getAttribute(e);return n===null?t:n!==`false`}_pages(){return Array.from(this.children).filter(e=>e!==this._header)}_page(e){return{tabLabel:e.getAttribute(`tab-label`),menuLabel:e.getAttribute(`menu-label`),tabFill:e.getAttribute(`tab-fill`)!==`false`,tabExpand:e.hasAttribute(`tab-expand`),reorderable:e.hasAttribute(`reorderable`),detachable:e.hasAttribute(`detachable`),visible:!e.hasAttribute(`hidden`),child:e}}_initChild(e){this._initializedChildren.has(e)||(this._initializedChildren.add(e),e.classList.add(`adw-notebook-page`))}_firstVisible(){return this._pages().find(e=>this._page(e).visible)??null}_searchPage(e){let t=this._pages(),n=this._current?t.indexOf(this._current):-1;for(let r=n+e;r>=0&&r<t.length;r+=e)if(this._switchTo(t[r]))return!0;return!1}_takeOver(e){let t=this._pages();for(let n of[...t.slice(e),...t.slice(0,e)])if(this._switchTo(n))return!0;return!1}_onMutations(e){let t=new Set(this._pages()),n=e.filter(e=>e.target===this||t.has(e.target));if(n.length===0)return;let r=0,i=0,a=[];for(let e of n){if(e.type===`childList`){for(let t of Array.from(e.removedNodes))t===this._current&&(this._current=null),i+=1;for(let t of Array.from(e.addedNodes))!(t instanceof HTMLElement)||t===this._header||(this._initChild(t),r+=1);continue}let t=e.attributeName;if(t===`hidden`){(!this._current||!this._page(this._current).visible)&&this._switchTo(this._firstVisible());continue}t&&fi.includes(t)&&a.push(e.target)}(r>0||i>0)&&this.dispatchEvent(new CustomEvent(`items-changed`,{bubbles:!0,detail:{added:r,removed:i}}));for(let e of a)this.dispatchEvent(new CustomEvent(`page-updated`,{bubbles:!0,detail:{child:e}}));this._render()}_effectiveTabPos(){let e=this.tabPos;return this.getAttribute(`dir`)===`rtl`?e===`left`?`right`:e===`right`?`left`:e:e}_render(){if(!this._initialized)return;let e=this._pages();e.length!==this._tabNodes.length&&(this._tabs.replaceChildren(),this._tabNodes=e.map(()=>this._buildTab()),this._tabs.append(...this._tabNodes));let t=this._current?e.indexOf(this._current):-1,n=0;e.forEach((e,r)=>{let i=this._tabNodes[r];if(!i)return;let a=this._page(e),o=r===t;a.visible&&(n+=1);let s=a.tabLabel??`Page ${n}`;i.textContent!==s&&(i.textContent=s),i.classList.toggle(`active`,o),i.classList.toggle(`expand`,a.tabExpand),i.classList.toggle(`fill`,a.tabFill),i.classList.toggle(`reorderable`,a.reorderable);let c=!a.visible;i.hidden!==c&&(i.hidden=c),i.setAttribute(`aria-selected`,String(o)),e.classList.toggle(`visible-page`,o),o?e.removeAttribute(`aria-hidden`):e.setAttribute(`aria-hidden`,`true`)});let r=!this.showTabs;this._header.hidden!==r&&(this._header.hidden=r);let i=this._effectiveTabPos();this.getAttribute(`data-tab-pos`)!==i&&this.setAttribute(`data-tab-pos`,i),this.classList.toggle(`frame`,this.showBorder)}_buildTab(){let e=document.createElement(`button`);return e.type=`button`,e.className=`adw-notebook-tab`,e.setAttribute(`role`,`tab`),e.addEventListener(`click`,()=>{let t=this._tabNodes.findIndex(t=>t===e);if(t===-1)return;let n=this._pages()[t];n&&this._switchTo(n)}),e}_onContextMenu=e=>{if(!this.enablePopup)return;e.preventDefault(),this._closeMenu();let t=document.createElement(`div`);t.className=`adw-notebook-menu`,t.setAttribute(`role`,`listbox`);let n=0;for(let e of this._pages()){let r=this._page(e);r.visible&&(n+=1);let i=document.createElement(`button`);i.type=`button`,i.className=`adw-notebook-menu-item`,i.setAttribute(`role`,`option`),i.textContent=r.menuLabel??r.tabLabel??`Page ${n}`,i.hidden=!r.visible,i.setAttribute(`aria-selected`,String(e===this._current)),i.addEventListener(`click`,()=>{this._switchTo(e),this._closeMenu()}),t.appendChild(i)}this.appendChild(t),this._menu=t};_closeMenu(){this._menu?.remove(),this._menu=null}};customElements.define(`gtk-notebook`,GtkNotebook);const pi=[`left`,`right`,`top`,`bottom`];var GtkOverlay=class extends HTMLElement{_childEl;_layerEl;_initialized=!1;_resize=null;_mutations=null;static get observedAttributes(){return[]}get child(){return this._childEl?.firstElementChild??null}get overlayLayer(){return this._layerEl}connectedCallback(){if(this._initialized){this._observe();return}this._initialized=!0,this._childEl=document.createElement(`div`),this._childEl.className=`adw-overlay-child`,this._layerEl=document.createElement(`div`),this._layerEl.className=`adw-overlay-layer`,bindSlottedChildren(this,[{into:this._childEl},{name:`overlay`,into:this._layerEl}]).install(this._childEl,this._layerEl),this._observe()}disconnectedCallback(){this._resize?.disconnect(),this._resize=null,this._mutations?.disconnect(),this._mutations=null}_observe(){this._resize||(this._resize=new ResizeObserver(()=>this._syncEdgeClasses()),this._resize.observe(this._layerEl),this._mutations=new MutationObserver(()=>this._syncEdgeClasses()),this._mutations.observe(this._layerEl,{childList:!0,attributes:!0,subtree:!0}),this._syncEdgeClasses())}_syncEdgeClasses(){let e=this.matches(`:dir(rtl)`);for(let t of this._layerEl.children){let n=t.getAttribute(`halign`),r=t.getAttribute(`valign`),i={left:e?n===`end`:n===`start`,right:e?n===`start`:n===`end`,top:r===`start`,bottom:r===`end`};for(let e of pi)t.classList.toggle(e,i[e])}}};customElements.define(`gtk-overlay`,GtkOverlay);const W=25.4,G=[{name:`na_letter`,displayName:`US Letter`,width:8.5*W,height:11*W},{name:`na_legal`,displayName:`US Legal`,width:8.5*W,height:14*W},{name:`iso_a4`,displayName:`A4`,width:210,height:297},{name:`iso_a5`,displayName:`A5`,width:148,height:210},{name:`roc_16k`,displayName:`ROC 16k`,width:7.75*W,height:10.75*W},{name:`iso_b5`,displayName:`B5`,width:176,height:250},{name:`jis_b5`,displayName:`JB5`,width:182,height:257},{name:`na_number-10`,displayName:`#10 Envelope`,width:4.125*W,height:9.5*W},{name:`iso_dl`,displayName:`DL Envelope`,width:110,height:220},{name:`jpn_chou3`,displayName:`Choukei 3 Envelope`,width:120,height:235},{name:`na_ledger`,displayName:`Tabloid`,width:11*W,height:17*W},{name:`iso_a3`,displayName:`A3`,width:297,height:420}],mi=new Set([`na_letter`,`na_legal`,`iso_a4`]);function doubleToString(e,t){let n=t===`inch`?e.toFixed(2):e.toFixed(1);return n.includes(`.`)&&(n=n.replace(/0+$/,``),n.endsWith(`.`)&&(n=n.slice(0,-1))),n}function defaultMargins(e){return{top:.25*W,bottom:(mi.has(e.name)?.56:.25)*W,left:.25*W,right:.25*W}}function defaultPageSetup(){let e=G.find(e=>e.name===`iso_a4`);return{paperSize:e.name,orientation:`portrait`,margins:defaultMargins(e)}}function paperSizeByName(e){return G.find(t=>t.name===e)??null}function paperSizeOf(e){return paperSizeByName(e.paperSize)??G[2]}function pageSetupEquals(e,t){return e.paperSize===t.paperSize&&e.margins.top===t.margins.top&&e.margins.bottom===t.margins.bottom&&e.margins.left===t.margins.left&&e.margins.right===t.margins.right}function orientedSize(e,t=`mm`){let n=paperSizeOf(e),r=e.orientation===`landscape`||e.orientation===`reverse-landscape`,i=r?n.height:n.width,a=r?n.width:n.height;return t===`mm`?{width:i,height:a}:{width:i/W,height:a/W}}function unitLabel(e){return e===`mm`?`mm`:`inch`}function paperSizeLabel(e,t=`mm`){let{width:n,height:r}=orientedSize(e,t);return`${doubleToString(n,t)} × ${doubleToString(r,t)} ${unitLabel(t)}`}function paperMarginsTooltip(e,t=`mm`){let inUnit=e=>t===`mm`?e:e/W,shown=e=>`${doubleToString(inUnit(e),t)} ${unitLabel(t)}`,{margins:n}=e;return[`Margins:`,` Left: ${shown(n.left)}`,` Right: ${shown(n.right)}`,` Top: ${shown(n.top)}`,` Bottom: ${shown(n.bottom)}`].join(`
8
- `)}const hi={name:`Any Printer`,location:`For portable documents`},gi=[[`portrait`,`Portrait`],[`reverse-portrait`,`Reverse portrait`],[`landscape`,`Landscape`],[`reverse-landscape`,`Reverse landscape`]];var GtkPageSetupUnixDialog=class extends AdwDialog{_built=!1;static get observedAttributes(){return[...AdwDialog.observedAttributes]}_printerEl;_paperEl;_sizeLabelEl;_radios=new Map;_printers=[];_setups=[];_lastSetup=null;_printSettings=null;_unit=`mm`;get unit(){return this._unit}set unit(e){this._unit=e,this._built&&this._renderSetup()}get printers(){return this._printers.map(e=>({...e}))}set printers(e){this._printers=e.map(e=>({...e})),this._built&&this._renderSetup()}get pageSetup(){return{...this._current(),orientation:this._orientation()}}set pageSetup(e){let t=this._setups.findIndex(t=>pageSetupEquals(t,e));t<0?(this._setups.push(e),this._paperEl.selected=this._setups.length-1):this._paperEl.selected!==t&&(this._paperEl.selected=t),this._setOrientation(e.orientation),this._built&&this._renderSetup()}get printSettings(){return this._printSettings}set printSettings(e){this._printSettings=e;let t=e?.[`format-for-printer`];if(t===void 0)return;let n=this._printerRows().findIndex(e=>e.name===t);n>=0&&(this._printerEl.selected=n)}connectedCallback(){if(this._built){super.connectedCallback();return}super.connectedCallback(),this.hasAttribute(`title`)||this.setAttribute(`title`,`Page Setup`),this._fillPaperSizes();let e=[...this.contentArea.childNodes];this.contentArea.replaceChildren(this._build());for(let t of e)this.contentArea.appendChild(t);this._renderSetup();let t=this._setups.findIndex(e=>e.paperSize===defaultPageSetup().paperSize);t>=0&&this._paperEl.selected!==t&&(this._paperEl.selected=t,this._renderSetup()),this._built=!0}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),!(!this._built||t===n)&&e!==`title`&&this._renderSetup()}_build(){let e=document.createElement(`div`);e.className=`adw-page-setup-grid`,this._printerEl=this._dropDown(`printer`,`_Format for:`),this._printerEl.addEventListener(`notify::selected`,()=>this._printerChanged()),e.append(this._label(`_Format for:`),this._printerEl),this._paperEl=this._dropDown(`paper`,`_Paper size:`),this._paperEl.addEventListener(`notify::selected`,()=>this._paperChanged()),e.append(this._label(`_Paper size:`),this._paperEl),this._sizeLabelEl=document.createElement(`div`),this._sizeLabelEl.className=`adw-page-setup-size-label`,this._sizeLabelEl.setAttribute(`aria-live`,`polite`),e.append(this._sizeLabelEl),e.append(this._label(`_Orientation:`));for(let[t,n]of gi){let r=document.createElement(`adw-radio`);r.className=`adw-page-setup-orientation`,r.setAttribute(`label`,n),r.setAttribute(`name`,`adw-page-setup-orientation`),r.setAttribute(`value`,t),r.addEventListener(`notify::checked`,()=>this._orientationChanged()),this._radios.set(t,r),e.appendChild(r)}return e.appendChild(this._actions()),e}_dropDown(e,t){let n=document.createElement(`gtk-drop-down`);return n.className=`adw-page-setup-${e}`,n.setAttribute(`aria-label`,t.replace(`_`,``)),n}_label(e){let t=document.createElement(`div`);return t.className=`adw-page-setup-label`,t.textContent=e.replace(`_`,``),t}_actions(){let e=document.createElement(`div`);e.className=`adw-page-setup-actions`;let t=document.createElement(`button`);t.type=`button`,t.className=`adw-page-setup-cancel`,t.textContent=`Cancel`,t.addEventListener(`click`,()=>this._respond(-6));let n=document.createElement(`button`);return n.type=`button`,n.className=`adw-page-setup-apply suggested-action`,n.textContent=`Apply`,n.addEventListener(`click`,()=>this._respond(-5)),e.append(t,n),e}_respond(e){this.dispatchEvent(new CustomEvent(`response`,{bubbles:!0,detail:{responseId:e}})),this.close()}_printerRows(){return[hi,...this._printers]}_fillPaperSizes(){this._setups=G.map(e=>({paperSize:e.name,orientation:`portrait`,margins:defaultMargins(e)}))}_current(){return this._setups[this._paperEl.selected]??defaultPageSetup()}_orientation(){for(let[e,t]of this._radios)if(t.checked)return e;return`portrait`}_setOrientation(e){let t=this._radios.get(e);t!==void 0&&(t.checked=!0)}_renderSetup(){let e=this._printerRows();this._printerEl.setAttribute(`model`,JSON.stringify(e.map(e=>e.name))),this._printerEl.selected>=e.length&&(this._printerEl.selected=0);let t=[...this._setups.map(e=>paperSizeOf(e).displayName),`Manage Custom Sizes…`];this._paperEl.setAttribute(`model`,JSON.stringify(t)),this._paperEl.selected>=t.length&&(this._paperEl.selected=0);let n=this._current();this._sizeLabelEl.textContent=paperSizeLabel(n,this._unit),this._sizeLabelEl.title=paperMarginsTooltip(n,this._unit)}_printerChanged(){let e=this._printerRows()[this._printerEl.selected];(e===void 0||e.name===hi.name)&&this._fillPaperSizes(),this._renderSetup(),this._printSettings!==null&&(this._printSettings={"format-for-printer":e?.name})}_paperChanged(){let e=this._paperEl.selected;if(e>=this._setups.length){let e=this._lastSetup??defaultPageSetup();this._setups.push(e),this._paperEl.selected=this._setups.length-1,this._renderSetup();return}this._lastSetup=this._setups[e]??null,this._renderSetup()}_orientationChanged(){this._built&&(this._setups[this._paperEl.selected]={...this._current(),orientation:this._orientation()},this._renderSetup())}};customElements.define(`gtk-page-setup-unix-dialog`,GtkPageSetupUnixDialog);function computePanedPosition(e){let{allocation:t,startRequest:n,endRequest:r,resizeStart:i,resizeEnd:a,shrinkStart:o,shrinkEnd:s}=e,c=o?0:n,l=t;s||(l=Math.max(1,l-r)),l=Math.max(c,l);let u;return u=e.positionSet?e.lastAllocation>0?i&&!a?e.startChildSize+t-e.lastAllocation:!i&&a?e.startChildSize:t*(e.startChildSize/e.lastAllocation)+.5:e.startChildSize:i&&!a?Math.max(0,t-r):!i&&a?n:n+r===0?t*.5+.5:t*(n/(n+r))+.5,u=Math.trunc(u),{min:c,max:l,position:glibClamp(u,c,l)}}var GtkPaned=class extends HTMLElement{_startEl;_handleEl;_endEl;_initialized=!1;_position=-1;_positionSet=!1;_minPosition=0;_maxPosition=2**53-1;_lastAllocation=0;_dragPos=0;_dragging=!1;_resize=null;static get observedAttributes(){return[`orientation`,`position`,`position-set`,`resize-start-child`,`resize-end-child`,`shrink-start-child`,`shrink-end-child`,`wide-handle`]}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this.setAttribute(`orientation`,e)}get position(){return this._position}set position(e){this.setPosition(e)}get positionSet(){return this._positionSet}get minPosition(){return this._minPosition}get maxPosition(){return this._maxPosition}get wideHandle(){return this.hasAttribute(`wide-handle`)}set wideHandle(e){this.toggleAttribute(`wide-handle`,!!e)}get startChild(){return this._startEl?.firstElementChild??null}get endChild(){return this._endEl?.firstElementChild??null}connectedCallback(){if(this._initialized){this._observe();return}this._initialized=!0,this.setAttribute(`role`,`group`),this._startEl=document.createElement(`div`),this._startEl.className=`adw-paned-child`,this._handleEl=document.createElement(`div`),this._handleEl.className=`adw-paned-handle separator`,this._handleEl.setAttribute(`role`,`separator`),this._handleEl.tabIndex=0,this._endEl=document.createElement(`div`),this._endEl.className=`adw-paned-child`,bindSlottedChildren(this,[{into:this._startEl},{name:`start`,into:this._startEl},{name:`end`,into:this._endEl}],()=>this._observe()).install(this._startEl,this._handleEl,this._endEl),this._handleEl.addEventListener(`pointerdown`,this._onPointerDown),this._handleEl.addEventListener(`keydown`,this._onKeyDown);let e=Number.parseFloat(this.getAttribute(`position`)??``);Number.isFinite(e)&&this.setPosition(e),this._observe(),this._layout()}disconnectedCallback(){this._dragging=!1,this._resize?.disconnect(),this._resize=null}attributeChangedCallback(e){if(this._initialized){if(e===`position`){let e=Number.parseFloat(this.getAttribute(`position`)??``);Number.isFinite(e)&&this.setPosition(e);return}e!==`position-set`&&(this._layout(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}})))}}_property(e){switch(e){case`orientation`:return this.orientation;case`resize-start-child`:return this.getAttribute(`resize-start-child`)!==`false`;case`resize-end-child`:return this.getAttribute(`resize-end-child`)!==`false`;case`shrink-start-child`:return this.getAttribute(`shrink-start-child`)!==`false`;case`shrink-end-child`:return this.getAttribute(`shrink-end-child`)!==`false`;case`wide-handle`:return this.wideHandle;default:return this.getAttribute(e)}}_observe(){this._resize||(this._resize=new ResizeObserver(()=>this._layout()),this._resize.observe(this));for(let e of[this._startEl,this._endEl]){let t=e.firstElementChild;t&&this._resize.observe(t)}}setPosition(e){if(Number.isFinite(e)){if(e<0){this._positionSet&&(this._positionSet=!1,this._notify(`position-set`,{positionSet:!1})),this._position=-1,this._layout();return}this._positionSet||(this._positionSet=!0,this._notify(`position-set`,{positionSet:!0})),this._position!==e&&(this._position=e,this._notify(`position`,{position:e}),this._layout())}}_layout(){if(!this._startEl)return;let e=this.orientation===`horizontal`,t=this._handleEl.getBoundingClientRect(),n=e?t.width:t.height,r=Math.max(1,(e?this.clientWidth:this.clientHeight)-n),i=computePanedPosition({allocation:r,startRequest:this._sizeRequest(this._startEl,e),endRequest:this._sizeRequest(this._endEl,e),resizeStart:this.getAttribute(`resize-start-child`)!==`false`,resizeEnd:this.getAttribute(`resize-end-child`)!==`false`,shrinkStart:this.getAttribute(`shrink-start-child`)!==`false`,shrinkEnd:this.getAttribute(`shrink-end-child`)!==`false`,positionSet:this._positionSet,startChildSize:this._position<0?0:this._position,lastAllocation:this._lastAllocation}),a=Math.floor(i.position);a!==this._position&&(this._position=a,this._notify(`position`,{position:a})),i.min!==this._minPosition&&(this._minPosition=i.min,this._notify(`min-position`,{minPosition:i.min})),i.max!==this._maxPosition&&(this._maxPosition=i.max,this._notify(`max-position`,{maxPosition:i.max})),this._lastAllocation=r,this._startEl.style.flexBasis=`${Math.max(1,a)}px`,this._startEl.style.flexGrow=`0`,this._endEl.style.flexGrow=this.getAttribute(`resize-end-child`)===`false`?`0`:`1`,this._applyMinimum(this._startEl,`shrink-start-child`,e),this._applyMinimum(this._endEl,`shrink-end-child`,e);let o=a!==0,s=a!==r;this._startEl.hidden=!o,this._endEl.hidden=!s,this._handleEl.hidden=!o||!s,this.classList.toggle(`horizontal`,e),this.classList.toggle(`vertical`,!e),this._handleEl.classList.toggle(`wide`,this.wideHandle),this._handleEl.setAttribute(`aria-orientation`,this.orientation),this._handleEl.setAttribute(`aria-valuemin`,`0`),this._handleEl.setAttribute(`aria-valuemax`,String(e?this.clientWidth:this.clientHeight)),this._handleEl.setAttribute(`aria-valuenow`,String(a))}_sizeRequest(e,t){let n=e.style.flexGrow,r=e.style.flexShrink,i=e.style.flexBasis;e.style.flex=`none`;let a=t?e.offsetWidth:e.offsetHeight;return e.style.flexGrow=n,e.style.flexShrink=r,e.style.flexBasis=i,a}_applyMinimum(e,t,n){let r=this.getAttribute(t)!==`false`;e.style.minWidth=n&&r?`0`:``,e.style.minHeight=n?``:r?`0`:``}_notify(e,t){this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:t}))}get _isRtl(){return this.orientation===`horizontal`&&this.matches(`:dir(rtl)`)}_onPointerDown=e=>{if(e.button!==0||this._handleEl.hidden)return;this._dragging=!0,this._handleEl.setPointerCapture(e.pointerId);let t=this.orientation===`horizontal`,n=this._handleEl.getBoundingClientRect(),r=t?e.clientX:e.clientY,i=t?n.left:n.top;this._dragPos=r-i-(this.wideHandle?0:6),this._handleEl.addEventListener(`pointermove`,this._onPointerMove),this._handleEl.addEventListener(`pointerup`,this._onPointerUp),this._handleEl.addEventListener(`pointercancel`,this._onPointerUp)};_onPointerMove=e=>{if(!this._dragging)return;let t=this.orientation===`horizontal`,n=(t?e.clientX:e.clientY)-this._dragPos,r=t?this._handleEl.offsetWidth:this._handleEl.offsetHeight,i=this._isRtl?(t?this.clientWidth:this.clientHeight)-n-r:n;this.setPosition(glibClamp(Math.round(i),this._minPosition,this._maxPosition))};_onPointerUp=e=>{this._dragging&&(this._dragging=!1,this._handleEl.hasPointerCapture(e.pointerId)&&this._handleEl.releasePointerCapture(e.pointerId),this._handleEl.removeEventListener(`pointermove`,this._onPointerMove),this._handleEl.removeEventListener(`pointerup`,this._onPointerUp),this._handleEl.removeEventListener(`pointercancel`,this._onPointerUp))};_onKeyDown=e=>{if(e.altKey||e.metaKey||e.shiftKey)return;if(e.key===`Escape`){this.dispatchEvent(new CustomEvent(`cancel-position`,{bubbles:!0,detail:{}}));return}if(e.key===`Enter`||e.key===` `){this.dispatchEvent(new CustomEvent(`accept-position`,{bubbles:!0,detail:{}}));return}let t=0,n=null;switch(e.key){case`ArrowLeft`:t=e.ctrlKey?-75:-1;break;case`ArrowRight`:t=e.ctrlKey?75:1;break;case`ArrowUp`:t=e.ctrlKey?-75:-1;break;case`ArrowDown`:t=e.ctrlKey?75:1;break;case`PageUp`:t=-75;break;case`PageDown`:t=75;break;case`Home`:n=`start`;break;case`End`:n=`end`;break;default:return}e.preventDefault();let r;n===`start`?r=this._minPosition:n===`end`?r=this._maxPosition:(this._isRtl&&(t=-t),r=this._position+t),this.setPosition(glibClamp(r,this._minPosition,this._maxPosition))}};customElements.define(`gtk-paned`,GtkPaned);var GtkPasswordEntry=class extends GtkEntry{_entry=new EntryRowState;_password=new PasswordEntryRowState(this._entry);_toggle;_peekIcon;_capsLock;static get observedAttributes(){return[...GtkEntry.observedAttributes,`show-peek-icon`]}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)}connectedCallback(){super.connectedCallback(),this._input.type=`password`,this._input.autocomplete=`new-password`,this._capsLock=document.createElement(`span`),this._capsLock.className=`adw-password-entry-caps-lock`,this._capsLock.textContent=`⇪`,this._capsLock.setAttribute(`role`,`alert`),this._toggle=document.createElement(`button`),this._toggle.type=`button`,this._toggle.className=`adw-button flat circular icon-only adw-password-entry-peek`,this._peekIcon=createGtkImage(null,`adw-password-entry-peek-icon`),this._toggle.append(this._peekIcon),this._toggle.addEventListener(`click`,()=>this._password.togglePeek()),this._toggle.addEventListener(`mousedown`,e=>e.preventDefault());let readCapsLock=e=>this._password.setCapsLockOn(e.getModifierState(`CapsLock`));this._input.addEventListener(`keydown`,readCapsLock),this._input.addEventListener(`keyup`,readCapsLock),this._input.addEventListener(`focus`,()=>{this._entry.setEditing(!0),this._passwordChanged()}),this._input.addEventListener(`blur`,()=>{this._entry.setEditing(!1),this._passwordChanged()}),this.replaceChildren(this._capsLock,this._input,this._toggle),this._toggle.hidden=!this.hasAttribute(`show-peek-icon`),this._applyPassword(this._password.state),this._password.subscribe(e=>{this._applyPassword(e),this.dispatchEvent(new CustomEvent(`notify::revealed`,{bubbles:!0,detail:{revealed:e.revealed}}))})}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),e===`show-peek-icon`&&this._toggle&&(this._toggle.hidden=n===null)}_passwordChanged(){this._applyPassword(this._password.state)}_applyPassword(e){this._input.type=e.revealed?`text`:`password`,this._peekIcon.dataset.iconName=e.peekIconName,this._peekIcon.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`),this._capsLock.dataset.iconName=e.indicatorIconName,this._capsLock.title=e.indicatorTooltip,this._capsLock.setAttribute(`aria-label`,e.indicatorTooltip),this._capsLock.hidden=!this._entry.state.indicatorVisible}};customElements.define(`gtk-password-entry`,GtkPasswordEntry);const _i=[`fill`,`contain`,`cover`,`scale-down`];function normalizePictureContentFit(e){return _i.includes(e)?e:`contain`}var GtkPicture=class extends HTMLElement{_initialized=!1;static get observedAttributes(){return[`alternative-text`,`can-shrink`,`content-fit`,`isolate-contents`,`keep-aspect-ratio`]}get alternativeText(){return this.getAttribute(`alternative-text`)??``}set alternativeText(e){this._write(`alternative-text`,e)}get canShrink(){return!this.hasAttribute(`can-shrink`)||this.getAttribute(`can-shrink`)!==`false`}set canShrink(e){this._toggle(`can-shrink`,e,!0)}get contentFit(){return normalizePictureContentFit(this.getAttribute(`content-fit`))}set contentFit(e){this._write(`content-fit`,e)}get isolateContents(){return!this.hasAttribute(`isolate-contents`)||this.getAttribute(`isolate-contents`)!==`false`}set isolateContents(e){this._toggle(`isolate-contents`,e,!0)}get keepAspectRatio(){return this.contentFit!==`fill`}set keepAspectRatio(e){this.contentFit=e?`contain`:`fill`}_write(e,t){this.getAttribute(e)!==t&&this.setAttribute(e,t)}_toggle(e,t,n){let r=t?``:`false`;if(n){t?this.removeAttribute(e):this._write(e,r);return}this._write(e,r)}connectedCallback(){if(this._initialized){this._render();return}this._initialized=!0,this.setAttribute(`role`,`img`),this._render()}attributeChangedCallback(e,t,n){this._initialized&&(this._render(),e===`content-fit`&&(t===`fill`||n===`fill`)&&this.dispatchEvent(new CustomEvent(`notify::keep-aspect-ratio`,{bubbles:!0,detail:{"keep-aspect-ratio":this.keepAspectRatio}})),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}})))}_property(e){switch(e){case`alternative-text`:return this.alternativeText;case`can-shrink`:return this.canShrink;case`isolate-contents`:return this.isolateContents;case`keep-aspect-ratio`:return this.keepAspectRatio;default:return this.contentFit}}_render(){this.style.setProperty(`--gtk-picture-content-fit`,this.contentFit),this.classList.toggle(`can-shrink`,this.canShrink),this.classList.toggle(`isolated`,this.isolateContents),this.alternativeText?this.setAttribute(`aria-label`,this.alternativeText):this.removeAttribute(`aria-label`)}};customElements.define(`gtk-picture`,GtkPicture);const vi=`main`;var GtkPopoverMenu=class extends GtkPopover{_model=[];_actions=null;_menuView;_menuInitialized=!1;static get observedAttributes(){return[...GtkPopover.observedAttributes,`menu-model`,`menu-title`,`visible-submenu`]}get menuModel(){return this._model}set menuModel(e){this._model=normalizeMenuModel(e),assertMenuRenderable(this._model,E),this._menuInitialized&&this._renderMenu()}get actions(){return this._actions}set actions(e){this._actions=e??null,this._menuView?.setActions(this._actions),this._menuInitialized&&this._renderMenu()}get menuTitle(){return this.getAttribute(`menu-title`)??``}set menuTitle(e){this.setAttribute(`menu-title`,e??``)}get visibleSubmenu(){let e=this._openPageLabel();return e===null?vi:e}set visibleSubmenu(e){this.openSubmenu(e)}connectedCallback(){super.connectedCallback(),!this._menuInitialized&&(this._menuInitialized=!0,this.classList.add(`adw-popover-menu`),this.setAttribute(`role`,`menu`),this.setAttribute(`menu`,``),this._menuView=new PopoverMenuView(this,`adw-popover-menu`,e=>this._activate(e)),this._menuView.setActions(this._actions),this._model.length===0&&(this._model=this._parseMenuAttr()),this._renderMenu(),this.subscribe(e=>{e?(this._menuView.setActions(this._actions??menuActionsOfElement(this,this._model)),this._menuView.render(),this._menuView.focusableRows[0]?.focus()):this._menuView.reset()}))}attributeChangedCallback(e,t,n){if(super.attributeChangedCallback(e,t,n),this._menuInitialized){if(e===`menu-model`){this._model=this._parseMenuAttr(),this._renderMenu();return}if(e===`menu-title`){this._menuView.setTitle(this.menuTitle),this._menuView.render();return}e===`visible-submenu`&&this._navigate(n??vi)}}openSubmenu(e){this._navigate(e)}_navigate(e){let t=this.visibleSubmenu;if(!this._showPage(e))return;let n=this.visibleSubmenu;this._reflectSubmenu(),n!==t&&this.dispatchEvent(new CustomEvent(`notify::visible-submenu`,{bubbles:!0,detail:{visibleSubmenu:n}}))}_showPage(e){if(e===vi||e.length===0)this._menuView.reset();else{let t=this._findSubmenu(e);if(t===null)return!1;this._menuView.setMenuModel(this._model),this._menuView.showPage(t)}return this._menuView.render(),!0}closeSubmenus(){this.openSubmenu(vi)}_openPageLabel(){let e=this._menuView.page;if(e.length===0)return null;let t=menuNodeAt(this._model,e);return t!==null&&t.kind!==`item`?t.label:null}_findSubmenu(e){let walk=(t,n)=>{for(let[r,i]of t.entries()){if(i.kind===`item`)continue;let t=[...n,r];if(i.label===e)return t;let a=walk(i.items,t);if(a!==null)return a}return null};return walk(this._model,[])}_reflectSubmenu(){let e=this.visibleSubmenu;this.getAttribute(`visible-submenu`)!==e&&this.setAttribute(`visible-submenu`,e)}_activate(e){let t=menuItemAt(this._model,e);this.popdown(),this.anchor?.focus(),t!==null&&(activateElementMenuItem(this,t),this.dispatchEvent(new CustomEvent(`menu-item-activated`,{bubbles:!0,detail:{id:t.id??t.label,label:t.label,path:[...e]}})))}_renderMenu(){this._menuView.setMenuModel(this._model),this._menuView.setTitle(this.menuTitle),this._menuView.render(),this._model.length===0&&this.popdown()}_parseMenuAttr(){let e=normalizeMenuModel(parseMenuModel(this.getAttribute(`menu-model`))),t=menuRefusals(e,E);if(t.length===0)return e;console.error(`${E.name} cannot render this menu, so it has none:`);for(let e of t)console.error(` [${e.path.join(`.`)}] ${e.message}`);return[]}};customElements.define(`gtk-popover-menu`,GtkPopoverMenu);var GtkPopoverBin=class extends HTMLElement{_model=[];_popover=null;_actions=null;_initialized=!1;_longPressTimer=null;static get observedAttributes(){return[`menu-model`,`handle-input`]}get menuModel(){return this._model}set menuModel(e){this._model=normalizeMenuModel(e),assertMenuRenderable(this._model,E),this._adoptPopover(this._buildPopover()),this._notifyModel()}get popoverElement(){return this._popover}set popoverElement(e){this._model=[],this._adoptPopover(e),this._notifyModel()}get handleInput(){return this.hasAttribute(`handle-input`)}set handleInput(e){this.toggleAttribute(`handle-input`,!!e)}get actions(){return this._actions}set actions(e){this._actions=e??null,this._popover!==null&&(this._popover.actions=this._actions)}connectedCallback(){this._initialized||(this._initialized=!0,this.classList.add(`adw-popover-bin`),this.addEventListener(`contextmenu`,e=>this._onContextMenu(e)),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),this._wireGestures(),this._model.length===0&&(this._model=this._parseMenuAttr()),this._model.length>0&&this._adoptPopover(this._buildPopover()))}disconnectedCallback(){this._cancelLongPress()}attributeChangedCallback(e){if(this._initialized){if(e===`handle-input`){this.handleInput||this._cancelLongPress();return}e===`menu-model`&&(this._model=this._parseMenuAttr(),this._adoptPopover(this._model.length>0?this._buildPopover():null),this._notifyModel())}}popup(){this.dispatchEvent(new CustomEvent(`menu.popup`,{bubbles:!0}));let e=this._popover;e!==null&&(e.open=!0)}popdown(){this._popover?.popdown()}get childElement(){let e=this.firstElementChild;return e===null||e===this._popover?null:e}_wireGestures(){this.addEventListener(`pointerdown`,e=>{!this.handleInput||this._popover===null||(this._cancelLongPress(),e.pointerType===`touch`&&(this._longPressTimer=setTimeout(()=>{this._longPressTimer=null,this._popupAt(e)},500)))}),this.addEventListener(`pointerup`,()=>this._cancelLongPress()),this.addEventListener(`pointercancel`,()=>this._cancelLongPress())}_cancelLongPress(){this._longPressTimer!==null&&(clearTimeout(this._longPressTimer),this._longPressTimer=null)}_onContextMenu(e){!this.handleInput||this._popover===null||(e.preventDefault(),this._popupAt(e))}_popupAt(e){let t=this._popover;t!==null&&(t.open=!0)}_onKeyDown(e){e.key!==`ContextMenu`&&e.key!==`F10`||e.shiftKey||this._popover!==null&&(e.preventDefault(),this.popup())}_buildPopover(){if(this._model.length===0)return null;let e=document.createElement(`gtk-popover-menu`);return e.setAttribute(`position`,`bottom`),e.setAttribute(`align`,`start`),e.menuModel=this._model,e.actions=this._actions,e.anchor=this,e}_adoptPopover(e){let t=this._popover;t!==null&&t!==e&&(t.popdown(),t.remove()),this._popover=e;let n=this.childElement;if(e===null){n?.classList.remove(`has-open-popup`);return}e.subscribe(e=>{n?.classList.toggle(`has-open-popup`,e)}),this.appendChild(e)}_notifyModel(){this.dispatchEvent(new CustomEvent(`notify::menu-model`,{bubbles:!0,detail:{menuModel:this._model,popover:this._popover}}))}_parseMenuAttr(){let e=normalizeMenuModel(parseMenuModel(this.getAttribute(`menu-model`))),t=menuRefusals(e,E);if(t.length===0)return e;console.error(`${E.name} cannot render this menu, so it has none:`);for(let e of t)console.error(` [${e.path.join(`.`)}] ${e.message}`);return[]}};customElements.define(`gtk-popover-bin`,GtkPopoverBin);var GtkPopoverMenuBar=class extends HTMLElement{_model=[];_actions=null;_items=[];_active=null;_initialized=!1;static get observedAttributes(){return[`menu-model`]}get menuModel(){return this._model}set menuModel(e){this._model=normalizeMenuModel(e),assertMenuRenderable(this._model,E),this._initialized&&this._rebuild()}get actions(){return this._actions}set actions(e){this._actions=e??null,this._initialized&&this._rebuild()}get activeItem(){return this._active?.button??null}connectedCallback(){this._initialized||(this._initialized=!0,this.classList.add(`adw-popover-menu-bar`),this.setAttribute(`role`,`menubar`),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),this.addEventListener(`pointerleave`,()=>{this._active!==null&&!this._active.popover.open&&this._setActive(null,!1)}),this._model.length===0&&(this._model=this._parseMenuAttr()),this._rebuild())}attributeChangedCallback(e){!this._initialized||e!==`menu-model`||(this._model=this._parseMenuAttr(),this._rebuild())}selectFirst(){this._setActive(this._items[0]??null,!0)}popup(){this.selectFirst()}_setActive(e,t){let n=e!==this._active,r=this._active!==null&&this._active.popover.open;r&&n&&this._active?.popover.popdown(),n&&(this._active?.button.classList.remove(`selected`),this._active=e,e?.button.classList.add(`selected`)),this._active!==null&&(t||r&&n?this._active.popover.open=!0:n&&this.matches(`:focus-within`)&&this._active.button.focus())}_onKeyDown(e){this._active?.popover.open!==!0&&(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`||(e.preventDefault(),this._move(e.key===`ArrowRight`?1:-1)))}_move(e){let t=this._items.length;if(t===0)return;let n=(this._active===null?-1:this._items.indexOf(this._active))+e;n<0&&(n=t-1),n>=t&&(n=0),this._setActive(this._items[n],!1)}_rebuild(){this._items=[],this._active=null;let e=[];this._model.forEach((t,n)=>{t.kind===`submenu`&&e.push(this._buildItem(t,[n]))}),this._items=e,this.replaceChildren(...e.map(e=>e.root))}_focusFirstRow(e){e.querySelector(`.adw-popover-item:not([hidden]):not([disabled])`)?.focus()}_buildItem(e,t){let n=document.createElement(`div`);n.className=`adw-popover-menu-bar-item`,n.setAttribute(`role`,`none`);let r=document.createElement(`button`);r.type=`button`,r.className=`adw-popover-menu-bar-button`,r.setAttribute(`role`,`menuitem`),r.setAttribute(`aria-haspopup`,`menu`),r.setAttribute(`aria-expanded`,`false`);let i=document.createElement(`span`);i.className=`adw-popover-menu-bar-label`,i.textContent=e.label,r.appendChild(i);let a=document.createElement(`gtk-popover-menu`);a.setAttribute(`position`,`bottom`),a.setAttribute(`align`,`start`),a.menuModel=e.items,a.actions=this._actions,a.anchor=r,r.setAttribute(`aria-controls`,`popover`);let o={node:e,path:t,root:n,button:r,popover:a};return a.subscribe(e=>{if(r.setAttribute(`aria-expanded`,String(e)),e){for(let e of this._items)e.root.classList.toggle(`active`,e===o);this._focusFirstRow(a)}else o.root.classList.remove(`active`),this._active===o&&(this._active=null)}),a.addEventListener(`menu-item-activated`,e=>{e.stopPropagation();let n=e.detail;this._activate(o,[...t,...n.path])}),r.addEventListener(`click`,()=>this._setActive(o,!0)),n.addEventListener(`pointerenter`,()=>this._setActive(o,!1)),n.append(r,a),o}_activate(e,t){let n=menuItemAt(this._model,t);e.popover.popdown(),e.button.focus(),n!==null&&this.dispatchEvent(new CustomEvent(`menu-item-activated`,{bubbles:!0,detail:{id:n.id??n.label,label:n.label,path:[...t]}}))}_parseMenuAttr(){let e=normalizeMenuModel(parseMenuModel(this.getAttribute(`menu-model`))),t=menuRefusals(e,E);if(t.length>0){console.error(`${E.name} cannot render this menu, so it has none:`);for(let e of t)console.error(` [${e.path.join(`.`)}] ${e.message}`);return[]}for(let[t,n]of e.entries())n.kind!==`submenu`&&console.warn(`Don't know how to handle this item: top-level entry ${t} is a ${n.kind}.`);return e}};customElements.define(`gtk-popover-menu-bar`,GtkPopoverMenuBar);const yi=[`collate`,`copies`,`generate-pdf`,`generate-ps`,`number-up`,`number-up-layout`,`page-set`,`preview`,`reverse`,`scale`],bi=[`General`,`Page Setup`,`Job`,`Image Quality`,`Color`,`Finishing`,`Advanced`],xi=[`All sheets`,`Even sheets`,`Odd sheets`],Si=[`portrait`,`landscape`,`reverse-portrait`,`reverse-landscape`],Ci={copies:`1`,collate:`0`,reverse:`0`,"page-set":`0`,scale:`100`,orientation:`portrait`};var GtkPrintUnixDialog=class extends AdwDialog{_built=!1;_printers=[];_selected=null;_settings={...Ci};_pageSetup=defaultPageSetup();_printerListEl;_switcherEl;_panelEl;_tabPages=new Map;_tab=`General`;_currentPage=-1;_supportSelection=!1;_hasSelection=!1;_manual=new Set;_range=`all`;_printAt=`now`;_printButton;_previewButton;_conflictsEl;_capabilityControls=new Map;_collateCheck;_reverseCheck;_copiesInput;_paperDrop;_orientationDrop;_pageRangeInput;_selectionRadio;_currentPageRadio;_rangeRadios=new Map;_atInput=null;static get observedAttributes(){return[...AdwDialog.observedAttributes,`current-page`,`embed-page-setup`,`has-selection`,`manual-capabilities`,`support-selection`]}get currentPage(){return this._currentPage}set currentPage(e){this._currentPage=e,this._built&&this._renderPrint()}get embedPageSetup(){return this.hasAttribute(`embed-page-setup`)}set embedPageSetup(e){this.toggleAttribute(`embed-page-setup`,e),this._built&&this._renderPrint()}get hasSelection(){return this._hasSelection}set hasSelection(e){this._hasSelection=e,this._built&&this._renderPrint()}get supportSelection(){return this.hasAttribute(`support-selection`)}set supportSelection(e){this.toggleAttribute(`support-selection`,e),this._built&&this._renderPrint()}get manualCapabilities(){return[...this._manual]}set manualCapabilities(e){this._manual=new Set(e.filter(e=>yi.includes(e))),this._built&&this._renderPrint()}get selectedPrinter(){return this._selected===null?null:{...this._selected}}get pageSetup(){return{...this._pageSetup}}set pageSetup(e){this._pageSetup=e,this._built&&this._renderPrint()}get printSettings(){return{...this._settings}}set printSettings(e){this._settings={...Ci,...e},this._built&&this._renderPrint()}get range(){return this._range}set range(e){if(this._range=e,!this._built)return;let t=this._rangeRadios.get(e);t!==void 0&&(t.checked=!0),this._renderPrint()}get printers(){return this._printers.map(e=>({...e}))}set printers(e){this._printers=e.map(e=>({...e})),this._selected=null,this._built&&this._renderPrint()}connectedCallback(){if(this._built){super.connectedCallback();return}this._switcherEl=document.createElement(`div`),this._switcherEl.className=`adw-print-switcher`,this._switcherEl.setAttribute(`role`,`tablist`),super.connectedCallback(),this.hasAttribute(`title`)||this.setAttribute(`title`,`Print`),this._readManual();let e=[...this.contentArea.childNodes];this.contentArea.replaceChildren(this._build());for(let t of e)this.contentArea.appendChild(t);this._renderPrint(),this._built=!0}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),!(!this._built||t===n)&&e!==`title`&&(e===`manual-capabilities`&&this._readManual(),this._renderPrint())}_readManual(){this._manual=new Set((this.getAttribute(`manual-capabilities`)??``).split(`|`).map(e=>e.trim()).filter(e=>yi.includes(e)))}decorateHeader(e){let t=e.querySelector(`.adw-dialog-title`);t===null?e.prepend(this._switcherEl):t.replaceWith(this._switcherEl)}_build(){let e=document.createElement(`div`);return e.className=`adw-print-root`,this._panelEl=document.createElement(`div`),this._panelEl.className=`adw-print-panel`,this._panelEl.setAttribute(`role`,`tabpanel`),e.append(this._panelEl,this._buildConflicts(),this._buildActions()),this._renderPanel(),e}_renderPanel(){for(let e of bi){let t=this._tabPages.get(e);t===void 0&&(t=document.createElement(`div`),t.className=`adw-print-page`,t.setAttribute(`role`,`tabpanel`),t.dataset.tab=e,t.appendChild(this._buildTab(e)),this._tabPages.set(e,t),this._panelEl.appendChild(t)),t.hidden=e!==this._tab}}_buildTab(e){switch(e){case`General`:return this._buildGeneral();case`Page Setup`:return this._buildPageSetup();case`Job`:return this._buildJob();case`Image Quality`:case`Color`:case`Finishing`:return this._buildOptionsPage(e);case`Advanced`:return this._buildOptionsPage(e)}}_buildGeneral(){let e=document.createElement(`div`);e.className=`adw-print-columns`,this._printerListEl=document.createElement(`div`),this._printerListEl.className=`adw-print-printer-list`,this._printerListEl.setAttribute(`role`,`radiogroup`),this._printerListEl.setAttribute(`aria-label`,`Printer`),e.appendChild(this._frame(this._printerListEl));let t=document.createElement(`div`);t.className=`adw-print-column`;let n=this._group(`Range`),r=n.body;for(let[e,t]of[[`all`,`All Pages`],[`current`,`Current Page`],[`selection`,`Selection`]]){let n=this._radio(t,`adw-print-range-${e}`);n.addEventListener(`notify::checked`,()=>{n.checked&&(this._range=e,(e===`current`||e===`selection`)&&this._renderPrint())}),e===`current`&&(this._currentPageRadio=n),e===`selection`&&(this._selectionRadio=n),this._rangeRadios.set(e,n),r.appendChild(n)}let i=this._radio(`Pages:`,`adw-print-range-pages`);i.addEventListener(`notify::checked`,()=>{i.checked&&(this._range=`pages`,this._pageRangeInput.focus())}),this._pageRangeInput=document.createElement(`input`),this._pageRangeInput.type=`text`,this._pageRangeInput.className=`adw-print-page-range-entry`,this._pageRangeInput.title=`Specify one or more page ranges, e.g. 1–3, 7, 11`,this._pageRangeInput.setAttribute(`aria-label`,`Pages`),this._pageRangeInput.addEventListener(`focus`,()=>{this._range=`pages`,i.checked=!0}),this._rangeRadios.set(`pages`,i);let a=document.createElement(`div`);a.className=`adw-print-grid-row`,a.append(i,this._pageRangeInput),r.appendChild(a),t.appendChild(n.group);let o=this._group(`Copies`),s=o.body,c=document.createElement(`div`);c.className=`adw-print-grid-row`;let l=document.createElement(`div`);l.className=`adw-print-label`,l.textContent=`Copies:`,this._copiesInput=document.createElement(`input`),this._copiesInput.type=`number`,this._copiesInput.min=`1`,this._copiesInput.className=`adw-print-copies`,this._copiesInput.value=this._settings.copies??`1`,this._copiesInput.setAttribute(`aria-label`,`Copies`),this._copiesInput.addEventListener(`input`,()=>{this._settings={...this._settings,copies:this._copiesInput.value},this._renderPrint()}),c.append(l,this._copiesInput),s.appendChild(c),this._collateCheck=this._check(`Collate`,`adw-print-collate`),this._reverseCheck=this._check(`Reverse`,`adw-print-reverse`);for(let e of[this._collateCheck,this._reverseCheck])e.addEventListener(`notify::checked`,()=>this._renderPrint());s.append(this._collateCheck,this._reverseCheck);let u=this._buildCollatePreview(),d=document.createElement(`div`);return d.className=`adw-print-grid-row`,d.appendChild(u),s.appendChild(d),t.appendChild(o.group),e.appendChild(t),e}_buildCollatePreview(){let e=document.createElement(`div`);return e.className=`adw-print-collate-preview`,e.setAttribute(`role`,`img`),e.setAttribute(`aria-label`,`A visualization of the effect of the collate and reverse options on the page ordering`),e.dataset.columnA=`2`,e.dataset.columnB=`1`,e}_buildPageSetup(){let e=document.createElement(`div`);e.className=`adw-print-columns`;let t=document.createElement(`div`);t.className=`adw-print-column`;let n=this._group(`Layout`),r=n.body;r.appendChild(this._labelledRow(`Two-sided:`,this._dropDown(xi,`Two-sided`)));let i=document.createElement(`input`);i.type=`number`,i.min=`10`,i.max=`400`,i.className=`adw-print-scale`,i.value=this._settings.scale??`100`,i.setAttribute(`aria-label`,`Scale in percent`),i.addEventListener(`input`,()=>{this._settings={...this._settings,scale:i.value},this._renderPrint()}),this._capabilityControls.set(`scale`,i);let a=document.createElement(`div`);a.className=`adw-print-grid-row`;let o=document.createElement(`div`);o.className=`adw-print-label`,o.textContent=`Scale:`;let s=document.createElement(`span`);s.className=`adw-print-label`,s.textContent=`%`,a.append(o,i,s),r.appendChild(a),t.appendChild(n.group);let c=this._group(`Paper`),l=c.body,u=G.map(e=>e.displayName);return this._paperDrop=this._dropDown(u,`Paper size`),this._orientationDrop=this._dropDown(Si.map(e=>e[0].toUpperCase()+e.slice(1)),`Orientation`),l.appendChild(this._labelledRow(`Paper size:`,this._paperDrop)),l.appendChild(this._labelledRow(`Orientation:`,this._orientationDrop)),t.appendChild(c.group),this._paperDrop.addEventListener(`notify::selected`,()=>{this.embedPageSetup&&this._paperChanged(this._paperDrop.selected)}),this._orientationDrop.addEventListener(`notify::selected`,()=>{if(!this.embedPageSetup)return;let e=Si[this._orientationDrop.selected]??`portrait`;this._pageSetup={...this._pageSetup,orientation:e},this._settings={...this._settings,orientation:e},this._renderPrint()}),e.append(t,this._buildSheetPreview()),e}_buildSheetPreview(){let e=document.createElement(`div`);e.className=`adw-print-sheet-preview`,e.setAttribute(`role`,`img`),e.setAttribute(`aria-label`,`Page layout preview`);let t=document.createElement(`div`);t.className=`adw-print-paper`;let n=paperSizeOf(this._pageSetup),r=this._pageSetup.orientation===`landscape`||this._pageSetup.orientation===`reverse-landscape`;t.style.aspectRatio=r?`${n.height} / ${n.width}`:`${n.width} / ${n.height}`;let i=document.createElement(`div`);i.className=`adw-print-number-up`,i.dataset.cells=`1`,t.appendChild(i),e.appendChild(t);let a=document.createElement(`div`);return a.className=`adw-print-sheet-caption`,a.textContent=`${orientedSize(this._pageSetup).width.toFixed(1)} mm × ${orientedSize(this._pageSetup).height.toFixed(1)} mm`,e.appendChild(a),e}_buildJob(){let e=document.createElement(`div`);e.className=`adw-print-column`;let t=this._group(`Job Details`);t.body.appendChild(this._optionsGrid(`Job Details`));let n=this._group(`Print Document`),r=n.body;for(let[e,t]of[[`now`,`Now`],[`at`,`At:`],[`hold`,`On hold`]]){let n=this._radio(t,`adw-print-at`);if(n.addEventListener(`notify::checked`,()=>{n.checked&&(this._printAt=e,this._atInput!==null&&(this._atInput.disabled=e!==`at`),e===`at`&&this._atInput?.focus())}),r.appendChild(n),e===`at`){this._atInput=document.createElement(`input`),this._atInput.type=`text`,this._atInput.className=`adw-print-at-entry`,this._atInput.setAttribute(`aria-label`,`Print at`),this._atInput.disabled=!0,this._atInput.addEventListener(`input`,()=>{this._settings={...this._settings,"print-at":this._atInput.value}});let e=document.createElement(`div`);e.className=`adw-print-grid-row`,e.appendChild(this._atInput),r.appendChild(e)}}let i=this._group(`Add Cover Page`);return i.body.appendChild(this._optionsGrid(`Cover Page`)),e.append(t.group,n.group,i.group),e}_buildOptionsPage(e){let t=document.createElement(`div`);t.className=`adw-print-column`;let n=this._optionsGrid(e);if(e===`Advanced`){let e=document.createElement(`div`);return e.className=`adw-print-advanced`,e.appendChild(n),t.appendChild(e),t}return t.appendChild(n),t}_optionsGrid(e){let t=document.createElement(`div`);return t.className=`adw-print-options-grid`,t.setAttribute(`role`,`group`),t.setAttribute(`aria-label`,e),t.dataset.empty=`true`,t}_buildConflicts(){return this._conflictsEl=document.createElement(`div`),this._conflictsEl.className=`adw-print-conflicts`,this._conflictsEl.hidden=!0,this._conflictsEl.append(createGtkImage(`dialog-warning`,`adw-print-conflicts-icon`),(()=>{let e=document.createElement(`span`);return e.className=`adw-print-conflicts-label`,e.textContent=`Some of the settings in the dialog conflict`,e})()),this._conflictsEl}_buildActions(){let e=document.createElement(`div`);e.className=`adw-print-actions`,this._previewButton=document.createElement(`button`),this._previewButton.type=`button`,this._previewButton.className=`adw-print-preview`,this._previewButton.textContent=`Preview`,this._previewButton.addEventListener(`click`,()=>this._respond(-10));let t=document.createElement(`button`);return t.type=`button`,t.className=`adw-print-cancel`,t.textContent=`Cancel`,t.addEventListener(`click`,()=>this._respond(-6)),this._printButton=document.createElement(`button`),this._printButton.type=`button`,this._printButton.className=`adw-print-print suggested-action`,this._printButton.textContent=`Print`,this._printButton.addEventListener(`click`,()=>this._respond(-5)),e.append(this._previewButton,t,this._printButton),e}_respond(e){this.dispatchEvent(new CustomEvent(`response`,{bubbles:!0,detail:{responseId:e}})),e!==-5&&this.close()}_group(e){let t=document.createElement(`div`);t.className=`adw-print-group`;let n=document.createElement(`div`);n.className=`adw-print-group-title`,n.textContent=e;let r=document.createElement(`div`);return r.className=`adw-print-group-body`,t.append(n,r),{group:t,body:r}}_labelledRow(e,t,n){let r=document.createElement(`div`);r.className=`adw-print-grid-row`;let i=document.createElement(`div`);return i.className=`adw-print-label`,i.textContent=e,r.append(i,t),n!==void 0&&this._capabilityControls.set(n,t),r}_dropDown(e,t){let n=document.createElement(`gtk-drop-down`);return n.className=`adw-print-dropdown`,n.setAttribute(`model`,JSON.stringify([...e])),n.setAttribute(`aria-label`,t),n}_radio(e,t){let n=document.createElement(`adw-radio`);return n.className=t,n.setAttribute(`label`,e),n.setAttribute(`name`,t),n.setAttribute(`value`,e),n}_check(e,t){let n=document.createElement(`gtk-check-button`);return n.className=t,n.setAttribute(`label`,e),n.setAttribute(`name`,t),n}_frame(e){let t=document.createElement(`div`);return t.className=`adw-print-frame`,t.appendChild(e),t}_printerChanged(e){this._selected=e,e!==null&&(this._settings={...this._settings,"format-for-printer":e.name}),this._renderPrint()}_paperChanged(e){let t=G[e];t!==void 0&&(this._pageSetup={...this._pageSetup,paperSize:t.name,margins:defaultMargins(t)},this._renderPrint())}_capabilities(){let e=new Set(this._manual);for(let t of this._selected?.capabilities??[])e.add(t);return e}_renderPrint(){let e=this._capabilities();this._switcherEl.replaceChildren(...bi.map(e=>{let t=document.createElement(`button`);return t.type=`button`,t.className=`adw-print-switcher-item`,t.setAttribute(`role`,`tab`),t.textContent=e,t.classList.toggle(`checked`,e===this._tab),t.setAttribute(`aria-selected`,String(e===this._tab)),t.addEventListener(`click`,()=>{this._tab=e,this._renderPanel(),this._renderPrint()}),t})),this._printerListEl.replaceChildren(...this._printers.map(e=>{let t=document.createElement(`button`);t.type=`button`,t.className=`adw-print-printer-row`,t.setAttribute(`role`,`radio`),t.setAttribute(`aria-checked`,String(e===this._selected)),t.classList.toggle(`checked`,e===this._selected),t.appendChild(e.iconName===void 0?createGtkImage(`printer`,`adw-print-printer-icon`):createGtkImage(e.iconName,`adw-print-printer-icon`));let n=document.createElement(`span`);n.className=`adw-print-printer-text`;let r=document.createElement(`span`);if(r.className=`adw-print-printer-name`,r.textContent=e.name,n.appendChild(r),e.location!==void 0){let t=document.createElement(`span`);t.className=`adw-print-printer-location`,t.textContent=e.location,n.appendChild(t)}return t.appendChild(n),t.addEventListener(`click`,()=>this._printerChanged(e)),t})),this._selectionRadio.hidden=!this.supportSelection,this._selectionRadio.classList.toggle(`insensitive`,!this.supportSelection||!this._hasSelection),this._selectionRadio.setAttribute(`aria-disabled`,String(!this.supportSelection||!this._hasSelection)),this._currentPageRadio.classList.toggle(`insensitive`,this._currentPage===-1),this._currentPageRadio.setAttribute(`aria-disabled`,String(this._currentPage===-1));for(let[t,n]of this._capabilityControls)n.toggleAttribute(`disabled`,!e.has(t));let t=Number.parseInt(this._copiesInput.value,10),n=this._copiesInput.value!==``&&Number.isFinite(t)&&t>1;this._collateCheck.toggleAttribute(`disabled`,!n||!e.has(`collate`)),this._reverseCheck.toggleAttribute(`disabled`,!e.has(`reverse`)),this._copiesInput.toggleAttribute(`disabled`,!e.has(`copies`)),this._paperDrop.toggleAttribute(`disabled`,!this.embedPageSetup),this._orientationDrop.toggleAttribute(`disabled`,!this.embedPageSetup);let r=this._collateCheck.checked,i=this._reverseCheck.checked,a=this.contentArea.querySelector(`.adw-print-collate-preview`);a!==null&&(a.dataset.columnA=String(r?i?1:2:i?2:1),a.dataset.columnB=String(r?i?2:1:i?1:2),a.dataset.secondColumn=String(n));let o=this._selected!==null&&(this._selected.acceptsJobs??!0);this._printButton.toggleAttribute(`disabled`,!o),this._previewButton.hidden=!e.has(`preview`);let s=this.contentArea.querySelector(`.adw-print-paper`);if(s!==null){let e=paperSizeOf(this._pageSetup),t=this._pageSetup.orientation===`reverse-portrait`;s.style.aspectRatio=`${this._pageSetup.orientation===`landscape`||t?`${e.height} / ${e.width}`:`${e.width} / ${e.height}`}`}let c=this.contentArea.querySelector(`.adw-print-number-up`);c!==null&&(c.dataset.cells=`1`),this._conflictsEl.hidden=!0}};customElements.define(`gtk-print-unix-dialog`,GtkPrintUnixDialog);var GtkProgressBar=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(`gtk-progress-bar`,GtkProgressBar);const wi=[`none`,`crossfade`,`slide-right`,`slide-left`,`slide-up`,`slide-down`,`swing-right`,`swing-left`,`swing-up`,`swing-down`,`fade-slide-right`,`fade-slide-left`,`fade-slide-up`,`fade-slide-down`],Ti=new Set([`slide-right`,`slide-left`,`fade-slide-right`,`fade-slide-left`]),Ei=new Set([`slide-up`,`slide-down`,`fade-slide-up`,`fade-slide-down`]),Di=new Set([`swing-right`,`swing-left`]),Oi=new Set([`swing-up`,`swing-down`]),ki=new Set([`crossfade`,`fade-slide-right`,`fade-slide-left`,`fade-slide-up`,`fade-slide-down`]),Ai={"slide-left":`slide-right`,"slide-right":`slide-left`,"swing-left":`swing-right`,"swing-right":`swing-left`,"fade-slide-left":`fade-slide-right`,"fade-slide-right":`fade-slide-left`};var GtkRevealer=class extends HTMLElement{_clipEl;_initialized=!1;_position=0;_target=0;_frame=0;_startedAt=0;_naturalWidth=0;_naturalHeight=0;_resize=null;static get observedAttributes(){return[`reveal-child`,`transition-type`,`transition-duration`]}get revealChild(){return this.hasAttribute(`reveal-child`)}set revealChild(e){this.toggleAttribute(`reveal-child`,!!e)}get childRevealed(){return this._position===this._target?this.revealChild:!this.revealChild}get transitionType(){let e=this.getAttribute(`transition-type`);return wi.includes(e)?e:`slide-down`}set transitionType(e){this.setAttribute(`transition-type`,e)}get transitionDuration(){let e=Number.parseFloat(this.getAttribute(`transition-duration`)??``);return Number.isFinite(e)&&e>=0?e:250}set transitionDuration(e){this.setAttribute(`transition-duration`,String(e))}get child(){return this._clipEl?.firstElementChild??null}connectedCallback(){if(this._initialized){this._observeChild(),this._render();return}this._initialized=!0,this.setAttribute(`role`,`group`),this._clipEl=document.createElement(`div`),this._clipEl.className=`adw-revealer-clip`,bindSlottedChildren(this,[{name:`child`,into:this._clipEl},{into:this._clipEl}],()=>this._observeChild()).install(this._clipEl),this._observeChild(),this._animate(this.revealChild),this._render()}disconnectedCallback(){this._finish(),this._resize?.disconnect(),this._resize=null}attributeChangedCallback(e,t,n){if(!this._initialized)return;if(e===`reveal-child`){if(!this._animate(n!==null))return;this.dispatchEvent(new CustomEvent(`notify::reveal-child`,{bubbles:!0,detail:{revealChild:this.revealChild}}));return}this._render();let r=e===`transition-duration`?{transitionDuration:this.transitionDuration}:{transitionType:this.transitionType};this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:r}))}_observeChild(){this._resize?.disconnect(),this._resize=new ResizeObserver(e=>{for(let t of e){let e=t.borderBoxSize?.[0];this._naturalWidth=e?e.inlineSize:t.contentRect.width,this._naturalHeight=e?e.blockSize:t.contentRect.height}this._render()}),this._resize.observe(this._clipEl);let e=this._clipEl.firstElementChild;e&&this._resize.observe(e)}_animate(e){let t=+!!e;if(this._target===t)return!1;this._target=t;let n=this.effectiveTransition,r=globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1;if(this.transitionDuration===0||n===`none`||r||!this.isConnected)return this._finish(),this._setPosition(t),!0;let i=this._position;return this._startedAt=performance.now(),this._frame===0&&(this._frame=requestAnimationFrame(()=>this._tick(i))),!0}_tick(e){this._frame=0;let t=this.transitionDuration,n=performance.now()-this._startedAt,r=t<=0?1:Math.min(1,n/t),i=easeOutCubic(r);this._setPosition(e+i*(this._target-e)),r<1&&(this._frame=requestAnimationFrame(()=>this._tick(e)))}_finish(){this._frame!==0&&(cancelAnimationFrame(this._frame),this._frame=0)}get effectiveTransition(){let e=this.transitionType;return this.matches(`:dir(rtl)`)?Ai[e]??e:e}_scale(e){let t=this.effectiveTransition,n=e===`horizontal`?Ti:Ei,r=e===`horizontal`?Di:Oi;return n.has(t)?this._position:r.has(t)?Math.sin(Math.PI*this._position/2):1}_setPosition(e){this._position=e,this._render(),this._position===this._target&&this.dispatchEvent(new CustomEvent(`notify::child-revealed`,{bubbles:!0,detail:{childRevealed:this.childRevealed}}))}_render(){let e=this._clipEl.firstElementChild;e&&this._naturalHeight===0&&(this._naturalWidth=e.offsetWidth,this._naturalHeight=e.offsetHeight);let t=this._position,n=this._scale(`horizontal`),r=this._scale(`vertical`),i=this.effectiveTransition;if(this._clipEl.style.width=n<1?`${Math.ceil(this._naturalWidth*n)}px`:``,this._clipEl.style.height=r<1?`${Math.ceil(this._naturalHeight*r)}px`:``,e){let a=this._naturalWidth,o=this._naturalHeight,s=a*n,c=o*r,l=2*Math.max(s,c),u=90*(1-t),d=``;switch(i){case`slide-right`:case`fade-slide-right`:d=`translateX(${s-a}px)`;break;case`slide-down`:case`fade-slide-down`:d=`translateY(${c-o}px)`;break;case`swing-right`:d=`translate(0, ${c/2}px) perspective(${l}px) rotateY(${u}deg) translate(0, ${-o/2}px)`;break;case`swing-left`:d=`translate(${s}px, ${c/2}px) perspective(${l}px) rotateY(${-u}deg) translate(${-a}px, ${-o/2}px)`;break;case`swing-down`:d=`translate(${s/2}px, 0) perspective(${l}px) rotateX(${-u}deg) translate(${-a/2}px, 0)`;break;case`swing-up`:d=`translate(${s/2}px, ${c}px) perspective(${l}px) rotateX(${u}deg) translate(${-a/2}px, ${-o}px)`;break;default:break}e.style.transform=d,e.style.transformOrigin=d===``?``:`0 0`,e.style.opacity=ki.has(i)?String(t):``}this.classList.toggle(`revealed`,t>0)}};customElements.define(`gtk-revealer`,GtkRevealer);const ji=[`left`,`right`,`top`,`bottom`];function seededRange(e,t){let n=normalizeAdjustment(parseAdjustment(e));if(t===null)return n;let r=Number.parseFloat(t);return Number.isFinite(r)?{...n,value:r}:n}function formatScaleValue(e,t){let n=e.toFixed(t);return n.startsWith(`-`)&&Number.parseFloat(n)===0?n.slice(1):n}var GtkScale=class extends HTMLElement{_range=new SpinState;_trough;_highlight;_fill;_slider;_value;_initialized=!1;_pointerId=null;static get observedAttributes(){return[`adjustment`,`digits`,`disabled`,`draw-value`,`fill-level`,`has-origin`,`inverted`,`orientation`,`restrict-to-fill-level`,`round-digits`,`show-fill-level`,`value`,`value-pos`]}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this.setAttribute(`orientation`,e)}get adjustment(){return this._range.adjustment}set adjustment(e){this._range.configure(typeof e==`string`?parseAdjustment(e):e),this._render()}get value(){return this._range.value}set value(e){this._setValue(e,!1)}get inverted(){return this.hasAttribute(`inverted`)}set inverted(e){this.toggleAttribute(`inverted`,!!e)}get drawValue(){return this.hasAttribute(`draw-value`)}set drawValue(e){this.toggleAttribute(`draw-value`,!!e)}get valuePos(){let e=this.getAttribute(`value-pos`);return ji.includes(e)?e:`top`}set valuePos(e){this.setAttribute(`value-pos`,e)}get hasOrigin(){return!this.hasAttribute(`has-origin`)||this.getAttribute(`has-origin`)!==`false`}set hasOrigin(e){this.toggleAttribute(`has-origin`,!!e)}get digits(){let e=Number.parseInt(this.getAttribute(`digits`)??``,10);return Number.isFinite(e)?Math.max(0,e):1}set digits(e){this.setAttribute(`digits`,String(e))}get fillLevel(){let e=Number.parseFloat(this.getAttribute(`fill-level`)??``);return Number.isFinite(e)?e:0}set fillLevel(e){this.setAttribute(`fill-level`,String(e))}get showFillLevel(){return this.hasAttribute(`show-fill-level`)}set showFillLevel(e){this.toggleAttribute(`show-fill-level`,!!e)}get restrictToFillLevel(){return this.hasAttribute(`restrict-to-fill-level`)}set restrictToFillLevel(e){this.toggleAttribute(`restrict-to-fill-level`,!!e)}get slider(){return this._slider}connectedCallback(){this._initialized||(this._initialized=!0,this._range.configure(seededRange(this.getAttribute(`adjustment`),this.getAttribute(`value`))),this._trough=document.createElement(`span`),this._trough.className=`adw-scale-trough`,this._highlight=document.createElement(`span`),this._highlight.className=`adw-scale-highlight`,this._fill=document.createElement(`span`),this._fill.className=`adw-scale-fill`,this._slider=document.createElement(`span`),this._slider.className=`adw-scale-slider`,this._trough.append(this._fill,this._highlight,this._slider),this._value=document.createElement(`span`),this._value.className=`adw-scale-value`,this.replaceChildren(this._trough,this._value),this.setAttribute(`role`,`slider`),this.hasAttribute(`tabindex`)||this.setAttribute(`tabindex`,`0`),this._trough.addEventListener(`pointerdown`,e=>this._onPointerDown(e)),this._value.addEventListener(`pointerdown`,e=>this._onPointerDown(e)),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),this.addEventListener(`pointermove`,e=>this._onPointerMove(e)),this.addEventListener(`pointerup`,e=>this._onPointerUp(e)),this.addEventListener(`pointercancel`,e=>this._onPointerUp(e)),this._range.subscribe(e=>{this._render(),this.dispatchEvent(new CustomEvent(`value-changed`,{bubbles:!0,detail:{value:e.value}}))}),this._range.subscribeChanged(()=>this._render()),this._render())}attributeChangedCallback(e){if(this._initialized){if(e===`adjustment`){this._range.configure(parseAdjustment(this.getAttribute(`adjustment`)));return}if(e===`value`){this._range.setValue(Number.parseFloat(this.getAttribute(`value`)??`0`));return}this._render()}}_setValue(e,t){let n=e;this.restrictToFillLevel&&(n=Math.min(n,Math.max(this.adjustment.lower,this.fillLevel)));let r=Number.parseInt(this.getAttribute(`round-digits`)??``,10);if(Number.isFinite(r)&&r!==-1){let e=10**r;n=Math.floor(n*e+.5)/e}return t?this._range.setValueInteractive(n):this._range.setValue(n)}_valueAtCoord(e){let t=this.adjustment,n=this.orientation===`horizontal`?this._trough.clientWidth:this._trough.clientHeight,r=n===0?1:glibClamp(e/n,0,1);return this._shouldInvert()&&(r=1-r),t.lower+r*(t.upper-t.lower-t.pageSize)}_shouldInvert(){let e=this.closest(`[dir="rtl"]`)!==null;return this.orientation===`horizontal`?this.inverted?!e:e:this.inverted}_onPointerDown(e){if(this.hasAttribute(`disabled`)||e.button!==0)return;let t=this._trough.getBoundingClientRect(),n=this.orientation===`horizontal`?e.clientX-t.left:e.clientY-t.top;this._pointerId=e.pointerId,this.focus(),this._setValue(this._valueAtCoord(n),!0);try{this.setPointerCapture(e.pointerId)}catch{}e.preventDefault()}_onPointerMove(e){if(this._pointerId!==e.pointerId)return;let t=this._trough.getBoundingClientRect(),n=this.orientation===`horizontal`?e.clientX-t.left:e.clientY-t.top;this._setValue(this._valueAtCoord(n),!0)}_onPointerUp(e){this._pointerId===e.pointerId&&(this._pointerId=null,this.hasPointerCapture(e.pointerId)&&this.releasePointerCapture(e.pointerId))}_onKeyDown(e){if(this.hasAttribute(`disabled`))return;let t=this.adjustment,n=e.ctrlKey,r=null;switch(e.key){case`ArrowLeft`:r=this.value-(n?t.pageIncrement:t.stepIncrement);break;case`ArrowRight`:r=this.value+(n?t.pageIncrement:t.stepIncrement);break;case`ArrowDown`:r=this.value-(n?t.pageIncrement:t.stepIncrement);break;case`ArrowUp`:r=this.value+(n?t.pageIncrement:t.stepIncrement);break;case`PageUp`:r=this.value+t.pageIncrement;break;case`PageDown`:r=this.value-t.pageIncrement;break;case`Home`:r=t.lower;break;case`End`:r=t.upper-t.pageSize;break;case`+`:case`=`:r=this.value+(n?t.pageIncrement:t.stepIncrement);break;case`-`:r=this.value-(n?t.pageIncrement:t.stepIncrement);break;default:return}e.preventDefault(),this._setValue(r,!0)}_render(){if(!this._trough)return;let e=this.orientation,t=this.adjustment,n=t.upper-t.lower-t.pageSize,r=n===0?0:(t.value-t.lower)/n,i=glibClamp(this._shouldInvert()?1-r:r,0,1);this.classList.toggle(`horizontal`,e===`horizontal`),this.classList.toggle(`vertical`,e===`vertical`),this.setAttribute(`aria-orientation`,e),e===`horizontal`?this._slider.style.left=`${i*100}%`:this._slider.style.bottom=`${i*100}%`,this._slider.style.top=``,this._slider.style.right=``;let a=this.hasOrigin;this._highlight.hidden=!a,a&&(e===`horizontal`?(this._highlight.style.right=``,this._highlight.style.width=`${i*100}%`):(this._highlight.style.width=``,this._highlight.style.height=`${i*100}%`));let o=this.showFillLevel;if(this._fill.hidden=!o,o){let r=glibClamp((this.fillLevel-t.lower)/(n||1),0,1);e===`horizontal`?this._fill.style.width=`${r*100}%`:this._fill.style.height=`${r*100}%`}this._value.textContent=formatScaleValue(t.value,this.digits),this._value.hidden=!this.drawValue;let s=this.valuePos;this._value.classList.toggle(`left`,s===`left`),this._value.classList.toggle(`right`,s===`right`),this._value.classList.toggle(`top`,s===`top`),this._value.classList.toggle(`bottom`,s===`bottom`),this.classList.toggle(`value-top`,s===`top`),this.classList.toggle(`value-right`,s===`right`),this.classList.toggle(`value-bottom`,s===`bottom`),this.classList.toggle(`value-left`,s===`left`),this.setAttribute(`aria-valuemin`,String(t.lower)),this.setAttribute(`aria-valuemax`,String(t.upper-t.pageSize)),this.setAttribute(`aria-valuenow`,String(t.value)),this.setAttribute(`aria-valuetext`,this._value.textContent??``),this.hasAttribute(`disabled`)?this.setAttribute(`aria-disabled`,`true`):this.removeAttribute(`aria-disabled`)}};customElements.define(`gtk-scale`,GtkScale);const Mi={lower:0,upper:100,stepIncrement:2,pageIncrement:20,pageSize:0};var GtkScaleButton=class extends HTMLElement{_state=new SpinState;_buttonEl;_glyph;_dockEl;_rangeEl;_minusEl;_plusEl;_icons=[];_initialized=!1;_syncing=!1;static get observedAttributes(){return[`value`,`icons`,`adjustment`,`has-frame`,`orientation`]}get value(){return this._state.value}set value(e){this._applyValue(e)}get active(){return this._buttonEl?.classList.contains(`checked`)??!1}get icons(){return[...this._icons]}set icons(e){this.setAttribute(`icons`,JSON.stringify(e))}get hasFrame(){return this.hasAttribute(`has-frame`)}set hasFrame(e){this.toggleAttribute(`has-frame`,!!e)}get orientation(){return this.getAttribute(`orientation`)===`horizontal`?`horizontal`:`vertical`}set orientation(e){this.setAttribute(`orientation`,e)}connectedCallback(){if(this._initialized)return;this._initialized=!0,this.setAttribute(`role`,`group`),this._glyph=createGtkImage(`image-missing`,`scale-button-glyph`),this._buttonEl=document.createElement(`button`),this._buttonEl.type=`button`,this._buttonEl.className=`adw-button scale-button-icon flat`,this._buttonEl.setAttribute(`aria-expanded`,`false`),this._buttonEl.appendChild(this._glyph),this._minusEl=this._stepButton(`list-remove-symbolic`,`Decrease`),this._plusEl=this._stepButton(`list-add-symbolic`,`Increase`),this._rangeEl=document.createElement(`input`),this._rangeEl.type=`range`,this._rangeEl.className=`scale-button-range`,this._rangeEl.addEventListener(`input`,()=>{this._syncing||this._applyValue(Number(this._rangeEl.value))});let e=document.createElement(`div`);e.className=`scale-button-box`,e.append(this._minusEl,this._rangeEl,this._plusEl),this._dockEl=document.createElement(`gtk-popover`),this._dockEl.classList.add(`scale-popup`),this._dockEl.replaceChildren(e),this._dockEl.anchor=this._buttonEl,this.replaceChildren(this._buttonEl,this._dockEl),this._buttonEl.addEventListener(`click`,()=>this._toggleDock()),this._minusEl.addEventListener(`click`,()=>this._step(-1)),this._plusEl.addEventListener(`click`,()=>this._step(1)),this._dockEl.subscribe(e=>this._renderDock(e)),this.addEventListener(`wheel`,e=>{e.deltaY!==0&&(e.preventDefault(),this._applyValue(this._state.value-Math.sign(e.deltaY)*this._state.adjustment.stepIncrement))},{passive:!1}),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),this._icons=parseIcons(this.getAttribute(`icons`)),this._syncAdjustment(),this._render()}attributeChangedCallback(e){if(this._initialized){if(e===`adjustment`){this._syncAdjustment();return}if(e===`icons`){this._icons=parseIcons(this.getAttribute(`icons`)),this._render(),this.dispatchEvent(new CustomEvent(`notify::icons`,{bubbles:!0}));return}if(e===`value`){let e=this.getAttribute(`value`);if(e===null||e.trim()===``)return;let t=Number(e);Number.isFinite(t)&&this._applyValue(t);return}this._render()}}_applyValue(e){let t=this._state.setValue(e);if(this._render(),!t)return;let n=this._state.value;this.setAttribute(`value`,String(n)),this.dispatchEvent(new CustomEvent(`value-changed`,{bubbles:!0,detail:{value:n}})),this.dispatchEvent(new CustomEvent(`notify::value`,{bubbles:!0,detail:{value:n}}))}_syncAdjustment(){let e=parseAdjustment(this.getAttribute(`adjustment`)),t={...Mi,...e},n=this.getAttribute(`value`),r=n===null||n.trim()===``?NaN:Number(n);t.value=Number.isFinite(r)?r:this._state.value,this._state.configure(t),this._render(),this.dispatchEvent(new CustomEvent(`notify::adjustment`,{bubbles:!0}))}_render(){if(!this._initialized)return;let e=this._state.value,[t,n]=adjustmentRange(this._state.adjustment),r=selectIcon(this._icons,e,t,n);this._glyph.getAttribute(`icon-name`)!==r&&this._glyph.setAttribute(`icon-name`,r),this._buttonEl.setAttribute(`aria-label`,r),this._syncing=!0,this._rangeEl.min=String(t),this._rangeEl.max=String(n),this._rangeEl.step=String(this._state.adjustment.stepIncrement),this._rangeEl.value=String(e),this._rangeEl.setAttribute(`aria-valuemin`,String(t)),this._rangeEl.setAttribute(`aria-valuemax`,String(n)),this._rangeEl.setAttribute(`aria-valuenow`,String(e)),this._syncing=!1,this._minusEl.disabled=!(t<e),this._plusEl.disabled=!(e<n),this._buttonEl.classList.toggle(`flat`,!this.hasFrame),this.classList.toggle(`horizontal`,this.orientation===`horizontal`),this.classList.toggle(`vertical`,this.orientation===`vertical`)}_stepButton(e,t){let n=document.createElement(`button`);return n.type=`button`,n.className=`adw-button scale-button-step flat`,n.setAttribute(`aria-label`,t),n.appendChild(createGtkImage(e)),n}_toggleDock(){this.active?this._dock(`popdown`):this._dock(`popup`)}_dock(e){let t=e===`popup`;this.active!==t&&(this._buttonEl.classList.toggle(`checked`,t),this._buttonEl.setAttribute(`aria-expanded`,String(t)),t?(this._dockEl.popup(),this._rangeEl.focus()):(this._dockEl.popdown(),this._buttonEl.focus()),this.dispatchEvent(new CustomEvent(e,{bubbles:!0})),this.dispatchEvent(new CustomEvent(`notify::active`,{bubbles:!0,detail:{active:t}})))}_renderDock(e){this._dock(e?`popup`:`popdown`)}_step(e){this._applyValue(this._state.value+e*this._state.adjustment.pageIncrement)}_onKeyDown(e){if(e.key===`Escape`){if(!this.active)return;e.preventDefault(),this._dock(`popdown`);return}e.target===this._buttonEl&&(e.key!==` `&&e.key!==`Enter`&&e.key!==`Return`||(e.preventDefault(),this._toggleDock()))}};customElements.define(`gtk-scale-button`,GtkScaleButton);function selectIcon(e,t,n,r){let i=e[0];if(i===void 0||i===``)return`image-missing`;if(e.length===1)return i;if(e.length===2)return t<(r-n)/2+n?i:e[1]??i;if(t===n)return i;if(t===r)return e[1]??i;let a=(r-n)/(e.length-2);return e[Math.floor((t-n)/a)+2]??i}function parseIcons(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return[]}return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}var GtkSearchBar=class extends HTMLElement{_box;_center;_close;_initialized=!1;_capture=null;_onCapturedKey=e=>this._captureKey(e);_onInput=()=>this._revealFromTyping();static get observedAttributes(){return[`search-mode-enabled`,`show-close-button`]}get searchModeEnabled(){return this.hasAttribute(`search-mode-enabled`)}set searchModeEnabled(e){this.toggleAttribute(`search-mode-enabled`,!!e)}get showCloseButton(){return this.hasAttribute(`show-close-button`)}set showCloseButton(e){this.toggleAttribute(`show-close-button`,!!e)}get keyCaptureWidget(){return this._capture}set keyCaptureWidget(e){this._capture!==e&&(this._capture?.removeEventListener(`keydown`,this._onCapturedKey,!0),this._capture=e,this._capture?.addEventListener(`keydown`,this._onCapturedKey,!0))}get entry(){return this.querySelector(`input, textarea`)}connectedCallback(){this._initialized||(this._initialized=!0,this.setAttribute(`role`,`search`),this._center=document.createElement(`div`),this._center.className=`adw-search-bar-center`,this._center.append(...this.childNodes),this._close=document.createElement(`button`),this._close.className=`adw-search-bar-close`,this._close.type=`button`,this._close.setAttribute(`aria-label`,`Close search`),this._close.addEventListener(`click`,()=>this.searchModeEnabled=!1),this._box=document.createElement(`div`),this._box.className=`adw-search-bar-box`,this._box.append(this._center,this._close),this.replaceChildren(this._box),this.addEventListener(`input`,this._onInput),this.addEventListener(`keydown`,e=>{e.key===`Escape`&&(this.searchModeEnabled=!1)}),this._render())}disconnectedCallback(){this.keyCaptureWidget=null}attributeChangedCallback(e,t,n){if(this._initialized){if(e===`search-mode-enabled`){this._applyReveal(),this.dispatchEvent(new CustomEvent(`notify::search-mode-enabled`,{bubbles:!0,detail:{searchModeEnabled:this.searchModeEnabled}}));return}e===`show-close-button`&&(this._render(),this.dispatchEvent(new CustomEvent(`notify::show-close-button`,{bubbles:!0,detail:{showCloseButton:this.showCloseButton}})))}}_render(){let e=this.searchModeEnabled;this.classList.toggle(`revealed`,e),this._box.inert=!e,this._close.hidden=!this.showCloseButton}_applyReveal(){this._render();let e=this.entry;e!==null&&(this.searchModeEnabled?e.focus():e.value=``)}_revealFromTyping(){this.searchModeEnabled||(this.searchModeEnabled=!0,this.entry?.focus())}_captureKey(e){if(e.defaultPrevented||e.ctrlKey||e.altKey||e.metaKey||e.key.length!==1)return;let t=this.entry;if(this.searchModeEnabled=!0,t===null)return;e.preventDefault(),t.focus();let n=t.selectionStart??t.value.length,r=t.selectionEnd??n;t.setRangeText(e.key,n,r,`end`)}};customElements.define(`gtk-search-bar`,GtkSearchBar);var GtkSearchEntry=class extends GtkEntry{_searchIcon;_clear;_clearIcon;_timeout=null;static get observedAttributes(){return[...GtkEntry.observedAttributes,`search-delay`]}get searchDelay(){let e=Number.parseInt(this.getAttribute(`search-delay`)??``,10);return Number.isFinite(e)&&e>=0?e:150}set searchDelay(e){this.setAttribute(`search-delay`,String(e))}get _empty(){return this._input?this._input.value===``:this.getAttribute(`value`)===``}connectedCallback(){super.connectedCallback(),this._searchIcon=createGtkImage(`system-search-symbolic`,`adw-search-entry-icon`),this._clear=document.createElement(`button`),this._clear.type=`button`,this._clear.className=`adw-button flat circular icon-only adw-search-entry-clear`,this._clearIcon=createGtkImage(`edit-clear-symbolic`,`adw-search-entry-clear-icon`),this._clear.append(this._clearIcon),this._clear.title=`Clear Entry`,this._clear.setAttribute(`aria-label`,`Clear Entry`),this._clear.addEventListener(`click`,()=>{this._input.value=``,this._onChanged(),this._input.focus()}),this._clear.addEventListener(`mousedown`,e=>e.preventDefault()),this.replaceChildren(this._searchIcon,this._input,this._clear),this.setAttribute(`role`,`searchbox`),this._input.addEventListener(`input`,()=>this._onChanged()),this._input.addEventListener(`keydown`,e=>this._onKeyDown(e)),this._render()}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),e===`search-delay`&&this._clear&&this._cancel()}disconnectedCallback(){this._cancel(),super.disconnectedCallback()}_onChanged(){if(this._cancel(),this._empty){this._render(),this.dispatchEvent(new CustomEvent(`search-changed`,{bubbles:!0,detail:{value:``}}));return}this._render();let e=this.searchDelay;this._timeout=globalThis.setTimeout(()=>{this._timeout=null,this.dispatchEvent(new CustomEvent(`search-changed`,{bubbles:!0,detail:{value:this._input.value}}))},e)}_cancel(){this._timeout!==null&&(clearTimeout(this._timeout),this._timeout=null)}_onKeyDown(e){switch(e.key){case`Escape`:e.preventDefault(),this.dispatchEvent(new CustomEvent(`stop-search`,{bubbles:!0}));break;case`g`:if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault(),this.dispatchEvent(new CustomEvent(e.shiftKey?`previous-match`:`next-match`,{bubbles:!0}));break;default:return}}_render(){this._clear&&(this._clear.hidden=this._empty)}};customElements.define(`gtk-search-entry`,GtkSearchEntry);const Ni=[`always`,`never`,`automatic`,`external`],Pi=[`always`,`automatic`,`never`,`external`],Fi=[`top-left`,`top-right`,`bottom-left`,`bottom-right`];function normalizePolicy(e){return Ni.find(t=>t===e)??`automatic`}function normalizeCorner(e){return Fi.find(t=>t===e)??`top-left`}function sizeRequest(e){if(e===null)return null;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>=0?t:null}const Ii=[{key:`hadjustment`,bar:`horizontal`,policy:`hscrollbar-policy`,natural:`propagate-natural-width`,cssMin:`minWidth`,end:`left`,farEnd:`right`},{key:`vadjustment`,bar:`vertical`,policy:`vscrollbar-policy`,natural:`propagate-natural-height`,cssMin:`minHeight`,end:`top`,farEnd:`bottom`}];function resolveScrollKey(e){switch(e.key){case`ArrowLeft`:return e.ctrlKey?{scroll:`step-backward`,horizontal:!0}:null;case`ArrowRight`:return e.ctrlKey?{scroll:`step-forward`,horizontal:!0}:null;case`ArrowUp`:return e.ctrlKey?{scroll:`step-backward`,horizontal:!1}:null;case`ArrowDown`:return e.ctrlKey?{scroll:`step-forward`,horizontal:!1}:null;case`PageUp`:return{scroll:`page-backward`,horizontal:e.ctrlKey};case`PageDown`:return{scroll:`page-forward`,horizontal:e.ctrlKey};case`Home`:return{scroll:`start`,horizontal:e.ctrlKey};case`End`:return{scroll:`end`,horizontal:e.ctrlKey};default:return null}}var GtkScrolledWindow=class extends HTMLElement{_viewport;_bars=null;_wroteSizes=new Set;_shading=null;_observer=null;_hoverable=null;_fadeTimer=null;_built=!1;_standIn={};_adopted={};static get observedAttributes(){return[`hscrollbar-policy`,`vscrollbar-policy`,`window-placement`,`has-frame`,`min-content-width`,`min-content-height`,`max-content-width`,`max-content-height`,`overlay-scrolling`,`propagate-natural-width`,`propagate-natural-height`]}get hscrollbarPolicy(){return normalizePolicy(this.getAttribute(`hscrollbar-policy`))}set hscrollbarPolicy(e){this.setAttribute(`hscrollbar-policy`,e)}get vscrollbarPolicy(){return normalizePolicy(this.getAttribute(`vscrollbar-policy`))}set vscrollbarPolicy(e){this.setAttribute(`vscrollbar-policy`,e)}get_policy(){return[Pi.indexOf(this.hscrollbarPolicy),Pi.indexOf(this.vscrollbarPolicy)]}set_policy(e,t){let nick=(e,t)=>{let n=Number.isInteger(e)?Pi[e]:void 0;if(n===void 0)throw TypeError(`${e} is not a valid value for enum argument ${t}`);return n},n=nick(e,`hscrollbar_policy`),r=nick(t,`vscrollbar_policy`);this.hscrollbarPolicy=n,this.vscrollbarPolicy=r}get hadjustment(){return this._adopted.hadjustment??this._viewport?.hadjustment??(this._standIn.hadjustment??=new GtkAdjustment)}get vadjustment(){return this._adopted.vadjustment??this._viewport?.vadjustment??(this._standIn.vadjustment??=new GtkAdjustment)}get_hadjustment(){return this.hadjustment}get_vadjustment(){return this.vadjustment}set_hadjustment(e){this._adopted.hadjustment=e}set_vadjustment(e){this._adopted.vadjustment=e}get windowPlacement(){return normalizeCorner(this.getAttribute(`window-placement`))}set windowPlacement(e){this.setAttribute(`window-placement`,e)}get hasFrame(){return this.hasAttribute(`has-frame`)}set hasFrame(e){this.toggleAttribute(`has-frame`,!!e)}get overlayScrolling(){return this.getAttribute(`overlay-scrolling`)!==`false`}set overlayScrolling(e){this.toggleAttribute(`overlay-scrolling`,!!e)}get minContentWidth(){return sizeRequest(this.getAttribute(`min-content-width`))}set minContentWidth(e){this._writeSizeRequest(`min-content-width`,e)}get minContentHeight(){return sizeRequest(this.getAttribute(`min-content-height`))}set minContentHeight(e){this._writeSizeRequest(`min-content-height`,e)}get maxContentWidth(){return sizeRequest(this.getAttribute(`max-content-width`))}set maxContentWidth(e){this._writeSizeRequest(`max-content-width`,e)}get maxContentHeight(){return sizeRequest(this.getAttribute(`max-content-height`))}set maxContentHeight(e){this._writeSizeRequest(`max-content-height`,e)}get propagateNaturalWidth(){return this.hasAttribute(`propagate-natural-width`)}set propagateNaturalWidth(e){this.toggleAttribute(`propagate-natural-width`,!!e)}get propagateNaturalHeight(){return this.hasAttribute(`propagate-natural-height`)}set propagateNaturalHeight(e){this.toggleAttribute(`propagate-natural-height`,!!e)}hscrollbar(){return this._bars?.horizontal??null}vscrollbar(){return this._bars?.vertical??null}get viewport(){return this._viewport}connectedCallback(){if(!this._built){this._built=!0,this._viewport=document.createElement(`gtk-viewport`);let e=document.createElement(`gtk-scrollbar`),t=document.createElement(`gtk-scrollbar`);e.setAttribute(`orientation`,`horizontal`),t.setAttribute(`orientation`,`vertical`),this._bars={horizontal:e,vertical:t},bindSlottedChildren(this,[{into:this._viewport}]).install(this._viewport,t,e),this.setAttribute(`role`,`generic`),this._viewport.addEventListener(`value-changed`,this._onViewportValue);for(let n of[e,t])n.addEventListener(`value-changed`,this._onBarValue),n.addEventListener(`pointerenter`,this._onIndicatorOver),n.addEventListener(`pointerleave`,this._onIndicatorOut);this._observer=new ResizeObserver(()=>this._sync()),this._observer.observe(this._viewport),this._shading=new AdwScrollShading(this,{onOvershoot:e=>this._edgeOvershot(e)}),this._shading.connect()}this._releaseHoverable(),this._hoverable=matchMedia(`(hover: hover)`),this._hoverable.addEventListener(`change`,this._onHoverableChange),this.addEventListener(`keydown`,this._onKeyDown),this._sync()}disconnectedCallback(){this.removeEventListener(`keydown`,this._onKeyDown),this._releaseHoverable()}attributeChangedCallback(e,t,n){!this._built||!this.isConnected||(this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._normalized(e,n)}})),this._sync())}_normalized(e,t){switch(e){case`hscrollbar-policy`:return normalizePolicy(t);case`vscrollbar-policy`:return normalizePolicy(t);case`window-placement`:return normalizeCorner(t);case`overlay-scrolling`:return t!==`false`;case`has-frame`:return t!==null;case`propagate-natural-width`:case`propagate-natural-height`:return t!==null;default:return sizeRequest(t)}}_writeSizeRequest(e,t){t===null?this.removeAttribute(e):this.setAttribute(e,String(Math.max(0,Math.trunc(t))))}get _useIndicators(){return this.overlayScrolling&&(this._hoverable?.matches??!0)}_sync(){let e=this._bars;if(e===null||!this._viewport.isConnected||!e.vertical.isConnected)return;let t=this.windowPlacement,n=this._useIndicators;this.classList.toggle(`frame`,this.hasFrame),this.classList.toggle(t,!0);for(let e of Fi)e!==t&&this.classList.toggle(e,!1);this.classList.toggle(`overlay-scrolling`,n),this._writeSize(`min-width`,`min-content-width`),this._writeSize(`min-height`,`min-content-height`),this._writeSize(`max-width`,`max-content-width`),this._writeSize(`max-height`,`max-content-height`);for(let t of Ii){let r=e[t.bar],i=normalizePolicy(this.getAttribute(t.policy)),a=this._adjustment(t.key);r.hidden=!(i===`always`||i===`automatic`&&a.upper-a.lower>a.pageSize),r.classList.toggle(`overlay-indicator`,n),r.adjustment=a,this._viewport.style[t.cssMin]=this.hasAttribute(t.natural)?`max-content`:i===`never`?`min-content`:``}n||this._clearFade()}_writeSize(e,t){let n=sizeRequest(this.getAttribute(t));n===null?this._wroteSizes.has(e)&&this.style.removeProperty(e):this.style.setProperty(e,`${n}px`),n===null?this._wroteSizes.delete(e):this._wroteSizes.add(e)}_adjustment(e){return this._viewport[e]}_mayScroll(e){let t=this._bars;if(t===null)return null;let n=e?t.horizontal:t.vertical;return n.hidden?normalizePolicy(this.getAttribute(e?`hscrollbar-policy`:`vscrollbar-policy`))===`external`?n:null:n}_onViewportValue=e=>{let t=this._bars;if(t===null)return;let n=e.detail;for(let e of Ii){let r=n[e.key];t[e.bar].adjustment=r;let i=r.upper-r.pageSize;r.value<=r.lower?this._edgeReached(e.end):r.value>=i&&this._edgeReached(e.farEnd)}this._fadeIn()};_onBarValue=e=>{let t=e.currentTarget,n=e.detail.adjustment;t.hidden||this._viewport.scrollAxis(t.getAttribute(`orientation`)===`vertical`?`vertical`:`horizontal`,n.value)};_edgeReached(e){this.dispatchEvent(new CustomEvent(`edge-reached`,{bubbles:!0,detail:{pos:e}}))}_edgeOvershot(e){e!==0&&this.dispatchEvent(new CustomEvent(`edge-overshot`,{bubbles:!0,detail:{pos:e<0?`top`:`bottom`}}))}_onKeyDown=e=>{if(e.key===`Tab`&&e.ctrlKey){let t=e.shiftKey?`backward`:`forward`;this.dispatchEvent(new CustomEvent(`move-focus-out`,{bubbles:!0,detail:{directionType:t}}));return}let t=resolveScrollKey(e);if(t===null)return;let n=this._mayScroll(t.horizontal);n!==null&&(e.preventDefault(),n.scrollBy(t.scroll),this.dispatchEvent(new CustomEvent(`scroll-child`,{bubbles:!0,detail:{scroll:t.scroll,horizontal:t.horizontal}})))};_fadeIn(){let e=this._bars;if(!(e===null||!this._useIndicators)){for(let t of[e.horizontal,e.vertical])t.style.setProperty(`--adw-indicator-opacity`,`1`);this._fadeTimer!==null&&clearTimeout(this._fadeTimer),this._fadeTimer=setTimeout(()=>this._fadeOut(),2e3)}}_fadeOut(){this._fadeTimer=null;let e=this._bars;if(!(e===null||!this._useIndicators))for(let t of[e.horizontal,e.vertical])t.classList.contains(`hovering`)||t.style.setProperty(`--adw-indicator-opacity`,`0`)}_clearFade(){this._fadeTimer!==null&&clearTimeout(this._fadeTimer),this._fadeTimer=null;let e=this._bars;if(e!==null)for(let t of[e.horizontal,e.vertical])t.style.removeProperty(`--adw-indicator-opacity`)}_onIndicatorOver=e=>{e.currentTarget.classList.add(`hovering`),this._fadeIn()};_onIndicatorOut=e=>{e.currentTarget.classList.remove(`hovering`)};_onHoverableChange=()=>{this._sync()};_releaseHoverable(){this._hoverable?.removeEventListener(`change`,this._onHoverableChange),this._hoverable=null}};customElements.define(`gtk-scrolled-window`,GtkScrolledWindow);const Li=Object.freeze({value:0,lower:0,upper:0,stepIncrement:0,pageIncrement:0,pageSize:0});var GtkScrollbar=class extends HTMLElement{_trough;_slider;_observer=null;_built=!1;_adjustment=null;_grabPosition=0;_grabDelta=0;_zoom=!1;_dragging=!1;static get observedAttributes(){return[`orientation`,`adjustment`]}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this.setAttribute(`orientation`,e)}get adjustment(){return this._adjustment??Li}set adjustment(e){let t=e==null?null:typeof e==`string`?parseAdjustment(e):e;this._adjustment=t===null?null:normalizeAdjustment(t,this._adjustment??void 0),this._built&&(this._render(),this._notify(`adjustment`,{adjustment:this.adjustment}))}get value(){return this.adjustment.value}set value(e){let t=this._adjustment;if(t===null)return;let n=clampAdjustmentValue(t,e);n!==t.value&&(this._adjustment={...t,value:n},this._render(),this.dispatchEvent(new CustomEvent(`value-changed`,{bubbles:!0,detail:{adjustment:this._adjustment}})))}scrollBy(e){if(typeof e!=`string`)return;let t=this.adjustment;switch(e){case`step-forward`:this.value=t.value+t.stepIncrement;break;case`step-backward`:this.value=t.value-t.stepIncrement;break;case`page-forward`:this.value=t.value+t.pageIncrement;break;case`page-backward`:this.value=t.value-t.pageIncrement;break;case`start`:this.value=t.lower;break;case`end`:this.value=t.upper;break}}scrollByWheel(e,t){let n=t===1?48:100,r=n===0?0:e/n;this.scrollBy(r>=0?`page-forward`:`page-backward`)}get _troughLength(){return this.orientation===`vertical`?this._trough.clientHeight:this._trough.clientWidth}connectedCallback(){this._built||(this._built=!0,this._trough=document.createElement(`div`),this._trough.className=`adw-scrollbar-trough`,this._slider=document.createElement(`div`),this._slider.className=`adw-scrollbar-slider`,this._trough.appendChild(this._slider),this.replaceChildren(this._trough),this.addEventListener(`pointerdown`,this._onPointerDown),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`wheel`,this._onWheel,{passive:!0}),this.tabIndex=0,this._observer=new ResizeObserver(()=>this._render()),this._observer.observe(this._trough),this.setAttribute(`role`,`scrollbar`)),this.hasAttribute(`adjustment`)&&(this.adjustment=this.getAttribute(`adjustment`)),this._render()}attributeChangedCallback(e,t,n){if(!(!this._built||!this.isConnected)){if(e===`adjustment`){this.adjustment=n;return}this._notify(`orientation`,{orientation:this.orientation}),this._render()}}_notify(e,t){this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:t}))}_onPointerDown=e=>{if(!this.hasAttribute(`tabindex`))return;this.focus();let t=this._coordinate(e),n=e.target===this._slider;this._grabPosition=this._sliderPosition(),this._grabDelta=t-this._grabPosition,this._setZoom(n&&e.shiftKey),this._dragging=n,this._capture(e.pointerId),this.addEventListener(`pointermove`,this._onPointerMove),this.addEventListener(`pointerup`,this._onPointerEnd),this.addEventListener(`pointercancel`,this._onPointerEnd),!n&&(e.button===0&&!e.shiftKey?this.value=this._coordinateValue(t+this._sliderSize()/2):(e.button===1||e.button===0&&e.shiftKey)&&this.scrollBy(this._coordinateValue(t)>this.value?`page-forward`:`page-backward`))};_onPointerMove=e=>{if(!this._dragging)return;this._setZoom(e.shiftKey);let t=this._coordinate(e),n=this._zoom?this._zoomFactor():1;this.value=this._coordinateValue(this._grabPosition+n*(t-(this._grabDelta+this._grabPosition)))};_onPointerEnd=e=>{this._endDrag(e.pointerId)};_endDrag(e){this._dragging=!1,this._setZoom(!1),e!==void 0&&this.hasPointerCapture(e)&&this.releasePointerCapture(e),this.removeEventListener(`pointermove`,this._onPointerMove),this.removeEventListener(`pointerup`,this._onPointerEnd),this.removeEventListener(`pointercancel`,this._onPointerEnd)}_capture(e){try{this.setPointerCapture(e)}catch{}}_onKeyDown=e=>{let t=resolveRangeKey(e,this.orientation===`vertical`);t!==null&&(e.preventDefault(),this.scrollBy(t))};_onWheel=e=>{e.target!==this&&e.target!==this._trough||this.scrollByWheel(e.deltaY,e.deltaMode)};_setZoom(e){this._zoom!==e&&(this._zoom=e,this.classList.toggle(`fine-tune`,e))}_zoomFactor(){let e=this.adjustment,t=e.upper-e.lower-e.pageSize,n=t<=0?1:Math.min(1,this._troughLength/t);return n===1?.25:n}_render(){if(!this._built)return;let e=this.adjustment,t=this.orientation===`vertical`;this.classList.toggle(`vertical`,t),this.classList.toggle(`horizontal`,!t),this.setAttribute(`aria-orientation`,this.orientation),this.removeAttribute(`aria-disabled`),this.removeAttribute(`disabled`);let n=this._troughLength,r=e.upper-e.lower,i=r-e.pageSize;if(r===0)this._slider.style.removeProperty(`--adw-scrollbar-size`);else{let t=Math.min(n,n*(e.pageSize/r));this._slider.style.setProperty(`--adw-scrollbar-size`,`${t}px`)}let a=this._sliderSize(),o=Math.max(0,n-a),s=i===0?0:o*((e.value-e.lower)/i);this.setAttribute(`aria-valuemin`,String(e.lower)),this.setAttribute(`aria-valuemax`,String(e.upper-e.pageSize)),this.setAttribute(`aria-valuenow`,String(e.value)),this._slider.style.setProperty(`--adw-scrollbar-position`,`${s}px`)}_sliderPosition(){return Number.parseFloat(this._slider.style.getPropertyValue(`--adw-scrollbar-position`))||0}_sliderSize(){return Number.parseFloat(this._slider.style.getPropertyValue(`--adw-scrollbar-size`))||0}_coordinateValue(e){let t=this.adjustment,n=Math.max(1,this._troughLength-this._sliderSize()),r=Math.min(1,Math.max(0,e/n));return t.lower+r*(t.upper-t.pageSize-t.lower)}_coordinate(e){let t=this._trough.getBoundingClientRect();return this.orientation===`vertical`?e.clientY-t.top:e.clientX-t.left}};function resolveRangeKey(e,t){switch(e.key){case`ArrowRight`:return t?null:`step-forward`;case`ArrowLeft`:return t?null:`step-backward`;case`ArrowDown`:return t?`step-forward`:null;case`ArrowUp`:return t?`step-backward`:null;case`PageDown`:return`page-forward`;case`PageUp`:return`page-backward`;case`Home`:return`start`;case`End`:return`end`;default:return null}}customElements.define(`gtk-scrollbar`,GtkScrollbar);const K=1e-10,Ri=[`always`,`if-valid`];var GtkSpinButton=class extends HTMLElement{_range=new SpinState;_input;_down;_up;_initialized=!1;_edited=!1;_vertical=null;_initialTimer=null;_repeatTimer=null;_timerCalls=0;_timerStep=0;static get observedAttributes(){return[`adjustment`,`climb-rate`,`digits`,`disabled`,`numeric`,`orientation`,`snap-to-ticks`,`update-policy`,`value`,`wrap`]}get adjustment(){return this._range.adjustment}set adjustment(e){this._range.configure(typeof e==`string`?parseAdjustment(e):e),this._render()}get value(){return this._range.value}set value(e){this._range.setValue(e),this._render()}get digits(){let e=Number.parseInt(this.getAttribute(`digits`)??``,10);return Number.isFinite(e)?Math.max(0,e):0}set digits(e){this.setAttribute(`digits`,String(e))}get numeric(){return this.hasAttribute(`numeric`)}set numeric(e){this.toggleAttribute(`numeric`,!!e)}get snapToTicks(){return this.hasAttribute(`snap-to-ticks`)}set snapToTicks(e){this.toggleAttribute(`snap-to-ticks`,!!e)}get wrap(){return this.hasAttribute(`wrap`)}set wrap(e){this.toggleAttribute(`wrap`,!!e)}get updatePolicy(){let e=this.getAttribute(`update-policy`);return Ri.includes(e)?e:`always`}set updatePolicy(e){this.setAttribute(`update-policy`,e)}get climbRate(){let e=Number.parseFloat(this.getAttribute(`climb-rate`)??``);return Number.isFinite(e)&&e>0?e:0}set climbRate(e){this.setAttribute(`climb-rate`,String(e))}get text(){return this._input}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=normalizeAdjustment(parseAdjustment(this.getAttribute(`adjustment`))),t=this.getAttribute(`value`),n=t===null?NaN:Number.parseFloat(t);this._range.configure(Number.isFinite(n)?{...e,value:n}:e),this._input=document.createElement(`input`),this._input.className=`adw-spin-button-text`,this._input.type=`text`,this._input.inputMode=`decimal`,this._input.autocomplete=`off`,this._input.spellcheck=!1,this._down=document.createElement(`button`),this._down.type=`button`,this._down.className=`adw-button image-button down`,this._down.append(createGtkImage(`value-decrease-symbolic`)),this._down.setAttribute(`aria-label`,`Decrease`),this._up=document.createElement(`button`),this._up.type=`button`,this._up.className=`adw-button image-button up`,this._up.append(createGtkImage(`value-increase-symbolic`)),this._up.setAttribute(`aria-label`,`Increase`),this._down.addEventListener(`click`,()=>this._spin(-this._range.adjustment.stepIncrement)),this._up.addEventListener(`click`,()=>this._spin(this._range.adjustment.stepIncrement)),this._hold(this._down,-1),this._hold(this._up,1),this._input.addEventListener(`input`,()=>{this._edited=!0,this.numeric&&this._rejectNonNumeric()}),this._input.addEventListener(`change`,()=>this._update()),this._input.addEventListener(`keydown`,e=>this._onKeyDown(e)),this.setAttribute(`role`,`spinbutton`),this.replaceChildren(this._input,this._down,this._up),this._range.subscribe(e=>{this._render(),this.dispatchEvent(new CustomEvent(`value-changed`,{bubbles:!0,detail:{value:e.value}}))}),this._range.subscribeChanged(()=>this._render()),this._render()}attributeChangedCallback(e){if(this._initialized){if(e===`adjustment`){this._range.configure(parseAdjustment(this.getAttribute(`adjustment`)));return}if(e===`value`){this._range.setValue(Number.parseFloat(this.getAttribute(`value`)??`0`));return}this._render()}}_spin(e){let t=this.adjustment,n=t.value+e,r=!1;e>0?this.wrap?Math.abs(t.value-t.upper)<K?(n=t.lower,r=!0):n>t.upper&&(n=t.upper):n=Math.min(n,t.upper):e<0&&(this.wrap?Math.abs(t.value-t.lower)<K?(n=t.upper,r=!0):n<t.lower&&(n=t.lower):n=Math.max(n,t.lower)),Math.abs(n-t.value)>K&&this._range.setValueInteractive(n),r&&this.dispatchEvent(new CustomEvent(`wrapped`,{bubbles:!0}))}_update(){let e=this.adjustment,t=Number.parseFloat(this._input.value),n=this._input.value.trim()!==``&&Number.isNaN(t);if(this.updatePolicy===`always`){let r=glibClamp(n||!Number.isFinite(t)?e.value:t,e.lower,e.upper-e.pageSize);this._commit(this.snapToTicks?snapAdjustmentValue(e,r):r);return}if(n||!Number.isFinite(t)||t<e.lower||t>e.upper){this._render(),this.dispatchEvent(new CustomEvent(`value-changed`,{bubbles:!0,detail:{value:this._range.value}}));return}this._commit(this.snapToTicks?snapAdjustmentValue(e,t):t)}_commit(e){this._range.setValue(e),this._edited=!1,this._render()}_rejectNonNumeric(){let e=this.digits,t=!1,n=!1,r=``;for(let i of this._input.value){if(i===`-`||i===`+`){if(t||r!==``)return this._resetText();t=!0,r+=i;continue}if(i===`.`){if(!e||n)return this._resetText();n=!0,r+=i;continue}if(i<`0`||i>`9`)return this._resetText();r+=i}r!==this._input.value&&(this._input.value=r)}_resetText(){this._input.value=this._formatted()}_hold(e,t){let begin=e=>{e.button!==0||this.hasAttribute(`disabled`)||(this._timerStep=this._range.adjustment.stepIncrement,this._timerCalls=0,this._spin(t*this._timerStep),this._initialTimer=globalThis.setTimeout(()=>{this._initialTimer=null,this._spin(t*this._timerStep),this._repeatTimer=globalThis.setInterval(()=>this._tick(t),50)},500))},end=()=>this._stopHold();e.addEventListener(`pointerdown`,begin),e.addEventListener(`pointerup`,end),e.addEventListener(`pointerleave`,end),e.addEventListener(`pointercancel`,end)}_tick(e){this._spin(e*this._timerStep);let t=this._range.adjustment;this.climbRate>0&&this._timerStep<t.pageIncrement&&(this._timerCalls<5?this._timerCalls+=1:(this._timerCalls=0,this._timerStep+=this.climbRate))}_stopHold(){this._initialTimer!==null&&(clearTimeout(this._initialTimer),this._initialTimer=null),this._repeatTimer!==null&&(clearInterval(this._repeatTimer),this._repeatTimer=null),this._timerCalls=0,this._timerStep=0}_onKeyDown(e){let t=this._range.adjustment,n=t.stepIncrement,r=t.pageIncrement,i=null;switch(e.key){case`ArrowUp`:i=n;break;case`ArrowDown`:i=-n;break;case`PageUp`:i=r;break;case`PageDown`:i=-r;break;case`Enter`:{let e=this._edited;this._update(),e||this.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0}));return}default:return}e.preventDefault(),this._spin(i)}_formatted(){return formatScaleValue(this._range.value,this.digits)}_render(){if(!this._input)return;let e=this.adjustment,t=this.getAttribute(`orientation`)===`vertical`;this.classList.toggle(`vertical`,t),this.classList.toggle(`horizontal`,!t),t!==this._vertical&&(this._vertical=t,t?this.replaceChildren(this._up,this._input,this._down):this.replaceChildren(this._input,this._down,this._up)),this._input.disabled=this.hasAttribute(`disabled`),this._input.size=10,document.activeElement!==this._input&&this._input.value!==this._formatted()&&(this._input.value=this._formatted()),this._up.disabled=!this.wrap&&e.upper-e.value<=K,this._down.disabled=!this.wrap&&e.value-e.lower<=K,this.setAttribute(`aria-valuemin`,String(e.lower)),this.setAttribute(`aria-valuemax`,String(e.upper-e.pageSize)),this.setAttribute(`aria-valuenow`,String(e.value)),this.hasAttribute(`disabled`)?this.setAttribute(`aria-disabled`,`true`):this.removeAttribute(`aria-disabled`)}};customElements.define(`gtk-spin-button`,GtkSpinButton);const zi=`http://www.w3.org/2000/svg`;var GtkSpinner=class extends HTMLElement{_initialized=!1;static get observedAttributes(){return[`spinning`,`disabled`]}get spinning(){return this.hasAttribute(`spinning`)}set spinning(e){this.toggleAttribute(`spinning`,!!e)}start(){this.spinning=!0,this.setAttribute(`aria-busy`,`true`)}stop(){this.spinning=!1,this.setAttribute(`aria-busy`,`false`)}connectedCallback(){if(this._initialized){this._render();return}this._initialized=!0;let e=document.createElementNS(zi,`svg`);e.setAttribute(`viewBox`,`0 0 16 16`),e.setAttribute(`class`,`adw-spinner-ring`);let t=document.createElementNS(zi,`circle`);t.setAttribute(`cx`,`8`),t.setAttribute(`cy`,`8`),t.setAttribute(`r`,`7`),t.setAttribute(`class`,`adw-spinner-track`);let n=document.createElementNS(zi,`path`);n.setAttribute(`d`,`M 1 8 A 7 7 0 0 1 8 1`),n.setAttribute(`class`,`adw-spinner-arc`),e.append(t,n),this.replaceChildren(e),this.setAttribute(`role`,`progressbar`),this._render()}attributeChangedCallback(e){this._initialized&&(this._render(),e===`spinning`&&this.dispatchEvent(new CustomEvent(`notify::spinning`,{bubbles:!0,detail:{spinning:this.spinning}})))}_render(){this.classList.toggle(`checked`,this.spinning)}};customElements.define(`gtk-spinner`,GtkSpinner);const Bi=[`none`,`crossfade`,`slide-right`,`slide-left`,`slide-up`,`slide-down`,`slide-left-right`,`slide-up-down`,`over-up`,`over-down`,`over-left`,`over-right`,`under-up`,`under-down`,`under-left`,`under-right`,`over-up-down`,`over-down-up`,`over-left-right`,`over-right-left`,`rotate-left`,`rotate-right`,`rotate-left-right`],Vi=new Set([`slide-left-right`,`slide-up-down`,`over-up-down`,`over-down-up`,`over-left-right`,`over-right-left`,`rotate-left-right`]),Hi={"slide-left":`slide-right`,"slide-right":`slide-left`,"rotate-left":`rotate-right`,"rotate-right":`rotate-left`,"over-left":`over-right`,"over-right":`over-left`,"under-left":`under-right`,"under-right":`under-left`};function simpleTransitionType(e,t){switch(t){case`slide-left-right`:return e?`slide-right`:`slide-left`;case`rotate-left-right`:return e?`rotate-right`:`rotate-left`;case`slide-up-down`:return e?`slide-down`:`slide-up`;case`over-up-down`:return e?`under-down`:`over-up`;case`over-down-up`:return e?`under-up`:`over-down`;case`over-left-right`:return e?`under-right`:`over-left`;case`over-right-left`:return e?`under-left`:`over-right`;default:return t}}const Ui=[`name`,`title`,`icon-name`,`use-underline`,`needs-attention`];var GtkStack=class extends HTMLElement{static signals={"notify::visible-child":`notify::visible-child`,"notify::visible-child-name":`notify::visible-child-name`};_visible=null;_lastVisible=null;_initialized=!1;_initializedChildren=new WeakSet;_observer=null;_timer=null;_running=!1;static get observedAttributes(){return[`visible-child-name`,`transition-type`,`transition-duration`,`hhomogeneous`,`vhomogeneous`,`interpolate-size`]}get visibleChildName(){return this.getAttribute(`visible-child-name`)}set visibleChildName(e){this._write(`visible-child-name`,e)}get visibleChild(){return this._visible}set visibleChild(e){this.setVisibleChild(e)}get transitionType(){let e=this.getAttribute(`transition-type`);return e!==null&&Bi.includes(e)?e:`none`}set transitionType(e){this._write(`transition-type`,e)}get transitionDuration(){return this._duration()}set transitionDuration(e){this._write(`transition-duration`,String(e))}get hhomogeneous(){return this._flag(`hhomogeneous`,!0)}set hhomogeneous(e){this._write(`hhomogeneous`,e?``:`false`)}get vhomogeneous(){return this._flag(`vhomogeneous`,!0)}set vhomogeneous(e){this._write(`vhomogeneous`,e?``:`false`)}get interpolateSize(){return this.hasAttribute(`interpolate-size`)}set interpolateSize(e){this.toggleAttribute(`interpolate-size`,!!e)}get transitionRunning(){return this.hasAttribute(`transition-running`)}get pages(){return this._children().map(e=>this._page(e))}getChildByName(e){return this._children().find(t=>this._page(t).name===e)??null}getPage(e){return this._children().includes(e)?this._page(e):null}isSelected(e){return this._visible===e}addTitled(e,t,n){return t!==null&&e.setAttribute(`name`,t),n!=null&&e.setAttribute(`title`,n),this.addChild(e)}addNamed(e,t){return this.addTitled(e,t)}addChild(e){return this.appendChild(e),this._initChild(e),this._initialized&&!this._visible&&!e.hasAttribute(`hidden`)&&this._show(e),e}removePage(e){e.remove()}setVisibleChild(e,t){return e?this._children().includes(e)?this._show(e,t):!1:this._show(this._firstVisible(),t)}setVisibleChildName(e){if(e===null)return!1;let t=this._children().find(t=>this._page(t).name===e);return t?this._show(t):!1}connectedCallback(){if(this._initialized){this._render();return}this._initialized=!0,this.setAttribute(`role`,`group`);for(let e of this._children())this._initChild(e);this._observer=new MutationObserver(e=>this._onChildMutations(e)),this._observer.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[...Ui,`hidden`]}),this._visible||this._show(this._firstVisible()),this._render()}disconnectedCallback(){this._observer?.disconnect(),this._observer=null,this._timer!==null&&clearTimeout(this._timer),this._timer=null,this._initialized=!1}attributeChangedCallback(e){if(this._initialized){if(e===`visible-child-name`){this.setVisibleChildName(this.getAttribute(`visible-child-name`));return}this._render(),this._notify(e)}}_property(e){switch(e){case`transition-type`:return this.transitionType;case`transition-duration`:return this.transitionDuration;case`hhomogeneous`:return this.hhomogeneous;case`vhomogeneous`:return this.vhomogeneous;case`interpolate-size`:return this.interpolateSize;default:return this.visibleChildName}}_notify(e){this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}}))}_write(e,t){t===null?this.removeAttribute(e):this.getAttribute(e)!==t&&this.setAttribute(e,t)}_flag(e,t){let n=this.getAttribute(e);return n===null?t:n!==`false`}_duration(){let e=this.getAttribute(`transition-duration`);if(e===null)return 200;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:0}_children(){return Array.from(this.children)}_page(e){return{name:e.getAttribute(`name`)??``,title:e.getAttribute(`title`),iconName:e.getAttribute(`icon-name`),useUnderline:e.hasAttribute(`use-underline`),needsAttention:e.hasAttribute(`needs-attention`),visible:!e.hasAttribute(`hidden`),child:e}}_firstVisible(){return this._children().find(e=>this._page(e).visible)??null}_initChild(e){this._initializedChildren.has(e)||(this._initializedChildren.add(e),e.classList.add(`adw-stack-page`))}_onChildMutations(e){let t=0,n=0,r=-1,i=!1;for(let a of e){if(a.type===`childList`){for(let e of Array.from(a.removedNodes))e===this._visible&&(this._visible=null),e===this._lastVisible&&(this._lastVisible=null),n+=1;for(let e of Array.from(a.addedNodes))e instanceof HTMLElement&&(this._initChild(e),t+=1,r===-1&&(r=this._children().indexOf(e)));continue}let e=a.attributeName;if(e){if(e===`hidden`){this._show(this._firstVisible());continue}Ui.includes(e)&&(i=!0)}}if((n>0||t>0)&&this.dispatchEvent(new CustomEvent(`items-changed`,{bubbles:!0,detail:{position:r===-1?this._children().length:r,removed:n,added:t}})),i){for(let t of e){if(t.type!==`attributes`)continue;let e=t.target;this.dispatchEvent(new CustomEvent(`page-updated`,{bubbles:!0,detail:{child:e}})),e===this._visible&&t.attributeName===`name`&&(this._write(`visible-child-name`,this._nameOrNull(this._page(e).name)),this.dispatchEvent(new CustomEvent(`notify::visible-child-name`,{bubbles:!0,detail:{"visible-child-name":this.visibleChildName}})))}this._render()}}_nameOrNull(e){return e===``?null:e}_show(e,t){if(!e)return!1;let n=this._page(e);if(!n.visible||this._visible===e)return!1;let r=this._visible;if(this._visible=e,this._write(`visible-child-name`,this._nameOrNull(n.name)),this._lastVisible=r,this._render(),this.dispatchEvent(new CustomEvent(`notify::visible-child`,{bubbles:!0,detail:{"visible-child":e}})),this.dispatchEvent(new CustomEvent(`notify::visible-child-name`,{bubbles:!0,detail:{"visible-child-name":this.visibleChildName}})),r){let t=Math.min(this._children().indexOf(r),this._children().indexOf(e));this.dispatchEvent(new CustomEvent(`selection-changed`,{bubbles:!0,detail:{position:t,nItems:2}}))}else this.dispatchEvent(new CustomEvent(`selection-changed`,{bubbles:!0,detail:{position:this._children().indexOf(e),nItems:1}}));return this._startTransition(r,t??this.transitionType),!0}_startTransition(e,t){this._timer!==null&&(clearTimeout(this._timer),this._timer=null);let n=this._effectiveType(t);if(Vi.has(n)&&!e?n=`none`:Vi.has(n)&&e&&(n=simpleTransitionType(this._newChildFirst(e),n)),n===`none`||!e||this._duration()===0){this._running=!1,this.removeAttribute(`transition-running`),this.classList.remove(`transitioning`),this._lastVisible=null,this._render();return}this.dataset.transitionType=n,this._running=!0,this.setAttribute(`transition-running`,``),this.classList.add(`transitioning`),this._render(),this.dispatchEvent(new CustomEvent(`transition-start`,{bubbles:!0,detail:{duration:this._duration()}})),this._timer=setTimeout(()=>{this._timer=null,this._running=!1,this.removeAttribute(`transition-running`),this.classList.remove(`transitioning`),delete this.dataset.transitionType,this._lastVisible=null,this._render(),this.dispatchEvent(new CustomEvent(`transition-end`,{bubbles:!0}))},this._duration())}_newChildFirst(e){let t=this._children();return t.indexOf(this._visible)<t.indexOf(e)}_effectiveType(e){let t=e;return t!==`none`&&(this._reducedMotion()?t=this.hhomogeneous&&this.vhomogeneous?`crossfade`:`none`:this.getAttribute(`dir`)===`rtl`&&(t=Hi[t]??t)),t}_reducedMotion(){return typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches}_render(){if(this._initialized){for(let e of this._children()){let t=e===this._visible;e.classList.toggle(`visible-page`,t),e.classList.toggle(`transitioning-in`,t&&this._running),e.classList.toggle(`transitioning-out`,!t&&e===this._lastVisible&&this._running),t?e.removeAttribute(`aria-hidden`):e.setAttribute(`aria-hidden`,`true`)}this.style.setProperty(`--stack-transition-duration`,`${this._duration()}ms`)}}};customElements.define(`gtk-stack`,GtkStack);var GtkStackSidebar=class extends HTMLElement{_stack=null;_list;_initialized=!1;_rows=[];_onStackChange=()=>this._rebuild();static get observedAttributes(){return[`stack`]}get stack(){return this._stack}set stack(e){this.setStack(typeof e==`string`?this._resolve(e):e)}refresh(){this._rebuild()}connectedCallback(){if(this._initialized){this._bindStack(),this._rebuild();return}this._initialized=!0,this._list=document.createElement(`div`),this._list.className=`adw-stack-sidebar-list navigation-sidebar`,this._list.setAttribute(`role`,`listbox`),this._list.setAttribute(`aria-label`,`Sidebar`),this.replaceChildren(this._list),this.classList.add(`sidebar`);let e=this.getAttribute(`stack`);if(e){this.setStack(this._resolve(e));return}this._rebuild()}disconnectedCallback(){this._unbindStack()}attributeChangedCallback(e,t,n){!this._initialized||e!==`stack`||this.setStack(n===null?null:this._resolve(n))}setStack(e){e!==this._stack&&(this._unbindStack(),this._stack=e,this._bindStack(),this._rebuild(),this.dispatchEvent(new CustomEvent(`notify::stack`,{bubbles:!0,detail:{stack:this._stack}})))}_resolve(e){return e?document.getElementById(e)??null:null}_bindStack(){this._stack?.addEventListener(`items-changed`,this._onStackChange),this._stack?.addEventListener(`selection-changed`,this._onStackChange),this._stack?.addEventListener(`page-updated`,this._onStackChange)}_unbindStack(){this._stack?.removeEventListener(`items-changed`,this._onStackChange),this._stack?.removeEventListener(`selection-changed`,this._onStackChange),this._stack?.removeEventListener(`page-updated`,this._onStackChange)}_pages(){return this._stack?.pages??[]}_visible(e){return e.visible&&e.title!==null}_selectedIndex(){let e=this._pages(),t=this._stack?.visibleChildName??null;return t===null?-1:e.findIndex(e=>e.name===t)}_rebuild(){if(!this._initialized)return;let e=this._pages();e.length!==this._rows.length&&(this._list.replaceChildren(),this._rows=e.map(()=>this._buildRow()),this._list.append(...this._rows));let t=this._selectedIndex();e.forEach((e,n)=>{let r=this._rows[n];if(!r)return;let i=r.querySelector(`.adw-stack-sidebar-title`);i&&(i.textContent=e.title??``),r.hidden=!this._visible(e),r.classList.toggle(`needs-attention`,e.needsAttention),r.classList.toggle(`selected`,n===t),r.setAttribute(`aria-selected`,String(n===t))})}_buildRow(){let e=document.createElement(`button`);e.type=`button`,e.className=`adw-stack-sidebar-row`,e.setAttribute(`role`,`link`);let t=document.createElement(`span`);return t.className=`adw-stack-sidebar-title`,e.appendChild(t),e.addEventListener(`click`,()=>this._onRowActivated(e)),e}_onRowActivated(e){let t=this._rows.findIndex(t=>t===e);if(t===-1)return;let n=this._pages()[t];n&&(this._stack?.isSelected(n.child)||this._stack?.setVisibleChild(n.child))}};customElements.define(`gtk-stack-sidebar`,GtkStackSidebar);var GtkStackSwitcher=class extends HTMLElement{_stack=null;_initialized=!1;_nodes=[];_onStackChange=()=>this._rebuild();static get observedAttributes(){return[`stack`,`orientation`]}get stack(){return this._stack}set stack(e){this.setStack(typeof e==`string`?this._resolve(e):e)}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this.getAttribute(`orientation`)!==e&&this.setAttribute(`orientation`,e)}refresh(){this._rebuild()}connectedCallback(){if(this._initialized){this._bindStack(),this._rebuild();return}this._initialized=!0,this.setAttribute(`role`,`tablist`),this.classList.add(`linked`);let e=this.getAttribute(`stack`);if(e){this.setStack(this._resolve(e));return}this._rebuild()}disconnectedCallback(){this._unbindStack()}attributeChangedCallback(e,t,n){if(this._initialized){if(e===`orientation`){this._render(),this.dispatchEvent(new CustomEvent(`notify::orientation`,{bubbles:!0,detail:{orientation:this.orientation}}));return}this.setStack(n===null?null:this._resolve(n))}}setStack(e){e!==this._stack&&(this._unbindStack(),this._stack=e,this._bindStack(),this._rebuild(),this.dispatchEvent(new CustomEvent(`notify::stack`,{bubbles:!0,detail:{stack:this._stack}})))}_resolve(e){return e?document.getElementById(e)??null:null}_bindStack(){this._stack?.addEventListener(`items-changed`,this._onStackChange),this._stack?.addEventListener(`selection-changed`,this._onStackChange),this._stack?.addEventListener(`page-updated`,this._onStackChange)}_unbindStack(){this._stack?.removeEventListener(`items-changed`,this._onStackChange),this._stack?.removeEventListener(`selection-changed`,this._onStackChange),this._stack?.removeEventListener(`page-updated`,this._onStackChange)}_visible(e){return e.visible&&(e.title!==null||e.iconName!==null)}_pages(){return this._stack?.pages??[]}_selectedIndex(){let e=this._pages(),t=this._stack?.visibleChildName??null;return t===null?-1:e.findIndex(e=>e.name===t)}_rebuild(){if(!this._initialized)return;let e=this._pages();e.length!==this._nodes.length&&(this.replaceChildren(),this._nodes=e.map(()=>this._buildButton()),this.append(...this._nodes.map(e=>e.button)));let t=this._selectedIndex();e.forEach((e,n)=>{let r=this._nodes[n];if(!r)return;r.button.hidden=!this._visible(e),r.button.classList.toggle(`active`,n===t),r.button.setAttribute(`aria-selected`,String(n===t)),r.button.classList.toggle(`needs-attention`,e.needsAttention);let i=e.iconName!==null,a=e.title!==null;r.icon.hidden=!i,r.label.hidden=!a,r.label.textContent=e.title??``,r.button.dataset.buttonMode=i?a?`both`:`icon`:`text`,i?(r.icon.setAttribute(`icon-name`,e.iconName),this.title=e.title??``):(r.icon.removeAttribute(`icon-name`),this.removeAttribute(`title`))}),this._render()}_buildButton(){let e=document.createElement(`button`);e.type=`button`,e.className=`adw-stack-switcher-button`,e.setAttribute(`role`,`tab`);let t=document.createElement(`span`);t.className=`adw-stack-switcher-icon`,t.setAttribute(`aria-hidden`,`true`);let n=document.createElement(`span`);return n.className=`adw-stack-switcher-title`,e.append(t,n),e.addEventListener(`click`,()=>this._onToggled(e)),{button:e,label:n,icon:t}}_onToggled(e){let t=this._nodes.findIndex(t=>t.button===e);if(t===-1)return;let n=this._pages()[t];n&&(this._stack?.isSelected(n.child)||this._stack?.setVisibleChild(n.child))}_render(){this.setAttribute(`aria-orientation`,this.orientation)}};customElements.define(`gtk-stack-switcher`,GtkStackSwitcher);var GtkText=class extends HTMLElement{_input;_initialized=!1;_maxLength=0;static get observedAttributes(){return[`text`,`editable`,`placeholder-text`,`max-length`,`visibility`,`propagate-text-width`]}get text(){return this._input?this._input.value:this.getAttribute(`text`)??``}set text(e){let t=clampEntryText(e??``,this._maxLength);this._input?this._input.value=t:this.setAttribute(`text`,t),this._resizeToText()}get editable(){return readBooleanAttribute(this,`editable`,!0)}set editable(e){writeBooleanAttribute(this,`editable`,e,!0)}get placeholderText(){return this.getAttribute(`placeholder-text`)??``}set placeholderText(e){this.setAttribute(`placeholder-text`,e??``)}get maxLength(){return this._maxLength}set maxLength(e){this._maxLength=Number.isFinite(e)?Math.min(it,Math.max(0,Math.trunc(e))):0,this._input&&(this._input.value=clampEntryText(this._input.value,this._maxLength))}get visibility(){return readBooleanAttribute(this,`visibility`,!0)}set visibility(e){writeBooleanAttribute(this,`visibility`,e,!0)}get propagateTextWidth(){return readBooleanAttribute(this,`propagate-text-width`,!1)}set propagateTextWidth(e){writeBooleanAttribute(this,`propagate-text-width`,e,!1)}get textLength(){return entryTextLength(this.text)}get input(){return this._input}connectedCallback(){if(this._initialized)return;this._initialized=!0,this._maxLength=Number(this.getAttribute(`max-length`)??0);let e=document.createElement(`input`);e.className=`adw-text`,e.type=this.visibility?`text`:`password`,e.value=clampEntryText(this.getAttribute(`text`)??``,this._maxLength),e.placeholder=this.placeholderText,e.readOnly=!this.editable,e.addEventListener(`input`,()=>{let t=clampEntryText(e.value,this._maxLength);t!==e.value&&(e.value=t),this._resizeToText()}),e.addEventListener(`keydown`,t=>{t.key===`Enter`&&this.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0,detail:{text:e.value}}))}),this._input=e,this.replaceChildren(e),this._render()}attributeChangedCallback(e,t,n){if(!this._initialized){e===`max-length`&&(this._maxLength=Number(n??0));return}e===`text`?this._input.value=clampEntryText(n??``,this._maxLength):e===`placeholder-text`?this._input.placeholder=n??``:e===`max-length`?(this._maxLength=Number(n??0),this._input.value=clampEntryText(this._input.value,this._maxLength)):e===`editable`?this._input.readOnly=!this.editable:e===`visibility`&&(this._input.type=this.visibility?`text`:`password`),this._resizeToText(),this._reflectReadOnly()}_render(){this._resizeToText(),this._reflectReadOnly()}_reflectReadOnly(){this.classList.toggle(`read-only`,!this.editable)}_resizeToText(){let e=this.propagateTextWidth;this.classList.toggle(`propagate-text-width`,e),this._input&&e&&(this._input.size=Math.max(1,entryTextLength(this._input.value)))}};function readBooleanAttribute(e,t,n){let r=e.getAttribute(t);return r===null?n:r!==`false`}function writeBooleanAttribute(e,t,n,r){n===r?e.removeAttribute(t):e.setAttribute(t,n?`true`:`false`)}customElements.define(`gtk-text`,GtkText);const Wi=[`none`,`char`,`word`,`word-char`];function normalizeWrapMode(e){return Wi.includes(e??``)?e:`none`}const Gi={none:`pre`,word:`pre-wrap`,"word-char":`pre-wrap`,char:`pre-wrap`};var GtkTextView=class extends HTMLElement{_area;_initialized=!1;static get observedAttributes(){return[`text`,`editable`,`wrap-mode`,`justification`,`monospace`,`accepts-tab`,`cursor-visible`,`top-margin`,`bottom-margin`,`left-margin`,`right-margin`]}get text(){return this._area?this._area.value:this.getAttribute(`text`)??this._seedText()}set text(e){this._area?this._area.value=e??``:this.setAttribute(`text`,e??``)}get editable(){return this._bool(`editable`,!0)}set editable(e){this._setBool(`editable`,e,!0)}get wrapMode(){return normalizeWrapMode(this.getAttribute(`wrap-mode`))}set wrapMode(e){this.setAttribute(`wrap-mode`,e)}get justification(){return normalizeLabelJustify(this.getAttribute(`justification`))}set justification(e){this.setAttribute(`justification`,e)}get monospace(){return this._bool(`monospace`,!1)}set monospace(e){this._setBool(`monospace`,e,!1)}get acceptsTab(){return this._bool(`accepts-tab`,!0)}set acceptsTab(e){this._setBool(`accepts-tab`,e,!0)}get cursorVisible(){return this._bool(`cursor-visible`,!0)}set cursorVisible(e){this._setBool(`cursor-visible`,e,!0)}get topMargin(){return this._margin(`top-margin`)}set topMargin(e){this.setAttribute(`top-margin`,String(e))}get bottomMargin(){return this._margin(`bottom-margin`)}set bottomMargin(e){this.setAttribute(`bottom-margin`,String(e))}get leftMargin(){return this._margin(`left-margin`)}set leftMargin(e){this.setAttribute(`left-margin`,String(e))}get rightMargin(){return this._margin(`right-margin`)}set rightMargin(e){this.setAttribute(`right-margin`,String(e))}get buffer(){return{cursor_position:this._area?this._area.selectionEnd??this._area.value.length:this.text.length,insert_at_cursor:(e,t=-1)=>{let n=t<0?e:e.slice(0,t),r=this._area;if(!r){this.text+=n;return}let i=r.selectionEnd??r.value.length;r.setRangeText(n,i,i,`end`),this._emitChanged()},set_text:(e,t=-1)=>{this.text=t<0?e:e.slice(0,t),this._area&&this._emitChanged()},get_text:()=>this.text}}get_buffer(){return this.buffer}get textarea(){return this._area}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=document.createElement(`textarea`);e.className=`adw-text-view`,e.value=this.getAttribute(`text`)??this._seedText(),e.spellcheck=!1,e.addEventListener(`input`,()=>this._emitChanged()),e.addEventListener(`keydown`,t=>{if(t.key!==`Tab`||!this.acceptsTab)return;t.preventDefault();let n=e.selectionStart??e.value.length,r=e.selectionEnd??n;e.setRangeText(` `,n,r,`end`),this._emitChanged()}),this._area=e,this.replaceChildren(e),this._render()}attributeChangedCallback(e,t,n){this._initialized&&(e===`text`?this._area.value=n??``:e===`editable`&&(this._area.readOnly=!this.editable),this._render())}_render(){let e=this.wrapMode,t=this._area;t.style.whiteSpace=Gi[e],t.style.wordBreak=e===`char`?`break-all`:`normal`,t.style.overflowWrap=e===`word-char`?`anywhere`:`normal`,t.style.textAlign=ei[this.justification],t.style.caretColor=this.cursorVisible?``:`transparent`,this.classList.toggle(`monospace`,this.monospace),t.style.setProperty(`--adw-text-view-margin-top`,`${this.topMargin}px`),t.style.setProperty(`--adw-text-view-margin-end`,`${this.rightMargin}px`),t.style.setProperty(`--adw-text-view-margin-bottom`,`${this.bottomMargin}px`),t.style.setProperty(`--adw-text-view-margin-start`,`${this.leftMargin}px`)}_seedText(){return this.textContent}_emitChanged(){this.dispatchEvent(new CustomEvent(`changed`,{bubbles:!0,detail:{text:this._area.value}}))}_bool(e,t){let n=this.getAttribute(e);return n===null?t:n!==`false`}_setBool(e,t,n){t===n?this.removeAttribute(e):this.setAttribute(e,t?`true`:`false`)}_margin(e){let t=Number.parseInt(this.getAttribute(e)??``,10);return Number.isFinite(t)?Math.max(0,t):0}};customElements.define(`gtk-text-view`,GtkTextView);var GtkToggleButton=class extends GtkButton{static signals={...GtkButton.signals,toggled:`toggled`,"notify::active":`notify::active`};_wired=!1;_groupNext=null;_groupPrev=null;_reflectingGroup=!1;static get observedAttributes(){return[...GtkButton.observedAttributes,`active`,`group`]}get active(){return this.hasAttribute(`active`)}set active(e){let t=!!e;this.active!==t&&(t&&this._grouped&&this._clearGroup(),this.toggleAttribute(`active`,t))}set group(e){this._reflectingGroup=!0,e===null||e.id===``?this.removeAttribute(`group`):this.setAttribute(`group`,e.id),this._reflectingGroup=!1,this._setGroup(e)}get _grouped(){return this._groupNext!==null||this._groupPrev!==null}connectedCallback(){super.connectedCallback(),!this._wired&&(this._wired=!0,this.button.addEventListener(`click`,()=>{this.active&&this._grouped||(this.active=!this.active)}),this.hasAttribute(`group`)&&this._setGroup(resolveGroupTarget(this.getAttribute(`group`),this)))}attributeChangedCallback(e){e===`group`&&!this._reflectingGroup&&this.isConnected&&this._setGroup(resolveGroupTarget(this.getAttribute(`group`),this)),super.attributeChangedCallback(),!(e!==`active`||!this.isConnected)&&(this.active&&this._grouped&&this._clearGroup(),this.dispatchEvent(new CustomEvent(`toggled`,{bubbles:!0})),this.dispatchEvent(new CustomEvent(`notify::active`,{bubbles:!0,detail:{active:this.active}})))}_setGroup(e){if(e===this){console.error(`<gtk-toggle-button> cannot be its own group; the group is unchanged.`);return}if(e===null)this._groupPrev&&(this._groupPrev._groupNext=this._groupNext),this._groupNext&&(this._groupNext._groupPrev=this._groupPrev),this._groupNext=null,this._groupPrev=null;else{if(this._groupNext===e)return;if(this._groupPrev=null,e._groupPrev){let t=e._groupPrev;t._groupNext=this,this._groupPrev=t}e._groupPrev=this,this._groupNext=e}this.dispatchEvent(new CustomEvent(`notify::group`,{bubbles:!0}))}_clearGroup(){let e=this._groupFirst();for(let t=e;t!==null;t=t._groupNext)t!==this&&(t.active=!1)}_groupFirst(e=0){let t=this._groupPrev;return t===null||e>1024?this:t._groupFirst(e+1)}decorate(e){e.classList.toggle(`checked`,this.active),e.setAttribute(`aria-pressed`,String(this.active))}};customElements.define(`gtk-toggle-button`,GtkToggleButton);function resolveGroupTarget(e,t){if(e===null||e===``)return null;let n=document.getElementById(e);return n===null?(console.error(`<gtk-toggle-button group="${e}"> names no element; the group is unchanged.`),null):(n instanceof GtkToggleButton||customElements.upgrade(n),!(n instanceof GtkToggleButton)||n===t?(console.error(`<gtk-toggle-button group="${e}"> names no other toggle button; the group is unchanged.`),null):n)}var GtkTreeExpander=class extends HTMLElement{_ornaments=[];_expandTimer=null;_initialized=!1;static get observedAttributes(){return[`hide-expander`,`indent-for-depth`,`indent-for-icon`,`depth`,`expandable`,`expanded`]}get hideExpander(){return this.hasAttribute(`hide-expander`)}set hideExpander(e){this.toggleAttribute(`hide-expander`,!!e)}get indentForDepth(){return this.getAttribute(`indent-for-depth`)!==`false`}set indentForDepth(e){this.setAttribute(`indent-for-depth`,String(!!e))}get indentForIcon(){return this.getAttribute(`indent-for-icon`)!==`false`}set indentForIcon(e){this.setAttribute(`indent-for-icon`,String(!!e))}get depth(){let e=Number.parseInt(this.getAttribute(`depth`)??``,10);return Number.isFinite(e)&&e>0?e:0}set depth(e){this.setAttribute(`depth`,String(e))}get expandable(){return this.hasAttribute(`expandable`)}set expandable(e){this.toggleAttribute(`expandable`,!!e)}get expanded(){return this.hasAttribute(`expanded`)}set expanded(e){this.toggleAttribute(`expanded`,!!e)}get layout(){return treeExpanderLayout({depth:this.depth,expandable:this.expandable,expanded:this.expanded},{hideExpander:this.hideExpander,indentForDepth:this.indentForDepth,indentForIcon:this.indentForIcon})}connectedCallback(){this._initialized||(this._initialized=!0,this.hasAttribute(`tabindex`)||(this.tabIndex=0),this._wire()),this.setAttribute(`role`,`button`),this._render()}_wire(){this.addEventListener(`keydown`,e=>{let t=treeExpanderAction(e.key,{ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,rtl:globalThis.getComputedStyle(this).direction===`rtl`});t!==`none`&&(e.preventDefault(),this.expanded=treeExpanderExpanded(this.expanded,t))}),this.addEventListener(`dragenter`,()=>{this.expanded||this._expandTimer!==null||(this._expandTimer=setTimeout(()=>{this._expandTimer=null,this.expanded=!0},500))});for(let e of[`dragleave`,`drop`])this.addEventListener(e,()=>this._cancelExpandTimer())}disconnectedCallback(){this._cancelExpandTimer()}attributeChangedCallback(e){this._initialized&&(this._render(),e===`expanded`&&this.dispatchEvent(new CustomEvent(`notify::expanded`,{bubbles:!0,detail:{expanded:this.expanded}})))}_cancelExpandTimer(){this._expandTimer!==null&&(clearTimeout(this._expandTimer),this._expandTimer=null)}_render(){for(let e of this._ornaments)e.remove();this._ornaments=[];let e=this.layout,t=this.firstChild;for(let n=0;n<e.indents;n++){let e=document.createElement(`span`);e.className=`adw-tree-expander-indent`,e.setAttribute(`aria-hidden`,`true`),this.insertBefore(e,t),this._ornaments.push(e)}if(e.expander===`none`)this.removeAttribute(`aria-expanded`);else{let n=createGtkImage(`go-next`,`adw-tree-expander-icon`);n.classList.toggle(`expanded`,e.expander===`expanded`),n.addEventListener(`click`,e=>{e.stopPropagation(),this.expanded=!this.expanded}),this.insertBefore(n,t),this._ornaments.push(n),this.setAttribute(`aria-expanded`,String(e.expander===`expanded`))}this.setAttribute(`aria-level`,String(e.level))}};customElements.define(`gtk-tree-expander`,GtkTreeExpander);var GtkVideo=class extends HTMLElement{_initialized=!1;_overlayIcon;_controlsRevealer;_media=null;mediaListeners=[];_hideTimer=null;_hasStream=!1;_error=null;_ended=!1;_playing=!1;static get observedAttributes(){return[`autoplay`,`graphics-offload`,`loop`]}get autoplay(){return this.hasAttribute(`autoplay`)}set autoplay(e){this._write(`autoplay`,!!e),this._syncMedia()}get loop(){return this.hasAttribute(`loop`)}set loop(e){this._write(`loop`,!!e),this._syncMedia()}get graphicsOffload(){return this.hasAttribute(`graphics-offload`)}set graphicsOffload(e){this._write(`graphics-offload`,!!e)}get media(){return this._media}get playing(){return this._playing}get timestamp(){return this._media?.currentTime??0}get duration(){let e=this._media?.duration??0;return Number.isFinite(e)?e:0}get controlsRevealed(){return this._controlsRevealer?.classList.contains(`revealed`)??!1}_write(e,t){this.toggleAttribute(e,t)}connectedCallback(){if(this._initialized){this._adoptMedia();return}this._initialized=!0,this._overlayIcon=document.createElement(`button`),this._overlayIcon.className=`adw-video-overlay-icon osd circular`,this._overlayIcon.type=`button`,this._overlayIcon.setAttribute(`aria-label`,`Play`),this._overlayIcon.title=`Play`,this._overlayIcon.addEventListener(`click`,()=>this._overlayClicked()),this._controlsRevealer=document.createElement(`div`),this._controlsRevealer.className=`adw-video-controls-revealer`,this._wrap(),this._adoptMedia(),this.addEventListener(`pointermove`,this._onPointerMove)}_wrap(){let e=this.querySelector(`:scope > video`),t=[...this.children].filter(t=>t!==e),n=document.createElement(`div`);n.className=`adw-video-surface`,this.replaceChildren(n),e&&n.appendChild(e),n.append(this._overlayIcon),this._controlsRevealer.append(...t),n.append(this._controlsRevealer)}_adoptMedia(){let e=this.querySelector(`:scope > .adw-video-surface > video`)??null;if(e===this._media){this._syncMedia(),this._updateOverlayIcon();return}if(this._media&&this._detachMedia(this._media),this._media=e,this._hasStream=e!==null,e){let onPlay=()=>this._updatePlaying(!0),onPause=()=>this._updatePlaying(!1),onEnded=()=>{this._ended=!0,this._updateOverlayIcon()},onError=()=>{this._error=e.error?.message??`Playback failed`,this._updateOverlayIcon()},onMetadata=()=>{this._ended=!1,this._error=null,this._updateOverlayIcon()},onPrepared=()=>{this.autoplay&&e.play().catch(()=>{})};this.mediaListeners=[[`play`,onPlay],[`pause`,onPause],[`ended`,onEnded],[`error`,onError],[`loadedmetadata`,onMetadata],[`loadeddata`,onPrepared]];for(let[t,n]of this.mediaListeners)e.addEventListener(t,n)}this._syncMedia(),this._updateOverlayIcon()}_detachMedia(e){for(let[t,n]of this.mediaListeners)e.removeEventListener(t,n);this.mediaListeners=[]}_syncMedia(){this._media&&(this._media.loop=this.loop,this._media.autoplay=!1,this.classList.toggle(`graphics-offload`,this.graphicsOffload))}_overlayClicked(){let e=this._media??null;e!==null&&(e.paused?e.play().catch(()=>{}):e.pause())}revealControls(){this._controlsRevealer&&(this._controlsRevealer.classList.add(`revealed`),this._hideTimer!==null&&clearTimeout(this._hideTimer),this._hideTimer=setTimeout(()=>this._hideControls(),3e3))}_hideControls(){this._hideTimer=null,this._controlsRevealer?.classList.remove(`revealed`)}_onPointerMove=()=>{this.revealControls()};attributeChangedCallback(e){this._initialized&&(e===`graphics-offload`&&this._syncMedia(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}})))}_property(e){switch(e){case`autoplay`:return this.autoplay;case`loop`:return this.loop;default:return this.graphicsOffload}}_updatePlaying(e){this._playing=e,this._overlayIcon&&(this._overlayIcon.hidden=e),this.classList.toggle(`playing`,e),this.dispatchEvent(new CustomEvent(`notify::playing`,{bubbles:!0,detail:{playing:e}}))}_updateOverlayIcon(){if(!this._overlayIcon)return;let e,t=null;this._hasStream?this._error===null?e=this._ended?`media-playlist-repeat-symbolic`:`media-playback-start-symbolic`:(e=`dialog-error-symbolic`,t=this._error):e=`media-eject-symbolic`;let n=document.createElement(`gtk-image`);n.setAttribute(`icon-name`,e),this._overlayIcon.replaceChildren(n),t?this._overlayIcon.title=t:this._overlayIcon.title=``,this._overlayIcon.classList.toggle(`error`,this._error!==null)}disconnectedCallback(){this._hideTimer!==null&&clearTimeout(this._hideTimer),this._hideTimer=null}};customElements.define(`gtk-video`,GtkVideo);const Ki=[`horizontal`,`vertical`];function axisAdjustment(e,t){let n=t===`vertical`,r=n?e.clientHeight:e.clientWidth,i=n?e.scrollHeight:e.scrollWidth;return normalizeAdjustment({value:n?e.scrollTop:e.scrollLeft,lower:0,upper:Math.max(i,r),stepIncrement:r*.1,pageIncrement:r*.9,pageSize:r})}var GtkViewport=class extends HTMLElement{_observer=null;_watch=null;static get observedAttributes(){return[`scroll-to-focus`]}get hadjustment(){return axisAdjustment(this,`horizontal`)}get vadjustment(){return axisAdjustment(this,`vertical`)}get scrollToFocus(){return this.getAttribute(`scroll-to-focus`)!==`false`}set scrollToFocus(e){this.setAttribute(`scroll-to-focus`,e?`true`:`false`)}connectedCallback(){this.setAttribute(`role`,`generic`),this.addEventListener(`scroll`,this._announce,{passive:!0}),this._observe(),this._bindFocus()}disconnectedCallback(){this.removeEventListener(`scroll`,this._announce),this.removeEventListener(`focusin`,this._onFocusIn)}_observe(){if(this._observer===null){this._observer=new ResizeObserver(()=>this._announce()),this._observer.observe(this);for(let e of this.children)this._observer.observe(e);this._watch=new MutationObserver(()=>{for(let e of this.children)this._observer?.observe(e);this._announce()}),this._watch.observe(this,{childList:!0})}}attributeChangedCallback(e){this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this.scrollToFocus}})),this.isConnected&&this._bindFocus()}scrollAxis(e,t){let n=axisAdjustment(this,e),r=clampAdjustmentValue(n,t);r!==n.value&&(e===`vertical`?this.scrollTop=r:this.scrollLeft=r,this._announce())}scrollTo(e,t){if(!(e instanceof Element)&&e!==null){Element.prototype.scrollTo.call(this,e,t);return}let n=e;if(n!==null&&n!==this&&typeof n.scrollIntoView==`function`){n.scrollIntoView({block:`nearest`,inline:`nearest`,behavior:matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`}),this._announce();return}for(let e of Ki){let t=axisAdjustment(this,e),n=clampAdjustmentValue(t,t.value);n!==t.value&&(e===`vertical`?this.scrollTop=n:this.scrollLeft=n)}this._announce()}get adjustments(){return{hadjustment:this.hadjustment,vadjustment:this.vadjustment}}_announce=()=>{this.dispatchEvent(new CustomEvent(`value-changed`,{bubbles:!0,detail:this.adjustments}))};_bindFocus(){this.removeEventListener(`focusin`,this._onFocusIn),this.scrollToFocus&&this.addEventListener(`focusin`,this._onFocusIn)}_onFocusIn=e=>{let t=e.target;!(t instanceof Element)||t===this||this.scrollTo(t)}};customElements.define(`gtk-viewport`,GtkViewport);const qi={"double-click":{attribute:`double-click-action`,fallback:`toggle-maximize`},"middle-click":{attribute:`middle-click-action`,fallback:`none`},"right-click":{attribute:`right-click-action`,fallback:`menu`}},Ji={"toggle-maximize":`window.toggle-maximized`,lower:`window.lower`,minimize:`window.minimize`,menu:`window.menu`},Yi=new Set([`none`,`toggle-maximize`,`lower`,`minimize`,`menu`]);function gestureOf(e,t){switch(e){case 0:return t>1?`double-click`:null;case 1:return`middle-click`;case 2:return`right-click`;default:return null}}var GtkWindowHandle=class extends HTMLElement{_drag=null;static get observedAttributes(){return[`double-click-action`,`middle-click-action`,`right-click-action`]}actionFor(e){let{attribute:t,fallback:n}=qi[e],r=this.getAttribute(t);return r===null?n:r.startsWith(`toggle-maximize`)?`toggle-maximize`:Yi.has(r)?r:`none`}connectedCallback(){this.setAttribute(`role`,`generic`),this.addEventListener(`click`,this._onClick),this.addEventListener(`pointerdown`,this._onPointerDown),this.addEventListener(`pointermove`,this._onPointerMove)}disconnectedCallback(){this.removeEventListener(`click`,this._onClick),this.removeEventListener(`pointerdown`,this._onPointerDown),this.removeEventListener(`pointermove`,this._onPointerMove),this._drag=null}_perform(e,t,n){let r=this.actionFor(e),i=r===`none`?null:Ji[r],a={action:r,gesture:e,windowAction:i,x:t,y:n};this.dispatchEvent(new CustomEvent(`titlebar-action`,{bubbles:!0,detail:a})),i!==null&&this.dispatchEvent(new CustomEvent(i,{bubbles:!0,detail:a}))}_onClick=e=>{this._drag=null;let t=gestureOf(e.button,e.detail);t!==null&&this._perform(t,e.clientX,e.clientY)};_onPointerDown=e=>{e.detail>1||(this._drag={pointerId:e.pointerId,x:e.clientX,y:e.clientY})};_onPointerMove=e=>{let t=this._drag;t===null||t.pointerId!==e.pointerId||Math.abs(e.clientX-t.x)+Math.abs(e.clientY-t.y)<=1||(this._drag=null,this.dispatchEvent(new CustomEvent(`window-move`,{bubbles:!0,detail:{x:e.clientX,y:e.clientY}})))}};customElements.define(`gtk-window-handle`,GtkWindowHandle);const q=createGtkPlatform(Jn);q.CssProvider,q.StyleContext,q.Settings,q.IconTheme,q.EventControllerKey,q.show_uri;function extensionsOf(e){return[...e.patterns,...e.suffixes].map(e=>`.${e}`)}function filePickerOptions(e,t){let n=[];for(let t of e.filters){if(t.acceptAll)continue;let e={};for(let n of t.mimeTypes)e[n]=[];let r=extensionsOf(t);r.length>0&&(e[t.mimeTypes[0]??`application/octet-stream`]=r),n.push({description:t.name??``,accept:e})}let r={};return n.length>0&&(r.types=n,r.excludeAcceptAllOption=!e.filters.some(e=>e.acceptAll)),t===`save`&&e.initialName!==null&&(r.suggestedName=e.initialName),r}function inputAccept(e){if(!e||e.acceptAll)return null;let t=[...extensionsOf(e),...e.mimeTypes];return t.length>0?t.join(`,`):null}function writeInWorker(e,t){let n=URL.createObjectURL(new Blob([`onmessage = async (event) => {
5
+ `);super(`this tree cannot be rendered by ${e}: ${t.length} construct(s) it refuses.\n${n}`),this.name=`UnsupportedConstructError`,this.renderer=e,this.refused=t}};function assertTreeConstructs(e,t,n){let r=[];for(let i of constructUsesOf(n)){let n=t[i.kind];if(n===void 0)throw Error(`${e}'s capabilities declare no row for the construct '${i.kind}'.`);n!==`implemented`&&r.push({...i,reason:n.refused})}if(r.length>0)throw new UnsupportedConstructError(e,r)}function attempt(e){try{return e(),null}catch(e){return e instanceof Error?e.message:String(e)}}function count$1(e,t){let n={n:0};return e.connect(t,()=>{n.n++}),n}__name(count$1,`count`),[...[`Children`,`Implements`,`Requires`,`GTypeFlags`].map(e=>({row:`registerClass`,rule:`the meta key ${e} is refused at registration, by name`,holds:`subset`,observe(t){let{GObject:n}=t;return(attempt(()=>n.registerClass({GTypeName:`GoVecRefuse${e}`,[e]:[]},class extends n.Object{}))??``).includes(e)},shows:!0}))];const B={active:!1,checked:!1,keyboardActivating:!1};({...B}),{...B},{...B},{...B},{...B},{...B};const wn=[{value:`a`,label:`A`},{value:`b`,label:`B`},{value:`c`,label:`C`}];[...wn],[...wn],Math.PI*.015,Math.PI*.35,Math.PI*.015,Math.PI*.9;const RADIO=(e,t,n)=>({label:n,action:`${e}::${t}`});RADIO(`win.view`,`list`,`List`),RADIO(`win.view`,`grid`,`Grid`),RADIO(`win.view`,`list`,`List`),RADIO(`win.view`,`list`,`List`),RADIO(`win.view`,`grid`,`Grid`),RADIO(`win.sort`,`name`,`Name`);const hostTagOf=e=>{if(!/^(?:Adw|Gtk)[A-Z]\w*$/.test(e))throw Error(`hostTagOf: ${e} is not a GIR class name`);let t=[];for(let n=0;n<e.length;n++){let r=e.charAt(n);if(r>=`A`&&r<=`Z`&&n>0){let r=e.charAt(n-1),i=e.charAt(n+1);(!(r>=`A`&&r<=`Z`)||i>=`a`&&i<=`z`)&&t.push(`-`)}t.push(r.toLowerCase())}return t.join(``)},attributeOf=e=>e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),propertyOf=e=>e.replace(/[-_]([a-z0-9])/g,(e,t)=>t.toUpperCase()),Tn={"margin-start":`margin-inline-start`,"margin-end":`margin-inline-end`,"margin-top":`margin-top`,"margin-bottom":`margin-bottom`},En=[`hexpand`,`vexpand`],Dn={"width-request":`min-width`,"height-request":`min-height`};function widgetLengthStyle(e,t){let n=Tn[e];if(n!==void 0)return[n,`${Number(t)}px`];let r=Dn[e];if(r!==void 0)return[r,Number(t)<0?null:`${Number(t)}px`]}const On=new Map([[`adw-toggle-group`,new Set([`sensitive`])],[`adw-toggle`,new Set([`enabled`])],[`adw-alert-response`,new Set([`enabled`])],[`adw-sidebar-item`,new Set([`enabled`,`visible`])],[`gtk-editable-label`,new Set([`editable`])],[`adw-entry-row`,new Set([`editable`,`show-apply-button`])],[`gtk-text`,new Set([`editable`])],[`gtk-text-view`,new Set([`editable`])],[`adw-navigation-page`,new Set([`can-pop`])],[`gtk-action-bar`,new Set([`revealed`])],[`adw-password-entry-row`,new Set([`revealed`])]]);function isValueBasedBooleanAttr(e,t){let n=On.get(e);return n!==void 0&&n.has(t)}const kn={layout:`implemented`,strings:`implemented`,responses:`implemented`,page:`implemented`,extern:`implemented`,signal:`implemented`,bind:`implemented`,breakpoint:`implemented`,"sibling-object":{refused:`the web builder mounts one root element and has no consumer for a second root yet (ADR 0093)`}};function dispatchedSignalsOf(e){return e.constructor.signals??{}}const An=new WeakSet,jn=new WeakMap,Mn=new WeakSet;let Nn=0;function hasElementApi(e){return Mn.has(e)}function eventOf(e,t){let n=dispatchedSignalsOf(e),r=n[t]??(t.startsWith(`notify::`)?n[`notify::${attributeOf(t.slice(8))}`]:void 0);if(r===void 0)throw Error(`<${e.localName}> declares no signal '${t}'. It dispatches: ${Object.keys(n).join(`, `)||`none`}.`);return r}function inheritedDescriptor(e,t){for(let n=Object.getPrototypeOf(e);n!==null;n=Object.getPrototypeOf(n)){let e=Object.getOwnPropertyDescriptor(n,t);if(e!==void 0)return e}}function notifyElement(e,t){let n=propertyOf(t);e.dispatchEvent(new CustomEvent(eventOf(e,`notify::${t}`),{bubbles:!0,detail:{[n]:e[n]}}))}function ensureNotifying(e,t){let n=propertyOf(t),r=jn.get(e)??new Set;if(r.has(n)||(r.add(n),jn.set(e,r),Object.getOwnPropertyDescriptor(e,n)!==void 0))return;let i=inheritedDescriptor(e,n);if(i?.get===void 0||i.set===void 0)return;let{get:a,set:o}=i,s=eventOf(e,`notify::${t}`);Object.defineProperty(e,n,{configurable:!0,enumerable:!1,get(){return a.call(this)},set(e){let n=a.call(this),r=!1,mark=e=>{e.target===this&&(r=!0)};this.addEventListener(s,mark);try{o.call(this,e)}finally{this.removeEventListener(s,mark)}!r&&a.call(this)!==n&&notifyElement(this,t)}})}function listenElement(e,t,n){let r=eventOf(e,t),i=t.startsWith(`notify::`);i&&ensureNotifying(e,t.slice(8));let listener=t=>{i&&t.target!==e||n(e,...An.has(t)?t.detail:[])};return e.addEventListener(r,listener),()=>e.removeEventListener(r,listener)}function dispatchElement(e,t,n){let r=eventOf(e,t),i=new CustomEvent(r,{detail:n,bubbles:r.startsWith(`notify::`)});An.add(i),e.dispatchEvent(i)}function installElementApi(e){if(typeof e.connect==`function`)return;Mn.add(e);let t=new Map,define=(t,n)=>Object.defineProperty(e,t,{value:n,configurable:!0,writable:!0,enumerable:!1});define(`connect`,(n,r)=>{let i=listenElement(e,n,r),a=++Nn;return t.set(a,i),a}),define(`disconnect`,n=>{let r=t.get(n);if(r===void 0)throw Error(`No handler with id ${n} is connected to <${e.localName}>`);t.delete(n),r()}),define(`emit`,(t,...n)=>dispatchElement(e,t,n)),define(`notify`,t=>notifyElement(e,t)),define(`add_css_class`,t=>e.classList.add(t)),define(`remove_css_class`,t=>e.classList.remove(t)),define(`has_css_class`,t=>e.classList.contains(t))}const Pn=new Set([`connect`,`disconnect`,`emit`,`notify`]);function endpointOf(e){return hasElementApi(e)?new Proxy(e,{get(e,t){if(typeof t!=`string`||Pn.has(t))return Reflect.get(e,t,e);let n=Reflect.get(e,propertyOf(t),e);return typeof n==`function`?n.bind(e):n},set(e,t,n){return Reflect.set(e,typeof t==`string`?propertyOf(t):t,n,e)}}):e}const Fn=new WeakMap;function bindSlottedChildren(e,t,n){let r=new Map,i=[],a=null;for(let e of t){let t=e.claims;e.name!==void 0&&r.set(e.name,e),t!==void 0&&i.push([t,e]),e.name===void 0&&t===void 0&&(a=e)}let o=new Set,s=null,slotFor=e=>{if(o.has(e))return null;let t=e instanceof Element?e.getAttribute(`slot`)??``:``;if(t!==``)return r.get(t)??null;for(let[t,n]of i)if(t(e))return n;return a},route=t=>{let n=slotFor(t);return n===null?null:`into`in n?(n.into.appendChild(t),n):(n.consume(t),t.parentNode===e&&e.removeChild(t),n)},c={slots:t,slotFor,install(...t){for(let t of Array.from(e.childNodes))route(t);o=new Set(t),e.replaceChildren(...t),s?.disconnect(),s=new MutationObserver(t=>{for(let r of t)if(r.target===e)for(let e of r.addedNodes){let t=route(e);t!==null&&n?.(e,t)}}),s.observe(e,{childList:!0})}};return Fn.set(e,c),c}const In=new Map;function registerTemplateClass(e,t){let n=In.get(e);if(n!==void 0&&n!==t)throw Error(`the template class '${e}' is already registered as <${n}>.`);In.set(e,t)}function isTemplateTag(e){for(let t of In.values())if(t===e)return!0;return!1}function templateTagFor(e){let t=In.get(e);if(t===void 0)throw Error(`the tree uses the class '$${e}', which no registerTemplateClass() call registered: adwaita-web cannot build a class it does not know.`);if(customElements.get(t)===void 0)throw Error(`the class '$${e}' is registered as <${t}>, which nothing has defined in the custom element registry, so the element would stay an empty unknown tag.`);return t}function booleanAttribute$2(e,t){return e===null?t:e!==`false`}__name(booleanAttribute$2,`booleanAttribute`);function writeBooleanAttribute$1(e,t,n){n?e.setAttribute(t,`true`):e.setAttribute(t,`false`)}__name(writeBooleanAttribute$1,`writeBooleanAttribute`);function isWritable(e,t){for(let n=e;n!==null;n=Object.getPrototypeOf(n)){let e=Object.getOwnPropertyDescriptor(n,t);if(e!==void 0)return e.set!==void 0||e.writable===!0}return!1}function newRecord(e,t,n){return{placed:[],extended:[],ids:new Map,binds:[],breakpointHosts:[],disposers:[],...e===void 0?{}:{scope:e},...t===void 0?{}:{observeSize:t},...n===void 0?{}:{template:n}}}function bindBreakpoints(e,t,n){let r=createBreakpointDriver((t.breakpoints??[]).map(t=>{if(parseBreakpointCondition(t.condition)===null)throw Error(`<${e.localName}> \`condition ("${t.condition}")\` is not an Adwaita breakpoint condition.`);return{condition:t.condition,setters:t.setters.map(t=>{let r=n.ids.get(t.object);if(r===void 0)throw Error(`<${e.localName}> breakpoint setter \`${t.object}.${t.property}\` names no object: nothing in this tree has the id '${t.object}'.`);return{object:r,property:t.property,value:t.value}})}}),{read(e,t){let n=propertyOf(t),r=e[n];return typeof r==`boolean`&&isWritable(e,n)?{member:r}:{attribute:e.getAttribute(attributeOf(t))}},write(e,t,n){let r=propertyOf(t);if(typeof n==`object`&&n&&`member`in n)e[r]=n.member;else if(typeof n==`object`&&n&&`attribute`in n){let r=n.attribute;r===null?e.removeAttribute(attributeOf(t)):e.setAttribute(attributeOf(t),r)}else typeof n==`boolean`&&isWritable(e,r)?e[r]=n:writeProp(e,t,n)}});n.disposers.push((n.observeSize??observeAdaptiveSize)(e,e=>r.evaluate(e)))}function bindProperty(e,t){if(t.template!==void 0)return bindThroughEngine(e,t.template,t);let{el:n,property:r,source:i,sourceProperty:a,flags:o}=e,s=`<${n.localName}> \`${r}: bind ${i}.${a}\``,c=t.ids.get(i);if(c===void 0)throw Error(`${s} names no object: nothing in this tree has the id '${i}'.`);if(o.length>0)throw Error(`${s} carries ${o.join(`, `)}: adwaita-web binds the plain form only until each flag is verified against GObject.`);let l=`notify::${a}`,u=dispatchedSignalsOf(c),d=u[l];if(d===void 0)throw Error(`${s}: <${c.localName}> dispatches no '${l}', so the target would follow the source once and never again. It dispatches: ${Object.keys(u).join(`, `)||`none`}.`);let f=propertyOf(r),p=propertyOf(a);if(!isWritable(n,f))throw Error(`${s}: <${n.localName}> has no writable property '${f}'.`);let follow=()=>{n[f]=c[p]};follow(),c.addEventListener(d,follow)}function bindThroughEngine(e,t,n){let{el:r,property:i,source:a,sourceProperty:o,flags:s}=e,c=`<${r.localName}> \`${i}: bind ${a}.${o}\``,l=a===`template`?t.instance:n.ids.get(a);if(l===void 0)throw Error(`${c} names no object: nothing in this tree has the id '${a}'.`);let u=[`bidirectional`,`inverted`,`no-sync-create`],d=s.filter(e=>!u.includes(e));if(d.length>0)throw Error(`${c} carries ${d.join(`, `)}, which is not a bind flag.`);if(hasElementApi(r)&&!isWritable(r,propertyOf(i)))throw Error(`${c}: <${r.localName}> has no writable property '${propertyOf(i)}'.`);let f=[];s.includes(`bidirectional`)&&f.push(`bidirectional`),s.includes(`inverted`)&&f.push(`invert-boolean`),s.includes(`no-sync-create`)||f.push(`sync-create`),t.bind(endpointOf(l),o,endpointOf(r),i,f)}function writeProp(e,t,n){let r=attributeOf(t),i=propertyOf(t),a=En.find(e=>e===r);a!==void 0&&typeof n==`boolean`?e.setAttribute(a,n?``:`false`):isTemplateTag(e.localName)&&i in e?e[i]=n:typeof n==`boolean`&&isValueBasedBooleanAttr(e.localName,r)?writeBooleanAttribute$1(e,r,n):n===!1&&isWritable(e,i)?e[i]=!1:typeof n==`boolean`?e.toggleAttribute(r,n):e.setAttribute(r,String(n));let o=widgetLengthStyle(r,n);o!==void 0&&(o[1]===null?e.style.removeProperty(o[0]):e.style.setProperty(o[0],o[1]))}function buildNode$1(e,t){let n=document.createElement(e.extern===!0?templateTagFor(e.tag):hostTagOf(e.tag));t.template!==void 0&&installElementApi(n),e.id!==void 0&&(n.id=e.id,t.ids.set(e.id,n)),collectNode(n,e,t),writeLook(n,e,t.menus),bindSignals(n,e,t),e.extensions!==void 0&&t.extended.push({el:n,node:e});for(let r of buildChildren(n,e,t))n.append(r);return n}__name(buildNode$1,`buildNode`);function collectNode(e,t,n){for(let[r,i]of Object.entries(t.bindings??{}))n.binds.push({el:e,property:r,source:i.source,sourceProperty:i.property,flags:i.flags??[]});t.breakpoints!==void 0&&n.breakpointHosts.push({el:e,node:t})}function writeLook(e,t,n){for(let[n,r]of Object.entries(t.props??{}))n!==`menu-model`&&writeProp(e,n,r);for(let[r,i]of menuAssignments(t,n))e[propertyOf(r)]=i;t.styleClasses!==void 0&&t.styleClasses.length>0&&e.classList.add(...t.styleClasses),writeExtensions(e,t)}const Ln={row:{property:`gridRow`,span:!1},column:{property:`gridColumn`,span:!1},"row-span":{property:`gridRow`,span:!0},"column-span":{property:`gridColumn`,span:!0}};function writeGridCell(e,t,n){let r=n.layout??{};if(e.localName!==`gtk-grid`)throw Error(`layout (${Object.keys(r).join(`, `)}) on \`${n.tag}\` under \`${e.localName}\`: this renderer's only layout manager is the grid, so the placement would be dropped.`);let i={row:0,column:0,"row-span":1,"column-span":1};for(let[e,t]of Object.entries(r)){if(Ln[e]===void 0)throw Error(`layout \`${e}\` on \`${n.tag}\` reaches nothing: a grid child takes ${Object.keys(Ln).join(`, `)}.`);if(typeof t!=`number`||!Number.isInteger(t))throw Error(`layout \`${e}: ${String(t)}\` on \`${n.tag}\` is not a whole number.`);i[e]=t}t.style.gridRow=`${i.row+1} / span ${i[`row-span`]}`,t.style.gridColumn=`${i.column+1} / span ${i[`column-span`]}`}function buildChildren(e,t,n){let r=[];for(let i of t.children??[]){let t=buildNode$1(i,n);i.layout!==void 0&&writeGridCell(e,t,i),i.page!==void 0&&writePage(e,t,i),i.slot!==void 0&&(t.setAttribute(`slot`,i.slot),n.placed.push({parent:e,child:t,slot:i.slot})),r.push(t)}return r}function buildTemplateTree(e,t,n){assertTreeConstructs(`adwaita-web`,kn,e);let r=newRecord(void 0,void 0,t);r.menus=e.menus,e.id!==void 0&&r.ids.set(e.id,n),collectNode(n,e,r),bindSignals(n,e,r);let i=buildChildren(n,e,r);for(let e of r.binds)bindProperty(e,r);for(let e of r.breakpointHosts)bindBreakpoints(e.el,e.node,r);return{children:i,objects:Object.fromEntries(r.ids),finish:()=>writeLook(n,e,e.menus)}}function bindSignals(e,t,n){let r=dispatchedSignalsOf(e);for(let i of t.signals??[]){let t=i.detail===void 0?i.name:`${i.name}::${i.detail}`,a=r[t];if(a===void 0)throw Error(`<${e.localName}> declares no signal '${t}', so the handler '${i.handler}' would never run. It dispatches: ${Object.keys(r).join(`, `)||`none`}.`);if(n.template!==void 0){if(i.flags?.includes(`after`)===!0)throw Error(`the handler '${i.handler}' for '${t}' uses after, which is not in the GObject subset.`);let r=i.object===void 0?void 0:i.object===`template`?n.template.instance:n.ids.get(i.object);if(i.object!==void 0&&r===void 0)throw Error(`the handler '${i.handler}' for '${t}' names the object '${i.object}', which nothing in this tree has.`);e.connect(t,n.template.handler(i.handler,{object:r,flags:i.flags}));continue}if(i.object!==void 0||(i.flags?.length??0)>0)throw Error(`the handler '${i.handler}' for '${t}' uses ${i.object===void 0?``:`an object `}${(i.flags??[]).join(`, `)}: adwaita-web binds plain handlers only until each of those is verified against GTK.`);let o=n.scope?.[i.handler];if(typeof o!=`function`)throw Error(`the tree binds the handler '${i.handler}' for '${t}', and the scope ${n.scope===void 0?"was not given (pass `scope`)":`has no such function`}.`);e.addEventListener(a,e=>o.call(n.scope,e))}}function writeExtensions(e,t){let n=t.extensions?.strings;n!==void 0&&e.setAttribute(`strings`,JSON.stringify(n.map(e=>e.value)));for(let n of t.extensions?.responses??[]){let t=document.createElement(`adw-alert-response`);t.id=n.id,n.appearance!==void 0&&t.setAttribute(`appearance`,n.appearance),n.enabled===!1&&t.setAttribute(`enabled`,`false`),t.textContent=n.label,e.append(t)}}function writePage(e,t,n){let{page:r}=n;if(e.localName===`gtk-notebook`)r?.label!==void 0&&t.setAttribute(`tab-label`,r.label);else if(e.localName===`gtk-stack`)r?.name!==void 0&&t.setAttribute(`name`,r.name),r?.label!==void 0&&t.setAttribute(`title`,r.label);else throw Error(`adwaita-web's shared-tree builder: <${n.tag}> has a page, and <${e.localName}> has no pages.`)}const Rn=`adw-icon--`;var GtkImage=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(Rn));this.classList.remove(...e);let t=this.resolvedIconName;t===``?stringIsNotEmpty(this.getAttribute(`icon-name`))&&this.classList.add(`${Rn}image-missing`):this.classList.add(`${Rn}${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 createGtkImage(e,...t){let n=document.createElement(`gtk-image`);return e!==null&&n.setAttribute(`icon-name`,e),t.length>0&&n.classList.add(...t),n}customElements.define(`gtk-image`,GtkImage);const zn=[`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(zn)).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(createGtkImage(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=createGtkImage(`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=createGtkImage(`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=createGtkImage(`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);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()}function applyRowTooltip(e,t){let n=e.getAttribute(`tooltip-text`)??``;for(let e of t)n?(e.getAttribute(`title`)!==n&&e.setAttribute(`title`,n),e.hasAttribute(Bn)||e.setAttribute(Bn,``)):(e.removeAttribute(`title`),e.removeAttribute(Bn))}const Bn=`data-row-tooltip`;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}}function applyRowLineClamp(e){let{titleEl:t,subtitleEl:n,textContainerEl:r,getTitleLines:i,getSubtitleLines:a}=e,o=i(),s=a(),c=o>0,l=s>0,u=c||l;r.classList.toggle(`adw-row-clamp`,u),c?t.style.setProperty(`--adw-row-title-lines`,String(o)):t.style.removeProperty(`--adw-row-title-lines`),l?n.style.setProperty(`--adw-row-subtitle-lines`,String(s)):n.style.removeProperty(`--adw-row-subtitle-lines`),u?r.style.setProperty(`--adw-row-ellipsize-overflow`,`ellipsis`):r.style.removeProperty(`--adw-row-ellipsize-overflow`)}function parseRowLinesAttribute(e){if(e===null||e===``)return 0;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:0}const Vn=[`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;_textEl;_state=new ActionRowState;_sensitivityObserver=null;_initialized=!1;_activation;static get observedAttributes(){return[`title`,`subtitle`,`activatable`,`tooltip-text`,`title-lines`,`subtitle-lines`]}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,this._prefixEl=document.createElement(`div`),this._prefixEl.className=`adw-action-row-prefix`;let e=document.createElement(`div`);e.className=`adw-row-text`,this._textEl=e,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._suffixEl=document.createElement(`div`),this._suffixEl.className=`adw-action-row-suffix`,bindSlottedChildren(this,[{name:`prefix`,into:this._prefixEl},{name:`suffix`,into:this._suffixEl}]).install(this._prefixEl,e,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`)),this._applyLineClamping()}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:Vn})}_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),applyRowTooltip(this,[this._prefixEl,this._textEl,this._suffixEl]),this._activation?.sync()}_applyLineClamping(){applyRowLineClamp({titleEl:this._titleEl,subtitleEl:this._subtitleEl,textContainerEl:this._titleEl.parentElement,getTitleLines:()=>parseRowLinesAttribute(this.getAttribute(`title-lines`)),getSubtitleLines:()=>parseRowLinesAttribute(this.getAttribute(`subtitle-lines`))})}};customElements.define(`adw-action-row`,AdwActionRow);const Hn={b:{element:`b`},i:{element:`i`},u:{element:`u`},s:{element:`s`},tt:{element:`span`,style:{"font-family":`monospace`}},big:{element:`span`,style:{"font-size":`larger`}},small:{element:`span`,style:{"font-size":`smaller`}},sub:{element:`sub`},sup:{element:`sup`},markup:{element:`span`,style:{display:`contents`}},span:{element:`span`}},Un={weight:`font-weight`,style:`font-style`,underline:`text-decoration-line`,strikethrough:`text-decoration-line`,font_family:`font-family`,size:`font-size`},Wn={font_weight:`weight`,font_style:`style`,face:`font_family`,font_size:`size`},Gn={weight:{ultralight:`100`,light:`300`,normal:`400`,medium:`500`,semibold:`600`,bold:`bold`,ultrabold:`700`,heavy:`900`},style:{normal:`normal`,oblique:`oblique`,italic:`italic`}};function buildNode(e,t){if(e.kind===`text`)return t.createTextNode(e.text);let n=Hn[e.tag];if(n===void 0)return null;let r=t.createElement(n.element);if(n.style!==void 0)for(let[e,t]of Object.entries(n.style))r.style.setProperty(e,t);e.tag===`span`&&applySpanAttributes(r,e.attributes);for(let n of e.children){let e=buildNode(n,t);e!==null&&r.append(e)}return r}function applySpanAttributes(e,t){let n=[];for(let[r,i]of Object.entries(t)){let t=Wn[r]??r,a=Un[t];if(a===void 0)continue;if(t===`underline`){i!==`none`&&n.push(`underline`);continue}if(t===`strikethrough`){i!==`false`&&i!==`none`&&n.push(`line-through`);continue}if(t===`font_family`){let t=sanitizeFontFamily(i);t!==null&&e.style.setProperty(a,t);continue}if(t===`size`){let t=sanitizeFontSize(i);t!==null&&e.style.setProperty(a,t);continue}if(t===`weight`&&/^[0-9]{1,4}$/.test(i)&&+i>=1&&+i<=1e3){e.style.setProperty(a,i);continue}let o=Gn[t]?.[i];o!==void 0&&e.style.setProperty(a,o)}n.length>0&&e.style.setProperty(`text-decoration-line`,n.join(` `))}const Kn=new Set([`serif`,`sans-serif`,`monospace`,`cursive`,`fantasy`,`system-ui`,`ui-serif`,`ui-sans-serif`,`ui-monospace`,`ui-rounded`]);function sanitizeFontFamily(e){let t=[];for(let n of e.split(`,`)){let e=n.trim();if(e!==``){if(!Kn.has(e.toLowerCase())&&!/^["']?[A-Za-z0-9 _-]+["']?$/.test(e))return null;t.push(e)}}return t.length>0?t.join(`, `):null}function sanitizeFontSize(e){let t=e.trim(),n={"xx-small":`xx-small`,"x-small":`x-small`,small:`small`,medium:`medium`,large:`large`,"x-large":`x-large`,"xx-large":`xx-large`,smaller:`smaller`,larger:`larger`}[t];return n===void 0?/^[0-9]+$/.test(t)?`${t/1024}pt`:/^[0-9]+(\.[0-9]+)?pt$/.test(t)||/^[0-9]+(\.[0-9]+)?%$/.test(t)?t:null:n}function renderPangoMarkup(e,t){let n=parsePangoMarkup(t);if(n===null){e.textContent=t;return}let r=e.ownerDocument??document;e.replaceChildren(...n.map(e=>buildNode(e,r)).filter(e=>e!==null))}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`,`heading-use-markup`,`body-use-markup`,`close-response`,`default-response`,`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 headingUseMarkup(){return this.hasAttribute(`heading-use-markup`)}set headingUseMarkup(e){e?this.setAttribute(`heading-use-markup`,``):this.removeAttribute(`heading-use-markup`)}get bodyUseMarkup(){return this.hasAttribute(`body-use-markup`)}set bodyUseMarkup(e){e?this.setAttribute(`body-use-markup`,``):this.removeAttribute(`body-use-markup`)}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,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 e=document.createElement(`div`);e.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`,e.append(this._headingEl,this._bodyEl,this._childEl),this._responseAreaEl=document.createElement(`div`),this._responseAreaEl.className=`adw-alert-dialog-responses`,this._dialogEl.append(e,this._responseAreaEl),bindSlottedChildren(this,[{claims:e=>e instanceof Element&&e.localName===`adw-alert-response`,consume:e=>this._adoptResponse(e)},{into:this._childEl}]).install(this._scrimEl,this._dialogEl),bindEmptySections(this._childEl),this._model.heading=this.heading,this._model.body=this.body;let t=this.getAttribute(`close-response`);t!==null&&(this._model.closeResponse=t),this._model.defaultResponse=this.getAttribute(`default-response`),this._render()}_adoptResponse(e){let t=e.getAttribute(`id`);if(!t)return;let n=e.getAttribute(`appearance`)??`default`;this.addResponse(t,(e.textContent??``).trim()),n!=="default"&&this.setResponseAppearance(t,n),booleanAttribute$2(e.getAttribute(`enabled`),!0)||this.setResponseEnabled(t,!1)}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===`close-response`?n!==null&&this.setCloseResponse(n):e===`default-response`?this.setDefaultResponse(n):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.headingUseMarkup?renderPangoMarkup(this._headingEl,e):this._headingEl.textContent=e,this._headingEl.hidden=e.length===0;let t=this.body;this.bodyUseMarkup?renderPangoMarkup(this._bodyEl,t):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);var AdwWindowFeatures=class{_host;_contentEl=null;_breakpoints=[];_disposeBreakpoints=null;_openDialogs=[];constructor(e){this._host=e}get contentArea(){return this._contentEl}get content(){return this._contentEl?.firstElementChild??null}set content(e){e&&this._contentEl?.appendChild(e)}get breakpoints(){return this._breakpoints}get currentBreakpoint(){return this._breakpoints.find(e=>e.applied)??null}get dialogs(){return this._openDialogs=this._openDialogs.filter(e=>e.isConnected),this._openDialogs}get visibleDialog(){let e=this.dialogs;return e.length>0?e[e.length-1]:null}adopt(e){this._contentEl===null&&(this._contentEl=e,e.classList.add(`adw-window-content`),this._host.addEventListener(`notify::open`,e=>{let t=e.target;t!==this._host&&(t.hasAttribute(`open`)?this._openDialogs.includes(t)||this._openDialogs.push(t):this._openDialogs=this._openDialogs.filter(e=>e!==t))}))}addBreakpoint(e){let t=this._host,n=new AdwBreakpoint(e,{onApply:()=>t.dataset.breakpoint=e,onUnapply:()=>{t.dataset.breakpoint===e&&delete t.dataset.breakpoint}});return this._breakpoints.push(n),this.bind(),n}bind(){this._disposeBreakpoints?.(),this._disposeBreakpoints=null,this._contentEl!==null&&this._breakpoints.length>0&&(this._disposeBreakpoints=addBreakpoints(this._host,this._breakpoints))}release(){this._disposeBreakpoints?.(),this._disposeBreakpoints=null}applySizeRequest(){let e=this._host,t=e.getAttribute(`default-width`)??e.getAttribute(`width`),n=e.getAttribute(`default-height`)??e.getAttribute(`height`);e.style.width=t?`${t}px`:`360px`,e.style.height=n?`${n}px`:`200px`}};const qn={minimize:{className:`minimize`,icon:`window-minimize-symbolic`,label:`Minimize`,action:`minimize`},maximize:{className:`maximize`,icon:`window-maximize-symbolic`,label:`Maximize`,action:`toggle-maximized`},close:{className:`close`,icon:`window-close-symbolic`,label:`Close`,action:`close`}},Jn=[`decoration-layout`,`deletable`,`icon-name`,`maximized`,`modal`,`resizable`,`transient-for`];var GtkWindowControls=class extends HTMLElement{_initialized=!1;_empty=!0;_window=null;_windowObserver=null;static get observedAttributes(){return[`decoration-layout`,`side`,`use-native-controls`]}get side(){return this.getAttribute(`side`)===`end`?`end`:`start`}set side(e){this._write(`side`,e)}get useNativeControls(){return this.hasAttribute(`use-native-controls`)}get empty(){return this._empty}_write(e,t){this.getAttribute(e)!==t&&this.setAttribute(e,t)}connectedCallback(){if(this._initialized){this._followWindow();return}this._initialized=!0,this.setAttribute(`role`,`group`),this._followWindow()}disconnectedCallback(){this._windowObserver?.disconnect(),this._windowObserver=null,this._window=null}attributeChangedCallback(e){this._initialized&&(this._render(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}})))}_property(e){return e===`side`?this.side:this.hasAttribute(e)}_followWindow(){this._windowObserver?.disconnect(),this._applyEmptyClass(),this._window=this.closest(`gtk-window, adw-window`),this._window!==null&&(this._windowObserver??=new MutationObserver(()=>this._render()),this._windowObserver.observe(this._window,{attributes:!0,attributeFilter:Jn})),this._render()}_isSovereign(e){return!e.hasAttribute(`modal`)&&!e.hasAttribute(`transient-for`)}_windowFlag(e,t){return e.getAttribute(t)!==`false`}_layoutHalf(){let e=this.getAttribute(`decoration-layout`)??this._window?.getAttribute(`decoration-layout`)??`:minimize,maximize,close`;if(e===``)return null;let t=e.indexOf(`:`);return t===-1?e:this.side===`start`?e.slice(0,t):e.slice(t+1)}_render(){this.classList.toggle(`start`,this.side===`start`),this.classList.toggle(`end`,this.side===`end`),this.replaceChildren(),this._applyEmptyClass();let e=this._window;if(e===null){this._setEmpty(!0);return}let t=this._isSovereign(e),n=this._layoutHalf();if(n===null){this._setEmpty(!0);return}let r=!0;for(let i of n.split(`,`)){let n=this._buttonFor(i,e,t);n!==null&&(this.appendChild(n),r=!1)}this._setEmpty(r)}_applyEmptyClass(){this.classList.toggle(`empty`,this._empty)}_buttonFor(e,t,n){if(e===`icon`)return n?this._windowIcon(t):null;if(e===`minimize`)return n?this._controlButton(qn.minimize):null;if(e===`maximize`){if(!n||!this._windowFlag(t,`resizable`))return null;let e=t.hasAttribute(`maximized`);return this._controlButton(e?{...qn.maximize,icon:`window-restore-symbolic`,label:`Restore`}:qn.maximize)}return e===`close`&&this._windowFlag(t,`deletable`)?this._controlButton(qn.close):null}_windowIcon(e){let t=e.getAttribute(`icon-name`);return t===null||t===``?null:createGtkImage(t,`icon`)}_controlButton(e){let t=document.createElement(`button`);return t.className=`adw-window-controls-button ${e.className}`,t.setAttribute(`aria-label`,e.label),t.title=e.label,t.appendChild(createGtkImage(e.icon)),t.addEventListener(`click`,()=>this.dispatchEvent(new CustomEvent(`window-action`,{bubbles:!0,detail:{action:e.action}}))),t}_setEmpty(e){e!==this._empty&&(this._empty=e,this._applyEmptyClass(),this.dispatchEvent(new CustomEvent(`notify::empty`,{bubbles:!0,detail:{empty:e}})))}};customElements.define(`gtk-window-controls`,GtkWindowControls);var GtkWindow=class extends HTMLElement{_initialized=!1;_titlebar;_content;_startControls=null;_endControls=null;_titleLabel=null;_titlebarObserver=null;_members=new WindowMemberState(e=>this._notifyMember(e));_closing=new CloseRequestState;_syncActive=()=>void this._members.reportActive(this._documentIsActive());_onFocusIn=e=>{e.target instanceof Element&&this._members.reportFocus(e.target)};_onFocusOut=e=>{let t=e.relatedTarget;t instanceof Node&&this.contains(t)||t===null&&!document.hasFocus()||this._members.reportFocus(null)};static get observedAttributes(){return[`decorated`,`default-width`,`default-height`,`deletable`,`fullscreened`,`hide-on-close`,`icon-name`,`maximized`,`modal`,`resizable`,`title`,`transient-for`,`hidden`]}get title(){return this.getAttribute(`title`)??``}set title(e){this._write(`title`,e)}get decorated(){return this._onByDefault(`decorated`)}set decorated(e){this._write(`decorated`,String(e))}get maximized(){return this._offByDefault(`maximized`)}set maximized(e){this._write(`maximized`,String(e))}get resizable(){return this._onByDefault(`resizable`)}set resizable(e){this._write(`resizable`,String(e))}get deletable(){return this._onByDefault(`deletable`)}set deletable(e){this._write(`deletable`,String(e))}_write(e,t){t===null?this.removeAttribute(e):this.getAttribute(e)!==t&&this.setAttribute(e,t)}_onByDefault(e){return this.getAttribute(e)!==`false`}_offByDefault(e){return this.hasAttribute(e)}connectedCallback(){if(this._initialized){this._watchActivity(),this._watchTitlebar(),this._render();return}this._initialized=!0,this._watchActivity(),this._titlebar=document.createElement(`div`),this._titlebar.className=`adw-gtk-window-titlebar`,this._content=document.createElement(`div`),this._content.className=`adw-gtk-window-content`,bindSlottedChildren(this,[...this.hasTitlebar()?[{name:`titlebar`,into:this._titlebar}]:[],...this.extraSlots(),{into:this._content}]).install(...this.strips()),this.addEventListener(`window-action`,e=>this._onWindowAction(e)),this._watchTitlebar(),this._render()}disconnectedCallback(){this._titlebarObserver?.disconnect(),this._titlebarObserver=null,globalThis.removeEventListener(`focus`,this._syncActive),globalThis.removeEventListener(`blur`,this._syncActive),document.removeEventListener(`visibilitychange`,this._syncActive),this.removeEventListener(`focusin`,this._onFocusIn),this.removeEventListener(`focusout`,this._onFocusOut),this._members.reportActive(!1),this._members.reportFocus(null)}_watchActivity(){globalThis.addEventListener(`focus`,this._syncActive),globalThis.addEventListener(`blur`,this._syncActive),document.addEventListener(`visibilitychange`,this._syncActive),this.addEventListener(`focusin`,this._onFocusIn),this.addEventListener(`focusout`,this._onFocusOut),this._syncActive()}_documentIsActive(){return this.isConnected&&!this.hidden&&document.visibilityState!==`hidden`&&document.hasFocus()}_notifyMember(e){let t=e===`is-active`?this._members.active:e===`focus-widget`?this._members.focus:this.maximized;this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:t}}))}_watchTitlebar(){this._titlebarObserver?.disconnect(),this._titlebarObserver=new MutationObserver(()=>this._render()),this._titlebarObserver.observe(this._titlebar,{childList:!0})}strips(){return[this._titlebar,this._content]}hasTitlebar(){return!0}extraSlots(){return[]}attributeChangedCallback(e){if(e===`hidden`){this._syncActive();return}this._initialized&&this._render(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}}))}_property(e){if(e===`default-width`||e===`default-height`){let t=Number.parseFloat(this.getAttribute(e)??``);return Number.isFinite(t)?t:null}return e===`title`||e===`icon-name`||e===`transient-for`?this.getAttribute(e):e===`decorated`||e===`resizable`||e===`deletable`?this._onByDefault(e):this._offByDefault(e)}_render(){this._titlebar.hidden=!this.decorated,this.classList.toggle(`maximized`,this.decorated&&this.maximized),this.classList.toggle(`fullscreen`,this.decorated&&this._offByDefault(`fullscreened`)),this.renderFrameSize();let e=this.getAttribute(`title`);e===null?this.removeAttribute(`aria-label`):this.setAttribute(`aria-label`,e),this._renderTitlebar()}renderFrameSize(){let e=Number.parseFloat(this.getAttribute(`default-width`)??``),t=Number.parseFloat(this.getAttribute(`default-height`)??``);for(let[n,r]of[[`width`,e],[`height`,t]])Number.isFinite(r)&&r>0?this.style.setProperty(n,`${r}px`):this.style.removeProperty(n)}_renderTitlebar(){if([...this._titlebar.children].some(e=>e!==this._startControls&&e!==this._endControls&&e!==this._titleLabel)){for(let e of[this._startControls,this._endControls,this._titleLabel])e?.remove();this._startControls=null,this._endControls=null,this._titleLabel=null;return}if(!this.decorated||!this.hasTitlebar())return;this._startControls===null&&(this._startControls=document.createElement(`gtk-window-controls`),this._startControls.setAttribute(`side`,`start`),this._endControls=document.createElement(`gtk-window-controls`),this._endControls.setAttribute(`side`,`end`),this._titleLabel=document.createElement(`span`),this._titleLabel.className=`adw-gtk-window-title`,this._titlebar.append(this._startControls,this._titleLabel,this._endControls));let e=this.getAttribute(`title`);e===null?this._titleLabel?.removeAttribute(`title`):this._titleLabel?.setAttribute(`title`,e??``)}_onWindowAction(e){let t=e.detail?.action;if(t===`toggle-maximized`){this._write(`maximized`,String(!this._offByDefault(`maximized`)));return}t===`close`&&this.close()}close(){let e=this._closing.close({realized:this.isConnected,hideOnClose:this._offByDefault(`hide-on-close`),emit:()=>{let e=new CustomEvent(`close-request`,{bubbles:!0,cancelable:!0});return this.dispatchEvent(e),e.defaultPrevented},hide:()=>void(this.hidden=!0),destroy:()=>this.remove()});return e===`hidden`||e===`destroyed`}present(){this.hidden=!1}get isActive(){return this._members.active}is_active(){return this._members.active}get focusWidget(){return this.get_focus()}get_focus(){let e=document.activeElement;return e!==null&&e!==this&&this.contains(e)?e:null}set_focus(e){if(e===null){let e=this.get_focus();(e instanceof HTMLElement||e instanceof SVGElement)&&e.blur(),this._members.reportFocus(null);return}if(e===this||!this.contains(e))throw Error(`<gtk-window>.set_focus: the widget is not inside this window`);(e instanceof HTMLElement||e instanceof SVGElement)&&e.focus(),this._members.reportFocus(this.get_focus())}is_maximized(){return this.maximized}maximize(){this._write(`maximized`,`true`)}unmaximize(){this._write(`maximized`,`false`)}};customElements.define(`gtk-window`,GtkWindow);const Yn=new Map;function modifierState(e){return!!e.shiftKey|(e.ctrlKey?4:0)|(e.altKey?8:0)|(e.metaKey?67108864:0)}const Xn={setStyles(e){if(typeof document>`u`)return;let t=new Set(e.map(e=>e.owner));for(let[e,n]of Yn)t.has(e)||(n.remove(),Yn.delete(e));for(let{owner:t,css:n,priority:r}of e){let e=Yn.get(t);e||(e=document.createElement(`style`),Yn.set(t,e)),e.dataset.gtkPriority=String(r),e.textContent!==n&&(e.textContent=n),document.head.append(e)}},openUri(e){typeof globalThis>`u`||globalThis.open(e,`_blank`,`noopener`)},fontName(){if(typeof document>`u`||!document.body)return null;let e=getComputedStyle(document.body),t=e.fontFamily.split(`,`)[0]?.trim().replace(/^["']|["']$/g,``),n=Number.parseFloat(e.fontSize);return!t||!Number.isFinite(n)?null:`${t} ${Math.round(n*.75*10)/10}`},listenKeys(e,t){let n=e;n.hasAttribute(`tabindex`)||n.setAttribute(`tabindex`,`-1`);let listen=e=>n=>{let r=n;t({key:r.key,keycode:r.keyCode,state:modifierState(r),pressed:e})&&r.preventDefault()},r=listen(!0),i=listen(!1);return n.addEventListener(`keydown`,r),n.addEventListener(`keyup`,i),()=>{n.removeEventListener(`keydown`,r),n.removeEventListener(`keyup`,i)}}},Zn={name:`adwaita-web`,requiresWindow:!1,start(e){return new Promise(t=>{let go=()=>{e(),t()};document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,go,{once:!0}):go()})},detach(e){e.remove()},exit(){}};function parentOfElement(e){if(!(e instanceof Element))return null;let t=e.anchor;return t instanceof Element?t:e.parentElement}function menuActionsOfElement(e,t){return menuActionsFor(t,e,parentOfElement)}function activateElementMenuItem(e,t){return activateMenuItem(t,e,parentOfElement)}var GioApplication=class extends GioApplicationBase{static host=Zn};withGtkApplication(GioApplication);const Qn=new WeakMap;function followAccelerators(e,t){Qn.get(e)?.(),Qn.delete(e),t!==null&&Qn.set(e,Xn.listenKeys(e,t=>dispatchAccelerator(e,t,parentOfElement)))}function defineWindowApplication(e){installActionMap(e),Object.defineProperty(e,"application",{configurable:!0,enumerable:!0,get(){return applicationOfWindow(this)},set(e){let t=applicationOfWindow(this);t!==e&&(t?.remove_window(this),e?.add_window(this),followAccelerators(this,e))}})}var GtkApplicationWindow=class extends GtkWindow{_menubar=null;_menubarObserver=null;static get observedAttributes(){return[...GtkWindow.observedAttributes,`show-menubar`]}get showMenubar(){return this.getAttribute(`show-menubar`)===`true`}set showMenubar(e){this._write(`show-menubar`,String(e))}menubarSection(){if(this._menubar===null){let e=document.createElement(`div`);e.className=`adw-gtk-application-window-menubar`,this._menubar=e}return this._menubar}strips(){return[this._titlebar,this.menubarSection(),this._content]}extraSlots(){return[{name:`menubar`,into:this.menubarSection()}]}connectedCallback(){super.connectedCallback(),this._followMenubar()}disconnectedCallback(){this._menubarObserver?.disconnect(),this._menubarObserver=null}attributeChangedCallback(e){super.attributeChangedCallback(e),e===`show-menubar`&&this._renderMenubar()}_followMenubar(){this._menubarObserver?.disconnect(),this._menubarObserver=new MutationObserver(()=>this._renderMenubar()),this._menubarObserver.observe(this.menubarSection(),{childList:!0}),this._renderMenubar()}_renderMenubar(){let e=this.menubarSection();e.hidden=!this.showMenubar||e.childElementCount===0}};customElements.define(`gtk-application-window`,GtkApplicationWindow),defineWindowApplication(GtkApplicationWindow.prototype);var AdwApplicationWindow=class extends GtkApplicationWindow{_features=new AdwWindowFeatures(this);_model=[];_menubarEl=null;static get observedAttributes(){return[...GtkApplicationWindow.observedAttributes,`width`,`height`,`menu-model`]}get contentArea(){return this._content}get content(){return this._features.content}set content(e){this._features.content=e}get breakpoints(){return this._features.breakpoints}get currentBreakpoint(){return this._features.currentBreakpoint}get dialogs(){return this._features.dialogs}get visibleDialog(){return this._features.visibleDialog}addBreakpoint(e){return this._features.addBreakpoint(e)}get showMenubar(){return this.hasAttribute(`show-menubar`)}set showMenubar(e){e?this.setAttribute(`show-menubar`,``):this.removeAttribute(`show-menubar`)}get menuModel(){return this._model}set menuModel(e){this._model=normalizeMenuModel(e),this._renderMenubar()}get menubar(){return this._menubarEl}connectedCallback(){super.connectedCallback(),this._features.adopt(this._content),this._features.bind()}disconnectedCallback(){this._features.release(),super.disconnectedCallback()}attributeChangedCallback(e){if(e===`width`||e===`height`){this.renderFrameSize();return}super.attributeChangedCallback(e),e===`menu-model`&&(this._model=parseMenuModel(this.getAttribute(`menu-model`)),this._renderMenubar())}hasTitlebar(){return!1}strips(){return[this._content]}extraSlots(){return[{name:`content`,into:this._content}]}renderFrameSize(){this._features.applySizeRequest()}_followMenubar(){this._menubarEl===null&&(this._menubarEl=document.createElement(`div`),this._menubarEl.className=`adw-application-window-menubar`,this._content.prepend(this._menubarEl)),this._renderMenubar()}menubarSection(){return this._menubarEl??super.menubarSection()}_renderMenubar(){let e=this._menubarEl;if(e!==null){e.replaceChildren(),e.hidden=!this.showMenubar||this._model.length===0;for(let t of flattenMenu(this._model)){let n=t.node;if(n.kind===`submenu`){let t=document.createElement(`gtk-menu-button`);t.setAttribute(`menu-title`,n.label),t.menuModel=n.items,e.appendChild(t);continue}let r=document.createElement(`gtk-button`);r.setAttribute(`label`,n.label??``),r.setAttribute(`flat`,``),r.addEventListener(`click`,()=>{this.dispatchEvent(new CustomEvent(`menu-item-activated`,{bubbles:!0,detail:{id:n.id??n.label,label:n.label,path:[...t.path]}}))}),e.appendChild(r)}}}};customElements.define(`adw-application-window`,AdwApplicationWindow),defineWindowApplication(AdwApplicationWindow.prototype);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=createGtkImage(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=avatarIconSize(e),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`)?renderPangoMarkup(this._titleEl,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 He)this._button.classList.toggle(e,n.includes(e));this.classList.toggle(`revealed`,this.hasAttribute(`revealed`))}};customElements.define(`adw-banner`,AdwBanner);var AdwBin=class extends HTMLElement{_observer=null;get child(){return this.lastElementChild}set child(e){this.setChild(e)}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this}]),this._enforceSingleChild(),this._observer??=new MutationObserver(()=>this._enforceSingleChild()),this._observer.observe(this,{childList:!0})}disconnectedCallback(){this._observer?.disconnect()}_enforceSingleChild(){let e=this.lastElementChild;if(e!==null)for(let t of Array.from(this.children)){if(t===e)break;t.remove()}}setChild(e){if(e!==null&&e.parentElement!==null&&e.parentElement!==this)throw Error(`AdwBin.setChild: the child already has a parent.`);if(e===this.child)return;let t=this.child;e===null?t?.remove():this.replaceChildren(e),this.dispatchEvent(new CustomEvent(`notify::child`,{bubbles:!0,detail:{child:e}}))}};customElements.define(`adw-bin`,AdwBin);var AdwBottomSheetContent=class extends HTMLElement{},AdwBottomSheetSheet=class extends HTMLElement{},AdwBottomSheetBottomBar=class extends HTMLElement{},AdwBottomSheet=class extends HTMLElement{_initialized=!1;_contentEl;_dimmingEl;_sheetEl;_sheetBodyEl;_bottomBarEl;_dragHandleEl;_pendingBottomBar=null;_state=new BottomSheetPresentation;_reflecting=!1;static get observedAttributes(){return[`open`,`modal`,`can-close`,`can-open`,`reveal-bottom-bar`,`show-drag-handle`]}get open(){return this._state.open}set open(e){this._setOpen(!!e)}get modal(){return this._state.modal}set modal(e){this._setBoolAttr(`modal`,e)}get_modal(){return this.modal}set_modal(e){this.modal=e}get canClose(){return this._state.canClose}set canClose(e){this._setBoolAttr(`can-close`,e)}get canOpen(){return this._state.canOpen}set canOpen(e){this._setBoolAttr(`can-open`,e)}get revealBottomBar(){return this._state.revealBottomBar}set revealBottomBar(e){this._setBoolAttr(`reveal-bottom-bar`,e)}get showDragHandle(){return this._boolAttr(`show-drag-handle`,!0)}set showDragHandle(e){this._setBoolAttr(`show-drag-handle`,e)}get bottomBar(){return this._initialized?this._bottomBarEl.firstChild:this._pendingBottomBar}setBottomBar(e){if(this._state.setHasBottomBar(e!==null),!this._initialized){this._pendingBottomBar=e;return}e?this._bottomBarEl.replaceChildren(e):this._bottomBarEl.replaceChildren(),this._render()}requestOpen(e){return this._state.requestOpen(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,this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-bottom-sheet-content`,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`),this._sheetBodyEl=document.createElement(`div`),this._sheetBodyEl.className=`adw-bottom-sheet-sheet-body`,this._bottomBarEl=document.createElement(`button`),this._bottomBarEl.type=`button`,this._bottomBarEl.className=`adw-bottom-sheet-bottom-bar`,this._bottomBarEl.addEventListener(`click`,()=>this.requestOpen(`bottom-bar`)),this._sheetEl.append(this._bottomBarEl,this._dragHandleEl,this._sheetBodyEl);let layer=(e,t)=>({claims:t=>t instanceof Element&&t.localName===e,consume:e=>{for(let n of Array.from(e.childNodes))t.appendChild(n)}});bindSlottedChildren(this,[{name:`sheet`,into:this._sheetBodyEl},{name:`bottom-bar`,into:this._bottomBarEl},{name:`content`,into:this._contentEl},layer(`adw-bottom-sheet-sheet`,this._sheetBodyEl),layer(`adw-bottom-sheet-bottom-bar`,this._bottomBarEl),layer(`adw-bottom-sheet-content`,this._contentEl),{into:this._contentEl}],(e,t)=>{!(`into`in t)||t.into!==this._bottomBarEl||(this._state.setHasBottomBar(!0),this._render())}).install(this._contentEl,this._dimmingEl,this._sheetEl),this._pendingBottomBar&&this._bottomBarEl.replaceChildren(this._pendingBottomBar),this._pendingBottomBar=null,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.setCanOpen(this._boolAttr(`can-open`,!0)),this._state.setRevealBottomBar(this._boolAttr(`reveal-bottom-bar`,!0)),this._state.setHasBottomBar(this._bottomBarEl.childNodes.length>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===`modal`&&this._state.setModal(this._boolAttr(`modal`,!0)),e===`can-close`&&this._state.setCanClose(this._boolAttr(`can-close`,!0)),e===`can-open`&&this._state.setCanOpen(this._boolAttr(`can-open`,!0)),e===`reveal-bottom-bar`&&this._state.setRevealBottomBar(this._boolAttr(`reveal-bottom-bar`,!0)),this._initialized&&this._render()}}_setOpen(e){this._state.setOpen(e)&&(this._initialized||this._reflectOpen(e))}_render(){let e=this._state.open,t=this._state.chrome,n=t.layer===`bottom-bar`;this._reflectOpen(e),this.classList.toggle(`open`,e),this.classList.toggle(`modal`,this._state.modal),this.classList.toggle(`has-drag-handle`,this.showDragHandle),this.classList.toggle(`showing-bottom-bar`,n&&t.surfaceVisible),this._dimmingEl.classList.toggle(`visible`,t.dimmed),this._bottomBarEl.hidden=!n,this._bottomBarEl.classList.toggle(`inert`,t.bottomBarInert),this._sheetBodyEl.hidden=n,this._dragHandleEl.hidden=!this.showDragHandle||n}_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`)}};customElements.define(`adw-bottom-sheet-content`,AdwBottomSheetContent),customElements.define(`adw-bottom-sheet-sheet`,AdwBottomSheetSheet),customElements.define(`adw-bottom-sheet-bottom-bar`,AdwBottomSheetBottomBar),customElements.define(`adw-bottom-sheet`,AdwBottomSheet);function parseBreakpoints(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return console.error("<adw-breakpoint-bin>: `breakpoints` is not JSON; no breakpoint is applied."),[]}return Array.isArray(t)?t.flatMap(e=>{if(typeof e!=`object`||!e)return[];let{condition:t,setters:n}=e;return typeof t==`string`?[{condition:t,setters:Array.isArray(n)?n:[]}]:[]}):[]}var AdwBreakpointBin=class extends HTMLElement{_state=new BreakpointBinState;_dispose;_applied=null;_pendingSync=!1;_originals=new Map;static get observedAttributes(){return[`breakpoints`]}get currentBreakpoint(){return this._state.current}get currentBreakpointAttribute(){let e=this._state.current;return e===null?null:String(e)}get child(){return this.firstElementChild}connectedCallback(){this.setAttribute(`role`,`group`),this.style.display=`block`,this._syncSizing(),this._pendingSync=!0,this._observe()}disconnectedCallback(){this._dispose?.(),this._dispose=void 0}attributeChangedCallback(e){e!==`breakpoints`||!this.isConnected||(this._originals.clear(),this._syncBreakpoints())}_syncBreakpoints(){this._pendingSync=!1;let e=parseBreakpoints(this.getAttribute(`breakpoints`));this._state=new BreakpointBinState;for(let t of e){let e=[];for(let n of t.setters){if(typeof n?.target!=`string`||typeof n.property!=`string`)continue;let t=this.querySelector(n.target);if(t===null)continue;let r=`${n.target}\u0000${n.property}\u0000${n.value}`;this._originals.has(r)||this._originals.set(r,t.getAttribute(n.property)),e.push({object:t,property:n.property,value:n.value,originalValue:this._originals.get(r)??null})}this._state.add({condition:t.condition,setters:e})}this._state.inherit(this._applied),this._state.setHasChild(this.child!==null),this._write(this._state.current),this._syncSizing()}_observe(){this._dispose?.(),this._dispose=observeAdaptiveSize(this,e=>{this._pendingSync&&this._syncBreakpoints(),this._state.setHasChild(this.child!==null);let t=this._state.evaluate(e);t!==null&&(this._emit(t.from,`breakpoint-unapply`),this._perform(t.writes),this._write(t.to),this._emit(t.to,`breakpoint-apply`),this.dispatchEvent(new CustomEvent(`notify::current-breakpoint`,{bubbles:!0,detail:{currentBreakpoint:this.currentBreakpointAttribute}})))})}_perform(e){for(let t of e)t.value===null?t.object.removeAttribute(t.property):t.object.setAttribute(t.property,String(t.value))}_write(e){this._applied=e}_emit(e,t){e!==null&&this.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:{index:e}}))}_syncSizing(){let e=this._state.length>0;this.style.minWidth=e?`0px`:``,this.style.minHeight=e?`0px`:``,e&&(this.style.overflow=`hidden`)}};customElements.define(`adw-breakpoint-bin`,AdwBreakpointBin);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=createGtkImage(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(Ke),this._styledHost=e))}_unroot(){this._styledHost?.classList.remove(Ke),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 AdwButtonRow=class extends HTMLElement{_contentsEl;_startIconEl;_endIconEl;_titleEl;_state=new ButtonRowState;_initialized=!1;static get observedAttributes(){return[`title`,`start-icon-name`,`end-icon-name`,`tooltip-text`]}connectedCallback(){this._initialized||(this._contentsEl=document.createElement(`div`),this._contentsEl.className=`adw-button-row-contents`,this._startIconEl=createGtkImage(null,`start`),this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-button-row-title`,this._endIconEl=createGtkImage(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),applyRowTooltip(this,[this._contentsEl])}_paintIcon(e,t,n){e.iconName=n?t:null,e.hidden=!n}};customElements.define(`adw-button-row`,AdwButtonRow);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`,`carousel`]}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`||e===`carousel`)&&this._initialized&&(this._detach(),this._carousel=null,this._resolveForAttr(),this._attach(),this._render())}_resolveForAttr(){let e=this.getAttribute(`carousel`)??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);var AdwClamp=class extends HTMLElement{_resize=null;_mutations=null;static get observedAttributes(){return[`maximum-size`,`tightening-threshold`]}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this}]),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`),Xe.maximumSize),tighteningThreshold:normalizeClampSize(this.getAttribute(`tightening-threshold`),Xe.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 Ze)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 Ze)e.classList.toggle(t,t===i)}}};customElements.define(`adw-clamp`,AdwClamp);const $n={automatic:`auto`,always:`scroll`,never:`hidden`};var AdwClampScrollable=class extends HTMLElement{_resize=null;_mutations=null;static get observedAttributes(){return[`maximum-size`,`tightening-threshold`,`unit`,`orientation`,`hscroll-policy`,`vscroll-policy`]}get maximumSize(){return normalizeClampSize(this.getAttribute(`maximum-size`),Xe.maximumSize)}set maximumSize(e){this.setAttribute(`maximum-size`,String(e))}get tighteningThreshold(){return normalizeClampSize(this.getAttribute(`tightening-threshold`),Xe.tighteningThreshold)}set tighteningThreshold(e){this.setAttribute(`tightening-threshold`,String(e))}get unit(){return normalizeLengthUnit(this.getAttribute(`unit`),`sp`)}set unit(e){this.setAttribute(`unit`,e)}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this.setAttribute(`orientation`,e)}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this}]),this._resize=new ResizeObserver(()=>this._allocate()),this._resize.observe(this),this._mutations=new MutationObserver(()=>this._allocate()),this._mutations.observe(this,{childList:!0}),this._applyOverflow(),this._allocate()}disconnectedCallback(){this._resize?.disconnect(),this._resize=null,this._mutations?.disconnect(),this._mutations=null}attributeChangedCallback(){this._applyOverflow(),this._allocate()}_applyOverflow(){let e=this.getAttribute(`hscroll-policy`),t=this.getAttribute(`vscroll-policy`);this.style.overflowX=e===null?`auto`:$n[e]??`auto`,this.style.overflowY=t===null?`auto`:$n[t]??`auto`}_allocate(){let e=this.orientation===`vertical`,t=this.unit,n=e?this.clientHeight:this.clientWidth,r={maximumSize:adwLengthToPx(t,this.maximumSize),tighteningThreshold:adwLengthToPx(t,this.tighteningThreshold),childMin:0,childNat:0};for(let t of Array.from(this.children)){if(n<=0){t.style.maxWidth=``,t.style.maxHeight=``,t.style.marginInline=``,t.style.marginBlock=``;for(let e of Ze)t.classList.remove(e);continue}let{childSize:i,sizeClass:a}=clampAllocate(n,r);e?(t.style.maxWidth=``,t.style.maxHeight=`${i}px`,t.style.marginInline=``,t.style.marginBlock=`auto`):(t.style.maxWidth=`${i}px`,t.style.maxHeight=``,t.style.marginInline=`auto`,t.style.marginBlock=``);for(let e of Ze)t.classList.toggle(e,e===a)}}};customElements.define(`adw-clamp-scrollable`,AdwClampScrollable);function stringListSlot(e){return{name:`model`,consume:t=>e(parseListModel(t instanceof Element?t.getAttribute(`strings`):null))}}var AdwComboRow=class extends HTMLElement{_select;_valueEl;_textEl;_titleEl;_subtitleEl;_state=new ComboState;_initialized=!1;static get observedAttributes(){return[`title`,`subtitle`,`model`,`selected`,`tooltip-text`,`title-lines`,`subtitle-lines`]}get model(){return this._state.model}set model(e){this._state.setModel(normalizeComboOptions(e))}get selected(){return this._initialized?this._state.selectedIndex:parseInt(this.getAttribute(`selected`)||`0`,10)}set selected(e){this.setAttribute(`selected`,String(e))}get selectedValue(){return this._state.selectedValue}set selectedValue(e){let t=this._state.model.findIndex(t=>t.value===e);t>=0&&(this.selected=t)}get selectedItem(){return this._state.model[this._state.selectedIndex]??null}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=document.createElement(`div`);e.className=`adw-row-text`,this._textEl=e,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._valueEl=document.createElement(`span`),this._valueEl.className=`adw-row-value`,this._select=document.createElement(`select`),bindSlottedChildren(this,[stringListSlot(e=>this._state.setModel(e))]).install(e,this._valueEl,this._select),this._state.count===0&&this._state.setModel(parseListModel(this.getAttribute(`model`))),this._state.setSelectedIndex(parseInt(this.getAttribute(`selected`)||`0`,10)),this._state.subscribeItems(e=>this._applyItemsChanged(e)),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._renderOptions(),this._renderText()}attributeChangedCallback(e,t,n){this._initialized&&(e===`model`?this._state.setModel(parseListModel(n)):e===`selected`?this._state.setSelectedIndex(parseInt(n||`0`,10)):this._renderText())}_createOption(e){let t=document.createElement(`option`);return t.value=e.value,t.textContent=e.label,t}_applyItemsChanged(e){if(!this._initialized)return;for(let t=0;t<e.removed;t++)this._select.remove(e.position);let t=this._select.options[e.position]??null,n=this._state.model;for(let r=0;r<e.added;r++){let i=n[e.position+r];i&&this._select.insertBefore(this._createOption(i),t)}}_renderOptions(){this._initialized&&(this._select.replaceChildren(...this._state.model.map(e=>this._createOption(e))),this._select.selectedIndex=this._state.selectedIndex,this._valueEl.textContent=this._state.selectedLabel,this._syncChooser())}_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,applyRowTooltip(this,[this._textEl,this._valueEl,this._select]),this._applyLineClamping()}_applyLineClamping(){applyRowLineClamp({titleEl:this._titleEl,subtitleEl:this._subtitleEl,textContainerEl:this._titleEl.parentElement,getTitleLines:()=>parseRowLinesAttribute(this.getAttribute(`title-lines`)),getSubtitleLines:()=>parseRowLinesAttribute(this.getAttribute(`subtitle-lines`))})}};customElements.define(`adw-combo-row`,AdwComboRow);const er=[`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&&er.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`),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 e=document.createElement(`div`);e.className=`adw-dialog-header-side`,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-dialog-title`;let t=document.createElement(`div`);t.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()),t.appendChild(this._closeBtn),this._headerEl.append(e,this._titleEl,t),this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-dialog-content`,this._boxEl.append(this._headerEl,this._contentEl),this._scrimEl.appendChild(this._boxEl),bindSlottedChildren(this,[{into:this._contentEl}]).install(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()}decorateHeader(e){}_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),this.decorateHeader(this._headerEl)}};customElements.define(`adw-dialog`,AdwDialog);function setPartVisible(e,t){e.hidden=!t,e.style.display=t?``:`none`}var AdwEntryRow=class extends HTMLElement{_state=new EntryRowState;_input;_emptyTitle;_title;_area;_editIcon;_indicator;_applyButton;_prefixes;_suffixes;_initialized=!1;_slots;_lastText=``;_lastLength=0;static get observedAttributes(){return[`title`,`text`,`editable`,`max-length`,`show-apply-button`,`activates-default`,`tooltip-text`]}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(booleanAttribute$2(this.getAttribute(`show-apply-button`),!1)),this._state.setActivatesDefault(booleanAttribute$2(this.getAttribute(`activates-default`),!1)),this.hasAttribute(`text`)&&this._state.setText(this.getAttribute(`text`)??``),this._renderTitle(),this._onConnected(),this._slots.install(this._prefixes,this._area,this._indicator,this._applyButton,this._editIcon,this._suffixes),this._lastText=this._state.text,this._lastLength=this._state.textLength,this._render(this._state.state),applyRowTooltip(this,this._tooltipParts()),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(booleanAttribute$2(n,!1));break;case`activates-default`:this._state.setActivatesDefault(booleanAttribute$2(n,!1));break;case`tooltip-text`:applyRowTooltip(this,this._tooltipParts());break}}_tooltipParts(){return[this._prefixes,this._area,this._suffixes]}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._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=at,this._applyButton.setAttribute(`aria-label`,at),this._applyButton.textContent=`✓`,this._applyButton.addEventListener(`click`,()=>this.apply()),this._editIcon=createGtkImage(`document-edit`,`adw-row-edit`,`${e}-edit`),this._editIcon.dataset.iconName=`adw-entry-edit-symbolic`,this._slots=bindSlottedChildren(this,[{name:`prefix`,consume:e=>this.addPrefix(e)},{name:`suffix`,claims:e=>e instanceof Element,consume:e=>this.addSuffix(e)}]),setPartVisible(this._prefixes,!1),setPartVisible(this._suffixes,!1),this.addEventListener(`click`,e=>this._maybeFocus(e))}_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 GtkSwitch=class extends HTMLElement{static signals={"notify::active":`notify::active`,"notify::state":`notify::state`};_input;_slider;_initialized=!1;static get observedAttributes(){return[`active`,`state`,`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),this.state=this.active}get state(){return this.hasAttribute(`state`)}set state(e){this.toggleAttribute(`state`,!!e)}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){this.toggleAttribute(`disabled`,!!e)}connectedCallback(){if(this._initialized){this._render();return}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.active&&(this.state=!0),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}})):e===`state`&&this.dispatchEvent(new CustomEvent(`notify::state`,{bubbles:!0,detail:{state:this.state}})))}_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(`checked`,this.state),this.classList.toggle(`disabled`,e)}};customElements.define(`gtk-switch`,GtkSwitch);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`,`tooltip-text`,`title-lines`,`subtitle-lines`]}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,this._headerEl=document.createElement(`div`),this._headerEl.className=`adw-expander-row-header`;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._enableSwitch=document.createElement(`gtk-switch`),this._enableSwitch.classList.add(`adw-expander-row-enable-switch`),this._enableSwitch.active=this.enableExpansion,this._chevronEl=createGtkImage(`go-down`,`adw-expander-row-chevron`),this._prefixEl=document.createElement(`div`),this._prefixEl.className=`adw-expander-row-prefix`,this._suffixEl=document.createElement(`div`),this._suffixEl.className=`adw-expander-row-suffix`,this._headerEl.append(this._prefixEl,e,this._suffixEl,this._enableSwitch,this._chevronEl),this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-expander-row-content`,bindSlottedChildren(this,[{name:`prefix`,into:this._prefixEl},{name:`suffix`,into:this._suffixEl},{into:this._contentEl}]).install(this._headerEl,this._contentEl),bindEmptySections(this._prefixEl,this._suffixEl),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),applyRowTooltip(this,[this._headerEl]),this._applyLineClamping()}_applyLineClamping(){applyRowLineClamp({titleEl:this._titleEl,subtitleEl:this._subtitleEl,textContainerEl:this._titleEl.parentElement,getTitleLines:()=>parseRowLinesAttribute(this.getAttribute(`title-lines`)),getSubtitleLines:()=>parseRowLinesAttribute(this.getAttribute(`subtitle-lines`))})}};customElements.define(`adw-expander-row`,AdwExpanderRow);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;_page=null;_window=null;_pageObserver=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){this._followPage(),this._renderTitle();return}this._initialized=!0,this._startEl=document.createElement(`div`),this._startEl.className=`adw-header-bar-start`,this._centerEl=document.createElement(`div`),this._centerEl.className=`adw-header-bar-center`,this._endEl=document.createElement(`div`),this._endEl.className=`adw-header-bar-end`,bindSlottedChildren(this,[{name:`start`,into:this._startEl},{name:`center`,into:this._centerEl},{name:`title-widget`,into:this._centerEl},{name:`end`,into:this._endEl}],(e,t)=>{`into`in t&&t.into===this._centerEl&&this._dropDerivedTitle()}).install(this._startEl,this._centerEl,this._endEl),this._centerEl.childElementCount===0&&(this._titleEl=document.createElement(`adw-window-title`),this._titleEl.className=`adw-header-bar-title`,this._centerEl.appendChild(this._titleEl)),this._followPage(),this._renderTitle()}disconnectedCallback(){this._pageObserver?.disconnect(),this._pageObserver=null,this._page=null,this._window=null}_followPage(){this._page=this.closest(`adw-navigation-page`),this._window=this.closest(`adw-window, adw-application-window`),this._pageObserver??=new MutationObserver(()=>this._renderTitle());for(let e of[this._page,this._window])e!==null&&this._pageObserver.observe(e,{attributes:!0,attributeFilter:[`title`]})}attributeChangedCallback(){this._initialized&&this._renderTitle()}_dropDerivedTitle(){this._titleEl?.remove(),this._titleEl=null}_renderTitle(){if(this._titleEl)for(let e of[`title`,`subtitle`]){let t=this.getAttribute(e)??(e===`title`?this._page?.getAttribute(`title`)??this._window?.getAttribute(`title`)??null:null);t===null?this._titleEl.removeAttribute(e):this._titleEl.setAttribute(e,t)}}};customElements.define(`adw-header-bar`,AdwHeaderBar);const tr={schedule(e,t){return setTimeout(e,t)},cancel(e){clearTimeout(e)}};function createSwitcherIcon(e,t){return createGtkImage(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`)}const nr={horizontal:{previous:`ArrowLeft`,next:`ArrowRight`},vertical:{previous:`ArrowUp`,next:`ArrowDown`}},adjacentStep=(e,t,n)=>{let r=t+n;return r<0||r>=e.length?null:r};function attachRovingFocus(e){let keysOf=e=>nr[typeof e==`function`?e():e];e.host.addEventListener(`keydown`,t=>{let{previous:n,next:r}=keysOf(e.orientation),i=e.crossAxis===void 0?null:keysOf(e.crossAxis.orientation);if(t.altKey||t.ctrlKey||t.metaKey)return;let a=e.items(),o=a.findIndex(e=>e===t.target||e.contains(t.target));if(o<0)return;let s=e.step??adjacentStep,c;if(t.key===n)c=s(a,o,-1);else if(t.key===r)c=s(a,o,1);else if(i!==null&&t.key===i.previous)c=e.crossAxis.step(a,o,-1);else if(i!==null&&t.key===i.next)c=e.crossAxis.step(a,o,1);else if(t.key===`Home`)c=0;else if(t.key===`End`)c=a.length-1;else return;t.preventDefault();let l=c===null?void 0:a[c];l===void 0||l===a[o]||(e.select(l),l.focus())})}var AdwViewStackPage=class extends HTMLElement{static get observedAttributes(){return[`name`,`title`,`icon-name`,`badge-number`,`needs-attention`,`use-underline`]}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this}])}},AdwInlineViewSwitcher=class extends HTMLElement{scheduler=tr;_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 tn)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 AdwMultiLayoutView=class extends HTMLElement{_layouts=[];_children=new Map;_slots=new Map;_current=null;_acceptingSlots=!1;_observer=null;static get observedAttributes(){return[`layout-name`]}get layoutName(){return this._current?.name??null}set layoutName(e){e!==null&&this.setAttribute(`layout-name`,e)}get layout(){return this._current?.content??null}connectedCallback(){this.setAttribute(`role`,`group`),this.style.display=`block`,this._observer?.disconnect(),this._observer=new MutationObserver(()=>this._rebuild()),this._observer.observe(this,{childList:!0}),this._rebuild()}disconnectedCallback(){this._observer?.disconnect(),this._observer=null}attributeChangedCallback(e){!this.isConnected||e!==`layout-name`||this._setLayoutByName(this.getAttribute(`layout-name`))}getChild(e){return this._children.get(e)??null}getLayoutByName(e){return this._layouts.find(t=>t.name===e)?.content??null}registerSlot(e,t){if(this._acceptingSlots&&this._slots.get(e)!==t){if(this._slots.has(e)){console.warn(`Duplicate slot ID in AdwLayout ${this.layoutName}: ${e}`);return}this._slots.set(e,t)}}_rebuild(){if(this.isConnected){this._observer?.disconnect();try{this._readAuthoredTree()}finally{this.isConnected&&this._observer?.observe(this,{childList:!0})}}}_readAuthoredTree(){let e=[];for(let t of Array.from(this.children)){let n=t.getAttribute(`name`);if(n!==null){e.push({name:n,content:t});continue}let r=t.getAttribute(`slot`);r===null||r===``||(this._children.has(r)&&console.warn(`While adding child: duplicate slot ${r} in AdwMultiLayoutView; kept the first`),this._children.set(r,t))}this._layouts=e;let t=this.getAttribute(`layout-name`);t===null?this._setLayout(e[0]??null):this._setLayoutByName(t)}_setLayout(e){if(e===this._current){e!==null&&this._mount(e);return}this._current=e,e===null?this._destroy():this._mount(e),this.dispatchEvent(new CustomEvent(`notify::layout`,{bubbles:!0,detail:{layout:this.layoutName}})),this.dispatchEvent(new CustomEvent(`notify::layout-name`,{bubbles:!0,detail:{layoutName:this.layoutName}}))}_setLayoutByName(e){if(e===null)return;let t=this._layouts.find(t=>t.name===e);if(t===void 0){console.error(`Layout name '${e}' not found in AdwMultiLayoutView`);return}this._setLayout(t)}_destroy(){this._slots.clear(),this.replaceChildren()}_mount(e){for(this._destroy(),this._acceptingSlots=!0,this.appendChild(e.content);;){let t=this._slots.size;for(let t of e.content.querySelectorAll(`adw-layout-slot`)){let e=t.getAttribute(`id`);e!==null&&e!==``&&!this._slots.has(e)&&this.registerSlot(e,t)}for(let[e,t]of this._children)this._parent(e,t);if(this._slots.size===t)break}this._acceptingSlots=!1}_parent(e,t){let n=this._slots.get(e);n!==void 0&&t.parentElement!==n&&(this._mirrorVisible(n,t),n.appendChild(t))}_mirrorVisible(e,t){let apply=()=>{e.toggleAttribute(`hidden`,t.hidden===!0)};apply(),new MutationObserver(apply).observe(t,{attributes:!0,attributeFilter:[`hidden`]})}};customElements.define(`adw-multi-layout-view`,AdwMultiLayoutView);var AdwLayoutSlot=class extends HTMLElement{_registered=!1;static get observedAttributes(){return[`id`]}get slotId(){return this.getAttribute(`id`)}connectedCallback(){this.setAttribute(`role`,`group`),this.style.display=`contents`,this._register()}disconnectedCallback(){this._registered=!1}attributeChangedCallback(e){!this.isConnected||e!==`id`||(this._registered&&console.warn("<adw-layout-slot>: `id` is construct-only upstream; re-registering the slot."),this._register())}_register(){let e=this.slotId;if(e===null||e===``){console.error("<adw-layout-slot> created without an `id` — libadwaita refuses this with g_error.");return}let t=this.closest(`adw-multi-layout-view`);t instanceof AdwMultiLayoutView&&t.registerSlot(e,this),this._registered=!0}};customElements.define(`adw-layout-slot`,AdwLayoutSlot);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`]}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this}])}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){if(this._syncing)return;let n=this.closest(`adw-navigation-view`);n instanceof AdwNavigationView&&n.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()??Ft,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(`gtk-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-view`,AdwNavigationView),customElements.define(`adw-navigation-page`,AdwNavigationPage);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(){this._initialized||(this._initialized=!0,this._sidebarEl=document.createElement(`div`),this._sidebarEl.className=`adw-nsv-sidebar`,this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-nsv-content`,bindSlottedChildren(this,[{name:`sidebar`,into:this._sidebarEl},{name:`content`,into:this._contentEl}],(e,t)=>this._mountPane(t.name===`sidebar`?`sidebar`:`content`)).install(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._mountPane(`sidebar`),this._mountPane(`content`),this._state.subscribe(()=>{this._reflectShowContent(),this._syncClasses()}))}_mountPane(e){let t=e===`sidebar`?this._sidebarEl:this._contentEl,n=Array.from(t.children),r=n.length>0?{tag:this._tagOf(n)}:null;e===`sidebar`?this._state.setSidebar(r):this._state.setContent(r)}_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);const rr={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{static signals={"notify::show-sidebar":`notify::show-sidebar`};_initialized=!1;_sidebarEl;_contentEl;_backdropEl;_disposeBreakpoint;_breakpointApplied=!1;_state=new OverlaySplitViewState;_notifiedShowSidebar=null;_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(){this._initialized||(this._initialized=!0,this._sidebarEl=document.createElement(`div`),this._sidebarEl.className=`adw-osv-sidebar`,this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-osv-content`,this._backdropEl=document.createElement(`div`),this._backdropEl.className=`adw-osv-backdrop`,this._backdropEl.addEventListener(`click`,()=>this.hideSidebar()),bindSlottedChildren(this,[{name:`sidebar`,into:this._sidebarEl},{name:`content`,into:this._contentEl},{into:this._contentEl}]).install(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:rr}),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}}this._notifyShowSidebar()}_notifyShowSidebar(){let e=this._state.showSidebar,t=this._notifiedShowSidebar;this._notifiedShowSidebar=e,!(t===null||t===e)&&this.dispatchEvent(new CustomEvent(`notify::show-sidebar`,{bubbles:!0,detail:{showSidebar:e}}))}_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 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=createGtkImage(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 ir=new Set([`adw-action-row`,`adw-switch-row`,`adw-combo-row`,`adw-spin-row`]),ar=new Set([...ir,`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=>ar.has(e.tagName.toLowerCase()))}function describeRow(e){let t=e.getAttribute(`subtitle`);return{title:e.getAttribute(`title`)??``,subtitle:t,visible:isVisible(e),isActionRow:ir.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,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 e=document.createElement(`div`);e.className=`adw-preferences-dialog-header`;let t=document.createElement(`div`);t.className=`adw-preferences-dialog-header-side`,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-preferences-dialog-title`;let n=document.createElement(`div`);n.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()),n.appendChild(this._closeBtn),e.append(t,this._titleEl,n),this._bodyEl=document.createElement(`div`),this._bodyEl.className=`adw-preferences-dialog-body`,this._pagesEl=document.createElement(`div`),this._pagesEl.className=`adw-preferences-dialog-pages`,this._bodyEl.appendChild(this._pagesEl),this._dialogEl.append(e,this._bodyEl),bindSlottedChildren(this,[{into:this._pagesEl}]).install(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);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._observeBoxes();return}this._initialized=!0,this._headerEl=document.createElement(`div`),this._headerEl.className=`adw-preferences-group-header`;let e=document.createElement(`div`);e.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`,e.append(this._titleEl,this._descriptionEl),this._suffixEl=document.createElement(`div`),this._suffixEl.className=`adw-preferences-group-suffix`,this._headerEl.append(e,this._suffixEl),this._listboxEl=document.createElement(`div`),this._listboxEl.className=`adw-preferences-group-listbox`,bindSlottedChildren(this,[{name:`header-suffix`,into:this._suffixEl},{into:this._listboxEl}],()=>this._renderHeader()).install(this._headerEl,this._listboxEl),this.setAttribute(`role`,`group`),this._observeBoxes()}disconnectedCallback(){this._observer?.disconnect(),this._observer=null}attributeChangedCallback(){this._initialized&&this._renderHeader()}_observeBoxes(){this._observer||(this._observer=new MutationObserver(()=>this._renderHeader()),this._observer.observe(this._listboxEl,{childList:!0}),this._observer.observe(this._suffixEl,{childList:!0}),this._renderHeader())}_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);var AdwPreferencesRow=class extends HTMLElement{_titleEl;_contentEl;_initialized=!1;static get observedAttributes(){return[`title`,`title-selectable`,`use-markup`,`use-underline`,`tooltip-text`]}get title(){return this.getAttribute(`title`)??``}set title(e){e===``?this.removeAttribute(`title`):this.setAttribute(`title`,e)}get titleSelectable(){return this.hasAttribute(`title-selectable`)}set titleSelectable(e){this.toggleAttribute(`title-selectable`,e)}get useMarkup(){return this.hasAttribute(`use-markup`)}set useMarkup(e){this.toggleAttribute(`use-markup`,e)}get useUnderline(){return this.hasAttribute(`use-underline`)}set useUnderline(e){this.toggleAttribute(`use-underline`,e)}get child(){return this._contentEl?.firstElementChild??null}set child(e){this._contentEl?.replaceChildren(...e===null?[]:[e])}connectedCallback(){this._initialized||(this._initialized=!0,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-row-title`,this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-preferences-row-content`,bindSlottedChildren(this,[{name:`child`,into:this._contentEl}]).install(this._titleEl,this._contentEl),bindEmptySections(this._contentEl),this.setAttribute(`role`,`listitem`),this._render())}attributeChangedCallback(e,t,n){this._initialized&&(this._render(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:n}})))}_render(){let e=labelDisplayText(this.title,this.useMarkup,this.useUnderline);this._titleEl.textContent=e,this._titleEl.hidden=!stringIsNotEmpty(e),this._titleEl.style.userSelect=this.titleSelectable?`text`:``,applyRowTooltip(this,[this._titleEl,this._contentEl])}};customElements.define(`adw-preferences-row`,AdwPreferencesRow);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);var AdwShortcutsDialog=class extends AdwDialog{get sections(){return[...this.contentArea.children].filter(e=>e.localName===`adw-shortcuts-section`)}connectedCallback(){super.connectedCallback(),this.classList.add(`adw-shortcuts-dialog`)}};customElements.define(`adw-shortcuts-dialog`,AdwShortcutsDialog);const or=new WeakMap,sr=new WeakMap;var AdwSidebarItem=class extends HTMLElement{static get observedAttributes(){return[`title`,`subtitle`,`icon-name`,`disabled`,`hidden`,`enabled`,`visible`,`needs-attention`,`badge-number`]}get enabled(){let e=this.getAttribute(`enabled`);return e===null?!this.hasAttribute(`disabled`):booleanAttribute$2(e,!0)}set enabled(e){this.setAttribute(`enabled`,e?`true`:`false`),this.toggleAttribute(`disabled`,!e)}get visible(){let e=this.getAttribute(`visible`);return e===null?!this.hasAttribute(`hidden`):booleanAttribute$2(e,!0)}set visible(e){this.setAttribute(`visible`,e?`true`:`false`),this.toggleAttribute(`hidden`,!e)}attributeChangedCallback(e,t,n){let r=or.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===`enabled`?r.spec.enabled=booleanAttribute$2(n,!0):e===`hidden`?r.spec.visible=n===null:e===`visible`?r.spec.visible=booleanAttribute$2(n,!0):e===`needs-attention`?r.spec.needsAttention=n===null:e===`badge-number`&&(r.spec.badgeNumber=Number.parseInt(i,10)||0),r.sidebar.refresh()}},AdwSidebarSection=class extends HTMLElement{static get observedAttributes(){return[`title`]}attributeChangedCallback(e,t,n){let r=sr.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.enabled,visible:e.visible,badgeNumber:Number.parseInt(e.getAttribute(`badge-number`)??`0`,10)||0,needsAttention:e.hasAttribute(`needs-attention`)};or.set(e,{sidebar:this,spec:t}),n.push(t)}let r={title:t.getAttribute(`title`)??``,items:n};sr.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=createGtkImage(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(this._createIndicator(t)),n.appendChild(createGtkImage(`go-next`,`adw-sidebar-item-arrow`)),n.addEventListener(`click`,()=>this._activate(e.index)),n}_createIndicator(e){let t=e.badgeNumber??0,n=e.needsAttention===!0,r=document.createElement(`span`);if(r.className=`indicator`,r.hidden=!n&&t===0,r.classList.toggle(`dot`,t===0),r.classList.toggle(`needs-attention`,n),t>0){let e=document.createElement(`span`);e.className=`numeric`,e.textContent=viewSwitcherBadgeLabel(t),r.appendChild(e)}return r}_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 cr=[`value`,`lower`,`upper`,`stepIncrement`,`pageIncrement`,`pageSize`];function authoredAdjustment(e){let t={};if(!(e instanceof Element))return t;for(let n of cr){let r=e.getAttribute(attributeOf(n)),i=r===null?NaN:Number.parseFloat(r);Number.isFinite(i)&&(t[n]=i)}return t}var AdwSpinRow=class extends HTMLElement{_input;_textEl;_controlEl;_titleEl;_subtitleEl;_state=new SpinState;_initialized=!1;static get observedAttributes(){return[`title`,`subtitle`,`value`,`adjustment`,`tooltip-text`,`title-lines`,`subtitle-lines`]}get value(){return this._state.value}set value(e){this._state.setValue(this._roundToStep(e)),this._syncValue()}get adjustment(){return this._state.adjustment}set adjustment(e){this._state.configure(typeof e==`string`?parseAdjustment(e):e)}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=normalizeAdjustment(parseAdjustment(this.getAttribute(`adjustment`)));this._state.configure(e);let t=document.createElement(`div`);t.className=`adw-row-text`,this._textEl=t,this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-row-title`,this._subtitleEl=document.createElement(`span`),this._subtitleEl.className=`adw-row-subtitle`,t.append(this._titleEl,this._subtitleEl);let n=document.createElement(`div`);n.className=`adw-spin-control`,this._controlEl=n;let r=document.createElement(`button`);r.className=`adw-spin-dec`,r.textContent=`−`,r.addEventListener(`click`,()=>this._adjust(-this._state.adjustment.stepIncrement));let i=document.createElement(`input`);i.type=`text`,i.value=this._formatValue(this._state.value),i.addEventListener(`change`,()=>{let e=parseFloat(i.value);Number.isNaN(e)?i.value=this._formatValue(this._state.value):(this.value=e,this._emitChange())});let a=document.createElement(`button`);a.className=`adw-spin-inc`,a.textContent=`+`,a.addEventListener(`click`,()=>this._adjust(this._state.adjustment.stepIncrement)),n.append(r,i,a),bindSlottedChildren(this,[{name:`adjustment`,consume:e=>this._state.configure(normalizeAdjustment(authoredAdjustment(e)))}]).install(t,n);let o=this.getAttribute(`value`);this._state.setValue(this._roundToStep(o===null?this._state.value:Number.parseFloat(o))),i.value=this._formatValue(this._state.value),this._input=i,this._state.subscribe(()=>this._syncValue()),this._renderText()}attributeChangedCallback(e,t,n){if(this._initialized){if(e===`title`||e===`subtitle`||e===`tooltip-text`||e===`title-lines`||e===`subtitle-lines`){this._renderText();return}if(e===`adjustment`){this._state.configure(parseAdjustment(n));return}this._state.setValue(this._roundToStep(Number.parseFloat(n||`0`)))}}_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,applyRowTooltip(this,[this._textEl,this._controlEl]),this._applyLineClamping()}_applyLineClamping(){applyRowLineClamp({titleEl:this._titleEl,subtitleEl:this._subtitleEl,textContainerEl:this._titleEl.parentElement,getTitleLines:()=>parseRowLinesAttribute(this.getAttribute(`title-lines`)),getSubtitleLines:()=>parseRowLinesAttribute(this.getAttribute(`subtitle-lines`))})}_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.adjustment.stepIncrement);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.adjustment.stepIncrement);return t>0?e.toFixed(t):String(e)}};customElements.define(`adw-spin-row`,AdwSpinRow);const lr=`http://www.w3.org/2000/svg`,V=new Set;let ur=0;function tick(e){for(let t of V)t.drawAt(e);ur=V.size>0?requestAnimationFrame(tick):0}function startTicking(){ur===0&&V.size>0&&(ur=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(),V.add(this),this._origin=null,startTicking()}disconnectedCallback(){V.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(lr,`svg`);e.setAttribute(`fill`,`none`),e.setAttribute(`aria-hidden`,`true`);let t=document.createElementNS(lr,`circle`);t.setAttribute(`stroke`,`currentColor`),t.setAttribute(`stroke-opacity`,`0.15`);let n=document.createElementNS(lr,`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?Ht:this._lastProgress)}_lastProgress=Ht;_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 PopoverMenuView=class{surface;prefix;onActivate;_model=[];_actions=null;_title=``;_page=[];_openers=new Set;_backRow=null;_key=`[]`;_rows=[];constructor(e,t,n){this.surface=e,this.prefix=t,this.onActivate=n,this.surface.addEventListener(`keydown`,e=>this._onKeyDown(e))}_onKeyDown(e){let t=document.activeElement;if(!(t===null||!this.surface.contains(t))){if(e.key===`ArrowRight`&&this._openers.has(t)){e.preventDefault(),t.click();return}e.key===`ArrowLeft`&&t===this._backRow&&(e.preventDefault(),t.click())}}get rows(){return this._rows}get page(){return this._page}showPage(e){this._page=[...e]}get focusableRows(){return this._rows.filter(e=>!e.hidden&&!e.disabled)}focusPage(e){let t=this.focusableRows;(t[e]??t[0])?.focus()}setMenuModel(e){let t=JSON.stringify(e);t!==this._key&&(this._key=t,this._page=[]),this._model=e}setActions(e){this._actions=e}setTitle(e){this._title=e}reset(){this._page=[]}currentItems(){if(this._page.length===0)return this._model;let e=menuNodeAt(this._model,this._page);return e!==null&&e.kind!==`item`?e.items:this._model}render(){this.surface.replaceChildren(),this._rows=[],this._openers=new Set,this._backRow=null;let e=menuNodeAt(this._model,this._page);this._page.length>0&&e!==null&&e.kind===`submenu`?this.surface.appendChild(this.backRow(e.label)):this._title.length>0&&this.surface.appendChild(this.heading(this._title,`${this.prefix}-title`));let t=``;for(let e of flattenMenu(this.currentItems(),this._page)){e.separated&&this.surface.appendChild(this.separator());let n=e.path.slice(0,-1),r=n.join(`.`);if(r!==t){t=r;let e=this.sectionHeading(n);e!==null&&this.surface.appendChild(this.heading(e,`adw-popover-section-title`))}e.node.kind===`submenu`?this.surface.appendChild(this.submenuRow(e.node.label,e.node.icon,e.path)):this.surface.appendChild(this.itemRow(e.node,e.path))}}sectionHeading(e){if(e.length<=this._page.length)return null;let t=menuNodeAt(this._model,e);return t!==null&&t.kind===`section`&&t.label!==void 0?t.label:null}heading(e,t){let n=document.createElement(`div`);return n.className=`adw-popover-title ${t}`,n.textContent=e,n}separator(){let e=document.createElement(`div`);return e.className=`adw-popover-separator`,e.setAttribute(`role`,`separator`),e}baseRow(e){let t=document.createElement(`button`);return t.type=`button`,t.className=`adw-popover-item ${e}`,t.tabIndex=-1,this._rows.push(t),t}backRow(e){let t=this.baseRow(`${this.prefix}-item adw-popover-back`);t.setAttribute(`role`,`menuitem`),t.appendChild(createGtkImage(`go-previous`,`${this.prefix}-item-icon`));let n=document.createElement(`span`);return n.className=`${this.prefix}-item-label`,n.textContent=e.length>0?e:`Back`,t.appendChild(n),t.addEventListener(`click`,()=>{this._page=this._page.slice(0,-1),this.render(),this.focusPage(0)}),this._backRow=t,t}submenuRow(e,t,n){let r=this.baseRow(`${this.prefix}-item`);r.setAttribute(`role`,`menuitem`),r.setAttribute(`aria-haspopup`,`menu`),t!==void 0&&t.length>0&&r.appendChild(createGtkImage(t,`${this.prefix}-item-icon`));let i=document.createElement(`span`);return i.className=`${this.prefix}-item-label`,i.textContent=e,r.appendChild(i),r.appendChild(createGtkImage(`go-next`,`adw-popover-item-arrow`)),r.addEventListener(`click`,()=>{this._page=[...n],this.render(),this.focusPage(1)}),this._openers.add(r),r}itemRow(e,t){let n=resolveMenuItemState(e,this._actions??void 0),r=this.baseRow(`${this.prefix}-item`);if(r.hidden=!n.visible,r.disabled=!n.sensitive,n.sensitive||r.setAttribute(`aria-disabled`,`true`),n.role===`normal`)r.setAttribute(`role`,`menuitem`);else{r.setAttribute(`role`,n.role===`check`?`menuitemcheckbox`:`menuitemradio`),r.setAttribute(`aria-checked`,String(n.toggled));let e=document.createElement(`span`);e.className=`adw-popover-item-check ${n.role===`radio`?`radio`:``}`.trim(),r.appendChild(e)}e.icon!==void 0&&e.icon.length>0&&r.appendChild(createGtkImage(e.icon,`${this.prefix}-item-icon`));let i=document.createElement(`span`);if(i.className=`${this.prefix}-item-label`,i.textContent=e.label,r.appendChild(i),e.accel!==void 0&&e.accel.length>0){let t=document.createElement(`span`);t.className=`adw-popover-item-accel`,t.textContent=e.accel,r.appendChild(t)}return r.addEventListener(`click`,()=>{n.sensitive&&this.onActivate(t)}),r}};const dr=[`bottom`,`top`,`start`,`end`],fr=[`start`,`end`],pr=[`menu`,`listbox`],mr=[...pr,`dialog`];var GtkPopover=class extends HTMLElement{_state=new PopoverState;_anchor=null;_initialized=!1;_reflecting=!1;_onDocumentPointerDown=e=>{if(!this.autohide)return;let t=e.target;this.contains(t)||this.anchor?.contains(t)!==!0&&this._state.dismiss()};_onDocumentKeyDown=e=>{e.key===`Escape`&&this.autohide&&(e.stopPropagation(),this._state.dismiss(),this.anchor?.focus())};static get observedAttributes(){return[`open`,`position`,`align`,`role`,`menu`,`autohide`]}get open(){return this._state.open}set open(e){e?this._state.popup():this._state.popdown()}get autohide(){return this.getAttribute(`autohide`)!==`false`}set autohide(e){this.setAttribute(`autohide`,String(e))}get anchor(){return this._anchor??this.parentElement}set anchor(e){this._anchor=e}get position(){let e=this.getAttribute(`position`);return dr.includes(e)?e:`bottom`}set position(e){this.setAttribute(`position`,e)}get align(){let e=this.getAttribute(`align`);return fr.includes(e)?e:`start`}set align(e){this.setAttribute(`align`,e)}get popoverRole(){let e=this.getAttribute(`role`);return mr.includes(e)?e:`menu`}get items(){return[...this.querySelectorAll(`.adw-popover-item`)].filter(e=>!e.hidden&&!e.disabled)}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||!pr.includes(this.popoverRole))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(`gtk-popover`,GtkPopover);const hr={flat:`flat`,suggested:`suggested-action`,destructive:`destructive-action`},gr={"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`},_r={down:`bottom`,up:`top`,left:`start`,right:`end`};var AdwSplitButton=class extends HTMLElement{_state=new SplitButtonState;_actionEl;_dropdownEl;_arrowEl;_menuEl;_menuView;_actions=null;_inlineLabel=``;_openReflected=!1;_initialized=!1;static get observedAttributes(){return[`label`,`icon-name`,`use-underline`,`tooltip`,`dropdown-tooltip`,`direction`,`menu-model`,`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 menuModel(){return this._state.menuModel??[]}set menuModel(e){this._state.setMenuModel(this._acceptMenu(e)),this._initialized&&this._render()}_acceptMenu(e,t=!0){let n=normalizeMenuModel(e);if(t)return assertMenuRenderable(n,E),n;let r=menuRefusals(n,E);if(r.length===0)return n;console.error(`${E.name} cannot render this menu, so it has none:`);for(let e of r)console.error(` [${e.path.join(`.`)}] ${e.message}`);return[]}get actions(){return this._actions}set actions(e){this._actions=e??null,this._menuView?.setActions(this._actions),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=createGtkImage(null),this._dropdownEl.appendChild(this._arrowEl),this._menuEl=document.createElement(`gtk-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._menuView.reset())}),this._menuView=new PopoverMenuView(this._menuEl,`adw-split-button-menu`,e=>{let t=this._state.activateMenuItem(e);t!==null&&(activateElementMenuItem(this,t),this.dispatchEvent(new CustomEvent(`menu-activated`,{bubbles:!0,detail:{label:t.label,action:t.action,id:t.id??t.label,path:[...e]}})))}),this._menuView.setActions(this._actions),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-model`:this._state.setMenuModel(this._acceptMenu(parseMenuModel(n),!1));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(this._acceptMenu(parseMenuModel(this.getAttribute(`menu-model`)),!1))}_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._menuView.focusableRows[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(hr))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(createGtkImage(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=gr[n],this._arrowEl.style.transform=n===`pan-up-symbolic`?`rotate(180deg)`:``,this._menuEl.position=_r[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.open=this._state.open;let e=this._state.menuModel??[];this._menuView.setMenuModel(e),this._menuView.setActions(this._actions??menuActionsOfElement(this,e)),this._menuView.render()}};customElements.define(`adw-split-button`,AdwSplitButton);var AdwStatusPage=class extends HTMLElement{_iconEl;_titleEl;_descEl;_childEl;_initialized=!1;static get observedAttributes(){return[`icon`,`icon-name`,`title`,`description`,`compact`]}connectedCallback(){this._initialized||(this._initialized=!0,this._iconEl=createGtkImage(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`,bindSlottedChildren(this,[{name:`child`,into:this._childEl},{into:this._childEl}]).install(this._iconEl,this._titleEl,this._descEl,this._childEl),bindEmptySections(this._childEl),this._render())}attributeChangedCallback(){this._initialized&&this._render()}_render(){this.hasAttribute(`compact`)&&this.classList.add(`compact`);let e=this.getAttribute(`icon`)??this.getAttribute(`icon-name`);this._iconEl.iconName=e,this._iconEl.hidden=!stringIsNotEmpty(e);let t=this.getAttribute(`title`)??``;this._titleEl.textContent=t,this._titleEl.hidden=!stringIsNotEmpty(t);let n=this.getAttribute(`description`)??``;this._descEl.textContent=n,this._descEl.hidden=!stringIsNotEmpty(n)}};customElements.define(`adw-status-page`,AdwStatusPage);var AdwSwitchRow=class extends HTMLElement{_switchEl;_prefixEl;_textEl;_titleEl;_subtitleEl;_state=new SwitchRowState;_initialized=!1;static get observedAttributes(){return[`title`,`subtitle`,`active`,`tooltip-text`,`title-lines`,`subtitle-lines`]}get prefixSection(){return this._prefixEl}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._textEl=e,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._prefixEl=document.createElement(`div`),this._prefixEl.className=`adw-switch-row-prefix`,this._switchEl=document.createElement(`gtk-switch`),this._switchEl.unfocusable=!0,bindSlottedChildren(this,[{name:`prefix`,into:this._prefixEl}]).install(this._prefixEl,e,this._switchEl),bindEmptySections(this._prefixEl),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,applyRowTooltip(this,[this._prefixEl,this._textEl]),this._applyLineClamping()}_applyLineClamping(){applyRowLineClamp({titleEl:this._titleEl,subtitleEl:this._subtitleEl,textContainerEl:this._titleEl.parentElement,getTitleLines:()=>parseRowLinesAttribute(this.getAttribute(`title-lines`)),getSubtitleLines:()=>parseRowLinesAttribute(this.getAttribute(`subtitle-lines`))})}};customElements.define(`adw-switch-row`,AdwSwitchRow);const createTabChip=e=>{let t=document.createElement(`button`);t.type=`button`,t.className=`adw-tab`,t.setAttribute(`role`,`tab`);let n=createGtkImage(null,`adw-tab-icon`),r=document.createElement(`adw-spinner`);r.className=`adw-tab-spinner`,r.setAttribute(`size`,`16`),r.hidden=!0;let i=document.createElement(`span`);i.className=`adw-tab-title`;let a=createGtkImage(null,`adw-tab-indicator`),o=document.createElement(`button`);return o.type=`button`,o.className=`adw-tab-close`,o.setAttribute(`aria-label`,`Close tab`),o.addEventListener(`click`,t=>{t.stopPropagation(),e.onClose()}),t.append(n,r,i,a,o),t.addEventListener(`click`,()=>e.onSelect()),t.addEventListener(`pointerenter`,()=>e.onHover(!0)),t.addEventListener(`pointerleave`,()=>e.onHover(!1)),{el:t,icon:n,spinner:r,label:i,indicator:a,close:o}},refreshTabChip=(e,t,n)=>{e.label.textContent=t.title,e.el.title=tabTooltip(t),e.el.classList.toggle(`pinned`,t.pinned),e.el.classList.toggle(`needs-attention`,t.needsAttention),e.el.classList.toggle(`closing`,t.closing);let r=tabIconState(t,n);e.icon.iconName=r.icon,e.icon.hidden=!r.iconVisible||r.spinner,e.spinner.hidden=!(r.spinner&&r.iconVisible),e.indicator.iconName=t.indicatorIcon,e.indicator.hidden=!r.indicatorVisible},chipPosition=(e,t)=>t.getBoundingClientRect().left-e.getBoundingClientRect().left+e.scrollLeft,refreshTabChipClose=(e,t,n,r)=>{let i=e.scrollLeft,a=chipPosition(e,t.el),o=a>=i&&a+t.el.offsetWidth<=i+e.clientWidth;t.close.hidden=!tabCloseVisible({hovering:r.hovering,fullyVisible:o,selected:r.selected,dragging:!1,pinned:n.pinned})},scrollChipIntoBar=(e,t)=>{let n=e.clientWidth,r=t.offsetWidth;if(n<=0||r<=0)return;let i=e.scrollLeft,a=chipPosition(e,t),o=Math.min(r,n-r)/2;a-5<i?e.scrollLeft=a-o:a+r+5>i+n&&(e.scrollLeft=a+r+o-n)},vr=[`page-attached`,`page-detached`,`page-reordered`,`page-updated`,`page-pinned`,`notify::selected-page`];var AdwTabBar=class extends HTMLElement{_boxEl;_startEl;_endEl;_indicatorEl;_chips=new Map;_hovered=new Set;_view=null;_initialized=!1;_preferredAction=null;_dropTypes=[];_dropActions=[];_dropArmed=!1;static get observedAttributes(){return[`view`,`autohide`,`expand-tabs`,`inverted`,`extra-drag-preload`]}get view(){return this._view}set view(e){this.setView(e===null?null:typeof e==`string`?this._resolveView(e):e)}get startActionWidget(){return this._startEl?.firstElementChild??null}set startActionWidget(e){this.startActionWidget!==e&&(this._startEl.replaceChildren(...e===null?[]:[e]),this.dispatchEvent(new CustomEvent(`notify::start-action-widget`,{bubbles:!0,detail:{widget:e}})))}get endActionWidget(){return this._endEl?.firstElementChild??null}set endActionWidget(e){this.endActionWidget!==e&&(this._endEl.replaceChildren(...e===null?[]:[e]),this.dispatchEvent(new CustomEvent(`notify::end-action-widget`,{bubbles:!0,detail:{widget: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 inverted(){return this.hasAttribute(`inverted`)}set inverted(e){e?this.setAttribute(`inverted`,``):this.removeAttribute(`inverted`)}get extraDragPreload(){return this.hasAttribute(`extra-drag-preload`)}set extraDragPreload(e){e?this.setAttribute(`extra-drag-preload`,``):this.removeAttribute(`extra-drag-preload`)}get tabsRevealed(){return tabsRevealed({autohide:this.autohide,nPages:this._view?.nPages??0,nPinnedPages:this._view?.nPinnedPages??0,isTransferringPage:!1})}get isOverflowing(){return this._initialized?this.scrollWidth>this.clientWidth:!1}get extraDragPreferredAction(){return this._preferredAction}setView(e){this._view!==e&&(this._unbindView(),this._view=e,this._bindView(),this._syncChips(),this._applyRevealed(),this.dispatchEvent(new CustomEvent(`notify::view`,{bubbles:!0,detail:{view:e}})))}connectedCallback(){if(this._initialized){this._bindView(),this._syncChips();return}this._initialized=!0,this.classList.add(`adw-tab-bar`),this.setAttribute(`role`,`tablist`),this._startEl=document.createElement(`div`),this._startEl.className=`adw-tab-bar-start-action`,this._boxEl=document.createElement(`div`),this._boxEl.className=`adw-tab-box`,this._indicatorEl=document.createElement(`div`),this._indicatorEl.className=`adw-tab-box-overflow`,this._indicatorEl.hidden=!0,this._boxEl.appendChild(this._indicatorEl),this._endEl=document.createElement(`div`),this._endEl.className=`adw-tab-bar-end-action`,bindSlottedChildren(this,[{name:`start-action-widget`,into:this._startEl},{name:`end-action-widget`,into:this._endEl}]).install(this._startEl,this._boxEl,this._endEl);let e=this.getAttribute(`view`);this.setView(e===null?null:this._resolveView(e)),this._bindView(),this._syncChips(),this._applyRevealed(),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),this.addEventListener(`dragover`,this._onDragOver),this.addEventListener(`drop`,this._onDrop)}disconnectedCallback(){this._unbindView()}attributeChangedCallback(e,t,n){if(this._initialized){switch(e){case`view`:this.setView(n===null?null:this._resolveView(n));return;case`autohide`:this._applyRevealed();break;case`expand-tabs`:case`inverted`:case`extra-drag-preload`:break}(n!==null||e===`view`)&&this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:n}}))}}setupExtraDropTarget(e,t=[`copy`,`move`]){this._dropTypes=e,this._dropActions=t}_resolveView(e){return document.getElementById(e)??null}_bindView(){this._unbindView();for(let e of vr)this._view?.addEventListener(e,this._onViewChange)}_unbindView(){for(let e of vr)this._view?.removeEventListener(e,this._onViewChange)}_onViewChange=()=>{this._syncChips(),this._applyRevealed()};_syncChips(){let e=this._view?.pages??[],t=new Set;e.forEach((e,n)=>{t.add(e.id);let r=this._chips.get(e.id);if(r===void 0){let t=createTabChip({onSelect:()=>this._view?.setSelectedPage(e.id),onClose:()=>this._view?.closePage(e.id),onHover:t=>{t?this._hovered.add(e.id):this._hovered.delete(e.id),this._refreshOne(e.id)}});t.el.dataset.pageId=e.id,t.close.tabIndex=-1,this._chips.set(e.id,t),this._boxEl.insertBefore(t.el,this._boxEl.children[n]??null)}else this._boxEl.children[n]!==r.el&&this._boxEl.insertBefore(r.el,this._boxEl.children[n]??null);this._refreshOne(e.id)});for(let[e,n]of this._chips)t.has(e)||(n.el.remove(),this._chips.delete(e),this._hovered.delete(e));this._applyActiveState(),this._boxEl.classList.toggle(`single-tab`,e.length<=1),this._applyOverflow()}_refreshOne(e){let t=this._view?.pages.find(t=>t.id===e),n=this._chips.get(e);t===void 0||n===void 0||(refreshTabChip(n,t,this._view?.getAttribute(`default-icon`)),refreshTabChipClose(this,n,t,{hovering:this._hovered.has(e),selected:this._view?.selectedId===e}))}_applyActiveState(){let e=this._view?.selectedId??null;for(let[t,n]of this._chips){let r=t===e;n.el.classList.toggle(`active`,r),n.el.setAttribute(`aria-selected`,String(r)),n.el.tabIndex=r?0:-1;let i=this._view?.pages.find(e=>e.id===t);i!==void 0&&refreshTabChipClose(this,n,i,{hovering:this._hovered.has(t),selected:r})}if(e===null)return;let t=this._chips.get(e);t!==void 0&&scrollChipIntoBar(this,t.el)}_applyRevealed(){this.hidden=!this.tabsRevealed}_applyOverflow(){this._indicatorEl.hidden=!this.isOverflowing}_onKeyDown(e){let t=this._view;if(t===null)return;let n=!1;if(e.ctrlKey&&e.key===`Tab`)n=e.shiftKey?t.cyclePreviousPage():t.cycleNextPage();else if(e.ctrlKey&&(e.key===`PageUp`||e.key===`PageDown`))n=e.key===`PageUp`?t.selectPreviousPage():t.selectNextPage();else if(e.ctrlKey&&(e.key===`Home`||e.key===`End`))n=e.key===`Home`?t.selectFirstPage():t.selectLastPage();else if(e.altKey&&/^[0-9]$/.test(e.key)){let r=Number.parseInt(e.key,10);n=t.selectNthPage(r===0?9:r-1)}else e.key===`ArrowLeft`||e.key===`ArrowRight`?n=e.key===`ArrowLeft`?t.selectPreviousPage():t.selectNextPage():(e.key===`Home`||e.key===`End`)&&(n=e.key===`Home`?t.selectFirstPage():t.selectLastPage());if(!n)return;e.preventDefault();let r=t.selectedId;r!==null&&this._chips.get(r)?.el.focus({preventScroll:!0})}_onDragOver=e=>{this._dropTypes.length===0||e.dataTransfer===null||[...this._dropTypes].find(t=>e.dataTransfer?.types.includes(t))!==void 0&&(e.preventDefault(),e.dataTransfer.dropEffect!==`none`&&(e.dataTransfer.dropEffect=this._dropEffects(e)),this._armHoverValue())};_onDrop=e=>{if(this._dropTypes.length===0||e.dataTransfer===null)return;let t=[...this._dropTypes].find(t=>e.dataTransfer?.types.includes(t));if(t===void 0)return;e.preventDefault();let n=this._dropEffects(e),r=this.dispatchEvent(new CustomEvent(`extra-drag-drop`,{bubbles:!0,cancelable:!0,detail:{action:n,data:e.dataTransfer.getData(t)}}));e.dataTransfer.dropEffect=r?n:`none`};_dropEffects(e){let t=this._preferredAction;return t!==null&&this._dropActions.includes(t)?t:this._dropActions[0]??`copy`}_armHoverValue(){if(this._dropArmed)return;this._dropArmed=!0;let e=new CustomEvent(`extra-drag-value`,{bubbles:!0,cancelable:!0,detail:{action:null}});this.dispatchEvent(e);let t=e.detail.action;t!==this._preferredAction&&(this._preferredAction=t,this.dispatchEvent(new CustomEvent(`notify::extra-drag-preferred-action`,{bubbles:!0,detail:{action:t}})))}};customElements.define(`adw-tab-bar`,AdwTabBar);const yr=[`page-attached`,`page-detached`,`page-updated`,`notify::selected-page`];var AdwTabButton=class extends HTMLElement{_button;_binEl;_labelEl;_indicatorEl;_view=null;_initialized=!1;static get observedAttributes(){return[`view`]}get view(){return this._view}set view(e){this.setView(e===null?null:typeof e==`string`?this._resolveView(e):e)}setView(e){this._view!==e&&(this._unbindView(),this._view=e,this._bindView(),this._render(),this.dispatchEvent(new CustomEvent(`notify::view`,{bubbles:!0,detail:{view:e}})))}connectedCallback(){if(this._initialized){this._bindView(),this._render();return}this._initialized=!0,this._button=document.createElement(`button`),this._button.type=`button`,this._button.className=`adw-button image-button`,this._button.title=`View Open Tabs`,this._binEl=document.createElement(`span`),this._binEl.className=`adw-tab-button-indicatorbin`;let e=document.createElement(`span`);e.className=`adw-tab-button-plate`,this._labelEl=document.createElement(`span`),this._labelEl.className=`adw-tab-button-label numeric`,this._indicatorEl=document.createElement(`span`),this._indicatorEl.className=`adw-tab-button-indicator`,this._binEl.append(e,this._labelEl),this._button.append(this._binEl,this._indicatorEl),this.replaceChildren(this._button),this.setAttribute(`role`,`button`);let t=this.getAttribute(`view`);this.setView(t===null?null:this._resolveView(t)),this._bindView(),this._render()}disconnectedCallback(){this._unbindView()}attributeChangedCallback(e,t,n){!this._initialized||e!==`view`||this.setView(n===null?null:this._resolveView(n))}_resolveView(e){return document.getElementById(e)??null}_onViewChange=()=>this._render();_bindView(){this._unbindView();for(let e of yr)this._view?.addEventListener(e,this._onViewChange)}_unbindView(){for(let e of yr)this._view?.removeEventListener(e,this._onViewChange)}_render(){let e=this._view,t=e?.nPages??0,n=t<100;this._labelEl.textContent=n?String(t):``,this._labelEl.hidden=!n,this._labelEl.classList.toggle(`small`,t>=10),this._binEl.classList.toggle(`overflow`,!n);let r=e?.selectedId??null,i=e?.pages.some(e=>e.needsAttention&&e.id!==r)??!1;this._indicatorEl.classList.toggle(`needs-attention`,i),this._indicatorEl.hidden=!i,this._button.setAttribute(`aria-label`,`View Open Tabs (${t})`)}};customElements.define(`adw-tab-button`,AdwTabButton);var AdwTabOverview=class extends HTMLElement{_childEl;_overviewEl;_headerEl;_startButtonsEl;_endButtonsEl;_titleEl;_searchBtn;_searchEntry;_searchClamp;_searchBar;_menuBtn;_gridEl;_pinnedGridEl;_emptyState;_searchEmptyState;_newTabBtn;_thumbs=new Map;_view=null;_model=[];_searchActive=!1;_initialized=!1;_appliedOpen=!1;_reflecting=!1;static get observedAttributes(){return[`view`,`open`,`inverted`,`enable-search`,`enable-new-tab`,`secondary-menu`,`show-start-title-buttons`,`show-end-title-buttons`,`extra-drag-preload`]}get view(){return this._view}set view(e){this.setView(e===null?null:typeof e==`string`?this._resolveView(e):e)}setView(e){this._view!==e&&(this._unbindView(),this._view=e,this._bindView(),this._initialized&&this._syncAll(),this.dispatchEvent(new CustomEvent(`notify::view`,{bubbles:!0,detail:{view:e}})))}get child(){return this._childEl.firstElementChild}get open(){return this.hasAttribute(`open`)}set open(e){this.setOpen(e)}get inverted(){return this.hasAttribute(`inverted`)}set inverted(e){this.toggleAttribute(`inverted`,e)}get enableSearch(){return this.getAttribute(`enable-search`)!==`false`}set enableSearch(e){this.setAttribute(`enable-search`,String(e))}get searchActive(){return this._searchActive}get enableNewTab(){return this.hasAttribute(`enable-new-tab`)}set enableNewTab(e){this.toggleAttribute(`enable-new-tab`,e)}get secondaryMenu(){return this._model}set secondaryMenu(e){let t=normalizeMenuModel(e);assertMenuRenderable(t,E),this._model=t,this._applyMenu()}get showStartTitleButtons(){return this.getAttribute(`show-start-title-buttons`)!==`false`}set showStartTitleButtons(e){this.setAttribute(`show-start-title-buttons`,String(e))}get showEndTitleButtons(){return this.getAttribute(`show-end-title-buttons`)!==`false`}set showEndTitleButtons(e){this.setAttribute(`show-end-title-buttons`,String(e))}get extraDragPreload(){return this.hasAttribute(`extra-drag-preload`)}set extraDragPreload(e){this.toggleAttribute(`extra-drag-preload`,e)}get extraDragPreferredAction(){return 0}activateOverviewOpen(){return this.open||this._view===null?!1:(this.setOpen(!0),!0)}activateOverviewClose(){return!this.open||this._view===null||this._view.nPages===0?!1:(this.setOpen(!1),!0)}connectedCallback(){if(this._initialized){this._bindView(),this._syncAll();return}this._initialized=!0,this._childEl=document.createElement(`div`),this._childEl.className=`adw-tab-overview-child`,this._overviewEl=document.createElement(`div`),this._overviewEl.className=`overview adw-tab-overview-toolbar`,this._headerEl=document.createElement(`div`),this._headerEl.className=`adw-header-bar overview-header-bar`,this._startButtonsEl=document.createElement(`div`),this._startButtonsEl.className=`overview-title-buttons start`,this._endButtonsEl=document.createElement(`div`),this._endButtonsEl.className=`overview-title-buttons end`,this._searchBtn=document.createElement(`button`),this._searchBtn.type=`button`,this._searchBtn.className=`adw-button image-button search-button`,this._searchBtn.title=`Search Tabs`,this._searchBtn.appendChild(createGtkImage(`system-search`,`search-button-icon`)),this._titleEl=document.createElement(`div`),this._titleEl.className=`adw-window-title numeric overview-title`,this._menuBtn=document.createElement(`gtk-menu-button`),this._menuBtn.setAttribute(`icon-name`,`view-more`),this._menuBtn.className=`secondary-menu-button`,this._menuBtn.hidden=!0,this._headerEl.append(this._startButtonsEl,this._searchBtn,this._titleEl,this._endButtonsEl,this._menuBtn),this._searchBar=document.createElement(`div`),this._searchBar.className=`adw-search-bar overview-search-bar`,this._searchClamp=document.createElement(`div`),this._searchClamp.className=`adw-clamp overview-search-clamp`,this._searchEntry=document.createElement(`input`),this._searchEntry.type=`search`,this._searchEntry.className=`adw-entry overview-search-entry`,this._searchEntry.placeholder=`Search tabs`,this._searchEntry.setAttribute(`aria-label`,`Search tabs`),this._searchClamp.appendChild(this._searchEntry),this._searchBar.appendChild(this._searchClamp);let e=document.createElement(`div`);e.className=`adw-tab-overview-content`;let t=document.createElement(`div`);t.className=`adw-tab-overview-scroll`,this._pinnedGridEl=this._createGrid(`adw-tab-grid pinned-grid`,`Pinned tabs`),this._gridEl=this._createGrid(`adw-tab-grid`,`Open tabs`),t.append(this._pinnedGridEl,this._gridEl),this._emptyState=document.createElement(`adw-status-page`),this._emptyState.className=`overview-empty-state`,this._emptyState.setAttribute(`icon`,`view-grid`),this._emptyState.setAttribute(`title`,`No Open Tabs`),this._emptyState.hidden=!0,this._searchEmptyState=document.createElement(`adw-status-page`),this._searchEmptyState.className=`overview-search-empty-state`,this._searchEmptyState.setAttribute(`icon`,`system-search`),this._searchEmptyState.setAttribute(`title`,`No Tabs Found`),this._searchEmptyState.setAttribute(`description`,`Try a different search`),this._searchEmptyState.hidden=!0,this._newTabBtn=document.createElement(`button`),this._newTabBtn.type=`button`,this._newTabBtn.className=`adw-button pill suggested-action new-tab-button`,this._newTabBtn.append(createGtkImage(`list-add`,`new-tab-button-icon`),document.createTextNode(`New Tab`)),e.append(t,this._emptyState,this._searchEmptyState,this._newTabBtn),this._overviewEl.append(this._headerEl,this._searchBar,e);let n=Array.from(this.children);this.replaceChildren(this._childEl,this._overviewEl);for(let e of n)this._childEl.appendChild(e);this._searchEntry.addEventListener(`input`,()=>this._onSearchChanged()),this._searchEntry.addEventListener(`keydown`,e=>this._onSearchKeyDown(e)),this._searchBtn.addEventListener(`click`,()=>this._toggleSearchMode()),this._newTabBtn.addEventListener(`click`,()=>this._requestCreateTab()),this.addEventListener(`keydown`,e=>this._onKeyDown(e));let r=this.getAttribute(`view`);this.setView(r===null?this._findView():this._resolveView(r)),r!==null&&this.removeAttribute(`view`);let i=this.getAttribute(`secondary-menu`);i!==null&&(this.secondaryMenu=JSON.parse(i),this.removeAttribute(`secondary-menu`)),this._applyOpen(),this._syncAll()}disconnectedCallback(){this._unbindView()}attributeChangedCallback(e,t,n){if(this._initialized)switch(e){case`view`:this.setView(n===null?this._findView():this._resolveView(n));return;case`open`:this._reflecting||this._applyOpen();return;case`secondary-menu`:if(n===null)return;try{this.secondaryMenu=JSON.parse(n)}catch(e){console.error(`<adw-tab-overview secondary-menu> is not valid JSON: ${String(e)}`)}return;case`enable-new-tab`:this._applyNewTabButton();return;case`inverted`:this._syncGrids();return;case`enable-search`:case`show-start-title-buttons`:case`show-end-title-buttons`:this._applyHeaderBar();return}}_resolveView(e){return document.getElementById(e)??this._findView()}_findView(){return this.querySelector(`adw-tab-view`)}_bindView(){this._unbindView();for(let e of xr)this._view?.addEventListener(e,this._onViewChange)}_unbindView(){for(let e of xr)this._view?.removeEventListener(e,this._onViewChange)}_onViewChange=()=>{this._syncAll()};_syncAll(){this._applyTitle(),this._syncGrids(),this._applyEmptyStates(),this._applyNewTabButton(),this._applyHeaderBar()}_applyTitle(){let e=this._view;this._titleEl.textContent=e===null?``:e.nPages===1?`1 Tab`:`${e.nPages} Tabs`}_syncGrids(){let e=this._view,t=this._searchActive?this._searchEntry.value:``,n=new Set,r=[],i=[];if(e!==null)for(let a of e.pages){if(!tabSearchMatches(a,t)){this._thumbs.get(a.id)?.root.remove(),this._thumbs.delete(a.id);continue}n.add(a.id);let e=this._thumbFor(a.id);this._refreshThumb(e,a),(a.pinned?r:i).push(e.root)}for(let[e,t]of this._thumbs)n.has(e)||(t.root.remove(),this._thumbs.delete(e));this._pinnedGridEl.replaceChildren(...r),this._gridEl.replaceChildren(...i),this._pinnedGridEl.hidden=r.length===0}_applyEmptyStates(){let e=this._pinnedGridEl.childElementCount===0&&this._gridEl.childElementCount===0;this._emptyState.hidden=!(e&&!this._searchActive),this._searchEmptyState.hidden=!(e&&this._searchActive)}_applyNewTabButton(){this._newTabBtn.hidden=!(this.enableNewTab&&!this._searchActive)}_applyHeaderBar(){let e=this._model.length>0;this._headerEl.hidden=!(this.enableSearch||e||this.showStartTitleButtons||this.showEndTitleButtons),this._startButtonsEl.hidden=!this.showStartTitleButtons,this._endButtonsEl.hidden=!this.showEndTitleButtons,this._searchBtn.hidden=!this.enableSearch,this._searchBar.hidden=!this.enableSearch||!this._searchMode,this._menuBtn.hidden=!e}_applyMenu(){let e=this._menuBtn;this._model.length>0&&(e.menuModel=this._model),this._applyHeaderBar()}_applyOpen(){let e=this.open;this._overviewEl.hidden=!e,this._childEl.classList.toggle(`background`,e),this._childEl.inert=e,e!==this._appliedOpen&&(this._appliedOpen=e,this._reflecting=!0,e?this.hasAttribute(`open`)||this.setAttribute(`open`,``):this.hasAttribute(`open`)&&(this._searchMode=!1,this._setSearchActive(!1),this._searchEntry.value=``,this.removeAttribute(`open`)),this._reflecting=!1,this.dispatchEvent(new CustomEvent(`notify::open`,{bubbles:!0,detail:{open:e}})))}setOpen(e){this.open!==e&&(this._reflecting=!0,this.toggleAttribute(`open`,e),this._reflecting=!1,this._applyOpen(),e&&this._syncAll())}_searchMode=!1;_toggleSearchMode(){this._searchMode=!this._searchMode,this._searchBar.hidden=!this.enableSearch||!this._searchMode,this._searchMode?this._searchEntry.focus():this._stopSearch()}_onSearchChanged(){this._setSearchActive(this._searchEntry.value!==``),this._syncGrids(),this._applyEmptyStates(),this._applyNewTabButton()}_stopSearch(){this._searchEntry.value=``,this._setSearchActive(!1),this._syncGrids(),this._applyEmptyStates(),this._applyNewTabButton()}_setSearchActive(e){e!==this._searchActive&&(this._searchActive=e,this.dispatchEvent(new CustomEvent(`notify::search-active`,{bubbles:!0,detail:{searchActive:e}})))}_onSearchKeyDown(e){if(e.key===`Escape`){this._stopSearch(),this._searchMode=!1,this._searchBar.hidden=!this.enableSearch||!this._searchMode;return}e.key===`Enter`&&this._searchActive&&(this._focusFirstRow(this._pinnedGridEl)||this._focusFirstRow(this._gridEl))&&e.preventDefault()}_onKeyDown(e){if(!this.open)return;let t=e.target;if(t instanceof Node&&!this._onGridKey(e,t)&&!(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)){if(e.key===`ArrowDown`){if(this._searchBar.contains(t)||this._searchBtn.contains(t)){(this._focusFirstRow(this._pinnedGridEl)||this._focusFirstRow(this._gridEl))&&e.preventDefault();return}if(this._menuBtn.contains(t)){(this._focusLastRow(this._pinnedGridEl)||this._focusLastRow(this._gridEl))&&e.preventDefault();return}if(this._newTabBtn.contains(t))return;(this._gridEl.contains(t)||this._pinnedGridEl.contains(t))&&this._newTabBtn.hidden===!1&&(e.preventDefault(),this._newTabBtn.focus());return}this._newTabBtn.contains(t)&&(this._focusLastRow(this._gridEl)||this._focusLastRow(this._pinnedGridEl))&&e.preventDefault()}}_onGridKey(e,t){if(e.altKey||e.ctrlKey||e.metaKey)return!1;let n=[this._pinnedGridEl,this._gridEl].find(e=>e.contains(t));if(n===void 0)return!1;let r=[...n.children].filter(e=>e instanceof HTMLElement),i=r.findIndex(e=>e.contains(t));if(i<0||t instanceof Element&&t.closest(`button`)!==null)return!1;let a=this._view;if(a===null)return!1;if(e.key===`Enter`||e.key===` `){let t=r[i].dataset.pageId;return t===void 0?!1:(e.preventDefault(),a.setSelectedPage(t),this.setOpen(!1),!0)}let o=gridColumns(r.map(e=>e.getBoundingClientRect().top)),s=gridNavigate(e.key,i,r.length,o);if(s===null){let t=[`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key);return t&&e.preventDefault(),t}let c=r[s].dataset.pageId;return c===void 0?!1:(e.preventDefault(),a.setSelectedPage(c),r[s].focus(),!0)}_focusFirstRow(e){let t=e.querySelector(`.adw-tab-thumbnail`);return t===null?!1:(t.focus(),!0)}_focusLastRow(e){let t=e.querySelectorAll(`.adw-tab-thumbnail`),n=t[t.length-1];return n===void 0?!1:(n.focus(),!0)}_requestCreateTab(){let e=this._view;if(e===null)return;let t={page:null};if(this.dispatchEvent(new CustomEvent(`create-tab`,{bubbles:!0,detail:t})),t.page===null){console.error("<adw-tab-overview>: the create-tab handler must not leave `detail.page` unset.");return}e.setSelectedPage(t.page.id),this.setOpen(!1),t.page.content?.focus?.()}_createGrid(e,t){let n=document.createElement(`div`);return n.className=e,n.setAttribute(`role`,`grid`),n.setAttribute(`aria-label`,t),n}_thumbFor(e){let t=this._thumbs.get(e);if(t!==void 0)return t;let n=document.createElement(`div`);n.className=`adw-tab-thumbnail`,n.dataset.pageId=e,n.setAttribute(`role`,`gridcell`),n.tabIndex=-1;let r=document.createElement(`div`);r.className=`contents`;let i=document.createElement(`div`);i.className=`thumbnail`;let a=document.createElement(`div`);a.className=`card`;let o=document.createElement(`div`);o.className=`picture`;let s=document.createElement(`span`);s.className=`picture-portrait`,o.appendChild(s);let c=document.createElement(`button`);c.type=`button`,c.className=`tab-close-button adw-button image-button`,c.title=`Close Tab`,c.setAttribute(`aria-label`,`Close Tab`),c.tabIndex=-1,c.appendChild(createGtkImage(`window-close`,`tab-close-icon`));let l=document.createElement(`button`);l.type=`button`,l.className=`tab-unpin-icon`,l.tabIndex=-1,l.title=`Unpin Tab`,l.setAttribute(`aria-label`,`Unpin Tab`),l.dataset.iconName=`adw-tab-unpin-symbolic`;let u=document.createElement(`button`);u.type=`button`,u.className=`tab-indicator adw-button image-button`,u.tabIndex=-1;let d=createGtkImage(null,`tab-indicator-icon`);u.appendChild(d),a.append(o,c,l,u);let f=document.createElement(`div`);f.className=`needs-attention`;let p=document.createElement(`div`);p.className=`gizmo`,f.appendChild(p),i.append(a,f);let m=document.createElement(`div`);m.className=`icon-title-box`;let g=createGtkImage(null,`tab-icon`),_=document.createElement(`span`);_.className=`tab-label`,m.append(g,_),r.append(i,m),n.appendChild(r),n.addEventListener(`click`,()=>{let t=this._view;t!==null&&(t.setSelectedPage(e),this.setOpen(!1))}),n.addEventListener(`auxclick`,t=>{t.button===1&&(t.preventDefault(),this._view?.closePage(e))}),c.addEventListener(`click`,t=>{t.stopPropagation(),this._view?.closePage(e)}),l.addEventListener(`click`,t=>{t.stopPropagation(),this._view?.setPagePinned(e,!1)}),u.addEventListener(`click`,t=>{t.stopPropagation(),this._view?.dispatchEvent(new CustomEvent(`indicator-activated`,{bubbles:!0,detail:{id:e}}))});let v={root:n,label:_,icon:g,spinner:null,picture:o,portrait:s,closeBtn:c,unpinIcon:l,indicatorBtn:u,indicatorIcon:d,attention:f};return this._thumbs.set(e,v),v}_refreshThumb(e,t){if(e.root.title=tabTooltip(t),e.root.setAttribute(`aria-label`,tabTooltip(t)),e.icon.hidden=t.icon===null&&!t.loading,e.root.classList.toggle(`loading`,t.loading),t.loading&&e.spinner===null){let t=document.createElement(`adw-spinner`);t.className=`tab-spinner`,t.setAttribute(`size`,String(br)),e.icon.replaceWith(t),e.spinner=t}else!t.loading&&e.spinner!==null&&(e.spinner.replaceWith(e.icon),e.spinner=null);e.indicatorBtn.hidden=t.indicatorIcon===null,e.indicatorIcon.iconName=t.indicatorIcon,e.attention.hidden=!t.needsAttention,e.root.classList.toggle(`inverted`,this.inverted),e.closeBtn.hidden=t.pinned,e.unpinIcon.hidden=!t.pinned,e.label.textContent=t.title,e.portrait.textContent=t.title;let n=this._view?.selectedId===t.id;e.root.classList.toggle(`selected`,n),e.root.setAttribute(`aria-selected`,String(n))}};const br=`16`,xr=[`page-attached`,`page-detached`,`page-reordered`,`page-pinned`,`page-updated`,`notify::selected-page`];customElements.define(`adw-tab-overview`,AdwTabOverview);const Sr=[`title`,`tooltip`,`icon`,`indicator-icon`,`keyword`,`loading`,`needs-attention`,`pinned`];var AdwTabPage=class extends HTMLElement{static get observedAttributes(){return Sr}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this}])}attributeChangedCallback(e,t,n){let r=this.closest(`adw-tab-view`);r instanceof AdwTabView&&r.syncDeclaredPage(this,e,n)}},AdwTabView=class extends HTMLElement{_state=new TabViewState({onClosePage:e=>this._requestClose(e)});_barEl;_tabBoxEl;_pagesEl;_tabs=new Map;_chips=new Map;_panels=new Map;_hovered=new Set;_initialized=!1;_generatedIds=0;_reflecting=!1;static get observedAttributes(){return[`selected-page`,`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 selectedPage(){return this._state.selectedPage}set selectedPage(e){this._state.setSelectedPage(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-page`),t=Array.from(this.children);this.replaceChildren(this._barEl,this._pagesEl);for(let e of t)e.localName===`adw-tab-page`?this._adoptDeclaredPage(e):this.appendPage({id:this._nextId(),content: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-page`){if(this._reflecting)return;let e=this.getAttribute(`selected-page`);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`keyword`:this._state.setPageKeyword(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)}setPageKeyword(e,t){return this._state.setPageKeyword(e,t)}setPageIcon(e,t){return this._state.setPageIcon(e,t)}setPageIndicatorIcon(e,t){return this._state.setPageIndicatorIcon(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._chips.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=createTabChip({onSelect:()=>this._state.setSelectedPage(e.id),onClose:()=>this._state.closePage(e.id),onHover:t=>{t?this._hovered.add(e.id):this._hovered.delete(e.id),this._refreshCloseVisibility(e.id)}});n.el.dataset.pageId=e.id,n.close.tabIndex=-1,this._tabBoxEl.insertBefore(n.el,this._tabBoxEl.children[t]??null),this._tabs.set(e.id,n.el),this._chips.set(e.id,n);let r=e.content;r&&(this._panels.set(e.id,r),this._pagesEl.insertBefore(r,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);!t||!n||(refreshTabChip(this._chips.get(e),t,this.getAttribute(`default-icon`)),this._refreshCloseVisibility(e))}_refreshCloseVisibility(e){let t=this._state.getPage(e),n=this._chips.get(e);!t||!n||refreshTabChipClose(this._barEl,n,t,{hovering:this._hovered.has(e),selected:this._state.selectedId===e})}_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);t&&scrollChipIntoBar(this._barEl,t)}_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.selectedId;e===null?this.removeAttribute(`selected-page`):this.getAttribute(`selected-page`)!==e&&this.setAttribute(`selected-page`,e),this._reflecting=!1}_applySelectedAttribute(e){this._state.setSelectedPage(e)}_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-view`,AdwTabView),customElements.define(`adw-tab-page`,AdwTabPage);const Cr={schedule:(e,t)=>setTimeout(e,t),cancel:e=>clearTimeout(e)};var AdwToastOverlay=class extends HTMLElement{_toasts;_initialized=!1;_queue;_scheduler=Cr;_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`,this._toasts=document.createElement(`div`),this._toasts.className=`adw-toast-overlay-toasts`,bindSlottedChildren(this,[{into:e}]).install(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(createGtkImage(`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 AdwToggle=class extends HTMLElement{static get observedAttributes(){return[`label`,`icon-name`,`tooltip`,`enabled`]}attributeChangedCallback(e,t,n){e===`enabled`&&t!==n&&this.dispatchEvent(new CustomEvent(`toggle-enabled-changed`,{bubbles:!0,composed:!0,detail:{enabled:n!==`false`}}))}},AdwToggleGroup=class extends HTMLElement{_innerEl;_buttons=[];_state=new ToggleGroupState;_initialized=!1;_stateAttr=`aria-checked`;_names=[];_enabled=[];_toggles=[];static get observedAttributes(){return[`active`,`active-name`,`flat`,`round`,`sensitive`]}get sensitive(){return booleanAttribute$2(this.getAttribute(`sensitive`),!0)}set sensitive(e){this.setAttribute(`sensitive`,e?`true`:`false`)}isToggleEnabled(e){return this._enabled[e]??!1}get active(){return this._state.selected}set active(e){this.setAttribute(`active`,String(e))}get activeName(){return this._names[this._state.selected]??null}set activeName(e){e===null?this.removeAttribute(`active-name`):this.setAttribute(`active-name`,e)}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=Array.from(this.querySelectorAll(`adw-toggle`)),t=keptToggles(e.map(e=>({el:e,name:e.getAttribute(`name`)}))).map(e=>e.el);t.length<e.length&&console.warn(`[adw-toggle-group] a toggle name already exists; the later toggle is not added`);let n=this.getAttribute(`role`)?.trim()||null;n===null&&this.setAttribute(`role`,`radiogroup`);let r=n===`tablist`,i=r?`tab`:`radio`;this._stateAttr=r?`aria-selected`:`aria-checked`,this._innerEl=document.createElement(`div`),this._innerEl.className=`adw-toggle-group-inner`,this._innerEl.setAttribute(`role`,`none`),this._toggles=t,this._buttons=t.map((e,t)=>{let n=document.createElement(`button`);n.type=`button`,n.className=`adw-toggle`,n.setAttribute(`role`,i),this._enabled[t]=booleanAttribute$2(e.getAttribute(`enabled`),!0);let r=e.getAttribute(`label`)??``,a=e.getAttribute(`icon-name`)??``,o=e.getAttribute(`tooltip`)??``;return a&&n.appendChild(createGtkImage(a)),r&&n.appendChild(document.createTextNode(r)),n.title=o,!r&&o?n.setAttribute(`aria-label`,o):a&&!r&&n.setAttribute(`aria-label`,a),n.addEventListener(`click`,()=>this._selectIndex(t)),n}),this._innerEl.append(...this._buttons),this.replaceChildren(this._innerEl);for(let e=0;e<this._toggles.length;e++)this._toggles[e].addEventListener(`toggle-enabled-changed`,t=>{let{enabled:n}=t.detail;this._enabled[e]!==n&&(this._enabled[e]=n,this._render())});this._state.setLabels(t.map(e=>e.getAttribute(`label`)||e.getAttribute(`icon-name`)||``)),this._names=t.map(e=>e.getAttribute(`name`)),this._state.subscribe(()=>this._render()),this._state.setSelected(this._readActiveAttr()),this._applyActiveName(),this._render(),attachRovingFocus({host:this,orientation:`horizontal`,items:()=>this._buttons.filter(e=>!e.disabled),select:e=>this._selectIndex(this._buttons.findIndex(t=>t===e))})}attributeChangedCallback(e){if(this._initialized){if(e===`active`){this._state.setSelected(this._readActiveAttr());return}if(e===`active-name`){this._applyActiveName();return}this._render()}}_applyActiveName(){let e=this.getAttribute(`active-name`);if(e===null)return;let t=toggleIndexOfName(this._names,e);t!==-1&&this._state.setSelected(t)}_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._enabled[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,t=this.sensitive;this.toggleAttribute(`disabled`,!t),this._buttons.forEach((n,r)=>{let i=r===e;n.classList.toggle(`active`,i),n.setAttribute(this._stateAttr,String(i)),n.disabled=!t||!this._enabled[r],n.tabIndex=i?0:-1}),this._enabled[e]||this._activateFirstEnabled()}_activateFirstEnabled(){let e=this._enabled.findIndex(e=>e);e!==-1&&(this._state.setSelected(e),this.setAttribute(`active`,String(e)),this.dispatchEvent(new CustomEvent(`notify::active`,{bubbles:!0,detail:{active:e}})))}};customElements.define(`adw-toggle`,AdwToggle),customElements.define(`adw-toggle-group`,AdwToggleGroup);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(){this._initialized||(this._initialized=!0,this._topEl=document.createElement(`div`),this._topEl.className=`adw-toolbar-view-top`,this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-toolbar-view-content`,this._bottomEl=document.createElement(`div`),this._bottomEl.className=`adw-toolbar-view-bottom`,bindSlottedChildren(this,[{name:`top`,into:this._topEl},{name:`bottom`,into:this._bottomEl},{name:`content`,into:this._contentEl},{into:this._contentEl}]).install(this._topEl,this._contentEl,this._bottomEl),bindEmptySections(this._topEl,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 $e)this.classList.toggle(t,e.includes(t));for(let e of et)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);var AdwViewStack=class extends HTMLElement{static signals={"notify::visible-child":`notify::visible-child`,"notify::visible-child-name":`notify::visible-child-name`};_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}selectNthPage(e){return 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`),badgeNumber:e.hasAttribute(`badge-number`)?Number.parseInt(e.getAttribute(`badge-number`)??`0`,10):0,needsAttention:e.hasAttribute(`needs-attention`),useUnderline:e.hasAttribute(`use-underline`),startsSection:e.hasAttribute(`starts-section`),sectionTitle:e.getAttribute(`section-title`)}),this.replaceChild(n,e)}e!==null&&this._state.setVisibleName(e,!1),this._applyVisibility(),this._reflectName(),this._emitItemsChanged()}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}})),this.dispatchEvent(new CustomEvent(`notify::visible-child-name`,{bubbles:!0,detail:{"visible-child-name":e.name}}))}_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 AdwViewSwitcherPage=class extends HTMLElement{},AdwViewSwitcher=class extends HTMLElement{scheduler=tr;_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=createGtkImage(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 en)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 AdwViewSwitcherSidebar=class extends HTMLElement{_sidebar;_placeholderEl;_prefixEl;_suffixEl;_stack=null;_filter=null;_initialized=!1;static get observedAttributes(){return[`stack`,`mode`]}get stack(){return this._stack}set stack(e){this.setStack(e===null?null:typeof e==`string`?this._resolveStack(e):e)}setStack(e){e!==null&&this._stack!==e&&(this._unbindStack(),this._stack=e,this._bindStack(),this._populate(),this._syncSelection(),this.dispatchEvent(new CustomEvent(`notify::stack`,{bubbles:!0,detail:{stack:e}})))}get mode(){return this.getAttribute(`mode`)===`page`?`page`:`sidebar`}set mode(e){this.setAttribute(`mode`,e)}get filter(){return this._filter}set filter(e){this._filter=e,this._initialized&&(this._sidebar.filter=e,this._applyEmptyState())}get placeholder(){return this._placeholderEl.firstElementChild}set placeholder(e){e===null?this._placeholderEl.replaceChildren():this._placeholderEl.replaceChildren(e),this._applyEmptyState()}get prefixWidget(){return this._prefixEl.firstElementChild}set prefixWidget(e){e===null?this._prefixEl.replaceChildren():this._prefixEl.replaceChildren(e)}get suffixWidget(){return this._suffixEl.firstElementChild}set suffixWidget(e){e===null?this._suffixEl.replaceChildren():this._suffixEl.replaceChildren(e)}connectedCallback(){if(this._initialized){this._bindStack(),this._populate();return}this._initialized=!0,this._prefixEl=document.createElement(`div`),this._prefixEl.className=`view-switcher-sidebar-prefix`,this._suffixEl=document.createElement(`div`),this._suffixEl.className=`view-switcher-sidebar-suffix`,this._placeholderEl=document.createElement(`div`),this._placeholderEl.className=`view-switcher-sidebar-placeholder`,this._placeholderEl.hidden=!0,this._sidebar=document.createElement(`adw-sidebar`),this._sidebar.addEventListener(`activated`,this._onSidebarActivated);let e=document.createElement(`div`);e.className=`view-switcher-sidebar-box`,e.append(this._sidebar,this._placeholderEl),bindSlottedChildren(this,[{name:`placeholder`,into:this._placeholderEl},{name:`prefix`,into:this._prefixEl},{name:`suffix`,into:this._suffixEl}]).install(this._prefixEl,e,this._suffixEl),this._applyMode();let t=this.getAttribute(`stack`);this.setStack(t===null?this._findStack():this._resolveStack(t)),this._applyEmptyState()}disconnectedCallback(){this._unbindStack()}attributeChangedCallback(e,t,n){this._initialized&&(e===`stack`?this.setStack(n===null?this._findStack():this._resolveStack(n)):e===`mode`&&this._applyMode())}_resolveStack(e){return document.getElementById(e)??this._findStack()}_findStack(){return this.parentElement?.querySelector(`adw-view-stack`)??null}_bindStack(){this._unbindStack();for(let e of wr)this._stack?.addEventListener(e,this._onStackChange)}_unbindStack(){for(let e of wr)this._stack?.removeEventListener(e,this._onStackChange)}_onStackChange=()=>{this._populate(),this._syncSelection()};_onSidebarActivated=e=>{e.stopPropagation();let t=e.detail.index,n=this._stack;n!==null&&(n.selectNthPage(t),this.dispatchEvent(new CustomEvent(`activated`,{bubbles:!0,detail:{index:t}})))};_populate(){let e=this._stack;if(e===null){this._sidebar.sections=[],this._applyEmptyState();return}let t=viewSwitcherPagesFromStack(e.pages);this._sidebar.sections=viewSwitcherSidebarSections(t).map(e=>this._toSectionSpec(e)),this._applyEmptyState()}_toSectionSpec(e){let t=e.pages.map(e=>({title:e.title??``,iconName:e.iconName??``,visible:e.visible,badgeNumber:e.badgeNumber,needsAttention:e.needsAttention}));return{title:e.title,items:t}}_syncSelection(){let e=this._stack;if(e===null)return;let t=e.visibleChildIndex;t<0||this._sidebar.selected!==t&&(this._sidebar.selected=t)}_applyMode(){let e=this.mode===`page`;this.classList.toggle(`page`,e),this._sidebar.mode=this.mode}_applyEmptyState(){let e=this._sidebar.classList.contains(`empty`);this._placeholderEl.hidden=!e,this.classList.toggle(`empty`,e)}};const wr=[`items-changed`,`notify::visible-child`];customElements.define(`adw-view-switcher-sidebar`,AdwViewSwitcherSidebar);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.selectNthPage(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=createGtkImage(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?.selectNthPage(e)}),{button:t,icon:n,label:r,indicator:i}}_applyRevealed(){this.hidden=!this._barState.revealed}};customElements.define(`adw-view-switcher-bar`,AdwViewSwitcherBar);var AdwWindow=class extends GtkWindow{_features=new AdwWindowFeatures(this);static get observedAttributes(){return[...GtkWindow.observedAttributes,`width`,`height`]}get contentArea(){return this._content}get content(){return this._features.content}set content(e){this._features.content=e}get breakpoints(){return this._features.breakpoints}get currentBreakpoint(){return this._features.currentBreakpoint}get dialogs(){return this._features.dialogs}get visibleDialog(){return this._features.visibleDialog}addBreakpoint(e){return this._features.addBreakpoint(e)}connectedCallback(){super.connectedCallback(),this._features.adopt(this._content),this._features.bind()}disconnectedCallback(){this._features.release(),super.disconnectedCallback()}attributeChangedCallback(e){if(e===`width`||e===`height`){this.renderFrameSize();return}super.attributeChangedCallback(e)}hasTitlebar(){return!1}strips(){return[this._content]}extraSlots(){return[{name:`content`,into:this._content}]}renderFrameSize(){this._features.applySizeRequest()}};customElements.define(`adw-window`,AdwWindow);const Tr=[`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[...Tr]}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 Er={dark:()=>typeof document<`u`&&isAdwaitaDark(document.documentElement),subscribe(e){if(typeof document>`u`)return()=>{};let t=globalThis.matchMedia?.(`(prefers-color-scheme: dark)`);t?.addEventListener(`change`,e);let n=new MutationObserver(e);return n.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}),()=>{t?.removeEventListener(`change`,e),n.disconnect()}}};Er.force=e=>{if(typeof document>`u`)return;let t=document.documentElement;t.classList.remove(`theme-dark`,`theme-light`),e!==null&&t.classList.add(e?`theme-dark`:`theme-light`)},Object.freeze({ALWAYS:0,AUTOMATIC:1,NEVER:2,EXTERNAL:3}),Object.freeze({NONE:0,LTR:1,RTL:2}),Object.freeze({WIDGET:1,TEXT:2,LEFT:3,RIGHT:4,TOP:5,BOTTOM:6}),Object.freeze({WORD:0,LINE:1});const Dr={main:`About`,credits:`Credits`,license:`License`,system:`System`},Or=[`credits`,`license`,`system`],kr=[`unknown`,`custom`,`gpl-2-0`,`gpl-3-0`,`lgpl-2-1`,`lgpl-3-0`,`bsd`,`mit-x11`,`artistic`,`gpl-2-0-only`,`gpl-3-0-only`,`lgpl-2-1-only`,`lgpl-3-0-only`,`agpl-3-0`,`agpl-3-0-only`,`bsd-3`,`apache-2-0`,`mpl-2-0`,`0bsd`];var GtkAboutDialog=class extends AdwDialog{_built=!1;_logo=``;_switcherEl;_stackEl;_pages=new Map;_populated=new Set;_authors=[];_documenters=[];_artists=[];_creditSections=[];static get observedAttributes(){return[...AdwDialog.observedAttributes,`program-name`,`version`,`copyright`,`comments`,`license`,`license-type`,`system-information`,`website`,`website-label`,`translator-credits`,`logo-icon-name`,`wrap-license`]}get programName(){return this.getAttribute(`program-name`)??``}set programName(e){this.setAttribute(`program-name`,e)}get version(){return this.getAttribute(`version`)??``}set version(e){this.setAttribute(`version`,e)}get copyright(){return this.getAttribute(`copyright`)??``}set copyright(e){this.setAttribute(`copyright`,e)}get comments(){return this.getAttribute(`comments`)??``}set comments(e){this.setAttribute(`comments`,e)}get license(){return this.getAttribute(`license`)??``}set license(e){this.setAttribute(`license`,e),this.setAttribute(`license-type`,`custom`)}get licenseType(){let e=this.getAttribute(`license-type`);return e!==null&&kr.includes(e)?e:`unknown`}set licenseType(e){kr.includes(e)?this.setAttribute(`license-type`,e):this.removeAttribute(`license-type`)}get systemInformation(){return this.getAttribute(`system-information`)??``}set systemInformation(e){this.setAttribute(`system-information`,e)}get website(){return this.getAttribute(`website`)??``}set website(e){this.setAttribute(`website`,e)}get websiteLabel(){return this.getAttribute(`website-label`)??``}set websiteLabel(e){this.setAttribute(`website-label`,e)}get translatorCredits(){return this.getAttribute(`translator-credits`)??``}set translatorCredits(e){this.setAttribute(`translator-credits`,e)}get logoIconName(){return this.getAttribute(`logo-icon-name`)??``}set logoIconName(e){this.setAttribute(`logo-icon-name`,e)}get wrapLicense(){return this.hasAttribute(`wrap-license`)}set wrapLicense(e){this.toggleAttribute(`wrap-license`,e)}get logo(){return this._logo}set logo(e){this._logo=e,this._built&&this._renderLogo()}get authors(){return[...this._authors]}set authors(e){this._authors=[...e],this._creditsChanged()}get documenters(){return[...this._documenters]}set documenters(e){this._documenters=[...e],this._creditsChanged()}get artists(){return[...this._artists]}set artists(e){this._artists=[...e],this._creditsChanged()}addCreditSection(e,t){this._creditSections.push({name:e,people:[...t]}),this._creditsChanged()}_creditsChanged(){this._populated.delete(`credits`),this._built&&this._renderAbout()}connectedCallback(){if(this._built){super.connectedCallback();return}this._switcherEl=document.createElement(`div`),this._switcherEl.className=`adw-gtk-about-dialog-switcher`,this._switcherEl.setAttribute(`role`,`tablist`),this._switcherEl.setAttribute(`aria-label`,`Pages`),super.connectedCallback(),this._stackEl=document.createElement(`div`),this._stackEl.className=`adw-gtk-about-dialog-stack`,this._stackEl.dataset.transitionType=`crossfade`,this.setAttribute(`title`,`About ${this.programName||document.title}`);let e=[...this.contentArea.childNodes];this.contentArea.replaceChildren(this._build());for(let t of e)this.contentArea.appendChild(t);this._renderAbout(),this._built=!0}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),this._built&&t!==n&&((e===`license`||e===`license-type`||e===`website`)&&this._populated.delete(`license`),e===`system-information`&&this._populated.delete(`system`),(e===`website`||e===`website-label`||e===`license`||e===`license-type`)&&(this._renderMain(),this._populateLicense()),e===`wrap-license`&&this._populateLicense(),e===`system-information`&&this._populateSystem(),this._renderAbout())}decorateHeader(e){let t=e.querySelector(`.adw-dialog-title`);t===null?e.prepend(this._switcherEl):t.replaceWith(this._switcherEl),this._renderSwitcher()}get visiblePage(){return this._stackEl.dataset.visible??`main`}showPage(e){this._populatePage(e);for(let[t,n]of this._pages)n.hidden=t!==e;this._stackEl.dataset.visible=e,this._renderSwitcher()}_build(){let e=document.createElement(`div`);e.className=`adw-gtk-about-dialog-box`;let t=document.createElement(`div`);t.className=`adw-gtk-about-dialog-head`;let n=document.createElement(`div`);n.className=`adw-gtk-about-dialog-logo-slot`,t.appendChild(n),this._renderLogo();let r=document.createElement(`div`);r.className=`adw-gtk-about-dialog-name`,r.textContent=this.programName||document.title,t.appendChild(r);for(let e of[`main`,...Or]){let t=document.createElement(`div`);t.className=`adw-gtk-about-dialog-page`,t.dataset.page=e,t.hidden=e!==`main`,this._pages.set(e,t),this._stackEl.appendChild(t)}return this._renderMain(),t.appendChild(this._stackEl),e.appendChild(t),e}_renderAbout(){this.setAttribute(`title`,`About ${this.programName||document.title}`);for(let e of Or){let t=this._pages.get(e);if(t===void 0)continue;let n=this._pageVisible(e);t.hidden!==!n&&(t.hidden=!n,n||this._populated.delete(e))}this._pages.get(this._stackEl.dataset.visible??`main`)?.hidden!==!1&&(this._stackEl.dataset.visible=`main`,this._pages.get(`main`).hidden=!1),this._renderMain(),this._renderSwitcher()}_pageVisible(e){return e===`credits`?this._creditsPeople().length>0:e===`license`?this.licenseType===`custom`&&this.license.length>0:this.systemInformation.length>0}_creditsPeople(){let e=[];this._authors.length>0&&e.push({title:`Created by`,people:this._authors}),this._documenters.length>0&&e.push({title:`Documented by`,people:this._documenters});let t=translatorCreditsPeople(this.translatorCredits);t.length>0&&e.push({title:`Translated by`,people:t}),this._artists.length>0&&e.push({title:`Design by`,people:this._artists});for(let t of this._creditSections)e.push({title:t.name,people:t.people});return e}_visiblePages(){return Or.filter(e=>this._pages.get(e)?.hidden===!1)}_renderSwitcher(){if(this._switcherEl===void 0)return;let e=this._visiblePages();this._switcherEl.hidden=e.length===0,this._switcherEl.replaceChildren(...e.map(e=>{let t=document.createElement(`button`);return t.type=`button`,t.className=`adw-gtk-about-dialog-switcher-item`,t.setAttribute(`role`,`tab`),t.textContent=Dr[e],t.classList.toggle(`checked`,this._stackEl.dataset.visible===e),t.setAttribute(`aria-selected`,String(this._stackEl.dataset.visible===e)),t.addEventListener(`click`,()=>this.showPage(e)),t}))}_renderLogo(){let e=this.contentArea.querySelector(`.adw-gtk-about-dialog-logo-slot`);if(e!==null){if(this.logoIconName.length>0){e.replaceChildren(createGtkImage(this.logoIconName,`adw-gtk-about-dialog-logo`));return}if(this._logo.length>0){let t=document.createElement(`img`);t.className=`adw-gtk-about-dialog-logo`,t.src=this._logo,t.alt=``,e.replaceChildren(t);return}e.replaceChildren()}}_renderMain(){let e=this._pages.get(`main`);if(e===void 0)return;let t=[],label=(e,t)=>{let n=document.createElement(`div`);return n.className=t,n.textContent=e,n};this.version.length>0&&t.push(label(this.version,`adw-gtk-about-dialog-version`)),this.comments.length>0&&t.push(label(this.comments,`adw-gtk-about-dialog-comments`)),this.website.length>0?t.push(this.websiteLabel.length>0?this._link(this.websiteLabel,this.website,`adw-gtk-about-dialog-website`):this._link(`Website`,this.website,`adw-gtk-about-dialog-website`)):this.websiteLabel.length>0&&t.push(label(this.websiteLabel,`adw-gtk-about-dialog-website`)),this.copyright.length>0&&t.push(label(this.copyright,`adw-gtk-about-dialog-copyright`));let n=this._licenseMarkup();n!==null&&t.push(n),e.replaceChildren(...t)}_licenseMarkup(){let e=this.licenseType,t=kr.indexOf(e),n=t>=0?t:o.UNKNOWN,r=document.createElement(`div`);if(r.className=`adw-gtk-about-dialog-license`,n!==o.CUSTOM&&n!==o.UNKNOWN){let e=s[n],t=e.url??this.website;return r.append(document.createTextNode(`This program comes with absolutely no warranty.
6
+ See the `),this._link(e.name??``,t,`adw-gtk-about-dialog-license-link`),document.createTextNode(` for details.`)),r}return n===o.UNKNOWN||this.license.length===0?null:(this._fillWithLinks(r,this.license),r)}_populateLicense(){let e=this._pages.get(`license`);if(e===void 0)return;let t=document.createElement(`div`);t.className=`adw-gtk-about-dialog-text-view`,this.wrapLicense&&t.classList.add(`wrap`);let n=this._licenseMarkup();if(n!==null){let e=document.createElement(`div`);e.className=`adw-gtk-about-dialog-text`,e.replaceChildren(...[...n.childNodes].map(e=>e.cloneNode(!0))),t.appendChild(e)}e.replaceChildren(this._frame(t))}_populateSystem(){let e=this._pages.get(`system`);if(e===void 0)return;let t=document.createElement(`div`);t.className=`adw-gtk-about-dialog-text-view`;let n=document.createElement(`div`);n.className=`adw-gtk-about-dialog-text`,this._fillWithLinks(n,this.systemInformation),t.appendChild(n),e.replaceChildren(this._frame(t))}_populateCredits(){let e=this._pages.get(`credits`);if(e===void 0)return;let t=document.createElement(`div`);t.className=`adw-gtk-about-dialog-credits-grid`,t.setAttribute(`role`,`group`),t.setAttribute(`aria-label`,Dr.credits);for(let e of this._creditsPeople()){let n=document.createElement(`div`);n.className=`adw-gtk-about-dialog-credits-heading`,n.textContent=e.title,t.appendChild(n);for(let n of e.people){let e=parseCreditPerson(n),r=document.createElement(`div`);r.className=`adw-gtk-about-dialog-credits-person`,e.link===null?r.textContent=e.name:r.appendChild(this._link(e.name,e.uri??``,`adw-gtk-about-dialog-credits-link`)),t.appendChild(r)}t.appendChild(document.createElement(`div`))}e.replaceChildren(this._frame(t))}_populatePage(e){this._populated.has(e)||(this._populated.add(e),e===`credits`?this._populateCredits():e===`license`?this._populateLicense():e===`system`&&this._populateSystem())}_frame(e){let t=document.createElement(`div`);t.className=`adw-gtk-about-dialog-scrolled`;let n=document.createElement(`div`);return n.className=`adw-view`,n.appendChild(e),t.appendChild(n),t}_link(e,t,n){let r=document.createElement(`a`);return r.className=n,r.href=t,r.rel=`noopener noreferrer`,r.textContent=e,r.addEventListener(`click`,e=>{e.preventDefault(),this._activateLink(t)}),r}_fillWithLinks(e,t){for(let n of splitLinks(t)){if(n.uri===null){e.appendChild(document.createTextNode(n.text));continue}let t=document.createElement(`a`);t.href=n.uri,t.rel=`noopener noreferrer`,t.textContent=n.text,t.addEventListener(`click`,e=>{e.preventDefault(),this._activateLink(n.uri)}),e.appendChild(t)}}_activateLink(e){let t=new CustomEvent(`activate-link`,{bubbles:!0,cancelable:!0,detail:{uri:e}});this.dispatchEvent(t)&&globalThis.open(e,`_blank`,`noopener,noreferrer`)}};function splitLinks(e){let t=[],n=e;for(;n.length>0;){let e=n.indexOf(`<`),r=e<0?-1:n.indexOf(`>`,e),i=n.indexOf(`http://`),a=n.indexOf(`https://`),o=i;(i<0||a>=0&&a<i)&&(o=a);let s=-1;if(o>=0&&(s=`
7
+ >`.split(``).reduce((e,t)=>{if(e>=0)return e;let r=n.indexOf(t,o);return r<0?-1:r},-1),s<0&&(s=n.length)),o>=0&&(e<0||r<0||o<=e+1)&&(e=o,r=s),e<0||r<0){t.push({text:n,uri:null});break}e>0&&t.push({text:n.slice(0,e),uri:null});let c=n[e]===`<`,l=c?n.slice(e+1,r):n.slice(e,r);t.push({text:l,uri:c?`mailto:${l}`:l}),n=n.slice(r+ +!!c)}return t}customElements.define(`gtk-about-dialog`,GtkAboutDialog);var GtkActionBar=class extends HTMLElement{_initialized=!1;_startEl=null;_centerEl=null;_endEl=null;static get observedAttributes(){return[`revealed`]}get revealed(){return this.getAttribute(`revealed`)!==`false`}set revealed(e){this.setAttribute(`revealed`,e?`true`:`false`)}get startSection(){return this._startEl}get centerSection(){return this._centerEl}get endSection(){return this._endEl}connectedCallback(){if(this._initialized)return;this._initialized=!0,this._startEl=document.createElement(`div`),this._startEl.className=`adw-action-bar-start`,this._centerEl=document.createElement(`div`),this._centerEl.className=`adw-action-bar-center`,this._endEl=document.createElement(`div`),this._endEl.className=`adw-action-bar-end`;let e=this._endEl;bindSlottedChildren(this,[{name:`start`,into:this._startEl},{name:`center`,into:this._centerEl},{name:`end`,consume:t=>e.prepend(t)},{into:this._startEl}]).install(this._startEl,this._centerEl,this._endEl),this._renderRevealed()}attributeChangedCallback(){this._initialized&&this._renderRevealed()}_renderRevealed(){this.hidden=!this.revealed}};customElements.define(`gtk-action-bar`,GtkActionBar);function normalizeAlign(e){let t=Number.parseFloat(e??``);return Number.isFinite(t)?glibClamp(t,0,1):.5}function normalizeRatio(e){let t=Number.parseFloat(e??``);return Number.isFinite(t)?glibClamp(t,1e-4,1e4):1}var GtkAspectFrame=class extends HTMLElement{static get observedAttributes(){return[`ratio`,`xalign`,`yalign`,`obey-child`]}get ratio(){return normalizeRatio(this.getAttribute(`ratio`))}set ratio(e){this.setAttribute(`ratio`,String(e))}get xalign(){return normalizeAlign(this.getAttribute(`xalign`))}set xalign(e){this.setAttribute(`xalign`,String(e))}get yalign(){return normalizeAlign(this.getAttribute(`yalign`))}set yalign(e){this.setAttribute(`yalign`,String(e))}get obeyChild(){let e=this.getAttribute(`obey-child`);return e===null||e!==`false`&&e!==`0`}set obeyChild(e){e?this.setAttribute(`obey-child`,`true`):this.setAttribute(`obey-child`,`false`)}get child(){return this.firstElementChild??null}set child(e){this.firstElementChild!==null&&this.firstElementChild.remove(),e!==null&&this.append(e),this._sync()}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this}]),this.setAttribute(`role`,`generic`),this._sync()}attributeChangedCallback(e,t,n){if(this._sync(),!this.isConnected)return;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){return e===`ratio`?normalizeRatio(t):e===`xalign`||e===`yalign`?normalizeAlign(t):t!==null&&t!==`false`&&t!==`0`}_sync(){let e=this.child;if(e===null)return;let t=e.style;this.obeyChild?t.removeProperty(`aspect-ratio`):t.aspectRatio=String(this.ratio),t.flex=`1 1 auto`,t.maxWidth=`100%`,t.maxHeight=`100%`,this.style.justifyContent=labelYalignAlignItems(this.xalign),this.style.alignItems=labelYalignAlignItems(this.yalign)}};customElements.define(`gtk-aspect-frame`,GtkAspectFrame);const Ar=[`orientation`,`spacing`,`homogeneous`];var GtkBox=class extends HTMLElement{static get observedAttributes(){return[...Ar]}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this.setAttribute(`orientation`,e)}get spacing(){return normalizeBoxSpacing(this.getAttribute(`spacing`))}set spacing(e){this.setAttribute(`spacing`,String(e))}get homogeneous(){return this.hasAttribute(`homogeneous`)}set homogeneous(e){this.toggleAttribute(`homogeneous`,!!e)}connectedCallback(){this._sync()}attributeChangedCallback(e,t,n){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){return e===`orientation`?normalizeBoxOrientation(t):e===`spacing`?normalizeBoxSpacing(t):t!==null}_sync(){this.style.flexDirection=this.orientation===`vertical`?`column`:`row`,this.style.gap=`${this.spacing}px`}};customElements.define(`gtk-box`,GtkBox);const jr=[`flat`,`suggested`,`destructive`,`circular`,`pill`];var GtkButton=class extends HTMLElement{static signals={clicked:`click`};_button;_label=``;_initialized=!1;_child=null;static get observedAttributes(){return[`icon`,`icon-name`,`label`,`tooltip`,`tooltip-text`,`disabled`,`flat`,`suggested`,`destructive`,`circular`,`pill`,`class`]}get icon_name(){return this.getAttribute(`icon-name`)}set icon_name(e){this.reflect(`icon-name`,e)}get iconName(){return this.icon_name}set iconName(e){this.icon_name=e}get tooltip_text(){return this.getAttribute(`tooltip-text`)}set tooltip_text(e){this.reflect(`tooltip-text`,e)}get tooltipText(){return this.tooltip_text}set tooltipText(e){this.tooltip_text=e}reflect(e,t){t==null?this.removeAttribute(e):this.setAttribute(e,t)}get button(){return this._button}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=Array.from(this.childNodes).filter(e=>e.nodeType===Node.TEXT_NODE).map(e=>e.textContent??``).join(``);this._label=(this.getAttribute(`label`)??e).trim(),this._button=document.createElement(`button`),bindSlottedChildren(this,[{name:`child`,claims:e=>e instanceof Element,consume:e=>{this._child=e,this._render()}}]).install(this._button),this._render()}attributeChangedCallback(){this._initialized&&this._render()}_render(){let e=this._button;e.className=`adw-button`;let t=[...jr.filter(e=>this.hasAttribute(e)),...this.classList];e.classList.add(...buttonStyleClasses(t));let n=this._child,r=n?null:this.getAttribute(`icon`)??this.getAttribute(`icon-name`),i=n?``:(this.getAttribute(`label`)??this._label).trim();r&&!i&&e.classList.add(`icon-only`),i&&!r&&e.classList.add(`text-button`),n?e.replaceChildren(n):e.replaceChildren(),r&&e.appendChild(createGtkImage(r)),i&&e.appendChild(document.createTextNode(i));let a=this.getAttribute(`tooltip`)??this.getAttribute(`tooltip-text`);e.title=a??``,r&&!i?e.setAttribute(`aria-label`,a??r):e.removeAttribute(`aria-label`),e.disabled=this.hasAttribute(`disabled`),this.decorate(e)}decorate(e){}};customElements.define(`gtk-button`,GtkButton);const Mr=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],Nr=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],H=[{step:`previous-month`,icon:`go-previous`,tooltip:`Previous Month`},{step:`next-month`,icon:`go-next`,tooltip:`Next Month`},{step:`previous-year`,icon:`go-up`,tooltip:`Previous Year`},{step:`next-year`,icon:`go-down`,tooltip:`Next Year`}];var GtkCalendar=class extends HTMLElement{_headerEl;_monthEl;_yearEl;_arrowEls={};_gridEl;_dayNameEls=[];_weekNumberEls=[];_cellEls=[];_marked=calendarClearMarks();_date;_focus=-1;_initialized=!1;static get observedAttributes(){return[`date`,`year`,`month`,`day`,`show-heading`,`show-day-names`,`show-week-numbers`,`week-start`]}get date(){return toIsoDate(this._date)}set date(e){this.setAttribute(`date`,e)}get year(){return this._date.year}set year(e){this.setAttribute(`year`,String(e))}get month(){return this._date.month-1}set month(e){this.setAttribute(`month`,String(e))}get day(){return this._date.day}set day(e){this.setAttribute(`day`,String(e))}get showHeading(){return this.getAttribute(`show-heading`)!==`false`}set showHeading(e){this.setAttribute(`show-heading`,String(!!e))}get showDayNames(){return this.getAttribute(`show-day-names`)!==`false`}set showDayNames(e){this.setAttribute(`show-day-names`,String(!!e))}get showWeekNumbers(){return this.hasAttribute(`show-week-numbers`)}set showWeekNumbers(e){this.toggleAttribute(`show-week-numbers`,!!e)}get weekStart(){let e=this.getAttribute(`week-start`);if(e!==null){let t=Number.parseInt(e,10);if(Number.isFinite(t)&&t>=0&&t<=6)return t}return localeWeekStart()}set weekStart(e){this.setAttribute(`week-start`,String(e))}get markedDays(){return this._marked.flatMap((e,t)=>e?[t+1]:[])}constructor(){super(),this._date=today()}connectedCallback(){this._initialized||(this._initialized=!0,this._buildHeader(),this._buildGrid(),this.replaceChildren(this._headerEl,this._gridEl),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),this._adoptAttributes(),this._render())}attributeChangedCallback(e){if(!this._initialized)return;let t=this._adoptAttributes(e);this._render(),(e===`date`||e===`year`||e===`month`||e===`day`)&&this._emitDaySelected(t)}markDay(e){let t=calendarMarkDay(this._marked,e,!0);t!==this._marked&&(this._marked=t,this._paintStates(),this.dispatchEvent(new CustomEvent(`notify::marked-days`,{bubbles:!0,detail:{markedDays:this.markedDays}})))}unmarkDay(e){let t=calendarMarkDay(this._marked,e,!1);t!==this._marked&&(this._marked=t,this._paintStates(),this.dispatchEvent(new CustomEvent(`notify::marked-days`,{bubbles:!0,detail:{markedDays:this.markedDays}})))}dayIsMarked(e){return calendarDayIsMarked(this._marked,e)}clearMarks(){this._marked=calendarClearMarks(),this._paintStates(),this.dispatchEvent(new CustomEvent(`notify::marked-days`,{bubbles:!0,detail:{markedDays:[]}}))}get cells(){return calendarDays(this._date.year,this._date.month,this.weekStart)}get selectedDate(){return{...this._date}}_buildHeader(){this._headerEl=document.createElement(`div`),this._headerEl.className=`adw-calendar-header`;let e={previousMonth:{icon:H[0].icon,tooltip:H[0].tooltip},nextMonth:{icon:H[1].icon,tooltip:H[1].tooltip},previousYear:{icon:H[2].icon,tooltip:H[2].tooltip},nextYear:{icon:H[3].icon,tooltip:H[3].tooltip}},button=(t,n,r)=>{let i=document.createElement(`button`);return i.type=`button`,i.className=`adw-calendar-nav-button flat`,i.title=e[t].tooltip,i.setAttribute(`aria-label`,e[t].tooltip),n&&i.classList.add(`expand`),i.style.justifySelf=r,i.addEventListener(`click`,()=>this._onArrow(t)),i.appendChild(createGtkImage(e[t].icon,`adw-calendar-nav-icon`)),this._arrowEls[t]=i,i};this._monthEl=document.createElement(`span`),this._monthEl.className=`adw-calendar-month`,this._yearEl=document.createElement(`span`),this._yearEl.className=`adw-calendar-year`,this._headerEl.append(button(`previousMonth`,!1,`start`),this._monthEl,button(`nextMonth`,!0,`start`),button(`previousYear`,!1,`center`),this._yearEl,button(`nextYear`,!1,`end`)),this._monthEl.style.flex=`1`,this._yearEl.style.paddingInline=`6px`}_buildGrid(){this._gridEl=document.createElement(`div`),this._gridEl.className=`adw-calendar-grid`;for(let e=0;e<7;e++){let e=document.createElement(`span`);e.className=`adw-calendar-day-name`,this._dayNameEls.push(e),this._gridEl.appendChild(e)}let e=document.createElement(`span`);e.className=`adw-calendar-week-spacer`,e.setAttribute(`aria-hidden`,`true`),this._gridEl.appendChild(e);for(let e=0;e<6;e++){let e=document.createElement(`span`);e.className=`adw-calendar-week-number`,this._weekNumberEls.push(e),this._gridEl.appendChild(e);for(let e=0;e<7;e++){let e=document.createElement(`button`);e.type=`button`,e.className=`adw-calendar-cell day-number`,e.addEventListener(`click`,()=>this._onCellClick(Number(e.dataset.index??`0`))),this._cellEls.push(e),this._gridEl.appendChild(e)}}}_adoptAttributes(e){let t=this.getAttribute(`date`);if(t!==null&&!(e===`year`||e===`month`||e===`day`)){let e=parseIsoDate(t);if(e!==null){let t=calendarSelectDay(this._date,e,!1);return this._date=t.date,t}}let n={year:integer(this.getAttribute(`year`),this._date.year),month:integer(this.getAttribute(`month`),this._date.month-1)+1,day:integer(this.getAttribute(`day`),this._date.day)},r=calendarSelectDay(this._date,n,!1);return this._date=r.date,r}_render(){this._monthEl.textContent=Nr[this._date.month-1],this._yearEl.textContent=String(this._date.year);let e=calendarDays(this._date.year,this._date.month,this.weekStart);e.forEach((e,t)=>{let n=this._cellEls[t];n.dataset.index=String(t),n.textContent=String(e.date.day),n.setAttribute(`aria-label`,`${Nr[e.date.month-1]} ${e.date.day}, ${e.date.year}`),n.classList.toggle(`other-month`,e.month!==`current`)}),this._paintWeekNumbers(e),this._paintStates(),this._paintArrows(),this._paintDayNames(),this._paintVisibility()}_paintWeekNumbers(e){for(let t=0;t<6;t++){let n=e[t*7+6];this._weekNumberEls[t].textContent=String(calendarWeekNumber(n.date))}}_paintStates(){let e=calendarDays(this._date.year,this._date.month,this.weekStart),t=today(),n=t.year===this._date.year&&t.month===this._date.month?t.day:-1;e.forEach((e,t)=>{let r=this._cellEls[t],i=e.month===`current`&&e.date.day===this._date.day,a=e.month===`previous`&&this._date.year===1&&this._date.month===1||e.month===`next`&&this._date.year===9999&&this._date.month===12;r.classList.toggle(`selected`,i),r.classList.toggle(`marked`,e.month===`current`&&calendarDayIsMarked(this._marked,e.date.day)),r.classList.toggle(`today`,e.date.day===n&&e.month===`current`),r.classList.toggle(`focused`,t===this._focus),r.disabled=a,a?r.textContent=``:r.textContent=String(e.date.day)})}_paintArrows(){let e=calendarNavigationButtons(this._date);for(let t of[`previousMonth`,`nextMonth`,`previousYear`,`nextYear`])this._arrowEls[t].disabled=!e[t]}_paintDayNames(){for(let e=0;e<7;e++)this._dayNameEls[e].textContent=Mr[(e+this.weekStart)%7]}_paintVisibility(){this._headerEl.hidden=!this.showHeading;for(let e of this._dayNameEls)e.hidden=!this.showDayNames;for(let e of this._weekNumberEls)e.hidden=!this.showWeekNumbers}_onArrow(e){let t=H.find(t=>arrowNameOf(t.step)===e)?.step;t===void 0||this._arrowEls[e].disabled||this._navigate(t)}_navigate(e){let t=this._date;if(this._date=calendarSelectDay(t,calendarStep(t,e),!1).date,this._focus>=0){let e=this.cells,t=e[this._focus],n=e.findIndex(e=>e.month===t?.month&&e.date.day===t.date.day);this._focus=n>=0?n:-1}this._render(),this.dispatchEvent(new CustomEvent(`notify::date`,{bubbles:!0,detail:{date:this.date}})),this.dispatchEvent(new CustomEvent({"previous-month":`prev-month`,"next-month":`next-month`,"previous-year":`prev-year`,"next-year":`next-year`}[e],{bubbles:!0}))}_emitDaySelected(e){let notify=(e,t)=>this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:t}}));e.dayChanged&&(this.dispatchEvent(new CustomEvent(`day-selected`,{bubbles:!0})),notify(`day`,this._date.day)),e.monthChanged&&notify(`month`,this._date.month-1),e.yearChanged&&notify(`year`,this._date.year),notify(`date`,this.date)}_onCellClick(e){let t=this.cells[e];t!==void 0&&(this._focus=e,t.month===`previous`?this._navigate(`previous-month`):t.month===`next`&&this._navigate(`next-month`),this._selectDate(t.date,!0))}_selectDate(e,t){let n=calendarSelectDay(this._date,e,t);if(!n.dayChanged&&!n.monthChanged&&!n.yearChanged){this._render();return}this._date=n.date;let r=this.cells.findIndex(e=>e.month===`current`&&e.date.day===this._date.day);r>=0&&(this._focus=r),this._render(),this._emitDaySelected(n)}_onKeyDown(e){let t={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,1],ArrowDown:[0,-1]};if(e.ctrlKey){let t={ArrowLeft:`previous-month`,ArrowRight:`next-month`,ArrowUp:`previous-year`,ArrowDown:`next-year`}[e.key];if(t===void 0||(e.preventDefault(),!calendarNavigationButtons(this._date)[arrowNameOf(t)]))return;this._navigate(t);return}if(e.altKey||e.metaKey)return;if(e.key===` `){if(this._focus<0)return;e.preventDefault();let t=this.cells[this._focus];if(t===void 0)return;t.month===`previous`?this._navigate(`previous-month`):t.month===`next`&&this._navigate(`next-month`),this._selectDate(t.date,!0);return}let n=t[e.key];n!==void 0&&(e.preventDefault(),this._moveFocus(n[0],n[1]))}_moveFocus(e,t){if(this.cells.length===0)return;let n=this._focus<0?-1:Math.trunc(this._focus/7),r=this._focus<0?-1:this._focus%7;t===1?(n>0&&n--,n<0&&(n=5),r<0&&(r=6)):t===-1?(n<5&&n++,r<0&&(r=0)):e===-1?(r>0?r--:n>0&&(r=6,n--),r<0&&(r=6),n<0&&(n=5)):(r<6?r++:n<5&&(r=0,n++),r<0&&(r=0),n<0&&(n=0));let i=n*7+r;this._cellEls[i]?.disabled!==!0&&(this._focus=i,this._paintStates(),this._cellEls[i]?.focus())}};function arrowNameOf(e){switch(e){case`previous-month`:return`previousMonth`;case`next-month`:return`nextMonth`;case`previous-year`:return`previousYear`;default:return`nextYear`}}function localeWeekStart(){let e=globalThis.navigator?.language;if(typeof e!=`string`)return calendarWeekStart(0,0);let t=Intl.Locale;if(t===void 0)return calendarWeekStart(0,0);let n=new t(e).getWeekInfo?.();return n===void 0?calendarWeekStart(0,0):calendarWeekStart(n.firstDay%7,n.firstDay===7?0:1)}function today(){let e=new Date;return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate()}}function toIsoDate(e){return`${String(e.year).padStart(4,`0`)}-${String(e.month).padStart(2,`0`)}-${String(e.day).padStart(2,`0`)}`}function parseIsoDate(e){let t=/^(-?\d{1,6})-(\d{1,2})-(\d{1,2})$/.exec(e.trim());if(t===null)return null;let n=Number(t[1]),r=Number(t[2]),i=Number(t[3]);return r<1||r>12||i<1||i>31||n<1||n>9999?null:{year:n,month:r,day:i}}function integer(e,t){let n=Number.parseInt(e??``,10);return Number.isFinite(n)?n:t}customElements.define(`gtk-calendar`,GtkCalendar);const Pr={top:0,center:.5,bottom:1};var GtkCenterBox=class extends HTMLElement{static get observedAttributes(){return[`baseline-position`,`shrink-center-last`]}get baselinePosition(){let e=this.getAttribute(`baseline-position`);return e!==null&&e in Pr?e:`center`}set baselinePosition(e){this.setAttribute(`baseline-position`,e)}get shrinkCenterLast(){let e=this.getAttribute(`shrink-center-last`);return e===null||e!==`false`&&e!==`0`}set shrinkCenterLast(e){e?this.removeAttribute(`shrink-center-last`):this.setAttribute(`shrink-center-last`,`false`)}get startWidget(){return this.querySelector(`[slot="start-widget"]`)}set startWidget(e){this._assign(`start-widget`,e)}get centerWidget(){return this.querySelector(`[slot="center-widget"]`)}set centerWidget(e){this._assign(`center-widget`,e)}get endWidget(){return this.querySelector(`[slot="end-widget"]`)}set endWidget(e){this._assign(`end-widget`,e)}connectedCallback(){bindSlottedChildren(this,[{name:`start-widget`,into:this},{name:`center-widget`,into:this},{name:`end-widget`,into:this}]),this.setAttribute(`role`,`generic`),this._sync()}attributeChangedCallback(e,t,n){if(this._sync(),!this.isConnected)return;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){return e===`shrink-center-last`?t===null||t!==`false`&&t!==`0`:t!==null&&t in Pr?t:`center`}_assign(e,t){let n=this.querySelector(`[slot="${e}"]`);n!==null&&(n.removeAttribute(`slot`),n.remove()),t!==null&&(t.setAttribute(`slot`,e),this.append(t)),this._sync()}_sync(){let e=this.shrinkCenterLast;for(let t of this.children){let n=t.getAttribute(`slot`),r=n===`center-widget`?!e:n===`start-widget`||n===`end-widget`?e:!1;t.style.flexShrink=String(r?100:1)}this.hasAttribute(`baseline-position`)?this.style.alignItems=labelYalignAlignItems(Pr[this.baselinePosition]):this.style.removeProperty(`align-items`)}};customElements.define(`gtk-center-box`,GtkCenterBox);const Fr=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 active(){return this.checked}set active(e){this.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===`active`&&(this.checked=this.hasAttribute(`active`)),e===`checked`&&(this.dispatchEvent(new CustomEvent(`notify::checked`,{bubbles:!0,detail:{checked:this.checked}})),this.dispatchEvent(new CustomEvent(`toggled`,{bubbles:!0})),this.dispatchEvent(new CustomEvent(`notify::active`,{bubbles:!0,detail:{active: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}},GtkCheckButton=class extends AdwCheckBase{static signals={toggled:`toggled`,"notify::active":`notify::active`};static get observedAttributes(){return[`checked`,`active`,`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}Fr.select(this.name,this.value)}onConnected(){this._input.name=this.name,this.name!==``&&(this._unsubscribe??=Fr.subscribe(e=>{e.name===this.name&&(this.checked=e.selected===this.value)}),this.checked&&Fr.select(this.name,this.value))}onDisconnected(){this._unsubscribe?.(),this._unsubscribe=null}render(){super.render(),this._input.name=this.name}};customElements.define(`gtk-check-button`,GtkCheckButton),customElements.define(`adw-radio`,AdwRadio);const Ir={red:.75,green:.25,blue:.25,alpha:1};var GtkColorDialogButton=class extends HTMLElement{_buttonEl;_swatchEl;_inputEl;_dialog=null;_rgba={...Ir};_pending=!1;_initialized=!1;static get observedAttributes(){return[`rgba`,`dialog`,`disabled`]}get rgba(){return{...this._rgba}}set rgba(e){let t=typeof e==`string`?parseCssColor(e):e;t===null||rgbaEqual(t,this._rgba)||(this._rgba=t,this._renderSwatch(),this.dispatchEvent(new CustomEvent(`notify::rgba`,{bubbles:!0,detail:{rgba:this.rgba}})))}get dialog(){return this._dialog}set dialog(e){this._dialog!==e&&(this._dialog=e,e?.title!=null&&(this._inputEl.title=e.title),this._renderSensitivity(),this.dispatchEvent(new CustomEvent(`notify::dialog`,{bubbles:!0,detail:{dialog:e}})))}connectedCallback(){if(this._initialized)return;this._initialized=!0,this.setAttribute(`role`,`group`),this._swatchEl=document.createElement(`span`),this._swatchEl.className=`color-button-swatch`,this._buttonEl=document.createElement(`button`),this._buttonEl.type=`button`,this._buttonEl.className=`adw-button color icon-only`,this._buttonEl.setAttribute(`aria-haspopup`,`dialog`),this._buttonEl.appendChild(this._swatchEl),this._inputEl=document.createElement(`input`),this._inputEl.type=`color`,this._inputEl.className=`color-button-input`,this._inputEl.tabIndex=-1,this._inputEl.setAttribute(`aria-hidden`,`true`),this.replaceChildren(this._buttonEl,this._inputEl),this._buttonEl.addEventListener(`click`,()=>this.activate()),this._inputEl.addEventListener(`change`,()=>{this._pending=!1;let e=parseCssColor(this._inputEl.value);e!==null&&(this.rgba={...e,alpha:this._rgba.alpha}),this._renderSensitivity()}),this.hasAttribute(`dialog`)&&(this.dialog={});let e=this.getAttribute(`rgba`);e!==null&&(this.rgba=e),this._renderSwatch(),this._renderSensitivity()}attributeChangedCallback(e){if(this._initialized){if(e===`rgba`){let e=this.getAttribute(`rgba`);e!==null&&(this.rgba=e);return}if(e===`dialog`){this.dialog=this.hasAttribute(`dialog`)?this._dialog??{}:null;return}this._renderSensitivity()}}activate(){this.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0})),this._choose()}_choose(){this._dialog===null||this._pending||(this._pending=!0,this._renderSensitivity(),this._inputEl.value=formatHex(this._rgba),this._inputEl.click())}_renderSensitivity(){let e=this._dialog!==null&&!this.hasAttribute(`disabled`);this._buttonEl.disabled=!e,this._buttonEl.classList.toggle(`disabled`,!e)}_renderSwatch(){this._swatchEl.style.backgroundColor=formatCssColor(this._rgba),this._swatchEl.dataset.translucent=String(this._rgba.alpha<1);let e=describeColor(this._rgba);this._swatchEl.setAttribute(`aria-label`,e),this._buttonEl.setAttribute(`aria-label`,e)}};customElements.define(`gtk-color-dialog-button`,GtkColorDialogButton);function rgbaEqual(e,t){return e.red===t.red&&e.green===t.green&&e.blue===t.blue&&e.alpha===t.alpha}function scaleRound(e,t){return Math.min(t,Math.max(0,Math.floor(e*t+.5)))}function describeColor(e){let t=[`Red ${scaleRound(e.red,100)}%`,`Green ${scaleRound(e.green,100)}%`,`Blue ${scaleRound(e.blue,100)}%`];return e.alpha<1&&t.push(`Alpha ${scaleRound(e.alpha,100)}%`),t.join(`, `)}function formatHex(e){let channel=e=>Math.round(Math.min(1,Math.max(0,e))*255).toString(16).padStart(2,`0`);return`#${channel(e.red)}${channel(e.green)}${channel(e.blue)}`}function formatCssColor(e){let t=formatHex(e);return e.alpha<1?`${t}${Math.round(e.alpha*255).toString(16).padStart(2,`0`)}`:t}const Lr=/^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:\s*[,/]\s*([\d.]+%?))?\s*\)$/i;function parseCssColor(e){let t=document.createElement(`span`);t.style.color=``,t.style.color=e.trim();let n=t.style.color;if(n===``)return null;let r=Lr.exec(n);if(r===null)return null;let i=r[4];return{red:Number(r[1])/255,green:Number(r[2])/255,blue:Number(r[3])/255,alpha:i===void 0?1:i.endsWith(`%`)?Number.parseFloat(i)/100:Number(i)}}const Rr=`adw-list-item-label`,defaultListItemFactory=e=>{let t=document.createElement(`span`);return t.className=Rr,t.textContent=e.item.label,t};function attachRubberBand(e){let t=null,n=null,r=null,stop=()=>{t?.remove(),t=null,n=null,r!==null&&e.host.hasPointerCapture(r)&&e.host.releasePointerCapture(r),r=null};e.host.addEventListener(`pointerdown`,i=>{if(i.button!==0||!e.enabled())return;let a=i.target;a!==null&&e.rows().some(e=>e===a||e.contains(a))||(n={x:i.clientX,y:i.clientY},r=i.pointerId,e.host.setPointerCapture(i.pointerId),t=document.createElement(`div`),t.className=`adw-rubberband`,t.setAttribute(`aria-hidden`,`true`),e.surface.appendChild(t))}),e.host.addEventListener(`pointermove`,r=>{if(n===null||t===null)return;let i=e.surface.getBoundingClientRect(),a=Math.min(n.x,r.clientX),o=Math.min(n.y,r.clientY),s=Math.abs(r.clientX-n.x),c=Math.abs(r.clientY-n.y);t.style.left=`${a-i.left}px`,t.style.top=`${o-i.top}px`,t.style.width=`${s}px`,t.style.height=`${c}px`;let l=[];e.rows().forEach((e,t)=>{let n=e.getBoundingClientRect();n.right>=a&&n.left<=a+s&&n.bottom>=o&&n.top<=o+c&&l.push(t)}),e.selectPositions(l)});for(let t of[`pointerup`,`pointercancel`,`lostpointercapture`])e.host.addEventListener(t,stop)}const zr=new Set([`all`,`item`,`cell`]);function normalizeListTabBehavior$1(e){return e!=null&&zr.has(e)?e:`all`}__name(normalizeListTabBehavior$1,`normalizeListTabBehavior`);var GtkListView=class extends HTMLElement{_listEl;_rows=[];_state=new ListViewState;_factory=defaultListItemFactory;_initialized=!1;static get observedAttributes(){return[`model`,`selection-mode`,`show-separators`,`single-click-activate`,`enable-rubberband`,`tab-behavior`,`orientation`]}get model(){return this._state.model}set model(e){this._state.setModel(normalizeComboOptions(e))}get factory(){return this._factory}set factory(e){this._factory=typeof e==`function`?e:defaultListItemFactory,this._renderRows()}get selected(){return this._state.selection}set selected(e){let t=typeof e==`number`?[e]:e??[];this._state.setSelection(t)}get selectionMode(){return normalizeListSelectionMode(this.getAttribute(`selection-mode`))}set selectionMode(e){this.setAttribute(`selection-mode`,e)}get showSeparators(){return this.hasAttribute(`show-separators`)}set showSeparators(e){this.toggleAttribute(`show-separators`,!!e)}get singleClickActivate(){return this.hasAttribute(`single-click-activate`)}set singleClickActivate(e){this.toggleAttribute(`single-click-activate`,!!e)}get enableRubberband(){return this.hasAttribute(`enable-rubberband`)}set enableRubberband(e){this.toggleAttribute(`enable-rubberband`,!!e)}get tabBehavior(){return normalizeListTabBehavior$1(this.getAttribute(`tab-behavior`))}set tabBehavior(e){this.setAttribute(`tab-behavior`,e)}get orientation(){return this.getAttribute(`orientation`)===`horizontal`?`horizontal`:`vertical`}set orientation(e){this.setAttribute(`orientation`,e)}connectedCallback(){this._initialized||(this._initialized=!0,this.classList.add(this._viewClass,`view`),this._listEl=document.createElement(`div`),this._listEl.className=`adw-list-view-rows`,this.appendChild(this._listEl),bindSlottedChildren(this,[stringListSlot(e=>this._state.setModel(e))]).install(this._listEl),this._state.count===0&&this._state.setModel(parseListModel(this.getAttribute(`model`))),this._state.setSelectionMode(this.selectionMode),this._state.subscribeItems(e=>this._applyItemsChanged(e)),this._state.subscribeSelection(()=>this._onSelectionChanged()),attachRovingFocus({host:this,orientation:()=>this.orientation,items:()=>this._rows,select:e=>this._selectRow(e,{})}),attachRubberBand({host:this,surface:this._listEl,enabled:()=>this.enableRubberband&&this._state.selectionMode===`multiple`,rows:()=>this._rows,selectPositions:e=>this._state.setSelection(e,!0)}),this._applyAttributes(),this._renderRows())}attributeChangedCallback(e){if(this._initialized){if(e===`model`){this._state.setModel(parseListModel(this.getAttribute(`model`)));return}e===`selection-mode`&&this._state.setSelectionMode(this.selectionMode),this._applyAttributes(),(e===`selection-mode`||e===`tab-behavior`)&&this._renderRows()}}_applyAttributes(){let e=this.orientation;this.classList.toggle(`separators`,this.showSeparators),this.classList.toggle(`horizontal`,e===`horizontal`);let t=this._state.selectionMode!==`none`;this.setAttribute(`role`,t?`listbox`:`list`),this._state.selectionMode===`multiple`?this.setAttribute(`aria-multiselectable`,`true`):this.removeAttribute(`aria-multiselectable`)}get _viewClass(){return`adw-list-view`}get _rowClass(){return`adw-list-view-row`}_renderRows(){if(this._initialized){this._listEl.replaceChildren(),this._rows=[];for(let e=0;e<this._state.count;e++){let t=this._createRow(e);t!==null&&(this._listEl.appendChild(t),this._rows.push(t))}this._syncSelectedStates()}}_createRow(e){let t=this._state.itemContext(e);if(t===null)return null;let n=document.createElement(`div`);return n.className=`${this._rowClass} activatable`,n.setAttribute(`role`,this._state.selectionMode===`none`?`listitem`:`option`),n.tabIndex=this.tabBehavior===`all`?0:-1,n.appendChild(this._factory(t)),n.addEventListener(`click`,e=>{this._selectRow(n,{modify:e.ctrlKey||e.metaKey,extend:e.shiftKey}),this.singleClickActivate&&this._activateRow(n)}),n.addEventListener(`dblclick`,()=>{this.singleClickActivate||this._activateRow(n)}),n.addEventListener(`pointerenter`,()=>{this.singleClickActivate&&this._selectRow(n,{})}),n.addEventListener(`keydown`,e=>{e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),e.key===` `?this._selectRow(n,{modify:e.ctrlKey,extend:e.shiftKey}):this._activateRow(n))}),n}_selectRow(e,t){let n=this._rows.indexOf(e);n<0||this._state.selectItem(n,t)}_activateRow(e){let t=this._rows.indexOf(e);t<0||this.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0,detail:{position:t}}))}_onSelectionChanged(){this._syncSelectedStates(),this.dispatchEvent(new CustomEvent(`notify::selected`,{bubbles:!0,detail:{selected:this._state.selection}}))}_syncSelectedStates(){let e=new Set(this._state.selection),t=this.tabBehavior!==`all`,n=e.size>0?Math.min(...e):0;this._rows.forEach((r,i)=>{let a=e.has(i);r.classList.toggle(`selected`,a),this._state.selectionMode===`none`?r.removeAttribute(`aria-selected`):r.setAttribute(`aria-selected`,String(a)),t&&(r.tabIndex=i===n?0:-1)})}_applyItemsChanged(e){if(!this._initialized)return;for(let t of this._rows.splice(e.position,e.removed))t.remove();let t=this._rows[e.position]??null,n=[];for(let r=0;r<e.added;r++){let i=this._createRow(e.position+r);i!==null&&(this._listEl.insertBefore(i,t),n.push(i))}this._rows.splice(e.position,0,...n),this._syncSelectedStates()}};customElements.define(`gtk-list-view`,GtkListView);var GtkColumnView=class extends GtkListView{_headerEl;_columns=[];_factories={};_sorter=null;_dragged=null;static get observedAttributes(){return[`model`,`columns`,`selection-mode`,`single-click-activate`,`enable-rubberband`,`tab-behavior`,`show-row-separators`,`show-column-separators`,`reorderable`]}get columns(){return this._columns.map(e=>({...e}))}set columns(e){this._columns=normalizeColumnViewColumns(e),this._renderHeader(),this._renderRows()}get columnFactories(){return this._factories}set columnFactories(e){this._factories=e??{},this._renderRows()}get sorter(){return this._sorter===null?null:{...this._sorter}}set sorter(e){this._applySorter(e)}get showRowSeparators(){return this.hasAttribute(`show-row-separators`)}set showRowSeparators(e){this.toggleAttribute(`show-row-separators`,!!e)}get showColumnSeparators(){return this.hasAttribute(`show-column-separators`)}set showColumnSeparators(e){this.toggleAttribute(`show-column-separators`,!!e)}get reorderable(){return this.hasAttribute(`reorderable`)}set reorderable(e){this.toggleAttribute(`reorderable`,!!e)}connectedCallback(){let e=this._headerEl===void 0;e&&(this._columns=parseColumnViewColumns(this.getAttribute(`columns`)),this._headerEl=document.createElement(`div`),this._headerEl.className=`adw-column-view-header`,this._headerEl.setAttribute(`role`,`row`)),super.connectedCallback(),e&&this.insertBefore(this._headerEl,this.firstChild),this._renderHeader(),this._renderRows()}attributeChangedCallback(e){if(e===`columns`){this._columns=parseColumnViewColumns(this.getAttribute(`columns`)),this._renderHeader(),this._renderRows();return}super.attributeChangedCallback(e)}_applyAttributes(){super._applyAttributes(),this.classList.toggle(`separators`,this.showRowSeparators),this.classList.toggle(`column-separators`,this.showColumnSeparators),this.setAttribute(`role`,`grid`),this.removeAttribute(`aria-multiselectable`),this.classList.remove(`horizontal`),this._headerEl!==void 0&&this._applyTracks(this._headerEl)}get _viewClass(){return`adw-column-view`}get _rowClass(){return`adw-column-view-row`}_createRow(e){let t=super._createRow(e);if(t===null)return null;t.setAttribute(`role`,`row`),t.replaceChildren();let n=this._state.itemContext(e);if(n!==null)for(let e of this._columns)e.visible!==!1&&t.appendChild(this._createCell(e,n));return this._applyTracks(t),t}_createCell(e,t){let n=document.createElement(`div`);n.className=`adw-column-view-cell`,n.setAttribute(`role`,`gridcell`);let r=this._factories[e.id??e.key];if(r!==void 0)n.appendChild(r(t));else{let r=document.createElement(`span`);r.className=Rr,r.textContent=listItemField(t.item,e.key),n.appendChild(r)}return n}_renderHeader(){if(this._headerEl!==void 0){this._headerEl.replaceChildren();for(let e of this._columns)e.visible!==!1&&this._headerEl.appendChild(this._createHeaderCell(e));this._applyTracks(this._headerEl)}}_createHeaderCell(e){let t=e.id??e.key,n=document.createElement(`button`);n.type=`button`,n.className=`adw-column-view-header-cell`,n.setAttribute(`role`,`columnheader`),n.dataset.columnId=t;let r=document.createElement(`span`);if(r.className=`adw-column-view-header-title`,r.textContent=e.title??e.key,n.appendChild(r),e.sortable===!0){let r=this._sorter!==null&&this._sorter.column===t,i=createGtkImage(`go-down`,`adw-column-view-sort-indicator`);i.classList.toggle(`ascending`,r&&!this._sorter.descending),i.classList.toggle(`descending`,r&&this._sorter.descending),i.hidden=!r,n.appendChild(i),n.setAttribute(`aria-sort`,r?this._sorter.descending?`descending`:`ascending`:`none`),n.addEventListener(`click`,()=>this._applySorter(columnViewSort(this._sorter,e)))}else n.disabled=!0;return this.reorderable&&this._makeDraggable(n,t),n}_makeDraggable(e,t){e.draggable=!0,e.addEventListener(`dragstart`,e=>{this._dragged=t,e.dataTransfer?.setData(`text/plain`,t)}),e.addEventListener(`dragover`,e=>e.preventDefault()),e.addEventListener(`drop`,e=>{e.preventDefault();let n=this._columns.findIndex(e=>(e.id??e.key)===this._dragged),r=this._columns.findIndex(e=>(e.id??e.key)===t);if(this._dragged=null,n<0||r<0||n===r)return;let i=this._columns.splice(n,1);this._columns.splice(r,0,...i),this._renderHeader(),this._renderRows()})}_applySorter(e){let t=e===null&&this._sorter===null||e!==null&&this._sorter!==null&&e.column===this._sorter.column&&e.descending===this._sorter.descending;this._sorter=e===null?null:{...e},!t&&(this._renderHeader(),this.dispatchEvent(new CustomEvent(`notify::sorter`,{bubbles:!0,detail:{sorter:this.sorter}})))}_applyTracks(e){e.style.gridTemplateColumns=dataGridTrackTemplate(columnViewTracks(this._columns))}};customElements.define(`gtk-column-view`,GtkColumnView);var GtkDropDown=class extends HTMLElement{static signals={"notify::selected":`notify::selected`,"notify::selected-item":`notify::selected-item`};_buttonEl;_labelEl;_popoverEl;_listEl;_searchEl=null;_itemButtons=[];_state=new ComboState;_initialized=!1;_typeAheadBuffer=``;_typeAheadTimer=null;static get observedAttributes(){return[`model`,`selected`,`enable-search`,`disabled`]}get model(){return this._state.model}set model(e){this._state.setModel(normalizeComboOptions(e))}get selected(){return this._state.selectedIndex}set selected(e){this._selectIndex(e)}get_selected(){return this.selected}set_selected(e){this.selected=e}get selectedValue(){return this._state.selectedValue}set selectedValue(e){let t=this._state.model.findIndex(t=>t.value===e);t>=0&&this._selectIndex(t)}get selectedItem(){return this._state.model[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,createGtkImage(`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(`gtk-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),bindSlottedChildren(this,[stringListSlot(e=>this._state.setModel(e))]).install(this._buttonEl,this._popoverEl),this._state.count===0&&this._state.setModel(parseListModel(this.getAttribute(`model`)));let e=Number.parseInt(this.getAttribute(`selected`)??``,10);this._state.hasIndex(e)&&this._state.setSelectedIndex(e),this._state.subscribeItems(e=>this._applyItemsChanged(e)),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===`model`)this._state.setModel(parseListModel(n));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())}_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.model[e];this.dispatchEvent(new CustomEvent(`notify::selected`,{bubbles:!0,detail:{selected:e}})),this.dispatchEvent(new CustomEvent(`notify::selected-item`,{bubbles:!0,detail:{"selected-item":n??null}})),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.model.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(),n=this._state.model;this._itemButtons.forEach((e,r)=>{e.hidden=!(t.length===0||(n[r]?.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 of this._state.model){let t=this._createItem(e);this._listEl.appendChild(t),this._itemButtons.push(t)}this._updateSelectedStates(),this._state.count===0&&this._popoverEl.popdown()}_createItem(e){let t=document.createElement(`button`);t.type=`button`,t.className=`adw-popover-item adw-drop-down-item`,t.setAttribute(`role`,`option`),t.tabIndex=-1;let n=document.createElement(`span`);n.className=`adw-drop-down-item-label`,n.textContent=e.label;let r=document.createElement(`span`);return r.className=`adw-drop-down-item-check`,r.setAttribute(`aria-hidden`,`true`),t.append(n,r),t.addEventListener(`click`,()=>{let e=this._itemButtons.indexOf(t);e<0||(this._selectIndex(e,{fromUser:!0}),this._popoverEl.popdown(),this._buttonEl.focus())}),t}_applyItemsChanged(e){if(!this._initialized)return;for(let t of this._itemButtons.splice(e.position,e.removed))t.remove();let t=this._itemButtons[e.position]??null,n=[],r=this._state.model;for(let i=0;i<e.added;i++){let a=r[e.position+i];if(!a)continue;let o=this._createItem(a);this._listEl.insertBefore(o,t),n.push(o)}this._itemButtons.splice(e.position,0,...n),this._updateSelectedStates(),this._updateLabel(),this._state.count===0&&this._popoverEl.popdown()}};customElements.define(`gtk-drop-down`,GtkDropDown);const Br=2147483647;function intAttribute(e,t){let n=Number.parseInt(e.getAttribute(t)??``,10);return Number.isFinite(n)?n:0}var GtkDrawingArea=class extends HTMLElement{_canvas;_context=null;_initialized=!1;_drawFunc=null;_width=-1;_height=-1;_scale=1;_resize=null;_frame=null;static get observedAttributes(){return[`content-width`,`content-height`]}get contentWidth(){return intAttribute(this,`content-width`)}set contentWidth(e){this._write(`content-width`,String(glibClamp(Math.trunc(e)||0,0,Br)))}get contentHeight(){return intAttribute(this,`content-height`)}set contentHeight(e){this._write(`content-height`,String(glibClamp(Math.trunc(e)||0,0,Br)))}_write(e,t){this.getAttribute(e)!==t&&this.setAttribute(e,t)}get drawFunc(){return this._drawFunc}set drawFunc(e){this.setDrawFunc(e)}setDrawFunc(e){this._drawFunc=e,this.queueDraw()}queueDraw(){!this._initialized||this._frame!==null||(this._frame=requestAnimationFrame(()=>{this._frame=null,this._draw()}))}connectedCallback(){if(this._initialized){this._observe();return}this._initialized=!0,this._canvas=document.createElement(`canvas`),this._canvas.className=`adw-drawing-area-canvas`,this._context=this._canvas.getContext(`2d`),this.replaceChildren(this._canvas),this._publishSize(),this._observe()}disconnectedCallback(){this._resize?.disconnect(),this._resize=null,this._frame!==null&&cancelAnimationFrame(this._frame),this._frame=null}attributeChangedCallback(e){this._initialized&&((e===`content-width`||e===`content-height`)&&this._publishSize(),this._notify(e),(e===`content-width`||e===`content-height`)&&this.queueDraw())}_publishSize(){let e=[[`--adw-drawing-width`,this.contentWidth],[`--adw-drawing-height`,this.contentHeight]];for(let[t,n]of e)n>0?this.style.setProperty(t,`${n}px`):this.style.removeProperty(t)}_observe(){this._resize||(this._resize=new ResizeObserver(e=>{for(let t of e){let e=t.borderBoxSize?.[0];this._allocated(e?e.inlineSize:t.contentRect.width,e?e.blockSize:t.contentRect.height)}}),this._resize.observe(this))}_allocated(e,t){let n=e!==this._width||t!==this._height;this._width=e,this._height=t,n&&this.dispatchEvent(new CustomEvent(`resize`,{bubbles:!0,detail:{width:e,height:t}})),this._draw()}_draw(){if(!this._canvas||this._width<0)return;let e=this._width,t=this._height,n=this._devicePixelRatio(),r=Math.round(e*n),i=Math.round(t*n);this._canvas.width!==r&&(this._canvas.width=r),this._canvas.height!==i&&(this._canvas.height=i),this._scale=n;let a=this._context;a&&(a.setTransform(n,0,0,n,0,0),a.clearRect(0,0,e,t),this._drawFunc&&this._drawFunc(this,a,e,t))}_devicePixelRatio(){return typeof globalThis>`u`?1:globalThis.devicePixelRatio||1}_notify(e){let t=e===`content-width`?this.contentWidth:this.contentHeight;this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:t}}))}get allocation(){return{width:this._width,height:this._height}}get pixelScale(){return this._scale}};customElements.define(`gtk-drawing-area`,GtkDrawingArea);const Vr=new WeakMap;var Hr=class GtkDragIcon extends HTMLElement{_pointerX=0;_pointerY=0;_dragging=!1;_onDragOver=null;_onDragEnd=null;_transfer=null;static get observedAttributes(){return[]}static getForDrag(e){let t=e.dataTransfer,n=t===null?void 0:Vr.get(t);if(n!==void 0)return n;let r=document.querySelector(`gtk-drag-icon`),i=r instanceof GtkDragIcon&&!r.dragging?r:null,a=i??document.createElement(`gtk-drag-icon`);return i===null&&document.body.appendChild(a),t!==null&&Vr.set(t,a),a.beginDrag(e),a}static createWidgetForValue(e){if(typeof e==`string`){let t=document.createElement(`gtk-label`);return t.setAttribute(`label`,e),t}if(e===null)return null;let t=document.createElement(`div`);t.className=`adw-drag-icon-swatch`;let n=e.alpha??1;return t.style.backgroundColor=`rgba(${Math.round(e.red*255)}, ${Math.round(e.green*255)}, ${Math.round(e.blue*255)}, ${n})`,t}get child(){return this.firstElementChild}set child(e){this.child!==e&&(this.replaceChildren(),e!==null&&this.appendChild(e),this.dispatchEvent(new CustomEvent(`notify::child`,{bubbles:!0,detail:{child:e}})))}setChild(e){this.child=e,e!==null&&this._render()}connectedCallback(){this.style.pointerEvents=`none`,this._dragging&&this._observe()}disconnectedCallback(){this._unobserve()}beginDrag(e){let t=e.dataTransfer;if(t!==null)try{let e=document.createElement(`canvas`);e.width=1,e.height=1,t.setDragImage(e,0,0)}catch{}this._pointerX=e.clientX,this._pointerY=e.clientY,this._transfer=t,this._dragging=!0,this._observe(),this._render()}endDrag(){this._dragging=!1,this._transfer=null,this._unobserve(),this.hidden=!0}get dragging(){return this._dragging}_observe(){this._onDragOver===null&&(this._onDragOver=e=>{this._pointerX=e.clientX,this._pointerY=e.clientY,this._render()},this._onDragEnd=e=>{(e.dataTransfer===null||e.dataTransfer===this._transfer)&&this.endDrag()},document.addEventListener(`dragover`,this._onDragOver),document.addEventListener(`dragend`,this._onDragEnd))}_unobserve(){this._onDragOver!==null&&document.removeEventListener(`dragover`,this._onDragOver),this._onDragEnd!==null&&document.removeEventListener(`dragend`,this._onDragEnd),this._onDragOver=null,this._onDragEnd=null}_render(){this.hidden=!this._dragging,this._dragging&&(this.style.left=`0px`,this.style.top=`0px`,this.style.transform=`translate3d(${Math.round(this._pointerX)}px, ${Math.round(this._pointerY)}px, 0)`)}};customElements.define(`gtk-drag-icon`,Hr);var GtkEditableLabel=class extends HTMLElement{_label;_entry;_initialized=!1;_grace=null;static get observedAttributes(){return[`text`,`editable`,`editing`]}get text(){return this.getAttribute(`text`)??``}set text(e){this.setAttribute(`text`,e??``)}get editable(){let e=this.getAttribute(`editable`);return e===null?!0:e!==`false`}set editable(e){e?this.removeAttribute(`editable`):this.setAttribute(`editable`,`false`)}get editing(){return this.hasAttribute(`editing`)}set editing(e){this.toggleAttribute(`editing`,!!e)}startEditing(){this.editable&&(this.editing=!0)}stopEditing(e=!1){this.editing&&=(e&&this.setAttribute(`text`,this._entry.value),!1)}get entry(){return this._entry}connectedCallback(){this._initialized||(this._initialized=!0,this._label=document.createElement(`span`),this._label.className=`adw-editable-label-label`,this._label.addEventListener(`click`,()=>this.startEditing()),this._entry=document.createElement(`input`),this._entry.className=`adw-editable-label-entry`,this._entry.type=`text`,this._entry.tabIndex=-1,this._entry.addEventListener(`keydown`,e=>{e.key===`Enter`?(e.preventDefault(),e.stopPropagation(),this.stopEditing(!0)):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),this.stopEditing(!1))}),this.replaceChildren(this._label,this._entry),this.addEventListener(`keydown`,e=>{this.editing||e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),this.startEditing())}),this.addEventListener(`focusout`,e=>{let t=e.relatedTarget;t instanceof Node&&this.contains(t)||(this._grace!==null&&clearTimeout(this._grace),this._grace=setTimeout(()=>{this._grace=null,this.editing&&this.stopEditing(!0)},100))}),this._render())}disconnectedCallback(){this._grace!==null&&clearTimeout(this._grace),this._grace=null}attributeChangedCallback(e,t,n){if(this._initialized)switch(e){case`text`:this.editing||this._render();break;case`editable`:n===`false`&&this.stopEditing(!1);break;case`editing`:this._render(),this.editing?this._entry.focus():this.focus(),this.dispatchEvent(new CustomEvent(`notify::editing`,{bubbles:!0,detail:{editing:this.editing}}));break}}_render(){let e=this.editing;this.classList.toggle(`editing`,e),this._label.hidden=e,this._entry.hidden=!e,this._label.textContent=this.text,this._entry.value=this.text,e?this.removeAttribute(`tabindex`):this.setAttribute(`tabindex`,`0`)}};customElements.define(`gtk-editable-label`,GtkEditableLabel);function row(e,t,n=``){return{text:e,name:t,keywords:n===``?[]:n.split(` `)}}const Ur=[`🏻`,`🏼`,`🏽`,`🏾`,`🏿`];function hasVariations(e){return[...e.text].some(e=>Ur.includes(e))}const Wr=[row(`😀`,`grinning face`,`smile happy joy grin`),row(`😃`,`grinning face with big eyes`,`smile happy joy`),row(`😄`,`grinning face with smiling eyes`,`smile happy joy`),row(`😁`,`beaming face with smiling eyes`,`smile happy`),row(`😂`,`face with tears of joy`,`laugh joy cry`),row(`🤣`,`rolling on the floor laughing`,`laugh rofl joy`),row(`🙂`,`slightly smiling face`,`smile`),row(`😉`,`winking face`,`wink joke flirt`),row(`😊`,`smiling face with smiling eyes`,`blush happy`),row(`😇`,`smiling face with halo`,`angel innocent`),row(`🥰`,`smiling face with hearts`,`love affection`),row(`😍`,`smiling face with heart-eyes`,`love crush`),row(`😘`,`face blowing a kiss`,`kiss love`),row(`😗`,`kissing face`,`kiss love`),row(`☺️`,`smiling face`,`smile happy`),row(`😋`,`face savoring food`,`yum delicious tasty`),row(`😛`,`face with tongue`,`tongue silly`),row(`🤪`,`zany face`,`crazy goofy wild`),row(`😟`,`worried face`,`worried sad`),row(`🙁`,`slightly frowning face`,`sad frown`),row(`☹️`,`frowning face`,`sad frown`),row(`😮`,`face with open mouth`,`surprised wow`),row(`😲`,`astonished face`,`surprised wow`),row(`😳`,`flushed face`,`blush embarrassed`),row(`🥺`,`pleading face`,`please puppy`),row(`😦`,`frowning face with open mouth`,`frown disappointed`),row(`😨`,`fearful face`,`fear scared`),row(`😰`,`anxious face with sweat`,`nervous anxious`),row(`😢`,`crying face`,`cry sad tear`),row(`😭`,`loudly crying face`,`cry sad sob`),row(`😶`,`face without mouth`,`silent speechless`),row(`😏`,`smirking face`,`smirk`),row(`😒`,`unamused face`,`meh unhappy`),row(`🙄`,`face with rolling eyes`,`eyeroll annoyed`),row(`😬`,`grimacing face`,`grimace awkward`),row(`🤥`,`lying face`,`liar pinocchio`),row(`😎`,`smiling face with sunglasses`,`cool sunglasses`),row(`🤓`,`nerd face`,`nerd geek glasses`),row(`🧐`,`face with monocle`,`fancy monocle`),row(`🧑`,`person`,`adult human`),row(`👨`,`man`,`adult male`),row(`👩`,`woman`,`adult female`),row(`👧`,`girl`,`child female`),row(`👦`,`boy`,`child male`),row(`👶`,`baby`,`child infant`),row(`👶🏻`,`child: light skin tone`,`child skin tone`),row(`🧑‍💻`,`technologist`,`coder computer`),row(`👷`,`construction worker`,`builder work`),row(`🕵️`,`detective`,`spy sleuth`),row(`🤴`,`prince`,`crown royal`),row(`👸`,`princess`,`crown royal`),row(`👰`,`person with veil`,`bride wedding`),row(`🤵`,`person in tuxedo`,`formal groom`),row(`🎅`,`Santa Claus`,`christmas santa`),row(`🤶`,`Mrs. Claus`,`christmas santa`),row(`🦸`,`superhero`,`hero power`),row(`🦹`,`supervillain`,`villain power`),row(`🧙`,`mage`,`wizard magic`),row(`🧚`,`fairy`,`magic wings`),row(`🧛`,`vampire`,`dracula horror`),row(`🧜`,`merperson`,`mermaid merman`),row(`🧝`,`elf`,`fantasy pointy`),row(`🧟`,`zombie`,`undead horror`),row(`💆`,`person getting massage`,`spa head`),row(`💇`,`person getting haircut`,`barber salon`),row(`🚶`,`person walking`,`walk pedestrian`),row(`🏃`,`person running`,`run marathon`),row(`💃`,`woman dancing`,`dance ballet`),row(`👪`,`family`,`parents child`),row(`🧑‍🤝‍🧑`,`people holding hands`,`family couple`)],Gr=[row(`👋`,`waving hand`,`wave hello goodbye`),row(`✋️`,`raised hand`,`stop highfive`),row(`👍`,`thumbs up`,`like yes approve`),row(`👎`,`thumbs down`,`dislike no`),row(`👌`,`OK hand`,`ok perfect`),row(`👏`,`clapping hands`,`applause praise`),row(`👐`,`open hands`,`hug open`),row(`🙌`,`raising hands`,`celebrate praise`),row(`🙏`,`folded hands`,`pray thanks`),row(`🤝`,`handshake`,`deal agreement`),row(`🤘`,`sign of the horns`,`rock metal`),row(`👈`,`backhand index pointing left`,`point direction`),row(`👉`,`backhand index pointing right`,`point direction`),row(`☝️`,`index pointing up`,`point one`),row(`✍️`,`writing hand`,`write pen`),row(`🤞`,`crossed fingers`,`luck hope`),row(`💪`,`flexed biceps`,`muscle strong`),row(`🧠`,`brain`,`mind smart`),row(`👀`,`eyes`,`look see watch`),row(`🧣`,`ear`,`hear listen`),row(`👃`,`nose`,`smell`),row(`🦰`,`red hair`,`ginger hair`),row(`🛀`,`bathing`,`bath shower`),row(`🛍`,`shower`,`bath clean`),row(`🦽`,`probing cane`,`blind accessibility`),row(`🦼`,`motorized wheelchair`,`accessibility`),row(`🦯`,`person with white cane`,`blind accessibility`),row(`🏋️`,`weight lifting`,`gym sport`),row(`👫`,`woman and man holding hands`,`couple family`),row(`👬`,`men holding hands`,`couple`),row(`👭`,`women holding hands`,`couple`),row(`💏`,`kiss`,`love couple`),row(`💑`,`couple with heart`,`love wedding`),row(`👮`,`police officer`,`cop law`),row(`👷`,`person with skullcap`,`worker`),row(`🥷`,`ninja`,`martialarts`),row(`🧗`,`person climbing`,`sport`),row(`🤸`,`person cartwheeling`,`gymnastics`),row(`🤼`,`people wrestling`,`sport wrestle`),row(`👯`,`people with bunny ears`,`costume`),row(`🧕`,`woman with headscarf`,`hijab clothing`),row(`👞`,`man’s shoe`,`clothing`),row(`👕`,`t-shirt`,`clothing shirt`),row(`👖`,`jeans`,`clothing trousers`),row(`👔`,`necktie`,`clothing formal`),row(`👗`,`dress`,`clothing`),row(`👘`,`kimono`,`clothing`),row(`🥻`,`sari`,`clothing`),row(`👙`,`bikini`,`clothing swimsuit`),row(`👚`,`woman’s clothes`,`clothing dress`),row(`🩱`,`one-piece swimsuit`,`clothing swimsuit`),row(`👑`,`woman’s hat`,`clothing`),row(`👒`,`glasses`,`clothing eyewear`),row(`🎩`,`top hat`,`clothing`),row(`🎓`,`graduation cap`,`clothing education`),row(`🧢`,`billed cap`,`clothing hat`),row(`👜`,`running shoe`,`clothing sneaker`),row(`👡`,`woman’s heel`,`clothing shoe`),row(`🛠️`,`hammer and wrench`,`tool repair`)],Kr=[row(`🐒`,`monkey`,`animal primate`),row(`🦍`,`gorilla`,`animal ape`),row(`🐕`,`dog`,`animal pet`),row(`🐶`,`dog face`,`animal pet`),row(`🐩`,`poodle`,`dog animal`),row(`🐺`,`wolf`,`animal`),row(`🦊`,`fox`,`animal`),row(`🐱`,`cat face`,`animal pet`),row(`🦁`,`lion`,`animal cat`),row(`🐯`,`tiger face`,`animal cat`),row(`🐅`,`tiger`,`animal`),row(`🐆`,`leopard`,`animal cat`),row(`🐴`,`horse face`,`animal`),row(`🦄`,`unicorn`,`animal fantasy`),row(`ᾬ`,`unicorn face`,`animal fantasy`),row(`🦓`,`zebra`,`animal`),row(`🦌`,`deer`,`animal`),row(`🐮`,`cow face`,`animal`),row(`🐷`,`pig face`,`animal`),row(`🐪`,`camel`,`animal desert`),row(`🦒`,`giraffe`,`animal`),row(`🐘`,`elephant`,`animal`),row(`🦛`,`rhinoceros`,`animal`),row(`🐰`,`rabbit face`,`animal pet`),row(`🐻`,`bear`,`animal`),row(`🐨`,`koala`,`animal`),row(`🐼`,`panda`,`animal`),row(`🦥`,`sloth`,`animal`),row(`🦦`,`otter`,`animal`),row(`🦘`,`kangaroo`,`animal`),row(`🐔`,`chicken`,`bird animal`),row(`🐧`,`penguin`,`bird animal`),row(`🦆`,`duck`,`bird animal`),row(`🦉`,`owl`,`bird animal`),row(`🐸`,`frog`,`animal`),row(`🐢`,`turtle`,`animal reptile`),row(`🐍`,`snake`,`animal reptile`),row(`🐳`,`dragon face`,`animal fantasy`),row(`🦖`,`T-Rex`,`animal dinosaur`),row(`🐬`,`dolphin`,`animal sea`),row(`🦈`,`shark`,`animal sea`),row(`🐙`,`octopus`,`animal sea`),row(`🐛`,`bug`,`animal insect`),row(`🦋`,`butterfly`,`animal insect`),row(`🕷️`,`spider`,`animal insect`),row(`🌸`,`cherry blossom`,`flower spring`),row(`🌺`,`hibiscus`,`flower`),row(`🌻`,`sunflower`,`flower sun`),row(`🌷`,`tulip`,`flower`),row(`🌱`,`seedling`,`plant nature`),row(`🌲`,`evergreen tree`,`plant nature`),row(`🌳`,`deciduous tree`,`plant nature`),row(`🌴`,`palm tree`,`plant nature`),row(`🌵`,`cactus`,`plant`),row(`🍀`,`four leaf clover`,`plant luck`),row(`🍁`,`maple leaf`,`plant autumn`),row(`🍂`,`fallen leaf`,`plant autumn`),row(`🍃`,`leaf fluttering in wind`,`plant wind`)],qr=[row(`🍇`,`grapes`,`fruit`),row(`🍈`,`melon`,`fruit`),row(`🍉`,`watermelon`,`fruit`),row(`🍊`,`tangerine`,`fruit citrus`),row(`🍋`,`lemon`,`fruit citrus`),row(`🍌`,`banana`,`fruit`),row(`🍍`,`pineapple`,`fruit`),row(`🍎`,`red apple`,`fruit`),row(`🍐`,`pear`,`fruit`),row(`🍑`,`peach`,`fruit`),row(`🍒`,`cherries`,`fruit`),row(`🍓`,`strawberry`,`fruit`),row(`🥝`,`kiwi fruit`,`fruit`),row(`🍏`,`tomato`,`fruit vegetable`),row(`🥐`,`croissant`,`food bread`),row(`🥖`,`flatbread`,`food bread`),row(`🥨`,`pretzel`,`food`),row(`🥯`,`bagel`,`food bread`),row(`🥞`,`pancakes`,`food breakfast`),row(`🧀`,`cheese wedge`,`food dairy`),row(`🍖`,`meat on bone`,`food`),row(`🍗`,`poultry leg`,`food chicken`),row(`🥩`,`cut of meat`,`food`),row(`🥓`,`bacon`,`food`),row(`🍔`,`hamburger`,`food`),row(`🍟`,`french fries`,`food`),row(`🍕`,`pizza`,`food`),row(`🌭`,`hot dog`,`food`),row(`🥪`,`sandwich`,`food lunch`),row(`🌮`,`taco`,`food`),row(`🌯`,`burrito`,`food`),row(`🥗`,`green salad`,`food vegetable`),row(`🍿`,`popcorn`,`food snack`),row(`🍣`,`sushi`,`food japanese`),row(`🍤`,`fish cake with swirl`,`food`),row(`🍥`,`soft ice cream`,`food dessert`),row(`🍦`,`soft serve`,`food dessert`),row(`🍨`,`ice cream`,`food dessert`),row(`🎂`,`birthday cake`,`food dessert`),row(`🧁`,`cupcake`,`food dessert`),row(`🥧`,`pie`,`food dessert`),row(`🍫`,`chocolate bar`,`food dessert`),row(`🍬`,`candy`,`food sweet`),row(`🍭`,`lollipop`,`food sweet`),row(`☕`,`hot beverage`,`drink coffee tea`),row(`🫖`,`teapot`,`drink tea`),row(`🍶`,`teacup without handle`,`drink tea`),row(`🍷`,`wine glass`,`drink`),row(`🍸`,`cocktail glass`,`drink`),row(`🍺`,`beer mug`,`drink`),row(`🥂`,`clinking glasses`,`drink cheers`),row(`🥢`,`chopsticks`,`food utensil`),row(`🍴`,`fork and knife`,`food utensil`),row(`🥄`,`spoon`,`food utensil`)],Jr=[row(`🌍`,`globe showing Europe-Africa`,`world earth`),row(`🌎`,`globe showing Americas`,`world earth`),row(`🌏`,`globe showing Asia-Australia`,`world earth`),row(`🗺️`,`world map`,`map`),row(`⛰️`,`mountain`,`travel nature`),row(`🌋`,`volcano`,`travel nature`),row(`🏕️`,`camping`,`travel nature`),row(`🏖️`,`beach with umbrella`,`travel sea`),row(`🏜`,`desert`,`travel nature`),row(`🏝️`,`desert island`,`travel sea`),row(`🏞️`,`national park`,`travel nature`),row(`🏟️`,`stadium`,`travel sport`),row(`🏛️`,`classical building`,`travel`),row(`🏗️`,`buildings`,`travel`),row(`🏠`,`house`,`home building`),row(`🏡`,`house with garden`,`home`),row(`🏢`,`office building`,`work`),row(`🏤`,`post office`,`building`),row(`🏥`,`hospital`,`building health`),row(`🏨`,`hotel`,`travel building`),row(`🏪`,`convenience store`,`building shop`),row(`🏫`,`school`,`building education`),row(`🏯`,`castle`,`building`),row(`⛪`,`church`,`building religion`),row(`⛩️`,`shinto torii gate`,`japan`),row(`🛑`,`fountain`,`building`),row(`🗼️`,`tower`,`building`),row(`🗽`,`Statue of Liberty`,`travel usa`),row(`🗛️`,`Mount Rushmore`,`travel usa`),row(`🧲`,`carousel horse`,`travel fair`),row(`🚀`,`rocket`,`travel space`),row(`🛸`,`flying saucer`,`travel space`),row(`🛎️`,`bellhop bell`,`travel hotel`),row(`🧳`,`luggage`,`travel`),row(`🧭`,`compass`,`travel navigate`),row(`⌛️`,`hourglass done`,`time`),row(`⏰`,`alarm clock`,`time`),row(`🚂`,`locomotive`,`travel train`),row(`🚆`,`train`,`travel`),row(`🚇`,`metro`,`travel subway`),row(`🚉`,`station`,`travel`),row(`🚌`,`bus`,`travel`),row(`🚑`,`ambulance`,`emergency`),row(`🚓`,`police car`,`emergency`),row(`🚕`,`taxi`,`travel`),row(`🚗`,`automobile`,`travel car`),row(`🚙`,`sport utility vehicle`,`car`),row(`🚲`,`bicycle`,`vehicle`),row(`🛴`,`kick scooter`,`vehicle`),row(`⛺`,`tent`,`travel camping`)],Yr=[row(`🎃`,`jack-o-lantern`,`halloween pumpkin`),row(`🎄`,`Christmas tree`,`christmas`),row(`🎆`,`fireworks`,`celebration`),row(`✨`,`sparkles`,`celebration magic`),row(`🎈`,`balloon`,`party`),row(`🎉`,`party popper`,`party celebration`),row(`🎊`,`confetti ball`,`party`),row(`🎁`,`wrapped gift`,`present birthday`),row(`🎗️`,`reminder ribbon`,`awareness`),row(`🎫`,`ticket`,`event`),row(`🏆`,`trophy`,`award win`),row(`🥇`,`1st place medal`,`award win`),row(`🎾`,`tennis`,`sport`),row(`🏈`,`American football`,`sport`),row(`🏑`,`field hockey`,`sport`),row(`🏒`,`ice hockey`,`sport`),row(`🎳`,`bowling`,`sport`),row(`🏐`,`volleyball`,`sport`),row(`🥎`,`lacrosse`,`sport`),row(`⚽`,`soccer ball`,`sport football`),row(`⚾`,`baseball`,`sport`),row(`🏊`,`swimming`,`sport`),row(`🎿`,`skis`,`sport winter`),row(`⛷️`,`skier`,`sport winter`),row(`🛹`,`skateboard`,`sport`),row(`🎽`,`running shirt`,`sport`),row(`🎯`,`bullseye`,`sport game target`),row(`🎱`,`pool 8 ball`,`game`),row(`🎲`,`game die`,`game dice`),row(`🃏`,`joker`,`game cards`),row(`🕹️`,`joystick`,`game`),row(`🎮`,`video game`,`game`),row(`🧩`,`puzzle piece`,`game`),row(`🧸`,`teddy bear`,`toy`),row(`🪅`,`pinata`,`toy party`),row(`🪆`,`nesting dolls`,`toy`),row(`🎭`,`performing arts`,`theatre`),row(`🎼`,`musical score`,`music`),row(`🎤`,`microphone`,`music sing`),row(`🎧`,`headphones`,`music listen`),row(`🎸`,`guitar`,`music`),row(`🥁`,`drum`,`music`),row(`🎨`,`artist palette`,`art paint`),row(`🖌️`,`paintbrush`,`art paint`),row(`🧵`,`thread`,`sew`),row(`🪡`,`sewing needle`,`sew`)],Xr=[row(`🧱`,`brick`,`object build`),row(`🪑`,`shovel`,`object tool`),row(`🪩`,`mirror ball`,`object`),row(`🧯`,`fire extinguisher`,`object safety`),row(`🛠️`,`hammer and wrench`,`tool`),row(`⚒️`,`hammer and pick`,`tool`),row(`🔧`,`wrench`,`tool`),row(`🪛`,`screwdriver`,`tool`),row(`⚙️`,`gear`,`tool cog`),row(`🗜️`,`clamp`,`tool`),row(`🔒`,`locked with key`,`object security`),row(`🔓`,`unlocked`,`object security`),row(`🔑`,`key`,`object`),row(`🗝️`,`old key`,`object`),row(`🔨`,`hammer`,`tool`),row(`🔫`,`water pistol`,`object toy`),row(`🪓`,`carpentry saw`,`tool`),row(`💡`,`light bulb`,`object idea`),row(`🔦`,`flashlight`,`object`),row(`🔬`,`microscope`,`object lab`),row(`🔭`,`telescope`,`object`),row(`💻`,`laptop`,`object computer`),row(`🖥️`,`desktop computer`,`object computer`),row(`🖨️`,`printer`,`object office`),row(`⌨️`,`keyboard`,`object computer`),row(`🖱️`,`computer mouse`,`object computer`),row(`💾`,`floppy disk`,`object`),row(`📚`,`books`,`object reading`),row(`📓`,`notebook`,`object writing`),row(`📊`,`bar chart`,`object data`),row(`📋`,`clipboard`,`object office`),row(`📌`,`pushpin`,`object office`),row(`📎`,`paperclip`,`object office`),row(`📏`,`straight ruler`,`object office`),row(`✂️`,`scissors`,`object office`),row(`🗑️`,`card file box`,`object office`),row(`🗒️`,`file cabinet`,`object office`),row(`🗓️`,`wastebasket`,`object office`),row(`🧼`,`window`,`object house`),row(`🛙`,`elevator`,`object building`),row(`🛝`,`radio`,`object`),row(`🛞`,`video camera`,`object record`),row(`⚯`,`white flag`,`object surrender`)],Zr=[row(`🔠`,`input latin letters`,`symbol text`),row(`🔡`,`lowercase`,`symbol text`),row(`🔢`,`uppercase`,`symbol text`),row(`🅰️`,`A button`,`symbol letter`),row(`🆎`,`AB button`,`symbol letters`),row(`🆑️`,`CL button`,`symbol`),row(`🆒️`,`COOL button`,`symbol`),row(`🆓️`,`FREE button`,`symbol`),row(`🆔️`,`ID button`,`symbol`),row(`🆕️`,`NEW button`,`symbol`),row(`🆖️`,`OK button`,`symbol`),row(`🆗️`,`SOS button`,`symbol`),row(`🆘️`,`VS button`,`symbol`),row(`🆙️`,`UP button`,`symbol`),row(`🔴`,`red circle`,`symbol shape`),row(`🟠`,`orange circle`,`symbol shape`),row(`🟡`,`yellow circle`,`symbol shape`),row(`🟢`,`green circle`,`symbol shape`),row(`🔵`,`blue circle`,`symbol shape`),row(`🟣`,`purple circle`,`symbol shape`),row(`⚪`,`black circle`,`symbol shape`),row(`⚫`,`white circle`,`symbol shape`),row(`🟧`,`red square`,`symbol shape`),row(`🟨`,`yellow square`,`symbol shape`),row(`🟩`,`green square`,`symbol shape`),row(`🟦`,`blue square`,`symbol shape`),row(`🟪`,`purple square`,`symbol shape`),row(`⬛`,`black large square`,`symbol shape`),row(`⬜`,`white large square`,`symbol shape`),row(`🔶`,`large orange diamond`,`symbol shape`),row(`🔷`,`large blue diamond`,`symbol shape`),row(`🔺`,`red triangle pointed up`,`symbol shape`),row(`🔻`,`red triangle pointed down`,`symbol shape`),row(`▶️`,`black right-pointing triangle`,`symbol shape`),row(`◀️`,`black left-pointing triangle`,`symbol shape`),row(`▲️`,`black up-pointing triangle`,`symbol shape`),row(`▼️`,`black down-pointing triangle`,`symbol shape`),row(`❓`,`red question mark`,`symbol`),row(`❗`,`red exclamation mark`,`symbol`),row(`⁉️`,`red exclamation question mark`,`symbol`),row(`💤`,`zzz`,`symbol sleep`),row(`♻`,`recycling symbol`,`symbol green`),row(`☮`,`information`,`symbol info`),row(`⚠️`,`warning`,`symbol caution`),row(`✔️`,`check mark button`,`symbol done yes`),row(`✖️`,`multiply`,`symbol no`),row(`➕`,`plus`,`symbol math`),row(`➖`,`minus`,`symbol math`),row(`➗`,`divide`,`symbol math`),row(`🚫`,`prohibited`,`symbol no`),row(`🚳`,`no bicycles`,`symbol no`),row(`🚭`,`no smoking`,`symbol no`),row(`🚯`,`no littering`,`symbol no`),row(`🚱`,`non-potable water`,`symbol no`),row(`🔞`,`no one under eighteen`,`symbol age`),row(`🏁`,`chequered flag`,`symbol sport`),row(`🚩`,`triangular flag`,`symbol`),row(`🎌`,`crossed flags`,`symbol`),row(`🏴`,`black flag`,`symbol`),row(`🏳️`,`white flag`,`symbol surrender`),row(`🏳‍🌈`,`rainbow flag`,`symbol pride`)],Qr=[row(`🇦🇨`,`flag: Bolivia`,`flag country`),row(`🇧🇷`,`flag: Brazil`,`flag country`),row(`🇩🇪`,`flag: Germany`,`flag country deutschland`),row(`🇫🇷`,`flag: France`,`flag country`),row(`🇮🇳`,`flag: United Kingdom`,`flag country britain uk`),row(`🇯🇵`,`flag: Japan`,`flag country japan`),row(`🇳🇱`,`flag: United States`,`flag country usa`),row(`🇸🇪`,`flag: Sweden`,`flag country`),row(`🇸🇰`,`flag: Denmark`,`flag country`),row(`🇹🇷`,`flag: Turkey`,`flag country`),row(`🇺🇸`,`flag: Spain`,`flag country`)],$r=[{id:`people`,heading:`Smileys & People`,tooltip:`Smileys & People`,entries:Wr},{id:`body`,heading:`Body & Clothing`,tooltip:`Body & Clothing`,entries:Gr},{id:`nature`,heading:`Animals & Nature`,tooltip:`Animals & Nature`,entries:Kr},{id:`food`,heading:`Food & Drink`,tooltip:`Food & Drink`,entries:qr},{id:`travel`,heading:`Travel & Places`,tooltip:`Travel & Places`,entries:Jr},{id:`activities`,heading:`Activities`,tooltip:`Activities`,entries:Yr},{id:`objects`,heading:`Objects`,tooltip:`Objects`,entries:Xr},{id:`symbols`,heading:`Symbols`,tooltip:`Symbols`,entries:Zr},{id:`flags`,heading:`Flags`,tooltip:`Flags`,entries:Qr}];[...$r.map(e=>e.id)];function emojiTooltip(e){return e===`recent`?`Recent`:$r.find(t=>t.id===e)?.tooltip??``}var GtkEmojiChooser=class extends GtkPopover{_built=!1;_entry;_listEl;_emptyEl;_sections=new Map;_entryOf=new WeakMap;_recent=[];_ctrl=!1;connectedCallback(){if(super.connectedCallback(),this._built)return;this._built=!0,this.hasAttribute(`role`)||this.setAttribute(`role`,`listbox`);let e=document.createElement(`div`);e.className=`emoji-picker-root`,e.appendChild(this._buildSearchbar()),this._listEl=document.createElement(`div`),this._listEl.className=`emoji-list`,this._emptyEl=this._buildEmptyPage();let t=document.createElement(`div`);t.className=`emoji-stack`,t.append(this._listEl,this._emptyEl),e.appendChild(t),this.replaceChildren(e);let n=document.createElement(`div`);n.className=`emoji-flowbox emoji-recent-box`,n.dataset.section=`recent`,this._listEl.appendChild(n),this._sections.set(`recent`,{id:`recent`,heading:null,box:n,button:null,empty:!0}),this._buildSections(),this._buildToolbar(e),this._renderRecents(),this._listEl.addEventListener(`scroll`,()=>this._markSection(this._currentSection())),this.addEventListener(`keydown`,e=>this._ctrl=e.ctrlKey),this.addEventListener(`keyup`,e=>this._ctrl=e.ctrlKey),this.subscribe(e=>{e&&(this._entry.value=``,this._filter(),this._listEl.scrollTop=0,this._markSection(`recent`))}),this._markSection(`recent`)}get recentEmoji(){return[...this._recent]}pick(e,t=!1){this._activate(e,null,t)}_buildSearchbar(){let e=document.createElement(`div`);e.className=`emoji-searchbar`;let t=createGtkImage(`edit-find`,`emoji-search-icon`);return this._entry=document.createElement(`input`),this._entry.type=`search`,this._entry.className=`emoji-search-entry`,this._entry.placeholder=`Search emoji`,this._entry.setAttribute(`aria-label`,`Search emoji`),this._entry.addEventListener(`input`,()=>this._filter()),this._entry.addEventListener(`keydown`,e=>{if(e.key===`Enter`){e.preventDefault(),this._activateFirstResult();return}e.ctrlKey&&(e.key===`n`||e.key===`p`)&&(e.preventDefault(),this._scrollSection(e.key===`n`?1:-1))}),e.append(t,this._entry),e}_buildEmptyPage(){let e=document.createElement(`div`);e.className=`emoji-empty`,e.hidden=!0,e.appendChild(createGtkImage(`edit-find`,`emoji-empty-icon`));let t=document.createElement(`div`);t.className=`emoji-empty-title`,t.textContent=`No Results Found`;let n=document.createElement(`div`);return n.className=`emoji-empty-hint`,n.textContent=`Try a different search`,e.append(t,n),e}_buildSections(){for(let e of $r){let t=document.createElement(`div`);t.className=`emoji-heading`,t.textContent=e.heading;let n=document.createElement(`div`);n.className=`emoji-flowbox`,n.dataset.section=e.id;for(let t of e.entries)n.appendChild(this._emojiButton(t));this._listEl.append(t,n),this._sections.set(e.id,{id:e.id,heading:t,box:n,button:null,empty:!0})}}_buildToolbar(e){let t=document.createElement(`div`);t.className=`emoji-toolbar`;let n=[[`recent`,this._sectionButton(`recent`,createGtkImage(`emoji-recent`,`emoji-section-icon`),emojiTooltip(`recent`))],[`people`,this._sectionButton(`people`,createGtkImage(`emoji-people`,`emoji-section-icon`),emojiTooltip(`people`))],[`body`,this._sectionButton(`body`,createGtkImage(`emoji-body`,`emoji-section-icon`),emojiTooltip(`body`))],[`nature`,this._sectionButton(`nature`,createGtkImage(`emoji-nature`,`emoji-section-icon`),emojiTooltip(`nature`))],[`food`,this._sectionButton(`food`,createGtkImage(`emoji-food`,`emoji-section-icon`),emojiTooltip(`food`))],[`travel`,this._sectionButton(`travel`,createGtkImage(`emoji-travel`,`emoji-section-icon`),emojiTooltip(`travel`))],[`activities`,this._sectionButton(`activities`,createGtkImage(`emoji-activities`,`emoji-section-icon`),emojiTooltip(`activities`))],[`objects`,this._sectionButton(`objects`,createGtkImage(`emoji-objects`,`emoji-section-icon`),emojiTooltip(`objects`))],[`symbols`,this._sectionButton(`symbols`,createGtkImage(`emoji-symbols`,`emoji-section-icon`),emojiTooltip(`symbols`))],[`flags`,this._sectionButton(`flags`,createGtkImage(`emoji-flags`,`emoji-section-icon`),emojiTooltip(`flags`))]];for(let[e,t]of n){t.addEventListener(`click`,()=>this._scrollTo(e));let n=this._sections.get(e);n!==void 0&&this._sections.set(e,{...n,button:t})}t.append(...n.map(([,e])=>e)),e.appendChild(t)}_sectionButton(e,t,n){let r=document.createElement(`button`);return r.type=`button`,r.className=`emoji-section`,r.dataset.section=e,r.title=n,r.setAttribute(`aria-label`,n),r.appendChild(t),r}_emojiButton(e){let t=document.createElement(`button`);return t.type=`button`,t.className=`emoji`,t.textContent=e.text,t.title=e.name,t.setAttribute(`aria-label`,e.name),this._entryOf.set(t,e),t.addEventListener(`click`,n=>{if(this._closeVariations(),n.detail>1&&hasVariations(e)){this._showVariations(e,t);return}this._activate(e,t)}),t}_matches(e,t){if(t.length===0)return!0;let n=`${e.name} ${e.keywords.join(` `)}`.toLowerCase().split(/\s+/);return t.every(e=>n.some(t=>t.startsWith(e)))}_filter(){let e=this._entry.value.toLowerCase().split(/\s+/).filter(e=>e.length>0);for(let t of this._sections.values()){let n=0;for(let r of t.box.querySelectorAll(`.emoji`)){let t=this._entryOf.get(r),i=t!==void 0&&this._matches(t,e);r.hidden=!i,i&&(n+=1)}t.empty=n===0,t.heading!==null&&(t.heading.hidden=t.empty),t.id!==`recent`&&(t.box.hidden=t.empty)}let t=[...this._sections.values()].every(e=>e.empty);this._listEl.hidden=t,this._emptyEl.hidden=!t,this._markSection(this._currentSection())}_activate(e,t,n=!1){!n&&t?.parentElement?.dataset.section!==`recent`&&this._remember(e),this.dispatchEvent(new CustomEvent(`emoji-picked`,{bubbles:!0,detail:{text:e.text}})),this._ctrl||this.popdown()}_remember(e){this._recent=[e,...this._recent.filter(t=>t.text!==e.text)].slice(0,21),this._renderRecents()}_renderRecents(){let e=this._sections.get(`recent`);if(e===void 0)return;e.box.replaceChildren(...this._recent.map(e=>this._emojiButton(e)));let t=this._recent.length===0;e.box.hidden=t,e.empty=t,e.button!==null&&(e.button.disabled=t)}_showVariations(e,t){this._closeVariations();let n=document.createElement(`div`);n.className=`emoji-variations`;let r=document.createElement(`div`);r.className=`emoji-variations-row`;let i=[...e.text].filter(e=>!Ur.includes(e)).join(``);for(let t of[i,...Ur.map(e=>i+e)]){let n=document.createElement(`button`);n.type=`button`,n.className=`emoji`,n.textContent=t,n.addEventListener(`click`,r=>{r.stopPropagation(),this._closeVariations(),this._activate({...e,text:t},n)}),r.appendChild(n)}n.appendChild(r),t.insertAdjacentElement(`afterend`,n)}_closeVariations(){for(let e of this.querySelectorAll(`.emoji-variations`))e.remove()}_scrollTo(e){let t=this._sections.get(e);if(t===void 0||t.empty)return;let n=t.heading??t.box;this._listEl.scrollTo({top:n.offsetTop-6,behavior:`smooth`}),this._markSection(e)}_scrollSection(e){let t=[...this._sections.values()].filter(e=>!e.empty);if(t.length===0)return;let n=t.findIndex(e=>e.id===this._currentSection()),r=t[Math.min(Math.max((n<0?0:n)+e,0),t.length-1)];this._scrollTo(r.id)}_activateFirstResult(){for(let e of this._sections.values()){if(e.empty)continue;let t=[...e.box.querySelectorAll(`.emoji`)].find(e=>!e.hidden);if(t!==void 0){this._activate(this._entryOf.get(t)??{text:t.textContent??``,name:``,keywords:[]},t);return}}}_sectionAt(e){let t=`recent`;for(let n of this._sections.values())if(!(n.empty||n.box.hidden)){if(e<(n.heading??n.box).offsetTop-6)break;t=n.id}return t}_currentSection(){return this._sectionAt(this._listEl.scrollTop)}_markSection(e){for(let t of this._sections.values())t.button?.classList.toggle(`checked`,t.id===e)}};customElements.define(`gtk-emoji-chooser`,GtkEmojiChooser);var GtkEntry=class extends HTMLElement{_input;_initialized=!1;_maxLength=0;_announced=``;static signals={changed:`changed`,"notify::text":`notify::text`,activate:`activate`};static get observedAttributes(){return[`value`,`text`,`placeholder-text`,`placeholder`,`width-request`,`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._announceText()):this.setAttribute(`value`,t)}get text(){return this.value}set text(e){this.value=e}_announceText(){let e=this._input.value;e!==this._announced&&(this._announced=e,this.dispatchEvent(new CustomEvent(`changed`,{bubbles:!0})),this.dispatchEvent(new CustomEvent(`notify::text`,{bubbles:!0,detail:{text:e}})))}get maxLength(){return this._maxLength}set maxLength(e){this._maxLength=Number.isFinite(e)?Math.min(it,Math.max(0,Math.trunc(e))):0,this._input&&(this._input.value=clampEntryText(this._input.value,this._maxLength),this._announceText())}get textLength(){return entryTextLength(this.value)}placeholderAttribute(){return this.getAttribute(`placeholder-text`)??this.getAttribute(`placeholder`)??``}applyWidthRequest(){let e=Number(this.getAttribute(`width-request`)??-1);this.style.minWidth=Number.isFinite(e)&&e>0?`${e}px`:``}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.getAttribute(`text`)??``,this._maxLength),e.placeholder=this.placeholderAttribute(),this.applyWidthRequest(),e.disabled=this.hasAttribute(`disabled`),e.addEventListener(`input`,()=>{let t=clampEntryText(e.value,this._maxLength);t!==e.value&&(e.value=t),this._announceText()}),e.addEventListener(`keydown`,t=>{t.key===`Enter`&&this.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0,detail:{value:e.value}}))}),this._input=e,this._announced=e.value,this.replaceChildren(e)}disconnectedCallback(){}attributeChangedCallback(e,t,n){if(e===`maxlength`){this.maxLength=Number(n??0);return}if(e===`width-request`){this.applyWidthRequest();return}this._input&&(e===`value`||e===`text`?(this._input.value=clampEntryText(n??``,this._maxLength),this._announceText()):e===`placeholder-text`||e===`placeholder`?this._input.placeholder=this.placeholderAttribute():e===`type`?this._input.type=n||`text`:e===`disabled`&&(this._input.disabled=n!==null))}};customElements.define(`gtk-entry`,GtkEntry);const ei={left:`start`,right:`end`,center:`center`,fill:`justify`},ti=[`label`,`use-markup`,`use-underline`,`justify`,`xalign`,`yalign`,`wrap`,`wrap-mode`,`ellipsize`,`lines`,`width-chars`,`max-width-chars`,`selectable`];var GtkLabel=class extends HTMLElement{_wrapSpan=null;_resizes=null;_wroteMinWidth=!1;_wroteMaxWidth=!1;static get observedAttributes(){return[...ti]}get label(){return this.getAttribute(`label`)??``}set label(e){this.setAttribute(`label`,e??``)}get useMarkup(){return this.hasAttribute(`use-markup`)}set useMarkup(e){this.toggleAttribute(`use-markup`,!!e)}get useUnderline(){return this.hasAttribute(`use-underline`)}set useUnderline(e){this.toggleAttribute(`use-underline`,!!e)}get justify(){return normalizeLabelJustify(this.getAttribute(`justify`))}set justify(e){this.setAttribute(`justify`,e)}get xalign(){return normalizeLabelXalign$1(this.getAttribute(`xalign`))}set xalign(e){this.setAttribute(`xalign`,String(e))}get yalign(){return normalizeLabelYalign(this.getAttribute(`yalign`))}set yalign(e){this.setAttribute(`yalign`,String(e))}get wrap(){return this.hasAttribute(`wrap`)}set wrap(e){this.toggleAttribute(`wrap`,!!e)}get wrapMode(){return normalizeLabelWrapMode(this.getAttribute(`wrap-mode`))}set wrapMode(e){this.setAttribute(`wrap-mode`,e)}get ellipsize(){return normalizeLabelEllipsize(this.getAttribute(`ellipsize`))}set ellipsize(e){this.setAttribute(`ellipsize`,e)}get lines(){return normalizeLabelLines(this.getAttribute(`lines`))}set lines(e){this.setAttribute(`lines`,String(e))}get widthChars(){return normalizeLabelWidthChars(this.getAttribute(`width-chars`))}set widthChars(e){this.setAttribute(`width-chars`,String(e))}get maxWidthChars(){return normalizeLabelMaxWidthChars(this.getAttribute(`max-width-chars`))}set maxWidthChars(e){this.setAttribute(`max-width-chars`,String(e))}get selectable(){return this.hasAttribute(`selectable`)}set selectable(e){this.toggleAttribute(`selectable`,!!e)}get_label(){return this.label}set_label(e){this.label=e}getText(){return labelDisplayText(this.label,this.useMarkup,this.useUnderline)}connectedCallback(){this._render(),this._resizes=new ResizeObserver(()=>this._remeasure()),this._resizes.observe(this),document.fonts?.ready.then(()=>this._remeasure())}disconnectedCallback(){this._resizes?.disconnect(),this._resizes=null}_remeasure(){if(!this._wrapSpan||!this.isConnected)return;this._wrapSpan.style.width=``;let e=measuredWrapWidth(this._wrapSpan);this._wrapSpan.style.width=e===null?``:`${e}px`}attributeChangedCallback(e,t,n){this._render();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){return e===`label`?t??``:e===`justify`?normalizeLabelJustify(t):e===`xalign`?normalizeLabelXalign$1(t):e===`yalign`?normalizeLabelYalign(t):e===`wrap-mode`?normalizeLabelWrapMode(t):e===`ellipsize`?normalizeLabelEllipsize(t):e===`lines`?normalizeLabelLines(t):e===`width-chars`?normalizeLabelWidthChars(t):e===`max-width-chars`?normalizeLabelMaxWidthChars(t):t!==null}_render(){let e=this.getText(),t=this.wrap,n=this.ellipsize,r=n!==`none`;t||r?this._renderSpan(e,r):this._renderSingleLine(e),this.style.setProperty(`--gtk-label-xalign`,String(this.xalign)),this.style.textAlign=ei[this.justify],this.style.setProperty(`--gtk-label-align-items`,labelYalignAlignItems(this.yalign));let i=labelEllipsizeOverflowValue(n);i===`ellipsis`?this.style.setProperty(`--gtk-label-ellipsize-overflow`,i):this.style.removeProperty(`--gtk-label-ellipsize-overflow`);let a=labelEffectiveLines(this.lines,n);a===null?this.style.removeProperty(`--gtk-label-lines`):this.style.setProperty(`--gtk-label-lines`,String(a));let o=labelWidthCharsExtent(this.widthChars,this.maxWidthChars);o.minCh===null?this._wroteMinWidth&&this.style.removeProperty(`min-width`):this.style.minWidth=`${o.minCh}ch`,o.maxCh===null?this._wroteMaxWidth&&this.style.removeProperty(`max-width`):this.style.maxWidth=`${o.maxCh}ch`,this._wroteMinWidth=o.minCh!==null,this._wroteMaxWidth=o.maxCh!==null}_renderSingleLine(e){this._wrapSpan?.remove(),this._wrapSpan=null,this.textContent!==e&&(this.textContent=e)}_renderSpan(e,t){this._wrapSpan||(this.textContent=``,this._wrapSpan=document.createElement(`span`),this._wrapSpan.className=`adw-label-text`,this.appendChild(this._wrapSpan)),this._wrapSpan.classList.toggle(`adw-label-clamp`,t),this._wrapSpan.textContent!==e&&(this._wrapSpan.textContent=e),this._remeasure()}};function measuredWrapWidth(e){let t=document.createRange();t.selectNodeContents(e);let n=0;for(let e of t.getClientRects())n=Math.max(n,e.width);return n>0?Math.ceil(n):null}customElements.define(`gtk-label`,GtkLabel);let ni=0;var GtkExpander=class extends HTMLElement{_box;_titleEl;_arrowEl;_labelEl;_labelSection;_contentEl;_initialized=!1;static get observedAttributes(){return[`expanded`,`label`,`use-markup`,`use-underline`,`resize-toplevel`]}get expanded(){return this.hasAttribute(`expanded`)}set expanded(e){this.toggleAttribute(`expanded`,!!e)}get label(){return this.labelWidget===null?this.getAttribute(`label`):null}set label(e){e===null?this.removeAttribute(`label`):this.setAttribute(`label`,e)}get useMarkup(){return this.hasAttribute(`use-markup`)}set useMarkup(e){this.toggleAttribute(`use-markup`,!!e)}get useUnderline(){return this.hasAttribute(`use-underline`)}set useUnderline(e){this.toggleAttribute(`use-underline`,!!e)}get resizeToplevel(){return this.hasAttribute(`resize-toplevel`)}set resizeToplevel(e){this.toggleAttribute(`resize-toplevel`,!!e)}get child(){return this._contentEl?.firstElementChild??null}get labelWidget(){return this._labelSection?.firstElementChild??null}connectedCallback(){this._initialized||(this._initialized=!0,this._arrowEl=createGtkImage(`pan-end`,`adw-expander-arrow`),this._labelEl=document.createElement(`gtk-label`),this._labelSection=document.createElement(`div`),this._labelSection.className=`adw-expander-label`,this._titleEl=document.createElement(`div`),this._titleEl.className=`adw-expander-title`,this._titleEl.setAttribute(`role`,`button`),this._titleEl.append(this._arrowEl,this._labelEl,this._labelSection),this._contentEl=document.createElement(`div`),this._contentEl.className=`adw-expander-content`,this._box=document.createElement(`div`),this._box.className=`adw-expander-box`,this._box.append(this._titleEl,this._contentEl),bindSlottedChildren(this,[{name:`label-widget`,into:this._labelSection},{name:`label`,into:this._labelSection},{name:`child`,into:this._contentEl},{into:this._contentEl}]).install(this._box),bindEmptySections(this._labelSection),this._titleEl.addEventListener(`click`,()=>this._activate()),attachRowActivation({row:this._titleEl,activatable:()=>!0}),this._titleEl.addEventListener(`keydown`,this._onKeyDown),this._render())}attributeChangedCallback(e){this._initialized&&(this._render(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._detail(e)}})))}_detail(e){switch(e){case`expanded`:return this.expanded;case`label`:return this.label;case`use-markup`:return this.useMarkup;case`use-underline`:return this.useUnderline;default:return this.resizeToplevel}}_activate(){this.expanded=!this.expanded,this.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0,detail:{expanded:this.expanded}}))}_onKeyDown=e=>{if(!this.useUnderline||!e.altKey||e.ctrlKey||e.metaKey)return;let t=this._mnemonic();t===null||(e.key.length===1?e.key.toUpperCase():``)!==t||(e.preventDefault(),this._activate())};_mnemonic(){let e=[...this.getAttribute(`label`)??``];for(let t=0;t<e.length;t+=1){if(e[t]!==`_`)continue;let n=e[t+1];if(n===void 0)return null;if(t+=1,n!==`_`)return n.toUpperCase()}return null}_render(){this._arrowEl.classList.toggle(`checked`,this.expanded),this.classList.toggle(`expanded`,this.expanded),this._titleEl.setAttribute(`aria-expanded`,String(this.expanded)),this._contentEl.hidden=!this.expanded;let e=this.labelWidget;this._labelEl.hidden=e!==null||this.label===null,e===null&&(this._labelEl.setAttribute(`label`,labelDisplayText(this.label??``,this.useMarkup,this.useUnderline)),this._labelEl.toggleAttribute(`use-markup`,this.useMarkup),this._labelEl.toggleAttribute(`use-underline`,this.useUnderline));let t=this.child;t===null?this._titleEl.removeAttribute(`aria-controls`):this._titleEl.getAttribute(`aria-controls`)===null&&(t.id===``&&(t.id=`gtk-expander-content-${ni++}`),this._titleEl.setAttribute(`aria-controls`,t.id)),this.classList.toggle(`resize-toplevel`,this.resizeToplevel)}};customElements.define(`gtk-expander`,GtkExpander);var GtkFixed=class extends HTMLElement{_resize=null;_mutations=null;connectedCallback(){this._resize=new ResizeObserver(()=>this._size()),this._resize.observe(this),this._mutations=new MutationObserver(()=>{this._observeChildren(),this._size()}),this._mutations.observe(this,{childList:!0}),this._observeChildren(),this._size()}disconnectedCallback(){this._resize?.disconnect(),this._resize=null,this._mutations?.disconnect(),this._mutations=null}put(e,t,n){e.parentNode!==this&&this.append(e),this.move(e,t,n)}move(e,t,n){e.style.left=`${t}px`,e.style.top=`${n}px`}_observeChildren(){if(this._resize!==null)for(let e of this.children)e instanceof HTMLElement&&this._resize.observe(e)}_size(){let e=0,t=0;for(let n of this.children)n instanceof HTMLElement&&(e=Math.max(e,n.offsetLeft+n.offsetWidth),t=Math.max(t,n.offsetTop+n.offsetHeight));let n=`${e}px`,r=`${t}px`;this.style.minWidth!==n&&(this.style.minWidth=n),this.style.minHeight!==r&&(this.style.minHeight=r)}};customElements.define(`gtk-fixed`,GtkFixed);var GtkFlowBoxChild=class extends HTMLElement{_contentsEl;_initialized=!1;connectedCallback(){this._initialized||(this._initialized=!0,this._contentsEl=document.createElement(`div`),this._contentsEl.className=`adw-flow-box-child-contents`,bindSlottedChildren(this,[{into:this._contentsEl}]).install(this._contentsEl),this.setAttribute(`role`,`gridcell`),this.tabIndex=0)}get child(){return this._contentsEl.firstElementChild}get index(){return this.parentElement?[...this.parentElement.children].indexOf(this):-1}get selected(){return this.classList.contains(`selected`)}};customElements.define(`gtk-flow-box-child`,GtkFlowBoxChild);var GtkFlowBox=class extends HTMLElement{_children=[];_selection=[];_anchor=-1;_initialized=!1;static get observedAttributes(){return[`selection-mode`,`activate-on-single-click`,`accept-unpaired-release`,`homogeneous`,`min-children-per-line`,`max-children-per-line`,`row-spacing`,`column-spacing`,`orientation`]}get selectionMode(){return normalizeBoxSelectionMode(this.getAttribute(`selection-mode`))}set selectionMode(e){this.setAttribute(`selection-mode`,e)}get activateOnSingleClick(){return this.getAttribute(`activate-on-single-click`)!==`false`}set activateOnSingleClick(e){this.setAttribute(`activate-on-single-click`,String(!!e))}get acceptUnpairedRelease(){return this.hasAttribute(`accept-unpaired-release`)}set acceptUnpairedRelease(e){this.toggleAttribute(`accept-unpaired-release`,!!e)}get homogeneous(){return this.hasAttribute(`homogeneous`)}set homogeneous(e){this.toggleAttribute(`homogeneous`,!!e)}get minChildrenPerLine(){return count(this.getAttribute(`min-children-per-line`),0)}set minChildrenPerLine(e){this.setAttribute(`min-children-per-line`,String(e))}get maxChildrenPerLine(){return Math.max(1,count(this.getAttribute(`max-children-per-line`),7))}set maxChildrenPerLine(e){this.setAttribute(`max-children-per-line`,String(e))}get rowSpacing(){return count(this.getAttribute(`row-spacing`),0)}set rowSpacing(e){this.setAttribute(`row-spacing`,String(e))}get columnSpacing(){return count(this.getAttribute(`column-spacing`),0)}set columnSpacing(e){this.setAttribute(`column-spacing`,String(e))}get orientation(){return this.getAttribute(`orientation`)===`vertical`?`vertical`:`horizontal`}set orientation(e){this.setAttribute(`orientation`,e)}get cells(){return this._children}get selectedChildren(){return[...this._selection]}set selectedChildren(e){for(let t of typeof e==`number`?[e]:e??[])this.selectChild(this._children[t]??null)}get selectedChildElements(){return this._selection.map(e=>this._children[e]).filter(e=>e!==void 0)}connectedCallback(){this._initialized||(this._initialized=!0,this.addEventListener(`click`,e=>this._onClick(e)),this.addEventListener(`dblclick`,e=>this._onDoubleClick(e)),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),attachRovingFocus({host:this,orientation:()=>this.orientation,items:()=>this._children,step:(e,t,n)=>{let r=t+n;return r<0||r>=e.length?null:r},crossAxis:{orientation:()=>this.orientation===`horizontal`?`vertical`:`horizontal`,step:(e,t,n)=>visualStep(e,t,n,this.orientation)},select:e=>this._updateSelection(e,{})}),new MutationObserver(()=>this._collectChildren()).observe(this,{childList:!0}),this._applyAttributes(),this._collectChildren())}attributeChangedCallback(){this._initialized&&(this._applyAttributes(),this._syncChildren())}selectChild(e){let t=listBoxSelectRow(this._selection,this._anchor,e===null?null:this._children.indexOf(e),this._children.length,this.selectionMode);same$1(t.selection,this._selection)&&t.anchor===this._anchor||(this._selection=t.selection,this._anchor=t.anchor,this._emitSelection(e))}unselectChild(e){let t=listBoxUnselectRow(this._selection,this._anchor,this._children.indexOf(e),this._children.length,this.selectionMode);same$1(t.selection,this._selection)||(this._selection=t.selection,this._emitSelection(null))}selectAll(){let e=listBoxSelectAll(this._children.length,this.selectionMode);e!==null&&(this._selection=e,this._anchor=e.length>0?e[0]:-1,this._emitSelection(this.selectedChildElements[0]??null))}unselectAll(){listBoxUnselectAll(this._selection,this.selectionMode)!==null&&(this._selection=[],this._anchor=-1,this._emitSelection(null))}_applyAttributes(){this.classList.toggle(`homogeneous`,this.homogeneous),this.classList.toggle(`vertical`,this.orientation===`vertical`),this.style.setProperty(`--adw-flow-box-row-spacing`,`${this.rowSpacing}px`),this.style.setProperty(`--adw-flow-box-column-spacing`,`${this.columnSpacing}px`),this.style.setProperty(`--adw-flow-box-max-children-per-line`,String(this.maxChildrenPerLine)),this.minChildrenPerLine>0?this.style.setProperty(`--adw-flow-box-min-children-per-line`,String(this.minChildrenPerLine)):this.style.removeProperty(`--adw-flow-box-min-children-per-line`);let e=this.selectionMode!==`none`;this.setAttribute(`role`,`grid`),this.selectionMode===`multiple`?this.setAttribute(`aria-multiselectable`,`true`):this.removeAttribute(`aria-multiselectable`),e?this.removeAttribute(`aria-readonly`):this.setAttribute(`aria-readonly`,`true`)}_collectChildren(){let e=[...this.querySelectorAll(`:scope > gtk-flow-box-child`)];e.length===this._children.length&&e.every((e,t)=>e===this._children[t])||(this._children=e,this._selection=this._selection.filter(e=>e<this._children.length),this._anchor>=this._children.length&&(this._anchor=-1),this._syncChildren())}_syncChildren(){let e=this.selectionMode!==`none`,t=new Set(this._selection);this._children.forEach((n,r)=>{let i=t.has(r);n.classList.toggle(`selected`,i),n.classList.toggle(`activatable`,e),e?n.setAttribute(`aria-selected`,String(i)):n.removeAttribute(`aria-selected`)})}_onClick(e){let t=this._childAt(e.target);t===null&&!this.acceptUnpairedRelease||(t!==null&&this._updateSelection(t,{modify:e.ctrlKey||e.metaKey,extend:e.shiftKey}),!(e.detail<(this.activateOnSingleClick?1:2))&&t!==null&&this._activate(t))}_onDoubleClick(e){if(this.activateOnSingleClick)return;let t=this._childAt(e.target);t!==null&&this._activate(t)}_onKeyDown(e){if(!e.ctrlKey||e.altKey||e.metaKey||e.key!==` `)return;let t=this._childAt(e.target);t!==null&&(e.preventDefault(),this._updateSelection(t,{modify:!0}))}_childAt(e){if(!(e instanceof Element))return null;let t=e.closest(`gtk-flow-box-child`);return this.contains(t)?t:null}_updateSelection(e,t){let n=listBoxSelect(this._selection,this._anchor,this._children.indexOf(e),this._children.length,this.selectionMode,t);same$1(n.selection,this._selection)||(this._selection=n.selection,this._anchor=n.anchor,this._emitSelection(n.selection.includes(this._children.indexOf(e))?e:null))}_activate(e){this.dispatchEvent(new CustomEvent(`child-activated`,{bubbles:!0,detail:{child:e}})),e.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0}))}_emitSelection(e){this._syncChildren(),this.dispatchEvent(new CustomEvent(`selected-children-changed`,{bubbles:!0})),this.dispatchEvent(new CustomEvent(`child-selected`,{bubbles:!0,detail:{child:e}})),this.dispatchEvent(new CustomEvent(`notify::selected-children`,{bubbles:!0,detail:{selectedChildren:[...this._selection]}}))}};const visualStep=(e,t,n,r)=>{if(e.length<2)return null;let i=r===`vertical`,alongLine=e=>i?e.offsetLeft:e.offsetTop,acrossLine=e=>i?e.offsetTop:e.offsetLeft,a=e[t],o=alongLine(a),s=acrossLine(a),c=n>0?o+1:o-1,l=null,u=1/0;for(let t=0;t<e.length;t++){let n=e[t];if(alongLine(n)!==c)continue;let r=Math.abs(acrossLine(n)-s);(l===null||r<u)&&(l=t,u=r)}if(l!==null)return l;let d=t+n;return d<0||d>=e.length?null:alongLine(e[d])===o?d:null};function same$1(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}__name(same$1,`same`);function count(e,t){let n=Number.parseInt(e??``,10);return Number.isFinite(n)&&n>=0?n:t}customElements.define(`gtk-flow-box`,GtkFlowBox);const ri={family:`Sans`,slant:`normal`,weight:400,width:`normal`,size:12,absolute:!1},ii=[{word:`Thin`,set:{weight:100}},{word:`UltraLight`,set:{weight:200}},{word:`Light`,set:{weight:300}},{word:`SemiLight`,set:{weight:350}},{word:`Book`,set:{weight:375}},{word:`Medium`,set:{weight:500}},{word:`SemiBold`,set:{weight:600}},{word:`Bold`,set:{weight:700}},{word:`UltraBold`,set:{weight:800}},{word:`Heavy`,set:{weight:900}},{word:`Black`,set:{weight:1e3}},{word:`Italic`,set:{slant:`italic`}},{word:`Oblique`,set:{slant:`oblique`}},{word:`Condensed`,set:{width:`condensed`}},{word:`Expanded`,set:{width:`expanded`}}];function parseFontDescription(e){let t={...ri,family:``},n=e.trim().split(/\s+/).filter(e=>e!==``);for(let e=n.length;e>0;e--){let r=/^(-?\d+(?:\.\d+)?)(px)?$/.exec(n[e-1]);if(r!==null){t.size=Number(r[1]),t.absolute=r[2]===`px`,n.length=e-1;break}}let r=[];for(let e of n){let n=ii.find(t=>t.word.toLowerCase()===e.toLowerCase());if(n===void 0){r.push(e);continue}Object.assign(t,n.set)}return t.family=r.join(` `),t}function formatFontDescription(e){let t=[];for(let{word:n,set:r}of ii)Object.entries(r).every(([t,n])=>e[t]===n)&&!t.includes(n)&&t.push(n);let n=`${e.size}${e.absolute?`px`:``}`;return[e.family,...t,n].filter(e=>e!==``).join(` `)}function fontDescriptionEqual(e,t){return e.family===t.family&&e.slant===t.slant&&e.weight===t.weight&&e.width===t.width&&e.size===t.size&&e.absolute===t.absolute}function formatFontSize(e,t){return`${Number(e.toPrecision(4))}${t?`px`:``}`}function cssFontParts(e,t){return{fontFamily:e.family===``?`sans-serif`:`"${e.family}"`,fontWeight:String(e.weight),fontStyle:e.slant,fontStretch:e.width,fontSize:t?`${e.size}${e.absolute?`px`:`pt`}`:``}}function cssFontShorthand(e,t){let n=cssFontParts(e,t),r=[];return n.fontStyle!==`normal`&&r.push(n.fontStyle),n.fontWeight!==`400`&&r.push(n.fontWeight),n.fontStretch!==`normal`&&r.push(n.fontStretch),n.fontSize!==``&&r.push(n.fontSize),r.length>0&&r.push(``),`${r.join(` `)}${n.fontFamily}`.trim()}function cssFontFeatureTags(e){return e.split(`,`).map(e=>e.trim()).filter(e=>e!==``).map(e=>`"${e}"`)}var GtkSeparator=class extends HTMLElement{static get observedAttributes(){return[`orientation`]}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this.setAttribute(`orientation`,e)}connectedCallback(){this.setAttribute(`role`,`separator`),this._render()}attributeChangedCallback(){this.isConnected&&this._render()}_render(){let e=this.orientation;this.classList.toggle(`horizontal`,e===`horizontal`),this.classList.toggle(`vertical`,e===`vertical`),this.setAttribute(`aria-orientation`,e)}};customElements.define(`gtk-separator`,GtkSeparator);const ai=[`family`,`face`,`font`,`features`],oi=[{weight:400,slant:`normal`},{weight:700,slant:`normal`},{weight:400,slant:`italic`},{weight:700,slant:`italic`}];var GtkFontDialogButton=class extends HTMLElement{_buttonEl;_labelEl;_sizeBoxEl;_sizeLabelEl;_dockEl;_selectEl;_desc={...ri};_dialog=null;_features=``;_language=null;_pending=!1;_initialized=!1;static get observedAttributes(){return[`font-desc`,`font-features`,`language`,`level`,`use-font`,`use-size`,`dialog`,`disabled`]}get fontDesc(){return{...this._desc}}set fontDesc(e){let t=typeof e==`string`?parseFontDescription(e):e;fontDescriptionEqual(t,this._desc)||(this._desc={...t},this._render(),this.dispatchEvent(new CustomEvent(`notify::font-desc`,{bubbles:!0,detail:{fontDesc:this.fontDesc}})))}get fontFeatures(){return this._features}set fontFeatures(e){this._features!==e&&(this._features=e,this._render(),this.dispatchEvent(new CustomEvent(`notify::font-features`,{bubbles:!0,detail:{value:e}})))}get language(){return this._language}set language(e){this._language!==e&&(this._language=e,this._render(),this.dispatchEvent(new CustomEvent(`notify::language`,{bubbles:!0,detail:{value:e}})))}get level(){let e=this.getAttribute(`level`);return ai.find(t=>t===e)??`font`}set level(e){this.setAttribute(`level`,e)}get useFont(){return this.hasAttribute(`use-font`)}set useFont(e){this.toggleAttribute(`use-font`,!!e)}get useSize(){return this.hasAttribute(`use-size`)}set useSize(e){this.toggleAttribute(`use-size`,!!e)}get dialog(){return this._dialog}set dialog(e){this._dialog!==e&&(this._dialog=e,this._renderSensitivity(),this.dispatchEvent(new CustomEvent(`notify::dialog`,{bubbles:!0,detail:{dialog:e}})))}connectedCallback(){if(this._initialized)return;this._initialized=!0,this.setAttribute(`role`,`group`),this._labelEl=document.createElement(`span`),this._labelEl.className=`font-button-label`,this._sizeLabelEl=document.createElement(`span`),this._sizeLabelEl.className=`font-button-size-label`;let e=document.createElement(`gtk-separator`);e.setAttribute(`orientation`,`vertical`),this._sizeBoxEl=document.createElement(`span`),this._sizeBoxEl.className=`font-button-size`,this._sizeBoxEl.append(e,this._sizeLabelEl),this._buttonEl=document.createElement(`button`),this._buttonEl.type=`button`,this._buttonEl.className=`adw-button font`,this._buttonEl.setAttribute(`aria-haspopup`,`dialog`),this._buttonEl.append(this._labelEl,this._sizeBoxEl),this._selectEl=document.createElement(`select`),this._selectEl.className=`font-button-chooser`,this._selectEl.addEventListener(`change`,()=>this._choose()),this._dockEl=document.createElement(`gtk-popover`),this._dockEl.classList.add(`font-button-popover`),this._dockEl.replaceChildren(this._selectEl),this._dockEl.anchor=this._buttonEl,this.replaceChildren(this._buttonEl,this._dockEl),this._buttonEl.addEventListener(`click`,()=>this.activate()),this._dockEl.subscribe(e=>{e||(this._pending=!1),this._renderSensitivity()}),this.hasAttribute(`dialog`)&&(this.dialog={});for(let e of[`font-desc`,`font-features`,`language`]){let t=this.getAttribute(e);t!==null&&(e===`font-desc`?this.fontDesc=t:e===`font-features`?this.fontFeatures=t:this.language=t)}this._render()}attributeChangedCallback(e){if(this._initialized)switch(e){case`font-desc`:{let e=this.getAttribute(`font-desc`);e!==null&&(this.fontDesc=e);return}case`font-features`:this.fontFeatures=this.getAttribute(`font-features`)??``;return;case`language`:this.language=this.getAttribute(`language`);return;case`dialog`:this.dialog=this.hasAttribute(`dialog`)?this._dialog??{}:null;return;case`disabled`:this._renderSensitivity();return;default:this._render()}}activate(){this.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0})),this._openChooser()}_openChooser(){this._dialog===null||this._pending||(this._pending=!0,this._renderSensitivity(),this._selectEl.replaceChildren(...this._options()),this._dockEl.popup())}_options(){let e=new Set;for(let t of document.fonts)t.family&&e.add(t.family);this._desc.family!==``&&e.add(this._desc.family);let t=[],n=new Set,add=e=>{let r=formatFontDescription(e);if(n.has(r))return;n.add(r);let i=document.createElement(`option`);i.value=r,i.textContent=r,t.push(i)};add(this._desc);for(let t of[...e].sort())for(let{weight:e,slant:n}of oi){let r={...this._desc,family:t,weight:e,slant:n};document.fonts.check(cssFontShorthand(r,!0))&&add(r)}return t}_choose(){let e=parseFontDescription(this._selectEl.value),t=this.level;t===`family`?this.fontDesc={...ri,family:e.family}:t===`face`?this.fontDesc={...e,size:this._desc.size,absolute:this._desc.absolute}:this.fontDesc=e,this._pending=!1,this._dockEl.popdown(),this._renderSensitivity()}_renderSensitivity(){let e=this._dialog!==null&&!this.hasAttribute(`disabled`);this._buttonEl.disabled=!e,this._buttonEl.classList.toggle(`disabled`,!e)}_render(){if(!this._initialized)return;let e=this.level,t=this._faceName(),n=[this._desc.family===``?`None`:this._desc.family];e!==`family`&&t!==``&&n.push(t),this._labelEl.textContent=n.join(` `),this._sizeBoxEl.hidden=e===`family`||e===`face`,this._sizeBoxEl.hidden||(this._sizeLabelEl.textContent=formatFontSize(this._desc.size,this._desc.absolute));let r=this._labelEl.style;if(this.useFont){let e=cssFontParts(this._desc,this.useSize);r.fontFamily=e.fontFamily,r.fontWeight=e.fontWeight,r.fontStyle=e.fontStyle,r.fontStretch=e.fontStretch,r.fontSize=e.fontSize,r.fontFeatureSettings=``;for(let e of cssFontFeatureTags(this._features))if(r.fontFeatureSettings=e,r.fontFeatureSettings!==``)break;this._labelEl.lang=this._language??this._dialog?.language??``}else r.fontFamily=``,r.fontWeight=``,r.fontStyle=``,r.fontStretch=``,r.fontSize=``,r.fontFeatureSettings=``,this._labelEl.lang=``;this._renderSensitivity()}_faceName(){let e=cssFontShorthand(this._desc,!0);if(this._desc.family===``||!document.fonts.check(e))return``;let t=[];return this._desc.slant===`italic`?t.push(`Italic`):this._desc.slant===`oblique`&&t.push(`Oblique`),this._desc.weight!==400&&t.push(this._desc.weight>=700?`Bold`:`Light`),this._desc.width===`condensed`?t.push(`Condensed`):this._desc.width===`expanded`&&t.push(`Expanded`),t.join(` `)}};customElements.define(`gtk-font-dialog-button`,GtkFontDialogButton);function normalizeLabelXalign(e){let t=Number.parseFloat(e??``);return Number.isFinite(t)?glibClamp(t,0,1):0}var GtkFrame=class extends HTMLElement{_mutations=null;static get observedAttributes(){return[`label`,`label-xalign`]}_labelEl=null;_writingLabel=!1;get label(){return this.getAttribute(`label`)}set label(e){e===null?this.removeAttribute(`label`):this.setAttribute(`label`,e)}get labelXalign(){return normalizeLabelXalign(this.getAttribute(`label-xalign`))}set labelXalign(e){this.setAttribute(`label-xalign`,String(e))}get labelWidget(){let e=this.querySelector(`[slot="label-widget"]`);return e===null?this._labelEl?.parentNode===this?this._labelEl:null:e}set labelWidget(e){let t=this.querySelector(`[slot="label-widget"]`);t!==null&&(t.removeAttribute(`slot`),t.remove()),e!==null&&(e.setAttribute(`slot`,`label-widget`),this.prepend(e),this._sync())}connectedCallback(){bindSlottedChildren(this,[{name:`child`,into:this},{name:`label-widget`,into:this}]),this._mutations=new MutationObserver(()=>this._sync()),this._mutations.observe(this,{childList:!0}),this.setAttribute(`role`,`group`),this._sync()}disconnectedCallback(){this._mutations?.disconnect(),this._mutations=null}attributeChangedCallback(e,t,n){if(this._sync(),!this.isConnected)return;let r=e===`label-xalign`?String(normalizeLabelXalign(n)):n;r!==(e===`label-xalign`?String(normalizeLabelXalign(t)):t)&&this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:r}}))}_sync(){let e=this.querySelector(`[slot="label-widget"]`),t=this.getAttribute(`label`);e===null&&t!==null?(this._labelEl===null&&(this._labelEl=document.createElement(`gtk-label`),this._labelEl.addEventListener(`notify::label`,e=>{this._writingLabel&&e.stopPropagation()})),this._writingLabel=!0,this._labelEl.setAttribute(`label`,t),this._writingLabel=!1,this._labelEl.parentNode!==this&&this.prepend(this._labelEl)):this._labelEl?.parentNode===this&&this._labelEl.remove();let n=this.labelWidget;n!==null&&(n.classList.add(`adw-frame-label`),n.style.alignSelf=labelYalignAlignItems(this.labelXalign))}};customElements.define(`gtk-frame`,GtkFrame);const U=[`gl`,`gles`];function parseApis(e){let t=e.getAttribute(`allowed-apis`);if(t===null)return[...U];let n=t.split(/[\s,|]+/).filter(e=>U.includes(e));return U.filter(e=>n.includes(e))}function booleanAttribute$1(e,t,n){let r=e.getAttribute(t);return r===null?n:r!==`false`&&r!==`0`}__name(booleanAttribute$1,`booleanAttribute`);var GtkGLArea=class extends HTMLElement{_canvas;_messageEl=null;_initialized=!1;_context=null;_error=null;_needsResize=!1;_allowedApis=[...U];_needsRender=!0;_haveBuffers=!1;_width=0;_height=0;_scale=1;_resize=null;_frame=null;static get observedAttributes(){return[`auto-render`,`has-depth-buffer`,`has-stencil-buffer`,`allowed-apis`]}get autoRender(){return booleanAttribute$1(this,`auto-render`,!0)}set autoRender(e){this.autoRender!==!!e&&this._write(`auto-render`,String(!!e))}get hasDepthBuffer(){return booleanAttribute$1(this,`has-depth-buffer`,!1)}set hasDepthBuffer(e){this.hasDepthBuffer!==!!e&&this._write(`has-depth-buffer`,String(!!e))}get hasStencilBuffer(){return booleanAttribute$1(this,`has-stencil-buffer`,!1)}set hasStencilBuffer(e){this.hasStencilBuffer!==!!e&&this._write(`has-stencil-buffer`,String(!!e))}get allowedApis(){return[...this._allowedApis]}set allowedApis(e){if(this._context!==null){this._write(`allowed-apis`,this._allowedApis.join(` `));return}this._allowedApis=U.filter(t=>e.includes(t)),this._write(`allowed-apis`,this._allowedApis.join(` `))}_write(e,t){this.getAttribute(e)!==t&&this.setAttribute(e,t)}get api(){return this._context===null?`gl`:`gles`}get context(){return this._context}get error(){return this._error}setError(e){let t=e===null?null:typeof e==`string`?e:e.message;this._error!==t&&(this._error=t,this._renderMessage(),this._queueDraw())}makeCurrent(){return this._context}queueRender(){this._needsRender=!0,this._queueDraw()}connectedCallback(){if(this._initialized){this._observe();return}this._initialized=!0,this.hasAttribute(`allowed-apis`)&&(this._allowedApis=parseApis(this)),this._canvas=document.createElement(`canvas`),this._canvas.className=`adw-gl-area-canvas`,this.replaceChildren(this._canvas),this._observe()}disconnectedCallback(){this._resize?.disconnect(),this._resize=null,this._frame!==null&&cancelAnimationFrame(this._frame),this._frame=null}_queueDraw(){!this._initialized||this._frame!==null||(this._frame=requestAnimationFrame(()=>{this._frame=null,this._draw()}))}attributeChangedCallback(e){if(this._initialized){switch(e){case`auto-render`:this.autoRender&&this._queueDraw();break;case`has-depth-buffer`:case`has-stencil-buffer`:this._haveBuffers=!1;break;case`allowed-apis`:if(this._context!==null){this._write(`allowed-apis`,this._allowedApis.join(` `));return}this._allowedApis=parseApis(this);break;default:break}this._notify(e)}}_notify(e){let t=e===`allowed-apis`?this.allowedApis.join(` `):e===`auto-render`?this.autoRender:e===`has-depth-buffer`?this.hasDepthBuffer:this.hasStencilBuffer;this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:t}}))}_observe(){this._resize||(this._resize=new ResizeObserver(e=>{for(let t of e){let e=t.borderBoxSize?.[0],n=e?e.inlineSize:t.contentRect.width,r=e?e.blockSize:t.contentRect.height;n===this._width&&r===this._height||(this._width=n,this._height=r,this._needsResize=!0,this._queueDraw())}}),this._resize.observe(this))}_draw(){if(!this._canvas)return;let e=typeof globalThis>`u`?1:globalThis.devicePixelRatio||1;this._scale=e;let t=Math.round(this._width*e),n=Math.round(this._height*e);if(t===0||n===0)return;if(this._error!==null){this._renderMessage();return}let r=this._context??this._createContext();r!==null&&(this.makeCurrent(),this.attachBuffers(r),this.hasDepthBuffer?r.enable?.(r.DEPTH_TEST):r.disable?.(r.DEPTH_TEST),(this._needsRender||this.autoRender)&&(this._needsResize&&(this._needsResize=!1,this.dispatchEvent(new CustomEvent(`resize`,{bubbles:!0,detail:{width:t,height:n}}))),this.dispatchEvent(new CustomEvent(`render`,{bubbles:!0,detail:{context:r}}))),this._needsRender=!1)}attachBuffers(e=this._context){e!==null&&(this.hasStencilBuffer?e.enable?.(e.STENCIL_TEST):e.disable?.(e.STENCIL_TEST),this._haveBuffers=!0)}_createContext(){let e=this.allowedApis;if(e.length===0)return null;let t={context:null};if(this.dispatchEvent(new CustomEvent(`create-context`,{bubbles:!0,detail:t})),t.context!==null)return this._context=t.context,this._context;let n={preserveDrawingBuffer:!0,depth:this.hasDepthBuffer,stencil:this.hasStencilBuffer},r=e.includes(`gles`)?[`webgl2`,`webgl`]:[`webgl`];for(let e of r){let t=this._canvas.getContext(e,n);if(t!==null)return this._context=t,t}return null}_renderMessage(){if(this._error===null){this._messageEl?.remove(),this._messageEl=null;return}this._messageEl||(this._messageEl=document.createElement(`div`),this._messageEl.className=`adw-gl-area-error`,this.append(this._messageEl)),this._messageEl.textContent=this._error}get viewport(){return{width:Math.round(this._width*this._scale),height:Math.round(this._height*this._scale)}}get pixelScale(){return this._scale}};customElements.define(`gtk-gl-area`,GtkGLArea);function booleanAttribute(e,t,n){let r=e.getAttribute(t);return r===null?n:r!==`false`&&r!==`0`}var GtkGraphicsOffload=class extends HTMLElement{_childEl;_initialized=!1;static get observedAttributes(){return[`enabled`,`black-background`]}get child(){return this._childEl?.firstElementChild??null}get enabled(){return this.getAttribute(`enabled`)===`disabled`?`disabled`:`enabled`}set enabled(e){this.enabled!==e&&this.setAttribute(`enabled`,e)}get blackBackground(){return booleanAttribute(this,`black-background`,!1)}set blackBackground(e){this.blackBackground!==!!e&&this.setAttribute(`black-background`,String(!!e))}connectedCallback(){this._initialized||(this._initialized=!0,this._childEl=document.createElement(`div`),this._childEl.className=`adw-graphics-offload-child`,bindSlottedChildren(this,[{into:this._childEl}]).install(this._childEl),this.replaceChildren(this._childEl),this._render())}attributeChangedCallback(e){this._initialized&&((e===`enabled`||e===`black-background`)&&this._render(),this._notify(e))}_render(){let e=this.enabled!==`disabled`;this.style.willChange=e?`transform`:``,this.style.backgroundColor=this.blackBackground?`#000000`:``}_notify(e){let t=e===`enabled`?this.enabled:this.blackBackground;this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:t}}))}};customElements.define(`gtk-graphics-offload`,GtkGraphicsOffload);var GtkGrid=class extends HTMLElement{static get observedAttributes(){return[`column-spacing`,`row-spacing`,`column-homogeneous`,`row-homogeneous`,`orientation`]}get columnSpacing(){return normalizeBoxSpacing(this.getAttribute(`column-spacing`))}set columnSpacing(e){this.setAttribute(`column-spacing`,String(e))}get rowSpacing(){return normalizeBoxSpacing(this.getAttribute(`row-spacing`))}set rowSpacing(e){this.setAttribute(`row-spacing`,String(e))}get columnHomogeneous(){return this.hasAttribute(`column-homogeneous`)}set columnHomogeneous(e){this.toggleAttribute(`column-homogeneous`,!!e)}get rowHomogeneous(){return this.hasAttribute(`row-homogeneous`)}set rowHomogeneous(e){this.toggleAttribute(`row-homogeneous`,!!e)}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this.setAttribute(`orientation`,e)}connectedCallback(){this.setAttribute(`role`,`generic`),this._sync()}attributeChangedCallback(e,t,n){if(this._sync(),!this.isConnected)return;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){return e===`column-spacing`||e===`row-spacing`?normalizeBoxSpacing(t):e===`orientation`?normalizeBoxOrientation(t):t!==null}_sync(){this.style.rowGap=`${this.rowSpacing}px`,this.style.columnGap=`${this.columnSpacing}px`,this.style.gridAutoRows=this.rowHomogeneous?`1fr`:``,this.style.gridAutoColumns=this.columnHomogeneous?`1fr`:``,this.style.gridAutoFlow=this.orientation===`vertical`?`row`:`column`}};customElements.define(`gtk-grid`,GtkGrid);function cssPixels(e,t){let n=Number.parseFloat(e);return Number.isFinite(n)?n:t}var GtkGridView=class extends GtkListView{_observer=null;static get observedAttributes(){return[`model`,`selection-mode`,`single-click-activate`,`enable-rubberband`,`tab-behavior`,`orientation`,`min-columns`,`max-columns`]}get minColumns(){return this._columnBound(`min-columns`,1)}set minColumns(e){this.setAttribute(`min-columns`,String(e))}get maxColumns(){return this._columnBound(`max-columns`,7)}set maxColumns(e){this.setAttribute(`max-columns`,String(e))}connectedCallback(){super.connectedCallback(),this._observer===null&&(this._observer=new ResizeObserver(()=>this._applyColumns()),this._observer.observe(this),this._applyColumns())}disconnectedCallback(){this._observer?.disconnect(),this._observer=null}attributeChangedCallback(e){super.attributeChangedCallback(e),this._applyColumns()}get _viewClass(){return`adw-grid-view`}get _rowClass(){return`adw-grid-view-child`}_renderRows(){super._renderRows(),this._applyColumns()}_columnBound(e,t){let n=Number.parseInt(this.getAttribute(e)??``,10);return Number.isFinite(n)&&n>=1?n:t}_applyColumns(){let e=this._rows[0];if(e===void 0)return;let t=cssPixels(globalThis.getComputedStyle(e).minWidth,120),n=cssPixels(globalThis.getComputedStyle(this._listEl).columnGap,6),r=gridViewColumns(Math.round(this.getBoundingClientRect().width),t,n,this.minColumns,this.maxColumns);this._listEl.style.gridTemplateColumns=`repeat(${r}, 1fr)`}};customElements.define(`gtk-grid-view`,GtkGridView);var GtkHeaderBar=class extends HTMLElement{_initialized=!1;_handle;_box;_startBox;_endBox;_startControls=null;_endControls=null;_titleLabel=null;_centre=null;_centreObserver=null;static get observedAttributes(){return[`decoration-layout`,`show-title-buttons`]}get decorationLayout(){return this.getAttribute(`decoration-layout`)}set decorationLayout(e){e===null?this.removeAttribute(`decoration-layout`):this._write(`decoration-layout`,e)}get showTitleButtons(){return this.getAttribute(`show-title-buttons`)!==`false`}set showTitleButtons(e){this._write(`show-title-buttons`,String(e))}get titleWidget(){return this._centre}_write(e,t){this.getAttribute(e)!==t&&this.setAttribute(e,t)}connectedCallback(){if(this._initialized){this._followCentre();return}this._initialized=!0,this.setAttribute(`role`,`group`),this._startBox=document.createElement(`div`),this._startBox.className=`adw-gtk-header-bar-start`,this._endBox=document.createElement(`div`),this._endBox.className=`adw-gtk-header-bar-end`,this._box=document.createElement(`div`),this._box.className=`adw-gtk-header-bar-box`,this._box.append(this._startBox,this._endBox),this._handle=document.createElement(`div`),this._handle.className=`adw-gtk-header-bar-handle`,this._handle.appendChild(this._box),this._renderTitleButtons(),bindSlottedChildren(this,[{name:`start`,into:this._startBox},{name:`title`,into:this._box},{name:`title-widget`,into:this._box},{name:`end`,consume:e=>this._endBox.prepend(e)},{into:this._startBox}]).install(this._handle),this._followCentre()}disconnectedCallback(){this._centreObserver?.disconnect(),this._centreObserver=null}attributeChangedCallback(e){this._initialized&&(e===`show-title-buttons`?this._renderTitleButtons():this._bindDecorationLayout(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}})))}_property(e){return e===`show-title-buttons`?this.showTitleButtons:this.decorationLayout}_renderTitleButtons(){if(!this.showTitleButtons){this._startControls?.remove(),this._endControls?.remove(),this._startControls=null,this._endControls=null;return}this._startControls===null&&(this._startControls=document.createElement(`gtk-window-controls`),this._startControls.setAttribute(`side`,`start`),this._startBox.prepend(this._startControls),this._endControls=document.createElement(`gtk-window-controls`),this._endControls.setAttribute(`side`,`end`),this._endBox.appendChild(this._endControls)),this._bindDecorationLayout()}_bindDecorationLayout(){for(let e of[this._startControls,this._endControls]){if(e===null)continue;let t=this.decorationLayout;t===null?e.removeAttribute(`decoration-layout`):e.setAttribute(`decoration-layout`,t)}}_followCentre(){this._centreObserver?.disconnect(),this._centreObserver=new MutationObserver(()=>this._syncCentre()),this._centreObserver.observe(this._box,{childList:!0});let e=this.closest(`gtk-window, adw-window`);e!==null&&this._centreObserver.observe(e,{attributes:!0,attributeFilter:[`title`]}),this._syncCentre()}_centreChild(){for(let e of this._box.children)if(!(e===this._startBox||e===this._endBox||e===this._titleLabel)&&e instanceof HTMLElement)return e;return null}_syncCentre(){this._centre=this._centreChild(),this._centre===null?this._titleLabel===null?this._constructTitleLabel():this._updateTitle():this._dropTitleLabel()}_constructTitleLabel(){let e=document.createElement(`gtk-label`);e.className=`title adw-gtk-header-bar-title`,this._titleLabel=e,this._box.appendChild(e),this._updateTitle()}_dropTitleLabel(){this._titleLabel?.remove(),this._titleLabel=null}_updateTitle(){let e=this._titleLabel;if(e===null)return;let t=this.closest(`gtk-window, adw-window`)?.getAttribute(`title`)??document.title;t===``?e.removeAttribute(`label`):e.setAttribute(`label`,t)}};customElements.define(`gtk-header-bar`,GtkHeaderBar);var GtkLinkButton=class extends GtkButton{_wired=!1;static get observedAttributes(){return[...GtkButton.observedAttributes,`uri`,`visited`]}get uri(){return this.getAttribute(`uri`)??``}set uri(e){this.setAttribute(`uri`,e)}get visited(){return this.hasAttribute(`visited`)}set visited(e){this.toggleAttribute(`visited`,!!e)}connectedCallback(){super.connectedCallback(),!this._wired&&(this._wired=!0,this.button.addEventListener(`click`,()=>this._activateLink()))}attributeChangedCallback(e){e===`uri`&&this.isConnected&&(this.visited=!1),super.attributeChangedCallback(),e===`visited`&&this.isConnected&&this.dispatchEvent(new CustomEvent(`notify::visited`,{bubbles:!0,detail:{visited:this.visited}}))}_activateLink(){let e=new CustomEvent(`activate-link`,{bubbles:!0,cancelable:!0});if(this.dispatchEvent(e),e.defaultPrevented)return;let{uri:t}=this;t!==``&&(this.launch(t),this.visited=!0)}launch(e){globalThis.open(e,`_blank`,`noopener`)}decorate(e){e.classList.add(`link`),e.classList.toggle(`visited`,this.visited);let t=(this.getAttribute(`label`)??``).trim();(this.getAttribute(`tooltip`)??this.getAttribute(`tooltip-text`))===null&&t!==``&&this.uri!==``&&this.uri!==t&&(e.title=this.uri)}};customElements.define(`gtk-link-button`,GtkLinkButton);const si=[`clip`,`ellipsize-start`,`ellipsize-middle`,`ellipsize-end`];function normalizeInscriptionOverflow(e){return si.includes(e)?e:`clip`}function normalizeInscriptionWrapMode(e){return Mt.includes(e)?e:`word-char`}function normalizeAlignment(e,t){let n=typeof e==`number`?e:Number.parseFloat(String(e??``));return Number.isFinite(n)?Math.min(1,Math.max(0,n)):t}function normalizeCount(e){let t=typeof e==`number`?e:Number.parseInt(String(e??``),10);return Number.isFinite(t)?Math.max(0,Math.trunc(t)):0}var GtkInscription=class extends HTMLElement{_initialized=!1;static get observedAttributes(){return[`markup`,`min-chars`,`min-lines`,`nat-chars`,`nat-lines`,`text`,`text-overflow`,`wrap-mode`,`xalign`,`yalign`]}get text(){return this.getAttribute(`text`)??``}set text(e){this._write(`text`,e)}get markup(){return this.getAttribute(`markup`)??``}set markup(e){this._write(`markup`,e)}get minChars(){let e=this.getAttribute(`min-chars`);return e===null?3:normalizeCount(e)}set minChars(e){this._write(`min-chars`,String(e))}get natChars(){return normalizeCount(this.getAttribute(`nat-chars`))}set natChars(e){this._write(`nat-chars`,String(e))}get minLines(){let e=this.getAttribute(`min-lines`);return e===null?1:normalizeCount(e)}set minLines(e){this._write(`min-lines`,String(e))}get natLines(){return normalizeCount(this.getAttribute(`nat-lines`))}set natLines(e){this._write(`nat-lines`,String(e))}get textOverflow(){return normalizeInscriptionOverflow(this.getAttribute(`text-overflow`))}set textOverflow(e){this._write(`text-overflow`,e)}get wrapMode(){return normalizeInscriptionWrapMode(this.getAttribute(`wrap-mode`))}set wrapMode(e){this._write(`wrap-mode`,e)}get xalign(){return normalizeAlignment(this.getAttribute(`xalign`),0)}set xalign(e){this._write(`xalign`,String(e))}get yalign(){return normalizeAlignment(this.getAttribute(`yalign`),.5)}set yalign(e){this._write(`yalign`,String(e))}_write(e,t){this.getAttribute(e)!==t&&this.setAttribute(e,t)}connectedCallback(){if(this._initialized){this._render();return}this._initialized=!0,this._render()}attributeChangedCallback(e){this._initialized&&(this._render(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}})))}_property(e){switch(e){case`text`:return this.text;case`markup`:return this.markup;case`min-chars`:return this.minChars;case`nat-chars`:return this.natChars;case`min-lines`:return this.minLines;case`nat-lines`:return this.natLines;case`text-overflow`:return this.textOverflow;case`wrap-mode`:return this.wrapMode;case`xalign`:return this.xalign;default:return this.yalign}}_render(){let e=this.text,t=this.markup;this.textContent=e||!t?e:labelDisplayText(t,!0,!1);let n=this.minChars,r=this.natChars;if(n===0&&r===0)this.style.setProperty(`--gtk-inscription-min-ch`,`auto`),this.style.setProperty(`--gtk-inscription-width`,`auto`);else{let{minCh:e,maxCh:t}=labelWidthCharsExtent(n,r);this.style.setProperty(`--gtk-inscription-min-ch`,`${e}ch`),this.style.setProperty(`--gtk-inscription-width`,`${t}ch`)}let i=this.minLines,a=this.natLines;this.style.setProperty(`--gtk-inscription-min-lh`,i===0&&a===0?`auto`:`${i}lh`),this.style.setProperty(`--gtk-inscription-height`,i===0&&a===0?`auto`:`${Math.max(i,a)}lh`),this.style.setProperty(`--gtk-inscription-xalign`,String(this.xalign)),this.style.setProperty(`--gtk-inscription-align-items`,labelYalignAlignItems(this.yalign));let o=this.textOverflow;this.style.setProperty(`--gtk-inscription-text-overflow`,labelEllipsizeOverflowValue(o===`clip`?`none`:`end`)),this.classList.toggle(`clip`,o===`clip`),this.classList.toggle(`ellipsized`,o!==`clip`)}};customElements.define(`gtk-inscription`,GtkInscription);const ci=[[`low`,.25],[`high`,.75],[`full`,1]];function levelClassFor(e,t){for(let n=0;n<e.length;n++){let[r,i]=e[n];if(t>i)continue;let a=n===0?null:e[n-1][1];if(a===null||a<t)return r}return null}function numberAttribute(e,t,n){let r=Number.parseFloat(e.getAttribute(t)??``);return Number.isFinite(r)?r:n}var GtkLevelBar=class extends HTMLElement{_trough;_initialized=!1;_offsets=ci.map(e=>[...e]);static get observedAttributes(){return[`value`,`min-value`,`max-value`,`mode`,`inverted`,`orientation`,`disabled`]}get value(){return numberAttribute(this,`value`,0)}set value(e){this._write(`value`,String(e))}get minValue(){return numberAttribute(this,`min-value`,0)}set minValue(e){this._write(`min-value`,String(e))}get maxValue(){return numberAttribute(this,`max-value`,1)}set maxValue(e){this._write(`max-value`,String(e))}get mode(){return this.getAttribute(`mode`)===`discrete`?`discrete`:`continuous`}set mode(e){this._write(`mode`,e)}get inverted(){return this.hasAttribute(`inverted`)}set inverted(e){this.toggleAttribute(`inverted`,!!e)}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this._write(`orientation`,e)}_write(e,t){this.getAttribute(e)!==t&&this.setAttribute(e,t)}get disabled(){return this.hasAttribute(`disabled`)}set disabled(e){this.toggleAttribute(`disabled`,!!e)}addOffsetValue(e,t){if(t<this.minValue||t>this.maxValue)return;let n=this._offsets.findIndex(([t])=>t===e);n!==-1&&this._offsets[n][1]===t||(n!==-1&&this._offsets.splice(n,1),this._offsets.push([e,t]),this._offsets.sort((e,t)=>e[1]-t[1]),this._render(),this.dispatchEvent(new CustomEvent(`offset-changed`,{bubbles:!0,detail:{name:e}})))}removeOffsetValue(e){let t=this._offsets.findIndex(([t])=>t===e);t!==-1&&(this._offsets.splice(t,1),this._render())}offsetValue(e){return this._offsets.find(([t])=>t===e)?.[1]??null}connectedCallback(){if(this._initialized){this._render();return}this._initialized=!0,this._trough=document.createElement(`span`),this._trough.className=`adw-level-bar-trough`,this.replaceChildren(this._trough),this.setAttribute(`role`,`meter`),this._render()}attributeChangedCallback(e){if(!(!this._initialized||e===`disabled`)){if(e===`min-value`&&this.value<this.minValue){this._write(`value`,String(this.minValue)),this._notify(e);return}if(e===`max-value`&&(this._clampOffsets(),this.value>this.maxValue)){this._write(`value`,String(this.maxValue)),this._notify(e);return}this._render(),this._notify(e)}}_notify(e){this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}}))}_clampOffsets(){for(let e=0;e<this._offsets.length;e++){let[t,n]=this._offsets[e];n<this.minValue?this._offsets[e]=[t,this.minValue]:n>this.maxValue&&(this._offsets[e]=[t,this.maxValue])}}_property(e){switch(e){case`value`:return this.value;case`min-value`:return this.minValue;case`max-value`:return this.maxValue;case`mode`:return this.mode;case`inverted`:return this.inverted;default:return this.orientation}}_render(){if(!this._trough)return;let e=this.mode===`discrete`,t=this.orientation===`vertical`;this.classList.toggle(`continuous`,!e),this.classList.toggle(`discrete`,e),this.classList.toggle(`vertical`,t),this.classList.toggle(`horizontal`,!t);let n=this.minValue,r=this.maxValue,i=this.value,a=e?Math.max(1,Math.round(r)-Math.round(n)):1,o=levelClassFor(this._offsets,i);if(this._trough.replaceChildren(),e){let e=Math.min(a,Math.max(0,Math.round(i)-Math.round(n)));for(let t=0;t<a;t++){let n=this.inverted?t>=a-e:t<e;this._trough.append(this._block(n?`filled`:`empty`,n?o:null))}}else{let e=this._block(`empty`,null),t=this._block(`filled`,o);t.style.setProperty(`--level-fraction`,String(r>n?(i-n)/(r-n):0)),t.hidden=i===0,this._trough.append(e,t)}this.setAttribute(`aria-valuemin`,String(n)),this.setAttribute(`aria-valuemax`,String(r)),this.setAttribute(`aria-valuenow`,String(i))}_block(e,t){let n=document.createElement(`span`);return n.className=`adw-level-bar-block ${e}`,e===`filled`&&t&&n.classList.add(t),n}};customElements.define(`gtk-level-bar`,GtkLevelBar);var GtkListBoxRow=class extends HTMLElement{_contentsEl;_activation;_initialized=!1;static get observedAttributes(){return[`activatable`,`selectable`]}get activatable(){return this.getAttribute(`activatable`)!==`false`}set activatable(e){this.setAttribute(`activatable`,String(!!e))}get selectable(){return this.getAttribute(`selectable`)!==`false`}set selectable(e){this.setAttribute(`selectable`,String(!!e))}get index(){return this.parentElement?[...this.parentElement.children].indexOf(this):-1}get selected(){return this.classList.contains(`selected`)}get child(){return this._contentsEl.firstElementChild}connectedCallback(){this._initialized||(this._initialized=!0,this._contentsEl=document.createElement(`div`),this._contentsEl.className=`adw-list-box-row-contents`,bindSlottedChildren(this,[{into:this._contentsEl}]).install(this._contentsEl),this.setAttribute(`role`,`listitem`),this._claimed?this._syncActivation():this.syncClasses(!0))}claim(){this._claimed=!0}release(){this._claimed=!1,this.syncClasses(!1)}_canSelect=!0;_claimed=!1;attributeChangedCallback(){this._initialized&&this.syncClasses(this._canSelect)}syncClasses(e){this._canSelect=e,this.classList.toggle(`activatable`,this.activatable||this.selectable&&e),this._syncActivation()}_syncActivation(){this._activation??=attachRowActivation({row:this,activatable:()=>this.classList.contains(`activatable`),activate:()=>this.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0}))}),this._claimed||this._activation.sync()}};customElements.define(`gtk-list-box-row`,GtkListBoxRow);const li=new Set([`all`,`item`,`cell`]);function normalizeListTabBehavior(e){return e!=null&&li.has(e)?e:`all`}var GtkListBox=class extends HTMLElement{_rows=[];_selection=[];_anchor=-1;_initialized=!1;static get observedAttributes(){return[`selection-mode`,`activate-on-single-click`,`accept-unpaired-release`,`show-separators`,`tab-behavior`]}get selectionMode(){return normalizeBoxSelectionMode(this.getAttribute(`selection-mode`))}set selectionMode(e){this.setAttribute(`selection-mode`,e)}get activateOnSingleClick(){return this.getAttribute(`activate-on-single-click`)!==`false`}set activateOnSingleClick(e){this.setAttribute(`activate-on-single-click`,String(!!e))}get acceptUnpairedRelease(){return this.hasAttribute(`accept-unpaired-release`)}set acceptUnpairedRelease(e){this.toggleAttribute(`accept-unpaired-release`,!!e)}get showSeparators(){return this.hasAttribute(`show-separators`)}set showSeparators(e){this.toggleAttribute(`show-separators`,!!e)}get tabBehavior(){return normalizeListTabBehavior(this.getAttribute(`tab-behavior`))}set tabBehavior(e){this.setAttribute(`tab-behavior`,e)}get rows(){return this._rows}get selectedRows(){return[...this._selection]}set selectedRows(e){for(let t of typeof e==`number`?[e]:e??[])this.selectRow(this._rows[t]??null)}get selectedRowElements(){return this._selection.map(e=>this._rows[e]).filter(e=>e!==void 0)}connectedCallback(){this._initialized||(this._initialized=!0,this.addEventListener(`click`,e=>this._onClick(e)),this.addEventListener(`dblclick`,e=>this._onDoubleClick(e)),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),attachRovingFocus({host:this,orientation:`vertical`,items:()=>this._rows,select:e=>this._updateSelection(e,{})}),new MutationObserver(()=>this._collectRows()).observe(this,{childList:!0}),this._applyAttributes(),this._collectRows())}attributeChangedCallback(e){this._initialized&&(this._applyAttributes(),e===`selection-mode`&&this._syncRows(),e===`tab-behavior`&&this._syncTabIndexes())}selectRow(e){let t=e===null?null:this._rows.indexOf(e),n=listBoxSelectRow(this._selection,this._anchor,t,this._rows.length,this.selectionMode,e===null||e.selectable);same(n.selection,this._selection)&&n.anchor===this._anchor||(this._selection=n.selection,this._anchor=n.anchor,this._emitSelection(e))}unselectRow(e){let t=listBoxUnselectRow(this._selection,this._anchor,this._rows.indexOf(e),this._rows.length,this.selectionMode);same(t.selection,this._selection)||(this._selection=t.selection,this._emitSelection(null))}selectAll(){let e=listBoxSelectAll(this._rows.length,this.selectionMode);e!==null&&(this._selection=e,this._anchor=e.length>0?e[0]:-1,this._emitSelection(this.selectedRowElements[0]??null))}unselectAll(){listBoxUnselectAll(this._selection,this.selectionMode)!==null&&(this._selection=[],this._anchor=-1,this._emitSelection(null))}_applyAttributes(){this.classList.toggle(`separators`,this.showSeparators);let e=this.selectionMode!==`none`;this.setAttribute(`role`,e?`listbox`:`list`),this.selectionMode===`multiple`?this.setAttribute(`aria-multiselectable`,`true`):this.removeAttribute(`aria-multiselectable`)}_collectRows(){let e=[...this.querySelectorAll(`:scope > gtk-list-box-row`)];if(!(e.length===this._rows.length&&e.every((e,t)=>e===this._rows[t]))){for(let t of this._rows)e.includes(t)||t.release();for(let t of e)t.claim();this._rows=e,this._selection=this._selection.filter(e=>e<this._rows.length),this._anchor>=this._rows.length&&(this._anchor=-1),this._syncRows()}}_syncRows(){let e=this.selectionMode!==`none`,t=new Set(this._selection);this._rows.forEach((n,r)=>{n.syncClasses(e),n.selectable&&e?n.setAttribute(`aria-selected`,String(t.has(r))):n.removeAttribute(`aria-selected`)}),this._syncTabIndexes()}_syncTabIndexes(){let e=this.tabBehavior!==`all`,t=this._selection.length>0?this._selection[0]:0;this._rows.forEach((n,r)=>{n.tabIndex=e?r===t?0:-1:n.classList.contains(`activatable`)?0:-1})}_onClick(e){let t=this._rowAt(e.target);t===null&&!this.acceptUnpairedRelease||(t!==null&&this._updateSelection(t,{modify:e.ctrlKey||e.metaKey,extend:e.shiftKey}),!(e.detail<(this.activateOnSingleClick?1:2))&&t!==null&&this._activate(t))}_onDoubleClick(e){if(this.activateOnSingleClick)return;let t=this._rowAt(e.target);t!==null&&this._activate(t)}_onKeyDown(e){if(!e.ctrlKey||e.altKey||e.metaKey||e.key!==` `)return;let t=this._rowAt(e.target);t!==null&&(e.preventDefault(),this._updateSelection(t,{modify:!0}))}_rowAt(e){if(!(e instanceof Element))return null;let t=e.closest(`gtk-list-box-row`);return this.contains(t)?t:null}_updateSelection(e,t){let n=listBoxSelect(this._selection,this._anchor,this._rows.indexOf(e),this._rows.length,this.selectionMode,t,e.selectable);same(n.selection,this._selection)||(this._selection=n.selection,this._anchor=n.anchor,this._emitSelection(n.selection.includes(this._rows.indexOf(e))?e:null))}_activate(e){e.activatable&&(this.dispatchEvent(new CustomEvent(`row-activated`,{bubbles:!0,detail:{row:e}})),e.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0})))}_emitSelection(e){this._syncRows(),this.dispatchEvent(new CustomEvent(`selected-rows-changed`,{bubbles:!0})),this.dispatchEvent(new CustomEvent(`row-selected`,{bubbles:!0,detail:{row:e}})),this.dispatchEvent(new CustomEvent(`notify::selected-rows`,{bubbles:!0,detail:{selectedRows:[...this._selection]}}))}};function same(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}customElements.define(`gtk-list-box`,GtkListBox);function volumeIconFor(e){let t=Math.min(1,Math.max(0,Number.isFinite(e)?e:1));return t===0?`audio-volume-muted-symbolic`:t===1?`audio-volume-high-symbolic`:Math.trunc((t-0)/.5)+2===2?`audio-volume-low-symbolic`:`audio-volume-medium-symbolic`}function mediaTimeToString(e,t=!1,n=!1){let r=Math.trunc(e);t&&r++;let i=r%60;r-=i;let a=r%3600/60;r-=a*60;let o=r/3600;return o>0||n?t?`-${o}:${String(a).padStart(2,`0`)}:${String(i).padStart(2,`0`)}`:`${o}:${String(a).padStart(2,`0`)}:${String(i).padStart(2,`0`)}`:t?`-${a}:${String(i).padStart(2,`0`)}`:`${a}:${String(i).padStart(2,`0`)}`}var GtkMediaControls=class extends HTMLElement{_initialized=!1;_playButton;_timeLabel;_seekScale;_durationLabel;_volumeButton;_volumeIcon;_volumePopover;_volumeScale;_media=null;_seeking=!1;_volume=1;connectedCallback(){if(this._initialized){this._adoptMedia();return}this._initialized=!0;let e=document.createElement(`div`);e.className=`adw-media-controls-box`,this._playButton=document.createElement(`button`),this._playButton.className=`adw-media-controls-button adw-flat`,this._playButton.type=`button`,this._playButton.title=`Play`,this._playButton.setAttribute(`aria-label`,`Play`),this._playButton.addEventListener(`click`,()=>this._togglePlay());let t=document.createElement(`div`);t.className=`adw-media-controls-time-box`,this._timeLabel=document.createElement(`span`),this._timeLabel.className=`adw-media-controls-time-label`,this._seekScale=document.createElement(`input`),this._seekScale.className=`adw-media-controls-seek-scale`,this._seekScale.type=`range`,this._seekScale.min=`0`,this._seekScale.max=`10`,this._seekScale.step=`1`,this._seekScale.value=`0`,this._seekScale.setAttribute(`aria-label`,`Position`),this._seekScale.addEventListener(`input`,()=>this._onSeekInput()),this._durationLabel=document.createElement(`span`),this._durationLabel.className=`adw-media-controls-duration-label`,t.append(this._timeLabel,this._seekScale,this._durationLabel),this._volumeButton=document.createElement(`button`),this._volumeButton.className=`adw-media-controls-button adw-media-controls-volume-button adw-flat`,this._volumeButton.type=`button`,this._volumeButton.setAttribute(`aria-label`,`Volume`),this._volumeButton.addEventListener(`click`,()=>this._toggleVolumePopover()),this._volumeIcon=document.createElement(`span`),this._volumeIcon.className=`adw-media-controls-volume-icon`,this._volumePopover=document.createElement(`gtk-popover`),this._volumePopover.className=`adw-media-controls-volume-popover`,this._volumeScale=document.createElement(`input`),this._volumeScale.className=`adw-media-controls-volume-scale`,this._volumeScale.type=`range`,this._volumeScale.min=`0`,this._volumeScale.max=`1`,this._volumeScale.step=`0.1`,this._volumeScale.value=`1`,this._volumeScale.setAttribute(`aria-label`,`Volume`),this._volumeScale.addEventListener(`input`,()=>this._onVolumeInput()),this._volumePopover.append(this._volumeScale),this._volumePopover.addEventListener(`click`,e=>e.stopPropagation()),this._volumeButton.append(this._volumeIcon,this._volumePopover),e.append(this._playButton,t,this._volumeButton),this.replaceChildren(e),this._renderVolume(),this._adoptMedia()}get media(){return this._media}get timestamp(){return this._media?.currentTime??0}get duration(){let e=this._media?.duration??0;return Number.isFinite(e)?e:0}get volume(){return this._volume}set volume(e){this._setVolume(e)}get sensitive(){return this._media!=null}_togglePlay(){let e=this._media??null;e!==null&&(e.paused?e.play().catch(()=>{}):e.pause())}_onSeekInput(){this._seeking=!0,this._media&&(this._media.currentTime=Number.parseFloat(this._seekScale.value)),this._seeking=!1,this._updateTimestamp()}_onVolumeInput(){this._setVolume(Number.parseFloat(this._volumeScale.value))}_setVolume(e){let t=Math.min(1,Math.max(0,Number.isFinite(e)?e:1));this._volume=t,this._media&&(this._media.volume=t),this._renderVolume()}_renderVolume(){this._volumeScale&&(this._volumeScale.value=String(this._volume));let e=document.createElement(`gtk-image`);e.setAttribute(`icon-name`,volumeIconFor(this._volume)),this._volumeIcon?.replaceChildren(e)}_toggleVolumePopover(){this._volumePopover&&(this._volumePopover.hidden=!this._volumePopover.hidden)}_adoptMedia(){let e=this.getAttribute(`for`),t=e?this.ownerDocument.getElementById(e):null,n=(t instanceof HTMLVideoElement?t:null)??this.closest(`gtk-video`)?.querySelector(`video`)??null;if(n===this._media){this._render();return}if(this._media&&this._detachMedia(),this._media=n,n){this._mediaListeners=[[`timeupdate`,()=>this._updateTimestamp()],[`durationchange`,()=>this._updateDuration()],[`play`,()=>this._updatePlaying(!0)],[`pause`,()=>this._updatePlaying(!1)],[`seeked`,()=>this._updateTimestamp()]];for(let[e,t]of this._mediaListeners)n.addEventListener(e,t);this._setVolume(n.volume)}this._render()}_mediaListeners=[];_detachMedia(){if(this._media)for(let[e,t]of this._mediaListeners)this._media.removeEventListener(e,t);this._mediaListeners=[]}_updateTimestamp(){if(!this._initialized)return;let e=this.timestamp,t=this.duration;!this._seeking&&t>0&&(this._seekScale.value=String(e)),this._timeLabel.textContent=mediaTimeToString(e),this._durationLabel.textContent=mediaTimeToString(t>e?t-e:0,!0),this._durationLabel.hidden=t<=0}_updateDuration(){this._initialized&&(this._seekScale.max=String(this.duration>0?this.duration:10),this._updateTimestamp())}_updatePlaying(e){if(!this._initialized)return;let t=document.createElement(`gtk-image`);t.setAttribute(`icon-name`,e?`media-playback-pause-symbolic`:`media-playback-start-symbolic`),this._playButton.replaceChildren(t),this._playButton.title=e?`Pause`:`Play`,this._playButton.setAttribute(`aria-label`,e?`Pause`:`Play`)}_render(){if(!this._initialized)return;let e=this._media??null,t=e!==null;this.classList.toggle(`insensitive`,!t),this._playButton.disabled=!t,this._seekScale.disabled=!t,this._volumeButton.disabled=!t,this._volumeScale.disabled=!t,this._updateDuration(),this._updateTimestamp(),this._updatePlaying(t&&!e.paused)}};customElements.define(`gtk-media-controls`,GtkMediaControls);const ui={down:`bottom`,up:`top`,left:`start`,right:`end`};var GtkMenuButton=class extends HTMLElement{_buttonEl;_popoverEl;_model=[];_actions=null;_menuTitle=``;_initialized=!1;_menuView;static get observedAttributes(){return[`icon-name`,`menu-title`,`menu-model`,`disabled`,`flat`,`circular`,`direction`]}get active(){return this._popoverEl?.open??!1}get menuModel(){return this._model}set menuModel(e){this._model=this._acceptMenu(e),this._initialized&&this._renderMenu()}_acceptMenu(e,t=!0){let n=normalizeMenuModel(e);if(t)return assertMenuRenderable(n,E),n;let r=menuRefusals(n,E);if(r.length===0)return n;console.error(`${E.name} cannot render this menu, so it has none:`);for(let e of r)console.error(` [${e.path.join(`.`)}] ${e.message}`);return[]}get actions(){return this._actions}set actions(e){this._actions=e??null,this._menuView?.setActions(this._actions),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(`gtk-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._menuView=new PopoverMenuView(this._popoverEl,`adw-menu-button`,e=>{let t=menuItemAt(this._model,e);t!==null&&(this._popoverEl.popdown(),this._buttonEl.focus(),activateElementMenuItem(this,t),this.dispatchEvent(new CustomEvent(`menu-item-activated`,{bubbles:!0,detail:{id:t.id??t.label,label:t.label,path:[...e]}})))}),this._menuView.setActions(this._actions),this._buttonEl.addEventListener(`click`,()=>{this.hasAttribute(`disabled`)||!this._popoverEl.open&&this._model.length===0||(this._popoverEl.open=!this._popoverEl.open)}),this._model.length===0&&(this._model=this._parseMenuAttr()),!this.hasAttribute(`flat`)&&!this.hasAttribute(`circular`)&&this.setAttribute(`flat`,``),this._render())}attributeChangedCallback(e){if(!(!this._initialized||!this._buttonEl)){if(e===`menu-model`){this._model=this._parseMenuAttr(),this._renderMenu();return}this._render()}}_parseMenuAttr(){return this._acceptMenu(parseMenuModel(this.getAttribute(`menu-model`)),!1)}_onPopoverToggled(e){this.classList.toggle(`active`,e),this._buttonEl.setAttribute(`aria-expanded`,String(e)),e?(this._refreshActions(),this._menuView.focusableRows[0]?.focus()):this._menuView.reset()}_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=ui[$t(this.direction)],this._buttonEl.replaceChildren(),this._buttonEl.appendChild(createGtkImage(this.getAttribute(`icon-name`)??`open-menu`,`adw-menu-button-icon`)),this._buttonEl.setAttribute(`aria-label`,this.getAttribute(`menu-title`)||`Menu`),this._renderMenu()}_refreshActions(){this._menuView.setActions(this._actions??menuActionsOfElement(this,this._model)),this._menuView.render()}_renderMenu(){this._menuView.setMenuModel(this._model),this._menuView.setTitle(this.getAttribute(`menu-title`)??this._menuTitle),this._menuView.render(),this._model.length===0&&this._popoverEl.popdown()}};customElements.define(`gtk-menu-button`,GtkMenuButton);const di=[`top`,`bottom`,`left`,`right`],fi=[`tab-label`,`menu-label`,`tab-fill`,`tab-expand`,`reorderable`,`detachable`];var GtkNotebook=class extends HTMLElement{_current=null;_initialized=!1;_initializedChildren=new WeakSet;_header;_tabs;_observer=null;_tabNodes=[];_menu=null;static get observedAttributes(){return[`page`,`tab-pos`,`show-tabs`,`show-border`,`scrollable`,`enable-popup`,`group-name`]}get page(){return this._current?this._pages().indexOf(this._current):-1}set page(e){this.setCurrentPage(e)}get tabPos(){let e=this.getAttribute(`tab-pos`);return e!==null&&di.includes(e)?e:`top`}set tabPos(e){this._write(`tab-pos`,e)}get showTabs(){return this._flag(`show-tabs`,!0)}set showTabs(e){this._write(`show-tabs`,e?``:`false`)}get showBorder(){return this._flag(`show-border`,!0)}set showBorder(e){this._write(`show-border`,e?``:`false`)}get scrollable(){return this._flag(`scrollable`,!1)}set scrollable(e){this._write(`scrollable`,e?``:`false`)}get enablePopup(){return this._flag(`enable-popup`,!1)}set enablePopup(e){this._write(`enable-popup`,e?``:`false`)}get groupName(){return this.getAttribute(`group-name`)}set groupName(e){this._write(`group-name`,e)}get currentPage(){return this._current}get nPages(){return this._pages().length}getNthPage(e){let t=this._pages();return t[e<0?t.length-1:e]??null}pageNum(e){return this._pages().indexOf(e)}getPage(e){return this._pages().includes(e)?this._page(e):null}setPage(e){let t=this._pages().indexOf(e);return t===-1?!1:this.setCurrentPage(t)}nextPage(){return this._searchPage(1)}prevPage(){return this._searchPage(-1)}setCurrentPage(e){let t=this._pages(),n=t[e<0?t.length-1:e];return n?this._switchTo(n):!1}appendPage(e,t){return this.insertPage(e,-1,t)}insertPage(e,t,n){let r=t<0?this._pages().length:t;return n!=null&&e.setAttribute(`tab-label`,n),this._initChild(e),this.insertBefore(e,this._pages()[r]??null),this.dispatchEvent(new CustomEvent(`page-added`,{bubbles:!0,detail:{position:r,nPages:this._pages().length}})),this._current||this._switchTo(e),this._render(),r}removePage(e){let t=this._pages().indexOf(e);return t===-1?!1:(e===this._current&&(this._current=null),e.remove(),this.dispatchEvent(new CustomEvent(`page-removed`,{bubbles:!0,detail:{position:t,nPages:this._pages().length}})),this._current||this._takeOver(t),this._render(),!0)}refresh(){this._render()}connectedCallback(){if(this._initialized)this._observer=new MutationObserver(e=>this._onMutations(e));else{this._initialized=!0,this._header=document.createElement(`div`),this._header.className=`adw-notebook-header`,this._tabs=document.createElement(`div`),this._tabs.className=`adw-notebook-tabs`,this._tabs.setAttribute(`role`,`tablist`),this._header.appendChild(this._tabs);for(let e of this._pages())this._initChild(e)}this._header.parentNode!==this&&this.prepend(this._header),this._observer?.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[...fi,`hidden`]}),this._current||this._switchTo(this._firstVisible()),this.addEventListener(`contextmenu`,this._onContextMenu),this._render()}disconnectedCallback(){this._observer?.disconnect(),this._observer=null,this.removeEventListener(`contextmenu`,this._onContextMenu),this._closeMenu()}attributeChangedCallback(e){if(this._initialized){if(e===`page`){let t=this.getAttribute(e);t!==null&&this.setCurrentPage(Number.parseInt(t,10));return}this._render(),this._notify(e)}}_switchTo(e){let t=this._pages().indexOf(e);if(t===-1||!this._page(e).visible||this._current===e)return!1;let n=new CustomEvent(`switch-page`,{bubbles:!0,cancelable:!0,detail:{page:t,child:e}});return this.dispatchEvent(n),n.defaultPrevented?!1:(this._current=e,this._render(),this._notify(`page`),!0)}_notify(e){this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}}))}_property(e){switch(e){case`page`:return this.page;case`tab-pos`:return this.tabPos;case`show-tabs`:return this.showTabs;case`show-border`:return this.showBorder;case`scrollable`:return this.scrollable;case`enable-popup`:return this.enablePopup;default:return this.groupName}}_write(e,t){t===null?this.removeAttribute(e):this.getAttribute(e)!==t&&this.setAttribute(e,t)}_flag(e,t){let n=this.getAttribute(e);return n===null?t:n!==`false`}_pages(){return Array.from(this.children).filter(e=>e!==this._header)}_page(e){return{tabLabel:e.getAttribute(`tab-label`),menuLabel:e.getAttribute(`menu-label`),tabFill:e.getAttribute(`tab-fill`)!==`false`,tabExpand:e.hasAttribute(`tab-expand`),reorderable:e.hasAttribute(`reorderable`),detachable:e.hasAttribute(`detachable`),visible:!e.hasAttribute(`hidden`),child:e}}_initChild(e){this._initializedChildren.has(e)||(this._initializedChildren.add(e),e.classList.add(`adw-notebook-page`))}_firstVisible(){return this._pages().find(e=>this._page(e).visible)??null}_searchPage(e){let t=this._pages(),n=this._current?t.indexOf(this._current):-1;for(let r=n+e;r>=0&&r<t.length;r+=e)if(this._switchTo(t[r]))return!0;return!1}_takeOver(e){let t=this._pages();for(let n of[...t.slice(e),...t.slice(0,e)])if(this._switchTo(n))return!0;return!1}_onMutations(e){let t=new Set(this._pages()),n=e.filter(e=>e.target===this||t.has(e.target));if(n.length===0)return;let r=0,i=0,a=[];for(let e of n){if(e.type===`childList`){for(let t of Array.from(e.removedNodes))t===this._current&&(this._current=null),i+=1;for(let t of Array.from(e.addedNodes))!(t instanceof HTMLElement)||t===this._header||(this._initChild(t),r+=1);continue}let t=e.attributeName;if(t===`hidden`){(!this._current||!this._page(this._current).visible)&&this._switchTo(this._firstVisible());continue}t&&fi.includes(t)&&a.push(e.target)}(r>0||i>0)&&this.dispatchEvent(new CustomEvent(`items-changed`,{bubbles:!0,detail:{added:r,removed:i}}));for(let e of a)this.dispatchEvent(new CustomEvent(`page-updated`,{bubbles:!0,detail:{child:e}}));this._render()}_effectiveTabPos(){let e=this.tabPos;return this.getAttribute(`dir`)===`rtl`?e===`left`?`right`:e===`right`?`left`:e:e}_render(){if(!this._initialized)return;let e=this._pages();e.length!==this._tabNodes.length&&(this._tabs.replaceChildren(),this._tabNodes=e.map(()=>this._buildTab()),this._tabs.append(...this._tabNodes));let t=this._current?e.indexOf(this._current):-1,n=0;e.forEach((e,r)=>{let i=this._tabNodes[r];if(!i)return;let a=this._page(e),o=r===t;a.visible&&(n+=1);let s=a.tabLabel??`Page ${n}`;i.textContent!==s&&(i.textContent=s),i.classList.toggle(`active`,o),i.classList.toggle(`expand`,a.tabExpand),i.classList.toggle(`fill`,a.tabFill),i.classList.toggle(`reorderable`,a.reorderable);let c=!a.visible;i.hidden!==c&&(i.hidden=c),i.setAttribute(`aria-selected`,String(o)),e.classList.toggle(`visible-page`,o),o?e.removeAttribute(`aria-hidden`):e.setAttribute(`aria-hidden`,`true`)});let r=!this.showTabs;this._header.hidden!==r&&(this._header.hidden=r);let i=this._effectiveTabPos();this.getAttribute(`data-tab-pos`)!==i&&this.setAttribute(`data-tab-pos`,i),this.classList.toggle(`frame`,this.showBorder)}_buildTab(){let e=document.createElement(`button`);return e.type=`button`,e.className=`adw-notebook-tab`,e.setAttribute(`role`,`tab`),e.addEventListener(`click`,()=>{let t=this._tabNodes.findIndex(t=>t===e);if(t===-1)return;let n=this._pages()[t];n&&this._switchTo(n)}),e}_onContextMenu=e=>{if(!this.enablePopup)return;e.preventDefault(),this._closeMenu();let t=document.createElement(`div`);t.className=`adw-notebook-menu`,t.setAttribute(`role`,`listbox`);let n=0;for(let e of this._pages()){let r=this._page(e);r.visible&&(n+=1);let i=document.createElement(`button`);i.type=`button`,i.className=`adw-notebook-menu-item`,i.setAttribute(`role`,`option`),i.textContent=r.menuLabel??r.tabLabel??`Page ${n}`,i.hidden=!r.visible,i.setAttribute(`aria-selected`,String(e===this._current)),i.addEventListener(`click`,()=>{this._switchTo(e),this._closeMenu()}),t.appendChild(i)}this.appendChild(t),this._menu=t};_closeMenu(){this._menu?.remove(),this._menu=null}};customElements.define(`gtk-notebook`,GtkNotebook);const pi=[`left`,`right`,`top`,`bottom`];var GtkOverlay=class extends HTMLElement{_childEl;_layerEl;_initialized=!1;_resize=null;_mutations=null;static get observedAttributes(){return[]}get child(){return this._childEl?.firstElementChild??null}get overlayLayer(){return this._layerEl}connectedCallback(){if(this._initialized){this._observe();return}this._initialized=!0,this._childEl=document.createElement(`div`),this._childEl.className=`adw-overlay-child`,this._layerEl=document.createElement(`div`),this._layerEl.className=`adw-overlay-layer`,bindSlottedChildren(this,[{into:this._childEl},{name:`overlay`,into:this._layerEl}]).install(this._childEl,this._layerEl),this._observe()}disconnectedCallback(){this._resize?.disconnect(),this._resize=null,this._mutations?.disconnect(),this._mutations=null}_observe(){this._resize||(this._resize=new ResizeObserver(()=>this._syncEdgeClasses()),this._resize.observe(this._layerEl),this._mutations=new MutationObserver(()=>this._syncEdgeClasses()),this._mutations.observe(this._layerEl,{childList:!0,attributes:!0,subtree:!0}),this._syncEdgeClasses())}_syncEdgeClasses(){let e=this.matches(`:dir(rtl)`);for(let t of this._layerEl.children){let n=t.getAttribute(`halign`),r=t.getAttribute(`valign`),i={left:e?n===`end`:n===`start`,right:e?n===`start`:n===`end`,top:r===`start`,bottom:r===`end`};for(let e of pi)t.classList.toggle(e,i[e])}}};customElements.define(`gtk-overlay`,GtkOverlay);const W=25.4,G=[{name:`na_letter`,displayName:`US Letter`,width:8.5*W,height:11*W},{name:`na_legal`,displayName:`US Legal`,width:8.5*W,height:14*W},{name:`iso_a4`,displayName:`A4`,width:210,height:297},{name:`iso_a5`,displayName:`A5`,width:148,height:210},{name:`roc_16k`,displayName:`ROC 16k`,width:7.75*W,height:10.75*W},{name:`iso_b5`,displayName:`B5`,width:176,height:250},{name:`jis_b5`,displayName:`JB5`,width:182,height:257},{name:`na_number-10`,displayName:`#10 Envelope`,width:4.125*W,height:9.5*W},{name:`iso_dl`,displayName:`DL Envelope`,width:110,height:220},{name:`jpn_chou3`,displayName:`Choukei 3 Envelope`,width:120,height:235},{name:`na_ledger`,displayName:`Tabloid`,width:11*W,height:17*W},{name:`iso_a3`,displayName:`A3`,width:297,height:420}],mi=new Set([`na_letter`,`na_legal`,`iso_a4`]);function doubleToString(e,t){let n=t===`inch`?e.toFixed(2):e.toFixed(1);return n.includes(`.`)&&(n=n.replace(/0+$/,``),n.endsWith(`.`)&&(n=n.slice(0,-1))),n}function defaultMargins(e){return{top:.25*W,bottom:(mi.has(e.name)?.56:.25)*W,left:.25*W,right:.25*W}}function defaultPageSetup(){let e=G.find(e=>e.name===`iso_a4`);return{paperSize:e.name,orientation:`portrait`,margins:defaultMargins(e)}}function paperSizeByName(e){return G.find(t=>t.name===e)??null}function paperSizeOf(e){return paperSizeByName(e.paperSize)??G[2]}function pageSetupEquals(e,t){return e.paperSize===t.paperSize&&e.margins.top===t.margins.top&&e.margins.bottom===t.margins.bottom&&e.margins.left===t.margins.left&&e.margins.right===t.margins.right}function orientedSize(e,t=`mm`){let n=paperSizeOf(e),r=e.orientation===`landscape`||e.orientation===`reverse-landscape`,i=r?n.height:n.width,a=r?n.width:n.height;return t===`mm`?{width:i,height:a}:{width:i/W,height:a/W}}function unitLabel(e){return e===`mm`?`mm`:`inch`}function paperSizeLabel(e,t=`mm`){let{width:n,height:r}=orientedSize(e,t);return`${doubleToString(n,t)} × ${doubleToString(r,t)} ${unitLabel(t)}`}function paperMarginsTooltip(e,t=`mm`){let inUnit=e=>t===`mm`?e:e/W,shown=e=>`${doubleToString(inUnit(e),t)} ${unitLabel(t)}`,{margins:n}=e;return[`Margins:`,` Left: ${shown(n.left)}`,` Right: ${shown(n.right)}`,` Top: ${shown(n.top)}`,` Bottom: ${shown(n.bottom)}`].join(`
8
+ `)}const hi={name:`Any Printer`,location:`For portable documents`},gi=[[`portrait`,`Portrait`],[`reverse-portrait`,`Reverse portrait`],[`landscape`,`Landscape`],[`reverse-landscape`,`Reverse landscape`]];var GtkPageSetupUnixDialog=class extends AdwDialog{_built=!1;static get observedAttributes(){return[...AdwDialog.observedAttributes]}_printerEl;_paperEl;_sizeLabelEl;_radios=new Map;_printers=[];_setups=[];_lastSetup=null;_printSettings=null;_unit=`mm`;get unit(){return this._unit}set unit(e){this._unit=e,this._built&&this._renderSetup()}get printers(){return this._printers.map(e=>({...e}))}set printers(e){this._printers=e.map(e=>({...e})),this._built&&this._renderSetup()}get pageSetup(){return{...this._current(),orientation:this._orientation()}}set pageSetup(e){let t=this._setups.findIndex(t=>pageSetupEquals(t,e));t<0?(this._setups.push(e),this._paperEl.selected=this._setups.length-1):this._paperEl.selected!==t&&(this._paperEl.selected=t),this._setOrientation(e.orientation),this._built&&this._renderSetup()}get printSettings(){return this._printSettings}set printSettings(e){this._printSettings=e;let t=e?.[`format-for-printer`];if(t===void 0)return;let n=this._printerRows().findIndex(e=>e.name===t);n>=0&&(this._printerEl.selected=n)}connectedCallback(){if(this._built){super.connectedCallback();return}super.connectedCallback(),this.hasAttribute(`title`)||this.setAttribute(`title`,`Page Setup`),this._fillPaperSizes();let e=[...this.contentArea.childNodes];this.contentArea.replaceChildren(this._build());for(let t of e)this.contentArea.appendChild(t);this._renderSetup();let t=this._setups.findIndex(e=>e.paperSize===defaultPageSetup().paperSize);t>=0&&this._paperEl.selected!==t&&(this._paperEl.selected=t,this._renderSetup()),this._built=!0}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),!(!this._built||t===n)&&e!==`title`&&this._renderSetup()}_build(){let e=document.createElement(`div`);e.className=`adw-page-setup-grid`,this._printerEl=this._dropDown(`printer`,`_Format for:`),this._printerEl.addEventListener(`notify::selected`,()=>this._printerChanged()),e.append(this._label(`_Format for:`),this._printerEl),this._paperEl=this._dropDown(`paper`,`_Paper size:`),this._paperEl.addEventListener(`notify::selected`,()=>this._paperChanged()),e.append(this._label(`_Paper size:`),this._paperEl),this._sizeLabelEl=document.createElement(`div`),this._sizeLabelEl.className=`adw-page-setup-size-label`,this._sizeLabelEl.setAttribute(`aria-live`,`polite`),e.append(this._sizeLabelEl),e.append(this._label(`_Orientation:`));for(let[t,n]of gi){let r=document.createElement(`adw-radio`);r.className=`adw-page-setup-orientation`,r.setAttribute(`label`,n),r.setAttribute(`name`,`adw-page-setup-orientation`),r.setAttribute(`value`,t),r.addEventListener(`notify::checked`,()=>this._orientationChanged()),this._radios.set(t,r),e.appendChild(r)}return e.appendChild(this._actions()),e}_dropDown(e,t){let n=document.createElement(`gtk-drop-down`);return n.className=`adw-page-setup-${e}`,n.setAttribute(`aria-label`,t.replace(`_`,``)),n}_label(e){let t=document.createElement(`div`);return t.className=`adw-page-setup-label`,t.textContent=e.replace(`_`,``),t}_actions(){let e=document.createElement(`div`);e.className=`adw-page-setup-actions`;let t=document.createElement(`button`);t.type=`button`,t.className=`adw-page-setup-cancel`,t.textContent=`Cancel`,t.addEventListener(`click`,()=>this._respond(-6));let n=document.createElement(`button`);return n.type=`button`,n.className=`adw-page-setup-apply suggested-action`,n.textContent=`Apply`,n.addEventListener(`click`,()=>this._respond(-5)),e.append(t,n),e}_respond(e){this.dispatchEvent(new CustomEvent(`response`,{bubbles:!0,detail:{responseId:e}})),this.close()}_printerRows(){return[hi,...this._printers]}_fillPaperSizes(){this._setups=G.map(e=>({paperSize:e.name,orientation:`portrait`,margins:defaultMargins(e)}))}_current(){return this._setups[this._paperEl.selected]??defaultPageSetup()}_orientation(){for(let[e,t]of this._radios)if(t.checked)return e;return`portrait`}_setOrientation(e){let t=this._radios.get(e);t!==void 0&&(t.checked=!0)}_renderSetup(){let e=this._printerRows();this._printerEl.setAttribute(`model`,JSON.stringify(e.map(e=>e.name))),this._printerEl.selected>=e.length&&(this._printerEl.selected=0);let t=[...this._setups.map(e=>paperSizeOf(e).displayName),`Manage Custom Sizes…`];this._paperEl.setAttribute(`model`,JSON.stringify(t)),this._paperEl.selected>=t.length&&(this._paperEl.selected=0);let n=this._current();this._sizeLabelEl.textContent=paperSizeLabel(n,this._unit),this._sizeLabelEl.title=paperMarginsTooltip(n,this._unit)}_printerChanged(){let e=this._printerRows()[this._printerEl.selected];(e===void 0||e.name===hi.name)&&this._fillPaperSizes(),this._renderSetup(),this._printSettings!==null&&(this._printSettings={"format-for-printer":e?.name})}_paperChanged(){let e=this._paperEl.selected;if(e>=this._setups.length){let e=this._lastSetup??defaultPageSetup();this._setups.push(e),this._paperEl.selected=this._setups.length-1,this._renderSetup();return}this._lastSetup=this._setups[e]??null,this._renderSetup()}_orientationChanged(){this._built&&(this._setups[this._paperEl.selected]={...this._current(),orientation:this._orientation()},this._renderSetup())}};customElements.define(`gtk-page-setup-unix-dialog`,GtkPageSetupUnixDialog);function computePanedPosition(e){let{allocation:t,startRequest:n,endRequest:r,resizeStart:i,resizeEnd:a,shrinkStart:o,shrinkEnd:s}=e,c=o?0:n,l=t;s||(l=Math.max(1,l-r)),l=Math.max(c,l);let u;return u=e.positionSet?e.lastAllocation>0?i&&!a?e.startChildSize+t-e.lastAllocation:!i&&a?e.startChildSize:t*(e.startChildSize/e.lastAllocation)+.5:e.startChildSize:i&&!a?Math.max(0,t-r):!i&&a?n:n+r===0?t*.5+.5:t*(n/(n+r))+.5,u=Math.trunc(u),{min:c,max:l,position:glibClamp(u,c,l)}}var GtkPaned=class extends HTMLElement{_startEl;_handleEl;_endEl;_initialized=!1;_position=-1;_positionSet=!1;_minPosition=0;_maxPosition=2**53-1;_lastAllocation=0;_dragPos=0;_dragging=!1;_resize=null;static get observedAttributes(){return[`orientation`,`position`,`position-set`,`resize-start-child`,`resize-end-child`,`shrink-start-child`,`shrink-end-child`,`wide-handle`]}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this.setAttribute(`orientation`,e)}get position(){return this._position}set position(e){this.setPosition(e)}get positionSet(){return this._positionSet}get minPosition(){return this._minPosition}get maxPosition(){return this._maxPosition}get wideHandle(){return this.hasAttribute(`wide-handle`)}set wideHandle(e){this.toggleAttribute(`wide-handle`,!!e)}get startChild(){return this._startEl?.firstElementChild??null}get endChild(){return this._endEl?.firstElementChild??null}connectedCallback(){if(this._initialized){this._observe();return}this._initialized=!0,this.setAttribute(`role`,`group`),this._startEl=document.createElement(`div`),this._startEl.className=`adw-paned-child`,this._handleEl=document.createElement(`div`),this._handleEl.className=`adw-paned-handle separator`,this._handleEl.setAttribute(`role`,`separator`),this._handleEl.tabIndex=0,this._endEl=document.createElement(`div`),this._endEl.className=`adw-paned-child`,bindSlottedChildren(this,[{into:this._startEl},{name:`start`,into:this._startEl},{name:`end`,into:this._endEl}],()=>this._observe()).install(this._startEl,this._handleEl,this._endEl),this._handleEl.addEventListener(`pointerdown`,this._onPointerDown),this._handleEl.addEventListener(`keydown`,this._onKeyDown);let e=Number.parseFloat(this.getAttribute(`position`)??``);Number.isFinite(e)&&this.setPosition(e),this._observe(),this._layout()}disconnectedCallback(){this._dragging=!1,this._resize?.disconnect(),this._resize=null}attributeChangedCallback(e){if(this._initialized){if(e===`position`){let e=Number.parseFloat(this.getAttribute(`position`)??``);Number.isFinite(e)&&this.setPosition(e);return}e!==`position-set`&&(this._layout(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}})))}}_property(e){switch(e){case`orientation`:return this.orientation;case`resize-start-child`:return this.getAttribute(`resize-start-child`)!==`false`;case`resize-end-child`:return this.getAttribute(`resize-end-child`)!==`false`;case`shrink-start-child`:return this.getAttribute(`shrink-start-child`)!==`false`;case`shrink-end-child`:return this.getAttribute(`shrink-end-child`)!==`false`;case`wide-handle`:return this.wideHandle;default:return this.getAttribute(e)}}_observe(){this._resize||(this._resize=new ResizeObserver(()=>this._layout()),this._resize.observe(this));for(let e of[this._startEl,this._endEl]){let t=e.firstElementChild;t&&this._resize.observe(t)}}setPosition(e){if(Number.isFinite(e)){if(e<0){this._positionSet&&(this._positionSet=!1,this._notify(`position-set`,{positionSet:!1})),this._position=-1,this._layout();return}this._positionSet||(this._positionSet=!0,this._notify(`position-set`,{positionSet:!0})),this._position!==e&&(this._position=e,this._notify(`position`,{position:e}),this._layout())}}_layout(){if(!this._startEl)return;let e=this.orientation===`horizontal`,t=this._handleEl.getBoundingClientRect(),n=e?t.width:t.height,r=Math.max(1,(e?this.clientWidth:this.clientHeight)-n),i=computePanedPosition({allocation:r,startRequest:this._sizeRequest(this._startEl,e),endRequest:this._sizeRequest(this._endEl,e),resizeStart:this.getAttribute(`resize-start-child`)!==`false`,resizeEnd:this.getAttribute(`resize-end-child`)!==`false`,shrinkStart:this.getAttribute(`shrink-start-child`)!==`false`,shrinkEnd:this.getAttribute(`shrink-end-child`)!==`false`,positionSet:this._positionSet,startChildSize:this._position<0?0:this._position,lastAllocation:this._lastAllocation}),a=Math.floor(i.position);a!==this._position&&(this._position=a,this._notify(`position`,{position:a})),i.min!==this._minPosition&&(this._minPosition=i.min,this._notify(`min-position`,{minPosition:i.min})),i.max!==this._maxPosition&&(this._maxPosition=i.max,this._notify(`max-position`,{maxPosition:i.max})),this._lastAllocation=r,this._startEl.style.flexBasis=`${Math.max(1,a)}px`,this._startEl.style.flexGrow=`0`,this._endEl.style.flexGrow=this.getAttribute(`resize-end-child`)===`false`?`0`:`1`,this._applyMinimum(this._startEl,`shrink-start-child`,e),this._applyMinimum(this._endEl,`shrink-end-child`,e);let o=a!==0,s=a!==r;this._startEl.hidden=!o,this._endEl.hidden=!s,this._handleEl.hidden=!o||!s,this.classList.toggle(`horizontal`,e),this.classList.toggle(`vertical`,!e),this._handleEl.classList.toggle(`wide`,this.wideHandle),this._handleEl.setAttribute(`aria-orientation`,this.orientation),this._handleEl.setAttribute(`aria-valuemin`,`0`),this._handleEl.setAttribute(`aria-valuemax`,String(e?this.clientWidth:this.clientHeight)),this._handleEl.setAttribute(`aria-valuenow`,String(a))}_sizeRequest(e,t){let n=e.style.flexGrow,r=e.style.flexShrink,i=e.style.flexBasis;e.style.flex=`none`;let a=t?e.offsetWidth:e.offsetHeight;return e.style.flexGrow=n,e.style.flexShrink=r,e.style.flexBasis=i,a}_applyMinimum(e,t,n){let r=this.getAttribute(t)!==`false`;e.style.minWidth=n&&r?`0`:``,e.style.minHeight=n?``:r?`0`:``}_notify(e,t){this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:t}))}get _isRtl(){return this.orientation===`horizontal`&&this.matches(`:dir(rtl)`)}_onPointerDown=e=>{if(e.button!==0||this._handleEl.hidden)return;this._dragging=!0,this._handleEl.setPointerCapture(e.pointerId);let t=this.orientation===`horizontal`,n=this._handleEl.getBoundingClientRect(),r=t?e.clientX:e.clientY,i=t?n.left:n.top;this._dragPos=r-i-(this.wideHandle?0:6),this._handleEl.addEventListener(`pointermove`,this._onPointerMove),this._handleEl.addEventListener(`pointerup`,this._onPointerUp),this._handleEl.addEventListener(`pointercancel`,this._onPointerUp)};_onPointerMove=e=>{if(!this._dragging)return;let t=this.orientation===`horizontal`,n=(t?e.clientX:e.clientY)-this._dragPos,r=t?this._handleEl.offsetWidth:this._handleEl.offsetHeight,i=this._isRtl?(t?this.clientWidth:this.clientHeight)-n-r:n;this.setPosition(glibClamp(Math.round(i),this._minPosition,this._maxPosition))};_onPointerUp=e=>{this._dragging&&(this._dragging=!1,this._handleEl.hasPointerCapture(e.pointerId)&&this._handleEl.releasePointerCapture(e.pointerId),this._handleEl.removeEventListener(`pointermove`,this._onPointerMove),this._handleEl.removeEventListener(`pointerup`,this._onPointerUp),this._handleEl.removeEventListener(`pointercancel`,this._onPointerUp))};_onKeyDown=e=>{if(e.altKey||e.metaKey||e.shiftKey)return;if(e.key===`Escape`){this.dispatchEvent(new CustomEvent(`cancel-position`,{bubbles:!0,detail:{}}));return}if(e.key===`Enter`||e.key===` `){this.dispatchEvent(new CustomEvent(`accept-position`,{bubbles:!0,detail:{}}));return}let t=0,n=null;switch(e.key){case`ArrowLeft`:t=e.ctrlKey?-75:-1;break;case`ArrowRight`:t=e.ctrlKey?75:1;break;case`ArrowUp`:t=e.ctrlKey?-75:-1;break;case`ArrowDown`:t=e.ctrlKey?75:1;break;case`PageUp`:t=-75;break;case`PageDown`:t=75;break;case`Home`:n=`start`;break;case`End`:n=`end`;break;default:return}e.preventDefault();let r;n===`start`?r=this._minPosition:n===`end`?r=this._maxPosition:(this._isRtl&&(t=-t),r=this._position+t),this.setPosition(glibClamp(r,this._minPosition,this._maxPosition))}};customElements.define(`gtk-paned`,GtkPaned);var GtkPasswordEntry=class extends GtkEntry{_entry=new EntryRowState;_password=new PasswordEntryRowState(this._entry);_toggle;_peekIcon;_capsLock;static get observedAttributes(){return[...GtkEntry.observedAttributes,`show-peek-icon`]}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)}connectedCallback(){super.connectedCallback(),this._input.type=`password`,this._input.autocomplete=`new-password`,this._capsLock=document.createElement(`span`),this._capsLock.className=`adw-password-entry-caps-lock`,this._capsLock.textContent=`⇪`,this._capsLock.setAttribute(`role`,`alert`),this._toggle=document.createElement(`button`),this._toggle.type=`button`,this._toggle.className=`adw-button flat circular icon-only adw-password-entry-peek`,this._peekIcon=createGtkImage(null,`adw-password-entry-peek-icon`),this._toggle.append(this._peekIcon),this._toggle.addEventListener(`click`,()=>this._password.togglePeek()),this._toggle.addEventListener(`mousedown`,e=>e.preventDefault());let readCapsLock=e=>this._password.setCapsLockOn(e.getModifierState(`CapsLock`));this._input.addEventListener(`keydown`,readCapsLock),this._input.addEventListener(`keyup`,readCapsLock),this._input.addEventListener(`focus`,()=>{this._entry.setEditing(!0),this._passwordChanged()}),this._input.addEventListener(`blur`,()=>{this._entry.setEditing(!1),this._passwordChanged()}),this.replaceChildren(this._capsLock,this._input,this._toggle),this._toggle.hidden=!this.hasAttribute(`show-peek-icon`),this._applyPassword(this._password.state),this._password.subscribe(e=>{this._applyPassword(e),this.dispatchEvent(new CustomEvent(`notify::revealed`,{bubbles:!0,detail:{revealed:e.revealed}}))})}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),e===`show-peek-icon`&&this._toggle&&(this._toggle.hidden=n===null)}_passwordChanged(){this._applyPassword(this._password.state)}_applyPassword(e){this._input.type=e.revealed?`text`:`password`,this._peekIcon.dataset.iconName=e.peekIconName,this._peekIcon.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`),this._capsLock.dataset.iconName=e.indicatorIconName,this._capsLock.title=e.indicatorTooltip,this._capsLock.setAttribute(`aria-label`,e.indicatorTooltip),this._capsLock.hidden=!this._entry.state.indicatorVisible}};customElements.define(`gtk-password-entry`,GtkPasswordEntry);const _i=[`fill`,`contain`,`cover`,`scale-down`];function normalizePictureContentFit(e){return _i.includes(e)?e:`contain`}var GtkPicture=class extends HTMLElement{_initialized=!1;static get observedAttributes(){return[`alternative-text`,`can-shrink`,`content-fit`,`isolate-contents`,`keep-aspect-ratio`]}get alternativeText(){return this.getAttribute(`alternative-text`)??``}set alternativeText(e){this._write(`alternative-text`,e)}get canShrink(){return!this.hasAttribute(`can-shrink`)||this.getAttribute(`can-shrink`)!==`false`}set canShrink(e){this._toggle(`can-shrink`,e,!0)}get contentFit(){return normalizePictureContentFit(this.getAttribute(`content-fit`))}set contentFit(e){this._write(`content-fit`,e)}get isolateContents(){return!this.hasAttribute(`isolate-contents`)||this.getAttribute(`isolate-contents`)!==`false`}set isolateContents(e){this._toggle(`isolate-contents`,e,!0)}get keepAspectRatio(){return this.contentFit!==`fill`}set keepAspectRatio(e){this.contentFit=e?`contain`:`fill`}_write(e,t){this.getAttribute(e)!==t&&this.setAttribute(e,t)}_toggle(e,t,n){let r=t?``:`false`;if(n){t?this.removeAttribute(e):this._write(e,r);return}this._write(e,r)}connectedCallback(){if(this._initialized){this._render();return}this._initialized=!0,this.setAttribute(`role`,`img`),this._render()}attributeChangedCallback(e,t,n){this._initialized&&(this._render(),e===`content-fit`&&(t===`fill`||n===`fill`)&&this.dispatchEvent(new CustomEvent(`notify::keep-aspect-ratio`,{bubbles:!0,detail:{"keep-aspect-ratio":this.keepAspectRatio}})),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}})))}_property(e){switch(e){case`alternative-text`:return this.alternativeText;case`can-shrink`:return this.canShrink;case`isolate-contents`:return this.isolateContents;case`keep-aspect-ratio`:return this.keepAspectRatio;default:return this.contentFit}}_render(){this.style.setProperty(`--gtk-picture-content-fit`,this.contentFit),this.classList.toggle(`can-shrink`,this.canShrink),this.classList.toggle(`isolated`,this.isolateContents),this.alternativeText?this.setAttribute(`aria-label`,this.alternativeText):this.removeAttribute(`aria-label`)}};customElements.define(`gtk-picture`,GtkPicture);const vi=`main`;var GtkPopoverMenu=class extends GtkPopover{_model=[];_actions=null;_menuView;_menuInitialized=!1;static get observedAttributes(){return[...GtkPopover.observedAttributes,`menu-model`,`menu-title`,`visible-submenu`]}get menuModel(){return this._model}set menuModel(e){this._model=normalizeMenuModel(e),assertMenuRenderable(this._model,E),this._menuInitialized&&this._renderMenu()}get actions(){return this._actions}set actions(e){this._actions=e??null,this._menuView?.setActions(this._actions),this._menuInitialized&&this._renderMenu()}get menuTitle(){return this.getAttribute(`menu-title`)??``}set menuTitle(e){this.setAttribute(`menu-title`,e??``)}get visibleSubmenu(){let e=this._openPageLabel();return e===null?vi:e}set visibleSubmenu(e){this.openSubmenu(e)}connectedCallback(){super.connectedCallback(),!this._menuInitialized&&(this._menuInitialized=!0,this.classList.add(`adw-popover-menu`),this.setAttribute(`role`,`menu`),this.setAttribute(`menu`,``),this._menuView=new PopoverMenuView(this,`adw-popover-menu`,e=>this._activate(e)),this._menuView.setActions(this._actions),this._model.length===0&&(this._model=this._parseMenuAttr()),this._renderMenu(),this.subscribe(e=>{e?(this._menuView.setActions(this._actions??menuActionsOfElement(this,this._model)),this._menuView.render(),this._menuView.focusableRows[0]?.focus()):this._menuView.reset()}))}attributeChangedCallback(e,t,n){if(super.attributeChangedCallback(e,t,n),this._menuInitialized){if(e===`menu-model`){this._model=this._parseMenuAttr(),this._renderMenu();return}if(e===`menu-title`){this._menuView.setTitle(this.menuTitle),this._menuView.render();return}e===`visible-submenu`&&this._navigate(n??vi)}}openSubmenu(e){this._navigate(e)}_navigate(e){let t=this.visibleSubmenu;if(!this._showPage(e))return;let n=this.visibleSubmenu;this._reflectSubmenu(),n!==t&&this.dispatchEvent(new CustomEvent(`notify::visible-submenu`,{bubbles:!0,detail:{visibleSubmenu:n}}))}_showPage(e){if(e===vi||e.length===0)this._menuView.reset();else{let t=this._findSubmenu(e);if(t===null)return!1;this._menuView.setMenuModel(this._model),this._menuView.showPage(t)}return this._menuView.render(),!0}closeSubmenus(){this.openSubmenu(vi)}_openPageLabel(){let e=this._menuView.page;if(e.length===0)return null;let t=menuNodeAt(this._model,e);return t!==null&&t.kind!==`item`?t.label:null}_findSubmenu(e){let walk=(t,n)=>{for(let[r,i]of t.entries()){if(i.kind===`item`)continue;let t=[...n,r];if(i.label===e)return t;let a=walk(i.items,t);if(a!==null)return a}return null};return walk(this._model,[])}_reflectSubmenu(){let e=this.visibleSubmenu;this.getAttribute(`visible-submenu`)!==e&&this.setAttribute(`visible-submenu`,e)}_activate(e){let t=menuItemAt(this._model,e);this.popdown(),this.anchor?.focus(),t!==null&&(activateElementMenuItem(this,t),this.dispatchEvent(new CustomEvent(`menu-item-activated`,{bubbles:!0,detail:{id:t.id??t.label,label:t.label,path:[...e]}})))}_renderMenu(){this._menuView.setMenuModel(this._model),this._menuView.setTitle(this.menuTitle),this._menuView.render(),this._model.length===0&&this.popdown()}_parseMenuAttr(){let e=normalizeMenuModel(parseMenuModel(this.getAttribute(`menu-model`))),t=menuRefusals(e,E);if(t.length===0)return e;console.error(`${E.name} cannot render this menu, so it has none:`);for(let e of t)console.error(` [${e.path.join(`.`)}] ${e.message}`);return[]}};customElements.define(`gtk-popover-menu`,GtkPopoverMenu);var GtkPopoverBin=class extends HTMLElement{_model=[];_popover=null;_actions=null;_initialized=!1;_longPressTimer=null;static get observedAttributes(){return[`menu-model`,`handle-input`]}get menuModel(){return this._model}set menuModel(e){this._model=normalizeMenuModel(e),assertMenuRenderable(this._model,E),this._adoptPopover(this._buildPopover()),this._notifyModel()}get popoverElement(){return this._popover}set popoverElement(e){this._model=[],this._adoptPopover(e),this._notifyModel()}get handleInput(){return this.hasAttribute(`handle-input`)}set handleInput(e){this.toggleAttribute(`handle-input`,!!e)}get actions(){return this._actions}set actions(e){this._actions=e??null,this._popover!==null&&(this._popover.actions=this._actions)}connectedCallback(){this._initialized||(this._initialized=!0,this.classList.add(`adw-popover-bin`),this.addEventListener(`contextmenu`,e=>this._onContextMenu(e)),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),this._wireGestures(),this._model.length===0&&(this._model=this._parseMenuAttr()),this._model.length>0&&this._adoptPopover(this._buildPopover()))}disconnectedCallback(){this._cancelLongPress()}attributeChangedCallback(e){if(this._initialized){if(e===`handle-input`){this.handleInput||this._cancelLongPress();return}e===`menu-model`&&(this._model=this._parseMenuAttr(),this._adoptPopover(this._model.length>0?this._buildPopover():null),this._notifyModel())}}popup(){this.dispatchEvent(new CustomEvent(`menu.popup`,{bubbles:!0}));let e=this._popover;e!==null&&(e.open=!0)}popdown(){this._popover?.popdown()}get childElement(){let e=this.firstElementChild;return e===null||e===this._popover?null:e}_wireGestures(){this.addEventListener(`pointerdown`,e=>{!this.handleInput||this._popover===null||(this._cancelLongPress(),e.pointerType===`touch`&&(this._longPressTimer=setTimeout(()=>{this._longPressTimer=null,this._popupAt(e)},500)))}),this.addEventListener(`pointerup`,()=>this._cancelLongPress()),this.addEventListener(`pointercancel`,()=>this._cancelLongPress())}_cancelLongPress(){this._longPressTimer!==null&&(clearTimeout(this._longPressTimer),this._longPressTimer=null)}_onContextMenu(e){!this.handleInput||this._popover===null||(e.preventDefault(),this._popupAt(e))}_popupAt(e){let t=this._popover;t!==null&&(t.open=!0)}_onKeyDown(e){e.key!==`ContextMenu`&&e.key!==`F10`||e.shiftKey||this._popover!==null&&(e.preventDefault(),this.popup())}_buildPopover(){if(this._model.length===0)return null;let e=document.createElement(`gtk-popover-menu`);return e.setAttribute(`position`,`bottom`),e.setAttribute(`align`,`start`),e.menuModel=this._model,e.actions=this._actions,e.anchor=this,e}_adoptPopover(e){let t=this._popover;t!==null&&t!==e&&(t.popdown(),t.remove()),this._popover=e;let n=this.childElement;if(e===null){n?.classList.remove(`has-open-popup`);return}e.subscribe(e=>{n?.classList.toggle(`has-open-popup`,e)}),this.appendChild(e)}_notifyModel(){this.dispatchEvent(new CustomEvent(`notify::menu-model`,{bubbles:!0,detail:{menuModel:this._model,popover:this._popover}}))}_parseMenuAttr(){let e=normalizeMenuModel(parseMenuModel(this.getAttribute(`menu-model`))),t=menuRefusals(e,E);if(t.length===0)return e;console.error(`${E.name} cannot render this menu, so it has none:`);for(let e of t)console.error(` [${e.path.join(`.`)}] ${e.message}`);return[]}};customElements.define(`gtk-popover-bin`,GtkPopoverBin);var GtkPopoverMenuBar=class extends HTMLElement{_model=[];_actions=null;_items=[];_active=null;_initialized=!1;static get observedAttributes(){return[`menu-model`]}get menuModel(){return this._model}set menuModel(e){this._model=normalizeMenuModel(e),assertMenuRenderable(this._model,E),this._initialized&&this._rebuild()}get actions(){return this._actions}set actions(e){this._actions=e??null,this._initialized&&this._rebuild()}get activeItem(){return this._active?.button??null}connectedCallback(){this._initialized||(this._initialized=!0,this.classList.add(`adw-popover-menu-bar`),this.setAttribute(`role`,`menubar`),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),this.addEventListener(`pointerleave`,()=>{this._active!==null&&!this._active.popover.open&&this._setActive(null,!1)}),this._model.length===0&&(this._model=this._parseMenuAttr()),this._rebuild())}attributeChangedCallback(e){!this._initialized||e!==`menu-model`||(this._model=this._parseMenuAttr(),this._rebuild())}selectFirst(){this._setActive(this._items[0]??null,!0)}popup(){this.selectFirst()}_setActive(e,t){let n=e!==this._active,r=this._active!==null&&this._active.popover.open;r&&n&&this._active?.popover.popdown(),n&&(this._active?.button.classList.remove(`selected`),this._active=e,e?.button.classList.add(`selected`)),this._active!==null&&(t||r&&n?this._active.popover.open=!0:n&&this.matches(`:focus-within`)&&this._active.button.focus())}_onKeyDown(e){this._active?.popover.open!==!0&&(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`||(e.preventDefault(),this._move(e.key===`ArrowRight`?1:-1)))}_move(e){let t=this._items.length;if(t===0)return;let n=(this._active===null?-1:this._items.indexOf(this._active))+e;n<0&&(n=t-1),n>=t&&(n=0),this._setActive(this._items[n],!1)}_rebuild(){this._items=[],this._active=null;let e=[];this._model.forEach((t,n)=>{t.kind===`submenu`&&e.push(this._buildItem(t,[n]))}),this._items=e,this.replaceChildren(...e.map(e=>e.root))}_focusFirstRow(e){e.querySelector(`.adw-popover-item:not([hidden]):not([disabled])`)?.focus()}_buildItem(e,t){let n=document.createElement(`div`);n.className=`adw-popover-menu-bar-item`,n.setAttribute(`role`,`none`);let r=document.createElement(`button`);r.type=`button`,r.className=`adw-popover-menu-bar-button`,r.setAttribute(`role`,`menuitem`),r.setAttribute(`aria-haspopup`,`menu`),r.setAttribute(`aria-expanded`,`false`);let i=document.createElement(`span`);i.className=`adw-popover-menu-bar-label`,i.textContent=e.label,r.appendChild(i);let a=document.createElement(`gtk-popover-menu`);a.setAttribute(`position`,`bottom`),a.setAttribute(`align`,`start`),a.menuModel=e.items,a.actions=this._actions,a.anchor=r,r.setAttribute(`aria-controls`,`popover`);let o={node:e,path:t,root:n,button:r,popover:a};return a.subscribe(e=>{if(r.setAttribute(`aria-expanded`,String(e)),e){for(let e of this._items)e.root.classList.toggle(`active`,e===o);this._focusFirstRow(a)}else o.root.classList.remove(`active`),this._active===o&&(this._active=null)}),a.addEventListener(`menu-item-activated`,e=>{e.stopPropagation();let n=e.detail;this._activate(o,[...t,...n.path])}),r.addEventListener(`click`,()=>this._setActive(o,!0)),n.addEventListener(`pointerenter`,()=>this._setActive(o,!1)),n.append(r,a),o}_activate(e,t){let n=menuItemAt(this._model,t);e.popover.popdown(),e.button.focus(),n!==null&&this.dispatchEvent(new CustomEvent(`menu-item-activated`,{bubbles:!0,detail:{id:n.id??n.label,label:n.label,path:[...t]}}))}_parseMenuAttr(){let e=normalizeMenuModel(parseMenuModel(this.getAttribute(`menu-model`))),t=menuRefusals(e,E);if(t.length>0){console.error(`${E.name} cannot render this menu, so it has none:`);for(let e of t)console.error(` [${e.path.join(`.`)}] ${e.message}`);return[]}for(let[t,n]of e.entries())n.kind!==`submenu`&&console.warn(`Don't know how to handle this item: top-level entry ${t} is a ${n.kind}.`);return e}};customElements.define(`gtk-popover-menu-bar`,GtkPopoverMenuBar);const yi=[`collate`,`copies`,`generate-pdf`,`generate-ps`,`number-up`,`number-up-layout`,`page-set`,`preview`,`reverse`,`scale`],bi=[`General`,`Page Setup`,`Job`,`Image Quality`,`Color`,`Finishing`,`Advanced`],xi=[`All sheets`,`Even sheets`,`Odd sheets`],Si=[`portrait`,`landscape`,`reverse-portrait`,`reverse-landscape`],Ci={copies:`1`,collate:`0`,reverse:`0`,"page-set":`0`,scale:`100`,orientation:`portrait`};var GtkPrintUnixDialog=class extends AdwDialog{_built=!1;_printers=[];_selected=null;_settings={...Ci};_pageSetup=defaultPageSetup();_printerListEl;_switcherEl;_panelEl;_tabPages=new Map;_tab=`General`;_currentPage=-1;_supportSelection=!1;_hasSelection=!1;_manual=new Set;_range=`all`;_printAt=`now`;_printButton;_previewButton;_conflictsEl;_capabilityControls=new Map;_collateCheck;_reverseCheck;_copiesInput;_paperDrop;_orientationDrop;_pageRangeInput;_selectionRadio;_currentPageRadio;_rangeRadios=new Map;_atInput=null;static get observedAttributes(){return[...AdwDialog.observedAttributes,`current-page`,`embed-page-setup`,`has-selection`,`manual-capabilities`,`support-selection`]}get currentPage(){return this._currentPage}set currentPage(e){this._currentPage=e,this._built&&this._renderPrint()}get embedPageSetup(){return this.hasAttribute(`embed-page-setup`)}set embedPageSetup(e){this.toggleAttribute(`embed-page-setup`,e),this._built&&this._renderPrint()}get hasSelection(){return this._hasSelection}set hasSelection(e){this._hasSelection=e,this._built&&this._renderPrint()}get supportSelection(){return this.hasAttribute(`support-selection`)}set supportSelection(e){this.toggleAttribute(`support-selection`,e),this._built&&this._renderPrint()}get manualCapabilities(){return[...this._manual]}set manualCapabilities(e){this._manual=new Set(e.filter(e=>yi.includes(e))),this._built&&this._renderPrint()}get selectedPrinter(){return this._selected===null?null:{...this._selected}}get pageSetup(){return{...this._pageSetup}}set pageSetup(e){this._pageSetup=e,this._built&&this._renderPrint()}get printSettings(){return{...this._settings}}set printSettings(e){this._settings={...Ci,...e},this._built&&this._renderPrint()}get range(){return this._range}set range(e){if(this._range=e,!this._built)return;let t=this._rangeRadios.get(e);t!==void 0&&(t.checked=!0),this._renderPrint()}get printers(){return this._printers.map(e=>({...e}))}set printers(e){this._printers=e.map(e=>({...e})),this._selected=null,this._built&&this._renderPrint()}connectedCallback(){if(this._built){super.connectedCallback();return}this._switcherEl=document.createElement(`div`),this._switcherEl.className=`adw-print-switcher`,this._switcherEl.setAttribute(`role`,`tablist`),super.connectedCallback(),this.hasAttribute(`title`)||this.setAttribute(`title`,`Print`),this._readManual();let e=[...this.contentArea.childNodes];this.contentArea.replaceChildren(this._build());for(let t of e)this.contentArea.appendChild(t);this._renderPrint(),this._built=!0}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),!(!this._built||t===n)&&e!==`title`&&(e===`manual-capabilities`&&this._readManual(),this._renderPrint())}_readManual(){this._manual=new Set((this.getAttribute(`manual-capabilities`)??``).split(`|`).map(e=>e.trim()).filter(e=>yi.includes(e)))}decorateHeader(e){let t=e.querySelector(`.adw-dialog-title`);t===null?e.prepend(this._switcherEl):t.replaceWith(this._switcherEl)}_build(){let e=document.createElement(`div`);return e.className=`adw-print-root`,this._panelEl=document.createElement(`div`),this._panelEl.className=`adw-print-panel`,this._panelEl.setAttribute(`role`,`tabpanel`),e.append(this._panelEl,this._buildConflicts(),this._buildActions()),this._renderPanel(),e}_renderPanel(){for(let e of bi){let t=this._tabPages.get(e);t===void 0&&(t=document.createElement(`div`),t.className=`adw-print-page`,t.setAttribute(`role`,`tabpanel`),t.dataset.tab=e,t.appendChild(this._buildTab(e)),this._tabPages.set(e,t),this._panelEl.appendChild(t)),t.hidden=e!==this._tab}}_buildTab(e){switch(e){case`General`:return this._buildGeneral();case`Page Setup`:return this._buildPageSetup();case`Job`:return this._buildJob();case`Image Quality`:case`Color`:case`Finishing`:return this._buildOptionsPage(e);case`Advanced`:return this._buildOptionsPage(e)}}_buildGeneral(){let e=document.createElement(`div`);e.className=`adw-print-columns`,this._printerListEl=document.createElement(`div`),this._printerListEl.className=`adw-print-printer-list`,this._printerListEl.setAttribute(`role`,`radiogroup`),this._printerListEl.setAttribute(`aria-label`,`Printer`),e.appendChild(this._frame(this._printerListEl));let t=document.createElement(`div`);t.className=`adw-print-column`;let n=this._group(`Range`),r=n.body;for(let[e,t]of[[`all`,`All Pages`],[`current`,`Current Page`],[`selection`,`Selection`]]){let n=this._radio(t,`adw-print-range-${e}`);n.addEventListener(`notify::checked`,()=>{n.checked&&(this._range=e,(e===`current`||e===`selection`)&&this._renderPrint())}),e===`current`&&(this._currentPageRadio=n),e===`selection`&&(this._selectionRadio=n),this._rangeRadios.set(e,n),r.appendChild(n)}let i=this._radio(`Pages:`,`adw-print-range-pages`);i.addEventListener(`notify::checked`,()=>{i.checked&&(this._range=`pages`,this._pageRangeInput.focus())}),this._pageRangeInput=document.createElement(`input`),this._pageRangeInput.type=`text`,this._pageRangeInput.className=`adw-print-page-range-entry`,this._pageRangeInput.title=`Specify one or more page ranges, e.g. 1–3, 7, 11`,this._pageRangeInput.setAttribute(`aria-label`,`Pages`),this._pageRangeInput.addEventListener(`focus`,()=>{this._range=`pages`,i.checked=!0}),this._rangeRadios.set(`pages`,i);let a=document.createElement(`div`);a.className=`adw-print-grid-row`,a.append(i,this._pageRangeInput),r.appendChild(a),t.appendChild(n.group);let o=this._group(`Copies`),s=o.body,c=document.createElement(`div`);c.className=`adw-print-grid-row`;let l=document.createElement(`div`);l.className=`adw-print-label`,l.textContent=`Copies:`,this._copiesInput=document.createElement(`input`),this._copiesInput.type=`number`,this._copiesInput.min=`1`,this._copiesInput.className=`adw-print-copies`,this._copiesInput.value=this._settings.copies??`1`,this._copiesInput.setAttribute(`aria-label`,`Copies`),this._copiesInput.addEventListener(`input`,()=>{this._settings={...this._settings,copies:this._copiesInput.value},this._renderPrint()}),c.append(l,this._copiesInput),s.appendChild(c),this._collateCheck=this._check(`Collate`,`adw-print-collate`),this._reverseCheck=this._check(`Reverse`,`adw-print-reverse`);for(let e of[this._collateCheck,this._reverseCheck])e.addEventListener(`notify::checked`,()=>this._renderPrint());s.append(this._collateCheck,this._reverseCheck);let u=this._buildCollatePreview(),d=document.createElement(`div`);return d.className=`adw-print-grid-row`,d.appendChild(u),s.appendChild(d),t.appendChild(o.group),e.appendChild(t),e}_buildCollatePreview(){let e=document.createElement(`div`);return e.className=`adw-print-collate-preview`,e.setAttribute(`role`,`img`),e.setAttribute(`aria-label`,`A visualization of the effect of the collate and reverse options on the page ordering`),e.dataset.columnA=`2`,e.dataset.columnB=`1`,e}_buildPageSetup(){let e=document.createElement(`div`);e.className=`adw-print-columns`;let t=document.createElement(`div`);t.className=`adw-print-column`;let n=this._group(`Layout`),r=n.body;r.appendChild(this._labelledRow(`Two-sided:`,this._dropDown(xi,`Two-sided`)));let i=document.createElement(`input`);i.type=`number`,i.min=`10`,i.max=`400`,i.className=`adw-print-scale`,i.value=this._settings.scale??`100`,i.setAttribute(`aria-label`,`Scale in percent`),i.addEventListener(`input`,()=>{this._settings={...this._settings,scale:i.value},this._renderPrint()}),this._capabilityControls.set(`scale`,i);let a=document.createElement(`div`);a.className=`adw-print-grid-row`;let o=document.createElement(`div`);o.className=`adw-print-label`,o.textContent=`Scale:`;let s=document.createElement(`span`);s.className=`adw-print-label`,s.textContent=`%`,a.append(o,i,s),r.appendChild(a),t.appendChild(n.group);let c=this._group(`Paper`),l=c.body,u=G.map(e=>e.displayName);return this._paperDrop=this._dropDown(u,`Paper size`),this._orientationDrop=this._dropDown(Si.map(e=>e[0].toUpperCase()+e.slice(1)),`Orientation`),l.appendChild(this._labelledRow(`Paper size:`,this._paperDrop)),l.appendChild(this._labelledRow(`Orientation:`,this._orientationDrop)),t.appendChild(c.group),this._paperDrop.addEventListener(`notify::selected`,()=>{this.embedPageSetup&&this._paperChanged(this._paperDrop.selected)}),this._orientationDrop.addEventListener(`notify::selected`,()=>{if(!this.embedPageSetup)return;let e=Si[this._orientationDrop.selected]??`portrait`;this._pageSetup={...this._pageSetup,orientation:e},this._settings={...this._settings,orientation:e},this._renderPrint()}),e.append(t,this._buildSheetPreview()),e}_buildSheetPreview(){let e=document.createElement(`div`);e.className=`adw-print-sheet-preview`,e.setAttribute(`role`,`img`),e.setAttribute(`aria-label`,`Page layout preview`);let t=document.createElement(`div`);t.className=`adw-print-paper`;let n=paperSizeOf(this._pageSetup),r=this._pageSetup.orientation===`landscape`||this._pageSetup.orientation===`reverse-landscape`;t.style.aspectRatio=r?`${n.height} / ${n.width}`:`${n.width} / ${n.height}`;let i=document.createElement(`div`);i.className=`adw-print-number-up`,i.dataset.cells=`1`,t.appendChild(i),e.appendChild(t);let a=document.createElement(`div`);return a.className=`adw-print-sheet-caption`,a.textContent=`${orientedSize(this._pageSetup).width.toFixed(1)} mm × ${orientedSize(this._pageSetup).height.toFixed(1)} mm`,e.appendChild(a),e}_buildJob(){let e=document.createElement(`div`);e.className=`adw-print-column`;let t=this._group(`Job Details`);t.body.appendChild(this._optionsGrid(`Job Details`));let n=this._group(`Print Document`),r=n.body;for(let[e,t]of[[`now`,`Now`],[`at`,`At:`],[`hold`,`On hold`]]){let n=this._radio(t,`adw-print-at`);if(n.addEventListener(`notify::checked`,()=>{n.checked&&(this._printAt=e,this._atInput!==null&&(this._atInput.disabled=e!==`at`),e===`at`&&this._atInput?.focus())}),r.appendChild(n),e===`at`){this._atInput=document.createElement(`input`),this._atInput.type=`text`,this._atInput.className=`adw-print-at-entry`,this._atInput.setAttribute(`aria-label`,`Print at`),this._atInput.disabled=!0,this._atInput.addEventListener(`input`,()=>{this._settings={...this._settings,"print-at":this._atInput.value}});let e=document.createElement(`div`);e.className=`adw-print-grid-row`,e.appendChild(this._atInput),r.appendChild(e)}}let i=this._group(`Add Cover Page`);return i.body.appendChild(this._optionsGrid(`Cover Page`)),e.append(t.group,n.group,i.group),e}_buildOptionsPage(e){let t=document.createElement(`div`);t.className=`adw-print-column`;let n=this._optionsGrid(e);if(e===`Advanced`){let e=document.createElement(`div`);return e.className=`adw-print-advanced`,e.appendChild(n),t.appendChild(e),t}return t.appendChild(n),t}_optionsGrid(e){let t=document.createElement(`div`);return t.className=`adw-print-options-grid`,t.setAttribute(`role`,`group`),t.setAttribute(`aria-label`,e),t.dataset.empty=`true`,t}_buildConflicts(){return this._conflictsEl=document.createElement(`div`),this._conflictsEl.className=`adw-print-conflicts`,this._conflictsEl.hidden=!0,this._conflictsEl.append(createGtkImage(`dialog-warning`,`adw-print-conflicts-icon`),(()=>{let e=document.createElement(`span`);return e.className=`adw-print-conflicts-label`,e.textContent=`Some of the settings in the dialog conflict`,e})()),this._conflictsEl}_buildActions(){let e=document.createElement(`div`);e.className=`adw-print-actions`,this._previewButton=document.createElement(`button`),this._previewButton.type=`button`,this._previewButton.className=`adw-print-preview`,this._previewButton.textContent=`Preview`,this._previewButton.addEventListener(`click`,()=>this._respond(-10));let t=document.createElement(`button`);return t.type=`button`,t.className=`adw-print-cancel`,t.textContent=`Cancel`,t.addEventListener(`click`,()=>this._respond(-6)),this._printButton=document.createElement(`button`),this._printButton.type=`button`,this._printButton.className=`adw-print-print suggested-action`,this._printButton.textContent=`Print`,this._printButton.addEventListener(`click`,()=>this._respond(-5)),e.append(this._previewButton,t,this._printButton),e}_respond(e){this.dispatchEvent(new CustomEvent(`response`,{bubbles:!0,detail:{responseId:e}})),e!==-5&&this.close()}_group(e){let t=document.createElement(`div`);t.className=`adw-print-group`;let n=document.createElement(`div`);n.className=`adw-print-group-title`,n.textContent=e;let r=document.createElement(`div`);return r.className=`adw-print-group-body`,t.append(n,r),{group:t,body:r}}_labelledRow(e,t,n){let r=document.createElement(`div`);r.className=`adw-print-grid-row`;let i=document.createElement(`div`);return i.className=`adw-print-label`,i.textContent=e,r.append(i,t),n!==void 0&&this._capabilityControls.set(n,t),r}_dropDown(e,t){let n=document.createElement(`gtk-drop-down`);return n.className=`adw-print-dropdown`,n.setAttribute(`model`,JSON.stringify([...e])),n.setAttribute(`aria-label`,t),n}_radio(e,t){let n=document.createElement(`adw-radio`);return n.className=t,n.setAttribute(`label`,e),n.setAttribute(`name`,t),n.setAttribute(`value`,e),n}_check(e,t){let n=document.createElement(`gtk-check-button`);return n.className=t,n.setAttribute(`label`,e),n.setAttribute(`name`,t),n}_frame(e){let t=document.createElement(`div`);return t.className=`adw-print-frame`,t.appendChild(e),t}_printerChanged(e){this._selected=e,e!==null&&(this._settings={...this._settings,"format-for-printer":e.name}),this._renderPrint()}_paperChanged(e){let t=G[e];t!==void 0&&(this._pageSetup={...this._pageSetup,paperSize:t.name,margins:defaultMargins(t)},this._renderPrint())}_capabilities(){let e=new Set(this._manual);for(let t of this._selected?.capabilities??[])e.add(t);return e}_renderPrint(){let e=this._capabilities();this._switcherEl.replaceChildren(...bi.map(e=>{let t=document.createElement(`button`);return t.type=`button`,t.className=`adw-print-switcher-item`,t.setAttribute(`role`,`tab`),t.textContent=e,t.classList.toggle(`checked`,e===this._tab),t.setAttribute(`aria-selected`,String(e===this._tab)),t.addEventListener(`click`,()=>{this._tab=e,this._renderPanel(),this._renderPrint()}),t})),this._printerListEl.replaceChildren(...this._printers.map(e=>{let t=document.createElement(`button`);t.type=`button`,t.className=`adw-print-printer-row`,t.setAttribute(`role`,`radio`),t.setAttribute(`aria-checked`,String(e===this._selected)),t.classList.toggle(`checked`,e===this._selected),t.appendChild(e.iconName===void 0?createGtkImage(`printer`,`adw-print-printer-icon`):createGtkImage(e.iconName,`adw-print-printer-icon`));let n=document.createElement(`span`);n.className=`adw-print-printer-text`;let r=document.createElement(`span`);if(r.className=`adw-print-printer-name`,r.textContent=e.name,n.appendChild(r),e.location!==void 0){let t=document.createElement(`span`);t.className=`adw-print-printer-location`,t.textContent=e.location,n.appendChild(t)}return t.appendChild(n),t.addEventListener(`click`,()=>this._printerChanged(e)),t})),this._selectionRadio.hidden=!this.supportSelection,this._selectionRadio.classList.toggle(`insensitive`,!this.supportSelection||!this._hasSelection),this._selectionRadio.setAttribute(`aria-disabled`,String(!this.supportSelection||!this._hasSelection)),this._currentPageRadio.classList.toggle(`insensitive`,this._currentPage===-1),this._currentPageRadio.setAttribute(`aria-disabled`,String(this._currentPage===-1));for(let[t,n]of this._capabilityControls)n.toggleAttribute(`disabled`,!e.has(t));let t=Number.parseInt(this._copiesInput.value,10),n=this._copiesInput.value!==``&&Number.isFinite(t)&&t>1;this._collateCheck.toggleAttribute(`disabled`,!n||!e.has(`collate`)),this._reverseCheck.toggleAttribute(`disabled`,!e.has(`reverse`)),this._copiesInput.toggleAttribute(`disabled`,!e.has(`copies`)),this._paperDrop.toggleAttribute(`disabled`,!this.embedPageSetup),this._orientationDrop.toggleAttribute(`disabled`,!this.embedPageSetup);let r=this._collateCheck.checked,i=this._reverseCheck.checked,a=this.contentArea.querySelector(`.adw-print-collate-preview`);a!==null&&(a.dataset.columnA=String(r?i?1:2:i?2:1),a.dataset.columnB=String(r?i?2:1:i?1:2),a.dataset.secondColumn=String(n));let o=this._selected!==null&&(this._selected.acceptsJobs??!0);this._printButton.toggleAttribute(`disabled`,!o),this._previewButton.hidden=!e.has(`preview`);let s=this.contentArea.querySelector(`.adw-print-paper`);if(s!==null){let e=paperSizeOf(this._pageSetup),t=this._pageSetup.orientation===`reverse-portrait`;s.style.aspectRatio=`${this._pageSetup.orientation===`landscape`||t?`${e.height} / ${e.width}`:`${e.width} / ${e.height}`}`}let c=this.contentArea.querySelector(`.adw-print-number-up`);c!==null&&(c.dataset.cells=`1`),this._conflictsEl.hidden=!0}};customElements.define(`gtk-print-unix-dialog`,GtkPrintUnixDialog);var GtkProgressBar=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(`gtk-progress-bar`,GtkProgressBar);const wi=[`none`,`crossfade`,`slide-right`,`slide-left`,`slide-up`,`slide-down`,`swing-right`,`swing-left`,`swing-up`,`swing-down`,`fade-slide-right`,`fade-slide-left`,`fade-slide-up`,`fade-slide-down`],Ti=new Set([`slide-right`,`slide-left`,`fade-slide-right`,`fade-slide-left`]),Ei=new Set([`slide-up`,`slide-down`,`fade-slide-up`,`fade-slide-down`]),Di=new Set([`swing-right`,`swing-left`]),Oi=new Set([`swing-up`,`swing-down`]),ki=new Set([`crossfade`,`fade-slide-right`,`fade-slide-left`,`fade-slide-up`,`fade-slide-down`]),Ai={"slide-left":`slide-right`,"slide-right":`slide-left`,"swing-left":`swing-right`,"swing-right":`swing-left`,"fade-slide-left":`fade-slide-right`,"fade-slide-right":`fade-slide-left`};var GtkRevealer=class extends HTMLElement{_clipEl;_initialized=!1;_position=0;_target=0;_frame=0;_startedAt=0;_naturalWidth=0;_naturalHeight=0;_resize=null;static get observedAttributes(){return[`reveal-child`,`transition-type`,`transition-duration`]}get revealChild(){return this.hasAttribute(`reveal-child`)}set revealChild(e){this.toggleAttribute(`reveal-child`,!!e)}get childRevealed(){return this._position===this._target?this.revealChild:!this.revealChild}get transitionType(){let e=this.getAttribute(`transition-type`);return wi.includes(e)?e:`slide-down`}set transitionType(e){this.setAttribute(`transition-type`,e)}get transitionDuration(){let e=Number.parseFloat(this.getAttribute(`transition-duration`)??``);return Number.isFinite(e)&&e>=0?e:250}set transitionDuration(e){this.setAttribute(`transition-duration`,String(e))}get child(){return this._clipEl?.firstElementChild??null}connectedCallback(){if(this._initialized){this._observeChild(),this._render();return}this._initialized=!0,this.setAttribute(`role`,`group`),this._clipEl=document.createElement(`div`),this._clipEl.className=`adw-revealer-clip`,bindSlottedChildren(this,[{name:`child`,into:this._clipEl},{into:this._clipEl}],()=>this._observeChild()).install(this._clipEl),this._observeChild(),this._animate(this.revealChild),this._render()}disconnectedCallback(){this._finish(),this._resize?.disconnect(),this._resize=null}attributeChangedCallback(e,t,n){if(!this._initialized)return;if(e===`reveal-child`){if(!this._animate(n!==null))return;this.dispatchEvent(new CustomEvent(`notify::reveal-child`,{bubbles:!0,detail:{revealChild:this.revealChild}}));return}this._render();let r=e===`transition-duration`?{transitionDuration:this.transitionDuration}:{transitionType:this.transitionType};this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:r}))}_observeChild(){this._resize?.disconnect(),this._resize=new ResizeObserver(e=>{for(let t of e){let e=t.borderBoxSize?.[0];this._naturalWidth=e?e.inlineSize:t.contentRect.width,this._naturalHeight=e?e.blockSize:t.contentRect.height}this._render()}),this._resize.observe(this._clipEl);let e=this._clipEl.firstElementChild;e&&this._resize.observe(e)}_animate(e){let t=+!!e;if(this._target===t)return!1;this._target=t;let n=this.effectiveTransition,r=globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1;if(this.transitionDuration===0||n===`none`||r||!this.isConnected)return this._finish(),this._setPosition(t),!0;let i=this._position;return this._startedAt=performance.now(),this._frame===0&&(this._frame=requestAnimationFrame(()=>this._tick(i))),!0}_tick(e){this._frame=0;let t=this.transitionDuration,n=performance.now()-this._startedAt,r=t<=0?1:Math.min(1,n/t),i=easeOutCubic(r);this._setPosition(e+i*(this._target-e)),r<1&&(this._frame=requestAnimationFrame(()=>this._tick(e)))}_finish(){this._frame!==0&&(cancelAnimationFrame(this._frame),this._frame=0)}get effectiveTransition(){let e=this.transitionType;return this.matches(`:dir(rtl)`)?Ai[e]??e:e}_scale(e){let t=this.effectiveTransition,n=e===`horizontal`?Ti:Ei,r=e===`horizontal`?Di:Oi;return n.has(t)?this._position:r.has(t)?Math.sin(Math.PI*this._position/2):1}_setPosition(e){this._position=e,this._render(),this._position===this._target&&this.dispatchEvent(new CustomEvent(`notify::child-revealed`,{bubbles:!0,detail:{childRevealed:this.childRevealed}}))}_render(){let e=this._clipEl.firstElementChild;e&&this._naturalHeight===0&&(this._naturalWidth=e.offsetWidth,this._naturalHeight=e.offsetHeight);let t=this._position,n=this._scale(`horizontal`),r=this._scale(`vertical`),i=this.effectiveTransition;if(this._clipEl.style.width=n<1?`${Math.ceil(this._naturalWidth*n)}px`:``,this._clipEl.style.height=r<1?`${Math.ceil(this._naturalHeight*r)}px`:``,e){let a=this._naturalWidth,o=this._naturalHeight,s=a*n,c=o*r,l=2*Math.max(s,c),u=90*(1-t),d=``;switch(i){case`slide-right`:case`fade-slide-right`:d=`translateX(${s-a}px)`;break;case`slide-down`:case`fade-slide-down`:d=`translateY(${c-o}px)`;break;case`swing-right`:d=`translate(0, ${c/2}px) perspective(${l}px) rotateY(${u}deg) translate(0, ${-o/2}px)`;break;case`swing-left`:d=`translate(${s}px, ${c/2}px) perspective(${l}px) rotateY(${-u}deg) translate(${-a}px, ${-o/2}px)`;break;case`swing-down`:d=`translate(${s/2}px, 0) perspective(${l}px) rotateX(${-u}deg) translate(${-a/2}px, 0)`;break;case`swing-up`:d=`translate(${s/2}px, ${c}px) perspective(${l}px) rotateX(${u}deg) translate(${-a/2}px, ${-o}px)`;break;default:break}e.style.transform=d,e.style.transformOrigin=d===``?``:`0 0`,e.style.opacity=ki.has(i)?String(t):``}this.classList.toggle(`revealed`,t>0)}};customElements.define(`gtk-revealer`,GtkRevealer);const ji=[`left`,`right`,`top`,`bottom`];function seededRange(e,t){let n=normalizeAdjustment(parseAdjustment(e));if(t===null)return n;let r=Number.parseFloat(t);return Number.isFinite(r)?{...n,value:r}:n}function formatScaleValue(e,t){let n=e.toFixed(t);return n.startsWith(`-`)&&Number.parseFloat(n)===0?n.slice(1):n}var GtkScale=class extends HTMLElement{_range=new SpinState;_trough;_highlight;_fill;_slider;_value;_initialized=!1;_pointerId=null;static get observedAttributes(){return[`adjustment`,`digits`,`disabled`,`draw-value`,`fill-level`,`has-origin`,`inverted`,`orientation`,`restrict-to-fill-level`,`round-digits`,`show-fill-level`,`value`,`value-pos`]}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this.setAttribute(`orientation`,e)}get adjustment(){return this._range.adjustment}set adjustment(e){this._range.configure(typeof e==`string`?parseAdjustment(e):e),this._render()}get value(){return this._range.value}set value(e){this._setValue(e,!1)}get inverted(){return this.hasAttribute(`inverted`)}set inverted(e){this.toggleAttribute(`inverted`,!!e)}get drawValue(){return this.hasAttribute(`draw-value`)}set drawValue(e){this.toggleAttribute(`draw-value`,!!e)}get valuePos(){let e=this.getAttribute(`value-pos`);return ji.includes(e)?e:`top`}set valuePos(e){this.setAttribute(`value-pos`,e)}get hasOrigin(){return!this.hasAttribute(`has-origin`)||this.getAttribute(`has-origin`)!==`false`}set hasOrigin(e){this.toggleAttribute(`has-origin`,!!e)}get digits(){let e=Number.parseInt(this.getAttribute(`digits`)??``,10);return Number.isFinite(e)?Math.max(0,e):1}set digits(e){this.setAttribute(`digits`,String(e))}get fillLevel(){let e=Number.parseFloat(this.getAttribute(`fill-level`)??``);return Number.isFinite(e)?e:0}set fillLevel(e){this.setAttribute(`fill-level`,String(e))}get showFillLevel(){return this.hasAttribute(`show-fill-level`)}set showFillLevel(e){this.toggleAttribute(`show-fill-level`,!!e)}get restrictToFillLevel(){return this.hasAttribute(`restrict-to-fill-level`)}set restrictToFillLevel(e){this.toggleAttribute(`restrict-to-fill-level`,!!e)}get slider(){return this._slider}connectedCallback(){this._initialized||(this._initialized=!0,this._range.configure(seededRange(this.getAttribute(`adjustment`),this.getAttribute(`value`))),this._trough=document.createElement(`span`),this._trough.className=`adw-scale-trough`,this._highlight=document.createElement(`span`),this._highlight.className=`adw-scale-highlight`,this._fill=document.createElement(`span`),this._fill.className=`adw-scale-fill`,this._slider=document.createElement(`span`),this._slider.className=`adw-scale-slider`,this._trough.append(this._fill,this._highlight,this._slider),this._value=document.createElement(`span`),this._value.className=`adw-scale-value`,this.replaceChildren(this._trough,this._value),this.setAttribute(`role`,`slider`),this.hasAttribute(`tabindex`)||this.setAttribute(`tabindex`,`0`),this._trough.addEventListener(`pointerdown`,e=>this._onPointerDown(e)),this._value.addEventListener(`pointerdown`,e=>this._onPointerDown(e)),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),this.addEventListener(`pointermove`,e=>this._onPointerMove(e)),this.addEventListener(`pointerup`,e=>this._onPointerUp(e)),this.addEventListener(`pointercancel`,e=>this._onPointerUp(e)),this._range.subscribe(e=>{this._render(),this.dispatchEvent(new CustomEvent(`value-changed`,{bubbles:!0,detail:{value:e.value}}))}),this._range.subscribeChanged(()=>this._render()),this._render())}attributeChangedCallback(e){if(this._initialized){if(e===`adjustment`){this._range.configure(parseAdjustment(this.getAttribute(`adjustment`)));return}if(e===`value`){this._range.setValue(Number.parseFloat(this.getAttribute(`value`)??`0`));return}this._render()}}_setValue(e,t){let n=e;this.restrictToFillLevel&&(n=Math.min(n,Math.max(this.adjustment.lower,this.fillLevel)));let r=Number.parseInt(this.getAttribute(`round-digits`)??``,10);if(Number.isFinite(r)&&r!==-1){let e=10**r;n=Math.floor(n*e+.5)/e}return t?this._range.setValueInteractive(n):this._range.setValue(n)}_valueAtCoord(e){let t=this.adjustment,n=this.orientation===`horizontal`?this._trough.clientWidth:this._trough.clientHeight,r=n===0?1:glibClamp(e/n,0,1);return this._shouldInvert()&&(r=1-r),t.lower+r*(t.upper-t.lower-t.pageSize)}_shouldInvert(){let e=this.closest(`[dir="rtl"]`)!==null;return this.orientation===`horizontal`?this.inverted?!e:e:this.inverted}_onPointerDown(e){if(this.hasAttribute(`disabled`)||e.button!==0)return;let t=this._trough.getBoundingClientRect(),n=this.orientation===`horizontal`?e.clientX-t.left:e.clientY-t.top;this._pointerId=e.pointerId,this.focus(),this._setValue(this._valueAtCoord(n),!0);try{this.setPointerCapture(e.pointerId)}catch{}e.preventDefault()}_onPointerMove(e){if(this._pointerId!==e.pointerId)return;let t=this._trough.getBoundingClientRect(),n=this.orientation===`horizontal`?e.clientX-t.left:e.clientY-t.top;this._setValue(this._valueAtCoord(n),!0)}_onPointerUp(e){this._pointerId===e.pointerId&&(this._pointerId=null,this.hasPointerCapture(e.pointerId)&&this.releasePointerCapture(e.pointerId))}_onKeyDown(e){if(this.hasAttribute(`disabled`))return;let t=this.adjustment,n=e.ctrlKey,r=null;switch(e.key){case`ArrowLeft`:r=this.value-(n?t.pageIncrement:t.stepIncrement);break;case`ArrowRight`:r=this.value+(n?t.pageIncrement:t.stepIncrement);break;case`ArrowDown`:r=this.value-(n?t.pageIncrement:t.stepIncrement);break;case`ArrowUp`:r=this.value+(n?t.pageIncrement:t.stepIncrement);break;case`PageUp`:r=this.value+t.pageIncrement;break;case`PageDown`:r=this.value-t.pageIncrement;break;case`Home`:r=t.lower;break;case`End`:r=t.upper-t.pageSize;break;case`+`:case`=`:r=this.value+(n?t.pageIncrement:t.stepIncrement);break;case`-`:r=this.value-(n?t.pageIncrement:t.stepIncrement);break;default:return}e.preventDefault(),this._setValue(r,!0)}_render(){if(!this._trough)return;let e=this.orientation,t=this.adjustment,n=t.upper-t.lower-t.pageSize,r=n===0?0:(t.value-t.lower)/n,i=glibClamp(this._shouldInvert()?1-r:r,0,1);this.classList.toggle(`horizontal`,e===`horizontal`),this.classList.toggle(`vertical`,e===`vertical`),this.setAttribute(`aria-orientation`,e),e===`horizontal`?this._slider.style.left=`${i*100}%`:this._slider.style.bottom=`${i*100}%`,this._slider.style.top=``,this._slider.style.right=``;let a=this.hasOrigin;this._highlight.hidden=!a,a&&(e===`horizontal`?(this._highlight.style.right=``,this._highlight.style.width=`${i*100}%`):(this._highlight.style.width=``,this._highlight.style.height=`${i*100}%`));let o=this.showFillLevel;if(this._fill.hidden=!o,o){let r=glibClamp((this.fillLevel-t.lower)/(n||1),0,1);e===`horizontal`?this._fill.style.width=`${r*100}%`:this._fill.style.height=`${r*100}%`}this._value.textContent=formatScaleValue(t.value,this.digits),this._value.hidden=!this.drawValue;let s=this.valuePos;this._value.classList.toggle(`left`,s===`left`),this._value.classList.toggle(`right`,s===`right`),this._value.classList.toggle(`top`,s===`top`),this._value.classList.toggle(`bottom`,s===`bottom`),this.classList.toggle(`value-top`,s===`top`),this.classList.toggle(`value-right`,s===`right`),this.classList.toggle(`value-bottom`,s===`bottom`),this.classList.toggle(`value-left`,s===`left`),this.setAttribute(`aria-valuemin`,String(t.lower)),this.setAttribute(`aria-valuemax`,String(t.upper-t.pageSize)),this.setAttribute(`aria-valuenow`,String(t.value)),this.setAttribute(`aria-valuetext`,this._value.textContent??``),this.hasAttribute(`disabled`)?this.setAttribute(`aria-disabled`,`true`):this.removeAttribute(`aria-disabled`)}};customElements.define(`gtk-scale`,GtkScale);const Mi={lower:0,upper:100,stepIncrement:2,pageIncrement:20,pageSize:0};var GtkScaleButton=class extends HTMLElement{_state=new SpinState;_buttonEl;_glyph;_dockEl;_rangeEl;_minusEl;_plusEl;_icons=[];_initialized=!1;_syncing=!1;static get observedAttributes(){return[`value`,`icons`,`adjustment`,`has-frame`,`orientation`]}get value(){return this._state.value}set value(e){this._applyValue(e)}get active(){return this._buttonEl?.classList.contains(`checked`)??!1}get icons(){return[...this._icons]}set icons(e){this.setAttribute(`icons`,JSON.stringify(e))}get hasFrame(){return this.hasAttribute(`has-frame`)}set hasFrame(e){this.toggleAttribute(`has-frame`,!!e)}get orientation(){return this.getAttribute(`orientation`)===`horizontal`?`horizontal`:`vertical`}set orientation(e){this.setAttribute(`orientation`,e)}connectedCallback(){if(this._initialized)return;this._initialized=!0,this.setAttribute(`role`,`group`),this._glyph=createGtkImage(`image-missing`,`scale-button-glyph`),this._buttonEl=document.createElement(`button`),this._buttonEl.type=`button`,this._buttonEl.className=`adw-button scale-button-icon flat`,this._buttonEl.setAttribute(`aria-expanded`,`false`),this._buttonEl.appendChild(this._glyph),this._minusEl=this._stepButton(`list-remove-symbolic`,`Decrease`),this._plusEl=this._stepButton(`list-add-symbolic`,`Increase`),this._rangeEl=document.createElement(`input`),this._rangeEl.type=`range`,this._rangeEl.className=`scale-button-range`,this._rangeEl.addEventListener(`input`,()=>{this._syncing||this._applyValue(Number(this._rangeEl.value))});let e=document.createElement(`div`);e.className=`scale-button-box`,e.append(this._minusEl,this._rangeEl,this._plusEl),this._dockEl=document.createElement(`gtk-popover`),this._dockEl.classList.add(`scale-popup`),this._dockEl.replaceChildren(e),this._dockEl.anchor=this._buttonEl,this.replaceChildren(this._buttonEl,this._dockEl),this._buttonEl.addEventListener(`click`,()=>this._toggleDock()),this._minusEl.addEventListener(`click`,()=>this._step(-1)),this._plusEl.addEventListener(`click`,()=>this._step(1)),this._dockEl.subscribe(e=>this._renderDock(e)),this.addEventListener(`wheel`,e=>{e.deltaY!==0&&(e.preventDefault(),this._applyValue(this._state.value-Math.sign(e.deltaY)*this._state.adjustment.stepIncrement))},{passive:!1}),this.addEventListener(`keydown`,e=>this._onKeyDown(e)),this._icons=parseIcons(this.getAttribute(`icons`)),this._syncAdjustment(),this._render()}attributeChangedCallback(e){if(this._initialized){if(e===`adjustment`){this._syncAdjustment();return}if(e===`icons`){this._icons=parseIcons(this.getAttribute(`icons`)),this._render(),this.dispatchEvent(new CustomEvent(`notify::icons`,{bubbles:!0}));return}if(e===`value`){let e=this.getAttribute(`value`);if(e===null||e.trim()===``)return;let t=Number(e);Number.isFinite(t)&&this._applyValue(t);return}this._render()}}_applyValue(e){let t=this._state.setValue(e);if(this._render(),!t)return;let n=this._state.value;this.setAttribute(`value`,String(n)),this.dispatchEvent(new CustomEvent(`value-changed`,{bubbles:!0,detail:{value:n}})),this.dispatchEvent(new CustomEvent(`notify::value`,{bubbles:!0,detail:{value:n}}))}_syncAdjustment(){let e=parseAdjustment(this.getAttribute(`adjustment`)),t={...Mi,...e},n=this.getAttribute(`value`),r=n===null||n.trim()===``?NaN:Number(n);t.value=Number.isFinite(r)?r:this._state.value,this._state.configure(t),this._render(),this.dispatchEvent(new CustomEvent(`notify::adjustment`,{bubbles:!0}))}_render(){if(!this._initialized)return;let e=this._state.value,[t,n]=adjustmentRange(this._state.adjustment),r=selectIcon(this._icons,e,t,n);this._glyph.getAttribute(`icon-name`)!==r&&this._glyph.setAttribute(`icon-name`,r),this._buttonEl.setAttribute(`aria-label`,r),this._syncing=!0,this._rangeEl.min=String(t),this._rangeEl.max=String(n),this._rangeEl.step=String(this._state.adjustment.stepIncrement),this._rangeEl.value=String(e),this._rangeEl.setAttribute(`aria-valuemin`,String(t)),this._rangeEl.setAttribute(`aria-valuemax`,String(n)),this._rangeEl.setAttribute(`aria-valuenow`,String(e)),this._syncing=!1,this._minusEl.disabled=!(t<e),this._plusEl.disabled=!(e<n),this._buttonEl.classList.toggle(`flat`,!this.hasFrame),this.classList.toggle(`horizontal`,this.orientation===`horizontal`),this.classList.toggle(`vertical`,this.orientation===`vertical`)}_stepButton(e,t){let n=document.createElement(`button`);return n.type=`button`,n.className=`adw-button scale-button-step flat`,n.setAttribute(`aria-label`,t),n.appendChild(createGtkImage(e)),n}_toggleDock(){this.active?this._dock(`popdown`):this._dock(`popup`)}_dock(e){let t=e===`popup`;this.active!==t&&(this._buttonEl.classList.toggle(`checked`,t),this._buttonEl.setAttribute(`aria-expanded`,String(t)),t?(this._dockEl.popup(),this._rangeEl.focus()):(this._dockEl.popdown(),this._buttonEl.focus()),this.dispatchEvent(new CustomEvent(e,{bubbles:!0})),this.dispatchEvent(new CustomEvent(`notify::active`,{bubbles:!0,detail:{active:t}})))}_renderDock(e){this._dock(e?`popup`:`popdown`)}_step(e){this._applyValue(this._state.value+e*this._state.adjustment.pageIncrement)}_onKeyDown(e){if(e.key===`Escape`){if(!this.active)return;e.preventDefault(),this._dock(`popdown`);return}e.target===this._buttonEl&&(e.key!==` `&&e.key!==`Enter`&&e.key!==`Return`||(e.preventDefault(),this._toggleDock()))}};customElements.define(`gtk-scale-button`,GtkScaleButton);function selectIcon(e,t,n,r){let i=e[0];if(i===void 0||i===``)return`image-missing`;if(e.length===1)return i;if(e.length===2)return t<(r-n)/2+n?i:e[1]??i;if(t===n)return i;if(t===r)return e[1]??i;let a=(r-n)/(e.length-2);return e[Math.floor((t-n)/a)+2]??i}function parseIcons(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return[]}return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}var GtkSearchBar=class extends HTMLElement{_box;_center;_close;_initialized=!1;_capture=null;_onCapturedKey=e=>this._captureKey(e);_onInput=()=>this._revealFromTyping();static get observedAttributes(){return[`search-mode-enabled`,`show-close-button`]}get searchModeEnabled(){return this.hasAttribute(`search-mode-enabled`)}set searchModeEnabled(e){this.toggleAttribute(`search-mode-enabled`,!!e)}get showCloseButton(){return this.hasAttribute(`show-close-button`)}set showCloseButton(e){this.toggleAttribute(`show-close-button`,!!e)}get keyCaptureWidget(){return this._capture}set keyCaptureWidget(e){this._capture!==e&&(this._capture?.removeEventListener(`keydown`,this._onCapturedKey,!0),this._capture=e,this._capture?.addEventListener(`keydown`,this._onCapturedKey,!0))}get entry(){return this.querySelector(`input, textarea`)}connectedCallback(){this._initialized||(this._initialized=!0,this.setAttribute(`role`,`search`),this._center=document.createElement(`div`),this._center.className=`adw-search-bar-center`,this._center.append(...this.childNodes),this._close=document.createElement(`button`),this._close.className=`adw-search-bar-close`,this._close.type=`button`,this._close.setAttribute(`aria-label`,`Close search`),this._close.addEventListener(`click`,()=>this.searchModeEnabled=!1),this._box=document.createElement(`div`),this._box.className=`adw-search-bar-box`,this._box.append(this._center,this._close),this.replaceChildren(this._box),this.addEventListener(`input`,this._onInput),this.addEventListener(`keydown`,e=>{e.key===`Escape`&&(this.searchModeEnabled=!1)}),this._render())}disconnectedCallback(){this.keyCaptureWidget=null}attributeChangedCallback(e,t,n){if(this._initialized){if(e===`search-mode-enabled`){this._applyReveal(),this.dispatchEvent(new CustomEvent(`notify::search-mode-enabled`,{bubbles:!0,detail:{searchModeEnabled:this.searchModeEnabled}}));return}e===`show-close-button`&&(this._render(),this.dispatchEvent(new CustomEvent(`notify::show-close-button`,{bubbles:!0,detail:{showCloseButton:this.showCloseButton}})))}}_render(){let e=this.searchModeEnabled;this.classList.toggle(`revealed`,e),this._box.inert=!e,this._close.hidden=!this.showCloseButton}_applyReveal(){this._render();let e=this.entry;e!==null&&(this.searchModeEnabled?e.focus():e.value=``)}_revealFromTyping(){this.searchModeEnabled||(this.searchModeEnabled=!0,this.entry?.focus())}_captureKey(e){if(e.defaultPrevented||e.ctrlKey||e.altKey||e.metaKey||e.key.length!==1)return;let t=this.entry;if(this.searchModeEnabled=!0,t===null)return;e.preventDefault(),t.focus();let n=t.selectionStart??t.value.length,r=t.selectionEnd??n;t.setRangeText(e.key,n,r,`end`)}};customElements.define(`gtk-search-bar`,GtkSearchBar);var GtkSearchEntry=class extends GtkEntry{_searchIcon;_clear;_clearIcon;_timeout=null;static get observedAttributes(){return[...GtkEntry.observedAttributes,`search-delay`]}get searchDelay(){let e=Number.parseInt(this.getAttribute(`search-delay`)??``,10);return Number.isFinite(e)&&e>=0?e:150}set searchDelay(e){this.setAttribute(`search-delay`,String(e))}get _empty(){return this._input?this._input.value===``:this.getAttribute(`value`)===``}connectedCallback(){super.connectedCallback(),this._searchIcon=createGtkImage(`system-search-symbolic`,`adw-search-entry-icon`),this._clear=document.createElement(`button`),this._clear.type=`button`,this._clear.className=`adw-button flat circular icon-only adw-search-entry-clear`,this._clearIcon=createGtkImage(`edit-clear-symbolic`,`adw-search-entry-clear-icon`),this._clear.append(this._clearIcon),this._clear.title=`Clear Entry`,this._clear.setAttribute(`aria-label`,`Clear Entry`),this._clear.addEventListener(`click`,()=>{this._input.value=``,this._onChanged(),this._input.focus()}),this._clear.addEventListener(`mousedown`,e=>e.preventDefault()),this.replaceChildren(this._searchIcon,this._input,this._clear),this.setAttribute(`role`,`searchbox`),this._input.addEventListener(`input`,()=>this._onChanged()),this._input.addEventListener(`keydown`,e=>this._onKeyDown(e)),this._render()}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),e===`search-delay`&&this._clear&&this._cancel()}disconnectedCallback(){this._cancel(),super.disconnectedCallback()}_onChanged(){if(this._cancel(),this._empty){this._render(),this.dispatchEvent(new CustomEvent(`search-changed`,{bubbles:!0,detail:{value:``}}));return}this._render();let e=this.searchDelay;this._timeout=globalThis.setTimeout(()=>{this._timeout=null,this.dispatchEvent(new CustomEvent(`search-changed`,{bubbles:!0,detail:{value:this._input.value}}))},e)}_cancel(){this._timeout!==null&&(clearTimeout(this._timeout),this._timeout=null)}_onKeyDown(e){switch(e.key){case`Escape`:e.preventDefault(),this.dispatchEvent(new CustomEvent(`stop-search`,{bubbles:!0}));break;case`g`:if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault(),this.dispatchEvent(new CustomEvent(e.shiftKey?`previous-match`:`next-match`,{bubbles:!0}));break;default:return}}_render(){this._clear&&(this._clear.hidden=this._empty)}};customElements.define(`gtk-search-entry`,GtkSearchEntry);const Ni=[`always`,`never`,`automatic`,`external`],Pi=[`always`,`automatic`,`never`,`external`],Fi=[`top-left`,`top-right`,`bottom-left`,`bottom-right`];function normalizePolicy(e){return Ni.find(t=>t===e)??`automatic`}function normalizeCorner(e){return Fi.find(t=>t===e)??`top-left`}function sizeRequest(e){if(e===null)return null;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>=0?t:null}const Ii=[{key:`hadjustment`,bar:`horizontal`,policy:`hscrollbar-policy`,natural:`propagate-natural-width`,cssMin:`minWidth`,end:`left`,farEnd:`right`},{key:`vadjustment`,bar:`vertical`,policy:`vscrollbar-policy`,natural:`propagate-natural-height`,cssMin:`minHeight`,end:`top`,farEnd:`bottom`}];function resolveScrollKey(e){switch(e.key){case`ArrowLeft`:return e.ctrlKey?{scroll:`step-backward`,horizontal:!0}:null;case`ArrowRight`:return e.ctrlKey?{scroll:`step-forward`,horizontal:!0}:null;case`ArrowUp`:return e.ctrlKey?{scroll:`step-backward`,horizontal:!1}:null;case`ArrowDown`:return e.ctrlKey?{scroll:`step-forward`,horizontal:!1}:null;case`PageUp`:return{scroll:`page-backward`,horizontal:e.ctrlKey};case`PageDown`:return{scroll:`page-forward`,horizontal:e.ctrlKey};case`Home`:return{scroll:`start`,horizontal:e.ctrlKey};case`End`:return{scroll:`end`,horizontal:e.ctrlKey};default:return null}}var GtkScrolledWindow=class extends HTMLElement{_viewport;_bars=null;_wroteSizes=new Set;_shading=null;_observer=null;_hoverable=null;_fadeTimer=null;_built=!1;_standIn={};_adopted={};static get observedAttributes(){return[`hscrollbar-policy`,`vscrollbar-policy`,`window-placement`,`has-frame`,`min-content-width`,`min-content-height`,`max-content-width`,`max-content-height`,`overlay-scrolling`,`propagate-natural-width`,`propagate-natural-height`]}get hscrollbarPolicy(){return normalizePolicy(this.getAttribute(`hscrollbar-policy`))}set hscrollbarPolicy(e){this.setAttribute(`hscrollbar-policy`,e)}get vscrollbarPolicy(){return normalizePolicy(this.getAttribute(`vscrollbar-policy`))}set vscrollbarPolicy(e){this.setAttribute(`vscrollbar-policy`,e)}get_policy(){return[Pi.indexOf(this.hscrollbarPolicy),Pi.indexOf(this.vscrollbarPolicy)]}set_policy(e,t){let nick=(e,t)=>{let n=Number.isInteger(e)?Pi[e]:void 0;if(n===void 0)throw TypeError(`${e} is not a valid value for enum argument ${t}`);return n},n=nick(e,`hscrollbar_policy`),r=nick(t,`vscrollbar_policy`);this.hscrollbarPolicy=n,this.vscrollbarPolicy=r}get hadjustment(){return this._adopted.hadjustment??this._viewport?.hadjustment??(this._standIn.hadjustment??=new GtkAdjustment)}get vadjustment(){return this._adopted.vadjustment??this._viewport?.vadjustment??(this._standIn.vadjustment??=new GtkAdjustment)}get_hadjustment(){return this.hadjustment}get_vadjustment(){return this.vadjustment}set_hadjustment(e){this._adopted.hadjustment=e}set_vadjustment(e){this._adopted.vadjustment=e}get windowPlacement(){return normalizeCorner(this.getAttribute(`window-placement`))}set windowPlacement(e){this.setAttribute(`window-placement`,e)}get hasFrame(){return this.hasAttribute(`has-frame`)}set hasFrame(e){this.toggleAttribute(`has-frame`,!!e)}get overlayScrolling(){return this.getAttribute(`overlay-scrolling`)!==`false`}set overlayScrolling(e){this.toggleAttribute(`overlay-scrolling`,!!e)}get minContentWidth(){return sizeRequest(this.getAttribute(`min-content-width`))}set minContentWidth(e){this._writeSizeRequest(`min-content-width`,e)}get minContentHeight(){return sizeRequest(this.getAttribute(`min-content-height`))}set minContentHeight(e){this._writeSizeRequest(`min-content-height`,e)}get maxContentWidth(){return sizeRequest(this.getAttribute(`max-content-width`))}set maxContentWidth(e){this._writeSizeRequest(`max-content-width`,e)}get maxContentHeight(){return sizeRequest(this.getAttribute(`max-content-height`))}set maxContentHeight(e){this._writeSizeRequest(`max-content-height`,e)}get propagateNaturalWidth(){return this.hasAttribute(`propagate-natural-width`)}set propagateNaturalWidth(e){this.toggleAttribute(`propagate-natural-width`,!!e)}get propagateNaturalHeight(){return this.hasAttribute(`propagate-natural-height`)}set propagateNaturalHeight(e){this.toggleAttribute(`propagate-natural-height`,!!e)}hscrollbar(){return this._bars?.horizontal??null}vscrollbar(){return this._bars?.vertical??null}get viewport(){return this._viewport}connectedCallback(){if(!this._built){this._built=!0,this._viewport=document.createElement(`gtk-viewport`);let e=document.createElement(`gtk-scrollbar`),t=document.createElement(`gtk-scrollbar`);e.setAttribute(`orientation`,`horizontal`),t.setAttribute(`orientation`,`vertical`),this._bars={horizontal:e,vertical:t},bindSlottedChildren(this,[{into:this._viewport}]).install(this._viewport,t,e),this.setAttribute(`role`,`generic`),this._viewport.addEventListener(`value-changed`,this._onViewportValue);for(let n of[e,t])n.addEventListener(`value-changed`,this._onBarValue),n.addEventListener(`pointerenter`,this._onIndicatorOver),n.addEventListener(`pointerleave`,this._onIndicatorOut);this._observer=new ResizeObserver(()=>this._sync()),this._observer.observe(this._viewport),this._shading=new AdwScrollShading(this,{onOvershoot:e=>this._edgeOvershot(e)}),this._shading.connect()}this._releaseHoverable(),this._hoverable=matchMedia(`(hover: hover)`),this._hoverable.addEventListener(`change`,this._onHoverableChange),this.addEventListener(`keydown`,this._onKeyDown),this._sync()}disconnectedCallback(){this.removeEventListener(`keydown`,this._onKeyDown),this._releaseHoverable()}attributeChangedCallback(e,t,n){!this._built||!this.isConnected||(this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._normalized(e,n)}})),this._sync())}_normalized(e,t){switch(e){case`hscrollbar-policy`:return normalizePolicy(t);case`vscrollbar-policy`:return normalizePolicy(t);case`window-placement`:return normalizeCorner(t);case`overlay-scrolling`:return t!==`false`;case`has-frame`:return t!==null;case`propagate-natural-width`:case`propagate-natural-height`:return t!==null;default:return sizeRequest(t)}}_writeSizeRequest(e,t){t===null?this.removeAttribute(e):this.setAttribute(e,String(Math.max(0,Math.trunc(t))))}get _useIndicators(){return this.overlayScrolling&&(this._hoverable?.matches??!0)}_sync(){let e=this._bars;if(e===null||!this._viewport.isConnected||!e.vertical.isConnected)return;let t=this.windowPlacement,n=this._useIndicators;this.classList.toggle(`frame`,this.hasFrame),this.classList.toggle(t,!0);for(let e of Fi)e!==t&&this.classList.toggle(e,!1);this.classList.toggle(`overlay-scrolling`,n),this._writeSize(`min-width`,`min-content-width`),this._writeSize(`min-height`,`min-content-height`),this._writeSize(`max-width`,`max-content-width`),this._writeSize(`max-height`,`max-content-height`);for(let t of Ii){let r=e[t.bar],i=normalizePolicy(this.getAttribute(t.policy)),a=this._adjustment(t.key);r.hidden=!(i===`always`||i===`automatic`&&a.upper-a.lower>a.pageSize),r.classList.toggle(`overlay-indicator`,n),r.adjustment=a,this._viewport.style[t.cssMin]=this.hasAttribute(t.natural)?`max-content`:i===`never`?`min-content`:``}n||this._clearFade()}_writeSize(e,t){let n=sizeRequest(this.getAttribute(t));n===null?this._wroteSizes.has(e)&&this.style.removeProperty(e):this.style.setProperty(e,`${n}px`),n===null?this._wroteSizes.delete(e):this._wroteSizes.add(e)}_adjustment(e){return this._viewport[e]}_mayScroll(e){let t=this._bars;if(t===null)return null;let n=e?t.horizontal:t.vertical;return n.hidden?normalizePolicy(this.getAttribute(e?`hscrollbar-policy`:`vscrollbar-policy`))===`external`?n:null:n}_onViewportValue=e=>{let t=this._bars;if(t===null)return;let n=e.detail;for(let e of Ii){let r=n[e.key];t[e.bar].adjustment=r;let i=r.upper-r.pageSize;r.value<=r.lower?this._edgeReached(e.end):r.value>=i&&this._edgeReached(e.farEnd)}this._fadeIn()};_onBarValue=e=>{let t=e.currentTarget,n=e.detail.adjustment;t.hidden||this._viewport.scrollAxis(t.getAttribute(`orientation`)===`vertical`?`vertical`:`horizontal`,n.value)};_edgeReached(e){this.dispatchEvent(new CustomEvent(`edge-reached`,{bubbles:!0,detail:{pos:e}}))}_edgeOvershot(e){e!==0&&this.dispatchEvent(new CustomEvent(`edge-overshot`,{bubbles:!0,detail:{pos:e<0?`top`:`bottom`}}))}_onKeyDown=e=>{if(e.key===`Tab`&&e.ctrlKey){let t=e.shiftKey?`backward`:`forward`;this.dispatchEvent(new CustomEvent(`move-focus-out`,{bubbles:!0,detail:{directionType:t}}));return}let t=resolveScrollKey(e);if(t===null)return;let n=this._mayScroll(t.horizontal);n!==null&&(e.preventDefault(),n.scrollBy(t.scroll),this.dispatchEvent(new CustomEvent(`scroll-child`,{bubbles:!0,detail:{scroll:t.scroll,horizontal:t.horizontal}})))};_fadeIn(){let e=this._bars;if(!(e===null||!this._useIndicators)){for(let t of[e.horizontal,e.vertical])t.style.setProperty(`--adw-indicator-opacity`,`1`);this._fadeTimer!==null&&clearTimeout(this._fadeTimer),this._fadeTimer=setTimeout(()=>this._fadeOut(),2e3)}}_fadeOut(){this._fadeTimer=null;let e=this._bars;if(!(e===null||!this._useIndicators))for(let t of[e.horizontal,e.vertical])t.classList.contains(`hovering`)||t.style.setProperty(`--adw-indicator-opacity`,`0`)}_clearFade(){this._fadeTimer!==null&&clearTimeout(this._fadeTimer),this._fadeTimer=null;let e=this._bars;if(e!==null)for(let t of[e.horizontal,e.vertical])t.style.removeProperty(`--adw-indicator-opacity`)}_onIndicatorOver=e=>{e.currentTarget.classList.add(`hovering`),this._fadeIn()};_onIndicatorOut=e=>{e.currentTarget.classList.remove(`hovering`)};_onHoverableChange=()=>{this._sync()};_releaseHoverable(){this._hoverable?.removeEventListener(`change`,this._onHoverableChange),this._hoverable=null}};customElements.define(`gtk-scrolled-window`,GtkScrolledWindow);const Li=Object.freeze({value:0,lower:0,upper:0,stepIncrement:0,pageIncrement:0,pageSize:0});var GtkScrollbar=class extends HTMLElement{_trough;_slider;_observer=null;_built=!1;_adjustment=null;_grabPosition=0;_grabDelta=0;_zoom=!1;_dragging=!1;static get observedAttributes(){return[`orientation`,`adjustment`]}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this.setAttribute(`orientation`,e)}get adjustment(){return this._adjustment??Li}set adjustment(e){let t=e==null?null:typeof e==`string`?parseAdjustment(e):e;this._adjustment=t===null?null:normalizeAdjustment(t,this._adjustment??void 0),this._built&&(this._render(),this._notify(`adjustment`,{adjustment:this.adjustment}))}get value(){return this.adjustment.value}set value(e){let t=this._adjustment;if(t===null)return;let n=clampAdjustmentValue(t,e);n!==t.value&&(this._adjustment={...t,value:n},this._render(),this.dispatchEvent(new CustomEvent(`value-changed`,{bubbles:!0,detail:{adjustment:this._adjustment}})))}scrollBy(e){if(typeof e!=`string`)return;let t=this.adjustment;switch(e){case`step-forward`:this.value=t.value+t.stepIncrement;break;case`step-backward`:this.value=t.value-t.stepIncrement;break;case`page-forward`:this.value=t.value+t.pageIncrement;break;case`page-backward`:this.value=t.value-t.pageIncrement;break;case`start`:this.value=t.lower;break;case`end`:this.value=t.upper;break}}scrollByWheel(e,t){let n=t===1?48:100,r=n===0?0:e/n;this.scrollBy(r>=0?`page-forward`:`page-backward`)}get _troughLength(){return this.orientation===`vertical`?this._trough.clientHeight:this._trough.clientWidth}connectedCallback(){this._built||(this._built=!0,this._trough=document.createElement(`div`),this._trough.className=`adw-scrollbar-trough`,this._slider=document.createElement(`div`),this._slider.className=`adw-scrollbar-slider`,this._trough.appendChild(this._slider),this.replaceChildren(this._trough),this.addEventListener(`pointerdown`,this._onPointerDown),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`wheel`,this._onWheel,{passive:!0}),this.tabIndex=0,this._observer=new ResizeObserver(()=>this._render()),this._observer.observe(this._trough),this.setAttribute(`role`,`scrollbar`)),this.hasAttribute(`adjustment`)&&(this.adjustment=this.getAttribute(`adjustment`)),this._render()}attributeChangedCallback(e,t,n){if(!(!this._built||!this.isConnected)){if(e===`adjustment`){this.adjustment=n;return}this._notify(`orientation`,{orientation:this.orientation}),this._render()}}_notify(e,t){this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:t}))}_onPointerDown=e=>{if(!this.hasAttribute(`tabindex`))return;this.focus();let t=this._coordinate(e),n=e.target===this._slider;this._grabPosition=this._sliderPosition(),this._grabDelta=t-this._grabPosition,this._setZoom(n&&e.shiftKey),this._dragging=n,this._capture(e.pointerId),this.addEventListener(`pointermove`,this._onPointerMove),this.addEventListener(`pointerup`,this._onPointerEnd),this.addEventListener(`pointercancel`,this._onPointerEnd),!n&&(e.button===0&&!e.shiftKey?this.value=this._coordinateValue(t+this._sliderSize()/2):(e.button===1||e.button===0&&e.shiftKey)&&this.scrollBy(this._coordinateValue(t)>this.value?`page-forward`:`page-backward`))};_onPointerMove=e=>{if(!this._dragging)return;this._setZoom(e.shiftKey);let t=this._coordinate(e),n=this._zoom?this._zoomFactor():1;this.value=this._coordinateValue(this._grabPosition+n*(t-(this._grabDelta+this._grabPosition)))};_onPointerEnd=e=>{this._endDrag(e.pointerId)};_endDrag(e){this._dragging=!1,this._setZoom(!1),e!==void 0&&this.hasPointerCapture(e)&&this.releasePointerCapture(e),this.removeEventListener(`pointermove`,this._onPointerMove),this.removeEventListener(`pointerup`,this._onPointerEnd),this.removeEventListener(`pointercancel`,this._onPointerEnd)}_capture(e){try{this.setPointerCapture(e)}catch{}}_onKeyDown=e=>{let t=resolveRangeKey(e,this.orientation===`vertical`);t!==null&&(e.preventDefault(),this.scrollBy(t))};_onWheel=e=>{e.target!==this&&e.target!==this._trough||this.scrollByWheel(e.deltaY,e.deltaMode)};_setZoom(e){this._zoom!==e&&(this._zoom=e,this.classList.toggle(`fine-tune`,e))}_zoomFactor(){let e=this.adjustment,t=e.upper-e.lower-e.pageSize,n=t<=0?1:Math.min(1,this._troughLength/t);return n===1?.25:n}_render(){if(!this._built)return;let e=this.adjustment,t=this.orientation===`vertical`;this.classList.toggle(`vertical`,t),this.classList.toggle(`horizontal`,!t),this.setAttribute(`aria-orientation`,this.orientation),this.removeAttribute(`aria-disabled`),this.removeAttribute(`disabled`);let n=this._troughLength,r=e.upper-e.lower,i=r-e.pageSize;if(r===0)this._slider.style.removeProperty(`--adw-scrollbar-size`);else{let t=Math.min(n,n*(e.pageSize/r));this._slider.style.setProperty(`--adw-scrollbar-size`,`${t}px`)}let a=this._sliderSize(),o=Math.max(0,n-a),s=i===0?0:o*((e.value-e.lower)/i);this.setAttribute(`aria-valuemin`,String(e.lower)),this.setAttribute(`aria-valuemax`,String(e.upper-e.pageSize)),this.setAttribute(`aria-valuenow`,String(e.value)),this._slider.style.setProperty(`--adw-scrollbar-position`,`${s}px`)}_sliderPosition(){return Number.parseFloat(this._slider.style.getPropertyValue(`--adw-scrollbar-position`))||0}_sliderSize(){return Number.parseFloat(this._slider.style.getPropertyValue(`--adw-scrollbar-size`))||0}_coordinateValue(e){let t=this.adjustment,n=Math.max(1,this._troughLength-this._sliderSize()),r=Math.min(1,Math.max(0,e/n));return t.lower+r*(t.upper-t.pageSize-t.lower)}_coordinate(e){let t=this._trough.getBoundingClientRect();return this.orientation===`vertical`?e.clientY-t.top:e.clientX-t.left}};function resolveRangeKey(e,t){switch(e.key){case`ArrowRight`:return t?null:`step-forward`;case`ArrowLeft`:return t?null:`step-backward`;case`ArrowDown`:return t?`step-forward`:null;case`ArrowUp`:return t?`step-backward`:null;case`PageDown`:return`page-forward`;case`PageUp`:return`page-backward`;case`Home`:return`start`;case`End`:return`end`;default:return null}}customElements.define(`gtk-scrollbar`,GtkScrollbar);const K=1e-10,Ri=[`always`,`if-valid`];var GtkSpinButton=class extends HTMLElement{_range=new SpinState;_input;_down;_up;_initialized=!1;_edited=!1;_vertical=null;_initialTimer=null;_repeatTimer=null;_timerCalls=0;_timerStep=0;static get observedAttributes(){return[`adjustment`,`climb-rate`,`digits`,`disabled`,`numeric`,`orientation`,`snap-to-ticks`,`update-policy`,`value`,`wrap`]}get adjustment(){return this._range.adjustment}set adjustment(e){this._range.configure(typeof e==`string`?parseAdjustment(e):e),this._render()}get value(){return this._range.value}set value(e){this._range.setValue(e),this._render()}get digits(){let e=Number.parseInt(this.getAttribute(`digits`)??``,10);return Number.isFinite(e)?Math.max(0,e):0}set digits(e){this.setAttribute(`digits`,String(e))}get numeric(){return this.hasAttribute(`numeric`)}set numeric(e){this.toggleAttribute(`numeric`,!!e)}get snapToTicks(){return this.hasAttribute(`snap-to-ticks`)}set snapToTicks(e){this.toggleAttribute(`snap-to-ticks`,!!e)}get wrap(){return this.hasAttribute(`wrap`)}set wrap(e){this.toggleAttribute(`wrap`,!!e)}get updatePolicy(){let e=this.getAttribute(`update-policy`);return Ri.includes(e)?e:`always`}set updatePolicy(e){this.setAttribute(`update-policy`,e)}get climbRate(){let e=Number.parseFloat(this.getAttribute(`climb-rate`)??``);return Number.isFinite(e)&&e>0?e:0}set climbRate(e){this.setAttribute(`climb-rate`,String(e))}get text(){return this._input}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=normalizeAdjustment(parseAdjustment(this.getAttribute(`adjustment`))),t=this.getAttribute(`value`),n=t===null?NaN:Number.parseFloat(t);this._range.configure(Number.isFinite(n)?{...e,value:n}:e),this._input=document.createElement(`input`),this._input.className=`adw-spin-button-text`,this._input.type=`text`,this._input.inputMode=`decimal`,this._input.autocomplete=`off`,this._input.spellcheck=!1,this._down=document.createElement(`button`),this._down.type=`button`,this._down.className=`adw-button image-button down`,this._down.append(createGtkImage(`value-decrease-symbolic`)),this._down.setAttribute(`aria-label`,`Decrease`),this._up=document.createElement(`button`),this._up.type=`button`,this._up.className=`adw-button image-button up`,this._up.append(createGtkImage(`value-increase-symbolic`)),this._up.setAttribute(`aria-label`,`Increase`),this._down.addEventListener(`click`,()=>this._spin(-this._range.adjustment.stepIncrement)),this._up.addEventListener(`click`,()=>this._spin(this._range.adjustment.stepIncrement)),this._hold(this._down,-1),this._hold(this._up,1),this._input.addEventListener(`input`,()=>{this._edited=!0,this.numeric&&this._rejectNonNumeric()}),this._input.addEventListener(`change`,()=>this._update()),this._input.addEventListener(`keydown`,e=>this._onKeyDown(e)),this.setAttribute(`role`,`spinbutton`),this.replaceChildren(this._input,this._down,this._up),this._range.subscribe(e=>{this._render(),this.dispatchEvent(new CustomEvent(`value-changed`,{bubbles:!0,detail:{value:e.value}}))}),this._range.subscribeChanged(()=>this._render()),this._render()}attributeChangedCallback(e){if(this._initialized){if(e===`adjustment`){this._range.configure(parseAdjustment(this.getAttribute(`adjustment`)));return}if(e===`value`){this._range.setValue(Number.parseFloat(this.getAttribute(`value`)??`0`));return}this._render()}}_spin(e){let t=this.adjustment,n=t.value+e,r=!1;e>0?this.wrap?Math.abs(t.value-t.upper)<K?(n=t.lower,r=!0):n>t.upper&&(n=t.upper):n=Math.min(n,t.upper):e<0&&(this.wrap?Math.abs(t.value-t.lower)<K?(n=t.upper,r=!0):n<t.lower&&(n=t.lower):n=Math.max(n,t.lower)),Math.abs(n-t.value)>K&&this._range.setValueInteractive(n),r&&this.dispatchEvent(new CustomEvent(`wrapped`,{bubbles:!0}))}_update(){let e=this.adjustment,t=Number.parseFloat(this._input.value),n=this._input.value.trim()!==``&&Number.isNaN(t);if(this.updatePolicy===`always`){let r=glibClamp(n||!Number.isFinite(t)?e.value:t,e.lower,e.upper-e.pageSize);this._commit(this.snapToTicks?snapAdjustmentValue(e,r):r);return}if(n||!Number.isFinite(t)||t<e.lower||t>e.upper){this._render(),this.dispatchEvent(new CustomEvent(`value-changed`,{bubbles:!0,detail:{value:this._range.value}}));return}this._commit(this.snapToTicks?snapAdjustmentValue(e,t):t)}_commit(e){this._range.setValue(e),this._edited=!1,this._render()}_rejectNonNumeric(){let e=this.digits,t=!1,n=!1,r=``;for(let i of this._input.value){if(i===`-`||i===`+`){if(t||r!==``)return this._resetText();t=!0,r+=i;continue}if(i===`.`){if(!e||n)return this._resetText();n=!0,r+=i;continue}if(i<`0`||i>`9`)return this._resetText();r+=i}r!==this._input.value&&(this._input.value=r)}_resetText(){this._input.value=this._formatted()}_hold(e,t){let begin=e=>{e.button!==0||this.hasAttribute(`disabled`)||(this._timerStep=this._range.adjustment.stepIncrement,this._timerCalls=0,this._spin(t*this._timerStep),this._initialTimer=globalThis.setTimeout(()=>{this._initialTimer=null,this._spin(t*this._timerStep),this._repeatTimer=globalThis.setInterval(()=>this._tick(t),50)},500))},end=()=>this._stopHold();e.addEventListener(`pointerdown`,begin),e.addEventListener(`pointerup`,end),e.addEventListener(`pointerleave`,end),e.addEventListener(`pointercancel`,end)}_tick(e){this._spin(e*this._timerStep);let t=this._range.adjustment;this.climbRate>0&&this._timerStep<t.pageIncrement&&(this._timerCalls<5?this._timerCalls+=1:(this._timerCalls=0,this._timerStep+=this.climbRate))}_stopHold(){this._initialTimer!==null&&(clearTimeout(this._initialTimer),this._initialTimer=null),this._repeatTimer!==null&&(clearInterval(this._repeatTimer),this._repeatTimer=null),this._timerCalls=0,this._timerStep=0}_onKeyDown(e){let t=this._range.adjustment,n=t.stepIncrement,r=t.pageIncrement,i=null;switch(e.key){case`ArrowUp`:i=n;break;case`ArrowDown`:i=-n;break;case`PageUp`:i=r;break;case`PageDown`:i=-r;break;case`Enter`:{let e=this._edited;this._update(),e||this.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0}));return}default:return}e.preventDefault(),this._spin(i)}_formatted(){return formatScaleValue(this._range.value,this.digits)}_render(){if(!this._input)return;let e=this.adjustment,t=this.getAttribute(`orientation`)===`vertical`;this.classList.toggle(`vertical`,t),this.classList.toggle(`horizontal`,!t),t!==this._vertical&&(this._vertical=t,t?this.replaceChildren(this._up,this._input,this._down):this.replaceChildren(this._input,this._down,this._up)),this._input.disabled=this.hasAttribute(`disabled`),this._input.size=10,document.activeElement!==this._input&&this._input.value!==this._formatted()&&(this._input.value=this._formatted()),this._up.disabled=!this.wrap&&e.upper-e.value<=K,this._down.disabled=!this.wrap&&e.value-e.lower<=K,this.setAttribute(`aria-valuemin`,String(e.lower)),this.setAttribute(`aria-valuemax`,String(e.upper-e.pageSize)),this.setAttribute(`aria-valuenow`,String(e.value)),this.hasAttribute(`disabled`)?this.setAttribute(`aria-disabled`,`true`):this.removeAttribute(`aria-disabled`)}};customElements.define(`gtk-spin-button`,GtkSpinButton);const zi=`http://www.w3.org/2000/svg`;var GtkSpinner=class extends HTMLElement{_initialized=!1;static get observedAttributes(){return[`spinning`,`disabled`]}get spinning(){return this.hasAttribute(`spinning`)}set spinning(e){this.toggleAttribute(`spinning`,!!e)}start(){this.spinning=!0,this.setAttribute(`aria-busy`,`true`)}stop(){this.spinning=!1,this.setAttribute(`aria-busy`,`false`)}connectedCallback(){if(this._initialized){this._render();return}this._initialized=!0;let e=document.createElementNS(zi,`svg`);e.setAttribute(`viewBox`,`0 0 16 16`),e.setAttribute(`class`,`adw-spinner-ring`);let t=document.createElementNS(zi,`circle`);t.setAttribute(`cx`,`8`),t.setAttribute(`cy`,`8`),t.setAttribute(`r`,`7`),t.setAttribute(`class`,`adw-spinner-track`);let n=document.createElementNS(zi,`path`);n.setAttribute(`d`,`M 1 8 A 7 7 0 0 1 8 1`),n.setAttribute(`class`,`adw-spinner-arc`),e.append(t,n),this.replaceChildren(e),this.setAttribute(`role`,`progressbar`),this._render()}attributeChangedCallback(e){this._initialized&&(this._render(),e===`spinning`&&this.dispatchEvent(new CustomEvent(`notify::spinning`,{bubbles:!0,detail:{spinning:this.spinning}})))}_render(){this.classList.toggle(`checked`,this.spinning)}};customElements.define(`gtk-spinner`,GtkSpinner);const Bi=[`none`,`crossfade`,`slide-right`,`slide-left`,`slide-up`,`slide-down`,`slide-left-right`,`slide-up-down`,`over-up`,`over-down`,`over-left`,`over-right`,`under-up`,`under-down`,`under-left`,`under-right`,`over-up-down`,`over-down-up`,`over-left-right`,`over-right-left`,`rotate-left`,`rotate-right`,`rotate-left-right`],Vi=new Set([`slide-left-right`,`slide-up-down`,`over-up-down`,`over-down-up`,`over-left-right`,`over-right-left`,`rotate-left-right`]),Hi={"slide-left":`slide-right`,"slide-right":`slide-left`,"rotate-left":`rotate-right`,"rotate-right":`rotate-left`,"over-left":`over-right`,"over-right":`over-left`,"under-left":`under-right`,"under-right":`under-left`};function simpleTransitionType(e,t){switch(t){case`slide-left-right`:return e?`slide-right`:`slide-left`;case`rotate-left-right`:return e?`rotate-right`:`rotate-left`;case`slide-up-down`:return e?`slide-down`:`slide-up`;case`over-up-down`:return e?`under-down`:`over-up`;case`over-down-up`:return e?`under-up`:`over-down`;case`over-left-right`:return e?`under-right`:`over-left`;case`over-right-left`:return e?`under-left`:`over-right`;default:return t}}const Ui=[`name`,`title`,`icon-name`,`use-underline`,`needs-attention`];var GtkStack=class extends HTMLElement{static signals={"notify::visible-child":`notify::visible-child`,"notify::visible-child-name":`notify::visible-child-name`};_visible=null;_lastVisible=null;_initialized=!1;_initializedChildren=new WeakSet;_observer=null;_timer=null;_running=!1;static get observedAttributes(){return[`visible-child-name`,`transition-type`,`transition-duration`,`hhomogeneous`,`vhomogeneous`,`interpolate-size`]}get visibleChildName(){return this.getAttribute(`visible-child-name`)}set visibleChildName(e){this._write(`visible-child-name`,e)}get visibleChild(){return this._visible}set visibleChild(e){this.setVisibleChild(e)}get transitionType(){let e=this.getAttribute(`transition-type`);return e!==null&&Bi.includes(e)?e:`none`}set transitionType(e){this._write(`transition-type`,e)}get transitionDuration(){return this._duration()}set transitionDuration(e){this._write(`transition-duration`,String(e))}get hhomogeneous(){return this._flag(`hhomogeneous`,!0)}set hhomogeneous(e){this._write(`hhomogeneous`,e?``:`false`)}get vhomogeneous(){return this._flag(`vhomogeneous`,!0)}set vhomogeneous(e){this._write(`vhomogeneous`,e?``:`false`)}get interpolateSize(){return this.hasAttribute(`interpolate-size`)}set interpolateSize(e){this.toggleAttribute(`interpolate-size`,!!e)}get transitionRunning(){return this.hasAttribute(`transition-running`)}get pages(){return this._children().map(e=>this._page(e))}getChildByName(e){return this._children().find(t=>this._page(t).name===e)??null}getPage(e){return this._children().includes(e)?this._page(e):null}isSelected(e){return this._visible===e}addTitled(e,t,n){return t!==null&&e.setAttribute(`name`,t),n!=null&&e.setAttribute(`title`,n),this.addChild(e)}addNamed(e,t){return this.addTitled(e,t)}addChild(e){return this.appendChild(e),this._initChild(e),this._initialized&&!this._visible&&!e.hasAttribute(`hidden`)&&this._show(e),e}removePage(e){e.remove()}setVisibleChild(e,t){return e?this._children().includes(e)?this._show(e,t):!1:this._show(this._firstVisible(),t)}setVisibleChildName(e){if(e===null)return!1;let t=this._children().find(t=>this._page(t).name===e);return t?this._show(t):!1}connectedCallback(){if(this._initialized){this._render();return}this._initialized=!0,this.setAttribute(`role`,`group`);for(let e of this._children())this._initChild(e);this._observer=new MutationObserver(e=>this._onChildMutations(e)),this._observer.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[...Ui,`hidden`]}),this._visible||this._show(this._firstVisible()),this._render()}disconnectedCallback(){this._observer?.disconnect(),this._observer=null,this._timer!==null&&clearTimeout(this._timer),this._timer=null,this._initialized=!1}attributeChangedCallback(e){if(this._initialized){if(e===`visible-child-name`){this.setVisibleChildName(this.getAttribute(`visible-child-name`));return}this._render(),this._notify(e)}}_property(e){switch(e){case`transition-type`:return this.transitionType;case`transition-duration`:return this.transitionDuration;case`hhomogeneous`:return this.hhomogeneous;case`vhomogeneous`:return this.vhomogeneous;case`interpolate-size`:return this.interpolateSize;default:return this.visibleChildName}}_notify(e){this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}}))}_write(e,t){t===null?this.removeAttribute(e):this.getAttribute(e)!==t&&this.setAttribute(e,t)}_flag(e,t){let n=this.getAttribute(e);return n===null?t:n!==`false`}_duration(){let e=this.getAttribute(`transition-duration`);if(e===null)return 200;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:0}_children(){return Array.from(this.children)}_page(e){return{name:e.getAttribute(`name`)??``,title:e.getAttribute(`title`),iconName:e.getAttribute(`icon-name`),useUnderline:e.hasAttribute(`use-underline`),needsAttention:e.hasAttribute(`needs-attention`),visible:!e.hasAttribute(`hidden`),child:e}}_firstVisible(){return this._children().find(e=>this._page(e).visible)??null}_initChild(e){this._initializedChildren.has(e)||(this._initializedChildren.add(e),e.classList.add(`adw-stack-page`))}_onChildMutations(e){let t=0,n=0,r=-1,i=!1;for(let a of e){if(a.type===`childList`){for(let e of Array.from(a.removedNodes))e===this._visible&&(this._visible=null),e===this._lastVisible&&(this._lastVisible=null),n+=1;for(let e of Array.from(a.addedNodes))e instanceof HTMLElement&&(this._initChild(e),t+=1,r===-1&&(r=this._children().indexOf(e)));continue}let e=a.attributeName;if(e){if(e===`hidden`){this._show(this._firstVisible());continue}Ui.includes(e)&&(i=!0)}}if((n>0||t>0)&&this.dispatchEvent(new CustomEvent(`items-changed`,{bubbles:!0,detail:{position:r===-1?this._children().length:r,removed:n,added:t}})),i){for(let t of e){if(t.type!==`attributes`)continue;let e=t.target;this.dispatchEvent(new CustomEvent(`page-updated`,{bubbles:!0,detail:{child:e}})),e===this._visible&&t.attributeName===`name`&&(this._write(`visible-child-name`,this._nameOrNull(this._page(e).name)),this.dispatchEvent(new CustomEvent(`notify::visible-child-name`,{bubbles:!0,detail:{"visible-child-name":this.visibleChildName}})))}this._render()}}_nameOrNull(e){return e===``?null:e}_show(e,t){if(!e)return!1;let n=this._page(e);if(!n.visible||this._visible===e)return!1;let r=this._visible;if(this._visible=e,this._write(`visible-child-name`,this._nameOrNull(n.name)),this._lastVisible=r,this._render(),this.dispatchEvent(new CustomEvent(`notify::visible-child`,{bubbles:!0,detail:{"visible-child":e}})),this.dispatchEvent(new CustomEvent(`notify::visible-child-name`,{bubbles:!0,detail:{"visible-child-name":this.visibleChildName}})),r){let t=Math.min(this._children().indexOf(r),this._children().indexOf(e));this.dispatchEvent(new CustomEvent(`selection-changed`,{bubbles:!0,detail:{position:t,nItems:2}}))}else this.dispatchEvent(new CustomEvent(`selection-changed`,{bubbles:!0,detail:{position:this._children().indexOf(e),nItems:1}}));return this._startTransition(r,t??this.transitionType),!0}_startTransition(e,t){this._timer!==null&&(clearTimeout(this._timer),this._timer=null);let n=this._effectiveType(t);if(Vi.has(n)&&!e?n=`none`:Vi.has(n)&&e&&(n=simpleTransitionType(this._newChildFirst(e),n)),n===`none`||!e||this._duration()===0){this._running=!1,this.removeAttribute(`transition-running`),this.classList.remove(`transitioning`),this._lastVisible=null,this._render();return}this.dataset.transitionType=n,this._running=!0,this.setAttribute(`transition-running`,``),this.classList.add(`transitioning`),this._render(),this.dispatchEvent(new CustomEvent(`transition-start`,{bubbles:!0,detail:{duration:this._duration()}})),this._timer=setTimeout(()=>{this._timer=null,this._running=!1,this.removeAttribute(`transition-running`),this.classList.remove(`transitioning`),delete this.dataset.transitionType,this._lastVisible=null,this._render(),this.dispatchEvent(new CustomEvent(`transition-end`,{bubbles:!0}))},this._duration())}_newChildFirst(e){let t=this._children();return t.indexOf(this._visible)<t.indexOf(e)}_effectiveType(e){let t=e;return t!==`none`&&(this._reducedMotion()?t=this.hhomogeneous&&this.vhomogeneous?`crossfade`:`none`:this.getAttribute(`dir`)===`rtl`&&(t=Hi[t]??t)),t}_reducedMotion(){return typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches}_render(){if(this._initialized){for(let e of this._children()){let t=e===this._visible;e.classList.toggle(`visible-page`,t),e.classList.toggle(`transitioning-in`,t&&this._running),e.classList.toggle(`transitioning-out`,!t&&e===this._lastVisible&&this._running),t?e.removeAttribute(`aria-hidden`):e.setAttribute(`aria-hidden`,`true`)}this.style.setProperty(`--stack-transition-duration`,`${this._duration()}ms`)}}};customElements.define(`gtk-stack`,GtkStack);var GtkStackSidebar=class extends HTMLElement{_stack=null;_list;_initialized=!1;_rows=[];_onStackChange=()=>this._rebuild();static get observedAttributes(){return[`stack`]}get stack(){return this._stack}set stack(e){this.setStack(typeof e==`string`?this._resolve(e):e)}refresh(){this._rebuild()}connectedCallback(){if(this._initialized){this._bindStack(),this._rebuild();return}this._initialized=!0,this._list=document.createElement(`div`),this._list.className=`adw-stack-sidebar-list navigation-sidebar`,this._list.setAttribute(`role`,`listbox`),this._list.setAttribute(`aria-label`,`Sidebar`),this.replaceChildren(this._list),this.classList.add(`sidebar`);let e=this.getAttribute(`stack`);if(e){this.setStack(this._resolve(e));return}this._rebuild()}disconnectedCallback(){this._unbindStack()}attributeChangedCallback(e,t,n){!this._initialized||e!==`stack`||this.setStack(n===null?null:this._resolve(n))}setStack(e){e!==this._stack&&(this._unbindStack(),this._stack=e,this._bindStack(),this._rebuild(),this.dispatchEvent(new CustomEvent(`notify::stack`,{bubbles:!0,detail:{stack:this._stack}})))}_resolve(e){return e?document.getElementById(e)??null:null}_bindStack(){this._stack?.addEventListener(`items-changed`,this._onStackChange),this._stack?.addEventListener(`selection-changed`,this._onStackChange),this._stack?.addEventListener(`page-updated`,this._onStackChange)}_unbindStack(){this._stack?.removeEventListener(`items-changed`,this._onStackChange),this._stack?.removeEventListener(`selection-changed`,this._onStackChange),this._stack?.removeEventListener(`page-updated`,this._onStackChange)}_pages(){return this._stack?.pages??[]}_visible(e){return e.visible&&e.title!==null}_selectedIndex(){let e=this._pages(),t=this._stack?.visibleChildName??null;return t===null?-1:e.findIndex(e=>e.name===t)}_rebuild(){if(!this._initialized)return;let e=this._pages();e.length!==this._rows.length&&(this._list.replaceChildren(),this._rows=e.map(()=>this._buildRow()),this._list.append(...this._rows));let t=this._selectedIndex();e.forEach((e,n)=>{let r=this._rows[n];if(!r)return;let i=r.querySelector(`.adw-stack-sidebar-title`);i&&(i.textContent=e.title??``),r.hidden=!this._visible(e),r.classList.toggle(`needs-attention`,e.needsAttention),r.classList.toggle(`selected`,n===t),r.setAttribute(`aria-selected`,String(n===t))})}_buildRow(){let e=document.createElement(`button`);e.type=`button`,e.className=`adw-stack-sidebar-row`,e.setAttribute(`role`,`link`);let t=document.createElement(`span`);return t.className=`adw-stack-sidebar-title`,e.appendChild(t),e.addEventListener(`click`,()=>this._onRowActivated(e)),e}_onRowActivated(e){let t=this._rows.findIndex(t=>t===e);if(t===-1)return;let n=this._pages()[t];n&&(this._stack?.isSelected(n.child)||this._stack?.setVisibleChild(n.child))}};customElements.define(`gtk-stack-sidebar`,GtkStackSidebar);var GtkStackSwitcher=class extends HTMLElement{_stack=null;_initialized=!1;_nodes=[];_onStackChange=()=>this._rebuild();static get observedAttributes(){return[`stack`,`orientation`]}get stack(){return this._stack}set stack(e){this.setStack(typeof e==`string`?this._resolve(e):e)}get orientation(){return normalizeBoxOrientation(this.getAttribute(`orientation`))}set orientation(e){this.getAttribute(`orientation`)!==e&&this.setAttribute(`orientation`,e)}refresh(){this._rebuild()}connectedCallback(){if(this._initialized){this._bindStack(),this._rebuild();return}this._initialized=!0,this.setAttribute(`role`,`tablist`),this.classList.add(`linked`);let e=this.getAttribute(`stack`);if(e){this.setStack(this._resolve(e));return}this._rebuild()}disconnectedCallback(){this._unbindStack()}attributeChangedCallback(e,t,n){if(this._initialized){if(e===`orientation`){this._render(),this.dispatchEvent(new CustomEvent(`notify::orientation`,{bubbles:!0,detail:{orientation:this.orientation}}));return}this.setStack(n===null?null:this._resolve(n))}}setStack(e){e!==this._stack&&(this._unbindStack(),this._stack=e,this._bindStack(),this._rebuild(),this.dispatchEvent(new CustomEvent(`notify::stack`,{bubbles:!0,detail:{stack:this._stack}})))}_resolve(e){return e?document.getElementById(e)??null:null}_bindStack(){this._stack?.addEventListener(`items-changed`,this._onStackChange),this._stack?.addEventListener(`selection-changed`,this._onStackChange),this._stack?.addEventListener(`page-updated`,this._onStackChange)}_unbindStack(){this._stack?.removeEventListener(`items-changed`,this._onStackChange),this._stack?.removeEventListener(`selection-changed`,this._onStackChange),this._stack?.removeEventListener(`page-updated`,this._onStackChange)}_visible(e){return e.visible&&(e.title!==null||e.iconName!==null)}_pages(){return this._stack?.pages??[]}_selectedIndex(){let e=this._pages(),t=this._stack?.visibleChildName??null;return t===null?-1:e.findIndex(e=>e.name===t)}_rebuild(){if(!this._initialized)return;let e=this._pages();e.length!==this._nodes.length&&(this.replaceChildren(),this._nodes=e.map(()=>this._buildButton()),this.append(...this._nodes.map(e=>e.button)));let t=this._selectedIndex();e.forEach((e,n)=>{let r=this._nodes[n];if(!r)return;r.button.hidden=!this._visible(e),r.button.classList.toggle(`active`,n===t),r.button.setAttribute(`aria-selected`,String(n===t)),r.button.classList.toggle(`needs-attention`,e.needsAttention);let i=e.iconName!==null,a=e.title!==null;r.icon.hidden=!i,r.label.hidden=!a,r.label.textContent=e.title??``,r.button.dataset.buttonMode=i?a?`both`:`icon`:`text`,i?(r.icon.setAttribute(`icon-name`,e.iconName),this.title=e.title??``):(r.icon.removeAttribute(`icon-name`),this.removeAttribute(`title`))}),this._render()}_buildButton(){let e=document.createElement(`button`);e.type=`button`,e.className=`adw-stack-switcher-button`,e.setAttribute(`role`,`tab`);let t=document.createElement(`span`);t.className=`adw-stack-switcher-icon`,t.setAttribute(`aria-hidden`,`true`);let n=document.createElement(`span`);return n.className=`adw-stack-switcher-title`,e.append(t,n),e.addEventListener(`click`,()=>this._onToggled(e)),{button:e,label:n,icon:t}}_onToggled(e){let t=this._nodes.findIndex(t=>t.button===e);if(t===-1)return;let n=this._pages()[t];n&&(this._stack?.isSelected(n.child)||this._stack?.setVisibleChild(n.child))}_render(){this.setAttribute(`aria-orientation`,this.orientation)}};customElements.define(`gtk-stack-switcher`,GtkStackSwitcher);var GtkText=class extends HTMLElement{_input;_initialized=!1;_maxLength=0;static get observedAttributes(){return[`text`,`editable`,`placeholder-text`,`max-length`,`visibility`,`propagate-text-width`]}get text(){return this._input?this._input.value:this.getAttribute(`text`)??``}set text(e){let t=clampEntryText(e??``,this._maxLength);this._input?this._input.value=t:this.setAttribute(`text`,t),this._resizeToText()}get editable(){return readBooleanAttribute(this,`editable`,!0)}set editable(e){writeBooleanAttribute(this,`editable`,e,!0)}get placeholderText(){return this.getAttribute(`placeholder-text`)??``}set placeholderText(e){this.setAttribute(`placeholder-text`,e??``)}get maxLength(){return this._maxLength}set maxLength(e){this._maxLength=Number.isFinite(e)?Math.min(it,Math.max(0,Math.trunc(e))):0,this._input&&(this._input.value=clampEntryText(this._input.value,this._maxLength))}get visibility(){return readBooleanAttribute(this,`visibility`,!0)}set visibility(e){writeBooleanAttribute(this,`visibility`,e,!0)}get propagateTextWidth(){return readBooleanAttribute(this,`propagate-text-width`,!1)}set propagateTextWidth(e){writeBooleanAttribute(this,`propagate-text-width`,e,!1)}get textLength(){return entryTextLength(this.text)}get input(){return this._input}connectedCallback(){if(this._initialized)return;this._initialized=!0,this._maxLength=Number(this.getAttribute(`max-length`)??0);let e=document.createElement(`input`);e.className=`adw-text`,e.type=this.visibility?`text`:`password`,e.value=clampEntryText(this.getAttribute(`text`)??``,this._maxLength),e.placeholder=this.placeholderText,e.readOnly=!this.editable,e.addEventListener(`input`,()=>{let t=clampEntryText(e.value,this._maxLength);t!==e.value&&(e.value=t),this._resizeToText()}),e.addEventListener(`keydown`,t=>{t.key===`Enter`&&this.dispatchEvent(new CustomEvent(`activate`,{bubbles:!0,detail:{text:e.value}}))}),this._input=e,this.replaceChildren(e),this._render()}attributeChangedCallback(e,t,n){if(!this._initialized){e===`max-length`&&(this._maxLength=Number(n??0));return}e===`text`?this._input.value=clampEntryText(n??``,this._maxLength):e===`placeholder-text`?this._input.placeholder=n??``:e===`max-length`?(this._maxLength=Number(n??0),this._input.value=clampEntryText(this._input.value,this._maxLength)):e===`editable`?this._input.readOnly=!this.editable:e===`visibility`&&(this._input.type=this.visibility?`text`:`password`),this._resizeToText(),this._reflectReadOnly()}_render(){this._resizeToText(),this._reflectReadOnly()}_reflectReadOnly(){this.classList.toggle(`read-only`,!this.editable)}_resizeToText(){let e=this.propagateTextWidth;this.classList.toggle(`propagate-text-width`,e),this._input&&e&&(this._input.size=Math.max(1,entryTextLength(this._input.value)))}};function readBooleanAttribute(e,t,n){let r=e.getAttribute(t);return r===null?n:r!==`false`}function writeBooleanAttribute(e,t,n,r){n===r?e.removeAttribute(t):e.setAttribute(t,n?`true`:`false`)}customElements.define(`gtk-text`,GtkText);const Wi=[`none`,`char`,`word`,`word-char`];function normalizeWrapMode(e){return Wi.includes(e??``)?e:`none`}const Gi={none:`pre`,word:`pre-wrap`,"word-char":`pre-wrap`,char:`pre-wrap`};var GtkTextView=class extends HTMLElement{_area;_initialized=!1;static get observedAttributes(){return[`text`,`editable`,`wrap-mode`,`justification`,`monospace`,`accepts-tab`,`cursor-visible`,`top-margin`,`bottom-margin`,`left-margin`,`right-margin`]}get text(){return this._area?this._area.value:this.getAttribute(`text`)??this._seedText()}set text(e){this._area?this._area.value=e??``:this.setAttribute(`text`,e??``)}get editable(){return this._bool(`editable`,!0)}set editable(e){this._setBool(`editable`,e,!0)}get wrapMode(){return normalizeWrapMode(this.getAttribute(`wrap-mode`))}set wrapMode(e){this.setAttribute(`wrap-mode`,e)}get justification(){return normalizeLabelJustify(this.getAttribute(`justification`))}set justification(e){this.setAttribute(`justification`,e)}get monospace(){return this._bool(`monospace`,!1)}set monospace(e){this._setBool(`monospace`,e,!1)}get acceptsTab(){return this._bool(`accepts-tab`,!0)}set acceptsTab(e){this._setBool(`accepts-tab`,e,!0)}get cursorVisible(){return this._bool(`cursor-visible`,!0)}set cursorVisible(e){this._setBool(`cursor-visible`,e,!0)}get topMargin(){return this._margin(`top-margin`)}set topMargin(e){this.setAttribute(`top-margin`,String(e))}get bottomMargin(){return this._margin(`bottom-margin`)}set bottomMargin(e){this.setAttribute(`bottom-margin`,String(e))}get leftMargin(){return this._margin(`left-margin`)}set leftMargin(e){this.setAttribute(`left-margin`,String(e))}get rightMargin(){return this._margin(`right-margin`)}set rightMargin(e){this.setAttribute(`right-margin`,String(e))}get buffer(){return{cursor_position:this._area?this._area.selectionEnd??this._area.value.length:this.text.length,insert_at_cursor:(e,t=-1)=>{let n=t<0?e:e.slice(0,t),r=this._area;if(!r){this.text+=n;return}let i=r.selectionEnd??r.value.length;r.setRangeText(n,i,i,`end`),this._emitChanged()},set_text:(e,t=-1)=>{this.text=t<0?e:e.slice(0,t),this._area&&this._emitChanged()},get_text:()=>this.text}}get_buffer(){return this.buffer}get textarea(){return this._area}connectedCallback(){if(this._initialized)return;this._initialized=!0;let e=document.createElement(`textarea`);e.className=`adw-text-view`,e.value=this.getAttribute(`text`)??this._seedText(),e.spellcheck=!1,e.addEventListener(`input`,()=>this._emitChanged()),e.addEventListener(`keydown`,t=>{if(t.key!==`Tab`||!this.acceptsTab)return;t.preventDefault();let n=e.selectionStart??e.value.length,r=e.selectionEnd??n;e.setRangeText(` `,n,r,`end`),this._emitChanged()}),this._area=e,this.replaceChildren(e),this._render()}attributeChangedCallback(e,t,n){this._initialized&&(e===`text`?this._area.value=n??``:e===`editable`&&(this._area.readOnly=!this.editable),this._render())}_render(){let e=this.wrapMode,t=this._area;t.style.whiteSpace=Gi[e],t.style.wordBreak=e===`char`?`break-all`:`normal`,t.style.overflowWrap=e===`word-char`?`anywhere`:`normal`,t.style.textAlign=ei[this.justification],t.style.caretColor=this.cursorVisible?``:`transparent`,this.classList.toggle(`monospace`,this.monospace),t.style.setProperty(`--adw-text-view-margin-top`,`${this.topMargin}px`),t.style.setProperty(`--adw-text-view-margin-end`,`${this.rightMargin}px`),t.style.setProperty(`--adw-text-view-margin-bottom`,`${this.bottomMargin}px`),t.style.setProperty(`--adw-text-view-margin-start`,`${this.leftMargin}px`)}_seedText(){return this.textContent}_emitChanged(){this.dispatchEvent(new CustomEvent(`changed`,{bubbles:!0,detail:{text:this._area.value}}))}_bool(e,t){let n=this.getAttribute(e);return n===null?t:n!==`false`}_setBool(e,t,n){t===n?this.removeAttribute(e):this.setAttribute(e,t?`true`:`false`)}_margin(e){let t=Number.parseInt(this.getAttribute(e)??``,10);return Number.isFinite(t)?Math.max(0,t):0}};customElements.define(`gtk-text-view`,GtkTextView);var GtkToggleButton=class extends GtkButton{static signals={...GtkButton.signals,toggled:`toggled`,"notify::active":`notify::active`};_wired=!1;_groupNext=null;_groupPrev=null;_reflectingGroup=!1;static get observedAttributes(){return[...GtkButton.observedAttributes,`active`,`group`]}get active(){return this.hasAttribute(`active`)}set active(e){let t=!!e;this.active!==t&&(t&&this._grouped&&this._clearGroup(),this.toggleAttribute(`active`,t))}set group(e){this._reflectingGroup=!0,e===null||e.id===``?this.removeAttribute(`group`):this.setAttribute(`group`,e.id),this._reflectingGroup=!1,this._setGroup(e)}get _grouped(){return this._groupNext!==null||this._groupPrev!==null}connectedCallback(){super.connectedCallback(),!this._wired&&(this._wired=!0,this.button.addEventListener(`click`,()=>{this.active&&this._grouped||(this.active=!this.active)}),this.hasAttribute(`group`)&&this._setGroup(resolveGroupTarget(this.getAttribute(`group`),this)))}attributeChangedCallback(e){e===`group`&&!this._reflectingGroup&&this.isConnected&&this._setGroup(resolveGroupTarget(this.getAttribute(`group`),this)),super.attributeChangedCallback(),!(e!==`active`||!this.isConnected)&&(this.active&&this._grouped&&this._clearGroup(),this.dispatchEvent(new CustomEvent(`toggled`,{bubbles:!0})),this.dispatchEvent(new CustomEvent(`notify::active`,{bubbles:!0,detail:{active:this.active}})))}_setGroup(e){if(e===this){console.error(`<gtk-toggle-button> cannot be its own group; the group is unchanged.`);return}if(e===null)this._groupPrev&&(this._groupPrev._groupNext=this._groupNext),this._groupNext&&(this._groupNext._groupPrev=this._groupPrev),this._groupNext=null,this._groupPrev=null;else{if(this._groupNext===e)return;if(this._groupPrev=null,e._groupPrev){let t=e._groupPrev;t._groupNext=this,this._groupPrev=t}e._groupPrev=this,this._groupNext=e}this.dispatchEvent(new CustomEvent(`notify::group`,{bubbles:!0}))}_clearGroup(){let e=this._groupFirst();for(let t=e;t!==null;t=t._groupNext)t!==this&&(t.active=!1)}_groupFirst(e=0){let t=this._groupPrev;return t===null||e>1024?this:t._groupFirst(e+1)}decorate(e){e.classList.toggle(`checked`,this.active),e.setAttribute(`aria-pressed`,String(this.active))}};customElements.define(`gtk-toggle-button`,GtkToggleButton);function resolveGroupTarget(e,t){if(e===null||e===``)return null;let n=document.getElementById(e);return n===null?(console.error(`<gtk-toggle-button group="${e}"> names no element; the group is unchanged.`),null):(n instanceof GtkToggleButton||customElements.upgrade(n),!(n instanceof GtkToggleButton)||n===t?(console.error(`<gtk-toggle-button group="${e}"> names no other toggle button; the group is unchanged.`),null):n)}var GtkTreeExpander=class extends HTMLElement{_ornaments=[];_expandTimer=null;_initialized=!1;static get observedAttributes(){return[`hide-expander`,`indent-for-depth`,`indent-for-icon`,`depth`,`expandable`,`expanded`]}get hideExpander(){return this.hasAttribute(`hide-expander`)}set hideExpander(e){this.toggleAttribute(`hide-expander`,!!e)}get indentForDepth(){return this.getAttribute(`indent-for-depth`)!==`false`}set indentForDepth(e){this.setAttribute(`indent-for-depth`,String(!!e))}get indentForIcon(){return this.getAttribute(`indent-for-icon`)!==`false`}set indentForIcon(e){this.setAttribute(`indent-for-icon`,String(!!e))}get depth(){let e=Number.parseInt(this.getAttribute(`depth`)??``,10);return Number.isFinite(e)&&e>0?e:0}set depth(e){this.setAttribute(`depth`,String(e))}get expandable(){return this.hasAttribute(`expandable`)}set expandable(e){this.toggleAttribute(`expandable`,!!e)}get expanded(){return this.hasAttribute(`expanded`)}set expanded(e){this.toggleAttribute(`expanded`,!!e)}get layout(){return treeExpanderLayout({depth:this.depth,expandable:this.expandable,expanded:this.expanded},{hideExpander:this.hideExpander,indentForDepth:this.indentForDepth,indentForIcon:this.indentForIcon})}connectedCallback(){this._initialized||(this._initialized=!0,this.hasAttribute(`tabindex`)||(this.tabIndex=0),this._wire()),this.setAttribute(`role`,`button`),this._render()}_wire(){this.addEventListener(`keydown`,e=>{let t=treeExpanderAction(e.key,{ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,rtl:globalThis.getComputedStyle(this).direction===`rtl`});t!==`none`&&(e.preventDefault(),this.expanded=treeExpanderExpanded(this.expanded,t))}),this.addEventListener(`dragenter`,()=>{this.expanded||this._expandTimer!==null||(this._expandTimer=setTimeout(()=>{this._expandTimer=null,this.expanded=!0},500))});for(let e of[`dragleave`,`drop`])this.addEventListener(e,()=>this._cancelExpandTimer())}disconnectedCallback(){this._cancelExpandTimer()}attributeChangedCallback(e){this._initialized&&(this._render(),e===`expanded`&&this.dispatchEvent(new CustomEvent(`notify::expanded`,{bubbles:!0,detail:{expanded:this.expanded}})))}_cancelExpandTimer(){this._expandTimer!==null&&(clearTimeout(this._expandTimer),this._expandTimer=null)}_render(){for(let e of this._ornaments)e.remove();this._ornaments=[];let e=this.layout,t=this.firstChild;for(let n=0;n<e.indents;n++){let e=document.createElement(`span`);e.className=`adw-tree-expander-indent`,e.setAttribute(`aria-hidden`,`true`),this.insertBefore(e,t),this._ornaments.push(e)}if(e.expander===`none`)this.removeAttribute(`aria-expanded`);else{let n=createGtkImage(`go-next`,`adw-tree-expander-icon`);n.classList.toggle(`expanded`,e.expander===`expanded`),n.addEventListener(`click`,e=>{e.stopPropagation(),this.expanded=!this.expanded}),this.insertBefore(n,t),this._ornaments.push(n),this.setAttribute(`aria-expanded`,String(e.expander===`expanded`))}this.setAttribute(`aria-level`,String(e.level))}};customElements.define(`gtk-tree-expander`,GtkTreeExpander);var GtkVideo=class extends HTMLElement{_initialized=!1;_overlayIcon;_controlsRevealer;_media=null;mediaListeners=[];_hideTimer=null;_hasStream=!1;_error=null;_ended=!1;_playing=!1;static get observedAttributes(){return[`autoplay`,`graphics-offload`,`loop`]}get autoplay(){return this.hasAttribute(`autoplay`)}set autoplay(e){this._write(`autoplay`,!!e),this._syncMedia()}get loop(){return this.hasAttribute(`loop`)}set loop(e){this._write(`loop`,!!e),this._syncMedia()}get graphicsOffload(){return this.hasAttribute(`graphics-offload`)}set graphicsOffload(e){this._write(`graphics-offload`,!!e)}get media(){return this._media}get playing(){return this._playing}get timestamp(){return this._media?.currentTime??0}get duration(){let e=this._media?.duration??0;return Number.isFinite(e)?e:0}get controlsRevealed(){return this._controlsRevealer?.classList.contains(`revealed`)??!1}_write(e,t){this.toggleAttribute(e,t)}connectedCallback(){if(this._initialized){this._adoptMedia();return}this._initialized=!0,this._overlayIcon=document.createElement(`button`),this._overlayIcon.className=`adw-video-overlay-icon osd circular`,this._overlayIcon.type=`button`,this._overlayIcon.setAttribute(`aria-label`,`Play`),this._overlayIcon.title=`Play`,this._overlayIcon.addEventListener(`click`,()=>this._overlayClicked()),this._controlsRevealer=document.createElement(`div`),this._controlsRevealer.className=`adw-video-controls-revealer`,this._wrap(),this._adoptMedia(),this.addEventListener(`pointermove`,this._onPointerMove)}_wrap(){let e=this.querySelector(`:scope > video`),t=[...this.children].filter(t=>t!==e),n=document.createElement(`div`);n.className=`adw-video-surface`,this.replaceChildren(n),e&&n.appendChild(e),n.append(this._overlayIcon),this._controlsRevealer.append(...t),n.append(this._controlsRevealer)}_adoptMedia(){let e=this.querySelector(`:scope > .adw-video-surface > video`)??null;if(e===this._media){this._syncMedia(),this._updateOverlayIcon();return}if(this._media&&this._detachMedia(this._media),this._media=e,this._hasStream=e!==null,e){let onPlay=()=>this._updatePlaying(!0),onPause=()=>this._updatePlaying(!1),onEnded=()=>{this._ended=!0,this._updateOverlayIcon()},onError=()=>{this._error=e.error?.message??`Playback failed`,this._updateOverlayIcon()},onMetadata=()=>{this._ended=!1,this._error=null,this._updateOverlayIcon()},onPrepared=()=>{this.autoplay&&e.play().catch(()=>{})};this.mediaListeners=[[`play`,onPlay],[`pause`,onPause],[`ended`,onEnded],[`error`,onError],[`loadedmetadata`,onMetadata],[`loadeddata`,onPrepared]];for(let[t,n]of this.mediaListeners)e.addEventListener(t,n)}this._syncMedia(),this._updateOverlayIcon()}_detachMedia(e){for(let[t,n]of this.mediaListeners)e.removeEventListener(t,n);this.mediaListeners=[]}_syncMedia(){this._media&&(this._media.loop=this.loop,this._media.autoplay=!1,this.classList.toggle(`graphics-offload`,this.graphicsOffload))}_overlayClicked(){let e=this._media??null;e!==null&&(e.paused?e.play().catch(()=>{}):e.pause())}revealControls(){this._controlsRevealer&&(this._controlsRevealer.classList.add(`revealed`),this._hideTimer!==null&&clearTimeout(this._hideTimer),this._hideTimer=setTimeout(()=>this._hideControls(),3e3))}_hideControls(){this._hideTimer=null,this._controlsRevealer?.classList.remove(`revealed`)}_onPointerMove=()=>{this.revealControls()};attributeChangedCallback(e){this._initialized&&(e===`graphics-offload`&&this._syncMedia(),this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this._property(e)}})))}_property(e){switch(e){case`autoplay`:return this.autoplay;case`loop`:return this.loop;default:return this.graphicsOffload}}_updatePlaying(e){this._playing=e,this._overlayIcon&&(this._overlayIcon.hidden=e),this.classList.toggle(`playing`,e),this.dispatchEvent(new CustomEvent(`notify::playing`,{bubbles:!0,detail:{playing:e}}))}_updateOverlayIcon(){if(!this._overlayIcon)return;let e,t=null;this._hasStream?this._error===null?e=this._ended?`media-playlist-repeat-symbolic`:`media-playback-start-symbolic`:(e=`dialog-error-symbolic`,t=this._error):e=`media-eject-symbolic`;let n=document.createElement(`gtk-image`);n.setAttribute(`icon-name`,e),this._overlayIcon.replaceChildren(n),t?this._overlayIcon.title=t:this._overlayIcon.title=``,this._overlayIcon.classList.toggle(`error`,this._error!==null)}disconnectedCallback(){this._hideTimer!==null&&clearTimeout(this._hideTimer),this._hideTimer=null}};customElements.define(`gtk-video`,GtkVideo);const Ki=[`horizontal`,`vertical`];function axisAdjustment(e,t){let n=t===`vertical`,r=n?e.clientHeight:e.clientWidth,i=n?e.scrollHeight:e.scrollWidth;return normalizeAdjustment({value:n?e.scrollTop:e.scrollLeft,lower:0,upper:Math.max(i,r),stepIncrement:r*.1,pageIncrement:r*.9,pageSize:r})}var GtkViewport=class extends HTMLElement{_observer=null;_watch=null;static get observedAttributes(){return[`scroll-to-focus`]}get hadjustment(){return axisAdjustment(this,`horizontal`)}get vadjustment(){return axisAdjustment(this,`vertical`)}get scrollToFocus(){return this.getAttribute(`scroll-to-focus`)!==`false`}set scrollToFocus(e){this.setAttribute(`scroll-to-focus`,e?`true`:`false`)}connectedCallback(){this.setAttribute(`role`,`generic`),this.addEventListener(`scroll`,this._announce,{passive:!0}),this._observe(),this._bindFocus()}disconnectedCallback(){this.removeEventListener(`scroll`,this._announce),this.removeEventListener(`focusin`,this._onFocusIn)}_observe(){if(this._observer===null){this._observer=new ResizeObserver(()=>this._announce()),this._observer.observe(this);for(let e of this.children)this._observer.observe(e);this._watch=new MutationObserver(()=>{for(let e of this.children)this._observer?.observe(e);this._announce()}),this._watch.observe(this,{childList:!0})}}attributeChangedCallback(e){this.dispatchEvent(new CustomEvent(`notify::${e}`,{bubbles:!0,detail:{[e]:this.scrollToFocus}})),this.isConnected&&this._bindFocus()}scrollAxis(e,t){let n=axisAdjustment(this,e),r=clampAdjustmentValue(n,t);r!==n.value&&(e===`vertical`?this.scrollTop=r:this.scrollLeft=r,this._announce())}scrollTo(e,t){if(!(e instanceof Element)&&e!==null){Element.prototype.scrollTo.call(this,e,t);return}let n=e;if(n!==null&&n!==this&&typeof n.scrollIntoView==`function`){n.scrollIntoView({block:`nearest`,inline:`nearest`,behavior:matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`}),this._announce();return}for(let e of Ki){let t=axisAdjustment(this,e),n=clampAdjustmentValue(t,t.value);n!==t.value&&(e===`vertical`?this.scrollTop=n:this.scrollLeft=n)}this._announce()}get adjustments(){return{hadjustment:this.hadjustment,vadjustment:this.vadjustment}}_announce=()=>{this.dispatchEvent(new CustomEvent(`value-changed`,{bubbles:!0,detail:this.adjustments}))};_bindFocus(){this.removeEventListener(`focusin`,this._onFocusIn),this.scrollToFocus&&this.addEventListener(`focusin`,this._onFocusIn)}_onFocusIn=e=>{let t=e.target;!(t instanceof Element)||t===this||this.scrollTo(t)}};customElements.define(`gtk-viewport`,GtkViewport);const qi={"double-click":{attribute:`double-click-action`,fallback:`toggle-maximize`},"middle-click":{attribute:`middle-click-action`,fallback:`none`},"right-click":{attribute:`right-click-action`,fallback:`menu`}},Ji={"toggle-maximize":`window.toggle-maximized`,lower:`window.lower`,minimize:`window.minimize`,menu:`window.menu`},Yi=new Set([`none`,`toggle-maximize`,`lower`,`minimize`,`menu`]);function gestureOf(e,t){switch(e){case 0:return t>1?`double-click`:null;case 1:return`middle-click`;case 2:return`right-click`;default:return null}}var GtkWindowHandle=class extends HTMLElement{_drag=null;static get observedAttributes(){return[`double-click-action`,`middle-click-action`,`right-click-action`]}actionFor(e){let{attribute:t,fallback:n}=qi[e],r=this.getAttribute(t);return r===null?n:r.startsWith(`toggle-maximize`)?`toggle-maximize`:Yi.has(r)?r:`none`}connectedCallback(){this.setAttribute(`role`,`generic`),this.addEventListener(`click`,this._onClick),this.addEventListener(`pointerdown`,this._onPointerDown),this.addEventListener(`pointermove`,this._onPointerMove)}disconnectedCallback(){this.removeEventListener(`click`,this._onClick),this.removeEventListener(`pointerdown`,this._onPointerDown),this.removeEventListener(`pointermove`,this._onPointerMove),this._drag=null}_perform(e,t,n){let r=this.actionFor(e),i=r===`none`?null:Ji[r],a={action:r,gesture:e,windowAction:i,x:t,y:n};this.dispatchEvent(new CustomEvent(`titlebar-action`,{bubbles:!0,detail:a})),i!==null&&this.dispatchEvent(new CustomEvent(i,{bubbles:!0,detail:a}))}_onClick=e=>{this._drag=null;let t=gestureOf(e.button,e.detail);t!==null&&this._perform(t,e.clientX,e.clientY)};_onPointerDown=e=>{e.detail>1||(this._drag={pointerId:e.pointerId,x:e.clientX,y:e.clientY})};_onPointerMove=e=>{let t=this._drag;t===null||t.pointerId!==e.pointerId||Math.abs(e.clientX-t.x)+Math.abs(e.clientY-t.y)<=1||(this._drag=null,this.dispatchEvent(new CustomEvent(`window-move`,{bubbles:!0,detail:{x:e.clientX,y:e.clientY}})))}};customElements.define(`gtk-window-handle`,GtkWindowHandle);const q=createGtkPlatform(Xn);q.CssProvider,q.StyleContext,q.Settings,q.IconTheme,q.EventControllerKey,q.show_uri;function extensionsOf(e){return[...e.patterns,...e.suffixes].map(e=>`.${e}`)}function filePickerOptions(e,t){let n=[];for(let t of e.filters){if(t.acceptAll)continue;let e={};for(let n of t.mimeTypes)e[n]=[];let r=extensionsOf(t);r.length>0&&(e[t.mimeTypes[0]??`application/octet-stream`]=r),n.push({description:t.name??``,accept:e})}let r={};return n.length>0&&(r.types=n,r.excludeAcceptAllOption=!e.filters.some(e=>e.acceptAll)),t===`save`&&e.initialName!==null&&(r.suggestedName=e.initialName),r}function inputAccept(e){if(!e||e.acceptAll)return null;let t=[...extensionsOf(e),...e.mimeTypes];return t.length>0?t.join(`,`):null}function writeInWorker(e,t){let n=URL.createObjectURL(new Blob([`onmessage = async (event) => {
9
9
  const { handle, data } = event.data;
10
10
  let access = null;
11
11
  try {
@@ -21,7 +21,7 @@ See the `),this._link(e.name??``,t,`adw-gtk-about-dialog-license-link`),document
21
21
  }
22
22
  };`],{type:`text/javascript`})),r=new Worker(n);return new Promise((n,i)=>{r.onmessage=e=>{e.data.ok?n():i(Error(e.data.message))},r.onerror=e=>i(Error(e.message||`the write worker failed`)),r.postMessage({handle:e,data:t})}).finally(()=>{r.terminate(),URL.revokeObjectURL(n)})}function concat(e){let t=new Uint8Array(e.reduce((e,t)=>e+t.length,0)),n=0;for(let r of e)t.set(r,n),n+=r.length;return t}async function openWriter(e,t){if(t.canStreamWrite(e)){let t=await e.createWritable();return{write:e=>t.write(e),close:()=>t.close()}}let n=[];return{write:async e=>void n.push(e.slice()),close:()=>writeInWorker(e,concat(n))}}function handleFor(e,t){return{basename:e.name,read:async()=>new Uint8Array(await(await e.getFile()).arrayBuffer()),openWriter:()=>openWriter(e,t)}}async function freeName(e,t){let n=t.lastIndexOf(`.`),r=n>0?t.slice(0,n):t,i=n>0?t.slice(n):``;for(let n=1;;n++){let a=n===1?t:`${r} (${n})${i}`;try{await e.getFileHandle(a)}catch{return a}}}async function copyIntoOpfs(e,t,n){let r=await e.getFileHandle(await freeName(e,t.name),{create:!0}),i=await openWriter(r,n);return await i.write(new Uint8Array(await t.arrayBuffer())),await i.close(),r}function isAbort(e){return e?.name===`AbortError`}function dialogRejection(e){if(isAbort(e))return dismissedError();let t=e;return t&&typeof t.message==`string`?dialogFailedError(`${t.name??`Error`}: ${t.message}`):dialogFailedError(String(e))}function createWebFileChooserDriver(e){let run=async(t,n)=>{if(!e.isActive())throw dialogFailedError(`Gtk.FileDialog.${t}() needs a user activation (a click or a key press)`);try{if(e.showSaveFilePicker&&e.showOpenFilePicker){let r=filePickerOptions(n,t),i=t===`open`?(await e.showOpenFilePicker(r))[0]:await e.showSaveFilePicker(r);if(!i)throw dismissedError();return handleFor(i,e)}let r=await e.opfsRoot(),i=await e.choose(t,n,r);if(i===null)throw dismissedError();return`upload`in i?handleFor(await copyIntoOpfs(r,i.upload,e),e):handleFor(await r.getFileHandle(i.name,{create:t===`save`}),e)}catch(e){throw dialogRejection(e)}};return{open:e=>run(`open`,e),save:e=>run(`save`,e)}}function el$1(e,t={},n){let r=document.createElement(e);for(let[e,n]of Object.entries(t))r.setAttribute(e,n);return n!==void 0&&(r.textContent=n),r}__name(el$1,`el`);function sameFilter(e,t){return JSON.stringify(e)===JSON.stringify(t)}function presentOpfsDialog(e,t,n){let r=t.filters,i=t.defaultFilter?r.findIndex(e=>sameFilter(e,t.defaultFilter)):0,a=r[Math.max(i,0)]??t.defaultFilter,o=el$1(`adw-dialog`,{title:t.title??(e===`open`?`Open File`:`Save File`),"content-width":`720`,"content-height":`480`}),s=el$1(`adw-overlay-split-view`,{breakpoint:`max-width: 560px`}),c=el$1(`div`,{slot:`sidebar`}),l=el$1(`gtk-list-box`,{class:`navigation-sidebar`,"selection-mode":`browse`});l.append(el$1(`gtk-list-box-row`,{},`Origin Storage`)),c.append(l);let u=el$1(`adw-toolbar-view`),d=el$1(`gtk-list-box`,{"selection-mode":`single`,"activate-on-single-click":`false`}),f=el$1(`p`,{class:`dimmed`,hidden:``},`No files`),p=el$1(`div`,{slot:`bottom`,class:`toolbar`}),m=null;r.length>0&&(m=el$1(`gtk-drop-down`),m.model=r.map((e,t)=>e.name??`Filter ${t+1}`),m.selected=Math.max(i,0),p.append(m));let g=null;e===`save`&&(g=el$1(`gtk-entry`,{"placeholder-text":`Name`}),g.style.flex=`1`,g.value=t.initialName??``,p.append(g));let _=null;e===`open`&&(_=el$1(`gtk-button`,{label:`Upload…`}),p.append(_));let v=el$1(`div`);v.style.flex=`1`;let ee=el$1(`gtk-button`,{label:e===`open`?`Open`:`Save`,suggested:``});p.append(v,ee),u.append(d,f,p),s.append(c,u),o.append(s);let y=null,refill=async()=>{o.removeAttribute(`data-ready`);let e=[];for await(let[t,r]of n.entries())r.kind===`file`&&(!a||fileFilterAccepts(a,t))&&e.push(t);e.sort((e,t)=>e.localeCompare(t)),d.replaceChildren(...e.map(e=>el$1(`gtk-list-box-row`,{"data-name":e},e))),y=null,f.hidden=e.length>0,o.setAttribute(`data-ready`,``)};return new Promise(t=>{let n=!1,finish=e=>{n||(n=!0,t(e),o.forceClose(),o.remove())},acceptCurrent=()=>{if(e===`open`){y!==null&&finish({name:y});return}let t=g.value.trim();t!==``&&!t.includes(`/`)&&t!==`.`&&t!==`..`&&finish({name:t})};d.addEventListener(`row-selected`,e=>{y=e.detail.row?.dataset.name??null,g&&y!==null&&(g.value=y)}),d.addEventListener(`row-activated`,e=>{y=e.detail.row.dataset.name??null,g&&y!==null&&(g.value=y),acceptCurrent()}),g?.addEventListener(`activate`,acceptCurrent),ee.addEventListener(`click`,acceptCurrent),m?.addEventListener(`notify::selected`,e=>{a=r[e.detail.selected]??null,refill()}),_?.addEventListener(`click`,()=>{let e=document.createElement(`input`);e.type=`file`;let t=inputAccept(a);t!==null&&(e.accept=t),e.addEventListener(`change`,()=>{let t=e.files?.[0];t&&finish({upload:t})}),e.addEventListener(`cancel`,()=>finish(null)),e.click()}),o.addEventListener(`closed`,()=>finish(null)),o.present(),refill()})}function browserFileChooserEnv(){let e=typeof globalThis>`u`?{}:globalThis,t=`showSaveFilePicker`in e&&`showOpenFilePicker`in e;return{showOpenFilePicker:t?t=>e.showOpenFilePicker(t):void 0,showSaveFilePicker:t?t=>e.showSaveFilePicker(t):void 0,isActive:()=>typeof navigator<`u`&&navigator.userActivation?navigator.userActivation.isActive:!0,opfsRoot:async()=>{if(typeof navigator>`u`||typeof navigator.storage?.getDirectory!=`function`)throw Error(`this browser has neither the File System Access pickers nor an Origin Private File System`);return navigator.storage.getDirectory()},choose:presentOpfsDialog,canStreamWrite:e=>typeof e.createWritable==`function`}}registerFileChooserDriver(createWebFileChooserDriver(browserFileChooserEnv()));let J=null;function interceptCopy(e,t){if(!e)return t(),!1;let n=J,r={data:e,wrote:!1};J=r;try{t()}finally{J=n}return r.wrote}const Y=createGdk({writeText(e){if(J){J.data.setData(`text/plain`,e),J.wrote=!0;return}return typeof navigator>`u`||!navigator.clipboard?Promise.reject(Error(`navigator.clipboard is not available here`)):navigator.clipboard.writeText(e)}});Y.Display,Y.Clipboard,Y.ContentProvider,Y.ContentFormats;const{KEY_space:Xi,KEY_a:Zi,KEY_d:Qi,KEY_e:$i,KEY_q:ea,KEY_s:ta,KEY_w:na,KEY_Return:ra,KEY_Escape:ia,KEY_Left:aa,KEY_Up:oa,KEY_Right:sa,KEY_Down:ca}=T,X=createGLibTimers();X.PRIORITY_HIGH,X.PRIORITY_DEFAULT,X.PRIORITY_HIGH_IDLE,X.PRIORITY_DEFAULT_IDLE,X.PRIORITY_LOW,X.SOURCE_REMOVE,X.SOURCE_CONTINUE,X.idle_add,X.timeout_add,X.source_remove;const la=new Set;function splitSelectorList(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`(`||a===`[`?n++:a===`)`||a===`]`?n--:a===`,`&&n===0&&(t.push(e.slice(r,i).trim()),r=i+1)}return t.push(e.slice(r).trim()),t}function rulesOf(e){try{return e.cssRules}catch{return null}}function copyRules(e,t,n,r){for(let i of Array.from(e))if(i instanceof CSSStyleRule){let e=splitSelectorList(i.selectorText).filter(e=>t.test(e));if(e.length===0)continue;let a=e.map(e=>e.replace(new RegExp(t.source,`g`),n)).join(`, `);r.push(`${a} { ${i.style.cssText} }`)}else if(`cssRules`in i){let e=[];if(copyRules(i.cssRules,t,n,e),e.length===0)continue;let a=i.cssText.slice(0,i.cssText.indexOf(`{`)).trim();r.push(`${a} { ${e.join(`
23
23
  `)} }`)}}function inheritStyles(e,t){if(!t||la.has(e))return;la.add(e);let n=RegExp(`(?<![\\w-])${t}(?![\\w-])`),r=[],i=[...Array.from(document.styleSheets),...document.adoptedStyleSheets];for(let t of i){let i=rulesOf(t);i&&copyRules(i,n,e,r)}if(r.length===0)return;let a=new CSSStyleSheet;a.replaceSync(r.join(`
24
- `)),document.adoptedStyleSheets=[...document.adoptedStyleSheets,a]}const ua=new WeakMap,da=new WeakSet,fa=new Map;function tagForTypeName(e){return`gjsify-${e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).replace(/([A-Z]+)([A-Z][a-z])/g,`$1-$2`).toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}`}function isElementClass(e){return e.prototype instanceof HTMLElement}function declareSignals(e,t){let n={...e.signals??{}};for(let e of t.properties)n[`notify::${e.name}`]=`notify::${e.name}`;for(let e of Object.keys(t.signals))n[e]=e;Object.defineProperty(e,"signals",{value:n,configurable:!0,writable:!0})}function attachPending(e){let t=ua.get(e);if(t!==void 0){ua.delete(e);for(let n of t)n.finish(),e.append(...n.children)}}const Z=createGObject({name:`adwaita-web`,dispatch(e,t,n){if(!(e instanceof HTMLElement))throw Error(`No signal '${t}' on object '${String(e)}'`);dispatchElement(e,t,n)},listen(e,t,n){if(!(e instanceof HTMLElement))throw Error(`No signal '${t}' on object '${String(e)}'`);return listenElement(e,t,n)},createFromTree(e,t,n){return buildTemplateTree(e,t,n)},attach(e,t){let n=ua.get(e)??[];n.push(t),ua.set(e,n)},register(e,t){if(!isElementClass(e))return;let n=tagForTypeName(t.typeName),r=fa.get(n)??(customElements.get(n)===void 0?void 0:`another class`);if(r!==void 0)throw Error(`GObject.registerClass: ${t.typeName} would be <${n}>, which ${r} already defines. Give the class a distinct GTypeName.`);let i=Object.getPrototypeOf(e),a=typeof customElements.getName==`function`?customElements.getName(i):null;class Constructing extends i{constructor(e){if(super(),da.has(this))return;da.add(this);let t=constructRegistered(this,e);for(let[e,r]of Object.entries(t)){let t=propertyOf(e);if(!(t in this))throw Error(`No property ${e} on <${n}>`);this[t]=r}}}Object.setPrototypeOf(e,Constructing),Object.setPrototypeOf(e.prototype,Constructing.prototype);let o=e.prototype;for(let[e,t]of Object.entries({...widgetDisplayMembers(Y),...widgetTreeMembers(),...widgetControllerMembers(Jn)}))e in o||Object.defineProperty(o,e,{value:t,writable:!0,configurable:!0});let s=o.connectedCallback;Object.defineProperty(o,"connectedCallback",{configurable:!0,writable:!0,value(){attachPending(this),syncDirection(this),inheritStyles(n,a),s?.call(this)}}),declareSignals(e,t),customElements.define(n,e),fa.set(n,t.typeName),registerTemplateClass(t.typeName,n)}});Z.Object,Z.registerClass,Z.type_ensure,Z.signal_stop_emission_by_name,Z.ParamSpec,Z.ParamFlags,Z.Value,Z.TYPE_STRING,Z.TYPE_BOOLEAN,Z.TYPE_INT,Z.TYPE_UINT,Z.TYPE_DOUBLE,Z.GTypeName,Z.GTypeFlags,Z.interfaces,Z.properties,Z.signals,Z.requires,Z.__gtkTemplate__,Z.__gtkCssName__,Z.__gtkChildren__,Z.__gtkInternalChildren__;let pa=1;var SignalEmitter=class{constructor(){this.handlers=new Map,this.emissions=[]}connect(e,t){return this.add(e,t,!1)}connect_after(e,t){return this.add(e,t,!0)}checkSignal(e){}add(e,t,n){this.checkSignal(e);let r=pa++;return this.handlers.set(r,{name:e,callback:t,after:n}),r}disconnect(e){if(!this.handlers.delete(e))throw Error(`No signal handler with id ${e} on this object`)}classHandler(e,t){}emit(e,...t){this.run(e,t,!1)}emitHandled(e,...t){return this.run(e,t,!0)}run(e,t,n){let r=Array.from(this.handlers).filter(([,t])=>t.name===e),i={name:e,stopped:!1};this.emissions.push(i);let a=!1,stage=e=>{for(let[o,s]of r){if(i.stopped)return!0;if(s.after!==e||!this.handlers.has(o))continue;let r=s.callback(this,...t);if(n&&r)return a=!0,!0}return i.stopped};try{if(stage(!1))return a;let r=this.classHandler(e,t);return n&&r?!0:(i.stopped||stage(!0),a)}finally{this.emissions.splice(this.emissions.lastIndexOf(i),1)}}[S](e){for(let t=this.emissions.length-1;t>=0;t--){let n=this.emissions[t];if(n.name===e&&!n.stopped){n.stopped=!0;return}}console.warn(`no emission of signal "${e}" to stop`)}},TextIter=class{constructor(e,t){this.source=e,this.offset=t}get utf16Offset(){return this.offset}get_offset(){let e=0,t=this.source.getText(0,this.offset);for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);if(r>=55296&&r<=56319&&n+1<t.length){let e=t.charCodeAt(n+1);e>=56320&&e<=57343&&n++}e++}return e}set_offset(e){if(!Number.isInteger(e))throw TypeError(`TextIter.set_offset: ${e} is not an integer`);let t=this.source.getText(),n=0;for(let r=0;e>=0&&r<e&&n<t.length;r++)n+=t.codePointAt(n)>65535?2:1;this.offset=e<0||n>=t.length?this.source.length:n}},TextMark=class{constructor(e){this.name=e}};const ma=new Set([`changed`,`mark-set`,`begin-user-action`,`end-user-action`,`undo`,`redo`,`cursor-moved`,`notify::language`,`notify::style-scheme`,`notify::highlight-syntax`,`notify::cursor-position`,`notify::can-undo`,`notify::can-redo`]);var GtkSourceBuffer=class extends SignalEmitter{constructor(e=``){super(),this.lines=[``],this.lineStarts=[0],this.startsValidTo=1,this.cursor=0,this.bound=0,this.insertMark=new TextMark(`insert`),this.boundMark=new TextMark(`selection_bound`),this.undoStack=[],this.redoStack=[],this.open=null,this.depth=0,this.recording=!0,this.reportedUndo=!1,this.reportedRedo=!1,this.lang=null,this.scheme=null,this.highlight=!0;let{text:t=``,highlightSyntax:n=!0}=typeof e==`string`?{text:e}:e;t!==``&&(this.lines=t.split(`
24
+ `)),document.adoptedStyleSheets=[...document.adoptedStyleSheets,a]}const ua=new WeakMap,da=new WeakSet,fa=new Map;function tagForTypeName(e){return`gjsify-${e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).replace(/([A-Z]+)([A-Z][a-z])/g,`$1-$2`).toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}`}function isElementClass(e){return e.prototype instanceof HTMLElement}function declareSignals(e,t){let n={...e.signals??{}};for(let e of t.properties)n[`notify::${e.name}`]=`notify::${e.name}`;for(let e of Object.keys(t.signals))n[e]=e;Object.defineProperty(e,"signals",{value:n,configurable:!0,writable:!0})}function attachPending(e){let t=ua.get(e);if(t!==void 0){ua.delete(e);for(let n of t)n.finish(),e.append(...n.children)}}const Z=createGObject({name:`adwaita-web`,dispatch(e,t,n){if(!(e instanceof HTMLElement))throw Error(`No signal '${t}' on object '${String(e)}'`);dispatchElement(e,t,n)},listen(e,t,n){if(!(e instanceof HTMLElement))throw Error(`No signal '${t}' on object '${String(e)}'`);return listenElement(e,t,n)},createFromTree(e,t,n){return buildTemplateTree(e,t,n)},attach(e,t){let n=ua.get(e)??[];n.push(t),ua.set(e,n)},register(e,t){if(!isElementClass(e))return;let n=tagForTypeName(t.typeName),r=fa.get(n)??(customElements.get(n)===void 0?void 0:`another class`);if(r!==void 0)throw Error(`GObject.registerClass: ${t.typeName} would be <${n}>, which ${r} already defines. Give the class a distinct GTypeName.`);let i=Object.getPrototypeOf(e),a=typeof customElements.getName==`function`?customElements.getName(i):null;class Constructing extends i{constructor(e){if(super(),da.has(this))return;da.add(this);let t=constructRegistered(this,e);for(let[e,r]of Object.entries(t)){let t=propertyOf(e);if(!(t in this))throw Error(`No property ${e} on <${n}>`);this[t]=r}}}Object.setPrototypeOf(e,Constructing),Object.setPrototypeOf(e.prototype,Constructing.prototype);let o=e.prototype;for(let[e,t]of Object.entries({...widgetDisplayMembers(Y),...widgetTreeMembers(),...widgetControllerMembers(Xn)}))e in o||Object.defineProperty(o,e,{value:t,writable:!0,configurable:!0});let s=o.connectedCallback;Object.defineProperty(o,"connectedCallback",{configurable:!0,writable:!0,value(){attachPending(this),syncDirection(this),inheritStyles(n,a),s?.call(this)}}),declareSignals(e,t),customElements.define(n,e),fa.set(n,t.typeName),registerTemplateClass(t.typeName,n)}});Z.Object,Z.registerClass,Z.type_ensure,Z.signal_stop_emission_by_name,Z.ParamSpec,Z.ParamFlags,Z.Value,Z.TYPE_STRING,Z.TYPE_BOOLEAN,Z.TYPE_INT,Z.TYPE_UINT,Z.TYPE_DOUBLE,Z.GTypeName,Z.GTypeFlags,Z.interfaces,Z.properties,Z.signals,Z.requires,Z.__gtkTemplate__,Z.__gtkCssName__,Z.__gtkChildren__,Z.__gtkInternalChildren__;let pa=1;var SignalEmitter=class{constructor(){this.handlers=new Map,this.emissions=[]}connect(e,t){return this.add(e,t,!1)}connect_after(e,t){return this.add(e,t,!0)}checkSignal(e){}add(e,t,n){this.checkSignal(e);let r=pa++;return this.handlers.set(r,{name:e,callback:t,after:n}),r}disconnect(e){if(!this.handlers.delete(e))throw Error(`No signal handler with id ${e} on this object`)}classHandler(e,t){}emit(e,...t){this.run(e,t,!1)}emitHandled(e,...t){return this.run(e,t,!0)}run(e,t,n){let r=Array.from(this.handlers).filter(([,t])=>t.name===e),i={name:e,stopped:!1};this.emissions.push(i);let a=!1,stage=e=>{for(let[o,s]of r){if(i.stopped)return!0;if(s.after!==e||!this.handlers.has(o))continue;let r=s.callback(this,...t);if(n&&r)return a=!0,!0}return i.stopped};try{if(stage(!1))return a;let r=this.classHandler(e,t);return n&&r?!0:(i.stopped||stage(!0),a)}finally{this.emissions.splice(this.emissions.lastIndexOf(i),1)}}[S](e){for(let t=this.emissions.length-1;t>=0;t--){let n=this.emissions[t];if(n.name===e&&!n.stopped){n.stopped=!0;return}}console.warn(`no emission of signal "${e}" to stop`)}},TextIter=class{constructor(e,t){this.source=e,this.offset=t}get utf16Offset(){return this.offset}get_offset(){let e=0,t=this.source.getText(0,this.offset);for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);if(r>=55296&&r<=56319&&n+1<t.length){let e=t.charCodeAt(n+1);e>=56320&&e<=57343&&n++}e++}return e}set_offset(e){if(!Number.isInteger(e))throw TypeError(`TextIter.set_offset: ${e} is not an integer`);let t=this.source.getText(),n=0;for(let r=0;e>=0&&r<e&&n<t.length;r++)n+=t.codePointAt(n)>65535?2:1;this.offset=e<0||n>=t.length?this.source.length:n}},TextMark=class{constructor(e){this.name=e}};const ma=new Set([`changed`,`mark-set`,`begin-user-action`,`end-user-action`,`undo`,`redo`,`cursor-moved`,`notify::language`,`notify::style-scheme`,`notify::highlight-syntax`,`notify::cursor-position`,`notify::can-undo`,`notify::can-redo`]);var GtkSourceBuffer=class extends SignalEmitter{constructor(e=``){super(),this.lines=[``],this.lineStarts=[0],this.startsValidTo=1,this.cursor=0,this.bound=0,this.insertMark=new TextMark(`insert`),this.boundMark=new TextMark(`selection_bound`),this.undoStack=[],this.redoStack=[],this.open=null,this.depth=0,this.recording=!0,this.reportedUndo=!1,this.reportedRedo=!1,this.lang=null,this.scheme=null,this.highlight=!0;let{text:t=``,highlightSyntax:n=!0}=typeof e==`string`?{text:e}:e;t!==``&&(this.lines=t.split(`
25
25
  `)),this.highlight=n!==!1&&String(n)!==`false`}get text(){return this.lines.join(`
26
26
  `)}set text(e){this.recording=!1;try{this.replace(0,this.length,e??``),this.placeCursor(this.length)}finally{this.recording=!0}this.undoStack=[],this.redoStack=[],this.open&&(this.open.edits.length=0),this.syncUndoState()}get length(){return this.offsetOfLine(this.lines.length-1)+this.lines[this.lines.length-1].length}get lineCount(){return this.lines.length}getLine(e){let t=this.lines[e];if(t===void 0)throw RangeError(`Buffer: line ${e} is outside 0..${this.lines.length-1}`);return t}getLines(){return[...this.lines]}offsetOfLine(e){if(e<0||e>=this.lines.length)throw RangeError(`Buffer: line ${e} is outside 0..${this.lines.length-1}`);for(;this.startsValidTo<=e;){let e=this.startsValidTo-1;this.lineStarts[this.startsValidTo]=this.lineStarts[e]+this.lines[e].length+1,this.startsValidTo++}return this.lineStarts[e]}lineOfOffset(e){this.checkOffset(e);let t=0,n=this.lines.length-1;for(;t<n;){let r=t+n+1>>1;this.offsetOfLine(r)<=e?t=r:n=r-1}return t}getText(e=0,t=this.length){if(this.checkOffset(e),this.checkOffset(t),e>t)throw RangeError(`Buffer: range ${e}..${t} is reversed`);return this.text.slice(e,t)}insert(e,t){this.replace(e,e,t)}delete(e,t){if(typeof e==`number`&&typeof t==`number`){this.replace(e,t,``);return}let n=typeof e==`number`?e:this.ownIter(e,`delete`),r=typeof t==`number`?t:this.ownIter(t,`delete`);this.replace(Math.min(n,r),Math.max(n,r),``)}replace(e,t,n){if(this.checkOffset(e),this.checkOffset(t),e>t)throw RangeError(`Buffer: range ${e}..${t} is reversed`);let r=this.lineOfOffset(e),i=this.lineOfOffset(t),a=this.offsetOfLine(r),o=this.offsetOfLine(i),s=this.lines.slice(r,i+1).join(`
27
27
  `).slice(e-a,t-a);if(s===``&&n===``)return;let c=(this.lines[r].slice(0,e-a)+n+this.lines[i].slice(t-o)).split(`
@@ -96,7 +96,7 @@ gtk-source-view .gsv-area {
96
96
  }
97
97
  gtk-source-view.cursor-hidden .gsv-area { caret-color: transparent; }
98
98
  gtk-source-view .gsv-area::selection { background: var(--gsv-selection); color: transparent; }
99
- `,document.head.appendChild(e)}const Fa={"auto-indent":[`autoIndent`,!1,toBoolean],"indent-width":[`indentWidth`,-1,toNumber],"show-line-numbers":[`showLineNumbers`,!1,toBoolean],"highlight-current-line":[`highlightCurrentLine`,!1,toBoolean],monospace:[`monospace`,!1,toBoolean],editable:[`editable`,!0,toBoolean],"cursor-visible":[`cursorVisible`,!0,toBoolean],"left-margin":[`leftMargin`,0,toNumber],"right-margin":[`rightMargin`,0,toNumber],"top-margin":[`topMargin`,0,toNumber],"bottom-margin":[`bottomMargin`,0,toNumber]},Ia=[`auto-indent`,`indent-width`,`show-line-numbers`,`highlight-current-line`,`monospace`,`editable`,`cursor-visible`,`left-margin`,`right-margin`,`top-margin`,`bottom-margin`];var GtkSourceView=class extends HTMLElement{static get observedAttributes(){return Ia}session;driver;unsubscribe=null;built=!1;gutter=document.createElement(`div`);rightGutter=document.createElement(`div`);backdrop=document.createElement(`div`);area=document.createElement(`textarea`);vadj=new GtkAdjustment;hadj=new GtkAdjustment;direction=1;gutters=new GutterSet(this);constructor(){super(),this.gutter.className=`gsv-gutter`,this.rightGutter.className=`gsv-gutter gsv-gutter-right`,this.backdrop.className=`gsv-backdrop`,this.area.className=`gsv-area`,this.area.wrap=`off`,this.area.spellcheck=!1,this.area.autocapitalize=`off`,this.area.autocomplete=`off`,this.driver=new WebEditorDriver({root:this,area:this.area,backdrop:this.backdrop,gutter:this.gutter,rightGutter:this.rightGutter}),this.session=new EditorSession(this.driver,void 0,adwaitaColorScheme()),this.session.bindGutters(this.gutters)}syncAdjustments(){let{area:e}=this;this.vadj.configure(e.scrollTop,0,e.scrollHeight,20,e.clientHeight,e.clientHeight),this.hadj.configure(e.scrollLeft,0,e.scrollWidth,20,e.clientWidth,e.clientWidth)}onAreaScroll=()=>this.syncAdjustments();connectedCallback(){if(ensureStyleInjected(),this.area.addEventListener(`scroll`,this.onAreaScroll),!this.built){this.built=!0;let e=document.createElement(`div`);e.className=`gsv-stage`,e.append(this.backdrop,this.area),this.append(this.gutter,e,this.rightGutter)}this.driver.attach(),this.unsubscribe=onAdwaitaColorSchemeChanged(()=>this.session.setColorScheme(adwaitaColorScheme())),this.session.setColorScheme(adwaitaColorScheme())}disconnectedCallback(){this.area.removeEventListener(`scroll`,this.onAreaScroll),this.unsubscribe?.(),this.unsubscribe=null,this.driver.detach()}attributeChangedCallback(e,t,n){let[r,i,a]=Fa[e],o=n===null?i:n===``&&typeof i==`boolean`?!0:a(n,`GtkSource.View.${r}`);this[r]=o}get buffer(){return this.session.buffer}set buffer(e){this.session.buffer=e}get autoIndent(){return this.session.autoIndent}set autoIndent(e){this.session.autoIndent=toBoolean(e,`GtkSource.View.autoIndent`)}get indentWidth(){return this.session.indentWidth}set indentWidth(e){this.session.indentWidth=toNumber(e,`GtkSource.View.indentWidth`)}get showLineNumbers(){return this.session.showLineNumbers}set showLineNumbers(e){this.session.showLineNumbers=toBoolean(e,`GtkSource.View.showLineNumbers`)}get highlightCurrentLine(){return this.session.highlightCurrentLine}set highlightCurrentLine(e){this.session.highlightCurrentLine=toBoolean(e,`GtkSource.View.highlightCurrentLine`)}get monospace(){return this.session.monospace}set monospace(e){this.session.monospace=toBoolean(e,`GtkSource.View.monospace`)}get editable(){return this.session.editable}set editable(e){this.session.editable=toBoolean(e,`GtkSource.View.editable`)}get cursorVisible(){return this.session.cursorVisible}set cursorVisible(e){this.session.cursorVisible=toBoolean(e,`GtkSource.View.cursorVisible`)}get cursor_visible(){return this.cursorVisible}set cursor_visible(e){this.cursorVisible=e}get_cursor_visible(){return this.cursorVisible}set_cursor_visible(e){this.cursorVisible=e}get_editable(){return this.editable}set_editable(e){this.editable=e}get highlight_current_line(){return this.highlightCurrentLine}set highlight_current_line(e){this.highlightCurrentLine=e}get show_line_numbers(){return this.showLineNumbers}set show_line_numbers(e){this.showLineNumbers=e}get vadjustment(){return this.vadj}get hadjustment(){return this.hadj}get_vadjustment(){return this.vadj}get_hadjustment(){return this.hadj}set_direction(e){if(![0,1,2].includes(e))throw TypeError(`${e} is not a valid value for enum argument dir`);this.direction=e,e===0?this.removeAttribute(`dir`):this.dir=e===2?`rtl`:`ltr`}get_direction(){return this.direction}get_first_child(){return null}get_next_sibling(){return this.nextElementSibling}get_parent(){return this.parentElement}get_gutter(e){return this.gutters.get(e)}get leftMargin(){return this.session.leftMargin}set leftMargin(e){this.session.leftMargin=toNumber(e,`GtkSource.View.leftMargin`)}get rightMargin(){return this.session.rightMargin}set rightMargin(e){this.session.rightMargin=toNumber(e,`GtkSource.View.rightMargin`)}get topMargin(){return this.session.topMargin}set topMargin(e){this.session.topMargin=toNumber(e,`GtkSource.View.topMargin`)}get bottomMargin(){return this.session.bottomMargin}set bottomMargin(e){this.session.bottomMargin=toNumber(e,`GtkSource.View.bottomMargin`)}connect(e,t){return this.session.connect(e,((e,...n)=>t(this,...n)))}connect_after(e,t){return this.session.connect_after(e,((e,...n)=>t(this,...n)))}[S](e){this.session[S](e)}disconnect(e){this.session.disconnect(e)}get textarea(){return this.area}};customElements.define(`gtk-source-view`,GtkSourceView);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 AdwShortcutsSection=class extends HTMLElement{_initialized=!1;_bodyEl;_titleEl;static get observedAttributes(){return[`title`]}get title(){return this.getAttribute(`title`)??``}set title(e){this.setAttribute(`title`,e)}get items(){return[...this._bodyEl.children]}connectedCallback(){this._initialized||(this._initialized=!0,this._titleEl=document.createElement(`div`),this._titleEl.className=`adw-shortcuts-section-title`,this._bodyEl=document.createElement(`div`),this._bodyEl.className=`adw-shortcuts-section-body`,this.setAttribute(`role`,`group`),bindSlottedChildren(this,[{into:this._bodyEl}]).install(this._titleEl,this._bodyEl),this._render())}attributeChangedCallback(e){this._initialized&&e===`title`&&this._render()}_render(){let e=this.title;this._titleEl.textContent=e,this._titleEl.hidden=e.length===0}};customElements.define(`adw-shortcuts-section`,AdwShortcutsSection);const La=[`ltr`,`rtl`,`none`];var AdwShortcutsItem=class extends HTMLElement{_initialized=!1;_titleEl;_subtitleEl;_labelEl;static get observedAttributes(){return[`title`,`subtitle`,`accelerator`,`action-name`,`direction`]}get title(){return this.getAttribute(`title`)??``}set title(e){this.setAttribute(`title`,e)}get subtitle(){return this.getAttribute(`subtitle`)??``}set subtitle(e){this.setAttribute(`subtitle`,e)}get accelerator(){return this.getAttribute(`accelerator`)??``}set accelerator(e){e?this.setAttribute(`accelerator`,e):this.removeAttribute(`accelerator`)}get actionName(){return this.getAttribute(`action-name`)??``}set actionName(e){e?this.setAttribute(`action-name`,e):this.removeAttribute(`action-name`)}get direction(){let e=this.getAttribute(`direction`);return e&&La.includes(e)?e:`none`}set direction(e){this.setAttribute(`direction`,e)}get hasAccelerator(){return this.accelerator.length>0}connectedCallback(){this._initialized||(this._initialized=!0,this.setAttribute(`role`,`listitem`),this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-shortcuts-item-title`,this._subtitleEl=document.createElement(`span`),this._subtitleEl.className=`adw-shortcuts-item-subtitle`,this._labelEl=document.createElement(`adw-shortcut-label`),this._labelEl.className=`adw-shortcuts-item-label`,this.replaceChildren(this._titleEl,this._subtitleEl,this._labelEl),this._render())}attributeChangedCallback(e){this._initialized&&(e===`direction`||e===`accelerator`||e===`action-name`?this._render():e===`title`?this._titleEl.textContent=this.title:e===`subtitle`&&this._renderSubtitle())}_render(){this._titleEl.textContent=this.title,this._renderSubtitle(),this._labelEl.setAttribute(`accelerator`,this.accelerator),this._labelEl.hidden=!this.hasAccelerator;let e=this.direction;if(e!==`none`){let t=getComputedStyle(this).direction;this.hidden=t!==e}else this.hidden=!1}_renderSubtitle(){let e=this.subtitle;this._subtitleEl.textContent=e,this._subtitleEl.hidden=e.length===0}};if(customElements.define(`adw-shortcuts-item`,AdwShortcutsItem),typeof document<`u`&&!document.getElementById(`adwaita-web-style`)){let e=document.createElement(`style`);e.id=`adwaita-web-style`,e.textContent=`@charset "UTF-8";
99
+ `,document.head.appendChild(e)}const Fa={"auto-indent":[`autoIndent`,!1,toBoolean],"indent-width":[`indentWidth`,-1,toNumber],"show-line-numbers":[`showLineNumbers`,!1,toBoolean],"highlight-current-line":[`highlightCurrentLine`,!1,toBoolean],monospace:[`monospace`,!1,toBoolean],editable:[`editable`,!0,toBoolean],"cursor-visible":[`cursorVisible`,!0,toBoolean],"left-margin":[`leftMargin`,0,toNumber],"right-margin":[`rightMargin`,0,toNumber],"top-margin":[`topMargin`,0,toNumber],"bottom-margin":[`bottomMargin`,0,toNumber]},Ia=[`auto-indent`,`indent-width`,`show-line-numbers`,`highlight-current-line`,`monospace`,`editable`,`cursor-visible`,`left-margin`,`right-margin`,`top-margin`,`bottom-margin`];var GtkSourceView=class extends HTMLElement{static get observedAttributes(){return Ia}session;driver;unsubscribe=null;built=!1;gutter=document.createElement(`div`);rightGutter=document.createElement(`div`);backdrop=document.createElement(`div`);area=document.createElement(`textarea`);vadj=new GtkAdjustment;hadj=new GtkAdjustment;direction=1;gutters=new GutterSet(this);constructor(){super(),this.gutter.className=`gsv-gutter`,this.rightGutter.className=`gsv-gutter gsv-gutter-right`,this.backdrop.className=`gsv-backdrop`,this.area.className=`gsv-area`,this.area.wrap=`off`,this.area.spellcheck=!1,this.area.autocapitalize=`off`,this.area.autocomplete=`off`,this.driver=new WebEditorDriver({root:this,area:this.area,backdrop:this.backdrop,gutter:this.gutter,rightGutter:this.rightGutter}),this.session=new EditorSession(this.driver,void 0,adwaitaColorScheme()),this.session.bindGutters(this.gutters)}syncAdjustments(){let{area:e}=this;this.vadj.configure(e.scrollTop,0,e.scrollHeight,20,e.clientHeight,e.clientHeight),this.hadj.configure(e.scrollLeft,0,e.scrollWidth,20,e.clientWidth,e.clientWidth)}onAreaScroll=()=>this.syncAdjustments();connectedCallback(){if(ensureStyleInjected(),this.area.addEventListener(`scroll`,this.onAreaScroll),!this.built){this.built=!0;let e=document.createElement(`div`);e.className=`gsv-stage`,e.append(this.backdrop,this.area),this.append(this.gutter,e,this.rightGutter)}this.driver.attach(),this.unsubscribe=onAdwaitaColorSchemeChanged(()=>this.session.setColorScheme(adwaitaColorScheme())),this.session.setColorScheme(adwaitaColorScheme())}disconnectedCallback(){this.area.removeEventListener(`scroll`,this.onAreaScroll),this.unsubscribe?.(),this.unsubscribe=null,this.driver.detach()}attributeChangedCallback(e,t,n){let[r,i,a]=Fa[e],o=n===null?i:n===``&&typeof i==`boolean`?!0:a(n,`GtkSource.View.${r}`);this[r]=o}get buffer(){return this.session.buffer}set buffer(e){this.session.buffer=e}get autoIndent(){return this.session.autoIndent}set autoIndent(e){this.session.autoIndent=toBoolean(e,`GtkSource.View.autoIndent`)}get indentWidth(){return this.session.indentWidth}set indentWidth(e){this.session.indentWidth=toNumber(e,`GtkSource.View.indentWidth`)}get showLineNumbers(){return this.session.showLineNumbers}set showLineNumbers(e){this.session.showLineNumbers=toBoolean(e,`GtkSource.View.showLineNumbers`)}get highlightCurrentLine(){return this.session.highlightCurrentLine}set highlightCurrentLine(e){this.session.highlightCurrentLine=toBoolean(e,`GtkSource.View.highlightCurrentLine`)}get monospace(){return this.session.monospace}set monospace(e){this.session.monospace=toBoolean(e,`GtkSource.View.monospace`)}get editable(){return this.session.editable}set editable(e){this.session.editable=toBoolean(e,`GtkSource.View.editable`)}get cursorVisible(){return this.session.cursorVisible}set cursorVisible(e){this.session.cursorVisible=toBoolean(e,`GtkSource.View.cursorVisible`)}get cursor_visible(){return this.cursorVisible}set cursor_visible(e){this.cursorVisible=e}get_cursor_visible(){return this.cursorVisible}set_cursor_visible(e){this.cursorVisible=e}get_editable(){return this.editable}set_editable(e){this.editable=e}get highlight_current_line(){return this.highlightCurrentLine}set highlight_current_line(e){this.highlightCurrentLine=e}get show_line_numbers(){return this.showLineNumbers}set show_line_numbers(e){this.showLineNumbers=e}get vadjustment(){return this.vadj}get hadjustment(){return this.hadj}get_vadjustment(){return this.vadj}get_hadjustment(){return this.hadj}set_direction(e){if(![0,1,2].includes(e))throw TypeError(`${e} is not a valid value for enum argument dir`);this.direction=e,e===0?this.removeAttribute(`dir`):this.dir=e===2?`rtl`:`ltr`}get_direction(){return this.direction}get_first_child(){return null}get_next_sibling(){return this.nextElementSibling}get_parent(){return this.parentElement}get_gutter(e){return this.gutters.get(e)}get leftMargin(){return this.session.leftMargin}set leftMargin(e){this.session.leftMargin=toNumber(e,`GtkSource.View.leftMargin`)}get rightMargin(){return this.session.rightMargin}set rightMargin(e){this.session.rightMargin=toNumber(e,`GtkSource.View.rightMargin`)}get topMargin(){return this.session.topMargin}set topMargin(e){this.session.topMargin=toNumber(e,`GtkSource.View.topMargin`)}get bottomMargin(){return this.session.bottomMargin}set bottomMargin(e){this.session.bottomMargin=toNumber(e,`GtkSource.View.bottomMargin`)}connect(e,t){return this.session.connect(e,((e,...n)=>t(this,...n)))}connect_after(e,t){return this.session.connect_after(e,((e,...n)=>t(this,...n)))}[S](e){this.session[S](e)}disconnect(e){this.session.disconnect(e)}get textarea(){return this.area}};customElements.define(`gtk-source-view`,GtkSourceView);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_columns(){return this.columns}set_columns(e){this.columns=e}get_rows(){return this.rows}set_rows(e){this.rows=e}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 AdwShortcutsSection=class extends HTMLElement{_initialized=!1;_bodyEl;_titleEl;static get observedAttributes(){return[`title`]}get title(){return this.getAttribute(`title`)??``}set title(e){this.setAttribute(`title`,e)}get items(){return[...this._bodyEl.children]}connectedCallback(){this._initialized||(this._initialized=!0,this._titleEl=document.createElement(`div`),this._titleEl.className=`adw-shortcuts-section-title`,this._bodyEl=document.createElement(`div`),this._bodyEl.className=`adw-shortcuts-section-body`,this.setAttribute(`role`,`group`),bindSlottedChildren(this,[{into:this._bodyEl}]).install(this._titleEl,this._bodyEl),this._render())}attributeChangedCallback(e){this._initialized&&e===`title`&&this._render()}_render(){let e=this.title;this._titleEl.textContent=e,this._titleEl.hidden=e.length===0}};customElements.define(`adw-shortcuts-section`,AdwShortcutsSection);const La=[`ltr`,`rtl`,`none`];var AdwShortcutsItem=class extends HTMLElement{_initialized=!1;_titleEl;_subtitleEl;_labelEl;static get observedAttributes(){return[`title`,`subtitle`,`accelerator`,`action-name`,`direction`]}get title(){return this.getAttribute(`title`)??``}set title(e){this.setAttribute(`title`,e)}get subtitle(){return this.getAttribute(`subtitle`)??``}set subtitle(e){this.setAttribute(`subtitle`,e)}get accelerator(){return this.getAttribute(`accelerator`)??``}set accelerator(e){e?this.setAttribute(`accelerator`,e):this.removeAttribute(`accelerator`)}get actionName(){return this.getAttribute(`action-name`)??``}set actionName(e){e?this.setAttribute(`action-name`,e):this.removeAttribute(`action-name`)}get direction(){let e=this.getAttribute(`direction`);return e&&La.includes(e)?e:`none`}set direction(e){this.setAttribute(`direction`,e)}get hasAccelerator(){return this.accelerator.length>0}connectedCallback(){this._initialized||(this._initialized=!0,this.setAttribute(`role`,`listitem`),this._titleEl=document.createElement(`span`),this._titleEl.className=`adw-shortcuts-item-title`,this._subtitleEl=document.createElement(`span`),this._subtitleEl.className=`adw-shortcuts-item-subtitle`,this._labelEl=document.createElement(`adw-shortcut-label`),this._labelEl.className=`adw-shortcuts-item-label`,this.replaceChildren(this._titleEl,this._subtitleEl,this._labelEl),this._render())}attributeChangedCallback(e){this._initialized&&(e===`direction`||e===`accelerator`||e===`action-name`?this._render():e===`title`?this._titleEl.textContent=this.title:e===`subtitle`&&this._renderSubtitle())}_render(){this._titleEl.textContent=this.title,this._renderSubtitle(),this._labelEl.setAttribute(`accelerator`,this.accelerator),this._labelEl.hidden=!this.hasAccelerator;let e=this.direction;if(e!==`none`){let t=getComputedStyle(this).direction;this.hidden=t!==e}else this.hidden=!1}_renderSubtitle(){let e=this.subtitle;this._subtitleEl.textContent=e,this._subtitleEl.hidden=e.length===0}};if(customElements.define(`adw-shortcuts-item`,AdwShortcutsItem),typeof document<`u`&&!document.getElementById(`adwaita-web-style`)){let e=document.createElement(`style`);e.id=`adwaita-web-style`,e.textContent=`@charset "UTF-8";
100
100
  :root {
101
101
  --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");
102
102
  --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");
@@ -2191,6 +2191,10 @@ adw-application-window.fullscreen {
2191
2191
  outline: none;
2192
2192
  box-shadow: none;
2193
2193
  }
2194
+ adw-window[hidden],
2195
+ adw-application-window[hidden] {
2196
+ display: none;
2197
+ }
2194
2198
 
2195
2199
  .adw-window-content {
2196
2200
  display: flex;