@gjsify/example-gtk-adwaita-storybook 0.38.1 → 0.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/gjs.node.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import{createRequire as e}from"node:module";import"@gjsify/node-gi/globals";import t from"@gjsify/node-gi/system";var n=Object.defineProperty,__name=(e,t)=>n(e,`name`,{value:t,configurable:!0}),__exportAll=(e,t)=>{let r={};for(var i in e)n(r,i,{get:e[i],enumerable:!0});return t||n(r,Symbol.toStringTag,{value:`Module`}),r},StoryRegistry=class{constructor(){this.modules=[]}registerStory(e){if(!e||!Array.isArray(e.stories)){console.warn(`Invalid story module provided to registerStory`);return}this.modules.push(e)}registerStories(e){if(!Array.isArray(e)){console.warn(`Invalid story modules array provided to registerStories`);return}let t=e.filter(e=>e&&Array.isArray(e.stories));this.modules.push(...t)}getStories(){return[...this.modules]}createStoryInstances(){for(let e of this.modules)this.instantiateStoriesForModule(e);return[...this.modules]}instantiateStoriesForModule(e){e.instances=[];let t=e.decorators??[];for(let n of e.stories)try{let r=new n,build=()=>{typeof r.initialize==`function`&&r.initialize()};t.reduceRight((e,t)=>()=>t(e,r),build)(),e.instances.push(r)}catch(e){console.error(`Failed to instantiate story: ${n.name||`Unknown`}`,e)}}},StorybookController=class{constructor(e,t){this._registry=new StoryRegistry,this._activeStory=null,this._unsubArgs=null,this._view=e,this._buildControls=t}mount(e,t=!0){this._registry.registerStories(e);let n=this._registry.createStoryInstances();if(this._view.renderSidebar(this._groupByCategory(n),e=>this.select(e)),t){let e=this._firstStory();e&&this.select(e)}}select(e){this._view.setPreviewTitle(`${e.meta.title} — ${e.story}`),this._view.showPreview(e),this._view.markSelected(e.meta.title),this._wireControls(e),this._activeStory=e}_wireControls(e){this._unsubArgs&&=(this._unsubArgs(),null);let t=this._buildControls(e),n=t.map(e=>e.refresh);this._view.renderControls(t),this._unsubArgs=e.onArgsChanged(e=>{for(let t of n)t(e)})}_groupByCategory(e){let t=new Map;for(let n of e)for(let e of n.instances??[]){let n=e.meta.title.split(`/`),r=n[0],i=n.length>1?n[1]:e.meta.title;t.has(r)||t.set(r,[]),t.get(r).push({instance:e,name:i||`Unnamed`})}return[...t].map(([e,t])=>({category:e,stories:t}))}get activeStory(){return this._activeStory}listStories(){return this._registry.getStories().flatMap(e=>(e.instances??[]).map(e=>({title:e.meta.title,story:e.story,category:e.meta.title.split(`/`)[0],controls:e.meta.controls??[]})))}openStoryByTitle(e){let t=this._findByTitle(e);return t?(this.select(t),!0):!1}getCurrentStory(){let e=this._activeStory;return e?{title:e.meta.title,story:e.story,args:e.args}:null}setActiveArg(e,t){let n=this._activeStory;return n?(n.setArg(e,t),!0):!1}_findByTitle(e){for(let t of this._registry.getStories())for(let n of t.instances??[])if(n.meta.title===e)return n;return null}_firstStory(){for(let e of this._registry.getStories()){let t=(e.instances??[])[0];if(t)return t}return null}};let r=function(e){return e.TEXT=`text`,e.NUMBER=`number`,e.BOOLEAN=`boolean`,e.SELECT=`select`,e.RANGE=`range`,e.COLOR=`color`,e}({});function isStoryModule(e){return typeof e==`object`&&!!e&&Array.isArray(e.stories)}function argsFromControls(e=[]){let t={};for(let n of e)t[n.name]=defaultFor(n);return t}function defaultFor(e){if(e.defaultValue!==void 0)return e.defaultValue;switch(e.type){case`text`:return``;case`color`:return`#000000`;case`boolean`:return!1;case`number`:case`range`:return e.min??0;case`select`:return e.options[0]?.value??null;default:return null}}function controlLabel(e){return e.label||e.name}function bindControl(e,t,n){let i=t.name,a=t.description;switch(t.type){case r.TEXT:{let r=n.text(controlLabel(t),a),o=e.args[i];return r.set(typeof o==`string`?o:``),r.onChange(t=>e.setArg(i,t)),{view:r.node,refresh:e=>{let t=typeof e[i]==`string`?e[i]:``;r.get()!==t&&r.set(t)}}}case r.COLOR:{let r=n.color(controlLabel(t),a),o=e.args[i];return r.set(typeof o==`string`?o:`#000000`),r.onChange(t=>e.setArg(i,t)),{view:r.node,refresh:e=>{let t=typeof e[i]==`string`?e[i]:`#000000`;r.get()!==t&&r.set(t)}}}case r.BOOLEAN:{let r=n.boolean(controlLabel(t),a);return r.set(!!e.args[i]),r.onChange(t=>e.setArg(i,t)),{view:r.node,refresh:e=>{let t=!!e[i];r.get()!==t&&r.set(t)}}}case r.NUMBER:{let r=n.number(t),a=e.args[i];return r.set(typeof a==`number`?a:t.min??0),r.onChange(t=>e.setArg(i,t)),{view:r.node,refresh:e=>{let t=typeof e[i]==`number`?e[i]:0;r.get()!==t&&r.set(t)}}}case r.RANGE:{let r=n.range(t),a=e.args[i],o=typeof a==`number`?a:t.min??0;return r.set(o),r.onChange(t=>e.setArg(i,t)),{view:r.node,refresh:e=>{let t=typeof e[i]==`number`?e[i]:o;r.get()!==t&&r.set(t)}}}case r.SELECT:{let r=t.options;if(!r?.length)return console.warn(`SELECT control "${i}" has no options`),null;let a=n.select(t),o=e.args[i],s=Math.max(0,r.findIndex(e=>e.value===o));return a.set(s),a.onChange(t=>{t>=0&&t<r.length&&e.setArg(i,r[t].value)}),{view:a.node,refresh:e=>{let t=e[i],n=r.findIndex(e=>e.value===t);n>=0&&a.get()!==n&&a.set(n)}}}default:return console.warn(`Unsupported control type: ${t.type}`),null}}function buildStorybookDevtoolsExtension(e){let currentStory=()=>e.getCurrentStory();return{methods:[{name:`ListStories`,kind:`read-only`,handler:(()=>JSON.stringify(e.listStories(),null,2))},{name:`GetCurrentStory`,kind:`read-only`,handler:(()=>JSON.stringify(currentStory(),null,2))},{name:`OpenStory`,kind:`mutating`,handler:(t=>e.openStoryByTitle(t))},{name:`SetStoryArg`,kind:`mutating`,handler:((t,n)=>e.setActiveArg(t,n?JSON.parse(n):null))},{name:`GetStoryArgs`,kind:`read-only`,handler:(()=>JSON.stringify(currentStory()?.args??{},null,2))}],contributeStatus:()=>{let t=currentStory(),n=e.listStories();return{storybook:{currentStory:t?{title:t.title,story:t.story}:null,storyCount:n.length}}}}}function collectStoryModules$1(e){let t=[];for(let n of e)if(!(!n||typeof n!=`object`))for(let e of Object.values(n))isStoryModule(e)&&t.push(e);return t}__name(collectStoryModules$1,`collectStoryModules`);var StoryViewBase=class{constructor(){this._listeners=new Set}initBase(e,t,n){this._meta=e,this._story=t,this._args=argsFromControls(e.controls),this._chrome=this.createChrome(e,n),this.refreshChromeText()}get meta(){return this._meta}get story(){return this._story}get args(){return this._args}get root(){return this._chrome.root}set args(e){this._args!==e&&(this._args=e,this.updateArgs(e),this.emitArgs(e))}emitArgs(e){for(let t of this._listeners)t(e)}onArgsChanged(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}setArg(e,t){this.args={...this._args,[e]:t}}initialize(){}updateArgs(e){}teardown(){}addContent(e){this._chrome.hasStage&&this._chrome.setStageContent(e)}refreshChromeText(){let e=this._story?`${this._meta.title} — ${this._story}`:this._meta.title;this._chrome.setChromeText(e,this._meta.description??``)}};const i=[`system`,`light`,`dark`];var StorybookSettings=class{constructor(e=()=>!1){this._colorScheme=`system`,this._accentMode=`system`,this._accent=`blue`,this._listeners=new Set,this._systemDark=e}get colorScheme(){return this._colorScheme}set colorScheme(e){!i.includes(e)||e===this._colorScheme||(this._colorScheme=e,this._notify())}get accentMode(){return this._accentMode}set accentMode(e){e!==this._accentMode&&(this._accentMode=e,this._notify())}get accent(){return this._accent}set accent(e){e!==this._accent&&(this._accent=e,this._notify())}get resolvedAccent(){return this._accentMode===`custom`?this._accent:null}get resolvedDark(){return this._colorScheme===`dark`?!0:this._colorScheme===`light`?!1:this._systemDark()}get state(){return{colorScheme:this._colorScheme,accentMode:this._accentMode,accent:this._accent}}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}systemChanged(){this._colorScheme===`system`&&this._notify()}_notify(){let e=this.state;for(let t of[...this._listeners])try{t(e)}catch{}}};const a={ListStories:`<method name="ListStories"><arg type="s" direction="out" name="stories_json"/></method>`,GetCurrentStory:`<method name="GetCurrentStory"><arg type="s" direction="out" name="story_json"/></method>`,OpenStory:`<method name="OpenStory"><arg type="s" direction="in" name="title"/><arg type="b" direction="out" name="opened"/></method>`,SetStoryArg:`<method name="SetStoryArg"><arg type="s" direction="in" name="name"/><arg type="s" direction="in" name="value_json"/><arg type="b" direction="out" name="applied"/></method>`,GetStoryArgs:`<method name="GetStoryArgs"><arg type="s" direction="out" name="args_json"/></method>`};function storybookDevtoolsExtension(e){let t=buildStorybookDevtoolsExtension(e.controller),n=[],r={},i={};for(let e of t.methods){let t=a[e.name];t&&n.push(t),r[e.name]=e.handler,i[e.name]=e.kind}return{methodsXml:n,handlers:r,methodKinds:i,contributeStatus:t.contributeStatus}}const o=e(import.meta.url);let s;function load$6(){return s===void 0&&(s=o(`@gjsify/node-gi/gi`).requireGi(`GLib`,`2.0`)),s}__name(load$6,`load`);var c=new Proxy(Object.create(null),{get(e,t){return load$6()[t]},has(e,t){return t in load$6()}});function variantKindFor(e,t){switch(e){case`s`:case`b`:case`i`:case`u`:case`d`:return e}if(typeof t==`string`)return`s`;if(typeof t==`boolean`)return`b`;if(typeof t==`number`)return Number.isInteger(t)?`i`:`d`;throw Error(`Cannot build a GLib.Variant from ${typeof t}`)}function buildVariant(e,t){switch(variantKindFor(e?.dup_string()??null,t)){case`s`:return c.Variant.new_string(String(t));case`b`:return c.Variant.new_boolean(!!t);case`i`:return c.Variant.new_int32(Number(t));case`u`:return c.Variant.new_uint32(Number(t));case`d`:return c.Variant.new_double(Number(t))}}function describeActions(e){return e?e.list_actions().sort((e,t)=>e.localeCompare(t)).map(t=>({name:t,enabled:e.get_action_enabled(t),parameterType:e.get_action_parameter_type(t)?.dup_string()??null,stateType:e.get_action_state_type(t)?.dup_string()??null})):[]}function activateAction(e,t,n){let r=e.get_action_parameter_type(t),i=n==null?null:buildVariant(r,n);e.activate_action(t,i)}function changeActionState(e,t,n){e.change_action_state(t,buildVariant(e.get_action_state_type(t),n))}const l=e(import.meta.url);let u;function load$5(){return u===void 0&&(u=l(`@gjsify/node-gi/gi`).requireGi(`Gdk`,`4.0`)),u}__name(load$5,`load`);var d=new Proxy(Object.create(null),{get(e,t){return load$5()[t]},has(e,t){return t in load$5()}});const f=e(import.meta.url);let p;function load$4(){return p===void 0&&(p=f(`@gjsify/node-gi/gi`).requireGi(`Gtk`,`4.0`)),p}__name(load$4,`load`);var m=new Proxy(Object.create(null),{get(e,t){return load$4()[t]},has(e,t){return t in load$4()}});const h=new Map;function swapCss(e,t){let n=d.Display.get_default();if(!n)return!1;let r=h.get(e);return r||(r=new m.CssProvider,m.StyleContext.add_provider_for_display(n,r,m.STYLE_PROVIDER_PRIORITY_USER+1),h.set(e,r)),r.load_from_string(t),!0}function dumpCss(){return{providers:[...h.keys()]}}const g=`org.gjsify.Devtools`;function formatDbusErrorMessage(e,t){return`${e}: ${t}`}const ee={GetStatus:`read-only`,Screenshot:`read-only`,ListActions:`read-only`,ActivateAction:`mutating`,ChangeActionState:`mutating`,PresentWindow:`read-only`,ResizeWindow:`mutating`,ListToplevels:`read-only`,DumpTree:`read-only`,GetProperty:`read-only`,GetFocused:`read-only`,ActivateWidget:`mutating`,DumpGSettings:`read-only`,DumpCss:`read-only`,SwapCss:`mutating`};function sanitizeInstanceId(e){let t=e.toLowerCase().replace(/[^a-z0-9]/g,``);return/^[a-z]/.test(t)?t:`i${t||`0`}`}function resolveBusAddress(e,t){let n=`/${e.replace(/\./g,`/`)}`,r=t&&t!=="default"?sanitizeInstanceId(t):`default`;return r==="default"?{busName:e,objectPath:`${n}/devtools`,instance:`default`}:{busName:`${e}.${r}`,objectPath:`${n}/${r}/devtools`,instance:r}}const _=`GJSIFY_DEVTOOLS_ADDRESS`;function isDevtoolsEnabledValue(e){if(e==null)return!1;let t=e.toLowerCase();return t!==``&&t!==`0`&&t!==`false`}function devtoolsAddressFilePath(e,t,n){let{busName:r}=resolveBusAddress(t,n);return`${e}/gjsify-devtools/${r}.address`}function buildDevtoolsIfaceXml(e=[]){return`<node>
2
- <interface name="${g}">
1
+ import{createRequire as e}from"node:module";import"@gjsify/node-gi/globals";import t from"@gjsify/node-gi/system";var n=Object.defineProperty,__name=(e,t)=>n(e,`name`,{value:t,configurable:!0}),__exportAll=(e,t)=>{let r={};for(var i in e)n(r,i,{get:e[i],enumerable:!0});return t||n(r,Symbol.toStringTag,{value:`Module`}),r};const r=[`Overview`,`Presentation`,`Boxed Lists`,`Controls`,`Buttons`,`Layout`,`View Switching`,`Navigation`,`Feedback`];function orderCategories(e){let t=new Map(r.map((e,t)=>[e,t])),n=[...e].filter(e=>t.has(e));n.sort((e,n)=>t.get(e)-t.get(n));let i=e.filter(e=>!t.has(e));return[...n,...i]}var StoryRegistry=class{constructor(){this.modules=[]}registerStory(e){if(!e||!Array.isArray(e.stories)){console.warn(`Invalid story module provided to registerStory`);return}this.modules.push(e)}registerStories(e){if(!Array.isArray(e)){console.warn(`Invalid story modules array provided to registerStories`);return}let t=e.filter(e=>e&&Array.isArray(e.stories));this.modules.push(...t)}getStories(){return[...this.modules]}createStoryInstances(){for(let e of this.modules)this.instantiateStoriesForModule(e);return[...this.modules]}instantiateStoriesForModule(e){e.instances=[];let t=e.decorators??[];for(let n of e.stories)try{let r=new n,build=()=>{typeof r.initialize==`function`&&r.initialize()};t.reduceRight((e,t)=>()=>t(e,r),build)(),e.instances.push(r)}catch(e){console.error(`Failed to instantiate story: ${n.name||`Unknown`}`,e)}}},StorybookController=class{constructor(e,t){this._registry=new StoryRegistry,this._activeStory=null,this._unsubArgs=null,this._view=e,this._buildControls=t}mount(e,t=!0){this._registry.registerStories(e);let n=this._registry.createStoryInstances(),r=this._groupByCategory(n);if(this._view.renderSidebar(r,e=>this.select(e)),t){let e=r[0]?.stories[0]?.instance??null;e&&this.select(e)}}select(e){this._view.setPreviewTitle(`${e.meta.title} — ${e.story}`),this._view.showPreview(e),this._view.markSelected(e.meta.title),this._wireControls(e),this._activeStory=e}_wireControls(e){this._unsubArgs&&=(this._unsubArgs(),null);let t=this._buildControls(e),n=t.map(e=>e.refresh);this._view.renderControls(t),this._unsubArgs=e.onArgsChanged(e=>{for(let t of n)t(e)})}_groupByCategory(e){let t=new Map;for(let n of e)for(let e of n.instances??[]){let n=e.meta.title.split(`/`),r=n[0],i=n.length>1?n[1]:e.meta.title;t.has(r)||t.set(r,[]),t.get(r).push({instance:e,name:i||`Unnamed`})}return orderCategories([...t.keys()]).map(e=>({category:e,stories:t.get(e)}))}get activeStory(){return this._activeStory}listStories(){return this._registry.getStories().flatMap(e=>(e.instances??[]).map(e=>({title:e.meta.title,story:e.story,category:e.meta.title.split(`/`)[0],controls:e.meta.controls??[]})))}openStoryByTitle(e){let t=this._findByTitle(e);return t?(this.select(t),!0):!1}getCurrentStory(){let e=this._activeStory;return e?{title:e.meta.title,story:e.story,args:e.args}:null}setActiveArg(e,t){let n=this._activeStory;return n?(n.setArg(e,t),!0):!1}_findByTitle(e){for(let t of this._registry.getStories())for(let n of t.instances??[])if(n.meta.title===e)return n;return null}};let i=function(e){return e.TEXT=`text`,e.NUMBER=`number`,e.BOOLEAN=`boolean`,e.SELECT=`select`,e.RANGE=`range`,e.COLOR=`color`,e}({});function isStoryModule(e){return typeof e==`object`&&!!e&&Array.isArray(e.stories)}function argsFromControls(e=[]){let t={};for(let n of e)t[n.name]=defaultFor(n);return t}function defaultFor(e){if(e.defaultValue!==void 0)return e.defaultValue;switch(e.type){case`text`:return``;case`color`:return`#000000`;case`boolean`:return!1;case`number`:case`range`:return e.min??0;case`select`:return e.options[0]?.value??null;default:return null}}function controlLabel(e){return e.label||e.name}function bindControl(e,t,n){let r=t.name,a=t.description;switch(t.type){case i.TEXT:{let i=n.text(controlLabel(t),a),o=e.args[r];return i.set(typeof o==`string`?o:``),i.onChange(t=>e.setArg(r,t)),{view:i.node,refresh:e=>{let t=typeof e[r]==`string`?e[r]:``;i.get()!==t&&i.set(t)}}}case i.COLOR:{let i=n.color(controlLabel(t),a),o=e.args[r];return i.set(typeof o==`string`?o:`#000000`),i.onChange(t=>e.setArg(r,t)),{view:i.node,refresh:e=>{let t=typeof e[r]==`string`?e[r]:`#000000`;i.get()!==t&&i.set(t)}}}case i.BOOLEAN:{let i=n.boolean(controlLabel(t),a);return i.set(!!e.args[r]),i.onChange(t=>e.setArg(r,t)),{view:i.node,refresh:e=>{let t=!!e[r];i.get()!==t&&i.set(t)}}}case i.NUMBER:{let i=n.number(t),a=e.args[r];return i.set(typeof a==`number`?a:t.min??0),i.onChange(t=>e.setArg(r,t)),{view:i.node,refresh:e=>{let t=typeof e[r]==`number`?e[r]:0;i.get()!==t&&i.set(t)}}}case i.RANGE:{let i=n.range(t),a=e.args[r],o=typeof a==`number`?a:t.min??0;return i.set(o),i.onChange(t=>e.setArg(r,t)),{view:i.node,refresh:e=>{let t=typeof e[r]==`number`?e[r]:o;i.get()!==t&&i.set(t)}}}case i.SELECT:{let i=t.options;if(!i?.length)return console.warn(`SELECT control "${r}" has no options`),null;let a=n.select(t),o=e.args[r],s=Math.max(0,i.findIndex(e=>e.value===o));return a.set(s),a.onChange(t=>{t>=0&&t<i.length&&e.setArg(r,i[t].value)}),{view:a.node,refresh:e=>{let t=e[r],n=i.findIndex(e=>e.value===t);n>=0&&a.get()!==n&&a.set(n)}}}default:return console.warn(`Unsupported control type: ${t.type}`),null}}function buildStorybookDevtoolsExtension(e){let currentStory=()=>e.getCurrentStory();return{methods:[{name:`ListStories`,kind:`read-only`,handler:(()=>JSON.stringify(e.listStories(),null,2))},{name:`GetCurrentStory`,kind:`read-only`,handler:(()=>JSON.stringify(currentStory(),null,2))},{name:`OpenStory`,kind:`mutating`,handler:(t=>e.openStoryByTitle(t))},{name:`SetStoryArg`,kind:`mutating`,handler:((t,n)=>e.setActiveArg(t,n?JSON.parse(n):null))},{name:`GetStoryArgs`,kind:`read-only`,handler:(()=>JSON.stringify(currentStory()?.args??{},null,2))}],contributeStatus:()=>{let t=currentStory(),n=e.listStories();return{storybook:{currentStory:t?{title:t.title,story:t.story}:null,storyCount:n.length}}}}}function collectStoryModules$1(e){let t=[];for(let n of e)if(!(!n||typeof n!=`object`))for(let e of Object.values(n))isStoryModule(e)&&t.push(e);return t}__name(collectStoryModules$1,`collectStoryModules`);var StoryViewBase=class{constructor(){this._listeners=new Set}initBase(e,t,n){this._meta=e,this._story=t,this._args=argsFromControls(e.controls),this._chrome=this.createChrome(e,n),this.refreshChromeText()}get meta(){return this._meta}get story(){return this._story}get args(){return this._args}get root(){return this._chrome.root}set args(e){this._args!==e&&(this._args=e,this.updateArgs(e),this.emitArgs(e))}emitArgs(e){for(let t of this._listeners)t(e)}onArgsChanged(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}setArg(e,t){this.args={...this._args,[e]:t}}initialize(){}updateArgs(e){}teardown(){}addContent(e){this._chrome.hasStage&&this._chrome.setStageContent(e)}refreshChromeText(){let e=this._story?`${this._meta.title} — ${this._story}`:this._meta.title;this._chrome.setChromeText(e,this._meta.description??``)}};const a=[`system`,`light`,`dark`];var StorybookSettings=class{constructor(e=()=>!1){this._colorScheme=`system`,this._accentMode=`system`,this._accent=`blue`,this._listeners=new Set,this._systemDark=e}get colorScheme(){return this._colorScheme}set colorScheme(e){!a.includes(e)||e===this._colorScheme||(this._colorScheme=e,this._notify())}get accentMode(){return this._accentMode}set accentMode(e){e!==this._accentMode&&(this._accentMode=e,this._notify())}get accent(){return this._accent}set accent(e){e!==this._accent&&(this._accent=e,this._notify())}get resolvedAccent(){return this._accentMode===`custom`?this._accent:null}get resolvedDark(){return this._colorScheme===`dark`?!0:this._colorScheme===`light`?!1:this._systemDark()}get state(){return{colorScheme:this._colorScheme,accentMode:this._accentMode,accent:this._accent}}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}systemChanged(){this._colorScheme===`system`&&this._notify()}_notify(){let e=this.state;for(let t of[...this._listeners])try{t(e)}catch{}}};const o={ListStories:`<method name="ListStories"><arg type="s" direction="out" name="stories_json"/></method>`,GetCurrentStory:`<method name="GetCurrentStory"><arg type="s" direction="out" name="story_json"/></method>`,OpenStory:`<method name="OpenStory"><arg type="s" direction="in" name="title"/><arg type="b" direction="out" name="opened"/></method>`,SetStoryArg:`<method name="SetStoryArg"><arg type="s" direction="in" name="name"/><arg type="s" direction="in" name="value_json"/><arg type="b" direction="out" name="applied"/></method>`,GetStoryArgs:`<method name="GetStoryArgs"><arg type="s" direction="out" name="args_json"/></method>`};function storybookDevtoolsExtension(e){let t=buildStorybookDevtoolsExtension(e.controller),n=[],r={},i={};for(let e of t.methods){let t=o[e.name];t&&n.push(t),r[e.name]=e.handler,i[e.name]=e.kind}return{methodsXml:n,handlers:r,methodKinds:i,contributeStatus:t.contributeStatus}}const s=e(import.meta.url);let c;function load$6(){return c===void 0&&(c=s(`@gjsify/node-gi/gi`).requireGi(`GLib`,`2.0`)),c}__name(load$6,`load`);var l=new Proxy(Object.create(null),{get(e,t){return load$6()[t]},has(e,t){return t in load$6()}});function variantKindFor(e,t){switch(e){case`s`:case`b`:case`i`:case`u`:case`d`:return e}if(typeof t==`string`)return`s`;if(typeof t==`boolean`)return`b`;if(typeof t==`number`)return Number.isInteger(t)?`i`:`d`;throw Error(`Cannot build a GLib.Variant from ${typeof t}`)}function buildVariant(e,t){switch(variantKindFor(e?.dup_string()??null,t)){case`s`:return l.Variant.new_string(String(t));case`b`:return l.Variant.new_boolean(!!t);case`i`:return l.Variant.new_int32(Number(t));case`u`:return l.Variant.new_uint32(Number(t));case`d`:return l.Variant.new_double(Number(t))}}function describeActions(e){return e?e.list_actions().sort((e,t)=>e.localeCompare(t)).map(t=>({name:t,enabled:e.get_action_enabled(t),parameterType:e.get_action_parameter_type(t)?.dup_string()??null,stateType:e.get_action_state_type(t)?.dup_string()??null})):[]}function activateAction(e,t,n){let r=e.get_action_parameter_type(t),i=n==null?null:buildVariant(r,n);e.activate_action(t,i)}function changeActionState(e,t,n){e.change_action_state(t,buildVariant(e.get_action_state_type(t),n))}const u=e(import.meta.url);let d;function load$5(){return d===void 0&&(d=u(`@gjsify/node-gi/gi`).requireGi(`Gdk`,`4.0`)),d}__name(load$5,`load`);var f=new Proxy(Object.create(null),{get(e,t){return load$5()[t]},has(e,t){return t in load$5()}});const p=e(import.meta.url);let m;function load$4(){return m===void 0&&(m=p(`@gjsify/node-gi/gi`).requireGi(`Gtk`,`4.0`)),m}__name(load$4,`load`);var h=new Proxy(Object.create(null),{get(e,t){return load$4()[t]},has(e,t){return t in load$4()}});const g=new Map;function swapCss(e,t){let n=f.Display.get_default();if(!n)return!1;let r=g.get(e);return r||(r=new h.CssProvider,h.StyleContext.add_provider_for_display(n,r,h.STYLE_PROVIDER_PRIORITY_USER+1),g.set(e,r)),r.load_from_string(t),!0}function dumpCss(){return{providers:[...g.keys()]}}const _=`org.gjsify.Devtools`;function formatDbusErrorMessage(e,t){return`${e}: ${t}`}const v={GetStatus:`read-only`,Screenshot:`read-only`,ListActions:`read-only`,ActivateAction:`mutating`,ChangeActionState:`mutating`,PresentWindow:`read-only`,ResizeWindow:`mutating`,ListToplevels:`read-only`,DumpTree:`read-only`,GetProperty:`read-only`,GetFocused:`read-only`,ActivateWidget:`mutating`,DumpGSettings:`read-only`,DumpCss:`read-only`,SwapCss:`mutating`};function sanitizeInstanceId(e){let t=e.toLowerCase().replace(/[^a-z0-9]/g,``);return/^[a-z]/.test(t)?t:`i${t||`0`}`}function appIdToObjectPath(e){return`/${e.replace(/\./g,`/`).replace(/-/g,`_`)}`}function resolveBusAddress(e,t){let n=appIdToObjectPath(e),r=t&&t!=="default"?sanitizeInstanceId(t):`default`;return r==="default"?{busName:e,objectPath:`${n}/devtools`,instance:`default`}:{busName:`${e}.${r}`,objectPath:`${n}/${r}/devtools`,instance:r}}const y=`GJSIFY_DEVTOOLS_ADDRESS`;function isDevtoolsEnabledValue(e){if(e==null)return!1;let t=e.toLowerCase();return t!==``&&t!==`0`&&t!==`false`}function devtoolsAddressFilePath(e,t,n){let{busName:r}=resolveBusAddress(t,n);return`${e}/gjsify-devtools/${r}.address`}function buildDevtoolsIfaceXml(e=[]){return`<node>
2
+ <interface name="${_}">
3
3
  <method name="GetStatus">
4
4
  <arg type="s" direction="out" name="status_json"/>
5
5
  </method>
@@ -61,7 +61,7 @@ import{createRequire as e}from"node:module";import"@gjsify/node-gi/globals";impo
61
61
  </method>${e.length>0?`\n${e.join(`
62
62
  `)}`:``}
63
63
  </interface>
64
- </node>`}const v=e(import.meta.url);let y;function load$3(){return y===void 0&&(y=v(`@gjsify/node-gi/gi`).requireGi(`Gio`,`2.0`)),y}__name(load$3,`load`);var b=new Proxy(Object.create(null),{get(e,t){return load$3()[t]},has(e,t){return t in load$3()}});function isWin32(){return c.DIR_SEPARATOR===92}function defaultListenAddress(){return isWin32()?`nonce-tcp:host=127.0.0.1`:`unix:tmpdir=${c.get_tmp_dir()}`}var DevtoolsPeerServerError=class extends Error{constructor(e,t,n,r){super(e),this.address=t,this.reason=n,this.name=`DevtoolsPeerServerError`,this.cause=r}};function isAddressInUse(e){return e instanceof c.Error&&e.matches(b.io_error_quark(),b.IOErrorEnum.ADDRESS_IN_USE)}function unixSocketPath(e){if(!e.startsWith(`unix:`))return null;for(let t of e.slice(5).split(`,`)){let e=t.indexOf(`=`);if(!(e<0||t.slice(0,e)!==`path`))try{return decodeURIComponent(t.slice(e+1))}catch{return null}}return null}function inspectExistingSocket(e){try{if((b.File.new_for_path(e).query_info(`unix::mode`,b.FileQueryInfoFlags.NONE,null).get_attribute_uint32(`unix::mode`)&61440)!=49152)return`not-a-socket`}catch{return`not-a-socket`}let t=new b.SocketClient;t.set_timeout(2);let n;try{n=t.connect(b.UnixSocketAddress.new(e),null)}catch{return`dead`}return n.close(null),`live`}function clearReclaimableSocket(e){let t=unixSocketPath(e);if(!t||!c.file_test(t,c.FileTest.EXISTS))return;let n=inspectExistingSocket(t);if(n===`live`)throw new DevtoolsPeerServerError(`cannot listen on ${e}: another process is already listening there. Stop it, or point ${_} (or options.address) at a different socket — GJSIFY_DEVTOOLS_INSTANCE=<label> lets two devtools-enabled apps run side by side.`,e,`address-in-use`);if(n===`not-a-socket`)throw new DevtoolsPeerServerError(`cannot listen on ${e}: ${t} already exists and is not a socket, so it will NOT be removed. Point ${_} (or options.address) at a free path.`,e,`occupied-by-other-file`);try{b.File.new_for_path(t).delete(null)}catch(n){throw new DevtoolsPeerServerError(`cannot listen on ${e}: ${t} is a socket nothing listens on, but removing it failed (${n}). Delete it by hand, or point ${_} at a free path.`,e,`address-in-use`,n)}console.log(`[gjsify-devtools] reclaimed the stale socket ${t}: nothing was listening on it (an abnormal exit — Ctrl-C, SIGKILL, a crash — leaves the inode behind).`)}function flagsForAddress(e){return e.startsWith(`tcp:`)||e.startsWith(`nonce-tcp:`)?b.DBusServerFlags.NONE:b.DBusServerFlags.AUTHENTICATION_REQUIRE_SAME_USER}function startDevtoolsPeerServer(e,t,n){let r=n&&n!==``?n:defaultListenAddress();clearReclaimableSocket(r);let i;try{i=b.DBusServer.new_sync(r,flagsForAddress(r),b.dbus_generate_guid(),null,null)}catch(e){let t=isAddressInUse(e);throw new DevtoolsPeerServerError(t?`cannot listen on ${r}: the address is already in use (${e}). Stop whatever holds it, or point ${_} (or options.address) at a different address.`:`cannot listen on ${r}: ${e}. Check the address form — \`unix:path=/tmp/app.sock\`, \`unix:tmpdir=/tmp\` or \`nonce-tcp:host=127.0.0.1\`.`,r,t?`address-in-use`:`listen-failed`,e)}let a=new Set;i.connect(`new-connection`,(n,r)=>(a.add(r),r.connect(`closed`,()=>{e.unexport(r),a.delete(r)}),e.export(r,t),!0)),i.start();let o=!1;return{address:i.get_client_address(),objectPath:t,get connectionCount(){return a.size},stop(){if(!o){o=!0,i.stop();for(let t of a)e.unexport(t),!t.is_closed()&&t.close(null,(e,t)=>{try{e.close_finish(t)}catch{}});a.clear()}}}}function writeDevtoolsAddressFile(e,t){try{if(c.mkdir_with_parents(c.path_get_dirname(e),448),!c.file_set_contents(e,`${t}\n`))return null}catch(t){return console.error(`[gjsify-devtools] could not publish the peer address to ${e}: ${t}`),null}try{b.File.new_for_path(e).set_attribute_uint32(`unix::mode`,384,b.FileQueryInfoFlags.NONE,null)}catch(t){console.error(`[gjsify-devtools] could not restrict ${e} to the current user: ${t}`)}return e}function removeDevtoolsAddressFile(e){try{b.File.new_for_path(e).delete(null)}catch{}}const te=e(import.meta.url);let x;function load$2(){return x===void 0&&(x=te(`@gjsify/node-gi/gi`).requireGi(`Graphene`,`1.0`)),x}__name(load$2,`load`);var ne=new Proxy(Object.create(null),{get(e,t){return load$2()[t]},has(e,t){return t in load$2()}});function captureWidgetPng(e){let t=e.get_native()?.get_renderer();if(!t)return null;let n=e.get_width(),r=e.get_height();if(n<=0||r<=0)return null;let i=m.WidgetPaintable.new(e),a=m.Snapshot.new();i.snapshot(a,n,r);let o=a.to_node();if(!o)return null;let s=new ne.Rect;s.init(0,0,n,r);let c=t.render_texture(o,s).save_to_png_bytes().get_data();return c?new Uint8Array(c):null}function dumpGSettings(e){let t=b.SettingsSchemaSource.get_default()?.lookup(e,!0);if(!t)throw Error(formatDbusErrorMessage(`not-found`,`GSettings schema '${e}' is not installed`));let n=new b.Settings({settings_schema:t}),r={};for(let e of t.list_keys())r[e]=n.get_value(e).recursiveUnpack();return r}function parseWidgetPath(e){let t=e.split(`/`).filter(e=>e.length>0);if(t.length===0)return null;let n=t[0].match(/^toplevel:(\d+)$/);if(!n)return null;let r=[];for(let e of t.slice(1)){let t=e.match(/^child:(\d+)$/);if(!t)return null;r.push(Number(t[1]))}return{toplevel:Number(n[1]),children:r}}function buildWidgetPath(e,t){return[`toplevel:${e}`,...t.map(e=>`child:${e}`)].join(`/`)}function widgetType(e){let t=e;return typeof t.$typeName==`string`&&t.$typeName.length>0?t.$typeName:t.constructor?.$gtype?.name??`GtkWidget`}function activateWidget(e){let t=e;if(typeof t.activate==`function`&&t.activate()===!0)return!0;let n=typeof t.get_parent==`function`?t.get_parent():null;if(n&&widgetType(n)===`GtkListBox`){let t=n,r=!1;return typeof t.select_row==`function`&&(t.select_row(e),r=!0),typeof t.emit==`function`&&(t.emit(`row-activated`,e),r=!0),r}return!1}function nthChild(e,t){let n=e.get_first_child(),r=0;for(;n&&r<t;)n=n.get_next_sibling(),r++;return r===t?n:null}function listToplevels(){let e=m.Window.get_toplevels(),t=e.get_n_items(),n=[];for(let r=0;r<t;r++){let t=e.get_item(r);t&&n.push({path:`toplevel:${r}`,type:widgetType(t),title:t.get_title?.()??null,mapped:t.get_mapped(),focused:t.is_active??!1})}return n}function resolveWidgetPath(e){let t=parseWidgetPath(e);if(!t)return null;let n=m.Window.get_toplevels().get_item(t.toplevel);if(!n)return null;for(let e of t.children)if(n=nthChild(n,e),!n)return null;return n}function dumpTree(e,t,n){let r={path:n,type:widgetType(e),name:e.get_name()||null,cssClasses:e.get_css_classes(),mapped:e.get_mapped(),visible:e.get_visible(),children:[]};if(t<=0)return r;let i=e.get_first_child(),a=0;for(;i;)r.children.push(dumpTree(i,t-1,`${n}/child:${a}`)),i=i.get_next_sibling(),a++;return r}function jsonSafe(e){let t=typeof e;return e==null||t===`string`||t===`number`||t===`boolean`?e??null:`[${t}]`}function getWidgetProperty(e,t){let n=e,r=t.replace(/-/g,`_`),i=t.replace(/[-_]([a-z])/g,(e,t)=>t.toUpperCase());for(let e of[t,r,i])if(e in n)return jsonSafe(n[e])}function childIndex(e,t){let n=e.get_first_child(),r=0;for(;n;){if(n===t)return r;n=n.get_next_sibling(),r++}return-1}function pathOfWidget(e){let t=[],n=e,r=n.get_parent();for(;r;){let e=childIndex(r,n);if(e<0)return null;t.unshift(e),n=r,r=n.get_parent()}let i=m.Window.get_toplevels(),a=i.get_n_items();for(let e=0;e<a;e++)if(i.get_item(e)===n)return buildWidgetPath(e,t);return null}function frameDelay(e){return new Promise(t=>{c.timeout_add(c.PRIORITY_DEFAULT,e,()=>(t(),c.SOURCE_REMOVE))})}async function captureWidgetWhenRenderable(e,t=12,n=50){for(let r=0;r<t;r++){let t=captureWidgetPng(e);if(t)return t;await frameDelay(n)}return captureWidgetPng(e)}var DevtoolsService=class{constructor(e,t){this._app=e,this._options=t,this._exported=new Map,this._peer=null,this._addressFile=null,this._kinds=new Map,this._extensions=t.extend??[];for(let[e,t]of Object.entries(ee))this._kinds.set(e,t);for(let e of this._extensions){for(let[t,n]of Object.entries(e.methodKinds))this._kinds.set(t,n);for(let[t,n]of Object.entries(e.handlers)){let e=n;this[t]=(...n)=>(this._guard(t),e(...n))}}}export(e,t){if(this._exported.has(e))return;let n=buildDevtoolsIfaceXml(this._extensions.flatMap(e=>e.methodsXml??[])),r=b.DBusExportedObject.wrapJSObject(n,this);r.export(e,t),this._exported.set(e,r)}unexport(e){if(e){this._exported.get(e)?.unexport(),this._exported.delete(e);return}for(let e of this._exported.values())e.unexport();this._exported.clear(),this._peer?.stop(),this._peer=null,this._addressFile&&=(removeDevtoolsAddressFile(this._addressFile),null)}attachPeerServer(e,t){this._peer=e,this._addressFile=t??null}get peerAddress(){return this._peer?.address??null}get addressFile(){return this._addressFile}GetStatus(){let e=this._app.get_active_window(),t={appId:this._app.get_application_id()??`unknown`,instance:this._options.instance??`default`,activeWindow:e?{id:e.get_name()||`window`,title:e.get_title()??``,mapped:e.get_mapped()}:null,toplevelCount:m.Window.get_toplevels().get_n_items(),focusedWidget:null,paused:this._isPaused()};for(let e of this._extensions){let n=e.contributeStatus?.();n&&Object.assign(t,n)}return JSON.stringify(t)}async ScreenshotAsync(e,t){try{let e=await this._captureActiveWindowPng();t.return_value(new c.Variant(`(ay)`,[e]))}catch(e){t.return_dbus_error(`org.gjsify.Devtools.Error.Screenshot`,e instanceof Error?e.message:String(e))}}async _captureActiveWindowPng(){let e=this._app.get_active_window();if(!e)return new Uint8Array;let t=captureWidgetPng(e);return t||=(e.present(),await captureWidgetWhenRenderable(e)),t??new Uint8Array}ListActions(){let e={app:describeActions(this._actionGroup(`app`)),win:describeActions(this._actionGroup(`win`))};return JSON.stringify(e)}ActivateAction(e,t,n){this._guard(`ActivateAction`);let r=this._scope(e);activateAction(this._requireGroup(r,t),t,this._parseValue(n))}ChangeActionState(e,t,n){this._guard(`ChangeActionState`);let r=this._scope(e);changeActionState(this._requireGroup(r,t),t,this._parseValue(n))}PresentWindow(){this._app.get_active_window()?.present()}ResizeWindow(e,t){this._guard(`ResizeWindow`);let n=this._app.get_active_window();if(!n)throw Error(formatDbusErrorMessage(`unavailable`,`no active window to resize`));let r=Math.max(1,Math.round(e)),i=Math.max(1,Math.round(t));return n.is_maximized()&&n.unmaximize(),n.is_fullscreen()&&n.unfullscreen(),n.set_default_size(r,i),[r,i]}ListToplevels(){return JSON.stringify(listToplevels())}DumpTree(e,t){let n=this._resolveRootWidget(e);if(!n)throw Error(formatDbusErrorMessage(`not-found`,`no widget at '${e||`active window`}'`));return JSON.stringify(dumpTree(n.widget,t>0?t:8,n.path))}GetProperty(e,t){let n=this._resolveRootWidget(e);if(!n)throw Error(formatDbusErrorMessage(`not-found`,`no widget at '${e}'`));let r=getWidgetProperty(n.widget,t);if(r===void 0)throw Error(formatDbusErrorMessage(`not-found`,`widget has no property '${t}'`));return JSON.stringify(r)}GetFocused(){let e=this._app.get_active_window(),t=e?e.get_focus():null;return JSON.stringify(t?{path:pathOfWidget(t),name:t.get_name()||null,type:widgetType(t)}:null)}ActivateWidget(e){this._guard(`ActivateWidget`);let t=this._resolveRootWidget(e);if(!t)throw Error(formatDbusErrorMessage(`not-found`,`no widget at '${e}'`));return activateWidget(t.widget)}DumpGSettings(e){return JSON.stringify(dumpGSettings(e))}DumpCss(){return JSON.stringify(dumpCss())}SwapCss(e,t){return this._guard(`SwapCss`),swapCss(e,t)}_resolveRootWidget(e){if(!e||e===`window`||e===`active`){let e=this._app.get_active_window();return e?{widget:e,path:pathOfWidget(e)??`toplevel:0`}:null}let t=resolveWidgetPath(e);return t?{widget:t,path:e}:null}_isPaused(){return this._options.paused?.()??!1}_guard(e){let t=this._kinds.get(e);if(!t)throw Error(formatDbusErrorMessage(`internal`,`unclassified devtools method '${e}'`));if(t===`mutating`&&this._isPaused())throw Error(formatDbusErrorMessage(`paused`,`${e} rejected — external control is paused. Read-only methods keep working.`))}_scope(e){return e===`app`?`app`:`win`}_actionGroup(e){if(e===`app`)return this._app;if(this._options.winActionGroup)return this._options.winActionGroup;let t=this._app.get_active_window();return t instanceof m.ApplicationWindow?t:null}_requireGroup(e,t){let n=this._actionGroup(e);if(!n)throw Error(formatDbusErrorMessage(`unavailable`,`no '${e}' action group`));if(!n.has_action(t))throw Error(formatDbusErrorMessage(`not-found`,`unknown action ${e}.${t}`));return n}_parseValue(e){if(!e||e===`null`)return null;try{return JSON.parse(e)}catch{throw Error(formatDbusErrorMessage(`invalid-params`,`value_json is not valid JSON: ${e}`))}}};const S=`DBUS_SESSION_BUS_ADDRESS`,re=new Set;function envEnabled(){return isDevtoolsEnabledValue(c.getenv(`GJSIFY_DEVTOOLS`))}function envValue(e){let t=c.getenv(e);return t&&t!==``?t:null}function sessionBusUsable(){if(!envValue(S))return!1;try{return b.bus_get_sync(b.BusType.SESSION,null),!0}catch{return!1}}function chooseDevtoolsTransport(e){return e.requestedAddress?{kind:`peer`,address:e.requestedAddress,reason:`requested`}:e.hasAppConnection?{kind:`session-bus`}:e.sessionBusUsable?{kind:`unregistered`}:{kind:`peer`,address:null,reason:`no-session-bus`}}function describeMissingConnection(e,t){return e?t?`[gjsify-devtools] the session bus answers but this application is not registered on it yet — call installDevtools() from the GtkApplication "startup" handler (the bus connection and object path exist only after registration).`:`[gjsify-devtools] ${S} is set (${e}) but no bus answers there — using the bus-less peer transport instead. On macOS this is the usual state: Homebrew's dbus listens on launchd, so the advertised address only works while that socket is live.`:`[gjsify-devtools] this machine has no session bus (${S} is unset) — using the bus-less peer transport instead. Point the bridge at the address below, or set ${_} on both the app and \`gjsify debug\` to pin it yourself.`}function installDevtools(e,t={}){if(!(t.enabled??envEnabled()))return null;let n=t.instance??envValue(`GJSIFY_DEVTOOLS_INSTANCE`)??void 0,r=new DevtoolsService(e,{...t,instance:n});try{return exportDevtools(e,r,t,n)}catch(e){return r.unexport(),console.error(`[gjsify-devtools] devtools stayed OFF, the app is unaffected — ${describeInstallFailure(e)}`),null}}function describeInstallFailure(e){return e instanceof DevtoolsPeerServerError||e instanceof Error?e.message:String(e)}function exportDevtools(e,t,n,r){let i=e.get_is_registered(),a=i?e.get_dbus_connection():null,o=i?e.get_dbus_object_path():null,s=envValue(S),l=!!(a&&o),u=l||sessionBusUsable(),d=chooseDevtoolsTransport({requestedAddress:n.address??envValue(_),hasAppConnection:l,sessionBusUsable:u}),f=e.get_application_id()??`unknown`,p=`${o??`/${f.replace(/\./g,`/`)}`}/devtools`;if((d.kind===`unregistered`||d.kind===`peer`&&d.reason===`no-session-bus`)&&console.error(describeMissingConnection(s,u)),d.kind===`session-bus`&&a)t.export(a,p),console.log(`[gjsify-devtools] exported ${g} at ${p} (dest ${f})`);else if(d.kind===`peer`){let n=startDevtoolsPeerServer(t,p,d.address??void 0),i=writeDevtoolsAddressFile(devtoolsAddressFilePath(c.get_user_runtime_dir(),f,r),n.address);t.attachPeerServer(n,i),console.log(`[gjsify-devtools] exported ${g} at ${p} (peer address ${n.address}${i?`, published to ${i}`:``})`),i&&e.connect(`shutdown`,()=>removeDevtoolsAddressFile(i))}return re.add(t),t}const ie=[`AdwNavigationSplitView`,`GtkListBox`,`AdwOverlaySplitView`];function probeEnabled(){let e=c.getenv(`GJSIFY_STORYBOOK_PROBE`);if(e==null)return!1;let t=e.toLowerCase();return t!==``&&t!==`0`&&t!==`false`}function collectTypes(e,t){t.add(e.type);for(let n of e.children)collectTypes(n,t)}function installStorybookProbe(e,t,n={}){let r=n.requireChrome??ie,i=n.out??c.getenv(`GJSIFY_STORYBOOK_PROBE_OUT`)??void 0,a=n.timeoutMs??8e3,o=n.storyWidget??c.getenv(`GJSIFY_STORYBOOK_PROBE_STORY_WIDGET`)??void 0,s=t.controller.listStories(),l=[...new Set(s.map(e=>e.category))],u=n.story??c.getenv(`GJSIFY_STORYBOOK_PROBE_STORY`)??s[0]?.title,d=u?t.openStoryByTitle(u):!1,f=t.activeStory,p=new Set;collectTypes(dumpTree(t,60,`toplevel:0`),p);let m=r.filter(e=>!p.has(e)),h=new Set;f&&collectTypes(dumpTree(f,60,`story`),h);let g=h.size,ee=o?h.has(o):null,finish=t=>{let n=JSON.stringify(t);if(t.ok)console.log(`STORYBOOK PROBE: PASS ${n}`);else{console.error(`STORYBOOK PROBE: FAIL ${n}`);try{typeof process<`u`&&(process.exitCode=1)}catch{}}if(i)try{c.file_set_contents(i,JSON.stringify(t,null,2))}catch{}e.quit()},_=0;c.timeout_add(c.PRIORITY_DEFAULT,100,()=>{_+=100;let e=captureWidgetPng(t),n=t.get_width()>0&&t.get_height()>0;if(!e&&!(_>=a))return c.SOURCE_CONTINUE;let i=f?captureWidgetPng(f):null,p=s.length>=1&&l.length>=1&&m.length===0&&d&&f!=null&&g>1,v;return s.length<1?v=`no stories registered`:l.length<1?v=`no categories`:m.length>0?v=`chrome missing: ${m.join(`, `)}`:!d||f==null?v=`could not open story: ${u??`(none)`}`:g<=1&&(v=`opened story rendered an empty subtree`),p&&o&&!h.has(o)&&(p=!1,v=`story widget ${o} not found in the opened story subtree`),p&&n&&(!e||e.length===0)&&(p=!1,v=`window realized (${t.get_width()}x${t.get_height()}) but the GSK capture was empty`),finish({ok:p,reason:v,stories:s.length,categories:l,opened:d,activeStory:f?f.meta.title:null,requiredChrome:r,missingChrome:m,storySubtreeWidgets:g,storyWidgetPresent:ee,windowRealized:n,windowPngBytes:e?e.length:0,storyPngBytes:i?i.length:0}),c.SOURCE_REMOVE})}const ae=e(import.meta.url);let oe;function load$1(){return oe===void 0&&(oe=ae(`@gjsify/node-gi/gi`).requireGi(`Adw`,`1`)),oe}__name(load$1,`load`);var C=new Proxy(Object.create(null),{get(e,t){return load$1()[t]},has(e,t){return t in load$1()}});const w={UNKNOWN:0,CUSTOM:1,GPL_2_0:2,GPL_3_0:3,LGPL_2_1:4,LGPL_3_0:5,BSD:6,MIT_X11:7,ARTISTIC:8,GPL_2_0_ONLY:9,GPL_3_0_ONLY:10,LGPL_2_1_ONLY:11,LGPL_3_0_ONLY:12,AGPL_3_0:13,AGPL_3_0_ONLY:14,BSD_3:15,APACHE_2_0:16,MPL_2_0:17,"0BSD":18};w.GPL_2_0_ONLY,w.GPL_3_0_ONLY,w.UNKNOWN;const se=[`blue`,`teal`,`green`,`yellow`,`orange`,`red`,`pink`,`purple`,`slate`],ce={blue:`#3584e4`,teal:`#2190a4`,green:`#3a944a`,yellow:`#c88800`,orange:`#ed5b00`,red:`#e62d42`,pink:`#d56199`,purple:`#9141ac`,slate:`#6f8396`};function parseHex(e){let t=/^#([0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;let n=Number.parseInt(t[1],16);return[(n>>16&255)/255,(n>>8&255)/255,(n&255)/255]}function toHex(e,t,n){let channel=e=>Math.round(Math.min(1,Math.max(0,e))*255).toString(16).padStart(2,`0`);return`#${channel(e)}${channel(t)}${channel(n)}`}const toLinear=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4,fromLinear=e=>e<=.0031308?e*12.92:1.055*e**(1/2.4)-.055;function linearToOklab(e,t,n){let r=Math.cbrt(.4122214708*e+.5363325363*t+.0514459929*n),i=Math.cbrt(.2119034982*e+.6806995451*t+.1073969566*n),a=Math.cbrt(.0883024619*e+.2817188376*t+.6299787005*n);return[.2104542553*r+.793617785*i-.0040720468*a,1.9779984951*r-2.428592205*i+.4505937099*a,.0259040371*r+.7827717662*i-.808675766*a]}function oklabToLinear(e,t,n){let r=(e+.3963377774*t+.2158037573*n)**3,i=(e-.1055613458*t-.0638541728*n)**3,a=(e-.0894841775*t-1.291485548*n)**3;return[4.0767416621*r-3.3077115913*i+.2309699292*a,-1.2684380046*r+2.6097574011*i-.3413193965*a,-.0041960863*r-.7034186147*i+1.707614701*a]}function adwaitaStandaloneColor(e,t){let n=parseHex(e);if(!n)return e;let[r,i,a]=linearToOklab(toLinear(n[0]),toLinear(n[1]),toLinear(n[2])),[o,s,c]=oklabToLinear(t?Math.max(r,.85):Math.min(r,.5),i,a);return toHex(fromLinear(o),fromLinear(s),fromLinear(c))}function adwaitaAccentBgColor(e){return ce[e]}function adwaitaAccentColor(e,t){return adwaitaStandaloneColor(ce[e],t)}Math.PI*.35,Math.PI*.015,Math.PI*.9;const le=Math.PI*.9,ue=Math.PI*.7,de=Math.PI*1.1,fe=Math.PI*1.35,pe=le+de+fe-ue;53*Math.PI*2/pe,de-ue/2;const me={system:`Follow system`,light:`Light`,dark:`Dark`},he={blue:`Blue`,teal:`Teal`,green:`Green`,yellow:`Yellow`,orange:`Orange`,red:`Red`,pink:`Pink`,purple:`Purple`,slate:`Slate`};var StorybookAppearance=class{constructor(){this._provider=null,this._applying=!1,this._styleManager=C.StyleManager.get_default(),this.settings=new StorybookSettings(()=>this._styleManager.get_dark()),this.settings.subscribe(e=>this._apply(e)),this._styleManager.connect(`notify::dark`,()=>this.settings.systemChanged()),this._apply(this.settings.state)}_apply(e){if(!this._applying){this._applying=!0;try{this._styleManager.set_color_scheme(e.colorScheme===`light`?C.ColorScheme.FORCE_LIGHT:e.colorScheme===`dark`?C.ColorScheme.FORCE_DARK:C.ColorScheme.DEFAULT),this._applyAccent(this.settings.resolvedAccent)}finally{this._applying=!1}}}_applyAccent(e){let t=d.Display.get_default();if(!t)return;if(!this._provider){if(!e)return;this._provider=new m.CssProvider,m.StyleContext.add_provider_for_display(t,this._provider,m.STYLE_PROVIDER_PRIORITY_APPLICATION)}if(!e){this._provider.load_from_string(``);return}let n=adwaitaAccentBgColor(e),r=adwaitaAccentColor(e,this.settings.resolvedDark);this._provider.load_from_string(`:root { --accent-bg-color: ${n}; --accent-color: ${r}; }`)}};function buildSwatch(e,t,n){let r=new m.CheckButton({tooltip_text:t,halign:m.Align.CENTER,valign:m.Align.CENTER,focus_on_click:!1});for(let t of e)r.add_css_class(t);return r.update_property([m.AccessibleProperty.LABEL],[t]),n&&r.set_group(n),r}function buildSwatchCard(e=!1){let t=new C.WrapBox({align:.5,child_spacing:8,line_spacing:8,margin_top:12,margin_bottom:12,margin_start:12,margin_end:12}),n=new C.Bin({child:t,hexpand:!0});return n.add_css_class(`card`),e&&n.add_css_class(`storybook-card-attached`),{card:n,row:t}}function buildAppearanceDialog(e){let t=e.settings,n=new C.PreferencesPage,r=new C.PreferencesGroup({title:`Style`}),{card:a,row:o}=buildSwatchCard(),s=null,c=new Map;for(let e of i){let n=buildSwatch([`storybook-swatch`,`storybook-scheme-swatch`,`storybook-scheme-${e}`],me[e],s);s??=n,n.set_active(t.colorScheme===e),n.connect(`toggled`,()=>{n.get_active()&&(t.colorScheme=e)}),c.set(e,n),o.append(n)}r.add(a),n.add(r);let l=new C.PreferencesGroup({title:`Accent colour`});l.add_css_class(`storybook-attached-group`);let u=new C.SwitchRow({title:`Use a custom accent colour`,subtitle:`Off follows the desktop, which owns the accent`,active:t.accentMode===`custom`});l.add(u);let{card:d,row:f}=buildSwatchCard(!0),p=null,h=new Map;for(let e of se){let n=buildSwatch([`storybook-swatch`],he[e],p);p??=n,n.set_active(t.accent===e);let r=new m.CssProvider;r.load_from_string(`checkbutton { background-color: ${adwaitaAccentBgColor(e)}; }`),n.get_style_context().add_provider(r,m.STYLE_PROVIDER_PRIORITY_APPLICATION),n.connect(`toggled`,()=>{n.get_active()&&(t.accent=e)}),h.set(e,n),f.append(n)}f.set_sensitive(t.accentMode===`custom`),u.connect(`notify::active`,()=>{t.accentMode=u.get_active()?`custom`:`system`}),l.add(d),n.add(l),t.subscribe(e=>{let t=c.get(e.colorScheme);t&&!t.get_active()&&t.set_active(!0);let n=h.get(e.accent);n&&!n.get_active()&&n.set_active(!0);let r=e.accentMode===`custom`;u.get_active()!==r&&u.set_active(r),f.set_sensitive(r)});let g=new C.PreferencesDialog({title:`Appearance`});return g.add(n),g}const ge=e(import.meta.url);let T;function load(){return T===void 0&&(T=ge("@gjsify/node-gi/gi").requireGi(`GObject`,`2.0`)),T}var E=new Proxy(Object.create(null),{get(e,t){return load()[t]},has(e,t){return t in load()}});function adwControlWidgetFactory(){return{text(e,t){let n=new C.EntryRow({title:e});t&&n.set_tooltip_text(t);let r=null;return n.connect(`changed`,()=>r?.(n.get_text())),{node:n,get:()=>n.get_text(),set:e=>n.set_text(e),onChange:e=>{r=e}}},boolean(e,t){let n=new C.SwitchRow({title:e,subtitle:t??``}),r=null;return n.connect(`notify::active`,()=>r?.(n.get_active())),{node:n,get:()=>n.get_active(),set:e=>n.set_active(e),onChange:e=>{r=e}}},number(e){let t=C.SpinRow.new_with_range(e.min??0,e.max??100,e.step??1);t.set_title(e.label||e.name),e.description&&t.set_subtitle(e.description);let n=null;return t.connect(`changed`,()=>n?.(t.get_value())),{node:t,get:()=>t.get_value(),set:e=>t.set_value(e),onChange:e=>{n=e}}},range(e){return buildRangeWidget(e)},select(e){return buildSelectWidget(e)},color(e,t){return buildColorWidget(e,t)}}}function buildRangeWidget(e){let t=e.min??0,n=e.max??100,r=e.step??1,i=typeof e.min==`number`?e.min:0,a=Number.isInteger(r)&&Number.isInteger(i),o=new m.Adjustment({lower:t,upper:n,step_increment:r,value:i});o.step_increment=r;let s=new m.ListBoxRow({selectable:!1,activatable:!1});s.add_css_class(`story-range-row`);let c=new m.Box({orientation:m.Orientation.VERTICAL,spacing:6,margin_top:12,margin_bottom:12,margin_start:12,margin_end:12}),l=new m.Box({orientation:m.Orientation.HORIZONTAL,spacing:12}),u=new m.Label({label:e.label||e.name,halign:m.Align.START,hexpand:!0,ellipsize:3});u.add_css_class(`heading`);let formatValue=e=>a?String(Math.round(e)):e.toFixed(2),d=new m.Label({label:formatValue(i),halign:m.Align.END});if(d.add_css_class(`numeric`),d.add_css_class(`dim-label`),l.append(u),l.append(d),c.append(l),e.description){let t=new m.Label({label:e.description,halign:m.Align.START,xalign:0,wrap:!0,max_width_chars:32});t.add_css_class(`caption`),t.add_css_class(`dim-label`),c.append(t)}let f=new m.Scale({orientation:m.Orientation.HORIZONTAL,adjustment:o,draw_value:!1,hexpand:!0}),p=null,h=!1;return f.connect(`value-changed`,()=>{if(h)return;let e=f.get_value();if(a){let t=Math.round(e);if(t!==e){f.set_value(t);return}e=t}d.set_label(formatValue(e)),p?.(e)}),c.append(f),s.set_child(c),{node:s,get:()=>f.get_value(),set:e=>{h=!0,f.set_value(e),h=!1,d.set_label(formatValue(e))},onChange:e=>{p=e}}}function buildSelectWidget(e){let t=e.options??[],n=m.StringList.new(t.map(e=>e.label)),r=new C.ComboRow({title:e.label||e.name,subtitle:e.description??``,model:n}),i=null;return r.connect(`notify::selected`,()=>i?.(r.get_selected())),{node:r,get:()=>r.get_selected(),set:e=>r.set_selected(e),onChange:e=>{i=e}}}function buildColorWidget(e,t){let n=new C.ActionRow({title:e,subtitle:t??``}),r=new m.ColorDialogButton({dialog:new m.ColorDialog({title:e}),valign:m.Align.CENTER});n.add_suffix(r),n.set_activatable_widget(r);let channel=e=>Math.round(Math.max(0,Math.min(1,e))*255).toString(16).padStart(2,`0`),rgbaToHex=e=>`#${channel(e.red)}${channel(e.green)}${channel(e.blue)}`,i=null,a=!1;return r.connect(`notify::rgba`,()=>{a||i?.(rgbaToHex(r.get_rgba()))}),{node:n,get:()=>rgbaToHex(r.get_rgba()),set:e=>{let t=new d.RGBA;t.parse(e)&&(a=!0,r.set_rgba(t),a=!1)},onChange:e=>{i=e}}}var _e=class StorybookWindow extends C.ApplicationWindow{static{E.registerClass({GTypeName:`StorybookWindow`},StorybookWindow)}constructor(e){super(e),this._appearance=new StorybookAppearance,this._controlRows=[],this._rowByTitle=new Map,this._onSelect=null,this._suppressSelect=!1,this.set_default_size(1200,800),this.set_size_request(360,320),this.set_title(`Storybook`),this._buildUI(),this._controller=new StorybookController(this,e=>this._buildControls(e)),this._sidebar_list.connect(`row-selected`,this._onRowSelected.bind(this)),this._show_controls_button.connect(`toggled`,this._onToggleControls.bind(this)),this._controls_split_view.set_show_sidebar(!0)}_onRowSelected(e,t){if(this._suppressSelect||!t)return;let n=t;n.storyWidget&&this._onSelect?.(n.storyWidget)}get controller(){return this._controller}_buildControls(e){let t=e.meta.controls;if(!Array.isArray(t))return[];let n=adwControlWidgetFactory(),r=[];for(let i of t){if(!i?.name||!i?.type){console.warn(`Invalid control configuration:`,i);continue}let t=bindControl(e,i,n);t&&r.push(t)}return r}_buildUI(){this._sidebar_list=new m.ListBox({selection_mode:m.SelectionMode.SINGLE}),this._sidebar_list.add_css_class(`navigation-sidebar`);let e=new m.ScrolledWindow({hexpand:!0,vexpand:!0,child:this._sidebar_list}),t=new C.HeaderBar({title_widget:new C.WindowTitle({title:`Stories`}),show_end_title_buttons:!1}),n=new C.ToolbarView({content:e,top_bar_style:C.ToolbarStyle.FLAT});n.add_top_bar(t);let r=new C.NavigationPage({title:`Stories`,tag:`stories`,child:n});this._content_area=new C.Bin({hexpand:!0,vexpand:!0});let i=new m.ScrolledWindow({hexpand:!0,vexpand:!0,child:this._content_area});this._control_panel=new C.PreferencesGroup({title:`Controls`});let a=new C.PreferencesPage;a.add(this._control_panel);let o=new m.ScrolledWindow({vexpand:!0,child:a});this._controls_split_view=new C.OverlaySplitView({show_sidebar:!0,sidebar_position:m.PackType.END,min_sidebar_width:280,max_sidebar_width:360,content:i,sidebar:o,css_classes:[`storybook-controls`]}),this._preview_title=new C.WindowTitle({title:`Preview`}),this._show_controls_button=new m.ToggleButton({icon_name:`sidebar-show-right-symbolic`,tooltip_text:`Toggle Controls`,active:!0});let s=new C.HeaderBar({title_widget:this._preview_title});s.pack_end(this._show_controls_button);let c=new m.Button({icon_name:`applications-graphics-symbolic`,tooltip_text:`Appearance`});c.connect(`clicked`,()=>buildAppearanceDialog(this._appearance).present(this)),s.pack_end(c);let l=new C.ToolbarView({content:this._controls_split_view,top_bar_style:C.ToolbarStyle.FLAT});l.add_top_bar(s);let u=new C.NavigationPage({title:`Preview`,tag:`preview`,child:l});this._main_split_view=new C.NavigationSplitView({min_sidebar_width:220,max_sidebar_width:320,sidebar:r,content:u}),this.set_content(this._main_split_view);let d=C.BreakpointCondition.parse(`max-width: 720sp`);if(d){let e=new C.Breakpoint({condition:d});e.connect(`apply`,()=>{this._main_split_view.collapsed=!0,this._controls_split_view.collapsed=!0}),e.connect(`unapply`,()=>{this._main_split_view.collapsed=!1,this._controls_split_view.collapsed=!1}),this.add_breakpoint(e)}}_onToggleControls(e){this._controls_split_view.set_show_sidebar(e.get_active())}populateSidebar(e){this._controller.mount(e,!0)}renderSidebar(e,t){this._onSelect=t,this._suppressSelect=!0,this._clearSidebar(),this._rowByTitle.clear();for(let t of e){this._addCategoryToSidebar(t.category);for(let{instance:e,name:n}of t.stories)this._addStoryToSidebar(e,n)}this._suppressSelect=!1}markSelected(e){let t=this._rowByTitle.get(e);t&&this._sidebar_list.get_selected_row()!==t&&(this._suppressSelect=!0,this._sidebar_list.select_row(t),this._suppressSelect=!1)}setPreviewTitle(e){this._preview_title.set_title(e)}showPreview(e){this._content_area.set_child(e),this._main_split_view.get_collapsed()&&this._main_split_view.set_show_content(!0)}renderControls(e){this._clearControlPanel();for(let t of e){let e=t.view;e instanceof C.PreferencesRow&&e.set_use_markup(!1),this._control_panel.add(e),this._controlRows.push(e)}this._show_controls_button.set_active(!0)}_clearSidebar(){let e=this._sidebar_list.get_first_child();for(;e;){let t=e.get_next_sibling();e.unparent(),e=t}}_addCategoryToSidebar(e){let t=new m.ListBoxRow({selectable:!1}),n=new m.Label({label:e,halign:m.Align.START,margin_top:10,margin_bottom:4,margin_start:12,margin_end:12});n.add_css_class(`heading`),n.add_css_class(`dim-label`),t.set_child(n),this._sidebar_list.append(t)}_addStoryToSidebar(e,t){let n=new m.ListBoxRow,r=new m.Label({label:t||`Unnamed Story`,halign:m.Align.START,margin_start:20,margin_top:6,margin_bottom:6});n.set_child(r),this._sidebar_list.append(n),n.storyWidget=e,this._rowByTitle.set(e.meta.title,n)}_clearControlPanel(){for(let e of this._controlRows)this._control_panel.remove(e);this._controlRows=[]}get activeStory(){return this._controller.activeStory}openStoryByTitle(e){return this._controller.openStoryByTitle(e)}setActiveArg(e,t){return this._controller.setActiveArg(e,t)}};E.type_ensure(_e.$gtype);var ve=class StorybookApplication extends C.Application{static{E.registerClass({GTypeName:`StorybookApplication`},StorybookApplication)}constructor(e){super({application_id:e.applicationId,flags:b.ApplicationFlags.DEFAULT_FLAGS}),this._window=null,this._options=e,this.connect(`startup`,()=>this._initStyles()),this.connect(`activate`,()=>this._onActivate())}_initStyles(){let e=new m.CssProvider;e.load_from_string(`
64
+ </node>`}const ee=e(import.meta.url);let b;function load$3(){return b===void 0&&(b=ee(`@gjsify/node-gi/gi`).requireGi(`Gio`,`2.0`)),b}__name(load$3,`load`);var x=new Proxy(Object.create(null),{get(e,t){return load$3()[t]},has(e,t){return t in load$3()}});function isWin32(){return l.DIR_SEPARATOR===92}function defaultListenAddress(){return isWin32()?`nonce-tcp:host=127.0.0.1`:`unix:tmpdir=${l.get_tmp_dir()}`}var DevtoolsPeerServerError=class extends Error{constructor(e,t,n,r){super(e),this.address=t,this.reason=n,this.name=`DevtoolsPeerServerError`,this.cause=r}};function isAddressInUse(e){return e instanceof l.Error&&e.matches(x.io_error_quark(),x.IOErrorEnum.ADDRESS_IN_USE)}function unixSocketPath(e){if(!e.startsWith(`unix:`))return null;for(let t of e.slice(5).split(`,`)){let e=t.indexOf(`=`);if(!(e<0||t.slice(0,e)!==`path`))try{return decodeURIComponent(t.slice(e+1))}catch{return null}}return null}function inspectExistingSocket(e){try{if((x.File.new_for_path(e).query_info(`unix::mode`,x.FileQueryInfoFlags.NONE,null).get_attribute_uint32(`unix::mode`)&61440)!=49152)return`not-a-socket`}catch{return`not-a-socket`}let t=new x.SocketClient;t.set_timeout(2);let n;try{n=t.connect(x.UnixSocketAddress.new(e),null)}catch{return`dead`}return n.close(null),`live`}function clearReclaimableSocket(e){let t=unixSocketPath(e);if(!t||!l.file_test(t,l.FileTest.EXISTS))return;let n=inspectExistingSocket(t);if(n===`live`)throw new DevtoolsPeerServerError(`cannot listen on ${e}: another process is already listening there. Stop it, or point ${y} (or options.address) at a different socket — GJSIFY_DEVTOOLS_INSTANCE=<label> lets two devtools-enabled apps run side by side.`,e,`address-in-use`);if(n===`not-a-socket`)throw new DevtoolsPeerServerError(`cannot listen on ${e}: ${t} already exists and is not a socket, so it will NOT be removed. Point ${y} (or options.address) at a free path.`,e,`occupied-by-other-file`);try{x.File.new_for_path(t).delete(null)}catch(n){throw new DevtoolsPeerServerError(`cannot listen on ${e}: ${t} is a socket nothing listens on, but removing it failed (${n}). Delete it by hand, or point ${y} at a free path.`,e,`address-in-use`,n)}console.log(`[gjsify-devtools] reclaimed the stale socket ${t}: nothing was listening on it (an abnormal exit — Ctrl-C, SIGKILL, a crash — leaves the inode behind).`)}function flagsForAddress(e){return e.startsWith(`tcp:`)||e.startsWith(`nonce-tcp:`)?x.DBusServerFlags.NONE:x.DBusServerFlags.AUTHENTICATION_REQUIRE_SAME_USER}function startDevtoolsPeerServer(e,t,n){let r=n&&n!==``?n:defaultListenAddress();clearReclaimableSocket(r);let i;try{i=x.DBusServer.new_sync(r,flagsForAddress(r),x.dbus_generate_guid(),null,null)}catch(e){let t=isAddressInUse(e);throw new DevtoolsPeerServerError(t?`cannot listen on ${r}: the address is already in use (${e}). Stop whatever holds it, or point ${y} (or options.address) at a different address.`:`cannot listen on ${r}: ${e}. Check the address form — \`unix:path=/tmp/app.sock\`, \`unix:tmpdir=/tmp\` or \`nonce-tcp:host=127.0.0.1\`.`,r,t?`address-in-use`:`listen-failed`,e)}let a=new Set;i.connect(`new-connection`,(n,r)=>(a.add(r),r.connect(`closed`,()=>{e.unexport(r),a.delete(r)}),e.export(r,t),!0)),i.start();let o=!1;return{address:i.get_client_address(),objectPath:t,get connectionCount(){return a.size},stop(){if(!o){o=!0,i.stop();for(let t of a)e.unexport(t),!t.is_closed()&&t.close(null,(e,t)=>{try{e.close_finish(t)}catch{}});a.clear()}}}}function writeDevtoolsAddressFile(e,t){try{if(l.mkdir_with_parents(l.path_get_dirname(e),448),!l.file_set_contents(e,`${t}\n`))return null}catch(t){return console.error(`[gjsify-devtools] could not publish the peer address to ${e}: ${t}`),null}try{x.File.new_for_path(e).set_attribute_uint32(`unix::mode`,384,x.FileQueryInfoFlags.NONE,null)}catch(t){console.error(`[gjsify-devtools] could not restrict ${e} to the current user: ${t}`)}return e}function removeDevtoolsAddressFile(e){try{x.File.new_for_path(e).delete(null)}catch{}}const te=e(import.meta.url);let S;function load$2(){return S===void 0&&(S=te(`@gjsify/node-gi/gi`).requireGi(`Graphene`,`1.0`)),S}__name(load$2,`load`);var ne=new Proxy(Object.create(null),{get(e,t){return load$2()[t]},has(e,t){return t in load$2()}});function captureWidgetPng(e){let t=e.get_native()?.get_renderer();if(!t)return null;let n=e.get_width(),r=e.get_height();if(n<=0||r<=0)return null;let i=h.WidgetPaintable.new(e),a=h.Snapshot.new();i.snapshot(a,n,r);let o=a.to_node();if(!o)return null;let s=new ne.Rect;s.init(0,0,n,r);let c=t.render_texture(o,s).save_to_png_bytes().get_data();return c?new Uint8Array(c):null}function dumpGSettings(e){let t=x.SettingsSchemaSource.get_default()?.lookup(e,!0);if(!t)throw Error(formatDbusErrorMessage(`not-found`,`GSettings schema '${e}' is not installed`));let n=new x.Settings({settings_schema:t}),r={};for(let e of t.list_keys())r[e]=n.get_value(e).recursiveUnpack();return r}function parseWidgetPath(e){let t=e.split(`/`).filter(e=>e.length>0);if(t.length===0)return null;let n=t[0].match(/^toplevel:(\d+)$/);if(!n)return null;let r=[];for(let e of t.slice(1)){let t=e.match(/^child:(\d+)$/);if(!t)return null;r.push(Number(t[1]))}return{toplevel:Number(n[1]),children:r}}function buildWidgetPath(e,t){return[`toplevel:${e}`,...t.map(e=>`child:${e}`)].join(`/`)}function widgetType(e){let t=e;return typeof t.$typeName==`string`&&t.$typeName.length>0?t.$typeName:t.constructor?.$gtype?.name??`GtkWidget`}function activateWidget(e){let t=e;if(typeof t.activate==`function`&&t.activate()===!0)return!0;let n=typeof t.get_parent==`function`?t.get_parent():null;if(n&&widgetType(n)===`GtkListBox`){let t=n,r=!1;return typeof t.select_row==`function`&&(t.select_row(e),r=!0),typeof t.emit==`function`&&(t.emit(`row-activated`,e),r=!0),r}return!1}function nthChild(e,t){let n=e.get_first_child(),r=0;for(;n&&r<t;)n=n.get_next_sibling(),r++;return r===t?n:null}function listToplevels(){let e=h.Window.get_toplevels(),t=e.get_n_items(),n=[];for(let r=0;r<t;r++){let t=e.get_item(r);t&&n.push({path:`toplevel:${r}`,type:widgetType(t),title:t.get_title?.()??null,mapped:t.get_mapped(),focused:t.is_active??!1})}return n}function resolveWidgetPath(e){let t=parseWidgetPath(e);if(!t)return null;let n=h.Window.get_toplevels().get_item(t.toplevel);if(!n)return null;for(let e of t.children)if(n=nthChild(n,e),!n)return null;return n}function dumpTree(e,t,n){let r={path:n,type:widgetType(e),name:e.get_name()||null,cssClasses:e.get_css_classes(),mapped:e.get_mapped(),visible:e.get_visible(),children:[]};if(t<=0)return r;let i=e.get_first_child(),a=0;for(;i;)r.children.push(dumpTree(i,t-1,`${n}/child:${a}`)),i=i.get_next_sibling(),a++;return r}function jsonSafe(e){let t=typeof e;return e==null||t===`string`||t===`number`||t===`boolean`?e??null:`[${t}]`}function getWidgetProperty(e,t){let n=e,r=t.replace(/-/g,`_`),i=t.replace(/[-_]([a-z])/g,(e,t)=>t.toUpperCase());for(let e of[t,r,i])if(e in n)return jsonSafe(n[e])}function childIndex(e,t){let n=e.get_first_child(),r=0;for(;n;){if(n===t)return r;n=n.get_next_sibling(),r++}return-1}function pathOfWidget(e){let t=[],n=e,r=n.get_parent();for(;r;){let e=childIndex(r,n);if(e<0)return null;t.unshift(e),n=r,r=n.get_parent()}let i=h.Window.get_toplevels(),a=i.get_n_items();for(let e=0;e<a;e++)if(i.get_item(e)===n)return buildWidgetPath(e,t);return null}function isActiveWindowScope(e){return!e||e===`window`||e===`active`}function frameDelay(e){return new Promise(t=>{l.timeout_add(l.PRIORITY_DEFAULT,e,()=>(t(),l.SOURCE_REMOVE))})}async function captureWidgetWhenRenderable(e,t=12,n=50){for(let r=0;r<t;r++){let t=captureWidgetPng(e);if(t)return t;await frameDelay(n)}return captureWidgetPng(e)}var DevtoolsService=class{constructor(e,t){this._app=e,this._options=t,this._exported=new Map,this._peer=null,this._addressFile=null,this._kinds=new Map,this._extensions=t.extend??[];for(let[e,t]of Object.entries(v))this._kinds.set(e,t);for(let e of this._extensions){for(let[t,n]of Object.entries(e.methodKinds))this._kinds.set(t,n);for(let[t,n]of Object.entries(e.handlers)){let e=n;this[t]=(...n)=>(this._guard(t),e(...n))}}}export(e,t){if(this._exported.has(e))return;let n=buildDevtoolsIfaceXml(this._extensions.flatMap(e=>e.methodsXml??[])),r=x.DBusExportedObject.wrapJSObject(n,this);r.export(e,t),this._exported.set(e,r)}unexport(e){if(e){this._exported.get(e)?.unexport(),this._exported.delete(e);return}for(let e of this._exported.values())e.unexport();this._exported.clear(),this._peer?.stop(),this._peer=null,this._addressFile&&=(removeDevtoolsAddressFile(this._addressFile),null)}attachPeerServer(e,t){this._peer=e,this._addressFile=t??null}get peerAddress(){return this._peer?.address??null}get addressFile(){return this._addressFile}GetStatus(){let e=this._app.get_active_window(),t={appId:this._app.get_application_id()??`unknown`,instance:this._options.instance??`default`,activeWindow:e?{id:e.get_name()||`window`,title:e.get_title()??``,mapped:e.get_mapped()}:null,toplevelCount:h.Window.get_toplevels().get_n_items(),focusedWidget:null,paused:this._isPaused()};for(let e of this._extensions){let n=e.contributeStatus?.();n&&Object.assign(t,n)}return JSON.stringify(t)}async ScreenshotAsync(e,t){try{let n=typeof e?.[0]==`string`?e[0]:``,r=await this._captureScopePng(n);t.return_value(new l.Variant(`(ay)`,[r]))}catch(e){t.return_dbus_error(`org.gjsify.Devtools.Error.Screenshot`,e instanceof Error?e.message:String(e))}}async _captureScopePng(e){let t=this._resolveRootWidget(e);if(!t){if(isActiveWindowScope(e))return new Uint8Array;throw Error(formatDbusErrorMessage(`not-found`,`no widget at '${e}'`))}let n=captureWidgetPng(t.widget);if(!n){let e=t.widget.get_root();e instanceof h.Window&&e.present(),n=await captureWidgetWhenRenderable(t.widget)}return n??new Uint8Array}ListActions(){let e={app:describeActions(this._actionGroup(`app`)),win:describeActions(this._actionGroup(`win`))};return JSON.stringify(e)}ActivateAction(e,t,n){this._guard(`ActivateAction`);let r=this._scope(e);activateAction(this._requireGroup(r,t),t,this._parseValue(n))}ChangeActionState(e,t,n){this._guard(`ChangeActionState`);let r=this._scope(e);changeActionState(this._requireGroup(r,t),t,this._parseValue(n))}PresentWindow(){this._app.get_active_window()?.present()}ResizeWindow(e,t){this._guard(`ResizeWindow`);let n=this._app.get_active_window();if(!n)throw Error(formatDbusErrorMessage(`unavailable`,`no active window to resize`));let r=Math.max(1,Math.round(e)),i=Math.max(1,Math.round(t));return n.is_maximized()&&n.unmaximize(),n.is_fullscreen()&&n.unfullscreen(),n.set_default_size(r,i),[r,i]}ListToplevels(){return JSON.stringify(listToplevels())}DumpTree(e,t){let n=this._resolveRootWidget(e);if(!n)throw Error(formatDbusErrorMessage(`not-found`,`no widget at '${e||`active window`}'`));return JSON.stringify(dumpTree(n.widget,t>0?t:8,n.path))}GetProperty(e,t){let n=this._resolveRootWidget(e);if(!n)throw Error(formatDbusErrorMessage(`not-found`,`no widget at '${e}'`));let r=getWidgetProperty(n.widget,t);if(r===void 0)throw Error(formatDbusErrorMessage(`not-found`,`widget has no property '${t}'`));return JSON.stringify(r)}GetFocused(){let e=this._app.get_active_window(),t=e?e.get_focus():null;return JSON.stringify(t?{path:pathOfWidget(t),name:t.get_name()||null,type:widgetType(t)}:null)}ActivateWidget(e){this._guard(`ActivateWidget`);let t=this._resolveRootWidget(e);if(!t)throw Error(formatDbusErrorMessage(`not-found`,`no widget at '${e}'`));return activateWidget(t.widget)}DumpGSettings(e){return JSON.stringify(dumpGSettings(e))}DumpCss(){return JSON.stringify(dumpCss())}SwapCss(e,t){return this._guard(`SwapCss`),swapCss(e,t)}_resolveRootWidget(e){if(isActiveWindowScope(e)){let e=this._app.get_active_window();return e?{widget:e,path:pathOfWidget(e)??`toplevel:0`}:null}let t=resolveWidgetPath(e);return t?{widget:t,path:e}:null}_isPaused(){return this._options.paused?.()??!1}_guard(e){let t=this._kinds.get(e);if(!t)throw Error(formatDbusErrorMessage(`internal`,`unclassified devtools method '${e}'`));if(t===`mutating`&&this._isPaused())throw Error(formatDbusErrorMessage(`paused`,`${e} rejected — external control is paused. Read-only methods keep working.`))}_scope(e){return e===`app`?`app`:`win`}_actionGroup(e){if(e===`app`)return this._app;if(this._options.winActionGroup)return this._options.winActionGroup;let t=this._app.get_active_window();return t instanceof h.ApplicationWindow?t:null}_requireGroup(e,t){let n=this._actionGroup(e);if(!n)throw Error(formatDbusErrorMessage(`unavailable`,`no '${e}' action group`));if(!n.has_action(t))throw Error(formatDbusErrorMessage(`not-found`,`unknown action ${e}.${t}`));return n}_parseValue(e){if(!e||e===`null`)return null;try{return JSON.parse(e)}catch{throw Error(formatDbusErrorMessage(`invalid-params`,`value_json is not valid JSON: ${e}`))}}};const C=`DBUS_SESSION_BUS_ADDRESS`,re=new Set;function envEnabled(){return isDevtoolsEnabledValue(l.getenv(`GJSIFY_DEVTOOLS`))}function envValue(e){let t=l.getenv(e);return t&&t!==``?t:null}function sessionBusUsable(){if(!envValue(C))return!1;try{return x.bus_get_sync(x.BusType.SESSION,null),!0}catch{return!1}}function chooseDevtoolsTransport(e){return e.requestedAddress?{kind:`peer`,address:e.requestedAddress,reason:`requested`}:e.hasAppConnection?{kind:`session-bus`}:e.sessionBusUsable?{kind:`unregistered`}:{kind:`peer`,address:null,reason:`no-session-bus`}}function describeMissingConnection(e,t){return e?t?`[gjsify-devtools] the session bus answers but this application is not registered on it yet — call installDevtools() from the GtkApplication "startup" handler (the bus connection and object path exist only after registration).`:`[gjsify-devtools] ${C} is set (${e}) but no bus answers there — using the bus-less peer transport instead. On macOS this is the usual state: Homebrew's dbus listens on launchd, so the advertised address only works while that socket is live.`:`[gjsify-devtools] this machine has no session bus (${C} is unset) — using the bus-less peer transport instead. Point the bridge at the address below, or set ${y} on both the app and \`gjsify debug\` to pin it yourself.`}function installDevtools(e,t={}){if(!(t.enabled??envEnabled()))return null;let n=t.instance??envValue(`GJSIFY_DEVTOOLS_INSTANCE`)??void 0,r=new DevtoolsService(e,{...t,instance:n});try{return exportDevtools(e,r,t,n)}catch(e){return r.unexport(),console.error(`[gjsify-devtools] devtools stayed OFF, the app is unaffected — ${describeInstallFailure(e)}`),null}}function describeInstallFailure(e){return e instanceof DevtoolsPeerServerError||e instanceof Error?e.message:String(e)}function exportDevtools(e,t,n,r){let i=e.get_is_registered(),a=i?e.get_dbus_connection():null,o=i?e.get_dbus_object_path():null,s=envValue(C),c=!!(a&&o),u=c||sessionBusUsable(),d=chooseDevtoolsTransport({requestedAddress:n.address??envValue(y),hasAppConnection:c,sessionBusUsable:u}),f=e.get_application_id()??`unknown`,p=`${o??appIdToObjectPath(f)}/devtools`;if((d.kind===`unregistered`||d.kind===`peer`&&d.reason===`no-session-bus`)&&console.error(describeMissingConnection(s,u)),d.kind===`session-bus`&&a)t.export(a,p),console.log(`[gjsify-devtools] exported ${_} at ${p} (dest ${f})`);else if(d.kind===`peer`){let n=startDevtoolsPeerServer(t,p,d.address??void 0),i=writeDevtoolsAddressFile(devtoolsAddressFilePath(l.get_user_runtime_dir(),f,r),n.address);t.attachPeerServer(n,i),console.log(`[gjsify-devtools] exported ${_} at ${p} (peer address ${n.address}${i?`, published to ${i}`:``})`),i&&e.connect(`shutdown`,()=>removeDevtoolsAddressFile(i))}return re.add(t),t}const ie=[`AdwNavigationSplitView`,`GtkListBox`,`AdwOverlaySplitView`];function probeEnabled(){let e=l.getenv(`GJSIFY_STORYBOOK_PROBE`);if(e==null)return!1;let t=e.toLowerCase();return t!==``&&t!==`0`&&t!==`false`}function collectTypes(e,t){t.add(e.type);for(let n of e.children)collectTypes(n,t)}function installStorybookProbe(e,t,n={}){let r=n.requireChrome??ie,i=n.out??l.getenv(`GJSIFY_STORYBOOK_PROBE_OUT`)??void 0,a=n.timeoutMs??8e3,o=n.storyWidget??l.getenv(`GJSIFY_STORYBOOK_PROBE_STORY_WIDGET`)??void 0,s=t.controller.listStories(),c=[...new Set(s.map(e=>e.category))],u=n.story??l.getenv(`GJSIFY_STORYBOOK_PROBE_STORY`)??s[0]?.title,d=u?t.openStoryByTitle(u):!1,f=t.activeStory,p=new Set;collectTypes(dumpTree(t,60,`toplevel:0`),p);let m=r.filter(e=>!p.has(e)),h=new Set;f&&collectTypes(dumpTree(f,60,`story`),h);let g=h.size,_=o?h.has(o):null,finish=t=>{let n=JSON.stringify(t);if(t.ok)console.log(`STORYBOOK PROBE: PASS ${n}`);else{console.error(`STORYBOOK PROBE: FAIL ${n}`);try{typeof process<`u`&&(process.exitCode=1)}catch{}}if(i)try{l.file_set_contents(i,JSON.stringify(t,null,2))}catch{}e.quit()},v=0;l.timeout_add(l.PRIORITY_DEFAULT,100,()=>{v+=100;let e=captureWidgetPng(t),n=t.get_width()>0&&t.get_height()>0;if(!e&&!(v>=a))return l.SOURCE_CONTINUE;let i=f?captureWidgetPng(f):null,p=s.length>=1&&c.length>=1&&m.length===0&&d&&f!=null&&g>1,y;return s.length<1?y=`no stories registered`:c.length<1?y=`no categories`:m.length>0?y=`chrome missing: ${m.join(`, `)}`:!d||f==null?y=`could not open story: ${u??`(none)`}`:g<=1&&(y=`opened story rendered an empty subtree`),p&&o&&!h.has(o)&&(p=!1,y=`story widget ${o} not found in the opened story subtree`),p&&n&&(!e||e.length===0)&&(p=!1,y=`window realized (${t.get_width()}x${t.get_height()}) but the GSK capture was empty`),finish({ok:p,reason:y,stories:s.length,categories:c,opened:d,activeStory:f?f.meta.title:null,requiredChrome:r,missingChrome:m,storySubtreeWidgets:g,storyWidgetPresent:_,windowRealized:n,windowPngBytes:e?e.length:0,storyPngBytes:i?i.length:0}),l.SOURCE_REMOVE})}const ae=e(import.meta.url);let oe;function load$1(){return oe===void 0&&(oe=ae(`@gjsify/node-gi/gi`).requireGi(`Adw`,`1`)),oe}__name(load$1,`load`);var w=new Proxy(Object.create(null),{get(e,t){return load$1()[t]},has(e,t){return t in load$1()}});const T={UNKNOWN:0,CUSTOM:1,GPL_2_0:2,GPL_3_0:3,LGPL_2_1:4,LGPL_3_0:5,BSD:6,MIT_X11:7,ARTISTIC:8,GPL_2_0_ONLY:9,GPL_3_0_ONLY:10,LGPL_2_1_ONLY:11,LGPL_3_0_ONLY:12,AGPL_3_0:13,AGPL_3_0_ONLY:14,BSD_3:15,APACHE_2_0:16,MPL_2_0:17,"0BSD":18};T.GPL_2_0_ONLY,T.GPL_3_0_ONLY,T.UNKNOWN;const se=[`blue`,`teal`,`green`,`yellow`,`orange`,`red`,`pink`,`purple`,`slate`],ce={blue:`#3584e4`,teal:`#2190a4`,green:`#3a944a`,yellow:`#c88800`,orange:`#ed5b00`,red:`#e62d42`,pink:`#d56199`,purple:`#9141ac`,slate:`#6f8396`};function parseHex(e){let t=/^#([0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;let n=Number.parseInt(t[1],16);return[(n>>16&255)/255,(n>>8&255)/255,(n&255)/255]}function toHex(e,t,n){let channel=e=>Math.round(Math.min(1,Math.max(0,e))*255).toString(16).padStart(2,`0`);return`#${channel(e)}${channel(t)}${channel(n)}`}const toLinear=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4,fromLinear=e=>e<=.0031308?e*12.92:1.055*e**(1/2.4)-.055;function linearToOklab(e,t,n){let r=Math.cbrt(.4122214708*e+.5363325363*t+.0514459929*n),i=Math.cbrt(.2119034982*e+.6806995451*t+.1073969566*n),a=Math.cbrt(.0883024619*e+.2817188376*t+.6299787005*n);return[.2104542553*r+.793617785*i-.0040720468*a,1.9779984951*r-2.428592205*i+.4505937099*a,.0259040371*r+.7827717662*i-.808675766*a]}function oklabToLinear(e,t,n){let r=(e+.3963377774*t+.2158037573*n)**3,i=(e-.1055613458*t-.0638541728*n)**3,a=(e-.0894841775*t-1.291485548*n)**3;return[4.0767416621*r-3.3077115913*i+.2309699292*a,-1.2684380046*r+2.6097574011*i-.3413193965*a,-.0041960863*r-.7034186147*i+1.707614701*a]}function adwaitaStandaloneColor(e,t){let n=parseHex(e);if(!n)return e;let[r,i,a]=linearToOklab(toLinear(n[0]),toLinear(n[1]),toLinear(n[2])),[o,s,c]=oklabToLinear(t?Math.max(r,.85):Math.min(r,.5),i,a);return toHex(fromLinear(o),fromLinear(s),fromLinear(c))}function adwaitaAccentBgColor(e){return ce[e]}function adwaitaAccentColor(e,t){return adwaitaStandaloneColor(ce[e],t)}Math.PI*.35,Math.PI*.015,Math.PI*.9;const le=Math.PI*.9,ue=Math.PI*.7,de=Math.PI*1.1,fe=Math.PI*1.35,pe=le+de+fe-ue;53*Math.PI*2/pe,de-ue/2;const me={system:`Follow system`,light:`Light`,dark:`Dark`},he={blue:`Blue`,teal:`Teal`,green:`Green`,yellow:`Yellow`,orange:`Orange`,red:`Red`,pink:`Pink`,purple:`Purple`,slate:`Slate`};var StorybookAppearance=class{constructor(){this._provider=null,this._applying=!1,this._styleManager=w.StyleManager.get_default(),this.settings=new StorybookSettings(()=>this._styleManager.get_dark()),this.settings.subscribe(e=>this._apply(e)),this._styleManager.connect(`notify::dark`,()=>this.settings.systemChanged()),this._apply(this.settings.state)}_apply(e){if(!this._applying){this._applying=!0;try{this._styleManager.set_color_scheme(e.colorScheme===`light`?w.ColorScheme.FORCE_LIGHT:e.colorScheme===`dark`?w.ColorScheme.FORCE_DARK:w.ColorScheme.DEFAULT),this._applyAccent(this.settings.resolvedAccent)}finally{this._applying=!1}}}_applyAccent(e){let t=f.Display.get_default();if(!t)return;if(!this._provider){if(!e)return;this._provider=new h.CssProvider,h.StyleContext.add_provider_for_display(t,this._provider,h.STYLE_PROVIDER_PRIORITY_APPLICATION)}if(!e){this._provider.load_from_string(``);return}let n=adwaitaAccentBgColor(e),r=adwaitaAccentColor(e,this.settings.resolvedDark);this._provider.load_from_string(`:root { --accent-bg-color: ${n}; --accent-color: ${r}; }`)}};function buildSwatch(e,t,n){let r=new h.CheckButton({tooltip_text:t,halign:h.Align.CENTER,valign:h.Align.CENTER,focus_on_click:!1});for(let t of e)r.add_css_class(t);return r.update_property([h.AccessibleProperty.LABEL],[t]),n&&r.set_group(n),r}function buildSwatchCard(e=!1){let t=new w.WrapBox({align:.5,child_spacing:8,line_spacing:8,margin_top:12,margin_bottom:12,margin_start:12,margin_end:12}),n=new w.Bin({child:t,hexpand:!0});return n.add_css_class(`card`),e&&n.add_css_class(`storybook-card-attached`),{card:n,row:t}}function buildAppearanceDialog(e){let t=e.settings,n=new w.PreferencesPage,r=new w.PreferencesGroup({title:`Style`}),{card:i,row:o}=buildSwatchCard(),s=null,c=new Map;for(let e of a){let n=buildSwatch([`storybook-swatch`,`storybook-scheme-swatch`,`storybook-scheme-${e}`],me[e],s);s??=n,n.set_active(t.colorScheme===e),n.connect(`toggled`,()=>{n.get_active()&&(t.colorScheme=e)}),c.set(e,n),o.append(n)}r.add(i),n.add(r);let l=new w.PreferencesGroup({title:`Accent colour`});l.add_css_class(`storybook-attached-group`);let u=new w.SwitchRow({title:`Use a custom accent colour`,subtitle:`Off follows the desktop, which owns the accent`,active:t.accentMode===`custom`});l.add(u);let{card:d,row:f}=buildSwatchCard(!0),p=null,m=new Map;for(let e of se){let n=buildSwatch([`storybook-swatch`],he[e],p);p??=n,n.set_active(t.accent===e);let r=new h.CssProvider;r.load_from_string(`checkbutton { background-color: ${adwaitaAccentBgColor(e)}; }`),n.get_style_context().add_provider(r,h.STYLE_PROVIDER_PRIORITY_APPLICATION),n.connect(`toggled`,()=>{n.get_active()&&(t.accent=e)}),m.set(e,n),f.append(n)}f.set_sensitive(t.accentMode===`custom`),u.connect(`notify::active`,()=>{t.accentMode=u.get_active()?`custom`:`system`}),l.add(d),n.add(l),t.subscribe(e=>{let t=c.get(e.colorScheme);t&&!t.get_active()&&t.set_active(!0);let n=m.get(e.accent);n&&!n.get_active()&&n.set_active(!0);let r=e.accentMode===`custom`;u.get_active()!==r&&u.set_active(r),f.set_sensitive(r)});let g=new w.PreferencesDialog({title:`Appearance`});return g.add(n),g}const ge=e(import.meta.url);let E;function load(){return E===void 0&&(E=ge("@gjsify/node-gi/gi").requireGi(`GObject`,`2.0`)),E}var D=new Proxy(Object.create(null),{get(e,t){return load()[t]},has(e,t){return t in load()}});function adwControlWidgetFactory(){return{text(e,t){let n=new w.EntryRow({title:e});t&&n.set_tooltip_text(t);let r=null;return n.connect(`changed`,()=>r?.(n.get_text())),{node:n,get:()=>n.get_text(),set:e=>n.set_text(e),onChange:e=>{r=e}}},boolean(e,t){let n=new w.SwitchRow({title:e,subtitle:t??``}),r=null;return n.connect(`notify::active`,()=>r?.(n.get_active())),{node:n,get:()=>n.get_active(),set:e=>n.set_active(e),onChange:e=>{r=e}}},number(e){let t=w.SpinRow.new_with_range(e.min??0,e.max??100,e.step??1);t.set_title(e.label||e.name),e.description&&t.set_subtitle(e.description);let n=null;return t.connect(`changed`,()=>n?.(t.get_value())),{node:t,get:()=>t.get_value(),set:e=>t.set_value(e),onChange:e=>{n=e}}},range(e){return buildRangeWidget(e)},select(e){return buildSelectWidget(e)},color(e,t){return buildColorWidget(e,t)}}}function buildRangeWidget(e){let t=e.min??0,n=e.max??100,r=e.step??1,i=typeof e.min==`number`?e.min:0,a=Number.isInteger(r)&&Number.isInteger(i),o=new h.Adjustment({lower:t,upper:n,step_increment:r,value:i});o.step_increment=r;let s=new h.ListBoxRow({selectable:!1,activatable:!1});s.add_css_class(`story-range-row`);let c=new h.Box({orientation:h.Orientation.VERTICAL,spacing:6,margin_top:12,margin_bottom:12,margin_start:12,margin_end:12}),l=new h.Box({orientation:h.Orientation.HORIZONTAL,spacing:12}),u=new h.Label({label:e.label||e.name,halign:h.Align.START,hexpand:!0,ellipsize:3});u.add_css_class(`heading`);let formatValue=e=>a?String(Math.round(e)):e.toFixed(2),d=new h.Label({label:formatValue(i),halign:h.Align.END});if(d.add_css_class(`numeric`),d.add_css_class(`dim-label`),l.append(u),l.append(d),c.append(l),e.description){let t=new h.Label({label:e.description,halign:h.Align.START,xalign:0,wrap:!0,max_width_chars:32});t.add_css_class(`caption`),t.add_css_class(`dim-label`),c.append(t)}let f=new h.Scale({orientation:h.Orientation.HORIZONTAL,adjustment:o,draw_value:!1,hexpand:!0}),p=null,m=!1;return f.connect(`value-changed`,()=>{if(m)return;let e=f.get_value();if(a){let t=Math.round(e);if(t!==e){f.set_value(t);return}e=t}d.set_label(formatValue(e)),p?.(e)}),c.append(f),s.set_child(c),{node:s,get:()=>f.get_value(),set:e=>{m=!0,f.set_value(e),m=!1,d.set_label(formatValue(e))},onChange:e=>{p=e}}}function buildSelectWidget(e){let t=e.options??[],n=h.StringList.new(t.map(e=>e.label)),r=new w.ComboRow({title:e.label||e.name,subtitle:e.description??``,model:n}),i=null;return r.connect(`notify::selected`,()=>i?.(r.get_selected())),{node:r,get:()=>r.get_selected(),set:e=>r.set_selected(e),onChange:e=>{i=e}}}function buildColorWidget(e,t){let n=new w.ActionRow({title:e,subtitle:t??``}),r=new h.ColorDialogButton({dialog:new h.ColorDialog({title:e}),valign:h.Align.CENTER});n.add_suffix(r),n.set_activatable_widget(r);let channel=e=>Math.round(Math.max(0,Math.min(1,e))*255).toString(16).padStart(2,`0`),rgbaToHex=e=>`#${channel(e.red)}${channel(e.green)}${channel(e.blue)}`,i=null,a=!1;return r.connect(`notify::rgba`,()=>{a||i?.(rgbaToHex(r.get_rgba()))}),{node:n,get:()=>rgbaToHex(r.get_rgba()),set:e=>{let t=new f.RGBA;t.parse(e)&&(a=!0,r.set_rgba(t),a=!1)},onChange:e=>{i=e}}}var _e=class StorybookWindow extends w.ApplicationWindow{static{D.registerClass({GTypeName:`StorybookWindow`},StorybookWindow)}constructor(e){super(e),this._appearance=new StorybookAppearance,this._controlRows=[],this._rowByTitle=new Map,this._onSelect=null,this._suppressSelect=!1,this.set_default_size(1200,800),this.set_size_request(360,320),this.set_title(`Storybook`),this._buildUI(),this._controller=new StorybookController(this,e=>this._buildControls(e)),this._sidebar_list.connect(`row-selected`,this._onRowSelected.bind(this)),this._show_controls_button.connect(`toggled`,this._onToggleControls.bind(this)),this._controls_split_view.set_show_sidebar(!0)}_onRowSelected(e,t){if(this._suppressSelect||!t)return;let n=t;n.storyWidget&&this._onSelect?.(n.storyWidget)}get controller(){return this._controller}_buildControls(e){let t=e.meta.controls;if(!Array.isArray(t))return[];let n=adwControlWidgetFactory(),r=[];for(let i of t){if(!i?.name||!i?.type){console.warn(`Invalid control configuration:`,i);continue}let t=bindControl(e,i,n);t&&r.push(t)}return r}_buildUI(){this._sidebar_list=new h.ListBox({selection_mode:h.SelectionMode.SINGLE}),this._sidebar_list.add_css_class(`navigation-sidebar`);let e=new h.ScrolledWindow({hexpand:!0,vexpand:!0,child:this._sidebar_list}),t=new w.HeaderBar({title_widget:new w.WindowTitle({title:`Stories`}),show_end_title_buttons:!1}),n=new w.ToolbarView({content:e,top_bar_style:w.ToolbarStyle.FLAT});n.add_top_bar(t);let r=new w.NavigationPage({title:`Stories`,tag:`stories`,child:n});this._content_area=new w.Bin({hexpand:!0,vexpand:!0});let i=new h.ScrolledWindow({hexpand:!0,vexpand:!0,child:this._content_area});i.add_css_class(`sb-preview-area`),this._control_panel=new w.PreferencesGroup({title:`Controls`});let a=new w.PreferencesPage;a.add(this._control_panel);let o=new h.ScrolledWindow({vexpand:!0,child:a});this._controls_split_view=new w.OverlaySplitView({show_sidebar:!0,sidebar_position:h.PackType.END,min_sidebar_width:280,max_sidebar_width:360,content:i,sidebar:o,css_classes:[`storybook-controls`]}),this._preview_title=new w.WindowTitle({title:`Preview`}),this._show_controls_button=new h.ToggleButton({icon_name:`sidebar-show-right-symbolic`,tooltip_text:`Toggle Controls`,active:!0});let s=new w.HeaderBar({title_widget:this._preview_title});s.pack_end(this._show_controls_button);let c=new h.Button({icon_name:`applications-graphics-symbolic`,tooltip_text:`Appearance`});c.connect(`clicked`,()=>buildAppearanceDialog(this._appearance).present(this)),s.pack_end(c);let l=new w.ToolbarView({content:this._controls_split_view,top_bar_style:w.ToolbarStyle.FLAT});l.add_top_bar(s);let u=new w.NavigationPage({title:`Preview`,tag:`preview`,child:l});this._main_split_view=new w.NavigationSplitView({min_sidebar_width:220,max_sidebar_width:320,sidebar:r,content:u}),this.set_content(this._main_split_view);let d=w.BreakpointCondition.parse(`max-width: 720sp`);if(d){let e=new w.Breakpoint({condition:d});e.connect(`apply`,()=>{this._main_split_view.collapsed=!0,this._controls_split_view.collapsed=!0}),e.connect(`unapply`,()=>{this._main_split_view.collapsed=!1,this._controls_split_view.collapsed=!1}),this.add_breakpoint(e)}}_onToggleControls(e){this._controls_split_view.set_show_sidebar(e.get_active())}populateSidebar(e){this._controller.mount(e,!0)}renderSidebar(e,t){this._onSelect=t,this._suppressSelect=!0,this._clearSidebar(),this._rowByTitle.clear();for(let t of e){this._addCategoryToSidebar(t.category);for(let{instance:e,name:n}of t.stories)this._addStoryToSidebar(e,n)}this._suppressSelect=!1}markSelected(e){let t=this._rowByTitle.get(e);t&&this._sidebar_list.get_selected_row()!==t&&(this._suppressSelect=!0,this._sidebar_list.select_row(t),this._suppressSelect=!1)}setPreviewTitle(e){this._preview_title.set_title(e)}showPreview(e){this._content_area.set_child(e),this._main_split_view.get_collapsed()&&this._main_split_view.set_show_content(!0)}renderControls(e){this._clearControlPanel();for(let t of e){let e=t.view;e instanceof w.PreferencesRow&&e.set_use_markup(!1),this._control_panel.add(e),this._controlRows.push(e)}this._show_controls_button.set_active(!0)}_clearSidebar(){let e=this._sidebar_list.get_first_child();for(;e;){let t=e.get_next_sibling();e.unparent(),e=t}}_addCategoryToSidebar(e){let t=new h.ListBoxRow({selectable:!1}),n=new h.Label({label:e,halign:h.Align.START,margin_top:10,margin_bottom:4,margin_start:12,margin_end:12});n.add_css_class(`heading`),n.add_css_class(`dim-label`),t.set_child(n),this._sidebar_list.append(t)}_addStoryToSidebar(e,t){let n=new h.ListBoxRow,r=new h.Label({label:t||`Unnamed Story`,halign:h.Align.START,margin_start:20,margin_top:6,margin_bottom:6});n.set_child(r),this._sidebar_list.append(n),n.storyWidget=e,this._rowByTitle.set(e.meta.title,n)}_clearControlPanel(){for(let e of this._controlRows)this._control_panel.remove(e);this._controlRows=[]}get activeStory(){return this._controller.activeStory}openStoryByTitle(e){return this._controller.openStoryByTitle(e)}setActiveArg(e,t){return this._controller.setActiveArg(e,t)}};D.type_ensure(_e.$gtype);var ve=class StorybookApplication extends w.Application{static{D.registerClass({GTypeName:`StorybookApplication`},StorybookApplication)}constructor(e){super({application_id:e.applicationId,flags:x.ApplicationFlags.DEFAULT_FLAGS}),this._window=null,this._options=e,this.connect(`startup`,()=>this._initStyles()),this.connect(`activate`,()=>this._onActivate())}_initStyles(){let e=new h.CssProvider;e.load_from_string(`
65
65
  /* Appearance dialog — round swatches with a selection ring, the shape GNOME's own
66
66
  appearance switcher uses. Adapted from Learn6502's theme-mode-selector.css and
67
67
  accent-color-selector.css (JumpLink/easy6502, MIT).
@@ -150,13 +150,35 @@ import{createRequire as e}from"node:module";import"@gjsify/node-gi/globals";impo
150
150
  background-color: @window_bg_color;
151
151
  }
152
152
 
153
- /* Subtle dashed frame around the live preview so the widget's bounds stay
154
- locatable even when it is transparent or in an empty state (e.g. a collapsed
155
- bottom sheet, a status page, a bare button). @window_fg_color flips with the
156
- theme (alpha(currentColor, …) does not resolve in a Gtk.CssProvider). */
153
+ /* The preview AREA carries the tint, not a box inside it.
154
+
155
+ The requirement is unchanged — the preview must stay LOCATABLE when the widget on
156
+ it is transparent or in an empty state (a collapsed bottom sheet, a status page, a
157
+ bare button), which is why a frame was here at all. A dashed border met it by
158
+ drawing attention to itself; a box with a surface met it by floating in the pane
159
+ with no edge, which is how it read. The whole area meets it by being the surface,
160
+ which is what the widget gallery on the website does: there the tint is on the
161
+ preview panel and the stage within it is only centring.
162
+
163
+ BOTH SCHEMES, WITHOUT BRANCHING. A Gtk.CssProvider string cannot ask which colour
164
+ scheme is active, so the tint is named rather than spelled out: @accent_color is
165
+ libadwaita's STANDALONE accent, defined as the accent moved to a lightness that
166
+ reads against the current scheme's background (oklab min(l, 0.5) in light,
167
+ max(l, 0.85) in dark — _colors.scss:25,88). Correct in both by construction, and it
168
+ follows a runtime accent, so the area is never blue while the widgets are orange.
169
+ The website hardcodes #3584e4 / #78aeed for those two states, which is this name
170
+ resolved by hand.
171
+
172
+ The purple counter-tint has no named equivalent and stays a literal, as on the
173
+ website — decoration, not a role, and the same hue in both schemes there too. */
174
+ .sb-preview-area {
175
+ background-image:
176
+ radial-gradient(circle at 0% 0%, alpha(@accent_color, 0.07), transparent 45%),
177
+ radial-gradient(circle at 100% 100%, alpha(#926ee4, 0.06), transparent 45%);
178
+ }
179
+
180
+ /* Breathing room only. No radius and no surface: nothing here is a box any more. */
157
181
  .story-stage {
158
- border: 1px dashed alpha(@window_fg_color, 0.28);
159
- border-radius: 12px;
160
182
  padding: 18px;
161
183
  }
162
- \n${this._options.css??``}`);let t=d.Display.get_default();if(!t){console.error(`No display found`);return}m.StyleContext.add_provider_for_display(t,e,m.STYLE_PROVIDER_PRIORITY_APPLICATION)}_onActivate(){if(!this._window){this._window=new _e({application:this}),this._options.title&&this._window.set_title(this._options.title);try{this._window.populateSidebar(this._options.stories)}catch(e){console.error(`Failed to create story instances:`,e)}installDevtools(this,{enabled:this._options.devtools||void 0,extend:[storybookDevtoolsExtension(this._window)]}),probeEnabled()&&installStorybookProbe(this,this._window,this._options.probe)}this._window.present()}};E.type_ensure(ve.$gtype);function collectStoryModules(e){return collectStoryModules$1(e)}function buildGtkChrome(e){let t=new C.PreferencesPage,n=new C.PreferencesGroup,r=new m.Box({orientation:m.Orientation.VERTICAL,halign:m.Align.CENTER,valign:m.Align.CENTER,margin_top:12,margin_bottom:12,spacing:12,hexpand:!0});return r.add_css_class(`story-stage`),n.add(r),t.add(n),e.set_child(t),{root:e,hasStage:!0,setStageContent(e){let t=r.get_first_child();for(;t;)t.unparent(),t=r.get_first_child();r.append(e)},setChromeText(e,t){n.set_title(c.markup_escape_text(e,-1)),n.set_description(c.markup_escape_text(t,-1))}}}var StoryCore=class extends StoryViewBase{constructor(e,t,n){super(),this._widget=e,this.initBase(t,n)}createChrome(e){return buildGtkChrome(this._widget)}initialize(){this._widget.initialize()}updateArgs(e){this._widget.updateArgs(e)}teardown(){this._widget.teardown()}emitArgs(e){super.emitArgs(e),this._widget.notify(`args`)}},D=class StoryWidget extends C.Bin{static{E.registerClass({GTypeName:`StoryWidget`,Properties:{meta:E.ParamSpec.object(`meta`,`Meta`,`Story metadata`,E.ParamFlags.READWRITE,E.Object),story:E.ParamSpec.string(`story`,`Story Name`,`Story name`,E.ParamFlags.READWRITE,``),args:E.ParamSpec.object(`args`,`Args`,`Story arguments`,E.ParamFlags.READWRITE,E.Object)}},StoryWidget)}constructor(e,t={}){super(t),this._core=new StoryCore(this,e.meta,e.story)}static fromMeta(e,t){return{meta:e,story:t,args:argsFromControls(e.controls)}}get meta(){return this._core.meta}get story(){return this._core.story}get args(){return this._core.args}set args(e){this._core.args=e}onArgsChanged(e){return this._core.onArgsChanged(e)}setArg(e,t){this._core.setArg(e,t)}initialize(){}updateArgs(e){}teardown(){}addContent(e){this._core.addContent(e)}};E.type_ensure(D.$gtype);var ye=class AdwaitaApp extends C.Application{static{E.registerClass({GTypeName:`GjsifyAdwaitaApp`},AdwaitaApp)}constructor(e){super({application_id:e.applicationId,flags:e.flags??b.ApplicationFlags.DEFAULT_FLAGS}),this._window=null,this._options=e,this._initActions(),this.connect(`startup`,()=>this._onStartup()),this.connect(`activate`,()=>this._onActivate())}_initActions(){if(this._options.quitAction!==!1){let e=new b.SimpleAction({name:`quit`});e.connect(`activate`,()=>this.quit()),this.add_action(e),this.set_accels_for_action(`app.quit`,[`<primary>q`])}if(this._options.about){let e=new b.SimpleAction({name:`about`});e.connect(`activate`,()=>this._showAbout()),this.add_action(e)}}_onStartup(){this._options.css&&this._loadCss(this._options.css),this._installDevtools(),this._options.onStartup?.(this)}_loadCss(e){let t=d.Display.get_default();if(!t){console.error(`@gjsify/adwaita-app: no default display; CSS not applied`);return}let n=new m.CssProvider;n.load_from_string(e),m.StyleContext.add_provider_for_display(t,n,m.STYLE_PROVIDER_PRIORITY_APPLICATION)}_installDevtools(){let e=this._options.devtools;if(e===!1)return;let t=typeof e==`object`?e:{enabled:e||void 0};installDevtools(this,t)}_onActivate(){this._window||=this._options.createWindow(this),this._window.present()}_showAbout(){let e=this._options.about;if(!e)return;let t=new C.AboutDialog({application_name:e.applicationName,application_icon:e.applicationIcon??this._options.applicationId});e.version&&(t.version=e.version),e.developerName&&(t.developer_name=e.developerName),e.website&&(t.website=e.website),e.issueUrl&&(t.issue_url=e.issueUrl),e.license&&(t.license=e.license),e.comments&&(t.comments=e.comments),e.copyright&&(t.copyright=e.copyright),e.developers?.length&&t.set_developers(e.developers),t.present(this.get_active_window())}};async function runApplication(e,t){let n=!1;try{e.register(null),n=e.get_is_remote()}catch{n=!1}let r=await e.runAsync(t);return n&&console.error(`${e.applicationId??`This application`} is already running — brought the existing instance to the front instead of opening a second window.`),r}E.type_ensure(ye.$gtype);var be=class LoadingStack extends m.Stack{static{E.registerClass({GTypeName:`GjsifyLoadingStack`},LoadingStack)}constructor(e={}){super(e);let t=new m.Box({orientation:m.Orientation.VERTICAL,halign:m.Align.CENTER,valign:m.Align.CENTER,hexpand:!0,vexpand:!0});t.append(new C.Spinner),this.add_named(t,`loading`),this._content=new C.Bin({hexpand:!0,vexpand:!0}),this.add_named(this._content,`content`),this._error=new C.StatusPage({iconName:`dialog-error-symbolic`,title:`Something went wrong`}),this.add_named(this._error,`error`),this.set_visible_child_name(`loading`)}setContent(e){this._content.set_child(e)}setError(e,t){this._error.set_title(e),this._error.set_description(t??``)}showLoading(){this.set_visible_child_name(`loading`)}showContent(){this.set_visible_child_name(`content`)}showError(){this.set_visible_child_name(`error`)}};E.type_ensure(be.$gtype);async function runStorybook(e){return runApplication(new ve(e),[t.programInvocationName,...t.programArgs])}const xe={title:`Buttons/Button Content`,description:`Adw.ButtonContent — pairs a symbolic icon with a label inside a Gtk.Button.`,controls:[{name:`label`,label:`Label`,type:r.TEXT,defaultValue:`Download`},{name:`iconName`,label:`Icon`,type:r.SELECT,options:[{label:`Download`,value:`folder-download-symbolic`},{label:`Add`,value:`list-add-symbolic`},{label:`Send`,value:`mail-send-symbolic`},{label:`Star`,value:`starred-symbolic`}],defaultValue:`folder-download-symbolic`},{name:`canShrink`,label:`Can shrink`,type:r.BOOLEAN,defaultValue:!1}]};var Se=__exportAll({ButtonContentStories:()=>Ce,ButtonContentStory:()=>O}),O=class ButtonContentStory extends D{_content=null;_button=null;static{E.registerClass({GTypeName:`AdwStorybookButtonContent`},ButtonContentStory)}constructor(){super(D.fromMeta(ButtonContentStory.getMetadata(),`Default`))}static getMetadata(){return{...xe,component:C.ButtonContent.$gtype}}initialize(){this._content=new C.ButtonContent({label:this.args.label,iconName:this.args.iconName,canShrink:this.args.canShrink}),this._button=new m.Button({child:this._content}),this._button.add_css_class(`suggested-action`),this._button.add_css_class(`pill`),this.addContent(this._button)}updateArgs(e){this._content&&(this._content.label=this.args.label,this._content.iconName=this.args.iconName,this._content.canShrink=this.args.canShrink)}};E.type_ensure(O.$gtype);const Ce={stories:[O]},we={title:`Buttons/Button Styles`,description:`Buttons with Adwaita style classes: .pill, .circular, .suggested-action, .destructive-action, .flat.`,controls:[{name:`label`,label:`Demo label`,type:r.TEXT,defaultValue:`Click me`},{name:`style`,label:`Demo style`,type:r.SELECT,options:[{label:`Pill`,value:`pill`},{label:`Circular (icon)`,value:`circular`},{label:`Suggested`,value:`suggested-action`},{label:`Destructive`,value:`destructive-action`},{label:`Flat`,value:`flat`}],defaultValue:`suggested-action`}]};var Te=__exportAll({ButtonStylesStories:()=>De,ButtonStylesStory:()=>k});const Ee=[`pill`,`circular`,`suggested-action`,`destructive-action`,`flat`];var k=class ButtonStylesStory extends D{_demo=null;static{E.registerClass({GTypeName:`AdwStorybookButtonStyles`},ButtonStylesStory)}constructor(){super(D.fromMeta(ButtonStylesStory.getMetadata(),`Default`))}static getMetadata(){return{...we,component:m.Button.$gtype}}initialize(){let e=new C.WrapBox({childSpacing:12,lineSpacing:12,halign:m.Align.CENTER}),t=new m.Button({label:`Pill`});t.add_css_class(`pill`),e.append(t);let n=new m.Button({iconName:`list-add-symbolic`});n.add_css_class(`circular`),e.append(n);let r=new m.Button({label:`Suggested`});r.add_css_class(`suggested-action`),e.append(r);let i=new m.Button({label:`Delete`});i.add_css_class(`destructive-action`),e.append(i);let a=new m.Button({label:`Flat`});a.add_css_class(`flat`),e.append(a),this._demo=new m.Button({label:this.args.label}),this._applyStyle(this.args.style),e.append(this._demo),this.addContent(e)}_applyStyle(e){if(this._demo){for(let e of Ee)this._demo.remove_css_class(e);this._demo.add_css_class(e)}}updateArgs(e){this._demo&&(this._demo.label=this.args.label,this._applyStyle(this.args.style))}};E.type_ensure(k.$gtype);const De={stories:[k]},Oe={title:`Buttons/Split Button`,description:`Adw.SplitButton — a primary action button paired with a dropdown menu of related actions.`,controls:[{name:`label`,label:`Label`,type:r.TEXT,defaultValue:`Save`},{name:`iconName`,label:`Icon`,type:r.SELECT,options:[{label:`None`,value:``},{label:`Save`,value:`document-save-symbolic`},{label:`Send`,value:`mail-send-symbolic`},{label:`Add`,value:`list-add-symbolic`}],defaultValue:`document-save-symbolic`}]},ke={title:`Buttons/Split Button Flat`,description:`Adw.SplitButton with the .flat style class, as used inside header bars and toolbars.`,controls:[{name:`label`,label:`Label`,type:r.TEXT,defaultValue:`Reply`},{name:`iconName`,label:`Icon`,type:r.SELECT,options:[{label:`None`,value:``},{label:`Reply`,value:`mail-reply-sender-symbolic`},{label:`Edit`,value:`document-edit-symbolic`},{label:`Open`,value:`document-open-symbolic`}],defaultValue:`mail-reply-sender-symbolic`}]};var Ae=__exportAll({SplitButtonFlatStory:()=>j,SplitButtonStories:()=>je,SplitButtonStory:()=>A});function buildMenu(){let e=new b.Menu;return e.append(`Save as…`,`app.save-as`),e.append(`Export`,`app.export`),e.append(`Print`,`app.print`),e}var A=class SplitButtonStory extends D{_widget=null;static{E.registerClass({GTypeName:`AdwStorybookSplitButton`},SplitButtonStory)}constructor(){super(D.fromMeta(SplitButtonStory.getMetadata(),`Default`))}static getMetadata(){return{...Oe,component:C.SplitButton.$gtype}}initialize(){this._widget=new C.SplitButton({label:this.args.label,menuModel:buildMenu()});let e=this.args.iconName;e&&(this._widget.iconName=e),this.addContent(this._widget)}updateArgs(e){if(!this._widget)return;let t=this.args.iconName;t?this._widget.iconName=t:this._widget.label=this.args.label}};E.type_ensure(A.$gtype);var j=class SplitButtonFlatStory extends D{_widget=null;static{E.registerClass({GTypeName:`AdwStorybookSplitButtonFlat`},SplitButtonFlatStory)}constructor(){super(D.fromMeta(SplitButtonFlatStory.getMetadata(),`Default`))}static getMetadata(){return{...ke,component:C.SplitButton.$gtype}}initialize(){this._widget=new C.SplitButton({label:this.args.label,menuModel:buildMenu()}),this._widget.add_css_class(`flat`);let e=this.args.iconName;e&&(this._widget.iconName=e),this.addContent(this._widget)}updateArgs(e){if(!this._widget)return;let t=this.args.iconName;t?this._widget.iconName=t:this._widget.label=this.args.label}};E.type_ensure(j.$gtype);const je={stories:[A,j]},Me={title:`Buttons/Toggle Group`,description:`Adw.ToggleGroup — a linked group of Adw.Toggle buttons where exactly one is active.`,controls:[{name:`active`,label:`Active toggle`,type:r.SELECT,options:[{label:`List`,value:0},{label:`Grid`,value:1},{label:`Columns`,value:2}],defaultValue:0},{name:`style`,label:`Style`,type:r.SELECT,options:[{label:`Default`,value:`default`},{label:`Flat`,value:`flat`},{label:`Round`,value:`round`}],defaultValue:`default`}]};var Ne=__exportAll({ToggleGroupStories:()=>Fe,ToggleGroupStory:()=>M});const Pe=[`flat`,`round`];var M=class ToggleGroupStory extends D{_toggleGroup=null;static{E.registerClass({GTypeName:`AdwStorybookToggleGroup`},ToggleGroupStory)}constructor(){super(D.fromMeta(ToggleGroupStory.getMetadata(),`Default`))}static getMetadata(){return{...Me,component:C.ToggleGroup.$gtype}}initialize(){this._toggleGroup=new C.ToggleGroup,this._toggleGroup.add(new C.Toggle({label:`List`,iconName:`view-list-symbolic`})),this._toggleGroup.add(new C.Toggle({label:`Grid`,iconName:`view-grid-symbolic`})),this._toggleGroup.add(new C.Toggle({label:`Columns`,iconName:`view-columns-symbolic`})),this._toggleGroup.active=this.args.active,this._applyStyle(this.args.style),this.addContent(this._toggleGroup)}_applyStyle(e){if(this._toggleGroup){for(let e of Pe)this._toggleGroup.remove_css_class(e);e!=="default"&&this._toggleGroup.add_css_class(e)}}updateArgs(e){this._toggleGroup&&(this._toggleGroup.active=this.args.active,this._applyStyle(this.args.style))}};E.type_ensure(M.$gtype);const Fe={stories:[M]},Ie={title:`Feedback/About Dialog`,description:`Adw.AboutDialog — the standard Adwaita about window with application name, version, credits and license.`,controls:[{name:`applicationName`,label:`Application name`,type:r.TEXT,defaultValue:`Adwaita Storybook`},{name:`version`,label:`Version`,type:r.TEXT,defaultValue:`0.11.0`}]};var Le=__exportAll({AboutDialogStories:()=>Re,AboutDialogStory:()=>N}),N=class AboutDialogStory extends D{_button=null;static{E.registerClass({GTypeName:`AdwStorybookAboutDialog`},AboutDialogStory)}constructor(){super(D.fromMeta(AboutDialogStory.getMetadata(),`Default`))}static getMetadata(){return{...Ie,component:C.AboutDialog.$gtype}}initialize(){this._button=new m.Button({label:`Show dialog`,halign:m.Align.CENTER,valign:m.Align.CENTER}),this._button.add_css_class(`pill`),this._button.add_css_class(`suggested-action`),this._button.connect(`clicked`,()=>this._present()),this.addContent(this._button)}_present(){new C.AboutDialog({applicationName:this.args.applicationName,applicationIcon:`application-x-executable-symbolic`,developerName:`A GJSify Project`,version:this.args.version,comments:`A live catalogue of native GTK and Adwaita widgets, rendered under GJS.`,website:`https://github.com/gjsify/gjsify`,issueUrl:`https://github.com/gjsify/gjsify/issues`,licenseType:m.License.MIT_X11,developers:[`Ada Lovelace`,`Grace Hopper`],designers:[`Margaret Hamilton`],copyright:`© 2026 The GJSify Project`}).present(this)}updateArgs(e){}};E.type_ensure(N.$gtype);const Re={stories:[N]},ze={title:`Feedback/Alert Dialog`,description:`Adw.AlertDialog — a modal dialog with a heading, body text and responses, including a destructive action.`,controls:[{name:`heading`,label:`Heading`,type:r.TEXT,defaultValue:`Delete Project?`},{name:`body`,label:`Body`,type:r.TEXT,defaultValue:`This will permanently remove the project and all of its files. This action cannot be undone.`}]};var Be=__exportAll({AlertDialogStories:()=>Ve,AlertDialogStory:()=>P}),P=class AlertDialogStory extends D{_button=null;static{E.registerClass({GTypeName:`AdwStorybookAlertDialog`},AlertDialogStory)}constructor(){super(D.fromMeta(AlertDialogStory.getMetadata(),`Default`))}static getMetadata(){return{...ze,component:C.AlertDialog.$gtype}}initialize(){this._button=new m.Button({label:`Show dialog`,halign:m.Align.CENTER,valign:m.Align.CENTER}),this._button.add_css_class(`pill`),this._button.add_css_class(`suggested-action`),this._button.connect(`clicked`,()=>this._present()),this.addContent(this._button)}_present(){let e=new C.AlertDialog({heading:this.args.heading,body:this.args.body});e.add_response(`cancel`,`Cancel`),e.add_response(`delete`,`Delete`),e.set_response_appearance(`delete`,C.ResponseAppearance.DESTRUCTIVE),e.set_default_response(`cancel`),e.set_close_response(`cancel`),e.present(this)}updateArgs(e){}};E.type_ensure(P.$gtype);const Ve={stories:[P]},He={title:`Feedback/Preferences Dialog`,description:`Adw.PreferencesDialog — a preferences window with a page, a group and a handful of boxed-list rows.`,controls:[{name:`pageTitle`,label:`Page title`,type:r.TEXT,defaultValue:`General`},{name:`groupTitle`,label:`Group title`,type:r.TEXT,defaultValue:`Appearance`}]};var Ue=__exportAll({PreferencesDialogStories:()=>We,PreferencesDialogStory:()=>F}),F=class PreferencesDialogStory extends D{_button=null;static{E.registerClass({GTypeName:`AdwStorybookPreferencesDialog`},PreferencesDialogStory)}constructor(){super(D.fromMeta(PreferencesDialogStory.getMetadata(),`Default`))}static getMetadata(){return{...He,component:C.PreferencesDialog.$gtype}}initialize(){this._button=new m.Button({label:`Show dialog`,halign:m.Align.CENTER,valign:m.Align.CENTER}),this._button.add_css_class(`pill`),this._button.add_css_class(`suggested-action`),this._button.connect(`clicked`,()=>this._present()),this.addContent(this._button)}_present(){let e=new C.PreferencesDialog,t=new C.PreferencesPage({title:this.args.pageTitle,iconName:`preferences-system-symbolic`}),n=new C.PreferencesGroup({title:this.args.groupTitle,description:`Control how the application looks and behaves.`});n.add(new C.SwitchRow({title:`Dark style`,subtitle:`Use a dark colour scheme`,active:!0})),n.add(new C.ComboRow({title:`Accent colour`,model:new m.StringList({strings:[`Blue`,`Teal`,`Green`,`Orange`,`Purple`]}),selected:0})),n.add(new C.SpinRow({title:`Font size`,adjustment:new m.Adjustment({lower:8,upper:24,value:12,stepIncrement:1,pageIncrement:4})})),t.add(n),e.add(t),e.present(this)}updateArgs(e){}};E.type_ensure(F.$gtype);const We={stories:[F]},Ge={title:`Feedback/Toast`,description:`Adw.Toast — a transient notification, with an optional action button, shown over an Adw.ToastOverlay.`,controls:[{name:`title`,label:`Toast text`,type:r.TEXT,defaultValue:`File moved to Trash`},{name:`timeout`,label:`Timeout (s)`,type:r.NUMBER,min:0,max:10,step:1,defaultValue:3},{name:`hasButton`,label:`Action button`,type:r.BOOLEAN,defaultValue:!0},{name:`buttonLabel`,label:`Button label`,type:r.TEXT,defaultValue:`Undo`}]};var Ke=__exportAll({ToastStories:()=>qe,ToastStory:()=>I}),I=class ToastStory extends D{_overlay=null;static{E.registerClass({GTypeName:`AdwStorybookToast`},ToastStory)}constructor(){super(D.fromMeta(ToastStory.getMetadata(),`Default`))}static getMetadata(){return{...Ge,component:C.Toast.$gtype}}initialize(){let e=new m.Button({label:`Show toast`,halign:m.Align.CENTER,valign:m.Align.CENTER});e.add_css_class(`pill`),e.add_css_class(`suggested-action`),e.connect(`clicked`,()=>this._showToast()),this._overlay=new C.ToastOverlay({child:e,widthRequest:360,heightRequest:220}),this.addContent(this._overlay)}_showToast(){if(!this._overlay)return;let e=new C.Toast({title:this.args.title,timeout:this.args.timeout});this.args.hasButton&&(e.buttonLabel=this.args.buttonLabel),this._overlay.add_toast(e)}updateArgs(e){}};E.type_ensure(I.$gtype);const qe={stories:[I]},Je={title:`Layout/Clamp`,description:`Adw.Clamp limits its child to a maximum width and centres it, tightening the layout as space shrinks.`,controls:[{name:`maximumSize`,label:`Maximum size`,type:r.RANGE,min:200,max:600,step:10,defaultValue:400},{name:`tighteningThreshold`,label:`Tightening threshold`,type:r.RANGE,min:100,max:600,step:10,defaultValue:300}]};var Ye=__exportAll({ClampStories:()=>Xe,ClampStory:()=>L}),L=class ClampStory extends D{_clamp=null;static{E.registerClass({GTypeName:`AdwStorybookClamp`},ClampStory)}constructor(){super(D.fromMeta(ClampStory.getMetadata(),`Default`))}static getMetadata(){return{...Je,component:C.Clamp.$gtype}}initialize(){let e=new m.Box({orientation:m.Orientation.HORIZONTAL,widthRequest:520});e.add_css_class(`card`);let t=new m.Label({label:`This content is clamped — it stops growing past the maximum size and stays centred.`,wrap:!0,xalign:0,hexpand:!0,marginTop:18,marginBottom:18,marginStart:18,marginEnd:18});e.append(t),this._clamp=new C.Clamp({maximumSize:this.args.maximumSize,tighteningThreshold:this.args.tighteningThreshold,child:e}),this.addContent(this._clamp)}updateArgs(e){this._clamp&&(this._clamp.maximumSize=this.args.maximumSize,this._clamp.tighteningThreshold=this.args.tighteningThreshold)}};E.type_ensure(L.$gtype);const Xe={stories:[L]},Ze={title:`Layout/Header Bar`,description:`Adw.HeaderBar hosts a custom title widget with start and end controls — the standard top chrome of an Adwaita window.`,controls:[{name:`title`,label:`Title`,type:r.TEXT,defaultValue:`Text Editor`},{name:`subtitle`,label:`Subtitle`,type:r.TEXT,defaultValue:`notes.md`},{name:`showTitle`,label:`Show title`,type:r.BOOLEAN,defaultValue:!0}]};var Qe=__exportAll({HeaderBarStories:()=>$e,HeaderBarStory:()=>R}),R=class HeaderBarStory extends D{_headerBar=null;_title=null;static{E.registerClass({GTypeName:`AdwStorybookHeaderBar`},HeaderBarStory)}constructor(){super(D.fromMeta(HeaderBarStory.getMetadata(),`Default`))}static getMetadata(){return{...Ze,component:C.HeaderBar.$gtype}}initialize(){this._title=new C.WindowTitle({title:this.args.title,subtitle:this.args.subtitle}),this._headerBar=new C.HeaderBar({titleWidget:this._title,showTitle:this.args.showTitle,widthRequest:460});let e=new m.Button({iconName:`go-previous-symbolic`});e.add_css_class(`flat`),this._headerBar.pack_start(e);let t=new b.Menu;t.append(`New Window`,`app.new-window`),t.append(`Preferences`,`app.preferences`),t.append(`About`,`app.about`);let n=new m.MenuButton({iconName:`open-menu-symbolic`,menuModel:t});n.add_css_class(`flat`),this._headerBar.pack_end(n),this.addContent(this._headerBar)}updateArgs(e){!this._headerBar||!this._title||(this._title.title=this.args.title,this._title.subtitle=this.args.subtitle,this._headerBar.showTitle=this.args.showTitle)}};E.type_ensure(R.$gtype);const $e={stories:[R]},et={title:`Layout/Toolbar View`,description:`Adw.ToolbarView pins a top header bar and a bottom toolbar around its content, each independently revealable.`,controls:[{name:`revealTopBars`,label:`Reveal top bars`,type:r.BOOLEAN,defaultValue:!0},{name:`revealBottomBars`,label:`Reveal bottom bars`,type:r.BOOLEAN,defaultValue:!0}]};var tt=__exportAll({ToolbarViewStories:()=>nt,ToolbarViewStory:()=>z}),z=class ToolbarViewStory extends D{_view=null;static{E.registerClass({GTypeName:`AdwStorybookToolbarView`},ToolbarViewStory)}constructor(){super(D.fromMeta(ToolbarViewStory.getMetadata(),`Default`))}static getMetadata(){return{...et,component:C.ToolbarView.$gtype}}initialize(){this._view=new C.ToolbarView({widthRequest:460,heightRequest:320,revealTopBars:this.args.revealTopBars,revealBottomBars:this.args.revealBottomBars});let e=new C.HeaderBar({titleWidget:new C.WindowTitle({title:`Documents`,subtitle:`12 items`})});this._view.add_top_bar(e);let t=new C.StatusPage({iconName:`folder-documents-symbolic`,title:`Your library`,description:`Content sits between the toolbars and scrolls independently of them.`});this._view.content=t;let n=new m.ActionBar,r=new m.Button({iconName:`list-add-symbolic`});r.add_css_class(`flat`);let i=new m.Button({iconName:`list-remove-symbolic`});i.add_css_class(`flat`),n.pack_start(r),n.pack_start(i),n.set_center_widget(new m.Label({label:`Selection: none`}));let a=new m.Button({iconName:`send-to-symbolic`});a.add_css_class(`flat`),n.pack_end(a),this._view.add_bottom_bar(n),this.addContent(this._view)}updateArgs(e){this._view&&(this._view.revealTopBars=this.args.revealTopBars,this._view.revealBottomBars=this.args.revealBottomBars)}};E.type_ensure(z.$gtype);const nt={stories:[z]},rt={title:`Layout/Wrap Box`,description:`Adw.WrapBox flows its children horizontally and wraps them onto new lines when they run out of room.`,controls:[{name:`childSpacing`,label:`Child spacing`,type:r.RANGE,min:0,max:36,step:1,defaultValue:8},{name:`lineSpacing`,label:`Line spacing`,type:r.RANGE,min:0,max:36,step:1,defaultValue:8}]};var it=__exportAll({WrapBoxStories:()=>at,WrapBoxStory:()=>B}),B=class WrapBoxStory extends D{_wrap=null;static{E.registerClass({GTypeName:`AdwStorybookWrapBox`},WrapBoxStory)}constructor(){super(D.fromMeta(WrapBoxStory.getMetadata(),`Default`))}static getMetadata(){return{...rt,component:C.WrapBox.$gtype}}initialize(){this._wrap=new C.WrapBox({childSpacing:this.args.childSpacing,lineSpacing:this.args.lineSpacing,widthRequest:460});for(let e of[`Design`,`Adwaita`,`GNOME`,`GTK`,`Typescript`,`Storybook`,`Wrapping`,`Layout`]){let t=new m.Button({label:e});t.add_css_class(`pill`),this._wrap.append(t)}this.addContent(this._wrap)}updateArgs(e){this._wrap&&(this._wrap.childSpacing=this.args.childSpacing,this._wrap.lineSpacing=this.args.lineSpacing)}};E.type_ensure(B.$gtype);const at={stories:[B]},ot={title:`Navigation/Bottom Sheet`,description:`Adw.BottomSheet — a sheet that slides up over the content. Toggle "Open" to reveal it.`,controls:[{name:`open`,label:`Open`,type:r.BOOLEAN,defaultValue:!0},{name:`modal`,label:`Modal`,type:r.BOOLEAN,defaultValue:!0},{name:`canClose`,label:`Can close`,type:r.BOOLEAN,defaultValue:!0}]};var st=__exportAll({BottomSheetStories:()=>ct,BottomSheetStory:()=>V}),V=class BottomSheetStory extends D{_sheet=null;static{E.registerClass({GTypeName:`AdwStorybookBottomSheet`},BottomSheetStory)}constructor(){super(D.fromMeta(BottomSheetStory.getMetadata(),`Default`))}static getMetadata(){return{...ot,component:C.BottomSheet.$gtype}}buildContent(){let e=new m.Button({label:`Toggle sheet`,halign:m.Align.CENTER,valign:m.Align.CENTER,vexpand:!0});return e.add_css_class(`pill`),e.add_css_class(`suggested-action`),e.connect(`clicked`,()=>{this._sheet&&(this._sheet.open=!this._sheet.open)}),e}buildSheet(){let e=new m.Box({orientation:m.Orientation.VERTICAL,spacing:12,marginTop:18,marginBottom:24,marginStart:18,marginEnd:18});e.append(new m.Label({label:`Share track`,halign:m.Align.START,cssClasses:[`title-2`]}));let t=new C.PreferencesGroup;for(let[e,n]of[[`Copy link`,`edit-copy-symbolic`],[`Send to a friend`,`mail-send-symbolic`],[`Add to playlist`,`list-add-symbolic`]]){let r=new C.ActionRow({title:e});r.add_prefix(new m.Image({iconName:n})),r.activatable=!0,t.add(r)}return e.append(t),e}initialize(){this._sheet=new C.BottomSheet({content:this.buildContent(),sheet:this.buildSheet(),open:this.args.open,modal:this.args.modal,canClose:this.args.canClose,widthRequest:480,heightRequest:340}),this.addContent(this._sheet)}updateArgs(e){this._sheet&&(this._sheet.open=this.args.open,this._sheet.modal=this.args.modal,this._sheet.canClose=this.args.canClose)}};E.type_ensure(V.$gtype);const ct={stories:[V]},lt={title:`Navigation/Navigation Split View`,description:`Adw.NavigationSplitView — a resizable sidebar beside a content pane. When collapsed it folds into a navigation stack.`,controls:[{name:`showContent`,label:`Show content`,type:r.BOOLEAN,defaultValue:!0},{name:`collapsed`,label:`Collapsed`,type:r.BOOLEAN,defaultValue:!1}]};var ut=__exportAll({NavigationSplitViewStories:()=>dt,NavigationSplitViewStory:()=>H}),H=class NavigationSplitViewStory extends D{_view=null;static{E.registerClass({GTypeName:`AdwStorybookNavigationSplitView`},NavigationSplitViewStory)}constructor(){super(D.fromMeta(NavigationSplitViewStory.getMetadata(),`Default`))}static getMetadata(){return{...lt,component:C.NavigationSplitView.$gtype}}buildSidebar(){let e=new C.PreferencesGroup;for(let[t,n,r]of[[`All Mail`,`128 messages`,`mail-unread-symbolic`],[`Starred`,`6 messages`,`starred-symbolic`],[`Drafts`,`2 messages`,`document-edit-symbolic`],[`Archive`,`512 messages`,`folder-symbolic`]]){let i=new C.ActionRow({title:t,subtitle:n});i.add_prefix(new m.Image({iconName:r})),i.activatable=!0,e.add(i)}let t=new C.ToolbarView;return t.add_top_bar(new C.HeaderBar),t.content=e,new C.NavigationPage({title:`Mailboxes`,child:t})}buildContent(){let e=new C.StatusPage({iconName:`mail-unread-symbolic`,title:`All Mail`,description:`Select a conversation from the list to read it here.`,vexpand:!0}),t=new C.ToolbarView;return t.add_top_bar(new C.HeaderBar),t.content=e,new C.NavigationPage({title:`All Mail`,child:t})}initialize(){this._view=new C.NavigationSplitView({sidebar:this.buildSidebar(),content:this.buildContent(),showContent:this.args.showContent,collapsed:this.args.collapsed,widthRequest:480,heightRequest:340}),this.addContent(this._view)}updateArgs(e){this._view&&(this._view.showContent=this.args.showContent,this._view.collapsed=this.args.collapsed)}};E.type_ensure(H.$gtype);const dt={stories:[H]},ft={title:`Navigation/Navigation View`,description:`Adw.NavigationView — a navigation stack. The root page pushes a detail page, which gets an automatic back button.`,controls:[{name:`rootTitle`,label:`Root title`,type:r.TEXT,defaultValue:`Contacts`},{name:`detailTitle`,label:`Detail title`,type:r.TEXT,defaultValue:`Ada Lovelace`},{name:`animateTransitions`,label:`Animate transitions`,type:r.BOOLEAN,defaultValue:!0}]};var pt=__exportAll({NavigationViewStories:()=>ht,NavigationViewStory:()=>mt}),mt=class NavigationViewStory extends D{_view=null;static{E.registerClass({GTypeName:`AdwStorybookNavigationView`},NavigationViewStory)}constructor(){super(D.fromMeta(NavigationViewStory.getMetadata(),`Default`))}static getMetadata(){return{...ft,component:C.NavigationView.$gtype}}buildPage(e,t){let n=new C.ToolbarView;return n.add_top_bar(new C.HeaderBar),n.content=t,new C.NavigationPage({title:e,child:n})}initialize(){this._view=new C.NavigationView({animateTransitions:this.args.animateTransitions,widthRequest:480,heightRequest:340});let e=this.buildPage(this.args.detailTitle,new C.StatusPage({iconName:`avatar-default-symbolic`,title:this.args.detailTitle,description:`Mathematician and writer, the first computer programmer.`,vexpand:!0})),t=new m.Button({label:`Open contact`,halign:m.Align.CENTER,valign:m.Align.CENTER,vexpand:!0});t.add_css_class(`pill`),t.add_css_class(`suggested-action`),t.connect(`clicked`,()=>{this._view?.push(e)});let n=this.buildPage(this.args.rootTitle,t);this._view.add(n),this._view.add(e),this.addContent(this._view)}updateArgs(e){this._view&&(this._view.animateTransitions=this.args.animateTransitions)}};E.type_ensure(mt.$gtype);const ht={stories:[mt]},gt={title:`Navigation/Overlay Split View`,description:`Adw.OverlaySplitView — a sidebar shown beside the content, or overlaid on top of it when collapsed.`,controls:[{name:`showSidebar`,label:`Show sidebar`,type:r.BOOLEAN,defaultValue:!0},{name:`collapsed`,label:`Collapsed`,type:r.BOOLEAN,defaultValue:!1}]};var _t=__exportAll({OverlaySplitViewStories:()=>vt,OverlaySplitViewStory:()=>U}),U=class OverlaySplitViewStory extends D{_view=null;static{E.registerClass({GTypeName:`AdwStorybookOverlaySplitView`},OverlaySplitViewStory)}constructor(){super(D.fromMeta(OverlaySplitViewStory.getMetadata(),`Default`))}static getMetadata(){return{...gt,component:C.OverlaySplitView.$gtype}}buildSidebar(){let e=new C.PreferencesGroup;for(let[t,n]of[[`Home`,`go-home-symbolic`],[`Discover`,`system-search-symbolic`],[`Library`,`folder-music-symbolic`],[`Settings`,`emblem-system-symbolic`]]){let r=new C.ActionRow({title:t});r.add_prefix(new m.Image({iconName:n})),r.activatable=!0,e.add(r)}let t=new C.ToolbarView;return t.add_top_bar(new C.HeaderBar({showTitle:!1})),t.content=e,t.add_css_class(`sidebar`),t}buildContent(){let e=new C.StatusPage({iconName:`folder-music-symbolic`,title:`Your Library`,description:`Toggle the sidebar to browse sections. Collapse it to overlay the content.`,vexpand:!0}),t=new C.ToolbarView;return t.add_top_bar(new C.HeaderBar),t.content=e,t}initialize(){this._view=new C.OverlaySplitView({sidebar:this.buildSidebar(),content:this.buildContent(),showSidebar:this.args.showSidebar,collapsed:this.args.collapsed,widthRequest:480,heightRequest:340}),this.addContent(this._view)}updateArgs(e){this._view&&(this._view.showSidebar=this.args.showSidebar,this._view.collapsed=this.args.collapsed)}};E.type_ensure(U.$gtype);const vt={stories:[U]},yt={title:`Navigation/Sidebar`,description:`Adw.Sidebar — a selectable list of Adw.SidebarItem grouped into sections. Selecting an item updates the content.`,controls:[{name:`mode`,label:`Mode`,type:r.SELECT,options:[{label:`Sidebar`,value:`sidebar`},{label:`Page`,value:`page`}],defaultValue:`sidebar`},{name:`selected`,label:`Selected index`,type:r.NUMBER,min:0,max:3,step:1,defaultValue:0}]};var bt=__exportAll({SidebarStories:()=>xt,SidebarStory:()=>W}),W=class SidebarStory extends D{_sidebar=null;_status=null;static{E.registerClass({GTypeName:`AdwStorybookSidebar`},SidebarStory)}constructor(){super(D.fromMeta(SidebarStory.getMetadata(),`Default`))}static getMetadata(){return{...yt,component:C.Sidebar.$gtype}}items=[{title:`Inbox`,subtitle:`3 unread`,icon:`mail-unread-symbolic`},{title:`Starred`,subtitle:`Favourites`,icon:`starred-symbolic`},{title:`Sent`,subtitle:`Outgoing mail`,icon:`mail-send-symbolic`},{title:`Archive`,subtitle:`Older mail`,icon:`folder-symbolic`}];modeFromArg(e){return e===`page`?C.SidebarMode.PAGE:C.SidebarMode.SIDEBAR}syncContent(){if(!this._sidebar||!this._status)return;let e=this.items[this._sidebar.selected]??this.items[0];this._status.title=e.title,this._status.iconName=e.icon,this._status.description=e.subtitle}initialize(){let e=new C.SidebarSection({title:`Mailboxes`});for(let t of this.items)e.append(new C.SidebarItem({title:t.title,subtitle:t.subtitle,iconName:t.icon}));this._sidebar=new C.Sidebar({mode:this.modeFromArg(this.args.mode),selected:this.args.selected,widthRequest:220}),this._sidebar.append(e),this._sidebar.connect(`notify::selected`,()=>this.syncContent()),this._status=new C.StatusPage({hexpand:!0,vexpand:!0});let t=new m.Box({orientation:m.Orientation.HORIZONTAL,widthRequest:480,heightRequest:340});t.append(this._sidebar),t.append(new m.Separator({orientation:m.Orientation.VERTICAL})),t.append(this._status),this.syncContent(),this.addContent(t)}updateArgs(e){this._sidebar&&(this._sidebar.mode=this.modeFromArg(this.args.mode),this._sidebar.selected=this.args.selected,this.syncContent())}};E.type_ensure(W.$gtype);const xt={stories:[W]},St=[{title:`Sync`,kind:`switch`,active:!0},{title:`Export`,kind:`action`}],Ct=[`Blue`,`Teal`,`Green`,`Orange`],wt=[{title:`Copy`,accelerator:`<Control>C`},{title:`Select all`,accelerator:`<Shift><Control>a`},{title:`Switch tab`,accelerator:`<Alt>1...9`}],Tt={title:`Overview/Widgets`,description:`Many widgets at once, the way an app composes them: a banner, preference groups of rows, an expander, buttons and shortcut labels. Use it to judge spacing, alignment and the theme as a whole rather than one widget in isolation.`,controls:[{name:`revealed`,label:`Show banner`,type:r.BOOLEAN,description:`Adw.Banner:revealed — animates in and out`,defaultValue:!0}]};var Et=__exportAll({OverviewWidgetsStories:()=>Dt,OverviewWidgetsStory:()=>G}),G=class OverviewWidgetsStory extends D{_banner=null;static{E.registerClass({GTypeName:`AdwStorybookOverviewWidgets`},OverviewWidgetsStory)}constructor(){super(D.fromMeta(OverviewWidgetsStory.getMetadata(),`Default`))}static getMetadata(){return Tt}initialize(){let e=new m.Box({orientation:m.Orientation.VERTICAL,hexpand:!0});this._banner=new C.Banner({title:`You have unsaved changes`,button_label:`Save`,revealed:this.args.revealed}),e.append(this._banner);let t=new C.PreferencesPage({hexpand:!0}),n=new C.PreferencesGroup({title:`Appearance`});n.add(new C.SwitchRow({title:`Dark mode`,subtitle:`Use the dark Adwaita palette`,active:!1})),n.add(new C.SwitchRow({title:`Notifications`,subtitle:`Show toasts for events`,active:!0})),n.add(new C.ComboRow({title:`Accent color`,model:m.StringList.new([...Ct]),selected:0})),t.add(n);let r=new C.PreferencesGroup({title:`Account`}),i=new C.EntryRow({title:`Name`});i.set_text(`Ada Lovelace`),r.add(i);let a=new C.EntryRow({title:`Email`});a.set_text(`ada@example.com`),r.add(a);let o=new C.SpinRow({title:`Devices`,adjustment:new m.Adjustment({value:3,lower:1,upper:10,step_increment:1,page_increment:1})});o.set_value(3),r.add(o);let s=new C.ExpanderRow({title:`Advanced`,subtitle:`More options`,expanded:!0});for(let e of St)s.add_row(e.kind===`switch`?new C.SwitchRow({title:e.title,active:e.active??!1}):new C.ActionRow({title:e.title}));r.add(s),t.add(r);let c=new C.PreferencesGroup({title:`Shortcuts`});for(let e of wt){let t=new C.ActionRow({title:e.title});t.add_suffix(new C.ShortcutLabel({accelerator:e.accelerator,valign:m.Align.CENTER})),c.add(t)}t.add(c);let l=new C.PreferencesGroup({title:`Actions`}),u=new m.Box({orientation:m.Orientation.HORIZONTAL,spacing:12,homogeneous:!0,margin_top:6,margin_bottom:6}),d=new m.Button({label:`Save changes`});d.add_css_class(`suggested-action`),u.append(d);let f=new m.Button({label:`Delete account`});f.add_css_class(`destructive-action`),u.append(f),l.add(u),t.add(l),e.append(t),this.addContent(e)}updateArgs(e){this._banner?.set_revealed(this.args.revealed)}};E.type_ensure(G.$gtype);const Dt={stories:[G]},Ot={title:`Presentation/Avatar`,description:`A circular avatar that derives initials (and a colour) from a name, or shows a symbolic icon.`,controls:[{name:`text`,label:`Name`,type:r.TEXT,defaultValue:`Ada Lovelace`},{name:`size`,label:`Size`,type:r.RANGE,min:24,max:160,step:8,defaultValue:96},{name:`showInitials`,label:`Show initials`,type:r.BOOLEAN,defaultValue:!0},{name:`iconName`,label:`Fallback icon`,type:r.SELECT,options:[{label:`Person`,value:`avatar-default-symbolic`},{label:`Contact`,value:`contact-new-symbolic`},{label:`Camera`,value:`camera-photo-symbolic`}],defaultValue:`avatar-default-symbolic`}]};var kt=__exportAll({AvatarStories:()=>At,AvatarStory:()=>K}),K=class AvatarStory extends D{_avatar=null;static{E.registerClass({GTypeName:`AdwStorybookAvatar`},AvatarStory)}constructor(){super(D.fromMeta(AvatarStory.getMetadata(),`Default`))}static getMetadata(){return{...Ot,component:C.Avatar.$gtype}}initialize(){this._avatar=new C.Avatar({size:this.args.size,text:this.args.text,showInitials:this.args.showInitials,iconName:this.args.iconName}),this.addContent(this._avatar)}updateArgs(e){this._avatar&&(this._avatar.size=this.args.size,this._avatar.text=this.args.text,this._avatar.showInitials=this.args.showInitials,this._avatar.iconName=this.args.iconName)}};E.type_ensure(K.$gtype);const At={stories:[K]},jt={title:`Presentation/Banner`,description:`Adw.Banner — a full-width strip carrying a status message and an optional action button.`,controls:[{name:`title`,label:`Title`,type:r.TEXT,defaultValue:`Metered connection — updates paused`},{name:`buttonLabel`,label:`Button label`,type:r.TEXT,defaultValue:`Resume`},{name:`revealed`,label:`Revealed`,type:r.BOOLEAN,defaultValue:!0},{name:`useMarkup`,label:`Use markup`,type:r.BOOLEAN,defaultValue:!1}]};var Mt=__exportAll({BannerStories:()=>Nt,BannerStory:()=>q}),q=class BannerStory extends D{_banner=null;static{E.registerClass({GTypeName:`AdwStorybookBanner`},BannerStory)}constructor(){super(D.fromMeta(BannerStory.getMetadata(),`Default`))}static getMetadata(){return{...jt,component:C.Banner.$gtype}}initialize(){this._banner=new C.Banner({title:this.args.title,buttonLabel:this.args.buttonLabel,revealed:this.args.revealed,useMarkup:this.args.useMarkup});let e=new m.Box({orientation:m.Orientation.VERTICAL,widthRequest:460});e.append(this._banner),this.addContent(e)}updateArgs(e){this._banner&&(this._banner.title=this.args.title,this._banner.buttonLabel=this.args.buttonLabel,this._banner.revealed=this.args.revealed,this._banner.useMarkup=this.args.useMarkup)}};E.type_ensure(q.$gtype);const Nt={stories:[q]},Pt=[{label:`Single`,accelerator:`<Control>C`},{label:`Modifier order`,accelerator:`<Shift><Control>a`},{label:`Alternatives`,accelerator:`<Shift>A Home`},{label:`Range`,accelerator:`<Alt>1...9`},{label:`In sequence`,accelerator:`<Control>C+<Control>X`},{label:`Together`,accelerator:`Control_L&Control_R`},{label:`Nested`,accelerator:`<Alt>1...9 <Alt>0`},{label:`Unset`,accelerator:``}],Ft={title:`Presentation/Shortcut Label`,description:`Adw.ShortcutLabel — an accelerator drawn as keycaps. The four grammar levels: alternatives (space), a range (...), pressed in sequence (+), and pressed together (&).`,controls:[{name:`accelerator`,label:`Accelerator`,type:r.SELECT,options:[{label:`Ctrl+C`,value:`<Control>C`},{label:`Modifier order (Shift+Ctrl+A)`,value:`<Shift><Control>a`},{label:`Alternatives (Shift+A / Home)`,value:`<Shift>A Home`},{label:`Range (Alt+1…9)`,value:`<Alt>1...9`},{label:`In sequence (Ctrl+C → Ctrl+X)`,value:`<Control>C+<Control>X`},{label:`Together (Ctrl L + Ctrl R)`,value:`Control_L&Control_R`},{label:`Nested (Alt+1…9 / Alt+0)`,value:`<Alt>1...9 <Alt>0`},{label:`Glyph key (Ctrl+Space)`,value:`<Control>space`},{label:`Arrow key (Left)`,value:`Left`},{label:`Unset — shows the placeholder`,value:``}],defaultValue:`<Control>C`},{name:`disabledText`,label:`Placeholder`,type:r.TEXT,defaultValue:`Disabled`}]},It={title:`Presentation/Shortcut Label (All Levels)`,description:`Every Adw.ShortcutLabel grammar level at once: alternatives (space), a range (...), pressed in sequence (+), pressed together (&) — plus GTK's fixed keycap order and the disabled placeholder.`,controls:[{name:`disabledText`,label:`Placeholder`,type:r.TEXT,defaultValue:`Disabled`}]};var Lt=__exportAll({ShortcutLabelLevelsStory:()=>Y,ShortcutLabelStories:()=>Rt,ShortcutLabelStory:()=>J}),J=class ShortcutLabelStory extends D{_widget=null;static{E.registerClass({GTypeName:`AdwStorybookShortcutLabel`},ShortcutLabelStory)}constructor(){super(D.fromMeta(ShortcutLabelStory.getMetadata(),`Default`))}static getMetadata(){return{...Ft,component:C.ShortcutLabel.$gtype}}initialize(){this._widget=new C.ShortcutLabel({accelerator:this.args.accelerator,disabledText:this.args.disabledText,halign:m.Align.CENTER,valign:m.Align.CENTER}),this.addContent(this._widget)}updateArgs(e){this._widget&&(this._widget.disabledText=this.args.disabledText,this._widget.accelerator=this.args.accelerator)}};E.type_ensure(J.$gtype);var Y=class ShortcutLabelLevelsStory extends D{_widgets=[];static{E.registerClass({GTypeName:`AdwStorybookShortcutLabelLevels`},ShortcutLabelLevelsStory)}constructor(){super(D.fromMeta(ShortcutLabelLevelsStory.getMetadata(),`Default`))}static getMetadata(){return{...It,component:C.ShortcutLabel.$gtype}}initialize(){let e=new m.Grid({row_spacing:12,column_spacing:24});for(let[t,n]of Pt.entries()){let r=new m.Label({label:n.label,halign:m.Align.START});r.add_css_class(`dimmed`),e.attach(r,0,t,1,1);let i=new C.ShortcutLabel({accelerator:n.accelerator,disabledText:this.args.disabledText,halign:m.Align.END,hexpand:!0});e.attach(i,1,t,1,1),this._widgets.push(i)}this.addContent(e)}updateArgs(e){for(let e of this._widgets)e.disabledText=this.args.disabledText}};E.type_ensure(Y.$gtype);const Rt={stories:[J,Y]},zt={title:`Presentation/Spinner`,description:`Adw.Spinner — a lightweight loading indicator that spins continuously while visible.`,controls:[{name:`size`,label:`Size`,type:r.RANGE,min:16,max:64,step:4,defaultValue:48}]};var Bt=__exportAll({SpinnerStories:()=>Vt,SpinnerStory:()=>X}),X=class SpinnerStory extends D{_spinner=null;static{E.registerClass({GTypeName:`AdwStorybookSpinner`},SpinnerStory)}constructor(){super(D.fromMeta(SpinnerStory.getMetadata(),`Default`))}static getMetadata(){return{...zt,component:C.Spinner.$gtype}}initialize(){let e=this.args.size;this._spinner=new C.Spinner({widthRequest:e,heightRequest:e,halign:m.Align.CENTER,valign:m.Align.CENTER}),this.addContent(this._spinner)}updateArgs(e){if(!this._spinner)return;let t=this.args.size;this._spinner.widthRequest=t,this._spinner.heightRequest=t}};E.type_ensure(X.$gtype);const Vt={stories:[X]},Ht={title:`Presentation/Status Page`,description:`Adw.StatusPage — a full-page empty state with an icon, title, description and optional action.`,controls:[{name:`iconName`,label:`Icon`,type:r.SELECT,options:[{label:`Folder`,value:`folder-symbolic`},{label:`Mail`,value:`mail-unread-symbolic`},{label:`Search`,value:`system-search-symbolic`},{label:`Star`,value:`starred-symbolic`}],defaultValue:`folder-symbolic`},{name:`title`,label:`Title`,type:r.TEXT,defaultValue:`No Documents`},{name:`description`,label:`Description`,type:r.TEXT,defaultValue:`Documents you create or open will appear here.`}]};var Ut=__exportAll({StatusPageStories:()=>Wt,StatusPageStory:()=>Z}),Z=class StatusPageStory extends D{_statusPage=null;static{E.registerClass({GTypeName:`AdwStorybookStatusPage`},StatusPageStory)}constructor(){super(D.fromMeta(StatusPageStory.getMetadata(),`Default`))}static getMetadata(){return{...Ht,component:C.StatusPage.$gtype}}initialize(){let e=new m.Button({label:`New Document`,halign:m.Align.CENTER,cssClasses:[`pill`,`suggested-action`]});this._statusPage=new C.StatusPage({iconName:this.args.iconName,title:this.args.title,description:this.args.description,child:e,widthRequest:460,heightRequest:320}),this.addContent(this._statusPage)}updateArgs(e){this._statusPage&&(this._statusPage.iconName=this.args.iconName,this._statusPage.title=this.args.title,this._statusPage.description=this.args.description)}};E.type_ensure(Z.$gtype);const Wt={stories:[Z]},Gt={title:`Presentation/Window Title`,description:`Adw.WindowTitle — a compact title/subtitle widget intended for a window or header bar.`,controls:[{name:`title`,label:`Title`,type:r.TEXT,defaultValue:`Inbox`},{name:`subtitle`,label:`Subtitle`,type:r.TEXT,defaultValue:`3 unread messages`}]};var Kt=__exportAll({WindowTitleStories:()=>Jt,WindowTitleStory:()=>qt}),qt=class WindowTitleStory extends D{_windowTitle=null;static{E.registerClass({GTypeName:`AdwStorybookWindowTitle`},WindowTitleStory)}constructor(){super(D.fromMeta(WindowTitleStory.getMetadata(),`Default`))}static getMetadata(){return{...Gt,component:C.WindowTitle.$gtype}}initialize(){this._windowTitle=new C.WindowTitle({title:this.args.title,subtitle:this.args.subtitle}),this.addContent(this._windowTitle)}updateArgs(e){this._windowTitle&&(this._windowTitle.title=this.args.title,this._windowTitle.subtitle=this.args.subtitle)}};E.type_ensure(qt.$gtype);const Jt={stories:[qt]},Yt={title:`Boxed Lists/Action Row`,description:`Adw.ActionRow — a preferences row with a title/subtitle, a prefix icon and a suffix button, shown inside a boxed list.`,controls:[{name:`title`,label:`Title`,type:r.TEXT,defaultValue:`Wi-Fi`},{name:`subtitle`,label:`Subtitle`,type:r.TEXT,defaultValue:`Connected to Highgarden 5GHz`},{name:`iconName`,label:`Prefix icon`,type:r.SELECT,options:[{label:`Network`,value:`network-wireless-symbolic`},{label:`Folder`,value:`folder-symbolic`},{label:`Starred`,value:`starred-symbolic`}],defaultValue:`network-wireless-symbolic`},{name:`activatable`,label:`Activatable`,type:r.BOOLEAN,defaultValue:!0}]};var Xt=__exportAll({ActionRowStories:()=>Qt,ActionRowStory:()=>Zt}),Zt=class ActionRowStory extends D{_row=null;_icon=null;_button=null;static{E.registerClass({GTypeName:`AdwStorybookActionRow`},ActionRowStory)}constructor(){super(D.fromMeta(ActionRowStory.getMetadata(),`Default`))}static getMetadata(){return{...Yt,component:C.ActionRow.$gtype}}initialize(){this._row=new C.ActionRow({title:this.args.title,subtitle:this.args.subtitle}),this._icon=new m.Image({iconName:this.args.iconName}),this._row.add_prefix(this._icon),this._button=new m.Button({iconName:`go-next-symbolic`,valign:m.Align.CENTER}),this._button.add_css_class(`flat`),this._row.add_suffix(this._button),this._row.activatableWidget=this._button,this._row.activatable=this.args.activatable;let e=new C.PreferencesGroup;e.add(this._row);let t=new C.Clamp({maximumSize:400,child:e});this.addContent(t)}updateArgs(e){!this._row||!this._icon||(this._row.title=this.args.title,this._row.subtitle=this.args.subtitle,this._icon.iconName=this.args.iconName,this._row.activatable=this.args.activatable)}};E.type_ensure(Zt.$gtype);const Qt={stories:[Zt]},$t={title:`Boxed Lists/Button Row`,description:`Adw.ButtonRow — a full-width row that acts as a button, with an optional icon and style class.`,controls:[{name:`title`,label:`Title`,type:r.TEXT,defaultValue:`Add account`},{name:`startIconName`,label:`Start icon`,type:r.SELECT,options:[{label:`Add`,value:`list-add-symbolic`},{label:`Trash`,value:`user-trash-symbolic`},{label:`None`,value:``}],defaultValue:`list-add-symbolic`},{name:`style`,label:`Style`,type:r.SELECT,options:[{label:`None`,value:`none`},{label:`Suggested`,value:`suggested-action`},{label:`Destructive`,value:`destructive-action`}],defaultValue:`suggested-action`}]};var en=__exportAll({ButtonRowStories:()=>rn,ButtonRowStory:()=>nn});const tn=[`suggested-action`,`destructive-action`];var nn=class ButtonRowStory extends D{_row=null;static{E.registerClass({GTypeName:`AdwStorybookButtonRow`},ButtonRowStory)}constructor(){super(D.fromMeta(ButtonRowStory.getMetadata(),`Default`))}static getMetadata(){return{...$t,component:C.ButtonRow.$gtype}}initialize(){this._row=new C.ButtonRow({title:this.args.title,startIconName:this.args.startIconName}),this._applyStyle(this.args.style);let e=new C.PreferencesGroup;e.add(this._row);let t=new C.Clamp({maximumSize:400,child:e});this.addContent(t)}_applyStyle(e){if(this._row){for(let e of tn)this._row.remove_css_class(e);e!==`none`&&this._row.add_css_class(e)}}updateArgs(e){this._row&&(this._row.title=this.args.title,this._row.startIconName=this.args.startIconName,this._applyStyle(this.args.style))}};E.type_ensure(nn.$gtype);const rn={stories:[nn]},an=[`Blue`,`Teal`,`Green`,`Orange`,`Purple`],on={title:`Boxed Lists/Combo Row`,description:`Adw.ComboRow — a preferences row with an inline drop-down backed by a Gtk.StringList.`,controls:[{name:`title`,label:`Title`,type:r.TEXT,defaultValue:`Accent colour`},{name:`subtitle`,label:`Subtitle`,type:r.TEXT,defaultValue:`Used to highlight selected items`},{name:`selected`,label:`Selected`,type:r.NUMBER,min:0,max:4,step:1,defaultValue:1}]};var sn=__exportAll({ComboRowStories:()=>ln,ComboRowStory:()=>cn}),cn=class ComboRowStory extends D{_row=null;static{E.registerClass({GTypeName:`AdwStorybookComboRow`},ComboRowStory)}constructor(){super(D.fromMeta(ComboRowStory.getMetadata(),`Default`))}static getMetadata(){return{...on,component:C.ComboRow.$gtype}}initialize(){this._row=new C.ComboRow({title:this.args.title,subtitle:this.args.subtitle,model:new m.StringList({strings:[...an]}),selected:this.args.selected});let e=new C.PreferencesGroup;e.add(this._row);let t=new C.Clamp({maximumSize:400,child:e});this.addContent(t)}updateArgs(e){this._row&&(this._row.title=this.args.title,this._row.subtitle=this.args.subtitle,this._row.selected=this.args.selected)}};E.type_ensure(cn.$gtype);const ln={stories:[cn]},un={title:`Boxed Lists/Entry Row`,description:`Adw.EntryRow — a preferences row whose title doubles as placeholder text for an inline entry.`,controls:[{name:`title`,label:`Title`,type:r.TEXT,defaultValue:`Display name`},{name:`text`,label:`Text`,type:r.TEXT,defaultValue:`Ada Lovelace`},{name:`showApplyButton`,label:`Show apply button`,type:r.BOOLEAN,defaultValue:!0}]};var dn=__exportAll({EntryRowStories:()=>pn,EntryRowStory:()=>fn}),fn=class EntryRowStory extends D{_row=null;static{E.registerClass({GTypeName:`AdwStorybookEntryRow`},EntryRowStory)}constructor(){super(D.fromMeta(EntryRowStory.getMetadata(),`Default`))}static getMetadata(){return{...un,component:C.EntryRow.$gtype}}initialize(){this._row=new C.EntryRow({title:this.args.title,text:this.args.text,showApplyButton:this.args.showApplyButton});let e=new C.PreferencesGroup;e.add(this._row);let t=new C.Clamp({maximumSize:400,child:e});this.addContent(t)}updateArgs(e){this._row&&(this._row.title=this.args.title,this._row.text=this.args.text,this._row.showApplyButton=this.args.showApplyButton)}};E.type_ensure(fn.$gtype);const pn={stories:[fn]},mn={title:`Boxed Lists/Expander Row`,description:`Adw.ExpanderRow — a preferences row that discloses nested rows and can carry an enable switch.`,controls:[{name:`title`,label:`Title`,type:r.TEXT,defaultValue:`Proxy settings`},{name:`subtitle`,label:`Subtitle`,type:r.TEXT,defaultValue:`Route traffic through a custom proxy`},{name:`expanded`,label:`Expanded`,type:r.BOOLEAN,defaultValue:!0},{name:`showEnableSwitch`,label:`Show enable switch`,type:r.BOOLEAN,defaultValue:!1}]};var hn=__exportAll({ExpanderRowStories:()=>_n,ExpanderRowStory:()=>gn}),gn=class ExpanderRowStory extends D{_row=null;static{E.registerClass({GTypeName:`AdwStorybookExpanderRow`},ExpanderRowStory)}constructor(){super(D.fromMeta(ExpanderRowStory.getMetadata(),`Default`))}static getMetadata(){return{...mn,component:C.ExpanderRow.$gtype}}initialize(){this._row=new C.ExpanderRow({title:this.args.title,subtitle:this.args.subtitle,expanded:this.args.expanded,showEnableSwitch:this.args.showEnableSwitch}),this._row.add_row(new C.EntryRow({title:`Host`,text:`proxy.example.com`})),this._row.add_row(new C.SwitchRow({title:`Use authentication`,active:!1}));let e=new C.PreferencesGroup;e.add(this._row);let t=new C.Clamp({maximumSize:400,child:e});this.addContent(t)}updateArgs(e){this._row&&(this._row.title=this.args.title,this._row.subtitle=this.args.subtitle,this._row.expanded=this.args.expanded,this._row.showEnableSwitch=this.args.showEnableSwitch)}};E.type_ensure(gn.$gtype);const _n={stories:[gn]},vn={title:`Boxed Lists/Password Entry Row`,description:`Adw.PasswordEntryRow — an entry row that masks its contents and shows a peek toggle.`,controls:[{name:`title`,label:`Title`,type:r.TEXT,defaultValue:`Password`},{name:`text`,label:`Text`,type:r.TEXT,defaultValue:`correct-horse-battery`}]};var yn=__exportAll({PasswordEntryRowStories:()=>xn,PasswordEntryRowStory:()=>bn}),bn=class PasswordEntryRowStory extends D{_row=null;static{E.registerClass({GTypeName:`AdwStorybookPasswordEntryRow`},PasswordEntryRowStory)}constructor(){super(D.fromMeta(PasswordEntryRowStory.getMetadata(),`Default`))}static getMetadata(){return{...vn,component:C.PasswordEntryRow.$gtype}}initialize(){this._row=new C.PasswordEntryRow({title:this.args.title,text:this.args.text});let e=new C.PreferencesGroup;e.add(this._row);let t=new C.Clamp({maximumSize:400,child:e});this.addContent(t)}updateArgs(e){this._row&&(this._row.title=this.args.title,this._row.text=this.args.text)}};E.type_ensure(bn.$gtype);const xn={stories:[bn]},Sn={title:`Boxed Lists/Preferences Group`,description:`Adw.PreferencesGroup — the boxed-list container that gathers a title, description, header-suffix widget and rows.`,controls:[{name:`title`,label:`Title`,type:r.TEXT,defaultValue:`Account`},{name:`description`,label:`Description`,type:r.TEXT,defaultValue:`Manage how this device signs in and syncs.`}]};var Cn=__exportAll({PreferencesGroupStories:()=>Tn,PreferencesGroupStory:()=>wn}),wn=class PreferencesGroupStory extends D{_prefsGroup=null;static{E.registerClass({GTypeName:`AdwStorybookPreferencesGroup`},PreferencesGroupStory)}constructor(){super(D.fromMeta(PreferencesGroupStory.getMetadata(),`Default`))}static getMetadata(){return{...Sn,component:C.PreferencesGroup.$gtype}}initialize(){let e=new m.Button({label:`Sign out`,valign:m.Align.CENTER});e.add_css_class(`flat`),this._prefsGroup=new C.PreferencesGroup({title:this.args.title,description:this.args.description,headerSuffix:e});let t=new C.EntryRow({title:`Display name`,text:`Grace Hopper`});this._prefsGroup.add(t);let n=new C.SwitchRow({title:`Sync over Wi-Fi only`,subtitle:`Avoid using mobile data for backups`,active:!0});this._prefsGroup.add(n);let r=new C.ComboRow({title:`Region`,model:new m.StringList({strings:[`Europe`,`Americas`,`Asia`,`Oceania`]}),selected:0});this._prefsGroup.add(r);let i=new C.Clamp({maximumSize:400,child:this._prefsGroup});this.addContent(i)}updateArgs(e){this._prefsGroup&&(this._prefsGroup.title=this.args.title,this._prefsGroup.description=this.args.description)}};E.type_ensure(wn.$gtype);const Tn={stories:[wn]},En={title:`Boxed Lists/Spin Row`,description:`Adw.SpinRow — a preferences row with an inline spin button over a numeric adjustment.`,controls:[{name:`title`,label:`Title`,type:r.TEXT,defaultValue:`Font size`},{name:`value`,label:`Value`,type:r.NUMBER,min:0,max:100,step:1,defaultValue:16},{name:`digits`,label:`Digits`,type:r.NUMBER,min:0,max:4,step:1,defaultValue:0}]};var Dn=__exportAll({SpinRowStories:()=>On,SpinRowStory:()=>Q}),Q=class SpinRowStory extends D{_row=null;static{E.registerClass({GTypeName:`AdwStorybookSpinRow`},SpinRowStory)}constructor(){super(D.fromMeta(SpinRowStory.getMetadata(),`Default`))}static getMetadata(){return{...En,component:C.SpinRow.$gtype}}initialize(){this._row=new C.SpinRow({title:this.args.title,adjustment:new m.Adjustment({lower:0,upper:100,value:this.args.value,stepIncrement:1,pageIncrement:10}),digits:this.args.digits});let e=new C.PreferencesGroup;e.add(this._row);let t=new C.Clamp({maximumSize:400,child:e});this.addContent(t)}updateArgs(e){this._row&&(this._row.title=this.args.title,this._row.value=this.args.value,this._row.digits=this.args.digits)}};E.type_ensure(Q.$gtype);const On={stories:[Q]},kn={title:`Boxed Lists/Switch Row`,description:`Adw.SwitchRow — a preferences row with a trailing switch, shown inside a boxed list.`,controls:[{name:`title`,label:`Title`,type:r.TEXT,defaultValue:`Automatic updates`},{name:`subtitle`,label:`Subtitle`,type:r.TEXT,defaultValue:`Download and install updates without asking`},{name:`active`,label:`Active`,type:r.BOOLEAN,defaultValue:!0}]};var An=__exportAll({SwitchRowStories:()=>Mn,SwitchRowStory:()=>jn}),jn=class SwitchRowStory extends D{_row=null;static{E.registerClass({GTypeName:`AdwStorybookSwitchRow`},SwitchRowStory)}constructor(){super(D.fromMeta(SwitchRowStory.getMetadata(),`Default`))}static getMetadata(){return{...kn,component:C.SwitchRow.$gtype}}initialize(){this._row=new C.SwitchRow({title:this.args.title,subtitle:this.args.subtitle,active:this.args.active});let e=new C.PreferencesGroup;e.add(this._row);let t=new C.Clamp({maximumSize:400,child:e});this.addContent(t)}updateArgs(e){this._row&&(this._row.title=this.args.title,this._row.subtitle=this.args.subtitle,this._row.active=this.args.active)}};E.type_ensure(jn.$gtype);const Mn={stories:[jn]},Nn=[{name:`allowScrollWheel`,label:`Allow scroll wheel`,type:r.BOOLEAN,defaultValue:!0},{name:`allowLongSwipes`,label:`Allow long swipes`,type:r.BOOLEAN,defaultValue:!1}],Pn={title:`View Switching/Carousel (Dots)`,description:`Adw.Carousel — a horizontally swipeable pager with three pages, paired with Adw.CarouselIndicatorDots.`,controls:Nn},Fn={title:`View Switching/Carousel (Lines)`,description:`Adw.Carousel — the same swipeable pager paired with Adw.CarouselIndicatorLines instead of dots.`,controls:Nn};var In=__exportAll({CarouselDotsStory:()=>Rn,CarouselLinesStory:()=>zn,CarouselStories:()=>Bn});const Ln=[{title:`Welcome`,css:`accent`},{title:`Discover`,css:`success`},{title:`Get started`,css:`warning`}];function buildPage(e,t){let n=new m.Box({orientation:m.Orientation.VERTICAL,halign:m.Align.CENTER,valign:m.Align.CENTER,widthRequest:440,heightRequest:260});n.add_css_class(`card`),n.add_css_class(t);let r=new m.Label({label:e,vexpand:!0,valign:m.Align.CENTER});return r.add_css_class(`title-1`),n.append(r),n}var Rn=class CarouselDotsStory extends D{_carousel=null;static{E.registerClass({GTypeName:`AdwStorybookCarouselDots`},CarouselDotsStory)}constructor(){super(D.fromMeta(CarouselDotsStory.getMetadata(),`Default`))}static getMetadata(){return{...Pn,component:C.Carousel.$gtype}}initialize(){this._carousel=new C.Carousel({allowScrollWheel:this.args.allowScrollWheel,allowLongSwipes:this.args.allowLongSwipes,vexpand:!0});for(let e of Ln)this._carousel.append(buildPage(e.title,e.css));let e=new C.CarouselIndicatorDots({carousel:this._carousel}),t=new m.Box({orientation:m.Orientation.VERTICAL,spacing:12,widthRequest:480,heightRequest:340});t.append(this._carousel),t.append(e),this.addContent(t)}updateArgs(e){this._carousel&&(this._carousel.allowScrollWheel=this.args.allowScrollWheel,this._carousel.allowLongSwipes=this.args.allowLongSwipes)}};E.type_ensure(Rn.$gtype);var zn=class CarouselLinesStory extends D{_carousel=null;static{E.registerClass({GTypeName:`AdwStorybookCarouselLines`},CarouselLinesStory)}constructor(){super(D.fromMeta(CarouselLinesStory.getMetadata(),`Default`))}static getMetadata(){return{...Fn,component:C.Carousel.$gtype}}initialize(){this._carousel=new C.Carousel({allowScrollWheel:this.args.allowScrollWheel,allowLongSwipes:this.args.allowLongSwipes,vexpand:!0});for(let e of Ln)this._carousel.append(buildPage(e.title,e.css));let e=new C.CarouselIndicatorLines({carousel:this._carousel}),t=new m.Box({orientation:m.Orientation.VERTICAL,spacing:12,widthRequest:480,heightRequest:340});t.append(this._carousel),t.append(e),this.addContent(t)}updateArgs(e){this._carousel&&(this._carousel.allowScrollWheel=this.args.allowScrollWheel,this._carousel.allowLongSwipes=this.args.allowLongSwipes)}};E.type_ensure(zn.$gtype);const Bn={stories:[Rn,zn]},Vn={title:`View Switching/Inline View Switcher`,description:`Adw.InlineViewSwitcher — a compact inline switcher that can show labels, icons, or both for an Adw.ViewStack.`,controls:[{name:`displayMode`,label:`Display mode`,type:r.SELECT,options:[{label:`Labels`,value:`labels`},{label:`Icons`,value:`icons`},{label:`Both`,value:`both`}],defaultValue:`both`}]};var Hn=__exportAll({InlineViewSwitcherStories:()=>Wn,InlineViewSwitcherStory:()=>Un}),Un=class InlineViewSwitcherStory extends D{_switcher=null;static{E.registerClass({GTypeName:`AdwStorybookInlineViewSwitcher`},InlineViewSwitcherStory)}constructor(){super(D.fromMeta(InlineViewSwitcherStory.getMetadata(),`Default`))}static getMetadata(){return{...Vn,component:C.InlineViewSwitcher.$gtype}}buildPage(e,t,n){return new C.StatusPage({iconName:t,title:e,description:n,vexpand:!0})}initialize(){let e=new C.ViewStack({vexpand:!0});e.add_titled_with_icon(this.buildPage(`Overview`,`view-grid-symbolic`,`A quick summary of your project.`),`overview`,`Overview`,`view-grid-symbolic`),e.add_titled_with_icon(this.buildPage(`Activity`,`document-edit-symbolic`,`Recent edits and changes.`),`activity`,`Activity`,`document-edit-symbolic`),e.add_titled_with_icon(this.buildPage(`Settings`,`emblem-system-symbolic`,`Configure how things behave.`),`settings`,`Settings`,`emblem-system-symbolic`),this._switcher=new C.InlineViewSwitcher({stack:e,displayMode:this.modeFromArg(this.args.displayMode),halign:m.Align.CENTER});let t=new m.Box({orientation:m.Orientation.VERTICAL,spacing:12,widthRequest:480,heightRequest:340});t.append(this._switcher),t.append(e),this.addContent(t)}modeFromArg(e){return e===`labels`?C.InlineViewSwitcherDisplayMode.LABELS:e===`icons`?C.InlineViewSwitcherDisplayMode.ICONS:C.InlineViewSwitcherDisplayMode.BOTH}updateArgs(e){this._switcher&&(this._switcher.displayMode=this.modeFromArg(this.args.displayMode))}};E.type_ensure(Un.$gtype);const Wn={stories:[Un]},Gn={title:`View Switching/Tab View`,description:`Adw.TabView with an Adw.TabBar header — three tabbed pages; the tab bar can auto-hide when only one tab remains.`,controls:[{name:`autohide`,label:`Autohide tab bar`,type:r.BOOLEAN,defaultValue:!1}]};var Kn=__exportAll({TabViewStories:()=>Yn,TabViewStory:()=>Jn});const qn=[{title:`Overview`,body:`A summary of everything at a glance.`},{title:`Details`,body:`The specifics, broken down line by line.`},{title:`History`,body:`A log of every change made so far.`}];var Jn=class TabViewStory extends D{_tabBar=null;static{E.registerClass({GTypeName:`AdwStorybookTabView`},TabViewStory)}constructor(){super(D.fromMeta(TabViewStory.getMetadata(),`Default`))}static getMetadata(){return{...Gn,component:C.TabView.$gtype}}buildPageBody(e,t){return new C.StatusPage({iconName:`view-paged-symbolic`,title:e,description:t,vexpand:!0})}initialize(){let e=new C.TabView({vexpand:!0});for(let t of qn){let n=e.append(this.buildPageBody(t.title,t.body));n.title=t.title}this._tabBar=new C.TabBar({view:e,autohide:this.args.autohide});let t=new m.Box({orientation:m.Orientation.VERTICAL,widthRequest:480,heightRequest:340});t.append(this._tabBar),t.append(e),this.addContent(t)}updateArgs(e){this._tabBar&&(this._tabBar.autohide=this.args.autohide)}};E.type_ensure(Jn.$gtype);const Yn={stories:[Jn]},Xn={title:`View Switching/View Switcher`,description:`Adw.ViewSwitcher — a segmented switcher whose buttons select pages in a paired Adw.ViewStack.`,controls:[{name:`policy`,label:`Policy`,type:r.SELECT,options:[{label:`Wide`,value:`wide`},{label:`Narrow`,value:`narrow`}],defaultValue:`wide`}]};var Zn=__exportAll({ViewSwitcherStories:()=>Qn,ViewSwitcherStory:()=>$}),$=class ViewSwitcherStory extends D{_switcher=null;static{E.registerClass({GTypeName:`AdwStorybookViewSwitcher`},ViewSwitcherStory)}constructor(){super(D.fromMeta(ViewSwitcherStory.getMetadata(),`Default`))}static getMetadata(){return{...Xn,component:C.ViewSwitcher.$gtype}}buildPage(e,t,n){return new C.StatusPage({iconName:t,title:e,description:n,vexpand:!0})}initialize(){let e=new C.ViewStack({vexpand:!0});e.add_titled_with_icon(this.buildPage(`Inbox`,`mail-unread-symbolic`,`You have three unread conversations.`),`inbox`,`Inbox`,`mail-unread-symbolic`),e.add_titled_with_icon(this.buildPage(`Starred`,`starred-symbolic`,`Messages you have marked as important.`),`starred`,`Starred`,`starred-symbolic`),e.add_titled_with_icon(this.buildPage(`Archive`,`folder-symbolic`,`Older conversations kept for reference.`),`archive`,`Archive`,`folder-symbolic`),this._switcher=new C.ViewSwitcher({stack:e,policy:this.policyFromArg(this.args.policy),halign:m.Align.CENTER});let t=new m.Box({orientation:m.Orientation.VERTICAL,spacing:12,widthRequest:480,heightRequest:340});t.append(this._switcher),t.append(e),this.addContent(t)}policyFromArg(e){return e===`narrow`?C.ViewSwitcherPolicy.NARROW:C.ViewSwitcherPolicy.WIDE}updateArgs(e){this._switcher&&(this._switcher.policy=this.policyFromArg(this.args.policy))}};E.type_ensure($.$gtype);const Qn={stories:[$]};await runStorybook({applicationId:`org.gjsify.AdwaitaStorybook`,title:`Adwaita Storybook`,stories:collectStoryModules([Se,Te,Ae,Ne,Le,Be,Ue,Ke,Ye,Qe,tt,it,st,ut,pt,_t,bt,Et,kt,Mt,Lt,Bt,Ut,Kt,Xt,en,sn,dn,hn,yn,Cn,Dn,An,In,Hn,Kn,Zn])});export{};
184
+ \n${this._options.css??``}`);let t=f.Display.get_default();if(!t){console.error(`No display found`);return}h.StyleContext.add_provider_for_display(t,e,h.STYLE_PROVIDER_PRIORITY_APPLICATION)}_onActivate(){if(!this._window){this._window=new _e({application:this}),this._options.title&&this._window.set_title(this._options.title);try{this._window.populateSidebar(this._options.stories)}catch(e){console.error(`Failed to create story instances:`,e)}installDevtools(this,{enabled:this._options.devtools||void 0,extend:[storybookDevtoolsExtension(this._window)]}),probeEnabled()&&installStorybookProbe(this,this._window,this._options.probe)}this._window.present()}};D.type_ensure(ve.$gtype);function collectStoryModules(e){return collectStoryModules$1(e)}function buildGtkChrome(e){let t=new w.PreferencesPage,n=new w.PreferencesGroup,r=new h.Box({orientation:h.Orientation.VERTICAL,halign:h.Align.CENTER,valign:h.Align.CENTER,margin_top:12,margin_bottom:12,spacing:12,hexpand:!0});return r.add_css_class(`story-stage`),n.add(r),t.add(n),e.set_child(t),{root:e,hasStage:!0,setStageContent(e){let t=r.get_first_child();for(;t;)t.unparent(),t=r.get_first_child();r.append(e)},setChromeText(e,t){n.set_title(l.markup_escape_text(e,-1)),n.set_description(l.markup_escape_text(t,-1))}}}var StoryCore=class extends StoryViewBase{constructor(e,t,n){super(),this._widget=e,this.initBase(t,n)}createChrome(e){return buildGtkChrome(this._widget)}initialize(){this._widget.initialize()}updateArgs(e){this._widget.updateArgs(e)}teardown(){this._widget.teardown()}emitArgs(e){super.emitArgs(e),this._widget.notify(`args`)}},O=class StoryWidget extends w.Bin{static{D.registerClass({GTypeName:`StoryWidget`,Properties:{meta:D.ParamSpec.object(`meta`,`Meta`,`Story metadata`,D.ParamFlags.READWRITE,D.Object),story:D.ParamSpec.string(`story`,`Story Name`,`Story name`,D.ParamFlags.READWRITE,``),args:D.ParamSpec.object(`args`,`Args`,`Story arguments`,D.ParamFlags.READWRITE,D.Object)}},StoryWidget)}constructor(e,t={}){super(t),this._core=new StoryCore(this,e.meta,e.story)}static fromMeta(e,t){return{meta:e,story:t,args:argsFromControls(e.controls)}}get meta(){return this._core.meta}get story(){return this._core.story}get args(){return this._core.args}set args(e){this._core.args=e}onArgsChanged(e){return this._core.onArgsChanged(e)}setArg(e,t){this._core.setArg(e,t)}initialize(){}updateArgs(e){}teardown(){}addContent(e){this._core.addContent(e)}};D.type_ensure(O.$gtype);var ye=class AdwaitaApp extends w.Application{static{D.registerClass({GTypeName:`GjsifyAdwaitaApp`},AdwaitaApp)}constructor(e){super({application_id:e.applicationId,flags:e.flags??x.ApplicationFlags.DEFAULT_FLAGS}),this._window=null,this._options=e,this._initActions(),this.connect(`startup`,()=>this._onStartup()),this.connect(`activate`,()=>this._onActivate())}_initActions(){if(this._options.quitAction!==!1){let e=new x.SimpleAction({name:`quit`});e.connect(`activate`,()=>this.quit()),this.add_action(e),this.set_accels_for_action(`app.quit`,[`<primary>q`])}if(this._options.about){let e=new x.SimpleAction({name:`about`});e.connect(`activate`,()=>this._showAbout()),this.add_action(e)}}_onStartup(){this._options.css&&this._loadCss(this._options.css),this._installDevtools(),this._options.onStartup?.(this)}_loadCss(e){let t=f.Display.get_default();if(!t){console.error(`@gjsify/adwaita-app: no default display; CSS not applied`);return}let n=new h.CssProvider;n.load_from_string(e),h.StyleContext.add_provider_for_display(t,n,h.STYLE_PROVIDER_PRIORITY_APPLICATION)}_installDevtools(){let e=this._options.devtools;if(e===!1)return;let t=typeof e==`object`?e:{enabled:e||void 0};installDevtools(this,t)}_onActivate(){this._window||=this._options.createWindow(this),this._window.present()}_showAbout(){let e=this._options.about;if(!e)return;let t=new w.AboutDialog({application_name:e.applicationName,application_icon:e.applicationIcon??this._options.applicationId});e.version&&(t.version=e.version),e.developerName&&(t.developer_name=e.developerName),e.website&&(t.website=e.website),e.issueUrl&&(t.issue_url=e.issueUrl),e.license&&(t.license=e.license),e.comments&&(t.comments=e.comments),e.copyright&&(t.copyright=e.copyright),e.developers?.length&&t.set_developers(e.developers),t.present(this.get_active_window())}};async function runApplication(e,t){let n=!1;try{e.register(null),n=e.get_is_remote()}catch{n=!1}let r=await e.runAsync(t);return n&&console.error(`${e.applicationId??`This application`} is already running — brought the existing instance to the front instead of opening a second window.`),r}D.type_ensure(ye.$gtype);var be=class LoadingStack extends h.Stack{static{D.registerClass({GTypeName:`GjsifyLoadingStack`},LoadingStack)}constructor(e={}){super(e);let t=new h.Box({orientation:h.Orientation.VERTICAL,halign:h.Align.CENTER,valign:h.Align.CENTER,hexpand:!0,vexpand:!0});t.append(new w.Spinner),this.add_named(t,`loading`),this._content=new w.Bin({hexpand:!0,vexpand:!0}),this.add_named(this._content,`content`),this._error=new w.StatusPage({iconName:`dialog-error-symbolic`,title:`Something went wrong`}),this.add_named(this._error,`error`),this.set_visible_child_name(`loading`)}setContent(e){this._content.set_child(e)}setError(e,t){this._error.set_title(e),this._error.set_description(t??``)}showLoading(){this.set_visible_child_name(`loading`)}showContent(){this.set_visible_child_name(`content`)}showError(){this.set_visible_child_name(`error`)}};D.type_ensure(be.$gtype);async function runStorybook(e){return runApplication(new ve(e),[t.programInvocationName,...t.programArgs])}const xe={title:`Buttons/Button Content`,description:`Adw.ButtonContent — pairs a symbolic icon with a label inside a Gtk.Button.`,controls:[{name:`label`,label:`Label`,type:i.TEXT,defaultValue:`Download`},{name:`iconName`,label:`Icon`,type:i.SELECT,options:[{label:`Download`,value:`folder-download-symbolic`},{label:`Add`,value:`list-add-symbolic`},{label:`Send`,value:`mail-send-symbolic`},{label:`Star`,value:`starred-symbolic`}],defaultValue:`folder-download-symbolic`},{name:`canShrink`,label:`Can shrink`,type:i.BOOLEAN,defaultValue:!1}]};var Se=__exportAll({ButtonContentStories:()=>Ce,ButtonContentStory:()=>k}),k=class ButtonContentStory extends O{_content=null;_button=null;static{D.registerClass({GTypeName:`AdwStorybookButtonContent`},ButtonContentStory)}constructor(){super(O.fromMeta(ButtonContentStory.getMetadata(),`Default`))}static getMetadata(){return{...xe,component:w.ButtonContent.$gtype}}initialize(){this._content=new w.ButtonContent({label:this.args.label,iconName:this.args.iconName,canShrink:this.args.canShrink}),this._button=new h.Button({child:this._content}),this._button.add_css_class(`suggested-action`),this._button.add_css_class(`pill`),this.addContent(this._button)}updateArgs(e){this._content&&(this._content.label=this.args.label,this._content.iconName=this.args.iconName,this._content.canShrink=this.args.canShrink)}};D.type_ensure(k.$gtype);const Ce={stories:[k]},we={title:`Buttons/Button Styles`,description:`Buttons with Adwaita style classes: .pill, .circular, .suggested-action, .destructive-action, .flat.`,controls:[{name:`label`,label:`Demo label`,type:i.TEXT,defaultValue:`Click me`},{name:`style`,label:`Demo style`,type:i.SELECT,options:[{label:`Pill`,value:`pill`},{label:`Circular (icon)`,value:`circular`},{label:`Suggested`,value:`suggested-action`},{label:`Destructive`,value:`destructive-action`},{label:`Flat`,value:`flat`}],defaultValue:`suggested-action`}]};var Te=__exportAll({ButtonStylesStories:()=>De,ButtonStylesStory:()=>A});const Ee=[`pill`,`circular`,`suggested-action`,`destructive-action`,`flat`];var A=class ButtonStylesStory extends O{_demo=null;static{D.registerClass({GTypeName:`AdwStorybookButtonStyles`},ButtonStylesStory)}constructor(){super(O.fromMeta(ButtonStylesStory.getMetadata(),`Default`))}static getMetadata(){return{...we,component:h.Button.$gtype}}initialize(){let e=new w.WrapBox({childSpacing:12,lineSpacing:12,halign:h.Align.CENTER}),t=new h.Button({label:`Pill`});t.add_css_class(`pill`),e.append(t);let n=new h.Button({iconName:`list-add-symbolic`});n.add_css_class(`circular`),e.append(n);let r=new h.Button({label:`Suggested`});r.add_css_class(`suggested-action`),e.append(r);let i=new h.Button({label:`Delete`});i.add_css_class(`destructive-action`),e.append(i);let a=new h.Button({label:`Flat`});a.add_css_class(`flat`),e.append(a),this._demo=new h.Button({label:this.args.label}),this._applyStyle(this.args.style),e.append(this._demo),this.addContent(e)}_applyStyle(e){if(this._demo){for(let e of Ee)this._demo.remove_css_class(e);this._demo.add_css_class(e)}}updateArgs(e){this._demo&&(this._demo.label=this.args.label,this._applyStyle(this.args.style))}};D.type_ensure(A.$gtype);const De={stories:[A]},Oe=[`Save as…`,`Export`,`Print`],ke={title:`Buttons/Menu Button`,description:`Gtk.MenuButton — a button whose only action is to open a menu. Where a Split Button has a primary action beside its arrow, this one has none: every choice lives in the popover.`,controls:[{name:`iconName`,label:`Icon`,type:i.SELECT,options:[{label:`Hamburger`,value:`open-menu-symbolic`},{label:`More`,value:`view-more-symbolic`},{label:`Open`,value:`document-open-symbolic`}],defaultValue:`open-menu-symbolic`},{name:`menuTitle`,label:`Menu title`,type:i.TEXT,defaultValue:`Document`}]};var Ae=__exportAll({MenuButtonStories:()=>je,MenuButtonStory:()=>j}),j=class MenuButtonStory extends O{_widget=null;static{D.registerClass({GTypeName:`AdwStorybookMenuButton`},MenuButtonStory)}constructor(){super(O.fromMeta(MenuButtonStory.getMetadata(),`Default`))}static getMetadata(){return{...ke,component:h.MenuButton.$gtype}}initialize(){this._widget=new h.MenuButton({halign:h.Align.CENTER}),this._apply(),this.addContent(this._widget)}updateArgs(e){this._apply()}_buildMenu(e){let t=new x.Menu;for(let e of Oe)t.append(e,`app.${e.toLowerCase().replace(/[^a-z]+/g,`-`)}`);let n=new x.Menu;return n.append_section(e.length>0?e:null,t),n}_apply(){this._widget&&(this._widget.iconName=this.args.iconName,this._widget.menuModel=this._buildMenu(this.args.menuTitle))}};D.type_ensure(j.$gtype);const je={stories:[j]},Me={title:`Buttons/Split Button`,description:`Adw.SplitButton — a primary action button paired with a dropdown menu of related actions.`,controls:[{name:`label`,label:`Label`,type:i.TEXT,defaultValue:`Save`},{name:`iconName`,label:`Icon`,type:i.SELECT,options:[{label:`None`,value:``},{label:`Save`,value:`document-save-symbolic`},{label:`Send`,value:`mail-send-symbolic`},{label:`Add`,value:`list-add-symbolic`}],defaultValue:`document-save-symbolic`}]},Ne={title:`Buttons/Split Button Flat`,description:`Adw.SplitButton with the .flat style class, as used inside header bars and toolbars.`,controls:[{name:`label`,label:`Label`,type:i.TEXT,defaultValue:`Reply`},{name:`iconName`,label:`Icon`,type:i.SELECT,options:[{label:`None`,value:``},{label:`Reply`,value:`mail-reply-sender-symbolic`},{label:`Edit`,value:`document-edit-symbolic`},{label:`Open`,value:`document-open-symbolic`}],defaultValue:`mail-reply-sender-symbolic`}]};var Pe=__exportAll({SplitButtonFlatStory:()=>N,SplitButtonStories:()=>Fe,SplitButtonStory:()=>M});function buildMenu(){let e=new x.Menu;return e.append(`Save as…`,`app.save-as`),e.append(`Export`,`app.export`),e.append(`Print`,`app.print`),e}var M=class SplitButtonStory extends O{_widget=null;static{D.registerClass({GTypeName:`AdwStorybookSplitButton`},SplitButtonStory)}constructor(){super(O.fromMeta(SplitButtonStory.getMetadata(),`Default`))}static getMetadata(){return{...Me,component:w.SplitButton.$gtype}}initialize(){this._widget=new w.SplitButton({label:this.args.label,menuModel:buildMenu()});let e=this.args.iconName;e&&(this._widget.iconName=e),this.addContent(this._widget)}updateArgs(e){if(!this._widget)return;let t=this.args.iconName;t?this._widget.iconName=t:this._widget.label=this.args.label}};D.type_ensure(M.$gtype);var N=class SplitButtonFlatStory extends O{_widget=null;static{D.registerClass({GTypeName:`AdwStorybookSplitButtonFlat`},SplitButtonFlatStory)}constructor(){super(O.fromMeta(SplitButtonFlatStory.getMetadata(),`Default`))}static getMetadata(){return{...Ne,component:w.SplitButton.$gtype}}initialize(){this._widget=new w.SplitButton({label:this.args.label,menuModel:buildMenu()}),this._widget.add_css_class(`flat`);let e=this.args.iconName;e&&(this._widget.iconName=e),this.addContent(this._widget)}updateArgs(e){if(!this._widget)return;let t=this.args.iconName;t?this._widget.iconName=t:this._widget.label=this.args.label}};D.type_ensure(N.$gtype);const Fe={stories:[M,N]},Ie={title:`Buttons/Toggle Group`,description:`Adw.ToggleGroup — a linked group of Adw.Toggle buttons where exactly one is active.`,controls:[{name:`active`,label:`Active toggle`,type:i.SELECT,options:[{label:`List`,value:0},{label:`Grid`,value:1},{label:`Columns`,value:2}],defaultValue:0},{name:`style`,label:`Style`,type:i.SELECT,options:[{label:`Default`,value:`default`},{label:`Flat`,value:`flat`},{label:`Round`,value:`round`}],defaultValue:`default`}]};var Le=__exportAll({ToggleGroupStories:()=>ze,ToggleGroupStory:()=>P});const Re=[`flat`,`round`];var P=class ToggleGroupStory extends O{_toggleGroup=null;static{D.registerClass({GTypeName:`AdwStorybookToggleGroup`},ToggleGroupStory)}constructor(){super(O.fromMeta(ToggleGroupStory.getMetadata(),`Default`))}static getMetadata(){return{...Ie,component:w.ToggleGroup.$gtype}}initialize(){this._toggleGroup=new w.ToggleGroup,this._toggleGroup.add(new w.Toggle({label:`List`,iconName:`view-list-symbolic`})),this._toggleGroup.add(new w.Toggle({label:`Grid`,iconName:`view-grid-symbolic`})),this._toggleGroup.add(new w.Toggle({label:`Columns`,iconName:`view-columns-symbolic`})),this._toggleGroup.active=this.args.active,this._applyStyle(this.args.style),this.addContent(this._toggleGroup)}_applyStyle(e){if(this._toggleGroup){for(let e of Re)this._toggleGroup.remove_css_class(e);e!=="default"&&this._toggleGroup.add_css_class(e)}}updateArgs(e){this._toggleGroup&&(this._toggleGroup.active=this.args.active,this._applyStyle(this.args.style))}};D.type_ensure(P.$gtype);const ze={stories:[P]},Be=[`Automatic`,`Always`,`Never`,`When busy`],Ve={title:`Controls/Drop Down`,description:`Gtk.DropDown — pick one value from a list. The button shows the selection; the list opens in a popover. Adw.ComboRow is the same choice presented as a boxed-list row.`,controls:[{name:`selected`,label:`Selected`,type:i.SELECT,options:Be.map((e,t)=>({label:e,value:t})),defaultValue:0},{name:`enableSearch`,label:`Search field`,type:i.BOOLEAN,defaultValue:!1}]};var He=__exportAll({DropDownStories:()=>Ue,DropDownStory:()=>F}),F=class DropDownStory extends O{_dropDown=null;static{D.registerClass({GTypeName:`AdwStorybookDropDown`},DropDownStory)}constructor(){super(O.fromMeta(DropDownStory.getMetadata(),`Default`))}static getMetadata(){return{...Ve,component:h.DropDown.$gtype}}initialize(){this._dropDown=h.DropDown.new_from_strings([...Be]),this._dropDown.expression=h.PropertyExpression.new(h.StringObject.$gtype,null,`string`),this._dropDown.halign=h.Align.CENTER,this._apply(),this.addContent(this._dropDown)}updateArgs(e){this._apply()}_apply(){this._dropDown&&(this._dropDown.selected=this.args.selected,this._dropDown.enableSearch=this.args.enableSearch)}};D.type_ensure(F.$gtype);const Ue={stories:[F]},We={title:`Controls/Entry`,description:`Gtk.Entry — a single-line text field. Libadwaita ships no AdwEntry; the Adwaita look is the GTK entry styled by the stylesheet, which is why the row variants (Entry Row, Password Entry Row) are the widgets with an Adw prefix.`,controls:[{name:`text`,label:`Text`,type:i.TEXT,defaultValue:``},{name:`placeholder`,label:`Placeholder`,type:i.TEXT,defaultValue:`Search files…`},{name:`editable`,label:`Editable`,type:i.BOOLEAN,defaultValue:!0}]};var Ge=__exportAll({EntryStories:()=>Ke,EntryStory:()=>I}),I=class EntryStory extends O{_entry=null;static{D.registerClass({GTypeName:`AdwStorybookEntry`},EntryStory)}constructor(){super(O.fromMeta(EntryStory.getMetadata(),`Default`))}static getMetadata(){return{...We,component:h.Entry.$gtype}}initialize(){this._entry=new h.Entry({widthRequest:280,halign:h.Align.CENTER}),this._apply(),this.addContent(this._entry)}updateArgs(e){this._apply()}_apply(){this._entry&&(this._entry.text=this.args.text,this._entry.placeholderText=this.args.placeholder,this._entry.editable=this.args.editable)}};D.type_ensure(I.$gtype);const Ke={stories:[I]},qe={title:`Feedback/About Dialog`,description:`Adw.AboutDialog — the standard Adwaita about window with application name, version, credits and license.`,controls:[{name:`applicationName`,label:`Application name`,type:i.TEXT,defaultValue:`Adwaita Storybook`},{name:`version`,label:`Version`,type:i.TEXT,defaultValue:`0.11.0`}]};var Je=__exportAll({AboutDialogStories:()=>Ye,AboutDialogStory:()=>L}),L=class AboutDialogStory extends O{_button=null;static{D.registerClass({GTypeName:`AdwStorybookAboutDialog`},AboutDialogStory)}constructor(){super(O.fromMeta(AboutDialogStory.getMetadata(),`Default`))}static getMetadata(){return{...qe,component:w.AboutDialog.$gtype}}initialize(){this._button=new h.Button({label:`Show dialog`,halign:h.Align.CENTER,valign:h.Align.CENTER}),this._button.add_css_class(`pill`),this._button.add_css_class(`suggested-action`),this._button.connect(`clicked`,()=>this._present()),this.addContent(this._button)}_present(){new w.AboutDialog({applicationName:this.args.applicationName,applicationIcon:`application-x-executable-symbolic`,developerName:`A GJSify Project`,version:this.args.version,comments:`A live catalogue of native GTK and Adwaita widgets, rendered under GJS.`,website:`https://github.com/gjsify/gjsify`,issueUrl:`https://github.com/gjsify/gjsify/issues`,licenseType:h.License.MIT_X11,developers:[`Ada Lovelace`,`Grace Hopper`],designers:[`Margaret Hamilton`],copyright:`© 2026 The GJSify Project`}).present(this)}updateArgs(e){}};D.type_ensure(L.$gtype);const Ye={stories:[L]},Xe={title:`Feedback/Alert Dialog`,description:`Adw.AlertDialog — a modal dialog with a heading, body text and responses, including a destructive action.`,controls:[{name:`heading`,label:`Heading`,type:i.TEXT,defaultValue:`Delete Project?`},{name:`body`,label:`Body`,type:i.TEXT,defaultValue:`This will permanently remove the project and all of its files. This action cannot be undone.`}]};var Ze=__exportAll({AlertDialogStories:()=>Qe,AlertDialogStory:()=>R}),R=class AlertDialogStory extends O{_button=null;static{D.registerClass({GTypeName:`AdwStorybookAlertDialog`},AlertDialogStory)}constructor(){super(O.fromMeta(AlertDialogStory.getMetadata(),`Default`))}static getMetadata(){return{...Xe,component:w.AlertDialog.$gtype}}initialize(){this._button=new h.Button({label:`Show dialog`,halign:h.Align.CENTER,valign:h.Align.CENTER}),this._button.add_css_class(`pill`),this._button.add_css_class(`suggested-action`),this._button.connect(`clicked`,()=>this._present()),this.addContent(this._button)}_present(){let e=new w.AlertDialog({heading:this.args.heading,body:this.args.body});e.add_response(`cancel`,`Cancel`),e.add_response(`delete`,`Delete`),e.set_response_appearance(`delete`,w.ResponseAppearance.DESTRUCTIVE),e.set_default_response(`cancel`),e.set_close_response(`cancel`),e.present(this)}updateArgs(e){}};D.type_ensure(R.$gtype);const Qe={stories:[R]},$e={title:`Feedback/Preferences Dialog`,description:`Adw.PreferencesDialog — a preferences window with a page, a group and a handful of boxed-list rows.`,controls:[{name:`pageTitle`,label:`Page title`,type:i.TEXT,defaultValue:`General`},{name:`groupTitle`,label:`Group title`,type:i.TEXT,defaultValue:`Appearance`}]};var et=__exportAll({PreferencesDialogStories:()=>tt,PreferencesDialogStory:()=>z}),z=class PreferencesDialogStory extends O{_button=null;static{D.registerClass({GTypeName:`AdwStorybookPreferencesDialog`},PreferencesDialogStory)}constructor(){super(O.fromMeta(PreferencesDialogStory.getMetadata(),`Default`))}static getMetadata(){return{...$e,component:w.PreferencesDialog.$gtype}}initialize(){this._button=new h.Button({label:`Show dialog`,halign:h.Align.CENTER,valign:h.Align.CENTER}),this._button.add_css_class(`pill`),this._button.add_css_class(`suggested-action`),this._button.connect(`clicked`,()=>this._present()),this.addContent(this._button)}_present(){let e=new w.PreferencesDialog,t=new w.PreferencesPage({title:this.args.pageTitle,iconName:`preferences-system-symbolic`}),n=new w.PreferencesGroup({title:this.args.groupTitle,description:`Control how the application looks and behaves.`});n.add(new w.SwitchRow({title:`Dark style`,subtitle:`Use a dark colour scheme`,active:!0})),n.add(new w.ComboRow({title:`Accent colour`,model:new h.StringList({strings:[`Blue`,`Teal`,`Green`,`Orange`,`Purple`]}),selected:0})),n.add(new w.SpinRow({title:`Font size`,adjustment:new h.Adjustment({lower:8,upper:24,value:12,stepIncrement:1,pageIncrement:4})})),t.add(n),e.add(t),e.present(this)}updateArgs(e){}};D.type_ensure(z.$gtype);const tt={stories:[z]},nt={title:`Feedback/Toast`,description:`Adw.Toast — a transient notification, with an optional action button, shown over an Adw.ToastOverlay.`,controls:[{name:`title`,label:`Toast text`,type:i.TEXT,defaultValue:`File moved to Trash`},{name:`timeout`,label:`Timeout (s)`,type:i.NUMBER,min:0,max:10,step:1,defaultValue:3},{name:`hasButton`,label:`Action button`,type:i.BOOLEAN,defaultValue:!0},{name:`buttonLabel`,label:`Button label`,type:i.TEXT,defaultValue:`Undo`}]};var rt=__exportAll({ToastStories:()=>it,ToastStory:()=>B}),B=class ToastStory extends O{_overlay=null;static{D.registerClass({GTypeName:`AdwStorybookToast`},ToastStory)}constructor(){super(O.fromMeta(ToastStory.getMetadata(),`Default`))}static getMetadata(){return{...nt,component:w.Toast.$gtype}}initialize(){let e=new h.Button({label:`Show toast`,halign:h.Align.CENTER,valign:h.Align.CENTER});e.add_css_class(`pill`),e.add_css_class(`suggested-action`),e.connect(`clicked`,()=>this._showToast()),this._overlay=new w.ToastOverlay({child:e,widthRequest:360,heightRequest:220}),this.addContent(this._overlay)}_showToast(){if(!this._overlay)return;let e=new w.Toast({title:this.args.title,timeout:this.args.timeout});this.args.hasButton&&(e.buttonLabel=this.args.buttonLabel),this._overlay.add_toast(e)}updateArgs(e){}};D.type_ensure(B.$gtype);const it={stories:[B]},at={title:`Layout/Clamp`,description:`Adw.Clamp limits its child to a maximum width and centres it, tightening the layout as space shrinks.`,controls:[{name:`maximumSize`,label:`Maximum size`,type:i.RANGE,min:200,max:600,step:10,defaultValue:400},{name:`tighteningThreshold`,label:`Tightening threshold`,type:i.RANGE,min:100,max:600,step:10,defaultValue:300}]};var ot=__exportAll({ClampStories:()=>st,ClampStory:()=>V}),V=class ClampStory extends O{_clamp=null;static{D.registerClass({GTypeName:`AdwStorybookClamp`},ClampStory)}constructor(){super(O.fromMeta(ClampStory.getMetadata(),`Default`))}static getMetadata(){return{...at,component:w.Clamp.$gtype}}initialize(){let e=new h.Box({orientation:h.Orientation.HORIZONTAL,widthRequest:520});e.add_css_class(`card`);let t=new h.Label({label:`This content is clamped — it stops growing past the maximum size and stays centred.`,wrap:!0,xalign:0,hexpand:!0,marginTop:18,marginBottom:18,marginStart:18,marginEnd:18});e.append(t),this._clamp=new w.Clamp({maximumSize:this.args.maximumSize,tighteningThreshold:this.args.tighteningThreshold,child:e}),this.addContent(this._clamp)}updateArgs(e){this._clamp&&(this._clamp.maximumSize=this.args.maximumSize,this._clamp.tighteningThreshold=this.args.tighteningThreshold)}};D.type_ensure(V.$gtype);const st={stories:[V]},ct={title:`Layout/Header Bar`,description:`Adw.HeaderBar hosts a custom title widget with start and end controls — the standard top chrome of an Adwaita window.`,controls:[{name:`title`,label:`Title`,type:i.TEXT,defaultValue:`Text Editor`},{name:`subtitle`,label:`Subtitle`,type:i.TEXT,defaultValue:`notes.md`},{name:`showTitle`,label:`Show title`,type:i.BOOLEAN,defaultValue:!0}]};var lt=__exportAll({HeaderBarStories:()=>ut,HeaderBarStory:()=>H}),H=class HeaderBarStory extends O{_headerBar=null;_title=null;static{D.registerClass({GTypeName:`AdwStorybookHeaderBar`},HeaderBarStory)}constructor(){super(O.fromMeta(HeaderBarStory.getMetadata(),`Default`))}static getMetadata(){return{...ct,component:w.HeaderBar.$gtype}}initialize(){this._title=new w.WindowTitle({title:this.args.title,subtitle:this.args.subtitle}),this._headerBar=new w.HeaderBar({titleWidget:this._title,showTitle:this.args.showTitle,widthRequest:460});let e=new h.Button({iconName:`go-previous-symbolic`});e.add_css_class(`flat`),this._headerBar.pack_start(e);let t=new x.Menu;t.append(`New Window`,`app.new-window`),t.append(`Preferences`,`app.preferences`),t.append(`About`,`app.about`);let n=new h.MenuButton({iconName:`open-menu-symbolic`,menuModel:t});n.add_css_class(`flat`),this._headerBar.pack_end(n),this.addContent(this._headerBar)}updateArgs(e){!this._headerBar||!this._title||(this._title.title=this.args.title,this._title.subtitle=this.args.subtitle,this._headerBar.showTitle=this.args.showTitle)}};D.type_ensure(H.$gtype);const ut={stories:[H]},dt={title:`Layout/Toolbar View`,description:`Adw.ToolbarView pins a top header bar and a bottom toolbar around its content, each independently revealable.`,controls:[{name:`revealTopBars`,label:`Reveal top bars`,type:i.BOOLEAN,defaultValue:!0},{name:`revealBottomBars`,label:`Reveal bottom bars`,type:i.BOOLEAN,defaultValue:!0}]};var ft=__exportAll({ToolbarViewStories:()=>pt,ToolbarViewStory:()=>U}),U=class ToolbarViewStory extends O{_view=null;static{D.registerClass({GTypeName:`AdwStorybookToolbarView`},ToolbarViewStory)}constructor(){super(O.fromMeta(ToolbarViewStory.getMetadata(),`Default`))}static getMetadata(){return{...dt,component:w.ToolbarView.$gtype}}initialize(){this._view=new w.ToolbarView({widthRequest:460,heightRequest:320,revealTopBars:this.args.revealTopBars,revealBottomBars:this.args.revealBottomBars});let e=new w.HeaderBar({titleWidget:new w.WindowTitle({title:`Documents`,subtitle:`12 items`})});this._view.add_top_bar(e);let t=new w.StatusPage({iconName:`folder-documents-symbolic`,title:`Your library`,description:`Content sits between the toolbars and scrolls independently of them.`});this._view.content=t;let n=new h.ActionBar,r=new h.Button({iconName:`list-add-symbolic`});r.add_css_class(`flat`);let i=new h.Button({iconName:`list-remove-symbolic`});i.add_css_class(`flat`),n.pack_start(r),n.pack_start(i),n.set_center_widget(new h.Label({label:`Selection: none`}));let a=new h.Button({iconName:`send-to-symbolic`});a.add_css_class(`flat`),n.pack_end(a),this._view.add_bottom_bar(n),this.addContent(this._view)}updateArgs(e){this._view&&(this._view.revealTopBars=this.args.revealTopBars,this._view.revealBottomBars=this.args.revealBottomBars)}};D.type_ensure(U.$gtype);const pt={stories:[U]},mt={title:`Layout/Wrap Box`,description:`Adw.WrapBox flows its children horizontally and wraps them onto new lines when they run out of room.`,controls:[{name:`childSpacing`,label:`Child spacing`,type:i.RANGE,min:0,max:36,step:1,defaultValue:8},{name:`lineSpacing`,label:`Line spacing`,type:i.RANGE,min:0,max:36,step:1,defaultValue:8}]};var ht=__exportAll({WrapBoxStories:()=>gt,WrapBoxStory:()=>W}),W=class WrapBoxStory extends O{_wrap=null;static{D.registerClass({GTypeName:`AdwStorybookWrapBox`},WrapBoxStory)}constructor(){super(O.fromMeta(WrapBoxStory.getMetadata(),`Default`))}static getMetadata(){return{...mt,component:w.WrapBox.$gtype}}initialize(){this._wrap=new w.WrapBox({childSpacing:this.args.childSpacing,lineSpacing:this.args.lineSpacing,widthRequest:460});for(let e of[`Design`,`Adwaita`,`GNOME`,`GTK`,`Typescript`,`Storybook`,`Wrapping`,`Layout`]){let t=new h.Button({label:e});t.add_css_class(`pill`),this._wrap.append(t)}this.addContent(this._wrap)}updateArgs(e){this._wrap&&(this._wrap.childSpacing=this.args.childSpacing,this._wrap.lineSpacing=this.args.lineSpacing)}};D.type_ensure(W.$gtype);const gt={stories:[W]},_t={title:`Navigation/Bottom Sheet`,description:`Adw.BottomSheet — a sheet that slides up over the content. Toggle "Open" to reveal it.`,controls:[{name:`open`,label:`Open`,type:i.BOOLEAN,defaultValue:!0},{name:`modal`,label:`Modal`,type:i.BOOLEAN,defaultValue:!0},{name:`canClose`,label:`Can close`,type:i.BOOLEAN,defaultValue:!0}]};var vt=__exportAll({BottomSheetStories:()=>yt,BottomSheetStory:()=>G}),G=class BottomSheetStory extends O{_sheet=null;static{D.registerClass({GTypeName:`AdwStorybookBottomSheet`},BottomSheetStory)}constructor(){super(O.fromMeta(BottomSheetStory.getMetadata(),`Default`))}static getMetadata(){return{..._t,component:w.BottomSheet.$gtype}}buildContent(){let e=new h.Button({label:`Toggle sheet`,halign:h.Align.CENTER,valign:h.Align.CENTER,vexpand:!0});return e.add_css_class(`pill`),e.add_css_class(`suggested-action`),e.connect(`clicked`,()=>{this._sheet&&(this._sheet.open=!this._sheet.open)}),e}buildSheet(){let e=new h.Box({orientation:h.Orientation.VERTICAL,spacing:12,marginTop:18,marginBottom:24,marginStart:18,marginEnd:18});e.append(new h.Label({label:`Share track`,halign:h.Align.START,cssClasses:[`title-2`]}));let t=new w.PreferencesGroup;for(let[e,n]of[[`Copy link`,`edit-copy-symbolic`],[`Send to a friend`,`mail-send-symbolic`],[`Add to playlist`,`list-add-symbolic`]]){let r=new w.ActionRow({title:e});r.add_prefix(new h.Image({iconName:n})),r.activatable=!0,t.add(r)}return e.append(t),e}initialize(){this._sheet=new w.BottomSheet({content:this.buildContent(),sheet:this.buildSheet(),open:this.args.open,modal:this.args.modal,canClose:this.args.canClose,widthRequest:480,heightRequest:340}),this.addContent(this._sheet)}updateArgs(e){this._sheet&&(this._sheet.open=this.args.open,this._sheet.modal=this.args.modal,this._sheet.canClose=this.args.canClose)}};D.type_ensure(G.$gtype);const yt={stories:[G]},bt={title:`Navigation/Navigation Split View`,description:`Adw.NavigationSplitView — a resizable sidebar beside a content pane. When collapsed it folds into a navigation stack.`,controls:[{name:`showContent`,label:`Show content`,type:i.BOOLEAN,defaultValue:!0},{name:`collapsed`,label:`Collapsed`,type:i.BOOLEAN,defaultValue:!1}]};var xt=__exportAll({NavigationSplitViewStories:()=>St,NavigationSplitViewStory:()=>K}),K=class NavigationSplitViewStory extends O{_view=null;static{D.registerClass({GTypeName:`AdwStorybookNavigationSplitView`},NavigationSplitViewStory)}constructor(){super(O.fromMeta(NavigationSplitViewStory.getMetadata(),`Default`))}static getMetadata(){return{...bt,component:w.NavigationSplitView.$gtype}}buildSidebar(){let e=new w.PreferencesGroup;for(let[t,n,r]of[[`All Mail`,`128 messages`,`mail-unread-symbolic`],[`Starred`,`6 messages`,`starred-symbolic`],[`Drafts`,`2 messages`,`document-edit-symbolic`],[`Archive`,`512 messages`,`folder-symbolic`]]){let i=new w.ActionRow({title:t,subtitle:n});i.add_prefix(new h.Image({iconName:r})),i.activatable=!0,e.add(i)}let t=new w.ToolbarView;return t.add_top_bar(new w.HeaderBar),t.content=e,new w.NavigationPage({title:`Mailboxes`,child:t})}buildContent(){let e=new w.StatusPage({iconName:`mail-unread-symbolic`,title:`All Mail`,description:`Select a conversation from the list to read it here.`,vexpand:!0}),t=new w.ToolbarView;return t.add_top_bar(new w.HeaderBar),t.content=e,new w.NavigationPage({title:`All Mail`,child:t})}initialize(){this._view=new w.NavigationSplitView({sidebar:this.buildSidebar(),content:this.buildContent(),showContent:this.args.showContent,collapsed:this.args.collapsed,widthRequest:480,heightRequest:340}),this.addContent(this._view)}updateArgs(e){this._view&&(this._view.showContent=this.args.showContent,this._view.collapsed=this.args.collapsed)}};D.type_ensure(K.$gtype);const St={stories:[K]},Ct={title:`Navigation/Navigation View`,description:`Adw.NavigationView — a navigation stack. The root page pushes a detail page, which gets an automatic back button.`,controls:[{name:`rootTitle`,label:`Root title`,type:i.TEXT,defaultValue:`Contacts`},{name:`detailTitle`,label:`Detail title`,type:i.TEXT,defaultValue:`Ada Lovelace`},{name:`animateTransitions`,label:`Animate transitions`,type:i.BOOLEAN,defaultValue:!0}]};var wt=__exportAll({NavigationViewStories:()=>Tt,NavigationViewStory:()=>q}),q=class NavigationViewStory extends O{_view=null;static{D.registerClass({GTypeName:`AdwStorybookNavigationView`},NavigationViewStory)}constructor(){super(O.fromMeta(NavigationViewStory.getMetadata(),`Default`))}static getMetadata(){return{...Ct,component:w.NavigationView.$gtype}}buildPage(e,t){let n=new w.ToolbarView;return n.add_top_bar(new w.HeaderBar),n.content=t,new w.NavigationPage({title:e,child:n})}initialize(){this._view=new w.NavigationView({animateTransitions:this.args.animateTransitions,widthRequest:480,heightRequest:340});let e=this.buildPage(this.args.detailTitle,new w.StatusPage({iconName:`avatar-default-symbolic`,title:this.args.detailTitle,description:`Mathematician and writer, the first computer programmer.`,vexpand:!0})),t=new h.Button({label:`Open contact`,halign:h.Align.CENTER,valign:h.Align.CENTER,vexpand:!0});t.add_css_class(`pill`),t.add_css_class(`suggested-action`),t.connect(`clicked`,()=>{this._view?.push(e)});let n=this.buildPage(this.args.rootTitle,t);this._view.add(n),this._view.add(e),this.addContent(this._view)}updateArgs(e){this._view&&(this._view.animateTransitions=this.args.animateTransitions)}};D.type_ensure(q.$gtype);const Tt={stories:[q]},Et={title:`Navigation/Overlay Split View`,description:`Adw.OverlaySplitView — a sidebar shown beside the content, or overlaid on top of it when collapsed.`,controls:[{name:`showSidebar`,label:`Show sidebar`,type:i.BOOLEAN,defaultValue:!0},{name:`collapsed`,label:`Collapsed`,type:i.BOOLEAN,defaultValue:!1}]};var Dt=__exportAll({OverlaySplitViewStories:()=>Ot,OverlaySplitViewStory:()=>J}),J=class OverlaySplitViewStory extends O{_view=null;static{D.registerClass({GTypeName:`AdwStorybookOverlaySplitView`},OverlaySplitViewStory)}constructor(){super(O.fromMeta(OverlaySplitViewStory.getMetadata(),`Default`))}static getMetadata(){return{...Et,component:w.OverlaySplitView.$gtype}}buildSidebar(){let e=new w.PreferencesGroup;for(let[t,n]of[[`Home`,`go-home-symbolic`],[`Discover`,`system-search-symbolic`],[`Library`,`folder-music-symbolic`],[`Settings`,`emblem-system-symbolic`]]){let r=new w.ActionRow({title:t});r.add_prefix(new h.Image({iconName:n})),r.activatable=!0,e.add(r)}let t=new w.ToolbarView;return t.add_top_bar(new w.HeaderBar({showTitle:!1})),t.content=e,t.add_css_class(`sidebar`),t}buildContent(){let e=new w.StatusPage({iconName:`folder-music-symbolic`,title:`Your Library`,description:`Toggle the sidebar to browse sections. Collapse it to overlay the content.`,vexpand:!0}),t=new w.ToolbarView;return t.add_top_bar(new w.HeaderBar),t.content=e,t}initialize(){this._view=new w.OverlaySplitView({sidebar:this.buildSidebar(),content:this.buildContent(),showSidebar:this.args.showSidebar,collapsed:this.args.collapsed,widthRequest:480,heightRequest:340}),this.addContent(this._view)}updateArgs(e){this._view&&(this._view.showSidebar=this.args.showSidebar,this._view.collapsed=this.args.collapsed)}};D.type_ensure(J.$gtype);const Ot={stories:[J]},kt={title:`Navigation/Sidebar`,description:`Adw.Sidebar — a selectable list of Adw.SidebarItem grouped into sections. Selecting an item updates the content.`,controls:[{name:`mode`,label:`Mode`,type:i.SELECT,options:[{label:`Sidebar`,value:`sidebar`},{label:`Page`,value:`page`}],defaultValue:`sidebar`},{name:`selected`,label:`Selected index`,type:i.NUMBER,min:0,max:3,step:1,defaultValue:0}]};var At=__exportAll({SidebarStories:()=>jt,SidebarStory:()=>Y}),Y=class SidebarStory extends O{_sidebar=null;_status=null;static{D.registerClass({GTypeName:`AdwStorybookSidebar`},SidebarStory)}constructor(){super(O.fromMeta(SidebarStory.getMetadata(),`Default`))}static getMetadata(){return{...kt,component:w.Sidebar.$gtype}}items=[{title:`Inbox`,subtitle:`3 unread`,icon:`mail-unread-symbolic`},{title:`Starred`,subtitle:`Favourites`,icon:`starred-symbolic`},{title:`Sent`,subtitle:`Outgoing mail`,icon:`mail-send-symbolic`},{title:`Archive`,subtitle:`Older mail`,icon:`folder-symbolic`}];modeFromArg(e){return e===`page`?w.SidebarMode.PAGE:w.SidebarMode.SIDEBAR}syncContent(){if(!this._sidebar||!this._status)return;let e=this.items[this._sidebar.selected]??this.items[0];this._status.title=e.title,this._status.iconName=e.icon,this._status.description=e.subtitle}initialize(){let e=new w.SidebarSection({title:`Mailboxes`});for(let t of this.items)e.append(new w.SidebarItem({title:t.title,subtitle:t.subtitle,iconName:t.icon}));this._sidebar=new w.Sidebar({mode:this.modeFromArg(this.args.mode),selected:this.args.selected,widthRequest:220}),this._sidebar.append(e),this._sidebar.connect(`notify::selected`,()=>this.syncContent()),this._status=new w.StatusPage({hexpand:!0,vexpand:!0});let t=new h.Box({orientation:h.Orientation.HORIZONTAL,widthRequest:480,heightRequest:340});t.append(this._sidebar),t.append(new h.Separator({orientation:h.Orientation.VERTICAL})),t.append(this._status),this.syncContent(),this.addContent(t)}updateArgs(e){this._sidebar&&(this._sidebar.mode=this.modeFromArg(this.args.mode),this._sidebar.selected=this.args.selected,this.syncContent())}};D.type_ensure(Y.$gtype);const jt={stories:[Y]},Mt=[{title:`Sync`,kind:`switch`,active:!0},{title:`Export`,kind:`action`}],Nt=[`Blue`,`Teal`,`Green`,`Orange`],X={appearance:`Appearance`,account:`Account`,shortcuts:`Shortcuts`,actions:`Actions`},Z={bannerTitle:`You have unsaved changes`,bannerButton:`Save`,darkMode:`Dark mode`,darkModeSubtitle:`Use the dark Adwaita palette`,notifications:`Notifications`,notificationsSubtitle:`Show toasts for events`,accentColor:`Accent color`,name:`Name`,nameValue:`Ada Lovelace`,email:`Email`,emailValue:`ada@example.com`,devices:`Devices`,advanced:`Advanced`,advancedSubtitle:`More options`,save:`Save changes`,delete:`Delete account`},Q={value:3,lower:1,upper:10,step:1},Pt=[{title:`Copy`,accelerator:`<Control>C`},{title:`Select all`,accelerator:`<Shift><Control>a`},{title:`Switch tab`,accelerator:`<Alt>1...9`}],Ft={title:`Overview/Widgets`,description:`Many widgets at once, the way an app composes them: a banner, preference groups of rows, an expander, buttons and shortcut labels. Use it to judge spacing, alignment and the theme as a whole rather than one widget in isolation.`,controls:[{name:`revealed`,label:`Show banner`,type:i.BOOLEAN,description:`Adw.Banner:revealed — animates in and out`,defaultValue:!0}]};var It=__exportAll({OverviewWidgetsStories:()=>Rt,OverviewWidgetsStory:()=>Lt}),Lt=class OverviewWidgetsStory extends O{_banner=null;static{D.registerClass({GTypeName:`AdwStorybookOverviewWidgets`},OverviewWidgetsStory)}constructor(){super(O.fromMeta(OverviewWidgetsStory.getMetadata(),`Default`))}static getMetadata(){return Ft}initialize(){let e=new h.Box({orientation:h.Orientation.VERTICAL,hexpand:!0});this._banner=new w.Banner({title:Z.bannerTitle,button_label:Z.bannerButton,revealed:this.args.revealed}),e.append(this._banner);let t=new w.PreferencesPage({hexpand:!0}),n=new w.PreferencesGroup({title:X.appearance});n.add(new w.SwitchRow({title:Z.darkMode,subtitle:Z.darkModeSubtitle,active:!1})),n.add(new w.SwitchRow({title:Z.notifications,subtitle:Z.notificationsSubtitle,active:!0})),n.add(new w.ComboRow({title:Z.accentColor,model:h.StringList.new([...Nt]),selected:0})),t.add(n);let r=new w.PreferencesGroup({title:X.account}),i=new w.EntryRow({title:Z.name});i.set_text(Z.nameValue),r.add(i);let a=new w.EntryRow({title:Z.email});a.set_text(Z.emailValue),r.add(a);let o=new w.SpinRow({title:Z.devices,adjustment:new h.Adjustment({value:Q.value,lower:Q.lower,upper:Q.upper,step_increment:Q.step,page_increment:Q.step})});o.set_value(Q.value),r.add(o);let s=new w.ExpanderRow({title:Z.advanced,subtitle:Z.advancedSubtitle,expanded:!0});for(let e of Mt)s.add_row(e.kind===`switch`?new w.SwitchRow({title:e.title,active:e.active??!1}):new w.ActionRow({title:e.title}));r.add(s),t.add(r);let c=new w.PreferencesGroup({title:X.shortcuts});for(let e of Pt){let t=new w.ActionRow({title:e.title});t.add_suffix(new w.ShortcutLabel({accelerator:e.accelerator,valign:h.Align.CENTER})),c.add(t)}t.add(c);let l=new w.PreferencesGroup({title:X.actions}),u=new h.Box({orientation:h.Orientation.HORIZONTAL,spacing:12,homogeneous:!0,margin_top:6,margin_bottom:6}),d=new h.Button({label:Z.save});d.add_css_class(`suggested-action`),u.append(d);let f=new h.Button({label:Z.delete});f.add_css_class(`destructive-action`),u.append(f),l.add(u),t.add(l),e.append(t),this.addContent(e)}updateArgs(e){this._banner?.set_revealed(this.args.revealed)}};D.type_ensure(Lt.$gtype);const Rt={stories:[Lt]},zt={title:`Presentation/Avatar`,description:`A circular avatar that derives initials (and a colour) from a name, or shows a symbolic icon.`,controls:[{name:`text`,label:`Name`,type:i.TEXT,defaultValue:`Ada Lovelace`},{name:`size`,label:`Size`,type:i.RANGE,min:24,max:160,step:8,defaultValue:96},{name:`showInitials`,label:`Show initials`,type:i.BOOLEAN,defaultValue:!0},{name:`iconName`,label:`Fallback icon`,type:i.SELECT,options:[{label:`Person`,value:`avatar-default-symbolic`},{label:`Contact`,value:`contact-new-symbolic`},{label:`Camera`,value:`camera-photo-symbolic`}],defaultValue:`avatar-default-symbolic`}]};var Bt=__exportAll({AvatarStories:()=>Ht,AvatarStory:()=>Vt}),Vt=class AvatarStory extends O{_avatar=null;static{D.registerClass({GTypeName:`AdwStorybookAvatar`},AvatarStory)}constructor(){super(O.fromMeta(AvatarStory.getMetadata(),`Default`))}static getMetadata(){return{...zt,component:w.Avatar.$gtype}}initialize(){this._avatar=new w.Avatar({size:this.args.size,text:this.args.text,showInitials:this.args.showInitials,iconName:this.args.iconName}),this.addContent(this._avatar)}updateArgs(e){this._avatar&&(this._avatar.size=this.args.size,this._avatar.text=this.args.text,this._avatar.showInitials=this.args.showInitials,this._avatar.iconName=this.args.iconName)}};D.type_ensure(Vt.$gtype);const Ht={stories:[Vt]},Ut={title:`Presentation/Banner`,description:`Adw.Banner — a full-width strip carrying a status message and an optional action button.`,controls:[{name:`title`,label:`Title`,type:i.TEXT,defaultValue:`Metered connection — updates paused`},{name:`buttonLabel`,label:`Button label`,type:i.TEXT,defaultValue:`Resume`},{name:`revealed`,label:`Revealed`,type:i.BOOLEAN,defaultValue:!0},{name:`useMarkup`,label:`Use markup`,type:i.BOOLEAN,defaultValue:!1}]};var Wt=__exportAll({BannerStories:()=>Kt,BannerStory:()=>Gt}),Gt=class BannerStory extends O{_banner=null;static{D.registerClass({GTypeName:`AdwStorybookBanner`},BannerStory)}constructor(){super(O.fromMeta(BannerStory.getMetadata(),`Default`))}static getMetadata(){return{...Ut,component:w.Banner.$gtype}}initialize(){this._banner=new w.Banner({title:this.args.title,buttonLabel:this.args.buttonLabel,revealed:this.args.revealed,useMarkup:this.args.useMarkup});let e=new h.Box({orientation:h.Orientation.VERTICAL,widthRequest:460});e.append(this._banner),this.addContent(e)}updateArgs(e){this._banner&&(this._banner.title=this.args.title,this._banner.buttonLabel=this.args.buttonLabel,this._banner.revealed=this.args.revealed,this._banner.useMarkup=this.args.useMarkup)}};D.type_ensure(Gt.$gtype);const Kt={stories:[Gt]},qt=[{label:`Single`,accelerator:`<Control>C`},{label:`Modifier order`,accelerator:`<Shift><Control>a`},{label:`Alternatives`,accelerator:`<Shift>A Home`},{label:`Range`,accelerator:`<Alt>1...9`},{label:`In sequence`,accelerator:`<Control>C+<Control>X`},{label:`Together`,accelerator:`Control_L&Control_R`},{label:`Nested`,accelerator:`<Alt>1...9 <Alt>0`},{label:`Unset`,accelerator:``}],Jt={title:`Presentation/Shortcut Label`,description:`Adw.ShortcutLabel — an accelerator drawn as keycaps. The four grammar levels: alternatives (space), a range (...), pressed in sequence (+), and pressed together (&).`,controls:[{name:`accelerator`,label:`Accelerator`,type:i.SELECT,options:[{label:`Ctrl+C`,value:`<Control>C`},{label:`Modifier order (Shift+Ctrl+A)`,value:`<Shift><Control>a`},{label:`Alternatives (Shift+A / Home)`,value:`<Shift>A Home`},{label:`Range (Alt+1…9)`,value:`<Alt>1...9`},{label:`In sequence (Ctrl+C → Ctrl+X)`,value:`<Control>C+<Control>X`},{label:`Together (Ctrl L + Ctrl R)`,value:`Control_L&Control_R`},{label:`Nested (Alt+1…9 / Alt+0)`,value:`<Alt>1...9 <Alt>0`},{label:`Glyph key (Ctrl+Space)`,value:`<Control>space`},{label:`Arrow key (Left)`,value:`Left`},{label:`Unset — shows the placeholder`,value:``}],defaultValue:`<Control>C`},{name:`disabledText`,label:`Placeholder`,type:i.TEXT,defaultValue:`Disabled`}]},Yt={title:`Presentation/Shortcut Label (All Levels)`,description:`Every Adw.ShortcutLabel grammar level at once: alternatives (space), a range (...), pressed in sequence (+), pressed together (&) — plus GTK's fixed keycap order and the disabled placeholder.`,controls:[{name:`disabledText`,label:`Placeholder`,type:i.TEXT,defaultValue:`Disabled`}]};var Xt=__exportAll({ShortcutLabelLevelsStory:()=>Qt,ShortcutLabelStories:()=>$t,ShortcutLabelStory:()=>Zt}),Zt=class ShortcutLabelStory extends O{_widget=null;static{D.registerClass({GTypeName:`AdwStorybookShortcutLabel`},ShortcutLabelStory)}constructor(){super(O.fromMeta(ShortcutLabelStory.getMetadata(),`Default`))}static getMetadata(){return{...Jt,component:w.ShortcutLabel.$gtype}}initialize(){this._widget=new w.ShortcutLabel({accelerator:this.args.accelerator,disabledText:this.args.disabledText,halign:h.Align.CENTER,valign:h.Align.CENTER}),this.addContent(this._widget)}updateArgs(e){this._widget&&(this._widget.disabledText=this.args.disabledText,this._widget.accelerator=this.args.accelerator)}};D.type_ensure(Zt.$gtype);var Qt=class ShortcutLabelLevelsStory extends O{_widgets=[];static{D.registerClass({GTypeName:`AdwStorybookShortcutLabelLevels`},ShortcutLabelLevelsStory)}constructor(){super(O.fromMeta(ShortcutLabelLevelsStory.getMetadata(),`Default`))}static getMetadata(){return{...Yt,component:w.ShortcutLabel.$gtype}}initialize(){let e=new h.Grid({row_spacing:12,column_spacing:24});for(let[t,n]of qt.entries()){let r=new h.Label({label:n.label,halign:h.Align.START});r.add_css_class(`dimmed`),e.attach(r,0,t,1,1);let i=new w.ShortcutLabel({accelerator:n.accelerator,disabledText:this.args.disabledText,halign:h.Align.END,hexpand:!0});e.attach(i,1,t,1,1),this._widgets.push(i)}this.addContent(e)}updateArgs(e){for(let e of this._widgets)e.disabledText=this.args.disabledText}};D.type_ensure(Qt.$gtype);const $t={stories:[Zt,Qt]},en={title:`Presentation/Spinner`,description:`Adw.Spinner — a lightweight loading indicator that spins continuously while visible.`,controls:[{name:`size`,label:`Size`,type:i.RANGE,min:16,max:64,step:4,defaultValue:48}]};var tn=__exportAll({SpinnerStories:()=>rn,SpinnerStory:()=>nn}),nn=class SpinnerStory extends O{_spinner=null;static{D.registerClass({GTypeName:`AdwStorybookSpinner`},SpinnerStory)}constructor(){super(O.fromMeta(SpinnerStory.getMetadata(),`Default`))}static getMetadata(){return{...en,component:w.Spinner.$gtype}}initialize(){let e=this.args.size;this._spinner=new w.Spinner({widthRequest:e,heightRequest:e,halign:h.Align.CENTER,valign:h.Align.CENTER}),this.addContent(this._spinner)}updateArgs(e){if(!this._spinner)return;let t=this.args.size;this._spinner.widthRequest=t,this._spinner.heightRequest=t}};D.type_ensure(nn.$gtype);const rn={stories:[nn]},an={title:`Presentation/Status Page`,description:`Adw.StatusPage — a full-page empty state with an icon, title, description and optional action.`,controls:[{name:`iconName`,label:`Icon`,type:i.SELECT,options:[{label:`Folder`,value:`folder-symbolic`},{label:`Mail`,value:`mail-unread-symbolic`},{label:`Search`,value:`system-search-symbolic`},{label:`Star`,value:`starred-symbolic`}],defaultValue:`folder-symbolic`},{name:`title`,label:`Title`,type:i.TEXT,defaultValue:`No Documents`},{name:`description`,label:`Description`,type:i.TEXT,defaultValue:`Documents you create or open will appear here.`}]};var on=__exportAll({StatusPageStories:()=>cn,StatusPageStory:()=>sn}),sn=class StatusPageStory extends O{_statusPage=null;static{D.registerClass({GTypeName:`AdwStorybookStatusPage`},StatusPageStory)}constructor(){super(O.fromMeta(StatusPageStory.getMetadata(),`Default`))}static getMetadata(){return{...an,component:w.StatusPage.$gtype}}initialize(){let e=new h.Button({label:`New Document`,halign:h.Align.CENTER,cssClasses:[`pill`,`suggested-action`]});this._statusPage=new w.StatusPage({iconName:this.args.iconName,title:this.args.title,description:this.args.description,child:e,widthRequest:460,heightRequest:320}),this.addContent(this._statusPage)}updateArgs(e){this._statusPage&&(this._statusPage.iconName=this.args.iconName,this._statusPage.title=this.args.title,this._statusPage.description=this.args.description)}};D.type_ensure(sn.$gtype);const cn={stories:[sn]},ln={title:`Presentation/Window Title`,description:`Adw.WindowTitle — a compact title/subtitle widget intended for a window or header bar.`,controls:[{name:`title`,label:`Title`,type:i.TEXT,defaultValue:`Inbox`},{name:`subtitle`,label:`Subtitle`,type:i.TEXT,defaultValue:`3 unread messages`}]};var un=__exportAll({WindowTitleStories:()=>fn,WindowTitleStory:()=>dn}),dn=class WindowTitleStory extends O{_windowTitle=null;static{D.registerClass({GTypeName:`AdwStorybookWindowTitle`},WindowTitleStory)}constructor(){super(O.fromMeta(WindowTitleStory.getMetadata(),`Default`))}static getMetadata(){return{...ln,component:w.WindowTitle.$gtype}}initialize(){this._windowTitle=new w.WindowTitle({title:this.args.title,subtitle:this.args.subtitle}),this.addContent(this._windowTitle)}updateArgs(e){this._windowTitle&&(this._windowTitle.title=this.args.title,this._windowTitle.subtitle=this.args.subtitle)}};D.type_ensure(dn.$gtype);const fn={stories:[dn]},pn={title:`Boxed Lists/Action Row`,description:`Adw.ActionRow — a preferences row with a title/subtitle, a prefix icon and a suffix button, shown inside a boxed list.`,controls:[{name:`title`,label:`Title`,type:i.TEXT,defaultValue:`Wi-Fi`},{name:`subtitle`,label:`Subtitle`,type:i.TEXT,defaultValue:`Connected to Highgarden 5GHz`},{name:`iconName`,label:`Prefix icon`,type:i.SELECT,options:[{label:`Network`,value:`network-wireless-symbolic`},{label:`Folder`,value:`folder-symbolic`},{label:`Starred`,value:`starred-symbolic`}],defaultValue:`network-wireless-symbolic`},{name:`activatable`,label:`Activatable`,type:i.BOOLEAN,defaultValue:!0}]};var mn=__exportAll({ActionRowStories:()=>gn,ActionRowStory:()=>hn}),hn=class ActionRowStory extends O{_row=null;_icon=null;_button=null;static{D.registerClass({GTypeName:`AdwStorybookActionRow`},ActionRowStory)}constructor(){super(O.fromMeta(ActionRowStory.getMetadata(),`Default`))}static getMetadata(){return{...pn,component:w.ActionRow.$gtype}}initialize(){this._row=new w.ActionRow({title:this.args.title,subtitle:this.args.subtitle}),this._icon=new h.Image({iconName:this.args.iconName}),this._row.add_prefix(this._icon),this._button=new h.Button({iconName:`go-next-symbolic`,valign:h.Align.CENTER}),this._button.add_css_class(`flat`),this._row.add_suffix(this._button),this._row.activatableWidget=this._button,this._row.activatable=this.args.activatable;let e=new w.PreferencesGroup;e.add(this._row);let t=new w.Clamp({maximumSize:400,child:e});this.addContent(t)}updateArgs(e){!this._row||!this._icon||(this._row.title=this.args.title,this._row.subtitle=this.args.subtitle,this._icon.iconName=this.args.iconName,this._row.activatable=this.args.activatable)}};D.type_ensure(hn.$gtype);const gn={stories:[hn]},_n={title:`Boxed Lists/Button Row`,description:`Adw.ButtonRow — a full-width row that acts as a button, with an optional icon and style class.`,controls:[{name:`title`,label:`Title`,type:i.TEXT,defaultValue:`Add account`},{name:`startIconName`,label:`Start icon`,type:i.SELECT,options:[{label:`Add`,value:`list-add-symbolic`},{label:`Trash`,value:`user-trash-symbolic`},{label:`None`,value:``}],defaultValue:`list-add-symbolic`},{name:`style`,label:`Style`,type:i.SELECT,options:[{label:`None`,value:`none`},{label:`Suggested`,value:`suggested-action`},{label:`Destructive`,value:`destructive-action`}],defaultValue:`suggested-action`}]};var vn=__exportAll({ButtonRowStories:()=>xn,ButtonRowStory:()=>bn});const yn=[`suggested-action`,`destructive-action`];var bn=class ButtonRowStory extends O{_row=null;static{D.registerClass({GTypeName:`AdwStorybookButtonRow`},ButtonRowStory)}constructor(){super(O.fromMeta(ButtonRowStory.getMetadata(),`Default`))}static getMetadata(){return{..._n,component:w.ButtonRow.$gtype}}initialize(){this._row=new w.ButtonRow({title:this.args.title,startIconName:this.args.startIconName}),this._applyStyle(this.args.style);let e=new w.PreferencesGroup;e.add(this._row);let t=new w.Clamp({maximumSize:400,child:e});this.addContent(t)}_applyStyle(e){if(this._row){for(let e of yn)this._row.remove_css_class(e);e!==`none`&&this._row.add_css_class(e)}}updateArgs(e){this._row&&(this._row.title=this.args.title,this._row.startIconName=this.args.startIconName,this._applyStyle(this.args.style))}};D.type_ensure(bn.$gtype);const xn={stories:[bn]},Sn=[`Blue`,`Teal`,`Green`,`Orange`,`Purple`],Cn={title:`Boxed Lists/Combo Row`,description:`Adw.ComboRow — a preferences row with an inline drop-down backed by a Gtk.StringList.`,controls:[{name:`title`,label:`Title`,type:i.TEXT,defaultValue:`Accent colour`},{name:`subtitle`,label:`Subtitle`,type:i.TEXT,defaultValue:`Used to highlight selected items`},{name:`selected`,label:`Selected`,type:i.NUMBER,min:0,max:4,step:1,defaultValue:1}]};var wn=__exportAll({ComboRowStories:()=>En,ComboRowStory:()=>Tn}),Tn=class ComboRowStory extends O{_row=null;static{D.registerClass({GTypeName:`AdwStorybookComboRow`},ComboRowStory)}constructor(){super(O.fromMeta(ComboRowStory.getMetadata(),`Default`))}static getMetadata(){return{...Cn,component:w.ComboRow.$gtype}}initialize(){this._row=new w.ComboRow({title:this.args.title,subtitle:this.args.subtitle,model:new h.StringList({strings:[...Sn]}),selected:this.args.selected});let e=new w.PreferencesGroup;e.add(this._row);let t=new w.Clamp({maximumSize:400,child:e});this.addContent(t)}updateArgs(e){this._row&&(this._row.title=this.args.title,this._row.subtitle=this.args.subtitle,this._row.selected=this.args.selected)}};D.type_ensure(Tn.$gtype);const En={stories:[Tn]},Dn={title:`Boxed Lists/Entry Row`,description:`Adw.EntryRow — a preferences row whose title doubles as placeholder text for an inline entry.`,controls:[{name:`title`,label:`Title`,type:i.TEXT,defaultValue:`Display name`},{name:`text`,label:`Text`,type:i.TEXT,defaultValue:`Ada Lovelace`},{name:`showApplyButton`,label:`Show apply button`,type:i.BOOLEAN,defaultValue:!0}]};var On=__exportAll({EntryRowStories:()=>kn,EntryRowStory:()=>$}),$=class EntryRowStory extends O{_row=null;static{D.registerClass({GTypeName:`AdwStorybookEntryRow`},EntryRowStory)}constructor(){super(O.fromMeta(EntryRowStory.getMetadata(),`Default`))}static getMetadata(){return{...Dn,component:w.EntryRow.$gtype}}initialize(){this._row=new w.EntryRow({title:this.args.title,text:this.args.text,showApplyButton:this.args.showApplyButton});let e=new w.PreferencesGroup;e.add(this._row);let t=new w.Clamp({maximumSize:400,child:e});this.addContent(t)}updateArgs(e){this._row&&(this._row.title=this.args.title,this._row.text=this.args.text,this._row.showApplyButton=this.args.showApplyButton)}};D.type_ensure($.$gtype);const kn={stories:[$]},An={title:`Boxed Lists/Expander Row`,description:`Adw.ExpanderRow — a preferences row that discloses nested rows and can carry an enable switch.`,controls:[{name:`title`,label:`Title`,type:i.TEXT,defaultValue:`Proxy settings`},{name:`subtitle`,label:`Subtitle`,type:i.TEXT,defaultValue:`Route traffic through a custom proxy`},{name:`expanded`,label:`Expanded`,type:i.BOOLEAN,defaultValue:!0},{name:`showEnableSwitch`,label:`Show enable switch`,type:i.BOOLEAN,defaultValue:!1}]};var jn=__exportAll({ExpanderRowStories:()=>Nn,ExpanderRowStory:()=>Mn}),Mn=class ExpanderRowStory extends O{_row=null;static{D.registerClass({GTypeName:`AdwStorybookExpanderRow`},ExpanderRowStory)}constructor(){super(O.fromMeta(ExpanderRowStory.getMetadata(),`Default`))}static getMetadata(){return{...An,component:w.ExpanderRow.$gtype}}initialize(){this._row=new w.ExpanderRow({title:this.args.title,subtitle:this.args.subtitle,expanded:this.args.expanded,showEnableSwitch:this.args.showEnableSwitch}),this._row.add_row(new w.EntryRow({title:`Host`,text:`proxy.example.com`})),this._row.add_row(new w.SwitchRow({title:`Use authentication`,active:!1}));let e=new w.PreferencesGroup;e.add(this._row);let t=new w.Clamp({maximumSize:400,child:e});this.addContent(t)}updateArgs(e){this._row&&(this._row.title=this.args.title,this._row.subtitle=this.args.subtitle,this._row.expanded=this.args.expanded,this._row.showEnableSwitch=this.args.showEnableSwitch)}};D.type_ensure(Mn.$gtype);const Nn={stories:[Mn]},Pn={title:`Boxed Lists/Password Entry Row`,description:`Adw.PasswordEntryRow — an entry row that masks its contents and shows a peek toggle.`,controls:[{name:`title`,label:`Title`,type:i.TEXT,defaultValue:`Password`},{name:`text`,label:`Text`,type:i.TEXT,defaultValue:`correct-horse-battery`}]};var Fn=__exportAll({PasswordEntryRowStories:()=>Ln,PasswordEntryRowStory:()=>In}),In=class PasswordEntryRowStory extends O{_row=null;static{D.registerClass({GTypeName:`AdwStorybookPasswordEntryRow`},PasswordEntryRowStory)}constructor(){super(O.fromMeta(PasswordEntryRowStory.getMetadata(),`Default`))}static getMetadata(){return{...Pn,component:w.PasswordEntryRow.$gtype}}initialize(){this._row=new w.PasswordEntryRow({title:this.args.title,text:this.args.text});let e=new w.PreferencesGroup;e.add(this._row);let t=new w.Clamp({maximumSize:400,child:e});this.addContent(t)}updateArgs(e){this._row&&(this._row.title=this.args.title,this._row.text=this.args.text)}};D.type_ensure(In.$gtype);const Ln={stories:[In]},Rn={title:`Boxed Lists/Preferences Group`,description:`Adw.PreferencesGroup — the boxed-list container that gathers a title, description, header-suffix widget and rows.`,controls:[{name:`title`,label:`Title`,type:i.TEXT,defaultValue:`Account`},{name:`description`,label:`Description`,type:i.TEXT,defaultValue:`Manage how this device signs in and syncs.`}]};var zn=__exportAll({PreferencesGroupStories:()=>Vn,PreferencesGroupStory:()=>Bn}),Bn=class PreferencesGroupStory extends O{_prefsGroup=null;static{D.registerClass({GTypeName:`AdwStorybookPreferencesGroup`},PreferencesGroupStory)}constructor(){super(O.fromMeta(PreferencesGroupStory.getMetadata(),`Default`))}static getMetadata(){return{...Rn,component:w.PreferencesGroup.$gtype}}initialize(){let e=new h.Button({label:`Sign out`,valign:h.Align.CENTER});e.add_css_class(`flat`),this._prefsGroup=new w.PreferencesGroup({title:this.args.title,description:this.args.description,headerSuffix:e});let t=new w.EntryRow({title:`Display name`,text:`Grace Hopper`});this._prefsGroup.add(t);let n=new w.SwitchRow({title:`Sync over Wi-Fi only`,subtitle:`Avoid using mobile data for backups`,active:!0});this._prefsGroup.add(n);let r=new w.ComboRow({title:`Region`,model:new h.StringList({strings:[`Europe`,`Americas`,`Asia`,`Oceania`]}),selected:0});this._prefsGroup.add(r);let i=new w.Clamp({maximumSize:400,child:this._prefsGroup});this.addContent(i)}updateArgs(e){this._prefsGroup&&(this._prefsGroup.title=this.args.title,this._prefsGroup.description=this.args.description)}};D.type_ensure(Bn.$gtype);const Vn={stories:[Bn]},Hn={title:`Boxed Lists/Spin Row`,description:`Adw.SpinRow — a preferences row with an inline spin button over a numeric adjustment.`,controls:[{name:`title`,label:`Title`,type:i.TEXT,defaultValue:`Font size`},{name:`value`,label:`Value`,type:i.NUMBER,min:0,max:100,step:1,defaultValue:16},{name:`digits`,label:`Digits`,type:i.NUMBER,min:0,max:4,step:1,defaultValue:0}]};var Un=__exportAll({SpinRowStories:()=>Gn,SpinRowStory:()=>Wn}),Wn=class SpinRowStory extends O{_row=null;static{D.registerClass({GTypeName:`AdwStorybookSpinRow`},SpinRowStory)}constructor(){super(O.fromMeta(SpinRowStory.getMetadata(),`Default`))}static getMetadata(){return{...Hn,component:w.SpinRow.$gtype}}initialize(){this._row=new w.SpinRow({title:this.args.title,adjustment:new h.Adjustment({lower:0,upper:100,value:this.args.value,stepIncrement:1,pageIncrement:10}),digits:this.args.digits});let e=new w.PreferencesGroup;e.add(this._row);let t=new w.Clamp({maximumSize:400,child:e});this.addContent(t)}updateArgs(e){this._row&&(this._row.title=this.args.title,this._row.value=this.args.value,this._row.digits=this.args.digits)}};D.type_ensure(Wn.$gtype);const Gn={stories:[Wn]},Kn={title:`Boxed Lists/Switch Row`,description:`Adw.SwitchRow — a preferences row with a trailing switch, shown inside a boxed list.`,controls:[{name:`title`,label:`Title`,type:i.TEXT,defaultValue:`Automatic updates`},{name:`subtitle`,label:`Subtitle`,type:i.TEXT,defaultValue:`Download and install updates without asking`},{name:`active`,label:`Active`,type:i.BOOLEAN,defaultValue:!0}]};var qn=__exportAll({SwitchRowStories:()=>Yn,SwitchRowStory:()=>Jn}),Jn=class SwitchRowStory extends O{_row=null;static{D.registerClass({GTypeName:`AdwStorybookSwitchRow`},SwitchRowStory)}constructor(){super(O.fromMeta(SwitchRowStory.getMetadata(),`Default`))}static getMetadata(){return{...Kn,component:w.SwitchRow.$gtype}}initialize(){this._row=new w.SwitchRow({title:this.args.title,subtitle:this.args.subtitle,active:this.args.active});let e=new w.PreferencesGroup;e.add(this._row);let t=new w.Clamp({maximumSize:400,child:e});this.addContent(t)}updateArgs(e){this._row&&(this._row.title=this.args.title,this._row.subtitle=this.args.subtitle,this._row.active=this.args.active)}};D.type_ensure(Jn.$gtype);const Yn={stories:[Jn]},Xn=[{name:`allowScrollWheel`,label:`Allow scroll wheel`,type:i.BOOLEAN,defaultValue:!0},{name:`allowLongSwipes`,label:`Allow long swipes`,type:i.BOOLEAN,defaultValue:!1}],Zn={title:`View Switching/Carousel (Dots)`,description:`Adw.Carousel — a horizontally swipeable pager with three pages, paired with Adw.CarouselIndicatorDots.`,controls:Xn},Qn={title:`View Switching/Carousel (Lines)`,description:`Adw.Carousel — the same swipeable pager paired with Adw.CarouselIndicatorLines instead of dots.`,controls:Xn};var $n=__exportAll({CarouselDotsStory:()=>tr,CarouselLinesStory:()=>nr,CarouselStories:()=>rr});const er=[{title:`Welcome`,css:`accent`},{title:`Discover`,css:`success`},{title:`Get started`,css:`warning`}];function buildPage(e,t){let n=new h.Box({orientation:h.Orientation.VERTICAL,halign:h.Align.CENTER,valign:h.Align.CENTER,widthRequest:440,heightRequest:260});n.add_css_class(`card`),n.add_css_class(t);let r=new h.Label({label:e,vexpand:!0,valign:h.Align.CENTER});return r.add_css_class(`title-1`),n.append(r),n}var tr=class CarouselDotsStory extends O{_carousel=null;static{D.registerClass({GTypeName:`AdwStorybookCarouselDots`},CarouselDotsStory)}constructor(){super(O.fromMeta(CarouselDotsStory.getMetadata(),`Default`))}static getMetadata(){return{...Zn,component:w.Carousel.$gtype}}initialize(){this._carousel=new w.Carousel({allowScrollWheel:this.args.allowScrollWheel,allowLongSwipes:this.args.allowLongSwipes,vexpand:!0});for(let e of er)this._carousel.append(buildPage(e.title,e.css));let e=new w.CarouselIndicatorDots({carousel:this._carousel}),t=new h.Box({orientation:h.Orientation.VERTICAL,spacing:12,widthRequest:480,heightRequest:340});t.append(this._carousel),t.append(e),this.addContent(t)}updateArgs(e){this._carousel&&(this._carousel.allowScrollWheel=this.args.allowScrollWheel,this._carousel.allowLongSwipes=this.args.allowLongSwipes)}};D.type_ensure(tr.$gtype);var nr=class CarouselLinesStory extends O{_carousel=null;static{D.registerClass({GTypeName:`AdwStorybookCarouselLines`},CarouselLinesStory)}constructor(){super(O.fromMeta(CarouselLinesStory.getMetadata(),`Default`))}static getMetadata(){return{...Qn,component:w.Carousel.$gtype}}initialize(){this._carousel=new w.Carousel({allowScrollWheel:this.args.allowScrollWheel,allowLongSwipes:this.args.allowLongSwipes,vexpand:!0});for(let e of er)this._carousel.append(buildPage(e.title,e.css));let e=new w.CarouselIndicatorLines({carousel:this._carousel}),t=new h.Box({orientation:h.Orientation.VERTICAL,spacing:12,widthRequest:480,heightRequest:340});t.append(this._carousel),t.append(e),this.addContent(t)}updateArgs(e){this._carousel&&(this._carousel.allowScrollWheel=this.args.allowScrollWheel,this._carousel.allowLongSwipes=this.args.allowLongSwipes)}};D.type_ensure(nr.$gtype);const rr={stories:[tr,nr]},ir={title:`View Switching/Inline View Switcher`,description:`Adw.InlineViewSwitcher — a compact inline switcher that can show labels, icons, or both for an Adw.ViewStack.`,controls:[{name:`displayMode`,label:`Display mode`,type:i.SELECT,options:[{label:`Labels`,value:`labels`},{label:`Icons`,value:`icons`},{label:`Both`,value:`both`}],defaultValue:`both`}]};var ar=__exportAll({InlineViewSwitcherStories:()=>sr,InlineViewSwitcherStory:()=>or}),or=class InlineViewSwitcherStory extends O{_switcher=null;static{D.registerClass({GTypeName:`AdwStorybookInlineViewSwitcher`},InlineViewSwitcherStory)}constructor(){super(O.fromMeta(InlineViewSwitcherStory.getMetadata(),`Default`))}static getMetadata(){return{...ir,component:w.InlineViewSwitcher.$gtype}}buildPage(e,t,n){return new w.StatusPage({iconName:t,title:e,description:n,vexpand:!0})}initialize(){let e=new w.ViewStack({vexpand:!0});e.add_titled_with_icon(this.buildPage(`Overview`,`view-grid-symbolic`,`A quick summary of your project.`),`overview`,`Overview`,`view-grid-symbolic`),e.add_titled_with_icon(this.buildPage(`Activity`,`document-edit-symbolic`,`Recent edits and changes.`),`activity`,`Activity`,`document-edit-symbolic`),e.add_titled_with_icon(this.buildPage(`Settings`,`emblem-system-symbolic`,`Configure how things behave.`),`settings`,`Settings`,`emblem-system-symbolic`),this._switcher=new w.InlineViewSwitcher({stack:e,displayMode:this.modeFromArg(this.args.displayMode),halign:h.Align.CENTER});let t=new h.Box({orientation:h.Orientation.VERTICAL,spacing:12,widthRequest:480,heightRequest:340});t.append(this._switcher),t.append(e),this.addContent(t)}modeFromArg(e){return e===`labels`?w.InlineViewSwitcherDisplayMode.LABELS:e===`icons`?w.InlineViewSwitcherDisplayMode.ICONS:w.InlineViewSwitcherDisplayMode.BOTH}updateArgs(e){this._switcher&&(this._switcher.displayMode=this.modeFromArg(this.args.displayMode))}};D.type_ensure(or.$gtype);const sr={stories:[or]},cr={title:`View Switching/Tab View`,description:`Adw.TabView with an Adw.TabBar header — three tabbed pages; the tab bar can auto-hide when only one tab remains.`,controls:[{name:`autohide`,label:`Autohide tab bar`,type:i.BOOLEAN,defaultValue:!1}]};var lr=__exportAll({TabViewStories:()=>fr,TabViewStory:()=>dr});const ur=[{title:`Overview`,body:`A summary of everything at a glance.`},{title:`Details`,body:`The specifics, broken down line by line.`},{title:`History`,body:`A log of every change made so far.`}];var dr=class TabViewStory extends O{_tabBar=null;static{D.registerClass({GTypeName:`AdwStorybookTabView`},TabViewStory)}constructor(){super(O.fromMeta(TabViewStory.getMetadata(),`Default`))}static getMetadata(){return{...cr,component:w.TabView.$gtype}}buildPageBody(e,t){return new w.StatusPage({iconName:`view-paged-symbolic`,title:e,description:t,vexpand:!0})}initialize(){let e=new w.TabView({vexpand:!0});for(let t of ur){let n=e.append(this.buildPageBody(t.title,t.body));n.title=t.title}this._tabBar=new w.TabBar({view:e,autohide:this.args.autohide});let t=new h.Box({orientation:h.Orientation.VERTICAL,widthRequest:480,heightRequest:340});t.append(this._tabBar),t.append(e),this.addContent(t)}updateArgs(e){this._tabBar&&(this._tabBar.autohide=this.args.autohide)}};D.type_ensure(dr.$gtype);const fr={stories:[dr]},pr=[{name:`inbox`,title:`Inbox`,icon:`mail-unread-symbolic`},{name:`starred`,title:`Starred`,icon:`starred-symbolic`},{name:`archive`,title:`Archive`,icon:`folder-symbolic`}],mr={title:`View Switching/View Switcher Bar`,description:"Adw.ViewSwitcherBar — the narrow-window switcher, pinned to the bottom of a toolbar view. `reveal` is a REQUEST, not a state: a stack with fewer than two pages stays collapsed however loudly it is asked.",controls:[{name:`reveal`,label:`Reveal`,type:i.BOOLEAN,defaultValue:!0}]};var hr=__exportAll({ViewSwitcherBarStories:()=>_r,ViewSwitcherBarStory:()=>gr}),gr=class ViewSwitcherBarStory extends O{_bar=null;static{D.registerClass({GTypeName:`AdwStorybookViewSwitcherBar`},ViewSwitcherBarStory)}constructor(){super(O.fromMeta(ViewSwitcherBarStory.getMetadata(),`Default`))}static getMetadata(){return{...mr,component:w.ViewSwitcherBar.$gtype}}initialize(){let e=new w.ViewStack({vexpand:!0});for(let t of pr){let n=new w.StatusPage({iconName:t.icon,title:t.title,description:`The ${t.title.toLowerCase()} page.`,vexpand:!0});e.add_titled_with_icon(n,t.name,t.title,t.icon)}this._bar=new w.ViewSwitcherBar({stack:e}),this._apply();let t=new w.ToolbarView({content:e,widthRequest:360,heightRequest:360});t.add_bottom_bar(this._bar),this.addContent(t)}updateArgs(e){this._apply()}_apply(){this._bar&&(this._bar.reveal=this.args.reveal)}};D.type_ensure(gr.$gtype);const _r={stories:[gr]},vr={title:`View Switching/View Switcher`,description:`Adw.ViewSwitcher — a segmented switcher whose buttons select pages in a paired Adw.ViewStack.`,controls:[{name:`policy`,label:`Policy`,type:i.SELECT,options:[{label:`Wide`,value:`wide`},{label:`Narrow`,value:`narrow`}],defaultValue:`wide`}]};var yr=__exportAll({ViewSwitcherStories:()=>xr,ViewSwitcherStory:()=>br}),br=class ViewSwitcherStory extends O{_switcher=null;static{D.registerClass({GTypeName:`AdwStorybookViewSwitcher`},ViewSwitcherStory)}constructor(){super(O.fromMeta(ViewSwitcherStory.getMetadata(),`Default`))}static getMetadata(){return{...vr,component:w.ViewSwitcher.$gtype}}buildPage(e,t,n){return new w.StatusPage({iconName:t,title:e,description:n,vexpand:!0})}initialize(){let e=new w.ViewStack({vexpand:!0});e.add_titled_with_icon(this.buildPage(`Inbox`,`mail-unread-symbolic`,`You have three unread conversations.`),`inbox`,`Inbox`,`mail-unread-symbolic`),e.add_titled_with_icon(this.buildPage(`Starred`,`starred-symbolic`,`Messages you have marked as important.`),`starred`,`Starred`,`starred-symbolic`),e.add_titled_with_icon(this.buildPage(`Archive`,`folder-symbolic`,`Older conversations kept for reference.`),`archive`,`Archive`,`folder-symbolic`),this._switcher=new w.ViewSwitcher({stack:e,policy:this.policyFromArg(this.args.policy),halign:h.Align.CENTER});let t=new h.Box({orientation:h.Orientation.VERTICAL,spacing:12,widthRequest:480,heightRequest:340});t.append(this._switcher),t.append(e),this.addContent(t)}policyFromArg(e){return e===`narrow`?w.ViewSwitcherPolicy.NARROW:w.ViewSwitcherPolicy.WIDE}updateArgs(e){this._switcher&&(this._switcher.policy=this.policyFromArg(this.args.policy))}};D.type_ensure(br.$gtype);const xr={stories:[br]};await runStorybook({applicationId:`org.gjsify.AdwaitaStorybook`,title:`Adwaita Storybook`,stories:collectStoryModules([Se,Te,Ae,Pe,Le,He,Ge,Je,Ze,et,rt,ot,lt,ft,ht,vt,xt,wt,Dt,At,It,Bt,Wt,Xt,tn,on,un,mn,vn,wn,On,jn,Fn,zn,Un,qn,$n,ar,lr,hr,yr])});export{};