PluginProbe
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin / 1.1.6
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin v1.1.6
1.1.10 1.1.9 1.1.8 1.1.7 1.1.6 1.1.5 1.1.4 1.1.3 1.1.2 1.1.1 1.1.0 1.0.1 1.0.0 0.9.8 0.9.7 0.9.6 0.9.4 0.9.5 0.9.3 0.9.2 0.9.1 0.9.0 0.8.9 0.8.8 0.8.7 All 34 releases
desktop-mode / assets / js / apps / os-settings.min.js

os-settings.min.js in OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin 1.1.6, at assets/js/apps/os-settings.min.js

2,292 lines 442.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var openStationApp_osSettings=function(ys){"use strict";const sa="desktop-mode";function xi(){return window.wp?.i18n}function d(o,e=sa){return xi()?.__(o,e)??o}function q(o,...e){const t=xi()?.sprintf;if(t)return t(o,...e);let s=0;return o.replace(/%(?:(\d+)\$)?[sd]/g,(i,n)=>{const r=n?Number.parseInt(n,10)-1:s++;return String(e[r]??"")})}function l(o,...e){return{__wpdHtml:!0,strings:o,values:e}}function oa(o){return!!o&&o.__wpdHtml===!0}const ia="$$wpd$$",z=/\$\$wpd\$\$(\d+)\$\$/g,na="$$wpd-node$$",ra=/^\$\$wpd-node\$\$(\d+)\$\$$/,aa=new Set(["style","script","textarea","title"]);function la(o){let e="",t=!1,s=null,i=!1,n=null,r="",a=!1;for(let c=0;c<o.length;c++){const u=o[c];e+=u;for(let h=0;h<u.length;h++){const p=u[h];if(i){u.startsWith("-->",h)&&(i=!1,h+=2);continue}if(n!==null){p==="<"&&u[h+1]==="/"&&u.slice(h+2,h+2+n.length).toLowerCase()===n&&(h+=1+n.length,n=null,t=!0,a=!1,r="");continue}if(s!==null){p===s&&(s=null);continue}if(t){p==='"'||p==="'"?(s=p,a=!1):p===">"?(t=!1,a=!1,aa.has(r)&&(n=r),r=""):a&&(/[a-zA-Z0-9-]/.test(p)?r+=p.toLowerCase():a=!1);continue}if(u.startsWith("<!--",h)){i=!0,h+=3;continue}const g=u[h+1]??"";p==="<"&&/[a-zA-Z/!]/.test(g)&&(t=!0,r="",a=/[a-zA-Z]/.test(g))}c<o.length-1&&(e+=t||i||n!==null?`${ia}${c}$$`:`<!--${na}${c}$$-->`)}return e}const ki=new WeakMap;function $i(o){const e=ki.get(o);if(e)return e;const t=document.createElement("template");t.innerHTML=la(o);const s=[],i=(a,c)=>{if(a.nodeType===Node.ELEMENT_NODE){const p=a;for(const g of Array.from(p.attributes)){const m=g.name,b=g.value,x=m[0];if(z.test(b))if(z.lastIndex=0,x==="@"){const w=z.exec(b);z.lastIndex=0,s.push({path:c,kind:"event",name:m.slice(1),valueIndex:w?Number(w[1]):0}),p.removeAttribute(m)}else if(x==="."){const w=z.exec(b);z.lastIndex=0,s.push({path:c,kind:"prop",name:m.slice(1),valueIndex:w?Number(w[1]):0}),p.removeAttribute(m)}else if(x==="?"){const w=z.exec(b);z.lastIndex=0,s.push({path:c,kind:"bool",name:m.slice(1),valueIndex:w?Number(w[1]):0}),p.removeAttribute(m)}else{const w=[],$=[];let f=0,A;for(z.lastIndex=0;(A=z.exec(b))!==null;)w.push(b.slice(f,A.index)),$.push(Number(A[1])),f=A.index+A[0].length;w.push(b.slice(f)),s.push({path:c,kind:"attr",name:m,template:w,valueIndices:$}),p.setAttribute(m,"")}}}const u=Array.from(a.childNodes);let h=0;for(let p=0;p<u.length;p++){const g=u[p],m=p+h;if(g.nodeType===Node.COMMENT_NODE){const b=ra.exec(g.data);if(b){const x=document.createTextNode("");g.parentNode.replaceChild(x,g),s.push({path:[...c,m],kind:"node",valueIndex:Number(b[1])})}continue}if(g.nodeType===Node.TEXT_NODE){const b=g.textContent||"";if(!z.test(b)){z.lastIndex=0;continue}z.lastIndex=0;const x=g.parentNode;let w=0,$;const f=[],A=[];for(z.lastIndex=0;($=z.exec(b))!==null;){$.index>w&&f.push(document.createTextNode(b.slice(w,$.index)));const k=document.createTextNode("");f.push(k),A.push({path:[...c,m+f.length-1],kind:"node",valueIndex:Number($[1])}),w=$.index+$[0].length}w<b.length&&f.push(document.createTextNode(b.slice(w)));for(const k of f)x.insertBefore(k,g);x.removeChild(g),h+=f.length-1,s.push(...A)}else i(g,[...c,m])}};i(t.content,[]);const r={template:t,buildParts:a=>{const c=[];for(const u of s){let h=a;for(const p of u.path)h=h.childNodes[p];u.kind==="node"?c.push({kind:"node",valueIndex:u.valueIndex,child:{anchor:h,state:null}}):u.kind==="attr"?c.push({kind:"attr",element:h,name:u.name,template:u.template,valueIndices:u.valueIndices}):u.kind==="event"?c.push({kind:"event",valueIndex:u.valueIndex,element:h,name:u.name}):u.kind==="prop"?c.push({kind:"prop",valueIndex:u.valueIndex,element:h,name:u.name}):u.kind==="bool"&&c.push({kind:"bool",valueIndex:u.valueIndex,element:h,name:u.name})}return c}};return ki.set(o,r),r}const Ei=new WeakMap;function ca(o,e){for(const t of o.nodes)if(t.parentNode!==e)return!1;return!0}function ge(o,e){const t=Ei.get(e);if(t&&t.strings===o.strings&&ca(t,e)){Gt(t.parts,o.values);return}const s=$i(o.strings),i=s.template.content.cloneNode(!0),n=s.buildParts(i),r=Array.from(i.childNodes);for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(i),Gt(n,o.values),Ei.set(e,{strings:o.strings,parts:n,nodes:r})}function Gt(o,e){for(const t of o)if(t.kind==="node")Xt(t.child,e[t.valueIndex]);else if(t.kind==="attr"){let s=t.template[0];for(let i=0;i<t.valueIndices.length;i++)s+=Ai(e[t.valueIndices[i]]),s+=t.template[i+1];s!==t.last&&(t.last=s,s===""?t.element.removeAttribute(t.name):t.element.setAttribute(t.name,s))}else if(t.kind==="event"){const s=e[t.valueIndex];s!==t.current&&(t.current&&t.element.removeEventListener(t.name,t.current),s&&t.element.addEventListener(t.name,s),t.current=s)}else if(t.kind==="prop"){const s=e[t.valueIndex];s!==t.last&&(t.last=s,t.element[t.name]=s)}else if(t.kind==="bool"){const s=!!e[t.valueIndex];s!==t.last&&(t.last=s,s?t.element.setAttribute(t.name,""):t.element.removeAttribute(t.name))}}function Xt(o,e){if(e==null||e===!1){o.state&&(se(o.state),o.state=null);return}if(Array.isArray(e)){pa(o,e);return}if(oa(e)){ha(o,e);return}if(e instanceof Node){da(o,e);return}ua(o,Ai(e))}function da(o,e){const t=o.state;t?.shape==="node"&&t.node===e||(t&&se(t),$e(o,[e]),o.state={shape:"node",node:e})}function ua(o,e){const t=o.state;if(t?.shape==="text"){t.text!==e&&(t.node.textContent=e,t.text=e);return}t&&se(t);const s=document.createTextNode(e);$e(o,[s]),o.state={shape:"text",node:s,text:e}}function ha(o,e){const t=o.state;if(t?.shape==="template"&&t.strings===e.strings){Gt(t.parts,e.values);return}t&&se(t);const s=$i(e.strings),i=s.template.content.cloneNode(!0),n=s.buildParts(i),r=Array.from(i.childNodes);$e(o,[i]),Gt(n,e.values),o.state={shape:"template",strings:e.strings,parts:n,nodes:r}}function pa(o,e){const t=o.state;if(t?.shape==="array"){const i=Math.min(t.entries.length,e.length);for(let n=0;n<i;n++)Xt(t.entries[n],e[n]);if(e.length<t.entries.length){for(let n=e.length;n<t.entries.length;n++){const r=t.entries[n];r.state&&se(r.state),r.anchor.remove()}t.entries.length=e.length}else for(let n=t.entries.length;n<e.length;n++){const r=document.createTextNode("");$e(o,[r]);const a={anchor:r,state:null};Xt(a,e[n]),t.entries.push(a)}return}t&&se(t);const s=[];for(const i of e){const n=document.createTextNode("");$e(o,[n]);const r={anchor:n,state:null};Xt(r,i),s.push(r)}o.state={shape:"array",entries:s}}function $e(o,e){const t=o.anchor.parentNode;if(t)for(const s of e)t.insertBefore(s,o.anchor)}function se(o){if(o.shape==="text"){o.node.remove();return}if(o.shape==="template"){for(const e of o.parts)e.kind==="node"&&e.child.state&&(se(e.child.state),e.child.state=null);for(const e of o.nodes)e.parentNode&&e.parentNode.removeChild(e);return}if(o.shape==="node"){o.node.parentNode&&o.node.parentNode.removeChild(o.node);return}for(const e of o.entries)e.state&&se(e.state),e.anchor.remove()}function Ai(o){return o==null||o===!1?"":String(o)}function ga(o,e){const t=e.local??{},s={id:o,hasLocal:r=>Object.prototype.hasOwnProperty.call(t,r),runLocal:(r,a,c,u)=>{const h=t[r];if(!h)return a;const p={...a},g=h(p,c,u);return g===void 0?p:g},render:r=>{ge(e.view(r),r.root),e.updated?.(r)},mounted:r=>e.mounted?.(r)},{placeholder:i}=e;i&&(s.placeholder=r=>i(r));const n=window;return(n.openStationApps??(n.openStationApps={}))[o]=s,s}function Ci(){const o=window.wp?.hooks;if(!o)throw new Error("[openstation] `window.wp.hooks` is not available. The plugin declares `wp-hooks` as a script dependency; if you are seeing this error, verify the enqueue order.");return o}function ce(o,e,...t){return Ci().applyFilters(o,e,...t)}function de(o,...e){Ci().doAction(o,...e)}const W={INIT:"os.init",WALLPAPERS:"os.wallpapers",GAMES:"os.games",UNFOCUS_EFFECTS:"os.unfocus-effects",WINDOW_REVEALS:"os.window-reveals",WALLPAPER_MOUNTING:"os.wallpaper.mounting",WALLPAPER_MOUNTED:"os.wallpaper.mounted",WALLPAPER_UNMOUNTING:"os.wallpaper.unmounting",WALLPAPER_MOUNT_FAILED:"os.wallpaper.mount-failed",WALLPAPER_VISIBILITY:"os.wallpaper.visibility",WALLPAPER_SUSPEND:"os.wallpaper.suspend",WALLPAPER_PREVIEW_PARAMS:"os.wallpaper.preview-params",WALLPAPER_SETTINGS_CHANGED:"os.wallpaper.settings-changed",IFRAME_READY:"os.iframe.ready",IFRAME_ERROR:"os.iframe.error",IFRAME_NETWORK_COMPLETED:"os.iframe.network-completed",SHELL_ERROR:"os.shell.error",BROADCAST:"os.broadcast",MONITOR_ENTRY:"os.monitor.entry",WALLPAPER_SURFACES:"os.wallpaper.surfaces",DESKTOP_THEME_CHANGED:"os.os-theme.changed",DESKTOP_THEME_ICON:"os.os-theme.icon",DESKTOP_THEME_ICON_COLOR:"os.os-theme.icon-color",WALLPAPERS_SERVER_CHANGED:"os.wallpapers.server-changed",EXTENDED_OPTIONS_CHANGED:"os.extended-options.changed",WINDOW_GEOMETRY:"os.window.geometry",WINDOW_OPENED:"os.window.opened",WINDOW_CONTENT_LOADING:"os.window.content-loading",WINDOW_CONTENT_LOADED:"os.window.content-loaded",WINDOW_LOADING_OVERLAY:"os.window.loading-overlay",WINDOW_REOPENED:"os.window.reopened",WINDOW_MENU_OPENED:"os.window.menu-opened",WINDOW_CLOSING:"os.window.closing",WINDOW_CLOSED:"os.window.closed",WINDOW_FOCUSED:"os.window.focused",WINDOW_BLURRED:"os.window.blurred",WINDOW_MINIMIZED:"os.window.minimized",WINDOW_RESTORED:"os.window.restored",WINDOW_CHILD_BLOCKED:"os.window.child-blocked",WINDOW_MAXIMIZED:"os.window.maximized",WINDOW_UNMAXIMIZED:"os.window.unmaximized",WINDOW_FULLSCREEN_ENTERED:"os.window.fullscreen-entered",WINDOW_FULLSCREEN_EXITED:"os.window.fullscreen-exited",WINDOW_AUTO_EXIT_FULLSCREEN:"os.window.auto-exit-fullscreen",WINDOW_FOCUS_ON_DRAG_HOVER:"os.window.focus-on-drag-hover",WINDOW_BOUNDS_CHANGED:"os.window.bounds-changed",WINDOW_MOVED:"os.window.moved",WINDOW_RESIZED:"os.window.resized",WINDOW_DRAG_START:"os.window.drag-start",WINDOW_DRAG_END:"os.window.drag-end",WINDOW_RESIZE_START:"os.window.resize-start",WINDOW_RESIZE_END:"os.window.resize-end",WINDOW_DETACHED:"os.window.detached",WINDOW_RELOADED:"os.window.reloaded",WINDOW_TITLE_CHANGED:"os.window.title-changed",WINDOW_HIGHLIGHT_CHANGED:"os.window.highlight-changed",WINDOW_BODY_RESIZED:"os.window.body-resized",NATIVE_WINDOW_BEFORE_RENDER:"os.native-window.before-render",NATIVE_WINDOW_AFTER_RENDER:"os.native-window.after-render",NATIVE_WINDOW_BEFORE_CLOSE:"os.native-window.before-close",WINDOW_CHROME_THEME:"os.window.chrome.theme",WINDOW_CHROME_CONTROLS:"os.window.chrome.controls",WINDOW_CHROME_SLOT:"os.window.chrome.slot",WINDOW_CHROME_RENDER:"os.window.chrome.render",WINDOW_CHROME_APPLIED:"os.window.chrome.applied",WINDOW_CHROME_THEME_CHANGED:"os.window.chrome.theme-changed",DESKTOP_ICON_CLICKED:"os.os-icon.clicked",DESKTOP_ICONS_RENDERED:"os.os-icons.rendered",ICON_BADGE_CHANGED:"os.icon.badge-changed",COMPONENTS_REGISTERED:"os.components.registered",DOCK_ITEM_APPENDED:"os.dock.item-appended",DOCK_ITEM_REMOVED:"os.dock.item-removed",DOCK_BEFORE_RENDER:"os.dock.before-render",DOCK_AFTER_RENDER:"os.dock.after-render",DOCK_REFRESH_ACTIVE:"os.dock.refresh-active",DOCK_TILE_CLASS:"os.dock.tile-class",DOCK_TILE_ELEMENT:"os.dock.tile-element",DOCK_TILE_RENDERED:"os.dock.tile-rendered",DOCK_TILE_TOOLTIP:"os.dock.tile-tooltip",DOCK_PEEK_CARD_CONTENT:"os.dock.peek-card-content",DOCK_PEEK_CARD_ELEMENT:"os.dock.peek-card-element",CONSTELLATION_PANEL:"os.constellation.panel",CONSTELLATION_OPENED:"os.constellation.opened",CONSTELLATION_CLOSED:"os.constellation.closed",OVERVIEW_ENTERING:"os.overview.entering",OVERVIEW_ENTERED:"os.overview.entered",OVERVIEW_EXITING:"os.overview.exiting",OVERVIEW_EXITED:"os.overview.exited",OVERVIEW_WINDOW_HOVER:"os.overview.window-hover",OVERVIEW_WINDOW_UNHOVER:"os.overview.window-unhover",OVERVIEW_WINDOW_CLICK:"os.overview.window-click",WORK_AREA_CHANGED:"os.work-area.changed",ARRANGE_CASCADE_STARTING:"os.arrange.cascade.starting",ARRANGE_CASCADE_APPLIED:"os.arrange.cascade.applied",ARRANGE_TILE_STARTING:"os.arrange.tile.starting",ARRANGE_TILE_APPLIED:"os.arrange.tile.applied",ARRANGE_TILE_DIMENSIONS:"os.arrange.tile.dimensions",ARRANGE_COLUMNS_STARTING:"os.arrange.columns.starting",ARRANGE_COLUMNS_APPLIED:"os.arrange.columns.applied",ARRANGE_FOCUS_SPLIT:"os.arrange.focus.split",ARRANGE_FOCUS_STARTING:"os.arrange.focus.starting",ARRANGE_FOCUS_APPLIED:"os.arrange.focus.applied",ARRANGE_SNAP_CHANGED:"os.arrange.snap.changed",ARRANGE_SNAP_CELL_SIZE:"os.arrange.snap.cell-size",ARRANGE_CUSTOM_ACTION:"os.arrange.custom-action",POINTER_SHAKE:"os.pointer.shake",GRID_SNAP_DIMENSIONS:"os.grid-snap.dimensions",GRID_SNAP_ARMED:"os.grid-snap.armed",GRID_SNAP_CHANGED:"os.grid-snap.changed",GRID_SNAP_ANCHOR_RESET:"os.grid-snap.anchor-reset",GRID_SNAP_CANCELED:"os.grid-snap.canceled",GRID_SNAP_COMMITTED:"os.grid-snap.committed",GRID_SNAP_REFLOWED:"os.grid-snap.reflowed",SNAP_ZONE_PENDING:"os.snap.zone-pending",SNAP_ZONE_CANCELED:"os.snap.zone-canceled",SNAP_ZONE_COMMITTED:"os.snap.zone-committed",SNAP_SPLIT_FILLED:"os.snap.split-filled",WIDGETS:"os.widgets",WIDGET_MOUNTING:"os.widget.mounting",WIDGET_MOUNTED:"os.widget.mounted",WIDGET_UNMOUNTING:"os.widget.unmounting",WIDGET_MOUNT_FAILED:"os.widget.mount-failed",WIDGET_ADDED:"os.widget.added",WIDGET_REMOVED:"os.widget.removed",DESKTOP_CREATED:"os.os.created",DESKTOP_CLOSED:"os.os.closed",DESKTOP_SWITCHED:"os.os.switched",DESKTOP_RENAMED:"os.os.renamed",WINDOW_DESKTOP_CHANGED:"os.os.window-moved",PRIMARY_DESKTOP_ID:"os.primary-desktop-id",WORKSPACE_PRESETS:"os.workspaces.presets",WORKSPACE_PROFILE:"os.workspaces.profile",WORKSPACE_UPDATED:"os.workspaces.updated",WORKSPACE_PROVISIONED:"os.workspaces.provisioned",WINDOWS_BEFORE_CLOSE_ALL:"os.windows.before-close-all",WINDOWS_CLOSE_ALL:"os.windows.close-all",WINDOWS_AFTER_CLOSE_ALL:"os.windows.after-close-all",COMMAND_BEFORE_RUN:"os.command.before-run",COMMAND_AFTER_RUN:"os.command.after-run",COMMAND_ERROR:"os.command.error",SHELL_RESIZED:"os.shell.resized",SHELL_VISIBILITY:"os.shell.visibility",CONNECTION_OPENED:"os.connection.opened",CONNECTION_CLOSED:"os.connection.closed",CONNECTION_MESSAGE:"os.connection.message",IFRAME_CONNECTION_REQUEST:"os.iframe.connection-request",WINDOW_CONTENT_CHANGED:"os.window-links.content-changed",WINDOW_LINK_GROUPS_CHANGED:"os.window-links.groups-changed",WINDOW_LINKS_CONTENT:"os.window-links.content",WINDOW_LINK_GROUPS:"os.window-links.groups",WINDOW_LINK_EDGES:"os.window-links.edges",RELATED_ENTITIES_ITEMS:"os.related-entities.items",WINDOW_LINK_RENDERERS:"os.window-links.renderers",WINDOW_LINK_RENDERER:"os.window-links.renderer",EDITOR_PREVIEW_WINDOW_CONFIG:"os.editor-preview.window-config",EDITOR_PREVIEW_LIVE:"os.editor-preview.live",EDITOR_PREVIEW_OPENED:"os.editor-preview.opened",EDITOR_PREVIEW_CLOSED:"os.editor-preview.closed",REVISIONS_WINDOW_CONFIG:"os.revisions.window-config",REVISIONS_OPENED:"os.revisions.opened",FILE_DROP_FILES_DETECTED:"os.drop.files-detected",FILE_DROP_FILES_REJECTED:"os.drop.files-rejected",FILE_DROP_DIALOG_FIELDS:"os.drop.dialog-fields",FILE_DROP_BEFORE_UPLOAD:"os.drop.before-upload",FILE_DROP_UPLOAD_STARTED:"os.drop.upload-started",FILE_DROP_UPLOAD_PROGRESS:"os.drop.upload-progress",FILE_DROP_AFTER_UPLOAD:"os.drop.after-upload",FILE_DROP_UPLOAD_FAILED:"os.drop.upload-failed",AUTH_LOST:"os.auth.lost",AUTH_RESTORED:"os.auth.restored",MODE_CHANGED:"os.mode.changed",SESSION_SNAPSHOT:"os.session.snapshot"};function Si(o,e){if(!o||typeof o!="object")return["def (not an object)"];const t=o,s=[];for(const i of e)i.valid(t)||s.push(`${i.field} (${i.message})`);return s}class fa extends Error{constructor(e,t,s){super(`[openstation] ${e} registration rejected — fields: `+t.join(", ")+"."),this.name="RegistrationError",this.kind=e,this.errors=t,this.def=s}}function ws(o,e,t){if(e.length!==0)throw new fa(o,e,t)}const Li="__openStationSharedStores";function ba(){const o=window;let e=o[Li];return e||(e=new Map,o[Li]=e),e}function K(o,e){const t=ba();let s=t.get(o);s||(s={state:e(),listeners:new Set,rebuild:e},t.set(o,s));const i={get state(){return s.state},set state(n){s.state=n},getState(){return s.state},notify(){for(const n of Array.from(s.listeners))try{n(s.state)}catch(r){console.error(`[desktop-mode/shared-store:${o}] subscriber threw:`,r)}},subscribe(n){return s.listeners.add(n),()=>{s.listeners.delete(n)}},setState(n){const r=s.state;if(typeof r!="object"||r===null){console.warn(`[desktop-mode/shared-store:${o}] setState called on a primitive store; use the state setter instead.`);return}Object.assign(r,n),i.notify()},reset(){const n=s.rebuild(),r=s.state;if(typeof r=="object"&&r!==null&&typeof n=="object"&&n!==null){const a=r;for(const c of Object.keys(a))delete a[c];Object.assign(a,n)}else s.state=n;s.listeners.clear()}};return i}const Ri=K("desktop-mode/wallpaper-registry",()=>({seed:[],listeners:new Set})),Zt=Ri.state.seed,xs=Ri.state.listeners;function Ii(o){ws("Wallpaper",Si(o,Ti),o);const e=Zt.findIndex(t=>t.id===o.id);e>=0?Zt[e]=o:Zt.push(o),va()}function ma(o){return xs.add(o),()=>{xs.delete(o)}}function va(){const o=Array.from(xs);for(const e of o)try{e()}catch(t){typeof console<"u"&&console.error("[openstation] wallpaper registry listener threw:",t)}}function Di(){const o=Zt.slice(),e=ce(W.WALLPAPERS,o);return Array.isArray(e)?e.filter(_a):(typeof console<"u"&&console.warn("[openstation] `os.wallpapers` filter returned a non-array; falling back to seed list."),o)}function Ee(o){return Di().find(e=>e.id===o)}const Ti=[{field:"id",message:"missing or not a non-empty string",valid:o=>typeof o.id=="string"&&o.id!==""},{field:"label",message:"missing or not a non-empty string",valid:o=>typeof o.label=="string"&&o.label!==""},{field:"preview",message:"missing or not a non-empty string",valid:o=>typeof o.preview=="string"&&o.preview!==""},{field:"type",message:'must be "css" or "canvas"',valid:o=>o.type==="css"||o.type==="canvas"},{field:"value/resolveValue/mount",message:"css types need `value` or `resolveValue`; canvas types need `mount`",valid:o=>o.type==="css"?typeof o.value=="string"||typeof o.resolveValue=="function":o.type==="canvas"?typeof o.mount=="function":!0}];function _a(o){return Si(o,Ti).length===0}function Ni(o){let e,t;try{const i=new URL(o,document.baseURI);e=i.origin,t=i.pathname}catch{return null}if(!t)return null;const s=document.querySelectorAll("script[src]");for(const i of Array.from(s))try{const n=new URL(i.src,document.baseURI);if(n.origin===e&&n.pathname===t)return i}catch{}return null}const Pi=new Map;function ya(o){const e=Pi.get(o);if(e)return e;let t=[];try{const s=new URL(o,document.baseURI);if(s.pathname.endsWith("/load-scripts.php")){const i=[];s.searchParams.forEach((n,r)=>{if(r!=="load"&&!r.startsWith("load["))return;const a=/(\d+)/.exec(r);i.push({order:a?Number(a[1]):i.length,value:n})}),i.sort((n,r)=>n.order-r.order),t=i.map(n=>n.value).join("").split(",").map(n=>n.trim()).filter(Boolean)}}catch{}return Pi.set(o,t),t}function wa(){const o=new Set,e=document.querySelectorAll('script[src*="load-scripts.php"]');for(const t of Array.from(e))for(const s of ya(t.src))o.add(s);return o}function zi(o){return o.url&&Ni(o.url)?!0:!!o.handle&&wa().has(o.handle)}const Yt=new Map;function ks(o,e){const t=Yt.get(o);if(t)return t;const s=e?.deps;if(s&&s.length>0){const n=a=>!a.url||zi(a)?Promise.resolve():ks(a.url,{...a,deps:void 0}),r=s.reduce((a,c)=>a.then(()=>n(c)),Promise.resolve(void 0)).then(()=>Mi(o,e));return Yt.set(o,r),r}const i=Mi(o,e);return Yt.set(o,i),i}function Mi(o,e){return new Promise((t,s)=>{const i=`script[data-os-vendor="${xa(o)}"]`,n=document.querySelector(i);if(n){if(n.dataset.loaded==="1"){t();return}n.addEventListener("load",()=>t(),{once:!0}),n.addEventListener("error",()=>s(new Error(`Failed to load ${o}`)),{once:!0});return}const r=Ni(o);if(r){r.dataset.osVendor=o,r.dataset.loaded="1",t();return}if(zi({handle:e?.handle})){t();return}e?.translations&&Qt(e.translations);for(const c of e?.l10n??[])Qt(c);for(const c of e?.before??[])Qt(c);const a=document.createElement("script");a.src=o,a.async=!0,a.dataset.osVendor=o,a.addEventListener("load",()=>{a.dataset.loaded="1";for(const c of e?.after??[])Qt(c);t()},{once:!0}),a.addEventListener("error",()=>{Yt.delete(o),a.remove(),s(new Error(`Failed to load ${o}`))},{once:!0}),document.head.appendChild(a)})}function Qt(o){if(!o)return;const e=document.createElement("script");e.textContent=o,e.dataset.osVendorInline="1",document.head.appendChild(e)}function xa(o){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(o):o.replace(/["\\]/g,"\\$&")}const fe=K("desktop-mode/wallpaper-lazy",()=>({pending:new Map,inflight:new Map}));function ka(o){fe.state.pending.delete(o)}function $a(o){return(window.openStationWallpapers||{})[o]??null}function Ea(o){const e=fe.state.inflight.get(o);if(e)return e;const t=fe.state.pending.get(o);if(!t)return Promise.resolve(null);const s=(async()=>{try{await ks(t.scriptUrl,{translations:t.scriptTranslations,l10n:t.scriptL10n,before:t.scriptBefore,after:t.scriptAfter})}catch(n){return de(W.SHELL_ERROR,{scope:"wallpaper-script-load",id:t.id,error:n}),null}let i=$a(t.id);if(i&&!i.description&&t.description&&(i={...i,description:t.description}),!i)return de(W.SHELL_ERROR,{scope:"wallpaper-missing-def",id:t.id,error:new Error(`[openstation] No wallpaper def on window.openStationWallpapers["${t.id}"]. Script loaded but didn't publish a def — check the plugin's enqueue + global assignment.`)}),null;try{Ii(i)}catch(n){return de(W.SHELL_ERROR,{scope:"wallpaper-register",id:t.id,error:n}),null}return ka(t.id),i})().finally(()=>{fe.state.inflight.delete(o)});return fe.state.inflight.set(o,s),s}async function Aa(){const o=Array.from(fe.state.pending.keys());o.length!==0&&await Promise.all(o.map(e=>Ea(e)))}const Oi=K("desktop-mode/dock-rail-registry",()=>({registry:new Map,listeners:new Set,activeId:"default"})),Wi=Oi.state.registry,Hi=Oi.state.listeners;function Ca(o){return Wi.get(o)}function Sa(){return Array.from(Wi.values())}function La(o){return Hi.add(o),()=>{Hi.delete(o)}}function Ra(o){o.style.setProperty("--os-file-tile-enter-delay",`${(Math.random()*.25).toFixed(3)}s`),o.style.setProperty("--os-file-tile-enter-duration",`${(.3+Math.random()*.25).toFixed(3)}s`)}function Ui(o){if(!o)return 214;let e=5381;for(let t=0;t<o.length;t++)e=Math.imul(e,33)+o.charCodeAt(t);return(e%360+360)%360}const qi="X-WP-Nonce";function Ia(o,e){const t=Da();if(!t)return e;const s=Ta(o);if(!s||!Na(s))return e;const i=e?.headers??(typeof Request<"u"&&o instanceof Request?o.headers:void 0),n=new Headers(i??{});return n.has(qi)?e:(n.set(qi,t),{...e??{},headers:n})}function Da(){if(typeof window>"u")return;const e=window.openStationConfig?.restNonce;return typeof e=="string"&&e.length>0?e:void 0}function Ta(o){try{const e=typeof window<"u"&&window.location?window.location.href:void 0;return typeof o=="string"?new URL(o,e):o instanceof URL?o:typeof Request<"u"&&o instanceof Request?new URL(o.url,e):null}catch{return null}}function Na(o){return typeof window>"u"||!window.location||o.origin!==window.location.origin?!1:!!(o.pathname.includes("/wp-json/")||o.searchParams.has("rest_route"))}function Pa(o,e,t={}){const s=window.wp?.os?.fetch;if(typeof s=="function")return s(o,e,t);const i=Ia(o,e);return fetch(o,i)}const oe=[[0,0],[100,0],[100,100],[0,100]],za=48,Ma=80,$s=6,Es=8,Fi=4,Vi=3,Ki=64,As=105,ie=2;function ji(o){return`${Math.round(o*1e3)/1e3}%`}function ne(o){return o.slice().reverse()}function Ae(o,e,t,s){return[[o,e],[t,e],[t,s],[o,s]]}function Oa(o,e,t,s){const i=[];for(let n=0;n<s;n++){const r=n/s*Math.PI*2;i.push([o+Math.cos(r)*t,e+Math.sin(r)*t])}return i}function j(o,e=[]){const t=[],s=i=>{t.push(`${ji(i[0])} ${ji(i[1])}`)};for(const i of o)s(i);if(e.length>0){s(o[0]);for(const i of e){for(const n of i)s(n);s(i[0]),s(o[0])}}return`polygon( ${t.join(", ")} )`}function Bi(o){return j(oe,[ne(Oa(50,50,o,za))])}function Gi(o){return j(oe,[ne(Ae(50-o,-ie,50+o,100+ie))])}function Xi(o){const e=100/$s,t=[];for(let s=0;s<$s;s++){const i=s*e;t.push(ne(Ae(-ie,i,100+ie,i+o)))}return j(oe,t)}function Zi(o){return j(oe,[ne(Ae(-ie,50-o,100+ie,50+o))])}function Yi(o){const e=100/Es,t=[];for(let s=0;s<Es;s++){const i=s*e;t.push(ne(Ae(i,-ie,i+o,100+ie)))}return j(oe,t)}function Qi(o){return j(oe,[ne([[50,50-o],[50+o,50],[50,50+o],[50-o,50]])])}function Ji(o){const e=100/Fi,t=100/Vi,s=[];for(let i=0;i<Vi;i++)for(let n=0;n<Fi;n++){const r=n*e+e/2,a=i*t+t/2,c=e/2*o,u=t/2*o;s.push(ne(Ae(r-c,a-u,r+c,a+u)))}return j(oe,s)}function en(o){const e=-Math.PI/2,t=o/180*Math.PI,s=[[50,50]];for(let i=0;i<Ki;i++){const n=e+i/(Ki-1)*t;s.push([50+Math.cos(n)*As,50+Math.sin(n)*As])}return j(oe,[ne(s)])}function Wa(){return{from:Bi(0),to:Bi(Ma)}}function Ha(){return{from:Gi(0),to:Gi(52)}}function Ua(){return{from:Xi(0),to:Xi(100/$s+.5)}}function qa(){return{from:Zi(0),to:Zi(52)}}function Fa(){return{from:Yi(0),to:Yi(100/Es+.5)}}function Va(){return{from:Qi(0),to:Qi(As)}}function Ka(){return{from:Ji(0),to:Ji(1.04)}}function ja(){return{from:en(0),to:en(360)}}function Ba(){return{from:"inset( 0% 0% 0% 0% )",to:"inset( 0% 0% 100% 0% )"}}function Ga(){return{from:"inset( 0% 0% 0% 0% )",to:"inset( 0% 0% 0% 100% )"}}function Xa(){return{from:j([[-60,0],[100,0],[100,100],[0,100]]),to:j([[100,0],[260,0],[260,100],[160,100]])}}const Cs=6,Ss=100,be=Ss/2,Jt=200,tn=90,sn=["#5c5c6d","#525261","#484855","#3e3e49","#34343d","#2a2a31"],Za="#101014",Ya=1.25,me="http://www.w3.org/2000/svg";let Qa=0;function es(o){return Math.round(o*1e3)/1e3}function Ls(o){return o/Cs*Math.PI*2-Math.PI/2}function Ja(o){const t=Ls(o)+Math.PI/Cs+Math.PI/2;return{x:Math.cos(t),y:Math.sin(t)}}function el(o){const e=Ls(o),t=Ls(o+1);return[[be,be],[be+Math.cos(e)*Jt,be+Math.sin(e)*Jt],[be+Math.cos(t)*Jt,be+Math.sin(t)*Jt]]}function on(o,e){const t=el(o),s=document.createElementNS(me,"path");return s.setAttribute("d",`M ${t.map(([i,n])=>`${es(i)} ${es(n)}`).join(" L ")} Z`),e?s.setAttribute("fill","#fff"):(s.setAttribute("fill",sn[o%sn.length]),s.setAttribute("stroke",Za),s.setAttribute("stroke-width",String(Ya)),s.setAttribute("vector-effect","non-scaling-stroke"),s.setAttribute("stroke-linejoin","round")),s}function tl(){const o=`os-iris-${++Qa}`,e=document.createElementNS(me,"svg");e.setAttribute("viewBox",`0 0 ${Ss} ${Ss}`),e.setAttribute("preserveAspectRatio","none"),e.setAttribute("aria-hidden","true"),e.style.width="100%",e.style.height="100%",e.style.display="block";const t=document.createElementNS(me,"defs"),s=document.createElementNS(me,"mask");s.setAttribute("id",o);const i=document.createElementNS(me,"g"),n=document.createElementNS(me,"g");n.setAttribute("mask",`url(#${o})`);const r=[];for(let c=0;c<Cs;c++){const u=on(c,!0),h=on(c,!1);i.appendChild(u),n.appendChild(h),r.push({el:u,index:c},{el:h,index:c})}s.appendChild(i),t.appendChild(s),e.appendChild(t),e.appendChild(n);const a=document.createElement("div");return a.appendChild(e),{element:a,play:c=>r.map(({el:u,index:h})=>{const p=Ja(h),g=es(p.x*tn),m=es(p.y*tn);return u.animate([{transform:"translate( 0px, 0px )"},{transform:`translate( ${g}px, ${m}px )`}],{duration:c.duration,easing:c.easing,delay:c.delay,fill:"both"})})}}const ts="none",nn=K("desktop-mode/window-reveal-registry",()=>({registry:new Map,listeners:new Set})),Rs=nn.state.registry,Is=nn.state.listeners,rn=/^[a-z0-9_/-]+$/;function an(o){const e=/^\s*([a-zA-Z-]+)\s*\(/.exec(o);return e?e[1].toLowerCase():""}const sl=0;function ln(o,e){const t=[],s=typeof o.from=="string"&&o.from.trim()!=="",i=typeof o.to=="string"&&o.to.trim()!=="";if(s||t.push(`${e}.from (missing — the clip-path covering the window)`),i||t.push(`${e}.to (missing — the clip-path uncovering the window)`),s&&i){const n=an(o.from),r=an(o.to);n===""||r===""?t.push(`${e}.from|to (must be shape functions, e.g. \`inset( … )\` or \`polygon( … )\` — bare keywords like \`none\` cannot be animated)`):n!==r&&t.push(`${e}.from|to (must use the same shape function to interpolate — got \`${n}()\` and \`${r}()\`)`)}return t}function ol(o){if(typeof KeyframeEffect!="function")return!0;try{return new KeyframeEffect(null,null,{easing:o}),!0}catch{return!1}}function F(o){const e=[];if(!o||typeof o!="object")e.push("def (not an object)");else{typeof o.id!="string"||o.id.trim()===""?e.push("id (missing)"):rn.test(o.id.trim().toLowerCase())?o.id.trim().toLowerCase()===ts&&e.push('id ("none" is reserved)'):e.push(`id (must match ${rn} — lowercase alphanum, hyphens, underscores, slashes for vendor/sub-id)`),(typeof o.label!="string"||o.label.trim()==="")&&e.push("label (missing)");const s=o.render!==void 0,i=Array.isArray(o.layers),n=o.from!==void 0||o.to!==void 0;s&&typeof o.render!="function"?e.push("render (not a function)"):s&&(i||n)?e.push("render|layers|from|to (supply exactly one of: a from/to pair, a layers array, or a render function)"):s||(i&&n?e.push("layers|from|to (supply EITHER a single from/to pair OR a layers array, not both)"):i?(o.layers.length===0&&e.push("layers (empty — supply at least one matched pair)"),o.layers.forEach((r,a)=>{if(!r||typeof r!="object"){e.push(`layers[ ${a} ] (not an object)`);return}e.push(...ln(r,`layers[ ${a} ]`))})):e.push(...ln(o,"").map(r=>r.replace(/^\./,"")))),o.easing!==void 0&&(typeof o.easing!="string"||o.easing.trim()===""?e.push("easing (not a non-empty string)"):ol(o.easing)||e.push("easing (not an easing the browser can parse — `Element.animate()` would throw at play time, with the covering surface already over the window)"))}ws("WindowReveal",e,o);const t=o.id.trim().toLowerCase();Rs.set(t,{...o,id:t}),al()}function il(){const o=Array.from(Rs.values()),e=ce(W.WINDOW_REVEALS,o);return Array.isArray(e)?e:(typeof console<"u"&&console.warn("[openstation] `os.window-reveals` filter returned a non-array; falling back to registry list."),o)}function nl(o){return Rs.has(o)}function rl(o){return Is.add(o),()=>{Is.delete(o)}}function al(){const o=Array.from(Is);for(const e of o)try{e()}catch(t){typeof console<"u"&&console.error("[openstation] window-reveal registry listener threw:",t)}}F({id:"sweep",label:d("Sweep"),description:d("A straight edge travels across the window, uncovering the page behind it."),...Ga(),duration:420}),F({id:"iris",label:d("Iris"),description:d("The page opens out from the centre of the window, like a camera shutter."),...Wa(),duration:520}),F({id:"curtain",label:d("Curtain"),description:d("Two panels part from the middle of the window and slide off the sides."),...Ha(),duration:480}),F({id:"blinds",label:d("Blinds"),description:d("Six horizontal slats retract at once, letting the page through between them."),...Ua(),duration:560}),F({id:"diagonal",label:d("Diagonal"),description:d("A slanted edge sweeps off the trailing corner of the window."),...Xa(),duration:460}),F({id:"rise",label:d("Rise"),description:d("The page rises into the window from the bottom edge upward."),...Ba(),duration:440}),F({id:"shutter",label:d("Shutter"),description:d("Two panels part from the middle of the window and slide off the top and bottom."),...qa(),duration:480}),F({id:"slats",label:d("Slats"),description:d("Eight vertical slats retract at once, letting the page through between them."),...Fa(),duration:560}),F({id:"diamond",label:d("Diamond"),description:d("The page opens out from the centre of the window through a growing rhombus."),...Va(),duration:520}),F({id:"mosaic",label:d("Mosaic"),description:d("The page arrives as a grid of tiles, each opening out from its own centre."),...Ka(),duration:600}),F({id:"obturator",label:d("Camera shutter"),description:d("Six wedges slide aside in unison, opening a hexagonal aperture from the centre like the iris of a camera lens."),render:tl,duration:720,edgeLag:0}),F({id:"radar",label:d("Radar"),description:d("A spoke sweeps a full turn around the centre of the window, uncovering the page behind it."),...ja(),duration:760});const ll="desktop-mode-os-settings",Ds=1920,Ts=1080,cl=40,dl=300,ss="custom-gradient",re="custom-image",ul="galaxy",Ce="custom",cn=[{id:"pulse",label:"Pulse",value:"#f252fc"},{id:"nebula",label:"Nebula",value:"#ec9bff"},{id:"sirius",label:"Sirius",value:"#9af2ff"},{id:"lagoon",label:"Lagoon",value:"#9f98ff"},{id:"wp-blue",label:"WordPress Blue",value:"#2271b1"},{id:"indigo",label:"Indigo",value:"#3858e9"},{id:"teal",label:"Teal",value:"#04a4cc"},{id:"emerald",label:"Emerald",value:"#059669"},{id:"amber",label:"Amber",value:"#d97706"},{id:"rose",label:"Rose",value:"#e11d48"}];function Ns(){const e=window.wp?.os?.config?.accentColors;if(!Array.isArray(e)||e.length===0)return cn;const t=[];for(const s of e)s&&typeof s=="object"&&typeof s.id=="string"&&typeof s.label=="string"&&typeof s.value=="string"&&s.id!==""&&s.label!==""&&/^#[0-9a-f]{3,8}$/i.test(s.value)&&t.push({id:s.id,label:s.label,value:s.value});return t.length>0?t:cn}function hl(){const e=window.wp?.os?.config?.defaultWallpaper;return typeof e=="string"&&e!==""?e:ul}const dn=[{id:"compact",label:"Compact",width:48,icon:18},{id:"default",label:"Default",width:56,icon:20},{id:"large",label:"Large",width:72,icon:26}],un=[{id:"sharp",label:"Sharp",value:0},{id:"default",label:"Default",value:8},{id:"round",label:"Round",value:16}],hn=[{id:"static",label:"Static"},{id:"dynamic",label:"Dynamic"},{id:"hidden",label:"Hidden"}],Ps=[{id:"static",label:"Static"},{id:"dynamic",label:"Dynamic"}],pn=[{id:"bottom",label:"Bottom"},{id:"left",label:"Left"},{id:"right",label:"Right"}],pl=[{id:"unified",label:"Unified"},{id:"classic",label:"Split"}],gn={dockSize:["compact","default","large"],desktopLayout:["classic","unified"],dockPlacement:["bottom","left","right"],windowRadius:["sharp","default","round"],adminBarMode:["static","dynamic","hidden"]},fn=["dockRailRenderer","windowReveal","accent"],bn={windowRevealDuration:{min:80,max:4e3}},gl=/^[a-z0-9_-]+$/;[...Object.keys(gn),...fn,...Object.keys(bn)];function mn(o){if(!o||typeof o!="object"||Array.isArray(o))return{};const e=o,t={},s={};for(const[i,n]of Object.entries(gn)){const r=e[i];typeof r=="string"&&n.includes(r)&&(t[i]=r)}for(const i of fn){const n=e[i];typeof n=="string"&&gl.test(n)&&(t[i]=n)}for(const[i,n]of Object.entries(bn)){const r=e[i];typeof r=="number"&&Number.isFinite(r)&&(s[i]=Math.min(n.max,Math.max(n.min,Math.round(r))))}return{...t,...s}}function vn(o){const e=mn(o);return typeof e.dockRailRenderer=="string"&&Ca(e.dockRailRenderer)===void 0&&delete e.dockRailRenderer,typeof e.windowReveal=="string"&&e.windowReveal!==ts&&!nl(e.windowReveal)&&delete e.windowReveal,typeof e.accent=="string"&&!Ns().some(t=>t.id===e.accent)&&delete e.accent,e}const fl=/^[a-z0-9_-]+$/,_n=128;function bl(o){return typeof o!="string"||o===""||o.length>2048?!1:o.startsWith("dashicons-")||o.startsWith("https://")||o.startsWith("http://")||o.startsWith("data:image/")}function yn(o){if(!o||typeof o!="object")return null;const e=o,t=typeof e.slug=="string"?e.slug:"";if(!fl.test(t))return null;const s={};if(e.icons&&typeof e.icons=="object"){let c=0;for(const[u,h]of Object.entries(e.icons)){if(c>=_n)break;u===""||!bl(h)||(s[u]=h,c+=1)}}const i={};if(e.tokens&&typeof e.tokens=="object")for(const[c,u]of Object.entries(e.tokens))typeof u=="string"&&(i[c]=u);const n=[];if(Array.isArray(e.fonts))for(const c of e.fonts)typeof c=="string"&&c!==""&&n.push(c);const r={};if(e.iconColors&&typeof e.iconColors=="object"){let c=0;for(const[u,h]of Object.entries(e.iconColors)){if(c>=_n)break;u===""||typeof h!="string"||h===""||(r[u]=h,c+=1)}}const a=c=>typeof e[c]=="string"?e[c]:"";return{id:a("id")||t,slug:t,name:a("name")||t,version:a("version"),author:a("author"),description:a("description"),previewUrl:a("previewUrl"),cssUrl:a("cssUrl"),cssText:a("cssText"),tokens:i,fonts:n,icons:s,iconColors:r,recommendedOsSettings:mn(e.recommendedOsSettings),installedAt:typeof e.installedAt=="number"?e.installedAt:0,source:e.source==="code"?"code":"upload",cssDeferred:e.cssDeferred===!0}}function ml(){const e=window.openStationConfig?.serverDesktopThemes,t=[];if(Array.isArray(e))for(const s of e){const i=yn(s);i&&t.push(i)}return{themes:t,activeId:null,activeIcons:null,activeIconColors:null}}const J=K("desktop-mode/desktop-themes",ml);function wn(){return J}function vl(){return J.getState().themes.slice()}function _l(o){if(typeof o!="string"||o==="")return null;const e=o.replace(/\//g,"-");return J.getState().themes.find(t=>t.slug===e||t.id===o)??null}function yl(o){const e=yn(o);if(!e)return null;const t=J.state.themes.slice(),s=t.findIndex(i=>i.slug===e.slug);return s>=0?t[s]=e:t.push(e),t.sort((i,n)=>i.name.localeCompare(n.name)),J.setState({themes:t}),e}function wl(o){const e=J.state.themes.filter(t=>t.slug!==o);e.length!==J.state.themes.length&&J.setState({themes:e})}function xl(o){return J.subscribe(o)}function kl(o){const e=wn().state;if(e.activeIcons===null||!o)return null;const t=e.activeIcons[o];if(typeof t!="string"||t==="")return null;const s=ce(W.DESKTOP_THEME_ICON,t,{slot:o,themeId:e.activeId??""});return typeof s=="string"&&s!==""?s:null}function $l(o){const e=wn().state;if(e.activeIconColors===null||!o)return null;const t=e.activeIconColors[o];if(typeof t!="string"||t==="")return null;const s=ce(W.DESKTOP_THEME_ICON_COLOR,t,{slot:o,themeId:e.activeId??""});return typeof s=="string"&&s!==""?El(s):null}function El(o){const e=o.trim();if(e===""||e.length>64||/[;{}<>"'\\]/.test(e))return null;let t=0;for(const s of e)if(s==="(")t+=1;else if(s===")"&&(t-=1,t<0))return null;return t===0?e:null}function Al(o){return typeof o!="string"||o===""||o.length>4096||!/^(https?:\/\/|data:image\/)/i.test(o)?!1:!/['"()\\<>\s]/.test(o)}function xn(o,e,t){if(!Al(e))return!1;const s=`url("${e}") center / contain no-repeat`;return o.style.backgroundImage="none",o.style.backgroundColor=t,o.style.setProperty("-webkit-mask",s),o.style.setProperty("mask",s),!0}const Se={OS_SETTINGS:"OS_SETTINGS",RECYCLE_BIN:"RECYCLE_BIN",BUG_REPORT:"BUG_REPORT",EXIT_OPENSTATION:"EXIT_OPENSTATION",PWA_INSTALL:"PWA_INSTALL"},Cl={"desktop-mode-os-settings":Se.OS_SETTINGS,"desktop-mode-recycle-bin":Se.RECYCLE_BIN,"desktop-mode-bug-report":Se.BUG_REPORT,"os-exit":Se.EXIT_OPENSTATION,"os-pwa-install":Se.PWA_INSTALL};function Sl(o){if(typeof o!="string"||o==="")return"";const e=Cl[o];if(e)return e;const t=o.toLowerCase().replace(/[^a-z0-9_-]/g,"");return t===""?"":`APP:${t}`}K("desktop-mode/native-url-remap",()=>({remaps:[],deps:null}));const Ll={core:"rail",plugin:"rail",app:"desktop",control:"rail"};function Rl(o,e){return o==="core"&&e==="classic"?"sidebar":"dock"}function Il(o,e){return o.locked?"rail":e[o.id]??o.defaultPlacement??Ll[o.kind]}function Dl(o){return o.map((e,t)=>({item:e,index:t})).sort((e,t)=>(e.item.order??0)-(t.item.order??0)||e.index-t.index).map(e=>e.item)}function Tl(){return window.wp?.os??null}function Nl(){return Tl()?.getNavItems?.()??[]}const zs="none",kn=K("desktop-mode/unfocus-effect-registry",()=>({registry:new Map,listeners:new Set})),$n=kn.state.registry,Ms=kn.state.listeners,En=/^[a-z0-9_/-]+$/;function Os(o){const e=[];!o||typeof o!="object"?e.push("def (not an object)"):(typeof o.id!="string"||o.id.trim()===""?e.push("id (missing)"):En.test(o.id.trim().toLowerCase())?o.id.trim().toLowerCase()===zs&&e.push('id ("none" is reserved)'):e.push(`id (must match ${En} — lowercase alphanum, hyphens, underscores, slashes for vendor/sub-id)`),(typeof o.label!="string"||o.label.trim()==="")&&e.push("label (missing)"),typeof o.className!="string"&&typeof o.apply!="function"&&e.push("className|apply (at least one must be provided — a CSS class to toggle or an apply callback)")),ws("UnfocusEffect",e,o);const t=o.id.trim().toLowerCase();$n.set(t,{...o,id:t}),Ml()}function Pl(){const o=Array.from($n.values()),e=ce(W.UNFOCUS_EFFECTS,o);return Array.isArray(e)?e:(typeof console<"u"&&console.warn("[openstation] `os.unfocus-effects` filter returned a non-array; falling back to registry list."),o)}function zl(o){return Ms.add(o),()=>{Ms.delete(o)}}function Ml(){const o=Array.from(Ms);for(const e of o)try{e()}catch(t){typeof console<"u"&&console.error("[openstation] unfocus-effect registry listener threw:",t)}}Os({id:"darken",label:d("Darken"),description:d("Dim unfocused windows so the focused one stands out."),className:"os-window--fx-darken"}),Os({id:"frost",label:d("Frost"),description:d("Throw unfocused windows out of focus — a soft, frosted-glass blur, as if you were looking at them through an iced-over pane."),className:"os-window--fx-frost"}),Os({id:"grayscale",label:d("Grayscale"),description:d("Drain the colour from unfocused windows so the focused one is the only thing still in colour — your eye snaps right to it."),className:"os-window--fx-grayscale"});const An="none",Cn=K("desktop-mode/window-link-renderer-registry",()=>({registry:new Map,listeners:new Set})),Ol=Cn.state.registry,Sn=Cn.state.listeners;function Wl(){const o=Array.from(Ol.values()),e=ce(W.WINDOW_LINK_RENDERERS,o);return Array.isArray(e)?e:(typeof console<"u"&&console.warn("[openstation] `os.window-links.renderers` filter returned a non-array; falling back to registry list."),o)}function Hl(o){return Sn.add(o),()=>{Sn.delete(o)}}let ue=null;function Ul(){if(ue)return ue;if(window.openStationWindowLinkVisuals)return ue=Promise.resolve(!0),ue;const e=window.openStationConfig?.windowLinkVisualsBundleUrl;return e?(ue=ks(e).then(()=>!0).catch(t=>{throw ue=null,t}),ue):Promise.resolve(!1)}const Ln=K("desktop-mode/settings-tab-registry",()=>({registry:new Map,listeners:new Set})),ql=Ln.state.registry,Rn=Ln.state.listeners;function Fl(){return Array.from(ql.values()).sort((o,e)=>(o.order??100)-(e.order??100))}function Vl(o){return Rn.add(o),()=>{Rn.delete(o)}}function Ws(o){const{from:e,to:t,angle:s}=o.customGradient;return`linear-gradient(${s}deg, ${e}, ${t})`}function Kl(o,e){Ii({id:ss,label:d("Custom gradient"),type:"css",preview:Ws(o()),description:d("Mix your own two-colour gradient and set the angle — your desk, your palette."),resolveValue:()=>Ws(o()),...e?{renderEditor:e}:{}})}const In={close:{a:'fill="currentColor"',b:'<path d="m13.06 12 6.47-6.47-1.06-1.06L12 10.94 5.53 4.47 4.47 5.53 10.94 12l-6.47 6.47 1.06 1.06L12 13.06l6.47 6.47 1.06-1.06L13.06 12Z" />'},check:{a:'fill="currentColor"',b:'<path d="M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z" />'},"chevron-right":{a:'fill="currentColor"',b:'<path d="M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" />'},"arrow-up-right":{a:'fill="currentColor"',b:'<path d="M10 6H18V14H16.5V8.5L7 18L6 17L15.5 7.5H10V6Z" />'},plus:{a:'fill="currentColor"',b:'<path d="M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" />'},search:{a:'fill="currentColor"',b:'<path d="M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z" />'},pin:{a:'fill="currentColor"',b:'<path d="m21.5 9.1-6.6-6.6-4.2 5.6c-1.2-.1-2.4.1-3.6.7-.1 0-.1.1-.2.1-.5.3-.9.6-1.2.9l3.7 3.7-5.7 5.7v1.1h1.1l5.7-5.7 3.7 3.7c.4-.4.7-.8.9-1.2.1-.1.1-.2.2-.3.6-1.1.8-2.4.6-3.6l5.6-4.1zm-7.3 3.5.1.9c.1.9 0 1.8-.4 2.6l-6-6c.8-.4 1.7-.5 2.6-.4l.9.1L15 4.9 19.1 9l-4.9 3.6z" />'},trash:{a:'fill="currentColor"',b:'<path fill-rule="evenodd" clip-rule="evenodd" d="M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z" />'},download:{a:'fill="currentColor"',b:'<path d="M18 11.3l-1-1.1-4 4V3h-1.5v11.3L7 10.2l-1 1.1 6.2 5.8 5.8-5.8zm.5 3.7v3.5h-13V15H4v5h16v-5h-1.5z" />'},settings:{a:'fill="currentColor"',b:'<path d="m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z" /><path d="m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z" />'},info:{a:'fill="currentColor"',b:'<path fill-rule="evenodd" clip-rule="evenodd" d="M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm.75 4v1.5h-1.5V8h1.5Zm0 8v-5h-1.5v5h1.5Z" />'},bell:{a:'fill="currentColor"',b:'<path fill-rule="evenodd" clip-rule="evenodd" d="M17 11.5c0 1.353.17 2.368.976 3 .266.209.602.376 1.024.5v1H5v-1c.422-.124.757-.291 1.024-.5.806-.632.976-1.647.976-3V9c0-2.8 2.2-5 5-5s5 2.2 5 5v2.5ZM15.5 9v2.5c0 .93.066 1.98.515 2.897l.053.103H7.932a4.018 4.018 0 0 0 .053-.103c.449-.917.515-1.967.515-2.897V9c0-1.972 1.528-3.5 3.5-3.5s3.5 1.528 3.5 3.5Zm-5.492 9.008c0-.176.023-.346.065-.508h3.854A1.996 1.996 0 0 1 12 20c-1.1 0-1.992-.892-1.992-1.992Z" />'},more:{a:'fill="currentColor"',b:'<path d="M11 13h2v-2h-2v2zm-6 0h2v-2H5v2zm12-2v2h2v-2h-2z" />'},maximize:{a:'fill="currentColor"',b:'<path d="M6 4a2 2 0 0 0-2 2v3h1.5V6a.5.5 0 0 1 .5-.5h3V4H6Zm3 14.5H6a.5.5 0 0 1-.5-.5v-3H4v3a2 2 0 0 0 2 2h3v-1.5Zm6 1.5v-1.5h3a.5.5 0 0 0 .5-.5v-3H20v3a2 2 0 0 1-2 2h-3Zm3-16a2 2 0 0 1 2 2v3h-1.5V6a.5.5 0 0 0-.5-.5h-3V4h3Z" />'},edit:{a:'fill="currentColor"',b:'<path d="m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z" />'},color:{a:'fill="currentColor"',b:'<path d="M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3zm-5.1 7.6c-2.5 0-4.6-2.1-4.6-4.6 0-.3.1-1 .8-2.3.5-.9 1.1-1.9 2-3.1.7-.9 1.3-1.7 1.8-2.3.7.8 1.3 1.6 1.8 2.3.8 1.1 1.5 2.2 2 3.1.7 1.3.8 2 .8 2.3 0 2.5-2.1 4.6-4.6 4.6z" />'},wallpaper:{a:'fill="currentColor"',b:'<path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z" />'},warning:{a:'fill="currentColor"',b:'<path fill-rule="evenodd" clip-rule="evenodd" d="M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm-.75 12v-1.5h1.5V16h-1.5Zm0-8v5h1.5V8h-1.5Z" />'},minimize:{a:'fill="currentColor"',b:'<path d="M5 11.25h14v1.5H5z" />'},window:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="4.125" y="5.4375" width="15.75" height="13.125" rx="1.75"/><path d="M4.125 9.8125h15.75"/><circle cx="7.275" cy="7.625" r="0.7438" fill="currentColor" stroke="none"/>'},windows:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="3.6875" y="8.5" width="11.375" height="10.0625" rx="1.75"/><path d="M3.6875 12h11.375"/><path d="M8.5 8.5V7.1875a1.75 1.75 0 0 1 1.75-1.75h7.875A1.75 1.75 0 0 1 19.875 7.1875v7a1.75 1.75 0 0 1-1.75 1.75h-3.0625"/>'},dock:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="3.25" y="8.5" width="17.5" height="7" rx="3.5"/><circle cx="7.625" cy="12" r="1.0062" fill="currentColor" stroke="none"/><circle cx="12" cy="12" r="1.0062" fill="currentColor" stroke="none"/><circle cx="16.375" cy="12" r="1.0062" fill="currentColor" stroke="none"/>'},spaces:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="3.6875" y="5.4375" width="7.4375" height="7.875" rx="1.75"/><rect x="12.875" y="5.4375" width="7.4375" height="7.875" rx="1.75"/><circle cx="9.375" cy="17.6875" r="0.7875" fill="currentColor" stroke="none"/><circle cx="12" cy="17.6875" r="0.7875" fill="currentColor" stroke="none"/><circle cx="14.625" cy="17.6875" r="0.7875" fill="currentColor" stroke="none"/>'},copilot:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<path d="M10 2.5Q10.9 8.5 17.5 10Q10.9 11.5 10 17.5Q9.1 11.5 2.5 10Q9.1 8.5 10 2.5Z" fill="currentColor" stroke="none"/><path d="M17.9 14Q18.35 17.1 21.5 17.6Q18.35 18.1 17.9 21.2Q17.45 18.1 14.3 17.6Q17.45 17.1 17.9 14Z" fill="currentColor" stroke="none"/>'},snap:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="3.6875" y="5.4375" width="16.625" height="13.125" rx="1.75"/><path d="M12 5.4375v13.125"/><path d="M12 12h8.3125"/>'},command:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<path d="M14.625 6.75v10.5a2.625 2.625 0 1 0 2.625-2.625H6.75a2.625 2.625 0 1 0 2.625 2.625V6.75a2.625 2.625 0 1 0-2.625 2.625h10.5a2.625 2.625 0 1 0-2.625-2.625"/>'},apps:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="4.125" y="4.125" width="6.5625" height="6.5625" rx="1.75"/><rect x="13.3125" y="4.125" width="6.5625" height="6.5625" rx="1.75"/><rect x="4.125" y="13.3125" width="6.5625" height="6.5625" rx="1.75"/><rect x="13.3125" y="13.3125" width="6.5625" height="6.5625" rx="1.75"/>'},widgets:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="3.6875" y="3.6875" width="9.625" height="9.625" rx="1.75"/><rect x="15.0625" y="3.6875" width="5.25" height="5.25" rx="1.75"/><rect x="15.0625" y="10.6875" width="5.25" height="9.625" rx="1.75"/><rect x="3.6875" y="15.0625" width="9.625" height="5.25" rx="1.75"/>'},user:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<circle cx="12" cy="8.9375" r="3.5"/><path d="M5.4375 19.4375a6.5625 6.5625 0 0 1 13.125 0"/>'},lock:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="5.4375" y="10.6875" width="13.125" height="8.75" rx="1.75"/><path d="M8.5 10.6875V8.0625a3.5 3.5 0 0 1 7 0v2.625"/>'}};function Dn(o){return o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function jl(o){return Object.prototype.hasOwnProperty.call(In,o)?In[o]:null}function Bl(o,e={}){const t=jl(o);if(!t)return"";const{size:s=24,className:i,title:n,rotate:r}=e,a=['xmlns="http://www.w3.org/2000/svg"','viewBox="0 0 24 24"'];s!=null&&a.push(`width="${s}"`,`height="${s}"`),a.push(t.a),i&&a.push(`class="${Dn(i)}"`),n?a.push('role="img"',`aria-label="${Dn(n)}"`):a.push('aria-hidden="true"','focusable="false"');const c=r?`<g transform="rotate(${r} 12 12)">${t.b}</g>`:t.b;return`<svg ${a.join(" ")}>${c}</svg>`}function I(o,e={}){const t=Bl(o,e),s=document.createElement("div");s.innerHTML=t;const i=s.firstElementChild;return i instanceof SVGSVGElement?i:document.createElementNS("http://www.w3.org/2000/svg","svg")}const Tn=K("desktop-mode/wallpaper-settings",()=>({values:{}}));function Nn(o){return{...Tn.state.values[o]??{}}}function Gl(o,e){Tn.state.values[o]={...e},de(W.WALLPAPER_SETTINGS_CHANGED,{id:o,settings:{...e}})}function Hs(o){return!!o&&typeof o=="object"&&typeof o.then=="function"}const Xl=4,Pn=24,zn=4,Zl=250,Yl="os-settings__wallpaper-live-preview";function Ql(o){const e=o.type==="canvas"?o.needs:void 0;if(!e||e.length===0)return Promise.resolve();const t=window.wp?.os;return t?.loadModules?t.loadModules(e):Promise.reject(new Error(`[openstation] Wallpaper "${o.id}" declares needs but wp.os.loadModules is unavailable.`))}function Jl(){return window.openStationConfig?.pluginUrl??""}function ec(){return typeof window.matchMedia=="function"&&window.matchMedia("( prefers-reduced-motion: reduce )").matches}function tc(o){const e={...o.previewParams??{}},t=ce(W.WALLPAPER_PREVIEW_PARAMS,e,o.id);return!t||typeof t!="object"?e:t}function sc(o){const e=new Map;let t=!1;const s=()=>{let f=0;return e.forEach(A=>{(A.teardown||A.mounting)&&f++}),f},i=f=>{f.remountTimer!==null&&(clearTimeout(f.remountTimer),f.remountTimer=null)},n=f=>{if(f.generation++,f.mounting=!1,i(f),f.teardown){const A=f.teardown;f.teardown=null;try{A()}catch(k){typeof console<"u"&&console.error(`[openstation] Wallpaper "${f.defId}" preview teardown threw:`,k)}}f.overlay.innerHTML=""},r=f=>{t||!f.visible||f.teardown||f.mounting||m&&(f.tile.clientWidth<Pn||f.tile.clientHeight<Pn)||a(f)},a=f=>{const A=Ee(f.defId);if(!A?.renderPreview||s()>=Xl)return;const k=++f.generation;f.mounting=!0,f.mountWidth=f.tile.clientWidth,f.mountHeight=f.tile.clientHeight;const R={id:A.id,pluginUrl:Jl(),prefersReducedMotion:ec(),visible:!document.hidden,settings:Nn(A.id),params:tc(A),width:f.mountWidth,height:f.mountHeight},X=N=>{if(k!==f.generation||t){try{N()}catch{}return}f.mounting=!1,f.teardown=N,c(f)&&u(f)},Z=N=>{k===f.generation&&(f.mounting=!1,f.overlay.innerHTML="",typeof console<"u"&&console.error(`[openstation] Wallpaper "${A.id}" renderPreview failed:`,N))};Ql(A).then(()=>{if(k!==f.generation||t)return;let N;try{N=A.renderPreview(f.overlay,R)}catch(M){Z(M);return}if(Hs(N)){N.then(X,Z);return}X(N)},Z)},c=f=>Math.abs(f.tile.clientWidth-f.mountWidth)>zn||Math.abs(f.tile.clientHeight-f.mountHeight)>zn,u=f=>{i(f),f.remountTimer=setTimeout(()=>{f.remountTimer=null,!(t||!f.teardown||!c(f))&&(n(f),r(f))},Zl)},h=f=>{for(const A of f){const k=e.get(A.target);k&&(k.visible=A.isIntersecting,A.isIntersecting?r(k):n(k))}},p=typeof IntersectionObserver=="function"?new IntersectionObserver(h,{threshold:.1}):null,g=f=>{for(const A of f){const k=e.get(A.target);!k||t||(!k.teardown&&!k.mounting?r(k):k.teardown&&c(k)&&u(k))}},m=typeof ResizeObserver=="function"?new ResizeObserver(g):null,b=f=>{n(f),p?.unobserve(f.tile),m?.unobserve(f.tile),f.overlay.remove(),e.delete(f.tile)},x=()=>{if(t)return;const f=o.querySelectorAll("os-swatch[data-wallpaper-id]"),A=new Set;f.forEach(k=>{A.add(k);const R=k.dataset.wallpaperId??"",Z=!!Ee(R)?.renderPreview&&!!p,N=e.get(k);if(N&&(N.defId!==R||!Z)&&b(N),!Z||e.has(k))return;const M=document.createElement("div");M.className=Yl,M.setAttribute("aria-hidden","true"),k.appendChild(M),e.set(k,{tile:k,overlay:M,defId:R,generation:0,teardown:null,mounting:!1,visible:!1,mountWidth:0,mountHeight:0,remountTimer:null}),p.observe(k),m?.observe(k)}),e.forEach((k,R)=>{A.has(R)||b(k)})},w=()=>{t||(t=!0,e.forEach(f=>n(f)),e.clear(),p?.disconnect(),m?.disconnect(),document.removeEventListener("os-window-closed",$))},$=()=>{o.isConnected||w()};return document.addEventListener("os-window-closed",$),{sync:x,dispose:w}}const le=class le extends HTMLElement{constructor(){super(),this._renderScheduled=!1,this._propValues={},this.constructor.shadow?(this.attachShadow({mode:"open"}),this._renderRoot=this.shadowRoot):this._renderRoot=this,this._installPropAccessors()}static get observedAttributes(){return this.props.map(Mn)}connectedCallback(){this._adoptStyles(),this.requestUpdate()}attributeChangedCallback(e,t,s){if(t===s)return;const i=oc(e);this._propValues[i]=s,this.requestUpdate()}get classNames(){return Array.from(this.classList)}set classNames(e){if(e==null){this.removeAttribute("class");return}const s=(Array.isArray(e)?e:String(e).split(/\s+/)).map(i=>String(i).trim()).filter(i=>i!=="");this.className=s.join(" ")}requestUpdate(){this._scheduleRender()}emit(e,t){return this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}_installPropAccessors(){const e=this.constructor;for(const t of e.props){if(Object.getOwnPropertyDescriptor(this,t))continue;const s=Mn(t);Object.defineProperty(this,t,{get:()=>t in this._propValues?this._propValues[t]:this.getAttribute(s),set:i=>{let n;i==null||i===!1?n=null:i===!0?n="":n=String(i),this._propValues[t]=n,n===null?this.removeAttribute(s):this.setAttribute(s,n),this.requestUpdate()},enumerable:!0,configurable:!0})}}_scheduleRender(){this._renderScheduled||!this.isConnected||(this._renderScheduled=!0,queueMicrotask(()=>{this._renderScheduled=!1,this.isConnected&&ge(this.render(),this._renderRoot)}))}_adoptStyles(){const e=this.constructor;if(e.styles.length!==0)if(e.shadow&&this.shadowRoot){const t=e.styles.map(s=>s.sheet).filter(s=>s!==null);if(this.shadowRoot.adoptedStyleSheets=t,t.length!==e.styles.length){for(const s of e.styles)if(!s.sheet){const i=document.createElement("style");i.textContent=s.cssText,this.shadowRoot.appendChild(i)}}}else this._adoptLightStyles(e)}_adoptLightStyles(e){if(!le._lightStylesAdopted.has(e)){le._lightStylesAdopted.add(e);for(const t of e.styles){const s=document.createElement("style");s.dataset.osUi=this.tagName.toLowerCase(),s.textContent=t.cssText,document.head.appendChild(s)}}}};le.props=[],le.styles=[],le.shadow=!0,le._lightStylesAdopted=new WeakSet;let _=le;function y(o,e){customElements.get(o)||customElements.define(o,e)}function Mn(o){return o.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function oc(o){return o.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}const ic=(()=>{try{return typeof new CSSStyleSheet().replaceSync=="function"}catch{return!1}})();function v(o,...e){let t=o[0];for(let s=1;s<o.length;s++){const i=e[s-1];if(typeof i=="string"||typeof i=="number")t+=String(i);else if(i&&i.__wpdCss)t+=i.cssText;else throw new TypeError("[os-ui] css`` interpolations must be strings, numbers, or other css`` results. Got: "+typeof i);t+=o[s]}if(ic){const s=new CSSStyleSheet;return s.replaceSync(t),{__wpdCss:!0,sheet:s,cssText:t}}return{__wpdCss:!0,sheet:null,cssText:t}}function nc(o){const e=[],t=[];let s=null,i=o.parentElement;for(;i&&!(i===document.body||i===document.documentElement);){const r=i.id||"";if(r.startsWith("wp-window-")){s=r.slice(10);break}if(i.tagName.toLowerCase()==="os-tabpanel"){const a=i.getAttribute("for");a&&t.unshift(a)}i=i.parentElement}s&&e.push(Us(s));for(const r of t)e.push("tab-"+Us(r));const n=o.getAttribute("label");return n&&e.push(Us(n)),e.length===0?"os-unnamed":"os-"+e.filter(r=>r!=="").join("-")}function Us(o){return o.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Le(o){if(o.id)return o.id;const e=nc(o);return o.id=e,e}const S=v`:host{--_holo-fill:var( --os-ui-holo-fill,${"linear-gradient( 124deg, #afa2e8 0%, #f5a8ea 46%, #8ee9f7 100% )"} );--_holo-ink:var( --os-ui-holo-ink,#0c0b0f );--_holo-sheen:var( --os-ui-holo-sheen,linear-gradient( 124deg,rgba( 159,214,255,0.1 ) 0%,rgba( 236,155,255,0.12 ) 34%,rgba( 242,82,252,0.1 ) 58%,rgba( 147,240,198,0.09 ) 100% ) );--_holo-edge:var( --os-ui-holo-edge,linear-gradient( 124deg,rgba( 154,242,255,0.7 ) 0%,rgba( 236,155,255,0.85 ) 38%,rgba( 242,82,252,0.7 ) 62%,rgba( 159,152,255,0.6 ) 100% ) );--_holo-edge-quiet:var( --os-ui-holo-edge-quiet,linear-gradient( 124deg,rgba( 154,242,255,0.22 ) 0%,rgba( 236,155,255,0.28 ) 38%,rgba( 242,82,252,0.22 ) 62%,rgba( 159,152,255,0.2 ) 100% ) );--_holo-glow:var( --os-ui-holo-glow,0 0 0 1px rgba( 242,82,252,0.28 ),0 2px 10px rgba( 242,82,252,0.22 ) );--_holo-glow-strong:var( --os-ui-holo-glow-strong,0 0 0 1px rgba( 242,82,252,0.42 ),0 4px 18px rgba( 242,82,252,0.38 ),0 1px 3px rgba( 12,11,15,0.6 ) );--_holo-track:var( --os-ui-holo-track,rgba( 255,251,255,0.16 ) );--_holo-track-edge:var( --os-ui-holo-track-edge,#8c8f94 );--_holo-ring-color:var( --os-ui-accent-dim,#2271b1 );--_holo-focus:var( --os-ui-focus-ring,0 0 0 2px rgba( 12,11,15,0.9 ),0 0 0 4px #f252fc,0 0 12px 2px rgba( 242,82,252,0.45 ) );--_holo-focus-field:var( --os-ui-focus-ring-field,0 0 0 1px #f252fc,0 0 0 4px rgba( 242,82,252,0.18 ) );--_holo-t:var( --os-ui-holo-transition,220ms );--_holo-t-fast:var( --os-ui-motion-fast,140ms );--_holo-t-slow:var( --os-ui-motion-slow,340ms );--_holo-t-ambient:var( --os-ui-motion-ambient,12s );--_holo-spring:var( --os-ui-ease-spring,cubic-bezier( 0.32,1.5,0.55,1 ) );--_holo-ease:var( --os-ui-ease-out,cubic-bezier( 0.22,0.9,0.28,1 ) );--_holo-loop:var( --os-ui-ease-loop,cubic-bezier( 0.45,0,0.55,1 ) )}`,rc=v` .os-holo-fill{background-color:transparent;background-image:var( --_holo-fill );background-size:220% 220%;background-position:22% 28%;background-repeat:no-repeat;color:var( --_holo-ink );transition:background-position var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease,filter var( --_holo-t ) ease}.os-holo-fill:hover{background-position:74% 66%}.os-holo-fill:active{background-position:88% 82%;filter:brightness( 0.94 )}@media ( prefers-reduced-motion:reduce ){.os-holo-fill{transition-duration:1ms}.os-holo-fill:hover,.os-holo-fill:active{background-position:22% 28%}}`,os=v` .os-holo-sheen{position:relative;isolation:isolate}.os-holo-sheen::before{content:'';position:absolute;inset:0;z-index:-1;border-radius:inherit;background-image:var( --_holo-sheen );background-size:200% 200%;background-position:20% 30%;opacity:0;pointer-events:none;transition:opacity var( --_holo-t ) ease,background-position var( --_holo-t ) ease}.os-holo-sheen:hover::before,.os-holo-sheen:focus-visible::before{opacity:1;background-position:76% 68%}@media ( prefers-reduced-motion:reduce ){.os-holo-sheen::before{transition-duration:1ms}.os-holo-sheen:hover::before,.os-holo-sheen:focus-visible::before{background-position:20% 30%}}`,On=v` .os-holo-edge{position:relative}.os-holo-edge::after{content:'';position:absolute;inset:0;border-radius:inherit;padding:1px;background-image:var( --_holo-edge-quiet );opacity:0;pointer-events:none;-webkit-mask:linear-gradient( #000 0 0 ) content-box,linear-gradient( #000 0 0 );-webkit-mask-composite:xor;mask:linear-gradient( #000 0 0 ) content-box,linear-gradient( #000 0 0 );mask-composite:exclude;transition:opacity var( --_holo-t ) ease}.os-holo-edge:hover::after,.os-holo-edge:focus-visible::after{background-image:var( --_holo-edge );opacity:1}.os-holo-edge.is-lit::after{background-image:var( --_holo-edge );opacity:1}@media ( prefers-reduced-motion:reduce ){.os-holo-edge::after{transition-duration:1ms}}`,is=v` .os-holo-glint{position:absolute;inset:0;border-radius:inherit;overflow:hidden;pointer-events:none}.os-holo-glint::before{content:'';position:absolute;top:-60%;bottom:-60%;width:45%;inset-inline-start:-60%;background:linear-gradient( 90deg,transparent 0%,rgba( 255,251,255,0.14 ) 45%,rgba( 255,251,255,0.22 ) 50%,rgba( 255,251,255,0.14 ) 55%,transparent 100% );transform:rotate( 18deg ) translateX( 0 );opacity:0}:hover>.os-holo-glint::before,:focus-visible>.os-holo-glint::before,:host(:hover )>.os-holo-glint::before,:host(:focus-visible )>.os-holo-glint::before{animation:os-holo-glint var( --_holo-t-slow ) var( --_holo-ease )}@keyframes os-holo-glint{0%{opacity:0;transform:rotate( 18deg ) translateX( 0 )}15%{opacity:1}85%{opacity:1}100%{opacity:0;transform:rotate( 18deg ) translateX( 240vw )}}@media ( prefers-reduced-motion:reduce ){:hover>.os-holo-glint::before,:focus-visible>.os-holo-glint::before,:host(:hover )>.os-holo-glint::before,:host(:focus-visible )>.os-holo-glint::before{animation:none}}`,qs=v` .os-holo-ring{position:absolute;inset:0;border-radius:inherit;box-shadow:0 0 0 0 var( --_holo-ring-color );opacity:0;pointer-events:none}:active:not(:disabled )>.os-holo-ring,:host(:active:not( [ disabled ] ) )>.os-holo-ring{animation:os-holo-ring var( --_holo-t-slow ) var( --_holo-ease )}@keyframes os-holo-ring{0%{opacity:0.45;box-shadow:0 0 0 0 var( --_holo-ring-color )}100%{opacity:0;box-shadow:0 0 0 10px transparent}}@media ( prefers-reduced-motion:reduce ){:active:not(:disabled )>.os-holo-ring,:host(:active:not( [ disabled ] ) )>.os-holo-ring{animation:none}}`,Wn=v` .os-holo-shimmer{background-image:var( --_holo-fill );background-size:300% 300%;background-repeat:no-repeat;animation:os-holo-shimmer 2.4s var( --_holo-loop ) infinite}@keyframes os-holo-shimmer{0%{background-position:0% 50%}100%{background-position:100% 50%}}@media ( prefers-reduced-motion:reduce ){.os-holo-shimmer{animation:none;background-position:30% 50%}}`,Fs=v` .os-holo-enter{animation:os-holo-enter var( --_holo-t ) var( --_holo-spring )}@keyframes os-holo-enter{from{opacity:0;transform:scale( 0.96 )}}@media ( prefers-reduced-motion:reduce ){.os-holo-enter{animation:none}}`,Vs=v` input:where(:not( [ type='checkbox' ] ):not( [ type='radio' ] ) ),select,textarea{transition:background-color var( --_holo-t ) ease,border-color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease}input:where(:not( [ type='checkbox' ] ):not( [ type='radio' ] ) ):hover:not(:disabled ),select:hover:not(:disabled ),textarea:hover:not(:disabled ){border-color:var( --os-ui-border-strong,#8c8f94 )}input:where(:not( [ type='checkbox' ] ):not( [ type='radio' ] ) ):focus,input:where(:not( [ type='checkbox' ] ):not( [ type='radio' ] ) ):focus-visible,select:focus,select:focus-visible,textarea:focus,textarea:focus-visible{outline:none;border-color:var( --os-ui-accent,#2271b1 );box-shadow:var( --_holo-focus-field )}input::placeholder,textarea::placeholder{color:var( --os-ui-fg-faint,#8c8f94 );opacity:1}input::selection,textarea::selection{background:var( --os-ui-selection-bg,rgba( 159,152,255,0.6 ) );color:var( --os-ui-selection-fg,#fffbff )}@media ( prefers-reduced-motion:reduce ){input:where(:not( [ type='checkbox' ] ):not( [ type='radio' ] ) ),select,textarea{transition-duration:1ms}}`,ns=v` input[ type='checkbox' ],input[ type='radio' ]{appearance:none;-webkit-appearance:none;position:relative;flex:0 0 auto;box-sizing:border-box;width:16px;height:16px;margin:0;padding:0;border:1px solid var( --_holo-track-edge );border-radius:4px;background-color:var( --_holo-track );background-image:none;background-repeat:no-repeat;cursor:inherit;transition:background-color var( --_holo-t ) ease,border-color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease}input[ type='radio' ]{border-radius:50%}input[ type='checkbox' ]:hover:not(:disabled ),input[ type='radio' ]:hover:not(:disabled ){border-color:var( --os-ui-accent,#2271b1 )}input[ type='checkbox' ]:focus-visible,input[ type='radio' ]:focus-visible{outline:none;box-shadow:var( --_holo-focus )}input[ type='checkbox' ]:checked,input[ type='checkbox' ]:indeterminate,input[ type='radio' ]:checked{border-color:transparent;background-color:var( --os-ui-accent,#2271b1 )}input[ type='checkbox' ]:checked:focus-visible,input[ type='radio' ]:checked:focus-visible{box-shadow:var( --_holo-focus )}input[ type='checkbox' ]:checked::after{content:'';position:absolute;inset-inline-start:50%;top:46%;width:3.5px;height:7.5px;border:solid var( --os-ui-fg-on-accent,#fff );border-width:0 2px 2px 0;transform:translate( -50%,-50% ) rotate( 45deg );animation:os-holo-tick 180ms cubic-bezier( 0.3,1.4,0.6,1 )}input[ type='checkbox' ]:indeterminate::after{content:'';position:absolute;inset-inline-start:50%;top:50%;width:8px;height:2px;border:0;border-radius:1px;background:var( --os-ui-fg-on-accent,#fff );transform:translate( -50%,-50% )}input[ type='radio' ]:checked::after{content:'';position:absolute;inset-inline-start:50%;top:50%;width:6px;height:6px;border-radius:50%;background:var( --os-ui-fg-on-accent,#fff );transform:translate( -50%,-50% );animation:os-holo-tick 180ms cubic-bezier( 0.3,1.4,0.6,1 )}input[ type='checkbox' ]:disabled,input[ type='radio' ]:disabled{cursor:not-allowed}@keyframes os-holo-tick{from{opacity:0;transform:translate( -50%,-50% ) rotate( 45deg ) scale( 0.4 )}}@media ( prefers-reduced-motion:reduce ){input[ type='checkbox' ]:checked::after,input[ type='radio' ]:checked::after{animation:none}}`,Hn=v` @keyframes os-holo-drift{0%{background-position:16% 26%}50%{background-position:84% 74%}100%{background-position:16% 26%}}.os-holo-alive{animation:os-holo-drift var( --_holo-t-ambient ) var( --_holo-loop ) infinite}@media ( prefers-reduced-motion:reduce ){.os-holo-alive{animation:none}}`;v` ${S} ${rc} ${os} ${On} ${is} ${qs} ${Wn} ${Fs} ${Vs} ${ns} ${Hn} `;const ac=v` ${S}:host{display:none;position:fixed;inset:0;align-items:center;justify-content:center;background:var( --os-ui-scrim,rgba( 0,0,0,0.45 ) );background-image:var( --os-ui-scrim-image,none );background-repeat:var( --os-ui-scrim-image-repeat,repeat );background-size:var( --os-ui-scrim-image-size,auto );background-position:var( --os-ui-scrim-image-position,center );backdrop-filter:blur( 2px );z-index:10000;--os-ui-fg:var( --os-ui-modal-text,#f0f0f1 );--os-ui-fg-muted:var( --os-ui-modal-text-muted,#a7aaad );--os-ui-border:var( --os-ui-modal-border,rgba( 255,255,255,0.25 ) );--os-window-bg:var( --os-ui-modal-field-bg,#2c3338 );--os-ui-button-bg-hover:var( --os-ui-modal-button-bg-hover,rgba( 255,255,255,0.08 ) );--os-ui-surface:var( --os-ui-modal-surface,#2c3338 );--os-ui-surface-elevated:var( --os-ui-modal-surface-elevated,#3c434a );--os-ui-border-strong:var( --os-ui-modal-border-strong,rgba( 255,255,255,0.35 ) );--os-ui-hover:var( --os-ui-modal-hover,rgba( 255,255,255,0.08 ) );--os-ui-notice-color:var( --os-ui-modal-text,#f0f0f1 );--os-ui-card-bg:var( --os-ui-modal-surface,#2c3338 );--os-ui-card-fg:var( --os-ui-modal-text,#f0f0f1 );--os-ui-card-border:var( --os-ui-modal-border,rgba( 255,255,255,0.25 ) );--os-ui-card-border-hover:var( --os-ui-modal-border-strong,rgba( 255,255,255,0.35 ) )}:host( [ open ] ){display:flex;animation:os-modal-scrim var( --_holo-t ) var( --_holo-ease )}:host( [ open ] ) .dialog{animation:os-modal-dialog var( --_holo-t ) var( --_holo-spring )}@keyframes os-modal-scrim{from{opacity:0}}@keyframes os-modal-dialog{from{opacity:0;transform:scale( 0.96 ) translateY( 8px )}}@media ( prefers-reduced-motion:reduce ){:host( [ open ] ),:host( [ open ] ) .dialog{animation:none}}.dialog{max-width:92vw;max-height:90vh;background-color:var( --os-ui-modal-bg,#1d2327 );background-image:var( --os-ui-dialog-bg-image,none );background-repeat:var( --os-ui-dialog-bg-image-repeat,repeat );background-size:var( --os-ui-dialog-bg-image-size,auto );background-position:var( --os-ui-dialog-bg-image-position,center );color:var( --os-ui-modal-fg,var( --os-fg,#fff ) );border:1px solid var( --os-ui-border,rgba( 255,255,255,0.08 ) );border-radius:10px;box-shadow:0 20px 50px rgba( 0,0,0,0.6 );display:flex;flex-direction:column;overflow:hidden}:host( [ size='sm' ] ) .dialog{width:min( 360px,92vw )}:host(:not( [ size ] ) ) .dialog,:host( [ size='md' ] ) .dialog{width:min( 540px,92vw )}:host( [ size='lg' ] ) .dialog{width:min( 760px,94vw )}.header{display:flex;align-items:center;gap:10px;padding:16px 20px 12px;border-bottom:1px solid var( --os-ui-border,rgba( 255,255,255,0.06 ) )}.title{margin:0;flex:1;font-size:15px;font-weight:600}.header-actions{display:flex;gap:6px}.header-actions::slotted( * ){margin-inline-start:6px}.close{background:transparent;border:0;color:inherit;font-size:18px;line-height:1;padding:4px 8px;border-radius:4px;cursor:pointer;opacity:0.7}.close:hover{opacity:1;background:var( --os-ui-hover,rgba( 255,255,255,0.08 ) )}.body{padding:16px 20px;overflow:auto;flex:1 1 auto;font-size:13px;line-height:1.5}.footer{padding:12px 20px 16px;border-top:1px solid var( --os-ui-border,rgba( 255,255,255,0.06 ) )}.footer slot{display:flex;justify-content:flex-end;gap:10px;flex-wrap:wrap}:host( [ mandatory ] ) .close{display:none}`,Un='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])',Ne=class Ne extends _{constructor(){super(...arguments),this._prevFocus=null,this._onKey=e=>{if(e.key==="Escape"&&!this.hasAttribute("mandatory")){e.preventDefault(),this._cancel();return}if(e.key==="Tab"){const t=this._focusables();if(t.length===0)return;const s=t[0],i=t[t.length-1],n=this.ownerDocument,r=n?n.activeElement:null,a=e.composedPath()[0]||r;e.shiftKey&&a===s?(e.preventDefault(),i.focus()):!e.shiftKey&&a===i&&(e.preventDefault(),s.focus())}},this._onBackdrop=e=>{if(this.hasAttribute("mandatory"))return;const t=e.composedPath();(t.length>0?t[0]:e.target)===this&&this._cancel()}}connectedCallback(){super.connectedCallback(),this.setAttribute("role","dialog"),this.setAttribute("aria-modal","true"),this.addEventListener("keydown",this._onKey),this.addEventListener("click",this._onBackdrop)}disconnectedCallback(){this.removeEventListener("keydown",this._onKey),this.removeEventListener("click",this._onBackdrop)}attributeChangedCallback(e,t,s){if(super.attributeChangedCallback?.(e,t,s),e==="open"){if(s!==null){const i=this.ownerDocument;this._prevFocus=i?i.activeElement:null,queueMicrotask(()=>this._focusFirst())}else if(this._prevFocus){try{this._prevFocus.focus()}catch{}this._prevFocus=null}}}showModal(){this.setAttribute("open","")}hideModal(){this.removeAttribute("open")}_focusables(){const e=this.shadowRoot;if(!e)return[];const t=Array.from(this.querySelectorAll(Un)),s=Array.from(e.querySelectorAll(Un));return[...t,...s].filter(i=>i.offsetParent!==null||i.tagName==="BUTTON")}_focusFirst(){const e=this._focusables();e.length>0?e[0].focus():this.shadowRoot?.querySelector(".dialog")?.focus?.()}_cancel(){const e=new CustomEvent("os-modal-cancel",{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(e)&&this.hideModal()}render(){const e=this.getAttribute("title")??"",t=this.hasAttribute("mandatory");return l`
2 <div part="dialog" class="dialog" tabindex="-1">
3 ${e?l`
4 <div class="header">
5 <h2 class="title">${e}</h2>
6 <div class="header-actions">
7 <slot name="header-actions"></slot>
8 ${t?l``:l`<button
9 type="button"
10 class="close"
11 aria-label="Close"
12 @click=${()=>this._cancel()}
13 >×</button>`}
14 </div>
15 </div>
16 `:l``}
17 <div class="body">
18 <slot></slot>
19 </div>
20 <div class="footer">
21 <slot name="footer"></slot>
22 </div>
23 </div>
24 `}};Ne.props=["open","title","size","mandatory"],Ne.styles=[ac],Ne.help=void 0;let Ks=Ne;y("os-modal",Ks);const lc=v` ${S} ${os} ${On} ${is} ${qs} ${Hn}:host{display:inline-flex}:host( [ fill-cell ] ){display:flex;width:100%}button{appearance:none;display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:var( --os-ui-button-padding,6px 12px );border-radius:var( --os-ui-button-border-radius,6px );font:inherit;font-weight:500;cursor:pointer;transition:background-color var( --_holo-t ) ease,color var( --_holo-t ) ease,border-color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease,transform 80ms ease;background:var( --os-ui-button-bg,transparent );background-image:var( --os-ui-button-bg-image,none );background-repeat:var( --os-ui-button-bg-image-repeat,repeat );background-size:var( --os-ui-button-bg-image-size,auto );background-position:var( --os-ui-button-bg-image-position,center );color:var( --os-ui-button-fg,var( --os-ui-fg,#1d2327 ) );border:var( --os-ui-button-border,1px solid var( --os-ui-border,#c3c4c7 ) )}:host( [ fill-cell ] ) button{width:100%;min-height:var( --os-ui-button-min-height,44px )}button:disabled{opacity:0.5;cursor:not-allowed}button:active:not(:disabled ){transform:translateY( 1px )}button:hover:not(:disabled ){background-color:var( --os-ui-button-bg-hover,var( --os-ui-hover,rgba( 0,0,0,0.04 ) ) )}button:focus-visible{outline:none;box-shadow:var( --_holo-focus )}button:disabled::before,button:disabled::after,button:disabled .os-holo-glint{opacity:0 !important}:host( [ variant='primary' ] ) button{background-color:var( --os-ui-button-bg,var( --wp-admin-theme-color,#2271b1 ) );color:var( --os-ui-button-fg,var( --os-ui-fg-on-accent,#fff ) );border:var( --os-ui-button-border,1px solid transparent )}:host( [ variant='primary' ] ) button:hover:not(:disabled ){filter:brightness( 1.06 );background-color:var( --os-ui-button-bg,var( --wp-admin-theme-color,#2271b1 ) );box-shadow:var( --_holo-glow )}:host( [ variant='holo' ] ) button{background-color:transparent;background-image:var( --_holo-fill );background-size:220% 220%;background-position:22% 28%;background-repeat:no-repeat;color:var( --os-ui-button-fg,var( --_holo-ink ) );border:var( --os-ui-button-border,1px solid transparent );box-shadow:var( --_holo-glow );font-weight:600;transition:background-position var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease,filter var( --_holo-t ) ease,transform 80ms ease}:host( [ variant='holo' ] ) button:hover:not(:disabled ){background-color:transparent;background-position:74% 66%;box-shadow:var( --_holo-glow-strong )}:host( [ variant='holo' ] ) button:active:not(:disabled ){background-position:88% 82%;filter:brightness( 0.94 )}:host( [ variant='holo' ] ) button::before{display:none}@media ( prefers-reduced-motion:reduce ){:host( [ variant='holo' ] ) button:hover:not(:disabled ),:host( [ variant='holo' ] ) button:active:not(:disabled ){background-position:22% 28%}}:host( [ variant='secondary' ] ) button{background-color:var( --os-ui-button-bg,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) );color:var( --os-ui-button-fg,var( --os-ui-fg,#1d2327 ) );border:var( --os-ui-button-border,1px solid transparent )}:host( [ variant='secondary' ] ) button:hover:not(:disabled ){background-color:var( --os-ui-button-bg-hover,var( --os-ui-hover,rgba( 0,0,0,0.1 ) ) )}:host( [ variant='danger' ] ) button{background-color:var( --os-ui-button-bg,transparent );color:var( --os-ui-button-fg,var( --os-ui-danger,#d63638 ) );border:var( --os-ui-button-border,1px solid currentColor )}:host( [ variant='danger' ] ) button:hover:not(:disabled ){background-color:var( --os-ui-danger,#d63638 );color:var( --os-ui-fg-on-accent,#fff )}:host( [ variant='danger' ] ) button::after{display:none}:host( [ variant='link' ] ) button{background-color:transparent;background-image:none;color:var( --os-ui-button-fg,var( --wp-admin-theme-color,#2271b1 ) );border:0;padding:0;text-decoration:underline}:host( [ variant='link' ] ) button::before,:host( [ variant='link' ] ) button::after,:host( [ variant='link' ] ) .os-holo-glint,:host( [ variant='link' ] ) .os-holo-ring{display:none}:host( [ variant='link' ] ) button:active:not(:disabled ){transform:none}:host( [ busy ] ) button{pointer-events:none;opacity:0.75}:host( [ variant='holo' ][ busy ] ) button{animation:os-holo-drift 12s ease-in-out infinite}@media ( prefers-reduced-motion:reduce ){:host( [ variant='holo' ][ busy ] ) button{animation:none}}.os-button__spinner{box-sizing:border-box;display:inline-block;width:12px;height:12px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:os-button-spin 0.6s linear infinite;flex-shrink:0}@keyframes os-button-spin{to{transform:rotate( 360deg )}}`,Pe=class Pe extends _{render(){const e=this.disabled!==null,t=this.busy!==null,s=this.type||"button";return l`
25 <button
26 part="button"
27 class="os-holo-edge os-holo-sheen"
28 type=${s}
29 ?disabled=${e||t}
30 aria-busy=${t?"true":"false"}
31 >
32 ${t?l`<span class="os-button__spinner" aria-hidden="true"></span>`:""}
33 <slot></slot>
34 <!--
35 The two motion layers. Elements rather than
36 pseudo-elements because the sheen and the hairline
37 have already taken this button's ::before and
38 ::after — see the pseudo-element budget note in
39 src/ui/holo.ts. Both are inert and aria-hidden.
40 -->
41 <span class="os-holo-glint" aria-hidden="true"></span>
42 <span class="os-holo-ring" aria-hidden="true"></span>
43 </button>
44 `}};Pe.props=["variant","disabled","type","busy","fill-cell"],Pe.styles=[lc],Pe.help=void 0;let js=Pe;y("os-button",js);const Bs=ll;function he(){return window.wp?.os}function ee(){return he().getOsSettings()}function E(o){he()?.updateOsSettings(o,{windowId:Bs})}function cc(){he()?.resetOsSettings({windowId:Bs})}function qn(o){return he()?.subscribeOsSettings(o)??(()=>{})}function dc(o){const e=he()?.desktopThemes?.applyRecommendedOsSettings(o)??{};return Object.keys(e).length>0}function uc(){try{he()?.refreshMenu?.()}catch{}}function hc(o,e,t="dashicons-admin-settings"){const s=he();if(s?.windowManager?.open){s.windowManager.open({id:s.deriveWindowId?s.deriveWindowId(o):o,url:o,title:e,icon:t});return}window.open(o,"_blank","noopener")}function Fn(){return window.openStationConfig??{}}const pc=()=>({editor:{id:"",teardown:null},previews:null,imagePickerOpen:!1,imageSource:"",library:{query:"",page:0,totalPages:0,loaded:[],loading:!1,error:"",searchTimer:null,uploadError:"",uploading:!1,dragover:!1},themes:{error:"",busy:!1},features:{purging:!1,resetting:!1,extendedSaving:!1,extendedError:"",commentsAiSaving:!1},components:{entries:null,activeTag:"",query:"",paintedTag:""},about:null,search:{query:"",index:null},mountedTabs:new WeakMap,glyphs:new Map}),ve=o=>o.extra,C=o=>o.ui(pc),Vn=o=>o.detail??{},P=o=>String(Vn(o).value??""),O=o=>Vn(o).checked===!0;function gc(o){return o.replace(/[^a-zA-Z0-9._-]+/g,"-").replace(/^-+|-+$/g,"")||"wallpaper"}function fc(o){if(!o||typeof o.id!="number"||!o.source_url)return!1;const e=o.media_details;return!!e&&typeof e.width=="number"&&typeof e.height=="number"&&e.width>0&&e.height>0}function bc(o){if(!o)return"";const e=document.createElement("div");return e.innerHTML=o,e.textContent?.trim()||""}async function Kn(o,e){try{const t=await o.json();if(t&&typeof t.message=="string")return t.message}catch{}return e}async function mc(o,e,t,s){const i=new URL(ve(o).mediaUrl);i.searchParams.set("media_type","image"),i.searchParams.set("per_page",String(cl)),i.searchParams.set("page",String(e)),i.searchParams.set("orderby","date"),i.searchParams.set("order","desc"),i.searchParams.set("_fields","id,source_url,alt_text,title,media_details"),t&&i.searchParams.set("search",t),s&&(i.searchParams.set("openstation_min_width",String(Ds)),i.searchParams.set("openstation_min_height",String(Ts)));const n=await o.fetch(i.toString());if(!n.ok)throw new Error(await Kn(n,`HTTP ${n.status}`));const r=n.headers.get("X-WP-TotalPages"),a=r?parseInt(r,10):1;return{items:(await n.json()).filter(fc),totalPages:a||1}}async function vc(o,e){const t=await o.fetch(ve(o).mediaUrl,{method:"POST",headers:{"Content-Type":e.type,"Content-Disposition":`attachment; filename="${gc(e.name)}"`},body:e});if(!t.ok)throw new Error(await Kn(t,`Upload failed (HTTP ${t.status}).`));const s=await t.json();return{id:s.id,url:s.source_url}}function jn(o){E({customImage:o,wallpaper:re})}async function Bn(o,e){const t=C(o).library,s=i=>{t.uploadError=i,o.repaint(),window.setTimeout(()=>{t.uploadError="",o.repaint()},4e3)};if(!e.type.startsWith("image/")){s(d("That file isn’t an image."));return}t.uploading=!0,o.repaint();try{jn(await vc(o,e))}catch(i){s(i instanceof Error?i.message:d("Upload failed."))}finally{t.uploading=!1,o.repaint()}}function _c(o,e,t){return o?l`<span class="os-settings__upload-status">${d("Uploading…")}</span>`:e?l`<os-button
45 variant="danger"
46 class="os-settings__upload-remove"
47 aria-label=${d("Remove custom image")}
48 @click=${t}
49 >${d("Remove")}</os-button>`:l`<div class="os-settings__upload-inner">
50 <span class="os-settings__upload-plus" aria-hidden="true">+</span>
51 <span class="os-settings__upload-prompt">${d("Drop an image here, or click to upload")}</span>
52 <span class="os-settings__upload-hint">${d("JPEG, PNG, or WebP · goes straight to your Media Library")}</span>
53 </div>`}const yc=(o,e)=>{const t=C(e).library,s=!!o.customImage,i=["os-settings__upload-tile"];s&&i.push("os-settings__upload-tile--filled"),t.dragover&&i.push("os-settings__upload-tile--dragover"),t.uploading&&i.push("os-settings__upload-tile--busy");const n=()=>e.root.querySelector("[data-os-upload-input]"),r=h=>{h.stopPropagation(),E({customImage:null,...o.wallpaper===re?{wallpaper:hl()}:{}})},a=()=>{if(!t.uploading){if(o.customImage){E({wallpaper:re});return}n()?.click()}},c=h=>{const p=h.currentTarget,g=p.files?.[0];g&&Bn(e,g),p.value=""},u=h=>{t.dragover!==h&&(t.dragover=h,e.repaint())};return l`
54 <input
55 type="file"
56 accept="image/*"
57 class="os-settings__file-input"
58 data-os-upload-input
59 @change=${c}
60 />
61 <div
62 class=${i.join(" ")}
63 data-wallpaper-id=${re}
64 aria-pressed=${o.wallpaper===re?"true":"false"}
65 aria-label=${d(s?"Custom image wallpaper":"Upload a wallpaper image")}
66 style=${s?`background-image: url("${encodeURI(o.customImage.url)}")`:""}
67 @click=${a}
68 @dragover=${h=>{h.preventDefault(),u(!0)}}
69 @dragleave=${()=>u(!1)}
70 @drop=${h=>{h.preventDefault(),u(!1);const p=h.dataTransfer?.files?.[0];p&&Bn(e,p)}}
71 >
72 ${_c(t.uploading,s,r)}
73 ${t.uploadError?l`<span class="os-settings__upload-error" role="status">${t.uploadError}</span>`:""}
74 </div>
75 `};function wc(o,e){return o.libraryHdOnly?e.filter(t=>t.media_details.width>=Ds&&t.media_details.height>=Ts):e}async function Gs(o){const e=C(o).library;if(!(e.loading||e.totalPages>0&&e.page>=e.totalPages)){e.loading=!0,e.error="",o.repaint();try{const t=await mc(o,e.page+1,e.query,ee().libraryHdOnly);e.page+=1,e.totalPages=t.totalPages,e.loaded=e.loaded.concat(t.items)}catch(t){e.error=t instanceof Error?q(d("Couldn’t load your media: %s"),t.message):d("Couldn’t load your media.")}finally{e.loading=!1,o.repaint()}}}function Gn(o){const e=C(o).library;e.page=0,e.totalPages=0,e.loaded=[],Gs(o)}const xc=(o,e)=>{const t=o.wallpaper===re&&o.customImage?.id===e.id,s=e.media_details.sizes||{},i=s.medium?.source_url||s.thumbnail?.source_url||s.large?.source_url||e.source_url,n=e.alt_text||bc(e.title?.rendered||"")||`Image #${e.id}`;return l`<button
76 type="button"
77 class=${t?"os-settings__library-tile os-settings__library-tile--selected":"os-settings__library-tile"}
78 data-media-id=${String(e.id)}
79 aria-pressed=${t?"true":"false"}
80 aria-label=${n}
81 title=${n}
82 style=${`background-image: url("${encodeURI(i)}")`}
83 @click=${()=>jn({id:e.id,url:e.source_url})}
84 >
85 <span class="os-settings__library-tile-dims">${e.media_details.width}×${e.media_details.height}</span>
86 </button>`},kc=(o,e)=>{const t=C(e).library,s=wc(o,t.loaded),i=t.loaded.length-s.length,n=[q(d("Showing %d"),s.length)];o.libraryHdOnly&&i>0&&n.push(q(d("%d hidden by HD filter"),i));const r=u=>{const h=u.target.value;t.searchTimer!==null&&window.clearTimeout(t.searchTimer),t.searchTimer=window.setTimeout(()=>{t.searchTimer=null,t.query=h.trim(),Gn(e)},dl)},a=u=>{E({libraryHdOnly:O(u)}),Gn(e)},c=()=>t.error?l`<p class="os-settings__library-error">${t.error}</p>`:t.loading&&t.page===0?Array.from({length:8},()=>l`<div class="os-settings__library-tile os-settings__library-tile--skeleton"></div>`):s.length===0&&!t.loading?l`<p class="os-settings__library-empty">
87 ${o.libraryHdOnly?d("No HD images found. Try unchecking the filter, or upload a larger image."):d("No images in your Media Library yet.")}
88 </p>`:s.map(u=>xc(o,u));return l`
89 <div class="os-settings__library">
90 <div class="os-settings__library-toolbar">
91 <input
92 type="search"
93 class="os-settings__library-search"
94 placeholder=${d("Search your media")}
95 aria-label=${d("Search media")}
96 @input=${r}
97 />
98 <os-checkbox-label
99 label=${q(d("Only HD (≥%1$d×%2$d)"),Ds,Ts)}
100 ?checked=${o.libraryHdOnly}
101 @os-checkbox-change=${a}
102 ></os-checkbox-label>
103 </div>
104 <div class="os-settings__library-grid">${c()}</div>
105 <div class="os-settings__library-footer">
106 <span class="os-settings__library-meta">${n.join(" · ")}</span>
107 <os-button
108 variant="ghost"
109 ?hidden=${t.totalPages>0&&t.page>=t.totalPages}
110 ?disabled=${t.loading}
111 @click=${()=>void Gs(e)}
112 >${d("Load more")}</os-button>
113 </div>
114 </div>
115 `};function Xn(o){const e=C(o);return e.imageSource?e.imageSource:o.data.canUpload?"upload":"library"}function $c(o){const e=C(o);if(!e.imagePickerOpen||Xn(o)!=="library")return;const t=e.library;t.page===0&&!t.loading&&!t.error&&Gs(o)}const Ec=(o,e)=>{const t=e.data.canUpload,s=Xn(e),i=n=>{const r=P(n);(r==="upload"||r==="library")&&(C(e).imageSource=r,e.repaint())};return l`
116 <div class="os-settings__uploader">
117 ${t?l`<os-tabs value=${s} label=${d("Image source")} @os-tab-change=${i}>
118 <os-tab value="upload">${d("Upload new")}</os-tab>
119 <os-tab value="library">${d("Media Library")}</os-tab>
120 </os-tabs>`:""}
121 <div class="os-settings__tab-pane">
122 ${s==="upload"?yc(o,e):kc(o,e)}
123 </div>
124 </div>
125 `},Ac="[data-os-editor-slot]";function Zn(o){return{id:o,pluginUrl:"",prefersReducedMotion:typeof window.matchMedia=="function"&&window.matchMedia("( prefers-reduced-motion: reduce )").matches,visible:!document.hidden,settings:Nn(o)}}function Cc(o){const e=o.root.querySelector(Ac);if(!e)return;const t=C(o),s=ee().wallpaper;if(t.editor.id===s&&e.firstElementChild)return;Yn(o),t.editor.id=s;const i=document.createElement("div");i.className="os-settings__editor-slot-inner",e.textContent="",e.appendChild(i);const n=Ee(s);if(n?.renderEditor)try{const r=n.renderEditor(i,Zn(n.id));Hs(r)?r.then(a=>{t.editor.teardown=a}):t.editor.teardown=r}catch(r){console.error(`[openstation] Wallpaper "${n.id}" renderEditor threw:`,r)}}function Yn(o){const e=C(o);if(e.editor.teardown)try{e.editor.teardown()}catch(t){console.error("[openstation] Wallpaper editor teardown threw:",t)}e.editor={id:"",teardown:null}}function Sc(o){o.classList.add("os-settings__gradient-editor-inner");const e=s=>{E({customGradient:{...ee().customGradient,...s}}),t()},t=()=>{const{from:s,to:i,angle:n}=ee().customGradient;ge(l`
126 <div class="os-settings__gradient-row">
127 <os-color-field
128 variant="block"
129 label=${d("From")}
130 value=${s}
131 @os-color-change=${r=>e({from:P(r)})}
132 ></os-color-field>
133 <os-color-field
134 variant="block"
135 label=${d("To")}
136 value=${i}
137 @os-color-change=${r=>e({to:P(r)})}
138 ></os-color-field>
139 </div>
140 <os-range-field
141 label=${d("Angle")}
142 min="0"
143 max="360"
144 step="1"
145 suffix="°"
146 value=${String(n)}
147 @os-range-change=${r=>e({angle:Number(P(r))})}
148 ></os-range-field>
149 `,o)};return t(),()=>{}}function Lc(o){if(typeof o.renderConfig!="function")return;const e=document.createElement("os-modal");e.setAttribute("size","sm"),e.setAttribute("title",q(d("%s settings"),o.label));const t=document.createElement("div");t.className="os-settings__wallpaper-config-form",e.appendChild(t);const s=document.createElement("os-button");s.setAttribute("slot","footer"),s.setAttribute("variant","primary"),s.textContent=d("Done"),e.appendChild(s);let i=null,n=!1;const r=()=>{if(!n){n=!0;try{i?.()}catch(c){console.error(`[openstation] Wallpaper "${o.id}" config teardown threw:`,c)}i=null,e.remove()}};s.addEventListener("click",r),e.addEventListener("os-modal-cancel",r);const a={...Zn(o.id),setSettings:c=>{const u=ee(),h={...u.wallpaperSettings[o.id]??{},...c};E({wallpaperSettings:{...u.wallpaperSettings,[o.id]:h}}),Gl(o.id,h)}};document.body.appendChild(e),e.setAttribute("open","");try{const c=o.renderConfig(t,a);Hs(c)?c.then(u=>{if(n){try{u()}catch{}return}i=u}):i=c}catch(c){console.error(`[openstation] Wallpaper "${o.id}" renderConfig threw:`,c),r()}}const Rc=(o,e)=>{const t=C(e),s=Ee(o.wallpaper),i=typeof s?.renderConfig=="function",n=typeof s?.renderEditor=="function",r=c=>{const u=Ee(P(c));u&&u.id!==re&&E({wallpaper:u.id})},a=Di().filter(c=>c.id!==re).sort((c,u)=>+(c.id===ss)-+(u.id===ss));return l`
150 <os-section
151 heading=${d("Wallpaper")}
152 description=${d("The backdrop behind your windows. Pick a preset, mix your own gradient, or drop in an image.")}
153 >
154 <div class="os-settings__grid os-settings__grid--wallpapers" @os-pick=${r}>
155 ${a.map(c=>l`<os-swatch
156 value=${c.id}
157 label=${c.label}
158 preview=${c.id===ss?Ws(o):c.preview}
159 variant="wallpaper"
160 data-wallpaper-id=${c.id}
161 ?selected=${o.wallpaper===c.id}
162 >
163 <span class="os-settings__swatch-label">${c.label}</span>
164 </os-swatch>`)}
165 <button
166 type="button"
167 class="os-settings__wallpaper-add"
168 aria-expanded=${t.imagePickerOpen?"true":"false"}
169 @click=${()=>{t.imagePickerOpen=!t.imagePickerOpen,e.repaint()}}
170 >
171 <span class="os-settings__wallpaper-add-plus" aria-hidden="true">+</span>
172 <span>${d("Use your own image")}</span>
173 </button>
174 </div>
175 <div
176 class="os-settings__wallpaper-config-slot"
177 data-expanded=${i?"true":"false"}
178 style=${i?"margin-top:12px":""}
179 >
180 <div class="os-settings__wallpaper-config-slot-inner">
181 ${i?l`<div class="os-settings__wallpaper-config">
182 <os-button variant="secondary" @click=${()=>Lc(s)}>
183 <os-icon name="admin-generic"></os-icon>
184 ${d("Wallpaper settings")}
185 </os-button>
186 </div>`:""}
187 </div>
188 </div>
189 <div
190 class="os-settings__editor-slot"
191 data-os-editor-slot
192 data-expanded=${n?"true":"false"}
193 ></div>
194 <div class="os-settings__image-picker-slot" data-expanded=${t.imagePickerOpen?"true":"false"}>
195 <div class="os-settings__image-picker-slot-inner">${Ec(o,e)}</div>
196 </div>
197 </os-section>
198 `},Ic=typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/i.test(navigator.platform||navigator.userAgent||"")?"⌘K":"Ctrl+K";let Xs=!1;document.addEventListener("os-settings-save-lifecycle",o=>{if(!Xs)return;const e=o.detail?.phase;e!=="saved"&&e!=="failed"||(Xs=!1,e==="saved"&&uc())});const B=(o,e,t,s,i=!1,n="")=>l`
199 <div class="os-features__item">
200 <os-checkbox-label
201 label=${o}
202 ?checked=${e}
203 ?disabled=${i}
204 @os-checkbox-change=${t}
205 ></os-checkbox-label>
206 <p class="os-features__hint">${s}</p>
207 ${n}
208 </div>
209 `,Qn=o=>l`
210 <os-notice tone="warning" not-dismissible>
211 ${d("This feature requires an AI provider configured in")}
212 <a
213 href=${o}
214 @click=${e=>{e.preventDefault(),o&&hc(o,d("Connectors"))}}
215 >${d("Settings → Connectors")}</a>.
216 </os-notice>
217 `;async function Dc(o,e){const t=C(o).features;t.commentsAiSaving||(t.commentsAiSaving=!0,o.repaint(),await o.dispatch("comments-ai",{enabled:e}),t.commentsAiSaving=!1,Jn(o),o.repaint())}async function Tc(o){const e=C(o).features;e.resetting||(e.resetting=!0,o.repaint(),await o.dispatch("reset-intros")&&document.dispatchEvent(new CustomEvent("os-intros-reset")),e.resetting=!1,o.repaint())}function Jn(o){const e=Fn(),t=o.data.aiAssistant;if(t&&e.aiAssistant){const s=e.aiAssistant.available!==t.available||e.aiAssistant.assistantProviderConfigured!==t.assistantProviderConfigured;Object.assign(e.aiAssistant,t),s&&document.dispatchEvent(new CustomEvent("os-ai-status-changed"))}o.data.commentsAi&&e.commentsAi&&Object.assign(e.commentsAi,o.data.commentsAi)}const Nc=(o,e)=>{const{aiAssistant:t,commentsAi:s,isAdmin:i}=e.data,n=C(e).features,r=a=>{const c=Number(P(a));if([15,30,45,60].includes(c)){E({heartbeatRate:c});try{window.wp?.heartbeat?.interval?.(c>=60?"slow":"standard")}catch{}}};return l`
218 <os-section
219 heading=""
220 description=${d("Watch the dot in the OpenStation Preferences title bar to see when a change has been saved.")}
221 >
222 ${t?.available?B(d("AI assistant"),o.ai.enabled,a=>E({ai:{...o.ai,enabled:O(a)}}),q(d("Adds an AI mode to the %s command palette: find content and ask about your site."),Ic),!t.assistantProviderConfigured,t.assistantProviderConfigured?"":Qn(t.connectorsUrl)):""}
223 ${s?B(d("Score new comments with AI"),s.enabled,a=>void Dc(e,O(a)),d("Rates incoming comments so you can triage the queue faster."),n.commentsAiSaving||!s.providerConfigured,s.providerConfigured?"":Qn(t?.connectorsUrl??"")):""}
224 <div class="os-features__item">
225 <os-checkbox-label
226 label=${d("Window links")}
227 ?checked=${o.windowLinksEnabled}
228 @os-checkbox-change=${a=>E({windowLinksEnabled:O(a)})}
229 ></os-checkbox-label>
230 <p class="os-features__hint">
231 ${d("Draws connector lines between related windows. Line style and visibility live in Windows → Window links.")}
232 </p>
233 ${B(d("Bring related windows to front"),o.windowLinkRaiseOnFocus,a=>E({windowLinkRaiseOnFocus:O(a)}),d("Clicking a window also surfaces its parent and children."),!o.windowLinksEnabled)}
234 ${B(d("Highlight related windows"),o.windowLinkHighlight,a=>E({windowLinkHighlight:O(a)}),d("Related windows get an accent outline while one of them is focused."),!o.windowLinksEnabled)}
235 </div>
236 ${B(d("Show desktop when clicking the wallpaper"),o.showDesktopOnWallpaperClick,a=>E({showDesktopOnWallpaperClick:O(a)}),d("A click on the empty desktop minimizes every window; a second click restores them."))}
237 ${B(d("Show post/page status ribbon"),o.showPostStatusRibbons,a=>E({showPostStatusRibbons:O(a)}),d("Marks unpublished posts and pages with a corner ribbon on their tiles."))}
238 ${B(d("Enable developer mode"),o.developerModeEnabled,a=>{E({developerModeEnabled:O(a)}),Xs=!0},d("Unlocks developer surfaces meant for plugin authors."))}
239 ${B(d("Folder sharing"),o.foldersSharingEnabled,a=>E({foldersSharingEnabled:O(a)}),d("Share desktop folders with other users or roles, with read or write access."),!1,i?l`<div class="os-features__danger-row">
240 <p class="os-features__hint">${d("Removes every share and its access list. Cannot be undone.")}</p>
241 <os-button
242 variant="danger"
243 os-action="purge-shares"
244 os-confirm=${d("This drops every shares table on the site (current + legacy). All invites, accept/deny decisions, and share rows are permanently removed. Recipients lose their access until someone shares with them again. The empty tables are recreated on the next admin load so the feature keeps working — but every existing share is gone.")}
245 os-confirm-title=${d("Delete folder sharing data?")}
246 os-confirm-label=${d("Delete data")}
247 os-confirm-danger
248 >${d("Delete folder sharing data")}</os-button>
249 </div>`:"")}
250 <div class="os-features__item">
251 <label class="os-features__select-label">
252 <span class="os-features__select-title">${d("WordPress Heartbeat rate")}</span>
253 <os-select value=${String(o.heartbeatRate)} @os-pick=${r}>
254 <os-option value="15">${d("Fast (15s, not recommended)")}</os-option>
255 <os-option value="30">${d("Medium (30s)")}</os-option>
256 <os-option value="45">${d("Slow (45s)")}</os-option>
257 <os-option value="60">${d("Very slow (60s, default)")}</os-option>
258 </os-select>
259 </label>
260 <p class="os-features__hint">
261 ${d("How often the Heartbeat API runs. Faster means quicker live updates and more server traffic. The 30s and 45s rates apply exactly from the next page load.")}
262 </p>
263 </div>
264 <div class="os-features__row">
265 <p class="os-features__hint">
266 ${d("Brings back the one-time announcements you have dismissed, such as the welcome dialog.")}
267 </p>
268 <os-button variant="secondary" ?disabled=${n.resetting} @click=${()=>void Tc(e)}>
269 ${n.resetting?d("Resetting…"):d("Reset what’s-new dialogs")}
270 </os-button>
271 </div>
272 </os-section>
273 `},Pc=o=>{const e=(t,s,i)=>B(s,o[t]===!0,n=>E({[t]:O(n)}),i);return l`
274 <os-section
275 heading=${d("Beta features")}
276 description=${d("Experimental redesigns of core admin screens, off by default. Each toggle affects only your account and takes effect immediately.")}
277 >
278 ${e("stationHomeEnabled",d("Use Station Home as your Dashboard"),d("Opens Station Home instead of the classic WordPress Dashboard: recent work, site pulse, and quick actions in one native window. Leave off to keep the classic Dashboard, including any customizations plugins have made to it."))}
279 ${e("nativePostsEnabled",d("Use the native Posts window"),d("Replaces the classic Posts list with a native table window: sticky header, paginated rows, bulk actions, and a row preview."))}
280 ${e("nativePagesEnabled",d("Use the native Pages window"),d("The Posts table experience for Pages, with a Parent column, hierarchical sort, and edit-lock indicators."))}
281 ${e("nativeUsersEnabled",d("Use the native Users window"),d("A native Users list with bulk role changes, online indicators, and one-click password resets."))}
282 ${e("nativePluginsEnabled",d("Use the native Plugins window"),d("A native Plugins window with an Installed list, bulk actions, and a Browse gallery from the WordPress.org directory."))}
283 ${e("nativeCommentsEnabled",d("Use the native Comments window"),d("A native two-pane Comments window: a list of conversations beside the full reply thread."))}
284 ${e("windowPrewarmEnabled",d("Prewarm windows on hover (experimental)"),d("Starts loading a window while you hover its dock icon, so it appears already rendered when you click: an admin page in a hidden window, or a native window’s first request sent ahead of the open. Uses extra memory for one speculative page at a time."))}
285 ${e("adminAssetCacheEnabled",d("Shared asset cache (experimental)"),d("Serves the admin’s stylesheets and scripts from one cache shared by every window, so opening a window skips the network for files any window has already loaded. Unlike the other toggles here, this one takes effect after your next reload."))}
286 </os-section>
287 `};let Zs=0;async function zc(o,e){const t=C(o).features;t.extendedSaving=!0,t.extendedError="",o.data.extendedOptions&&Object.assign(o.data.extendedOptions,e),o.repaint(),Zs++;try{const s=await o.dispatch("extended",{options:e});if(s&&o.data.extendedOptions)try{de(W.EXTENDED_OPTIONS_CHANGED,{options:o.data.extendedOptions})}catch{}else s||(t.extendedError=d("The options could not be saved."))}finally{Zs--,t.extendedSaving=Zs>0,o.repaint()}}const Mc=(o,e)=>{const t=e.data.extendedOptions;if(!t)return l``;const s=C(e).features,i=(n,r,a)=>B(r,t[n],c=>void zc(e,{...t,[n]:O(c)}),a);return l`
288 <os-section
289 heading=${d("Extended options")}
290 description=${d("Site-wide enhancements that apply to every user. Toggling requires the affected page to be reloaded for the change to take effect.")}
291 >
292 ${i("media_library_enhanced",d("Enable drag-and-drop in the Media Library"),d("Makes every item in the WordPress Media Library draggable. Drop a media item into text fields, rich-text editors, Gutenberg blocks, or any target that accepts images or files. No replacement of the library — just a drag-and-drop layer on top of the one you already know."))}
293 ${i("games",d("Enable games"),d("Adds a Games app for every user: built-in games, scoreboards, and player-to-player challenges. Off by default — while off, nothing game-related runs anywhere, on the server or in the browser. Saved scores are kept across a disable and reappear when re-enabled."))}
294 ${i("agents",d("Enable AI agents"),d("Adds an Agents section to WP Explorer: durable AI workers that live on the site as login-blocked users, act through the WordPress Abilities API under their own role, and answer in a chat window. Requires a configured AI connector to run. Off by default — while off, nothing agent-related loads. Agent definitions are kept across a disable and reappear when re-enabled."))}
295 ${s.extendedError?l`<p class="os-ext__error">${s.extendedError}</p>`:""}
296 ${s.extendedSaving?l`<p class="os-ext__saving">${d("Saving…")}</p>`:""}
297 </os-section>
298 `},Oc=(o,e)=>l`
299 ${Nc(o,e)}
300 ${Pc(o)}
301 ${e.data.isAdmin?Mc(o,e):""}
302 `,Wc=v`:host{display:block;margin-block-end:36px}:host( [ hidden ] ){display:none}.os-section__heading{margin:0 0 5px;font-size:20px;font-weight:500;letter-spacing:-0.01em;color:var( --os-ui-fg,#1d2327 )}.os-section__description{margin:0 0 14px;max-width:78ch;font-size:14px;color:var( --os-ui-fg-muted,#646970 );line-height:1.55}.os-section__description:empty{display:none}:host( [ stack ] ) .os-section__body{display:flex;flex-direction:column;gap:var( --os-ui-section-gap,12px )}`,ze=class ze extends _{render(){const e=this.heading||"",t=this.description||"";return l`
303 ${e?l`<h3 class="os-section__heading">${e}</h3>`:""}
304 ${t?l`<p class="os-section__description">${t}</p>`:""}
305 <div class="os-section__body" part="body"><slot></slot></div>
306 `}};ze.props=["heading","description","stack"],ze.styles=[Wc],ze.help=void 0;let Ys=ze;y("os-section",Ys);const Hc=v` ${S}:host{display:block;width:100%;aspect-ratio:4 / 3}:host( [ size='small' ] ){display:inline-block;width:32px;height:32px;aspect-ratio:1 / 1;flex:0 0 auto}:host( [ variant='accent' ] ){display:inline-block;width:28px;height:28px;aspect-ratio:1 / 1;flex:0 0 auto}:host( [ size='small' ][ variant='accent' ] ) button{border-radius:8px}:host( [ size='small' ][ variant='accent' ] ) button[ aria-pressed='true' ]{box-shadow:0 0 0 2px var( --os-ui-surface-sunken,#f0f0f1 ),0 0 0 4px var( --os-ui-accent,#2271b1 )}:host( [ size='small' ][ variant='accent' ] ) button[ aria-pressed='true' ]:focus-visible{box-shadow:var( --_holo-focus )}:host( [ variant='wallpaper' ] ){aspect-ratio:16 / 10}:host( [ variant='wallpaper' ] ) button{display:flex;align-items:flex-end;justify-content:flex-start;padding:8px;overflow:hidden}button{appearance:none;position:relative;width:100%;height:100%;padding:0;border-radius:10px;border:2px solid transparent;cursor:pointer;background-color:var( --os-ui-surface-sunken,#eee );background-size:cover;background-position:center;transition:transform 0.15s ease,border-color 0.15s ease,box-shadow 0.15s ease}:host( [ size='small' ] ) button{border-radius:50%}button:hover{transform:scale( 1.04 )}button:focus-visible{outline:none;box-shadow:var( --_holo-focus )}button[ aria-pressed='true' ]{border-color:transparent;box-shadow:0 0 0 2px var( --os-ui-accent,#2271b1 )}button[ aria-pressed='true' ]:focus-visible{box-shadow:var( --_holo-focus )}:host( [ variant='wallpaper' ] ) button:hover{transform:translateY( -2px )}`,Me=class Me extends _{render(){const e=this.selected!==null,t=this.label||"",s=this.preview||"";return l`
307 <button
308 type="button"
309 aria-pressed=${e?"true":"false"}
310 aria-label=${t}
311 title=${t}
312 style="background: ${s}"
313 @click=${()=>this._onPick()}
314 >
315 <slot></slot>
316 </button>
317 `}_onPick(){this.emit("os-pick",{value:this.value})}};Me.props=["value","label","selected","preview","size","variant"],Me.styles=[Hc],Me.help=void 0;let Qs=Me;y("os-swatch",Qs);const Uc=v`:host{display:grid;grid-template-columns:repeat( var( --os-ui-swatch-grid-cols,4 ),1fr );gap:12px}:host( [ mode='row' ] ){display:flex;flex-wrap:wrap;align-items:center;gap:10px}`,Oe=class Oe extends _{render(){const e=this.label||"",t=this.columns||"";return t&&this.style.setProperty("--os-ui-swatch-grid-cols",t),this.setAttribute("role","radiogroup"),e&&this.setAttribute("aria-label",e),l`<slot></slot>`}};Oe.props=["label","columns","mode"],Oe.styles=[Uc],Oe.help=void 0;let Js=Oe;y("os-swatch-grid",Js);const qc=v` ${S}:host{display:inline-flex;position:relative;padding:3px;background:var( --os-ui-segmented-bg,var( --os-ui-hover,rgba( 0,0,0,0.05 ) ) );border-radius:8px;gap:2px}.os-segmented__thumb{position:absolute;top:3px;bottom:3px;left:0;width:var( --_thumb-w,0px );border-radius:6px;background-color:var( --os-ui-segmented-selected-bg,var( --os-ui-accent,#2271b1 ) );background-image:var( --os-ui-segmented-selected-image,none );background-size:220% 220%;background-position:22% 28%;background-repeat:no-repeat;transform:translateX( var( --_thumb-x,0px ) );pointer-events:none;opacity:0}:host( [ data-thumb ] ) .os-segmented__thumb{opacity:1}:host( [ data-thumb-ready ] ) .os-segmented__thumb{transition:transform var( --_holo-t-slow ) var( --_holo-spring ),width var( --_holo-t-slow ) var( --_holo-ease ),opacity var( --_holo-t-fast ) linear}@media ( prefers-reduced-motion:reduce ){:host( [ data-thumb-ready ] ) .os-segmented__thumb{transition-duration:1ms}}`,Fc=v` ${S} ${os}:host{flex:1 1 auto;min-width:0}button{appearance:none;display:block;width:100%;padding:6px 13px;background:transparent;border:0;font:inherit;font-size:13px;color:var( --os-ui-fg-muted,#646970 );cursor:pointer;border-radius:6px;transition:background-color var( --_holo-t ) ease,color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease,background-position var( --_holo-t ) ease;white-space:nowrap}button:hover{color:var( --os-ui-fg,#1d2327 )}button:focus-visible{outline:none;box-shadow:var( --_holo-focus )}:host( [ aria-checked='true' ] ) button{color:var( --os-ui-segmented-selected-fg,var( --os-ui-fg-on-accent,#fff ) );transition-duration:var( --_holo-t-fast )}:host( [ aria-checked='true' ] ) button::before{display:none}`,We=class We extends _{render(){return this.setAttribute("role","radio"),l`
318 <button
319 type="button"
320 class="os-holo-sheen"
321 @click=${()=>this._onPick()}
322 >
323 <slot></slot>
324 </button>
325 `}_onPick(){this.emit("os-segment-pick",{value:this.value})}};We.props=["value"],We.styles=[Fc],We.help=void 0;let eo=We;y("os-segment",eo);const He=class He extends _{constructor(){super(...arguments),this._resizeObserver=null}connectedCallback(){super.connectedCallback(),this.addEventListener("os-segment-pick",e=>{const t=e.detail;e.stopPropagation(),this.value=t.value,this.emit("os-pick",{value:t.value})}),typeof ResizeObserver<"u"&&(this._resizeObserver=new ResizeObserver(()=>this._placeThumb()),this._resizeObserver.observe(this))}disconnectedCallback(){this._resizeObserver?.disconnect(),this._resizeObserver=null}_placeThumb(){if(!this.shadowRoot?.querySelector(".os-segmented__thumb"))return;const t=this.value,s=Array.from(this.querySelectorAll(":scope > os-segment")).find(u=>u.getAttribute("value")===t);if(!s||this.offsetWidth===0){this.removeAttribute("data-thumb");return}const i=this.getBoundingClientRect(),n=i.width/this.offsetWidth,r=Math.abs(n-1)<.02?1:n;if(!(r>0))return;const a=s.getBoundingClientRect(),c=u=>`${Math.round(u*100)/100}px`;this.style.setProperty("--_thumb-x",c((a.left-i.left)/r)),this.style.setProperty("--_thumb-w",c(a.width/r)),this.setAttribute("data-thumb",""),this.hasAttribute("data-thumb-ready")||requestAnimationFrame(()=>this.setAttribute("data-thumb-ready",""))}set items(e){const t=this.querySelectorAll(":scope > os-segment");for(const n of Array.from(t))n.remove();for(const n of e){const r=document.createElement("os-segment");r.setAttribute("value",n.value),r.textContent=n.label,this.appendChild(r)}const s=this.value;!(s!==null&&e.some(n=>n.value===s))&&e.length>0?this.value=e[0].value:this.requestUpdate()}render(){const e=this.label||"";e&&this.setAttribute("aria-label",e),this.setAttribute("role","radiogroup");const t=this.value;return queueMicrotask(()=>{const s=this.querySelectorAll("os-segment");for(const i of Array.from(s)){const n=i.getAttribute("value");i.setAttribute("aria-checked",n===t?"true":"false")}this._placeThumb()}),l`<span class="os-segmented__thumb" aria-hidden="true"></span
326 ><slot></slot>`}};He.props=["value","label"],He.styles=[qc],He.help={title:"Segmented",summary:"iOS-style segmented radio group. Pill-shaped bar of equal-width <os-segment> children where exactly one is active.",status:"stable",props:[{name:"value",type:"string",description:"Currently selected segment value. Mirrored onto child aria-checked."},{name:"label",type:"string",description:"aria-label for the radiogroup."}],slots:[{name:"(default)",description:'<os-segment value="…"> children.'}],events:[{name:"os-pick",description:"Fires when the selected segment changes.",detail:"{ value: string }"}],cssProps:[{name:"--os-window-bg",description:"Pill background."},{name:"--os-ui-fg",description:"Active label colour."},{name:"--os-ui-fg-muted",description:"Inactive label colour."}],example:l`
327 <os-segmented value="md" label="Dock size">
328 <os-segment value="sm">Small</os-segment>
329 <os-segment value="md">Medium</os-segment>
330 <os-segment value="lg">Large</os-segment>
331 </os-segmented>
332 `};let to=He;y("os-segmented",to);const Vc=v` ${S}:host{display:flex;flex-direction:column;gap:8px;font-size:13px;color:var( --os-ui-fg,#1d2327 );min-width:0}:host( [ hidden ] ){display:none}.os-select__label{font-size:13px;line-height:1.5;color:var( --os-ui-fg-muted,#646970 )}.os-select__trigger{appearance:none;display:flex;align-items:center;gap:8px;width:100%;min-width:0;padding:8px 12px;background:var( --os-ui-hover,rgba( 0,0,0,0.05 ) );border:1px solid transparent;border-radius:8px;font:inherit;font-size:13px;line-height:1.5;color:var( --os-ui-fg,#1d2327 );text-align:start;cursor:pointer;transition:background-color var( --_holo-t ) ease,border-color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease}.os-select__trigger:hover:not(:disabled ){background:var( --os-ui-hover,rgba( 0,0,0,0.08 ) );border-color:var( --os-ui-border-strong,#8c8f94 )}.os-select__trigger:focus,.os-select__trigger:focus-visible{outline:none;border-color:var( --os-ui-accent,#2271b1 );box-shadow:var( --_holo-focus-field )}.os-select__trigger:disabled{opacity:0.5;cursor:not-allowed}:host( [ plain ] ){display:inline-flex;flex-direction:row;align-items:center}:host( [ plain ] ) .os-select__label{display:none}:host( [ plain ] ) .os-select__trigger{width:auto;padding:4px 6px;background:transparent;border-color:transparent;border-radius:6px}:host( [ plain ] ) .os-select__trigger:hover:not(:disabled ){background:var( --os-ui-hover,rgba( 0,0,0,0.05 ) );border-color:transparent}:host( [ plain ] ) .os-select__trigger:focus,:host( [ plain ] ) .os-select__trigger:focus-visible{border-color:var( --os-ui-accent,#2271b1 )}:host( [ plain ] ) .os-select__value{flex:0 1 auto}.os-select__value{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.os-select__value--placeholder{color:var( --os-ui-fg-muted,#646970 )}.os-select__chevron{flex:0 0 auto;pointer-events:none;color:var( --os-ui-fg-muted,#646970 )}.os-select__trigger:hover .os-select__chevron{color:var( --os-ui-fg,#1d2327 )}.os-select__trigger:focus .os-select__chevron,.os-select__trigger:focus-visible .os-select__chevron{color:var( --os-ui-accent,#2271b1 )}.os-select__popup{position:fixed;inset:auto;margin:0;max-height:min( 320px,60vh );overflow-y:auto;padding:4px;background:var( --os-ui-surface,#fff );border:1px solid var( --os-ui-border,#dcdcde );border-radius:8px;box-shadow:0 12px 32px rgba( 0,0,0,0.45 );color:var( --os-ui-fg,#1d2327 )}.os-select__popup:not( [ data-open ] ){display:none}.os-select__popup:popover-open{display:block}.os-select__popup[ data-open ]{position:absolute;top:calc( 100% + 4px );left:0;min-width:100%;z-index:1000}:host{position:relative}.os-select__option{display:flex;align-items:center;gap:8px;padding:7px 10px;border-radius:6px;font-size:13px;line-height:1.5;cursor:pointer;white-space:nowrap}.os-select__check{flex:0 0 auto;visibility:hidden}.os-select__option[ aria-selected='true' ] .os-select__check{visibility:visible}.os-select__option[ data-active ],.os-select__option:hover{background:var( --os-ui-accent,#2271b1 );color:var( --os-ui-fg-on-accent,#fff )}.os-select__option[ aria-disabled='true' ]{opacity:0.5;cursor:not-allowed}.os-select__option[ aria-disabled='true' ]:hover{background:transparent;color:inherit}@media ( prefers-reduced-motion:reduce ){.os-select__trigger{transition-duration:1ms}}`,Kc=v`:host{display:none}`,Ue=class Ue extends _{render(){return l``}};Ue.props=["value","disabled"],Ue.styles=[Kc],Ue.help=void 0;let so=Ue;y("os-option",so);const qe=class qe extends _{constructor(){super(...arguments),this._optionObserver=null,this._open=!1,this._activeIndex=-1,this._typed="",this._dismissedAt=0,this._typedTimer=null,this._onWindowScroll=e=>{const t=e.target,s=this._popup();s&&t instanceof Node&&(t===s||s.contains(t))||this._hide()},this._onWindowResize=()=>this._hide()}set items(e){const t=this.querySelectorAll(":scope > os-option");for(const n of Array.from(t))n.remove();for(const n of e){const r=document.createElement("os-option");r.setAttribute("value",n.value),r.textContent=n.label,this.appendChild(r)}const s=this.value;!(s!==null&&e.some(n=>n.value===s))&&e.length>0&&(this.value=e[0].value),this.requestUpdate()}connectedCallback(){super.connectedCallback(),Le(this),this._optionObserver=new MutationObserver(()=>this.requestUpdate()),this._optionObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value","disabled"],characterData:!0})}disconnectedCallback(){this._optionObserver?.disconnect(),this._optionObserver=null,this._teardownDismiss(),this._open=!1,this._typedTimer&&(clearTimeout(this._typedTimer),this._typedTimer=null)}render(){const e=this.label||"",t=this.value,s=this.placeholder||"",i=this.disabled!==null;e&&this.setAttribute("aria-label",e);const n=this.getAttribute("aria-label")||"",r=e||n||s,a=this._readOptions(),c=a.find(b=>b.value===t),u=c?c.label:s,h=this.id||"os-unnamed",p=`${h}__listbox`,g=`${h}__trigger`,m=this._open&&this._activeIndex>=0?`${h}__opt-${this._activeIndex}`:"";return l`
333 ${e?l`<label
334 class="os-select__label"
335 for=${g}
336 >${e}</label>`:l``}
337 <button
338 type="button"
339 class="os-select__trigger"
340 id=${g}
341 role="combobox"
342 aria-haspopup="listbox"
343 aria-expanded=${this._open?"true":"false"}
344 aria-controls=${p}
345 aria-label=${r}
346 aria-activedescendant=${m}
347 ?disabled=${i}
348 @click=${()=>this._toggle()}
349 @keydown=${b=>this._onTriggerKeydown(b)}
350 >
351 <span
352 class="os-select__value${c?"":" os-select__value--placeholder"}"
353 >${u}</span
354 >
355 ${I("chevron-right",{size:16,rotate:90,className:"os-select__chevron"})}
356 </button>
357 <div
358 class="os-select__popup"
359 id=${p}
360 role="listbox"
361 popover="auto"
362 aria-label=${r}
363 @toggle=${b=>this._onPopoverToggle(b)}
364 >
365 ${a.map((b,x)=>l`
366 <div
367 class="os-select__option"
368 id=${`${h}__opt-${x}`}
369 role="option"
370 data-value=${b.value}
371 aria-selected=${b.value===t?"true":"false"}
372 aria-disabled=${b.disabled?"true":"false"}
373 ?data-active=${this._open&&x===this._activeIndex}
374 @click=${()=>this._onOptionClick(b)}
375 @pointermove=${()=>this._setActive(x)}
376 >
377 ${I("check",{size:16,className:"os-select__check"})}
378 <span class="os-select__option-label"
379 >${b.label}</span
380 >
381 </div>
382 `)}
383 </div>
384 `}_readOptions(){const e=[],t=this.querySelectorAll(":scope > os-option");for(const s of Array.from(t)){const i=s.getAttribute("value");i!==null&&e.push({value:i,label:(s.textContent||i).trim(),disabled:s.hasAttribute("disabled")})}return e}_popup(){return this.shadowRoot?.querySelector(".os-select__popup")??null}_trigger(){return this.shadowRoot?.querySelector(".os-select__trigger")??null}_toggle(){if(this._open){this._hide();return}performance.now()-this._dismissedAt<250||this._show()}_show(){const e=this._popup(),t=this._trigger();if(!e||!t||this._open)return;this._open=!0;const s=this._readOptions(),i=this.value,n=s.findIndex(a=>a.value===i&&!a.disabled);this._activeIndex=n>=0?n:s.findIndex(a=>!a.disabled);const r=t.getBoundingClientRect();e.style.minWidth=`${r.width}px`,typeof e.showPopover=="function"?(e.style.left=`${r.left}px`,e.style.top=`${r.bottom+4}px`,e.showPopover(),r.bottom+4+e.offsetHeight>window.innerHeight-8&&(e.style.top=`${Math.max(8,r.top-4-e.offsetHeight)}px`)):e.setAttribute("data-open",""),window.addEventListener("scroll",this._onWindowScroll,{capture:!0,passive:!0}),window.addEventListener("resize",this._onWindowResize),this.requestUpdate(),this._scrollActiveIntoView()}_hide(){if(!this._open)return;this._open=!1;const e=this._popup();if(e){if(typeof e.hidePopover=="function")try{e.hidePopover()}catch{}e.removeAttribute("data-open")}this._teardownDismiss(),this.requestUpdate()}_teardownDismiss(){window.removeEventListener("scroll",this._onWindowScroll,{capture:!0}),window.removeEventListener("resize",this._onWindowResize)}_onPopoverToggle(e){e.newState==="closed"&&this._open&&(this._dismissedAt=performance.now(),this._open=!1,this._teardownDismiss(),this.requestUpdate())}_onOptionClick(e){e.disabled||this._commit(e.value)}_commit(e){this._hide(),this.value=e,this.emit("os-pick",{value:e})}_setActive(e){if(e===this._activeIndex)return;const t=this._readOptions();!t[e]||t[e].disabled||(this._activeIndex=e,this.requestUpdate())}_moveActive(e){const t=this._readOptions();let s=this._activeIndex;for(let i=0;i<t.length&&(s=Math.min(Math.max(s+e,0),t.length-1),!(!t[s]?.disabled||s===0||s===t.length-1));i++);s!==this._activeIndex&&t[s]&&!t[s].disabled&&(this._activeIndex=s,this.requestUpdate(),this._scrollActiveIntoView())}_scrollActiveIntoView(){queueMicrotask(()=>{this.shadowRoot?.querySelector(".os-select__option[data-active]")?.scrollIntoView?.({block:"nearest"})})}_typeAhead(e){this._typedTimer&&clearTimeout(this._typedTimer),this._typed+=e.toLowerCase(),this._typedTimer=setTimeout(()=>{this._typed=""},500);const s=this._readOptions().findIndex(i=>!i.disabled&&i.label.toLowerCase().startsWith(this._typed));s>=0&&(this._activeIndex=s,this.requestUpdate(),this._scrollActiveIntoView())}_onTriggerKeydown(e){const t=this._readOptions();if(t.length!==0){if(!this._open){if(["ArrowDown","ArrowUp","Enter"," ","Home","End"].includes(e.key)){if(e.preventDefault(),this._show(),e.key==="Home"&&(this._activeIndex=t.findIndex(s=>!s.disabled)),e.key==="End"){for(let s=t.length-1;s>=0;s--)if(!t[s].disabled){this._activeIndex=s;break}}this.requestUpdate()}else e.key.length===1&&e.key.trim()!==""&&(this._show(),this._typeAhead(e.key));return}switch(e.key){case"ArrowDown":e.preventDefault(),this._moveActive(1);break;case"ArrowUp":e.preventDefault(),this._moveActive(-1);break;case"Home":e.preventDefault(),this._activeIndex=t.findIndex(s=>!s.disabled),this.requestUpdate(),this._scrollActiveIntoView();break;case"End":e.preventDefault();for(let s=t.length-1;s>=0;s--)if(!t[s].disabled){this._activeIndex=s,this.requestUpdate(),this._scrollActiveIntoView();break}break;case"Enter":case" ":{e.preventDefault();const s=t[this._activeIndex];s&&!s.disabled&&this._commit(s.value);break}case"Tab":{const s=t[this._activeIndex];s&&!s.disabled?this._commit(s.value):this._hide();break}case"Escape":e.preventDefault(),this._hide();break;default:e.key.length===1&&e.key.trim()!==""&&this._typeAhead(e.key)}}}};qe.props=["value","label","placeholder","disabled","name"],qe.styles=[Vc],qe.help={title:"Select",summary:"Dropdown picker: a combobox trigger plus a custom top-layer listbox, so the popup wears the station instead of the operating system. Mirrors the <os-segmented> contract (set value, listen for os-pick).",status:"stable",props:[{name:"value",type:"string",description:"Currently selected option value."},{name:"label",type:"string",description:"Visible label rendered above the trigger and used as the accessible name."},{name:"placeholder",type:"string",description:"Trigger text shown when no value is set."},{name:"disabled",type:"boolean attribute",description:"Disables the trigger and dims the chrome."},{name:"plain",type:"boolean attribute",description:"Drops the field chrome and shrinks to the value, for a picker that is a list row’s trailing control rather than a field of its own. The container already draws the box; use with no `label`."},{name:"name",type:"string",description:"Accepted for compatibility. Shadow-DOM controls never participated in light-DOM form submission, so nothing is lost by the native select being gone; read `value` off the host instead."}],slots:[{name:"(default)",description:'<os-option value="…"> children.'}],events:[{name:"os-pick",description:"Fires when the user picks a new option.",detail:"{ value: string }"}],cssProps:[{name:"--os-ui-fg",description:"Label + value colour."},{name:"--os-ui-fg-muted",description:"Placeholder + chevron colour."},{name:"--os-ui-accent",description:"Active option row + selected check."}],example:l`
385 <os-select value="eur" label="Currency">
386 <os-option value="eur">Euro</os-option>
387 <os-option value="usd">US Dollar</os-option>
388 <os-option value="jpy">Japanese Yen</os-option>
389 </os-select>
390 `};let oo=qe;y("os-select",oo);const jc=v`
391 :host {
392 display: flex;
393 flex-direction: column;
394 gap: 4px;
395 font-size: 13px;
396 color: var( --os-ui-fg, #1d2327 );
397 min-width: 0;
398 }
399
400 :host( [ hidden ] ) {
401 display: none;
402 }
403
404 .os-multiselect__label {
405 font-size: 12px;
406 color: var( --os-ui-fg-muted, #646970 );
407 }
408
409 .os-multiselect__trigger {
410 appearance: none;
411 display: inline-flex;
412 align-items: center;
413 justify-content: space-between;
414 gap: 8px;
415 width: 100%;
416 min-width: 0;
417 padding: 7px 12px 7px 12px;
418 background: var( --os-ui-hover, rgba( 0, 0, 0, 0.05 ) );
419 border: 1px solid transparent;
420 border-radius: 7px;
421 font: inherit;
422 font-size: 13px;
423 color: var( --os-ui-fg, #1d2327 );
424 cursor: pointer;
425 text-align: start;
426 transition: background-color 0.12s ease, border-color 0.12s ease,
427 box-shadow 0.12s ease;
428 }
429
430 .os-multiselect__trigger:hover {
431 background: var( --os-ui-hover, rgba( 0, 0, 0, 0.08 ) );
432 }
433
434 .os-multiselect__trigger:focus-visible {
435 outline: none;
436 border-color: var( --os-ui-accent, #2271b1 );
437 box-shadow: var(
438 --os-ui-focus-ring-field,
439 0 0 0 1px #2271b1, 0 0 0 4px rgba( 34, 113, 177, 0.18 )
440 );
441 }
442
443 .os-multiselect__trigger:disabled {
444 opacity: 0.5;
445 cursor: not-allowed;
446 }
447
448 .os-multiselect__trigger[ data-active='true' ] {
449 color: var( --wp-admin-theme-color, #2271b1 );
450 font-weight: 600;
451 }
452
453 .os-multiselect__summary {
454 flex: 1 1 auto;
455 min-width: 0;
456 overflow: hidden;
457 text-overflow: ellipsis;
458 white-space: nowrap;
459 }
460
461 .os-multiselect__chevron {
462 color: var( --os-ui-fg-muted, #646970 );
463 flex-shrink: 0;
464 transition: color 0.12s ease, transform 0.18s ease;
465 }
466
467 .os-multiselect__trigger:hover .os-multiselect__chevron,
468 .os-multiselect__trigger:focus-visible .os-multiselect__chevron {
469 color: var( --os-ui-fg, #1d2327 );
470 }
471
472 :host( [ open ] ) .os-multiselect__chevron {
473 transform: rotate( 180deg );
474 }
475 `;function Bc(){const o="os-multiselect-popover-styles";if(document.getElementById(o))return;const e=document.createElement("style");e.id=o,e.textContent=`
476 .os-multiselect__popover {
477 position: fixed;
478 z-index: 100000;
479 max-height: 320px;
480 overflow-y: auto;
481 min-width: 200px;
482 padding: 4px 0;
483 background: var( --os-window-bg, #fff );
484 color: var( --os-ui-fg, #1d2327 );
485 border: 1px solid var( --os-window-border, #c3c4c7 );
486 border-radius: 8px;
487 box-shadow: 0 8px 28px rgba( 0, 0, 0, 0.18 );
488 font: inherit;
489 font-size: 13px;
490 }
491
492 .os-multiselect__clear {
493 display: block;
494 width: 100%;
495 padding: 6px 12px;
496 font: inherit;
497 font-size: 11px;
498 font-weight: 600;
499 letter-spacing: 0.04em;
500 text-transform: uppercase;
501 text-align: start;
502 border: 0;
503 border-bottom: 1px solid var( --os-window-border, #dcdcde );
504 background: transparent;
505 color: var( --wp-admin-theme-color, #2271b1 );
506 cursor: pointer;
507 }
508
509 .os-multiselect__clear:hover {
510 background: color-mix(
511 in srgb,
512 var( --wp-admin-theme-color, #2271b1 ) 10%,
513 transparent
514 );
515 }
516
517 .os-multiselect__option {
518 display: flex;
519 align-items: center;
520 gap: 8px;
521 padding: 6px 12px;
522 cursor: pointer;
523 user-select: none;
524 }
525
526 .os-multiselect__option:hover {
527 background: var( --os-ui-hover, rgba( 0, 0, 0, 0.05 ) );
528 }
529
530 .os-multiselect__option[ data-disabled='true' ] {
531 opacity: 0.5;
532 cursor: not-allowed;
533 }
534
535 .os-multiselect__option > span {
536 flex: 1 1 auto;
537 min-width: 0;
538 overflow: hidden;
539 text-overflow: ellipsis;
540 white-space: nowrap;
541 }
542
543 .os-multiselect__option > input[ type='checkbox' ] {
544 margin: 0;
545 flex-shrink: 0;
546 accent-color: var( --wp-admin-theme-color, #2271b1 );
547 }
548
549 .os-multiselect__empty {
550 padding: 8px 12px;
551 color: var( --os-ui-fg-muted, #646970 );
552 font-style: italic;
553 }
554
555 .os-multiselect__loading {
556 display: flex;
557 align-items: center;
558 gap: 8px;
559 padding: 8px 12px;
560 color: var( --os-ui-fg-muted, #646970 );
561 font-size: 12px;
562 }
563
564 .os-multiselect__spinner {
565 display: inline-block;
566 width: 12px;
567 height: 12px;
568 border-radius: 50%;
569 border: 2px solid currentColor;
570 border-top-color: transparent;
571 animation: os-multiselect-spin 0.8s linear infinite;
572 }
573
574 @keyframes os-multiselect-spin {
575 to { transform: rotate( 360deg ); }
576 }
577 `,document.head.appendChild(e)}typeof document<"u"&&Bc();const Fe=class Fe extends _{constructor(){super(...arguments),this._optionObserver=null,this._popover=null,this._teardownOpen=null,this._hasMore=!1,this._loadingMore=!1}set items(e){const t=this.querySelectorAll(":scope > os-option");for(const n of Array.from(t))n.remove();for(const n of e){const r=document.createElement("os-option");r.setAttribute("value",n.value),r.textContent=n.label,this.appendChild(r)}this._loadingMore=!1;const s=new Set(e.map(n=>n.value)),i=this._readValues().filter(n=>s.has(n));this._writeValueAttribute(i),this.requestUpdate(),this._refreshPopover()}get values(){return this._readValues()}set values(e){const t=Array.isArray(e)?e.map(s=>String(s)).filter(s=>s!==""):[];this._writeValueAttribute(t),this.requestUpdate(),this._refreshPopover()}get hasMore(){return this._hasMore}set hasMore(e){this._hasMore=!!e,this._refreshPopover()}get loadingMore(){return this._loadingMore}set loadingMore(e){this._loadingMore=!!e,this._refreshPopover()}appendItems(e){if(this._loadingMore=!1,!e||e.length===0){this._refreshPopover();return}const t=new Set(Array.from(this.querySelectorAll(":scope > os-option")).map(s=>s.getAttribute("value")));for(const s of e){if(t.has(s.value))continue;const i=document.createElement("os-option");i.setAttribute("value",s.value),i.textContent=s.label,this.appendChild(i)}this.requestUpdate(),this._refreshPopover()}connectedCallback(){super.connectedCallback(),Le(this),this._optionObserver=new MutationObserver(()=>{this.requestUpdate(),this._refreshPopover()}),this._optionObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value","disabled"],characterData:!0})}disconnectedCallback(){this._optionObserver?.disconnect(),this._optionObserver=null,this._closePopover()}render(){const e=this.label||"",t=this.placeholder||"All",s=this.disabled!==null;e?this.setAttribute("aria-label",e):this.removeAttribute("aria-label");const i=e||t,n=this._summarize(t),r=this._readValues().length>0,c=`${this.id||"os-unnamed"}__trigger`;return l`
578 ${e?l`<label
579 class="os-multiselect__label"
580 for=${c}
581 >${e}</label>`:l``}
582 <button
583 id=${c}
584 type="button"
585 class="os-multiselect__trigger"
586 aria-haspopup="listbox"
587 aria-expanded=${this._isOpen()?"true":"false"}
588 aria-label=${i}
589 ?disabled=${s}
590 data-active=${r?"true":"false"}
591 @click=${u=>this._onTriggerClick(u)}
592 >
593 <span class="os-multiselect__summary">${n}</span>
594 ${I("chevron-right",{size:16,rotate:90,className:"os-multiselect__chevron"})}
595 </button>
596 `}_readOptions(){const e=[],t=this.querySelectorAll(":scope > os-option");for(const s of Array.from(t)){const i=s.getAttribute("value");i!==null&&e.push({value:i,label:(s.textContent||i).trim(),disabled:s.hasAttribute("disabled")})}return e}_readValues(){return(this.value??"").split(",").map(t=>t.trim()).filter(t=>t!=="")}_writeValueAttribute(e){const t=e.join(",");this.value=t}_summarize(e){const t=this._readValues();if(t.length===0)return e;const s=this._readOptions(),i=new Map(s.map(n=>[n.value,n.label]));return t.length===1?i.get(t[0])??t[0]:`${t.length} selected`}_isOpen(){return this.open!==null}_onTriggerClick(e){e.stopPropagation(),e.preventDefault(),this.disabled===null&&(this._popover?this._closePopover():this._openPopover())}_openPopover(){if(this._popover)return;const e=document.createElement("div");e.className="os-multiselect__popover",e.setAttribute("role","listbox"),e.setAttribute("aria-multiselectable","true"),e.style.setProperty("--wp-admin-theme-color",getComputedStyle(this).getPropertyValue("--wp-admin-theme-color")||"#2271b1"),document.body.appendChild(e),this._popover=e,this._refreshPopover(),this._placePopover();const t=r=>{const a=r.target;if(!a)return;const c=this.shadowRoot?.querySelector(".os-multiselect__trigger");e.contains(a)||c&&c.contains(a)||this._closePopover()},s=r=>{r.key==="Escape"&&(r.stopPropagation(),this._closePopover(),this.shadowRoot?.querySelector(".os-multiselect__trigger")?.focus())},i=()=>this._placePopover(),n=()=>{if(!this._hasMore||this._loadingMore)return;const r=e.scrollHeight,a=e.clientHeight,c=e.scrollTop;r-(c+a)<64&&this.emit("os-multiselect-load-more",{})};setTimeout(()=>{document.addEventListener("pointerdown",t,!0)},0),document.addEventListener("keydown",s,!0),window.addEventListener("resize",i),window.addEventListener("scroll",i,!0),e.addEventListener("scroll",n),this._teardownOpen=()=>{document.removeEventListener("pointerdown",t,!0),document.removeEventListener("keydown",s,!0),window.removeEventListener("resize",i),window.removeEventListener("scroll",i,!0),e.removeEventListener("scroll",n)},this.setAttribute("open",""),this.requestUpdate(),this.emit("os-multiselect-open",{})}_closePopover(){this._teardownOpen&&(this._teardownOpen(),this._teardownOpen=null),this._popover&&(this._popover.remove(),this._popover=null,this.removeAttribute("open"),this.requestUpdate(),this.emit("os-multiselect-close",{}))}_refreshPopover(){const e=this._popover;if(!e)return;const t=this._readOptions(),s=new Set(this._readValues());if(e.replaceChildren(),t.length===0){const i=document.createElement("div");i.className="os-multiselect__empty",i.textContent="No options",e.appendChild(i);return}if(s.size>0){const i=document.createElement("button");i.type="button",i.className="os-multiselect__clear",i.textContent="Clear",i.addEventListener("click",n=>{n.preventDefault(),n.stopPropagation(),this._writeValueAttribute([]),this.requestUpdate(),this._refreshPopover(),this._emitPick()}),e.appendChild(i)}for(const i of t){const n=document.createElement("label");n.className="os-multiselect__option",n.setAttribute("role","option"),n.setAttribute("aria-selected",s.has(i.value)?"true":"false"),i.disabled&&(n.setAttribute("aria-disabled","true"),n.dataset.disabled="true");const r=document.createElement("input");r.type="checkbox",r.checked=s.has(i.value),r.disabled=i.disabled,r.addEventListener("change",()=>{const c=new Set(this._readValues());r.checked?c.add(i.value):c.delete(i.value);const u=t.map(h=>h.value).filter(h=>c.has(h));this._writeValueAttribute(u),n.setAttribute("aria-selected",r.checked?"true":"false"),this.requestUpdate(),this._refreshPopover(),this._emitPick()});const a=document.createElement("span");a.textContent=i.label,n.appendChild(r),n.appendChild(a),e.appendChild(n)}if(this._loadingMore){const i=document.createElement("div");i.className="os-multiselect__loading";const n=document.createElement("span");n.className="os-multiselect__spinner",n.setAttribute("aria-hidden","true");const r=document.createElement("span");r.textContent="Loading…",i.appendChild(n),i.appendChild(r),e.appendChild(i)}}_placePopover(){const e=this._popover,t=this.shadowRoot?.querySelector(".os-multiselect__trigger");if(!e||!t)return;const s=t.getBoundingClientRect(),i=window.innerWidth,n=window.innerHeight,r=Math.max(s.width,200);e.style.minWidth=`${r}px`;let a=s.left;a+r>i-8&&(a=Math.max(8,i-r-8)),e.style.left=`${a}px`,e.style.top=`${s.bottom+4}px`;const c=e.offsetHeight||200;s.bottom+4+c>n-8&&(e.style.top=`${Math.max(8,s.top-c-4)}px`)}_emitPick(){const e=this._readValues();this.emit("os-pick",{value:e.join(","),values:e})}};Fe.props=["value","label","placeholder","disabled","name","open"],Fe.styles=[jc],Fe.help=void 0;let io=Fe;y("os-multiselect",io);const Gc=v` ${S}:host{display:inline-flex;align-items:center;gap:8px;font-size:12px;color:var( --os-ui-fg-muted,#646970 )}label{display:inline-flex;align-items:center;gap:8px}input[ type='color' ]{width:28px;height:28px;padding:0;border:1px solid var( --os-ui-border,#c3c4c7 );border-radius:6px;background:transparent;cursor:pointer;transition:border-color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease}input[ type='color' ]:hover{border-color:var( --os-ui-border-strong,#8c8f94 )}input[ type='color' ]:focus-visible{outline:none;box-shadow:var( --_holo-focus )}:host( [ variant='block' ] ){display:flex;width:100%}:host( [ variant='block' ] ) label{display:flex;flex:1;align-items:center}:host( [ variant='block' ] ) input[ type='color' ]{flex:1;width:auto;height:32px}input[ type='color' ]::-webkit-color-swatch-wrapper{padding:2px}input[ type='color' ]::-webkit-color-swatch{border:none;border-radius:2px}`,Ve=class Ve extends _{open(){const e=()=>{const t=this.shadowRoot?.querySelector("input");if(!t)return!1;try{t.showPicker()}catch{t.click()}return!0};e()||queueMicrotask(()=>void e())}render(){const e=this.label||"",t=this.value||"#000000";return l`
597 <label>
598 <span class="os-color-field__label">${e}</span>
599 <input
600 type="color"
601 .value=${t}
602 @input=${s=>this._onInput(s)}
603 />
604 </label>
605 `}_onInput(e){const t=e.target;this.value=t.value,this.emit("os-color-change",{value:t.value})}};Ve.props=["label","value","variant"],Ve.styles=[Gc],Ve.help=void 0;let no=Ve;y("os-color-field",no);const Xc=v` ${S}:host{display:flex;align-items:center;gap:10px;font-size:12px;color:var( --os-ui-fg-muted,#646970 )}input[ type='range' ]{appearance:none;-webkit-appearance:none;flex:1;min-width:0;height:18px;margin:0;padding:0;background:transparent;cursor:pointer}input[ type='range' ]:disabled{cursor:not-allowed;opacity:0.5}input[ type='range' ]::-webkit-slider-runnable-track{height:6px;border-radius:999px;background-image:linear-gradient( var( --_range-angle,90deg ),transparent var( --_fill,0% ),var( --_holo-track ) var( --_fill,0% ) ),linear-gradient( var( --os-ui-accent,#2271b1 ),var( --os-ui-accent,#2271b1 ) );background-size:auto,auto;background-position:center,center;background-repeat:no-repeat;box-shadow:inset 0 0 0 1px var( --_holo-track-edge )}input[ type='range' ]::-moz-range-track{height:6px;border-radius:999px;background-image:linear-gradient( var( --_range-angle,90deg ),transparent var( --_fill,0% ),var( --_holo-track ) var( --_fill,0% ) ),linear-gradient( var( --os-ui-accent,#2271b1 ),var( --os-ui-accent,#2271b1 ) );background-size:auto,auto;background-position:center,center;background-repeat:no-repeat;box-shadow:inset 0 0 0 1px var( --_holo-track-edge )}input[ type='range' ]::-webkit-slider-thumb{appearance:none;-webkit-appearance:none;width:16px;height:16px;margin-top:-5px;border:0;border-radius:50%;background:var( --os-ui-switch-knob,#fffbff );box-shadow:0 1px 3px rgba( 12,11,15,0.5 ),0 0 0 1px rgba( 12,11,15,0.14 );cursor:inherit;transition:transform var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease}input[ type='range' ]::-moz-range-thumb{width:16px;height:16px;border:0;border-radius:50%;background:var( --os-ui-switch-knob,#fffbff );box-shadow:0 1px 3px rgba( 12,11,15,0.5 ),0 0 0 1px rgba( 12,11,15,0.14 );cursor:inherit;transition:transform var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease}input[ type='range' ]:active::-webkit-slider-thumb{transform:scale( 1.15 );box-shadow:var( --_holo-glow-strong )}input[ type='range' ]:active::-moz-range-thumb{transform:scale( 1.15 );box-shadow:var( --_holo-glow-strong )}input[ type='range' ]:focus-visible{outline:none}input[ type='range' ]:focus-visible::-webkit-slider-thumb{box-shadow:var( --_holo-focus )}input[ type='range' ]:focus-visible::-moz-range-thumb{box-shadow:var( --_holo-focus )}.os-range-field__value{width:var( --os-ui-range-readout-width,3ch );flex:none;text-align:end;font-variant-numeric:tabular-nums;color:var( --os-ui-fg,#1d2327 )}@media ( prefers-reduced-motion:reduce ){input[ type='range' ]::-webkit-slider-thumb{transition-duration:1ms}input[ type='range' ]::-moz-range-thumb{transition-duration:1ms}}`;function Zc(o,e,t){const s=Number.parseFloat(o),i=Number.parseFloat(e),n=Number.parseFloat(t);if(!Number.isFinite(s)||!Number.isFinite(i)||!Number.isFinite(n)||n===i)return"0%";const r=(s-i)/(n-i);return`${Math.min(100,Math.max(0,r*100)).toFixed(2)}%`}function Yc(o){const e=o.indexOf(".");return e<0?0:Math.min(3,o.length-e-1)}function Qc(o,e,t,s){const i=r=>{const a=Number.parseFloat(r);return Number.isFinite(a)?String(Math.trunc(Math.abs(a))).length+(a<0?1:0):3};return Math.max(i(o),i(e))+(t>0?t+1:0)+s.length}const Ke=class Ke extends _{render(){const e=this.label||"",t=this.value||"0",s=this.min||"0",i=this.max||"100",n=this.step||"1",r=this.suffix||"",a=this.decimals,c=a?Math.min(6,Math.max(0,Number.parseInt(a,10)||0)):Yc(n),u=Number.parseFloat(t),h=Number.isFinite(u)?u.toFixed(c):t,p=Qc(s,i,c,r);return l`
606 <label class="os-range-field__label">${e}</label>
607 <input
608 type="range"
609 min=${s}
610 max=${i}
611 step=${n}
612 style="--_fill: ${Zc(t,s,i)}"
613 .value=${t}
614 @input=${g=>this._onInput(g)}
615 />
616 <span
617 class="os-range-field__value"
618 style="--os-ui-range-readout-width: ${p}ch"
619 >${h}${r}</span
620 >
621 `}connectedCallback(){super.connectedCallback(),getComputedStyle(this).direction==="rtl"&&this.style.setProperty("--_range-angle","270deg")}_onInput(e){const t=e.target,s=parseFloat(t.value);Number.isFinite(s)&&(this.value=String(s),this.emit("os-range-change",{value:s}))}};Ke.props=["label","value","min","max","step","suffix","decimals"],Ke.styles=[Xc],Ke.help=void 0;let ro=Ke;y("os-range-field",ro);const er=v` ${S} ${Vs}:host{--_field-size:var( --os-ui-field-font-size,13px );--_field-radius:var( --os-ui-field-radius,6px );display:flex;flex-direction:column;gap:4px;font-size:var( --_field-size );color:var( --os-ui-fg,#1d2327 );min-width:0}:host( [ hidden ] ){display:none}.os-text-field__label{font-size:12px;color:var( --os-ui-fg-muted,#646970 )}.os-text-field__row{position:relative;display:flex;align-items:center;width:100%}input{appearance:none;-webkit-appearance:none;display:block;width:100%;min-width:0;box-sizing:border-box;padding:7px 10px;background:var( --os-window-bg,#fff );border:1px solid var( --os-ui-border,#dcdcde );border-radius:var( --_field-radius );font:inherit;font-size:var( --_field-size );color:var( --os-ui-fg,#1d2327 )}.os-text-field__suffix{position:absolute;inset-inline-end:10px;top:50%;transform:translateY( -50% );pointer-events:none;font-size:12px;color:var( --os-ui-fg-muted,#646970 )}.os-text-field__row--has-reveal input{padding-inline-end:36px}.os-text-field__row--has-clear input{padding-inline-end:36px}.os-text-field__row--has-reveal.os-text-field__row--has-clear input{padding-inline-end:68px}.os-text-field__clear{position:absolute;inset-inline-end:0;top:0;bottom:0;width:34px;display:flex;align-items:center;justify-content:center;padding:0;border:none;background:transparent;color:var( --os-ui-fg-muted,#646970 );cursor:pointer;border-radius:0 6px 6px 0}.os-text-field__row--has-reveal .os-text-field__clear{inset-inline-end:34px;border-radius:0}.os-text-field__clear:hover{color:var( --os-ui-accent,#2271b1 )}.os-text-field__clear:focus-visible{outline:none;color:var( --os-ui-accent,#2271b1 );box-shadow:inset 0 0 0 2px var( --os-ui-accent,#2271b1 )}.os-text-field__clear:disabled{opacity:0.45;cursor:default}.os-text-field__reveal{position:absolute;inset-inline-end:0;top:0;bottom:0;width:34px;display:flex;align-items:center;justify-content:center;padding:0;border:none;background:transparent;color:var( --os-ui-fg-muted,#646970 );cursor:pointer;border-radius:0 6px 6px 0;transition:color 0.12s ease}.os-text-field__reveal:hover{color:var( --os-ui-accent,#2271b1 )}.os-text-field__reveal:focus-visible{outline:none;color:var( --os-ui-accent,#2271b1 );box-shadow:inset 0 0 0 2px var( --os-ui-accent,#2271b1 );border-radius:0 6px 6px 0}.os-text-field__reveal:disabled{opacity:0.45;cursor:not-allowed}.os-text-field__input--masked{-webkit-text-security:disc;text-security:disc}@supports not ( ( -webkit-text-security:disc ) or ( text-security:disc ) ){.os-text-field__input--masked{font-family:text-security-disc,"password",monospace;letter-spacing:0.2em}}input:disabled{opacity:0.55;cursor:not-allowed;background:var( --os-ui-hover,rgba( 0,0,0,0.03 ) )}input[ aria-invalid='true' ],input[ aria-invalid='true' ]:hover:not(:disabled ){border-color:var( --os-ui-danger,#d63638 )}input[ aria-invalid='true' ]:focus,input[ aria-invalid='true' ]:focus-visible{border-color:var( --os-ui-danger,#d63638 );box-shadow:0 0 0 1px var( --os-ui-danger,#d63638 ),0 0 0 4px rgba( 214,54,56,0.18 )}input[ type='number' ]::-webkit-inner-spin-button,input[ type='number' ]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[ type='number' ]{-moz-appearance:textfield}`,je=class je extends _{constructor(){super(...arguments),this._revealed=!1}connectedCallback(){super.connectedCallback(),Le(this)}render(){const e=this.label||"",t=this.value??"",s=this.placeholder||"",i=this.disabled!==null,n=this.readonly!==null,r=this.autocomplete,a=this.type||"text",c=a==="password";let u=r||"off";c&&(!r||u==="off")&&(u="new-password");const h=this.maxlength,p=this.minlength,g=this.pattern||"",m=this.name||"",b=this.suffix||"",x=this.invalid!==null,w=this.reveal!==null,$=this.clearable!==null,f=a==="password",A=f&&!(w&&this._revealed);let k;f||w&&this._revealed?k="text":k=a;const R=["os-text-field__row",w?"os-text-field__row--has-reveal":"",$?"os-text-field__row--has-clear":""].filter(Boolean).join(" "),X=A?"os-text-field__input os-text-field__input--masked":"os-text-field__input",N=`${this.id||"os-unnamed"}__input`;return l`
622 ${e?l`<label
623 class="os-text-field__label"
624 for=${N}
625 >${e}</label>`:l``}
626 <span class=${R}>
627 <input
628 id=${N}
629 class=${X}
630 type=${k}
631 .value=${t}
632 placeholder=${s}
633 ?disabled=${i}
634 ?readonly=${n}
635 autocomplete=${u}
636 maxlength=${h??""}
637 minlength=${p??""}
638 pattern=${g}
639 name=${m}
640 aria-invalid=${x?"true":"false"}
641 aria-label=${e||""}
642 @input=${M=>this._onInput(M)}
643 @change=${M=>this._onChange(M)}
644 @keydown=${M=>this._onKeyDown(M)}
645 />
646 ${b?l`<span class="os-text-field__suffix">${b}</span>`:l``}
647 ${$&&t!==""?this._renderClearButton(i):l``}
648 ${w?this._renderRevealButton(i):l``}
649 </span>
650 `}_renderClearButton(e){return l`
651 <button
652 type="button"
653 class="os-text-field__clear"
654 aria-label="Clear"
655 ?disabled=${e}
656 tabindex="0"
657 @click=${()=>this._onClear()}
658 >
659 ${Jc()}
660 </button>
661 `}_onClear(){this.value="",this.emit("os-input-change",{value:""}),this.emit("os-input-commit",{value:""}),this.shadowRoot?.querySelector("input")?.focus()}_renderRevealButton(e){const t=this._revealed?"Hide":"Show";return l`
662 <button
663 type="button"
664 class="os-text-field__reveal"
665 aria-label=${t}
666 aria-pressed=${this._revealed?"true":"false"}
667 ?disabled=${e}
668 tabindex="0"
669 @click=${()=>this._onToggleReveal()}
670 >
671 ${this._revealed?td():ed()}
672 </button>
673 `}_onToggleReveal(){this._revealed=!this._revealed,this.requestUpdate()}_onInput(e){const t=e.target;this.value=t.value,this.emit("os-input-change",{value:t.value})}_onChange(e){const t=e.target;this.emit("os-input-commit",{value:t.value})}_onKeyDown(e){if(e.key==="Enter"&&!e.shiftKey&&!e.altKey&&!e.metaKey){const t=e.target;this.emit("os-submit",{value:t.value})}}};je.props=["label","value","placeholder","disabled","readonly","autocomplete","type","maxlength","minlength","pattern","name","suffix","invalid","reveal","clearable"],je.styles=[er],je.help=void 0;let ao=je;y("os-text-field",ao);function Jc(){return l`
674 <svg
675 viewBox="0 0 16 16"
676 width="14"
677 height="14"
678 fill="none"
679 stroke="currentColor"
680 stroke-width="1.5"
681 stroke-linecap="round"
682 aria-hidden="true"
683 focusable="false"
684 >
685 <path d="M4 4l8 8M12 4l-8 8" />
686 </svg>
687 `}function ed(){return l`
688 <svg
689 viewBox="0 0 16 16"
690 width="14"
691 height="14"
692 fill="none"
693 stroke="currentColor"
694 stroke-width="1.5"
695 stroke-linecap="round"
696 stroke-linejoin="round"
697 aria-hidden="true"
698 focusable="false"
699 >
700 <path d="M1 8C1 8 3.5 3 8 3s7 5 7 5-2.5 5-7 5S1 8 1 8z" />
701 <circle cx="8" cy="8" r="2" />
702 </svg>
703 `}function td(){return l`
704 <svg
705 viewBox="0 0 16 16"
706 width="14"
707 height="14"
708 fill="none"
709 stroke="currentColor"
710 stroke-width="1.5"
711 stroke-linecap="round"
712 stroke-linejoin="round"
713 aria-hidden="true"
714 focusable="false"
715 >
716 <path d="M1 8C1 8 3.5 3 8 3s7 5 7 5-2.5 5-7 5S1 8 1 8z" />
717 <circle cx="8" cy="8" r="2" />
718 <line x1="2" y1="2" x2="14" y2="14" />
719 </svg>
720 `}const Be=class Be extends _{connectedCallback(){super.connectedCallback(),Le(this)}render(){const e=this.label||"",t=this.value??"",s=this.placeholder||"",i=this.disabled!==null,n=this.readonly!==null,r=this.name||"",a=this.suffix||"",c=this.min,u=this.max,h=this.step||"any",p=this.invalid!==null,m=`${this.id||"os-unnamed"}__input`;return l`
721 ${e?l`<label
722 class="os-text-field__label"
723 for=${m}
724 >${e}</label>`:l``}
725 <span class="os-text-field__row">
726 <input
727 id=${m}
728 type="number"
729 .value=${t}
730 placeholder=${s}
731 ?disabled=${i}
732 ?readonly=${n}
733 inputmode="decimal"
734 autocomplete="off"
735 min=${c??""}
736 max=${u??""}
737 step=${h}
738 name=${r}
739 aria-invalid=${p?"true":"false"}
740 aria-label=${e||""}
741 @input=${b=>this._onInput(b)}
742 @change=${b=>this._onCommit(b)}
743 @keydown=${b=>this._onKeyDown(b)}
744 />
745 ${a?l`<span class="os-text-field__suffix">${a}</span>`:l``}
746 </span>
747 `}_readRange(){const e=this.min,t=this.max,s=e!==null?parseFloat(e):-1/0,i=t!==null?parseFloat(t):1/0;return{min:Number.isFinite(s)?s:-1/0,max:Number.isFinite(i)?i:1/0}}_clamp(e){const{min:t,max:s}=this._readRange();return e<t?t:e>s?s:e}_onInput(e){const t=e.target,s=parseFloat(t.value);Number.isFinite(s)&&(this.value=String(s),this.emit("os-input-change",{value:s}))}_onCommit(e){const t=e.target,s=parseFloat(t.value);if(!Number.isFinite(s))return;const i=this._clamp(s);i!==s&&(t.value=String(i),this.value=String(i)),this.emit("os-input-commit",{value:i})}_onKeyDown(e){if(e.key==="Enter"&&!e.shiftKey&&!e.altKey&&!e.metaKey){const t=e.target,s=parseFloat(t.value);if(!Number.isFinite(s))return;const i=this._clamp(s);i!==s&&(t.value=String(i),this.value=String(i)),this.emit("os-submit",{value:i})}}};Be.props=["label","value","placeholder","disabled","readonly","name","suffix","min","max","step","invalid"],Be.styles=[er],Be.help=void 0;let lo=Be;y("os-number-field",lo);const sd=v` ${S} ${ns}:host{display:inline-flex;align-items:center;gap:6px;font-size:13px;color:var( --os-ui-fg,#1d2327 );cursor:pointer}:host( [ disabled ] ){cursor:not-allowed;opacity:0.55}:host( [ block ] ){display:flex;cursor:default}:host( [ block ] ) label{cursor:pointer}:host( [ block ][ disabled ] ) label{cursor:not-allowed}label{display:inline-flex;align-items:center;gap:6px;cursor:inherit}.os-checkbox__label{line-height:1.3}.os-checkbox__label:empty{display:none}`,Ge=class Ge extends _{render(){const e=this.checked!==null,t=this.disabled!==null,s=this.label||"",i=this.value;return l`
748 <label>
749 <input
750 type="checkbox"
751 ?checked=${e}
752 ?disabled=${t}
753 .value=${i??""}
754 @change=${n=>this._onChange(n)}
755 />
756 <span class="os-checkbox__label">${s}</span>
757 </label>
758 `}_onChange(e){const s=e.target.checked;s?this.setAttribute("checked",""):this.removeAttribute("checked"),this.emit("os-checkbox-change",{checked:s,value:this.value})}};Ge.props=["checked","value","label","disabled"],Ge.styles=[sd],Ge.help=void 0;let co=Ge;y("os-checkbox",co);const od=v` ${S} ${ns}:host{display:inline-flex;align-items:center;gap:8px;font-size:12px;color:var( --os-ui-fg,#1d2327 );cursor:pointer;-webkit-user-select:none;user-select:none}label{display:inline-flex;align-items:center;gap:8px;cursor:pointer}:host( [ disabled ] ){opacity:0.5;cursor:not-allowed}:host( [ disabled ] ) label,:host( [ disabled ] ) input[ type='checkbox' ]{cursor:not-allowed}`,Xe=class Xe extends _{render(){const e=this.label||"",t=this.checked!==null,s=this.disabled!==null;return l`
759 <label>
760 <input
761 type="checkbox"
762 ?checked=${t}
763 ?disabled=${s}
764 @change=${i=>this._onChange(i)}
765 />
766 <span class="os-checkbox-label__text">${e}</span>
767 </label>
768 `}_onChange(e){if(this.disabled!==null)return;const t=e.target.checked;t?this.setAttribute("checked",""):this.removeAttribute("checked"),this.emit("os-checkbox-change",{checked:t})}};Xe.props=["label","checked","disabled"],Xe.styles=[od],Xe.help=void 0;let uo=Xe;y("os-checkbox-label",uo);const id=v` ${S}:host{--_h:22px;--_pad:2px;--_knob:calc( var( --_h ) - 2 * var( --_pad ) );--_travel:calc( var( --_w ) - var( --_knob ) - 2 * var( --_pad ) );--_w:calc( var( --_h ) * 1.85 );--_drag:0px;--_dir:1;display:inline-flex;align-items:center;gap:10px;font-size:13px;line-height:1.3;color:var( --os-ui-fg,#1d2327 );cursor:pointer;-webkit-user-select:none;user-select:none}:host( [ size='sm' ] ){--_h:16px;--_pad:2px;font-size:12px;gap:8px}:host( [ size='lg' ] ){--_h:30px;--_pad:3px;font-size:14px;gap:12px}:host( [ block ] ){display:flex;width:100%;justify-content:space-between}:host( [ label-position='start' ] ) .os-switch__row{flex-direction:row-reverse}:host( [ disabled ] ){cursor:not-allowed;opacity:0.5}.os-switch__row{display:inline-flex;align-items:center;gap:inherit;flex:1 1 auto;justify-content:inherit}button{appearance:none;flex:0 0 auto;position:relative;box-sizing:border-box;width:var( --_w );height:var( --_h );padding:0;margin:0;border:0;border-radius:999px;background-color:var( --_holo-track );background-image:none;box-shadow:inset 0 0 0 1px var( --_holo-track-edge );cursor:inherit;outline:none;transition:background-color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease}button:disabled{cursor:not-allowed}:host( [ checked ] ) button{background-image:none;background-color:var( --os-ui-accent,#2271b1 );box-shadow:none}button:focus-visible{box-shadow:var( --_holo-focus ),inset 0 0 0 1px var( --_holo-track-edge )}:host( [ checked ] ) button:focus-visible{box-shadow:var( --_holo-focus )}:host( [ tone='accent' ][ checked ] ) button,:host( [ tone='danger' ][ checked ] ) button,:host( [ tone='success' ][ checked ] ) button{background-image:none}:host( [ tone='accent' ][ checked ] ) button{background-color:var( --os-ui-accent,#2271b1 )}:host( [ tone='danger' ][ checked ] ) button{background-color:var( --os-ui-danger,#d63638 );box-shadow:0 0 0 1px rgba( 255,90,90,0.3 ),0 2px 10px rgba( 255,90,90,0.25 )}:host( [ tone='success' ][ checked ] ) button{background-color:var( --os-ui-success-fg,#00a32a );box-shadow:0 0 0 1px rgba( 147,240,198,0.3 ),0 2px 10px rgba( 147,240,198,0.25 )}.os-switch__knob{position:absolute;top:var( --_pad );inset-inline-start:var( --_pad );width:var( --_knob );height:var( --_knob );border-radius:999px;background:var( --os-ui-switch-knob,#fffbff );box-shadow:0 1px 2px rgba( 12,11,15,0.45 ),0 0 0 1px var( --os-ui-switch-knob-edge,rgba( 12,11,15,0.55 ) );pointer-events:none;transition:transform var( --_holo-t ) var( --_holo-spring ),width var( --_holo-t ) ease}.os-switch__knob{transform:translateX( calc( var( --_dir ) * var( --_drag ) ) )}:host( [ checked ] ) .os-switch__knob{transform:translateX( calc( var( --_dir ) * ( var( --_travel ) + var( --_drag ) ) ) )}:host(:not( [ disabled ] ) ) button:active .os-switch__knob{width:calc( var( --_knob ) * 1.28 )}:host( [ checked ]:not( [ disabled ] ) ) button:active .os-switch__knob{width:calc( var( --_knob ) * 1.28 );transform:translateX( calc( var( --_dir ) * ( var( --_travel ) - var( --_knob ) * 0.28 + var( --_drag ) ) ) )}:host( [ data-dragging ] ) .os-switch__knob{transition:width var( --_holo-t ) ease}.os-switch__label{line-height:1.3}.os-switch__label:empty{display:none}.os-switch__text{display:flex;flex-direction:column;gap:2px;min-width:0}.os-switch__description{font-size:0.92em;color:var( --os-ui-fg-muted,#646970 )}@media ( prefers-reduced-motion:reduce ){.os-switch__knob{transition-duration:1ms}}`,nd=4,Ze=class Ze extends _{constructor(){super(...arguments),this._pointerId=null,this._startX=0,this._travel=0,this._moved=!1,this._dir=1,this._swallowClick=!1}render(){const e=this._attr("checked")!==null,t=this._attr("disabled")!==null,s=this._attr("label")||"",i=this._attr("description")||"";return l`
769 <div class="os-switch__row">
770 <span class="os-switch__text">
771 <span class="os-switch__label">${s}</span>
772 <span class="os-switch__description" id="os-switch-desc"
773 >${i}</span
774 >
775 </span>
776 <button
777 type="button"
778 role="switch"
779 aria-checked=${e?"true":"false"}
780 aria-label=${s||"Toggle"}
781 aria-describedby=${i?"os-switch-desc":""}
782 ?disabled=${t}
783 @click=${()=>this._onClick()}
784 @keydown=${n=>this._onKeyDown(n)}
785 @pointerdown=${n=>this._onPointerDown(n)}
786 @pointermove=${n=>this._onPointerMove(n)}
787 @pointerup=${n=>this._onPointerUp(n)}
788 @pointercancel=${()=>this._endGesture()}
789 >
790 <span class="os-switch__knob"></span>
791 </button>
792 </div>
793 `}_onPointerDown(e){if(this._attr("disabled")!==null)return;const t=e.currentTarget;this._pointerId=e.pointerId,this._startX=e.clientX,this._moved=!1,this._dir=getComputedStyle(this).direction==="rtl"?-1:1,this.style.setProperty("--_dir",String(this._dir)),this._travel=Math.max(0,t.clientWidth-t.clientHeight),t.setPointerCapture(e.pointerId)}_onPointerMove(e){if(this._pointerId!==e.pointerId||this._travel===0)return;const t=(e.clientX-this._startX)*this._dir;if(!this._moved&&Math.abs(t)>=nd&&(this._moved=!0,this.setAttribute("data-dragging","")),!this._moved)return;const s=this._attr("checked")!==null,i=s?-this._travel:0,n=s?0:this._travel;this.style.setProperty("--_drag",`${Math.min(n,Math.max(i,t))}px`)}_onPointerUp(e){if(this._pointerId!==e.pointerId)return;const t=this._moved,s=(e.clientX-this._startX)*this._dir;if(this._swallowClick=t,this._endGesture(),!t)return;const i=this._attr("checked")!==null,r=(i?this._travel:0)+s>this._travel/2;r!==i&&this._commit(r)}_endGesture(){this._pointerId=null,this._moved=!1,this.removeAttribute("data-dragging"),this.style.removeProperty("--_drag")}_onClick(){if(this._swallowClick){this._swallowClick=!1;return}this._attr("disabled")===null&&this._commit(this._attr("checked")===null)}_onKeyDown(e){this._attr("disabled")===null&&(e.key==="ArrowRight"||e.key==="End"?(e.preventDefault(),this._attr("checked")===null&&this._commit(!0)):(e.key==="ArrowLeft"||e.key==="Home")&&(e.preventDefault(),this._attr("checked")!==null&&this._commit(!1)))}_commit(e){e?this.setAttribute("checked",""):this.removeAttribute("checked");const t={checked:e,value:this._attr("value")};this.emit("os-switch-change",t),this.emit("os-checkbox-change",t)}_attr(e){return this[e]??null}};Ze.props=["checked","value","label","description","disabled","size","tone","block","labelPosition"],Ze.styles=[id],Ze.help=void 0;let ho=Ze;y("os-switch",ho);const rd=v`:host{position:fixed;top:calc( var( --wp-admin--admin-bar--height,32px ) + 16px );inset-inline-end:16px;display:flex;flex-direction:column;gap:8px;z-index:calc( var( --os-z-fullscreen,99999 ) + 10 );pointer-events:none}`,ad=v` ${S}:host{display:flex;align-items:center;gap:12px;min-width:280px;max-width:420px;padding:10px 14px;background-color:var( --os-ui-toast-bg,var( --os-ui-modal-bg,#1d2327 ) );background-image:var( --os-ui-toast-bg-image,none );background-repeat:var( --os-ui-toast-bg-image-repeat,repeat );background-size:var( --os-ui-toast-bg-image-size,auto );background-position:var( --os-ui-toast-bg-image-position,center );color:var( --os-ui-fg-on-accent,#fff );border-radius:10px;border:1px solid var( --os-ui-border,rgba( 255,255,255,0.12 ) );box-shadow:0 10px 30px rgba( 0,0,0,0.4 ),0 2px 6px rgba( 0,0,0,0.18 ),inset 0 0 0 1px rgba( 255,255,255,0.04 );font-size:13px;line-height:1.4;opacity:0;transform:translateY( -10px ) scale( 0.97 );transition:opacity var( --_holo-t-fast ) linear,transform var( --_holo-t ) var( --_holo-spring );pointer-events:auto}:host( [ state='in' ] ){opacity:1;transform:translateY( 0 ) scale( 1 )}:host( [ state='out' ] ){opacity:0;transform:translateX( 16px ) scale( 0.97 );transition:opacity var( --_holo-t-fast ) linear,transform var( --_holo-t ) var( --_holo-ease )}.os-toast__label{flex:1}button[ hidden ]{display:none}button{flex-shrink:0;padding:4px 10px;border:none;border-radius:4px;background:var( --os-ui-hover,rgba( 255,255,255,0.12 ) );color:var( --os-ui-fg-on-accent,#fff );font:inherit;font-size:12px;font-weight:500;cursor:pointer;transition:background-color 0.12s ease}button:hover{background:var( --os-ui-scrim,rgba( 255,255,255,0.22 ) )}button:focus-visible{outline:2px solid var( --os-ui-border,rgba( 255,255,255,0.6 ) );outline-offset:2px}.os-toast__close{display:inline-flex;align-items:center;justify-content:center;padding:4px;border-radius:6px;background:transparent;color:var( --os-ui-fg-muted,rgba( 255,255,255,0.7 ) )}.os-toast__close:hover{background:var( --os-ui-hover,rgba( 255,255,255,0.14 ) );color:var( --os-ui-fg-on-accent,#fff )}@media ( prefers-reduced-motion:reduce ){:host{transition-duration:0.01ms}}`,bs=class bs extends _{connectedCallback(){super.connectedCallback(),this.setAttribute("aria-live","polite")}render(){return l`<slot></slot>`}};bs.styles=[rd],bs.help=void 0;let po=bs;y("os-toast-container",po);const Ye=class Ye extends _{constructor(){super(...arguments),this._hovered=!1,this._focused=!1,this._onEnter=()=>{this._hovered=!0,this._syncHold()},this._onLeave=()=>{this._hovered=!1,this._syncHold()},this._onFocusIn=()=>{this._focused=!0,this._syncHold()},this._onFocusOut=e=>{const t=e.relatedTarget;t instanceof Node&&this._containsDeep(t)||(this._focused=!1,this._syncHold())}}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","status"),this.addEventListener("mouseenter",this._onEnter),this.addEventListener("mouseleave",this._onLeave),this.addEventListener("focusin",this._onFocusIn),this.addEventListener("focusout",this._onFocusOut)}disconnectedCallback(){this.removeEventListener("mouseenter",this._onEnter),this.removeEventListener("mouseleave",this._onLeave),this.removeEventListener("focusin",this._onFocusIn),this.removeEventListener("focusout",this._onFocusOut)}_containsDeep(e){let t=e;for(;t;){if(t===this)return!0;const s=t.parentNode;t=s instanceof ShadowRoot?s.host:s}return!1}_syncHold(){const e=this._hovered||this._focused;e!==this.hasAttribute("held")&&(e?this.setAttribute("held",""):this.removeAttribute("held"),this.emit("os-toast-hold",{held:e}))}render(){const e=this.action||"",t=this.hasAttribute("dismissible");return l`
794 <span class="os-toast__label"><slot></slot></span>
795 <button
796 type="button"
797 ?hidden=${!e}
798 @click=${s=>this._onAction(s)}
799 >
800 ${e}
801 </button>
802 <button
803 type="button"
804 class="os-toast__close"
805 aria-label=${d("Dismiss")}
806 ?hidden=${!t}
807 @click=${s=>this._onDismiss(s)}
808 >
809 ${I("close",{size:16})}
810 </button>
811 `}_onAction(e){e.preventDefault(),e.stopPropagation(),this.emit("os-toast-action",{})}_onDismiss(e){e.preventDefault(),e.stopPropagation(),this.emit("os-toast-dismiss",{})}};Ye.props=["action","state","dismissible"],Ye.styles=[ad],Ye.help={title:"Toast",summary:'Single transient notification. Message is slotted; fade-in / fade-out is CSS-driven by flipping the state attribute between "in" and "out". Usually created via the showToast() helper rather than authored by hand.',status:"stable",props:[{name:"action",type:"string",description:"Optional action button label. When set, a button renders on the right and emits os-toast-action on click."},{name:"state",type:"'in' | 'out'",description:'Drives the CSS fade transition. Set to "in" when rendered, flip to "out" before removal.'},{name:"dismissible",type:"boolean",description:"When set, a close (×) button renders on the right and emits os-toast-dismiss on click. Use for persistent toasts the user must be able to close."},{name:"held",type:"boolean (reflected, read-only)",description:"Set by the component while the pointer is over the toast or focus is inside it. showToast() pauses the auto-dismiss timer for as long as it is present. Do not set it by hand — pass `persistent` for a toast that should never expire."}],slots:[{name:"(default)",description:"Message text."}],events:[{name:"os-toast-action",description:"Fires when the action button is clicked.",detail:"{}"},{name:"os-toast-dismiss",description:"Fires when the close (×) button is clicked.",detail:"{}"},{name:"os-toast-hold",description:"Fires when the toast starts or stops being attended to — pointer over it, or focus inside it. showToast() pauses the auto-dismiss timer while held is true.",detail:"{ held: boolean }"}],example:l`
812 <os-toast state="in" action="Undo">Post moved to trash.</os-toast>
813 `};let go=Ye;y("os-toast",go);const ld=v`:host{display:flex;gap:4px;margin-bottom:10px;border-bottom:1px solid var( --os-ui-border,#dcdcde )}:host( [ orientation='vertical' ] ){flex-direction:column;align-items:stretch;gap:0;margin-bottom:0;border-bottom:0}`,cd=v`:host{display:block}:host( [ hidden ] ){display:none}:host(:focus-visible ){outline:2px solid var( --os-ui-accent,#2271b1 );outline-offset:4px;border-radius:4px}`,dd=v` ${S}:host{display:inline-block}:host( [ data-orientation='vertical' ] ){display:block;--_tab-edge:var( --os-ui-tab-edge,linear-gradient( var( --os-ui-accent,#f252fc ),var( --os-ui-accent,#f252fc ) ) );--_tab-wash:var( --os-ui-tab-wash,linear-gradient( 90deg,rgba( 242,82,252,0.16 ) 0%,rgba( 255,251,255,0.04 ) 42%,transparent 100% ) );--_tab-bloom:var( --os-ui-tab-bloom,linear-gradient( 90deg,rgba( 242,82,252,0.26 ),transparent ) )}:host( [ data-orientation='vertical' ] ) button{display:flex;align-items:center;gap:11px;isolation:isolate;width:100%;min-height:40px;padding:0 14px 0 20px;margin-bottom:0;border-radius:0;text-align:start;font-size:14px;font-weight:400;line-height:1.5;white-space:nowrap}:host( [ data-orientation='vertical' ] ) slot::slotted( svg ){flex:0 0 17px;width:17px;height:17px;opacity:0.8;transition:opacity var( --_holo-t ) var( --_holo-ease )}:host( [ data-orientation='vertical' ] ) button:hover slot::slotted( svg ),:host( [ data-orientation='vertical' ][ aria-selected='true' ] ) slot::slotted( svg ){opacity:1}:host( [ data-orientation='vertical' ] ) button::after{inset-inline:0 auto;inset-block:0;z-index:-1;width:2px;height:auto;border-radius:0;background-image:var( --_tab-edge );transition:opacity var( --_holo-t ) var( --_holo-ease )}:host( [ data-orientation='vertical' ] ) button::before{content:'';position:absolute;inset-inline:0 auto;inset-block:0;z-index:-1;width:44px;background-image:var( --_tab-bloom );filter:blur( 8px );opacity:0;pointer-events:none;transition:opacity var( --_holo-t ) var( --_holo-ease )}:host( [ data-orientation='vertical' ] ) button:hover::after{inset-inline:0 auto;opacity:0}:host( [ data-orientation='vertical' ][ aria-selected='true' ] ) button{background-image:var( --_tab-wash );font-weight:400}:host( [ data-orientation='vertical' ][ aria-selected='true' ] ) button::after,:host( [ data-orientation='vertical' ][ aria-selected='true' ] ) button:hover::after{inset-inline:0 auto;opacity:1}:host( [ data-orientation='vertical' ][ aria-selected='true' ] ) button::before{opacity:1}@media ( prefers-reduced-motion:reduce ){:host( [ data-orientation='vertical' ] ) button::before,:host( [ data-orientation='vertical' ] ) slot::slotted( svg ){transition-duration:1ms}}button{appearance:none;position:relative;padding:6px 10px 8px;border:none;background:transparent;color:var( --os-ui-fg-muted,#50575e );font:inherit;font-size:12px;font-weight:500;cursor:pointer;margin-bottom:-1px;transition:color var( --_holo-t ) ease}button::after{content:'';position:absolute;inset-inline:50%;bottom:0;height:2px;border-radius:2px 2px 0 0;background-image:linear-gradient( var( --os-ui-accent,#2271b1 ),var( --os-ui-accent,#2271b1 ) );background-size:100% 100%;opacity:0;transition:inset-inline var( --_holo-t ) ease,opacity var( --_holo-t ) ease}button:hover{color:var( --os-ui-fg,#1d2327 )}button:hover::after{inset-inline:30%;opacity:0.45}button:focus-visible{outline:none;box-shadow:var( --_holo-focus );border-radius:4px}:host( [ aria-selected='true' ] ) button{color:var( --os-ui-fg,#1d2327 );font-weight:600}:host( [ aria-selected='true' ] ) button::after,:host( [ aria-selected='true' ] ) button:hover::after{inset-inline:0;opacity:1}@media ( prefers-reduced-motion:reduce ){button::after{transition-duration:1ms}}`,Qe=class Qe extends _{render(){return this.setAttribute("role","tab"),l`
814 <button type="button" @click=${()=>this._onPick()}>
815 <slot></slot>
816 </button>
817 `}_onPick(){this.emit("os-tab-pick",{value:this.value})}};Qe.props=["value"],Qe.styles=[dd],Qe.help=void 0;let fo=Qe;y("os-tab",fo);const Je=class Je extends _{constructor(){super(...arguments),this._tabObserver=null,this._onKeyDown=e=>{const t=this.orientation==="vertical",s=t?"ArrowDown":"ArrowRight",i=t?"ArrowUp":"ArrowLeft";if(e.key!==s&&e.key!==i&&e.key!=="Home"&&e.key!=="End")return;const n=Array.from(this.querySelectorAll("os-tab")).filter(h=>!h.hasAttribute("data-search-hidden"));if(n.length===0)return;const r=this.value,a=n.findIndex(h=>h.getAttribute("value")===r);let c=0;if(e.key==="End")c=n.length-1;else if(e.key!=="Home"){const h=e.key===s?1:-1;c=(a+h+n.length)%n.length}const u=n[c]?.getAttribute("value");!u||u===r||(e.preventDefault(),this.value=u,this.emit("os-tab-change",{value:u}),queueMicrotask(()=>{n[c]?.focus()}))}}connectedCallback(){super.connectedCallback(),this.addEventListener("os-tab-pick",e=>{const t=e.detail;e.stopPropagation(),this.value=t.value,this.emit("os-tab-change",{value:t.value})}),this.addEventListener("keydown",this._onKeyDown),this._tabObserver=new MutationObserver(()=>this.requestUpdate()),this._tabObserver.observe(this,{childList:!0})}disconnectedCallback(){this._tabObserver?.disconnect(),this._tabObserver=null,this.removeEventListener("keydown",this._onKeyDown)}set items(e){ud(this,"os-tab",e);const t=this.value;!(t!==null&&e.some(i=>i.value===t))&&e.length>0?this.value=e[0].value:this.requestUpdate()}render(){this.setAttribute("role","tablist");const e=this.label||"";e&&this.setAttribute("aria-label",e);const t=this.orientation==="vertical";this.setAttribute("aria-orientation",t?"vertical":"horizontal");for(const i of Array.from(this.querySelectorAll("os-tab")))t?i.setAttribute("data-orientation","vertical"):i.removeAttribute("data-orientation");const s=this.value;return queueMicrotask(()=>{const i=this.querySelectorAll("os-tab");for(const n of Array.from(i)){const r=n.getAttribute("value");n.setAttribute("aria-selected",r===s?"true":"false"),n.setAttribute("tabindex",r===s?"0":"-1")}tr(this,s)}),l`<slot></slot>`}};Je.props=["value","label","orientation"],Je.styles=[ld],Je.help={title:"Tabs",summary:'Underline-accent tab strip. Pair with sibling <os-tabpanel for="…"> elements and the strip auto-toggles their hidden attribute on selection. Set orientation="vertical" for a sidebar instead of a strip.',status:"stable",props:[{name:"value",type:"string",description:"Currently active tab value. Mirrored to child <os-tab> aria-selected."},{name:"label",type:"string",description:"aria-label for the tablist — describe the tab group for assistive tech."},{name:"orientation",type:"'horizontal' | 'vertical'",description:"Lay the tabs across the top (default) or down the side. Vertical also sets aria-orientation and moves each tab's accent from an underline to a leading edge."}],slots:[{name:"(default)",description:'<os-tab value="…"> children forming the strip.'}],events:[{name:"os-tab-change",description:"Fires when the active tab changes.",detail:"{ value: string }"}],example:l`
818 <os-tabs value="one" label="Demo tabs">
819 <os-tab value="one">One</os-tab>
820 <os-tab value="two">Two</os-tab>
821 <os-tab value="three">Three</os-tab>
822 </os-tabs>
823 <os-tabpanel for="one">First panel.</os-tabpanel>
824 <os-tabpanel for="two">Second panel.</os-tabpanel>
825 <os-tabpanel for="three">Third panel.</os-tabpanel>
826 `};let bo=Je;y("os-tabs",bo);const et=class et extends _{connectedCallback(){super.connectedCallback(),this.setAttribute("role","tabpanel"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0");const e=hd(this);e&&tr(e,e.getAttribute("value"))}render(){return l`<slot></slot>`}};et.props=["for"],et.styles=[cd],et.help={title:"Tab panel",summary:'Auto-managed panel paired with a sibling <os-tabs>. Declares which tab it belongs to via `for="<tab-value>"`; the parent strip toggles `hidden` whenever the active tab changes. role="tabpanel" and tabindex="0" are set automatically.',status:"stable",props:[{name:"for",type:"string",description:"Matches the `value` of the owning <os-tab>. Panel is shown when its parent tabs strip is on that value."}],slots:[{name:"(default)",description:"Panel body content."}],example:l`
827 <os-tabs value="two" label="Demo tabs">
828 <os-tab value="one">One</os-tab>
829 <os-tab value="two">Two</os-tab>
830 </os-tabs>
831 <os-tabpanel for="one">
832 Hidden — the strip is on "two".
833 </os-tabpanel>
834 <os-tabpanel for="two">
835 Visible, because this panel's <code>for</code> matches the
836 strip's <code>value</code>.
837 </os-tabpanel>
838 `};let mo=et;y("os-tabpanel",mo);function ud(o,e,t){const s=o.querySelectorAll(`:scope > ${e}`);for(const i of Array.from(s))i.remove();for(const i of t){const n=document.createElement(e);n.setAttribute("value",i.value),n.textContent=i.label,o.appendChild(n)}}function hd(o){const e=o.parentElement;if(!e)return null;const t=e.querySelector(":scope > os-tabs");return t||o.closest("os-tabs")}function tr(o,e){const t=new Set,s=o.parentElement;if(s)for(const i of Array.from(s.querySelectorAll(":scope > os-tabpanel")))t.add(i);for(const i of Array.from(o.querySelectorAll(":scope > os-tabpanel")))t.add(i);for(const i of t){const n=i.getAttribute("for"),r=n!==null&&n===e;r?i.removeAttribute("hidden"):i.setAttribute("hidden",""),i.setAttribute("aria-hidden",r?"false":"true")}}const pd=v`:host{display:inline-flex}button{display:flex;align-items:center;justify-content:center;width:30px;height:30px;padding:0;border:none;border-radius:var( --os-ui-btn-radius,5px );background-color:var( --os-ui-btn-bg,transparent );background-image:var( --os-ui-btn-bg-image,none );background-repeat:var( --os-ui-btn-bg-image-repeat,no-repeat );background-size:var( --os-ui-btn-bg-image-size,auto );background-position:var( --os-ui-btn-bg-image-position,center );color:var( --os-ui-btn-color,currentColor );cursor:pointer;transition:background-color 0.15s ease,color 0.15s ease,transform 80ms ease}button:active{transform:scale( 0.9 )}@media ( prefers-reduced-motion:reduce ){button:active{transform:none}}button:hover{color:var( --os-ui-btn-color-hover,currentColor );background-color:var( --os-ui-btn-bg-hover,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) )}button:focus-visible{color:var( --os-ui-btn-color-hover,currentColor );background-color:var( --os-ui-btn-bg-hover,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) );outline:2px solid var( --os-ui-btn-outline,currentColor );outline-offset:1px}:host( [ active ] ) button{color:var( --os-ui-btn-color-hover,currentColor );background-color:var( --os-ui-btn-bg-active,var( --os-ui-hover,rgba( 0,0,0,0.08 ) ) )}:host( [ danger ] ) button:hover{color:var( --os-ui-fg-on-accent,#fff );background-color:var( --os-ui-btn-danger-hover,var( --os-ui-danger,#d63638 ) )}svg{display:block;pointer-events:none;flex-shrink:0}svg:empty{display:none}.themed-icon{display:block;width:14px;height:14px;flex-shrink:0;pointer-events:none;background-color:var( --os-ui-btn-icon-color,currentColor )}::slotted( span ){line-height:1}::slotted( svg ){display:block}`,gd={minimize:'<path d="M3 6h6" stroke="currentColor" stroke-width="1.25" stroke-linecap="round"/>',maximize:'<rect x="3" y="3" width="6" height="6" rx="1" stroke="currentColor" stroke-width="1.25" fill="none"/>',fullscreen:'<path d="M4.5 2H2v2.5M10 4.5V2H7.5M4.5 10H2V7.5M10 7.5V10H7.5" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',"fullscreen-exit":'<path d="M2 4.5H4.5V2M7.5 2V4.5H10M2 7.5H4.5V10M7.5 10V7.5H10" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',detach:'<path d="M5 2H2.5v7.5H10V7M6.5 2H10v3.5M10 2L5.5 6.5" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',reload:'<g transform="translate(0.6 0.6) scale(0.021)" fill="currentColor"><path d="m504.554 233.704-76.447 91.467c-6.329 7.572-15.417 11.479-24.571 11.479a31.872 31.872 0 0 1-20.504-7.447l-91.467-76.447c-13.561-11.334-15.366-31.515-4.032-45.075s31.515-15.366 45.075-4.032l37.506 31.347c-10.274-74.891-74.668-132.774-152.337-132.774C132.984 102.223 64 171.207 64 256s68.984 153.777 153.777 153.777c17.673 0 32 14.327 32 32s-14.327 32-32 32c-58.17 0-112.859-22.653-153.991-63.785C22.653 368.859 0 314.17 0 256s22.653-112.859 63.786-153.992c41.132-41.132 95.821-63.785 153.991-63.785s112.859 22.653 153.992 63.785c32.517 32.516 53.471 73.508 60.829 117.991l22.849-27.339c11.334-13.56 31.515-15.364 45.075-4.032 13.56 11.335 15.365 31.516 4.032 45.076z"/></g>',close:'<path d="M3.25 3.25l5.5 5.5M3.25 8.75l5.5-5.5" stroke="currentColor" stroke-width="1.25" stroke-linecap="round"/>',menu:'<circle cx="3" cy="6" r="1.2" fill="currentColor"/><circle cx="6" cy="6" r="1.2" fill="currentColor"/><circle cx="9" cy="6" r="1.2" fill="currentColor"/>'};function fd(o){const e=(o??"").trim();return e===""||e.length>4096||!/^(https?:\/\/|data:image\/)/i.test(e)||/['"()\\<>\s]/.test(e)?"":e}const tt=class tt extends _{constructor(){super(...arguments),this._activateWired=!1}static get observedAttributes(){return[...super.observedAttributes,"aria-label"]}render(){const e=fd(this["icon-src"]||this.getAttribute("icon-src")||""),t=e?"":this.icon||"",s=gd[t]||"",i=this.getAttribute("aria-label")||"";return e?l`
839 <button type="button" aria-label="${i}">
840 <span
841 class="themed-icon"
842 aria-hidden="true"
843 style="-webkit-mask: url('${e}') center / contain no-repeat; mask: url('${e}') center / contain no-repeat;"
844 ></span>
845 <slot></slot>
846 </button>
847 `:l`
848 <button type="button" aria-label="${i}">
849 <svg
850 width="14"
851 height="14"
852 viewBox="0 0 12 12"
853 aria-hidden="true"
854 focusable="false"
855 ></svg>
856 <slot></slot>
857 </button>
858 <span data-svg-buffer style="display:none">${s}</span>
859 `}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this._paintSvg()),queueMicrotask(()=>this._wireActivateEvent())}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),queueMicrotask(()=>this._paintSvg())}_paintSvg(){const e=this.shadowRoot;if(!e)return;const t=e.querySelector("svg"),s=e.querySelector("[data-svg-buffer]");if(t&&s){const i=s.textContent||"";t.innerHTML!==i&&(t.innerHTML=i)}}_wireActivateEvent(){if(this._activateWired)return;const e=this.shadowRoot;if(!e)return;const t=e.querySelector("button");t&&(this._activateWired=!0,t.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("os-button-activate",{bubbles:!0,composed:!0,cancelable:!0}))}))}};tt.props=["icon","icon-src","active","danger"],tt.styles=[pd],tt.help=void 0;let vo=tt;y("os-window-button",vo);const bd=v` ${S} ${Fs}:host{display:block;animation:os-holo-enter var( --_holo-t ) var( --_holo-spring );transform-origin:top left;min-width:220px;padding:4px;background:var( --os-window-bg,#fff );background-image:var( --os-ui-menu-bg-image,none );background-repeat:var( --os-ui-menu-bg-image-repeat,repeat );background-size:var( --os-ui-menu-bg-image-size,auto );background-position:var( --os-ui-menu-bg-image-position,center );color:var( --os-ui-fg,#1d2327 );border:1px solid var( --os-window-border,#c3c4c7 );border-radius:8px;box-shadow:0 8px 24px rgba( 0,0,0,0.18 ),0 2px 6px rgba( 0,0,0,0.08 )}:host(:dir( rtl ) ){transform-origin:top right}@media ( prefers-reduced-motion:reduce ){:host{animation:none}}:host( [ hidden ] ){display:none}`,md=v`:host{display:block}button{display:flex;align-items:center;gap:10px;width:100%;min-height:32px;padding:6px 10px;border:none;border-radius:6px;background:transparent;color:inherit;font:inherit;font-size:13px;line-height:1.3;text-align:start;cursor:pointer;transition:background-color 0.12s ease,color 0.12s ease}button:hover,button:focus-visible{background:var( --os-ui-hover,rgba( 0,0,0,0.06 ) );color:var( --os-ui-fg,#000 );outline:none}button:focus-visible{outline:none;box-shadow:inset 0 0 0 2px var( --os-ui-accent,#2271b1 )}.os-menu-item__icon{flex-shrink:0;width:18px;height:18px;font-size:18px;line-height:1;color:var( --wp-admin-theme-color,#2271b1 )}.os-menu-item__icon[ hidden ]{display:none}.os-menu-item__label{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.os-menu-item__check{flex-shrink:0;width:16px;height:16px;border-radius:3px;border:1.5px solid var( --os-ui-border,rgba( 0,0,0,0.25 ) );position:relative;background:transparent;transition:background-color 0.12s ease,border-color 0.12s ease}.os-menu-item__check[ hidden ]{display:none}:host( [ checked ] ) .os-menu-item__check{background-color:transparent;background-image:var( --os-ui-holo-fill,linear-gradient( 124deg,#afa2e8 0%,#f5a8ea 46%,#8ee9f7 100% ) );background-size:200% 200%;background-position:25% 30%;border-color:transparent;box-shadow:var( --os-ui-holo-glow,0 0 0 1px rgba( 242,82,252,0.28 ),0 2px 10px rgba( 242,82,252,0.22 ) )}:host( [ checked ] ) .os-menu-item__check::after{content:'';position:absolute;top:1px;left:4px;width:4px;height:8px;border:solid var( --os-ui-holo-ink,#0c0b0f );border-width:0 2px 2px 0;transform:rotate( 45deg )}`,ms=class ms extends _{connectedCallback(){super.connectedCallback(),this.setAttribute("role","menu")}render(){return l`<slot></slot>`}};ms.styles=[bd],ms.help=void 0;let _o=ms;y("os-menu",_o);const st=class st extends _{connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","menuitem")}render(){const e=this.icon||"",t=this.getAttribute("role")==="menuitemcheckbox",s=this.checked!==null;return t&&this.setAttribute("aria-checked",s?"true":"false"),l`
860 <button type="button" @click=${i=>this._onPick(i)}>
861 <span
862 class="os-menu-item__check"
863 ?hidden=${!t}
864 ></span>
865 <span
866 class="os-menu-item__icon dashicons ${e}"
867 aria-hidden="true"
868 ?hidden=${t||!e}
869 ></span>
870 <span class="os-menu-item__label">
871 <slot></slot>
872 </span>
873 </button>
874 `}_onPick(e){e.preventDefault(),this.emit("os-menu-item-click",{value:this.value})}};st.props=["icon","value","checked"],st.styles=[md],st.help={title:"Menu item",summary:'Single row inside a <os-menu>. Supports three looks: plain label, left-aligned dashicon (icon="dashicons-…"), or a checkbox indicator (role="menuitemcheckbox" + checked).',status:"stable",props:[{name:"icon",type:"string (dashicons class)",description:'Dashicons class rendered on the left. Ignored when role="menuitemcheckbox".'},{name:"value",type:"string",description:"Identifier emitted in os-menu-item-click.detail.value."},{name:"checked",type:"boolean attribute",description:'Visible check indicator. Only honoured when role="menuitemcheckbox".'}],slots:[{name:"(default)",description:"Menu item label."}],events:[{name:"os-menu-item-click",description:"Fires when the item is clicked; bubbles so the <os-menu> parent can delegate.",detail:"{ value: string | null }"}],example:l`
875 <os-menu>
876 <os-menu-item value="plain">Plain item</os-menu-item>
877 <os-menu-item value="icon" icon="dashicons-external">
878 With an icon
879 </os-menu-item>
880 <os-menu-item value="startup" role="menuitemcheckbox" checked>
881 Checked (menuitemcheckbox)
882 </os-menu-item>
883 </os-menu>
884 `};let yo=st;y("os-menu-item",yo);const vd=v` ${S} ${Fs}:host{display:none;position:fixed;min-width:180px;background-color:var( --os-ui-context-menu-bg,#1d2327 );background-image:var( --os-ui-menu-bg-image,none );background-repeat:var( --os-ui-menu-bg-image-repeat,repeat );background-size:var( --os-ui-menu-bg-image-size,auto );background-position:var( --os-ui-menu-bg-image-position,center );color:var( --os-ui-context-menu-fg,var( --os-fg,#fff ) );border:1px solid var( --os-ui-border,rgba( 255,255,255,0.08 ) );border-radius:8px;box-shadow:0 8px 24px rgba( 0,0,0,0.45 );padding:4px;font-size:13px;line-height:1.3;z-index:9999}:host( [ open ] ){display:block;animation:os-holo-enter var( --_holo-t-fast ) var( --_holo-ease );transform-origin:top left;box-sizing:border-box;max-block-size:calc( 100vh - 16px );max-block-size:calc( 100dvh - 16px );overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}:host( [ open ]:dir( rtl ) ){transform-origin:top right}@media ( prefers-reduced-motion:reduce ){:host( [ open ] ){animation:none}}`,_d=v`:host{display:flex;align-items:center;gap:10px;width:100%;padding:8px 10px;border:0;background:transparent;color:inherit;text-align:start;cursor:pointer;border-radius:4px;box-sizing:border-box;user-select:none}:host(:hover ),:host( [ active ] ){background:var( --os-ui-hover,rgba( 255,255,255,0.1 ) );outline:none}:host( [ disabled ] ){opacity:0.45;cursor:not-allowed}:host( [ danger ] ){color:var( --os-ui-danger-hover,#ff8a8a )}:host( [ danger ]:hover ){background:var( --os-ui-badge-danger-bg,rgba( 255,90,90,0.18 ) )}:host( [ heading ] ){padding:8px 10px 4px;font-size:10px;font-weight:700;letter-spacing:0.06em;text-transform:uppercase;color:var( --os-ui-context-menu-fg-muted,var( --os-ui-fg-muted,rgba( 255,255,255,0.5 ) ) );pointer-events:none}.icon{display:inline-flex;align-items:center;justify-content:center;font-size:18px;width:20px;height:20px}.label{flex:1}.chevron{margin-inline-start:auto;padding-inline-start:8px;font-size:16px;line-height:1;opacity:0.7}.check{display:inline-flex;align-items:center;justify-content:center;width:14px;font-size:13px;line-height:1;opacity:0.95}`,ot=class ot extends _{render(){return l`
885 <slot></slot>
886 `}connectedCallback(){super.connectedCallback(),this.setAttribute("role","menu")}};ot.props=["open"],ot.styles=[vd],ot.help=void 0;let wo=ot;y("os-context-menu",wo);const it=class it extends _{constructor(){super(...arguments),this._onActivate=e=>{if(this.hasAttribute("disabled")||this.hasAttribute("heading"))return;const t=e.target;t&&t!==this&&t.closest("os-context-menu-option")!==this||this.emit("os-context-menu-pick",{id:this.dataset.menuItemId??this.id??"",value:this.getAttribute("value")??""})},this._onKey=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this._onActivate(e))}}connectedCallback(){super.connectedCallback();const e=this.hasAttribute("heading");this.setAttribute("role",e?"presentation":"menuitem"),e||this.setAttribute("tabindex","0"),this.addEventListener("click",this._onActivate),this.addEventListener("keydown",this._onKey)}disconnectedCallback(){this.removeEventListener("click",this._onActivate),this.removeEventListener("keydown",this._onKey)}render(){const e=this.getAttribute("icon"),t=this.hasAttribute("has-children"),s=this.hasAttribute("checked");return l`
887 ${s?l`<span class="check" aria-hidden="true">✓</span>`:l``}
888 ${e?l`<span class="icon dashicons ${e}" aria-hidden="true"></span>`:l``}
889 <span class="label"><slot></slot></span>
890 ${t?l`<span class="chevron" aria-hidden="true">›</span>`:l``}
891 `}};it.props=["value","icon","disabled","danger","heading","has-children","checked"],it.styles=[_d],it.help={title:"Context menu option",summary:"Single row inside <os-context-menu>. Use `icon` for a leading dashicon, `danger` for destructive items, `heading` for a non-interactive section header, `has-children` to render a trailing chevron.",status:"stable",props:[{name:"value",type:"string",description:"Forwarded as `detail.value` on activation."},{name:"icon",type:"string",description:"Dashicon class (e.g. `dashicons-trash`)."},{name:"disabled",type:"boolean attribute",description:"Renders the option dimmed; clicks are ignored."},{name:"danger",type:"boolean attribute",description:"Destructive styling — red text, red hover."},{name:"heading",type:"boolean attribute",description:"Non-interactive section header. Ignores clicks."},{name:"has-children",type:"boolean attribute",description:"Renders a trailing chevron to suggest a submenu."},{name:"checked",type:"boolean attribute",description:"Renders a leading check mark — for radio-style picks inside a submenu (e.g. the active Sort By order)."}],slots:[{name:"(default)",description:"Visible label."}],events:[{name:"os-context-menu-pick",description:"Bubbled on click / Enter for non-heading non-disabled options. Detail: `{ id, value }`."}],example:l`
892 <os-context-menu open style="position: relative; z-index: 0">
893 <os-context-menu-option heading>Every variant</os-context-menu-option>
894 <os-context-menu-option value="plain">Plain</os-context-menu-option>
895 <os-context-menu-option value="icon" icon="dashicons-admin-page">
896 With an icon
897 </os-context-menu-option>
898 <os-context-menu-option value="checked" checked>
899 Checked
900 </os-context-menu-option>
901 <os-context-menu-option value="children" has-children>
902 With a submenu
903 </os-context-menu-option>
904 <os-context-menu-option value="off" disabled>Disabled</os-context-menu-option>
905 <os-context-menu-option value="del" danger icon="dashicons-trash">
906 Danger
907 </os-context-menu-option>
908 </os-context-menu>
909 `};let xo=it;y("os-context-menu-option",xo);const yd=v` ${S}:host{display:none;position:fixed;inset:0;align-items:center;justify-content:center;background:var( --os-ui-scrim,rgba( 0,0,0,0.45 ) );background-image:var( --os-ui-scrim-image,none );background-repeat:var( --os-ui-scrim-image-repeat,repeat );background-size:var( --os-ui-scrim-image-size,auto );background-position:var( --os-ui-scrim-image-position,center );backdrop-filter:blur( 2px );z-index:10000}:host( [ open ] ){display:flex;animation:os-confirm-scrim var( --_holo-t ) var( --_holo-ease )}:host( [ open ] ) .dialog{animation:os-confirm-dialog var( --_holo-t ) var( --_holo-spring )}@keyframes os-confirm-scrim{from{opacity:0}}@keyframes os-confirm-dialog{from{opacity:0;transform:scale( 0.96 ) translateY( 8px )}}@media ( prefers-reduced-motion:reduce ){:host( [ open ] ),:host( [ open ] ) .dialog{animation:none}}.dialog{width:min( 420px,92vw );background-color:var( --os-ui-confirm-dialog-bg,#1d2327 );background-image:var( --os-ui-dialog-bg-image,none );background-repeat:var( --os-ui-dialog-bg-image-repeat,repeat );background-size:var( --os-ui-dialog-bg-image-size,auto );background-position:var( --os-ui-dialog-bg-image-position,center );color:var( --os-ui-confirm-dialog-fg,var( --os-fg,#fff ) );border:1px solid var( --os-ui-border,rgba( 255,255,255,0.08 ) );border-radius:10px;box-shadow:0 20px 50px rgba( 0,0,0,0.6 );padding:20px 22px 18px;display:flex;flex-direction:column;gap:10px;position:relative}.close{position:absolute;top:8px;right:10px;width:28px;height:28px;display:inline-flex;align-items:center;justify-content:center;background:transparent;border:0;border-radius:6px;color:var( --os-ui-confirm-dialog-fg-muted,var( --os-ui-fg-muted,rgba( 255,255,255,0.7 ) ) );cursor:pointer;font-size:22px;line-height:1;padding:0}.close:hover{background:var( --os-ui-hover,rgba( 255,255,255,0.08 ) );color:inherit}.btn:focus,.close:focus{outline:none;box-shadow:var( --_holo-focus )}.dialog:focus,.dialog:focus-visible{outline:none}.title{margin:0 0 4px;font-size:16px;font-weight:600}.message{margin:0;color:var( --os-ui-confirm-dialog-fg-muted,var( --os-ui-fg-muted,rgba( 255,255,255,0.7 ) ) );line-height:1.45;white-space:pre-line}.remember{display:flex;align-items:center;gap:8px;margin-top:4px;font-size:12px;color:var( --os-ui-confirm-dialog-fg-muted,var( --os-ui-fg-muted,rgba( 255,255,255,0.7 ) ) );cursor:pointer;user-select:none}.remember__box{margin:0;accent-color:var( --os-ui-accent,#2271b1 );cursor:pointer}.remember__box:focus,.remember__box:focus-visible{outline:none;box-shadow:var( --_holo-focus )}.actions{display:flex;justify-content:flex-end;gap:8px;margin-top:6px}.btn{border:0;border-radius:6px;padding:8px 14px;font-size:13px;cursor:pointer;font-weight:500}.btn--secondary{background:var( --os-ui-hover,rgba( 255,255,255,0.08 ) );color:inherit}.btn--secondary:hover{background:var( --os-ui-hover,rgba( 255,255,255,0.14 ) )}.btn--primary{background:var( --wp-admin-theme-color,#2271b1 );color:var( --os-ui-fg-on-accent,#fff )}.btn--primary:hover{filter:brightness( 1.08 )}.btn--danger{background:var( --os-ui-danger,#d63638 );color:var( --os-ui-fg-on-accent,#fff )}.btn--danger:hover{filter:brightness( 1.08 )}`,sr='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function wd(o){let e=o?.activeElement??null;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e&&e!==o?.body?e:null}function or(o){const e=o.composedPath(),t=e.length>0?e[0]:o.target;return t instanceof HTMLElement?t:null}function ir(o){return o!==null&&o.matches(sr)}const nt=class nt extends _{constructor(){super(...arguments),this._prevFocus=null,this._focusTries=0,this._onKey=e=>{if(e.key==="Escape"){e.preventDefault(),this._cancel();return}if(e.key==="Tab"){this._trapTab(e);return}if(e.key==="Enter"&&!e.isComposing){if(ir(or(e))||this.hasAttribute("danger"))return;e.preventDefault(),this._confirm()}},this._focusInitial=()=>{if(!this.hasAttribute("open"))return;const e=this.isConnected?this._initialFocusTarget():null;if(e){e.focus();return}if(this._focusTries++<5){queueMicrotask(this._focusInitial);return}this.isConnected&&this.focus()},this._onBackdrop=e=>{const t=e.composedPath();(t.length>0?t[0]:e.target)===this&&this._cancel()},this._confirm=()=>{this.emit("os-confirm",{confirmed:!0,remember:this._remembered()}),this.removeAttribute("open")},this._cancel=()=>{this.emit("os-cancel",{confirmed:!1}),this.removeAttribute("open")}}connectedCallback(){super.connectedCallback(),this.setAttribute("role","dialog"),this.setAttribute("aria-modal","true"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","-1"),this.addEventListener("keydown",this._onKey),this.addEventListener("click",this._onBackdrop)}disconnectedCallback(){this.removeEventListener("keydown",this._onKey),this.removeEventListener("click",this._onBackdrop),this._restoreFocus()}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e==="open"&&(s!==null?(this._prevFocus=wd(this.ownerDocument),this._focusTries=0,queueMicrotask(this._focusInitial)):this._restoreFocus())}_focusables(){const e=this.shadowRoot;return e?Array.from(e.querySelectorAll(sr)):[]}_trapTab(e){const t=this._focusables();if(t.length===0)return;const s=t[0],i=t[t.length-1],n=or(e),r=!ir(n);e.shiftKey&&(r||n===s)?(e.preventDefault(),i.focus()):!e.shiftKey&&(r||n===i)&&(e.preventDefault(),s.focus())}_initialFocusTarget(){const e=this.shadowRoot;if(!e)return null;const t=e.querySelector(".btn--secondary"),s=e.querySelector(".dialog");return this.hasAttribute("danger")?t??e.querySelector(".close")??s:e.querySelector(".btn--primary, .btn--danger")??t??s}_restoreFocus(){const e=this._prevFocus;this._prevFocus=null,!(!e||!e.isConnected)&&e.focus()}_remembered(){return this.shadowRoot?.querySelector(".remember__box")?.checked===!0}render(){const e=this.title??"",t=this.message??"",s=this["confirm-label"]||"Confirm",i=this["cancel-label"]||"Cancel",n=this.hasAttribute("danger"),r=this.hasAttribute("hide-cancel"),a=this.hasAttribute("dismissable"),c=this["remember-label"]??"";return l`
910 <div class="dialog" tabindex="-1">
911 ${a?l`<button
912 type="button"
913 class="close"
914 aria-label="Close"
915 @click=${()=>this._cancel()}
916 >&times;</button>`:l``}
917 ${e?l`<h2 class="title">${e}</h2>`:l``}
918 ${t?l`<p class="message">${t}</p>`:l``}
919 ${c?l`<label class="remember">
920 <input type="checkbox" class="remember__box" />
921 <span class="remember__label">${c}</span>
922 </label>`:l``}
923 <div class="actions">
924 ${r?l``:l`<button
925 type="button"
926 class="btn btn--secondary"
927 @click=${()=>this._cancel()}
928 >
929 ${i}
930 </button>`}
931 <button
932 type="button"
933 class="btn ${n?"btn--danger":"btn--primary"}"
934 @click=${()=>this._confirm()}
935 >
936 ${s}
937 </button>
938 </div>
939 </div>
940 `}};nt.props=["open","title","message","confirm-label","cancel-label","danger","hide-cancel","dismissable","remember-label"],nt.styles=[yd],nt.help=void 0;let ko=nt;y("os-confirm-dialog",ko);const xd=v`:host{display:block;position:relative;font-size:13px}.input{width:100%;padding:8px 10px;background:var( --os-ui-input-bg,var( --os-ui-hover,rgba( 255,255,255,0.06 ) ) );color:inherit;border:1px solid var( --os-ui-border,rgba( 255,255,255,0.12 ) );border-radius:6px;font:inherit;box-sizing:border-box}.input:focus{outline:none;border-color:var( --os-ui-accent,#2271b1 );box-shadow:var( --os-ui-focus-ring-field,0 0 0 1px #2271b1,0 0 0 4px rgba( 34,113,177,0.18 ) )}.dropdown{background:var( --os-bg,#1d2327 );color:var( --os-fg,#fff );border:1px solid var( --os-ui-border,rgba( 255,255,255,0.18 ) );border-radius:6px;overflow:auto;z-index:11000;box-shadow:0 12px 32px rgba( 0,0,0,0.5 )}.empty.error{color:var( --os-ui-danger-hover,#ff8080 )}.item{display:flex;align-items:center;gap:10px;padding:8px 10px;cursor:pointer;border:0;background:transparent;color:inherit;width:100%;text-align:start;font:inherit}.item:hover,.item:focus{background:var( --os-ui-hover,rgba( 255,255,255,0.06 ) );outline:none}.avatar{width:24px;height:24px;border-radius:50%;flex:0 0 auto;background:var( --os-ui-hover,rgba( 255,255,255,0.1 ) )}.name{font-weight:500}.slug{opacity:0.6;font-size:12px}.empty{padding:12px;color:var( --os-ui-fg-muted,rgba( 255,255,255,0.5 ) );font-size:12px}`,rt=class rt extends _{constructor(){super(...arguments),this._timer=null,this._abort=null,this._results=[],this._query="",this._open=!1,this._phase="idle",this._error="",this._dropdownStyle="",this._onScrollOrResize=()=>{},this._onInput=e=>{const t=e.target.value;this._query=t,this._scheduleSearch(t)},this._onFocus=()=>{if(this._results.length===0&&this._phase==="idle"){this._scheduleSearch(this._query);return}this._open=!0,this._positionDropdown(),this.requestUpdate()},this._onBlur=()=>{setTimeout(()=>{this._open=!1,this.requestUpdate()},150)},this._pick=e=>{this.emit("os-user-pick",{user:e}),this._results=[],this._open=!1,this._phase="idle",this._query="";const t=this.shadowRoot?.querySelector(".input");t&&(t.value=""),this.requestUpdate()}}connectedCallback(){super.connectedCallback(),this._onScrollOrResize=()=>{this._open&&(this._positionDropdown(),this.requestUpdate())},window.addEventListener("resize",this._onScrollOrResize),window.addEventListener("scroll",this._onScrollOrResize,!0)}disconnectedCallback(){this._timer&&clearTimeout(this._timer),this._abort&&this._abort.abort(),window.removeEventListener("resize",this._onScrollOrResize),window.removeEventListener("scroll",this._onScrollOrResize,!0)}_endpoint(){const e=this.getAttribute("endpoint");return e||window.openStationConfig?.filesUsersSearchUrl||""}_scheduleSearch(e){this._timer&&clearTimeout(this._timer),this._phase="loading",this._open=!0,this._positionDropdown(),this.requestUpdate(),this._timer=setTimeout(()=>this._runSearch(e),200)}async _runSearch(e){const t=this._endpoint();if(!t){this._phase="error",this._error="Search endpoint is not configured.",this._results=[],this._open=!0,this.requestUpdate();return}this._abort&&this._abort.abort();const s=new AbortController;this._abort=s;const i=this.getAttribute("exclude")||"",n=t+"?q="+encodeURIComponent(e)+"&exclude="+encodeURIComponent(i);try{const r={signal:s.signal,credentials:"same-origin"},a=await Pa(n,r,{source:"desktop-mode/files-user-search",silent:!0});if(!a.ok)throw new Error(`HTTP ${a.status}`);const c=await a.json();this._results=c&&Array.isArray(c.users)?c.users:[],this._phase="ready",this._error="",this._open=!0}catch(r){if(r.name==="AbortError")return;this._results=[],this._phase="error",this._error=r.message||"Search failed.",this._open=!0}this._positionDropdown(),this.requestUpdate()}_positionDropdown(){const e=this.shadowRoot?.querySelector(".input");if(!e)return;const t=e.getBoundingClientRect(),s=t.bottom+4,i=t.left,n=t.width,a=window.innerHeight-t.bottom,c=t.top,u=Math.max(120,Math.min(280,Math.max(a,c)-16));a<200&&c>a?this._dropdownStyle=["position:fixed",`left:${i}px`,`top:${t.top-4-u}px`,`width:${n}px`,`max-height:${u}px`].join(";"):this._dropdownStyle=["position:fixed",`left:${i}px`,`top:${s}px`,`width:${n}px`,`max-height:${u}px`].join(";")}_dropdownContent(){if(this._phase==="loading")return l`<div class="empty">Searching…</div>`;if(this._phase==="error")return l`<div class="empty error">${this._error}</div>`;if(this._results.length===0){const e=this._query?"No matches.":"No users available.";return l`<div class="empty">${e}</div>`}return this._results.map(e=>l`
941 <button
942 type="button"
943 class="item"
944 role="option"
945 @mousedown=${t=>t.preventDefault()}
946 @click=${()=>this._pick(e)}
947 >
948 <img class="avatar" src=${e.avatarUrl} alt="" />
949 <div>
950 <div class="name">${e.name}</div>
951 <div class="slug">${e.slug}</div>
952 </div>
953 </button>
954 `)}render(){const e=this.getAttribute("placeholder")||"Search users…";return l`
955 <input
956 class="input"
957 type="search"
958 placeholder=${e}
959 autocomplete="off"
960 @input=${this._onInput}
961 @focus=${this._onFocus}
962 @blur=${this._onBlur}
963 .value=${this._query}
964 />
965 ${this._open?l`
966 <div class="dropdown" role="listbox" style=${this._dropdownStyle}>
967 ${this._dropdownContent()}
968 </div>
969 `:l``}
970 `}};rt.props=["placeholder","exclude","endpoint"],rt.styles=[xd],rt.help=void 0;let $o=rt;y("os-user-search",$o);const kd=v`:host{display:flex;flex-wrap:wrap;gap:6px;font-size:13px}.chip{display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border-radius:999px;background:var( --os-ui-hover,rgba( 255,255,255,0.06 ) );color:inherit;border:1px solid var( --os-ui-border,rgba( 255,255,255,0.12 ) );cursor:pointer;font:inherit}.chip:hover{background:var( --os-ui-hover,rgba( 255,255,255,0.12 ) )}.chip[ aria-pressed='true' ]{background:var( --wp-admin-theme-color,#2271b1 );border-color:var( --wp-admin-theme-color,#2271b1 );color:var( --os-ui-fg-on-accent,#fff )}.empty{color:var( --os-ui-fg-muted,rgba( 255,255,255,0.5 ) );font-size:12px}`,at=class at extends _{constructor(){super(...arguments),this._onToggle=e=>{const t=!this._selectedSet().has(e);this.emit("os-role-toggle",{slug:e,selected:t})}}_selectedSet(){const e=this.getAttribute("selected")||"";return new Set(e.split(",").map(t=>t.trim()).filter(t=>t!==""))}_roles(){const e=this.getAttribute("roles");if(e)try{const t=JSON.parse(e);if(Array.isArray(t))return t}catch{}return window.openStationConfig?.shareEligibleRoles||[]}render(){const e=this._roles();if(e.length===0)return l`<span class="empty">No eligible roles.</span>`;const t=this._selectedSet();return l`
971 ${e.map(s=>{const i=t.has(s.slug);return l`
972 <button
973 type="button"
974 class="chip"
975 aria-pressed=${i?"true":"false"}
976 @click=${()=>this._onToggle(s.slug)}
977 >${s.name}</button>
978 `})}
979 `}};at.props=["selected","roles"],at.styles=[kd],at.help=void 0;let Eo=at;y("os-role-picker",Eo);const $d=v`:host{display:block;position:absolute;z-index:10;background:var( --os-ui-flyout-bg,var( --os-ui-surface-elevated,#ffffff ) );background-image:var( --os-ui-panel-bg-image,none );background-repeat:var( --os-ui-panel-bg-image-repeat,repeat );background-size:var( --os-ui-panel-bg-image-size,auto );background-position:var( --os-ui-panel-bg-image-position,center );color:var( --os-ui-flyout-fg,var( --os-fg,#1d2327 ) );border-radius:14px;box-shadow:var( --os-ui-flyout-shadow,0 16px 48px rgba( 0,25,53,0.4 ) );transform:translateX( 110% );opacity:0;pointer-events:none;transition:transform 220ms cubic-bezier( 0.22,1,0.36,1 ),opacity 180ms ease}:host( [ open ] ){transform:translateX( 0 );opacity:1;pointer-events:auto}:host( [ placement='end' ] ),:host(:not( [ placement ] ) ){inset-block:64px 14px;inset-inline-end:14px;width:min( 320px,calc( 100% - 28px ) )}:host( [ placement='start' ] ){inset-block:64px 14px;inset-inline-start:14px;width:min( 320px,calc( 100% - 28px ) );transform:translateX( -110% )}:host( [ placement='start' ][ open ] ){transform:translateX( 0 )}:host( [ placement='top' ] ){inset-block-start:14px;inset-inline:14px;max-block-size:calc( 100% - 28px );transform:translateY( -110% )}:host( [ placement='top' ][ open ] ){transform:translateY( 0 )}:host-context( [ dir='rtl' ] ):host( [ placement='end' ] ),:host-context( [ dir='rtl' ] ):host(:not( [ placement ] ) ){transform:translateX( -110% )}:host-context( [ dir='rtl' ] ):host( [ placement='end' ][ open ] ),:host-context( [ dir='rtl' ] ):host(:not( [ placement ] ) [ open ] ){transform:translateX( 0 )}:host-context( [ dir='rtl' ] ):host( [ placement='start' ] ){transform:translateX( 110% )}:host-context( [ dir='rtl' ] ):host( [ placement='start' ][ open ] ){transform:translateX( 0 )}:host::before{content:'';position:fixed;inset:0;background:var( --os-ui-flyout-backdrop,transparent );z-index:-1;pointer-events:none;transition:opacity 180ms ease;opacity:0}:host( [ open ] )::before{opacity:1}@media ( prefers-reduced-motion:reduce ){:host{transition:none}:host::before{transition:none}}`,nr=["a[href]","area[href]","button:not([disabled])",'input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]'].join(","),Ed="[data-flyout-close]",lt=class lt extends _{constructor(){super(...arguments),this._trigger=null,this._onDocKey=null,this._onScopePointerDown=null,this._onHostClick=null,this._onHostKeyDown=null,this._pendingReason=null}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","dialog"),this.hasAttribute("open")||this.setAttribute("inert","")}disconnectedCallback(){this._detachOpenListeners()}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e==="open"&&(s!==null&&t===null?this._handleOpen():s===null&&t!==null&&this._handleClose())}_handleOpen(){this.removeAttribute("inert");const e=this.ownerDocument,t=e?.activeElement??null;this._trigger=t instanceof HTMLElement&&t!==this&&t!==e?.body&&t!==e?.documentElement?t:null,queueMicrotask(()=>{if(!this.hasAttribute("open"))return;(this._firstFocusable()??this).focus?.({preventScroll:!0})}),this._attachOpenListeners()}_handleClose(){const e=this._pendingReason??"api";this._pendingReason=null,this.setAttribute("inert",""),this._detachOpenListeners(),this.emit("os-flyout-dismiss",{reason:e});const t=this._trigger;this._trigger=null,t&&t.isConnected&&t.focus?.({preventScroll:!0})}_dismiss(e){this.hasAttribute("open")&&(this._pendingReason=e,this.removeAttribute("open"))}_attachOpenListeners(){const e=this._resolveScopeRoot();this._onScopePointerDown=t=>{if(!this.hasAttribute("open"))return;const s=t.composedPath();s.includes(this)||this._trigger&&s.includes(this._trigger)||this._dismiss("pointer")},e.addEventListener("pointerdown",this._onScopePointerDown),this._onDocKey=t=>{t.key==="Escape"&&this.hasAttribute("open")&&(t.preventDefault(),this._dismiss("escape"))},document.addEventListener("keydown",this._onDocKey),this._onHostKeyDown=t=>{if(t.key!=="Tab")return;const s=this._allFocusable();if(s.length===0){t.preventDefault();return}const i=s[0],n=s[s.length-1],r=this.ownerDocument?.activeElement??null;t.shiftKey&&(r===i||r===this)?(t.preventDefault(),n.focus({preventScroll:!0})):!t.shiftKey&&r===n&&(t.preventDefault(),i.focus({preventScroll:!0}))},this.addEventListener("keydown",this._onHostKeyDown),this._onHostClick=t=>{const i=t.target?.closest?.(Ed);i&&this.contains(i)&&this._dismiss("close-button")},this.addEventListener("click",this._onHostClick)}_detachOpenListeners(){this._onDocKey&&(document.removeEventListener("keydown",this._onDocKey),this._onDocKey=null),this._onScopePointerDown&&(this._resolveScopeRoot().removeEventListener("pointerdown",this._onScopePointerDown),this._onScopePointerDown=null),this._onHostKeyDown&&(this.removeEventListener("keydown",this._onHostKeyDown),this._onHostKeyDown=null),this._onHostClick&&(this.removeEventListener("click",this._onHostClick),this._onHostClick=null)}_resolveScopeRoot(){const e=this.getAttribute("scope")??"window";return e==="document"?document.body:e==="parent"?this.parentElement??document.body:this.closest(".os-window__body")??this.parentElement??document.body}_firstFocusable(){return this.querySelector(nr)??null}_allFocusable(){return Array.from(this.querySelectorAll(nr)).filter(e=>!e.disabled)}render(){return l`<slot></slot>`}};lt.props=["open","placement","scope","aria-label","aria-labelledby"],lt.styles=[$d],lt.help=void 0;let Ao=lt;y("os-flyout",Ao);const Ad=v` ${S}:host{display:inline-flex}button{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;border-radius:4px;background:transparent;color:var( --os-ui-fg-muted,rgba( 0,0,0,0.45 ) );cursor:pointer;transition:background-color 0.15s ease,color 0.15s ease,transform 0.12s ease}:host( [ variant='detach' ] ) button:hover{color:var( --wp-admin-theme-color,#2271b1 );background:var( --os-ui-accent-soft,rgba( 34,113,177,0.12 ) );transform:translateY( -1px )}:host( [ variant='detach' ] ) button:focus-visible{outline:none;color:var( --os-ui-accent,#2271b1 );background:var( --os-ui-accent-soft,rgba( 34,113,177,0.12 ) );box-shadow:var( --_holo-focus )}:host( [ variant='close' ] ) button:hover{color:var( --os-ui-fg-on-accent,#fff );background:var( --os-ui-danger,#d63638 )}:host( [ variant='close' ] ) button:focus-visible{color:var( --os-ui-fg-on-accent,#fff );background:var( --os-ui-danger,#d63638 );outline:none;box-shadow:0 0 0 2px rgba( 12,11,15,0.9 ),0 0 0 4px var( --os-ui-danger,#d63638 ),0 0 12px 2px rgba( 214,54,56,0.45 )}svg{display:block;pointer-events:none;width:12px;height:12px}@media ( prefers-reduced-motion:reduce ){button{transition-duration:0.01ms}:host( [ variant='detach' ] ) button:hover{transform:none}}`,Cd={detach:'<path d="M5 2H2.5v7.5H10V7M6.5 2H10v3.5M10 2L5.5 6.5" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',close:'<path d="M2.5 2.5l7 7M9.5 2.5l-7 7" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/>'},ct=class ct extends _{render(){const e=this.variant||"",t=Cd[e]||"";return l`
980 <button type="button">
981 <svg
982 viewBox="0 0 12 12"
983 aria-hidden="true"
984 focusable="false"
985 ></svg>
986 <slot></slot>
987 </button>
988 <span data-svg-buffer style="display:none">${t}</span>
989 `}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this._paintSvg())}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),queueMicrotask(()=>this._paintSvg())}_paintSvg(){const e=this.shadowRoot;if(!e)return;const t=e.querySelector("svg"),s=e.querySelector("[data-svg-buffer]");if(t&&s){const i=s.textContent||"";t.innerHTML!==i&&(t.innerHTML=i)}}};ct.props=["variant"],ct.styles=[Ad],ct.help=void 0;let Co=ct;y("os-tab-chip",Co);const Sd=v`:host{display:flex;flex-direction:column;gap:var( --os-ui-stack-gap,12px );align-items:var( --os-ui-stack-align,stretch );padding:var( --os-ui-stack-padding,0 )}:host( [ hidden ] ){display:none}`,dt=class dt extends _{render(){const e=this.gap,t=this.align,s=this.padding,i=e&&/^\d+$/.test(e)?`${e}px`:"";return i&&this.style.setProperty("--os-ui-stack-gap",i),t&&this.style.setProperty("--os-ui-stack-align",t),s!==null&&/^\d+$/.test(s)&&this.style.setProperty("--os-ui-stack-padding",`${s}px`),l`<slot></slot>`}};dt.props=["gap","align","padding"],dt.styles=[Sd],dt.help=void 0;let So=dt;y("os-stack",So);const Ld=v`:host{display:flex;flex-direction:row;flex-wrap:wrap;gap:var( --os-ui-cluster-gap,8px );justify-content:var( --os-ui-cluster-justify,flex-start );align-items:var( --os-ui-cluster-align,center )}:host( [ hidden ] ){display:none}`,ut=class ut extends _{render(){const e=this.gap,t=this.justify,s=this.align,i=e&&/^\d+$/.test(e)?`${e}px`:"";return i&&this.style.setProperty("--os-ui-cluster-gap",i),t&&this.style.setProperty("--os-ui-cluster-justify",t),s&&this.style.setProperty("--os-ui-cluster-align",s),l`<slot></slot>`}};ut.props=["gap","justify","align"],ut.styles=[Ld],ut.help=void 0;let Lo=ut;y("os-cluster",Lo);const Rd=v`:host{display:inline-flex;align-items:center;justify-content:center;width:var( --os-ui-icon-size,16px );height:var( --os-ui-icon-size,16px );color:inherit;line-height:1}:host( [ hidden ] ){display:none}.os-icon__glyph{font-size:var( --os-ui-icon-size,16px );width:var( --os-ui-icon-size,16px );height:var( --os-ui-icon-size,16px );line-height:1;color:inherit;display:inline-flex;align-items:center;justify-content:center}.os-icon__glyph--char{font-family:dashicons;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;speak:none}.os-icon__glyph.dashicons{font-family:dashicons}`;let rs=null;function Id(o){let e=o.trim();if(e==="")return null;(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))&&(e=e.slice(1,-1));const t=e.match(/^\\([0-9a-f]{1,6})\s?$/i);return t?String.fromCodePoint(parseInt(t[1],16)):e||null}function rr(){const o=new Map;if(typeof document>"u")return o;const e=Array.from(document.styleSheets??[]);for(const t of e){let s=null;try{s=t.cssRules}catch{continue}if(s)for(const i of Array.from(s)){const n=i;if(!n||!n.selectorText)continue;const r=n.selectorText.match(/\.dashicons-([a-z0-9-]+)::?before/i);if(!r)continue;const a=n.style?.content;if(!a)continue;const c=Id(a);c&&o.set(r[1],c)}}return o}function Dd(o){rs||(rs=rr());const e=o.startsWith("dashicons-")?o.slice(10):o;return rs.get(e)??null}function Td(){rs=rr()}let ar=!1;function Nd(){if(ar||typeof window>"u")return;ar=!0;const o=()=>{Td()};document.readyState==="loading"&&document.addEventListener("DOMContentLoaded",o,{once:!0}),window.addEventListener("load",o,{once:!0})}Nd();const ht=class ht extends _{render(){const e=this.name||"",t=e.startsWith("dashicons-")?e.slice(10):e,s=this.size;s&&/^\d+$/.test(s)&&this.style.setProperty("--os-ui-icon-size",`${s}px`);const i=Dd(t);return i?l`<span
990 class="os-icon__glyph os-icon__glyph--char dashicons dashicons-${t}"
991 aria-hidden="true"
992 >${i}</span>`:l`<span
993 class="os-icon__glyph dashicons dashicons-${t}"
994 aria-hidden="true"
995 ></span>`}};ht.props=["name","size"],ht.styles=[Rd],ht.help=void 0;let Ro=ht;y("os-icon",Ro);const Pd=v`:host{display:flex;flex-direction:column;gap:var( --os-ui-body-gap,12px );padding:var( --os-ui-body-padding,16px );box-sizing:border-box;width:100%;height:100%;min-width:0;min-height:0}:host( [ scroll ] ){overflow:auto}:host( [ hidden ] ){display:none}::slotted( * ){min-width:0}`,pt=class pt extends _{render(){const e=this.gap,t=this.padding;return e&&/^\d+$/.test(e)&&this.style.setProperty("--os-ui-body-gap",`${e}px`),t&&/^\d+$/.test(t)&&this.style.setProperty("--os-ui-body-padding",`${t}px`),l`<slot></slot>`}};pt.props=["gap","padding","scroll"],pt.styles=[Pd],pt.help=void 0;let Io=pt;y("os-body",Io);const zd=v`:host{display:flex;flex-direction:column;gap:var( --os-ui-panel-gap,12px );padding:var( --os-ui-panel-padding,16px );background-image:var( --os-ui-panel-bg-image,none );background-repeat:var( --os-ui-panel-bg-image-repeat,repeat );background-size:var( --os-ui-panel-bg-image-size,auto );background-position:var( --os-ui-panel-bg-image-position,center );box-sizing:border-box}:host( [ hidden ] ){display:none}`,gt=class gt extends _{render(){const e=this.gap,t=this.padding;return e&&/^\d+$/.test(e)&&this.style.setProperty("--os-ui-panel-gap",`${e}px`),t&&/^\d+$/.test(t)&&this.style.setProperty("--os-ui-panel-padding",`${t}px`),l`<slot></slot>`}};gt.props=["gap","padding"],gt.styles=[zd],gt.help=void 0;let Do=gt;y("os-panel",Do);const Md=v`:host{display:grid;grid-template-columns:repeat( 12,minmax( 0,1fr ) );gap:var( --os-ui-row-gap,12px );row-gap:var( --os-ui-row-row-gap,var( --os-ui-row-gap,12px ) );column-gap:var( --os-ui-row-column-gap,var( --os-ui-row-gap,12px ) );width:100%;min-width:0}:host( [ hidden ] ){display:none}::slotted( [ col='1' ] ){grid-column:span 1}::slotted( [ col='2' ] ){grid-column:span 2}::slotted( [ col='3' ] ){grid-column:span 3}::slotted( [ col='4' ] ){grid-column:span 4}::slotted( [ col='5' ] ){grid-column:span 5}::slotted( [ col='6' ] ){grid-column:span 6}::slotted( [ col='7' ] ){grid-column:span 7}::slotted( [ col='8' ] ){grid-column:span 8}::slotted( [ col='9' ] ){grid-column:span 9}::slotted( [ col='10' ] ){grid-column:span 10}::slotted( [ col='11' ] ){grid-column:span 11}::slotted( [ col='12' ] ){grid-column:span 12}::slotted(:not( [ col ] ) ){grid-column:1 / -1}::slotted( * ){min-width:0}`,ft=class ft extends _{render(){const e=this.gap,t=this["column-gap"],s=this["row-gap"];return e&&/^\d+$/.test(e)&&this.style.setProperty("--os-ui-row-gap",`${e}px`),t&&/^\d+$/.test(t)&&this.style.setProperty("--os-ui-row-column-gap",`${t}px`),s&&/^\d+$/.test(s)&&this.style.setProperty("--os-ui-row-row-gap",`${s}px`),l`<slot></slot>`}};ft.props=["gap","column-gap","row-gap"],ft.styles=[Md],ft.help=void 0;let To=ft;y("os-row",To);const Od=v`:host{display:grid;grid-template-columns:var( --os-ui-grid-columns,1fr );grid-template-rows:var( --os-ui-grid-rows,auto );gap:var( --os-ui-grid-gap,8px );column-gap:var( --os-ui-grid-column-gap,var( --os-ui-grid-gap,8px ) );row-gap:var( --os-ui-grid-row-gap,var( --os-ui-grid-gap,8px ) )}:host( [ hidden ] ){display:none}`,bt=class bt extends _{render(){const e=this.columns,t=this.rows,s=this.gap,i=this["column-gap"],n=this["row-gap"];return e&&/^\d+$/.test(e)&&this.style.setProperty("--os-ui-grid-columns",`repeat(${e}, minmax(0, 1fr))`),t&&/^\d+$/.test(t)&&this.style.setProperty("--os-ui-grid-rows",`repeat(${t}, minmax(0, 1fr))`),s&&/^\d+$/.test(s)&&this.style.setProperty("--os-ui-grid-gap",`${s}px`),i&&/^\d+$/.test(i)&&this.style.setProperty("--os-ui-grid-column-gap",`${i}px`),n&&/^\d+$/.test(n)&&this.style.setProperty("--os-ui-grid-row-gap",`${n}px`),l`<slot></slot>`}};bt.props=["columns","rows","gap","column-gap","row-gap"],bt.styles=[Od],bt.help=void 0;let No=bt;y("os-grid",No);const Wd=v`:host{display:flex;align-items:center;justify-content:var( --os-ui-display-align,flex-end );width:100%;min-height:calc( var( --os-ui-display-size,28px ) * 1.4 );padding:8px 14px;box-sizing:border-box;font-size:var( --os-ui-display-size,28px );font-variant-numeric:tabular-nums;font-weight:500;letter-spacing:0.01em;color:var( --os-ui-display-fg,var( --os-ui-fg,#1d2327 ) );background:var( --os-ui-display-bg,transparent );border-radius:var( --os-ui-display-border-radius,0 );line-height:1.1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host( [ hidden ] ){display:none}.os-display__output{display:block;font:inherit;color:inherit;text-align:var( --os-ui-display-align,end );overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}`,lr={sm:"16px",md:"20px",lg:"28px",xl:"40px"},mt=class mt extends _{connectedCallback(){super.connectedCallback?.(),this.hasAttribute("aria-live")||this.setAttribute("aria-live","polite"),this.hasAttribute("role")||this.setAttribute("role","status")}render(){const e=this.value,t=this.size||"lg",s=this.align||"end";return this.style.setProperty("--os-ui-display-size",lr[t]||lr.lg),this.style.setProperty("--os-ui-display-align",s),l`
996 <output part="output" class="os-display__output">
997 ${e??l`<slot></slot>`}
998 </output>
999 `}};mt.props=["value","size","align"],mt.styles=[Wd],mt.help=void 0;let Po=mt;y("os-display",Po);const Hd=v`:host{display:block}:host( [ hidden ] ){display:none}.os-disclosure__summary{display:flex;align-items:center;gap:8px;width:100%;padding:0;background:none;border:0;font:inherit;color:var( --os-ui-fg,#1d2327 );text-align:start;cursor:pointer}.os-disclosure__summary:focus-visible{outline:2px solid var( --os-ui-accent,#f252fc );outline-offset:2px;border-radius:4px}.os-disclosure__heading{flex:1 1 auto;min-width:0;margin:0;font-size:20px;font-weight:500;letter-spacing:-0.01em}.os-disclosure__hint{flex:0 0 auto;font-size:13px;font-weight:400;color:var( --os-ui-fg-muted,#646970 )}.os-disclosure__marker{flex:0 0 auto;width:8px;height:8px;margin-inline-end:2px;border-inline-end:2px solid currentColor;border-block-end:2px solid currentColor;transform:rotate( -45deg );transition:transform 160ms ease;opacity:0.7}:host( [ open ] ) .os-disclosure__marker{transform:rotate( 45deg )}@media ( prefers-reduced-motion:reduce ){.os-disclosure__marker{transition:none}}.os-disclosure__body{margin-block-start:14px}.os-disclosure__body[ hidden ]{display:none}`;let Ud=0;const vt=class vt extends _{constructor(){super(...arguments),this.bodyId=`os-disclosure-body-${++Ud}`,this.onToggle=()=>{const e=!this.isOpen();e?this.setAttribute("open",""):this.removeAttribute("open"),this.emit("os-disclosure-toggle",{open:e})}}isOpen(){return this.hasAttribute("open")}render(){const e=this.heading||"",t=this.hint||"",s=this.isOpen();return l`
1000 <button
1001 type="button"
1002 class="os-disclosure__summary"
1003 part="summary"
1004 aria-expanded=${s?"true":"false"}
1005 aria-controls=${this.bodyId}
1006 @click=${this.onToggle}
1007 >
1008 <span class="os-disclosure__marker" aria-hidden="true"></span>
1009 <h3 class="os-disclosure__heading">${e}</h3>
1010 ${t?l`<span class="os-disclosure__hint">${t}</span>`:""}
1011 </button>
1012 <div
1013 id=${this.bodyId}
1014 class="os-disclosure__body"
1015 part="body"
1016 ?hidden=${!s}
1017 >
1018 <slot></slot>
1019 </div>
1020 `}};vt.props=["heading","hint","open"],vt.styles=[Hd],vt.help=void 0;let zo=vt;y("os-disclosure",zo);const qd=v`:host{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:32px 24px;text-align:center;color:var( --os-ui-empty-state-fg,var( --os-ui-fg-muted,#646970 ) )}:host( [ hidden ] ){display:none}.os-empty-state__icon{margin-bottom:4px;color:var( --os-ui-empty-state-icon-color,currentColor );opacity:0.75}.os-empty-state__heading{margin:0;font-size:14px;font-weight:600;color:var( --os-ui-fg,#1d2327 )}.os-empty-state__description{margin:0;font-size:12px;line-height:1.4;max-width:48ch}.os-empty-state__description:empty{display:none}.os-empty-state__cta{margin-top:8px}.os-empty-state__cta:empty{display:none}`,_t=class _t extends _{render(){const e=this.icon||"",t=this.heading||"",s=this.description||"";return l`
1021 ${e?l`<os-icon
1022 class="os-empty-state__icon"
1023 name=${e}
1024 size="28"
1025 ></os-icon>`:null}
1026 <h3 class="os-empty-state__heading">${t}</h3>
1027 <p class="os-empty-state__description">${s}</p>
1028 <div class="os-empty-state__cta">
1029 <slot name="cta"></slot>
1030 </div>
1031 <slot></slot>
1032 `}};_t.props=["icon","heading","description"],_t.styles=[qd],_t.help=void 0;let Mo=_t;y("os-empty-state",Mo);const Fd=v` ${S} ${os} ${is} ${qs}:host{display:inline-flex;user-select:none}:host( [ fill-cell ] ),:host{display:flex;width:100%}:host( [ hidden ] ){display:none}button{width:100%;min-height:var( --os-ui-key-min-height,48px );appearance:none;display:inline-flex;align-items:center;justify-content:center;padding:var( --os-ui-key-padding,8px 12px );font:inherit;font-size:var( --os-ui-key-font-size,16px );font-weight:500;cursor:pointer;border-radius:var( --os-ui-key-border-radius,8px );background:var( --os-ui-key-bg,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) );color:var( --os-ui-key-fg,var( --os-ui-fg,#1d2327 ) );border:var( --os-ui-key-border,1px solid transparent );transition:transform 0.08s ease,background-color 0.12s ease,box-shadow 0.12s ease}button:hover:not(:disabled ){background:var( --os-ui-key-bg-hover,var( --os-ui-hover,rgba( 0,0,0,0.1 ) ) )}button:focus-visible{outline:none;box-shadow:var( --_holo-focus )}button:disabled::before{opacity:0 !important}:host( [ variant='primary' ] ) button{background:var( --os-ui-key-bg,var( --wp-admin-theme-color,#2271b1 ) );color:var( --os-ui-key-fg,var( --os-ui-fg-on-accent,#fff ) )}:host( [ variant='primary' ] ) button:hover:not(:disabled ){filter:brightness( 1.06 )}:host( [ variant='secondary' ] ) button{background:var( --os-ui-key-bg,var( --os-ui-hover,rgba( 0,0,0,0.04 ) ) )}:host( [ variant='ghost' ] ) button{background:transparent;border:var( --os-ui-key-border,1px solid var( --os-ui-border,#c3c4c7 ) )}:host( [ variant='danger' ] ) button{background:transparent;color:var( --os-ui-danger,#d63638 );border:1px solid currentColor}:host( .os-key--pressed ) button,button:active:not(:disabled ){transform:scale( 0.96 );box-shadow:inset 0 1px 2px rgba( 0,0,0,0.22 );background:var( --os-ui-key-bg-pressed,var( --os-ui-hover,rgba( 0,0,0,0.14 ) ) )}button:disabled{opacity:0.5;cursor:not-allowed}`,as="os-key--pressed",yt=class yt extends _{constructor(){super(...arguments),this._onKeyDown=null,this._onKeyUp=null,this._keyHeldByKeyboard=!1}connectedCallback(){super.connectedCallback?.(),this._onKeyDown=e=>this.handleKeyboardDown(e),this._onKeyUp=e=>this.handleKeyboardUp(e),document.addEventListener("keydown",this._onKeyDown),document.addEventListener("keyup",this._onKeyUp)}disconnectedCallback(){this._onKeyDown&&document.removeEventListener("keydown",this._onKeyDown),this._onKeyUp&&document.removeEventListener("keyup",this._onKeyUp)}render(){const e=this.label,t=this.disabled!==null;return l`
1033 <button
1034 part="button"
1035 class="os-holo-sheen"
1036 type="button"
1037 ?disabled=${t}
1038 @click=${s=>this.handleClick(s)}
1039 >
1040 ${e!=null&&e!==""?e:l`<slot></slot>`}
1041 <span class="os-holo-glint" aria-hidden="true"></span>
1042 <span class="os-holo-ring" aria-hidden="true"></span>
1043 </button>
1044 `}handleClick(e){if(this.isDisabled())return;const t=this.buildDetail("click");this.flashPressed(),this.hasAttribute("hold")?(this.emitKey("os-key-down",t),this.emitKey("os-key-up",t)):this.emitKey("os-key",t),e.stopPropagation()}handleKeyboardDown(e){if(this.isDisabled()||!this.matchesEvent(e)||this._keyHeldByKeyboard)return;this._keyHeldByKeyboard=!0,this.classList.add(as);const t=this.buildDetail("keyboard");this.hasAttribute("hold")?this.emitKey("os-key-down",t):this.emitKey("os-key",t)}handleKeyboardUp(e){!this._keyHeldByKeyboard||!this.matchesEvent(e,!0)||(this._keyHeldByKeyboard=!1,this.classList.remove(as),this.hasAttribute("hold")&&this.emitKey("os-key-up",this.buildDetail("keyboard")))}matchesEvent(e,t=!1){const s=this.code||"",i=this.key||"";if(s){if(e.code!==s)return!1}else if(i){if(e.key!==i)return!1}else return!1;const n=this.modifier||"",r=new Set(n.split("+").map(p=>p.trim().toLowerCase()).filter(Boolean)),a=r.has("ctrl")||r.has("control"),c=r.has("alt"),u=r.has("shift"),h=r.has("meta")||r.has("cmd")||r.has("command");return e.ctrlKey===a&&e.altKey===c&&e.shiftKey===u&&e.metaKey===h}buildDetail(e){const t=this.label||this.textContent?.trim()||"";return{key:this.key||"",code:this.code||"",label:t,source:e}}isDisabled(){return this.disabled!==null}emitKey(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}flashPressed(){this.classList.add(as),window.setTimeout(()=>{this.classList.remove(as)},120)}};yt.props=["key","code","label","variant","fill-cell","hold","modifier","disabled"],yt.styles=[Fd],yt.help=void 0;let Oo=yt;y("os-key",Oo);const Vd=v`:host{display:inline}:host( [ hidden ] ){display:none}code{font-family:var( --os-ui-code-font-family,ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace );font-size:var( --os-ui-code-font-size,0.92em );padding:var( --os-ui-code-padding,0.1em 0.4em );border-radius:var( --os-ui-code-border-radius,4px );background:var( --os-ui-code-bg,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) );color:var( --os-ui-code-fg,var( --os-ui-fg,#1d2327 ) );border:var( --os-ui-code-border,1px solid rgba( 0,0,0,0.08 ) );white-space:var( --os-ui-code-white-space,nowrap );overflow-wrap:anywhere}:host( [ block ] ){display:block}:host( [ block ] ) code{display:block;padding:var( --os-ui-code-block-padding,10px 12px );white-space:pre;max-block-size:var( --os-ui-code-block-max-block-size,none );overflow:auto}:host( [ wrap ] ) code{white-space:pre-wrap;overflow-wrap:anywhere}:host( [ copy ] ){position:relative}:host( [ copy ] ):not( [ block ] ){display:inline-flex;align-items:center;gap:var( --os-ui-code-copy-gap,8px )}.copy{appearance:none;display:inline-flex;align-items:center;justify-content:center;flex:none;inline-size:var( --os-ui-code-copy-size,24px );block-size:var( --os-ui-code-copy-size,24px );background:transparent;border:0;border-radius:4px;padding:0;margin:0;font:inherit;cursor:pointer;color:var( --os-ui-code-copy-color,var( --os-ui-fg-muted,#57606a ) );opacity:var( --os-ui-code-copy-opacity,0.6 );transition:opacity 120ms ease,color 120ms ease,background-color 120ms ease;line-height:1;font-size:1.05em}.copy:hover,.copy:focus-visible{opacity:1;color:var( --os-ui-code-copy-color-hover,var( --wp-admin-theme-color,#007cba ) );background:var( --os-ui-code-copy-bg,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) )}:host( [ block ] ) .copy{position:absolute;top:6px;inset-inline-end:6px;background:var( --os-ui-code-copy-bg,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) );opacity:var( --os-ui-code-copy-opacity,0.6 )}:host( [ block ] ):hover .copy,:host( [ block ] ):focus-within .copy{opacity:1}:host( [ block ][ copy ] ) code{padding-inline-end:var( --os-ui-code-copy-inset,42px )}`,wt=class wt extends _{constructor(){super(...arguments),this._copied=!1,this._resetTimer=null,this._onCopy=e=>{e.stopPropagation();const t=this._readSlotText();if(t==="")return;const s=n=>{n&&(this._copied=!0,this.requestUpdate(),this.emit("os-copy",{text:t}),this._resetTimer&&clearTimeout(this._resetTimer),this._resetTimer=setTimeout(()=>{this._copied=!1,this._resetTimer=null,this.requestUpdate()},1500))},i=navigator.clipboard;i&&typeof i.writeText=="function"?i.writeText(t).then(()=>s(!0),()=>s(this._fallbackCopy(t))):s(this._fallbackCopy(t))}}_readSlotText(){const e=this.shadowRoot?.querySelector("slot");return e?e.assignedNodes({flatten:!0}).map(i=>i.textContent??"").join("").trim():(this.textContent||"").trim()}_fallbackCopy(e){try{const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="absolute",t.style.left="-9999px",document.body.appendChild(t),t.select();const s=document.execCommand("copy");return document.body.removeChild(t),s}catch{return!1}}render(){const e=this.getAttribute("copy")!==null;return l`<code><slot></slot></code>${e?l`<button
1045 type="button"
1046 class="copy"
1047 part="copy"
1048 aria-label="${this._copied?"Copied":"Copy code to clipboard"}"
1049 title="${this._copied?"Copied":"Copy to clipboard"}"
1050 @click=${this._onCopy}
1051 >
1052 ${this._copied?"✓":"⧉"}
1053 </button>`:""}`}};wt.props=["block","copy","wrap"],wt.styles=[Vd],wt.help=void 0;let Wo=wt;y("os-code",Wo);const Kd=v` ${S}:host{display:inline-flex;align-items:center;gap:var( --os-ui-badge-gap,6px );padding:var( --os-ui-badge-padding,2px 8px );font:var( --os-ui-badge-font,500 12px/1.4 var( --os-font,system-ui ) );color:var( --os-ui-badge-color,var( --os-ui-fg,#1d2327 ) );background:var( --os-ui-badge-bg,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) );border:var( --os-ui-badge-border,1px solid transparent );border-radius:var( --os-ui-badge-border-radius,999px );white-space:nowrap;vertical-align:baseline}:host( [ hidden ] ){display:none}.dot{width:var( --os-ui-badge-dot-size,8px );height:var( --os-ui-badge-dot-size,8px );border-radius:50%;background:currentColor;flex:0 0 auto}:host( [ tone="success" ] ){--os-ui-badge-color:var( --os-ui-badge-success,var( --os-ui-success-fg,#1a7f37 ) );--os-ui-badge-bg:var( --os-ui-badge-success-bg,rgba( 26,127,55,0.12 ) )}:host( [ tone="warning" ] ){--os-ui-badge-color:var( --os-ui-badge-warning,var( --os-ui-warning-fg,#9a6700 ) );--os-ui-badge-bg:var( --os-ui-badge-warning-bg,rgba( 154,103,0,0.12 ) )}:host( [ tone="danger" ] ){--os-ui-badge-color:var( --os-ui-badge-danger,var( --os-ui-danger,#cf222e ) );--os-ui-badge-bg:var( --os-ui-badge-danger-bg,rgba( 207,34,46,0.12 ) )}:host( [ tone="info" ] ){--os-ui-badge-color:var( --os-ui-badge-info,var( --os-ui-info-fg,#0969da ) );--os-ui-badge-bg:var( --os-ui-badge-info-bg,rgba( 9,105,218,0.12 ) )}:host( [ tone="neutral" ] ){--os-ui-badge-color:var( --os-ui-badge-neutral,var( --os-ui-fg-muted,#57606a ) );--os-ui-badge-bg:var( --os-ui-badge-neutral-bg,rgba( 87,96,106,0.12 ) )}:host( [ tone="accent" ] ){--os-ui-badge-color:var( --os-ui-badge-accent,var( --_holo-ink ) );background-color:transparent;background-image:var( --os-ui-badge-accent-bg,var( --_holo-fill ) );background-size:220% 220%;background-position:22% 28%;background-repeat:no-repeat;box-shadow:var( --_holo-glow );font-weight:600}:host( [ tone="accent" ] ) .dot{display:none}:host( [ no-dot ] ) .dot{display:none}`,xt=class xt extends _{render(){return l`<span class="dot" aria-hidden="true"></span><slot></slot>`}};xt.props=["tone","noDot"],xt.styles=[Kd],xt.help=void 0;let Ho=xt;y("os-badge",Ho);const jd=v`:host{position:absolute;width:var( --os-ui-ribbon-size,90px );height:var( --os-ui-ribbon-size,90px );overflow:hidden;pointer-events:none;z-index:var( --os-ui-ribbon-z,2 )}:host( [ hidden ] ){display:none}.banner{position:absolute;display:block;width:var( --os-ui-ribbon-banner-width,140px );padding:var( --os-ui-ribbon-padding,4px 0 );text-align:center;font:var( --os-ui-ribbon-font,700 10px/1.4 var( --os-font,system-ui ) );letter-spacing:var( --os-ui-ribbon-tracking,0.06em );text-transform:uppercase;color:var( --os-ui-ribbon-fg,var( --os-ui-fg-on-accent,#fff ) );background:var( --os-ui-ribbon-bg,var( --wp-admin-theme-color,#2271b1 ) );background-size:260% 260%;background-position:30% 40%;box-shadow:var( --os-ui-ribbon-shadow,0 2px 4px rgba( 0,0,0,0.2 ) )}:host(:not( [ placement ] ) ),:host( [ placement='top-end' ] ){inset-block-start:0;inset-inline-end:0}:host(:not( [ placement ] ) ) .banner,:host( [ placement='top-end' ] ) .banner{inset-block-start:var( --os-ui-ribbon-banner-offset,20px );inset-inline-end:var( --os-ui-ribbon-banner-pull,-36px );transform:rotate( 45deg )}:host( [ placement='top-start' ] ){inset-block-start:0;inset-inline-start:0}:host( [ placement='top-start' ] ) .banner{inset-block-start:var( --os-ui-ribbon-banner-offset,20px );inset-inline-start:var( --os-ui-ribbon-banner-pull,-36px );transform:rotate( -45deg )}:host( [ placement='bottom-end' ] ){inset-block-end:0;inset-inline-end:0}:host( [ placement='bottom-end' ] ) .banner{inset-block-end:var( --os-ui-ribbon-banner-offset,20px );inset-inline-end:var( --os-ui-ribbon-banner-pull,-36px );transform:rotate( -45deg )}:host( [ placement='bottom-start' ] ){inset-block-end:0;inset-inline-start:0}:host( [ placement='bottom-start' ] ) .banner{inset-block-end:var( --os-ui-ribbon-banner-offset,20px );inset-inline-start:var( --os-ui-ribbon-banner-pull,-36px );transform:rotate( 45deg )}:host-context( [ dir='rtl' ] ):host(:not( [ placement ] ) ) .banner,:host-context( [ dir='rtl' ] ):host( [ placement='top-end' ] ) .banner{transform:rotate( -45deg )}:host-context( [ dir='rtl' ] ):host( [ placement='top-start' ] ) .banner{transform:rotate( 45deg )}:host-context( [ dir='rtl' ] ):host( [ placement='bottom-end' ] ) .banner{transform:rotate( 45deg )}:host-context( [ dir='rtl' ] ):host( [ placement='bottom-start' ] ) .banner{transform:rotate( -45deg )}:host( [ tone='success' ] ) .banner{background:var( --os-ui-ribbon-success,var( --os-ui-success-fg,#1a7f37 ) )}:host( [ tone='warning' ] ) .banner{background:var( --os-ui-ribbon-warning,var( --os-ui-warning-bg,#9a6700 ) )}:host( [ tone='danger' ] ) .banner{background:var( --os-ui-ribbon-danger,var( --os-ui-danger,#cf222e ) )}:host( [ tone='info' ] ) .banner{background:var( --os-ui-ribbon-info,var( --os-ui-info-bg,#0969da ) )}:host( [ tone='neutral' ] ) .banner{background:var( --os-ui-ribbon-neutral,var( --os-ui-surface,#57606a ) )}`,kt=class kt extends _{render(){return l`<span class="banner" part="banner"><slot></slot></span>`}};kt.props=["placement","tone"],kt.styles=[jd],kt.help=void 0;let Uo=kt;y("os-ribbon",Uo);const cr="data:image/svg+xml;base64,",ls=new Map;function Bd(o){const e=ls.get(o);if(e!==void 0)return e;let t=!1;try{t=atob(o.slice(cr.length)).includes("currentColor")}catch{}return ls.size>=256&&ls.clear(),ls.set(o,t),t}function dr(o,e){const t=e.className??"",s=e.title??"";let i=null;if(e.slot){const c=kl(e.slot);c!==null&&(o=c),i=$l(e.slot)}if(typeof o=="string"&&o.startsWith("dashicons-")){const c=document.createElement("span");return c.className=`dashicons ${o} ${t}`.trim(),c.setAttribute("aria-hidden","true"),i!==null&&(c.style.color=i),c}if(i!==null&&typeof o=="string"){const c=document.createElement("span");if(c.className=t,c.setAttribute("aria-hidden","true"),c.style.display="inline-block",xn(c,o,i))return c}if(typeof o=="string"&&o.startsWith("data:image/svg+xml;base64,")){const c=o.slice(cr.length);if(/^[A-Za-z0-9+/=]+$/.test(c)){const u=document.createElement("span");return u.className=t,u.setAttribute("aria-hidden","true"),u.style.display="inline-block",Bd(o)&&xn(u,o,"currentColor")||(u.style.backgroundImage=`url("${o}")`,u.style.backgroundRepeat="no-repeat",u.style.backgroundPosition="center",u.style.backgroundSize="contain"),u}}if(typeof o=="string"&&/^data:image\/(png|jpeg|jpg|gif|webp|x-icon|vnd\.microsoft\.icon);base64,/i.test(o)){const c=o.indexOf(","),u=c>=0?o.slice(c+1):"";if(/^[A-Za-z0-9+/=]+$/.test(u))return ur(o,t)}if(typeof o=="string"&&(o.startsWith("http://")||o.startsWith("https://")))return ur(o,t);const n=document.createElement("span");n.className=`${t} os-icon-letter`.trim(),n.setAttribute("aria-hidden","true");const r=Gd(s);n.textContent=r;const a=Ui(s);return n.style.backgroundColor=`hsl( ${a}, 60%, 45% )`,n.style.color="#fff",n.style.display="inline-flex",n.style.alignItems="center",n.style.justifyContent="center",n.style.fontWeight="600",n.style.borderRadius="4px",n}function ur(o,e){const t=document.createElement("img");return t.className=e,t.src=o,t.alt="",t.setAttribute("aria-hidden","true"),t.draggable=!1,t}function Gd(o){const e=(o??"").trim();if(e==="")return"?";const t=e.split(/\s+/);if(t.length>=2)return(t[0][0]+t[1][0]).toUpperCase();const s=t[0];return s.length>=2?s.slice(0,2).toUpperCase():s.toUpperCase()}const Xd=v`:host{display:inline-block}`,D="os-file-tile",hr={draft:"Draft",pending:"Pending",private:"Private",future:"Scheduled"};function Zd(){const o=window.wp?.os?.getOsSettings;if(typeof o!="function")return!0;try{return o()?.showPostStatusRibbons!==!1}catch{return!0}}function Yd(){return window.wp?.os?.dragManager??null}const Qd=["type","ref","label","icon","thumbnail","kind","status","selected","selectable","missing","access-gated","drag-kind","drag-title","drag-icon"],ke=class ke extends _{constructor(){super(...arguments),this._pointerdownHandler=null,this._keydownHandler=null,this._onSettingsSave=e=>{e.detail?.phase==="saved"&&this._paint()}}connectedCallback(){super.connectedCallback(),this._keydownHandler||(this._keydownHandler=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.click())},this.addEventListener("keydown",this._keydownHandler)),document.addEventListener("os-settings-save-lifecycle",this._onSettingsSave),this._paint()}disconnectedCallback(){this._pointerdownHandler&&(this.removeEventListener("pointerdown",this._pointerdownHandler),this._pointerdownHandler=null),this._keydownHandler&&(this.removeEventListener("keydown",this._keydownHandler),this._keydownHandler=null),document.removeEventListener("os-settings-save-lifecycle",this._onSettingsSave)}requestUpdate(){this.isConnected&&this._paint()}attributeChangedCallback(e,t,s){if(t!==s){if(e==="selected"||e==="selectable"||e==="aria-selected"){this._paintSelection();return}super.attributeChangedCallback(e,t,s)}}_paintSelection(){const e=this.hasAttribute("selected"),t=this.hasAttribute("selectable");if(this.classList.toggle(`${D}--selected`,e),this.setAttribute("role",t?"option":"listitem"),t){const s=e?"true":"false";this.getAttribute("aria-selected")!==s&&this.setAttribute("aria-selected",s)}else this.removeAttribute("aria-selected")}render(){return l``}_paint(){const e=this.getAttribute("type")??"",t=this.getAttribute("ref")??"",s=this.getAttribute("label")??"",i=this.getAttribute("icon")??"",n=this.getAttribute("thumbnail")??"",r=this.getAttribute("kind")??"entry",a=this.getAttribute("status")??"",c=this.hasAttribute("selected"),u=this.hasAttribute("selectable"),h=this.hasAttribute("missing"),p=this.hasAttribute("access-gated"),g=[D,`${D}--folder`,`${D}--missing`,`${D}--access-gated`,`${D}--selected`];for(const $ of g)this.classList.remove($);this.classList.add(D),r==="folder"&&this.classList.add(`${D}--folder`),h&&this.classList.add(`${D}--missing`),p&&this.classList.add(`${D}--access-gated`),c&&this.classList.add(`${D}--selected`),this.dataset.fileType=e,this.dataset.fileRef=t,r&&(this.dataset.role=r),this.setAttribute("role",u?"option":"listitem"),u?this.setAttribute("aria-selected",c?"true":"false"):this.removeAttribute("aria-selected"),this.setAttribute("aria-label",s),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0");const m="You don’t have permission to open this — ask the folder owner for access.";p?(this.title=m,this.setAttribute("aria-disabled","true")):(this.removeAttribute("aria-disabled"),this.title===m&&this.removeAttribute("title"));const b=[`${D}__visual`,`${D}__label`,`${D}__lock`];for(const $ of b)this.querySelectorAll(`:scope > .${$}`).forEach(f=>f.remove());this.querySelectorAll(":scope > os-ribbon").forEach($=>$.remove());const x=document.createElement("span");if(x.className=`${D}__visual`,n){const $=document.createElement("img");$.src=n,$.alt="",$.loading="lazy",$.decoding="async",$.className=`${D}__preview`,$.draggable=!1,x.appendChild($)}else if(i){const $=dr(i,{title:s,className:`${D}__icon`});x.appendChild($)}this.appendChild(x);const w=document.createElement("span");if(w.className=`${D}__label`,w.textContent=s,this.appendChild(w),p){const $=document.createElement("span");$.className=`${D}__lock dashicons dashicons-lock`,$.setAttribute("aria-hidden","true"),this.appendChild($)}if(a&&a!=="publish"&&hr[a]&&Zd()){const $=document.createElement("os-ribbon");$.setAttribute("placement","top-end"),$.setAttribute("tone",Jd(a)),$.textContent=hr[a],this.appendChild($)}Ra(this),de("os.tile.rendered",{tile:this}),this._wireDragOut()}_wireDragOut(){this._pointerdownHandler&&(this.removeEventListener("pointerdown",this._pointerdownHandler),this._pointerdownHandler=null);const e=this.getAttribute("drag-kind");if(!e)return;const t=s=>{if(s.button!==0)return;const i=Yd();if(!i)return;const n=this.getAttribute("ref")??"",r=this.getAttribute("drag-title")??this.getAttribute("label")??void 0,a=this.getAttribute("drag-icon")??this.getAttribute("icon")??void 0,c=this.getBoundingClientRect();i.start({payload:{type:"shortcut",source:this,data:{kind:e,ref:n,title:r,icon:a},ghost:{offsetX:s.clientX-c.left,offsetY:s.clientY-c.top}},origin:s})};this._pointerdownHandler=t,this.addEventListener("pointerdown",t)}};ke.shadow=!1,ke.props=Qd,ke.styles=[Xd],ke.help=void 0;let qo=ke;function Jd(o){switch(o){case"draft":return"warning";case"pending":return"info";case"private":return"danger";case"future":return"primary";default:return"primary"}}y("os-tile",qo);const eu=v`:host{display:block;position:relative;overflow-y:auto;overflow-x:hidden;font:var( --os-ui-log-font,12px/1.4 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace );color:var( --os-ui-log-fg,var( --os-ui-fg,#1d2327 ) );background:var( --os-ui-log-bg,transparent );border:var( --os-ui-log-border,1px solid rgba( 0,0,0,0.06 ) );border-radius:var( --os-ui-log-border-radius,4px );min-height:var( --os-ui-log-min-height,120px );contain:strict}:host( [ hidden ] ){display:none}.spacer{position:relative;width:100%}.window{position:absolute;left:0;right:0;top:0}.row{box-sizing:border-box;display:block;padding:var( --os-ui-log-row-padding,2px 8px );min-height:var( --os-ui-log-row-height,22px );border-bottom:var( --os-ui-log-row-border,1px solid rgba( 0,0,0,0.04 ) );white-space:var( --os-ui-log-row-white-space,pre );overflow:hidden;text-overflow:ellipsis}:host( [ auto-row-height ] ) .row{min-height:0;overflow:visible;text-overflow:clip;white-space:var( --os-ui-log-row-white-space,normal )}.empty{display:flex;align-items:center;justify-content:center;padding:16px;color:var( --os-ui-fg-muted,#57606a );font-style:italic}`;function pr(o){const e=document.createElement("span");let t;if(typeof o=="string")t=o;else try{t=JSON.stringify(o)}catch{t=String(o)}return e.textContent=t,e}const $t=class $t extends _{constructor(){super(...arguments),this._entries=[],this._renderRow=pr,this._stickToBottom=!0,this._heights=[],this._offsets=[],this._offsetsValid=!1,this._onScroll=()=>{const e=this.scrollHeight-this.clientHeight-this.scrollTop;this._stickToBottom=e<=4,this._paintWindow()},this._resizeObserver=null}connectedCallback(){super.connectedCallback(),this.addEventListener("scroll",this._onScroll,{passive:!0}),typeof ResizeObserver<"u"&&(this._resizeObserver=new ResizeObserver(()=>this._paintWindow()),this._resizeObserver.observe(this)),queueMicrotask(()=>{this._paintSpacer(),this._stickToBottom&&(this.scrollTop=this.scrollHeight),this._paintWindow()})}disconnectedCallback(){this.removeEventListener("scroll",this._onScroll),this._resizeObserver?.disconnect(),this._resizeObserver=null}get renderRow(){return this._renderRow}set renderRow(e){this._renderRow=typeof e=="function"?e:pr,this._heights=[],this._invalidateOffsets(),this._paintSpacer(),this._paintWindow()}get entries(){return this._entries}set entries(e){this._entries=Array.isArray(e)?e.slice():[],this._heights=[],this._invalidateOffsets(),this._enforceMaxRows(),this._afterEntriesMutation()}push(e){this._entries.push(e),this._enforceMaxRows(),this._afterEntriesMutation(),this.emit("os-log-append",{entry:e,length:this._entries.length})}pushMany(e){if(!(!Array.isArray(e)||e.length===0)){for(const t of e)this._entries.push(t);this._enforceMaxRows(),this._afterEntriesMutation()}}clear(){this._entries=[],this._heights=[],this._invalidateOffsets(),this._afterEntriesMutation()}scrollToBottom(){this._stickToBottom=!0,this.scrollTop=this.scrollHeight}_enforceMaxRows(){const e=this._readMaxRows();if(e>0&&this._entries.length>e){const t=this._entries.length-e;this._entries.splice(0,t),this._heights.length>0&&this._heights.splice(0,Math.min(t,this._heights.length)),this._invalidateOffsets()}}_afterEntriesMutation(){this._paintSpacer(),this._stickToBottom&&(this.scrollTop=this.scrollHeight),this._paintWindow()}_readRowHeight(){const e=parseFloat(this.getAttribute("row-height")||"22");return Number.isFinite(e)&&e>0?e:22}_readMaxRows(){const e=parseFloat(this.getAttribute("max-rows")||"0");return Number.isFinite(e)&&e>0?Math.floor(e):0}_readOverscan(){const e=parseFloat(this.getAttribute("overscan")||"6");return Number.isFinite(e)&&e>=0?Math.floor(e):6}_isAutoHeight(){return this.getAttribute("auto-row-height")!==null}_invalidateOffsets(){this._offsetsValid=!1,this._offsets=[]}_ensureOffsets(){if(this._offsetsValid)return;const e=this._readRowHeight(),t=new Array(this._entries.length);let s=0;for(let i=0;i<this._entries.length;i++){t[i]=s;const n=this._heights[i];s+=Number.isFinite(n)&&n>0?n:e}this._offsets=t,this._totalHeight=s,this._offsetsValid=!0}_totalContentHeight(){return this._isAutoHeight()?(this._ensureOffsets(),this._totalHeight??0):this._entries.length*this._readRowHeight()}_findIndexAtOffset(e){const t=this._offsets;if(t.length===0)return 0;let s=0,i=t.length-1;for(;s<i;){const n=Math.floor((s+i+1)/2);t[n]<=e?s=n:i=n-1}return s}_paintSpacer(){const e=this.shadowRoot?.querySelector(".spacer");e&&(e.style.height=`${this._totalContentHeight()}px`)}_paintWindow(){const e=this.shadowRoot?.querySelector(".window"),t=this.shadowRoot?.querySelector(".empty");if(!e)return;if(this._entries.length===0){e.replaceChildren(),t&&(t.style.display="");return}t&&(t.style.display="none");const s=this._isAutoHeight(),i=this._readRowHeight(),n=this._readOverscan(),r=this.clientHeight,a=this.scrollTop;let c,u;if(s){this._ensureOffsets();const b=this._findIndexAtOffset(a),x=this._findIndexAtOffset(a+r);c=Math.max(0,b-n),u=Math.min(this._entries.length,x+1+n)}else c=Math.max(0,Math.floor(a/i)-n),u=Math.min(this._entries.length,Math.ceil((a+r)/i)+n);const h=document.createDocumentFragment(),p=[];for(let b=c;b<u;b++){const x=this._renderRow(this._entries[b],b);let w;x instanceof HTMLElement?w=x:(w=document.createElement("span"),w.textContent=String(x)),w.classList.add("row"),w.style.position="absolute",w.style.left="0",w.style.right="0",s?(w.style.top=`${this._offsets[b]}px`,w.style.height="auto"):(w.style.top=`${b*i}px`,w.style.height=`${i}px`),h.appendChild(w),p.push({idx:b,el:w})}if(e.replaceChildren(h),!s)return;let g=!1;const m=this._readRowHeight();for(const{idx:b,el:x}of p){const w=x.offsetHeight||m,$=this._heights[b];(!Number.isFinite($)||Math.abs($-w)>.5)&&(this._heights[b]=w,g=!0)}if(g){this._invalidateOffsets(),this._ensureOffsets();for(const{idx:b,el:x}of p)x.style.top=`${this._offsets[b]}px`;this._paintSpacer(),this._stickToBottom&&(this.scrollTop=this.scrollHeight)}}render(){const e=this.getAttribute("empty")||"No entries";return l`
1054 <div class="spacer">
1055 <div class="window" part="window"></div>
1056 </div>
1057 <div class="empty" part="empty">${e}</div>
1058 `}};$t.props=["rowHeight","maxRows","overscan","empty","autoRowHeight"],$t.styles=[eu],$t.help=void 0;let Fo=$t;y("os-log",Fo);const tu=v`:host{display:block;counter-reset:os-step}:host( [ hidden ] ){display:none}.os-steps__list{display:flex;flex-direction:column;gap:var( --os-ui-steps-gap,16px );margin:0;padding:0;list-style:none}:host( [ horizontal ] ){--os-ui-step-connector-width:20px;--os-ui-step-title-color:var( --os-ui-fg-muted,#646970 );--os-ui-step-title-weight:400}:host( [ horizontal ] ) .os-steps__list{flex-direction:row;align-items:center;flex-wrap:wrap;gap:var( --os-ui-steps-gap,10px )}`,su=v`:host{display:grid;grid-template-columns:var( --os-ui-step-chip-size,28px ) 1fr var( --os-ui-step-connector-width,0 );column-gap:var( --os-ui-step-gap,12px );align-items:start;counter-increment:os-step}:host( [ hidden ] ){display:none}:host::before{content:counter( os-step );display:inline-flex;align-items:center;justify-content:center;width:var( --os-ui-step-chip-size,28px );height:var( --os-ui-step-chip-size,28px );box-sizing:border-box;border-radius:50%;background:var( --os-ui-step-chip-bg,var( --wp-admin-theme-color,#2271b1 ) );background-size:200% 200%;background-position:30% 40%;color:var( --os-ui-step-chip-fg,var( --os-ui-fg-on-accent,#fff ) );border:var( --os-ui-step-chip-border,0 );font-family:var( --os-ui-step-chip-family,inherit );font-size:var( --os-ui-step-chip-font-size,13px );font-weight:600;line-height:1;flex-shrink:0}:host( [ done ] )::before{content:'✓';background:var( --os-ui-step-chip-done-bg,var( --os-ui-fg-muted,#646970 ) )}:host( [ current ] ) .os-step__title{color:var( --os-ui-fg,#1d2327 );font-weight:600}:host( [ interactive ] ){cursor:pointer}:host( [ interactive ]:focus-visible ){outline:var( --os-ui-focus-ring,2px solid #2271b1 );outline-offset:2px;border-radius:var( --os-ui-radius,4px )}:host::after{content:'';inline-size:var( --os-ui-step-connector-width,0 );block-size:1px;background:var( --os-ui-border,rgba( 0,0,0,0.08 ) );align-self:center}:host(:last-of-type )::after{content:none}.os-step__body{min-width:0}:host( [ trail ] ){align-items:center}:host( [ trail ] ) .os-step__title{margin:0}.os-step__title{margin:0 0 4px;font-family:var( --os-ui-step-title-family,inherit );font-size:var( --os-ui-step-title-size,14px );font-weight:var( --os-ui-step-title-weight,600 );color:var( --os-ui-step-title-color,var( --os-ui-fg,#1d2327 ) );text-transform:var( --os-ui-step-title-transform,none );letter-spacing:var( --os-ui-step-title-spacing,normal );line-height:1.3}.os-step__title:empty{display:none}.os-step__body::slotted( * ){margin-block:0}`,Et=class Et extends _{constructor(){super(...arguments),this.syncTrail=()=>{const e=this.hasAttribute("horizontal");for(const t of Array.from(this.children))t.tagName==="OS-STEP"&&t.toggleAttribute("trail",e)}}connectedCallback(){super.connectedCallback(),this.syncTrail()}render(){return this.syncTrail(),l`<ol class="os-steps__list"><slot @slotchange=${this.syncTrail}></slot></ol>`}};Et.props=["horizontal"],Et.styles=[tu],Et.help=void 0;let Vo=Et;y("os-steps",Vo);const At=class At extends _{constructor(){super(...arguments),this.onClick=e=>{if(!this.isInteractive())return;const t=e.composedPath();for(const s of t){if(s===this)break;if(s instanceof HTMLElement&&s.hasAttribute("data-noclick"))return}this.dispatchEvent(new CustomEvent("os-step-click",{bubbles:!0,composed:!0}))},this.onKeyDown=e=>{if(!this.isInteractive()||e.key!=="Enter"&&e.key!==" ")return;const t=e.target;t instanceof HTMLElement&&t!==this&&t.closest("button, a, input, select, textarea")||(e.preventDefault(),this.onClick(e))}}isInteractive(){return this.hasAttribute("interactive")}syncRoles(){this.hasAttribute("current")?this.setAttribute("aria-current","step"):this.removeAttribute("aria-current"),this.isInteractive()?(this.setAttribute("role","button"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0")):(this.removeAttribute("role"),this.removeAttribute("tabindex"))}connectedCallback(){super.connectedCallback(),this.syncRoles(),this.addEventListener("click",this.onClick),this.addEventListener("keydown",this.onKeyDown)}disconnectedCallback(){this.removeEventListener("click",this.onClick),this.removeEventListener("keydown",this.onKeyDown)}render(){const e=this.title||"";return this.syncRoles(),l`
1059 <div class="os-step__body">
1060 <div class="os-step__title">${e}</div>
1061 <slot></slot>
1062 </div>
1063 `}};At.props=["title","done","current","interactive"],At.styles=[su],At.help={title:"Step",summary:"A single numbered step inside <os-steps>. Renders an auto-numbered chip and an optional bold title above the slotted body.",status:"stable",props:[{name:"title",type:"string",description:"Optional bold title rendered above the body."},{name:"done",type:"boolean",description:"When present, the chip shows a ✓ in a muted colour instead of the number."},{name:"current",type:"boolean",description:'Marks the step the reader is on. Mirrors aria-current="step" onto the host.'},{name:"interactive",type:"boolean",description:"Makes the step a way back: focusable, activated by click or Enter/Space, and emits os-step-click."}],events:[{name:"os-step-click",detail:"none",description:"Fired when an interactive step is activated by pointer or keyboard."}],slots:[{name:"(default)",description:"Step body content."}],cssProps:[{name:"--os-ui-step-gap",default:"12px"},{name:"--os-ui-step-chip-size",default:"28px"},{name:"--os-ui-step-chip-bg",default:"var(--wp-admin-theme-color)"},{name:"--os-ui-step-chip-fg",default:"#fff"},{name:"--os-ui-step-chip-done-bg",default:"var(--os-ui-fg-muted)"},{name:"--os-ui-step-chip-font-size",default:"13px"}],example:l`
1064 <os-steps>
1065 <os-step title="Configure">Open OpenStation Preferences → AI.</os-step>
1066 <os-step title="Connect" done>Key confirmed.</os-step>
1067 </os-steps>
1068 `};let Ko=At;y("os-step",Ko);const ou=v` ${S} ${ns}:host{display:block;--_bg:var( --os-ui-table-bg,var( --os-ui-surface,#fff ) );--_border:var( --os-ui-table-border,var( --os-ui-border,rgba( 0,0,0,0.08 ) ) );--_column-border:var( --os-ui-table-column-border,var( --os-ui-border-strong,rgba( 0,0,0,0.14 ) ) );--_header-bg:var( --os-ui-table-header-bg,var( --os-ui-surface-elevated,#f6f7f7 ) );--_row-hover:var( --os-ui-table-row-hover,var( --os-ui-hover,rgba( 0,0,0,0.04 ) ) );--_stripe:var( --os-ui-table-stripe,var( --os-ui-surface-subtle,rgba( 0,0,0,0.03 ) ) );--_cell-padding:var( --os-ui-table-cell-padding,8px 12px );--_font-size:var( --os-ui-table-font-size,13px );--_max-height:var( --os-ui-table-max-height,none );font-size:var( --_font-size );color:inherit}:host( [ hidden ] ){display:none}.scroll{position:relative;overflow:auto;max-height:var( --_max-height );border:1px solid var( --_border );border-radius:4px;background:var( --_bg )}table{width:100%;border-collapse:separate;border-spacing:0;background:var( --_bg )}thead th{text-align:start;font-weight:600;background-color:var( --_header-bg );background-image:var( --os-ui-table-header-bg-image,none );background-repeat:var( --os-ui-table-header-bg-image-repeat,repeat );background-size:var( --os-ui-table-header-bg-image-size,auto );background-position:var( --os-ui-table-header-bg-image-position,center );padding:var( --_cell-padding );border-bottom:1px solid var( --_border );white-space:nowrap}tbody td{padding:var( --_cell-padding );border-bottom:1px solid var( --_border );background-color:var( --_bg );vertical-align:middle}tbody tr:last-child td{border-bottom:0}:host( [ striped ] ) tbody tr:nth-child( odd ) td{background-image:linear-gradient( var( --_stripe ),var( --_stripe ) )}:host( [ hover ] ) tbody tr:hover td{background-image:linear-gradient( var( --_row-hover ),var( --_row-hover ) )}:host( [ hover ][ striped ] ) tbody tr:nth-child( odd ):hover td{background-image:linear-gradient( var( --_row-hover ),var( --_row-hover ) ),linear-gradient( var( --_stripe ),var( --_stripe ) )}:host( [ compact ] ){--os-ui-table-cell-padding:4px 8px;--os-ui-table-font-size:12px}:host( [ bordered ] ) thead th,:host( [ bordered ] ) tbody td{border-inline-end:1px solid var( --_column-border )}:host( [ bordered ] ) thead th:last-child,:host( [ bordered ] ) tbody td:last-child{border-inline-end:0}th.is-sticky,td.is-sticky{position:sticky;z-index:10}tbody td.is-sticky{background-color:var( --_bg )}thead th.is-sticky{background-color:var( --_header-bg );background-image:var( --os-ui-table-header-bg-image,none );background-repeat:var( --os-ui-table-header-bg-image-repeat,repeat );background-size:var( --os-ui-table-header-bg-image-size,auto );background-position:var( --os-ui-table-header-bg-image-position,center );z-index:30}:host( [ sticky-header ] ) thead th{position:sticky;top:0;z-index:20}:host( [ sticky-header ] ) thead tr.filter-row th{top:var( --os-ui-table-header-height,33px );z-index:20}:host( [ sticky-header ] ) thead th.is-sticky{z-index:40}:host( [ sticky-header ] ) thead tr.filter-row th.is-sticky{z-index:40}th.is-sticky-edge,td.is-sticky-edge{border-inline-end:var( --os-ui-table-sticky-edge,2px solid var( --_border ) )}.align-center{text-align:center}.align-end{text-align:end}.filter-row th{padding:4px 8px;background-color:var( --_header-bg );background-image:var( --os-ui-table-header-bg-image,none );background-repeat:var( --os-ui-table-header-bg-image-repeat,repeat );background-size:var( --os-ui-table-header-bg-image-size,auto );background-position:var( --os-ui-table-header-bg-image-position,center );border-bottom:1px solid var( --_border );font-weight:400}.filter-input,.filter-select{width:100%;min-width:60px;box-sizing:border-box;padding:4px 6px;font:inherit;color:inherit;background-color:var( --_bg );border:1px solid var( --_border );border-radius:3px}.filter-input:focus,.filter-select:focus{outline:none;border-color:var( --os-ui-accent,#2271b1 );box-shadow:var( --_holo-focus-field )}.expander{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;padding:0;border:0;background:transparent;color:inherit;cursor:pointer;border-radius:3px;font-size:11px;line-height:1}.expander:hover{background:var( --os-ui-hover,rgba( 0,0,0,0.06 ) )}td.col-expander,th.col-expander{width:36px;min-width:36px;padding-left:0;padding-right:0;text-align:center}tr.subtable td{padding:0;background-color:var( --_bg );background-image:linear-gradient( var( --_stripe ),var( --_stripe ) );border-bottom:1px solid var( --_border )}tr.subtable .subtable-inner{padding:8px 12px 8px 32px}tr.empty td{padding:24px;text-align:center;color:var( --os-ui-text-muted,var( --os-ui-fg-muted,rgba( 0,0,0,0.55 ) ) );font-style:italic}thead th.is-sortable{cursor:pointer;user-select:none}thead th.is-sortable:hover{background-image:linear-gradient( var( --_row-hover ),var( --_row-hover ) )}thead th.is-sortable:focus-visible{outline:none;box-shadow:inset 0 0 0 2px var( --os-ui-accent,#2271b1 )}.sort-indicator{font-size:10px;color:var( --os-ui-text-muted,var( --os-ui-fg-muted,rgba( 0,0,0,0.55 ) ) );margin-inline-start:2px}thead th.sort-asc .sort-indicator,thead th.sort-desc .sort-indicator{color:var( --wp-admin-theme-color,#2271b1 )}td.col-select,th.col-select{width:40px;min-width:40px;padding-left:0;padding-right:0;text-align:center}.select-all-checkbox,.select-row-checkbox{cursor:pointer;margin:0}tbody tr.is-selected td{background-color:color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 10%,var( --_bg ) );background-image:none}tbody tr.is-selected:hover td{background-color:color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 16%,var( --_bg ) )}tbody tr.is-selected td:first-child{box-shadow:inset 3px 0 0 0 var( --os-ui-accent,#2271b1 )}tbody:dir( rtl ) tr.is-selected td:first-child{box-shadow:inset -3px 0 0 0 var( --os-ui-accent,#2271b1 )}:host( [ stacked ] ) .scroll{border:0;border-radius:0}:host( [ stacked ] ) table,:host( [ stacked ] ) tbody{display:block;width:100%}:host( [ stacked ] ) colgroup,:host( [ stacked ] ) thead{display:none}:host( [ stacked ] ) tbody tr{display:flex;align-items:flex-start;gap:12px;padding:12px 14px;border-bottom:1px solid var( --_border );background-color:var( --_bg )}:host( [ stacked ] ) tbody tr:last-child{border-bottom:0}:host( [ stacked ] ) tbody td{display:block;padding:0;border:0;background-color:transparent;background-image:none;box-shadow:none;min-width:0;width:auto;vertical-align:baseline}:host( [ stacked ] ) tbody tr.is-selected td,:host( [ stacked ] ) tbody tr.is-selected:hover td,:host( [ stacked ][ striped ] ) tbody tr:nth-child( odd ) td,:host( [ stacked ][ hover ] ) tbody tr:hover td,:host( [ stacked ][ hover ][ striped ] ) tbody tr:nth-child( odd ):hover td,:host( [ stacked ][ bordered ] ) tbody td{padding:0;border:0;background-color:transparent;background-image:none;box-shadow:none}:host( [ stacked ][ hover ] ) tbody tr:hover{background-image:linear-gradient( var( --_row-hover ),var( --_row-hover ) )}:host( [ stacked ] ) tbody tr.is-selected,:host( [ stacked ] ) tbody tr.is-selected:hover{background-color:color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 10%,var( --_bg ) );background-image:none;box-shadow:inset 3px 0 0 0 var( --os-ui-accent,#2271b1 )}:host( [ stacked ] ) tbody:dir( rtl ) tr.is-selected{box-shadow:inset -3px 0 0 0 var( --os-ui-accent,#2271b1 )}:host( [ stacked ] ) tbody td.col-select,:host( [ stacked ] ) tbody td.col-expander{flex:0 0 auto;display:flex;align-items:center;justify-content:center;min-width:0}:host( [ stacked ] ) tbody td.col-select{width:44px;height:44px;margin:-11px 0 -11px -11px;cursor:pointer}:host( [ stacked ] ) .select-row-checkbox{width:22px;height:22px}:host( [ stacked ] ) tbody td.col-expander{width:28px;height:22px;margin-inline-start:-4px}:host( [ stacked ] ) tbody td.stack-body{flex:1 1 auto;display:flex;flex-direction:column;gap:4px;min-width:0}.stack-cell{display:flex;align-items:baseline;gap:6px;min-width:0;line-height:1.4}.stack-title{font-size:15px;font-weight:600;line-height:1.35}.stack-meta{font-size:13px}.stack-label{flex:0 0 auto;font-size:12px;color:var( --os-ui-text-muted,var( --os-ui-fg-muted,rgba( 0,0,0,0.55 ) ) )}.stack-label::after{content:'·';margin-inline-start:6px}.stack-value{flex:1 1 auto;min-width:0;display:flex;align-items:center;flex-wrap:wrap;gap:6px}.stack-actions{margin-block-start:6px}.stack-actions .stack-value{gap:8px}.stack-actions .stack-value>*{justify-content:flex-start;max-width:100%}:host( [ stacked ] ) tr.subtable,:host( [ stacked ] ) tr.empty{display:block;padding:0}:host( [ stacked ] ) tr.subtable td{background-image:linear-gradient( var( --_stripe ),var( --_stripe ) )}:host( [ stacked ] ) tr.subtable .subtable-inner{padding:8px 14px 12px}:host( [ stacked ] ) tr.empty td{padding:24px}:host( [ stacked ] ) tr.skeleton{display:block;padding:14px;border-bottom:1px solid var( --_border )}:host( [ stacked ] ) tr.skeleton td.stack-body{gap:8px}:host( [ stacked ] ) tr.skeleton .skeleton-bar:first-child{height:15px}tbody tr.skeleton td{padding:var( --_cell-padding )}.skeleton-bar{display:block;height:12px;border-radius:3px;background:linear-gradient( 90deg,var( --os-ui-table-skeleton-color,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) ) 0%,var( --os-ui-table-skeleton-highlight,var( --os-ui-hover,rgba( 0,0,0,0.14 ) ) ) 50%,var( --os-ui-table-skeleton-color,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) ) 100% );background-size:200% 100%;animation:os-table-skeleton-pulse 1.4s ease-in-out infinite}@keyframes os-table-skeleton-pulse{0%{background-position:200% 50%}100%{background-position:-200% 50%}}@media ( prefers-reduced-motion:reduce ){.skeleton-bar{animation:none}}`,_e="__wpd_expander__",ye="__wpd_select__",Ct=class Ct extends _{constructor(){super(...arguments),this._data=[],this._columns=[],this._filters={},this._expanded=new Set,this._subTable=null,this._sort=null,this._selection=new Set,this._getRowId=(e,t)=>t,this._filterCache=new Map,this._paintScheduled=!1,this._stacked=!1,this._stickyHeaderWarned=!1,this._stickyRaceWarned=!1,this._resizeObserver=null,this._stickyMicroScheduled=!1,this._stickyRafHandle=null,this._loadingDesyncWarned=!1,this._lastStickyIndex=-1}get data(){return this._data}set data(e){this._data=Array.isArray(e)?e.slice():[],this._expanded.clear(),this._schedulePaint()}get columns(){return this._columns}set columns(e){this._columns=Array.isArray(e)?e.slice():[];const t=new Set(this._columns.map(s=>s.key));for(const s of Object.keys(this._filters))t.has(s)||delete this._filters[s];for(const s of Array.from(this._filterCache.keys()))t.has(s)||this._filterCache.delete(s);this._sort&&!t.has(this._sort.key)&&(this._sort=null),this._schedulePaint()}get filters(){return{...this._filters}}set filters(e){this._filters=e?{...e}:{},this._schedulePaint()}get sort(){return this._sort?{...this._sort}:null}set sort(e){this._sort=e?{...e}:null,this._schedulePaint()}get selection(){return new Set(this._selection)}set selection(e){this._selection=new Set(e??[]),this._schedulePaint()}get selectedRows(){const e=[];return this._data.forEach((t,s)=>{this._selection.has(this._getRowId(t,s))&&e.push(t)}),e}get visibleRows(){return this._filteredRows().map(e=>e.row)}get getRowId(){return this._getRowId}set getRowId(e){this._getRowId=typeof e=="function"?e:(t,s)=>s,this._schedulePaint()}get subTable(){return this._subTable}set subTable(e){this._subTable=typeof e=="function"?e:null,this._expanded.clear(),this._schedulePaint()}get expanded(){return new Set(this._expanded)}set expanded(e){this._expanded=new Set(e??[]),this._schedulePaint()}expand(e){e<0||e>=this._data.length||this._expanded.has(e)||(this._expanded.add(e),this.emit("os-table-expand-change",{row:this._data[e],index:e,expanded:!0}),this._schedulePaint())}collapse(e){this._expanded.has(e)&&(this._expanded.delete(e),this.emit("os-table-expand-change",{row:this._data[e],index:e,expanded:!1}),this._schedulePaint())}expandAll(){if(!this._subTable)return;let e=!1;for(let t=0;t<this._data.length;t++)this._subTable(this._data[t],t)&&(this._expanded.has(t)||(this._expanded.add(t),e=!0));e&&this._schedulePaint()}collapseAll(){this._expanded.size!==0&&(this._expanded.clear(),this._schedulePaint())}isExpanded(e){return this._expanded.has(e)}clearFilters(){Object.keys(this._filters).length!==0&&(this._filters={},this.emit("os-table-filter-change",{filters:{}}),this._schedulePaint())}clearSort(){this._sort!==null&&(this._sort=null,this.emit("os-table-sort-change",{sort:null}),this._schedulePaint())}select(e){if(this._selection.has(e))return;const t=this._readSelectable(),s=t==="single"?Array.from(this._selection):[];t==="single"&&this._selection.clear(),this._selection.add(e),this._emitSelectionChange(),this._syncSelectionDom([e,...s])}deselect(e){this._selection.delete(e)&&(this._emitSelectionChange(),this._syncSelectionDom([e]))}selectAll(){if(this._readSelectable()==="multi"){for(const{row:e,index:t}of this._filteredRows())this._selection.add(this._getRowId(e,t));this._emitSelectionChange(),this._syncSelectionDom("all")}}clearSelection(){this._selection.size!==0&&(this._selection.clear(),this._emitSelectionChange(),this._syncSelectionDom("all"))}_syncSelectionDom(e){const t=this.shadowRoot;if(!t)return;const s=t.querySelector("tbody");if(!s)return;let i=null;if(e!=="all"){i=new Set;for(const a of e)i.add(String(a))}const n=s.querySelectorAll("tr[data-row-id]");for(const a of n){const c=a.dataset.rowId;if(c===void 0||i&&!i.has(c))continue;const u=Number(a.dataset.rowIndex);if(!Number.isFinite(u))continue;const h=this._data[u];if(h===void 0)continue;const p=this._getRowId(h,u),g=this._selection.has(p);a.classList.toggle("is-selected",g);const m=a.querySelector("input.select-row-checkbox");m&&m.checked!==g&&(m.checked=g)}const r=t.querySelector("thead .select-all-checkbox");if(r){const{total:a,selected:c}=this._visibleSelectionStats();r.checked=a>0&&c===a,r.indeterminate=c>0&&c<a}}scrollToRow(e){const t=this.shadowRoot;if(!t)return;const i=t.querySelectorAll("tbody tr:not(.subtable):not(.empty):not(.skeleton)")[e];i&&i.scrollIntoView({block:"nearest",inline:"nearest"})}connectedCallback(){super.connectedCallback(),this._schedulePaint()}disconnectedCallback(){this._resizeObserver?.disconnect(),this._resizeObserver=null,this._stickyRafHandle!==null&&typeof cancelAnimationFrame<"u"&&(cancelAnimationFrame(this._stickyRafHandle),this._stickyRafHandle=null)}recomputeLayout(){this._applyStickyOffsets(),this._measureHeaderHeight()}render(){return l`
1069 <div class="scroll" part="scroll">
1070 <table part="table">
1071 <colgroup></colgroup>
1072 <thead></thead>
1073 <tbody></tbody>
1074 </table>
1075 </div>
1076 `}requestUpdate(){super.requestUpdate(),this._schedulePaint()}_schedulePaint(){this._paintScheduled||!this.isConnected||(this._paintScheduled=!0,queueMicrotask(()=>{this._paintScheduled=!1,this.isConnected&&this._paint()}))}_paint(){const e=this.shadowRoot;if(!e)return;e.querySelector("tbody")||ge(this.render(),e);const t=e.querySelector("colgroup"),s=e.querySelector("thead"),i=e.querySelector("tbody");if(!t||!s||!i)return;const n=this._effectiveColumns();this._stacked=this.hasAttribute("stacked");const r=this._readStickyColumns();this._lastStickyIndex=this._computeLastStickyIndex(n,r),this._paintColgroup(t,n),this._paintHead(s,n,r),this._paintBody(i,n,r),this._applyStickyOffsets(),this._measureHeaderHeight(),this._scheduleStickyOffsets(),this._maybeWarnStickyHeader(),this._maybeWarnLoadingDesync(i),this._ensureResizeObserver()}_maybeWarnLoadingDesync(e){this._loadingDesyncWarned||this.hasAttribute("loading")&&(e.querySelector("tr.skeleton")||(this._loadingDesyncWarned=!0,console.warn("[os-table] `loading` attribute is set but no skeleton rows rendered. Either attributeChangedCallback didn't route through requestUpdate (framework regression), or `loading` was set after the most recent paint and no follow-up trigger ran. Toggling `data` will force a paint as a workaround.")))}_scheduleStickyOffsets(){this._stickyMicroScheduled||(this._stickyMicroScheduled=!0,queueMicrotask(()=>{this._stickyMicroScheduled=!1,this.isConnected&&this._applyStickyOffsets()})),this._stickyRafHandle===null&&typeof requestAnimationFrame<"u"&&(this._stickyRafHandle=requestAnimationFrame(()=>{this._stickyRafHandle=null,this.isConnected&&(this._applyStickyOffsets(),this._measureHeaderHeight())}))}_ensureResizeObserver(){if(this._resizeObserver||typeof ResizeObserver>"u")return;const e=this.shadowRoot?.querySelector(".scroll");e&&(this._resizeObserver=new ResizeObserver(()=>{this.isConnected&&(this._applyStickyOffsets(),this._measureHeaderHeight(),this._stickyHeaderWarned=!1,this._maybeWarnStickyHeader())}),this._resizeObserver.observe(e),this._resizeObserver.observe(this))}_paintColgroup(e,t){const s=[];for(const i of t){const n=document.createElement("col");i.width&&(n.style.width=i.width),s.push(n)}e.replaceChildren(...s)}_paintHead(e,t,s){const i=document.createElement("tr");i.setAttribute("part","header-row");for(let c=0;c<t.length;c++)i.appendChild(this._buildHeaderCell(t[c],c,s));const n=e.querySelector(':scope > tr[part="header-row"]');n?e.replaceChild(i,n):e.insertBefore(i,e.firstChild);const r=t.some(c=>c.filter||Array.isArray(c.filterOptions)||typeof c.filterRender=="function");let a=e.querySelector(":scope > tr.filter-row");if(r){const c=[];for(let p=0;p<t.length;p++)c.push(this._buildFilterCell(t[p],p,s));a||(a=document.createElement("tr"),a.classList.add("filter-row"),a.setAttribute("part","filter-row"),e.appendChild(a));const u=Array.from(a.children);let h=u.length===c.length;if(h){for(let p=0;p<c.length;p++)if(u[p]!==c[p]){h=!1;break}}if(!h){const p=new Set(c);for(const g of c)a.appendChild(g);for(const g of Array.from(a.children))p.has(g)||a.removeChild(g)}}else a&&a.remove()}_buildHeaderCell(e,t,s){const i=document.createElement("th");if(i.setAttribute("scope","col"),i.dataset.key=e.key,this._applyCellClasses(i,e,t,s),e.minWidth&&(i.style.minWidth=e.minWidth),e.key===ye){if(this._readSelectable()==="multi"){const r=document.createElement("input");r.type="checkbox",r.className="select-all-checkbox",r.setAttribute("data-noclick",""),r.setAttribute("aria-label","Select all rows");const{total:a,selected:c}=this._visibleSelectionStats();r.checked=a>0&&c===a,r.indeterminate=c>0&&c<a,r.addEventListener("change",()=>{r.checked?this.selectAll():this.clearSelection()}),i.appendChild(r)}return i}if(i.textContent=e.label??(e.key===_e?"":e.key),e.sortable){i.classList.add("is-sortable");const n=this._sort?.key===e.key,r=document.createElement("span");r.className="sort-indicator";let a="";n&&(a=this._sort.direction==="asc"?" ▲":" ▼"),r.textContent=a,i.appendChild(r),n&&i.classList.add(this._sort.direction==="asc"?"sort-asc":"sort-desc"),i.addEventListener("click",()=>this._cycleSort(e.key))}return i}_buildFilterCell(e,t,s){const i=this._filterCache.get(e.key),n=Array.isArray(e.filterOptions),r=typeof e.filterRender=="function";let a;if(!e.filter&&!n&&!r||e.key===_e||e.key===ye?a="none":r?a="custom":e.filter==="select"||n?a="select":a="text",i&&i.kind===a){if(i.th.className="",this._applyCellClasses(i.th,e,t,s),a==="select"){const p=i.control,g=this._resolveFilterOptions(e),m=g.map(b=>b.value).join("|");m!==i.optionsKey?(this._populateSelect(p,g,this._filters[e.key]??""),i.optionsKey=m):p.value=this._filters[e.key]??""}else if(a==="text"){const p=i.control,g=this._filters[e.key]??"";p.value!==g&&p.ownerDocument.activeElement!==p&&(p.value=g)}else a==="custom"&&e.filterRender&&e.filterRender(i.th,{value:this._filters[e.key]??"",setValue:p=>this._onFilterChange(e.key,p),col:e});return i.th}const c=document.createElement("th");if(this._applyCellClasses(c,e,t,s),a==="none")return this._filterCache.set(e.key,{th:c,control:null,optionsKey:"",kind:"none"}),c;if(a==="custom"&&e.filterRender)return e.filterRender(c,{value:this._filters[e.key]??"",setValue:p=>this._onFilterChange(e.key,p),col:e}),this._filterCache.set(e.key,{th:c,control:null,optionsKey:"",kind:"custom"}),c;let u,h="";if(a==="select"){const p=document.createElement("select");p.classList.add("filter-select"),p.setAttribute("data-noclick",""),p.setAttribute("aria-label",`Filter ${e.label??e.key}`);const g=this._resolveFilterOptions(e);this._populateSelect(p,g,this._filters[e.key]??""),h=g.map(m=>m.value).join("|"),p.addEventListener("change",()=>{this._onFilterChange(e.key,p.value)}),u=p}else{const p=document.createElement("input");p.type="search",p.classList.add("filter-input"),p.setAttribute("data-noclick",""),p.setAttribute("placeholder","Filter…"),p.setAttribute("aria-label",`Filter ${e.label??e.key}`),p.value=this._filters[e.key]??"",p.addEventListener("input",()=>{this._onFilterChange(e.key,p.value)}),u=p}return c.appendChild(u),this._filterCache.set(e.key,{th:c,control:u,optionsKey:h,kind:a}),c}_populateSelect(e,t,s){e.replaceChildren();const i=document.createElement("option");i.value="",i.textContent="All",e.appendChild(i);for(const n of t){const r=document.createElement("option");r.value=n.value,r.textContent=n.label,n.value===s&&(r.selected=!0),e.appendChild(r)}e.value=s}_resolveFilterOptions(e){return Array.isArray(e.filterOptions)?e.filterOptions:this._uniqueValues(e.key).map(t=>({value:t,label:t}))}_paintBody(e,t,s){if(e.replaceChildren(),this.hasAttribute("loading")){const n=this._readLoadingRows();for(let r=0;r<n;r++)e.appendChild(this._buildSkeletonRow(t,r));return}const i=this._sortedRows(this._filteredRows());if(i.length===0){e.appendChild(this._buildEmptyRow(t.length));return}for(const{row:n,index:r}of i)if(e.appendChild(this._stacked?this._buildStackedRow(n,r,t):this._buildBodyRow(n,r,t,s)),this._expanded.has(r)&&this._subTable){const a=this._subTable(n,r);a&&e.appendChild(this._buildSubTableRow(a,t.length))}}_buildEmptyRow(e){const t=document.createElement("tr");t.classList.add("empty");const s=document.createElement("td");s.colSpan=e;const i=document.createElement("slot");return i.name="empty",i.textContent=this.getAttribute("empty")||"No data",s.appendChild(i),t.appendChild(s),t}_buildSkeletonRow(e,t){const s=document.createElement("tr");if(s.classList.add("skeleton"),s.setAttribute("aria-hidden","true"),this._stacked){s.classList.add("stack-row");const i=document.createElement("td");i.className="stack-body",i.colSpan=Math.max(1,e.length);for(const n of[55+t*7%25,30+t*11%15]){const r=document.createElement("span");r.className="skeleton-bar",r.style.width=`${n}%`,i.appendChild(r)}return s.appendChild(i),s}for(const i of e){const n=document.createElement("td"),r=document.createElement("span");r.className="skeleton-bar";const a=50+(t*7+s.children.length*13)%40;r.style.width=`${a}%`,n.appendChild(r),s.appendChild(n)}return s}_buildBodyRow(e,t,s,i){const n=document.createElement("tr");n.setAttribute("part","row"),n.dataset.rowIndex=String(t);const r=this._getRowId(e,t);n.dataset.rowId=String(r),this._selection.has(r)&&n.classList.add("is-selected"),n.addEventListener("click",a=>{this._onRowClick(e,t,a)});for(let a=0;a<s.length;a++)n.appendChild(this._buildBodyCell(s[a],a,e,t,i));return n}_buildStackedRow(e,t,s){const i=document.createElement("tr");i.setAttribute("part","row"),i.classList.add("stack-row"),i.dataset.rowIndex=String(t);const n=this._getRowId(e,t);i.dataset.rowId=String(n),this._selection.has(n)&&i.classList.add("is-selected"),i.addEventListener("click",u=>{this._onRowClick(e,t,u)});const r=document.createElement("td");r.className="stack-body";let a=0,c=0;for(let u=0;u<s.length;u++){const h=s[u];if(h.key===ye||h.key===_e){i.appendChild(this._buildBodyCell(h,u,e,t,0));continue}c++;const p=iu(h,a++);if(p==="hidden")continue;const g=document.createElement("div");if(g.className=`stack-cell stack-${p}`,g.dataset.key=h.key,p==="meta"&&h.label){const x=document.createElement("span");x.className="stack-label",x.textContent=h.label,g.appendChild(x)}const m=document.createElement("span");m.className="stack-value";const b=e[h.key];h.render?this._mountCellContent(m,h.render(b,e,t)):b!=null&&(m.textContent=String(b)),g.appendChild(m),r.appendChild(g)}return r.colSpan=Math.max(1,c),i.appendChild(r),i}_buildBodyCell(e,t,s,i,n){const r=document.createElement("td");if(this._applyCellClasses(r,e,t,n),e.minWidth&&(r.style.minWidth=e.minWidth),e.key===ye){const c=this._getRowId(s,i),u=document.createElement("input");return u.type="checkbox",u.className="select-row-checkbox",u.setAttribute("data-noclick",""),u.setAttribute("aria-label","Select row"),u.checked=this._selection.has(c),u.addEventListener("change",()=>{u.checked?this.select(c):this.deselect(c)}),r.appendChild(u),this._stacked&&(r.setAttribute("data-noclick",""),r.addEventListener("click",h=>{h.target===r&&(u.checked=!u.checked,u.dispatchEvent(new Event("change")))})),r}if(e.key===_e){if(!(this._subTable?!!this._subTable(s,i):!1))return r;const u=this._expanded.has(i),h=document.createElement("button");return h.type="button",h.className="expander",h.setAttribute("data-noclick",""),h.setAttribute("aria-expanded",u?"true":"false"),h.setAttribute("aria-label",u?"Collapse row":"Expand row"),h.textContent=u?"▾":"▸",h.addEventListener("click",p=>{this._toggleRow(i,s,p)}),r.appendChild(h),r}const a=s[e.key];if(e.render){const c=e.render(a,s,i);this._mountCellContent(r,c)}else a!=null&&(r.textContent=String(a));return r}_buildSubTableRow(e,t){const s=document.createElement("tr");s.classList.add("subtable"),s.setAttribute("part","subtable-row");const i=document.createElement("td");i.colSpan=t;const n=document.createElement("div");if(n.classList.add("subtable-inner"),e instanceof Node)n.appendChild(e);else if(gr(e))ge(e,n);else{const r=document.createElement("os-table");r.columns=e.columns,r.data=e.data,e.subTable&&(r.subTable=e.subTable),n.appendChild(r)}return i.appendChild(n),s.appendChild(i),s}_mountCellContent(e,t){if(typeof t=="string"){e.textContent=t;return}if(t instanceof Node){e.appendChild(t);return}gr(t)&&ge(t,e)}_onFilterChange(e,t){t===""?delete this._filters[e]:this._filters[e]=t,this.emit("os-table-filter-change",{filters:{...this._filters}});const i=this.shadowRoot?.querySelector("tbody");if(i){const n=this._effectiveColumns(),r=this._readStickyColumns();this._lastStickyIndex=this._computeLastStickyIndex(n,r),this._paintBody(i,n,r),this._applyStickyOffsets()}}_onRowClick(e,t,s){const i=s.composedPath?.()??[];for(const n of i){if(n instanceof Element&&n.hasAttribute("data-noclick"))return;if(n===this)break}this.emit("os-table-row-click",{row:e,index:t,originalEvent:s})}_toggleRow(e,t,s){s.stopPropagation();const i=this._expanded.has(e);i?this._expanded.delete(e):this._expanded.add(e),this.emit("os-table-expand-change",{row:t,index:e,expanded:!i}),this._schedulePaint()}_cycleSort(e){!this._sort||this._sort.key!==e?this._sort={key:e,direction:"asc"}:this._sort.direction==="asc"?this._sort={key:e,direction:"desc"}:this._sort=null,this.emit("os-table-sort-change",{sort:this._sort?{...this._sort}:null}),this._schedulePaint()}_emitSelectionChange(){this.emit("os-table-selection-change",{selection:Array.from(this._selection),rows:this.selectedRows})}_filteredRows(){const e=[],t=Object.keys(this._filters).filter(s=>this._filters[s]!=="");for(let s=0;s<this._data.length;s++){const i=this._data[s];let n=!0;for(const r of t){const a=this._columns.find(p=>p.key===r);if(a&&typeof a.filterRender=="function")continue;const c=this._filters[r]??"",u=i[r],h=u==null?"":String(u);if(a?.filter==="select"){if(h!==c){n=!1;break}}else if(!h.toLowerCase().includes(c.toLowerCase())){n=!1;break}}n&&e.push({row:i,index:s})}return e}_sortedRows(e){if(!this._sort)return e;const t=this._columns.find(n=>n.key===this._sort.key);if(!t)return e;const s=this._sort.direction==="desc"?-1:1,i=e.slice();return i.sort((n,r)=>{const a=t.sortValue?t.sortValue(n.row,n.row[t.key]):n.row[t.key],c=t.sortValue?t.sortValue(r.row,r.row[t.key]):r.row[t.key];return nu(a,c)*s}),i}_uniqueValues(e){const t=new Set;for(const s of this._data){const i=s[e];i!=null&&t.add(String(i))}return Array.from(t).sort()}_visibleSelectionStats(){let e=0,t=0;for(const{row:s,index:i}of this._filteredRows())e++,this._selection.has(this._getRowId(s,i))&&t++;return{total:e,selected:t}}_readStickyColumns(){const e=parseInt(this.getAttribute("sticky-columns")||"0",10);return Number.isFinite(e)&&e>0?e:0}_readLoadingRows(){const e=parseInt(this.getAttribute("loading-rows")||"5",10);return Number.isFinite(e)&&e>0?Math.min(e,100):5}_readSelectable(){const e=this.getAttribute("selectable");return e==="single"?"single":e==="multi"||e===""?"multi":null}_isStickyIndex(e,t,s){return this._stacked||s.sticky===!1?!1:s.sticky===!0?!0:e<t}_computeLastStickyIndex(e,t){let s=-1;for(let i=0;i<e.length;i++)this._isStickyIndex(i,t,e[i])&&(s=i);return s}_applyCellClasses(e,t,s,i){t.key===_e&&e.classList.add("col-expander"),t.key===ye&&e.classList.add("col-select"),t.align==="center"&&e.classList.add("align-center"),t.align==="end"&&e.classList.add("align-end"),this._isStickyIndex(s,i,t)&&(e.classList.add("is-sticky"),s===this._lastStickyIndex&&e.classList.add("is-sticky-edge"))}_effectiveColumns(){const e=[];return this._readSelectable()&&e.push({key:ye,label:"",width:"40px",align:"center"}),this._subTable&&e.push({key:_e,label:"",width:"36px",align:"center"}),e.push(...this._columns),e}_applyStickyOffsets(){const e=this.shadowRoot;if(!e)return;const t=e.querySelector("thead tr");if(!t)return;const s=Array.from(t.children),i=[];let n=0;for(let a=0;a<s.length;a++)i[a]=n,s[a].classList.contains("is-sticky")&&(n+=s[a].offsetWidth);e.querySelectorAll("thead tr, tbody tr:not(.subtable):not(.empty):not(.skeleton)").forEach(a=>{const c=Array.from(a.children);for(let u=0;u<c.length;u++)c[u].classList.contains("is-sticky")&&(c[u].style.insetInlineStart=`${i[u]}px`)}),this._maybeWarnStickyOffsetRace(s,i)}_maybeWarnStickyOffsetRace(e,t){if(this._stickyRaceWarned)return;const s=this._readStickyColumns();if(s<2)return;const i=Math.min(s-1,e.length-1);if(i<=0||t[i]!==0||this.offsetWidth===0)return;this._stickyRaceWarned=!0;const n=e[0]?.offsetWidth??0;console.warn(`[os-table] sticky-columns: column ${i} resolved to inset-inline-start: 0px while the host is visible. ths[0].offsetWidth was ${n}px at measurement time. Likely a layout race — call recomputeLayout() after the panel finishes its mount/transition, or wrap the assignment of \`data\` in a requestAnimationFrame.`)}_measureHeaderHeight(){const e=this.shadowRoot;if(!e)return;const t=e.querySelector("thead tr");if(!t)return;const s=t.offsetHeight;s>0&&this.style.setProperty("--os-ui-table-header-height",`${s}px`)}_maybeWarnStickyHeader(){if(this._stickyHeaderWarned||!this.hasAttribute("sticky-header")||this.hasAttribute("loading")||this._data.length<8)return;const e=this.shadowRoot?.querySelector(".scroll");e&&e.offsetWidth!==0&&e.scrollHeight<=e.clientHeight+1&&(this._stickyHeaderWarned=!0,console.warn("[os-table] sticky-header is set but the table has no scroll container. Set --os-ui-table-max-height on the host (or wrap it in a scrolling parent) so the header has something to stick to."))}};Ct.props=["stickyColumns","stickyHeader","striped","hover","compact","bordered","empty","loading","loadingRows","selectable","stacked"],Ct.styles=[ou],Ct.help=void 0;let jo=Ct;function gr(o){return!!o&&o.__wpdHtml===!0}function iu(o,e){return o.stack?o.stack:e===0?"title":o.label?"meta":"actions"}function nu(o,e){if(o===e)return 0;if(o==null)return-1;if(e==null)return 1;if(typeof o=="number"&&typeof e=="number")return o-e;if(o instanceof Date&&e instanceof Date)return o.getTime()-e.getTime();const t=Number(o),s=Number(e);return Number.isFinite(t)&&Number.isFinite(s)?t-s:String(o).localeCompare(String(e))}y("os-table",jo);const ru=v`:host{display:inline-block;--_color:var( --os-ui-spinner-color,var( --wp-admin-theme-color,#21759b ) );--_accent:var( --os-ui-spinner-accent,var( --os-ui-fg-on-accent,#fff ) );--_size:var( --os-ui-spinner-size,48px );width:var( --_size );height:var( --_size );color:var( --_color );vertical-align:middle;line-height:0}:host( [ hidden ] ){display:none}:host( [ preset='inline' ] ){--os-ui-spinner-color:currentColor;--os-ui-spinner-size:16px}.root,.root svg{display:block;width:100%;height:100%}.root svg .mark{fill:var( --_accent )}@keyframes os-spinner-spin{to{transform:rotate( 360deg )}}@keyframes os-spinner-scale{0%,100%{transform:scale( 1 )}50%{transform:scale( 1.045 )}}@keyframes os-spinner-opacity{0%,100%{opacity:1}50%{opacity:0.7}}@media ( prefers-reduced-motion:reduce ){.root svg [ style*='animation' ]{animation:none !important}}`,fr=Object.freeze({classic:{sp1:12,sp2:24,sp3:40,a1:28,a2:15,a3:8,gap:4,dir2:1,dir3:-1,pulse:"none",dots:0},comet:{sp1:8,sp2:14,sp3:26,a1:50,a2:28,a3:12,gap:3,dir2:1,dir3:1,pulse:"none",dots:5},orbit:{sp1:10,sp2:10,sp3:32,a1:50,a2:50,a3:8,gap:5,dir2:-1,dir3:-1,pulse:"opacity",dots:3},pulse:{sp1:6,sp2:18,sp3:30,a1:20,a2:12,a3:6,gap:4,dir2:1,dir3:-1,pulse:"both",dots:8},inline:{sp1:8,sp2:8,sp3:8,a1:25,a2:25,a3:25,gap:0,dir2:1,dir3:1,pulse:"none",dots:0}}),H=61.26,U=61.26,br=58.453,au='<path d="m8.708 61.26c0 20.802 12.089 38.779 29.619 47.298l-25.069-68.686c-2.916 6.536-4.55 13.769-4.55 21.388z"/><path d="m96.74 58.608c0-6.495-2.333-10.993-4.334-14.494-2.664-4.329-5.161-7.995-5.161-12.324 0-4.831 3.664-9.328 8.825-9.328.233 0 .454.029.681.042-9.35-8.566-21.807-13.796-35.489-13.796-18.36 0-34.513 9.42-43.91 23.688 1.233.037 2.395.063 3.382.063 5.497 0 14.006-.667 14.006-.667 2.833-.167 3.167 3.994.337 4.329 0 0-2.847.335-6.015.501l19.138 56.925 11.501-34.493-8.188-22.434c-2.83-.166-5.511-.501-5.511-.501-2.832-.166-2.5-4.496.332-4.329 0 0 8.679.667 13.843.667 5.496 0 14.006-.667 14.006-.667 2.835-.167 3.168 3.994.337 4.329 0 0-2.853.335-6.015.501l18.992 56.494 5.242-17.517c2.272-7.269 4.001-12.49 4.001-16.989z"/><path d="m62.184 65.857-15.768 45.819c4.708 1.384 9.687 2.141 14.846 2.141 6.12 0 11.989-1.058 17.452-2.979-.141-.225-.269-.464-.374-.724z"/><path d="m107.376 36.046c.226 1.674.354 3.471.354 5.404 0 5.333-.996 11.328-3.996 18.824l-16.053 46.413c15.624-9.111 26.133-26.038 26.133-45.426.001-9.137-2.333-17.729-6.438-25.215z"/>',St=class St extends _{constructor(){super(...arguments),this._paintScheduled=!1}connectedCallback(){super.connectedCallback(),this._schedulePaint()}render(){return l`<div class="root" part="root"></div>`}requestUpdate(){super.requestUpdate(),this._schedulePaint()}_schedulePaint(){this._paintScheduled||!this.isConnected||(this._paintScheduled=!0,queueMicrotask(()=>{this._paintScheduled=!1,this.isConnected&&this._paint()}))}_paint(){this._syncCssVars();const e=this.shadowRoot?.querySelector(".root");e&&(e.innerHTML=this._buildSvg())}_syncCssVars(){const e=(t,s,i)=>{const n=this.getAttribute(t);n===null?this.style.removeProperty(s):this.style.setProperty(s,i?i(n):n)};e("color","--os-ui-spinner-color"),e("accent","--os-ui-spinner-accent"),e("size","--os-ui-spinner-size",t=>/^-?\d+(\.\d+)?$/.test(t.trim())?`${t}px`:t)}_effectiveConfig(){const e=this.getAttribute("preset")??"classic",t=fr[e]??fr.classic,s=(r,a)=>{const c=this.getAttribute(r);if(c===null)return a;const u=parseFloat(c);return Number.isFinite(u)?u:a},i=(r,a)=>{const c=this.getAttribute(r);if(c===null)return a;const u=c.toLowerCase();return u==="-1"||u==="ccw"||u==="reverse"?-1:1},n=()=>{const r=this.getAttribute("pulse");return r==="scale"||r==="opacity"||r==="both"||r==="none"?r:t.pulse};return{sp1:s("sp1",t.sp1),sp2:s("sp2",t.sp2),sp3:s("sp3",t.sp3),a1:s("a1",t.a1),a2:s("a2",t.a2),a3:s("a3",t.a3),gap:s("gap",t.gap),dir2:i("dir2",t.dir2),dir3:i("dir3",t.dir3),pulse:n(),dots:Math.max(0,Math.floor(s("dots",t.dots)))}}_buildInlineSvg(e){const t=mr(this.getAttribute("label")??"Loading"),s=9,i=(e.sp1/10).toFixed(2);return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" role="img" aria-label="${t}"><circle cx="12" cy="12" r="${s}" fill="none" stroke="currentColor" stroke-width="2.4" stroke-opacity="0.22"/><circle cx="12" cy="12" r="${s}" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-dasharray="${cs(s,e.a1)}" style="transform-origin:12px 12px;animation: os-spinner-spin ${i}s linear infinite"/></svg>`}_buildSvg(){const e=this._effectiveConfig();if(this.getAttribute("preset")==="inline")return this._buildInlineSvg(e);const t=mr(this.getAttribute("label")??"Loading"),s=e.gap*3+14,i=-s,n=122.52+s*2,r=br+e.gap+2,a=r+e.gap+2,c=a+e.gap+1.5,u=`animation: os-spinner-spin ${(e.sp1/10).toFixed(2)}s linear infinite`,h=`animation: os-spinner-spin ${(e.sp2/10).toFixed(2)}s linear infinite${e.dir2<0?" reverse":""}`,p=`animation: os-spinner-spin ${(e.sp3/10).toFixed(2)}s linear infinite${e.dir3<0?" reverse":""}`,g=(e.sp1*1.8/10).toFixed(1),m=(e.sp1*2.3/10).toFixed(1);let b="";e.pulse==="scale"?b=`animation: os-spinner-scale ${g}s ease-in-out infinite`:e.pulse==="opacity"?b=`animation: os-spinner-opacity ${m}s ease-in-out infinite`:e.pulse==="both"&&(b=`animation: os-spinner-scale ${g}s ease-in-out infinite, os-spinner-opacity ${m}s ease-in-out infinite`);let x="";if(e.dots>0){const w=c+e.gap+1,$=2*Math.PI*w,f=1.6,A=(e.sp1*.65/10).toFixed(2);for(let k=0;k<e.dots;k++){const R=-(k/e.dots)*$;x+=`<circle cx="${H}" cy="${U}" r="${w.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="${f}" stroke-dasharray="${f.toFixed(2)} ${($-f).toFixed(2)}" stroke-dashoffset="${R.toFixed(2)}" stroke-linecap="round" stroke-opacity="0.65" style="transform-origin:${H}px ${U}px;animation: os-spinner-spin ${A}s linear infinite"/>`}}return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${i} ${i} ${n} ${n}" role="img" aria-label="${t}"><g style="transform-origin:${H}px ${U}px${b?";"+b:""}"><circle cx="${H}" cy="${U}" r="${br}" fill="currentColor"/><g class="mark">${au}</g></g><circle cx="${H}" cy="${U}" r="${r.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="0.6" stroke-opacity="0.2"/><circle cx="${H}" cy="${U}" r="${r.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="2.2" stroke-dasharray="${cs(r,e.a1)}" stroke-linecap="round" style="transform-origin:${H}px ${U}px;${u}"/><circle cx="${H}" cy="${U}" r="${a.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="0.5" stroke-opacity="0.15"/><circle cx="${H}" cy="${U}" r="${a.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="1.6" stroke-opacity="0.8" stroke-dasharray="${cs(a,e.a2)}" stroke-linecap="round" style="transform-origin:${H}px ${U}px;${h}"/><circle cx="${H}" cy="${U}" r="${c.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="0.4" stroke-opacity="0.12"/><circle cx="${H}" cy="${U}" r="${c.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="1.0" stroke-opacity="0.6" stroke-dasharray="${cs(c,e.a3)}" stroke-linecap="round" style="transform-origin:${H}px ${U}px;${p}"/>`+x+"</svg>"}};St.props=["preset","size","color","accent","sp1","sp2","sp3","a1","a2","a3","gap","dir2","dir3","pulse","dots","label"],St.styles=[ru],St.help=void 0;let Bo=St;function cs(o,e){const t=2*Math.PI*o,s=e/100*t,i=t-s;return`${s.toFixed(2)} ${i.toFixed(2)}`}function mr(o){return String(o).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}y("os-spinner",Bo);const lu=v`:host{display:inline;color:inherit;font:inherit}`,ds=new Set;let Re=null;const cu=3e4;function du(){Re===null&&(Re=window.setInterval(()=>{for(const o of ds)o.tick()},cu))}function uu(){Re!==null&&ds.size===0&&(window.clearInterval(Re),Re=null)}function hu(o){if(!o)return null;const e=t=>{const s=new Date(t);return Number.isNaN(s.getTime())?null:s};return pu(o)?e(o):e(o.replace(" ","T")+"Z")}function pu(o){const e=Math.max(o.indexOf("T"),o.indexOf(" ")),t=e===-1?"":o.slice(e+1);return/(?:[Zz]|[+-]\d{2}:?\d{2})$/.test(t)}let Go=null,Xo=null;function vr(){return typeof navigator<"u"&&navigator.language||"en"}function gu(){return Go||(Go=new Intl.RelativeTimeFormat(vr(),{numeric:"auto"})),Go}function _r(){return Xo||(Xo=new Intl.RelativeTimeFormat(vr(),{numeric:"always",style:"narrow"})),Xo}function fu(o,e){const t=gu(),s=o.getTime()-e,i=Math.round(s/1e3),n=Math.abs;return n(i)<45?t.format(0,"second"):yr(t,i)}function yr(o,e){const t=Math.abs,s=Math.round(e/60);if(t(s)<45)return o.format(s,"minute");const i=Math.round(s/60);if(t(i)<22)return o.format(i,"hour");const n=Math.round(i/24);if(t(n)<26)return o.format(n,"day");const r=Math.round(n/30);if(t(r)<11)return o.format(r,"month");const a=Math.round(n/365);return o.format(a,"year")}function bu(o,e){const t=Math.round((o.getTime()-e)/1e3),s=Math.abs;return s(t)<45?_r().format(0,"second"):s(t)>604800?o.toLocaleDateString(void 0,{month:"short",day:"numeric"}):yr(_r(),t)}const Lt=class Lt extends _{connectedCallback(){super.connectedCallback(),ds.add(this),du()}disconnectedCallback(){ds.delete(this),uu()}tick(){this.requestUpdate()}render(){const e=this.datetime,t=hu(e);if(!t)return l`<span>${e??""}</span>`;const s=Date.now(),i=this.hasAttribute("compact")?bu(t,s):fu(t,s),n=t.toLocaleString();return l`<time datetime=${t.toISOString()} title=${n}
1077 >${i}</time
1078 >`}};Lt.props=["datetime","compact"],Lt.styles=[lu],Lt.help=void 0;let Zo=Lt;y("os-relative-time",Zo);const mu=v`:host{display:block;position:relative;color:var( --os-ui-fg,#1d2327 );font-family:var( --os-ui-font,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif );font-size:12px}.head{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;margin-block-end:6px}:host(:not( [legend] ):not( [heading] ) ) .head{display:none}.heading{margin:0;font-size:13px;font-weight:600;color:var( --os-ui-fg,#1d2327 )}.heading[hidden]{display:none}.legend{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin-inline-start:auto}:host(:not( [legend] ) ) .legend{display:none}.chip{display:inline-flex;align-items:center;gap:6px;padding:3px 9px;border:1px solid var( --os-ui-border,#dcdcde );border-radius:999px;background:transparent;color:var( --os-ui-fg-muted,#646970 );font:inherit;cursor:pointer;transition:opacity 0.12s ease,border-color 0.12s ease}.chip[aria-pressed='false']{opacity:0.45}.chip:hover{border-color:var( --os-ui-border-strong,#8c8f94 );color:var( --os-ui-fg,#1d2327 )}.chip:focus-visible{outline:2px solid var( --os-ui-accent,#2271b1 );outline-offset:1px}.count{font-variant-numeric:tabular-nums;color:var( --os-ui-fg,#1d2327 )}.swatch{display:inline-block;width:10px;height:10px;border-radius:3px;flex:none}.swatch,.seg{background:var( --_tone );fill:var( --_tone )}[data-tone='danger']{--_tone:var( --os-ui-danger,#d63638 )}[data-tone='warning']{--_tone:var( --os-ui-warning,#dba617 )}[data-tone='info']{--_tone:var( --os-ui-info-fg,#72aee6 )}[data-tone='success']{--_tone:var( --os-ui-success,#00a32a )}[data-tone='accent']{--_tone:var( --os-ui-accent,#2271b1 )}[data-tone='neutral']{--_tone:var( --os-ui-fg-muted,#646970 )}.chart{position:relative}svg{display:block;inline-size:100%}.grid{stroke:var( --os-ui-border,#dcdcde );stroke-width:1}.tick{fill:var( --os-ui-fg-muted,#646970 );font-size:10px;font-variant-numeric:tabular-nums}.hit{fill:transparent;cursor:crosshair}.hover{fill:var( --os-ui-surface-raised,rgba( 0,0,0,0.04 ) );pointer-events:none}.empty{padding:40px 0;text-align:center;font-size:13px;color:var( --os-ui-fg-muted,#646970 )}.tooltip{position:absolute;inset-block-start:4px;transform:translateX( -50% );min-inline-size:150px;padding:8px 10px;border-radius:6px;border:1px solid var( --os-ui-border,#dcdcde );background:var( --os-ui-surface-elevated,#fff );box-shadow:var( --os-ui-shadow,0 2px 8px rgba( 0,0,0,0.15 ) );pointer-events:none;z-index:2}.tooltip[hidden]{display:none}.tooltip-head{margin-block-end:6px;color:var( --os-ui-fg-muted,#646970 );font-size:11px}.tooltip-row{display:flex;align-items:center;gap:6px;line-height:1.6}.tooltip-label{flex:1}.tooltip-value{font-variant-numeric:tabular-nums;font-weight:600}`,vu="http://www.w3.org/2000/svg",Ie=8,_u=20,V=8,yu=40,wu=24,Yo=2,xu=150,ku=new Set(["danger","warning","info","success","accent","neutral"]);function wr(o,e){if(!o)return e;try{return JSON.parse(o)}catch{return e}}function $u(o){if(o<=5)return Math.max(1,o);const e=Math.pow(10,Math.floor(Math.log10(o)));for(const t of[1,2,5,10])if(t*e>=o)return t*e;return 10*e}function ae(o,e){const t=document.createElementNS(vu,o);for(const[s,i]of Object.entries(e))t.setAttribute(s,i);return t}function Eu(o,e,t,s){const i=Math.min(3,s/2,t/2);return`M ${o} ${e+s} L ${o} ${e+i} Q ${o} ${e} ${o+i} ${e} L ${o+t-i} ${e} Q ${o+t} ${e} ${o+t} ${e+i} L ${o+t} ${e+s} Z`}const Rt=class Rt extends _{constructor(){super(...arguments),this._resize=null,this._tooltip=null}connectedCallback(){super.connectedCallback(),typeof ResizeObserver<"u"&&(this._resize=new ResizeObserver(()=>this.paint()),this._resize.observe(this))}disconnectedCallback(){this._resize?.disconnect(),this._resize=null}requestUpdate(){super.requestUpdate(),queueMicrotask(()=>this.paint())}get seriesList(){const e=wr(this.getAttribute("series"),[]);return Array.isArray(e)?e.filter(t=>!!t&&typeof t=="object"&&typeof t.key=="string").map(t=>({key:t.key,label:typeof t.label=="string"?t.label:t.key,tone:t.tone&&ku.has(t.tone)?t.tone:"neutral"})):[]}get columnList(){const e=wr(this.getAttribute("columns"),[]);return Array.isArray(e)?e.map(t=>Array.isArray(t)?t.map(s=>Number.isFinite(Number(s))?Math.max(0,Number(s)):0):[]):[]}get hiddenSet(){return new Set((this.getAttribute("hidden-series")??"").split(",").map(e=>e.trim()).filter(e=>e!==""))}totals(){const e=this.seriesList,t=e.map(()=>0);for(const s of this.columnList)e.forEach((i,n)=>{t[n]+=s[n]??0});return t}toggleSeries(e){const t=this.hiddenSet;t.has(e)?t.delete(e):t.add(e);const s=Array.from(t);s.length>0?this.setAttribute("hidden-series",s.join(",")):this.removeAttribute("hidden-series"),this.emit("os-series-toggle",{key:e,hidden:s})}render(){const e=this.seriesList,t=this.totals(),s=this.hiddenSet,i=this.getAttribute("heading")??"";return l`
1079 <div class="head" part="head">
1080 <h2 class="heading" part="heading" ?hidden=${i===""}>${i}</h2>
1081 <div class="legend" part="legend" role="group">
1082 ${e.map((n,r)=>l`
1083 <button
1084 type="button"
1085 class="chip"
1086 data-tone=${n.tone??"neutral"}
1087 aria-pressed=${s.has(n.key)?"false":"true"}
1088 @click=${()=>this.toggleSeries(n.key)}
1089 >
1090 <span class="swatch"></span>
1091 <span class="label">${n.label}</span>
1092 <span class="count">${t[r].toLocaleString()}</span>
1093 </button>
1094 `)}
1095 </div>
1096 </div>
1097 <div class="chart" part="chart"></div>
1098 <div class="tooltip" part="tooltip" hidden></div>
1099 `}paint(){const e=this.shadowRoot,t=e?.querySelector(".chart"),s=e?.querySelector(".tooltip");if(!t||!s)return;this._tooltip=s,s.hidden=!0,t.textContent="";const i=this.columnList,n=i.some(L=>L.some(T=>T>0));if(i.length===0||!n){const L=document.createElement("div");L.className="empty",L.textContent=this.getAttribute("empty")??"",t.appendChild(L);return}const r=this.seriesList,a=this.hiddenSet,c=r.map((L,T)=>a.has(L.key)?-1:T).filter(L=>L>=0),u=parseInt(this.getAttribute("height")??"",10),h=Number.isFinite(u)&&u>40?u:xu,p=Math.max(280,this.clientWidth||640),g=p-V-yu,m=h-Ie-_u,b=i.length,x=g/b,w=Math.max(2,Math.min(wu,x-Yo)),$=i.reduce((L,T)=>{const Y=c.reduce((Q,_s)=>Q+(T[_s]??0),0);return Math.max(L,Y)},0),f=$u($),A=m/f,k=ae("svg",{width:String(p),height:String(h),viewBox:`0 0 ${p} ${h}`,role:"img"});for(const L of[0,.5,1]){const T=f*L,Y=Ie+m-T*A;k.appendChild(ae("line",{class:"grid",x1:String(V),y1:String(Y),x2:String(V+g),y2:String(Y)}));const Q=ae("text",{class:"tick",x:String(V+g+6),y:String(Y+3.5)});Q.textContent=Number.isInteger(T)?T.toLocaleString():String(T),k.appendChild(Q)}const R=Number(this.getAttribute("start"))||0,X=Number(this.getAttribute("end"))||R+b,Z=Math.max(1,(X-R)/b),N=X-R>36*3600,M=L=>new Date(L*1e3).toLocaleString([],N?{month:"short",day:"numeric"}:{hour:"2-digit",minute:"2-digit"}),Ip=L=>new Date(L*1e3).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),Dp=[[R,V,"start"],[R+(X-R)/2,V+g/2,"middle"],[X,V+g,"end"]];for(const[L,T,Y]of Dp){const Q=ae("text",{class:"tick",x:String(T),y:String(h-5),"text-anchor":Y});Q.textContent=M(L),k.appendChild(Q)}const vs=ae("rect",{class:"hover",y:String(Ie),width:String(x),height:String(m),visibility:"hidden"});k.appendChild(vs),i.forEach((L,T)=>{const Y=V+T*x+(x-w)/2;let Q=Ie+m;const _s=c.filter(Bt=>(L[Bt]??0)>0),Tp=_s[_s.length-1];for(const Bt of c){const ea=L[Bt]??0;if(ea===0)continue;const ta=r[Bt].tone??"neutral",yi=ea*A,wi=Q-yi;Bt===Tp?k.appendChild(ae("path",{class:"seg","data-tone":ta,d:Eu(Y,wi,w,Math.max(1.5,yi))})):k.appendChild(ae("rect",{class:"seg","data-tone":ta,x:String(Y),y:String(wi+Yo),width:String(w),height:String(Math.max(1.5,yi-Yo))})),Q=wi}const _i=ae("rect",{class:"hit",x:String(V+T*x),y:String(Ie),width:String(x),height:String(m)});_i.addEventListener("pointerenter",()=>{vs.setAttribute("x",String(V+T*x)),vs.setAttribute("visibility","visible"),this.showTooltip(T,L,x,p,{head:`${Ip(R+T*Z)} – ${M(R+(T+1)*Z)}`,series:r,visibleIndexes:c})}),_i.addEventListener("pointerleave",()=>{vs.setAttribute("visibility","hidden"),s.hidden=!0}),k.appendChild(_i)}),t.appendChild(k)}showTooltip(e,t,s,i,n){const r=this._tooltip;if(!r)return;r.textContent="";const a=document.createElement("div");a.className="tooltip-head",a.textContent=n.head,r.appendChild(a);let c=0;for(const h of[...n.visibleIndexes].reverse()){const p=t[h]??0;if(p===0)continue;c++;const g=document.createElement("div");g.className="tooltip-row";const m=document.createElement("span");m.className="swatch",m.dataset.tone=n.series[h].tone??"neutral";const b=document.createElement("span");b.className="tooltip-label",b.textContent=n.series[h].label;const x=document.createElement("span");x.className="tooltip-value",x.textContent=p.toLocaleString(),g.append(m,b,x),r.appendChild(g)}if(c===0){const h=document.createElement("div");h.className="tooltip-row",h.textContent="—",r.appendChild(h)}r.hidden=!1;const u=V+e*s+s/2;r.style.left=`${Math.max(60,Math.min(u,i-60))}px`}};Rt.props=["heading","series","columns","start","end","hidden-series","legend","empty","height"],Rt.styles=[mu],Rt.help=void 0;let Qo=Rt;y("os-histogram",Qo);const Au=v`:host{--_border:var( --os-ui-stat-border,var( --os-ui-border,#dcdcde ) );--_bg:var( --os-ui-stat-bg,transparent );--_value-color:var( --os-ui-stat-value-color,var( --wp-admin-theme-color,#2271b1 ) );--_value-size:var( --os-ui-stat-value-size,20px );--_label-color:var( --os-ui-stat-label-color,var( --os-ui-fg-muted,#646970 ) );display:flex;flex-direction:column;gap:2px;padding:var( --os-ui-stat-padding,10px 12px );border:1px solid var( --_border );border-radius:var( --os-ui-stat-radius,8px );background:var( --_bg );min-inline-size:0}:host( [ hidden ] ){display:none}.value{font-size:var( --_value-size );font-weight:700;line-height:1.1;color:var( --_value-color );font-variant-numeric:tabular-nums}.label{display:inline-flex;align-items:center;gap:6px;font-size:11px;letter-spacing:0.05em;text-transform:uppercase;color:var( --_label-color )}.caption{font-size:11px;color:var( --_label-color )}.swatch{display:inline-block;inline-size:10px;block-size:10px;border-radius:3px;flex:none;background:var( --os-app-tone,var( --os-ui-fg-muted,#646970 ) )}`,It=class It extends _{render(){const e=this,t=e.caption||"";return l`
1100 <span class="value" part="value">${e.value||""}</span>
1101 <span class="label" part="label">
1102 ${this.hasAttribute("swatch")?l`<i class="swatch" aria-hidden="true"></i>`:""}
1103 ${e.label||""}
1104 </span>
1105 ${t?l`<span class="caption" part="caption">${t}</span>`:""}
1106 `}};It.props=["value","label","caption","swatch"],It.styles=[Au],It.help=void 0;let Jo=It;y("os-stat",Jo);const Cu=v`:host{display:inline-flex;position:relative;width:var( --os-ui-avatar-size,32px );height:var( --os-ui-avatar-size,32px );flex:0 0 auto;vertical-align:middle;line-height:0;perspective:calc( var( --os-ui-avatar-size,32px ) * 8 );--os-ui-avatar-tilt-x:0deg;--os-ui-avatar-tilt-y:0deg;--os-ui-avatar-hover:0;--os-ui-avatar-glare-x:50%;--os-ui-avatar-glare-y:50%}:host( [ hidden ] ){display:none}.os-avatar__tile{position:relative;width:100%;height:100%;border-radius:50%;overflow:hidden;background:var( --os-window-bg,#f0f0f1 );color:var( --os-ui-fg-on-accent,#fff );display:flex;align-items:center;justify-content:center;font-weight:700;font-size:calc( var( --os-ui-avatar-size,32px ) * 0.48 );line-height:1;letter-spacing:0;font-feature-settings:'tnum' 1;user-select:none;transform-style:preserve-3d;transform:rotateX( var( --os-ui-avatar-tilt-x ) ) rotateY( var( --os-ui-avatar-tilt-y ) ) scale( calc( 1 + var( --os-ui-avatar-hover ) * 0.07 ) );transition:transform 220ms cubic-bezier( 0.2,0.8,0.2,1 ),box-shadow 220ms cubic-bezier( 0.2,0.8,0.2,1 );box-shadow:inset 0 0 0 1px rgba( 255,255,255,calc( 0.18 + 0.22 * var( --os-ui-avatar-hover ) ) ),inset 0 0 0 calc( 1px + var( --os-ui-avatar-hover ) * 1px ) rgba( 0,0,0,calc( 0.08 + 0.04 * var( --os-ui-avatar-hover ) ) ),0 calc( 1px + var( --os-ui-avatar-hover ) * 8px ) calc( 6px + var( --os-ui-avatar-hover ) * 18px ) rgba( 0,0,0,calc( 0.08 + 0.18 * var( --os-ui-avatar-hover ) ) )}.os-avatar__tile::after{content:'';position:absolute;inset:0;border-radius:50%;background:radial-gradient( circle at var( --os-ui-avatar-glare-x ) var( --os-ui-avatar-glare-y ),var( --os-ui-scrim,rgba( 255,255,255,0.55 ) ) 0%,var( --os-ui-hover,rgba( 255,255,255,0 ) ) 55% );opacity:var( --os-ui-avatar-hover );mix-blend-mode:overlay;pointer-events:none;transition:opacity 220ms cubic-bezier( 0.2,0.8,0.2,1 )}.os-avatar__tile::before{content:'';position:absolute;inset:calc( var( --os-ui-avatar-hover ) * -3px );border-radius:50%;background:radial-gradient( circle at var( --os-ui-avatar-glare-x ) var( --os-ui-avatar-glare-y ),color-mix( in srgb,var( --os-ui-avatar-halo,rgb( 99,102,241 ) ) calc( 35% * var( --os-ui-avatar-hover ) ),transparent ) 0%,transparent 70% );filter:blur( 4px );pointer-events:none;z-index:-1;transition:inset 220ms cubic-bezier( 0.2,0.8,0.2,1 ),background 220ms}.os-avatar__tile img{width:calc( 100% + 2px );height:calc( 100% + 2px );margin:-1px;object-fit:cover;display:block;transform:translateZ( 1px )}.os-avatar__dot{position:absolute;bottom:0;inset-inline-end:0;width:calc( var( --os-ui-avatar-size,32px ) * 0.32 );height:calc( var( --os-ui-avatar-size,32px ) * 0.32 );min-width:8px;min-height:8px;border-radius:50%;box-sizing:border-box;border:2px solid var( --os-ui-avatar-dot-ring,var( --os-window-bg,#fff ) );background:var( --os-ui-avatar-dot-color,transparent );z-index:2}.os-avatar__dot--online{background:var( --os-ui-success-fg,#00a32a )}.os-avatar__dot--online::after{content:'';position:absolute;inset:-2px;border-radius:50%;border:1px solid var( --os-ui-success-fg,#00a32a );animation:os-avatar-presence 6s var( --os-ui-ease-out,cubic-bezier( 0.22,0.9,0.28,1 ) ) infinite;pointer-events:none}@keyframes os-avatar-presence{0%{opacity:0.6;transform:scale( 1 )}20%{opacity:0;transform:scale( 2.2 )}100%{opacity:0;transform:scale( 2.2 )}}.os-avatar__dot--inactive{background:var( --os-ui-warning-fg,#dba617 )}.os-avatar__dot--offline{background:var( --os-ui-fg-muted,#8c8f94 )}@media ( prefers-reduced-motion:reduce ){.os-avatar__dot--online::after{animation:none;opacity:0.6}.os-avatar__tile{transform:none;transition:box-shadow 200ms}.os-avatar__tile::after,.os-avatar__tile::before{display:none}}`,xr={xs:20,sm:24,md:40,lg:64,xl:96},kr=new Set(["online","inactive","offline"]),Dt=class Dt extends _{constructor(){super(...arguments),this._presenceHandler=null,this._imgFailed=!1,this._onPointerMove=null,this._onPointerEnter=null,this._onPointerLeave=null,this._tiltRaf=0,this._pendingTiltX="0deg",this._pendingTiltY="0deg",this._pendingGlareX="50%",this._pendingGlareY="50%"}connectedCallback(){super.connectedCallback(),this._maybeAttachPresenceListener(),this._attachHoverEffect()}disconnectedCallback(){this._presenceHandler&&(document.removeEventListener("os-presence-changed",this._presenceHandler),this._presenceHandler=null),this._detachHoverEffect()}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e==="src"&&(this._imgFailed=!1),(e==="user-id"||e==="presence")&&this._maybeAttachPresenceListener()}render(){const e=this._attr("src"),t=this._attr("name")||"",s=this._attr("alt"),i=s!==null?s:t,n=this._attr("size"),r=this._resolveSize(n),a=this._presenceForRender(),c=this._attr("clickable")!==null;this.style.setProperty("--os-ui-avatar-size",`${r}px`);const u=e&&!this._imgFailed?"":this._initialsBg(t),h=e&&!this._imgFailed?l`<img
1107 src=${e}
1108 alt=${i}
1109 @error=${()=>this._onImgError()}
1110 loading="lazy"
1111 />`:this._initials(t),p=a?l`<span
1112 class=${`os-avatar__dot os-avatar__dot--${a}`}
1113 aria-label=${this._presenceLabel(a)}
1114 ></span>`:l``;return c?l`
1115 <button
1116 type="button"
1117 class="os-avatar__tile"
1118 aria-label=${i||"User"}
1119 style=${u?`background:${u};`:""}
1120 @click=${g=>this._onClick(g)}
1121 >${h}</button>
1122 ${p}
1123 `:l`
1124 <div
1125 class="os-avatar__tile"
1126 role="img"
1127 aria-label=${i||"User"}
1128 style=${u?`background:${u};`:""}
1129 >${h}</div>
1130 ${p}
1131 `}_attr(e){return this.getAttribute(e)}_resolveSize(e){if(!e)return 32;if(e in xr)return xr[e];const t=Number(e);return Number.isFinite(t)&&t>0?t:32}_initials(e){const t=e.trim();return t?Array.from(t)[0]?.toUpperCase()??"?":"?"}_initialsBg(e){const t=Ui(e);return`linear-gradient(135deg, hsl(${t} 62% 55%), hsl(${(t+24)%360} 58% 42%))`}_presenceForRender(){const e=this._attr("presence");return e&&kr.has(e)?e:null}_presenceLabel(e){switch(e){case"online":return"Online";case"inactive":return"Inactive";case"offline":return"Offline"}}_onImgError(){this._imgFailed=!0,this.requestUpdate()}_onClick(e){const t=this._attr("user-id"),s={userId:t!==null&&Number(t)||null,originalEvent:e};this.emit("os-avatar-click",s)}_attachHoverEffect(){typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches||(this._onPointerEnter=()=>{this.style.setProperty("--os-ui-avatar-hover","1")},this._onPointerLeave=()=>{this.style.setProperty("--os-ui-avatar-hover","0"),this._pendingTiltX="0deg",this._pendingTiltY="0deg",this._pendingGlareX="50%",this._pendingGlareY="50%",this._flushTilt()},this._onPointerMove=t=>{const s=this.getBoundingClientRect();if(s.width===0||s.height===0)return;const i=(t.clientX-s.left)/s.width-.5,n=(t.clientY-s.top)/s.height-.5,r=14;this._pendingTiltY=`${(i*r).toFixed(2)}deg`,this._pendingTiltX=`${(-n*r).toFixed(2)}deg`;const a=Math.max(0,Math.min(100,(i+.5)*100)),c=Math.max(0,Math.min(100,(n+.5)*100));this._pendingGlareX=`${a.toFixed(1)}%`,this._pendingGlareY=`${c.toFixed(1)}%`,this._tiltRaf||(this._tiltRaf=requestAnimationFrame(()=>this._flushTilt()))},this.addEventListener("pointerenter",this._onPointerEnter),this.addEventListener("pointerleave",this._onPointerLeave),this.addEventListener("pointermove",this._onPointerMove))}_flushTilt(){this._tiltRaf=0,this.style.setProperty("--os-ui-avatar-tilt-x",this._pendingTiltX),this.style.setProperty("--os-ui-avatar-tilt-y",this._pendingTiltY),this.style.setProperty("--os-ui-avatar-glare-x",this._pendingGlareX),this.style.setProperty("--os-ui-avatar-glare-y",this._pendingGlareY)}_detachHoverEffect(){this._onPointerMove&&(this.removeEventListener("pointermove",this._onPointerMove),this._onPointerMove=null),this._onPointerEnter&&(this.removeEventListener("pointerenter",this._onPointerEnter),this._onPointerEnter=null),this._onPointerLeave&&(this.removeEventListener("pointerleave",this._onPointerLeave),this._onPointerLeave=null),this._tiltRaf&&(cancelAnimationFrame(this._tiltRaf),this._tiltRaf=0)}_maybeAttachPresenceListener(){const e=this._attr("user-id"),t=this._attr("presence"),s=!!e&&!t;s&&!this._presenceHandler?(this._presenceHandler=i=>{const n=i.detail;n&&String(n.userId)===String(e)&&n.newStatus&&kr.has(n.newStatus)&&this.setAttribute("presence",n.newStatus)},document.addEventListener("os-presence-changed",this._presenceHandler)):!s&&this._presenceHandler&&(document.removeEventListener("os-presence-changed",this._presenceHandler),this._presenceHandler=null)}};Dt.props=["src","alt","name","size","presence","userId","clickable"],Dt.styles=[Cu],Dt.help=void 0;let ei=Dt;y("os-avatar",ei);const Su=v` ${S} ${Vs}:host{--_field-size:var( --os-ui-field-font-size,13px );--_field-radius:var( --os-ui-field-radius,6px );display:flex;flex-direction:column;gap:4px;font-size:var( --_field-size );color:var( --os-ui-fg,#1d2327 );min-width:0}:host( [ hidden ] ){display:none}.os-textarea__label{font-size:12px;color:var( --os-ui-fg-muted,#646970 )}textarea{appearance:none;-webkit-appearance:none;display:block;width:100%;min-width:0;box-sizing:border-box;padding:8px 10px;background:var( --os-window-bg,#fff );border:1px solid var( --os-ui-border,#dcdcde );border-radius:var( --_field-radius );font:inherit;font-size:var( --_field-size );line-height:1.45;color:var( --os-ui-fg,#1d2327 );resize:vertical}textarea:disabled{opacity:0.55;cursor:not-allowed;background:var( --os-ui-hover,rgba( 0,0,0,0.03 ) )}textarea[ aria-invalid='true' ],textarea[ aria-invalid='true' ]:hover:not(:disabled ){border-color:var( --os-ui-danger,#d63638 )}textarea[ aria-invalid='true' ]:focus,textarea[ aria-invalid='true' ]:focus-visible{border-color:var( --os-ui-danger,#d63638 );box-shadow:0 0 0 1px var( --os-ui-danger,#d63638 ),0 0 0 4px rgba( 214,54,56,0.18 )}:host( [ auto-grow ] ) textarea{resize:none;overflow:hidden}`,Tt=class Tt extends _{constructor(){super(...arguments),this._textareaEl=null}connectedCallback(){super.connectedCallback(),Le(this)}render(){const e=this._attr("label")||"",t=this._attr("value")??"",s=this._attr("placeholder")||"",i=this._boolAttr("disabled"),n=this._boolAttr("readonly"),r=this._attr("aria-label")||e,a=this._attr("name")||"",c=Number(this._attr("rows"))||3,u=this._attr("maxlength"),h=this._attr("minlength"),p=this._boolAttr("invalid"),m=`${this.id||"os-unnamed"}__field`;return l`
1132 ${e?l`<label class="os-textarea__label" for=${m}>${e}</label>`:l``}
1133 <textarea
1134 id=${m}
1135 part="textarea"
1136 .value=${t}
1137 placeholder=${s}
1138 ?disabled=${i}
1139 ?readonly=${n}
1140 rows=${c}
1141 maxlength=${u??""}
1142 minlength=${h??""}
1143 name=${a}
1144 aria-invalid=${p?"true":"false"}
1145 aria-label=${r||""}
1146 @input=${b=>this._onInput(b)}
1147 @change=${b=>this._onChange(b)}
1148 @keydown=${b=>this._onKeyDown(b)}
1149 ></textarea>
1150 `}_attr(e){return this.getAttribute(e)}_boolAttr(e){return this.getAttribute(e)!==null}_onInput(e){const t=e.target;this._textareaEl=t,this.setAttribute("value",t.value),this.emit("os-input-change",{value:t.value}),this._boolAttr("auto-grow")&&this._autosize(t)}_onChange(e){const t=e.target;this.emit("os-input-commit",{value:t.value})}_onKeyDown(e){if(this._boolAttr("submit-on-enter")&&e.key==="Enter"&&!e.shiftKey&&!e.altKey&&!e.metaKey&&!e.ctrlKey){e.preventDefault();const t=e.target;this.emit("os-submit",{value:t.value})}}_autosize(e){const t=Number(this._attr("max-rows"))||8,s=window.getComputedStyle(e),i=parseFloat(s.fontSize)||13,n=s.lineHeight,r=n==="normal"?i*1.45:parseFloat(n)||i*1.45,a=parseFloat(s.paddingTop)||0,c=parseFloat(s.paddingBottom)||0,u=r*t+a+c;e.style.height="auto";const h=Math.min(e.scrollHeight,u);e.style.height=`${h}px`}refreshAutosize(){this._textareaEl&&this._boolAttr("auto-grow")&&this._autosize(this._textareaEl)}focusInput(){(this.shadowRoot??this).querySelector("textarea")?.focus()}clear(){this.setAttribute("value","");const t=(this.shadowRoot??this).querySelector("textarea");t&&(t.value="",this._boolAttr("auto-grow")&&this._autosize(t))}};Tt.props=["label","value","placeholder","disabled","readonly","ariaLabel","name","rows","maxlength","minlength","invalid","autoGrow","maxRows","submitOnEnter"],Tt.styles=[Su],Tt.help=void 0;let ti=Tt;y("os-textarea",ti);const Lu=v` ${S}:host{display:inline-flex;max-width:100%;vertical-align:middle}:host( [ hidden ] ){display:none}.os-chip{display:inline-flex;align-items:center;gap:var( --os-ui-chip-gap,4px );padding:var( --os-ui-chip-padding,2px 8px );border-radius:var( --os-ui-chip-radius,999px );font-size:var( --os-ui-chip-font-size,12px );line-height:var( --os-ui-chip-line-height,1.6 );font-weight:var( --os-ui-chip-font-weight,500 );background:var( --os-ui-chip-bg,var( --os-ui-surface,#f0f0f1 ) );color:var( --os-ui-chip-fg,var( --os-ui-fg,#1d2327 ) );border:var( --os-ui-chip-border,1px solid transparent );max-width:100%;box-sizing:border-box;transition:background-color 0.12s ease,color 0.12s ease,border-color 0.12s ease,transform 0.12s ease,opacity 0.12s ease}:host( [ tone='accent' ] ) .os-chip{background:var( --os-ui-chip-bg,color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 14%,transparent ) );color:var( --os-ui-chip-fg,var( --wp-admin-theme-color,#2271b1 ) )}:host( [ tone='positive' ] ) .os-chip{background:var( --os-ui-chip-bg,rgba( 30,132,73,0.14 ) );color:var( --os-ui-chip-fg,var( --os-ui-success-fg,#1d6f42 ) )}:host( [ tone='warning' ] ) .os-chip{background:var( --os-ui-chip-bg,rgba( 217,119,6,0.18 ) );color:var( --os-ui-chip-fg,var( --os-ui-warning-fg,#8a4a06 ) )}:host( [ tone='danger' ] ) .os-chip{background:var( --os-ui-chip-bg,rgba( 214,54,56,0.14 ) );color:var( --os-ui-chip-fg,var( --os-ui-danger-hover,#a02622 ) )}:host( [ pending ] ) .os-chip{opacity:0.65;animation:os-chip-pulse 1.2s ease-in-out infinite}@keyframes os-chip-pulse{0%,100%{opacity:0.55}50%{opacity:0.95}}.os-chip__label{max-width:var( --os-ui-chip-label-max,220px );overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.os-chip__icon{display:inline-flex;align-items:center;flex-shrink:0}.os-chip__icon::slotted( * ){display:inline-flex}.os-chip__dismiss{appearance:none;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:16px;height:16px;margin-inline-start:2px;padding:0;border:0;border-radius:50%;background:transparent;color:inherit;cursor:pointer;opacity:0.55;transition:opacity 0.12s ease,background-color 0.12s ease}.os-chip__dismiss:hover,.os-chip__dismiss:focus-visible{opacity:1;background:var( --os-ui-hover,rgba( 0,0,0,0.12 ) );outline:none}.os-chip__dismiss:focus-visible{box-shadow:var( --_holo-focus )}.os-chip__dismiss[ disabled ]{opacity:0.35;cursor:not-allowed}.os-chip__dismiss svg{display:block;width:14px;height:14px}:host( [ disabled ] ) .os-chip{opacity:0.55;cursor:not-allowed}:host( [ size='compact' ] ) .os-chip{padding:var( --os-ui-chip-padding,1px 6px );font-size:var( --os-ui-chip-font-size,11px )}:host( [ selected ] ) .os-chip{position:relative;background:var( --os-ui-chip-bg,var( --os-ui-accent-soft,rgba( 34,113,177,0.14 ) ) );color:var( --os-ui-chip-fg,var( --os-ui-fg,#1d2327 ) )}:host( [ selected ] ) .os-chip::after{content:'';position:absolute;inset:0;border-radius:inherit;padding:1px;background-image:var( --_holo-edge );pointer-events:none;-webkit-mask:linear-gradient( #000 0 0 ) content-box,linear-gradient( #000 0 0 );-webkit-mask-composite:xor;mask:linear-gradient( #000 0 0 ) content-box,linear-gradient( #000 0 0 );mask-composite:exclude}`,Nt=class Nt extends _{constructor(){super(...arguments),this._onHostKeyDown=e=>{if(this.dismissible!==null&&(e.key==="Backspace"||e.key==="Delete")){if(e.preventDefault(),this.disabled!==null)return;const i=this.label??"";this.emit("os-chip-dismiss",{label:i})}}}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this._onHostKeyDown)}disconnectedCallback(){this.removeEventListener("keydown",this._onHostKeyDown)}render(){const e=this.label??"",t=this.dismissible!==null,s=this.disabled!==null;return l`
1151 <span part="chip" class="os-chip">
1152 <span class="os-chip__icon">
1153 <slot name="icon"></slot>
1154 </span>
1155 <span class="os-chip__label">
1156 ${e===""?l`<slot></slot>`:e}
1157 </span>
1158 ${t?l`
1159 <button
1160 part="dismiss"
1161 class="os-chip__dismiss"
1162 type="button"
1163 aria-label=${`Remove ${e||"chip"}`}
1164 ?disabled=${s}
1165 @click=${i=>this._onDismiss(i)}
1166 >
1167 ${I("close",{size:null})}
1168 </button>
1169 `:l``}
1170 </span>
1171 `}_onDismiss(e){if(e.stopPropagation(),this.disabled!==null)return;const s=this.label??"";this.emit("os-chip-dismiss",{label:s})}};Nt.props=["label","tone","size","dismissible","disabled","pending","selected"],Nt.styles=[Lu],Nt.help=void 0;let si=Nt;y("os-chip",si);const Ru=v`:host{display:inline-flex;max-width:100%}.os-tag-input{display:inline-flex;flex-wrap:wrap;align-items:center;gap:var( --os-ui-tag-input-gap,4px );padding:var( --os-ui-tag-input-padding,2px );min-height:24px;max-width:100%}.os-tag-input__chips{display:inline-flex;flex-wrap:wrap;align-items:center;gap:var( --os-ui-tag-input-gap,4px );min-width:0}.os-tag-input__add{appearance:none;display:inline-flex;align-items:center;gap:3px;padding:1px 8px;min-height:22px;font:inherit;font-size:11px;font-weight:500;line-height:1;color:var( --os-ui-tag-input-add-fg,var( --os-ui-fg-muted,#50575e ) );background:transparent;border:1px dashed var( --os-ui-tag-input-add-border,var( --os-ui-border,#c3c4c7 ) );border-radius:999px;cursor:pointer;transition:background-color 0.12s ease,color 0.12s ease,border-color 0.12s ease}.os-tag-input__add:hover:not(:disabled ){background:var( --os-ui-hover,rgba( 0,0,0,0.04 ) );color:var( --os-ui-tag-input-add-fg-hover,var( --os-ui-fg,#1d2327 ) );border-color:var( --os-ui-tag-input-add-border-hover,var( --os-ui-border-strong,#8c8f94 ) )}.os-tag-input__add:focus-visible{outline:none;border-style:solid;box-shadow:var( --os-ui-focus-ring,0 0 0 2px rgba( 12,11,15,0.9 ),0 0 0 4px #2271b1 )}.os-tag-input__add:disabled{opacity:0.5;cursor:not-allowed}.os-tag-input__add svg{display:block}.os-tag-input__editor{position:relative;display:inline-flex;align-items:center;flex:0 1 auto;min-width:120px}.os-tag-input__input{appearance:none;font:inherit;font-size:var( --os-ui-field-font-size-compact,12px );line-height:1.4;padding:2px 8px;border:1px solid var( --os-ui-tag-input-input-border,var( --os-ui-border,#2271b1 ) );border-radius:999px;background:var( --os-ui-tag-input-input-bg,var( --os-ui-surface,#fff ) );color:var( --os-ui-tag-input-input-fg,var( --os-ui-fg,#1d2327 ) );min-width:80px;max-width:240px}.os-tag-input__input:focus{outline:none;border-color:var( --os-ui-accent,#2271b1 );box-shadow:var( --os-ui-focus-ring-field,0 0 0 1px #2271b1,0 0 0 4px rgba( 34,113,177,0.18 ) )}.os-tag-input__suggestions{position:absolute;top:calc( 100% + 4px );left:0;min-width:220px;max-width:320px;max-height:240px;overflow-y:auto;padding:4px 0;background:var( --os-ui-tag-input-pop-bg,var( --os-ui-surface,#fff ) );color:var( --os-ui-tag-input-pop-fg,var( --os-ui-fg,#1d2327 ) );border:1px solid var( --os-ui-tag-input-pop-border,var( --os-ui-border,#c3c4c7 ) );border-radius:8px;box-shadow:0 6px 16px rgba( 0,0,0,0.08 ),0 1px 2px rgba( 0,0,0,0.06 );z-index:50}.os-tag-input__suggestion-item{display:flex;align-items:center;gap:6px;padding:6px 12px;font-size:13px;cursor:pointer;user-select:none}.os-tag-input__suggestion-item[ aria-selected='true' ]{background:color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 10%,transparent );color:var( --wp-admin-theme-color,#2271b1 )}.os-tag-input__suggestion-create{font-style:italic;color:var( --os-ui-tag-input-create-fg,var( --os-ui-fg-muted,#50575e ) );border-top:1px solid var( --os-ui-tag-input-pop-divider,var( --os-ui-border,#f0f0f1 ) )}.os-tag-input__suggestion-create[ aria-selected='true' ]{color:var( --wp-admin-theme-color,#2271b1 )}.os-tag-input__suggestion-empty,.os-tag-input__suggestion-loading{display:flex;align-items:center;gap:8px;padding:8px 12px;font-size:12px;color:var( --os-ui-tag-input-pop-muted,var( --os-ui-fg-muted,#646970 ) )}.os-tag-input__suggestion-spinner{display:inline-block;width:10px;height:10px;border-radius:50%;border:2px solid currentColor;border-top-color:transparent;animation:os-tag-input-spin 0.8s linear infinite}@keyframes os-tag-input-spin{to{transform:rotate( 360deg )}}:host( [ disabled ] ) .os-tag-input{opacity:0.6;pointer-events:none}`,Pt=class Pt extends _{constructor(){super(...arguments),this._value=[],this._suggestions=[],this._suggestionsLoading=!1,this._query="",this._highlight=-1,this._focusedChip=-1,this._onDocumentPointerDown=e=>{!this.isOpen||e.composedPath().includes(this)||this.closeInput()}}get _input(){const e=this.shadowRoot;return e?e.querySelector(".os-tag-input__input"):null}get value(){return this._value}set value(e){this._value=Array.isArray(e)?e.slice():[],this._focusedChip>=this._value.length&&(this._focusedChip=-1),this.requestUpdate()}get suggestions(){return this._suggestions}set suggestions(e){this._suggestions=Array.isArray(e)?e.slice():[],this._highlight=this._suggestions.length>0?0:-1,this._suggestionsLoading=!1,this.requestUpdate()}get suggestionsLoading(){return this._suggestionsLoading}set suggestionsLoading(e){this._suggestionsLoading=!!e,this.requestUpdate()}get query(){return this._query}get isOpen(){return this.open!==null}openInput(){this.isOpen||(this.open="",this._query="",this._highlight=-1,this.emit("os-tag-open",{}),queueMicrotask(()=>{this._input?.focus(),this._emitSuggest("")}))}closeInput(){this.isOpen&&(this.open=null,this._query="",this._suggestions=[],this._highlight=-1,this._suggestionsLoading=!1,this.emit("os-tag-close",{}),this.requestUpdate())}connectedCallback(){super.connectedCallback(),document.addEventListener("pointerdown",this._onDocumentPointerDown,!0)}disconnectedCallback(){document.removeEventListener("pointerdown",this._onDocumentPointerDown,!0)}render(){const e=this.isOpen,t=this.disabled!==null,s=this.readonly!==null,i=this.removable!==null||this.removable===null&&!s,n=this.creatable!==null,r=this["add-label"]||"Add",a=this.placeholder||"Add a tag…";return l`
1172 <span
1173 class="os-tag-input"
1174 role="group"
1175 aria-label=${this.label??""}
1176 >
1177 ${this._renderChips(i,t)}
1178 ${this._renderTrailing({isOpen:e,readonly:s,disabled:t,placeholder:a,creatable:n,addLabel:r})}
1179 </span>
1180 `}_renderTrailing(e){return e.isOpen?this._renderEditor(e.placeholder,e.creatable):e.readonly||e.disabled?l``:this._renderTrigger(e.addLabel)}_renderChips(e,t){const s=this._value;return s.length===0?l``:l`
1181 <span class="os-tag-input__chips" role="list">
1182 ${s.map((i,n)=>{const r=i.tone??"neutral";return l`
1183 <os-chip
1184 role="listitem"
1185 size="compact"
1186 tone=${r}
1187 label=${i.label}
1188 ?dismissible=${e&&!t}
1189 ?disabled=${t}
1190 ?pending=${!!i.pending}
1191 tabindex=${n===this._focusedChip?"0":"-1"}
1192 data-idx=${String(n)}
1193 @os-chip-dismiss=${a=>this._onChipDismiss(a,i)}
1194 @focus=${()=>this._focusedChip=n}
1195 ></os-chip>
1196 `})}
1197 </span>
1198 `}_renderTrigger(e){const t=this.disabled!==null;return l`
1199 <button
1200 type="button"
1201 class="os-tag-input__add"
1202 aria-label=${e}
1203 aria-haspopup="listbox"
1204 aria-expanded="false"
1205 ?disabled=${t}
1206 @click=${()=>this.openInput()}
1207 >
1208 ${Iu()}
1209 <span>${e}</span>
1210 </button>
1211 `}_renderEditor(e,t){const s=this._suggestions.length>0||this._suggestionsLoading||t&&this._query.trim().length>0;return l`
1212 <span class="os-tag-input__editor">
1213 <input
1214 class="os-tag-input__input"
1215 type="text"
1216 autocomplete="off"
1217 autocapitalize="off"
1218 spellcheck="false"
1219 placeholder=${e}
1220 .value=${this._query}
1221 aria-autocomplete="list"
1222 aria-expanded=${s?"true":"false"}
1223 aria-activedescendant=${this._highlight>=0?`os-tag-suggestion-${this._highlight}`:""}
1224 @input=${i=>this._onInput(i)}
1225 @keydown=${i=>this._onInputKeyDown(i)}
1226 @blur=${i=>this._onInputBlur(i)}
1227 />
1228 ${s?this._renderSuggestions(t):l``}
1229 </span>
1230 `}_renderSuggestions(e){const t=this._query.trim(),s=this._suggestions,i=e&&t.length>0&&!s.some(n=>n.label.toLowerCase()===t.toLowerCase())&&!this._value.some(n=>n.label.toLowerCase()===t.toLowerCase());return l`
1231 <div
1232 class="os-tag-input__suggestions"
1233 role="listbox"
1234 >
1235 ${this._suggestionsLoading?l`
1236 <div class="os-tag-input__suggestion-loading">
1237 <span class="os-tag-input__suggestion-spinner" aria-hidden="true"></span>
1238 <span>Searching…</span>
1239 </div>
1240 `:l``}
1241 ${s.length===0&&!this._suggestionsLoading&&!i?l`
1242 <div class="os-tag-input__suggestion-empty">
1243 ${t.length>0?"No matches.":"Type to search."}
1244 </div>
1245 `:l``}
1246 ${s.map((n,r)=>{const a=r===this._highlight;return l`
1247 <div
1248 id=${`os-tag-suggestion-${r}`}
1249 role="option"
1250 aria-selected=${a?"true":"false"}
1251 class="os-tag-input__suggestion-item"
1252 @mousedown=${c=>{c.preventDefault(),this._addSuggestion(n,!1)}}
1253 @mouseenter=${()=>{this._highlight=r,this.requestUpdate()}}
1254 >
1255 <span>${n.label}</span>
1256 </div>
1257 `})}
1258 ${i?l`
1259 <div
1260 id=${`os-tag-suggestion-${s.length}`}
1261 role="option"
1262 aria-selected=${this._highlight===s.length?"true":"false"}
1263 class="os-tag-input__suggestion-item os-tag-input__suggestion-create"
1264 @mousedown=${n=>{n.preventDefault(),this._addSuggestion({label:t},!0)}}
1265 @mouseenter=${()=>{this._highlight=s.length,this.requestUpdate()}}
1266 >
1267 Create "${t}"
1268 </div>
1269 `:l``}
1270 </div>
1271 `}_onChipDismiss(e,t){e.stopPropagation(),this.emit("os-tag-remove",{tag:t})}_onInput(e){const t=e.target.value;this._query=t,this._emitSuggest(t)}_emitSuggest(e){const t=parseInt(this["min-query"]||"0",10)||0;if(e.length<t){this._suggestions=[],this._suggestionsLoading=!1,this.requestUpdate();return}this._suggestionsLoading=!0,this.requestUpdate(),this.emit("os-tag-suggest",{query:e})}_onInputKeyDown(e){const t=this.creatable!==null,s=this._suggestions,i=this._query.trim(),n=t&&i.length>0&&!s.some(a=>a.label.toLowerCase()===i.toLowerCase())&&!this._value.some(a=>a.label.toLowerCase()===i.toLowerCase()),r=s.length+(n?1:0);switch(e.key){case"ArrowDown":{if(r===0)return;e.preventDefault(),this._highlight=this._highlight+1>=r?0:this._highlight+1,this.requestUpdate();return}case"ArrowUp":{if(r===0)return;e.preventDefault(),this._highlight=this._highlight<=0?r-1:this._highlight-1,this.requestUpdate();return}case"Enter":{if(e.preventDefault(),this._highlight>=0&&this._highlight<s.length){this._addSuggestion(s[this._highlight],!1);return}if(this._highlight===s.length&&n){this._addSuggestion({label:i},!0);return}if(n&&i.length>0){this._addSuggestion({label:i},!0);return}return}case"Escape":{e.preventDefault(),this.closeInput();return}case"Backspace":{if(this._query===""&&this._value.length>0){e.preventDefault();const a=this._value.length-1;this._focusedChip===a?(this.emit("os-tag-remove",{tag:this._value[a]}),this._focusedChip=-1):(this._focusedChip=a,this.requestUpdate())}return}default:this._focusedChip!==-1&&(this._focusedChip=-1)}}_onInputBlur(e){queueMicrotask(()=>{this.shadowRoot?.activeElement||this.closeInput()})}_addSuggestion(e,t){if(this._value.some(i=>i.label.toLowerCase()===e.label.toLowerCase())){this._query="",this._highlight=-1,this._suggestions=[],this.requestUpdate(),this._input?.focus();return}this.emit("os-tag-add",{tag:e,isNew:t}),this._query="",this._highlight=-1,this._suggestions=[],this._suggestionsLoading=!1,this.requestUpdate(),queueMicrotask(()=>{this._input?.focus()})}};Pt.props=["label","placeholder","add-label","creatable","removable","disabled","readonly","size","min-query","open"],Pt.styles=[Ru],Pt.help=void 0;let oi=Pt;y("os-tag-input",oi);function Iu(){return I("plus",{size:14})}const Du=v`:host{display:block;container-type:inline-size;container-name:os-form;font-size:13px;color:var( --os-ui-fg,#1d2327 )}:host( [ hidden ] ){display:none}.header{margin:0 0 18px}.header:empty{display:none}.fields{display:grid;grid-template-columns:1fr;gap:14px 16px;margin:0 0 18px}@container os-form ( min-width:480px ){.fields{grid-template-columns:repeat( 2,minmax( 0,1fr ) )}}@container os-form ( min-width:760px ){:host( [ columns="3" ] ) .fields{grid-template-columns:repeat( 3,minmax( 0,1fr ) )}}:host( [ columns="1" ] ) .fields{grid-template-columns:1fr}:host( [ columns="2" ] ) .fields{grid-template-columns:repeat( 2,minmax( 0,1fr ) )}::slotted( [ full-width ] ){grid-column:1 / -1}::slotted( [ slot ] ){display:contents}.error{margin:0 0 14px;padding:10px 12px;border-radius:6px;background:var( --os-ui-notice-error-bg,rgba( 179,45,46,0.10 ) );color:var( --os-ui-danger-hover,#b32d2e );font-size:13px;line-height:1.4}.error[ hidden ]{display:none}.footer{display:flex;flex-wrap:wrap;gap:8px;align-items:center;justify-content:flex-end;border-top:1px solid var( --os-ui-border,#dcdcde );padding-top:14px}:host( [ align="start" ] ) .footer{justify-content:flex-start}:host( [ align="stretch" ] ) .footer{justify-content:stretch}:host( [ align="stretch" ] ) .footer .footer-actions{flex:1 1 auto}.footer-leading,.footer-trailing{display:contents}.footer-actions{display:inline-flex;gap:8px;align-items:center;margin-inline-start:auto}:host( [ align="start" ] ) .footer-actions{margin-inline-start:0}:host( [ busy ] ){pointer-events:none}:host( [ busy ] ) .fields{opacity:0.6}:host( [ busy ] ) .footer{pointer-events:auto}.busy-spinner{display:inline-flex;width:14px;height:14px;border-radius:50%;border:2px solid currentColor;border-right-color:transparent;animation:os-form-spin 0.7s linear infinite;vertical-align:-2px;margin-inline-end:6px}@keyframes os-form-spin{to{transform:rotate( 360deg )}}@media ( prefers-reduced-motion:reduce ){.busy-spinner{animation-duration:2s}}`,zt=class zt extends _{constructor(){super(...arguments),this._initial=new Map,this._captured=!1,this._fieldChangeListener=null,this._enterSubmitListener=null}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this._captureInitialValues()),this._fieldChangeListener=e=>this._onAnyFieldInput(e),this.addEventListener("os-input-change",this._fieldChangeListener),this.addEventListener("os-input-commit",this._fieldChangeListener),this.addEventListener("os-checkbox-change",this._fieldChangeListener),this.addEventListener("os-select-change",this._fieldChangeListener),this.addEventListener("change",this._fieldChangeListener),this._enterSubmitListener=()=>this.submit(),this.addEventListener("os-submit",this._enterSubmitListener)}disconnectedCallback(){this._fieldChangeListener&&(this.removeEventListener("os-input-change",this._fieldChangeListener),this.removeEventListener("os-input-commit",this._fieldChangeListener),this.removeEventListener("os-checkbox-change",this._fieldChangeListener),this.removeEventListener("os-select-change",this._fieldChangeListener),this.removeEventListener("change",this._fieldChangeListener),this._fieldChangeListener=null),this._enterSubmitListener&&(this.removeEventListener("os-submit",this._enterSubmitListener),this._enterSubmitListener=null)}render(){const e=this["submit-label"]||"Submit",t=this["reset-label"]||"Reset",s=this.error||"",i=this.busy!==null,r=this["show-reset"]!=="false";return l`
1272 <div class="header" part="header">
1273 <slot name="header"></slot>
1274 </div>
1275 <div class="fields" part="fields">
1276 <slot></slot>
1277 </div>
1278 <slot name="error">
1279 ${s?l`<p class="error" role="alert" part="error">${s}</p>`:l`<p class="error" role="alert" part="error" hidden></p>`}
1280 </slot>
1281 <footer class="footer" part="footer">
1282 <span class="footer-leading"
1283 ><slot name="footer-leading"></slot
1284 ></span>
1285 <span class="footer-actions">
1286 ${r?l`<os-button
1287 variant="ghost"
1288 data-os-form-action="reset"
1289 ?disabled=${i}
1290 @click=${()=>this.reset()}
1291 >${t}</os-button>`:l``}
1292 <os-button
1293 variant="primary"
1294 data-os-form-action="submit"
1295 ?disabled=${i}
1296 @click=${()=>this.submit()}
1297 >
1298 ${i?l`<span class="busy-spinner" aria-hidden="true"></span>`:l``}
1299 ${e}
1300 </os-button>
1301 </span>
1302 <span class="footer-trailing"
1303 ><slot name="footer-trailing"></slot
1304 ></span>
1305 </footer>
1306 `}getValues(){const e={};for(const t of this._namedFields()){const s=t.getAttribute("name");s&&(e[s]=this._readField(t))}return e}setValues(e){for(const[t,s]of Object.entries(e)){const i=this._fieldByName(t);i&&this._writeField(i,s)}}setBusy(e){e?this.setAttribute("busy",""):this.removeAttribute("busy")}setError(e){e?this.setAttribute("error",e):this.removeAttribute("error")}setFieldInvalid(e,t=!0,s=null){const i=this._fieldByName(e);i&&(t?(i.setAttribute("invalid",""),s!==null&&i.setAttribute("error",s)):(i.removeAttribute("invalid"),i.removeAttribute("error")))}clearErrors(){this.setError(null);for(const e of this._namedFields())e.removeAttribute("invalid"),e.removeAttribute("error")}reset(){this.clearErrors();for(const[e,t]of this._initial.entries()){const s=this._fieldByName(e);if(s){if(t.checked!==null){s.checked=t.checked,t.checked?s.setAttribute("checked",""):s.removeAttribute("checked");continue}this._writeField(s,t.value)}}this.dispatchEvent(new CustomEvent("os-form-reset",{bubbles:!0,composed:!0,detail:{form:this}}))}submit(){const e=[];for(const i of this._namedFields()){const n=i.getAttribute("name");if(!n||!i.hasAttribute("required"))continue;const a=this._readField(i);if(a==null||a===""||Array.isArray(a)&&a.length===0){i.setAttribute("invalid","");const u=i.getAttribute("label");e.push(u||n)}}if(e.length>0){const i=e.join(", ");this.setError(`Required: ${i}`);return}const t=this.getValues(),s=new CustomEvent("os-form-submit",{bubbles:!0,composed:!0,cancelable:!0,detail:{values:t,form:this}});this.dispatchEvent(s)}_captureInitialValues(){if(this._captured)return;const e=this._namedFields();if(e.length!==0){for(const t of e){const s=t.getAttribute("name");if(!s)continue;const i=t.tagName==="OS-CHECKBOX"||t.tagName==="OS-CHECKBOX-LABEL"||t.tagName==="INPUT"&&t.type==="checkbox";this._initial.set(s,{value:this._readField(t),checked:i?!!t.checked:null})}this._captured=!0}}_namedFields(){return Array.from(this.querySelectorAll("[name]"))}_fieldByName(e){const t=typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/["\\]/g,"\\$&");return this.querySelector(`[name="${t}"]`)}_readField(e){const t=e.tagName.toUpperCase();return t==="OS-CHECKBOX"||t==="OS-CHECKBOX-LABEL"||t==="INPUT"&&e.type==="checkbox"?typeof e.checked=="boolean"?e.checked:e.hasAttribute("checked"):e.value!==void 0&&e.value!==null?e.value:e.getAttribute("value")??""}_writeField(e,t){const s=e.tagName.toUpperCase();if(s==="OS-CHECKBOX"||s==="OS-CHECKBOX-LABEL"||s==="INPUT"&&e.type==="checkbox"){const r=!!t;e.checked=r,r?e.setAttribute("checked",""):e.removeAttribute("checked");return}const n=t==null?"":String(t);e.value=n,e.setAttribute("value",n)}_onAnyFieldInput(e){const t=e.target;if(!t)return;const s=t.getAttribute?.("name");s&&(this.dispatchEvent(new CustomEvent("os-form-input",{bubbles:!0,composed:!0,detail:{name:s,value:this._readField(t),form:this}})),t.hasAttribute("invalid")&&t.removeAttribute("invalid"))}};zt.props=["submit-label","reset-label","error","busy","columns","min-column","show-reset","align"],zt.styles=[Du],zt.help=void 0;let ii=zt;y("os-form",ii);const Tu=v`:host{display:inline-flex;align-items:center;gap:6px;font-size:var( --os-ui-save-status-font-size,11px );line-height:1;color:var( --os-ui-save-status-fg,currentColor );vertical-align:middle;min-width:0;opacity:1;pointer-events:auto}.os-save-status__indicator{display:inline-flex;align-items:center;justify-content:center;width:var( --os-ui-save-status-size,12px );height:var( --os-ui-save-status-size,12px );border-radius:50%;flex-shrink:0;box-sizing:border-box;background:var( --os-ui-save-status-bg,transparent );border:2px solid var( --os-ui-save-status-idle-color,color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 55%,transparent ) );color:var( --wp-admin-theme-color,#2271b1 );transition:background-color 0.2s ease,border-color 0.2s ease,box-shadow 0.2s ease}:host( [ phase='pending' ] ) .os-save-status__indicator,:host( [ phase='saving' ] ) .os-save-status__indicator{background:var( --os-ui-save-status-bg,var( --wp-admin-theme-color,#2271b1 ) );border-color:transparent;color:var( --wp-admin-theme-color,#2271b1 );animation:os-save-status-pulse 1.2s ease-in-out infinite}:host( [ animation='modem' ][ phase='pending' ] ) .os-save-status__indicator,:host( [ animation='modem' ][ phase='saving' ] ) .os-save-status__indicator{background:var( --os-ui-save-status-bg,var( --wp-admin-theme-color,#2271b1 ) );border-color:transparent;color:var( --wp-admin-theme-color,#2271b1 );animation:os-save-status-modem-stutter 1.8s ease-in-out infinite,os-save-status-modem-glow 2.4s ease-in-out infinite}@keyframes os-save-status-modem-stutter{0%,4%{opacity:1}5%,30%{opacity:0.22}31%,36%{opacity:1}37%,39%{opacity:0.22}40%,44%{opacity:1}45%,67%{opacity:0.22}68%,76%{opacity:1}77%,100%{opacity:0.22}}@keyframes os-save-status-modem-glow{0%,12%{box-shadow:0 0 0 0 transparent}13%,22%{box-shadow:0 0 4px 0 currentColor}23%,50%{box-shadow:0 0 0 0 transparent}51%,58%{box-shadow:0 0 4px 0 currentColor}59%,84%{box-shadow:0 0 0 0 transparent}85%,94%{box-shadow:0 0 5px 0 currentColor}95%,100%{box-shadow:0 0 0 0 transparent}}@media ( prefers-reduced-motion:reduce ){:host( [ phase='pending' ] ) .os-save-status__indicator,:host( [ phase='saving' ] ) .os-save-status__indicator,:host( [ animation='modem' ][ phase='pending' ] ) .os-save-status__indicator,:host( [ animation='modem' ][ phase='saving' ] ) .os-save-status__indicator{animation:none;opacity:0.85}}:host( [ phase='saved' ] ) .os-save-status__indicator{background:var( --os-ui-save-status-saved-bg,var( --os-ui-success-fg,#1d6f42 ) );border-color:transparent;color:var( --os-ui-save-status-saved-bg,var( --os-ui-success-fg,#1d6f42 ) )}:host( [ phase='failed' ] ) .os-save-status__indicator{background:var( --os-ui-save-status-failed-bg,var( --os-ui-danger,#d63638 ) );border-color:transparent;color:var( --os-ui-save-status-failed-bg,var( --os-ui-danger,#d63638 ) );animation:os-save-status-pulse 0.8s ease-in-out 2}:host( [ variant='ring' ] ) .os-save-status__indicator{background:transparent}:host( [ variant='ring' ][ phase='pending' ] ) .os-save-status__indicator,:host( [ variant='ring' ][ phase='saving' ] ) .os-save-status__indicator{background:transparent;border-color:var( --os-ui-save-status-ring-color,var( --os-ui-save-status-bg,var( --wp-admin-theme-color,#2271b1 ) ) );animation:os-save-status-ring-pulse 1.6s var( --os-ui-ease-loop,ease-in-out ) infinite}:host( [ variant='ring' ][ phase='failed' ] ) .os-save-status__indicator{background:transparent;border-color:var( --os-ui-save-status-failed-bg,var( --os-ui-danger,#d63638 ) );animation:os-save-status-ring-alert 0.62s var( --os-ui-ease-out,ease-out ) 1}:host( [ variant='ring' ][ phase='failed' ] ) .os-save-status__glyph{color:var( --os-ui-save-status-failed-bg,var( --os-ui-danger,#d63638 ) )}:host( [ variant='ring' ][ phase='saved' ] ) .os-save-status__indicator{background:var( --os-ui-save-status-saved-bg,var( --wp-admin-theme-color,#2271b1 ) );border-color:transparent;animation:os-save-status-ring-land 0.42s var( --os-ui-ease-out,ease-out ) 1}:host( [ variant='ring' ][ phase='saved' ] ) .os-save-status__glyph,:host( [ variant='ring' ][ phase='failed' ] ) .os-save-status__glyph{animation:os-save-status-glyph-in 0.24s var( --os-ui-ease-out,ease-out ) 0.08s 1 backwards}@keyframes os-save-status-ring-pulse{0%,100%{opacity:0.45;scale:0.9}50%{opacity:1;scale:1}}@keyframes os-save-status-ring-land{0%{scale:0.82}55%{scale:1.06}100%{scale:1}}@keyframes os-save-status-ring-alert{0%{scale:0.9}25%{scale:1.08}50%{scale:0.98}75%{scale:1.04}100%{scale:1}}@keyframes os-save-status-glyph-in{0%{opacity:0;scale:0.4}100%{opacity:1;scale:1}}@media ( prefers-reduced-motion:reduce ){:host( [ variant='ring' ] ) .os-save-status__indicator,:host( [ variant='ring' ] ) .os-save-status__glyph{animation:none;opacity:1;scale:1}}@keyframes os-save-status-pulse{0%,100%{opacity:0.55;transform:scale( 0.9 )}50%{opacity:1;transform:scale( 1 )}}:host( [ mode='pill' ] ) .os-save-status{display:inline-flex;align-items:center;gap:6px;padding:2px 10px;border-radius:999px;background:var( --os-ui-save-status-pill-bg,transparent );font-weight:500;white-space:nowrap}:host( [ mode='pill' ][ phase='saving' ] ) .os-save-status,:host( [ mode='pill' ][ phase='pending' ] ) .os-save-status{background:var( --os-ui-save-status-pill-bg,var( --os-ui-hover,rgba( 0,0,0,0.04 ) ) );color:var( --os-ui-save-status-pill-fg,var( --os-ui-fg-muted,#50575e ) )}:host( [ mode='pill' ][ phase='saved' ] ) .os-save-status{background:var( --os-ui-save-status-pill-bg,rgba( 30,132,73,0.12 ) );color:var( --os-ui-save-status-pill-fg,var( --os-ui-success-fg,#1d6f42 ) )}:host( [ mode='pill' ][ phase='failed' ] ) .os-save-status{background:var( --os-ui-save-status-pill-bg,rgba( 214,54,56,0.12 ) );color:var( --os-ui-save-status-pill-fg,var( --os-ui-danger-hover,#a02622 ) )}.os-save-status__label{min-width:0;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host( [ phase='saved' ] ) .os-save-status__glyph,:host( [ phase='failed' ] ) .os-save-status__glyph{display:inline-block;color:var( --os-ui-fg-on-accent,#fff );width:calc( var( --os-ui-save-status-size,12px ) * 0.66 );height:calc( var( --os-ui-save-status-size,12px ) * 0.66 )}.os-save-status__glyph{display:none}.os-save-status__glyph svg{display:block;width:100%;height:100%}`,$r="os-settings-save-lifecycle",Nu=2200,Pu=6e3,Mt=class Mt extends _{constructor(){super(...arguments),this._autoTimer=null,this._docListener=null}connectedCallback(){super.connectedCallback(),this.auto!==null&&this._installAutoListener()}disconnectedCallback(){this._removeAutoListener(),this._autoTimer!==null&&(window.clearTimeout(this._autoTimer),this._autoTimer=null)}attributeChangedCallback(e,t,s){if(super.attributeChangedCallback(e,t,s),(e==="auto"||e==="event")&&(this._removeAutoListener(),this.auto!==null&&this._installAutoListener()),e==="phase"){this._scheduleAutoClear();const i={phase:this.phase??"idle",error:this.error??void 0};this.emit("os-save-status-change",i)}}render(){const e=this.phase??"idle",t=this.mode??"dot",i=(this.error??"")||this._labelForPhase(e);return i?this.setAttribute("title",i):this.removeAttribute("title"),this.setAttribute("aria-live",e==="failed"?"assertive":"polite"),this.setAttribute("role",e==="failed"?"alert":"status"),l`
1307 <span class="os-save-status">
1308 <span class="os-save-status__indicator" aria-hidden="true">
1309 <span class="os-save-status__glyph">${this._renderGlyph(e)}</span>
1310 </span>
1311 ${t==="pill"?l`<span class="os-save-status__label"
1312 >${this._labelForPhase(e)}</span
1313 >`:l``}
1314 </span>
1315 `}_renderGlyph(e){return e==="saved"?zu():e==="failed"?Mu():""}_labelForPhase(e){switch(e){case"pending":case"saving":return this["saving-label"]??"Saving…";case"saved":return this["saved-label"]??"Saved";case"failed":return(this.error??"")||"Couldn’t save";default:return this["idle-label"]??""}}_installAutoListener(){const e=this.event||$r;this._docListener=t=>{const s=t.detail;!s||typeof s.phase!="string"||(this.phase=s.phase,s.error?this.error=s.error:s.phase!=="failed"&&this.error&&this.removeAttribute("error"))},document.addEventListener(e,this._docListener)}_removeAutoListener(){if(!this._docListener)return;const e=this.event||$r;document.removeEventListener(e,this._docListener),this._docListener=null}_scheduleAutoClear(){this._autoTimer!==null&&(window.clearTimeout(this._autoTimer),this._autoTimer=null);const e=this.phase??"idle",t=this._autoClearMsFor(e);t<=0||(this._autoTimer=window.setTimeout(()=>{this._autoTimer=null,this.phase="idle"},t))}_autoClearMsFor(e){if(e==="saved"){const t=this["auto-clear-saved-ms"];return parseInt(t||"",10)||Nu}if(e==="failed"){const t=this["auto-clear-failed-ms"];return parseInt(t||"",10)||Pu}return 0}};Mt.props=["phase","mode","variant","animation","auto","event","error","saving-label","saved-label","idle-label","auto-clear-saved-ms","auto-clear-failed-ms"],Mt.styles=[Tu],Mt.help=void 0;let ni=Mt;y("os-save-status",ni);function zu(){return l`
1316 <svg
1317 viewBox="0 0 12 12"
1318 aria-hidden="true"
1319 focusable="false"
1320 fill="none"
1321 stroke="currentColor"
1322 stroke-width="2"
1323 stroke-linecap="round"
1324 stroke-linejoin="round"
1325 >
1326 <path d="M2.5 6 L5 8.5 L9.5 4" />
1327 </svg>
1328 `}function Mu(){return l`
1329 <svg
1330 viewBox="0 0 12 12"
1331 aria-hidden="true"
1332 focusable="false"
1333 fill="currentColor"
1334 >
1335 <path
1336 d="M5 2 H7 V7 H5 z M5 8.5 H7 V10.5 H5 z"
1337 />
1338 </svg>
1339 `}const Ou=v`:host{display:flex;width:100%;min-width:0;max-width:100%;align-items:stretch}.os-cat{display:flex;flex-direction:column;align-items:stretch;gap:4px;padding:var( --os-ui-cat-padding,2px );min-height:24px;max-width:100%;width:100%}.os-cat__chips{display:inline-flex;flex-wrap:wrap;align-items:center;gap:var( --os-ui-cat-gap,4px );min-width:0}.os-cat__chains{display:flex;flex-wrap:wrap;gap:4px;min-width:0}.os-cat__viz-host{display:flex;align-items:center;gap:4px;min-width:0;flex:1 1 auto;max-width:100%;min-height:28px;cursor:pointer;position:relative}.os-cat__viz-svg{display:block;width:100%;max-width:100%;min-width:0;overflow:visible;flex:1 1 auto}.os-cat__viz-svg .os-cat-edge{fill:none;stroke:var( --os-ui-cat-edge-color,currentColor );stroke-width:1.25;stroke-linecap:round;opacity:0.55;transition:stroke-width 0.18s ease,opacity 0.18s ease}.os-cat__viz-svg .os-cat-edge[ data-active='true' ]{stroke-width:2;opacity:1}.os-cat__viz-svg .os-cat-node{cursor:pointer;transition:r 0.2s cubic-bezier( 0.34,1.56,0.64,1 ),fill 0.18s ease,stroke-width 0.18s ease,filter 0.18s ease}.os-cat__viz-svg .os-cat-node[ data-selected='true' ]{filter:drop-shadow( 0 0 6px var( --os-ui-cat-node-glow,rgba( 0,0,0,0.18 ) ) )}.os-cat__viz-svg .os-cat-node:hover,.os-cat__viz-svg .os-cat-node:focus-visible{filter:drop-shadow( 0 0 8px var( --os-ui-cat-node-glow,rgba( 0,0,0,0.3 ) ) );outline:none}.os-cat__viz-svg .os-cat-label{font-family:var( --os-ui-font,system-ui,sans-serif );font-size:10.5px;fill:var( --os-ui-cat-label-fg,var( --os-ui-fg,#1d2327 ) );font-weight:500;pointer-events:none;user-select:none}.os-cat__viz-svg .os-cat-label[ data-selected='false' ]{fill:var( --os-ui-cat-label-muted,var( --os-ui-fg-muted,#8c8f94 ) );font-weight:400;font-style:italic}.os-cat__trigger{appearance:none;display:inline-flex;align-items:center;gap:4px;padding:1px 8px;min-height:22px;font:inherit;font-size:11px;font-weight:500;line-height:1;color:var( --os-ui-cat-trigger-fg,var( --os-ui-fg-muted,#50575e ) );background:transparent;border:1px dashed var( --os-ui-cat-trigger-border,var( --os-ui-border,#c3c4c7 ) );border-radius:999px;cursor:pointer;transition:background-color 0.12s ease,color 0.12s ease,border-color 0.12s ease}.os-cat__trigger:hover:not(:disabled ){background:var( --os-ui-hover,rgba( 0,0,0,0.04 ) );color:var( --os-ui-cat-trigger-fg-hover,var( --os-ui-fg,#1d2327 ) );border-color:var( --os-ui-cat-trigger-border-hover,var( --os-ui-border-strong,#8c8f94 ) )}.os-cat__trigger:focus-visible{outline:none;border-style:solid;box-shadow:0 0 0 2px var( --wp-admin-theme-color,#2271b1 )}.os-cat__trigger svg{display:block}.os-cat__uncategorized{display:inline-flex;align-items:center;gap:4px;padding:1px 10px;min-height:22px;font-size:11px;font-weight:500;line-height:1.6;color:var( --os-ui-cat-uncat-fg,var( --os-ui-fg-muted,#8c8f94 ) );background:transparent;border:1px dashed var( --os-ui-cat-uncat-border,var( --os-ui-border,#c3c4c7 ) );border-radius:999px;font-style:italic}.os-cat__popover{position:fixed;top:0;left:0;min-width:280px;max-width:360px;max-height:360px;display:flex;flex-direction:column;background:var( --os-ui-cat-pop-bg,var( --os-ui-surface,#fff ) );color:var( --os-ui-cat-pop-fg,var( --os-ui-fg,#1d2327 ) );border:1px solid var( --os-ui-cat-pop-border,var( --os-ui-border,#c3c4c7 ) );border-radius:8px;box-shadow:0 6px 16px rgba( 0,0,0,0.08 ),0 1px 2px rgba( 0,0,0,0.06 );z-index:1000}.os-cat__editor{position:relative;display:inline-flex;align-items:center}.os-cat__search{appearance:none;font:inherit;font-size:13px;padding:8px 12px;border:0;border-bottom:1px solid var( --os-ui-cat-pop-divider,var( --os-ui-border,#f0f0f1 ) );background:transparent;color:inherit;outline:none}.os-cat__search:focus{border-bottom-color:var( --wp-admin-theme-color,#2271b1 )}.os-cat__tree{flex:1 1 auto;min-height:0;overflow-y:auto;padding:4px 0}.os-cat__row-block{display:contents}.os-cat__row{display:flex;align-items:center;gap:6px;padding:4px 8px 4px var( --os-ui-cat-row-indent,12px );cursor:pointer;user-select:none;font-size:13px;line-height:1.4;position:relative}.os-cat__row:hover,.os-cat__row[ data-focused='true' ]{background:var( --os-ui-hover,rgba( 0,0,0,0.04 ) )}.os-cat__row[ data-selected='true' ]{color:var( --wp-admin-theme-color,#2271b1 );font-weight:600}.os-cat__row::before{content:'';position:absolute;left:0;top:0;bottom:0;width:var( --os-ui-cat-guide-width,0px );border-left:1px dotted var( --os-ui-cat-guide-color,var( --os-ui-border,rgba( 0,0,0,0.08 ) ) )}.os-cat__expander{display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;border:0;background:transparent;color:inherit;cursor:pointer;flex-shrink:0;opacity:0.65}.os-cat__expander:hover{opacity:1}.os-cat__expander svg{display:block;transition:transform 0.12s ease}.os-cat__row[ data-expanded='true' ] .os-cat__expander svg{transform:rotate( 90deg )}.os-cat__expander--placeholder{visibility:hidden}.os-cat__create-row{display:flex;align-items:center;padding:2px 8px 2px var( --os-ui-cat-row-indent,28px );position:relative}.os-cat__create-row::before{content:'';position:absolute;left:0;top:0;bottom:0;width:var( --os-ui-cat-guide-width,0px );border-left:1px dotted var( --os-ui-cat-guide-color,var( --os-ui-border,rgba( 0,0,0,0.08 ) ) )}.os-cat__create-wrap{display:inline-flex;align-items:center;flex:1 1 auto;min-width:0;gap:4px;padding:1px 1px 1px 0;border:1px solid transparent;border-radius:6px;background:transparent;transition:border-color 0.12s ease,background-color 0.12s ease,box-shadow 0.12s ease}.os-cat__create-wrap:hover{border-color:var( --os-ui-border,rgba( 0,0,0,0.12 ) );background:var( --os-ui-cat-pop-bg,var( --os-ui-surface,#fff ) )}.os-cat__create-wrap:focus-within{border-color:var( --wp-admin-theme-color,#2271b1 );background:var( --os-ui-cat-pop-bg,var( --os-ui-surface,#fff ) );box-shadow:0 0 0 2px color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 15%,transparent )}.os-cat__create-input{flex:1 1 auto;min-width:0;appearance:none;font:inherit;font-size:var( --os-ui-field-font-size-compact,12px );padding:3px 6px;border:0;background:transparent;color:inherit;outline:none}.os-cat__create-input::placeholder{color:var( --os-ui-cat-pop-muted,var( --os-ui-fg-muted,#8c8f94 ) );font-style:italic;opacity:1}.os-cat__create-submit{appearance:none;display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;flex-shrink:0;padding:0;border:0;border-radius:4px;background:transparent;color:var( --os-ui-cat-pop-muted,var( --os-ui-fg-muted,#8c8f94 ) );cursor:pointer;transition:background-color 0.12s ease,color 0.12s ease}.os-cat__create-wrap:focus-within .os-cat__create-submit:not( [ disabled ] ){background:var( --wp-admin-theme-color,#2271b1 );color:var( --os-ui-fg-on-accent,#fff )}.os-cat__create-submit:hover:not( [ disabled ] ){filter:brightness( 1.05 )}.os-cat__create-submit[ disabled ]{cursor:default;opacity:0.5}.os-cat__create-submit svg{display:block}.os-cat__create-spinner{display:inline-block;width:12px;height:12px;margin:0 4px;border-radius:50%;border:2px solid var( --wp-admin-theme-color,#2271b1 );border-top-color:transparent;animation:os-cat-spin 0.8s linear infinite;flex-shrink:0}.os-cat__check{display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex-shrink:0;border:1.5px solid var( --os-ui-cat-check-border,var( --os-ui-border,#8c8f94 ) );border-radius:3px;color:transparent;transition:background-color 0.12s ease,border-color 0.12s ease,color 0.12s ease}.os-cat__row[ data-selected='true' ] .os-cat__check{background:var( --wp-admin-theme-color,#2271b1 );border-color:var( --wp-admin-theme-color,#2271b1 );color:var( --os-ui-fg-on-accent,#fff )}.os-cat__check svg{display:block;width:14px;height:14px}.os-cat__label{min-width:0;flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.os-cat__delete{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;width:18px;height:18px;border:0;border-radius:50%;padding:0;background:transparent;color:var( --os-ui-cat-delete-color,var( --os-ui-danger,#d63638 ) );cursor:pointer;opacity:0;transition:opacity 0.12s ease,background-color 0.12s ease}.os-cat__row:hover .os-cat__delete,.os-cat__row[ data-focused='true' ] .os-cat__delete,.os-cat__delete:focus-visible{opacity:1}.os-cat__delete:hover,.os-cat__delete:focus-visible{background:var( --os-ui-badge-danger-bg,rgba( 214,54,56,0.12 ) )}.os-cat__delete svg{display:block;width:14px;height:14px}.os-cat__match{background:var( --os-ui-search-highlight-bg,rgba( 252,211,77,0.45 ) );border-radius:2px;padding:0 1px}.os-cat__empty,.os-cat__loading{padding:12px;font-size:12px;color:var( --os-ui-cat-pop-muted,var( --os-ui-fg-muted,#646970 ) );text-align:center}.os-cat__loading-spinner{display:inline-block;width:12px;height:12px;border-radius:50%;border:2px solid currentColor;border-top-color:transparent;animation:os-cat-spin 0.8s linear infinite;margin-inline-end:8px;vertical-align:middle}@keyframes os-cat-spin{to{transform:rotate( 360deg )}}.os-cat__footer{padding:8px 12px;font-size:11px;color:var( --os-ui-cat-pop-muted,var( --os-ui-fg-muted,#646970 ) );border-top:1px solid var( --os-ui-cat-pop-divider,var( --os-ui-border,#f0f0f1 ) );border-radius:10px;background:var( --os-ui-cat-pop-footer-bg,var( --os-ui-surface,#fafafb ) );display:flex;align-items:center;gap:6px;line-height:1.4}.os-cat__footer .dashicons{font-size:14px;width:14px;height:14px;flex-shrink:0}:host( [ disabled ] ) .os-cat{opacity:0.6;pointer-events:none}`,G="10px",Wu=v`:host{display:inline-flex;max-width:100%;align-items:center;min-width:0;font-family:var( --os-ui-font,system-ui,sans-serif );font-size:12px;line-height:1;font-weight:500}.os-crumb-chain{display:inline-flex;flex-wrap:nowrap;align-items:stretch;max-width:100%;min-width:0;min-height:22px;border-radius:999px;overflow:hidden;filter:drop-shadow( 0 1px 1px rgba( 0,0,0,0.06 ) )}.os-crumb{display:inline-flex;align-items:center;justify-content:center;gap:5px;min-height:22px;padding:2px 12px;background:var( --os-ui-crumb-bg,var( --os-ui-surface,#c3c4c7 ) );color:var( --os-ui-crumb-fg,var( --os-ui-fg,#1d2327 ) );text-align:center;min-width:0;max-width:100%;flex-shrink:1;font-size:12px;font-weight:500;letter-spacing:0.01em;white-space:nowrap;cursor:grab;transition:filter 0.15s ease,transform 0.15s ease,background-color 0.12s ease}.os-crumb:active{cursor:grabbing}.os-crumb:hover{filter:brightness( 1.06 )}.os-crumb__remove{cursor:pointer}.os-crumb--first{padding-inline-end:22px;clip-path:polygon( 0 0,calc( 100% - ${G} ) 0,100% 50%,calc( 100% - ${G} ) 100%,0 100% )}.os-crumb--middle{padding-inline:22px;margin-inline-start:calc( -1 * ${G} );clip-path:polygon( ${G} 0,calc( 100% - ${G} ) 0,100% 50%,calc( 100% - ${G} ) 100%,${G} 100%,0 50% )}.os-crumb--last{padding-inline-start:22px;padding-inline-end:14px;margin-inline-start:calc( -1 * ${G} );clip-path:polygon( ${G} 0,100% 0,100% 100%,${G} 100%,0 50% )}.os-crumb--solo{padding:2px 12px;border-radius:999px}.os-crumb__label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:1.4}.os-crumb__remove{appearance:none;display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex-shrink:0;padding:0;border:0;border-radius:50%;background:transparent;color:inherit;cursor:pointer;opacity:0.65;transition:opacity 0.12s ease,background-color 0.12s ease,transform 0.12s ease}.os-crumb__remove:hover,.os-crumb__remove:focus-visible{opacity:1;background:var( --os-ui-scrim,rgba( 0,0,0,0.22 ) );outline:none;transform:scale( 1.1 )}.os-crumb__remove svg{display:block;width:100%;height:100%}.os-crumb-chain:hover{filter:drop-shadow( 0 2px 3px rgba( 0,0,0,0.12 ) )}:host( [ disabled ] ) .os-crumb-chain{opacity:0.55;pointer-events:none}`,Ot=class Ot extends _{constructor(){super(...arguments),this._segments=[]}get segments(){return this._segments}set segments(e){this._segments=Array.isArray(e)?e.slice():[],this.requestUpdate()}render(){const e=this.removable!==null,t=this._segments;return t.length===0?l``:l`
1340 <div class="os-crumb-chain" role="group">
1341 ${t.map((s,i)=>{const n=Cr(i,t.length),r=s.color,a=r?`--os-ui-crumb-bg: ${r}; --os-ui-crumb-fg: ${Sr(r)};`:"";return l`
1342 <span
1343 class=${`os-crumb os-crumb--${n}`}
1344 style=${a}
1345 title=${s.name}
1346 draggable="true"
1347 @click=${c=>this._onSegmentClick(c,i,s)}
1348 @dragstart=${c=>this._onSegmentDragStart(c,i,s)}
1349 >
1350 <span class="os-crumb__label">${s.name}</span>
1351 ${e?l`
1352 <button
1353 type="button"
1354 class="os-crumb__remove"
1355 aria-label=${`Remove ${s.name}`}
1356 draggable="false"
1357 @click=${c=>this._onRemove(c,i,s)}
1358 >${Fu()}</button>
1359 `:l``}
1360 </span>
1361 `})}
1362 </div>
1363 `}_onSegmentDragStart(e,t,s){if(e.target?.closest(".os-crumb__remove")){e.preventDefault();return}const n=this._segments.slice(t);if(e.dataTransfer){const r=Uu(n);document.body.appendChild(r);const a=e.currentTarget?.getBoundingClientRect(),c=a?Math.min(30,a.width/2):16,u=a?Math.min(16,a.height/2):12;e.dataTransfer.setDragImage(r,c,u),requestAnimationFrame(()=>r.remove())}this.emit("os-chain-segment-dragstart",{index:t,id:s.id,segment:s,segments:n,dragEvent:e})}_onSegmentClick(e,t,s){e.target?.closest(".os-crumb__remove")||this.emit("os-chain-segment-click",{index:t,id:s.id,segment:s})}_onRemove(e,t,s){e.stopPropagation(),this.emit("os-chain-remove",{index:t,id:s.id,segment:s})}};Ot.props=["removable","disabled"],Ot.styles=[Wu],Ot.help=void 0;let ri=Ot;y("os-crumb-chain",ri);const Hu=10;function Uu(o){const e=document.createElement("div");e.style.cssText=["display: inline-flex","align-items: stretch","border-radius: 999px","overflow: hidden","filter: drop-shadow( 0 1px 2px rgba( 0, 0, 0, 0.18 ) )",'font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',"font-size: 12px","line-height: 1","font-weight: 500","position: fixed","top: -10000px","left: -10000px","pointer-events: none","z-index: 2147483647"].join("; ");const t=o.length,s=qu();return o.forEach((i,n)=>{const r=document.createElement("span"),a=i.color??s.bg,c=i.color?Sr(i.color):s.fg,u=Cr(n,t),h=["display: inline-flex","align-items: center","justify-content: center","min-height: 22px",`background: ${a}`,`color: ${c}`,"white-space: nowrap","box-sizing: border-box","letter-spacing: 0.01em"],p=Hu;u==="solo"?h.push("padding: 2px 12px","border-radius: 999px"):u==="first"?h.push("padding: 2px 22px 2px 12px",`clip-path: polygon( 0 0, calc( 100% - ${p}px ) 0, 100% 50%, calc( 100% - ${p}px ) 100%, 0 100% )`):u==="middle"?h.push("padding: 2px 22px",`margin-inline-start: -${p}px`,`clip-path: polygon( ${p}px 0, calc( 100% - ${p}px ) 0, 100% 50%, calc( 100% - ${p}px ) 100%, ${p}px 100%, 0 50% )`):h.push("padding: 2px 14px 2px 22px",`margin-inline-start: -${p}px`,`clip-path: polygon( ${p}px 0, 100% 0, 100% 100%, ${p}px 100%, 0 50% )`),r.style.cssText=h.join("; "),r.textContent=i.name,e.appendChild(r)}),e}const Er="rgba( 0, 0, 0, 0.08 )",Ar="#1d2327";function qu(){if(typeof document>"u"||!document.body)return{bg:Er,fg:Ar};const o=getComputedStyle(document.body);return{bg:o.getPropertyValue("--os-ui-crumb-bg").trim()||Er,fg:o.getPropertyValue("--os-ui-crumb-fg").trim()||Ar}}function Cr(o,e){return e===1?"solo":o===0?"first":o===e-1?"last":"middle"}let De=null;function Sr(o){De||(De=document.createElement("canvas"),De.width=1,De.height=1);const e=De.getContext("2d",{willReadFrequently:!0});if(!e)return"#1d2327";try{e.clearRect(0,0,1,1),e.fillStyle=o,e.fillRect(0,0,1,1);const t=e.getImageData(0,0,1,1).data,s=t[3]/255,i=t[0]*s+255*(1-s),n=t[1]*s+255*(1-s),r=t[2]*s+255*(1-s),a=u=>{const h=u/255;return h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4)};return .2126*a(i)+.7152*a(n)+.0722*a(r)>.55?"#1d2327":"#fff"}catch{return"#1d2327"}}function Fu(){return I("close",{size:null})}const Lr="uncategorized",Vu=1;function us(o){return o.id===Vu?!0:(o.name||"").toLowerCase()===Lr}const Wt=class Wt extends _{constructor(){super(...arguments),this._items=[],this._value=[],this._query="",this._collapsed=new Set,this._focusedRow=-1,this._creatingValues=new Map,this._creatingPending=new Set,this._onCellClick=e=>{if(e.target?.closest(".os-cat-node")||this.isOpen)return;const s=this.disabled!==null,i=this.readonly!==null;s||i||this.openPicker()},this._onDocPointerDown=e=>{!this.isOpen||e.composedPath().includes(this)||this.closePicker()},this._onLayoutChange=()=>{this.isOpen&&this.closePicker()},this._onDocKeydown=e=>{this.isOpen&&e.key==="Escape"&&(e.preventDefault(),this.closePicker())}}get items(){return this._items}set items(e){this._items=Array.isArray(e)?e.slice():[],this.requestUpdate()}get value(){return this._value}set value(e){this._value=Array.isArray(e)?e.slice():[],this.requestUpdate()}get isOpen(){return this.open!==null}openPicker(){this.isOpen||(this.open="",this._query="",this._focusedRow=0,this.emit("os-categories-open",{}),queueMicrotask(()=>{this._positionPopover(),this._searchInput?.focus()}))}closePicker(){this.isOpen&&(this.open=null,this._query="",this._focusedRow=-1,this.emit("os-categories-close",{}),this.requestUpdate())}connectedCallback(){super.connectedCallback(),document.addEventListener("pointerdown",this._onDocPointerDown,!0),document.addEventListener("keydown",this._onDocKeydown,!0),window.addEventListener("resize",this._onLayoutChange,{passive:!0}),window.addEventListener("scroll",this._onLayoutChange,{passive:!0,capture:!0})}disconnectedCallback(){document.removeEventListener("pointerdown",this._onDocPointerDown,!0),document.removeEventListener("keydown",this._onDocKeydown,!0),window.removeEventListener("resize",this._onLayoutChange),window.removeEventListener("scroll",this._onLayoutChange,{capture:!0})}get _searchInput(){return this.shadowRoot?.querySelector(".os-cat__search")??null}render(){const e=this.isOpen,t=this.disabled!==null,s=this.readonly!==null,i=this.loading!==null,n=this["add-label"]||"Categorize",r=this.placeholder||"Search categories…",a=Math.max(0,parseInt(this["max-visible"]||"2",10)||2);return l`
1364 <span class="os-cat" role="group">
1365 ${this._renderChipRow(a,s,t,n)}
1366 ${e?this._renderPopover(r,i):l``}
1367 </span>
1368 `}_renderChipRow(e,t,s,i){const n=this._selectedItemsInOrder();if(n.length===0)return l`
1369 <span class="os-cat__chips" role="list">
1370 <span
1371 class="os-cat__uncategorized"
1372 title=${'Posts with no category appear as "Uncategorized" in WordPress.'}
1373 @click=${this._onCellClick}
1374 >${"Uncategorized"}</span>
1375 </span>
1376 `;const r=this._buildChains(n);return l`
1377 <div
1378 class="os-cat__chains"
1379 role="list"
1380 @click=${this._onCellClick}
1381 >
1382 ${r.map(a=>this._renderChain(a,t,s))}
1383 </div>
1384 `}_buildChains(e){const t=new Map;for(const a of this._items)t.set(a.id,a);const s=new Set(e.map(a=>a.id)),i=a=>{for(const c of s){if(c===a)continue;let u=t.get(c),h=16;for(;u&&h-- >0;){if(u.parent===a)return!0;if(!u.parent)break;u=t.get(u.parent)}}return!1},n=e.filter(a=>!i(a.id)),r=[];for(const a of n){const c=[];let u=a,h=16;for(;u&&h-- >0&&((u===a||s.has(u.id))&&c.unshift(u),!!u.parent);)u=t.get(u.parent);const p=c.map(g=>({id:g.id,name:g.name}));r.push({id:a.id,segments:p})}return r}_renderChain(e,t,s){const i=!t&&!s,n=a=>{a.stopPropagation();const c=a.detail,u=typeof c?.index=="number"?c.index:e.segments.length-1,h=new Set;for(const g of e.segments.slice(u))typeof g.id=="number"&&h.add(g.id);const p=this._value.filter(g=>!h.has(g));p.length!==this._value.length&&this.emit("os-categories-change",{value:p})},r=document.createElement("os-crumb-chain");return r.segments=e.segments,i&&r.setAttribute("removable",""),r.addEventListener("os-chain-remove",n),l`<div role="listitem">${r}</div>`}_renderPopover(e,t){const s=this._buildTree(),i=this._filterTree(s,this._query),n=this._flattenForDisplay(i);return this._focusedRow>=n.length&&(this._focusedRow=n.length>0?n.length-1:-1),l`
1385 <div class="os-cat__popover" role="dialog" aria-label="Choose categories">
1386 <input
1387 class="os-cat__search"
1388 type="text"
1389 autocomplete="off"
1390 placeholder=${e}
1391 .value=${this._query}
1392 @input=${r=>this._onSearchInput(r)}
1393 @keydown=${r=>this._onSearchKeydown(r,n)}
1394 />
1395 <div class="os-cat__tree" role="listbox" aria-multiselectable="true">
1396 ${this._renderCreateRow(0,12,0,"")}
1397 ${this._renderTreeBody(t,n)}
1398 </div>
1399 <div class="os-cat__footer">
1400 <span class="dashicons dashicons-info-outline" aria-hidden="true"></span>
1401 <span>
1402 Posts with no category appear as
1403 <strong>Uncategorized</strong>.
1404 </span>
1405 </div>
1406 </div>
1407 `}_renderTreeBody(e,t){return e?l`
1408 <div class="os-cat__loading">
1409 <span class="os-cat__loading-spinner" aria-hidden="true"></span>
1410 ${"Loading categories…"}
1411 </div>
1412 `:t.length===0?l`
1413 <div class="os-cat__empty">
1414 ${this._items.length===0?"No categories yet — create one in WordPress to assign.":"No matches."}
1415 </div>
1416 `:t.map((s,i)=>this._renderRow(s,i,t.length))}_renderRow(e,t,s){const{node:i,hasChildren:n}=e,r=this._value.includes(i.item.id),a=!this._collapsed.has(i.item.id),c=12+i.depth*16,u=i.depth>0?i.depth*16:0,h=t===this._focusedRow;return l`
1417 <div class="os-cat__row-block">
1418 <div
1419 class="os-cat__row"
1420 role="option"
1421 aria-selected=${r?"true":"false"}
1422 data-selected=${r?"true":"false"}
1423 data-expanded=${a?"true":"false"}
1424 data-focused=${h?"true":"false"}
1425 data-row-id=${String(i.item.id)}
1426 style=${`--os-ui-cat-row-indent: ${c}px; --os-ui-cat-guide-width: ${u}px;`}
1427 @mouseenter=${()=>{this._focusedRow=t,this.requestUpdate()}}
1428 @click=${p=>{p.preventDefault(),this._toggleSelection(i.item.id)}}
1429 >
1430 ${n?l`<button
1431 type="button"
1432 class="os-cat__expander"
1433 aria-label=${a?"Collapse":"Expand"}
1434 @click=${p=>{p.stopPropagation(),this._toggleExpand(i.item.id)}}
1435 >${Rr()}</button>`:l`<span class="os-cat__expander os-cat__expander--placeholder" aria-hidden="true">${Rr()}</span>`}
1436 <span class="os-cat__check" aria-hidden="true">${ju()}</span>
1437 <span class="os-cat__label">${this._highlight(i.item.name,this._query)}</span>
1438 ${us(i.item)?l``:l`<button
1439 type="button"
1440 class="os-cat__delete"
1441 aria-label=${`Delete ${i.item.name}`}
1442 title=${`Delete ${i.item.name}`}
1443 @click=${p=>this._onDeleteClick(p,i.item)}
1444 >${Bu()}</button>`}
1445 </div>
1446 ${a&&!us(i.item)?this._renderCreateRow(i.item.id,12+(i.depth+1)*16,(i.depth+1)*16,i.item.name):l``}
1447 </div>
1448 `}_renderCreateRow(e,t,s,i){const n=this._creatingValues.get(e)??"",r=this._creatingPending.has(e),a=e===0?"Add new category…":`Add child of "${i}"…`;return l`
1449 <div
1450 class="os-cat__create-row"
1451 style=${`--os-ui-cat-row-indent: ${t}px; --os-ui-cat-guide-width: ${s}px;`}
1452 @click=${c=>c.stopPropagation()}
1453 >
1454 <div class="os-cat__create-wrap">
1455 <input
1456 class="os-cat__create-input"
1457 type="text"
1458 autocomplete="off"
1459 spellcheck="false"
1460 placeholder=${a}
1461 aria-label=${a}
1462 .value=${n}
1463 ?disabled=${r}
1464 @input=${c=>this._onCreateInput(c,e)}
1465 @keydown=${c=>this._onCreateKeydown(c,e)}
1466 />
1467 ${r?l`<span class="os-cat__create-spinner" aria-hidden="true"></span>`:l`<button
1468 type="button"
1469 class="os-cat__create-submit"
1470 aria-label=${e===0?"Create category":`Create child of ${i}`}
1471 ?disabled=${n.trim().length===0}
1472 @click=${c=>{c.stopPropagation(),this._submitCreate(e)}}
1473 >${Ku()}</button>`}
1474 </div>
1475 </div>
1476 `}_onCreateInput(e,t){const s=e.target.value;s===""?this._creatingValues.delete(t):this._creatingValues.set(t,s),this.requestUpdate()}_onCreateKeydown(e,t){if(e.key==="Escape"){e.preventDefault(),this._creatingValues.delete(t),this.requestUpdate();return}e.key==="Enter"&&(e.preventDefault(),this._submitCreate(t))}_submitCreate(e){const t=(this._creatingValues.get(e)??"").trim();!t||this._creatingPending.has(e)||(this._creatingPending.add(e),this.requestUpdate(),this.emit("os-categories-create",{name:t,parent:e}))}endCreating(e=0){this._creatingPending.delete(e),this._creatingValues.delete(e),this.requestUpdate()}failCreating(e=0,t){this._creatingPending.delete(e),this.requestUpdate()}_buildTree(){const e=new Map;for(const n of this._items)e.set(n.id,{item:n,children:[],depth:0});const t=[];for(const n of e.values()){const r=n.item.parent;r&&e.has(r)?e.get(r).children.push(n):t.push(n)}const s=(n,r)=>{n.depth=r;for(const a of n.children)s(a,r+1)};for(const n of t)s(n,0);const i=n=>{n.sort((r,a)=>{const c=us(r.item),u=us(a.item);return c!==u?c?-1:1:r.item.name.localeCompare(a.item.name)});for(const r of n)i(r.children)};return i(t),t}_filterTree(e,t){const s=t.trim().toLowerCase();if(!s)return e;const i=n=>{if(n.item.name.toLowerCase().includes(s))return{item:n.item,children:n.children.slice(),depth:n.depth};const a=n.children.map(i).filter(c=>c!==null);return a.length>0?{item:n.item,children:a,depth:n.depth}:null};return e.map(i).filter(n=>n!==null)}_flattenForDisplay(e){const t=[],s=this._query.trim()!=="",i=n=>{for(const r of n)t.push({node:r,visible:!0,hasChildren:r.children.length>0}),!(this._collapsed.has(r.item.id)&&!s)&&r.children.length>0&&i(r.children)};return i(e),t}_selectedItemsInOrder(){const e=new Map;for(const i of this._items)e.set(i.id,i);const t=[],s=[];for(const i of this._value){const n=e.get(i);n&&(n.name.toLowerCase()===Lr||n.id===1?s.push(n):t.push(n))}return t.length>0?t:s.length>0?[]:t}_highlight(e,t){const s=t.trim();if(!s)return e;const i=e.toLowerCase(),n=s.toLowerCase(),r=i.indexOf(n);return r===-1?e:l`${e.slice(0,r)}<span class="os-cat__match"
1477 >${e.slice(r,r+s.length)}</span
1478 >${e.slice(r+s.length)}`}_toggleSelection(e){const t=this._value.includes(e)?this._value.filter(s=>s!==e):[...this._value,e];this.emit("os-categories-change",{value:t})}_onDeleteClick(e,t){e.stopPropagation(),e.preventDefault(),this.emit("os-categories-delete",{id:t.id,name:t.name})}_toggleExpand(e){this._collapsed.has(e)?this._collapsed.delete(e):this._collapsed.add(e),this.requestUpdate()}_onSearchInput(e){this._query=e.target.value,this._focusedRow=0,this.requestUpdate()}_onSearchKeydown(e,t){switch(e.key){case"ArrowDown":{if(t.length===0)return;e.preventDefault(),this._focusedRow=this._focusedRow+1>=t.length?0:this._focusedRow+1,this.requestUpdate(),this._scrollFocusedIntoView();return}case"ArrowUp":{if(t.length===0)return;e.preventDefault(),this._focusedRow=this._focusedRow<=0?t.length-1:this._focusedRow-1,this.requestUpdate(),this._scrollFocusedIntoView();return}case"ArrowRight":{if(this._focusedRow<0||this._focusedRow>=t.length)return;const s=t[this._focusedRow];s.hasChildren&&this._collapsed.has(s.node.item.id)&&(e.preventDefault(),this._toggleExpand(s.node.item.id));return}case"ArrowLeft":{if(this._focusedRow<0||this._focusedRow>=t.length)return;const s=t[this._focusedRow];s.hasChildren&&!this._collapsed.has(s.node.item.id)&&(e.preventDefault(),this._toggleExpand(s.node.item.id));return}case"Enter":case" ":{if(this._focusedRow<0||this._focusedRow>=t.length)return;e.preventDefault();const s=t[this._focusedRow];this._toggleSelection(s.node.item.id);return}case"Escape":e.preventDefault(),this.closePicker()}}_scrollFocusedIntoView(){queueMicrotask(()=>{const e=this.shadowRoot?.querySelector(".os-cat__tree");if(!e)return;const t=e.querySelector('.os-cat__row[data-focused="true"]');if(!t)return;const s=t.getBoundingClientRect(),i=e.getBoundingClientRect();s.top<i.top?t.scrollIntoView({block:"nearest"}):s.bottom>i.bottom&&t.scrollIntoView({block:"nearest"})})}_positionPopover(){const e=this.shadowRoot?.querySelector(".os-cat__popover");if(!e)return;const t=this.getBoundingClientRect(),s=e.getBoundingClientRect(),i=window.innerWidth,n=window.innerHeight,r=8;let a=t.bottom+4;const c=a+s.height+r>n,u=t.top-4-s.height>=r;c&&u?a=t.top-4-s.height:c&&(a=Math.max(r,n-s.height-r));let h=t.left;h+s.width+r>i&&(h=t.right-s.width),h=Math.max(r,Math.min(h,i-s.width-r)),e.style.top=`${a}px`,e.style.left=`${h}px`}};Wt.props=["placeholder","add-label","disabled","readonly","open","loading","max-visible"],Wt.styles=[Ou],Wt.help=void 0;let ai=Wt;y("os-category-picker",ai);function Rr(){return I("chevron-right",{size:14})}function Ku(){return I("plus",{size:16})}function ju(){return I("check",{size:null})}function Bu(){return I("close",{size:null})}const Gu=v` ${S} ${is}:host(:not( [ interactive ] ) ) .os-holo-glint,:host( [ disabled ] ) .os-holo-glint{display:none}:host{display:flex;flex-direction:column;position:relative;gap:var( --os-ui-card-gap,12px );padding:var( --os-ui-card-padding,16px );border:1px solid var( --os-ui-card-border,var( --os-ui-border,rgba( 0,0,0,0.08 ) ) );border-radius:var( --os-ui-card-radius,12px );background:var( --os-ui-card-bg,var( --os-ui-surface,#fff ) );background-image:var( --os-ui-panel-bg-image,none );background-repeat:var( --os-ui-panel-bg-image-repeat,repeat );background-size:var( --os-ui-panel-bg-image-size,auto );background-position:var( --os-ui-panel-bg-image-position,center );color:var( --os-ui-card-fg,inherit );box-sizing:border-box;min-width:0;transition:transform 180ms ease,box-shadow 180ms ease,border-color 180ms ease}:host( [ hidden ] ){display:none}:host( [ compact ] ){padding:var( --os-ui-card-padding-compact,10px );gap:var( --os-ui-card-gap-compact,6px );border-radius:var( --os-ui-card-radius-compact,8px )}:host( [ interactive ] ){cursor:pointer;outline-offset:2px}:host( [ interactive ]:hover ),:host( [ interactive ]:focus-visible ){transform:translateY( -2px );box-shadow:var( --os-ui-card-shadow-hover,0 4px 16px rgba( 0,0,0,0.08 ) );border-color:var( --os-ui-card-border-hover,var( --os-ui-border-strong,rgba( 0,0,0,0.16 ) ) )}:host( [ interactive ]:focus-visible ){outline:none;box-shadow:var( --_holo-focus )}:host( [ selected ] ){border-color:var( --os-ui-card-border-selected,var( --wp-admin-theme-color,#2271b1 ) );box-shadow:var( --os-ui-card-shadow-selected,0 0 0 1px var( --wp-admin-theme-color,#2271b1 ) inset )}:host( [ selected ] )::after{content:'';position:absolute;inset:-1px;border-radius:inherit;padding:1px;background-image:var( --_holo-edge );pointer-events:none;-webkit-mask:linear-gradient( #000 0 0 ) content-box,linear-gradient( #000 0 0 );-webkit-mask-composite:xor;mask:linear-gradient( #000 0 0 ) content-box,linear-gradient( #000 0 0 );mask-composite:exclude}:host( [ disabled ] ){opacity:0.55;pointer-events:none;cursor:not-allowed}@media ( prefers-reduced-motion:reduce ){:host{transition:none}:host( [ interactive ]:hover ),:host( [ interactive ]:focus-visible ){transform:none}}::slotted( header ){display:flex;align-items:center;gap:12px;min-width:0}::slotted( footer ){display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:auto}`,Ir="[data-noclick]",Ht=class Ht extends _{constructor(){super(...arguments),this._onClick=e=>{!this.hasAttribute("interactive")||this.hasAttribute("disabled")||e.target?.closest(Ir)||this._emitCardClick(e)},this._onKeyDown=e=>{if(!this.hasAttribute("interactive")||this.hasAttribute("disabled")||e.key!=="Enter"&&e.key!==" "&&e.key!=="Spacebar")return;const t=e.target;t&&t!==this&&t.closest(Ir)||t instanceof HTMLElement&&t!==this&&(t.tagName==="BUTTON"||t.tagName==="A"||t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT")||(e.preventDefault(),this._emitCardClick(e))}}connectedCallback(){super.connectedCallback(),this._syncRoles(),this.addEventListener("click",this._onClick),this.addEventListener("keydown",this._onKeyDown)}disconnectedCallback(){this.removeEventListener("click",this._onClick),this.removeEventListener("keydown",this._onKeyDown)}render(){return this._syncRoles(),l`<span class="os-holo-glint" aria-hidden="true"></span
1479 ><slot name="header"></slot><slot></slot><slot name="footer"></slot>`}_syncRoles(){const e=this.hasAttribute("interactive"),t=this.hasAttribute("disabled");e?(this.hasAttribute("role")||this.setAttribute("role","button"),this.setAttribute("tabindex",t?"-1":"0"),this.setAttribute("aria-disabled",t?"true":"false")):(this.removeAttribute("role"),this.removeAttribute("tabindex"),this.removeAttribute("aria-disabled"))}_emitCardClick(e){this.dispatchEvent(new CustomEvent("os-card-click",{detail:{originalEvent:e},bubbles:!0,composed:!0}))}};Ht.props=["interactive","selected","compact","disabled"],Ht.styles=[Gu],Ht.help=void 0;let li=Ht;y("os-card",li);const Xu=v`:host{display:block;--_track:var( --os-ui-rating-track,var( --os-ui-border,rgba( 0,0,0,0.08 ) ) );--_fill:var( --os-ui-rating-fill,linear-gradient( 90deg,#f5af00 0%,#ffd245 100% ) );--_star:var( --os-ui-rating-star,#f5af00 );--_star-empty:var( --os-ui-rating-star-empty,var( --os-ui-fg-faint,rgba( 0,0,0,0.18 ) ) );--_surface:var( --os-ui-rating-surface,var( --os-ui-surface-elevated,rgba( 255,255,255,0.7 ) ) );--_border:var( --os-ui-rating-border,var( --os-ui-border,rgba( 0,0,0,0.08 ) ) );--_fg:var( --os-ui-rating-fg,var( --os-ui-fg,inherit ) );--_fg-muted:var( --os-ui-rating-fg-muted,var( --os-ui-fg-muted,#666 ) )}:host( [ hidden ] ){display:none}.summary-card{display:grid;grid-template-columns:minmax( 140px,180px ) 1fr;gap:28px;align-items:center;padding:18px 20px;background:var( --_surface );border:1px solid var( --_border );border-radius:14px;color:var( --_fg )}.summary{display:flex;flex-direction:column;align-items:center;gap:8px;padding-inline-end:20px;border-inline-end:1px solid var( --_border )}.big{font-size:44px;font-weight:700;line-height:1;font-variant-numeric:tabular-nums;letter-spacing:-0.02em;color:var( --_fg )}.stars{display:inline-flex;gap:2px;color:var( --_star )}.stars svg{width:16px;height:16px;display:block}.stars .empty{color:var( --_star-empty )}.total{font-size:12px;color:var( --_fg-muted )}.bars{display:grid;gap:6px;min-width:0}.row{display:grid;grid-template-columns:42px 1fr 60px;gap:12px;align-items:center;font-size:12.5px;color:var( --_fg-muted )}.row__label{display:inline-flex;align-items:center;gap:4px;font-variant-numeric:tabular-nums;font-weight:600}.row__label svg{width:11px;height:11px;color:var( --_star )}.row__track{position:relative;height:10px;background:var( --_track );border-radius:999px;overflow:hidden}.row__fill{position:absolute;inset:0;background:var( --_fill );border-radius:999px;transform-origin:left center;transform:scaleX( var( --ratio,0 ) );transition:transform 600ms cubic-bezier( 0.2,0.8,0.2,1 )}:host(:dir( rtl ) ) .row__fill,:host-context( [ dir='rtl' ] ) .row__fill{transform-origin:right center}.row__count{text-align:end;font-variant-numeric:tabular-nums;color:var( --_fg )}@media ( prefers-reduced-motion:reduce ){.row__fill{transition:none}}@media ( max-width:540px ){.summary-card{grid-template-columns:1fr;gap:16px}.summary{padding-inline-end:0;border-inline-end:0;border-block-end:1px solid var( --_border );padding-block-end:14px}}`,Ut=class Ut extends _{constructor(){super(...arguments),this._ratings={}}get ratings(){return{...this._ratings}}set ratings(e){this._ratings=e?{...e}:{},this.requestUpdate()}render(){const e=Zu(Dr(this,"rating")),t=e/100*5,s=Dr(this,"total"),i=s>0?s:(this._ratings[5]??0)+(this._ratings[4]??0)+(this._ratings[3]??0)+(this._ratings[2]??0)+(this._ratings[1]??0),n=new Intl.NumberFormat,r=e>0?(e/100*5).toFixed(1):"—";return l`
1480 <div class="summary-card" role="img" aria-label=${Yu(e,i)}>
1481 <div class="summary">
1482 <div class="big">${r}</div>
1483 <div class="stars" aria-hidden="true">
1484 ${Qu(t)}
1485 </div>
1486 <div class="total">
1487 ${i===1?"1 rating":`${n.format(i)} ratings`}
1488 </div>
1489 </div>
1490 <div class="bars">
1491 ${[5,4,3,2,1].map(a=>{const c=this._ratings[String(a)]??0,u=i===0?0:c/i;return l`
1492 <div
1493 class="row"
1494 role="presentation"
1495 aria-label=${`${a} stars: ${n.format(c)}`}
1496 >
1497 <span class="row__label">
1498 ${a} ${Tr()}
1499 </span>
1500 <span class="row__track">
1501 <span
1502 class="row__fill"
1503 style=${`--ratio: ${u.toFixed(4)}`}
1504 ></span>
1505 </span>
1506 <span class="row__count">${n.format(c)}</span>
1507 </div>
1508 `})}
1509 </div>
1510 </div>
1511 `}};Ut.props=["rating","total"],Ut.styles=[Xu],Ut.help=void 0;let ci=Ut;function Dr(o,e){const t=o.getAttribute(e);if(t===null||t==="")return 0;const s=Number(t);return Number.isFinite(s)?s:0}function Zu(o){return o<0?0:o>100?100:o}function Yu(o,e){return e===0?"No ratings yet":`Average rating ${(o/100*5).toFixed(1)} out of 5, from ${e} ratings`}function Qu(o){const e=Math.floor(o),t=o-e>=.5?1:0,s=5-e-t,i=[];for(let n=0;n<e;n++)i.push(Tr());for(let n=0;n<t;n++)i.push(Ju());for(let n=0;n<s;n++)i.push(eh());return i}function Tr(){return l`
1512 <svg viewBox="0 0 16 16" fill="currentColor" aria-hidden="true">
1513 <path
1514 d="M8 1.5l2.06 4.17 4.6.67-3.33 3.25.79 4.58L8 12L3.88 14.17l.79-4.58L1.34 6.34l4.6-.67L8 1.5z"
1515 />
1516 </svg>
1517 `}function Ju(){return l`
1518 <svg viewBox="0 0 16 16" aria-hidden="true">
1519 <defs>
1520 <linearGradient id="os-half-star">
1521 <stop offset="50%" stop-color="currentColor" />
1522 <stop
1523 offset="50%"
1524 stop-color="currentColor"
1525 stop-opacity="0.22"
1526 />
1527 </linearGradient>
1528 </defs>
1529 <path
1530 fill="url(#os-half-star)"
1531 d="M8 1.5l2.06 4.17 4.6.67-3.33 3.25.79 4.58L8 12L3.88 14.17l.79-4.58L1.34 6.34l4.6-.67L8 1.5z"
1532 />
1533 </svg>
1534 `}function eh(){return l`
1535 <svg
1536 class="empty"
1537 viewBox="0 0 16 16"
1538 fill="currentColor"
1539 aria-hidden="true"
1540 >
1541 <path
1542 d="M8 1.5l2.06 4.17 4.6.67-3.33 3.25.79 4.58L8 12L3.88 14.17l.79-4.58L1.34 6.34l4.6-.67L8 1.5z"
1543 />
1544 </svg>
1545 `}y("os-rating-summary",ci);const th=v`:host{display:flex;align-items:flex-start;gap:10px;width:100%;box-sizing:border-box;padding:10px 14px;font:var( --os-ui-notice-font,13px/1.5 var( --os-font,system-ui ) );color:var( --os-ui-notice-color,var( --os-ui-fg,#1d2327 ) );background:var( --os-ui-notice-bg,var( --os-ui-hover,rgba( 0,0,0,0.04 ) ) );border-block-end:1px solid var( --os-ui-notice-border,var( --os-ui-border,rgba( 0,0,0,0.08 ) ) );border-inline-start:4px solid var( --os-ui-notice-accent,var( --os-ui-border,#646970 ) )}:host( [ hidden ] ){display:none}.os-notice__icon{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;color:var( --os-ui-notice-accent,var( --os-ui-accent,#646970 ) )}.os-notice__icon[ hidden ]{display:none}.os-notice__label{flex:1;min-width:0;word-wrap:break-word}::slotted( a ){color:var( --os-ui-notice-link,var( --wp-admin-theme-color,#2271b1 ) );border-radius:2px}::slotted( a:hover ),::slotted( a:focus-visible ){color:var( --os-ui-notice-link-hover,var( --os-ui-accent-strong,#135e96 ) )}::slotted( a:focus-visible ){outline:2px solid var( --os-ui-notice-link-hover,var( --os-ui-accent-strong,#135e96 ) );outline-offset:2px}::slotted( p:first-child ){margin-block-start:0}::slotted( p:last-child ){margin-block-end:0}.os-notice__close{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;background:transparent;color:inherit;opacity:0.6;cursor:pointer;border-radius:4px;transition:opacity 0.12s ease,background-color 0.12s ease}.os-notice__close:hover{opacity:1;background:var( --os-ui-hover,rgba( 0,0,0,0.06 ) )}.os-notice__close:focus-visible{opacity:1;outline:2px solid var( --wp-admin-theme-color,#2271b1 );outline-offset:1px}.os-notice__close[ hidden ]{display:none}.os-notice__close svg{width:14px;height:14px}:host( [ tone='info' ] ){--os-ui-notice-accent:var( --os-ui-notice-info,var( --os-ui-info-fg,#0969da ) );--os-ui-notice-bg:var( --os-ui-notice-info-bg,rgba( 9,105,218,0.08 ) );--os-ui-notice-border:var( --os-ui-notice-info-border,rgba( 9,105,218,0.16 ) )}:host( [ tone='success' ] ){--os-ui-notice-accent:var( --os-ui-notice-success,var( --os-ui-success-fg,#1a7f37 ) );--os-ui-notice-bg:var( --os-ui-notice-success-bg,rgba( 26,127,55,0.08 ) );--os-ui-notice-border:var( --os-ui-notice-success-border,rgba( 26,127,55,0.16 ) )}:host( [ tone='warning' ] ){--os-ui-notice-accent:var( --os-ui-notice-warning,var( --os-ui-warning-fg,#9a6700 ) );--os-ui-notice-bg:var( --os-ui-notice-warning-bg,rgba( 154,103,0,0.08 ) );--os-ui-notice-border:var( --os-ui-notice-warning-border,rgba( 154,103,0,0.16 ) )}:host( [ tone='error' ] ),:host( [ tone='danger' ] ){--os-ui-notice-accent:var( --os-ui-notice-error,var( --os-ui-danger,#cf222e ) );--os-ui-notice-bg:var( --os-ui-notice-error-bg,rgba( 207,34,46,0.08 ) );--os-ui-notice-border:var( --os-ui-notice-error-border,rgba( 207,34,46,0.16 ) )}:host( [ tone='neutral' ] ){--os-ui-notice-accent:var( --os-ui-notice-neutral,var( --os-ui-fg-muted,#57606a ) );--os-ui-notice-bg:var( --os-ui-notice-neutral-bg,rgba( 87,96,106,0.08 ) );--os-ui-notice-border:var( --os-ui-notice-neutral-border,rgba( 87,96,106,0.16 ) )}`,sh="desktop-mode-notice-dismissed";function oh(){const e=window.wp?.os?.config?.currentUserId;return typeof e=="number"&&e>0?String(e):"anon"}function Nr(){return`${sh}:${oh()}`}function di(){try{const o=window.localStorage.getItem(Nr());if(!o)return{};const e=JSON.parse(o);if(e&&typeof e=="object"&&!Array.isArray(e))return e}catch{}return{}}function Pr(o){try{window.localStorage.setItem(Nr(),JSON.stringify(o))}catch{}}function ih(o){return o?di()[o]===!0:!1}function nh(o){if(!o)return;const e=di();e[o]=!0,Pr(e)}function rh(o){if(!o)return;const e=di();e[o]&&(delete e[o],Pr(e))}const qt=class qt extends _{connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","status"),this.hasAttribute("tone")||this.setAttribute("tone","info");const e=this.getAttribute("notice-id");e&&ih(e)&&(this.hidden=!0)}dismiss(){this.hidden=!0;const e=this.getAttribute("notice-id");e&&nh(e),this.emit("os-notice-dismiss",{noticeId:e??void 0})}undismiss(){const e=this.getAttribute("notice-id");e&&rh(e),this.hidden=!1}render(){const e=this.getAttribute("icon"),t=!this.hasAttribute("not-dismissible");return l`
1546 <span
1547 class="os-notice__icon dashicons ${e??""}"
1548 ?hidden=${!e}
1549 aria-hidden="true"
1550 ></span>
1551 <span class="os-notice__label"><slot></slot></span>
1552 <button
1553 type="button"
1554 class="os-notice__close"
1555 ?hidden=${!t}
1556 aria-label=${d("Dismiss notice")}
1557 @click=${s=>this._onDismiss(s)}
1558 >
1559 ${I("close",{size:null})}
1560 </button>
1561 `}_onDismiss(e){e.preventDefault(),e.stopPropagation(),this.dismiss()}};qt.props=["tone","notDismissible","icon","noticeId"],qt.styles=[th],qt.help=void 0;let ui=qt;y("os-notice",ui);const ah=v` ${S} ${Wn}:host{display:block;--_track-bg:var( --os-ui-progress-track-bg,var( --os-ui-surface-sunken,rgba( 0,0,0,0.08 ) ) );--_fill:var( --os-ui-progress-fill,var( --wp-admin-theme-color,#2271b1 ) );--_height:var( --os-ui-progress-height,6px );--_radius:var( --os-ui-progress-radius,999px );--_label-color:var( --os-ui-progress-label-color,inherit );--_label-size:var( --os-ui-progress-label-size,12px );--_label-gap:var( --os-ui-progress-label-gap,4px );width:100%;font:inherit;color:var( --_label-color )}:host( [ hidden ] ){display:none}.header{display:flex;align-items:baseline;justify-content:space-between;gap:8px;margin-bottom:var( --_label-gap );font-size:var( --_label-size );line-height:1.3}.label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.percent{font-variant-numeric:tabular-nums;opacity:0.75;flex-shrink:0}.track{position:relative;width:100%;height:var( --_height );background:var( --_track-bg );border-radius:var( --_radius );overflow:hidden}.fill{position:absolute;inset-block:0;inset-inline-start:0;width:0;background:var( --_fill );border-radius:inherit;transition:width 0.18s ease-out}:host( [ tone='success' ] ){--os-ui-progress-fill:var( --os-ui-success-fg,#3a8a3a )}:host( [ tone='warning' ] ){--os-ui-progress-fill:var( --os-ui-warning-fg,#dba617 )}:host( [ tone='danger' ] ){--os-ui-progress-fill:var( --os-ui-danger,#d63638 )}:host( [ indeterminate ] ) .fill{width:100%;transition:none;background-image:var( --_fill );background-size:300% 300%;background-repeat:no-repeat;animation:os-holo-shimmer 2.4s var( --_holo-loop ) infinite}:host( [ indeterminate ][ tone ] ) .fill{width:33%;background-image:none;animation:os-progress-sweep 1.1s linear infinite}@keyframes os-progress-sweep{0%{transform:translateX( -120% )}100%{transform:translateX( 320% )}}@media ( prefers-reduced-motion:reduce ){.fill{transition:none}:host( [ indeterminate ] ) .fill,:host( [ indeterminate ][ tone ] ) .fill{animation:none;width:100%;opacity:0.6}}`,Ft=class Ft extends _{constructor(){super(...arguments),this._ownedAriaLabel=null}render(){return l`<div class="root" part="root">
1562 <div class="header" part="header" hidden>
1563 <span class="label" part="label"></span>
1564 <span class="percent" part="percent"></span>
1565 </div>
1566 <div class="track" part="track">
1567 <div class="fill" part="fill"></div>
1568 </div>
1569 </div>`}requestUpdate(){super.requestUpdate(),queueMicrotask(()=>this._paint())}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this._paint())}_paint(){const e=this.shadowRoot;if(!e)return;const t=this._readMax(),s=this.hasAttribute("indeterminate")||t<=0,i=s?0:this._readValue(t),n=s?0:i/t,r=Math.round(n*100),a=this.getAttribute("label")??"",c=this.hasAttribute("show-percent"),u=e.querySelector(".fill");u&&!s?u.style.width=`${(n*100).toFixed(2)}%`:u&&s&&u.style.removeProperty("width");const h=e.querySelector(".header"),p=e.querySelector(".label"),g=e.querySelector(".percent");if(h&&p&&g){const b=a||c&&!s;h.hidden=!b,p.textContent=a,g.hidden=!(c&&!s),g.textContent=`${r}%`}this._syncAria(t,i,s,a);const m=e.querySelector(".track");m&&(m.setAttribute("role","progressbar"),m.setAttribute("aria-valuemin","0"),s?(m.removeAttribute("aria-valuenow"),m.removeAttribute("aria-valuemax")):(m.setAttribute("aria-valuemax",String(t)),m.setAttribute("aria-valuenow",String(i))),a?m.setAttribute("aria-label",a):m.removeAttribute("aria-label"))}_syncAria(e,t,s,i){this.setAttribute("role","progressbar"),this.setAttribute("aria-valuemin","0"),s?(this.removeAttribute("aria-valuenow"),this.removeAttribute("aria-valuemax")):(this.setAttribute("aria-valuemax",String(e)),this.setAttribute("aria-valuenow",String(t)));const n=this.getAttribute("aria-label");i?(n===null||n===this._ownedAriaLabel)&&(this.setAttribute("aria-label",i),this._ownedAriaLabel=i):n!==null&&n===this._ownedAriaLabel&&(this.removeAttribute("aria-label"),this._ownedAriaLabel=null)}_readMax(){const e=this.getAttribute("max");if(e===null)return 100;const t=parseFloat(e);return Number.isFinite(t)?t:100}_readValue(e){const t=parseFloat(this.getAttribute("value")??"0");return!Number.isFinite(t)||t<0?0:t>e?e:t}};Ft.props=["value","max","indeterminate","tone","label","showPercent"],Ft.styles=[ah],Ft.help=void 0;let hi=Ft;y("os-progress-bar",hi);const lh=v`:host{--_gap:var( --os-ui-field-row-gap,6px );--_label-width:var( --os-ui-field-row-label-width,12rem );display:flex;flex-direction:column;gap:var( --_gap );container-type:inline-size}:host( [ hidden ] ){display:none}.os-field-row__head{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:0}.os-field-row__head:empty{display:none}.os-field-row__label{font-size:13px;font-weight:500;line-height:1.4;color:var( --os-ui-fg,#1d2327 );cursor:default}.os-field-row__required{margin-inline-start:2px;color:var( --os-ui-danger,#d63638 )}.os-field-row__action:empty{display:none}.os-field-row__control{min-width:0}.os-field-row__hint,.os-field-row__error{margin:0;font-size:12px;line-height:1.4}.os-field-row__hint{color:var( --os-ui-fg-muted,#646970 )}.os-field-row__error{color:var( --os-ui-danger,#d63638 )}:host( [ layout='inline' ] ){display:grid;grid-template-columns:var( --_label-width ) minmax( 0,1fr );align-items:start;column-gap:12px;row-gap:2px}:host( [ layout='inline' ] ) .os-field-row__head{grid-column:1;grid-row:1;padding-block-start:5px}:host( [ layout='inline' ] ) .os-field-row__control{grid-column:2;grid-row:1}:host( [ layout='inline' ] ) .os-field-row__hint,:host( [ layout='inline' ] ) .os-field-row__error{grid-column:2;grid-row:2}@container ( max-width:30rem ){:host( [ layout='inline' ] ){display:flex;flex-direction:column;gap:var( --_gap )}:host( [ layout='inline' ] ) .os-field-row__head{padding-block-start:0}}::slotted( input:where(:not( [ type='checkbox' ],[ type='radio' ] ) ) ),::slotted( select ),::slotted( textarea ){box-sizing:border-box;width:100%;padding:6px 8px;border-radius:4px;background:var( --os-ui-field-bg,#fff );border:1px solid var( --os-ui-field-border,#8c8f94 );color:var( --os-ui-field-fg,#2c3338 );font:inherit}`,ch='input, select, textarea, [contenteditable="true"], [role="textbox"], [role="combobox"], [os-field-control]';let dh=0;const Vt=class Vt extends _{constructor(){super(...arguments),this.uid=`os-field-row-${++dh}`,this.syncControl=()=>{const e=this.control;if(!e)return;const t=this.error,s=this.hint,i=this.hasAttribute("required");let n="";t?n=`${this.uid}-error`:s&&(n=`${this.uid}-hint`);const r=(e.getAttribute("aria-describedby")??"").split(/\s+/).filter(c=>c&&!c.startsWith(this.uid)),a=n?[...r,n]:r;a.length?e.setAttribute("aria-describedby",a.join(" ")):e.removeAttribute("aria-describedby"),t?e.setAttribute("aria-invalid","true"):e.getAttribute("aria-invalid")==="true"&&e.removeAttribute("aria-invalid"),i&&(e.setAttribute("required",""),e.setAttribute("aria-required","true"))},this.focusControl=()=>{const e=this.control;e&&e.focus?.()}}get control(){const e=this["control-id"];return e?Array.from(this.querySelectorAll("[id]")).find(t=>t.id===e)??null:this.querySelector(ch)}render(){const e=this.label||"",t=this.hint||"",s=this.error||"",i=this.hasAttribute("required");queueMicrotask(this.syncControl);let n=null;return s?n=l`<p
1570 class="os-field-row__error"
1571 id="${this.uid}-error"
1572 role="alert"
1573 >
1574 ${s}
1575 </p>`:t&&(n=l`<p class="os-field-row__hint" id="${this.uid}-hint">
1576 ${t}
1577 </p>`),l`
1578 <div class="os-field-row__head">
1579 ${e?l`<span
1580 class="os-field-row__label"
1581 id="${this.uid}-label"
1582 @click=${this.focusControl}
1583 >
1584 ${e}${i?l`<span
1585 class="os-field-row__required"
1586 aria-hidden="true"
1587 >*</span
1588 >`:null}
1589 </span>`:null}
1590 <span class="os-field-row__action"><slot name="action"></slot></span>
1591 </div>
1592 <div class="os-field-row__control">
1593 <slot @slotchange=${this.syncControl}></slot>
1594 </div>
1595 ${n}
1596 `}};Vt.props=["label","hint","error","required","layout","control-id"],Vt.styles=[lh],Vt.help=void 0;let pi=Vt;y("os-field-row",pi);const uh=v`:host{--_gap:var( --os-ui-repeater-gap,8px );--_row-bg:var( --os-ui-repeater-row-bg,var( --os-ui-surface,#fff ) );--_border:var( --os-ui-repeater-row-border,var( --os-ui-border,#dcdcde ) );display:flex;flex-direction:column;gap:var( --_gap )}:host( [ hidden ] ){display:none}.os-repeater__rows{display:flex;flex-direction:column;gap:var( --_gap )}.os-repeater__row{display:flex;align-items:start;gap:6px;padding:8px;border:1px solid var( --_border );border-radius:6px;background:var( --_row-bg )}.os-repeater__content{flex:1 1 auto;min-width:0}.os-repeater__handles{display:flex;flex-direction:column;gap:2px;flex:0 0 auto}.os-repeater__handle,.os-repeater__remove{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:0;border-radius:4px;background:transparent;color:var( --os-ui-fg-muted,#646970 );cursor:pointer}.os-repeater__handle:hover:not(:disabled ),.os-repeater__remove:hover:not(:disabled ){background:var( --os-ui-hover,rgba( 0,0,0,0.06 ) );color:var( --os-ui-fg,#1d2327 )}.os-repeater__remove:hover:not(:disabled ){color:var( --os-ui-danger,#d63638 )}.os-repeater__handle:disabled,.os-repeater__remove:disabled{opacity:0.4;cursor:default}.os-repeater__handle:focus-visible,.os-repeater__remove:focus-visible{outline:2px solid var( --os-ui-accent,#2271b1 );outline-offset:1px}.os-repeater__remove{flex:0 0 auto}.os-repeater__empty{padding:12px;border:1px dashed var( --_border );border-radius:6px;font-size:12px;color:var( --os-ui-fg-muted,#646970 )}.os-repeater__empty:has( slot[ name='empty' ]:not(:has( * ) ) ):empty{display:none}.os-repeater__footer{display:flex;align-items:center;gap:8px}`,Kt=class Kt extends _{constructor(){super(...arguments),this._keys=[],this.onAdd=()=>{this.isDisabled||this.emit("os-repeater-add",{keys:[...this._keys]})},this.onKeydown=e=>{if(!e.altKey||!this.hasAttribute("reorderable"))return;let t=0;if(e.key==="ArrowUp"?t=-1:e.key==="ArrowDown"&&(t=1),t===0)return;const i=e.target?.closest?.('[slot^="row-"]')?.getAttribute("slot")?.slice(4);i&&(e.preventDefault(),this.onMove(i,t))}}get keys(){return this._keys}set keys(e){this._keys=Array.isArray(e)?[...e]:[],this.requestUpdate()}get isDisabled(){return this.hasAttribute("disabled")}numeric(e){const t=this.getAttribute(e);if(t===null||t.trim()==="")return null;const s=Number(t);return Number.isFinite(s)?s:null}onRemove(e){if(this.isDisabled)return;const t=this._keys.indexOf(e);this.emit("os-repeater-remove",{key:e,index:t,keys:this._keys.filter(s=>s!==e)})}onMove(e,t){if(this.isDisabled)return;const s=this._keys.indexOf(e),i=s+t;if(s<0||i<0||i>=this._keys.length)return;const n=[...this._keys];n.splice(i,0,...n.splice(s,1)),this.emit("os-repeater-move",{key:e,from:s,to:i,keys:n})}render(){const e=this._keys,t=this.isDisabled,s=this.hasAttribute("reorderable"),i=this,n=i["row-label"]||"row",r=i["add-label"]||"Add row",a=i["empty-text"]||"",c=this.numeric("min"),u=this.numeric("max"),h=c===null||e.length>c,p=u===null||e.length<u;return l`
1597 <div class="os-repeater__rows" @keydown=${this.onKeydown}>
1598 ${e.length===0?l`<div class="os-repeater__empty">
1599 <slot name="empty">${a}</slot>
1600 </div>`:e.map((g,m)=>l`
1601 <div class="os-repeater__row" data-key=${g}>
1602 ${s?l`<div class="os-repeater__handles">
1603 <button
1604 type="button"
1605 class="os-repeater__handle"
1606 ?disabled=${t||m===0}
1607 aria-label="Move ${n} up"
1608 @click=${()=>this.onMove(g,-1)}
1609 >
1610 <os-icon name="arrow-up-alt2" size="14"></os-icon>
1611 </button>
1612 <button
1613 type="button"
1614 class="os-repeater__handle"
1615 ?disabled=${t||m===e.length-1}
1616 aria-label="Move ${n} down"
1617 @click=${()=>this.onMove(g,1)}
1618 >
1619 <os-icon name="arrow-down-alt2" size="14"></os-icon>
1620 </button>
1621 </div>`:null}
1622 <div class="os-repeater__content">
1623 <slot name="row-${g}"></slot>
1624 </div>
1625 <button
1626 type="button"
1627 class="os-repeater__remove"
1628 ?disabled=${t||!h}
1629 aria-label="Remove ${n}"
1630 @click=${()=>this.onRemove(g)}
1631 >
1632 <os-icon name="trash" size="14"></os-icon>
1633 </button>
1634 </div>
1635 `)}
1636 </div>
1637 <div class="os-repeater__footer">
1638 <os-button
1639 variant="secondary"
1640 size="small"
1641 ?disabled=${t||!p}
1642 @click=${this.onAdd}
1643 >${r}</os-button
1644 >
1645 <slot name="footer"></slot>
1646 </div>
1647 `}};Kt.props=["add-label","empty-text","disabled","reorderable","min","max","row-label"],Kt.styles=[uh],Kt.help=void 0;let gi=Kt;y("os-repeater",gi);const hh=v`:host{--_bg:var( --os-ui-token-field-bg,var( --os-ui-field-bg,#fff ) );--_border:var( --os-ui-token-field-border,var( --os-ui-field-border,#8c8f94 ) );--_fg:var( --os-ui-token-field-fg,var( --os-ui-field-fg,#2c3338 ) );--_chip-bg:var( --os-ui-token-field-chip-bg,var( --os-ui-surface-raised,rgba( 0,0,0,0.06 ) ) );display:block;position:relative}:host( [ hidden ] ){display:none}.os-token-field{display:flex;flex-direction:column;gap:6px}.os-token-field__label{font-size:13px;font-weight:500;color:var( --os-ui-fg,#1d2327 )}.os-token-field__input{box-sizing:border-box;width:100%;padding:6px 8px;border-radius:4px;background:var( --_bg );border:1px solid var( --_border );color:var( --_fg );font:inherit;resize:vertical}.os-token-field__input:focus-visible{outline:2px solid var( --os-ui-accent,#2271b1 );outline-offset:1px}.os-token-field__input:disabled{opacity:0.6}.os-token-field__toolbar{display:flex;align-items:center;gap:6px}.os-token-field__catalogue{position:absolute;inset-inline-start:0;inset-block-start:100%;z-index:20;max-height:18rem;overflow-y:auto;width:100%;padding:4px;box-sizing:border-box;border:1px solid var( --os-ui-border,#dcdcde );border-radius:6px;background:var( --os-ui-surface-elevated,#fff );box-shadow:0 8px 24px rgba( 0,0,0,0.18 )}.os-token-field__group{margin:6px 6px 2px;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:0.04em;color:var( --os-ui-fg-faint,#8c8f94 )}.os-token-field__option{display:grid;grid-template-columns:minmax( 0,1fr ) auto;gap:2px 8px;width:100%;padding:6px 8px;border:0;border-radius:4px;background:transparent;color:var( --os-ui-fg,#1d2327 );font:inherit;text-align:start;cursor:pointer}.os-token-field__option:hover,.os-token-field__option:focus-visible{background:var( --os-ui-hover,rgba( 0,0,0,0.06 ) );outline:none}.os-token-field__option-label{font-size:13px;min-width:0}.os-token-field__option-token{grid-column:2;grid-row:1;padding:1px 5px;border-radius:3px;background:var( --_chip-bg );font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px;color:var( --os-ui-fg-muted,#646970 )}.os-token-field__option-sample,.os-token-field__option-description{grid-column:1 / -1;font-size:11px;color:var( --os-ui-fg-muted,#646970 )}.os-token-field__option-sample{font-style:italic}.os-token-field__hint{margin:0;font-size:12px;color:var( --os-ui-fg-muted,#646970 )}.os-token-field__preview{display:flex;gap:6px;margin:0;font-size:12px;line-height:1.4;color:var( --os-ui-fg-muted,#646970 )}.os-token-field__preview-label{flex:0 0 auto;font-weight:600}.os-token-field__preview-body{min-width:0;overflow-wrap:anywhere;white-space:pre-wrap}`,jt=class jt extends _{constructor(){super(...arguments),this._tokens=[],this._value="",this.caret=null,this.onInput=e=>{const t=e.target;this._value=t.value,this.emit("os-token-field-input",{value:this._value}),this.requestUpdate()},this.rememberCaret=()=>{const e=this.field;e&&(this.caret={start:e.selectionStart??e.value.length,end:e.selectionEnd??e.value.length})},this.toggleCatalogue=()=>{if(!(this.hasAttribute("disabled")||this.hasAttribute("readonly"))){if(this.isOpen){this.removeAttribute("open");return}this.rememberCaret(),this.setAttribute("open","")}},this.onKeydown=e=>{e.key==="Escape"&&this.isOpen&&(e.stopPropagation(),this.removeAttribute("open"),this.field?.focus())}}get tokens(){return this._tokens}set tokens(e){this._tokens=Array.isArray(e)?[...e]:[],this.requestUpdate()}get value(){return this._value}set value(e){this._value=typeof e=="string"?e:"";const t=this.field;t&&t.value!==this._value&&(t.value=this._value),this.requestUpdate()}get field(){return this.shadowRoot?.querySelector(".os-token-field__input")??null}get isOpen(){return this.hasAttribute("open")}grouped(){const e=new Map;for(const t of this._tokens){const s=t.group??"",i=e.get(s);i?i.push(t):e.set(s,[t])}return[...e.entries()].sort((t,s)=>t[0]===""?1:s[0]===""?-1:0)}preview(){let e=this._value,t=!1;for(const s of this._tokens)!s.sample||!e.includes(s.token)||(e=e.split(s.token).join(s.sample),t=!0);return t?e:null}insert(e){const t=this.field,s=this.caret??{start:this._value.length,end:this._value.length},i=this._value.slice(0,s.start),n=this._value.slice(s.end);this._value=`${i}${e.token}${n}`,this.removeAttribute("open"),t&&(t.value=this._value),this.emit("os-token-insert",{token:e.token,value:this._value}),this.emit("os-token-field-input",{value:this._value}),this.requestUpdate();const r=i.length+e.token.length;this.caret={start:r,end:r},queueMicrotask(()=>{const a=this.field;a?.focus(),a?.setSelectionRange?.(r,r)})}render(){const e=this.label||"",t=this.hint||"",s=this.placeholder||"",i=this,n=i["insert-label"]||"Insert a value",r=i["preview-label"]||"Reads as",a=this.hasAttribute("multiline"),c=this.hasAttribute("disabled"),u=this.hasAttribute("readonly"),h=Number(this.getAttribute("rows"))||4,p=this.preview(),g=this.grouped(),m=a?l`<textarea
1648 class="os-token-field__input"
1649 rows=${h}
1650 placeholder=${s}
1651 ?disabled=${c}
1652 ?readonly=${u}
1653 .value=${this._value}
1654 @input=${this.onInput}
1655 @keyup=${this.rememberCaret}
1656 @click=${this.rememberCaret}
1657 @blur=${this.rememberCaret}
1658 ></textarea>`:l`<input
1659 type="text"
1660 class="os-token-field__input"
1661 placeholder=${s}
1662 ?disabled=${c}
1663 ?readonly=${u}
1664 .value=${this._value}
1665 @input=${this.onInput}
1666 @keyup=${this.rememberCaret}
1667 @click=${this.rememberCaret}
1668 @blur=${this.rememberCaret}
1669 />`;return l`
1670 <div class="os-token-field" @keydown=${this.onKeydown}>
1671 ${e?l`<span class="os-token-field__label">${e}</span>`:null}
1672 ${m}
1673 <div class="os-token-field__toolbar">
1674 <os-button
1675 variant="ghost"
1676 size="small"
1677 ?disabled=${c||u||g.length===0}
1678 aria-expanded=${this.isOpen?"true":"false"}
1679 @click=${this.toggleCatalogue}
1680 >
1681 <os-icon name="editor-code" size="14"></os-icon>
1682 ${n}
1683 </os-button>
1684 <slot name="action"></slot>
1685 </div>
1686 ${this.isOpen?l`<div
1687 class="os-token-field__catalogue"
1688 role="listbox"
1689 aria-label=${n}
1690 >
1691 ${g.map(([b,x])=>l`
1692 ${b?l`<p class="os-token-field__group">${b}</p>`:null}
1693 ${x.map(w=>l`
1694 <button
1695 type="button"
1696 role="option"
1697 class="os-token-field__option"
1698 @click=${()=>this.insert(w)}
1699 >
1700 <span class="os-token-field__option-label"
1701 >${w.label}</span
1702 >
1703 <code class="os-token-field__option-token"
1704 >${w.token}</code
1705 >
1706 ${w.sample?l`<span class="os-token-field__option-sample"
1707 >${w.sample}</span
1708 >`:null}
1709 ${w.description?l`<span
1710 class="os-token-field__option-description"
1711 >${w.description}</span
1712 >`:null}
1713 </button>
1714 `)}
1715 `)}
1716 </div>`:null}
1717 ${t?l`<p class="os-token-field__hint">${t}</p>`:null}
1718 ${p!==null?l`<p class="os-token-field__preview">
1719 <span class="os-token-field__preview-label"
1720 >${r}</span
1721 >
1722 <span class="os-token-field__preview-body">${p}</span>
1723 </p>`:null}
1724 </div>
1725 `}};jt.props=["label","placeholder","hint","multiline","rows","disabled","readonly","insert-label","preview-label","open"],jt.styles=[hh],jt.help=void 0;let fi=jt;y("os-token-field",fi);const ph=["os-section","os-button","os-swatch","os-swatch-grid","os-segmented","os-segment","os-select","os-option","os-multiselect","os-color-field","os-range-field","os-text-field","os-number-field","os-checkbox","os-checkbox-label","os-switch","os-toast","os-toast-container","os-tabs","os-tab","os-tabpanel","os-window-button","os-menu","os-menu-item","os-context-menu","os-context-menu-option","os-confirm-dialog","os-modal","os-user-search","os-role-picker","os-flyout","os-tab-chip","os-stack","os-cluster","os-icon","os-body","os-panel","os-row","os-grid","os-display","os-disclosure","os-empty-state","os-key","os-code","os-badge","os-ribbon","os-tile","os-log","os-steps","os-step","os-table","os-spinner","os-relative-time","os-histogram","os-stat","os-avatar","os-textarea","os-chip","os-tag-input","os-form","os-save-status","os-category-picker","os-crumb-chain","os-card","os-rating-summary","os-notice","os-progress-bar","os-field-row","os-repeater","os-token-field"];function gh(o,e,t,s){const i=[o,e,...s];if(t){i.push(t.summary??"",t.status??"");for(const n of[t.props,t.slots,t.events,t.parts,t.cssProps])for(const r of n??[]){const{name:a,description:c}=r;i.push(a??"",c??"")}}return i.join(" ").toLowerCase()}function zr(o,e){return e.toLowerCase().split(/\s+/).filter(Boolean).every(s=>o.haystack.includes(s))}function fh(o){const e=o.replace(/^os-/,"").replace(/-/g," ");return e.charAt(0).toUpperCase()+e.slice(1)}function bh(){const o=[];for(const e of ph){const t=customElements.get(e);if(!t)continue;const s=t.help??null,i=s?.title??fh(e),n=t.props??[];o.push({tag:e,title:i,help:s,props:n,haystack:gh(e,i,s,n)})}return o.sort((e,t)=>e.title.localeCompare(t.title)),o}const mh=["<!-- 1 — invented name, nothing close in the registry. -->","<os-example-console-fail-due-to-unregistered-component>","</os-example-console-fail-due-to-unregistered-component>","","<!-- 2 — typo within edit distance of a real tag. -->","<os-buton></os-buton>"].join(`
1726 `);let Mr=!1;function vh(){if(Mr)return;Mr=!0,console.log(`%c⚠ wp.os — INTENTIONAL DEMO%c
1727 The next two console.error entries are fired ON PURPOSE by the
1728 OpenStation Preferences → Components tab to demonstrate the <os-*> missing-
1729 import warner. They are not real bugs.
1730
1731 1. <os-example-console-fail-due-to-unregistered-component>
1732 2. <os-buton> (typo of <os-button>)
1733
1734 Source: apps/os-settings/parts/components.ts — the "Missing-import
1735 warner — live demo" section. Remove that section in your fork
1736 if you want a quieter Components tab.`,"background: #ffb400;color: #1a1a1a;font-weight: 700;font-size: 12px;padding: 4px 8px;border-radius: 3px","color: #b25c00;font-weight: 500")}const _h=o=>{switch(o){case"experimental":return d("Experimental");case"planned":return d("Planned");default:return d("Stable")}},hs=(o,e,t)=>e?.length?l`<section class="os-settings__help-group">
1737 <h4>${o}</h4>
1738 <ul class="os-settings__help-list">${e.map(s=>l`<li>${t(s)}</li>`)}</ul>
1739 </section>`:"",ps=o=>o?l` — ${o}`:"";function yh(o){const e=o.help?.props??[],t=new Set(e.map(i=>i.name)),s=o.props.filter(i=>!t.has(i));return e.length===0&&s.length===0?"":l`
1740 <section class="os-settings__help-group">
1741 <h4>${d("Props")}</h4>
1742 <table class="os-settings__help-table">
1743 <thead>
1744 <tr>
1745 <th>${d("Name")}</th>
1746 <th>${d("Type")}</th>
1747 <th>${d("Default")}</th>
1748 <th>${d("Description")}</th>
1749 </tr>
1750 </thead>
1751 <tbody>
1752 ${e.map(i=>l`<tr>
1753 <td><code>${i.name}</code></td>
1754 <td>${i.type??"—"}</td>
1755 <td>${i.default??"—"}</td>
1756 <td>${i.description??""}</td>
1757 </tr>`)}
1758 ${s.map(i=>l`<tr>
1759 <td><code>${i}</code></td>
1760 <td>—</td>
1761 <td>—</td>
1762 <td><em>${d("Undocumented — declared via static props.")}</em></td>
1763 </tr>`)}
1764 </tbody>
1765 </table>
1766 </section>
1767 `}function wh(o){const e=o.help,t=e?.status??"stable";return l`
1768 <header class="os-settings__help-head">
1769 <h3 class="os-settings__help-title">${o.title}</h3>
1770 <code class="os-settings__help-code">&lt;${o.tag}&gt;</code>
1771 <span class="os-settings__help-badge is-${t}">${_h(t)}</span>
1772 </header>
1773 ${e?.summary?l`<p class="os-settings__help-summary">${e.summary}</p>`:""}
1774 ${e?.example?l`<section class="os-settings__help-group">
1775 <h4>${d("Example")}</h4>
1776 <div class="os-settings__help-example">${e.example}</div>
1777 </section>`:""}
1778 ${yh(o)}
1779 ${hs(d("Slots"),e?.slots,s=>l`<code>${s.name}</code>${ps(s.description)}`)}
1780 ${hs(d("Events"),e?.events,s=>l`<code>${s.name}</code>${s.detail?l` — <code>${s.detail}</code>`:""}${ps(s.description)}`)}
1781 ${hs(d("Shadow parts"),e?.parts,s=>l`<code>::part(${s.name})</code>${ps(s.description)}`)}
1782 ${hs(d("CSS custom properties"),e?.cssProps,s=>l`<code>${s.name}</code>${s.default?l` (${d("default")} <code>${s.default}</code>)`:""}${ps(s.description)}`)}
1783 ${e?"":l`<p class="os-settings__help-note">
1784 ${d("This component has no help descriptor yet. Add `static help` to its class for a fuller reference.")}
1785 </p>`}
1786 `}const xh=()=>l`
1787 <os-disclosure
1788 class="os-settings__help-warner-section"
1789 heading=${d("Missing-import warner — live demo")}
1790 hint=${d("Developer mode")}
1791 >
1792 <div class="os-settings__help-warner">
1793 <p class="os-settings__help-warner-text">
1794 ${d('Both <os-*> tags in the next piece of code are intentionally bogus, one per answer the warner has. Open the browser console: within ~2 seconds you should see two console.error entries from the framework, each pointing the developer at the fix — a name nothing in the registry comes close to, and a typo the warner can suggest a fix for ("did you mean"). Live copies of the same two tags are rendered off-screen, so the demo fires without affecting layout — including while this section is folded away. Remove this section in your fork if you want a quieter Components tab.')}
1795 </p>
1796 <pre class="os-settings__help-warner-code"><code>${mh}</code></pre>
1797 </div>
1798 </os-disclosure>
1799 <!--
1800 The live copies. Real elements, because the warner watches the
1801 document for tags nothing registered. Clipped rather than
1802 display:none, and OUTSIDE the disclosure (a closed disclosure's
1803 body is display:none), so the upgrade path runs exactly as it
1804 would on a visible element.
1805 -->
1806 <div
1807 class="os-settings__help-warner-demo"
1808 aria-hidden="true"
1809 os-preserve
1810 style="position:absolute;width:0;height:0;overflow:hidden;clip:rect(0 0 0 0);"
1811 >
1812 <os-example-console-fail-due-to-unregistered-component></os-example-console-fail-due-to-unregistered-component>
1813 <os-buton></os-buton>
1814 </div>
1815 `;function Or(o){const e=C(o).components;return e.entries??(e.entries=bh()),e.entries}function Wr(o){const e=C(o).components,t=Or(o).filter(s=>zr(s,e.query));return t.find(s=>s.tag===e.activeTag)??t[0]}const kh=(o,e)=>{const t=C(e).components;o.developerModeEnabled&&vh();const s=Or(e).filter(n=>zr(n,t.query)),i=Wr(e);return l`
1816 ${o.developerModeEnabled?xh():""}
1817 <div class="os-settings__help-layout">
1818 <div class="os-settings__help-sidebar">
1819 <os-text-field
1820 class="os-settings__help-search"
1821 type="search"
1822 label=${d("Search components")}
1823 placeholder=${d("Name, tag, prop, event…")}
1824 autocomplete="off"
1825 value=${t.query}
1826 @os-input-change=${n=>{t.query=P(n).trim(),e.repaint()}}
1827 ></os-text-field>
1828 <nav class="os-settings__help-nav" aria-label=${d("Components")}>
1829 ${s.length?"":l`<p class="os-settings__help-nav-empty">${d("No components match.")}</p>`}
1830 ${s.map(n=>l`<button
1831 type="button"
1832 class=${n.tag===i?.tag?"os-settings__help-nav-item is-active":"os-settings__help-nav-item"}
1833 aria-pressed=${n.tag===i?.tag?"true":"false"}
1834 @click=${()=>{t.activeTag=n.tag,e.repaint()}}
1835 >
1836 <span class="os-settings__help-nav-title">${n.title}</span>
1837 <span class="os-settings__help-nav-tag">&lt;${n.tag}&gt;</span>
1838 </button>`)}
1839 </nav>
1840 </div>
1841 <div class="os-settings__help-detail">
1842 ${i?wh(i):l`<p>${d("No components registered.")}</p>`}
1843 </div>
1844 </div>
1845 `};function $h(o){const e=C(o).components,t=o.root.querySelector(".os-settings__help-detail");if(!t)return;const s=Wr(o),i=s?.tag??"";i!==e.paintedTag&&(t.scrollTop=0,e.paintedTag=i);const n=s?.help?.exampleInit,r=t.querySelector(".os-settings__help-example");if(!(!n||!r||r.hasAttribute("data-os-example-ready"))){r.setAttribute("data-os-example-ready",""),customElements.upgrade(r);try{n(r)}catch(a){console.error(`[openstation] <${i}> exampleInit threw:`,a)}}}const Hr="https://openstation.blog/",Ur="https://openstation.blog/feed/",Eh="https://github.com/WordPress/openstation/";function bi(o){if(typeof o!="string"||o==="")return"";try{const e=new URL(o,window.location.href);return e.protocol==="http:"||e.protocol==="https:"?e.href:""}catch{return""}}const we=o=>typeof o=="string"?o.trim():"";function Ah(o){if(!o||typeof o!="object")return null;const e=o,t=(Array.isArray(e.items)?e.items:[]).map(s=>{if(!s||typeof s!="object")return null;const i=s,n=we(i.title),r=bi(i.url);return n===""||r===""?null:{title:n,url:r,author:we(i.author),publishedAt:we(i.publishedAt),excerpt:we(i.excerpt)}}).filter(s=>s!==null).slice(0,5);return{title:we(e.title)||d("OpenStation"),description:we(e.description)||d("A public dev diary — building a desktop OS for wp-admin."),homeUrl:bi(e.homeUrl)||Hr,feedUrl:bi(e.feedUrl)||Ur,items:t,stale:e.stale===!0}}function Ch(o){if(o==="")return"";const e=new Date(o);return Number.isNaN(e.getTime())?"":e.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function qr(o){const e=Ch(o.publishedAt);return e&&o.author?q("%1$s · %2$s",e,o.author):e||o.author}const Sh=o=>l`
1846 <article class="os-settings__about-featured">
1847 <a href=${o.url} target="_blank" rel="noopener noreferrer">
1848 <div class="os-settings__about-featured-copy">
1849 <span class="os-settings__about-kicker">${d("Latest dispatch")}</span>
1850 <h3>${o.title}</h3>
1851 ${o.excerpt?l`<p>${o.excerpt}</p>`:""}
1852 </div>
1853 <footer>
1854 <span>${qr(o)}</span>
1855 <strong>${d("Read the dispatch")} <span aria-hidden="true">↗</span></strong>
1856 </footer>
1857 </a>
1858 </article>
1859 `,Lh=o=>l`
1860 <article class="os-settings__about-card" role="listitem">
1861 <a href=${o.url} target="_blank" rel="noopener noreferrer">
1862 <span class="os-settings__about-card-meta">${qr(o)}</span>
1863 <h3>${o.title}</h3>
1864 ${o.excerpt?l`<p>${o.excerpt}</p>`:""}
1865 <strong>${d("Read more")} <span aria-hidden="true">↗</span></strong>
1866 </a>
1867 </article>
1868 `,mi=(o,e,t,s="",i=!1)=>l`
1869 <div class=${`os-settings__about-status${s}`} role=${t} aria-live=${t==="status"?"polite":null}>
1870 ${i?l`<span class="os-settings__about-spinner" aria-hidden="true"></span>`:l`<span class="dashicons dashicons-rss" aria-hidden="true"></span>`}
1871 <div>
1872 <strong>${o}</strong>
1873 <span>${e}</span>
1874 </div>
1875 </div>
1876 `;function Rh(o){if(o.kind==="loading")return mi(d("Opening the journal…"),d("The latest posts are arriving over RSS."),"status","",!0);if(o.kind==="error")return mi(d("The journal could not be reached."),d("You can still read every post on openstation.blog."),"alert"," os-settings__about-status--error");if(o.feed.items.length===0)return mi(d("No dispatches yet."),d("The journal is open and waiting for its next post."),"status");const[e,...t]=o.feed.items;return l`
1877 ${o.feed.stale?l`<p class="os-settings__about-stale" role="status">
1878 ${d("Showing the last saved copy while the journal reconnects.")}
1879 </p>`:""}
1880 <section class="os-settings__about-feed" aria-label=${d("Latest journal posts")}>
1881 ${Sh(e)}
1882 ${t.length>0?l`<div class="os-settings__about-grid" role="list">${t.map(Lh)}</div>`:""}
1883 </section>
1884 `}function Ih(o,e){const t=e.kind==="ready"?e.feed:null,s=`${o.pluginUrl??""}/assets/images/openstation-mark.svg`,i=o.pluginVersion??"";return l`
1885 <div class="os-settings__about-inner">
1886 <header class="os-settings__about-overview">
1887 <div class="os-settings__about-identity">
1888 <img src=${s} alt="" width="64" height="64" />
1889 <div>
1890 <span class="os-settings__about-eyebrow">${d("About OpenStation")}</span>
1891 <h2>${d("A desktop for WordPress.")}</h2>
1892 <p>
1893 ${d("OpenStation reshapes wp-admin into a personal workspace, with movable windows, a dock, themes, and focused tools that keep your site close at hand.")}
1894 </p>
1895 </div>
1896 </div>
1897 <div class="os-settings__about-story">
1898 <p>
1899 ${d("It is a playful, open-source experiment by Automattic exploring what WordPress can feel like when the dashboard becomes a place of its own.")}
1900 </p>
1901 <div class="os-settings__about-meta">
1902 <span>
1903 <strong>OpenStation${i?` ${i}`:""}</strong>
1904 <small>${d("An experiment by Automattic")}</small>
1905 </span>
1906 <a href=${Eh} target="_blank" rel="noopener noreferrer">
1907 ${d("View the project")} <span aria-hidden="true">↗</span>
1908 </a>
1909 </div>
1910 </div>
1911 </header>
1912 <div class="os-settings__about-journal-head">
1913 <div>
1914 <span class="os-settings__about-eyebrow">${d("OpenStation Journal")}</span>
1915 <h2>${d("Latest from the station")}</h2>
1916 <p>${t?.description||d("A public dev diary — building a desktop OS for wp-admin.")}</p>
1917 </div>
1918 <a class="os-settings__about-journal-link" href=${t?.homeUrl||Hr} target="_blank" rel="noopener noreferrer">
1919 ${d("Visit the journal")} <span aria-hidden="true">↗</span>
1920 </a>
1921 </div>
1922 ${Rh(e)}
1923 <footer class="os-settings__about-footer">
1924 <p>
1925 <strong>${d("OpenStation Journal")}</strong>
1926 <span>${d("News and field notes, delivered over RSS.")}</span>
1927 </p>
1928 <a href=${t?.feedUrl||Ur} target="_blank" rel="noopener noreferrer">
1929 <span class="dashicons dashicons-rss" aria-hidden="true"></span>
1930 ${d("RSS feed")}
1931 </a>
1932 </footer>
1933 </div>
1934 `}const Dh=(o,e)=>l`<div class="os-settings__about">${Ih(ve(e),C(e).about??{kind:"loading"})}</div>`;function Th(o){const e=C(o);if(o.state.tab!=="about"||e.about!==null)return;e.about={kind:"loading"};const t=ve(o).aboutFeedUrl;if(!t){e.about={kind:"error"},o.repaint();return}(async()=>{try{const s=await o.fetch(t,{credentials:"same-origin"});if(!s.ok)throw new Error(`about feed returned ${s.status}`);const i=await s.json(),n=i.success?Ah(i.data):null;if(!n)throw new Error("about feed returned an invalid payload");e.about={kind:"ready",feed:n}}catch(s){console.error("[openstation/about] journal feed failed:",s),e.about={kind:"error"}}o.repaint()})()}function Nh(o,e){switch(o){case"wp-blue":return d("WordPress Blue");case"indigo":return d("Indigo");case"teal":return d("Teal");case"emerald":return d("Emerald");case"amber":return d("Amber");case"rose":return d("Rose");default:return e}}function Ph(o,e){switch(o){case"compact":return d("Compact");case"default":return d("Default");case"large":return d("Large");default:return e}}function zh(o,e){switch(o){case"sharp":return d("Sharp");case"default":return d("Default");case"round":return d("Round");default:return e}}function Mh(o,e){switch(o){case"static":return d("Static");case"dynamic":return d("Dynamic");case"hidden":return d("Hidden");default:return e}}function Oh(o,e){switch(o){case"static":return d("Static");case"dynamic":return d("Dynamic");default:return e}}function Wh(o,e){switch(o){case"bottom":return d("Bottom");case"left":return d("Left");case"right":return d("Right");default:return e}}function Hh(o,e){switch(o){case"classic":return d("Split");case"unified":return d("Unified");default:return e}}function Uh(o){switch(o){case"classic":return d("Core admin menus are placed in a sidebar; plugins, apps, and OpenStation controls in a dock along the bottom edge.");case"unified":return d("Every menu in a single dock.");default:return""}}const qh="conic-gradient( #f252fc, #9af2ff, #93f0c6, #f8f2b6, #ff5a5a, #f252fc )";function Fh(o){const e=o.querySelector(".os-settings__accent-picker");if(e)try{e.showPicker()}catch{e.click()}}const Vh=o=>{const e=o.accent===Ce,t=i=>{const n=P(i);n!==Ce&&!Ns().some(r=>r.id===n)||(E({accent:n}),n===Ce&&Fh(i.currentTarget))},s=i=>{const n=i.target.value;/^#[0-9a-fA-F]{6}$/.test(n)&&E({customAccent:n,accent:Ce})};return l`
1935 <os-section
1936 heading=${d("Accent color")}
1937 description=${d("Used in focused window title bars, buttons, and focus rings.")}
1938 >
1939 <os-swatch-grid label=${d("Accent color")} mode="row" @os-pick=${t}>
1940 ${Ns().map(i=>l`<os-swatch
1941 value=${i.id}
1942 label=${Nh(i.id,i.label)}
1943 preview=${i.value}
1944 size="small"
1945 variant="accent"
1946 ?selected=${o.accent===i.id}
1947 ></os-swatch>`)}
1948 <span class="os-settings__accent-custom">
1949 <os-swatch
1950 value=${Ce}
1951 label=${d("Custom")}
1952 preview=${e?o.customAccent:qh}
1953 size="small"
1954 variant="accent"
1955 ?selected=${e}
1956 ></os-swatch>
1957 <input
1958 type="color"
1959 class="os-settings__accent-picker"
1960 tabindex="-1"
1961 aria-hidden="true"
1962 .value=${o.customAccent}
1963 @input=${s}
1964 />
1965 </span>
1966 </os-swatch-grid>
1967 </os-section>
1968 `},Kh={unified:[{kind:"win",style:"left:12%;top:14%;width:44%;height:42%"},{kind:"win",style:"left:30%;top:30%;width:44%;height:42%"},{kind:"bar",rail:"dock",style:"left:24%;bottom:10%;width:52%;height:9%"}],classic:[{kind:"bar",rail:"sidebar",style:"left:0;top:0;bottom:0;width:5%"},{kind:"win",style:"left:14%;top:14%;width:44%;height:42%"},{kind:"win",style:"left:32%;top:30%;width:44%;height:42%"},{kind:"bar",rail:"dock",style:"left:33%;bottom:10%;width:38%;height:9%"}]},Te=(o,e)=>t=>{const s=P(t);o.some(i=>i.id===s)&&e(s)},Fr=()=>Ps.map(o=>l`<os-segment value=${o.id}>${Oh(o.id,o.label)}</os-segment>`),jh=o=>d(o==="dynamic"?"The dock folds into a thin line at its edge of the screen and comes back when you move the pointer there. Windows can use the whole desktop.":"The dock is always visible, and windows open above it."),Bh=o=>{const e=r=>a=>{a.target.closest(".os-settings__dock-option")||E({desktopLayout:r})},t=r=>{const a=["os-settings__layout-card"];return o.dockBehavior==="dynamic"&&a.push("is-dock-dynamic"),r==="classic"&&o.sideDockBehavior==="dynamic"&&a.push("is-sidebar-dynamic"),a.join(" ")},s=(r,a,c,u="")=>l`<div class="os-settings__dock-option">
1969 <span class="os-settings__dock-option-label" id=${r}>${a}</span>
1970 ${c}
1971 ${u?l`<span class="os-settings__dock-option-hint">${u}</span>`:""}
1972 </div>`,i=()=>l`<div class="os-settings__dock-options">
1973 ${s("os-settings-dock-placement-label",d("Placement"),l`<os-segmented
1974 value=${o.dockPlacement}
1975 label=${d("Dock position")}
1976 @os-pick=${Te(pn,r=>E({dockPlacement:r}))}
1977 >
1978 ${pn.map(r=>l`<os-segment value=${r.id}>${Wh(r.id,r.label)}</os-segment>`)}
1979 </os-segmented>`)}
1980 </div>`,n=()=>l`<div class="os-settings__dock-options">
1981 ${s("os-settings-side-dock-behavior-label",d("Sidebar behavior"),l`<os-segmented
1982 value=${o.sideDockBehavior}
1983 label=${d("Sidebar behavior")}
1984 @os-pick=${Te(Ps,r=>E({sideDockBehavior:r}))}
1985 >
1986 ${Fr()}
1987 </os-segmented>`)}
1988 </div>`;return l`
1989 <os-section heading=${d("Desktop layout")} description=${d("Where the menus live.")}>
1990 <div class="os-settings__layout-grid" role="radiogroup" aria-label=${d("Desktop layout")}>
1991 ${pl.map(r=>{const a=o.desktopLayout===r.id;return l`<div class=${t(r.id)} @click=${e(r.id)}>
1992 <button
1993 type="button"
1994 class="os-settings__layout-choice"
1995 role="radio"
1996 aria-checked=${a?"true":"false"}
1997 >
1998 <span class="os-settings__layout-preview" aria-hidden="true">
1999 ${(Kh[r.id]??[]).map(c=>l`<span
2000 class="os-settings__layout-${c.kind}${c.rail?` is-accent is-${c.rail}`:""}"
2001 style=${c.style}
2002 ></span>`)}
2003 </span>
2004 <span class="os-settings__layout-name">${Hh(r.id,r.label)}</span>
2005 <span class="os-settings__layout-desc">${Uh(r.id)}</span>
2006 </button>
2007 ${r.id==="classic"?n():i()}
2008 </div>`})}
2009 </div>
2010 <div class="os-settings__dock-options os-settings__dock-options--page">
2011 ${s("os-settings-dock-size-label",d("Dock size"),l`<os-segmented
2012 value=${o.dockSize}
2013 label=${d("Dock size")}
2014 @os-pick=${Te(dn,r=>E({dockSize:r}))}
2015 >
2016 ${dn.map(r=>l`<os-segment value=${r.id}>${Ph(r.id,r.label)}</os-segment>`)}
2017 </os-segmented>`)}
2018 ${s("os-settings-dock-behavior-label",d("Dock behavior"),l`<os-segmented
2019 value=${o.dockBehavior}
2020 label=${d("Dock behavior")}
2021 @os-pick=${Te(Ps,r=>E({dockBehavior:r}))}
2022 >
2023 ${Fr()}
2024 </os-segmented>`,jh(o.dockBehavior))}
2025 </div>
2026 </os-section>
2027 `},Gh=o=>{const e=Sa();return e.length<=1?l``:l`
2028 <os-section
2029 heading=${d("Dock style")}
2030 description=${d("How the rail itself paints — the shipped icon strip, or anything a plugin replaces it with. Switching is instant; the dock rebuilds with the new renderer.")}
2031 >
2032 <os-segmented
2033 value=${o.dockRailRenderer}
2034 label=${d("Dock style")}
2035 @os-pick=${t=>{const s=P(t);s!==""&&E({dockRailRenderer:s})}}
2036 >
2037 ${e.map(t=>l`<os-segment value=${t.id}>${t.label}</os-segment>`)}
2038 </os-segmented>
2039 </os-section>
2040 `};function Xh(o){switch(o){case"dynamic":return d("The admin bar slides out of the way and comes back when you move the pointer to the top edge of the screen.");case"hidden":return d("The admin bar is never shown. Use the Exit OpenStation tile on the dock to get back to the classic admin.");default:return d("The admin bar is always visible above the desktop.")}}const Zh=o=>l`
2041 <os-section heading=${d("Admin bar")} description=${Xh(o.adminBarMode)}>
2042 <os-segmented
2043 value=${o.adminBarMode}
2044 label=${d("Admin bar")}
2045 @os-pick=${Te(hn,e=>E({adminBarMode:e}))}
2046 >
2047 ${hn.map(e=>l`<os-segment value=${e.id}>${Mh(e.id,e.label)}</os-segment>`)}
2048 </os-segmented>
2049 </os-section>
2050 `;function Yh(o,e,t){return l`
2051 ${Vh(o)}
2052 ${e}
2053 ${Bh(o)}
2054 ${Gh(o)}
2055 ${Zh(o)}
2056 `}const Qh=o=>l`
2057 <os-section heading=${d("Window corners")} description=${d("How rounded the corners of windows are.")}>
2058 <os-segmented
2059 value=${o.windowRadius}
2060 label=${d("Window corners")}
2061 @os-pick=${e=>{const t=P(e);un.some(s=>s.id===t)&&E({windowRadius:t})}}
2062 >
2063 ${un.map(e=>l`<os-segment value=${e.id}>${zh(e.id,e.label)}</os-segment>`)}
2064 </os-segmented>
2065 </os-section>
2066 `,Vr=[{value:sl,label:()=>d("Default (per reveal)")},{value:200,label:()=>d("Very fast — 200 ms")},{value:320,label:()=>d("Fast — 320 ms")},{value:460,label:()=>d("Normal — 460 ms")},{value:700,label:()=>d("Slow — 700 ms")},{value:1100,label:()=>d("Very slow — 1100 ms")}],Jh=[{id:"focus",label:()=>d("When a related window is focused")},{id:"always",label:()=>d("Always")},{id:"off",label:()=>d("Off")}],vi=(o,e,t,s,i)=>l`<os-select
2067 value=${e}
2068 label=${o}
2069 @os-pick=${n=>{const r=P(n);r!==""&&(r===t||s.some(a=>a.id===r))&&i(r)}}
2070 >
2071 <os-option value=${t}>${d("None")}</os-option>
2072 ${s.map(n=>l`<os-option value=${n.id}>${n.label}</os-option>`)}
2073 </os-select>`,ep=o=>{const e=Pl(),t=il(),s=Wl(),i=(n,r,a,c)=>{const u=n.find(h=>h.id===r);return r!==a&&u?.description?u.description:c};return l`
2074 <os-section
2075 heading=${d("Unfocused windows")}
2076 description=${i(e,o.unfocusEffect,zs,d("Apply a visual treatment to every window except the one you are working in."))}
2077 >
2078 ${vi(d("Unfocused window effect"),o.unfocusEffect,zs,e,n=>E({unfocusEffect:n}))}
2079 </os-section>
2080 <os-section
2081 heading=${d("Window reveal")}
2082 description=${i(t,o.windowReveal,ts,d("Uncover a window’s content when it finishes loading, instead of fading it in."))}
2083 >
2084 ${vi(d("Reveal style"),o.windowReveal,ts,t,n=>E({windowReveal:n}))}
2085 <os-select
2086 value=${String(o.windowRevealDuration)}
2087 label=${d("Reveal speed")}
2088 @os-pick=${n=>{const r=Number(P(n));Vr.some(a=>a.value===r)&&E({windowRevealDuration:r})}}
2089 >
2090 ${Vr.map(n=>l`<os-option value=${String(n.value)}>${n.label()}</os-option>`)}
2091 </os-select>
2092 </os-section>
2093 <os-section
2094 heading=${d("Window links")}
2095 description=${i(s,o.windowLinkRenderer,An,d("Draw a visual tie between windows showing related content — a post and its comments or media."))}
2096 >
2097 ${vi(d("Link style"),o.windowLinkRenderer,An,s,n=>E({windowLinkRenderer:n}))}
2098 <os-select
2099 value=${o.windowLinkVisibility}
2100 label=${d("Show links")}
2101 @os-pick=${n=>{const r=P(n);(r==="focus"||r==="always"||r==="off")&&E({windowLinkVisibility:r})}}
2102 >
2103 ${Jh.map(n=>l`<os-option value=${n.id}>${n.label()}</os-option>`)}
2104 </os-select>
2105 </os-section>
2106 `},tp=o=>l`
2107 <os-section
2108 heading=${d("Closing every window")}
2109 description=${d("⌥⌘W on macOS, Ctrl+Alt+W elsewhere, closes every open window on the desktop you are looking at. Unticked, it closes them without asking — a page holding unsaved changes still gets to raise its own prompt.")}
2110 >
2111 <os-checkbox-label
2112 label=${d("Ask before closing all windows")}
2113 ?checked=${o.confirmCloseAllWindows}
2114 @os-checkbox-change=${e=>E({confirmCloseAllWindows:O(e)})}
2115 ></os-checkbox-label>
2116 </os-section>
2117 `,sp=(o,e)=>l`
2118 ${Qh(o)}
2119 ${ep(o)}
2120 ${tp(o)}
2121 `,op="",ip={accent:"pulse",desktopLayout:"unified",dockPlacement:"bottom"};function np(o){if(o===op)return Object.keys(vn(ip)).length>0;const e=_l(o);return e?Object.keys(vn(e.recommendedOsSettings)).length>0:!1}const gs="",Kr="OpenStation";function rp(o){const e=o.trim().split(/\s+/).filter(Boolean);return e.length===0?"?":e.length>=2?(e[0][0]+e[1][0]).toUpperCase():e[0].slice(0,2).toUpperCase()}async function jr(o,e){try{const t=await o.json();if(t&&typeof t.message=="string"&&t.message!=="")return t.message}catch{}return`${e} (HTTP ${o.status}).`}function Br(o){const e=o?.serverWallpapers;Array.isArray(e)&&de(W.WALLPAPERS_SERVER_CHANGED,{wallpapers:e})}async function ap(o,e){const t=new FormData;t.append("file",e,e.name);const s=await o.fetch(ve(o).desktopThemesUrl,{method:"POST",body:t});if(!s.ok)throw new Error(await jr(s,"Theme upload failed"));const i=await s.json();return Br(i),i}async function lp(o,e){const t=await o.fetch(`${ve(o).desktopThemesUrl}/${encodeURIComponent(e)}`,{method:"DELETE"});if(!t.ok)throw new Error(await jr(t,"Theme delete failed"));try{Br(await t.json())}catch{}}async function Gr(o,e){const t=C(o).themes;if(!t.busy){t.busy=!0,t.error="",o.repaint();try{yl(await ap(o,e))}catch(s){t.error=s instanceof Error?s.message:d("That theme could not be installed.")}finally{t.busy=!1,o.repaint()}}}async function cp(o,e){if(!await o.host.confirm?.({title:d("Delete this theme?"),message:q(d("“%s” will be removed from this site for everyone. This cannot be undone."),e.name),confirmLabel:d("Delete"),danger:!0}))return;const s=C(o).themes;s.error="";try{await lp(o,e.slug),wl(e.slug),ee().desktopTheme===e.slug&&E({desktopTheme:gs})}catch(i){s.error=i instanceof Error?i.message:d("That theme could not be deleted.")}o.repaint()}const dp=(o,e,t,s)=>l`
2122 <div class="os-settings__theme-card-wrap">
2123 <button
2124 type="button"
2125 class="os-settings__theme-card"
2126 aria-pressed=${t?"true":"false"}
2127 data-theme-slug=${e.slug}
2128 @click=${()=>E({desktopTheme:e.slug})}
2129 >
2130 <span class="os-settings__theme-preview">
2131 ${e.previewUrl?l`<img src=${e.previewUrl} alt="" aria-hidden="true" draggable="false" />`:l`<span class="os-settings__theme-initials" aria-hidden="true">${rp(e.name)}</span>`}
2132 </span>
2133 <span class="os-settings__theme-name">${e.name}</span>
2134 <span class="os-settings__theme-meta">
2135 ${e.version!==""?q(d("Version %s"),e.version):""}
2136 </span>
2137 </button>
2138 ${s&&e.source!=="code"?l`<button
2139 type="button"
2140 class="os-settings__theme-delete"
2141 aria-label=${q(d("Delete %s"),e.name)}
2142 @click=${()=>void cp(o,e)}
2143 >×</button>`:""}
2144 </div>
2145 `,up=o=>l`
2146 <div class="os-settings__theme-card-wrap">
2147 <button
2148 type="button"
2149 class="os-settings__theme-card os-settings__theme-card--system"
2150 aria-pressed=${o?"true":"false"}
2151 @click=${()=>E({desktopTheme:gs})}
2152 >
2153 <span class="os-settings__theme-preview os-settings__theme-preview--system" aria-hidden="true"></span>
2154 <span class="os-settings__theme-name">${Kr}</span>
2155 <span class="os-settings__theme-meta">${d("The look OpenStation ships with")}</span>
2156 </button>
2157 </div>
2158 `,hp=o=>{const e=C(o).themes,t=s=>s.dataTransfer?.files?.[0]??s.currentTarget.files?.[0];return l`<div
2159 class=${e.busy?"os-settings__theme-upload os-settings__theme-upload--busy":"os-settings__theme-upload"}
2160 @dragover=${s=>{s.preventDefault(),s.currentTarget.classList.add("os-settings__theme-upload--dragover")}}
2161 @dragleave=${s=>{s.currentTarget.classList.remove("os-settings__theme-upload--dragover")}}
2162 @drop=${s=>{s.preventDefault(),s.currentTarget.classList.remove("os-settings__theme-upload--dragover");const i=t(s);i&&Gr(o,i)}}
2163 >
2164 <label class="os-settings__theme-upload-label">
2165 <input
2166 type="file"
2167 accept=".zip,application/zip"
2168 class="os-settings__file-input"
2169 ?disabled=${e.busy}
2170 @change=${s=>{const i=s.currentTarget,n=i.files?.[0];n&&Gr(o,n),i.value=""}}
2171 />
2172 <span class="os-settings__theme-upload-plus" aria-hidden="true">+</span>
2173 <span class="os-settings__theme-upload-prompt">
2174 ${e.busy?d("Installing…"):d("Drop a theme .zip here, or click to upload")}
2175 </span>
2176 </label>
2177 </div>`},pp=(o,e)=>{if(!np(o))return"";const t=o===gs?Kr:e.find(s=>s.slug===o)?.name;return t===void 0?"":l`<div class="os-settings__theme-recommendation">
2178 <os-button variant="secondary" @click=${()=>dc(o)}>
2179 ${q(d("Apply %s’s recommended layout and effects"),t)}
2180 </os-button>
2181 </div>`},gp=(o,e)=>{const t=vl(),s=e.data.canManageDesktopThemes,i=C(e).themes.error;return l`
2182 ${i!==""?l`<os-notice tone="error">${i}</os-notice>`:""}
2183 <os-section heading=${d("Installed")}>
2184 <div class="os-settings__theme-grid" role="group" aria-label=${d("Desktop theme")}>
2185 ${up(o.desktopTheme===gs)}
2186 ${t.map(n=>dp(e,n,o.desktopTheme===n.slug,s))}
2187 ${s?hp(e):""}
2188 </div>
2189 ${pp(o.desktopTheme,t)}
2190 </os-section>
2191 `},fp=[{kinds:["core"],heading:()=>d("WordPress Core"),description:()=>d("The admin menus WordPress itself registers.")},{kinds:["plugin","app"],heading:()=>d("Plugins & Apps"),description:()=>d("Menus from installed plugins and apps.")},{kinds:["control"],heading:()=>d("OpenStation"),description:()=>d("The OpenStation’s own controls.")}];function bp(){const o=window.wp?.os;return typeof o?.getNavItems=="function"?o.getNavItems():[]}function mp(o){return o.locked||o.transient?!1:o.menu||o.entry?!0:o.tile?.placeable===!0}const vp=o=>d(o==="classic"?"Choose where each menu shows up: on the dock/sidebar, on the desktop wallpaper, both, or hidden entirely. Changes apply instantly.":"Choose where each menu shows up: on the dock, on the desktop wallpaper, both, or hidden entirely. Changes apply instantly."),_p=(o,e)=>[{id:"rail",label:Rl(o,e)==="sidebar"?d("In the sidebar"):d("On the dock")},{id:"desktop",label:d("On the desktop")},{id:"both",label:d("On both")},{id:"hidden",label:d("Hidden")}],yp=(o,e)=>l`<div class="os-nav-settings__row" data-item-id=${o.id}>
2192 <div class="os-nav-settings__identity">
2193 ${dr(o.icon,{title:o.title,className:"os-nav-settings__icon",slot:Sl(o.id)})}
2194 <div class="os-nav-settings__title">${o.title}</div>
2195 </div>
2196 <os-select
2197 plain
2198 label=${o.title}
2199 value=${Il(o,e.navPlacement)}
2200 @os-pick=${t=>{const s=P(t);(s==="both"||s==="rail"||s==="desktop"||s==="hidden")&&E({navPlacement:{...e.navPlacement,[o.id]:s}})}}
2201 >
2202 ${_p(o.kind,e.desktopLayout).map(t=>l`<os-option value=${t.id}>${t.label}</os-option>`)}
2203 </os-select>
2204 </div>`,wp=o=>{const e=bp().filter(mp),t=fp.map(s=>({...s,rows:Dl(e.filter(i=>s.kinds.includes(i.kind)))})).filter(s=>s.rows.length>0);return l`
2205 <p class="os-settings__page-description os-nav-settings__lead">${vp(o.desktopLayout)}</p>
2206 ${t.length===0?l`<os-empty-state
2207 heading=${d("Nothing registered yet")}
2208 description=${d("Plugins and the admin menu will appear here once they’re registered.")}
2209 ></os-empty-state>`:t.map(s=>l`
2210 <os-section class="os-nav-settings" heading=${s.heading()} description=${s.description()}>
2211 ${s.rows.map(i=>yp(i,o))}
2212 </os-section>
2213 `)}
2214 `},fs=3,Xr=[{id:"auto",label:()=>d("Automatic")},{id:"desktop",label:()=>d("Always desktop")},{id:"mobile",label:()=>d("Always mobile")}];function xp(o){return o.filter(e=>!e.locked&&!e.transient&&!!(e.windowId||e.tile||e.menu?.url||e.entry?.url))}const kp=(o,e)=>{const t=xp(Nl()),s=new Set(t.map(u=>u.id)),i=(Fn().mode?.tabBar??[]).filter(u=>s.has(u)),n=(o.mobileTabs.length>0?o.mobileTabs:i).slice(0,fs),r=n.length>=fs,a=u=>{const h=P(u);Xr.some(p=>p.id===h)&&E({mobileLayout:h})},c=u=>h=>{const p=O(h),g=n.filter(m=>m!==u);p&&g.length<fs&&g.push(u),E({mobileTabs:g})};return l`
2215 <os-section
2216 heading=${d("Layout")}
2217 description=${d("Automatic follows the screen: phones get the phone layer, everything wider gets the desktop. Force either to preview or to opt out.")}
2218 >
2219 <os-segmented value=${o.mobileLayout} label=${d("Mobile layout")} @os-pick=${a}>
2220 ${Xr.map(u=>l`<os-segment value=${u.id}>${u.label()}</os-segment>`)}
2221 </os-segmented>
2222 </os-section>
2223
2224 <os-section
2225 heading=${d("Tab bar")}
2226 description=${q(d("Home and the app switcher are always there. Pin up to %d apps between them; leave it empty for the default set."),fs)}
2227 >
2228 ${t.length===0?l`<p class="os-features__hint">${d("Nothing to pin yet.")}</p>`:t.map(u=>{const h=n.includes(u.id);return l`
2229 <div class="os-features__item">
2230 <os-checkbox-label
2231 label=${u.title}
2232 ?checked=${h}
2233 ?disabled=${!h&&r}
2234 @os-checkbox-change=${c(u.id)}
2235 ></os-checkbox-label>
2236 </div>
2237 `})}
2238 </os-section>
2239 `},xe={size:null},te={appearance:()=>I("color",xe),themes:()=>{const o=document.createElementNS("http://www.w3.org/2000/svg","svg");return o.setAttribute("viewBox","0 0 24 24"),o.setAttribute("fill","currentColor"),o.setAttribute("aria-hidden","true"),o.innerHTML='<path fill-rule="evenodd" clip-rule="evenodd" d="M20 12a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-1.5 0a6.5 6.5 0 0 1-6.5 6.5v-13a6.5 6.5 0 0 1 6.5 6.5Z" />',o},windows:()=>I("windows",xe),navigation:()=>{const o=document.createElementNS("http://www.w3.org/2000/svg","svg");return o.setAttribute("viewBox","0 0 24 24"),o.setAttribute("fill","currentColor"),o.setAttribute("aria-hidden","true"),o.innerHTML='<path d="M12 4c-4.4 0-8 3.6-8 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 14.5c-3.6 0-6.5-2.9-6.5-6.5S8.4 5.5 12 5.5s6.5 2.9 6.5 6.5-2.9 6.5-6.5 6.5zM9 16l4.5-3L15 8.4l-4.5 3L9 16z" />',o},mobile:()=>I("window",xe),features:()=>I("settings",xe),help:()=>I("widgets",xe),"os-file-associations":()=>{const o=document.createElementNS("http://www.w3.org/2000/svg","svg");return o.setAttribute("viewBox","0 0 24 24"),o.setAttribute("fill","currentColor"),o.setAttribute("aria-hidden","true"),o.innerHTML='<path d="M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z" /><path d="M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z" />',o},about:()=>I("info",xe)},Zr=o=>`os-settings-tab-host-${o}`;function pe(o,e=""){return l`
2240 <header class="os-settings__page-header">
2241 <h2 class="os-settings__page-title">${o}</h2>
2242 ${e?l`<p class="os-settings__page-description">${e}</p>`:""}
2243 </header>
2244 `}function $p(o,e){return o.capability==="manage_options"?e:!0}function Yr(o){return o<20?1:o<40?2:3}function Qr(o){const e=o.data.isAdmin,t=[{id:"appearance",order:10,label:d("Appearance"),icon:te.appearance,panel:(s,i)=>l`${pe(d("Appearance"),d("Personalize your desktop. Changes apply instantly and are saved to this browser."))}${Yh(s,Rc(s,i))}`},{id:"themes",order:12,label:d("Themes"),icon:te.themes,panel:(s,i)=>l`${pe(d("Themes"),d("A desktop theme repaints every token at once. A coarser version of what Appearance does one control at a time."))}${gp(s,i)}`},{id:"windows",order:18,label:d("Windows"),icon:te.windows,panel:(s,i)=>l`${pe(d("Windows"),d("How windows look, how they arrive, and how they behave when they are not the one you are using."))}${sp(s)}`},{id:"navigation",order:22,label:d("Navigation"),icon:te.navigation,panel:(s,i)=>l`${pe(d("Navigation"))}${wp(s)}`},{id:"mobile",order:24,label:d("Mobile"),icon:te.mobile,panel:(s,i)=>l`${pe(d("Mobile"),d("On a phone the desktop becomes a home screen, one full-screen app at a time, and a tab bar. Choose when that happens and what the bar holds."))}${kp(s)}`},{id:"features",order:30,label:d("Features"),icon:te.features,panel:(s,i)=>l`${pe(d("Features"),d("The assistant, the developer tools, and the betas. Every switch here affects only your account and takes effect immediately."))}${Oc(s,i)}`}];e&&t.push({id:"help",order:40,label:d("Components"),icon:te.help,panel:(s,i)=>l`${pe(d("Components"),d("Every <os-*> web component shipped by this plugin, with its props, slots, and a live example."))}${kh(s,i)}`}),t.push({id:"about",order:Number.MAX_SAFE_INTEGER,label:d("About"),icon:te.about,padding:"0",panel:Dh});for(const s of Fl())$p(s,e)&&t.push({id:`ext-${s.id}`,order:s.order??100,label:s.label,icon:te[s.id],tab:s,panel:()=>l`<div data-host=${Zr(s.id)}></div>`});return t.sort((s,i)=>s.order-i.order),t}function Ep(o,e){const t=C(o);for(const s of e){const i=s.tab;if(!i)continue;const n=o.root.querySelector(`[data-host="${Zr(i.id)}"]`);if(!(!n||t.mountedTabs.get(n)===i)){t.mountedTabs.set(n,i);try{i.render(n,{isAdmin:o.data.isAdmin,getOsSettings:ee,subscribeOsSettings:qn})}catch(r){console.error("[openstation] settings tab render threw:",i.id,r)}}}}const Ap=["heading","description","label","placeholder"];function Cp(o,e){const t=new Map;for(const s of e){const i=o.querySelector(`os-tabpanel[for="${s.id}"]`),n=[s.label,i?.textContent??""];for(const r of Array.from(i?.querySelectorAll("[heading],[description],[label],[placeholder]")??[]))for(const a of Ap)n.push(r.getAttribute(a)??"");t.set(s.id,n.join(" ").replace(/\s+/g," ").toLowerCase())}return t}const Sp="appearance";function Jr(o,e){if(!e.icon)return l`<span class="os-settings__nav-glyph-blank" aria-hidden="true"></span>`;let t=o.glyphs.get(e.id);return t||(t=e.icon(),o.glyphs.set(e.id,t)),t}function Lp(o){const e=ee(),t=C(o),s=Qr(o),i=s.some(h=>h.id===o.state.tab)?o.state.tab:Sp,{query:n,index:r}=t.search,a=h=>n===""||(r?.get(h.id)??"").includes(n);let c=0;const u=h=>{var p;(p=t.search).index??(p.index=Cp(o.root,s)),t.search.query=h.target.value.trim().toLowerCase(),o.repaint()};return l`
2245 <div class="os-settings">
2246 <div class="os-settings__search">
2247 <label class="os-settings__search-field">
2248 ${Jr(t,{id:"__search",order:0,label:"",icon:()=>I("search",{size:null}),panel:()=>l``})}
2249 <input
2250 type="search"
2251 class="os-settings__search-input"
2252 placeholder=${d("Search settings")}
2253 aria-label=${d("Search settings")}
2254 aria-controls="os-settings-nav"
2255 @input=${u}
2256 />
2257 </label>
2258 </div>
2259 <os-tabs
2260 id="os-settings-nav"
2261 orientation="vertical"
2262 value=${i}
2263 label=${d("Settings sections")}
2264 os-bind="tab"
2265 >
2266 ${s.map((h,p)=>{const g=p>0&&Yr(h.order)!==Yr(s[p-1].order),m=a(h);return m&&c++,l`<os-tab
2267 value=${h.id}
2268 data-group-start=${g?"true":null}
2269 data-search-hidden=${m?null:"true"}
2270 >${Jr(t,h)}${h.label}</os-tab>`})}
2271 </os-tabs>
2272 <p class="os-settings__search-empty" ?hidden=${n===""||c>0}>
2273 ${d("No settings match that.")}
2274 </p>
2275 ${""}
2276 <os-select
2277 class="os-settings__page-select"
2278 label=${d("Settings section")}
2279 value=${i}
2280 os-bind="tab"
2281 >
2282 ${s.map(h=>l`<os-option value=${h.id}>${h.label}</os-option>`)}
2283 </os-select>
2284 <os-panel class="os-settings__footer">
2285 <os-button variant="ghost" @click=${cc}>${d("Reset to defaults")}</os-button>
2286 </os-panel>
2287 ${s.map(h=>l`<os-tabpanel for=${h.id}>
2288 <os-panel padding=${h.padding??null}>${h.panel(e,o)}</os-panel>
2289 </os-tabpanel>`)}
2290 </div>
2291 `}const Rp=ga(Bs,{local:{tab:(o,e)=>{const t=String(e.value??"");t!==""&&(o.tab=t)}},view:Lp,mounted:o=>{const e=C(o);Kl(ee,Sc),e.previews=sc(o.root),Aa(),Ul().catch(()=>{});const t=()=>o.repaint(),s=[qn(t),ma(t),La(t),zl(t),rl(t),Hl(t),xl(t),Vl(t)];return()=>{for(const i of s)i();Yn(o),e.previews?.dispose(),e.previews=null}},updated:o=>{Cc(o),C(o).previews?.sync(),$c(o),Ep(o,Qr(o)),$h(o),Th(o),Jn(o)}});return ys.default=Rp,Object.defineProperties(ys,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),ys}({});
2292