PluginProbe
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin / 1.1.11
OpenStation: Desktop Windows, Dock & Virtual Desktops for WP Admin v1.1.11
1.1.11 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 All 35 releases
← All changes | assets/js/window-system.min.js +26 -22 1.0.1 → 1.1.11 View file →
@@ -1,6 +1,6 @@
1 -(function(){"use strict";function pe(){const e=window.wp?.hooks;if(!e)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 e}function _t(e,t,o,n){pe().addAction(e,t,o,n)}function wt(e,t){return pe().removeAction(e,t)}function x(e,t,...o){return pe().applyFilters(e,t,...o)}function f(e,...t){pe().doAction(e,...t)}const u={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",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_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",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",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_SNAP_CHANGED:"os.arrange.snap.changed",ARRANGE_SNAP_CELL_SIZE:"os.arrange.snap.cell-size",ARRANGE_CUSTOM_ACTION:"os.arrange.custom-action",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",PRIMARY_DESKTOP_ID:"os.primary-desktop-id",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",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"},an="os.activity.";function $e(e){return an+String(e).replace(/[^a-zA-Z0-9_.-]/g,".")}let ln=0;const Pe={publish(e,t){f($e(e),t)},subscribe(e,t){const o=`os/activity-sub/${++ln}`,n=$e(e);_t(n,o,i=>t(i));let s=!1;return()=>{s||(s=!0,wt(n,o))}},filter(e,t,...o){return x($e(e),t,...o)}},ze=new Map,He=new Map;function me(e,t,o,n){let s=e.get(t);if(!s){if(!n)return;s=new Map,e.set(t,s)}let i=s.get(o);if(!i){if(!n)return;i=new Set,s.set(o,i)}return i}function yt(e,t,o,n){const s={channel:o,windowId:t},i=me(e,t,o,!1);if(i)for(const c of Array.from(i))try{c(n,s)}catch(a){typeof console<"u"&&console.error(`[openstation] window-channel subscriber for "${o}" threw:`,a)}const r=me(e,t,"*",!1);if(r)for(const c of Array.from(r))try{c(n,s)}catch(a){typeof console<"u"&&console.error(`[openstation] window-channel wildcard subscriber for "${t}" threw:`,a)}}function cn(e,t,o){const n=me(ze,e,t,!0);n.add(o);let s=!1;return()=>{s||(s=!0,n.delete(o))}}function vt(e,t,o){yt(ze,e,t,o)}function dn(e,t,o){const n=me(He,e,t,!0);n.add(o);let s=!1;return()=>{s||(s=!0,n.delete(o))}}function un(e,t,o){yt(He,e,t,o)}const ge=new Set,be=new Set,te=new Map;function Et(e){return ge.has(e)}function _e(e){be.has(e)||(be.add(e),f(u.WINDOW_CONTENT_LOADING,{windowId:e}),typeof document<"u"&&document.dispatchEvent(new CustomEvent("os-window-content-loading",{detail:{windowId:e}})))}function $(e){if(!ge.has(e)){ge.add(e);const t=te.get(e);if(t){te.delete(e);for(const o of t)try{o.flush()}catch(n){typeof console<"u"&&console.error(`[openstation] flushing queued window-send for "${o.channel}" threw:`,n)}}}be.delete(e)&&(f(u.WINDOW_CONTENT_LOADED,{windowId:e}),typeof document<"u"&&document.dispatchEvent(new CustomEvent("os-window-content-loaded",{detail:{windowId:e}})))}function hn(e,t,o,n){let s=te.get(e);s||(s=[],te.set(e,s)),s.push({channel:t,payload:o,flush:n})}function fn(e){ze.delete(e),He.delete(e),ge.delete(e),be.delete(e),te.delete(e)}const pn=new Map;function mn(e){return pn.get(e)??null}const gn="openstation";function At(){return window.wp?.i18n}function b(e,t=gn){return At()?.__(e,t)??e}function Fe(e,...t){const o=At()?.sprintf;if(o)return o(e,...t);let n=0;return e.replace(/%(?:(\d+)\$)?[sd]/g,(s,i)=>{const r=i?Number.parseInt(i,10)-1:n++;return String(t[r]??"")})}let bn=0;function _n(e,t={}){const o=++bn,n=d=>`desktop-mode/native-render-ctx/${e}/${o}/${d}`,s=new AbortController,i=[],r=(d,h,_,p)=>{const m=n(h);_t(d,m,w=>{_(w)&&p(w)});const k=()=>{wt(d,m)};return i.push(k),k},c=d=>!!d&&typeof d=="object"&&d.windowId===e;return{ctx:{window:{send(d,h){typeof d!="string"||d===""||vt(e,d,h)},on(d,h){return typeof d!="string"||d===""||typeof h!="function"?()=>{}:dn(e,d,h)},markLoading(){_e(e)},markReady(){$(e)}},markLoading(){_e(e)},markReady(){$(e)},signal:s.signal,onResize(d){return typeof d!="function"?()=>{}:r(u.WINDOW_BODY_RESIZED,"on-resize",c,h=>{const{width:_,height:p}=h;try{d(_,p)}catch(m){f(u.SHELL_ERROR,{scope:"native-render-ctx/onResize",id:e,error:m})}})},onHide(d){return typeof d!="function"?()=>{}:r(u.WINDOW_MINIMIZED,"on-hide",c,()=>{try{d()}catch(h){f(u.SHELL_ERROR,{scope:"native-render-ctx/onHide",id:e,error:h})}})},onShow(d){return typeof d!="function"?()=>{}:r(u.WINDOW_RESTORED,"on-show",c,()=>{try{d()}catch(h){f(u.SHELL_ERROR,{scope:"native-render-ctx/onShow",id:e,error:h})}})},params:t},dispose:()=>{try{s.abort()}catch{}for(;i.length;){const d=i.pop();try{d?.()}catch{}}}}}const wn=["post_type","page","taxonomy","path","post","c","tag_ID","item","p"];function St(e){try{const t=new URL(e,window.location.origin),o=new URLSearchParams;for(const s of wn){const i=t.searchParams.get(s);i&&o.set(s,i)}o.sort();const n=o.toString();return t.pathname.replace(/\/+$/,"")+(n?`?${n}`:"")}catch{return e}}function G(e){try{const t=new URL(e,window.location.origin);return t.searchParams.delete("openstation_chromeless"),t.searchParams.delete("desktop_mode_portal"),t.pathname.replace(/\/+$/,"")+"?"+t.searchParams.toString()}catch{return e}}function yn(e){if(!e)return 214;let t=5381;for(let o=0;o<e.length;o++)t=Math.imul(t,33)+e.charCodeAt(o);return(t%360+360)%360}const kt="__openStationSharedStores";function vn(){const e=window;let t=e[kt];return t||(t=new Map,e[kt]=t),t}function T(e,t){const o=vn();let n=o.get(e);n||(n={state:t(),listeners:new Set,rebuild:t},o.set(e,n));const s={get state(){return n.state},set state(i){n.state=i},getState(){return n.state},notify(){for(const i of Array.from(n.listeners))try{i(n.state)}catch(r){console.error(`[desktop-mode/shared-store:${e}] subscriber threw:`,r)}},subscribe(i){return n.listeners.add(i),()=>{n.listeners.delete(i)}},setState(i){const r=n.state;if(typeof r!="object"||r===null){console.warn(`[desktop-mode/shared-store:${e}] setState called on a primitive store; use the state setter instead.`);return}Object.assign(r,i),s.notify()},reset(){const i=n.rebuild(),r=n.state;if(typeof r=="object"&&r!==null&&typeof i=="object"&&i!==null){const c=r;for(const a of Object.keys(c))delete c[a];Object.assign(c,i)}else n.state=i;n.listeners.clear()}};return s}const Ct=T("desktop-mode/dock-rail-registry",()=>({registry:new Map,listeners:new Set,activeId:"default"}));Ct.state.registry,Ct.state.listeners;function En(e,t){if(!e||typeof e!="object")return["def (not an object)"];const o=e,n=[];for(const s of t)s.valid(o)||n.push(`${s.field} (${s.message})`);return n}class An extends Error{constructor(t,o,n){super(`[openstation] ${t} registration rejected — fields: `+o.join(", ")+"."),this.name="RegistrationError",this.kind=t,this.errors=o,this.def=n}}function Ue(e,t,o){if(t.length!==0)throw new An(e,t,o)}function xt(e,t,o){typeof console>"u"||console.warn(`[openstation] ${e} registration rejected — fields: `+t.join(", ")+".",o)}const q=[[0,0],[100,0],[100,100],[0,100]],Sn=48,kn=80,Be=6,Ge=8,It=4,Lt=3,Tt=64,qe=105,V=2;function Rt(e){return`${Math.round(e*1e3)/1e3}%`}function j(e){return e.slice().reverse()}function oe(e,t,o,n){return[[e,t],[o,t],[o,n],[e,n]]}function Cn(e,t,o,n){const s=[];for(let i=0;i<n;i++){const r=i/n*Math.PI*2;s.push([e+Math.cos(r)*o,t+Math.sin(r)*o])}return s}function P(e,t=[]){const o=[],n=s=>{o.push(`${Rt(s[0])} ${Rt(s[1])}`)};for(const s of e)n(s);if(t.length>0){n(e[0]);for(const s of t){for(const i of s)n(i);n(s[0]),n(e[0])}}return`polygon( ${o.join(", ")} )`}function Nt(e){return P(q,[j(Cn(50,50,e,Sn))])}function Ot(e){return P(q,[j(oe(50-e,-V,50+e,100+V))])}function Dt(e){const t=100/Be,o=[];for(let n=0;n<Be;n++){const s=n*t;o.push(j(oe(-V,s,100+V,s+e)))}return P(q,o)}function Wt(e){return P(q,[j(oe(-V,50-e,100+V,50+e))])}function Mt(e){const t=100/Ge,o=[];for(let n=0;n<Ge;n++){const s=n*t;o.push(j(oe(s,-V,s+e,100+V)))}return P(q,o)}function $t(e){return P(q,[j([[50,50-e],[50+e,50],[50,50+e],[50-e,50]])])}function Pt(e){const t=100/It,o=100/Lt,n=[];for(let s=0;s<Lt;s++)for(let i=0;i<It;i++){const r=i*t+t/2,c=s*o+o/2,a=t/2*e,l=o/2*e;n.push(j(oe(r-a,c-l,r+a,c+l)))}return P(q,n)}function zt(e){const t=-Math.PI/2,o=e/180*Math.PI,n=[[50,50]];for(let s=0;s<Tt;s++){const i=t+s/(Tt-1)*o;n.push([50+Math.cos(i)*qe,50+Math.sin(i)*qe])}return P(q,[j(n)])}function xn(){return{from:Nt(0),to:Nt(kn)}}function In(){return{from:Ot(0),to:Ot(52)}}function Ln(){return{from:Dt(0),to:Dt(100/Be+.5)}}function Tn(){return{from:Wt(0),to:Wt(52)}}function Rn(){return{from:Mt(0),to:Mt(100/Ge+.5)}}function Nn(){return{from:$t(0),to:$t(qe)}}function On(){return{from:Pt(0),to:Pt(1.04)}}function Dn(){return{from:zt(0),to:zt(360)}}function Wn(){return{from:"inset( 0% 0% 0% 0% )",to:"inset( 0% 0% 100% 0% )"}}function Mn(){return{from:"inset( 0% 0% 0% 0% )",to:"inset( 0% 0% 0% 100% )"}}function $n(){return{from:P([[-60,0],[100,0],[100,100],[0,100]]),to:P([[100,0],[260,0],[260,100],[160,100]])}}const Ve=6,je=100,Q=je/2,we=200,Ht=90,Ft=["#5c5c6d","#525261","#484855","#3e3e49","#34343d","#2a2a31"],Pn="#101014",zn=1.25,J="http://www.w3.org/2000/svg";let Hn=0;function ye(e){return Math.round(e*1e3)/1e3}function Ke(e){return e/Ve*Math.PI*2-Math.PI/2}function Fn(e){const o=Ke(e)+Math.PI/Ve+Math.PI/2;return{x:Math.cos(o),y:Math.sin(o)}}function Un(e){const t=Ke(e),o=Ke(e+1);return[[Q,Q],[Q+Math.cos(t)*we,Q+Math.sin(t)*we],[Q+Math.cos(o)*we,Q+Math.sin(o)*we]]}function Ut(e,t){const o=Un(e),n=document.createElementNS(J,"path");return n.setAttribute("d",`M ${o.map(([s,i])=>`${ye(s)} ${ye(i)}`).join(" L ")} Z`),t?n.setAttribute("fill","#fff"):(n.setAttribute("fill",Ft[e%Ft.length]),n.setAttribute("stroke",Pn),n.setAttribute("stroke-width",String(zn)),n.setAttribute("vector-effect","non-scaling-stroke"),n.setAttribute("stroke-linejoin","round")),n}function Bn(){const e=`os-iris-${++Hn}`,t=document.createElementNS(J,"svg");t.setAttribute("viewBox",`0 0 ${je} ${je}`),t.setAttribute("preserveAspectRatio","none"),t.setAttribute("aria-hidden","true"),t.style.width="100%",t.style.height="100%",t.style.display="block";const o=document.createElementNS(J,"defs"),n=document.createElementNS(J,"mask");n.setAttribute("id",e);const s=document.createElementNS(J,"g"),i=document.createElementNS(J,"g");i.setAttribute("mask",`url(#${e})`);const r=[];for(let a=0;a<Ve;a++){const l=Ut(a,!0),d=Ut(a,!1);s.appendChild(l),i.appendChild(d),r.push({el:l,index:a},{el:d,index:a})}n.appendChild(s),o.appendChild(n),t.appendChild(o),t.appendChild(i);const c=document.createElement("div");return c.appendChild(t),{element:c,play:a=>r.map(({el:l,index:d})=>{const h=Fn(d),_=ye(h.x*Ht),p=ye(h.y*Ht);return l.animate([{transform:"translate( 0px, 0px )"},{transform:`translate( ${_}px, ${p}px )`}],{duration:a.duration,easing:a.easing,delay:a.delay,fill:"both"})})}}const Xe="none",Gn=70,qn=600,Bt=T("desktop-mode/window-reveal-registry",()=>({registry:new Map,listeners:new Set})),Gt=Bt.state.registry,Vn=Bt.state.listeners,qt=/^[a-z0-9_/-]+$/;function Vt(e){const t=/^\s*([a-zA-Z-]+)\s*\(/.exec(e);return t?t[1].toLowerCase():""}const jn=0;function Kn(e){return typeof e!="number"||!Number.isFinite(e)?Gn:Math.min(qn,Math.max(0,e))}function Xn(e){return typeof e.render=="function"?[]:Array.isArray(e.layers)&&e.layers.length>0?e.layers:typeof e.from=="string"&&typeof e.to=="string"?[{from:e.from,to:e.to}]:[]}function jt(e,t){const o=[],n=typeof e.from=="string"&&e.from.trim()!=="",s=typeof e.to=="string"&&e.to.trim()!=="";if(n||o.push(`${t}.from (missing — the clip-path covering the window)`),s||o.push(`${t}.to (missing — the clip-path uncovering the window)`),n&&s){const i=Vt(e.from),r=Vt(e.to);i===""||r===""?o.push(`${t}.from|to (must be shape functions, e.g. \`inset( … )\` or \`polygon( … )\` — bare keywords like \`none\` cannot be animated)`):i!==r&&o.push(`${t}.from|to (must use the same shape function to interpolate — got \`${i}()\` and \`${r}()\`)`)}return o}function Yn(e){if(typeof KeyframeEffect!="function")return!0;try{return new KeyframeEffect(null,null,{easing:e}),!0}catch{return!1}}function W(e){const t=[];if(!e||typeof e!="object")t.push("def (not an object)");else{typeof e.id!="string"||e.id.trim()===""?t.push("id (missing)"):qt.test(e.id.trim().toLowerCase())?e.id.trim().toLowerCase()===Xe&&t.push('id ("none" is reserved)'):t.push(`id (must match ${qt} — lowercase alphanum, hyphens, underscores, slashes for vendor/sub-id)`),(typeof e.label!="string"||e.label.trim()==="")&&t.push("label (missing)");const n=e.render!==void 0,s=Array.isArray(e.layers),i=e.from!==void 0||e.to!==void 0;n&&typeof e.render!="function"?t.push("render (not a function)"):n&&(s||i)?t.push("render|layers|from|to (supply exactly one of: a from/to pair, a layers array, or a render function)"):n||(s&&i?t.push("layers|from|to (supply EITHER a single from/to pair OR a layers array, not both)"):s?(e.layers.length===0&&t.push("layers (empty — supply at least one matched pair)"),e.layers.forEach((r,c)=>{if(!r||typeof r!="object"){t.push(`layers[ ${c} ] (not an object)`);return}t.push(...jt(r,`layers[ ${c} ]`))})):t.push(...jt(e,"").map(r=>r.replace(/^\./,"")))),e.easing!==void 0&&(typeof e.easing!="string"||e.easing.trim()===""?t.push("easing (not a non-empty string)"):Yn(e.easing)||t.push("easing (not an easing the browser can parse — `Element.animate()` would throw at play time, with the covering surface already over the window)"))}Ue("WindowReveal",t,e);const o=e.id.trim().toLowerCase();Gt.set(o,{...e,id:o}),Jn()}function Zn(){const e=Array.from(Gt.values()),t=x(u.WINDOW_REVEALS,e);return Array.isArray(t)?t:(typeof console<"u"&&console.warn("[openstation] `os.window-reveals` filter returned a non-array; falling back to registry list."),e)}function Qn(e){return Zn().find(t=>t.id===e)}function Jn(){const e=Array.from(Vn);for(const t of e)try{t()}catch(o){typeof console<"u"&&console.error("[openstation] window-reveal registry listener threw:",o)}}W({id:"sweep",label:b("Sweep"),description:b("A straight edge travels across the window, uncovering the page behind it."),...Mn(),duration:420}),W({id:"iris",label:b("Iris"),description:b("The page opens out from the centre of the window, like a camera shutter."),...xn(),duration:520}),W({id:"curtain",label:b("Curtain"),description:b("Two panels part from the middle of the window and slide off the sides."),...In(),duration:480}),W({id:"blinds",label:b("Blinds"),description:b("Six horizontal slats retract at once, letting the page through between them."),...Ln(),duration:560}),W({id:"diagonal",label:b("Diagonal"),description:b("A slanted edge sweeps off the trailing corner of the window."),...$n(),duration:460}),W({id:"rise",label:b("Rise"),description:b("The page rises into the window from the bottom edge upward."),...Wn(),duration:440}),W({id:"shutter",label:b("Shutter"),description:b("Two panels part from the middle of the window and slide off the top and bottom."),...Tn(),duration:480}),W({id:"slats",label:b("Slats"),description:b("Eight vertical slats retract at once, letting the page through between them."),...Rn(),duration:560}),W({id:"diamond",label:b("Diamond"),description:b("The page opens out from the centre of the window through a growing rhombus."),...Nn(),duration:520}),W({id:"mosaic",label:b("Mosaic"),description:b("The page arrives as a grid of tiles, each opening out from its own centre."),...On(),duration:600}),W({id:"obturator",label:b("Camera shutter"),description:b("Six wedges slide aside in unison, opening a hexagonal aperture from the centre like the iris of a camera lens."),render:Bn,duration:720,edgeLag:0}),W({id:"radar",label:b("Radar"),description:b("A spoke sweeps a full turn around the centre of the window, uncovering the page behind it."),...Dn(),duration:760});const Kt={dockSize:["compact","default","large"],desktopLayout:["classic","unified","spatial"],windowRadius:["sharp","default","round"],adminBarMode:["static","dynamic","hidden"]},Xt=["dockRailRenderer","windowReveal","accent"],Yt={windowRevealDuration:{min:80,max:4e3}},es=/^[a-z0-9_-]+$/;[...Object.keys(Kt),...Xt,...Object.keys(Yt)];function ts(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t=e,o={},n={};for(const[s,i]of Object.entries(Kt)){const r=t[s];typeof r=="string"&&i.includes(r)&&(o[s]=r)}for(const s of Xt){const i=t[s];typeof i=="string"&&es.test(i)&&(o[s]=i)}for(const[s,i]of Object.entries(Yt)){const r=t[s];typeof r=="number"&&Number.isFinite(r)&&(n[s]=Math.min(i.max,Math.max(i.min,Math.round(r))))}return{...o,...n}}const os=/^[a-z0-9_-]+$/,Zt=128;function ns(e){return typeof e!="string"||e===""||e.length>2048?!1:e.startsWith("dashicons-")||e.startsWith("https://")||e.startsWith("http://")||e.startsWith("data:image/")}function ss(e){if(!e||typeof e!="object")return null;const t=e,o=typeof t.slug=="string"?t.slug:"";if(!os.test(o))return null;const n={};if(t.icons&&typeof t.icons=="object"){let a=0;for(const[l,d]of Object.entries(t.icons)){if(a>=Zt)break;l===""||!ns(d)||(n[l]=d,a+=1)}}const s={};if(t.tokens&&typeof t.tokens=="object")for(const[a,l]of Object.entries(t.tokens))typeof l=="string"&&(s[a]=l);const i=[];if(Array.isArray(t.fonts))for(const a of t.fonts)typeof a=="string"&&a!==""&&i.push(a);const r={};if(t.iconColors&&typeof t.iconColors=="object"){let a=0;for(const[l,d]of Object.entries(t.iconColors)){if(a>=Zt)break;l===""||typeof d!="string"||d===""||(r[l]=d,a+=1)}}const c=a=>typeof t[a]=="string"?t[a]:"";return{id:c("id")||o,slug:o,name:c("name")||o,version:c("version"),author:c("author"),description:c("description"),previewUrl:c("previewUrl"),cssUrl:c("cssUrl"),cssText:c("cssText"),tokens:s,fonts:i,icons:n,iconColors:r,recommendedOsSettings:ts(t.recommendedOsSettings),installedAt:typeof t.installedAt=="number"?t.installedAt:0,source:t.source==="code"?"code":"upload"}}function is(){const t=window.openStationConfig?.serverDesktopThemes,o=[];if(Array.isArray(t))for(const n of t){const s=ss(n);s&&o.push(s)}return{themes:o,activeId:null,activeIcons:null,activeIconColors:null}}const rs=T("desktop-mode/desktop-themes",is);function Qt(){return rs}function Jt(e){const t=Qt().state;if(t.activeIcons===null||!e)return null;const o=t.activeIcons[e];if(typeof o!="string"||o==="")return null;const n=x(u.DESKTOP_THEME_ICON,o,{slot:e,themeId:t.activeId??""});return typeof n=="string"&&n!==""?n:null}function eo(e){const t=Qt().state;if(t.activeIconColors===null||!e)return null;const o=t.activeIconColors[e];if(typeof o!="string"||o==="")return null;const n=x(u.DESKTOP_THEME_ICON_COLOR,o,{slot:e,themeId:t.activeId??""});return typeof n=="string"&&n!==""?as(n):null}function as(e){const t=e.trim();if(t===""||t.length>64||/[;{}<>"'\\]/.test(t))return null;let o=0;for(const n of t)if(n==="(")o+=1;else if(n===")"&&(o-=1,o<0))return null;return o===0?t:null}function ls(e){return typeof e!="string"||e===""||e.length>4096||!/^(https?:\/\/|data:image\/)/i.test(e)?!1:!/['"()\\<>\s]/.test(e)}function to(e,t,o){if(!ls(t))return!1;const n=`url("${t}") center / contain no-repeat`;return e.style.backgroundImage="none",e.style.backgroundColor=o,e.style.setProperty("-webkit-mask",n),e.style.setProperty("mask",n),!0}const oo="data:image/svg+xml;base64,",ve=new Map;function cs(e){const t=ve.get(e);if(t!==void 0)return t;let o=!1;try{o=atob(e.slice(oo.length)).includes("currentColor")}catch{}return ve.size>=256&&ve.clear(),ve.set(e,o),o}function no(e,t){const o=t.className??"",n=t.title??"";let s=null;if(t.slot){const a=Jt(t.slot);a!==null&&(e=a),s=eo(t.slot)}if(typeof e=="string"&&e.startsWith("dashicons-")){const a=document.createElement("span");return a.className=`dashicons ${e} ${o}`.trim(),a.setAttribute("aria-hidden","true"),s!==null&&(a.style.color=s),a}if(s!==null&&typeof e=="string"){const a=document.createElement("span");if(a.className=o,a.setAttribute("aria-hidden","true"),a.style.display="inline-block",to(a,e,s))return a}if(typeof e=="string"&&e.startsWith("data:image/svg+xml;base64,")){const a=e.slice(oo.length);if(/^[A-Za-z0-9+/=]+$/.test(a)){const l=document.createElement("span");return l.className=o,l.setAttribute("aria-hidden","true"),l.style.display="inline-block",cs(e)&&to(l,e,"currentColor")||(l.style.backgroundImage=`url("${e}")`,l.style.backgroundRepeat="no-repeat",l.style.backgroundPosition="center",l.style.backgroundSize="contain"),l}}if(typeof e=="string"&&/^data:image\/(png|jpeg|jpg|gif|webp|x-icon|vnd\.microsoft\.icon);base64,/i.test(e)){const a=e.indexOf(","),l=a>=0?e.slice(a+1):"";if(/^[A-Za-z0-9+/=]+$/.test(l))return so(e,o)}if(typeof e=="string"&&(e.startsWith("http://")||e.startsWith("https://")))return so(e,o);const i=document.createElement("span");i.className=`${o} os-icon-letter`.trim(),i.setAttribute("aria-hidden","true");const r=ds(n);i.textContent=r;const c=yn(n);return i.style.backgroundColor=`hsl( ${c}, 60%, 45% )`,i.style.color="#fff",i.style.display="inline-flex",i.style.alignItems="center",i.style.justifyContent="center",i.style.fontWeight="600",i.style.borderRadius="4px",i}function so(e,t){const o=document.createElement("img");return o.className=t,o.src=e,o.alt="",o.setAttribute("aria-hidden","true"),o.draggable=!1,o}function ds(e){const t=(e??"").trim();if(t==="")return"?";const o=t.split(/\s+/);if(o.length>=2)return(o[0][0]+o[1][0]).toUpperCase();const n=o[0];return n.length>=2?n.slice(0,2).toUpperCase():n.toUpperCase()}const ne={OS_SETTINGS:"OS_SETTINGS",RECYCLE_BIN:"RECYCLE_BIN",BUG_REPORT:"BUG_REPORT",EXIT_OPENSTATION:"EXIT_OPENSTATION",PWA_INSTALL:"PWA_INSTALL"},us={"desktop-mode-os-settings":ne.OS_SETTINGS,"desktop-mode-recycle-bin":ne.RECYCLE_BIN,"desktop-mode-bug-report":ne.BUG_REPORT,"os-exit":ne.EXIT_OPENSTATION,"os-pwa-install":ne.PWA_INSTALL};function io(e){if(typeof e!="string"||e==="")return"";const t=us[e];if(t)return t;const o=e.toLowerCase().replace(/[^a-z0-9_-]/g,"");return o===""?"":`APP:${o}`}function hs(e){if(typeof e!="string"||e==="")return"";const t=e.replace(/^core\//,"").toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,"");return t===""?"":`WINDOW_CONTROL_${t}`}function Ye(e,t){const o=hs(t),n=Jt(o),s=eo(o);if(n===null&&s===null)return!1;if(s!==null?e.style.setProperty("--os-ui-btn-icon-color",s):e.style.removeProperty("--os-ui-btn-icon-color"),n===null)return e.style.setProperty("color",s),!1;if(n.startsWith("dashicons-")){e.removeAttribute("icon-src"),e.removeAttribute("icon");const i=document.createElement("span");return i.className=`dashicons ${n}`,i.setAttribute("aria-hidden","true"),s!==null&&(i.style.color=s),e.appendChild(i),!0}return e.setAttribute("icon-src",n),!0}const H=0,Ze=40,ro=5,fs=ro*ro,ps=3e3,ms=120,Qe="os-window__loading",ao="os-window__loading--visible",gs=T("desktop-mode/window-reveal-active",()=>({id:Xe,duration:jn}));function bs(){const e=gs.state.id;return!e||e===Xe?null:Qn(e)??null}const Je="os-window__reveal",_s="os-window__reveal--edge",ws="os-window__reveal--custom",lo="data-os-reveal",co="data-os-reveal-layer",ys=T("desktop-mode/window-reveal-rendered",()=>({plays:new WeakMap})).state.plays;function uo(e,t,o,n){const s=document.createElement("div");s.className=n?`${Je} ${_s}`:Je;const i=n?e.edgeColor:t.color??e.surfaceColor;return typeof i=="string"&&i!==""&&(s.style.background=i),s.setAttribute("aria-hidden","true"),s.setAttribute(lo,e.id),s.setAttribute(co,String(o)),s.style.clipPath=t.from,s}function vs(){const e=bs();if(!e)return[];if(typeof e.render=="function"){let n;try{n=e.render()}catch(i){return typeof console<"u"&&console.error(`[openstation] window reveal "${e.id}" render threw:`,i),[]}if(!n?.element||typeof n.play!="function")return[];const s=n.element;return s.classList.add(Je),s.classList.add(ws),s.setAttribute("aria-hidden","true"),s.setAttribute(lo,e.id),s.setAttribute(co,"0"),ys.set(s,n.play),[s]}const t=Xn(e);if(t.length===0)return[];const o=[];return Kn(e.edgeLag)>0&&t.forEach((n,s)=>o.push(uo(e,n,s,!0))),t.forEach((n,s)=>o.push(uo(e,n,s,!1))),o}const ho="os-window__body--loading",fo="data-os-loading-at",po="data-os-loading-cycle";function Es(e){return e.getAttribute(po)??"0"}function As(e){e.setAttribute(fo,String(Date.now())),e.setAttribute(po,String(Number(Es(e))+1))}function Ss(e,t){const o=Number(e.getAttribute(fo)),n=Number.isFinite(o)&&o>0?Date.now()-o:0,s=ms-n;if(s<=0){t.classList.add(ao);return}window.setTimeout(()=>{t.isConnected&&e.classList.contains(ho)&&t.classList.add(ao)},s)}const ks=Symbol.for("desktop-mode/window-config");function Cs(e,t){e[ks]=t}const mo=window.location.origin;function Ee(e){const t=new URL(e,mo);return t.origin!==mo?null:(t.searchParams.set("openstation_chromeless","1"),t.toString())}function ee(){const e=document.querySelectorAll(".os-window--fullscreen:not(.os-window--minimized)").length>0;document.body.classList.toggle("os-has-fullscreen-window",e)}function xs(){const e=document.createElement("div");e.className=Qe,e.setAttribute("aria-hidden","true");const t=document.createElement("os-spinner");return t.setAttribute("preset","classic"),t.setAttribute("size","clamp(96px, 14vw, 192px)"),t.setAttribute("label",b("Loading window content")),e.appendChild(t),e}function Is(e){let t=xs();const o={windowId:e.id,config:e};if(typeof e.loading?.render=="function")try{e.loading.render(t,o)}catch(n){typeof console<"u"&&console.error(`[openstation] loading.render threw for "${e.id}":`,n)}try{const n=x(u.WINDOW_LOADING_OVERLAY,t,o);n instanceof HTMLElement&&(t=n)}catch(n){typeof console<"u"&&console.error(`[openstation] WINDOW_LOADING_OVERLAY filter threw for "${e.id}":`,n)}return t&&!t.classList.contains(Qe)&&t.classList.add(Qe),t}function K(e){const t=document.createElement("span");return t.className=`os-window__slot os-window__slot--${e}`,t.dataset.slot=e,t}function Ls(e){const t=document.createElement("div");t.className="os-window",e.native&&t.classList.add("os-window--native"),t.id=`wp-window-${e.id}`,t.setAttribute("role","dialog"),t.setAttribute("aria-labelledby",`wp-window-title-${e.id}`),t.style.left=`${e.x}px`,t.style.top=`${e.y}px`,t.style.width=`${e.width}px`,t.style.height=`${e.height}px`;const o=document.createElement("div");o.className="os-window__titlebar";const n=document.createElement("os-window-button");n.setAttribute("icon","menu"),Ye(n,"core/menu"),n.setAttribute("aria-label",b("Window actions")),n.setAttribute("aria-haspopup","menu"),n.setAttribute("aria-expanded","false"),n.classList.add("os-window__btn"),n.classList.add("os-window__menu-btn");const s=document.createElement("os-menu");s.classList.add("os-window__menu-panel"),s.hidden=!0;const i=document.createElement("os-menu-item");if(i.setAttribute("role","menuitemcheckbox"),i.setAttribute("value","startup"),i.classList.add("os-window__menu-item"),i.classList.add("os-window__menu-item--startup"),i.textContent=b("Open on startup"),s.appendChild(i),e.multi){const g=document.createElement("os-menu-item");g.setAttribute("role","menuitem"),g.setAttribute("value","open-another"),g.setAttribute("icon","dashicons-plus-alt2"),g.classList.add("os-window__menu-item"),g.classList.add("os-window__menu-item--open-another"),g.textContent=Fe(b("Open another %s"),e.title),s.appendChild(g)}if(!e.native){const g=document.createElement("os-menu-item");g.setAttribute("role","menuitem"),g.setAttribute("value","open-in-new-window"),g.setAttribute("icon","dashicons-plus-alt"),g.classList.add("os-window__menu-item"),g.classList.add("os-window__menu-item--open-in-new-window"),g.textContent=b("Open in new window"),s.appendChild(g)}if(!e.native){const g=document.createElement("os-menu-item");g.setAttribute("role","menuitem"),g.setAttribute("value","reload"),g.setAttribute("icon","dashicons-update"),g.classList.add("os-window__menu-item"),g.classList.add("os-window__menu-item--reload"),g.textContent=b("Reload"),s.appendChild(g);const L=document.createElement("os-menu-item");L.setAttribute("role","menuitem"),L.setAttribute("value","open-external"),L.setAttribute("icon","dashicons-external"),L.classList.add("os-window__menu-item"),L.classList.add("os-window__menu-item--open-external"),L.textContent=b("Open in browser tab"),s.appendChild(L)}const r=K("icon"),c=no(e.icon,{title:e.title,className:"os-window__icon",slot:io(e.id)});r.appendChild(c);const a=K("title"),l=document.createElement("span");l.className="os-window__title",l.id=`wp-window-title-${e.id}`,l.textContent=e.title,a.appendChild(l);const d=K("before-titlebar"),h=K("before-icon"),_=K("after-title"),p=K("before-controls"),m=K("after-controls"),k=K("after-titlebar"),w=document.createElement("div");w.className="os-window__controls";const E=document.createElement("div");E.className="os-window__screen-meta";const y=document.createElement("span");y.className="os-window__custom-buttons os-window__custom-buttons--left";const v=document.createElement("span");v.className="os-window__custom-buttons os-window__custom-buttons--right";const S=document.createElement("span");S.className="os-window__activity";const N=document.createElement("os-save-status");N.setAttribute("mode","dot"),N.setAttribute("animation","modem"),N.setAttribute("phase","idle"),N.setAttribute("data-os-activity-indicator",""),S.appendChild(N),o.appendChild(h),o.appendChild(r),o.appendChild(S),o.appendChild(a),o.appendChild(_),o.appendChild(y),o.appendChild(E),n&&s&&s.children.length>0&&(o.appendChild(n),o.appendChild(s)),o.appendChild(v),o.appendChild(p),o.appendChild(w),o.appendChild(m);for(const g of Array.from(o.children))g.setAttribute("data-os-default-chrome","");const I=document.createElement("div");if(I.className=`os-window__body ${ho}`,As(I),e.native)I.classList.add("os-window__body--native");else{const g=document.createElement("iframe");g.className="os-window__iframe",g.setAttribute("name",`os-frame-${e.id}`);const L=e.url?Ee(e.url):null;g.src=L??"about:blank",I.appendChild(g);const Me=()=>{$(e.id)};g.addEventListener("load",Me)}const he=Is(e);I.appendChild(he),Ss(I,he);for(const g of vs())I.appendChild(g);_e(e.id);const rn=[];for(const g of["ne","nw","se","sw"]){const L=document.createElement("div");L.className=`os-window__resize-handle os-window__resize-handle--${g}`,L.dataset.dir=g,L.setAttribute("aria-hidden","true"),rn.push(L)}if(t.appendChild(d),t.appendChild(o),t.appendChild(k),!e.native){const g=document.createElement("nav");if(g.className="os-window__tabs",g.setAttribute("role","tablist"),g.setAttribute("aria-label",Fe(b("%s sub-pages"),e.title)),e.submenu&&e.submenu.length>0&&e.url){const L=G(e.url),Me=e.parentUrl??e.url,oa=G(Me),na=e.submenu.some(fe=>G(fe.url)===oa)?[...e.submenu]:[{title:e.title,url:Me},...e.submenu];for(const fe of na){const z=document.createElement("button");z.className="os-window__tab",z.dataset.kind="submenu",z.setAttribute("type","button"),z.setAttribute("role","tab"),z.dataset.url=fe.url,z.textContent=fe.title,G(fe.url)===L?(z.classList.add("os-window__tab--active"),z.setAttribute("aria-selected","true")):z.setAttribute("aria-selected","false"),g.appendChild(z)}}t.appendChild(g)}t.appendChild(I);for(const g of rn)t.appendChild(g);return Cs(t,e),t}const Ts="os-confirm-dialog";let et=null;function Ae(){return typeof window.customElements<"u"&&!!window.customElements.get(Ts)}function Rs(e){return new Promise((t,o)=>{const n=document.querySelector('script[data-os-shell-overlays="1"]'),s=()=>{if(Ae()){t();return}o(new Error("[openstation] shell-overlays bundle loaded but did not register the overlay components."))};if(n){Ae()?s():(n.addEventListener("load",s),n.addEventListener("error",()=>o(new Error("failed to load shell-overlays bundle"))));return}const i=document.createElement("script");i.src=e,i.async=!0,i.dataset.osShellOverlays="1",i.addEventListener("load",s),i.addEventListener("error",()=>o(new Error("failed to load shell-overlays bundle"))),document.head.appendChild(i)})}function Ns(e){return Ae()||!e?Promise.resolve():(et||(et=Rs(e)),et)}function Os(){return window.openStationConfig?.shellOverlaysBundleUrl??""}function Ds(e,t){const o=Os();if(Ae()||!o){t();return}Ns(o).then(()=>{e()&&t()}).catch(n=>{typeof console<"u"&&console.warn("[openstation] shell-overlays failed to load; menu/dialog suppressed:",n)})}const Ws=4e3,Ms=200;function go(e){const t=Pe.filter("os/toast-requested",{...e});if(!t||t.cancel===!0)return()=>{};let o=!1,n=null;return Ds(()=>!o,()=>{n=$s(t)}),()=>{o=!0,n&&n()}}function $s(e){const t=Ps(),o=document.createElement("os-toast");o.textContent=e.message,e.action&&(o.setAttribute("action",e.action.label),o.addEventListener("os-toast-action",()=>{e.action?.onClick(),i()})),e.dismissible&&(o.setAttribute("dismissible",""),o.addEventListener("os-toast-dismiss",()=>{e.onDismiss?.(),i()})),t.appendChild(o);let n=!1,s=null;const i=()=>{n||(n=!0,s!==null&&(window.clearTimeout(s),s=null),o.setAttribute("state","out"),window.setTimeout(()=>{o.remove()},Ms))};return requestAnimationFrame(()=>{o.setAttribute("state","in")}),e.persistent||(s=window.setTimeout(i,e.duration??Ws)),Pe.publish("os/toast-shown",{...e}),i}function Ps(){const e=document.querySelector("os-toast-container");if(e)return e;const t=document.createElement("os-toast-container");return document.body.appendChild(t),t}function zs(e,t){let o;try{o=new URL(t,window.location.origin)}catch{return null}const n=St(t);let s=null,i=-1;for(const r of e){const c=r.dataset.url;if(!c||St(c)!==n)continue;let a;try{a=new URL(c,window.location.origin)}catch{continue}let l=0,d=!1;for(const[h,_]of a.searchParams)if(!(h==="openstation_chromeless"||h==="desktop_mode_portal")){if(o.searchParams.get(h)!==_){d=!0;break}l++}!d&&l>i&&(s=r,i=l)}return s}function bo(e,t){const o=e.element.querySelectorAll('.os-window__tab[data-kind="submenu"]');if(!o.length)return;if(e._activeTabId!=="primary"){for(const i of o)i.classList.remove("os-window__tab--active"),i.setAttribute("aria-selected","false");return}const n=G(t);let s=null;for(const i of o){const r=i.dataset.url;if(r&&G(r)===n){s=i;break}}s||(s=zs(o,t));for(const i of o){const r=i===s;i.classList.toggle("os-window__tab--active",r),i.setAttribute("aria-selected",r?"true":"false")}}function _o(e,t,o){if(!e.iframe)return;const n=e.element.querySelector(".os-window__tabs"),s=e.element.querySelector(".os-window__body");if(!n||!s)return;Hs(e,n);const i=`ext-${++e._externalTabSeq}`,r=document.createElement("button");r.className="os-window__tab os-window__tab--external",r.dataset.kind="external",r.dataset.tabId=i,r.setAttribute("type","button"),r.setAttribute("role","tab"),r.setAttribute("aria-selected","false"),r.title=t;const c=document.createElement("span");c.className="os-window__tab-label",c.textContent=o,r.appendChild(c);const a=document.createElement("os-tab-chip");a.setAttribute("variant","detach"),a.dataset.tabAction="detach",a.dataset.tabId=i,a.setAttribute("aria-label",b("Open in a new browser tab")),a.title=b("Open in a new browser tab"),r.appendChild(a);const l=document.createElement("os-tab-chip");l.setAttribute("variant","close"),l.dataset.tabAction="close",l.dataset.tabId=i,l.setAttribute("aria-label",b("Close tab")),l.title=b("Close tab"),r.appendChild(l),n.appendChild(r);const d=document.createElement("iframe");d.className="os-window__iframe os-window__iframe--external",d.dataset.tabId=i,d.style.display="none",d.src=t,s.appendChild(d);let h=!1;const _=()=>{h=!0};d.addEventListener("load",_,{once:!0});const p=window.setTimeout(()=>{h||(d.removeEventListener("load",_),Us(e,i))},ps),m=()=>{d.removeEventListener("load",_),window.clearTimeout(p)};e._externalTabs.set(i,{tabEl:r,iframe:d,url:t,label:o,cancelProbe:m}),se(e,i),r.scrollIntoView({behavior:"smooth",inline:"end",block:"nearest"}),e._emitChange("state")}function Hs(e,t){if(t.querySelector('[data-kind="main"]')||t.querySelector('[data-kind="submenu"]'))return;const o=document.createElement("button");o.className="os-window__tab os-window__tab--main os-window__tab--active",o.dataset.kind="main",o.setAttribute("type","button"),o.setAttribute("role","tab"),o.setAttribute("aria-selected","true"),o.textContent=e.config.title||"Main",t.prepend(o)}function se(e,t){if(e._activeTabId===t)return;e._activeTabId=t,e.iframe&&(e.iframe.style.display=t==="primary"?"":"none");for(const[n,s]of e._externalTabs)s.iframe.style.display=t===n?"":"none";e.element.querySelectorAll(".os-window__tab").forEach(n=>{let s;n.dataset.kind==="main"?s=t==="primary":n.dataset.kind==="external"?s=n.dataset.tabId===t:s=t==="primary"&&n.classList.contains("os-window__tab--active"),n.classList.toggle("os-window__tab--active",s),n.setAttribute("aria-selected",s?"true":"false")})}function tt(e,t){const o=e._externalTabs.get(t);o&&(o.cancelProbe(),o.tabEl.remove(),o.iframe.remove(),e._externalTabs.delete(t),e._activeTabId===t&&se(e,"primary"),e._externalTabs.size===0&&e.element.querySelector(".os-window__tab--main")?.remove(),e._emitChange("state"))}function Fs(e,t){const o=e._externalTabs.get(t);if(!o)return;let n=o.url;try{const s=o.iframe.contentWindow?.location.href;s&&s!=="about:blank"&&(n=s)}catch{}window.open(n,"_blank","noopener"),tt(e,t)}function Us(e,t){const o=e._externalTabs.get(t);if(!o)return;const{url:n,label:s}=o;tt(e,t),go({message:Fe(b(`Opened "%s" in a new browser tab — this site doesn't allow embedding.`),s),action:{label:b("Open"),onClick:()=>{window.open(n,"_blank","noopener")}}}),window.open(n,"_blank","noopener")}function Bs(e){return e._externalTabs.size}function Gs(e){const t=[];for(const o of e._externalTabs.values()){let n=o.url;try{const s=o.iframe.contentWindow?.location.href;s&&s!=="about:blank"&&(n=s)}catch{}t.push({url:n,label:o.label})}return t}function qs(e,t){const o=t.target,n=o.closest("[data-tab-action]");if(n){t.stopPropagation();const c=n.dataset.tabAction,a=n.dataset.tabId;if(!a)return;c==="close"?tt(e,a):c==="detach"&&Fs(e,a);return}const s=o.closest(".os-window__tab");if(!s)return;t.stopPropagation();const i=s.dataset.kind,r=s.dataset.tabId;if(i==="external"&&r){se(e,r);return}if(i==="main"){se(e,"primary");return}if(s.dataset.url){const c=Ee(s.dataset.url);c&&e.iframe&&(e.markContentLoading(),e.iframe.src=c),se(e,"primary")}}const ot=1;function Vs(e,t){const o=Math.max(0,e.scrollWidth-e.clientWidth);if(o<=ot){delete e.dataset.overflow;return}const n=Math.abs(e.scrollLeft),s=n<=ot,i=n>=o-ot,r=t??window.getComputedStyle(e).direction==="rtl",c=r?!i:!s,a=r?!s:!i;c&&a?e.dataset.overflow="both":c?e.dataset.overflow="left":a?e.dataset.overflow="right":delete e.dataset.overflow}function js(e){let t=null,o=null;const n=()=>{o===null&&(o=window.requestAnimationFrame(()=>{o=null,t===null&&(t=window.getComputedStyle(e).direction==="rtl"),Vs(e,t)}))},s=()=>{t=null,n()};e.addEventListener("scroll",n,{passive:!0});const i=typeof ResizeObserver>"u"?null:new ResizeObserver(s);i?.observe(e);const r=typeof MutationObserver>"u"?null:new MutationObserver(s);return r?.observe(e,{childList:!0,subtree:!0}),n(),()=>{e.removeEventListener("scroll",n),i?.disconnect(),r?.disconnect(),o!==null&&(window.cancelAnimationFrame(o),o=null)}}const Ks=T("desktop-mode/native-url-remap",()=>({remaps:[],deps:null}));function wo(e){const{deps:t,remaps:o}=Ks.state;if(!t||!e)return!1;let n;try{n=new URL(e,t.adminUrl)}catch{return!1}const s=t.getSnapshot();for(const i of o){if(!i.matches(e,n)||i.enabled&&!i.enabled(s))continue;if(i.onMatch)try{i.onMatch(e,n)}catch(a){console.warn(`[openstation] URL remap onMatch hook threw for "${i.id}":`,a)}let r;if(i.params)try{r=i.params(e,n)??void 0}catch(a){console.warn(`[openstation] URL remap params hook threw for "${i.id}":`,a)}if(r?t.openById(i.nativeWindowId,{params:r}):t.openById(i.nativeWindowId))return!0}return!1}const Xs=T("desktop-mode/destructive-admin-actions",()=>({entries:[]}));function Ys(e,t){for(const o of Xs.state.entries)try{if(o.matches(e,t))return o.id}catch(n){console.warn(`[openstation] destructive-action predicate threw for "${o.id}":`,n)}return null}const Zs=32,Qs=64,Js=/^[a-z0-9_/-]+$/,F=T("desktop-mode/window-links",()=>({contentByWindow:new Map,focusSeq:new Map,seq:0,listeners:new Set,lastGroupsSignature:"",manager:null,started:!1}));function Se(e){return`${e.type}:${e.id}`}function yo(e){return e.root?Se(e.root):Se(e)}function vo(e){const t=n=>typeof n=="number"&&Number.isFinite(n)||typeof n=="string"&&n.trim()!=="",o=n=>typeof n=="string"&&Js.test(n.trim().toLowerCase());return En(e,[{field:"type",valid:n=>o(n.type),message:"must match /^[a-z0-9_/-]+$/ — lowercase alphanum, hyphens, underscores, slashes for vendor/sub-type"},{field:"id",valid:n=>t(n.id),message:"must be a finite number or non-empty string"},{field:"root",valid:n=>n.root===void 0||!!n.root&&typeof n.root=="object"&&o(n.root.type)&&t(n.root.id),message:"when present, must be { type, id } with the same shapes as the ref itself"},{field:"related",valid:n=>n.related===void 0||Array.isArray(n.related)&&n.related.every(s=>!!s&&typeof s=="object"&&typeof s.id=="string"&&s.id.trim()!==""&&typeof s.group=="string"&&s.group.trim()!==""&&typeof s.label=="string"&&s.label.trim()!==""&&typeof s.url=="string"&&s.url.trim()!==""&&(s.groupLabel===void 0||typeof s.groupLabel=="string")&&(s.icon===void 0||typeof s.icon=="string")&&(s.count===void 0||typeof s.count=="number"&&Number.isFinite(s.count))),message:"when present, must be an array of { id, group, label, url, groupLabel?, icon?, count? } entries with non-empty strings"},{field:"links",valid:n=>n.links===void 0||Array.isArray(n.links)&&n.links.every(s=>!!s&&typeof s=="object"&&o(s.type)&&t(s.id)&&(s.rel===void 0||s.rel==="references"||s.rel==="child")),message:"when present, must be an array of { type, id, rel?: 'references'|'child' } entries"}])}function ei(e,t){const o={type:e.type.trim().toLowerCase(),id:e.id,source:t};if(e.root&&(o.root={type:e.root.type.trim().toLowerCase(),id:e.root.id}),Array.isArray(e.links)&&e.links.length>0&&(o.links=e.links.slice(0,Zs).map(n=>{const s={type:n.type.trim().toLowerCase(),id:n.id};return n.rel==="child"&&(s.rel="child"),s})),typeof e.label=="string"&&e.label!==""&&(o.label=e.label),typeof e.previewUrl=="string"&&e.previewUrl!=="")try{new URL(e.previewUrl,window.location.origin).origin===window.location.origin&&(o.previewUrl=e.previewUrl)}catch{}return Array.isArray(e.related)&&e.related.length>0&&(o.related=e.related.slice(0,Qs).map(n=>{const s={id:n.id,group:n.group,label:n.label,url:n.url};return typeof n.groupLabel=="string"&&n.groupLabel!==""&&(s.groupLabel=n.groupLabel),typeof n.icon=="string"&&n.icon!==""&&(s.icon=n.icon),typeof n.count=="number"&&(s.count=n.count),s})),o}function Eo(e){return!e||!e.related?"":e.related.map(t=>`${t.id}\0${t.group}\0${t.label}\0${t.url}\0${t.groupLabel??""}\0${t.icon??""}\0${t.count??""}`).join("|")}function nt(e){return e?[Se(e),yo(e),...(e.links??[]).map(t=>Se(t)+(t.rel==="child"?"!child":""))].join("|"):""}function ti(e,t,o={}){const n=o.source??"api";if(typeof e!="string"||e===""){Ue("WindowContentRef",["windowId (must be a non-empty string)"],t);return}let s=null;if(t!=null){const c=vo(t);if(c.length>0){n==="api"&&Ue("WindowContentRef",c,t),xt("WindowContentRef",c,t);return}s=ei(t,n)}if(s=x(u.WINDOW_LINKS_CONTENT,s,{windowId:e,source:n}),s!==null&&(!s||vo(s).length>0)){xt("WindowContentRef",["filter (os.window-links.content returned an invalid ref)"],s);return}const i=F.state.contentByWindow.get(e)??null;if(s===null&&i===null||s!==null&&i!==null&&nt(s)===nt(i)&&s.label===i.label&&s.previewUrl===i.previewUrl&&Eo(s)===Eo(i))return;s===null?F.state.contentByWindow.delete(e):F.state.contentByWindow.set(e,s);const r={windowId:e,content:s,previous:i,source:n};document.dispatchEvent(new CustomEvent("os-window-content-changed",{detail:r})),f(u.WINDOW_CONTENT_CHANGED,r),ii(),ni()}function oi(){const e=new Map;for(const[s,i]of F.state.contentByWindow){const r=yo(i);let c=e.get(r);c||(c={key:r,root:i.root?{...i.root}:{type:i.type,id:i.id},rootWindowIds:[],children:[]},e.set(r,c)),i.root?c.children.push({windowId:s,content:i}):c.rootWindowIds.push(s)}const t=F.state.focusSeq;for(const s of e.values())s.rootWindowIds.sort((i,r)=>(t.get(r)??0)-(t.get(i)??0));const o=Array.from(e.values()),n=x(u.WINDOW_LINK_GROUPS,o);return Array.isArray(n)?n:(typeof console<"u"&&console.warn("[openstation] `os.window-links.groups` filter returned a non-array; falling back to computed groups."),o)}function ni(){for(const e of Array.from(F.state.listeners))try{e()}catch(t){typeof console<"u"&&console.error("[openstation] window-links listener threw:",t)}}function si(){return Array.from(F.state.contentByWindow).map(([e,t])=>`${e}=${nt(t)}`).sort().join(";")}function ii(){const e=si();if(e===F.state.lastGroupsSignature)return;F.state.lastGroupsSignature=e;const o={groups:oi()};document.dispatchEvent(new CustomEvent("os-window-link-groups-changed",{detail:o})),f(u.WINDOW_LINK_GROUPS_CHANGED,o)}const ri="desktop-mode-my-wordpress",ai=Object.freeze({userId:null,userName:"",requestedAt:0});function Ao(){return window.wp?.os}let ke=null;function li(){if(ke)return ke;const e=Ao()?.createSharedStore;return typeof e!="function"?null:(ke=e("desktop-mode/my-wordpress/footprint-target",()=>({...ai})),ke)}function ci(e,t=""){const o=li();if(o){o.state.userId=e,o.state.userName=t,o.state.requestedAt=Date.now(),o.notify();return}window._wpdFootprintTarget={userId:e,userName:t,requestedAt:Date.now()}}function di(e){const t=Number(e.userId);!Number.isFinite(t)||t<=0||(ci(t,e.userName??""),Ao()?.openWindow?.(ri,{source:"my-wordpress/open-user-footprint"}))}const M=window.location.origin,So=T("desktop-mode/admin-link-deps",()=>({deps:null}));function ui(e,t){if(t.origin!==M||!e.iframe||t.source!==e.iframe.contentWindow)return;const o=t.data;if(!(!o||typeof o.type!="string")){if(o.type==="os-title-change"&&typeof o.title=="string"&&e.setTitle(o.title),o.type==="os-content-identity"&&ti(e.id,o.identity??null,{source:"bridge"}),o.type==="os-window-publish"&&typeof o.channel=="string"&&o.channel!==""&&vt(e.id,o.channel,o.payload),typeof o.type=="string"&&o.type.startsWith("os-bridge-")&&window.__openStationConnectionBridge?.routeIncomingFromIframe(o,e.id),o.type==="os-ready"&&(e._iframeBridgeReady=!0,$(e.id),f(u.IFRAME_READY,{windowId:e.id})),o.type==="os-bridge-beforeunload-response"){if(e._isDestroyed)return;e._closePending=!1,e._iframeCloseTimeout&&(clearTimeout(e._iframeCloseTimeout),e._iframeCloseTimeout=null),o.prevent?Promise.resolve().then(()=>ta).then(({osConfirm:n})=>n({title:typeof o.message=="string"&&o.message?o.message:b("Unsaved changes"),message:b("You have unsaved changes. Are you sure you want to close this window?"),confirmLabel:b("Close window"),danger:!0})).then(n=>{n&&e.destroy()}).catch(()=>{e.destroy()}):e.destroy()}if(o.type==="os-navigate"&&typeof o.url=="string"&&o.url!==""&&hi(e,o.url,o.target==="new"?"new":"self"),o.type==="os-iframe-admin-link"&&typeof o.url=="string"&&o.url!==""){const n=So.state.deps;if(wo(o.url))e.close();else if(n){const s=typeof o.label=="string"?o.label:"";bi(e,o.url,s,n,o.newContext===!0)}}if(o.type==="os-open-user-footprint"&&typeof o.userId=="number"&&o.userId>0&&di({userId:o.userId,userName:typeof o.userName=="string"?o.userName:""}),o.type==="os-notification"&&typeof o.title=="string"&&o.title!==""&&Ai(o.title,typeof o.body=="string"?o.body:""),o.type==="os-focus-request"&&(e.element.classList.contains("os-window--overview")||e.onFocusRequest?.(e)),o.type==="os-screen-meta"&&Array.isArray(o.panels)&&Si(e,o.panels),o.type==="os-screen-meta-state"&&ki(e,typeof o.open=="string"?o.open:null),o.type==="os-external-link"&&typeof o.url=="string"&&o.url!==""){const n=typeof o.label=="string"&&o.label!==""?o.label:o.url;_o(e,o.url,n)}if(o.type==="os-iframe-error"&&f(u.IFRAME_ERROR,{windowId:e.id,kind:o.kind==="unhandledrejection"?"unhandledrejection":"error",message:typeof o.message=="string"?o.message:"",filename:typeof o.filename=="string"?o.filename:null,lineno:typeof o.lineno=="number"?o.lineno:null,colno:typeof o.colno=="number"?o.colno:null,stack:typeof o.stack=="string"?o.stack:null}),o.type==="os-chrome-theme"&&o.tokens&&typeof o.tokens=="object")try{e.setAppearanceTheme(o.tokens)}catch(n){f(u.SHELL_ERROR,{scope:"window-bridge-chrome-theme",windowId:e.id,error:n})}if(o.type==="os-chrome-controls"&&o.config&&typeof o.config=="object")try{e.setAppearanceControls(o.config)}catch(n){f(u.SHELL_ERROR,{scope:"window-bridge-chrome-controls",windowId:e.id,error:n})}if(o.type==="os-chrome-slot"&&typeof o.slot=="string"&&typeof o.html=="string")try{e.setAppearanceSlot(o.slot,{html:o.html})}catch(n){f(u.SHELL_ERROR,{scope:"window-bridge-chrome-slot",windowId:e.id,error:n})}if(o.type==="os-iframe-network"){const n={windowId:e.id,method:typeof o.method=="string"?o.method:"GET",url:typeof o.url=="string"?o.url:"",status:typeof o.status=="number"?o.status:0,duration:typeof o.duration=="number"?o.duration:0,failed:!!o.failed};o.requestHeaders&&typeof o.requestHeaders=="object"&&(n.requestHeaders=o.requestHeaders),o.responseHeaders&&typeof o.responseHeaders=="object"&&(n.responseHeaders=o.responseHeaders),f(u.IFRAME_NETWORK_COMPLETED,n)}}}function hi(e,t,o){let n;try{n=new URL(t,M)}catch{return}if(n.origin===M){if(o==="new"){window.open(n.toString(),"_blank","noopener,noreferrer");return}e.iframe&&(e.iframe.src=n.toString())}}const fi=new Set(["trash","untrash","delete","spam","unspam","spamcomment","unspamcomment","trashcomment","untrashcomment","deletecomment","approvecomment","unapprovecomment"]);function pi(e){const t=e.searchParams.get("action");return t&&fi.has(t)&&(e.searchParams.has("_wpnonce")||e.searchParams.has("_wp_nonce"))?!0:Ys(e.toString(),e)!==null}function ko(e,t){if(e.searchParams.has("_wp_http_referer"))return e;let o="";try{o=t.iframe?.contentWindow?.location.href??""}catch{}if(o||(o=t.config.url||""),!o)return e;try{const n=new URL(o,M);if(n.origin!==M)return e;const s=new URL(e.href),i=new URL(n.href);return i.searchParams.delete("openstation_chromeless"),s.searchParams.set("_wp_http_referer",i.pathname+(i.search?i.search:"")),s}catch{return e}}function mi(e,t){let o="";try{o=e.getCurrentUrl?.()??""}catch{return""}if(!o||o.startsWith("#")||o==="about:blank")return"";try{const n=new URL(o,t.adminUrl);return n.origin!==M?"":t.deriveSlug(n.toString())}catch{return""}}function gi(e,t,o){if(t===(e.config.baseId||e.id))return!0;const n=mi(e,o);return n!==""&&n===t}function bi(e,t,o,n,s=!1){let i;try{i=new URL(t,n.adminUrl)}catch{return}if(i.origin!==M)return;if(s){st(e,i,o,n);return}const r=i.toString(),c=n.deriveSlug(r),a=gi(e,c,n);if(!a&&pi(i)){const l=ko(i,e),d=e.iframe?.contentWindow;if(d)try{d.location.assign(l.href)}catch{e.iframe&&(e.iframe.src=l.href)}return}if(a){const l=e.iframe?.contentWindow;if(l)try{l.location.assign(r)}catch{e.iframe&&(e.iframe.src=r)}return}st(e,i,o,n)}function st(e,t,o,n){const s=t.toString(),i=n.deriveSlug(s),r=n.findDockEntry(s),c=o.trim(),a=r?.title||(c!==""?c:i),l=ko(t,e);n.openWindow({id:i,baseId:i,url:l.toString(),parentUrl:r?.url??s,title:a,titleFromPage:!r,icon:r?.icon??"dashicons-admin-generic",submenu:r?.submenu,multi:r?.multi})}function Ce(e){if(!e||e.startsWith("#"))return"";try{const t=new URL(e,M);return t.origin!==M?"":t.pathname.split("/").pop()??""}catch{return""}}const _i=new Set(["revision.php"]);function wi(e,t){try{const n=e.iframe?.contentWindow?.performance?.getEntriesByType?.("navigation")?.[0]?.name??"";if(n&&Ce(n)===Ce(t))return n}catch{}return t}function yi(e,t){const o=Ce(e.config.url??"");if(!o||!_i.has(o))return!1;const n=Ce(t);if(!n||n===o)return!1;if(wo(t))return e.close(),!0;const s=So.state.deps;if(!s)return!1;let i;try{i=new URL(wi(e,t),s.adminUrl)}catch{return!1}return i.origin!==M?!1:(st(e,i,"",s),e.close(),!0)}function vi(e){if(!e.config.titleFromPage)return;let t="";try{t=e.iframe?.contentDocument?.title??""}catch{return}const o=Ei(t);o!==""&&o!==e.config.title&&e.setTitle(o)}function Ei(e){const t=e.trim(),o=t.indexOf(" ‹ ");return(o>0?t.slice(0,o):t).trim()}function Ai(e,t){const o=t!==""?`${e} — ${t}`:e;go({message:o})}function Si(e,t){const o=e.element.querySelector(".os-window__screen-meta");if(!o)return;o.innerHTML="";const n={"screen-options":{icon:"dashicons-admin-generic",label:"Screen Options"},help:{icon:"dashicons-editor-help",label:"Help"}};for(const s of t){const i=n[s];if(!i)continue;const r=document.createElement("button");r.className="os-window__meta-btn",r.setAttribute("type","button"),r.setAttribute("aria-label",i.label),r.setAttribute("aria-pressed","false"),r.dataset.panel=s,r.innerHTML=`<span class="dashicons ${i.icon}" aria-hidden="true"></span>`,r.addEventListener("click",c=>{c.stopPropagation(),e.iframe?.contentWindow?.postMessage({type:"os-toggle-panel",panel:s},M)}),o.appendChild(r)}}function ki(e,t){const o=e.element.querySelector(".os-window__screen-meta");o&&o.querySelectorAll(".os-window__meta-btn").forEach(n=>{const s=n.dataset.panel===t;n.classList.toggle("os-window__meta-btn--active",s),n.setAttribute("aria-pressed",s?"true":"false")})}const Co=T("desktop-mode/title-bar-buttons-registry",()=>({registry:new Map,listeners:new Set})),Ci=Co.state.registry,xo=Co.state.listeners;function xi(){return Array.from(Ci.values()).sort((e,t)=>(e.order??100)-(t.order??100))}function Ii(e){const t=[],o=[];for(const n of xi()){try{if(!n.match(e))continue}catch{continue}n.placement==="right"?o.push(n):t.push(n)}return{left:t,right:o}}function Li(e){return xo.add(e),()=>{xo.delete(e)}}const Ti=/^dashicons-[a-z0-9-]+$/i,Ri=/^\s*<svg[\s>]/i;function Io(e,t){if(t){if(Ti.test(t)){const o=document.createElement("span");o.className=`dashicons ${t}`,o.setAttribute("aria-hidden","true"),e.appendChild(o);return}if(Ri.test(t)){const o=document.createElement("span");o.setAttribute("aria-hidden","true"),o.innerHTML=t,e.appendChild(o);return}e.setAttribute("icon",t)}}const Lo=T("desktop-mode/window-themes-registry",()=>({registry:new Map,listeners:new Set})),Ni=Lo.state.registry,To=Lo.state.listeners;function Ro(){return Array.from(Ni.values()).sort((e,t)=>(e.priority??100)-(t.priority??100))}function Oi(e){let t=null;for(const o of Ro()){try{if(!o.match(e))continue}catch(n){typeof console<"u"&&console.warn(`[openstation] window-theme "${o.id}" match() threw — skipping`,n);continue}t=o}return t}function Di(e){return To.add(e),()=>{To.delete(e)}}const xe=new WeakMap;function Wi(e,t){let o=null,n={};if(t&&"tokens"in t&&t.tokens)o=null,n={...t.tokens};else if(t&&"themeId"in t&&t.themeId){const i=$i(t.themeId);i&&(o=i.id,n={...i.tokens})}else{const i=Oi(e);i&&(o=i.id,n={...i.tokens})}const s=x(u.WINDOW_CHROME_THEME,n,{windowId:e.id,themeId:o,config:e.config});return{themeId:o,tokens:s}}function it(e,t){const o=e.element;if(!o)return;const n=xe.get(o),{themeId:s,tokens:i}=Wi(e,t);if(n){for(const c of n.keys)if(!(c in i))try{o.style.removeProperty(c)}catch{}}const r=new Set;for(const[c,a]of Object.entries(i))try{o.style.setProperty(c,a),r.add(c)}catch(l){f(u.SHELL_ERROR,{scope:"window-theme-apply",windowId:e.id,key:c,error:l})}xe.set(o,{themeId:s,keys:r}),f(u.WINDOW_CHROME_THEME_CHANGED,{windowId:e.id,themeId:s,tokens:i})}function Mi(e){const t=e.element;if(!t)return;const o=xe.get(t);if(o){for(const n of o.keys)try{t.style.removeProperty(n)}catch{}xe.delete(t)}}function $i(e){for(const t of Ro())if(t.id===e)return{id:t.id,tokens:t.tokens};return null}const No=T("desktop-mode/window-controls-registry",()=>({registry:new Map,listeners:new Set})),Pi=No.state.registry,Oo=No.state.listeners;function zi(){return Array.from(Pi.values()).sort((e,t)=>{const o=e.order??100,n=t.order??100;return o!==n?o-n:e.id.localeCompare(t.id)})}function Hi(e){const t=[],o=[],n=[];for(const s of zi()){try{if(!s.match(e))continue}catch(r){typeof console<"u"&&console.warn(`[openstation] window-control "${s.id}" match() threw — skipping`,r);continue}const i=s.placement??"left";i==="right"?o.push(s):i==="controls"?n.push(s):t.push(s)}return{left:t,right:o,controls:n}}function Fi(e){return Oo.add(e),()=>{Oo.delete(e)}}function Ui(e,t){const o=Hi(e),n=new Set(t?.hide??[]);let s=o.left.filter(l=>!n.has(l.id)),i=o.right.filter(l=>!n.has(l.id)),r=o.controls.filter(l=>!n.has(l.id));if(t?.custom){for(const l of t.custom){if(n.has(l.id))continue;const d={id:l.id,label:l.label,icon:l.icon,placement:l.placement??"controls",order:l.order??100,match:()=>!0,onClick:l.onClick?(h,_)=>l.onClick(_):void 0,render:l.render?h=>l.render(h):void 0};d.placement==="left"?s.push(d):d.placement==="right"?i.push(d):r.push(d)}s=rt(s),i=rt(i),r=rt(r)}t?.order&&t.order.length>0&&(r=Bi(r,t.order));const c=t?.placement??"right",a={windowId:e.id,config:e.config};return s=x(u.WINDOW_CHROME_CONTROLS,s,{...a,placement:"left"}),i=x(u.WINDOW_CHROME_CONTROLS,i,{...a,placement:"right"}),r=x(u.WINDOW_CHROME_CONTROLS,r,{...a,placement:"controls"}),{left:s,right:i,controls:r,placement:c}}function rt(e){return[...e].sort((t,o)=>{const n=t.order??100,s=o.order??100;return n!==s?n-s:t.id.localeCompare(o.id)})}function Bi(e,t){const o=new Map;for(const i of e)o.set(i.id,i);const n=[],s=new Set;for(const i of t){const r=o.get(i);r&&!s.has(i)&&(n.push(r),s.add(i))}for(const i of e)s.has(i.id)||n.push(i);return n}function Gi(e,t){const o=document.createElement("os-window-button");o.setAttribute("aria-label",e.label),o.classList.add("os-window__btn");const n=qi(e.id);if(o.classList.add(`os-window__btn--${n}`),e.id==="core/close"&&o.setAttribute("danger",""),typeof e.render=="function")try{e.render(o,t)}catch(s){return f(u.SHELL_ERROR,{scope:"window-control-render",id:e.id,windowId:t.id,error:s}),{element:o}}else if(Ye(o,e.id)||Io(o,e.icon??""),typeof e.onClick=="function"){const s=i=>{i.stopPropagation();try{e.onClick(t,i)}catch(r){f(u.SHELL_ERROR,{scope:"window-control-onclick",id:e.id,windowId:t.id,error:r})}};return o.addEventListener("os-button-activate",s),{element:o,teardown:()=>{o.removeEventListener("os-button-activate",s)}}}return{element:o}}function qi(e){return e.startsWith("core/")?e.slice(5):e.replace(/\//g,"-")}function Vi(e,t){const o=[];for(;t.firstChild;)t.removeChild(t.firstChild);const n=Ui(e,e.config.appearance?.controls);t.classList.toggle("os-window__controls--left",n.placement==="left");for(const s of n.controls){const{element:i,teardown:r}=Gi(s,e);t.appendChild(i),r&&o.push(r)}return f(u.WINDOW_CHROME_APPLIED,{windowId:e.id,layer:"controls"}),()=>{for(const s of o)try{s()}catch{}}}const Do=T("desktop-mode/window-slots-registry",()=>({registry:new Map,listeners:new Set})),ji=Do.state.registry,Wo=Do.state.listeners;function Ki(){return Array.from(ji.values()).sort((e,t)=>{const o=e.order??100,n=t.order??100;return o!==n?o-n:e.id.localeCompare(t.id)})}function Xi(e,t){const o=[];for(const n of Ki())if(n.slot===t){try{if(!n.match(e))continue}catch(s){typeof console<"u"&&console.warn(`[openstation] window-slot "${n.id}" match() threw — skipping`,s);continue}o.push(n)}return o}function Yi(e){return Wo.add(e),()=>{Wo.delete(e)}}const Mo=["before-titlebar","before-icon","icon","title","after-title","before-controls","after-controls","after-titlebar"],$o=new WeakMap;function Po(e,t){return e.querySelector(`[data-slot="${t}"]`)}function Zi(e){const t=new Map;for(const o of Mo){const n=Po(e,o);n&&t.set(o,Array.from(n.childNodes).map(s=>s.cloneNode(!0)))}return t}function ie(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function Qi(e,t){ie(e);for(const o of t)e.appendChild(o.cloneNode(!0))}function Ji(e,t){const o=e.querySelector(".os-window__title");o&&(o.textContent=t)}function er(e){const t=[],o=e.element;if(!o)return()=>{};let n=$o.get(o);n||(n=Zi(o),$o.set(o,n));const s=e.config.appearance?.slots??{};for(const i of Mo){const r=Po(o,i);if(!r)continue;const c=n.get(i)??[],a=s[i],l=Xi(e,i);if(a===null)ie(r);else if(a&&"html"in a)ie(r),r.textContent=a.html;else if(a&&"render"in a){a.replace!==!1&&ie(r);try{const h=a.render(r);typeof h=="function"&&t.push(h)}catch(h){f(u.SHELL_ERROR,{scope:"window-slot-inline-render",windowId:e.id,slot:i,error:h})}}else Qi(r,c),i==="title"&&Ji(r,e.config.title);if(a!==null){let d=!1;for(const h of l){h.replace!==!1&&!d&&(ie(r),d=!0);try{const p=h.render(r,{window:e,slot:i});typeof p=="function"&&t.push(p)}catch(p){f(u.SHELL_ERROR,{scope:"window-slot-registry-render",windowId:e.id,slot:i,id:h.id,error:p})}}}x(u.WINDOW_CHROME_SLOT,r,{windowId:e.id,slot:i,config:e.config})}return f(u.WINDOW_CHROME_APPLIED,{windowId:e.id,layer:"slots"}),()=>{for(const i of t)try{i()}catch{}}}const zo=T("desktop-mode/window-chrome-registry",()=>({registry:new Map,listeners:new Set})),tr=zo.state.registry,Ho=zo.state.listeners;function or(e){return tr.get(e.toLowerCase())??null}function nr(e){return Ho.add(e),()=>{Ho.delete(e)}}const Ie="core/standard",at="os-window--custom-chrome";function Fo(e){const t=e.config.appearance?.chrome??Ie;return x(u.WINDOW_CHROME_RENDER,t,{windowId:e.id,config:e.config})}function Uo(e){return{title:e.config.title,icon:e.config.icon,focused:e.element.classList.contains("os-window--focused"),state:e.state}}function sr(e){const t=Fo(e);if(t===Ie)return null;const o=or(t);if(!o)return null;try{if(o.match&&!o.match(e))return null}catch{return null}e.element.classList.add(at);let n;try{n=o.render(e.element,{window:e,state:Uo(e)})}catch(s){return e.element.classList.remove(at),f(u.SHELL_ERROR,{scope:"window-chrome-render",windowId:e.id,chromeId:t,error:s}),null}return f(u.WINDOW_CHROME_APPLIED,{windowId:e.id,layer:"chrome",chromeId:t}),{id:t,handle:n}}const Bo=T("desktop-mode/window-actions-registry",()=>({registry:new Map,listeners:new Set})),ir=Bo.state.registry,Go=Bo.state.listeners;function rr(){return Array.from(ir.values()).sort((e,t)=>(e.order??100)-(t.order??100))}function ar(e){return Go.add(e),()=>{Go.delete(e)}}function lr(e,t){if(typeof e.label=="function")try{return String(e.label(t)??"")}catch{return""}return e.label}function cr(e,t){if(typeof e.icon=="function")try{return String(e.icon(t)??"")}catch{return""}return e.icon??""}function dr(e,t){if(typeof e.isVisible!="function")return!0;try{return!!e.isVisible(t)}catch{return!1}}function qo(e){const t=e.element.querySelector(".os-window__menu-panel");t&&(t.hidden?Vo(e):U(e))}function Vo(e){const t=e.element.querySelector(".os-window__menu-panel"),o=e.element.querySelector(".os-window__menu-btn");if(!t||!o)return;t.hidden=!1,o.setAttribute("aria-expanded","true");const n=t.querySelector(".os-window__menu-item--startup");n&&lt(e,n),jo(e,t),e._unsubscribeWindowActions?.(),e._unsubscribeWindowActions=ar(()=>{t.hidden||jo(e,t)}),f(u.WINDOW_MENU_OPENED,{windowId:e.id,element:t}),e._boundOnDocumentPointerDown||(e._boundOnDocumentPointerDown=i=>{const r=i.target;r&&(t.contains(r)||o.contains(r)||U(e))}),setTimeout(()=>{e._boundOnDocumentPointerDown&&document.addEventListener("pointerdown",e._boundOnDocumentPointerDown,!0)},0),t.querySelector('[role="menuitem"]')?.focus()}function U(e){const t=e.element.querySelector(".os-window__menu-panel"),o=e.element.querySelector(".os-window__menu-btn");t&&(t.hidden=!0),o&&o.setAttribute("aria-expanded","false"),e._boundOnDocumentPointerDown&&document.removeEventListener("pointerdown",e._boundOnDocumentPointerDown,!0),e._unsubscribeWindowActions?.(),e._unsubscribeWindowActions=null}function ur(e){e.hasAttribute("checked")?e.removeAttribute("checked"):e.setAttribute("checked","")}function lt(e,t){const o=window.wp?.os?.config?.defaultWindow;let n=!1;if(o&&o.enabled&&typeof o.url=="string")if(e.config.native)n=o.url===`native:${e.id}`;else try{const s=G(e.getCurrentUrl()),i=G(o.url);n=s===i}catch{n=!1}n?t.setAttribute("checked",""):t.removeAttribute("checked")}function jo(e,t){for(const o of Array.from(t.querySelectorAll(".os-window__menu-item--action")))o.remove();for(const o of rr()){if(!dr(o,e))continue;const n=lr(o,e);if(!n)continue;const s=document.createElement("os-menu-item");s.setAttribute("role","menuitem"),s.setAttribute("value",o.id);const i=cr(o,e);i&&s.setAttribute("icon",i),s.classList.add("os-window__menu-item"),s.classList.add("os-window__menu-item--action"),s.setAttribute("data-action-id",o.id),s.textContent=n,s.addEventListener("os-menu-item-click",r=>{r.stopPropagation(),U(e);try{o.onSelect(e)}catch(c){typeof console<"u"&&console.error(`[openstation] window action "${o.id}" threw:`,c)}}),t.appendChild(s)}}function Ko(e,t){let o=!1;return()=>{o||(o=!0,requestAnimationFrame(()=>{if(o=!1,!(t==="drag"&&!e._isDragging)&&!(t==="resize"&&!e._isResizing)&&!(e._isDestroyed||!e.element.isConnected))try{f(u.WINDOW_BOUNDS_CHANGED,{windowId:e.id,x:e.element.offsetLeft,y:e.element.offsetTop,width:e.element.offsetWidth,height:e.element.offsetHeight,state:e.state,phase:t})}catch{}}))}}function hr(e,t){const o=t.target;if(o.closest(".os-window__btn")||o.closest(".os-window__custom-buttons")||o.closest(".os-window__controls")||o.closest(".os-window__screen-meta")||o.closest(".os-window__menu-btn")||o.closest(".os-window__menu-panel"))return;const n=e.state==="maximized",s=e.state==="snapped-left"||e.state==="snapped-right",i=n||s,r=t.clientX,c=t.clientY,a=t.pointerId,l=i?fr(e,t):null;e._titleBar.setPointerCapture(a);const d=e.snapConfigProvider?.()??{enabled:!1,cellWidth:0,cellHeight:0},h=Ko(e,"drag");let _=!1;const p=(y,v)=>{if(_)return;_=!0;let S,N;if(l){const I=pr(e,l,y,v);S=I.left,N=I.top}else S=e.element.offsetLeft,N=e.element.offsetTop;e.element.classList.add("os-window--dragging"),d.enabled&&e.element.classList.add("os-window--snap-drag"),e._isDragging=!0,e._dragOffsetX=y-S,e._dragOffsetY=v-N,f(u.WINDOW_DRAG_START,{windowId:e.id})};i||p(r,c);const m=y=>{if(!_){const I=y.clientX-r,he=y.clientY-c;if(I*I+he*he<fs)return;p(y.clientX,y.clientY)}if(!e._isDragging)return;let v=y.clientX-e._dragOffsetX,S=y.clientY-e._dragOffsetY;const N=e.element.parentElement;if(N){const I=br(v,S,e.element.offsetWidth,N.clientWidth,N.clientHeight);v=I.x,S=I.y}d.enabled&&(v=Math.round(v/d.cellWidth)*d.cellWidth,S=Math.round(S/d.cellHeight)*d.cellHeight),e.element.style.left=`${v}px`,e.element.style.top=`${S}px`,e.onDragMove?.(e,y.clientX,y.clientY),h()},k=()=>{try{e._titleBar.releasePointerCapture(a)}catch{}},w=()=>{e._titleBar.removeEventListener("pointermove",m),e._titleBar.removeEventListener("pointerup",E),e._titleBar.removeEventListener("pointercancel",E),e._titleBar.removeEventListener("lostpointercapture",E)},E=()=>{if(!_){k(),w();return}if(!e._isDragging||(e._isDragging=!1,e.element.classList.remove("os-window--dragging"),e.element.classList.remove("os-window--snap-drag"),k(),w(),e.onDragEnd?.(e)??!1))return;e._emitChange("moved");const v={windowId:e.id,x:e.element.offsetLeft,y:e.element.offsetTop};f(u.WINDOW_DRAG_END,v),f(u.WINDOW_MOVED,v)};e._titleBar.addEventListener("pointermove",m),e._titleBar.addEventListener("pointerup",E),e._titleBar.addEventListener("pointercancel",E),e._titleBar.addEventListener("lostpointercapture",E)}function fr(e,t){const o=e._titleBar.getBoundingClientRect(),n=o.width>0?(t.clientX-o.left)/o.width:.5,s=e.element.parentElement,i=s?Math.min(960,Math.round(s.clientWidth*.6)):640,r=s?Math.min(640,Math.round(s.clientHeight*.7)):480,c=e._savedGeometry?.width??i,a=e._savedGeometry?.height??r,l=s?.getBoundingClientRect();return{isMaximized:e.state==="maximized",cursorRatioX:n,titleBarHeight:o.height,areaLeft:l?.left??0,areaTop:l?.top??0,targetW:c,targetH:a}}function pr(e,t,o,n){e.element.classList.remove("os-window--maximized","os-window--snapped-left","os-window--snapped-right"),e.element.style.width=`${t.targetW}px`,e.element.style.height=`${t.targetH}px`;const s=Math.max(H,Math.round(o-t.areaLeft-t.targetW*t.cursorRatioX)),i=Math.max(H,Math.round(n-t.areaTop-t.titleBarHeight/2));return e.element.style.left=`${s}px`,e.element.style.top=`${i}px`,e.state="normal",e._emitChange("state"),t.isMaximized&&f(u.WINDOW_UNMAXIMIZED,{windowId:e.id}),{left:s,top:i}}function mr(e,t){if(e.state==="maximized"||e.state==="fullscreen")return;t.preventDefault(),t.stopPropagation();const o=t.target,n=o.dataset.dir??"se";e._isResizing=!0,e._resizeStartX=t.clientX,e._resizeStartY=t.clientY,e._resizeStartW=e.element.offsetWidth,e._resizeStartH=e.element.offsetHeight;const s=e.element.offsetLeft,i=e.element.offsetTop;o.setPointerCapture(t.pointerId),e.element.classList.add("os-window--resizing"),f(u.WINDOW_RESIZE_START,{windowId:e.id});const r=Ko(e,"resize"),c=e.snapConfigProvider?.()??{enabled:!1,cellWidth:0,cellHeight:0};c.enabled&&e.element.classList.add("os-window--snap-drag"),(e.state==="snapped-left"||e.state==="snapped-right")&&(e.element.classList.remove("os-window--snapped-left","os-window--snapped-right"),e.state="normal");const a=d=>{if(!e._isResizing)return;const h=d.clientX-e._resizeStartX,_=d.clientY-e._resizeStartY,p=gr(n,h,_,s,i,e._resizeStartW,e._resizeStartH,e.config.minWidth,e.config.minHeight,c);e.element.style.left=`${p.x}px`,e.element.style.top=`${p.y}px`,e.element.style.width=`${p.width}px`,e.element.style.height=`${p.height}px`,r()},l=()=>{if(!e._isResizing)return;e._isResizing=!1,e.element.classList.remove("os-window--resizing"),e.element.classList.remove("os-window--snap-drag"),o.removeEventListener("pointermove",a),o.removeEventListener("pointerup",l),o.removeEventListener("pointercancel",l),o.removeEventListener("lostpointercapture",l),e._emitChange("resized");const d={windowId:e.id,width:e.element.offsetWidth,height:e.element.offsetHeight};f(u.WINDOW_RESIZE_END,d),f(u.WINDOW_RESIZED,d)};o.addEventListener("pointermove",a),o.addEventListener("pointerup",l),o.addEventListener("pointercancel",l),o.addEventListener("lostpointercapture",l)}function gr(e,t,o,n,s,i,r,c,a,l){let d=i,h=r,_=n,p=s;if((e==="ne"||e==="se")&&(d=Math.max(c,i+t)),e==="nw"||e==="sw"){const m=Math.max(c,i-t);_=n+(i-m),d=m}if((e==="se"||e==="sw")&&(h=Math.max(a,r+o)),e==="ne"||e==="nw"){const m=Math.max(a,r-o);p=s+(r-m),h=m}if(l.enabled){const m=Math.max(c,Math.round(d/l.cellWidth)*l.cellWidth),k=Math.max(a,Math.round(h/l.cellHeight)*l.cellHeight);(e==="nw"||e==="sw")&&(_=n+(d-m)),(e==="nw"||e==="ne")&&(p=s+(h-k)),d=m,h=k}if(_<H){const m=H-_;_=H,d=Math.max(c,d-m)}if(p<H){const m=H-p;p=H,h=Math.max(a,h-m)}return{x:_,y:p,width:d,height:h}}function br(e,t,o,n,s){const i=Ze-o,r=n-Ze,c=Math.max(i,Math.min(e,r)),a=H,l=s-Ze,d=Math.max(a,Math.min(t,l));return{x:c,y:d}}const ct=window.location.origin,De=class De{constructor(t){if(this.state="normal",this._activityCount=0,this._activityPhase="idle",this._activityError=null,this._activityClearTimer=null,this._activitySavingStartedAt=0,this._activitySettleTimer=null,this._isDragging=!1,this._isResizing=!1,this._isDestroyed=!1,this._dragOffsetX=0,this._dragOffsetY=0,this._resizeStartX=0,this._resizeStartY=0,this._resizeStartW=0,this._resizeStartH=0,this._savedGeometry=null,this._savedFullscreenState=null,this._stateBeforeMinimize=null,this._externalTabs=new Map,this._externalTabSeq=0,this._titleBarButtonsUnsubscribe=null,this._windowThemesUnsubscribe=null,this._windowControlsUnsubscribe=null,this._windowControlsTeardown=null,this._windowSlotsUnsubscribe=null,this._windowSlotsTeardown=null,this._chromeHandle=null,this._chromeId=Ie,this._windowChromesUnsubscribe=null,this._nativeRenderTeardown=null,this._nativeRenderCtxDispose=null,this._closeSafetyNetTimer=null,this._onCloseTransitionEnd=null,this._isFinalized=!1,this._iframeBridgeReady=!1,this._iframeCloseTimeout=null,this._closePending=!1,this._activeTabId="primary",this.onFocusRequest=null,this.onClose=null,this.onMinimize=null,this.onOpenAnother=null,this.onOpenInNewWindow=null,this.onToggleStartup=null,this.snapConfigProvider=null,this.onDragMove=null,this.onDragEnd=null,this._boundOnDocumentPointerDown=null,this._unsubscribeWindowActions=null,this._bodyResizeObserver=null,this._tabOverflowTeardown=null,this._swapBuffer=null,this._swapBufferTimer=null,this._suppressCloseFilter=!1,this.id=t.id,this.config=t,this.element=Ls(t),this.iframe=t.native?null:this.element.querySelector(".os-window__iframe"),this._titleBar=this.element.querySelector(".os-window__titlebar"),this._titleEl=this.element.querySelector(".os-window__title"),this._boundOnMessage=o=>ui(this,o),this.bindEvents(),this.iframe&&this._wireContentFocusForwarder(this.iframe),this.renderCustomTitleBarButtons(),this._titleBarButtonsUnsubscribe=Li(()=>{this.renderCustomTitleBarButtons()}),it(this,this.config.appearance?.theme),this._windowThemesUnsubscribe=Di(()=>{this._isDestroyed||it(this,this.config.appearance?.theme)}),this.repaintWindowControls(),this._windowControlsUnsubscribe=Fi(()=>{this._isDestroyed||this.repaintWindowControls()}),this.repaintWindowSlots(),this._windowSlotsUnsubscribe=Yi(()=>{this._isDestroyed||this.repaintWindowSlots()}),this.remountWindowChrome(),this._windowChromesUnsubscribe=nr(()=>{if(this._isDestroyed)return;Fo(this)!==this._chromeId&&this.remountWindowChrome()}),this._bodyResizeObserver=this.installBodyResizeObserver(),t.initialState==="minimized"){this.state="minimized",this.element.classList.add("os-window--minimized"),this.iframe&&(this.iframe.style.visibility="hidden"),this.element.style.setProperty("content-visibility","hidden");return}(t.initialState==="snapped-left"||t.initialState==="snapped-right")&&this.element.classList.add(`os-window--${t.initialState}`),this.element.classList.add("os-window--opening"),this.element.addEventListener("animationend",()=>{this.element.classList.remove("os-window--opening")},{once:!0}),t.initialState&&t.initialState!=="normal"&&requestAnimationFrame(()=>this.applyInitialState(t.initialState))}hydrateNative(){if(!this.config.native||!this.config.render)return;const t=this.element.querySelector(".os-window__body");if(!t)return;const o=x(u.NATIVE_WINDOW_BEFORE_RENDER,t,{windowId:this.id,config:this.config}),n=o instanceof HTMLElement?o:t,{ctx:s,dispose:i}=_n(this.id,this.config.params??{});this._nativeRenderCtxDispose=i;const r=this.config.render(n,s),c=l=>{typeof l=="function"&&(this._nativeRenderTeardown=l)};r instanceof Promise?r.then(l=>{this._isDestroyed||(c(l),$(this.id))},l=>{typeof console<"u"&&console.error(`[openstation] native render rejected for "${this.id}":`,l),f(u.SHELL_ERROR,{scope:"window-open",id:this.id,error:l}),!this._isDestroyed&&$(this.id)}):(c(r),requestAnimationFrame(()=>{this._isDestroyed||$(this.id)})),f(u.NATIVE_WINDOW_AFTER_RENDER,{windowId:this.id,body:n,config:this.config});const a=this.config.autofocus;a&&requestAnimationFrame(()=>{if(this._isDestroyed)return;if(typeof a=="string"){n.querySelector(a)?.focus();return}n.hasAttribute("tabindex")||(n.tabIndex=-1),n.focus()})}applyInitialState(t){t==="minimized"?this.minimize():t==="maximized"?this.toggleMaximize():t==="fullscreen"?this.toggleFullscreen():t==="snapped-left"?this.applySnap("left"):t==="snapped-right"&&this.applySnap("right")}_emitChange(t){document.dispatchEvent(new CustomEvent("os-window-changed",{detail:{windowId:this.id,reason:t,state:this.state}}))}snapGeometry(t){const o=this.snapConfigProvider?.();if(!o||!o.enabled)return t;const n=Math.max(this.config.minWidth,Math.round(t.width/o.cellWidth)*o.cellWidth),s=Math.max(this.config.minHeight,Math.round(t.height/o.cellHeight)*o.cellHeight);return{x:Math.round(t.x/o.cellWidth)*o.cellWidth,y:Math.round(t.y/o.cellHeight)*o.cellHeight,width:n,height:s}}getCurrentUrl(){if(!this.iframe)return this.config.url||`#${this.id}`;try{const t=this.iframe.contentWindow?.location.href;if(t&&t!=="about:blank")return t}catch{}return this.iframe.src}bindEvents(){this.element.addEventListener("pointerdown",()=>{this.element.classList.contains("os-window--overview")||this.onFocusRequest?.(this)}),this.element.addEventListener("focusin",()=>{this.element.classList.contains("os-window--overview")||this.onFocusRequest?.(this)}),this._titleBar.addEventListener("pointerdown",s=>hr(this,s)),this.element.querySelectorAll(".os-window__resize-handle").forEach(s=>{s.addEventListener("pointerdown",i=>mr(this,i))});const o=this.element.querySelector(".os-window__menu-btn"),n=this.element.querySelector(".os-window__menu-panel");if(o&&n){o.addEventListener("click",l=>{l.stopPropagation(),qo(this)});const s=n.querySelector(".os-window__menu-item--open-another");s&&s.addEventListener("os-menu-item-click",l=>{l.stopPropagation(),U(this),this.onOpenAnother?.(this)});const i=n.querySelector(".os-window__menu-item--open-in-new-window");i&&i.addEventListener("os-menu-item-click",l=>{l.stopPropagation(),U(this),this.onOpenInNewWindow?.(this)});const r=n.querySelector(".os-window__menu-item--reload");r&&r.addEventListener("os-menu-item-click",l=>{l.stopPropagation(),U(this),this.reload()});const c=n.querySelector(".os-window__menu-item--open-external");c&&c.addEventListener("os-menu-item-click",l=>{l.stopPropagation(),U(this),this.detach()});const a=n.querySelector(".os-window__menu-item--startup");a&&(lt(this,a),a.addEventListener("os-menu-item-click",l=>{l.stopPropagation(),ur(a),this.onToggleStartup?.(this)}),document.addEventListener("os-default-window-changed",()=>{lt(this,a)})),n.addEventListener("keydown",l=>{l.key==="Escape"&&(l.stopPropagation(),U(this),o.focus())})}if(this._titleBar.addEventListener("dblclick",s=>{s.target?.closest('button, [role="button"], [role="menuitem"], [role="menuitemcheckbox"], os-window-button, os-menu, os-menu-item, .os-window__menu-panel, .os-window__custom-buttons, input, select, textarea, a')||this.toggleMaximize()}),this.iframe){const s=this.iframe,i=this.element.querySelector(".os-window__tabs");i&&(i.addEventListener("click",r=>qs(this,r)),this._tabOverflowTeardown=js(i)),this._wireTabNavSync(s),window.addEventListener("message",this._boundOnMessage)}}addExternalTab(t,o){_o(this,t,o)}setZIndex(t){this.element.style.zIndex=String(t)}setFocused(t){this.element.classList.toggle("os-window--focused",t),this._notifyChromeStateChanged()}setTitle(t){const o=this.element.querySelector(".os-window__title");o&&(this._titleEl=o,o.textContent=t),this.config.title=t,f(u.WINDOW_TITLE_CHANGED,{windowId:this.id,title:t}),this._notifyChromeStateChanged()}repaintWindowControls(){const t=this.element.querySelector(".os-window__controls");if(t){if(this._windowControlsTeardown){try{this._windowControlsTeardown()}catch{}this._windowControlsTeardown=null}this._windowControlsTeardown=Vi(this,t)}}repaintThemedChrome(){const t=this.element.querySelector(".os-window__slot--icon");if(t){const n=t.querySelector(".os-window__icon");n&&n.replaceWith(no(this.config.icon,{title:this.config.title,className:"os-window__icon",slot:io(this.config.id)}))}const o=this.element.querySelector(".os-window__menu-btn");o&&(o.querySelectorAll(":scope > .dashicons").forEach(n=>n.remove()),o.removeAttribute("icon-src"),o.setAttribute("icon","menu"),Ye(o,"core/menu"))}setAppearanceControls(t){this.config.appearance={...this.config.appearance??{},controls:t??void 0},this.repaintWindowControls()}repaintWindowSlots(){if(this._windowSlotsTeardown){try{this._windowSlotsTeardown()}catch{}this._windowSlotsTeardown=null}this._windowSlotsTeardown=er(this)}remountWindowChrome(){if(this._chromeHandle){try{this._chromeHandle.destroy()}catch{}this._chromeHandle=null}this.element.classList.remove(at);const t=sr(this);t?(this._chromeHandle=t.handle,this._chromeId=t.id):this._chromeId=Ie}setAppearanceChrome(t){this.config.appearance={...this.config.appearance??{},chrome:t??void 0},this.remountWindowChrome()}_notifyChromeStateChanged(){if(!this._isDestroyed&&this._chromeHandle?.update)try{this._chromeHandle.update(Uo(this))}catch{}}setAppearanceSlot(t,o){const s={...this.config.appearance?.slots??{}};o===void 0?delete s[t]:s[t]=o,this.config.appearance={...this.config.appearance??{},slots:s},this.repaintWindowSlots()}setAppearanceTheme(t){let o;t==null?o=void 0:typeof t=="string"?o={themeId:t}:typeof t=="object"&&("themeId"in t||"tokens"in t)?o=t:typeof t=="object"&&(o={tokens:t}),this.config.appearance={...this.config.appearance??{},theme:o},it(this,o)}applySnap(t){this._applySnapVisuals(t)&&(this.state=t==="left"?"snapped-left":"snapped-right",this._emitChange("state"))}_applySnapVisuals(t){const o=this.element.parentElement;if(!o)return!1;const n=Math.floor(o.clientWidth/2),s=o.clientHeight;return this.element.classList.remove("os-window--maximized","os-window--fullscreen","os-window--snapped-left","os-window--snapped-right"),this.element.classList.add(`os-window--snapped-${t}`),this.element.style.left=t==="left"?"0px":`${n}px`,this.element.style.top="0px",this.element.style.width=`${n}px`,this.element.style.height=`${s}px`,!0}isMinimized(){return this.state==="minimized"}isMaximized(){return this.state==="maximized"}isFullscreen(){return this.state==="fullscreen"}isSnapped(t){return t==="left"?this.state==="snapped-left":t==="right"?this.state==="snapped-right":this.state==="snapped-left"||this.state==="snapped-right"}isFocused(){return this.element.classList.contains("os-window--focused")}minimize(){this.state!=="minimized"&&(this._stateBeforeMinimize=this.state,this.state="minimized",this.element.classList.add("os-window--minimized"),this.element.addEventListener("transitionend",t=>{t.propertyName==="opacity"&&this.state==="minimized"&&!this.element.classList.contains("os-window--overview")&&(this.iframe&&(this.iframe.style.visibility="hidden"),this.element.style.setProperty("content-visibility","hidden"))},{once:!0}),this.onMinimize?.(this),this._emitChange("state"),f(u.WINDOW_MINIMIZED,{windowId:this.id,element:this.element}),this._stateBeforeMinimize==="fullscreen"&&ee())}restore(){this.element.style.removeProperty("content-visibility"),this.iframe&&(this.iframe.style.visibility="");const t=this.state==="minimized";this.element.classList.remove("os-window--minimized"),t&&(this.state=this._stateBeforeMinimize??"normal",this._stateBeforeMinimize=null,this.state==="fullscreen"&&(ee(),this.updateFocusButtonState())),this.onFocusRequest?.(this),this._emitChange("state"),t&&f(u.WINDOW_RESTORED,{windowId:this.id,element:this.element})}maximize(){this.state!=="maximized"&&(this.state==="normal"&&(this._savedGeometry={x:this.element.offsetLeft,y:this.element.offsetTop,width:this.element.offsetWidth,height:this.element.offsetHeight}),this._applyMaximizeVisuals()&&(this.state="maximized",this._emitChange("state"),f(u.WINDOW_MAXIMIZED,{windowId:this.id,element:this.element})))}_applyMaximizeVisuals(){const t=this.element.parentElement;return t?(this.element.classList.remove("os-window--fullscreen","os-window--snapped-left","os-window--snapped-right"),this.element.classList.add("os-window--maximized"),this.element.style.left="0px",this.element.style.top="0px",this.element.style.width=`${t.clientWidth}px`,this.element.style.height=`${t.clientHeight}px`,!0):!1}toggleMaximize(){if(this.element.parentElement){if(this.state==="maximized"){if(this.element.classList.remove("os-window--maximized"),this._savedGeometry){const o=this.snapGeometry(this._savedGeometry);this.element.style.left=`${o.x}px`,this.element.style.top=`${o.y}px`,this.element.style.width=`${o.width}px`,this.element.style.height=`${o.height}px`,this._savedGeometry=o}this.state="normal",this._emitChange("state"),f(u.WINDOW_UNMAXIMIZED,{windowId:this.id,element:this.element});return}if(this.state==="fullscreen"){this._savedFullscreenState=null,this._applyMaximizeVisuals(),this.state="maximized",ee(),this.updateFocusButtonState(),this._emitChange("state"),f(u.WINDOW_FULLSCREEN_EXITED,{windowId:this.id,element:this.element}),f(u.WINDOW_MAXIMIZED,{windowId:this.id,element:this.element});return}this.maximize()}}toggleFullscreen(){if(this.state==="fullscreen"){this.element.classList.remove("os-window--fullscreen");const t=this._savedFullscreenState;this._savedFullscreenState=null;let o=!1;if(t&&t.state==="maximized")this._applyMaximizeVisuals(),this.state="maximized",o=!0;else if(t&&(t.state==="snapped-left"||t.state==="snapped-right")){const n=t.state==="snapped-left"?"left":"right";this._applySnapVisuals(n),this.state=t.state}else t?(this.element.style.left=`${t.x}px`,this.element.style.top=`${t.y}px`,this.element.style.width=`${t.width}px`,this.element.style.height=`${t.height}px`,this.state="normal"):this.state="normal";ee(),this.updateFocusButtonState(),this._emitChange("state"),f(u.WINDOW_FULLSCREEN_EXITED,{windowId:this.id,element:this.element}),o&&f(u.WINDOW_MAXIMIZED,{windowId:this.id,element:this.element});return}this.state==="normal"&&(this._savedGeometry={x:this.element.offsetLeft,y:this.element.offsetTop,width:this.element.offsetWidth,height:this.element.offsetHeight}),this._savedFullscreenState={state:this.state,x:this.element.offsetLeft,y:this.element.offsetTop,width:this.element.offsetWidth,height:this.element.offsetHeight},this.element.classList.remove("os-window--maximized","os-window--snapped-left","os-window--snapped-right"),this.element.classList.add("os-window--fullscreen"),this.state="fullscreen",ee(),this.updateFocusButtonState(),this._emitChange("state"),f(u.WINDOW_FULLSCREEN_ENTERED,{windowId:this.id,element:this.element})}updateFocusButtonState(){const t=this.element.querySelector(".os-window__btn--focus");if(!t)return;const o=this.state==="fullscreen";t.classList.toggle("os-window__btn--active",o),t.setAttribute("aria-pressed",o?"true":"false"),t.setAttribute("aria-label",b(o?"Exit fullscreen":"Enter fullscreen"))}detach(){const t=this.getCurrentUrl();let o;try{o=new URL(t,ct)}catch{return}o.origin===ct&&(o.searchParams.delete("openstation_chromeless"),o.searchParams.delete("desktop_mode_portal"),o.searchParams.set("desktop_mode_classic","1"),window.open(o.toString(),"_blank","noopener"),f(u.WINDOW_DETACHED,{windowId:this.id,url:o.toString()}))}reload(){if(this.config.native||this.element.querySelector(".os-window__body")?.classList.contains("os-window__body--loading"))return;let o,n;if(this._activeTabId==="primary"){if(!this.iframe)return;const s=this.iframe;o=this.getCurrentUrl(),n=()=>{try{s.contentWindow?.location.reload()}catch{s.src=s.src}}}else{const s=this._externalTabs.get(this._activeTabId);if(!s)return;o=s.url,n=()=>{try{s.iframe.contentWindow?.location.reload()}catch{s.iframe.src=s.url}}}this._spinReloadButton(),this.markContentLoading(),n(),f(u.WINDOW_RELOADED,{windowId:this.id,url:o})}navigateTo(t){if(this.config.native||!this.iframe)return!1;const o=Ee(t);if(!o)return!1;this.markContentLoading();const n=this.iframe.contentWindow;if(n)try{return n.location.assign(o),!0}catch{}return this.iframe.src=o,!0}_wireContentFocusForwarder(t){const o=()=>{let n=null;try{n=t.contentDocument}catch{return}n&&(n.location&&n.location.pathname.indexOf("/wp-admin/")!==-1||n.addEventListener("pointerdown",()=>{this.element.classList.contains("os-window--overview")||this.onFocusRequest?.(this)},{capture:!0,passive:!0}))};t.addEventListener("load",o),o()}_wireTabNavSync(t){t.addEventListener("load",()=>{try{const o=t.contentWindow?.location.href;if(!o||yi(this,o))return;vi(this),bo(this,o)}catch{}})}_discardSwapBuffer(){this._swapBufferTimer!==null&&(window.clearTimeout(this._swapBufferTimer),this._swapBufferTimer=null),this._swapBuffer&&(this._swapBuffer.remove(),this._swapBuffer=null,this.iframe?.classList.remove("os-window__iframe--swap-front"))}swapReload(t){if(this.config.native||!this.iframe||this._isDestroyed)return;if(this._activeTabId!=="primary"){this.reload();return}const o=t?Ee(t):this.getCurrentUrl();if(!o)return;this._discardSwapBuffer();const n=this.iframe;n.classList.add("os-window__iframe--swap-front");const s=document.createElement("iframe");s.className="os-window__iframe os-window__iframe--buffer",s.setAttribute("aria-hidden","true"),s.setAttribute("name",`os-frame-${this.id}-buffer`),this._swapBuffer=s,this._swapBufferTimer=window.setTimeout(()=>{this._swapBuffer===s&&this._discardSwapBuffer()},2e4),s.addEventListener("load",()=>{if(this._swapBuffer!==s||this._isDestroyed)return;this._swapBuffer=null,this._swapBufferTimer!==null&&(window.clearTimeout(this._swapBufferTimer),this._swapBufferTimer=null);let i=0,r=0;try{i=n.contentWindow?.scrollX??0,r=n.contentWindow?.scrollY??0}catch{}if(i||r)try{s.contentWindow?.scrollTo(i,r)}catch{}s.classList.remove("os-window__iframe--buffer"),s.removeAttribute("aria-hidden"),s.setAttribute("name",`os-frame-${this.id}`),n.remove(),this.iframe=s,$(this.id),s.addEventListener("load",()=>{$(this.id)}),this._wireContentFocusForwarder(s),this._wireTabNavSync(s),bo(this,o),f(u.WINDOW_RELOADED,{windowId:this.id,url:o,silent:!0})},{once:!0}),n.insertAdjacentElement("afterend",s),s.src=o}_spinReloadButton(){const t=this.element.querySelector(".os-window__btn--reload");t instanceof HTMLElement&&(t.classList.remove("os-window__btn--spinning"),t.offsetWidth,t.classList.add("os-window__btn--spinning"),t.addEventListener("animationend",()=>{t.classList.remove("os-window__btn--spinning")},{once:!0}))}renderCustomTitleBarButtons(){const t=this.element.querySelector(".os-window__custom-buttons--left"),o=this.element.querySelector(".os-window__custom-buttons--right");if(!t||!o)return;t.innerHTML="",o.innerHTML="";const{left:n,right:s}=Ii(this),i=(r,c)=>{for(const a of c){const l=document.createElement("os-window-button");if(Io(l,a.icon),l.setAttribute("aria-label",a.label),l.setAttribute("title",a.label),l.classList.add("os-window__btn"),l.classList.add("os-window__btn--custom"),l.dataset.buttonId=a.id,r.appendChild(l),typeof a.render=="function")try{a.render(l,this)}catch(d){typeof console<"u"&&console.error("[openstation] title-bar-button render threw:",a.id,d)}else typeof a.onClick=="function"&&l.addEventListener("os-button-activate",d=>{try{a.onClick(this,d)}catch(h){typeof console<"u"&&console.error("[openstation] title-bar-button onClick threw:",a.id,h)}})}};i(t,n),i(o,s)}send(t,o){if(typeof t!="string"||t==="")return;const n=this.iframe??mn(this.id);if(!n){un(this.id,t,o);return}const s=()=>{try{n.contentWindow?.postMessage({type:"os-window-send",channel:t,payload:o},ct)}catch(i){typeof console<"u"&&console.error("[openstation] Window.send: postMessage failed",i)}};if(Et(this.id)){s();return}hn(this.id,t,o,s)}on(t,o){return typeof t!="string"||t===""||typeof o!="function"?()=>{}:cn(this.id,t,o)}markContentLoading(){_e(this.id)}markContentLoaded(){$(this.id)}whenContentReady(){return Et(this.id)?Promise.resolve():new Promise(t=>{const o=this.id,n=s=>{const i=s.detail;!i||i.windowId!==o||(document.removeEventListener("os-window-content-loaded",n),t())};document.addEventListener("os-window-content-loaded",n)})}markActivity(t,o={}){this._activityPhase=t,this._activityError=o.error??null,this._paintActivityIndicator()}trackActivity(t){return this._markActivityStart(),t.then(o=>(this._markActivitySettled(!0),o),o=>{const n=o instanceof Error?o.message:String(o);throw this._markActivitySettled(!1,n),o})}_markActivityStart(){this._activityCount++,this._activitySettleTimer!==null&&(window.clearTimeout(this._activitySettleTimer),this._activitySettleTimer=null),this._activityCount===1&&(this._activityPhase="saving",this._activityError=null,this._activitySavingStartedAt=Date.now(),this._paintActivityIndicator())}_markActivitySettled(t,o){if(this._activityCount>0&&this._activityCount--,this._activityCount>0){!t&&o&&(this._activityError=o);return}const n=Date.now()-this._activitySavingStartedAt,s=De.MIN_SAVING_DISPLAY_MS-n;if(s>0){this._activitySettleTimer!==null&&window.clearTimeout(this._activitySettleTimer),this._activitySettleTimer=window.setTimeout(()=>{this._activitySettleTimer=null,this._finalizeActivitySettle(t,o)},s);return}this._finalizeActivitySettle(t,o)}_finalizeActivitySettle(t,o){this._activityPhase=t&&!this._activityError?"saved":"failed",!t&&o&&(this._activityError=o),this._paintActivityIndicator(),this._activityClearTimer!==null&&(window.clearTimeout(this._activityClearTimer),this._activityClearTimer=null),this._activityPhase==="saved"&&(this._activityClearTimer=window.setTimeout(()=>{this._activityClearTimer=null,this._activityPhase="idle",this._activityError=null,this._paintActivityIndicator()},2200))}_paintActivityIndicator(){if(this._isDestroyed)return;const t=this._titleBar.querySelector("[data-os-activity-indicator]");t&&(t.setAttribute("phase",this._activityPhase),this._activityError?t.setAttribute("error",this._activityError):t.removeAttribute("error"))}requestAttention(t,o={}){const n=Pe.filter("os/window-attention-requested",{windowId:this.id,mode:t,durationMs:o.durationMs,intensity:o.intensity},o);if(!n||n.cancel===!0)return;const s=n.mode??t,i={...o,durationMs:typeof n.durationMs=="number"?n.durationMs:o.durationMs,intensity:typeof n.intensity=="string"?n.intensity:o.intensity},r=x("os.window.attention",s,{windowId:this.id,opts:i}),c=window.wp,a=c?.os?.dock,l=c?.os?.taskbar;let d=!1;if(typeof a?.setAttention=="function"&&(a.setAttention(this.id,r,i),d=!0),typeof l?.setAttention=="function"&&(l.setAttention(this.id,r,i),d=!0),!d&&r!==null){this.setHighlight("persistent");const h=i.durationMs??4e3;h>0&&window.setTimeout(()=>{this.setHighlight(null)},h)}else!d&&r===null&&this.setHighlight(null)}shake(){if(x("os.window.shake",!0,{windowId:this.id})===!1)return;const o=this.element;o.classList.remove("os-window--shaking"),o.offsetWidth,o.classList.add("os-window--shaking");const n=()=>{o.classList.remove("os-window--shaking"),o.removeEventListener("animationend",n)};o.addEventListener("animationend",n)}setHighlight(t,o){const n=this.element;n&&(n.classList.remove("wp-window--highlight-preview","wp-window--highlight-persistent"),t==="preview"?n.classList.add("wp-window--highlight-preview"):t==="persistent"&&n.classList.add("wp-window--highlight-persistent"),o?.color?n.style.setProperty("--wp-window-highlight-color",o.color):t===null&&n.style.removeProperty("--wp-window-highlight-color"),f(u.WINDOW_HIGHLIGHT_CHANGED,{windowId:this.id,mode:t,color:o?.color}))}close(){if(!this._isDestroyed){if(this.config.native&&!this._suppressCloseFilter){if(x(u.NATIVE_WINDOW_BEFORE_CLOSE,!0,{windowId:this.id,config:this.config})===!1)return}else if(!this.config.native&&!this._suppressCloseFilter&&this._iframeBridgeReady&&this.iframe){if(this._closePending)return;this._closePending=!0;try{this.iframe.contentWindow?.postMessage({type:"os-bridge-beforeunload-query"},location.origin),this._iframeCloseTimeout=setTimeout(()=>{this._isDestroyed||(this._suppressCloseFilter=!0,this._closePending=!1,this.close())},500);return}catch{this._closePending=!1}}if(this._isDestroyed=!0,this._discardSwapBuffer(),this._activityClearTimer!==null&&(window.clearTimeout(this._activityClearTimer),this._activityClearTimer=null),this._activitySettleTimer!==null&&(window.clearTimeout(this._activitySettleTimer),this._activitySettleTimer=null),this._titleBarButtonsUnsubscribe&&(this._titleBarButtonsUnsubscribe(),this._titleBarButtonsUnsubscribe=null),this._windowThemesUnsubscribe&&(this._windowThemesUnsubscribe(),this._windowThemesUnsubscribe=null),this._windowControlsUnsubscribe&&(this._windowControlsUnsubscribe(),this._windowControlsUnsubscribe=null),this._windowSlotsUnsubscribe&&(this._windowSlotsUnsubscribe(),this._windowSlotsUnsubscribe=null),this._windowChromesUnsubscribe&&(this._windowChromesUnsubscribe(),this._windowChromesUnsubscribe=null),this._nativeRenderCtxDispose){try{this._nativeRenderCtxDispose()}catch(t){f(u.SHELL_ERROR,{scope:"native-window-ctx-dispose",id:this.id,error:t})}this._nativeRenderCtxDispose=null}this._bodyResizeObserver?.disconnect(),this._bodyResizeObserver=null,this._tabOverflowTeardown?.(),this._tabOverflowTeardown=null,fn(this.id);try{this.config.onClose?.()}catch(t){f(u.SHELL_ERROR,{scope:"native-window-close",id:this.id,error:t})}this.onClose?.(this),this.element.classList.add("os-window--closing"),this._onCloseTransitionEnd=t=>{t.propertyName==="opacity"&&this._finalizeClose()},this.element.addEventListener("transitionend",this._onCloseTransitionEnd),this._closeSafetyNetTimer=setTimeout(()=>this._finalizeClose(),300)}}destroy(){if(!this._isFinalized){if(!this._isDestroyed){this._suppressCloseFilter=!0;try{this.close()}finally{this._suppressCloseFilter=!1}}this._finalizeClose()}}_finalizeClose(){if(!this._isFinalized){if(this._isFinalized=!0,this._closeSafetyNetTimer!==null&&(clearTimeout(this._closeSafetyNetTimer),this._closeSafetyNetTimer=null),this._onCloseTransitionEnd&&(this.element.removeEventListener("transitionend",this._onCloseTransitionEnd),this._onCloseTransitionEnd=null),this._windowControlsTeardown){try{this._windowControlsTeardown()}catch{}this._windowControlsTeardown=null}if(this._windowSlotsTeardown){try{this._windowSlotsTeardown()}catch{}this._windowSlotsTeardown=null}if(this._chromeHandle){try{this._chromeHandle.destroy()}catch{}this._chromeHandle=null}if(Mi(this),this._nativeRenderTeardown){try{this._nativeRenderTeardown()}catch(t){f(u.SHELL_ERROR,{scope:"native-window-teardown",id:this.id,error:t})}this._nativeRenderTeardown=null}window.removeEventListener("message",this._boundOnMessage),this._boundOnDocumentPointerDown&&document.removeEventListener("pointerdown",this._boundOnDocumentPointerDown,!0),this._unsubscribeWindowActions?.(),this._unsubscribeWindowActions=null,this.element.remove(),ee()}}installBodyResizeObserver(){const t=this.element.querySelector(".os-window__body");if(!t||typeof ResizeObserver>"u")return null;const o=new ResizeObserver(n=>{const s=n[0];if(!s)return;const i=s.contentRect,r=Math.round(i.width),c=Math.round(i.height);try{this.config.onResize?.(r,c)}catch(a){f(u.SHELL_ERROR,{scope:"native-window-resize",id:this.id,error:a})}f(u.WINDOW_BODY_RESIZED,{windowId:this.id,width:r,height:c})});return o.observe(t),o}getSnapshot(){if(this.element.offsetParent===null){const o=n=>{const s=parseFloat(n);return Number.isFinite(s)?Math.round(s):0};return{id:this.id,x:o(this.element.style.left),y:o(this.element.style.top),width:o(this.element.style.width),height:o(this.element.style.height),state:this.state}}return{id:this.id,x:this.element.offsetLeft,y:this.element.offsetTop,width:this.element.offsetWidth,height:this.element.offsetHeight,state:this.state}}getExternalTabCount(){return Bs(this)}getExternalTabsSnapshot(){return Gs(this)}toggleActionsMenu(){qo(this)}closeActionsMenu(){U(this)}openActionsMenu(){Vo(this)}};De.MIN_SAVING_DISPLAY_MS=1200;let dt=De;function A(e,...t){return{__wpdHtml:!0,strings:e,values:t}}function _r(e){return!!e&&e.__wpdHtml===!0}const wr="$$wpd$$",R=/\$\$wpd\$\$(\d+)\$\$/g;function yr(e){let t=e[0];for(let o=1;o<e.length;o++)t+=`${wr}${o-1}$$`+e[o];return t}const Xo=new WeakMap;function Yo(e){const t=Xo.get(e);if(t)return t;const o=document.createElement("template");o.innerHTML=yr(e);const n=[],s=(c,a)=>{if(c.nodeType===Node.ELEMENT_NODE){const h=c;for(const _ of Array.from(h.attributes)){const p=_.name,m=_.value,k=p[0];if(R.test(m))if(R.lastIndex=0,k==="@"){const w=R.exec(m);R.lastIndex=0,n.push({path:a,kind:"event",name:p.slice(1),valueIndex:w?Number(w[1]):0}),h.removeAttribute(p)}else if(k==="."){const w=R.exec(m);R.lastIndex=0,n.push({path:a,kind:"prop",name:p.slice(1),valueIndex:w?Number(w[1]):0}),h.removeAttribute(p)}else if(k==="?"){const w=R.exec(m);R.lastIndex=0,n.push({path:a,kind:"bool",name:p.slice(1),valueIndex:w?Number(w[1]):0}),h.removeAttribute(p)}else{const w=[],E=[];let y=0,v;for(R.lastIndex=0;(v=R.exec(m))!==null;)w.push(m.slice(y,v.index)),E.push(Number(v[1])),y=v.index+v[0].length;w.push(m.slice(y)),n.push({path:a,kind:"attr",name:p,template:w,valueIndices:E}),h.setAttribute(p,"")}}}const l=Array.from(c.childNodes);let d=0;for(let h=0;h<l.length;h++){const _=l[h],p=h+d;if(_.nodeType===Node.TEXT_NODE){const m=_.textContent||"";if(!R.test(m)){R.lastIndex=0;continue}R.lastIndex=0;const k=_.parentNode;let w=0,E;const y=[],v=[];for(R.lastIndex=0;(E=R.exec(m))!==null;){E.index>w&&y.push(document.createTextNode(m.slice(w,E.index)));const S=document.createTextNode("");y.push(S),v.push({path:[...a,p+y.length-1],kind:"node",valueIndex:Number(E[1])}),w=E.index+E[0].length}w<m.length&&y.push(document.createTextNode(m.slice(w)));for(const S of y)k.insertBefore(S,_);k.removeChild(_),d+=y.length-1,n.push(...v)}else s(_,[...a,p])}};s(o.content,[]);const r={template:o,buildParts:c=>{const a=[];for(const l of n){let d=c;for(const h of l.path)d=d.childNodes[h];l.kind==="node"?a.push({kind:"node",valueIndex:l.valueIndex,child:{anchor:d,state:null}}):l.kind==="attr"?a.push({kind:"attr",element:d,name:l.name,template:l.template,valueIndices:l.valueIndices}):l.kind==="event"?a.push({kind:"event",valueIndex:l.valueIndex,element:d,name:l.name}):l.kind==="prop"?a.push({kind:"prop",valueIndex:l.valueIndex,element:d,name:l.name}):l.kind==="bool"&&a.push({kind:"bool",valueIndex:l.valueIndex,element:d,name:l.name})}return a}};return Xo.set(e,r),r}const Zo=new WeakMap;function vr(e,t){for(const o of e.nodes)if(o.parentNode!==t)return!1;return!0}function Er(e,t){const o=Zo.get(t);if(o&&o.strings===e.strings&&vr(o,t)){Le(o.parts,e.values);return}const n=Yo(e.strings),s=n.template.content.cloneNode(!0),i=n.buildParts(s),r=Array.from(s.childNodes);for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(s),Le(i,e.values),Zo.set(t,{strings:e.strings,parts:i,nodes:r})}function Le(e,t){for(const o of e)if(o.kind==="node")ut(o.child,t[o.valueIndex]);else if(o.kind==="attr"){let n=o.template[0];for(let s=0;s<o.valueIndices.length;s++)n+=Qo(t[o.valueIndices[s]]),n+=o.template[s+1];n!==o.last&&(o.last=n,n===""?o.element.removeAttribute(o.name):o.element.setAttribute(o.name,n))}else if(o.kind==="event"){const n=t[o.valueIndex];n!==o.current&&(o.current&&o.element.removeEventListener(o.name,o.current),n&&o.element.addEventListener(o.name,n),o.current=n)}else if(o.kind==="prop"){const n=t[o.valueIndex];n!==o.last&&(o.last=n,o.element[o.name]=n)}else if(o.kind==="bool"){const n=!!t[o.valueIndex];n!==o.last&&(o.last=n,n?o.element.setAttribute(o.name,""):o.element.removeAttribute(o.name))}}function ut(e,t){if(t==null||t===!1){e.state&&(Y(e.state),e.state=null);return}if(Array.isArray(t)){Cr(e,t);return}if(_r(t)){kr(e,t);return}if(t instanceof Node){Ar(e,t);return}Sr(e,Qo(t))}function Ar(e,t){const o=e.state;o?.shape==="node"&&o.node===t||(o&&Y(o),Te(e,[t]),e.state={shape:"node",node:t})}function Sr(e,t){const o=e.state;if(o?.shape==="text"){o.text!==t&&(o.node.textContent=t,o.text=t);return}o&&Y(o);const n=document.createTextNode(t);Te(e,[n]),e.state={shape:"text",node:n,text:t}}function kr(e,t){const o=e.state;if(o?.shape==="template"&&o.strings===t.strings){Le(o.parts,t.values);return}o&&Y(o);const n=Yo(t.strings),s=n.template.content.cloneNode(!0),i=n.buildParts(s),r=Array.from(s.childNodes);Te(e,[s]),Le(i,t.values),e.state={shape:"template",strings:t.strings,parts:i,nodes:r}}function Cr(e,t){const o=e.state;if(o?.shape==="array"&&o.entries.length===t.length){for(let s=0;s<t.length;s++)ut(o.entries[s],t[s]);return}o&&Y(o);const n=[];for(const s of t){const i=document.createTextNode("");Te(e,[i]);const r={anchor:i,state:null};ut(r,s),n.push(r)}e.state={shape:"array",entries:n}}function Te(e,t){const o=e.anchor.parentNode;if(o)for(const n of t)o.insertBefore(n,e.anchor)}function Y(e){if(e.shape==="text"){e.node.remove();return}if(e.shape==="template"){for(const t of e.parts)t.kind==="node"&&t.child.state&&(Y(t.child.state),t.child.state=null);for(const t of e.nodes)t.parentNode&&t.parentNode.removeChild(t);return}if(e.shape==="node"){e.node.parentNode&&e.node.parentNode.removeChild(e.node);return}for(const t of e.entries)t.state&&Y(t.state),t.anchor.remove()}function Qo(e){return e==null||e===!1?"":String(e)}const X=class X 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(Jo)}connectedCallback(){this._adoptStyles(),this.requestUpdate()}attributeChangedCallback(t,o,n){if(o===n)return;const s=xr(t);this._propValues[s]=n,this.requestUpdate()}get classNames(){return Array.from(this.classList)}set classNames(t){if(t==null){this.removeAttribute("class");return}const n=(Array.isArray(t)?t:String(t).split(/\s+/)).map(s=>String(s).trim()).filter(s=>s!=="");this.className=n.join(" ")}requestUpdate(){this._scheduleRender()}emit(t,o){return this.dispatchEvent(new CustomEvent(t,{detail:o,bubbles:!0,composed:!0}))}_installPropAccessors(){const t=this.constructor;for(const o of t.props){if(Object.getOwnPropertyDescriptor(this,o))continue;const n=Jo(o);Object.defineProperty(this,o,{get:()=>o in this._propValues?this._propValues[o]:this.getAttribute(n),set:s=>{let i;s==null||s===!1?i=null:s===!0?i="":i=String(s),this._propValues[o]=i,i===null?this.removeAttribute(n):this.setAttribute(n,i),this.requestUpdate()},enumerable:!0,configurable:!0})}}_scheduleRender(){this._renderScheduled||!this.isConnected||(this._renderScheduled=!0,queueMicrotask(()=>{this._renderScheduled=!1,this.isConnected&&Er(this.render(),this._renderRoot)}))}_adoptStyles(){const t=this.constructor;if(t.styles.length!==0)if(t.shadow&&this.shadowRoot){const o=t.styles.map(n=>n.sheet).filter(n=>n!==null);if(this.shadowRoot.adoptedStyleSheets=o,o.length!==t.styles.length){for(const n of t.styles)if(!n.sheet){const s=document.createElement("style");s.textContent=n.cssText,this.shadowRoot.appendChild(s)}}}else this._adoptLightStyles(t)}_adoptLightStyles(t){if(!X._lightStylesAdopted.has(t)){X._lightStylesAdopted.add(t);for(const o of t.styles){const n=document.createElement("style");n.dataset.osUi=this.tagName.toLowerCase(),n.textContent=o.cssText,document.head.appendChild(n)}}}};X.props=[],X.styles=[],X.shadow=!0,X._lightStylesAdopted=new WeakSet;let B=X;function Z(e,t){customElements.get(e)||customElements.define(e,t)}function Jo(e){return e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}function xr(e){return e.replace(/-([a-z])/g,(t,o)=>o.toUpperCase())}const Ir=(()=>{try{return typeof new CSSStyleSheet().replaceSync=="function"}catch{return!1}})();function C(e,...t){let o=e[0];for(let n=1;n<e.length;n++){const s=t[n-1];if(typeof s=="string"||typeof s=="number")o+=String(s);else if(s&&s.__wpdCss)o+=s.cssText;else throw new TypeError("[os-ui] css`` interpolations must be strings, numbers, or other css`` results. Got: "+typeof s);o+=e[n]}if(Ir){const n=new CSSStyleSheet;return n.replaceSync(o),{__wpdCss:!0,sheet:n,cssText:o}}return{__wpdCss:!0,sheet:null,cssText:o}}const Lr=C`: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}`,Tr={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 Rr(e){const t=(e??"").trim();return t===""||t.length>4096||!/^(https?:\/\/|data:image\/)/i.test(t)||/['"()\\<>\s]/.test(t)?"":t}const re=class re extends B{constructor(){super(...arguments),this._activateWired=!1}render(){const t=Rr(this["icon-src"]||this.getAttribute("icon-src")||""),o=t?"":this.icon||"",n=Tr[o]||"";return t?A`
2 - <button type="button">
1 +(function(){"use strict";function xe(){const e=window.wp?.hooks;if(!e)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 e}function Mt(e,t,n,o){xe().addAction(e,t,n,o)}function Pt(e,t){return xe().removeAction(e,t)}function T(e,t,...n){return xe().applyFilters(e,t,...n)}function m(e,...t){xe().doAction(e,...t)}const f={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",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"},Po="os.activity.";function Ve(e){return Po+String(e).replace(/[^a-zA-Z0-9_.-]/g,".")}let $o=0;const Ke={publish(e,t){m(Ve(e),t)},subscribe(e,t){const n=`os/activity-sub/${++$o}`,o=Ve(e);Mt(o,n,s=>t(s));let i=!1;return()=>{i||(i=!0,Pt(o,n))}},filter(e,t,...n){return T(Ve(e),t,...n)}},$t="__openStationSharedStores";function zo(){const e=window;let t=e[$t];return t||(t=new Map,e[$t]=t),t}function k(e,t){const n=zo();let o=n.get(e);o||(o={state:t(),listeners:new Set,rebuild:t},n.set(e,o));const i={get state(){return o.state},set state(s){o.state=s},getState(){return o.state},notify(){for(const s of Array.from(o.listeners))try{s(o.state)}catch(r){console.error(`[desktop-mode/shared-store:${e}] subscriber threw:`,r)}},subscribe(s){return o.listeners.add(s),()=>{o.listeners.delete(s)}},setState(s){const r=o.state;if(typeof r!="object"||r===null){console.warn(`[desktop-mode/shared-store:${e}] setState called on a primitive store; use the state setter instead.`);return}Object.assign(r,s),i.notify()},reset(){const s=o.rebuild(),r=o.state;if(typeof r=="object"&&r!==null&&typeof s=="object"&&s!==null){const d=r;for(const a of Object.keys(d))delete d[a];Object.assign(d,s)}else o.state=s;o.listeners.clear()}};return i}const G=k("desktop-mode/window-channels",()=>({parentSubs:new Map,nativeSubs:new Map,readyWindows:new Set,loadingWindows:new Set,pendingSends:new Map}));function Te(e,t,n,o){let i=e.get(t);if(!i){if(!o)return;i=new Map,e.set(t,i)}let s=i.get(n);if(!s){if(!o)return;s=new Set,i.set(n,s)}return s}function zt(e,t,n,o){const i={channel:n,windowId:t},s=Te(e,t,n,!1);if(s)for(const d of Array.from(s))try{d(o,i)}catch(a){typeof console<"u"&&console.error(`[openstation] window-channel subscriber for "${n}" threw:`,a)}const r=Te(e,t,"*",!1);if(r)for(const d of Array.from(r))try{d(o,i)}catch(a){typeof console<"u"&&console.error(`[openstation] window-channel wildcard subscriber for "${t}" threw:`,a)}}function Ho(e,t,n){const o=Te(G.state.parentSubs,e,t,!0);o.add(n);let i=!1;return()=>{i||(i=!0,o.delete(n))}}function Ht(e,t,n){zt(G.state.parentSubs,e,t,n)}function Fo(e,t,n){const o=Te(G.state.nativeSubs,e,t,!0);o.add(n);let i=!1;return()=>{i||(i=!0,o.delete(n))}}function Uo(e,t,n){zt(G.state.nativeSubs,e,t,n)}function Ft(e){return G.state.readyWindows.has(e)}function Ie(e){const{loadingWindows:t}=G.state;t.has(e)||(t.add(e),m(f.WINDOW_CONTENT_LOADING,{windowId:e}),typeof document<"u"&&document.dispatchEvent(new CustomEvent("os-window-content-loading",{detail:{windowId:e}})))}function $(e){const{readyWindows:t,loadingWindows:n,pendingSends:o}=G.state;if(!t.has(e)){t.add(e);const i=o.get(e);if(i){o.delete(e);for(const s of i)try{s.flush()}catch(r){typeof console<"u"&&console.error(`[openstation] flushing queued window-send for "${s.channel}" threw:`,r)}}}n.delete(e)&&(m(f.WINDOW_CONTENT_LOADED,{windowId:e}),typeof document<"u"&&document.dispatchEvent(new CustomEvent("os-window-content-loaded",{detail:{windowId:e}})))}function Go(e,t,n,o){const{pendingSends:i}=G.state;let s=i.get(e);s||(s=[],i.set(e,s)),s.push({channel:t,payload:n,flush:o})}function Bo(e){const t=G.state;t.parentSubs.delete(e),t.nativeSubs.delete(e),t.readyWindows.delete(e),t.loadingWindows.delete(e),t.pendingSends.delete(e)}const qo=k("desktop-mode/connection",()=>({connSeq:0,connections:new Map,connectionsByTarget:new Map,syntheticIframes:new Map}));function Vo(e){return qo.state.syntheticIframes.get(e)??null}const Ko="data-os-mode";function Ut(e=typeof document<"u"?document.documentElement:null){return!!e&&e.getAttribute(Ko)==="mobile"}const jo=Object.freeze({top:0,right:0,bottom:0,left:0});function Yo(e,t,n){return{x:n.left,y:n.top,width:Math.max(0,e-n.left-n.right),height:Math.max(0,t-n.top-n.bottom)}}const Xo="os/work-area";function Zo(){return{insets:{...jo},rect:{x:0,y:0,width:0,height:0},viewport:{x:0,y:0,width:0,height:0},area:{width:0,height:0}}}const je=k(Xo,()=>({snapshot:Zo(),installed:!1,areaEl:null}));function Ye(e){const t=e??je.state.areaEl;if(!t)return{...je.state.snapshot.rect};const n=t.clientWidth||t.getBoundingClientRect().width,o=t.clientHeight||t.getBoundingClientRect().height;return Yo(n,o,je.state.snapshot.insets)}const Qo="desktop-mode";function Gt(){return window.wp?.i18n}function _(e,t=Qo){return Gt()?.__(e,t)??e}function ie(e,...t){const n=Gt()?.sprintf;if(n)return n(e,...t);let o=0;return e.replace(/%(?:(\d+)\$)?[sd]/g,(i,s)=>{const r=s?Number.parseInt(s,10)-1:o++;return String(t[r]??"")})}const Jo="openstation";function ei(e,t){let n;if(typeof e=="string")try{n=new URL(e,t??(typeof window<"u"?window.location.href:void 0))}catch{return!1}else n=e;return n.pathname.slice(n.pathname.lastIndexOf("/")+1)==="admin.php"&&n.searchParams.get("page")===Jo}const Bt="os_tab",ti=k("desktop-mode/native-url-remap",()=>({remaps:[],deps:null}));function Xe(e,t={}){const{deps:n,remaps:o}=ti.state;if(!n||!e)return!1;let i;try{i=new URL(e,n.adminUrl)}catch{return!1}const s=n.getSnapshot();for(const r of o){if(!r.matches(e,i)||r.enabled&&!r.enabled(s))continue;if(r.onMatch)try{r.onMatch(e,i)}catch(u){console.warn(`[openstation] URL remap onMatch hook threw for "${r.id}":`,u)}let d;const a=i.searchParams.get(Bt);if(r.params)try{d=r.params(e,i)??void 0}catch(u){console.warn(`[openstation] URL remap params hook threw for "${r.id}":`,u)}a&&/^[a-z0-9_-]+$/.test(a)&&(d={...d??{},tab:a});const c=t.newInstance&&n.openNewById?n.openNewById:n.openById;if(d?c(r.nativeWindowId,{params:d}):c(r.nativeWindowId))return!0}return!1}const ni="os-window-tab-change";function Ze(e){return Array.from(e.querySelectorAll(".os-window__tab"))}function qt(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-")}function Vt(e,t){return`${e.id||"os-window"}-tab-${qt(t)}`}function Kt(e,t){return`${e.id||"os-window"}-panel-${qt(t)}`}function jt(e){const t=e.querySelector(".os-window__tab-plate");if(!t)return;const n=e.querySelector(".os-window__tab--active");if(!n){t.dataset.empty="",e.dataset.tabPlateEmpty="";return}delete t.dataset.empty,delete e.dataset.tabPlateEmpty,e.style.setProperty("--_tab-plate-x",`${n.offsetLeft}px`),e.style.setProperty("--_tab-plate-w",`${n.offsetWidth}px`),e.style.setProperty("--_tab-strip-w",`${e.clientWidth}px`),n.offsetWidth>0&&(t.dataset.placed="")}function le(e){if(e){if(e.querySelector(":scope > .os-window__tab")){e.setAttribute("role","tablist");const t=e.dataset.tablistLabel;t&&e.setAttribute("aria-label",t);return}e.setAttribute("role","presentation"),e.removeAttribute("aria-label")}}function Yt(e){const t=Ze(e);if(t.length===0)return;const n=t.find(o=>o.classList.contains("os-window__tab--active"))??t[0];for(const o of t){const i=o===n?0:-1;o.tabIndex!==i&&(o.tabIndex=i)}}function oi(e,t){const n=t;if(n.altKey||n.ctrlKey||n.metaKey)return;const i=n.target?.closest(".os-window__tab");if(!i)return;const s=Ze(e),r=s.indexOf(i);if(r<0)return;const d=getComputedStyle(e).direction==="rtl";let a;switch(n.key){case"ArrowRight":a=s[d?r-1:r+1];break;case"ArrowLeft":a=s[d?r+1:r-1];break;case"Home":a=s[0];break;case"End":a=s[s.length-1];break;default:return}!a||a===i||(n.preventDefault(),i.tabIndex=-1,a.tabIndex=0,a.focus(),a.scrollIntoView?.({block:"nearest",inline:"nearest"}))}function Xt(e){const t=new Map;for(const n of Ze(e))n.dataset.kind==="panel"&&n.dataset.panel&&t.set(n.dataset.panel,n);return t}function Zt(e){const t=e.querySelector(".os-window__body");return t?Array.from(t.querySelectorAll("os-tabpanel[ for ]")).filter(n=>!n.parentElement?.closest("os-tabpanel, os-tabs")):[]}function Qe(e,t){const n=e.querySelector(".os-window__tabs");if(!n)return;let o=!1;for(const[i,s]of Xt(n)){const r=i===t;o=o||r,s.classList.toggle("os-window__tab--active",r),s.setAttribute("aria-selected",r?"true":"false")}if(o){for(const i of Zt(e)){const s=i.getAttribute("for")===t;i.toggleAttribute("hidden",!s),i.setAttribute("aria-hidden",s?"false":"true")}Yt(n),jt(n),e.dispatchEvent(new CustomEvent(ni,{bubbles:!0,detail:{value:t}}))}}function ii(e,t,n){const o=e.querySelector(".os-window__tabs");if(!o)return;const i=Xt(o),s=Array.from(i.entries()).find(([,l])=>l.classList.contains("os-window__tab--active"))?.[0];let r=o.querySelector(".os-window__tab-plate");for(const l of t){let u=i.get(l.value);if(u)i.delete(l.value);else{const p=document.createElement("button");p.type="button",u=p,u.className="os-window__tab",u.dataset.kind="panel",u.dataset.panel=l.value,u.setAttribute("role","tab"),u.setAttribute("aria-selected","false"),u.tabIndex=-1}u.textContent!==l.label&&(u.textContent=l.label),u.id=Vt(e,l.value),u.setAttribute("aria-controls",Kt(e,l.value)),u.previousElementSibling!==r&&o.insertBefore(u,r?r.nextSibling:o.firstChild),r=u}for(const l of i.values())l.remove();le(o);const d=o.querySelector(":scope > .os-window__tab")!==null;for(const l of Zt(e)){const u=l.getAttribute("for");u&&(l.id=Kt(e,u),d?l.setAttribute("aria-labelledby",Vt(e,u)):l.removeAttribute("aria-labelledby"))}const a=l=>l!==void 0&&t.some(u=>u.value===l),c=[n,s,t[0]?.value].find(a);c!==void 0&&Qe(e,c)}let si=0;function ri(e,t={}){const n=++si,o=l=>`desktop-mode/native-render-ctx/${e}/${n}/${l}`,i=new AbortController,s=[],r=(l,u,p,g)=>{const b=o(u);Mt(l,b,w=>{p(w)&&g(w)});const y=()=>{Pt(l,b)};return s.push(y),y},d=l=>!!l&&typeof l=="object"&&l.windowId===e;return{ctx:{window:{send(l,u){typeof l!="string"||l===""||Ht(e,l,u)},on(l,u){return typeof l!="string"||l===""||typeof u!="function"?()=>{}:Fo(e,l,u)},markLoading(){Ie(e)},markReady(){$(e)}},markLoading(){Ie(e)},markReady(){$(e)},signal:i.signal,onResize(l){return typeof l!="function"?()=>{}:r(f.WINDOW_BODY_RESIZED,"on-resize",d,u=>{const{width:p,height:g}=u;try{l(p,g)}catch(b){m(f.SHELL_ERROR,{scope:"native-render-ctx/onResize",id:e,error:b})}})},onHide(l){return typeof l!="function"?()=>{}:r(f.WINDOW_MINIMIZED,"on-hide",d,()=>{try{l()}catch(u){m(f.SHELL_ERROR,{scope:"native-render-ctx/onHide",id:e,error:u})}})},onShow(l){return typeof l!="function"?()=>{}:r(f.WINDOW_RESTORED,"on-show",d,()=>{try{l()}catch(u){m(f.SHELL_ERROR,{scope:"native-render-ctx/onShow",id:e,error:u})}})},params:t},dispose:()=>{try{i.abort()}catch{}for(;s.length;){const l=s.pop();try{l?.()}catch{}}}}}const Qt=["post_type","page","taxonomy","path","post","c","tag_ID","item","p"].filter(e=>e!=="p"),Je=[];function ai(e){if(!e.pathname.endsWith("/admin.php")||!e.searchParams.get("page"))return Je;const t=e.searchParams.get("action");return t==="edit"&&e.searchParams.get("id")?["id"]:t==="new"?["action"]:Je}function Jt(e){try{const t=new URL(e,window.location.origin),n=new URLSearchParams,o=[...Qt,...ai(t)];for(const s of o){const r=t.searchParams.get(s);r?n.set(s,r):s==="post_type"&&(t.pathname.endsWith("/edit.php")||t.pathname.endsWith("/post-new.php"))&&n.set(s,"post")}n.sort();const i=n.toString();return t.pathname.replace(/\/+$/,"")+(i?`?${i}`:"")}catch{return e}}function Y(e){try{const t=new URL(e,window.location.origin);return t.searchParams.delete("openstation_chromeless"),t.searchParams.delete("desktop_mode_portal"),t.pathname.replace(/\/+$/,"")+"?"+t.searchParams.toString()}catch{return e}}const en="X-WP-Nonce";function li(e,t){const n=ci();if(!n)return t;const o=di(e);if(!o||!ui(o))return t;const i=t?.headers??(typeof Request<"u"&&e instanceof Request?e.headers:void 0),s=new Headers(i??{});return s.has(en)?t:(s.set(en,n),{...t??{},headers:s})}function ci(){if(typeof window>"u")return;const t=window.openStationConfig?.restNonce;return typeof t=="string"&&t.length>0?t:void 0}function di(e){try{const t=typeof window<"u"&&window.location?window.location.href:void 0;return typeof e=="string"?new URL(e,t):e instanceof URL?e:typeof Request<"u"&&e instanceof Request?new URL(e.url,t):null}catch{return null}}function ui(e){return typeof window>"u"||!window.location||e.origin!==window.location.origin?!1:!!(e.pathname.includes("/wp-json/")||e.searchParams.has("rest_route"))}function hi(e,t,n={}){const o=window.wp?.os?.fetch;if(typeof o=="function")return o(e,t,n);const i=li(e,t);return fetch(e,i)}const tn=k("desktop-mode/dock-rail-registry",()=>({registry:new Map,listeners:new Set,activeId:"default"}));tn.state.registry,tn.state.listeners;function fi(e,t){if(!e||typeof e!="object")return["def (not an object)"];const n=e,o=[];for(const i of t)i.valid(n)||o.push(`${i.field} (${i.message})`);return o}class pi extends Error{constructor(t,n,o){super(`[openstation] ${t} registration rejected — fields: `+n.join(", ")+"."),this.name="RegistrationError",this.kind=t,this.errors=n,this.def=o}}function et(e,t,n){if(t.length!==0)throw new pi(e,t,n)}function nn(e,t,n){typeof console>"u"||console.warn(`[openstation] ${e} registration rejected — fields: `+t.join(", ")+".",n)}const X=[[0,0],[100,0],[100,100],[0,100]],mi=48,gi=80,tt=6,nt=8,on=4,sn=3,rn=64,ot=105,Z=2;function an(e){return`${Math.round(e*1e3)/1e3}%`}function Q(e){return e.slice().reverse()}function ce(e,t,n,o){return[[e,t],[n,t],[n,o],[e,o]]}function _i(e,t,n,o){const i=[];for(let s=0;s<o;s++){const r=s/o*Math.PI*2;i.push([e+Math.cos(r)*n,t+Math.sin(r)*n])}return i}function z(e,t=[]){const n=[],o=i=>{n.push(`${an(i[0])} ${an(i[1])}`)};for(const i of e)o(i);if(t.length>0){o(e[0]);for(const i of t){for(const s of i)o(s);o(i[0]),o(e[0])}}return`polygon( ${n.join(", ")} )`}function ln(e){return z(X,[Q(_i(50,50,e,mi))])}function cn(e){return z(X,[Q(ce(50-e,-Z,50+e,100+Z))])}function dn(e){const t=100/tt,n=[];for(let o=0;o<tt;o++){const i=o*t;n.push(Q(ce(-Z,i,100+Z,i+e)))}return z(X,n)}function un(e){return z(X,[Q(ce(-Z,50-e,100+Z,50+e))])}function hn(e){const t=100/nt,n=[];for(let o=0;o<nt;o++){const i=o*t;n.push(Q(ce(i,-Z,i+e,100+Z)))}return z(X,n)}function fn(e){return z(X,[Q([[50,50-e],[50+e,50],[50,50+e],[50-e,50]])])}function pn(e){const t=100/on,n=100/sn,o=[];for(let i=0;i<sn;i++)for(let s=0;s<on;s++){const r=s*t+t/2,d=i*n+n/2,a=t/2*e,c=n/2*e;o.push(Q(ce(r-a,d-c,r+a,d+c)))}return z(X,o)}function mn(e){const t=-Math.PI/2,n=e/180*Math.PI,o=[[50,50]];for(let i=0;i<rn;i++){const s=t+i/(rn-1)*n;o.push([50+Math.cos(s)*ot,50+Math.sin(s)*ot])}return z(X,[Q(o)])}function bi(){return{from:ln(0),to:ln(gi)}}function wi(){return{from:cn(0),to:cn(52)}}function yi(){return{from:dn(0),to:dn(100/tt+.5)}}function vi(){return{from:un(0),to:un(52)}}function Ei(){return{from:hn(0),to:hn(100/nt+.5)}}function Ai(){return{from:fn(0),to:fn(ot)}}function Si(){return{from:pn(0),to:pn(1.04)}}function Ci(){return{from:mn(0),to:mn(360)}}function ki(){return{from:"inset( 0% 0% 0% 0% )",to:"inset( 0% 0% 100% 0% )"}}function xi(){return{from:"inset( 0% 0% 0% 0% )",to:"inset( 0% 0% 0% 100% )"}}function Ti(){return{from:z([[-60,0],[100,0],[100,100],[0,100]]),to:z([[100,0],[260,0],[260,100],[160,100]])}}const it=6,st=100,se=st/2,Le=200,gn=90,_n=["#5c5c6d","#525261","#484855","#3e3e49","#34343d","#2a2a31"],Ii="#101014",Li=1.25,re="http://www.w3.org/2000/svg";let Ni=0;function Ne(e){return Math.round(e*1e3)/1e3}function rt(e){return e/it*Math.PI*2-Math.PI/2}function Ri(e){const n=rt(e)+Math.PI/it+Math.PI/2;return{x:Math.cos(n),y:Math.sin(n)}}function Oi(e){const t=rt(e),n=rt(e+1);return[[se,se],[se+Math.cos(t)*Le,se+Math.sin(t)*Le],[se+Math.cos(n)*Le,se+Math.sin(n)*Le]]}function bn(e,t){const n=Oi(e),o=document.createElementNS(re,"path");return o.setAttribute("d",`M ${n.map(([i,s])=>`${Ne(i)} ${Ne(s)}`).join(" L ")} Z`),t?o.setAttribute("fill","#fff"):(o.setAttribute("fill",_n[e%_n.length]),o.setAttribute("stroke",Ii),o.setAttribute("stroke-width",String(Li)),o.setAttribute("vector-effect","non-scaling-stroke"),o.setAttribute("stroke-linejoin","round")),o}function Di(){const e=`os-iris-${++Ni}`,t=document.createElementNS(re,"svg");t.setAttribute("viewBox",`0 0 ${st} ${st}`),t.setAttribute("preserveAspectRatio","none"),t.setAttribute("aria-hidden","true"),t.style.width="100%",t.style.height="100%",t.style.display="block";const n=document.createElementNS(re,"defs"),o=document.createElementNS(re,"mask");o.setAttribute("id",e);const i=document.createElementNS(re,"g"),s=document.createElementNS(re,"g");s.setAttribute("mask",`url(#${e})`);const r=[];for(let a=0;a<it;a++){const c=bn(a,!0),l=bn(a,!1);i.appendChild(c),s.appendChild(l),r.push({el:c,index:a},{el:l,index:a})}o.appendChild(i),n.appendChild(o),t.appendChild(n),t.appendChild(s);const d=document.createElement("div");return d.appendChild(t),{element:d,play:a=>r.map(({el:c,index:l})=>{const u=Ri(l),p=Ne(u.x*gn),g=Ne(u.y*gn);return c.animate([{transform:"translate( 0px, 0px )"},{transform:`translate( ${p}px, ${g}px )`}],{duration:a.duration,easing:a.easing,delay:a.delay,fill:"both"})})}}const at="none",Wi=70,Mi=600,wn=k("desktop-mode/window-reveal-registry",()=>({registry:new Map,listeners:new Set})),yn=wn.state.registry,Pi=wn.state.listeners,vn=/^[a-z0-9_/-]+$/;function En(e){const t=/^\s*([a-zA-Z-]+)\s*\(/.exec(e);return t?t[1].toLowerCase():""}const $i=0;function zi(e){return typeof e!="number"||!Number.isFinite(e)?Wi:Math.min(Mi,Math.max(0,e))}function Hi(e){return typeof e.render=="function"?[]:Array.isArray(e.layers)&&e.layers.length>0?e.layers:typeof e.from=="string"&&typeof e.to=="string"?[{from:e.from,to:e.to}]:[]}function An(e,t){const n=[],o=typeof e.from=="string"&&e.from.trim()!=="",i=typeof e.to=="string"&&e.to.trim()!=="";if(o||n.push(`${t}.from (missing — the clip-path covering the window)`),i||n.push(`${t}.to (missing — the clip-path uncovering the window)`),o&&i){const s=En(e.from),r=En(e.to);s===""||r===""?n.push(`${t}.from|to (must be shape functions, e.g. \`inset( … )\` or \`polygon( … )\` — bare keywords like \`none\` cannot be animated)`):s!==r&&n.push(`${t}.from|to (must use the same shape function to interpolate — got \`${s}()\` and \`${r}()\`)`)}return n}function Fi(e){if(typeof KeyframeEffect!="function")return!0;try{return new KeyframeEffect(null,null,{easing:e}),!0}catch{return!1}}function W(e){const t=[];if(!e||typeof e!="object")t.push("def (not an object)");else{typeof e.id!="string"||e.id.trim()===""?t.push("id (missing)"):vn.test(e.id.trim().toLowerCase())?e.id.trim().toLowerCase()===at&&t.push('id ("none" is reserved)'):t.push(`id (must match ${vn} — lowercase alphanum, hyphens, underscores, slashes for vendor/sub-id)`),(typeof e.label!="string"||e.label.trim()==="")&&t.push("label (missing)");const o=e.render!==void 0,i=Array.isArray(e.layers),s=e.from!==void 0||e.to!==void 0;o&&typeof e.render!="function"?t.push("render (not a function)"):o&&(i||s)?t.push("render|layers|from|to (supply exactly one of: a from/to pair, a layers array, or a render function)"):o||(i&&s?t.push("layers|from|to (supply EITHER a single from/to pair OR a layers array, not both)"):i?(e.layers.length===0&&t.push("layers (empty — supply at least one matched pair)"),e.layers.forEach((r,d)=>{if(!r||typeof r!="object"){t.push(`layers[ ${d} ] (not an object)`);return}t.push(...An(r,`layers[ ${d} ]`))})):t.push(...An(e,"").map(r=>r.replace(/^\./,"")))),e.easing!==void 0&&(typeof e.easing!="string"||e.easing.trim()===""?t.push("easing (not a non-empty string)"):Fi(e.easing)||t.push("easing (not an easing the browser can parse — `Element.animate()` would throw at play time, with the covering surface already over the window)"))}et("WindowReveal",t,e);const n=e.id.trim().toLowerCase();yn.set(n,{...e,id:n}),Bi()}function Ui(){const e=Array.from(yn.values()),t=T(f.WINDOW_REVEALS,e);return Array.isArray(t)?t:(typeof console<"u"&&console.warn("[openstation] `os.window-reveals` filter returned a non-array; falling back to registry list."),e)}function Gi(e){return Ui().find(t=>t.id===e)}function Bi(){const e=Array.from(Pi);for(const t of e)try{t()}catch(n){typeof console<"u"&&console.error("[openstation] window-reveal registry listener threw:",n)}}W({id:"sweep",label:_("Sweep"),description:_("A straight edge travels across the window, uncovering the page behind it."),...xi(),duration:420}),W({id:"iris",label:_("Iris"),description:_("The page opens out from the centre of the window, like a camera shutter."),...bi(),duration:520}),W({id:"curtain",label:_("Curtain"),description:_("Two panels part from the middle of the window and slide off the sides."),...wi(),duration:480}),W({id:"blinds",label:_("Blinds"),description:_("Six horizontal slats retract at once, letting the page through between them."),...yi(),duration:560}),W({id:"diagonal",label:_("Diagonal"),description:_("A slanted edge sweeps off the trailing corner of the window."),...Ti(),duration:460}),W({id:"rise",label:_("Rise"),description:_("The page rises into the window from the bottom edge upward."),...ki(),duration:440}),W({id:"shutter",label:_("Shutter"),description:_("Two panels part from the middle of the window and slide off the top and bottom."),...vi(),duration:480}),W({id:"slats",label:_("Slats"),description:_("Eight vertical slats retract at once, letting the page through between them."),...Ei(),duration:560}),W({id:"diamond",label:_("Diamond"),description:_("The page opens out from the centre of the window through a growing rhombus."),...Ai(),duration:520}),W({id:"mosaic",label:_("Mosaic"),description:_("The page arrives as a grid of tiles, each opening out from its own centre."),...Si(),duration:600}),W({id:"obturator",label:_("Camera shutter"),description:_("Six wedges slide aside in unison, opening a hexagonal aperture from the centre like the iris of a camera lens."),render:Di,duration:720,edgeLag:0}),W({id:"radar",label:_("Radar"),description:_("A spoke sweeps a full turn around the centre of the window, uncovering the page behind it."),...Ci(),duration:760});const Sn={dockSize:["compact","default","large"],desktopLayout:["classic","unified"],dockPlacement:["bottom","left","right"],windowRadius:["sharp","default","round"],adminBarMode:["static","dynamic","hidden"]},Cn=["dockRailRenderer","windowReveal","accent"],kn={windowRevealDuration:{min:80,max:4e3}},qi=/^[a-z0-9_-]+$/;[...Object.keys(Sn),...Cn,...Object.keys(kn)];function Vi(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t=e,n={},o={};for(const[i,s]of Object.entries(Sn)){const r=t[i];typeof r=="string"&&s.includes(r)&&(n[i]=r)}for(const i of Cn){const s=t[i];typeof s=="string"&&qi.test(s)&&(n[i]=s)}for(const[i,s]of Object.entries(kn)){const r=t[i];typeof r=="number"&&Number.isFinite(r)&&(o[i]=Math.min(s.max,Math.max(s.min,Math.round(r))))}return{...n,...o}}const Ki=/^[a-z0-9_-]+$/,xn=128;function ji(e){return typeof e!="string"||e===""||e.length>2048?!1:e.startsWith("dashicons-")||e.startsWith("https://")||e.startsWith("http://")||e.startsWith("data:image/")}function Yi(e){if(!e||typeof e!="object")return null;const t=e,n=typeof t.slug=="string"?t.slug:"";if(!Ki.test(n))return null;const o={};if(t.icons&&typeof t.icons=="object"){let a=0;for(const[c,l]of Object.entries(t.icons)){if(a>=xn)break;c===""||!ji(l)||(o[c]=l,a+=1)}}const i={};if(t.tokens&&typeof t.tokens=="object")for(const[a,c]of Object.entries(t.tokens))typeof c=="string"&&(i[a]=c);const s=[];if(Array.isArray(t.fonts))for(const a of t.fonts)typeof a=="string"&&a!==""&&s.push(a);const r={};if(t.iconColors&&typeof t.iconColors=="object"){let a=0;for(const[c,l]of Object.entries(t.iconColors)){if(a>=xn)break;c===""||typeof l!="string"||l===""||(r[c]=l,a+=1)}}const d=a=>typeof t[a]=="string"?t[a]:"";return{id:d("id")||n,slug:n,name:d("name")||n,version:d("version"),author:d("author"),description:d("description"),previewUrl:d("previewUrl"),cssUrl:d("cssUrl"),cssText:d("cssText"),tokens:i,fonts:s,icons:o,iconColors:r,recommendedOsSettings:Vi(t.recommendedOsSettings),installedAt:typeof t.installedAt=="number"?t.installedAt:0,source:t.source==="code"?"code":"upload",cssDeferred:t.cssDeferred===!0}}function Xi(){const t=window.openStationConfig?.serverDesktopThemes,n=[];if(Array.isArray(t))for(const o of t){const i=Yi(o);i&&n.push(i)}return{themes:n,activeId:null,activeIcons:null,activeIconColors:null}}const Zi=k("desktop-mode/desktop-themes",Xi);function Tn(){return Zi}function In(e){const t=Tn().state;if(t.activeIcons===null||!e)return null;const n=t.activeIcons[e];if(typeof n!="string"||n==="")return null;const o=T(f.DESKTOP_THEME_ICON,n,{slot:e,themeId:t.activeId??""});return typeof o=="string"&&o!==""?o:null}function Ln(e){const t=Tn().state;if(t.activeIconColors===null||!e)return null;const n=t.activeIconColors[e];if(typeof n!="string"||n==="")return null;const o=T(f.DESKTOP_THEME_ICON_COLOR,n,{slot:e,themeId:t.activeId??""});return typeof o=="string"&&o!==""?Qi(o):null}function Qi(e){const t=e.trim();if(t===""||t.length>64||/[;{}<>"'\\]/.test(t))return null;let n=0;for(const o of t)if(o==="(")n+=1;else if(o===")"&&(n-=1,n<0))return null;return n===0?t:null}const de={OS_SETTINGS:"OS_SETTINGS",RECYCLE_BIN:"RECYCLE_BIN",BUG_REPORT:"BUG_REPORT",EXIT_OPENSTATION:"EXIT_OPENSTATION",PWA_INSTALL:"PWA_INSTALL"},Ji={"desktop-mode-os-settings":de.OS_SETTINGS,"desktop-mode-recycle-bin":de.RECYCLE_BIN,"desktop-mode-bug-report":de.BUG_REPORT,"os-exit":de.EXIT_OPENSTATION,"os-pwa-install":de.PWA_INSTALL};function es(e){if(typeof e!="string"||e==="")return"";const t=Ji[e];if(t)return t;const n=e.toLowerCase().replace(/[^a-z0-9_-]/g,"");return n===""?"":`APP:${n}`}function ts(e){if(typeof e!="string"||e==="")return"";const t=e.replace(/^core\//,"").toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,"");return t===""?"":`WINDOW_CONTROL_${t}`}function lt(e,t){const n=ts(t),o=In(n),i=Ln(n);if(o===null&&i===null)return!1;if(i!==null?e.style.setProperty("--os-ui-btn-icon-color",i):e.style.removeProperty("--os-ui-btn-icon-color"),o===null)return e.style.setProperty("color",i),!1;if(o.startsWith("dashicons-")){e.removeAttribute("icon-src"),e.removeAttribute("icon");const s=document.createElement("span");return s.className=`dashicons ${o}`,s.setAttribute("aria-hidden","true"),i!==null&&(s.style.color=i),e.appendChild(s),!0}return e.setAttribute("icon-src",o),!0}let ct=null;function Re(){return!!window.openStationShellOverlays}function ns(e){return new Promise((t,n)=>{const o=document.querySelector('script[data-os-shell-overlays="1"]'),i=()=>{if(Re()){t();return}n(new Error("[openstation] shell-overlays bundle loaded but did not set `window.openStationShellOverlays`."))};if(o){Re()?i():(o.addEventListener("load",i),o.addEventListener("error",()=>n(new Error("failed to load shell-overlays bundle"))));return}const s=document.createElement("script");s.src=e,s.async=!0,s.dataset.osShellOverlays="1",s.addEventListener("load",i),s.addEventListener("error",()=>n(new Error("failed to load shell-overlays bundle"))),document.head.appendChild(s)})}function os(e){return Re()||!e?Promise.resolve():(ct||(ct=ns(e)),ct)}function is(){return window.openStationConfig?.shellOverlaysBundleUrl??""}function ss(e,t){const n=is();if(Re()||!n){t();return}os(n).then(()=>{e()&&t()}).catch(o=>{typeof console<"u"&&console.warn("[openstation] shell-overlays failed to load; menu/dialog suppressed:",o)})}const rs=4e3,as=200,ls=1200;function dt(e){const t=Ke.filter("os/toast-requested",{...e});if(!t||t.cancel===!0)return()=>{};let n=!1,o=null;return ss(()=>!n,()=>{o=us(t)}),()=>{n=!0,o&&o()}}const cs={success:"positive",warning:"warning",error:"critical","shell-error":"critical"};function ds(e){return e?window.openStationConfig?.toastTypes?.find(o=>o.id===e)?.tone??cs[e]??null:null}function us(e){const t=ms(),n=document.createElement("os-toast");n.textContent=e.message;const o=ds(e.type);o&&n.setAttribute("tone",o),e.action&&(n.setAttribute("action",e.action.label),n.addEventListener("os-toast-action",()=>{e.action?.onClick(),c()})),e.dismissible&&(n.setAttribute("dismissible",""),n.addEventListener("os-toast-dismiss",()=>{e.onDismiss?.(),c()})),t.appendChild(n);let i=!1,s=null,r=e.duration??rs,d=0;const a=()=>{s!==null&&(window.clearTimeout(s),s=null)},c=()=>{i||(i=!0,a(),ps(n),n.setAttribute("state","out"),window.setTimeout(()=>{n.remove(),fs()},as))},l=()=>{i||e.persistent||s!==null||(d=Date.now(),s=window.setTimeout(c,r))},u=()=>{s!==null&&(r=Math.max(0,r-(Date.now()-d)),a())};return requestAnimationFrame(()=>{n.setAttribute("state","in")}),n.addEventListener("os-toast-hold",p=>{if(p.detail?.held){u();return}r=Math.max(r,ls),l()}),hs(n),l(),Ke.publish("os/toast-shown",{...e}),c}let Oe=null,ue=0;function Nn(e){const t=e.target;t instanceof HTMLElement&&(t.closest("os-toast-container")||(Oe=t))}function hs(e){ue===0&&document.addEventListener("focusin",Nn,!0),ue+=1;const t=e.ownerDocument,n=t.activeElement;n instanceof HTMLElement&&n!==t.body&&!n.closest("os-toast-container")&&(Oe=n)}function fs(){ue=Math.max(0,ue-1),ue===0&&document.removeEventListener("focusin",Nn,!0)}function ps(e){const t=e.ownerDocument.activeElement;t!==e&&!e.contains(t)||Oe?.isConnected===!0&&Oe.focus()}function ms(){const e=document.querySelector("os-toast-container");if(e)return e;const t=document.createElement("os-toast-container");return document.body.appendChild(t),t}const gs="http://localhost/";function _s(e,t){const n=typeof window<"u"&&window.location?window.location.href:gs,o=new URL(e,n),i=t.replace(/^\/+/,""),s=i.indexOf("?"),r=s===-1?i:i.slice(0,s),d=s===-1?"":i.slice(s+1);if(o.searchParams.has("rest_route")){const a=o.searchParams.get("rest_route")??"/",c=a.endsWith("/")?a:a+"/";o.searchParams.set("rest_route",c+r)}else{const a=o.pathname.endsWith("/")?o.pathname:o.pathname+"/";o.pathname=a+r}return d&&new URLSearchParams(d).forEach((c,l)=>{o.searchParams.append(l,c)}),o.toString()}`${btoa('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" fill="none" stroke="currentColor" stroke-width="6" stroke-linejoin="round"><rect x="6" y="6" width="27" height="27" rx="5"/><rect x="43" y="6" width="15" height="15" rx="5"/><rect x="43" y="31" width="15" height="27" rx="5"/><rect x="6" y="43" width="27" height="15" rx="5"/></svg>')}`,`${btoa('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" fill="none" stroke="currentColor" stroke-width="6" stroke-linecap="round"><path d="M10 22h44M10 42h44"/><circle cx="24" cy="22" r="7" fill="currentColor" stroke="none"/><circle cx="42" cy="42" r="7" fill="currentColor" stroke="none"/></svg>')}`;function bs(e){try{(window.top??window).location.assign(e)}catch{window.location.assign(e)}}const Rn=800;function ws(e,t=Rn){window.setTimeout(()=>{if(e){bs(e);return}try{(window.top??window).location.reload()}catch{window.location.reload()}},t)}const ys="desktop-mode/v1",vs=3e4,Es=3,he=k("desktop-mode/plugin-presence",()=>({confirmInFlight:!1,lastConfirmAt:null,exiting:!1,booted:!1,negativeConfirms:0}));function ut(){return window.wp?.os?.config??{}}function As(){const e=ut().adminUrl||"/wp-admin/";let t;try{t=new URL(e,window.location.href).pathname}catch{t="/wp-admin/"}return t.endsWith("/")?t:`${t}/`}function Ss(){const e=ut().restUrl;return e?_s(e,ys):null}function Cs(){he.state.negativeConfirms=0}async function ks(){const e=he.state;if(e.exiting||e.confirmInFlight||e.negativeConfirms>=Es)return;const t=Ss();if(!t)return;const n=Date.now();if(!(e.lastConfirmAt!==null&&n-e.lastConfirmAt<vs)){e.lastConfirmAt=n,e.confirmInFlight=!0;try{const o=await hi(t,{credentials:"same-origin"},{silent:!0,source:"desktop-mode/plugin-presence"});if(o.status!==404){e.negativeConfirms+=1;return}if((await o.json())?.code!=="rest_no_route"){e.negativeConfirms+=1;return}xs()}catch{}finally{e.confirmInFlight=!1}}}function xs(){if(!he.state.exiting){he.state.exiting=!0,ws(ut().adminUrl||"");try{dt({message:_("OpenStation is no longer active. Returning to the WordPress dashboard…"),duration:Rn})}catch{}}}function ht(e){if(he.state.exiting)return;let t=null;try{t=e.contentDocument}catch{return}if(!(!t?.body||!t.location)&&t.location.pathname.startsWith(As())){if(t.body.classList.contains("os-chromeless")){Cs();return}ks()}}const B=0,ft=40,On=5,Ts=On*On,Is=3e3,Ls=250,Ns=15e3,Rs=120,pt="os-window__loading",Dn="os-window__loading--visible",Os=k("desktop-mode/window-reveal-active",()=>({id:at,duration:$i}));function Ds(){const e=Os.state.id;return!e||e===at?null:Gi(e)??null}const mt="os-window__reveal",Ws="os-window__reveal--edge",Ms="os-window__reveal--custom",Wn="data-os-reveal",Mn="data-os-reveal-layer",Ps=k("desktop-mode/window-reveal-rendered",()=>({plays:new WeakMap})).state.plays;function Pn(e,t,n,o){const i=document.createElement("div");i.className=o?`${mt} ${Ws}`:mt;const s=o?e.edgeColor:t.color??e.surfaceColor;return typeof s=="string"&&s!==""&&(i.style.background=s),i.setAttribute("aria-hidden","true"),i.setAttribute(Wn,e.id),i.setAttribute(Mn,String(n)),i.style.clipPath=t.from,i}function $s(){const e=Ds();if(!e)return[];if(typeof e.render=="function"){let o;try{o=e.render()}catch(s){return typeof console<"u"&&console.error(`[openstation] window reveal "${e.id}" render threw:`,s),[]}if(!o?.element||typeof o.play!="function")return[];const i=o.element;return i.classList.add(mt),i.classList.add(Ms),i.setAttribute("aria-hidden","true"),i.setAttribute(Wn,e.id),i.setAttribute(Mn,"0"),Ps.set(i,o.play),[i]}const t=Hi(e);if(t.length===0)return[];const n=[];return zi(e.edgeLag)>0&&t.forEach((o,i)=>n.push(Pn(e,o,i,!0))),t.forEach((o,i)=>n.push(Pn(e,o,i,!1))),n}const $n="os-window__body--loading",zn="data-os-loading-at",Hn="data-os-loading-cycle";function zs(e){return e.getAttribute(Hn)??"0"}function Hs(e){e.setAttribute(zn,String(Date.now())),e.setAttribute(Hn,String(Number(zs(e))+1))}function Fs(e,t){const n=Number(e.getAttribute(zn)),o=Number.isFinite(n)&&n>0?Date.now()-n:0,i=Rs-o;if(i<=0){t.classList.add(Dn);return}window.setTimeout(()=>{t.isConnected&&e.classList.contains($n)&&t.classList.add(Dn)},i)}const Us=Symbol.for("desktop-mode/window-config");function Gs(e,t){e[Us]=t}const gt=window.location.origin;function Bs(e){try{return new URL(e,gt).searchParams.has(Bt)}catch{return!1}}function fe(e){const t=new URL(e,gt);return t.origin!==gt||ei(t)?null:(t.searchParams.set("openstation_chromeless","1"),t.toString())}function J(){const e=document.querySelectorAll(".os-window--fullscreen:not(.os-window--minimized)").length>0;document.body.classList.toggle("os-has-fullscreen-window",e)}function qs(){const e=document.createElement("div");e.className=pt,e.setAttribute("role","status"),e.setAttribute("aria-live","polite");const t=document.createElement("os-spinner");return t.setAttribute("preset","classic"),t.setAttribute("size","clamp(96px, 14vw, 192px)"),t.setAttribute("label",_("Loading window content")),e.appendChild(t),e}function Vs(e){let t=qs();const n={windowId:e.id,config:e};if(typeof e.loading?.render=="function")try{e.loading.render(t,n)}catch(o){typeof console<"u"&&console.error(`[openstation] loading.render threw for "${e.id}":`,o)}try{const o=T(f.WINDOW_LOADING_OVERLAY,t,n);o instanceof HTMLElement&&(t=o)}catch(o){typeof console<"u"&&console.error(`[openstation] WINDOW_LOADING_OVERLAY filter threw for "${e.id}":`,o)}return t&&!t.classList.contains(pt)&&t.classList.add(pt),t}function ee(e){const t=document.createElement("span");return t.className=`os-window__slot os-window__slot--${e}`,t.dataset.slot=e,t}function Ks(e){const t=document.createElement("div");t.className="os-window",e.native&&t.classList.add("os-window--native"),t.id=`wp-window-${e.id}`,t.setAttribute("role","dialog"),t.setAttribute("aria-labelledby",`wp-window-title-${e.id}`),t.setAttribute("aria-busy","true"),t.style.left=`${e.x}px`,t.style.top=`${e.y}px`,t.style.width=`${e.width}px`,t.style.height=`${e.height}px`;const n=document.createElement("div");n.className="os-window__titlebar";const o=document.createElement("os-window-button");o.setAttribute("icon","menu"),lt(o,"core/menu"),o.setAttribute("aria-label",_("Window actions")),o.setAttribute("aria-haspopup","menu"),o.setAttribute("aria-expanded","false"),o.classList.add("os-window__btn"),o.classList.add("os-window__menu-btn");const i=document.createElement("os-menu");i.classList.add("os-window__menu-panel"),i.hidden=!0;const s=document.createElement("os-menu-item");if(s.setAttribute("role","menuitemcheckbox"),s.setAttribute("value","startup"),s.classList.add("os-window__menu-item"),s.classList.add("os-window__menu-item--startup"),s.textContent=_("Open on startup"),i.appendChild(s),e.multi){const h=document.createElement("os-menu-item");h.setAttribute("role","menuitem"),h.setAttribute("value","open-another"),h.setAttribute("icon","dashicons-plus-alt2"),h.classList.add("os-window__menu-item"),h.classList.add("os-window__menu-item--open-another"),h.textContent=ie(_("Open another %s"),e.title),i.appendChild(h)}if(!e.native){const h=document.createElement("os-menu-item");h.setAttribute("role","menuitem"),h.setAttribute("value","open-in-new-window"),h.setAttribute("icon","dashicons-plus-alt"),h.classList.add("os-window__menu-item"),h.classList.add("os-window__menu-item--open-in-new-window"),h.textContent=_("Open in new window"),i.appendChild(h)}if(!e.native||e.render){const h=document.createElement("os-menu-item");h.setAttribute("role","menuitem"),h.setAttribute("value","reload"),h.setAttribute("icon","dashicons-update"),h.classList.add("os-window__menu-item"),h.classList.add("os-window__menu-item--reload"),h.textContent=_("Reload"),i.appendChild(h)}if(!e.native){const h=document.createElement("os-menu-item");h.setAttribute("role","menuitem"),h.setAttribute("value","open-external"),h.setAttribute("icon","dashicons-external"),h.classList.add("os-window__menu-item"),h.classList.add("os-window__menu-item--open-external"),h.textContent=_("Open in browser tab"),i.appendChild(h)}const r=ee("icon"),d=ee("title"),a=document.createElement("span");a.className="os-window__title",a.id=`wp-window-title-${e.id}`,a.textContent=e.title,d.appendChild(a);const c=ee("before-titlebar"),l=ee("before-icon"),u=ee("after-title"),p=ee("before-controls"),g=ee("after-controls"),b=ee("after-titlebar"),y=document.createElement("div");y.className="os-window__controls";const w=document.createElement("div");w.className="os-window__screen-meta";const S=document.createElement("span");S.className="os-window__custom-buttons os-window__custom-buttons--left";const E=document.createElement("span");E.className="os-window__custom-buttons os-window__custom-buttons--right";const C=document.createElement("os-save-status");C.className="os-window__status",C.setAttribute("mode","icon"),C.setAttribute("variant","ring"),C.setAttribute("phase","idle"),C.setAttribute("data-os-activity-indicator","");const N=document.createElement("span");N.className="os-window__activity-status",N.setAttribute("role","status"),N.setAttribute("aria-live","polite"),n.appendChild(N),n.appendChild(C),n.appendChild(l),n.appendChild(r),n.appendChild(d),n.appendChild(u),n.appendChild(S),n.appendChild(w),o&&i&&i.children.length>0&&(n.appendChild(o),n.appendChild(i)),n.appendChild(E),n.appendChild(p),n.appendChild(y),n.appendChild(g);for(const h of Array.from(n.children))h.setAttribute("data-os-default-chrome","");const D=document.createElement("div");if(D.className=`os-window__body ${$n}`,Hs(D),e.native)D.classList.add("os-window__body--native");else{const h=document.createElement("iframe");h.className="os-window__iframe",h.setAttribute("name",`os-frame-${e.id}`);const v=e.url?fe(e.url):null;h.src=v??"about:blank",D.appendChild(h);const I=()=>{$(e.id),ht(h)};h.addEventListener("load",I)}const Se=Vs(e);D.appendChild(Se),Fs(D,Se);for(const h of $s())D.appendChild(h);Ie(e.id);const j=[];for(const h of["ne","nw","se","sw"]){const v=document.createElement("div");v.className=`os-window__resize-handle os-window__resize-handle--${h}`,v.dataset.dir=h,v.setAttribute("aria-hidden","true"),j.push(v)}t.appendChild(c),t.appendChild(n),t.appendChild(b);{const h=document.createElement("nav");h.className="os-window__tabs";const v=document.createElement("span");v.className="os-window__tab-plate",v.setAttribute("aria-hidden","true");const I=document.createElement("span");I.className="os-window__tab-plate-fill";const H=document.createElement("span");H.className="os-window__tab-plate-joint",v.appendChild(I),v.appendChild(H),h.appendChild(v),e.native?h.dataset.tablistLabel=ie(_("%s sections"),e.title):h.dataset.tablistLabel=ie(_("%s sub-pages"),e.title);const P=(e.submenu??[]).filter(F=>!F.offSite&&!Bs(F.url));if(P.length>0&&e.url){const F=Y(e.url),Ce=e.parentUrl??e.url,Ol=Y(Ce),Dl=P.some(ke=>Y(ke.url)===Ol)?[...P]:[{title:e.selfLabel||e.title,url:Ce},...P];for(const ke of Dl){const U=document.createElement("button");U.className="os-window__tab",U.dataset.kind="submenu",U.setAttribute("type","button"),U.setAttribute("role","tab"),U.dataset.url=ke.url,U.textContent=ke.title,Y(ke.url)===F?(U.classList.add("os-window__tab--active"),U.setAttribute("aria-selected","true")):U.setAttribute("aria-selected","false"),h.appendChild(U)}}le(h),t.appendChild(h)}t.appendChild(D);for(const h of j)t.appendChild(h);return Gs(t,e),t}const Fn=window.location.origin;let Un=0;function js(e,{timeoutMs:t=Ls}={}){const n=e?.contentWindow;if(!n)return Promise.resolve(!1);Un+=1;const o=`os-unsaved-guard-${Date.now()}-${Un}`;return new Promise(i=>{let s=null,r=!1;const d=c=>{r||(r=!0,window.removeEventListener("message",a),s!==null&&window.clearTimeout(s),i(c))},a=c=>{if(c.origin!==Fn)return;const l=c?.data;!l||typeof l!="object"||l.type!=="os-bridge-beforeunload-response"||l.requestId!==o||d(l.prevent===!0)};window.addEventListener("message",a),s=window.setTimeout(()=>d(!1),t);try{n.postMessage({type:"os-bridge-beforeunload-query",requestId:o},Fn)}catch{d(!1)}})}function _t(e,{commit:t,navigate:n}){if(!e._iframeBridgeReady||!e.iframe){t(),n();return}e._unsavedGuardPending=!0,js(e.iframe).then(o=>{if(e._unsavedGuardPending=!1,!e._isDestroyed){if(!o){t(),n();return}e._deferNavigationCommit(t,Ns),n()}})}function Ys(e,t){let n;try{n=new URL(t,window.location.origin)}catch{return null}const o=Jt(t);let i=null,s=-1;for(const r of e){const d=r.dataset.url;if(!d||Jt(d)!==o)continue;let a;try{a=new URL(d,window.location.origin)}catch{continue}let c=0,l=!1;for(const[u,p]of a.searchParams){if(u==="openstation_chromeless"||u==="desktop_mode_portal"||Qt.includes(u))continue;if(n.searchParams.get(u)!==p){l=!0;break}c++}!l&&c>s&&(i=r,s=c)}return i}function pe(e,t){const n=e.element.querySelectorAll('.os-window__tab[data-kind="submenu"]');if(!n.length)return;if(e._activeTabId!=="primary"){for(const s of n)s.classList.remove("os-window__tab--active"),s.setAttribute("aria-selected","false");return}const o=Y(t);let i=null;for(const s of n){const r=s.dataset.url;if(r&&Y(r)===o){i=s;break}}if(i||(i=Ys(n,t)),!i){if(Array.from(n).some(d=>d.classList.contains("os-window__tab--active")))return;let r=!1;try{const d=new URL(t,window.location.origin);r=d.pathname.endsWith("/admin.php")&&d.searchParams.has("page")}catch{return}if(!r||!n[0])return;i=n[0]}for(const s of n){const r=s===i;s.classList.toggle("os-window__tab--active",r),s.setAttribute("aria-selected",r?"true":"false")}}function Gn(e,t,n){if(!e.iframe)return;const o=e.element.querySelector(".os-window__tabs"),i=e.element.querySelector(".os-window__body");if(!o||!i)return;Xs(e,o);const s=`ext-${++e._externalTabSeq}`,r=document.createElement("button");r.className="os-window__tab os-window__tab--external",r.dataset.kind="external",r.dataset.tabId=s,r.setAttribute("type","button"),r.setAttribute("role","tab"),r.setAttribute("aria-selected","false"),r.title=t;const d=document.createElement("span");d.className="os-window__tab-label",d.textContent=n,r.appendChild(d);const a=document.createElement("os-tab-chip");a.setAttribute("variant","detach"),a.dataset.tabAction="detach",a.dataset.tabId=s,a.setAttribute("aria-label",_("Open in a new browser tab")),a.title=_("Open in a new browser tab"),r.appendChild(a);const c=document.createElement("os-tab-chip");c.setAttribute("variant","close"),c.dataset.tabAction="close",c.dataset.tabId=s,c.setAttribute("aria-label",_("Close tab")),c.title=_("Close tab"),r.appendChild(c),o.appendChild(r),le(o);const l=document.createElement("iframe");l.className="os-window__iframe os-window__iframe--external",l.dataset.tabId=s,l.style.display="none",l.src=t,i.appendChild(l);let u=!1;const p=()=>{u=!0};l.addEventListener("load",p,{once:!0});const g=window.setTimeout(()=>{u||(l.removeEventListener("load",p),Qs(e,s))},Is),b=()=>{l.removeEventListener("load",p),window.clearTimeout(g)};e._externalTabs.set(s,{tabEl:r,iframe:l,url:t,label:n,cancelProbe:b}),me(e,s),r.scrollIntoView({behavior:"smooth",inline:"end",block:"nearest"}),e._emitChange("state")}function Xs(e,t){if(t.querySelector('[data-kind="main"]')||t.querySelector('[data-kind="submenu"]'))return;const n=document.createElement("button");n.className="os-window__tab os-window__tab--main os-window__tab--active",n.dataset.kind="main",n.setAttribute("type","button"),n.setAttribute("role","tab"),n.setAttribute("aria-selected","true"),n.textContent=e.config.title||"Main",t.prepend(n),le(t)}function me(e,t){if(e._activeTabId===t)return;e._activeTabId=t,e.iframe&&(e.iframe.style.display=t==="primary"?"":"none");for(const[o,i]of e._externalTabs)i.iframe.style.display=t===o?"":"none";e.element.querySelectorAll(".os-window__tab").forEach(o=>{let i;o.dataset.kind==="main"?i=t==="primary":o.dataset.kind==="external"?i=o.dataset.tabId===t:i=t==="primary"&&o.classList.contains("os-window__tab--active"),o.classList.toggle("os-window__tab--active",i),o.setAttribute("aria-selected",i?"true":"false")})}function bt(e,t){const n=e._externalTabs.get(t);n&&(n.cancelProbe(),n.tabEl.remove(),n.iframe.remove(),e._externalTabs.delete(t),e._activeTabId===t&&me(e,"primary"),e._externalTabs.size===0&&e.element.querySelector(".os-window__tab--main")?.remove(),le(e.element.querySelector(".os-window__tabs")),e._emitChange("state"))}function Zs(e,t){const n=e._externalTabs.get(t);if(!n)return;let o=n.url;try{const i=n.iframe.contentWindow?.location.href;i&&i!=="about:blank"&&(o=i)}catch{}window.open(o,"_blank","noopener"),bt(e,t)}function Qs(e,t){const n=e._externalTabs.get(t);if(!n)return;const{url:o,label:i}=n;bt(e,t),dt({message:ie(_(`Opened "%s" in a new browser tab — this site doesn't allow embedding.`),i),action:{label:_("Open"),onClick:()=>{window.open(o,"_blank","noopener")}}}),window.open(o,"_blank","noopener")}function Js(e){return e._externalTabs.size}function er(e){const t=[];for(const n of e._externalTabs.values()){let o=n.url;try{const i=n.iframe.contentWindow?.location.href;i&&i!=="about:blank"&&(o=i)}catch{}t.push({url:o,label:n.label})}return t}function tr(e,t){const n=t.target,o=n.closest("[data-tab-action]");if(o){t.stopPropagation();const d=o.dataset.tabAction,a=o.dataset.tabId;if(!a)return;d==="close"?bt(e,a):d==="detach"&&Zs(e,a);return}const i=n.closest(".os-window__tab");if(!i)return;t.stopPropagation();const s=i.dataset.kind,r=i.dataset.tabId;if(s==="external"&&r){me(e,r);return}if(s==="main"){me(e,"primary");return}if(s==="panel"&&i.dataset.panel){Qe(e.element,i.dataset.panel);return}if(i.dataset.url){const d=i.dataset.url;if(Xe(d))return;const a=fe(d);me(e,"primary");const c=()=>{e.markContentLoading(),pe(e,d)};a&&e.iframe?_t(e,{commit:c,navigate:()=>{e.iframe&&(e.iframe.src=a)}}):pe(e,d)}}const wt=1;function nr(e,t){const n=Math.max(0,e.scrollWidth-e.clientWidth);if(n<=wt){delete e.dataset.overflow;return}const o=Math.abs(e.scrollLeft),i=o<=wt,s=o>=n-wt,r=t??window.getComputedStyle(e).direction==="rtl",d=r?!s:!i,a=r?!i:!s;d&&a?e.dataset.overflow="both":d?e.dataset.overflow="left":a?e.dataset.overflow="right":delete e.dataset.overflow}function or(e){let t=null,n=null;const o=()=>{n===null&&(n=window.requestAnimationFrame(()=>{n=null,t===null&&(t=window.getComputedStyle(e).direction==="rtl"),nr(e,t),jt(e),Yt(e)}))},i=()=>{t=null,o()};e.addEventListener("scroll",o,{passive:!0});const s=typeof ResizeObserver>"u"?null:new ResizeObserver(i);s?.observe(e);const r=typeof MutationObserver>"u"?null:new MutationObserver(i);return r?.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class"]}),o(),()=>{e.removeEventListener("scroll",o),s?.disconnect(),r?.disconnect(),n!==null&&(window.cancelAnimationFrame(n),n=null)}}const ir=k("desktop-mode/destructive-admin-actions",()=>({entries:[]}));function sr(e,t){for(const n of ir.state.entries)try{if(n.matches(e,t))return n.id}catch(o){console.warn(`[openstation] destructive-action predicate threw for "${n.id}":`,o)}return null}const rr=32,ar=64,lr=/^[a-z0-9_/-]+$/,q=k("desktop-mode/window-links",()=>({contentByWindow:new Map,focusSeq:new Map,seq:0,listeners:new Set,lastGroupsSignature:"",manager:null,started:!1}));function De(e){return`${e.type}:${e.id}`}function Bn(e){return e.root?De(e.root):De(e)}function qn(e){const t=o=>typeof o=="number"&&Number.isFinite(o)||typeof o=="string"&&o.trim()!=="",n=o=>typeof o=="string"&&lr.test(o.trim().toLowerCase());return fi(e,[{field:"type",valid:o=>n(o.type),message:"must match /^[a-z0-9_/-]+$/ — lowercase alphanum, hyphens, underscores, slashes for vendor/sub-type"},{field:"id",valid:o=>t(o.id),message:"must be a finite number or non-empty string"},{field:"root",valid:o=>o.root===void 0||!!o.root&&typeof o.root=="object"&&n(o.root.type)&&t(o.root.id),message:"when present, must be { type, id } with the same shapes as the ref itself"},{field:"related",valid:o=>o.related===void 0||Array.isArray(o.related)&&o.related.every(i=>!!i&&typeof i=="object"&&typeof i.id=="string"&&i.id.trim()!==""&&typeof i.group=="string"&&i.group.trim()!==""&&typeof i.label=="string"&&i.label.trim()!==""&&typeof i.url=="string"&&i.url.trim()!==""&&(i.groupLabel===void 0||typeof i.groupLabel=="string")&&(i.icon===void 0||typeof i.icon=="string")&&(i.count===void 0||typeof i.count=="number"&&Number.isFinite(i.count))),message:"when present, must be an array of { id, group, label, url, groupLabel?, icon?, count? } entries with non-empty strings"},{field:"links",valid:o=>o.links===void 0||Array.isArray(o.links)&&o.links.every(i=>!!i&&typeof i=="object"&&n(i.type)&&t(i.id)&&(i.rel===void 0||i.rel==="references"||i.rel==="child")),message:"when present, must be an array of { type, id, rel?: 'references'|'child' } entries"},{field:"revisionCount",valid:o=>o.revisionCount===void 0||typeof o.revisionCount=="number"&&Number.isFinite(o.revisionCount),message:"when present, must be a finite number"}])}function Vn(e){if(!(typeof e!="string"||e===""))try{return new URL(e,window.location.origin).origin===window.location.origin?e:void 0}catch{return}}function cr(e,t){const n={type:e.type.trim().toLowerCase(),id:e.id,source:t};e.root&&(n.root={type:e.root.type.trim().toLowerCase(),id:e.root.id}),Array.isArray(e.links)&&e.links.length>0&&(n.links=e.links.slice(0,rr).map(s=>{const r={type:s.type.trim().toLowerCase(),id:s.id};return s.rel==="child"&&(r.rel="child"),r})),typeof e.label=="string"&&e.label!==""&&(n.label=e.label);const o=Vn(e.previewUrl);o&&(n.previewUrl=o);const i=Vn(e.revisionsUrl);return i&&(n.revisionsUrl=i,typeof e.revisionCount=="number"&&Number.isFinite(e.revisionCount)&&(n.revisionCount=Math.max(0,Math.trunc(e.revisionCount)))),Array.isArray(e.related)&&e.related.length>0&&(n.related=e.related.slice(0,ar).map(s=>{const r={id:s.id,group:s.group,label:s.label,url:s.url};return typeof s.groupLabel=="string"&&s.groupLabel!==""&&(r.groupLabel=s.groupLabel),typeof s.icon=="string"&&s.icon!==""&&(r.icon=s.icon),typeof s.count=="number"&&(r.count=s.count),r})),n}function Kn(e){return!e||!e.related?"":e.related.map(t=>`${t.id}\0${t.group}\0${t.label}\0${t.url}\0${t.groupLabel??""}\0${t.icon??""}\0${t.count??""}`).join("|")}function yt(e){return e?[De(e),Bn(e),...(e.links??[]).map(t=>De(t)+(t.rel==="child"?"!child":""))].join("|"):""}function dr(e,t,n={}){const o=n.source??"api";if(typeof e!="string"||e===""){et("WindowContentRef",["windowId (must be a non-empty string)"],t);return}let i=null;if(t!=null){const d=qn(t);if(d.length>0){o==="api"&&et("WindowContentRef",d,t),nn("WindowContentRef",d,t);return}i=cr(t,o)}if(i=T(f.WINDOW_LINKS_CONTENT,i,{windowId:e,source:o}),i!==null&&(!i||qn(i).length>0)){nn("WindowContentRef",["filter (os.window-links.content returned an invalid ref)"],i);return}const s=q.state.contentByWindow.get(e)??null;if(i===null&&s===null||i!==null&&s!==null&&yt(i)===yt(s)&&i.label===s.label&&i.previewUrl===s.previewUrl&&i.revisionsUrl===s.revisionsUrl&&i.revisionCount===s.revisionCount&&Kn(i)===Kn(s))return;i===null?q.state.contentByWindow.delete(e):q.state.contentByWindow.set(e,i);const r={windowId:e,content:i,previous:s,source:o};document.dispatchEvent(new CustomEvent("os-window-content-changed",{detail:r})),m(f.WINDOW_CONTENT_CHANGED,r),pr(),hr()}function ur(){const e=new Map;for(const[i,s]of q.state.contentByWindow){const r=Bn(s);let d=e.get(r);d||(d={key:r,root:s.root?{...s.root}:{type:s.type,id:s.id},rootWindowIds:[],children:[]},e.set(r,d)),s.root?d.children.push({windowId:i,content:s}):d.rootWindowIds.push(i)}const t=q.state.focusSeq;for(const i of e.values())i.rootWindowIds.sort((s,r)=>(t.get(r)??0)-(t.get(s)??0));const n=Array.from(e.values()),o=T(f.WINDOW_LINK_GROUPS,n);return Array.isArray(o)?o:(typeof console<"u"&&console.warn("[openstation] `os.window-links.groups` filter returned a non-array; falling back to computed groups."),n)}function hr(){for(const e of Array.from(q.state.listeners))try{e()}catch(t){typeof console<"u"&&console.error("[openstation] window-links listener threw:",t)}}function fr(){return Array.from(q.state.contentByWindow).map(([e,t])=>`${e}=${yt(t)}`).sort().join(";")}function pr(){const e=fr();if(e===q.state.lastGroupsSignature)return;q.state.lastGroupsSignature=e;const n={groups:ur()};document.dispatchEvent(new CustomEvent("os-window-link-groups-changed",{detail:n})),m(f.WINDOW_LINK_GROUPS_CHANGED,n)}const mr="my-wordpress",gr=Object.freeze({userId:null,userName:"",requestedAt:0});function jn(){return window.wp?.os}let We=null;function _r(){if(We)return We;const e=jn()?.createSharedStore;return typeof e!="function"?null:(We=e("desktop-mode/my-wordpress/footprint-target",()=>({...gr})),We)}function br(e,t=""){const n=_r();if(n){n.state.userId=e,n.state.userName=t,n.state.requestedAt=Date.now(),n.notify();return}window._wpdFootprintTarget={userId:e,userName:t,requestedAt:Date.now()}}function wr(e){const t=Number(e.userId);if(!Number.isFinite(t)||t<=0)return;const n=e.userName??"";br(t,n),jn()?.openWindow?.(mr,{source:"my-wordpress/open-user-footprint",params:{footprint:t,fpName:n}})}const M=window.location.origin,vt=k("desktop-mode/admin-link-deps",()=>({deps:null}));function yr(e,t){if(t.origin!==M||!e.iframe||t.source!==e.iframe.contentWindow)return;const n=t.data;if(!(!n||typeof n.type!="string")){if(n.type==="os-title-change"&&typeof n.title=="string"&&e.setTitle(n.title),n.type==="os-content-identity"&&dr(e.id,n.identity??null,{source:"bridge"}),n.type==="os-window-publish"&&typeof n.channel=="string"&&n.channel!==""&&Ht(e.id,n.channel,n.payload),typeof n.type=="string"&&n.type.startsWith("os-bridge-")&&window.__openStationConnectionBridge?.routeIncomingFromIframe(n,e.id),n.type==="os-iframe-navigated"&&e._settleNavigationActivity(),n.type==="os-ready"&&(e._iframeBridgeReady=!0,e._clearDeferredNavigation(),e._settleNavigationActivity(!0)||e._resetActivity(),$(e.id),m(f.IFRAME_READY,{windowId:e.id})),n.type==="os-iframe-unloading"&&e._commitDeferredNavigation(),n.type==="os-bridge-beforeunload-response"){if(e._isDestroyed||typeof n.requestId=="string"&&n.requestId!=="")return;e._closePending=!1,e._iframeCloseTimeout&&(clearTimeout(e._iframeCloseTimeout),e._iframeCloseTimeout=null),n.prevent?Promise.resolve().then(()=>Rl).then(({osConfirm:o})=>o({title:typeof n.message=="string"&&n.message?n.message:_("Unsaved changes"),message:_("You have unsaved changes. Are you sure you want to close this window?"),confirmLabel:_("Close window"),danger:!0})).then(o=>{o&&e.destroy()}).catch(()=>{e.destroy()}):e.destroy()}if(n.type==="os-navigate"&&typeof n.url=="string"&&n.url!==""&&Er(e,n.url,n.target==="new"?"new":"self"),n.type==="os-iframe-other-admin-link"&&typeof n.url=="string"&&n.url!==""&&vt.state.deps?.openOtherAdmin?.(n.url),n.type==="os-iframe-admin-link"&&typeof n.url=="string"&&n.url!==""){const o=vt.state.deps;if(Xe(n.url))e.close();else if(o){const i=typeof n.label=="string"?n.label:"";xr(e,n.url,i,o,n.newContext===!0)}}if(n.type==="os-open-user-footprint"&&typeof n.userId=="number"&&n.userId>0&&wr({userId:n.userId,userName:typeof n.userName=="string"?n.userName:""}),n.type==="os-notification"&&typeof n.title=="string"&&n.title!==""&&Or(n.title,typeof n.body=="string"?n.body:""),n.type==="os-focus-request"&&(e.element.classList.contains("os-window--overview")||e.onFocusRequest?.(e)),n.type==="os-screen-meta"&&Array.isArray(n.panels)&&Dr(e,n.panels),n.type==="os-screen-meta-state"&&Wr(e,typeof n.open=="string"?n.open:null),n.type==="os-external-link"&&typeof n.url=="string"&&n.url!==""){const o=typeof n.label=="string"&&n.label!==""?n.label:n.url;Gn(e,n.url,o)}if(n.type==="os-iframe-error"&&m(f.IFRAME_ERROR,{windowId:e.id,kind:n.kind==="unhandledrejection"?"unhandledrejection":"error",message:typeof n.message=="string"?n.message:"",filename:typeof n.filename=="string"?n.filename:null,lineno:typeof n.lineno=="number"?n.lineno:null,colno:typeof n.colno=="number"?n.colno:null,stack:typeof n.stack=="string"?n.stack:null}),n.type==="os-chrome-theme"&&n.tokens&&typeof n.tokens=="object")try{e.setAppearanceTheme(n.tokens)}catch(o){m(f.SHELL_ERROR,{scope:"window-bridge-chrome-theme",windowId:e.id,error:o})}if(n.type==="os-chrome-controls"&&n.config&&typeof n.config=="object")try{e.setAppearanceControls(n.config)}catch(o){m(f.SHELL_ERROR,{scope:"window-bridge-chrome-controls",windowId:e.id,error:o})}if(n.type==="os-chrome-slot"&&typeof n.slot=="string"&&typeof n.html=="string")try{e.setAppearanceSlot(n.slot,{html:n.html})}catch(o){m(f.SHELL_ERROR,{scope:"window-bridge-chrome-slot",windowId:e.id,error:o})}if(n.type==="os-iframe-activity"){if(n.phase==="start")e._markActivityStart(),n.navigation&&e._noteNavigationActivity();else if(n.phase==="end"){const o=!!n.failed,i=typeof n.status=="number"?n.status:0;e._markActivitySettled(!o,o?vr(i):void 0)}}if(n.type==="os-iframe-network"){const o={windowId:e.id,method:typeof n.method=="string"?n.method:"GET",url:typeof n.url=="string"?n.url:"",status:typeof n.status=="number"?n.status:0,duration:typeof n.duration=="number"?n.duration:0,failed:!!n.failed};n.requestHeaders&&typeof n.requestHeaders=="object"&&(o.requestHeaders=n.requestHeaders),n.responseHeaders&&typeof n.responseHeaders=="object"&&(o.responseHeaders=n.responseHeaders),m(f.IFRAME_NETWORK_COMPLETED,o)}}}function vr(e){return e<=0?_("Request failed."):ie(_("Request failed (HTTP %d)."),e)}function Er(e,t,n){let o;try{o=new URL(t,M)}catch{return}if(o.origin===M){if(n==="new"){window.open(o.toString(),"_blank","noopener,noreferrer");return}e.iframe&&(e.iframe.src=o.toString())}}const Ar=new Set(["trash","untrash","delete","spam","unspam","spamcomment","unspamcomment","trashcomment","untrashcomment","deletecomment","approvecomment","unapprovecomment"]);function Sr(e){const t=e.searchParams.get("action");return t&&Ar.has(t)&&(e.searchParams.has("_wpnonce")||e.searchParams.has("_wp_nonce"))?!0:sr(e.toString(),e)!==null}function Yn(e,t){if(e.searchParams.has("_wp_http_referer"))return e;let n="";try{n=t.iframe?.contentWindow?.location.href??""}catch{}if(n||(n=t.config.url||""),!n)return e;try{const o=new URL(n,M);if(o.origin!==M)return e;const i=new URL(e.href),s=new URL(o.href);return s.searchParams.delete("openstation_chromeless"),i.searchParams.set("_wp_http_referer",s.pathname+(s.search?s.search:"")),i}catch{return e}}function Cr(e,t){let n="";try{n=e.getCurrentUrl?.()??""}catch{return""}if(!n||n.startsWith("#")||n==="about:blank")return"";try{const o=new URL(n,t.adminUrl);return o.origin!==M?"":t.deriveSlug(o.toString())}catch{return""}}function kr(e,t,n){if(t===(e.config.baseId||e.id))return!0;const o=Cr(e,n);return o!==""&&o===t}function xr(e,t,n,o,i=!1){let s;try{s=new URL(t,o.adminUrl)}catch{return}if(s.origin!==M)return;if(i){Et(e,s,n,o);return}const r=s.toString(),d=o.deriveSlug(r),a=kr(e,d,o);if(!a&&Sr(s)){const c=Yn(s,e),l=e.iframe?.contentWindow;if(l)try{l.location.assign(c.href)}catch{e.iframe&&(e.iframe.src=c.href)}return}if(a){const c=e.iframe?.contentWindow;if(c)try{c.location.assign(r)}catch{e.iframe&&(e.iframe.src=r)}return}Et(e,s,n,o)}function Et(e,t,n,o){const i=t.toString(),s=o.deriveSlug(i),r=o.findDockEntry(i),d=n.trim(),a=r?.title||(d!==""?d:s),c=Yn(t,e);o.openWindow({id:s,baseId:s,url:c.toString(),parentUrl:r?.url??i,title:a,titleFromPage:!r,icon:r?.icon??"dashicons-admin-generic",submenu:r?.submenu,selfLabel:r?.selfLabel,multi:r?.multi})}function Me(e){if(!e||e.startsWith("#"))return"";try{const t=new URL(e,M);return t.origin!==M?"":t.pathname.split("/").pop()??""}catch{return""}}const Tr=new Set(["revision.php"]);function Ir(e,t){try{const o=e.iframe?.contentWindow?.performance?.getEntriesByType?.("navigation")?.[0]?.name??"";if(o&&Me(o)===Me(t))return o}catch{}return t}function Lr(e,t){const n=Me(e.config.url??"");if(!n||!Tr.has(n))return!1;const o=Me(t);if(!o||o===n)return!1;if(Xe(t))return e.close(),!0;const i=vt.state.deps;if(!i)return!1;let s;try{s=new URL(Ir(e,t),i.adminUrl)}catch{return!1}return s.origin!==M?!1:(Et(e,s,"",i),e.close(),!0)}function Nr(e){if(!e.config.titleFromPage)return;let t="";try{t=e.iframe?.contentDocument?.title??""}catch{return}const n=Rr(t);n!==""&&n!==e.config.title&&e.setTitle(n)}function Rr(e){const t=e.trim(),n=t.indexOf(" ‹ ");return(n>0?t.slice(0,n):t).trim()}function Or(e,t){const n=t!==""?`${e} — ${t}`:e;dt({message:n})}function Dr(e,t){const n=e.element.querySelector(".os-window__screen-meta");if(!n)return;n.innerHTML="";const o={"screen-options":{icon:"dashicons-admin-generic",label:"Screen Options"},help:{icon:"dashicons-editor-help",label:"Help"}};for(const i of t){const s=o[i];if(!s)continue;const r=document.createElement("button");r.className="os-window__meta-btn",r.setAttribute("type","button"),r.setAttribute("aria-label",s.label),r.setAttribute("aria-pressed","false"),r.dataset.panel=i,r.innerHTML=`<span class="dashicons ${s.icon}" aria-hidden="true"></span>`,r.addEventListener("click",d=>{d.stopPropagation(),e.iframe?.contentWindow?.postMessage({type:"os-toggle-panel",panel:i},M)}),n.appendChild(r)}}function Wr(e,t){const n=e.element.querySelector(".os-window__screen-meta");n&&n.querySelectorAll(".os-window__meta-btn").forEach(o=>{const i=o.dataset.panel===t;o.classList.toggle("os-window__meta-btn--active",i),o.setAttribute("aria-pressed",i?"true":"false")})}const Xn=k("desktop-mode/title-bar-buttons-registry",()=>({registry:new Map,listeners:new Set})),Mr=Xn.state.registry,At=Xn.state.listeners;function Pr(){return Array.from(Mr.values()).sort((e,t)=>(e.order??100)-(t.order??100))}function $r(e){const t=[],n=[];for(const o of Pr()){try{if(!o.match(e))continue}catch{continue}o.placement==="right"?n.push(o):t.push(o)}return{left:t,right:n}}function zr(e){return At.add(e),()=>{At.delete(e)}}function Hr(){const e=Array.from(At);for(const t of e)try{t()}catch(n){typeof console<"u"&&console.error("[openstation] title-bar-button registry listener threw:",n)}}typeof document<"u"&&document.addEventListener("os-settings-save-lifecycle",e=>{const t=e.detail;t&&t.phase==="saved"&&Hr()});const Fr=/^dashicons-[a-z0-9-]+$/i,Ur=/^\s*<svg[\s>]/i;function Zn(e,t){if(t){if(Fr.test(t)){const n=document.createElement("span");n.className=`dashicons ${t}`,n.setAttribute("aria-hidden","true"),e.appendChild(n);return}if(Ur.test(t)){const n=document.createElement("span");n.setAttribute("aria-hidden","true"),n.innerHTML=t,e.appendChild(n);return}e.setAttribute("icon",t)}}const Qn=k("desktop-mode/window-themes-registry",()=>({registry:new Map,listeners:new Set})),Gr=Qn.state.registry,Jn=Qn.state.listeners;function eo(){return Array.from(Gr.values()).sort((e,t)=>(e.priority??100)-(t.priority??100))}function Br(e){let t=null;for(const n of eo()){try{if(!n.match(e))continue}catch(o){typeof console<"u"&&console.warn(`[openstation] window-theme "${n.id}" match() threw — skipping`,o);continue}t=n}return t}function qr(e){return Jn.add(e),()=>{Jn.delete(e)}}const Pe=new WeakMap;function Vr(e,t){let n=null,o={};if(t&&"tokens"in t&&t.tokens)n=null,o={...t.tokens};else if(t&&"themeId"in t&&t.themeId){const s=jr(t.themeId);s&&(n=s.id,o={...s.tokens})}else{const s=Br(e);s&&(n=s.id,o={...s.tokens})}const i=T(f.WINDOW_CHROME_THEME,o,{windowId:e.id,themeId:n,config:e.config});return{themeId:n,tokens:i}}function St(e,t){const n=e.element;if(!n)return;const o=Pe.get(n),{themeId:i,tokens:s}=Vr(e,t);if(o){for(const d of o.keys)if(!(d in s))try{n.style.removeProperty(d)}catch{}}const r=new Set;for(const[d,a]of Object.entries(s))try{n.style.setProperty(d,a),r.add(d)}catch(c){m(f.SHELL_ERROR,{scope:"window-theme-apply",windowId:e.id,key:d,error:c})}Pe.set(n,{themeId:i,keys:r}),m(f.WINDOW_CHROME_THEME_CHANGED,{windowId:e.id,themeId:i,tokens:s})}function Kr(e){const t=e.element;if(!t)return;const n=Pe.get(t);if(n){for(const o of n.keys)try{t.style.removeProperty(o)}catch{}Pe.delete(t)}}function jr(e){for(const t of eo())if(t.id===e)return{id:t.id,tokens:t.tokens};return null}const to=k("desktop-mode/window-controls-registry",()=>({registry:new Map,listeners:new Set})),Yr=to.state.registry,no=to.state.listeners;function Xr(){return Array.from(Yr.values()).sort((e,t)=>{const n=e.order??100,o=t.order??100;return n!==o?n-o:e.id.localeCompare(t.id)})}function Zr(e){const t=[],n=[],o=[];for(const i of Xr()){try{if(!i.match(e))continue}catch(r){typeof console<"u"&&console.warn(`[openstation] window-control "${i.id}" match() threw — skipping`,r);continue}const s=i.placement??"left";s==="right"?n.push(i):s==="controls"?o.push(i):t.push(i)}return{left:t,right:n,controls:o}}function Qr(e){return no.add(e),()=>{no.delete(e)}}function Jr(e,t){const n=Zr(e),o=new Set(t?.hide??[]);let i=n.left.filter(c=>!o.has(c.id)),s=n.right.filter(c=>!o.has(c.id)),r=n.controls.filter(c=>!o.has(c.id));if(t?.custom){for(const c of t.custom){if(o.has(c.id))continue;const l={id:c.id,label:c.label,icon:c.icon,placement:c.placement??"controls",order:c.order??100,match:()=>!0,onClick:c.onClick?(u,p)=>c.onClick(p):void 0,render:c.render?u=>c.render(u):void 0};l.placement==="left"?i.push(l):l.placement==="right"?s.push(l):r.push(l)}i=Ct(i),s=Ct(s),r=Ct(r)}t?.order&&t.order.length>0&&(r=ea(r,t.order));const d=t?.placement??"right",a={windowId:e.id,config:e.config};return i=T(f.WINDOW_CHROME_CONTROLS,i,{...a,placement:"left"}),s=T(f.WINDOW_CHROME_CONTROLS,s,{...a,placement:"right"}),r=T(f.WINDOW_CHROME_CONTROLS,r,{...a,placement:"controls"}),{left:i,right:s,controls:r,placement:d}}function Ct(e){return[...e].sort((t,n)=>{const o=t.order??100,i=n.order??100;return o!==i?o-i:t.id.localeCompare(n.id)})}function ea(e,t){const n=new Map;for(const s of e)n.set(s.id,s);const o=[],i=new Set;for(const s of t){const r=n.get(s);r&&!i.has(s)&&(o.push(r),i.add(s))}for(const s of e)i.has(s.id)||o.push(s);return o}function ta(e,t){const n=document.createElement("os-window-button");n.setAttribute("aria-label",e.label||e.id),n.classList.add("os-window__btn");const o=na(e.id);if(n.classList.add(`os-window__btn--${o}`),e.id==="core/close"&&n.setAttribute("danger",""),typeof e.render=="function")try{e.render(n,t)}catch(i){return m(f.SHELL_ERROR,{scope:"window-control-render",id:e.id,windowId:t.id,error:i}),{element:n}}else if(lt(n,e.id)||Zn(n,e.icon??""),typeof e.onClick=="function"){const i=s=>{s.stopPropagation();try{e.onClick(t,s)}catch(r){m(f.SHELL_ERROR,{scope:"window-control-onclick",id:e.id,windowId:t.id,error:r})}};return n.addEventListener("os-button-activate",i),{element:n,teardown:()=>{n.removeEventListener("os-button-activate",i)}}}return{element:n}}function na(e){return e.startsWith("core/")?e.slice(5):e.replace(/\//g,"-")}function oa(e,t){const n=[];for(;t.firstChild;)t.removeChild(t.firstChild);const o=Jr(e,e.config.appearance?.controls);t.classList.toggle("os-window__controls--left",o.placement==="left");for(const i of o.controls){const{element:s,teardown:r}=ta(i,e);t.appendChild(s),r&&n.push(r)}return m(f.WINDOW_CHROME_APPLIED,{windowId:e.id,layer:"controls"}),()=>{for(const i of n)try{i()}catch{}}}function ia(e){if(!e)return 214;let t=5381;for(let n=0;n<e.length;n++)t=Math.imul(t,33)+e.charCodeAt(n);return(t%360+360)%360}function sa(e){return typeof e!="string"||e===""||e.length>4096||!/^(https?:\/\/|data:image\/)/i.test(e)?!1:!/['"()\\<>\s]/.test(e)}function oo(e,t,n){if(!sa(t))return!1;const o=`url("${t}") center / contain no-repeat`;return e.style.backgroundImage="none",e.style.backgroundColor=n,e.style.setProperty("-webkit-mask",o),e.style.setProperty("mask",o),!0}const io="data:image/svg+xml;base64,",$e=new Map;function ra(e){const t=$e.get(e);if(t!==void 0)return t;let n=!1;try{n=atob(e.slice(io.length)).includes("currentColor")}catch{}return $e.size>=256&&$e.clear(),$e.set(e,n),n}function aa(e,t){const n=t.className??"",o=t.title??"";let i=null;if(t.slot){const a=In(t.slot);a!==null&&(e=a),i=Ln(t.slot)}if(typeof e=="string"&&e.startsWith("dashicons-")){const a=document.createElement("span");return a.className=`dashicons ${e} ${n}`.trim(),a.setAttribute("aria-hidden","true"),i!==null&&(a.style.color=i),a}if(i!==null&&typeof e=="string"){const a=document.createElement("span");if(a.className=n,a.setAttribute("aria-hidden","true"),a.style.display="inline-block",oo(a,e,i))return a}if(typeof e=="string"&&e.startsWith("data:image/svg+xml;base64,")){const a=e.slice(io.length);if(/^[A-Za-z0-9+/=]+$/.test(a)){const c=document.createElement("span");return c.className=n,c.setAttribute("aria-hidden","true"),c.style.display="inline-block",ra(e)&&oo(c,e,"currentColor")||(c.style.backgroundImage=`url("${e}")`,c.style.backgroundRepeat="no-repeat",c.style.backgroundPosition="center",c.style.backgroundSize="contain"),c}}if(typeof e=="string"&&/^data:image\/(png|jpeg|jpg|gif|webp|x-icon|vnd\.microsoft\.icon);base64,/i.test(e)){const a=e.indexOf(","),c=a>=0?e.slice(a+1):"";if(/^[A-Za-z0-9+/=]+$/.test(c))return so(e,n)}if(typeof e=="string"&&(e.startsWith("http://")||e.startsWith("https://")))return so(e,n);const s=document.createElement("span");s.className=`${n} os-icon-letter`.trim(),s.setAttribute("aria-hidden","true");const r=la(o);s.textContent=r;const d=ia(o);return s.style.backgroundColor=`hsl( ${d}, 60%, 45% )`,s.style.color="#fff",s.style.display="inline-flex",s.style.alignItems="center",s.style.justifyContent="center",s.style.fontWeight="600",s.style.borderRadius="4px",s}function so(e,t){const n=document.createElement("img");return n.className=t,n.src=e,n.alt="",n.setAttribute("aria-hidden","true"),n.draggable=!1,n}function la(e){const t=(e??"").trim();if(t==="")return"?";const n=t.split(/\s+/);if(n.length>=2)return(n[0][0]+n[1][0]).toUpperCase();const o=n[0];return o.length>=2?o.slice(0,2).toUpperCase():o.toUpperCase()}const ro=k("desktop-mode/window-slots-registry",()=>({registry:new Map,listeners:new Set})),ca=ro.state.registry,ao=ro.state.listeners;function da(){return Array.from(ca.values()).sort((e,t)=>{const n=e.order??100,o=t.order??100;return n!==o?n-o:e.id.localeCompare(t.id)})}function ua(e,t){const n=[];for(const o of da())if(o.slot===t){try{if(!o.match(e))continue}catch(i){typeof console<"u"&&console.warn(`[openstation] window-slot "${o.id}" match() threw — skipping`,i);continue}n.push(o)}return n}function ha(e){return ao.add(e),()=>{ao.delete(e)}}const lo=["before-titlebar","before-icon","icon","title","after-title","before-controls","after-controls","after-titlebar"],co=new WeakMap;function uo(e,t){return e.querySelector(`[data-slot="${t}"]`)}function fa(e){const t=new Map;for(const n of lo){const o=uo(e,n);o&&t.set(n,Array.from(o.childNodes).map(i=>i.cloneNode(!0)))}return t}function ge(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function pa(e,t){ge(e);for(const n of t)e.appendChild(n.cloneNode(!0))}function ma(e,t){const n=e.querySelector(".os-window__title");n&&(n.textContent=t)}function ga(e){const t=[],n=e.element;if(!n)return()=>{};let o=co.get(n);o||(o=fa(n),co.set(n,o));const i=e.config.appearance?.slots??{};for(const s of lo){const r=uo(n,s);if(!r)continue;const d=o.get(s)??[],a=i[s],c=ua(e,s);if(a===null)ge(r);else if(a&&"html"in a)ge(r),r.textContent=a.html;else if(a&&"render"in a){a.replace!==!1&&ge(r);try{const u=a.render(r);typeof u=="function"&&t.push(u)}catch(u){m(f.SHELL_ERROR,{scope:"window-slot-inline-render",windowId:e.id,slot:s,error:u})}}else pa(r,d),s==="title"&&ma(r,e.config.title);if(a!==null){let l=!1;for(const u of c){u.replace!==!1&&!l&&(ge(r),l=!0);try{const g=u.render(r,{window:e,slot:s});typeof g=="function"&&t.push(g)}catch(g){m(f.SHELL_ERROR,{scope:"window-slot-registry-render",windowId:e.id,slot:s,id:u.id,error:g})}}}T(f.WINDOW_CHROME_SLOT,r,{windowId:e.id,slot:s,config:e.config})}return m(f.WINDOW_CHROME_APPLIED,{windowId:e.id,layer:"slots"}),()=>{for(const s of t)try{s()}catch{}}}const ho=k("desktop-mode/window-chrome-registry",()=>({registry:new Map,listeners:new Set})),_a=ho.state.registry,fo=ho.state.listeners;function ba(e){return _a.get(e.toLowerCase())??null}function wa(e){return fo.add(e),()=>{fo.delete(e)}}const ze="core/standard",kt="os-window--custom-chrome";function po(e){const t=e.config.appearance?.chrome??ze;return T(f.WINDOW_CHROME_RENDER,t,{windowId:e.id,config:e.config})}function mo(e){return{title:e.config.title,icon:e.config.icon,focused:e.element.classList.contains("os-window--focused"),state:e.state}}function ya(e){const t=po(e);if(t===ze)return null;const n=ba(t);if(!n)return null;try{if(n.match&&!n.match(e))return null}catch{return null}e.element.classList.add(kt);let o;try{o=n.render(e.element,{window:e,state:mo(e)})}catch(i){return e.element.classList.remove(kt),m(f.SHELL_ERROR,{scope:"window-chrome-render",windowId:e.id,chromeId:t,error:i}),null}return m(f.WINDOW_CHROME_APPLIED,{windowId:e.id,layer:"chrome",chromeId:t}),{id:t,handle:o}}const go=k("desktop-mode/window-actions-registry",()=>({registry:new Map,listeners:new Set})),va=go.state.registry,_o=go.state.listeners;function Ea(){return Array.from(va.values()).sort((e,t)=>(e.order??100)-(t.order??100))}function Aa(e){return _o.add(e),()=>{_o.delete(e)}}function Sa(e,t){if(typeof e.label=="function")try{return String(e.label(t)??"")}catch{return""}return e.label}function Ca(e,t){if(typeof e.icon=="function")try{return String(e.icon(t)??"")}catch{return""}return e.icon??""}function ka(e,t){if(!e.checkable||typeof e.checked!="function")return!1;try{return!!e.checked(t)}catch{return!1}}function xa(e,t){if(typeof e.isVisible!="function")return!0;try{return!!e.isVisible(t)}catch{return!1}}function bo(e){const t=e.element.querySelector(".os-window__menu-panel");t&&(t.hidden?wo(e):V(e))}function wo(e){const t=e.element.querySelector(".os-window__menu-panel"),n=e.element.querySelector(".os-window__menu-btn");if(!t||!n)return;t.hidden=!1,n.setAttribute("aria-expanded","true");const o=t.querySelector(".os-window__menu-item--startup");o&&xt(e,o),vo(e,t),e._unsubscribeWindowActions?.(),e._unsubscribeWindowActions=Aa(()=>{t.hidden||vo(e,t)}),m(f.WINDOW_MENU_OPENED,{windowId:e.id,element:t}),e._boundOnDocumentPointerDown||(e._boundOnDocumentPointerDown=s=>{const r=s.target;r&&(t.contains(r)||n.contains(r)||V(e))}),setTimeout(()=>{e._boundOnDocumentPointerDown&&document.addEventListener("pointerdown",e._boundOnDocumentPointerDown,!0)},0),t.querySelector('[role="menuitem"]')?.focus()}function V(e){const t=e.element.querySelector(".os-window__menu-panel"),n=e.element.querySelector(".os-window__menu-btn");t&&(t.hidden=!0),n&&n.setAttribute("aria-expanded","false"),e._boundOnDocumentPointerDown&&document.removeEventListener("pointerdown",e._boundOnDocumentPointerDown,!0),e._unsubscribeWindowActions?.(),e._unsubscribeWindowActions=null}function yo(e){e.hasAttribute("checked")?e.removeAttribute("checked"):e.setAttribute("checked","")}function xt(e,t){const n=window.wp?.os?.config?.defaultWindow;let o=!1;if(n&&n.enabled&&typeof n.url=="string")if(e.config.native)o=n.url===`native:${e.id}`;else try{const i=Y(e.getCurrentUrl()),s=Y(n.url);o=i===s}catch{o=!1}o?t.setAttribute("checked",""):t.removeAttribute("checked")}function vo(e,t){for(const n of Array.from(t.querySelectorAll(".os-window__menu-item--action")))n.remove();for(const n of Ea()){if(!xa(n,e))continue;const o=Sa(n,e);if(!o)continue;const i=document.createElement("os-menu-item");if(i.setAttribute("value",n.id),i.classList.add("os-window__menu-item"),i.classList.add("os-window__menu-item--action"),i.setAttribute("data-action-id",n.id),i.textContent=o,n.checkable)i.setAttribute("role","menuitemcheckbox"),ka(n,e)&&i.setAttribute("checked","");else{i.setAttribute("role","menuitem");const r=Ca(n,e);r&&i.setAttribute("icon",r)}const s=n.closeOnSelect??!n.checkable;i.addEventListener("os-menu-item-click",r=>{r.stopPropagation(),n.checkable&&yo(i),s&&V(e);try{n.onSelect(e)}catch(d){typeof console<"u"&&console.error(`[openstation] window action "${n.id}" threw:`,d)}}),t.appendChild(i)}}const Ta={minDurationMs:1e3,minReversals:5,minAmplitudePx:14,maxGapMs:320,cooldownMs:600},Ia="os-pointer-shake";function La(e={}){const t={...Ta,...e};let n={origin:0,dir:0,extent:0},o={origin:0,dir:0,extent:0},i=[],s=!1,r=-1/0;const d=()=>{n={origin:0,dir:0,extent:0},o={origin:0,dir:0,extent:0},i=[],s=!1},a=(l,u)=>{if(l.dir===0){const g=u-l.origin;return Math.abs(g)>=t.minAmplitudePx&&(l.dir=g>0?1:-1,l.extent=Math.abs(g)),!1}const p=(u-l.origin)*l.dir;if(p>=l.extent)return l.extent=p,!1;if(l.extent-p>=t.minAmplitudePx){const g=l.origin+l.dir*l.extent;return l.origin=g,l.dir=l.dir===1?-1:1,l.extent=l.extent-p,l.extent>=0}return!1};return{feed:(l,u,p)=>{if(p<r)return null;if(!s)return s=!0,n.origin=l,o.origin=u,null;const g=i[i.length-1];g&&p-g.t>t.maxGapMs&&(i=[]);const b=a(n,l),y=a(o,u);if(b&&i.push({t:p,axis:"x"}),y&&i.push({t:p,axis:"y"}),!b&&!y||i.length<t.minReversals)return null;const w=p-i[0].t;if(w<t.minDurationMs)return null;let S=0;for(const C of i)C.axis==="x"&&S++;const E={x:l,y:u,durationMs:w,reversals:i.length,axis:S*2>=i.length?"x":"y"};return d(),r=p+t.cooldownMs,E},reset:d}}function Na(e,t){e.dispatchEvent(new CustomEvent(Ia,{detail:t,bubbles:!0,composed:!0}))}function Eo(e,t){let n=!1;return()=>{n||(n=!0,requestAnimationFrame(()=>{if(n=!1,!(t==="drag"&&!e._isDragging)&&!(t==="resize"&&!e._isResizing)&&!(e._isDestroyed||!e.element.isConnected))try{m(f.WINDOW_BOUNDS_CHANGED,{windowId:e.id,x:e.element.offsetLeft,y:e.element.offsetTop,width:e.element.offsetWidth,height:e.element.offsetHeight,state:e.state,phase:t})}catch{}}))}}function Ra(e,t){const n=t.target;if(n.closest(".os-window__btn")||n.closest(".os-window__custom-buttons")||n.closest(".os-window__controls")||n.closest(".os-window__screen-meta")||n.closest(".os-window__menu-btn")||n.closest(".os-window__menu-panel")||Ut())return;const o=e.state==="maximized",i=e.state==="snapped-left"||e.state==="snapped-right",s=o||i,r=t.clientX,d=t.clientY,a=t.pointerId,c=s?Oa(e,t):null;e._titleBar.setPointerCapture(a);const l=e.snapConfigProvider?.()??{enabled:!1,cellWidth:0,cellHeight:0},u=Eo(e,"drag"),p=La();let g=!1,b=r,y=d;const w=(h,v,I)=>{h===g||!e._isDragging||(g=h,e.onDragGesture?.(e,{type:"modifier",active:h,clientX:v,clientY:I}))},S=h=>{h.key==="Alt"&&(h.preventDefault(),w(h.type==="keydown",b,y))};let E=!1;const C=(h,v)=>{if(E)return;E=!0;let I,H;if(c){const P=Da(e,c,h,v);I=P.left,H=P.top}else I=e.element.offsetLeft,H=e.element.offsetTop;e.element.classList.add("os-window--dragging"),l.enabled&&e.element.classList.add("os-window--snap-drag"),e._isDragging=!0,e._dragOffsetX=h-I,e._dragOffsetY=v-H,window.addEventListener("keydown",S),window.addEventListener("keyup",S),m(f.WINDOW_DRAG_START,{windowId:e.id})};s||C(r,d);const N=h=>{if(!E){const F=h.clientX-r,Ce=h.clientY-d;if(F*F+Ce*Ce<Ts)return;C(h.clientX,h.clientY)}if(!e._isDragging)return;let v=h.clientX-e._dragOffsetX,I=h.clientY-e._dragOffsetY;const H=e.element.parentElement;if(H){const F=Pa(v,I,e.element.offsetWidth,{x:0,y:0,width:H.clientWidth,height:H.clientHeight});v=F.x,I=F.y}l.enabled&&(v=Math.round(v/l.cellWidth)*l.cellWidth,I=Math.round(I/l.cellHeight)*l.cellHeight),e.element.style.left=`${v}px`,e.element.style.top=`${I}px`,b=h.clientX,y=h.clientY,w(h.altKey,h.clientX,h.clientY),e.onDragMove?.(e,h.clientX,h.clientY);const P=p.feed(h.clientX,h.clientY,h.timeStamp);P&&(Na(e.element,P),m(f.POINTER_SHAKE,{...P,windowId:e.id}),e.onDragGesture?.(e,{type:"shake",clientX:h.clientX,clientY:h.clientY})),u()},D=()=>{try{e._titleBar.releasePointerCapture(a)}catch{}},Se=()=>{e._titleBar.removeEventListener("pointermove",N),e._titleBar.removeEventListener("pointerup",j),e._titleBar.removeEventListener("pointercancel",j),e._titleBar.removeEventListener("lostpointercapture",j),window.removeEventListener("keydown",S),window.removeEventListener("keyup",S),p.reset()},j=()=>{if(!E){D(),Se();return}if(!e._isDragging||(e._isDragging=!1,e.element.classList.remove("os-window--dragging"),e.element.classList.remove("os-window--snap-drag"),D(),Se(),e.onDragEnd?.(e)??!1))return;e._gridSpan=null,e._emitChange("moved");const v={windowId:e.id,x:e.element.offsetLeft,y:e.element.offsetTop};m(f.WINDOW_DRAG_END,v),m(f.WINDOW_MOVED,v)};e._titleBar.addEventListener("pointermove",N),e._titleBar.addEventListener("pointerup",j),e._titleBar.addEventListener("pointercancel",j),e._titleBar.addEventListener("lostpointercapture",j)}function Oa(e,t){const n=e._titleBar.getBoundingClientRect(),o=n.width>0?(t.clientX-n.left)/n.width:.5,i=e.element.parentElement,s=i?Ye(i):null,r=s?Math.min(960,Math.round(s.width*.6)):640,d=s?Math.min(640,Math.round(s.height*.7)):480,a=e._savedGeometry?.width??r,c=e._savedGeometry?.height??d,l=i?.getBoundingClientRect();return{isMaximized:e.state==="maximized",cursorRatioX:o,titleBarHeight:n.height,areaLeft:l?.left??0,areaTop:l?.top??0,targetW:a,targetH:c}}function Da(e,t,n,o){e.element.classList.remove("os-window--maximized","os-window--snapped-left","os-window--snapped-right"),e.element.style.width=`${t.targetW}px`,e.element.style.height=`${t.targetH}px`;const i=Math.max(B,Math.round(n-t.areaLeft-t.targetW*t.cursorRatioX)),s=Math.max(B,Math.round(o-t.areaTop-t.titleBarHeight/2));return e.element.style.left=`${i}px`,e.element.style.top=`${s}px`,e.state="normal",e._emitChange("state"),t.isMaximized&&m(f.WINDOW_UNMAXIMIZED,{windowId:e.id}),{left:i,top:s}}function Wa(e,t){if(e.state==="maximized"||e.state==="fullscreen")return;t.preventDefault(),t.stopPropagation();const n=t.target,o=n.dataset.dir??"se";e._isResizing=!0,e._resizeStartX=t.clientX,e._resizeStartY=t.clientY,e._resizeStartW=e.element.offsetWidth,e._resizeStartH=e.element.offsetHeight;const i=e.element.offsetLeft,s=e.element.offsetTop;n.setPointerCapture(t.pointerId),e.element.classList.add("os-window--resizing"),m(f.WINDOW_RESIZE_START,{windowId:e.id});const r=Eo(e,"resize"),d=e.snapConfigProvider?.()??{enabled:!1,cellWidth:0,cellHeight:0};d.enabled&&e.element.classList.add("os-window--snap-drag"),(e.state==="snapped-left"||e.state==="snapped-right")&&(e.element.classList.remove("os-window--snapped-left","os-window--snapped-right"),e.state="normal");const a=l=>{if(!e._isResizing)return;const u=l.clientX-e._resizeStartX,p=l.clientY-e._resizeStartY,g=Ma(o,u,p,i,s,e._resizeStartW,e._resizeStartH,e.config.minWidth,e.config.minHeight,d);e.element.style.left=`${g.x}px`,e.element.style.top=`${g.y}px`,e.element.style.width=`${g.width}px`,e.element.style.height=`${g.height}px`,r()},c=()=>{if(!e._isResizing)return;e._isResizing=!1,e.element.classList.remove("os-window--resizing"),e.element.classList.remove("os-window--snap-drag"),n.removeEventListener("pointermove",a),n.removeEventListener("pointerup",c),n.removeEventListener("pointercancel",c),n.removeEventListener("lostpointercapture",c),e._gridSpan=null,e._emitChange("resized");const l={windowId:e.id,width:e.element.offsetWidth,height:e.element.offsetHeight};m(f.WINDOW_RESIZE_END,l),m(f.WINDOW_RESIZED,l)};n.addEventListener("pointermove",a),n.addEventListener("pointerup",c),n.addEventListener("pointercancel",c),n.addEventListener("lostpointercapture",c)}function Ma(e,t,n,o,i,s,r,d,a,c){let l=s,u=r,p=o,g=i;if((e==="ne"||e==="se")&&(l=Math.max(d,s+t)),e==="nw"||e==="sw"){const b=Math.max(d,s-t);p=o+(s-b),l=b}if((e==="se"||e==="sw")&&(u=Math.max(a,r+n)),e==="ne"||e==="nw"){const b=Math.max(a,r-n);g=i+(r-b),u=b}if(c.enabled){const b=Math.max(d,Math.round(l/c.cellWidth)*c.cellWidth),y=Math.max(a,Math.round(u/c.cellHeight)*c.cellHeight);(e==="nw"||e==="sw")&&(p=o+(l-b)),(e==="nw"||e==="ne")&&(g=i+(u-y)),l=b,u=y}if(p<B){const b=B-p;p=B,l=Math.max(d,l-b)}if(g<B){const b=B-g;g=B,u=Math.max(a,u-b)}return{x:p,y:g,width:l,height:u}}function Pa(e,t,n,o){const i=o.x+ft-n,s=o.x+o.width-ft,r=Math.max(i,Math.min(e,s)),d=o.y+B,a=o.y+o.height-ft,c=Math.max(d,Math.min(t,a));return{x:r,y:c}}const $a="os-speculate-doc",Ao=new Map,za=1e3;function Ha(e){if(typeof navigator>"u"||!("serviceWorker"in navigator)||!navigator.serviceWorker.controller)return;let t;try{const i=new URL(e,window.location.href);if(i.origin!==window.location.origin)return;t=i.toString()}catch{return}const n=Date.now(),o=Ao.get(t);if(!(o!==void 0&&n-o<za)){Ao.set(t,n);try{navigator.serviceWorker.controller.postMessage({type:$a,url:t})}catch{}}}const Tt=window.location.origin,Fa="os-window-open",Ua=300;function Ga(e){if(!window.wp?.os?.getOsSettings?.().windowPrewarmEnabled)return;const n=fe(e);n&&Ha(n)}const Ba=120,ae=class ae{constructor(t){if(this.state="normal",this._activityCount=0,this._activityPhase="idle",this._activityError=null,this._activityClearTimer=null,this._activitySavingStartedAt=0,this._activitySettleTimer=null,this._navigationActivity="none",this._navigationActivityTimer=null,this._isDragging=!1,this._isResizing=!1,this._isDestroyed=!1,this._dragOffsetX=0,this._dragOffsetY=0,this._resizeStartX=0,this._resizeStartY=0,this._resizeStartW=0,this._resizeStartH=0,this._savedGeometry=null,this._gridSpan=null,this._savedFullscreenState=null,this._stateBeforeMinimize=null,this._minimizeAnimation=null,this._restoreAnimation=null,this._externalTabs=new Map,this._externalTabSeq=0,this._titleBarButtonsUnsubscribe=null,this._windowThemesUnsubscribe=null,this._windowControlsUnsubscribe=null,this._windowControlsTeardown=null,this._windowSlotsUnsubscribe=null,this._windowSlotsTeardown=null,this._chromeHandle=null,this._chromeId=ze,this._windowChromesUnsubscribe=null,this._nativeRenderTeardown=null,this._nativeRenderCtxDispose=null,this._closeSafetyNetTimer=null,this._clearOpeningClassRemoval=null,this._onCloseTransitionEnd=null,this._isFinalized=!1,this._iframeBridgeReady=!1,this._iframeCloseTimeout=null,this._closePending=!1,this._unsavedGuardPending=!1,this._deferredNavigationCommit=null,this._deferredNavigationTimer=null,this._activeTabId="primary",this.onFocusRequest=null,this.onClose=null,this.onMinimize=null,this.onRestore=null,this.onOpenAnother=null,this.onOpenInNewWindow=null,this.onToggleStartup=null,this.snapConfigProvider=null,this.onDragMove=null,this.onDragEnd=null,this.onDragGesture=null,this._boundOnDocumentPointerDown=null,this._unsubscribeWindowActions=null,this._bodyResizeObserver=null,this._tabOverflowTeardown=null,this._tabSpeculateTimer=null,this._swapBuffer=null,this._swapBufferTimer=null,this._suppressCloseFilter=!1,this.id=t.id,this.config=t,this.element=Ks(t),this.iframe=t.native?null:this.element.querySelector(".os-window__iframe"),this._titleBar=this.element.querySelector(".os-window__titlebar"),this._titleEl=this.element.querySelector(".os-window__title"),this._boundOnMessage=n=>yr(this,n),this.bindEvents(),this.iframe&&this._wireContentFocusForwarder(this.iframe),this.renderCustomTitleBarButtons(),this._titleBarButtonsUnsubscribe=zr(()=>{this.renderCustomTitleBarButtons()}),St(this,this.config.appearance?.theme),this._windowThemesUnsubscribe=qr(()=>{this._isDestroyed||St(this,this.config.appearance?.theme)}),this.repaintWindowControls(),this._windowControlsUnsubscribe=Qr(()=>{this._isDestroyed||this.repaintWindowControls()}),this.repaintWindowSlots(),this._windowSlotsUnsubscribe=ha(()=>{this._isDestroyed||this.repaintWindowSlots()}),this.remountWindowChrome(),this._windowChromesUnsubscribe=wa(()=>{if(this._isDestroyed)return;po(this)!==this._chromeId&&this.remountWindowChrome()}),this._bodyResizeObserver=this.installBodyResizeObserver(),t.initialState==="minimized"){this.state="minimized",this.element.classList.add("os-window--minimized"),this.iframe&&(this.iframe.style.visibility="hidden"),this.element.style.setProperty("content-visibility","hidden");return}(t.initialState==="snapped-left"||t.initialState==="snapped-right")&&this.element.classList.add(`os-window--${t.initialState}`),document.hidden||(this.element.classList.add("os-window--opening"),this._armOpeningClassRemoval()),t.initialState&&t.initialState!=="normal"&&requestAnimationFrame(()=>this.applyInitialState(t.initialState))}_armOpeningClassRemoval(){const t=this.element;let n=null,o=!1;const i=()=>{o||(o=!0,this._clearOpeningClassRemoval=null,n!==null&&(window.clearTimeout(n),n=null),t.removeEventListener("animationend",s),t.removeEventListener("animationcancel",s),t.classList.remove("os-window--opening"))},s=r=>{r.target!==t||r.animationName!==Fa||i()};t.addEventListener("animationend",s),t.addEventListener("animationcancel",s),n=window.setTimeout(()=>{n=null,i()},Ua),this._clearOpeningClassRemoval=i}hydrateNative(){if(!this.config.native||!this.config.render)return;const t=this.element.querySelector(".os-window__body");if(!t)return;const n=T(f.NATIVE_WINDOW_BEFORE_RENDER,t,{windowId:this.id,config:this.config}),o=n instanceof HTMLElement?n:t,{ctx:i,dispose:s}=ri(this.id,this.config.params??{});this._nativeRenderCtxDispose=s;const r=this.config.render(o,i),d=c=>{typeof c=="function"&&(this._nativeRenderTeardown=c)};r instanceof Promise?r.then(c=>{this._isDestroyed||(d(c),$(this.id))},c=>{typeof console<"u"&&console.error(`[openstation] native render rejected for "${this.id}":`,c),m(f.SHELL_ERROR,{scope:"window-open",id:this.id,error:c}),!this._isDestroyed&&$(this.id)}):(d(r),requestAnimationFrame(()=>{this._isDestroyed||$(this.id)})),m(f.NATIVE_WINDOW_AFTER_RENDER,{windowId:this.id,body:o,config:this.config});const a=this.config.autofocus;a&&requestAnimationFrame(()=>{if(this._isDestroyed)return;if(typeof a=="string"){o.querySelector(a)?.focus();return}o.hasAttribute("tabindex")||(o.tabIndex=-1),o.focus()})}applyInitialState(t){t==="minimized"?this.minimize():t==="maximized"?this.toggleMaximize():t==="fullscreen"?this.toggleFullscreen():t==="snapped-left"?this.applySnap("left"):t==="snapped-right"&&this.applySnap("right")}_emitChange(t){t==="state"&&(this._gridSpan=null),document.dispatchEvent(new CustomEvent("os-window-changed",{detail:{windowId:this.id,reason:t,state:this.state}}))}snapGeometry(t){const n=this.snapConfigProvider?.();if(!n||!n.enabled)return t;const o=Math.max(this.config.minWidth,Math.round(t.width/n.cellWidth)*n.cellWidth),i=Math.max(this.config.minHeight,Math.round(t.height/n.cellHeight)*n.cellHeight);return{x:Math.round(t.x/n.cellWidth)*n.cellWidth,y:Math.round(t.y/n.cellHeight)*n.cellHeight,width:o,height:i}}getCurrentUrl(){if(!this.iframe)return this.config.url||`#${this.id}`;try{const t=this.iframe.contentWindow?.location.href;if(t&&t!=="about:blank")return t}catch{}return this.iframe.src}bindEvents(){this.element.addEventListener("pointerdown",()=>{this.element.classList.contains("os-window--overview")||this.onFocusRequest?.(this)}),this.element.addEventListener("focusin",()=>{this.element.classList.contains("os-window--overview")||this.onFocusRequest?.(this)}),this._titleBar.addEventListener("pointerdown",s=>Ra(this,s)),this.element.querySelectorAll(".os-window__resize-handle").forEach(s=>{s.addEventListener("pointerdown",r=>Wa(this,r))});const n=this.element.querySelector(".os-window__menu-btn"),o=this.element.querySelector(".os-window__menu-panel");if(n&&o){n.addEventListener("click",l=>{l.stopPropagation(),bo(this)});const s=o.querySelector(".os-window__menu-item--open-another");s&&s.addEventListener("os-menu-item-click",l=>{l.stopPropagation(),V(this),this.onOpenAnother?.(this)});const r=o.querySelector(".os-window__menu-item--open-in-new-window");r&&r.addEventListener("os-menu-item-click",l=>{l.stopPropagation(),V(this),this.onOpenInNewWindow?.(this)});const d=o.querySelector(".os-window__menu-item--reload");d&&d.addEventListener("os-menu-item-click",l=>{l.stopPropagation(),V(this),this.reload()});const a=o.querySelector(".os-window__menu-item--open-external");a&&a.addEventListener("os-menu-item-click",l=>{l.stopPropagation(),V(this),this.detach()});const c=o.querySelector(".os-window__menu-item--startup");c&&(xt(this,c),c.addEventListener("os-menu-item-click",l=>{l.stopPropagation(),yo(c),this.onToggleStartup?.(this)}),document.addEventListener("os-default-window-changed",()=>{xt(this,c)})),o.addEventListener("keydown",l=>{l.key==="Escape"&&(l.stopPropagation(),V(this),n.focus())})}this._titleBar.addEventListener("dblclick",s=>{s.target?.closest('button, [role="button"], [role="menuitem"], [role="menuitemcheckbox"], os-window-button, os-menu, os-menu-item, .os-window__menu-panel, .os-window__custom-buttons, input, select, textarea, a')||Ut()||this.toggleMaximize()});const i=this.element.querySelector(".os-window__tabs");if(i&&(i.addEventListener("click",s=>tr(this,s)),i.addEventListener("keydown",s=>oi(i,s)),i.addEventListener("pointerover",s=>{const r=s;if(r.pointerType!=="mouse")return;const d=r.target?.closest?.(".os-window__tab[data-url]"),a=d?.dataset.url;a&&(d?.classList.contains("is-active")||(this._tabSpeculateTimer&&window.clearTimeout(this._tabSpeculateTimer),this._tabSpeculateTimer=window.setTimeout(()=>{this._tabSpeculateTimer=null,Ga(a)},Ba)))}),i.addEventListener("pointerleave",()=>{this._tabSpeculateTimer&&(window.clearTimeout(this._tabSpeculateTimer),this._tabSpeculateTimer=null)}),this._tabOverflowTeardown=or(i)),this.iframe){const s=this.iframe;this._wireTabNavSync(s),window.addEventListener("message",this._boundOnMessage)}}addExternalTab(t,n){Gn(this,t,n)}setTabs(t,n){ii(this.element,t,n)}activateTab(t){Qe(this.element,t)}setZIndex(t){this.element.style.zIndex=String(t)}setFocused(t){this.element.classList.toggle("os-window--focused",t),this._notifyChromeStateChanged()}setTitle(t){const n=this.element.querySelector(".os-window__title");n&&(this._titleEl=n,n.textContent=t),this.config.title=t,m(f.WINDOW_TITLE_CHANGED,{windowId:this.id,title:t}),this._notifyChromeStateChanged()}repaintWindowControls(){const t=this.element.querySelector(".os-window__controls");if(t){if(this._windowControlsTeardown){try{this._windowControlsTeardown()}catch{}this._windowControlsTeardown=null}this._windowControlsTeardown=oa(this,t)}}repaintThemedChrome(){const t=this.element.querySelector(".os-window__slot--icon");if(t){const o=t.querySelector(".os-window__icon");o&&o.replaceWith(aa(this.config.icon,{title:this.config.title,className:"os-window__icon",slot:es(this.config.id)}))}const n=this.element.querySelector(".os-window__menu-btn");n&&(n.querySelectorAll(":scope > .dashicons").forEach(o=>o.remove()),n.removeAttribute("icon-src"),n.setAttribute("icon","menu"),lt(n,"core/menu"))}setAppearanceControls(t){this.config.appearance={...this.config.appearance??{},controls:t??void 0},this.repaintWindowControls()}repaintWindowSlots(){if(this._windowSlotsTeardown){try{this._windowSlotsTeardown()}catch{}this._windowSlotsTeardown=null}this._windowSlotsTeardown=ga(this)}remountWindowChrome(){if(this._chromeHandle){try{this._chromeHandle.destroy()}catch{}this._chromeHandle=null}this.element.classList.remove(kt);const t=ya(this);t?(this._chromeHandle=t.handle,this._chromeId=t.id):this._chromeId=ze}setAppearanceChrome(t){this.config.appearance={...this.config.appearance??{},chrome:t??void 0},this.remountWindowChrome()}_notifyChromeStateChanged(){if(!this._isDestroyed&&this._chromeHandle?.update)try{this._chromeHandle.update(mo(this))}catch{}}setAppearanceSlot(t,n){const i={...this.config.appearance?.slots??{}};n===void 0?delete i[t]:i[t]=n,this.config.appearance={...this.config.appearance??{},slots:i},this.repaintWindowSlots()}setAppearanceTheme(t){let n;t==null?n=void 0:typeof t=="string"?n={themeId:t}:typeof t=="object"&&("themeId"in t||"tokens"in t)?n=t:typeof t=="object"&&(n={tokens:t}),this.config.appearance={...this.config.appearance??{},theme:n},St(this,n)}applySnap(t){this._applySnapVisuals(t)&&(this.state=t==="left"?"snapped-left":"snapped-right",this._emitChange("state"))}_applySnapVisuals(t){const n=this.element.parentElement;if(!n)return!1;const o=Ye(n),i=Math.floor(o.width/2);return this.element.classList.remove("os-window--maximized","os-window--fullscreen","os-window--snapped-left","os-window--snapped-right"),this.element.classList.add(`os-window--snapped-${t}`),this.element.style.left=`${t==="left"?o.x:o.x+o.width-i}px`,this.element.style.top=`${o.y}px`,this.element.style.width=`${i}px`,this.element.style.height=`${o.height}px`,!0}isMinimized(){return this.state==="minimized"}isMaximized(){return this.state==="maximized"}isFullscreen(){return this.state==="fullscreen"}isSnapped(t){return t==="left"?this.state==="snapped-left":t==="right"?this.state==="snapped-right":this.state==="snapped-left"||this.state==="snapped-right"}isFocused(){return this.element.classList.contains("os-window--focused")}_prefersReducedMotion(){try{return window.matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}_getDockTarget(){const t=[],n=s=>{typeof s=="string"&&s!==""&&!t.includes(s)&&t.push(s)};n(this.id),n(this.config.baseId);for(const s of t){let r=s;try{typeof CSS<"u"&&typeof CSS.escape=="function"&&(r=CSS.escape(s))}catch{r=s}const d=[`.os-dock__item[data-os-window-base-id="${r}"] .os-dock__item-primary`,`.os-dock__item[data-os-window-base-id="${r}"]`,`.os-dock__item[data-menu-slug="${r}"] .os-dock__item-primary`,`.os-dock__item[data-system-id="${r}"] .os-dock__item-primary`,`.os-dock__item[data-nav-id="${r}"] .os-dock__item-primary`,`.os-dock__item[data-menu-slug="${r}"]`,`.os-dock__item[data-system-id="${r}"]`,`.os-dock__item[data-nav-id="${r}"]`];for(const a of d){const c=document.querySelector(a);if(c){const l=c.getBoundingClientRect();if(l.width>0&&l.height>0)return c}}}const o=['.os-dock__item[data-os-window-base-id="os-system"] .os-dock__item-primary','.os-dock__item[data-system-id="os-system"] .os-dock__item-primary','.os-dock__item[data-os-window-base-id="os-system"]','.os-dock__item[data-system-id="os-system"]'];if(this.id==="desktop-mode-os-settings"||this.id==="os-settings"||this.config.baseId==="desktop-mode-os-settings")for(const s of o){const r=document.querySelector(s);if(r){const d=r.getBoundingClientRect();if(d.width>0&&d.height>0)return r}}const i=document.querySelector("#os-dock")??document.querySelector(".os-dock");if(i){const s=i.getBoundingClientRect();if(s.width>0&&s.height>0)return i}return null}_clearGenieStyles(){this.element.style.removeProperty("will-change"),this.element.style.removeProperty("transform"),this.element.style.removeProperty("opacity")}_cancelGenieAnimation(t){const n=t==="minimize",o=n?this._minimizeAnimation:this._restoreAnimation;if(o){try{o.cancel()}catch{}n?(this._minimizeAnimation=null,this.element.classList.remove("os-window--minimizing")):(this._restoreAnimation=null,this.element.classList.remove("os-window--restoring")),this._clearGenieStyles()}}_buildGenieTransform(t,n,o){const i=n.left+n.width/2-(t.left+t.width/2),s=n.top+n.height/2-(t.top+t.height/2),r=Math.min(n.width/t.width,n.height/t.height);return{dx:i,dy:s,scale:Math.max(.06,Math.min(r,o))}}_canGenieAnimate(t){return!!t&&!this._prefersReducedMotion()&&typeof this.element.animate=="function"&&!document.hidden&&!this.element.classList.contains("os-window--overview")}_installMinimizeContentVisibilityGuard(){const t=()=>{this.state==="minimized"&&!this.element.classList.contains("os-window--overview")&&(this.iframe&&(this.iframe.style.visibility="hidden"),this.element.style.setProperty("content-visibility","hidden"))};t(),this.element.addEventListener("transitionend",n=>{n.propertyName==="opacity"&&t()},{once:!0})}minimize(){if(this.state==="minimized")return;this._cancelGenieAnimation("restore"),this._cancelGenieAnimation("minimize"),this._stateBeforeMinimize=this.state;const t=this._getDockTarget();if(this._canGenieAnimate(t)){const n=this.element.getBoundingClientRect(),o=t.getBoundingClientRect();if(n.width>0&&n.height>0&&o.width>0&&o.height>0){this.state="minimized",this.element.classList.add("os-window--minimizing"),this.element.style.willChange="transform";const{dx:s,dy:r,scale:d}=this._buildGenieTransform(n,o,.22);let a=null;try{a=this.element.animate([{transform:"translate(0px, 0px) scale(1)",opacity:1},{offset:.6,transform:`translate(${s*.6}px, ${r*.6}px) scale(${1-(1-d)*.6})`,opacity:1},{transform:`translate(${s}px, ${r}px) scale(${d})`,opacity:0}],{duration:480,easing:"cubic-bezier(0.32, 0.72, 0, 1)",fill:"forwards"})}catch{a=null}if(a){this._minimizeAnimation=a,a.onfinish=()=>{if(this._minimizeAnimation===a){this._minimizeAnimation=null,this.element.classList.add("os-window--minimized"),this.element.classList.remove("os-window--minimizing"),this._clearGenieStyles();try{a.cancel()}catch{}this._installMinimizeContentVisibilityGuard()}},a.oncancel=()=>{this._minimizeAnimation===a&&(this._minimizeAnimation=null,this.element.classList.remove("os-window--minimizing"),this._clearGenieStyles())},this.onMinimize?.(this),this._emitChange("state"),m(f.WINDOW_MINIMIZED,{windowId:this.id,element:this.element}),this._stateBeforeMinimize==="fullscreen"&&J();return}this.element.classList.remove("os-window--minimizing"),this._clearGenieStyles()}}this.state="minimized",this.element.classList.add("os-window--minimized"),this._installMinimizeContentVisibilityGuard(),this.onMinimize?.(this),this._emitChange("state"),m(f.WINDOW_MINIMIZED,{windowId:this.id,element:this.element}),this._stateBeforeMinimize==="fullscreen"&&J()}restore(){this._cancelGenieAnimation("minimize"),this._cancelGenieAnimation("restore");const t=this.state==="minimized",n=t?this._getDockTarget():null;if(t&&this._canGenieAnimate(n)){this.element.style.removeProperty("content-visibility"),this.iframe&&(this.iframe.style.visibility=""),this.element.classList.remove("os-window--minimized"),this.element.classList.add("os-window--restoring"),this.element.style.willChange="transform";const o=this._stateBeforeMinimize??"normal";this.state=o,this._stateBeforeMinimize=null,o==="fullscreen"&&(J(),this.updateFocusButtonState());const i=this.element.getBoundingClientRect(),s=n.getBoundingClientRect();if(i.width>0&&i.height>0&&s.width>0&&s.height>0){const{dx:d,dy:a,scale:c}=this._buildGenieTransform(i,s,.24);let l=null;try{l=this.element.animate([{transform:`translate(${d}px, ${a}px) scale(${c})`,opacity:0},{offset:.4,transform:`translate(${d*.4}px, ${a*.4}px) scale(${1-(1-c)*.4})`,opacity:1},{transform:"translate(0px, 0px) scale(1)",opacity:1}],{duration:480,easing:"cubic-bezier(0.32, 0.72, 0, 1)",fill:"forwards"})}catch{l=null}if(l){this._restoreAnimation=l;const u=()=>{if(this._restoreAnimation===l){this._restoreAnimation=null,this.element.classList.remove("os-window--restoring"),this._clearGenieStyles();try{l.cancel()}catch{}}};l.onfinish=u,l.oncancel=()=>{this._restoreAnimation===l&&(this._restoreAnimation=null,this.element.classList.remove("os-window--restoring"),this._clearGenieStyles())},this.onRestore?.(this),this.onFocusRequest?.(this),this._emitChange("state"),m(f.WINDOW_RESTORED,{windowId:this.id,element:this.element});return}}this.element.classList.remove("os-window--restoring"),this._clearGenieStyles(),this.onRestore?.(this),this.onFocusRequest?.(this),this._emitChange("state"),m(f.WINDOW_RESTORED,{windowId:this.id,element:this.element});return}this.element.style.removeProperty("content-visibility"),this.iframe&&(this.iframe.style.visibility=""),this.element.classList.remove("os-window--minimized"),t&&(this.state=this._stateBeforeMinimize??"normal",this._stateBeforeMinimize=null,this.state==="fullscreen"&&(J(),this.updateFocusButtonState())),t&&this.onRestore?.(this),this.onFocusRequest?.(this),this._emitChange("state"),t&&m(f.WINDOW_RESTORED,{windowId:this.id,element:this.element})}maximize(){this.state!=="maximized"&&(this.state==="normal"&&(this._savedGeometry={x:this.element.offsetLeft,y:this.element.offsetTop,width:this.element.offsetWidth,height:this.element.offsetHeight}),this._applyMaximizeVisuals()&&(this.state="maximized",this._emitChange("state"),m(f.WINDOW_MAXIMIZED,{windowId:this.id,element:this.element})))}_applyMaximizeVisuals(){const t=this.element.parentElement;if(!t)return!1;this.element.classList.remove("os-window--fullscreen","os-window--snapped-left","os-window--snapped-right"),this.element.classList.add("os-window--maximized");const n=Ye(t);return this.element.style.left=`${n.x}px`,this.element.style.top=`${n.y}px`,this.element.style.width=`${n.width}px`,this.element.style.height=`${n.height}px`,!0}toggleMaximize(){if(this.element.parentElement){if(this.state==="maximized"){if(this.element.classList.remove("os-window--maximized"),this._savedGeometry){const n=this.snapGeometry(this._savedGeometry);this.element.style.left=`${n.x}px`,this.element.style.top=`${n.y}px`,this.element.style.width=`${n.width}px`,this.element.style.height=`${n.height}px`,this._savedGeometry=n}this.state="normal",this._emitChange("state"),m(f.WINDOW_UNMAXIMIZED,{windowId:this.id,element:this.element});return}if(this.state==="fullscreen"){this._savedFullscreenState=null,this._applyMaximizeVisuals(),this.state="maximized",J(),this.updateFocusButtonState(),this._emitChange("state"),m(f.WINDOW_FULLSCREEN_EXITED,{windowId:this.id,element:this.element}),m(f.WINDOW_MAXIMIZED,{windowId:this.id,element:this.element});return}this.maximize()}}toggleFullscreen(){if(this.state==="fullscreen"){this.element.classList.remove("os-window--fullscreen");const t=this._savedFullscreenState;this._savedFullscreenState=null;let n=!1;if(t&&t.state==="maximized")this._applyMaximizeVisuals(),this.state="maximized",n=!0;else if(t&&(t.state==="snapped-left"||t.state==="snapped-right")){const o=t.state==="snapped-left"?"left":"right";this._applySnapVisuals(o),this.state=t.state}else t?(this.element.style.left=`${t.x}px`,this.element.style.top=`${t.y}px`,this.element.style.width=`${t.width}px`,this.element.style.height=`${t.height}px`,this.state="normal"):this.state="normal";J(),this.updateFocusButtonState(),this._emitChange("state"),m(f.WINDOW_FULLSCREEN_EXITED,{windowId:this.id,element:this.element}),n&&m(f.WINDOW_MAXIMIZED,{windowId:this.id,element:this.element});return}this.state==="normal"&&(this._savedGeometry={x:this.element.offsetLeft,y:this.element.offsetTop,width:this.element.offsetWidth,height:this.element.offsetHeight}),this._savedFullscreenState={state:this.state,x:this.element.offsetLeft,y:this.element.offsetTop,width:this.element.offsetWidth,height:this.element.offsetHeight},this.element.classList.remove("os-window--maximized","os-window--snapped-left","os-window--snapped-right"),this.element.classList.add("os-window--fullscreen"),this.state="fullscreen",J(),this.updateFocusButtonState(),this._emitChange("state"),m(f.WINDOW_FULLSCREEN_ENTERED,{windowId:this.id,element:this.element})}updateFocusButtonState(){const t=this.element.querySelector(".os-window__btn--focus");if(!t)return;const n=this.state==="fullscreen";t.classList.toggle("os-window__btn--active",n),t.setAttribute("aria-pressed",n?"true":"false"),t.setAttribute("aria-label",_(n?"Exit fullscreen":"Enter fullscreen"))}detach(){const t=this.getCurrentUrl();let n;try{n=new URL(t,Tt)}catch{return}n.origin===Tt&&(n.searchParams.delete("openstation_chromeless"),n.searchParams.delete("desktop_mode_portal"),n.searchParams.set("desktop_mode_classic","1"),window.open(n.toString(),"_blank","noopener"),m(f.WINDOW_DETACHED,{windowId:this.id,url:n.toString()}))}reload(){if(this.element.querySelector(".os-window__body")?.classList.contains("os-window__body--loading")||this._unsavedGuardPending)return;if(this.config.native){this._reloadNative();return}let n,o;if(this._activeTabId==="primary"){if(!this.iframe)return;const r=this.iframe;n=this.getCurrentUrl(),o=()=>{try{r.contentWindow?.location.reload()}catch{r.src=r.src}}}else{const r=this._externalTabs.get(this._activeTabId);if(!r)return;n=r.url,o=()=>{try{r.iframe.contentWindow?.location.reload()}catch{r.iframe.src=r.url}}}this._spinReloadButton();const i=()=>{this.markContentLoading()},s=()=>{o(),m(f.WINDOW_RELOADED,{windowId:this.id,url:n})};this._activeTabId==="primary"?_t(this,{commit:i,navigate:s}):(i(),s())}_reloadNative(){if(!this.config.render)return;const t=this.element.querySelector(".os-window__body");if(t){if(this._nativeRenderCtxDispose){try{this._nativeRenderCtxDispose()}catch(n){m(f.SHELL_ERROR,{scope:"native-window-ctx-dispose",id:this.id,error:n})}this._nativeRenderCtxDispose=null}if(this._nativeRenderTeardown){try{this._nativeRenderTeardown()}catch(n){m(f.SHELL_ERROR,{scope:"native-window-teardown",id:this.id,error:n})}this._nativeRenderTeardown=null}t.replaceChildren(),this._spinReloadButton(),this.markContentLoading(),this.hydrateNative(),m(f.WINDOW_RELOADED,{windowId:this.id,url:this.config.url??""})}}navigateTo(t){if(this.config.native||!this.iframe)return!1;const n=fe(t);return n?(_t(this,{commit:()=>{this.markContentLoading(),pe(this,t)},navigate:()=>{const o=this.iframe?.contentWindow;if(o)try{o.location.assign(n);return}catch{}this.iframe&&(this.iframe.src=n)}}),!0):!1}_wireContentFocusForwarder(t){const n=()=>{let o=null;try{o=t.contentDocument}catch{return}o&&(o.location&&o.location.pathname.indexOf("/wp-admin/")!==-1||o.addEventListener("pointerdown",()=>{this.element.classList.contains("os-window--overview")||this.onFocusRequest?.(this)},{capture:!0,passive:!0}))};t.addEventListener("load",n),n()}_wireTabNavSync(t){t.addEventListener("load",()=>{try{const n=t.contentWindow?.location.href;if(!n||Lr(this,n))return;Nr(this),pe(this,n)}catch{}})}_discardSwapBuffer(){this._swapBufferTimer!==null&&(window.clearTimeout(this._swapBufferTimer),this._swapBufferTimer=null),this._swapBuffer&&(this._swapBuffer.remove(),this._swapBuffer=null,this.iframe?.classList.remove("os-window__iframe--swap-front"))}swapReload(t){if(this.config.native||!this.iframe||this._isDestroyed)return;if(this._activeTabId!=="primary"){this.reload();return}const n=t?fe(t):this.getCurrentUrl();if(!n)return;this._discardSwapBuffer();const o=this.iframe;o.classList.add("os-window__iframe--swap-front");const i=document.createElement("iframe");i.className="os-window__iframe os-window__iframe--buffer",i.setAttribute("aria-hidden","true"),i.setAttribute("name",`os-frame-${this.id}-buffer`),this._swapBuffer=i,this._swapBufferTimer=window.setTimeout(()=>{this._swapBuffer===i&&this._discardSwapBuffer()},2e4),i.addEventListener("load",()=>{if(this._swapBuffer!==i||this._isDestroyed)return;this._swapBuffer=null,this._swapBufferTimer!==null&&(window.clearTimeout(this._swapBufferTimer),this._swapBufferTimer=null);let s=0,r=0;try{s=o.contentWindow?.scrollX??0,r=o.contentWindow?.scrollY??0}catch{}if(s||r)try{i.contentWindow?.scrollTo(s,r)}catch{}i.classList.remove("os-window__iframe--buffer"),i.removeAttribute("aria-hidden"),i.setAttribute("name",`os-frame-${this.id}`),o.remove(),this.iframe=i,$(this.id),ht(i),i.addEventListener("load",()=>{$(this.id),ht(i)}),this._wireContentFocusForwarder(i),this._wireTabNavSync(i),pe(this,n),m(f.WINDOW_RELOADED,{windowId:this.id,url:n,silent:!0})},{once:!0}),o.insertAdjacentElement("afterend",i),i.src=n}_spinReloadButton(){const t=this.element.querySelector(".os-window__btn--reload");t instanceof HTMLElement&&(t.classList.remove("os-window__btn--spinning"),t.offsetWidth,t.classList.add("os-window__btn--spinning"),t.addEventListener("animationend",()=>{t.classList.remove("os-window__btn--spinning")},{once:!0}))}renderCustomTitleBarButtons(){const t=this.element.querySelector(".os-window__custom-buttons--left"),n=this.element.querySelector(".os-window__custom-buttons--right");if(!t||!n)return;t.innerHTML="",n.innerHTML="";const{left:o,right:i}=$r(this),s=(r,d)=>{for(const a of d){const c=document.createElement("os-window-button");if(Zn(c,a.icon),c.setAttribute("aria-label",a.label),c.setAttribute("title",a.label),c.classList.add("os-window__btn"),c.classList.add("os-window__btn--custom"),c.dataset.buttonId=a.id,r.appendChild(c),typeof a.render=="function")try{a.render(c,this)}catch(l){typeof console<"u"&&console.error("[openstation] title-bar-button render threw:",a.id,l)}else typeof a.onClick=="function"&&c.addEventListener("os-button-activate",l=>{try{a.onClick(this,l)}catch(u){typeof console<"u"&&console.error("[openstation] title-bar-button onClick threw:",a.id,u)}})}};s(t,o),s(n,i)}send(t,n){if(typeof t!="string"||t==="")return;const o=this.iframe??Vo(this.id);if(!o){Uo(this.id,t,n);return}const i=()=>{try{o.contentWindow?.postMessage({type:"os-window-send",channel:t,payload:n},Tt)}catch(s){typeof console<"u"&&console.error("[openstation] Window.send: postMessage failed",s)}};if(Ft(this.id)){i();return}Go(this.id,t,n,i)}on(t,n){return typeof t!="string"||t===""||typeof n!="function"?()=>{}:Ho(this.id,t,n)}markContentLoading(){Ie(this.id)}markContentLoaded(){$(this.id)}whenContentReady(){return Ft(this.id)?Promise.resolve():new Promise(t=>{const n=this.id,o=i=>{const s=i.detail;!s||s.windowId!==n||(document.removeEventListener("os-window-content-loaded",o),t())};document.addEventListener("os-window-content-loaded",o)})}markActivity(t,n={}){this._activityPhase=t,this._activityError=n.error??null,this._paintActivityIndicator()}_resetActivity(){this._activitySettleTimer!==null&&(window.clearTimeout(this._activitySettleTimer),this._activitySettleTimer=null),this._activityClearTimer!==null&&(window.clearTimeout(this._activityClearTimer),this._activityClearTimer=null),this._activityCount=0,this._activityPhase="idle",this._activityError=null,this._paintActivityIndicator()}_deferNavigationCommit(t,n){this._clearDeferredNavigation(),this._deferredNavigationCommit=t,this._deferredNavigationTimer=window.setTimeout(()=>{this._deferredNavigationTimer=null,this._deferredNavigationCommit=null},n)}_commitDeferredNavigation(){const t=this._deferredNavigationCommit;this._clearDeferredNavigation(),!(!t||this._isDestroyed)&&t()}_clearDeferredNavigation(){this._deferredNavigationTimer!==null&&(window.clearTimeout(this._deferredNavigationTimer),this._deferredNavigationTimer=null),this._deferredNavigationCommit=null}_noteNavigationActivity(){this._navigationActivity="pending",this._navigationActivityTimer!==null&&window.clearTimeout(this._navigationActivityTimer),this._navigationActivityTimer=window.setTimeout(()=>{this._navigationActivityTimer=null,this._navigationActivity="none",this._resetActivity()},ae.NAVIGATION_ACTIVITY_TIMEOUT_MS)}_settleNavigationActivity(t=!1){const n=this._navigationActivity!=="none";return this._navigationActivity==="pending"&&(this._navigationActivity="settled",this._navigationActivityTimer!==null&&(window.clearTimeout(this._navigationActivityTimer),this._navigationActivityTimer=null),this._resetActivity(),this._finalizeActivitySettle(!0)),t&&(this._navigationActivity="none"),n}trackActivity(t){return this._markActivityStart(),t.then(n=>(this._markActivitySettled(!0),n),n=>{const o=n instanceof Error?n.message:String(n);throw this._markActivitySettled(!1,o),n})}_markActivityStart(){this._activityCount++,this._activitySettleTimer!==null&&(window.clearTimeout(this._activitySettleTimer),this._activitySettleTimer=null),this._activityCount===1&&(this._activityPhase="saving",this._activityError=null,this._activitySavingStartedAt=Date.now(),this._paintActivityIndicator())}_markActivitySettled(t,n){if(this._activityCount>0&&this._activityCount--,this._activityCount>0){!t&&n&&(this._activityError=n);return}const o=Date.now()-this._activitySavingStartedAt,i=ae.MIN_SAVING_DISPLAY_MS-o;if(i>0){this._activitySettleTimer!==null&&window.clearTimeout(this._activitySettleTimer),this._activitySettleTimer=window.setTimeout(()=>{this._activitySettleTimer=null,this._finalizeActivitySettle(t,n)},i);return}this._finalizeActivitySettle(t,n)}_finalizeActivitySettle(t,n){this._activityPhase=t&&!this._activityError?"saved":"failed",!t&&n&&(this._activityError=n),this._paintActivityIndicator(),this._activityClearTimer!==null&&(window.clearTimeout(this._activityClearTimer),this._activityClearTimer=null),this._activityPhase==="saved"&&(this._activityClearTimer=window.setTimeout(()=>{this._activityClearTimer=null,this._activityPhase="idle",this._activityError=null,this._paintActivityIndicator()},2200))}_paintActivityIndicator(){if(this._isDestroyed)return;const t=this._activityPhase;t==="idle"?this._titleBar.removeAttribute("data-os-activity"):this._titleBar.setAttribute("data-os-activity",t);const n=this._titleBar.querySelector(".os-window__activity-status");if(n){const i=t==="failed";n.setAttribute("role",i?"alert":"status"),n.setAttribute("aria-live",i?"assertive":"polite"),n.textContent=this._activityStatusText()}this._titleBar.querySelectorAll("[data-os-activity-indicator]").forEach(i=>{i.setAttribute("phase",t),this._activityError?i.setAttribute("error",this._activityError):i.removeAttribute("error")})}_activityStatusText(){switch(this._activityPhase){case"saved":return _("Saved");case"failed":return this._activityError?ie(_("Not saved. %s"),this._activityError):_("Not saved.");default:return""}}requestAttention(t,n={}){const o=Ke.filter("os/window-attention-requested",{windowId:this.id,mode:t,durationMs:n.durationMs,intensity:n.intensity},n);if(!o||o.cancel===!0)return;const i=o.mode??t,s={...n,durationMs:typeof o.durationMs=="number"?o.durationMs:n.durationMs,intensity:typeof o.intensity=="string"?o.intensity:n.intensity},r=T("os.window.attention",i,{windowId:this.id,opts:s}),d=window.wp,a=d?.os?.dock,c=d?.os?.taskbar;let l=!1;if(typeof a?.setAttention=="function"&&(a.setAttention(this.id,r,s),l=!0),typeof c?.setAttention=="function"&&(c.setAttention(this.id,r,s),l=!0),!l&&r!==null){this.setHighlight("persistent");const u=s.durationMs??4e3;u>0&&window.setTimeout(()=>{this.setHighlight(null)},u)}else!l&&r===null&&this.setHighlight(null)}shake(){if(T("os.window.shake",!0,{windowId:this.id})===!1)return;const n=this.element;n.classList.remove("os-window--shaking"),n.offsetWidth,n.classList.add("os-window--shaking");const o=()=>{n.classList.remove("os-window--shaking"),n.removeEventListener("animationend",o)};n.addEventListener("animationend",o)}setHighlight(t,n){const o=this.element;o&&(o.classList.remove("wp-window--highlight-preview","wp-window--highlight-persistent"),t==="preview"?o.classList.add("wp-window--highlight-preview"):t==="persistent"&&o.classList.add("wp-window--highlight-persistent"),n?.color?o.style.setProperty("--wp-window-highlight-color",n.color):t===null&&o.style.removeProperty("--wp-window-highlight-color"),m(f.WINDOW_HIGHLIGHT_CHANGED,{windowId:this.id,mode:t,color:n?.color}))}close(){if(!this._isDestroyed){if(this.config.native&&!this._suppressCloseFilter){if(T(f.NATIVE_WINDOW_BEFORE_CLOSE,!0,{windowId:this.id,config:this.config})===!1)return}else if(!this.config.native&&!this._suppressCloseFilter&&this._iframeBridgeReady&&this.iframe){if(this._closePending)return;this._closePending=!0;try{this.iframe.contentWindow?.postMessage({type:"os-bridge-beforeunload-query"},location.origin),this._iframeCloseTimeout=setTimeout(()=>{this._isDestroyed||(this._suppressCloseFilter=!0,this._closePending=!1,this.close())},500);return}catch{this._closePending=!1}}if(this._isDestroyed=!0,this._discardSwapBuffer(),this._clearDeferredNavigation(),this._activityClearTimer!==null&&(window.clearTimeout(this._activityClearTimer),this._activityClearTimer=null),this._activitySettleTimer!==null&&(window.clearTimeout(this._activitySettleTimer),this._activitySettleTimer=null),this._navigationActivityTimer!==null&&(window.clearTimeout(this._navigationActivityTimer),this._navigationActivityTimer=null),this._titleBarButtonsUnsubscribe&&(this._titleBarButtonsUnsubscribe(),this._titleBarButtonsUnsubscribe=null),this._windowThemesUnsubscribe&&(this._windowThemesUnsubscribe(),this._windowThemesUnsubscribe=null),this._windowControlsUnsubscribe&&(this._windowControlsUnsubscribe(),this._windowControlsUnsubscribe=null),this._windowSlotsUnsubscribe&&(this._windowSlotsUnsubscribe(),this._windowSlotsUnsubscribe=null),this._windowChromesUnsubscribe&&(this._windowChromesUnsubscribe(),this._windowChromesUnsubscribe=null),this._nativeRenderCtxDispose){try{this._nativeRenderCtxDispose()}catch(t){m(f.SHELL_ERROR,{scope:"native-window-ctx-dispose",id:this.id,error:t})}this._nativeRenderCtxDispose=null}this._bodyResizeObserver?.disconnect(),this._bodyResizeObserver=null,this._tabSpeculateTimer&&(window.clearTimeout(this._tabSpeculateTimer),this._tabSpeculateTimer=null),this._tabOverflowTeardown?.(),this._tabOverflowTeardown=null,Bo(this.id);try{this.config.onClose?.()}catch(t){m(f.SHELL_ERROR,{scope:"native-window-close",id:this.id,error:t})}this.onClose?.(this),this.element.classList.add("os-window--closing"),this._onCloseTransitionEnd=t=>{t.propertyName==="opacity"&&this._finalizeClose()},this.element.addEventListener("transitionend",this._onCloseTransitionEnd),this._closeSafetyNetTimer=setTimeout(()=>this._finalizeClose(),300)}}destroy(){if(!this._isFinalized){if(!this._isDestroyed){this._suppressCloseFilter=!0;try{this.close()}finally{this._suppressCloseFilter=!1}}this._finalizeClose()}}_finalizeClose(){if(!this._isFinalized){if(this._isFinalized=!0,this._closeSafetyNetTimer!==null&&(clearTimeout(this._closeSafetyNetTimer),this._closeSafetyNetTimer=null),this._iframeCloseTimeout!==null&&(clearTimeout(this._iframeCloseTimeout),this._iframeCloseTimeout=null),this._clearOpeningClassRemoval&&this._clearOpeningClassRemoval(),this._onCloseTransitionEnd&&(this.element.removeEventListener("transitionend",this._onCloseTransitionEnd),this._onCloseTransitionEnd=null),this._cancelGenieAnimation("minimize"),this._cancelGenieAnimation("restore"),this._windowControlsTeardown){try{this._windowControlsTeardown()}catch{}this._windowControlsTeardown=null}if(this._windowSlotsTeardown){try{this._windowSlotsTeardown()}catch{}this._windowSlotsTeardown=null}if(this._chromeHandle){try{this._chromeHandle.destroy()}catch{}this._chromeHandle=null}if(Kr(this),this._nativeRenderTeardown){try{this._nativeRenderTeardown()}catch(t){m(f.SHELL_ERROR,{scope:"native-window-teardown",id:this.id,error:t})}this._nativeRenderTeardown=null}window.removeEventListener("message",this._boundOnMessage),this._boundOnDocumentPointerDown&&document.removeEventListener("pointerdown",this._boundOnDocumentPointerDown,!0),this._unsubscribeWindowActions?.(),this._unsubscribeWindowActions=null,this.element.remove(),J()}}installBodyResizeObserver(){const t=this.element.querySelector(".os-window__body");if(!t||typeof ResizeObserver>"u")return null;const n=new ResizeObserver(o=>{const i=o[0];if(!i)return;const s=i.contentRect,r=Math.round(s.width),d=Math.round(s.height);try{this.config.onResize?.(r,d)}catch(a){m(f.SHELL_ERROR,{scope:"native-window-resize",id:this.id,error:a})}m(f.WINDOW_BODY_RESIZED,{windowId:this.id,width:r,height:d})});return n.observe(t),n}getSnapshot(){if(this.element.offsetParent===null){const n=o=>{const i=parseFloat(o);return Number.isFinite(i)?Math.round(i):0};return{id:this.id,x:n(this.element.style.left),y:n(this.element.style.top),width:n(this.element.style.width),height:n(this.element.style.height),state:this.state}}return{id:this.id,x:this.element.offsetLeft,y:this.element.offsetTop,width:this.element.offsetWidth,height:this.element.offsetHeight,state:this.state}}getExternalTabCount(){return Js(this)}getExternalTabsSnapshot(){return er(this)}toggleActionsMenu(){bo(this)}closeActionsMenu(){V(this)}openActionsMenu(){wo(this)}};ae.NAVIGATION_ACTIVITY_TIMEOUT_MS=3e4,ae.MIN_SAVING_DISPLAY_MS=1200;let It=ae;function A(e,...t){return{__wpdHtml:!0,strings:e,values:t}}function qa(e){return!!e&&e.__wpdHtml===!0}const Va="$$wpd$$",L=/\$\$wpd\$\$(\d+)\$\$/g,Ka="$$wpd-node$$",ja=/^\$\$wpd-node\$\$(\d+)\$\$$/,Ya=new Set(["style","script","textarea","title"]);function Xa(e){let t="",n=!1,o=null,i=!1,s=null,r="",d=!1;for(let a=0;a<e.length;a++){const c=e[a];t+=c;for(let l=0;l<c.length;l++){const u=c[l];if(i){c.startsWith("-->",l)&&(i=!1,l+=2);continue}if(s!==null){u==="<"&&c[l+1]==="/"&&c.slice(l+2,l+2+s.length).toLowerCase()===s&&(l+=1+s.length,s=null,n=!0,d=!1,r="");continue}if(o!==null){u===o&&(o=null);continue}if(n){u==='"'||u==="'"?(o=u,d=!1):u===">"?(n=!1,d=!1,Ya.has(r)&&(s=r),r=""):d&&(/[a-zA-Z0-9-]/.test(u)?r+=u.toLowerCase():d=!1);continue}if(c.startsWith("<!--",l)){i=!0,l+=3;continue}const p=c[l+1]??"";u==="<"&&/[a-zA-Z/!]/.test(p)&&(n=!0,r="",d=/[a-zA-Z]/.test(p))}a<e.length-1&&(t+=n||i||s!==null?`${Va}${a}$$`:`<!--${Ka}${a}$$-->`)}return t}const So=new WeakMap;function Co(e){const t=So.get(e);if(t)return t;const n=document.createElement("template");n.innerHTML=Xa(e);const o=[],i=(d,a)=>{if(d.nodeType===Node.ELEMENT_NODE){const u=d;for(const p of Array.from(u.attributes)){const g=p.name,b=p.value,y=g[0];if(L.test(b))if(L.lastIndex=0,y==="@"){const w=L.exec(b);L.lastIndex=0,o.push({path:a,kind:"event",name:g.slice(1),valueIndex:w?Number(w[1]):0}),u.removeAttribute(g)}else if(y==="."){const w=L.exec(b);L.lastIndex=0,o.push({path:a,kind:"prop",name:g.slice(1),valueIndex:w?Number(w[1]):0}),u.removeAttribute(g)}else if(y==="?"){const w=L.exec(b);L.lastIndex=0,o.push({path:a,kind:"bool",name:g.slice(1),valueIndex:w?Number(w[1]):0}),u.removeAttribute(g)}else{const w=[],S=[];let E=0,C;for(L.lastIndex=0;(C=L.exec(b))!==null;)w.push(b.slice(E,C.index)),S.push(Number(C[1])),E=C.index+C[0].length;w.push(b.slice(E)),o.push({path:a,kind:"attr",name:g,template:w,valueIndices:S}),u.setAttribute(g,"")}}}const c=Array.from(d.childNodes);let l=0;for(let u=0;u<c.length;u++){const p=c[u],g=u+l;if(p.nodeType===Node.COMMENT_NODE){const b=ja.exec(p.data);if(b){const y=document.createTextNode("");p.parentNode.replaceChild(y,p),o.push({path:[...a,g],kind:"node",valueIndex:Number(b[1])})}continue}if(p.nodeType===Node.TEXT_NODE){const b=p.textContent||"";if(!L.test(b)){L.lastIndex=0;continue}L.lastIndex=0;const y=p.parentNode;let w=0,S;const E=[],C=[];for(L.lastIndex=0;(S=L.exec(b))!==null;){S.index>w&&E.push(document.createTextNode(b.slice(w,S.index)));const N=document.createTextNode("");E.push(N),C.push({path:[...a,g+E.length-1],kind:"node",valueIndex:Number(S[1])}),w=S.index+S[0].length}w<b.length&&E.push(document.createTextNode(b.slice(w)));for(const N of E)y.insertBefore(N,p);y.removeChild(p),l+=E.length-1,o.push(...C)}else i(p,[...a,g])}};i(n.content,[]);const r={template:n,buildParts:d=>{const a=[];for(const c of o){let l=d;for(const u of c.path)l=l.childNodes[u];c.kind==="node"?a.push({kind:"node",valueIndex:c.valueIndex,child:{anchor:l,state:null}}):c.kind==="attr"?a.push({kind:"attr",element:l,name:c.name,template:c.template,valueIndices:c.valueIndices}):c.kind==="event"?a.push({kind:"event",valueIndex:c.valueIndex,element:l,name:c.name}):c.kind==="prop"?a.push({kind:"prop",valueIndex:c.valueIndex,element:l,name:c.name}):c.kind==="bool"&&a.push({kind:"bool",valueIndex:c.valueIndex,element:l,name:c.name})}return a}};return So.set(e,r),r}const ko=new WeakMap;function Za(e,t){for(const n of e.nodes)if(n.parentNode!==t)return!1;return!0}function Qa(e,t){const n=ko.get(t);if(n&&n.strings===e.strings&&Za(n,t)){He(n.parts,e.values);return}const o=Co(e.strings),i=o.template.content.cloneNode(!0),s=o.buildParts(i),r=Array.from(i.childNodes);for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(i),He(s,e.values),ko.set(t,{strings:e.strings,parts:s,nodes:r})}function He(e,t){for(const n of e)if(n.kind==="node")Fe(n.child,t[n.valueIndex]);else if(n.kind==="attr"){let o=n.template[0];for(let i=0;i<n.valueIndices.length;i++)o+=xo(t[n.valueIndices[i]]),o+=n.template[i+1];o!==n.last&&(n.last=o,o===""?n.element.removeAttribute(n.name):n.element.setAttribute(n.name,o))}else if(n.kind==="event"){const o=t[n.valueIndex];o!==n.current&&(n.current&&n.element.removeEventListener(n.name,n.current),o&&n.element.addEventListener(n.name,o),n.current=o)}else if(n.kind==="prop"){const o=t[n.valueIndex];o!==n.last&&(n.last=o,n.element[n.name]=o)}else if(n.kind==="bool"){const o=!!t[n.valueIndex];o!==n.last&&(n.last=o,o?n.element.setAttribute(n.name,""):n.element.removeAttribute(n.name))}}function Fe(e,t){if(t==null||t===!1){e.state&&(te(e.state),e.state=null);return}if(Array.isArray(t)){nl(e,t);return}if(qa(t)){tl(e,t);return}if(t instanceof Node){Ja(e,t);return}el(e,xo(t))}function Ja(e,t){const n=e.state;n?.shape==="node"&&n.node===t||(n&&te(n),_e(e,[t]),e.state={shape:"node",node:t})}function el(e,t){const n=e.state;if(n?.shape==="text"){n.text!==t&&(n.node.textContent=t,n.text=t);return}n&&te(n);const o=document.createTextNode(t);_e(e,[o]),e.state={shape:"text",node:o,text:t}}function tl(e,t){const n=e.state;if(n?.shape==="template"&&n.strings===t.strings){He(n.parts,t.values);return}n&&te(n);const o=Co(t.strings),i=o.template.content.cloneNode(!0),s=o.buildParts(i),r=Array.from(i.childNodes);_e(e,[i]),He(s,t.values),e.state={shape:"template",strings:t.strings,parts:s,nodes:r}}function nl(e,t){const n=e.state;if(n?.shape==="array"){const i=Math.min(n.entries.length,t.length);for(let s=0;s<i;s++)Fe(n.entries[s],t[s]);if(t.length<n.entries.length){for(let s=t.length;s<n.entries.length;s++){const r=n.entries[s];r.state&&te(r.state),r.anchor.remove()}n.entries.length=t.length}else for(let s=n.entries.length;s<t.length;s++){const r=document.createTextNode("");_e(e,[r]);const d={anchor:r,state:null};Fe(d,t[s]),n.entries.push(d)}return}n&&te(n);const o=[];for(const i of t){const s=document.createTextNode("");_e(e,[s]);const r={anchor:s,state:null};Fe(r,i),o.push(r)}e.state={shape:"array",entries:o}}function _e(e,t){const n=e.anchor.parentNode;if(n)for(const o of t)n.insertBefore(o,e.anchor)}function te(e){if(e.shape==="text"){e.node.remove();return}if(e.shape==="template"){for(const t of e.parts)t.kind==="node"&&t.child.state&&(te(t.child.state),t.child.state=null);for(const t of e.nodes)t.parentNode&&t.parentNode.removeChild(t);return}if(e.shape==="node"){e.node.parentNode&&e.node.parentNode.removeChild(e.node);return}for(const t of e.entries)t.state&&te(t.state),t.anchor.remove()}function xo(e){return e==null||e===!1?"":String(e)}const ne=class ne 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(To)}connectedCallback(){this._adoptStyles(),this.requestUpdate()}attributeChangedCallback(t,n,o){if(n===o)return;const i=ol(t);this._propValues[i]=o,this.requestUpdate()}get classNames(){return Array.from(this.classList)}set classNames(t){if(t==null){this.removeAttribute("class");return}const o=(Array.isArray(t)?t:String(t).split(/\s+/)).map(i=>String(i).trim()).filter(i=>i!=="");this.className=o.join(" ")}requestUpdate(){this._scheduleRender()}emit(t,n){return this.dispatchEvent(new CustomEvent(t,{detail:n,bubbles:!0,composed:!0}))}_installPropAccessors(){const t=this.constructor;for(const n of t.props){if(Object.getOwnPropertyDescriptor(this,n))continue;const o=To(n);Object.defineProperty(this,n,{get:()=>n in this._propValues?this._propValues[n]:this.getAttribute(o),set:i=>{let s;i==null||i===!1?s=null:i===!0?s="":s=String(i),this._propValues[n]=s,s===null?this.removeAttribute(o):this.setAttribute(o,s),this.requestUpdate()},enumerable:!0,configurable:!0})}}_scheduleRender(){this._renderScheduled||!this.isConnected||(this._renderScheduled=!0,queueMicrotask(()=>{this._renderScheduled=!1,this.isConnected&&Qa(this.render(),this._renderRoot)}))}_adoptStyles(){const t=this.constructor;if(t.styles.length!==0)if(t.shadow&&this.shadowRoot){const n=t.styles.map(o=>o.sheet).filter(o=>o!==null);if(this.shadowRoot.adoptedStyleSheets=n,n.length!==t.styles.length){for(const o of t.styles)if(!o.sheet){const i=document.createElement("style");i.textContent=o.cssText,this.shadowRoot.appendChild(i)}}}else this._adoptLightStyles(t)}_adoptLightStyles(t){if(!ne._lightStylesAdopted.has(t)){ne._lightStylesAdopted.add(t);for(const n of t.styles){const o=document.createElement("style");o.dataset.osUi=this.tagName.toLowerCase(),o.textContent=n.cssText,document.head.appendChild(o)}}}};ne.props=[],ne.styles=[],ne.shadow=!0,ne._lightStylesAdopted=new WeakSet;let K=ne;function oe(e,t){customElements.get(e)||customElements.define(e,t)}function To(e){return e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}function ol(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}const il=(()=>{try{return typeof new CSSStyleSheet().replaceSync=="function"}catch{return!1}})();function x(e,...t){let n=e[0];for(let o=1;o<e.length;o++){const i=t[o-1];if(typeof i=="string"||typeof i=="number")n+=String(i);else if(i&&i.__wpdCss)n+=i.cssText;else throw new TypeError("[os-ui] css`` interpolations must be strings, numbers, or other css`` results. Got: "+typeof i);n+=e[o]}if(il){const o=new CSSStyleSheet;return o.replaceSync(n),{__wpdCss:!0,sheet:o,cssText:n}}return{__wpdCss:!0,sheet:null,cssText:n}}const sl=x`: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:not(:disabled){transform:scale( 0.9 )}@media ( prefers-reduced-motion:reduce ){button:active:not(:disabled){transform:none}}button:disabled{opacity:0.5;cursor:default}button:hover:not(:disabled){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}`,rl={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 al(e){const t=(e??"").trim();return t===""||t.length>4096||!/^(https?:\/\/|data:image\/)/i.test(t)||/['"()\\<>\s]/.test(t)?"":t}const be=class be extends K{constructor(){super(...arguments),this._activateWired=!1}static get observedAttributes(){return[...super.observedAttributes,"aria-label","aria-pressed"]}render(){const t=al(this["icon-src"]||this.getAttribute("icon-src")||""),n=t?"":this.icon||"",o=rl[n]||"",i=this.getAttribute("aria-label")||"";return t?A`
2 + <button type="button" aria-label="${i}" aria-pressed="${this.getAttribute("aria-pressed")||""}" ?disabled="${this.hasAttribute("disabled")}">
3 3 <span
4 4 class="themed-icon"
5 5 aria-hidden="true"
6 6 style="-webkit-mask: url('${t}') center / contain no-repeat; mask: url('${t}') center / contain no-repeat;"
@@ -7,9 +7,9 @@
7 7 ></span>
8 8 <slot></slot>
9 9 </button>
10 10 `:A`
11 - <button type="button">
11 + <button type="button" aria-label="${i}" aria-pressed="${this.getAttribute("aria-pressed")||""}" ?disabled="${this.hasAttribute("disabled")}">
12 12 <svg
13 13 width="14"
14 14 height="14"
15 15 viewBox="0 0 12 12"
@@ -17,19 +17,19 @@
17 17 focusable="false"
18 18 ></svg>
19 19 <slot></slot>
20 20 </button>
21 - <span data-svg-buffer style="display:none">${n}</span>
22 - `}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this._paintSvg()),queueMicrotask(()=>this._wireActivateEvent())}attributeChangedCallback(t,o,n){super.attributeChangedCallback(t,o,n),queueMicrotask(()=>this._paintSvg())}_paintSvg(){const t=this.shadowRoot;if(!t)return;const o=t.querySelector("svg"),n=t.querySelector("[data-svg-buffer]");if(o&&n){const s=n.textContent||"";o.innerHTML!==s&&(o.innerHTML=s)}}_wireActivateEvent(){if(this._activateWired)return;const t=this.shadowRoot;if(!t)return;const o=t.querySelector("button");o&&(this._activateWired=!0,o.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("os-button-activate",{bubbles:!0,composed:!0,cancelable:!0}))}))}};re.props=["icon","icon-src","active","danger"],re.styles=[Lr],re.help=void 0;let ht=re;Z("os-window-button",ht);const Nr=C`: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:12px;height: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-surface,#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-surface,#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}@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:8px;height:8px}.os-save-status__glyph{display:none}.os-save-status__glyph svg{display:block;width:100%;height:100%}`,en="os-settings-save-lifecycle",Or=2200,Dr=6e3,ae=class ae extends B{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(t,o,n){if(super.attributeChangedCallback(t,o,n),(t==="auto"||t==="event")&&(this._removeAutoListener(),this.auto!==null&&this._installAutoListener()),t==="phase"){this._scheduleAutoClear();const s={phase:this.phase??"idle",error:this.error??void 0};this.emit("os-save-status-change",s)}}render(){const t=this.phase??"idle",o=this.mode??"dot",s=(this.error??"")||this._labelForPhase(t);return s?this.setAttribute("title",s):this.removeAttribute("title"),this.setAttribute("aria-live",t==="failed"?"assertive":"polite"),this.setAttribute("role",t==="failed"?"alert":"status"),A`
21 + <span data-svg-buffer style="display:none">${o}</span>
22 + `}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this._paintSvg()),queueMicrotask(()=>this._wireActivateEvent())}attributeChangedCallback(t,n,o){super.attributeChangedCallback(t,n,o),queueMicrotask(()=>this._paintSvg())}_paintSvg(){const t=this.shadowRoot;if(!t)return;const n=t.querySelector("svg"),o=t.querySelector("[data-svg-buffer]");if(n&&o){const i=o.textContent||"";n.innerHTML!==i&&(n.innerHTML=i)}}_wireActivateEvent(){if(this._activateWired)return;const t=this.shadowRoot;if(!t)return;const n=t.querySelector("button");n&&(this._activateWired=!0,n.addEventListener("click",()=>{this.hasAttribute("disabled")||this.dispatchEvent(new CustomEvent("os-button-activate",{bubbles:!0,composed:!0,cancelable:!0}))}))}};be.props=["icon","icon-src","active","danger","disabled"],be.styles=[sl],be.help=void 0;let Lt=be;oe("os-window-button",Lt);const ll=x`: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%}`,Io="os-settings-save-lifecycle",cl=2200,dl=6e3,we=class we extends K{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(t,n,o){if(super.attributeChangedCallback(t,n,o),(t==="auto"||t==="event")&&(this._removeAutoListener(),this.auto!==null&&this._installAutoListener()),t==="phase"){this._scheduleAutoClear();const i={phase:this.phase??"idle",error:this.error??void 0};this.emit("os-save-status-change",i)}}render(){const t=this.phase??"idle",n=this.mode??"dot",i=(this.error??"")||this._labelForPhase(t);return i?this.setAttribute("title",i):this.removeAttribute("title"),this.setAttribute("aria-live",t==="failed"?"assertive":"polite"),this.setAttribute("role",t==="failed"?"alert":"status"),A`
23 23 <span class="os-save-status">
24 24 <span class="os-save-status__indicator" aria-hidden="true">
25 25 <span class="os-save-status__glyph">${this._renderGlyph(t)}</span>
26 26 </span>
27 - ${o==="pill"?A`<span class="os-save-status__label"
27 + ${n==="pill"?A`<span class="os-save-status__label"
28 28 >${this._labelForPhase(t)}</span
29 29 >`:A``}
30 30 </span>
31 - `}_renderGlyph(t){return t==="saved"?Wr():t==="failed"?Mr():""}_labelForPhase(t){switch(t){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 t=this.event||en;this._docListener=o=>{const n=o.detail;!n||typeof n.phase!="string"||(this.phase=n.phase,n.error?this.error=n.error:n.phase!=="failed"&&this.error&&this.removeAttribute("error"))},document.addEventListener(t,this._docListener)}_removeAutoListener(){if(!this._docListener)return;const t=this.event||en;document.removeEventListener(t,this._docListener),this._docListener=null}_scheduleAutoClear(){this._autoTimer!==null&&(window.clearTimeout(this._autoTimer),this._autoTimer=null);const t=this.phase??"idle",o=this._autoClearMsFor(t);o<=0||(this._autoTimer=window.setTimeout(()=>{this._autoTimer=null,this.phase="idle"},o))}_autoClearMsFor(t){if(t==="saved"){const o=this["auto-clear-saved-ms"];return parseInt(o||"",10)||Or}if(t==="failed"){const o=this["auto-clear-failed-ms"];return parseInt(o||"",10)||Dr}return 0}};ae.props=["phase","mode","animation","auto","event","error","saving-label","saved-label","idle-label","auto-clear-saved-ms","auto-clear-failed-ms"],ae.styles=[Nr],ae.help=void 0;let ft=ae;Z("os-save-status",ft);function Wr(){return A`
31 + `}_renderGlyph(t){return t==="saved"?ul():t==="failed"?hl():""}_labelForPhase(t){switch(t){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 t=this.event||Io;this._docListener=n=>{const o=n.detail;!o||typeof o.phase!="string"||(this.phase=o.phase,o.error?this.error=o.error:o.phase!=="failed"&&this.error&&this.removeAttribute("error"))},document.addEventListener(t,this._docListener)}_removeAutoListener(){if(!this._docListener)return;const t=this.event||Io;document.removeEventListener(t,this._docListener),this._docListener=null}_scheduleAutoClear(){this._autoTimer!==null&&(window.clearTimeout(this._autoTimer),this._autoTimer=null);const t=this.phase??"idle",n=this._autoClearMsFor(t);n<=0||(this._autoTimer=window.setTimeout(()=>{this._autoTimer=null,this.phase="idle"},n))}_autoClearMsFor(t){if(t==="saved"){const n=this["auto-clear-saved-ms"];return parseInt(n||"",10)||cl}if(t==="failed"){const n=this["auto-clear-failed-ms"];return parseInt(n||"",10)||dl}return 0}};we.props=["phase","mode","variant","animation","auto","event","error","saving-label","saved-label","idle-label","auto-clear-saved-ms","auto-clear-failed-ms"],we.styles=[ll],we.help=void 0;let Nt=we;oe("os-save-status",Nt);function ul(){return A`
32 32 <svg
33 33 viewBox="0 0 12 12"
34 34 aria-hidden="true"
35 35 focusable="false"
@@ -40,9 +40,9 @@
40 40 stroke-linejoin="round"
41 41 >
42 42 <path d="M2.5 6 L5 8.5 L9.5 4" />
43 43 </svg>
44 - `}function Mr(){return A`
44 + `}function hl(){return A`
45 45 <svg
46 46 viewBox="0 0 12 12"
47 47 aria-hidden="true"
48 48 focusable="false"
@@ -51,24 +51,24 @@
51 51 <path
52 52 d="M5 2 H7 V7 H5 z M5 8.5 H7 V10.5 H5 z"
53 53 />
54 54 </svg>
55 - `}const $r=C`: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}}`,tn=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}}),O=61.26,D=61.26,on=58.453,Pr='<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"/>',le=class le extends B{constructor(){super(...arguments),this._paintScheduled=!1}connectedCallback(){super.connectedCallback(),this._schedulePaint()}render(){return A`<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 t=this.shadowRoot?.querySelector(".root");t&&(t.innerHTML=this._buildSvg())}_syncCssVars(){const t=(o,n,s)=>{const i=this.getAttribute(o);i===null?this.style.removeProperty(n):this.style.setProperty(n,s?s(i):i)};t("color","--os-ui-spinner-color"),t("accent","--os-ui-spinner-accent"),t("size","--os-ui-spinner-size",o=>/^-?\d+(\.\d+)?$/.test(o.trim())?`${o}px`:o)}_effectiveConfig(){const t=this.getAttribute("preset")??"classic",o=tn[t]??tn.classic,n=(r,c)=>{const a=this.getAttribute(r);if(a===null)return c;const l=parseFloat(a);return Number.isFinite(l)?l:c},s=(r,c)=>{const a=this.getAttribute(r);if(a===null)return c;const l=a.toLowerCase();return l==="-1"||l==="ccw"||l==="reverse"?-1:1},i=()=>{const r=this.getAttribute("pulse");return r==="scale"||r==="opacity"||r==="both"||r==="none"?r:o.pulse};return{sp1:n("sp1",o.sp1),sp2:n("sp2",o.sp2),sp3:n("sp3",o.sp3),a1:n("a1",o.a1),a2:n("a2",o.a2),a3:n("a3",o.a3),gap:n("gap",o.gap),dir2:s("dir2",o.dir2),dir3:s("dir3",o.dir3),pulse:i(),dots:Math.max(0,Math.floor(n("dots",o.dots)))}}_buildInlineSvg(t){const o=nn(this.getAttribute("label")??"Loading"),n=9,s=(t.sp1/10).toFixed(2);return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" role="img" aria-label="${o}"><circle cx="12" cy="12" r="${n}" fill="none" stroke="currentColor" stroke-width="2.4" stroke-opacity="0.22"/><circle cx="12" cy="12" r="${n}" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-dasharray="${Re(n,t.a1)}" style="transform-origin:12px 12px;animation: os-spinner-spin ${s}s linear infinite"/></svg>`}_buildSvg(){const t=this._effectiveConfig();if(this.getAttribute("preset")==="inline")return this._buildInlineSvg(t);const o=nn(this.getAttribute("label")??"Loading"),n=t.gap*3+14,s=-n,i=122.52+n*2,r=on+t.gap+2,c=r+t.gap+2,a=c+t.gap+1.5,l=`animation: os-spinner-spin ${(t.sp1/10).toFixed(2)}s linear infinite`,d=`animation: os-spinner-spin ${(t.sp2/10).toFixed(2)}s linear infinite${t.dir2<0?" reverse":""}`,h=`animation: os-spinner-spin ${(t.sp3/10).toFixed(2)}s linear infinite${t.dir3<0?" reverse":""}`,_=(t.sp1*1.8/10).toFixed(1),p=(t.sp1*2.3/10).toFixed(1);let m="";t.pulse==="scale"?m=`animation: os-spinner-scale ${_}s ease-in-out infinite`:t.pulse==="opacity"?m=`animation: os-spinner-opacity ${p}s ease-in-out infinite`:t.pulse==="both"&&(m=`animation: os-spinner-scale ${_}s ease-in-out infinite, os-spinner-opacity ${p}s ease-in-out infinite`);let k="";if(t.dots>0){const w=a+t.gap+1,E=2*Math.PI*w,y=1.6,v=(t.sp1*.65/10).toFixed(2);for(let S=0;S<t.dots;S++){const N=-(S/t.dots)*E;k+=`<circle cx="${O}" cy="${D}" r="${w.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="${y}" stroke-dasharray="${y.toFixed(2)} ${(E-y).toFixed(2)}" stroke-dashoffset="${N.toFixed(2)}" stroke-linecap="round" stroke-opacity="0.65" style="transform-origin:${O}px ${D}px;animation: os-spinner-spin ${v}s linear infinite"/>`}}return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${s} ${s} ${i} ${i}" role="img" aria-label="${o}"><g style="transform-origin:${O}px ${D}px${m?";"+m:""}"><circle cx="${O}" cy="${D}" r="${on}" fill="currentColor"/><g class="mark">${Pr}</g></g><circle cx="${O}" cy="${D}" r="${r.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="0.6" stroke-opacity="0.2"/><circle cx="${O}" cy="${D}" r="${r.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="2.2" stroke-dasharray="${Re(r,t.a1)}" stroke-linecap="round" style="transform-origin:${O}px ${D}px;${l}"/><circle cx="${O}" cy="${D}" r="${c.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="0.5" stroke-opacity="0.15"/><circle cx="${O}" cy="${D}" r="${c.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="1.6" stroke-opacity="0.8" stroke-dasharray="${Re(c,t.a2)}" stroke-linecap="round" style="transform-origin:${O}px ${D}px;${d}"/><circle cx="${O}" cy="${D}" r="${a.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="0.4" stroke-opacity="0.12"/><circle cx="${O}" cy="${D}" r="${a.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="1.0" stroke-opacity="0.6" stroke-dasharray="${Re(a,t.a3)}" stroke-linecap="round" style="transform-origin:${O}px ${D}px;${h}"/>`+k+"</svg>"}};le.props=["preset","size","color","accent","sp1","sp2","sp3","a1","a2","a3","gap","dir2","dir3","pulse","dots","label"],le.styles=[$r],le.help=void 0;let pt=le;function Re(e,t){const o=2*Math.PI*e,n=t/100*o,s=o-n;return`${n.toFixed(2)} ${s.toFixed(2)}`}function nn(e){return String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}Z("os-spinner",pt);const Ne=C`: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 ) )}`,zr=C` .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%}}`,Hr=C` .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%}}`,Fr=C` .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}}`,Ur=C` .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}}`,Br=C` .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}}`,Gr=C` .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%}}`,sn=C` .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}}`,qr=C` 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}}`,Vr=C` 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-position 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-image:var( --_holo-fill );background-size:220% 220%;background-position:22% 28%;box-shadow:var( --_holo-glow )}input[ type='checkbox' ]:checked:hover:not(:disabled ),input[ type='radio' ]:checked:hover:not(:disabled ){background-position:74% 66%}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( --_holo-ink );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( --_holo-ink );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( --_holo-ink );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}}`,jr=C` @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}}`;C` ${Ne} ${zr} ${Hr} ${Fr} ${Ur} ${Br} ${Gr} ${sn} ${qr} ${Vr} ${jr} `;const Kr=C` ${Ne} ${sn}: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}`,Xr=C`: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 )}`,We=class We extends B{connectedCallback(){super.connectedCallback(),this.setAttribute("role","menu")}render(){return A`<slot></slot>`}};We.styles=[Kr],We.help=void 0;let mt=We;Z("os-menu",mt);const ce=class ce extends B{connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","menuitem")}render(){const t=this.icon||"",o=this.getAttribute("role")==="menuitemcheckbox",n=this.checked!==null;return o&&this.setAttribute("aria-checked",n?"true":"false"),A`
56 - <button type="button" @click=${s=>this._onPick(s)}>
55 + `}const fl=x`: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}}`,Lo=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}}),R=61.26,O=61.26,No=58.453,pl='<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"/>',ye=class ye extends K{constructor(){super(...arguments),this._paintScheduled=!1}connectedCallback(){super.connectedCallback(),this._schedulePaint()}render(){return A`<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 t=this.shadowRoot?.querySelector(".root");t&&(t.innerHTML=this._buildSvg())}_syncCssVars(){const t=(n,o,i)=>{const s=this.getAttribute(n);s===null?this.style.removeProperty(o):this.style.setProperty(o,i?i(s):s)};t("color","--os-ui-spinner-color"),t("accent","--os-ui-spinner-accent"),t("size","--os-ui-spinner-size",n=>/^-?\d+(\.\d+)?$/.test(n.trim())?`${n}px`:n)}_effectiveConfig(){const t=this.getAttribute("preset")??"classic",n=Lo[t]??Lo.classic,o=(r,d)=>{const a=this.getAttribute(r);if(a===null)return d;const c=parseFloat(a);return Number.isFinite(c)?c:d},i=(r,d)=>{const a=this.getAttribute(r);if(a===null)return d;const c=a.toLowerCase();return c==="-1"||c==="ccw"||c==="reverse"?-1:1},s=()=>{const r=this.getAttribute("pulse");return r==="scale"||r==="opacity"||r==="both"||r==="none"?r:n.pulse};return{sp1:o("sp1",n.sp1),sp2:o("sp2",n.sp2),sp3:o("sp3",n.sp3),a1:o("a1",n.a1),a2:o("a2",n.a2),a3:o("a3",n.a3),gap:o("gap",n.gap),dir2:i("dir2",n.dir2),dir3:i("dir3",n.dir3),pulse:s(),dots:Math.max(0,Math.floor(o("dots",n.dots)))}}_buildInlineSvg(t){const n=Ro(this.getAttribute("label")??"Loading"),o=9,i=(t.sp1/10).toFixed(2);return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" role="img" aria-label="${n}"><circle cx="12" cy="12" r="${o}" fill="none" stroke="currentColor" stroke-width="2.4" stroke-opacity="0.22"/><circle cx="12" cy="12" r="${o}" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-dasharray="${Ue(o,t.a1)}" style="transform-origin:12px 12px;animation: os-spinner-spin ${i}s linear infinite"/></svg>`}_buildSvg(){const t=this._effectiveConfig();if(this.getAttribute("preset")==="inline")return this._buildInlineSvg(t);const n=Ro(this.getAttribute("label")??"Loading"),o=t.gap*3+14,i=-o,s=122.52+o*2,r=No+t.gap+2,d=r+t.gap+2,a=d+t.gap+1.5,c=`animation: os-spinner-spin ${(t.sp1/10).toFixed(2)}s linear infinite`,l=`animation: os-spinner-spin ${(t.sp2/10).toFixed(2)}s linear infinite${t.dir2<0?" reverse":""}`,u=`animation: os-spinner-spin ${(t.sp3/10).toFixed(2)}s linear infinite${t.dir3<0?" reverse":""}`,p=(t.sp1*1.8/10).toFixed(1),g=(t.sp1*2.3/10).toFixed(1);let b="";t.pulse==="scale"?b=`animation: os-spinner-scale ${p}s ease-in-out infinite`:t.pulse==="opacity"?b=`animation: os-spinner-opacity ${g}s ease-in-out infinite`:t.pulse==="both"&&(b=`animation: os-spinner-scale ${p}s ease-in-out infinite, os-spinner-opacity ${g}s ease-in-out infinite`);let y="";if(t.dots>0){const w=a+t.gap+1,S=2*Math.PI*w,E=1.6,C=(t.sp1*.65/10).toFixed(2);for(let N=0;N<t.dots;N++){const D=-(N/t.dots)*S;y+=`<circle cx="${R}" cy="${O}" r="${w.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="${E}" stroke-dasharray="${E.toFixed(2)} ${(S-E).toFixed(2)}" stroke-dashoffset="${D.toFixed(2)}" stroke-linecap="round" stroke-opacity="0.65" style="transform-origin:${R}px ${O}px;animation: os-spinner-spin ${C}s linear infinite"/>`}}return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${i} ${i} ${s} ${s}" role="img" aria-label="${n}"><g style="transform-origin:${R}px ${O}px${b?";"+b:""}"><circle cx="${R}" cy="${O}" r="${No}" fill="currentColor"/><g class="mark">${pl}</g></g><circle cx="${R}" cy="${O}" r="${r.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="0.6" stroke-opacity="0.2"/><circle cx="${R}" cy="${O}" r="${r.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="2.2" stroke-dasharray="${Ue(r,t.a1)}" stroke-linecap="round" style="transform-origin:${R}px ${O}px;${c}"/><circle cx="${R}" cy="${O}" r="${d.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="0.5" stroke-opacity="0.15"/><circle cx="${R}" cy="${O}" r="${d.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="1.6" stroke-opacity="0.8" stroke-dasharray="${Ue(d,t.a2)}" stroke-linecap="round" style="transform-origin:${R}px ${O}px;${l}"/><circle cx="${R}" cy="${O}" r="${a.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="0.4" stroke-opacity="0.12"/><circle cx="${R}" cy="${O}" r="${a.toFixed(2)}" fill="none" stroke="currentColor" stroke-width="1.0" stroke-opacity="0.6" stroke-dasharray="${Ue(a,t.a3)}" stroke-linecap="round" style="transform-origin:${R}px ${O}px;${u}"/>`+y+"</svg>"}};ye.props=["preset","size","color","accent","sp1","sp2","sp3","a1","a2","a3","gap","dir2","dir3","pulse","dots","label"],ye.styles=[fl],ye.help=void 0;let Rt=ye;function Ue(e,t){const n=2*Math.PI*e,o=t/100*n,i=n-o;return`${o.toFixed(2)} ${i.toFixed(2)}`}function Ro(e){return String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}oe("os-spinner",Rt);const Ge=x`: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 ) )}`,ml=x` .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%}}`,gl=x` .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%}}`,_l=x` .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}}`,bl=x` .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}}`,wl=x` .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}}`,yl=x` .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%}}`,Oo=x` .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}}`,vl=x` 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}}`,El=x` 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-accent-ink,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-accent-ink,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-accent-ink,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}}`,Al=x` @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}}`;x` ${Ge} ${ml} ${gl} ${_l} ${bl} ${wl} ${yl} ${Oo} ${vl} ${El} ${Al} `;const Sl=x` ${Ge} ${Oo}: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}`,Cl=x`: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 )}`,qe=class qe extends K{connectedCallback(){super.connectedCallback(),this.setAttribute("role","menu")}render(){return A`<slot></slot>`}};qe.styles=[Sl],qe.help=void 0;let Ot=qe;oe("os-menu",Ot);const ve=class ve extends K{connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","menuitem")}render(){const t=this.icon||"",n=this.getAttribute("role")==="menuitemcheckbox",o=this.checked!==null;return n&&this.setAttribute("aria-checked",o?"true":"false"),A`
56 + <button type="button" @click=${i=>this._onPick(i)}>
57 57 <span
58 58 class="os-menu-item__check"
59 - ?hidden=${!o}
59 + ?hidden=${!n}
60 60 ></span>
61 61 <span
62 62 class="os-menu-item__icon dashicons ${t}"
63 63 aria-hidden="true"
64 - ?hidden=${o||!t}
64 + ?hidden=${n||!t}
65 65 ></span>
66 66 <span class="os-menu-item__label">
67 67 <slot></slot>
68 68 </span>
69 69 </button>
70 - `}_onPick(t){t.preventDefault(),this.emit("os-menu-item-click",{value:this.value})}};ce.props=["icon","value","checked"],ce.styles=[Xr],ce.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:A`
70 + `}_onPick(t){t.preventDefault(),this.emit("os-menu-item-click",{value:this.value})}};ve.props=["icon","value","checked"],ve.styles=[Cl],ve.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:A`
71 71 <os-menu>
72 72 <os-menu-item value="plain">Plain item</os-menu-item>
73 73 <os-menu-item value="icon" icon="dashicons-external">
74 74 With an icon
@@ -76,9 +76,9 @@
76 76 <os-menu-item value="startup" role="menuitemcheckbox" checked>
77 77 Checked (menuitemcheckbox)
78 78 </os-menu-item>
79 79 </os-menu>
80 - `};let gt=ce;Z("os-menu-item",gt);const Yr=C` ${Ne}: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}}`,Zr={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"/>'},de=class de extends B{render(){const t=this.variant||"",o=Zr[t]||"";return A`
80 + `};let Dt=ve;oe("os-menu-item",Dt);const kl=x` ${Ge}: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}}`,xl={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"/>'},Ee=class Ee extends K{render(){const t=this.variant||"",n=xl[t]||"";return A`
81 81 <button type="button">
82 82 <svg
83 83 viewBox="0 0 12 12"
84 84 aria-hidden="true"
@@ -85,12 +85,12 @@
85 85 focusable="false"
86 86 ></svg>
87 87 <slot></slot>
88 88 </button>
89 - <span data-svg-buffer style="display:none">${o}</span>
90 - `}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this._paintSvg())}attributeChangedCallback(t,o,n){super.attributeChangedCallback(t,o,n),queueMicrotask(()=>this._paintSvg())}_paintSvg(){const t=this.shadowRoot;if(!t)return;const o=t.querySelector("svg"),n=t.querySelector("[data-svg-buffer]");if(o&&n){const s=n.textContent||"";o.innerHTML!==s&&(o.innerHTML=s)}}};de.props=["variant"],de.styles=[Yr],de.help=void 0;let bt=de;Z("os-tab-chip",bt);const Qr={createWindow(e){return new dt(e)}};window.openStationWindowSystem=Qr;const Jr=C` ${Ne}: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}.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}.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 )}`,ue=class ue extends B{constructor(){super(...arguments),this._onKey=t=>{t.key==="Escape"&&(t.preventDefault(),this._cancel()),t.key==="Enter"&&!t.isComposing&&(t.preventDefault(),this._confirm())},this._onBackdrop=t=>{const o=t.composedPath();(o.length>0?o[0]:t.target)===this&&this._cancel()},this._confirm=()=>{this.emit("os-confirm",{confirmed:!0}),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.addEventListener("keydown",this._onKey),this.addEventListener("click",this._onBackdrop)}disconnectedCallback(){this.removeEventListener("keydown",this._onKey),this.removeEventListener("click",this._onBackdrop)}render(){const t=this.title??"",o=this.message??"",n=this["confirm-label"]||"Confirm",s=this["cancel-label"]||"Cancel",i=this.hasAttribute("danger"),r=this.hasAttribute("hide-cancel"),c=this.hasAttribute("dismissable");return A`
89 + <span data-svg-buffer style="display:none">${n}</span>
90 + `}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this._paintSvg())}attributeChangedCallback(t,n,o){super.attributeChangedCallback(t,n,o),queueMicrotask(()=>this._paintSvg())}_paintSvg(){const t=this.shadowRoot;if(!t)return;const n=t.querySelector("svg"),o=t.querySelector("[data-svg-buffer]");if(n&&o){const i=o.textContent||"";n.innerHTML!==i&&(n.innerHTML=i)}}};Ee.props=["variant"],Ee.styles=[kl],Ee.help=void 0;let Wt=Ee;oe("os-tab-chip",Wt);const Tl={createWindow(e){return new It(e)}};window.openStationWindowSystem=Tl;const Il=x` ${Ge}: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-accent-ink,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 )}`,Do='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function Ll(e){let t=e?.activeElement??null;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t&&t!==e?.body?t:null}function Wo(e){const t=e.composedPath(),n=t.length>0?t[0]:e.target;return n instanceof HTMLElement?n:null}function Mo(e){return e!==null&&e.matches(Do)}const Ae=class Ae extends K{constructor(){super(...arguments),this._prevFocus=null,this._focusTries=0,this._onKey=t=>{if(t.key==="Escape"){t.preventDefault(),this._cancel();return}if(t.key==="Tab"){this._trapTab(t);return}if(t.key==="Enter"&&!t.isComposing){if(Mo(Wo(t))||this.hasAttribute("danger"))return;t.preventDefault(),this._confirm()}},this._focusInitial=()=>{if(!this.hasAttribute("open"))return;const t=this.isConnected?this._initialFocusTarget():null;if(t){t.focus();return}if(this._focusTries++<5){queueMicrotask(this._focusInitial);return}this.isConnected&&this.focus()},this._onBackdrop=t=>{const n=t.composedPath();(n.length>0?n[0]:t.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(t,n,o){super.attributeChangedCallback(t,n,o),t==="open"&&(o!==null?(this._prevFocus=Ll(this.ownerDocument),this._focusTries=0,queueMicrotask(this._focusInitial)):this._restoreFocus())}_focusables(){const t=this.shadowRoot;return t?Array.from(t.querySelectorAll(Do)):[]}_trapTab(t){const n=this._focusables();if(n.length===0)return;const o=n[0],i=n[n.length-1],s=Wo(t),r=!Mo(s);t.shiftKey&&(r||s===o)?(t.preventDefault(),i.focus()):!t.shiftKey&&(r||s===i)&&(t.preventDefault(),o.focus())}_initialFocusTarget(){const t=this.shadowRoot;if(!t)return null;const n=t.querySelector(".btn--secondary"),o=t.querySelector(".dialog");return this.hasAttribute("danger")?n??t.querySelector(".close")??o:t.querySelector(".btn--primary, .btn--danger")??n??o}_restoreFocus(){const t=this._prevFocus;this._prevFocus=null,!(!t||!t.isConnected)&&t.focus()}_remembered(){return this.shadowRoot?.querySelector(".remember__box")?.checked===!0}render(){const t=this.title??"",n=this.message??"",o=this["confirm-label"]||"Confirm",i=this["cancel-label"]||"Cancel",s=this.hasAttribute("danger"),r=this.hasAttribute("hide-cancel"),d=this.hasAttribute("dismissable"),a=this["remember-label"]??"";return A`
91 91 <div class="dialog" tabindex="-1">
92 - ${c?A`<button
92 + ${d?A`<button
93 93 type="button"
94 94 class="close"
95 95 aria-label="Close"
96 96 @click=${()=>this._cancel()}
@@ -95,9 +95,13 @@
95 95 aria-label="Close"
96 96 @click=${()=>this._cancel()}
97 97 >&times;</button>`:A``}
98 98 ${t?A`<h2 class="title">${t}</h2>`:A``}
99 - ${o?A`<p class="message">${o}</p>`:A``}
99 + ${n?A`<p class="message">${n}</p>`:A``}
100 + ${a?A`<label class="remember">
101 + <input type="checkbox" class="remember__box" />
102 + <span class="remember__label">${a}</span>
103 + </label>`:A``}
100 104 <div class="actions">
101 105 ${r?A``:A`<button
102 106 type="button"
103 107 class="btn btn--secondary"
@@ -102,16 +106,16 @@
102 106 type="button"
103 107 class="btn btn--secondary"
104 108 @click=${()=>this._cancel()}
105 109 >
106 - ${s}
110 + ${i}
107 111 </button>`}
108 112 <button
109 113 type="button"
110 - class="btn ${i?"btn--danger":"btn--primary"}"
114 + class="btn ${s?"btn--danger":"btn--primary"}"
111 115 @click=${()=>this._confirm()}
112 116 >
113 - ${n}
117 + ${o}
114 118 </button>
115 119 </div>
116 120 </div>
117 - `}};ue.props=["open","title","message","confirm-label","cancel-label","danger","hide-cancel","dismissable"],ue.styles=[Jr],ue.help=void 0;let Oe=ue;Z("os-confirm-dialog",Oe);function ea(e){return new Promise(t=>{const o=document.createElement("os-confirm-dialog");o.setAttribute("open",""),e.title&&o.setAttribute("title",e.title),o.setAttribute("message",e.message),e.confirmLabel&&o.setAttribute("confirm-label",e.confirmLabel),e.cancelLabel&&o.setAttribute("cancel-label",e.cancelLabel),e.danger&&o.setAttribute("danger",""),e.hideCancel&&o.setAttribute("hide-cancel",""),e.dismissable&&o.setAttribute("dismissable","");const n=i=>{o.remove(),t(i)};o.addEventListener("os-confirm",()=>n(!0)),o.addEventListener("os-cancel",()=>n(!1)),document.body.appendChild(o),(o.shadowRoot?.querySelector(".dialog")??o).focus?.()})}const ta=Object.freeze(Object.defineProperty({__proto__:null,OsConfirmDialog:Oe,osConfirm:ea},Symbol.toStringTag,{value:"Module"}))})();
121 + `}};Ae.props=["open","title","message","confirm-label","cancel-label","danger","hide-cancel","dismissable","remember-label"],Ae.styles=[Il],Ae.help=void 0;let Be=Ae;oe("os-confirm-dialog",Be);function Nl(e){return new Promise(t=>{const n=document.createElement("os-confirm-dialog");n.setAttribute("open",""),e.title&&n.setAttribute("title",e.title),n.setAttribute("message",e.message),e.confirmLabel&&n.setAttribute("confirm-label",e.confirmLabel),e.cancelLabel&&n.setAttribute("cancel-label",e.cancelLabel),e.danger&&n.setAttribute("danger",""),e.hideCancel&&n.setAttribute("hide-cancel",""),e.dismissable&&n.setAttribute("dismissable",""),e.rememberLabel&&n.setAttribute("remember-label",e.rememberLabel);const o=i=>{n.remove(),t(i)};n.addEventListener("os-confirm",i=>{e.onRemember?.(i.detail?.remember===!0),o(!0)}),n.addEventListener("os-cancel",()=>o(!1)),document.body.appendChild(n)})}const Rl=Object.freeze(Object.defineProperty({__proto__:null,OsConfirmDialog:Be,osConfirm:Nl},Symbol.toStringTag,{value:"Module"}))})();