| @@ -1,85 +1,52 @@ | ||
| 1 | -var openStationApp_pages=function(re){"use strict";const Se="desktop-mode";function ne(){return window.wp?.i18n}function p(i,e=Se){return ne()?.__(i,e)??i}function ae(i,e,t,o=Se){return ne()?._n(i,e,t,o)??(t===1?i:e)}function P(i,...e){const t=ne()?.sprintf;if(t)return t(i,...e);let o=0;return i.replace(/%(?:(\d+)\$)?[sd]/g,(s,a)=>{const r=a?Number.parseInt(a,10)-1:o++;return String(e[r]??"")})}function f(i,...e){return{__wpdHtml:!0,strings:i,values:e}}function ct(i){return!!i&&i.__wpdHtml===!0}const dt="$$wpd$$",w=/\$\$wpd\$\$(\d+)\$\$/g,ut="$$wpd-node$$",ht=/^\$\$wpd-node\$\$(\d+)\$\$$/,pt=new Set(["style","script","textarea","title"]);function ft(i){let e="",t=!1,o=null,s=!1,a=null,r="",n=!1;for(let l=0;l<i.length;l++){const c=i[l];e+=c;for(let d=0;d<c.length;d++){const u=c[d];if(s){c.startsWith("-->",d)&&(s=!1,d+=2);continue}if(a!==null){u==="<"&&c[d+1]==="/"&&c.slice(d+2,d+2+a.length).toLowerCase()===a&&(d+=1+a.length,a=null,t=!0,n=!1,r="");continue}if(o!==null){u===o&&(o=null);continue}if(t){u==='"'||u==="'"?(o=u,n=!1):u===">"?(t=!1,n=!1,pt.has(r)&&(a=r),r=""):n&&(/[a-zA-Z0-9-]/.test(u)?r+=u.toLowerCase():n=!1);continue}if(c.startsWith("<!--",d)){s=!0,d+=3;continue}const h=c[d+1]??"";u==="<"&&/[a-zA-Z/!]/.test(h)&&(t=!0,r="",n=/[a-zA-Z]/.test(h))}l<i.length-1&&(e+=t||s||a!==null?`${dt}${l}$$`:`<!--${ut}${l}$$-->`)}return e}const Ae=new WeakMap;function Ee(i){const e=Ae.get(i);if(e)return e;const t=document.createElement("template");t.innerHTML=ft(i);const o=[],s=(n,l)=>{if(n.nodeType===Node.ELEMENT_NODE){const u=n;for(const h of Array.from(u.attributes)){const g=h.name,m=h.value,_=g[0];if(w.test(m))if(w.lastIndex=0,_==="@"){const b=w.exec(m);w.lastIndex=0,o.push({path:l,kind:"event",name:g.slice(1),valueIndex:b?Number(b[1]):0}),u.removeAttribute(g)}else if(_==="."){const b=w.exec(m);w.lastIndex=0,o.push({path:l,kind:"prop",name:g.slice(1),valueIndex:b?Number(b[1]):0}),u.removeAttribute(g)}else if(_==="?"){const b=w.exec(m);w.lastIndex=0,o.push({path:l,kind:"bool",name:g.slice(1),valueIndex:b?Number(b[1]):0}),u.removeAttribute(g)}else{const b=[],v=[];let y=0,$;for(w.lastIndex=0;($=w.exec(m))!==null;)b.push(m.slice(y,$.index)),v.push(Number($[1])),y=$.index+$[0].length;b.push(m.slice(y)),o.push({path:l,kind:"attr",name:g,template:b,valueIndices:v}),u.setAttribute(g,"")}}}const c=Array.from(n.childNodes);let d=0;for(let u=0;u<c.length;u++){const h=c[u],g=u+d;if(h.nodeType===Node.COMMENT_NODE){const m=ht.exec(h.data);if(m){const _=document.createTextNode("");h.parentNode.replaceChild(_,h),o.push({path:[...l,g],kind:"node",valueIndex:Number(m[1])})}continue}if(h.nodeType===Node.TEXT_NODE){const m=h.textContent||"";if(!w.test(m)){w.lastIndex=0;continue}w.lastIndex=0;const _=h.parentNode;let b=0,v;const y=[],$=[];for(w.lastIndex=0;(v=w.exec(m))!==null;){v.index>b&&y.push(document.createTextNode(m.slice(b,v.index)));const X=document.createTextNode("");y.push(X),$.push({path:[...l,g+y.length-1],kind:"node",valueIndex:Number(v[1])}),b=v.index+v[0].length}b<m.length&&y.push(document.createTextNode(m.slice(b)));for(const X of y)_.insertBefore(X,h);_.removeChild(h),d+=y.length-1,o.push(...$)}else s(h,[...l,g])}};s(t.content,[]);const r={template:t,buildParts:n=>{const l=[];for(const c of o){let d=n;for(const u of c.path)d=d.childNodes[u];c.kind==="node"?l.push({kind:"node",valueIndex:c.valueIndex,child:{anchor:d,state:null}}):c.kind==="attr"?l.push({kind:"attr",element:d,name:c.name,template:c.template,valueIndices:c.valueIndices}):c.kind==="event"?l.push({kind:"event",valueIndex:c.valueIndex,element:d,name:c.name}):c.kind==="prop"?l.push({kind:"prop",valueIndex:c.valueIndex,element:d,name:c.name}):c.kind==="bool"&&l.push({kind:"bool",valueIndex:c.valueIndex,element:d,name:c.name})}return l}};return Ae.set(i,r),r}const Pe=new WeakMap;function gt(i,e){for(const t of i.nodes)if(t.parentNode!==e)return!1;return!0}function I(i,e){const t=Pe.get(e);if(t&&t.strings===i.strings&>(t,e)){Y(t.parts,i.values);return}const o=Ee(i.strings),s=o.template.content.cloneNode(!0),a=o.buildParts(s),r=Array.from(s.childNodes);for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(s),Y(a,i.values),Pe.set(e,{strings:i.strings,parts:a,nodes:r})}function Y(i,e){for(const t of i)if(t.kind==="node")Q(t.child,e[t.valueIndex]);else if(t.kind==="attr"){let o=t.template[0];for(let s=0;s<t.valueIndices.length;s++)o+=Te(e[t.valueIndices[s]]),o+=t.template[s+1];o!==t.last&&(t.last=o,o===""?t.element.removeAttribute(t.name):t.element.setAttribute(t.name,o))}else if(t.kind==="event"){const o=e[t.valueIndex];o!==t.current&&(t.current&&t.element.removeEventListener(t.name,t.current),o&&t.element.addEventListener(t.name,o),t.current=o)}else if(t.kind==="prop"){const o=e[t.valueIndex];o!==t.last&&(t.last=o,t.element[t.name]=o)}else if(t.kind==="bool"){const o=!!e[t.valueIndex];o!==t.last&&(t.last=o,o?t.element.setAttribute(t.name,""):t.element.removeAttribute(t.name))}}function Q(i,e){if(e==null||e===!1){i.state&&(T(i.state),i.state=null);return}if(Array.isArray(e)){vt(i,e);return}if(ct(e)){_t(i,e);return}if(e instanceof Node){mt(i,e);return}bt(i,Te(e))}function mt(i,e){const t=i.state;t?.shape==="node"&&t.node===e||(t&&T(t),N(i,[e]),i.state={shape:"node",node:e})}function bt(i,e){const t=i.state;if(t?.shape==="text"){t.text!==e&&(t.node.textContent=e,t.text=e);return}t&&T(t);const o=document.createTextNode(e);N(i,[o]),i.state={shape:"text",node:o,text:e}}function _t(i,e){const t=i.state;if(t?.shape==="template"&&t.strings===e.strings){Y(t.parts,e.values);return}t&&T(t);const o=Ee(e.strings),s=o.template.content.cloneNode(!0),a=o.buildParts(s),r=Array.from(s.childNodes);N(i,[s]),Y(a,e.values),i.state={shape:"template",strings:e.strings,parts:a,nodes:r}}function vt(i,e){const t=i.state;if(t?.shape==="array"){const s=Math.min(t.entries.length,e.length);for(let a=0;a<s;a++)Q(t.entries[a],e[a]);if(e.length<t.entries.length){for(let a=e.length;a<t.entries.length;a++){const r=t.entries[a];r.state&&T(r.state),r.anchor.remove()}t.entries.length=e.length}else for(let a=t.entries.length;a<e.length;a++){const r=document.createTextNode("");N(i,[r]);const n={anchor:r,state:null};Q(n,e[a]),t.entries.push(n)}return}t&&T(t);const o=[];for(const s of e){const a=document.createTextNode("");N(i,[a]);const r={anchor:a,state:null};Q(r,s),o.push(r)}i.state={shape:"array",entries:o}}function N(i,e){const t=i.anchor.parentNode;if(t)for(const o of e)t.insertBefore(o,i.anchor)}function T(i){if(i.shape==="text"){i.node.remove();return}if(i.shape==="template"){for(const e of i.parts)e.kind==="node"&&e.child.state&&(T(e.child.state),e.child.state=null);for(const e of i.nodes)e.parentNode&&e.parentNode.removeChild(e);return}if(i.shape==="node"){i.node.parentNode&&i.node.parentNode.removeChild(i.node);return}for(const e of i.entries)e.state&&T(e.state),e.anchor.remove()}function Te(i){return i==null||i===!1?"":String(i)}async function yt(i){if(i==="")return!1;const e=globalThis.navigator?.clipboard;if(e?.writeText)try{return await e.writeText(i),!0}catch{}return xt(i)}function xt(i){const e=globalThis.document;if(!e?.body||typeof e.execCommand!="function")return!1;const t=e.createElement("textarea");t.value=i,t.setAttribute("readonly",""),t.setAttribute("aria-hidden","true"),t.style.position="fixed",t.style.insetInlineStart="-9999px",t.style.opacity="0",e.body.appendChild(t);const o=e.activeElement;t.select();let s=!1;try{s=e.execCommand("copy")}catch{s=!1}return t.remove(),o?.focus?.(),s}const wt="data-os-mode";function le(i=typeof document<"u"?document.documentElement:null){return!!i&&i.getAttribute(wt)==="mobile"}function kt(i){return i.phone??le()?f`<os-select | |
| 1 | +var openStationApp_pages=function(De){"use strict";const vt="desktop-mode";function He(){return window.wp?.i18n}function u(s,e=vt){return He()?.__(s,e)??s}function Fe(s,e,t,o=vt){return He()?._n(s,e,t,o)??(t===1?s:e)}function H(s,...e){const t=He()?.sprintf;if(t)return t(s,...e);let o=0;return s.replace(/%(?:(\d+)\$)?[sd]/g,(i,a)=>{const n=a?Number.parseInt(a,10)-1:o++;return String(e[n]??"")})}function b(s,...e){return{__wpdHtml:!0,strings:s,values:e}}function ws(s){return!!s&&s.__wpdHtml===!0}const $s="$$wpd$$",F=/\$\$wpd\$\$(\d+)\$\$/g,Cs="$$wpd-node$$",Ss=/^\$\$wpd-node\$\$(\d+)\$\$$/,As=new Set(["style","script","textarea","title"]);function Es(s){let e="",t=!1,o=null,i=!1,a=null,n="",r=!1;for(let l=0;l<s.length;l++){const c=s[l];e+=c;for(let d=0;d<c.length;d++){const p=c[d];if(i){c.startsWith("-->",d)&&(i=!1,d+=2);continue}if(a!==null){p==="<"&&c[d+1]==="/"&&c.slice(d+2,d+2+a.length).toLowerCase()===a&&(d+=1+a.length,a=null,t=!0,r=!1,n="");continue}if(o!==null){p===o&&(o=null);continue}if(t){p==='"'||p==="'"?(o=p,r=!1):p===">"?(t=!1,r=!1,As.has(n)&&(a=n),n=""):r&&(/[a-zA-Z0-9-]/.test(p)?n+=p.toLowerCase():r=!1);continue}if(c.startsWith("<!--",d)){i=!0,d+=3;continue}const g=c[d+1]??"";p==="<"&&/[a-zA-Z/!]/.test(g)&&(t=!0,n="",r=/[a-zA-Z]/.test(g))}l<s.length-1&&(e+=t||i||a!==null?`${$s}${l}$$`:`<!--${Cs}${l}$$-->`)}return e}const xt=new WeakMap;function yt(s){const e=xt.get(s);if(e)return e;const t=document.createElement("template");t.innerHTML=Es(s);const o=[],i=(r,l)=>{if(r.nodeType===Node.ELEMENT_NODE){const p=r;for(const g of Array.from(p.attributes)){const v=g.name,_=g.value,x=v[0];if(F.test(_))if(F.lastIndex=0,x==="@"){const h=F.exec(_);F.lastIndex=0,o.push({path:l,kind:"event",name:v.slice(1),valueIndex:h?Number(h[1]):0}),p.removeAttribute(v)}else if(x==="."){const h=F.exec(_);F.lastIndex=0,o.push({path:l,kind:"prop",name:v.slice(1),valueIndex:h?Number(h[1]):0}),p.removeAttribute(v)}else if(x==="?"){const h=F.exec(_);F.lastIndex=0,o.push({path:l,kind:"bool",name:v.slice(1),valueIndex:h?Number(h[1]):0}),p.removeAttribute(v)}else{const h=[],f=[];let m=0,y;for(F.lastIndex=0;(y=F.exec(_))!==null;)h.push(_.slice(m,y.index)),f.push(Number(y[1])),m=y.index+y[0].length;h.push(_.slice(m)),o.push({path:l,kind:"attr",name:v,template:h,valueIndices:f}),p.setAttribute(v,"")}}}const c=Array.from(r.childNodes);let d=0;for(let p=0;p<c.length;p++){const g=c[p],v=p+d;if(g.nodeType===Node.COMMENT_NODE){const _=Ss.exec(g.data);if(_){const x=document.createTextNode("");g.parentNode.replaceChild(x,g),o.push({path:[...l,v],kind:"node",valueIndex:Number(_[1])})}continue}if(g.nodeType===Node.TEXT_NODE){const _=g.textContent||"";if(!F.test(_)){F.lastIndex=0;continue}F.lastIndex=0;const x=g.parentNode;let h=0,f;const m=[],y=[];for(F.lastIndex=0;(f=F.exec(_))!==null;){f.index>h&&m.push(document.createTextNode(_.slice(h,f.index)));const w=document.createTextNode("");m.push(w),y.push({path:[...l,v+m.length-1],kind:"node",valueIndex:Number(f[1])}),h=f.index+f[0].length}h<_.length&&m.push(document.createTextNode(_.slice(h)));for(const w of m)x.insertBefore(w,g);x.removeChild(g),d+=m.length-1,o.push(...y)}else i(g,[...l,v])}};i(t.content,[]);const n={template:t,buildParts:r=>{const l=[];for(const c of o){let d=r;for(const p of c.path)d=d.childNodes[p];c.kind==="node"?l.push({kind:"node",valueIndex:c.valueIndex,child:{anchor:d,state:null}}):c.kind==="attr"?l.push({kind:"attr",element:d,name:c.name,template:c.template,valueIndices:c.valueIndices}):c.kind==="event"?l.push({kind:"event",valueIndex:c.valueIndex,element:d,name:c.name}):c.kind==="prop"?l.push({kind:"prop",valueIndex:c.valueIndex,element:d,name:c.name}):c.kind==="bool"&&l.push({kind:"bool",valueIndex:c.valueIndex,element:d,name:c.name})}return l}};return xt.set(s,n),n}const kt=new WeakMap;function zs(s,e){for(const t of s.nodes)if(t.parentNode!==e)return!1;return!0}function Z(s,e){const t=kt.get(e);if(t&&t.strings===s.strings&&zs(t,e)){Ae(t.parts,s.values);return}const o=yt(s.strings),i=o.template.content.cloneNode(!0),a=o.buildParts(i),n=Array.from(i.childNodes);for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(i),Ae(a,s.values),kt.set(e,{strings:s.strings,parts:a,nodes:n})}function Ae(s,e){for(const t of s)if(t.kind==="node")Ee(t.child,e[t.valueIndex]);else if(t.kind==="attr"){let o=t.template[0];for(let i=0;i<t.valueIndices.length;i++)o+=wt(e[t.valueIndices[i]]),o+=t.template[i+1];o!==t.last&&(t.last=o,o===""?t.element.removeAttribute(t.name):t.element.setAttribute(t.name,o))}else if(t.kind==="event"){const o=e[t.valueIndex];o!==t.current&&(t.current&&t.element.removeEventListener(t.name,t.current),o&&t.element.addEventListener(t.name,o),t.current=o)}else if(t.kind==="prop"){const o=e[t.valueIndex];o!==t.last&&(t.last=o,t.element[t.name]=o)}else if(t.kind==="bool"){const o=!!e[t.valueIndex];o!==t.last&&(t.last=o,o?t.element.setAttribute(t.name,""):t.element.removeAttribute(t.name))}}function Ee(s,e){if(e==null||e===!1){s.state&&(se(s.state),s.state=null);return}if(Array.isArray(e)){Ls(s,e);return}if(ws(e)){Ms(s,e);return}if(e instanceof Node){Ts(s,e);return}Ps(s,wt(e))}function Ts(s,e){const t=s.state;t?.shape==="node"&&t.node===e||(t&&se(t),ue(s,[e]),s.state={shape:"node",node:e})}function Ps(s,e){const t=s.state;if(t?.shape==="text"){t.text!==e&&(t.node.textContent=e,t.text=e);return}t&&se(t);const o=document.createTextNode(e);ue(s,[o]),s.state={shape:"text",node:o,text:e}}function Ms(s,e){const t=s.state;if(t?.shape==="template"&&t.strings===e.strings){Ae(t.parts,e.values);return}t&&se(t);const o=yt(e.strings),i=o.template.content.cloneNode(!0),a=o.buildParts(i),n=Array.from(i.childNodes);ue(s,[i]),Ae(a,e.values),s.state={shape:"template",strings:e.strings,parts:a,nodes:n}}function Ls(s,e){const t=s.state;if(t?.shape==="array"){const i=Math.min(t.entries.length,e.length);for(let a=0;a<i;a++)Ee(t.entries[a],e[a]);if(e.length<t.entries.length){for(let a=e.length;a<t.entries.length;a++){const n=t.entries[a];n.state&&se(n.state),n.anchor.remove()}t.entries.length=e.length}else for(let a=t.entries.length;a<e.length;a++){const n=document.createTextNode("");ue(s,[n]);const r={anchor:n,state:null};Ee(r,e[a]),t.entries.push(r)}return}t&&se(t);const o=[];for(const i of e){const a=document.createTextNode("");ue(s,[a]);const n={anchor:a,state:null};Ee(n,i),o.push(n)}s.state={shape:"array",entries:o}}function ue(s,e){const t=s.anchor.parentNode;if(t)for(const o of e)t.insertBefore(o,s.anchor)}function se(s){if(s.shape==="text"){s.node.remove();return}if(s.shape==="template"){for(const e of s.parts)e.kind==="node"&&e.child.state&&(se(e.child.state),e.child.state=null);for(const e of s.nodes)e.parentNode&&e.parentNode.removeChild(e);return}if(s.shape==="node"){s.node.parentNode&&s.node.parentNode.removeChild(s.node);return}for(const e of s.entries)e.state&&se(e.state),e.anchor.remove()}function wt(s){return s==null||s===!1?"":String(s)}async function $t(s){if(s==="")return!1;const e=globalThis.navigator?.clipboard;if(e?.writeText)try{return await e.writeText(s),!0}catch{}return Rs(s)}function Rs(s){const e=globalThis.document;if(!e?.body||typeof e.execCommand!="function")return!1;const t=e.createElement("textarea");t.value=s,t.setAttribute("readonly",""),t.setAttribute("aria-hidden","true"),t.style.position="fixed",t.style.insetInlineStart="-9999px",t.style.opacity="0",e.body.appendChild(t);const o=e.activeElement;t.select();let i=!1;try{i=e.execCommand("copy")}catch{i=!1}return t.remove(),o?.focus?.(),i}const Is="data-os-mode";function Ue(s=typeof document<"u"?document.documentElement:null){return!!s&&s.getAttribute(Is)==="mobile"}function Ns(s){return s.phone??Ue()?b`<os-select | |
| 2 | 2 | class="os-app-list__status" |
| 3 | - os-bind=${i.bind} | |
| 4 | - os-action=${i.action} | |
| 5 | - value=${i.value} | |
| 6 | - aria-label=${i.label} | |
| 7 | - >${i.segments.map(t=>f`<os-option value=${t.value}>${t.label}</os-option>`)}</os-select>`:f`<os-segmented | |
| 3 | + os-bind=${s.bind} | |
| 4 | + os-action=${s.action} | |
| 5 | + .value=${s.value} | |
| 6 | + aria-label=${s.label} | |
| 7 | + >${s.segments.map(t=>b`<os-option .value=${t.value}>${t.label}</os-option>`)}</os-select>`:b`<os-segmented | |
| 8 | 8 | class="os-app-list__status" |
| 9 | - os-bind=${i.bind} | |
| 10 | - os-action=${i.action} | |
| 11 | - value=${i.value} | |
| 12 | - label=${i.label} | |
| 13 | - >${i.segments.map(t=>f`<os-segment value=${t.value}>${t.label}</os-segment>`)}</os-segmented>`}function Ct(i){const e=Math.max(1,i.page),t=Math.max(0,i.pages),o=Number(i.perPage)||20,s=i.pageAction??"page",a=i.perPageOptions??[10,20,50,100];return f`<footer class="os-app-list__pager"> | |
| 14 | - <div class="os-app-list__pager-meta"> | |
| 15 | - <span>${i.summary}</span> | |
| 16 | - </div> | |
| 17 | - <div class="os-app-list__pager-nav"> | |
| 18 | - <os-button | |
| 19 | - variant="ghost" | |
| 20 | - os-action=${s} | |
| 21 | - os-arg-page=${e-1} | |
| 22 | - ?disabled=${e<=1} | |
| 23 | - > | |
| 24 | - <span class="dashicons dashicons-arrow-left-alt2" aria-hidden="true"></span> | |
| 25 | - ${i.labels.previous} | |
| 26 | - </os-button> | |
| 27 | - <os-button | |
| 28 | - variant="ghost" | |
| 29 | - os-action=${s} | |
| 30 | - os-arg-page=${e+1} | |
| 31 | - ?disabled=${e>=t} | |
| 32 | - > | |
| 33 | - ${i.labels.next} | |
| 34 | - <span class="dashicons dashicons-arrow-right-alt2" aria-hidden="true"></span> | |
| 35 | - </os-button> | |
| 36 | - <label class="os-app-list__pager-perpage"> | |
| 37 | - ${i.labels.perPage} | |
| 38 | - <os-select | |
| 39 | - os-bind=${i.perPageBind??"perPage"} | |
| 40 | - os-action=${i.perPageAction??"filter"} | |
| 41 | - value=${String(o)} | |
| 42 | - aria-label=${i.labels.perPage} | |
| 43 | - >${a.map(r=>f`<os-option value=${r}>${r}</os-option>`)}</os-select> | |
| 44 | - </label> | |
| 45 | - </div> | |
| 46 | - </footer>`}function $t(i,e){const o=i.closest(".os-window")?.querySelector(".os-window__menu-panel")??null;if(!o||e.items.length===0)return null;const s=`${e.prefix}:`,a="data-os-app-menu-section";o.querySelectorAll(`[${a}="${e.prefix}"]`).forEach(d=>d.remove());const r=document.createElement("div");r.className="os-app__menu-section",r.setAttribute("role","presentation"),r.setAttribute(a,e.prefix),r.textContent=e.section,o.appendChild(r);const n=new Map;for(const d of e.items){const u=document.createElement("os-menu-item");u.setAttribute("role","menuitemcheckbox"),u.setAttribute("value",s+d.key),u.setAttribute(a,e.prefix),u.classList.add("os-window__menu-item","os-app__menu-item"),u.textContent=d.label||d.key,o.appendChild(u),n.set(d.key,u)}const l=()=>{for(const[d,u]of n)e.isChecked(d)?u.setAttribute("checked",""):u.removeAttribute("checked")};l();const c=d=>{const u=d.detail?.value;if(typeof u!="string"||!u.startsWith(s))return;const h=u.slice(s.length);n.has(h)&&(e.onToggle(h),l())};return o.addEventListener("os-menu-item-click",c),{refresh:l,dispose:()=>{o.removeEventListener("os-menu-item-click",c),r.remove();for(const d of n.values())d.remove();n.clear()}}}function St(i,e=null){const t=e??(typeof document<"u"?document.documentElement:null);if(!!t&&le(t)){i.hasAttribute("stacked")||i.setAttribute("stacked","");const a=i.getAttribute("sticky-columns");return a!==null&&(i.setAttribute("data-os-sticky-columns",a),i.removeAttribute("sticky-columns")),!0}i.hasAttribute("stacked")&&i.removeAttribute("stacked");const s=i.getAttribute("data-os-sticky-columns");return s!==null&&(i.setAttribute("sticky-columns",s),i.removeAttribute("data-os-sticky-columns")),!1}function Re(i){return Array.from(i.selection??[],String)}function At(){let i=null,e=!1,t=null,o=null;return{invalidateColumns(){i=null},invalidateData(){o=null},sync(s){const a={phone:!1,columnsChanged:!1,dataChanged:!1,selectionChanged:!1},r=s.table;if(!r)return a;const n=s.rowId??(c=>c.id),l=St(r);if(a.phone=l,l!==i&&(i=l,r.columns=s.columns(l),a.columnsChanged=!0),e||(e=!0,s.wire?.(r)),s.listKey!==t&&(t=s.listKey,Re(r).length>0&&(r.clearSelection(),a.selectionChanged=!0,s.onSelection?.([]))),s.fingerprint!==o){o=s.fingerprint,r.data=s.rows,a.dataChanged=!0;const c=new Set(s.rows.map(h=>String(n(h)))),d=Re(r),u=d.filter(h=>c.has(h));u.length!==d.length&&(r.selection=u,a.selectionChanged=!0,s.onSelection?.(u))}return a}}}function Et(i,e){const t=e.local??{},o={id:i,hasLocal:r=>Object.prototype.hasOwnProperty.call(t,r),runLocal:(r,n,l,c)=>{const d=t[r];if(!d)return n;const u={...n},h=d(u,l,c);return h===void 0?u:h},render:r=>{I(e.view(r),r.root),e.updated?.(r)},mounted:r=>e.mounted?.(r)},{placeholder:s}=e;s&&(o.placeholder=r=>s(r));const a=window;return(a.openStationApps??(a.openStationApps={}))[i]=o,o}const ce=new Map;async function Pt(i){if(!i)return null;let e;try{e=new URL(i,window.location.href)}catch{return i}if(!/gravatar\.com$/i.test(e.hostname))return i;e.searchParams.delete("d"),e.searchParams.delete("s");const t=e.toString(),o=ce.get(t);if(o!==void 0)return o instanceof Promise,o;const s=new URL(i,window.location.href);s.searchParams.set("d","blank");const a=new Promise(r=>{const n=new Image;n.crossOrigin="anonymous",n.onload=()=>{try{const l=document.createElement("canvas");l.width=1,l.height=1;const c=l.getContext("2d",{willReadFrequently:!0});if(!c){r(i);return}c.drawImage(n,0,0,1,1);const d=c.getImageData(0,0,1,1).data;r(d[3]===0?null:i)}catch{r(i)}},n.onerror=()=>r(null),n.src=s.toString()}).then(r=>(ce.set(t,r),r));return ce.set(t,a),a}function Tt(i){return i?.["48"]??i?.["96"]??i?.["24"]??""}function Rt(i,e){e&&Pt(e).then(t=>{i.isConnected&&(t?i.setAttribute("src",t):i.removeAttribute("src"))})}function Le(i){const e=document.createElement("textarea");return e.innerHTML=i,e.value}const L=class L 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(Me)}connectedCallback(){this._adoptStyles(),this.requestUpdate()}attributeChangedCallback(e,t,o){if(t===o)return;const s=Lt(e);this._propValues[s]=o,this.requestUpdate()}get classNames(){return Array.from(this.classList)}set classNames(e){if(e==null){this.removeAttribute("class");return}const o=(Array.isArray(e)?e:String(e).split(/\s+/)).map(s=>String(s).trim()).filter(s=>s!=="");this.className=o.join(" ")}requestUpdate(){this._scheduleRender()}emit(e,t){return this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}_installPropAccessors(){const e=this.constructor;for(const t of e.props){if(Object.getOwnPropertyDescriptor(this,t))continue;const o=Me(t);Object.defineProperty(this,t,{get:()=>t in this._propValues?this._propValues[t]:this.getAttribute(o),set:s=>{let a;s==null||s===!1?a=null:s===!0?a="":a=String(s),this._propValues[t]=a,a===null?this.removeAttribute(o):this.setAttribute(o,a),this.requestUpdate()},enumerable:!0,configurable:!0})}}_scheduleRender(){this._renderScheduled||!this.isConnected||(this._renderScheduled=!0,queueMicrotask(()=>{this._renderScheduled=!1,this.isConnected&&I(this.render(),this._renderRoot)}))}_adoptStyles(){const e=this.constructor;if(e.styles.length!==0)if(e.shadow&&this.shadowRoot){const t=e.styles.map(o=>o.sheet).filter(o=>o!==null);if(this.shadowRoot.adoptedStyleSheets=t,t.length!==e.styles.length){for(const o of e.styles)if(!o.sheet){const s=document.createElement("style");s.textContent=o.cssText,this.shadowRoot.appendChild(s)}}}else this._adoptLightStyles(e)}_adoptLightStyles(e){if(!L._lightStylesAdopted.has(e)){L._lightStylesAdopted.add(e);for(const t of e.styles){const o=document.createElement("style");o.dataset.osUi=this.tagName.toLowerCase(),o.textContent=t.cssText,document.head.appendChild(o)}}}};L.props=[],L.styles=[],L.shadow=!0,L._lightStylesAdopted=new WeakSet;let k=L;function S(i,e){customElements.get(i)||customElements.define(i,e)}function Me(i){return i.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function Lt(i){return i.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}const Mt=(()=>{try{return typeof new CSSStyleSheet().replaceSync=="function"}catch{return!1}})();function x(i,...e){let t=i[0];for(let o=1;o<i.length;o++){const s=e[o-1];if(typeof s=="string"||typeof s=="number")t+=String(s);else if(s&&s.__wpdCss)t+=s.cssText;else throw new TypeError("[os-ui] css`` interpolations must be strings, numbers, or other css`` results. Got: "+typeof s);t+=i[o]}if(Mt){const o=new CSSStyleSheet;return o.replaceSync(t),{__wpdCss:!0,sheet:o,cssText:t}}return{__wpdCss:!0,sheet:null,cssText:t}}function zt(i){const e=[],t=[];let o=null,s=i.parentElement;for(;s&&!(s===document.body||s===document.documentElement);){const r=s.id||"";if(r.startsWith("wp-window-")){o=r.slice(10);break}if(s.tagName.toLowerCase()==="os-tabpanel"){const n=s.getAttribute("for");n&&t.unshift(n)}s=s.parentElement}o&&e.push(de(o));for(const r of t)e.push("tab-"+de(r));const a=i.getAttribute("label");return a&&e.push(de(a)),e.length===0?"os-unnamed":"os-"+e.filter(r=>r!=="").join("-")}function de(i){return i.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function ze(i){if(i.id)return i.id;const e=zt(i);return i.id=e,e}function It(i){if(!i)return 214;let e=5381;for(let t=0;t<i.length;t++)e=Math.imul(e,33)+i.charCodeAt(t);return(e%360+360)%360}const Nt=x`:host{display:inline-flex;position:relative;width:var( --os-ui-avatar-size,32px );height:var( --os-ui-avatar-size,32px );flex:0 0 auto;vertical-align:middle;line-height:0;perspective:calc( var( --os-ui-avatar-size,32px ) * 8 );--os-ui-avatar-tilt-x:0deg;--os-ui-avatar-tilt-y:0deg;--os-ui-avatar-hover:0;--os-ui-avatar-glare-x:50%;--os-ui-avatar-glare-y:50%}:host( [ hidden ] ){display:none}.os-avatar__tile{position:relative;width:100%;height:100%;border-radius:50%;overflow:hidden;background:var( --os-window-bg,#f0f0f1 );color:var( --os-ui-fg-on-accent,#fff );display:flex;align-items:center;justify-content:center;font-weight:700;font-size:calc( var( --os-ui-avatar-size,32px ) * 0.48 );line-height:1;letter-spacing:0;font-feature-settings:'tnum' 1;user-select:none;transform-style:preserve-3d;transform:rotateX( var( --os-ui-avatar-tilt-x ) ) rotateY( var( --os-ui-avatar-tilt-y ) ) scale( calc( 1 + var( --os-ui-avatar-hover ) * 0.07 ) );transition:transform 220ms cubic-bezier( 0.2,0.8,0.2,1 ),box-shadow 220ms cubic-bezier( 0.2,0.8,0.2,1 );box-shadow:inset 0 0 0 1px rgba( 255,255,255,calc( 0.18 + 0.22 * var( --os-ui-avatar-hover ) ) ),inset 0 0 0 calc( 1px + var( --os-ui-avatar-hover ) * 1px ) rgba( 0,0,0,calc( 0.08 + 0.04 * var( --os-ui-avatar-hover ) ) ),0 calc( 1px + var( --os-ui-avatar-hover ) * 8px ) calc( 6px + var( --os-ui-avatar-hover ) * 18px ) rgba( 0,0,0,calc( 0.08 + 0.18 * var( --os-ui-avatar-hover ) ) )}.os-avatar__tile::after{content:'';position:absolute;inset:0;border-radius:50%;background:radial-gradient( circle at var( --os-ui-avatar-glare-x ) var( --os-ui-avatar-glare-y ),var( --os-ui-scrim,rgba( 255,255,255,0.55 ) ) 0%,var( --os-ui-hover,rgba( 255,255,255,0 ) ) 55% );opacity:var( --os-ui-avatar-hover );mix-blend-mode:overlay;pointer-events:none;transition:opacity 220ms cubic-bezier( 0.2,0.8,0.2,1 )}.os-avatar__tile::before{content:'';position:absolute;inset:calc( var( --os-ui-avatar-hover ) * -3px );border-radius:50%;background:radial-gradient( circle at var( --os-ui-avatar-glare-x ) var( --os-ui-avatar-glare-y ),color-mix( in srgb,var( --os-ui-avatar-halo,rgb( 99,102,241 ) ) calc( 35% * var( --os-ui-avatar-hover ) ),transparent ) 0%,transparent 70% );filter:blur( 4px );pointer-events:none;z-index:-1;transition:inset 220ms cubic-bezier( 0.2,0.8,0.2,1 ),background 220ms}.os-avatar__tile img{width:calc( 100% + 2px );height:calc( 100% + 2px );margin:-1px;object-fit:cover;display:block;transform:translateZ( 1px )}.os-avatar__dot{position:absolute;bottom:0;inset-inline-end:0;width:calc( var( --os-ui-avatar-size,32px ) * 0.32 );height:calc( var( --os-ui-avatar-size,32px ) * 0.32 );min-width:8px;min-height:8px;border-radius:50%;box-sizing:border-box;border:2px solid var( --os-ui-avatar-dot-ring,var( --os-window-bg,#fff ) );background:var( --os-ui-avatar-dot-color,transparent );z-index:2}.os-avatar__dot--online{background:var( --os-ui-success-fg,#00a32a )}.os-avatar__dot--online::after{content:'';position:absolute;inset:-2px;border-radius:50%;border:1px solid var( --os-ui-success-fg,#00a32a );animation:os-avatar-presence 6s var( --os-ui-ease-out,cubic-bezier( 0.22,0.9,0.28,1 ) ) infinite;pointer-events:none}@keyframes os-avatar-presence{0%{opacity:0.6;transform:scale( 1 )}20%{opacity:0;transform:scale( 2.2 )}100%{opacity:0;transform:scale( 2.2 )}}.os-avatar__dot--inactive{background:var( --os-ui-warning-fg,#dba617 )}.os-avatar__dot--offline{background:var( --os-ui-fg-muted,#8c8f94 )}@media ( prefers-reduced-motion:reduce ){.os-avatar__dot--online::after{animation:none;opacity:0.6}.os-avatar__tile{transform:none;transition:box-shadow 200ms}.os-avatar__tile::after,.os-avatar__tile::before{display:none}}`,Ie={xs:20,sm:24,md:40,lg:64,xl:96},Ne=new Set(["online","inactive","offline"]),F=class F extends k{constructor(){super(...arguments),this._presenceHandler=null,this._imgFailed=!1,this._onPointerMove=null,this._onPointerEnter=null,this._onPointerLeave=null,this._tiltRaf=0,this._pendingTiltX="0deg",this._pendingTiltY="0deg",this._pendingGlareX="50%",this._pendingGlareY="50%"}connectedCallback(){super.connectedCallback(),this._maybeAttachPresenceListener(),this._attachHoverEffect()}disconnectedCallback(){this._presenceHandler&&(document.removeEventListener("os-presence-changed",this._presenceHandler),this._presenceHandler=null),this._detachHoverEffect()}attributeChangedCallback(e,t,o){super.attributeChangedCallback(e,t,o),e==="src"&&(this._imgFailed=!1),(e==="user-id"||e==="presence")&&this._maybeAttachPresenceListener()}render(){const e=this._attr("src"),t=this._attr("name")||"",o=this._attr("alt"),s=o!==null?o:t,a=this._attr("size"),r=this._resolveSize(a),n=this._presenceForRender(),l=this._attr("clickable")!==null;this.style.setProperty("--os-ui-avatar-size",`${r}px`);const c=e&&!this._imgFailed?"":this._initialsBg(t),d=e&&!this._imgFailed?f`<img | |
| 9 | + os-bind=${s.bind} | |
| 10 | + os-action=${s.action} | |
| 11 | + value=${s.value} | |
| 12 | + label=${s.label} | |
| 13 | + >${s.segments.map(t=>b`<os-segment value=${t.value}>${t.label}</os-segment>`)}</os-segmented>`}function Os(s,e){const o=s.closest(".os-window")?.querySelector(".os-window__menu-panel")??null;if(!o||e.items.length===0)return null;const i=`${e.prefix}:`,a="data-os-app-menu-section";o.querySelectorAll(`[${a}="${e.prefix}"]`).forEach(d=>d.remove());const n=document.createElement("div");n.className="os-app__menu-section",n.setAttribute("role","presentation"),n.setAttribute(a,e.prefix),n.textContent=e.section,o.appendChild(n);const r=new Map;for(const d of e.items){const p=document.createElement("os-menu-item");p.setAttribute("role","menuitemcheckbox"),p.setAttribute("value",i+d.key),p.setAttribute(a,e.prefix),p.classList.add("os-window__menu-item","os-app__menu-item"),p.textContent=d.label||d.key,o.appendChild(p),r.set(d.key,p)}const l=()=>{for(const[d,p]of r)e.isChecked(d)?p.setAttribute("checked",""):p.removeAttribute("checked")};l();const c=d=>{const p=d.detail?.value;if(typeof p!="string"||!p.startsWith(i))return;const g=p.slice(i.length);r.has(g)&&(e.onToggle(g),l())};return o.addEventListener("os-menu-item-click",c),{refresh:l,dispose:()=>{o.removeEventListener("os-menu-item-click",c),n.remove();for(const d of r.values())d.remove();r.clear()}}}function qs(s,e=null){const t=e??(typeof document<"u"?document.documentElement:null);if(!!t&&Ue(t)){s.hasAttribute("stacked")||s.setAttribute("stacked","");const a=s.getAttribute("sticky-columns");return a!==null&&(s.setAttribute("data-os-sticky-columns",a),s.removeAttribute("sticky-columns")),!0}s.hasAttribute("stacked")&&s.removeAttribute("stacked");const i=s.getAttribute("data-os-sticky-columns");return i!==null&&(s.setAttribute("sticky-columns",i),s.removeAttribute("data-os-sticky-columns")),!1}function Ct(s){return Array.from(s.selection??[],String)}function Ds(){let s=null,e=!1,t=null,o=null;return{invalidateColumns(){s=null},invalidateData(){o=null},sync(i){const a={phone:!1,columnsChanged:!1,dataChanged:!1,selectionChanged:!1},n=i.table;if(!n)return a;const r=i.rowId??(c=>c.id),l=qs(n);if(a.phone=l,l!==s&&(s=l,n.columns=i.columns(l),a.columnsChanged=!0),e||(e=!0,i.wire?.(n)),i.listKey!==t&&(t=i.listKey,Ct(n).length>0&&(n.clearSelection(),a.selectionChanged=!0,i.onSelection?.([]))),i.fingerprint!==o){o=i.fingerprint,n.data=i.rows,a.dataChanged=!0;const c=new Set(i.rows.map(g=>String(r(g)))),d=Ct(n),p=d.filter(g=>c.has(g));p.length!==d.length&&(n.selection=p,a.selectionChanged=!0,i.onSelection?.(p))}return a}}}function Hs(s,e){const t=e.local??{},o={id:s,hasLocal:n=>Object.prototype.hasOwnProperty.call(t,n),runLocal:(n,r,l,c)=>{const d=t[n];if(!d)return r;const p={...r},g=d(p,l,c);return g===void 0?p:g},render:n=>{Z(e.view(n),n.root),e.updated?.(n)},mounted:n=>e.mounted?.(n)},{placeholder:i}=e;i&&(o.placeholder=n=>i(n));const a=window;return(a.openStationApps??(a.openStationApps={}))[s]=o,o}const Fs=250,St=window.location.origin;let At=0;function Us(s,{timeoutMs:e=Fs}={}){const t=s?.contentWindow;if(!t)return Promise.resolve(!1);At+=1;const o=`os-unsaved-guard-${Date.now()}-${At}`;return new Promise(i=>{let a=null,n=!1;const r=c=>{n||(n=!0,window.removeEventListener("message",l),a!==null&&window.clearTimeout(a),i(c))},l=c=>{if(c.origin!==St)return;const d=c?.data;!d||typeof d!="object"||d.type!=="os-bridge-beforeunload-response"||d.requestId!==o||r(d.prevent===!0)};window.addEventListener("message",l),a=window.setTimeout(()=>r(!1),e);try{t.postMessage({type:"os-bridge-beforeunload-query",requestId:o},St)}catch{r(!1)}})}class Vs extends Error{constructor(e,t){super(e||t.serverMessage||`HTTP ${t.status}`),this.name="RestError",this.status=t.status,this.code=t.code,this.data=t.data,this.serverMessage=t.serverMessage??""}}function Et(s){return s instanceof Vs}const Ws="rest_cookie_invalid_nonce",zt=()=>u("Could not reach the site. Check your connection and try again.","desktop-mode");function Tt(s){return typeof navigator<"u"&&navigator.onLine===!1?!0:s instanceof TypeError}function js(s){return Et(s)?s.code===Ws||s.status===401?"session":s.status>=200&&s.status<300?"unreadable":s.status===404?"gone":s.status>=500?"server":s.status>=400?"refused":"unknown":Tt(s)?"offline":"unknown"}function Ks(s){return Et(s)?s.serverMessage:Tt(s)?zt():s instanceof Error?s.message:""}function Bs(s,e){const{fallback:t,lead:o}=e,i=js(s),a=i==="offline"||i==="unreadable"?"warning":"error";let n="",r=!0;switch(i){case"offline":n=zt();break;case"session":n=u("Your session has expired. Reload the page and try again.","desktop-mode");break;case"unreadable":n=u("The site sent an unreadable reply. Reload the page to check whether the change went through.","desktop-mode");break;case"gone":case"refused":case"server":{const c=s;c.serverMessage?n=c.serverMessage:i==="gone"?(n=u("It no longer exists. Reload the page to catch up.","desktop-mode"),r=!1):i==="server"?(n=H(u("The server answered with error %d.","desktop-mode"),c.status),r=!1):(n=H(u("The server refused the request (HTTP %d).","desktop-mode"),c.status),r=!1);break}case"unknown":default:n=Ks(s);break}let l;return o?l=n?`${o}: ${n}`:t:n?r?l=n:l=`${t} ${n}`:l=t,{message:l,reason:n,kind:i,type:a}}function Gs(s,e,t){if(!s)return;const{duration:o,...i}=t,a=Bs(e,i),n={message:a.message,type:a.type};o&&(n.duration=o),s(n)}const Ve=new Map;async function Zs(s){if(!s)return null;let e;try{e=new URL(s,window.location.href)}catch{return s}if(!/gravatar\.com$/i.test(e.hostname))return s;e.searchParams.delete("d"),e.searchParams.delete("s");const t=e.toString(),o=Ve.get(t);if(o!==void 0)return o instanceof Promise,o;const i=new URL(s,window.location.href);i.searchParams.set("d","blank");const a=new Promise(n=>{const r=new Image;r.crossOrigin="anonymous",r.onload=()=>{try{const l=document.createElement("canvas");l.width=1,l.height=1;const c=l.getContext("2d",{willReadFrequently:!0});if(!c){n(s);return}c.drawImage(r,0,0,1,1);const d=c.getImageData(0,0,1,1).data;n(d[3]===0?null:s)}catch{n(s)}},r.onerror=()=>n(null),r.src=i.toString()}).then(n=>(Ve.set(t,n),n));return Ve.set(t,a),a}function Xs(s){return s?.["48"]??s?.["96"]??s?.["24"]??""}function Ys(s,e){e&&Zs(e).then(t=>{s.isConnected&&(t?s.setAttribute("src",t):s.removeAttribute("src"))})}function ae(s){const e=document.createElement("textarea");return e.innerHTML=s,e.value}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(Pt)}connectedCallback(){this._adoptStyles(),this.requestUpdate()}attributeChangedCallback(e,t,o){if(t===o)return;const i=Js(e);this._propValues[i]=o,this.requestUpdate()}get classNames(){return Array.from(this.classList)}set classNames(e){if(e==null){this.removeAttribute("class");return}const o=(Array.isArray(e)?e:String(e).split(/\s+/)).map(i=>String(i).trim()).filter(i=>i!=="");this.className=o.join(" ")}requestUpdate(){this._scheduleRender()}emit(e,t){return this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}_installPropAccessors(){const e=this.constructor;for(const t of e.props){if(Object.getOwnPropertyDescriptor(this,t))continue;const o=Pt(t);Object.defineProperty(this,t,{get:()=>t in this._propValues?this._propValues[t]:this.getAttribute(o),set:i=>{let a;i==null||i===!1?a=null:i===!0?a="":a=String(i),this._propValues[t]=a,a===null?this.removeAttribute(o):this.setAttribute(o,a),this.requestUpdate()},enumerable:!0,configurable:!0})}}_scheduleRender(){this._renderScheduled||!this.isConnected||(this._renderScheduled=!0,queueMicrotask(()=>{this._renderScheduled=!1,this.isConnected&&Z(this.render(),this._renderRoot)}))}_adoptStyles(){const e=this.constructor;if(e.styles.length!==0)if(e.shadow&&this.shadowRoot){const t=e.styles.map(o=>o.sheet).filter(o=>o!==null);if(this.shadowRoot.adoptedStyleSheets=t,t.length!==e.styles.length){for(const o of e.styles)if(!o.sheet){const i=document.createElement("style");i.textContent=o.cssText,this.shadowRoot.appendChild(i)}}}else this._adoptLightStyles(e)}_adoptLightStyles(e){if(!ne._lightStylesAdopted.has(e)){ne._lightStylesAdopted.add(e);for(const t of e.styles){const o=document.createElement("style");o.dataset.osUi=this.tagName.toLowerCase(),o.textContent=t.cssText,document.head.appendChild(o)}}}};ne.props=[],ne.styles=[],ne.shadow=!0,ne._lightStylesAdopted=new WeakSet;let U=ne;function W(s,e){customElements.get(s)||customElements.define(s,e)}function Pt(s){return s.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function Js(s){return s.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}const Qs=(()=>{try{return typeof new CSSStyleSheet().replaceSync=="function"}catch{return!1}})();function R(s,...e){let t=s[0];for(let o=1;o<s.length;o++){const i=e[o-1];if(typeof i=="string"||typeof i=="number")t+=String(i);else if(i&&i.__wpdCss)t+=i.cssText;else throw new TypeError("[os-ui] css`` interpolations must be strings, numbers, or other css`` results. Got: "+typeof i);t+=s[o]}if(Qs){const o=new CSSStyleSheet;return o.replaceSync(t),{__wpdCss:!0,sheet:o,cssText:t}}return{__wpdCss:!0,sheet:null,cssText:t}}function eo(s){const e=[],t=[];let o=null,i=s.parentElement;for(;i&&!(i===document.body||i===document.documentElement);){const n=i.id||"";if(n.startsWith("wp-window-")){o=n.slice(10);break}if(i.tagName.toLowerCase()==="os-tabpanel"){const r=i.getAttribute("for");r&&t.unshift(r)}i=i.parentElement}o&&e.push(We(o));for(const n of t)e.push("tab-"+We(n));const a=s.getAttribute("label");return a&&e.push(We(a)),e.length===0?"os-unnamed":"os-"+e.filter(n=>n!=="").join("-")}function We(s){return s.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Mt(s){if(s.id)return s.id;const e=eo(s);return s.id=e,e}function to(s){if(!s)return 214;let e=5381;for(let t=0;t<s.length;t++)e=Math.imul(e,33)+s.charCodeAt(t);return(e%360+360)%360}const so=R`:host{display:inline-flex;position:relative;width:var( --os-ui-avatar-size,32px );height:var( --os-ui-avatar-size,32px );flex:0 0 auto;vertical-align:middle;line-height:0;perspective:calc( var( --os-ui-avatar-size,32px ) * 8 );--os-ui-avatar-tilt-x:0deg;--os-ui-avatar-tilt-y:0deg;--os-ui-avatar-hover:0;--os-ui-avatar-glare-x:50%;--os-ui-avatar-glare-y:50%}:host( [ hidden ] ){display:none}.os-avatar__tile{position:relative;width:100%;height:100%;border-radius:50%;overflow:hidden;background:var( --os-window-bg,#f0f0f1 );color:var( --os-ui-fg-on-accent,#fff );display:flex;align-items:center;justify-content:center;font-weight:700;font-size:calc( var( --os-ui-avatar-size,32px ) * 0.48 );line-height:1;letter-spacing:0;font-feature-settings:'tnum' 1;user-select:none;transform-style:preserve-3d;transform:rotateX( var( --os-ui-avatar-tilt-x ) ) rotateY( var( --os-ui-avatar-tilt-y ) ) scale( calc( 1 + var( --os-ui-avatar-hover ) * 0.07 ) );transition:transform 220ms cubic-bezier( 0.2,0.8,0.2,1 ),box-shadow 220ms cubic-bezier( 0.2,0.8,0.2,1 );box-shadow:inset 0 0 0 1px rgba( 255,255,255,calc( 0.18 + 0.22 * var( --os-ui-avatar-hover ) ) ),inset 0 0 0 calc( 1px + var( --os-ui-avatar-hover ) * 1px ) rgba( 0,0,0,calc( 0.08 + 0.04 * var( --os-ui-avatar-hover ) ) ),0 calc( 1px + var( --os-ui-avatar-hover ) * 8px ) calc( 6px + var( --os-ui-avatar-hover ) * 18px ) rgba( 0,0,0,calc( 0.08 + 0.18 * var( --os-ui-avatar-hover ) ) )}.os-avatar__tile::after{content:'';position:absolute;inset:0;border-radius:50%;background:radial-gradient( circle at var( --os-ui-avatar-glare-x ) var( --os-ui-avatar-glare-y ),var( --os-ui-scrim,rgba( 255,255,255,0.55 ) ) 0%,var( --os-ui-hover,rgba( 255,255,255,0 ) ) 55% );opacity:var( --os-ui-avatar-hover );mix-blend-mode:overlay;pointer-events:none;transition:opacity 220ms cubic-bezier( 0.2,0.8,0.2,1 )}.os-avatar__tile::before{content:'';position:absolute;inset:calc( var( --os-ui-avatar-hover ) * -3px );border-radius:50%;background:radial-gradient( circle at var( --os-ui-avatar-glare-x ) var( --os-ui-avatar-glare-y ),color-mix( in srgb,var( --os-ui-avatar-halo,rgb( 99,102,241 ) ) calc( 35% * var( --os-ui-avatar-hover ) ),transparent ) 0%,transparent 70% );filter:blur( 4px );pointer-events:none;z-index:-1;transition:inset 220ms cubic-bezier( 0.2,0.8,0.2,1 ),background 220ms}.os-avatar__tile img{width:calc( 100% + 2px );height:calc( 100% + 2px );margin:-1px;object-fit:cover;display:block;transform:translateZ( 1px )}.os-avatar__dot{position:absolute;bottom:0;inset-inline-end:0;width:calc( var( --os-ui-avatar-size,32px ) * 0.32 );height:calc( var( --os-ui-avatar-size,32px ) * 0.32 );min-width:8px;min-height:8px;border-radius:50%;box-sizing:border-box;border:2px solid var( --os-ui-avatar-dot-ring,var( --os-window-bg,#fff ) );background:var( --os-ui-avatar-dot-color,transparent );z-index:2}.os-avatar__dot--online{background:var( --os-ui-success-fg,#00a32a )}.os-avatar__dot--online::after{content:'';position:absolute;inset:-2px;border-radius:50%;border:1px solid var( --os-ui-success-fg,#00a32a );animation:os-avatar-presence 6s var( --os-ui-ease-out,cubic-bezier( 0.22,0.9,0.28,1 ) ) infinite;pointer-events:none}@keyframes os-avatar-presence{0%{opacity:0.6;transform:scale( 1 )}20%{opacity:0;transform:scale( 2.2 )}100%{opacity:0;transform:scale( 2.2 )}}.os-avatar__dot--inactive{background:var( --os-ui-warning-fg,#dba617 )}.os-avatar__dot--offline{background:var( --os-ui-fg-muted,#8c8f94 )}@media ( prefers-reduced-motion:reduce ){.os-avatar__dot--online::after{animation:none;opacity:0.6}.os-avatar__tile{transform:none;transition:box-shadow 200ms}.os-avatar__tile::after,.os-avatar__tile::before{display:none}}`,Lt={xs:20,sm:24,md:40,lg:64,xl:96},Rt=new Set(["online","inactive","offline"]),me=class me extends U{constructor(){super(...arguments),this._presenceHandler=null,this._imgFailed=!1,this._onPointerMove=null,this._onPointerEnter=null,this._onPointerLeave=null,this._tiltRaf=0,this._pendingTiltX="0deg",this._pendingTiltY="0deg",this._pendingGlareX="50%",this._pendingGlareY="50%"}connectedCallback(){super.connectedCallback(),this._maybeAttachPresenceListener(),this._attachHoverEffect()}disconnectedCallback(){this._presenceHandler&&(document.removeEventListener("os-presence-changed",this._presenceHandler),this._presenceHandler=null),this._detachHoverEffect()}attributeChangedCallback(e,t,o){super.attributeChangedCallback(e,t,o),e==="src"&&(this._imgFailed=!1),(e==="user-id"||e==="presence")&&this._maybeAttachPresenceListener()}render(){const e=this._attr("src"),t=this._attr("name")||"",o=this._attr("alt"),i=o!==null?o:t,a=this._attr("size"),n=this._resolveSize(a),r=this._presenceForRender(),l=this._attr("clickable")!==null;this.style.setProperty("--os-ui-avatar-size",`${n}px`);const c=e&&!this._imgFailed?"":this._initialsBg(t),d=e&&!this._imgFailed?b`<img | |
| 47 | 14 | src=${e} |
| 48 | - alt=${s} | |
| 15 | + alt=${i} | |
| 49 | 16 | @error=${()=>this._onImgError()} |
| 50 | 17 | loading="lazy" |
| 51 | - />`:this._initials(t),u=n?f`<span | |
| 52 | - class=${`os-avatar__dot os-avatar__dot--${n}`} | |
| 53 | - aria-label=${this._presenceLabel(n)} | |
| 54 | - ></span>`:f``;return l?f` | |
| 18 | + />`:this._initials(t),p=r?b`<span | |
| 19 | + class=${`os-avatar__dot os-avatar__dot--${r}`} | |
| 20 | + aria-label=${this._presenceLabel(r)} | |
| 21 | + ></span>`:b``;return l?b` | |
| 55 | 22 | <button |
| 56 | 23 | type="button" |
| 57 | 24 | class="os-avatar__tile" |
| 58 | - aria-label=${s||"User"} | |
| 25 | + aria-label=${i||"User"} | |
| 59 | 26 | style=${c?`background:${c};`:""} |
| 60 | - @click=${h=>this._onClick(h)} | |
| 27 | + @click=${g=>this._onClick(g)} | |
| 61 | 28 | >${d}</button> |
| 62 | - ${u} | |
| 63 | - `:f` | |
| 29 | + ${p} | |
| 30 | + `:b` | |
| 64 | 31 | <div |
| 65 | 32 | class="os-avatar__tile" |
| 66 | 33 | role="img" |
| 67 | - aria-label=${s||"User"} | |
| 34 | + aria-label=${i||"User"} | |
| 68 | 35 | style=${c?`background:${c};`:""} |
| 69 | 36 | >${d}</div> |
| 70 | - ${u} | |
| 71 | - `}_attr(e){return this.getAttribute(e)}_resolveSize(e){if(!e)return 32;if(e in Ie)return Ie[e];const t=Number(e);return Number.isFinite(t)&&t>0?t:32}_initials(e){const t=e.trim();return t?Array.from(t)[0]?.toUpperCase()??"?":"?"}_initialsBg(e){const t=It(e);return`linear-gradient(135deg, hsl(${t} 62% 55%), hsl(${(t+24)%360} 58% 42%))`}_presenceForRender(){const e=this._attr("presence");return e&&Ne.has(e)?e:null}_presenceLabel(e){switch(e){case"online":return"Online";case"inactive":return"Inactive";case"offline":return"Offline"}}_onImgError(){this._imgFailed=!0,this.requestUpdate()}_onClick(e){const t=this._attr("user-id"),o={userId:t!==null&&Number(t)||null,originalEvent:e};this.emit("os-avatar-click",o)}_attachHoverEffect(){typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches||(this._onPointerEnter=()=>{this.style.setProperty("--os-ui-avatar-hover","1")},this._onPointerLeave=()=>{this.style.setProperty("--os-ui-avatar-hover","0"),this._pendingTiltX="0deg",this._pendingTiltY="0deg",this._pendingGlareX="50%",this._pendingGlareY="50%",this._flushTilt()},this._onPointerMove=t=>{const o=this.getBoundingClientRect();if(o.width===0||o.height===0)return;const s=(t.clientX-o.left)/o.width-.5,a=(t.clientY-o.top)/o.height-.5,r=14;this._pendingTiltY=`${(s*r).toFixed(2)}deg`,this._pendingTiltX=`${(-a*r).toFixed(2)}deg`;const n=Math.max(0,Math.min(100,(s+.5)*100)),l=Math.max(0,Math.min(100,(a+.5)*100));this._pendingGlareX=`${n.toFixed(1)}%`,this._pendingGlareY=`${l.toFixed(1)}%`,this._tiltRaf||(this._tiltRaf=requestAnimationFrame(()=>this._flushTilt()))},this.addEventListener("pointerenter",this._onPointerEnter),this.addEventListener("pointerleave",this._onPointerLeave),this.addEventListener("pointermove",this._onPointerMove))}_flushTilt(){this._tiltRaf=0,this.style.setProperty("--os-ui-avatar-tilt-x",this._pendingTiltX),this.style.setProperty("--os-ui-avatar-tilt-y",this._pendingTiltY),this.style.setProperty("--os-ui-avatar-glare-x",this._pendingGlareX),this.style.setProperty("--os-ui-avatar-glare-y",this._pendingGlareY)}_detachHoverEffect(){this._onPointerMove&&(this.removeEventListener("pointermove",this._onPointerMove),this._onPointerMove=null),this._onPointerEnter&&(this.removeEventListener("pointerenter",this._onPointerEnter),this._onPointerEnter=null),this._onPointerLeave&&(this.removeEventListener("pointerleave",this._onPointerLeave),this._onPointerLeave=null),this._tiltRaf&&(cancelAnimationFrame(this._tiltRaf),this._tiltRaf=0)}_maybeAttachPresenceListener(){const e=this._attr("user-id"),t=this._attr("presence"),o=!!e&&!t;o&&!this._presenceHandler?(this._presenceHandler=s=>{const a=s.detail;a&&String(a.userId)===String(e)&&a.newStatus&&Ne.has(a.newStatus)&&this.setAttribute("presence",a.newStatus)},document.addEventListener("os-presence-changed",this._presenceHandler)):!o&&this._presenceHandler&&(document.removeEventListener("os-presence-changed",this._presenceHandler),this._presenceHandler=null)}};F.props=["src","alt","name","size","presence","userId","clickable"],F.styles=[Nt],F.help=void 0;let ue=F;S("os-avatar",ue);const Ot=x`:host{display:inline;color:inherit;font:inherit}`,J=new Set;let O=null;const Dt=3e4;function Ht(){O===null&&(O=window.setInterval(()=>{for(const i of J)i.tick()},Dt))}function qt(){O!==null&&J.size===0&&(window.clearInterval(O),O=null)}function Ft(i){if(!i)return null;const e=t=>{const o=new Date(t);return Number.isNaN(o.getTime())?null:o};return Vt(i)?e(i):e(i.replace(" ","T")+"Z")}function Vt(i){const e=Math.max(i.indexOf("T"),i.indexOf(" ")),t=e===-1?"":i.slice(e+1);return/(?:[Zz]|[+-]\d{2}:?\d{2})$/.test(t)}let he=null,pe=null;function Oe(){return typeof navigator<"u"&&navigator.language||"en"}function Ut(){return he||(he=new Intl.RelativeTimeFormat(Oe(),{numeric:"auto"})),he}function De(){return pe||(pe=new Intl.RelativeTimeFormat(Oe(),{numeric:"always",style:"narrow"})),pe}function jt(i,e){const t=Ut(),o=i.getTime()-e,s=Math.round(o/1e3),a=Math.abs;return a(s)<45?t.format(0,"second"):He(t,s)}function He(i,e){const t=Math.abs,o=Math.round(e/60);if(t(o)<45)return i.format(o,"minute");const s=Math.round(o/60);if(t(s)<22)return i.format(s,"hour");const a=Math.round(s/24);if(t(a)<26)return i.format(a,"day");const r=Math.round(a/30);if(t(r)<11)return i.format(r,"month");const n=Math.round(a/365);return i.format(n,"year")}function Wt(i,e){const t=Math.round((i.getTime()-e)/1e3),o=Math.abs;return o(t)<45?De().format(0,"second"):o(t)>604800?i.toLocaleDateString(void 0,{month:"short",day:"numeric"}):He(De(),t)}const V=class V extends k{connectedCallback(){super.connectedCallback(),J.add(this),Ht()}disconnectedCallback(){J.delete(this),qt()}tick(){this.requestUpdate()}render(){const e=this.datetime,t=Ft(e);if(!t)return f`<span>${e??""}</span>`;const o=Date.now(),s=this.hasAttribute("compact")?Wt(t,o):jt(t,o),a=t.toLocaleString();return f`<time datetime=${t.toISOString()} title=${a} | |
| 72 | - >${s}</time | |
| 73 | - >`}};V.props=["datetime","compact"],V.styles=[Ot],V.help=void 0;let fe=V;S("os-relative-time",fe);function A(i,e,t,o){const s=`${e}|${t}`,a=i.get(s);if(a)return a;const r=o();return i.set(s,r),r}const Kt={publish:p("Published"),future:p("Scheduled"),draft:p("Draft"),pending:p("Pending"),private:p("Private"),trash:p("Trash")};function Bt(i){switch(i){case"publish":return{bg:"#e6f4ea",fg:"#1d6f42"};case"draft":return{bg:"#fdecea",fg:"#a02622"};case"pending":return{bg:"#fef7e0",fg:"#8a6d00"};case"private":return{bg:"#e8f0fe",fg:"#1a52a8"};case"future":return{bg:"#ede7f6",fg:"#5b3aa0"};default:return{bg:"#f1f1f2",fg:"#50575e"}}}function Gt(i,e){const t=i.editPostUrlBase??"",o=t.includes("?")?"&":"?";return`${t}${o}post=${e}&action=edit`}function Zt(i){const e=i._embedded?.author?.[0];return e?{id:e.id,name:e.name,avatar:Tt(e.avatar_urls)||void 0}:{id:i.author,name:p("Unknown")}}function Xt(i){const e=i._embedded?.["wp:featuredmedia"]?.[0];if(!e)return null;const t=e.media_details?.sizes??{};return{url:t.thumbnail?.source_url??t.medium?.source_url??e.source_url,alt:e.alt_text??""}}function qe(i){return Le(i.title.rendered)}function ee(i,e,t={}){const o=document.createElement("span");o.style.cssText=["display:inline-flex","align-items:center","gap:4px","padding:2px 8px","border-radius:10px","font-size:11px","font-weight:600",t.uppercase?"text-transform:uppercase;letter-spacing:0.04em":"",`background:${e.bg}`,`color:${e.fg}`,"white-space:nowrap","flex-shrink:0"].filter(Boolean).join(";"),t.icon&&o.appendChild(t.icon);const s=document.createElement("span");return s.textContent=i,o.appendChild(s),t.title&&(o.title=t.title),o}function Fe(i,e=13){const t=document.createElement("span");return t.className=`dashicons ${i}`,t.setAttribute("aria-hidden","true"),t.style.cssText=`font-size:${e}px;width:${e}px;height:${e}px;line-height:1;`,t}function Yt(){const i=document.createElement("span");return i.setAttribute("aria-hidden","true"),i.style.cssText="font-family:dashicons;font-size:14px;line-height:1;display:inline-block;speak:none;-webkit-font-smoothing:antialiased",i.textContent="",i}function Ve(i){i.addEventListener("mouseenter",()=>{i.style.textDecoration="underline"}),i.addEventListener("mouseleave",()=>{i.style.textDecoration="none"})}function Qt(i,e){const t=document.createElement("span");t.style.cssText="display:flex;flex-direction:column;gap:4px;min-width:0;";const o=document.createElement("span");o.style.cssText="display:flex;align-items:center;gap:8px;min-width:0;";const s=document.createElement("a");s.href=Gt(e.extra,i.id),s.setAttribute("data-noclick","");const a=qe(i)||p("(no title)");s.textContent=a,s.title=a,s.style.cssText="font-weight:600;color:inherit;text-decoration:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:340px;",Ve(s),s.addEventListener("click",l=>{l.preventDefault(),l.stopPropagation(),e.openUrl(s.href,a,"dashicons-admin-post")}),o.appendChild(s);const r=i.openstation_lock??null;r&&o.appendChild(ee(r.userName,{fg:"#b32d2e",bg:"rgba(179, 45, 46, 0.1)"},{icon:Yt(),title:P(p("%s is currently editing"),r.userName)}));const n=e.extra.mode==="pages";if(n&&typeof e.extra.frontPageId=="number"&&e.extra.frontPageId===i.id&&o.appendChild(ee(p("Front page"),{fg:"#0a4b78",bg:"rgba(34,113,177,0.12)"},{icon:Fe("dashicons-admin-home")})),n&&typeof e.extra.postsPageId=="number"&&e.extra.postsPageId===i.id&&o.appendChild(ee(p("Posts page"),{fg:"#5b3aa0",bg:"rgba(91,58,160,0.12)"},{icon:Fe("dashicons-admin-post")})),i.status&&i.status!=="publish"&&o.appendChild(ee(Kt[i.status]??i.status,Bt(i.status),{uppercase:!0})),n&&typeof i.link=="string"&&i.link&&i.status==="publish"){const l=document.createElement("a");l.href=i.link,l.target="_blank",l.rel="noreferrer noopener",l.textContent=p("View"),l.title=i.link,l.setAttribute("data-noclick",""),l.style.cssText="font-size:11px;color:var(--wp-admin-theme-color, #2271b1);text-decoration:none;flex-shrink:0;",l.addEventListener("click",c=>c.stopPropagation()),Ve(l),o.appendChild(l)}return t.appendChild(o),t}function Jt(i){const e=Zt(i),t=document.createElement("span");t.style.cssText="display:inline-flex;align-items:center;gap:8px;min-width:0;";const o=document.createElement("os-avatar");o.setAttribute("size","24"),e.name&&o.setAttribute("name",e.name),e.id>0&&o.setAttribute("user-id",String(e.id)),e.avatar&&Rt(o,e.avatar),t.appendChild(o);const s=document.createElement("span");return s.textContent=e.name,s.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;",t.appendChild(s),t}function eo(i){const e=document.createElement("span");e.style.cssText="display:flex;flex-direction:column;line-height:1.2;";const t=document.createElement("os-relative-time");if(t.setAttribute("datetime",i.date_gmt||i.date),e.appendChild(t),i.modified_gmt&&i.modified_gmt!==i.date_gmt){const o=document.createElement("span");o.textContent=p("modified"),o.style.cssText="font-size:11px;color:#646970;",e.appendChild(o)}return e}function to(i){const e=document.createElement("div");e.style.cssText="display:flex;gap:16px;padding:12px 16px;background:#fafafa;align-items:flex-start;";const t=Xt(i);if(t){const n=document.createElement("img");n.src=t.url,n.alt=t.alt,n.loading="lazy",n.style.cssText="width:96px;height:96px;border-radius:6px;object-fit:cover;flex-shrink:0;",e.appendChild(n)}const o=document.createElement("div");o.style.cssText="flex:1;min-width:0;display:flex;flex-direction:column;gap:6px;";const s=document.createElement("div");s.style.cssText="font-size:13px;color:#646970;text-transform:uppercase;letter-spacing:0.04em;",s.textContent=p("Excerpt"),o.appendChild(s);const a=document.createElement("div");a.style.cssText="color:#1d2327;line-height:1.5;";const r=i.excerpt?.rendered??"";return r?a.textContent=Le(r.replace(/<[^>]+>/g,"").trim())||p("(no excerpt)"):(a.textContent=p("(no excerpt)"),a.style.color="#a7aaad"),o.appendChild(a),e.appendChild(o),e}const Ue={close:{a:'fill="currentColor"',b:'<path d="m13.06 12 6.47-6.47-1.06-1.06L12 10.94 5.53 4.47 4.47 5.53 10.94 12l-6.47 6.47 1.06 1.06L12 13.06l6.47 6.47 1.06-1.06L13.06 12Z" />'},check:{a:'fill="currentColor"',b:'<path d="M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z" />'},"chevron-right":{a:'fill="currentColor"',b:'<path d="M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" />'},"arrow-up-right":{a:'fill="currentColor"',b:'<path d="M10 6H18V14H16.5V8.5L7 18L6 17L15.5 7.5H10V6Z" />'},plus:{a:'fill="currentColor"',b:'<path d="M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" />'},search:{a:'fill="currentColor"',b:'<path d="M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z" />'},pin:{a:'fill="currentColor"',b:'<path d="m21.5 9.1-6.6-6.6-4.2 5.6c-1.2-.1-2.4.1-3.6.7-.1 0-.1.1-.2.1-.5.3-.9.6-1.2.9l3.7 3.7-5.7 5.7v1.1h1.1l5.7-5.7 3.7 3.7c.4-.4.7-.8.9-1.2.1-.1.1-.2.2-.3.6-1.1.8-2.4.6-3.6l5.6-4.1zm-7.3 3.5.1.9c.1.9 0 1.8-.4 2.6l-6-6c.8-.4 1.7-.5 2.6-.4l.9.1L15 4.9 19.1 9l-4.9 3.6z" />'},trash:{a:'fill="currentColor"',b:'<path fill-rule="evenodd" clip-rule="evenodd" d="M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z" />'},download:{a:'fill="currentColor"',b:'<path d="M18 11.3l-1-1.1-4 4V3h-1.5v11.3L7 10.2l-1 1.1 6.2 5.8 5.8-5.8zm.5 3.7v3.5h-13V15H4v5h16v-5h-1.5z" />'},settings:{a:'fill="currentColor"',b:'<path d="m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z" /><path d="m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z" />'},info:{a:'fill="currentColor"',b:'<path fill-rule="evenodd" clip-rule="evenodd" d="M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm.75 4v1.5h-1.5V8h1.5Zm0 8v-5h-1.5v5h1.5Z" />'},bell:{a:'fill="currentColor"',b:'<path fill-rule="evenodd" clip-rule="evenodd" d="M17 11.5c0 1.353.17 2.368.976 3 .266.209.602.376 1.024.5v1H5v-1c.422-.124.757-.291 1.024-.5.806-.632.976-1.647.976-3V9c0-2.8 2.2-5 5-5s5 2.2 5 5v2.5ZM15.5 9v2.5c0 .93.066 1.98.515 2.897l.053.103H7.932a4.018 4.018 0 0 0 .053-.103c.449-.917.515-1.967.515-2.897V9c0-1.972 1.528-3.5 3.5-3.5s3.5 1.528 3.5 3.5Zm-5.492 9.008c0-.176.023-.346.065-.508h3.854A1.996 1.996 0 0 1 12 20c-1.1 0-1.992-.892-1.992-1.992Z" />'},more:{a:'fill="currentColor"',b:'<path d="M11 13h2v-2h-2v2zm-6 0h2v-2H5v2zm12-2v2h2v-2h-2z" />'},maximize:{a:'fill="currentColor"',b:'<path d="M6 4a2 2 0 0 0-2 2v3h1.5V6a.5.5 0 0 1 .5-.5h3V4H6Zm3 14.5H6a.5.5 0 0 1-.5-.5v-3H4v3a2 2 0 0 0 2 2h3v-1.5Zm6 1.5v-1.5h3a.5.5 0 0 0 .5-.5v-3H20v3a2 2 0 0 1-2 2h-3Zm3-16a2 2 0 0 1 2 2v3h-1.5V6a.5.5 0 0 0-.5-.5h-3V4h3Z" />'},edit:{a:'fill="currentColor"',b:'<path d="m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z" />'},color:{a:'fill="currentColor"',b:'<path d="M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3zm-5.1 7.6c-2.5 0-4.6-2.1-4.6-4.6 0-.3.1-1 .8-2.3.5-.9 1.1-1.9 2-3.1.7-.9 1.3-1.7 1.8-2.3.7.8 1.3 1.6 1.8 2.3.8 1.1 1.5 2.2 2 3.1.7 1.3.8 2 .8 2.3 0 2.5-2.1 4.6-4.6 4.6z" />'},wallpaper:{a:'fill="currentColor"',b:'<path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z" />'},warning:{a:'fill="currentColor"',b:'<path fill-rule="evenodd" clip-rule="evenodd" d="M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm-.75 12v-1.5h1.5V16h-1.5Zm0-8v5h1.5V8h-1.5Z" />'},minimize:{a:'fill="currentColor"',b:'<path d="M5 11.25h14v1.5H5z" />'},window:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="4.125" y="5.4375" width="15.75" height="13.125" rx="1.75"/><path d="M4.125 9.8125h15.75"/><circle cx="7.275" cy="7.625" r="0.7438" fill="currentColor" stroke="none"/>'},windows:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="3.6875" y="8.5" width="11.375" height="10.0625" rx="1.75"/><path d="M3.6875 12h11.375"/><path d="M8.5 8.5V7.1875a1.75 1.75 0 0 1 1.75-1.75h7.875A1.75 1.75 0 0 1 19.875 7.1875v7a1.75 1.75 0 0 1-1.75 1.75h-3.0625"/>'},dock:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="3.25" y="8.5" width="17.5" height="7" rx="3.5"/><circle cx="7.625" cy="12" r="1.0062" fill="currentColor" stroke="none"/><circle cx="12" cy="12" r="1.0062" fill="currentColor" stroke="none"/><circle cx="16.375" cy="12" r="1.0062" fill="currentColor" stroke="none"/>'},spaces:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="3.6875" y="5.4375" width="7.4375" height="7.875" rx="1.75"/><rect x="12.875" y="5.4375" width="7.4375" height="7.875" rx="1.75"/><circle cx="9.375" cy="17.6875" r="0.7875" fill="currentColor" stroke="none"/><circle cx="12" cy="17.6875" r="0.7875" fill="currentColor" stroke="none"/><circle cx="14.625" cy="17.6875" r="0.7875" fill="currentColor" stroke="none"/>'},copilot:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<path d="M10 2.5Q10.9 8.5 17.5 10Q10.9 11.5 10 17.5Q9.1 11.5 2.5 10Q9.1 8.5 10 2.5Z" fill="currentColor" stroke="none"/><path d="M17.9 14Q18.35 17.1 21.5 17.6Q18.35 18.1 17.9 21.2Q17.45 18.1 14.3 17.6Q17.45 17.1 17.9 14Z" fill="currentColor" stroke="none"/>'},snap:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="3.6875" y="5.4375" width="16.625" height="13.125" rx="1.75"/><path d="M12 5.4375v13.125"/><path d="M12 12h8.3125"/>'},command:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<path d="M14.625 6.75v10.5a2.625 2.625 0 1 0 2.625-2.625H6.75a2.625 2.625 0 1 0 2.625 2.625V6.75a2.625 2.625 0 1 0-2.625 2.625h10.5a2.625 2.625 0 1 0-2.625-2.625"/>'},apps:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="4.125" y="4.125" width="6.5625" height="6.5625" rx="1.75"/><rect x="13.3125" y="4.125" width="6.5625" height="6.5625" rx="1.75"/><rect x="4.125" y="13.3125" width="6.5625" height="6.5625" rx="1.75"/><rect x="13.3125" y="13.3125" width="6.5625" height="6.5625" rx="1.75"/>'},widgets:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="3.6875" y="3.6875" width="9.625" height="9.625" rx="1.75"/><rect x="15.0625" y="3.6875" width="5.25" height="5.25" rx="1.75"/><rect x="15.0625" y="10.6875" width="5.25" height="9.625" rx="1.75"/><rect x="3.6875" y="15.0625" width="9.625" height="5.25" rx="1.75"/>'},user:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<circle cx="12" cy="8.9375" r="3.5"/><path d="M5.4375 19.4375a6.5625 6.5625 0 0 1 13.125 0"/>'},lock:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="5.4375" y="10.6875" width="13.125" height="8.75" rx="1.75"/><path d="M8.5 10.6875V8.0625a3.5 3.5 0 0 1 7 0v2.625"/>'}};function je(i){return i.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function oo(i){return Object.prototype.hasOwnProperty.call(Ue,i)?Ue[i]:null}function so(i,e={}){const t=oo(i);if(!t)return"";const{size:o=24,className:s,title:a,rotate:r}=e,n=['xmlns="http://www.w3.org/2000/svg"','viewBox="0 0 24 24"'];o!=null&&n.push(`width="${o}"`,`height="${o}"`),n.push(t.a),s&&n.push(`class="${je(s)}"`),a?n.push('role="img"',`aria-label="${je(a)}"`):n.push('aria-hidden="true"','focusable="false"');const l=r?`<g transform="rotate(${r} 12 12)">${t.b}</g>`:t.b;return`<svg ${n.join(" ")}>${l}</svg>`}function E(i,e={}){const t=so(i,e),o=document.createElement("div");o.innerHTML=t;const s=o.firstElementChild;return s instanceof SVGSVGElement?s:document.createElementNS("http://www.w3.org/2000/svg","svg")}const io=x`:host{display:flex;width:100%;min-width:0;max-width:100%;align-items:stretch}.os-cat{display:flex;flex-direction:column;align-items:stretch;gap:4px;padding:var( --os-ui-cat-padding,2px );min-height:24px;max-width:100%;width:100%}.os-cat__chips{display:inline-flex;flex-wrap:wrap;align-items:center;gap:var( --os-ui-cat-gap,4px );min-width:0}.os-cat__chains{display:flex;flex-wrap:wrap;gap:4px;min-width:0}.os-cat__viz-host{display:flex;align-items:center;gap:4px;min-width:0;flex:1 1 auto;max-width:100%;min-height:28px;cursor:pointer;position:relative}.os-cat__viz-svg{display:block;width:100%;max-width:100%;min-width:0;overflow:visible;flex:1 1 auto}.os-cat__viz-svg .os-cat-edge{fill:none;stroke:var( --os-ui-cat-edge-color,currentColor );stroke-width:1.25;stroke-linecap:round;opacity:0.55;transition:stroke-width 0.18s ease,opacity 0.18s ease}.os-cat__viz-svg .os-cat-edge[ data-active='true' ]{stroke-width:2;opacity:1}.os-cat__viz-svg .os-cat-node{cursor:pointer;transition:r 0.2s cubic-bezier( 0.34,1.56,0.64,1 ),fill 0.18s ease,stroke-width 0.18s ease,filter 0.18s ease}.os-cat__viz-svg .os-cat-node[ data-selected='true' ]{filter:drop-shadow( 0 0 6px var( --os-ui-cat-node-glow,rgba( 0,0,0,0.18 ) ) )}.os-cat__viz-svg .os-cat-node:hover,.os-cat__viz-svg .os-cat-node:focus-visible{filter:drop-shadow( 0 0 8px var( --os-ui-cat-node-glow,rgba( 0,0,0,0.3 ) ) );outline:none}.os-cat__viz-svg .os-cat-label{font-family:var( --os-ui-font,system-ui,sans-serif );font-size:10.5px;fill:var( --os-ui-cat-label-fg,var( --os-ui-fg,#1d2327 ) );font-weight:500;pointer-events:none;user-select:none}.os-cat__viz-svg .os-cat-label[ data-selected='false' ]{fill:var( --os-ui-cat-label-muted,var( --os-ui-fg-muted,#8c8f94 ) );font-weight:400;font-style:italic}.os-cat__trigger{appearance:none;display:inline-flex;align-items:center;gap:4px;padding:1px 8px;min-height:22px;font:inherit;font-size:11px;font-weight:500;line-height:1;color:var( --os-ui-cat-trigger-fg,var( --os-ui-fg-muted,#50575e ) );background:transparent;border:1px dashed var( --os-ui-cat-trigger-border,var( --os-ui-border,#c3c4c7 ) );border-radius:999px;cursor:pointer;transition:background-color 0.12s ease,color 0.12s ease,border-color 0.12s ease}.os-cat__trigger:hover:not(:disabled ){background:var( --os-ui-hover,rgba( 0,0,0,0.04 ) );color:var( --os-ui-cat-trigger-fg-hover,var( --os-ui-fg,#1d2327 ) );border-color:var( --os-ui-cat-trigger-border-hover,var( --os-ui-border-strong,#8c8f94 ) )}.os-cat__trigger:focus-visible{outline:none;border-style:solid;box-shadow:0 0 0 2px var( --wp-admin-theme-color,#2271b1 )}.os-cat__trigger svg{display:block}.os-cat__uncategorized{display:inline-flex;align-items:center;gap:4px;padding:1px 10px;min-height:22px;font-size:11px;font-weight:500;line-height:1.6;color:var( --os-ui-cat-uncat-fg,var( --os-ui-fg-muted,#8c8f94 ) );background:transparent;border:1px dashed var( --os-ui-cat-uncat-border,var( --os-ui-border,#c3c4c7 ) );border-radius:999px;font-style:italic}.os-cat__popover{position:fixed;top:0;left:0;min-width:280px;max-width:360px;max-height:360px;display:flex;flex-direction:column;background:var( --os-ui-cat-pop-bg,var( --os-ui-surface,#fff ) );color:var( --os-ui-cat-pop-fg,var( --os-ui-fg,#1d2327 ) );border:1px solid var( --os-ui-cat-pop-border,var( --os-ui-border,#c3c4c7 ) );border-radius:8px;box-shadow:0 6px 16px rgba( 0,0,0,0.08 ),0 1px 2px rgba( 0,0,0,0.06 );z-index:1000}.os-cat__editor{position:relative;display:inline-flex;align-items:center}.os-cat__search{appearance:none;font:inherit;font-size:13px;padding:8px 12px;border:0;border-bottom:1px solid var( --os-ui-cat-pop-divider,var( --os-ui-border,#f0f0f1 ) );background:transparent;color:inherit;outline:none}.os-cat__search:focus{border-bottom-color:var( --wp-admin-theme-color,#2271b1 )}.os-cat__tree{flex:1 1 auto;min-height:0;overflow-y:auto;padding:4px 0}.os-cat__row-block{display:contents}.os-cat__row{display:flex;align-items:center;gap:6px;padding:4px 8px 4px var( --os-ui-cat-row-indent,12px );cursor:pointer;user-select:none;font-size:13px;line-height:1.4;position:relative}.os-cat__row:hover,.os-cat__row[ data-focused='true' ]{background:var( --os-ui-hover,rgba( 0,0,0,0.04 ) )}.os-cat__row[ data-selected='true' ]{color:var( --wp-admin-theme-color,#2271b1 );font-weight:600}.os-cat__row::before{content:'';position:absolute;left:0;top:0;bottom:0;width:var( --os-ui-cat-guide-width,0px );border-left:1px dotted var( --os-ui-cat-guide-color,var( --os-ui-border,rgba( 0,0,0,0.08 ) ) )}.os-cat__expander{display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;border:0;background:transparent;color:inherit;cursor:pointer;flex-shrink:0;opacity:0.65}.os-cat__expander:hover{opacity:1}.os-cat__expander svg{display:block;transition:transform 0.12s ease}.os-cat__row[ data-expanded='true' ] .os-cat__expander svg{transform:rotate( 90deg )}.os-cat__expander--placeholder{visibility:hidden}.os-cat__create-row{display:flex;align-items:center;padding:2px 8px 2px var( --os-ui-cat-row-indent,28px );position:relative}.os-cat__create-row::before{content:'';position:absolute;left:0;top:0;bottom:0;width:var( --os-ui-cat-guide-width,0px );border-left:1px dotted var( --os-ui-cat-guide-color,var( --os-ui-border,rgba( 0,0,0,0.08 ) ) )}.os-cat__create-wrap{display:inline-flex;align-items:center;flex:1 1 auto;min-width:0;gap:4px;padding:1px 1px 1px 0;border:1px solid transparent;border-radius:6px;background:transparent;transition:border-color 0.12s ease,background-color 0.12s ease,box-shadow 0.12s ease}.os-cat__create-wrap:hover{border-color:var( --os-ui-border,rgba( 0,0,0,0.12 ) );background:var( --os-ui-cat-pop-bg,var( --os-ui-surface,#fff ) )}.os-cat__create-wrap:focus-within{border-color:var( --wp-admin-theme-color,#2271b1 );background:var( --os-ui-cat-pop-bg,var( --os-ui-surface,#fff ) );box-shadow:0 0 0 2px color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 15%,transparent )}.os-cat__create-input{flex:1 1 auto;min-width:0;appearance:none;font:inherit;font-size:var( --os-ui-field-font-size-compact,12px );padding:3px 6px;border:0;background:transparent;color:inherit;outline:none}.os-cat__create-input::placeholder{color:var( --os-ui-cat-pop-muted,var( --os-ui-fg-muted,#8c8f94 ) );font-style:italic;opacity:1}.os-cat__create-submit{appearance:none;display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;flex-shrink:0;padding:0;border:0;border-radius:4px;background:transparent;color:var( --os-ui-cat-pop-muted,var( --os-ui-fg-muted,#8c8f94 ) );cursor:pointer;transition:background-color 0.12s ease,color 0.12s ease}.os-cat__create-wrap:focus-within .os-cat__create-submit:not( [ disabled ] ){background:var( --wp-admin-theme-color,#2271b1 );color:var( --os-ui-fg-on-accent,#fff )}.os-cat__create-submit:hover:not( [ disabled ] ){filter:brightness( 1.05 )}.os-cat__create-submit[ disabled ]{cursor:default;opacity:0.5}.os-cat__create-submit svg{display:block}.os-cat__create-spinner{display:inline-block;width:12px;height:12px;margin:0 4px;border-radius:50%;border:2px solid var( --wp-admin-theme-color,#2271b1 );border-top-color:transparent;animation:os-cat-spin 0.8s linear infinite;flex-shrink:0}.os-cat__check{display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex-shrink:0;border:1.5px solid var( --os-ui-cat-check-border,var( --os-ui-border,#8c8f94 ) );border-radius:3px;color:transparent;transition:background-color 0.12s ease,border-color 0.12s ease,color 0.12s ease}.os-cat__row[ data-selected='true' ] .os-cat__check{background:var( --wp-admin-theme-color,#2271b1 );border-color:var( --wp-admin-theme-color,#2271b1 );color:var( --os-ui-fg-on-accent,#fff )}.os-cat__check svg{display:block;width:14px;height:14px}.os-cat__label{min-width:0;flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.os-cat__delete{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;width:18px;height:18px;border:0;border-radius:50%;padding:0;background:transparent;color:var( --os-ui-cat-delete-color,var( --os-ui-danger,#d63638 ) );cursor:pointer;opacity:0;transition:opacity 0.12s ease,background-color 0.12s ease}.os-cat__row:hover .os-cat__delete,.os-cat__row[ data-focused='true' ] .os-cat__delete,.os-cat__delete:focus-visible{opacity:1}.os-cat__delete:hover,.os-cat__delete:focus-visible{background:var( --os-ui-badge-danger-bg,rgba( 214,54,56,0.12 ) )}.os-cat__delete svg{display:block;width:14px;height:14px}.os-cat__match{background:var( --os-ui-search-highlight-bg,rgba( 252,211,77,0.45 ) );border-radius:2px;padding:0 1px}.os-cat__empty,.os-cat__loading{padding:12px;font-size:12px;color:var( --os-ui-cat-pop-muted,var( --os-ui-fg-muted,#646970 ) );text-align:center}.os-cat__loading-spinner{display:inline-block;width:12px;height:12px;border-radius:50%;border:2px solid currentColor;border-top-color:transparent;animation:os-cat-spin 0.8s linear infinite;margin-inline-end:8px;vertical-align:middle}@keyframes os-cat-spin{to{transform:rotate( 360deg )}}.os-cat__footer{padding:8px 12px;font-size:11px;color:var( --os-ui-cat-pop-muted,var( --os-ui-fg-muted,#646970 ) );border-top:1px solid var( --os-ui-cat-pop-divider,var( --os-ui-border,#f0f0f1 ) );border-radius:10px;background:var( --os-ui-cat-pop-footer-bg,var( --os-ui-surface,#fafafb ) );display:flex;align-items:center;gap:6px;line-height:1.4}.os-cat__footer .dashicons{font-size:14px;width:14px;height:14px;flex-shrink:0}:host( [ disabled ] ) .os-cat{opacity:0.6;pointer-events:none}`,te=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 ) )}`,ro=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%}}`,no=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%}}`,ao=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}}`,lo=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}}`,co=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}}`,uo=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%}}`,ho=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}}`,po=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}}`,We=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-fg-on-accent,#fff );border-width:0 2px 2px 0;transform:translate( -50%,-50% ) rotate( 45deg );animation:os-holo-tick 180ms cubic-bezier( 0.3,1.4,0.6,1 )}input[ type='checkbox' ]:indeterminate::after{content:'';position:absolute;inset-inline-start:50%;top:50%;width:8px;height:2px;border:0;border-radius:1px;background:var( --os-ui-fg-on-accent,#fff );transform:translate( -50%,-50% )}input[ type='radio' ]:checked::after{content:'';position:absolute;inset-inline-start:50%;top:50%;width:6px;height:6px;border-radius:50%;background:var( --os-ui-fg-on-accent,#fff );transform:translate( -50%,-50% );animation:os-holo-tick 180ms cubic-bezier( 0.3,1.4,0.6,1 )}input[ type='checkbox' ]:disabled,input[ type='radio' ]:disabled{cursor:not-allowed}@keyframes os-holo-tick{from{opacity:0;transform:translate( -50%,-50% ) rotate( 45deg ) scale( 0.4 )}}@media ( prefers-reduced-motion:reduce ){input[ type='checkbox' ]:checked::after,input[ type='radio' ]:checked::after{animation:none}}`,fo=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` ${te} ${ro} ${no} ${ao} ${lo} ${co} ${uo} ${ho} ${po} ${We} ${fo} `;const go=x` ${te}:host{display:inline-flex;max-width:100%;vertical-align:middle}:host( [ hidden ] ){display:none}.os-chip{display:inline-flex;align-items:center;gap:var( --os-ui-chip-gap,4px );padding:var( --os-ui-chip-padding,2px 8px );border-radius:var( --os-ui-chip-radius,999px );font-size:var( --os-ui-chip-font-size,12px );line-height:var( --os-ui-chip-line-height,1.6 );font-weight:var( --os-ui-chip-font-weight,500 );background:var( --os-ui-chip-bg,var( --os-ui-surface,#f0f0f1 ) );color:var( --os-ui-chip-fg,var( --os-ui-fg,#1d2327 ) );border:var( --os-ui-chip-border,1px solid transparent );max-width:100%;box-sizing:border-box;transition:background-color 0.12s ease,color 0.12s ease,border-color 0.12s ease,transform 0.12s ease,opacity 0.12s ease}:host( [ tone='accent' ] ) .os-chip{background:var( --os-ui-chip-bg,color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 14%,transparent ) );color:var( --os-ui-chip-fg,var( --wp-admin-theme-color,#2271b1 ) )}:host( [ tone='positive' ] ) .os-chip{background:var( --os-ui-chip-bg,rgba( 30,132,73,0.14 ) );color:var( --os-ui-chip-fg,var( --os-ui-success-fg,#1d6f42 ) )}:host( [ tone='warning' ] ) .os-chip{background:var( --os-ui-chip-bg,rgba( 217,119,6,0.18 ) );color:var( --os-ui-chip-fg,var( --os-ui-warning-fg,#8a4a06 ) )}:host( [ tone='danger' ] ) .os-chip{background:var( --os-ui-chip-bg,rgba( 214,54,56,0.14 ) );color:var( --os-ui-chip-fg,var( --os-ui-danger-hover,#a02622 ) )}:host( [ pending ] ) .os-chip{opacity:0.65;animation:os-chip-pulse 1.2s ease-in-out infinite}@keyframes os-chip-pulse{0%,100%{opacity:0.55}50%{opacity:0.95}}.os-chip__label{max-width:var( --os-ui-chip-label-max,220px );overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.os-chip__icon{display:inline-flex;align-items:center;flex-shrink:0}.os-chip__icon::slotted( * ){display:inline-flex}.os-chip__dismiss{appearance:none;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:16px;height:16px;margin-inline-start:2px;padding:0;border:0;border-radius:50%;background:transparent;color:inherit;cursor:pointer;opacity:0.55;transition:opacity 0.12s ease,background-color 0.12s ease}.os-chip__dismiss:hover,.os-chip__dismiss:focus-visible{opacity:1;background:var( --os-ui-hover,rgba( 0,0,0,0.12 ) );outline:none}.os-chip__dismiss:focus-visible{box-shadow:var( --_holo-focus )}.os-chip__dismiss[ disabled ]{opacity:0.35;cursor:not-allowed}.os-chip__dismiss svg{display:block;width:14px;height:14px}:host( [ disabled ] ) .os-chip{opacity:0.55;cursor:not-allowed}:host( [ size='compact' ] ) .os-chip{padding:var( --os-ui-chip-padding,1px 6px );font-size:var( --os-ui-chip-font-size,11px )}:host( [ selected ] ) .os-chip{position:relative;background:var( --os-ui-chip-bg,var( --os-ui-accent-soft,rgba( 34,113,177,0.14 ) ) );color:var( --os-ui-chip-fg,var( --os-ui-fg,#1d2327 ) )}:host( [ selected ] ) .os-chip::after{content:'';position:absolute;inset:0;border-radius:inherit;padding:1px;background-image:var( --_holo-edge );pointer-events:none;-webkit-mask:linear-gradient( #000 0 0 ) content-box,linear-gradient( #000 0 0 );-webkit-mask-composite:xor;mask:linear-gradient( #000 0 0 ) content-box,linear-gradient( #000 0 0 );mask-composite:exclude}`,U=class U extends k{constructor(){super(...arguments),this._onHostKeyDown=e=>{if(this.dismissible!==null&&(e.key==="Backspace"||e.key==="Delete")){if(e.preventDefault(),this.disabled!==null)return;const s=this.label??"";this.emit("os-chip-dismiss",{label:s})}}}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this._onHostKeyDown)}disconnectedCallback(){this.removeEventListener("keydown",this._onHostKeyDown)}render(){const e=this.label??"",t=this.dismissible!==null,o=this.disabled!==null;return f` | |
| 37 | + ${p} | |
| 38 | + `}_attr(e){return this.getAttribute(e)}_resolveSize(e){if(!e)return 32;if(e in Lt)return Lt[e];const t=Number(e);return Number.isFinite(t)&&t>0?t:32}_initials(e){const t=e.trim();return t?Array.from(t)[0]?.toUpperCase()??"?":"?"}_initialsBg(e){const t=to(e);return`linear-gradient(135deg, hsl(${t} 62% 55%), hsl(${(t+24)%360} 58% 42%))`}_presenceForRender(){const e=this._attr("presence");return e&&Rt.has(e)?e:null}_presenceLabel(e){switch(e){case"online":return"Online";case"inactive":return"Inactive";case"offline":return"Offline"}}_onImgError(){this._imgFailed=!0,this.requestUpdate()}_onClick(e){const t=this._attr("user-id"),o={userId:t!==null&&Number(t)||null,originalEvent:e};this.emit("os-avatar-click",o)}_attachHoverEffect(){typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches||(this._onPointerEnter=()=>{this.style.setProperty("--os-ui-avatar-hover","1")},this._onPointerLeave=()=>{this.style.setProperty("--os-ui-avatar-hover","0"),this._pendingTiltX="0deg",this._pendingTiltY="0deg",this._pendingGlareX="50%",this._pendingGlareY="50%",this._flushTilt()},this._onPointerMove=t=>{const o=this.getBoundingClientRect();if(o.width===0||o.height===0)return;const i=(t.clientX-o.left)/o.width-.5,a=(t.clientY-o.top)/o.height-.5,n=14;this._pendingTiltY=`${(i*n).toFixed(2)}deg`,this._pendingTiltX=`${(-a*n).toFixed(2)}deg`;const r=Math.max(0,Math.min(100,(i+.5)*100)),l=Math.max(0,Math.min(100,(a+.5)*100));this._pendingGlareX=`${r.toFixed(1)}%`,this._pendingGlareY=`${l.toFixed(1)}%`,this._tiltRaf||(this._tiltRaf=requestAnimationFrame(()=>this._flushTilt()))},this.addEventListener("pointerenter",this._onPointerEnter),this.addEventListener("pointerleave",this._onPointerLeave),this.addEventListener("pointermove",this._onPointerMove))}_flushTilt(){this._tiltRaf=0,this.style.setProperty("--os-ui-avatar-tilt-x",this._pendingTiltX),this.style.setProperty("--os-ui-avatar-tilt-y",this._pendingTiltY),this.style.setProperty("--os-ui-avatar-glare-x",this._pendingGlareX),this.style.setProperty("--os-ui-avatar-glare-y",this._pendingGlareY)}_detachHoverEffect(){this._onPointerMove&&(this.removeEventListener("pointermove",this._onPointerMove),this._onPointerMove=null),this._onPointerEnter&&(this.removeEventListener("pointerenter",this._onPointerEnter),this._onPointerEnter=null),this._onPointerLeave&&(this.removeEventListener("pointerleave",this._onPointerLeave),this._onPointerLeave=null),this._tiltRaf&&(cancelAnimationFrame(this._tiltRaf),this._tiltRaf=0)}_maybeAttachPresenceListener(){const e=this._attr("user-id"),t=this._attr("presence"),o=!!e&&!t;o&&!this._presenceHandler?(this._presenceHandler=i=>{const a=i.detail;a&&String(a.userId)===String(e)&&a.newStatus&&Rt.has(a.newStatus)&&this.setAttribute("presence",a.newStatus)},document.addEventListener("os-presence-changed",this._presenceHandler)):!o&&this._presenceHandler&&(document.removeEventListener("os-presence-changed",this._presenceHandler),this._presenceHandler=null)}};me.props=["src","alt","name","size","presence","userId","clickable"],me.styles=[so],me.help=void 0;let je=me;W("os-avatar",je);const oo=R`:host{display:inline;color:inherit;font:inherit}`,ze=new Set;let he=null;const io=3e4;function no(){he===null&&(he=window.setInterval(()=>{for(const s of ze)s.tick()},io))}function ao(){he!==null&&ze.size===0&&(window.clearInterval(he),he=null)}function ro(s){if(!s)return null;const e=t=>{const o=new Date(t);return Number.isNaN(o.getTime())?null:o};return lo(s)?e(s):e(s.replace(" ","T")+"Z")}function lo(s){const e=Math.max(s.indexOf("T"),s.indexOf(" ")),t=e===-1?"":s.slice(e+1);return/(?:[Zz]|[+-]\d{2}:?\d{2})$/.test(t)}let Ke=null,Be=null;function It(){return typeof navigator<"u"&&navigator.language||"en"}function co(){return Ke||(Ke=new Intl.RelativeTimeFormat(It(),{numeric:"auto"})),Ke}function Nt(){return Be||(Be=new Intl.RelativeTimeFormat(It(),{numeric:"always",style:"narrow"})),Be}function po(s,e){const t=co(),o=s.getTime()-e,i=Math.round(o/1e3),a=Math.abs;return a(i)<45?t.format(0,"second"):Ot(t,i)}function Ot(s,e){const t=Math.abs,o=Math.round(e/60);if(t(o)<45)return s.format(o,"minute");const i=Math.round(o/60);if(t(i)<22)return s.format(i,"hour");const a=Math.round(i/24);if(t(a)<26)return s.format(a,"day");const n=Math.round(a/30);if(t(n)<11)return s.format(n,"month");const r=Math.round(a/365);return s.format(r,"year")}function uo(s,e){const t=Math.round((s.getTime()-e)/1e3),o=Math.abs;return o(t)<45?Nt().format(0,"second"):o(t)>604800?s.toLocaleDateString(void 0,{month:"short",day:"numeric"}):Ot(Nt(),t)}const be=class be extends U{connectedCallback(){super.connectedCallback(),ze.add(this),no()}disconnectedCallback(){ze.delete(this),ao()}tick(){this.requestUpdate()}render(){const e=this.datetime,t=ro(e);if(!t)return b`<span>${e??""}</span>`;const o=Date.now(),i=this.hasAttribute("compact")?uo(t,o):po(t,o),a=t.toLocaleString();return b`<time datetime=${t.toISOString()} title=${a} | |
| 39 | + >${i}</time | |
| 40 | + >`}};be.props=["datetime","compact"],be.styles=[oo],be.help=void 0;let Ge=be;W("os-relative-time",Ge);function X(s,e,t,o){const i=`${e}|${t}`,a=s.get(i);if(a)return a;const n=o();return s.set(i,n),n}const Ze={publish:u("Published"),future:u("Scheduled"),draft:u("Draft"),pending:u("Pending"),private:u("Private"),trash:u("Trash")};function ho(s){switch(s){case"publish":return{bg:"var(--os-ui-surface-raised, #e6f4ea)",fg:"var(--os-ui-success-fg, #1d6f42)"};case"draft":return{bg:"var(--os-ui-surface-raised, #fdecea)",fg:"var(--os-ui-danger, #a02622)"};case"pending":return{bg:"var(--os-ui-warning-bg, #fef7e0)",fg:"var(--os-ui-warning-fg, #8a6d00)"};case"private":return{bg:"var(--os-ui-info-bg, #e8f0fe)",fg:"var(--os-ui-info-fg, #1a52a8)"};case"future":return{bg:"var(--os-ui-surface-raised, #ede7f6)",fg:"var(--os-ui-accent, #5b3aa0)"};default:return{bg:"var(--os-ui-surface-raised, #f1f1f2)",fg:"var(--os-ui-fg-muted, #50575e)"}}}function Te(s,e){const t=s.editPostUrlBase??"",o=t.includes("?")?"&":"?";return`${t}${o}post=${e}&action=edit`}function Xe(s){const e=s._embedded?.author?.[0];return e?{id:e.id,name:ae(e.name??""),avatar:Xs(e.avatar_urls)||void 0}:{id:s.author,name:u("Unknown")}}function fo(s,e){for(const t of s._embedded?.["wp:term"]??[])if(t.length>0&&t[0].taxonomy===e)return t.map(o=>({id:o.id,name:o.name}));return[]}function Ye(s){const e=s._embedded?.["wp:featuredmedia"]?.[0];if(!e)return null;const t=e.media_details?.sizes??{};return{url:t.thumbnail?.source_url??t.medium?.source_url??e.source_url,alt:e.alt_text??""}}function le(s){return ae(s.title.rendered)}function Pe(s,e,t={}){const o=document.createElement("span");o.style.cssText=["display:inline-flex","align-items:center","gap:4px","padding:2px 8px","border-radius:10px","font-size:11px","font-weight:600",t.uppercase?"text-transform:uppercase;letter-spacing:0.04em":"",`background:${e.bg}`,`color:${e.fg}`,"white-space:nowrap","flex-shrink:0"].filter(Boolean).join(";"),t.icon&&o.appendChild(t.icon);const i=document.createElement("span");return i.textContent=s,o.appendChild(i),t.title&&(o.title=t.title),o}function qt(s,e=13){const t=document.createElement("span");return t.className=`dashicons ${s}`,t.setAttribute("aria-hidden","true"),t.style.cssText=`font-size:${e}px;width:${e}px;height:${e}px;line-height:1;`,t}function go(){const s=document.createElement("span");return s.setAttribute("aria-hidden","true"),s.style.cssText="font-family:dashicons;font-size:14px;line-height:1;display:inline-block;speak:none;-webkit-font-smoothing:antialiased",s.textContent="",s}function Dt(s){s.addEventListener("mouseenter",()=>{s.style.textDecoration="underline"}),s.addEventListener("mouseleave",()=>{s.style.textDecoration="none"})}function mo(s,e){const t=document.createElement("span");t.style.cssText="display:flex;flex-direction:column;gap:4px;min-width:0;";const o=document.createElement("span");o.style.cssText="display:flex;align-items:center;gap:8px;min-width:0;";const i=document.createElement("a");i.href=Te(e.extra,s.id),i.setAttribute("data-noclick","");const a=le(s)||u("(no title)");i.textContent=a,i.title=a,i.style.cssText="font-weight:600;color:inherit;text-decoration:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:340px;",Dt(i),i.addEventListener("click",l=>{l.preventDefault(),l.stopPropagation(),e.openUrl(i.href,a,"dashicons-admin-post")}),o.appendChild(i);const n=s.openstation_lock??null;n&&o.appendChild(Pe(n.userName,{fg:"var(--os-ui-danger, #b32d2e)",bg:"var(--os-ui-surface-raised, rgba(179, 45, 46, 0.1))"},{icon:go(),title:H(u("%s is currently editing"),n.userName)}));const r=e.extra.mode==="pages";if(r&&typeof e.extra.frontPageId=="number"&&e.extra.frontPageId===s.id&&o.appendChild(Pe(u("Front page"),{fg:"var(--os-ui-info-fg, #0a4b78)",bg:"var(--os-ui-info-bg, rgba(34,113,177,0.12))"},{icon:qt("dashicons-admin-home")})),r&&typeof e.extra.postsPageId=="number"&&e.extra.postsPageId===s.id&&o.appendChild(Pe(u("Posts page"),{fg:"var(--os-ui-accent, #5b3aa0)",bg:"var(--os-ui-surface-raised, rgba(91,58,160,0.12))"},{icon:qt("dashicons-admin-post")})),s.status&&s.status!=="publish"&&o.appendChild(Pe(Ze[s.status]??s.status,ho(s.status),{uppercase:!0})),r&&typeof s.link=="string"&&s.link&&s.status==="publish"){const l=document.createElement("a");l.href=s.link,l.target="_blank",l.rel="noreferrer noopener",l.textContent=u("View"),l.title=s.link,l.setAttribute("data-noclick",""),l.style.cssText="font-size:11px;color:var(--wp-admin-theme-color, #2271b1);text-decoration:none;flex-shrink:0;",l.addEventListener("click",c=>c.stopPropagation()),Dt(l),o.appendChild(l)}return t.appendChild(o),t}function bo(s){const e=Xe(s),t=document.createElement("span");t.style.cssText="display:inline-flex;align-items:center;gap:8px;min-width:0;";const o=document.createElement("os-avatar");o.setAttribute("size","24"),e.name&&o.setAttribute("name",e.name),e.id>0&&o.setAttribute("user-id",String(e.id)),e.avatar&&Ys(o,e.avatar),t.appendChild(o);const i=document.createElement("span");return i.textContent=e.name,i.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;",t.appendChild(i),t}function _o(s){const e=document.createElement("span");e.style.cssText="display:flex;flex-direction:column;line-height:1.2;";const t=document.createElement("os-relative-time");if(t.setAttribute("datetime",s.date_gmt||s.date),e.appendChild(t),s.modified_gmt&&s.modified_gmt!==s.date_gmt){const o=document.createElement("span");o.textContent=u("modified"),o.style.cssText="font-size:11px;color:var(--os-ui-fg-muted, #646970);",e.appendChild(o)}return e}function vo(s){const e=document.createElement("div");e.style.cssText="display:flex;gap:16px;padding:12px 16px;background:var(--os-ui-surface-sunken, #fafafa);align-items:flex-start;";const t=Ye(s);if(t){const r=document.createElement("img");r.src=t.url,r.alt=t.alt,r.loading="lazy",r.style.cssText="width:96px;height:96px;border-radius:6px;object-fit:cover;flex-shrink:0;",e.appendChild(r)}const o=document.createElement("div");o.style.cssText="flex:1;min-width:0;display:flex;flex-direction:column;gap:6px;";const i=document.createElement("div");i.style.cssText="font-size:13px;color:var(--os-ui-fg-muted, #646970);text-transform:uppercase;letter-spacing:0.04em;",i.textContent=u("Excerpt"),o.appendChild(i);const a=document.createElement("div");a.style.cssText="color:var(--os-ui-fg, #1d2327);line-height:1.5;";const n=s.excerpt?.rendered??"";return n?a.textContent=ae(n.replace(/<[^>]+>/g,"").trim())||u("(no excerpt)"):(a.textContent=u("(no excerpt)"),a.style.color="var(--os-ui-fg-muted, #a7aaad)"),o.appendChild(a),e.appendChild(o),e}const Ht={close:{a:'fill="currentColor"',b:'<path d="m13.06 12 6.47-6.47-1.06-1.06L12 10.94 5.53 4.47 4.47 5.53 10.94 12l-6.47 6.47 1.06 1.06L12 13.06l6.47 6.47 1.06-1.06L13.06 12Z" />'},check:{a:'fill="currentColor"',b:'<path d="M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z" />'},"chevron-right":{a:'fill="currentColor"',b:'<path d="M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" />'},"arrow-up-right":{a:'fill="currentColor"',b:'<path d="M10 6H18V14H16.5V8.5L7 18L6 17L15.5 7.5H10V6Z" />'},plus:{a:'fill="currentColor"',b:'<path d="M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" />'},search:{a:'fill="currentColor"',b:'<path d="M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z" />'},pin:{a:'fill="currentColor"',b:'<path d="m21.5 9.1-6.6-6.6-4.2 5.6c-1.2-.1-2.4.1-3.6.7-.1 0-.1.1-.2.1-.5.3-.9.6-1.2.9l3.7 3.7-5.7 5.7v1.1h1.1l5.7-5.7 3.7 3.7c.4-.4.7-.8.9-1.2.1-.1.1-.2.2-.3.6-1.1.8-2.4.6-3.6l5.6-4.1zm-7.3 3.5.1.9c.1.9 0 1.8-.4 2.6l-6-6c.8-.4 1.7-.5 2.6-.4l.9.1L15 4.9 19.1 9l-4.9 3.6z" />'},trash:{a:'fill="currentColor"',b:'<path fill-rule="evenodd" clip-rule="evenodd" d="M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z" />'},download:{a:'fill="currentColor"',b:'<path d="M18 11.3l-1-1.1-4 4V3h-1.5v11.3L7 10.2l-1 1.1 6.2 5.8 5.8-5.8zm.5 3.7v3.5h-13V15H4v5h16v-5h-1.5z" />'},settings:{a:'fill="currentColor"',b:'<path d="m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z" /><path d="m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z" />'},info:{a:'fill="currentColor"',b:'<path fill-rule="evenodd" clip-rule="evenodd" d="M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm.75 4v1.5h-1.5V8h1.5Zm0 8v-5h-1.5v5h1.5Z" />'},bell:{a:'fill="currentColor"',b:'<path fill-rule="evenodd" clip-rule="evenodd" d="M17 11.5c0 1.353.17 2.368.976 3 .266.209.602.376 1.024.5v1H5v-1c.422-.124.757-.291 1.024-.5.806-.632.976-1.647.976-3V9c0-2.8 2.2-5 5-5s5 2.2 5 5v2.5ZM15.5 9v2.5c0 .93.066 1.98.515 2.897l.053.103H7.932a4.018 4.018 0 0 0 .053-.103c.449-.917.515-1.967.515-2.897V9c0-1.972 1.528-3.5 3.5-3.5s3.5 1.528 3.5 3.5Zm-5.492 9.008c0-.176.023-.346.065-.508h3.854A1.996 1.996 0 0 1 12 20c-1.1 0-1.992-.892-1.992-1.992Z" />'},more:{a:'fill="currentColor"',b:'<path d="M11 13h2v-2h-2v2zm-6 0h2v-2H5v2zm12-2v2h2v-2h-2z" />'},maximize:{a:'fill="currentColor"',b:'<path d="M6 4a2 2 0 0 0-2 2v3h1.5V6a.5.5 0 0 1 .5-.5h3V4H6Zm3 14.5H6a.5.5 0 0 1-.5-.5v-3H4v3a2 2 0 0 0 2 2h3v-1.5Zm6 1.5v-1.5h3a.5.5 0 0 0 .5-.5v-3H20v3a2 2 0 0 1-2 2h-3Zm3-16a2 2 0 0 1 2 2v3h-1.5V6a.5.5 0 0 0-.5-.5h-3V4h3Z" />'},edit:{a:'fill="currentColor"',b:'<path d="m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z" />'},color:{a:'fill="currentColor"',b:'<path d="M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3zm-5.1 7.6c-2.5 0-4.6-2.1-4.6-4.6 0-.3.1-1 .8-2.3.5-.9 1.1-1.9 2-3.1.7-.9 1.3-1.7 1.8-2.3.7.8 1.3 1.6 1.8 2.3.8 1.1 1.5 2.2 2 3.1.7 1.3.8 2 .8 2.3 0 2.5-2.1 4.6-4.6 4.6z" />'},wallpaper:{a:'fill="currentColor"',b:'<path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z" />'},warning:{a:'fill="currentColor"',b:'<path fill-rule="evenodd" clip-rule="evenodd" d="M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm-.75 12v-1.5h1.5V16h-1.5Zm0-8v5h1.5V8h-1.5Z" />'},minimize:{a:'fill="currentColor"',b:'<path d="M5 11.25h14v1.5H5z" />'},window:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="4.125" y="5.4375" width="15.75" height="13.125" rx="1.75"/><path d="M4.125 9.8125h15.75"/><circle cx="7.275" cy="7.625" r="0.7438" fill="currentColor" stroke="none"/>'},windows:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="3.6875" y="8.5" width="11.375" height="10.0625" rx="1.75"/><path d="M3.6875 12h11.375"/><path d="M8.5 8.5V7.1875a1.75 1.75 0 0 1 1.75-1.75h7.875A1.75 1.75 0 0 1 19.875 7.1875v7a1.75 1.75 0 0 1-1.75 1.75h-3.0625"/>'},dock:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="3.25" y="8.5" width="17.5" height="7" rx="3.5"/><circle cx="7.625" cy="12" r="1.0062" fill="currentColor" stroke="none"/><circle cx="12" cy="12" r="1.0062" fill="currentColor" stroke="none"/><circle cx="16.375" cy="12" r="1.0062" fill="currentColor" stroke="none"/>'},spaces:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="3.6875" y="5.4375" width="7.4375" height="7.875" rx="1.75"/><rect x="12.875" y="5.4375" width="7.4375" height="7.875" rx="1.75"/><circle cx="9.375" cy="17.6875" r="0.7875" fill="currentColor" stroke="none"/><circle cx="12" cy="17.6875" r="0.7875" fill="currentColor" stroke="none"/><circle cx="14.625" cy="17.6875" r="0.7875" fill="currentColor" stroke="none"/>'},copilot:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<path d="M10 2.5Q10.9 8.5 17.5 10Q10.9 11.5 10 17.5Q9.1 11.5 2.5 10Q9.1 8.5 10 2.5Z" fill="currentColor" stroke="none"/><path d="M17.9 14Q18.35 17.1 21.5 17.6Q18.35 18.1 17.9 21.2Q17.45 18.1 14.3 17.6Q17.45 17.1 17.9 14Z" fill="currentColor" stroke="none"/>'},snap:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="3.6875" y="5.4375" width="16.625" height="13.125" rx="1.75"/><path d="M12 5.4375v13.125"/><path d="M12 12h8.3125"/>'},command:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<path d="M14.625 6.75v10.5a2.625 2.625 0 1 0 2.625-2.625H6.75a2.625 2.625 0 1 0 2.625 2.625V6.75a2.625 2.625 0 1 0-2.625 2.625h10.5a2.625 2.625 0 1 0-2.625-2.625"/>'},apps:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="4.125" y="4.125" width="6.5625" height="6.5625" rx="1.75"/><rect x="13.3125" y="4.125" width="6.5625" height="6.5625" rx="1.75"/><rect x="4.125" y="13.3125" width="6.5625" height="6.5625" rx="1.75"/><rect x="13.3125" y="13.3125" width="6.5625" height="6.5625" rx="1.75"/>'},widgets:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="3.6875" y="3.6875" width="9.625" height="9.625" rx="1.75"/><rect x="15.0625" y="3.6875" width="5.25" height="5.25" rx="1.75"/><rect x="15.0625" y="10.6875" width="5.25" height="9.625" rx="1.75"/><rect x="3.6875" y="15.0625" width="9.625" height="5.25" rx="1.75"/>'},user:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<circle cx="12" cy="8.9375" r="3.5"/><path d="M5.4375 19.4375a6.5625 6.5625 0 0 1 13.125 0"/>'},lock:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="5.4375" y="10.6875" width="13.125" height="8.75" rx="1.75"/><path d="M8.5 10.6875V8.0625a3.5 3.5 0 0 1 7 0v2.625"/>'}};function Ft(s){return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function xo(s){return Object.prototype.hasOwnProperty.call(Ht,s)?Ht[s]:null}function yo(s,e={}){const t=xo(s);if(!t)return"";const{size:o=24,className:i,title:a,rotate:n}=e,r=['xmlns="http://www.w3.org/2000/svg"','viewBox="0 0 24 24"'];o!=null&&r.push(`width="${o}"`,`height="${o}"`),r.push(t.a),i&&r.push(`class="${Ft(i)}"`),a?r.push('role="img"',`aria-label="${Ft(a)}"`):r.push('aria-hidden="true"','focusable="false"');const l=n?`<g transform="rotate(${n} 12 12)">${t.b}</g>`:t.b;return`<svg ${r.join(" ")}>${l}</svg>`}function Y(s,e={}){const t=yo(s,e),o=document.createElement("div");o.innerHTML=t;const i=o.firstElementChild;return i instanceof SVGSVGElement?i:document.createElementNS("http://www.w3.org/2000/svg","svg")}const ko=R`:host{display:flex;width:100%;min-width:0;max-width:100%;align-items:stretch}.os-cat{display:flex;flex-direction:column;align-items:stretch;gap:4px;padding:var( --os-ui-cat-padding,2px );min-height:24px;max-width:100%;width:100%}.os-cat__chips{display:inline-flex;flex-wrap:wrap;align-items:center;gap:var( --os-ui-cat-gap,4px );min-width:0}.os-cat__chains{display:flex;flex-wrap:wrap;gap:4px;min-width:0}.os-cat__viz-host{display:flex;align-items:center;gap:4px;min-width:0;flex:1 1 auto;max-width:100%;min-height:28px;cursor:pointer;position:relative}.os-cat__viz-svg{display:block;width:100%;max-width:100%;min-width:0;overflow:visible;flex:1 1 auto}.os-cat__viz-svg .os-cat-edge{fill:none;stroke:var( --os-ui-cat-edge-color,currentColor );stroke-width:1.25;stroke-linecap:round;opacity:0.55;transition:stroke-width 0.18s ease,opacity 0.18s ease}.os-cat__viz-svg .os-cat-edge[ data-active='true' ]{stroke-width:2;opacity:1}.os-cat__viz-svg .os-cat-node{cursor:pointer;transition:r 0.2s cubic-bezier( 0.34,1.56,0.64,1 ),fill 0.18s ease,stroke-width 0.18s ease,filter 0.18s ease}.os-cat__viz-svg .os-cat-node[ data-selected='true' ]{filter:drop-shadow( 0 0 6px var( --os-ui-cat-node-glow,rgba( 0,0,0,0.18 ) ) )}.os-cat__viz-svg .os-cat-node:hover,.os-cat__viz-svg .os-cat-node:focus-visible{filter:drop-shadow( 0 0 8px var( --os-ui-cat-node-glow,rgba( 0,0,0,0.3 ) ) );outline:none}.os-cat__viz-svg .os-cat-label{font-family:var( --os-ui-font,system-ui,sans-serif );font-size:10.5px;fill:var( --os-ui-cat-label-fg,var( --os-ui-fg,#1d2327 ) );font-weight:500;pointer-events:none;user-select:none}.os-cat__viz-svg .os-cat-label[ data-selected='false' ]{fill:var( --os-ui-cat-label-muted,var( --os-ui-fg-muted,#8c8f94 ) );font-weight:400;font-style:italic}.os-cat__trigger{appearance:none;display:inline-flex;align-items:center;gap:4px;padding:1px 8px;min-height:22px;font:inherit;font-size:11px;font-weight:500;line-height:1;color:var( --os-ui-cat-trigger-fg,var( --os-ui-fg-muted,#50575e ) );background:transparent;border:1px dashed var( --os-ui-cat-trigger-border,var( --os-ui-border,#c3c4c7 ) );border-radius:999px;cursor:pointer;transition:background-color 0.12s ease,color 0.12s ease,border-color 0.12s ease}.os-cat__trigger:hover:not(:disabled ){background:var( --os-ui-hover,rgba( 0,0,0,0.04 ) );color:var( --os-ui-cat-trigger-fg-hover,var( --os-ui-fg,#1d2327 ) );border-color:var( --os-ui-cat-trigger-border-hover,var( --os-ui-border-strong,#8c8f94 ) )}.os-cat__trigger:focus-visible{outline:none;border-style:solid;box-shadow:0 0 0 2px var( --wp-admin-theme-color,#2271b1 )}.os-cat__trigger svg{display:block}.os-cat__uncategorized{display:inline-flex;align-items:center;gap:4px;padding:1px 10px;min-height:22px;font-size:11px;font-weight:500;line-height:1.6;color:var( --os-ui-cat-uncat-fg,var( --os-ui-fg-muted,#8c8f94 ) );background:transparent;border:1px dashed var( --os-ui-cat-uncat-border,var( --os-ui-border,#c3c4c7 ) );border-radius:999px;font-style:italic}.os-cat__popover{position:fixed;top:0;left:0;min-width:280px;max-width:360px;max-height:360px;display:flex;flex-direction:column;background:var( --os-ui-cat-pop-bg,var( --os-ui-surface,#fff ) );color:var( --os-ui-cat-pop-fg,var( --os-ui-fg,#1d2327 ) );border:1px solid var( --os-ui-cat-pop-border,var( --os-ui-border,#c3c4c7 ) );border-radius:8px;box-shadow:0 6px 16px rgba( 0,0,0,0.08 ),0 1px 2px rgba( 0,0,0,0.06 );z-index:1000}.os-cat__editor{position:relative;display:inline-flex;align-items:center}.os-cat__search{appearance:none;font:inherit;font-size:13px;padding:8px 12px;border:0;border-bottom:1px solid var( --os-ui-cat-pop-divider,var( --os-ui-border,#f0f0f1 ) );background:transparent;color:inherit;outline:none}.os-cat__search:focus{border-bottom-color:var( --wp-admin-theme-color,#2271b1 )}.os-cat__tree{flex:1 1 auto;min-height:0;overflow-y:auto;padding:4px 0}.os-cat__row-block{display:contents}.os-cat__row{display:flex;align-items:center;gap:6px;padding:4px 8px 4px var( --os-ui-cat-row-indent,12px );cursor:pointer;user-select:none;font-size:13px;line-height:1.4;position:relative}.os-cat__row:hover,.os-cat__row[ data-focused='true' ]{background:var( --os-ui-hover,rgba( 0,0,0,0.04 ) )}.os-cat__row[ data-selected='true' ]{color:var( --wp-admin-theme-color,#2271b1 );font-weight:600}.os-cat__row::before{content:'';position:absolute;left:0;top:0;bottom:0;width:var( --os-ui-cat-guide-width,0px );border-left:1px dotted var( --os-ui-cat-guide-color,var( --os-ui-border,rgba( 0,0,0,0.08 ) ) )}.os-cat__expander{display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;border:0;background:transparent;color:inherit;cursor:pointer;flex-shrink:0;opacity:0.65}.os-cat__expander:hover{opacity:1}.os-cat__expander svg{display:block;transition:transform 0.12s ease}.os-cat__row[ data-expanded='true' ] .os-cat__expander svg{transform:rotate( 90deg )}.os-cat__expander--placeholder{visibility:hidden}.os-cat__create-row{display:flex;align-items:center;padding:2px 8px 2px var( --os-ui-cat-row-indent,28px );position:relative}.os-cat__create-row::before{content:'';position:absolute;left:0;top:0;bottom:0;width:var( --os-ui-cat-guide-width,0px );border-left:1px dotted var( --os-ui-cat-guide-color,var( --os-ui-border,rgba( 0,0,0,0.08 ) ) )}.os-cat__create-wrap{display:inline-flex;align-items:center;flex:1 1 auto;min-width:0;gap:4px;padding:1px 1px 1px 0;border:1px solid transparent;border-radius:6px;background:transparent;transition:border-color 0.12s ease,background-color 0.12s ease,box-shadow 0.12s ease}.os-cat__create-wrap:hover{border-color:var( --os-ui-border,rgba( 0,0,0,0.12 ) );background:var( --os-ui-cat-pop-bg,var( --os-ui-surface,#fff ) )}.os-cat__create-wrap:focus-within{border-color:var( --wp-admin-theme-color,#2271b1 );background:var( --os-ui-cat-pop-bg,var( --os-ui-surface,#fff ) );box-shadow:0 0 0 2px color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 15%,transparent )}.os-cat__create-input{flex:1 1 auto;min-width:0;appearance:none;font:inherit;font-size:var( --os-ui-field-font-size-compact,12px );padding:3px 6px;border:0;background:transparent;color:inherit;outline:none}.os-cat__create-input::placeholder{color:var( --os-ui-cat-pop-muted,var( --os-ui-fg-muted,#8c8f94 ) );font-style:italic;opacity:1}.os-cat__create-submit{appearance:none;display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;flex-shrink:0;padding:0;border:0;border-radius:4px;background:transparent;color:var( --os-ui-cat-pop-muted,var( --os-ui-fg-muted,#8c8f94 ) );cursor:pointer;transition:background-color 0.12s ease,color 0.12s ease}.os-cat__create-wrap:focus-within .os-cat__create-submit:not( [ disabled ] ){background:var( --wp-admin-theme-color,#2271b1 );color:var( --os-ui-accent-ink,var( --os-ui-fg-on-accent,#fff ) )}.os-cat__create-submit:hover:not( [ disabled ] ){filter:brightness( 1.05 )}.os-cat__create-submit[ disabled ]{cursor:default;opacity:0.5}.os-cat__create-submit svg{display:block}.os-cat__create-spinner{display:inline-block;width:12px;height:12px;margin:0 4px;border-radius:50%;border:2px solid var( --wp-admin-theme-color,#2271b1 );border-top-color:transparent;animation:os-cat-spin 0.8s linear infinite;flex-shrink:0}.os-cat__check{display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex-shrink:0;border:1.5px solid var( --os-ui-cat-check-border,var( --os-ui-border,#8c8f94 ) );border-radius:3px;color:transparent;transition:background-color 0.12s ease,border-color 0.12s ease,color 0.12s ease}.os-cat__row[ data-selected='true' ] .os-cat__check{background:var( --wp-admin-theme-color,#2271b1 );border-color:var( --wp-admin-theme-color,#2271b1 );color:var( --os-ui-accent-ink,var( --os-ui-fg-on-accent,#fff ) )}.os-cat__check svg{display:block;width:14px;height:14px}.os-cat__label{min-width:0;flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.os-cat__delete{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;width:18px;height:18px;border:0;border-radius:50%;padding:0;background:transparent;color:var( --os-ui-cat-delete-color,var( --os-ui-danger,#d63638 ) );cursor:pointer;opacity:0;transition:opacity 0.12s ease,background-color 0.12s ease}.os-cat__row:hover .os-cat__delete,.os-cat__row[ data-focused='true' ] .os-cat__delete,.os-cat__delete:focus-visible{opacity:1}.os-cat__delete:hover,.os-cat__delete:focus-visible{background:var( --os-ui-badge-danger-bg,rgba( 214,54,56,0.12 ) )}.os-cat__delete svg{display:block;width:14px;height:14px}.os-cat__match{background:var( --os-ui-search-highlight-bg,rgba( 252,211,77,0.45 ) );border-radius:2px;padding:0 1px}.os-cat__empty,.os-cat__loading{padding:12px;font-size:12px;color:var( --os-ui-cat-pop-muted,var( --os-ui-fg-muted,#646970 ) );text-align:center}.os-cat__loading-spinner{display:inline-block;width:12px;height:12px;border-radius:50%;border:2px solid currentColor;border-top-color:transparent;animation:os-cat-spin 0.8s linear infinite;margin-inline-end:8px;vertical-align:middle}@keyframes os-cat-spin{to{transform:rotate( 360deg )}}.os-cat__footer{padding:8px 12px;font-size:11px;color:var( --os-ui-cat-pop-muted,var( --os-ui-fg-muted,#646970 ) );border-top:1px solid var( --os-ui-cat-pop-divider,var( --os-ui-border,#f0f0f1 ) );border-radius:10px;background:var( --os-ui-cat-pop-footer-bg,var( --os-ui-surface,#fafafb ) );display:flex;align-items:center;gap:6px;line-height:1.4}.os-cat__footer .dashicons{font-size:14px;width:14px;height:14px;flex-shrink:0}:host( [ disabled ] ) .os-cat{opacity:0.6;pointer-events:none}`,fe=R`: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 ) )}`,wo=R` .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%}}`,$o=R` .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%}}`,Co=R` .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}}`,So=R` .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}}`,Ao=R` .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}}`,Eo=R` .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%}}`,zo=R` .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}}`,To=R` 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}}`,Je=R` 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}}`,Po=R` @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}}`;R` ${fe} ${wo} ${$o} ${Co} ${So} ${Ao} ${Eo} ${zo} ${To} ${Je} ${Po} `;const Mo=R` ${fe}:host{display:inline-flex;max-width:100%;vertical-align:middle}:host( [ hidden ] ){display:none}.os-chip{display:inline-flex;align-items:center;gap:var( --os-ui-chip-gap,4px );padding:var( --os-ui-chip-padding,2px 8px );border-radius:var( --os-ui-chip-radius,999px );font-size:var( --os-ui-chip-font-size,12px );line-height:var( --os-ui-chip-line-height,1.6 );font-weight:var( --os-ui-chip-font-weight,500 );background:var( --os-ui-chip-bg,var( --os-ui-surface,#f0f0f1 ) );color:var( --os-ui-chip-fg,var( --os-ui-fg,#1d2327 ) );border:var( --os-ui-chip-border,1px solid transparent );max-width:100%;box-sizing:border-box;transition:background-color 0.12s ease,color 0.12s ease,border-color 0.12s ease,transform 0.12s ease,opacity 0.12s ease}:host( [ tone='accent' ] ) .os-chip{background:var( --os-ui-chip-bg,color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 14%,transparent ) );color:var( --os-ui-chip-fg,var( --wp-admin-theme-color,#2271b1 ) )}:host( [ tone='positive' ] ) .os-chip{background:var( --os-ui-chip-bg,rgba( 30,132,73,0.14 ) );color:var( --os-ui-chip-fg,var( --os-ui-success-fg,#1d6f42 ) )}:host( [ tone='warning' ] ) .os-chip{background:var( --os-ui-chip-bg,rgba( 217,119,6,0.18 ) );color:var( --os-ui-chip-fg,var( --os-ui-warning-fg,#8a4a06 ) )}:host( [ tone='danger' ] ) .os-chip{background:var( --os-ui-chip-bg,rgba( 214,54,56,0.14 ) );color:var( --os-ui-chip-fg,var( --os-ui-danger-hover,#a02622 ) )}:host( [ pending ] ) .os-chip{opacity:0.65;animation:os-chip-pulse 1.2s ease-in-out infinite}@keyframes os-chip-pulse{0%,100%{opacity:0.55}50%{opacity:0.95}}.os-chip__label{max-width:var( --os-ui-chip-label-max,220px );overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.os-chip__icon{display:inline-flex;align-items:center;flex-shrink:0}.os-chip__icon::slotted( * ){display:inline-flex}.os-chip__dismiss{appearance:none;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:16px;height:16px;margin-inline-start:2px;padding:0;border:0;border-radius:50%;background:transparent;color:inherit;cursor:pointer;opacity:0.55;transition:opacity 0.12s ease,background-color 0.12s ease}.os-chip__dismiss:hover,.os-chip__dismiss:focus-visible{opacity:1;background:var( --os-ui-hover,rgba( 0,0,0,0.12 ) );outline:none}.os-chip__dismiss:focus-visible{box-shadow:var( --_holo-focus )}.os-chip__dismiss[ disabled ]{opacity:0.35;cursor:not-allowed}.os-chip__dismiss svg{display:block;width:14px;height:14px}:host( [ disabled ] ) .os-chip{opacity:0.55;cursor:not-allowed}:host( [ size='compact' ] ) .os-chip{padding:var( --os-ui-chip-padding,1px 6px );font-size:var( --os-ui-chip-font-size,11px )}:host( [ selected ] ) .os-chip{position:relative;background:var( --os-ui-chip-bg,var( --os-ui-accent-soft,rgba( 34,113,177,0.14 ) ) );color:var( --os-ui-chip-fg,var( --os-ui-fg,#1d2327 ) )}:host( [ selected ] ) .os-chip::after{content:'';position:absolute;inset:0;border-radius:inherit;padding:1px;background-image:var( --_holo-edge );pointer-events:none;-webkit-mask:linear-gradient( #000 0 0 ) content-box,linear-gradient( #000 0 0 );-webkit-mask-composite:xor;mask:linear-gradient( #000 0 0 ) content-box,linear-gradient( #000 0 0 );mask-composite:exclude}`,_e=class _e extends U{constructor(){super(...arguments),this._onHostKeyDown=e=>{if(this.dismissible!==null&&(e.key==="Backspace"||e.key==="Delete")){if(e.preventDefault(),this.disabled!==null)return;const i=this.label??"";this.emit("os-chip-dismiss",{label:i})}}}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this._onHostKeyDown)}disconnectedCallback(){this.removeEventListener("keydown",this._onHostKeyDown)}render(){const e=this.label??"",t=this.dismissible!==null,o=this.disabled!==null;return b` | |
| 74 | 41 | <span part="chip" class="os-chip"> |
| 75 | 42 | <span class="os-chip__icon"> |
| 76 | 43 | <slot name="icon"></slot> |
| 77 | 44 | </span> |
| 78 | 45 | <span class="os-chip__label"> |
| 79 | - ${e===""?f`<slot></slot>`:e} | |
| 46 | + ${e===""?b`<slot></slot>`:e} | |
| 80 | 47 | </span> |
| 81 | - ${t?f` | |
| 48 | + ${t?b` | |
| 82 | 49 | <button |
| 83 | 50 | part="dismiss" |
| 84 | 51 | class="os-chip__dismiss" |
| 85 | 52 | type="button" |
| @@ -84,44 +51,44 @@ | ||
| 84 | 51 | class="os-chip__dismiss" |
| 85 | 52 | type="button" |
| 86 | 53 | aria-label=${`Remove ${e||"chip"}`} |
| 87 | 54 | ?disabled=${o} |
| 88 | - @click=${s=>this._onDismiss(s)} | |
| 55 | + @click=${i=>this._onDismiss(i)} | |
| 89 | 56 | > |
| 90 | - ${E("close",{size:null})} | |
| 57 | + ${Y("close",{size:null})} | |
| 91 | 58 | </button> |
| 92 | - `:f``} | |
| 59 | + `:b``} | |
| 93 | 60 | </span> |
| 94 | - `}_onDismiss(e){if(e.stopPropagation(),this.disabled!==null)return;const o=this.label??"";this.emit("os-chip-dismiss",{label:o})}};U.props=["label","tone","size","dismissible","disabled","pending","selected"],U.styles=[go],U.help=void 0;let ge=U;S("os-chip",ge);const C="10px",mo=x`:host{display:inline-flex;max-width:100%;align-items:center;min-width:0;font-family:var( --os-ui-font,system-ui,sans-serif );font-size:12px;line-height:1;font-weight:500}.os-crumb-chain{display:inline-flex;flex-wrap:nowrap;align-items:stretch;max-width:100%;min-width:0;min-height:22px;border-radius:999px;overflow:hidden;filter:drop-shadow( 0 1px 1px rgba( 0,0,0,0.06 ) )}.os-crumb{display:inline-flex;align-items:center;justify-content:center;gap:5px;min-height:22px;padding:2px 12px;background:var( --os-ui-crumb-bg,var( --os-ui-surface,#c3c4c7 ) );color:var( --os-ui-crumb-fg,var( --os-ui-fg,#1d2327 ) );text-align:center;min-width:0;max-width:100%;flex-shrink:1;font-size:12px;font-weight:500;letter-spacing:0.01em;white-space:nowrap;cursor:grab;transition:filter 0.15s ease,transform 0.15s ease,background-color 0.12s ease}.os-crumb:active{cursor:grabbing}.os-crumb:hover{filter:brightness( 1.06 )}.os-crumb__remove{cursor:pointer}.os-crumb--first{padding-inline-end:22px;clip-path:polygon( 0 0,calc( 100% - ${C} ) 0,100% 50%,calc( 100% - ${C} ) 100%,0 100% )}.os-crumb--middle{padding-inline:22px;margin-inline-start:calc( -1 * ${C} );clip-path:polygon( ${C} 0,calc( 100% - ${C} ) 0,100% 50%,calc( 100% - ${C} ) 100%,${C} 100%,0 50% )}.os-crumb--last{padding-inline-start:22px;padding-inline-end:14px;margin-inline-start:calc( -1 * ${C} );clip-path:polygon( ${C} 0,100% 0,100% 100%,${C} 100%,0 50% )}.os-crumb--solo{padding:2px 12px;border-radius:999px}.os-crumb__label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:1.4}.os-crumb__remove{appearance:none;display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex-shrink:0;padding:0;border:0;border-radius:50%;background:transparent;color:inherit;cursor:pointer;opacity:0.65;transition:opacity 0.12s ease,background-color 0.12s ease,transform 0.12s ease}.os-crumb__remove:hover,.os-crumb__remove:focus-visible{opacity:1;background:var( --os-ui-scrim,rgba( 0,0,0,0.22 ) );outline:none;transform:scale( 1.1 )}.os-crumb__remove svg{display:block;width:100%;height:100%}.os-crumb-chain:hover{filter:drop-shadow( 0 2px 3px rgba( 0,0,0,0.12 ) )}:host( [ disabled ] ) .os-crumb-chain{opacity:0.55;pointer-events:none}`,j=class j extends k{constructor(){super(...arguments),this._segments=[]}get segments(){return this._segments}set segments(e){this._segments=Array.isArray(e)?e.slice():[],this.requestUpdate()}render(){const e=this.removable!==null,t=this._segments;return t.length===0?f``:f` | |
| 61 | + `}_onDismiss(e){if(e.stopPropagation(),this.disabled!==null)return;const o=this.label??"";this.emit("os-chip-dismiss",{label:o})}};_e.props=["label","tone","size","dismissible","disabled","pending","selected"],_e.styles=[Mo],_e.help=void 0;let Qe=_e;W("os-chip",Qe);const K="10px",Lo=R`:host{display:inline-flex;max-width:100%;align-items:center;min-width:0;font-family:var( --os-ui-font,system-ui,sans-serif );font-size:12px;line-height:1;font-weight:500}.os-crumb-chain{display:inline-flex;flex-wrap:nowrap;align-items:stretch;max-width:100%;min-width:0;min-height:22px;border-radius:999px;overflow:hidden;filter:drop-shadow( 0 1px 1px rgba( 0,0,0,0.06 ) )}.os-crumb{display:inline-flex;align-items:center;justify-content:center;gap:5px;min-height:22px;padding:2px 12px;background:var( --os-ui-crumb-bg,var( --os-ui-surface,#c3c4c7 ) );color:var( --os-ui-crumb-fg,var( --os-ui-fg,#1d2327 ) );text-align:center;min-width:0;max-width:100%;flex-shrink:1;font-size:12px;font-weight:500;letter-spacing:0.01em;white-space:nowrap;cursor:grab;transition:filter 0.15s ease,transform 0.15s ease,background-color 0.12s ease}.os-crumb:active{cursor:grabbing}.os-crumb:hover{filter:brightness( 1.06 )}.os-crumb__remove{cursor:pointer}.os-crumb--first{padding-inline-end:22px;clip-path:polygon( 0 0,calc( 100% - ${K} ) 0,100% 50%,calc( 100% - ${K} ) 100%,0 100% )}.os-crumb--middle{padding-inline:22px;margin-inline-start:calc( -1 * ${K} );clip-path:polygon( ${K} 0,calc( 100% - ${K} ) 0,100% 50%,calc( 100% - ${K} ) 100%,${K} 100%,0 50% )}.os-crumb--last{padding-inline-start:22px;padding-inline-end:14px;margin-inline-start:calc( -1 * ${K} );clip-path:polygon( ${K} 0,100% 0,100% 100%,${K} 100%,0 50% )}.os-crumb--solo{padding:2px 12px;border-radius:999px}.os-crumb__label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:1.4}.os-crumb__remove{appearance:none;display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex-shrink:0;padding:0;border:0;border-radius:50%;background:transparent;color:inherit;cursor:pointer;opacity:0.65;transition:opacity 0.12s ease,background-color 0.12s ease,transform 0.12s ease}.os-crumb__remove:hover,.os-crumb__remove:focus-visible{opacity:1;background:var( --os-ui-scrim,rgba( 0,0,0,0.22 ) );outline:none;transform:scale( 1.1 )}.os-crumb__remove svg{display:block;width:100%;height:100%}.os-crumb-chain:hover{filter:drop-shadow( 0 2px 3px rgba( 0,0,0,0.12 ) )}:host( [ disabled ] ) .os-crumb-chain{opacity:0.55;pointer-events:none}`,ve=class ve extends U{constructor(){super(...arguments),this._segments=[]}get segments(){return this._segments}set segments(e){this._segments=Array.isArray(e)?e.slice():[],this.requestUpdate()}render(){const e=this.removable!==null,t=this._segments;return t.length===0?b``:b` | |
| 95 | 62 | <div class="os-crumb-chain" role="group"> |
| 96 | - ${t.map((o,s)=>{const a=Ge(s,t.length),r=o.color,n=r?`--os-ui-crumb-bg: ${r}; --os-ui-crumb-fg: ${Ze(r)};`:"";return f` | |
| 63 | + ${t.map((o,i)=>{const a=Wt(i,t.length),n=o.color,r=n?`--os-ui-crumb-bg: ${n}; --os-ui-crumb-fg: ${jt(n)};`:"";return b` | |
| 97 | 64 | <span |
| 98 | 65 | class=${`os-crumb os-crumb--${a}`} |
| 99 | - style=${n} | |
| 66 | + style=${r} | |
| 100 | 67 | title=${o.name} |
| 101 | 68 | draggable="true" |
| 102 | - @click=${l=>this._onSegmentClick(l,s,o)} | |
| 103 | - @dragstart=${l=>this._onSegmentDragStart(l,s,o)} | |
| 69 | + @click=${l=>this._onSegmentClick(l,i,o)} | |
| 70 | + @dragstart=${l=>this._onSegmentDragStart(l,i,o)} | |
| 104 | 71 | > |
| 105 | 72 | <span class="os-crumb__label">${o.name}</span> |
| 106 | - ${e?f` | |
| 73 | + ${e?b` | |
| 107 | 74 | <button |
| 108 | 75 | type="button" |
| 109 | 76 | class="os-crumb__remove" |
| 110 | 77 | aria-label=${`Remove ${o.name}`} |
| 111 | 78 | draggable="false" |
| 112 | - @click=${l=>this._onRemove(l,s,o)} | |
| 113 | - >${yo()}</button> | |
| 114 | - `:f``} | |
| 79 | + @click=${l=>this._onRemove(l,i,o)} | |
| 80 | + >${Oo()}</button> | |
| 81 | + `:b``} | |
| 115 | 82 | </span> |
| 116 | 83 | `})} |
| 117 | 84 | </div> |
| 118 | - `}_onSegmentDragStart(e,t,o){if(e.target?.closest(".os-crumb__remove")){e.preventDefault();return}const a=this._segments.slice(t);if(e.dataTransfer){const r=_o(a);document.body.appendChild(r);const n=e.currentTarget?.getBoundingClientRect(),l=n?Math.min(30,n.width/2):16,c=n?Math.min(16,n.height/2):12;e.dataTransfer.setDragImage(r,l,c),requestAnimationFrame(()=>r.remove())}this.emit("os-chain-segment-dragstart",{index:t,id:o.id,segment:o,segments:a,dragEvent:e})}_onSegmentClick(e,t,o){e.target?.closest(".os-crumb__remove")||this.emit("os-chain-segment-click",{index:t,id:o.id,segment:o})}_onRemove(e,t,o){e.stopPropagation(),this.emit("os-chain-remove",{index:t,id:o.id,segment:o})}};j.props=["removable","disabled"],j.styles=[mo],j.help=void 0;let me=j;S("os-crumb-chain",me);const bo=10;function _o(i){const e=document.createElement("div");e.style.cssText=["display: inline-flex","align-items: stretch","border-radius: 999px","overflow: hidden","filter: drop-shadow( 0 1px 2px rgba( 0, 0, 0, 0.18 ) )",'font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',"font-size: 12px","line-height: 1","font-weight: 500","position: fixed","top: -10000px","left: -10000px","pointer-events: none","z-index: 2147483647"].join("; ");const t=i.length,o=vo();return i.forEach((s,a)=>{const r=document.createElement("span"),n=s.color??o.bg,l=s.color?Ze(s.color):o.fg,c=Ge(a,t),d=["display: inline-flex","align-items: center","justify-content: center","min-height: 22px",`background: ${n}`,`color: ${l}`,"white-space: nowrap","box-sizing: border-box","letter-spacing: 0.01em"],u=bo;c==="solo"?d.push("padding: 2px 12px","border-radius: 999px"):c==="first"?d.push("padding: 2px 22px 2px 12px",`clip-path: polygon( 0 0, calc( 100% - ${u}px ) 0, 100% 50%, calc( 100% - ${u}px ) 100%, 0 100% )`):c==="middle"?d.push("padding: 2px 22px",`margin-inline-start: -${u}px`,`clip-path: polygon( ${u}px 0, calc( 100% - ${u}px ) 0, 100% 50%, calc( 100% - ${u}px ) 100%, ${u}px 100%, 0 50% )`):d.push("padding: 2px 14px 2px 22px",`margin-inline-start: -${u}px`,`clip-path: polygon( ${u}px 0, 100% 0, 100% 100%, ${u}px 100%, 0 50% )`),r.style.cssText=d.join("; "),r.textContent=s.name,e.appendChild(r)}),e}const Ke="rgba( 0, 0, 0, 0.08 )",Be="#1d2327";function vo(){if(typeof document>"u"||!document.body)return{bg:Ke,fg:Be};const i=getComputedStyle(document.body);return{bg:i.getPropertyValue("--os-ui-crumb-bg").trim()||Ke,fg:i.getPropertyValue("--os-ui-crumb-fg").trim()||Be}}function Ge(i,e){return e===1?"solo":i===0?"first":i===e-1?"last":"middle"}let D=null;function Ze(i){D||(D=document.createElement("canvas"),D.width=1,D.height=1);const e=D.getContext("2d",{willReadFrequently:!0});if(!e)return"#1d2327";try{e.clearRect(0,0,1,1),e.fillStyle=i,e.fillRect(0,0,1,1);const t=e.getImageData(0,0,1,1).data,o=t[3]/255,s=t[0]*o+255*(1-o),a=t[1]*o+255*(1-o),r=t[2]*o+255*(1-o),n=c=>{const d=c/255;return d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4)};return .2126*n(s)+.7152*n(a)+.0722*n(r)>.55?"#1d2327":"#fff"}catch{return"#1d2327"}}function yo(){return E("close",{size:null})}const Xe="uncategorized",xo=1;function oe(i){return i.id===xo?!0:(i.name||"").toLowerCase()===Xe}const W=class W extends k{constructor(){super(...arguments),this._items=[],this._value=[],this._query="",this._collapsed=new Set,this._focusedRow=-1,this._creatingValues=new Map,this._creatingPending=new Set,this._onCellClick=e=>{if(e.target?.closest(".os-cat-node")||this.isOpen)return;const o=this.disabled!==null,s=this.readonly!==null;o||s||this.openPicker()},this._onDocPointerDown=e=>{!this.isOpen||e.composedPath().includes(this)||this.closePicker()},this._onLayoutChange=()=>{this.isOpen&&this.closePicker()},this._onDocKeydown=e=>{this.isOpen&&e.key==="Escape"&&(e.preventDefault(),this.closePicker())}}get items(){return this._items}set items(e){this._items=Array.isArray(e)?e.slice():[],this.requestUpdate()}get value(){return this._value}set value(e){this._value=Array.isArray(e)?e.slice():[],this.requestUpdate()}get isOpen(){return this.open!==null}openPicker(){this.isOpen||(this.open="",this._query="",this._focusedRow=0,this.emit("os-categories-open",{}),queueMicrotask(()=>{this._positionPopover(),this._searchInput?.focus()}))}closePicker(){this.isOpen&&(this.open=null,this._query="",this._focusedRow=-1,this.emit("os-categories-close",{}),this.requestUpdate())}connectedCallback(){super.connectedCallback(),document.addEventListener("pointerdown",this._onDocPointerDown,!0),document.addEventListener("keydown",this._onDocKeydown,!0),window.addEventListener("resize",this._onLayoutChange,{passive:!0}),window.addEventListener("scroll",this._onLayoutChange,{passive:!0,capture:!0})}disconnectedCallback(){document.removeEventListener("pointerdown",this._onDocPointerDown,!0),document.removeEventListener("keydown",this._onDocKeydown,!0),window.removeEventListener("resize",this._onLayoutChange),window.removeEventListener("scroll",this._onLayoutChange,{capture:!0})}get _searchInput(){return this.shadowRoot?.querySelector(".os-cat__search")??null}render(){const e=this.isOpen,t=this.disabled!==null,o=this.readonly!==null,s=this.loading!==null,a=this["add-label"]||"Categorize",r=this.placeholder||"Search categories…",n=Math.max(0,parseInt(this["max-visible"]||"2",10)||2);return f` | |
| 85 | + `}_onSegmentDragStart(e,t,o){if(e.target?.closest(".os-crumb__remove")){e.preventDefault();return}const a=this._segments.slice(t);if(e.dataTransfer){const n=Io(a);document.body.appendChild(n);const r=e.currentTarget?.getBoundingClientRect(),l=r?Math.min(30,r.width/2):16,c=r?Math.min(16,r.height/2):12;e.dataTransfer.setDragImage(n,l,c),requestAnimationFrame(()=>n.remove())}this.emit("os-chain-segment-dragstart",{index:t,id:o.id,segment:o,segments:a,dragEvent:e})}_onSegmentClick(e,t,o){e.target?.closest(".os-crumb__remove")||this.emit("os-chain-segment-click",{index:t,id:o.id,segment:o})}_onRemove(e,t,o){e.stopPropagation(),this.emit("os-chain-remove",{index:t,id:o.id,segment:o})}};ve.props=["removable","disabled"],ve.styles=[Lo],ve.help=void 0;let et=ve;W("os-crumb-chain",et);const Ro=10;function Io(s){const e=document.createElement("div");e.style.cssText=["display: inline-flex","align-items: stretch","border-radius: 999px","overflow: hidden","filter: drop-shadow( 0 1px 2px rgba( 0, 0, 0, 0.18 ) )",'font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',"font-size: 12px","line-height: 1","font-weight: 500","position: fixed","top: -10000px","left: -10000px","pointer-events: none","z-index: 2147483647"].join("; ");const t=s.length,o=No();return s.forEach((i,a)=>{const n=document.createElement("span"),r=i.color??o.bg,l=i.color?jt(i.color):o.fg,c=Wt(a,t),d=["display: inline-flex","align-items: center","justify-content: center","min-height: 22px",`background: ${r}`,`color: ${l}`,"white-space: nowrap","box-sizing: border-box","letter-spacing: 0.01em"],p=Ro;c==="solo"?d.push("padding: 2px 12px","border-radius: 999px"):c==="first"?d.push("padding: 2px 22px 2px 12px",`clip-path: polygon( 0 0, calc( 100% - ${p}px ) 0, 100% 50%, calc( 100% - ${p}px ) 100%, 0 100% )`):c==="middle"?d.push("padding: 2px 22px",`margin-inline-start: -${p}px`,`clip-path: polygon( ${p}px 0, calc( 100% - ${p}px ) 0, 100% 50%, calc( 100% - ${p}px ) 100%, ${p}px 100%, 0 50% )`):d.push("padding: 2px 14px 2px 22px",`margin-inline-start: -${p}px`,`clip-path: polygon( ${p}px 0, 100% 0, 100% 100%, ${p}px 100%, 0 50% )`),n.style.cssText=d.join("; "),n.textContent=i.name,e.appendChild(n)}),e}const Ut="rgba( 0, 0, 0, 0.08 )",Vt="#1d2327";function No(){if(typeof document>"u"||!document.body)return{bg:Ut,fg:Vt};const s=getComputedStyle(document.body);return{bg:s.getPropertyValue("--os-ui-crumb-bg").trim()||Ut,fg:s.getPropertyValue("--os-ui-crumb-fg").trim()||Vt}}function Wt(s,e){return e===1?"solo":s===0?"first":s===e-1?"last":"middle"}let ge=null;function jt(s){ge||(ge=document.createElement("canvas"),ge.width=1,ge.height=1);const e=ge.getContext("2d",{willReadFrequently:!0});if(!e)return"#1d2327";try{e.clearRect(0,0,1,1),e.fillStyle=s,e.fillRect(0,0,1,1);const t=e.getImageData(0,0,1,1).data,o=t[3]/255,i=t[0]*o+255*(1-o),a=t[1]*o+255*(1-o),n=t[2]*o+255*(1-o),r=c=>{const d=c/255;return d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4)};return .2126*r(i)+.7152*r(a)+.0722*r(n)>.55?"#1d2327":"#fff"}catch{return"#1d2327"}}function Oo(){return Y("close",{size:null})}const Kt="uncategorized",qo=1;function Me(s){return s.id===qo?!0:(s.name||"").toLowerCase()===Kt}const xe=class xe extends U{constructor(){super(...arguments),this._items=[],this._value=[],this._query="",this._collapsed=new Set,this._focusedRow=-1,this._creatingValues=new Map,this._creatingPending=new Set,this._onCellClick=e=>{if(e.target?.closest(".os-cat-node")||this.isOpen)return;const o=this.disabled!==null,i=this.readonly!==null;o||i||this.openPicker()},this._onDocPointerDown=e=>{!this.isOpen||e.composedPath().includes(this)||this.closePicker()},this._onLayoutChange=()=>{this.isOpen&&this.closePicker()},this._onDocKeydown=e=>{this.isOpen&&e.key==="Escape"&&(e.preventDefault(),this.closePicker())}}get items(){return this._items}set items(e){this._items=Array.isArray(e)?e.slice():[],this.requestUpdate()}get value(){return this._value}set value(e){this._value=Array.isArray(e)?e.slice():[],this.requestUpdate()}get isOpen(){return this.open!==null}openPicker(){this.isOpen||(this.open="",this._query="",this._focusedRow=0,this.emit("os-categories-open",{}),queueMicrotask(()=>{this._positionPopover(),this._searchInput?.focus()}))}closePicker(){this.isOpen&&(this.open=null,this._query="",this._focusedRow=-1,this.emit("os-categories-close",{}),this.requestUpdate())}connectedCallback(){super.connectedCallback(),document.addEventListener("pointerdown",this._onDocPointerDown,!0),document.addEventListener("keydown",this._onDocKeydown,!0),window.addEventListener("resize",this._onLayoutChange,{passive:!0}),window.addEventListener("scroll",this._onLayoutChange,{passive:!0,capture:!0})}disconnectedCallback(){document.removeEventListener("pointerdown",this._onDocPointerDown,!0),document.removeEventListener("keydown",this._onDocKeydown,!0),window.removeEventListener("resize",this._onLayoutChange),window.removeEventListener("scroll",this._onLayoutChange,{capture:!0})}get _searchInput(){return this.shadowRoot?.querySelector(".os-cat__search")??null}render(){const e=this.isOpen,t=this.disabled!==null,o=this.readonly!==null,i=this.loading!==null,a=this["add-label"]||"Categorize",n=this.placeholder||"Search categories…",r=Math.max(0,parseInt(this["max-visible"]||"2",10)||2);return b` | |
| 119 | 86 | <span class="os-cat" role="group"> |
| 120 | - ${this._renderChipRow(n,o,t,a)} | |
| 121 | - ${e?this._renderPopover(r,s):f``} | |
| 87 | + ${this._renderChipRow(r,o,t,a)} | |
| 88 | + ${e?this._renderPopover(n,i):b``} | |
| 122 | 89 | </span> |
| 123 | - `}_renderChipRow(e,t,o,s){const a=this._selectedItemsInOrder();if(a.length===0)return f` | |
| 90 | + `}_renderChipRow(e,t,o,i){const a=this._selectedItemsInOrder();if(a.length===0)return b` | |
| 124 | 91 | <span class="os-cat__chips" role="list"> |
| 125 | 92 | <span |
| 126 | 93 | class="os-cat__uncategorized" |
| 127 | 94 | title=${'Posts with no category appear as "Uncategorized" in WordPress.'} |
| @@ -127,17 +94,17 @@ | ||
| 127 | 94 | title=${'Posts with no category appear as "Uncategorized" in WordPress.'} |
| 128 | 95 | @click=${this._onCellClick} |
| 129 | 96 | >${"Uncategorized"}</span> |
| 130 | 97 | </span> |
| 131 | - `;const r=this._buildChains(a);return f` | |
| 98 | + `;const n=this._buildChains(a);return b` | |
| 132 | 99 | <div |
| 133 | 100 | class="os-cat__chains" |
| 134 | 101 | role="list" |
| 135 | 102 | @click=${this._onCellClick} |
| 136 | 103 | > |
| 137 | - ${r.map(n=>this._renderChain(n,t,o))} | |
| 104 | + ${n.map(r=>this._renderChain(r,t,o))} | |
| 138 | 105 | </div> |
| 139 | - `}_buildChains(e){const t=new Map;for(const n of this._items)t.set(n.id,n);const o=new Set(e.map(n=>n.id)),s=n=>{for(const l of o){if(l===n)continue;let c=t.get(l),d=16;for(;c&&d-- >0;){if(c.parent===n)return!0;if(!c.parent)break;c=t.get(c.parent)}}return!1},a=e.filter(n=>!s(n.id)),r=[];for(const n of a){const l=[];let c=n,d=16;for(;c&&d-- >0&&((c===n||o.has(c.id))&&l.unshift(c),!!c.parent);)c=t.get(c.parent);const u=l.map(h=>({id:h.id,name:h.name}));r.push({id:n.id,segments:u})}return r}_renderChain(e,t,o){const s=!t&&!o,a=n=>{n.stopPropagation();const l=n.detail,c=typeof l?.index=="number"?l.index:e.segments.length-1,d=new Set;for(const h of e.segments.slice(c))typeof h.id=="number"&&d.add(h.id);const u=this._value.filter(h=>!d.has(h));u.length!==this._value.length&&this.emit("os-categories-change",{value:u})},r=document.createElement("os-crumb-chain");return r.segments=e.segments,s&&r.setAttribute("removable",""),r.addEventListener("os-chain-remove",a),f`<div role="listitem">${r}</div>`}_renderPopover(e,t){const o=this._buildTree(),s=this._filterTree(o,this._query),a=this._flattenForDisplay(s);return this._focusedRow>=a.length&&(this._focusedRow=a.length>0?a.length-1:-1),f` | |
| 106 | + `}_buildChains(e){const t=new Map;for(const r of this._items)t.set(r.id,r);const o=new Set(e.map(r=>r.id)),i=r=>{for(const l of o){if(l===r)continue;let c=t.get(l),d=16;for(;c&&d-- >0;){if(c.parent===r)return!0;if(!c.parent)break;c=t.get(c.parent)}}return!1},a=e.filter(r=>!i(r.id)),n=[];for(const r of a){const l=[];let c=r,d=16;for(;c&&d-- >0&&((c===r||o.has(c.id))&&l.unshift(c),!!c.parent);)c=t.get(c.parent);const p=l.map(g=>({id:g.id,name:g.name}));n.push({id:r.id,segments:p})}return n}_renderChain(e,t,o){const i=!t&&!o,a=r=>{r.stopPropagation();const l=r.detail,c=typeof l?.index=="number"?l.index:e.segments.length-1,d=new Set;for(const g of e.segments.slice(c))typeof g.id=="number"&&d.add(g.id);const p=this._value.filter(g=>!d.has(g));p.length!==this._value.length&&this.emit("os-categories-change",{value:p})},n=document.createElement("os-crumb-chain");return n.segments=e.segments,i&&n.setAttribute("removable",""),n.addEventListener("os-chain-remove",a),b`<div role="listitem">${n}</div>`}_renderPopover(e,t){const o=this._buildTree(),i=this._filterTree(o,this._query),a=this._flattenForDisplay(i);return this._focusedRow>=a.length&&(this._focusedRow=a.length>0?a.length-1:-1),b` | |
| 140 | 107 | <div class="os-cat__popover" role="dialog" aria-label="Choose categories"> |
| 141 | 108 | <input |
| 142 | 109 | class="os-cat__search" |
| 143 | 110 | type="text" |
| @@ -143,10 +110,10 @@ | ||
| 143 | 110 | type="text" |
| 144 | 111 | autocomplete="off" |
| 145 | 112 | placeholder=${e} |
| 146 | 113 | .value=${this._query} |
| 147 | - @input=${r=>this._onSearchInput(r)} | |
| 148 | - @keydown=${r=>this._onSearchKeydown(r,a)} | |
| 114 | + @input=${n=>this._onSearchInput(n)} | |
| 115 | + @keydown=${n=>this._onSearchKeydown(n,a)} | |
| 149 | 116 | /> |
| 150 | 117 | <div class="os-cat__tree" role="listbox" aria-multiselectable="true"> |
| 151 | 118 | ${this._renderCreateRow(0,12,0,"")} |
| 152 | 119 | ${this._renderTreeBody(t,a)} |
| @@ -158,50 +125,50 @@ | ||
| 158 | 125 | <strong>Uncategorized</strong>. |
| 159 | 126 | </span> |
| 160 | 127 | </div> |
| 161 | 128 | </div> |
| 162 | - `}_renderTreeBody(e,t){return e?f` | |
| 129 | + `}_renderTreeBody(e,t){return e?b` | |
| 163 | 130 | <div class="os-cat__loading"> |
| 164 | 131 | <span class="os-cat__loading-spinner" aria-hidden="true"></span> |
| 165 | 132 | ${"Loading categories…"} |
| 166 | 133 | </div> |
| 167 | - `:t.length===0?f` | |
| 134 | + `:t.length===0?b` | |
| 168 | 135 | <div class="os-cat__empty"> |
| 169 | 136 | ${this._items.length===0?"No categories yet — create one in WordPress to assign.":"No matches."} |
| 170 | 137 | </div> |
| 171 | - `:t.map((o,s)=>this._renderRow(o,s,t.length))}_renderRow(e,t,o){const{node:s,hasChildren:a}=e,r=this._value.includes(s.item.id),n=!this._collapsed.has(s.item.id),l=12+s.depth*16,c=s.depth>0?s.depth*16:0,d=t===this._focusedRow;return f` | |
| 138 | + `:t.map((o,i)=>this._renderRow(o,i,t.length))}_renderRow(e,t,o){const{node:i,hasChildren:a}=e,n=this._value.includes(i.item.id),r=!this._collapsed.has(i.item.id),l=12+i.depth*16,c=i.depth>0?i.depth*16:0,d=t===this._focusedRow;return b` | |
| 172 | 139 | <div class="os-cat__row-block"> |
| 173 | 140 | <div |
| 174 | 141 | class="os-cat__row" |
| 175 | 142 | role="option" |
| 176 | - aria-selected=${r?"true":"false"} | |
| 177 | - data-selected=${r?"true":"false"} | |
| 178 | - data-expanded=${n?"true":"false"} | |
| 143 | + aria-selected=${n?"true":"false"} | |
| 144 | + data-selected=${n?"true":"false"} | |
| 145 | + data-expanded=${r?"true":"false"} | |
| 179 | 146 | data-focused=${d?"true":"false"} |
| 180 | - data-row-id=${String(s.item.id)} | |
| 147 | + data-row-id=${String(i.item.id)} | |
| 181 | 148 | style=${`--os-ui-cat-row-indent: ${l}px; --os-ui-cat-guide-width: ${c}px;`} |
| 182 | 149 | @mouseenter=${()=>{this._focusedRow=t,this.requestUpdate()}} |
| 183 | - @click=${u=>{u.preventDefault(),this._toggleSelection(s.item.id)}} | |
| 150 | + @click=${p=>{p.preventDefault(),this._toggleSelection(i.item.id)}} | |
| 184 | 151 | > |
| 185 | - ${a?f`<button | |
| 152 | + ${a?b`<button | |
| 186 | 153 | type="button" |
| 187 | 154 | class="os-cat__expander" |
| 188 | - aria-label=${n?"Collapse":"Expand"} | |
| 189 | - @click=${u=>{u.stopPropagation(),this._toggleExpand(s.item.id)}} | |
| 190 | - >${Ye()}</button>`:f`<span class="os-cat__expander os-cat__expander--placeholder" aria-hidden="true">${Ye()}</span>`} | |
| 191 | - <span class="os-cat__check" aria-hidden="true">${ko()}</span> | |
| 192 | - <span class="os-cat__label">${this._highlight(s.item.name,this._query)}</span> | |
| 193 | - ${oe(s.item)?f``:f`<button | |
| 155 | + aria-label=${r?"Collapse":"Expand"} | |
| 156 | + @click=${p=>{p.stopPropagation(),this._toggleExpand(i.item.id)}} | |
| 157 | + >${Bt()}</button>`:b`<span class="os-cat__expander os-cat__expander--placeholder" aria-hidden="true">${Bt()}</span>`} | |
| 158 | + <span class="os-cat__check" aria-hidden="true">${Ho()}</span> | |
| 159 | + <span class="os-cat__label">${this._highlight(i.item.name,this._query)}</span> | |
| 160 | + ${Me(i.item)?b``:b`<button | |
| 194 | 161 | type="button" |
| 195 | 162 | class="os-cat__delete" |
| 196 | - aria-label=${`Delete ${s.item.name}`} | |
| 197 | - title=${`Delete ${s.item.name}`} | |
| 198 | - @click=${u=>this._onDeleteClick(u,s.item)} | |
| 199 | - >${Co()}</button>`} | |
| 163 | + aria-label=${`Delete ${i.item.name}`} | |
| 164 | + title=${`Delete ${i.item.name}`} | |
| 165 | + @click=${p=>this._onDeleteClick(p,i.item)} | |
| 166 | + >${Fo()}</button>`} | |
| 200 | 167 | </div> |
| 201 | - ${n&&!oe(s.item)?this._renderCreateRow(s.item.id,12+(s.depth+1)*16,(s.depth+1)*16,s.item.name):f``} | |
| 168 | + ${r&&!Me(i.item)?this._renderCreateRow(i.item.id,12+(i.depth+1)*16,(i.depth+1)*16,i.item.name):b``} | |
| 202 | 169 | </div> |
| 203 | - `}_renderCreateRow(e,t,o,s){const a=this._creatingValues.get(e)??"",r=this._creatingPending.has(e),n=e===0?"Add new category…":`Add child of "${s}"…`;return f` | |
| 170 | + `}_renderCreateRow(e,t,o,i){const a=this._creatingValues.get(e)??"",n=this._creatingPending.has(e),r=e===0?"Add new category…":`Add child of "${i}"…`;return b` | |
| 204 | 171 | <div |
| 205 | 172 | class="os-cat__create-row" |
| 206 | 173 | style=${`--os-ui-cat-row-indent: ${t}px; --os-ui-cat-guide-width: ${o}px;`} |
| 207 | 174 | @click=${l=>l.stopPropagation()} |
| @@ -211,27 +178,27 @@ | ||
| 211 | 178 | class="os-cat__create-input" |
| 212 | 179 | type="text" |
| 213 | 180 | autocomplete="off" |
| 214 | 181 | spellcheck="false" |
| 215 | - placeholder=${n} | |
| 216 | - aria-label=${n} | |
| 182 | + placeholder=${r} | |
| 183 | + aria-label=${r} | |
| 217 | 184 | .value=${a} |
| 218 | - ?disabled=${r} | |
| 185 | + ?disabled=${n} | |
| 219 | 186 | @input=${l=>this._onCreateInput(l,e)} |
| 220 | 187 | @keydown=${l=>this._onCreateKeydown(l,e)} |
| 221 | 188 | /> |
| 222 | - ${r?f`<span class="os-cat__create-spinner" aria-hidden="true"></span>`:f`<button | |
| 189 | + ${n?b`<span class="os-cat__create-spinner" aria-hidden="true"></span>`:b`<button | |
| 223 | 190 | type="button" |
| 224 | 191 | class="os-cat__create-submit" |
| 225 | - aria-label=${e===0?"Create category":`Create child of ${s}`} | |
| 192 | + aria-label=${e===0?"Create category":`Create child of ${i}`} | |
| 226 | 193 | ?disabled=${a.trim().length===0} |
| 227 | 194 | @click=${l=>{l.stopPropagation(),this._submitCreate(e)}} |
| 228 | - >${wo()}</button>`} | |
| 195 | + >${Do()}</button>`} | |
| 229 | 196 | </div> |
| 230 | 197 | </div> |
| 231 | - `}_onCreateInput(e,t){const o=e.target.value;o===""?this._creatingValues.delete(t):this._creatingValues.set(t,o),this.requestUpdate()}_onCreateKeydown(e,t){if(e.key==="Escape"){e.preventDefault(),this._creatingValues.delete(t),this.requestUpdate();return}e.key==="Enter"&&(e.preventDefault(),this._submitCreate(t))}_submitCreate(e){const t=(this._creatingValues.get(e)??"").trim();!t||this._creatingPending.has(e)||(this._creatingPending.add(e),this.requestUpdate(),this.emit("os-categories-create",{name:t,parent:e}))}endCreating(e=0){this._creatingPending.delete(e),this._creatingValues.delete(e),this.requestUpdate()}failCreating(e=0,t){this._creatingPending.delete(e),this.requestUpdate()}_buildTree(){const e=new Map;for(const a of this._items)e.set(a.id,{item:a,children:[],depth:0});const t=[];for(const a of e.values()){const r=a.item.parent;r&&e.has(r)?e.get(r).children.push(a):t.push(a)}const o=(a,r)=>{a.depth=r;for(const n of a.children)o(n,r+1)};for(const a of t)o(a,0);const s=a=>{a.sort((r,n)=>{const l=oe(r.item),c=oe(n.item);return l!==c?l?-1:1:r.item.name.localeCompare(n.item.name)});for(const r of a)s(r.children)};return s(t),t}_filterTree(e,t){const o=t.trim().toLowerCase();if(!o)return e;const s=a=>{if(a.item.name.toLowerCase().includes(o))return{item:a.item,children:a.children.slice(),depth:a.depth};const n=a.children.map(s).filter(l=>l!==null);return n.length>0?{item:a.item,children:n,depth:a.depth}:null};return e.map(s).filter(a=>a!==null)}_flattenForDisplay(e){const t=[],o=this._query.trim()!=="",s=a=>{for(const r of a)t.push({node:r,visible:!0,hasChildren:r.children.length>0}),!(this._collapsed.has(r.item.id)&&!o)&&r.children.length>0&&s(r.children)};return s(e),t}_selectedItemsInOrder(){const e=new Map;for(const s of this._items)e.set(s.id,s);const t=[],o=[];for(const s of this._value){const a=e.get(s);a&&(a.name.toLowerCase()===Xe||a.id===1?o.push(a):t.push(a))}return t.length>0?t:o.length>0?[]:t}_highlight(e,t){const o=t.trim();if(!o)return e;const s=e.toLowerCase(),a=o.toLowerCase(),r=s.indexOf(a);return r===-1?e:f`${e.slice(0,r)}<span class="os-cat__match" | |
| 232 | - >${e.slice(r,r+o.length)}</span | |
| 233 | - >${e.slice(r+o.length)}`}_toggleSelection(e){const t=this._value.includes(e)?this._value.filter(o=>o!==e):[...this._value,e];this.emit("os-categories-change",{value:t})}_onDeleteClick(e,t){e.stopPropagation(),e.preventDefault(),this.emit("os-categories-delete",{id:t.id,name:t.name})}_toggleExpand(e){this._collapsed.has(e)?this._collapsed.delete(e):this._collapsed.add(e),this.requestUpdate()}_onSearchInput(e){this._query=e.target.value,this._focusedRow=0,this.requestUpdate()}_onSearchKeydown(e,t){switch(e.key){case"ArrowDown":{if(t.length===0)return;e.preventDefault(),this._focusedRow=this._focusedRow+1>=t.length?0:this._focusedRow+1,this.requestUpdate(),this._scrollFocusedIntoView();return}case"ArrowUp":{if(t.length===0)return;e.preventDefault(),this._focusedRow=this._focusedRow<=0?t.length-1:this._focusedRow-1,this.requestUpdate(),this._scrollFocusedIntoView();return}case"ArrowRight":{if(this._focusedRow<0||this._focusedRow>=t.length)return;const o=t[this._focusedRow];o.hasChildren&&this._collapsed.has(o.node.item.id)&&(e.preventDefault(),this._toggleExpand(o.node.item.id));return}case"ArrowLeft":{if(this._focusedRow<0||this._focusedRow>=t.length)return;const o=t[this._focusedRow];o.hasChildren&&!this._collapsed.has(o.node.item.id)&&(e.preventDefault(),this._toggleExpand(o.node.item.id));return}case"Enter":case" ":{if(this._focusedRow<0||this._focusedRow>=t.length)return;e.preventDefault();const o=t[this._focusedRow];this._toggleSelection(o.node.item.id);return}case"Escape":e.preventDefault(),this.closePicker()}}_scrollFocusedIntoView(){queueMicrotask(()=>{const e=this.shadowRoot?.querySelector(".os-cat__tree");if(!e)return;const t=e.querySelector('.os-cat__row[data-focused="true"]');if(!t)return;const o=t.getBoundingClientRect(),s=e.getBoundingClientRect();o.top<s.top?t.scrollIntoView({block:"nearest"}):o.bottom>s.bottom&&t.scrollIntoView({block:"nearest"})})}_positionPopover(){const e=this.shadowRoot?.querySelector(".os-cat__popover");if(!e)return;const t=this.getBoundingClientRect(),o=e.getBoundingClientRect(),s=window.innerWidth,a=window.innerHeight,r=8;let n=t.bottom+4;const l=n+o.height+r>a,c=t.top-4-o.height>=r;l&&c?n=t.top-4-o.height:l&&(n=Math.max(r,a-o.height-r));let d=t.left;d+o.width+r>s&&(d=t.right-o.width),d=Math.max(r,Math.min(d,s-o.width-r)),e.style.top=`${n}px`,e.style.left=`${d}px`}};W.props=["placeholder","add-label","disabled","readonly","open","loading","max-visible"],W.styles=[io],W.help=void 0;let be=W;S("os-category-picker",be);function Ye(){return E("chevron-right",{size:14})}function wo(){return E("plus",{size:16})}function ko(){return E("check",{size:null})}function Co(){return E("close",{size:null})}function $o(i){return i.categories.tree||(i.categories.tree=i.client.fetchAllCategories().then(e=>e.map(t=>({id:t.id,name:t.name,parent:t.parent})))),i.categories.tree}function Qe(i){i.categories.tree=null}function So(i){$o(i).then(e=>{for(const t of i.categories.pickers)t.isConnected?t.items=e:i.categories.pickers.delete(t)}).catch(()=>{})}function Ao(i,e){i.parentTitles.clear();for(const t of e)i.parentTitles.set(t.id,qe(t))}function Eo(i,e){const t=document.createElement("span"),o=typeof i.parent=="number"?i.parent:0;if(o===0)return t.textContent="—",t.setAttribute("aria-label",p("Top-level page")),t;const s=e.parentTitles.get(o);return t.textContent=s?`↳ ${s}`:P(p("↳ #%d"),o),t}function Po(i,e){const t=document.createElement("span"),o=typeof i.template=="string"?i.template:"",s=e.extra.pageTemplates??{};return t.textContent=s[o]??(o===""?p("Default template"):o),o!==""&&(t.title=o),t}function To(i,e){const t=document.createElement("button");t.type="button";const o=typeof i.slug=="string"?i.slug:"";return t.textContent=o||"—",t.disabled=o==="",t.title=o?p("Click to copy slug"):"",Object.assign(t.style,{appearance:"none",background:"transparent",border:"none",padding:"2px 6px",font:"inherit",color:"inherit",cursor:o?"copy":"default",textAlign:"left",fontFamily:'ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace',fontSize:"12px",borderRadius:"4px",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),t.addEventListener("click",s=>{s.stopPropagation(),o&&yt(o).then(a=>{if(!a){e.toast(p("Couldn’t copy the slug."),null);return}t.textContent=p("Copied!"),t.style.color="var(--wp-admin-theme-color, #2271b1)",setTimeout(()=>{t.textContent=o,t.style.color=""},1200)})}),t}function Ro(i){const e=document.createElement("span");Object.assign(e.style,{display:"inline-flex",alignItems:"center",gap:"6px",fontVariantNumeric:"tabular-nums"});const t=typeof i.openstation_comment_count=="number"?i.openstation_comment_count:null;if(t===null)return e.textContent="—",e.style.color="var(--os-ui-fg-muted, #8c8f94)",e;const o=document.createElement("span");o.className="dashicons dashicons-admin-comments",o.setAttribute("aria-hidden","true"),Object.assign(o.style,{fontSize:"16px",width:"16px",height:"16px",color:t>0?"var(--wp-admin-theme-color, #2271b1)":"var(--os-ui-fg-muted, #8c8f94)"});const s=document.createElement("span");return s.textContent=String(t),t===0&&(s.style.color="var(--os-ui-fg-muted, #8c8f94)"),e.appendChild(o),e.appendChild(s),e.setAttribute("aria-label",P(ae("%d comment","%d comments",t),t)),e}const Lo=x` ${te} ${We}:host{display:block;--_bg:var( --os-ui-table-bg,var( --os-ui-surface,#fff ) );--_border:var( --os-ui-table-border,var( --os-ui-border,rgba( 0,0,0,0.08 ) ) );--_column-border:var( --os-ui-table-column-border,var( --os-ui-border-strong,rgba( 0,0,0,0.14 ) ) );--_header-bg:var( --os-ui-table-header-bg,var( --os-ui-surface-elevated,#f6f7f7 ) );--_row-hover:var( --os-ui-table-row-hover,var( --os-ui-hover,rgba( 0,0,0,0.04 ) ) );--_stripe:var( --os-ui-table-stripe,var( --os-ui-surface-subtle,rgba( 0,0,0,0.03 ) ) );--_cell-padding:var( --os-ui-table-cell-padding,8px 12px );--_font-size:var( --os-ui-table-font-size,13px );--_max-height:var( --os-ui-table-max-height,none );font-size:var( --_font-size );color:inherit}:host( [ hidden ] ){display:none}.scroll{position:relative;overflow:auto;max-height:var( --_max-height );border:1px solid var( --_border );border-radius:4px;background:var( --_bg )}table{width:100%;border-collapse:separate;border-spacing:0;background:var( --_bg )}thead th{text-align:start;font-weight:600;background-color:var( --_header-bg );background-image:var( --os-ui-table-header-bg-image,none );background-repeat:var( --os-ui-table-header-bg-image-repeat,repeat );background-size:var( --os-ui-table-header-bg-image-size,auto );background-position:var( --os-ui-table-header-bg-image-position,center );padding:var( --_cell-padding );border-bottom:1px solid var( --_border );white-space:nowrap}tbody td{padding:var( --_cell-padding );border-bottom:1px solid var( --_border );background-color:var( --_bg );vertical-align:middle}tbody tr:last-child td{border-bottom:0}:host( [ striped ] ) tbody tr:nth-child( odd ) td{background-image:linear-gradient( var( --_stripe ),var( --_stripe ) )}:host( [ hover ] ) tbody tr:hover td{background-image:linear-gradient( var( --_row-hover ),var( --_row-hover ) )}:host( [ hover ][ striped ] ) tbody tr:nth-child( odd ):hover td{background-image:linear-gradient( var( --_row-hover ),var( --_row-hover ) ),linear-gradient( var( --_stripe ),var( --_stripe ) )}:host( [ compact ] ){--os-ui-table-cell-padding:4px 8px;--os-ui-table-font-size:12px}:host( [ bordered ] ) thead th,:host( [ bordered ] ) tbody td{border-inline-end:1px solid var( --_column-border )}:host( [ bordered ] ) thead th:last-child,:host( [ bordered ] ) tbody td:last-child{border-inline-end:0}th.is-sticky,td.is-sticky{position:sticky;z-index:10}tbody td.is-sticky{background-color:var( --_bg )}thead th.is-sticky{background-color:var( --_header-bg );background-image:var( --os-ui-table-header-bg-image,none );background-repeat:var( --os-ui-table-header-bg-image-repeat,repeat );background-size:var( --os-ui-table-header-bg-image-size,auto );background-position:var( --os-ui-table-header-bg-image-position,center );z-index:30}:host( [ sticky-header ] ) thead th{position:sticky;top:0;z-index:20}:host( [ sticky-header ] ) thead tr.filter-row th{top:var( --os-ui-table-header-height,33px );z-index:20}:host( [ sticky-header ] ) thead th.is-sticky{z-index:40}:host( [ sticky-header ] ) thead tr.filter-row th.is-sticky{z-index:40}th.is-sticky-edge,td.is-sticky-edge{border-inline-end:var( --os-ui-table-sticky-edge,2px solid var( --_border ) )}.align-center{text-align:center}.align-end{text-align:end}.filter-row th{padding:4px 8px;background-color:var( --_header-bg );background-image:var( --os-ui-table-header-bg-image,none );background-repeat:var( --os-ui-table-header-bg-image-repeat,repeat );background-size:var( --os-ui-table-header-bg-image-size,auto );background-position:var( --os-ui-table-header-bg-image-position,center );border-bottom:1px solid var( --_border );font-weight:400}.filter-input,.filter-select{width:100%;min-width:60px;box-sizing:border-box;padding:4px 6px;font:inherit;color:inherit;background-color:var( --_bg );border:1px solid var( --_border );border-radius:3px}.filter-input:focus,.filter-select:focus{outline:none;border-color:var( --os-ui-accent,#2271b1 );box-shadow:var( --_holo-focus-field )}.expander{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;padding:0;border:0;background:transparent;color:inherit;cursor:pointer;border-radius:3px;font-size:11px;line-height:1}.expander:hover{background:var( --os-ui-hover,rgba( 0,0,0,0.06 ) )}td.col-expander,th.col-expander{width:36px;min-width:36px;padding-left:0;padding-right:0;text-align:center}tr.subtable td{padding:0;background-color:var( --_bg );background-image:linear-gradient( var( --_stripe ),var( --_stripe ) );border-bottom:1px solid var( --_border )}tr.subtable .subtable-inner{padding:8px 12px 8px 32px}tr.empty td{padding:24px;text-align:center;color:var( --os-ui-text-muted,var( --os-ui-fg-muted,rgba( 0,0,0,0.55 ) ) );font-style:italic}thead th.is-sortable{cursor:pointer;user-select:none}thead th.is-sortable:hover{background-image:linear-gradient( var( --_row-hover ),var( --_row-hover ) )}thead th.is-sortable:focus-visible{outline:none;box-shadow:inset 0 0 0 2px var( --os-ui-accent,#2271b1 )}.sort-indicator{font-size:10px;color:var( --os-ui-text-muted,var( --os-ui-fg-muted,rgba( 0,0,0,0.55 ) ) );margin-inline-start:2px}thead th.sort-asc .sort-indicator,thead th.sort-desc .sort-indicator{color:var( --wp-admin-theme-color,#2271b1 )}td.col-select,th.col-select{width:40px;min-width:40px;padding-left:0;padding-right:0;text-align:center}.select-all-checkbox,.select-row-checkbox{cursor:pointer;margin:0}tbody tr.is-selected td{background-color:color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 10%,var( --_bg ) );background-image:none}tbody tr.is-selected:hover td{background-color:color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 16%,var( --_bg ) )}tbody tr.is-selected td:first-child{box-shadow:inset 3px 0 0 0 var( --os-ui-accent,#2271b1 )}tbody:dir( rtl ) tr.is-selected td:first-child{box-shadow:inset -3px 0 0 0 var( --os-ui-accent,#2271b1 )}:host( [ stacked ] ) .scroll{border:0;border-radius:0}:host( [ stacked ] ) table,:host( [ stacked ] ) tbody{display:block;width:100%}:host( [ stacked ] ) colgroup,:host( [ stacked ] ) thead{display:none}:host( [ stacked ] ) tbody tr{display:flex;align-items:flex-start;gap:12px;padding:12px 14px;border-bottom:1px solid var( --_border );background-color:var( --_bg )}:host( [ stacked ] ) tbody tr:last-child{border-bottom:0}:host( [ stacked ] ) tbody td{display:block;padding:0;border:0;background-color:transparent;background-image:none;box-shadow:none;min-width:0;width:auto;vertical-align:baseline}:host( [ stacked ] ) tbody tr.is-selected td,:host( [ stacked ] ) tbody tr.is-selected:hover td,:host( [ stacked ][ striped ] ) tbody tr:nth-child( odd ) td,:host( [ stacked ][ hover ] ) tbody tr:hover td,:host( [ stacked ][ hover ][ striped ] ) tbody tr:nth-child( odd ):hover td,:host( [ stacked ][ bordered ] ) tbody td{padding:0;border:0;background-color:transparent;background-image:none;box-shadow:none}:host( [ stacked ][ hover ] ) tbody tr:hover{background-image:linear-gradient( var( --_row-hover ),var( --_row-hover ) )}:host( [ stacked ] ) tbody tr.is-selected,:host( [ stacked ] ) tbody tr.is-selected:hover{background-color:color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 10%,var( --_bg ) );background-image:none;box-shadow:inset 3px 0 0 0 var( --os-ui-accent,#2271b1 )}:host( [ stacked ] ) tbody:dir( rtl ) tr.is-selected{box-shadow:inset -3px 0 0 0 var( --os-ui-accent,#2271b1 )}:host( [ stacked ] ) tbody td.col-select,:host( [ stacked ] ) tbody td.col-expander{flex:0 0 auto;display:flex;align-items:center;justify-content:center;min-width:0}:host( [ stacked ] ) tbody td.col-select{width:44px;height:44px;margin:-11px 0 -11px -11px;cursor:pointer}:host( [ stacked ] ) .select-row-checkbox{width:22px;height:22px}:host( [ stacked ] ) tbody td.col-expander{width:28px;height:22px;margin-inline-start:-4px}:host( [ stacked ] ) tbody td.stack-body{flex:1 1 auto;display:flex;flex-direction:column;gap:4px;min-width:0}.stack-cell{display:flex;align-items:baseline;gap:6px;min-width:0;line-height:1.4}.stack-title{font-size:15px;font-weight:600;line-height:1.35}.stack-meta{font-size:13px}.stack-label{flex:0 0 auto;font-size:12px;color:var( --os-ui-text-muted,var( --os-ui-fg-muted,rgba( 0,0,0,0.55 ) ) )}.stack-label::after{content:'·';margin-inline-start:6px}.stack-value{flex:1 1 auto;min-width:0;display:flex;align-items:center;flex-wrap:wrap;gap:6px}.stack-actions{margin-block-start:6px}.stack-actions .stack-value{gap:8px}.stack-actions .stack-value>*{justify-content:flex-start;max-width:100%}:host( [ stacked ] ) tr.subtable,:host( [ stacked ] ) tr.empty{display:block;padding:0}:host( [ stacked ] ) tr.subtable td{background-image:linear-gradient( var( --_stripe ),var( --_stripe ) )}:host( [ stacked ] ) tr.subtable .subtable-inner{padding:8px 14px 12px}:host( [ stacked ] ) tr.empty td{padding:24px}:host( [ stacked ] ) tr.skeleton{display:block;padding:14px;border-bottom:1px solid var( --_border )}:host( [ stacked ] ) tr.skeleton td.stack-body{gap:8px}:host( [ stacked ] ) tr.skeleton .skeleton-bar:first-child{height:15px}tbody tr.skeleton td{padding:var( --_cell-padding )}.skeleton-bar{display:block;height:12px;border-radius:3px;background:linear-gradient( 90deg,var( --os-ui-table-skeleton-color,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) ) 0%,var( --os-ui-table-skeleton-highlight,var( --os-ui-hover,rgba( 0,0,0,0.14 ) ) ) 50%,var( --os-ui-table-skeleton-color,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) ) 100% );background-size:200% 100%;animation:os-table-skeleton-pulse 1.4s ease-in-out infinite}@keyframes os-table-skeleton-pulse{0%{background-position:200% 50%}100%{background-position:-200% 50%}}@media ( prefers-reduced-motion:reduce ){.skeleton-bar{animation:none}}`,M="__wpd_expander__",z="__wpd_select__",K=class K extends k{constructor(){super(...arguments),this._data=[],this._columns=[],this._filters={},this._expanded=new Set,this._subTable=null,this._sort=null,this._selection=new Set,this._getRowId=(e,t)=>t,this._filterCache=new Map,this._paintScheduled=!1,this._stacked=!1,this._stickyHeaderWarned=!1,this._stickyRaceWarned=!1,this._resizeObserver=null,this._stickyMicroScheduled=!1,this._stickyRafHandle=null,this._loadingDesyncWarned=!1,this._lastStickyIndex=-1}get data(){return this._data}set data(e){this._data=Array.isArray(e)?e.slice():[],this._expanded.clear(),this._schedulePaint()}get columns(){return this._columns}set columns(e){this._columns=Array.isArray(e)?e.slice():[];const t=new Set(this._columns.map(o=>o.key));for(const o of Object.keys(this._filters))t.has(o)||delete this._filters[o];for(const o of Array.from(this._filterCache.keys()))t.has(o)||this._filterCache.delete(o);this._sort&&!t.has(this._sort.key)&&(this._sort=null),this._schedulePaint()}get filters(){return{...this._filters}}set filters(e){this._filters=e?{...e}:{},this._schedulePaint()}get sort(){return this._sort?{...this._sort}:null}set sort(e){this._sort=e?{...e}:null,this._schedulePaint()}get selection(){return new Set(this._selection)}set selection(e){this._selection=new Set(e??[]),this._schedulePaint()}get selectedRows(){const e=[];return this._data.forEach((t,o)=>{this._selection.has(this._getRowId(t,o))&&e.push(t)}),e}get visibleRows(){return this._filteredRows().map(e=>e.row)}get getRowId(){return this._getRowId}set getRowId(e){this._getRowId=typeof e=="function"?e:(t,o)=>o,this._schedulePaint()}get subTable(){return this._subTable}set subTable(e){this._subTable=typeof e=="function"?e:null,this._expanded.clear(),this._schedulePaint()}get expanded(){return new Set(this._expanded)}set expanded(e){this._expanded=new Set(e??[]),this._schedulePaint()}expand(e){e<0||e>=this._data.length||this._expanded.has(e)||(this._expanded.add(e),this.emit("os-table-expand-change",{row:this._data[e],index:e,expanded:!0}),this._schedulePaint())}collapse(e){this._expanded.has(e)&&(this._expanded.delete(e),this.emit("os-table-expand-change",{row:this._data[e],index:e,expanded:!1}),this._schedulePaint())}expandAll(){if(!this._subTable)return;let e=!1;for(let t=0;t<this._data.length;t++)this._subTable(this._data[t],t)&&(this._expanded.has(t)||(this._expanded.add(t),e=!0));e&&this._schedulePaint()}collapseAll(){this._expanded.size!==0&&(this._expanded.clear(),this._schedulePaint())}isExpanded(e){return this._expanded.has(e)}clearFilters(){Object.keys(this._filters).length!==0&&(this._filters={},this.emit("os-table-filter-change",{filters:{}}),this._schedulePaint())}clearSort(){this._sort!==null&&(this._sort=null,this.emit("os-table-sort-change",{sort:null}),this._schedulePaint())}select(e){if(this._selection.has(e))return;const t=this._readSelectable(),o=t==="single"?Array.from(this._selection):[];t==="single"&&this._selection.clear(),this._selection.add(e),this._emitSelectionChange(),this._syncSelectionDom([e,...o])}deselect(e){this._selection.delete(e)&&(this._emitSelectionChange(),this._syncSelectionDom([e]))}selectAll(){if(this._readSelectable()==="multi"){for(const{row:e,index:t}of this._filteredRows())this._selection.add(this._getRowId(e,t));this._emitSelectionChange(),this._syncSelectionDom("all")}}clearSelection(){this._selection.size!==0&&(this._selection.clear(),this._emitSelectionChange(),this._syncSelectionDom("all"))}_syncSelectionDom(e){const t=this.shadowRoot;if(!t)return;const o=t.querySelector("tbody");if(!o)return;let s=null;if(e!=="all"){s=new Set;for(const n of e)s.add(String(n))}const a=o.querySelectorAll("tr[data-row-id]");for(const n of a){const l=n.dataset.rowId;if(l===void 0||s&&!s.has(l))continue;const c=Number(n.dataset.rowIndex);if(!Number.isFinite(c))continue;const d=this._data[c];if(d===void 0)continue;const u=this._getRowId(d,c),h=this._selection.has(u);n.classList.toggle("is-selected",h);const g=n.querySelector("input.select-row-checkbox");g&&g.checked!==h&&(g.checked=h)}const r=t.querySelector("thead .select-all-checkbox");if(r){const{total:n,selected:l}=this._visibleSelectionStats();r.checked=n>0&&l===n,r.indeterminate=l>0&&l<n}}scrollToRow(e){const t=this.shadowRoot;if(!t)return;const s=t.querySelectorAll("tbody tr:not(.subtable):not(.empty):not(.skeleton)")[e];s&&s.scrollIntoView({block:"nearest",inline:"nearest"})}connectedCallback(){super.connectedCallback(),this._schedulePaint()}disconnectedCallback(){this._resizeObserver?.disconnect(),this._resizeObserver=null,this._stickyRafHandle!==null&&typeof cancelAnimationFrame<"u"&&(cancelAnimationFrame(this._stickyRafHandle),this._stickyRafHandle=null)}recomputeLayout(){this._applyStickyOffsets(),this._measureHeaderHeight()}render(){return f` | |
| 198 | + `}_onCreateInput(e,t){const o=e.target.value;o===""?this._creatingValues.delete(t):this._creatingValues.set(t,o),this.requestUpdate()}_onCreateKeydown(e,t){if(e.key==="Escape"){e.preventDefault(),this._creatingValues.delete(t),this.requestUpdate();return}e.key==="Enter"&&(e.preventDefault(),this._submitCreate(t))}_submitCreate(e){const t=(this._creatingValues.get(e)??"").trim();!t||this._creatingPending.has(e)||(this._creatingPending.add(e),this.requestUpdate(),this.emit("os-categories-create",{name:t,parent:e}))}endCreating(e=0){this._creatingPending.delete(e),this._creatingValues.delete(e),this.requestUpdate()}failCreating(e=0,t){this._creatingPending.delete(e),this.requestUpdate()}_buildTree(){const e=new Map;for(const a of this._items)e.set(a.id,{item:a,children:[],depth:0});const t=[];for(const a of e.values()){const n=a.item.parent;n&&e.has(n)?e.get(n).children.push(a):t.push(a)}const o=(a,n)=>{a.depth=n;for(const r of a.children)o(r,n+1)};for(const a of t)o(a,0);const i=a=>{a.sort((n,r)=>{const l=Me(n.item),c=Me(r.item);return l!==c?l?-1:1:n.item.name.localeCompare(r.item.name)});for(const n of a)i(n.children)};return i(t),t}_filterTree(e,t){const o=t.trim().toLowerCase();if(!o)return e;const i=a=>{if(a.item.name.toLowerCase().includes(o))return{item:a.item,children:a.children.slice(),depth:a.depth};const r=a.children.map(i).filter(l=>l!==null);return r.length>0?{item:a.item,children:r,depth:a.depth}:null};return e.map(i).filter(a=>a!==null)}_flattenForDisplay(e){const t=[],o=this._query.trim()!=="",i=a=>{for(const n of a)t.push({node:n,visible:!0,hasChildren:n.children.length>0}),!(this._collapsed.has(n.item.id)&&!o)&&n.children.length>0&&i(n.children)};return i(e),t}_selectedItemsInOrder(){const e=new Map;for(const i of this._items)e.set(i.id,i);const t=[],o=[];for(const i of this._value){const a=e.get(i);a&&(a.name.toLowerCase()===Kt||a.id===1?o.push(a):t.push(a))}return t.length>0?t:o.length>0?[]:t}_highlight(e,t){const o=t.trim();if(!o)return e;const i=e.toLowerCase(),a=o.toLowerCase(),n=i.indexOf(a);return n===-1?e:b`${e.slice(0,n)}<span class="os-cat__match" | |
| 199 | + >${e.slice(n,n+o.length)}</span | |
| 200 | + >${e.slice(n+o.length)}`}_toggleSelection(e){const t=this._value.includes(e)?this._value.filter(o=>o!==e):[...this._value,e];this.emit("os-categories-change",{value:t})}_onDeleteClick(e,t){e.stopPropagation(),e.preventDefault(),this.emit("os-categories-delete",{id:t.id,name:t.name})}_toggleExpand(e){this._collapsed.has(e)?this._collapsed.delete(e):this._collapsed.add(e),this.requestUpdate()}_onSearchInput(e){this._query=e.target.value,this._focusedRow=0,this.requestUpdate()}_onSearchKeydown(e,t){switch(e.key){case"ArrowDown":{if(t.length===0)return;e.preventDefault(),this._focusedRow=this._focusedRow+1>=t.length?0:this._focusedRow+1,this.requestUpdate(),this._scrollFocusedIntoView();return}case"ArrowUp":{if(t.length===0)return;e.preventDefault(),this._focusedRow=this._focusedRow<=0?t.length-1:this._focusedRow-1,this.requestUpdate(),this._scrollFocusedIntoView();return}case"ArrowRight":{if(this._focusedRow<0||this._focusedRow>=t.length)return;const o=t[this._focusedRow];o.hasChildren&&this._collapsed.has(o.node.item.id)&&(e.preventDefault(),this._toggleExpand(o.node.item.id));return}case"ArrowLeft":{if(this._focusedRow<0||this._focusedRow>=t.length)return;const o=t[this._focusedRow];o.hasChildren&&!this._collapsed.has(o.node.item.id)&&(e.preventDefault(),this._toggleExpand(o.node.item.id));return}case"Enter":case" ":{if(this._focusedRow<0||this._focusedRow>=t.length)return;e.preventDefault();const o=t[this._focusedRow];this._toggleSelection(o.node.item.id);return}case"Escape":e.preventDefault(),this.closePicker()}}_scrollFocusedIntoView(){queueMicrotask(()=>{const e=this.shadowRoot?.querySelector(".os-cat__tree");if(!e)return;const t=e.querySelector('.os-cat__row[data-focused="true"]');if(!t)return;const o=t.getBoundingClientRect(),i=e.getBoundingClientRect();o.top<i.top?t.scrollIntoView({block:"nearest"}):o.bottom>i.bottom&&t.scrollIntoView({block:"nearest"})})}_positionPopover(){const e=this.shadowRoot?.querySelector(".os-cat__popover");if(!e)return;const t=this.getBoundingClientRect(),o=e.getBoundingClientRect(),i=window.innerWidth,a=window.innerHeight,n=8;let r=t.bottom+4;const l=r+o.height+n>a,c=t.top-4-o.height>=n;l&&c?r=t.top-4-o.height:l&&(r=Math.max(n,a-o.height-n));let d=t.left;d+o.width+n>i&&(d=t.right-o.width),d=Math.max(n,Math.min(d,i-o.width-n)),e.style.top=`${r}px`,e.style.left=`${d}px`}};xe.props=["placeholder","add-label","disabled","readonly","open","loading","max-visible"],xe.styles=[ko],xe.help=void 0;let tt=xe;W("os-category-picker",tt);function Bt(){return Y("chevron-right",{size:14})}function Do(){return Y("plus",{size:16})}function Ho(){return Y("check",{size:null})}function Fo(){return Y("close",{size:null})}function Uo(s){return s.categories.tree||(s.categories.tree=s.client.fetchAllCategories().then(e=>e.map(t=>({id:t.id,name:t.name,parent:t.parent})))),s.categories.tree}function Gt(s){s.categories.tree=null}function Vo(s){Uo(s).then(e=>{for(const t of s.categories.pickers)t.isConnected?t.items=e:s.categories.pickers.delete(t)}).catch(()=>{})}function Zt(s,e){s.parentTitles.clear();for(const t of e)s.parentTitles.set(t.id,le(t))}function Wo(s,e){const t=document.createElement("span"),o=typeof s.parent=="number"?s.parent:0;if(o===0)return t.textContent="—",t.setAttribute("aria-label",u("Top-level page")),t;const i=e.parentTitles.get(o);return t.textContent=i?`↳ ${i}`:H(u("↳ #%d"),o),t}function jo(s,e){const t=document.createElement("span"),o=typeof s.template=="string"?s.template:"",i=e.extra.pageTemplates??{};return t.textContent=i[o]??(o===""?u("Default template"):o),o!==""&&(t.title=o),t}function Ko(s,e){const t=document.createElement("button");t.type="button";const o=typeof s.slug=="string"?s.slug:"";return t.textContent=o||"—",t.disabled=o==="",t.title=o?u("Click to copy slug"):"",Object.assign(t.style,{appearance:"none",background:"transparent",border:"none",padding:"2px 6px",font:"inherit",color:"inherit",cursor:o?"copy":"default",textAlign:"left",fontFamily:'ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace',fontSize:"12px",borderRadius:"4px",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),t.addEventListener("click",i=>{i.stopPropagation(),o&&$t(o).then(a=>{if(!a){e.toast(u("Couldn’t copy the slug."),null);return}t.textContent=u("Copied!"),t.style.color="var(--wp-admin-theme-color, #2271b1)",setTimeout(()=>{t.textContent=o,t.style.color=""},1200)})}),t}function Bo(s){const e=document.createElement("span");Object.assign(e.style,{display:"inline-flex",alignItems:"center",gap:"6px",fontVariantNumeric:"tabular-nums"});const t=typeof s.openstation_comment_count=="number"?s.openstation_comment_count:null;if(t===null)return e.textContent="—",e.style.color="var(--os-ui-fg-muted, #8c8f94)",e;const o=document.createElement("span");o.className="dashicons dashicons-admin-comments",o.setAttribute("aria-hidden","true"),Object.assign(o.style,{fontSize:"16px",width:"16px",height:"16px",color:t>0?"var(--wp-admin-theme-color, #2271b1)":"var(--os-ui-fg-muted, #8c8f94)"});const i=document.createElement("span");return i.textContent=String(t),t===0&&(i.style.color="var(--os-ui-fg-muted, #8c8f94)"),e.appendChild(o),e.appendChild(i),e.setAttribute("aria-label",H(Fe("%d comment","%d comments",t),t)),e}const Go=R` ${fe} ${Je}:host{display:block;--_bg:var( --os-ui-table-bg,var( --os-ui-surface,#fff ) );--_border:var( --os-ui-table-border,var( --os-ui-border,rgba( 0,0,0,0.08 ) ) );--_column-border:var( --os-ui-table-column-border,var( --os-ui-border-strong,rgba( 0,0,0,0.14 ) ) );--_header-bg:var( --os-ui-table-header-bg,var( --os-ui-surface-elevated,#f6f7f7 ) );--_row-hover:var( --os-ui-table-row-hover,var( --os-ui-hover,rgba( 0,0,0,0.04 ) ) );--_stripe:var( --os-ui-table-stripe,var( --os-ui-surface-subtle,rgba( 0,0,0,0.03 ) ) );--_cell-padding:var( --os-ui-table-cell-padding,8px 12px );--_font-size:var( --os-ui-table-font-size,13px );--_max-height:var( --os-ui-table-max-height,none );font-size:var( --_font-size );color:inherit}:host( [ hidden ] ){display:none}.scroll{position:relative;overflow:auto;max-height:var( --_max-height );border:1px solid var( --_border );border-radius:4px;background:var( --_bg )}table{width:100%;border-collapse:separate;border-spacing:0;background:var( --_bg )}thead th{text-align:start;font-weight:600;background-color:var( --_header-bg );background-image:var( --os-ui-table-header-bg-image,none );background-repeat:var( --os-ui-table-header-bg-image-repeat,repeat );background-size:var( --os-ui-table-header-bg-image-size,auto );background-position:var( --os-ui-table-header-bg-image-position,center );padding:var( --_cell-padding );border-bottom:1px solid var( --_border );white-space:nowrap}tbody td{padding:var( --_cell-padding );border-bottom:1px solid var( --_border );background-color:var( --_bg );vertical-align:middle}tbody tr:last-child td{border-bottom:0}:host( [ striped ] ) tbody tr:nth-child( odd ) td{background-image:linear-gradient( var( --_stripe ),var( --_stripe ) )}:host( [ hover ] ) tbody tr:hover td{background-image:linear-gradient( var( --_row-hover ),var( --_row-hover ) )}:host( [ hover ][ striped ] ) tbody tr:nth-child( odd ):hover td{background-image:linear-gradient( var( --_row-hover ),var( --_row-hover ) ),linear-gradient( var( --_stripe ),var( --_stripe ) )}:host( [ compact ] ){--os-ui-table-cell-padding:4px 8px;--os-ui-table-font-size:12px}:host( [ bordered ] ) thead th,:host( [ bordered ] ) tbody td{border-inline-end:1px solid var( --_column-border )}:host( [ bordered ] ) thead th:last-child,:host( [ bordered ] ) tbody td:last-child{border-inline-end:0}th.is-sticky,td.is-sticky{position:sticky;z-index:10}tbody td.is-sticky{background-color:var( --_bg )}thead th.is-sticky{background-color:var( --_header-bg );background-image:var( --os-ui-table-header-bg-image,none );background-repeat:var( --os-ui-table-header-bg-image-repeat,repeat );background-size:var( --os-ui-table-header-bg-image-size,auto );background-position:var( --os-ui-table-header-bg-image-position,center );z-index:30}:host( [ sticky-header ] ) thead th{position:sticky;top:0;z-index:20}:host( [ sticky-header ] ) thead tr.filter-row th{top:var( --os-ui-table-header-height,33px );z-index:20}:host( [ sticky-header ] ) thead th.is-sticky{z-index:40}:host( [ sticky-header ] ) thead tr.filter-row th.is-sticky{z-index:40}th.is-sticky-edge,td.is-sticky-edge{border-inline-end:var( --os-ui-table-sticky-edge,2px solid var( --_border ) )}.align-center{text-align:center}.align-end{text-align:end}.filter-row th{padding:4px 8px;background-color:var( --_header-bg );background-image:var( --os-ui-table-header-bg-image,none );background-repeat:var( --os-ui-table-header-bg-image-repeat,repeat );background-size:var( --os-ui-table-header-bg-image-size,auto );background-position:var( --os-ui-table-header-bg-image-position,center );border-bottom:1px solid var( --_border );font-weight:400}.filter-input,.filter-select{width:100%;min-width:60px;box-sizing:border-box;padding:4px 6px;font:inherit;color:inherit;background-color:var( --_bg );border:1px solid var( --_border );border-radius:3px}.filter-input:focus,.filter-select:focus{outline:none;border-color:var( --os-ui-accent,#2271b1 );box-shadow:var( --_holo-focus-field )}.expander{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;padding:0;border:0;background:transparent;color:inherit;cursor:pointer;border-radius:3px;font-size:11px;line-height:1}.expander:hover{background:var( --os-ui-hover,rgba( 0,0,0,0.06 ) )}td.col-expander,th.col-expander{width:36px;min-width:36px;padding-left:0;padding-right:0;text-align:center}tr.subtable td{padding:0;background-color:var( --_bg );background-image:linear-gradient( var( --_stripe ),var( --_stripe ) );border-bottom:1px solid var( --_border )}tr.subtable .subtable-inner{padding:8px 12px 8px 32px}tr.empty td{padding:24px;text-align:center;color:var( --os-ui-text-muted,var( --os-ui-fg-muted,rgba( 0,0,0,0.55 ) ) );font-style:italic}thead th.is-sortable{cursor:pointer;user-select:none}thead th.is-sortable:hover{background-image:linear-gradient( var( --_row-hover ),var( --_row-hover ) )}thead th.is-sortable:focus-visible{outline:none;box-shadow:inset 0 0 0 2px var( --os-ui-accent,#2271b1 )}.sort-indicator{font-size:10px;color:var( --os-ui-text-muted,var( --os-ui-fg-muted,rgba( 0,0,0,0.55 ) ) );margin-inline-start:2px}thead th.sort-asc .sort-indicator,thead th.sort-desc .sort-indicator{color:var( --wp-admin-theme-color,#2271b1 )}td.col-select,th.col-select{width:40px;min-width:40px;padding-left:0;padding-right:0;text-align:center}.select-all-checkbox,.select-row-checkbox{cursor:pointer;margin:0}tbody tr.is-selected td{background-color:color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 10%,var( --_bg ) );background-image:none}tbody tr.is-selected:hover td{background-color:color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 16%,var( --_bg ) )}tbody tr.is-selected td:first-child{box-shadow:inset 3px 0 0 0 var( --os-ui-accent,#2271b1 )}tbody:dir( rtl ) tr.is-selected td:first-child{box-shadow:inset -3px 0 0 0 var( --os-ui-accent,#2271b1 )}:host( [ stacked ] ) .scroll{border:0;border-radius:0}:host( [ stacked ] ) table,:host( [ stacked ] ) tbody{display:block;width:100%}:host( [ stacked ] ) colgroup,:host( [ stacked ] ) thead{display:none}:host( [ stacked ] ) tbody tr{display:flex;align-items:flex-start;gap:12px;padding:12px 14px;border-bottom:1px solid var( --_border );background-color:var( --_bg )}:host( [ stacked ] ) tbody tr:last-child{border-bottom:0}:host( [ stacked ] ) tbody td{display:block;padding:0;border:0;background-color:transparent;background-image:none;box-shadow:none;min-width:0;width:auto;vertical-align:baseline}:host( [ stacked ] ) tbody tr.is-selected td,:host( [ stacked ] ) tbody tr.is-selected:hover td,:host( [ stacked ][ striped ] ) tbody tr:nth-child( odd ) td,:host( [ stacked ][ hover ] ) tbody tr:hover td,:host( [ stacked ][ hover ][ striped ] ) tbody tr:nth-child( odd ):hover td,:host( [ stacked ][ bordered ] ) tbody td{padding:0;border:0;background-color:transparent;background-image:none;box-shadow:none}:host( [ stacked ][ hover ] ) tbody tr:hover{background-image:linear-gradient( var( --_row-hover ),var( --_row-hover ) )}:host( [ stacked ] ) tbody tr.is-selected,:host( [ stacked ] ) tbody tr.is-selected:hover{background-color:color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 10%,var( --_bg ) );background-image:none;box-shadow:inset 3px 0 0 0 var( --os-ui-accent,#2271b1 )}:host( [ stacked ] ) tbody:dir( rtl ) tr.is-selected{box-shadow:inset -3px 0 0 0 var( --os-ui-accent,#2271b1 )}:host( [ stacked ] ) tbody td.col-select,:host( [ stacked ] ) tbody td.col-expander{flex:0 0 auto;display:flex;align-items:center;justify-content:center;min-width:0}:host( [ stacked ] ) tbody td.col-select{width:44px;height:44px;margin:-11px 0 -11px -11px;cursor:pointer}:host( [ stacked ] ) .select-row-checkbox{width:22px;height:22px}:host( [ stacked ] ) tbody td.col-expander{width:28px;height:22px;margin-inline-start:-4px}:host( [ stacked ] ) tbody td.stack-body{flex:1 1 auto;display:flex;flex-direction:column;gap:4px;min-width:0}.stack-cell{display:flex;align-items:baseline;gap:6px;min-width:0;line-height:1.4}.stack-title{font-size:15px;font-weight:600;line-height:1.35}.stack-meta{font-size:13px}.stack-label{flex:0 0 auto;font-size:12px;color:var( --os-ui-text-muted,var( --os-ui-fg-muted,rgba( 0,0,0,0.55 ) ) )}.stack-label::after{content:'·';margin-inline-start:6px}.stack-value{flex:1 1 auto;min-width:0;display:flex;align-items:center;flex-wrap:wrap;gap:6px}.stack-actions{margin-block-start:6px}.stack-actions .stack-value{gap:8px}.stack-actions .stack-value>*{justify-content:flex-start;max-width:100%}:host( [ stacked ] ) tr.subtable,:host( [ stacked ] ) tr.empty{display:block;padding:0}:host( [ stacked ] ) tr.subtable td{background-image:linear-gradient( var( --_stripe ),var( --_stripe ) )}:host( [ stacked ] ) tr.subtable .subtable-inner{padding:8px 14px 12px}:host( [ stacked ] ) tr.empty td{padding:24px}:host( [ stacked ] ) tr.skeleton{display:block;padding:14px;border-bottom:1px solid var( --_border )}:host( [ stacked ] ) tr.skeleton td.stack-body{gap:8px}:host( [ stacked ] ) tr.skeleton .skeleton-bar:first-child{height:15px}tbody tr.skeleton td{padding:var( --_cell-padding )}.skeleton-bar{display:block;height:12px;border-radius:3px;background:linear-gradient( 90deg,var( --os-ui-table-skeleton-color,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) ) 0%,var( --os-ui-table-skeleton-highlight,var( --os-ui-hover,rgba( 0,0,0,0.14 ) ) ) 50%,var( --os-ui-table-skeleton-color,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) ) 100% );background-size:200% 100%;animation:os-table-skeleton-pulse 1.4s ease-in-out infinite}@keyframes os-table-skeleton-pulse{0%{background-position:200% 50%}100%{background-position:-200% 50%}}@media ( prefers-reduced-motion:reduce ){.skeleton-bar{animation:none}}`,ce="__wpd_expander__",de="__wpd_select__",ye=class ye extends U{constructor(){super(...arguments),this._data=[],this._columns=[],this._filters={},this._expanded=new Set,this._subTable=null,this._sort=null,this._selection=new Set,this._getRowId=(e,t)=>t,this._filterCache=new Map,this._paintScheduled=!1,this._stacked=!1,this._stickyHeaderWarned=!1,this._stickyRaceWarned=!1,this._resizeObserver=null,this._stickyMicroScheduled=!1,this._stickyRafHandle=null,this._loadingDesyncWarned=!1,this._lastStickyIndex=-1}get data(){return this._data}set data(e){this._data=Array.isArray(e)?e.slice():[],this._expanded.clear(),this._schedulePaint()}get columns(){return this._columns}set columns(e){this._columns=Array.isArray(e)?e.slice():[];const t=new Set(this._columns.map(o=>o.key));for(const o of Object.keys(this._filters))t.has(o)||delete this._filters[o];for(const o of Array.from(this._filterCache.keys()))t.has(o)||this._filterCache.delete(o);this._sort&&!t.has(this._sort.key)&&(this._sort=null),this._schedulePaint()}get filters(){return{...this._filters}}set filters(e){this._filters=e?{...e}:{},this._schedulePaint()}get sort(){return this._sort?{...this._sort}:null}set sort(e){this._sort=e?{...e}:null,this._schedulePaint()}get selection(){return new Set(this._selection)}set selection(e){this._selection=new Set(e??[]),this._schedulePaint()}get selectedRows(){const e=[];return this._data.forEach((t,o)=>{this._selection.has(this._getRowId(t,o))&&e.push(t)}),e}get visibleRows(){return this._filteredRows().map(e=>e.row)}get getRowId(){return this._getRowId}set getRowId(e){this._getRowId=typeof e=="function"?e:(t,o)=>o,this._schedulePaint()}get subTable(){return this._subTable}set subTable(e){this._subTable=typeof e=="function"?e:null,this._expanded.clear(),this._schedulePaint()}get expanded(){return new Set(this._expanded)}set expanded(e){this._expanded=new Set(e??[]),this._schedulePaint()}expand(e){e<0||e>=this._data.length||this._expanded.has(e)||(this._expanded.add(e),this.emit("os-table-expand-change",{row:this._data[e],index:e,expanded:!0}),this._schedulePaint())}collapse(e){this._expanded.has(e)&&(this._expanded.delete(e),this.emit("os-table-expand-change",{row:this._data[e],index:e,expanded:!1}),this._schedulePaint())}expandAll(){if(!this._subTable)return;let e=!1;for(let t=0;t<this._data.length;t++)this._subTable(this._data[t],t)&&(this._expanded.has(t)||(this._expanded.add(t),e=!0));e&&this._schedulePaint()}collapseAll(){this._expanded.size!==0&&(this._expanded.clear(),this._schedulePaint())}isExpanded(e){return this._expanded.has(e)}clearFilters(){Object.keys(this._filters).length!==0&&(this._filters={},this.emit("os-table-filter-change",{filters:{}}),this._schedulePaint())}clearSort(){this._sort!==null&&(this._sort=null,this.emit("os-table-sort-change",{sort:null}),this._schedulePaint())}select(e){if(this._selection.has(e))return;const t=this._readSelectable(),o=t==="single"?Array.from(this._selection):[];t==="single"&&this._selection.clear(),this._selection.add(e),this._emitSelectionChange(),this._syncSelectionDom([e,...o])}deselect(e){this._selection.delete(e)&&(this._emitSelectionChange(),this._syncSelectionDom([e]))}selectAll(){if(this._readSelectable()==="multi"){for(const{row:e,index:t}of this._filteredRows())this._selection.add(this._getRowId(e,t));this._emitSelectionChange(),this._syncSelectionDom("all")}}clearSelection(){this._selection.size!==0&&(this._selection.clear(),this._emitSelectionChange(),this._syncSelectionDom("all"))}_syncSelectionDom(e){const t=this.shadowRoot;if(!t)return;const o=t.querySelector("tbody");if(!o)return;let i=null;if(e!=="all"){i=new Set;for(const r of e)i.add(String(r))}const a=o.querySelectorAll("tr[data-row-id]");for(const r of a){const l=r.dataset.rowId;if(l===void 0||i&&!i.has(l))continue;const c=Number(r.dataset.rowIndex);if(!Number.isFinite(c))continue;const d=this._data[c];if(d===void 0)continue;const p=this._getRowId(d,c),g=this._selection.has(p);r.classList.toggle("is-selected",g);const v=r.querySelector("input.select-row-checkbox");v&&v.checked!==g&&(v.checked=g)}const n=t.querySelector("thead .select-all-checkbox");if(n){const{total:r,selected:l}=this._visibleSelectionStats();n.checked=r>0&&l===r,n.indeterminate=l>0&&l<r}}scrollToRow(e){const t=this.shadowRoot;if(!t)return;const i=t.querySelectorAll("tbody tr:not(.subtable):not(.empty):not(.skeleton)")[e];i&&i.scrollIntoView({block:"nearest",inline:"nearest"})}connectedCallback(){super.connectedCallback(),this._schedulePaint()}disconnectedCallback(){this._resizeObserver?.disconnect(),this._resizeObserver=null,this._stickyRafHandle!==null&&typeof cancelAnimationFrame<"u"&&(cancelAnimationFrame(this._stickyRafHandle),this._stickyRafHandle=null)}recomputeLayout(){this._applyStickyOffsets(),this._measureHeaderHeight()}render(){return b` | |
| 234 | 201 | <div class="scroll" part="scroll"> |
| 235 | 202 | <table part="table"> |
| 236 | 203 | <colgroup></colgroup> |
| 237 | 204 | <thead></thead> |
| @@ -237,67 +204,67 @@ | ||
| 237 | 204 | <thead></thead> |
| 238 | 205 | <tbody></tbody> |
| 239 | 206 | </table> |
| 240 | 207 | </div> |
| 241 | - `}requestUpdate(){super.requestUpdate(),this._schedulePaint()}_schedulePaint(){this._paintScheduled||!this.isConnected||(this._paintScheduled=!0,queueMicrotask(()=>{this._paintScheduled=!1,this.isConnected&&this._paint()}))}_paint(){const e=this.shadowRoot;if(!e)return;e.querySelector("tbody")||I(this.render(),e);const t=e.querySelector("colgroup"),o=e.querySelector("thead"),s=e.querySelector("tbody");if(!t||!o||!s)return;const a=this._effectiveColumns();this._stacked=this.hasAttribute("stacked");const r=this._readStickyColumns();this._lastStickyIndex=this._computeLastStickyIndex(a,r),this._paintColgroup(t,a),this._paintHead(o,a,r),this._paintBody(s,a,r),this._applyStickyOffsets(),this._measureHeaderHeight(),this._scheduleStickyOffsets(),this._maybeWarnStickyHeader(),this._maybeWarnLoadingDesync(s),this._ensureResizeObserver()}_maybeWarnLoadingDesync(e){this._loadingDesyncWarned||this.hasAttribute("loading")&&(e.querySelector("tr.skeleton")||(this._loadingDesyncWarned=!0,console.warn("[os-table] `loading` attribute is set but no skeleton rows rendered. Either attributeChangedCallback didn't route through requestUpdate (framework regression), or `loading` was set after the most recent paint and no follow-up trigger ran. Toggling `data` will force a paint as a workaround.")))}_scheduleStickyOffsets(){this._stickyMicroScheduled||(this._stickyMicroScheduled=!0,queueMicrotask(()=>{this._stickyMicroScheduled=!1,this.isConnected&&this._applyStickyOffsets()})),this._stickyRafHandle===null&&typeof requestAnimationFrame<"u"&&(this._stickyRafHandle=requestAnimationFrame(()=>{this._stickyRafHandle=null,this.isConnected&&(this._applyStickyOffsets(),this._measureHeaderHeight())}))}_ensureResizeObserver(){if(this._resizeObserver||typeof ResizeObserver>"u")return;const e=this.shadowRoot?.querySelector(".scroll");e&&(this._resizeObserver=new ResizeObserver(()=>{this.isConnected&&(this._applyStickyOffsets(),this._measureHeaderHeight(),this._stickyHeaderWarned=!1,this._maybeWarnStickyHeader())}),this._resizeObserver.observe(e),this._resizeObserver.observe(this))}_paintColgroup(e,t){const o=[];for(const s of t){const a=document.createElement("col");s.width&&(a.style.width=s.width),o.push(a)}e.replaceChildren(...o)}_paintHead(e,t,o){const s=document.createElement("tr");s.setAttribute("part","header-row");for(let l=0;l<t.length;l++)s.appendChild(this._buildHeaderCell(t[l],l,o));const a=e.querySelector(':scope > tr[part="header-row"]');a?e.replaceChild(s,a):e.insertBefore(s,e.firstChild);const r=t.some(l=>l.filter||Array.isArray(l.filterOptions)||typeof l.filterRender=="function");let n=e.querySelector(":scope > tr.filter-row");if(r){const l=[];for(let u=0;u<t.length;u++)l.push(this._buildFilterCell(t[u],u,o));n||(n=document.createElement("tr"),n.classList.add("filter-row"),n.setAttribute("part","filter-row"),e.appendChild(n));const c=Array.from(n.children);let d=c.length===l.length;if(d){for(let u=0;u<l.length;u++)if(c[u]!==l[u]){d=!1;break}}if(!d){const u=new Set(l);for(const h of l)n.appendChild(h);for(const h of Array.from(n.children))u.has(h)||n.removeChild(h)}}else n&&n.remove()}_buildHeaderCell(e,t,o){const s=document.createElement("th");if(s.setAttribute("scope","col"),s.dataset.key=e.key,this._applyCellClasses(s,e,t,o),e.minWidth&&(s.style.minWidth=e.minWidth),e.key===z){if(this._readSelectable()==="multi"){const r=document.createElement("input");r.type="checkbox",r.className="select-all-checkbox",r.setAttribute("data-noclick",""),r.setAttribute("aria-label","Select all rows");const{total:n,selected:l}=this._visibleSelectionStats();r.checked=n>0&&l===n,r.indeterminate=l>0&&l<n,r.addEventListener("change",()=>{r.checked?this.selectAll():this.clearSelection()}),s.appendChild(r)}return s}if(s.textContent=e.label??(e.key===M?"":e.key),e.sortable){s.classList.add("is-sortable");const a=this._sort?.key===e.key,r=document.createElement("span");r.className="sort-indicator";let n="";a&&(n=this._sort.direction==="asc"?" ▲":" ▼"),r.textContent=n,s.appendChild(r),a&&s.classList.add(this._sort.direction==="asc"?"sort-asc":"sort-desc"),s.addEventListener("click",()=>this._cycleSort(e.key))}return s}_buildFilterCell(e,t,o){const s=this._filterCache.get(e.key),a=Array.isArray(e.filterOptions),r=typeof e.filterRender=="function";let n;if(!e.filter&&!a&&!r||e.key===M||e.key===z?n="none":r?n="custom":e.filter==="select"||a?n="select":n="text",s&&s.kind===n){if(s.th.className="",this._applyCellClasses(s.th,e,t,o),n==="select"){const u=s.control,h=this._resolveFilterOptions(e),g=h.map(m=>m.value).join("|");g!==s.optionsKey?(this._populateSelect(u,h,this._filters[e.key]??""),s.optionsKey=g):u.value=this._filters[e.key]??""}else if(n==="text"){const u=s.control,h=this._filters[e.key]??"";u.value!==h&&u.ownerDocument.activeElement!==u&&(u.value=h)}else n==="custom"&&e.filterRender&&e.filterRender(s.th,{value:this._filters[e.key]??"",setValue:u=>this._onFilterChange(e.key,u),col:e});return s.th}const l=document.createElement("th");if(this._applyCellClasses(l,e,t,o),n==="none")return this._filterCache.set(e.key,{th:l,control:null,optionsKey:"",kind:"none"}),l;if(n==="custom"&&e.filterRender)return e.filterRender(l,{value:this._filters[e.key]??"",setValue:u=>this._onFilterChange(e.key,u),col:e}),this._filterCache.set(e.key,{th:l,control:null,optionsKey:"",kind:"custom"}),l;let c,d="";if(n==="select"){const u=document.createElement("select");u.classList.add("filter-select"),u.setAttribute("data-noclick",""),u.setAttribute("aria-label",`Filter ${e.label??e.key}`);const h=this._resolveFilterOptions(e);this._populateSelect(u,h,this._filters[e.key]??""),d=h.map(g=>g.value).join("|"),u.addEventListener("change",()=>{this._onFilterChange(e.key,u.value)}),c=u}else{const u=document.createElement("input");u.type="search",u.classList.add("filter-input"),u.setAttribute("data-noclick",""),u.setAttribute("placeholder","Filter…"),u.setAttribute("aria-label",`Filter ${e.label??e.key}`),u.value=this._filters[e.key]??"",u.addEventListener("input",()=>{this._onFilterChange(e.key,u.value)}),c=u}return l.appendChild(c),this._filterCache.set(e.key,{th:l,control:c,optionsKey:d,kind:n}),l}_populateSelect(e,t,o){e.replaceChildren();const s=document.createElement("option");s.value="",s.textContent="All",e.appendChild(s);for(const a of t){const r=document.createElement("option");r.value=a.value,r.textContent=a.label,a.value===o&&(r.selected=!0),e.appendChild(r)}e.value=o}_resolveFilterOptions(e){return Array.isArray(e.filterOptions)?e.filterOptions:this._uniqueValues(e.key).map(t=>({value:t,label:t}))}_paintBody(e,t,o){if(e.replaceChildren(),this.hasAttribute("loading")){const a=this._readLoadingRows();for(let r=0;r<a;r++)e.appendChild(this._buildSkeletonRow(t,r));return}const s=this._sortedRows(this._filteredRows());if(s.length===0){e.appendChild(this._buildEmptyRow(t.length));return}for(const{row:a,index:r}of s)if(e.appendChild(this._stacked?this._buildStackedRow(a,r,t):this._buildBodyRow(a,r,t,o)),this._expanded.has(r)&&this._subTable){const n=this._subTable(a,r);n&&e.appendChild(this._buildSubTableRow(n,t.length))}}_buildEmptyRow(e){const t=document.createElement("tr");t.classList.add("empty");const o=document.createElement("td");o.colSpan=e;const s=document.createElement("slot");return s.name="empty",s.textContent=this.getAttribute("empty")||"No data",o.appendChild(s),t.appendChild(o),t}_buildSkeletonRow(e,t){const o=document.createElement("tr");if(o.classList.add("skeleton"),o.setAttribute("aria-hidden","true"),this._stacked){o.classList.add("stack-row");const s=document.createElement("td");s.className="stack-body",s.colSpan=Math.max(1,e.length);for(const a of[55+t*7%25,30+t*11%15]){const r=document.createElement("span");r.className="skeleton-bar",r.style.width=`${a}%`,s.appendChild(r)}return o.appendChild(s),o}for(const s of e){const a=document.createElement("td"),r=document.createElement("span");r.className="skeleton-bar";const n=50+(t*7+o.children.length*13)%40;r.style.width=`${n}%`,a.appendChild(r),o.appendChild(a)}return o}_buildBodyRow(e,t,o,s){const a=document.createElement("tr");a.setAttribute("part","row"),a.dataset.rowIndex=String(t);const r=this._getRowId(e,t);a.dataset.rowId=String(r),this._selection.has(r)&&a.classList.add("is-selected"),a.addEventListener("click",n=>{this._onRowClick(e,t,n)});for(let n=0;n<o.length;n++)a.appendChild(this._buildBodyCell(o[n],n,e,t,s));return a}_buildStackedRow(e,t,o){const s=document.createElement("tr");s.setAttribute("part","row"),s.classList.add("stack-row"),s.dataset.rowIndex=String(t);const a=this._getRowId(e,t);s.dataset.rowId=String(a),this._selection.has(a)&&s.classList.add("is-selected"),s.addEventListener("click",c=>{this._onRowClick(e,t,c)});const r=document.createElement("td");r.className="stack-body";let n=0,l=0;for(let c=0;c<o.length;c++){const d=o[c];if(d.key===z||d.key===M){s.appendChild(this._buildBodyCell(d,c,e,t,0));continue}l++;const u=Mo(d,n++);if(u==="hidden")continue;const h=document.createElement("div");if(h.className=`stack-cell stack-${u}`,h.dataset.key=d.key,u==="meta"&&d.label){const _=document.createElement("span");_.className="stack-label",_.textContent=d.label,h.appendChild(_)}const g=document.createElement("span");g.className="stack-value";const m=e[d.key];d.render?this._mountCellContent(g,d.render(m,e,t)):m!=null&&(g.textContent=String(m)),h.appendChild(g),r.appendChild(h)}return r.colSpan=Math.max(1,l),s.appendChild(r),s}_buildBodyCell(e,t,o,s,a){const r=document.createElement("td");if(this._applyCellClasses(r,e,t,a),e.minWidth&&(r.style.minWidth=e.minWidth),e.key===z){const l=this._getRowId(o,s),c=document.createElement("input");return c.type="checkbox",c.className="select-row-checkbox",c.setAttribute("data-noclick",""),c.setAttribute("aria-label","Select row"),c.checked=this._selection.has(l),c.addEventListener("change",()=>{c.checked?this.select(l):this.deselect(l)}),r.appendChild(c),this._stacked&&(r.setAttribute("data-noclick",""),r.addEventListener("click",d=>{d.target===r&&(c.checked=!c.checked,c.dispatchEvent(new Event("change")))})),r}if(e.key===M){if(!(this._subTable?!!this._subTable(o,s):!1))return r;const c=this._expanded.has(s),d=document.createElement("button");return d.type="button",d.className="expander",d.setAttribute("data-noclick",""),d.setAttribute("aria-expanded",c?"true":"false"),d.setAttribute("aria-label",c?"Collapse row":"Expand row"),d.textContent=c?"▾":"▸",d.addEventListener("click",u=>{this._toggleRow(s,o,u)}),r.appendChild(d),r}const n=o[e.key];if(e.render){const l=e.render(n,o,s);this._mountCellContent(r,l)}else n!=null&&(r.textContent=String(n));return r}_buildSubTableRow(e,t){const o=document.createElement("tr");o.classList.add("subtable"),o.setAttribute("part","subtable-row");const s=document.createElement("td");s.colSpan=t;const a=document.createElement("div");if(a.classList.add("subtable-inner"),e instanceof Node)a.appendChild(e);else if(Je(e))I(e,a);else{const r=document.createElement("os-table");r.columns=e.columns,r.data=e.data,e.subTable&&(r.subTable=e.subTable),a.appendChild(r)}return s.appendChild(a),o.appendChild(s),o}_mountCellContent(e,t){if(typeof t=="string"){e.textContent=t;return}if(t instanceof Node){e.appendChild(t);return}Je(t)&&I(t,e)}_onFilterChange(e,t){t===""?delete this._filters[e]:this._filters[e]=t,this.emit("os-table-filter-change",{filters:{...this._filters}});const s=this.shadowRoot?.querySelector("tbody");if(s){const a=this._effectiveColumns(),r=this._readStickyColumns();this._lastStickyIndex=this._computeLastStickyIndex(a,r),this._paintBody(s,a,r),this._applyStickyOffsets()}}_onRowClick(e,t,o){const s=o.composedPath?.()??[];for(const a of s){if(a instanceof Element&&a.hasAttribute("data-noclick"))return;if(a===this)break}this.emit("os-table-row-click",{row:e,index:t,originalEvent:o})}_toggleRow(e,t,o){o.stopPropagation();const s=this._expanded.has(e);s?this._expanded.delete(e):this._expanded.add(e),this.emit("os-table-expand-change",{row:t,index:e,expanded:!s}),this._schedulePaint()}_cycleSort(e){!this._sort||this._sort.key!==e?this._sort={key:e,direction:"asc"}:this._sort.direction==="asc"?this._sort={key:e,direction:"desc"}:this._sort=null,this.emit("os-table-sort-change",{sort:this._sort?{...this._sort}:null}),this._schedulePaint()}_emitSelectionChange(){this.emit("os-table-selection-change",{selection:Array.from(this._selection),rows:this.selectedRows})}_filteredRows(){const e=[],t=Object.keys(this._filters).filter(o=>this._filters[o]!=="");for(let o=0;o<this._data.length;o++){const s=this._data[o];let a=!0;for(const r of t){const n=this._columns.find(u=>u.key===r);if(n&&typeof n.filterRender=="function")continue;const l=this._filters[r]??"",c=s[r],d=c==null?"":String(c);if(n?.filter==="select"){if(d!==l){a=!1;break}}else if(!d.toLowerCase().includes(l.toLowerCase())){a=!1;break}}a&&e.push({row:s,index:o})}return e}_sortedRows(e){if(!this._sort)return e;const t=this._columns.find(a=>a.key===this._sort.key);if(!t)return e;const o=this._sort.direction==="desc"?-1:1,s=e.slice();return s.sort((a,r)=>{const n=t.sortValue?t.sortValue(a.row,a.row[t.key]):a.row[t.key],l=t.sortValue?t.sortValue(r.row,r.row[t.key]):r.row[t.key];return zo(n,l)*o}),s}_uniqueValues(e){const t=new Set;for(const o of this._data){const s=o[e];s!=null&&t.add(String(s))}return Array.from(t).sort()}_visibleSelectionStats(){let e=0,t=0;for(const{row:o,index:s}of this._filteredRows())e++,this._selection.has(this._getRowId(o,s))&&t++;return{total:e,selected:t}}_readStickyColumns(){const e=parseInt(this.getAttribute("sticky-columns")||"0",10);return Number.isFinite(e)&&e>0?e:0}_readLoadingRows(){const e=parseInt(this.getAttribute("loading-rows")||"5",10);return Number.isFinite(e)&&e>0?Math.min(e,100):5}_readSelectable(){const e=this.getAttribute("selectable");return e==="single"?"single":e==="multi"||e===""?"multi":null}_isStickyIndex(e,t,o){return this._stacked||o.sticky===!1?!1:o.sticky===!0?!0:e<t}_computeLastStickyIndex(e,t){let o=-1;for(let s=0;s<e.length;s++)this._isStickyIndex(s,t,e[s])&&(o=s);return o}_applyCellClasses(e,t,o,s){t.key===M&&e.classList.add("col-expander"),t.key===z&&e.classList.add("col-select"),t.align==="center"&&e.classList.add("align-center"),t.align==="end"&&e.classList.add("align-end"),this._isStickyIndex(o,s,t)&&(e.classList.add("is-sticky"),o===this._lastStickyIndex&&e.classList.add("is-sticky-edge"))}_effectiveColumns(){const e=[];return this._readSelectable()&&e.push({key:z,label:"",width:"40px",align:"center"}),this._subTable&&e.push({key:M,label:"",width:"36px",align:"center"}),e.push(...this._columns),e}_applyStickyOffsets(){const e=this.shadowRoot;if(!e)return;const t=e.querySelector("thead tr");if(!t)return;const o=Array.from(t.children),s=[];let a=0;for(let n=0;n<o.length;n++)s[n]=a,o[n].classList.contains("is-sticky")&&(a+=o[n].offsetWidth);e.querySelectorAll("thead tr, tbody tr:not(.subtable):not(.empty):not(.skeleton)").forEach(n=>{const l=Array.from(n.children);for(let c=0;c<l.length;c++)l[c].classList.contains("is-sticky")&&(l[c].style.insetInlineStart=`${s[c]}px`)}),this._maybeWarnStickyOffsetRace(o,s)}_maybeWarnStickyOffsetRace(e,t){if(this._stickyRaceWarned)return;const o=this._readStickyColumns();if(o<2)return;const s=Math.min(o-1,e.length-1);if(s<=0||t[s]!==0||this.offsetWidth===0)return;this._stickyRaceWarned=!0;const a=e[0]?.offsetWidth??0;console.warn(`[os-table] sticky-columns: column ${s} resolved to inset-inline-start: 0px while the host is visible. ths[0].offsetWidth was ${a}px at measurement time. Likely a layout race — call recomputeLayout() after the panel finishes its mount/transition, or wrap the assignment of \`data\` in a requestAnimationFrame.`)}_measureHeaderHeight(){const e=this.shadowRoot;if(!e)return;const t=e.querySelector("thead tr");if(!t)return;const o=t.offsetHeight;o>0&&this.style.setProperty("--os-ui-table-header-height",`${o}px`)}_maybeWarnStickyHeader(){if(this._stickyHeaderWarned||!this.hasAttribute("sticky-header")||this.hasAttribute("loading")||this._data.length<8)return;const e=this.shadowRoot?.querySelector(".scroll");e&&e.offsetWidth!==0&&e.scrollHeight<=e.clientHeight+1&&(this._stickyHeaderWarned=!0,console.warn("[os-table] sticky-header is set but the table has no scroll container. Set --os-ui-table-max-height on the host (or wrap it in a scrolling parent) so the header has something to stick to."))}};K.props=["stickyColumns","stickyHeader","striped","hover","compact","bordered","empty","loading","loadingRows","selectable","stacked"],K.styles=[Lo],K.help=void 0;let _e=K;function Je(i){return!!i&&i.__wpdHtml===!0}function Mo(i,e){return i.stack?i.stack:e===0?"title":i.label?"meta":"actions"}function zo(i,e){if(i===e)return 0;if(i==null)return-1;if(e==null)return 1;if(typeof i=="number"&&typeof e=="number")return i-e;if(i instanceof Date&&e instanceof Date)return i.getTime()-e.getTime();const t=Number(i),o=Number(e);return Number.isFinite(t)&&Number.isFinite(o)?t-o:String(i).localeCompare(String(e))}S("os-table",_e);const Io=x` ${te}:host{display:flex;flex-direction:column;gap:8px;font-size:13px;color:var( --os-ui-fg,#1d2327 );min-width:0}:host( [ hidden ] ){display:none}.os-select__label{font-size:13px;line-height:1.5;color:var( --os-ui-fg-muted,#646970 )}.os-select__trigger{appearance:none;display:flex;align-items:center;gap:8px;width:100%;min-width:0;padding:8px 12px;background:var( --os-ui-hover,rgba( 0,0,0,0.05 ) );border:1px solid transparent;border-radius:8px;font:inherit;font-size:13px;line-height:1.5;color:var( --os-ui-fg,#1d2327 );text-align:start;cursor:pointer;transition:background-color var( --_holo-t ) ease,border-color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease}.os-select__trigger:hover:not(:disabled ){background:var( --os-ui-hover,rgba( 0,0,0,0.08 ) );border-color:var( --os-ui-border-strong,#8c8f94 )}.os-select__trigger:focus,.os-select__trigger:focus-visible{outline:none;border-color:var( --os-ui-accent,#2271b1 );box-shadow:var( --_holo-focus-field )}.os-select__trigger:disabled{opacity:0.5;cursor:not-allowed}:host( [ plain ] ){display:inline-flex;flex-direction:row;align-items:center}:host( [ plain ] ) .os-select__label{display:none}:host( [ plain ] ) .os-select__trigger{width:auto;padding:4px 6px;background:transparent;border-color:transparent;border-radius:6px}:host( [ plain ] ) .os-select__trigger:hover:not(:disabled ){background:var( --os-ui-hover,rgba( 0,0,0,0.05 ) );border-color:transparent}:host( [ plain ] ) .os-select__trigger:focus,:host( [ plain ] ) .os-select__trigger:focus-visible{border-color:var( --os-ui-accent,#2271b1 )}:host( [ plain ] ) .os-select__value{flex:0 1 auto}.os-select__value{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.os-select__value--placeholder{color:var( --os-ui-fg-muted,#646970 )}.os-select__chevron{flex:0 0 auto;pointer-events:none;color:var( --os-ui-fg-muted,#646970 )}.os-select__trigger:hover .os-select__chevron{color:var( --os-ui-fg,#1d2327 )}.os-select__trigger:focus .os-select__chevron,.os-select__trigger:focus-visible .os-select__chevron{color:var( --os-ui-accent,#2271b1 )}.os-select__popup{position:fixed;inset:auto;margin:0;max-height:min( 320px,60vh );overflow-y:auto;padding:4px;background:var( --os-ui-surface,#fff );border:1px solid var( --os-ui-border,#dcdcde );border-radius:8px;box-shadow:0 12px 32px rgba( 0,0,0,0.45 );color:var( --os-ui-fg,#1d2327 )}.os-select__popup:not( [ data-open ] ){display:none}.os-select__popup:popover-open{display:block}.os-select__popup[ data-open ]{position:absolute;top:calc( 100% + 4px );left:0;min-width:100%;z-index:1000}:host{position:relative}.os-select__option{display:flex;align-items:center;gap:8px;padding:7px 10px;border-radius:6px;font-size:13px;line-height:1.5;cursor:pointer;white-space:nowrap}.os-select__check{flex:0 0 auto;visibility:hidden}.os-select__option[ aria-selected='true' ] .os-select__check{visibility:visible}.os-select__option[ data-active ],.os-select__option:hover{background:var( --os-ui-accent,#2271b1 );color:var( --os-ui-fg-on-accent,#fff )}.os-select__option[ aria-disabled='true' ]{opacity:0.5;cursor:not-allowed}.os-select__option[ aria-disabled='true' ]:hover{background:transparent;color:inherit}@media ( prefers-reduced-motion:reduce ){.os-select__trigger{transition-duration:1ms}}`,No=x`:host{display:none}`,B=class B extends k{render(){return f``}};B.props=["value","disabled"],B.styles=[No],B.help=void 0;let ve=B;S("os-option",ve);const G=class G extends k{constructor(){super(...arguments),this._optionObserver=null,this._open=!1,this._activeIndex=-1,this._typed="",this._dismissedAt=0,this._typedTimer=null,this._onWindowScroll=e=>{const t=e.target,o=this._popup();o&&t instanceof Node&&(t===o||o.contains(t))||this._hide()},this._onWindowResize=()=>this._hide()}set items(e){const t=this.querySelectorAll(":scope > os-option");for(const a of Array.from(t))a.remove();for(const a of e){const r=document.createElement("os-option");r.setAttribute("value",a.value),r.textContent=a.label,this.appendChild(r)}const o=this.value;!(o!==null&&e.some(a=>a.value===o))&&e.length>0&&(this.value=e[0].value),this.requestUpdate()}connectedCallback(){super.connectedCallback(),ze(this),this._optionObserver=new MutationObserver(()=>this.requestUpdate()),this._optionObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value","disabled"],characterData:!0})}disconnectedCallback(){this._optionObserver?.disconnect(),this._optionObserver=null,this._teardownDismiss(),this._open=!1,this._typedTimer&&(clearTimeout(this._typedTimer),this._typedTimer=null)}render(){const e=this.label||"",t=this.value,o=this.placeholder||"",s=this.disabled!==null;e&&this.setAttribute("aria-label",e);const a=this.getAttribute("aria-label")||"",r=e||a||o,n=this._readOptions(),l=n.find(m=>m.value===t),c=l?l.label:o,d=this.id||"os-unnamed",u=`${d}__listbox`,h=`${d}__trigger`,g=this._open&&this._activeIndex>=0?`${d}__opt-${this._activeIndex}`:"";return f` | |
| 242 | - ${e?f`<label | |
| 208 | + `}requestUpdate(){super.requestUpdate(),this._schedulePaint()}_schedulePaint(){this._paintScheduled||!this.isConnected||(this._paintScheduled=!0,queueMicrotask(()=>{this._paintScheduled=!1,this.isConnected&&this._paint()}))}_paint(){const e=this.shadowRoot;if(!e)return;e.querySelector("tbody")||Z(this.render(),e);const t=e.querySelector("colgroup"),o=e.querySelector("thead"),i=e.querySelector("tbody");if(!t||!o||!i)return;const a=this._effectiveColumns();this._stacked=this.hasAttribute("stacked");const n=this._readStickyColumns();this._lastStickyIndex=this._computeLastStickyIndex(a,n),this._paintColgroup(t,a),this._paintHead(o,a,n),this._paintBody(i,a,n),this._applyStickyOffsets(),this._measureHeaderHeight(),this._scheduleStickyOffsets(),this._maybeWarnStickyHeader(),this._maybeWarnLoadingDesync(i),this._ensureResizeObserver()}_maybeWarnLoadingDesync(e){this._loadingDesyncWarned||this.hasAttribute("loading")&&(e.querySelector("tr.skeleton")||(this._loadingDesyncWarned=!0,console.warn("[os-table] `loading` attribute is set but no skeleton rows rendered. Either attributeChangedCallback didn't route through requestUpdate (framework regression), or `loading` was set after the most recent paint and no follow-up trigger ran. Toggling `data` will force a paint as a workaround.")))}_scheduleStickyOffsets(){this._stickyMicroScheduled||(this._stickyMicroScheduled=!0,queueMicrotask(()=>{this._stickyMicroScheduled=!1,this.isConnected&&this._applyStickyOffsets()})),this._stickyRafHandle===null&&typeof requestAnimationFrame<"u"&&(this._stickyRafHandle=requestAnimationFrame(()=>{this._stickyRafHandle=null,this.isConnected&&(this._applyStickyOffsets(),this._measureHeaderHeight())}))}_ensureResizeObserver(){if(this._resizeObserver||typeof ResizeObserver>"u")return;const e=this.shadowRoot?.querySelector(".scroll");e&&(this._resizeObserver=new ResizeObserver(()=>{this.isConnected&&(this._applyStickyOffsets(),this._measureHeaderHeight(),this._stickyHeaderWarned=!1,this._maybeWarnStickyHeader())}),this._resizeObserver.observe(e),this._resizeObserver.observe(this))}_paintColgroup(e,t){const o=[];for(const i of t){const a=document.createElement("col");i.width&&(a.style.width=i.width),o.push(a)}e.replaceChildren(...o)}_paintHead(e,t,o){const i=document.createElement("tr");i.setAttribute("part","header-row");for(let l=0;l<t.length;l++)i.appendChild(this._buildHeaderCell(t[l],l,o));const a=e.querySelector(':scope > tr[part="header-row"]');a?e.replaceChild(i,a):e.insertBefore(i,e.firstChild);const n=t.some(l=>l.filter||Array.isArray(l.filterOptions)||typeof l.filterRender=="function");let r=e.querySelector(":scope > tr.filter-row");if(n){const l=[];for(let p=0;p<t.length;p++)l.push(this._buildFilterCell(t[p],p,o));r||(r=document.createElement("tr"),r.classList.add("filter-row"),r.setAttribute("part","filter-row"),e.appendChild(r));const c=Array.from(r.children);let d=c.length===l.length;if(d){for(let p=0;p<l.length;p++)if(c[p]!==l[p]){d=!1;break}}if(!d){const p=new Set(l);for(const g of l)r.appendChild(g);for(const g of Array.from(r.children))p.has(g)||r.removeChild(g)}}else r&&r.remove()}_buildHeaderCell(e,t,o){const i=document.createElement("th");if(i.setAttribute("scope","col"),i.dataset.key=e.key,this._applyCellClasses(i,e,t,o),e.minWidth&&(i.style.minWidth=e.minWidth),e.key===de){if(this._readSelectable()==="multi"){const n=document.createElement("input");n.type="checkbox",n.className="select-all-checkbox",n.setAttribute("data-noclick",""),n.setAttribute("aria-label","Select all rows");const{total:r,selected:l}=this._visibleSelectionStats();n.checked=r>0&&l===r,n.indeterminate=l>0&&l<r,n.addEventListener("change",()=>{n.checked?this.selectAll():this.clearSelection()}),i.appendChild(n)}return i}if(i.textContent=e.label??(e.key===ce?"":e.key),e.sortable){i.classList.add("is-sortable");const a=this._sort?.key===e.key,n=document.createElement("span");n.className="sort-indicator";let r="";a&&(r=this._sort.direction==="asc"?" ▲":" ▼"),n.textContent=r,i.appendChild(n),a&&i.classList.add(this._sort.direction==="asc"?"sort-asc":"sort-desc"),i.addEventListener("click",()=>this._cycleSort(e.key))}return i}_buildFilterCell(e,t,o){const i=this._filterCache.get(e.key),a=Array.isArray(e.filterOptions),n=typeof e.filterRender=="function";let r;if(!e.filter&&!a&&!n||e.key===ce||e.key===de?r="none":n?r="custom":e.filter==="select"||a?r="select":r="text",i&&i.kind===r){if(i.th.className="",this._applyCellClasses(i.th,e,t,o),r==="select"){const p=i.control,g=this._resolveFilterOptions(e),v=g.map(_=>_.value).join("|");v!==i.optionsKey?(this._populateSelect(p,g,this._filters[e.key]??""),i.optionsKey=v):p.value=this._filters[e.key]??""}else if(r==="text"){const p=i.control,g=this._filters[e.key]??"";p.value!==g&&p.ownerDocument.activeElement!==p&&(p.value=g)}else r==="custom"&&e.filterRender&&e.filterRender(i.th,{value:this._filters[e.key]??"",setValue:p=>this._onFilterChange(e.key,p),col:e});return i.th}const l=document.createElement("th");if(this._applyCellClasses(l,e,t,o),r==="none")return this._filterCache.set(e.key,{th:l,control:null,optionsKey:"",kind:"none"}),l;if(r==="custom"&&e.filterRender)return e.filterRender(l,{value:this._filters[e.key]??"",setValue:p=>this._onFilterChange(e.key,p),col:e}),this._filterCache.set(e.key,{th:l,control:null,optionsKey:"",kind:"custom"}),l;let c,d="";if(r==="select"){const p=document.createElement("select");p.classList.add("filter-select"),p.setAttribute("data-noclick",""),p.setAttribute("aria-label",`Filter ${e.label??e.key}`);const g=this._resolveFilterOptions(e);this._populateSelect(p,g,this._filters[e.key]??""),d=g.map(v=>v.value).join("|"),p.addEventListener("change",()=>{this._onFilterChange(e.key,p.value)}),c=p}else{const p=document.createElement("input");p.type="search",p.classList.add("filter-input"),p.setAttribute("data-noclick",""),p.setAttribute("placeholder","Filter…"),p.setAttribute("aria-label",`Filter ${e.label??e.key}`),p.value=this._filters[e.key]??"",p.addEventListener("input",()=>{this._onFilterChange(e.key,p.value)}),c=p}return l.appendChild(c),this._filterCache.set(e.key,{th:l,control:c,optionsKey:d,kind:r}),l}_populateSelect(e,t,o){e.replaceChildren();const i=document.createElement("option");i.value="",i.textContent="All",e.appendChild(i);for(const a of t){const n=document.createElement("option");n.value=a.value,n.textContent=a.label,a.value===o&&(n.selected=!0),e.appendChild(n)}e.value=o}_resolveFilterOptions(e){return Array.isArray(e.filterOptions)?e.filterOptions:this._uniqueValues(e.key).map(t=>({value:t,label:t}))}_paintBody(e,t,o){if(e.replaceChildren(),this.hasAttribute("loading")){const a=this._readLoadingRows();for(let n=0;n<a;n++)e.appendChild(this._buildSkeletonRow(t,n));return}const i=this._sortedRows(this._filteredRows());if(i.length===0){e.appendChild(this._buildEmptyRow(t.length));return}for(const{row:a,index:n}of i)if(e.appendChild(this._stacked?this._buildStackedRow(a,n,t):this._buildBodyRow(a,n,t,o)),this._expanded.has(n)&&this._subTable){const r=this._subTable(a,n);r&&e.appendChild(this._buildSubTableRow(r,t.length))}}_buildEmptyRow(e){const t=document.createElement("tr");t.classList.add("empty");const o=document.createElement("td");o.colSpan=e;const i=document.createElement("slot");return i.name="empty",i.textContent=this.getAttribute("empty")||"No data",o.appendChild(i),t.appendChild(o),t}_buildSkeletonRow(e,t){const o=document.createElement("tr");if(o.classList.add("skeleton"),o.setAttribute("aria-hidden","true"),this._stacked){o.classList.add("stack-row");const i=document.createElement("td");i.className="stack-body",i.colSpan=Math.max(1,e.length);for(const a of[55+t*7%25,30+t*11%15]){const n=document.createElement("span");n.className="skeleton-bar",n.style.width=`${a}%`,i.appendChild(n)}return o.appendChild(i),o}for(const i of e){const a=document.createElement("td"),n=document.createElement("span");n.className="skeleton-bar";const r=50+(t*7+o.children.length*13)%40;n.style.width=`${r}%`,a.appendChild(n),o.appendChild(a)}return o}_buildBodyRow(e,t,o,i){const a=document.createElement("tr");a.setAttribute("part","row"),a.dataset.rowIndex=String(t);const n=this._getRowId(e,t);a.dataset.rowId=String(n),this._selection.has(n)&&a.classList.add("is-selected"),a.addEventListener("click",r=>{this._onRowClick(e,t,r)});for(let r=0;r<o.length;r++)a.appendChild(this._buildBodyCell(o[r],r,e,t,i));return a}_buildStackedRow(e,t,o){const i=document.createElement("tr");i.setAttribute("part","row"),i.classList.add("stack-row"),i.dataset.rowIndex=String(t);const a=this._getRowId(e,t);i.dataset.rowId=String(a),this._selection.has(a)&&i.classList.add("is-selected"),i.addEventListener("click",c=>{this._onRowClick(e,t,c)});const n=document.createElement("td");n.className="stack-body";let r=0,l=0;for(let c=0;c<o.length;c++){const d=o[c];if(d.key===de||d.key===ce){i.appendChild(this._buildBodyCell(d,c,e,t,0));continue}l++;const p=Zo(d,r++);if(p==="hidden")continue;const g=document.createElement("div");if(g.className=`stack-cell stack-${p}`,g.dataset.key=d.key,p==="meta"&&d.label){const h=document.createElement("span");h.className="stack-label",h.textContent=d.label,g.appendChild(h)}const v=document.createElement("span");v.className="stack-value";const _=e[d.key],x=Le(_);d.render?this._mountCellContent(v,d.render(_,e,t)):x!==null?v.appendChild(this._slotFor(x)):_!=null&&(v.textContent=String(_)),g.appendChild(v),n.appendChild(g)}return n.colSpan=Math.max(1,l),i.appendChild(n),i}_buildBodyCell(e,t,o,i,a){const n=document.createElement("td");if(this._applyCellClasses(n,e,t,a),e.minWidth&&(n.style.minWidth=e.minWidth),e.key===de){const c=this._getRowId(o,i),d=document.createElement("input");return d.type="checkbox",d.className="select-row-checkbox",d.setAttribute("data-noclick",""),d.setAttribute("aria-label","Select row"),d.checked=this._selection.has(c),d.addEventListener("change",()=>{d.checked?this.select(c):this.deselect(c)}),n.appendChild(d),this._stacked&&(n.setAttribute("data-noclick",""),n.addEventListener("click",p=>{p.target===n&&(d.checked=!d.checked,d.dispatchEvent(new Event("change")))})),n}if(e.key===ce){if(!(this._subTable?!!this._subTable(o,i):!1))return n;const d=this._expanded.has(i),p=document.createElement("button");return p.type="button",p.className="expander",p.setAttribute("data-noclick",""),p.setAttribute("aria-expanded",d?"true":"false"),p.setAttribute("aria-label",d?"Collapse row":"Expand row"),p.textContent=d?"▾":"▸",p.addEventListener("click",g=>{this._toggleRow(i,o,g)}),n.appendChild(p),n}const r=o[e.key],l=Le(r);if(e.render){const c=e.render(r,o,i);this._mountCellContent(n,c)}else l!==null?n.appendChild(this._slotFor(l)):r!=null&&(n.textContent=String(r));return n}_slotFor(e){const t=document.createElement("slot");return t.name=e,t}_buildSubTableRow(e,t){const o=document.createElement("tr");o.classList.add("subtable"),o.setAttribute("part","subtable-row");const i=document.createElement("td");i.colSpan=t;const a=document.createElement("div");if(a.classList.add("subtable-inner"),e instanceof Node)a.appendChild(e);else if(Xt(e))Z(e,a);else{const n=document.createElement("os-table");n.columns=e.columns,n.data=e.data,e.subTable&&(n.subTable=e.subTable),a.appendChild(n)}return i.appendChild(a),o.appendChild(i),o}_mountCellContent(e,t){if(typeof t=="string"){e.textContent=t;return}if(t instanceof Node){e.appendChild(t);return}Xt(t)&&Z(t,e)}_onFilterChange(e,t){t===""?delete this._filters[e]:this._filters[e]=t,this.emit("os-table-filter-change",{filters:{...this._filters}});const i=this.shadowRoot?.querySelector("tbody");if(i){const a=this._effectiveColumns(),n=this._readStickyColumns();this._lastStickyIndex=this._computeLastStickyIndex(a,n),this._paintBody(i,a,n),this._applyStickyOffsets()}}_onRowClick(e,t,o){const i=o.composedPath?.()??[];for(const a of i){if(a instanceof Element&&a.hasAttribute("data-noclick"))return;if(a===this)break}this.emit("os-table-row-click",{row:e,index:t,originalEvent:o})}_toggleRow(e,t,o){o.stopPropagation();const i=this._expanded.has(e);i?this._expanded.delete(e):this._expanded.add(e),this.emit("os-table-expand-change",{row:t,index:e,expanded:!i}),this._schedulePaint()}_cycleSort(e){!this._sort||this._sort.key!==e?this._sort={key:e,direction:"asc"}:this._sort.direction==="asc"?this._sort={key:e,direction:"desc"}:this._sort=null,this.emit("os-table-sort-change",{sort:this._sort?{...this._sort}:null}),this._schedulePaint()}_emitSelectionChange(){this.emit("os-table-selection-change",{selection:Array.from(this._selection),rows:this.selectedRows})}_filteredRows(){const e=[],t=Object.keys(this._filters).filter(o=>this._filters[o]!=="");for(let o=0;o<this._data.length;o++){const i=this._data[o];let a=!0;for(const n of t){const r=this._columns.find(p=>p.key===n);if(r&&typeof r.filterRender=="function")continue;const l=this._filters[n]??"",c=i[n],d=ot(c);if(r?.filter==="select"){if(d!==l){a=!1;break}}else if(!d.toLowerCase().includes(l.toLowerCase())){a=!1;break}}a&&e.push({row:i,index:o})}return e}_sortedRows(e){if(!this._sort)return e;const t=this._columns.find(a=>a.key===this._sort.key);if(!t)return e;const o=this._sort.direction==="desc"?-1:1,i=e.slice();return i.sort((a,n)=>{const r=a.row[t.key],l=n.row[t.key],c=t.sortValue?t.sortValue(a.row,r):Yt(r),d=t.sortValue?t.sortValue(n.row,l):Yt(l);return Xo(c,d)*o}),i}_uniqueValues(e){const t=new Set;for(const o of this._data){const i=o[e];i!=null&&t.add(ot(i))}return Array.from(t).sort()}_visibleSelectionStats(){let e=0,t=0;for(const{row:o,index:i}of this._filteredRows())e++,this._selection.has(this._getRowId(o,i))&&t++;return{total:e,selected:t}}_readStickyColumns(){const e=parseInt(this.getAttribute("sticky-columns")||"0",10);return Number.isFinite(e)&&e>0?e:0}_readLoadingRows(){const e=parseInt(this.getAttribute("loading-rows")||"5",10);return Number.isFinite(e)&&e>0?Math.min(e,100):5}_readSelectable(){const e=this.getAttribute("selectable");return e==="single"?"single":e==="multi"||e===""?"multi":null}_isStickyIndex(e,t,o){return this._stacked||o.sticky===!1?!1:o.sticky===!0?!0:e<t}_computeLastStickyIndex(e,t){let o=-1;for(let i=0;i<e.length;i++)this._isStickyIndex(i,t,e[i])&&(o=i);return o}_applyCellClasses(e,t,o,i){t.key===ce&&e.classList.add("col-expander"),t.key===de&&e.classList.add("col-select"),t.align==="center"&&e.classList.add("align-center"),t.align==="end"&&e.classList.add("align-end"),this._isStickyIndex(o,i,t)&&(e.classList.add("is-sticky"),o===this._lastStickyIndex&&e.classList.add("is-sticky-edge"))}_effectiveColumns(){const e=[];return this._readSelectable()&&e.push({key:de,label:"",width:"40px",align:"center"}),this._subTable&&e.push({key:ce,label:"",width:"36px",align:"center"}),e.push(...this._columns),e}_applyStickyOffsets(){const e=this.shadowRoot;if(!e)return;const t=e.querySelector("thead tr");if(!t)return;const o=Array.from(t.children),i=[];let a=0;for(let r=0;r<o.length;r++)i[r]=a,o[r].classList.contains("is-sticky")&&(a+=o[r].offsetWidth);e.querySelectorAll("thead tr, tbody tr:not(.subtable):not(.empty):not(.skeleton)").forEach(r=>{const l=Array.from(r.children);for(let c=0;c<l.length;c++)l[c].classList.contains("is-sticky")&&(l[c].style.insetInlineStart=`${i[c]}px`)}),this._maybeWarnStickyOffsetRace(o,i)}_maybeWarnStickyOffsetRace(e,t){if(this._stickyRaceWarned)return;const o=this._readStickyColumns();if(o<2)return;const i=Math.min(o-1,e.length-1);if(i<=0||t[i]!==0||this.offsetWidth===0)return;this._stickyRaceWarned=!0;const a=e[0]?.offsetWidth??0;console.warn(`[os-table] sticky-columns: column ${i} resolved to inset-inline-start: 0px while the host is visible. ths[0].offsetWidth was ${a}px at measurement time. Likely a layout race — call recomputeLayout() after the panel finishes its mount/transition, or wrap the assignment of \`data\` in a requestAnimationFrame.`)}_measureHeaderHeight(){const e=this.shadowRoot;if(!e)return;const t=e.querySelector("thead tr");if(!t)return;const o=t.offsetHeight;o>0&&this.style.setProperty("--os-ui-table-header-height",`${o}px`)}_maybeWarnStickyHeader(){if(this._stickyHeaderWarned||!this.hasAttribute("sticky-header")||this.hasAttribute("loading")||this._data.length<8)return;const e=this.shadowRoot?.querySelector(".scroll");e&&e.offsetWidth!==0&&e.scrollHeight<=e.clientHeight+1&&(this._stickyHeaderWarned=!0,console.warn("[os-table] sticky-header is set but the table has no scroll container. Set --os-ui-table-max-height on the host (or wrap it in a scrolling parent) so the header has something to stick to."))}};ye.props=["stickyColumns","stickyHeader","striped","hover","compact","bordered","empty","loading","loadingRows","selectable","stacked"],ye.styles=[Go],ye.help=void 0;let st=ye;function Xt(s){return!!s&&s.__wpdHtml===!0}function Zo(s,e){return s.stack?s.stack:e===0?"title":s.label?"meta":"actions"}function Le(s){return s&&typeof s=="object"&&typeof s.slot=="string"?s.slot:null}function ot(s){if(s==null)return"";if(Le(s)!==null){const e=s.text;return e==null?"":String(e)}return String(s)}function Yt(s){return Le(s)!==null?ot(s):s}function Xo(s,e){if(s===e)return 0;if(s==null)return-1;if(e==null)return 1;if(typeof s=="number"&&typeof e=="number")return s-e;if(s instanceof Date&&e instanceof Date)return s.getTime()-e.getTime();const t=Number(s),o=Number(e);return Number.isFinite(t)&&Number.isFinite(o)?t-o:String(s).localeCompare(String(e))}W("os-table",st);const Yo=R` ${fe}:host{display:flex;flex-direction:column;gap:8px;font-size:13px;color:var( --os-ui-fg,#1d2327 );min-width:0}:host( [ hidden ] ){display:none}.os-select__label{font-size:13px;line-height:1.5;color:var( --os-ui-fg-muted,#646970 )}.os-select__trigger{appearance:none;display:flex;align-items:center;gap:8px;width:100%;min-width:0;padding:8px 12px;background:var( --os-ui-hover,rgba( 0,0,0,0.05 ) );border:1px solid transparent;border-radius:8px;font:inherit;font-size:13px;line-height:1.5;color:var( --os-ui-fg,#1d2327 );text-align:start;cursor:pointer;transition:background-color var( --_holo-t ) ease,border-color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease}.os-select__trigger:hover:not(:disabled ){background:var( --os-ui-hover,rgba( 0,0,0,0.08 ) );border-color:var( --os-ui-border-strong,#8c8f94 )}.os-select__trigger:focus,.os-select__trigger:focus-visible{outline:none;border-color:var( --os-ui-accent,#2271b1 );box-shadow:var( --_holo-focus-field )}.os-select__trigger:disabled{opacity:0.5;cursor:not-allowed}:host( [ plain ] ){display:inline-flex;flex-direction:row;align-items:center}:host( [ plain ] ) .os-select__label{display:none}:host( [ plain ] ) .os-select__trigger{width:auto;padding:4px 6px;background:transparent;border-color:transparent;border-radius:6px}:host( [ plain ] ) .os-select__trigger:hover:not(:disabled ){background:var( --os-ui-hover,rgba( 0,0,0,0.05 ) );border-color:transparent}:host( [ plain ] ) .os-select__trigger:focus,:host( [ plain ] ) .os-select__trigger:focus-visible{border-color:var( --os-ui-accent,#2271b1 )}:host( [ plain ] ) .os-select__value{flex:0 1 auto}.os-select__value{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.os-select__value--placeholder{color:var( --os-ui-fg-muted,#646970 )}.os-select__chevron{flex:0 0 auto;pointer-events:none;color:var( --os-ui-fg-muted,#646970 )}.os-select__trigger:hover .os-select__chevron{color:var( --os-ui-fg,#1d2327 )}.os-select__trigger:focus .os-select__chevron,.os-select__trigger:focus-visible .os-select__chevron{color:var( --os-ui-accent,#2271b1 )}.os-select__popup{position:fixed;inset:auto;margin:0;max-height:min( 320px,60vh );overflow-y:auto;padding:4px;background:var( --os-ui-surface,#fff );border:1px solid var( --os-ui-border,#dcdcde );border-radius:8px;box-shadow:0 12px 32px rgba( 0,0,0,0.45 );color:var( --os-ui-fg,#1d2327 )}.os-select__popup:not( [ data-open ] ){display:none}.os-select__popup:popover-open{display:block}.os-select__popup[ data-open ]{position:absolute;top:calc( 100% + 4px );left:0;min-width:100%;z-index:1000}:host{position:relative}.os-select__option{display:flex;align-items:center;gap:8px;padding:7px 10px;border-radius:6px;font-size:13px;line-height:1.5;cursor:pointer;white-space:nowrap}.os-select__check{flex:0 0 auto;visibility:hidden}.os-select__option[ aria-selected='true' ] .os-select__check{visibility:visible}.os-select__option[ data-active ],.os-select__option:hover{background:var( --os-ui-accent,#2271b1 );color:var( --os-ui-accent-ink,var( --os-ui-fg-on-accent,#fff ) )}.os-select__option[ aria-disabled='true' ]{opacity:0.5;cursor:not-allowed}.os-select__option[ aria-disabled='true' ]:hover{background:transparent;color:inherit}@media ( prefers-reduced-motion:reduce ){.os-select__trigger{transition-duration:1ms}}`,Jo=R`:host{display:none}`,ke=class ke extends U{render(){return b``}};ke.props=["value","disabled"],ke.styles=[Jo],ke.help=void 0;let it=ke;W("os-option",it);const we=class we extends U{constructor(){super(...arguments),this._optionObserver=null,this._open=!1,this._activeIndex=-1,this._typed="",this._dismissedAt=0,this._typedTimer=null,this._onWindowScroll=e=>{const t=e.target,o=this._popup();o&&t instanceof Node&&(t===o||o.contains(t))||this._hide()},this._onWindowResize=()=>this._hide()}set items(e){const t=this.querySelectorAll(":scope > os-option");for(const a of Array.from(t))a.remove();for(const a of e){const n=document.createElement("os-option");n.setAttribute("value",a.value),n.textContent=a.label,this.appendChild(n)}const o=this.value;!(o!==null&&e.some(a=>a.value===o))&&e.length>0&&(this.value=e[0].value),this.requestUpdate()}connectedCallback(){super.connectedCallback(),Mt(this),this._optionObserver=new MutationObserver(()=>this.requestUpdate()),this._optionObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value","disabled"],characterData:!0})}disconnectedCallback(){this._optionObserver?.disconnect(),this._optionObserver=null,this._teardownDismiss(),this._open=!1,this._typedTimer&&(clearTimeout(this._typedTimer),this._typedTimer=null)}render(){const e=this.label||"",t=this.value,o=this.placeholder||"",i=this.disabled!==null;e&&this.setAttribute("aria-label",e);const a=this.getAttribute("aria-label")||"",n=e||a||o,r=this._readOptions(),l=r.find(_=>_.value===t),c=l?l.label:o,d=this.id||"os-unnamed",p=`${d}__listbox`,g=`${d}__trigger`,v=this._open&&this._activeIndex>=0?`${d}__opt-${this._activeIndex}`:"";return b` | |
| 209 | + ${e?b`<label | |
| 243 | 210 | class="os-select__label" |
| 244 | - for=${h} | |
| 245 | - >${e}</label>`:f``} | |
| 211 | + for=${g} | |
| 212 | + >${e}</label>`:b``} | |
| 246 | 213 | <button |
| 247 | 214 | type="button" |
| 248 | 215 | class="os-select__trigger" |
| 249 | - id=${h} | |
| 216 | + id=${g} | |
| 250 | 217 | role="combobox" |
| 251 | 218 | aria-haspopup="listbox" |
| 252 | 219 | aria-expanded=${this._open?"true":"false"} |
| 253 | - aria-controls=${u} | |
| 254 | - aria-label=${r} | |
| 255 | - aria-activedescendant=${g} | |
| 256 | - ?disabled=${s} | |
| 220 | + aria-controls=${p} | |
| 221 | + aria-label=${n} | |
| 222 | + aria-activedescendant=${v} | |
| 223 | + ?disabled=${i} | |
| 257 | 224 | @click=${()=>this._toggle()} |
| 258 | - @keydown=${m=>this._onTriggerKeydown(m)} | |
| 225 | + @keydown=${_=>this._onTriggerKeydown(_)} | |
| 259 | 226 | > |
| 260 | 227 | <span |
| 261 | 228 | class="os-select__value${l?"":" os-select__value--placeholder"}" |
| 262 | 229 | >${c}</span |
| 263 | 230 | > |
| 264 | - ${E("chevron-right",{size:16,rotate:90,className:"os-select__chevron"})} | |
| 231 | + ${Y("chevron-right",{size:16,rotate:90,className:"os-select__chevron"})} | |
| 265 | 232 | </button> |
| 266 | 233 | <div |
| 267 | 234 | class="os-select__popup" |
| 268 | - id=${u} | |
| 235 | + id=${p} | |
| 269 | 236 | role="listbox" |
| 270 | 237 | popover="auto" |
| 271 | - aria-label=${r} | |
| 272 | - @toggle=${m=>this._onPopoverToggle(m)} | |
| 238 | + aria-label=${n} | |
| 239 | + @toggle=${_=>this._onPopoverToggle(_)} | |
| 273 | 240 | > |
| 274 | - ${n.map((m,_)=>f` | |
| 241 | + ${r.map((_,x)=>b` | |
| 275 | 242 | <div |
| 276 | 243 | class="os-select__option" |
| 277 | - id=${`${d}__opt-${_}`} | |
| 244 | + id=${`${d}__opt-${x}`} | |
| 278 | 245 | role="option" |
| 279 | - data-value=${m.value} | |
| 280 | - aria-selected=${m.value===t?"true":"false"} | |
| 281 | - aria-disabled=${m.disabled?"true":"false"} | |
| 282 | - ?data-active=${this._open&&_===this._activeIndex} | |
| 283 | - @click=${()=>this._onOptionClick(m)} | |
| 284 | - @pointermove=${()=>this._setActive(_)} | |
| 246 | + data-value=${_.value} | |
| 247 | + aria-selected=${_.value===t?"true":"false"} | |
| 248 | + aria-disabled=${_.disabled?"true":"false"} | |
| 249 | + ?data-active=${this._open&&x===this._activeIndex} | |
| 250 | + @click=${()=>this._onOptionClick(_)} | |
| 251 | + @pointermove=${()=>this._setActive(x)} | |
| 285 | 252 | > |
| 286 | - ${E("check",{size:16,className:"os-select__check"})} | |
| 253 | + ${Y("check",{size:16,className:"os-select__check"})} | |
| 287 | 254 | <span class="os-select__option-label" |
| 288 | - >${m.label}</span | |
| 255 | + >${_.label}</span | |
| 289 | 256 | > |
| 290 | 257 | </div> |
| 291 | 258 | `)} |
| 292 | 259 | </div> |
| 293 | - `}_readOptions(){const e=[],t=this.querySelectorAll(":scope > os-option");for(const o of Array.from(t)){const s=o.getAttribute("value");s!==null&&e.push({value:s,label:(o.textContent||s).trim(),disabled:o.hasAttribute("disabled")})}return e}_popup(){return this.shadowRoot?.querySelector(".os-select__popup")??null}_trigger(){return this.shadowRoot?.querySelector(".os-select__trigger")??null}_toggle(){if(this._open){this._hide();return}performance.now()-this._dismissedAt<250||this._show()}_show(){const e=this._popup(),t=this._trigger();if(!e||!t||this._open)return;this._open=!0;const o=this._readOptions(),s=this.value,a=o.findIndex(n=>n.value===s&&!n.disabled);this._activeIndex=a>=0?a:o.findIndex(n=>!n.disabled);const r=t.getBoundingClientRect();e.style.minWidth=`${r.width}px`,typeof e.showPopover=="function"?(e.style.left=`${r.left}px`,e.style.top=`${r.bottom+4}px`,e.showPopover(),r.bottom+4+e.offsetHeight>window.innerHeight-8&&(e.style.top=`${Math.max(8,r.top-4-e.offsetHeight)}px`)):e.setAttribute("data-open",""),window.addEventListener("scroll",this._onWindowScroll,{capture:!0,passive:!0}),window.addEventListener("resize",this._onWindowResize),this.requestUpdate(),this._scrollActiveIntoView()}_hide(){if(!this._open)return;this._open=!1;const e=this._popup();if(e){if(typeof e.hidePopover=="function")try{e.hidePopover()}catch{}e.removeAttribute("data-open")}this._teardownDismiss(),this.requestUpdate()}_teardownDismiss(){window.removeEventListener("scroll",this._onWindowScroll,{capture:!0}),window.removeEventListener("resize",this._onWindowResize)}_onPopoverToggle(e){e.newState==="closed"&&this._open&&(this._dismissedAt=performance.now(),this._open=!1,this._teardownDismiss(),this.requestUpdate())}_onOptionClick(e){e.disabled||this._commit(e.value)}_commit(e){this._hide(),this.value=e,this.emit("os-pick",{value:e})}_setActive(e){if(e===this._activeIndex)return;const t=this._readOptions();!t[e]||t[e].disabled||(this._activeIndex=e,this.requestUpdate())}_moveActive(e){const t=this._readOptions();let o=this._activeIndex;for(let s=0;s<t.length&&(o=Math.min(Math.max(o+e,0),t.length-1),!(!t[o]?.disabled||o===0||o===t.length-1));s++);o!==this._activeIndex&&t[o]&&!t[o].disabled&&(this._activeIndex=o,this.requestUpdate(),this._scrollActiveIntoView())}_scrollActiveIntoView(){queueMicrotask(()=>{this.shadowRoot?.querySelector(".os-select__option[data-active]")?.scrollIntoView?.({block:"nearest"})})}_typeAhead(e){this._typedTimer&&clearTimeout(this._typedTimer),this._typed+=e.toLowerCase(),this._typedTimer=setTimeout(()=>{this._typed=""},500);const o=this._readOptions().findIndex(s=>!s.disabled&&s.label.toLowerCase().startsWith(this._typed));o>=0&&(this._activeIndex=o,this.requestUpdate(),this._scrollActiveIntoView())}_onTriggerKeydown(e){const t=this._readOptions();if(t.length!==0){if(!this._open){if(["ArrowDown","ArrowUp","Enter"," ","Home","End"].includes(e.key)){if(e.preventDefault(),this._show(),e.key==="Home"&&(this._activeIndex=t.findIndex(o=>!o.disabled)),e.key==="End"){for(let o=t.length-1;o>=0;o--)if(!t[o].disabled){this._activeIndex=o;break}}this.requestUpdate()}else e.key.length===1&&e.key.trim()!==""&&(this._show(),this._typeAhead(e.key));return}switch(e.key){case"ArrowDown":e.preventDefault(),this._moveActive(1);break;case"ArrowUp":e.preventDefault(),this._moveActive(-1);break;case"Home":e.preventDefault(),this._activeIndex=t.findIndex(o=>!o.disabled),this.requestUpdate(),this._scrollActiveIntoView();break;case"End":e.preventDefault();for(let o=t.length-1;o>=0;o--)if(!t[o].disabled){this._activeIndex=o,this.requestUpdate(),this._scrollActiveIntoView();break}break;case"Enter":case" ":{e.preventDefault();const o=t[this._activeIndex];o&&!o.disabled&&this._commit(o.value);break}case"Tab":{const o=t[this._activeIndex];o&&!o.disabled?this._commit(o.value):this._hide();break}case"Escape":e.preventDefault(),this._hide();break;default:e.key.length===1&&e.key.trim()!==""&&this._typeAhead(e.key)}}}};G.props=["value","label","placeholder","disabled","name"],G.styles=[Io],G.help={title:"Select",summary:"Dropdown picker: a combobox trigger plus a custom top-layer listbox, so the popup wears the station instead of the operating system. Mirrors the <os-segmented> contract (set value, listen for os-pick).",status:"stable",props:[{name:"value",type:"string",description:"Currently selected option value."},{name:"label",type:"string",description:"Visible label rendered above the trigger and used as the accessible name."},{name:"placeholder",type:"string",description:"Trigger text shown when no value is set."},{name:"disabled",type:"boolean attribute",description:"Disables the trigger and dims the chrome."},{name:"plain",type:"boolean attribute",description:"Drops the field chrome and shrinks to the value, for a picker that is a list row’s trailing control rather than a field of its own. The container already draws the box; use with no `label`."},{name:"name",type:"string",description:"Accepted for compatibility. Shadow-DOM controls never participated in light-DOM form submission, so nothing is lost by the native select being gone; read `value` off the host instead."}],slots:[{name:"(default)",description:'<os-option value="…"> children.'}],events:[{name:"os-pick",description:"Fires when the user picks a new option.",detail:"{ value: string }"}],cssProps:[{name:"--os-ui-fg",description:"Label + value colour."},{name:"--os-ui-fg-muted",description:"Placeholder + chevron colour."},{name:"--os-ui-accent",description:"Active option row + selected check."}],example:f` | |
| 260 | + `}_readOptions(){const e=[],t=this.querySelectorAll(":scope > os-option");for(const o of Array.from(t)){const i=o.getAttribute("value");i!==null&&e.push({value:i,label:(o.textContent||i).trim(),disabled:o.hasAttribute("disabled")})}return e}_popup(){return this.shadowRoot?.querySelector(".os-select__popup")??null}_trigger(){return this.shadowRoot?.querySelector(".os-select__trigger")??null}_toggle(){if(this._open){this._hide();return}performance.now()-this._dismissedAt<250||this._show()}_show(){const e=this._popup(),t=this._trigger();if(!e||!t||this._open)return;this._open=!0;const o=this._readOptions(),i=this.value,a=o.findIndex(r=>r.value===i&&!r.disabled);this._activeIndex=a>=0?a:o.findIndex(r=>!r.disabled);const n=t.getBoundingClientRect();e.style.minWidth=`${n.width}px`,typeof e.showPopover=="function"?(e.style.left=`${n.left}px`,e.style.top=`${n.bottom+4}px`,e.showPopover(),n.bottom+4+e.offsetHeight>window.innerHeight-8&&(e.style.top=`${Math.max(8,n.top-4-e.offsetHeight)}px`)):e.setAttribute("data-open",""),window.addEventListener("scroll",this._onWindowScroll,{capture:!0,passive:!0}),window.addEventListener("resize",this._onWindowResize),this.requestUpdate(),this._scrollActiveIntoView()}_hide(){if(!this._open)return;this._open=!1;const e=this._popup();if(e){if(typeof e.hidePopover=="function")try{e.hidePopover()}catch{}e.removeAttribute("data-open")}this._teardownDismiss(),this.requestUpdate()}_teardownDismiss(){window.removeEventListener("scroll",this._onWindowScroll,{capture:!0}),window.removeEventListener("resize",this._onWindowResize)}_onPopoverToggle(e){e.newState==="closed"&&this._open&&(this._dismissedAt=performance.now(),this._open=!1,this._teardownDismiss(),this.requestUpdate())}_onOptionClick(e){e.disabled||this._commit(e.value)}_commit(e){this._hide(),this.value=e,this.emit("os-pick",{value:e})}_setActive(e){if(e===this._activeIndex)return;const t=this._readOptions();!t[e]||t[e].disabled||(this._activeIndex=e,this.requestUpdate())}_moveActive(e){const t=this._readOptions();let o=this._activeIndex;for(let i=0;i<t.length&&(o=Math.min(Math.max(o+e,0),t.length-1),!(!t[o]?.disabled||o===0||o===t.length-1));i++);o!==this._activeIndex&&t[o]&&!t[o].disabled&&(this._activeIndex=o,this.requestUpdate(),this._scrollActiveIntoView())}_scrollActiveIntoView(){queueMicrotask(()=>{this.shadowRoot?.querySelector(".os-select__option[data-active]")?.scrollIntoView?.({block:"nearest"})})}_typeAhead(e){this._typedTimer&&clearTimeout(this._typedTimer),this._typed+=e.toLowerCase(),this._typedTimer=setTimeout(()=>{this._typed=""},500);const o=this._readOptions().findIndex(i=>!i.disabled&&i.label.toLowerCase().startsWith(this._typed));o>=0&&(this._activeIndex=o,this.requestUpdate(),this._scrollActiveIntoView())}_onTriggerKeydown(e){const t=this._readOptions();if(t.length!==0){if(!this._open){if(["ArrowDown","ArrowUp","Enter"," ","Home","End"].includes(e.key)){if(e.preventDefault(),this._show(),e.key==="Home"&&(this._activeIndex=t.findIndex(o=>!o.disabled)),e.key==="End"){for(let o=t.length-1;o>=0;o--)if(!t[o].disabled){this._activeIndex=o;break}}this.requestUpdate()}else e.key.length===1&&e.key.trim()!==""&&(this._show(),this._typeAhead(e.key));return}switch(e.key){case"ArrowDown":e.preventDefault(),this._moveActive(1);break;case"ArrowUp":e.preventDefault(),this._moveActive(-1);break;case"Home":e.preventDefault(),this._activeIndex=t.findIndex(o=>!o.disabled),this.requestUpdate(),this._scrollActiveIntoView();break;case"End":e.preventDefault();for(let o=t.length-1;o>=0;o--)if(!t[o].disabled){this._activeIndex=o,this.requestUpdate(),this._scrollActiveIntoView();break}break;case"Enter":case" ":{e.preventDefault();const o=t[this._activeIndex];o&&!o.disabled&&this._commit(o.value);break}case"Tab":{const o=t[this._activeIndex];o&&!o.disabled?this._commit(o.value):this._hide();break}case"Escape":e.preventDefault(),this._hide();break;default:e.key.length===1&&e.key.trim()!==""&&this._typeAhead(e.key)}}}};we.props=["value","label","placeholder","disabled","name"],we.styles=[Yo],we.help={title:"Select",summary:"Dropdown picker: a combobox trigger plus a custom top-layer listbox, so the popup wears the station instead of the operating system. Mirrors the <os-segmented> contract (set value, listen for os-pick).",status:"stable",props:[{name:"value",type:"string",description:"Currently selected option value."},{name:"label",type:"string",description:"Visible label rendered above the trigger and used as the accessible name."},{name:"placeholder",type:"string",description:"Trigger text shown when no value is set."},{name:"disabled",type:"boolean attribute",description:"Disables the trigger and dims the chrome."},{name:"plain",type:"boolean attribute",description:"Drops the field chrome and shrinks to the value, for a picker that is a list row’s trailing control rather than a field of its own. The container already draws the box; use with no `label`."},{name:"name",type:"string",description:"Accepted for compatibility. Shadow-DOM controls never participated in light-DOM form submission, so nothing is lost by the native select being gone; read `value` off the host instead."}],slots:[{name:"(default)",description:'<os-option value="…"> children.'}],events:[{name:"os-pick",description:"Fires when the user picks a new option.",detail:"{ value: string }"}],cssProps:[{name:"--os-ui-fg",description:"Label + value colour."},{name:"--os-ui-fg-muted",description:"Placeholder + chevron colour."},{name:"--os-ui-accent",description:"Active option row + selected check."}],example:b` | |
| 294 | 261 | <os-select value="eur" label="Currency"> |
| 295 | 262 | <os-option value="eur">Euro</os-option> |
| 296 | 263 | <os-option value="usd">US Dollar</os-option> |
| 297 | 264 | <os-option value="jpy">Japanese Yen</os-option> |
| 298 | 265 | </os-select> |
| 299 | - `};let ye=G;S("os-select",ye);const Oo=x` | |
| 266 | + `};let nt=we;W("os-select",nt);const Qo=R` | |
| 300 | 267 | :host { |
| 301 | 268 | display: flex; |
| 302 | 269 | flex-direction: column; |
| 303 | 270 | gap: 4px; |
| @@ -380,9 +347,9 @@ | ||
| 380 | 347 | |
| 381 | 348 | :host( [ open ] ) .os-multiselect__chevron { |
| 382 | 349 | transform: rotate( 180deg ); |
| 383 | 350 | } |
| 384 | -`;function Do(){const i="os-multiselect-popover-styles";if(document.getElementById(i))return;const e=document.createElement("style");e.id=i,e.textContent=` | |
| 351 | +`;function ei(){const s="os-multiselect-popover-styles";if(document.getElementById(s))return;const e=document.createElement("style");e.id=s,e.textContent=` | |
| 385 | 352 | .os-multiselect__popover { |
| 386 | 353 | position: fixed; |
| 387 | 354 | z-index: 100000; |
| 388 | 355 | max-height: 320px; |
| @@ -482,13 +449,13 @@ | ||
| 482 | 449 | |
| 483 | 450 | @keyframes os-multiselect-spin { |
| 484 | 451 | to { transform: rotate( 360deg ); } |
| 485 | 452 | } |
| 486 | -`,document.head.appendChild(e)}typeof document<"u"&&Do();const Z=class Z extends k{constructor(){super(...arguments),this._optionObserver=null,this._popover=null,this._teardownOpen=null,this._hasMore=!1,this._loadingMore=!1}set items(e){const t=this.querySelectorAll(":scope > os-option");for(const a of Array.from(t))a.remove();for(const a of e){const r=document.createElement("os-option");r.setAttribute("value",a.value),r.textContent=a.label,this.appendChild(r)}this._loadingMore=!1;const o=new Set(e.map(a=>a.value)),s=this._readValues().filter(a=>o.has(a));this._writeValueAttribute(s),this.requestUpdate(),this._refreshPopover()}get values(){return this._readValues()}set values(e){const t=Array.isArray(e)?e.map(o=>String(o)).filter(o=>o!==""):[];this._writeValueAttribute(t),this.requestUpdate(),this._refreshPopover()}get hasMore(){return this._hasMore}set hasMore(e){this._hasMore=!!e,this._refreshPopover()}get loadingMore(){return this._loadingMore}set loadingMore(e){this._loadingMore=!!e,this._refreshPopover()}appendItems(e){if(this._loadingMore=!1,!e||e.length===0){this._refreshPopover();return}const t=new Set(Array.from(this.querySelectorAll(":scope > os-option")).map(o=>o.getAttribute("value")));for(const o of e){if(t.has(o.value))continue;const s=document.createElement("os-option");s.setAttribute("value",o.value),s.textContent=o.label,this.appendChild(s)}this.requestUpdate(),this._refreshPopover()}connectedCallback(){super.connectedCallback(),ze(this),this._optionObserver=new MutationObserver(()=>{this.requestUpdate(),this._refreshPopover()}),this._optionObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value","disabled"],characterData:!0})}disconnectedCallback(){this._optionObserver?.disconnect(),this._optionObserver=null,this._closePopover()}render(){const e=this.label||"",t=this.placeholder||"All",o=this.disabled!==null;e?this.setAttribute("aria-label",e):this.removeAttribute("aria-label");const s=e||t,a=this._summarize(t),r=this._readValues().length>0,l=`${this.id||"os-unnamed"}__trigger`;return f` | |
| 487 | - ${e?f`<label | |
| 453 | +`,document.head.appendChild(e)}typeof document<"u"&&ei();const $e=class $e extends U{constructor(){super(...arguments),this._optionObserver=null,this._popover=null,this._teardownOpen=null,this._hasMore=!1,this._loadingMore=!1}set items(e){const t=this.querySelectorAll(":scope > os-option");for(const a of Array.from(t))a.remove();for(const a of e){const n=document.createElement("os-option");n.setAttribute("value",a.value),n.textContent=a.label,this.appendChild(n)}this._loadingMore=!1;const o=new Set(e.map(a=>a.value)),i=this._readValues().filter(a=>o.has(a));this._writeValueAttribute(i),this.requestUpdate(),this._refreshPopover()}get values(){return this._readValues()}set values(e){const t=Array.isArray(e)?e.map(o=>String(o)).filter(o=>o!==""):[];this._writeValueAttribute(t),this.requestUpdate(),this._refreshPopover()}get hasMore(){return this._hasMore}set hasMore(e){this._hasMore=!!e,this._refreshPopover()}get loadingMore(){return this._loadingMore}set loadingMore(e){this._loadingMore=!!e,this._refreshPopover()}appendItems(e){if(this._loadingMore=!1,!e||e.length===0){this._refreshPopover();return}const t=new Set(Array.from(this.querySelectorAll(":scope > os-option")).map(o=>o.getAttribute("value")));for(const o of e){if(t.has(o.value))continue;const i=document.createElement("os-option");i.setAttribute("value",o.value),i.textContent=o.label,this.appendChild(i)}this.requestUpdate(),this._refreshPopover()}connectedCallback(){super.connectedCallback(),Mt(this),this._optionObserver=new MutationObserver(()=>{this.requestUpdate(),this._refreshPopover()}),this._optionObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value","disabled"],characterData:!0})}disconnectedCallback(){this._optionObserver?.disconnect(),this._optionObserver=null,this._closePopover()}render(){const e=this.label||"",t=this.placeholder||"All",o=this.disabled!==null;e?this.setAttribute("aria-label",e):this.removeAttribute("aria-label");const i=e||t,a=this._summarize(t),n=this._readValues().length>0,l=`${this.id||"os-unnamed"}__trigger`;return b` | |
| 454 | + ${e?b`<label | |
| 488 | 455 | class="os-multiselect__label" |
| 489 | 456 | for=${l} |
| 490 | - >${e}</label>`:f``} | |
| 457 | + >${e}</label>`:b``} | |
| 491 | 458 | <button |
| 492 | 459 | id=${l} |
| 493 | 460 | type="button" |
| 494 | 461 | class="os-multiselect__trigger" |
| @@ -493,53 +460,140 @@ | ||
| 493 | 460 | type="button" |
| 494 | 461 | class="os-multiselect__trigger" |
| 495 | 462 | aria-haspopup="listbox" |
| 496 | 463 | aria-expanded=${this._isOpen()?"true":"false"} |
| 497 | - aria-label=${s} | |
| 464 | + aria-label=${i} | |
| 498 | 465 | ?disabled=${o} |
| 499 | - data-active=${r?"true":"false"} | |
| 466 | + data-active=${n?"true":"false"} | |
| 500 | 467 | @click=${c=>this._onTriggerClick(c)} |
| 501 | 468 | > |
| 502 | 469 | <span class="os-multiselect__summary">${a}</span> |
| 503 | - ${E("chevron-right",{size:16,rotate:90,className:"os-multiselect__chevron"})} | |
| 470 | + ${Y("chevron-right",{size:16,rotate:90,className:"os-multiselect__chevron"})} | |
| 504 | 471 | </button> |
| 505 | - `}_readOptions(){const e=[],t=this.querySelectorAll(":scope > os-option");for(const o of Array.from(t)){const s=o.getAttribute("value");s!==null&&e.push({value:s,label:(o.textContent||s).trim(),disabled:o.hasAttribute("disabled")})}return e}_readValues(){return(this.value??"").split(",").map(t=>t.trim()).filter(t=>t!=="")}_writeValueAttribute(e){const t=e.join(",");this.value=t}_summarize(e){const t=this._readValues();if(t.length===0)return e;const o=this._readOptions(),s=new Map(o.map(a=>[a.value,a.label]));return t.length===1?s.get(t[0])??t[0]:`${t.length} selected`}_isOpen(){return this.open!==null}_onTriggerClick(e){e.stopPropagation(),e.preventDefault(),this.disabled===null&&(this._popover?this._closePopover():this._openPopover())}_openPopover(){if(this._popover)return;const e=document.createElement("div");e.className="os-multiselect__popover",e.setAttribute("role","listbox"),e.setAttribute("aria-multiselectable","true"),e.style.setProperty("--wp-admin-theme-color",getComputedStyle(this).getPropertyValue("--wp-admin-theme-color")||"#2271b1"),document.body.appendChild(e),this._popover=e,this._refreshPopover(),this._placePopover();const t=r=>{const n=r.target;if(!n)return;const l=this.shadowRoot?.querySelector(".os-multiselect__trigger");e.contains(n)||l&&l.contains(n)||this._closePopover()},o=r=>{r.key==="Escape"&&(r.stopPropagation(),this._closePopover(),this.shadowRoot?.querySelector(".os-multiselect__trigger")?.focus())},s=()=>this._placePopover(),a=()=>{if(!this._hasMore||this._loadingMore)return;const r=e.scrollHeight,n=e.clientHeight,l=e.scrollTop;r-(l+n)<64&&this.emit("os-multiselect-load-more",{})};setTimeout(()=>{document.addEventListener("pointerdown",t,!0)},0),document.addEventListener("keydown",o,!0),window.addEventListener("resize",s),window.addEventListener("scroll",s,!0),e.addEventListener("scroll",a),this._teardownOpen=()=>{document.removeEventListener("pointerdown",t,!0),document.removeEventListener("keydown",o,!0),window.removeEventListener("resize",s),window.removeEventListener("scroll",s,!0),e.removeEventListener("scroll",a)},this.setAttribute("open",""),this.requestUpdate(),this.emit("os-multiselect-open",{})}_closePopover(){this._teardownOpen&&(this._teardownOpen(),this._teardownOpen=null),this._popover&&(this._popover.remove(),this._popover=null,this.removeAttribute("open"),this.requestUpdate(),this.emit("os-multiselect-close",{}))}_refreshPopover(){const e=this._popover;if(!e)return;const t=this._readOptions(),o=new Set(this._readValues());if(e.replaceChildren(),t.length===0){const s=document.createElement("div");s.className="os-multiselect__empty",s.textContent="No options",e.appendChild(s);return}if(o.size>0){const s=document.createElement("button");s.type="button",s.className="os-multiselect__clear",s.textContent="Clear",s.addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),this._writeValueAttribute([]),this.requestUpdate(),this._refreshPopover(),this._emitPick()}),e.appendChild(s)}for(const s of t){const a=document.createElement("label");a.className="os-multiselect__option",a.setAttribute("role","option"),a.setAttribute("aria-selected",o.has(s.value)?"true":"false"),s.disabled&&(a.setAttribute("aria-disabled","true"),a.dataset.disabled="true");const r=document.createElement("input");r.type="checkbox",r.checked=o.has(s.value),r.disabled=s.disabled,r.addEventListener("change",()=>{const l=new Set(this._readValues());r.checked?l.add(s.value):l.delete(s.value);const c=t.map(d=>d.value).filter(d=>l.has(d));this._writeValueAttribute(c),a.setAttribute("aria-selected",r.checked?"true":"false"),this.requestUpdate(),this._refreshPopover(),this._emitPick()});const n=document.createElement("span");n.textContent=s.label,a.appendChild(r),a.appendChild(n),e.appendChild(a)}if(this._loadingMore){const s=document.createElement("div");s.className="os-multiselect__loading";const a=document.createElement("span");a.className="os-multiselect__spinner",a.setAttribute("aria-hidden","true");const r=document.createElement("span");r.textContent="Loading…",s.appendChild(a),s.appendChild(r),e.appendChild(s)}}_placePopover(){const e=this._popover,t=this.shadowRoot?.querySelector(".os-multiselect__trigger");if(!e||!t)return;const o=t.getBoundingClientRect(),s=window.innerWidth,a=window.innerHeight,r=Math.max(o.width,200);e.style.minWidth=`${r}px`;let n=o.left;n+r>s-8&&(n=Math.max(8,s-r-8)),e.style.left=`${n}px`,e.style.top=`${o.bottom+4}px`;const l=e.offsetHeight||200;o.bottom+4+l>a-8&&(e.style.top=`${Math.max(8,o.top-l-4)}px`)}_emitPick(){const e=this._readValues();this.emit("os-pick",{value:e.join(","),values:e})}};Z.props=["value","label","placeholder","disabled","name","open"],Z.styles=[Oo],Z.help=void 0;let xe=Z;S("os-multiselect",xe);const Ho="openstation.postsWindow.columns",qo="openstation.postsWindow.statusSegments",Fo="openstation.postsWindow.bulkActions",Vo="openstation.postsWindow.toolbarTrailing",Uo="openstation.postsWindow.opened",jo="openstation.postsWindow.dataLoaded",we="[openstation:desktop-mode-posts]",et=new Set(["title"]),Wo=new Set(["title","author","parent","date"]);function ke(){try{const i=window.wp?.os;if(i&&typeof i.getOsSettings=="function"){const e=i.getOsSettings();if(Array.isArray(e.nativePostsHiddenColumns))return new Set(e.nativePostsHiddenColumns)}}catch{}return new Set}const tt={authors:[],tags:[]};function ot(i,e,t,o){const s="osPostsFilterMounted",a=i,r=t.map(c=>({value:String(c.id),label:c.name})),n=r.map(c=>`${c.value}:${c.label}`).join("|");if(a[s]){const c=a[s];c.listSig!==n&&(c.picker.items=r,c.listSig=n),c.picker.getAttribute("value")!==e.value&&c.picker.setAttribute("value",e.value),c.picker.hasMore=!!o.hasMore;return}const l=document.createElement("os-multiselect");if(l.setAttribute("placeholder",o.label),l.setAttribute("aria-label",o.ariaLabel),l.setAttribute("data-noclick",""),l.setAttribute("value",e.value),o.dataKey&&l.setAttribute("data-key",o.dataKey),i.appendChild(l),l.items=r,l.hasMore=!!o.hasMore,l.addEventListener("os-pick",c=>{const d=c.detail?.value??"";e.value=d,e.setValue(d)}),o.onLoadMore){const c=o.onLoadMore;l.addEventListener("os-multiselect-load-more",()=>{l.loadingMore=!0,c()})}a[s]={picker:l,listSig:n}}function Ko(i,e,t){const o={key:"title",label:p("Title"),sortable:!0,sticky:!0,render:(c,d)=>A(e,d.id,"title",()=>Qt(d,i))},s={key:"author",label:p("Author"),sortable:!0,width:"180px",filterRender:(c,d)=>ot(c,d,t.authors,{label:p("All authors"),ariaLabel:p("Filter by author")}),render:(c,d)=>A(e,d.id,"author",()=>Jt(d))},a={key:"date",label:p("Date"),sortable:!0,width:"170px",sortValue:c=>Date.parse(c.date_gmt+"Z")||0,render:(c,d)=>A(e,d.id,"date",()=>eo(d))};if(i.extra.mode==="pages")return[o,s,{key:"parent",label:p("Parent"),width:"200px",render:(c,d)=>A(e,d.id,"parent",()=>Eo(d,i))},{key:"template",label:p("Template"),width:"180px",render:(c,d)=>A(e,d.id,"template",()=>Po(d,i))},{key:"slug",label:p("Slug"),width:"200px",render:(c,d)=>A(e,d.id,"slug",()=>To(d,i))},{key:"comments",label:p("Comments"),width:"110px",sortValue:c=>typeof c.openstation_comment_count=="number"?c.openstation_comment_count:0,render:(c,d)=>A(e,d.id,"comments",()=>Ro(d))},a];const r=[o,s],{categories:n,tags:l}=i.cells;return n&&r.push({key:"categories",label:p("Categories"),width:"260px",render:(c,d)=>A(e,d.id,"categories",()=>n(d,i))}),l&&r.push({key:"tags",label:p("Tags"),minWidth:"360px",filterRender:(c,d)=>ot(c,d,t.tags.map(u=>({id:u.id,name:u.name})),{label:p("All tags"),ariaLabel:p("Filter by tag"),dataKey:"tags",hasMore:!!t.tagsHasMore,onLoadMore:t.loadMoreTags}),render:(c,d)=>A(e,d.id,"tags",()=>l(d,i))}),r.push(a),r}function st(i,e,t=tt){const o=Ko(i,e,t),s=window.wp?.hooks;return s&&typeof s.applyFilters=="function"?s.applyFilters(Ho,o):o}function Bo(i){return st(i,new Map).filter(e=>!et.has(e.key)).map(e=>({key:e.key,label:e.label||e.key}))}function Go(i,e,t=tt,o=!1,s=ke()){const a=st(i,e,t),r=s.size===0?a:a.filter(n=>et.has(n.key)||!s.has(n.key));return o?r.filter(n=>Wo.has(n.key)):r}function Zo(){return[{value:"",label:p("All")},{value:"publish",label:p("Published")},{value:"draft",label:p("Drafts")},{value:"pending",label:p("Pending")},{value:"future",label:p("Scheduled")},{value:"trash",label:p("Trash")}]}function Xo(){const i=window.wp?.hooks,e=Zo();if(!i||typeof i.applyFilters!="function")return e;try{const t=i.applyFilters(qo,e);return Array.isArray(t)&&t.length>0?t:e}catch(t){return console.error(`${we} status-segments filter threw; falling back to defaults:`,t),e}}function Yo(i,e){return[{id:"trash",label:p("Move to trash"),icon:"dashicons-trash",variant:"danger",confirm:t=>P(i==="pages"?ae("Move %d page to the trash?","Move %d pages to the trash?",t):ae("Move %d post to the trash?","Move %d posts to the trash?",t),t),run:async(t,o)=>{const s=o.table.data??[],a=t.filter(r=>{const n=s.find(l=>l.id===r);return n&&n.status!=="trash"});return a.length>0&&await e(a),o.table.clearSelection(),!1}}]}function Qo(i){const e=window.wp?.hooks;if(!e||typeof e.applyFilters!="function")return i;try{const t=e.applyFilters(Fo,i);return Array.isArray(t)?t:i}catch(t){return console.error(`${we} bulk-actions filter threw; falling back to defaults:`,t),i}}function Jo(i){const e=window.wp?.hooks;if(!e||typeof e.applyFilters!="function")return[];try{const t=e.applyFilters(Vo,[],i);return Array.isArray(t)?t.filter(o=>o instanceof HTMLElement):[]}catch(t){return console.error(`${we} toolbar-trailing filter threw; ignoring:`,t),[]}}function es(i,e="date"){switch(i){case"title":case"author":case"date":case"modified":return i;case"comments":return"comment_count";default:return e}}function ts(i){return i==="comment_count"?"comments":i}function se(i,e,t){const o=window.wp?.os;o&&typeof o.broadcast=="function"&&o.broadcast("os.term.changed",{source:"posts-window",taxonomy:i,action:e,id:t})}function R(i){const e=new URLSearchParams;for(const[o,s]of Object.entries(i))s!==void 0&&s!==""&&e.set(o,String(s));const t=e.toString();return t?`?${t}`:""}function os(i){const e=async(r,n={})=>{const l=await i(r,{...n,headers:{...n.body?{"Content-Type":"application/json"}:{},...n.headers??{}}});if(!l.ok){let d=`${l.status} ${l.statusText}`;try{const u=await l.json();u&&typeof u.message=="string"&&(d=u.message)}catch{}throw new Error(d)}return{data:n.expectJson===!1?null:await l.json(),headers:l.headers}},t=async(r,n)=>{const l={per_page:20,_fields:"id,name,slug,count",orderby:"count",order:"desc"};r&&(l.search=r,l.orderby="name",l.order="asc");const{data:c}=await e(`wp/v2/tags${R(l)}`,{method:"GET",signal:n});return Array.isArray(c)?c:[]},o=async r=>{const{data:n}=await e(`wp/v2/categories${R({per_page:100,_fields:"id,name,slug,parent",orderby:"name",order:"asc"})}`,{method:"GET",signal:r});return Array.isArray(n)?n:[]},s=(r,n=0)=>{const l=r.openstation_count;return{id:r.id??n,name:r.name??"",slug:r.slug??"",parent:r.parent??0,count:typeof l=="number"?l:r.count??0,description:r.description??"",isDefault:r.openstation_is_default===!0}},a=async(r,n={})=>{const{data:l,headers:c}=await e(`wp/v2/${r}${R({per_page:n.perPage??50,page:n.page??1,_fields:"id,name,slug,parent,count,description,openstation_is_default",orderby:n.orderby??"name",order:n.order??"asc",search:n.search,parent:typeof n.parent=="number"&&n.parent>=0?n.parent:void 0})}`,{method:"GET"});return{items:Array.isArray(l)?l.map(d=>s(d)):[],total:parseInt(c.get("X-WP-Total")??"0",10)||0,totalPages:parseInt(c.get("X-WP-TotalPages")??"0",10)||0}};return{searchTags:t,fetchAllCategories:o,async createTag(r){try{const{data:n}=await e("wp/v2/tags",{method:"POST",body:JSON.stringify({name:r})});return se("post_tag","created",n.id),n}catch(n){const l=n instanceof Error?n.message:String(n);if(/term[\s_]?exists/i.test(l)){const c=(await t(r)).find(d=>d.name.toLowerCase()===r.toLowerCase());if(c)return c}throw n}},async updatePostTags(r,n){const{data:l}=await e(`wp/v2/posts/${r}`,{method:"POST",body:JSON.stringify({tags:n})});return l},async fetchAuthorOptions(r){try{const{data:n}=await e(`wp/v2/users${R({per_page:100,who:"authors",_fields:"id,name",orderby:"name",order:"asc"})}`,{method:"GET",signal:r});return Array.isArray(n)?n:[]}catch{return[]}},async fetchTagOptions(r=1,n=50,l){try{const{data:c,headers:d}=await e(`wp/v2/tags${R({per_page:Math.max(1,n),page:Math.max(1,r),_fields:"id,name,count",orderby:"count",order:"desc"})}`,{method:"GET",signal:l});return{items:Array.isArray(c)?c:[],totalPages:parseInt(d.get("X-WP-TotalPages")??"0",10)||0}}catch{return{items:[],totalPages:0}}},async createCategory(r,n=0,l={}){const c={name:r,parent:n};l.slug&&(c.slug=l.slug),l.description&&(c.description=l.description);try{const{data:d}=await e("wp/v2/categories",{method:"POST",body:JSON.stringify(c)});return se("category","created",d.id),d}catch(d){const u=d instanceof Error?d.message:String(d);if(/term[\s_]?exists/i.test(u)){const h=(await o()).find(g=>g.name.toLowerCase()===r.toLowerCase()&&g.parent===n);if(h)return h}throw d}},async updatePostCategories(r,n){const{data:l}=await e(`wp/v2/posts/${r}`,{method:"POST",body:JSON.stringify({categories:n})});return l},fetchTerms:a,async fetchAllTerms(r){const n=[];let l=1;for(;l<=5;){const c=await a(r,{page:l,perPage:100});if(n.push(...c.items),l>=c.totalPages)break;l++}return n},async fetchTagCooccurrence(r="tags",n=8){const{data:l}=await e(`desktop-mode/v1/tag-cooccurrence${R({taxonomy:r==="tags"?"post_tag":"category",limit:n})}`,{method:"GET"}),c=new Map,d=l&&typeof l=="object"&&!Array.isArray(l)?l.pairs:void 0;if(!d)return c;for(const[u,h]of Object.entries(d)){const g=parseInt(u,10);if(!Number.isFinite(g)||g<=0)continue;const m=[];for(const _ of h){const b=Number(_?.id),v=Number(_?.shared);Number.isFinite(b)&&b>0&&Number.isFinite(v)&&v>0&&m.push({id:b,shared:v})}m.length>0&&c.set(g,m)}return c},async updateTerm(r,n,l){const{data:c}=await e(`wp/v2/${r}/${n}`,{method:"POST",body:JSON.stringify(l)});return se(r==="categories"?"category":"post_tag","updated",n),s(c,n)},async deleteTerm(r,n){await e(`wp/v2/${r}/${n}?force=true`,{method:"DELETE"}),se(r==="categories"?"category":"post_tag","deleted",n)},async fetchTermPosts(r,n,l,c){const{data:d,headers:u}=await e(`wp/v2/posts${R({[r]:n,per_page:c,page:l,status:"any",_fields:"id,title,status"})}`,{method:"GET"}),h=parseInt(u.get("X-WP-Total")??"",10);return{items:(Array.isArray(d)?d:[]).map(g=>({id:g.id,title:g.title?.rendered||`#${g.id}`})),totalPages:Math.max(1,parseInt(u.get("X-WP-TotalPages")??"1",10)||1),total:Number.isFinite(h)?h:-1}},async fetchTermCounts(r,n){const{data:l}=await e(`desktop-mode/v1/term-counts${R({taxonomy:r,ids:n.join(",")})}`,{method:"GET"});return l&&typeof l=="object"?l:{}}}}const ss="[openstation:desktop-mode-posts]",H=i=>i.root.querySelector("[data-os-posts-table]");function is(i){return{page:i.page,perPage:i.perPage,search:i.search||void 0,status:i.status||void 0,orderby:i.orderby,order:i.order,author:i.author.length>0?i.author:void 0,tag:i.tag.length>0?i.tag:void 0}}function Ce(i,e){if(!e.postsCtx){const t={body:i.root,get table(){return H(i)},refresh:()=>i.dispatch("refresh").then(()=>{}),getSelectedIds:()=>Array.from(H(i)?.selection??[]).map(o=>Number(o)),getSelectedRows:()=>{const o=new Set(t.getSelectedIds());return(H(i)?.data??[]).filter(s=>o.has(s.id))},getCurrentParams:()=>is(i.state)};e.postsCtx=t}return e.postsCtx}async function rs(i,e,t){const o=t.getSelectedIds();if(o.length===0)return;const{confirm:s}=e;if(s){const a=typeof s=="function"?s(o.length):P(s,o.length);if(!await(i.host.confirm?.({message:a,danger:!0})??Promise.resolve(!1)))return}try{if(await e.run(o,t)===!1)return}catch(a){console.error(`${ss} bulk action "${e.id}" failed`,a)}t.table.clearSelection(),await t.refresh()}function ns(i){const e={items:i.list.items,total:i.list.total,totalPages:i.list.pages,page:i.list.page},t=window.wp?.hooks;t&&typeof t.doAction=="function"&&t.doAction(jo,e),document.dispatchEvent(new CustomEvent("os-posts-window-data-loaded",{detail:e}))}const as="[openstation:desktop-mode-posts]",ls=50,$e=()=>({client:null,env:null,cellCache:new Map,table:At(),filterData:{authors:[],tags:[]},columnsKey:"",hidden:null,selected:0,bulkActions:null,extras:null,postsCtx:null,tab:"posts",canvases:{categories:null,tags:null},canvasPending:new Set,menu:null,disposed:!1,tagPage:0,tagTotalPages:1,tagFetching:!1}),cs=i=>i.mode==="pages"?"pages":"posts";function ds(i){return i.map(e=>`${e.id}:${e.status}:${e.modified_gmt}`).join("|")}function ie(i,e){return e.client||(e.client=os(i.fetch)),e.client}function q(i){return i.hidden||(i.hidden=ke()),i.hidden}function it(i,e,t){let o="";t instanceof Error?o=t.message:t!=null&&(o=String(t)),i.host.toast?.({message:`${e} ${o}`.trim(),duration:6e3})}function rt(i,e,t){return e.env||(e.env={extra:i.extra,client:ie(i,e),cells:t,openUrl:(o,s,a)=>i.host.openUrl?.(o,s,a),confirm:o=>i.host.confirm?.(o)??Promise.resolve(!1),toast:(o,s)=>it(i,o,s),announce:(o,s)=>i.host.announce?.("post",o,s),parentTitles:new Map,categories:{tree:null,pickers:new Set}}),e.env}function us(i,e){return{client:ie(i,e),extra:i.extra,openUrl:(t,o,s)=>i.host.openUrl?.(t,o,s),toast:(t,o)=>it(i,t,o),leaveFullscreen:()=>{const t=window.wp?.os?.windowManager?.getById?.(i.windowId);t?.isFullscreen?.()&&t.toggleFullscreen?.()}}}async function nt(i,e){if(!(e.tagFetching||e.tagPage>=e.tagTotalPages)){e.tagFetching=!0;try{const t=e.tagPage+1,o=await ie(i,e).fetchTagOptions(t,ls);e.tagPage=t,e.tagTotalPages=Math.max(e.tagTotalPages,o.totalPages||t);const s=new Set(e.filterData.tags.map(a=>a.id));for(const a of o.items)s.has(a.id)||(e.filterData.tags.push(a),s.add(a.id));e.filterData.tagsHasMore=e.tagPage<e.tagTotalPages,i.repaint()}finally{e.tagFetching=!1}}}const hs=i=>`${i.authors.map(e=>e.id).join(",")}|${i.tags.map(e=>e.id).join(",")}|${i.tagsHasMore?1:0}`,at=i=>i.split(",").map(e=>parseInt(e.trim(),10)).filter(e=>Number.isFinite(e)&&e>0),lt=(i,e)=>i.length===e.length&&i.every((t,o)=>t===e[o]);function ps(i,e,t){const o=i.extra;t.getRowId=a=>a.id,t.subTable=a=>to(a);const s=ts(i.state.orderby);t.sort=t.columns.some(a=>a.key===s)?{key:s,direction:i.state.order}:null,t.addEventListener("os-table-selection-change",()=>{e.selected=t.selection?.size??0,i.repaint()}),t.addEventListener("os-table-sort-change",a=>{const r=a.detail?.sort,n=o.defaultOrderby??"date";i.dispatch("sort",r?{orderby:es(r.key,n),order:r.direction}:{orderby:n,order:o.defaultOrder??"desc"})}),t.addEventListener("os-table-filter-change",a=>{const r=a.detail?.filters??{},n=at(r.author??""),l=at(r.tags??"");lt(n,i.state.author)&<(l,i.state.tag)||(i.local("set-column-filters",{author:n,tag:l}),i.dispatch("filter"))})}function fs(i,e={}){const t=e.terms,o=e.cells??{},s=(n,l,c)=>{if(!t||l.canvases[c]||l.canvasPending.has(c))return;const d=n.root.querySelector(c==="categories"?"[data-os-posts-cats-host]":"[data-os-posts-tags-host]");d&&(l.canvasPending.add(c),t[c](d,us(n,l)).then(u=>{if(l.disposed){u();return}l.canvases[c]=u}).catch(u=>{console.error(`${as} ${c} canvas failed`,u)}).finally(()=>l.canvasPending.delete(c)))},a=(n,l,c,d)=>(l.bulkActions||(l.bulkActions=Qo(Yo(c,u=>n.dispatch("trash",{ids:u})))),f` | |
| 506 | - <div class="os-app-list__toolbar-right ${d?"os-app-list__bulk--footer":""}" data-os-posts-bulk ?hidden=${l.selected===0}> | |
| 507 | - <span class="os-app-list__count" data-os-posts-count>${P(p("%d selected"),l.selected)}</span> | |
| 508 | - <span class="os-app-list__bulk-actions" data-os-posts-bulk-actions>${l.bulkActions.map(u=>f`<os-button | |
| 509 | - variant=${u.variant??"secondary"} | |
| 510 | - data-os-posts-bulk-action=${u.id} | |
| 511 | - @click=${()=>void rs(n,u,Ce(n,l))} | |
| 512 | - >${u.icon?f`<span class="dashicons ${u.icon}" aria-hidden="true"></span>`:""} ${u.label}</os-button>`)}</span> | |
| 472 | + `}_readOptions(){const e=[],t=this.querySelectorAll(":scope > os-option");for(const o of Array.from(t)){const i=o.getAttribute("value");i!==null&&e.push({value:i,label:(o.textContent||i).trim(),disabled:o.hasAttribute("disabled")})}return e}_readValues(){return(this.value??"").split(",").map(t=>t.trim()).filter(t=>t!=="")}_writeValueAttribute(e){const t=e.join(",");this.value=t}_summarize(e){const t=this._readValues();if(t.length===0)return e;const o=this._readOptions(),i=new Map(o.map(a=>[a.value,a.label]));return t.length===1?i.get(t[0])??t[0]:`${t.length} selected`}_isOpen(){return this.open!==null}_onTriggerClick(e){e.stopPropagation(),e.preventDefault(),this.disabled===null&&(this._popover?this._closePopover():this._openPopover())}_openPopover(){if(this._popover)return;const e=document.createElement("div");e.className="os-multiselect__popover",e.setAttribute("role","listbox"),e.setAttribute("aria-multiselectable","true"),e.style.setProperty("--wp-admin-theme-color",getComputedStyle(this).getPropertyValue("--wp-admin-theme-color")||"#2271b1"),document.body.appendChild(e),this._popover=e,this._refreshPopover(),this._placePopover();const t=n=>{const r=n.target;if(!r)return;const l=this.shadowRoot?.querySelector(".os-multiselect__trigger");e.contains(r)||l&&l.contains(r)||this._closePopover()},o=n=>{n.key==="Escape"&&(n.stopPropagation(),this._closePopover(),this.shadowRoot?.querySelector(".os-multiselect__trigger")?.focus())},i=()=>this._placePopover(),a=()=>{if(!this._hasMore||this._loadingMore)return;const n=e.scrollHeight,r=e.clientHeight,l=e.scrollTop;n-(l+r)<64&&this.emit("os-multiselect-load-more",{})};setTimeout(()=>{document.addEventListener("pointerdown",t,!0)},0),document.addEventListener("keydown",o,!0),window.addEventListener("resize",i),window.addEventListener("scroll",i,!0),e.addEventListener("scroll",a),this._teardownOpen=()=>{document.removeEventListener("pointerdown",t,!0),document.removeEventListener("keydown",o,!0),window.removeEventListener("resize",i),window.removeEventListener("scroll",i,!0),e.removeEventListener("scroll",a)},this.setAttribute("open",""),this.requestUpdate(),this.emit("os-multiselect-open",{})}_closePopover(){this._teardownOpen&&(this._teardownOpen(),this._teardownOpen=null),this._popover&&(this._popover.remove(),this._popover=null,this.removeAttribute("open"),this.requestUpdate(),this.emit("os-multiselect-close",{}))}_refreshPopover(){const e=this._popover;if(!e)return;const t=this._readOptions(),o=new Set(this._readValues());if(e.replaceChildren(),t.length===0){const i=document.createElement("div");i.className="os-multiselect__empty",i.textContent="No options",e.appendChild(i);return}if(o.size>0){const i=document.createElement("button");i.type="button",i.className="os-multiselect__clear",i.textContent="Clear",i.addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),this._writeValueAttribute([]),this.requestUpdate(),this._refreshPopover(),this._emitPick()}),e.appendChild(i)}for(const i of t){const a=document.createElement("label");a.className="os-multiselect__option",a.setAttribute("role","option"),a.setAttribute("aria-selected",o.has(i.value)?"true":"false"),i.disabled&&(a.setAttribute("aria-disabled","true"),a.dataset.disabled="true");const n=document.createElement("input");n.type="checkbox",n.checked=o.has(i.value),n.disabled=i.disabled,n.addEventListener("change",()=>{const l=new Set(this._readValues());n.checked?l.add(i.value):l.delete(i.value);const c=t.map(d=>d.value).filter(d=>l.has(d));this._writeValueAttribute(c),a.setAttribute("aria-selected",n.checked?"true":"false"),this.requestUpdate(),this._refreshPopover(),this._emitPick()});const r=document.createElement("span");r.textContent=i.label,a.appendChild(n),a.appendChild(r),e.appendChild(a)}if(this._loadingMore){const i=document.createElement("div");i.className="os-multiselect__loading";const a=document.createElement("span");a.className="os-multiselect__spinner",a.setAttribute("aria-hidden","true");const n=document.createElement("span");n.textContent="Loading…",i.appendChild(a),i.appendChild(n),e.appendChild(i)}}_placePopover(){const e=this._popover,t=this.shadowRoot?.querySelector(".os-multiselect__trigger");if(!e||!t)return;const o=t.getBoundingClientRect(),i=window.innerWidth,a=window.innerHeight,n=Math.max(o.width,200);e.style.minWidth=`${n}px`;let r=o.left;r+n>i-8&&(r=Math.max(8,i-n-8)),e.style.left=`${r}px`,e.style.top=`${o.bottom+4}px`;const l=e.offsetHeight||200;o.bottom+4+l>a-8&&(e.style.top=`${Math.max(8,o.top-l-4)}px`)}_emitPick(){const e=this._readValues();this.emit("os-pick",{value:e.join(","),values:e})}};$e.props=["value","label","placeholder","disabled","name","open"],$e.styles=[Qo],$e.help=void 0;let at=$e;W("os-multiselect",at);const ti="openstation.postsWindow.columns",si="openstation.postsWindow.statusSegments",oi="openstation.postsWindow.bulkActions",ii="openstation.postsWindow.toolbarTrailing",ni="openstation.postsWindow.opened",ai="openstation.postsWindow.dataLoaded",rt="[openstation:desktop-mode-posts]",Jt=new Set(["title"]),ri=new Set(["title","author","parent","date"]);function Qt(s){try{const e=window.wp?.os;if(e&&typeof e.getOsSettings=="function"){const o=e.getOsSettings()[s];if(Array.isArray(o))return new Set(o.filter(i=>typeof i=="string"))}}catch{}return new Set}const lt={authors:[],tags:[]};function es(s,e,t,o){const i="osPostsFilterMounted",a=s,n=t.map(c=>({value:String(c.id),label:c.name})),r=n.map(c=>`${c.value}:${c.label}`).join("|");if(a[i]){const c=a[i];c.listSig!==r&&(c.picker.items=n,c.listSig=r),c.picker.getAttribute("value")!==e.value&&c.picker.setAttribute("value",e.value),c.picker.hasMore=!!o.hasMore;return}const l=document.createElement("os-multiselect");if(l.setAttribute("placeholder",o.label),l.setAttribute("aria-label",o.ariaLabel),l.setAttribute("data-noclick",""),l.setAttribute("value",e.value),o.dataKey&&l.setAttribute("data-key",o.dataKey),s.appendChild(l),l.items=n,l.hasMore=!!o.hasMore,l.addEventListener("os-pick",c=>{const d=c.detail?.value??"";e.value=d,e.setValue(d)}),o.onLoadMore){const c=o.onLoadMore;l.addEventListener("os-multiselect-load-more",()=>{l.loadingMore=!0,c()})}a[i]={picker:l,listSig:r}}function ts(s,e,t){const o={key:"title",label:u("Title"),sortable:!0,sticky:!0,render:(c,d)=>X(e,d.id,"title",()=>mo(d,s))},i={key:"author",label:u("Author"),sortable:!0,width:"180px",filterRender:(c,d)=>es(c,d,t.authors,{label:u("All authors"),ariaLabel:u("Filter by author")}),render:(c,d)=>X(e,d.id,"author",()=>bo(d))},a={key:"date",label:u("Date"),sortable:!0,width:"170px",sortValue:c=>Date.parse(c.date_gmt+"Z")||0,render:(c,d)=>X(e,d.id,"date",()=>_o(d))};if(s.extra.mode==="pages")return[o,i,{key:"parent",label:u("Parent"),width:"200px",render:(c,d)=>X(e,d.id,"parent",()=>Wo(d,s))},{key:"template",label:u("Template"),width:"180px",render:(c,d)=>X(e,d.id,"template",()=>jo(d,s))},{key:"slug",label:u("Slug"),width:"200px",render:(c,d)=>X(e,d.id,"slug",()=>Ko(d,s))},{key:"comments",label:u("Comments"),width:"110px",sortValue:c=>typeof c.openstation_comment_count=="number"?c.openstation_comment_count:0,render:(c,d)=>X(e,d.id,"comments",()=>Bo(d))},a];const n=[o,i],{categories:r,tags:l}=s.cells;return r&&n.push({key:"categories",label:u("Categories"),width:"260px",render:(c,d)=>X(e,d.id,"categories",()=>r(d,s))}),l&&n.push({key:"tags",label:u("Tags"),minWidth:"360px",filterRender:(c,d)=>es(c,d,t.tags.map(p=>({id:p.id,name:p.name})),{label:u("All tags"),ariaLabel:u("Filter by tag"),dataKey:"tags",hasMore:!!t.tagsHasMore,onLoadMore:t.loadMoreTags}),render:(c,d)=>X(e,d.id,"tags",()=>l(d,s))}),n.push(a),n}function ss(s,e,t=lt){const o=ts(s,e,t),i=window.wp?.hooks;return i&&typeof i.applyFilters=="function"?i.applyFilters(ti,o):o}function li(s,e=lt,t=new Set){const o=new Set(ts(s,new Map,e).map(i=>i.key));return ct(s,new Map,e,!1,t).filter(i=>!o.has(i.key))}function ci(s){return ss(s,new Map).filter(e=>!Jt.has(e.key)).map(e=>({key:e.key,label:e.label||e.key}))}function ct(s,e,t=lt,o=!1,i=new Set){const a=ss(s,e,t),n=i.size===0?a:a.filter(r=>Jt.has(r.key)||!i.has(r.key));return o?n.filter(r=>ri.has(r.key)):n}function di(){return[{value:"",label:u("All")},{value:"publish",label:u("Published")},{value:"draft",label:u("Drafts")},{value:"pending",label:u("Pending")},{value:"future",label:u("Scheduled")},{value:"trash",label:u("Trash")}]}function pi(){const s=window.wp?.hooks,e=di();if(!s||typeof s.applyFilters!="function")return e;try{const t=s.applyFilters(si,e);return Array.isArray(t)&&t.length>0?t:e}catch(t){return console.error(`${rt} status-segments filter threw; falling back to defaults:`,t),e}}function ui(s,e){return[{id:"trash",label:u("Move to trash"),icon:"dashicons-trash",variant:"danger",confirm:t=>H(s==="pages"?Fe("Move %d page to the trash?","Move %d pages to the trash?",t):Fe("Move %d post to the trash?","Move %d posts to the trash?",t),t),run:async(t,o)=>{const i=o.table.data??[],a=t.filter(n=>{const r=i.find(l=>l.id===n);return r&&r.status!=="trash"});return a.length>0&&await e(a),o.table.clearSelection(),!1}}]}function hi(s){const e=window.wp?.hooks;if(!e||typeof e.applyFilters!="function")return s;try{const t=e.applyFilters(oi,s);return Array.isArray(t)?t:s}catch(t){return console.error(`${rt} bulk-actions filter threw; falling back to defaults:`,t),s}}function fi(s){const e=window.wp?.hooks;if(!e||typeof e.applyFilters!="function")return[];try{const t=e.applyFilters(ii,[],s);return Array.isArray(t)?t.filter(o=>o instanceof HTMLElement):[]}catch(t){return console.error(`${rt} toolbar-trailing filter threw; ignoring:`,t),[]}}function gi(s,e="date"){switch(s){case"title":case"author":case"date":case"modified":return s;case"comments":return"comment_count";default:return e}}function mi(s){return s==="comment_count"?"comments":s}function Re(s,e,t){const o=window.wp?.os;o&&typeof o.broadcast=="function"&&o.broadcast("os.term.changed",{source:"posts-window",taxonomy:s,action:e,id:t})}function oe(s){const e=new URLSearchParams;for(const[o,i]of Object.entries(s))i!==void 0&&i!==""&&e.set(o,String(i));const t=e.toString();return t?`?${t}`:""}function bi(s){const e=async(n,r={})=>{const l=await s(n,{...r,headers:{...r.body?{"Content-Type":"application/json"}:{},...r.headers??{}}});if(!l.ok){let d=`${l.status} ${l.statusText}`;try{const p=await l.json();p&&typeof p.message=="string"&&(d=p.message)}catch{}throw new Error(d)}return{data:r.expectJson===!1?null:await l.json(),headers:l.headers}},t=async(n,r)=>{const l={per_page:20,_fields:"id,name,slug,count",orderby:"count",order:"desc"};n&&(l.search=n,l.orderby="name",l.order="asc");const{data:c}=await e(`wp/v2/tags${oe(l)}`,{method:"GET",signal:r});return Array.isArray(c)?c:[]},o=async n=>{const{data:r}=await e(`wp/v2/categories${oe({per_page:100,_fields:"id,name,slug,parent",orderby:"name",order:"asc"})}`,{method:"GET",signal:n});return Array.isArray(r)?r:[]},i=(n,r=0)=>{const l=n.openstation_count;return{id:n.id??r,name:n.name??"",slug:n.slug??"",parent:n.parent??0,count:typeof l=="number"?l:n.count??0,description:n.description??"",isDefault:n.openstation_is_default===!0}},a=async(n,r={})=>{const{data:l,headers:c}=await e(`wp/v2/${n}${oe({per_page:r.perPage??50,page:r.page??1,_fields:"id,name,slug,parent,count,description,openstation_is_default",orderby:r.orderby??"name",order:r.order??"asc",search:r.search,parent:typeof r.parent=="number"&&r.parent>=0?r.parent:void 0})}`,{method:"GET"});return{items:Array.isArray(l)?l.map(d=>i(d)):[],total:parseInt(c.get("X-WP-Total")??"0",10)||0,totalPages:parseInt(c.get("X-WP-TotalPages")??"0",10)||0}};return{searchTags:t,fetchAllCategories:o,async createTag(n){try{const{data:r}=await e("wp/v2/tags",{method:"POST",body:JSON.stringify({name:n})});return Re("post_tag","created",r.id),r}catch(r){const l=r instanceof Error?r.message:String(r);if(/term[\s_]?exists/i.test(l)){const c=(await t(n)).find(d=>d.name.toLowerCase()===n.toLowerCase());if(c)return c}throw r}},async updatePostTags(n,r){const{data:l}=await e(`wp/v2/posts/${n}`,{method:"POST",body:JSON.stringify({tags:r})});return l},async fetchAuthorOptions(n){try{const{data:r}=await e(`wp/v2/users${oe({per_page:100,who:"authors",_fields:"id,name",orderby:"name",order:"asc"})}`,{method:"GET",signal:n});return Array.isArray(r)?r.map(l=>({...l,name:ae(l.name)})):[]}catch{return[]}},async fetchTagOptions(n=1,r=50,l){try{const{data:c,headers:d}=await e(`wp/v2/tags${oe({per_page:Math.max(1,r),page:Math.max(1,n),_fields:"id,name,count",orderby:"count",order:"desc"})}`,{method:"GET",signal:l});return{items:Array.isArray(c)?c:[],totalPages:parseInt(d.get("X-WP-TotalPages")??"0",10)||0}}catch{return{items:[],totalPages:0}}},async createCategory(n,r=0,l={}){const c={name:n,parent:r};l.slug&&(c.slug=l.slug),l.description&&(c.description=l.description);try{const{data:d}=await e("wp/v2/categories",{method:"POST",body:JSON.stringify(c)});return Re("category","created",d.id),d}catch(d){const p=d instanceof Error?d.message:String(d);if(/term[\s_]?exists/i.test(p)){const g=(await o()).find(v=>v.name.toLowerCase()===n.toLowerCase()&&v.parent===r);if(g)return g}throw d}},async updatePostCategories(n,r){const{data:l}=await e(`wp/v2/posts/${n}`,{method:"POST",body:JSON.stringify({categories:r})});return l},fetchTerms:a,async fetchAllTerms(n){const r=[];let l=1;for(;l<=5;){const c=await a(n,{page:l,perPage:100});if(r.push(...c.items),l>=c.totalPages)break;l++}return r},async fetchTagCooccurrence(n="tags",r=8){const{data:l}=await e(`desktop-mode/v1/tag-cooccurrence${oe({taxonomy:n==="tags"?"post_tag":"category",limit:r})}`,{method:"GET"}),c=new Map,d=l&&typeof l=="object"&&!Array.isArray(l)?l.pairs:void 0;if(!d)return c;for(const[p,g]of Object.entries(d)){const v=parseInt(p,10);if(!Number.isFinite(v)||v<=0)continue;const _=[];for(const x of g){const h=Number(x?.id),f=Number(x?.shared);Number.isFinite(h)&&h>0&&Number.isFinite(f)&&f>0&&_.push({id:h,shared:f})}_.length>0&&c.set(v,_)}return c},async updateTerm(n,r,l){const{data:c}=await e(`wp/v2/${n}/${r}`,{method:"POST",body:JSON.stringify(l)});return Re(n==="categories"?"category":"post_tag","updated",r),i(c,r)},async deleteTerm(n,r){await e(`wp/v2/${n}/${r}?force=true`,{method:"DELETE"}),Re(n==="categories"?"category":"post_tag","deleted",r)},async fetchTermPosts(n,r,l,c){const{data:d,headers:p}=await e(`wp/v2/posts${oe({[n]:r,per_page:c,page:l,status:"any",_fields:"id,title,status"})}`,{method:"GET"}),g=parseInt(p.get("X-WP-Total")??"",10);return{items:(Array.isArray(d)?d:[]).map(v=>({id:v.id,title:v.title?.rendered||`#${v.id}`})),totalPages:Math.max(1,parseInt(p.get("X-WP-TotalPages")??"1",10)||1),total:Number.isFinite(g)?g:-1}},async fetchTermCounts(n,r){const{data:l}=await e(`desktop-mode/v1/term-counts${oe({taxonomy:n,ids:r.join(",")})}`,{method:"GET"});return l&&typeof l=="object"?l:{}}}}const _i="[openstation:desktop-mode-posts]",V=s=>s.root.querySelector("[data-os-posts-table]");function vi(s){return{page:s.page,perPage:s.perPage,search:s.search||void 0,status:s.status||void 0,orderby:s.orderby,order:s.order,author:s.author.length>0?s.author:void 0,tag:s.tag.length>0?s.tag:void 0}}function dt(s,e){if(!e.postsCtx){const t={body:s.root,get table(){return V(s)},refresh:()=>s.dispatch("refresh").then(()=>{}),getSelectedIds:()=>Array.from(V(s)?.selection??[]).map(o=>Number(o)),getSelectedRows:()=>{const o=new Set(t.getSelectedIds());return(V(s)?.data??[]).filter(i=>o.has(i.id))},getCurrentParams:()=>vi(s.state)};e.postsCtx=t}return e.postsCtx}async function xi(s,e,t){const o=t.getSelectedIds();if(o.length===0)return;const{confirm:i}=e;if(i){const a=typeof i=="function"?i(o.length):H(i,o.length);if(!await(s.host.confirm?.({message:a,danger:!0})??Promise.resolve(!1)))return}try{if(await e.run(o,t)===!1)return}catch(a){console.error(`${_i} bulk action "${e.id}" failed`,a)}t.table.clearSelection(),await t.refresh()}function yi(s){const e={items:s.list.items,total:s.list.total,totalPages:s.list.pages,page:s.list.page},t=window.wp?.hooks;t&&typeof t.doAction=="function"&&t.doAction(ai,e),document.dispatchEvent(new CustomEvent("os-posts-window-data-loaded",{detail:e}))}class ki{constructor(){this.items=[],this.pending=!1,this.error=!1,this.key="",this.lastData=null,this.page=0,this.pages=0,this.expected=0,this.disposed=!1,this.ctx=null,this.observer=null,this.sentinel=null,this.generation=0}queryKey(e){return JSON.stringify([e.search,e.status,e.orderby,e.order,e.author,e.tag,e.perPage])}reconcile(e){this.ctx=e;const{state:t,data:o}=e,i=this.queryKey(t);if(i!==this.key&&(this.generation++,this.expected=0,this.key=i,this.items=[],this.page=0,this.pages=0,this.lastData=null,this.error=!1),!e.loading&&o&&o!==this.lastData&&o.list.page===t.page&&(!o.query||this.queryKey(o.query)===i))if(this.lastData=o,o.list.error)this.error=!0;else{if(o.list.page>1&&this.page===0&&o.list.page!==this.expected&&!o.list.replace)return{...e,data:{...o,list:{...o.list,items:this.items}}};const a=o.list.page===1||o.list.replace?o.list.items:[...this.items,...o.list.items];this.items=Array.from(new Map(a.map(n=>[n.id,n])).values()),this.page=o.list.page,this.pages=o.list.pages,this.error=!1}return o?{...e,data:{...o,list:{...o.list,items:this.items}}}:e}get hasMore(){return this.page>0&&this.page<this.pages}async more(){const e=this.ctx;if(!e||this.disposed||this.pending||e.loading||!this.hasMore)return;const t=this.generation;this.pending=!0,this.error=!1,this.expected=this.page+1,e.repaint();try{const o=await e.dispatch("page",{page:this.expected});t===this.generation&&(!o||e.data?.list.error)&&(this.error=!0)}catch{t===this.generation&&(this.error=!0)}finally{this.pending=!1,this.expected=0,this.sentinel=null,this.disposed||e.repaint()}}tail(){let e=this.items.length?u("You’re all caught up."):"";return this.pending?e=u("Loading more…"):this.hasMore&&(e=b`<os-button variant="ghost" @click=${()=>void this.more()}>${this.error?u("Could not load more. Retry"):u("Load more")}</os-button>`),b`<div class="os-posts-desk__continuation" data-content-feed-end role="status">${e}</div>`}observe(e){const t=e.querySelector(".os-posts-desk__feed [data-content-feed-end]");t!==this.sentinel&&(this.observer?.disconnect(),this.sentinel=t,!(!t||typeof IntersectionObserver>"u")&&(this.observer=new IntersectionObserver(o=>{o.some(i=>i.isIntersecting)&&!this.error&&this.more()},{root:e.querySelector(".os-posts-desk__feed"),rootMargin:"0px 0px 240px 0px"}),this.observer.observe(t)))}dispose(){this.disposed=!0,this.observer?.disconnect()}}function wi(s){const e=new DOMParser().parseFromString(s,"text/html");e.querySelectorAll("script, style").forEach(i=>i.remove()),e.querySelectorAll("p, div, li, h1, h2, h3, h4, h5, h6, br").forEach(i=>i.append(e.createTextNode(" ")));const t=e.body.textContent||"",o=Intl.Segmenter;return o?Array.from(new o(void 0,{granularity:"word"}).segment(t)).filter(i=>i.isWordLike).length:(t.match(/[\p{L}\p{N}]+/gu)||[]).length}async function $i(s,e,t,o){const i={},a=async(l,c,d,p)=>{try{const g=await s(c,{...d,signal:o},{silent:!0});if(!g.ok)return i[l]=g.status===429||g.status>=500?"retry":"unavailable",null;const v=await p(g);return v===null&&(i[l]="unavailable"),v}catch{return i[l]="retry",null}},[n,r]=await Promise.all([a("words",`wp/v2/${e}/${t}?context=edit&_fields=content`,{},async l=>{const c=await l.json();return typeof c.content?.rendered=="string"&&!c.content.protected?wi(c.content.rendered):null}),a("comments",`wp/v2/comments?post=${t}&status=approve&per_page=1`,{method:"HEAD"},async l=>{const c=l.headers.get("X-WP-Total");return c!==null&&/^\d+$/.test(c)?Number(c):null})]);return Object.keys(i).length?{words:n,comments:r,errors:i}:{words:n,comments:r}}function Ci(s,e,t){const o=new AbortController,i=new Map,a=new Set,n=new Map,r=new Map,l=new Set,c=new WeakMap;let d=0;const p=()=>{for(const x of s.querySelectorAll("[data-content-metrics]")){const h=i.get(x.dataset.contentMetrics||"");if(!h)continue;for(const y of["words","comments"]){const w=x.querySelector(`[data-metric="${y}"]`);w?.setAttribute("value",h[y]===null?"—":h[y].toLocaleString());let k=h.errors?.[y]?u("This count is unavailable or access is restricted."):"";h.errors?.[y]==="retry"&&(k=u("Could not load this count.")),w?.setAttribute("title",k)}const f=x.dataset.contentMetrics||"";let m=x.querySelector("[data-retry-metrics]");Object.values(h.errors||{}).includes("retry")&&(r.get(f)||0)>=3?m||(m=document.createElement("os-button"),m.setAttribute("variant","ghost"),m.setAttribute("data-retry-metrics",""),m.textContent=u("Retry counts"),m.addEventListener("click",()=>{r.delete(f),i.delete(f),m?.remove(),g(f,Number(x.dataset.postId)),v()}),x.append(m)):m?.remove()}},g=(x,h)=>{!a.has(x)&&!o.signal.aborted&&(a.add(x),n.set(x,h))},v=()=>{if(!o.signal.aborted)for(;d<2&&n.size;){const[x,h]=n.entries().next().value;n.delete(x),d++,r.set(x,(r.get(x)||0)+1),$i(e,t,h,o.signal).then(f=>{if(!o.signal.aborted&&(i.set(x,f),p(),Object.values(f.errors||{}).includes("retry")&&r.get(x)<3)){const m=setTimeout(()=>{l.delete(m),g(x,h),v()},500*r.get(x));l.add(m)}}).finally(()=>{a.delete(x),d--,v()})}},_=typeof IntersectionObserver>"u"?null:new IntersectionObserver(x=>{for(const h of x){if(!h.isIntersecting)continue;const f=h.target,m=f.dataset.contentMetrics||"";i.has(m)||g(m,Number(f.dataset.postId)),_?.unobserve(f)}v()},{root:s.querySelector(".os-posts-desk__feed"),rootMargin:"80px"});return{sync:()=>{p(),s.querySelectorAll("[data-content-metrics]").forEach(x=>{const h=x.getAttribute("data-content-metrics")||"";c.get(x)!==h&&(c.set(x,h),_?.observe(x))})},dispose:()=>{o.abort(),_?.disconnect(),l.forEach(clearTimeout),l.clear(),n.clear(),i.clear()}}}const os=R` .desktop-mode-posts .os-app-list__toolbar-right.os-app-list__bulk--footer{flex:0 0 auto;align-content:start;gap:8px;padding:8px 12px}.os-posts-desk__continuation{grid-column:1 / -1;padding:14px 8px;text-align:center;font-size:11px;color:var( --os-ui-fg-muted,#646970 )}.os-posts-desk__filter-toggle{display:none}.os-posts-desk__metrics{display:flex;gap:22px;margin-block:18px 0;--os-ui-stat-padding:0;--os-ui-stat-border:transparent;--os-ui-stat-value-size:24px;--os-ui-stat-value-color:var( --os-ui-fg,#1d2327 )}.os-posts-desk__metrics os-stat{min-inline-size:62px}.desktop-mode-posts:not(.desktop-mode-pages) .os-posts-desk__story{position:relative;border-radius:3px 12px 12px 3px;padding-inline-start:34px;background-image:repeating-linear-gradient(transparent 0 27px,var( --os-ui-surface-subtle,#f0f0f1 ) 27px 28px);background-position:0 10px}.desktop-mode-posts:not(.desktop-mode-pages) .os-posts-desk__story::before{content:'';position:absolute;inset-block:0;inset-inline-start:22px;border-inline-start:1px solid var( --os-ui-accent-dim,#c3c4c7 );opacity:.3}.desktop-mode-pages .os-posts-desk__story{position:relative;border-radius:3px 22px 3px 3px;box-shadow:3px 4px 0 -1px var( --os-ui-surface,#fff ),3px 4px 0 0 var( --os-ui-border,#dcdcde )}.desktop-mode-pages .os-posts-desk__story::after{content:'';position:absolute;inset-block-start:0;inset-inline-end:0;inline-size:16px;block-size:16px;border-end-start-radius:3px;border-inline-start:1px solid var( --os-ui-border,#dcdcde );border-block-end:1px solid var( --os-ui-border,#dcdcde );background:var( --os-ui-surface-sunken,#f6f7f7 );pointer-events:none}.desktop-mode-pages .os-posts-desk__select{margin-inline-end:6px}.os-pages-atlas-host{flex:1;min-block-size:0;display:flex;position:relative}@container content-desk (max-width:600px){.os-posts-desk__hero{padding:8px 12px;min-block-size:36px;gap:8px}.os-posts-desk__hero h2{font-size:17px;margin:0;letter-spacing:-.03em}.os-posts-desk__hero p,.os-posts-desk__eyebrow{display:none}.desktop-mode-posts .os-app-list__toolbar{display:none}.desktop-mode-posts[data-desk-options="true"] .os-app-list__toolbar{display:flex;padding:6px 12px}.os-posts-desk__tools{padding:6px 12px;gap:8px}.os-posts-desk__tools .os-app-list__search{flex:1;min-inline-size:0}.os-posts-desk__filter-toggle{display:block;flex:0 0 auto}.os-posts-desk__tools:not(.is-expanded)>os-select,.os-posts-desk__tools:not(.is-expanded)>os-checkbox{display:none}.os-posts-desk__tools.is-expanded>os-checkbox{flex-basis:100%}.os-posts-desk__feed,.desktop-mode-pages .os-posts-desk__feed{display:block;padding:8px 12px 14px}.os-posts-desk__story,.desktop-mode-pages .os-posts-desk__story,.os-posts-desk__story.is-current{padding:9px 12px;margin-block-end:9px}.desktop-mode-posts:not(.desktop-mode-pages) .os-posts-desk__story{padding-inline-start:24px}.desktop-mode-posts:not(.desktop-mode-pages) .os-posts-desk__story::before{inset-inline-start:14px}.os-posts-desk__story-top{margin-block-end:3px;min-block-size:18px}.os-posts-desk__story-content,.desktop-mode-pages .os-posts-desk__story-content{flex-direction:row;gap:10px}.os-posts-desk__page-mark,.os-posts-desk__kicker{display:none}.os-posts-desk__story h3,.desktop-mode-pages .os-posts-desk__story h3{font-size:18px;margin-block-end:2px;line-height:1.2}.os-posts-desk__thumbnail{inline-size:46px;block-size:46px}.os-posts-desk__excerpt{-webkit-line-clamp:1;line-clamp:1;font-size:11px;line-height:1.4}.desktop-mode-pages .os-posts-desk__excerpt{display:none}.os-posts-desk__metrics{gap:14px;margin-block-start:7px;--os-ui-stat-value-size:14px}.os-posts-desk__metrics os-stat{min-inline-size:0;flex-direction:row;align-items:baseline}.os-posts-desk__metrics os-stat::part(value),.os-posts-desk__metrics os-stat::part(label){display:inline}.os-posts-desk__metrics os-stat::part(label){font-size:9px;margin-inline-start:4px;letter-spacing:0;text-transform:none}.os-posts-desk__story-foot{margin-block-start:4px;gap:4px;flex-wrap:nowrap}.desktop-mode-pages .os-posts-desk__story-foot>.os-posts-desk__byline,.os-posts-desk__story-foot>.os-posts-desk__byline{flex:1;margin:0;font-size:10px;min-inline-size:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.os-posts-desk__story-foot os-button{--os-ui-button-padding:5px 9px;font-size:11px}.desktop-mode-posts .os-app-list__pager{padding:6px 12px;gap:4px;flex-wrap:nowrap}.desktop-mode-posts .os-app-list__pager-meta{font-size:10px;flex:1}.desktop-mode-posts .os-app-list__pager-perpage{display:none}.desktop-mode-posts .os-app-list__pager-nav{flex:0 0 auto}.desktop-mode-posts .os-app-list__pager-nav os-button{font-size:10px}}`,is=R` .desktop-mode-posts{container:content-desk / inline-size;color:var( --os-ui-fg,#1d2327 );background:var( --os-ui-surface-sunken,#f6f7f7 )}.desktop-mode-posts [hidden]{display:none !important}.os-posts-desk__hero{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:24px 26px 20px;background:var( --os-ui-surface,#fff )}.os-posts-desk__eyebrow,.os-posts-desk__inspector-head{font-size:10px;font-weight:600;letter-spacing:0.14em;color:var( --os-ui-fg-muted,#646970 )}.os-posts-desk__hero h2{margin:7px 0;font-size:clamp( 24px,3.4cqi,38px );font-weight:500;letter-spacing:-0.045em;line-height:1.1;color:inherit}.os-posts-desk__hero p{margin:0;font-size:12px;color:var( --os-ui-fg-muted,#646970 )}.os-posts-desk__hero>os-button{flex-shrink:0}.desktop-mode-posts .os-app-list__toolbar{padding:12px 24px;background:var( --os-ui-surface,#fff );flex-wrap:wrap}.desktop-mode-posts .os-app-list__toolbar-left{flex-wrap:wrap;min-inline-size:0}.desktop-mode-posts .os-app-list__search{min-inline-size:150px;flex:1 1 190px}.os-posts-desk__tools{display:flex;align-items:center;gap:10px;padding:9px 24px;border-block-end:1px solid var( --os-ui-border,#dcdcde );background:var( --os-ui-surface,#fff );flex-shrink:0}.os-posts-desk__tools>os-checkbox{margin-inline-end:auto;font-size:11px}.os-posts-desk__tools os-select{inline-size:155px}.os-posts-desk__workspace{display:flex;flex:1;min-block-size:0;min-inline-size:0;overflow:hidden}.os-posts-desk__feed{flex:1;min-inline-size:0;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable;padding:20px 24px 32px}.os-posts-desk__story{padding:20px;border:1px solid var( --os-ui-border,#dcdcde );border-radius:12px;background:var( --os-ui-surface,#fff );margin-block-end:12px;min-inline-size:0;transition:border-color 140ms ease,box-shadow 140ms ease}.os-posts-desk__story:hover{border-color:var( --os-ui-accent-dim,#2271b1 )}.os-posts-desk__story.is-current{border-inline-start:3px solid var( --os-ui-accent,#2271b1 );padding-inline-start:18px}.os-posts-desk__story-top{display:flex;align-items:center;gap:8px;margin-block-end:13px;min-block-size:22px}.os-posts-desk__id{margin-inline-start:auto;flex:0 0 auto;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11px;font-variant-numeric:tabular-nums;--os-ui-button-padding:3px 5px}.os-posts-desk__id::part(button){color:var( --os-ui-fg-muted,#646970 );gap:5px;min-block-size:24px}.os-posts-desk__id .dashicons{font-size:12px;inline-size:12px;block-size:12px}.os-posts-desk__id + .os-posts-desk__select{margin-inline-start:0}.os-posts-desk__select{margin-inline-start:auto;flex:0 0 20px;inline-size:20px;block-size:20px}.os-posts-desk__status,.os-posts-desk__role{display:inline-flex;align-items:center;gap:6px;font-size:10px;font-weight:600;line-height:1.6;color:var( --os-ui-fg-muted,#646970 )}.os-posts-desk__status::before{content:"";inline-size:6px;block-size:6px;border-radius:50%;background:currentColor}.os-posts-desk__status[data-status="publish"]{color:var( --os-ui-success-fg,#008a20 )}.os-posts-desk__status[data-status="draft"],.os-posts-desk__status[data-status="pending"]{color:var( --os-ui-warning,#996800 )}.os-posts-desk__status[data-status="future"],.os-posts-desk__role{color:var( --os-ui-accent,#2271b1 )}.os-posts-desk__role{border-inline-start:1px solid var( --os-ui-border,#dcdcde );padding-inline-start:8px}.os-posts-desk__story-content{display:flex;gap:18px;align-items:flex-start}.os-posts-desk__story-copy{min-inline-size:0;flex:1}.os-posts-desk__thumbnail{inline-size:104px;block-size:104px;object-fit:cover;border-radius:7px;flex:0 0 auto}.os-posts-desk__kicker{font-size:10px;letter-spacing:0.06em;color:var( --os-ui-fg-muted,#646970 );margin-block-end:5px;overflow-wrap:anywhere}.os-posts-desk__story h3{font-family:Georgia,"Times New Roman",serif;font-size:23px;font-weight:400;line-height:1.18;letter-spacing:-0.025em;margin:0 0 8px;color:inherit;overflow-wrap:anywhere}.os-posts-desk__story h3 a{color:inherit;text-decoration:none}.os-posts-desk__story h3 a:hover{text-decoration:underline;text-underline-offset:3px}.os-posts-desk__excerpt{font-size:12px;line-height:1.65;margin:0;color:var( --os-ui-fg-muted,#646970 );display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}.os-posts-desk__story-foot{display:flex;align-items:center;flex-wrap:wrap;gap:6px;margin-block-start:16px}.os-posts-desk__byline{font-size:11px;line-height:1.5;color:var( --os-ui-fg-muted,#646970 );margin-inline-end:auto;overflow-wrap:anywhere}.os-posts-desk__story-foot>.os-posts-desk__byline{flex:1 1 100px}.os-posts-desk__plugin-stat{display:flex;flex-direction:column;gap:4px;min-width:0}.os-posts-desk__plugin-stat-value{display:flex;align-items:center;min-height:22px}.os-posts-desk__plugin-stat-label{font-size:10px;line-height:1.2;letter-spacing:0.06em;text-transform:uppercase;color:var( --os-ui-fg-muted,#646970 )}.os-posts-desk__lock{font-size:11px;color:var( --os-ui-warning,#996800 )}.os-posts-desk__inspector{flex:0 0 330px;max-inline-size:40%;min-inline-size:0;display:flex;flex-direction:column;border-inline-start:1px solid var( --os-ui-border,#dcdcde );background:var( --os-ui-surface,#fff )}.os-posts-desk__inspector-head{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:12px 18px;border-block-end:1px solid var( --os-ui-border,#dcdcde )}.os-posts-desk__inspector-head os-button{letter-spacing:normal}.os-posts-desk__inspector-scroll{flex:1;min-block-size:0;overflow:auto;padding:20px;overscroll-behavior:contain}.os-posts-desk__cover{inline-size:100%;max-block-size:180px;object-fit:cover;border-radius:8px;margin-block-end:20px}.os-posts-desk__inspector h2{font-family:Georgia,"Times New Roman",serif;font-size:27px;font-weight:400;line-height:1.2;letter-spacing:-0.03em;margin:10px 0;color:inherit;overflow-wrap:anywhere}.os-posts-desk__preview{font-size:13px;line-height:1.8;color:var( --os-ui-fg-muted,#646970 );overflow-wrap:anywhere}.os-posts-desk__dates{padding-block:16px;border-block:1px solid var( --os-ui-border,#dcdcde );--os-ui-facts-font-size:11px;--os-ui-facts-row-gap:4px;--os-ui-facts-column-gap:10px}.os-posts-desk__fields section{padding-block:8px;font-size:12px;overflow-wrap:anywhere}.os-posts-desk__fields h3{font-size:11px;font-weight:600;margin:0 0 8px;color:var( --os-ui-fg-muted,#646970 )}.os-posts-desk__inspector-actions{display:flex;align-items:center;flex-wrap:wrap;gap:12px;padding:16px 20px;border-block-start:1px solid var( --os-ui-border,#dcdcde );font-size:11px}.os-posts-desk__inspector-actions a{color:var( --os-ui-accent,#2271b1 )}.os-posts-desk__empty{padding:48px 20px;text-align:center;color:var( --os-ui-fg-muted,#646970 )}.os-posts-desk__empty>.dashicons{font-size:40px;inline-size:40px;block-size:40px}.desktop-mode-posts .os-app-list__bulk--footer{padding:10px 24px}.desktop-mode-posts .os-app-list__bulk--footer .os-app-list__count,.desktop-mode-posts .os-app-list__bulk--footer .os-app-list__bulk-actions{flex:0 1 auto}.desktop-mode-pages .os-posts-desk__feed{display:grid;grid-template-columns:repeat( auto-fill,minmax( 230px,1fr ) );align-content:start;gap:16px}.desktop-mode-pages .os-posts-desk__story{margin:0;display:flex;flex-direction:column}.desktop-mode-pages .os-posts-desk__story-content{flex-direction:column;flex:1}.desktop-mode-pages .os-posts-desk__story h3,.desktop-mode-pages .os-posts-desk__inspector h2{font-family:inherit;font-weight:600;font-size:21px}.os-posts-desk__page-mark{border:1px solid var( --os-ui-border,#dcdcde );border-radius:5px;inline-size:42px;block-size:50px;padding:8px;color:var( --os-ui-accent,#2271b1 );background:var( --os-ui-surface-sunken,#f6f7f7 )}.os-posts-desk__page-mark i{display:block;block-size:2px;margin-block-start:4px;background:var( --os-ui-border,#dcdcde )}.os-posts-desk__page-mark i:last-child{inline-size:60%}@container content-desk (max-width:850px){.os-posts-desk__inspector{display:none}.os-posts-desk__inspector.is-open{display:flex;flex:1;max-inline-size:none;border-inline-start:0}.os-posts-desk__workspace.has-detail .os-posts-desk__feed{display:none}.os-posts-desk__hero{padding:20px}}@container content-desk (max-width:540px){.os-posts-desk__hero{padding:16px;gap:12px}.os-posts-desk__hero p,.os-posts-desk__eyebrow{display:none}.os-posts-desk__hero h2{font-size:23px}.desktop-mode-posts .os-app-list__toolbar,.os-posts-desk__tools{padding:8px 12px}.os-posts-desk__tools{flex-wrap:wrap}.os-posts-desk__tools>os-checkbox{flex-basis:100%}.os-posts-desk__tools os-select{flex:1;inline-size:130px}.os-posts-desk__feed{padding:12px}.os-posts-desk__story{padding:16px}.os-posts-desk__story.is-current{padding-inline-start:14px}.os-posts-desk__thumbnail{inline-size:64px;block-size:64px}.os-posts-desk__story h3{font-size:21px}}@media (prefers-reduced-motion:reduce){.os-posts-desk__story{transition:none}}.os-posts-desk__tools .os-app-list__search{flex:1 1 170px;min-inline-size:130px}.os-posts-desk__tools>os-checkbox{flex-shrink:0}@container content-desk (max-width:700px){.os-posts-desk__tools{flex-wrap:wrap}.os-posts-desk__tools .os-app-list__search{flex-basis:calc( 100% - 145px )}.os-posts-desk__tools>os-checkbox{flex-basis:auto}.os-posts-desk__tools os-select{flex:1 1 130px;min-inline-size:130px}}.desktop-mode-pages .os-posts-desk__story-foot>.os-posts-desk__byline{flex-basis:100%;margin-block-end:4px}html[data-os-mode="mobile"] .desktop-mode-posts .os-app-list__toolbar-left{flex:1 1 140px}html[data-os-mode="mobile"] .desktop-mode-posts .os-app-list__toolbar-trailing{flex:0 0 auto}`,Si=R` ${fe} ${Je}:host{display:inline-flex;align-items:center;gap:6px;font-size:13px;color:var( --os-ui-fg,#1d2327 );cursor:pointer}:host( [ disabled ] ){cursor:not-allowed;opacity:0.55}:host( [ block ] ){display:flex;cursor:default}:host( [ block ] ) label{cursor:pointer}:host( [ block ][ disabled ] ) label{cursor:not-allowed}label{display:inline-flex;align-items:center;gap:6px;cursor:inherit}.os-checkbox__label{line-height:1.3}.os-checkbox__label:empty{display:none}`,Ce=class Ce extends U{render(){const e=this.checked!==null,t=this.disabled!==null,o=this.label||"",i=this.value;return b` | |
| 473 | + <label> | |
| 474 | + <input | |
| 475 | + type="checkbox" | |
| 476 | + .checked=${e} | |
| 477 | + ?disabled=${t} | |
| 478 | + .value=${i??""} | |
| 479 | + @change=${a=>this._onChange(a)} | |
| 480 | + /> | |
| 481 | + <span class="os-checkbox__label">${o}</span> | |
| 482 | + </label> | |
| 483 | + `}_onChange(e){const o=e.target.checked;o?this.setAttribute("checked",""):this.removeAttribute("checked"),this.emit("os-checkbox-change",{checked:o,value:this.value})}};Ce.props=["checked","value","label","disabled"],Ce.styles=[Si],Ce.help=void 0;let pt=Ce;W("os-checkbox",pt);const Ai=R`:host{--_border:var( --os-ui-stat-border,var( --os-ui-border,#dcdcde ) );--_bg:var( --os-ui-stat-bg,transparent );--_value-color:var( --os-ui-stat-value-color,var( --wp-admin-theme-color,#2271b1 ) );--_value-size:var( --os-ui-stat-value-size,20px );--_label-color:var( --os-ui-stat-label-color,var( --os-ui-fg-muted,#646970 ) );display:flex;flex-direction:column;gap:2px;padding:var( --os-ui-stat-padding,10px 12px );border:1px solid var( --_border );border-radius:var( --os-ui-stat-radius,8px );background:var( --_bg );min-inline-size:0}:host( [ hidden ] ){display:none}.value{font-size:var( --_value-size );font-weight:700;line-height:1.1;color:var( --_value-color );font-variant-numeric:tabular-nums}.label{display:inline-flex;align-items:center;gap:6px;font-size:11px;letter-spacing:0.05em;text-transform:uppercase;color:var( --_label-color )}.caption{font-size:11px;color:var( --_label-color )}.swatch{display:inline-block;inline-size:10px;block-size:10px;border-radius:3px;flex:none;background:var( --os-app-tone,var( --os-ui-fg-muted,#646970 ) )}`,Se=class Se extends U{render(){const e=this,t=e.caption||"";return b` | |
| 484 | + <span class="value" part="value">${e.value||""}</span> | |
| 485 | + <span class="label" part="label"> | |
| 486 | + ${this.hasAttribute("swatch")?b`<i class="swatch" aria-hidden="true"></i>`:""} | |
| 487 | + ${e.label||""} | |
| 488 | + </span> | |
| 489 | + ${t?b`<span class="caption" part="caption">${t}</span>`:""} | |
| 490 | + `}};Se.props=["value","label","caption","swatch"],Se.styles=[Ai],Se.help=void 0;let ut=Se;W("os-stat",ut);const Ei=()=>({view:"desk",filters:!1,peek:!1,focused:null,inspectorKey:"",fields:[]});function ns(s){return ae((s.excerpt?.rendered??"").replace(/<[^>]*>/g," ")).replace(/\s+/g," ").trim()}function zi(s,e){if(!s.parent)return u("Top-level page");const t=e.find(o=>o.id===s.parent);return t?le(t):H(u("Parent page #%d"),s.parent)}function ht(s,e){s.host.openUrl?.(Te(s.extra,e.id),le(e)||u("(no title)"),s.extra.mode==="pages"?"dashicons-admin-page":"dashicons-admin-post")}function as(s){return b`<span class="os-posts-desk__status" data-status=${s.status}>${Ze[s.status]??s.status}</span>`}function Ti(s,e){return s.extra.frontPageId===e.id?u("Front page"):s.extra.postsPageId===e.id?u("Posts page"):""}function rs(s,e){queueMicrotask(()=>s.querySelector(e)?.shadowRoot?.querySelector("button")?.focus())}function Pi(s,e){const t=s.extra.mode==="pages",o=s.data?.list.items??[],i=V(s)?.selection??new Set,a=o.length>0&&o.every(l=>i.has(l.id)),n=l=>{e.view=l.detail.value==="table"?"table":"desk",s.repaint()},r=l=>{const[c,d]=String(l.detail.value).split(":");s.dispatch("sort",{orderby:c,order:d})};return b`<div class="os-posts-desk__tools ${e.filters?"is-expanded":""}"> | |
| 491 | + <os-text-field id=${`${s.windowId}-content-search`} class="os-app-list__search" data-os-posts-search | |
| 492 | + aria-label=${u(t?"Search pages":"Search posts")} os-bind="search" os-action="filter" os-debounce="250" | |
| 493 | + value=${s.state.search} placeholder=${u(t?"Search pages…":"Search posts…")}></os-text-field> | |
| 494 | + <os-button class="os-posts-desk__filter-toggle" variant="secondary" aria-expanded=${String(e.filters)} @click=${()=>{e.filters=!e.filters,s.repaint()}}>${u("Options")}</os-button> | |
| 495 | + <os-checkbox label=${u("Select loaded")} ?checked=${a} | |
| 496 | + @os-checkbox-change=${()=>{a?V(s)?.clearSelection():V(s)?.selectAll()}}></os-checkbox> | |
| 497 | + <os-select aria-label=${u("Sort content")} value=${`${s.state.orderby}:${s.state.order}`} @os-pick=${r}> | |
| 498 | + ${t?b`<os-option value="menu_order:asc">${u("Page order")}</os-option>`:""} | |
| 499 | + <os-option value="date:desc">${u("Newest first")}</os-option> | |
| 500 | + <os-option value="date:asc">${u("Oldest first")}</os-option> | |
| 501 | + <os-option value="modified:desc">${u("Recently edited")}</os-option> | |
| 502 | + <os-option value="title:asc">${u("Title A–Z")}</os-option> | |
| 503 | + <os-option value="title:desc">${u("Title Z–A")}</os-option> | |
| 504 | + <os-option value="author:asc">${u("By author")}</os-option> | |
| 505 | + <os-option value="author:desc">${u("By author, reversed")}</os-option> | |
| 506 | + <os-option value="modified:asc">${u("Least recently edited")}</os-option> | |
| 507 | + <os-option value="comment_count:asc">${u("Fewest comments")}</os-option> | |
| 508 | + <os-option value="comment_count:desc">${u("Most comments")}</os-option> | |
| 509 | + </os-select> | |
| 510 | + <os-select aria-label=${u("Content view")} value=${e.view} @os-pick=${n} data-os-posts-view> | |
| 511 | + <os-option value="desk">${u(t?"Page directory":"Writing desk")}</os-option> | |
| 512 | + <os-option value="table">${u("Details table")}</os-option> | |
| 513 | + </os-select> | |
| 514 | + </div>`}function Mi(s,e){const t=s.extra.mode==="pages",o=H(u(t?"Copy page ID %d":"Copy post ID %d"),e.id);return b`<os-button variant="ghost" class="os-posts-desk__id" title=${o} @click=${async i=>{i.stopPropagation();const n=await $t(String(e.id))?H(u(t?"Copied page ID #%d.":"Copied post ID #%d."),e.id):u("Couldn’t copy the ID. Please try again.");s.host.toast?.({message:n})}}><span class="screen-reader-text">${o}</span><span aria-hidden="true">#${e.id}</span><span class="dashicons dashicons-admin-page" aria-hidden="true"></span></os-button>`}function Li(s,e){const t=e[s.key];let o="";return s.render?o=s.render(t,e,0):t!=null&&(o=String(t)),o==null||o===""||o instanceof Element&&!o.childNodes.length&&!o.textContent?"":b`<div class="os-posts-desk__plugin-stat" data-column=${s.key}><span class="os-posts-desk__plugin-stat-value">${o}</span><span class="os-posts-desk__plugin-stat-label">${s.label||s.key}</span></div>`}function Ri(s,e,t,o,i=[]){const a=s.extra.mode==="pages",n=le(t)||u("(no title)"),r=Ye(t),l=fo(t,"category")[0]?.name,c=Ti(s,t),d=a?zi(t,s.data?.list.items??[]):ae(l||u("Story"));let p="";a?p=b`<div class="os-posts-desk__page-mark" aria-hidden="true"><span class="dashicons ${c?"dashicons-admin-home":"dashicons-admin-page"}"></span><i></i><i></i><i></i></div>`:r&&(p=b`<img class="os-posts-desk__thumbnail" src=${r.url} alt="" loading="lazy" @error=${v=>v.target.hidden=!0}>`);const g=()=>{e.focused=t.id,e.peek=!0,s.repaint(),rs(s.root,"[data-os-posts-inspect-close]")};return b`<article class="os-posts-desk__story ${o===t.id?"is-current":""}" data-story-id=${t.id}> | |
| 515 | + <div class="os-posts-desk__story-top"> | |
| 516 | + ${as(t)} | |
| 517 | + ${c?b`<span class="os-posts-desk__role">${c}</span>`:""} | |
| 518 | + ${Mi(s,t)} | |
| 519 | + <os-checkbox aria-label=${H(u("Select %s"),n)} | |
| 520 | + class="os-posts-desk__select" ?checked=${V(s)?.selection.has(t.id)??!1} | |
| 521 | + @os-checkbox-change=${v=>{v.detail.checked?V(s)?.select(t.id):V(s)?.deselect(t.id)}}></os-checkbox> | |
| 522 | + </div> | |
| 523 | + <div class="os-posts-desk__story-content"> | |
| 524 | + ${p} | |
| 525 | + <div class="os-posts-desk__story-copy"> | |
| 526 | + <div class="os-posts-desk__kicker">${d}</div> | |
| 527 | + <h3><a href=${Te(s.extra,t.id)} @click=${v=>{v.preventDefault(),ht(s,t)}}>${n}</a></h3> | |
| 528 | + <p class="os-posts-desk__excerpt">${a?`/${t.slug||""}`:ns(t)||u("Every story starts somewhere. Open the editor to keep writing.")}</p> | |
| 513 | 529 | </div> |
| 514 | - `),r=(n,l,c,d)=>{const{state:u,data:h}=n,g=h?.list,m=g?.total??0,_=g?.pages??0,b=c==="pages",v=n.extra;let y;if(n.loading)y="";else if(m===0)y=p(b?"No pages":"No posts");else{const X=p(b?"Page %1$d of %2$d · %3$d pages":"Page %1$d of %2$d · %3$d posts");y=P(X,g?.page??u.page,Math.max(_,1),m)}const $=()=>n.host.openUrl?.(v.newPostUrl??"",p(b?"Add New Page":"Add New Post"),b?"dashicons-admin-page":"dashicons-admin-post");return l.extras||(l.extras=Jo(Ce(n,l))),f` | |
| 530 | + </div> | |
| 531 | + <div class="os-posts-desk__metrics" data-content-metrics=${`${t.id}:${t.modified_gmt}`} data-post-id=${t.id}> | |
| 532 | + <os-stat data-metric="words" value="—" label=${u("Words")} title=${u("Words in the complete page or post body")}></os-stat> | |
| 533 | + <os-stat data-metric="comments" value=${typeof t.openstation_comment_count=="number"?String(t.openstation_comment_count):"—"} label=${u("Comments")} title=${u("Approved comments")}></os-stat> | |
| 534 | + ${a?"":b`<os-stat value=${String(t.tags?.length??0)} label=${u("Tags")}></os-stat>`} | |
| 535 | + ${i.map(v=>Li(v,t))} | |
| 536 | + </div> | |
| 537 | + ${t.openstation_lock?b`<p class="os-posts-desk__lock"><span class="dashicons dashicons-lock" aria-hidden="true"></span>${H(u("%s is editing"),t.openstation_lock.userName)}</p>`:""} | |
| 538 | + <footer class="os-posts-desk__story-foot"> | |
| 539 | + <span class="os-posts-desk__byline">${Xe(t).name}<span aria-hidden="true"> · </span><os-relative-time datetime=${t.modified_gmt||t.date_gmt}></os-relative-time></span> | |
| 540 | + <os-button variant="ghost" @click=${()=>ht(s,t)}>${u("Edit")}<span aria-hidden="true"> ↗</span></os-button> | |
| 541 | + <os-button variant="secondary" data-inspect-id=${t.id} @click=${g}>${u("Details")}</os-button> | |
| 542 | + </footer> | |
| 543 | + </article>`}function Ii(s,e,t,o,i,a){if(!a||!e.peek||e.focused===null)return"";const n=JSON.stringify([a,Array.from(i)]);if(n!==e.inspectorKey){e.inspectorKey=n,e.fields=ct(t,new Map,o,!1,i).filter(c=>!["title","author","date"].includes(c.key)).map(c=>({key:c.key,label:c.label||c.key,node:c.render?c.render(a[c.key],a,0):String(a[c.key]??"—")}));for(const c of t.categories.pickers)c.isConnected||t.categories.pickers.delete(c)}const r=Ye(a),l=()=>{const c=e.focused??a.id;e.focused=null,e.peek=!1,s.repaint(),rs(s.root,`[data-inspect-id="${c}"]`)};return b`<aside class="os-posts-desk__inspector ${e.focused!==null?"is-open":""}" aria-label=${u("Content details")} | |
| 544 | + @keydown=${c=>{c.key==="Escape"&&(c.stopPropagation(),l())}}> | |
| 545 | + <header class="os-posts-desk__inspector-head"><span>${s.extra.mode==="pages"?u("PAGE DETAILS"):u("STORY DETAILS")}</span><os-button variant="ghost" data-os-posts-inspect-close @click=${l}>${u("Close details")}</os-button></header> | |
| 546 | + <div class="os-posts-desk__inspector-scroll"> | |
| 547 | + ${r?b`<img class="os-posts-desk__cover" src=${r.url} alt=${r.alt} @error=${c=>c.target.hidden=!0}>`:""} | |
| 548 | + ${as(a)} | |
| 549 | + <h2>${le(a)||u("(no title)")}</h2> | |
| 550 | + <p class="os-posts-desk__byline">${Xe(a).name}</p> | |
| 551 | + ${a.openstation_lock?b`<os-notice tone="warning">${H(u("%s is currently editing"),a.openstation_lock.userName)}</os-notice>`:""} | |
| 552 | + <p class="os-posts-desk__preview">${ns(a)||u("No excerpt yet.")}</p> | |
| 553 | + <os-facts layout="between" class="os-posts-desk__dates"><os-fact label=${a.status==="future"?u("Scheduled for"):u("Date")}><os-relative-time datetime=${a.date_gmt||a.date}></os-relative-time></os-fact><os-fact label=${u("Last edited")}><os-relative-time datetime=${a.modified_gmt||a.modified}></os-relative-time></os-fact></os-facts> | |
| 554 | + <div class="os-posts-desk__fields">${e.fields.map(c=>b`<section data-detail-field=${c.key}><h3>${c.label}</h3>${c.node}</section>`)}</div> | |
| 555 | + </div> | |
| 556 | + <footer class="os-posts-desk__inspector-actions"><os-button variant="primary" @click=${()=>ht(s,a)}>${u("Open editor")}<span aria-hidden="true"> ↗</span></os-button> | |
| 557 | + ${a.link&&a.status==="publish"?b`<a href=${a.link} target="_blank" rel="noopener noreferrer">${u("View on site")} ↗</a>`:""} | |
| 558 | + </footer> | |
| 559 | + </aside>`}function Ni(s,e,t,o,i,a){const n=s.extra.mode==="pages"?u("No pages found."):u("No posts found."),r=s.data?.list.items??[],l=r.find(d=>d.id===e.focused)??r[0],c=r.length?li(t,o,i):[];return b`<div class="os-posts-desk__workspace ${e.focused!==null&&l?"has-detail":""}" ?hidden=${e.view!=="desk"}> | |
| 560 | + <div class="os-posts-desk__feed" aria-label=${s.extra.mode==="pages"?u("Page directory"):u("Stories")}> | |
| 561 | + ${r.length?r.map(d=>Ri(s,e,d,e.peek?l?.id:void 0,c)):b`<div class="os-posts-desk__empty"><span class="dashicons dashicons-welcome-write-blog" aria-hidden="true"></span><h3>${s.loading?u("Opening your workspace…"):n}</h3><p>${s.loading?u("Your content will appear here."):u("Try a different search or change the status filter.")}</p></div>`} | |
| 562 | + ${a??""} | |
| 563 | + </div> | |
| 564 | + ${e.peek?Ii(s,e,t,o,i,l):""} | |
| 565 | + </div>`}function Oi(s){queueMicrotask(()=>{for(const t of s.querySelectorAll(".os-posts-desk__select, [data-os-posts-search]"))t.shadowRoot?.querySelector("input")?.setAttribute("aria-label",t.getAttribute("aria-label")||"");const e=s.querySelector(".os-posts-desk__filter-toggle");e?.shadowRoot?.querySelector("button")?.setAttribute("aria-expanded",e.getAttribute("aria-expanded")||"false")})}const qi="[openstation:desktop-mode-posts]",Di=50,Ie=()=>({desk:Ei(),feed:new ki,client:null,env:null,cellCache:new Map,table:Ds(),filterData:{authors:[],tags:[]},columnsKey:"",hidden:null,selected:0,bulkActions:null,extras:null,postsCtx:null,tab:"posts",serverTab:"posts",editor:null,canvases:{categories:null,tags:null},canvasPending:new Set,menu:null,disposed:!1,tagPage:0,tagTotalPages:1,tagFetching:!1}),ls=s=>s.mode==="pages"?"pages":"posts";function Hi(s){return s.map(e=>`${e.id}:${e.status}:${e.modified_gmt}`).join("|")}function Ne(s,e){return e.client||(e.client=bi(s.fetch)),e.client}function pe(s,e){return s.hidden||(s.hidden=Qt(e)),s.hidden}function cs(s,e,t){const o=e.replace(/:\s*$/,"");Gs(s.host.toast,t,o===e?{fallback:e,duration:6e3}:{lead:o,fallback:`${o}.`,duration:6e3})}function ft(s,e,t){return e.env||(e.env={extra:s.extra,client:Ne(s,e),cells:t,openUrl:(o,i,a)=>s.host.openUrl?.(o,i,a),confirm:o=>s.host.confirm?.(o)??Promise.resolve(!1),toast:(o,i)=>cs(s,o,i),announce:(o,i)=>s.host.announce?.("post",o,i),parentTitles:new Map,categories:{tree:null,pickers:new Set}}),e.env}function Fi(s,e){return{client:Ne(s,e),extra:s.extra,openUrl:(t,o,i)=>s.host.openUrl?.(t,o,i),toast:(t,o)=>cs(s,t,o),leaveFullscreen:()=>{const t=window.wp?.os?.windowManager?.getById?.(s.windowId);t?.isFullscreen?.()&&t.toggleFullscreen?.()}}}async function ds(s,e){if(!(e.tagFetching||e.tagPage>=e.tagTotalPages)){e.tagFetching=!0;try{const t=e.tagPage+1,o=await Ne(s,e).fetchTagOptions(t,Di);e.tagPage=t,e.tagTotalPages=Math.max(e.tagTotalPages,o.totalPages||t);const i=new Set(e.filterData.tags.map(a=>a.id));for(const a of o.items)i.has(a.id)||(e.filterData.tags.push(a),i.add(a.id));e.filterData.tagsHasMore=e.tagPage<e.tagTotalPages,s.repaint()}finally{e.tagFetching=!1}}}const Ui=s=>`${s.authors.map(e=>e.id).join(",")}|${s.tags.map(e=>e.id).join(",")}|${s.tagsHasMore?1:0}`,ps=s=>s.split(",").map(e=>parseInt(e.trim(),10)).filter(e=>Number.isFinite(e)&&e>0),us=(s,e)=>s.length===e.length&&s.every((t,o)=>t===e[o]);function Vi(s,e,t){const o=s.extra;t.getRowId=a=>a.id,t.subTable=a=>vo(a);const i=mi(s.state.orderby);t.sort=t.columns.some(a=>a.key===i)?{key:i,direction:s.state.order}:null,t.addEventListener("os-table-selection-change",()=>{e.selected=t.selection?.size??0,s.repaint()}),t.addEventListener("os-table-sort-change",a=>{const n=a.detail?.sort,r=o.defaultOrderby??"date";s.dispatch("sort",n?{orderby:gi(n.key,r),order:n.direction}:{orderby:r,order:o.defaultOrder??"desc"})}),t.addEventListener("os-table-filter-change",a=>{const n=a.detail?.filters??{},r=ps(n.author??""),l=ps(n.tags??"");us(r,s.state.author)&&us(l,s.state.tag)||(s.local("set-column-filters",{author:r,tag:l}),s.dispatch("filter"))})}function Wi(s,e={}){const t=e.terms,o=e.cells??{},i="nativePagesHiddenColumns",a=(h,f,m)=>{if(!t||f.canvases[m]||f.canvasPending.has(m))return;const y=h.root.querySelector(m==="categories"?"[data-os-posts-cats-host]":"[data-os-posts-tags-host]");y&&(f.canvasPending.add(m),t[m](y,Fi(h,f)).then(w=>{if(f.disposed){w();return}f.canvases[m]=w}).catch(w=>{console.error(`${qi} ${m} canvas failed`,w)}).finally(()=>f.canvasPending.delete(m)))},n=(h,f,m,y)=>(f.bulkActions||(f.bulkActions=hi(ui(m,w=>h.dispatch("trash",{ids:w})))),b` | |
| 566 | + <div class="os-app-list__toolbar-right ${"os-app-list__bulk--footer"}" data-os-posts-bulk ?hidden=${f.selected===0}> | |
| 567 | + <span class="os-app-list__count" data-os-posts-count>${H(u("%d selected"),f.selected)}</span> | |
| 568 | + <os-button variant="ghost" @click=${()=>V(h)?.clearSelection()}>${u("Clear selection")}</os-button> | |
| 569 | + <span class="os-app-list__bulk-actions" data-os-posts-bulk-actions>${f.bulkActions.map(w=>b`<os-button | |
| 570 | + variant=${w.variant??"secondary"} | |
| 571 | + data-os-posts-bulk-action=${w.id} | |
| 572 | + @click=${()=>void xi(h,w,dt(h,f))} | |
| 573 | + >${w.icon?b`<span class="dashicons ${w.icon}" aria-hidden="true"></span>`:""} ${w.label}</os-button>`)}</span> | |
| 574 | + </div> | |
| 575 | + `),r=h=>Us(h.root.querySelector("[data-os-posts-editor] iframe")),l=(h,f)=>{f.editor&&r(h).then(m=>{m||f.disposed||!f.editor||(f.editor(),f.editor=null)})},c=(h,f)=>{const m="os.native-window.before-close",y=window.wp?.hooks;if(!y?.addFilter||!y.removeFilter)return()=>{};const w=`desktop-mode/posts/close-guard/${h.windowId}`;let k=!1;return y.addFilter(m,w,(...C)=>{const $=C[0];return C[1]?.windowId!==h.windowId||!f.editor||k?$:(k=!0,(async()=>{const N=!await r(h)||await h.host.confirm?.({title:u("Leave without saving?"),message:u("This post has changes that have not been saved. Closing the window discards them."),confirmLabel:u("Discard and close"),danger:!0})===!0;k=!1,N&&(f.editor?.(),f.editor=null,window.wp?.os?.windowManager?.getById(h.windowId)?.close())})(),!1)}),()=>y.removeFilter?.(m,w)},d=(h,f)=>{if(f.editor)return;const m=h.root.querySelector("[data-os-posts-editor]"),y=h.extra.newPostUrl??"";m&&y&&(f.editor=window.wp?.os?.embedAdminPage?.(m,y)??null)},p=(h,f,m)=>{const y=h.root.querySelector("os-tabs");if(!y){const w=m==="pages";h.host.openUrl?.(h.extra.newPostUrl??"",u(w?"Add Page":"Add Post"),w?"dashicons-admin-page":"dashicons-admin-post");return}y.value="new",v(h,f,"new")},g=h=>h.extra.menuTabs??[],v=(h,f,m)=>{if(f.tab==="new"&&m!=="new"&&l(h,f),f.tab=m,m==="new"){d(h,f);return}if(m==="atlas"&&!f.atlas&&e.atlas){const y=h.root.querySelector("[data-os-pages-atlas]");y&&(f.atlas=e.atlas(y,h));return}(m==="categories"||m==="tags")&&a(h,f,m)},_=(h,f)=>{const m=String(h.state.tab??"")||"posts";if(m===f.serverTab||(f.serverTab=m,m===f.tab))return;const y=h.root.querySelector("os-tabs");y&&(y.value=m),v(h,f,m)},x=(h,f,m,y)=>{const w=f.feed.reconcile(h),{state:k,data:C}=w,$=C?.list,P=m==="pages",z=ft(h,f,o);Zt(z,$?.items??[]);const N=()=>p(h,f,m);return f.extras||(f.extras=fi(dt(h,f))),b` | |
| 576 | + <header class="os-posts-desk__hero"> | |
| 577 | + <div><span class="os-posts-desk__eyebrow">${u(P?"THE SHAPE OF YOUR SITE":"YOUR EDITORIAL SPACE")}</span><h2>${u(P?"A place for every page.":"Stories in motion.")}</h2><p>${u(P?"Find a page. See where it belongs. Make it yours.":"From first thought to published story. Keep the words moving.")}</p></div> | |
| 578 | + <os-button variant="holo" data-os-posts-new @click=${N}><span class="dashicons dashicons-plus" aria-hidden="true"></span>${u(P?"New page":"Write a post")}</os-button> | |
| 579 | + </header> | |
| 515 | 580 | <header class="os-app-list__toolbar" data-os-posts-toolbar> |
| 516 | 581 | <div class="os-app-list__toolbar-left"> |
| 517 | - ${kt({segments:Xo(),value:u.status,bind:"status",action:"filter",label:p("Filter by status"),phone:d})} | |
| 518 | - <os-text-field | |
| 519 | - class="os-app-list__search" | |
| 520 | - data-os-posts-search | |
| 521 | - os-bind="search" | |
| 522 | - os-action="filter" | |
| 523 | - os-debounce="250" | |
| 524 | - value=${u.search} | |
| 525 | - placeholder=${p(b?"Search pages…":"Search posts…")} | |
| 526 | - ></os-text-field> | |
| 582 | + ${Ns({segments:pi(),value:k.status,bind:"status",action:"filter",label:u("Filter by status"),phone:y})} | |
| 527 | 583 | </div> |
| 528 | - ${d?"":a(n,l,c,!1)} | |
| 584 | + | |
| 529 | 585 | <div class="os-app-list__toolbar-trailing"> |
| 530 | - <span data-os-posts-toolbar-extras>${l.extras}</span> | |
| 531 | - <os-button variant="ghost" os-action="refresh" data-os-posts-refresh title=${p("Refresh")}> | |
| 532 | - <span class="dashicons dashicons-update" aria-hidden="true"></span> | |
| 586 | + <span data-os-posts-toolbar-extras>${f.extras}</span> | |
| 587 | + <os-button variant="ghost" os-action="refresh" data-os-posts-refresh title=${u("Refresh")}> | |
| 588 | + <span class="dashicons dashicons-update" aria-hidden="true"></span>${u("Refresh")} | |
| 533 | 589 | </os-button> |
| 534 | - <os-button variant="primary" data-os-posts-new @click=${$}> | |
| 535 | - <span class="dashicons dashicons-plus" aria-hidden="true"></span> | |
| 536 | - ${p("Add New")} | |
| 537 | - </os-button> | |
| 538 | 590 | </div> |
| 539 | 591 | </header> |
| 540 | - ${g?.error?f`<os-notice tone="danger">${g.error}</os-notice>`:""} | |
| 541 | - <div class="os-app-list__body" data-os-posts-body> | |
| 592 | + ${$?.error?b`<os-notice tone="danger">${$.error}</os-notice>`:""} | |
| 593 | + ${Pi(w,f.desk)} | |
| 594 | + ${Ni(w,f.desk,z,f.filterData,pe(f,i),f.feed.tail())} | |
| 595 | + <div class="os-app-list__body" data-os-posts-body ?hidden=${f.desk.view!=="table"}> | |
| 542 | 596 | <os-table |
| 543 | 597 | data-os-posts-table |
| 544 | 598 | os-preserve |
| 545 | 599 | selectable="multi" |
| @@ -549,30 +603,54 @@ | ||
| 549 | 603 | striped |
| 550 | 604 | bordered |
| 551 | 605 | > |
| 552 | 606 | <div slot="empty" class="os-app-list__empty"> |
| 553 | - <span class="dashicons ${b?"dashicons-admin-page":"dashicons-admin-post"}" aria-hidden="true"></span> | |
| 554 | - <p>${p(b?"No pages found.":"No posts found.")}</p> | |
| 607 | + <span class="dashicons ${P?"dashicons-admin-page":"dashicons-admin-post"}" aria-hidden="true"></span> | |
| 608 | + <p>${u(P?"No pages found.":"No posts found.")}</p> | |
| 555 | 609 | <p class="os-app-list__empty-hint"> |
| 556 | - ${p("Try a different search or change the status filter.")} | |
| 610 | + ${u("Try a different search or change the status filter.")} | |
| 557 | 611 | </p> |
| 558 | 612 | </div> |
| 559 | 613 | </os-table> |
| 560 | 614 | </div> |
| 561 | - ${Ct({page:g?.page??u.page,pages:_,perPage:u.perPage,summary:y,pageAction:"page",perPageBind:"perPage",perPageAction:"filter",labels:{previous:p("Previous"),next:p("Next"),perPage:p("Per page")}})} | |
| 562 | - ${d?a(n,l,c,!0):""} | |
| 563 | - `};return Et(i,{local:{"set-column-filters":(n,l)=>{n.author=Array.isArray(l.author)?l.author:[],n.tag=Array.isArray(l.tag)?l.tag:[]}},placeholder:n=>({list:{items:[],total:0,pages:0,page:n.page,perPage:n.perPage,error:"",code:""}}),view:n=>{const l=n.ui($e),c=cs(n.extra),d=le(),u=r(n,l,c,d),h=`os-app-list desktop-mode-posts${c==="pages"?" desktop-mode-pages":""}`;if(!t)return f`<div class=${h} data-os-posts-root> | |
| 564 | - <div class="os-app-list__panel">${u}</div> | |
| 565 | - </div>`;const g=m=>{const _=m.detail?.value??"posts";l.tab=_,(_==="categories"||_==="tags")&&s(n,l,_)};return f`<div class=${h} data-os-posts-root> | |
| 566 | - <os-tabs value=${l.tab} class="os-app-list__tabs" @os-tab-change=${g}> | |
| 567 | - <os-tab value="posts">${p("All posts")}</os-tab> | |
| 568 | - <os-tab value="categories">${p("Categories")}</os-tab> | |
| 569 | - <os-tab value="tags">${p("Tags")}</os-tab> | |
| 615 | + ${f.desk.view==="table"?f.feed.tail():""} | |
| 616 | + ${n(h,f,m)} | |
| 617 | + `};return Hs(s,{local:{"set-column-filters":(h,f)=>{h.author=Array.isArray(f.author)?f.author:[],h.tag=Array.isArray(f.tag)?f.tag:[]}},placeholder:h=>({list:{items:[],total:0,pages:0,page:h.page,perPage:h.perPage,error:"",code:""}}),view:h=>{const f=h.ui(Ie),m=ls(h.extra),y=Ue(),w=x(h,f,m,y),k=`os-app-list desktop-mode-posts${m==="pages"?" desktop-mode-pages":""}`;if(!t&&!e.atlas)return b`<div class=${k} data-os-posts-root data-desk-options=${String(f.desk.filters)}><style>${is.cssText}${os.cssText}</style> | |
| 618 | + <div class="os-app-list__panel">${w}</div> | |
| 619 | + </div>`;const C=$=>{const P=$.detail?.value??"posts";v(h,f,P)};return b`<div class=${k} data-os-posts-root data-desk-options=${String(f.desk.filters)}><style>${is.cssText}${os.cssText}</style> | |
| 620 | + <os-tabs value=${f.tab} class="os-app-list__tabs" @os-tab-change=${C}> | |
| 621 | + ${g(h).map($=>b`<os-tab value=${$.id}>${$.label}</os-tab>`)} | |
| 570 | 622 | </os-tabs> |
| 571 | - <os-tabpanel for="posts" class="os-app-list__panel">${u}</os-tabpanel> | |
| 572 | - <os-tabpanel for="categories" class="os-app-list__panel"> | |
| 623 | + <os-tabpanel for="posts" class="os-app-list__panel">${w}</os-tabpanel> | |
| 624 | + <os-tabpanel for="new" class="os-app-list__panel"> | |
| 625 | + <div data-os-posts-editor class="os-posts__embed-host" os-preserve></div> | |
| 626 | + </os-tabpanel> | |
| 627 | + ${e.atlas?b`<os-tabpanel for="atlas" class="os-app-list__panel"><div data-os-pages-atlas class="os-pages-atlas-host" os-preserve></div></os-tabpanel>`:""} | |
| 628 | + ${t?b`<os-tabpanel for="categories" class="os-app-list__panel"> | |
| 573 | 629 | <div data-os-posts-cats-host class="os-posts__terms-host" os-preserve></div> |
| 574 | 630 | </os-tabpanel> |
| 575 | 631 | <os-tabpanel for="tags" class="os-app-list__panel"> |
| 576 | 632 | <div data-os-posts-tags-host class="os-posts__terms-host" os-preserve></div> |
| 577 | - </os-tabpanel> | |
| 578 | - </div>`},mounted:n=>{const l=n.ui($e),c=[],d=rt(n,l,o),u=new MutationObserver(()=>{H(n)?.toggleAttribute("loading",n.root.getAttribute("aria-busy")==="true")});u.observe(n.root,{attributes:!0,attributeFilter:["aria-busy"]}),c.push(()=>u.disconnect()),ie(n,l).fetchAuthorOptions().then(b=>{l.filterData.authors=b,n.repaint()}),l.filterData.loadMoreTags=()=>void nt(n,l),nt(n,l),l.menu=$t(n.root,{section:p("Show columns"),prefix:i,items:Bo(d),isChecked:b=>!q(l).has(b),onToggle:b=>{const v=q(l);v.has(b)?v.delete(b):v.add(b);const y=window.wp?.os;y&&typeof y.updateOsSettings=="function"&&y.updateOsSettings({nativePostsHiddenColumns:Array.from(v).sort()},{windowId:n.windowId}),n.repaint()}}),c.push(()=>l.menu?.dispose());const h=window.wp?.os;if(h&&typeof h.subscribeOsSettings=="function"){let b=Array.from(q(l)).sort().join(",");c.push(h.subscribeOsSettings(()=>{const v=ke(),y=Array.from(v).sort().join(",");y!==b&&(b=y,l.hidden=v,n.repaint(),l.menu?.refresh())}))}h&&typeof h.subscribe=="function"&&c.push(h.subscribe("os.term.changed",b=>{b?.taxonomy==="category"&&(Qe(d),So(d))}));const g=()=>n.repaint();document.addEventListener("os-mode-changed",g),c.push(()=>document.removeEventListener("os-mode-changed",g));const m=Ce(n,l),_=window.wp?.hooks;return _&&typeof _.doAction=="function"&&_.doAction(Uo,m),document.dispatchEvent(new CustomEvent("os-posts-window-opened",{detail:m})),()=>{l.disposed=!0;for(const b of c)b();l.canvases.categories?.(),l.canvases.tags?.(),l.canvases={categories:null,tags:null},Qe(d)}},updated:n=>{const l=H(n);if(!l)return;n.loading&&l.setAttribute("loading","");const c=n.ui($e),{state:d,data:u}=n,h=rt(n,c,o),g=`${Array.from(q(c)).sort().join(",")}|${hs(c.filterData)}`;g!==c.columnsKey&&(c.columnsKey=g,c.cellCache.clear(),c.table.invalidateColumns());const m=u?.list?.items??[];c.table.sync({table:l,rows:m,listKey:[d.page,d.perPage,d.search,d.status,d.orderby,d.order,d.author.join(","),d.tag.join(",")].join("|"),fingerprint:ds(m),columns:b=>(c.cellCache.clear(),Go(h,c.cellCache,c.filterData,b,q(c))),wire:()=>ps(n,c,l),onSelection:b=>{c.selected=b.length}}).dataChanged&&(c.cellCache.clear(),Ao(h,m),u&&ns(u))}})}const gs=fs("desktop-mode-pages");return re.default=gs,Object.defineProperties(re,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),re}({}); | |
| 633 | + </os-tabpanel>`:""} | |
| 634 | + </div>`},mounted:h=>{const f=h.ui(Ie),m=[];f.stats=Ci(h.root,h.fetch,ls(h.extra)),f.stats.sync(),m.push(()=>f.stats?.dispose());const y=ft(h,f,o),w=new MutationObserver(()=>{V(h)?.toggleAttribute("loading",h.root.getAttribute("aria-busy")==="true")});w.observe(h.root,{attributes:!0,attributeFilter:["aria-busy"]}),m.push(()=>w.disconnect()),Ne(h,f).fetchAuthorOptions().then(z=>{f.filterData.authors=z,h.repaint()}),f.filterData.loadMoreTags=()=>void ds(h,f),ds(h,f),f.menu=Os(h.root,{section:u("Show columns"),prefix:s,items:ci(y),isChecked:z=>!pe(f,i).has(z),onToggle:z=>{const N=pe(f,i);N.has(z)?N.delete(z):N.add(z);const E=window.wp?.os;E&&typeof E.updateOsSettings=="function"&&E.updateOsSettings({[i]:Array.from(N).sort()},{windowId:h.windowId}),h.repaint()}}),m.push(()=>f.menu?.dispose());const k=window.wp?.os;if(k&&typeof k.subscribeOsSettings=="function"){let z=Array.from(pe(f,i)).sort().join(",");m.push(k.subscribeOsSettings(()=>{const N=Qt(i),E=Array.from(N).sort().join(",");E!==z&&(z=E,f.hidden=N,h.repaint(),f.menu?.refresh())}))}k&&typeof k.subscribe=="function"&&m.push(k.subscribe("os.term.changed",z=>{z?.taxonomy==="category"&&(Gt(y),Vo(y))}));const C=()=>h.repaint();document.addEventListener("os-mode-changed",C),m.push(()=>document.removeEventListener("os-mode-changed",C)),m.push(c(h,f));const $=dt(h,f),P=window.wp?.hooks;return P&&typeof P.doAction=="function"&&P.doAction(ni,$),document.dispatchEvent(new CustomEvent("os-posts-window-opened",{detail:$})),()=>{f.disposed=!0;for(const z of m)z();f.feed.dispose(),f.atlas?.(),f.editor?.(),f.editor=null,f.canvases.categories?.(),f.canvases.tags?.(),f.canvases={categories:null,tags:null},Gt(y)}},updated:h=>{Oi(h.root),_(h,h.ui(Ie));const f=V(h);if(!f)return;h.loading&&f.setAttribute("loading","");const m=h.ui(Ie);m.stats?.sync(),m.feed.observe(h.root);const{state:y,data:w}=h,k=ft(h,m,o),C=`${Array.from(pe(m,i)).sort().join(",")}|${Ui(m.filterData)}`;C!==m.columnsKey&&(m.columnsKey=C,m.cellCache.clear(),m.table.invalidateColumns());const $=m.feed.items;m.table.sync({table:f,rows:$,listKey:[y.perPage,y.search,y.status,y.orderby,y.order,y.author.join(","),y.tag.join(",")].join("|"),fingerprint:Hi($),columns:z=>(m.cellCache.clear(),ct(k,m.cellCache,m.filterData,z,pe(m,i))),wire:()=>Vi(h,m,f),onSelection:z=>{m.selected=z.length}}).dataChanged&&($.some(z=>z.id===m.desk.focused)||(m.desk.focused=null),queueMicrotask(()=>{m.disposed||h.repaint()}),m.cellCache.clear(),Zt(k,$),w&&yi(w))}})}const gt=480,hs=368;function ji(s,e,t){var v;const o=new Map(s.map(_=>[_.id,_])),i=new Map(s.map(_=>[_.id,new Set]));for(const _ of e)i.get(_.from)?.add(_.to),i.get(_.to)?.add(_.from);const a=new Set,n=[];for(const _ of s){if(a.has(_.id))continue;const x=[_.id];a.add(_.id);for(let h=0;h<x.length;h++)for(const f of i.get(x[h])||[])o.has(f)&&!a.has(f)&&(a.add(f),x.push(f));n.push(x)}n.sort((_,x)=>x.length-_.length||_[0]-x[0]);const r=new Map;let l=0,c=1;for(const _ of n.filter(x=>x.length>1)){const x=_.includes(t||0)?t:[..._].sort((k,C)=>(i.get(C)?.size||0)-(i.get(k)?.size||0)||k-C)[0],h=new Map([[x,0]]),f=[x];for(let k=0;k<f.length;k++)for(const C of i.get(f[k])||[])!h.has(C)&&o.has(C)&&(h.set(C,h.get(f[k])+1),f.push(C));const m=[];for(const k of f)(m[v=h.get(k)]??(m[v]=[])).push(k);for(let k=0;k<6;k++){const C=m.map(($,P)=>P);k%2&&C.reverse();for(const $ of C){const P=m[$+(k%2?1:-1)];if(!P)continue;const z=new Map(P.map((E,q)=>[E,q])),N=E=>{const q=Array.from(i.get(E)||[]).filter(ee=>z.has(ee)).map(ee=>z.get(ee));return q.length?q.reduce((ee,bt)=>ee+bt,0)/q.length:0};m[$].sort((E,q)=>N(E)-N(q)||E-q)}}const y=Math.min(6,Math.max(...m.map(k=>k.length)));let w=0;for(const k of m)k.forEach((C,$)=>r.set(C,{x:(w+Math.floor($/y))*gt,y:(l+$%y+Math.floor((y-Math.min(y,k.length))/2))*hs})),w+=Math.ceil(k.length/y);l+=y+1,c=Math.max(c,w)}const d=n.filter(_=>_.length===1).flat(),p=Math.max(c+(d.length?1:0),Math.ceil(Math.sqrt(s.length*1.2)),1);let g=0;for(const _ of d){for(;Math.floor(g/p)<Math.max(0,l-1)&&g%p<c;)g++;r.set(_,{x:g%p*gt,y:Math.floor(g/p)*hs}),g++}return[...s].sort((_,x)=>+(x.id===t)-+(_.id===t)).map(_=>({page:_,...r.get(_.id)}))}function Ki(s,e,t=0){const o=(t%7-3)*7,i=e.x>=s.x,a={x:s.x+(i?J:0),y:s.y+ie/2+o},n=s.x===e.x,r={x:e.x+(i&&!n?0:J),y:e.y+ie/2+o},l=s.x+(i?J+90+o:-90+o),c=e.x+(i&&!n?-90+o:J+90+o);let d;if(n)d=[a,{x:l,y:a.y},{x:l,y:r.y},r];else if(s.y===e.y&&Math.abs(s.x-e.x)===gt)d=[a,r];else{const p=s.y+(e.y<s.y?-55:ie+55)+o;d=[a,{x:l,y:a.y},{x:l,y:p},{x:c,y:p},{x:c,y:r.y},r]}return d.filter((p,g)=>!g||p.x!==d[g-1].x||p.y!==d[g-1].y)}const J=300,ie=258,Bi=1440,Gi=900,Q=s=>ae(s.title.rendered)||u("(no title)");function Oe(s,e=location.origin){try{const t=new URL(s.link,e);return t.origin!==e||!/^https?:$/.test(t.protocol)||/\/wp-admin(?:\/|$)|\/wp-login\.php/.test(t.pathname)?null:(t.hash="",["publish","private"].includes(s.status)||t.searchParams.set("preview","true"),t.href)}catch{return null}}function fs(s){const e=s.searchParams.get("page_id")||s.searchParams.get("p");return e?`${s.origin}/#${e}`:`${s.origin}${s.pathname.replace(/\/+$/,"")}`}function gs(s){const e=new Map(s.map(i=>[i.id,i])),t=new Map;for(const i of s)try{t.set(fs(new URL(i.link)),i.id)}catch{}const o=new Map;for(const i of s){if(i.parent&&i.parent!==i.id&&e.has(i.parent)&&o.set(`parent:${i.parent}:${i.id}`,{from:i.parent,to:i.id,kind:"parent"}),!i.content?.rendered||i.content.protected)continue;const a=new DOMParser().parseFromString(i.content.rendered,"text/html");for(const n of a.querySelectorAll("a[href]"))try{const r=new URL(i.link),l=new URL(n.getAttribute("href"),r);if(l.origin!==r.origin)continue;const c=Number(l.searchParams.get("page_id")||l.searchParams.get("p")),d=c&&e.has(c)?c:t.get(fs(l));d&&d!==i.id&&o.set(`link:${i.id}:${d}`,{from:i.id,to:d,kind:"link"})}catch{}}return Array.from(o.values())}async function Zi(s,e){const t=[];let o=0,i=1;for(let n=1;n<=Math.min(i,5);n++){const r=new URLSearchParams({context:"edit",status:"publish,future,draft,pending,private",per_page:"100",page:String(n),orderby:"menu_order",order:"asc",_fields:"id,parent,title,link,slug,status,content"}),l=await s(`wp/v2/pages?${r}`,{signal:e});if(!l.ok)throw new Error(u("Pages could not be loaded. Try refreshing the atlas."));const c=await l.json();if(!Array.isArray(c))throw new Error(u("The page response was invalid."));t.push(...c),i=Math.max(1,Number(l.headers.get("X-WP-TotalPages"))||1),o=Number(l.headers.get("X-WP-Total"))||t.length}const a=Array.from(new Map(t.map(n=>[n.id,n])).values());return{pages:a,edges:gs(a),total:o}}function Xi(s,e,t=gs(s)){return ji(s,t,e)}function re(s){const e=B(s,"--os-ui-surface","#ffffff",16777215);return{surface:e,raised:B(s,"--os-ui-surface-elevated","#ffffff",e),fg:B(s,"--os-ui-fg","#1d2327",e),muted:B(s,"--os-ui-fg-muted","#50575e",e),faint:B(s,"--os-ui-fg-faint","#b0b3b8",e),border:B(s,"--os-ui-border","#dcdcde",e),accent:B(s,"--os-ui-accent","#2271b1",e)}}function B(s,e,t,o=16777215){const i=document.createElement("span");i.hidden=!0,i.style.color=`var(${e}, ${t})`,s.append(i);const a=getComputedStyle(i).color;i.remove();const n=a.match(/[\d.]+/g)?.map(Number);if(!n||n.length<3)return parseInt(t.slice(1),16);const r=n[3]??1,l=a.startsWith("color(srgb");return[16,8,0].reduce((c,d,p)=>{const g=n[p]*(l?255:1),v=Math.floor(o/2**d)%256;return c+Math.round(g*r+v*(1-r))*2**d},0)}function Yi(s,e,t){let o=JSON.stringify([re(s),t?.()]);const i=()=>{const n=JSON.stringify([re(s),t?.()]);n!==o&&(o=n,e())},a=new MutationObserver(i);for(let n=s;n;n=n.parentElement)a.observe(n,{attributes:!0,attributeFilter:["style","class"]});return document.addEventListener("os-desktop-theme-changed",i),()=>{a.disconnect(),document.removeEventListener("os-desktop-theme-changed",i)}}function Ji(s,e,t,o){if(o<.4)return[];const i=new Set(s),a=e.filter(n=>i.has(n));return o<.5?a.slice(0,6):[...new Set([...t!==null&&i.has(t)?[t]:[],...a,...s])].slice(0,6)}async function Qi(s,e){const t=window.wp?.os;if(!t||typeof t.loadModules!="function")return s.textContent=`${e} ${u("Shell modules API missing.")}`,null;try{await t.loadModules(["pixijs"])}catch{return s.textContent=e,null}const o=window.PIXI;return o||(s.textContent=e),o??null}async function en(s,e,t){const o=new s.Application;await o.init({resizeTo:e,backgroundAlpha:0,antialias:!0,autoDensity:!0,resolution:Math.min(window.devicePixelRatio||1,2)}),e.appendChild(o.canvas),o.canvas.classList.add(t);const i=new s.Container;return i.x=e.clientWidth/2,i.y=e.clientHeight/2,o.stage.addChild(i),o.stage.eventMode="static",o.stage.hitArea=new s.Rectangle(0,0,e.clientWidth,e.clientHeight),{app:o,world:i}}function ms(s,e,t){try{s.ticker?.stop()}catch{}try{s.destroy({removeView:!0},{children:!0})}catch{}e.replaceChildren(),e.classList.remove(...t)}function bs(s){return Math.hypot(s.b.x-s.a.x,s.b.y-s.a.y)}function _s(s){return{x:(s.a.x+s.b.x)/2,y:(s.a.y+s.b.y)/2}}function tn(s,e,t,o){const i=bs(e),a=bs(t),n=i>0&&a>0?a/i:1,r=Math.max(o.min,Math.min(o.max,s.scale*n)),l=_s(e),c=_s(t),d=(l.x-s.x)/s.scale,p=(l.y-s.y)/s.scale;return{scale:r,x:c.x-d*r,y:c.y-p*r}}function sn(s,e){const t=s.ownerDocument.defaultView,o=new AbortController,i=new Map,a=s.style.touchAction;s.style.touchAction="none";let n=!1,r=0;const l=p=>{const g=s.getBoundingClientRect();return{x:p.clientX-g.left,y:p.clientY-g.top}},c={capture:!0,passive:!1,signal:o.signal};t.addEventListener("pointerdown",p=>{p.pointerType!=="touch"||!p.composedPath().includes(s)||(i.set(p.pointerId,l(p)),i.size>=2&&(p.preventDefault(),n||(n=!0,e.start())))},c),t.addEventListener("pointermove",p=>{if(!i.has(p.pointerId))return;if(!n){i.set(p.pointerId,l(p));return}const[g,v]=i.values();if(i.set(p.pointerId,l(p)),p.preventDefault(),v){const[_,x]=i.values();e.write(tn(e.read(),{a:g,b:v},{a:_,b:x},e.bounds))}},c);const d=p=>{i.delete(p.pointerId)&&n&&(p.preventDefault(),i.size||(n=!1,r=performance.now()+300,e.end()))};return t.addEventListener("pointerup",d,c),t.addEventListener("pointercancel",d,c),t.addEventListener("lostpointercapture",d,c),t.addEventListener("click",p=>{p.detail>0&&(n||performance.now()<r)&&p.composedPath().includes(s)&&(p.preventDefault(),p.stopImmediatePropagation())},c),{active:()=>n,dispose:()=>{o.abort(),i.clear(),n&&e.end(),n=!1,s.style.touchAction=a}}}function mt(s,e,t,o){const i=Math.min(1.8,Math.max(.08,e)),a=i/s.zoom;s.x=t-(t-s.x)*a,s.y=o-(o-s.y)*a,s.zoom=i}function on(s,e,t){const o=new Map,i=new AbortController,{signal:a}=i,n=sn(s,{read:()=>({x:e.x,y:e.y,scale:e.zoom}),write:c=>{e.x=c.x,e.y=c.y,e.zoom=c.scale,t()},bounds:{min:.08,max:1.8},start:()=>{o.clear(),s.classList.add("is-panning")},end:()=>s.classList.remove("is-panning")}),r=c=>{const d=s.getBoundingClientRect();return{x:c.clientX-d.left,y:c.clientY-d.top}};s.addEventListener("pointerdown",c=>{n.active()||c.button!==0||c.target.closest("os-button, a")||(o.set(c.pointerId,r(c)),s.setPointerCapture(c.pointerId),s.classList.add("is-panning"))},{signal:a}),s.addEventListener("pointermove",c=>{const d=o.get(c.pointerId);if(n.active()||!d)return;const p=r(c);o.set(c.pointerId,p),e.x+=p.x-d.x,e.y+=p.y-d.y,t()},{signal:a});const l=c=>{o.delete(c.pointerId),o.size||s.classList.remove("is-panning")};return s.addEventListener("pointerup",l,{signal:a}),s.addEventListener("pointercancel",l,{signal:a}),s.addEventListener("lostpointercapture",l,{signal:a}),s.addEventListener("wheel",c=>{c.preventDefault();const d=s.getBoundingClientRect();mt(e,e.zoom*Math.exp(-c.deltaY*.0015),c.clientX-d.left,c.clientY-d.top),t()},{signal:a,passive:!1}),s.addEventListener("keydown",c=>{if(c.target!==s)return;const d=70;if(c.key==="ArrowLeft")e.x+=d;else if(c.key==="ArrowRight")e.x-=d;else if(c.key==="ArrowUp")e.y+=d;else if(c.key==="ArrowDown")e.y-=d;else if(c.key==="+"||c.key==="="||c.key==="-")mt(e,e.zoom*(c.key==="-"?.8:1.25),s.clientWidth/2,s.clientHeight/2);else return;c.preventDefault(),t()},{signal:a}),()=>{i.abort(),n.dispose(),o.clear(),s.classList.remove("is-panning")}}async function nn(s,e,t,o,i,a){const n=document.createElement("div"),r=await Qi(n,u("The connection renderer is unavailable."));if(a.aborted)return null;if(!r)throw new Error(n.textContent||u("PixiJS could not load."));const{app:l,world:c}=await en(r,s,"os-page-atlas__canvas");if(a.aborted)return ms(l,s,[]),null;l.ticker?.stop();const d=new r.Graphics;c.addChild(d);const p=document.createElement("div");p.className="os-page-atlas__world",s.append(p);const g=Xi(e.pages,t,e.edges),v=new Map(g.map(S=>[S.page.id,S])),_=new Map,x=new Map,h={x:30,y:30,zoom:.8};let f=null,m="all",y="",w=!1,k=0,C=0,$=re(s).accent,P=B(s,"--os-ui-info-fg","#72aee6",re(s).surface);for(const S of g){const A=document.createElement("article");A.className="os-page-atlas__sheet",A.dataset.pageId=String(S.page.id),A.style.left=`${S.x}px`,A.style.top=`${S.y}px`,Z(b`<header class="os-page-atlas__sheet-head"><span aria-hidden="true">${S.page.id===t?"⌂":"▤"}</span><os-button variant="ghost" title=${Q(S.page)} @click=${()=>o(S.page.id)}>${Q(S.page)}</os-button></header> | |
| 635 | + <div class="os-page-atlas__viewport"><div class="os-page-atlas__placeholder">${u("Zoom closer for a live preview")}</div></div> | |
| 636 | + <footer class="os-page-atlas__sheet-foot"><span>/${S.page.slug}</span><span>${Ze[S.page.status]||S.page.status}</span></footer>`,A),p.append(A),_.set(S.page.id,A)}const z=(S,A,M,j,T)=>{S.moveTo(A[0].x,A[0].y);for(let D=1;D<A.length-1;D++){const L=A[D-1],I=A[D],te=A[D+1],G=Math.hypot(I.x-L.x,I.y-L.y),_t=Math.hypot(te.x-I.x,te.y-I.y),qe=Math.min(14,G/2,_t/2),ys={x:I.x+(L.x-I.x)/G*qe,y:I.y+(L.y-I.y)/G*qe},ks={x:I.x+(te.x-I.x)/_t*qe,y:I.y+(te.y-I.y)/_t*qe};S.lineTo(ys.x,ys.y).bezierCurveTo(I.x,I.y,I.x,I.y,ks.x,ks.y)}const O=A[A.length-1];S.lineTo(O.x,O.y).stroke({color:M,width:j,alpha:T})},N=()=>{d.clear();const S=new Set;for(const[A,M]of e.edges.entries()){if(m!=="all"&&M.kind!==m)continue;const j=v.get(M.from),T=v.get(M.to);if(!j||!T)continue;const O=f===null||M.from===f||M.to===f;O&&(S.add(M.from),S.add(M.to));const D=M.kind==="parent"?$:P,L=Ki(j,T,A);z(d,L,D,O?10:4,O?.07:.025),z(d,L,D,O?2:1,O?.7:.14);const I=L[L.length-1],te=L[L.length-2],G=Math.sign(I.x-te.x)||1;d.moveTo(I.x-G*9,I.y-5).lineTo(I.x,I.y).lineTo(I.x-G*9,I.y+5).stroke({color:D,width:2,alpha:O?.9:.16}),d.circle(L[0].x,L[0].y,3).fill({color:D,alpha:O?.9:.16})}for(const A of g){const M=_.get(A.page.id);M.classList.toggle("is-selected",A.page.id===f),M.classList.toggle("is-muted",y?!`${Q(A.page)} ${A.page.slug}`.toLocaleLowerCase().includes(y):f!==null&&A.page.id!==f&&!S.has(A.page.id))}},E=()=>{if(w)return;const S=s.clientWidth,A=s.clientHeight,M=S&&A?g.filter(T=>h.x+(T.x+J)*h.zoom>0&&h.y+(T.y+ie)*h.zoom>0&&h.x+T.x*h.zoom<S&&h.y+T.y*h.zoom<A).sort((T,O)=>T.page.id===f?-1:O.page.id===f?1:Math.hypot(h.x+T.x*h.zoom-S/2,h.y+T.y*h.zoom-A/2)-Math.hypot(h.x+O.x*h.zoom-S/2,h.y+O.y*h.zoom-A/2)):[],j=new Set(Ji(M.filter(T=>Oe(T.page)).map(T=>T.page.id),[...x.keys()],f,h.zoom));for(const[T,O]of _){const D=O.querySelector(".os-page-atlas__placeholder");D.textContent=h.zoom<.5?u("Zoom closer for a live preview"):u("Select this page for a live preview"),Oe(v.get(T).page)||(D.textContent=u("Open the editor to preview this page."))}for(const[T,O]of x)j.has(T)||(O.remove(),x.delete(T));for(const T of M){if(!j.has(T.page.id)||x.has(T.page.id))continue;const O=_.get(T.page.id).querySelector(".os-page-atlas__viewport"),D=Oe(T.page);if(!D)continue;const L=document.createElement("iframe");L.title=`${u("Page preview")}: ${Q(T.page)}`,L.width=String(Bi),L.height=String(Gi),L.tabIndex=-1,L.setAttribute("aria-hidden","true"),L.setAttribute("inert",""),L.setAttribute("sandbox","allow-scripts allow-same-origin"),L.src=D,O.append(L),x.set(T.page.id,L)}},q=()=>{w||(c.x=h.x,c.y=h.y,c.scale.set(h.zoom),p.style.transform=`translate(${h.x}px, ${h.y}px) scale(${h.zoom})`,l.render(),i(h.zoom),clearTimeout(k),k=window.setTimeout(E,160))},ee=()=>{if(!s.clientWidth||!s.clientHeight)return;const S=Math.max(J,...g.map(M=>M.x+J)),A=Math.max(ie,...g.map(M=>M.y+ie));h.zoom=Math.max(.08,Math.min(1,(s.clientWidth-70)/S,(s.clientHeight-70)/A)),h.x=(s.clientWidth-S*h.zoom)/2,h.y=(s.clientHeight-A*h.zoom)/2,q()},bt=S=>{const A=v.get(S);if(!A)return;f=S,N();const M={...h},j=Math.min(1.1,(s.clientWidth-80)/J,(s.clientHeight-80)/ie),T={zoom:Math.max(.35,j),x:s.clientWidth/2-(A.x+J/2)*j,y:s.clientHeight/2-(A.y+ie/2)*j};cancelAnimationFrame(C);const O=window.matchMedia("(prefers-reduced-motion: reduce)").matches,D=performance.now(),L=I=>{if(w)return;const te=O?1:Math.min(1,(I-D)/330),G=1-Math.pow(1-te,3);h.x=M.x+(T.x-M.x)*G,h.y=M.y+(T.y-M.y)*G,h.zoom=M.zoom+(T.zoom-M.zoom)*G,q(),te<1&&(C=requestAnimationFrame(L))};C=requestAnimationFrame(L)},cn=Yi(s,()=>{$=re(s).accent,P=B(s,"--os-ui-info-fg","#72aee6",re(s).surface),N(),l.render()},()=>B(s,"--os-ui-info-fg","#72aee6",re(s).surface)),dn=on(s,h,q);let vs=!1;const xs=new ResizeObserver(()=>{w||(s.clientWidth&&s.clientHeight?(l.renderer.resize(s.clientWidth,s.clientHeight),vs?q():(ee(),vs=!0)):E())});return xs.observe(s),N(),ee(),{focus:bt,fit:()=>{cancelAnimationFrame(C),f=null,N(),ee()},filter:(S,A)=>{m=S,y=A.toLocaleLowerCase().trim(),N(),q()},zoom:S=>{cancelAnimationFrame(C),mt(h,h.zoom*S,s.clientWidth/2,s.clientHeight/2),q()},dispose:()=>{w=!0,cn(),clearTimeout(k),cancelAnimationFrame(C),dn(),xs.disconnect(),x.forEach(S=>S.remove()),ms(l,s,[])}}}const an=R` .os-page-atlas{display:flex;flex-direction:column;flex:1;min-inline-size:0;min-block-size:0;color:var( --os-ui-fg,#1d2327 );background:var( --os-ui-surface,#fff );container:page-atlas / inline-size}.os-page-atlas__head{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:20px 24px 16px}.os-page-atlas__head h2{font-size:29px;font-weight:500;line-height:1.1;letter-spacing:-.045em;margin:0 0 6px;color:inherit}.os-page-atlas__head p{font-size:11px;margin:0;color:var( --os-ui-fg-muted,#646970 )}.os-page-atlas__totals{display:flex;gap:18px;--os-ui-stat-padding:0;--os-ui-stat-border:transparent;--os-ui-stat-value-color:var( --os-ui-fg,#1d2327 );--os-ui-stat-value-size:26px}.os-page-atlas__tools{display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:8px 24px;border-block:1px solid var( --os-ui-border,#dcdcde )}.os-page-atlas__tools os-text-field{flex:1;min-inline-size:130px}.os-page-atlas__tools os-select{inline-size:152px}.os-page-atlas__main{display:flex;flex:1;min-block-size:0;position:relative;overflow:hidden}.os-page-atlas__stage{position:relative;flex:1;min-inline-size:0;min-block-size:0;overflow:hidden;touch-action:none;cursor:grab;background-color:var( --os-ui-surface-sunken,#f6f7f7 );background-image:radial-gradient(circle,var( --os-ui-border,#dcdcde ) .7px,transparent .9px);background-size:22px 22px;isolation:isolate}.os-page-atlas__surface{position:absolute;inset:0;overflow:hidden;touch-action:none}.os-page-atlas__surface:focus-visible{outline:2px solid var( --os-ui-accent,#2271b1 );outline-offset:-3px}.os-page-atlas__surface.is-panning{cursor:grabbing;user-select:none}.os-page-atlas__canvas{position:absolute;inset:0;pointer-events:none;z-index:0}.os-page-atlas__world{position:absolute;inset:0 auto auto 0;transform-origin:0 0;z-index:1}.os-page-atlas__sheet{position:absolute;box-sizing:border-box;inline-size:300px;block-size:258px;border:1px solid var( --os-ui-border,#dcdcde );border-radius:8px;background:var( --os-ui-surface,#fff );box-shadow:0 12px 25px -16px var( --os-ui-fg-muted,#646970 ),4px 5px 0 -1px var( --os-ui-surface,#fff ),4px 5px 0 0 var( --os-ui-border,#dcdcde )}.os-page-atlas__sheet.is-selected{outline:2px solid var( --os-ui-accent,#2271b1 );outline-offset:4px}.os-page-atlas__sheet.is-muted{opacity:.36}.os-page-atlas__sheet-head{display:flex;align-items:center;gap:7px;padding:6px 9px;block-size:30px}.os-page-atlas__sheet-head>span{color:var( --os-ui-accent,#2271b1 );font-size:13px}.os-page-atlas__sheet-head os-button{flex:1;min-inline-size:0;text-align:start;--os-ui-button-padding:3px 0}.os-page-atlas__sheet-head os-button::part(button){display:block;inline-size:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:start}.os-page-atlas__viewport{position:relative;inline-size:288px;block-size:180px;margin-inline:5px;overflow:hidden;border-radius:3px;background:var( --os-ui-surface-sunken,#f6f7f7 );pointer-events:none}.os-page-atlas__viewport iframe{position:absolute;inset:0 auto auto 0;display:block;width:1440px !important;height:900px !important;max-width:none !important;max-height:none !important;border:0;transform:scale(.2);transform-origin:0 0;pointer-events:none}.os-page-atlas__placeholder{position:absolute;inset:0;display:grid;place-content:center;text-align:center;padding:20px;font-size:12px;color:var( --os-ui-fg-muted,#646970 );background-image:repeating-linear-gradient(transparent 0 21px,var( --os-ui-border-subtle,#f0f0f1 ) 21px 22px)}.os-page-atlas__sheet-foot{display:flex;justify-content:space-between;gap:6px;padding:8px 10px;font-size:10px;color:var( --os-ui-fg-muted,#646970 )}.os-page-atlas__sheet-foot span:first-child{max-inline-size:210px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.os-page-atlas__directory{flex:0 0 215px;min-inline-size:0;padding:14px;border-inline-start:1px solid var( --os-ui-border,#dcdcde );display:flex;flex-direction:column;gap:12px}.os-page-atlas__directory h3{margin:0;font-size:11px;font-weight:600;letter-spacing:.1em;text-transform:uppercase;color:var( --os-ui-fg-muted,#646970 )}.os-page-atlas__list{overflow:auto;flex:1;min-block-size:0;display:flex;flex-direction:column;gap:5px}.os-page-atlas__list os-button{display:block;text-align:start;--os-ui-button-padding:8px 10px}.os-page-atlas__list os-button::part(button){inline-size:100%;justify-content:space-between;text-align:start}.os-page-atlas__list os-button span{font-variant-numeric:tabular-nums;font-size:10px;color:var( --os-ui-fg-muted,#646970 )}.os-page-atlas__list os-button[aria-pressed="true"]{outline:1px solid var( --os-ui-accent,#2271b1 );border-radius:7px}.os-page-atlas__selection{font-size:12px;border-block-start:1px solid var( --os-ui-border,#dcdcde );padding-block-start:10px}.os-page-atlas__selection strong{display:block;margin-block-end:6px;overflow-wrap:anywhere}.os-page-atlas__selection p{font-size:11px;color:var( --os-ui-fg-muted,#646970 );line-height:1.6}.os-page-atlas__selection os-button{margin-block:4px}.os-page-atlas__legend{display:flex;align-items:center;gap:14px;padding:9px 20px;font-size:10px;color:var( --os-ui-fg-muted,#646970 );border-block-start:1px solid var( --os-ui-border,#dcdcde );flex-wrap:wrap}.os-page-atlas__legend span{display:inline-flex;align-items:center;gap:6px}.os-page-atlas__legend i{inline-size:20px;border-block-start:2px solid var( --os-ui-accent,#2271b1 )}.os-page-atlas__legend .is-link{border-color:var( --os-ui-info,#72aee6 )}.os-page-atlas__legend small{margin-inline-start:auto;font-size:inherit}.os-page-atlas__zoom{position:absolute;inset-block-end:14px;inset-inline-start:14px;z-index:3;display:flex;align-items:center;gap:3px;padding:4px;border:1px solid var( --os-ui-border,#dcdcde );border-radius:9px;background:var( --os-ui-surface,#fff )}.os-page-atlas__zoom output{min-inline-size:42px;font-size:10px;text-align:center}.os-page-atlas__message{padding:20px;font-size:12px;color:var( --os-ui-fg-muted,#646970 )}.os-page-atlas__refresh .dashicons{inline-size:16px;block-size:16px;font-size:16px}.os-page-atlas__browse{display:none}@container page-atlas (max-width:720px){.os-page-atlas__head{padding:12px;gap:10px}.os-page-atlas__head h2{font-size:21px}.os-page-atlas__head p{display:none}.os-page-atlas__totals{gap:12px;--os-ui-stat-value-size:19px}.os-page-atlas__totals os-stat::part(label){font-size:8px}.os-page-atlas__tools{padding:6px 12px;gap:6px}.os-page-atlas__tools os-text-field{min-inline-size:85px}.os-page-atlas__refresh{--os-ui-button-padding:6px}.os-page-atlas__refresh-label{position:absolute;inline-size:1px;block-size:1px;overflow:hidden;clip-path:inset(50%)}.os-page-atlas__tools os-select{inline-size:108px}.os-page-atlas__browse{display:block}.os-page-atlas__directory{display:none}.os-page-atlas.is-browsing .os-page-atlas__directory{display:flex;flex:1;border:0}.os-page-atlas.is-browsing .os-page-atlas__stage,.os-page-atlas.is-browsing .os-page-atlas__zoom{display:none}.os-page-atlas__legend{padding:7px 12px;gap:8px}.os-page-atlas__legend small{display:none}}`;function rn(s,e){let t=!1,o=new AbortController,i=null,a={pages:[],edges:[],total:0},n=null,r="",l="all";const c=()=>{g.classList.toggle("is-browsing")},d=k=>{n=k,g.classList.remove("is-browsing"),y(),requestAnimationFrame(()=>{t||i?.focus(k)})},p=()=>{i?.filter(l,r),y()};Z(b`<style>${an.cssText}</style><section class="os-page-atlas" aria-label=${u("Page atlas")}> | |
| 637 | + <header class="os-page-atlas__head"><div><h2>${u("Your site, unfolded.")}</h2><p>${u("Real pages. Real connections. A different perspective.")}</p></div> | |
| 638 | + <div class="os-page-atlas__totals"><os-stat data-atlas-total value="—" label=${u("Pages")}></os-stat><os-stat data-atlas-connections value="—" label=${u("Connections")}></os-stat></div></header> | |
| 639 | + <div class="os-page-atlas__tools"> | |
| 640 | + <os-text-field id=${`${e.windowId}-atlas-search`} aria-label=${u("Find a page in the atlas")} placeholder=${u("Find a page…")} @os-input-change=${k=>{r=String(k.detail.value),p()}}></os-text-field> | |
| 641 | + <os-select aria-label=${u("Connection type")} value="all" @os-pick=${k=>{l=String(k.detail.value),p()}}> | |
| 642 | + <os-option value="all">${u("All connections")}</os-option><os-option value="parent">${u("Page structure")}</os-option><os-option value="link">${u("Content links")}</os-option> | |
| 643 | + </os-select><os-button class="os-page-atlas__browse" variant="secondary" @click=${c}>${u("Browse")}</os-button> | |
| 644 | + <os-button class="os-page-atlas__refresh" variant="ghost" title=${u("Refresh")} @click=${()=>void w()}><span class="dashicons dashicons-update" aria-hidden="true"></span><span class="os-page-atlas__refresh-label">${u("Refresh")}</span></os-button> | |
| 645 | + </div> | |
| 646 | + <div class="os-page-atlas__main"> | |
| 647 | + <div class="os-page-atlas__stage" aria-label=${u("Page map. Drag to pan, scroll or pinch to zoom. Use arrow keys to pan and plus or minus to zoom. Browse the page directory to select a page.")}></div> | |
| 648 | + <div class="os-page-atlas__zoom"><os-button variant="ghost" title=${u("Zoom out")} @click=${()=>i?.zoom(.8)}>−</os-button><output aria-label=${u("Map zoom")}>100%</output><os-button variant="ghost" title=${u("Zoom in")} @click=${()=>i?.zoom(1.25)}>+</os-button><os-button variant="secondary" @click=${()=>{n=null,y(),i?.fit()}}>${u("Fit all")}</os-button></div> | |
| 649 | + <aside class="os-page-atlas__directory" aria-label=${u("Pages in the atlas")}><h3>${u("Explore your pages")}</h3><div class="os-page-atlas__list"></div><div class="os-page-atlas__selection" aria-live="polite"></div></aside> | |
| 650 | + </div> | |
| 651 | + <footer class="os-page-atlas__legend"><span><i></i>${u("Parent → child")}</span><span><i class="is-link"></i>${u("Links to")}</span><small>${u("1440 × 900 previews · drag to explore")}</small></footer> | |
| 652 | + <div class="os-page-atlas__message" role="status" hidden></div> | |
| 653 | + </section>`,s);const g=s.querySelector(".os-page-atlas"),v=g.querySelector(".os-page-atlas__stage"),_=g.querySelector(".os-page-atlas__list"),x=g.querySelector(".os-page-atlas__selection"),h=g.querySelector(".os-page-atlas__message"),f=g.querySelector("os-text-field");queueMicrotask(()=>f?.shadowRoot?.querySelector("input")?.setAttribute("aria-label",u("Find a page in the atlas")));const m=()=>a.edges.filter(k=>l==="all"||k.kind===l),y=()=>{const k=r.toLocaleLowerCase().trim(),C=a.pages.filter(E=>`${Q(E)} ${E.slug}`.toLocaleLowerCase().includes(k));Z(b`${C.length?C.map(E=>b`<os-button variant="ghost" aria-pressed=${String(n===E.id)} @click=${()=>d(E.id)}>${Q(E)}<span title=${u("Connections")}>${m().filter(q=>q.from===E.id||q.to===E.id).length}</span></os-button>`):b`<p>${u("No matching pages.")}</p>`}`,_);const $=a.pages.find(E=>E.id===n),P=$?a.edges.filter(E=>E.to===$.id&&E.kind==="link").length:0,z=$?a.edges.filter(E=>E.from===$.id&&E.kind==="link").length:0,N=$&&Oe($);Z($?b`<strong>${Q($)}</strong><p>${H(u("%1$d incoming · %2$d outgoing content links"),P,z)}</p> | |
| 654 | + <os-button variant="primary" @click=${()=>e.host.openUrl?.(Te(e.extra,$.id),Q($),"dashicons-admin-page")}>${u("Open editor")} ↗</os-button> | |
| 655 | + ${N?b`<os-button variant="ghost" @click=${()=>e.host.openUrl?.(N,Q($),"dashicons-visibility")}>${u("Open preview")} ↗</os-button>`:""} | |
| 656 | + <p>${u("Connections come from page parents and links in page bodies. Menus are not included.")}</p>`:b`<strong>${u("Follow a thread.")}</strong><p>${u("Choose a page to bring it closer and trace its connections. Pages with no connections remain visible.")}</p>`,x),queueMicrotask(()=>_.querySelectorAll("os-button").forEach(E=>E.shadowRoot?.querySelector("button")?.setAttribute("aria-pressed",E.getAttribute("aria-pressed")||"false")))},w=async()=>{o.abort(),o=new AbortController;const k=o.signal;i?.dispose(),i=null,n=null,v.textContent="",h.hidden=!1,h.textContent=u("Unfolding your pages…"),g.setAttribute("aria-busy","true");try{const C=await Zi(e.fetch,k);if(k.aborted||t)return;if(a=C,g.querySelector("[data-atlas-total]")?.setAttribute("value",String(a.pages.length)),g.querySelector("[data-atlas-connections]")?.setAttribute("value",String(a.edges.length)),y(),!a.pages.length){h.textContent=u("No pages yet. Create your first page to start the atlas.");return}const $=document.createElement("div");$.className="os-page-atlas__surface",$.tabIndex=0,$.setAttribute("role","region"),$.setAttribute("aria-label",v.getAttribute("aria-label")||u("Page map")),v.append($);const P=await nn($,a,typeof e.extra.frontPageId=="number"?e.extra.frontPageId:void 0,d,z=>{g.querySelector("output").textContent=`${Math.round(z*100)}%`},k);if(t||k.aborted){P?.dispose();return}i=P,i?.filter(l,r),h.hidden=a.total<=a.pages.length,h.textContent=H(u("Showing %1$d of %2$d pages. Connections outside this set are not shown."),a.pages.length,a.total)}catch(C){if(k.aborted||t)return;h.hidden=!1,h.textContent=C instanceof Error?C.message:u("The atlas could not load. Try Refresh.")}finally{!k.aborted&&!t&&g.removeAttribute("aria-busy")}};return w(),()=>{t=!0,o.abort(),i?.dispose(),s.replaceChildren()}}const ln=Wi("desktop-mode-pages",{atlas:rn});return De.default=ln,Object.defineProperties(De,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),De}({}); | |