| @@ -1,77 +1,44 @@ | ||
| 1 | -var openStationApp_posts=function(Ze){"use strict";const Tt="desktop-mode";function Qe(){return window.wp?.i18n}function m(s,e=Tt){return Qe()?.__(s,e)??s}function fe(s,e,t,o=Tt){return Qe()?._n(s,e,t,o)??(t===1?s:e)}function V(s,...e){const t=Qe()?.sprintf;if(t)return t(s,...e);let o=0;return s.replace(/%(?:(\d+)\$)?[sd]/g,(n,a)=>{const i=a?Number.parseInt(a,10)-1:o++;return String(e[i]??"")})}function C(s,...e){return{__wpdHtml:!0,strings:s,values:e}}function Wo(s){return!!s&&s.__wpdHtml===!0}const Vo="$$wpd$$",B=/\$\$wpd\$\$(\d+)\$\$/g,Bo="$$wpd-node$$",jo=/^\$\$wpd-node\$\$(\d+)\$\$$/,Xo=new Set(["style","script","textarea","title"]);function Go(s){let e="",t=!1,o=null,n=!1,a=null,i="",r=!1;for(let l=0;l<s.length;l++){const c=s[l];e+=c;for(let u=0;u<c.length;u++){const d=c[u];if(n){c.startsWith("-->",u)&&(n=!1,u+=2);continue}if(a!==null){d==="<"&&c[u+1]==="/"&&c.slice(u+2,u+2+a.length).toLowerCase()===a&&(u+=1+a.length,a=null,t=!0,r=!1,i="");continue}if(o!==null){d===o&&(o=null);continue}if(t){d==='"'||d==="'"?(o=d,r=!1):d===">"?(t=!1,r=!1,Xo.has(i)&&(a=i),i=""):r&&(/[a-zA-Z0-9-]/.test(d)?i+=d.toLowerCase():r=!1);continue}if(c.startsWith("<!--",u)){n=!0,u+=3;continue}const h=c[u+1]??"";d==="<"&&/[a-zA-Z/!]/.test(h)&&(t=!0,i="",r=/[a-zA-Z]/.test(h))}l<s.length-1&&(e+=t||n||a!==null?`${Vo}${l}$$`:`<!--${Bo}${l}$$-->`)}return e}const Pt=new WeakMap;function Mt(s){const e=Pt.get(s);if(e)return e;const t=document.createElement("template");t.innerHTML=Go(s);const o=[],n=(r,l)=>{if(r.nodeType===Node.ELEMENT_NODE){const d=r;for(const h of Array.from(d.attributes)){const p=h.name,f=h.value,b=p[0];if(B.test(f))if(B.lastIndex=0,b==="@"){const _=B.exec(f);B.lastIndex=0,o.push({path:l,kind:"event",name:p.slice(1),valueIndex:_?Number(_[1]):0}),d.removeAttribute(p)}else if(b==="."){const _=B.exec(f);B.lastIndex=0,o.push({path:l,kind:"prop",name:p.slice(1),valueIndex:_?Number(_[1]):0}),d.removeAttribute(p)}else if(b==="?"){const _=B.exec(f);B.lastIndex=0,o.push({path:l,kind:"bool",name:p.slice(1),valueIndex:_?Number(_[1]):0}),d.removeAttribute(p)}else{const _=[],$=[];let S=0,R;for(B.lastIndex=0;(R=B.exec(f))!==null;)_.push(f.slice(S,R.index)),$.push(Number(R[1])),S=R.index+R[0].length;_.push(f.slice(S)),o.push({path:l,kind:"attr",name:p,template:_,valueIndices:$}),d.setAttribute(p,"")}}}const c=Array.from(r.childNodes);let u=0;for(let d=0;d<c.length;d++){const h=c[d],p=d+u;if(h.nodeType===Node.COMMENT_NODE){const f=jo.exec(h.data);if(f){const b=document.createTextNode("");h.parentNode.replaceChild(b,h),o.push({path:[...l,p],kind:"node",valueIndex:Number(f[1])})}continue}if(h.nodeType===Node.TEXT_NODE){const f=h.textContent||"";if(!B.test(f)){B.lastIndex=0;continue}B.lastIndex=0;const b=h.parentNode;let _=0,$;const S=[],R=[];for(B.lastIndex=0;($=B.exec(f))!==null;){$.index>_&&S.push(document.createTextNode(f.slice(_,$.index)));const D=document.createTextNode("");S.push(D),R.push({path:[...l,p+S.length-1],kind:"node",valueIndex:Number($[1])}),_=$.index+$[0].length}_<f.length&&S.push(document.createTextNode(f.slice(_)));for(const D of S)b.insertBefore(D,h);b.removeChild(h),u+=S.length-1,o.push(...R)}else n(h,[...l,p])}};n(t.content,[]);const i={template:t,buildParts:r=>{const l=[];for(const c of o){let u=r;for(const d of c.path)u=u.childNodes[d];c.kind==="node"?l.push({kind:"node",valueIndex:c.valueIndex,child:{anchor:u,state:null}}):c.kind==="attr"?l.push({kind:"attr",element:u,name:c.name,template:c.template,valueIndices:c.valueIndices}):c.kind==="event"?l.push({kind:"event",valueIndex:c.valueIndex,element:u,name:c.name}):c.kind==="prop"?l.push({kind:"prop",valueIndex:c.valueIndex,element:u,name:c.name}):c.kind==="bool"&&l.push({kind:"bool",valueIndex:c.valueIndex,element:u,name:c.name})}return l}};return Pt.set(s,i),i}const Lt=new WeakMap;function Ko(s,e){for(const t of s.nodes)if(t.parentNode!==e)return!1;return!0}function xe(s,e){const t=Lt.get(e);if(t&&t.strings===s.strings&&Ko(t,e)){He(t.parts,s.values);return}const o=Mt(s.strings),n=o.template.content.cloneNode(!0),a=o.buildParts(n),i=Array.from(n.childNodes);for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(n),He(a,s.values),Lt.set(e,{strings:s.strings,parts:a,nodes:i})}function He(s,e){for(const t of s)if(t.kind==="node")Fe(t.child,e[t.valueIndex]);else if(t.kind==="attr"){let o=t.template[0];for(let n=0;n<t.valueIndices.length;n++)o+=It(e[t.valueIndices[n]]),o+=t.template[n+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 Fe(s,e){if(e==null||e===!1){s.state&&(ae(s.state),s.state=null);return}if(Array.isArray(e)){Jo(s,e);return}if(Wo(e)){Qo(s,e);return}if(e instanceof Node){Yo(s,e);return}Zo(s,It(e))}function Yo(s,e){const t=s.state;t?.shape==="node"&&t.node===e||(t&&ae(t),we(s,[e]),s.state={shape:"node",node:e})}function Zo(s,e){const t=s.state;if(t?.shape==="text"){t.text!==e&&(t.node.textContent=e,t.text=e);return}t&&ae(t);const o=document.createTextNode(e);we(s,[o]),s.state={shape:"text",node:o,text:e}}function Qo(s,e){const t=s.state;if(t?.shape==="template"&&t.strings===e.strings){He(t.parts,e.values);return}t&&ae(t);const o=Mt(e.strings),n=o.template.content.cloneNode(!0),a=o.buildParts(n),i=Array.from(n.childNodes);we(s,[n]),He(a,e.values),s.state={shape:"template",strings:e.strings,parts:a,nodes:i}}function Jo(s,e){const t=s.state;if(t?.shape==="array"){const n=Math.min(t.entries.length,e.length);for(let a=0;a<n;a++)Fe(t.entries[a],e[a]);if(e.length<t.entries.length){for(let a=e.length;a<t.entries.length;a++){const i=t.entries[a];i.state&&ae(i.state),i.anchor.remove()}t.entries.length=e.length}else for(let a=t.entries.length;a<e.length;a++){const i=document.createTextNode("");we(s,[i]);const r={anchor:i,state:null};Fe(r,e[a]),t.entries.push(r)}return}t&&ae(t);const o=[];for(const n of e){const a=document.createTextNode("");we(s,[a]);const i={anchor:a,state:null};Fe(i,n),o.push(i)}s.state={shape:"array",entries:o}}function we(s,e){const t=s.anchor.parentNode;if(t)for(const o of e)t.insertBefore(o,s.anchor)}function ae(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&&(ae(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&&ae(e.state),e.anchor.remove()}function It(s){return s==null||s===!1?"":String(s)}async function es(s){if(s==="")return!1;const e=globalThis.navigator?.clipboard;if(e?.writeText)try{return await e.writeText(s),!0}catch{}return ts(s)}function ts(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 n=!1;try{n=e.execCommand("copy")}catch{n=!1}return t.remove(),o?.focus?.(),n}const os="data-os-mode";function Je(s=typeof document<"u"?document.documentElement:null){return!!s&&s.getAttribute(os)==="mobile"}function ss(s){return s.phone??Je()?C`<os-select | |
| 1 | +var openStationApp_posts=function(dt){"use strict";const os="desktop-mode";function ut(){return window.wp?.i18n}function f(o,e=os){return ut()?.__(o,e)??o}function de(o,e,t,s=os){return ut()?._n(o,e,t,s)??(t===1?o:e)}function W(o,...e){const t=ut()?.sprintf;if(t)return t(o,...e);let s=0;return o.replace(/%(?:(\d+)\$)?[sd]/g,(n,a)=>{const i=a?Number.parseInt(a,10)-1:s++;return String(e[i]??"")})}function C(o,...e){return{__wpdHtml:!0,strings:o,values:e}}function Po(o){return!!o&&o.__wpdHtml===!0}const zo="$$wpd$$",Z=/\$\$wpd\$\$(\d+)\$\$/g,Ro="$$wpd-node$$",No=/^\$\$wpd-node\$\$(\d+)\$\$$/,Do=new Set(["style","script","textarea","title"]);function Oo(o){let e="",t=!1,s=null,n=!1,a=null,i="",r=!1;for(let c=0;c<o.length;c++){const l=o[c];e+=l;for(let d=0;d<l.length;d++){const u=l[d];if(n){l.startsWith("-->",d)&&(n=!1,d+=2);continue}if(a!==null){u==="<"&&l[d+1]==="/"&&l.slice(d+2,d+2+a.length).toLowerCase()===a&&(d+=1+a.length,a=null,t=!0,r=!1,i="");continue}if(s!==null){u===s&&(s=null);continue}if(t){u==='"'||u==="'"?(s=u,r=!1):u===">"?(t=!1,r=!1,Do.has(i)&&(a=i),i=""):r&&(/[a-zA-Z0-9-]/.test(u)?i+=u.toLowerCase():r=!1);continue}if(l.startsWith("<!--",d)){n=!0,d+=3;continue}const h=l[d+1]??"";u==="<"&&/[a-zA-Z/!]/.test(h)&&(t=!0,i="",r=/[a-zA-Z]/.test(h))}c<o.length-1&&(e+=t||n||a!==null?`${zo}${c}$$`:`<!--${Ro}${c}$$-->`)}return e}const ns=new WeakMap;function is(o){const e=ns.get(o);if(e)return e;const t=document.createElement("template");t.innerHTML=Oo(o);const s=[],n=(r,c)=>{if(r.nodeType===Node.ELEMENT_NODE){const u=r;for(const h of Array.from(u.attributes)){const p=h.name,m=h.value,_=p[0];if(Z.test(m))if(Z.lastIndex=0,_==="@"){const g=Z.exec(m);Z.lastIndex=0,s.push({path:c,kind:"event",name:p.slice(1),valueIndex:g?Number(g[1]):0}),u.removeAttribute(p)}else if(_==="."){const g=Z.exec(m);Z.lastIndex=0,s.push({path:c,kind:"prop",name:p.slice(1),valueIndex:g?Number(g[1]):0}),u.removeAttribute(p)}else if(_==="?"){const g=Z.exec(m);Z.lastIndex=0,s.push({path:c,kind:"bool",name:p.slice(1),valueIndex:g?Number(g[1]):0}),u.removeAttribute(p)}else{const g=[],b=[];let v=0,S;for(Z.lastIndex=0;(S=Z.exec(m))!==null;)g.push(m.slice(v,S.index)),b.push(Number(S[1])),v=S.index+S[0].length;g.push(m.slice(v)),s.push({path:c,kind:"attr",name:p,template:g,valueIndices:b}),u.setAttribute(p,"")}}}const l=Array.from(r.childNodes);let d=0;for(let u=0;u<l.length;u++){const h=l[u],p=u+d;if(h.nodeType===Node.COMMENT_NODE){const m=No.exec(h.data);if(m){const _=document.createTextNode("");h.parentNode.replaceChild(_,h),s.push({path:[...c,p],kind:"node",valueIndex:Number(m[1])})}continue}if(h.nodeType===Node.TEXT_NODE){const m=h.textContent||"";if(!Z.test(m)){Z.lastIndex=0;continue}Z.lastIndex=0;const _=h.parentNode;let g=0,b;const v=[],S=[];for(Z.lastIndex=0;(b=Z.exec(m))!==null;){b.index>g&&v.push(document.createTextNode(m.slice(g,b.index)));const T=document.createTextNode("");v.push(T),S.push({path:[...c,p+v.length-1],kind:"node",valueIndex:Number(b[1])}),g=b.index+b[0].length}g<m.length&&v.push(document.createTextNode(m.slice(g)));for(const T of v)_.insertBefore(T,h);_.removeChild(h),d+=v.length-1,s.push(...S)}else n(h,[...c,p])}};n(t.content,[]);const i={template:t,buildParts:r=>{const c=[];for(const l of s){let d=r;for(const u of l.path)d=d.childNodes[u];l.kind==="node"?c.push({kind:"node",valueIndex:l.valueIndex,child:{anchor:d,state:null}}):l.kind==="attr"?c.push({kind:"attr",element:d,name:l.name,template:l.template,valueIndices:l.valueIndices}):l.kind==="event"?c.push({kind:"event",valueIndex:l.valueIndex,element:d,name:l.name}):l.kind==="prop"?c.push({kind:"prop",valueIndex:l.valueIndex,element:d,name:l.name}):l.kind==="bool"&&c.push({kind:"bool",valueIndex:l.valueIndex,element:d,name:l.name})}return c}};return ns.set(o,i),i}const as=new WeakMap;function Ho(o,e){for(const t of o.nodes)if(t.parentNode!==e)return!1;return!0}function ke(o,e){const t=as.get(e);if(t&&t.strings===o.strings&&Ho(t,e)){Xe(t.parts,o.values);return}const s=is(o.strings),n=s.template.content.cloneNode(!0),a=s.buildParts(n),i=Array.from(n.childNodes);for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(n),Xe(a,o.values),as.set(e,{strings:o.strings,parts:a,nodes:i})}function Xe(o,e){for(const t of o)if(t.kind==="node")Ye(t.child,e[t.valueIndex]);else if(t.kind==="attr"){let s=t.template[0];for(let n=0;n<t.valueIndices.length;n++)s+=rs(e[t.valueIndices[n]]),s+=t.template[n+1];s!==t.last&&(t.last=s,s===""?t.element.removeAttribute(t.name):t.element.setAttribute(t.name,s))}else if(t.kind==="event"){const s=e[t.valueIndex];s!==t.current&&(t.current&&t.element.removeEventListener(t.name,t.current),s&&t.element.addEventListener(t.name,s),t.current=s)}else if(t.kind==="prop"){const s=e[t.valueIndex];s!==t.last&&(t.last=s,t.element[t.name]=s)}else if(t.kind==="bool"){const s=!!e[t.valueIndex];s!==t.last&&(t.last=s,s?t.element.setAttribute(t.name,""):t.element.removeAttribute(t.name))}}function Ye(o,e){if(e==null||e===!1){o.state&&(ue(o.state),o.state=null);return}if(Array.isArray(e)){Wo(o,e);return}if(Po(e)){Uo(o,e);return}if(e instanceof Node){qo(o,e);return}Fo(o,rs(e))}function qo(o,e){const t=o.state;t?.shape==="node"&&t.node===e||(t&&ue(t),Me(o,[e]),o.state={shape:"node",node:e})}function Fo(o,e){const t=o.state;if(t?.shape==="text"){t.text!==e&&(t.node.textContent=e,t.text=e);return}t&&ue(t);const s=document.createTextNode(e);Me(o,[s]),o.state={shape:"text",node:s,text:e}}function Uo(o,e){const t=o.state;if(t?.shape==="template"&&t.strings===e.strings){Xe(t.parts,e.values);return}t&&ue(t);const s=is(e.strings),n=s.template.content.cloneNode(!0),a=s.buildParts(n),i=Array.from(n.childNodes);Me(o,[n]),Xe(a,e.values),o.state={shape:"template",strings:e.strings,parts:a,nodes:i}}function Wo(o,e){const t=o.state;if(t?.shape==="array"){const n=Math.min(t.entries.length,e.length);for(let a=0;a<n;a++)Ye(t.entries[a],e[a]);if(e.length<t.entries.length){for(let a=e.length;a<t.entries.length;a++){const i=t.entries[a];i.state&&ue(i.state),i.anchor.remove()}t.entries.length=e.length}else for(let a=t.entries.length;a<e.length;a++){const i=document.createTextNode("");Me(o,[i]);const r={anchor:i,state:null};Ye(r,e[a]),t.entries.push(r)}return}t&&ue(t);const s=[];for(const n of e){const a=document.createTextNode("");Me(o,[a]);const i={anchor:a,state:null};Ye(i,n),s.push(i)}o.state={shape:"array",entries:s}}function Me(o,e){const t=o.anchor.parentNode;if(t)for(const s of e)t.insertBefore(s,o.anchor)}function ue(o){if(o.shape==="text"){o.node.remove();return}if(o.shape==="template"){for(const e of o.parts)e.kind==="node"&&e.child.state&&(ue(e.child.state),e.child.state=null);for(const e of o.nodes)e.parentNode&&e.parentNode.removeChild(e);return}if(o.shape==="node"){o.node.parentNode&&o.node.parentNode.removeChild(o.node);return}for(const e of o.entries)e.state&&ue(e.state),e.anchor.remove()}function rs(o){return o==null||o===!1?"":String(o)}async function ls(o){if(o==="")return!1;const e=globalThis.navigator?.clipboard;if(e?.writeText)try{return await e.writeText(o),!0}catch{}return Vo(o)}function Vo(o){const e=globalThis.document;if(!e?.body||typeof e.execCommand!="function")return!1;const t=e.createElement("textarea");t.value=o,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 s=e.activeElement;t.select();let n=!1;try{n=e.execCommand("copy")}catch{n=!1}return t.remove(),s?.focus?.(),n}const Bo="data-os-mode";function pt(o=typeof document<"u"?document.documentElement:null){return!!o&&o.getAttribute(Bo)==="mobile"}function jo(o){return o.phone??pt()?C`<os-select | |
| 2 | 2 | class="os-app-list__status" |
| 3 | - os-bind=${s.bind} | |
| 4 | - os-action=${s.action} | |
| 5 | - value=${s.value} | |
| 6 | - aria-label=${s.label} | |
| 7 | - >${s.segments.map(t=>C`<os-option value=${t.value}>${t.label}</os-option>`)}</os-select>`:C`<os-segmented | |
| 3 | + os-bind=${o.bind} | |
| 4 | + os-action=${o.action} | |
| 5 | + .value=${o.value} | |
| 6 | + aria-label=${o.label} | |
| 7 | + >${o.segments.map(t=>C`<os-option .value=${t.value}>${t.label}</os-option>`)}</os-select>`:C`<os-segmented | |
| 8 | 8 | class="os-app-list__status" |
| 9 | - os-bind=${s.bind} | |
| 10 | - os-action=${s.action} | |
| 11 | - value=${s.value} | |
| 12 | - label=${s.label} | |
| 13 | - >${s.segments.map(t=>C`<os-segment value=${t.value}>${t.label}</os-segment>`)}</os-segmented>`}function ns(s){const e=Math.max(1,s.page),t=Math.max(0,s.pages),o=Number(s.perPage)||20,n=s.pageAction??"page",a=s.perPageOptions??[10,20,50,100];return C`<footer class="os-app-list__pager"> | |
| 14 | - <div class="os-app-list__pager-meta"> | |
| 15 | - <span>${s.summary}</span> | |
| 16 | - </div> | |
| 17 | - <div class="os-app-list__pager-nav"> | |
| 18 | - <os-button | |
| 19 | - variant="ghost" | |
| 20 | - os-action=${n} | |
| 21 | - os-arg-page=${e-1} | |
| 22 | - ?disabled=${e<=1} | |
| 23 | - > | |
| 24 | - <span class="dashicons dashicons-arrow-left-alt2" aria-hidden="true"></span> | |
| 25 | - ${s.labels.previous} | |
| 26 | - </os-button> | |
| 27 | - <os-button | |
| 28 | - variant="ghost" | |
| 29 | - os-action=${n} | |
| 30 | - os-arg-page=${e+1} | |
| 31 | - ?disabled=${e>=t} | |
| 32 | - > | |
| 33 | - ${s.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 | - ${s.labels.perPage} | |
| 38 | - <os-select | |
| 39 | - os-bind=${s.perPageBind??"perPage"} | |
| 40 | - os-action=${s.perPageAction??"filter"} | |
| 41 | - value=${String(o)} | |
| 42 | - aria-label=${s.labels.perPage} | |
| 43 | - >${a.map(i=>C`<os-option value=${i}>${i}</os-option>`)}</os-select> | |
| 44 | - </label> | |
| 45 | - </div> | |
| 46 | - </footer>`}function is(s,e){const o=s.closest(".os-window")?.querySelector(".os-window__menu-panel")??null;if(!o||e.items.length===0)return null;const n=`${e.prefix}:`,a="data-os-app-menu-section";o.querySelectorAll(`[${a}="${e.prefix}"]`).forEach(u=>u.remove());const i=document.createElement("div");i.className="os-app__menu-section",i.setAttribute("role","presentation"),i.setAttribute(a,e.prefix),i.textContent=e.section,o.appendChild(i);const r=new Map;for(const u of e.items){const d=document.createElement("os-menu-item");d.setAttribute("role","menuitemcheckbox"),d.setAttribute("value",n+u.key),d.setAttribute(a,e.prefix),d.classList.add("os-window__menu-item","os-app__menu-item"),d.textContent=u.label||u.key,o.appendChild(d),r.set(u.key,d)}const l=()=>{for(const[u,d]of r)e.isChecked(u)?d.setAttribute("checked",""):d.removeAttribute("checked")};l();const c=u=>{const d=u.detail?.value;if(typeof d!="string"||!d.startsWith(n))return;const h=d.slice(n.length);r.has(h)&&(e.onToggle(h),l())};return o.addEventListener("os-menu-item-click",c),{refresh:l,dispose:()=>{o.removeEventListener("os-menu-item-click",c),i.remove();for(const u of r.values())u.remove();r.clear()}}}function as(s,e=null){const t=e??(typeof document<"u"?document.documentElement:null);if(!!t&&Je(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 n=s.getAttribute("data-os-sticky-columns");return n!==null&&(s.setAttribute("sticky-columns",n),s.removeAttribute("data-os-sticky-columns")),!1}function Rt(s){return Array.from(s.selection??[],String)}function rs(){let s=null,e=!1,t=null,o=null;return{invalidateColumns(){s=null},invalidateData(){o=null},sync(n){const a={phone:!1,columnsChanged:!1,dataChanged:!1,selectionChanged:!1},i=n.table;if(!i)return a;const r=n.rowId??(c=>c.id),l=as(i);if(a.phone=l,l!==s&&(s=l,i.columns=n.columns(l),a.columnsChanged=!0),e||(e=!0,n.wire?.(i)),n.listKey!==t&&(t=n.listKey,Rt(i).length>0&&(i.clearSelection(),a.selectionChanged=!0,n.onSelection?.([]))),n.fingerprint!==o){o=n.fingerprint,i.data=n.rows,a.dataChanged=!0;const c=new Set(n.rows.map(h=>String(r(h)))),u=Rt(i),d=u.filter(h=>c.has(h));d.length!==u.length&&(i.selection=d,a.selectionChanged=!0,n.onSelection?.(d))}return a}}}function ls(s,e){const t=e.local??{},o={id:s,hasLocal:i=>Object.prototype.hasOwnProperty.call(t,i),runLocal:(i,r,l,c)=>{const u=t[i];if(!u)return r;const d={...r},h=u(d,l,c);return h===void 0?d:h},render:i=>{xe(e.view(i),i.root),e.updated?.(i)},mounted:i=>e.mounted?.(i)},{placeholder:n}=e;n&&(o.placeholder=i=>n(i));const a=window;return(a.openStationApps??(a.openStationApps={}))[s]=o,o}const et=new Map;async function cs(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=et.get(t);if(o!==void 0)return o instanceof Promise,o;const n=new URL(s,window.location.href);n.searchParams.set("d","blank");const a=new Promise(i=>{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){i(s);return}c.drawImage(r,0,0,1,1);const u=c.getImageData(0,0,1,1).data;i(u[3]===0?null:s)}catch{i(s)}},r.onerror=()=>i(null),r.src=n.toString()}).then(i=>(et.set(t,i),i));return et.set(t,a),a}function ds(s){return s?.["48"]??s?.["96"]??s?.["24"]??""}function us(s,e){e&&cs(e).then(t=>{s.isConnected&&(t?s.setAttribute("src",t):s.removeAttribute("src"))})}function zt(s){const e=document.createElement("textarea");return e.innerHTML=s,e.value}const ce=class ce 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(Nt)}connectedCallback(){this._adoptStyles(),this.requestUpdate()}attributeChangedCallback(e,t,o){if(t===o)return;const n=hs(e);this._propValues[n]=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(n=>String(n).trim()).filter(n=>n!=="");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=Nt(t);Object.defineProperty(this,t,{get:()=>t in this._propValues?this._propValues[t]:this.getAttribute(o),set:n=>{let a;n==null||n===!1?a=null:n===!0?a="":a=String(n),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&&xe(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 n=document.createElement("style");n.textContent=o.cssText,this.shadowRoot.appendChild(n)}}}else this._adoptLightStyles(e)}_adoptLightStyles(e){if(!ce._lightStylesAdopted.has(e)){ce._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)}}}};ce.props=[],ce.styles=[],ce.shadow=!0,ce._lightStylesAdopted=new WeakSet;let G=ce;function Q(s,e){customElements.get(s)||customElements.define(s,e)}function Nt(s){return s.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function hs(s){return s.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}const ps=(()=>{try{return typeof new CSSStyleSheet().replaceSync=="function"}catch{return!1}})();function q(s,...e){let t=s[0];for(let o=1;o<s.length;o++){const n=e[o-1];if(typeof n=="string"||typeof n=="number")t+=String(n);else if(n&&n.__wpdCss)t+=n.cssText;else throw new TypeError("[os-ui] css`` interpolations must be strings, numbers, or other css`` results. Got: "+typeof n);t+=s[o]}if(ps){const o=new CSSStyleSheet;return o.replaceSync(t),{__wpdCss:!0,sheet:o,cssText:t}}return{__wpdCss:!0,sheet:null,cssText:t}}function fs(s){const e=[],t=[];let o=null,n=s.parentElement;for(;n&&!(n===document.body||n===document.documentElement);){const i=n.id||"";if(i.startsWith("wp-window-")){o=i.slice(10);break}if(n.tagName.toLowerCase()==="os-tabpanel"){const r=n.getAttribute("for");r&&t.unshift(r)}n=n.parentElement}o&&e.push(tt(o));for(const i of t)e.push("tab-"+tt(i));const a=s.getAttribute("label");return a&&e.push(tt(a)),e.length===0?"os-unnamed":"os-"+e.filter(i=>i!=="").join("-")}function tt(s){return s.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Dt(s){if(s.id)return s.id;const e=fs(s);return s.id=e,e}function gs(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 ms=q`: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}}`,Ot={xs:20,sm:24,md:40,lg:64,xl:96},Ht=new Set(["online","inactive","offline"]),Te=class Te extends G{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"),n=o!==null?o:t,a=this._attr("size"),i=this._resolveSize(a),r=this._presenceForRender(),l=this._attr("clickable")!==null;this.style.setProperty("--os-ui-avatar-size",`${i}px`);const c=e&&!this._imgFailed?"":this._initialsBg(t),u=e&&!this._imgFailed?C`<img | |
| 9 | + os-bind=${o.bind} | |
| 10 | + os-action=${o.action} | |
| 11 | + value=${o.value} | |
| 12 | + label=${o.label} | |
| 13 | + >${o.segments.map(t=>C`<os-segment value=${t.value}>${t.label}</os-segment>`)}</os-segmented>`}function Ko(o,e){const s=o.closest(".os-window")?.querySelector(".os-window__menu-panel")??null;if(!s||e.items.length===0)return null;const n=`${e.prefix}:`,a="data-os-app-menu-section";s.querySelectorAll(`[${a}="${e.prefix}"]`).forEach(d=>d.remove());const i=document.createElement("div");i.className="os-app__menu-section",i.setAttribute("role","presentation"),i.setAttribute(a,e.prefix),i.textContent=e.section,s.appendChild(i);const r=new Map;for(const d of e.items){const u=document.createElement("os-menu-item");u.setAttribute("role","menuitemcheckbox"),u.setAttribute("value",n+d.key),u.setAttribute(a,e.prefix),u.classList.add("os-window__menu-item","os-app__menu-item"),u.textContent=d.label||d.key,s.appendChild(u),r.set(d.key,u)}const c=()=>{for(const[d,u]of r)e.isChecked(d)?u.setAttribute("checked",""):u.removeAttribute("checked")};c();const l=d=>{const u=d.detail?.value;if(typeof u!="string"||!u.startsWith(n))return;const h=u.slice(n.length);r.has(h)&&(e.onToggle(h),c())};return s.addEventListener("os-menu-item-click",l),{refresh:c,dispose:()=>{s.removeEventListener("os-menu-item-click",l),i.remove();for(const d of r.values())d.remove();r.clear()}}}function Go(o,e=null){const t=e??(typeof document<"u"?document.documentElement:null);if(!!t&&pt(t)){o.hasAttribute("stacked")||o.setAttribute("stacked","");const a=o.getAttribute("sticky-columns");return a!==null&&(o.setAttribute("data-os-sticky-columns",a),o.removeAttribute("sticky-columns")),!0}o.hasAttribute("stacked")&&o.removeAttribute("stacked");const n=o.getAttribute("data-os-sticky-columns");return n!==null&&(o.setAttribute("sticky-columns",n),o.removeAttribute("data-os-sticky-columns")),!1}function cs(o){return Array.from(o.selection??[],String)}function Xo(){let o=null,e=!1,t=null,s=null;return{invalidateColumns(){o=null},invalidateData(){s=null},sync(n){const a={phone:!1,columnsChanged:!1,dataChanged:!1,selectionChanged:!1},i=n.table;if(!i)return a;const r=n.rowId??(l=>l.id),c=Go(i);if(a.phone=c,c!==o&&(o=c,i.columns=n.columns(c),a.columnsChanged=!0),e||(e=!0,n.wire?.(i)),n.listKey!==t&&(t=n.listKey,cs(i).length>0&&(i.clearSelection(),a.selectionChanged=!0,n.onSelection?.([]))),n.fingerprint!==s){s=n.fingerprint,i.data=n.rows,a.dataChanged=!0;const l=new Set(n.rows.map(h=>String(r(h)))),d=cs(i),u=d.filter(h=>l.has(h));u.length!==d.length&&(i.selection=u,a.selectionChanged=!0,n.onSelection?.(u))}return a}}}function Yo(o,e){const t=e.local??{},s={id:o,hasLocal:i=>Object.prototype.hasOwnProperty.call(t,i),runLocal:(i,r,c,l)=>{const d=t[i];if(!d)return r;const u={...r},h=d(u,c,l);return h===void 0?u:h},render:i=>{ke(e.view(i),i.root),e.updated?.(i)},mounted:i=>e.mounted?.(i)},{placeholder:n}=e;n&&(s.placeholder=i=>n(i));const a=window;return(a.openStationApps??(a.openStationApps={}))[o]=s,s}const Zo=250,ds=window.location.origin;let us=0;function Jo(o,{timeoutMs:e=Zo}={}){const t=o?.contentWindow;if(!t)return Promise.resolve(!1);us+=1;const s=`os-unsaved-guard-${Date.now()}-${us}`;return new Promise(n=>{let a=null,i=!1;const r=l=>{i||(i=!0,window.removeEventListener("message",c),a!==null&&window.clearTimeout(a),n(l))},c=l=>{if(l.origin!==ds)return;const d=l?.data;!d||typeof d!="object"||d.type!=="os-bridge-beforeunload-response"||d.requestId!==s||r(d.prevent===!0)};window.addEventListener("message",c),a=window.setTimeout(()=>r(!1),e);try{t.postMessage({type:"os-bridge-beforeunload-query",requestId:s},ds)}catch{r(!1)}})}class Qo 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 ps(o){return o instanceof Qo}const en="rest_cookie_invalid_nonce",hs=()=>f("Could not reach the site. Check your connection and try again.","desktop-mode");function fs(o){return typeof navigator<"u"&&navigator.onLine===!1?!0:o instanceof TypeError}function tn(o){return ps(o)?o.code===en||o.status===401?"session":o.status>=200&&o.status<300?"unreadable":o.status===404?"gone":o.status>=500?"server":o.status>=400?"refused":"unknown":fs(o)?"offline":"unknown"}function sn(o){return ps(o)?o.serverMessage:fs(o)?hs():o instanceof Error?o.message:""}function on(o,e){const{fallback:t,lead:s}=e,n=tn(o),a=n==="offline"||n==="unreadable"?"warning":"error";let i="",r=!0;switch(n){case"offline":i=hs();break;case"session":i=f("Your session has expired. Reload the page and try again.","desktop-mode");break;case"unreadable":i=f("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 l=o;l.serverMessage?i=l.serverMessage:n==="gone"?(i=f("It no longer exists. Reload the page to catch up.","desktop-mode"),r=!1):n==="server"?(i=W(f("The server answered with error %d.","desktop-mode"),l.status),r=!1):(i=W(f("The server refused the request (HTTP %d).","desktop-mode"),l.status),r=!1);break}case"unknown":default:i=sn(o);break}let c;return s?c=i?`${s}: ${i}`:t:i?r?c=i:c=`${t} ${i}`:c=t,{message:c,reason:i,kind:n,type:a}}function nn(o,e,t){if(!o)return;const{duration:s,...n}=t,a=on(e,n),i={message:a.message,type:a.type};s&&(i.duration=s),o(i)}const ht=new Map;async function an(o){if(!o)return null;let e;try{e=new URL(o,window.location.href)}catch{return o}if(!/gravatar\.com$/i.test(e.hostname))return o;e.searchParams.delete("d"),e.searchParams.delete("s");const t=e.toString(),s=ht.get(t);if(s!==void 0)return s instanceof Promise,s;const n=new URL(o,window.location.href);n.searchParams.set("d","blank");const a=new Promise(i=>{const r=new Image;r.crossOrigin="anonymous",r.onload=()=>{try{const c=document.createElement("canvas");c.width=1,c.height=1;const l=c.getContext("2d",{willReadFrequently:!0});if(!l){i(o);return}l.drawImage(r,0,0,1,1);const d=l.getImageData(0,0,1,1).data;i(d[3]===0?null:o)}catch{i(o)}},r.onerror=()=>i(null),r.src=n.toString()}).then(i=>(ht.set(t,i),i));return ht.set(t,a),a}function rn(o){return o?.["48"]??o?.["96"]??o?.["24"]??""}function ln(o,e){e&&an(e).then(t=>{o.isConnected&&(t?o.setAttribute("src",t):o.removeAttribute("src"))})}function pe(o){const e=document.createElement("textarea");return e.innerHTML=o,e.value}const ge=class ge 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(gs)}connectedCallback(){this._adoptStyles(),this.requestUpdate()}attributeChangedCallback(e,t,s){if(t===s)return;const n=cn(e);this._propValues[n]=s,this.requestUpdate()}get classNames(){return Array.from(this.classList)}set classNames(e){if(e==null){this.removeAttribute("class");return}const s=(Array.isArray(e)?e:String(e).split(/\s+/)).map(n=>String(n).trim()).filter(n=>n!=="");this.className=s.join(" ")}requestUpdate(){this._scheduleRender()}emit(e,t){return this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}_installPropAccessors(){const e=this.constructor;for(const t of e.props){if(Object.getOwnPropertyDescriptor(this,t))continue;const s=gs(t);Object.defineProperty(this,t,{get:()=>t in this._propValues?this._propValues[t]:this.getAttribute(s),set:n=>{let a;n==null||n===!1?a=null:n===!0?a="":a=String(n),this._propValues[t]=a,a===null?this.removeAttribute(s):this.setAttribute(s,a),this.requestUpdate()},enumerable:!0,configurable:!0})}}_scheduleRender(){this._renderScheduled||!this.isConnected||(this._renderScheduled=!0,queueMicrotask(()=>{this._renderScheduled=!1,this.isConnected&&ke(this.render(),this._renderRoot)}))}_adoptStyles(){const e=this.constructor;if(e.styles.length!==0)if(e.shadow&&this.shadowRoot){const t=e.styles.map(s=>s.sheet).filter(s=>s!==null);if(this.shadowRoot.adoptedStyleSheets=t,t.length!==e.styles.length){for(const s of e.styles)if(!s.sheet){const n=document.createElement("style");n.textContent=s.cssText,this.shadowRoot.appendChild(n)}}}else this._adoptLightStyles(e)}_adoptLightStyles(e){if(!ge._lightStylesAdopted.has(e)){ge._lightStylesAdopted.add(e);for(const t of e.styles){const s=document.createElement("style");s.dataset.osUi=this.tagName.toLowerCase(),s.textContent=t.cssText,document.head.appendChild(s)}}}};ge.props=[],ge.styles=[],ge.shadow=!0,ge._lightStylesAdopted=new WeakSet;let X=ge;function Q(o,e){customElements.get(o)||customElements.define(o,e)}function gs(o){return o.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function cn(o){return o.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}const dn=(()=>{try{return typeof new CSSStyleSheet().replaceSync=="function"}catch{return!1}})();function F(o,...e){let t=o[0];for(let s=1;s<o.length;s++){const n=e[s-1];if(typeof n=="string"||typeof n=="number")t+=String(n);else if(n&&n.__wpdCss)t+=n.cssText;else throw new TypeError("[os-ui] css`` interpolations must be strings, numbers, or other css`` results. Got: "+typeof n);t+=o[s]}if(dn){const s=new CSSStyleSheet;return s.replaceSync(t),{__wpdCss:!0,sheet:s,cssText:t}}return{__wpdCss:!0,sheet:null,cssText:t}}function un(o){const e=[],t=[];let s=null,n=o.parentElement;for(;n&&!(n===document.body||n===document.documentElement);){const i=n.id||"";if(i.startsWith("wp-window-")){s=i.slice(10);break}if(n.tagName.toLowerCase()==="os-tabpanel"){const r=n.getAttribute("for");r&&t.unshift(r)}n=n.parentElement}s&&e.push(ft(s));for(const i of t)e.push("tab-"+ft(i));const a=o.getAttribute("label");return a&&e.push(ft(a)),e.length===0?"os-unnamed":"os-"+e.filter(i=>i!=="").join("-")}function ft(o){return o.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function gt(o){if(o.id)return o.id;const e=un(o);return o.id=e,e}function pn(o){if(!o)return 214;let e=5381;for(let t=0;t<o.length;t++)e=Math.imul(e,33)+o.charCodeAt(t);return(e%360+360)%360}const hn=F`: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}}`,ms={xs:20,sm:24,md:40,lg:64,xl:96},bs=new Set(["online","inactive","offline"]),Re=class Re extends X{constructor(){super(...arguments),this._presenceHandler=null,this._imgFailed=!1,this._onPointerMove=null,this._onPointerEnter=null,this._onPointerLeave=null,this._tiltRaf=0,this._pendingTiltX="0deg",this._pendingTiltY="0deg",this._pendingGlareX="50%",this._pendingGlareY="50%"}connectedCallback(){super.connectedCallback(),this._maybeAttachPresenceListener(),this._attachHoverEffect()}disconnectedCallback(){this._presenceHandler&&(document.removeEventListener("os-presence-changed",this._presenceHandler),this._presenceHandler=null),this._detachHoverEffect()}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e==="src"&&(this._imgFailed=!1),(e==="user-id"||e==="presence")&&this._maybeAttachPresenceListener()}render(){const e=this._attr("src"),t=this._attr("name")||"",s=this._attr("alt"),n=s!==null?s:t,a=this._attr("size"),i=this._resolveSize(a),r=this._presenceForRender(),c=this._attr("clickable")!==null;this.style.setProperty("--os-ui-avatar-size",`${i}px`);const l=e&&!this._imgFailed?"":this._initialsBg(t),d=e&&!this._imgFailed?C`<img | |
| 47 | 14 | src=${e} |
| 48 | 15 | alt=${n} |
| 49 | 16 | @error=${()=>this._onImgError()} |
| 50 | 17 | loading="lazy" |
| 51 | - />`:this._initials(t),d=r?C`<span | |
| 18 | + />`:this._initials(t),u=r?C`<span | |
| 52 | 19 | class=${`os-avatar__dot os-avatar__dot--${r}`} |
| 53 | 20 | aria-label=${this._presenceLabel(r)} |
| 54 | - ></span>`:C``;return l?C` | |
| 21 | + ></span>`:C``;return c?C` | |
| 55 | 22 | <button |
| 56 | 23 | type="button" |
| 57 | 24 | class="os-avatar__tile" |
| 58 | 25 | aria-label=${n||"User"} |
| 59 | - style=${c?`background:${c};`:""} | |
| 26 | + style=${l?`background:${l};`:""} | |
| 60 | 27 | @click=${h=>this._onClick(h)} |
| 61 | - >${u}</button> | |
| 62 | - ${d} | |
| 28 | + >${d}</button> | |
| 29 | + ${u} | |
| 63 | 30 | `:C` |
| 64 | 31 | <div |
| 65 | 32 | class="os-avatar__tile" |
| 66 | 33 | role="img" |
| 67 | 34 | aria-label=${n||"User"} |
| 68 | - style=${c?`background:${c};`:""} | |
| 69 | - >${u}</div> | |
| 70 | - ${d} | |
| 71 | - `}_attr(e){return this.getAttribute(e)}_resolveSize(e){if(!e)return 32;if(e in Ot)return Ot[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=gs(e);return`linear-gradient(135deg, hsl(${t} 62% 55%), hsl(${(t+24)%360} 58% 42%))`}_presenceForRender(){const e=this._attr("presence");return e&&Ht.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 n=(t.clientX-o.left)/o.width-.5,a=(t.clientY-o.top)/o.height-.5,i=14;this._pendingTiltY=`${(n*i).toFixed(2)}deg`,this._pendingTiltX=`${(-a*i).toFixed(2)}deg`;const r=Math.max(0,Math.min(100,(n+.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=n=>{const a=n.detail;a&&String(a.userId)===String(e)&&a.newStatus&&Ht.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)}};Te.props=["src","alt","name","size","presence","userId","clickable"],Te.styles=[ms],Te.help=void 0;let ot=Te;Q("os-avatar",ot);const bs=q`:host{display:inline;color:inherit;font:inherit}`,qe=new Set;let ke=null;const _s=3e4;function vs(){ke===null&&(ke=window.setInterval(()=>{for(const s of qe)s.tick()},_s))}function ys(){ke!==null&&qe.size===0&&(window.clearInterval(ke),ke=null)}function xs(s){if(!s)return null;const e=t=>{const o=new Date(t);return Number.isNaN(o.getTime())?null:o};return ws(s)?e(s):e(s.replace(" ","T")+"Z")}function ws(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 st=null,nt=null;function Ft(){return typeof navigator<"u"&&navigator.language||"en"}function ks(){return st||(st=new Intl.RelativeTimeFormat(Ft(),{numeric:"auto"})),st}function qt(){return nt||(nt=new Intl.RelativeTimeFormat(Ft(),{numeric:"always",style:"narrow"})),nt}function Cs(s,e){const t=ks(),o=s.getTime()-e,n=Math.round(o/1e3),a=Math.abs;return a(n)<45?t.format(0,"second"):Ut(t,n)}function Ut(s,e){const t=Math.abs,o=Math.round(e/60);if(t(o)<45)return s.format(o,"minute");const n=Math.round(o/60);if(t(n)<22)return s.format(n,"hour");const a=Math.round(n/24);if(t(a)<26)return s.format(a,"day");const i=Math.round(a/30);if(t(i)<11)return s.format(i,"month");const r=Math.round(a/365);return s.format(r,"year")}function Ss(s,e){const t=Math.round((s.getTime()-e)/1e3),o=Math.abs;return o(t)<45?qt().format(0,"second"):o(t)>604800?s.toLocaleDateString(void 0,{month:"short",day:"numeric"}):Ut(qt(),t)}const Pe=class Pe extends G{connectedCallback(){super.connectedCallback(),qe.add(this),vs()}disconnectedCallback(){qe.delete(this),ys()}tick(){this.requestUpdate()}render(){const e=this.datetime,t=xs(e);if(!t)return C`<span>${e??""}</span>`;const o=Date.now(),n=this.hasAttribute("compact")?Ss(t,o):Cs(t,o),a=t.toLocaleString();return C`<time datetime=${t.toISOString()} title=${a} | |
| 35 | + style=${l?`background:${l};`:""} | |
| 36 | + >${d}</div> | |
| 37 | + ${u} | |
| 38 | + `}_attr(e){return this.getAttribute(e)}_resolveSize(e){if(!e)return 32;if(e in ms)return ms[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=pn(e);return`linear-gradient(135deg, hsl(${t} 62% 55%), hsl(${(t+24)%360} 58% 42%))`}_presenceForRender(){const e=this._attr("presence");return e&&bs.has(e)?e:null}_presenceLabel(e){switch(e){case"online":return"Online";case"inactive":return"Inactive";case"offline":return"Offline"}}_onImgError(){this._imgFailed=!0,this.requestUpdate()}_onClick(e){const t=this._attr("user-id"),s={userId:t!==null&&Number(t)||null,originalEvent:e};this.emit("os-avatar-click",s)}_attachHoverEffect(){typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches||(this._onPointerEnter=()=>{this.style.setProperty("--os-ui-avatar-hover","1")},this._onPointerLeave=()=>{this.style.setProperty("--os-ui-avatar-hover","0"),this._pendingTiltX="0deg",this._pendingTiltY="0deg",this._pendingGlareX="50%",this._pendingGlareY="50%",this._flushTilt()},this._onPointerMove=t=>{const s=this.getBoundingClientRect();if(s.width===0||s.height===0)return;const n=(t.clientX-s.left)/s.width-.5,a=(t.clientY-s.top)/s.height-.5,i=14;this._pendingTiltY=`${(n*i).toFixed(2)}deg`,this._pendingTiltX=`${(-a*i).toFixed(2)}deg`;const r=Math.max(0,Math.min(100,(n+.5)*100)),c=Math.max(0,Math.min(100,(a+.5)*100));this._pendingGlareX=`${r.toFixed(1)}%`,this._pendingGlareY=`${c.toFixed(1)}%`,this._tiltRaf||(this._tiltRaf=requestAnimationFrame(()=>this._flushTilt()))},this.addEventListener("pointerenter",this._onPointerEnter),this.addEventListener("pointerleave",this._onPointerLeave),this.addEventListener("pointermove",this._onPointerMove))}_flushTilt(){this._tiltRaf=0,this.style.setProperty("--os-ui-avatar-tilt-x",this._pendingTiltX),this.style.setProperty("--os-ui-avatar-tilt-y",this._pendingTiltY),this.style.setProperty("--os-ui-avatar-glare-x",this._pendingGlareX),this.style.setProperty("--os-ui-avatar-glare-y",this._pendingGlareY)}_detachHoverEffect(){this._onPointerMove&&(this.removeEventListener("pointermove",this._onPointerMove),this._onPointerMove=null),this._onPointerEnter&&(this.removeEventListener("pointerenter",this._onPointerEnter),this._onPointerEnter=null),this._onPointerLeave&&(this.removeEventListener("pointerleave",this._onPointerLeave),this._onPointerLeave=null),this._tiltRaf&&(cancelAnimationFrame(this._tiltRaf),this._tiltRaf=0)}_maybeAttachPresenceListener(){const e=this._attr("user-id"),t=this._attr("presence"),s=!!e&&!t;s&&!this._presenceHandler?(this._presenceHandler=n=>{const a=n.detail;a&&String(a.userId)===String(e)&&a.newStatus&&bs.has(a.newStatus)&&this.setAttribute("presence",a.newStatus)},document.addEventListener("os-presence-changed",this._presenceHandler)):!s&&this._presenceHandler&&(document.removeEventListener("os-presence-changed",this._presenceHandler),this._presenceHandler=null)}};Re.props=["src","alt","name","size","presence","userId","clickable"],Re.styles=[hn],Re.help=void 0;let mt=Re;Q("os-avatar",mt);const fn=F`:host{display:inline;color:inherit;font:inherit}`,Ze=new Set;let Ie=null;const gn=3e4;function mn(){Ie===null&&(Ie=window.setInterval(()=>{for(const o of Ze)o.tick()},gn))}function bn(){Ie!==null&&Ze.size===0&&(window.clearInterval(Ie),Ie=null)}function _n(o){if(!o)return null;const e=t=>{const s=new Date(t);return Number.isNaN(s.getTime())?null:s};return vn(o)?e(o):e(o.replace(" ","T")+"Z")}function vn(o){const e=Math.max(o.indexOf("T"),o.indexOf(" ")),t=e===-1?"":o.slice(e+1);return/(?:[Zz]|[+-]\d{2}:?\d{2})$/.test(t)}let bt=null,_t=null;function _s(){return typeof navigator<"u"&&navigator.language||"en"}function yn(){return bt||(bt=new Intl.RelativeTimeFormat(_s(),{numeric:"auto"})),bt}function vs(){return _t||(_t=new Intl.RelativeTimeFormat(_s(),{numeric:"always",style:"narrow"})),_t}function xn(o,e){const t=yn(),s=o.getTime()-e,n=Math.round(s/1e3),a=Math.abs;return a(n)<45?t.format(0,"second"):ys(t,n)}function ys(o,e){const t=Math.abs,s=Math.round(e/60);if(t(s)<45)return o.format(s,"minute");const n=Math.round(s/60);if(t(n)<22)return o.format(n,"hour");const a=Math.round(n/24);if(t(a)<26)return o.format(a,"day");const i=Math.round(a/30);if(t(i)<11)return o.format(i,"month");const r=Math.round(a/365);return o.format(r,"year")}function kn(o,e){const t=Math.round((o.getTime()-e)/1e3),s=Math.abs;return s(t)<45?vs().format(0,"second"):s(t)>604800?o.toLocaleDateString(void 0,{month:"short",day:"numeric"}):ys(vs(),t)}const Ne=class Ne extends X{connectedCallback(){super.connectedCallback(),Ze.add(this),mn()}disconnectedCallback(){Ze.delete(this),bn()}tick(){this.requestUpdate()}render(){const e=this.datetime,t=_n(e);if(!t)return C`<span>${e??""}</span>`;const s=Date.now(),n=this.hasAttribute("compact")?kn(t,s):xn(t,s),a=t.toLocaleString();return C`<time datetime=${t.toISOString()} title=${a} | |
| 72 | 39 | >${n}</time |
| 73 | - >`}};Pe.props=["datetime","compact"],Pe.styles=[bs],Pe.help=void 0;let it=Pe;Q("os-relative-time",it);function se(s,e,t,o){const n=`${e}|${t}`,a=s.get(n);if(a)return a;const i=o();return s.set(n,i),i}const $s={publish:m("Published"),future:m("Scheduled"),draft:m("Draft"),pending:m("Pending"),private:m("Private"),trash:m("Trash")};function Es(s){switch(s){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 As(s,e){const t=s.editPostUrlBase??"",o=t.includes("?")?"&":"?";return`${t}${o}post=${e}&action=edit`}function Ts(s){const e=s._embedded?.author?.[0];return e?{id:e.id,name:e.name,avatar:ds(e.avatar_urls)||void 0}:{id:s.author,name:m("Unknown")}}function Wt(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 Ps(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 Vt(s){return zt(s.title.rendered)}function Ue(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 n=document.createElement("span");return n.textContent=s,o.appendChild(n),t.title&&(o.title=t.title),o}function Bt(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 Ms(){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 jt(s){s.addEventListener("mouseenter",()=>{s.style.textDecoration="underline"}),s.addEventListener("mouseleave",()=>{s.style.textDecoration="none"})}function Ls(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 n=document.createElement("a");n.href=As(e.extra,s.id),n.setAttribute("data-noclick","");const a=Vt(s)||m("(no title)");n.textContent=a,n.title=a,n.style.cssText="font-weight:600;color:inherit;text-decoration:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:340px;",jt(n),n.addEventListener("click",l=>{l.preventDefault(),l.stopPropagation(),e.openUrl(n.href,a,"dashicons-admin-post")}),o.appendChild(n);const i=s.openstation_lock??null;i&&o.appendChild(Ue(i.userName,{fg:"#b32d2e",bg:"rgba(179, 45, 46, 0.1)"},{icon:Ms(),title:V(m("%s is currently editing"),i.userName)}));const r=e.extra.mode==="pages";if(r&&typeof e.extra.frontPageId=="number"&&e.extra.frontPageId===s.id&&o.appendChild(Ue(m("Front page"),{fg:"#0a4b78",bg:"rgba(34,113,177,0.12)"},{icon:Bt("dashicons-admin-home")})),r&&typeof e.extra.postsPageId=="number"&&e.extra.postsPageId===s.id&&o.appendChild(Ue(m("Posts page"),{fg:"#5b3aa0",bg:"rgba(91,58,160,0.12)"},{icon:Bt("dashicons-admin-post")})),s.status&&s.status!=="publish"&&o.appendChild(Ue($s[s.status]??s.status,Es(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=m("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()),jt(l),o.appendChild(l)}return t.appendChild(o),t}function Is(s){const e=Ts(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&&us(o,e.avatar),t.appendChild(o);const n=document.createElement("span");return n.textContent=e.name,n.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;",t.appendChild(n),t}function Rs(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=m("modified"),o.style.cssText="font-size:11px;color:#646970;",e.appendChild(o)}return e}function zs(s){const e=document.createElement("div");e.style.cssText="display:flex;gap:16px;padding:12px 16px;background:#fafafa;align-items:flex-start;";const t=Ps(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 n=document.createElement("div");n.style.cssText="font-size:13px;color:#646970;text-transform:uppercase;letter-spacing:0.04em;",n.textContent=m("Excerpt"),o.appendChild(n);const a=document.createElement("div");a.style.cssText="color:#1d2327;line-height:1.5;";const i=s.excerpt?.rendered??"";return i?a.textContent=zt(i.replace(/<[^>]+>/g,"").trim())||m("(no excerpt)"):(a.textContent=m("(no excerpt)"),a.style.color="#a7aaad"),o.appendChild(a),e.appendChild(o),e}const Xt={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 Gt(s){return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Ns(s){return Object.prototype.hasOwnProperty.call(Xt,s)?Xt[s]:null}function Ds(s,e={}){const t=Ns(s);if(!t)return"";const{size:o=24,className:n,title:a,rotate:i}=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),n&&r.push(`class="${Gt(n)}"`),a?r.push('role="img"',`aria-label="${Gt(a)}"`):r.push('aria-hidden="true"','focusable="false"');const l=i?`<g transform="rotate(${i} 12 12)">${t.b}</g>`:t.b;return`<svg ${r.join(" ")}>${l}</svg>`}function J(s,e={}){const t=Ds(s,e),o=document.createElement("div");o.innerHTML=t;const n=o.firstElementChild;return n instanceof SVGSVGElement?n:document.createElementNS("http://www.w3.org/2000/svg","svg")}const Os=q`: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}`,We=q`: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 ) )}`,Hs=q` .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%}}`,Fs=q` .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%}}`,qs=q` .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}}`,Us=q` .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}}`,Ws=q` .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}}`,Vs=q` .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%}}`,Bs=q` .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}}`,js=q` 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}}`,Kt=q` 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}}`,Xs=q` @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}}`;q` ${We} ${Hs} ${Fs} ${qs} ${Us} ${Ws} ${Vs} ${Bs} ${js} ${Kt} ${Xs} `;const Gs=q` ${We}: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}`,Me=class Me extends G{constructor(){super(...arguments),this._onHostKeyDown=e=>{if(this.dismissible!==null&&(e.key==="Backspace"||e.key==="Delete")){if(e.preventDefault(),this.disabled!==null)return;const n=this.label??"";this.emit("os-chip-dismiss",{label:n})}}}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 C` | |
| 40 | + >`}};Ne.props=["datetime","compact"],Ne.styles=[fn],Ne.help=void 0;let vt=Ne;Q("os-relative-time",vt);function re(o,e,t,s){const n=`${e}|${t}`,a=o.get(n);if(a)return a;const i=s();return o.set(n,i),i}const xs={publish:f("Published"),future:f("Scheduled"),draft:f("Draft"),pending:f("Pending"),private:f("Private"),trash:f("Trash")};function wn(o){switch(o){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 yt(o,e){const t=o.editPostUrlBase??"",s=t.includes("?")?"&":"?";return`${t}${s}post=${e}&action=edit`}function xt(o){const e=o._embedded?.author?.[0];return e?{id:e.id,name:e.name,avatar:rn(e.avatar_urls)||void 0}:{id:o.author,name:f("Unknown")}}function kt(o,e){for(const t of o._embedded?.["wp:term"]??[])if(t.length>0&&t[0].taxonomy===e)return t.map(s=>({id:s.id,name:s.name}));return[]}function wt(o){const e=o._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 we(o){return pe(o.title.rendered)}function Je(o,e,t={}){const s=document.createElement("span");s.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&&s.appendChild(t.icon);const n=document.createElement("span");return n.textContent=o,s.appendChild(n),t.title&&(s.title=t.title),s}function ks(o,e=13){const t=document.createElement("span");return t.className=`dashicons ${o}`,t.setAttribute("aria-hidden","true"),t.style.cssText=`font-size:${e}px;width:${e}px;height:${e}px;line-height:1;`,t}function Cn(){const o=document.createElement("span");return o.setAttribute("aria-hidden","true"),o.style.cssText="font-family:dashicons;font-size:14px;line-height:1;display:inline-block;speak:none;-webkit-font-smoothing:antialiased",o.textContent="",o}function ws(o){o.addEventListener("mouseenter",()=>{o.style.textDecoration="underline"}),o.addEventListener("mouseleave",()=>{o.style.textDecoration="none"})}function $n(o,e){const t=document.createElement("span");t.style.cssText="display:flex;flex-direction:column;gap:4px;min-width:0;";const s=document.createElement("span");s.style.cssText="display:flex;align-items:center;gap:8px;min-width:0;";const n=document.createElement("a");n.href=yt(e.extra,o.id),n.setAttribute("data-noclick","");const a=we(o)||f("(no title)");n.textContent=a,n.title=a,n.style.cssText="font-weight:600;color:inherit;text-decoration:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:340px;",ws(n),n.addEventListener("click",c=>{c.preventDefault(),c.stopPropagation(),e.openUrl(n.href,a,"dashicons-admin-post")}),s.appendChild(n);const i=o.openstation_lock??null;i&&s.appendChild(Je(i.userName,{fg:"var(--os-ui-danger, #b32d2e)",bg:"var(--os-ui-surface-raised, rgba(179, 45, 46, 0.1))"},{icon:Cn(),title:W(f("%s is currently editing"),i.userName)}));const r=e.extra.mode==="pages";if(r&&typeof e.extra.frontPageId=="number"&&e.extra.frontPageId===o.id&&s.appendChild(Je(f("Front page"),{fg:"var(--os-ui-info-fg, #0a4b78)",bg:"var(--os-ui-info-bg, rgba(34,113,177,0.12))"},{icon:ks("dashicons-admin-home")})),r&&typeof e.extra.postsPageId=="number"&&e.extra.postsPageId===o.id&&s.appendChild(Je(f("Posts page"),{fg:"var(--os-ui-accent, #5b3aa0)",bg:"var(--os-ui-surface-raised, rgba(91,58,160,0.12))"},{icon:ks("dashicons-admin-post")})),o.status&&o.status!=="publish"&&s.appendChild(Je(xs[o.status]??o.status,wn(o.status),{uppercase:!0})),r&&typeof o.link=="string"&&o.link&&o.status==="publish"){const c=document.createElement("a");c.href=o.link,c.target="_blank",c.rel="noreferrer noopener",c.textContent=f("View"),c.title=o.link,c.setAttribute("data-noclick",""),c.style.cssText="font-size:11px;color:var(--wp-admin-theme-color, #2271b1);text-decoration:none;flex-shrink:0;",c.addEventListener("click",l=>l.stopPropagation()),ws(c),s.appendChild(c)}return t.appendChild(s),t}function Sn(o){const e=xt(o),t=document.createElement("span");t.style.cssText="display:inline-flex;align-items:center;gap:8px;min-width:0;";const s=document.createElement("os-avatar");s.setAttribute("size","24"),e.name&&s.setAttribute("name",e.name),e.id>0&&s.setAttribute("user-id",String(e.id)),e.avatar&&ln(s,e.avatar),t.appendChild(s);const n=document.createElement("span");return n.textContent=e.name,n.style.cssText="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;",t.appendChild(n),t}function En(o){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",o.date_gmt||o.date),e.appendChild(t),o.modified_gmt&&o.modified_gmt!==o.date_gmt){const s=document.createElement("span");s.textContent=f("modified"),s.style.cssText="font-size:11px;color:var(--os-ui-fg-muted, #646970);",e.appendChild(s)}return e}function An(o){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=wt(o);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 s=document.createElement("div");s.style.cssText="flex:1;min-width:0;display:flex;flex-direction:column;gap:6px;";const n=document.createElement("div");n.style.cssText="font-size:13px;color:var(--os-ui-fg-muted, #646970);text-transform:uppercase;letter-spacing:0.04em;",n.textContent=f("Excerpt"),s.appendChild(n);const a=document.createElement("div");a.style.cssText="color:var(--os-ui-fg, #1d2327);line-height:1.5;";const i=o.excerpt?.rendered??"";return i?a.textContent=pe(i.replace(/<[^>]+>/g,"").trim())||f("(no excerpt)"):(a.textContent=f("(no excerpt)"),a.style.color="var(--os-ui-fg-muted, #a7aaad)"),s.appendChild(a),e.appendChild(s),e}const Cs={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 $s(o){return o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Tn(o){return Object.prototype.hasOwnProperty.call(Cs,o)?Cs[o]:null}function Mn(o,e={}){const t=Tn(o);if(!t)return"";const{size:s=24,className:n,title:a,rotate:i}=e,r=['xmlns="http://www.w3.org/2000/svg"','viewBox="0 0 24 24"'];s!=null&&r.push(`width="${s}"`,`height="${s}"`),r.push(t.a),n&&r.push(`class="${$s(n)}"`),a?r.push('role="img"',`aria-label="${$s(a)}"`):r.push('aria-hidden="true"','focusable="false"');const c=i?`<g transform="rotate(${i} 12 12)">${t.b}</g>`:t.b;return`<svg ${r.join(" ")}>${c}</svg>`}function se(o,e={}){const t=Mn(o,e),s=document.createElement("div");s.innerHTML=t;const n=s.firstElementChild;return n instanceof SVGSVGElement?n:document.createElementNS("http://www.w3.org/2000/svg","svg")}const In=F`: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}`,_e=F`: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 ) )}`,Ln=F` .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%}}`,Ss=F` .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%}}`,Es=F` .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}}`,As=F` .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}}`,Ts=F` .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}}`,Pn=F` .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%}}`,zn=F` .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}}`,Ms=F` 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}}`,Ct=F` 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}}`,Is=F` @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}}`;F` ${_e} ${Ln} ${Ss} ${Es} ${As} ${Ts} ${Pn} ${zn} ${Ms} ${Ct} ${Is} `;const Rn=F` ${_e}: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}`,De=class De extends X{constructor(){super(...arguments),this._onHostKeyDown=e=>{if(this.dismissible!==null&&(e.key==="Backspace"||e.key==="Delete")){if(e.preventDefault(),this.disabled!==null)return;const n=this.label??"";this.emit("os-chip-dismiss",{label:n})}}}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this._onHostKeyDown)}disconnectedCallback(){this.removeEventListener("keydown",this._onHostKeyDown)}render(){const e=this.label??"",t=this.dismissible!==null,s=this.disabled!==null;return C` | |
| 74 | 41 | <span part="chip" class="os-chip"> |
| 75 | 42 | <span class="os-chip__icon"> |
| 76 | 43 | <slot name="icon"></slot> |
| 77 | 44 | </span> |
| @@ -83,45 +50,45 @@ | ||
| 83 | 50 | part="dismiss" |
| 84 | 51 | class="os-chip__dismiss" |
| 85 | 52 | type="button" |
| 86 | 53 | aria-label=${`Remove ${e||"chip"}`} |
| 87 | - ?disabled=${o} | |
| 54 | + ?disabled=${s} | |
| 88 | 55 | @click=${n=>this._onDismiss(n)} |
| 89 | 56 | > |
| 90 | - ${J("close",{size:null})} | |
| 57 | + ${se("close",{size:null})} | |
| 91 | 58 | </button> |
| 92 | 59 | `:C``} |
| 93 | 60 | </span> |
| 94 | - `}_onDismiss(e){if(e.stopPropagation(),this.disabled!==null)return;const o=this.label??"";this.emit("os-chip-dismiss",{label:o})}};Me.props=["label","tone","size","dismissible","disabled","pending","selected"],Me.styles=[Gs],Me.help=void 0;let at=Me;Q("os-chip",at);const ee="10px",Ks=q`: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% - ${ee} ) 0,100% 50%,calc( 100% - ${ee} ) 100%,0 100% )}.os-crumb--middle{padding-inline:22px;margin-inline-start:calc( -1 * ${ee} );clip-path:polygon( ${ee} 0,calc( 100% - ${ee} ) 0,100% 50%,calc( 100% - ${ee} ) 100%,${ee} 100%,0 50% )}.os-crumb--last{padding-inline-start:22px;padding-inline-end:14px;margin-inline-start:calc( -1 * ${ee} );clip-path:polygon( ${ee} 0,100% 0,100% 100%,${ee} 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}`,Le=class Le extends G{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?C``:C` | |
| 61 | + `}_onDismiss(e){if(e.stopPropagation(),this.disabled!==null)return;const s=this.label??"";this.emit("os-chip-dismiss",{label:s})}};De.props=["label","tone","size","dismissible","disabled","pending","selected"],De.styles=[Rn],De.help=void 0;let $t=De;Q("os-chip",$t);const oe="10px",Nn=F`: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% - ${oe} ) 0,100% 50%,calc( 100% - ${oe} ) 100%,0 100% )}.os-crumb--middle{padding-inline:22px;margin-inline-start:calc( -1 * ${oe} );clip-path:polygon( ${oe} 0,calc( 100% - ${oe} ) 0,100% 50%,calc( 100% - ${oe} ) 100%,${oe} 100%,0 50% )}.os-crumb--last{padding-inline-start:22px;padding-inline-end:14px;margin-inline-start:calc( -1 * ${oe} );clip-path:polygon( ${oe} 0,100% 0,100% 100%,${oe} 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}`,Oe=class Oe extends X{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?C``:C` | |
| 95 | 62 | <div class="os-crumb-chain" role="group"> |
| 96 | - ${t.map((o,n)=>{const a=Qt(n,t.length),i=o.color,r=i?`--os-ui-crumb-bg: ${i}; --os-ui-crumb-fg: ${Jt(i)};`:"";return C` | |
| 63 | + ${t.map((s,n)=>{const a=zs(n,t.length),i=s.color,r=i?`--os-ui-crumb-bg: ${i}; --os-ui-crumb-fg: ${Rs(i)};`:"";return C` | |
| 97 | 64 | <span |
| 98 | 65 | class=${`os-crumb os-crumb--${a}`} |
| 99 | 66 | style=${r} |
| 100 | - title=${o.name} | |
| 67 | + title=${s.name} | |
| 101 | 68 | draggable="true" |
| 102 | - @click=${l=>this._onSegmentClick(l,n,o)} | |
| 103 | - @dragstart=${l=>this._onSegmentDragStart(l,n,o)} | |
| 69 | + @click=${c=>this._onSegmentClick(c,n,s)} | |
| 70 | + @dragstart=${c=>this._onSegmentDragStart(c,n,s)} | |
| 104 | 71 | > |
| 105 | - <span class="os-crumb__label">${o.name}</span> | |
| 72 | + <span class="os-crumb__label">${s.name}</span> | |
| 106 | 73 | ${e?C` |
| 107 | 74 | <button |
| 108 | 75 | type="button" |
| 109 | 76 | class="os-crumb__remove" |
| 110 | - aria-label=${`Remove ${o.name}`} | |
| 77 | + aria-label=${`Remove ${s.name}`} | |
| 111 | 78 | draggable="false" |
| 112 | - @click=${l=>this._onRemove(l,n,o)} | |
| 113 | - >${Js()}</button> | |
| 79 | + @click=${c=>this._onRemove(c,n,s)} | |
| 80 | + >${qn()}</button> | |
| 114 | 81 | `:C``} |
| 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 i=Zs(a);document.body.appendChild(i);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(i,l,c),requestAnimationFrame(()=>i.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})}};Le.props=["removable","disabled"],Le.styles=[Ks],Le.help=void 0;let rt=Le;Q("os-crumb-chain",rt);const Ys=10;function Zs(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=Qs();return s.forEach((n,a)=>{const i=document.createElement("span"),r=n.color??o.bg,l=n.color?Jt(n.color):o.fg,c=Qt(a,t),u=["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"],d=Ys;c==="solo"?u.push("padding: 2px 12px","border-radius: 999px"):c==="first"?u.push("padding: 2px 22px 2px 12px",`clip-path: polygon( 0 0, calc( 100% - ${d}px ) 0, 100% 50%, calc( 100% - ${d}px ) 100%, 0 100% )`):c==="middle"?u.push("padding: 2px 22px",`margin-inline-start: -${d}px`,`clip-path: polygon( ${d}px 0, calc( 100% - ${d}px ) 0, 100% 50%, calc( 100% - ${d}px ) 100%, ${d}px 100%, 0 50% )`):u.push("padding: 2px 14px 2px 22px",`margin-inline-start: -${d}px`,`clip-path: polygon( ${d}px 0, 100% 0, 100% 100%, ${d}px 100%, 0 50% )`),i.style.cssText=u.join("; "),i.textContent=n.name,e.appendChild(i)}),e}const Yt="rgba( 0, 0, 0, 0.08 )",Zt="#1d2327";function Qs(){if(typeof document>"u"||!document.body)return{bg:Yt,fg:Zt};const s=getComputedStyle(document.body);return{bg:s.getPropertyValue("--os-ui-crumb-bg").trim()||Yt,fg:s.getPropertyValue("--os-ui-crumb-fg").trim()||Zt}}function Qt(s,e){return e===1?"solo":s===0?"first":s===e-1?"last":"middle"}let Ce=null;function Jt(s){Ce||(Ce=document.createElement("canvas"),Ce.width=1,Ce.height=1);const e=Ce.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,n=t[0]*o+255*(1-o),a=t[1]*o+255*(1-o),i=t[2]*o+255*(1-o),r=c=>{const u=c/255;return u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4)};return .2126*r(n)+.7152*r(a)+.0722*r(i)>.55?"#1d2327":"#fff"}catch{return"#1d2327"}}function Js(){return J("close",{size:null})}const eo="uncategorized",en=1;function Ve(s){return s.id===en?!0:(s.name||"").toLowerCase()===eo}const Ie=class Ie extends G{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,n=this.readonly!==null;o||n||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,n=this.loading!==null,a=this["add-label"]||"Categorize",i=this.placeholder||"Search categories…",r=Math.max(0,parseInt(this["max-visible"]||"2",10)||2);return C` | |
| 85 | + `}_onSegmentDragStart(e,t,s){if(e.target?.closest(".os-crumb__remove")){e.preventDefault();return}const a=this._segments.slice(t);if(e.dataTransfer){const i=On(a);document.body.appendChild(i);const r=e.currentTarget?.getBoundingClientRect(),c=r?Math.min(30,r.width/2):16,l=r?Math.min(16,r.height/2):12;e.dataTransfer.setDragImage(i,c,l),requestAnimationFrame(()=>i.remove())}this.emit("os-chain-segment-dragstart",{index:t,id:s.id,segment:s,segments:a,dragEvent:e})}_onSegmentClick(e,t,s){e.target?.closest(".os-crumb__remove")||this.emit("os-chain-segment-click",{index:t,id:s.id,segment:s})}_onRemove(e,t,s){e.stopPropagation(),this.emit("os-chain-remove",{index:t,id:s.id,segment:s})}};Oe.props=["removable","disabled"],Oe.styles=[Nn],Oe.help=void 0;let St=Oe;Q("os-crumb-chain",St);const Dn=10;function On(o){const e=document.createElement("div");e.style.cssText=["display: inline-flex","align-items: stretch","border-radius: 999px","overflow: hidden","filter: drop-shadow( 0 1px 2px rgba( 0, 0, 0, 0.18 ) )",'font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',"font-size: 12px","line-height: 1","font-weight: 500","position: fixed","top: -10000px","left: -10000px","pointer-events: none","z-index: 2147483647"].join("; ");const t=o.length,s=Hn();return o.forEach((n,a)=>{const i=document.createElement("span"),r=n.color??s.bg,c=n.color?Rs(n.color):s.fg,l=zs(a,t),d=["display: inline-flex","align-items: center","justify-content: center","min-height: 22px",`background: ${r}`,`color: ${c}`,"white-space: nowrap","box-sizing: border-box","letter-spacing: 0.01em"],u=Dn;l==="solo"?d.push("padding: 2px 12px","border-radius: 999px"):l==="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% )`):l==="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% )`),i.style.cssText=d.join("; "),i.textContent=n.name,e.appendChild(i)}),e}const Ls="rgba( 0, 0, 0, 0.08 )",Ps="#1d2327";function Hn(){if(typeof document>"u"||!document.body)return{bg:Ls,fg:Ps};const o=getComputedStyle(document.body);return{bg:o.getPropertyValue("--os-ui-crumb-bg").trim()||Ls,fg:o.getPropertyValue("--os-ui-crumb-fg").trim()||Ps}}function zs(o,e){return e===1?"solo":o===0?"first":o===e-1?"last":"middle"}let Le=null;function Rs(o){Le||(Le=document.createElement("canvas"),Le.width=1,Le.height=1);const e=Le.getContext("2d",{willReadFrequently:!0});if(!e)return"#1d2327";try{e.clearRect(0,0,1,1),e.fillStyle=o,e.fillRect(0,0,1,1);const t=e.getImageData(0,0,1,1).data,s=t[3]/255,n=t[0]*s+255*(1-s),a=t[1]*s+255*(1-s),i=t[2]*s+255*(1-s),r=l=>{const d=l/255;return d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4)};return .2126*r(n)+.7152*r(a)+.0722*r(i)>.55?"#1d2327":"#fff"}catch{return"#1d2327"}}function qn(){return se("close",{size:null})}const Ns="uncategorized",Fn=1;function Qe(o){return o.id===Fn?!0:(o.name||"").toLowerCase()===Ns}const He=class He extends X{constructor(){super(...arguments),this._items=[],this._value=[],this._query="",this._collapsed=new Set,this._focusedRow=-1,this._creatingValues=new Map,this._creatingPending=new Set,this._onCellClick=e=>{if(e.target?.closest(".os-cat-node")||this.isOpen)return;const s=this.disabled!==null,n=this.readonly!==null;s||n||this.openPicker()},this._onDocPointerDown=e=>{!this.isOpen||e.composedPath().includes(this)||this.closePicker()},this._onLayoutChange=()=>{this.isOpen&&this.closePicker()},this._onDocKeydown=e=>{this.isOpen&&e.key==="Escape"&&(e.preventDefault(),this.closePicker())}}get items(){return this._items}set items(e){this._items=Array.isArray(e)?e.slice():[],this.requestUpdate()}get value(){return this._value}set value(e){this._value=Array.isArray(e)?e.slice():[],this.requestUpdate()}get isOpen(){return this.open!==null}openPicker(){this.isOpen||(this.open="",this._query="",this._focusedRow=0,this.emit("os-categories-open",{}),queueMicrotask(()=>{this._positionPopover(),this._searchInput?.focus()}))}closePicker(){this.isOpen&&(this.open=null,this._query="",this._focusedRow=-1,this.emit("os-categories-close",{}),this.requestUpdate())}connectedCallback(){super.connectedCallback(),document.addEventListener("pointerdown",this._onDocPointerDown,!0),document.addEventListener("keydown",this._onDocKeydown,!0),window.addEventListener("resize",this._onLayoutChange,{passive:!0}),window.addEventListener("scroll",this._onLayoutChange,{passive:!0,capture:!0})}disconnectedCallback(){document.removeEventListener("pointerdown",this._onDocPointerDown,!0),document.removeEventListener("keydown",this._onDocKeydown,!0),window.removeEventListener("resize",this._onLayoutChange),window.removeEventListener("scroll",this._onLayoutChange,{capture:!0})}get _searchInput(){return this.shadowRoot?.querySelector(".os-cat__search")??null}render(){const e=this.isOpen,t=this.disabled!==null,s=this.readonly!==null,n=this.loading!==null,a=this["add-label"]||"Categorize",i=this.placeholder||"Search categories…",r=Math.max(0,parseInt(this["max-visible"]||"2",10)||2);return C` | |
| 119 | 86 | <span class="os-cat" role="group"> |
| 120 | - ${this._renderChipRow(r,o,t,a)} | |
| 87 | + ${this._renderChipRow(r,s,t,a)} | |
| 121 | 88 | ${e?this._renderPopover(i,n):C``} |
| 122 | 89 | </span> |
| 123 | - `}_renderChipRow(e,t,o,n){const a=this._selectedItemsInOrder();if(a.length===0)return C` | |
| 90 | + `}_renderChipRow(e,t,s,n){const a=this._selectedItemsInOrder();if(a.length===0)return C` | |
| 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.'} |
| @@ -133,11 +100,11 @@ | ||
| 133 | 100 | class="os-cat__chains" |
| 134 | 101 | role="list" |
| 135 | 102 | @click=${this._onCellClick} |
| 136 | 103 | > |
| 137 | - ${i.map(r=>this._renderChain(r,t,o))} | |
| 104 | + ${i.map(r=>this._renderChain(r,t,s))} | |
| 138 | 105 | </div> |
| 139 | - `}_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)),n=r=>{for(const l of o){if(l===r)continue;let c=t.get(l),u=16;for(;c&&u-- >0;){if(c.parent===r)return!0;if(!c.parent)break;c=t.get(c.parent)}}return!1},a=e.filter(r=>!n(r.id)),i=[];for(const r of a){const l=[];let c=r,u=16;for(;c&&u-- >0&&((c===r||o.has(c.id))&&l.unshift(c),!!c.parent);)c=t.get(c.parent);const d=l.map(h=>({id:h.id,name:h.name}));i.push({id:r.id,segments:d})}return i}_renderChain(e,t,o){const n=!t&&!o,a=r=>{r.stopPropagation();const l=r.detail,c=typeof l?.index=="number"?l.index:e.segments.length-1,u=new Set;for(const h of e.segments.slice(c))typeof h.id=="number"&&u.add(h.id);const d=this._value.filter(h=>!u.has(h));d.length!==this._value.length&&this.emit("os-categories-change",{value:d})},i=document.createElement("os-crumb-chain");return i.segments=e.segments,n&&i.setAttribute("removable",""),i.addEventListener("os-chain-remove",a),C`<div role="listitem">${i}</div>`}_renderPopover(e,t){const o=this._buildTree(),n=this._filterTree(o,this._query),a=this._flattenForDisplay(n);return this._focusedRow>=a.length&&(this._focusedRow=a.length>0?a.length-1:-1),C` | |
| 106 | + `}_buildChains(e){const t=new Map;for(const r of this._items)t.set(r.id,r);const s=new Set(e.map(r=>r.id)),n=r=>{for(const c of s){if(c===r)continue;let l=t.get(c),d=16;for(;l&&d-- >0;){if(l.parent===r)return!0;if(!l.parent)break;l=t.get(l.parent)}}return!1},a=e.filter(r=>!n(r.id)),i=[];for(const r of a){const c=[];let l=r,d=16;for(;l&&d-- >0&&((l===r||s.has(l.id))&&c.unshift(l),!!l.parent);)l=t.get(l.parent);const u=c.map(h=>({id:h.id,name:h.name}));i.push({id:r.id,segments:u})}return i}_renderChain(e,t,s){const n=!t&&!s,a=r=>{r.stopPropagation();const c=r.detail,l=typeof c?.index=="number"?c.index:e.segments.length-1,d=new Set;for(const h of e.segments.slice(l))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})},i=document.createElement("os-crumb-chain");return i.segments=e.segments,n&&i.setAttribute("removable",""),i.addEventListener("os-chain-remove",a),C`<div role="listitem">${i}</div>`}_renderPopover(e,t){const s=this._buildTree(),n=this._filterTree(s,this._query),a=this._flattenForDisplay(n);return this._focusedRow>=a.length&&(this._focusedRow=a.length>0?a.length-1:-1),C` | |
| 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" |
| @@ -167,9 +134,9 @@ | ||
| 167 | 134 | `:t.length===0?C` |
| 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,n)=>this._renderRow(o,n,t.length))}_renderRow(e,t,o){const{node:n,hasChildren:a}=e,i=this._value.includes(n.item.id),r=!this._collapsed.has(n.item.id),l=12+n.depth*16,c=n.depth>0?n.depth*16:0,u=t===this._focusedRow;return C` | |
| 138 | + `:t.map((s,n)=>this._renderRow(s,n,t.length))}_renderRow(e,t,s){const{node:n,hasChildren:a}=e,i=this._value.includes(n.item.id),r=!this._collapsed.has(n.item.id),c=12+n.depth*16,l=n.depth>0?n.depth*16:0,d=t===this._focusedRow;return C` | |
| 172 | 139 | <div class="os-cat__row-block"> |
| 173 | 140 | <div |
| 174 | 141 | class="os-cat__row" |
| 175 | 142 | role="option" |
| @@ -175,37 +142,37 @@ | ||
| 175 | 142 | role="option" |
| 176 | 143 | aria-selected=${i?"true":"false"} |
| 177 | 144 | data-selected=${i?"true":"false"} |
| 178 | 145 | data-expanded=${r?"true":"false"} |
| 179 | - data-focused=${u?"true":"false"} | |
| 146 | + data-focused=${d?"true":"false"} | |
| 180 | 147 | data-row-id=${String(n.item.id)} |
| 181 | - style=${`--os-ui-cat-row-indent: ${l}px; --os-ui-cat-guide-width: ${c}px;`} | |
| 148 | + style=${`--os-ui-cat-row-indent: ${c}px; --os-ui-cat-guide-width: ${l}px;`} | |
| 182 | 149 | @mouseenter=${()=>{this._focusedRow=t,this.requestUpdate()}} |
| 183 | - @click=${d=>{d.preventDefault(),this._toggleSelection(n.item.id)}} | |
| 150 | + @click=${u=>{u.preventDefault(),this._toggleSelection(n.item.id)}} | |
| 184 | 151 | > |
| 185 | 152 | ${a?C`<button |
| 186 | 153 | type="button" |
| 187 | 154 | class="os-cat__expander" |
| 188 | 155 | aria-label=${r?"Collapse":"Expand"} |
| 189 | - @click=${d=>{d.stopPropagation(),this._toggleExpand(n.item.id)}} | |
| 190 | - >${to()}</button>`:C`<span class="os-cat__expander os-cat__expander--placeholder" aria-hidden="true">${to()}</span>`} | |
| 191 | - <span class="os-cat__check" aria-hidden="true">${on()}</span> | |
| 156 | + @click=${u=>{u.stopPropagation(),this._toggleExpand(n.item.id)}} | |
| 157 | + >${Ds()}</button>`:C`<span class="os-cat__expander os-cat__expander--placeholder" aria-hidden="true">${Ds()}</span>`} | |
| 158 | + <span class="os-cat__check" aria-hidden="true">${Wn()}</span> | |
| 192 | 159 | <span class="os-cat__label">${this._highlight(n.item.name,this._query)}</span> |
| 193 | - ${Ve(n.item)?C``:C`<button | |
| 160 | + ${Qe(n.item)?C``:C`<button | |
| 194 | 161 | type="button" |
| 195 | 162 | class="os-cat__delete" |
| 196 | 163 | aria-label=${`Delete ${n.item.name}`} |
| 197 | 164 | title=${`Delete ${n.item.name}`} |
| 198 | - @click=${d=>this._onDeleteClick(d,n.item)} | |
| 199 | - >${sn()}</button>`} | |
| 165 | + @click=${u=>this._onDeleteClick(u,n.item)} | |
| 166 | + >${Vn()}</button>`} | |
| 200 | 167 | </div> |
| 201 | - ${r&&!Ve(n.item)?this._renderCreateRow(n.item.id,12+(n.depth+1)*16,(n.depth+1)*16,n.item.name):C``} | |
| 168 | + ${r&&!Qe(n.item)?this._renderCreateRow(n.item.id,12+(n.depth+1)*16,(n.depth+1)*16,n.item.name):C``} | |
| 202 | 169 | </div> |
| 203 | - `}_renderCreateRow(e,t,o,n){const a=this._creatingValues.get(e)??"",i=this._creatingPending.has(e),r=e===0?"Add new category…":`Add child of "${n}"…`;return C` | |
| 170 | + `}_renderCreateRow(e,t,s,n){const a=this._creatingValues.get(e)??"",i=this._creatingPending.has(e),r=e===0?"Add new category…":`Add child of "${n}"…`;return C` | |
| 204 | 171 | <div |
| 205 | 172 | class="os-cat__create-row" |
| 206 | - style=${`--os-ui-cat-row-indent: ${t}px; --os-ui-cat-guide-width: ${o}px;`} | |
| 207 | - @click=${l=>l.stopPropagation()} | |
| 173 | + style=${`--os-ui-cat-row-indent: ${t}px; --os-ui-cat-guide-width: ${s}px;`} | |
| 174 | + @click=${c=>c.stopPropagation()} | |
| 208 | 175 | > |
| 209 | 176 | <div class="os-cat__create-wrap"> |
| 210 | 177 | <input |
| 211 | 178 | class="os-cat__create-input" |
| @@ -215,10 +182,10 @@ | ||
| 215 | 182 | placeholder=${r} |
| 216 | 183 | aria-label=${r} |
| 217 | 184 | .value=${a} |
| 218 | 185 | ?disabled=${i} |
| 219 | - @input=${l=>this._onCreateInput(l,e)} | |
| 220 | - @keydown=${l=>this._onCreateKeydown(l,e)} | |
| 186 | + @input=${c=>this._onCreateInput(c,e)} | |
| 187 | + @keydown=${c=>this._onCreateKeydown(c,e)} | |
| 221 | 188 | /> |
| 222 | 189 | ${i?C`<span class="os-cat__create-spinner" aria-hidden="true"></span>`:C`<button |
| 223 | 190 | type="button" |
| 224 | 191 | class="os-cat__create-submit" |
| @@ -223,15 +190,15 @@ | ||
| 223 | 190 | type="button" |
| 224 | 191 | class="os-cat__create-submit" |
| 225 | 192 | aria-label=${e===0?"Create category":`Create child of ${n}`} |
| 226 | 193 | ?disabled=${a.trim().length===0} |
| 227 | - @click=${l=>{l.stopPropagation(),this._submitCreate(e)}} | |
| 228 | - >${tn()}</button>`} | |
| 194 | + @click=${c=>{c.stopPropagation(),this._submitCreate(e)}} | |
| 195 | + >${Un()}</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 i=a.item.parent;i&&e.has(i)?e.get(i).children.push(a):t.push(a)}const o=(a,i)=>{a.depth=i;for(const r of a.children)o(r,i+1)};for(const a of t)o(a,0);const n=a=>{a.sort((i,r)=>{const l=Ve(i.item),c=Ve(r.item);return l!==c?l?-1:1:i.item.name.localeCompare(r.item.name)});for(const i of a)n(i.children)};return n(t),t}_filterTree(e,t){const o=t.trim().toLowerCase();if(!o)return e;const n=a=>{if(a.item.name.toLowerCase().includes(o))return{item:a.item,children:a.children.slice(),depth:a.depth};const r=a.children.map(n).filter(l=>l!==null);return r.length>0?{item:a.item,children:r,depth:a.depth}:null};return e.map(n).filter(a=>a!==null)}_flattenForDisplay(e){const t=[],o=this._query.trim()!=="",n=a=>{for(const i of a)t.push({node:i,visible:!0,hasChildren:i.children.length>0}),!(this._collapsed.has(i.item.id)&&!o)&&i.children.length>0&&n(i.children)};return n(e),t}_selectedItemsInOrder(){const e=new Map;for(const n of this._items)e.set(n.id,n);const t=[],o=[];for(const n of this._value){const a=e.get(n);a&&(a.name.toLowerCase()===eo||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 n=e.toLowerCase(),a=o.toLowerCase(),i=n.indexOf(a);return i===-1?e:C`${e.slice(0,i)}<span class="os-cat__match" | |
| 232 | - >${e.slice(i,i+o.length)}</span | |
| 233 | - >${e.slice(i+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(),n=e.getBoundingClientRect();o.top<n.top?t.scrollIntoView({block:"nearest"}):o.bottom>n.bottom&&t.scrollIntoView({block:"nearest"})})}_positionPopover(){const e=this.shadowRoot?.querySelector(".os-cat__popover");if(!e)return;const t=this.getBoundingClientRect(),o=e.getBoundingClientRect(),n=window.innerWidth,a=window.innerHeight,i=8;let r=t.bottom+4;const l=r+o.height+i>a,c=t.top-4-o.height>=i;l&&c?r=t.top-4-o.height:l&&(r=Math.max(i,a-o.height-i));let u=t.left;u+o.width+i>n&&(u=t.right-o.width),u=Math.max(i,Math.min(u,n-o.width-i)),e.style.top=`${r}px`,e.style.left=`${u}px`}};Ie.props=["placeholder","add-label","disabled","readonly","open","loading","max-visible"],Ie.styles=[Os],Ie.help=void 0;let lt=Ie;Q("os-category-picker",lt);function to(){return J("chevron-right",{size:14})}function tn(){return J("plus",{size:16})}function on(){return J("check",{size:null})}function sn(){return J("close",{size:null})}const ct="application/x-os-categories";function oo(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 dt(s){s.categories.tree=null}function nn(s){oo(s).then(e=>{for(const t of s.categories.pickers)t.isConnected?t.items=e:s.categories.pickers.delete(t)}).catch(()=>{})}function an(s,e){const{client:t}=e,o=document.createElement("span");o.style.cssText="display:inline-flex;align-items:center;width:100%;min-width:0;border-radius:6px;transition:background-color 0.12s ease, box-shadow 0.12s ease;";const n=document.createElement("os-category-picker");n.setAttribute("placeholder",m("Search categories…")),n.setAttribute("add-label",m("Categorize")),n.setAttribute("data-noclick",""),e.categories.pickers.add(n),n.value=s.categories??[],n.items=Wt(s,"category").map(d=>({id:d.id,name:d.name,parent:0}));const a={categoryIds:(s.categories??[]).slice()},i=d=>{a.categoryIds=d.slice(),n.value=d},r=async(d,h,p)=>{try{await t.updatePostCategories(s.id,d),e.announce("categorized",[s.id])}catch(f){i(h),e.toast(p,f)}};oo(e).then(d=>{n.isConnected&&(n.items=d)}).catch(d=>{console.warn("[openstation:desktop-mode-posts] category tree fetch failed",d)}),n.addEventListener("os-categories-open",()=>{e.categories.tree&&e.categories.tree.then(d=>{n.items=d}).catch(()=>{})}),n.addEventListener("os-categories-create",async d=>{const h=d.detail,p=h?.parent??0;if(!h||!h.name){n.failCreating(p);return}try{const f=await t.createCategory(h.name,p);dt(e),n.items=[...n.items,{id:f.id,name:f.name,parent:f.parent}];const b=a.categoryIds.slice(),_=[...b,f.id];i(_),n.endCreating(p),await r(_,b,m("Couldn’t assign new category."))}catch(f){n.failCreating(p,f instanceof Error?f.message:String(f)),e.toast(m("Couldn’t create category."),f)}}),n.addEventListener("os-categories-change",async d=>{const h=d.detail;if(!h||!Array.isArray(h.value))return;const p=a.categoryIds.slice(),f=h.value.slice();i(f),await r(f,p,m("Couldn’t update categories."))}),n.addEventListener("os-categories-delete",async d=>{const h=d.detail;if(!(!h||typeof h.id!="number"||!await e.confirm({title:m("Delete category?"),message:V(m('Delete the category "%s"? Posts assigned only to it will fall back to Uncategorized.'),h.name),confirmLabel:m("Delete"),danger:!0})))try{if(await t.deleteTerm("categories",h.id),a.categoryIds.includes(h.id)){const f=a.categoryIds.filter(b=>b!==h.id);i(f);try{await t.updatePostCategories(s.id,f)}catch(b){e.toast(m("Couldn’t update post categories after delete."),b)}}}catch(f){e.toast(m("Couldn’t delete category."),f)}}),n.addEventListener("os-chain-segment-dragstart",d=>{const h=d.detail;if(!h?.dragEvent?.dataTransfer)return;const p=h.segments.map(b=>b.id).filter(b=>typeof b=="number");if(p.length===0)return;const f=h.dragEvent.dataTransfer;f.setData(ct,JSON.stringify({ids:p,source:"posts-window",sourcePostId:s.id})),f.setData("text/plain",p.join(",")),f.effectAllowed="copy"});let l=0;const c=d=>{o.style.backgroundColor=d?"color-mix(in srgb, var(--wp-admin-theme-color, #2271b1) 12%, transparent)":"",o.style.boxShadow=d?"inset 0 0 0 2px var(--wp-admin-theme-color, #2271b1)":""},u=d=>Array.from(d.dataTransfer?.types??[]).includes(ct);return o.addEventListener("dragenter",d=>{u(d)&&(d.preventDefault(),l++,c(!0))}),o.addEventListener("dragover",d=>{u(d)&&(d.preventDefault(),d.dataTransfer&&(d.dataTransfer.dropEffect="copy"))}),o.addEventListener("dragleave",()=>{l>0&&l--,l===0&&c(!1)}),o.addEventListener("drop",async d=>{if(l=0,c(!1),!u(d))return;d.preventDefault();let h=null;try{h=JSON.parse(d.dataTransfer?.getData(ct)??"")}catch{return}if(!h||!Array.isArray(h.ids))return;const p=h.ids.filter(_=>typeof _=="number"&&Number.isFinite(_));if(p.length===0)return;const f=a.categoryIds.slice(),b=Array.from(new Set([...f,...p]));b.length!==f.length&&(i(b),await r(b,f,m("Couldn’t add category.")))}),o.appendChild(n),o}function rn(s,e){s.parentTitles.clear();for(const t of e)s.parentTitles.set(t.id,Vt(t))}function ln(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",m("Top-level page")),t;const n=e.parentTitles.get(o);return t.textContent=n?`↳ ${n}`:V(m("↳ #%d"),o),t}function cn(s,e){const t=document.createElement("span"),o=typeof s.template=="string"?s.template:"",n=e.extra.pageTemplates??{};return t.textContent=n[o]??(o===""?m("Default template"):o),o!==""&&(t.title=o),t}function dn(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?m("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",n=>{n.stopPropagation(),o&&es(o).then(a=>{if(!a){e.toast(m("Couldn’t copy the slug."),null);return}t.textContent=m("Copied!"),t.style.color="var(--wp-admin-theme-color, #2271b1)",setTimeout(()=>{t.textContent=o,t.style.color=""},1200)})}),t}function un(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 n=document.createElement("span");return n.textContent=String(t),t===0&&(n.style.color="var(--os-ui-fg-muted, #8c8f94)"),e.appendChild(o),e.appendChild(n),e.setAttribute("aria-label",V(fe("%d comment","%d comments",t),t)),e}const hn=q` ${We} ${Kt}: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}}`,ge="__wpd_expander__",me="__wpd_select__",Re=class Re extends G{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 n=null;if(e!=="all"){n=new Set;for(const r of e)n.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||n&&!n.has(l))continue;const c=Number(r.dataset.rowIndex);if(!Number.isFinite(c))continue;const u=this._data[c];if(u===void 0)continue;const d=this._getRowId(u,c),h=this._selection.has(d);r.classList.toggle("is-selected",h);const p=r.querySelector("input.select-row-checkbox");p&&p.checked!==h&&(p.checked=h)}const i=t.querySelector("thead .select-all-checkbox");if(i){const{total:r,selected:l}=this._visibleSelectionStats();i.checked=r>0&&l===r,i.indeterminate=l>0&&l<r}}scrollToRow(e){const t=this.shadowRoot;if(!t)return;const n=t.querySelectorAll("tbody tr:not(.subtable):not(.empty):not(.skeleton)")[e];n&&n.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 C` | |
| 198 | + `}_onCreateInput(e,t){const s=e.target.value;s===""?this._creatingValues.delete(t):this._creatingValues.set(t,s),this.requestUpdate()}_onCreateKeydown(e,t){if(e.key==="Escape"){e.preventDefault(),this._creatingValues.delete(t),this.requestUpdate();return}e.key==="Enter"&&(e.preventDefault(),this._submitCreate(t))}_submitCreate(e){const t=(this._creatingValues.get(e)??"").trim();!t||this._creatingPending.has(e)||(this._creatingPending.add(e),this.requestUpdate(),this.emit("os-categories-create",{name:t,parent:e}))}endCreating(e=0){this._creatingPending.delete(e),this._creatingValues.delete(e),this.requestUpdate()}failCreating(e=0,t){this._creatingPending.delete(e),this.requestUpdate()}_buildTree(){const e=new Map;for(const a of this._items)e.set(a.id,{item:a,children:[],depth:0});const t=[];for(const a of e.values()){const i=a.item.parent;i&&e.has(i)?e.get(i).children.push(a):t.push(a)}const s=(a,i)=>{a.depth=i;for(const r of a.children)s(r,i+1)};for(const a of t)s(a,0);const n=a=>{a.sort((i,r)=>{const c=Qe(i.item),l=Qe(r.item);return c!==l?c?-1:1:i.item.name.localeCompare(r.item.name)});for(const i of a)n(i.children)};return n(t),t}_filterTree(e,t){const s=t.trim().toLowerCase();if(!s)return e;const n=a=>{if(a.item.name.toLowerCase().includes(s))return{item:a.item,children:a.children.slice(),depth:a.depth};const r=a.children.map(n).filter(c=>c!==null);return r.length>0?{item:a.item,children:r,depth:a.depth}:null};return e.map(n).filter(a=>a!==null)}_flattenForDisplay(e){const t=[],s=this._query.trim()!=="",n=a=>{for(const i of a)t.push({node:i,visible:!0,hasChildren:i.children.length>0}),!(this._collapsed.has(i.item.id)&&!s)&&i.children.length>0&&n(i.children)};return n(e),t}_selectedItemsInOrder(){const e=new Map;for(const n of this._items)e.set(n.id,n);const t=[],s=[];for(const n of this._value){const a=e.get(n);a&&(a.name.toLowerCase()===Ns||a.id===1?s.push(a):t.push(a))}return t.length>0?t:s.length>0?[]:t}_highlight(e,t){const s=t.trim();if(!s)return e;const n=e.toLowerCase(),a=s.toLowerCase(),i=n.indexOf(a);return i===-1?e:C`${e.slice(0,i)}<span class="os-cat__match" | |
| 199 | + >${e.slice(i,i+s.length)}</span | |
| 200 | + >${e.slice(i+s.length)}`}_toggleSelection(e){const t=this._value.includes(e)?this._value.filter(s=>s!==e):[...this._value,e];this.emit("os-categories-change",{value:t})}_onDeleteClick(e,t){e.stopPropagation(),e.preventDefault(),this.emit("os-categories-delete",{id:t.id,name:t.name})}_toggleExpand(e){this._collapsed.has(e)?this._collapsed.delete(e):this._collapsed.add(e),this.requestUpdate()}_onSearchInput(e){this._query=e.target.value,this._focusedRow=0,this.requestUpdate()}_onSearchKeydown(e,t){switch(e.key){case"ArrowDown":{if(t.length===0)return;e.preventDefault(),this._focusedRow=this._focusedRow+1>=t.length?0:this._focusedRow+1,this.requestUpdate(),this._scrollFocusedIntoView();return}case"ArrowUp":{if(t.length===0)return;e.preventDefault(),this._focusedRow=this._focusedRow<=0?t.length-1:this._focusedRow-1,this.requestUpdate(),this._scrollFocusedIntoView();return}case"ArrowRight":{if(this._focusedRow<0||this._focusedRow>=t.length)return;const s=t[this._focusedRow];s.hasChildren&&this._collapsed.has(s.node.item.id)&&(e.preventDefault(),this._toggleExpand(s.node.item.id));return}case"ArrowLeft":{if(this._focusedRow<0||this._focusedRow>=t.length)return;const s=t[this._focusedRow];s.hasChildren&&!this._collapsed.has(s.node.item.id)&&(e.preventDefault(),this._toggleExpand(s.node.item.id));return}case"Enter":case" ":{if(this._focusedRow<0||this._focusedRow>=t.length)return;e.preventDefault();const s=t[this._focusedRow];this._toggleSelection(s.node.item.id);return}case"Escape":e.preventDefault(),this.closePicker()}}_scrollFocusedIntoView(){queueMicrotask(()=>{const e=this.shadowRoot?.querySelector(".os-cat__tree");if(!e)return;const t=e.querySelector('.os-cat__row[data-focused="true"]');if(!t)return;const s=t.getBoundingClientRect(),n=e.getBoundingClientRect();s.top<n.top?t.scrollIntoView({block:"nearest"}):s.bottom>n.bottom&&t.scrollIntoView({block:"nearest"})})}_positionPopover(){const e=this.shadowRoot?.querySelector(".os-cat__popover");if(!e)return;const t=this.getBoundingClientRect(),s=e.getBoundingClientRect(),n=window.innerWidth,a=window.innerHeight,i=8;let r=t.bottom+4;const c=r+s.height+i>a,l=t.top-4-s.height>=i;c&&l?r=t.top-4-s.height:c&&(r=Math.max(i,a-s.height-i));let d=t.left;d+s.width+i>n&&(d=t.right-s.width),d=Math.max(i,Math.min(d,n-s.width-i)),e.style.top=`${r}px`,e.style.left=`${d}px`}};He.props=["placeholder","add-label","disabled","readonly","open","loading","max-visible"],He.styles=[In],He.help=void 0;let Et=He;Q("os-category-picker",Et);function Ds(){return se("chevron-right",{size:14})}function Un(){return se("plus",{size:16})}function Wn(){return se("check",{size:null})}function Vn(){return se("close",{size:null})}const At="application/x-os-categories";function Os(o){return o.categories.tree||(o.categories.tree=o.client.fetchAllCategories().then(e=>e.map(t=>({id:t.id,name:t.name,parent:t.parent})))),o.categories.tree}function Tt(o){o.categories.tree=null}function Bn(o){Os(o).then(e=>{for(const t of o.categories.pickers)t.isConnected?t.items=e:o.categories.pickers.delete(t)}).catch(()=>{})}function jn(o,e){const{client:t}=e,s=document.createElement("span");s.style.cssText="display:inline-flex;align-items:center;width:100%;min-width:0;border-radius:6px;transition:background-color 0.12s ease, box-shadow 0.12s ease;";const n=document.createElement("os-category-picker");n.setAttribute("placeholder",f("Search categories…")),n.setAttribute("add-label",f("Categorize")),n.setAttribute("data-noclick",""),e.categories.pickers.add(n),n.value=o.categories??[],n.items=kt(o,"category").map(u=>({id:u.id,name:u.name,parent:0}));const a={categoryIds:(o.categories??[]).slice()},i=u=>{a.categoryIds=u.slice(),n.value=u},r=async(u,h,p)=>{try{await t.updatePostCategories(o.id,u),e.announce("categorized",[o.id])}catch(m){i(h),e.toast(p,m)}};Os(e).then(u=>{n.isConnected&&(n.items=u)}).catch(u=>{console.warn("[openstation:desktop-mode-posts] category tree fetch failed",u)}),n.addEventListener("os-categories-open",()=>{e.categories.tree&&e.categories.tree.then(u=>{n.items=u}).catch(()=>{})}),n.addEventListener("os-categories-create",async u=>{const h=u.detail,p=h?.parent??0;if(!h||!h.name){n.failCreating(p);return}try{const m=await t.createCategory(h.name,p);Tt(e),n.items=[...n.items,{id:m.id,name:m.name,parent:m.parent}];const _=a.categoryIds.slice(),g=[..._,m.id];i(g),n.endCreating(p),await r(g,_,f("Couldn’t assign new category."))}catch(m){n.failCreating(p,m instanceof Error?m.message:String(m)),e.toast(f("Couldn’t create category."),m)}}),n.addEventListener("os-categories-change",async u=>{const h=u.detail;if(!h||!Array.isArray(h.value))return;const p=a.categoryIds.slice(),m=h.value.slice();i(m),await r(m,p,f("Couldn’t update categories."))}),n.addEventListener("os-categories-delete",async u=>{const h=u.detail;if(!(!h||typeof h.id!="number"||!await e.confirm({title:f("Delete category?"),message:W(f('Delete the category "%s"? Posts assigned only to it will fall back to Uncategorized.'),h.name),confirmLabel:f("Delete"),danger:!0})))try{if(await t.deleteTerm("categories",h.id),a.categoryIds.includes(h.id)){const m=a.categoryIds.filter(_=>_!==h.id);i(m);try{await t.updatePostCategories(o.id,m)}catch(_){e.toast(f("Couldn’t update post categories after delete."),_)}}}catch(m){e.toast(f("Couldn’t delete category."),m)}}),n.addEventListener("os-chain-segment-dragstart",u=>{const h=u.detail;if(!h?.dragEvent?.dataTransfer)return;const p=h.segments.map(_=>_.id).filter(_=>typeof _=="number");if(p.length===0)return;const m=h.dragEvent.dataTransfer;m.setData(At,JSON.stringify({ids:p,source:"posts-window",sourcePostId:o.id})),m.setData("text/plain",p.join(",")),m.effectAllowed="copy"});let c=0;const l=u=>{s.style.backgroundColor=u?"color-mix(in srgb, var(--wp-admin-theme-color, #2271b1) 12%, transparent)":"",s.style.boxShadow=u?"inset 0 0 0 2px var(--wp-admin-theme-color, #2271b1)":""},d=u=>Array.from(u.dataTransfer?.types??[]).includes(At);return s.addEventListener("dragenter",u=>{d(u)&&(u.preventDefault(),c++,l(!0))}),s.addEventListener("dragover",u=>{d(u)&&(u.preventDefault(),u.dataTransfer&&(u.dataTransfer.dropEffect="copy"))}),s.addEventListener("dragleave",()=>{c>0&&c--,c===0&&l(!1)}),s.addEventListener("drop",async u=>{if(c=0,l(!1),!d(u))return;u.preventDefault();let h=null;try{h=JSON.parse(u.dataTransfer?.getData(At)??"")}catch{return}if(!h||!Array.isArray(h.ids))return;const p=h.ids.filter(g=>typeof g=="number"&&Number.isFinite(g));if(p.length===0)return;const m=a.categoryIds.slice(),_=Array.from(new Set([...m,...p]));_.length!==m.length&&(i(_),await r(_,m,f("Couldn’t add category.")))}),s.appendChild(n),s}function Hs(o,e){o.parentTitles.clear();for(const t of e)o.parentTitles.set(t.id,we(t))}function Kn(o,e){const t=document.createElement("span"),s=typeof o.parent=="number"?o.parent:0;if(s===0)return t.textContent="—",t.setAttribute("aria-label",f("Top-level page")),t;const n=e.parentTitles.get(s);return t.textContent=n?`↳ ${n}`:W(f("↳ #%d"),s),t}function Gn(o,e){const t=document.createElement("span"),s=typeof o.template=="string"?o.template:"",n=e.extra.pageTemplates??{};return t.textContent=n[s]??(s===""?f("Default template"):s),s!==""&&(t.title=s),t}function Xn(o,e){const t=document.createElement("button");t.type="button";const s=typeof o.slug=="string"?o.slug:"";return t.textContent=s||"—",t.disabled=s==="",t.title=s?f("Click to copy slug"):"",Object.assign(t.style,{appearance:"none",background:"transparent",border:"none",padding:"2px 6px",font:"inherit",color:"inherit",cursor:s?"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",n=>{n.stopPropagation(),s&&ls(s).then(a=>{if(!a){e.toast(f("Couldn’t copy the slug."),null);return}t.textContent=f("Copied!"),t.style.color="var(--wp-admin-theme-color, #2271b1)",setTimeout(()=>{t.textContent=s,t.style.color=""},1200)})}),t}function Yn(o){const e=document.createElement("span");Object.assign(e.style,{display:"inline-flex",alignItems:"center",gap:"6px",fontVariantNumeric:"tabular-nums"});const t=typeof o.openstation_comment_count=="number"?o.openstation_comment_count:null;if(t===null)return e.textContent="—",e.style.color="var(--os-ui-fg-muted, #8c8f94)",e;const s=document.createElement("span");s.className="dashicons dashicons-admin-comments",s.setAttribute("aria-hidden","true"),Object.assign(s.style,{fontSize:"16px",width:"16px",height:"16px",color:t>0?"var(--wp-admin-theme-color, #2271b1)":"var(--os-ui-fg-muted, #8c8f94)"});const n=document.createElement("span");return n.textContent=String(t),t===0&&(n.style.color="var(--os-ui-fg-muted, #8c8f94)"),e.appendChild(s),e.appendChild(n),e.setAttribute("aria-label",W(de("%d comment","%d comments",t),t)),e}const Zn=F` ${_e} ${Ct}: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__",$e="__wpd_select__",qe=class qe extends X{constructor(){super(...arguments),this._data=[],this._columns=[],this._filters={},this._expanded=new Set,this._subTable=null,this._sort=null,this._selection=new Set,this._getRowId=(e,t)=>t,this._filterCache=new Map,this._paintScheduled=!1,this._stacked=!1,this._stickyHeaderWarned=!1,this._stickyRaceWarned=!1,this._resizeObserver=null,this._stickyMicroScheduled=!1,this._stickyRafHandle=null,this._loadingDesyncWarned=!1,this._lastStickyIndex=-1}get data(){return this._data}set data(e){this._data=Array.isArray(e)?e.slice():[],this._expanded.clear(),this._schedulePaint()}get columns(){return this._columns}set columns(e){this._columns=Array.isArray(e)?e.slice():[];const t=new Set(this._columns.map(s=>s.key));for(const s of Object.keys(this._filters))t.has(s)||delete this._filters[s];for(const s of Array.from(this._filterCache.keys()))t.has(s)||this._filterCache.delete(s);this._sort&&!t.has(this._sort.key)&&(this._sort=null),this._schedulePaint()}get filters(){return{...this._filters}}set filters(e){this._filters=e?{...e}:{},this._schedulePaint()}get sort(){return this._sort?{...this._sort}:null}set sort(e){this._sort=e?{...e}:null,this._schedulePaint()}get selection(){return new Set(this._selection)}set selection(e){this._selection=new Set(e??[]),this._schedulePaint()}get selectedRows(){const e=[];return this._data.forEach((t,s)=>{this._selection.has(this._getRowId(t,s))&&e.push(t)}),e}get visibleRows(){return this._filteredRows().map(e=>e.row)}get getRowId(){return this._getRowId}set getRowId(e){this._getRowId=typeof e=="function"?e:(t,s)=>s,this._schedulePaint()}get subTable(){return this._subTable}set subTable(e){this._subTable=typeof e=="function"?e:null,this._expanded.clear(),this._schedulePaint()}get expanded(){return new Set(this._expanded)}set expanded(e){this._expanded=new Set(e??[]),this._schedulePaint()}expand(e){e<0||e>=this._data.length||this._expanded.has(e)||(this._expanded.add(e),this.emit("os-table-expand-change",{row:this._data[e],index:e,expanded:!0}),this._schedulePaint())}collapse(e){this._expanded.has(e)&&(this._expanded.delete(e),this.emit("os-table-expand-change",{row:this._data[e],index:e,expanded:!1}),this._schedulePaint())}expandAll(){if(!this._subTable)return;let e=!1;for(let t=0;t<this._data.length;t++)this._subTable(this._data[t],t)&&(this._expanded.has(t)||(this._expanded.add(t),e=!0));e&&this._schedulePaint()}collapseAll(){this._expanded.size!==0&&(this._expanded.clear(),this._schedulePaint())}isExpanded(e){return this._expanded.has(e)}clearFilters(){Object.keys(this._filters).length!==0&&(this._filters={},this.emit("os-table-filter-change",{filters:{}}),this._schedulePaint())}clearSort(){this._sort!==null&&(this._sort=null,this.emit("os-table-sort-change",{sort:null}),this._schedulePaint())}select(e){if(this._selection.has(e))return;const t=this._readSelectable(),s=t==="single"?Array.from(this._selection):[];t==="single"&&this._selection.clear(),this._selection.add(e),this._emitSelectionChange(),this._syncSelectionDom([e,...s])}deselect(e){this._selection.delete(e)&&(this._emitSelectionChange(),this._syncSelectionDom([e]))}selectAll(){if(this._readSelectable()==="multi"){for(const{row:e,index:t}of this._filteredRows())this._selection.add(this._getRowId(e,t));this._emitSelectionChange(),this._syncSelectionDom("all")}}clearSelection(){this._selection.size!==0&&(this._selection.clear(),this._emitSelectionChange(),this._syncSelectionDom("all"))}_syncSelectionDom(e){const t=this.shadowRoot;if(!t)return;const s=t.querySelector("tbody");if(!s)return;let n=null;if(e!=="all"){n=new Set;for(const r of e)n.add(String(r))}const a=s.querySelectorAll("tr[data-row-id]");for(const r of a){const c=r.dataset.rowId;if(c===void 0||n&&!n.has(c))continue;const l=Number(r.dataset.rowIndex);if(!Number.isFinite(l))continue;const d=this._data[l];if(d===void 0)continue;const u=this._getRowId(d,l),h=this._selection.has(u);r.classList.toggle("is-selected",h);const p=r.querySelector("input.select-row-checkbox");p&&p.checked!==h&&(p.checked=h)}const i=t.querySelector("thead .select-all-checkbox");if(i){const{total:r,selected:c}=this._visibleSelectionStats();i.checked=r>0&&c===r,i.indeterminate=c>0&&c<r}}scrollToRow(e){const t=this.shadowRoot;if(!t)return;const n=t.querySelectorAll("tbody tr:not(.subtable):not(.empty):not(.skeleton)")[e];n&&n.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 C` | |
| 234 | 201 | <div class="scroll" part="scroll"> |
| 235 | 202 | <table part="table"> |
| 236 | 203 | <colgroup></colgroup> |
| 237 | 204 | <thead></thead> |
| @@ -237,9 +204,9 @@ | ||
| 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")||xe(this.render(),e);const t=e.querySelector("colgroup"),o=e.querySelector("thead"),n=e.querySelector("tbody");if(!t||!o||!n)return;const a=this._effectiveColumns();this._stacked=this.hasAttribute("stacked");const i=this._readStickyColumns();this._lastStickyIndex=this._computeLastStickyIndex(a,i),this._paintColgroup(t,a),this._paintHead(o,a,i),this._paintBody(n,a,i),this._applyStickyOffsets(),this._measureHeaderHeight(),this._scheduleStickyOffsets(),this._maybeWarnStickyHeader(),this._maybeWarnLoadingDesync(n),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 n of t){const a=document.createElement("col");n.width&&(a.style.width=n.width),o.push(a)}e.replaceChildren(...o)}_paintHead(e,t,o){const n=document.createElement("tr");n.setAttribute("part","header-row");for(let l=0;l<t.length;l++)n.appendChild(this._buildHeaderCell(t[l],l,o));const a=e.querySelector(':scope > tr[part="header-row"]');a?e.replaceChild(n,a):e.insertBefore(n,e.firstChild);const i=t.some(l=>l.filter||Array.isArray(l.filterOptions)||typeof l.filterRender=="function");let r=e.querySelector(":scope > tr.filter-row");if(i){const l=[];for(let d=0;d<t.length;d++)l.push(this._buildFilterCell(t[d],d,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 u=c.length===l.length;if(u){for(let d=0;d<l.length;d++)if(c[d]!==l[d]){u=!1;break}}if(!u){const d=new Set(l);for(const h of l)r.appendChild(h);for(const h of Array.from(r.children))d.has(h)||r.removeChild(h)}}else r&&r.remove()}_buildHeaderCell(e,t,o){const n=document.createElement("th");if(n.setAttribute("scope","col"),n.dataset.key=e.key,this._applyCellClasses(n,e,t,o),e.minWidth&&(n.style.minWidth=e.minWidth),e.key===me){if(this._readSelectable()==="multi"){const i=document.createElement("input");i.type="checkbox",i.className="select-all-checkbox",i.setAttribute("data-noclick",""),i.setAttribute("aria-label","Select all rows");const{total:r,selected:l}=this._visibleSelectionStats();i.checked=r>0&&l===r,i.indeterminate=l>0&&l<r,i.addEventListener("change",()=>{i.checked?this.selectAll():this.clearSelection()}),n.appendChild(i)}return n}if(n.textContent=e.label??(e.key===ge?"":e.key),e.sortable){n.classList.add("is-sortable");const a=this._sort?.key===e.key,i=document.createElement("span");i.className="sort-indicator";let r="";a&&(r=this._sort.direction==="asc"?" ▲":" ▼"),i.textContent=r,n.appendChild(i),a&&n.classList.add(this._sort.direction==="asc"?"sort-asc":"sort-desc"),n.addEventListener("click",()=>this._cycleSort(e.key))}return n}_buildFilterCell(e,t,o){const n=this._filterCache.get(e.key),a=Array.isArray(e.filterOptions),i=typeof e.filterRender=="function";let r;if(!e.filter&&!a&&!i||e.key===ge||e.key===me?r="none":i?r="custom":e.filter==="select"||a?r="select":r="text",n&&n.kind===r){if(n.th.className="",this._applyCellClasses(n.th,e,t,o),r==="select"){const d=n.control,h=this._resolveFilterOptions(e),p=h.map(f=>f.value).join("|");p!==n.optionsKey?(this._populateSelect(d,h,this._filters[e.key]??""),n.optionsKey=p):d.value=this._filters[e.key]??""}else if(r==="text"){const d=n.control,h=this._filters[e.key]??"";d.value!==h&&d.ownerDocument.activeElement!==d&&(d.value=h)}else r==="custom"&&e.filterRender&&e.filterRender(n.th,{value:this._filters[e.key]??"",setValue:d=>this._onFilterChange(e.key,d),col:e});return n.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:d=>this._onFilterChange(e.key,d),col:e}),this._filterCache.set(e.key,{th:l,control:null,optionsKey:"",kind:"custom"}),l;let c,u="";if(r==="select"){const d=document.createElement("select");d.classList.add("filter-select"),d.setAttribute("data-noclick",""),d.setAttribute("aria-label",`Filter ${e.label??e.key}`);const h=this._resolveFilterOptions(e);this._populateSelect(d,h,this._filters[e.key]??""),u=h.map(p=>p.value).join("|"),d.addEventListener("change",()=>{this._onFilterChange(e.key,d.value)}),c=d}else{const d=document.createElement("input");d.type="search",d.classList.add("filter-input"),d.setAttribute("data-noclick",""),d.setAttribute("placeholder","Filter…"),d.setAttribute("aria-label",`Filter ${e.label??e.key}`),d.value=this._filters[e.key]??"",d.addEventListener("input",()=>{this._onFilterChange(e.key,d.value)}),c=d}return l.appendChild(c),this._filterCache.set(e.key,{th:l,control:c,optionsKey:u,kind:r}),l}_populateSelect(e,t,o){e.replaceChildren();const n=document.createElement("option");n.value="",n.textContent="All",e.appendChild(n);for(const a of t){const i=document.createElement("option");i.value=a.value,i.textContent=a.label,a.value===o&&(i.selected=!0),e.appendChild(i)}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 i=0;i<a;i++)e.appendChild(this._buildSkeletonRow(t,i));return}const n=this._sortedRows(this._filteredRows());if(n.length===0){e.appendChild(this._buildEmptyRow(t.length));return}for(const{row:a,index:i}of n)if(e.appendChild(this._stacked?this._buildStackedRow(a,i,t):this._buildBodyRow(a,i,t,o)),this._expanded.has(i)&&this._subTable){const r=this._subTable(a,i);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 n=document.createElement("slot");return n.name="empty",n.textContent=this.getAttribute("empty")||"No data",o.appendChild(n),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 n=document.createElement("td");n.className="stack-body",n.colSpan=Math.max(1,e.length);for(const a of[55+t*7%25,30+t*11%15]){const i=document.createElement("span");i.className="skeleton-bar",i.style.width=`${a}%`,n.appendChild(i)}return o.appendChild(n),o}for(const n of e){const a=document.createElement("td"),i=document.createElement("span");i.className="skeleton-bar";const r=50+(t*7+o.children.length*13)%40;i.style.width=`${r}%`,a.appendChild(i),o.appendChild(a)}return o}_buildBodyRow(e,t,o,n){const a=document.createElement("tr");a.setAttribute("part","row"),a.dataset.rowIndex=String(t);const i=this._getRowId(e,t);a.dataset.rowId=String(i),this._selection.has(i)&&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,n));return a}_buildStackedRow(e,t,o){const n=document.createElement("tr");n.setAttribute("part","row"),n.classList.add("stack-row"),n.dataset.rowIndex=String(t);const a=this._getRowId(e,t);n.dataset.rowId=String(a),this._selection.has(a)&&n.classList.add("is-selected"),n.addEventListener("click",c=>{this._onRowClick(e,t,c)});const i=document.createElement("td");i.className="stack-body";let r=0,l=0;for(let c=0;c<o.length;c++){const u=o[c];if(u.key===me||u.key===ge){n.appendChild(this._buildBodyCell(u,c,e,t,0));continue}l++;const d=pn(u,r++);if(d==="hidden")continue;const h=document.createElement("div");if(h.className=`stack-cell stack-${d}`,h.dataset.key=u.key,d==="meta"&&u.label){const b=document.createElement("span");b.className="stack-label",b.textContent=u.label,h.appendChild(b)}const p=document.createElement("span");p.className="stack-value";const f=e[u.key];u.render?this._mountCellContent(p,u.render(f,e,t)):f!=null&&(p.textContent=String(f)),h.appendChild(p),i.appendChild(h)}return i.colSpan=Math.max(1,l),n.appendChild(i),n}_buildBodyCell(e,t,o,n,a){const i=document.createElement("td");if(this._applyCellClasses(i,e,t,a),e.minWidth&&(i.style.minWidth=e.minWidth),e.key===me){const l=this._getRowId(o,n),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)}),i.appendChild(c),this._stacked&&(i.setAttribute("data-noclick",""),i.addEventListener("click",u=>{u.target===i&&(c.checked=!c.checked,c.dispatchEvent(new Event("change")))})),i}if(e.key===ge){if(!(this._subTable?!!this._subTable(o,n):!1))return i;const c=this._expanded.has(n),u=document.createElement("button");return u.type="button",u.className="expander",u.setAttribute("data-noclick",""),u.setAttribute("aria-expanded",c?"true":"false"),u.setAttribute("aria-label",c?"Collapse row":"Expand row"),u.textContent=c?"▾":"▸",u.addEventListener("click",d=>{this._toggleRow(n,o,d)}),i.appendChild(u),i}const r=o[e.key];if(e.render){const l=e.render(r,o,n);this._mountCellContent(i,l)}else r!=null&&(i.textContent=String(r));return i}_buildSubTableRow(e,t){const o=document.createElement("tr");o.classList.add("subtable"),o.setAttribute("part","subtable-row");const n=document.createElement("td");n.colSpan=t;const a=document.createElement("div");if(a.classList.add("subtable-inner"),e instanceof Node)a.appendChild(e);else if(so(e))xe(e,a);else{const i=document.createElement("os-table");i.columns=e.columns,i.data=e.data,e.subTable&&(i.subTable=e.subTable),a.appendChild(i)}return n.appendChild(a),o.appendChild(n),o}_mountCellContent(e,t){if(typeof t=="string"){e.textContent=t;return}if(t instanceof Node){e.appendChild(t);return}so(t)&&xe(t,e)}_onFilterChange(e,t){t===""?delete this._filters[e]:this._filters[e]=t,this.emit("os-table-filter-change",{filters:{...this._filters}});const n=this.shadowRoot?.querySelector("tbody");if(n){const a=this._effectiveColumns(),i=this._readStickyColumns();this._lastStickyIndex=this._computeLastStickyIndex(a,i),this._paintBody(n,a,i),this._applyStickyOffsets()}}_onRowClick(e,t,o){const n=o.composedPath?.()??[];for(const a of n){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 n=this._expanded.has(e);n?this._expanded.delete(e):this._expanded.add(e),this.emit("os-table-expand-change",{row:t,index:e,expanded:!n}),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 n=this._data[o];let a=!0;for(const i of t){const r=this._columns.find(d=>d.key===i);if(r&&typeof r.filterRender=="function")continue;const l=this._filters[i]??"",c=n[i],u=c==null?"":String(c);if(r?.filter==="select"){if(u!==l){a=!1;break}}else if(!u.toLowerCase().includes(l.toLowerCase())){a=!1;break}}a&&e.push({row:n,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,n=e.slice();return n.sort((a,i)=>{const r=t.sortValue?t.sortValue(a.row,a.row[t.key]):a.row[t.key],l=t.sortValue?t.sortValue(i.row,i.row[t.key]):i.row[t.key];return fn(r,l)*o}),n}_uniqueValues(e){const t=new Set;for(const o of this._data){const n=o[e];n!=null&&t.add(String(n))}return Array.from(t).sort()}_visibleSelectionStats(){let e=0,t=0;for(const{row:o,index:n}of this._filteredRows())e++,this._selection.has(this._getRowId(o,n))&&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 n=0;n<e.length;n++)this._isStickyIndex(n,t,e[n])&&(o=n);return o}_applyCellClasses(e,t,o,n){t.key===ge&&e.classList.add("col-expander"),t.key===me&&e.classList.add("col-select"),t.align==="center"&&e.classList.add("align-center"),t.align==="end"&&e.classList.add("align-end"),this._isStickyIndex(o,n,t)&&(e.classList.add("is-sticky"),o===this._lastStickyIndex&&e.classList.add("is-sticky-edge"))}_effectiveColumns(){const e=[];return this._readSelectable()&&e.push({key:me,label:"",width:"40px",align:"center"}),this._subTable&&e.push({key:ge,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),n=[];let a=0;for(let r=0;r<o.length;r++)n[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=`${n[c]}px`)}),this._maybeWarnStickyOffsetRace(o,n)}_maybeWarnStickyOffsetRace(e,t){if(this._stickyRaceWarned)return;const o=this._readStickyColumns();if(o<2)return;const n=Math.min(o-1,e.length-1);if(n<=0||t[n]!==0||this.offsetWidth===0)return;this._stickyRaceWarned=!0;const a=e[0]?.offsetWidth??0;console.warn(`[os-table] sticky-columns: column ${n} 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."))}};Re.props=["stickyColumns","stickyHeader","striped","hover","compact","bordered","empty","loading","loadingRows","selectable","stacked"],Re.styles=[hn],Re.help=void 0;let ut=Re;function so(s){return!!s&&s.__wpdHtml===!0}function pn(s,e){return s.stack?s.stack:e===0?"title":s.label?"meta":"actions"}function fn(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))}Q("os-table",ut);const gn=q` ${We}: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}}`,mn=q`:host{display:none}`,ze=class ze extends G{render(){return C``}};ze.props=["value","disabled"],ze.styles=[mn],ze.help=void 0;let ht=ze;Q("os-option",ht);const Ne=class Ne extends G{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 i=document.createElement("os-option");i.setAttribute("value",a.value),i.textContent=a.label,this.appendChild(i)}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(),Dt(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||"",n=this.disabled!==null;e&&this.setAttribute("aria-label",e);const a=this.getAttribute("aria-label")||"",i=e||a||o,r=this._readOptions(),l=r.find(f=>f.value===t),c=l?l.label:o,u=this.id||"os-unnamed",d=`${u}__listbox`,h=`${u}__trigger`,p=this._open&&this._activeIndex>=0?`${u}__opt-${this._activeIndex}`:"";return C` | |
| 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")||ke(this.render(),e);const t=e.querySelector("colgroup"),s=e.querySelector("thead"),n=e.querySelector("tbody");if(!t||!s||!n)return;const a=this._effectiveColumns();this._stacked=this.hasAttribute("stacked");const i=this._readStickyColumns();this._lastStickyIndex=this._computeLastStickyIndex(a,i),this._paintColgroup(t,a),this._paintHead(s,a,i),this._paintBody(n,a,i),this._applyStickyOffsets(),this._measureHeaderHeight(),this._scheduleStickyOffsets(),this._maybeWarnStickyHeader(),this._maybeWarnLoadingDesync(n),this._ensureResizeObserver()}_maybeWarnLoadingDesync(e){this._loadingDesyncWarned||this.hasAttribute("loading")&&(e.querySelector("tr.skeleton")||(this._loadingDesyncWarned=!0,console.warn("[os-table] `loading` attribute is set but no skeleton rows rendered. Either attributeChangedCallback didn't route through requestUpdate (framework regression), or `loading` was set after the most recent paint and no follow-up trigger ran. Toggling `data` will force a paint as a workaround.")))}_scheduleStickyOffsets(){this._stickyMicroScheduled||(this._stickyMicroScheduled=!0,queueMicrotask(()=>{this._stickyMicroScheduled=!1,this.isConnected&&this._applyStickyOffsets()})),this._stickyRafHandle===null&&typeof requestAnimationFrame<"u"&&(this._stickyRafHandle=requestAnimationFrame(()=>{this._stickyRafHandle=null,this.isConnected&&(this._applyStickyOffsets(),this._measureHeaderHeight())}))}_ensureResizeObserver(){if(this._resizeObserver||typeof ResizeObserver>"u")return;const e=this.shadowRoot?.querySelector(".scroll");e&&(this._resizeObserver=new ResizeObserver(()=>{this.isConnected&&(this._applyStickyOffsets(),this._measureHeaderHeight(),this._stickyHeaderWarned=!1,this._maybeWarnStickyHeader())}),this._resizeObserver.observe(e),this._resizeObserver.observe(this))}_paintColgroup(e,t){const s=[];for(const n of t){const a=document.createElement("col");n.width&&(a.style.width=n.width),s.push(a)}e.replaceChildren(...s)}_paintHead(e,t,s){const n=document.createElement("tr");n.setAttribute("part","header-row");for(let c=0;c<t.length;c++)n.appendChild(this._buildHeaderCell(t[c],c,s));const a=e.querySelector(':scope > tr[part="header-row"]');a?e.replaceChild(n,a):e.insertBefore(n,e.firstChild);const i=t.some(c=>c.filter||Array.isArray(c.filterOptions)||typeof c.filterRender=="function");let r=e.querySelector(":scope > tr.filter-row");if(i){const c=[];for(let u=0;u<t.length;u++)c.push(this._buildFilterCell(t[u],u,s));r||(r=document.createElement("tr"),r.classList.add("filter-row"),r.setAttribute("part","filter-row"),e.appendChild(r));const l=Array.from(r.children);let d=l.length===c.length;if(d){for(let u=0;u<c.length;u++)if(l[u]!==c[u]){d=!1;break}}if(!d){const u=new Set(c);for(const h of c)r.appendChild(h);for(const h of Array.from(r.children))u.has(h)||r.removeChild(h)}}else r&&r.remove()}_buildHeaderCell(e,t,s){const n=document.createElement("th");if(n.setAttribute("scope","col"),n.dataset.key=e.key,this._applyCellClasses(n,e,t,s),e.minWidth&&(n.style.minWidth=e.minWidth),e.key===$e){if(this._readSelectable()==="multi"){const i=document.createElement("input");i.type="checkbox",i.className="select-all-checkbox",i.setAttribute("data-noclick",""),i.setAttribute("aria-label","Select all rows");const{total:r,selected:c}=this._visibleSelectionStats();i.checked=r>0&&c===r,i.indeterminate=c>0&&c<r,i.addEventListener("change",()=>{i.checked?this.selectAll():this.clearSelection()}),n.appendChild(i)}return n}if(n.textContent=e.label??(e.key===Ce?"":e.key),e.sortable){n.classList.add("is-sortable");const a=this._sort?.key===e.key,i=document.createElement("span");i.className="sort-indicator";let r="";a&&(r=this._sort.direction==="asc"?" ▲":" ▼"),i.textContent=r,n.appendChild(i),a&&n.classList.add(this._sort.direction==="asc"?"sort-asc":"sort-desc"),n.addEventListener("click",()=>this._cycleSort(e.key))}return n}_buildFilterCell(e,t,s){const n=this._filterCache.get(e.key),a=Array.isArray(e.filterOptions),i=typeof e.filterRender=="function";let r;if(!e.filter&&!a&&!i||e.key===Ce||e.key===$e?r="none":i?r="custom":e.filter==="select"||a?r="select":r="text",n&&n.kind===r){if(n.th.className="",this._applyCellClasses(n.th,e,t,s),r==="select"){const u=n.control,h=this._resolveFilterOptions(e),p=h.map(m=>m.value).join("|");p!==n.optionsKey?(this._populateSelect(u,h,this._filters[e.key]??""),n.optionsKey=p):u.value=this._filters[e.key]??""}else if(r==="text"){const u=n.control,h=this._filters[e.key]??"";u.value!==h&&u.ownerDocument.activeElement!==u&&(u.value=h)}else r==="custom"&&e.filterRender&&e.filterRender(n.th,{value:this._filters[e.key]??"",setValue:u=>this._onFilterChange(e.key,u),col:e});return n.th}const c=document.createElement("th");if(this._applyCellClasses(c,e,t,s),r==="none")return this._filterCache.set(e.key,{th:c,control:null,optionsKey:"",kind:"none"}),c;if(r==="custom"&&e.filterRender)return e.filterRender(c,{value:this._filters[e.key]??"",setValue:u=>this._onFilterChange(e.key,u),col:e}),this._filterCache.set(e.key,{th:c,control:null,optionsKey:"",kind:"custom"}),c;let l,d="";if(r==="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(p=>p.value).join("|"),u.addEventListener("change",()=>{this._onFilterChange(e.key,u.value)}),l=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)}),l=u}return c.appendChild(l),this._filterCache.set(e.key,{th:c,control:l,optionsKey:d,kind:r}),c}_populateSelect(e,t,s){e.replaceChildren();const n=document.createElement("option");n.value="",n.textContent="All",e.appendChild(n);for(const a of t){const i=document.createElement("option");i.value=a.value,i.textContent=a.label,a.value===s&&(i.selected=!0),e.appendChild(i)}e.value=s}_resolveFilterOptions(e){return Array.isArray(e.filterOptions)?e.filterOptions:this._uniqueValues(e.key).map(t=>({value:t,label:t}))}_paintBody(e,t,s){if(e.replaceChildren(),this.hasAttribute("loading")){const a=this._readLoadingRows();for(let i=0;i<a;i++)e.appendChild(this._buildSkeletonRow(t,i));return}const n=this._sortedRows(this._filteredRows());if(n.length===0){e.appendChild(this._buildEmptyRow(t.length));return}for(const{row:a,index:i}of n)if(e.appendChild(this._stacked?this._buildStackedRow(a,i,t):this._buildBodyRow(a,i,t,s)),this._expanded.has(i)&&this._subTable){const r=this._subTable(a,i);r&&e.appendChild(this._buildSubTableRow(r,t.length))}}_buildEmptyRow(e){const t=document.createElement("tr");t.classList.add("empty");const s=document.createElement("td");s.colSpan=e;const n=document.createElement("slot");return n.name="empty",n.textContent=this.getAttribute("empty")||"No data",s.appendChild(n),t.appendChild(s),t}_buildSkeletonRow(e,t){const s=document.createElement("tr");if(s.classList.add("skeleton"),s.setAttribute("aria-hidden","true"),this._stacked){s.classList.add("stack-row");const n=document.createElement("td");n.className="stack-body",n.colSpan=Math.max(1,e.length);for(const a of[55+t*7%25,30+t*11%15]){const i=document.createElement("span");i.className="skeleton-bar",i.style.width=`${a}%`,n.appendChild(i)}return s.appendChild(n),s}for(const n of e){const a=document.createElement("td"),i=document.createElement("span");i.className="skeleton-bar";const r=50+(t*7+s.children.length*13)%40;i.style.width=`${r}%`,a.appendChild(i),s.appendChild(a)}return s}_buildBodyRow(e,t,s,n){const a=document.createElement("tr");a.setAttribute("part","row"),a.dataset.rowIndex=String(t);const i=this._getRowId(e,t);a.dataset.rowId=String(i),this._selection.has(i)&&a.classList.add("is-selected"),a.addEventListener("click",r=>{this._onRowClick(e,t,r)});for(let r=0;r<s.length;r++)a.appendChild(this._buildBodyCell(s[r],r,e,t,n));return a}_buildStackedRow(e,t,s){const n=document.createElement("tr");n.setAttribute("part","row"),n.classList.add("stack-row"),n.dataset.rowIndex=String(t);const a=this._getRowId(e,t);n.dataset.rowId=String(a),this._selection.has(a)&&n.classList.add("is-selected"),n.addEventListener("click",l=>{this._onRowClick(e,t,l)});const i=document.createElement("td");i.className="stack-body";let r=0,c=0;for(let l=0;l<s.length;l++){const d=s[l];if(d.key===$e||d.key===Ce){n.appendChild(this._buildBodyCell(d,l,e,t,0));continue}c++;const u=Jn(d,r++);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 g=document.createElement("span");g.className="stack-label",g.textContent=d.label,h.appendChild(g)}const p=document.createElement("span");p.className="stack-value";const m=e[d.key],_=et(m);d.render?this._mountCellContent(p,d.render(m,e,t)):_!==null?p.appendChild(this._slotFor(_)):m!=null&&(p.textContent=String(m)),h.appendChild(p),i.appendChild(h)}return i.colSpan=Math.max(1,c),n.appendChild(i),n}_buildBodyCell(e,t,s,n,a){const i=document.createElement("td");if(this._applyCellClasses(i,e,t,a),e.minWidth&&(i.style.minWidth=e.minWidth),e.key===$e){const l=this._getRowId(s,n),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(l),d.addEventListener("change",()=>{d.checked?this.select(l):this.deselect(l)}),i.appendChild(d),this._stacked&&(i.setAttribute("data-noclick",""),i.addEventListener("click",u=>{u.target===i&&(d.checked=!d.checked,d.dispatchEvent(new Event("change")))})),i}if(e.key===Ce){if(!(this._subTable?!!this._subTable(s,n):!1))return i;const d=this._expanded.has(n),u=document.createElement("button");return u.type="button",u.className="expander",u.setAttribute("data-noclick",""),u.setAttribute("aria-expanded",d?"true":"false"),u.setAttribute("aria-label",d?"Collapse row":"Expand row"),u.textContent=d?"▾":"▸",u.addEventListener("click",h=>{this._toggleRow(n,s,h)}),i.appendChild(u),i}const r=s[e.key],c=et(r);if(e.render){const l=e.render(r,s,n);this._mountCellContent(i,l)}else c!==null?i.appendChild(this._slotFor(c)):r!=null&&(i.textContent=String(r));return i}_slotFor(e){const t=document.createElement("slot");return t.name=e,t}_buildSubTableRow(e,t){const s=document.createElement("tr");s.classList.add("subtable"),s.setAttribute("part","subtable-row");const n=document.createElement("td");n.colSpan=t;const a=document.createElement("div");if(a.classList.add("subtable-inner"),e instanceof Node)a.appendChild(e);else if(qs(e))ke(e,a);else{const i=document.createElement("os-table");i.columns=e.columns,i.data=e.data,e.subTable&&(i.subTable=e.subTable),a.appendChild(i)}return n.appendChild(a),s.appendChild(n),s}_mountCellContent(e,t){if(typeof t=="string"){e.textContent=t;return}if(t instanceof Node){e.appendChild(t);return}qs(t)&&ke(t,e)}_onFilterChange(e,t){t===""?delete this._filters[e]:this._filters[e]=t,this.emit("os-table-filter-change",{filters:{...this._filters}});const n=this.shadowRoot?.querySelector("tbody");if(n){const a=this._effectiveColumns(),i=this._readStickyColumns();this._lastStickyIndex=this._computeLastStickyIndex(a,i),this._paintBody(n,a,i),this._applyStickyOffsets()}}_onRowClick(e,t,s){const n=s.composedPath?.()??[];for(const a of n){if(a instanceof Element&&a.hasAttribute("data-noclick"))return;if(a===this)break}this.emit("os-table-row-click",{row:e,index:t,originalEvent:s})}_toggleRow(e,t,s){s.stopPropagation();const n=this._expanded.has(e);n?this._expanded.delete(e):this._expanded.add(e),this.emit("os-table-expand-change",{row:t,index:e,expanded:!n}),this._schedulePaint()}_cycleSort(e){!this._sort||this._sort.key!==e?this._sort={key:e,direction:"asc"}:this._sort.direction==="asc"?this._sort={key:e,direction:"desc"}:this._sort=null,this.emit("os-table-sort-change",{sort:this._sort?{...this._sort}:null}),this._schedulePaint()}_emitSelectionChange(){this.emit("os-table-selection-change",{selection:Array.from(this._selection),rows:this.selectedRows})}_filteredRows(){const e=[],t=Object.keys(this._filters).filter(s=>this._filters[s]!=="");for(let s=0;s<this._data.length;s++){const n=this._data[s];let a=!0;for(const i of t){const r=this._columns.find(u=>u.key===i);if(r&&typeof r.filterRender=="function")continue;const c=this._filters[i]??"",l=n[i],d=It(l);if(r?.filter==="select"){if(d!==c){a=!1;break}}else if(!d.toLowerCase().includes(c.toLowerCase())){a=!1;break}}a&&e.push({row:n,index:s})}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 s=this._sort.direction==="desc"?-1:1,n=e.slice();return n.sort((a,i)=>{const r=a.row[t.key],c=i.row[t.key],l=t.sortValue?t.sortValue(a.row,r):Fs(r),d=t.sortValue?t.sortValue(i.row,c):Fs(c);return Qn(l,d)*s}),n}_uniqueValues(e){const t=new Set;for(const s of this._data){const n=s[e];n!=null&&t.add(It(n))}return Array.from(t).sort()}_visibleSelectionStats(){let e=0,t=0;for(const{row:s,index:n}of this._filteredRows())e++,this._selection.has(this._getRowId(s,n))&&t++;return{total:e,selected:t}}_readStickyColumns(){const e=parseInt(this.getAttribute("sticky-columns")||"0",10);return Number.isFinite(e)&&e>0?e:0}_readLoadingRows(){const e=parseInt(this.getAttribute("loading-rows")||"5",10);return Number.isFinite(e)&&e>0?Math.min(e,100):5}_readSelectable(){const e=this.getAttribute("selectable");return e==="single"?"single":e==="multi"||e===""?"multi":null}_isStickyIndex(e,t,s){return this._stacked||s.sticky===!1?!1:s.sticky===!0?!0:e<t}_computeLastStickyIndex(e,t){let s=-1;for(let n=0;n<e.length;n++)this._isStickyIndex(n,t,e[n])&&(s=n);return s}_applyCellClasses(e,t,s,n){t.key===Ce&&e.classList.add("col-expander"),t.key===$e&&e.classList.add("col-select"),t.align==="center"&&e.classList.add("align-center"),t.align==="end"&&e.classList.add("align-end"),this._isStickyIndex(s,n,t)&&(e.classList.add("is-sticky"),s===this._lastStickyIndex&&e.classList.add("is-sticky-edge"))}_effectiveColumns(){const e=[];return this._readSelectable()&&e.push({key:$e,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 s=Array.from(t.children),n=[];let a=0;for(let r=0;r<s.length;r++)n[r]=a,s[r].classList.contains("is-sticky")&&(a+=s[r].offsetWidth);e.querySelectorAll("thead tr, tbody tr:not(.subtable):not(.empty):not(.skeleton)").forEach(r=>{const c=Array.from(r.children);for(let l=0;l<c.length;l++)c[l].classList.contains("is-sticky")&&(c[l].style.insetInlineStart=`${n[l]}px`)}),this._maybeWarnStickyOffsetRace(s,n)}_maybeWarnStickyOffsetRace(e,t){if(this._stickyRaceWarned)return;const s=this._readStickyColumns();if(s<2)return;const n=Math.min(s-1,e.length-1);if(n<=0||t[n]!==0||this.offsetWidth===0)return;this._stickyRaceWarned=!0;const a=e[0]?.offsetWidth??0;console.warn(`[os-table] sticky-columns: column ${n} 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 s=t.offsetHeight;s>0&&this.style.setProperty("--os-ui-table-header-height",`${s}px`)}_maybeWarnStickyHeader(){if(this._stickyHeaderWarned||!this.hasAttribute("sticky-header")||this.hasAttribute("loading")||this._data.length<8)return;const e=this.shadowRoot?.querySelector(".scroll");e&&e.offsetWidth!==0&&e.scrollHeight<=e.clientHeight+1&&(this._stickyHeaderWarned=!0,console.warn("[os-table] sticky-header is set but the table has no scroll container. Set --os-ui-table-max-height on the host (or wrap it in a scrolling parent) so the header has something to stick to."))}};qe.props=["stickyColumns","stickyHeader","striped","hover","compact","bordered","empty","loading","loadingRows","selectable","stacked"],qe.styles=[Zn],qe.help=void 0;let Mt=qe;function qs(o){return!!o&&o.__wpdHtml===!0}function Jn(o,e){return o.stack?o.stack:e===0?"title":o.label?"meta":"actions"}function et(o){return o&&typeof o=="object"&&typeof o.slot=="string"?o.slot:null}function It(o){if(o==null)return"";if(et(o)!==null){const e=o.text;return e==null?"":String(e)}return String(o)}function Fs(o){return et(o)!==null?It(o):o}function Qn(o,e){if(o===e)return 0;if(o==null)return-1;if(e==null)return 1;if(typeof o=="number"&&typeof e=="number")return o-e;if(o instanceof Date&&e instanceof Date)return o.getTime()-e.getTime();const t=Number(o),s=Number(e);return Number.isFinite(t)&&Number.isFinite(s)?t-s:String(o).localeCompare(String(e))}Q("os-table",Mt);const ei=F` ${_e}: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}}`,ti=F`:host{display:none}`,Fe=class Fe extends X{render(){return C``}};Fe.props=["value","disabled"],Fe.styles=[ti],Fe.help=void 0;let Lt=Fe;Q("os-option",Lt);const Ue=class Ue extends X{constructor(){super(...arguments),this._optionObserver=null,this._open=!1,this._activeIndex=-1,this._typed="",this._dismissedAt=0,this._typedTimer=null,this._onWindowScroll=e=>{const t=e.target,s=this._popup();s&&t instanceof Node&&(t===s||s.contains(t))||this._hide()},this._onWindowResize=()=>this._hide()}set items(e){const t=this.querySelectorAll(":scope > os-option");for(const a of Array.from(t))a.remove();for(const a of e){const i=document.createElement("os-option");i.setAttribute("value",a.value),i.textContent=a.label,this.appendChild(i)}const s=this.value;!(s!==null&&e.some(a=>a.value===s))&&e.length>0&&(this.value=e[0].value),this.requestUpdate()}connectedCallback(){super.connectedCallback(),gt(this),this._optionObserver=new MutationObserver(()=>this.requestUpdate()),this._optionObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value","disabled"],characterData:!0})}disconnectedCallback(){this._optionObserver?.disconnect(),this._optionObserver=null,this._teardownDismiss(),this._open=!1,this._typedTimer&&(clearTimeout(this._typedTimer),this._typedTimer=null)}render(){const e=this.label||"",t=this.value,s=this.placeholder||"",n=this.disabled!==null;e&&this.setAttribute("aria-label",e);const a=this.getAttribute("aria-label")||"",i=e||a||s,r=this._readOptions(),c=r.find(m=>m.value===t),l=c?c.label:s,d=this.id||"os-unnamed",u=`${d}__listbox`,h=`${d}__trigger`,p=this._open&&this._activeIndex>=0?`${d}__opt-${this._activeIndex}`:"";return C` | |
| 242 | 209 | ${e?C`<label |
| 243 | 210 | class="os-select__label" |
| 244 | 211 | for=${h} |
| 245 | 212 | >${e}</label>`:C``} |
| @@ -249,55 +216,55 @@ | ||
| 249 | 216 | id=${h} |
| 250 | 217 | role="combobox" |
| 251 | 218 | aria-haspopup="listbox" |
| 252 | 219 | aria-expanded=${this._open?"true":"false"} |
| 253 | - aria-controls=${d} | |
| 220 | + aria-controls=${u} | |
| 254 | 221 | aria-label=${i} |
| 255 | 222 | aria-activedescendant=${p} |
| 256 | 223 | ?disabled=${n} |
| 257 | 224 | @click=${()=>this._toggle()} |
| 258 | - @keydown=${f=>this._onTriggerKeydown(f)} | |
| 225 | + @keydown=${m=>this._onTriggerKeydown(m)} | |
| 259 | 226 | > |
| 260 | 227 | <span |
| 261 | - class="os-select__value${l?"":" os-select__value--placeholder"}" | |
| 262 | - >${c}</span | |
| 228 | + class="os-select__value${c?"":" os-select__value--placeholder"}" | |
| 229 | + >${l}</span | |
| 263 | 230 | > |
| 264 | - ${J("chevron-right",{size:16,rotate:90,className:"os-select__chevron"})} | |
| 231 | + ${se("chevron-right",{size:16,rotate:90,className:"os-select__chevron"})} | |
| 265 | 232 | </button> |
| 266 | 233 | <div |
| 267 | 234 | class="os-select__popup" |
| 268 | - id=${d} | |
| 235 | + id=${u} | |
| 269 | 236 | role="listbox" |
| 270 | 237 | popover="auto" |
| 271 | 238 | aria-label=${i} |
| 272 | - @toggle=${f=>this._onPopoverToggle(f)} | |
| 239 | + @toggle=${m=>this._onPopoverToggle(m)} | |
| 273 | 240 | > |
| 274 | - ${r.map((f,b)=>C` | |
| 241 | + ${r.map((m,_)=>C` | |
| 275 | 242 | <div |
| 276 | 243 | class="os-select__option" |
| 277 | - id=${`${u}__opt-${b}`} | |
| 244 | + id=${`${d}__opt-${_}`} | |
| 278 | 245 | role="option" |
| 279 | - data-value=${f.value} | |
| 280 | - aria-selected=${f.value===t?"true":"false"} | |
| 281 | - aria-disabled=${f.disabled?"true":"false"} | |
| 282 | - ?data-active=${this._open&&b===this._activeIndex} | |
| 283 | - @click=${()=>this._onOptionClick(f)} | |
| 284 | - @pointermove=${()=>this._setActive(b)} | |
| 246 | + data-value=${m.value} | |
| 247 | + aria-selected=${m.value===t?"true":"false"} | |
| 248 | + aria-disabled=${m.disabled?"true":"false"} | |
| 249 | + ?data-active=${this._open&&_===this._activeIndex} | |
| 250 | + @click=${()=>this._onOptionClick(m)} | |
| 251 | + @pointermove=${()=>this._setActive(_)} | |
| 285 | 252 | > |
| 286 | - ${J("check",{size:16,className:"os-select__check"})} | |
| 253 | + ${se("check",{size:16,className:"os-select__check"})} | |
| 287 | 254 | <span class="os-select__option-label" |
| 288 | - >${f.label}</span | |
| 255 | + >${m.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 n=o.getAttribute("value");n!==null&&e.push({value:n,label:(o.textContent||n).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(),n=this.value,a=o.findIndex(r=>r.value===n&&!r.disabled);this._activeIndex=a>=0?a:o.findIndex(r=>!r.disabled);const i=t.getBoundingClientRect();e.style.minWidth=`${i.width}px`,typeof e.showPopover=="function"?(e.style.left=`${i.left}px`,e.style.top=`${i.bottom+4}px`,e.showPopover(),i.bottom+4+e.offsetHeight>window.innerHeight-8&&(e.style.top=`${Math.max(8,i.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 n=0;n<t.length&&(o=Math.min(Math.max(o+e,0),t.length-1),!(!t[o]?.disabled||o===0||o===t.length-1));n++);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(n=>!n.disabled&&n.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)}}}};Ne.props=["value","label","placeholder","disabled","name"],Ne.styles=[gn],Ne.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:C` | |
| 260 | + `}_readOptions(){const e=[],t=this.querySelectorAll(":scope > os-option");for(const s of Array.from(t)){const n=s.getAttribute("value");n!==null&&e.push({value:n,label:(s.textContent||n).trim(),disabled:s.hasAttribute("disabled")})}return e}_popup(){return this.shadowRoot?.querySelector(".os-select__popup")??null}_trigger(){return this.shadowRoot?.querySelector(".os-select__trigger")??null}_toggle(){if(this._open){this._hide();return}performance.now()-this._dismissedAt<250||this._show()}_show(){const e=this._popup(),t=this._trigger();if(!e||!t||this._open)return;this._open=!0;const s=this._readOptions(),n=this.value,a=s.findIndex(r=>r.value===n&&!r.disabled);this._activeIndex=a>=0?a:s.findIndex(r=>!r.disabled);const i=t.getBoundingClientRect();e.style.minWidth=`${i.width}px`,typeof e.showPopover=="function"?(e.style.left=`${i.left}px`,e.style.top=`${i.bottom+4}px`,e.showPopover(),i.bottom+4+e.offsetHeight>window.innerHeight-8&&(e.style.top=`${Math.max(8,i.top-4-e.offsetHeight)}px`)):e.setAttribute("data-open",""),window.addEventListener("scroll",this._onWindowScroll,{capture:!0,passive:!0}),window.addEventListener("resize",this._onWindowResize),this.requestUpdate(),this._scrollActiveIntoView()}_hide(){if(!this._open)return;this._open=!1;const e=this._popup();if(e){if(typeof e.hidePopover=="function")try{e.hidePopover()}catch{}e.removeAttribute("data-open")}this._teardownDismiss(),this.requestUpdate()}_teardownDismiss(){window.removeEventListener("scroll",this._onWindowScroll,{capture:!0}),window.removeEventListener("resize",this._onWindowResize)}_onPopoverToggle(e){e.newState==="closed"&&this._open&&(this._dismissedAt=performance.now(),this._open=!1,this._teardownDismiss(),this.requestUpdate())}_onOptionClick(e){e.disabled||this._commit(e.value)}_commit(e){this._hide(),this.value=e,this.emit("os-pick",{value:e})}_setActive(e){if(e===this._activeIndex)return;const t=this._readOptions();!t[e]||t[e].disabled||(this._activeIndex=e,this.requestUpdate())}_moveActive(e){const t=this._readOptions();let s=this._activeIndex;for(let n=0;n<t.length&&(s=Math.min(Math.max(s+e,0),t.length-1),!(!t[s]?.disabled||s===0||s===t.length-1));n++);s!==this._activeIndex&&t[s]&&!t[s].disabled&&(this._activeIndex=s,this.requestUpdate(),this._scrollActiveIntoView())}_scrollActiveIntoView(){queueMicrotask(()=>{this.shadowRoot?.querySelector(".os-select__option[data-active]")?.scrollIntoView?.({block:"nearest"})})}_typeAhead(e){this._typedTimer&&clearTimeout(this._typedTimer),this._typed+=e.toLowerCase(),this._typedTimer=setTimeout(()=>{this._typed=""},500);const s=this._readOptions().findIndex(n=>!n.disabled&&n.label.toLowerCase().startsWith(this._typed));s>=0&&(this._activeIndex=s,this.requestUpdate(),this._scrollActiveIntoView())}_onTriggerKeydown(e){const t=this._readOptions();if(t.length!==0){if(!this._open){if(["ArrowDown","ArrowUp","Enter"," ","Home","End"].includes(e.key)){if(e.preventDefault(),this._show(),e.key==="Home"&&(this._activeIndex=t.findIndex(s=>!s.disabled)),e.key==="End"){for(let s=t.length-1;s>=0;s--)if(!t[s].disabled){this._activeIndex=s;break}}this.requestUpdate()}else e.key.length===1&&e.key.trim()!==""&&(this._show(),this._typeAhead(e.key));return}switch(e.key){case"ArrowDown":e.preventDefault(),this._moveActive(1);break;case"ArrowUp":e.preventDefault(),this._moveActive(-1);break;case"Home":e.preventDefault(),this._activeIndex=t.findIndex(s=>!s.disabled),this.requestUpdate(),this._scrollActiveIntoView();break;case"End":e.preventDefault();for(let s=t.length-1;s>=0;s--)if(!t[s].disabled){this._activeIndex=s,this.requestUpdate(),this._scrollActiveIntoView();break}break;case"Enter":case" ":{e.preventDefault();const s=t[this._activeIndex];s&&!s.disabled&&this._commit(s.value);break}case"Tab":{const s=t[this._activeIndex];s&&!s.disabled?this._commit(s.value):this._hide();break}case"Escape":e.preventDefault(),this._hide();break;default:e.key.length===1&&e.key.trim()!==""&&this._typeAhead(e.key)}}}};Ue.props=["value","label","placeholder","disabled","name"],Ue.styles=[ei],Ue.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:C` | |
| 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 pt=Ne;Q("os-select",pt);const bn=q` | |
| 266 | + `};let Pt=Ue;Q("os-select",Pt);const si=F` | |
| 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 _n(){const s="os-multiselect-popover-styles";if(document.getElementById(s))return;const e=document.createElement("style");e.id=s,e.textContent=` | |
| 351 | +`;function oi(){const o="os-multiselect-popover-styles";if(document.getElementById(o))return;const e=document.createElement("style");e.id=o,e.textContent=` | |
| 385 | 352 | .os-multiselect__popover { |
| 386 | 353 | position: fixed; |
| 387 | 354 | z-index: 100000; |
| 388 | 355 | max-height: 320px; |
| @@ -482,64 +449,151 @@ | ||
| 482 | 449 | |
| 483 | 450 | @keyframes os-multiselect-spin { |
| 484 | 451 | to { transform: rotate( 360deg ); } |
| 485 | 452 | } |
| 486 | -`,document.head.appendChild(e)}typeof document<"u"&&_n();const De=class De extends G{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 i=document.createElement("os-option");i.setAttribute("value",a.value),i.textContent=a.label,this.appendChild(i)}this._loadingMore=!1;const o=new Set(e.map(a=>a.value)),n=this._readValues().filter(a=>o.has(a));this._writeValueAttribute(n),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 n=document.createElement("os-option");n.setAttribute("value",o.value),n.textContent=o.label,this.appendChild(n)}this.requestUpdate(),this._refreshPopover()}connectedCallback(){super.connectedCallback(),Dt(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 n=e||t,a=this._summarize(t),i=this._readValues().length>0,l=`${this.id||"os-unnamed"}__trigger`;return C` | |
| 453 | +`,document.head.appendChild(e)}typeof document<"u"&&oi();const We=class We extends X{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 i=document.createElement("os-option");i.setAttribute("value",a.value),i.textContent=a.label,this.appendChild(i)}this._loadingMore=!1;const s=new Set(e.map(a=>a.value)),n=this._readValues().filter(a=>s.has(a));this._writeValueAttribute(n),this.requestUpdate(),this._refreshPopover()}get values(){return this._readValues()}set values(e){const t=Array.isArray(e)?e.map(s=>String(s)).filter(s=>s!==""):[];this._writeValueAttribute(t),this.requestUpdate(),this._refreshPopover()}get hasMore(){return this._hasMore}set hasMore(e){this._hasMore=!!e,this._refreshPopover()}get loadingMore(){return this._loadingMore}set loadingMore(e){this._loadingMore=!!e,this._refreshPopover()}appendItems(e){if(this._loadingMore=!1,!e||e.length===0){this._refreshPopover();return}const t=new Set(Array.from(this.querySelectorAll(":scope > os-option")).map(s=>s.getAttribute("value")));for(const s of e){if(t.has(s.value))continue;const n=document.createElement("os-option");n.setAttribute("value",s.value),n.textContent=s.label,this.appendChild(n)}this.requestUpdate(),this._refreshPopover()}connectedCallback(){super.connectedCallback(),gt(this),this._optionObserver=new MutationObserver(()=>{this.requestUpdate(),this._refreshPopover()}),this._optionObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value","disabled"],characterData:!0})}disconnectedCallback(){this._optionObserver?.disconnect(),this._optionObserver=null,this._closePopover()}render(){const e=this.label||"",t=this.placeholder||"All",s=this.disabled!==null;e?this.setAttribute("aria-label",e):this.removeAttribute("aria-label");const n=e||t,a=this._summarize(t),i=this._readValues().length>0,c=`${this.id||"os-unnamed"}__trigger`;return C` | |
| 487 | 454 | ${e?C`<label |
| 488 | 455 | class="os-multiselect__label" |
| 489 | - for=${l} | |
| 456 | + for=${c} | |
| 490 | 457 | >${e}</label>`:C``} |
| 491 | 458 | <button |
| 492 | - id=${l} | |
| 459 | + id=${c} | |
| 493 | 460 | type="button" |
| 494 | 461 | class="os-multiselect__trigger" |
| 495 | 462 | aria-haspopup="listbox" |
| 496 | 463 | aria-expanded=${this._isOpen()?"true":"false"} |
| 497 | 464 | aria-label=${n} |
| 498 | - ?disabled=${o} | |
| 465 | + ?disabled=${s} | |
| 499 | 466 | data-active=${i?"true":"false"} |
| 500 | - @click=${c=>this._onTriggerClick(c)} | |
| 467 | + @click=${l=>this._onTriggerClick(l)} | |
| 501 | 468 | > |
| 502 | 469 | <span class="os-multiselect__summary">${a}</span> |
| 503 | - ${J("chevron-right",{size:16,rotate:90,className:"os-multiselect__chevron"})} | |
| 470 | + ${se("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 n=o.getAttribute("value");n!==null&&e.push({value:n,label:(o.textContent||n).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(),n=new Map(o.map(a=>[a.value,a.label]));return t.length===1?n.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=i=>{const r=i.target;if(!r)return;const l=this.shadowRoot?.querySelector(".os-multiselect__trigger");e.contains(r)||l&&l.contains(r)||this._closePopover()},o=i=>{i.key==="Escape"&&(i.stopPropagation(),this._closePopover(),this.shadowRoot?.querySelector(".os-multiselect__trigger")?.focus())},n=()=>this._placePopover(),a=()=>{if(!this._hasMore||this._loadingMore)return;const i=e.scrollHeight,r=e.clientHeight,l=e.scrollTop;i-(l+r)<64&&this.emit("os-multiselect-load-more",{})};setTimeout(()=>{document.addEventListener("pointerdown",t,!0)},0),document.addEventListener("keydown",o,!0),window.addEventListener("resize",n),window.addEventListener("scroll",n,!0),e.addEventListener("scroll",a),this._teardownOpen=()=>{document.removeEventListener("pointerdown",t,!0),document.removeEventListener("keydown",o,!0),window.removeEventListener("resize",n),window.removeEventListener("scroll",n,!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 n=document.createElement("div");n.className="os-multiselect__empty",n.textContent="No options",e.appendChild(n);return}if(o.size>0){const n=document.createElement("button");n.type="button",n.className="os-multiselect__clear",n.textContent="Clear",n.addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),this._writeValueAttribute([]),this.requestUpdate(),this._refreshPopover(),this._emitPick()}),e.appendChild(n)}for(const n of t){const a=document.createElement("label");a.className="os-multiselect__option",a.setAttribute("role","option"),a.setAttribute("aria-selected",o.has(n.value)?"true":"false"),n.disabled&&(a.setAttribute("aria-disabled","true"),a.dataset.disabled="true");const i=document.createElement("input");i.type="checkbox",i.checked=o.has(n.value),i.disabled=n.disabled,i.addEventListener("change",()=>{const l=new Set(this._readValues());i.checked?l.add(n.value):l.delete(n.value);const c=t.map(u=>u.value).filter(u=>l.has(u));this._writeValueAttribute(c),a.setAttribute("aria-selected",i.checked?"true":"false"),this.requestUpdate(),this._refreshPopover(),this._emitPick()});const r=document.createElement("span");r.textContent=n.label,a.appendChild(i),a.appendChild(r),e.appendChild(a)}if(this._loadingMore){const n=document.createElement("div");n.className="os-multiselect__loading";const a=document.createElement("span");a.className="os-multiselect__spinner",a.setAttribute("aria-hidden","true");const i=document.createElement("span");i.textContent="Loading…",n.appendChild(a),n.appendChild(i),e.appendChild(n)}}_placePopover(){const e=this._popover,t=this.shadowRoot?.querySelector(".os-multiselect__trigger");if(!e||!t)return;const o=t.getBoundingClientRect(),n=window.innerWidth,a=window.innerHeight,i=Math.max(o.width,200);e.style.minWidth=`${i}px`;let r=o.left;r+i>n-8&&(r=Math.max(8,n-i-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})}};De.props=["value","label","placeholder","disabled","name","open"],De.styles=[bn],De.help=void 0;let ft=De;Q("os-multiselect",ft);const vn="openstation.postsWindow.columns",yn="openstation.postsWindow.statusSegments",xn="openstation.postsWindow.bulkActions",wn="openstation.postsWindow.toolbarTrailing",kn="openstation.postsWindow.opened",Cn="openstation.postsWindow.dataLoaded",gt="[openstation:desktop-mode-posts]",no=new Set(["title"]),Sn=new Set(["title","author","parent","date"]);function mt(){try{const s=window.wp?.os;if(s&&typeof s.getOsSettings=="function"){const e=s.getOsSettings();if(Array.isArray(e.nativePostsHiddenColumns))return new Set(e.nativePostsHiddenColumns)}}catch{}return new Set}const io={authors:[],tags:[]};function ao(s,e,t,o){const n="osPostsFilterMounted",a=s,i=t.map(c=>({value:String(c.id),label:c.name})),r=i.map(c=>`${c.value}:${c.label}`).join("|");if(a[n]){const c=a[n];c.listSig!==r&&(c.picker.items=i,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=i,l.hasMore=!!o.hasMore,l.addEventListener("os-pick",c=>{const u=c.detail?.value??"";e.value=u,e.setValue(u)}),o.onLoadMore){const c=o.onLoadMore;l.addEventListener("os-multiselect-load-more",()=>{l.loadingMore=!0,c()})}a[n]={picker:l,listSig:r}}function $n(s,e,t){const o={key:"title",label:m("Title"),sortable:!0,sticky:!0,render:(c,u)=>se(e,u.id,"title",()=>Ls(u,s))},n={key:"author",label:m("Author"),sortable:!0,width:"180px",filterRender:(c,u)=>ao(c,u,t.authors,{label:m("All authors"),ariaLabel:m("Filter by author")}),render:(c,u)=>se(e,u.id,"author",()=>Is(u))},a={key:"date",label:m("Date"),sortable:!0,width:"170px",sortValue:c=>Date.parse(c.date_gmt+"Z")||0,render:(c,u)=>se(e,u.id,"date",()=>Rs(u))};if(s.extra.mode==="pages")return[o,n,{key:"parent",label:m("Parent"),width:"200px",render:(c,u)=>se(e,u.id,"parent",()=>ln(u,s))},{key:"template",label:m("Template"),width:"180px",render:(c,u)=>se(e,u.id,"template",()=>cn(u,s))},{key:"slug",label:m("Slug"),width:"200px",render:(c,u)=>se(e,u.id,"slug",()=>dn(u,s))},{key:"comments",label:m("Comments"),width:"110px",sortValue:c=>typeof c.openstation_comment_count=="number"?c.openstation_comment_count:0,render:(c,u)=>se(e,u.id,"comments",()=>un(u))},a];const i=[o,n],{categories:r,tags:l}=s.cells;return r&&i.push({key:"categories",label:m("Categories"),width:"260px",render:(c,u)=>se(e,u.id,"categories",()=>r(u,s))}),l&&i.push({key:"tags",label:m("Tags"),minWidth:"360px",filterRender:(c,u)=>ao(c,u,t.tags.map(d=>({id:d.id,name:d.name})),{label:m("All tags"),ariaLabel:m("Filter by tag"),dataKey:"tags",hasMore:!!t.tagsHasMore,onLoadMore:t.loadMoreTags}),render:(c,u)=>se(e,u.id,"tags",()=>l(u,s))}),i.push(a),i}function ro(s,e,t=io){const o=$n(s,e,t),n=window.wp?.hooks;return n&&typeof n.applyFilters=="function"?n.applyFilters(vn,o):o}function En(s){return ro(s,new Map).filter(e=>!no.has(e.key)).map(e=>({key:e.key,label:e.label||e.key}))}function An(s,e,t=io,o=!1,n=mt()){const a=ro(s,e,t),i=n.size===0?a:a.filter(r=>no.has(r.key)||!n.has(r.key));return o?i.filter(r=>Sn.has(r.key)):i}function Tn(){return[{value:"",label:m("All")},{value:"publish",label:m("Published")},{value:"draft",label:m("Drafts")},{value:"pending",label:m("Pending")},{value:"future",label:m("Scheduled")},{value:"trash",label:m("Trash")}]}function Pn(){const s=window.wp?.hooks,e=Tn();if(!s||typeof s.applyFilters!="function")return e;try{const t=s.applyFilters(yn,e);return Array.isArray(t)&&t.length>0?t:e}catch(t){return console.error(`${gt} status-segments filter threw; falling back to defaults:`,t),e}}function Mn(s,e){return[{id:"trash",label:m("Move to trash"),icon:"dashicons-trash",variant:"danger",confirm:t=>V(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 n=o.table.data??[],a=t.filter(i=>{const r=n.find(l=>l.id===i);return r&&r.status!=="trash"});return a.length>0&&await e(a),o.table.clearSelection(),!1}}]}function Ln(s){const e=window.wp?.hooks;if(!e||typeof e.applyFilters!="function")return s;try{const t=e.applyFilters(xn,s);return Array.isArray(t)?t:s}catch(t){return console.error(`${gt} bulk-actions filter threw; falling back to defaults:`,t),s}}function In(s){const e=window.wp?.hooks;if(!e||typeof e.applyFilters!="function")return[];try{const t=e.applyFilters(wn,[],s);return Array.isArray(t)?t.filter(o=>o instanceof HTMLElement):[]}catch(t){return console.error(`${gt} toolbar-trailing filter threw; ignoring:`,t),[]}}function Rn(s,e="date"){switch(s){case"title":case"author":case"date":case"modified":return s;case"comments":return"comment_count";default:return e}}function zn(s){return s==="comment_count"?"comments":s}function Be(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 re(s){const e=new URLSearchParams;for(const[o,n]of Object.entries(s))n!==void 0&&n!==""&&e.set(o,String(n));const t=e.toString();return t?`?${t}`:""}function Nn(s){const e=async(i,r={})=>{const l=await s(i,{...r,headers:{...r.body?{"Content-Type":"application/json"}:{},...r.headers??{}}});if(!l.ok){let u=`${l.status} ${l.statusText}`;try{const d=await l.json();d&&typeof d.message=="string"&&(u=d.message)}catch{}throw new Error(u)}return{data:r.expectJson===!1?null:await l.json(),headers:l.headers}},t=async(i,r)=>{const l={per_page:20,_fields:"id,name,slug,count",orderby:"count",order:"desc"};i&&(l.search=i,l.orderby="name",l.order="asc");const{data:c}=await e(`wp/v2/tags${re(l)}`,{method:"GET",signal:r});return Array.isArray(c)?c:[]},o=async i=>{const{data:r}=await e(`wp/v2/categories${re({per_page:100,_fields:"id,name,slug,parent",orderby:"name",order:"asc"})}`,{method:"GET",signal:i});return Array.isArray(r)?r:[]},n=(i,r=0)=>{const l=i.openstation_count;return{id:i.id??r,name:i.name??"",slug:i.slug??"",parent:i.parent??0,count:typeof l=="number"?l:i.count??0,description:i.description??"",isDefault:i.openstation_is_default===!0}},a=async(i,r={})=>{const{data:l,headers:c}=await e(`wp/v2/${i}${re({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(u=>n(u)):[],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(i){try{const{data:r}=await e("wp/v2/tags",{method:"POST",body:JSON.stringify({name:i})});return Be("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(i)).find(u=>u.name.toLowerCase()===i.toLowerCase());if(c)return c}throw r}},async updatePostTags(i,r){const{data:l}=await e(`wp/v2/posts/${i}`,{method:"POST",body:JSON.stringify({tags:r})});return l},async fetchAuthorOptions(i){try{const{data:r}=await e(`wp/v2/users${re({per_page:100,who:"authors",_fields:"id,name",orderby:"name",order:"asc"})}`,{method:"GET",signal:i});return Array.isArray(r)?r:[]}catch{return[]}},async fetchTagOptions(i=1,r=50,l){try{const{data:c,headers:u}=await e(`wp/v2/tags${re({per_page:Math.max(1,r),page:Math.max(1,i),_fields:"id,name,count",orderby:"count",order:"desc"})}`,{method:"GET",signal:l});return{items:Array.isArray(c)?c:[],totalPages:parseInt(u.get("X-WP-TotalPages")??"0",10)||0}}catch{return{items:[],totalPages:0}}},async createCategory(i,r=0,l={}){const c={name:i,parent:r};l.slug&&(c.slug=l.slug),l.description&&(c.description=l.description);try{const{data:u}=await e("wp/v2/categories",{method:"POST",body:JSON.stringify(c)});return Be("category","created",u.id),u}catch(u){const d=u instanceof Error?u.message:String(u);if(/term[\s_]?exists/i.test(d)){const h=(await o()).find(p=>p.name.toLowerCase()===i.toLowerCase()&&p.parent===r);if(h)return h}throw u}},async updatePostCategories(i,r){const{data:l}=await e(`wp/v2/posts/${i}`,{method:"POST",body:JSON.stringify({categories:r})});return l},fetchTerms:a,async fetchAllTerms(i){const r=[];let l=1;for(;l<=5;){const c=await a(i,{page:l,perPage:100});if(r.push(...c.items),l>=c.totalPages)break;l++}return r},async fetchTagCooccurrence(i="tags",r=8){const{data:l}=await e(`desktop-mode/v1/tag-cooccurrence${re({taxonomy:i==="tags"?"post_tag":"category",limit:r})}`,{method:"GET"}),c=new Map,u=l&&typeof l=="object"&&!Array.isArray(l)?l.pairs:void 0;if(!u)return c;for(const[d,h]of Object.entries(u)){const p=parseInt(d,10);if(!Number.isFinite(p)||p<=0)continue;const f=[];for(const b of h){const _=Number(b?.id),$=Number(b?.shared);Number.isFinite(_)&&_>0&&Number.isFinite($)&&$>0&&f.push({id:_,shared:$})}f.length>0&&c.set(p,f)}return c},async updateTerm(i,r,l){const{data:c}=await e(`wp/v2/${i}/${r}`,{method:"POST",body:JSON.stringify(l)});return Be(i==="categories"?"category":"post_tag","updated",r),n(c,r)},async deleteTerm(i,r){await e(`wp/v2/${i}/${r}?force=true`,{method:"DELETE"}),Be(i==="categories"?"category":"post_tag","deleted",r)},async fetchTermPosts(i,r,l,c){const{data:u,headers:d}=await e(`wp/v2/posts${re({[i]:r,per_page:c,page:l,status:"any",_fields:"id,title,status"})}`,{method:"GET"}),h=parseInt(d.get("X-WP-Total")??"",10);return{items:(Array.isArray(u)?u:[]).map(p=>({id:p.id,title:p.title?.rendered||`#${p.id}`})),totalPages:Math.max(1,parseInt(d.get("X-WP-TotalPages")??"1",10)||1),total:Number.isFinite(h)?h:-1}},async fetchTermCounts(i,r){const{data:l}=await e(`desktop-mode/v1/term-counts${re({taxonomy:i,ids:r.join(",")})}`,{method:"GET"});return l&&typeof l=="object"?l:{}}}}const Dn="[openstation:desktop-mode-posts]",Se=s=>s.root.querySelector("[data-os-posts-table]");function On(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 bt(s,e){if(!e.postsCtx){const t={body:s.root,get table(){return Se(s)},refresh:()=>s.dispatch("refresh").then(()=>{}),getSelectedIds:()=>Array.from(Se(s)?.selection??[]).map(o=>Number(o)),getSelectedRows:()=>{const o=new Set(t.getSelectedIds());return(Se(s)?.data??[]).filter(n=>o.has(n.id))},getCurrentParams:()=>On(s.state)};e.postsCtx=t}return e.postsCtx}async function Hn(s,e,t){const o=t.getSelectedIds();if(o.length===0)return;const{confirm:n}=e;if(n){const a=typeof n=="function"?n(o.length):V(n,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(`${Dn} bulk action "${e.id}" failed`,a)}t.table.clearSelection(),await t.refresh()}function Fn(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(Cn,e),document.dispatchEvent(new CustomEvent("os-posts-window-data-loaded",{detail:e}))}const qn="[openstation:desktop-mode-posts]",Un=50,_t=()=>({client:null,env:null,cellCache:new Map,table:rs(),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}),Wn=s=>s.mode==="pages"?"pages":"posts";function Vn(s){return s.map(e=>`${e.id}:${e.status}:${e.modified_gmt}`).join("|")}function je(s,e){return e.client||(e.client=Nn(s.fetch)),e.client}function $e(s){return s.hidden||(s.hidden=mt()),s.hidden}function lo(s,e,t){let o="";t instanceof Error?o=t.message:t!=null&&(o=String(t)),s.host.toast?.({message:`${e} ${o}`.trim(),duration:6e3})}function co(s,e,t){return e.env||(e.env={extra:s.extra,client:je(s,e),cells:t,openUrl:(o,n,a)=>s.host.openUrl?.(o,n,a),confirm:o=>s.host.confirm?.(o)??Promise.resolve(!1),toast:(o,n)=>lo(s,o,n),announce:(o,n)=>s.host.announce?.("post",o,n),parentTitles:new Map,categories:{tree:null,pickers:new Set}}),e.env}function Bn(s,e){return{client:je(s,e),extra:s.extra,openUrl:(t,o,n)=>s.host.openUrl?.(t,o,n),toast:(t,o)=>lo(s,t,o),leaveFullscreen:()=>{const t=window.wp?.os?.windowManager?.getById?.(s.windowId);t?.isFullscreen?.()&&t.toggleFullscreen?.()}}}async function uo(s,e){if(!(e.tagFetching||e.tagPage>=e.tagTotalPages)){e.tagFetching=!0;try{const t=e.tagPage+1,o=await je(s,e).fetchTagOptions(t,Un);e.tagPage=t,e.tagTotalPages=Math.max(e.tagTotalPages,o.totalPages||t);const n=new Set(e.filterData.tags.map(a=>a.id));for(const a of o.items)n.has(a.id)||(e.filterData.tags.push(a),n.add(a.id));e.filterData.tagsHasMore=e.tagPage<e.tagTotalPages,s.repaint()}finally{e.tagFetching=!1}}}const jn=s=>`${s.authors.map(e=>e.id).join(",")}|${s.tags.map(e=>e.id).join(",")}|${s.tagsHasMore?1:0}`,ho=s=>s.split(",").map(e=>parseInt(e.trim(),10)).filter(e=>Number.isFinite(e)&&e>0),po=(s,e)=>s.length===e.length&&s.every((t,o)=>t===e[o]);function Xn(s,e,t){const o=s.extra;t.getRowId=a=>a.id,t.subTable=a=>zs(a);const n=zn(s.state.orderby);t.sort=t.columns.some(a=>a.key===n)?{key:n,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 i=a.detail?.sort,r=o.defaultOrderby??"date";s.dispatch("sort",i?{orderby:Rn(i.key,r),order:i.direction}:{orderby:r,order:o.defaultOrder??"desc"})}),t.addEventListener("os-table-filter-change",a=>{const i=a.detail?.filters??{},r=ho(i.author??""),l=ho(i.tags??"");po(r,s.state.author)&&po(l,s.state.tag)||(s.local("set-column-filters",{author:r,tag:l}),s.dispatch("filter"))})}function Gn(s,e={}){const t=e.terms,o=e.cells??{},n=(r,l,c)=>{if(!t||l.canvases[c]||l.canvasPending.has(c))return;const u=r.root.querySelector(c==="categories"?"[data-os-posts-cats-host]":"[data-os-posts-tags-host]");u&&(l.canvasPending.add(c),t[c](u,Bn(r,l)).then(d=>{if(l.disposed){d();return}l.canvases[c]=d}).catch(d=>{console.error(`${qn} ${c} canvas failed`,d)}).finally(()=>l.canvasPending.delete(c)))},a=(r,l,c,u)=>(l.bulkActions||(l.bulkActions=Ln(Mn(c,d=>r.dispatch("trash",{ids:d})))),C` | |
| 506 | - <div class="os-app-list__toolbar-right ${u?"os-app-list__bulk--footer":""}" data-os-posts-bulk ?hidden=${l.selected===0}> | |
| 507 | - <span class="os-app-list__count" data-os-posts-count>${V(m("%d selected"),l.selected)}</span> | |
| 508 | - <span class="os-app-list__bulk-actions" data-os-posts-bulk-actions>${l.bulkActions.map(d=>C`<os-button | |
| 509 | - variant=${d.variant??"secondary"} | |
| 510 | - data-os-posts-bulk-action=${d.id} | |
| 511 | - @click=${()=>void Hn(r,d,bt(r,l))} | |
| 512 | - >${d.icon?C`<span class="dashicons ${d.icon}" aria-hidden="true"></span>`:""} ${d.label}</os-button>`)}</span> | |
| 472 | + `}_readOptions(){const e=[],t=this.querySelectorAll(":scope > os-option");for(const s of Array.from(t)){const n=s.getAttribute("value");n!==null&&e.push({value:n,label:(s.textContent||n).trim(),disabled:s.hasAttribute("disabled")})}return e}_readValues(){return(this.value??"").split(",").map(t=>t.trim()).filter(t=>t!=="")}_writeValueAttribute(e){const t=e.join(",");this.value=t}_summarize(e){const t=this._readValues();if(t.length===0)return e;const s=this._readOptions(),n=new Map(s.map(a=>[a.value,a.label]));return t.length===1?n.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=i=>{const r=i.target;if(!r)return;const c=this.shadowRoot?.querySelector(".os-multiselect__trigger");e.contains(r)||c&&c.contains(r)||this._closePopover()},s=i=>{i.key==="Escape"&&(i.stopPropagation(),this._closePopover(),this.shadowRoot?.querySelector(".os-multiselect__trigger")?.focus())},n=()=>this._placePopover(),a=()=>{if(!this._hasMore||this._loadingMore)return;const i=e.scrollHeight,r=e.clientHeight,c=e.scrollTop;i-(c+r)<64&&this.emit("os-multiselect-load-more",{})};setTimeout(()=>{document.addEventListener("pointerdown",t,!0)},0),document.addEventListener("keydown",s,!0),window.addEventListener("resize",n),window.addEventListener("scroll",n,!0),e.addEventListener("scroll",a),this._teardownOpen=()=>{document.removeEventListener("pointerdown",t,!0),document.removeEventListener("keydown",s,!0),window.removeEventListener("resize",n),window.removeEventListener("scroll",n,!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(),s=new Set(this._readValues());if(e.replaceChildren(),t.length===0){const n=document.createElement("div");n.className="os-multiselect__empty",n.textContent="No options",e.appendChild(n);return}if(s.size>0){const n=document.createElement("button");n.type="button",n.className="os-multiselect__clear",n.textContent="Clear",n.addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),this._writeValueAttribute([]),this.requestUpdate(),this._refreshPopover(),this._emitPick()}),e.appendChild(n)}for(const n of t){const a=document.createElement("label");a.className="os-multiselect__option",a.setAttribute("role","option"),a.setAttribute("aria-selected",s.has(n.value)?"true":"false"),n.disabled&&(a.setAttribute("aria-disabled","true"),a.dataset.disabled="true");const i=document.createElement("input");i.type="checkbox",i.checked=s.has(n.value),i.disabled=n.disabled,i.addEventListener("change",()=>{const c=new Set(this._readValues());i.checked?c.add(n.value):c.delete(n.value);const l=t.map(d=>d.value).filter(d=>c.has(d));this._writeValueAttribute(l),a.setAttribute("aria-selected",i.checked?"true":"false"),this.requestUpdate(),this._refreshPopover(),this._emitPick()});const r=document.createElement("span");r.textContent=n.label,a.appendChild(i),a.appendChild(r),e.appendChild(a)}if(this._loadingMore){const n=document.createElement("div");n.className="os-multiselect__loading";const a=document.createElement("span");a.className="os-multiselect__spinner",a.setAttribute("aria-hidden","true");const i=document.createElement("span");i.textContent="Loading…",n.appendChild(a),n.appendChild(i),e.appendChild(n)}}_placePopover(){const e=this._popover,t=this.shadowRoot?.querySelector(".os-multiselect__trigger");if(!e||!t)return;const s=t.getBoundingClientRect(),n=window.innerWidth,a=window.innerHeight,i=Math.max(s.width,200);e.style.minWidth=`${i}px`;let r=s.left;r+i>n-8&&(r=Math.max(8,n-i-8)),e.style.left=`${r}px`,e.style.top=`${s.bottom+4}px`;const c=e.offsetHeight||200;s.bottom+4+c>a-8&&(e.style.top=`${Math.max(8,s.top-c-4)}px`)}_emitPick(){const e=this._readValues();this.emit("os-pick",{value:e.join(","),values:e})}};We.props=["value","label","placeholder","disabled","name","open"],We.styles=[si],We.help=void 0;let zt=We;Q("os-multiselect",zt);const ni="openstation.postsWindow.columns",ii="openstation.postsWindow.statusSegments",ai="openstation.postsWindow.bulkActions",ri="openstation.postsWindow.toolbarTrailing",li="openstation.postsWindow.opened",ci="openstation.postsWindow.dataLoaded",Rt="[openstation:desktop-mode-posts]",Us=new Set(["title"]),di=new Set(["title","author","parent","date"]);function Ws(o){try{const e=window.wp?.os;if(e&&typeof e.getOsSettings=="function"){const s=e.getOsSettings()[o];if(Array.isArray(s))return new Set(s.filter(n=>typeof n=="string"))}}catch{}return new Set}const Nt={authors:[],tags:[]};function Vs(o,e,t,s){const n="osPostsFilterMounted",a=o,i=t.map(l=>({value:String(l.id),label:l.name})),r=i.map(l=>`${l.value}:${l.label}`).join("|");if(a[n]){const l=a[n];l.listSig!==r&&(l.picker.items=i,l.listSig=r),l.picker.getAttribute("value")!==e.value&&l.picker.setAttribute("value",e.value),l.picker.hasMore=!!s.hasMore;return}const c=document.createElement("os-multiselect");if(c.setAttribute("placeholder",s.label),c.setAttribute("aria-label",s.ariaLabel),c.setAttribute("data-noclick",""),c.setAttribute("value",e.value),s.dataKey&&c.setAttribute("data-key",s.dataKey),o.appendChild(c),c.items=i,c.hasMore=!!s.hasMore,c.addEventListener("os-pick",l=>{const d=l.detail?.value??"";e.value=d,e.setValue(d)}),s.onLoadMore){const l=s.onLoadMore;c.addEventListener("os-multiselect-load-more",()=>{c.loadingMore=!0,l()})}a[n]={picker:c,listSig:r}}function Bs(o,e,t){const s={key:"title",label:f("Title"),sortable:!0,sticky:!0,render:(l,d)=>re(e,d.id,"title",()=>$n(d,o))},n={key:"author",label:f("Author"),sortable:!0,width:"180px",filterRender:(l,d)=>Vs(l,d,t.authors,{label:f("All authors"),ariaLabel:f("Filter by author")}),render:(l,d)=>re(e,d.id,"author",()=>Sn(d))},a={key:"date",label:f("Date"),sortable:!0,width:"170px",sortValue:l=>Date.parse(l.date_gmt+"Z")||0,render:(l,d)=>re(e,d.id,"date",()=>En(d))};if(o.extra.mode==="pages")return[s,n,{key:"parent",label:f("Parent"),width:"200px",render:(l,d)=>re(e,d.id,"parent",()=>Kn(d,o))},{key:"template",label:f("Template"),width:"180px",render:(l,d)=>re(e,d.id,"template",()=>Gn(d,o))},{key:"slug",label:f("Slug"),width:"200px",render:(l,d)=>re(e,d.id,"slug",()=>Xn(d,o))},{key:"comments",label:f("Comments"),width:"110px",sortValue:l=>typeof l.openstation_comment_count=="number"?l.openstation_comment_count:0,render:(l,d)=>re(e,d.id,"comments",()=>Yn(d))},a];const i=[s,n],{categories:r,tags:c}=o.cells;return r&&i.push({key:"categories",label:f("Categories"),width:"260px",render:(l,d)=>re(e,d.id,"categories",()=>r(d,o))}),c&&i.push({key:"tags",label:f("Tags"),minWidth:"360px",filterRender:(l,d)=>Vs(l,d,t.tags.map(u=>({id:u.id,name:u.name})),{label:f("All tags"),ariaLabel:f("Filter by tag"),dataKey:"tags",hasMore:!!t.tagsHasMore,onLoadMore:t.loadMoreTags}),render:(l,d)=>re(e,d.id,"tags",()=>c(d,o))}),i.push(a),i}function js(o,e,t=Nt){const s=Bs(o,e,t),n=window.wp?.hooks;return n&&typeof n.applyFilters=="function"?n.applyFilters(ni,s):s}function ui(o,e=Nt,t=new Set){const s=new Set(Bs(o,new Map,e).map(n=>n.key));return Dt(o,new Map,e,!1,t).filter(n=>!s.has(n.key))}function pi(o){return js(o,new Map).filter(e=>!Us.has(e.key)).map(e=>({key:e.key,label:e.label||e.key}))}function Dt(o,e,t=Nt,s=!1,n=new Set){const a=js(o,e,t),i=n.size===0?a:a.filter(r=>Us.has(r.key)||!n.has(r.key));return s?i.filter(r=>di.has(r.key)):i}function hi(){return[{value:"",label:f("All")},{value:"publish",label:f("Published")},{value:"draft",label:f("Drafts")},{value:"pending",label:f("Pending")},{value:"future",label:f("Scheduled")},{value:"trash",label:f("Trash")}]}function fi(){const o=window.wp?.hooks,e=hi();if(!o||typeof o.applyFilters!="function")return e;try{const t=o.applyFilters(ii,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 gi(o,e){return[{id:"trash",label:f("Move to trash"),icon:"dashicons-trash",variant:"danger",confirm:t=>W(o==="pages"?de("Move %d page to the trash?","Move %d pages to the trash?",t):de("Move %d post to the trash?","Move %d posts to the trash?",t),t),run:async(t,s)=>{const n=s.table.data??[],a=t.filter(i=>{const r=n.find(c=>c.id===i);return r&&r.status!=="trash"});return a.length>0&&await e(a),s.table.clearSelection(),!1}}]}function mi(o){const e=window.wp?.hooks;if(!e||typeof e.applyFilters!="function")return o;try{const t=e.applyFilters(ai,o);return Array.isArray(t)?t:o}catch(t){return console.error(`${Rt} bulk-actions filter threw; falling back to defaults:`,t),o}}function bi(o){const e=window.wp?.hooks;if(!e||typeof e.applyFilters!="function")return[];try{const t=e.applyFilters(ri,[],o);return Array.isArray(t)?t.filter(s=>s instanceof HTMLElement):[]}catch(t){return console.error(`${Rt} toolbar-trailing filter threw; ignoring:`,t),[]}}function _i(o,e="date"){switch(o){case"title":case"author":case"date":case"modified":return o;case"comments":return"comment_count";default:return e}}function vi(o){return o==="comment_count"?"comments":o}function tt(o,e,t){const s=window.wp?.os;s&&typeof s.broadcast=="function"&&s.broadcast("os.term.changed",{source:"posts-window",taxonomy:o,action:e,id:t})}function he(o){const e=new URLSearchParams;for(const[s,n]of Object.entries(o))n!==void 0&&n!==""&&e.set(s,String(n));const t=e.toString();return t?`?${t}`:""}function yi(o){const e=async(i,r={})=>{const c=await o(i,{...r,headers:{...r.body?{"Content-Type":"application/json"}:{},...r.headers??{}}});if(!c.ok){let d=`${c.status} ${c.statusText}`;try{const u=await c.json();u&&typeof u.message=="string"&&(d=u.message)}catch{}throw new Error(d)}return{data:r.expectJson===!1?null:await c.json(),headers:c.headers}},t=async(i,r)=>{const c={per_page:20,_fields:"id,name,slug,count",orderby:"count",order:"desc"};i&&(c.search=i,c.orderby="name",c.order="asc");const{data:l}=await e(`wp/v2/tags${he(c)}`,{method:"GET",signal:r});return Array.isArray(l)?l:[]},s=async i=>{const{data:r}=await e(`wp/v2/categories${he({per_page:100,_fields:"id,name,slug,parent",orderby:"name",order:"asc"})}`,{method:"GET",signal:i});return Array.isArray(r)?r:[]},n=(i,r=0)=>{const c=i.openstation_count;return{id:i.id??r,name:i.name??"",slug:i.slug??"",parent:i.parent??0,count:typeof c=="number"?c:i.count??0,description:i.description??"",isDefault:i.openstation_is_default===!0}},a=async(i,r={})=>{const{data:c,headers:l}=await e(`wp/v2/${i}${he({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(c)?c.map(d=>n(d)):[],total:parseInt(l.get("X-WP-Total")??"0",10)||0,totalPages:parseInt(l.get("X-WP-TotalPages")??"0",10)||0}};return{searchTags:t,fetchAllCategories:s,async createTag(i){try{const{data:r}=await e("wp/v2/tags",{method:"POST",body:JSON.stringify({name:i})});return tt("post_tag","created",r.id),r}catch(r){const c=r instanceof Error?r.message:String(r);if(/term[\s_]?exists/i.test(c)){const l=(await t(i)).find(d=>d.name.toLowerCase()===i.toLowerCase());if(l)return l}throw r}},async updatePostTags(i,r){const{data:c}=await e(`wp/v2/posts/${i}`,{method:"POST",body:JSON.stringify({tags:r})});return c},async fetchAuthorOptions(i){try{const{data:r}=await e(`wp/v2/users${he({per_page:100,who:"authors",_fields:"id,name",orderby:"name",order:"asc"})}`,{method:"GET",signal:i});return Array.isArray(r)?r:[]}catch{return[]}},async fetchTagOptions(i=1,r=50,c){try{const{data:l,headers:d}=await e(`wp/v2/tags${he({per_page:Math.max(1,r),page:Math.max(1,i),_fields:"id,name,count",orderby:"count",order:"desc"})}`,{method:"GET",signal:c});return{items:Array.isArray(l)?l:[],totalPages:parseInt(d.get("X-WP-TotalPages")??"0",10)||0}}catch{return{items:[],totalPages:0}}},async createCategory(i,r=0,c={}){const l={name:i,parent:r};c.slug&&(l.slug=c.slug),c.description&&(l.description=c.description);try{const{data:d}=await e("wp/v2/categories",{method:"POST",body:JSON.stringify(l)});return tt("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 s()).find(p=>p.name.toLowerCase()===i.toLowerCase()&&p.parent===r);if(h)return h}throw d}},async updatePostCategories(i,r){const{data:c}=await e(`wp/v2/posts/${i}`,{method:"POST",body:JSON.stringify({categories:r})});return c},fetchTerms:a,async fetchAllTerms(i){const r=[];let c=1;for(;c<=5;){const l=await a(i,{page:c,perPage:100});if(r.push(...l.items),c>=l.totalPages)break;c++}return r},async fetchTagCooccurrence(i="tags",r=8){const{data:c}=await e(`desktop-mode/v1/tag-cooccurrence${he({taxonomy:i==="tags"?"post_tag":"category",limit:r})}`,{method:"GET"}),l=new Map,d=c&&typeof c=="object"&&!Array.isArray(c)?c.pairs:void 0;if(!d)return l;for(const[u,h]of Object.entries(d)){const p=parseInt(u,10);if(!Number.isFinite(p)||p<=0)continue;const m=[];for(const _ of h){const g=Number(_?.id),b=Number(_?.shared);Number.isFinite(g)&&g>0&&Number.isFinite(b)&&b>0&&m.push({id:g,shared:b})}m.length>0&&l.set(p,m)}return l},async updateTerm(i,r,c){const{data:l}=await e(`wp/v2/${i}/${r}`,{method:"POST",body:JSON.stringify(c)});return tt(i==="categories"?"category":"post_tag","updated",r),n(l,r)},async deleteTerm(i,r){await e(`wp/v2/${i}/${r}?force=true`,{method:"DELETE"}),tt(i==="categories"?"category":"post_tag","deleted",r)},async fetchTermPosts(i,r,c,l){const{data:d,headers:u}=await e(`wp/v2/posts${he({[i]:r,per_page:l,page:c,status:"any",_fields:"id,title,status"})}`,{method:"GET"}),h=parseInt(u.get("X-WP-Total")??"",10);return{items:(Array.isArray(d)?d:[]).map(p=>({id:p.id,title:p.title?.rendered||`#${p.id}`})),totalPages:Math.max(1,parseInt(u.get("X-WP-TotalPages")??"1",10)||1),total:Number.isFinite(h)?h:-1}},async fetchTermCounts(i,r){const{data:c}=await e(`desktop-mode/v1/term-counts${he({taxonomy:i,ids:r.join(",")})}`,{method:"GET"});return c&&typeof c=="object"?c:{}}}}const xi="[openstation:desktop-mode-posts]",ee=o=>o.root.querySelector("[data-os-posts-table]");function ki(o){return{page:o.page,perPage:o.perPage,search:o.search||void 0,status:o.status||void 0,orderby:o.orderby,order:o.order,author:o.author.length>0?o.author:void 0,tag:o.tag.length>0?o.tag:void 0}}function Ot(o,e){if(!e.postsCtx){const t={body:o.root,get table(){return ee(o)},refresh:()=>o.dispatch("refresh").then(()=>{}),getSelectedIds:()=>Array.from(ee(o)?.selection??[]).map(s=>Number(s)),getSelectedRows:()=>{const s=new Set(t.getSelectedIds());return(ee(o)?.data??[]).filter(n=>s.has(n.id))},getCurrentParams:()=>ki(o.state)};e.postsCtx=t}return e.postsCtx}async function wi(o,e,t){const s=t.getSelectedIds();if(s.length===0)return;const{confirm:n}=e;if(n){const a=typeof n=="function"?n(s.length):W(n,s.length);if(!await(o.host.confirm?.({message:a,danger:!0})??Promise.resolve(!1)))return}try{if(await e.run(s,t)===!1)return}catch(a){console.error(`${xi} bulk action "${e.id}" failed`,a)}t.table.clearSelection(),await t.refresh()}function Ci(o){const e={items:o.list.items,total:o.list.total,totalPages:o.list.pages,page:o.list.page},t=window.wp?.hooks;t&&typeof t.doAction=="function"&&t.doAction(ci,e),document.dispatchEvent(new CustomEvent("os-posts-window-data-loaded",{detail:e}))}class $i{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:s}=e,n=this.queryKey(t);if(n!==this.key&&(this.generation++,this.expected=0,this.key=n,this.items=[],this.page=0,this.pages=0,this.lastData=null,this.error=!1),!e.loading&&s&&s!==this.lastData&&s.list.page===t.page&&(!s.query||this.queryKey(s.query)===n))if(this.lastData=s,s.list.error)this.error=!0;else{if(s.list.page>1&&this.page===0&&s.list.page!==this.expected&&!s.list.replace)return{...e,data:{...s,list:{...s.list,items:this.items}}};const a=s.list.page===1||s.list.replace?s.list.items:[...this.items,...s.list.items];this.items=Array.from(new Map(a.map(i=>[i.id,i])).values()),this.page=s.list.page,this.pages=s.list.pages,this.error=!1}return s?{...e,data:{...s,list:{...s.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 s=await e.dispatch("page",{page:this.expected});t===this.generation&&(!s||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?f("You’re all caught up."):"";return this.pending?e=f("Loading more…"):this.hasMore&&(e=C`<os-button variant="ghost" @click=${()=>void this.more()}>${this.error?f("Could not load more. Retry"):f("Load more")}</os-button>`),C`<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(s=>{s.some(n=>n.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 Si(o){const e=new DOMParser().parseFromString(o,"text/html");e.querySelectorAll("script, style").forEach(n=>n.remove()),e.querySelectorAll("p, div, li, h1, h2, h3, h4, h5, h6, br").forEach(n=>n.append(e.createTextNode(" ")));const t=e.body.textContent||"",s=Intl.Segmenter;return s?Array.from(new s(void 0,{granularity:"word"}).segment(t)).filter(n=>n.isWordLike).length:(t.match(/[\p{L}\p{N}]+/gu)||[]).length}async function Ei(o,e,t,s){const n={},a=async(c,l,d,u)=>{try{const h=await o(l,{...d,signal:s},{silent:!0});if(!h.ok)return n[c]=h.status===429||h.status>=500?"retry":"unavailable",null;const p=await u(h);return p===null&&(n[c]="unavailable"),p}catch{return n[c]="retry",null}},[i,r]=await Promise.all([a("words",`wp/v2/${e}/${t}?context=edit&_fields=content`,{},async c=>{const l=await c.json();return typeof l.content?.rendered=="string"&&!l.content.protected?Si(l.content.rendered):null}),a("comments",`wp/v2/comments?post=${t}&status=approve&per_page=1`,{method:"HEAD"},async c=>{const l=c.headers.get("X-WP-Total");return l!==null&&/^\d+$/.test(l)?Number(l):null})]);return Object.keys(n).length?{words:i,comments:r,errors:n}:{words:i,comments:r}}function Ai(o,e,t){const s=new AbortController,n=new Map,a=new Set,i=new Map,r=new Map,c=new Set,l=new WeakMap;let d=0;const u=()=>{for(const _ of o.querySelectorAll("[data-content-metrics]")){const g=n.get(_.dataset.contentMetrics||"");if(!g)continue;for(const S of["words","comments"]){const T=_.querySelector(`[data-metric="${S}"]`);T?.setAttribute("value",g[S]===null?"—":g[S].toLocaleString());let z=g.errors?.[S]?f("This count is unavailable or access is restricted."):"";g.errors?.[S]==="retry"&&(z=f("Could not load this count.")),T?.setAttribute("title",z)}const b=_.dataset.contentMetrics||"";let v=_.querySelector("[data-retry-metrics]");Object.values(g.errors||{}).includes("retry")&&(r.get(b)||0)>=3?v||(v=document.createElement("os-button"),v.setAttribute("variant","ghost"),v.setAttribute("data-retry-metrics",""),v.textContent=f("Retry counts"),v.addEventListener("click",()=>{r.delete(b),n.delete(b),v?.remove(),h(b,Number(_.dataset.postId)),p()}),_.append(v)):v?.remove()}},h=(_,g)=>{!a.has(_)&&!s.signal.aborted&&(a.add(_),i.set(_,g))},p=()=>{if(!s.signal.aborted)for(;d<2&&i.size;){const[_,g]=i.entries().next().value;i.delete(_),d++,r.set(_,(r.get(_)||0)+1),Ei(e,t,g,s.signal).then(b=>{if(!s.signal.aborted&&(n.set(_,b),u(),Object.values(b.errors||{}).includes("retry")&&r.get(_)<3)){const v=setTimeout(()=>{c.delete(v),h(_,g),p()},500*r.get(_));c.add(v)}}).finally(()=>{a.delete(_),d--,p()})}},m=typeof IntersectionObserver>"u"?null:new IntersectionObserver(_=>{for(const g of _){if(!g.isIntersecting)continue;const b=g.target,v=b.dataset.contentMetrics||"";n.has(v)||h(v,Number(b.dataset.postId)),m?.unobserve(b)}p()},{root:o.querySelector(".os-posts-desk__feed"),rootMargin:"80px"});return{sync:()=>{u(),o.querySelectorAll("[data-content-metrics]").forEach(_=>{const g=_.getAttribute("data-content-metrics")||"";l.get(_)!==g&&(l.set(_,g),m?.observe(_))})},dispose:()=>{s.abort(),m?.disconnect(),c.forEach(clearTimeout),c.clear(),i.clear(),n.clear()}}}const Ks=F` .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}}`,Gs=F` .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}`,Ti=F` ${_e} ${Ct}: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}`,Ve=class Ve extends X{render(){const e=this.checked!==null,t=this.disabled!==null,s=this.label||"",n=this.value;return C` | |
| 473 | + <label> | |
| 474 | + <input | |
| 475 | + type="checkbox" | |
| 476 | + .checked=${e} | |
| 477 | + ?disabled=${t} | |
| 478 | + .value=${n??""} | |
| 479 | + @change=${a=>this._onChange(a)} | |
| 480 | + /> | |
| 481 | + <span class="os-checkbox__label">${s}</span> | |
| 482 | + </label> | |
| 483 | + `}_onChange(e){const s=e.target.checked;s?this.setAttribute("checked",""):this.removeAttribute("checked"),this.emit("os-checkbox-change",{checked:s,value:this.value})}};Ve.props=["checked","value","label","disabled"],Ve.styles=[Ti],Ve.help=void 0;let Ht=Ve;Q("os-checkbox",Ht);const Mi=F`: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 ) )}`,Be=class Be extends X{render(){const e=this,t=e.caption||"";return C` | |
| 484 | + <span class="value" part="value">${e.value||""}</span> | |
| 485 | + <span class="label" part="label"> | |
| 486 | + ${this.hasAttribute("swatch")?C`<i class="swatch" aria-hidden="true"></i>`:""} | |
| 487 | + ${e.label||""} | |
| 488 | + </span> | |
| 489 | + ${t?C`<span class="caption" part="caption">${t}</span>`:""} | |
| 490 | + `}};Be.props=["value","label","caption","swatch"],Be.styles=[Mi],Be.help=void 0;let qt=Be;Q("os-stat",qt);const Ii=()=>({view:"desk",filters:!1,peek:!1,focused:null,inspectorKey:"",fields:[]});function Xs(o){return pe((o.excerpt?.rendered??"").replace(/<[^>]*>/g," ")).replace(/\s+/g," ").trim()}function Li(o,e){if(!o.parent)return f("Top-level page");const t=e.find(s=>s.id===o.parent);return t?we(t):W(f("Parent page #%d"),o.parent)}function Ft(o,e){o.host.openUrl?.(yt(o.extra,e.id),we(e)||f("(no title)"),o.extra.mode==="pages"?"dashicons-admin-page":"dashicons-admin-post")}function Ys(o){return C`<span class="os-posts-desk__status" data-status=${o.status}>${xs[o.status]??o.status}</span>`}function Pi(o,e){return o.extra.frontPageId===e.id?f("Front page"):o.extra.postsPageId===e.id?f("Posts page"):""}function Zs(o,e){queueMicrotask(()=>o.querySelector(e)?.shadowRoot?.querySelector("button")?.focus())}function zi(o,e){const t=o.extra.mode==="pages",s=o.data?.list.items??[],n=ee(o)?.selection??new Set,a=s.length>0&&s.every(c=>n.has(c.id)),i=c=>{e.view=c.detail.value==="table"?"table":"desk",o.repaint()},r=c=>{const[l,d]=String(c.detail.value).split(":");o.dispatch("sort",{orderby:l,order:d})};return C`<div class="os-posts-desk__tools ${e.filters?"is-expanded":""}"> | |
| 491 | + <os-text-field id=${`${o.windowId}-content-search`} class="os-app-list__search" data-os-posts-search | |
| 492 | + aria-label=${f(t?"Search pages":"Search posts")} os-bind="search" os-action="filter" os-debounce="250" | |
| 493 | + value=${o.state.search} placeholder=${f(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,o.repaint()}}>${f("Options")}</os-button> | |
| 495 | + <os-checkbox label=${f("Select loaded")} ?checked=${a} | |
| 496 | + @os-checkbox-change=${()=>{a?ee(o)?.clearSelection():ee(o)?.selectAll()}}></os-checkbox> | |
| 497 | + <os-select aria-label=${f("Sort content")} value=${`${o.state.orderby}:${o.state.order}`} @os-pick=${r}> | |
| 498 | + ${t?C`<os-option value="menu_order:asc">${f("Page order")}</os-option>`:""} | |
| 499 | + <os-option value="date:desc">${f("Newest first")}</os-option> | |
| 500 | + <os-option value="date:asc">${f("Oldest first")}</os-option> | |
| 501 | + <os-option value="modified:desc">${f("Recently edited")}</os-option> | |
| 502 | + <os-option value="title:asc">${f("Title A–Z")}</os-option> | |
| 503 | + <os-option value="title:desc">${f("Title Z–A")}</os-option> | |
| 504 | + <os-option value="author:asc">${f("By author")}</os-option> | |
| 505 | + <os-option value="author:desc">${f("By author, reversed")}</os-option> | |
| 506 | + <os-option value="modified:asc">${f("Least recently edited")}</os-option> | |
| 507 | + <os-option value="comment_count:asc">${f("Fewest comments")}</os-option> | |
| 508 | + <os-option value="comment_count:desc">${f("Most comments")}</os-option> | |
| 509 | + </os-select> | |
| 510 | + <os-select aria-label=${f("Content view")} value=${e.view} @os-pick=${i} data-os-posts-view> | |
| 511 | + <os-option value="desk">${f(t?"Page directory":"Writing desk")}</os-option> | |
| 512 | + <os-option value="table">${f("Details table")}</os-option> | |
| 513 | + </os-select> | |
| 514 | + </div>`}function Ri(o,e){const t=o.extra.mode==="pages",s=W(f(t?"Copy page ID %d":"Copy post ID %d"),e.id);return C`<os-button variant="ghost" class="os-posts-desk__id" title=${s} @click=${async n=>{n.stopPropagation();const i=await ls(String(e.id))?W(f(t?"Copied page ID #%d.":"Copied post ID #%d."),e.id):f("Couldn’t copy the ID. Please try again.");o.host.toast?.({message:i})}}><span class="screen-reader-text">${s}</span><span aria-hidden="true">#${e.id}</span><span class="dashicons dashicons-admin-page" aria-hidden="true"></span></os-button>`}function Ni(o,e){const t=e[o.key];let s="";return o.render?s=o.render(t,e,0):t!=null&&(s=String(t)),s==null||s===""||s instanceof Element&&!s.childNodes.length&&!s.textContent?"":C`<div class="os-posts-desk__plugin-stat" data-column=${o.key}><span class="os-posts-desk__plugin-stat-value">${s}</span><span class="os-posts-desk__plugin-stat-label">${o.label||o.key}</span></div>`}function Di(o,e,t,s,n=[]){const a=o.extra.mode==="pages",i=we(t)||f("(no title)"),r=wt(t),c=kt(t,"category")[0]?.name,l=Pi(o,t),d=a?Li(t,o.data?.list.items??[]):pe(c||f("Story"));let u="";a?u=C`<div class="os-posts-desk__page-mark" aria-hidden="true"><span class="dashicons ${l?"dashicons-admin-home":"dashicons-admin-page"}"></span><i></i><i></i><i></i></div>`:r&&(u=C`<img class="os-posts-desk__thumbnail" src=${r.url} alt="" loading="lazy" @error=${p=>p.target.hidden=!0}>`);const h=()=>{e.focused=t.id,e.peek=!0,o.repaint(),Zs(o.root,"[data-os-posts-inspect-close]")};return C`<article class="os-posts-desk__story ${s===t.id?"is-current":""}" data-story-id=${t.id}> | |
| 515 | + <div class="os-posts-desk__story-top"> | |
| 516 | + ${Ys(t)} | |
| 517 | + ${l?C`<span class="os-posts-desk__role">${l}</span>`:""} | |
| 518 | + ${Ri(o,t)} | |
| 519 | + <os-checkbox aria-label=${W(f("Select %s"),i)} | |
| 520 | + class="os-posts-desk__select" ?checked=${ee(o)?.selection.has(t.id)??!1} | |
| 521 | + @os-checkbox-change=${p=>{p.detail.checked?ee(o)?.select(t.id):ee(o)?.deselect(t.id)}}></os-checkbox> | |
| 522 | + </div> | |
| 523 | + <div class="os-posts-desk__story-content"> | |
| 524 | + ${u} | |
| 525 | + <div class="os-posts-desk__story-copy"> | |
| 526 | + <div class="os-posts-desk__kicker">${d}</div> | |
| 527 | + <h3><a href=${yt(o.extra,t.id)} @click=${p=>{p.preventDefault(),Ft(o,t)}}>${i}</a></h3> | |
| 528 | + <p class="os-posts-desk__excerpt">${a?`/${t.slug||""}`:Xs(t)||f("Every story starts somewhere. Open the editor to keep writing.")}</p> | |
| 513 | 529 | </div> |
| 514 | - `),i=(r,l,c,u)=>{const{state:d,data:h}=r,p=h?.list,f=p?.total??0,b=p?.pages??0,_=c==="pages",$=r.extra;let S;if(r.loading)S="";else if(f===0)S=m(_?"No pages":"No posts");else{const D=m(_?"Page %1$d of %2$d · %3$d pages":"Page %1$d of %2$d · %3$d posts");S=V(D,p?.page??d.page,Math.max(b,1),f)}const R=()=>r.host.openUrl?.($.newPostUrl??"",m(_?"Add New Page":"Add New Post"),_?"dashicons-admin-page":"dashicons-admin-post");return l.extras||(l.extras=In(bt(r,l))),C` | |
| 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=${f("Words")} title=${f("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=${f("Comments")} title=${f("Approved comments")}></os-stat> | |
| 534 | + ${a?"":C`<os-stat value=${String(t.tags?.length??0)} label=${f("Tags")}></os-stat>`} | |
| 535 | + ${n.map(p=>Ni(p,t))} | |
| 536 | + </div> | |
| 537 | + ${t.openstation_lock?C`<p class="os-posts-desk__lock"><span class="dashicons dashicons-lock" aria-hidden="true"></span>${W(f("%s is editing"),t.openstation_lock.userName)}</p>`:""} | |
| 538 | + <footer class="os-posts-desk__story-foot"> | |
| 539 | + <span class="os-posts-desk__byline">${xt(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=${()=>Ft(o,t)}>${f("Edit")}<span aria-hidden="true"> ↗</span></os-button> | |
| 541 | + <os-button variant="secondary" data-inspect-id=${t.id} @click=${h}>${f("Details")}</os-button> | |
| 542 | + </footer> | |
| 543 | + </article>`}function Oi(o,e,t,s,n,a){if(!a||!e.peek||e.focused===null)return"";const i=JSON.stringify([a,Array.from(n)]);if(i!==e.inspectorKey){e.inspectorKey=i,e.fields=Dt(t,new Map,s,!1,n).filter(l=>!["title","author","date"].includes(l.key)).map(l=>({key:l.key,label:l.label||l.key,node:l.render?l.render(a[l.key],a,0):String(a[l.key]??"—")}));for(const l of t.categories.pickers)l.isConnected||t.categories.pickers.delete(l)}const r=wt(a),c=()=>{const l=e.focused??a.id;e.focused=null,e.peek=!1,o.repaint(),Zs(o.root,`[data-inspect-id="${l}"]`)};return C`<aside class="os-posts-desk__inspector ${e.focused!==null?"is-open":""}" aria-label=${f("Content details")} | |
| 544 | + @keydown=${l=>{l.key==="Escape"&&(l.stopPropagation(),c())}}> | |
| 545 | + <header class="os-posts-desk__inspector-head"><span>${o.extra.mode==="pages"?f("PAGE DETAILS"):f("STORY DETAILS")}</span><os-button variant="ghost" data-os-posts-inspect-close @click=${c}>${f("Close details")}</os-button></header> | |
| 546 | + <div class="os-posts-desk__inspector-scroll"> | |
| 547 | + ${r?C`<img class="os-posts-desk__cover" src=${r.url} alt=${r.alt} @error=${l=>l.target.hidden=!0}>`:""} | |
| 548 | + ${Ys(a)} | |
| 549 | + <h2>${we(a)||f("(no title)")}</h2> | |
| 550 | + <p class="os-posts-desk__byline">${xt(a).name}</p> | |
| 551 | + ${a.openstation_lock?C`<os-notice tone="warning">${W(f("%s is currently editing"),a.openstation_lock.userName)}</os-notice>`:""} | |
| 552 | + <p class="os-posts-desk__preview">${Xs(a)||f("No excerpt yet.")}</p> | |
| 553 | + <os-facts layout="between" class="os-posts-desk__dates"><os-fact label=${a.status==="future"?f("Scheduled for"):f("Date")}><os-relative-time datetime=${a.date_gmt||a.date}></os-relative-time></os-fact><os-fact label=${f("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(l=>C`<section data-detail-field=${l.key}><h3>${l.label}</h3>${l.node}</section>`)}</div> | |
| 555 | + </div> | |
| 556 | + <footer class="os-posts-desk__inspector-actions"><os-button variant="primary" @click=${()=>Ft(o,a)}>${f("Open editor")}<span aria-hidden="true"> ↗</span></os-button> | |
| 557 | + ${a.link&&a.status==="publish"?C`<a href=${a.link} target="_blank" rel="noopener noreferrer">${f("View on site")} ↗</a>`:""} | |
| 558 | + </footer> | |
| 559 | + </aside>`}function Hi(o,e,t,s,n,a){const i=o.extra.mode==="pages"?f("No pages found."):f("No posts found."),r=o.data?.list.items??[],c=r.find(d=>d.id===e.focused)??r[0],l=r.length?ui(t,s,n):[];return C`<div class="os-posts-desk__workspace ${e.focused!==null&&c?"has-detail":""}" ?hidden=${e.view!=="desk"}> | |
| 560 | + <div class="os-posts-desk__feed" aria-label=${o.extra.mode==="pages"?f("Page directory"):f("Stories")}> | |
| 561 | + ${r.length?r.map(d=>Di(o,e,d,e.peek?c?.id:void 0,l)):C`<div class="os-posts-desk__empty"><span class="dashicons dashicons-welcome-write-blog" aria-hidden="true"></span><h3>${o.loading?f("Opening your workspace…"):i}</h3><p>${o.loading?f("Your content will appear here."):f("Try a different search or change the status filter.")}</p></div>`} | |
| 562 | + ${a??""} | |
| 563 | + </div> | |
| 564 | + ${e.peek?Oi(o,e,t,s,n,c):""} | |
| 565 | + </div>`}function qi(o){queueMicrotask(()=>{for(const t of o.querySelectorAll(".os-posts-desk__select, [data-os-posts-search]"))t.shadowRoot?.querySelector("input")?.setAttribute("aria-label",t.getAttribute("aria-label")||"");const e=o.querySelector(".os-posts-desk__filter-toggle");e?.shadowRoot?.querySelector("button")?.setAttribute("aria-expanded",e.getAttribute("aria-expanded")||"false")})}const Fi="[openstation:desktop-mode-posts]",Ui=50,st=()=>({desk:Ii(),feed:new $i,client:null,env:null,cellCache:new Map,table:Xo(),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}),Js=o=>o.mode==="pages"?"pages":"posts";function Wi(o){return o.map(e=>`${e.id}:${e.status}:${e.modified_gmt}`).join("|")}function ot(o,e){return e.client||(e.client=yi(o.fetch)),e.client}function Se(o,e){return o.hidden||(o.hidden=Ws(e)),o.hidden}function Qs(o,e,t){const s=e.replace(/:\s*$/,"");nn(o.host.toast,t,s===e?{fallback:e,duration:6e3}:{lead:s,fallback:`${s}.`,duration:6e3})}function Ut(o,e,t){return e.env||(e.env={extra:o.extra,client:ot(o,e),cells:t,openUrl:(s,n,a)=>o.host.openUrl?.(s,n,a),confirm:s=>o.host.confirm?.(s)??Promise.resolve(!1),toast:(s,n)=>Qs(o,s,n),announce:(s,n)=>o.host.announce?.("post",s,n),parentTitles:new Map,categories:{tree:null,pickers:new Set}}),e.env}function Vi(o,e){return{client:ot(o,e),extra:o.extra,openUrl:(t,s,n)=>o.host.openUrl?.(t,s,n),toast:(t,s)=>Qs(o,t,s),leaveFullscreen:()=>{const t=window.wp?.os?.windowManager?.getById?.(o.windowId);t?.isFullscreen?.()&&t.toggleFullscreen?.()}}}async function eo(o,e){if(!(e.tagFetching||e.tagPage>=e.tagTotalPages)){e.tagFetching=!0;try{const t=e.tagPage+1,s=await ot(o,e).fetchTagOptions(t,Ui);e.tagPage=t,e.tagTotalPages=Math.max(e.tagTotalPages,s.totalPages||t);const n=new Set(e.filterData.tags.map(a=>a.id));for(const a of s.items)n.has(a.id)||(e.filterData.tags.push(a),n.add(a.id));e.filterData.tagsHasMore=e.tagPage<e.tagTotalPages,o.repaint()}finally{e.tagFetching=!1}}}const Bi=o=>`${o.authors.map(e=>e.id).join(",")}|${o.tags.map(e=>e.id).join(",")}|${o.tagsHasMore?1:0}`,to=o=>o.split(",").map(e=>parseInt(e.trim(),10)).filter(e=>Number.isFinite(e)&&e>0),so=(o,e)=>o.length===e.length&&o.every((t,s)=>t===e[s]);function ji(o,e,t){const s=o.extra;t.getRowId=a=>a.id,t.subTable=a=>An(a);const n=vi(o.state.orderby);t.sort=t.columns.some(a=>a.key===n)?{key:n,direction:o.state.order}:null,t.addEventListener("os-table-selection-change",()=>{e.selected=t.selection?.size??0,o.repaint()}),t.addEventListener("os-table-sort-change",a=>{const i=a.detail?.sort,r=s.defaultOrderby??"date";o.dispatch("sort",i?{orderby:_i(i.key,r),order:i.direction}:{orderby:r,order:s.defaultOrder??"desc"})}),t.addEventListener("os-table-filter-change",a=>{const i=a.detail?.filters??{},r=to(i.author??""),c=to(i.tags??"");so(r,o.state.author)&&so(c,o.state.tag)||(o.local("set-column-filters",{author:r,tag:c}),o.dispatch("filter"))})}function Ki(o,e={}){const t=e.terms,s=e.cells??{},n="nativePostsHiddenColumns",a=(g,b,v)=>{if(!t||b.canvases[v]||b.canvasPending.has(v))return;const S=g.root.querySelector(v==="categories"?"[data-os-posts-cats-host]":"[data-os-posts-tags-host]");S&&(b.canvasPending.add(v),t[v](S,Vi(g,b)).then(T=>{if(b.disposed){T();return}b.canvases[v]=T}).catch(T=>{console.error(`${Fi} ${v} canvas failed`,T)}).finally(()=>b.canvasPending.delete(v)))},i=(g,b,v,S)=>(b.bulkActions||(b.bulkActions=mi(gi(v,T=>g.dispatch("trash",{ids:T})))),C` | |
| 566 | + <div class="os-app-list__toolbar-right ${"os-app-list__bulk--footer"}" data-os-posts-bulk ?hidden=${b.selected===0}> | |
| 567 | + <span class="os-app-list__count" data-os-posts-count>${W(f("%d selected"),b.selected)}</span> | |
| 568 | + <os-button variant="ghost" @click=${()=>ee(g)?.clearSelection()}>${f("Clear selection")}</os-button> | |
| 569 | + <span class="os-app-list__bulk-actions" data-os-posts-bulk-actions>${b.bulkActions.map(T=>C`<os-button | |
| 570 | + variant=${T.variant??"secondary"} | |
| 571 | + data-os-posts-bulk-action=${T.id} | |
| 572 | + @click=${()=>void wi(g,T,Ot(g,b))} | |
| 573 | + >${T.icon?C`<span class="dashicons ${T.icon}" aria-hidden="true"></span>`:""} ${T.label}</os-button>`)}</span> | |
| 574 | + </div> | |
| 575 | + `),r=g=>Jo(g.root.querySelector("[data-os-posts-editor] iframe")),c=(g,b)=>{b.editor&&r(g).then(v=>{v||b.disposed||!b.editor||(b.editor(),b.editor=null)})},l=(g,b)=>{const v="os.native-window.before-close",S=window.wp?.hooks;if(!S?.addFilter||!S.removeFilter)return()=>{};const T=`desktop-mode/posts/close-guard/${g.windowId}`;let z=!1;return S.addFilter(v,T,(...P)=>{const y=P[0];return P[1]?.windowId!==g.windowId||!b.editor||z?y:(z=!0,(async()=>{const R=!await r(g)||await g.host.confirm?.({title:f("Leave without saving?"),message:f("This post has changes that have not been saved. Closing the window discards them."),confirmLabel:f("Discard and close"),danger:!0})===!0;z=!1,R&&(b.editor?.(),b.editor=null,window.wp?.os?.windowManager?.getById(g.windowId)?.close())})(),!1)}),()=>S.removeFilter?.(v,T)},d=(g,b)=>{if(b.editor)return;const v=g.root.querySelector("[data-os-posts-editor]"),S=g.extra.newPostUrl??"";v&&S&&(b.editor=window.wp?.os?.embedAdminPage?.(v,S)??null)},u=(g,b,v)=>{const S=g.root.querySelector("os-tabs");if(!S){const T=v==="pages";g.host.openUrl?.(g.extra.newPostUrl??"",f(T?"Add Page":"Add Post"),T?"dashicons-admin-page":"dashicons-admin-post");return}S.value="new",p(g,b,"new")},h=g=>g.extra.menuTabs??[],p=(g,b,v)=>{if(b.tab==="new"&&v!=="new"&&c(g,b),b.tab=v,v==="new"){d(g,b);return}if(v==="atlas"&&!b.atlas&&e.atlas){const S=g.root.querySelector("[data-os-pages-atlas]");S&&(b.atlas=e.atlas(S,g));return}(v==="categories"||v==="tags")&&a(g,b,v)},m=(g,b)=>{const v=String(g.state.tab??"")||"posts";if(v===b.serverTab||(b.serverTab=v,v===b.tab))return;const S=g.root.querySelector("os-tabs");S&&(S.value=v),p(g,b,v)},_=(g,b,v,S)=>{const T=b.feed.reconcile(g),{state:z,data:P}=T,y=P?.list,E=v==="pages",M=Ut(g,b,s);Hs(M,y?.items??[]);const R=()=>u(g,b,v);return b.extras||(b.extras=bi(Ot(g,b))),C` | |
| 576 | + <header class="os-posts-desk__hero"> | |
| 577 | + <div><span class="os-posts-desk__eyebrow">${f(E?"THE SHAPE OF YOUR SITE":"YOUR EDITORIAL SPACE")}</span><h2>${f(E?"A place for every page.":"Stories in motion.")}</h2><p>${f(E?"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=${R}><span class="dashicons dashicons-plus" aria-hidden="true"></span>${f(E?"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 | - ${ss({segments:Pn(),value:d.status,bind:"status",action:"filter",label:m("Filter by status"),phone:u})} | |
| 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=${d.search} | |
| 525 | - placeholder=${m(_?"Search pages…":"Search posts…")} | |
| 526 | - ></os-text-field> | |
| 582 | + ${jo({segments:fi(),value:z.status,bind:"status",action:"filter",label:f("Filter by status"),phone:S})} | |
| 527 | 583 | </div> |
| 528 | - ${u?"":a(r,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=${m("Refresh")}> | |
| 532 | - <span class="dashicons dashicons-update" aria-hidden="true"></span> | |
| 586 | + <span data-os-posts-toolbar-extras>${b.extras}</span> | |
| 587 | + <os-button variant="ghost" os-action="refresh" data-os-posts-refresh title=${f("Refresh")}> | |
| 588 | + <span class="dashicons dashicons-update" aria-hidden="true"></span>${f("Refresh")} | |
| 533 | 589 | </os-button> |
| 534 | - <os-button variant="primary" data-os-posts-new @click=${R}> | |
| 535 | - <span class="dashicons dashicons-plus" aria-hidden="true"></span> | |
| 536 | - ${m("Add New")} | |
| 537 | - </os-button> | |
| 538 | 590 | </div> |
| 539 | 591 | </header> |
| 540 | - ${p?.error?C`<os-notice tone="danger">${p.error}</os-notice>`:""} | |
| 541 | - <div class="os-app-list__body" data-os-posts-body> | |
| 592 | + ${y?.error?C`<os-notice tone="danger">${y.error}</os-notice>`:""} | |
| 593 | + ${zi(T,b.desk)} | |
| 594 | + ${Hi(T,b.desk,M,b.filterData,Se(b,n),b.feed.tail())} | |
| 595 | + <div class="os-app-list__body" data-os-posts-body ?hidden=${b.desk.view!=="table"}> | |
| 542 | 596 | <os-table |
| 543 | 597 | data-os-posts-table |
| 544 | 598 | os-preserve |
| 545 | 599 | selectable="multi" |
| @@ -549,34 +603,167 @@ | ||
| 549 | 603 | striped |
| 550 | 604 | bordered |
| 551 | 605 | > |
| 552 | 606 | <div slot="empty" class="os-app-list__empty"> |
| 553 | - <span class="dashicons ${_?"dashicons-admin-page":"dashicons-admin-post"}" aria-hidden="true"></span> | |
| 554 | - <p>${m(_?"No pages found.":"No posts found.")}</p> | |
| 607 | + <span class="dashicons ${E?"dashicons-admin-page":"dashicons-admin-post"}" aria-hidden="true"></span> | |
| 608 | + <p>${f(E?"No pages found.":"No posts found.")}</p> | |
| 555 | 609 | <p class="os-app-list__empty-hint"> |
| 556 | - ${m("Try a different search or change the status filter.")} | |
| 610 | + ${f("Try a different search or change the status filter.")} | |
| 557 | 611 | </p> |
| 558 | 612 | </div> |
| 559 | 613 | </os-table> |
| 560 | 614 | </div> |
| 561 | - ${ns({page:p?.page??d.page,pages:b,perPage:d.perPage,summary:S,pageAction:"page",perPageBind:"perPage",perPageAction:"filter",labels:{previous:m("Previous"),next:m("Next"),perPage:m("Per page")}})} | |
| 562 | - ${u?a(r,l,c,!0):""} | |
| 563 | - `};return ls(s,{local:{"set-column-filters":(r,l)=>{r.author=Array.isArray(l.author)?l.author:[],r.tag=Array.isArray(l.tag)?l.tag:[]}},placeholder:r=>({list:{items:[],total:0,pages:0,page:r.page,perPage:r.perPage,error:"",code:""}}),view:r=>{const l=r.ui(_t),c=Wn(r.extra),u=Je(),d=i(r,l,c,u),h=`os-app-list desktop-mode-posts${c==="pages"?" desktop-mode-pages":""}`;if(!t)return C`<div class=${h} data-os-posts-root> | |
| 564 | - <div class="os-app-list__panel">${d}</div> | |
| 565 | - </div>`;const p=f=>{const b=f.detail?.value??"posts";l.tab=b,(b==="categories"||b==="tags")&&n(r,l,b)};return C`<div class=${h} data-os-posts-root> | |
| 566 | - <os-tabs value=${l.tab} class="os-app-list__tabs" @os-tab-change=${p}> | |
| 567 | - <os-tab value="posts">${m("All posts")}</os-tab> | |
| 568 | - <os-tab value="categories">${m("Categories")}</os-tab> | |
| 569 | - <os-tab value="tags">${m("Tags")}</os-tab> | |
| 615 | + ${b.desk.view==="table"?b.feed.tail():""} | |
| 616 | + ${i(g,b,v)} | |
| 617 | + `};return Yo(o,{local:{"set-column-filters":(g,b)=>{g.author=Array.isArray(b.author)?b.author:[],g.tag=Array.isArray(b.tag)?b.tag:[]}},placeholder:g=>({list:{items:[],total:0,pages:0,page:g.page,perPage:g.perPage,error:"",code:""}}),view:g=>{const b=g.ui(st),v=Js(g.extra),S=pt(),T=_(g,b,v,S),z=`os-app-list desktop-mode-posts${v==="pages"?" desktop-mode-pages":""}`;if(!t&&!e.atlas)return C`<div class=${z} data-os-posts-root data-desk-options=${String(b.desk.filters)}><style>${Gs.cssText}${Ks.cssText}</style> | |
| 618 | + <div class="os-app-list__panel">${T}</div> | |
| 619 | + </div>`;const P=y=>{const E=y.detail?.value??"posts";p(g,b,E)};return C`<div class=${z} data-os-posts-root data-desk-options=${String(b.desk.filters)}><style>${Gs.cssText}${Ks.cssText}</style> | |
| 620 | + <os-tabs value=${b.tab} class="os-app-list__tabs" @os-tab-change=${P}> | |
| 621 | + ${h(g).map(y=>C`<os-tab value=${y.id}>${y.label}</os-tab>`)} | |
| 570 | 622 | </os-tabs> |
| 571 | - <os-tabpanel for="posts" class="os-app-list__panel">${d}</os-tabpanel> | |
| 572 | - <os-tabpanel for="categories" class="os-app-list__panel"> | |
| 623 | + <os-tabpanel for="posts" class="os-app-list__panel">${T}</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?C`<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?C`<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:r=>{const l=r.ui(_t),c=[],u=co(r,l,o),d=new MutationObserver(()=>{Se(r)?.toggleAttribute("loading",r.root.getAttribute("aria-busy")==="true")});d.observe(r.root,{attributes:!0,attributeFilter:["aria-busy"]}),c.push(()=>d.disconnect()),je(r,l).fetchAuthorOptions().then(_=>{l.filterData.authors=_,r.repaint()}),l.filterData.loadMoreTags=()=>void uo(r,l),uo(r,l),l.menu=is(r.root,{section:m("Show columns"),prefix:s,items:En(u),isChecked:_=>!$e(l).has(_),onToggle:_=>{const $=$e(l);$.has(_)?$.delete(_):$.add(_);const S=window.wp?.os;S&&typeof S.updateOsSettings=="function"&&S.updateOsSettings({nativePostsHiddenColumns:Array.from($).sort()},{windowId:r.windowId}),r.repaint()}}),c.push(()=>l.menu?.dispose());const h=window.wp?.os;if(h&&typeof h.subscribeOsSettings=="function"){let _=Array.from($e(l)).sort().join(",");c.push(h.subscribeOsSettings(()=>{const $=mt(),S=Array.from($).sort().join(",");S!==_&&(_=S,l.hidden=$,r.repaint(),l.menu?.refresh())}))}h&&typeof h.subscribe=="function"&&c.push(h.subscribe("os.term.changed",_=>{_?.taxonomy==="category"&&(dt(u),nn(u))}));const p=()=>r.repaint();document.addEventListener("os-mode-changed",p),c.push(()=>document.removeEventListener("os-mode-changed",p));const f=bt(r,l),b=window.wp?.hooks;return b&&typeof b.doAction=="function"&&b.doAction(kn,f),document.dispatchEvent(new CustomEvent("os-posts-window-opened",{detail:f})),()=>{l.disposed=!0;for(const _ of c)_();l.canvases.categories?.(),l.canvases.tags?.(),l.canvases={categories:null,tags:null},dt(u)}},updated:r=>{const l=Se(r);if(!l)return;r.loading&&l.setAttribute("loading","");const c=r.ui(_t),{state:u,data:d}=r,h=co(r,c,o),p=`${Array.from($e(c)).sort().join(",")}|${jn(c.filterData)}`;p!==c.columnsKey&&(c.columnsKey=p,c.cellCache.clear(),c.table.invalidateColumns());const f=d?.list?.items??[];c.table.sync({table:l,rows:f,listKey:[u.page,u.perPage,u.search,u.status,u.orderby,u.order,u.author.join(","),u.tag.join(",")].join("|"),fingerprint:Vn(f),columns:_=>(c.cellCache.clear(),An(h,c.cellCache,c.filterData,_,$e(c))),wire:()=>Xn(r,c,l),onSelection:_=>{c.selected=_.length}}).dataChanged&&(c.cellCache.clear(),rn(h,f),d&&Fn(d))}})}const fo="__openStationSharedStores";function Kn(){const s=window;let e=s[fo];return e||(e=new Map,s[fo]=e),e}function Yn(s,e){const t=Kn();let o=t.get(s);o||(o={state:e(),listeners:new Set,rebuild:e},t.set(s,o));const n={get state(){return o.state},set state(a){o.state=a},getState(){return o.state},notify(){for(const a of Array.from(o.listeners))try{a(o.state)}catch(i){console.error(`[desktop-mode/shared-store:${s}] subscriber threw:`,i)}},subscribe(a){return o.listeners.add(a),()=>{o.listeners.delete(a)}},setState(a){const i=o.state;if(typeof i!="object"||i===null){console.warn(`[desktop-mode/shared-store:${s}] setState called on a primitive store; use the state setter instead.`);return}Object.assign(i,a),n.notify()},reset(){const a=o.rebuild(),i=o.state;if(typeof i=="object"&&i!==null&&typeof a=="object"&&a!==null){const r=i;for(const l of Object.keys(r))delete r[l];Object.assign(r,a)}else o.state=a;o.listeners.clear()}};return n}const go=Object.freeze({top:0,right:0,bottom:0,left:0});function Zn(s,e,t,o){return{left:s,top:e,width:t,height:o,right:s+t,bottom:e+o}}function Qn(s,e){const t=n=>Math.min(Math.max(0,e.width),Math.max(0,n)),o=n=>Math.min(Math.max(0,e.height),Math.max(0,n));return{top:o(s.top-e.top),bottom:o(e.bottom-s.bottom),left:t(s.left-e.left),right:t(e.right-s.right)}}const Jn="os/work-area";function ei(){return{insets:{...go},rect:{x:0,y:0,width:0,height:0},viewport:{x:0,y:0,width:0,height:0},area:{width:0,height:0}}}const ti=Yn(Jn,()=>({snapshot:ei(),installed:!1,areaEl:null}));function oi(s){const{installed:e,snapshot:t}=ti.state;if(!e)return{...go};const o=t.viewport;return Qn(Zn(o.x,o.y,o.width,o.height),s.getBoundingClientRect())}const Xe=170,si=()=>({pixiInteractionAt:0,lastFocusChange:0,panMovedDist:0,panActive:!1,panStart:null});function ue(s,e){e.stopPropagation?.(),s.pixiInteractionAt=performance.now()}function mo(s,e){return!s||!e?.global?1/0:Math.hypot(e.global.x-s.x,e.global.y-s.y)}function ni(s,e,t){const o=performance.now();return o-s.lastFocusChange<250||o-s.pixiInteractionAt<250||s.panMovedDist>4?!1:e.target===t}function ii(s,e){const t={targetScale:s.scale.x,targetWorldX:s.x,targetWorldY:s.y,ease(){const a=t.targetScale-s.scale.x,i=t.targetWorldX-s.x,r=t.targetWorldY-s.y;(Math.abs(a)>5e-4||Math.abs(i)>.5||Math.abs(r)>.5)&&(s.scale.set(s.scale.x+a*.22),s.x+=i*.22,s.y+=r*.22)},stageToWorld(n){return{x:(n.x-s.x)/s.scale.x,y:(n.y-s.y)/s.scale.y}},pan(n,a){s.x+=n,s.y+=a,t.targetWorldX+=n,t.targetWorldY+=a},fitToView(n,a={}){const i=a.padding??90,r=a.animate??!1,l=e.getBoundingClientRect(),c=oi(e),u=c.left,d=c.top,h=Math.max(0,l.width-c.left-c.right),p=Math.max(0,l.height-c.top-c.bottom);if(!n||h===0||p===0){const E=u+h/2,I=d+p/2;t.targetScale=1,t.targetWorldX=E,t.targetWorldY=I,r||(s.x=E,s.y=I,s.scale.set(1));return}const f=Math.max(1,n.maxX-n.minX),b=Math.max(1,n.maxY-n.minY),_=(h-i*2)/f,$=(p-i*2)/b,S=Math.max(.2,Math.min(1.5,Math.min(_,$))),R=(n.minX+n.maxX)/2,D=(n.minY+n.maxY)/2,P=u+h/2-R*S,y=d+p/2-D*S;t.targetScale=S,t.targetWorldX=P,t.targetWorldY=y,r||(s.scale.set(S),s.x=P,s.y=y)},frameOn(n,a){const i=e.getBoundingClientRect();if(i.width<=0||i.height<=0)return!1;const r=Xe+70,l=i.width*.85/(2*r),c=i.height*.85/(2*r),u=Math.max(.5,Math.min(1.6,Math.min(l,c)));return t.targetScale=u,t.targetWorldX=i.width/2-n*u,t.targetWorldY=i.height/2-a*u,!0},dispose(){e.removeEventListener("wheel",o)}};function o(n){n.preventDefault();const i=Math.exp(-n.deltaY*8e-4),r=t.targetScale,l=Math.max(.3,Math.min(2.5,r*i));if(Math.abs(l-r)<5e-4)return;const c=e.getBoundingClientRect(),u=n.clientX-c.left,d=n.clientY-c.top,h=(u-t.targetWorldX)/r,p=(d-t.targetWorldY)/r;t.targetScale=l,t.targetWorldX=u-h*l,t.targetWorldY=d-p*l}return e.addEventListener("wheel",o,{passive:!1}),t}function ai(s,e,t,o){let n=!1,a=0,i=0;const r=24,l=80;let c=null;const u=()=>{const h=t.getBoundingClientRect();e.renderer.resize(h.width,h.height),e.stage.hitArea=new s.Rectangle(0,0,h.width,h.height),!n&&h.width>0&&h.height>0&&(n=!0,a=h.width,i=h.height,o.onFirstFit(),t.classList.remove("is-loading")),c!==null&&window.clearTimeout(c),c=window.setTimeout(()=>{c=null;const p=t.getBoundingClientRect();(Math.abs(p.width-a)>=r||Math.abs(p.height-i)>=r)&&(a=p.width,i=p.height,o.onSettle())},l),e.render(),o.onResize?.()},d=new ResizeObserver(u);return d.observe(t),()=>{d.disconnect(),c!==null&&window.clearTimeout(c)}}const be='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',_e=4;function ve(s,e){return s.length>e?s.slice(0,e-1)+"…":s}async function ri(s,e){const t=window.wp?.os;if(!t||typeof t.loadModules!="function")return s.textContent=`${e} ${m("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 li(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 n=new s.Container;return n.x=e.clientWidth/2,n.y=e.clientHeight/2,o.stage.addChild(n),o.stage.eventMode="static",o.stage.hitArea=new s.Rectangle(0,0,e.clientWidth,e.clientHeight),{app:o,world:n}}function ci(s,e,t){try{s.ticker?.stop()}catch{}try{s.destroy({removeView:!0},{children:!0})}catch{}e.replaceChildren(),e.classList.remove(...t)}function bo(){try{const s=getComputedStyle(document.documentElement).getPropertyValue("--wp-admin-theme-color").trim();if(!s)return 210;const e=document.createElement("span");e.style.color=s,document.body.appendChild(e);const t=getComputedStyle(e).color;e.remove();const o=t.match(/\d+/g);return!o||o.length<3?210:di(parseInt(o[0],10),parseInt(o[1],10),parseInt(o[2],10))}catch{return 210}}function di(s,e,t){const o=s/255,n=e/255,a=t/255,i=Math.max(o,n,a),r=Math.min(o,n,a),l=i-r;if(l===0)return 210;let c;switch(i){case o:c=(n-a)/l+(n<a?6:0);break;case n:c=(a-o)/l+2;break;default:c=(o-n)/l+4;break}return Math.round(c*60)}function te(s,e,t){const o=e/100,n=t/100,a=(1-Math.abs(2*n-1))*o,i=s/60,r=a*(1-Math.abs(i%2-1));let l=0,c=0,u=0;i<1?(l=a,c=r):i<2?(l=r,c=a):i<3?(c=a,u=r):i<4?(c=r,u=a):i<5?(l=r,u=a):(l=a,u=r);const d=n-a/2;return Math.round((l+d)*255)*65536+Math.round((c+d)*255)*256+Math.round((u+d)*255)}function ui(s,e){const t=Math.floor(s/65536)%256,o=Math.floor(s/256)%256,n=s%256,a=i=>Math.round(i*(1+e));return a(t)*65536+a(o)*256+a(n)}function _o(s){return`#${s.toString(16).padStart(6,"0")}`}function hi(s){const e=document.createElement("div");return e.innerHTML=s,e.textContent||e.innerText||""}const W="os-term-canvas";function vt(s,e){const t=document.createElement("button");return t.type="button",t.className=`${W}__btn${s?` ${W}__btn--${s}`:""}`,t.textContent=e,t}function pi(s,e,t){s.replaceChildren(),s.classList.add(W,e);const o=document.createElement("div");o.className=`${W}__toolbar`;const n=t.buttons.map(h=>{const p=vt(h.variant??"",""),f=document.createElement("span");return f.className=`dashicons ${h.icon}`,f.setAttribute("aria-hidden","true"),p.replaceChildren(f,document.createTextNode(h.label)),h.title&&(p.title=h.title),o.appendChild(p),p}),a=document.createElement("div");a.className=`${W}__search`;const i=document.createElement("input");i.type="search",i.className=`${W}__search-input`,i.placeholder=t.searchPlaceholder,i.setAttribute("aria-label",t.searchAria),a.appendChild(i);const r=document.createElement("ul");r.className=`${W}__search-results`,r.hidden=!0,a.appendChild(r);const l=document.createElement("span");l.className=`${W}__hint`,l.textContent=t.hint,o.appendChild(a),o.appendChild(l),s.appendChild(o);const c=document.createElement("div");c.className=`${W}__layout`,s.appendChild(c);const u=document.createElement("div");u.className=`${W}__stage is-loading`,c.appendChild(u);const d=document.createElement("aside");return d.className=`${W}__sidebar`,c.appendChild(d),{toolbar:o,stage:u,sidebar:d,buttons:n,searchWrap:a,searchInput:i,searchResults:r}}function fi(s,e){const{searchInput:t,searchResults:o,searchWrap:n}=s;let a=[],i=0;const r=()=>{o.querySelectorAll(`.${W}__search-result`).forEach((f,b)=>{const _=b===i;f.classList.toggle("is-active",_),_&&f.scrollIntoView({block:"nearest"})})},l=()=>{t.value="",o.hidden=!0,o.replaceChildren(),a=[],i=0},c=f=>{l(),e.select(f)},u=()=>{const f=t.value.trim().toLowerCase();if(f.length===0){o.hidden=!0,o.replaceChildren(),a=[],i=0;return}a=e.matches(f).sort((b,_)=>_.count-b.count).slice(0,10),i=0,o.replaceChildren(),a.forEach((b,_)=>{const $=document.createElement("li"),S=document.createElement("button");S.type="button",S.className=`${W}__search-result`,_===0&&S.classList.add("is-active");const R=document.createElement("span");R.className=`${W}__search-title`,R.textContent=b.name||`#${b.id}`;const D=document.createElement("span");D.className=`${W}__search-meta`,D.textContent=V(fe("%d post","%d posts",b.count),b.count),S.appendChild(R),S.appendChild(D),S.addEventListener("mousedown",P=>{P.preventDefault(),c(b)}),S.addEventListener("mouseenter",()=>{i=_,r()}),$.appendChild(S),o.appendChild($)}),o.hidden=a.length===0},d=f=>{if(f.key==="ArrowDown"||f.key==="ArrowUp"||f.key==="Enter"){if(a.length===0)return;f.preventDefault(),f.key==="ArrowDown"?(i=Math.min(i+1,a.length-1),r()):f.key==="ArrowUp"?(i=Math.max(i-1,0),r()):c(a[i])}else f.key==="Escape"&&l()},h=()=>{setTimeout(()=>{o.hidden=!0},120)},p=f=>{n.contains(f.target)||(o.hidden=!0)};return t.addEventListener("input",u),t.addEventListener("focus",u),t.addEventListener("keydown",d),t.addEventListener("blur",h),document.addEventListener("click",p),()=>{t.removeEventListener("input",u),t.removeEventListener("focus",u),t.removeEventListener("keydown",d),t.removeEventListener("blur",h),document.removeEventListener("click",p)}}const gi=10,mi=22,bi=6e4;function _i(s){const{pixi:e,postLayer:t,postChipLayer:o,postEdgeGfx:n,interaction:a,env:i}=s,r=new Map,l=new Map,c=new Map;let u=0;const d=new e.Container;d.eventMode="passive",d.visible=!1,t.addChild(d);const h=new e.Graphics,p=new e.Graphics,f=new e.Text({text:"1 / 1",style:{fill:5265246,fontSize:s.pagerLabelSize,fontFamily:be,fontWeight:"600"},...s.pagerTextRes?{resolution:s.pagerTextRes}:{}});f.anchor.set(.5);for(const y of[h,p])y.eventMode="static",y.cursor="pointer",y.hitArea=new e.Circle(0,0,16),y.on("pointerdown",E=>ue(a,E));d.addChild(h),d.addChild(f),d.addChild(p),h.on("pointertap",y=>{ue(a,y),a.lastFocusChange=performance.now(),P.focusPage>1&&(P.focusPage--,P.load())}),p.on("pointertap",y=>{ue(a,y),a.lastFocusChange=performance.now(),P.focusPage<P.focusTotalPages&&(P.focusPage++,P.load())});function b(y,E,I){y.clear(),y.circle(0,0,14),y.fill({color:I?15921906:16777215,alpha:I?.7:1}),y.stroke({color:0,width:1,alpha:.12});const O=y.children?.[0]??null;if(O)O.text=E,O.style.fill=I?11580344:5265246;else{const H=new e.Text({text:E,style:{fill:I?11580344:5265246,fontSize:s.pagerGlyphSize,fontFamily:be,fontWeight:"600"},...s.pagerTextRes?{resolution:s.pagerTextRes}:{}});H.anchor.set(.5),y.addChild(H)}}function _(){const y=P.focusId===null?null:s.getCenter(P.focusId);if(!y||P.focusTotalPages<=1){d.visible=!1;return}d.visible=!0;const E=P.focusPage<=1,I=P.focusPage>=P.focusTotalPages;b(h,"◀",E),b(p,"▶",I),h.cursor=E?"default":"pointer",p.cursor=I?"default":"pointer",f.text=`${P.focusPage} / ${P.focusTotalPages}`,h.x=-38,p.x=38,h.y=0,p.y=0,f.x=0,f.y=0,d.x=y.x,d.y=y.y+Xe+60}function $(y,E){const I=ve(E.title,mi);y.titleText.text!==I&&(y.titleText.text=I);const O=9,H=3,z=4,T=6,L=y.titleText.width,N=y.titleText.height,j=O+z*2+T+L+O,he=Math.max(N,z*2)+H*2,w=-j/2,v=-he/2;y.bg.clear(),y.bg.roundRect(w,v,j,he,he/2),y.cachedHover?(y.bg.fill({color:16777215,alpha:1}),y.bg.stroke({color:E.tone,width:1.5,alpha:1})):(y.bg.fill({color:16777215,alpha:.95}),y.bg.stroke({color:0,width:1,alpha:.12})),y.dot.clear(),y.dot.circle(w+O+z,0,z),y.dot.fill({color:E.tone,alpha:.85}),y.dot.stroke({color:16777215,width:1}),y.titleText.x=w+O+z*2+T,y.titleText.y=-N/2}function S(y){if(l.has(y.id))return;const E=new e.Container;E.eventMode="static",E.cursor="pointer",E.alpha=0;const I=new e.Graphics,O=new e.Graphics,H=new e.Text({text:y.title,style:{fill:1909543,fontSize:s.chipFontSize,fontFamily:be,fontWeight:"500"},resolution:s.chipTextRes});E.addChild(I),E.addChild(O),E.addChild(H);const z={container:E,bg:I,dot:O,titleText:H,cachedHover:!1};l.set(y.id,z),o.addChild(E),E.on("pointerdown",T=>ue(a,T)),E.on("pointertap",()=>{i.leaveFullscreen(),i.openUrl(y.editUrl,y.title,"dashicons-admin-post"),s.onOpenPost()}),E.on("pointerover",()=>{z.cachedHover=!0,$(z,y)}),E.on("pointerout",()=>{z.cachedHover=!1,$(z,y)}),$(z,y)}function R(y){P.clear();const E=P.focusId===null?null:s.getCenter(P.focusId);if(!E)return;const I=y.length,O=Xe+Math.max(0,I-8)*6;y.forEach((H,z)=>{const T=2*Math.PI/Math.max(1,I)*z-Math.PI/2,L=new e.Graphics;t.addChild(L);const N={id:H.id,title:H.title,editUrl:H.editUrl,angle:T,r:O,x:E.x,y:E.y,tx:E.x+Math.cos(T)*O,ty:E.y+Math.sin(T)*O,gfx:L,tone:E.tone};r.set(H.id,N),S(N)}),_()}function D(y,E){P.focusTotalPages=y.totalPages,Number.isFinite(y.realTotal)&&y.realTotal>=0&&s.onCountReconciled(E,y.realTotal),R(y.items)}const P={focusId:null,focusPage:1,focusTotalPages:1,async load(){if(P.focusId===null)return;const y=++u,E=P.focusId,I=`${E}:${P.focusPage}`,O=c.get(I);if(O&&performance.now()-O.fetchedAt<bi){D(O,E);return}try{const H=await i.client.fetchTermPosts(s.param,E,P.focusPage,gi);if(y!==u||P.focusId!==E)return;const z=i.extra.editPostUrlBase??"",T=z.includes("?")?"&":"?",L={items:H.items.map(N=>({id:N.id,title:hi(N.title),editUrl:`${z}${T}post=${N.id}&action=edit`})),totalPages:H.totalPages,realTotal:H.total,fetchedAt:performance.now()};c.set(I,L),D(L,E)}catch(H){i.toast(m("Couldn’t load posts:"),H)}},clear(){for(const y of r.values())t.removeChild(y.gfx),y.gfx.destroy();r.clear();for(const y of l.values())o.removeChild(y.container),y.container.destroy({children:!0});l.clear(),n.clear(),d.visible=!1},invalidate(){u++},ease(){for(const y of r.values())y.x+=(y.tx-y.x)*.18,y.y+=(y.ty-y.y)*.18,y.gfx.x=y.x,y.gfx.y=y.y},drawEdges(){n.clear();const y=P.focusId===null?null:s.getCenter(P.focusId);if(y)for(const E of r.values())n.moveTo(y.x,y.y),n.lineTo(E.x,E.y),n.stroke({color:y.tone,width:1,alpha:.35})},syncChips(y){for(const E of r.values()){const I=l.get(E.id);I&&(I.container.x=E.x,I.container.y=E.y,I.container.scale.set(y),I.container.alpha<1&&(I.container.alpha=Math.min(1,I.container.alpha+.18)))}}};return P}const yt=Xe+130;async function vo(s,e,t){const o=await ri(s,t.unavailable);if(!o)return null;const n=o,a=pi(s,t.modifier,t.chrome),{stage:i,sidebar:r}=a,{app:l,world:c}=await li(n,i,`${W}__canvas`),u={};for(const T of t.layers){const L=new n.Container;u[T]=L,c.addChild(L)}const d=new n.Graphics;u.postEdge.addChild(d);const h=si(),p=ii(c,i);let f=null,b=null,_=null,$=performance.now(),S=null,R=null,D=!1;const P=_i({pixi:n,postLayer:u.post,postChipLayer:u.postChip,postEdgeGfx:d,env:e,param:t.taxonomy,interaction:h,...t.fan,getCenter:T=>f?.center(T)??null,onCountReconciled:(T,L)=>f?.countReconciled(T,L),onOpenPost:()=>z.closeFocus()}),y=()=>document.hidden||i.clientWidth===0||i.clientHeight===0,E=()=>{if(_=null,D||!f||y())return;const T=performance.now(),L=Math.min(50,T-$);$=T,p.ease(),f.frame(L),_=requestAnimationFrame(E)},I=()=>{D||_!==null||!f||y()||($=performance.now(),_=requestAnimationFrame(E))},O=()=>I();l.stage.on("pointerdown",T=>{const L=T;h.panActive=!0,h.panStart={x:L.global.x,y:L.global.y},h.panMovedDist=0}),l.stage.on("pointermove",T=>{const L=T;if(!f?.pointerMove(L,p.stageToWorld(L.global))&&h.panActive&&h.panStart){const N=L.global.x-h.panStart.x,j=L.global.y-h.panStart.y;p.pan(N,j),h.panMovedDist+=Math.sqrt(N*N+j*j),h.panStart={x:L.global.x,y:L.global.y}}});const H=async T=>{await f?.pointerUp(T),h.panActive=!1,h.panStart=null};l.stage.on("pointerup",T=>void H(T)),l.stage.on("pointerupoutside",T=>void H(T)),l.canvas.addEventListener("click",T=>{ni(h,T,l.canvas)&&!f?.dragging()&&P.focusId!==null&&z.closeFocus()});const z={pixi:n,app:l,world:c,layers:u,postEdgeGfx:d,chrome:a,stage:i,sidebar:r,interaction:h,camera:p,fan:P,terms:[],nudge:null,async focusOn(T){if(P.focusId===T){z.closeFocus();return}const L=P.focusId!==null;P.focusId=T,P.focusPage=1,h.lastFocusChange=performance.now();const N=f?.center(T)??null;N&&(L||(b={scale:p.targetScale,x:p.targetWorldX,y:p.targetWorldY}),p.frameOn(N.x,N.y),z.nudge={x:N.x,y:N.y,radius:yt},f?.focusOpened?.(N)),f?.focusChanged(),await P.load()},closeFocus(){P.focusId=null,h.lastFocusChange=performance.now(),P.invalidate(),z.nudge=null,f?.focusClosed?.(),b&&(p.targetScale=b.scale,p.targetWorldX=b.x,p.targetWorldY=b.y,b=null),P.clear(),f?.focusChanged()},recenter(){const T=P.focusId===null?null:f?.center(P.focusId)??null;T&&p.frameOn(T.x,T.y)||p.fitToView(f?.bounds()??null,{animate:!0})},syncEmptyHint(T){const L=i.querySelector(`.${W}__empty`);if(T&&!L){const N=document.createElement("div");N.className=`${W}__empty`,N.textContent=t.emptyHint,i.appendChild(N)}else!T&&L&&L.remove()},async refreshCounts(){if(z.terms.length!==0)try{const T=await e.client.fetchTermCounts(t.restTaxonomy,z.terms.map(N=>N.id));let L=!1;z.terms=z.terms.map(N=>{const j=T[String(N.id)];return typeof j=="number"&&j!==N.count?(L=!0,{...N,count:j}):N}),L&&!D&&f?.countsChanged()}catch{}},start(T){f=T,S=ai(n,l,i,{onFirstFit:()=>p.fitToView(T.bounds()),onSettle:()=>z.recenter(),onResize:I}),document.addEventListener("visibilitychange",O),R=fi(a,{matches:T.search,select:L=>void z.focusOn(L.id)}),I(),z.refreshCounts()},teardown(){D=!0,_!==null&&(cancelAnimationFrame(_),_=null),document.removeEventListener("visibilitychange",O),S?.(),R?.(),p.dispose(),ci(l,s,[W,t.modifier])}};try{z.terms=await e.client.fetchAllTerms(t.taxonomy)}catch(T){e.toast(t.loadFailed,T)}return z}const xt=18;function vi(s,e,t,o){const n=new Map;function a(l,c){const u=o.isFocused(c.id),d=ve(c.name,xt),h=String(c.count);l.nameText.text!==d&&(l.nameText.text=d),l.countText.text!==h&&(l.countText.text=h),l.cachedName=d,l.cachedCount=c.count,l.cachedFocused=u,l.cachedColor=c.color;const p=9,f=3,b=5,_=5,$=2,S=l.nameText.width,R=l.nameText.height,D=l.countText.width,P=l.countText.height,y=Math.max(18,D+_*2),E=P+$*2,I=p+S+b+y+p,O=Math.max(R,E)+f*2,H=-I/2;l.bg.clear(),l.bg.roundRect(H,0,I,O,O/2),u?l.bg.fill(c.color):l.cachedHover?(l.bg.fill({color:16777215,alpha:.96}),l.bg.stroke({color:c.color,width:1.5,alpha:1})):(l.bg.fill({color:16777215,alpha:.88}),l.bg.stroke({color:0,width:1,alpha:.06})),l.nameText.x=H+p,l.nameText.y=(O-R)/2,l.nameText.style.fill=u?16777215:1909543;const z=H+p+S+b,T=(O-E)/2;l.countBg.clear(),l.countBg.roundRect(z,T,y,E,E/2),l.countBg.fill(u?{color:16777215,alpha:.25}:c.color),l.countText.x=z+(y-D)/2,l.countText.y=T+(E-P)/2}function i(l){const c=n.get(l.id);if(c)return c;const u=new s.Container;u.eventMode="static",u.cursor="pointer";const d=new s.Graphics,h=new s.Text({text:ve(l.name,xt),style:{fill:1909543,fontSize:14,fontFamily:be,fontWeight:"600"},resolution:_e}),p=new s.Graphics,f=new s.Text({text:String(l.count),style:{fill:16777215,fontSize:12,fontFamily:be,fontWeight:"700"},resolution:_e});u.addChild(d),u.addChild(h),u.addChild(p),u.addChild(f);const b={container:u,bg:d,nameText:h,countBg:p,countText:f,cachedName:"",cachedCount:-1,cachedFocused:!1,cachedHover:!1,cachedColor:-1};return n.set(l.id,b),e.addChild(u),u.on("pointerdown",_=>ue(t,_)),u.on("pointertap",()=>o.onTap(l.id)),u.on("pointerover",()=>{b.cachedHover=!0,a(b,l)}),u.on("pointerout",()=>{b.cachedHover=!1,a(b,l)}),b}const r={relayout(l){a(i(l),l)},destroy(l){const c=n.get(l);c&&(e.removeChild(c.container),c.container.destroy({children:!0}),n.delete(l))},sync(l,c,u){for(const h of[...n.keys()])l.has(h)||r.destroy(h);const d=u!==null;for(const h of l.values()){const p=i(h);p.container.x=h.x,p.container.y=h.y+h.radius+6,p.container.scale.set(c);const f=u===h.id,b=!d||f?1:.4;for(const _ of[p.container,h.gfx])Math.abs(_.alpha-b)>.005?_.alpha+=(b-_.alpha)*.18:_.alpha=b;(p.cachedName!==ve(h.name,xt)||p.cachedCount!==h.count||p.cachedFocused!==f||p.cachedColor!==h.color)&&a(p,h)}}};return r}function yo(s,e,t,o,n,a,i,r,l){const c=1-s;return{x:c*c*c*e+3*c*c*s*o+3*c*s*s*a+s*s*s*r,y:c*c*c*t+3*c*c*s*n+3*c*s*s*i+s*s*s*l}}function wt(s,e,t,o,n,a,i={}){const r=o-e,l=e+r*.5,c=o-r*.5,u=i.alpha??.5,d=i.width??1.5;if(!i.dashed){s.moveTo(e,t),s.bezierCurveTo(l,t,c,n,o,n),s.stroke({color:a,width:d,alpha:u});return}const h=32,p=i.dashPhase??0,f=Math.max(1,i.dashStride??1);let b=e,_=t;for(let $=1;$<=h;$++){const S=yo($/h,e,t,l,t,c,n,o,n);Math.floor(($-1+p)/f)%2===0&&(s.moveTo(b,_),s.lineTo(S.x,S.y),s.stroke({color:a,width:d,alpha:u})),b=S.x,_=S.y}}function ye(s,e,t){const o=e.gfx;o.clear();const n=e.radius;t||(o.circle(0,5,n),o.fill({color:0,alpha:.18})),t&&(o.circle(0,0,n+10),o.fill({color:e.color,alpha:.22})),o.circle(0,0,n),o.fill(ui(e.color,-.18)),o.circle(0,-n*.06,n*.94),o.fill(e.color),o.circle(-n*.32,-n*.42,n*.3),o.fill({color:16777215,alpha:.32}),o.circle(0,0,n),o.stroke({color:16777215,width:t?3:2,alignment:0}),o.x=e.x,o.y=e.y,o.zIndex=10,o.hitArea=new s.Circle(0,0,n+4)}function xo(s,e,t){ye(s,e,!1);const o=e.gfx,n=Math.sin(performance.now()/280)*.5+.5;o.circle(0,0,e.radius+6+n*5),o.stroke({color:t,width:3,alpha:.6+n*.35}),o.circle(0,0,e.radius*.42),o.fill({color:t,alpha:.85}),o.hitArea=new s.Circle(0,0,e.radius+12)}const yi=5500,wo=.05,xi=130;function ko(s,e,t){const o=Array.from(s.values());for(const n of o){if(n.pinned){n.x+=(n.tx-n.x)*.12,n.y+=(n.ty-n.y)*.12,n.gfx.x=n.x,n.gfx.y=n.y;continue}let a=0,i=0;for(const l of o){if(n===l)continue;const c=n.x-l.x,u=n.y-l.y,d=c*c+u*u+1,h=yi/d,p=Math.sqrt(d);a+=c/p*h,i+=u/p*h}const r=s.get(n.parent);if(r){const l=r.x-n.x,c=r.y-n.y,u=Math.sqrt(l*l+c*c)||1,d=u-xi;a+=l/u*d*wo,i+=c/u*d*wo}else a+=-n.x*8e-4,i+=-n.y*8e-4;if(t.nudge&&n.id!==t.focusId){const l=n.x-t.nudge.x,c=n.y-t.nudge.y,u=Math.sqrt(l*l+c*c)||1,d=t.nudge.radius+n.radius;u<d&&(a+=l/u*18*(d-u),i+=c/u*18*(d-u))}n!==t.dragNode&&(n.x+=a*e*.001+(n.tx-n.x)*.02,n.y+=i*e*.001+(n.ty-n.y)*.02),n.gfx.x=n.x,n.gfx.y=n.y}}function wi(s,e){const t={dragNode:null,focusId:null,nudge:null};for(let o=0;o<e;o++)ko(s,16,t);for(const o of s.values())o.tx=o.x,o.ty=o.y}const K=W;function Ge(s,e,t){const o=document.createElement("div");o.className=`${K}__sidebar-header`;const n=document.createElement("span");n.className=`${K}__sidebar-dot`,n.style.background=e;const a=document.createElement("code");a.className=`${K}__sidebar-slug`,a.textContent=t,o.appendChild(n),o.appendChild(a),s.appendChild(o)}function Co(s,e){const t=document.createElement("label");t.className=`${K}__sidebar-label`,t.textContent=e,s.appendChild(t)}function Ee(s,e,t,o){Co(s,e);const n=document.createElement("input");return n.type="text",n.className=`${K}__editor-name`,n.value=t,n.placeholder=o,s.appendChild(n),n}function kt(s,e){const t=Ee(s,m("Slug"),e,m("auto-from-name"));return t.spellcheck=!1,t.autocapitalize="off",t.addEventListener("input",()=>{const o=t.value,n=o.toLowerCase().replace(/[^a-z0-9-]+/g,"-");if(o!==n){const a=t.selectionStart??n.length;t.value=n,t.setSelectionRange(a,a)}}),t}function Ke(s,e){Co(s,m("Description"));const t=document.createElement("textarea");return t.className=`${K}__editor-desc`,t.value=e,t.placeholder=m("Description (optional)"),t.rows=4,s.appendChild(t),t}function So(s,e){const t=document.createElement("p");t.className=`${K}__sidebar-meta`,t.textContent=e,s.appendChild(t)}const le=vt;function Ye(s,e){const t=document.createElement("div");t.className=`${K}__editor-actions`;for(const o of e)t.appendChild(o);s.appendChild(t)}function $o(s,e,t,o){const n=document.createElement("div");n.className=`${K}__sidebar-empty`;const a=document.createElement("span");a.className=`dashicons ${e}`,a.setAttribute("aria-hidden","true"),n.appendChild(a);const i=document.createElement("h3");i.className=`${K}__sidebar-empty-title`,i.textContent=t,n.appendChild(i);const r=document.createElement("p");r.className=`${K}__sidebar-empty-hint`,r.textContent=o,n.appendChild(r),s.appendChild(n)}function Eo(s){const e=vt("danger",m("Delete"));let t=null;return e.addEventListener("click",async()=>{if(!e.classList.contains("is-armed")){e.textContent=m("Click again to delete"),e.classList.add("is-armed"),t!==null&&window.clearTimeout(t),t=window.setTimeout(()=>{e.textContent=m("Delete"),e.classList.remove("is-armed"),t=null},2500);return}t!==null&&(window.clearTimeout(t),t=null),await s()}),e}function Ao(s,e,t){s.addEventListener("keydown",o=>{o.key==="Enter"?(o.preventDefault(),e()):o.key==="Escape"&&t()})}function ki(s,e){const{sidebar:t,client:o}=s,n=e.parent!==0?s.node(e.parent):void 0,a=n?n.color:s.clusterColor(s.terms().length);Ge(t,_o(a),n?V(m("New child of %s"),n.name):m("New root category"));const i=Ee(t,m("Name"),"",m("e.g. Recipes"));requestAnimationFrame(()=>i.focus());const r=kt(t,""),l=Ke(t,""),c=le("primary",m("Create")),u=le("danger",m("Cancel")),d=()=>{s.setDraft(null),oe(s)},h=async()=>{const p=i.value.trim();if(!p){i.focus();return}c.disabled=!0;try{const f=await o.createCategory(p,e.parent,{slug:r.value.trim()||void 0,description:l.value||void 0}),b={id:f.id,name:f.name,slug:f.slug||"",parent:f.parent,count:0,description:f.description||"",isDefault:!1};s.terms().some(_=>_.id===b.id)||s.setTerms(s.terms().concat(b)),s.setDraft(null),s.buildTree(),s.setFocus(f.id),oe(s),await s.loadPosts()}catch(f){c.disabled=!1,s.toast(m("Couldn’t create:"),f)}};c.addEventListener("click",()=>void h()),u.addEventListener("click",d),Ao(i,()=>void h(),d),Ye(t,[c,u])}function Ci(s,e){const{sidebar:t,client:o}=s,n=e.id;Ge(t,_o(e.color),`#${n}`);const a=s.terms().find(p=>p.id===n),i=Ee(t,m("Name"),e.name,m("Name")),r=kt(t,a?.slug||""),l=Ke(t,e.description||"");So(t,V(fe("%d post in this category.","%d posts in this category.",e.count),e.count));const c=le("secondary",m("+ Child"));c.addEventListener("click",()=>{s.setDraft({parent:n}),oe(s)});const u=e.parent&&e.parent!==0?le("secondary",m("Make root")):null;u&&(u.title=m("Promote this category to a top-level root (no parent)."),u.addEventListener("click",async()=>{try{await o.updateTerm("categories",n,{parent:0});const p=s.node(n);p&&(p.parent=0),s.setTerms(s.terms().map(f=>f.id===n?{...f,parent:0}:f)),s.buildTree(),oe(s)}catch(p){s.toast(m("Couldn’t reparent:"),p)}}));const d=le("primary",m("Save"));d.addEventListener("click",async()=>{const p=i.value.trim();if(!p)return;const f=l.value,b=r.value.trim(),_=a?.slug??"";if(p===e.name&&f===(e.description||"")&&b===_)return;const $={name:p,description:f};b!==_&&($.slug=b);try{const S=await o.updateTerm("categories",n,$),R=s.node(n);R&&(R.name=S.name,R.description=S.description),s.setTerms(s.terms().map(D=>D.id===n?{...D,name:S.name,description:S.description,slug:S.slug||D.slug}:D)),s.relayoutNode(n),oe(s)}catch(S){s.toast(m("Couldn’t save:"),S)}});const h=Eo(async()=>{try{await o.deleteTerm("categories",n),s.setTerms(s.terms().filter(p=>p.id!==n)),s.setFocus(null),s.clearPosts(),s.buildTree(),oe(s)}catch(p){s.toast(m("Couldn’t delete:"),p)}});Ye(t,u?[c,u,d,h]:[c,d,h])}function oe(s){s.sidebar.replaceChildren();const e=s.draft();if(e!==null){ki(s,e);return}const t=s.focusId();if(t===null){$o(s.sidebar,"dashicons-admin-tools",m("No category selected"),m("Click a node on the mindmap to edit its name, description, and posts."));return}const o=s.node(t);if(!o){s.setFocus(null),oe(s);return}Ci(s,o)}const To=22,Si=48;function Po(s,e){const t=Math.max(1,...e.map(o=>o.count));return To+(Si-To)*Math.sqrt(s/t)}function Mo(s){return s.isDefault||s.id===1||s.slug==="uncategorized"||s.name.toLowerCase()==="uncategorized"}async function $i(s,e){const t=await vo(s,e,{taxonomy:"categories",restTaxonomy:"category",modifier:"os-mindmap",unavailable:m("Mindmap unavailable."),loadFailed:m("Couldn’t load categories:"),emptyHint:m('No custom categories yet. Click "Add root category" to start branching.'),chrome:{buttons:[{variant:"primary",icon:"dashicons-plus",label:m("Add root category")},{icon:"dashicons-image-rotate",label:m("Recenter")}],searchPlaceholder:m("Search categories…"),searchAria:m("Search categories in the mindmap"),hint:m("Click a node to focus + edit · drag onto another to reparent · wheel to zoom")},layers:["edge","postEdge","post","node","chip","postChip"],fan:{chipFontSize:14,chipTextRes:_e,pagerLabelSize:14,pagerGlyphSize:16,pagerTextRes:_e}});if(!t)return()=>{};const o=t,{pixi:n,layers:a,fan:i,camera:r,interaction:l,world:c}=o,{client:u}=e,d=new n.Graphics;a.edge.addChild(d);const h=new Map,p=vi(n,a.chip,l,{isFocused:w=>i.focusId===w,onTap:w=>void o.focusOn(w)});let f=null,b=null,_=null,$={x:0,y:0};const S=new Map;let R=null;const D=bo(),P=w=>te((D+w*47)%360,55,52);function y(w,v){let g=h.get(w.id);if(g)g.parent=w.parent,g.name=w.name,g.description=w.description,g.count=w.count,g.depth=v.depth,g.color=v.color,g.radius=v.radius,g.tx=v.tx,g.ty=v.ty,g.pinned=v.pinned;else{const x=new n.Graphics;x.eventMode="static",x.cursor="pointer",g={id:w.id,parent:w.parent,name:w.name,description:w.description,count:w.count,x:v.tx,y:v.ty,tx:v.tx,ty:v.ty,radius:v.radius,depth:v.depth,color:v.color,gfx:x,pinned:v.pinned},a.node.addChild(x);const k=g;x.on("pointerdown",M=>O(M,k)),h.set(w.id,g)}return ye(n,g,!1),g}function E(){const w=o.terms,v=new Map;for(const A of w){const F=v.get(A.parent)??[];F.push(A),v.set(A.parent,F)}const g=v.get(0)??[],x=g.filter(A=>!Mo(A)),k=g.find(Mo),M=(A,F,Z,ie,X)=>{const de=x.length>1?110+x.length*28:0,pe=k?Math.max(de,140):de,qo=F===0?pe:pe+160+(F-1)*150,Wi=F===0?P(Z):h.get(A.parent)?.color??P(Z);y(A,{tx:qo*Math.cos(ie),ty:qo*Math.sin(ie),radius:Po(A.count,w),depth:F,color:Wi,pinned:F===0});const At=v.get(A.id)??[];if(At.length>0){const Uo=X/At.length;At.forEach((Vi,Bi)=>M(Vi,F+1,Z,ie-X/2+Uo*(Bi+.5),Uo*.85))}},U=new Set(w.map(A=>A.id));for(const[A,F]of h)U.has(A)||(a.node.removeChild(F.gfx),F.gfx.destroy(),h.delete(A),p.destroy(A));const Y=Math.max(1,x.length);x.forEach((A,F)=>M(A,0,F,2*Math.PI/Y*F,2*Math.PI/Y)),k&&y(k,{tx:0,ty:0,radius:Po(k.count,w),depth:0,color:9211796,pinned:!0}),o.syncEmptyHint(w.length<=1)}function I(){d.clear();for(const w of h.values()){const v=w.parent?h.get(w.parent):void 0;if(!v)continue;const g=f!==null&&w===f,x=i.focusId!==null&&(w.id===i.focusId||w.parent===i.focusId),k=i.focusId!==null&&!x?.35:1;wt(d,v.x,v.y,w.x,w.y,v.color,g?{dashed:!0,alpha:.28*k}:{alpha:.5*k})}if(f&&b){const{x:w,y:v}=f,{x:g,y:x,color:k}=b;wt(d,w,v,g,x,k,{alpha:.22,width:9}),wt(d,w,v,g,x,k,{alpha:.95,width:2.5,dashed:!0,dashStride:2,dashPhase:Math.floor(performance.now()/70)});const M=performance.now()%1300/1300,U=g-w,Y=yo(M,w,v,w+U*.5,v,g-U*.5,x,g,x);d.circle(Y.x,Y.y,5),d.fill({color:16777215,alpha:.95}),d.stroke({color:k,width:2,alpha:1})}i.drawEdges()}function O(w,v){ue(l,w),f=v,v.pinned=!0,v.tx=v.x,v.ty=v.y,_={x:w.global.x,y:w.global.y};const g=r.stageToWorld(w.global);$={x:v.x-g.x,y:v.y-g.y}}function H(w,v){let g=h.get(v),x=32;for(;g&&x-- >0;){if(g.id===w)return!0;if(!g.parent)return!1;g=h.get(g.parent)}return!1}function z(w){if(!f)return;const v=w.x+$.x,g=w.y+$.y;f.x=v,f.y=g,f.tx=v,f.ty=g,f.gfx.x=v,f.gfx.y=g;let x=null;for(const k of h.values()){if(k===f)continue;const M=k.x-w.x,U=k.y-w.y;if(M*M+U*U<k.radius*k.radius){x=k;break}}x!==b&&(b&&ye(n,b,i.focusId===b.id),b=x,x&&xo(n,x,f.color))}async function T(w){if(!f)return;const v=f,g=b,x=mo(_,w);if(f=null,b=null,_=null,v.pinned=v.depth===0,!g&&x<2){o.focusOn(v.id);return}if(g&&g.id!==v.parent&&!H(v.id,g.id))try{await u.updateTerm("categories",v.id,{parent:g.id}),v.parent=g.id,o.terms=o.terms.map(k=>k.id===v.id?{...k,parent:g.id}:k),E()}catch(k){e.toast(m("Reparent failed:"),k)}else ye(n,v,i.focusId===v.id),g&&ye(n,g,i.focusId===g.id)}const L={sidebar:o.sidebar,client:u,toast:e.toast,terms:()=>o.terms,setTerms:w=>{o.terms=w},node:w=>h.get(w),focusId:()=>i.focusId,setFocus:w=>{i.focusId=w},draft:()=>R,setDraft:w=>{R=w&&w.parent!==0&&!h.get(w.parent)?R:w},clusterColor:P,buildTree:E,relayoutNode:w=>{const v=h.get(w);v&&p.relayout(v)},clearPosts:()=>i.clear(),loadPosts:()=>i.load()};function N(){if(h.size===0)return null;const w=30,v={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const g of h.values())v.minX=Math.min(v.minX,g.tx-g.radius),v.minY=Math.min(v.minY,g.ty-g.radius),v.maxX=Math.max(v.maxX,g.tx+g.radius),v.maxY=Math.max(v.maxY,g.ty+g.radius+w);return v}const[j,he]=o.chrome.buttons;return he.addEventListener("click",()=>o.recenter()),j.addEventListener("click",()=>{R={parent:0},oe(L)}),E(),oe(L),wi(h,80),o.start({center:w=>{const v=h.get(w);return v?{x:v.x,y:v.y,tone:v.color}:null},countReconciled:(w,v)=>{const g=h.get(w);g&&g.count!==v&&(g.count=v,o.terms=o.terms.map(x=>x.id===w?{...x,count:v}:x),p.relayout(g))},focusChanged:()=>{for(const w of h.values())ye(n,w,i.focusId===w.id);oe(L)},focusOpened:w=>{S.clear();for(const v of h.values()){if(v.id===i.focusId||!v.pinned)continue;const g=v.x-w.x,x=v.y-w.y,k=Math.sqrt(g*g+x*x)||1;if(k>=yt+v.radius)continue;S.set(v.id,{tx:v.tx,ty:v.ty});const M=yt+v.radius+20;v.tx=w.x+g/k*M,v.ty=w.y+x/k*M}},focusClosed:()=>{for(const[w,v]of S){const g=h.get(w);g&&(g.tx=v.tx,g.ty=v.ty)}S.clear()},bounds:N,frame:w=>{ko(h,w,{dragNode:f,focusId:i.focusId,nudge:o.nudge}),i.ease(),I(),f&&b&&xo(n,b,f.color);const v=1/Math.max(.01,c.scale.x);p.sync(h,v,i.focusId),i.syncChips(v)},countsChanged:()=>{for(const w of o.terms){const v=h.get(w.id);v&&v.count!==w.count&&(v.count=w.count,p.relayout(v))}E(),r.fitToView(N(),{animate:!0})},dragging:()=>f!==null,pointerMove:(w,v)=>f?(z(v),!0):!1,pointerUp:T,search:w=>Array.from(h.values()).filter(v=>v.name.toLowerCase().includes(w))}),()=>o.teardown()}const Ei=q`:host{display:inline-flex;max-width:100%}.os-tag-input{display:inline-flex;flex-wrap:wrap;align-items:center;gap:var( --os-ui-tag-input-gap,4px );padding:var( --os-ui-tag-input-padding,2px );min-height:24px;max-width:100%}.os-tag-input__chips{display:inline-flex;flex-wrap:wrap;align-items:center;gap:var( --os-ui-tag-input-gap,4px );min-width:0}.os-tag-input__add{appearance:none;display:inline-flex;align-items:center;gap:3px;padding:1px 8px;min-height:22px;font:inherit;font-size:11px;font-weight:500;line-height:1;color:var( --os-ui-tag-input-add-fg,var( --os-ui-fg-muted,#50575e ) );background:transparent;border:1px dashed var( --os-ui-tag-input-add-border,var( --os-ui-border,#c3c4c7 ) );border-radius:999px;cursor:pointer;transition:background-color 0.12s ease,color 0.12s ease,border-color 0.12s ease}.os-tag-input__add:hover:not(:disabled ){background:var( --os-ui-hover,rgba( 0,0,0,0.04 ) );color:var( --os-ui-tag-input-add-fg-hover,var( --os-ui-fg,#1d2327 ) );border-color:var( --os-ui-tag-input-add-border-hover,var( --os-ui-border-strong,#8c8f94 ) )}.os-tag-input__add:focus-visible{outline:none;border-style:solid;box-shadow:var( --os-ui-focus-ring,0 0 0 2px rgba( 12,11,15,0.9 ),0 0 0 4px #2271b1 )}.os-tag-input__add:disabled{opacity:0.5;cursor:not-allowed}.os-tag-input__add svg{display:block}.os-tag-input__editor{position:relative;display:inline-flex;align-items:center;flex:0 1 auto;min-width:120px}.os-tag-input__input{appearance:none;font:inherit;font-size:var( --os-ui-field-font-size-compact,12px );line-height:1.4;padding:2px 8px;border:1px solid var( --os-ui-tag-input-input-border,var( --os-ui-border,#2271b1 ) );border-radius:999px;background:var( --os-ui-tag-input-input-bg,var( --os-ui-surface,#fff ) );color:var( --os-ui-tag-input-input-fg,var( --os-ui-fg,#1d2327 ) );min-width:80px;max-width:240px}.os-tag-input__input:focus{outline:none;border-color:var( --os-ui-accent,#2271b1 );box-shadow:var( --os-ui-focus-ring-field,0 0 0 1px #2271b1,0 0 0 4px rgba( 34,113,177,0.18 ) )}.os-tag-input__suggestions{position:absolute;top:calc( 100% + 4px );left:0;min-width:220px;max-width:320px;max-height:240px;overflow-y:auto;padding:4px 0;background:var( --os-ui-tag-input-pop-bg,var( --os-ui-surface,#fff ) );color:var( --os-ui-tag-input-pop-fg,var( --os-ui-fg,#1d2327 ) );border:1px solid var( --os-ui-tag-input-pop-border,var( --os-ui-border,#c3c4c7 ) );border-radius:8px;box-shadow:0 6px 16px rgba( 0,0,0,0.08 ),0 1px 2px rgba( 0,0,0,0.06 );z-index:50}.os-tag-input__suggestion-item{display:flex;align-items:center;gap:6px;padding:6px 12px;font-size:13px;cursor:pointer;user-select:none}.os-tag-input__suggestion-item[ aria-selected='true' ]{background:color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 10%,transparent );color:var( --wp-admin-theme-color,#2271b1 )}.os-tag-input__suggestion-create{font-style:italic;color:var( --os-ui-tag-input-create-fg,var( --os-ui-fg-muted,#50575e ) );border-top:1px solid var( --os-ui-tag-input-pop-divider,var( --os-ui-border,#f0f0f1 ) )}.os-tag-input__suggestion-create[ aria-selected='true' ]{color:var( --wp-admin-theme-color,#2271b1 )}.os-tag-input__suggestion-empty,.os-tag-input__suggestion-loading{display:flex;align-items:center;gap:8px;padding:8px 12px;font-size:12px;color:var( --os-ui-tag-input-pop-muted,var( --os-ui-fg-muted,#646970 ) )}.os-tag-input__suggestion-spinner{display:inline-block;width:10px;height:10px;border-radius:50%;border:2px solid currentColor;border-top-color:transparent;animation:os-tag-input-spin 0.8s linear infinite}@keyframes os-tag-input-spin{to{transform:rotate( 360deg )}}:host( [ disabled ] ) .os-tag-input{opacity:0.6;pointer-events:none}`,Oe=class Oe extends G{constructor(){super(...arguments),this._value=[],this._suggestions=[],this._suggestionsLoading=!1,this._query="",this._highlight=-1,this._focusedChip=-1,this._onDocumentPointerDown=e=>{!this.isOpen||e.composedPath().includes(this)||this.closeInput()}}get _input(){const e=this.shadowRoot;return e?e.querySelector(".os-tag-input__input"):null}get value(){return this._value}set value(e){this._value=Array.isArray(e)?e.slice():[],this._focusedChip>=this._value.length&&(this._focusedChip=-1),this.requestUpdate()}get suggestions(){return this._suggestions}set suggestions(e){this._suggestions=Array.isArray(e)?e.slice():[],this._highlight=this._suggestions.length>0?0:-1,this._suggestionsLoading=!1,this.requestUpdate()}get suggestionsLoading(){return this._suggestionsLoading}set suggestionsLoading(e){this._suggestionsLoading=!!e,this.requestUpdate()}get query(){return this._query}get isOpen(){return this.open!==null}openInput(){this.isOpen||(this.open="",this._query="",this._highlight=-1,this.emit("os-tag-open",{}),queueMicrotask(()=>{this._input?.focus(),this._emitSuggest("")}))}closeInput(){this.isOpen&&(this.open=null,this._query="",this._suggestions=[],this._highlight=-1,this._suggestionsLoading=!1,this.emit("os-tag-close",{}),this.requestUpdate())}connectedCallback(){super.connectedCallback(),document.addEventListener("pointerdown",this._onDocumentPointerDown,!0)}disconnectedCallback(){document.removeEventListener("pointerdown",this._onDocumentPointerDown,!0)}render(){const e=this.isOpen,t=this.disabled!==null,o=this.readonly!==null,n=this.removable!==null||this.removable===null&&!o,a=this.creatable!==null,i=this["add-label"]||"Add",r=this.placeholder||"Add a tag…";return C` | |
| 633 | + </os-tabpanel>`:""} | |
| 634 | + </div>`},mounted:g=>{const b=g.ui(st),v=[];b.stats=Ai(g.root,g.fetch,Js(g.extra)),b.stats.sync(),v.push(()=>b.stats?.dispose());const S=Ut(g,b,s),T=new MutationObserver(()=>{ee(g)?.toggleAttribute("loading",g.root.getAttribute("aria-busy")==="true")});T.observe(g.root,{attributes:!0,attributeFilter:["aria-busy"]}),v.push(()=>T.disconnect()),ot(g,b).fetchAuthorOptions().then(M=>{b.filterData.authors=M,g.repaint()}),b.filterData.loadMoreTags=()=>void eo(g,b),eo(g,b),b.menu=Ko(g.root,{section:f("Show columns"),prefix:o,items:pi(S),isChecked:M=>!Se(b,n).has(M),onToggle:M=>{const R=Se(b,n);R.has(M)?R.delete(M):R.add(M);const H=window.wp?.os;H&&typeof H.updateOsSettings=="function"&&H.updateOsSettings({[n]:Array.from(R).sort()},{windowId:g.windowId}),g.repaint()}}),v.push(()=>b.menu?.dispose());const z=window.wp?.os;if(z&&typeof z.subscribeOsSettings=="function"){let M=Array.from(Se(b,n)).sort().join(",");v.push(z.subscribeOsSettings(()=>{const R=Ws(n),H=Array.from(R).sort().join(",");H!==M&&(M=H,b.hidden=R,g.repaint(),b.menu?.refresh())}))}z&&typeof z.subscribe=="function"&&v.push(z.subscribe("os.term.changed",M=>{M?.taxonomy==="category"&&(Tt(S),Bn(S))}));const P=()=>g.repaint();document.addEventListener("os-mode-changed",P),v.push(()=>document.removeEventListener("os-mode-changed",P)),v.push(l(g,b));const y=Ot(g,b),E=window.wp?.hooks;return E&&typeof E.doAction=="function"&&E.doAction(li,y),document.dispatchEvent(new CustomEvent("os-posts-window-opened",{detail:y})),()=>{b.disposed=!0;for(const M of v)M();b.feed.dispose(),b.atlas?.(),b.editor?.(),b.editor=null,b.canvases.categories?.(),b.canvases.tags?.(),b.canvases={categories:null,tags:null},Tt(S)}},updated:g=>{qi(g.root),m(g,g.ui(st));const b=ee(g);if(!b)return;g.loading&&b.setAttribute("loading","");const v=g.ui(st);v.stats?.sync(),v.feed.observe(g.root);const{state:S,data:T}=g,z=Ut(g,v,s),P=`${Array.from(Se(v,n)).sort().join(",")}|${Bi(v.filterData)}`;P!==v.columnsKey&&(v.columnsKey=P,v.cellCache.clear(),v.table.invalidateColumns());const y=v.feed.items;v.table.sync({table:b,rows:y,listKey:[S.perPage,S.search,S.status,S.orderby,S.order,S.author.join(","),S.tag.join(",")].join("|"),fingerprint:Wi(y),columns:M=>(v.cellCache.clear(),Dt(z,v.cellCache,v.filterData,M,Se(v,n))),wire:()=>ji(g,v,b),onSelection:M=>{v.selected=M.length}}).dataChanged&&(y.some(M=>M.id===v.desk.focused)||(v.desk.focused=null),queueMicrotask(()=>{v.disposed||g.repaint()}),v.cellCache.clear(),Hs(z,y),T&&Ci(T))}})}function oo(o){return Math.hypot(o.b.x-o.a.x,o.b.y-o.a.y)}function no(o){return{x:(o.a.x+o.b.x)/2,y:(o.a.y+o.b.y)/2}}function Gi(o,e,t,s){const n=oo(e),a=oo(t),i=n>0&&a>0?a/n:1,r=Math.max(s.min,Math.min(s.max,o.scale*i)),c=no(e),l=no(t),d=(c.x-o.x)/o.scale,u=(c.y-o.y)/o.scale;return{scale:r,x:l.x-d*r,y:l.y-u*r}}function Xi(o,e){const t=o.ownerDocument.defaultView,s=new AbortController,n=new Map,a=o.style.touchAction;o.style.touchAction="none";let i=!1,r=0;const c=u=>{const h=o.getBoundingClientRect();return{x:u.clientX-h.left,y:u.clientY-h.top}},l={capture:!0,passive:!1,signal:s.signal};t.addEventListener("pointerdown",u=>{u.pointerType!=="touch"||!u.composedPath().includes(o)||(n.set(u.pointerId,c(u)),n.size>=2&&(u.preventDefault(),i||(i=!0,e.start())))},l),t.addEventListener("pointermove",u=>{if(!n.has(u.pointerId))return;if(!i){n.set(u.pointerId,c(u));return}const[h,p]=n.values();if(n.set(u.pointerId,c(u)),u.preventDefault(),p){const[m,_]=n.values();e.write(Gi(e.read(),{a:h,b:p},{a:m,b:_},e.bounds))}},l);const d=u=>{n.delete(u.pointerId)&&i&&(u.preventDefault(),n.size||(i=!1,r=performance.now()+300,e.end()))};return t.addEventListener("pointerup",d,l),t.addEventListener("pointercancel",d,l),t.addEventListener("lostpointercapture",d,l),t.addEventListener("click",u=>{u.detail>0&&(i||performance.now()<r)&&u.composedPath().includes(o)&&(u.preventDefault(),u.stopImmediatePropagation())},l),{active:()=>i,dispose:()=>{s.abort(),n.clear(),i&&e.end(),i=!1,o.style.touchAction=a}}}const io="__openStationSharedStores";function Yi(){const o=window;let e=o[io];return e||(e=new Map,o[io]=e),e}function Zi(o,e){const t=Yi();let s=t.get(o);s||(s={state:e(),listeners:new Set,rebuild:e},t.set(o,s));const n={get state(){return s.state},set state(a){s.state=a},getState(){return s.state},notify(){for(const a of Array.from(s.listeners))try{a(s.state)}catch(i){console.error(`[desktop-mode/shared-store:${o}] subscriber threw:`,i)}},subscribe(a){return s.listeners.add(a),()=>{s.listeners.delete(a)}},setState(a){const i=s.state;if(typeof i!="object"||i===null){console.warn(`[desktop-mode/shared-store:${o}] setState called on a primitive store; use the state setter instead.`);return}Object.assign(i,a),n.notify()},reset(){const a=s.rebuild(),i=s.state;if(typeof i=="object"&&i!==null&&typeof a=="object"&&a!==null){const r=i;for(const c of Object.keys(r))delete r[c];Object.assign(r,a)}else s.state=a;s.listeners.clear()}};return n}const ao=Object.freeze({top:0,right:0,bottom:0,left:0});function Ji(o,e,t,s){return{left:o,top:e,width:t,height:s,right:o+t,bottom:e+s}}function Qi(o,e){const t=n=>Math.min(Math.max(0,e.width),Math.max(0,n)),s=n=>Math.min(Math.max(0,e.height),Math.max(0,n));return{top:s(o.top-e.top),bottom:s(e.bottom-o.bottom),left:t(o.left-e.left),right:t(e.right-o.right)}}const ea="os/work-area";function ta(){return{insets:{...ao},rect:{x:0,y:0,width:0,height:0},viewport:{x:0,y:0,width:0,height:0},area:{width:0,height:0}}}const sa=Zi(ea,()=>({snapshot:ta(),installed:!1,areaEl:null}));function oa(o){const{installed:e,snapshot:t}=sa.state;if(!e)return{...ao};const s=t.viewport;return Qi(Ji(s.x,s.y,s.width,s.height),o.getBoundingClientRect())}const nt=170,na=()=>({pixiInteractionAt:0,pinchUntil:0,lastFocusChange:0,panMovedDist:0,panActive:!1,panStart:null}),ne=o=>performance.now()<o.pinchUntil;function ve(o,e){e.stopPropagation?.(),o.pixiInteractionAt=performance.now()}function ro(o,e){return!o||!e?.global?1/0:Math.hypot(e.global.x-o.x,e.global.y-o.y)}function ia(o,e,t){const s=performance.now();return ne(o)||s-o.lastFocusChange<250||s-o.pixiInteractionAt<250||o.panMovedDist>4?!1:e.target===t}function aa(o,e,t){const s={targetScale:o.scale.x,targetWorldX:o.x,targetWorldY:o.y,ease(){const r=s.targetScale-o.scale.x,c=s.targetWorldX-o.x,l=s.targetWorldY-o.y;(Math.abs(r)>5e-4||Math.abs(c)>.5||Math.abs(l)>.5)&&(o.scale.set(o.scale.x+r*.22),o.x+=c*.22,o.y+=l*.22)},stageToWorld(i){return{x:(i.x-o.x)/o.scale.x,y:(i.y-o.y)/o.scale.y}},pan(i,r){o.x+=i,o.y+=r,s.targetWorldX+=i,s.targetWorldY+=r},fitToView(i,r={}){const c=r.padding??90,l=r.animate??!1,d=e.getBoundingClientRect(),u=oa(e),h=u.left,p=u.top,m=Math.max(0,d.width-u.left-u.right),_=Math.max(0,d.height-u.top-u.bottom);if(!i||m===0||_===0){const M=h+m/2,R=p+_/2;s.targetScale=1,s.targetWorldX=M,s.targetWorldY=R,l||(o.x=M,o.y=R,o.scale.set(1));return}const g=Math.max(1,i.maxX-i.minX),b=Math.max(1,i.maxY-i.minY),v=(m-c*2)/g,S=(_-c*2)/b,T=Math.max(.2,Math.min(1.5,Math.min(v,S))),z=(i.minX+i.maxX)/2,P=(i.minY+i.maxY)/2,y=h+m/2-z*T,E=p+_/2-P*T;s.targetScale=T,s.targetWorldX=y,s.targetWorldY=E,l||(o.scale.set(T),o.x=y,o.y=E)},frameOn(i,r){const c=e.getBoundingClientRect();if(c.width<=0||c.height<=0)return!1;const l=nt+70,d=c.width*.85/(2*l),u=c.height*.85/(2*l),h=Math.max(.5,Math.min(1.6,Math.min(d,u)));return s.targetScale=h,s.targetWorldX=c.width/2-i*h,s.targetWorldY=c.height/2-r*h,!0},dispose(){e.removeEventListener("wheel",n),a.dispose()}};function n(i){i.preventDefault();const c=Math.exp(-i.deltaY*8e-4),l=s.targetScale,d=Math.max(.3,Math.min(2.5,l*c));if(Math.abs(d-l)<5e-4)return;const u=e.getBoundingClientRect(),h=i.clientX-u.left,p=i.clientY-u.top,m=(h-s.targetWorldX)/l,_=(p-s.targetWorldY)/l;s.targetScale=d,s.targetWorldX=h-m*d,s.targetWorldY=p-_*d}const a=Xi(e,{read:()=>({x:o.x,y:o.y,scale:o.scale.x}),write:i=>{o.scale.set(i.scale),o.x=i.x,o.y=i.y,s.targetScale=i.scale,s.targetWorldX=i.x,s.targetWorldY=i.y},bounds:{min:.2,max:2.5},start:()=>t?.start(),end:()=>t?.end()});return e.addEventListener("wheel",n,{passive:!1}),s}function ra(o,e,t,s){let n=!1,a=0,i=0;const r=24,c=80;let l=null;const d=()=>{const h=t.getBoundingClientRect();e.renderer.resize(h.width,h.height),e.stage.hitArea=new o.Rectangle(0,0,h.width,h.height),!n&&h.width>0&&h.height>0&&(n=!0,a=h.width,i=h.height,s.onFirstFit(),t.classList.remove("is-loading")),l!==null&&window.clearTimeout(l),l=window.setTimeout(()=>{l=null;const p=t.getBoundingClientRect();(Math.abs(p.width-a)>=r||Math.abs(p.height-i)>=r)&&(a=p.width,i=p.height,s.onSettle())},c),e.render(),s.onResize?.()},u=new ResizeObserver(d);return u.observe(t),()=>{u.disconnect(),l!==null&&window.clearTimeout(l)}}const Ee='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',Ae=4;function Te(o,e){return o.length>e?o.slice(0,e-1)+"…":o}async function la(o,e){const t=window.wp?.os;if(!t||typeof t.loadModules!="function")return o.textContent=`${e} ${f("Shell modules API missing.")}`,null;try{await t.loadModules(["pixijs"])}catch{return o.textContent=e,null}const s=window.PIXI;return s||(o.textContent=e),s??null}async function ca(o,e,t){const s=new o.Application;await s.init({resizeTo:e,backgroundAlpha:0,antialias:!0,autoDensity:!0,resolution:Math.min(window.devicePixelRatio||1,2)}),e.appendChild(s.canvas),s.canvas.classList.add(t);const n=new o.Container;return n.x=e.clientWidth/2,n.y=e.clientHeight/2,s.stage.addChild(n),s.stage.eventMode="static",s.stage.hitArea=new o.Rectangle(0,0,e.clientWidth,e.clientHeight),{app:s,world:n}}function da(o,e,t){try{o.ticker?.stop()}catch{}try{o.destroy({removeView:!0},{children:!0})}catch{}e.replaceChildren(),e.classList.remove(...t)}function it(o=document.body){try{const e=getComputedStyle(o),t=e.getPropertyValue("--os-ui-accent").trim()||e.getPropertyValue("--wp-admin-theme-color").trim();if(!t)return 210;const s=document.createElement("span");s.style.color=t,o.appendChild(s);const n=getComputedStyle(s).color;s.remove();const a=n.match(/\d+/g);return!a||a.length<3?210:ua(parseInt(a[0],10),parseInt(a[1],10),parseInt(a[2],10))}catch{return 210}}function ua(o,e,t){const s=o/255,n=e/255,a=t/255,i=Math.max(s,n,a),r=Math.min(s,n,a),c=i-r;if(c===0)return 210;let l;switch(i){case s:l=(n-a)/c+(n<a?6:0);break;case n:l=(a-s)/c+2;break;default:l=(s-n)/c+4;break}return Math.round(l*60)}function lo(o,e,t){const s=e/100,n=t/100,a=(1-Math.abs(2*n-1))*s,i=o/60,r=a*(1-Math.abs(i%2-1));let c=0,l=0,d=0;i<1?(c=a,l=r):i<2?(c=r,l=a):i<3?(l=a,d=r):i<4?(l=r,d=a):i<5?(c=r,d=a):(c=a,d=r);const u=n-a/2;return Math.round((c+u)*255)*65536+Math.round((l+u)*255)*256+Math.round((d+u)*255)}function pa(o,e){const t=Math.floor(o/65536)%256,s=Math.floor(o/256)%256,n=o%256,a=i=>Math.round(i*(1+e));return a(t)*65536+a(s)*256+a(n)}function co(o){return`#${o.toString(16).padStart(6,"0")}`}function ha(o){const e=document.createElement("div");return e.innerHTML=o,e.textContent||e.innerText||""}const fa=F` .os-term-canvas__intro{padding:22px 24px 18px;background:var( --os-ui-surface,#fff );flex-shrink:0}.os-term-canvas__intro h2{font-size:28px;font-weight:500;letter-spacing:-0.035em;margin:0 0 6px;color:var( --os-ui-fg,#1d2327 )}.os-term-canvas__intro p{font-size:12px;margin:0;color:var( --os-ui-fg-muted,#646970 )}.os-term-directory{position:absolute;inset-block:12px;inset-inline-start:12px;inline-size:min( 300px,calc( 100% - 24px ) );z-index:5;box-sizing:border-box;display:flex;flex-direction:column;gap:10px;padding:16px;border:1px solid var( --os-ui-border,#dcdcde );border-radius:12px;background:var( --os-ui-surface,#fff );color:var( --os-ui-fg,#1d2327 );box-shadow:var( --os-ui-shadow-sheet,0 6px 24px rgba( 0,0,0,0.12 ) )}.os-term-directory header{display:flex;align-items:center;justify-content:space-between}.os-term-directory h3{font-size:17px;margin:0;color:inherit}.os-term-directory__count{font-size:11px;margin:0;color:var( --os-ui-fg-muted,#646970 )}.os-term-directory__items{overflow:auto;min-block-size:0;flex:1;display:flex;flex-direction:column;gap:4px}.os-term-directory__items os-button{flex-shrink:0}.os-term-directory__items os-button::part( button ){inline-size:100%;justify-content:space-between;text-align:start;white-space:normal}.os-term-directory__items small{color:var( --os-ui-fg-muted,#646970 );white-space:nowrap;font-size:10px}@container content-desk (max-width:540px){.os-term-canvas__intro{padding:14px}.os-term-canvas__intro h2{font-size:23px}.os-term-canvas__intro p{display:none}}.os-term-canvas__toolbar{flex-wrap:wrap;padding:12px 20px}.os-term-canvas__toolbar>button,.os-term-directory__toggle{flex-shrink:0;white-space:nowrap}.os-term-canvas__toolbar .os-term-canvas__hint{flex-basis:100%;font-size:11px}.os-term-canvas__search-input{border-radius:8px;border:1px solid var( --os-ui-border,#dcdcde );padding:8px 10px;background:var( --os-ui-surface,#fff );color:var( --os-ui-fg,#1d2327 )}`,B="os-term-canvas";function Wt(o,e){const t=document.createElement("button");return t.type="button",t.className=`${B}__btn${o?` ${B}__btn--${o}`:""}`,t.textContent=e,t}function ga(o,e,t){o.replaceChildren(),o.classList.add(B,e);const s=document.createElement("style");s.textContent=fa.cssText,o.appendChild(s);const n=document.createElement("header");n.className="os-term-canvas__intro";const a=document.createElement("h2");a.textContent=f(e==="os-mindmap"?"Give your ideas a home.":"Find the threads.");const i=document.createElement("p");i.textContent=f(e==="os-mindmap"?"Build branches for your stories. Choose a category to explore its posts.":"See what connects your stories. Choose a tag to follow the conversation."),n.append(a,i),o.appendChild(n);const r=document.createElement("div");r.className=`${B}__toolbar`;const c=t.buttons.map(g=>{const b=Wt(g.variant??"",""),v=document.createElement("span");return v.className=`dashicons ${g.icon}`,v.setAttribute("aria-hidden","true"),b.replaceChildren(v,document.createTextNode(g.label)),g.title&&(b.title=g.title),r.appendChild(b),b}),l=document.createElement("div");l.className=`${B}__search`;const d=document.createElement("input");d.type="search",d.className=`${B}__search-input`,d.placeholder=t.searchPlaceholder,d.setAttribute("aria-label",t.searchAria),l.appendChild(d);const u=document.createElement("ul");u.className=`${B}__search-results`,u.hidden=!0,l.appendChild(u);const h=document.createElement("span");h.className=`${B}__hint`,h.textContent=t.hint,r.appendChild(l),r.appendChild(h),o.appendChild(r);const p=document.createElement("div");p.className=`${B}__layout`,o.appendChild(p);const m=document.createElement("div");m.className=`${B}__stage is-loading`,p.appendChild(m);const _=document.createElement("aside");return _.className=`${B}__sidebar`,p.appendChild(_),{toolbar:r,stage:m,sidebar:_,buttons:c,searchWrap:l,searchInput:d,searchResults:u}}function ma(o,e){const{searchInput:t,searchResults:s,searchWrap:n}=o;let a=[],i=0;const r=()=>{s.querySelectorAll(`.${B}__search-result`).forEach((m,_)=>{const g=_===i;m.classList.toggle("is-active",g),g&&m.scrollIntoView({block:"nearest"})})},c=()=>{t.value="",s.hidden=!0,s.replaceChildren(),a=[],i=0},l=m=>{c(),e.select(m)},d=()=>{const m=t.value.trim().toLowerCase();if(m.length===0){s.hidden=!0,s.replaceChildren(),a=[],i=0;return}a=e.matches(m).sort((_,g)=>g.count-_.count).slice(0,10),i=0,s.replaceChildren(),a.forEach((_,g)=>{const b=document.createElement("li"),v=document.createElement("button");v.type="button",v.className=`${B}__search-result`,g===0&&v.classList.add("is-active");const S=document.createElement("span");S.className=`${B}__search-title`,S.textContent=_.name||`#${_.id}`;const T=document.createElement("span");T.className=`${B}__search-meta`,T.textContent=W(de("%d post","%d posts",_.count),_.count),v.appendChild(S),v.appendChild(T),v.addEventListener("mousedown",z=>{z.preventDefault(),l(_)}),v.addEventListener("mouseenter",()=>{i=g,r()}),b.appendChild(v),s.appendChild(b)}),s.hidden=a.length===0},u=m=>{if(m.key==="ArrowDown"||m.key==="ArrowUp"||m.key==="Enter"){if(a.length===0)return;m.preventDefault(),m.key==="ArrowDown"?(i=Math.min(i+1,a.length-1),r()):m.key==="ArrowUp"?(i=Math.max(i-1,0),r()):l(a[i])}else m.key==="Escape"&&c()},h=()=>{setTimeout(()=>{s.hidden=!0},120)},p=m=>{n.contains(m.target)||(s.hidden=!0)};return t.addEventListener("input",d),t.addEventListener("focus",d),t.addEventListener("keydown",u),t.addEventListener("blur",h),document.addEventListener("click",p),()=>{t.removeEventListener("input",d),t.removeEventListener("focus",d),t.removeEventListener("keydown",u),t.removeEventListener("blur",h),document.removeEventListener("click",p)}}const ba=F` ${_e} ${Ss} ${Es} ${As} ${Ts} ${Is}:host{display:inline-flex}:host( [ fill-cell ] ){display:flex;width:100%}button{appearance:none;display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:var( --os-ui-button-padding,6px 12px );border-radius:var( --os-ui-button-border-radius,6px );font:inherit;font-weight:500;cursor:pointer;transition:background-color var( --_holo-t ) ease,color var( --_holo-t ) ease,border-color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease,transform 80ms ease;background:var( --os-ui-button-bg,transparent );background-image:var( --os-ui-button-bg-image,none );background-repeat:var( --os-ui-button-bg-image-repeat,repeat );background-size:var( --os-ui-button-bg-image-size,auto );background-position:var( --os-ui-button-bg-image-position,center );color:var( --os-ui-button-fg,var( --os-ui-fg,#1d2327 ) );border:var( --os-ui-button-border,1px solid var( --os-ui-border,#c3c4c7 ) )}:host( [ fill-cell ] ) button{width:100%;min-height:var( --os-ui-button-min-height,44px )}button:disabled{opacity:0.5;cursor:not-allowed}button:active:not(:disabled ){transform:translateY( 1px )}button:hover:not(:disabled ){background-color:var( --os-ui-button-bg-hover,var( --os-ui-hover,rgba( 0,0,0,0.04 ) ) )}button:focus-visible{outline:none;box-shadow:var( --_holo-focus )}button:disabled::before,button:disabled::after,button:disabled .os-holo-glint{opacity:0 !important}:host( [ variant='primary' ] ) button{background-color:var( --os-ui-button-bg,var( --wp-admin-theme-color,#2271b1 ) );color:var( --os-ui-button-fg,var( --os-ui-accent-ink,var( --os-ui-fg-on-accent,#fff ) ) );border:var( --os-ui-button-border,1px solid transparent )}:host( [ variant='primary' ] ) button:hover:not(:disabled ){filter:brightness( 1.06 );background-color:var( --os-ui-button-bg,var( --wp-admin-theme-color,#2271b1 ) );box-shadow:var( --_holo-glow )}:host( [ variant='holo' ] ) button{background-color:transparent;background-image:var( --_holo-fill );background-size:220% 220%;background-position:22% 28%;background-repeat:no-repeat;color:var( --os-ui-button-fg,var( --_holo-ink ) );border:var( --os-ui-button-border,1px solid transparent );box-shadow:var( --_holo-glow );font-weight:600;transition:background-position var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease,filter var( --_holo-t ) ease,transform 80ms ease}:host( [ variant='holo' ] ) button:hover:not(:disabled ){background-color:transparent;background-position:74% 66%;box-shadow:var( --_holo-glow-strong )}:host( [ variant='holo' ] ) button:active:not(:disabled ){background-position:88% 82%;filter:brightness( 0.94 )}:host( [ variant='holo' ] ) button::before{display:none}@media ( prefers-reduced-motion:reduce ){:host( [ variant='holo' ] ) button:hover:not(:disabled ),:host( [ variant='holo' ] ) button:active:not(:disabled ){background-position:22% 28%}}:host( [ variant='secondary' ] ) button{background-color:var( --os-ui-button-bg,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) );color:var( --os-ui-button-fg,var( --os-ui-fg,#1d2327 ) );border:var( --os-ui-button-border,1px solid transparent )}:host( [ variant='secondary' ] ) button:hover:not(:disabled ){background-color:var( --os-ui-button-bg-hover,var( --os-ui-hover,rgba( 0,0,0,0.1 ) ) )}:host( [ variant='danger' ] ) button{background-color:var( --os-ui-button-bg,transparent );color:var( --os-ui-button-fg,var( --os-ui-danger,#d63638 ) );border:var( --os-ui-button-border,1px solid currentColor )}:host( [ variant='danger' ] ) button:hover:not(:disabled ){background-color:var( --os-ui-danger,#d63638 );color:var( --os-ui-fg-on-accent,#fff )}:host( [ variant='danger' ] ) button::after{display:none}:host( [ variant='link' ] ) button{background-color:transparent;background-image:none;color:var( --os-ui-button-fg,var( --wp-admin-theme-color,#2271b1 ) );border:0;padding:0;text-decoration:underline}:host( [ variant='link' ] ) button::before,:host( [ variant='link' ] ) button::after,:host( [ variant='link' ] ) .os-holo-glint,:host( [ variant='link' ] ) .os-holo-ring{display:none}:host( [ variant='link' ] ) button:active:not(:disabled ){transform:none}:host( [ busy ] ) button{pointer-events:none;opacity:0.75}:host( [ variant='holo' ][ busy ] ) button{animation:os-holo-drift 12s ease-in-out infinite}@media ( prefers-reduced-motion:reduce ){:host( [ variant='holo' ][ busy ] ) button{animation:none}}.os-button__spinner{box-sizing:border-box;display:inline-block;width:12px;height:12px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:os-button-spin 0.6s linear infinite;flex-shrink:0}@keyframes os-button-spin{to{transform:rotate( 360deg )}}`,je=class je extends X{static get observedAttributes(){return[...super.observedAttributes,"aria-label"]}render(){const e=this.disabled!==null,t=this.busy!==null,s=this.type||"button",n=this.getAttribute("aria-label")||"";return C` | |
| 635 | + <button | |
| 636 | + part="button" | |
| 637 | + class="os-holo-edge os-holo-sheen" | |
| 638 | + type=${s} | |
| 639 | + ?disabled=${e||t} | |
| 640 | + aria-busy=${t?"true":"false"} | |
| 641 | + aria-label=${n} | |
| 642 | + > | |
| 643 | + ${t?C`<span class="os-button__spinner" aria-hidden="true"></span>`:""} | |
| 644 | + <slot></slot> | |
| 645 | + <!-- | |
| 646 | + The two motion layers. Elements rather than | |
| 647 | + pseudo-elements because the sheen and the hairline | |
| 648 | + have already taken this button's ::before and | |
| 649 | + ::after — see the pseudo-element budget note in | |
| 650 | + src/ui/holo.ts. Both are inert and aria-hidden. | |
| 651 | + --> | |
| 652 | + <span class="os-holo-glint" aria-hidden="true"></span> | |
| 653 | + <span class="os-holo-ring" aria-hidden="true"></span> | |
| 654 | + </button> | |
| 655 | + `}};je.props=["variant","disabled","type","busy","fill-cell"],je.styles=[ba],je.help=void 0;let Vt=je;Q("os-button",Vt);const _a=F` ${_e} ${Ms}:host{--_field-size:var( --os-ui-field-font-size,13px );--_field-radius:var( --os-ui-field-radius,6px );display:flex;flex-direction:column;gap:4px;font-size:var( --_field-size );color:var( --os-ui-fg,#1d2327 );min-width:0}:host( [ hidden ] ){display:none}.os-text-field__label{font-size:12px;color:var( --os-ui-fg-muted,#646970 )}.os-text-field__label--hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;white-space:nowrap;clip-path:inset( 50% )}.os-text-field__row{position:relative;display:flex;align-items:center;width:100%}input{appearance:none;-webkit-appearance:none;display:block;width:100%;min-width:0;box-sizing:border-box;padding:7px 10px;background:var( --os-window-bg,#fff );border:1px solid var( --os-ui-border,#dcdcde );border-radius:var( --_field-radius );font:inherit;font-size:var( --_field-size );color:var( --os-ui-fg,#1d2327 )}input:is( [ type='date' ],[ type='datetime-local' ],[ type='month' ],[ type='week' ] )::-webkit-calendar-picker-indicator{--_calendar-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='1.5'%3E%3Cpath d='M4.75 7.25L4.75 18C4.75 18.6904 5.30964 19.25 6 19.25H18C18.6904 19.25 19.25 18.6904 19.25 18V7.25V6C19.25 5.30964 18.6904 4.75 18 4.75H6C5.30964 4.75 4.75 5.30964 4.75 6V7.25ZM19.25 7.25H4.75M7.25 10.75H9.25M11 10.75H13M14.75 10.75H16.75M7.25 14.5H9.25M11 14.5H13M14.75 14.5H16.75' vector-effect='non-scaling-stroke'/%3E%3Cpath d='M18 4.75H6C5.30964 4.75 4.75 5.30964 4.75 6V7.25H19.25V6C19.25 5.30964 18.6904 4.75 18 4.75Z' fill='currentColor' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");background:var( --os-ui-fg-muted,#646970 );-webkit-mask:var( --_calendar-icon ) center / contain no-repeat;mask:var( --_calendar-icon ) center / contain no-repeat;width:16px;height:16px;cursor:pointer}@media ( forced-colors:active ){input:is( [ type='date' ],[ type='datetime-local' ],[ type='month' ],[ type='week' ] )::-webkit-calendar-picker-indicator{background:ButtonText;forced-color-adjust:none}}.os-text-field__suffix{position:absolute;inset-inline-end:10px;top:50%;transform:translateY( -50% );pointer-events:none;font-size:12px;color:var( --os-ui-fg-muted,#646970 )}.os-text-field__row--has-reveal input{padding-inline-end:36px}:host( [ clearable ] ) input::-webkit-search-cancel-button{-webkit-appearance:none;display:none}.os-text-field__row--has-clear input{padding-inline-end:36px}.os-text-field__row--has-reveal.os-text-field__row--has-clear input{padding-inline-end:68px}.os-text-field__clear{position:absolute;inset-inline-end:0;top:0;bottom:0;width:34px;display:flex;align-items:center;justify-content:center;padding:0;border:none;background:transparent;color:var( --os-ui-fg-muted,#646970 );cursor:pointer;border-radius:0 6px 6px 0}.os-text-field__row--has-reveal .os-text-field__clear{inset-inline-end:34px;border-radius:0}.os-text-field__clear:hover{color:var( --os-ui-accent,#2271b1 )}.os-text-field__clear:focus-visible{outline:none;color:var( --os-ui-accent,#2271b1 );box-shadow:inset 0 0 0 2px var( --os-ui-accent,#2271b1 )}.os-text-field__clear:disabled{opacity:0.45;cursor:default}.os-text-field__reveal{position:absolute;inset-inline-end:0;top:0;bottom:0;width:34px;display:flex;align-items:center;justify-content:center;padding:0;border:none;background:transparent;color:var( --os-ui-fg-muted,#646970 );cursor:pointer;border-radius:0 6px 6px 0;transition:color 0.12s ease}.os-text-field__reveal:hover{color:var( --os-ui-accent,#2271b1 )}.os-text-field__reveal:focus-visible{outline:none;color:var( --os-ui-accent,#2271b1 );box-shadow:inset 0 0 0 2px var( --os-ui-accent,#2271b1 );border-radius:0 6px 6px 0}.os-text-field__reveal:disabled{opacity:0.45;cursor:not-allowed}.os-text-field__input--masked{-webkit-text-security:disc;text-security:disc}@supports not ( ( -webkit-text-security:disc ) or ( text-security:disc ) ){.os-text-field__input--masked{font-family:text-security-disc,"password",monospace;letter-spacing:0.2em}}input:disabled{opacity:0.55;cursor:not-allowed;background:var( --os-ui-hover,rgba( 0,0,0,0.03 ) )}input[ aria-invalid='true' ],input[ aria-invalid='true' ]:hover:not(:disabled ){border-color:var( --os-ui-danger,#d63638 )}input[ aria-invalid='true' ]:focus,input[ aria-invalid='true' ]:focus-visible{border-color:var( --os-ui-danger,#d63638 );box-shadow:0 0 0 1px var( --os-ui-danger,#d63638 ),0 0 0 4px rgba( 214,54,56,0.18 )}input[ type='number' ]::-webkit-inner-spin-button,input[ type='number' ]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[ type='number' ]{-moz-appearance:textfield}`,Ke=class Ke extends X{constructor(){super(...arguments),this._revealed=!1}connectedCallback(){super.connectedCallback(),gt(this)}render(){const e=this.label||"",t=this.hideLabel!==null,s=this.value??"",n=this.placeholder||"",a=this.disabled!==null,i=this.readonly!==null,r=this.autocomplete,c=this.type||"text",l=c==="password";let d=r||"off";l&&(!r||d==="off")&&(d="new-password");const u=this.maxlength,h=this.minlength,p=this.pattern||"",m=this.name||"",_=this.suffix||"",g=this.invalid!==null,b=this.reveal!==null,v=this.clearable!==null,S=c==="password",T=S&&!(b&&this._revealed);let z;S||b&&this._revealed?z="text":z=c;const P=["os-text-field__row",b?"os-text-field__row--has-reveal":"",v?"os-text-field__row--has-clear":""].filter(Boolean).join(" "),y=T?"os-text-field__input os-text-field__input--masked":"os-text-field__input",M=`${this.id||"os-unnamed"}__input`;return C` | |
| 656 | + ${e?C`<label | |
| 657 | + class=${t?"os-text-field__label os-text-field__label--hidden":"os-text-field__label"} | |
| 658 | + for=${M} | |
| 659 | + >${e}</label>`:C``} | |
| 660 | + <span class=${P}> | |
| 661 | + <input | |
| 662 | + id=${M} | |
| 663 | + class=${y} | |
| 664 | + type=${z} | |
| 665 | + .value=${s} | |
| 666 | + placeholder=${n} | |
| 667 | + ?disabled=${a} | |
| 668 | + ?readonly=${i} | |
| 669 | + autocomplete=${d} | |
| 670 | + maxlength=${u??""} | |
| 671 | + minlength=${h??""} | |
| 672 | + pattern=${p} | |
| 673 | + name=${m} | |
| 674 | + aria-invalid=${g?"true":"false"} | |
| 675 | + aria-label=${e||""} | |
| 676 | + @input=${R=>this._onInput(R)} | |
| 677 | + @change=${R=>this._onChange(R)} | |
| 678 | + @keydown=${R=>this._onKeyDown(R)} | |
| 679 | + /> | |
| 680 | + ${_?C`<span class="os-text-field__suffix">${_}</span>`:C``} | |
| 681 | + ${v&&s!==""?this._renderClearButton(a):C``} | |
| 682 | + ${b?this._renderRevealButton(a):C``} | |
| 683 | + </span> | |
| 684 | + `}_renderClearButton(e){return C` | |
| 685 | + <button | |
| 686 | + type="button" | |
| 687 | + class="os-text-field__clear" | |
| 688 | + aria-label="Clear" | |
| 689 | + ?disabled=${e} | |
| 690 | + tabindex="0" | |
| 691 | + @click=${()=>this._onClear()} | |
| 692 | + > | |
| 693 | + ${va()} | |
| 694 | + </button> | |
| 695 | + `}_onClear(){this.value="",this.emit("os-input-change",{value:""}),this.emit("os-input-commit",{value:""}),this.shadowRoot?.querySelector("input")?.focus()}_renderRevealButton(e){const t=this._revealed?"Hide":"Show";return C` | |
| 696 | + <button | |
| 697 | + type="button" | |
| 698 | + class="os-text-field__reveal" | |
| 699 | + aria-label=${t} | |
| 700 | + aria-pressed=${this._revealed?"true":"false"} | |
| 701 | + ?disabled=${e} | |
| 702 | + tabindex="0" | |
| 703 | + @click=${()=>this._onToggleReveal()} | |
| 704 | + > | |
| 705 | + ${this._revealed?xa():ya()} | |
| 706 | + </button> | |
| 707 | + `}_onToggleReveal(){this._revealed=!this._revealed,this.requestUpdate()}_onInput(e){const t=e.target;this.value=t.value,this.emit("os-input-change",{value:t.value})}_onChange(e){const t=e.target;this.emit("os-input-commit",{value:t.value})}_onKeyDown(e){if(e.key==="Enter"&&!e.shiftKey&&!e.altKey&&!e.metaKey){const t=e.target;this.emit("os-submit",{value:t.value})}}};Ke.props=["label","hideLabel","value","placeholder","disabled","readonly","autocomplete","type","maxlength","minlength","pattern","name","suffix","invalid","reveal","clearable"],Ke.styles=[_a],Ke.help=void 0;let Bt=Ke;Q("os-text-field",Bt);function va(){return C` | |
| 708 | + <svg | |
| 709 | + viewBox="0 0 16 16" | |
| 710 | + width="14" | |
| 711 | + height="14" | |
| 712 | + fill="none" | |
| 713 | + stroke="currentColor" | |
| 714 | + stroke-width="1.5" | |
| 715 | + stroke-linecap="round" | |
| 716 | + aria-hidden="true" | |
| 717 | + focusable="false" | |
| 718 | + > | |
| 719 | + <path d="M4 4l8 8M12 4l-8 8" /> | |
| 720 | + </svg> | |
| 721 | + `}function ya(){return C` | |
| 722 | + <svg | |
| 723 | + viewBox="0 0 16 16" | |
| 724 | + width="14" | |
| 725 | + height="14" | |
| 726 | + fill="none" | |
| 727 | + stroke="currentColor" | |
| 728 | + stroke-width="1.5" | |
| 729 | + stroke-linecap="round" | |
| 730 | + stroke-linejoin="round" | |
| 731 | + aria-hidden="true" | |
| 732 | + focusable="false" | |
| 733 | + > | |
| 734 | + <path d="M1 8C1 8 3.5 3 8 3s7 5 7 5-2.5 5-7 5S1 8 1 8z" /> | |
| 735 | + <circle cx="8" cy="8" r="2" /> | |
| 736 | + </svg> | |
| 737 | + `}function xa(){return C` | |
| 738 | + <svg | |
| 739 | + viewBox="0 0 16 16" | |
| 740 | + width="14" | |
| 741 | + height="14" | |
| 742 | + fill="none" | |
| 743 | + stroke="currentColor" | |
| 744 | + stroke-width="1.5" | |
| 745 | + stroke-linecap="round" | |
| 746 | + stroke-linejoin="round" | |
| 747 | + aria-hidden="true" | |
| 748 | + focusable="false" | |
| 749 | + > | |
| 750 | + <path d="M1 8C1 8 3.5 3 8 3s7 5 7 5-2.5 5-7 5S1 8 1 8z" /> | |
| 751 | + <circle cx="8" cy="8" r="2" /> | |
| 752 | + <line x1="2" y1="2" x2="14" y2="14" /> | |
| 753 | + </svg> | |
| 754 | + `}function ka(o,e,t){const s=e.trim().toLocaleLowerCase();return o.filter(n=>(!t||n.count===0)&&pe(n.name).toLocaleLowerCase().includes(s)).sort((n,a)=>pe(n.name).localeCompare(pe(a.name)))}function wa(o,e,t){const s=document.createElement("os-button");s.setAttribute("variant","secondary"),s.textContent=f("Browse topics"),s.className="os-term-directory__toggle",o.toolbar.insertBefore(s,o.searchWrap);const n=document.createElement("section");n.className="os-term-directory",n.setAttribute("aria-label",f("Topic directory")),n.hidden=!0,o.stage.appendChild(n);let a="",i=!1,r=50;const c=()=>s.shadowRoot?.querySelector("button")?.focus(),l=()=>{n.hidden=!0,s.setAttribute("aria-expanded","false"),s.shadowRoot?.querySelector("button")?.setAttribute("aria-expanded","false"),c()},d=()=>{const p=e(),m=ka(p,a,i);ke(C`<header><h3>${f("Your topics")}</h3><os-button variant="ghost" @click=${l}>${f("Close")}</os-button></header> | |
| 755 | + <os-text-field label=${f("Find a topic")} value=${a} placeholder=${f("Find a topic…")} | |
| 756 | + @os-input-change=${_=>{a=_.detail.value,r=50,d()}}></os-text-field> | |
| 757 | + <os-select label=${f("Show topics")} value=${i?"unused":"all"} | |
| 758 | + @os-pick=${_=>{i=_.detail.value==="unused",r=50,d()}}> | |
| 759 | + <os-option value="all">${f("All topics")}</os-option><os-option value="unused">${f("No posts yet")}</os-option> | |
| 760 | + </os-select> | |
| 761 | + <p class="os-term-directory__count" role="status">${W(de("%d topic","%d topics",m.length),m.length)}</p> | |
| 762 | + <div class="os-term-directory__items">${m.slice(0,r).map(_=>C`<os-button variant="ghost" data-topic-id=${_.id} @click=${()=>{l(),t(_.id)}}><span>${pe(_.name)}</span><small>${W(de("%d post","%d posts",_.count),_.count)}</small></os-button>`)} | |
| 763 | + ${m.length===0?C`<p>${f("No matching topics. Try another search or filter.")}</p>`:""} | |
| 764 | + ${m.length>r?C`<os-button variant="secondary" @click=${()=>{r+=50,d()}}>${f("Show more")}</os-button>`:""} | |
| 765 | + </div>`,n)},u=()=>{if(!n.hidden){l();return}d(),n.hidden=!1,s.setAttribute("aria-expanded","true"),s.shadowRoot?.querySelector("button")?.setAttribute("aria-expanded","true"),queueMicrotask(()=>n.querySelector("os-text-field")?.shadowRoot?.querySelector("input")?.focus())},h=p=>{p.key==="Escape"&&(p.stopPropagation(),l())};return s.addEventListener("click",u),n.addEventListener("keydown",h),()=>{s.removeEventListener("click",u),n.removeEventListener("keydown",h),s.remove(),n.remove()}}function at(o){const e=ye(o,"--os-ui-surface","#ffffff",16777215);return{surface:e,raised:ye(o,"--os-ui-surface-elevated","#ffffff",e),fg:ye(o,"--os-ui-fg","#1d2327",e),muted:ye(o,"--os-ui-fg-muted","#50575e",e),faint:ye(o,"--os-ui-fg-faint","#b0b3b8",e),border:ye(o,"--os-ui-border","#dcdcde",e),accent:ye(o,"--os-ui-accent","#2271b1",e)}}function ye(o,e,t,s=16777215){const n=document.createElement("span");n.hidden=!0,n.style.color=`var(${e}, ${t})`,o.append(n);const a=getComputedStyle(n).color;n.remove();const i=a.match(/[\d.]+/g)?.map(Number);if(!i||i.length<3)return parseInt(t.slice(1),16);const r=i[3]??1,c=a.startsWith("color(srgb");return[16,8,0].reduce((l,d,u)=>{const h=i[u]*(c?255:1),p=Math.floor(s/2**d)%256;return l+Math.round(h*r+p*(1-r))*2**d},0)}function Ca(o,e,t){let s=JSON.stringify([at(o),t?.()]);const n=()=>{const i=JSON.stringify([at(o),t?.()]);i!==s&&(s=i,e())},a=new MutationObserver(n);for(let i=o;i;i=i.parentElement)a.observe(i,{attributes:!0,attributeFilter:["style","class"]});return document.addEventListener("os-desktop-theme-changed",n),()=>{a.disconnect(),document.removeEventListener("os-desktop-theme-changed",n)}}function uo(o,e){const t=a=>[16,8,0].reduce((i,r,c)=>{const l=Math.floor(a/2**r)%256/255;return i+(l<=.04045?l/12.92:((l+.055)/1.055)**2.4)*[.2126,.7152,.0722][c]},0),s=t(o),n=a=>{const i=t(a);return(Math.max(i,s)+.05)/(Math.min(i,s)+.05)};return n(e.fg)>=n(e.surface)?e.fg:e.surface}const $a=10,Sa=22,Ea=6e4;function Aa(o){const{pixi:e,postLayer:t,postChipLayer:s,postEdgeGfx:n,interaction:a,env:i,palette:r}=o,c=new Map,l=new Map,d=new Map;let u=0;const h=new e.Container;h.eventMode="passive",h.visible=!1,t.addChild(h);const p=new e.Graphics,m=new e.Graphics,_=new e.Text({text:"1 / 1",style:{fill:r.muted,fontSize:o.pagerLabelSize,fontFamily:Ee,fontWeight:"600"},...o.pagerTextRes?{resolution:o.pagerTextRes}:{}});_.anchor.set(.5);for(const y of[p,m])y.eventMode="static",y.cursor="pointer",y.hitArea=new e.Circle(0,0,16),y.on("pointerdown",E=>ve(a,E));h.addChild(p),h.addChild(_),h.addChild(m),p.on("pointertap",y=>{ne(a)||(ve(a,y),a.lastFocusChange=performance.now(),P.focusPage>1&&(P.focusPage--,P.load()))}),m.on("pointertap",y=>{ne(a)||(ve(a,y),a.lastFocusChange=performance.now(),P.focusPage<P.focusTotalPages&&(P.focusPage++,P.load()))});function g(y,E,M){y.clear(),y.circle(0,0,14),y.fill({color:M?r.surface:r.raised,alpha:M?.7:1}),y.stroke({color:r.border,width:1,alpha:1});const R=y.children?.[0]??null;if(R)R.text=E,R.style.fill=M?r.faint:r.muted;else{const H=new e.Text({text:E,style:{fill:M?r.faint:r.muted,fontSize:o.pagerGlyphSize,fontFamily:Ee,fontWeight:"600"},...o.pagerTextRes?{resolution:o.pagerTextRes}:{}});H.anchor.set(.5),y.addChild(H)}}function b(){const y=P.focusId===null?null:o.getCenter(P.focusId);if(!y||P.focusTotalPages<=1){h.visible=!1;return}h.visible=!0;const E=P.focusPage<=1,M=P.focusPage>=P.focusTotalPages;g(p,"◀",E),g(m,"▶",M),p.cursor=E?"default":"pointer",m.cursor=M?"default":"pointer",_.text=`${P.focusPage} / ${P.focusTotalPages}`,p.x=-38,m.x=38,p.y=0,m.y=0,_.x=0,_.y=0,h.x=y.x,h.y=y.y+nt+60}function v(y,E){y.titleText.style.fill=r.fg;const M=Te(E.title,Sa);y.titleText.text!==M&&(y.titleText.text=M);const R=9,H=3,U=4,j=6,G=y.titleText.width,q=y.titleText.height,D=R+U*2+j+G+R,O=Math.max(q,U*2)+H*2,k=-D/2,x=-O/2;y.bg.clear(),y.bg.roundRect(k,x,D,O,O/2),y.cachedHover?(y.bg.fill({color:r.raised,alpha:1}),y.bg.stroke({color:E.tone,width:1.5,alpha:1})):(y.bg.fill({color:r.surface,alpha:1}),y.bg.stroke({color:r.border,width:1,alpha:1})),y.dot.clear(),y.dot.circle(k+R+U,0,U),y.dot.fill({color:E.tone,alpha:.85}),y.dot.stroke({color:r.border,width:1}),y.titleText.x=k+R+U*2+j,y.titleText.y=-q/2}function S(y){if(l.has(y.id))return;const E=new e.Container;E.eventMode="static",E.cursor="pointer",E.alpha=0;const M=new e.Graphics,R=new e.Graphics,H=new e.Text({text:y.title,style:{fill:r.fg,fontSize:o.chipFontSize,fontFamily:Ee,fontWeight:"500"},resolution:o.chipTextRes});E.addChild(M),E.addChild(R),E.addChild(H);const U={container:E,bg:M,dot:R,titleText:H,cachedHover:!1};l.set(y.id,U),s.addChild(E),E.on("pointerdown",j=>ve(a,j)),E.on("pointertap",()=>{ne(a)||(i.leaveFullscreen(),i.openUrl(y.editUrl,y.title,"dashicons-admin-post"),o.onOpenPost())}),E.on("pointerover",()=>{U.cachedHover=!0,v(U,y)}),E.on("pointerout",()=>{U.cachedHover=!1,v(U,y)}),v(U,y)}function T(y){P.clear();const E=P.focusId===null?null:o.getCenter(P.focusId);if(!E)return;const M=y.length,R=nt+Math.max(0,M-8)*6;y.forEach((H,U)=>{const j=2*Math.PI/Math.max(1,M)*U-Math.PI/2,G=new e.Graphics;t.addChild(G);const q={id:H.id,title:H.title,editUrl:H.editUrl,angle:j,r:R,x:E.x,y:E.y,tx:E.x+Math.cos(j)*R,ty:E.y+Math.sin(j)*R,gfx:G,tone:E.tone};c.set(H.id,q),S(q)}),b()}function z(y,E){P.focusTotalPages=y.totalPages,Number.isFinite(y.realTotal)&&y.realTotal>=0&&o.onCountReconciled(E,y.realTotal),T(y.items)}const P={repaintTheme(){const y=P.focusId===null?null:o.getCenter(P.focusId)?.tone;_.style.fill=r.muted,b();for(const E of c.values()){y!=null&&(E.tone=y);const M=l.get(E.id);M&&v(M,E)}},focusId:null,focusPage:1,focusTotalPages:1,async load(){if(P.focusId===null)return;const y=++u,E=P.focusId,M=`${E}:${P.focusPage}`,R=d.get(M);if(R&&performance.now()-R.fetchedAt<Ea){z(R,E);return}try{const H=await i.client.fetchTermPosts(o.param,E,P.focusPage,$a);if(y!==u||P.focusId!==E)return;const U=i.extra.editPostUrlBase??"",j=U.includes("?")?"&":"?",G={items:H.items.map(q=>({id:q.id,title:ha(q.title),editUrl:`${U}${j}post=${q.id}&action=edit`})),totalPages:H.totalPages,realTotal:H.total,fetchedAt:performance.now()};d.set(M,G),z(G,E)}catch(H){i.toast(f("Couldn’t load posts:"),H)}},clear(){for(const y of c.values())t.removeChild(y.gfx),y.gfx.destroy();c.clear();for(const y of l.values())s.removeChild(y.container),y.container.destroy({children:!0});l.clear(),n.clear(),h.visible=!1},invalidate(){u++},ease(){for(const y of c.values())y.x+=(y.tx-y.x)*.18,y.y+=(y.ty-y.y)*.18,y.gfx.x=y.x,y.gfx.y=y.y},drawEdges(){n.clear();const y=P.focusId===null?null:o.getCenter(P.focusId);if(y)for(const E of c.values())n.moveTo(y.x,y.y),n.lineTo(E.x,E.y),n.stroke({color:y.tone,width:1,alpha:.35})},syncChips(y){for(const E of c.values()){const M=l.get(E.id);M&&(M.container.x=E.x,M.container.y=E.y,M.container.scale.set(y),M.container.alpha<1&&(M.container.alpha=Math.min(1,M.container.alpha+.18)))}}};return P}const jt=nt+130;async function po(o,e,t){const s=await la(o,t.unavailable);if(!s)return null;const n=s,a=ga(o,t.modifier,t.chrome),{stage:i,sidebar:r}=a,{app:c,world:l}=await ca(n,i,`${B}__canvas`),d={};for(const D of t.layers){const O=new n.Container;d[D]=O,l.addChild(O)}const u=new n.Graphics;d.postEdge.addChild(u);const h=at(i),p=na();let m=null;const _=aa(l,i,{start:()=>{p.pinchUntil=1/0,p.panActive=!1,p.panStart=null,m?.cancelGesture()},end:()=>{p.pinchUntil=performance.now()+300}});let g=null,b=null,v=performance.now(),S=null,T=null,z=null,P=!1;const y=Aa({palette:h,pixi:n,postLayer:d.post,postChipLayer:d.postChip,postEdgeGfx:u,env:e,param:t.taxonomy,interaction:p,...t.fan,getCenter:D=>m?.center(D)??null,onCountReconciled:(D,O)=>m?.countReconciled(D,O),onOpenPost:()=>q.closeFocus()}),M=Ca(i,()=>{Object.assign(h,at(i)),m?.themeChanged(),y.repaintTheme(),c.render()}),R=()=>document.hidden||i.clientWidth===0||i.clientHeight===0,H=()=>{if(b=null,P||!m||R())return;const D=performance.now(),O=Math.min(50,D-v);v=D,_.ease(),m.frame(O),b=requestAnimationFrame(H)},U=()=>{P||b!==null||!m||R()||(v=performance.now(),b=requestAnimationFrame(H))},j=()=>U();c.stage.on("pointerdown",D=>{if(ne(p))return;const O=D;p.panActive=!0,p.panStart={x:O.global.x,y:O.global.y},p.panMovedDist=0}),c.stage.on("pointermove",D=>{if(ne(p))return;const O=D;if(!m?.pointerMove(O,_.stageToWorld(O.global))&&p.panActive&&p.panStart){const k=O.global.x-p.panStart.x,x=O.global.y-p.panStart.y;_.pan(k,x),p.panMovedDist+=Math.sqrt(k*k+x*x),p.panStart={x:O.global.x,y:O.global.y}}});const G=async D=>{ne(p)||await m?.pointerUp(D),p.panActive=!1,p.panStart=null};c.stage.on("pointerup",D=>void G(D)),c.stage.on("pointerupoutside",D=>void G(D)),c.canvas.addEventListener("click",D=>{ia(p,D,c.canvas)&&!m?.dragging()&&y.focusId!==null&&q.closeFocus()});const q={palette:h,pixi:n,app:c,world:l,layers:d,postEdgeGfx:u,chrome:a,stage:i,sidebar:r,interaction:p,camera:_,fan:y,terms:[],nudge:null,async focusOn(D){if(y.focusId===D){q.closeFocus();return}const O=y.focusId!==null;y.focusId=D,y.focusPage=1,p.lastFocusChange=performance.now();const k=m?.center(D)??null;k&&(O||(g={scale:_.targetScale,x:_.targetWorldX,y:_.targetWorldY}),_.frameOn(k.x,k.y),q.nudge={x:k.x,y:k.y,radius:jt},m?.focusOpened?.(k)),m?.focusChanged(),await y.load()},closeFocus(){y.focusId=null,p.lastFocusChange=performance.now(),y.invalidate(),q.nudge=null,m?.focusClosed?.(),g&&(_.targetScale=g.scale,_.targetWorldX=g.x,_.targetWorldY=g.y,g=null),y.clear(),m?.focusChanged()},recenter(){const D=y.focusId===null?null:m?.center(y.focusId)??null;D&&_.frameOn(D.x,D.y)||_.fitToView(m?.bounds()??null,{animate:!0})},syncEmptyHint(D){const O=i.querySelector(`.${B}__empty`);if(D&&!O){const k=document.createElement("div");k.className=`${B}__empty`,k.textContent=t.emptyHint,i.appendChild(k)}else!D&&O&&O.remove()},async refreshCounts(){if(q.terms.length!==0)try{const D=await e.client.fetchTermCounts(t.restTaxonomy,q.terms.map(k=>k.id));let O=!1;q.terms=q.terms.map(k=>{const x=D[String(k.id)];return typeof x=="number"&&x!==k.count?(O=!0,{...k,count:x}):k}),O&&!P&&m?.countsChanged()}catch{}},start(D){m=D,S=ra(n,c,i,{onFirstFit:()=>_.fitToView(D.bounds()),onSettle:()=>q.recenter(),onResize:U}),document.addEventListener("visibilitychange",j),T=wa(a,()=>q.terms,O=>void q.focusOn(O)),z=ma(a,{matches:D.search,select:O=>void q.focusOn(O.id)}),U(),q.refreshCounts()},teardown(){P=!0,b!==null&&(cancelAnimationFrame(b),b=null),document.removeEventListener("visibilitychange",j),S?.(),z?.(),T?.(),M(),_.dispose(),da(c,o,[B,t.modifier])}};try{q.terms=await e.client.fetchAllTerms(t.taxonomy)}catch(D){e.toast(t.loadFailed,D)}return q}const Kt=18;function Ta(o,e,t,s){const n=new Map,a=s.palette;function i(l,d){const u=s.isFocused(d.id),h=Te(d.name,Kt),p=String(d.count);l.nameText.text!==h&&(l.nameText.text=h),l.countText.text!==p&&(l.countText.text=p),l.cachedName=h,l.cachedCount=d.count,l.cachedFocused=u,l.cachedColor=d.color;const m=9,_=3,g=5,b=5,v=2,S=l.nameText.width,T=l.nameText.height,z=l.countText.width,P=l.countText.height,y=Math.max(18,z+b*2),E=P+v*2,M=m+S+g+y+m,R=Math.max(T,E)+_*2,H=-M/2;l.bg.clear(),l.bg.roundRect(H,0,M,R,R/2),u?(l.bg.fill(a.raised),l.bg.stroke({color:d.color,width:2})):l.cachedHover?(l.bg.fill({color:a.raised,alpha:1}),l.bg.stroke({color:d.color,width:1.5,alpha:1})):(l.bg.fill({color:a.surface,alpha:1}),l.bg.stroke({color:a.border,width:1,alpha:1})),l.nameText.x=H+m,l.nameText.y=(R-T)/2,l.nameText.style.fill=a.fg;const U=H+m+S+g,j=(R-E)/2;l.countBg.clear(),l.countBg.roundRect(U,j,y,E,E/2),l.countBg.fill(d.color),l.countText.style.fill=uo(d.color,a),l.countText.x=U+(y-z)/2,l.countText.y=j+(E-P)/2}function r(l){const d=n.get(l.id);if(d)return d;const u=new o.Container;u.eventMode="static",u.cursor="pointer";const h=new o.Graphics,p=new o.Text({text:Te(l.name,Kt),style:{fill:a.fg,fontSize:14,fontFamily:Ee,fontWeight:"600"},resolution:Ae}),m=new o.Graphics,_=new o.Text({text:String(l.count),style:{fill:a.fg,fontSize:12,fontFamily:Ee,fontWeight:"700"},resolution:Ae});u.addChild(h),u.addChild(p),u.addChild(m),u.addChild(_);const g={container:u,bg:h,nameText:p,countBg:m,countText:_,cachedName:"",cachedCount:-1,cachedFocused:!1,cachedHover:!1,cachedColor:-1};return n.set(l.id,g),e.addChild(u),u.on("pointerdown",b=>ve(t,b)),u.on("pointertap",()=>{ne(t)||s.onTap(l.id)}),u.on("pointerover",()=>{g.cachedHover=!0,i(g,l)}),u.on("pointerout",()=>{g.cachedHover=!1,i(g,l)}),g}const c={relayout(l){i(r(l),l)},destroy(l){const d=n.get(l);d&&(e.removeChild(d.container),d.container.destroy({children:!0}),n.delete(l))},sync(l,d,u){for(const p of[...n.keys()])l.has(p)||c.destroy(p);const h=u!==null;for(const p of l.values()){const m=r(p);m.container.x=p.x,m.container.y=p.y+p.radius+6,m.container.scale.set(d);const _=u===p.id,g=!h||_?1:.4;for(const b of[m.container,p.gfx])Math.abs(b.alpha-g)>.005?b.alpha+=(g-b.alpha)*.18:b.alpha=g;(m.cachedName!==Te(p.name,Kt)||m.cachedCount!==p.count||m.cachedFocused!==_||m.cachedColor!==p.color)&&i(m,p)}}};return c}function ho(o,e,t,s,n,a,i,r,c){const l=1-o;return{x:l*l*l*e+3*l*l*o*s+3*l*o*o*a+o*o*o*r,y:l*l*l*t+3*l*l*o*n+3*l*o*o*i+o*o*o*c}}function Gt(o,e,t,s,n,a,i={}){const r=s-e,c=e+r*.5,l=s-r*.5,d=i.alpha??.5,u=i.width??1.5;if(!i.dashed){o.moveTo(e,t),o.bezierCurveTo(c,t,l,n,s,n),o.stroke({color:a,width:u,alpha:d});return}const h=32,p=i.dashPhase??0,m=Math.max(1,i.dashStride??1);let _=e,g=t;for(let b=1;b<=h;b++){const v=ho(b/h,e,t,c,t,l,n,s,n);Math.floor((b-1+p)/m)%2===0&&(o.moveTo(_,g),o.lineTo(v.x,v.y),o.stroke({color:a,width:u,alpha:d})),_=v.x,g=v.y}}function le(o,e,t,s){const n=e.gfx;n.clear();const a=e.radius;t||(n.circle(0,5,a),n.fill({color:0,alpha:.18})),t&&(n.circle(0,0,a+10),n.fill({color:e.color,alpha:.22})),n.circle(0,0,a),n.fill(pa(e.color,-.18)),n.circle(0,-a*.06,a*.94),n.fill(e.color),n.circle(-a*.32,-a*.42,a*.3),n.fill({color:16777215,alpha:.32}),n.circle(0,0,a),n.stroke({color:s.border,width:t?3:2,alignment:0}),n.x=e.x,n.y=e.y,n.zIndex=10,n.hitArea=new o.Circle(0,0,a+4)}function fo(o,e,t,s){le(o,e,!1,s);const n=e.gfx,a=Math.sin(performance.now()/280)*.5+.5;n.circle(0,0,e.radius+6+a*5),n.stroke({color:t,width:3,alpha:.6+a*.35}),n.circle(0,0,e.radius*.42),n.fill({color:t,alpha:.85}),n.hitArea=new o.Circle(0,0,e.radius+12)}const Ma=5500,go=.05,Ia=130;function mo(o,e,t){const s=Array.from(o.values());for(const n of s){if(n.pinned){n.x+=(n.tx-n.x)*.12,n.y+=(n.ty-n.y)*.12,n.gfx.x=n.x,n.gfx.y=n.y;continue}let a=0,i=0;for(const c of s){if(n===c)continue;const l=n.x-c.x,d=n.y-c.y,u=l*l+d*d+1,h=Ma/u,p=Math.sqrt(u);a+=l/p*h,i+=d/p*h}const r=o.get(n.parent);if(r){const c=r.x-n.x,l=r.y-n.y,d=Math.sqrt(c*c+l*l)||1,u=d-Ia;a+=c/d*u*go,i+=l/d*u*go}else a+=-n.x*8e-4,i+=-n.y*8e-4;if(t.nudge&&n.id!==t.focusId){const c=n.x-t.nudge.x,l=n.y-t.nudge.y,d=Math.sqrt(c*c+l*l)||1,u=t.nudge.radius+n.radius;d<u&&(a+=c/d*18*(u-d),i+=l/d*18*(u-d))}n!==t.dragNode&&(n.x+=a*e*.001+(n.tx-n.x)*.02,n.y+=i*e*.001+(n.ty-n.y)*.02),n.gfx.x=n.x,n.gfx.y=n.y}}function La(o,e){const t={dragNode:null,focusId:null,nudge:null};for(let s=0;s<e;s++)mo(o,16,t);for(const s of o.values())s.tx=s.x,s.ty=s.y}const te=B;function rt(o,e,t){const s=document.createElement("div");s.className=`${te}__sidebar-header`;const n=document.createElement("span");n.className=`${te}__sidebar-dot`,n.style.background=e;const a=document.createElement("code");a.className=`${te}__sidebar-slug`,a.textContent=t,s.appendChild(n),s.appendChild(a),o.appendChild(s)}function bo(o,e){const t=document.createElement("label");t.className=`${te}__sidebar-label`,t.textContent=e,o.appendChild(t)}function Pe(o,e,t,s){bo(o,e);const n=document.createElement("input");return n.type="text",n.className=`${te}__editor-name`,n.value=t,n.placeholder=s,o.appendChild(n),n}function Xt(o,e){const t=Pe(o,f("Slug"),e,f("auto-from-name"));return t.spellcheck=!1,t.autocapitalize="off",t.addEventListener("input",()=>{const s=t.value,n=s.toLowerCase().replace(/[^a-z0-9-]+/g,"-");if(s!==n){const a=t.selectionStart??n.length;t.value=n,t.setSelectionRange(a,a)}}),t}function lt(o,e){bo(o,f("Description"));const t=document.createElement("textarea");return t.className=`${te}__editor-desc`,t.value=e,t.placeholder=f("Description (optional)"),t.rows=4,o.appendChild(t),t}function _o(o,e){const t=document.createElement("p");t.className=`${te}__sidebar-meta`,t.textContent=e,o.appendChild(t)}const fe=Wt;function ct(o,e){const t=document.createElement("div");t.className=`${te}__editor-actions`;for(const s of e)t.appendChild(s);o.appendChild(t)}function vo(o,e,t,s){const n=document.createElement("div");n.className=`${te}__sidebar-empty`;const a=document.createElement("span");a.className=`dashicons ${e}`,a.setAttribute("aria-hidden","true"),n.appendChild(a);const i=document.createElement("h3");i.className=`${te}__sidebar-empty-title`,i.textContent=t,n.appendChild(i);const r=document.createElement("p");r.className=`${te}__sidebar-empty-hint`,r.textContent=s,n.appendChild(r),o.appendChild(n)}function yo(o){const e=Wt("danger",f("Delete"));let t=null;return e.addEventListener("click",async()=>{if(!e.classList.contains("is-armed")){e.textContent=f("Click again to delete"),e.classList.add("is-armed"),t!==null&&window.clearTimeout(t),t=window.setTimeout(()=>{e.textContent=f("Delete"),e.classList.remove("is-armed"),t=null},2500);return}t!==null&&(window.clearTimeout(t),t=null),await o()}),e}function xo(o,e,t){o.addEventListener("keydown",s=>{s.key==="Enter"?(s.preventDefault(),e()):s.key==="Escape"&&t()})}function Pa(o,e){const{sidebar:t,client:s}=o,n=e.parent!==0?o.node(e.parent):void 0,a=n?n.color:o.clusterColor(o.terms().length);rt(t,co(a),n?W(f("New child of %s"),n.name):f("New root category"));const i=Pe(t,f("Name"),"",f("e.g. Recipes"));requestAnimationFrame(()=>i.focus());const r=Xt(t,""),c=lt(t,""),l=fe("primary",f("Create")),d=fe("danger",f("Cancel")),u=()=>{o.setDraft(null),ie(o)},h=async()=>{const p=i.value.trim();if(!p){i.focus();return}l.disabled=!0;try{const m=await s.createCategory(p,e.parent,{slug:r.value.trim()||void 0,description:c.value||void 0}),_={id:m.id,name:m.name,slug:m.slug||"",parent:m.parent,count:0,description:m.description||"",isDefault:!1};o.terms().some(g=>g.id===_.id)||o.setTerms(o.terms().concat(_)),o.setDraft(null),o.buildTree(),o.setFocus(m.id),ie(o),await o.loadPosts()}catch(m){l.disabled=!1,o.toast(f("Couldn’t create:"),m)}};l.addEventListener("click",()=>void h()),d.addEventListener("click",u),xo(i,()=>void h(),u),ct(t,[l,d])}function za(o,e){const{sidebar:t,client:s}=o,n=e.id;rt(t,co(e.color),`#${n}`);const a=o.terms().find(p=>p.id===n),i=Pe(t,f("Name"),e.name,f("Name")),r=Xt(t,a?.slug||""),c=lt(t,e.description||"");_o(t,W(de("%d post in this category.","%d posts in this category.",e.count),e.count));const l=fe("secondary",f("+ Child"));l.addEventListener("click",()=>{o.setDraft({parent:n}),ie(o)});const d=e.parent&&e.parent!==0?fe("secondary",f("Make root")):null;d&&(d.title=f("Promote this category to a top-level root (no parent)."),d.addEventListener("click",async()=>{try{await s.updateTerm("categories",n,{parent:0});const p=o.node(n);p&&(p.parent=0),o.setTerms(o.terms().map(m=>m.id===n?{...m,parent:0}:m)),o.buildTree(),ie(o)}catch(p){o.toast(f("Couldn’t reparent:"),p)}}));const u=fe("primary",f("Save"));u.addEventListener("click",async()=>{const p=i.value.trim();if(!p)return;const m=c.value,_=r.value.trim(),g=a?.slug??"";if(p===e.name&&m===(e.description||"")&&_===g)return;const b={name:p,description:m};_!==g&&(b.slug=_);try{const v=await s.updateTerm("categories",n,b),S=o.node(n);S&&(S.name=v.name,S.description=v.description),o.setTerms(o.terms().map(T=>T.id===n?{...T,name:v.name,description:v.description,slug:v.slug||T.slug}:T)),o.relayoutNode(n),ie(o)}catch(v){o.toast(f("Couldn’t save:"),v)}});const h=yo(async()=>{try{await s.deleteTerm("categories",n),o.setTerms(o.terms().filter(p=>p.id!==n)),o.setFocus(null),o.clearPosts(),o.buildTree(),ie(o)}catch(p){o.toast(f("Couldn’t delete:"),p)}});ct(t,d?[l,d,u,h]:[l,u,h])}function ie(o){o.sidebar.replaceChildren();const e=o.draft();if(e!==null){Pa(o,e);return}const t=o.focusId();if(t===null){vo(o.sidebar,"dashicons-admin-tools",f("No category selected"),f("Click a node on the mindmap to edit its name, description, and posts."));return}const s=o.node(t);if(!s){o.setFocus(null),ie(o);return}za(o,s)}const ko=22,Ra=48;function wo(o,e){const t=Math.max(1,...e.map(s=>s.count));return ko+(Ra-ko)*Math.sqrt(o/t)}function Yt(o){return o.isDefault||o.id===1||o.slug==="uncategorized"||o.name.toLowerCase()==="uncategorized"}async function Na(o,e){const t=await po(o,e,{taxonomy:"categories",restTaxonomy:"category",modifier:"os-mindmap",unavailable:f("Mindmap unavailable."),loadFailed:f("Couldn’t load categories:"),emptyHint:f('No custom categories yet. Click "Add root category" to start branching.'),chrome:{buttons:[{variant:"primary",icon:"dashicons-plus",label:f("Add root category")},{icon:"dashicons-image-rotate",label:f("Recenter")}],searchPlaceholder:f("Search categories…"),searchAria:f("Search categories in the mindmap"),hint:f("Click a node to focus + edit · drag onto another to reparent · scroll or pinch to zoom")},layers:["edge","postEdge","post","node","chip","postChip"],fan:{chipFontSize:14,chipTextRes:Ae,pagerLabelSize:14,pagerGlyphSize:16,pagerTextRes:Ae}});if(!t)return()=>{};const s=t,{pixi:n,layers:a,fan:i,camera:r,interaction:c,world:l,palette:d}=s,{client:u}=e,h=new n.Graphics;a.edge.addChild(h);const p=new Map,m=Ta(n,a.chip,c,{palette:d,isFocused:k=>i.focusId===k,onTap:k=>void s.focusOn(k)});let _=null,g=null,b=null,v={x:0,y:0};const S=new Map;let T=null,z=it(o);const P=k=>lo((z+k*47)%360,55,52);function y(k,x){let A=p.get(k.id);if(A)A.parent=k.parent,A.name=k.name,A.description=k.description,A.count=k.count,A.depth=x.depth,A.color=x.color,A.radius=x.radius,A.tx=x.tx,A.ty=x.ty,A.pinned=x.pinned;else{const w=new n.Graphics;w.eventMode="static",w.cursor="pointer",A={id:k.id,parent:k.parent,name:k.name,description:k.description,count:k.count,x:x.tx,y:x.ty,tx:x.tx,ty:x.ty,radius:x.radius,depth:x.depth,color:x.color,gfx:w,pinned:x.pinned},a.node.addChild(w);const $=A;w.on("pointerdown",I=>R(I,$)),p.set(k.id,A)}return le(n,A,!1,d),A}function E(){const k=s.terms,x=new Map;for(const V of k){const L=x.get(V.parent)??[];L.push(V),x.set(V.parent,L)}const A=x.get(0)??[],w=A.filter(V=>!Yt(V)),$=A.find(Yt),I=(V,L,Y,ae,me)=>{const J=w.length>1?110+w.length*28:0,be=$?Math.max(J,140):J,xe=L===0?be:be+160+(L-1)*150,Qa=L===0?P(Y):p.get(V.parent)?.color??P(Y);y(V,{tx:xe*Math.cos(ae),ty:xe*Math.sin(ae),radius:wo(V.count,k),depth:L,color:Qa,pinned:L===0});const ss=x.get(V.id)??[];if(ss.length>0){const Lo=me/ss.length;ss.forEach((er,tr)=>I(er,L+1,Y,ae-me/2+Lo*(tr+.5),Lo*.85))}},N=new Set(k.map(V=>V.id));for(const[V,L]of p)N.has(V)||(a.node.removeChild(L.gfx),L.gfx.destroy(),p.delete(V),m.destroy(V));const K=Math.max(1,w.length);w.forEach((V,L)=>I(V,0,L,2*Math.PI/K*L,2*Math.PI/K)),$&&y($,{tx:0,ty:0,radius:wo($.count,k),depth:0,color:9211796,pinned:!0}),s.syncEmptyHint(k.length<=1)}function M(){h.clear();for(const k of p.values()){const x=k.parent?p.get(k.parent):void 0;if(!x)continue;const A=_!==null&&k===_,w=i.focusId!==null&&(k.id===i.focusId||k.parent===i.focusId),$=i.focusId!==null&&!w?.35:1;Gt(h,x.x,x.y,k.x,k.y,x.color,A?{dashed:!0,alpha:.28*$}:{alpha:.5*$})}if(_&&g){const{x:k,y:x}=_,{x:A,y:w,color:$}=g;Gt(h,k,x,A,w,$,{alpha:.22,width:9}),Gt(h,k,x,A,w,$,{alpha:.95,width:2.5,dashed:!0,dashStride:2,dashPhase:Math.floor(performance.now()/70)});const I=performance.now()%1300/1300,N=A-k,K=ho(I,k,x,k+N*.5,x,A-N*.5,w,A,w);h.circle(K.x,K.y,5),h.fill({color:16777215,alpha:.95}),h.stroke({color:$,width:2,alpha:1})}i.drawEdges()}function R(k,x){if(ne(c))return;ve(c,k),_=x,x.pinned=!0,x.tx=x.x,x.ty=x.y,b={x:k.global.x,y:k.global.y};const A=r.stageToWorld(k.global);v={x:x.x-A.x,y:x.y-A.y}}function H(k,x){let A=p.get(x),w=32;for(;A&&w-- >0;){if(A.id===k)return!0;if(!A.parent)return!1;A=p.get(A.parent)}return!1}function U(k){if(!_)return;const x=k.x+v.x,A=k.y+v.y;_.x=x,_.y=A,_.tx=x,_.ty=A,_.gfx.x=x,_.gfx.y=A;let w=null;for(const $ of p.values()){if($===_)continue;const I=$.x-k.x,N=$.y-k.y;if(I*I+N*N<$.radius*$.radius){w=$;break}}w!==g&&(g&&le(n,g,i.focusId===g.id,d),g=w,w&&fo(n,w,_.color,d))}async function j(k){if(!_)return;const x=_,A=g,w=ro(b,k);if(_=null,g=null,b=null,x.pinned=x.depth===0,!A&&w<2){s.focusOn(x.id);return}if(A&&A.id!==x.parent&&!H(x.id,A.id))try{await u.updateTerm("categories",x.id,{parent:A.id}),x.parent=A.id,s.terms=s.terms.map($=>$.id===x.id?{...$,parent:A.id}:$),E()}catch($){e.toast(f("Reparent failed:"),$)}else le(n,x,i.focusId===x.id,d),A&&le(n,A,i.focusId===A.id,d)}const G={sidebar:s.sidebar,client:u,toast:e.toast,terms:()=>s.terms,setTerms:k=>{s.terms=k},node:k=>p.get(k),focusId:()=>i.focusId,setFocus:k=>{i.focusId=k},draft:()=>T,setDraft:k=>{T=k&&k.parent!==0&&!p.get(k.parent)?T:k},clusterColor:P,buildTree:E,relayoutNode:k=>{const x=p.get(k);x&&m.relayout(x)},clearPosts:()=>i.clear(),loadPosts:()=>i.load()};function q(){if(p.size===0)return null;const k=30,x={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const A of p.values())x.minX=Math.min(x.minX,A.tx-A.radius),x.minY=Math.min(x.minY,A.ty-A.radius),x.maxX=Math.max(x.maxX,A.tx+A.radius),x.maxY=Math.max(x.maxY,A.ty+A.radius+k);return x}const[D,O]=s.chrome.buttons;return O.addEventListener("click",()=>s.recenter()),D.addEventListener("click",()=>{T={parent:0},ie(G)}),E(),ie(G),La(p,80),s.start({themeChanged:()=>{const k=it(o);if(k!==z){z=k;const x=s.terms.filter(A=>!A.parent&&!Yt(A));for(const A of p.values()){let w=A;const $=new Set;for(;w.parent&&p.has(w.parent)&&!$.has(w.id);)$.add(w.id),w=p.get(w.parent);const I=x.findIndex(N=>N.id===w.id);I>=0&&(A.color=P(I))}}for(const x of p.values())le(n,x,i.focusId===x.id,d),m.relayout(x)},center:k=>{const x=p.get(k);return x?{x:x.x,y:x.y,tone:x.color}:null},countReconciled:(k,x)=>{const A=p.get(k);A&&A.count!==x&&(A.count=x,s.terms=s.terms.map(w=>w.id===k?{...w,count:x}:w),m.relayout(A))},focusChanged:()=>{for(const k of p.values())le(n,k,i.focusId===k.id,d);ie(G)},focusOpened:k=>{S.clear();for(const x of p.values()){if(x.id===i.focusId||!x.pinned)continue;const A=x.x-k.x,w=x.y-k.y,$=Math.sqrt(A*A+w*w)||1;if($>=jt+x.radius)continue;S.set(x.id,{tx:x.tx,ty:x.ty});const I=jt+x.radius+20;x.tx=k.x+A/$*I,x.ty=k.y+w/$*I}},focusClosed:()=>{for(const[k,x]of S){const A=p.get(k);A&&(A.tx=x.tx,A.ty=x.ty)}S.clear()},bounds:q,frame:k=>{mo(p,k,{dragNode:_,focusId:i.focusId,nudge:s.nudge}),i.ease(),M(),_&&g&&fo(n,g,_.color,d);const x=1/Math.max(.01,l.scale.x);m.sync(p,x,i.focusId),i.syncChips(x)},countsChanged:()=>{for(const k of s.terms){const x=p.get(k.id);x&&x.count!==k.count&&(x.count=k.count,m.relayout(x))}E(),r.fitToView(q(),{animate:!0})},dragging:()=>_!==null,pointerMove:(k,x)=>_?(U(x),!0):!1,pointerUp:j,cancelGesture:()=>{_&&(_.pinned=_.depth===0,le(n,_,i.focusId===_.id,d)),g&&le(n,g,i.focusId===g.id,d),_=null,g=null,b=null},search:k=>Array.from(p.values()).filter(x=>x.name.toLowerCase().includes(k))}),()=>s.teardown()}const Da=F`:host{display:inline-flex;max-width:100%}.os-tag-input{display:inline-flex;flex-wrap:wrap;align-items:center;gap:var( --os-ui-tag-input-gap,4px );padding:var( --os-ui-tag-input-padding,2px );min-height:24px;max-width:100%}.os-tag-input__chips{display:inline-flex;flex-wrap:wrap;align-items:center;gap:var( --os-ui-tag-input-gap,4px );min-width:0}.os-tag-input__add{appearance:none;display:inline-flex;align-items:center;gap:3px;padding:1px 8px;min-height:22px;font:inherit;font-size:11px;font-weight:500;line-height:1;color:var( --os-ui-tag-input-add-fg,var( --os-ui-fg-muted,#50575e ) );background:transparent;border:1px dashed var( --os-ui-tag-input-add-border,var( --os-ui-border,#c3c4c7 ) );border-radius:999px;cursor:pointer;transition:background-color 0.12s ease,color 0.12s ease,border-color 0.12s ease}.os-tag-input__add:hover:not(:disabled ){background:var( --os-ui-hover,rgba( 0,0,0,0.04 ) );color:var( --os-ui-tag-input-add-fg-hover,var( --os-ui-fg,#1d2327 ) );border-color:var( --os-ui-tag-input-add-border-hover,var( --os-ui-border-strong,#8c8f94 ) )}.os-tag-input__add:focus-visible{outline:none;border-style:solid;box-shadow:var( --os-ui-focus-ring,0 0 0 2px rgba( 12,11,15,0.9 ),0 0 0 4px #2271b1 )}.os-tag-input__add:disabled{opacity:0.5;cursor:not-allowed}.os-tag-input__add svg{display:block}.os-tag-input__editor{position:relative;display:inline-flex;align-items:center;flex:0 1 auto;min-width:120px}.os-tag-input__input{appearance:none;font:inherit;font-size:var( --os-ui-field-font-size-compact,12px );line-height:1.4;padding:2px 8px;border:1px solid var( --os-ui-tag-input-input-border,var( --os-ui-border,#2271b1 ) );border-radius:999px;background:var( --os-ui-tag-input-input-bg,var( --os-ui-surface,#fff ) );color:var( --os-ui-tag-input-input-fg,var( --os-ui-fg,#1d2327 ) );min-width:80px;max-width:240px}.os-tag-input__input:focus{outline:none;border-color:var( --os-ui-accent,#2271b1 );box-shadow:var( --os-ui-focus-ring-field,0 0 0 1px #2271b1,0 0 0 4px rgba( 34,113,177,0.18 ) )}.os-tag-input__suggestions{position:absolute;top:calc( 100% + 4px );left:0;min-width:220px;max-width:320px;max-height:240px;overflow-y:auto;padding:4px 0;background:var( --os-ui-tag-input-pop-bg,var( --os-ui-surface,#fff ) );color:var( --os-ui-tag-input-pop-fg,var( --os-ui-fg,#1d2327 ) );border:1px solid var( --os-ui-tag-input-pop-border,var( --os-ui-border,#c3c4c7 ) );border-radius:8px;box-shadow:0 6px 16px rgba( 0,0,0,0.08 ),0 1px 2px rgba( 0,0,0,0.06 );z-index:50}.os-tag-input__suggestion-item{display:flex;align-items:center;gap:6px;padding:6px 12px;font-size:13px;cursor:pointer;user-select:none}.os-tag-input__suggestion-item[ aria-selected='true' ]{background:color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 10%,transparent );color:var( --wp-admin-theme-color,#2271b1 )}.os-tag-input__suggestion-create{font-style:italic;color:var( --os-ui-tag-input-create-fg,var( --os-ui-fg-muted,#50575e ) );border-top:1px solid var( --os-ui-tag-input-pop-divider,var( --os-ui-border,#f0f0f1 ) )}.os-tag-input__suggestion-create[ aria-selected='true' ]{color:var( --wp-admin-theme-color,#2271b1 )}.os-tag-input__suggestion-empty,.os-tag-input__suggestion-loading{display:flex;align-items:center;gap:8px;padding:8px 12px;font-size:12px;color:var( --os-ui-tag-input-pop-muted,var( --os-ui-fg-muted,#646970 ) )}.os-tag-input__suggestion-spinner{display:inline-block;width:10px;height:10px;border-radius:50%;border:2px solid currentColor;border-top-color:transparent;animation:os-tag-input-spin 0.8s linear infinite}@keyframes os-tag-input-spin{to{transform:rotate( 360deg )}}:host( [ disabled ] ) .os-tag-input{opacity:0.6;pointer-events:none}`,Ge=class Ge extends X{constructor(){super(...arguments),this._value=[],this._suggestions=[],this._suggestionsLoading=!1,this._query="",this._highlight=-1,this._focusedChip=-1,this._onDocumentPointerDown=e=>{!this.isOpen||e.composedPath().includes(this)||this.closeInput()}}get _input(){const e=this.shadowRoot;return e?e.querySelector(".os-tag-input__input"):null}get value(){return this._value}set value(e){this._value=Array.isArray(e)?e.slice():[],this._focusedChip>=this._value.length&&(this._focusedChip=-1),this.requestUpdate()}get suggestions(){return this._suggestions}set suggestions(e){this._suggestions=Array.isArray(e)?e.slice():[],this._highlight=this._suggestions.length>0?0:-1,this._suggestionsLoading=!1,this.requestUpdate()}get suggestionsLoading(){return this._suggestionsLoading}set suggestionsLoading(e){this._suggestionsLoading=!!e,this.requestUpdate()}get query(){return this._query}get isOpen(){return this.open!==null}openInput(){this.isOpen||(this.open="",this._query="",this._highlight=-1,this.emit("os-tag-open",{}),queueMicrotask(()=>{this._input?.focus(),this._emitSuggest("")}))}closeInput(){this.isOpen&&(this.open=null,this._query="",this._suggestions=[],this._highlight=-1,this._suggestionsLoading=!1,this.emit("os-tag-close",{}),this.requestUpdate())}connectedCallback(){super.connectedCallback(),document.addEventListener("pointerdown",this._onDocumentPointerDown,!0)}disconnectedCallback(){document.removeEventListener("pointerdown",this._onDocumentPointerDown,!0)}render(){const e=this.isOpen,t=this.disabled!==null,s=this.readonly!==null,n=this.removable!==null||this.removable===null&&!s,a=this.creatable!==null,i=this["add-label"]||"Add",r=this.placeholder||"Add a tag…";return C` | |
| 579 | 766 | <span |
| 580 | 767 | class="os-tag-input" |
| 581 | 768 | role="group" |
| 582 | 769 | aria-label=${this.label??""} |
| @@ -581,13 +768,13 @@ | ||
| 581 | 768 | role="group" |
| 582 | 769 | aria-label=${this.label??""} |
| 583 | 770 | > |
| 584 | 771 | ${this._renderChips(n,t)} |
| 585 | - ${this._renderTrailing({isOpen:e,readonly:o,disabled:t,placeholder:r,creatable:a,addLabel:i})} | |
| 772 | + ${this._renderTrailing({isOpen:e,readonly:s,disabled:t,placeholder:r,creatable:a,addLabel:i})} | |
| 586 | 773 | </span> |
| 587 | - `}_renderTrailing(e){return e.isOpen?this._renderEditor(e.placeholder,e.creatable):e.readonly||e.disabled?C``:this._renderTrigger(e.addLabel)}_renderChips(e,t){const o=this._value;return o.length===0?C``:C` | |
| 774 | + `}_renderTrailing(e){return e.isOpen?this._renderEditor(e.placeholder,e.creatable):e.readonly||e.disabled?C``:this._renderTrigger(e.addLabel)}_renderChips(e,t){const s=this._value;return s.length===0?C``:C` | |
| 588 | 775 | <span class="os-tag-input__chips" role="list"> |
| 589 | - ${o.map((n,a)=>{const i=n.tone??"neutral";return C` | |
| 776 | + ${s.map((n,a)=>{const i=n.tone??"neutral";return C` | |
| 590 | 777 | <os-chip |
| 591 | 778 | role="listitem" |
| 592 | 779 | size="compact" |
| 593 | 780 | tone=${i} |
| @@ -611,12 +798,12 @@ | ||
| 611 | 798 | aria-expanded="false" |
| 612 | 799 | ?disabled=${t} |
| 613 | 800 | @click=${()=>this.openInput()} |
| 614 | 801 | > |
| 615 | - ${Ai()} | |
| 802 | + ${Oa()} | |
| 616 | 803 | <span>${e}</span> |
| 617 | 804 | </button> |
| 618 | - `}_renderEditor(e,t){const o=this._suggestions.length>0||this._suggestionsLoading||t&&this._query.trim().length>0;return C` | |
| 805 | + `}_renderEditor(e,t){const s=this._suggestions.length>0||this._suggestionsLoading||t&&this._query.trim().length>0;return C` | |
| 619 | 806 | <span class="os-tag-input__editor"> |
| 620 | 807 | <input |
| 621 | 808 | class="os-tag-input__input" |
| 622 | 809 | type="text" |
| @@ -625,17 +812,17 @@ | ||
| 625 | 812 | spellcheck="false" |
| 626 | 813 | placeholder=${e} |
| 627 | 814 | .value=${this._query} |
| 628 | 815 | aria-autocomplete="list" |
| 629 | - aria-expanded=${o?"true":"false"} | |
| 816 | + aria-expanded=${s?"true":"false"} | |
| 630 | 817 | aria-activedescendant=${this._highlight>=0?`os-tag-suggestion-${this._highlight}`:""} |
| 631 | 818 | @input=${n=>this._onInput(n)} |
| 632 | 819 | @keydown=${n=>this._onInputKeyDown(n)} |
| 633 | 820 | @blur=${n=>this._onInputBlur(n)} |
| 634 | 821 | /> |
| 635 | - ${o?this._renderSuggestions(t):C``} | |
| 822 | + ${s?this._renderSuggestions(t):C``} | |
| 636 | 823 | </span> |
| 637 | - `}_renderSuggestions(e){const t=this._query.trim(),o=this._suggestions,n=e&&t.length>0&&!o.some(a=>a.label.toLowerCase()===t.toLowerCase())&&!this._value.some(a=>a.label.toLowerCase()===t.toLowerCase());return C` | |
| 824 | + `}_renderSuggestions(e){const t=this._query.trim(),s=this._suggestions,n=e&&t.length>0&&!s.some(a=>a.label.toLowerCase()===t.toLowerCase())&&!this._value.some(a=>a.label.toLowerCase()===t.toLowerCase());return C` | |
| 638 | 825 | <div |
| 639 | 826 | class="os-tag-input__suggestions" |
| 640 | 827 | role="listbox" |
| 641 | 828 | > |
| @@ -644,20 +831,20 @@ | ||
| 644 | 831 | <span class="os-tag-input__suggestion-spinner" aria-hidden="true"></span> |
| 645 | 832 | <span>Searching…</span> |
| 646 | 833 | </div> |
| 647 | 834 | `:C``} |
| 648 | - ${o.length===0&&!this._suggestionsLoading&&!n?C` | |
| 835 | + ${s.length===0&&!this._suggestionsLoading&&!n?C` | |
| 649 | 836 | <div class="os-tag-input__suggestion-empty"> |
| 650 | 837 | ${t.length>0?"No matches.":"Type to search."} |
| 651 | 838 | </div> |
| 652 | 839 | `:C``} |
| 653 | - ${o.map((a,i)=>{const r=i===this._highlight;return C` | |
| 840 | + ${s.map((a,i)=>{const r=i===this._highlight;return C` | |
| 654 | 841 | <div |
| 655 | 842 | id=${`os-tag-suggestion-${i}`} |
| 656 | 843 | role="option" |
| 657 | 844 | aria-selected=${r?"true":"false"} |
| 658 | 845 | class="os-tag-input__suggestion-item" |
| 659 | - @mousedown=${l=>{l.preventDefault(),this._addSuggestion(a,!1)}} | |
| 846 | + @mousedown=${c=>{c.preventDefault(),this._addSuggestion(a,!1)}} | |
| 660 | 847 | @mouseenter=${()=>{this._highlight=i,this.requestUpdate()}} |
| 661 | 848 | > |
| 662 | 849 | <span>${a.label}</span> |
| 663 | 850 | </div> |
| @@ -663,16 +850,16 @@ | ||
| 663 | 850 | </div> |
| 664 | 851 | `})} |
| 665 | 852 | ${n?C` |
| 666 | 853 | <div |
| 667 | - id=${`os-tag-suggestion-${o.length}`} | |
| 854 | + id=${`os-tag-suggestion-${s.length}`} | |
| 668 | 855 | role="option" |
| 669 | - aria-selected=${this._highlight===o.length?"true":"false"} | |
| 856 | + aria-selected=${this._highlight===s.length?"true":"false"} | |
| 670 | 857 | class="os-tag-input__suggestion-item os-tag-input__suggestion-create" |
| 671 | 858 | @mousedown=${a=>{a.preventDefault(),this._addSuggestion({label:t},!0)}} |
| 672 | - @mouseenter=${()=>{this._highlight=o.length,this.requestUpdate()}} | |
| 859 | + @mouseenter=${()=>{this._highlight=s.length,this.requestUpdate()}} | |
| 673 | 860 | > |
| 674 | 861 | Create "${t}" |
| 675 | 862 | </div> |
| 676 | 863 | `:C``} |
| 677 | 864 | </div> |
| 678 | - `}_onChipDismiss(e,t){e.stopPropagation(),this.emit("os-tag-remove",{tag:t})}_onInput(e){const t=e.target.value;this._query=t,this._emitSuggest(t)}_emitSuggest(e){const t=parseInt(this["min-query"]||"0",10)||0;if(e.length<t){this._suggestions=[],this._suggestionsLoading=!1,this.requestUpdate();return}this._suggestionsLoading=!0,this.requestUpdate(),this.emit("os-tag-suggest",{query:e})}_onInputKeyDown(e){const t=this.creatable!==null,o=this._suggestions,n=this._query.trim(),a=t&&n.length>0&&!o.some(r=>r.label.toLowerCase()===n.toLowerCase())&&!this._value.some(r=>r.label.toLowerCase()===n.toLowerCase()),i=o.length+(a?1:0);switch(e.key){case"ArrowDown":{if(i===0)return;e.preventDefault(),this._highlight=this._highlight+1>=i?0:this._highlight+1,this.requestUpdate();return}case"ArrowUp":{if(i===0)return;e.preventDefault(),this._highlight=this._highlight<=0?i-1:this._highlight-1,this.requestUpdate();return}case"Enter":{if(e.preventDefault(),this._highlight>=0&&this._highlight<o.length){this._addSuggestion(o[this._highlight],!1);return}if(this._highlight===o.length&&a){this._addSuggestion({label:n},!0);return}if(a&&n.length>0){this._addSuggestion({label:n},!0);return}return}case"Escape":{e.preventDefault(),this.closeInput();return}case"Backspace":{if(this._query===""&&this._value.length>0){e.preventDefault();const r=this._value.length-1;this._focusedChip===r?(this.emit("os-tag-remove",{tag:this._value[r]}),this._focusedChip=-1):(this._focusedChip=r,this.requestUpdate())}return}default:this._focusedChip!==-1&&(this._focusedChip=-1)}}_onInputBlur(e){queueMicrotask(()=>{this.shadowRoot?.activeElement||this.closeInput()})}_addSuggestion(e,t){if(this._value.some(n=>n.label.toLowerCase()===e.label.toLowerCase())){this._query="",this._highlight=-1,this._suggestions=[],this.requestUpdate(),this._input?.focus();return}this.emit("os-tag-add",{tag:e,isNew:t}),this._query="",this._highlight=-1,this._suggestions=[],this._suggestionsLoading=!1,this.requestUpdate(),queueMicrotask(()=>{this._input?.focus()})}};Oe.props=["label","placeholder","add-label","creatable","removable","disabled","readonly","size","min-query","open"],Oe.styles=[Ei],Oe.help=void 0;let Ct=Oe;Q("os-tag-input",Ct);function Ai(){return J("plus",{size:14})}function Ti(s,e){const{client:t}=e,o=document.createElement("span");o.style.cssText="display:inline-flex;align-items:center;width:100%;min-width:0;";const n=document.createElement("os-tag-input");n.setAttribute("creatable",""),n.setAttribute("removable",""),n.setAttribute("min-query","0"),n.setAttribute("placeholder",m("Add tag…")),n.setAttribute("add-label",m("Tag")),n.setAttribute("data-noclick","");const a=Wt(s,"post_tag").map(l=>({id:l.id,label:l.name}));n.value=a;const i={tags:a.slice(),suggestAbort:null,suggestDebounce:null,lastQuery:""},r=l=>{i.tags=l.slice(),n.value=l};return n.addEventListener("os-tag-suggest",l=>{const c=l.detail?.query??"";i.lastQuery=c,i.suggestDebounce!==null&&window.clearTimeout(i.suggestDebounce),i.suggestDebounce=window.setTimeout(async()=>{i.suggestDebounce=null,i.suggestAbort?.abort();const u=new AbortController;i.suggestAbort=u;try{const d=await t.searchTags(c,u.signal);if(i.lastQuery!==c)return;const h=new Set(i.tags.map(p=>p.id));n.suggestions=d.filter(p=>!h.has(p.id)).map(p=>({id:p.id,label:p.name}))}catch(d){if(d?.name==="AbortError")return;n.suggestions=[],console.warn("[openstation:desktop-mode-posts] tag search failed",d)}finally{n.suggestionsLoading=!1}},200)}),n.addEventListener("os-tag-add",async l=>{const c=l.detail;if(c?.tag){r([...i.tags,{id:c.tag.id,label:c.tag.label,pending:!0}]);try{const u=c.isNew||typeof c.tag.id!="number"?await t.createTag(c.tag.label):{id:Number(c.tag.id),name:c.tag.label,slug:""},d=[...i.tags.filter(h=>!h.pending).map(h=>Number(h.id)),u.id];await t.updatePostTags(s.id,d),r(i.tags.map(h=>h.label.toLowerCase()===c.tag.label.toLowerCase()?{id:u.id,label:u.name}:h)),e.announce("tagged",[s.id])}catch(u){r(i.tags.filter(d=>d.label.toLowerCase()!==c.tag.label.toLowerCase())),e.toast(V(m('Couldn’t add tag "%s".'),c.tag.label),u)}}}),n.addEventListener("os-tag-remove",async l=>{const c=l.detail;if(!c?.tag)return;const u=c.tag,d=i.tags.slice();r(i.tags.map(h=>h.label===u.label?{...h,pending:!0}:h));try{const h=d.filter(p=>p.label!==u.label).map(p=>Number(p.id)).filter(p=>Number.isFinite(p));await t.updatePostTags(s.id,h),r(d.filter(p=>p.label!==u.label)),e.announce("untagged",[s.id])}catch(h){r(d),e.toast(V(m('Couldn’t remove tag "%s".'),u.label),h)}}),o.appendChild(n),o}const Ae=11,Pi=6,St=4,Lo=8,Io=22,Ro=s=>te(s,70,48);function Mi(s,e,t,o,n){const a=new s.Container;a.eventMode="static",a.cursor="pointer";const i=new s.Graphics,r=new s.Graphics,l=(h,p,f,b)=>new s.Text({text:h,style:{fill:p,fontSize:f,fontFamily:be,fontWeight:b},resolution:_e}),c=l("#",te(n,65,42),o,"700"),u=l(ve(t.name,Io),1909543,o,"600"),d=l(String(t.count),16777215,Math.max(10,Math.round(o*.55)),"700");for(const h of[i,r,c,u,d])a.addChild(h);return e.addChild(a),{container:a,shadow:i,bg:r,hashText:c,nameText:u,countText:d,cachedHover:!1}}function Li(s,e){const t=s.chip,o=ve(s.name,Io),n=String(s.count);t.nameText.text!==o&&(t.nameText.text=o),t.countText.text!==n&&(t.countText.text=n),t.nameText.style.fontSize=s.fontSize,t.hashText.style.fontSize=s.fontSize,t.countText.style.fontSize=Math.max(10,Math.round(s.fontSize*.55));const a=t.nameText.height,i=Math.max(18,t.countText.width+10),r=Math.max(14,t.countText.height+4);s.width=Ae+t.hashText.width+St+t.nameText.width+Lo+i+Ae,s.height=Math.max(a,r)+Pi*2,zo(s,e)}function zo(s,e){const t=s.chip,o=s.width,n=s.height,a=-o/2,i=-n/2,r=n/2;let l;e?l=Ro(s.hue):t.cachedHover?l=te(s.hue,70,92):l=te(s.hue,60,95);const c=e?te(s.hue,70,38):te(s.hue,50,70),u=e?te(s.hue,80,30):te(s.hue,70,50);t.shadow.clear(),t.shadow.roundRect(a-1,i+3,o+2,n+2,r+1);let d=.1;e?d=.18:t.cachedHover&&(d=.16),t.shadow.fill({color:0,alpha:d}),t.bg.clear(),t.bg.roundRect(a,i,o,n,r),t.bg.fill(l),t.bg.stroke({color:c,width:e?2:1.25,alpha:e?1:.85});const h=t.hashText.width,p=t.nameText.width,f=t.nameText.height,b=t.countText.width,_=t.countText.height,$=Math.max(18,b+10),S=Math.max(14,_+4);t.hashText.x=a+Ae,t.hashText.y=(n-f)/2+i,t.hashText.style.fill=e?16777215:te(s.hue,65,42),t.nameText.x=a+Ae+h+St,t.nameText.y=(n-f)/2+i,t.nameText.style.fill=e?16777215:1909543;const R=a+Ae+h+St+p+Lo,D=(n-S)/2+i;t.bg.roundRect(R,D,$,S,S/2),t.bg.fill(u),t.countText.x=R+($-b)/2,t.countText.y=D+(S-_)/2,t.countText.style.fill=16777215}const No=11,Ii=28,Ri=14;function Do(s,e){const t=Math.sqrt(s/Math.max(1,e));return Math.round(No+(Ii-No)*t)}function zi(s,e){return s.x<e.x+e.w&&s.x+s.w>e.x&&s.y<e.y+e.h&&s.y+s.h>e.y}function Oo(s){let e=0;for(let t=0;t<s.length;t++)e=(e*31+s.charCodeAt(t))%2147483647;return e}function Ho(s,e){return((e+Oo(s)%256*1.4)%360+360)%360}function Fo(s){const e=Oo(s);return(e%2===0?-1:1)*(Math.floor(e/2)%4)*.011}function Ni(s,e,t,o=0,n=0){if(t.length===0)return{x:o,y:n};const a=Ri,i=(l,c)=>{const u={x:l-s/2-a,y:c-e/2-a,w:s+a*2,h:e+a*2};return!t.some(d=>zi(u,d))};if(i(o,n))return{x:o,y:n};let r=0;for(let l=0;l<1e4;l++){r+=.18;const c=r*5,u=o+c*Math.cos(r),d=n+c*Math.sin(r)*.7;if(i(u,d))return{x:u,y:d}}return{x:o,y:n+(t.length+1)*(e+a)}}function $t(s,e,t,o){let n=0;const a=()=>{const i=n++;if(i===0)return{x:0,y:0};const r=i*2.4,l=120+i*70;return{x:l*Math.cos(r),y:l*Math.sin(r)*.8}};for(const i of s){let r=0,l=0,c=!1;const u=o.get(i.id);if(u&&u.length>0){let h=0,p=0,f=0;for(const b of u){const _=t.get(b.id);_&&(h+=_.x*b.shared,p+=_.y*b.shared,f+=b.shared)}f>0&&(r=h/f,l=p/f,c=!0)}if(!c){const h=a();r=h.x,l=h.y}const d=Ni(i.width,i.height,e,r,l);i.tx=d.x,i.ty=d.y,t.set(i.id,{x:d.x,y:d.y}),e.push({x:d.x-i.width/2,y:d.y-i.height/2,w:i.width,h:i.height})}}function Di(){try{const s=window.location.host||"unknown",e=window.location.pathname.replace(/\/?wp-admin\/?.*$/,"");return`os-tagcloud-positions:${s}${e}`}catch{return"os-tagcloud-positions:fallback"}}function Oi(s){const e=new Map;try{const t=window.localStorage.getItem(s),o=t?JSON.parse(t):null;if(!o||typeof o!="object")return e;for(const[n,a]of Object.entries(o)){const i=parseInt(n,10),r=a;Number.isFinite(i)&&typeof r?.x=="number"&&typeof r?.y=="number"&&e.set(i,{x:r.x,y:r.y})}}catch{}return e}function Et(s,e){try{const t={};for(const[o,n]of e)t[String(o)]=n;window.localStorage.setItem(s,JSON.stringify(t))}catch{}}function Hi(s){const{sidebar:e,client:t}=s;Ge(e,`hsl( ${s.themeHue}deg 60% 55% )`,m("New tag"));const o=Ee(e,m("Name"),"",m("e.g. featured"));requestAnimationFrame(()=>o.focus());const n=Ke(e,""),a=le("primary",m("Create")),i=le("danger",m("Cancel")),r=()=>{s.setDraft(!1),ne(s)},l=async()=>{const c=o.value.trim();if(!c){o.focus();return}a.disabled=!0;try{const u=await t.createTag(c),d={id:u.id,name:u.name,slug:u.slug||"",parent:0,count:0,description:u.description||"",isDefault:!1};s.terms().some(p=>p.id===d.id)||s.setTerms(s.terms().concat(d));const h=n.value.trim();if(h)try{const p=await t.updateTerm("tags",u.id,{description:h});s.setTerms(s.terms().map(f=>f.id===p.id?{...f,description:p.description||h}:f))}catch(p){s.toast(m("Tag created but description failed:"),p)}s.setDraft(!1),s.buildCloud(),s.setFocus(u.id),ne(s),await s.loadPosts()}catch(u){a.disabled=!1,s.toast(m("Couldn’t create:"),u)}};a.addEventListener("click",()=>void l()),i.addEventListener("click",r),Ao(o,()=>void l(),r),Ye(e,[a,i])}function Fi(s,e){const{sidebar:t,client:o}=s,n=e.id;Ge(t,`hsl( ${e.hue}deg 60% 55% )`,`#${n}`);const a=s.terms().find(d=>d.id===n),i=Ee(t,m("Name"),e.name,m("Name")),r=kt(t,a?.slug||""),l=Ke(t,e.description||"");So(t,V(fe("%d post tagged with this.","%d posts tagged with this.",e.count),e.count));const c=le("primary",m("Save"));c.addEventListener("click",async()=>{const d=i.value.trim();if(!d)return;const h=l.value,p=r.value.trim(),f=a?.slug??"";if(d===e.name&&h===(e.description||"")&&p===f)return;const b={name:d,description:h};p!==f&&(b.slug=p);try{const _=await o.updateTerm("tags",n,b);s.applyTagUpdate(n,{name:_.name,description:_.description,slug:_.slug||e.slug}),s.setTerms(s.terms().map($=>$.id===n?{...$,name:_.name,description:_.description,slug:_.slug||$.slug}:$)),ne(s)}catch(_){s.toast(m("Couldn’t save:"),_)}});const u=Eo(async()=>{try{await o.deleteTerm("tags",n),s.setTerms(s.terms().filter(d=>d.id!==n)),s.forgetTag(n),s.setFocus(null),s.clearPosts(),s.buildCloud(),ne(s)}catch(d){s.toast(m("Couldn’t delete:"),d)}});Ye(t,[c,u])}function ne(s){if(s.sidebar.replaceChildren(),s.draft()){Hi(s);return}const e=s.focusId();if(e===null){$o(s.sidebar,"dashicons-tag",m("No tag selected"),m("Click a tag on the cloud to edit it, or click + Add tag to create a new one."));return}const t=s.tag(e);if(!t){s.setFocus(null),ne(s);return}Fi(s,t)}async function qi(s,e){const t=await vo(s,e,{taxonomy:"tags",restTaxonomy:"post_tag",modifier:"os-tagcloud",unavailable:m("Tag cloud unavailable."),loadFailed:m("Couldn’t load tags:"),emptyHint:m('No tags yet. Click "Add tag" to start building the cloud.'),chrome:{buttons:[{variant:"primary",icon:"dashicons-plus",label:m("Add tag")},{icon:"dashicons-image-rotate",label:m("Recenter")},{icon:"dashicons-grid-view",label:m("Reflow"),title:m("Recompute the chip layout from scratch — discards manual repositioning.")}],searchPlaceholder:m("Search tags…"),searchAria:m("Search tags in the cloud"),hint:m("Click a tag to focus + edit · drag to reposition · wheel to zoom")},layers:["postEdge","chip","post","postChip"],fan:{chipFontSize:12,chipTextRes:_e,pagerLabelSize:12,pagerGlyphSize:14}});if(!t)return()=>{};const o=t,{pixi:n,layers:a,fan:i,camera:r,interaction:l,world:c}=o,{client:u}=e,d=new Map;let h=null,p={x:0,y:0},f=null,b=!1;const _=Di(),$=Oi(_);let S=new Map;const R=bo(),D=g=>i.focusId===g,P=g=>Li(g,D(g.id)),y=g=>zo(g,D(g.id));function E(){const g=o.terms,x=new Set(g.map(A=>A.id));for(const[A,F]of d)x.has(A)||(a.chip.removeChild(F.chip.container),F.chip.container.destroy({children:!0}),d.delete(A));const k=Math.max(1,...g.map(A=>A.count)),M=[];for(const A of g){const F=Do(A.count,k),Z=Ho(A.slug||A.name,R),ie=Fo(A.slug||A.name),X=d.get(A.id);if(X){X.name=A.name,X.slug=A.slug,X.description=A.description,X.count=A.count,X.fontSize=F,X.hue=Z,X.rotation=ie,P(X);continue}const de=$.get(A.id),pe={id:A.id,name:A.name,slug:A.slug,description:A.description,count:A.count,fontSize:F,hue:Z,rotation:ie,x:de?.x??0,y:de?.y??0,tx:de?.x??0,ty:de?.y??0,width:0,height:0,chip:Mi(n,a.chip,A,F,Z)};d.set(A.id,pe),P(pe),I(pe),de||M.push(pe)}const U=[],Y=new Map;for(const A of d.values())M.includes(A)||(U.push({x:A.tx-A.width/2,y:A.ty-A.height/2,w:A.width,h:A.height}),Y.set(A.id,{x:A.tx,y:A.ty}));M.sort((A,F)=>F.count-A.count),$t(M,U,Y,S);for(const A of M)A.x=A.tx,A.y=A.ty;o.syncEmptyHint(g.length===0)}function I(g){const x=g.chip.container;x.on("pointerdown",k=>{const M=k;ue(l,k),h=g,f={x:M.global.x,y:M.global.y};const U=r.stageToWorld(M.global);p={x:g.x-U.x,y:g.y-U.y}}),x.on("pointerover",()=>{g.chip.cachedHover=!0,y(g)}),x.on("pointerout",()=>{g.chip.cachedHover=!1,y(g)})}function O(g){const x=o.nudge;for(const k of d.values()){if(k===h)continue;let M=k.tx,U=k.ty;if(x&&k.id!==i.focusId){const A=k.tx-x.x,F=k.ty-x.y,Z=Math.sqrt(A*A+F*F)||1,ie=x.radius+Math.max(k.width,k.height)/2;if(Z<ie){const X=ie+12;M=x.x+A/Z*X,U=x.y+F/Z*X}}const Y=1-Math.exp(-g*.012);k.x+=(M-k.x)*Y,k.y+=(U-k.y)*Y}}function H(){const g=1/Math.max(.01,c.scale.x),x=i.focusId!==null;for(const k of d.values()){const M=k.chip.container;M.x=k.x,M.y=k.y,M.scale.set(Math.max(1,g)),M.rotation=k.rotation;const U=!x||i.focusId===k.id?1:.32;Math.abs(M.alpha-U)>.005?M.alpha+=(U-M.alpha)*.18:M.alpha=U}i.syncChips(g)}function z(g){if(!h)return;const x=h,k=mo(f,g);h=null,f=null,k<3?o.focusOn(x.id):($.set(x.id,{x:x.tx,y:x.ty}),Et(_,$))}const T={sidebar:o.sidebar,client:u,toast:e.toast,themeHue:R,terms:()=>o.terms,setTerms:g=>{o.terms=g},tag:g=>d.get(g),focusId:()=>i.focusId,setFocus:g=>{i.focusId=g},draft:()=>b,setDraft:g=>{b=g},applyTagUpdate:(g,x)=>{const k=d.get(g);k&&(k.name=x.name,k.description=x.description,k.slug=x.slug,k.hue=Ho(k.slug||k.name,R),k.rotation=Fo(k.slug||k.name),P(k))},forgetTag:g=>{$.delete(g),Et(_,$)},buildCloud:E,clearPosts:()=>i.clear(),loadPosts:()=>i.load()};function L(){if(d.size===0)return null;const g={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const x of d.values())g.minX=Math.min(g.minX,x.tx-x.width/2),g.minY=Math.min(g.minY,x.ty-x.height/2),g.maxX=Math.max(g.maxX,x.tx+x.width/2),g.maxY=Math.max(g.maxY,x.ty+x.height/2);return g}function N(){const g=[],x=new Map,k=[];for(const M of d.values())$.has(M.id)?(g.push({x:M.tx-M.width/2,y:M.ty-M.height/2,w:M.width,h:M.height}),x.set(M.id,{x:M.tx,y:M.ty})):k.push(M);k.sort((M,U)=>U.count-M.count),$t(k,g,x,S)}async function j(){try{S=await u.fetchTagCooccurrence("tags",8),S.size>0&&N()}catch{}}const[he,w,v]=o.chrome.buttons;return w.addEventListener("click",()=>o.recenter()),he.addEventListener("click",()=>{b=!0,ne(T)}),v.addEventListener("click",()=>{$.clear(),Et(_,$);for(const x of d.values())x.tx=0,x.ty=0;const g=Array.from(d.values()).sort((x,k)=>k.count-x.count);$t(g,[],new Map,S),r.fitToView(L(),{animate:!0}),j()}),E(),ne(T),o.start({center:g=>{const x=d.get(g);return x?{x:x.x,y:x.y,tone:Ro(x.hue)}:null},countReconciled:(g,x)=>{const k=d.get(g);k&&k.count!==x&&(k.count=x,o.terms=o.terms.map(M=>M.id===g?{...M,count:x}:M),P(k))},focusChanged:()=>{for(const g of d.values())y(g);ne(T)},bounds:L,frame:g=>{O(g),i.ease(),i.drawEdges(),H()},countsChanged:()=>{const g=Math.max(1,...o.terms.map(x=>x.count));for(const x of o.terms){const k=d.get(x.id);k&&(k.count=x.count,k.fontSize=Do(x.count,g),P(k))}i.focusId!==null&&ne(T)},dragging:()=>h!==null,pointerMove:(g,x)=>h?(h.x=x.x+p.x,h.y=x.y+p.y,h.tx=h.x,h.ty=h.y,!0):!1,pointerUp:z,search:g=>Array.from(d.values()).filter(x=>x.name.toLowerCase().includes(g)||x.slug.toLowerCase().includes(g))}),j(),()=>o.teardown()}const Ui=Gn("desktop-mode-posts",{cells:{tags:Ti,categories:an},terms:{categories:$i,tags:qi}});return Ze.default=Ui,Object.defineProperties(Ze,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),Ze}({}); | |
| 865 | + `}_onChipDismiss(e,t){e.stopPropagation(),this.emit("os-tag-remove",{tag:t})}_onInput(e){const t=e.target.value;this._query=t,this._emitSuggest(t)}_emitSuggest(e){const t=parseInt(this["min-query"]||"0",10)||0;if(e.length<t){this._suggestions=[],this._suggestionsLoading=!1,this.requestUpdate();return}this._suggestionsLoading=!0,this.requestUpdate(),this.emit("os-tag-suggest",{query:e})}_onInputKeyDown(e){const t=this.creatable!==null,s=this._suggestions,n=this._query.trim(),a=t&&n.length>0&&!s.some(r=>r.label.toLowerCase()===n.toLowerCase())&&!this._value.some(r=>r.label.toLowerCase()===n.toLowerCase()),i=s.length+(a?1:0);switch(e.key){case"ArrowDown":{if(i===0)return;e.preventDefault(),this._highlight=this._highlight+1>=i?0:this._highlight+1,this.requestUpdate();return}case"ArrowUp":{if(i===0)return;e.preventDefault(),this._highlight=this._highlight<=0?i-1:this._highlight-1,this.requestUpdate();return}case"Enter":{if(e.preventDefault(),this._highlight>=0&&this._highlight<s.length){this._addSuggestion(s[this._highlight],!1);return}if(this._highlight===s.length&&a){this._addSuggestion({label:n},!0);return}if(a&&n.length>0){this._addSuggestion({label:n},!0);return}return}case"Escape":{e.preventDefault(),this.closeInput();return}case"Backspace":{if(this._query===""&&this._value.length>0){e.preventDefault();const r=this._value.length-1;this._focusedChip===r?(this.emit("os-tag-remove",{tag:this._value[r]}),this._focusedChip=-1):(this._focusedChip=r,this.requestUpdate())}return}default:this._focusedChip!==-1&&(this._focusedChip=-1)}}_onInputBlur(e){queueMicrotask(()=>{this.shadowRoot?.activeElement||this.closeInput()})}_addSuggestion(e,t){if(this._value.some(n=>n.label.toLowerCase()===e.label.toLowerCase())){this._query="",this._highlight=-1,this._suggestions=[],this.requestUpdate(),this._input?.focus();return}this.emit("os-tag-add",{tag:e,isNew:t}),this._query="",this._highlight=-1,this._suggestions=[],this._suggestionsLoading=!1,this.requestUpdate(),queueMicrotask(()=>{this._input?.focus()})}};Ge.props=["name","label","placeholder","add-label","creatable","removable","disabled","readonly","size","min-query","open"],Ge.styles=[Da],Ge.help=void 0;let Zt=Ge;Q("os-tag-input",Zt);function Oa(){return se("plus",{size:14})}function Ha(o,e){const{client:t}=e,s=document.createElement("span");s.style.cssText="display:inline-flex;align-items:center;width:100%;min-width:0;";const n=document.createElement("os-tag-input");n.setAttribute("creatable",""),n.setAttribute("removable",""),n.setAttribute("min-query","0"),n.setAttribute("placeholder",f("Add tag…")),n.setAttribute("add-label",f("Tag")),n.setAttribute("data-noclick","");const a=kt(o,"post_tag").map(c=>({id:c.id,label:c.name}));n.value=a;const i={tags:a.slice(),suggestAbort:null,suggestDebounce:null,lastQuery:""},r=c=>{i.tags=c.slice(),n.value=c};return n.addEventListener("os-tag-suggest",c=>{const l=c.detail?.query??"";i.lastQuery=l,i.suggestDebounce!==null&&window.clearTimeout(i.suggestDebounce),i.suggestDebounce=window.setTimeout(async()=>{i.suggestDebounce=null,i.suggestAbort?.abort();const d=new AbortController;i.suggestAbort=d;try{const u=await t.searchTags(l,d.signal);if(i.lastQuery!==l)return;const h=new Set(i.tags.map(p=>p.id));n.suggestions=u.filter(p=>!h.has(p.id)).map(p=>({id:p.id,label:p.name}))}catch(u){if(u?.name==="AbortError")return;n.suggestions=[],console.warn("[openstation:desktop-mode-posts] tag search failed",u)}finally{n.suggestionsLoading=!1}},200)}),n.addEventListener("os-tag-add",async c=>{const l=c.detail;if(l?.tag){r([...i.tags,{id:l.tag.id,label:l.tag.label,pending:!0}]);try{const d=l.isNew||typeof l.tag.id!="number"?await t.createTag(l.tag.label):{id:Number(l.tag.id),name:l.tag.label,slug:""},u=[...i.tags.filter(h=>!h.pending).map(h=>Number(h.id)),d.id];await t.updatePostTags(o.id,u),r(i.tags.map(h=>h.label.toLowerCase()===l.tag.label.toLowerCase()?{id:d.id,label:d.name}:h)),e.announce("tagged",[o.id])}catch(d){r(i.tags.filter(u=>u.label.toLowerCase()!==l.tag.label.toLowerCase())),e.toast(W(f('Couldn’t add tag "%s".'),l.tag.label),d)}}}),n.addEventListener("os-tag-remove",async c=>{const l=c.detail;if(!l?.tag)return;const d=l.tag,u=i.tags.slice();r(i.tags.map(h=>h.label===d.label?{...h,pending:!0}:h));try{const h=u.filter(p=>p.label!==d.label).map(p=>Number(p.id)).filter(p=>Number.isFinite(p));await t.updatePostTags(o.id,h),r(u.filter(p=>p.label!==d.label)),e.announce("untagged",[o.id])}catch(h){r(u),e.toast(W(f('Couldn’t remove tag "%s".'),d.label),h)}}),s.appendChild(n),s}const ze=11,qa=6,Jt=4,Co=8,$o=22,So=o=>lo(o,70,48);function Fa(o,e,t,s,n){const a=new o.Container;a.eventMode="static",a.cursor="pointer";const i=new o.Graphics,r=new o.Graphics,c=(h,p,m,_)=>new o.Text({text:h,style:{fill:p,fontSize:m,fontFamily:Ee,fontWeight:_},resolution:Ae}),l=c("#",n.accent,s,"700"),d=c(Te(t.name,$o),n.fg,s,"600"),u=c(String(t.count),n.fg,Math.max(10,Math.round(s*.55)),"700");for(const h of[i,r,l,d,u])a.addChild(h);return e.addChild(a),{container:a,shadow:i,bg:r,hashText:l,nameText:d,countText:u,cachedHover:!1}}function Ua(o,e,t){const s=o.chip,n=Te(o.name,$o),a=String(o.count);s.nameText.text!==n&&(s.nameText.text=n),s.countText.text!==a&&(s.countText.text=a),s.nameText.style.fontSize=o.fontSize,s.hashText.style.fontSize=o.fontSize,s.countText.style.fontSize=Math.max(10,Math.round(o.fontSize*.55));const i=s.nameText.height,r=Math.max(18,s.countText.width+10),c=Math.max(14,s.countText.height+4);o.width=ze+s.hashText.width+Jt+s.nameText.width+Co+r+ze,o.height=Math.max(i,c)+qa*2,Eo(o,e,t)}function Eo(o,e,t){const s=o.chip,n=o.width,a=o.height,i=-n/2,r=-a/2,c=a/2,l=e||s.cachedHover?t.raised:t.surface,d=e?t.accent:t.border,u=So(o.hue);s.shadow.clear(),s.shadow.roundRect(i-1,r+3,n+2,a+2,c+1);let h=.1;e?h=.18:s.cachedHover&&(h=.16),s.shadow.fill({color:0,alpha:h}),s.bg.clear(),s.bg.roundRect(i,r,n,a,c),s.bg.fill(l),s.bg.stroke({color:d,width:e?2:1.25,alpha:e?1:.85});const p=s.hashText.width,m=s.nameText.width,_=s.nameText.height,g=s.countText.width,b=s.countText.height,v=Math.max(18,g+10),S=Math.max(14,b+4);s.hashText.x=i+ze,s.hashText.y=(a-_)/2+r,s.hashText.style.fill=t.accent,s.nameText.x=i+ze+p+Jt,s.nameText.y=(a-_)/2+r,s.nameText.style.fill=t.fg;const T=i+ze+p+Jt+m+Co,z=(a-S)/2+r;s.bg.roundRect(T,z,v,S,S/2),s.bg.fill(u),s.countText.x=T+(v-g)/2,s.countText.y=z+(S-b)/2,s.countText.style.fill=uo(u,t)}const Ao=11,Wa=28,Va=14;function To(o,e){const t=Math.sqrt(o/Math.max(1,e));return Math.round(Ao+(Wa-Ao)*t)}function Ba(o,e){return o.x<e.x+e.w&&o.x+o.w>e.x&&o.y<e.y+e.h&&o.y+o.h>e.y}function Mo(o){let e=0;for(let t=0;t<o.length;t++)e=(e*31+o.charCodeAt(t))%2147483647;return e}function Qt(o,e){return((e+Mo(o)%256*1.4)%360+360)%360}function Io(o){const e=Mo(o);return(e%2===0?-1:1)*(Math.floor(e/2)%4)*.011}function ja(o,e,t,s=0,n=0){if(t.length===0)return{x:s,y:n};const a=Va,i=(c,l)=>{const d={x:c-o/2-a,y:l-e/2-a,w:o+a*2,h:e+a*2};return!t.some(u=>Ba(d,u))};if(i(s,n))return{x:s,y:n};let r=0;for(let c=0;c<1e4;c++){r+=.18;const l=r*5,d=s+l*Math.cos(r),u=n+l*Math.sin(r)*.7;if(i(d,u))return{x:d,y:u}}return{x:s,y:n+(t.length+1)*(e+a)}}function es(o,e,t,s){let n=0;const a=()=>{const i=n++;if(i===0)return{x:0,y:0};const r=i*2.4,c=120+i*70;return{x:c*Math.cos(r),y:c*Math.sin(r)*.8}};for(const i of o){let r=0,c=0,l=!1;const d=s.get(i.id);if(d&&d.length>0){let h=0,p=0,m=0;for(const _ of d){const g=t.get(_.id);g&&(h+=g.x*_.shared,p+=g.y*_.shared,m+=_.shared)}m>0&&(r=h/m,c=p/m,l=!0)}if(!l){const h=a();r=h.x,c=h.y}const u=ja(i.width,i.height,e,r,c);i.tx=u.x,i.ty=u.y,t.set(i.id,{x:u.x,y:u.y}),e.push({x:u.x-i.width/2,y:u.y-i.height/2,w:i.width,h:i.height})}}function Ka(){try{const o=window.location.host||"unknown",e=window.location.pathname.replace(/\/?wp-admin\/?.*$/,"");return`os-tagcloud-positions:${o}${e}`}catch{return"os-tagcloud-positions:fallback"}}function Ga(o){const e=new Map;try{const t=window.localStorage.getItem(o),s=t?JSON.parse(t):null;if(!s||typeof s!="object")return e;for(const[n,a]of Object.entries(s)){const i=parseInt(n,10),r=a;Number.isFinite(i)&&typeof r?.x=="number"&&typeof r?.y=="number"&&e.set(i,{x:r.x,y:r.y})}}catch{}return e}function ts(o,e){try{const t={};for(const[s,n]of e)t[String(s)]=n;window.localStorage.setItem(o,JSON.stringify(t))}catch{}}function Xa(o){const{sidebar:e,client:t}=o;rt(e,`hsl( ${o.themeHue}deg 60% 55% )`,f("New tag"));const s=Pe(e,f("Name"),"",f("e.g. featured"));requestAnimationFrame(()=>s.focus());const n=lt(e,""),a=fe("primary",f("Create")),i=fe("danger",f("Cancel")),r=()=>{o.setDraft(!1),ce(o)},c=async()=>{const l=s.value.trim();if(!l){s.focus();return}a.disabled=!0;try{const d=await t.createTag(l),u={id:d.id,name:d.name,slug:d.slug||"",parent:0,count:0,description:d.description||"",isDefault:!1};o.terms().some(p=>p.id===u.id)||o.setTerms(o.terms().concat(u));const h=n.value.trim();if(h)try{const p=await t.updateTerm("tags",d.id,{description:h});o.setTerms(o.terms().map(m=>m.id===p.id?{...m,description:p.description||h}:m))}catch(p){o.toast(f("Tag created but description failed:"),p)}o.setDraft(!1),o.buildCloud(),o.setFocus(d.id),ce(o),await o.loadPosts()}catch(d){a.disabled=!1,o.toast(f("Couldn’t create:"),d)}};a.addEventListener("click",()=>void c()),i.addEventListener("click",r),xo(s,()=>void c(),r),ct(e,[a,i])}function Ya(o,e){const{sidebar:t,client:s}=o,n=e.id;rt(t,`hsl( ${e.hue}deg 60% 55% )`,`#${n}`);const a=o.terms().find(u=>u.id===n),i=Pe(t,f("Name"),e.name,f("Name")),r=Xt(t,a?.slug||""),c=lt(t,e.description||"");_o(t,W(de("%d post tagged with this.","%d posts tagged with this.",e.count),e.count));const l=fe("primary",f("Save"));l.addEventListener("click",async()=>{const u=i.value.trim();if(!u)return;const h=c.value,p=r.value.trim(),m=a?.slug??"";if(u===e.name&&h===(e.description||"")&&p===m)return;const _={name:u,description:h};p!==m&&(_.slug=p);try{const g=await s.updateTerm("tags",n,_);o.applyTagUpdate(n,{name:g.name,description:g.description,slug:g.slug||e.slug}),o.setTerms(o.terms().map(b=>b.id===n?{...b,name:g.name,description:g.description,slug:g.slug||b.slug}:b)),ce(o)}catch(g){o.toast(f("Couldn’t save:"),g)}});const d=yo(async()=>{try{await s.deleteTerm("tags",n),o.setTerms(o.terms().filter(u=>u.id!==n)),o.forgetTag(n),o.setFocus(null),o.clearPosts(),o.buildCloud(),ce(o)}catch(u){o.toast(f("Couldn’t delete:"),u)}});ct(t,[l,d])}function ce(o){if(o.sidebar.replaceChildren(),o.draft()){Xa(o);return}const e=o.focusId();if(e===null){vo(o.sidebar,"dashicons-tag",f("No tag selected"),f("Click a tag on the cloud to edit it, or click + Add tag to create a new one."));return}const t=o.tag(e);if(!t){o.setFocus(null),ce(o);return}Ya(o,t)}async function Za(o,e){const t=await po(o,e,{taxonomy:"tags",restTaxonomy:"post_tag",modifier:"os-tagcloud",unavailable:f("Tag cloud unavailable."),loadFailed:f("Couldn’t load tags:"),emptyHint:f('No tags yet. Click "Add tag" to start building the cloud.'),chrome:{buttons:[{variant:"primary",icon:"dashicons-plus",label:f("Add tag")},{icon:"dashicons-image-rotate",label:f("Recenter")},{icon:"dashicons-grid-view",label:f("Reflow"),title:f("Recompute the chip layout from scratch — discards manual repositioning.")}],searchPlaceholder:f("Search tags…"),searchAria:f("Search tags in the cloud"),hint:f("Click a tag to focus + edit · drag to reposition · scroll or pinch to zoom")},layers:["postEdge","chip","post","postChip"],fan:{chipFontSize:12,chipTextRes:Ae,pagerLabelSize:12,pagerGlyphSize:14}});if(!t)return()=>{};const s=t,{pixi:n,layers:a,fan:i,camera:r,interaction:c,world:l,palette:d}=s,{client:u}=e,h=new Map;let p=null,m={x:0,y:0},_=null,g=null,b=!1;const v=Ka(),S=Ga(v);let T=new Map,z=it(o);const P=w=>i.focusId===w,y=w=>Ua(w,P(w.id),d),E=w=>Eo(w,P(w.id),d);function M(){const w=s.terms,$=new Set(w.map(L=>L.id));for(const[L,Y]of h)$.has(L)||(a.chip.removeChild(Y.chip.container),Y.chip.container.destroy({children:!0}),h.delete(L));const I=Math.max(1,...w.map(L=>L.count)),N=[];for(const L of w){const Y=To(L.count,I),ae=Qt(L.slug||L.name,z),me=Io(L.slug||L.name),J=h.get(L.id);if(J){J.name=L.name,J.slug=L.slug,J.description=L.description,J.count=L.count,J.fontSize=Y,J.hue=ae,J.rotation=me,y(J);continue}const be=S.get(L.id),xe={id:L.id,name:L.name,slug:L.slug,description:L.description,count:L.count,fontSize:Y,hue:ae,rotation:me,x:be?.x??0,y:be?.y??0,tx:be?.x??0,ty:be?.y??0,width:0,height:0,chip:Fa(n,a.chip,L,Y,d)};h.set(L.id,xe),y(xe),R(xe),be||N.push(xe)}const K=[],V=new Map;for(const L of h.values())N.includes(L)||(K.push({x:L.tx-L.width/2,y:L.ty-L.height/2,w:L.width,h:L.height}),V.set(L.id,{x:L.tx,y:L.ty}));N.sort((L,Y)=>Y.count-L.count),es(N,K,V,T);for(const L of N)L.x=L.tx,L.y=L.ty;s.syncEmptyHint(w.length===0)}function R(w){const $=w.chip.container;$.on("pointerdown",I=>{if(ne(c))return;const N=I;ve(c,I),p=w,g={x:w.tx,y:w.ty},_={x:N.global.x,y:N.global.y};const K=r.stageToWorld(N.global);m={x:w.x-K.x,y:w.y-K.y}}),$.on("pointerover",()=>{w.chip.cachedHover=!0,E(w)}),$.on("pointerout",()=>{w.chip.cachedHover=!1,E(w)})}function H(w){const $=s.nudge;for(const I of h.values()){if(I===p)continue;let N=I.tx,K=I.ty;if($&&I.id!==i.focusId){const L=I.tx-$.x,Y=I.ty-$.y,ae=Math.sqrt(L*L+Y*Y)||1,me=$.radius+Math.max(I.width,I.height)/2;if(ae<me){const J=me+12;N=$.x+L/ae*J,K=$.y+Y/ae*J}}const V=1-Math.exp(-w*.012);I.x+=(N-I.x)*V,I.y+=(K-I.y)*V}}function U(){const w=1/Math.max(.01,l.scale.x),$=i.focusId!==null;for(const I of h.values()){const N=I.chip.container;N.x=I.x,N.y=I.y,N.scale.set(1),N.rotation=I.rotation;const K=!$||i.focusId===I.id?1:.32;Math.abs(N.alpha-K)>.005?N.alpha+=(K-N.alpha)*.18:N.alpha=K}i.syncChips(w)}function j(w){if(!p)return;const $=p,I=ro(_,w);p=null,_=null,I<3?s.focusOn($.id):(S.set($.id,{x:$.tx,y:$.ty}),ts(v,S))}const G={sidebar:s.sidebar,client:u,toast:e.toast,themeHue:z,terms:()=>s.terms,setTerms:w=>{s.terms=w},tag:w=>h.get(w),focusId:()=>i.focusId,setFocus:w=>{i.focusId=w},draft:()=>b,setDraft:w=>{b=w},applyTagUpdate:(w,$)=>{const I=h.get(w);I&&(I.name=$.name,I.description=$.description,I.slug=$.slug,I.hue=Qt(I.slug||I.name,z),I.rotation=Io(I.slug||I.name),y(I))},forgetTag:w=>{S.delete(w),ts(v,S)},buildCloud:M,clearPosts:()=>i.clear(),loadPosts:()=>i.load()};function q(){if(h.size===0)return null;const w={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const $ of h.values())w.minX=Math.min(w.minX,$.tx-$.width/2),w.minY=Math.min(w.minY,$.ty-$.height/2),w.maxX=Math.max(w.maxX,$.tx+$.width/2),w.maxY=Math.max(w.maxY,$.ty+$.height/2);return w}function D(){const w=[],$=new Map,I=[];for(const N of h.values())S.has(N.id)?(w.push({x:N.tx-N.width/2,y:N.ty-N.height/2,w:N.width,h:N.height}),$.set(N.id,{x:N.tx,y:N.ty})):I.push(N);I.sort((N,K)=>K.count-N.count),es(I,w,$,T)}async function O(){try{T=await u.fetchTagCooccurrence("tags",8),T.size>0&&D()}catch{}}const[k,x,A]=s.chrome.buttons;return x.addEventListener("click",()=>s.recenter()),k.addEventListener("click",()=>{b=!0,ce(G)}),A.addEventListener("click",()=>{S.clear(),ts(v,S);for(const $ of h.values())$.tx=0,$.ty=0;const w=Array.from(h.values()).sort(($,I)=>I.count-$.count);es(w,[],new Map,T),r.fitToView(q(),{animate:!0}),O()}),M(),ce(G),s.start({themeChanged:()=>{z=it(o);for(const w of h.values())w.hue=Qt(w.slug||w.name,z),E(w)},center:w=>{const $=h.get(w);return $?{x:$.x,y:$.y,tone:So($.hue)}:null},countReconciled:(w,$)=>{const I=h.get(w);I&&I.count!==$&&(I.count=$,s.terms=s.terms.map(N=>N.id===w?{...N,count:$}:N),y(I))},focusChanged:()=>{for(const w of h.values())E(w);ce(G)},bounds:q,frame:w=>{H(w),i.ease(),i.drawEdges(),U()},countsChanged:()=>{const w=Math.max(1,...s.terms.map($=>$.count));for(const $ of s.terms){const I=h.get($.id);I&&(I.count=$.count,I.fontSize=To($.count,w),y(I))}i.focusId!==null&&ce(G)},dragging:()=>p!==null,pointerMove:(w,$)=>p?(p.x=$.x+m.x,p.y=$.y+m.y,p.tx=p.x,p.ty=p.y,!0):!1,pointerUp:j,cancelGesture:()=>{p&&g&&(p.x=p.tx=g.x,p.y=p.ty=g.y),p=null,_=null,g=null},search:w=>Array.from(h.values()).filter($=>$.name.toLowerCase().includes(w)||$.slug.toLowerCase().includes(w))}),O(),()=>s.teardown()}const Ja=Ki("desktop-mode-posts",{cells:{tags:Ha,categories:jn},terms:{categories:Na,tags:Za}});return dt.default=Ja,Object.defineProperties(dt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),dt}({}); | |