| @@ -1,214 +1,359 @@ | ||
| 1 | -var openStationApp_users=function(j){"use strict";const Ce="desktop-mode";function ee(){return window.wp?.i18n}function a(e,t=Ce){return ee()?.__(e,t)??e}function y(e,...t){const n=ee()?.sprintf;if(n)return n(e,...t);let s=0;return e.replace(/%(?:(\d+)\$)?[sd]/g,(o,i)=>{const r=i?Number.parseInt(i,10)-1:s++;return String(t[r]??"")})}function h(e,...t){return{__wpdHtml:!0,strings:e,values:t}}function Ae(e){return!!e&&e.__wpdHtml===!0}const Te="$$wpd$$",b=/\$\$wpd\$\$(\d+)\$\$/g,Pe="$$wpd-node$$",Ne=/^\$\$wpd-node\$\$(\d+)\$\$$/,Re=new Set(["style","script","textarea","title"]);function Me(e){let t="",n=!1,s=null,o=!1,i=null,r="",c=!1;for(let d=0;d<e.length;d++){const l=e[d];t+=l;for(let u=0;u<l.length;u++){const p=l[u];if(o){l.startsWith("-->",u)&&(o=!1,u+=2);continue}if(i!==null){p==="<"&&l[u+1]==="/"&&l.slice(u+2,u+2+i.length).toLowerCase()===i&&(u+=1+i.length,i=null,n=!0,c=!1,r="");continue}if(s!==null){p===s&&(s=null);continue}if(n){p==='"'||p==="'"?(s=p,c=!1):p===">"?(n=!1,c=!1,Re.has(r)&&(i=r),r=""):c&&(/[a-zA-Z0-9-]/.test(p)?r+=p.toLowerCase():c=!1);continue}if(l.startsWith("<!--",u)){o=!0,u+=3;continue}const f=l[u+1]??"";p==="<"&&/[a-zA-Z/!]/.test(f)&&(n=!0,r="",c=/[a-zA-Z]/.test(f))}d<e.length-1&&(t+=n||o||i!==null?`${Te}${d}$$`:`<!--${Pe}${d}$$-->`)}return t}const te=new WeakMap;function ne(e){const t=te.get(e);if(t)return t;const n=document.createElement("template");n.innerHTML=Me(e);const s=[],o=(c,d)=>{if(c.nodeType===Node.ELEMENT_NODE){const p=c;for(const f of Array.from(p.attributes)){const v=f.name,g=f.value,k=v[0];if(b.test(g))if(b.lastIndex=0,k==="@"){const m=b.exec(g);b.lastIndex=0,s.push({path:d,kind:"event",name:v.slice(1),valueIndex:m?Number(m[1]):0}),p.removeAttribute(v)}else if(k==="."){const m=b.exec(g);b.lastIndex=0,s.push({path:d,kind:"prop",name:v.slice(1),valueIndex:m?Number(m[1]):0}),p.removeAttribute(v)}else if(k==="?"){const m=b.exec(g);b.lastIndex=0,s.push({path:d,kind:"bool",name:v.slice(1),valueIndex:m?Number(m[1]):0}),p.removeAttribute(v)}else{const m=[],x=[];let _=0,S;for(b.lastIndex=0;(S=b.exec(g))!==null;)m.push(g.slice(_,S.index)),x.push(Number(S[1])),_=S.index+S[0].length;m.push(g.slice(_)),s.push({path:d,kind:"attr",name:v,template:m,valueIndices:x}),p.setAttribute(v,"")}}}const l=Array.from(c.childNodes);let u=0;for(let p=0;p<l.length;p++){const f=l[p],v=p+u;if(f.nodeType===Node.COMMENT_NODE){const g=Ne.exec(f.data);if(g){const k=document.createTextNode("");f.parentNode.replaceChild(k,f),s.push({path:[...d,v],kind:"node",valueIndex:Number(g[1])})}continue}if(f.nodeType===Node.TEXT_NODE){const g=f.textContent||"";if(!b.test(g)){b.lastIndex=0;continue}b.lastIndex=0;const k=f.parentNode;let m=0,x;const _=[],S=[];for(b.lastIndex=0;(x=b.exec(g))!==null;){x.index>m&&_.push(document.createTextNode(g.slice(m,x.index)));const J=document.createTextNode("");_.push(J),S.push({path:[...d,v+_.length-1],kind:"node",valueIndex:Number(x[1])}),m=x.index+x[0].length}m<g.length&&_.push(document.createTextNode(g.slice(m)));for(const J of _)k.insertBefore(J,f);k.removeChild(f),u+=_.length-1,s.push(...S)}else o(f,[...d,v])}};o(n.content,[]);const r={template:n,buildParts:c=>{const d=[];for(const l of s){let u=c;for(const p of l.path)u=u.childNodes[p];l.kind==="node"?d.push({kind:"node",valueIndex:l.valueIndex,child:{anchor:u,state:null}}):l.kind==="attr"?d.push({kind:"attr",element:u,name:l.name,template:l.template,valueIndices:l.valueIndices}):l.kind==="event"?d.push({kind:"event",valueIndex:l.valueIndex,element:u,name:l.name}):l.kind==="prop"?d.push({kind:"prop",valueIndex:l.valueIndex,element:u,name:l.name}):l.kind==="bool"&&d.push({kind:"bool",valueIndex:l.valueIndex,element:u,name:l.name})}return d}};return te.set(e,r),r}const se=new WeakMap;function Ie(e,t){for(const n of e.nodes)if(n.parentNode!==t)return!1;return!0}function oe(e,t){const n=se.get(t);if(n&&n.strings===e.strings&&Ie(n,t)){z(n.parts,e.values);return}const s=ne(e.strings),o=s.template.content.cloneNode(!0),i=s.buildParts(o),r=Array.from(o.childNodes);for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(o),z(i,e.values),se.set(t,{strings:e.strings,parts:i,nodes:r})}function z(e,t){for(const n of e)if(n.kind==="node")D(n.child,t[n.valueIndex]);else if(n.kind==="attr"){let s=n.template[0];for(let o=0;o<n.valueIndices.length;o++)s+=ie(t[n.valueIndices[o]]),s+=n.template[o+1];s!==n.last&&(n.last=s,s===""?n.element.removeAttribute(n.name):n.element.setAttribute(n.name,s))}else if(n.kind==="event"){const s=t[n.valueIndex];s!==n.current&&(n.current&&n.element.removeEventListener(n.name,n.current),s&&n.element.addEventListener(n.name,s),n.current=s)}else if(n.kind==="prop"){const s=t[n.valueIndex];s!==n.last&&(n.last=s,n.element[n.name]=s)}else if(n.kind==="bool"){const s=!!t[n.valueIndex];s!==n.last&&(n.last=s,s?n.element.setAttribute(n.name,""):n.element.removeAttribute(n.name))}}function D(e,t){if(t==null||t===!1){e.state&&($(e.state),e.state=null);return}if(Array.isArray(t)){Fe(e,t);return}if(Ae(t)){De(e,t);return}if(t instanceof Node){Le(e,t);return}ze(e,ie(t))}function Le(e,t){const n=e.state;n?.shape==="node"&&n.node===t||(n&&$(n),T(e,[t]),e.state={shape:"node",node:t})}function ze(e,t){const n=e.state;if(n?.shape==="text"){n.text!==t&&(n.node.textContent=t,n.text=t);return}n&&$(n);const s=document.createTextNode(t);T(e,[s]),e.state={shape:"text",node:s,text:t}}function De(e,t){const n=e.state;if(n?.shape==="template"&&n.strings===t.strings){z(n.parts,t.values);return}n&&$(n);const s=ne(t.strings),o=s.template.content.cloneNode(!0),i=s.buildParts(o),r=Array.from(o.childNodes);T(e,[o]),z(i,t.values),e.state={shape:"template",strings:t.strings,parts:i,nodes:r}}function Fe(e,t){const n=e.state;if(n?.shape==="array"){const o=Math.min(n.entries.length,t.length);for(let i=0;i<o;i++)D(n.entries[i],t[i]);if(t.length<n.entries.length){for(let i=t.length;i<n.entries.length;i++){const r=n.entries[i];r.state&&$(r.state),r.anchor.remove()}n.entries.length=t.length}else for(let i=n.entries.length;i<t.length;i++){const r=document.createTextNode("");T(e,[r]);const c={anchor:r,state:null};D(c,t[i]),n.entries.push(c)}return}n&&$(n);const s=[];for(const o of t){const i=document.createTextNode("");T(e,[i]);const r={anchor:i,state:null};D(r,o),s.push(r)}e.state={shape:"array",entries:s}}function T(e,t){const n=e.anchor.parentNode;if(n)for(const s of t)n.insertBefore(s,e.anchor)}function $(e){if(e.shape==="text"){e.node.remove();return}if(e.shape==="template"){for(const t of e.parts)t.kind==="node"&&t.child.state&&($(t.child.state),t.child.state=null);for(const t of e.nodes)t.parentNode&&t.parentNode.removeChild(t);return}if(e.shape==="node"){e.node.parentNode&&e.node.parentNode.removeChild(e.node);return}for(const t of e.entries)t.state&&$(t.state),t.anchor.remove()}function ie(e){return e==null||e===!1?"":String(e)}function re(e,t="short"){if(e===""||e===null||e===void 0)return"";const n=typeof e=="string"&&/^\d{4}-\d{2}$/.test(e)?`${e}-01T00:00:00`:e,s=n instanceof Date?n:new Date(n);if(Number.isNaN(s.getTime()))return String(e);try{switch(t){case"long":return s.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"});case"month":return s.toLocaleDateString(void 0,{year:"numeric",month:"long"});case"datetime":return s.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"});case"iso":return s.toISOString();default:return s.toLocaleDateString(void 0,{month:"short",day:"numeric"})}}catch{return String(e)}}async function ae(e){if(e==="")return!1;const t=globalThis.navigator?.clipboard;if(t?.writeText)try{return await t.writeText(e),!0}catch{}return Ue(e)}function Ue(e){const t=globalThis.document;if(!t?.body||typeof t.execCommand!="function")return!1;const n=t.createElement("textarea");n.value=e,n.setAttribute("readonly",""),n.setAttribute("aria-hidden","true"),n.style.position="fixed",n.style.insetInlineStart="-9999px",n.style.opacity="0",t.body.appendChild(n);const s=t.activeElement;n.select();let o=!1;try{o=t.execCommand("copy")}catch{o=!1}return n.remove(),s?.focus?.(),o}const We="data-os-mode";function F(e=typeof document<"u"?document.documentElement:null){return!!e&&e.getAttribute(We)==="mobile"}function Oe(e){return e.phone??F()?h`<os-select | |
| 1 | +var openStationApp_users=function(ze){"use strict";const jt="desktop-mode";function tt(){return window.wp?.i18n}function l(o,e=jt){return tt()?.__(o,e)??o}function x(o,...e){const t=tt()?.sprintf;if(t)return t(o,...e);let s=0;return o.replace(/%(?:(\d+)\$)?[sd]/g,(i,n)=>{const r=n?Number.parseInt(n,10)-1:s++;return String(e[r]??"")})}function h(o,...e){return{__wpdHtml:!0,strings:o,values:e}}function Bt(o){return!!o&&o.__wpdHtml===!0}const Kt="$$wpd$$",$=/\$\$wpd\$\$(\d+)\$\$/g,Vt="$$wpd-node$$",Yt=/^\$\$wpd-node\$\$(\d+)\$\$$/,Xt=new Set(["style","script","textarea","title"]);function Gt(o){let e="",t=!1,s=null,i=!1,n=null,r="",a=!1;for(let c=0;c<o.length;c++){const d=o[c];e+=d;for(let p=0;p<d.length;p++){const u=d[p];if(i){d.startsWith("-->",p)&&(i=!1,p+=2);continue}if(n!==null){u==="<"&&d[p+1]==="/"&&d.slice(p+2,p+2+n.length).toLowerCase()===n&&(p+=1+n.length,n=null,t=!0,a=!1,r="");continue}if(s!==null){u===s&&(s=null);continue}if(t){u==='"'||u==="'"?(s=u,a=!1):u===">"?(t=!1,a=!1,Xt.has(r)&&(n=r),r=""):a&&(/[a-zA-Z0-9-]/.test(u)?r+=u.toLowerCase():a=!1);continue}if(d.startsWith("<!--",p)){i=!0,p+=3;continue}const m=d[p+1]??"";u==="<"&&/[a-zA-Z/!]/.test(m)&&(t=!0,r="",a=/[a-zA-Z]/.test(m))}c<o.length-1&&(e+=t||i||n!==null?`${Kt}${c}$$`:`<!--${Vt}${c}$$-->`)}return e}const ot=new WeakMap;function st(o){const e=ot.get(o);if(e)return e;const t=document.createElement("template");t.innerHTML=Gt(o);const s=[],i=(a,c)=>{if(a.nodeType===Node.ELEMENT_NODE){const u=a;for(const m of Array.from(u.attributes)){const f=m.name,g=m.value,_=f[0];if($.test(g))if($.lastIndex=0,_==="@"){const v=$.exec(g);$.lastIndex=0,s.push({path:c,kind:"event",name:f.slice(1),valueIndex:v?Number(v[1]):0}),u.removeAttribute(f)}else if(_==="."){const v=$.exec(g);$.lastIndex=0,s.push({path:c,kind:"prop",name:f.slice(1),valueIndex:v?Number(v[1]):0}),u.removeAttribute(f)}else if(_==="?"){const v=$.exec(g);$.lastIndex=0,s.push({path:c,kind:"bool",name:f.slice(1),valueIndex:v?Number(v[1]):0}),u.removeAttribute(f)}else{const v=[],L=[];let A=0,T;for($.lastIndex=0;(T=$.exec(g))!==null;)v.push(g.slice(A,T.index)),L.push(Number(T[1])),A=T.index+T[0].length;v.push(g.slice(A)),s.push({path:c,kind:"attr",name:f,template:v,valueIndices:L}),u.setAttribute(f,"")}}}const d=Array.from(a.childNodes);let p=0;for(let u=0;u<d.length;u++){const m=d[u],f=u+p;if(m.nodeType===Node.COMMENT_NODE){const g=Yt.exec(m.data);if(g){const _=document.createTextNode("");m.parentNode.replaceChild(_,m),s.push({path:[...c,f],kind:"node",valueIndex:Number(g[1])})}continue}if(m.nodeType===Node.TEXT_NODE){const g=m.textContent||"";if(!$.test(g)){$.lastIndex=0;continue}$.lastIndex=0;const _=m.parentNode;let v=0,L;const A=[],T=[];for($.lastIndex=0;(L=$.exec(g))!==null;){L.index>v&&A.push(document.createTextNode(g.slice(v,L.index)));const C=document.createTextNode("");A.push(C),T.push({path:[...c,f+A.length-1],kind:"node",valueIndex:Number(L[1])}),v=L.index+L[0].length}v<g.length&&A.push(document.createTextNode(g.slice(v)));for(const C of A)_.insertBefore(C,m);_.removeChild(m),p+=A.length-1,s.push(...T)}else i(m,[...c,f])}};i(t.content,[]);const r={template:t,buildParts:a=>{const c=[];for(const d of s){let p=a;for(const u of d.path)p=p.childNodes[u];d.kind==="node"?c.push({kind:"node",valueIndex:d.valueIndex,child:{anchor:p,state:null}}):d.kind==="attr"?c.push({kind:"attr",element:p,name:d.name,template:d.template,valueIndices:d.valueIndices}):d.kind==="event"?c.push({kind:"event",valueIndex:d.valueIndex,element:p,name:d.name}):d.kind==="prop"?c.push({kind:"prop",valueIndex:d.valueIndex,element:p,name:d.name}):d.kind==="bool"&&c.push({kind:"bool",valueIndex:d.valueIndex,element:p,name:d.name})}return c}};return ot.set(o,r),r}const it=new WeakMap;function Zt(o,e){for(const t of o.nodes)if(t.parentNode!==e)return!1;return!0}function G(o,e){const t=it.get(e);if(t&&t.strings===o.strings&&Zt(t,e)){be(t.parts,o.values);return}const s=st(o.strings),i=s.template.content.cloneNode(!0),n=s.buildParts(i),r=Array.from(i.childNodes);for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(i),be(n,o.values),it.set(e,{strings:o.strings,parts:n,nodes:r})}function be(o,e){for(const t of o)if(t.kind==="node")ve(t.child,e[t.valueIndex]);else if(t.kind==="attr"){let s=t.template[0];for(let i=0;i<t.valueIndices.length;i++)s+=nt(e[t.valueIndices[i]]),s+=t.template[i+1];s!==t.last&&(t.last=s,s===""?t.element.removeAttribute(t.name):t.element.setAttribute(t.name,s))}else if(t.kind==="event"){const s=e[t.valueIndex];s!==t.current&&(t.current&&t.element.removeEventListener(t.name,t.current),s&&t.element.addEventListener(t.name,s),t.current=s)}else if(t.kind==="prop"){const s=e[t.valueIndex];s!==t.last&&(t.last=s,t.element[t.name]=s)}else if(t.kind==="bool"){const s=!!e[t.valueIndex];s!==t.last&&(t.last=s,s?t.element.setAttribute(t.name,""):t.element.removeAttribute(t.name))}}function ve(o,e){if(e==null||e===!1){o.state&&(M(o.state),o.state=null);return}if(Array.isArray(e)){to(o,e);return}if(Bt(e)){eo(o,e);return}if(e instanceof Node){Jt(o,e);return}Qt(o,nt(e))}function Jt(o,e){const t=o.state;t?.shape==="node"&&t.node===e||(t&&M(t),Z(o,[e]),o.state={shape:"node",node:e})}function Qt(o,e){const t=o.state;if(t?.shape==="text"){t.text!==e&&(t.node.textContent=e,t.text=e);return}t&&M(t);const s=document.createTextNode(e);Z(o,[s]),o.state={shape:"text",node:s,text:e}}function eo(o,e){const t=o.state;if(t?.shape==="template"&&t.strings===e.strings){be(t.parts,e.values);return}t&&M(t);const s=st(e.strings),i=s.template.content.cloneNode(!0),n=s.buildParts(i),r=Array.from(i.childNodes);Z(o,[i]),be(n,e.values),o.state={shape:"template",strings:e.strings,parts:n,nodes:r}}function to(o,e){const t=o.state;if(t?.shape==="array"){const i=Math.min(t.entries.length,e.length);for(let n=0;n<i;n++)ve(t.entries[n],e[n]);if(e.length<t.entries.length){for(let n=e.length;n<t.entries.length;n++){const r=t.entries[n];r.state&&M(r.state),r.anchor.remove()}t.entries.length=e.length}else for(let n=t.entries.length;n<e.length;n++){const r=document.createTextNode("");Z(o,[r]);const a={anchor:r,state:null};ve(a,e[n]),t.entries.push(a)}return}t&&M(t);const s=[];for(const i of e){const n=document.createTextNode("");Z(o,[n]);const r={anchor:n,state:null};ve(r,i),s.push(r)}o.state={shape:"array",entries:s}}function Z(o,e){const t=o.anchor.parentNode;if(t)for(const s of e)t.insertBefore(s,o.anchor)}function M(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&&(M(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&&M(e.state),e.anchor.remove()}function nt(o){return o==null||o===!1?"":String(o)}function rt(o,e="short"){if(o===""||o===null||o===void 0)return"";const t=typeof o=="string"&&/^\d{4}-\d{2}$/.test(o)?`${o}-01T00:00:00`:o,s=t instanceof Date?t:new Date(t);if(Number.isNaN(s.getTime()))return String(o);try{switch(e){case"long":return s.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"});case"month":return s.toLocaleDateString(void 0,{year:"numeric",month:"long"});case"datetime":return s.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"});case"iso":return s.toISOString();default:return s.toLocaleDateString(void 0,{month:"short",day:"numeric"})}}catch{return String(o)}}async function at(o){if(o==="")return!1;const e=globalThis.navigator?.clipboard;if(e?.writeText)try{return await e.writeText(o),!0}catch{}return oo(o)}function oo(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 i=!1;try{i=e.execCommand("copy")}catch{i=!1}return t.remove(),s?.focus?.(),i}const so="data-os-mode";function _e(o=typeof document<"u"?document.documentElement:null){return!!o&&o.getAttribute(so)==="mobile"}function io(o){return o.phone??_e()?h`<os-select | |
| 2 | 2 | class="os-app-list__status" |
| 3 | - os-bind=${e.bind} | |
| 4 | - os-action=${e.action} | |
| 5 | - value=${e.value} | |
| 6 | - aria-label=${e.label} | |
| 7 | - >${e.segments.map(n=>h`<os-option value=${n.value}>${n.label}</os-option>`)}</os-select>`:h`<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=>h`<os-option .value=${t.value}>${t.label}</os-option>`)}</os-select>`:h`<os-segmented | |
| 8 | 8 | class="os-app-list__status" |
| 9 | - os-bind=${e.bind} | |
| 10 | - os-action=${e.action} | |
| 11 | - value=${e.value} | |
| 12 | - label=${e.label} | |
| 13 | - >${e.segments.map(n=>h`<os-segment value=${n.value}>${n.label}</os-segment>`)}</os-segmented>`}function je(e){const t=Math.max(1,e.page),n=Math.max(0,e.pages),s=Number(e.perPage)||20,o=e.pageAction??"page",i=e.perPageOptions??[10,20,50,100];return h`<footer class="os-app-list__pager"> | |
| 14 | - <div class="os-app-list__pager-meta"> | |
| 15 | - <span>${e.summary}</span> | |
| 16 | - </div> | |
| 17 | - <div class="os-app-list__pager-nav"> | |
| 18 | - <os-button | |
| 19 | - variant="ghost" | |
| 20 | - os-action=${o} | |
| 21 | - os-arg-page=${t-1} | |
| 22 | - ?disabled=${t<=1} | |
| 9 | + os-bind=${o.bind} | |
| 10 | + os-action=${o.action} | |
| 11 | + value=${o.value} | |
| 12 | + label=${o.label} | |
| 13 | + >${o.segments.map(t=>h`<os-segment value=${t.value}>${t.label}</os-segment>`)}</os-segmented>`}function no(o,e=null){const t=e??(typeof document<"u"?document.documentElement:null);if(!!t&&_e(t)){o.hasAttribute("stacked")||o.setAttribute("stacked","");const n=o.getAttribute("sticky-columns");return n!==null&&(o.setAttribute("data-os-sticky-columns",n),o.removeAttribute("sticky-columns")),!0}o.hasAttribute("stacked")&&o.removeAttribute("stacked");const i=o.getAttribute("data-os-sticky-columns");return i!==null&&(o.setAttribute("sticky-columns",i),o.removeAttribute("data-os-sticky-columns")),!1}function lt(o){return Array.from(o.selection??[],String)}function ro(){let o=null,e=!1,t=null,s=null;return{invalidateColumns(){o=null},invalidateData(){s=null},sync(i){const n={phone:!1,columnsChanged:!1,dataChanged:!1,selectionChanged:!1},r=i.table;if(!r)return n;const a=i.rowId??(d=>d.id),c=no(r);if(n.phone=c,c!==o&&(o=c,r.columns=i.columns(c),n.columnsChanged=!0),e||(e=!0,i.wire?.(r)),i.listKey!==t&&(t=i.listKey,lt(r).length>0&&(r.clearSelection(),n.selectionChanged=!0,i.onSelection?.([]))),i.fingerprint!==s){s=i.fingerprint,r.data=i.rows,n.dataChanged=!0;const d=new Set(i.rows.map(m=>String(a(m)))),p=lt(r),u=p.filter(m=>d.has(m));u.length!==p.length&&(r.selection=u,n.selectionChanged=!0,i.onSelection?.(u))}return n}}}function ao(o,e){const t=e.local??{},s={id:o,hasLocal:r=>Object.prototype.hasOwnProperty.call(t,r),runLocal:(r,a,c,d)=>{const p=t[r];if(!p)return a;const u={...a},m=p(u,c,d);return m===void 0?u:m},render:r=>{G(e.view(r),r.root),e.updated?.(r)},mounted:r=>e.mounted?.(r)},{placeholder:i}=e;i&&(s.placeholder=r=>i(r));const n=window;return(n.openStationApps??(n.openStationApps={}))[o]=s,s}class lo{constructor(){this.data=null,this.loading=!1,this.error=!1,this.active=!1,this.previous=null,this.request=null,this.disposed=!1}update(e){const t=e.state.tab==="activity",s=t&&(!this.active||this.previous!==e.data);this.active=t,this.previous=e.data,s&&this.load(e)}async load(e){if(this.disposed||this.loading)return;const t=new AbortController;this.request=t,this.loading=!0,this.error=!1,e.repaint();try{const s=await e.fetch("/desktop-mode/v1/users/activity-summary",{signal:t.signal});if(!s.ok)throw new Error("Activity summary unavailable");const i=await s.json();t.signal.aborted||(this.data=i)}catch{t.signal.aborted||(this.error=!0)}finally{this.loading=!1,this.disposed||e.repaint()}}dispose(){this.disposed=!0,this.request?.abort()}}class co{constructor(){this.data=null,this.loading=!1,this.error=!1,this.active=!1,this.previous=null,this.request=null,this.disposed=!1}update(e){const t=e.state.tab==="roles",s=t&&(!this.active||this.previous!==e.data);this.active=t,this.previous=e.data,s&&this.load(e)}async load(e){if(this.disposed||this.loading)return;const t=new AbortController;this.request=t,this.loading=!0,this.error=!1,e.repaint();try{const s=await e.fetch("/desktop-mode/v1/users/roles-summary",{signal:t.signal});if(!s.ok)throw new Error("Role summary unavailable");const i=await s.json();t.signal.aborted||(this.data=i)}catch{t.signal.aborted||(this.error=!0)}finally{this.loading=!1,this.disposed||e.repaint()}}dispose(){this.disposed=!0,this.request?.abort()}}class uo{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.restarting=!1}reconcile(e){this.ctx=e;const{state:t,data:s}=e,i=JSON.stringify([t.search,t.role,t.orderby,t.order,t.perPage]);if(i!==this.key&&(this.key=i,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)if(this.lastData=s,s.list.error)this.error=!0;else if(s.list.page>1&&s.list.page!==this.expected)this.restarting||(this.restarting=!0,queueMicrotask(()=>{this.disposed||e.dispatch("page",{page:1}).catch(()=>{this.error=!0}).finally(()=>{this.restarting=!1,this.disposed||e.repaint()})}));else{const n=s.list.page===1?s.list.items:[...this.items,...s.list.items];this.items=Array.from(new Map(n.map(r=>[r.id,r])).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)){this.pending=!0,this.error=!1,this.expected=this.page+1,e.repaint();try{const t=this.expected;(!await e.dispatch("page",{page:t})||e.data?.list.error||this.page!==t||!this.hasMore&&this.items.length<e.data.list.total)&&(this.error=!0)}catch{this.error=!0}finally{this.pending=!1,this.expected=0,this.sentinel=null,this.disposed||e.repaint()}}}tail(){let e=this.items.length?l("You’re all caught up."):"";return this.pending?e=l("Loading more…"):this.hasMore&&(e=h`<os-button variant="ghost" @click=${()=>void this.more()}>${this.error?l("Could not load more. Retry"):l("Load more people")}</os-button>`),h`<div class="os-people__continuation" data-users-feed-end role="status">${e}</div>`}observe(e){const t=e.querySelector(".os-people__cards [data-users-feed-end]");t!==this.sentinel&&(this.observer?.disconnect(),this.sentinel=t,!(!t||typeof IntersectionObserver>"u")&&(this.observer=new IntersectionObserver(s=>{s.some(i=>i.isIntersecting)&&!this.error&&this.more()},{root:e.querySelector(".os-people__cards"),rootMargin:"0px 0px 240px 0px"}),this.observer.observe(t)))}dispose(){this.disposed=!0,this.observer?.disconnect()}}const W=class W 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(ct)}connectedCallback(){this._adoptStyles(),this.requestUpdate()}attributeChangedCallback(e,t,s){if(t===s)return;const i=po(e);this._propValues[i]=s,this.requestUpdate()}get classNames(){return Array.from(this.classList)}set classNames(e){if(e==null){this.removeAttribute("class");return}const s=(Array.isArray(e)?e:String(e).split(/\s+/)).map(i=>String(i).trim()).filter(i=>i!=="");this.className=s.join(" ")}requestUpdate(){this._scheduleRender()}emit(e,t){return this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}_installPropAccessors(){const e=this.constructor;for(const t of e.props){if(Object.getOwnPropertyDescriptor(this,t))continue;const s=ct(t);Object.defineProperty(this,t,{get:()=>t in this._propValues?this._propValues[t]:this.getAttribute(s),set:i=>{let n;i==null||i===!1?n=null:i===!0?n="":n=String(i),this._propValues[t]=n,n===null?this.removeAttribute(s):this.setAttribute(s,n),this.requestUpdate()},enumerable:!0,configurable:!0})}}_scheduleRender(){this._renderScheduled||!this.isConnected||(this._renderScheduled=!0,queueMicrotask(()=>{this._renderScheduled=!1,this.isConnected&&G(this.render(),this._renderRoot)}))}_adoptStyles(){const e=this.constructor;if(e.styles.length!==0)if(e.shadow&&this.shadowRoot){const t=e.styles.map(s=>s.sheet).filter(s=>s!==null);if(this.shadowRoot.adoptedStyleSheets=t,t.length!==e.styles.length){for(const s of e.styles)if(!s.sheet){const i=document.createElement("style");i.textContent=s.cssText,this.shadowRoot.appendChild(i)}}}else this._adoptLightStyles(e)}_adoptLightStyles(e){if(!W._lightStylesAdopted.has(e)){W._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)}}}};W.props=[],W.styles=[],W.shadow=!0,W._lightStylesAdopted=new WeakSet;let w=W;function S(o,e){customElements.get(o)||customElements.define(o,e)}function ct(o){return o.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function po(o){return o.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}const ho=(()=>{try{return typeof new CSSStyleSheet().replaceSync=="function"}catch{return!1}})();function b(o,...e){let t=o[0];for(let s=1;s<o.length;s++){const i=e[s-1];if(typeof i=="string"||typeof i=="number")t+=String(i);else if(i&&i.__wpdCss)t+=i.cssText;else throw new TypeError("[os-ui] css`` interpolations must be strings, numbers, or other css`` results. Got: "+typeof i);t+=o[s]}if(ho){const s=new CSSStyleSheet;return s.replaceSync(t),{__wpdCss:!0,sheet:s,cssText:t}}return{__wpdCss:!0,sheet:null,cssText:t}}function mo(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 fo=b`: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}}`,dt={xs:20,sm:24,md:40,lg:64,xl:96},ut=new Set(["online","inactive","offline"]),oe=class oe extends w{constructor(){super(...arguments),this._presenceHandler=null,this._imgFailed=!1,this._onPointerMove=null,this._onPointerEnter=null,this._onPointerLeave=null,this._tiltRaf=0,this._pendingTiltX="0deg",this._pendingTiltY="0deg",this._pendingGlareX="50%",this._pendingGlareY="50%"}connectedCallback(){super.connectedCallback(),this._maybeAttachPresenceListener(),this._attachHoverEffect()}disconnectedCallback(){this._presenceHandler&&(document.removeEventListener("os-presence-changed",this._presenceHandler),this._presenceHandler=null),this._detachHoverEffect()}attributeChangedCallback(e,t,s){super.attributeChangedCallback(e,t,s),e==="src"&&(this._imgFailed=!1),(e==="user-id"||e==="presence")&&this._maybeAttachPresenceListener()}render(){const e=this._attr("src"),t=this._attr("name")||"",s=this._attr("alt"),i=s!==null?s:t,n=this._attr("size"),r=this._resolveSize(n),a=this._presenceForRender(),c=this._attr("clickable")!==null;this.style.setProperty("--os-ui-avatar-size",`${r}px`);const d=e&&!this._imgFailed?"":this._initialsBg(t),p=e&&!this._imgFailed?h`<img | |
| 14 | + src=${e} | |
| 15 | + alt=${i} | |
| 16 | + @error=${()=>this._onImgError()} | |
| 17 | + loading="lazy" | |
| 18 | + />`:this._initials(t),u=a?h`<span | |
| 19 | + class=${`os-avatar__dot os-avatar__dot--${a}`} | |
| 20 | + aria-label=${this._presenceLabel(a)} | |
| 21 | + ></span>`:h``;return c?h` | |
| 22 | + <button | |
| 23 | + type="button" | |
| 24 | + class="os-avatar__tile" | |
| 25 | + aria-label=${i||"User"} | |
| 26 | + style=${d?`background:${d};`:""} | |
| 27 | + @click=${m=>this._onClick(m)} | |
| 28 | + >${p}</button> | |
| 29 | + ${u} | |
| 30 | + `:h` | |
| 31 | + <div | |
| 32 | + class="os-avatar__tile" | |
| 33 | + role="img" | |
| 34 | + aria-label=${i||"User"} | |
| 35 | + style=${d?`background:${d};`:""} | |
| 36 | + >${p}</div> | |
| 37 | + ${u} | |
| 38 | + `}_attr(e){return this.getAttribute(e)}_resolveSize(e){if(!e)return 32;if(e in dt)return dt[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=mo(e);return`linear-gradient(135deg, hsl(${t} 62% 55%), hsl(${(t+24)%360} 58% 42%))`}_presenceForRender(){const e=this._attr("presence");return e&&ut.has(e)?e:null}_presenceLabel(e){switch(e){case"online":return"Online";case"inactive":return"Inactive";case"offline":return"Offline"}}_onImgError(){this._imgFailed=!0,this.requestUpdate()}_onClick(e){const t=this._attr("user-id"),s={userId:t!==null&&Number(t)||null,originalEvent:e};this.emit("os-avatar-click",s)}_attachHoverEffect(){typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches||(this._onPointerEnter=()=>{this.style.setProperty("--os-ui-avatar-hover","1")},this._onPointerLeave=()=>{this.style.setProperty("--os-ui-avatar-hover","0"),this._pendingTiltX="0deg",this._pendingTiltY="0deg",this._pendingGlareX="50%",this._pendingGlareY="50%",this._flushTilt()},this._onPointerMove=t=>{const s=this.getBoundingClientRect();if(s.width===0||s.height===0)return;const i=(t.clientX-s.left)/s.width-.5,n=(t.clientY-s.top)/s.height-.5,r=14;this._pendingTiltY=`${(i*r).toFixed(2)}deg`,this._pendingTiltX=`${(-n*r).toFixed(2)}deg`;const a=Math.max(0,Math.min(100,(i+.5)*100)),c=Math.max(0,Math.min(100,(n+.5)*100));this._pendingGlareX=`${a.toFixed(1)}%`,this._pendingGlareY=`${c.toFixed(1)}%`,this._tiltRaf||(this._tiltRaf=requestAnimationFrame(()=>this._flushTilt()))},this.addEventListener("pointerenter",this._onPointerEnter),this.addEventListener("pointerleave",this._onPointerLeave),this.addEventListener("pointermove",this._onPointerMove))}_flushTilt(){this._tiltRaf=0,this.style.setProperty("--os-ui-avatar-tilt-x",this._pendingTiltX),this.style.setProperty("--os-ui-avatar-tilt-y",this._pendingTiltY),this.style.setProperty("--os-ui-avatar-glare-x",this._pendingGlareX),this.style.setProperty("--os-ui-avatar-glare-y",this._pendingGlareY)}_detachHoverEffect(){this._onPointerMove&&(this.removeEventListener("pointermove",this._onPointerMove),this._onPointerMove=null),this._onPointerEnter&&(this.removeEventListener("pointerenter",this._onPointerEnter),this._onPointerEnter=null),this._onPointerLeave&&(this.removeEventListener("pointerleave",this._onPointerLeave),this._onPointerLeave=null),this._tiltRaf&&(cancelAnimationFrame(this._tiltRaf),this._tiltRaf=0)}_maybeAttachPresenceListener(){const e=this._attr("user-id"),t=this._attr("presence"),s=!!e&&!t;s&&!this._presenceHandler?(this._presenceHandler=i=>{const n=i.detail;n&&String(n.userId)===String(e)&&n.newStatus&&ut.has(n.newStatus)&&this.setAttribute("presence",n.newStatus)},document.addEventListener("os-presence-changed",this._presenceHandler)):!s&&this._presenceHandler&&(document.removeEventListener("os-presence-changed",this._presenceHandler),this._presenceHandler=null)}};oe.props=["src","alt","name","size","presence","userId","clickable"],oe.styles=[fo],oe.help=void 0;let Ee=oe;S("os-avatar",Ee);const go=b`:host{--_border:var( --os-ui-stat-border,var( --os-ui-border,#dcdcde ) );--_bg:var( --os-ui-stat-bg,transparent );--_value-color:var( --os-ui-stat-value-color,var( --wp-admin-theme-color,#2271b1 ) );--_value-size:var( --os-ui-stat-value-size,20px );--_label-color:var( --os-ui-stat-label-color,var( --os-ui-fg-muted,#646970 ) );display:flex;flex-direction:column;gap:2px;padding:var( --os-ui-stat-padding,10px 12px );border:1px solid var( --_border );border-radius:var( --os-ui-stat-radius,8px );background:var( --_bg );min-inline-size:0}:host( [ hidden ] ){display:none}.value{font-size:var( --_value-size );font-weight:700;line-height:1.1;color:var( --_value-color );font-variant-numeric:tabular-nums}.label{display:inline-flex;align-items:center;gap:6px;font-size:11px;letter-spacing:0.05em;text-transform:uppercase;color:var( --_label-color )}.caption{font-size:11px;color:var( --_label-color )}.swatch{display:inline-block;inline-size:10px;block-size:10px;border-radius:3px;flex:none;background:var( --os-app-tone,var( --os-ui-fg-muted,#646970 ) )}`,se=class se extends w{render(){const e=this,t=e.caption||"";return h` | |
| 39 | + <span class="value" part="value">${e.value||""}</span> | |
| 40 | + <span class="label" part="label"> | |
| 41 | + ${this.hasAttribute("swatch")?h`<i class="swatch" aria-hidden="true"></i>`:""} | |
| 42 | + ${e.label||""} | |
| 43 | + </span> | |
| 44 | + ${t?h`<span class="caption" part="caption">${t}</span>`:""} | |
| 45 | + `}};se.props=["value","label","caption","swatch"],se.styles=[go],se.help=void 0;let Re=se;S("os-stat",Re);const I=b`: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 ) )}`,bo=b` .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%}}`,Le=b` .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%}}`,pt=b` .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}}`,ht=b` .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}}`,mt=b` .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}}`,ft=b` .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%}}`,gt=b` .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}}`,vo=b` 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}}`,Te=b` 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}}`,bt=b` @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}}`;b` ${I} ${bo} ${Le} ${pt} ${ht} ${mt} ${ft} ${gt} ${vo} ${Te} ${bt} `;const _o=b` ${I} ${Te}: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}`,ie=class ie extends w{render(){const e=this.checked!==null,t=this.disabled!==null,s=this.label||"",i=this.value;return h` | |
| 46 | + <label> | |
| 47 | + <input | |
| 48 | + type="checkbox" | |
| 49 | + .checked=${e} | |
| 50 | + ?disabled=${t} | |
| 51 | + .value=${i??""} | |
| 52 | + @change=${n=>this._onChange(n)} | |
| 53 | + /> | |
| 54 | + <span class="os-checkbox__label">${s}</span> | |
| 55 | + </label> | |
| 56 | + `}_onChange(e){const s=e.target.checked;s?this.setAttribute("checked",""):this.removeAttribute("checked"),this.emit("os-checkbox-change",{checked:s,value:this.value})}};ie.props=["checked","value","label","disabled"],ie.styles=[_o],ie.help=void 0;let Ne=ie;S("os-checkbox",Ne);const yo=b` ${I} ${Le} ${pt} ${ht} ${mt} ${bt}: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 )}}`,ne=class ne extends w{static get observedAttributes(){return[...super.observedAttributes,"aria-label"]}render(){const e=this.disabled!==null,t=this.busy!==null,s=this.type||"button",i=this.getAttribute("aria-label")||"";return h` | |
| 57 | + <button | |
| 58 | + part="button" | |
| 59 | + class="os-holo-edge os-holo-sheen" | |
| 60 | + type=${s} | |
| 61 | + ?disabled=${e||t} | |
| 62 | + aria-busy=${t?"true":"false"} | |
| 63 | + aria-label=${i} | |
| 23 | 64 | > |
| 24 | - <span class="dashicons dashicons-arrow-left-alt2" aria-hidden="true"></span> | |
| 25 | - ${e.labels.previous} | |
| 26 | - </os-button> | |
| 27 | - <os-button | |
| 28 | - variant="ghost" | |
| 29 | - os-action=${o} | |
| 30 | - os-arg-page=${t+1} | |
| 31 | - ?disabled=${t>=n} | |
| 65 | + ${t?h`<span class="os-button__spinner" aria-hidden="true"></span>`:""} | |
| 66 | + <slot></slot> | |
| 67 | + <!-- | |
| 68 | + The two motion layers. Elements rather than | |
| 69 | + pseudo-elements because the sheen and the hairline | |
| 70 | + have already taken this button's ::before and | |
| 71 | + ::after — see the pseudo-element budget note in | |
| 72 | + src/ui/holo.ts. Both are inert and aria-hidden. | |
| 73 | + --> | |
| 74 | + <span class="os-holo-glint" aria-hidden="true"></span> | |
| 75 | + <span class="os-holo-ring" aria-hidden="true"></span> | |
| 76 | + </button> | |
| 77 | + `}};ne.props=["variant","disabled","type","busy","fill-cell"],ne.styles=[yo],ne.help=void 0;let Pe=ne;S("os-button",Pe);const xo=b` ${I} ${gt}:host{display:none;position:fixed;min-width:180px;background-color:var( --os-ui-context-menu-bg,#1d2327 );background-image:var( --os-ui-menu-bg-image,none );background-repeat:var( --os-ui-menu-bg-image-repeat,repeat );background-size:var( --os-ui-menu-bg-image-size,auto );background-position:var( --os-ui-menu-bg-image-position,center );color:var( --os-ui-context-menu-fg,var( --os-fg,#fff ) );border:1px solid var( --os-ui-border,rgba( 255,255,255,0.08 ) );border-radius:8px;box-shadow:0 8px 24px rgba( 0,0,0,0.45 );padding:4px;font-size:13px;line-height:1.3;z-index:9999}:host( [ open ] ){display:block;animation:os-holo-enter var( --_holo-t-fast ) var( --_holo-ease );transform-origin:top left;box-sizing:border-box;max-block-size:calc( 100vh - 16px );max-block-size:calc( 100dvh - 16px );overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}:host( [ open ]:dir( rtl ) ){transform-origin:top right}@media ( prefers-reduced-motion:reduce ){:host( [ open ] ){animation:none}}`,ko=b`:host{display:flex;align-items:center;gap:10px;width:100%;padding:8px 10px;border:0;background:transparent;color:inherit;text-align:start;cursor:pointer;border-radius:4px;box-sizing:border-box;user-select:none}:host(:hover ),:host( [ active ] ){background:var( --os-ui-hover,rgba( 255,255,255,0.1 ) );outline:none}:host( [ disabled ] ){opacity:0.45;cursor:not-allowed}:host( [ danger ] ){color:var( --os-ui-danger-hover,#ff8a8a )}:host( [ danger ]:hover ){background:var( --os-ui-badge-danger-bg,rgba( 255,90,90,0.18 ) )}:host( [ heading ] ){padding:8px 10px 4px;font-size:10px;font-weight:700;letter-spacing:0.06em;text-transform:uppercase;color:var( --os-ui-context-menu-fg-muted,var( --os-ui-fg-muted,rgba( 255,255,255,0.5 ) ) );pointer-events:none}.icon{display:inline-flex;align-items:center;justify-content:center;font-size:18px;width:20px;height:20px}.label{flex:1}.chevron{margin-inline-start:auto;padding-inline-start:8px;font-size:16px;line-height:1;opacity:0.7}.check{display:inline-flex;align-items:center;justify-content:center;width:14px;font-size:13px;line-height:1;opacity:0.95}`,re=class re extends w{render(){return h` | |
| 78 | + <slot></slot> | |
| 79 | + `}connectedCallback(){super.connectedCallback(),this.setAttribute("role","menu")}};re.props=["open"],re.styles=[xo],re.help=void 0;let Me=re;S("os-context-menu",Me);const ae=class ae extends w{constructor(){super(...arguments),this._onActivate=e=>{if(this.hasAttribute("disabled")||this.hasAttribute("heading"))return;const t=e.target;t&&t!==this&&t.closest("os-context-menu-option")!==this||this.emit("os-context-menu-pick",{id:this.dataset.menuItemId??this.id??"",value:this.getAttribute("value")??""})},this._onKey=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this._onActivate(e))}}connectedCallback(){super.connectedCallback();const e=this.hasAttribute("heading");this.setAttribute("role",e?"presentation":"menuitem"),e||this.setAttribute("tabindex","0"),this.addEventListener("click",this._onActivate),this.addEventListener("keydown",this._onKey)}disconnectedCallback(){this.removeEventListener("click",this._onActivate),this.removeEventListener("keydown",this._onKey)}render(){const e=this.getAttribute("icon"),t=this.hasAttribute("has-children"),s=this.hasAttribute("checked");return h` | |
| 80 | + ${s?h`<span class="check" aria-hidden="true">✓</span>`:h``} | |
| 81 | + ${e?h`<span class="icon dashicons ${e}" aria-hidden="true"></span>`:h``} | |
| 82 | + <span class="label"><slot></slot></span> | |
| 83 | + ${t?h`<span class="chevron" aria-hidden="true">›</span>`:h``} | |
| 84 | + `}};ae.props=["value","icon","disabled","danger","heading","has-children","checked"],ae.styles=[ko],ae.help={title:"Context menu option",summary:"Single row inside <os-context-menu>. Use `icon` for a leading dashicon, `danger` for destructive items, `heading` for a non-interactive section header, `has-children` to render a trailing chevron.",status:"stable",props:[{name:"value",type:"string",description:"Forwarded as `detail.value` on activation."},{name:"icon",type:"string",description:"Dashicon class (e.g. `dashicons-trash`)."},{name:"disabled",type:"boolean attribute",description:"Renders the option dimmed; clicks are ignored."},{name:"danger",type:"boolean attribute",description:"Destructive styling — red text, red hover."},{name:"heading",type:"boolean attribute",description:"Non-interactive section header. Ignores clicks."},{name:"has-children",type:"boolean attribute",description:"Renders a trailing chevron to suggest a submenu."},{name:"checked",type:"boolean attribute",description:"Renders a leading check mark — for radio-style picks inside a submenu (e.g. the active Sort By order)."}],slots:[{name:"(default)",description:"Visible label."}],events:[{name:"os-context-menu-pick",description:"Bubbled on click / Enter for non-heading non-disabled options. Detail: `{ id, value }`."}],example:h` | |
| 85 | + <os-context-menu open style="position: relative; z-index: 0"> | |
| 86 | + <os-context-menu-option heading>Every variant</os-context-menu-option> | |
| 87 | + <os-context-menu-option value="plain">Plain</os-context-menu-option> | |
| 88 | + <os-context-menu-option value="icon" icon="dashicons-admin-page"> | |
| 89 | + With an icon | |
| 90 | + </os-context-menu-option> | |
| 91 | + <os-context-menu-option value="checked" checked> | |
| 92 | + Checked | |
| 93 | + </os-context-menu-option> | |
| 94 | + <os-context-menu-option value="children" has-children> | |
| 95 | + With a submenu | |
| 96 | + </os-context-menu-option> | |
| 97 | + <os-context-menu-option value="off" disabled>Disabled</os-context-menu-option> | |
| 98 | + <os-context-menu-option value="del" danger icon="dashicons-trash"> | |
| 99 | + Danger | |
| 100 | + </os-context-menu-option> | |
| 101 | + </os-context-menu> | |
| 102 | + `};let Ie=ae;S("os-context-menu-option",Ie);function wo(o,e){o.style.visibility="hidden";const t=()=>{o.isConnected&&(e(o.getBoundingClientRect()),o.style.visibility="")};typeof requestAnimationFrame=="function"?requestAnimationFrame(t):t()}const $o=b`:host{display:inline-block}:host([hidden]){display:none}.panel{position:fixed;inset:auto;margin:0;padding:0;border:0;background:transparent;overflow:visible;max-inline-size:calc(100vw - 16px)}.panel[hidden]{display:none}os-context-menu{position:relative;inset:auto;max-inline-size:calc(100vw - 16px)}os-button::part(button){min-block-size:30px}.chevron{display:inline-block;inline-size:5px;block-size:5px;border-inline-end:1.5px solid currentColor;border-block-end:1.5px solid currentColor;transform:translateY(-2px) rotate(45deg);margin-inline-start:5px;vertical-align:middle}:host(:dir(rtl)) .chevron{transform:translateY(-2px) rotate(-45deg)}`,le=class le extends w{constructor(){super(...arguments),this.opened=!1,this.listeners=null,this.onKey=e=>{if(e.key==="Escape"||e.key==="Tab"){e.key==="Escape"&&(e.preventDefault(),e.stopPropagation()),this.close();return}if(!["ArrowDown","ArrowUp","Home","End"].includes(e.key))return;e.preventDefault(),e.stopPropagation();const t=this.options();let i=t.indexOf(this.ownerDocument.activeElement)+(e.key==="ArrowUp"?-1:1);e.key==="Home"&&(i=0),e.key==="End"&&(i=t.length-1),t[(i+t.length)%t.length]?.focus()}}get panel(){return this.shadowRoot?.querySelector(".panel")??null}get trigger(){return this.shadowRoot?.querySelector("os-button")?.shadowRoot?.querySelector("button")??null}options(){return Array.from(this.querySelectorAll("os-context-menu-option:not([heading]):not([disabled])"))}render(){return h`<os-button variant="ghost" @click=${()=>this.opened?this.close():this.show()} @keydown=${e=>{(e.key==="ArrowDown"||e.key==="ArrowUp")&&(e.preventDefault(),this.show(e.key==="ArrowUp"))}}>${this.getAttribute("text")||"Actions"} <span class="chevron" aria-hidden="true"></span></os-button> | |
| 103 | + <div class="panel" popover="manual" hidden><os-context-menu open aria-label=${this.getAttribute("label")||"Actions"}><slot></slot></os-context-menu></div>`}requestUpdate(){this.opened&&this.close(!1),super.requestUpdate(),queueMicrotask(()=>queueMicrotask(()=>this.syncTrigger()))}syncTrigger(){this.trigger?.setAttribute("aria-label",this.getAttribute("label")||"Actions"),this.trigger?.setAttribute("aria-haspopup","menu"),this.trigger?.setAttribute("aria-expanded",String(this.opened))}show(e=!1){if(this.opened||!this.panel)return;this.opened=!0,this.panel.hidden=!1,this.panel.showPopover?.(),this.syncTrigger();const t=this.panel;wo(t,i=>{if(!this.opened)return;const n=this.getBoundingClientRect(),r=getComputedStyle(this).direction==="rtl";t.style.left=`${Math.max(8,Math.min(r?n.left:n.right-i.width,window.innerWidth-i.width-8))}px`,t.style.top=`${Math.max(8,Math.min(n.bottom+5+i.height<=window.innerHeight-8?n.bottom+5:n.top-i.height-5,window.innerHeight-i.height-8))}px`;const a=this.options();a[e?a.length-1:0]?.focus({preventScroll:!0})}),this.listeners=new AbortController;const{signal:s}=this.listeners;document.addEventListener("pointerdown",i=>{i.composedPath().includes(this)||this.close(!1)},{capture:!0,signal:s}),document.addEventListener("focusin",i=>{i.composedPath().includes(this)||this.close(!1)},{signal:s}),document.addEventListener("scroll",i=>{i.composedPath().includes(t)||this.close(!1)},{capture:!0,signal:s}),window.addEventListener("resize",()=>this.close(!1),{signal:s}),this.addEventListener("keydown",this.onKey,{signal:s}),this.addEventListener("os-context-menu-pick",()=>this.close(),{capture:!0,signal:s})}close(e=!0){this.opened&&(this.opened=!1,this.listeners?.abort(),this.listeners=null,this.panel?.isConnected&&this.panel.hidePopover?.(),this.panel&&(this.panel.hidden=!0),this.syncTrigger(),e&&this.isConnected&&this.trigger?.focus({preventScroll:!0}))}disconnectedCallback(){this.close(!1)}};le.props=["label","text"],le.styles=[$o],le.help=void 0;let qe=le;S("os-action-menu",qe);const De=new Map;async function So(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=De.get(t);if(s!==void 0)return s instanceof Promise,s;const i=new URL(o,window.location.href);i.searchParams.set("d","blank");const n=new Promise(r=>{const a=new Image;a.crossOrigin="anonymous",a.onload=()=>{try{const c=document.createElement("canvas");c.width=1,c.height=1;const d=c.getContext("2d",{willReadFrequently:!0});if(!d){r(o);return}d.drawImage(a,0,0,1,1);const p=d.getImageData(0,0,1,1).data;r(p[3]===0?null:o)}catch{r(o)}},a.onerror=()=>r(null),a.src=i.toString()}).then(r=>(De.set(t,r),r));return De.set(t,n),n}function vt(o){return o?.["48"]??o?.["96"]??o?.["24"]??""}function _t(o,e){e&&So(e).then(t=>{o.isConnected&&(t?o.setAttribute("src",t):o.removeAttribute("src"))})}function Ao(o){const e=document.createElement("button");e.type="button",e.setAttribute("data-noclick",""),e.setAttribute("aria-label",o.label),e.title=o.label;const t=o.variant==="danger",s=t?"var( --os-ui-danger, #d63638 )":"var( --os-ui-fg-muted, #50575e )",i=t?"var( --os-ui-danger, #d63638 )":"var( --os-ui-border, #c3c4c7 )",n="var( --os-ui-surface, #fff )",r=()=>{e.style.background=n,e.style.color=s,e.style.borderColor=i},a=()=>{t?(e.style.background="var( --os-ui-danger, #d63638 )",e.style.color="var( --os-ui-fg-on-accent, #fff )",e.style.borderColor="var( --os-ui-danger, #d63638 )"):(e.style.background="var( --os-ui-hover, #f0f0f1 )",e.style.color="var( --os-ui-fg, #1d2327 )",e.style.borderColor="var( --os-ui-border-strong, #8c8f94 )")},c=o.labelled===!0;if(e.style.cssText=["display: inline-flex","align-items: center","justify-content: center",c?"gap: 6px":"",c?"flex: 0 0 auto":"flex: 0 0 30px",c?"width: auto":"width: 30px",c?"height: 36px":"height: 30px",c?"padding: 0 12px":"padding: 0",c?"font-size: 13px":"",c?"font-weight: 600":"","margin: 0","border: 1px solid "+i,"border-radius: 6px","background: "+n,"color: "+s,"cursor: pointer","box-sizing: border-box","line-height: 1","font: inherit","transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease"].join(";"),e.addEventListener("mouseenter",a),e.addEventListener("mouseleave",r),e.addEventListener("focus",a),e.addEventListener("blur",r),e.appendChild(o.glyph),c){const d=document.createElement("span");d.textContent=o.label,d.style.cssText="white-space: nowrap; line-height: 1;",e.appendChild(d)}return e.addEventListener("click",d=>{d.stopPropagation(),o.onClick()}),e}const yt="desktop-mode-user-edit";function Co(o,e={}){if(!Number.isFinite(o)||o<=0)return!1;const t=window.wp?.os;return t?.openWindow?.(yt,{source:e.source??"user-edit/open",params:{userId:o}})?(t?.relations?.set?.(yt,{type:"user",id:o}),!0):(e.fallback?.(),!1)}const zo=b` ${I} ${Te}: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}}`,B="__wpd_expander__",K="__wpd_select__",ce=class ce extends w{constructor(){super(...arguments),this._data=[],this._columns=[],this._filters={},this._expanded=new Set,this._subTable=null,this._sort=null,this._selection=new Set,this._getRowId=(e,t)=>t,this._filterCache=new Map,this._paintScheduled=!1,this._stacked=!1,this._stickyHeaderWarned=!1,this._stickyRaceWarned=!1,this._resizeObserver=null,this._stickyMicroScheduled=!1,this._stickyRafHandle=null,this._loadingDesyncWarned=!1,this._lastStickyIndex=-1}get data(){return this._data}set data(e){this._data=Array.isArray(e)?e.slice():[],this._expanded.clear(),this._schedulePaint()}get columns(){return this._columns}set columns(e){this._columns=Array.isArray(e)?e.slice():[];const t=new Set(this._columns.map(s=>s.key));for(const s of Object.keys(this._filters))t.has(s)||delete this._filters[s];for(const s of Array.from(this._filterCache.keys()))t.has(s)||this._filterCache.delete(s);this._sort&&!t.has(this._sort.key)&&(this._sort=null),this._schedulePaint()}get filters(){return{...this._filters}}set filters(e){this._filters=e?{...e}:{},this._schedulePaint()}get sort(){return this._sort?{...this._sort}:null}set sort(e){this._sort=e?{...e}:null,this._schedulePaint()}get selection(){return new Set(this._selection)}set selection(e){this._selection=new Set(e??[]),this._schedulePaint()}get selectedRows(){const e=[];return this._data.forEach((t,s)=>{this._selection.has(this._getRowId(t,s))&&e.push(t)}),e}get visibleRows(){return this._filteredRows().map(e=>e.row)}get getRowId(){return this._getRowId}set getRowId(e){this._getRowId=typeof e=="function"?e:(t,s)=>s,this._schedulePaint()}get subTable(){return this._subTable}set subTable(e){this._subTable=typeof e=="function"?e:null,this._expanded.clear(),this._schedulePaint()}get expanded(){return new Set(this._expanded)}set expanded(e){this._expanded=new Set(e??[]),this._schedulePaint()}expand(e){e<0||e>=this._data.length||this._expanded.has(e)||(this._expanded.add(e),this.emit("os-table-expand-change",{row:this._data[e],index:e,expanded:!0}),this._schedulePaint())}collapse(e){this._expanded.has(e)&&(this._expanded.delete(e),this.emit("os-table-expand-change",{row:this._data[e],index:e,expanded:!1}),this._schedulePaint())}expandAll(){if(!this._subTable)return;let e=!1;for(let t=0;t<this._data.length;t++)this._subTable(this._data[t],t)&&(this._expanded.has(t)||(this._expanded.add(t),e=!0));e&&this._schedulePaint()}collapseAll(){this._expanded.size!==0&&(this._expanded.clear(),this._schedulePaint())}isExpanded(e){return this._expanded.has(e)}clearFilters(){Object.keys(this._filters).length!==0&&(this._filters={},this.emit("os-table-filter-change",{filters:{}}),this._schedulePaint())}clearSort(){this._sort!==null&&(this._sort=null,this.emit("os-table-sort-change",{sort:null}),this._schedulePaint())}select(e){if(this._selection.has(e))return;const t=this._readSelectable(),s=t==="single"?Array.from(this._selection):[];t==="single"&&this._selection.clear(),this._selection.add(e),this._emitSelectionChange(),this._syncSelectionDom([e,...s])}deselect(e){this._selection.delete(e)&&(this._emitSelectionChange(),this._syncSelectionDom([e]))}selectAll(){if(this._readSelectable()==="multi"){for(const{row:e,index:t}of this._filteredRows())this._selection.add(this._getRowId(e,t));this._emitSelectionChange(),this._syncSelectionDom("all")}}clearSelection(){this._selection.size!==0&&(this._selection.clear(),this._emitSelectionChange(),this._syncSelectionDom("all"))}_syncSelectionDom(e){const t=this.shadowRoot;if(!t)return;const s=t.querySelector("tbody");if(!s)return;let i=null;if(e!=="all"){i=new Set;for(const a of e)i.add(String(a))}const n=s.querySelectorAll("tr[data-row-id]");for(const a of n){const c=a.dataset.rowId;if(c===void 0||i&&!i.has(c))continue;const d=Number(a.dataset.rowIndex);if(!Number.isFinite(d))continue;const p=this._data[d];if(p===void 0)continue;const u=this._getRowId(p,d),m=this._selection.has(u);a.classList.toggle("is-selected",m);const f=a.querySelector("input.select-row-checkbox");f&&f.checked!==m&&(f.checked=m)}const r=t.querySelector("thead .select-all-checkbox");if(r){const{total:a,selected:c}=this._visibleSelectionStats();r.checked=a>0&&c===a,r.indeterminate=c>0&&c<a}}scrollToRow(e){const t=this.shadowRoot;if(!t)return;const i=t.querySelectorAll("tbody tr:not(.subtable):not(.empty):not(.skeleton)")[e];i&&i.scrollIntoView({block:"nearest",inline:"nearest"})}connectedCallback(){super.connectedCallback(),this._schedulePaint()}disconnectedCallback(){this._resizeObserver?.disconnect(),this._resizeObserver=null,this._stickyRafHandle!==null&&typeof cancelAnimationFrame<"u"&&(cancelAnimationFrame(this._stickyRafHandle),this._stickyRafHandle=null)}recomputeLayout(){this._applyStickyOffsets(),this._measureHeaderHeight()}render(){return h` | |
| 104 | + <div class="scroll" part="scroll"> | |
| 105 | + <table part="table"> | |
| 106 | + <colgroup></colgroup> | |
| 107 | + <thead></thead> | |
| 108 | + <tbody></tbody> | |
| 109 | + </table> | |
| 110 | + </div> | |
| 111 | + `}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")||G(this.render(),e);const t=e.querySelector("colgroup"),s=e.querySelector("thead"),i=e.querySelector("tbody");if(!t||!s||!i)return;const n=this._effectiveColumns();this._stacked=this.hasAttribute("stacked");const r=this._readStickyColumns();this._lastStickyIndex=this._computeLastStickyIndex(n,r),this._paintColgroup(t,n),this._paintHead(s,n,r),this._paintBody(i,n,r),this._applyStickyOffsets(),this._measureHeaderHeight(),this._scheduleStickyOffsets(),this._maybeWarnStickyHeader(),this._maybeWarnLoadingDesync(i),this._ensureResizeObserver()}_maybeWarnLoadingDesync(e){this._loadingDesyncWarned||this.hasAttribute("loading")&&(e.querySelector("tr.skeleton")||(this._loadingDesyncWarned=!0,console.warn("[os-table] `loading` attribute is set but no skeleton rows rendered. Either attributeChangedCallback didn't route through requestUpdate (framework regression), or `loading` was set after the most recent paint and no follow-up trigger ran. Toggling `data` will force a paint as a workaround.")))}_scheduleStickyOffsets(){this._stickyMicroScheduled||(this._stickyMicroScheduled=!0,queueMicrotask(()=>{this._stickyMicroScheduled=!1,this.isConnected&&this._applyStickyOffsets()})),this._stickyRafHandle===null&&typeof requestAnimationFrame<"u"&&(this._stickyRafHandle=requestAnimationFrame(()=>{this._stickyRafHandle=null,this.isConnected&&(this._applyStickyOffsets(),this._measureHeaderHeight())}))}_ensureResizeObserver(){if(this._resizeObserver||typeof ResizeObserver>"u")return;const e=this.shadowRoot?.querySelector(".scroll");e&&(this._resizeObserver=new ResizeObserver(()=>{this.isConnected&&(this._applyStickyOffsets(),this._measureHeaderHeight(),this._stickyHeaderWarned=!1,this._maybeWarnStickyHeader())}),this._resizeObserver.observe(e),this._resizeObserver.observe(this))}_paintColgroup(e,t){const s=[];for(const i of t){const n=document.createElement("col");i.width&&(n.style.width=i.width),s.push(n)}e.replaceChildren(...s)}_paintHead(e,t,s){const i=document.createElement("tr");i.setAttribute("part","header-row");for(let c=0;c<t.length;c++)i.appendChild(this._buildHeaderCell(t[c],c,s));const n=e.querySelector(':scope > tr[part="header-row"]');n?e.replaceChild(i,n):e.insertBefore(i,e.firstChild);const r=t.some(c=>c.filter||Array.isArray(c.filterOptions)||typeof c.filterRender=="function");let a=e.querySelector(":scope > tr.filter-row");if(r){const c=[];for(let u=0;u<t.length;u++)c.push(this._buildFilterCell(t[u],u,s));a||(a=document.createElement("tr"),a.classList.add("filter-row"),a.setAttribute("part","filter-row"),e.appendChild(a));const d=Array.from(a.children);let p=d.length===c.length;if(p){for(let u=0;u<c.length;u++)if(d[u]!==c[u]){p=!1;break}}if(!p){const u=new Set(c);for(const m of c)a.appendChild(m);for(const m of Array.from(a.children))u.has(m)||a.removeChild(m)}}else a&&a.remove()}_buildHeaderCell(e,t,s){const i=document.createElement("th");if(i.setAttribute("scope","col"),i.dataset.key=e.key,this._applyCellClasses(i,e,t,s),e.minWidth&&(i.style.minWidth=e.minWidth),e.key===K){if(this._readSelectable()==="multi"){const r=document.createElement("input");r.type="checkbox",r.className="select-all-checkbox",r.setAttribute("data-noclick",""),r.setAttribute("aria-label","Select all rows");const{total:a,selected:c}=this._visibleSelectionStats();r.checked=a>0&&c===a,r.indeterminate=c>0&&c<a,r.addEventListener("change",()=>{r.checked?this.selectAll():this.clearSelection()}),i.appendChild(r)}return i}if(i.textContent=e.label??(e.key===B?"":e.key),e.sortable){i.classList.add("is-sortable");const n=this._sort?.key===e.key,r=document.createElement("span");r.className="sort-indicator";let a="";n&&(a=this._sort.direction==="asc"?" ▲":" ▼"),r.textContent=a,i.appendChild(r),n&&i.classList.add(this._sort.direction==="asc"?"sort-asc":"sort-desc"),i.addEventListener("click",()=>this._cycleSort(e.key))}return i}_buildFilterCell(e,t,s){const i=this._filterCache.get(e.key),n=Array.isArray(e.filterOptions),r=typeof e.filterRender=="function";let a;if(!e.filter&&!n&&!r||e.key===B||e.key===K?a="none":r?a="custom":e.filter==="select"||n?a="select":a="text",i&&i.kind===a){if(i.th.className="",this._applyCellClasses(i.th,e,t,s),a==="select"){const u=i.control,m=this._resolveFilterOptions(e),f=m.map(g=>g.value).join("|");f!==i.optionsKey?(this._populateSelect(u,m,this._filters[e.key]??""),i.optionsKey=f):u.value=this._filters[e.key]??""}else if(a==="text"){const u=i.control,m=this._filters[e.key]??"";u.value!==m&&u.ownerDocument.activeElement!==u&&(u.value=m)}else a==="custom"&&e.filterRender&&e.filterRender(i.th,{value:this._filters[e.key]??"",setValue:u=>this._onFilterChange(e.key,u),col:e});return i.th}const c=document.createElement("th");if(this._applyCellClasses(c,e,t,s),a==="none")return this._filterCache.set(e.key,{th:c,control:null,optionsKey:"",kind:"none"}),c;if(a==="custom"&&e.filterRender)return e.filterRender(c,{value:this._filters[e.key]??"",setValue:u=>this._onFilterChange(e.key,u),col:e}),this._filterCache.set(e.key,{th:c,control:null,optionsKey:"",kind:"custom"}),c;let d,p="";if(a==="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 m=this._resolveFilterOptions(e);this._populateSelect(u,m,this._filters[e.key]??""),p=m.map(f=>f.value).join("|"),u.addEventListener("change",()=>{this._onFilterChange(e.key,u.value)}),d=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)}),d=u}return c.appendChild(d),this._filterCache.set(e.key,{th:c,control:d,optionsKey:p,kind:a}),c}_populateSelect(e,t,s){e.replaceChildren();const i=document.createElement("option");i.value="",i.textContent="All",e.appendChild(i);for(const n of t){const r=document.createElement("option");r.value=n.value,r.textContent=n.label,n.value===s&&(r.selected=!0),e.appendChild(r)}e.value=s}_resolveFilterOptions(e){return Array.isArray(e.filterOptions)?e.filterOptions:this._uniqueValues(e.key).map(t=>({value:t,label:t}))}_paintBody(e,t,s){if(e.replaceChildren(),this.hasAttribute("loading")){const n=this._readLoadingRows();for(let r=0;r<n;r++)e.appendChild(this._buildSkeletonRow(t,r));return}const i=this._sortedRows(this._filteredRows());if(i.length===0){e.appendChild(this._buildEmptyRow(t.length));return}for(const{row:n,index:r}of i)if(e.appendChild(this._stacked?this._buildStackedRow(n,r,t):this._buildBodyRow(n,r,t,s)),this._expanded.has(r)&&this._subTable){const a=this._subTable(n,r);a&&e.appendChild(this._buildSubTableRow(a,t.length))}}_buildEmptyRow(e){const t=document.createElement("tr");t.classList.add("empty");const s=document.createElement("td");s.colSpan=e;const i=document.createElement("slot");return i.name="empty",i.textContent=this.getAttribute("empty")||"No data",s.appendChild(i),t.appendChild(s),t}_buildSkeletonRow(e,t){const s=document.createElement("tr");if(s.classList.add("skeleton"),s.setAttribute("aria-hidden","true"),this._stacked){s.classList.add("stack-row");const i=document.createElement("td");i.className="stack-body",i.colSpan=Math.max(1,e.length);for(const n of[55+t*7%25,30+t*11%15]){const r=document.createElement("span");r.className="skeleton-bar",r.style.width=`${n}%`,i.appendChild(r)}return s.appendChild(i),s}for(const i of e){const n=document.createElement("td"),r=document.createElement("span");r.className="skeleton-bar";const a=50+(t*7+s.children.length*13)%40;r.style.width=`${a}%`,n.appendChild(r),s.appendChild(n)}return s}_buildBodyRow(e,t,s,i){const n=document.createElement("tr");n.setAttribute("part","row"),n.dataset.rowIndex=String(t);const r=this._getRowId(e,t);n.dataset.rowId=String(r),this._selection.has(r)&&n.classList.add("is-selected"),n.addEventListener("click",a=>{this._onRowClick(e,t,a)});for(let a=0;a<s.length;a++)n.appendChild(this._buildBodyCell(s[a],a,e,t,i));return n}_buildStackedRow(e,t,s){const i=document.createElement("tr");i.setAttribute("part","row"),i.classList.add("stack-row"),i.dataset.rowIndex=String(t);const n=this._getRowId(e,t);i.dataset.rowId=String(n),this._selection.has(n)&&i.classList.add("is-selected"),i.addEventListener("click",d=>{this._onRowClick(e,t,d)});const r=document.createElement("td");r.className="stack-body";let a=0,c=0;for(let d=0;d<s.length;d++){const p=s[d];if(p.key===K||p.key===B){i.appendChild(this._buildBodyCell(p,d,e,t,0));continue}c++;const u=Eo(p,a++);if(u==="hidden")continue;const m=document.createElement("div");if(m.className=`stack-cell stack-${u}`,m.dataset.key=p.key,u==="meta"&&p.label){const v=document.createElement("span");v.className="stack-label",v.textContent=p.label,m.appendChild(v)}const f=document.createElement("span");f.className="stack-value";const g=e[p.key],_=ye(g);p.render?this._mountCellContent(f,p.render(g,e,t)):_!==null?f.appendChild(this._slotFor(_)):g!=null&&(f.textContent=String(g)),m.appendChild(f),r.appendChild(m)}return r.colSpan=Math.max(1,c),i.appendChild(r),i}_buildBodyCell(e,t,s,i,n){const r=document.createElement("td");if(this._applyCellClasses(r,e,t,n),e.minWidth&&(r.style.minWidth=e.minWidth),e.key===K){const d=this._getRowId(s,i),p=document.createElement("input");return p.type="checkbox",p.className="select-row-checkbox",p.setAttribute("data-noclick",""),p.setAttribute("aria-label","Select row"),p.checked=this._selection.has(d),p.addEventListener("change",()=>{p.checked?this.select(d):this.deselect(d)}),r.appendChild(p),this._stacked&&(r.setAttribute("data-noclick",""),r.addEventListener("click",u=>{u.target===r&&(p.checked=!p.checked,p.dispatchEvent(new Event("change")))})),r}if(e.key===B){if(!(this._subTable?!!this._subTable(s,i):!1))return r;const p=this._expanded.has(i),u=document.createElement("button");return u.type="button",u.className="expander",u.setAttribute("data-noclick",""),u.setAttribute("aria-expanded",p?"true":"false"),u.setAttribute("aria-label",p?"Collapse row":"Expand row"),u.textContent=p?"▾":"▸",u.addEventListener("click",m=>{this._toggleRow(i,s,m)}),r.appendChild(u),r}const a=s[e.key],c=ye(a);if(e.render){const d=e.render(a,s,i);this._mountCellContent(r,d)}else c!==null?r.appendChild(this._slotFor(c)):a!=null&&(r.textContent=String(a));return r}_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 i=document.createElement("td");i.colSpan=t;const n=document.createElement("div");if(n.classList.add("subtable-inner"),e instanceof Node)n.appendChild(e);else if(xt(e))G(e,n);else{const r=document.createElement("os-table");r.columns=e.columns,r.data=e.data,e.subTable&&(r.subTable=e.subTable),n.appendChild(r)}return i.appendChild(n),s.appendChild(i),s}_mountCellContent(e,t){if(typeof t=="string"){e.textContent=t;return}if(t instanceof Node){e.appendChild(t);return}xt(t)&&G(t,e)}_onFilterChange(e,t){t===""?delete this._filters[e]:this._filters[e]=t,this.emit("os-table-filter-change",{filters:{...this._filters}});const i=this.shadowRoot?.querySelector("tbody");if(i){const n=this._effectiveColumns(),r=this._readStickyColumns();this._lastStickyIndex=this._computeLastStickyIndex(n,r),this._paintBody(i,n,r),this._applyStickyOffsets()}}_onRowClick(e,t,s){const i=s.composedPath?.()??[];for(const n of i){if(n instanceof Element&&n.hasAttribute("data-noclick"))return;if(n===this)break}this.emit("os-table-row-click",{row:e,index:t,originalEvent:s})}_toggleRow(e,t,s){s.stopPropagation();const i=this._expanded.has(e);i?this._expanded.delete(e):this._expanded.add(e),this.emit("os-table-expand-change",{row:t,index:e,expanded:!i}),this._schedulePaint()}_cycleSort(e){!this._sort||this._sort.key!==e?this._sort={key:e,direction:"asc"}:this._sort.direction==="asc"?this._sort={key:e,direction:"desc"}:this._sort=null,this.emit("os-table-sort-change",{sort:this._sort?{...this._sort}:null}),this._schedulePaint()}_emitSelectionChange(){this.emit("os-table-selection-change",{selection:Array.from(this._selection),rows:this.selectedRows})}_filteredRows(){const e=[],t=Object.keys(this._filters).filter(s=>this._filters[s]!=="");for(let s=0;s<this._data.length;s++){const i=this._data[s];let n=!0;for(const r of t){const a=this._columns.find(u=>u.key===r);if(a&&typeof a.filterRender=="function")continue;const c=this._filters[r]??"",d=i[r],p=We(d);if(a?.filter==="select"){if(p!==c){n=!1;break}}else if(!p.toLowerCase().includes(c.toLowerCase())){n=!1;break}}n&&e.push({row:i,index:s})}return e}_sortedRows(e){if(!this._sort)return e;const t=this._columns.find(n=>n.key===this._sort.key);if(!t)return e;const s=this._sort.direction==="desc"?-1:1,i=e.slice();return i.sort((n,r)=>{const a=n.row[t.key],c=r.row[t.key],d=t.sortValue?t.sortValue(n.row,a):kt(a),p=t.sortValue?t.sortValue(r.row,c):kt(c);return Ro(d,p)*s}),i}_uniqueValues(e){const t=new Set;for(const s of this._data){const i=s[e];i!=null&&t.add(We(i))}return Array.from(t).sort()}_visibleSelectionStats(){let e=0,t=0;for(const{row:s,index:i}of this._filteredRows())e++,this._selection.has(this._getRowId(s,i))&&t++;return{total:e,selected:t}}_readStickyColumns(){const e=parseInt(this.getAttribute("sticky-columns")||"0",10);return Number.isFinite(e)&&e>0?e:0}_readLoadingRows(){const e=parseInt(this.getAttribute("loading-rows")||"5",10);return Number.isFinite(e)&&e>0?Math.min(e,100):5}_readSelectable(){const e=this.getAttribute("selectable");return e==="single"?"single":e==="multi"||e===""?"multi":null}_isStickyIndex(e,t,s){return this._stacked||s.sticky===!1?!1:s.sticky===!0?!0:e<t}_computeLastStickyIndex(e,t){let s=-1;for(let i=0;i<e.length;i++)this._isStickyIndex(i,t,e[i])&&(s=i);return s}_applyCellClasses(e,t,s,i){t.key===B&&e.classList.add("col-expander"),t.key===K&&e.classList.add("col-select"),t.align==="center"&&e.classList.add("align-center"),t.align==="end"&&e.classList.add("align-end"),this._isStickyIndex(s,i,t)&&(e.classList.add("is-sticky"),s===this._lastStickyIndex&&e.classList.add("is-sticky-edge"))}_effectiveColumns(){const e=[];return this._readSelectable()&&e.push({key:K,label:"",width:"40px",align:"center"}),this._subTable&&e.push({key:B,label:"",width:"36px",align:"center"}),e.push(...this._columns),e}_applyStickyOffsets(){const e=this.shadowRoot;if(!e)return;const t=e.querySelector("thead tr");if(!t)return;const s=Array.from(t.children),i=[];let n=0;for(let a=0;a<s.length;a++)i[a]=n,s[a].classList.contains("is-sticky")&&(n+=s[a].offsetWidth);e.querySelectorAll("thead tr, tbody tr:not(.subtable):not(.empty):not(.skeleton)").forEach(a=>{const c=Array.from(a.children);for(let d=0;d<c.length;d++)c[d].classList.contains("is-sticky")&&(c[d].style.insetInlineStart=`${i[d]}px`)}),this._maybeWarnStickyOffsetRace(s,i)}_maybeWarnStickyOffsetRace(e,t){if(this._stickyRaceWarned)return;const s=this._readStickyColumns();if(s<2)return;const i=Math.min(s-1,e.length-1);if(i<=0||t[i]!==0||this.offsetWidth===0)return;this._stickyRaceWarned=!0;const n=e[0]?.offsetWidth??0;console.warn(`[os-table] sticky-columns: column ${i} resolved to inset-inline-start: 0px while the host is visible. ths[0].offsetWidth was ${n}px at measurement time. Likely a layout race — call recomputeLayout() after the panel finishes its mount/transition, or wrap the assignment of \`data\` in a requestAnimationFrame.`)}_measureHeaderHeight(){const e=this.shadowRoot;if(!e)return;const t=e.querySelector("thead tr");if(!t)return;const s=t.offsetHeight;s>0&&this.style.setProperty("--os-ui-table-header-height",`${s}px`)}_maybeWarnStickyHeader(){if(this._stickyHeaderWarned||!this.hasAttribute("sticky-header")||this.hasAttribute("loading")||this._data.length<8)return;const e=this.shadowRoot?.querySelector(".scroll");e&&e.offsetWidth!==0&&e.scrollHeight<=e.clientHeight+1&&(this._stickyHeaderWarned=!0,console.warn("[os-table] sticky-header is set but the table has no scroll container. Set --os-ui-table-max-height on the host (or wrap it in a scrolling parent) so the header has something to stick to."))}};ce.props=["stickyColumns","stickyHeader","striped","hover","compact","bordered","empty","loading","loadingRows","selectable","stacked"],ce.styles=[zo],ce.help=void 0;let Fe=ce;function xt(o){return!!o&&o.__wpdHtml===!0}function Eo(o,e){return o.stack?o.stack:e===0?"title":o.label?"meta":"actions"}function ye(o){return o&&typeof o=="object"&&typeof o.slot=="string"?o.slot:null}function We(o){if(o==null)return"";if(ye(o)!==null){const e=o.text;return e==null?"":String(e)}return String(o)}function kt(o){return ye(o)!==null?We(o):o}function Ro(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))}S("os-table",Fe);const Lo=b`:host{display:inline-flex;align-items:center;justify-content:center;width:var( --os-ui-icon-size,16px );height:var( --os-ui-icon-size,16px );color:inherit;line-height:1}:host( [ hidden ] ){display:none}.os-icon__glyph{font-size:var( --os-ui-icon-size,16px );width:var( --os-ui-icon-size,16px );height:var( --os-ui-icon-size,16px );line-height:1;color:inherit;display:inline-flex;align-items:center;justify-content:center}.os-icon__glyph--char{font-family:dashicons;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;speak:none}.os-icon__glyph.dashicons{font-family:dashicons}`;let xe=null;function To(o){let e=o.trim();if(e==="")return null;(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))&&(e=e.slice(1,-1));const t=e.match(/^\\([0-9a-f]{1,6})\s?$/i);return t?String.fromCodePoint(parseInt(t[1],16)):e||null}function wt(){const o=new Map;if(typeof document>"u")return o;const e=Array.from(document.styleSheets??[]);for(const t of e){let s=null;try{s=t.cssRules}catch{continue}if(s)for(const i of Array.from(s)){const n=i;if(!n||!n.selectorText)continue;const r=n.selectorText.match(/\.dashicons-([a-z0-9-]+)::?before/i);if(!r)continue;const a=n.style?.content;if(!a)continue;const c=To(a);c&&o.set(r[1],c)}}return o}function No(o){xe||(xe=wt());const e=o.startsWith("dashicons-")?o.slice(10):o;return xe.get(e)??null}function Po(){xe=wt()}let $t=!1;function Mo(){if($t||typeof window>"u")return;$t=!0;const o=()=>{Po()};document.readyState==="loading"&&document.addEventListener("DOMContentLoaded",o,{once:!0}),window.addEventListener("load",o,{once:!0})}Mo();const de=class de extends w{render(){const e=this.name||"",t=e.startsWith("dashicons-")?e.slice(10):e,s=this.size;s&&/^\d+$/.test(s)&&this.style.setProperty("--os-ui-icon-size",`${s}px`);const i=No(t);return i?h`<span | |
| 112 | + class="os-icon__glyph os-icon__glyph--char dashicons dashicons-${t}" | |
| 113 | + aria-hidden="true" | |
| 114 | + >${i}</span>`:h`<span | |
| 115 | + class="os-icon__glyph dashicons dashicons-${t}" | |
| 116 | + aria-hidden="true" | |
| 117 | + ></span>`}};de.props=["name","size"],de.styles=[Lo],de.help=void 0;let He=de;S("os-icon",He);const Io=b`:host{display:inline;color:inherit;font:inherit}`,ke=new Set;let J=null;const qo=3e4;function Do(){J===null&&(J=window.setInterval(()=>{for(const o of ke)o.tick()},qo))}function Fo(){J!==null&&ke.size===0&&(window.clearInterval(J),J=null)}function Wo(o){if(!o)return null;const e=t=>{const s=new Date(t);return Number.isNaN(s.getTime())?null:s};return Ho(o)?e(o):e(o.replace(" ","T")+"Z")}function Ho(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 Oe=null,Ue=null;function St(){return typeof navigator<"u"&&navigator.language||"en"}function Oo(){return Oe||(Oe=new Intl.RelativeTimeFormat(St(),{numeric:"auto"})),Oe}function At(){return Ue||(Ue=new Intl.RelativeTimeFormat(St(),{numeric:"always",style:"narrow"})),Ue}function Uo(o,e){const t=Oo(),s=o.getTime()-e,i=Math.round(s/1e3),n=Math.abs;return n(i)<45?t.format(0,"second"):Ct(t,i)}function Ct(o,e){const t=Math.abs,s=Math.round(e/60);if(t(s)<45)return o.format(s,"minute");const i=Math.round(s/60);if(t(i)<22)return o.format(i,"hour");const n=Math.round(i/24);if(t(n)<26)return o.format(n,"day");const r=Math.round(n/30);if(t(r)<11)return o.format(r,"month");const a=Math.round(n/365);return o.format(a,"year")}function jo(o,e){const t=Math.round((o.getTime()-e)/1e3),s=Math.abs;return s(t)<45?At().format(0,"second"):s(t)>604800?o.toLocaleDateString(void 0,{month:"short",day:"numeric"}):Ct(At(),t)}const ue=class ue extends w{connectedCallback(){super.connectedCallback(),ke.add(this),Do()}disconnectedCallback(){ke.delete(this),Fo()}tick(){this.requestUpdate()}render(){const e=this.datetime,t=Wo(e);if(!t)return h`<span>${e??""}</span>`;const s=Date.now(),i=this.hasAttribute("compact")?jo(t,s):Uo(t,s),n=t.toLocaleString();return h`<time datetime=${t.toISOString()} title=${n} | |
| 118 | + >${i}</time | |
| 119 | + >`}};ue.props=["datetime","compact"],ue.styles=[Io],ue.help=void 0;let je=ue;S("os-relative-time",je);function zt(o){if(typeof o=="number")return o>0?o*1e3:NaN;const e=String(o??"");if(!e||e.startsWith("0000-00-00"))return NaN;let t=e.includes(" ")?e.replace(" ","T"):e;!/Z$/.test(t)&&!/[+-]\d{2}:?\d{2}$/.test(t)&&(t+="Z");const s=Date.parse(t);return Number.isFinite(s)?s:NaN}function Bo(o){const e=zt(o);if(!Number.isFinite(e)){const s=document.createElement("span");return s.textContent="—",s}const t=document.createElement("os-relative-time");return t.setAttribute("datetime",new Date(e).toISOString()),t.title=rt(e,"datetime"),t}function Ko(o){at(o).catch(()=>!1)}const Vo=()=>[{value:"",label:l("All")},{value:"online",label:l("Online")},{value:"recent",label:l("Active 30d")},{value:"never",label:l("No sign-in recorded")}];function Yo(o,e){if(e==="online")return o.filter(t=>t.openstation_presence==="online");if(e==="recent"){const t=Math.floor(Date.now()/1e3);return o.filter(s=>{const i=s.openstation_last_login;return typeof i=="number"&&i>0&&t-i<2592e3})}return e==="never"?o.filter(t=>typeof t.openstation_last_login!="number"||!t.openstation_last_login):o}const Xo=new Set(["identity","email","role","last_login","actions"]),Go={identity:"name",email:"email",registered:"registered_date"};function Zo(o){const e=o.openstation_user_stats;return[o.id,o.name,o.slug,o.email??"",(o.roles??[]).join(","),o.registered_date??"",o.openstation_last_login??"",o.openstation_presence??"",o.openstation_can_edit?1:0,e?`${e.posts}/${e.pages}/${e.comments}`:""].join("|")}function O(o,e,t,s){const i=`${e}::${t}`,n=o.get(i);if(n)return n;const r=s();return o.set(i,r),r}function Et(o,e){for(const t of Array.from(o.keys()))t.startsWith(`${e}::`)&&o.delete(t)}const V="var( --os-ui-fg-muted, #50575e )",Jo="display:inline-flex;align-items:center;padding:2px 8px;border-radius:10px;font-size:11px;font-weight:600;background:var(--os-ui-badge-info-bg, rgba(34,113,177,0.10));color:var(--os-ui-info-fg, #0a4b78);white-space:nowrap;";function Qo(o,e){const t=document.createElement("span");t.style.cssText="display:flex;align-items:center;gap:10px;min-width:0;";const s=document.createElement("os-avatar");s.setAttribute("size","32"),o.name&&s.setAttribute("name",o.name),s.setAttribute("presence",o.openstation_presence??"offline");const i=vt(o.avatar_urls);i&&_t(s,i),t.appendChild(s);const n=document.createElement("span");n.style.cssText="display:flex;flex-direction:column;min-width:0;line-height:1.25;";const r=document.createElement("button");if(r.type="button",r.textContent=o.name||`#${o.id}`,r.title=r.textContent,r.setAttribute("data-noclick",""),r.style.cssText="appearance:none;background:transparent;border:none;padding:0;font:inherit;font-weight:600;color:inherit;cursor:pointer;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:240px;",r.addEventListener("mouseenter",()=>{r.style.textDecoration="underline"}),r.addEventListener("mouseleave",()=>{r.style.textDecoration="none"}),r.addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),Q(o.id,e)}),n.appendChild(r),o.slug){const a=document.createElement("span");a.textContent=`@${o.slug}`,a.style.cssText=`font-size:11px;color:${V};white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:240px;`,n.appendChild(a)}return t.appendChild(n),t}function Q(o,e){Co(o,{source:"users-window/row-click",fallback:()=>{console.error("[openstation:desktop-mode-users] the User Edit window is not registered for this user."),e.toast(l("Profile window not registered — see console."))}})}function es(o,e){const t=document.createElement("button");t.type="button";const s=typeof o.email=="string"?o.email:"";return t.textContent=s||"—",t.disabled=s==="",t.title=s?l("Click to copy email"):"",t.style.cssText=["appearance:none","background:transparent","border:none","padding:2px 6px","font:inherit","color:inherit",`cursor:${s?"copy":"default"}`,"text-align:left","font-size:13px","border-radius:4px","max-width:100%","overflow:hidden","text-overflow:ellipsis","white-space:nowrap"].join(";"),t.addEventListener("click",i=>{i.stopPropagation(),s&&at(s).then(n=>{if(!n){e.toast(l("Could not copy the email address."));return}t.textContent=l("Copied!"),t.style.color="var(--wp-admin-theme-color, #2271b1)",setTimeout(()=>{t.textContent=s,t.style.color=""},1200)})}),t}function ts(o,e){const t=document.createElement("span");t.style.cssText="display:inline-flex;flex-wrap:wrap;gap:4px;min-width:0;";const s=Array.isArray(o.roles)?o.roles:[];if(s.length===0){const n=document.createElement("span");return n.textContent=l("No role"),n.style.cssText=`color:${V};font-style:italic;`,t.appendChild(n),t}const i=e.allRoles??{};for(const n of s){const r=document.createElement("span");r.textContent=i[n]??n,r.style.cssText=Jo,t.appendChild(r)}return t}function os(o){const e=o.openstation_user_stats??{posts:0,pages:0,comments:0},t=document.createElement("span");t.style.cssText="display:inline-flex;align-items:center;gap:10px;font-size:12px;font-variant-numeric:tabular-nums;";const s=(i,n,r)=>{const a=document.createElement("span");a.style.cssText="display:inline-flex;align-items:center;gap:3px;",a.title=r;const c=document.createElement("os-icon");c.setAttribute("name",i),c.setAttribute("size","14"),c.style.color=V;const d=document.createElement("span");return d.textContent=String(n),n===0&&(d.style.color=V),a.append(c,d),a};return t.append(s("admin-post",e.posts,l("Posts")),s("admin-page",e.pages,l("Pages")),s("admin-comments",e.comments,l("Comments"))),t}function Rt(o,e){const t=document.createElement("span");t.style.cssText="font-size:13px;font-variant-numeric:tabular-nums;";const s=zt(o);return Number.isFinite(s)?(t.appendChild(Bo(o)),t.title=rt(s,"datetime"),t):(t.textContent=e,t.style.color=V,t)}function ss(o,e,t){const s=document.createElement("span");if(s.style.cssText="display:inline-flex;gap:4px;align-items:center;",e.canEdit!==!0||o.openstation_can_edit!==!0)return s.textContent="—",s.style.color=V,s;const i=(n,r,a)=>{const c=document.createElement("os-icon");return c.setAttribute("name",r),c.setAttribute("size","18"),Ao({label:n,glyph:c,onClick:a})};return s.append(i(l("Send password reset"),"email-alt",()=>t.onSendReset(o)),i(l("Resend welcome email"),"megaphone",()=>t.onResendWelcome(o))),s}function is(o,e,t,s=_e()){const i=[{key:"identity",label:l("Name"),sortable:!0,sticky:!0,minWidth:"260px",render:(n,r)=>O(o,r.id,"identity",()=>Qo(r,t))},{key:"email",label:l("Email"),sortable:!0,minWidth:"220px",render:(n,r)=>O(o,r.id,"email",()=>es(r,t))},{key:"role",label:l("Role"),width:"180px",render:(n,r)=>O(o,r.id,"role",()=>ts(r,e))},{key:"stats",label:l("Content"),width:"160px",sortValue:n=>{const r=n.openstation_user_stats;return r?r.posts+r.pages+r.comments:0},render:(n,r)=>O(o,r.id,"stats",()=>os(r))},{key:"last_login",label:l("Last login"),width:"140px",sortable:!1,sortValue:n=>typeof n.openstation_last_login=="number"?n.openstation_last_login:0,render:(n,r)=>O(o,r.id,"last_login",()=>Rt(r.openstation_last_login,l("Never")))},{key:"registered",label:l("Registered"),width:"140px",sortable:!0,render:(n,r)=>O(o,r.id,"registered",()=>Rt(r.registered_date,"—"))}];return e.canEdit===!0&&i.push({key:"actions",label:l("Actions"),stack:"actions",width:"110px",sortable:!1,render:(n,r)=>O(o,r.id,"actions",()=>ss(r,e,t))}),s?i.filter(n=>Xo.has(n.key)):i}const ns=(o,e)=>e.allRoles?.[o]||o||l("No role");function U(o,e=48){return h`<os-avatar data-people-avatar=${vt(o.avatar_urls)||""} name=${o.name} size=${e} presence=${o.openstation_presence||""}></os-avatar>`}function rs(o){return o.openstation_presence==="online"?l("Online now"):o.openstation_presence==="inactive"?l("Away"):l("Offline")}function as(o){return o.openstation_last_login?h`<span>${l("Last sign-in")} <os-relative-time datetime=${new Date(o.openstation_last_login*1e3).toISOString()}></os-relative-time></span>`:l("No sign-in recorded")}function ls(o,e,t){return h`<os-action-menu text=${l("Actions")} label=${x(l("Actions for %s"),o.name)} @os-context-menu-pick=${s=>{const i=s.detail.id;i==="profile"&&Q(o.id,t),!(!e.canEdit||!o.openstation_can_edit)&&(i==="reset"&&t.onSendReset(o),i==="welcome"&&t.onResendWelcome(o))}}> | |
| 120 | + <os-context-menu-option data-menu-item-id="profile" icon="dashicons-id">${l("View profile")}</os-context-menu-option> | |
| 121 | + ${e.canEdit&&o.openstation_can_edit?h` | |
| 122 | + <os-context-menu-option heading>${l("Account emails")}</os-context-menu-option> | |
| 123 | + <os-context-menu-option data-menu-item-id="reset" icon="dashicons-lock">${l("Send password reset")}</os-context-menu-option> | |
| 124 | + <os-context-menu-option data-menu-item-id="welcome" icon="dashicons-email-alt">${l("Resend welcome")}</os-context-menu-option>`:""} | |
| 125 | + </os-action-menu>`}function cs(o){const e=new Date(o.registered_date||"");return Number.isNaN(e.getTime())?"—":e.toLocaleDateString(void 0,{month:"short",year:"numeric"})}function ds(o,e,t,s){const{cfg:i,actions:n}=e,r=i.canEdit||i.canPromote||i.canDelete;return h`<div class="os-people__cards" aria-label=${l("People directory")}> | |
| 126 | + ${o.length?o.map(a=>h`<article class="os-people__card ${e.selected.includes(a.id)?"is-selected":""}" data-person-id=${a.id}> | |
| 127 | + <header class="os-people__id-header"><span class="os-people__issuer"><span class="dashicons dashicons-id-alt" aria-hidden="true"></span> OPENSTATION <span>/ ${l("MEMBER")}</span></span> | |
| 128 | + ${a.id===i.currentUserId?h`<span class="os-people__you">${l("You")}</span>`:""} | |
| 129 | + ${r?h`<os-checkbox class="os-people__select" aria-label=${x(l("Select %s"),a.name)} ?checked=${e.selected.includes(a.id)} @os-checkbox-change=${c=>e.select(a.id,c.detail.checked)}></os-checkbox>`:""} | |
| 130 | + </header> | |
| 131 | + <div class="os-people__identity"> | |
| 132 | + <div class="os-people__portrait">${U(a,64)}<span class="os-people__member-number" title=${l("WordPress user ID")}>#${String(a.id).padStart(5,"0")}</span></div> | |
| 133 | + <div class="os-people__credentials"><h3><os-button variant="ghost" title=${a.name} @click=${()=>Q(a.id,n)}>${a.name||a.slug}</os-button></h3> | |
| 134 | + <p class="os-people__handle">@${a.slug}</p> | |
| 135 | + <div class="os-people__roles">${(a.roles.length?a.roles:[""]).map(c=>h`<span>${ns(c,i)}</span>`)}</div> | |
| 136 | + <p class="os-people__email" title=${a.email||""}>${a.email||l("No email available")}</p> | |
| 137 | + <p class="os-people__joined">${l("Member since")} <time datetime=${a.registered_date||""}>${cs(a)}</time></p> | |
| 138 | + </div> | |
| 139 | + </div> | |
| 140 | + <div class="os-people__stats" aria-label=${l("Published contributions")}> | |
| 141 | + <os-stat value=${String(a.openstation_user_stats?.posts??"—")} label=${l("Posts")}></os-stat> | |
| 142 | + <os-stat value=${String(a.openstation_user_stats?.pages??"—")} label=${l("Pages")}></os-stat> | |
| 143 | + <os-stat value=${String(a.openstation_user_stats?.comments??"—")} label=${l("Comments")}></os-stat> | |
| 144 | + <span class="os-people__seal" aria-hidden="true"><span class="dashicons dashicons-admin-users"></span></span> | |
| 145 | + </div> | |
| 146 | + <footer><span class="os-people__presence" data-presence=${a.openstation_presence||"offline"} title=${l("Current presence")}>${rs(a)}</span><span class="os-people__last-login">${as(a)}</span>${ls(a,i,n)}</footer> | |
| 147 | + </article>`):h`<div class="os-people__empty"><span class="dashicons dashicons-admin-users" aria-hidden="true"></span><h3>${l(s?"Meeting your people…":"No people match this view.")}</h3><p>${l("Try another search, presence or role filter.")}</p></div>`} | |
| 148 | + ${t} | |
| 149 | + </div>`}function us(o,e){return h`<div class="os-people__role-grid">${o.map(t=>h`<article class="os-people__room"> | |
| 150 | + <div class="os-people__orbit"><div class="os-people__orbit-center"><strong>${t.total}</strong><span>${t.label}</span></div> | |
| 151 | + ${t.members.slice(0,8).map((s,i)=>{const n=i/Math.min(t.members.length,8)*Math.PI*2-Math.PI/2;return h`<span class="os-people__satellite" style=${`inset-inline-start:${50+Math.cos(n)*42}%;inset-block-start:${50+Math.sin(n)*42}%`} title=${s.name}>${U(s,36)}</span>`})}</div> | |
| 152 | + <p>${t.members.slice(0,3).map(s=>s.name).join(", ")}${t.total>3?"…":""}</p> | |
| 153 | + <os-button variant="secondary" ?disabled=${t.total===0} @click=${()=>e(t.role)}>${l("Meet this group")} ↗</os-button> | |
| 154 | + </article>`)} | |
| 155 | + ${o.length?"":h`<p class="os-people__empty">${l("No role groups found.")}</p>`} | |
| 156 | + </div>`}function ps(o){queueMicrotask(()=>{o.querySelectorAll("[data-people-avatar]").forEach(e=>{const t=e.getAttribute("data-people-avatar")||"";e.dataset.avatarResolved!==t&&(e.dataset.avatarResolved=t,_t(e,t))}),o.querySelectorAll(".os-people__select, [data-os-users-search]").forEach(e=>e.shadowRoot?.querySelector("input")?.setAttribute("aria-label",e.getAttribute("aria-label")||""))})}const hs=b` ${I} ${ft}:host{display:block;--_track-bg:var( --os-ui-progress-track-bg,var( --os-ui-surface-sunken,rgba( 0,0,0,0.08 ) ) );--_fill:var( --os-ui-progress-fill,var( --wp-admin-theme-color,#2271b1 ) );--_height:var( --os-ui-progress-height,6px );--_radius:var( --os-ui-progress-radius,999px );--_label-color:var( --os-ui-progress-label-color,inherit );--_label-size:var( --os-ui-progress-label-size,12px );--_label-gap:var( --os-ui-progress-label-gap,4px );width:100%;font:inherit;color:var( --_label-color )}:host( [ hidden ] ){display:none}.header{display:flex;align-items:baseline;justify-content:space-between;gap:8px;margin-bottom:var( --_label-gap );font-size:var( --_label-size );line-height:1.3}.label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.percent{font-variant-numeric:tabular-nums;opacity:0.75;flex-shrink:0}.track{position:relative;width:100%;height:var( --_height );background:var( --_track-bg );border-radius:var( --_radius );overflow:hidden}.fill{position:absolute;inset-block:0;inset-inline-start:0;width:0;background:var( --_fill );border-radius:inherit;transition:width 0.18s ease-out}:host( [ tone='success' ] ){--os-ui-progress-fill:var( --os-ui-success-fg,#3a8a3a )}:host( [ tone='warning' ] ){--os-ui-progress-fill:var( --os-ui-warning-fg,#dba617 )}:host( [ tone='danger' ] ){--os-ui-progress-fill:var( --os-ui-danger,#d63638 )}:host( [ indeterminate ] ) .fill{width:100%;transition:none;background-image:var( --_fill );background-size:300% 300%;background-repeat:no-repeat;animation:os-holo-shimmer 2.4s var( --_holo-loop ) infinite}:host( [ indeterminate ][ tone ] ) .fill{width:33%;background-image:none;animation:os-progress-sweep 1.1s linear infinite}@keyframes os-progress-sweep{0%{transform:translateX( -120% )}100%{transform:translateX( 320% )}}@media ( prefers-reduced-motion:reduce ){.fill{transition:none}:host( [ indeterminate ] ) .fill,:host( [ indeterminate ][ tone ] ) .fill{animation:none;width:100%;opacity:0.6}}`,pe=class pe extends w{constructor(){super(...arguments),this._ownedAriaLabel=null}render(){return h`<div class="root" part="root"> | |
| 157 | + <div class="header" part="header" hidden> | |
| 158 | + <span class="label" part="label"></span> | |
| 159 | + <span class="percent" part="percent"></span> | |
| 160 | + </div> | |
| 161 | + <div class="track" part="track"> | |
| 162 | + <div class="fill" part="fill"></div> | |
| 163 | + </div> | |
| 164 | + </div>`}requestUpdate(){super.requestUpdate(),queueMicrotask(()=>this._paint())}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this._paint())}_paint(){const e=this.shadowRoot;if(!e)return;const t=this._readMax(),s=this.hasAttribute("indeterminate")||t<=0,i=s?0:this._readValue(t),n=s?0:i/t,r=Math.round(n*100),a=this.getAttribute("label")??"",c=this.hasAttribute("show-percent"),d=e.querySelector(".fill");d&&!s?d.style.width=`${(n*100).toFixed(2)}%`:d&&s&&d.style.removeProperty("width");const p=e.querySelector(".header"),u=e.querySelector(".label"),m=e.querySelector(".percent");if(p&&u&&m){const g=a||c&&!s;p.hidden=!g,u.textContent=a,m.hidden=!(c&&!s),m.textContent=`${r}%`}this._syncAria(t,i,s,a);const f=e.querySelector(".track");f&&(f.setAttribute("role","progressbar"),f.setAttribute("aria-valuemin","0"),s?(f.removeAttribute("aria-valuenow"),f.removeAttribute("aria-valuemax")):(f.setAttribute("aria-valuemax",String(t)),f.setAttribute("aria-valuenow",String(i))),a?f.setAttribute("aria-label",a):f.removeAttribute("aria-label"))}_syncAria(e,t,s,i){this.setAttribute("role","progressbar"),this.setAttribute("aria-valuemin","0"),s?(this.removeAttribute("aria-valuenow"),this.removeAttribute("aria-valuemax")):(this.setAttribute("aria-valuemax",String(e)),this.setAttribute("aria-valuenow",String(t)));const n=this.getAttribute("aria-label");i?(n===null||n===this._ownedAriaLabel)&&(this.setAttribute("aria-label",i),this._ownedAriaLabel=i):n!==null&&n===this._ownedAriaLabel&&(this.removeAttribute("aria-label"),this._ownedAriaLabel=null)}_readMax(){const e=this.getAttribute("max");if(e===null)return 100;const t=parseFloat(e);return Number.isFinite(t)?t:100}_readValue(e){const t=parseFloat(this.getAttribute("value")??"0");return!Number.isFinite(t)||t<0?0:t>e?e:t}};pe.props=["value","max","indeterminate","tone","label","showPercent"],pe.styles=[hs],pe.help=void 0;let Be=pe;S("os-progress-bar",Be);const ms=b`:host{display:block;position:relative;color:var( --os-ui-fg,#1d2327 );font-family:var( --os-ui-font,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif );font-size:12px}.head{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;margin-block-end:6px}:host(:not( [legend] ):not( [heading] ) ) .head{display:none}.heading{margin:0;font-size:13px;font-weight:600;color:var( --os-ui-fg,#1d2327 )}.heading[hidden]{display:none}.legend{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin-inline-start:auto}:host(:not( [legend] ) ) .legend{display:none}.chip{display:inline-flex;align-items:center;gap:6px;padding:3px 9px;border:1px solid var( --os-ui-border,#dcdcde );border-radius:999px;background:transparent;color:var( --os-ui-fg-muted,#646970 );font:inherit;cursor:pointer;transition:opacity 0.12s ease,border-color 0.12s ease}.chip[aria-pressed='false']{opacity:0.45}.chip:hover{border-color:var( --os-ui-border-strong,#8c8f94 );color:var( --os-ui-fg,#1d2327 )}.chip:focus-visible{outline:2px solid var( --os-ui-accent,#2271b1 );outline-offset:1px}.count{font-variant-numeric:tabular-nums;color:var( --os-ui-fg,#1d2327 )}.swatch{display:inline-block;width:10px;height:10px;border-radius:3px;flex:none}.swatch,.seg{background:var( --_tone );fill:var( --_tone )}[data-tone='danger']{--_tone:var( --os-ui-danger,#d63638 )}[data-tone='warning']{--_tone:var( --os-ui-warning,#dba617 )}[data-tone='info']{--_tone:var( --os-ui-info-fg,#72aee6 )}[data-tone='success']{--_tone:var( --os-ui-success,#00a32a )}[data-tone='accent']{--_tone:var( --os-ui-accent,#2271b1 )}[data-tone='neutral']{--_tone:var( --os-ui-fg-muted,#646970 )}.chart{position:relative}svg{display:block;inline-size:100%}.grid{stroke:var( --os-ui-border,#dcdcde );stroke-width:1}.tick{fill:var( --os-ui-fg-muted,#646970 );font-size:10px;font-variant-numeric:tabular-nums}.hit{fill:transparent;cursor:crosshair}.hover{fill:var( --os-ui-surface-raised,rgba( 0,0,0,0.04 ) );pointer-events:none}.empty{padding:40px 0;text-align:center;font-size:13px;color:var( --os-ui-fg-muted,#646970 )}.tooltip{position:absolute;inset-block-start:4px;transform:translateX( -50% );min-inline-size:150px;padding:8px 10px;border-radius:6px;border:1px solid var( --os-ui-border,#dcdcde );background:var( --os-ui-surface-elevated,#fff );box-shadow:var( --os-ui-shadow,0 2px 8px rgba( 0,0,0,0.15 ) );pointer-events:none;z-index:2}.tooltip[hidden]{display:none}.tooltip-head{margin-block-end:6px;color:var( --os-ui-fg-muted,#646970 );font-size:11px}.tooltip-row{display:flex;align-items:center;gap:6px;line-height:1.6}.tooltip-label{flex:1}.tooltip-value{font-variant-numeric:tabular-nums;font-weight:600}`,fs="http://www.w3.org/2000/svg",ee=8,gs=20,z=8,bs=40,vs=24,Ke=2,_s=150,ys=new Set(["danger","warning","info","success","accent","neutral"]);function Lt(o,e){if(!o)return e;try{return JSON.parse(o)}catch{return e}}function xs(o){if(o<=5)return Math.max(1,o);const e=Math.pow(10,Math.floor(Math.log10(o)));for(const t of[1,2,5,10])if(t*e>=o)return t*e;return 10*e}function q(o,e){const t=document.createElementNS(fs,o);for(const[s,i]of Object.entries(e))t.setAttribute(s,i);return t}function ks(o,e,t,s){const i=Math.min(3,s/2,t/2);return`M ${o} ${e+s} L ${o} ${e+i} Q ${o} ${e} ${o+i} ${e} L ${o+t-i} ${e} Q ${o+t} ${e} ${o+t} ${e+i} L ${o+t} ${e+s} Z`}const he=class he extends w{constructor(){super(...arguments),this._resize=null,this._tooltip=null}connectedCallback(){super.connectedCallback(),typeof ResizeObserver<"u"&&(this._resize=new ResizeObserver(()=>this.paint()),this._resize.observe(this))}disconnectedCallback(){this._resize?.disconnect(),this._resize=null}requestUpdate(){super.requestUpdate(),queueMicrotask(()=>this.paint())}get seriesList(){const e=Lt(this.getAttribute("series"),[]);return Array.isArray(e)?e.filter(t=>!!t&&typeof t=="object"&&typeof t.key=="string").map(t=>({key:t.key,label:typeof t.label=="string"?t.label:t.key,tone:t.tone&&ys.has(t.tone)?t.tone:"neutral"})):[]}get columnList(){const e=Lt(this.getAttribute("columns"),[]);return Array.isArray(e)?e.map(t=>Array.isArray(t)?t.map(s=>Number.isFinite(Number(s))?Math.max(0,Number(s)):0):[]):[]}get hiddenSet(){return new Set((this.getAttribute("hidden-series")??"").split(",").map(e=>e.trim()).filter(e=>e!==""))}totals(){const e=this.seriesList,t=e.map(()=>0);for(const s of this.columnList)e.forEach((i,n)=>{t[n]+=s[n]??0});return t}toggleSeries(e){const t=this.hiddenSet;t.has(e)?t.delete(e):t.add(e);const s=Array.from(t);s.length>0?this.setAttribute("hidden-series",s.join(",")):this.removeAttribute("hidden-series"),this.emit("os-series-toggle",{key:e,hidden:s})}render(){const e=this.seriesList,t=this.totals(),s=this.hiddenSet,i=this.getAttribute("heading")??"";return h` | |
| 165 | + <div class="head" part="head"> | |
| 166 | + <h2 class="heading" part="heading" ?hidden=${i===""}>${i}</h2> | |
| 167 | + <div class="legend" part="legend" role="group"> | |
| 168 | + ${e.map((n,r)=>h` | |
| 169 | + <button | |
| 170 | + type="button" | |
| 171 | + class="chip" | |
| 172 | + data-tone=${n.tone??"neutral"} | |
| 173 | + aria-pressed=${s.has(n.key)?"false":"true"} | |
| 174 | + @click=${()=>this.toggleSeries(n.key)} | |
| 175 | + > | |
| 176 | + <span class="swatch"></span> | |
| 177 | + <span class="label">${n.label}</span> | |
| 178 | + <span class="count">${t[r].toLocaleString()}</span> | |
| 179 | + </button> | |
| 180 | + `)} | |
| 181 | + </div> | |
| 182 | + </div> | |
| 183 | + <div class="chart" part="chart"></div> | |
| 184 | + <div class="tooltip" part="tooltip" hidden></div> | |
| 185 | + `}paint(){const e=this.shadowRoot,t=e?.querySelector(".chart"),s=e?.querySelector(".tooltip");if(!t||!s)return;this._tooltip=s,s.hidden=!0,t.textContent="";const i=this.columnList,n=i.some(y=>y.some(k=>k>0));if(i.length===0||!n){const y=document.createElement("div");y.className="empty",y.textContent=this.getAttribute("empty")??"",t.appendChild(y);return}const r=this.seriesList,a=this.hiddenSet,c=r.map((y,k)=>a.has(y.key)?-1:k).filter(y=>y>=0),d=parseInt(this.getAttribute("height")??"",10),p=Number.isFinite(d)&&d>40?d:_s,u=Math.max(280,this.clientWidth||640),m=u-z-bs,f=p-ee-gs,g=i.length,_=m/g,v=Math.max(2,Math.min(vs,_-Ke)),L=i.reduce((y,k)=>{const N=c.reduce((P,Ce)=>P+(k[Ce]??0),0);return Math.max(y,N)},0),A=xs(L),T=f/A,C=q("svg",{width:String(u),height:String(p),viewBox:`0 0 ${u} ${p}`,role:"img"});for(const y of[0,.5,1]){const k=A*y,N=ee+f-k*T;C.appendChild(q("line",{class:"grid",x1:String(z),y1:String(N),x2:String(z+m),y2:String(N)}));const P=q("text",{class:"tick",x:String(z+m+6),y:String(N+3.5)});P.textContent=Number.isInteger(k)?k.toLocaleString():String(k),C.appendChild(P)}const H=Number(this.getAttribute("start"))||0,Se=Number(this.getAttribute("end"))||H+g,Wt=Math.max(1,(Se-H)/g),Us=Se-H>36*3600,Ht=y=>new Date(y*1e3).toLocaleString([],Us?{month:"short",day:"numeric"}:{hour:"2-digit",minute:"2-digit"}),js=y=>new Date(y*1e3).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),Bs=[[H,z,"start"],[H+(Se-H)/2,z+m/2,"middle"],[Se,z+m,"end"]];for(const[y,k,N]of Bs){const P=q("text",{class:"tick",x:String(k),y:String(p-5),"text-anchor":N});P.textContent=Ht(y),C.appendChild(P)}const Ae=q("rect",{class:"hover",y:String(ee),width:String(_),height:String(f),visibility:"hidden"});C.appendChild(Ae),i.forEach((y,k)=>{const N=z+k*_+(_-v)/2;let P=ee+f;const Ce=c.filter(ge=>(y[ge]??0)>0),Ks=Ce[Ce.length-1];for(const ge of c){const Ot=y[ge]??0;if(Ot===0)continue;const Ut=r[ge].tone??"neutral",Qe=Ot*T,et=P-Qe;ge===Ks?C.appendChild(q("path",{class:"seg","data-tone":Ut,d:ks(N,et,v,Math.max(1.5,Qe))})):C.appendChild(q("rect",{class:"seg","data-tone":Ut,x:String(N),y:String(et+Ke),width:String(v),height:String(Math.max(1.5,Qe-Ke))})),P=et}const Je=q("rect",{class:"hit",x:String(z+k*_),y:String(ee),width:String(_),height:String(f)});Je.addEventListener("pointerenter",()=>{Ae.setAttribute("x",String(z+k*_)),Ae.setAttribute("visibility","visible"),this.showTooltip(k,y,_,u,{head:`${js(H+k*Wt)} – ${Ht(H+(k+1)*Wt)}`,series:r,visibleIndexes:c})}),Je.addEventListener("pointerleave",()=>{Ae.setAttribute("visibility","hidden"),s.hidden=!0}),C.appendChild(Je)}),t.appendChild(C)}showTooltip(e,t,s,i,n){const r=this._tooltip;if(!r)return;r.textContent="";const a=document.createElement("div");a.className="tooltip-head",a.textContent=n.head,r.appendChild(a);let c=0;for(const p of[...n.visibleIndexes].reverse()){const u=t[p]??0;if(u===0)continue;c++;const m=document.createElement("div");m.className="tooltip-row";const f=document.createElement("span");f.className="swatch",f.dataset.tone=n.series[p].tone??"neutral";const g=document.createElement("span");g.className="tooltip-label",g.textContent=n.series[p].label;const _=document.createElement("span");_.className="tooltip-value",_.textContent=u.toLocaleString(),m.append(f,g,_),r.appendChild(m)}if(c===0){const p=document.createElement("div");p.className="tooltip-row",p.textContent="—",r.appendChild(p)}r.hidden=!1;const d=z+e*s+s/2;r.style.left=`${Math.max(60,Math.min(d,i-60))}px`}};he.props=["heading","series","columns","start","end","hidden-series","legend","empty","height"],he.styles=[ms],he.help=void 0;let Ve=he;S("os-histogram",Ve);const ws=b` ${I}:host{display:inline-flex;position:relative;padding:3px;background:var( --os-ui-segmented-bg,var( --os-ui-hover,rgba( 0,0,0,0.05 ) ) );border-radius:8px;gap:2px;box-shadow:var( --os-ui-segmented-edge,none )}.os-segmented__thumb{position:absolute;top:3px;bottom:3px;left:0;width:var( --_thumb-w,0px );border-radius:6px;background-color:var( --os-ui-segmented-selected-bg,color-mix( in srgb,var( --os-ui-accent,#2271b1 ) var( --os-ui-segmented-selected-accent,100% ),var( --os-ui-segmented-selected-base,var( --os-ui-surface,#fff ) ) ) );background-image:var( --os-ui-segmented-selected-image,none );box-shadow:var( --os-ui-segmented-selected-shadow,none );background-size:220% 220%;background-position:22% 28%;background-repeat:no-repeat;transform:translateX( var( --_thumb-x,0px ) );pointer-events:none;opacity:0}:host( [ data-thumb ] ) .os-segmented__thumb{opacity:1}:host( [ data-thumb-ready ] ) .os-segmented__thumb{transition:transform var( --_holo-t-slow ) var( --_holo-spring ),width var( --_holo-t-slow ) var( --_holo-ease ),opacity var( --_holo-t-fast ) linear}@media ( prefers-reduced-motion:reduce ){:host( [ data-thumb-ready ] ) .os-segmented__thumb{transition-duration:1ms}}`,$s=b` ${I} ${Le}:host{flex:1 1 auto;min-width:0;--_holo-sheen:var( --os-ui-segmented-hover-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% ) ) )}button{appearance:none;display:block;width:100%;padding:6px 13px;background:transparent;border:0;font:inherit;font-size:13px;color:var( --os-ui-fg-muted,#646970 );cursor:pointer;border-radius:6px;transition:background-color var( --_holo-t ) ease,color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease,background-position var( --_holo-t ) ease;white-space:nowrap}button:hover{color:var( --os-ui-fg,#1d2327 )}:host(:not( [ aria-checked='true' ] ) ) button:hover{background-color:var( --os-ui-segmented-hover-bg,transparent )}button:focus-visible{outline:none;box-shadow:var( --_holo-focus )}:host( [ aria-checked='true' ] ) button{color:var( --os-ui-segmented-selected-fg,color-mix( in srgb,var( --os-ui-accent-ink,var( --os-ui-fg-on-accent,#fff ) ) var( --os-ui-segmented-selected-accent,100% ),var( --os-ui-fg,#1d2327 ) ) );transition-duration:var( --_holo-t-fast )}:host( [ aria-checked='true' ] ) button::before{display:none}`,me=class me extends w{render(){return this.setAttribute("role","radio"),h` | |
| 186 | + <button | |
| 187 | + type="button" | |
| 188 | + class="os-holo-sheen" | |
| 189 | + @click=${()=>this._onPick()} | |
| 32 | 190 | > |
| 33 | - ${e.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 | - ${e.labels.perPage} | |
| 38 | - <os-select | |
| 39 | - os-bind=${e.perPageBind??"perPage"} | |
| 40 | - os-action=${e.perPageAction??"filter"} | |
| 41 | - value=${String(s)} | |
| 42 | - aria-label=${e.labels.perPage} | |
| 43 | - >${i.map(r=>h`<os-option value=${r}>${r}</os-option>`)}</os-select> | |
| 44 | - </label> | |
| 191 | + <slot></slot> | |
| 192 | + </button> | |
| 193 | + `}_onPick(){this.emit("os-segment-pick",{value:this.value})}};me.props=["value"],me.styles=[$s],me.help=void 0;let Ye=me;S("os-segment",Ye);const fe=class fe extends w{constructor(){super(...arguments),this._resizeObserver=null}connectedCallback(){super.connectedCallback(),this.addEventListener("os-segment-pick",e=>{const t=e.detail;e.stopPropagation(),this.value=t.value,this.emit("os-pick",{value:t.value})}),typeof ResizeObserver<"u"&&(this._resizeObserver=new ResizeObserver(()=>this._placeThumb()),this._resizeObserver.observe(this))}disconnectedCallback(){this._resizeObserver?.disconnect(),this._resizeObserver=null}_placeThumb(){if(!this.shadowRoot?.querySelector(".os-segmented__thumb"))return;const t=this.value,s=Array.from(this.querySelectorAll(":scope > os-segment")).find(d=>d.getAttribute("value")===t);if(!s||this.offsetWidth===0){this.removeAttribute("data-thumb");return}const i=this.getBoundingClientRect(),n=i.width/this.offsetWidth,r=Math.abs(n-1)<.02?1:n;if(!(r>0))return;const a=s.getBoundingClientRect(),c=d=>`${Math.round(d*100)/100}px`;this.style.setProperty("--_thumb-x",c((a.left-i.left)/r)),this.style.setProperty("--_thumb-w",c(a.width/r)),this.setAttribute("data-thumb",""),this.hasAttribute("data-thumb-ready")||requestAnimationFrame(()=>this.setAttribute("data-thumb-ready",""))}set items(e){const t=this.querySelectorAll(":scope > os-segment");for(const n of Array.from(t))n.remove();for(const n of e){const r=document.createElement("os-segment");r.setAttribute("value",n.value),r.textContent=n.label,this.appendChild(r)}const s=this.value;!(s!==null&&e.some(n=>n.value===s))&&e.length>0?this.value=e[0].value:this.requestUpdate()}render(){const e=this.label||"";e&&this.setAttribute("aria-label",e),this.setAttribute("role","radiogroup");const t=this.value;return queueMicrotask(()=>{const s=this.querySelectorAll("os-segment");for(const i of Array.from(s)){const n=i.getAttribute("value");i.setAttribute("aria-checked",n===t?"true":"false")}this._placeThumb()}),h`<span class="os-segmented__thumb" aria-hidden="true"></span | |
| 194 | + ><slot></slot>`}};fe.props=["value","label"],fe.styles=[ws],fe.help={title:"Segmented",summary:"iOS-style segmented radio group. Pill-shaped bar of equal-width <os-segment> children where exactly one is active.",status:"stable",props:[{name:"value",type:"string",description:"Currently selected segment value. Mirrored onto child aria-checked."},{name:"label",type:"string",description:"aria-label for the radiogroup."}],slots:[{name:"(default)",description:'<os-segment value="…"> children.'}],events:[{name:"os-pick",description:"Fires when the selected segment changes.",detail:"{ value: string }"}],cssProps:[{name:"--os-window-bg",description:"Pill background."},{name:"--os-ui-fg",description:"Active label colour."},{name:"--os-ui-fg-muted",description:"Inactive label colour."}],example:h` | |
| 195 | + <os-segmented value="md" label="Dock size"> | |
| 196 | + <os-segment value="sm">Small</os-segment> | |
| 197 | + <os-segment value="md">Medium</os-segment> | |
| 198 | + <os-segment value="lg">Large</os-segment> | |
| 199 | + </os-segmented> | |
| 200 | + `};let Xe=fe;S("os-segmented",Xe);const j=864e5;function Y(o){const e=o.registered_date;return e?Date.parse(/(?:Z|[+-]\d\d:\d\d)$/i.test(e)?e:`${e}Z`):NaN}function E(o,e){const t=o.openstation_user_stats?.[e];return typeof t=="number"&&Number.isFinite(t)&&t>0?t:0}function Ss(o,e){return o.filter(t=>E(t,e)>0).sort((t,s)=>E(s,e)-E(t,e)||t.name.localeCompare(s.name)||t.id-s.id)}function As(o,e=Date.now()){const t=o.filter(d=>d.openstation_user_stats),s={posts:0,pages:0,comments:0};for(const d of t)for(const p of["posts","pages","comments"])s[p]+=E(d,p);const i=o.filter(d=>Y(d)>0&&Y(d)<=e).sort((d,p)=>Y(p)-Y(d)),n=o.filter(d=>typeof d.openstation_last_login=="number"&&d.openstation_last_login>0&&d.openstation_last_login*1e3<=e).sort((d,p)=>p.openstation_last_login-d.openstation_last_login),r=Math.floor(e/j)*j+j,a=r-56*j,c=Array.from({length:8},()=>[0]);for(const d of i){const p=Math.floor((Y(d)-a)/(7*j));p>=0&&p<8&&c[p][0]++}return{totals:s,known:t.length,contributors:t.filter(d=>E(d,"posts")+E(d,"pages")+E(d,"comments")>0).length,online:o.filter(d=>d.openstation_presence==="online"),away:o.filter(d=>d.openstation_presence==="inactive"),unknownPresence:o.filter(d=>!["online","inactive","offline"].includes(d.openstation_presence||"")).length,recent:i.filter(d=>Y(d)>=e-30*j).length,registered:i,logins:n,active30:n.filter(d=>d.openstation_last_login*1e3>=e-30*j).length,unrecorded:o.length-n.length,start:a/1e3,end:r/1e3,weeks:c}}const R=o=>o.toLocaleString(),Tt=o=>({posts:l("Posts"),pages:l("Pages"),comments:l("Comments")})[o];function te(o,e){return h`<os-button variant="ghost" class="os-community__person" @click=${()=>Q(o.id,e)}>${o.name||o.slug}</os-button>`}function we(o,e,t,s){return h`<article class="os-community__metric"><span class="dashicons ${s}" aria-hidden="true"></span><strong>${o}</strong><div><h3>${e}</h3><p>${t}</p></div></article>`}function Cs(o,e,t,s,i){const n=Array.isArray(o)?{...As(o),total:o.length,onlineCount:o.filter(u=>u.openstation_presence==="online").length,awayCount:o.filter(u=>u.openstation_presence==="inactive").length}:o,r=Array.isArray(o)?Ss(o,s):o.leaders[s],a=r[0],c=[...n.online,...n.away],d=a?E(a,s):1,p=n.totals.posts+n.totals.pages;return h`<div class="os-community"> | |
| 201 | + <div class="os-community__metrics" aria-label=${l("Community overview")}> | |
| 202 | + ${we(R(n.onlineCount),l("Online now"),x(l("%d away at last refresh"),n.awayCount),"dashicons-admin-users")} | |
| 203 | + ${we(R(n.recent),l("New accounts"),l("Registered in the last 30 days"),"dashicons-welcome-add-page")} | |
| 204 | + ${we(R(n.active30),l("Checked in"),l("Latest sign-in within 30 days"),"dashicons-clock")} | |
| 205 | + ${we(n.known?R(n.contributors):"—",l("Contributors"),l("Published work or approved comments"),"dashicons-edit")} | |
| 45 | 206 | </div> |
| 46 | - </footer>`}function He(e,t=null){const n=t??(typeof document<"u"?document.documentElement:null);if(!!n&&F(n)){e.hasAttribute("stacked")||e.setAttribute("stacked","");const i=e.getAttribute("sticky-columns");return i!==null&&(e.setAttribute("data-os-sticky-columns",i),e.removeAttribute("sticky-columns")),!0}e.hasAttribute("stacked")&&e.removeAttribute("stacked");const o=e.getAttribute("data-os-sticky-columns");return o!==null&&(e.setAttribute("sticky-columns",o),e.removeAttribute("data-os-sticky-columns")),!1}function le(e){return Array.from(e.selection??[],String)}function qe(){let e=null,t=!1,n=null,s=null;return{invalidateColumns(){e=null},invalidateData(){s=null},sync(o){const i={phone:!1,columnsChanged:!1,dataChanged:!1,selectionChanged:!1},r=o.table;if(!r)return i;const c=o.rowId??(l=>l.id),d=He(r);if(i.phone=d,d!==e&&(e=d,r.columns=o.columns(d),i.columnsChanged=!0),t||(t=!0,o.wire?.(r)),o.listKey!==n&&(n=o.listKey,le(r).length>0&&(r.clearSelection(),i.selectionChanged=!0,o.onSelection?.([]))),o.fingerprint!==s){s=o.fingerprint,r.data=o.rows,i.dataChanged=!0;const l=new Set(o.rows.map(f=>String(c(f)))),u=le(r),p=u.filter(f=>l.has(f));p.length!==u.length&&(r.selection=p,i.selectionChanged=!0,o.onSelection?.(p))}return i}}}function Xe(e,t){const n=t.local??{},s={id:e,hasLocal:r=>Object.prototype.hasOwnProperty.call(n,r),runLocal:(r,c,d,l)=>{const u=n[r];if(!u)return c;const p={...c},f=u(p,d,l);return f===void 0?p:f},render:r=>{oe(t.view(r),r.root),t.updated?.(r)},mounted:r=>t.mounted?.(r)},{placeholder:o}=t;o&&(s.placeholder=r=>o(r));const i=window;return(i.openStationApps??(i.openStationApps={}))[e]=s,s}const w=class w 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(ce)}connectedCallback(){this._adoptStyles(),this.requestUpdate()}attributeChangedCallback(t,n,s){if(n===s)return;const o=Ge(t);this._propValues[o]=s,this.requestUpdate()}get classNames(){return Array.from(this.classList)}set classNames(t){if(t==null){this.removeAttribute("class");return}const s=(Array.isArray(t)?t:String(t).split(/\s+/)).map(o=>String(o).trim()).filter(o=>o!=="");this.className=s.join(" ")}requestUpdate(){this._scheduleRender()}emit(t,n){return this.dispatchEvent(new CustomEvent(t,{detail:n,bubbles:!0,composed:!0}))}_installPropAccessors(){const t=this.constructor;for(const n of t.props){if(Object.getOwnPropertyDescriptor(this,n))continue;const s=ce(n);Object.defineProperty(this,n,{get:()=>n in this._propValues?this._propValues[n]:this.getAttribute(s),set:o=>{let i;o==null||o===!1?i=null:o===!0?i="":i=String(o),this._propValues[n]=i,i===null?this.removeAttribute(s):this.setAttribute(s,i),this.requestUpdate()},enumerable:!0,configurable:!0})}}_scheduleRender(){this._renderScheduled||!this.isConnected||(this._renderScheduled=!0,queueMicrotask(()=>{this._renderScheduled=!1,this.isConnected&&oe(this.render(),this._renderRoot)}))}_adoptStyles(){const t=this.constructor;if(t.styles.length!==0)if(t.shadow&&this.shadowRoot){const n=t.styles.map(s=>s.sheet).filter(s=>s!==null);if(this.shadowRoot.adoptedStyleSheets=n,n.length!==t.styles.length){for(const s of t.styles)if(!s.sheet){const o=document.createElement("style");o.textContent=s.cssText,this.shadowRoot.appendChild(o)}}}else this._adoptLightStyles(t)}_adoptLightStyles(t){if(!w._lightStylesAdopted.has(t)){w._lightStylesAdopted.add(t);for(const n of t.styles){const s=document.createElement("style");s.dataset.osUi=this.tagName.toLowerCase(),s.textContent=n.cssText,document.head.appendChild(s)}}}};w.props=[],w.styles=[],w.shadow=!0,w._lightStylesAdopted=new WeakSet;let P=w;function H(e,t){customElements.get(e)||customElements.define(e,t)}function ce(e){return e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}function Ge(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}const Ke=(()=>{try{return typeof new CSSStyleSheet().replaceSync=="function"}catch{return!1}})();function q(e,...t){let n=e[0];for(let s=1;s<e.length;s++){const o=t[s-1];if(typeof o=="string"||typeof o=="number")n+=String(o);else if(o&&o.__wpdCss)n+=o.cssText;else throw new TypeError("[os-ui] css`` interpolations must be strings, numbers, or other css`` results. Got: "+typeof o);n+=e[s]}if(Ke){const s=new CSSStyleSheet;return s.replaceSync(n),{__wpdCss:!0,sheet:s,cssText:n}}return{__wpdCss:!0,sheet:null,cssText:n}}const Ye=q`:host{display:inline;color:inherit;font:inherit}`,U=new Set;let N=null;const Be=3e4;function Ve(){N===null&&(N=window.setInterval(()=>{for(const e of U)e.tick()},Be))}function Ze(){N!==null&&U.size===0&&(window.clearInterval(N),N=null)}function Qe(e){if(!e)return null;const t=n=>{const s=new Date(n);return Number.isNaN(s.getTime())?null:s};return Je(e)?t(e):t(e.replace(" ","T")+"Z")}function Je(e){const t=Math.max(e.indexOf("T"),e.indexOf(" ")),n=t===-1?"":e.slice(t+1);return/(?:[Zz]|[+-]\d{2}:?\d{2})$/.test(n)}let X=null,G=null;function de(){return typeof navigator<"u"&&navigator.language||"en"}function et(){return X||(X=new Intl.RelativeTimeFormat(de(),{numeric:"auto"})),X}function ue(){return G||(G=new Intl.RelativeTimeFormat(de(),{numeric:"always",style:"narrow"})),G}function tt(e,t){const n=et(),s=e.getTime()-t,o=Math.round(s/1e3),i=Math.abs;return i(o)<45?n.format(0,"second"):pe(n,o)}function pe(e,t){const n=Math.abs,s=Math.round(t/60);if(n(s)<45)return e.format(s,"minute");const o=Math.round(s/60);if(n(o)<22)return e.format(o,"hour");const i=Math.round(o/24);if(n(i)<26)return e.format(i,"day");const r=Math.round(i/30);if(n(r)<11)return e.format(r,"month");const c=Math.round(i/365);return e.format(c,"year")}function nt(e,t){const n=Math.round((e.getTime()-t)/1e3),s=Math.abs;return s(n)<45?ue().format(0,"second"):s(n)>604800?e.toLocaleDateString(void 0,{month:"short",day:"numeric"}):pe(ue(),n)}const M=class M extends P{connectedCallback(){super.connectedCallback(),U.add(this),Ve()}disconnectedCallback(){U.delete(this),Ze()}tick(){this.requestUpdate()}render(){const t=this.datetime,n=Qe(t);if(!n)return h`<span>${t??""}</span>`;const s=Date.now(),o=this.hasAttribute("compact")?nt(n,s):tt(n,s),i=n.toLocaleString();return h`<time datetime=${n.toISOString()} title=${i} | |
| 47 | - >${o}</time | |
| 48 | - >`}};M.props=["datetime","compact"],M.styles=[Ye],M.help=void 0;let K=M;H("os-relative-time",K);function fe(e){if(typeof e=="number")return e>0?e*1e3:NaN;const t=String(e??"");if(!t||t.startsWith("0000-00-00"))return NaN;let n=t.includes(" ")?t.replace(" ","T"):t;!/Z$/.test(n)&&!/[+-]\d{2}:?\d{2}$/.test(n)&&(n+="Z");const s=Date.parse(n);return Number.isFinite(s)?s:NaN}function st(e){const t=fe(e);if(!Number.isFinite(t)){const s=document.createElement("span");return s.textContent="—",s}const n=document.createElement("os-relative-time");return n.setAttribute("datetime",new Date(t).toISOString()),n.title=re(t,"datetime"),n}function ot(e){ae(e).catch(()=>!1)}function it(e){const t="ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz23456789!@#$%^&*-_=+",n=new Uint32Array(e);crypto.getRandomValues(n);let s="";for(let o=0;o<e;o+=1)s+=t[n[o]%t.length];return s}function he(e){return Object.entries(e).map(([t,n])=>h`<os-option value=${t}>${n}</os-option>`)}function rt(e,t){const n=e.defaultRole??"subscriber",s=e.assignableRoles&&Object.keys(e.assignableRoles).length>0?e.assignableRoles:{[n]:n},o=e.locales??{"":a("Site default")},i=r=>{r.preventDefault(),r.stopPropagation();const d=r.currentTarget.closest("os-form")?.querySelector('os-text-field[name="password"]'),l=it(18);d&&(d.value=l,d.setAttribute("value",l)),ot(l),t(a("Generated password copied to clipboard."))};return h`<os-form | |
| 207 | + <div class="os-community__grid"> | |
| 208 | + <section class="os-community__panel os-community__work"> | |
| 209 | + <header><div><span class="os-community__eyebrow">${l("MADE BY YOUR PEOPLE")}</span><h3>${l("The work we share")}</h3></div><span class="os-community__stamp" aria-hidden="true">↗</span></header> | |
| 210 | + <div class="os-community__totals"><div><strong>${n.known?R(p):"—"}</strong><span>${l("published pieces")}</span></div><p>${x(l("%1$s posts · %2$s pages · %3$s approved comments"),n.known?R(n.totals.posts):"—",n.known?R(n.totals.pages):"—",n.known?R(n.totals.comments):"—")}</p></div> | |
| 211 | + <os-segmented label=${l("Rank contributions by")} value=${s} @os-pick=${u=>{const m=u.detail.value;["posts","pages","comments"].includes(m)&&i(m)}}>${["posts","pages","comments"].map(u=>h`<os-segment value=${u}>${Tt(u)}</os-segment>`)}</os-segmented> | |
| 212 | + ${a?h`<div class="os-community__spotlight">${U(a,58)}<div><span class="os-community__eyebrow">${l("LEADING THIS COMMUNITY")}</span>${te(a,e)}<p>${a.roles.map(u=>t.allRoles?.[u]||u).join(" · ")}</p></div><strong>${R(E(a,s))}<small>${Tt(s)}</small></strong></div>`:h`<p class="os-community__empty">${l("No contributions of this kind yet.")}</p>`} | |
| 213 | + <ol class="os-community__leaders" start="2">${r.slice(1,6).map((u,m)=>h`<li><span class="os-community__rank">${m+2}</span>${U(u,30)}<div>${te(u,e)}<div class="os-community__track" aria-hidden="true"><i style=${`inline-size:${E(u,s)/d*100}%`}></i></div></div><strong>${R(E(u,s))}</strong></li>`)}</ol> | |
| 214 | + <p class="os-community__footnote">${l("All-time published work and approved comments.")}${n.known<n.total?` ${x(l("Content counts are unavailable for %d profiles."),n.total-n.known)}`:""}</p> | |
| 215 | + </section> | |
| 216 | + <section class="os-community__panel os-community__presence-panel"> | |
| 217 | + <header><div><span class="os-community__eyebrow">${l("AT LAST REFRESH")}</span><h3>${l("Around the station")}</h3></div><span class="os-community__status-dot" data-online=${n.onlineCount>0} aria-hidden="true"></span></header> | |
| 218 | + <div class="os-community__presence-summary"><strong>${R(n.onlineCount+n.awayCount)}</strong><p>${l("online or away")}<span>${x(l("%1$d online · %2$d away"),n.onlineCount,n.awayCount)}</span></p></div> | |
| 219 | + <div class="os-community__present">${c.slice(0,6).map(u=>h`<div>${U(u,38)}<div>${te(u,e)}<p>${u.openstation_presence==="online"?l("Online now"):l("Away")}${u.id===t.currentUserId?` · ${l("You")}`:""}</p></div></div>`)}</div> | |
| 220 | + ${c.length?"":h`<p class="os-community__empty">${l("A quiet moment. Nobody across this site is marked online or away.")}</p>`} | |
| 221 | + <p class="os-community__footnote">${n.onlineCount+n.awayCount>6?x(l("And %d more across this site."),n.onlineCount+n.awayCount-6):""}${l("Presence is a snapshot, refreshed with this view.")}${n.unknownPresence?` ${x(l("%d profiles have no presence data."),n.unknownPresence)}`:""}</p> | |
| 222 | + </section> | |
| 223 | + <section class="os-community__panel os-community__arrivals"> | |
| 224 | + <header><div><span class="os-community__eyebrow">${l("ROOM FOR SOMEONE NEW")}</span><h3>${l("New faces, new possibilities")}</h3></div><span class="dashicons dashicons-groups" aria-hidden="true"></span></header> | |
| 225 | + <p class="os-community__description">${l("Account registrations over the last eight weeks. Each bar is one week.")}</p> | |
| 226 | + <os-histogram height="135" aria-label=${l("Weekly account registrations across this site")} series=${JSON.stringify([{key:"accounts",label:l("New accounts"),tone:"info"}])} columns=${JSON.stringify(n.weeks)} start=${n.start} end=${n.end} empty=${l("No registrations in these eight weeks.")}></os-histogram> | |
| 227 | + <h4>${l("Newest accounts")}</h4><div class="os-community__newcomers">${n.registered.slice(0,4).map(u=>h`<div>${U(u,34)}<div>${te(u,e)}<p>${l("Registered")} <os-relative-time datetime=${u.registered_date||""}></os-relative-time></p></div></div>`)}</div> | |
| 228 | + ${n.registered.length?"":h`<p class="os-community__empty">${l("No registration dates available.")}</p>`} | |
| 229 | + </section> | |
| 230 | + <section class="os-community__panel os-community__checkins"> | |
| 231 | + <header><div><span class="os-community__eyebrow">${l("FAMILIAR FACES")}</span><h3>${l("Latest check-ins")}</h3></div><span class="dashicons dashicons-clock" aria-hidden="true"></span></header> | |
| 232 | + <p class="os-community__description">${l("One latest recorded sign-in per person.")}</p> | |
| 233 | + <ol class="os-community__timeline">${n.logins.slice(0,6).map(u=>h`<li>${U(u,34)}<div>${te(u,e)}<p><os-relative-time datetime=${new Date(u.openstation_last_login*1e3).toISOString()}></os-relative-time></p></div><span class="os-community__login-mark" aria-hidden="true">↗</span></li>`)}</ol> | |
| 234 | + ${n.logins.length?"":h`<p class="os-community__empty">${l("No sign-ins recorded across this site yet.")}</p>`} | |
| 235 | + <p class="os-community__footnote">${x(l("%d profiles have no recorded sign-in. This is not a complete login history."),n.unrecorded)}</p> | |
| 236 | + </section> | |
| 237 | + </div> | |
| 238 | + </div>`}const zs=b` .os-community__loading{max-inline-size:520px;padding:48px 24px;margin:40px auto;text-align:center;color:var( --os-ui-fg,#1d2327 )}.os-community__loading>.dashicons{font-size:40px;inline-size:40px;block-size:40px;color:var( --os-ui-fg-muted,#646970 )}.os-community__loading h3{font-size:24px;font-weight:500;color:inherit}.os-community__loading p{font-size:12px;line-height:1.7;color:var( --os-ui-fg-muted,#646970 )}.os-community__loading os-progress-bar{display:block;margin-block:24px 12px}.os-community{padding:22px 24px 8px;max-inline-size:1440px;margin-inline:auto}.os-community__metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-block-end:20px}.os-community__metric{display:grid;grid-template-columns:auto 1fr;column-gap:14px;row-gap:8px;padding:18px;border:1px solid var( --os-ui-border,#dcdcde );border-radius:14px;background:var( --os-ui-surface,#fff )}.os-community__metric>.dashicons{grid-column:1 / -1;color:var( --os-ui-fg-muted,#646970 );font-size:18px}.os-community__metric strong{font-size:38px;font-weight:500;line-height:1;letter-spacing:-.05em;font-variant-numeric:tabular-nums;align-self:center}.os-community__metric h3{margin:0 0 3px;font-size:12px;color:inherit}.os-community__metric p{margin:0;font-size:10px;line-height:1.5;color:var( --os-ui-fg-muted,#646970 )}.os-community__grid{display:grid;grid-template-columns:minmax(0,1.35fr) minmax(0,1fr);gap:20px;align-items:start}.os-community__panel{min-inline-size:0;padding:24px;border:1px solid var( --os-ui-border,#dcdcde );border-radius:18px;background:var( --os-ui-surface,#fff )}.os-community__panel>header{display:flex;gap:12px;align-items:center;justify-content:space-between;margin-block-end:16px}.os-community__panel h3{margin:5px 0 0;font-size:22px;font-weight:500;letter-spacing:-.035em;line-height:1.15;color:inherit}.os-community__eyebrow{font-size:9px;letter-spacing:.13em;color:var( --os-ui-fg-muted,#646970 )}.os-community__stamp{font-size:32px;font-weight:300;color:var( --os-ui-accent,#2271b1 )}.os-community__totals{margin-block:6px 18px}.os-community__totals>div{display:flex;align-items:baseline;gap:10px}.os-community__totals strong{font-size:clamp(40px,4.8cqi,60px);line-height:1;font-weight:500;letter-spacing:-.06em;font-variant-numeric:tabular-nums}.os-community__totals span{font-size:13px}.os-community__totals p,.os-community__description{font-size:11px;line-height:1.6;color:var( --os-ui-fg-muted,#646970 );margin:9px 0 0}.os-community__work os-segmented{display:flex;margin-block-end:18px}.os-community__work os-segment{flex:1}.os-community__spotlight{display:flex;gap:14px;align-items:center;padding:18px;border-radius:12px;background:var( --os-ui-surface-sunken,#f6f7f7 );border-inline-start:3px solid var( --os-ui-accent,#2271b1 )}.os-community__spotlight>div{flex:1;min-inline-size:0}.os-community__person{display:block;max-inline-size:100%;--os-ui-button-padding:0}.os-community__person::part(button){padding:0;min-block-size:0;border:0;background:transparent;color:var( --os-ui-fg,#1d2327 );font-size:13px;font-weight:600;line-height:1.3;text-align:start;white-space:normal;overflow-wrap:anywhere}.os-community__spotlight .os-community__person{margin-block:4px}.os-community__spotlight .os-community__person::part(button){font-size:19px;letter-spacing:-.025em}.os-community__spotlight p{font-size:10px;color:var( --os-ui-fg-muted,#646970 );margin:0}.os-community__spotlight>strong{text-align:end;font-size:30px;font-weight:500;line-height:1;font-variant-numeric:tabular-nums}.os-community__spotlight small{display:block;font-size:9px;font-weight:400;margin-block-start:6px;color:var( --os-ui-fg-muted,#646970 )}.os-community__leaders{list-style:none;padding:0;margin:12px 0}.os-community__leaders li{display:flex;gap:12px;align-items:center;padding-block:9px}.os-community__rank{inline-size:12px;font-size:10px;color:var( --os-ui-fg-muted,#646970 );font-variant-numeric:tabular-nums}.os-community__leaders li>div{flex:1;min-inline-size:0}.os-community__leaders li>strong{font-size:15px;font-weight:500;font-variant-numeric:tabular-nums}.os-community__track{margin-block-start:6px;block-size:4px;border-radius:4px;overflow:hidden;background:var( --os-ui-surface-subtle,#f0f0f1 )}.os-community__track i{display:block;block-size:100%;border-radius:inherit;background:var( --os-ui-accent,#2271b1 )}.os-community__footnote{border-block-start:1px solid var( --os-ui-surface-subtle,#f0f0f1 );padding-block-start:12px;margin:16px 0 0;font-size:10px;line-height:1.6;color:var( --os-ui-fg-muted,#646970 )}.os-community__presence-panel{background:radial-gradient(ellipse at 100% 0,var( --os-ui-surface-subtle,#f0f0f1 ),transparent 70%),var( --os-ui-surface,#fff )}.os-community__status-dot{color:var( --os-ui-fg-muted,#646970 );inline-size:8px;block-size:8px;border-radius:50%;background:currentColor}.os-community__status-dot[data-online="true"]{color:var( --os-ui-success-fg,#008a20 )}.os-community__presence-summary{display:flex;gap:15px;align-items:center;margin-block:20px}.os-community__presence-summary>strong{display:grid;place-items:center;inline-size:90px;block-size:90px;border:1px solid var( --os-ui-border,#dcdcde );border-radius:50%;box-shadow:inset 0 0 0 8px var( --os-ui-surface,#fff );background:var( --os-ui-surface-sunken,#f6f7f7 );font-size:40px;font-weight:500}.os-community__presence-summary p{font-size:16px;margin:0}.os-community__presence-summary span{display:block;font-size:11px;color:var( --os-ui-fg-muted,#646970 );margin-block-start:6px}.os-community__present{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.os-community__present>div,.os-community__newcomers>div{display:flex;align-items:center;gap:10px;min-inline-size:0}.os-community__present>div>div,.os-community__newcomers>div>div{min-inline-size:0}.os-community__present p,.os-community__newcomers p,.os-community__timeline p{font-size:10px;color:var( --os-ui-fg-muted,#646970 );margin:4px 0 0}.os-community__arrivals h4{margin:20px 0 12px;font-size:11px;font-weight:600;color:inherit}.os-community__arrivals os-histogram{display:block;margin-block-start:16px}.os-community__newcomers{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.os-community__timeline{padding:0;margin:20px 0 0;list-style:none}.os-community__timeline li{position:relative;display:flex;gap:12px;align-items:center;padding-block-end:19px}.os-community__timeline li:not(:last-child)::before{content:'';position:absolute;inline-size:1px;inset-inline-start:16px;inset-block:34px 0;background:var( --os-ui-border,#dcdcde )}.os-community__timeline li>div{flex:1;min-inline-size:0}.os-community__login-mark{color:var( --os-ui-fg-muted,#646970 )}.os-community__empty{margin:24px 0;padding:16px;border:1px dashed var( --os-ui-border,#dcdcde );border-radius:10px;font-size:12px;line-height:1.6;color:var( --os-ui-fg-muted,#646970 )}@container people (min-width:900px){.os-community__work{grid-column:1;grid-row:1 / 3}.os-community__presence-panel{grid-column:2;grid-row:1}.os-community__checkins{grid-column:2;grid-row:2 / 4}.os-community__arrivals{grid-column:1;grid-row:3}}@container people (max-width:899px){.os-community{padding:16px}.os-community__metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.os-community__grid{grid-template-columns:1fr;gap:14px}.os-community__presence-panel{grid-row:1}.os-community__present{grid-template-columns:repeat(3,minmax(0,1fr))}}@container people (max-width:480px){.os-community{padding:10px 12px}.os-community__metrics{gap:8px;margin-block-end:12px}.os-community__metric{gap:6px 10px;padding:12px}.os-community__metric>.dashicons{display:none}.os-community__metric strong{font-size:29px}.os-community__metric h3{font-size:11px}.os-community__metric p{font-size:9px}.os-community__panel{padding:17px;border-radius:14px}.os-community__panel h3{font-size:20px}.os-community__present,.os-community__newcomers{grid-template-columns:repeat(2,minmax(0,1fr))}.os-community__spotlight{gap:10px;padding:12px;flex-wrap:wrap}.os-community__spotlight .os-community__eyebrow{font-size:8px}.os-community__spotlight .os-community__person::part(button){font-size:16px}}`,Es=b` .desktop-mode-users{container:people / inline-size;color:var( --os-ui-fg,#1d2327 );background:var( --os-ui-surface-sunken,#f6f7f7 )}.desktop-mode-users [hidden]{display:none !important}.os-people__hero{display:flex;justify-content:space-between;align-items:center;gap:20px;padding:25px;background:var( --os-ui-surface,#fff )}.os-people__hero h2{color:inherit;margin:4px 0 8px;font-size:clamp(24px,3.4cqi,37px);font-weight:500;letter-spacing:-.045em;line-height:1.12}.os-people__eyebrow{font-size:10px;letter-spacing:.15em;color:var( --os-ui-fg-muted,#646970 )}.os-people__hero p{margin:0;font-size:12px;color:var( --os-ui-fg-muted,#646970 )}.os-people__tools{display:flex;gap:9px;padding:10px 24px;align-items:center;flex-wrap:wrap;border-block-end:1px solid var( --os-ui-border,#dcdcde );background:var( --os-ui-surface,#fff )}.os-people__tools os-text-field{flex:1;min-inline-size:150px}.os-people__tools os-select{inline-size:140px}.os-people__options{display:none}.os-people__cards{flex:1;min-block-size:0;min-inline-size:0;overflow:auto;padding:20px 24px;display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,350px),1fr));gap:18px;align-content:start;overscroll-behavior:contain}.os-people__card{position:relative;isolation:isolate;box-sizing:border-box;display:grid;grid-template-rows:auto 1fr auto auto;gap:10px;aspect-ratio:1.586;min-inline-size:0;border:1px solid var( --os-ui-border,#dcdcde );border-radius:15px;padding:14px 16px 8px;background:var( --os-ui-surface,#fff );box-shadow:0 2px 4px var( --os-ui-surface-subtle,#f0f0f1 )}.os-people__card::before{content:'';position:absolute;z-index:-1;pointer-events:none;inset:0;border-radius:inherit;background:repeating-radial-gradient(ellipse at 105% 15%,transparent 0 8px,var( --os-ui-surface-subtle,#f0f0f1 ) 9px 10px,transparent 11px 16px);opacity:.55;mask-image:linear-gradient(to left,#000,transparent 70%)}.os-people__card::after{content:'';position:absolute;pointer-events:none;inset-block:28px;inset-inline-start:0;inline-size:3px;background:var( --os-ui-accent,#2271b1 );border-start-end-radius:3px;border-end-end-radius:3px;opacity:.65}.os-people__card.is-selected{outline:2px solid var( --os-ui-accent,#2271b1 );outline-offset:-2px}.os-people__id-header{display:flex;align-items:center;gap:8px;min-block-size:18px}.os-people__issuer{display:inline-flex;align-items:center;gap:5px;font-size:9px;font-weight:600;letter-spacing:.12em;color:var( --os-ui-fg,#1d2327 )}.os-people__issuer>span:last-child{font-weight:400;color:var( --os-ui-fg-muted,#646970 )}.os-people__issuer .dashicons{font-size:17px;inline-size:17px;block-size:17px}.os-people__you{font-size:10px;color:var( --os-ui-accent,#2271b1 )}.os-people__select{margin-inline-start:auto;inline-size:18px;block-size:18px;flex:0 0 18px}.os-people__identity{display:grid;grid-template-columns:84px minmax(0,1fr);align-items:center;gap:16px}.os-people__portrait{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:10px 4px 7px;border:1px solid var( --os-ui-border,#dcdcde );border-radius:9px;background:var( --os-ui-surface-sunken,#f6f7f7 )}.os-people__member-number{font:9px/1.2 ui-monospace,monospace;letter-spacing:.13em;color:var( --os-ui-fg-muted,#646970 )}.os-people__credentials{min-inline-size:0}.os-people__identity h3{margin:0;font-size:20px;line-height:1.15;color:inherit}.os-people__identity h3 os-button{font:inherit;--os-ui-button-padding:0}.os-people__identity h3 os-button::part(button){font:inherit;text-align:start;border:0;background:transparent;padding:0;white-space:normal;overflow-wrap:anywhere}.os-people__identity p{margin:4px 0 0;font-size:10px;color:var( --os-ui-fg-muted,#646970 )}.os-people__handle{overflow-wrap:anywhere}.os-people__email{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.os-people__joined time{color:var( --os-ui-fg,#1d2327 )}.os-people__roles{display:flex;flex-wrap:wrap;gap:4px;margin-block:6px}.os-people__roles span{border:1px solid var( --os-ui-border,#dcdcde );border-radius:4px;padding:2px 6px;font-size:9px;color:var( --os-ui-fg-muted,#646970 );background:var( --os-ui-surface,#fff )}.os-people__stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr)) 28px;gap:8px;align-items:center;padding-block:7px 0;border-block-start:1px solid var( --os-ui-border,#dcdcde );--os-ui-stat-padding:0;--os-ui-stat-border:transparent;--os-ui-stat-value-size:21px;--os-ui-stat-value-color:var( --os-ui-fg,#1d2327 )}.os-people__stats os-stat::part(label){font-size:8px}.os-people__seal{display:grid;place-items:center;inline-size:26px;block-size:26px;border:1px solid var( --os-ui-border,#dcdcde );border-radius:50%;color:var( --os-ui-fg-muted,#646970 );opacity:.5}.os-people__seal .dashicons{font-size:16px;inline-size:16px;block-size:16px}.os-people__card>footer{display:flex;align-items:center;gap:8px;min-inline-size:0}.os-people__last-login{flex:1;min-inline-size:0;font-size:9px;color:var( --os-ui-fg-muted,#646970 )}.os-people__card os-action-menu{margin-inline-start:auto;flex:0 0 auto}.os-people__presence{display:inline-flex;align-items:center;gap:4px;font-size:9px;color:var( --os-ui-fg-muted,#646970 );white-space:nowrap}.os-people__presence::before{content:'';inline-size:5px;block-size:5px;border-radius:50%;background:currentColor}.os-people__presence[data-presence="online"]{color:var( --os-ui-success-fg,#008a20 )}.os-people__presence[data-presence="inactive"]{color:var( --os-ui-warning-fg,#996800 )}.os-people__continuation{grid-column:1 / -1;flex:0 0 auto;padding:14px;text-align:center;font-size:11px;color:var( --os-ui-fg-muted,#646970 )}.os-people__empty{grid-column:1 / -1;padding:50px 20px;text-align:center;color:var( --os-ui-fg-muted,#646970 )}.os-people__scope{display:flex;align-items:center;gap:12px;justify-content:space-between;padding:8px 24px;font-size:11px;color:var( --os-ui-fg-muted,#646970 );border-block-end:1px solid var( --os-ui-border,#dcdcde )}.os-people__role-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:20px;padding:24px}.os-people__room{border:1px solid var( --os-ui-border,#dcdcde );background:var( --os-ui-surface,#fff );border-radius:18px;padding:24px;text-align:center;min-inline-size:0}.os-people__orbit{position:relative;inline-size:210px;block-size:210px;margin:12px auto 20px;border:1px solid var( --os-ui-border,#dcdcde );border-radius:50%}.os-people__orbit::before{content:'';position:absolute;inset:25px;border:1px dashed var( --os-ui-border,#dcdcde );border-radius:50%}.os-people__orbit-center{position:absolute;inset:45px;display:flex;flex-direction:column;align-items:center;justify-content:center;border-radius:50%;background:var( --os-ui-surface-sunken,#f6f7f7 );gap:6px}.os-people__orbit-center strong{font-size:36px;font-weight:500;line-height:1}.os-people__orbit-center span{font-size:11px;max-inline-size:95px;overflow-wrap:anywhere;color:var( --os-ui-fg-muted,#646970 )}.os-people__satellite{position:absolute;transform:translate(-50%,-50%);background:var( --os-ui-surface,#fff );padding:3px;border-radius:50%}.os-people__room>p{font-size:11px;color:var( --os-ui-fg-muted,#646970 );min-block-size:28px}.os-people__insights{flex:1;min-block-size:0;overflow:auto}.desktop-mode-users .os-app-list__toolbar-right.os-app-list__bulk--footer{flex:0 0 auto;max-block-size:38%;overflow:auto;align-content:start}.desktop-mode-users .os-app-list__bulk--footer .os-app-list__count{flex:0 0 auto}.desktop-mode-users .os-app-list__bulk--footer .os-app-list__bulk-actions{flex:1}@container people (max-width:640px){.os-people__hero{padding:10px 12px;gap:10px}.os-people__hero h2{font-size:20px;margin:0}.os-people__hero p,.os-people__eyebrow{display:none}.os-people__tools{padding:7px 12px;gap:7px}.os-people__options{display:block}.os-people__tools:not(.is-expanded) .os-people__extra{display:none}.os-people__cards{display:block;padding:9px 12px}.os-people__card{aspect-ratio:auto;gap:7px;padding:10px 12px 5px;margin-block-end:10px}.os-people__identity{grid-template-columns:72px minmax(0,1fr);gap:12px}.os-people__portrait{padding:5px 2px;gap:4px}.os-people__identity h3{font-size:17px}.os-people__identity p{font-size:9px;margin-block-start:3px}.os-people__roles{margin-block:4px}.os-people__stats{--os-ui-stat-value-size:18px;padding-block-start:5px}.os-people__last-login{font-size:8px}.os-people__scope{padding:7px 12px}.os-people__role-grid{padding:12px}}`;function Rs(o){const e="ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz23456789!@#$%^&*-_=+",t=new Uint32Array(o);crypto.getRandomValues(t);let s="";for(let i=0;i<o;i+=1)s+=e[t[i]%e.length];return s}function Nt(o){return Object.entries(o).map(([e,t])=>h`<os-option value=${e}>${t}</os-option>`)}function Ls(o,e){const t=o.defaultRole??"subscriber",s=o.assignableRoles&&Object.keys(o.assignableRoles).length>0?o.assignableRoles:{[t]:t},i=o.locales??{"":l("Site default")},n=r=>{r.preventDefault(),r.stopPropagation();const c=r.currentTarget.closest("os-form")?.querySelector('os-text-field[name="password"]'),d=Rs(18);c&&(c.value=d,c.setAttribute("value",d)),Ko(d),e(l("Generated password copied to clipboard."))};return h`<os-form | |
| 49 | 239 | data-os-users-add-form |
| 50 | 240 | os-action="create" |
| 51 | - submit-label=${a("Add user")} | |
| 52 | - reset-label=${a("Reset")} | |
| 241 | + submit-label=${l("Add user")} | |
| 242 | + reset-label=${l("Reset")} | |
| 53 | 243 | > |
| 54 | 244 | <div slot="header"> |
| 55 | - <h2>${a("Add a new user")}</h2> | |
| 245 | + <h2>${l("Add a new user")}</h2> | |
| 56 | 246 | <p class="os-users__form-lede"> |
| 57 | - ${a("WordPress will create the account and (optionally) email the user a notification with a link to set their own password.")} | |
| 247 | + ${l("WordPress will create the account and (optionally) email the user a notification with a link to set their own password.")} | |
| 58 | 248 | </p> |
| 59 | 249 | </div> |
| 60 | - <os-text-field name="username" label=${a("Username (required)")} placeholder=${a("e.g. jane.doe")} autocomplete="off" required></os-text-field> | |
| 61 | - <os-text-field name="email" type="email" label=${a("Email (required)")} placeholder=${a("[email protected]")} autocomplete="off" required></os-text-field> | |
| 62 | - <os-text-field name="first_name" label=${a("First name")} autocomplete="off"></os-text-field> | |
| 63 | - <os-text-field name="last_name" label=${a("Last name")} autocomplete="off"></os-text-field> | |
| 64 | - <os-text-field name="url" type="url" label=${a("Website")} placeholder="https://example.com" autocomplete="off" full-width></os-text-field> | |
| 65 | - <os-select name="role" label=${a("Role")} value=${s[n]!==void 0?n:""}>${he(s)}</os-select> | |
| 66 | - <os-select name="locale" label=${a("Language")}>${he(o)}</os-select> | |
| 250 | + <os-text-field name="username" label=${l("Username (required)")} placeholder=${l("e.g. jane.doe")} autocomplete="off" required></os-text-field> | |
| 251 | + <os-text-field name="email" type="email" label=${l("Email (required)")} placeholder=${l("[email protected]")} autocomplete="off" required></os-text-field> | |
| 252 | + <os-text-field name="first_name" label=${l("First name")} autocomplete="off"></os-text-field> | |
| 253 | + <os-text-field name="last_name" label=${l("Last name")} autocomplete="off"></os-text-field> | |
| 254 | + <os-text-field name="url" type="url" label=${l("Website")} placeholder="https://example.com" autocomplete="off" full-width></os-text-field> | |
| 255 | + <os-select name="role" label=${l("Role")} value=${s[t]!==void 0?t:""}>${Nt(s)}</os-select> | |
| 256 | + <os-select name="locale" label=${l("Language")}>${Nt(i)}</os-select> | |
| 67 | 257 | <os-text-field |
| 68 | 258 | name="password" |
| 69 | 259 | type="password" |
| 70 | 260 | reveal |
| 71 | - label=${a("Password")} | |
| 72 | - placeholder=${a("Auto-generated; click Generate to set one.")} | |
| 261 | + label=${l("Password")} | |
| 262 | + placeholder=${l("Auto-generated; click Generate to set one.")} | |
| 73 | 263 | autocomplete="new-password" |
| 74 | 264 | full-width |
| 75 | 265 | ></os-text-field> |
| 76 | 266 | <div class="os-users__form-pwd-actions" full-width> |
| 77 | - <os-button variant="ghost" type="button" @click=${i}> | |
| 267 | + <os-button variant="ghost" type="button" @click=${n}> | |
| 78 | 268 | <span class="dashicons dashicons-randomize" aria-hidden="true"></span> |
| 79 | - ${a("Generate strong password")} | |
| 269 | + ${l("Generate strong password")} | |
| 80 | 270 | </os-button> |
| 81 | - <p class="os-users__form-hint">${a("Leave blank to let WordPress generate one and email it to the user.")}</p> | |
| 271 | + <p class="os-users__form-hint">${l("Leave blank to let WordPress generate one and email it to the user.")}</p> | |
| 82 | 272 | </div> |
| 83 | - <os-checkbox-label name="send_notification" label=${a("Send the new user an email about their account")} checked full-width></os-checkbox-label> | |
| 84 | - </os-form>`}function at(e,t,n){const s=e.querySelector("[data-os-users-add-form]");if(!s)return n;const o={created:t.created,error:t.createError,field:t.createField};return t.created!==n.created?(s.reset(),s.clearErrors(),o):t.createError===n.error&&t.createField===n.field?n:(s.clearErrors(),t.createError&&(s.setError(t.createError),t.createField&&s.setFieldInvalid(t.createField)),o)}const Y=new Map;async function lt(e){if(!e)return null;let t;try{t=new URL(e,window.location.href)}catch{return e}if(!/gravatar\.com$/i.test(t.hostname))return e;t.searchParams.delete("d"),t.searchParams.delete("s");const n=t.toString(),s=Y.get(n);if(s!==void 0)return s instanceof Promise,s;const o=new URL(e,window.location.href);o.searchParams.set("d","blank");const i=new Promise(r=>{const c=new Image;c.crossOrigin="anonymous",c.onload=()=>{try{const d=document.createElement("canvas");d.width=1,d.height=1;const l=d.getContext("2d",{willReadFrequently:!0});if(!l){r(e);return}l.drawImage(c,0,0,1,1);const u=l.getImageData(0,0,1,1).data;r(u[3]===0?null:e)}catch{r(e)}},c.onerror=()=>r(null),c.src=o.toString()}).then(r=>(Y.set(n,r),r));return Y.set(n,i),i}function ct(e){return e?.["48"]??e?.["96"]??e?.["24"]??""}function dt(e,t){t&<(t).then(n=>{e.isConnected&&(n?e.setAttribute("src",n):e.removeAttribute("src"))})}const me="desktop-mode-user-edit";function ut(e,t={}){if(!Number.isFinite(e)||e<=0)return!1;const n=window.wp?.os;return n?.openWindow?.(me,{source:t.source??"user-edit/open",params:{userId:e}})?(n?.relations?.set?.(me,{type:"user",id:e}),!0):(t.fallback?.(),!1)}function pt(e){if(!e)return 214;let t=5381;for(let n=0;n<e.length;n++)t=Math.imul(t,33)+e.charCodeAt(n);return(t%360+360)%360}const ft=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}}`,ge={xs:20,sm:24,md:40,lg:64,xl:96},be=new Set(["online","inactive","offline"]),I=class I extends P{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(t,n,s){super.attributeChangedCallback(t,n,s),t==="src"&&(this._imgFailed=!1),(t==="user-id"||t==="presence")&&this._maybeAttachPresenceListener()}render(){const t=this._attr("src"),n=this._attr("name")||"",s=this._attr("alt"),o=s!==null?s:n,i=this._attr("size"),r=this._resolveSize(i),c=this._presenceForRender(),d=this._attr("clickable")!==null;this.style.setProperty("--os-ui-avatar-size",`${r}px`);const l=t&&!this._imgFailed?"":this._initialsBg(n),u=t&&!this._imgFailed?h`<img | |
| 85 | - src=${t} | |
| 86 | - alt=${o} | |
| 87 | - @error=${()=>this._onImgError()} | |
| 88 | - loading="lazy" | |
| 89 | - />`:this._initials(n),p=c?h`<span | |
| 90 | - class=${`os-avatar__dot os-avatar__dot--${c}`} | |
| 91 | - aria-label=${this._presenceLabel(c)} | |
| 92 | - ></span>`:h``;return d?h` | |
| 93 | - <button | |
| 94 | - type="button" | |
| 95 | - class="os-avatar__tile" | |
| 96 | - aria-label=${o||"User"} | |
| 97 | - style=${l?`background:${l};`:""} | |
| 98 | - @click=${f=>this._onClick(f)} | |
| 99 | - >${u}</button> | |
| 100 | - ${p} | |
| 101 | - `:h` | |
| 102 | - <div | |
| 103 | - class="os-avatar__tile" | |
| 104 | - role="img" | |
| 105 | - aria-label=${o||"User"} | |
| 106 | - style=${l?`background:${l};`:""} | |
| 107 | - >${u}</div> | |
| 108 | - ${p} | |
| 109 | - `}_attr(t){return this.getAttribute(t)}_resolveSize(t){if(!t)return 32;if(t in ge)return ge[t];const n=Number(t);return Number.isFinite(n)&&n>0?n:32}_initials(t){const n=t.trim();return n?Array.from(n)[0]?.toUpperCase()??"?":"?"}_initialsBg(t){const n=pt(t);return`linear-gradient(135deg, hsl(${n} 62% 55%), hsl(${(n+24)%360} 58% 42%))`}_presenceForRender(){const t=this._attr("presence");return t&&be.has(t)?t:null}_presenceLabel(t){switch(t){case"online":return"Online";case"inactive":return"Inactive";case"offline":return"Offline"}}_onImgError(){this._imgFailed=!0,this.requestUpdate()}_onClick(t){const n=this._attr("user-id"),s={userId:n!==null&&Number(n)||null,originalEvent:t};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=n=>{const s=this.getBoundingClientRect();if(s.width===0||s.height===0)return;const o=(n.clientX-s.left)/s.width-.5,i=(n.clientY-s.top)/s.height-.5,r=14;this._pendingTiltY=`${(o*r).toFixed(2)}deg`,this._pendingTiltX=`${(-i*r).toFixed(2)}deg`;const c=Math.max(0,Math.min(100,(o+.5)*100)),d=Math.max(0,Math.min(100,(i+.5)*100));this._pendingGlareX=`${c.toFixed(1)}%`,this._pendingGlareY=`${d.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 t=this._attr("user-id"),n=this._attr("presence"),s=!!t&&!n;s&&!this._presenceHandler?(this._presenceHandler=o=>{const i=o.detail;i&&String(i.userId)===String(t)&&i.newStatus&&be.has(i.newStatus)&&this.setAttribute("presence",i.newStatus)},document.addEventListener("os-presence-changed",this._presenceHandler)):!s&&this._presenceHandler&&(document.removeEventListener("os-presence-changed",this._presenceHandler),this._presenceHandler=null)}};I.props=["src","alt","name","size","presence","userId","clickable"],I.styles=[ft],I.help=void 0;let B=I;H("os-avatar",B);const ht=q`:host{display:inline-flex;align-items:center;justify-content:center;width:var( --os-ui-icon-size,16px );height:var( --os-ui-icon-size,16px );color:inherit;line-height:1}:host( [ hidden ] ){display:none}.os-icon__glyph{font-size:var( --os-ui-icon-size,16px );width:var( --os-ui-icon-size,16px );height:var( --os-ui-icon-size,16px );line-height:1;color:inherit;display:inline-flex;align-items:center;justify-content:center}.os-icon__glyph--char{font-family:dashicons;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;speak:none}.os-icon__glyph.dashicons{font-family:dashicons}`;let W=null;function mt(e){let t=e.trim();if(t==="")return null;(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))&&(t=t.slice(1,-1));const n=t.match(/^\\([0-9a-f]{1,6})\s?$/i);return n?String.fromCodePoint(parseInt(n[1],16)):t||null}function ve(){const e=new Map;if(typeof document>"u")return e;const t=Array.from(document.styleSheets??[]);for(const n of t){let s=null;try{s=n.cssRules}catch{continue}if(s)for(const o of Array.from(s)){const i=o;if(!i||!i.selectorText)continue;const r=i.selectorText.match(/\.dashicons-([a-z0-9-]+)::?before/i);if(!r)continue;const c=i.style?.content;if(!c)continue;const d=mt(c);d&&e.set(r[1],d)}}return e}function gt(e){W||(W=ve());const t=e.startsWith("dashicons-")?e.slice(10):e;return W.get(t)??null}function bt(){W=ve()}let _e=!1;function vt(){if(_e||typeof window>"u")return;_e=!0;const e=()=>{bt()};document.readyState==="loading"&&document.addEventListener("DOMContentLoaded",e,{once:!0}),window.addEventListener("load",e,{once:!0})}vt();const L=class L extends P{render(){const t=this.name||"",n=t.startsWith("dashicons-")?t.slice(10):t,s=this.size;s&&/^\d+$/.test(s)&&this.style.setProperty("--os-ui-icon-size",`${s}px`);const o=gt(n);return o?h`<span | |
| 110 | - class="os-icon__glyph os-icon__glyph--char dashicons dashicons-${n}" | |
| 111 | - aria-hidden="true" | |
| 112 | - >${o}</span>`:h`<span | |
| 113 | - class="os-icon__glyph dashicons dashicons-${n}" | |
| 114 | - aria-hidden="true" | |
| 115 | - ></span>`}};L.props=["name","size"],L.styles=[ht],L.help=void 0;let V=L;H("os-icon",V);const _t=()=>[{value:"",label:a("All")},{value:"online",label:a("Online")},{value:"recent",label:a("Active 30d")},{value:"never",label:a("Never logged in")}];function ye(e,t){if(t==="online")return e.filter(n=>n.openstation_presence==="online");if(t==="recent"){const n=Math.floor(Date.now()/1e3);return e.filter(s=>{const o=s.openstation_last_login;return typeof o=="number"&&o>0&&n-o<2592e3})}return t==="never"?e.filter(n=>typeof n.openstation_last_login!="number"||!n.openstation_last_login):e}const yt=new Set(["identity","email","role","last_login","actions"]),xt={identity:"name",email:"email",registered:"registered_date"};function $t(e){const t=e.openstation_user_stats;return[e.id,e.name,e.slug,e.email??"",(e.roles??[]).join(","),e.registered_date??"",e.openstation_last_login??"",e.openstation_presence??"",e.openstation_can_edit?1:0,t?`${t.posts}/${t.pages}/${t.comments}`:""].join("|")}function E(e,t,n,s){const o=`${t}::${n}`,i=e.get(o);if(i)return i;const r=s();return e.set(o,r),r}function xe(e,t){for(const n of Array.from(e.keys()))n.startsWith(`${t}::`)&&e.delete(n)}const A="var(--os-ui-fg-muted, #8c8f94)",wt="display:inline-flex;align-items:center;padding:2px 8px;border-radius:10px;font-size:11px;font-weight:600;background:var(--os-ui-badge-info-bg, rgba(34,113,177,0.10));color:var(--os-ui-info-fg, #0a4b78);white-space:nowrap;";function kt(e,t){const n=document.createElement("span");n.style.cssText="display:flex;align-items:center;gap:10px;min-width:0;";const s=document.createElement("os-avatar");s.setAttribute("size","32"),e.name&&s.setAttribute("name",e.name),s.setAttribute("presence",e.openstation_presence??"offline");const o=ct(e.avatar_urls);o&&dt(s,o),n.appendChild(s);const i=document.createElement("span");i.style.cssText="display:flex;flex-direction:column;min-width:0;line-height:1.25;";const r=document.createElement("button");if(r.type="button",r.textContent=e.name||`#${e.id}`,r.title=r.textContent,r.setAttribute("data-noclick",""),r.style.cssText="appearance:none;background:transparent;border:none;padding:0;font:inherit;font-weight:600;color:inherit;cursor:pointer;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:240px;",r.addEventListener("mouseenter",()=>{r.style.textDecoration="underline"}),r.addEventListener("mouseleave",()=>{r.style.textDecoration="none"}),r.addEventListener("click",c=>{c.preventDefault(),c.stopPropagation(),$e(e.id,t)}),i.appendChild(r),e.slug){const c=document.createElement("span");c.textContent=`@${e.slug}`,c.style.cssText=`font-size:11px;color:${A};white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:240px;`,i.appendChild(c)}return n.appendChild(i),n}function $e(e,t){ut(e,{source:"users-window/row-click",fallback:()=>{console.error("[openstation:desktop-mode-users] the User Edit window is not registered for this user."),t.toast(a("Profile window not registered — see console."))}})}function St(e,t){const n=document.createElement("button");n.type="button";const s=typeof e.email=="string"?e.email:"";return n.textContent=s||"—",n.disabled=s==="",n.title=s?a("Click to copy email"):"",n.style.cssText=["appearance:none","background:transparent","border:none","padding:2px 6px","font:inherit","color:inherit",`cursor:${s?"copy":"default"}`,"text-align:left","font-size:13px","border-radius:4px","max-width:100%","overflow:hidden","text-overflow:ellipsis","white-space:nowrap"].join(";"),n.addEventListener("click",o=>{o.stopPropagation(),s&&ae(s).then(i=>{if(!i){t.toast(a("Could not copy the email address."));return}n.textContent=a("Copied!"),n.style.color="var(--wp-admin-theme-color, #2271b1)",setTimeout(()=>{n.textContent=s,n.style.color=""},1200)})}),n}function Et(e,t){const n=document.createElement("span");n.style.cssText="display:inline-flex;flex-wrap:wrap;gap:4px;min-width:0;";const s=Array.isArray(e.roles)?e.roles:[];if(s.length===0){const i=document.createElement("span");return i.textContent=a("No role"),i.style.cssText=`color:${A};font-style:italic;`,n.appendChild(i),n}const o=t.allRoles??{};for(const i of s){const r=document.createElement("span");r.textContent=o[i]??i,r.style.cssText=wt,n.appendChild(r)}return n}function Ct(e){const t=e.openstation_user_stats??{posts:0,pages:0,comments:0},n=document.createElement("span");n.style.cssText="display:inline-flex;align-items:center;gap:10px;font-size:12px;font-variant-numeric:tabular-nums;";const s=(o,i,r)=>{const c=document.createElement("span");c.style.cssText="display:inline-flex;align-items:center;gap:3px;",c.title=r;const d=document.createElement("os-icon");d.setAttribute("name",o),d.setAttribute("size","14"),d.style.color=A;const l=document.createElement("span");return l.textContent=String(i),i===0&&(l.style.color=A),c.append(d,l),c};return n.append(s("admin-post",t.posts,a("Posts")),s("admin-page",t.pages,a("Pages")),s("admin-comments",t.comments,a("Comments"))),n}function we(e,t){const n=document.createElement("span");n.style.cssText="font-size:13px;font-variant-numeric:tabular-nums;";const s=fe(e);return Number.isFinite(s)?(n.appendChild(st(e)),n.title=re(s,"datetime"),n):(n.textContent=t,n.style.color=A,n)}function At(e,t,n){const s=document.createElement("span");if(s.style.cssText="display:inline-flex;gap:4px;align-items:center;",t.canEdit!==!0||e.openstation_can_edit!==!0)return s.textContent="—",s.style.color=A,s;const o=(i,r,c)=>{const d=document.createElement("button");d.type="button",d.title=i,d.setAttribute("aria-label",i),d.style.cssText="appearance:none;border:1px solid var(--os-ui-border, #dcdcde);background:var(--os-ui-btn-bg, #fff);color:inherit;padding:4px 6px;border-radius:4px;cursor:pointer;line-height:1;";const l=document.createElement("os-icon");return l.setAttribute("name",r),l.setAttribute("size","14"),d.appendChild(l),d.addEventListener("click",u=>{u.stopPropagation(),c()}),d};return s.append(o(a("Send password reset"),"email-alt",()=>n.onSendReset(e)),o(a("Resend welcome email"),"megaphone",()=>n.onResendWelcome(e))),s}function Tt(e,t,n,s=F()){const o=[{key:"identity",label:a("Name"),sortable:!0,sticky:!0,minWidth:"260px",render:(i,r)=>E(e,r.id,"identity",()=>kt(r,n))},{key:"email",label:a("Email"),sortable:!0,minWidth:"220px",render:(i,r)=>E(e,r.id,"email",()=>St(r,n))},{key:"role",label:a("Role"),width:"180px",render:(i,r)=>E(e,r.id,"role",()=>Et(r,t))},{key:"stats",label:a("Content"),width:"160px",sortValue:i=>{const r=i.openstation_user_stats;return r?r.posts+r.pages+r.comments:0},render:(i,r)=>E(e,r.id,"stats",()=>Ct(r))},{key:"last_login",label:a("Last login"),width:"140px",sortable:!1,sortValue:i=>typeof i.openstation_last_login=="number"?i.openstation_last_login:0,render:(i,r)=>E(e,r.id,"last_login",()=>we(r.openstation_last_login,a("Never")))},{key:"registered",label:a("Registered"),width:"140px",sortable:!0,render:(i,r)=>E(e,r.id,"registered",()=>we(r.registered_date,"—"))}];return t.canEdit===!0&&o.push({key:"actions",label:a("Actions"),stack:"actions",width:"110px",sortable:!1,render:(i,r)=>E(e,r.id,"actions",()=>At(r,t,n))}),s?o.filter(i=>yt.has(i.key)):o}const Pt="desktop-mode-users",Nt={success:5e3,error:8e3,info:void 0},R=()=>({cache:new Map,sync:qe(),selected:[],rows:new Map,bulkRole:"",reassign:null,addForm:{created:0,error:"",field:""},profileWired:!1}),O=e=>e.root.querySelector("[data-os-users-table]"),C=e=>e.extra,Z=(e,t,n)=>{e.host.toast?.(n?{message:t,duration:n}:{message:t})};function Q(e){return Array.from(O(e)?.selection??[]).map(t=>Number(t)).filter(t=>t>0)}function ke(e){O(e)?.clearSelection(),e.ui(R).selected=[]}async function Rt(e){const n=e.ui(R).bulkRole,s=Q(e);if(!n||s.length===0)return;await e.dispatch("bulk-role",{ids:s,role:n},{confirm:{title:a("Change role for selected users?"),message:y(a("Set %1$d user(s)' role to %2$s?"),s.length,C(e).assignableRoles?.[n]??n),label:a("Set role")}})&&ke(e)}async function Mt(e){const t=Q(e);if(t.length===0)return;const n=C(e),s=e.ui(R),o=n.isMultisite===!0,i=o?null:s.reassign??Se(n);let r;o?r=y(a("Remove %d user(s) from this site? Their network account stays."),t.length):i?r=y(a("Permanently delete %1$d user(s)? Their content is attributed to %2$s. This cannot be undone."),t.length,i.name):r=y(a("Permanently delete %d user(s)? Their content is deleted too. This cannot be undone."),t.length),await e.dispatch("bulk-delete",{ids:t,reassign:i?.id??0},{confirm:{title:a(o?"Remove selected users from this site?":"Delete selected users?"),message:r,label:a(o?"Remove":"Delete"),danger:!0}})&&ke(e)}function Se(e){return e.currentUserId?{id:e.currentUserId,name:a("you")}:null}function It(e,t){e.dispatch("send-reset",{id:t.id},{confirm:{title:a("Send password reset email?"),message:y(a("WordPress will email %s a password-reset link."),t.name),label:a("Send reset email")}})}function Lt(e,t){e.dispatch("resend-welcome",{id:t.id},{confirm:{title:a("Resend welcome email?"),message:y(a("WordPress will resend the original welcome email to %s."),t.name),label:a("Resend")}})}function zt(e,t,n){const s=t.reassign??Se(C(e));return h`<span class="os-users__reassign"> | |
| 116 | - <span class="os-users__reassign-label">${a("Attribute content to")}</span> | |
| 273 | + <os-checkbox-label name="send_notification" label=${l("Send the new user an email about their account")} checked full-width></os-checkbox-label> | |
| 274 | + </os-form>`}function Ts(o,e,t){const s=o.querySelector("[data-os-users-add-form]");if(!s)return t;const i={created:e.created,error:e.createError,field:e.createField};return e.created!==t.created?(s.reset(),s.clearErrors(),i):e.createError===t.error&&e.createField===t.field?t:(s.clearErrors(),e.createError&&(s.setError(e.createError),e.createField&&s.setFieldInvalid(e.createField)),i)}const Ns="desktop-mode-users",Ps={success:5e3,error:8e3,info:void 0},D=()=>({feed:new uo,roles:new co,activity:new lo,view:"people",contribution:"posts",options:!1,cache:new Map,sync:ro(),selected:[],rows:new Map,bulkRole:"",reassign:null,addForm:{created:0,error:"",field:""},profileWired:!1}),X=o=>o.root.querySelector("[data-os-users-table]"),F=o=>o.extra,Ms=o=>o.extra.menuTabs??[],$e=(o,e,t)=>{o.host.toast?.(t?{message:e,duration:t}:{message:e})};function Ge(o){return Array.from(X(o)?.selection??[]).map(e=>Number(e)).filter(e=>e>0)}function Ze(o){X(o)?.clearSelection(),o.ui(D).selected=[]}async function Is(o){const t=o.ui(D).bulkRole,s=Ge(o);if(!t||s.length===0)return;await o.dispatch("bulk-role",{ids:s,role:t},{confirm:{title:l("Change role for selected users?"),message:x(l("Set %1$d user(s)' role to %2$s?"),s.length,F(o).assignableRoles?.[t]??t),label:l("Set role")}})&&Ze(o)}async function qs(o){const e=Ge(o);if(e.length===0)return;const t=F(o),s=o.ui(D),i=t.isMultisite===!0,n=i?null:s.reassign??Pt(t);let r;i?r=x(l("Remove %d user(s) from this site? Their network account stays."),e.length):n?r=x(l("Permanently delete %1$d user(s)? Their content is attributed to %2$s. This cannot be undone."),e.length,n.name):r=x(l("Permanently delete %d user(s)? Their content is deleted too. This cannot be undone."),e.length),await o.dispatch("bulk-delete",{ids:e,reassign:n?.id??0},{confirm:{title:l(i?"Remove selected users from this site?":"Delete selected users?"),message:r,label:l(i?"Remove":"Delete"),danger:!0}})&&Ze(o)}function Pt(o){return o.currentUserId?{id:o.currentUserId,name:l("you")}:null}function Mt(o,e){o.dispatch("send-reset",{id:e.id},{confirm:{title:l("Send password reset email?"),message:x(l("WordPress will email %s a password-reset link."),e.name),label:l("Send reset email")}})}function It(o,e){o.dispatch("resend-welcome",{id:e.id},{confirm:{title:l("Resend welcome email?"),message:x(l("WordPress will resend the original welcome email to %s."),e.name),label:l("Resend")}})}function Ds(o,e,t){const s=e.reassign??Pt(F(o));return h`<span class="os-users__reassign"> | |
| 275 | + <span class="os-users__reassign-label">${l("Attribute content to")}</span> | |
| 117 | 276 | <strong class="os-users__reassign-name">${s?s.name:"—"}</strong> |
| 118 | 277 | <os-user-search |
| 119 | 278 | class="os-users__reassign-search" |
| 120 | - placeholder=${a("Change…")} | |
| 121 | - exclude=${n.join(",")} | |
| 122 | - @os-user-pick=${o=>{const i=o.detail?.user;i&&(t.reassign={id:i.id,name:i.name},e.repaint())}} | |
| 279 | + placeholder=${l("Change…")} | |
| 280 | + exclude=${t.join(",")} | |
| 281 | + @os-user-pick=${i=>{const n=i.detail?.user;n&&(e.reassign={id:n.id,name:n.name},o.repaint())}} | |
| 123 | 282 | ></os-user-search> |
| 124 | - </span>`}function Ee(e,t,n){const s=C(e),o=s.assignableRoles??{},i=t.selected.length>0;return h`<div | |
| 125 | - class="os-app-list__toolbar-right ${n?"os-app-list__bulk--footer":""}" | |
| 283 | + </span>`}function Fs(o,e,t){const s=F(o),i=s.assignableRoles??{},n=e.selected.length>0;return h`<div | |
| 284 | + class="os-app-list__toolbar-right ${"os-app-list__bulk--footer"}" | |
| 126 | 285 | data-os-users-bulk |
| 127 | - ?hidden=${!i} | |
| 286 | + ?hidden=${!n} | |
| 128 | 287 | > |
| 129 | - <span class="os-app-list__count" data-os-users-count>${y(a("%d selected"),t.selected.length)}</span> | |
| 288 | + <span class="os-app-list__count" data-os-users-count>${x(l("%d selected"),e.selected.length)}</span> | |
| 289 | + <os-button variant="ghost" @click=${()=>{Ze(o),o.repaint()}}>${l("Clear selection")}</os-button> | |
| 130 | 290 | <span class="os-app-list__bulk-actions" data-os-users-bulk-actions> |
| 131 | - ${s.canPromote&&Object.keys(o).length>0?h`<span class="os-users__bulk-group"> | |
| 291 | + ${s.canPromote&&Object.keys(i).length>0?h`<span class="os-users__bulk-group"> | |
| 132 | 292 | <os-select |
| 133 | 293 | class="os-users__bulk-role" |
| 134 | - aria-label=${a("Set role to…")} | |
| 135 | - value=${t.bulkRole} | |
| 136 | - @os-pick=${r=>{t.bulkRole=String(r.detail?.value??"")}} | |
| 294 | + aria-label=${l("Set role to…")} | |
| 295 | + .value=${e.bulkRole} | |
| 296 | + placeholder=${l("Set role to…")} | |
| 297 | + @os-pick=${r=>{e.bulkRole=String(r.detail?.value??"")}} | |
| 137 | 298 | > |
| 138 | - <os-option value="">${a("Set role to…")}</os-option> | |
| 139 | - ${Object.entries(o).map(([r,c])=>h`<os-option value=${r}>${c}</os-option>`)} | |
| 299 | + <os-option .value=${""}>${l("Set role to…")}</os-option> | |
| 300 | + ${Object.entries(i).map(([r,a])=>h`<os-option value=${r}>${a}</os-option>`)} | |
| 140 | 301 | </os-select> |
| 141 | - <os-button variant="primary" @click=${()=>void Rt(e)}>${a("Apply")}</os-button> | |
| 302 | + <os-button variant="primary" @click=${()=>void Is(o)}>${l("Apply")}</os-button> | |
| 142 | 303 | </span>`:""} |
| 143 | 304 | ${s.canDelete?h`<span class="os-users__bulk-group"> |
| 144 | - ${s.isMultisite?"":zt(e,t,t.selected)} | |
| 145 | - <os-button variant="danger" @click=${()=>void Mt(e)}> | |
| 305 | + ${s.isMultisite?"":Ds(o,e,e.selected)} | |
| 306 | + <os-button variant="danger" @click=${()=>void qs(o)}> | |
| 146 | 307 | <span class="dashicons dashicons-trash" aria-hidden="true"></span> |
| 147 | - ${s.isMultisite?a("Remove from site"):a("Delete")} | |
| 308 | + ${s.isMultisite?l("Remove from site"):l("Delete")} | |
| 148 | 309 | </os-button> |
| 149 | 310 | </span>`:""} |
| 150 | 311 | </span> |
| 151 | - </div>`}function Dt(e,t){const{state:n,data:s}=e,o=s.list;return n.status?y(a("%1$d of %2$d on this page match"),t.length,o.items.length):y(a("Page %1$d of %2$d · %3$d users"),o.page,Math.max(1,o.pages),o.total)}function Ft(e,t,n,s){const{state:o,data:i}=e,r=C(e),c=i.list,d=r.canEdit===!0||r.canPromote===!0||r.canDelete===!0;return h`<os-tabpanel for="all" class="os-app-list__panel" ?hidden=${o.tab!=="all"}> | |
| 152 | - <header class="os-app-list__toolbar" data-os-users-toolbar> | |
| 153 | - <div class="os-app-list__toolbar-left"> | |
| 154 | - ${Oe({segments:_t(),value:o.status,bind:"status",action:"filter",label:a("Filter users"),phone:n})} | |
| 155 | - <os-text-field | |
| 156 | - class="os-app-list__search" | |
| 157 | - data-os-users-search | |
| 158 | - type="search" | |
| 159 | - os-bind="search" | |
| 160 | - os-action="filter" | |
| 161 | - os-debounce="250" | |
| 162 | - placeholder=${a("Search name, username, email…")} | |
| 163 | - ></os-text-field> | |
| 164 | - </div> | |
| 165 | - ${n?"":Ee(e,t,!1)} | |
| 166 | - <div class="os-app-list__toolbar-trailing"> | |
| 167 | - <os-button variant="ghost" os-action="refresh" data-os-users-refresh title=${a("Refresh")}> | |
| 168 | - <span class="dashicons dashicons-update" aria-hidden="true"></span> | |
| 169 | - </os-button> | |
| 170 | - ${r.canCreate?h`<os-button variant="primary" data-os-users-new os-action="tab" os-arg-value="add-new"> | |
| 171 | - <span class="dashicons dashicons-plus" aria-hidden="true"></span> | |
| 172 | - ${a("Add new")} | |
| 173 | - </os-button>`:""} | |
| 174 | - </div> | |
| 175 | - </header> | |
| 176 | - <div class="os-app-list__body" data-os-users-body> | |
| 177 | - ${c.error?h`<os-notice tone="danger">${a("Could not load users. Try Refresh.")} ${c.error}</os-notice>`:h`<os-table | |
| 178 | - data-os-users-table | |
| 179 | - os-preserve | |
| 180 | - selectable=${d?"multi":""} | |
| 181 | - sticky-header | |
| 182 | - sticky-columns="1" | |
| 183 | - hover | |
| 184 | - striped | |
| 185 | - bordered | |
| 186 | - > | |
| 187 | - <div slot="empty" class="os-app-list__empty"> | |
| 188 | - <span class="dashicons dashicons-admin-users" aria-hidden="true"></span> | |
| 189 | - <p>${a("No users found.")}</p> | |
| 190 | - <p class="os-app-list__empty-hint">${a("Try a different search or change the role filter.")}</p> | |
| 191 | - </div> | |
| 192 | - </os-table>`} | |
| 312 | + </div>`}function qt(o){return{onSendReset:e=>Mt(o,e),onResendWelcome:e=>It(o,e),toast:e=>$e(o,e)}}function Dt(o,e){return Yo(e.feed.items,o.state.status)}function Ws(o,e){o.state.role=e===""?"none":e,o.dispatch("filter",{})}function Hs(o,e,t,s){const{state:i,data:n}=o,r=F(o),a=r.canEdit===!0||r.canPromote===!0||r.canDelete===!0;return h`<os-tabpanel for="all" class="os-app-list__panel" ?hidden=${i.tab!=="all"}> | |
| 313 | + <header class="os-people__hero"><div><span class="os-people__eyebrow">${l("YOUR COMMUNITY")}</span><h2>${l("The people behind it.")}</h2><p>${l("Get to know the names. See what everyone brings.")}</p></div> | |
| 314 | + ${r.canCreate?h`<os-button variant="holo" data-os-users-new os-action="tab" os-arg-value="add-new">+ ${l("Add person")}</os-button>`:""}</header> | |
| 315 | + <div class="os-people__tools ${e.options?"is-expanded":""}" data-os-users-toolbar> | |
| 316 | + <os-text-field id=${`${o.windowId}-people-search`} class="os-app-list__search" data-os-users-search type="search" os-bind="search" os-action="filter" os-debounce="250" value=${i.search} aria-label=${l("Search people")} placeholder=${l("Search name, username, email…")}></os-text-field> | |
| 317 | + <os-button class="os-people__options" variant="secondary" @click=${()=>{e.options=!e.options,o.repaint()}}>${l("Options")}</os-button> | |
| 318 | + <os-select class="os-people__extra" aria-label=${l("Filter by role")} os-bind="role" os-action="filter" .value=${i.role} data-os-users-role> | |
| 319 | + <os-option .value=${""}>${l("Every role")}</os-option><os-option value="none">${l("No role")}</os-option>${Object.entries(r.allRoles||{}).map(([c,d])=>h`<os-option value=${c}>${d}</os-option>`)} | |
| 320 | + </os-select> | |
| 321 | + <os-select class="os-people__extra" aria-label=${l("Directory view")} value=${e.view} @os-pick=${c=>{e.view=String(c.detail.value),o.repaint()}}><os-option value="people">${l("People cards")}</os-option><os-option value="table">${l("Details table")}</os-option></os-select> | |
| 322 | + <os-select class="os-people__extra" aria-label=${l("Sort people")} value=${`${i.orderby}:${i.order}`} @os-pick=${c=>{const[d,p]=String(c.detail.value).split(":");o.dispatch("sort",{orderby:d,order:p})}}><os-option value="name:asc">${l("Name A–Z")}</os-option><os-option value="name:desc">${l("Name Z–A")}</os-option><os-option value="registered_date:desc">${l("Newest members")}</os-option><os-option value="registered_date:asc">${l("Longest standing")}</os-option><os-option value="email:asc">${l("Email A–Z")}</os-option></os-select> | |
| 323 | + <span class="os-people__extra">${io({segments:Vo(),value:i.status,bind:"status",action:"filter",label:l("Filter users"),phone:t})}</span> | |
| 324 | + <os-button class="os-people__extra" variant="ghost" os-action="refresh" data-os-users-refresh>${l("Refresh")}</os-button> | |
| 193 | 325 | </div> |
| 194 | - ${n?Ee(e,t,!0):""} | |
| 195 | - ${je({page:c.page,pages:c.pages,perPage:o.perPage,summary:e.loading?"":Dt(e,s),labels:{previous:a("Previous"),next:a("Next"),perPage:a("Per page")}})} | |
| 196 | - </os-tabpanel>`}const Ut=Xe(Pt,{local:{tab:(e,t)=>{e.tab=String(t.value??"all")}},placeholder:e=>({list:{items:[],total:0,pages:0,page:e.page,perPage:e.perPage}}),view:e=>{const{state:t}=e,n=C(e),s=e.ui(R),o=F(),i=ye(e.data.list.items,t.status);return h`<div class="os-app-list desktop-mode-users" data-os-users-root> | |
| 197 | - <os-tabs value=${t.tab} os-bind="tab" class="os-app-list__tabs os-users__tabs" label=${a("Users")} data-os-users-tabs> | |
| 198 | - <os-tab value="all">${a("All users")}</os-tab> | |
| 199 | - ${n.canCreate?h`<os-tab value="add-new">${a("Add new")}</os-tab>`:""} | |
| 200 | - <os-tab value="edit" data-os-users-edit-tab>${a("Profile")}</os-tab> | |
| 326 | + ${n.list.error?h`<os-notice tone="danger">${l("Could not load users. Try Refresh.")} ${n.list.error}</os-notice>`:""} | |
| 327 | + <div class="os-people__scope"><span>${x(l("%1$d of %2$d people loaded"),e.feed.items.length,n.list.total)}${i.status||i.role?` · ${s.length} ${l("match filters")}`:""}</span>${i.role?h`<os-button variant="ghost" data-os-users-clear-role @click=${()=>{o.state.role="",o.dispatch("filter",{})}}>${l("Clear role")}</os-button>`:""}</div> | |
| 328 | + <div class="os-people__card-host" ?hidden=${e.view!=="people"} style="display:flex;flex:1;min-height:0;">${ds(i.tab==="all"?s:[],{cfg:r,actions:qt(o),selected:e.selected,select:(c,d)=>{d?X(o)?.select(c):X(o)?.deselect(c)}},e.feed.tail(),o.loading)}</div> | |
| 329 | + <div class="os-app-list__body" data-os-users-body ?hidden=${e.view!=="table"}><os-table data-os-users-table os-preserve selectable=${a?"multi":""} sticky-header sticky-columns="1" hover striped bordered><div slot="empty" class="os-app-list__empty"><p>${l("No users found.")}</p></div></os-table></div> | |
| 330 | + ${e.view==="table"?e.feed.tail():""} | |
| 331 | + ${Fs(o,e)} | |
| 332 | + </os-tabpanel>`}function Ft(o,e,t){const s=e.roles,i=t==="roles";let n,r;if(i)n=s.data?x(l("%d people across this site. Up to 8 faces per role; people can belong to more than one group."),s.data.total):l("Gathering your role groups…"),r=s.data?us(s.data.groups,a=>{o.local("tab",{value:"all"}),Ws(o,a)}):h`<p class="os-people__empty" role="status">${s.error?l("Role groups are unavailable."):l("Loading all roles…")}</p>`;else{const a=e.activity.data;n=a?x(l("%d people across this site."),a.total):l("Gathering the complete community overview"),r=a?Cs(a,qt(o),F(o),e.contribution,c=>{e.contribution=c,o.repaint()}):h`<section class="os-community__loading" role="status"><h3>${e.activity.error?l("The overview could not load. Use Refresh to retry."):l("Bringing everyone together…")}</h3></section>`}return h`<os-tabpanel for=${t} class="os-app-list__panel" ?hidden=${o.state.tab!==t}> | |
| 333 | + <header class="os-people__hero"><div><span class="os-people__eyebrow">${l(i?"A PLACE FOR EVERYONE":"THE HUMAN SIDE OF YOUR SITE")}</span><h2>${l(i?"Different roles. One community.":"A community, in motion.")}</h2><p>${l(i?"Explore the groups that make your site work.":"The people showing up, joining in, and making things happen.")}</p></div></header> | |
| 334 | + <div class="os-people__scope"><span>${n}</span> | |
| 335 | + ${i?h`<os-button variant="ghost" ?disabled=${s.loading} @click=${()=>void s.load(o)}>${s.loading?l("Refreshing…"):l("Refresh")}</os-button>`:h`<os-button variant="ghost" ?disabled=${e.activity.loading} @click=${()=>void e.activity.load(o)}>${l("Refresh")}</os-button>`}</div> | |
| 336 | + ${(i?s.error:e.activity.error)?h`<os-notice tone="danger">${l("Could not refresh this overview. Try Refresh.")}</os-notice>`:""} | |
| 337 | + <div class="os-people__insights">${r}</div> | |
| 338 | + </os-tabpanel>`}const Os=ao(Ns,{local:{tab:(o,e)=>{o.tab=String(e.value??"all")}},placeholder:o=>({list:{items:[],total:0,pages:0,page:o.page,perPage:o.perPage}}),view:o=>{const{state:e}=o,t=F(o),s=o.ui(D),i=_e();s.feed.reconcile(o);const n=Dt(o,s);return h`<div class="os-app-list desktop-mode-users" data-os-users-root><style>${Es.cssText}${zs.cssText}</style> | |
| 339 | + <os-tabs value=${e.tab} os-bind="tab" class="os-app-list__tabs os-users__tabs" label=${l("Users")} data-os-users-tabs> | |
| 340 | + ${Ms(o).map(r=>h`<os-tab | |
| 341 | + value=${r.id} | |
| 342 | + data-os-users-tab=${r.id} | |
| 343 | + >${r.label}</os-tab>`)} | |
| 201 | 344 | </os-tabs> |
| 202 | - ${Ft(e,s,o,i)} | |
| 203 | - ${n.canCreate?h`<os-tabpanel for="add-new" class="os-users__add-panel" ?hidden=${t.tab!=="add-new"}> | |
| 204 | - ${rt(n,r=>Z(e,r))} | |
| 345 | + ${Hs(o,s,i,n)} | |
| 346 | + ${Ft(o,s,"roles")} | |
| 347 | + ${Ft(o,s,"activity")} | |
| 348 | + ${t.canCreate?h`<os-tabpanel for="add-new" class="os-users__add-panel" ?hidden=${e.tab!=="add-new"}> | |
| 349 | + ${Ls(t,r=>$e(o,r))} | |
| 205 | 350 | </os-tabpanel>`:""} |
| 206 | - <os-tabpanel for="edit" class="os-users__edit-panel" ?hidden=${t.tab!=="edit"}> | |
| 351 | + <os-tabpanel for="edit" class="os-users__edit-panel" ?hidden=${e.tab!=="edit"}> | |
| 207 | 352 | <os-user-profile |
| 208 | 353 | os-preserve |
| 209 | 354 | data-os-user-profile-self |
| 210 | - user-id=${t.tab==="edit"&&n.currentUserId?String(n.currentUserId):""} | |
| 355 | + user-id=${e.tab==="edit"&&t.currentUserId?String(t.currentUserId):""} | |
| 211 | 356 | ></os-user-profile> |
| 212 | 357 | </os-tabpanel> |
| 213 | - </div>`},mounted:e=>{const t=()=>e.repaint();return document.addEventListener("os-mode-changed",t),()=>{document.removeEventListener("os-mode-changed",t)}},updated:e=>{const t=e.ui(R),{state:n,data:s}=e,o=C(e);t.addForm=at(e.root,n,t.addForm);const i=e.root.querySelector("os-user-profile");i&&!t.profileWired&&(t.profileWired=!0,i.config=o,i.fetch=e.fetch,i.toast=(l,u)=>Z(e,l,Nt[u??"info"]));const r=ye(s.list.items,n.status),c=new Map(r.map(l=>[l.id,$t(l)]));for(const[l,u]of c)t.rows.get(l)!==u&&xe(t.cache,l);for(const l of t.rows.keys())c.has(l)||xe(t.cache,l);t.rows=c;const d={onSendReset:l=>It(e,l),onResendWelcome:l=>Lt(e,l),toast:l=>Z(e,l)};O(e)?.toggleAttribute("loading",e.loading),t.sync.sync({table:O(e),rows:r,listKey:`${n.page}|${n.perPage}|${n.search}|${n.status}|${n.orderby}|${n.order}`,fingerprint:Array.from(c.values()).join(` | |
| 214 | -`),columns:l=>Tt(t.cache,o,d,l),wire:l=>{const u=l;u.getRowId=p=>p.id,u.sort={key:"identity",direction:n.order==="desc"?"desc":"asc"},u.addEventListener("os-table-selection-change",()=>{t.selected=Q(e),e.repaint()}),u.addEventListener("os-table-sort-change",p=>{const f=p.detail?.sort;e.dispatch("sort",{orderby:f?xt[f.key]??"name":"name",order:f?.direction??"asc"})}),u.addEventListener("os-table-row-click",p=>{const f=p.detail?.row?.id;typeof f=="number"&&f>0&&$e(f,d)})},onSelection:l=>{t.selected=l.map(Number),queueMicrotask(()=>e.repaint())}})}});return j.default=Ut,Object.defineProperties(j,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),j}({}); | |
| 358 | + </div>`},mounted:o=>{const e=()=>o.repaint();return document.addEventListener("os-mode-changed",e),()=>{document.removeEventListener("os-mode-changed",e),o.ui(D).feed.dispose(),o.ui(D).roles.dispose(),o.ui(D).activity.dispose()}},updated:o=>{const e=o.ui(D),{state:t}=o,s=F(o);e.addForm=Ts(o.root,t,e.addForm);const i=o.root.querySelector("os-user-profile");if(i&&!e.profileWired&&(e.profileWired=!0,i.config=s,i.fetch=o.fetch,i.toast=(c,d)=>$e(o,c,Ps[d??"info"])),ps(o.root),e.roles.update(o),e.feed.observe(o.root),e.activity.update(o),t.tab!=="all")return;const n=Dt(o,e),r=new Map(n.map(c=>[c.id,Zo(c)]));for(const[c,d]of r)e.rows.get(c)!==d&&Et(e.cache,c);for(const c of e.rows.keys())r.has(c)||Et(e.cache,c);e.rows=r;const a={onSendReset:c=>Mt(o,c),onResendWelcome:c=>It(o,c),toast:c=>$e(o,c)};X(o)?.toggleAttribute("loading",o.loading),e.sync.sync({table:X(o),rows:n,listKey:`${t.perPage}|${t.search}|${t.role}|${t.status}|${t.orderby}|${t.order}`,fingerprint:Array.from(r.values()).join(` | |
| 359 | +`),columns:c=>is(e.cache,s,a,c),wire:c=>{const d=c;d.getRowId=p=>p.id,d.sort={key:"identity",direction:t.order==="desc"?"desc":"asc"},d.addEventListener("os-table-selection-change",()=>{e.selected=Ge(o),o.repaint()}),d.addEventListener("os-table-sort-change",p=>{const u=p.detail?.sort;o.dispatch("sort",{orderby:u?Go[u.key]??"name":"name",order:u?.direction??"asc"})}),d.addEventListener("os-table-row-click",p=>{const u=p.detail?.row?.id;typeof u=="number"&&u>0&&Q(u,a)})},onSelection:c=>{e.selected=c.map(Number),queueMicrotask(()=>o.repaint())}})}});return ze.default=Os,Object.defineProperties(ze,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),ze}({}); | |