| @@ -1,7 +1,7 @@ | ||
| 1 | -var openStationUserProfile=function(ie){"use strict";const rt="http://localhost/";function at(n,e){const t=typeof window<"u"&&window.location?window.location.href:rt,o=new URL(n,t),i=e.replace(/^\/+/,""),s=i.indexOf("?"),a=s===-1?i:i.slice(0,s),r=s===-1?"":i.slice(s+1);if(o.searchParams.has("rest_route")){const l=o.searchParams.get("rest_route")??"/",c=l.endsWith("/")?l:l+"/";o.searchParams.set("rest_route",c+a)}else{const l=o.pathname.endsWith("/")?o.pathname:o.pathname+"/";o.pathname=l+a}return r&&new URLSearchParams(r).forEach((c,u)=>{o.searchParams.append(u,c)}),o.toString()}const Ae="X-WP-Nonce";function lt(n,e){const t=ct();if(!t)return e;const o=dt(n);if(!o||!ut(o))return e;const i=e?.headers??(typeof Request<"u"&&n instanceof Request?n.headers:void 0),s=new Headers(i??{});return s.has(Ae)?e:(s.set(Ae,t),{...e??{},headers:s})}function ct(){if(typeof window>"u")return;const e=window.openStationConfig?.restNonce;return typeof e=="string"&&e.length>0?e:void 0}function dt(n){try{const e=typeof window<"u"&&window.location?window.location.href:void 0;return typeof n=="string"?new URL(n,e):n instanceof URL?n:typeof Request<"u"&&n instanceof Request?new URL(n.url,e):null}catch{return null}}function ut(n){return typeof window>"u"||!window.location||n.origin!==window.location.origin?!1:!!(n.pathname.includes("/wp-json/")||n.searchParams.has("rest_route"))}function ht(n,e,t={}){const o=window.wp?.os?.fetch;if(typeof o=="function")return o(n,e,t);const i=lt(n,e);return fetch(n,i)}const $e="desktop-mode";function se(){return window.wp?.i18n}function d(n,e=$e){return se()?.__(n,e)??n}function Ee(n,e,t,o=$e){return se()?._n(n,e,t,o)??(t===1?n:e)}function S(n,...e){const t=se()?.sprintf;if(t)return t(n,...e);let o=0;return n.replace(/%(?:(\d+)\$)?[sd]/g,(i,s)=>{const a=s?Number.parseInt(s,10)-1:o++;return String(e[a]??"")})}function m(n,...e){return{__wpdHtml:!0,strings:n,values:e}}function pt(n){return!!n&&n.__wpdHtml===!0}const ft="$$wpd$$",E=/\$\$wpd\$\$(\d+)\$\$/g,mt="$$wpd-node$$",gt=/^\$\$wpd-node\$\$(\d+)\$\$$/,bt=new Set(["style","script","textarea","title"]);function vt(n){let e="",t=!1,o=null,i=!1,s=null,a="",r=!1;for(let l=0;l<n.length;l++){const c=n[l];e+=c;for(let u=0;u<c.length;u++){const p=c[u];if(i){c.startsWith("-->",u)&&(i=!1,u+=2);continue}if(s!==null){p==="<"&&c[u+1]==="/"&&c.slice(u+2,u+2+s.length).toLowerCase()===s&&(u+=1+s.length,s=null,t=!0,r=!1,a="");continue}if(o!==null){p===o&&(o=null);continue}if(t){p==='"'||p==="'"?(o=p,r=!1):p===">"?(t=!1,r=!1,bt.has(a)&&(s=a),a=""):r&&(/[a-zA-Z0-9-]/.test(p)?a+=p.toLowerCase():r=!1);continue}if(c.startsWith("<!--",u)){i=!0,u+=3;continue}const h=c[u+1]??"";p==="<"&&/[a-zA-Z/!]/.test(h)&&(t=!0,a="",r=/[a-zA-Z]/.test(h))}l<n.length-1&&(e+=t||i||s!==null?`${ft}${l}$$`:`<!--${mt}${l}$$-->`)}return e}const Se=new WeakMap;function ze(n){const e=Se.get(n);if(e)return e;const t=document.createElement("template");t.innerHTML=vt(n);const o=[],i=(r,l)=>{if(r.nodeType===Node.ELEMENT_NODE){const p=r;for(const h of Array.from(p.attributes)){const g=h.name,f=h.value,_=g[0];if(E.test(f))if(E.lastIndex=0,_==="@"){const v=E.exec(f);E.lastIndex=0,o.push({path:l,kind:"event",name:g.slice(1),valueIndex:v?Number(v[1]):0}),p.removeAttribute(g)}else if(_==="."){const v=E.exec(f);E.lastIndex=0,o.push({path:l,kind:"prop",name:g.slice(1),valueIndex:v?Number(v[1]):0}),p.removeAttribute(g)}else if(_==="?"){const v=E.exec(f);E.lastIndex=0,o.push({path:l,kind:"bool",name:g.slice(1),valueIndex:v?Number(v[1]):0}),p.removeAttribute(g)}else{const v=[],y=[];let k=0,A;for(E.lastIndex=0;(A=E.exec(f))!==null;)v.push(f.slice(k,A.index)),y.push(Number(A[1])),k=A.index+A[0].length;v.push(f.slice(k)),o.push({path:l,kind:"attr",name:g,template:v,valueIndices:y}),p.setAttribute(g,"")}}}const c=Array.from(r.childNodes);let u=0;for(let p=0;p<c.length;p++){const h=c[p],g=p+u;if(h.nodeType===Node.COMMENT_NODE){const f=gt.exec(h.data);if(f){const _=document.createTextNode("");h.parentNode.replaceChild(_,h),o.push({path:[...l,g],kind:"node",valueIndex:Number(f[1])})}continue}if(h.nodeType===Node.TEXT_NODE){const f=h.textContent||"";if(!E.test(f)){E.lastIndex=0;continue}E.lastIndex=0;const _=h.parentNode;let v=0,y;const k=[],A=[];for(E.lastIndex=0;(y=E.exec(f))!==null;){y.index>v&&k.push(document.createTextNode(f.slice(v,y.index)));const L=document.createTextNode("");k.push(L),A.push({path:[...l,g+k.length-1],kind:"node",valueIndex:Number(y[1])}),v=y.index+y[0].length}v<f.length&&k.push(document.createTextNode(f.slice(v)));for(const L of k)_.insertBefore(L,h);_.removeChild(h),u+=k.length-1,o.push(...A)}else i(h,[...l,g])}};i(t.content,[]);const a={template:t,buildParts:r=>{const l=[];for(const c of o){let u=r;for(const p of c.path)u=u.childNodes[p];c.kind==="node"?l.push({kind:"node",valueIndex:c.valueIndex,child:{anchor:u,state:null}}):c.kind==="attr"?l.push({kind:"attr",element:u,name:c.name,template:c.template,valueIndices:c.valueIndices}):c.kind==="event"?l.push({kind:"event",valueIndex:c.valueIndex,element:u,name:c.name}):c.kind==="prop"?l.push({kind:"prop",valueIndex:c.valueIndex,element:u,name:c.name}):c.kind==="bool"&&l.push({kind:"bool",valueIndex:c.valueIndex,element:u,name:c.name})}return l}};return Se.set(n,a),a}const Le=new WeakMap;function xt(n,e){for(const t of n.nodes)if(t.parentNode!==e)return!1;return!0}function _t(n,e){const t=Le.get(e);if(t&&t.strings===n.strings&&xt(t,e)){Q(t.parts,n.values);return}const o=ze(n.strings),i=o.template.content.cloneNode(!0),s=o.buildParts(i),a=Array.from(i.childNodes);for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(i),Q(s,n.values),Le.set(e,{strings:n.strings,parts:s,nodes:a})}function Q(n,e){for(const t of n)if(t.kind==="node")J(t.child,e[t.valueIndex]);else if(t.kind==="attr"){let o=t.template[0];for(let i=0;i<t.valueIndices.length;i++)o+=Te(e[t.valueIndices[i]]),o+=t.template[i+1];o!==t.last&&(t.last=o,o===""?t.element.removeAttribute(t.name):t.element.setAttribute(t.name,o))}else if(t.kind==="event"){const o=e[t.valueIndex];o!==t.current&&(t.current&&t.element.removeEventListener(t.name,t.current),o&&t.element.addEventListener(t.name,o),t.current=o)}else if(t.kind==="prop"){const o=e[t.valueIndex];o!==t.last&&(t.last=o,t.element[t.name]=o)}else if(t.kind==="bool"){const o=!!e[t.valueIndex];o!==t.last&&(t.last=o,o?t.element.setAttribute(t.name,""):t.element.removeAttribute(t.name))}}function J(n,e){if(e==null||e===!1){n.state&&(N(n.state),n.state=null);return}if(Array.isArray(e)){Ct(n,e);return}if(pt(e)){kt(n,e);return}if(e instanceof Node){yt(n,e);return}wt(n,Te(e))}function yt(n,e){const t=n.state;t?.shape==="node"&&t.node===e||(t&&N(t),D(n,[e]),n.state={shape:"node",node:e})}function wt(n,e){const t=n.state;if(t?.shape==="text"){t.text!==e&&(t.node.textContent=e,t.text=e);return}t&&N(t);const o=document.createTextNode(e);D(n,[o]),n.state={shape:"text",node:o,text:e}}function kt(n,e){const t=n.state;if(t?.shape==="template"&&t.strings===e.strings){Q(t.parts,e.values);return}t&&N(t);const o=ze(e.strings),i=o.template.content.cloneNode(!0),s=o.buildParts(i),a=Array.from(i.childNodes);D(n,[i]),Q(s,e.values),n.state={shape:"template",strings:e.strings,parts:s,nodes:a}}function Ct(n,e){const t=n.state;if(t?.shape==="array"){const i=Math.min(t.entries.length,e.length);for(let s=0;s<i;s++)J(t.entries[s],e[s]);if(e.length<t.entries.length){for(let s=e.length;s<t.entries.length;s++){const a=t.entries[s];a.state&&N(a.state),a.anchor.remove()}t.entries.length=e.length}else for(let s=t.entries.length;s<e.length;s++){const a=document.createTextNode("");D(n,[a]);const r={anchor:a,state:null};J(r,e[s]),t.entries.push(r)}return}t&&N(t);const o=[];for(const i of e){const s=document.createTextNode("");D(n,[s]);const a={anchor:s,state:null};J(a,i),o.push(a)}n.state={shape:"array",entries:o}}function D(n,e){const t=n.anchor.parentNode;if(t)for(const o of e)t.insertBefore(o,n.anchor)}function N(n){if(n.shape==="text"){n.node.remove();return}if(n.shape==="template"){for(const e of n.parts)e.kind==="node"&&e.child.state&&(N(e.child.state),e.child.state=null);for(const e of n.nodes)e.parentNode&&e.parentNode.removeChild(e);return}if(n.shape==="node"){n.node.parentNode&&n.node.parentNode.removeChild(n.node);return}for(const e of n.entries)e.state&&N(e.state),e.anchor.remove()}function Te(n){return n==null||n===!1?"":String(n)}function re(n,e="short"){if(n===""||n===null||n===void 0)return"";const t=typeof n=="string"&&/^\d{4}-\d{2}$/.test(n)?`${n}-01T00:00:00`:n,o=t instanceof Date?t:new Date(t);if(Number.isNaN(o.getTime()))return String(n);try{switch(e){case"long":return o.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"});case"month":return o.toLocaleDateString(void 0,{year:"numeric",month:"long"});case"datetime":return o.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"});case"iso":return o.toISOString();default:return o.toLocaleDateString(void 0,{month:"short",day:"numeric"})}}catch{return String(n)}}async function At(n){if(n==="")return!1;const e=globalThis.navigator?.clipboard;if(e?.writeText)try{return await e.writeText(n),!0}catch{}return $t(n)}function $t(n){const e=globalThis.document;if(!e?.body||typeof e.execCommand!="function")return!1;const t=e.createElement("textarea");t.value=n,t.setAttribute("readonly",""),t.setAttribute("aria-hidden","true"),t.style.position="fixed",t.style.insetInlineStart="-9999px",t.style.opacity="0",e.body.appendChild(t);const o=e.activeElement;t.select();let i=!1;try{i=e.execCommand("copy")}catch{i=!1}return t.remove(),o?.focus?.(),i}const M=class M 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(Ie)}connectedCallback(){this._adoptStyles(),this.requestUpdate()}attributeChangedCallback(e,t,o){if(t===o)return;const i=Et(e);this._propValues[i]=o,this.requestUpdate()}get classNames(){return Array.from(this.classList)}set classNames(e){if(e==null){this.removeAttribute("class");return}const o=(Array.isArray(e)?e:String(e).split(/\s+/)).map(i=>String(i).trim()).filter(i=>i!=="");this.className=o.join(" ")}requestUpdate(){this._scheduleRender()}emit(e,t){return this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}_installPropAccessors(){const e=this.constructor;for(const t of e.props){if(Object.getOwnPropertyDescriptor(this,t))continue;const o=Ie(t);Object.defineProperty(this,t,{get:()=>t in this._propValues?this._propValues[t]:this.getAttribute(o),set:i=>{let s;i==null||i===!1?s=null:i===!0?s="":s=String(i),this._propValues[t]=s,s===null?this.removeAttribute(o):this.setAttribute(o,s),this.requestUpdate()},enumerable:!0,configurable:!0})}}_scheduleRender(){this._renderScheduled||!this.isConnected||(this._renderScheduled=!0,queueMicrotask(()=>{this._renderScheduled=!1,this.isConnected&&_t(this.render(),this._renderRoot)}))}_adoptStyles(){const e=this.constructor;if(e.styles.length!==0)if(e.shadow&&this.shadowRoot){const t=e.styles.map(o=>o.sheet).filter(o=>o!==null);if(this.shadowRoot.adoptedStyleSheets=t,t.length!==e.styles.length){for(const o of e.styles)if(!o.sheet){const i=document.createElement("style");i.textContent=o.cssText,this.shadowRoot.appendChild(i)}}}else this._adoptLightStyles(e)}_adoptLightStyles(e){if(!M._lightStylesAdopted.has(e)){M._lightStylesAdopted.add(e);for(const t of e.styles){const o=document.createElement("style");o.dataset.osUi=this.tagName.toLowerCase(),o.textContent=t.cssText,document.head.appendChild(o)}}}};M.props=[],M.styles=[],M.shadow=!0,M._lightStylesAdopted=new WeakSet;let z=M;function I(n,e){customElements.get(n)||customElements.define(n,e)}function Ie(n){return n.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function Et(n){return n.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}const St=(()=>{try{return typeof new CSSStyleSheet().replaceSync=="function"}catch{return!1}})();function w(n,...e){let t=n[0];for(let o=1;o<n.length;o++){const i=e[o-1];if(typeof i=="string"||typeof i=="number")t+=String(i);else if(i&&i.__wpdCss)t+=i.cssText;else throw new TypeError("[os-ui] css`` interpolations must be strings, numbers, or other css`` results. Got: "+typeof i);t+=n[o]}if(St){const o=new CSSStyleSheet;return o.replaceSync(t),{__wpdCss:!0,sheet:o,cssText:t}}return{__wpdCss:!0,sheet:null,cssText:t}}function zt(n){const e=[],t=[];let o=null,i=n.parentElement;for(;i&&!(i===document.body||i===document.documentElement);){const a=i.id||"";if(a.startsWith("wp-window-")){o=a.slice(10);break}if(i.tagName.toLowerCase()==="os-tabpanel"){const r=i.getAttribute("for");r&&t.unshift(r)}i=i.parentElement}o&&e.push(ae(o));for(const a of t)e.push("tab-"+ae(a));const s=n.getAttribute("label");return s&&e.push(ae(s)),e.length===0?"os-unnamed":"os-"+e.filter(a=>a!=="").join("-")}function ae(n){return n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function le(n){if(n.id)return n.id;const e=zt(n);return n.id=e,e}const Lt=w`:host{display:inline;color:inherit;font:inherit}`,ee=new Set;let V=null;const Tt=3e4;function It(){V===null&&(V=window.setInterval(()=>{for(const n of ee)n.tick()},Tt))}function Nt(){V!==null&&ee.size===0&&(window.clearInterval(V),V=null)}function Mt(n){if(!n)return null;const e=t=>{const o=new Date(t);return Number.isNaN(o.getTime())?null:o};return Rt(n)?e(n):e(n.replace(" ","T")+"Z")}function Rt(n){const e=Math.max(n.indexOf("T"),n.indexOf(" ")),t=e===-1?"":n.slice(e+1);return/(?:[Zz]|[+-]\d{2}:?\d{2})$/.test(t)}let ce=null,de=null;function Ne(){return typeof navigator<"u"&&navigator.language||"en"}function Pt(){return ce||(ce=new Intl.RelativeTimeFormat(Ne(),{numeric:"auto"})),ce}function Me(){return de||(de=new Intl.RelativeTimeFormat(Ne(),{numeric:"always",style:"narrow"})),de}function Ht(n,e){const t=Pt(),o=n.getTime()-e,i=Math.round(o/1e3),s=Math.abs;return s(i)<45?t.format(0,"second"):Re(t,i)}function Re(n,e){const t=Math.abs,o=Math.round(e/60);if(t(o)<45)return n.format(o,"minute");const i=Math.round(o/60);if(t(i)<22)return n.format(i,"hour");const s=Math.round(i/24);if(t(s)<26)return n.format(s,"day");const a=Math.round(s/30);if(t(a)<11)return n.format(a,"month");const r=Math.round(s/365);return n.format(r,"year")}function jt(n,e){const t=Math.round((n.getTime()-e)/1e3),o=Math.abs;return o(t)<45?Me().format(0,"second"):o(t)>604800?n.toLocaleDateString(void 0,{month:"short",day:"numeric"}):Re(Me(),t)}const F=class F extends z{connectedCallback(){super.connectedCallback(),ee.add(this),It()}disconnectedCallback(){ee.delete(this),Nt()}tick(){this.requestUpdate()}render(){const e=this.datetime,t=Mt(e);if(!t)return m`<span>${e??""}</span>`;const o=Date.now(),i=this.hasAttribute("compact")?jt(t,o):Ht(t,o),s=t.toLocaleString();return m`<time datetime=${t.toISOString()} title=${s} | |
| 1 | +var openStationUserProfile=function(se){"use strict";function dt(n){const e=window.wp?.os;return typeof e?.showToast!="function"?()=>{}:e.showToast(n)??(()=>{})}const ut="http://localhost/";function ht(n,e){const t=typeof window<"u"&&window.location?window.location.href:ut,o=new URL(n,t),i=e.replace(/^\/+/,""),s=i.indexOf("?"),a=s===-1?i:i.slice(0,s),r=s===-1?"":i.slice(s+1);if(o.searchParams.has("rest_route")){const l=o.searchParams.get("rest_route")??"/",c=l.endsWith("/")?l:l+"/";o.searchParams.set("rest_route",c+a)}else{const l=o.pathname.endsWith("/")?o.pathname:o.pathname+"/";o.pathname=l+a}return r&&new URLSearchParams(r).forEach((c,d)=>{o.searchParams.append(d,c)}),o.toString()}const $e="X-WP-Nonce";function pt(n,e){const t=ft();if(!t)return e;const o=mt(n);if(!o||!bt(o))return e;const i=e?.headers??(typeof Request<"u"&&n instanceof Request?n.headers:void 0),s=new Headers(i??{});return s.has($e)?e:(s.set($e,t),{...e??{},headers:s})}function ft(){if(typeof window>"u")return;const e=window.openStationConfig?.restNonce;return typeof e=="string"&&e.length>0?e:void 0}function mt(n){try{const e=typeof window<"u"&&window.location?window.location.href:void 0;return typeof n=="string"?new URL(n,e):n instanceof URL?n:typeof Request<"u"&&n instanceof Request?new URL(n.url,e):null}catch{return null}}function bt(n){return typeof window>"u"||!window.location||n.origin!==window.location.origin?!1:!!(n.pathname.includes("/wp-json/")||n.searchParams.has("rest_route"))}function gt(n,e,t={}){const o=window.wp?.os?.fetch;if(typeof o=="function")return o(n,e,t);const i=pt(n,e);return fetch(n,i)}const Ee="desktop-mode";function re(){return window.wp?.i18n}function u(n,e=Ee){return re()?.__(n,e)??n}function Se(n,e,t,o=Ee){return re()?._n(n,e,t,o)??(t===1?n:e)}function T(n,...e){const t=re()?.sprintf;if(t)return t(n,...e);let o=0;return n.replace(/%(?:(\d+)\$)?[sd]/g,(i,s)=>{const a=s?Number.parseInt(s,10)-1:o++;return String(e[a]??"")})}function m(n,...e){return{__wpdHtml:!0,strings:n,values:e}}function vt(n){return!!n&&n.__wpdHtml===!0}const xt="$$wpd$$",$=/\$\$wpd\$\$(\d+)\$\$/g,_t="$$wpd-node$$",yt=/^\$\$wpd-node\$\$(\d+)\$\$$/,wt=new Set(["style","script","textarea","title"]);function kt(n){let e="",t=!1,o=null,i=!1,s=null,a="",r=!1;for(let l=0;l<n.length;l++){const c=n[l];e+=c;for(let d=0;d<c.length;d++){const p=c[d];if(i){c.startsWith("-->",d)&&(i=!1,d+=2);continue}if(s!==null){p==="<"&&c[d+1]==="/"&&c.slice(d+2,d+2+s.length).toLowerCase()===s&&(d+=1+s.length,s=null,t=!0,r=!1,a="");continue}if(o!==null){p===o&&(o=null);continue}if(t){p==='"'||p==="'"?(o=p,r=!1):p===">"?(t=!1,r=!1,wt.has(a)&&(s=a),a=""):r&&(/[a-zA-Z0-9-]/.test(p)?a+=p.toLowerCase():r=!1);continue}if(c.startsWith("<!--",d)){i=!0,d+=3;continue}const h=c[d+1]??"";p==="<"&&/[a-zA-Z/!]/.test(h)&&(t=!0,a="",r=/[a-zA-Z]/.test(h))}l<n.length-1&&(e+=t||i||s!==null?`${xt}${l}$$`:`<!--${_t}${l}$$-->`)}return e}const Le=new WeakMap;function Te(n){const e=Le.get(n);if(e)return e;const t=document.createElement("template");t.innerHTML=kt(n);const o=[],i=(r,l)=>{if(r.nodeType===Node.ELEMENT_NODE){const p=r;for(const h of Array.from(p.attributes)){const b=h.name,f=h.value,x=b[0];if($.test(f))if($.lastIndex=0,x==="@"){const _=$.exec(f);$.lastIndex=0,o.push({path:l,kind:"event",name:b.slice(1),valueIndex:_?Number(_[1]):0}),p.removeAttribute(b)}else if(x==="."){const _=$.exec(f);$.lastIndex=0,o.push({path:l,kind:"prop",name:b.slice(1),valueIndex:_?Number(_[1]):0}),p.removeAttribute(b)}else if(x==="?"){const _=$.exec(f);$.lastIndex=0,o.push({path:l,kind:"bool",name:b.slice(1),valueIndex:_?Number(_[1]):0}),p.removeAttribute(b)}else{const _=[],y=[];let k=0,C;for($.lastIndex=0;(C=$.exec(f))!==null;)_.push(f.slice(k,C.index)),y.push(Number(C[1])),k=C.index+C[0].length;_.push(f.slice(k)),o.push({path:l,kind:"attr",name:b,template:_,valueIndices:y}),p.setAttribute(b,"")}}}const c=Array.from(r.childNodes);let d=0;for(let p=0;p<c.length;p++){const h=c[p],b=p+d;if(h.nodeType===Node.COMMENT_NODE){const f=yt.exec(h.data);if(f){const x=document.createTextNode("");h.parentNode.replaceChild(x,h),o.push({path:[...l,b],kind:"node",valueIndex:Number(f[1])})}continue}if(h.nodeType===Node.TEXT_NODE){const f=h.textContent||"";if(!$.test(f)){$.lastIndex=0;continue}$.lastIndex=0;const x=h.parentNode;let _=0,y;const k=[],C=[];for($.lastIndex=0;(y=$.exec(f))!==null;){y.index>_&&k.push(document.createTextNode(f.slice(_,y.index)));const N=document.createTextNode("");k.push(N),C.push({path:[...l,b+k.length-1],kind:"node",valueIndex:Number(y[1])}),_=y.index+y[0].length}_<f.length&&k.push(document.createTextNode(f.slice(_)));for(const N of k)x.insertBefore(N,h);x.removeChild(h),d+=k.length-1,o.push(...C)}else i(h,[...l,b])}};i(t.content,[]);const a={template:t,buildParts:r=>{const l=[];for(const c of o){let d=r;for(const p of c.path)d=d.childNodes[p];c.kind==="node"?l.push({kind:"node",valueIndex:c.valueIndex,child:{anchor:d,state:null}}):c.kind==="attr"?l.push({kind:"attr",element:d,name:c.name,template:c.template,valueIndices:c.valueIndices}):c.kind==="event"?l.push({kind:"event",valueIndex:c.valueIndex,element:d,name:c.name}):c.kind==="prop"?l.push({kind:"prop",valueIndex:c.valueIndex,element:d,name:c.name}):c.kind==="bool"&&l.push({kind:"bool",valueIndex:c.valueIndex,element:d,name:c.name})}return l}};return Le.set(n,a),a}const ze=new WeakMap;function Ct(n,e){for(const t of n.nodes)if(t.parentNode!==e)return!1;return!0}function At(n,e){const t=ze.get(e);if(t&&t.strings===n.strings&&Ct(t,e)){Q(t.parts,n.values);return}const o=Te(n.strings),i=o.template.content.cloneNode(!0),s=o.buildParts(i),a=Array.from(i.childNodes);for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(i),Q(s,n.values),ze.set(e,{strings:n.strings,parts:s,nodes:a})}function Q(n,e){for(const t of n)if(t.kind==="node")J(t.child,e[t.valueIndex]);else if(t.kind==="attr"){let o=t.template[0];for(let i=0;i<t.valueIndices.length;i++)o+=Ie(e[t.valueIndices[i]]),o+=t.template[i+1];o!==t.last&&(t.last=o,o===""?t.element.removeAttribute(t.name):t.element.setAttribute(t.name,o))}else if(t.kind==="event"){const o=e[t.valueIndex];o!==t.current&&(t.current&&t.element.removeEventListener(t.name,t.current),o&&t.element.addEventListener(t.name,o),t.current=o)}else if(t.kind==="prop"){const o=e[t.valueIndex];o!==t.last&&(t.last=o,t.element[t.name]=o)}else if(t.kind==="bool"){const o=!!e[t.valueIndex];o!==t.last&&(t.last=o,o?t.element.setAttribute(t.name,""):t.element.removeAttribute(t.name))}}function J(n,e){if(e==null||e===!1){n.state&&(R(n.state),n.state=null);return}if(Array.isArray(e)){Lt(n,e);return}if(vt(e)){St(n,e);return}if(e instanceof Node){$t(n,e);return}Et(n,Ie(e))}function $t(n,e){const t=n.state;t?.shape==="node"&&t.node===e||(t&&R(t),j(n,[e]),n.state={shape:"node",node:e})}function Et(n,e){const t=n.state;if(t?.shape==="text"){t.text!==e&&(t.node.textContent=e,t.text=e);return}t&&R(t);const o=document.createTextNode(e);j(n,[o]),n.state={shape:"text",node:o,text:e}}function St(n,e){const t=n.state;if(t?.shape==="template"&&t.strings===e.strings){Q(t.parts,e.values);return}t&&R(t);const o=Te(e.strings),i=o.template.content.cloneNode(!0),s=o.buildParts(i),a=Array.from(i.childNodes);j(n,[i]),Q(s,e.values),n.state={shape:"template",strings:e.strings,parts:s,nodes:a}}function Lt(n,e){const t=n.state;if(t?.shape==="array"){const i=Math.min(t.entries.length,e.length);for(let s=0;s<i;s++)J(t.entries[s],e[s]);if(e.length<t.entries.length){for(let s=e.length;s<t.entries.length;s++){const a=t.entries[s];a.state&&R(a.state),a.anchor.remove()}t.entries.length=e.length}else for(let s=t.entries.length;s<e.length;s++){const a=document.createTextNode("");j(n,[a]);const r={anchor:a,state:null};J(r,e[s]),t.entries.push(r)}return}t&&R(t);const o=[];for(const i of e){const s=document.createTextNode("");j(n,[s]);const a={anchor:s,state:null};J(a,i),o.push(a)}n.state={shape:"array",entries:o}}function j(n,e){const t=n.anchor.parentNode;if(t)for(const o of e)t.insertBefore(o,n.anchor)}function R(n){if(n.shape==="text"){n.node.remove();return}if(n.shape==="template"){for(const e of n.parts)e.kind==="node"&&e.child.state&&(R(e.child.state),e.child.state=null);for(const e of n.nodes)e.parentNode&&e.parentNode.removeChild(e);return}if(n.shape==="node"){n.node.parentNode&&n.node.parentNode.removeChild(n.node);return}for(const e of n.entries)e.state&&R(e.state),e.anchor.remove()}function Ie(n){return n==null||n===!1?"":String(n)}function ae(n,e="short"){if(n===""||n===null||n===void 0)return"";const t=typeof n=="string"&&/^\d{4}-\d{2}$/.test(n)?`${n}-01T00:00:00`:n,o=t instanceof Date?t:new Date(t);if(Number.isNaN(o.getTime()))return String(n);try{switch(e){case"long":return o.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"});case"month":return o.toLocaleDateString(void 0,{year:"numeric",month:"long"});case"datetime":return o.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"});case"iso":return o.toISOString();default:return o.toLocaleDateString(void 0,{month:"short",day:"numeric"})}}catch{return String(n)}}async function Tt(n){if(n==="")return!1;const e=globalThis.navigator?.clipboard;if(e?.writeText)try{return await e.writeText(n),!0}catch{}return zt(n)}function zt(n){const e=globalThis.document;if(!e?.body||typeof e.execCommand!="function")return!1;const t=e.createElement("textarea");t.value=n,t.setAttribute("readonly",""),t.setAttribute("aria-hidden","true"),t.style.position="fixed",t.style.insetInlineStart="-9999px",t.style.opacity="0",e.body.appendChild(t);const o=e.activeElement;t.select();let i=!1;try{i=e.execCommand("copy")}catch{i=!1}return t.remove(),o?.focus?.(),i}const P=class P 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(Ne)}connectedCallback(){this._adoptStyles(),this.requestUpdate()}attributeChangedCallback(e,t,o){if(t===o)return;const i=It(e);this._propValues[i]=o,this.requestUpdate()}get classNames(){return Array.from(this.classList)}set classNames(e){if(e==null){this.removeAttribute("class");return}const o=(Array.isArray(e)?e:String(e).split(/\s+/)).map(i=>String(i).trim()).filter(i=>i!=="");this.className=o.join(" ")}requestUpdate(){this._scheduleRender()}emit(e,t){return this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}_installPropAccessors(){const e=this.constructor;for(const t of e.props){if(Object.getOwnPropertyDescriptor(this,t))continue;const o=Ne(t);Object.defineProperty(this,t,{get:()=>t in this._propValues?this._propValues[t]:this.getAttribute(o),set:i=>{let s;i==null||i===!1?s=null:i===!0?s="":s=String(i),this._propValues[t]=s,s===null?this.removeAttribute(o):this.setAttribute(o,s),this.requestUpdate()},enumerable:!0,configurable:!0})}}_scheduleRender(){this._renderScheduled||!this.isConnected||(this._renderScheduled=!0,queueMicrotask(()=>{this._renderScheduled=!1,this.isConnected&&At(this.render(),this._renderRoot)}))}_adoptStyles(){const e=this.constructor;if(e.styles.length!==0)if(e.shadow&&this.shadowRoot){const t=e.styles.map(o=>o.sheet).filter(o=>o!==null);if(this.shadowRoot.adoptedStyleSheets=t,t.length!==e.styles.length){for(const o of e.styles)if(!o.sheet){const i=document.createElement("style");i.textContent=o.cssText,this.shadowRoot.appendChild(i)}}}else this._adoptLightStyles(e)}_adoptLightStyles(e){if(!P._lightStylesAdopted.has(e)){P._lightStylesAdopted.add(e);for(const t of e.styles){const o=document.createElement("style");o.dataset.osUi=this.tagName.toLowerCase(),o.textContent=t.cssText,document.head.appendChild(o)}}}};P.props=[],P.styles=[],P.shadow=!0,P._lightStylesAdopted=new WeakSet;let z=P;function I(n,e){customElements.get(n)||customElements.define(n,e)}function Ne(n){return n.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function It(n){return n.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}const Nt=(()=>{try{return typeof new CSSStyleSheet().replaceSync=="function"}catch{return!1}})();function w(n,...e){let t=n[0];for(let o=1;o<n.length;o++){const i=e[o-1];if(typeof i=="string"||typeof i=="number")t+=String(i);else if(i&&i.__wpdCss)t+=i.cssText;else throw new TypeError("[os-ui] css`` interpolations must be strings, numbers, or other css`` results. Got: "+typeof i);t+=n[o]}if(Nt){const o=new CSSStyleSheet;return o.replaceSync(t),{__wpdCss:!0,sheet:o,cssText:t}}return{__wpdCss:!0,sheet:null,cssText:t}}function Mt(n){const e=[],t=[];let o=null,i=n.parentElement;for(;i&&!(i===document.body||i===document.documentElement);){const a=i.id||"";if(a.startsWith("wp-window-")){o=a.slice(10);break}if(i.tagName.toLowerCase()==="os-tabpanel"){const r=i.getAttribute("for");r&&t.unshift(r)}i=i.parentElement}o&&e.push(le(o));for(const a of t)e.push("tab-"+le(a));const s=n.getAttribute("label");return s&&e.push(le(s)),e.length===0?"os-unnamed":"os-"+e.filter(a=>a!=="").join("-")}function le(n){return n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function ce(n){if(n.id)return n.id;const e=Mt(n);return n.id=e,e}const Rt=w`:host{display:inline;color:inherit;font:inherit}`,ee=new Set;let V=null;const Pt=3e4;function Ht(){V===null&&(V=window.setInterval(()=>{for(const n of ee)n.tick()},Pt))}function Dt(){V!==null&&ee.size===0&&(window.clearInterval(V),V=null)}function jt(n){if(!n)return null;const e=t=>{const o=new Date(t);return Number.isNaN(o.getTime())?null:o};return Vt(n)?e(n):e(n.replace(" ","T")+"Z")}function Vt(n){const e=Math.max(n.indexOf("T"),n.indexOf(" ")),t=e===-1?"":n.slice(e+1);return/(?:[Zz]|[+-]\d{2}:?\d{2})$/.test(t)}let de=null,ue=null;function Me(){return typeof navigator<"u"&&navigator.language||"en"}function Ft(){return de||(de=new Intl.RelativeTimeFormat(Me(),{numeric:"auto"})),de}function Re(){return ue||(ue=new Intl.RelativeTimeFormat(Me(),{numeric:"always",style:"narrow"})),ue}function qt(n,e){const t=Ft(),o=n.getTime()-e,i=Math.round(o/1e3),s=Math.abs;return s(i)<45?t.format(0,"second"):Pe(t,i)}function Pe(n,e){const t=Math.abs,o=Math.round(e/60);if(t(o)<45)return n.format(o,"minute");const i=Math.round(o/60);if(t(i)<22)return n.format(i,"hour");const s=Math.round(i/24);if(t(s)<26)return n.format(s,"day");const a=Math.round(s/30);if(t(a)<11)return n.format(a,"month");const r=Math.round(s/365);return n.format(r,"year")}function Ut(n,e){const t=Math.round((n.getTime()-e)/1e3),o=Math.abs;return o(t)<45?Re().format(0,"second"):o(t)>604800?n.toLocaleDateString(void 0,{month:"short",day:"numeric"}):Pe(Re(),t)}const F=class F extends z{connectedCallback(){super.connectedCallback(),ee.add(this),Ht()}disconnectedCallback(){ee.delete(this),Dt()}tick(){this.requestUpdate()}render(){const e=this.datetime,t=jt(e);if(!t)return m`<span>${e??""}</span>`;const o=Date.now(),i=this.hasAttribute("compact")?Ut(t,o):qt(t,o),s=t.toLocaleString();return m`<time datetime=${t.toISOString()} title=${s} | |
| 2 | 2 | >${i}</time |
| 3 | - >`}};F.props=["datetime","compact"],F.styles=[Lt],F.help=void 0;let ue=F;I("os-relative-time",ue);async function Dt(n,e){const t=await n.fetch(`wp/v2/users/${e}?context=edit`);if(!t.ok)throw new Error(`[user-edit] load failed: ${t.status}`);return await t.json()}async function Vt(n,e,t){const o=await n.fetch(`wp/v2/users/${e}?context=edit`,{method:"POST",headers:{"X-HTTP-Method-Override":"PUT","Content-Type":"application/json"},body:JSON.stringify(t)});if(!o.ok){const i=await o.json().catch(()=>({})),s={};for(const[a,r]of Object.entries(i.data?.params??{}))s[a]=String(r);return{ok:!1,error:i.code??`http_${o.status}`,message:i.message,fieldErrors:s}}return{ok:!0,user:await o.json()}}async function Ft(n,e,t=!1){const o=await n.fetch(`desktop-mode/v1/users/${e}/insights${t?"?fresh=1":""}`);if(!o.ok)throw new Error(`[user-edit] insights failed: ${o.status}`);return await o.json()}async function Ut(n,e,t){const o=await n.fetch(`desktop-mode/v1/users/${e}/destroy-sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:t})});if(!o.ok)throw new Error(`http_${o.status}`)}async function qt(n,e){const t=await n.fetch(`desktop-mode/v1/users/${e}/application-passwords`);return t.ok?(await t.json()).items??[]:[]}async function Bt(n,e,t){const o=await n.fetch(`desktop-mode/v1/users/${e}/application-passwords`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t})});if(!o.ok)throw new Error(`http_${o.status}`);return(await o.json()).password}async function Ot(n,e,t){const o=await n.fetch(`desktop-mode/v1/users/${e}/application-passwords/${t}`,{method:"DELETE"});if(!o.ok)throw new Error(`http_${o.status}`)}function Pe(n){if(typeof n=="number")return n>0?n*1e3:NaN;const e=String(n??"");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 o=Date.parse(t);return Number.isFinite(o)?o:NaN}function te(n){const e=Pe(n);if(!Number.isFinite(e)){const o=document.createElement("span");return o.textContent="—",o}const t=document.createElement("os-relative-time");return t.setAttribute("datetime",new Date(e).toISOString()),t.title=re(e,"datetime"),t}function He(n){At(n).catch(()=>!1)}const he=new Map;async function Wt(n){if(!n)return null;let e;try{e=new URL(n,window.location.href)}catch{return n}if(!/gravatar\.com$/i.test(e.hostname))return n;e.searchParams.delete("d"),e.searchParams.delete("s");const t=e.toString(),o=he.get(t);if(o!==void 0)return o instanceof Promise,o;const i=new URL(n,window.location.href);i.searchParams.set("d","blank");const s=new Promise(a=>{const r=new Image;r.crossOrigin="anonymous",r.onload=()=>{try{const l=document.createElement("canvas");l.width=1,l.height=1;const c=l.getContext("2d",{willReadFrequently:!0});if(!c){a(n);return}c.drawImage(r,0,0,1,1);const u=c.getImageData(0,0,1,1).data;a(u[3]===0?null:n)}catch{a(n)}},r.onerror=()=>a(null),r.src=i.toString()}).then(a=>(he.set(t,a),a));return he.set(t,s),s}function Zt(n,e){e&&Wt(e).then(t=>{n.isConnected&&(t?n.setAttribute("src",t):n.removeAttribute("src"))})}function Xt(n){if(!n)return 214;let e=5381;for(let t=0;t<n.length;t++)e=Math.imul(e,33)+n.charCodeAt(t);return(e%360+360)%360}const Kt=w`: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}}`,je={xs:20,sm:24,md:40,lg:64,xl:96},De=new Set(["online","inactive","offline"]),U=class U extends z{constructor(){super(...arguments),this._presenceHandler=null,this._imgFailed=!1,this._onPointerMove=null,this._onPointerEnter=null,this._onPointerLeave=null,this._tiltRaf=0,this._pendingTiltX="0deg",this._pendingTiltY="0deg",this._pendingGlareX="50%",this._pendingGlareY="50%"}connectedCallback(){super.connectedCallback(),this._maybeAttachPresenceListener(),this._attachHoverEffect()}disconnectedCallback(){this._presenceHandler&&(document.removeEventListener("os-presence-changed",this._presenceHandler),this._presenceHandler=null),this._detachHoverEffect()}attributeChangedCallback(e,t,o){super.attributeChangedCallback(e,t,o),e==="src"&&(this._imgFailed=!1),(e==="user-id"||e==="presence")&&this._maybeAttachPresenceListener()}render(){const e=this._attr("src"),t=this._attr("name")||"",o=this._attr("alt"),i=o!==null?o:t,s=this._attr("size"),a=this._resolveSize(s),r=this._presenceForRender(),l=this._attr("clickable")!==null;this.style.setProperty("--os-ui-avatar-size",`${a}px`);const c=e&&!this._imgFailed?"":this._initialsBg(t),u=e&&!this._imgFailed?m`<img | |
| 3 | + >`}};F.props=["datetime","compact"],F.styles=[Rt],F.help=void 0;let he=F;I("os-relative-time",he);function Bt(n){const e=document.createElement("textarea");return e.innerHTML=n,e.value}const Wt=["name","first_name","last_name","nickname","description"];function He(n){for(const e of Wt){const t=n[e];typeof t=="string"&&(n[e]=Bt(t))}return n}async function Ot(n,e){const t=await n.fetch(`wp/v2/users/${e}?context=edit`);if(!t.ok)throw new Error(`[user-edit] load failed: ${t.status}`);return He(await t.json())}async function Zt(n,e,t){const o=await n.fetch(`wp/v2/users/${e}?context=edit`,{method:"POST",headers:{"X-HTTP-Method-Override":"PUT","Content-Type":"application/json"},body:JSON.stringify(t)});if(!o.ok){const i=await o.json().catch(()=>({})),s={};for(const[a,r]of Object.entries(i.data?.params??{}))s[a]=String(r);return{ok:!1,error:i.code??`http_${o.status}`,message:i.message,fieldErrors:s}}return{ok:!0,user:He(await o.json())}}async function Xt(n,e,t=!1){const o=await n.fetch(`desktop-mode/v1/users/${e}/insights${t?"?fresh=1":""}`);if(!o.ok)throw new Error(`[user-edit] insights failed: ${o.status}`);return await o.json()}async function Kt(n,e,t){const o=await n.fetch(`desktop-mode/v1/users/${e}/destroy-sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scope:t})});if(!o.ok)throw new Error(`http_${o.status}`)}async function Gt(n,e){const t=await n.fetch(`desktop-mode/v1/users/${e}/application-passwords`);return t.ok?(await t.json()).items??[]:[]}async function Yt(n,e,t){const o=await n.fetch(`desktop-mode/v1/users/${e}/application-passwords`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t})});if(!o.ok)throw new Error(`http_${o.status}`);return(await o.json()).password}async function Qt(n,e,t){const o=await n.fetch(`desktop-mode/v1/users/${e}/application-passwords/${t}`,{method:"DELETE"});if(!o.ok)throw new Error(`http_${o.status}`)}function De(n){if(typeof n=="number")return n>0?n*1e3:NaN;const e=String(n??"");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 o=Date.parse(t);return Number.isFinite(o)?o:NaN}function te(n){const e=De(n);if(!Number.isFinite(e)){const o=document.createElement("span");return o.textContent="—",o}const t=document.createElement("os-relative-time");return t.setAttribute("datetime",new Date(e).toISOString()),t.title=ae(e,"datetime"),t}function je(n){Tt(n).catch(()=>!1)}const pe=new Map;async function Jt(n){if(!n)return null;let e;try{e=new URL(n,window.location.href)}catch{return n}if(!/gravatar\.com$/i.test(e.hostname))return n;e.searchParams.delete("d"),e.searchParams.delete("s");const t=e.toString(),o=pe.get(t);if(o!==void 0)return o instanceof Promise,o;const i=new URL(n,window.location.href);i.searchParams.set("d","blank");const s=new Promise(a=>{const r=new Image;r.crossOrigin="anonymous",r.onload=()=>{try{const l=document.createElement("canvas");l.width=1,l.height=1;const c=l.getContext("2d",{willReadFrequently:!0});if(!c){a(n);return}c.drawImage(r,0,0,1,1);const d=c.getImageData(0,0,1,1).data;a(d[3]===0?null:n)}catch{a(n)}},r.onerror=()=>a(null),r.src=i.toString()}).then(a=>(pe.set(t,a),a));return pe.set(t,s),s}function eo(n,e){e&&Jt(e).then(t=>{n.isConnected&&(t?n.setAttribute("src",t):n.removeAttribute("src"))})}function to(n){if(!n)return 214;let e=5381;for(let t=0;t<n.length;t++)e=Math.imul(e,33)+n.charCodeAt(t);return(e%360+360)%360}const oo=w`: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}}`,Ve={xs:20,sm:24,md:40,lg:64,xl:96},Fe=new Set(["online","inactive","offline"]),q=class q extends z{constructor(){super(...arguments),this._presenceHandler=null,this._imgFailed=!1,this._onPointerMove=null,this._onPointerEnter=null,this._onPointerLeave=null,this._tiltRaf=0,this._pendingTiltX="0deg",this._pendingTiltY="0deg",this._pendingGlareX="50%",this._pendingGlareY="50%"}connectedCallback(){super.connectedCallback(),this._maybeAttachPresenceListener(),this._attachHoverEffect()}disconnectedCallback(){this._presenceHandler&&(document.removeEventListener("os-presence-changed",this._presenceHandler),this._presenceHandler=null),this._detachHoverEffect()}attributeChangedCallback(e,t,o){super.attributeChangedCallback(e,t,o),e==="src"&&(this._imgFailed=!1),(e==="user-id"||e==="presence")&&this._maybeAttachPresenceListener()}render(){const e=this._attr("src"),t=this._attr("name")||"",o=this._attr("alt"),i=o!==null?o:t,s=this._attr("size"),a=this._resolveSize(s),r=this._presenceForRender(),l=this._attr("clickable")!==null;this.style.setProperty("--os-ui-avatar-size",`${a}px`);const c=e&&!this._imgFailed?"":this._initialsBg(t),d=e&&!this._imgFailed?m`<img | |
| 4 | 4 | src=${e} |
| 5 | 5 | alt=${i} |
| 6 | 6 | @error=${()=>this._onImgError()} |
| 7 | 7 | loading="lazy" |
| @@ -14,9 +14,9 @@ | ||
| 14 | 14 | class="os-avatar__tile" |
| 15 | 15 | aria-label=${i||"User"} |
| 16 | 16 | style=${c?`background:${c};`:""} |
| 17 | 17 | @click=${h=>this._onClick(h)} |
| 18 | - >${u}</button> | |
| 18 | + >${d}</button> | |
| 19 | 19 | ${p} |
| 20 | 20 | `:m` |
| 21 | 21 | <div |
| 22 | 22 | class="os-avatar__tile" |
| @@ -22,11 +22,11 @@ | ||
| 22 | 22 | class="os-avatar__tile" |
| 23 | 23 | role="img" |
| 24 | 24 | aria-label=${i||"User"} |
| 25 | 25 | style=${c?`background:${c};`:""} |
| 26 | - >${u}</div> | |
| 26 | + >${d}</div> | |
| 27 | 27 | ${p} |
| 28 | - `}_attr(e){return this.getAttribute(e)}_resolveSize(e){if(!e)return 32;if(e in je)return je[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=Xt(e);return`linear-gradient(135deg, hsl(${t} 62% 55%), hsl(${(t+24)%360} 58% 42%))`}_presenceForRender(){const e=this._attr("presence");return e&&De.has(e)?e:null}_presenceLabel(e){switch(e){case"online":return"Online";case"inactive":return"Inactive";case"offline":return"Offline"}}_onImgError(){this._imgFailed=!0,this.requestUpdate()}_onClick(e){const t=this._attr("user-id"),o={userId:t!==null&&Number(t)||null,originalEvent:e};this.emit("os-avatar-click",o)}_attachHoverEffect(){typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches||(this._onPointerEnter=()=>{this.style.setProperty("--os-ui-avatar-hover","1")},this._onPointerLeave=()=>{this.style.setProperty("--os-ui-avatar-hover","0"),this._pendingTiltX="0deg",this._pendingTiltY="0deg",this._pendingGlareX="50%",this._pendingGlareY="50%",this._flushTilt()},this._onPointerMove=t=>{const o=this.getBoundingClientRect();if(o.width===0||o.height===0)return;const i=(t.clientX-o.left)/o.width-.5,s=(t.clientY-o.top)/o.height-.5,a=14;this._pendingTiltY=`${(i*a).toFixed(2)}deg`,this._pendingTiltX=`${(-s*a).toFixed(2)}deg`;const r=Math.max(0,Math.min(100,(i+.5)*100)),l=Math.max(0,Math.min(100,(s+.5)*100));this._pendingGlareX=`${r.toFixed(1)}%`,this._pendingGlareY=`${l.toFixed(1)}%`,this._tiltRaf||(this._tiltRaf=requestAnimationFrame(()=>this._flushTilt()))},this.addEventListener("pointerenter",this._onPointerEnter),this.addEventListener("pointerleave",this._onPointerLeave),this.addEventListener("pointermove",this._onPointerMove))}_flushTilt(){this._tiltRaf=0,this.style.setProperty("--os-ui-avatar-tilt-x",this._pendingTiltX),this.style.setProperty("--os-ui-avatar-tilt-y",this._pendingTiltY),this.style.setProperty("--os-ui-avatar-glare-x",this._pendingGlareX),this.style.setProperty("--os-ui-avatar-glare-y",this._pendingGlareY)}_detachHoverEffect(){this._onPointerMove&&(this.removeEventListener("pointermove",this._onPointerMove),this._onPointerMove=null),this._onPointerEnter&&(this.removeEventListener("pointerenter",this._onPointerEnter),this._onPointerEnter=null),this._onPointerLeave&&(this.removeEventListener("pointerleave",this._onPointerLeave),this._onPointerLeave=null),this._tiltRaf&&(cancelAnimationFrame(this._tiltRaf),this._tiltRaf=0)}_maybeAttachPresenceListener(){const e=this._attr("user-id"),t=this._attr("presence"),o=!!e&&!t;o&&!this._presenceHandler?(this._presenceHandler=i=>{const s=i.detail;s&&String(s.userId)===String(e)&&s.newStatus&&De.has(s.newStatus)&&this.setAttribute("presence",s.newStatus)},document.addEventListener("os-presence-changed",this._presenceHandler)):!o&&this._presenceHandler&&(document.removeEventListener("os-presence-changed",this._presenceHandler),this._presenceHandler=null)}};U.props=["src","alt","name","size","presence","userId","clickable"],U.styles=[Kt],U.help=void 0;let pe=U;I("os-avatar",pe);const H=w`: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 ) )}`,Gt=w` .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%}}`,Ve=w` .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%}}`,Fe=w` .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}}`,Ue=w` .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}}`,qe=w` .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}}`,Yt=w` .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%}}`,Qt=w` .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}}`,fe=w` 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}}`,Be=w` input[ type='checkbox' ],input[ type='radio' ]{appearance:none;-webkit-appearance:none;position:relative;flex:0 0 auto;box-sizing:border-box;width:16px;height:16px;margin:0;padding:0;border:1px solid var( --_holo-track-edge );border-radius:4px;background-color:var( --_holo-track );background-image:none;background-repeat:no-repeat;cursor:inherit;transition:background-color var( --_holo-t ) ease,border-color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease}input[ type='radio' ]{border-radius:50%}input[ type='checkbox' ]:hover:not(:disabled ),input[ type='radio' ]:hover:not(:disabled ){border-color:var( --os-ui-accent,#2271b1 )}input[ type='checkbox' ]:focus-visible,input[ type='radio' ]:focus-visible{outline:none;box-shadow:var( --_holo-focus )}input[ type='checkbox' ]:checked,input[ type='checkbox' ]:indeterminate,input[ type='radio' ]:checked{border-color:transparent;background-color:var( --os-ui-accent,#2271b1 )}input[ type='checkbox' ]:checked:focus-visible,input[ type='radio' ]:checked:focus-visible{box-shadow:var( --_holo-focus )}input[ type='checkbox' ]:checked::after{content:'';position:absolute;inset-inline-start:50%;top:46%;width:3.5px;height:7.5px;border:solid var( --os-ui-fg-on-accent,#fff );border-width:0 2px 2px 0;transform:translate( -50%,-50% ) rotate( 45deg );animation:os-holo-tick 180ms cubic-bezier( 0.3,1.4,0.6,1 )}input[ type='checkbox' ]:indeterminate::after{content:'';position:absolute;inset-inline-start:50%;top:50%;width:8px;height:2px;border:0;border-radius:1px;background:var( --os-ui-fg-on-accent,#fff );transform:translate( -50%,-50% )}input[ type='radio' ]:checked::after{content:'';position:absolute;inset-inline-start:50%;top:50%;width:6px;height:6px;border-radius:50%;background:var( --os-ui-fg-on-accent,#fff );transform:translate( -50%,-50% );animation:os-holo-tick 180ms cubic-bezier( 0.3,1.4,0.6,1 )}input[ type='checkbox' ]:disabled,input[ type='radio' ]:disabled{cursor:not-allowed}@keyframes os-holo-tick{from{opacity:0;transform:translate( -50%,-50% ) rotate( 45deg ) scale( 0.4 )}}@media ( prefers-reduced-motion:reduce ){input[ type='checkbox' ]:checked::after,input[ type='radio' ]:checked::after{animation:none}}`,Oe=w` @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}}`;w` ${H} ${Gt} ${Ve} ${Fe} ${Ue} ${qe} ${Yt} ${Qt} ${fe} ${Be} ${Oe} `;const Jt=w` ${H} ${Ve} ${Fe} ${Ue} ${qe} ${Oe}:host{display:inline-flex}:host( [ fill-cell ] ){display:flex;width:100%}button{appearance:none;display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:var( --os-ui-button-padding,6px 12px );border-radius:var( --os-ui-button-border-radius,6px );font:inherit;font-weight:500;cursor:pointer;transition:background-color var( --_holo-t ) ease,color var( --_holo-t ) ease,border-color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease,transform 80ms ease;background:var( --os-ui-button-bg,transparent );background-image:var( --os-ui-button-bg-image,none );background-repeat:var( --os-ui-button-bg-image-repeat,repeat );background-size:var( --os-ui-button-bg-image-size,auto );background-position:var( --os-ui-button-bg-image-position,center );color:var( --os-ui-button-fg,var( --os-ui-fg,#1d2327 ) );border:var( --os-ui-button-border,1px solid var( --os-ui-border,#c3c4c7 ) )}:host( [ fill-cell ] ) button{width:100%;min-height:var( --os-ui-button-min-height,44px )}button:disabled{opacity:0.5;cursor:not-allowed}button:active:not(:disabled ){transform:translateY( 1px )}button:hover:not(:disabled ){background-color:var( --os-ui-button-bg-hover,var( --os-ui-hover,rgba( 0,0,0,0.04 ) ) )}button:focus-visible{outline:none;box-shadow:var( --_holo-focus )}button:disabled::before,button:disabled::after,button:disabled .os-holo-glint{opacity:0 !important}:host( [ variant='primary' ] ) button{background-color:var( --os-ui-button-bg,var( --wp-admin-theme-color,#2271b1 ) );color:var( --os-ui-button-fg,var( --os-ui-fg-on-accent,#fff ) );border:var( --os-ui-button-border,1px solid transparent )}:host( [ variant='primary' ] ) button:hover:not(:disabled ){filter:brightness( 1.06 );background-color:var( --os-ui-button-bg,var( --wp-admin-theme-color,#2271b1 ) );box-shadow:var( --_holo-glow )}:host( [ variant='holo' ] ) button{background-color:transparent;background-image:var( --_holo-fill );background-size:220% 220%;background-position:22% 28%;background-repeat:no-repeat;color:var( --os-ui-button-fg,var( --_holo-ink ) );border:var( --os-ui-button-border,1px solid transparent );box-shadow:var( --_holo-glow );font-weight:600;transition:background-position var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease,filter var( --_holo-t ) ease,transform 80ms ease}:host( [ variant='holo' ] ) button:hover:not(:disabled ){background-color:transparent;background-position:74% 66%;box-shadow:var( --_holo-glow-strong )}:host( [ variant='holo' ] ) button:active:not(:disabled ){background-position:88% 82%;filter:brightness( 0.94 )}:host( [ variant='holo' ] ) button::before{display:none}@media ( prefers-reduced-motion:reduce ){:host( [ variant='holo' ] ) button:hover:not(:disabled ),:host( [ variant='holo' ] ) button:active:not(:disabled ){background-position:22% 28%}}:host( [ variant='secondary' ] ) button{background-color:var( --os-ui-button-bg,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) );color:var( --os-ui-button-fg,var( --os-ui-fg,#1d2327 ) );border:var( --os-ui-button-border,1px solid transparent )}:host( [ variant='secondary' ] ) button:hover:not(:disabled ){background-color:var( --os-ui-button-bg-hover,var( --os-ui-hover,rgba( 0,0,0,0.1 ) ) )}:host( [ variant='danger' ] ) button{background-color:var( --os-ui-button-bg,transparent );color:var( --os-ui-button-fg,var( --os-ui-danger,#d63638 ) );border:var( --os-ui-button-border,1px solid currentColor )}:host( [ variant='danger' ] ) button:hover:not(:disabled ){background-color:var( --os-ui-danger,#d63638 );color:var( --os-ui-fg-on-accent,#fff )}:host( [ variant='danger' ] ) button::after{display:none}:host( [ variant='link' ] ) button{background-color:transparent;background-image:none;color:var( --os-ui-button-fg,var( --wp-admin-theme-color,#2271b1 ) );border:0;padding:0;text-decoration:underline}:host( [ variant='link' ] ) button::before,:host( [ variant='link' ] ) button::after,:host( [ variant='link' ] ) .os-holo-glint,:host( [ variant='link' ] ) .os-holo-ring{display:none}:host( [ variant='link' ] ) button:active:not(:disabled ){transform:none}:host( [ busy ] ) button{pointer-events:none;opacity:0.75}:host( [ variant='holo' ][ busy ] ) button{animation:os-holo-drift 12s ease-in-out infinite}@media ( prefers-reduced-motion:reduce ){:host( [ variant='holo' ][ busy ] ) button{animation:none}}.os-button__spinner{box-sizing:border-box;display:inline-block;width:12px;height:12px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:os-button-spin 0.6s linear infinite;flex-shrink:0}@keyframes os-button-spin{to{transform:rotate( 360deg )}}`,q=class q extends z{render(){const e=this.disabled!==null,t=this.busy!==null,o=this.type||"button";return m` | |
| 28 | + `}_attr(e){return this.getAttribute(e)}_resolveSize(e){if(!e)return 32;if(e in Ve)return Ve[e];const t=Number(e);return Number.isFinite(t)&&t>0?t:32}_initials(e){const t=e.trim();return t?Array.from(t)[0]?.toUpperCase()??"?":"?"}_initialsBg(e){const t=to(e);return`linear-gradient(135deg, hsl(${t} 62% 55%), hsl(${(t+24)%360} 58% 42%))`}_presenceForRender(){const e=this._attr("presence");return e&&Fe.has(e)?e:null}_presenceLabel(e){switch(e){case"online":return"Online";case"inactive":return"Inactive";case"offline":return"Offline"}}_onImgError(){this._imgFailed=!0,this.requestUpdate()}_onClick(e){const t=this._attr("user-id"),o={userId:t!==null&&Number(t)||null,originalEvent:e};this.emit("os-avatar-click",o)}_attachHoverEffect(){typeof window<"u"&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches||(this._onPointerEnter=()=>{this.style.setProperty("--os-ui-avatar-hover","1")},this._onPointerLeave=()=>{this.style.setProperty("--os-ui-avatar-hover","0"),this._pendingTiltX="0deg",this._pendingTiltY="0deg",this._pendingGlareX="50%",this._pendingGlareY="50%",this._flushTilt()},this._onPointerMove=t=>{const o=this.getBoundingClientRect();if(o.width===0||o.height===0)return;const i=(t.clientX-o.left)/o.width-.5,s=(t.clientY-o.top)/o.height-.5,a=14;this._pendingTiltY=`${(i*a).toFixed(2)}deg`,this._pendingTiltX=`${(-s*a).toFixed(2)}deg`;const r=Math.max(0,Math.min(100,(i+.5)*100)),l=Math.max(0,Math.min(100,(s+.5)*100));this._pendingGlareX=`${r.toFixed(1)}%`,this._pendingGlareY=`${l.toFixed(1)}%`,this._tiltRaf||(this._tiltRaf=requestAnimationFrame(()=>this._flushTilt()))},this.addEventListener("pointerenter",this._onPointerEnter),this.addEventListener("pointerleave",this._onPointerLeave),this.addEventListener("pointermove",this._onPointerMove))}_flushTilt(){this._tiltRaf=0,this.style.setProperty("--os-ui-avatar-tilt-x",this._pendingTiltX),this.style.setProperty("--os-ui-avatar-tilt-y",this._pendingTiltY),this.style.setProperty("--os-ui-avatar-glare-x",this._pendingGlareX),this.style.setProperty("--os-ui-avatar-glare-y",this._pendingGlareY)}_detachHoverEffect(){this._onPointerMove&&(this.removeEventListener("pointermove",this._onPointerMove),this._onPointerMove=null),this._onPointerEnter&&(this.removeEventListener("pointerenter",this._onPointerEnter),this._onPointerEnter=null),this._onPointerLeave&&(this.removeEventListener("pointerleave",this._onPointerLeave),this._onPointerLeave=null),this._tiltRaf&&(cancelAnimationFrame(this._tiltRaf),this._tiltRaf=0)}_maybeAttachPresenceListener(){const e=this._attr("user-id"),t=this._attr("presence"),o=!!e&&!t;o&&!this._presenceHandler?(this._presenceHandler=i=>{const s=i.detail;s&&String(s.userId)===String(e)&&s.newStatus&&Fe.has(s.newStatus)&&this.setAttribute("presence",s.newStatus)},document.addEventListener("os-presence-changed",this._presenceHandler)):!o&&this._presenceHandler&&(document.removeEventListener("os-presence-changed",this._presenceHandler),this._presenceHandler=null)}};q.props=["src","alt","name","size","presence","userId","clickable"],q.styles=[oo],q.help=void 0;let fe=q;I("os-avatar",fe);const D=w`: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 ) )}`,no=w` .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%}}`,qe=w` .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%}}`,Ue=w` .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}}`,Be=w` .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}}`,We=w` .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}}`,io=w` .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%}}`,so=w` .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}}`,me=w` 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}}`,Oe=w` 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}}`,Ze=w` @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}}`;w` ${D} ${no} ${qe} ${Ue} ${Be} ${We} ${io} ${so} ${me} ${Oe} ${Ze} `;const ro=w` ${D} ${qe} ${Ue} ${Be} ${We} ${Ze}: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 )}}`,U=class U extends z{static get observedAttributes(){return[...super.observedAttributes,"aria-label"]}render(){const e=this.disabled!==null,t=this.busy!==null,o=this.type||"button",i=this.getAttribute("aria-label")||"";return m` | |
| 29 | 29 | <button |
| 30 | 30 | part="button" |
| 31 | 31 | class="os-holo-edge os-holo-sheen" |
| 32 | 32 | type=${o} |
| @@ -31,8 +31,9 @@ | ||
| 31 | 31 | class="os-holo-edge os-holo-sheen" |
| 32 | 32 | type=${o} |
| 33 | 33 | ?disabled=${e||t} |
| 34 | 34 | aria-busy=${t?"true":"false"} |
| 35 | + aria-label=${i} | |
| 35 | 36 | > |
| 36 | 37 | ${t?m`<span class="os-button__spinner" aria-hidden="true"></span>`:""} |
| 37 | 38 | <slot></slot> |
| 38 | 39 | <!-- |
| @@ -44,13 +45,13 @@ | ||
| 44 | 45 | --> |
| 45 | 46 | <span class="os-holo-glint" aria-hidden="true"></span> |
| 46 | 47 | <span class="os-holo-ring" aria-hidden="true"></span> |
| 47 | 48 | </button> |
| 48 | - `}};q.props=["variant","disabled","type","busy","fill-cell"],q.styles=[Jt],q.help=void 0;let me=q;I("os-button",me);const eo=w`:host{display:block;container-type:inline-size;container-name:os-form;font-size:13px;color:var( --os-ui-fg,#1d2327 )}:host( [ hidden ] ){display:none}.header{margin:0 0 18px}.header:empty{display:none}.fields{display:grid;grid-template-columns:1fr;gap:14px 16px;margin:0 0 18px}@container os-form ( min-width:480px ){.fields{grid-template-columns:repeat( 2,minmax( 0,1fr ) )}}@container os-form ( min-width:760px ){:host( [ columns="3" ] ) .fields{grid-template-columns:repeat( 3,minmax( 0,1fr ) )}}:host( [ columns="1" ] ) .fields{grid-template-columns:1fr}:host( [ columns="2" ] ) .fields{grid-template-columns:repeat( 2,minmax( 0,1fr ) )}::slotted( [ full-width ] ){grid-column:1 / -1}::slotted( [ slot ] ){display:contents}.error{margin:0 0 14px;padding:10px 12px;border-radius:6px;background:var( --os-ui-notice-error-bg,rgba( 179,45,46,0.10 ) );color:var( --os-ui-danger-hover,#b32d2e );font-size:13px;line-height:1.4}.error[ hidden ]{display:none}.footer{display:flex;flex-wrap:wrap;gap:8px;align-items:center;justify-content:flex-end;border-top:1px solid var( --os-ui-border,#dcdcde );padding-top:14px}:host( [ align="start" ] ) .footer{justify-content:flex-start}:host( [ align="stretch" ] ) .footer{justify-content:stretch}:host( [ align="stretch" ] ) .footer .footer-actions{flex:1 1 auto}.footer-leading,.footer-trailing{display:contents}.footer-actions{display:inline-flex;gap:8px;align-items:center;margin-inline-start:auto}:host( [ align="start" ] ) .footer-actions{margin-inline-start:0}:host( [ busy ] ){pointer-events:none}:host( [ busy ] ) .fields{opacity:0.6}:host( [ busy ] ) .footer{pointer-events:auto}.busy-spinner{display:inline-flex;width:14px;height:14px;border-radius:50%;border:2px solid currentColor;border-right-color:transparent;animation:os-form-spin 0.7s linear infinite;vertical-align:-2px;margin-inline-end:6px}@keyframes os-form-spin{to{transform:rotate( 360deg )}}@media ( prefers-reduced-motion:reduce ){.busy-spinner{animation-duration:2s}}`,B=class B extends z{constructor(){super(...arguments),this._initial=new Map,this._captured=!1,this._fieldChangeListener=null,this._enterSubmitListener=null}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this._captureInitialValues()),this._fieldChangeListener=e=>this._onAnyFieldInput(e),this.addEventListener("os-input-change",this._fieldChangeListener),this.addEventListener("os-input-commit",this._fieldChangeListener),this.addEventListener("os-checkbox-change",this._fieldChangeListener),this.addEventListener("os-select-change",this._fieldChangeListener),this.addEventListener("change",this._fieldChangeListener),this._enterSubmitListener=()=>this.submit(),this.addEventListener("os-submit",this._enterSubmitListener)}disconnectedCallback(){this._fieldChangeListener&&(this.removeEventListener("os-input-change",this._fieldChangeListener),this.removeEventListener("os-input-commit",this._fieldChangeListener),this.removeEventListener("os-checkbox-change",this._fieldChangeListener),this.removeEventListener("os-select-change",this._fieldChangeListener),this.removeEventListener("change",this._fieldChangeListener),this._fieldChangeListener=null),this._enterSubmitListener&&(this.removeEventListener("os-submit",this._enterSubmitListener),this._enterSubmitListener=null)}render(){const e=this["submit-label"]||"Submit",t=this["reset-label"]||"Reset",o=this.error||"",i=this.busy!==null,a=this["show-reset"]!=="false";return m` | |
| 49 | + `}};U.props=["variant","disabled","type","busy","fill-cell"],U.styles=[ro],U.help=void 0;let be=U;I("os-button",be);const ao=w`:host{display:block;container-type:inline-size;container-name:os-form;font-size:13px;color:var( --os-ui-fg,#1d2327 )}:host( [ hidden ] ){display:none}.header{margin:0 0 18px}.header:empty{display:none}.fields{display:grid;grid-template-columns:1fr;gap:14px 16px;margin:0 0 18px}@container os-form ( min-width:480px ){.fields{grid-template-columns:repeat( 2,minmax( 0,1fr ) )}}@container os-form ( min-width:760px ){:host( [ columns="3" ] ) .fields{grid-template-columns:repeat( 3,minmax( 0,1fr ) )}}:host( [ columns="1" ] ) .fields{grid-template-columns:1fr}:host( [ columns="2" ] ) .fields{grid-template-columns:repeat( 2,minmax( 0,1fr ) )}::slotted( [ full-width ] ){grid-column:1 / -1}::slotted( [ slot ] ){display:contents}.error{margin:0 0 14px;padding:10px 12px;border-radius:6px;background:var( --os-ui-notice-error-bg,rgba( 179,45,46,0.10 ) );color:var( --os-ui-danger-hover,#b32d2e );font-size:13px;line-height:1.4}.error[ hidden ]{display:none}.footer{display:flex;flex-wrap:wrap;gap:8px;align-items:center;justify-content:flex-end;border-top:1px solid var( --os-ui-border,#dcdcde );padding-top:14px}:host( [ align="start" ] ) .footer{justify-content:flex-start}:host( [ align="stretch" ] ) .footer{justify-content:stretch}:host( [ align="stretch" ] ) .footer .footer-actions{flex:1 1 auto}.footer-leading,.footer-trailing{display:contents}.footer-actions{display:inline-flex;gap:8px;align-items:center;margin-inline-start:auto}:host( [ align="start" ] ) .footer-actions{margin-inline-start:0}:host( [ busy ] ){pointer-events:none}:host( [ busy ] ) .fields{opacity:0.6}:host( [ busy ] ) .footer{pointer-events:auto}.busy-spinner{display:inline-flex;width:14px;height:14px;border-radius:50%;border:2px solid currentColor;border-right-color:transparent;animation:os-form-spin 0.7s linear infinite;vertical-align:-2px;margin-inline-end:6px}@keyframes os-form-spin{to{transform:rotate( 360deg )}}@media ( prefers-reduced-motion:reduce ){.busy-spinner{animation-duration:2s}}`;function Xe(n){if(n===null||typeof n!="object")return n;try{return structuredClone(n)}catch{return n}}const B=class B extends z{constructor(){super(...arguments),this._initial=new Map,this._captured=!1,this._fieldChangeListener=null,this._enterSubmitListener=null}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this._captureInitialValues()),this._fieldChangeListener=e=>this._onAnyFieldInput(e),this.addEventListener("os-input-change",this._fieldChangeListener),this.addEventListener("os-input-commit",this._fieldChangeListener),this.addEventListener("os-checkbox-change",this._fieldChangeListener),this.addEventListener("os-select-change",this._fieldChangeListener),this.addEventListener("os-range-change",this._fieldChangeListener),this.addEventListener("os-color-change",this._fieldChangeListener),this.addEventListener("change",this._fieldChangeListener),this._enterSubmitListener=()=>this.submit(),this.addEventListener("os-submit",this._enterSubmitListener)}disconnectedCallback(){this._fieldChangeListener&&(this.removeEventListener("os-input-change",this._fieldChangeListener),this.removeEventListener("os-input-commit",this._fieldChangeListener),this.removeEventListener("os-checkbox-change",this._fieldChangeListener),this.removeEventListener("os-select-change",this._fieldChangeListener),this.removeEventListener("os-range-change",this._fieldChangeListener),this.removeEventListener("os-color-change",this._fieldChangeListener),this.removeEventListener("change",this._fieldChangeListener),this._fieldChangeListener=null),this._enterSubmitListener&&(this.removeEventListener("os-submit",this._enterSubmitListener),this._enterSubmitListener=null)}render(){const e=this["submit-label"]||"Submit",t=this["reset-label"]||"Reset",o=this.error||"",i=this.busy!==null,a=this["show-reset"]!=="false";return m` | |
| 49 | 50 | <div class="header" part="header"> |
| 50 | 51 | <slot name="header"></slot> |
| 51 | 52 | </div> |
| 52 | - <div class="fields" part="fields"> | |
| 53 | + <div class="fields" part="fields" ?inert=${i}> | |
| 53 | 54 | <slot></slot> |
| 54 | 55 | </div> |
| 55 | 56 | <slot name="error"> |
| 56 | 57 | ${o?m`<p class="error" role="alert" part="error">${o}</p>`:m`<p class="error" role="alert" part="error" hidden></p>`} |
| @@ -79,15 +80,15 @@ | ||
| 79 | 80 | <span class="footer-trailing" |
| 80 | 81 | ><slot name="footer-trailing"></slot |
| 81 | 82 | ></span> |
| 82 | 83 | </footer> |
| 83 | - `}getValues(){const e={};for(const t of this._namedFields()){const o=t.getAttribute("name");o&&(e[o]=this._readField(t))}return e}setValues(e){for(const[t,o]of Object.entries(e)){const i=this._fieldByName(t);i&&this._writeField(i,o)}}setBusy(e){e?this.setAttribute("busy",""):this.removeAttribute("busy")}setError(e){e?this.setAttribute("error",e):this.removeAttribute("error")}setFieldInvalid(e,t=!0,o=null){const i=this._fieldByName(e);i&&(t?(i.setAttribute("invalid",""),o!==null&&i.setAttribute("error",o)):(i.removeAttribute("invalid"),i.removeAttribute("error")))}clearErrors(){this.setError(null);for(const e of this._namedFields())e.removeAttribute("invalid"),e.removeAttribute("error")}reset(){this.clearErrors();for(const[e,t]of this._initial.entries()){const o=this._fieldByName(e);if(o){if(t.checked!==null){o.checked=t.checked,t.checked?o.setAttribute("checked",""):o.removeAttribute("checked");continue}this._writeField(o,t.value)}}this.dispatchEvent(new CustomEvent("os-form-reset",{bubbles:!0,composed:!0,detail:{form:this}}))}submit(){const e=[];for(const i of this._namedFields()){const s=i.getAttribute("name");if(!s||!i.hasAttribute("required"))continue;const r=this._readField(i);if(r==null||r===""||Array.isArray(r)&&r.length===0){i.setAttribute("invalid","");const c=i.getAttribute("label");e.push(c||s)}}if(e.length>0){const i=e.join(", ");this.setError(`Required: ${i}`);return}const t=this.getValues(),o=new CustomEvent("os-form-submit",{bubbles:!0,composed:!0,cancelable:!0,detail:{values:t,form:this}});this.dispatchEvent(o)}_captureInitialValues(){if(this._captured)return;const e=this._namedFields();if(e.length!==0){for(const t of e){const o=t.getAttribute("name");if(!o)continue;const i=t.tagName==="OS-CHECKBOX"||t.tagName==="OS-CHECKBOX-LABEL"||t.tagName==="INPUT"&&t.type==="checkbox";this._initial.set(o,{value:this._readField(t),checked:i?!!t.checked:null})}this._captured=!0}}_namedFields(){return Array.from(this.querySelectorAll("[name]"))}_fieldByName(e){const t=typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/["\\]/g,"\\$&");return this.querySelector(`[name="${t}"]`)}_readField(e){const t=e.tagName.toUpperCase();return t==="OS-CHECKBOX"||t==="OS-CHECKBOX-LABEL"||t==="INPUT"&&e.type==="checkbox"?typeof e.checked=="boolean"?e.checked:e.hasAttribute("checked"):e.value!==void 0&&e.value!==null?e.value:e.getAttribute("value")??""}_writeField(e,t){const o=e.tagName.toUpperCase();if(o==="OS-CHECKBOX"||o==="OS-CHECKBOX-LABEL"||o==="INPUT"&&e.type==="checkbox"){const a=!!t;e.checked=a,a?e.setAttribute("checked",""):e.removeAttribute("checked");return}const s=t==null?"":String(t);e.value=s,e.setAttribute("value",s)}_onAnyFieldInput(e){const t=e.target;if(!t)return;const o=t.getAttribute?.("name");o&&(this.dispatchEvent(new CustomEvent("os-form-input",{bubbles:!0,composed:!0,detail:{name:o,value:this._readField(t),form:this}})),t.hasAttribute("invalid")&&t.removeAttribute("invalid"))}};B.props=["submit-label","reset-label","error","busy","columns","min-column","show-reset","align"],B.styles=[eo],B.help=void 0;let ge=B;I("os-form",ge);const to=w`: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 oe=null;function oo(n){let e=n.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 We(){const n=new Map;if(typeof document>"u")return n;const e=Array.from(document.styleSheets??[]);for(const t of e){let o=null;try{o=t.cssRules}catch{continue}if(o)for(const i of Array.from(o)){const s=i;if(!s||!s.selectorText)continue;const a=s.selectorText.match(/\.dashicons-([a-z0-9-]+)::?before/i);if(!a)continue;const r=s.style?.content;if(!r)continue;const l=oo(r);l&&n.set(a[1],l)}}return n}function no(n){oe||(oe=We());const e=n.startsWith("dashicons-")?n.slice(10):n;return oe.get(e)??null}function io(){oe=We()}let Ze=!1;function so(){if(Ze||typeof window>"u")return;Ze=!0;const n=()=>{io()};document.readyState==="loading"&&document.addEventListener("DOMContentLoaded",n,{once:!0}),window.addEventListener("load",n,{once:!0})}so();const O=class O extends z{render(){const e=this.name||"",t=e.startsWith("dashicons-")?e.slice(10):e,o=this.size;o&&/^\d+$/.test(o)&&this.style.setProperty("--os-ui-icon-size",`${o}px`);const i=no(t);return i?m`<span | |
| 84 | + `}getValues(){const e={};for(const t of this._namedFields()){const o=t.getAttribute("name");o&&(e[o]=this._readField(t))}return e}setValues(e){for(const[t,o]of Object.entries(e)){const i=this._fieldByName(t);i&&this._writeField(i,o)}}setBusy(e){e?this.setAttribute("busy",""):this.removeAttribute("busy")}setError(e){e?this.setAttribute("error",e):this.removeAttribute("error")}setFieldInvalid(e,t=!0,o=null){const i=this._fieldByName(e);i&&(t?(i.setAttribute("invalid",""),o!==null&&i.setAttribute("error",o)):(i.removeAttribute("invalid"),i.removeAttribute("error")))}clearErrors(){this.setError(null);for(const e of this._namedFields())e.removeAttribute("invalid"),e.removeAttribute("error")}reset(){this.clearErrors();for(const[e,t]of this._initial.entries()){const o=this._fieldByName(e);if(o){if(t.checked!==null){o.checked=t.checked,t.checked?o.setAttribute("checked",""):o.removeAttribute("checked");continue}this._writeField(o,Xe(t.value))}}this.dispatchEvent(new CustomEvent("os-form-reset",{bubbles:!0,composed:!0,detail:{form:this}}))}submit(){if(this.hasAttribute("busy"))return;const e=[];for(const i of this._namedFields()){const s=i.getAttribute("name");if(!s||!i.hasAttribute("required"))continue;const r=this._readField(i);if(r==null||r===""||Array.isArray(r)&&r.length===0){i.setAttribute("invalid","");const c=i.getAttribute("label");e.push(c||s)}}if(e.length>0){const i=e.join(", ");this.setError(`Required: ${i}`);return}const t=this.getValues(),o=new CustomEvent("os-form-submit",{bubbles:!0,composed:!0,cancelable:!0,detail:{values:t,form:this}});this.dispatchEvent(o)}_captureInitialValues(){if(this._captured)return;const e=this._namedFields();if(e.length!==0){for(const t of e){const o=t.getAttribute("name");if(!o)continue;const i=t.tagName==="OS-SWITCH"||t.tagName==="OS-CHECKBOX"||t.tagName==="OS-CHECKBOX-LABEL"||t.tagName==="INPUT"&&t.type==="checkbox";this._initial.set(o,{value:Xe(this._readField(t)),checked:i?!!this._readField(t):null})}this._captured=!0}}_namedFields(){return Array.from(this.querySelectorAll("[name]"))}_fieldByName(e){const t=typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/["\\]/g,"\\$&");return this.querySelector(`[name="${t}"]`)}_readField(e){const t=e.tagName.toUpperCase();return t==="OS-SWITCH"||t==="OS-CHECKBOX"||t==="OS-CHECKBOX-LABEL"||t==="INPUT"&&e.type==="checkbox"?typeof e.checked=="boolean"?e.checked:e.hasAttribute("checked"):e.value!==void 0&&e.value!==null?e.value:e.getAttribute("value")??""}_writeField(e,t){const o=e.tagName.toUpperCase();if(o==="OS-SWITCH"||o==="OS-CHECKBOX"||o==="OS-CHECKBOX-LABEL"||o==="INPUT"&&e.type==="checkbox"){const a=!!t;e.checked=a,a?e.setAttribute("checked",""):e.removeAttribute("checked");return}if(t!==null&&typeof t=="object"||e.value!==null&&typeof e.value=="object"){e.value=t;return}const s=t==null?"":String(t);e.value=s,e.setAttribute("value",s)}_onAnyFieldInput(e){const t=e.target;if(!t)return;const o=t.getAttribute?.("name");o&&(this.dispatchEvent(new CustomEvent("os-form-input",{bubbles:!0,composed:!0,detail:{name:o,value:this._readField(t),form:this}})),t.hasAttribute("invalid")&&t.removeAttribute("invalid"))}};B.props=["submit-label","reset-label","error","busy","columns","min-column","show-reset","align"],B.styles=[ao],B.help=void 0;let ge=B;I("os-form",ge);const lo=w`: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 oe=null;function co(n){let e=n.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 Ke(){const n=new Map;if(typeof document>"u")return n;const e=Array.from(document.styleSheets??[]);for(const t of e){let o=null;try{o=t.cssRules}catch{continue}if(o)for(const i of Array.from(o)){const s=i;if(!s||!s.selectorText)continue;const a=s.selectorText.match(/\.dashicons-([a-z0-9-]+)::?before/i);if(!a)continue;const r=s.style?.content;if(!r)continue;const l=co(r);l&&n.set(a[1],l)}}return n}function uo(n){oe||(oe=Ke());const e=n.startsWith("dashicons-")?n.slice(10):n;return oe.get(e)??null}function ho(){oe=Ke()}let Ge=!1;function po(){if(Ge||typeof window>"u")return;Ge=!0;const n=()=>{ho()};document.readyState==="loading"&&document.addEventListener("DOMContentLoaded",n,{once:!0}),window.addEventListener("load",n,{once:!0})}po();const W=class W extends z{render(){const e=this.name||"",t=e.startsWith("dashicons-")?e.slice(10):e,o=this.size;o&&/^\d+$/.test(o)&&this.style.setProperty("--os-ui-icon-size",`${o}px`);const i=uo(t);return i?m`<span | |
| 84 | 85 | class="os-icon__glyph os-icon__glyph--char dashicons dashicons-${t}" |
| 85 | 86 | aria-hidden="true" |
| 86 | 87 | >${i}</span>`:m`<span |
| 87 | 88 | class="os-icon__glyph dashicons dashicons-${t}" |
| 88 | 89 | aria-hidden="true" |
| 89 | - ></span>`}};O.props=["name","size"],O.styles=[to],O.help=void 0;let be=O;I("os-icon",be);const Xe={close:{a:'fill="currentColor"',b:'<path d="m13.06 12 6.47-6.47-1.06-1.06L12 10.94 5.53 4.47 4.47 5.53 10.94 12l-6.47 6.47 1.06 1.06L12 13.06l6.47 6.47 1.06-1.06L13.06 12Z" />'},check:{a:'fill="currentColor"',b:'<path d="M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z" />'},"chevron-right":{a:'fill="currentColor"',b:'<path d="M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" />'},"arrow-up-right":{a:'fill="currentColor"',b:'<path d="M10 6H18V14H16.5V8.5L7 18L6 17L15.5 7.5H10V6Z" />'},plus:{a:'fill="currentColor"',b:'<path d="M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" />'},search:{a:'fill="currentColor"',b:'<path d="M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z" />'},pin:{a:'fill="currentColor"',b:'<path d="m21.5 9.1-6.6-6.6-4.2 5.6c-1.2-.1-2.4.1-3.6.7-.1 0-.1.1-.2.1-.5.3-.9.6-1.2.9l3.7 3.7-5.7 5.7v1.1h1.1l5.7-5.7 3.7 3.7c.4-.4.7-.8.9-1.2.1-.1.1-.2.2-.3.6-1.1.8-2.4.6-3.6l5.6-4.1zm-7.3 3.5.1.9c.1.9 0 1.8-.4 2.6l-6-6c.8-.4 1.7-.5 2.6-.4l.9.1L15 4.9 19.1 9l-4.9 3.6z" />'},trash:{a:'fill="currentColor"',b:'<path fill-rule="evenodd" clip-rule="evenodd" d="M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z" />'},download:{a:'fill="currentColor"',b:'<path d="M18 11.3l-1-1.1-4 4V3h-1.5v11.3L7 10.2l-1 1.1 6.2 5.8 5.8-5.8zm.5 3.7v3.5h-13V15H4v5h16v-5h-1.5z" />'},settings:{a:'fill="currentColor"',b:'<path d="m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z" /><path d="m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z" />'},info:{a:'fill="currentColor"',b:'<path fill-rule="evenodd" clip-rule="evenodd" d="M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm.75 4v1.5h-1.5V8h1.5Zm0 8v-5h-1.5v5h1.5Z" />'},bell:{a:'fill="currentColor"',b:'<path fill-rule="evenodd" clip-rule="evenodd" d="M17 11.5c0 1.353.17 2.368.976 3 .266.209.602.376 1.024.5v1H5v-1c.422-.124.757-.291 1.024-.5.806-.632.976-1.647.976-3V9c0-2.8 2.2-5 5-5s5 2.2 5 5v2.5ZM15.5 9v2.5c0 .93.066 1.98.515 2.897l.053.103H7.932a4.018 4.018 0 0 0 .053-.103c.449-.917.515-1.967.515-2.897V9c0-1.972 1.528-3.5 3.5-3.5s3.5 1.528 3.5 3.5Zm-5.492 9.008c0-.176.023-.346.065-.508h3.854A1.996 1.996 0 0 1 12 20c-1.1 0-1.992-.892-1.992-1.992Z" />'},more:{a:'fill="currentColor"',b:'<path d="M11 13h2v-2h-2v2zm-6 0h2v-2H5v2zm12-2v2h2v-2h-2z" />'},maximize:{a:'fill="currentColor"',b:'<path d="M6 4a2 2 0 0 0-2 2v3h1.5V6a.5.5 0 0 1 .5-.5h3V4H6Zm3 14.5H6a.5.5 0 0 1-.5-.5v-3H4v3a2 2 0 0 0 2 2h3v-1.5Zm6 1.5v-1.5h3a.5.5 0 0 0 .5-.5v-3H20v3a2 2 0 0 1-2 2h-3Zm3-16a2 2 0 0 1 2 2v3h-1.5V6a.5.5 0 0 0-.5-.5h-3V4h3Z" />'},edit:{a:'fill="currentColor"',b:'<path d="m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z" />'},color:{a:'fill="currentColor"',b:'<path d="M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3zm-5.1 7.6c-2.5 0-4.6-2.1-4.6-4.6 0-.3.1-1 .8-2.3.5-.9 1.1-1.9 2-3.1.7-.9 1.3-1.7 1.8-2.3.7.8 1.3 1.6 1.8 2.3.8 1.1 1.5 2.2 2 3.1.7 1.3.8 2 .8 2.3 0 2.5-2.1 4.6-4.6 4.6z" />'},wallpaper:{a:'fill="currentColor"',b:'<path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z" />'},warning:{a:'fill="currentColor"',b:'<path fill-rule="evenodd" clip-rule="evenodd" d="M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm-.75 12v-1.5h1.5V16h-1.5Zm0-8v5h1.5V8h-1.5Z" />'},minimize:{a:'fill="currentColor"',b:'<path d="M5 11.25h14v1.5H5z" />'},window:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="4.125" y="5.4375" width="15.75" height="13.125" rx="1.75"/><path d="M4.125 9.8125h15.75"/><circle cx="7.275" cy="7.625" r="0.7438" fill="currentColor" stroke="none"/>'},windows:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="3.6875" y="8.5" width="11.375" height="10.0625" rx="1.75"/><path d="M3.6875 12h11.375"/><path d="M8.5 8.5V7.1875a1.75 1.75 0 0 1 1.75-1.75h7.875A1.75 1.75 0 0 1 19.875 7.1875v7a1.75 1.75 0 0 1-1.75 1.75h-3.0625"/>'},dock:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="3.25" y="8.5" width="17.5" height="7" rx="3.5"/><circle cx="7.625" cy="12" r="1.0062" fill="currentColor" stroke="none"/><circle cx="12" cy="12" r="1.0062" fill="currentColor" stroke="none"/><circle cx="16.375" cy="12" r="1.0062" fill="currentColor" stroke="none"/>'},spaces:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="3.6875" y="5.4375" width="7.4375" height="7.875" rx="1.75"/><rect x="12.875" y="5.4375" width="7.4375" height="7.875" rx="1.75"/><circle cx="9.375" cy="17.6875" r="0.7875" fill="currentColor" stroke="none"/><circle cx="12" cy="17.6875" r="0.7875" fill="currentColor" stroke="none"/><circle cx="14.625" cy="17.6875" r="0.7875" fill="currentColor" stroke="none"/>'},copilot:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<path d="M10 2.5Q10.9 8.5 17.5 10Q10.9 11.5 10 17.5Q9.1 11.5 2.5 10Q9.1 8.5 10 2.5Z" fill="currentColor" stroke="none"/><path d="M17.9 14Q18.35 17.1 21.5 17.6Q18.35 18.1 17.9 21.2Q17.45 18.1 14.3 17.6Q17.45 17.1 17.9 14Z" fill="currentColor" stroke="none"/>'},snap:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="3.6875" y="5.4375" width="16.625" height="13.125" rx="1.75"/><path d="M12 5.4375v13.125"/><path d="M12 12h8.3125"/>'},command:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<path d="M14.625 6.75v10.5a2.625 2.625 0 1 0 2.625-2.625H6.75a2.625 2.625 0 1 0 2.625 2.625V6.75a2.625 2.625 0 1 0-2.625 2.625h10.5a2.625 2.625 0 1 0-2.625-2.625"/>'},apps:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="4.125" y="4.125" width="6.5625" height="6.5625" rx="1.75"/><rect x="13.3125" y="4.125" width="6.5625" height="6.5625" rx="1.75"/><rect x="4.125" y="13.3125" width="6.5625" height="6.5625" rx="1.75"/><rect x="13.3125" y="13.3125" width="6.5625" height="6.5625" rx="1.75"/>'},widgets:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="3.6875" y="3.6875" width="9.625" height="9.625" rx="1.75"/><rect x="15.0625" y="3.6875" width="5.25" height="5.25" rx="1.75"/><rect x="15.0625" y="10.6875" width="5.25" height="9.625" rx="1.75"/><rect x="3.6875" y="15.0625" width="9.625" height="5.25" rx="1.75"/>'},user:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<circle cx="12" cy="8.9375" r="3.5"/><path d="M5.4375 19.4375a6.5625 6.5625 0 0 1 13.125 0"/>'},lock:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="5.4375" y="10.6875" width="13.125" height="8.75" rx="1.75"/><path d="M8.5 10.6875V8.0625a3.5 3.5 0 0 1 7 0v2.625"/>'}};function Ke(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function ro(n){return Object.prototype.hasOwnProperty.call(Xe,n)?Xe[n]:null}function ao(n,e={}){const t=ro(n);if(!t)return"";const{size:o=24,className:i,title:s,rotate:a}=e,r=['xmlns="http://www.w3.org/2000/svg"','viewBox="0 0 24 24"'];o!=null&&r.push(`width="${o}"`,`height="${o}"`),r.push(t.a),i&&r.push(`class="${Ke(i)}"`),s?r.push('role="img"',`aria-label="${Ke(s)}"`):r.push('aria-hidden="true"','focusable="false"');const l=a?`<g transform="rotate(${a} 12 12)">${t.b}</g>`:t.b;return`<svg ${r.join(" ")}>${l}</svg>`}function Ge(n,e={}){const t=ao(n,e),o=document.createElement("div");o.innerHTML=t;const i=o.firstElementChild;return i instanceof SVGSVGElement?i:document.createElementNS("http://www.w3.org/2000/svg","svg")}const lo=w` ${H}:host{display:flex;flex-direction:column;gap:8px;font-size:13px;color:var( --os-ui-fg,#1d2327 );min-width:0}:host( [ hidden ] ){display:none}.os-select__label{font-size:13px;line-height:1.5;color:var( --os-ui-fg-muted,#646970 )}.os-select__trigger{appearance:none;display:flex;align-items:center;gap:8px;width:100%;min-width:0;padding:8px 12px;background:var( --os-ui-hover,rgba( 0,0,0,0.05 ) );border:1px solid transparent;border-radius:8px;font:inherit;font-size:13px;line-height:1.5;color:var( --os-ui-fg,#1d2327 );text-align:start;cursor:pointer;transition:background-color var( --_holo-t ) ease,border-color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease}.os-select__trigger:hover:not(:disabled ){background:var( --os-ui-hover,rgba( 0,0,0,0.08 ) );border-color:var( --os-ui-border-strong,#8c8f94 )}.os-select__trigger:focus,.os-select__trigger:focus-visible{outline:none;border-color:var( --os-ui-accent,#2271b1 );box-shadow:var( --_holo-focus-field )}.os-select__trigger:disabled{opacity:0.5;cursor:not-allowed}:host( [ plain ] ){display:inline-flex;flex-direction:row;align-items:center}:host( [ plain ] ) .os-select__label{display:none}:host( [ plain ] ) .os-select__trigger{width:auto;padding:4px 6px;background:transparent;border-color:transparent;border-radius:6px}:host( [ plain ] ) .os-select__trigger:hover:not(:disabled ){background:var( --os-ui-hover,rgba( 0,0,0,0.05 ) );border-color:transparent}:host( [ plain ] ) .os-select__trigger:focus,:host( [ plain ] ) .os-select__trigger:focus-visible{border-color:var( --os-ui-accent,#2271b1 )}:host( [ plain ] ) .os-select__value{flex:0 1 auto}.os-select__value{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.os-select__value--placeholder{color:var( --os-ui-fg-muted,#646970 )}.os-select__chevron{flex:0 0 auto;pointer-events:none;color:var( --os-ui-fg-muted,#646970 )}.os-select__trigger:hover .os-select__chevron{color:var( --os-ui-fg,#1d2327 )}.os-select__trigger:focus .os-select__chevron,.os-select__trigger:focus-visible .os-select__chevron{color:var( --os-ui-accent,#2271b1 )}.os-select__popup{position:fixed;inset:auto;margin:0;max-height:min( 320px,60vh );overflow-y:auto;padding:4px;background:var( --os-ui-surface,#fff );border:1px solid var( --os-ui-border,#dcdcde );border-radius:8px;box-shadow:0 12px 32px rgba( 0,0,0,0.45 );color:var( --os-ui-fg,#1d2327 )}.os-select__popup:not( [ data-open ] ){display:none}.os-select__popup:popover-open{display:block}.os-select__popup[ data-open ]{position:absolute;top:calc( 100% + 4px );left:0;min-width:100%;z-index:1000}:host{position:relative}.os-select__option{display:flex;align-items:center;gap:8px;padding:7px 10px;border-radius:6px;font-size:13px;line-height:1.5;cursor:pointer;white-space:nowrap}.os-select__check{flex:0 0 auto;visibility:hidden}.os-select__option[ aria-selected='true' ] .os-select__check{visibility:visible}.os-select__option[ data-active ],.os-select__option:hover{background:var( --os-ui-accent,#2271b1 );color:var( --os-ui-fg-on-accent,#fff )}.os-select__option[ aria-disabled='true' ]{opacity:0.5;cursor:not-allowed}.os-select__option[ aria-disabled='true' ]:hover{background:transparent;color:inherit}@media ( prefers-reduced-motion:reduce ){.os-select__trigger{transition-duration:1ms}}`,co=w`:host{display:none}`,W=class W extends z{render(){return m``}};W.props=["value","disabled"],W.styles=[co],W.help=void 0;let ve=W;I("os-option",ve);const Z=class Z extends z{constructor(){super(...arguments),this._optionObserver=null,this._open=!1,this._activeIndex=-1,this._typed="",this._dismissedAt=0,this._typedTimer=null,this._onWindowScroll=e=>{const t=e.target,o=this._popup();o&&t instanceof Node&&(t===o||o.contains(t))||this._hide()},this._onWindowResize=()=>this._hide()}set items(e){const t=this.querySelectorAll(":scope > os-option");for(const s of Array.from(t))s.remove();for(const s of e){const a=document.createElement("os-option");a.setAttribute("value",s.value),a.textContent=s.label,this.appendChild(a)}const o=this.value;!(o!==null&&e.some(s=>s.value===o))&&e.length>0&&(this.value=e[0].value),this.requestUpdate()}connectedCallback(){super.connectedCallback(),le(this),this._optionObserver=new MutationObserver(()=>this.requestUpdate()),this._optionObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value","disabled"],characterData:!0})}disconnectedCallback(){this._optionObserver?.disconnect(),this._optionObserver=null,this._teardownDismiss(),this._open=!1,this._typedTimer&&(clearTimeout(this._typedTimer),this._typedTimer=null)}render(){const e=this.label||"",t=this.value,o=this.placeholder||"",i=this.disabled!==null;e&&this.setAttribute("aria-label",e);const s=this.getAttribute("aria-label")||"",a=e||s||o,r=this._readOptions(),l=r.find(f=>f.value===t),c=l?l.label:o,u=this.id||"os-unnamed",p=`${u}__listbox`,h=`${u}__trigger`,g=this._open&&this._activeIndex>=0?`${u}__opt-${this._activeIndex}`:"";return m` | |
| 90 | + ></span>`}};W.props=["name","size"],W.styles=[lo],W.help=void 0;let ve=W;I("os-icon",ve);const Ye={close:{a:'fill="currentColor"',b:'<path d="m13.06 12 6.47-6.47-1.06-1.06L12 10.94 5.53 4.47 4.47 5.53 10.94 12l-6.47 6.47 1.06 1.06L12 13.06l6.47 6.47 1.06-1.06L13.06 12Z" />'},check:{a:'fill="currentColor"',b:'<path d="M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z" />'},"chevron-right":{a:'fill="currentColor"',b:'<path d="M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" />'},"arrow-up-right":{a:'fill="currentColor"',b:'<path d="M10 6H18V14H16.5V8.5L7 18L6 17L15.5 7.5H10V6Z" />'},plus:{a:'fill="currentColor"',b:'<path d="M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" />'},search:{a:'fill="currentColor"',b:'<path d="M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z" />'},pin:{a:'fill="currentColor"',b:'<path d="m21.5 9.1-6.6-6.6-4.2 5.6c-1.2-.1-2.4.1-3.6.7-.1 0-.1.1-.2.1-.5.3-.9.6-1.2.9l3.7 3.7-5.7 5.7v1.1h1.1l5.7-5.7 3.7 3.7c.4-.4.7-.8.9-1.2.1-.1.1-.2.2-.3.6-1.1.8-2.4.6-3.6l5.6-4.1zm-7.3 3.5.1.9c.1.9 0 1.8-.4 2.6l-6-6c.8-.4 1.7-.5 2.6-.4l.9.1L15 4.9 19.1 9l-4.9 3.6z" />'},trash:{a:'fill="currentColor"',b:'<path fill-rule="evenodd" clip-rule="evenodd" d="M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z" />'},download:{a:'fill="currentColor"',b:'<path d="M18 11.3l-1-1.1-4 4V3h-1.5v11.3L7 10.2l-1 1.1 6.2 5.8 5.8-5.8zm.5 3.7v3.5h-13V15H4v5h16v-5h-1.5z" />'},settings:{a:'fill="currentColor"',b:'<path d="m19 7.5h-7.628c-.3089-.87389-1.1423-1.5-2.122-1.5-.97966 0-1.81309.62611-2.12197 1.5h-2.12803v1.5h2.12803c.30888.87389 1.14231 1.5 2.12197 1.5.9797 0 1.8131-.62611 2.122-1.5h7.628z" /><path d="m19 15h-2.128c-.3089-.8739-1.1423-1.5-2.122-1.5s-1.8131.6261-2.122 1.5h-7.628v1.5h7.628c.3089.8739 1.1423 1.5 2.122 1.5s1.8131-.6261 2.122-1.5h2.128z" />'},info:{a:'fill="currentColor"',b:'<path fill-rule="evenodd" clip-rule="evenodd" d="M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm.75 4v1.5h-1.5V8h1.5Zm0 8v-5h-1.5v5h1.5Z" />'},bell:{a:'fill="currentColor"',b:'<path fill-rule="evenodd" clip-rule="evenodd" d="M17 11.5c0 1.353.17 2.368.976 3 .266.209.602.376 1.024.5v1H5v-1c.422-.124.757-.291 1.024-.5.806-.632.976-1.647.976-3V9c0-2.8 2.2-5 5-5s5 2.2 5 5v2.5ZM15.5 9v2.5c0 .93.066 1.98.515 2.897l.053.103H7.932a4.018 4.018 0 0 0 .053-.103c.449-.917.515-1.967.515-2.897V9c0-1.972 1.528-3.5 3.5-3.5s3.5 1.528 3.5 3.5Zm-5.492 9.008c0-.176.023-.346.065-.508h3.854A1.996 1.996 0 0 1 12 20c-1.1 0-1.992-.892-1.992-1.992Z" />'},more:{a:'fill="currentColor"',b:'<path d="M11 13h2v-2h-2v2zm-6 0h2v-2H5v2zm12-2v2h2v-2h-2z" />'},maximize:{a:'fill="currentColor"',b:'<path d="M6 4a2 2 0 0 0-2 2v3h1.5V6a.5.5 0 0 1 .5-.5h3V4H6Zm3 14.5H6a.5.5 0 0 1-.5-.5v-3H4v3a2 2 0 0 0 2 2h3v-1.5Zm6 1.5v-1.5h3a.5.5 0 0 0 .5-.5v-3H20v3a2 2 0 0 1-2 2h-3Zm3-16a2 2 0 0 1 2 2v3h-1.5V6a.5.5 0 0 0-.5-.5h-3V4h3Z" />'},edit:{a:'fill="currentColor"',b:'<path d="m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z" />'},color:{a:'fill="currentColor"',b:'<path d="M17.2 10.9c-.5-1-1.2-2.1-2.1-3.2-.6-.9-1.3-1.7-2.1-2.6L12 4l-1 1.1c-.6.9-1.3 1.7-2 2.6-.8 1.2-1.5 2.3-2 3.2-.6 1.2-1 2.2-1 3 0 3.4 2.7 6.1 6.1 6.1s6.1-2.7 6.1-6.1c0-.8-.3-1.8-1-3zm-5.1 7.6c-2.5 0-4.6-2.1-4.6-4.6 0-.3.1-1 .8-2.3.5-.9 1.1-1.9 2-3.1.7-.9 1.3-1.7 1.8-2.3.7.8 1.3 1.6 1.8 2.3.8 1.1 1.5 2.2 2 3.1.7 1.3.8 2 .8 2.3 0 2.5-2.1 4.6-4.6 4.6z" />'},wallpaper:{a:'fill="currentColor"',b:'<path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z" />'},warning:{a:'fill="currentColor"',b:'<path fill-rule="evenodd" clip-rule="evenodd" d="M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm-.75 12v-1.5h1.5V16h-1.5Zm0-8v5h1.5V8h-1.5Z" />'},minimize:{a:'fill="currentColor"',b:'<path d="M5 11.25h14v1.5H5z" />'},window:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="4.125" y="5.4375" width="15.75" height="13.125" rx="1.75"/><path d="M4.125 9.8125h15.75"/><circle cx="7.275" cy="7.625" r="0.7438" fill="currentColor" stroke="none"/>'},windows:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="3.6875" y="8.5" width="11.375" height="10.0625" rx="1.75"/><path d="M3.6875 12h11.375"/><path d="M8.5 8.5V7.1875a1.75 1.75 0 0 1 1.75-1.75h7.875A1.75 1.75 0 0 1 19.875 7.1875v7a1.75 1.75 0 0 1-1.75 1.75h-3.0625"/>'},dock:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="3.25" y="8.5" width="17.5" height="7" rx="3.5"/><circle cx="7.625" cy="12" r="1.0062" fill="currentColor" stroke="none"/><circle cx="12" cy="12" r="1.0062" fill="currentColor" stroke="none"/><circle cx="16.375" cy="12" r="1.0062" fill="currentColor" stroke="none"/>'},spaces:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="3.6875" y="5.4375" width="7.4375" height="7.875" rx="1.75"/><rect x="12.875" y="5.4375" width="7.4375" height="7.875" rx="1.75"/><circle cx="9.375" cy="17.6875" r="0.7875" fill="currentColor" stroke="none"/><circle cx="12" cy="17.6875" r="0.7875" fill="currentColor" stroke="none"/><circle cx="14.625" cy="17.6875" r="0.7875" fill="currentColor" stroke="none"/>'},copilot:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<path d="M10 2.5Q10.9 8.5 17.5 10Q10.9 11.5 10 17.5Q9.1 11.5 2.5 10Q9.1 8.5 10 2.5Z" fill="currentColor" stroke="none"/><path d="M17.9 14Q18.35 17.1 21.5 17.6Q18.35 18.1 17.9 21.2Q17.45 18.1 14.3 17.6Q17.45 17.1 17.9 14Z" fill="currentColor" stroke="none"/>'},snap:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="3.6875" y="5.4375" width="16.625" height="13.125" rx="1.75"/><path d="M12 5.4375v13.125"/><path d="M12 12h8.3125"/>'},command:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<path d="M14.625 6.75v10.5a2.625 2.625 0 1 0 2.625-2.625H6.75a2.625 2.625 0 1 0 2.625 2.625V6.75a2.625 2.625 0 1 0-2.625 2.625h10.5a2.625 2.625 0 1 0-2.625-2.625"/>'},apps:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="4.125" y="4.125" width="6.5625" height="6.5625" rx="1.75"/><rect x="13.3125" y="4.125" width="6.5625" height="6.5625" rx="1.75"/><rect x="4.125" y="13.3125" width="6.5625" height="6.5625" rx="1.75"/><rect x="13.3125" y="13.3125" width="6.5625" height="6.5625" rx="1.75"/>'},widgets:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="3.6875" y="3.6875" width="9.625" height="9.625" rx="1.75"/><rect x="15.0625" y="3.6875" width="5.25" height="5.25" rx="1.75"/><rect x="15.0625" y="10.6875" width="5.25" height="9.625" rx="1.75"/><rect x="3.6875" y="15.0625" width="9.625" height="5.25" rx="1.75"/>'},user:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<circle cx="12" cy="8.9375" r="3.5"/><path d="M5.4375 19.4375a6.5625 6.5625 0 0 1 13.125 0"/>'},lock:{a:'fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"',b:'<rect x="5.4375" y="10.6875" width="13.125" height="8.75" rx="1.75"/><path d="M8.5 10.6875V8.0625a3.5 3.5 0 0 1 7 0v2.625"/>'}};function Qe(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function fo(n){return Object.prototype.hasOwnProperty.call(Ye,n)?Ye[n]:null}function mo(n,e={}){const t=fo(n);if(!t)return"";const{size:o=24,className:i,title:s,rotate:a}=e,r=['xmlns="http://www.w3.org/2000/svg"','viewBox="0 0 24 24"'];o!=null&&r.push(`width="${o}"`,`height="${o}"`),r.push(t.a),i&&r.push(`class="${Qe(i)}"`),s?r.push('role="img"',`aria-label="${Qe(s)}"`):r.push('aria-hidden="true"','focusable="false"');const l=a?`<g transform="rotate(${a} 12 12)">${t.b}</g>`:t.b;return`<svg ${r.join(" ")}>${l}</svg>`}function Je(n,e={}){const t=mo(n,e),o=document.createElement("div");o.innerHTML=t;const i=o.firstElementChild;return i instanceof SVGSVGElement?i:document.createElementNS("http://www.w3.org/2000/svg","svg")}const bo=w` ${D}:host{display:flex;flex-direction:column;gap:8px;font-size:13px;color:var( --os-ui-fg,#1d2327 );min-width:0}:host( [ hidden ] ){display:none}.os-select__label{font-size:13px;line-height:1.5;color:var( --os-ui-fg-muted,#646970 )}.os-select__trigger{appearance:none;display:flex;align-items:center;gap:8px;width:100%;min-width:0;padding:8px 12px;background:var( --os-ui-hover,rgba( 0,0,0,0.05 ) );border:1px solid transparent;border-radius:8px;font:inherit;font-size:13px;line-height:1.5;color:var( --os-ui-fg,#1d2327 );text-align:start;cursor:pointer;transition:background-color var( --_holo-t ) ease,border-color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease}.os-select__trigger:hover:not(:disabled ){background:var( --os-ui-hover,rgba( 0,0,0,0.08 ) );border-color:var( --os-ui-border-strong,#8c8f94 )}.os-select__trigger:focus,.os-select__trigger:focus-visible{outline:none;border-color:var( --os-ui-accent,#2271b1 );box-shadow:var( --_holo-focus-field )}.os-select__trigger:disabled{opacity:0.5;cursor:not-allowed}:host( [ plain ] ){display:inline-flex;flex-direction:row;align-items:center}:host( [ plain ] ) .os-select__label{display:none}:host( [ plain ] ) .os-select__trigger{width:auto;padding:4px 6px;background:transparent;border-color:transparent;border-radius:6px}:host( [ plain ] ) .os-select__trigger:hover:not(:disabled ){background:var( --os-ui-hover,rgba( 0,0,0,0.05 ) );border-color:transparent}:host( [ plain ] ) .os-select__trigger:focus,:host( [ plain ] ) .os-select__trigger:focus-visible{border-color:var( --os-ui-accent,#2271b1 )}:host( [ plain ] ) .os-select__value{flex:0 1 auto}.os-select__value{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.os-select__value--placeholder{color:var( --os-ui-fg-muted,#646970 )}.os-select__chevron{flex:0 0 auto;pointer-events:none;color:var( --os-ui-fg-muted,#646970 )}.os-select__trigger:hover .os-select__chevron{color:var( --os-ui-fg,#1d2327 )}.os-select__trigger:focus .os-select__chevron,.os-select__trigger:focus-visible .os-select__chevron{color:var( --os-ui-accent,#2271b1 )}.os-select__popup{position:fixed;inset:auto;margin:0;max-height:min( 320px,60vh );overflow-y:auto;padding:4px;background:var( --os-ui-surface,#fff );border:1px solid var( --os-ui-border,#dcdcde );border-radius:8px;box-shadow:0 12px 32px rgba( 0,0,0,0.45 );color:var( --os-ui-fg,#1d2327 )}.os-select__popup:not( [ data-open ] ){display:none}.os-select__popup:popover-open{display:block}.os-select__popup[ data-open ]{position:absolute;top:calc( 100% + 4px );left:0;min-width:100%;z-index:1000}:host{position:relative}.os-select__option{display:flex;align-items:center;gap:8px;padding:7px 10px;border-radius:6px;font-size:13px;line-height:1.5;cursor:pointer;white-space:nowrap}.os-select__check{flex:0 0 auto;visibility:hidden}.os-select__option[ aria-selected='true' ] .os-select__check{visibility:visible}.os-select__option[ data-active ],.os-select__option:hover{background:var( --os-ui-accent,#2271b1 );color:var( --os-ui-accent-ink,var( --os-ui-fg-on-accent,#fff ) )}.os-select__option[ aria-disabled='true' ]{opacity:0.5;cursor:not-allowed}.os-select__option[ aria-disabled='true' ]:hover{background:transparent;color:inherit}@media ( prefers-reduced-motion:reduce ){.os-select__trigger{transition-duration:1ms}}`,go=w`:host{display:none}`,O=class O extends z{render(){return m``}};O.props=["value","disabled"],O.styles=[go],O.help=void 0;let xe=O;I("os-option",xe);const Z=class Z extends z{constructor(){super(...arguments),this._optionObserver=null,this._open=!1,this._activeIndex=-1,this._typed="",this._dismissedAt=0,this._typedTimer=null,this._onWindowScroll=e=>{const t=e.target,o=this._popup();o&&t instanceof Node&&(t===o||o.contains(t))||this._hide()},this._onWindowResize=()=>this._hide()}set items(e){const t=this.querySelectorAll(":scope > os-option");for(const s of Array.from(t))s.remove();for(const s of e){const a=document.createElement("os-option");a.setAttribute("value",s.value),a.textContent=s.label,this.appendChild(a)}const o=this.value;!(o!==null&&e.some(s=>s.value===o))&&e.length>0&&(this.value=e[0].value),this.requestUpdate()}connectedCallback(){super.connectedCallback(),ce(this),this._optionObserver=new MutationObserver(()=>this.requestUpdate()),this._optionObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value","disabled"],characterData:!0})}disconnectedCallback(){this._optionObserver?.disconnect(),this._optionObserver=null,this._teardownDismiss(),this._open=!1,this._typedTimer&&(clearTimeout(this._typedTimer),this._typedTimer=null)}render(){const e=this.label||"",t=this.value,o=this.placeholder||"",i=this.disabled!==null;e&&this.setAttribute("aria-label",e);const s=this.getAttribute("aria-label")||"",a=e||s||o,r=this._readOptions(),l=r.find(f=>f.value===t),c=l?l.label:o,d=this.id||"os-unnamed",p=`${d}__listbox`,h=`${d}__trigger`,b=this._open&&this._activeIndex>=0?`${d}__opt-${this._activeIndex}`:"";return m` | |
| 90 | 91 | ${e?m`<label |
| 91 | 92 | class="os-select__label" |
| 92 | 93 | for=${h} |
| 93 | 94 | >${e}</label>`:m``} |
| @@ -99,9 +100,9 @@ | ||
| 99 | 100 | aria-haspopup="listbox" |
| 100 | 101 | aria-expanded=${this._open?"true":"false"} |
| 101 | 102 | aria-controls=${p} |
| 102 | 103 | aria-label=${a} |
| 103 | - aria-activedescendant=${g} | |
| 104 | + aria-activedescendant=${b} | |
| 104 | 105 | ?disabled=${i} |
| 105 | 106 | @click=${()=>this._toggle()} |
| 106 | 107 | @keydown=${f=>this._onTriggerKeydown(f)} |
| 107 | 108 | > |
| @@ -108,9 +109,9 @@ | ||
| 108 | 109 | <span |
| 109 | 110 | class="os-select__value${l?"":" os-select__value--placeholder"}" |
| 110 | 111 | >${c}</span |
| 111 | 112 | > |
| 112 | - ${Ge("chevron-right",{size:16,rotate:90,className:"os-select__chevron"})} | |
| 113 | + ${Je("chevron-right",{size:16,rotate:90,className:"os-select__chevron"})} | |
| 113 | 114 | </button> |
| 114 | 115 | <div |
| 115 | 116 | class="os-select__popup" |
| 116 | 117 | id=${p} |
| @@ -118,21 +119,21 @@ | ||
| 118 | 119 | popover="auto" |
| 119 | 120 | aria-label=${a} |
| 120 | 121 | @toggle=${f=>this._onPopoverToggle(f)} |
| 121 | 122 | > |
| 122 | - ${r.map((f,_)=>m` | |
| 123 | + ${r.map((f,x)=>m` | |
| 123 | 124 | <div |
| 124 | 125 | class="os-select__option" |
| 125 | - id=${`${u}__opt-${_}`} | |
| 126 | + id=${`${d}__opt-${x}`} | |
| 126 | 127 | role="option" |
| 127 | 128 | data-value=${f.value} |
| 128 | 129 | aria-selected=${f.value===t?"true":"false"} |
| 129 | 130 | aria-disabled=${f.disabled?"true":"false"} |
| 130 | - ?data-active=${this._open&&_===this._activeIndex} | |
| 131 | + ?data-active=${this._open&&x===this._activeIndex} | |
| 131 | 132 | @click=${()=>this._onOptionClick(f)} |
| 132 | - @pointermove=${()=>this._setActive(_)} | |
| 133 | + @pointermove=${()=>this._setActive(x)} | |
| 133 | 134 | > |
| 134 | - ${Ge("check",{size:16,className:"os-select__check"})} | |
| 135 | + ${Je("check",{size:16,className:"os-select__check"})} | |
| 135 | 136 | <span class="os-select__option-label" |
| 136 | 137 | >${f.label}</span |
| 137 | 138 | > |
| 138 | 139 | </div> |
| @@ -137,42 +138,42 @@ | ||
| 137 | 138 | > |
| 138 | 139 | </div> |
| 139 | 140 | `)} |
| 140 | 141 | </div> |
| 141 | - `}_readOptions(){const e=[],t=this.querySelectorAll(":scope > os-option");for(const o of Array.from(t)){const i=o.getAttribute("value");i!==null&&e.push({value:i,label:(o.textContent||i).trim(),disabled:o.hasAttribute("disabled")})}return e}_popup(){return this.shadowRoot?.querySelector(".os-select__popup")??null}_trigger(){return this.shadowRoot?.querySelector(".os-select__trigger")??null}_toggle(){if(this._open){this._hide();return}performance.now()-this._dismissedAt<250||this._show()}_show(){const e=this._popup(),t=this._trigger();if(!e||!t||this._open)return;this._open=!0;const o=this._readOptions(),i=this.value,s=o.findIndex(r=>r.value===i&&!r.disabled);this._activeIndex=s>=0?s:o.findIndex(r=>!r.disabled);const a=t.getBoundingClientRect();e.style.minWidth=`${a.width}px`,typeof e.showPopover=="function"?(e.style.left=`${a.left}px`,e.style.top=`${a.bottom+4}px`,e.showPopover(),a.bottom+4+e.offsetHeight>window.innerHeight-8&&(e.style.top=`${Math.max(8,a.top-4-e.offsetHeight)}px`)):e.setAttribute("data-open",""),window.addEventListener("scroll",this._onWindowScroll,{capture:!0,passive:!0}),window.addEventListener("resize",this._onWindowResize),this.requestUpdate(),this._scrollActiveIntoView()}_hide(){if(!this._open)return;this._open=!1;const e=this._popup();if(e){if(typeof e.hidePopover=="function")try{e.hidePopover()}catch{}e.removeAttribute("data-open")}this._teardownDismiss(),this.requestUpdate()}_teardownDismiss(){window.removeEventListener("scroll",this._onWindowScroll,{capture:!0}),window.removeEventListener("resize",this._onWindowResize)}_onPopoverToggle(e){e.newState==="closed"&&this._open&&(this._dismissedAt=performance.now(),this._open=!1,this._teardownDismiss(),this.requestUpdate())}_onOptionClick(e){e.disabled||this._commit(e.value)}_commit(e){this._hide(),this.value=e,this.emit("os-pick",{value:e})}_setActive(e){if(e===this._activeIndex)return;const t=this._readOptions();!t[e]||t[e].disabled||(this._activeIndex=e,this.requestUpdate())}_moveActive(e){const t=this._readOptions();let o=this._activeIndex;for(let i=0;i<t.length&&(o=Math.min(Math.max(o+e,0),t.length-1),!(!t[o]?.disabled||o===0||o===t.length-1));i++);o!==this._activeIndex&&t[o]&&!t[o].disabled&&(this._activeIndex=o,this.requestUpdate(),this._scrollActiveIntoView())}_scrollActiveIntoView(){queueMicrotask(()=>{this.shadowRoot?.querySelector(".os-select__option[data-active]")?.scrollIntoView?.({block:"nearest"})})}_typeAhead(e){this._typedTimer&&clearTimeout(this._typedTimer),this._typed+=e.toLowerCase(),this._typedTimer=setTimeout(()=>{this._typed=""},500);const o=this._readOptions().findIndex(i=>!i.disabled&&i.label.toLowerCase().startsWith(this._typed));o>=0&&(this._activeIndex=o,this.requestUpdate(),this._scrollActiveIntoView())}_onTriggerKeydown(e){const t=this._readOptions();if(t.length!==0){if(!this._open){if(["ArrowDown","ArrowUp","Enter"," ","Home","End"].includes(e.key)){if(e.preventDefault(),this._show(),e.key==="Home"&&(this._activeIndex=t.findIndex(o=>!o.disabled)),e.key==="End"){for(let o=t.length-1;o>=0;o--)if(!t[o].disabled){this._activeIndex=o;break}}this.requestUpdate()}else e.key.length===1&&e.key.trim()!==""&&(this._show(),this._typeAhead(e.key));return}switch(e.key){case"ArrowDown":e.preventDefault(),this._moveActive(1);break;case"ArrowUp":e.preventDefault(),this._moveActive(-1);break;case"Home":e.preventDefault(),this._activeIndex=t.findIndex(o=>!o.disabled),this.requestUpdate(),this._scrollActiveIntoView();break;case"End":e.preventDefault();for(let o=t.length-1;o>=0;o--)if(!t[o].disabled){this._activeIndex=o,this.requestUpdate(),this._scrollActiveIntoView();break}break;case"Enter":case" ":{e.preventDefault();const o=t[this._activeIndex];o&&!o.disabled&&this._commit(o.value);break}case"Tab":{const o=t[this._activeIndex];o&&!o.disabled?this._commit(o.value):this._hide();break}case"Escape":e.preventDefault(),this._hide();break;default:e.key.length===1&&e.key.trim()!==""&&this._typeAhead(e.key)}}}};Z.props=["value","label","placeholder","disabled","name"],Z.styles=[lo],Z.help={title:"Select",summary:"Dropdown picker: a combobox trigger plus a custom top-layer listbox, so the popup wears the station instead of the operating system. Mirrors the <os-segmented> contract (set value, listen for os-pick).",status:"stable",props:[{name:"value",type:"string",description:"Currently selected option value."},{name:"label",type:"string",description:"Visible label rendered above the trigger and used as the accessible name."},{name:"placeholder",type:"string",description:"Trigger text shown when no value is set."},{name:"disabled",type:"boolean attribute",description:"Disables the trigger and dims the chrome."},{name:"plain",type:"boolean attribute",description:"Drops the field chrome and shrinks to the value, for a picker that is a list row’s trailing control rather than a field of its own. The container already draws the box; use with no `label`."},{name:"name",type:"string",description:"Accepted for compatibility. Shadow-DOM controls never participated in light-DOM form submission, so nothing is lost by the native select being gone; read `value` off the host instead."}],slots:[{name:"(default)",description:'<os-option value="…"> children.'}],events:[{name:"os-pick",description:"Fires when the user picks a new option.",detail:"{ value: string }"}],cssProps:[{name:"--os-ui-fg",description:"Label + value colour."},{name:"--os-ui-fg-muted",description:"Placeholder + chevron colour."},{name:"--os-ui-accent",description:"Active option row + selected check."}],example:m` | |
| 142 | + `}_readOptions(){const e=[],t=this.querySelectorAll(":scope > os-option");for(const o of Array.from(t)){const i=o.getAttribute("value");i!==null&&e.push({value:i,label:(o.textContent||i).trim(),disabled:o.hasAttribute("disabled")})}return e}_popup(){return this.shadowRoot?.querySelector(".os-select__popup")??null}_trigger(){return this.shadowRoot?.querySelector(".os-select__trigger")??null}_toggle(){if(this._open){this._hide();return}performance.now()-this._dismissedAt<250||this._show()}_show(){const e=this._popup(),t=this._trigger();if(!e||!t||this._open)return;this._open=!0;const o=this._readOptions(),i=this.value,s=o.findIndex(r=>r.value===i&&!r.disabled);this._activeIndex=s>=0?s:o.findIndex(r=>!r.disabled);const a=t.getBoundingClientRect();e.style.minWidth=`${a.width}px`,typeof e.showPopover=="function"?(e.style.left=`${a.left}px`,e.style.top=`${a.bottom+4}px`,e.showPopover(),a.bottom+4+e.offsetHeight>window.innerHeight-8&&(e.style.top=`${Math.max(8,a.top-4-e.offsetHeight)}px`)):e.setAttribute("data-open",""),window.addEventListener("scroll",this._onWindowScroll,{capture:!0,passive:!0}),window.addEventListener("resize",this._onWindowResize),this.requestUpdate(),this._scrollActiveIntoView()}_hide(){if(!this._open)return;this._open=!1;const e=this._popup();if(e){if(typeof e.hidePopover=="function")try{e.hidePopover()}catch{}e.removeAttribute("data-open")}this._teardownDismiss(),this.requestUpdate()}_teardownDismiss(){window.removeEventListener("scroll",this._onWindowScroll,{capture:!0}),window.removeEventListener("resize",this._onWindowResize)}_onPopoverToggle(e){e.newState==="closed"&&this._open&&(this._dismissedAt=performance.now(),this._open=!1,this._teardownDismiss(),this.requestUpdate())}_onOptionClick(e){e.disabled||this._commit(e.value)}_commit(e){this._hide(),this.value=e,this.emit("os-pick",{value:e})}_setActive(e){if(e===this._activeIndex)return;const t=this._readOptions();!t[e]||t[e].disabled||(this._activeIndex=e,this.requestUpdate())}_moveActive(e){const t=this._readOptions();let o=this._activeIndex;for(let i=0;i<t.length&&(o=Math.min(Math.max(o+e,0),t.length-1),!(!t[o]?.disabled||o===0||o===t.length-1));i++);o!==this._activeIndex&&t[o]&&!t[o].disabled&&(this._activeIndex=o,this.requestUpdate(),this._scrollActiveIntoView())}_scrollActiveIntoView(){queueMicrotask(()=>{this.shadowRoot?.querySelector(".os-select__option[data-active]")?.scrollIntoView?.({block:"nearest"})})}_typeAhead(e){this._typedTimer&&clearTimeout(this._typedTimer),this._typed+=e.toLowerCase(),this._typedTimer=setTimeout(()=>{this._typed=""},500);const o=this._readOptions().findIndex(i=>!i.disabled&&i.label.toLowerCase().startsWith(this._typed));o>=0&&(this._activeIndex=o,this.requestUpdate(),this._scrollActiveIntoView())}_onTriggerKeydown(e){const t=this._readOptions();if(t.length!==0){if(!this._open){if(["ArrowDown","ArrowUp","Enter"," ","Home","End"].includes(e.key)){if(e.preventDefault(),this._show(),e.key==="Home"&&(this._activeIndex=t.findIndex(o=>!o.disabled)),e.key==="End"){for(let o=t.length-1;o>=0;o--)if(!t[o].disabled){this._activeIndex=o;break}}this.requestUpdate()}else e.key.length===1&&e.key.trim()!==""&&(this._show(),this._typeAhead(e.key));return}switch(e.key){case"ArrowDown":e.preventDefault(),this._moveActive(1);break;case"ArrowUp":e.preventDefault(),this._moveActive(-1);break;case"Home":e.preventDefault(),this._activeIndex=t.findIndex(o=>!o.disabled),this.requestUpdate(),this._scrollActiveIntoView();break;case"End":e.preventDefault();for(let o=t.length-1;o>=0;o--)if(!t[o].disabled){this._activeIndex=o,this.requestUpdate(),this._scrollActiveIntoView();break}break;case"Enter":case" ":{e.preventDefault();const o=t[this._activeIndex];o&&!o.disabled&&this._commit(o.value);break}case"Tab":{const o=t[this._activeIndex];o&&!o.disabled?this._commit(o.value):this._hide();break}case"Escape":e.preventDefault(),this._hide();break;default:e.key.length===1&&e.key.trim()!==""&&this._typeAhead(e.key)}}}};Z.props=["value","label","placeholder","disabled","name"],Z.styles=[bo],Z.help={title:"Select",summary:"Dropdown picker: a combobox trigger plus a custom top-layer listbox, so the popup wears the station instead of the operating system. Mirrors the <os-segmented> contract (set value, listen for os-pick).",status:"stable",props:[{name:"value",type:"string",description:"Currently selected option value."},{name:"label",type:"string",description:"Visible label rendered above the trigger and used as the accessible name."},{name:"placeholder",type:"string",description:"Trigger text shown when no value is set."},{name:"disabled",type:"boolean attribute",description:"Disables the trigger and dims the chrome."},{name:"plain",type:"boolean attribute",description:"Drops the field chrome and shrinks to the value, for a picker that is a list row’s trailing control rather than a field of its own. The container already draws the box; use with no `label`."},{name:"name",type:"string",description:"Accepted for compatibility. Shadow-DOM controls never participated in light-DOM form submission, so nothing is lost by the native select being gone; read `value` off the host instead."}],slots:[{name:"(default)",description:'<os-option value="…"> children.'}],events:[{name:"os-pick",description:"Fires when the user picks a new option.",detail:"{ value: string }"}],cssProps:[{name:"--os-ui-fg",description:"Label + value colour."},{name:"--os-ui-fg-muted",description:"Placeholder + chevron colour."},{name:"--os-ui-accent",description:"Active option row + selected check."}],example:m` | |
| 142 | 143 | <os-select value="eur" label="Currency"> |
| 143 | 144 | <os-option value="eur">Euro</os-option> |
| 144 | 145 | <os-option value="usd">US Dollar</os-option> |
| 145 | 146 | <os-option value="jpy">Japanese Yen</os-option> |
| 146 | 147 | </os-select> |
| 147 | - `};let xe=Z;I("os-select",xe);const uo=w` ${H} ${fe}:host{--_field-size:var( --os-ui-field-font-size,13px );--_field-radius:var( --os-ui-field-radius,6px );display:flex;flex-direction:column;gap:4px;font-size:var( --_field-size );color:var( --os-ui-fg,#1d2327 );min-width:0}:host( [ hidden ] ){display:none}.os-text-field__label{font-size:12px;color:var( --os-ui-fg-muted,#646970 )}.os-text-field__row{position:relative;display:flex;align-items:center;width:100%}input{appearance:none;-webkit-appearance:none;display:block;width:100%;min-width:0;box-sizing:border-box;padding:7px 10px;background:var( --os-window-bg,#fff );border:1px solid var( --os-ui-border,#dcdcde );border-radius:var( --_field-radius );font:inherit;font-size:var( --_field-size );color:var( --os-ui-fg,#1d2327 )}.os-text-field__suffix{position:absolute;inset-inline-end:10px;top:50%;transform:translateY( -50% );pointer-events:none;font-size:12px;color:var( --os-ui-fg-muted,#646970 )}.os-text-field__row--has-reveal input{padding-inline-end:36px}.os-text-field__row--has-clear input{padding-inline-end:36px}.os-text-field__row--has-reveal.os-text-field__row--has-clear input{padding-inline-end:68px}.os-text-field__clear{position:absolute;inset-inline-end:0;top:0;bottom:0;width:34px;display:flex;align-items:center;justify-content:center;padding:0;border:none;background:transparent;color:var( --os-ui-fg-muted,#646970 );cursor:pointer;border-radius:0 6px 6px 0}.os-text-field__row--has-reveal .os-text-field__clear{inset-inline-end:34px;border-radius:0}.os-text-field__clear:hover{color:var( --os-ui-accent,#2271b1 )}.os-text-field__clear:focus-visible{outline:none;color:var( --os-ui-accent,#2271b1 );box-shadow:inset 0 0 0 2px var( --os-ui-accent,#2271b1 )}.os-text-field__clear:disabled{opacity:0.45;cursor:default}.os-text-field__reveal{position:absolute;inset-inline-end:0;top:0;bottom:0;width:34px;display:flex;align-items:center;justify-content:center;padding:0;border:none;background:transparent;color:var( --os-ui-fg-muted,#646970 );cursor:pointer;border-radius:0 6px 6px 0;transition:color 0.12s ease}.os-text-field__reveal:hover{color:var( --os-ui-accent,#2271b1 )}.os-text-field__reveal:focus-visible{outline:none;color:var( --os-ui-accent,#2271b1 );box-shadow:inset 0 0 0 2px var( --os-ui-accent,#2271b1 );border-radius:0 6px 6px 0}.os-text-field__reveal:disabled{opacity:0.45;cursor:not-allowed}.os-text-field__input--masked{-webkit-text-security:disc;text-security:disc}@supports not ( ( -webkit-text-security:disc ) or ( text-security:disc ) ){.os-text-field__input--masked{font-family:text-security-disc,"password",monospace;letter-spacing:0.2em}}input:disabled{opacity:0.55;cursor:not-allowed;background:var( --os-ui-hover,rgba( 0,0,0,0.03 ) )}input[ aria-invalid='true' ],input[ aria-invalid='true' ]:hover:not(:disabled ){border-color:var( --os-ui-danger,#d63638 )}input[ aria-invalid='true' ]:focus,input[ aria-invalid='true' ]:focus-visible{border-color:var( --os-ui-danger,#d63638 );box-shadow:0 0 0 1px var( --os-ui-danger,#d63638 ),0 0 0 4px rgba( 214,54,56,0.18 )}input[ type='number' ]::-webkit-inner-spin-button,input[ type='number' ]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[ type='number' ]{-moz-appearance:textfield}`,X=class X extends z{constructor(){super(...arguments),this._revealed=!1}connectedCallback(){super.connectedCallback(),le(this)}render(){const e=this.label||"",t=this.value??"",o=this.placeholder||"",i=this.disabled!==null,s=this.readonly!==null,a=this.autocomplete,r=this.type||"text",l=r==="password";let c=a||"off";l&&(!a||c==="off")&&(c="new-password");const u=this.maxlength,p=this.minlength,h=this.pattern||"",g=this.name||"",f=this.suffix||"",_=this.invalid!==null,v=this.reveal!==null,y=this.clearable!==null,k=r==="password",A=k&&!(v&&this._revealed);let L;k||v&&this._revealed?L="text":L=r;const j=["os-text-field__row",v?"os-text-field__row--has-reveal":"",y?"os-text-field__row--has-clear":""].filter(Boolean).join(" "),Ce=A?"os-text-field__input os-text-field__input--masked":"os-text-field__input",C=`${this.id||"os-unnamed"}__input`;return m` | |
| 148 | + `};let _e=Z;I("os-select",_e);const vo=w` ${D} ${me}:host{--_field-size:var( --os-ui-field-font-size,13px );--_field-radius:var( --os-ui-field-radius,6px );display:flex;flex-direction:column;gap:4px;font-size:var( --_field-size );color:var( --os-ui-fg,#1d2327 );min-width:0}:host( [ hidden ] ){display:none}.os-text-field__label{font-size:12px;color:var( --os-ui-fg-muted,#646970 )}.os-text-field__label--hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;white-space:nowrap;clip-path:inset( 50% )}.os-text-field__row{position:relative;display:flex;align-items:center;width:100%}input{appearance:none;-webkit-appearance:none;display:block;width:100%;min-width:0;box-sizing:border-box;padding:7px 10px;background:var( --os-window-bg,#fff );border:1px solid var( --os-ui-border,#dcdcde );border-radius:var( --_field-radius );font:inherit;font-size:var( --_field-size );color:var( --os-ui-fg,#1d2327 )}input:is( [ type='date' ],[ type='datetime-local' ],[ type='month' ],[ type='week' ] )::-webkit-calendar-picker-indicator{--_calendar-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='1.5'%3E%3Cpath d='M4.75 7.25L4.75 18C4.75 18.6904 5.30964 19.25 6 19.25H18C18.6904 19.25 19.25 18.6904 19.25 18V7.25V6C19.25 5.30964 18.6904 4.75 18 4.75H6C5.30964 4.75 4.75 5.30964 4.75 6V7.25ZM19.25 7.25H4.75M7.25 10.75H9.25M11 10.75H13M14.75 10.75H16.75M7.25 14.5H9.25M11 14.5H13M14.75 14.5H16.75' vector-effect='non-scaling-stroke'/%3E%3Cpath d='M18 4.75H6C5.30964 4.75 4.75 5.30964 4.75 6V7.25H19.25V6C19.25 5.30964 18.6904 4.75 18 4.75Z' fill='currentColor' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");background:var( --os-ui-fg-muted,#646970 );-webkit-mask:var( --_calendar-icon ) center / contain no-repeat;mask:var( --_calendar-icon ) center / contain no-repeat;width:16px;height:16px;cursor:pointer}@media ( forced-colors:active ){input:is( [ type='date' ],[ type='datetime-local' ],[ type='month' ],[ type='week' ] )::-webkit-calendar-picker-indicator{background:ButtonText;forced-color-adjust:none}}.os-text-field__suffix{position:absolute;inset-inline-end:10px;top:50%;transform:translateY( -50% );pointer-events:none;font-size:12px;color:var( --os-ui-fg-muted,#646970 )}.os-text-field__row--has-reveal input{padding-inline-end:36px}:host( [ clearable ] ) input::-webkit-search-cancel-button{-webkit-appearance:none;display:none}.os-text-field__row--has-clear input{padding-inline-end:36px}.os-text-field__row--has-reveal.os-text-field__row--has-clear input{padding-inline-end:68px}.os-text-field__clear{position:absolute;inset-inline-end:0;top:0;bottom:0;width:34px;display:flex;align-items:center;justify-content:center;padding:0;border:none;background:transparent;color:var( --os-ui-fg-muted,#646970 );cursor:pointer;border-radius:0 6px 6px 0}.os-text-field__row--has-reveal .os-text-field__clear{inset-inline-end:34px;border-radius:0}.os-text-field__clear:hover{color:var( --os-ui-accent,#2271b1 )}.os-text-field__clear:focus-visible{outline:none;color:var( --os-ui-accent,#2271b1 );box-shadow:inset 0 0 0 2px var( --os-ui-accent,#2271b1 )}.os-text-field__clear:disabled{opacity:0.45;cursor:default}.os-text-field__reveal{position:absolute;inset-inline-end:0;top:0;bottom:0;width:34px;display:flex;align-items:center;justify-content:center;padding:0;border:none;background:transparent;color:var( --os-ui-fg-muted,#646970 );cursor:pointer;border-radius:0 6px 6px 0;transition:color 0.12s ease}.os-text-field__reveal:hover{color:var( --os-ui-accent,#2271b1 )}.os-text-field__reveal:focus-visible{outline:none;color:var( --os-ui-accent,#2271b1 );box-shadow:inset 0 0 0 2px var( --os-ui-accent,#2271b1 );border-radius:0 6px 6px 0}.os-text-field__reveal:disabled{opacity:0.45;cursor:not-allowed}.os-text-field__input--masked{-webkit-text-security:disc;text-security:disc}@supports not ( ( -webkit-text-security:disc ) or ( text-security:disc ) ){.os-text-field__input--masked{font-family:text-security-disc,"password",monospace;letter-spacing:0.2em}}input:disabled{opacity:0.55;cursor:not-allowed;background:var( --os-ui-hover,rgba( 0,0,0,0.03 ) )}input[ aria-invalid='true' ],input[ aria-invalid='true' ]:hover:not(:disabled ){border-color:var( --os-ui-danger,#d63638 )}input[ aria-invalid='true' ]:focus,input[ aria-invalid='true' ]:focus-visible{border-color:var( --os-ui-danger,#d63638 );box-shadow:0 0 0 1px var( --os-ui-danger,#d63638 ),0 0 0 4px rgba( 214,54,56,0.18 )}input[ type='number' ]::-webkit-inner-spin-button,input[ type='number' ]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[ type='number' ]{-moz-appearance:textfield}`,X=class X extends z{constructor(){super(...arguments),this._revealed=!1}connectedCallback(){super.connectedCallback(),ce(this)}render(){const e=this.label||"",t=this.hideLabel!==null,o=this.value??"",i=this.placeholder||"",s=this.disabled!==null,a=this.readonly!==null,r=this.autocomplete,l=this.type||"text",c=l==="password";let d=r||"off";c&&(!r||d==="off")&&(d="new-password");const p=this.maxlength,h=this.minlength,b=this.pattern||"",f=this.name||"",x=this.suffix||"",_=this.invalid!==null,y=this.reveal!==null,k=this.clearable!==null,C=l==="password",N=C&&!(y&&this._revealed);let M;C||y&&this._revealed?M="text":M=l;const Ae=["os-text-field__row",y?"os-text-field__row--has-reveal":"",k?"os-text-field__row--has-clear":""].filter(Boolean).join(" "),v=N?"os-text-field__input os-text-field__input--masked":"os-text-field__input",L=`${this.id||"os-unnamed"}__input`;return m` | |
| 148 | 149 | ${e?m`<label |
| 149 | - class="os-text-field__label" | |
| 150 | - for=${C} | |
| 150 | + class=${t?"os-text-field__label os-text-field__label--hidden":"os-text-field__label"} | |
| 151 | + for=${L} | |
| 151 | 152 | >${e}</label>`:m``} |
| 152 | - <span class=${j}> | |
| 153 | + <span class=${Ae}> | |
| 153 | 154 | <input |
| 154 | - id=${C} | |
| 155 | - class=${Ce} | |
| 156 | - type=${L} | |
| 157 | - .value=${t} | |
| 158 | - placeholder=${o} | |
| 159 | - ?disabled=${i} | |
| 160 | - ?readonly=${s} | |
| 161 | - autocomplete=${c} | |
| 162 | - maxlength=${u??""} | |
| 163 | - minlength=${p??""} | |
| 164 | - pattern=${h} | |
| 165 | - name=${g} | |
| 155 | + id=${L} | |
| 156 | + class=${v} | |
| 157 | + type=${M} | |
| 158 | + .value=${o} | |
| 159 | + placeholder=${i} | |
| 160 | + ?disabled=${s} | |
| 161 | + ?readonly=${a} | |
| 162 | + autocomplete=${d} | |
| 163 | + maxlength=${p??""} | |
| 164 | + minlength=${h??""} | |
| 165 | + pattern=${b} | |
| 166 | + name=${f} | |
| 166 | 167 | aria-invalid=${_?"true":"false"} |
| 167 | 168 | aria-label=${e||""} |
| 168 | - @input=${$=>this._onInput($)} | |
| 169 | - @change=${$=>this._onChange($)} | |
| 170 | - @keydown=${$=>this._onKeyDown($)} | |
| 169 | + @input=${A=>this._onInput(A)} | |
| 170 | + @change=${A=>this._onChange(A)} | |
| 171 | + @keydown=${A=>this._onKeyDown(A)} | |
| 171 | 172 | /> |
| 172 | - ${f?m`<span class="os-text-field__suffix">${f}</span>`:m``} | |
| 173 | - ${y&&t!==""?this._renderClearButton(i):m``} | |
| 174 | - ${v?this._renderRevealButton(i):m``} | |
| 173 | + ${x?m`<span class="os-text-field__suffix">${x}</span>`:m``} | |
| 174 | + ${k&&o!==""?this._renderClearButton(s):m``} | |
| 175 | + ${y?this._renderRevealButton(s):m``} | |
| 175 | 176 | </span> |
| 176 | 177 | `}_renderClearButton(e){return m` |
| 177 | 178 | <button |
| 178 | 179 | type="button" |
| @@ -181,9 +182,9 @@ | ||
| 181 | 182 | ?disabled=${e} |
| 182 | 183 | tabindex="0" |
| 183 | 184 | @click=${()=>this._onClear()} |
| 184 | 185 | > |
| 185 | - ${ho()} | |
| 186 | + ${xo()} | |
| 186 | 187 | </button> |
| 187 | 188 | `}_onClear(){this.value="",this.emit("os-input-change",{value:""}),this.emit("os-input-commit",{value:""}),this.shadowRoot?.querySelector("input")?.focus()}_renderRevealButton(e){const t=this._revealed?"Hide":"Show";return m` |
| 188 | 189 | <button |
| 189 | 190 | type="button" |
| @@ -193,11 +194,11 @@ | ||
| 193 | 194 | ?disabled=${e} |
| 194 | 195 | tabindex="0" |
| 195 | 196 | @click=${()=>this._onToggleReveal()} |
| 196 | 197 | > |
| 197 | - ${this._revealed?fo():po()} | |
| 198 | + ${this._revealed?yo():_o()} | |
| 198 | 199 | </button> |
| 199 | - `}_onToggleReveal(){this._revealed=!this._revealed,this.requestUpdate()}_onInput(e){const t=e.target;this.value=t.value,this.emit("os-input-change",{value:t.value})}_onChange(e){const t=e.target;this.emit("os-input-commit",{value:t.value})}_onKeyDown(e){if(e.key==="Enter"&&!e.shiftKey&&!e.altKey&&!e.metaKey){const t=e.target;this.emit("os-submit",{value:t.value})}}};X.props=["label","value","placeholder","disabled","readonly","autocomplete","type","maxlength","minlength","pattern","name","suffix","invalid","reveal","clearable"],X.styles=[uo],X.help=void 0;let _e=X;I("os-text-field",_e);function ho(){return m` | |
| 200 | + `}_onToggleReveal(){this._revealed=!this._revealed,this.requestUpdate()}_onInput(e){const t=e.target;this.value=t.value,this.emit("os-input-change",{value:t.value})}_onChange(e){const t=e.target;this.emit("os-input-commit",{value:t.value})}_onKeyDown(e){if(e.key==="Enter"&&!e.shiftKey&&!e.altKey&&!e.metaKey){const t=e.target;this.emit("os-submit",{value:t.value})}}};X.props=["label","hideLabel","value","placeholder","disabled","readonly","autocomplete","type","maxlength","minlength","pattern","name","suffix","invalid","reveal","clearable"],X.styles=[vo],X.help=void 0;let ye=X;I("os-text-field",ye);function xo(){return m` | |
| 200 | 201 | <svg |
| 201 | 202 | viewBox="0 0 16 16" |
| 202 | 203 | width="14" |
| 203 | 204 | height="14" |
| @@ -209,9 +210,9 @@ | ||
| 209 | 210 | focusable="false" |
| 210 | 211 | > |
| 211 | 212 | <path d="M4 4l8 8M12 4l-8 8" /> |
| 212 | 213 | </svg> |
| 213 | - `}function po(){return m` | |
| 214 | + `}function _o(){return m` | |
| 214 | 215 | <svg |
| 215 | 216 | viewBox="0 0 16 16" |
| 216 | 217 | width="14" |
| 217 | 218 | height="14" |
| @@ -225,9 +226,9 @@ | ||
| 225 | 226 | > |
| 226 | 227 | <path d="M1 8C1 8 3.5 3 8 3s7 5 7 5-2.5 5-7 5S1 8 1 8z" /> |
| 227 | 228 | <circle cx="8" cy="8" r="2" /> |
| 228 | 229 | </svg> |
| 229 | - `}function fo(){return m` | |
| 230 | + `}function yo(){return m` | |
| 230 | 231 | <svg |
| 231 | 232 | viewBox="0 0 16 16" |
| 232 | 233 | width="14" |
| 233 | 234 | height="14" |
| @@ -242,12 +243,12 @@ | ||
| 242 | 243 | <path d="M1 8C1 8 3.5 3 8 3s7 5 7 5-2.5 5-7 5S1 8 1 8z" /> |
| 243 | 244 | <circle cx="8" cy="8" r="2" /> |
| 244 | 245 | <line x1="2" y1="2" x2="14" y2="14" /> |
| 245 | 246 | </svg> |
| 246 | - `}const mo=w` ${H} ${fe}:host{--_field-size:var( --os-ui-field-font-size,13px );--_field-radius:var( --os-ui-field-radius,6px );display:flex;flex-direction:column;gap:4px;font-size:var( --_field-size );color:var( --os-ui-fg,#1d2327 );min-width:0}:host( [ hidden ] ){display:none}.os-textarea__label{font-size:12px;color:var( --os-ui-fg-muted,#646970 )}textarea{appearance:none;-webkit-appearance:none;display:block;width:100%;min-width:0;box-sizing:border-box;padding:8px 10px;background:var( --os-window-bg,#fff );border:1px solid var( --os-ui-border,#dcdcde );border-radius:var( --_field-radius );font:inherit;font-size:var( --_field-size );line-height:1.45;color:var( --os-ui-fg,#1d2327 );resize:vertical}textarea:disabled{opacity:0.55;cursor:not-allowed;background:var( --os-ui-hover,rgba( 0,0,0,0.03 ) )}textarea[ aria-invalid='true' ],textarea[ aria-invalid='true' ]:hover:not(:disabled ){border-color:var( --os-ui-danger,#d63638 )}textarea[ aria-invalid='true' ]:focus,textarea[ aria-invalid='true' ]:focus-visible{border-color:var( --os-ui-danger,#d63638 );box-shadow:0 0 0 1px var( --os-ui-danger,#d63638 ),0 0 0 4px rgba( 214,54,56,0.18 )}:host( [ auto-grow ] ) textarea{resize:none;overflow:hidden}`,K=class K extends z{constructor(){super(...arguments),this._textareaEl=null}connectedCallback(){super.connectedCallback(),le(this)}render(){const e=this._attr("label")||"",t=this._attr("value")??"",o=this._attr("placeholder")||"",i=this._boolAttr("disabled"),s=this._boolAttr("readonly"),a=this._attr("aria-label")||e,r=this._attr("name")||"",l=Number(this._attr("rows"))||3,c=this._attr("maxlength"),u=this._attr("minlength"),p=this._boolAttr("invalid"),g=`${this.id||"os-unnamed"}__field`;return m` | |
| 247 | - ${e?m`<label class="os-textarea__label" for=${g}>${e}</label>`:m``} | |
| 247 | + `}const wo=w` ${D} ${me}:host{--_field-size:var( --os-ui-field-font-size,13px );--_field-radius:var( --os-ui-field-radius,6px );display:flex;flex-direction:column;gap:4px;font-size:var( --_field-size );color:var( --os-ui-fg,#1d2327 );min-width:0}:host( [ hidden ] ){display:none}.os-textarea__label{font-size:12px;color:var( --os-ui-fg-muted,#646970 )}textarea{appearance:none;-webkit-appearance:none;display:block;width:100%;min-width:0;box-sizing:border-box;padding:8px 10px;background:var( --os-window-bg,#fff );border:1px solid var( --os-ui-border,#dcdcde );border-radius:var( --_field-radius );font:inherit;font-size:var( --_field-size );line-height:1.45;color:var( --os-ui-fg,#1d2327 );resize:vertical}textarea:disabled{opacity:0.55;cursor:not-allowed;background:var( --os-ui-hover,rgba( 0,0,0,0.03 ) )}textarea[ aria-invalid='true' ],textarea[ aria-invalid='true' ]:hover:not(:disabled ){border-color:var( --os-ui-danger,#d63638 )}textarea[ aria-invalid='true' ]:focus,textarea[ aria-invalid='true' ]:focus-visible{border-color:var( --os-ui-danger,#d63638 );box-shadow:0 0 0 1px var( --os-ui-danger,#d63638 ),0 0 0 4px rgba( 214,54,56,0.18 )}:host( [ auto-grow ] ) textarea{resize:none;overflow:hidden}`,K=class K extends z{constructor(){super(...arguments),this._textareaEl=null}connectedCallback(){super.connectedCallback(),ce(this)}render(){const e=this._attr("label")||"",t=this._attr("value")??"",o=this._attr("placeholder")||"",i=this._boolAttr("disabled"),s=this._boolAttr("readonly"),a=this._attr("aria-label")||e,r=this._attr("name")||"",l=Number(this._attr("rows"))||3,c=this._attr("maxlength"),d=this._attr("minlength"),p=this._boolAttr("invalid"),b=`${this.id||"os-unnamed"}__field`;return m` | |
| 248 | + ${e?m`<label class="os-textarea__label" for=${b}>${e}</label>`:m``} | |
| 248 | 249 | <textarea |
| 249 | - id=${g} | |
| 250 | + id=${b} | |
| 250 | 251 | part="textarea" |
| 251 | 252 | .value=${t} |
| 252 | 253 | placeholder=${o} |
| 253 | 254 | ?disabled=${i} |
| @@ -253,9 +254,9 @@ | ||
| 253 | 254 | ?disabled=${i} |
| 254 | 255 | ?readonly=${s} |
| 255 | 256 | rows=${l} |
| 256 | 257 | maxlength=${c??""} |
| 257 | - minlength=${u??""} | |
| 258 | + minlength=${d??""} | |
| 258 | 259 | name=${r} |
| 259 | 260 | aria-invalid=${p?"true":"false"} |
| 260 | 261 | aria-label=${a||""} |
| 261 | 262 | @input=${f=>this._onInput(f)} |
| @@ -261,9 +262,9 @@ | ||
| 261 | 262 | @input=${f=>this._onInput(f)} |
| 262 | 263 | @change=${f=>this._onChange(f)} |
| 263 | 264 | @keydown=${f=>this._onKeyDown(f)} |
| 264 | 265 | ></textarea> |
| 265 | - `}_attr(e){return this.getAttribute(e)}_boolAttr(e){return this.getAttribute(e)!==null}_onInput(e){const t=e.target;this._textareaEl=t,this.setAttribute("value",t.value),this.emit("os-input-change",{value:t.value}),this._boolAttr("auto-grow")&&this._autosize(t)}_onChange(e){const t=e.target;this.emit("os-input-commit",{value:t.value})}_onKeyDown(e){if(this._boolAttr("submit-on-enter")&&e.key==="Enter"&&!e.shiftKey&&!e.altKey&&!e.metaKey&&!e.ctrlKey){e.preventDefault();const t=e.target;this.emit("os-submit",{value:t.value})}}_autosize(e){const t=Number(this._attr("max-rows"))||8,o=window.getComputedStyle(e),i=parseFloat(o.fontSize)||13,s=o.lineHeight,a=s==="normal"?i*1.45:parseFloat(s)||i*1.45,r=parseFloat(o.paddingTop)||0,l=parseFloat(o.paddingBottom)||0,c=a*t+r+l;e.style.height="auto";const u=Math.min(e.scrollHeight,c);e.style.height=`${u}px`}refreshAutosize(){this._textareaEl&&this._boolAttr("auto-grow")&&this._autosize(this._textareaEl)}focusInput(){(this.shadowRoot??this).querySelector("textarea")?.focus()}clear(){this.setAttribute("value","");const t=(this.shadowRoot??this).querySelector("textarea");t&&(t.value="",this._boolAttr("auto-grow")&&this._autosize(t))}};K.props=["label","value","placeholder","disabled","readonly","ariaLabel","name","rows","maxlength","minlength","invalid","autoGrow","maxRows","submitOnEnter"],K.styles=[mo],K.help=void 0;let ye=K;I("os-textarea",ye);function go(n){const e="ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz23456789!@#$%^&*-_=+",t=new Uint32Array(n);crypto.getRandomValues(t);let o="";for(let i=0;i<n;i+=1)o+=e[t[i]%e.length];return o}const we="border:1px solid var(--os-ui-border, #dcdcde);border-radius:10px;padding:14px 16px;",bo="color:var(--os-ui-fg-muted, #50575e);font-size:11px;text-transform:uppercase;letter-spacing:0.04em;font-weight:600;",vo="display:inline-flex;padding:2px 8px;border-radius:10px;background:var(--os-ui-badge-info-bg, rgba(34,113,177,0.10));color:var(--os-ui-info-fg, #0a4b78);font-size:11px;font-weight:600;";function b(n,e){const t=document.createElement("div");return t.style.cssText=n,typeof e=="string"?t.textContent=e:e&&t.appendChild(e),t}function Ye(n){n.replaceChildren(b("display:flex;align-items:center;justify-content:center;padding:32px;color:var(--os-ui-fg-muted, #50575e);font-size:13px;",d("Loading insights…")))}function Qe(n,e){const t=document.createElement("p");t.style.cssText="padding:24px;color:var(--os-ui-danger, #b32d2e);font-size:13px;text-align:center;",t.textContent=S(d("Could not load insights (%s)."),String(e?.message??e)),n.replaceChildren(t)}function xo(n,e,t){n.replaceChildren(yo(e,t),wo(e),ko(e))}function _o(n,e){const t=document.createElement("div");t.className="os-user-edit__activity";const o=document.createElement("h3");o.textContent=d("Recent activity"),o.style.cssText="margin:24px 0 12px;font-size:13px;font-weight:600;text-transform:uppercase;letter-spacing:0.04em;color:var(--os-ui-fg-muted, #50575e);",t.append(o,Co(e),Ao(e)),n.replaceChildren(t)}function Je(n,e){const t=b("display:flex;flex-wrap:wrap;gap:4px;justify-content:center;"),o=e.allRoles??{};for(const i of n){const s=document.createElement("span");s.textContent=o[i]??i,s.style.cssText=vo,t.appendChild(s)}if(n.length===0){const i=document.createElement("span");i.textContent=d("No role"),i.style.cssText="font-size:11px;color:var(--os-ui-fg-muted, #8c8f94);",t.appendChild(i)}return t}function yo(n,e){const t=b(["display:flex","flex-direction:column","align-items:center","text-align:center","gap:6px","padding:16px","border:1px solid var(--os-ui-border, #dcdcde)","border-radius:12px","background:var(--os-ui-card-bg, var(--os-ui-surface, #f6f7f7))"].join(";")),o=document.createElement("img");o.src=n.avatarUrl,o.alt="",o.style.cssText="width:72px;height:72px;border-radius:50%;flex-shrink:0;",t.appendChild(o),t.appendChild(b("font-size:15px;font-weight:600;letter-spacing:-0.01em;",n.displayName||`#${n.userId}`)),t.appendChild(Je(n.roles,e));const i=n.profileCompleteness;if(i&&i.total>0){const s=b("display:flex;flex-direction:column;gap:4px;width:100%;margin-top:6px;"),a=b("display:flex;justify-content:space-between;align-items:baseline;font-size:11px;color:var(--os-ui-fg-muted, #50575e);"),r=document.createElement("span");r.textContent=d("Profile completeness");const l=document.createElement("span");l.style.cssText="font-variant-numeric:tabular-nums;font-weight:600;",l.textContent=`${i.percent}%`,a.append(r,l),s.appendChild(a);const c=b("height:4px;border-radius:999px;background:var(--os-ui-holo-track, rgba(0,0,0,0.06));position:relative;overflow:hidden;");c.appendChild(b(`position:absolute;inset:0;width:${i.percent}%;background:var(--wp-admin-theme-color, #2271b1);transition:width 360ms ease;`)),s.appendChild(c),t.appendChild(s)}return t}function wo(n){const e=b("display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:12px;"),t=(s,a,r)=>{const l=b("border:1px solid var(--os-ui-border, #dcdcde);border-radius:8px;padding:8px 10px;display:flex;flex-direction:column;gap:1px;min-width:0;");if(l.appendChild(b("font-size:10px;text-transform:uppercase;letter-spacing:0.04em;color:var(--os-ui-fg-muted, #50575e);font-weight:600;",s)),l.appendChild(b("font-size:18px;font-weight:600;font-variant-numeric:tabular-nums;",a)),r){const c=b("font-size:10px;color:var(--os-ui-fg-muted, #8c8f94);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;",r);c.title=r,l.appendChild(c)}return l},o=n.stats;e.appendChild(t(d("Posts"),String(o.posts),o.pages>0?S(Ee("+ %d page","+ %d pages",o.pages),o.pages):void 0)),e.appendChild(t(d("Comments"),String(o.commentsAuthored),o.commentsReceived>0?S(d("%d received"),o.commentsReceived):void 0)),e.appendChild(t(d("Last login"),o.lastLoginAt?te(o.lastLoginAt):d("Never"),o.lastLoginAt?re(o.lastLoginAt*1e3,"long"):void 0));let i="—";return o.daysSinceRegistration!==null&&(i=S(Ee("%d day","%d days",o.daysSinceRegistration),o.daysSinceRegistration)),e.appendChild(t(d("Member"),i,o.registeredAt?re(o.registeredAt*1e3,"long"):void 0)),e}function ko(n){const e=b(`${we}margin:0 0 22px;`),t=b("display:flex;justify-content:space-between;align-items:baseline;margin:0 0 8px;");t.appendChild(b("font-size:13px;font-weight:600;",d("Posts published — last 12 months")));const o=n.contentByMonth.reduce((l,c)=>l+c.count,0);if(t.appendChild(b("font-size:11px;color:var(--os-ui-fg-muted, #50575e);",S(d("%d total"),o))),e.appendChild(t),n.contentByMonth.length===0){const l=document.createElement("p");return l.style.cssText="margin:0;color:var(--os-ui-fg-muted, #50575e);font-size:12px;",l.textContent=d("No activity in the last 12 months."),e.appendChild(l),e}const i=Math.max(1,...n.contentByMonth.map(l=>l.count)),s=`grid-template-columns:repeat(${n.contentByMonth.length}, 1fr);`,a=b(`display:grid;${s}gap:4px;align-items:end;height:60px;`);for(const l of n.contentByMonth){const c=b("display:flex;flex-direction:column;align-items:center;height:100%;justify-content:flex-end;"),u=b(["width:100%",`height:${Math.max(3,Math.round(l.count/i*100))}%`,"background:var(--wp-admin-theme-color, #2271b1)",l.count===0?"opacity:0.18":"opacity:1","border-radius:3px 3px 0 0","transition:height 360ms ease"].join(";"));u.title=S(d("%1$s — %2$d posts"),l.month,l.count),c.appendChild(u),a.appendChild(c)}e.appendChild(a);const r=b(`display:grid;${s}gap:4px;margin-top:4px;font-size:10px;color:var(--os-ui-fg-muted, #8c8f94);text-align:center;`);for(const l of n.contentByMonth){const c=document.createElement("span"),u=l.month.split("-");c.textContent=u.length===2?u[1]:l.month,r.appendChild(c)}return e.appendChild(r),e}function Co(n){const e=b("display:grid;grid-template-columns:repeat(auto-fit, minmax(280px, 1fr));gap:14px;margin:0 0 22px;");return e.appendChild(et(d("Recent posts"),d("No recent posts."),n.recentPosts.map(t=>({primary:t.title,when:t.dateGmt,tag:t.status!=="publish"?t.status:null,badge:t.commentCount>0?S(d("%d 💬"),t.commentCount):null})))),e.appendChild(et(d("Recent comments"),d("No recent comments."),n.recentComments.map(t=>({primary:t.excerpt||d("(empty comment)"),when:t.dateGmt,context:t.postTitle?S(d('on "%s"'),t.postTitle):void 0,tag:t.approved?null:d("pending"),badge:null})))),e}function et(n,e,t){const o=b(`${we}min-width:0;`);if(o.appendChild(b("font-size:13px;font-weight:600;margin:0 0 10px;",n)),t.length===0){const s=document.createElement("p");return s.style.cssText="margin:0;color:var(--os-ui-fg-muted, #50575e);font-size:12px;",s.textContent=e,o.appendChild(s),o}const i=document.createElement("ul");i.style.cssText="list-style:none;padding:0;margin:0;display:flex;flex-direction:column;gap:8px;";for(const s of t){const a=document.createElement("li");a.style.cssText="min-width:0;";const r=b("display:flex;align-items:baseline;gap:6px;min-width:0;"),l=document.createElement("span");if(l.style.cssText="font-size:13px;line-height:1.35;flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;",l.textContent=s.primary,l.title=s.primary,r.appendChild(l),s.tag){const u=document.createElement("span");u.style.cssText="font-size:10px;text-transform:uppercase;letter-spacing:0.04em;background:var(--os-ui-badge-neutral-bg, rgba(0,0,0,0.06));padding:1px 6px;border-radius:8px;flex-shrink:0;",u.textContent=s.tag,r.appendChild(u)}if(s.badge){const u=document.createElement("span");u.style.cssText="font-size:11px;color:var(--os-ui-fg-muted, #50575e);flex-shrink:0;",u.textContent=s.badge,r.appendChild(u)}a.appendChild(r);const c=b("font-size:11px;color:var(--os-ui-fg-muted, #8c8f94);");s.context&&c.append(s.context," · "),c.appendChild(Number.isFinite(Pe(s.when))?te(s.when):document.createTextNode("—")),a.appendChild(c),i.appendChild(a)}return o.appendChild(i),o}function Ao(n){const e=b(we);e.appendChild(b("font-size:13px;font-weight:600;margin:0 0 10px;",d("Active sessions & app access")));const t=b("display:grid;grid-template-columns:repeat(auto-fit, minmax(200px, 1fr));gap:12px;"),o=(a,r,l)=>{const c=b("display:flex;flex-direction:column;gap:2px;font-size:12px;");return c.append(b(bo,a),b("font-size:18px;font-weight:600;",r),b("color:var(--os-ui-fg-muted, #8c8f94);",l)),c};t.appendChild(o(d("Active sessions"),String(n.sessions.length),n.sessions.some(a=>a.current)?d("Includes the current device."):d("Logged in across multiple devices.")));const i=n.applicationPasswords;let s;if(i.lastUsedAt&&i.lastUsedName){const a=document.createDocumentFragment();a.append(S(d('"%s" last used'),i.lastUsedName)," ",te(i.lastUsedAt)),s=a}else s=i.total?d("No recent use."):d("No app passwords issued yet.");return t.appendChild(o(d("Application passwords"),String(i.total),s)),e.appendChild(t),e}const $o=w` ${H} ${Be}:host{display:inline-flex;align-items:center;gap:8px;font-size:12px;color:var( --os-ui-fg,#1d2327 );cursor:pointer;-webkit-user-select:none;user-select:none}label{display:inline-flex;align-items:center;gap:8px;cursor:pointer}:host( [ disabled ] ){opacity:0.5;cursor:not-allowed}:host( [ disabled ] ) label,:host( [ disabled ] ) input[ type='checkbox' ]{cursor:not-allowed}`,G=class G extends z{render(){const e=this.label||"",t=this.checked!==null,o=this.disabled!==null;return m` | |
| 266 | + `}_attr(e){return this.getAttribute(e)}_boolAttr(e){return this.getAttribute(e)!==null}_onInput(e){const t=e.target;this._textareaEl=t,this.setAttribute("value",t.value),this.emit("os-input-change",{value:t.value}),this._boolAttr("auto-grow")&&this._autosize(t)}_onChange(e){const t=e.target;this.emit("os-input-commit",{value:t.value})}_onKeyDown(e){if(!(!this._boolAttr("submit-on-enter")||e.isComposing||e.keyCode===229)&&e.key==="Enter"&&!e.shiftKey&&!e.altKey&&!e.metaKey&&!e.ctrlKey){e.preventDefault();const t=e.target;this.emit("os-submit",{value:t.value})}}_autosize(e){const t=Number(this._attr("max-rows"))||8,o=window.getComputedStyle(e),i=parseFloat(o.fontSize)||13,s=o.lineHeight,a=s==="normal"?i*1.45:parseFloat(s)||i*1.45,r=parseFloat(o.paddingTop)||0,l=parseFloat(o.paddingBottom)||0,c=(parseFloat(o.borderTopWidth)||0)+(parseFloat(o.borderBottomWidth)||0),d=a*t+r+l+c;e.style.height="auto",e.style.overflowY="hidden";const p=e.value?e.scrollHeight+c:a*(Number(this._attr("rows"))||3)+r+l+c,h=Math.min(p,d);e.style.height=`${Math.ceil(h)}px`,e.style.overflowY=p>Math.ceil(d)?"auto":"hidden"}refreshAutosize(){this._textareaEl&&this._boolAttr("auto-grow")&&this._autosize(this._textareaEl)}focusInput(){(this.shadowRoot??this).querySelector("textarea")?.focus()}clear(){this.setAttribute("value","");const t=(this.shadowRoot??this).querySelector("textarea");t&&(t.value="",this._boolAttr("auto-grow")&&this._autosize(t))}};K.props=["label","value","placeholder","disabled","readonly","ariaLabel","name","rows","maxlength","minlength","invalid","autoGrow","maxRows","submitOnEnter"],K.styles=[wo],K.help=void 0;let we=K;I("os-textarea",we);function ko(n){const e="ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz23456789!@#$%^&*-_=+",t=new Uint32Array(n);crypto.getRandomValues(t);let o="";for(let i=0;i<n;i+=1)o+=e[t[i]%e.length];return o}const Co="my-wordpress",Ao=Object.freeze({userId:null,userName:"",requestedAt:0});function et(){return window.wp?.os}let ne=null;function $o(){if(ne)return ne;const n=et()?.createSharedStore;return typeof n!="function"?null:(ne=n("desktop-mode/my-wordpress/footprint-target",()=>({...Ao})),ne)}function Eo(n,e=""){const t=$o();if(t){t.state.userId=n,t.state.userName=e,t.state.requestedAt=Date.now(),t.notify();return}window._wpdFootprintTarget={userId:n,userName:e,requestedAt:Date.now()}}function So(n){const e=Number(n.userId);if(!Number.isFinite(e)||e<=0)return;const t=n.userName??"";Eo(e,t),et()?.openWindow?.(Co,{source:"my-wordpress/open-user-footprint",params:{footprint:e,fpName:t}})}const ke="border:1px solid var(--os-ui-border, #dcdcde);border-radius:10px;padding:14px 16px;",Lo="color:var(--os-ui-fg-muted, #50575e);font-size:11px;text-transform:uppercase;letter-spacing:0.04em;font-weight:600;",To="display:inline-flex;padding:2px 8px;border-radius:10px;background:var(--os-ui-badge-info-bg, rgba(34,113,177,0.10));color:var(--os-ui-info-fg, #0a4b78);font-size:11px;font-weight:600;";function g(n,e){const t=document.createElement("div");return t.style.cssText=n,typeof e=="string"?t.textContent=e:e&&t.appendChild(e),t}function tt(n){n.replaceChildren(g("display:flex;align-items:center;justify-content:center;padding:32px;color:var(--os-ui-fg-muted, #50575e);font-size:13px;",u("Loading insights…")))}function ot(n,e){const t=document.createElement("p");t.style.cssText="padding:24px;color:var(--os-ui-danger, #b32d2e);font-size:13px;text-align:center;",t.textContent=T(u("Could not load insights (%s)."),String(e?.message??e)),n.replaceChildren(t)}function zo(n,e,t){const o=[No(e,t),Mo(e),Po(e)];t.canViewFootprint&&o.push(Ro(e)),n.replaceChildren(...o)}function Io(n,e){const t=document.createElement("div");t.className="os-user-edit__activity";const o=document.createElement("h3");o.textContent=u("Recent activity"),o.style.cssText="margin:24px 0 12px;font-size:13px;font-weight:600;text-transform:uppercase;letter-spacing:0.04em;color:var(--os-ui-fg-muted, #50575e);",t.append(o,Ho(e),Do(e)),n.replaceChildren(t)}function nt(n,e){const t=g("display:flex;flex-wrap:wrap;gap:4px;justify-content:center;"),o=e.allRoles??{};for(const i of n){const s=document.createElement("span");s.textContent=o[i]??i,s.style.cssText=To,t.appendChild(s)}if(n.length===0){const i=document.createElement("span");i.textContent=u("No role"),i.style.cssText="font-size:11px;color:var(--os-ui-fg-muted, #8c8f94);",t.appendChild(i)}return t}function No(n,e){const t=g(["display:flex","flex-direction:column","align-items:center","text-align:center","gap:6px","padding:16px","border:1px solid var(--os-ui-border, #dcdcde)","border-radius:12px","background:var(--os-ui-card-bg, var(--os-ui-surface, #f6f7f7))"].join(";")),o=document.createElement("img");o.src=n.avatarUrl,o.alt="",o.style.cssText="width:72px;height:72px;border-radius:50%;flex-shrink:0;",t.appendChild(o),t.appendChild(g("font-size:15px;font-weight:600;letter-spacing:-0.01em;",n.displayName||`#${n.userId}`)),t.appendChild(nt(n.roles,e));const i=n.profileCompleteness;if(i&&i.total>0){const s=g("display:flex;flex-direction:column;gap:4px;width:100%;margin-top:6px;"),a=g("display:flex;justify-content:space-between;align-items:baseline;font-size:11px;color:var(--os-ui-fg-muted, #50575e);"),r=document.createElement("span");r.textContent=u("Profile completeness");const l=document.createElement("span");l.style.cssText="font-variant-numeric:tabular-nums;font-weight:600;",l.textContent=`${i.percent}%`,a.append(r,l),s.appendChild(a);const c=g("height:4px;border-radius:999px;background:var(--os-ui-holo-track, rgba(0,0,0,0.06));position:relative;overflow:hidden;");c.appendChild(g(`position:absolute;inset:0;width:${i.percent}%;background:var(--wp-admin-theme-color, #2271b1);transition:width 360ms ease;`)),s.appendChild(c),t.appendChild(s)}return t}function Mo(n){const e=g("display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:12px;"),t=(s,a,r)=>{const l=g("border:1px solid var(--os-ui-border, #dcdcde);border-radius:8px;padding:8px 10px;display:flex;flex-direction:column;gap:1px;min-width:0;");if(l.appendChild(g("font-size:10px;text-transform:uppercase;letter-spacing:0.04em;color:var(--os-ui-fg-muted, #50575e);font-weight:600;",s)),l.appendChild(g("font-size:18px;font-weight:600;font-variant-numeric:tabular-nums;",a)),r){const c=g("font-size:10px;color:var(--os-ui-fg-muted, #8c8f94);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;",r);c.title=r,l.appendChild(c)}return l},o=n.stats;e.appendChild(t(u("Posts"),String(o.posts),o.pages>0?T(Se("+ %d page","+ %d pages",o.pages),o.pages):void 0)),e.appendChild(t(u("Comments"),String(o.commentsAuthored),o.commentsReceived>0?T(u("%d received"),o.commentsReceived):void 0)),e.appendChild(t(u("Last login"),o.lastLoginAt?te(o.lastLoginAt):u("Never"),o.lastLoginAt?ae(o.lastLoginAt*1e3,"long"):void 0));let i="—";return o.daysSinceRegistration!==null&&(i=T(Se("%d day","%d days",o.daysSinceRegistration),o.daysSinceRegistration)),e.appendChild(t(u("Member"),i,o.registeredAt?ae(o.registeredAt*1e3,"long"):void 0)),e}function Ro(n){const e=g("margin:0 0 22px;"),t=document.createElement("os-button");return t.setAttribute("variant","secondary"),t.setAttribute("fill-cell",""),t.setAttribute("data-os-user-profile-footprint",""),t.textContent=u("View activity footprint"),t.addEventListener("click",()=>{So({userId:n.userId,userName:n.displayName})}),e.appendChild(t),e}function Po(n){const e=g(ke),t=g("display:flex;justify-content:space-between;align-items:baseline;margin:0 0 8px;");t.appendChild(g("font-size:13px;font-weight:600;",u("Posts published — last 12 months")));const o=n.contentByMonth.reduce((l,c)=>l+c.count,0);if(t.appendChild(g("font-size:11px;color:var(--os-ui-fg-muted, #50575e);",T(u("%d total"),o))),e.appendChild(t),n.contentByMonth.length===0){const l=document.createElement("p");return l.style.cssText="margin:0;color:var(--os-ui-fg-muted, #50575e);font-size:12px;",l.textContent=u("No activity in the last 12 months."),e.appendChild(l),e}const i=Math.max(1,...n.contentByMonth.map(l=>l.count)),s=`grid-template-columns:repeat(${n.contentByMonth.length}, 1fr);`,a=g(`display:grid;${s}gap:4px;align-items:end;height:60px;`);for(const l of n.contentByMonth){const c=g("display:flex;flex-direction:column;align-items:center;height:100%;justify-content:flex-end;"),d=g(["width:100%",`height:${Math.max(3,Math.round(l.count/i*100))}%`,"background:var(--wp-admin-theme-color, #2271b1)",l.count===0?"opacity:0.18":"opacity:1","border-radius:3px 3px 0 0","transition:height 360ms ease"].join(";"));d.title=T(u("%1$s — %2$d posts"),l.month,l.count),c.appendChild(d),a.appendChild(c)}e.appendChild(a);const r=g(`display:grid;${s}gap:4px;margin-top:4px;font-size:10px;color:var(--os-ui-fg-muted, #8c8f94);text-align:center;`);for(const l of n.contentByMonth){const c=document.createElement("span"),d=l.month.split("-");c.textContent=d.length===2?d[1]:l.month,r.appendChild(c)}return e.appendChild(r),e}function Ho(n){const e=g("display:grid;grid-template-columns:repeat(auto-fit, minmax(280px, 1fr));gap:14px;margin:0 0 22px;");return e.appendChild(it(u("Recent posts"),u("No recent posts."),n.recentPosts.map(t=>({primary:t.title,when:t.dateGmt,tag:t.status!=="publish"?t.status:null,badge:t.commentCount>0?T(u("%d 💬"),t.commentCount):null})))),e.appendChild(it(u("Recent comments"),u("No recent comments."),n.recentComments.map(t=>({primary:t.excerpt||u("(empty comment)"),when:t.dateGmt,context:t.postTitle?T(u('on "%s"'),t.postTitle):void 0,tag:t.approved?null:u("pending"),badge:null})))),e}function it(n,e,t){const o=g(`${ke}min-width:0;`);if(o.appendChild(g("font-size:13px;font-weight:600;margin:0 0 10px;",n)),t.length===0){const s=document.createElement("p");return s.style.cssText="margin:0;color:var(--os-ui-fg-muted, #50575e);font-size:12px;",s.textContent=e,o.appendChild(s),o}const i=document.createElement("ul");i.style.cssText="list-style:none;padding:0;margin:0;display:flex;flex-direction:column;gap:8px;";for(const s of t){const a=document.createElement("li");a.style.cssText="min-width:0;";const r=g("display:flex;align-items:baseline;gap:6px;min-width:0;"),l=document.createElement("span");if(l.style.cssText="font-size:13px;line-height:1.35;flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;",l.textContent=s.primary,l.title=s.primary,r.appendChild(l),s.tag){const d=document.createElement("span");d.style.cssText="font-size:10px;text-transform:uppercase;letter-spacing:0.04em;background:var(--os-ui-badge-neutral-bg, rgba(0,0,0,0.06));padding:1px 6px;border-radius:8px;flex-shrink:0;",d.textContent=s.tag,r.appendChild(d)}if(s.badge){const d=document.createElement("span");d.style.cssText="font-size:11px;color:var(--os-ui-fg-muted, #50575e);flex-shrink:0;",d.textContent=s.badge,r.appendChild(d)}a.appendChild(r);const c=g("font-size:11px;color:var(--os-ui-fg-muted, #8c8f94);");s.context&&c.append(s.context," · "),c.appendChild(Number.isFinite(De(s.when))?te(s.when):document.createTextNode("—")),a.appendChild(c),i.appendChild(a)}return o.appendChild(i),o}function Do(n){const e=g(ke);e.appendChild(g("font-size:13px;font-weight:600;margin:0 0 10px;",u("Active sessions & app access")));const t=g("display:grid;grid-template-columns:repeat(auto-fit, minmax(200px, 1fr));gap:12px;"),o=(a,r,l)=>{const c=g("display:flex;flex-direction:column;gap:2px;font-size:12px;");return c.append(g(Lo,a),g("font-size:18px;font-weight:600;",r),g("color:var(--os-ui-fg-muted, #8c8f94);",l)),c};t.appendChild(o(u("Active sessions"),String(n.sessions.length),n.sessions.some(a=>a.current)?u("Includes the current device."):u("Logged in across multiple devices.")));const i=n.applicationPasswords;let s;if(i.lastUsedAt&&i.lastUsedName){const a=document.createDocumentFragment();a.append(T(u('"%s" last used'),i.lastUsedName)," ",te(i.lastUsedAt)),s=a}else s=i.total?u("No recent use."):u("No app passwords issued yet.");return t.appendChild(o(u("Application passwords"),String(i.total),s)),e.appendChild(t),e}const jo=w` ${D} ${Oe}:host{display:inline-flex;align-items:center;gap:8px;font-size:12px;color:var( --os-ui-fg,#1d2327 );cursor:pointer;-webkit-user-select:none;user-select:none}label{display:inline-flex;align-items:center;gap:8px;cursor:pointer}:host( [ disabled ] ){opacity:0.5;cursor:not-allowed}:host( [ disabled ] ) label,:host( [ disabled ] ) input[ type='checkbox' ]{cursor:not-allowed}`,G=class G extends z{render(){const e=this.label||"",t=this.checked!==null,o=this.disabled!==null;return m` | |
| 266 | 267 | <label> |
| 267 | 268 | <input |
| 268 | 269 | type="checkbox" |
| 269 | 270 | ?checked=${t} |
| @@ -271,9 +272,9 @@ | ||
| 271 | 272 | @change=${i=>this._onChange(i)} |
| 272 | 273 | /> |
| 273 | 274 | <span class="os-checkbox-label__text">${e}</span> |
| 274 | 275 | </label> |
| 275 | - `}_onChange(e){if(this.disabled!==null)return;const t=e.target.checked;t?this.setAttribute("checked",""):this.removeAttribute("checked"),this.emit("os-checkbox-change",{checked:t})}};G.props=["label","checked","disabled"],G.styles=[$o],G.help=void 0;let ke=G;I("os-checkbox-label",ke);function ne(n,e,t,o={}){const i=o.trueValue??"true",s=o.falseValue??"false",a=document.createElement("span");o.fullWidth&&a.setAttribute("full-width","");const r=document.createElement("os-checkbox-label");return r.setAttribute("label",e),r.setAttribute("name",n),r.setAttribute("value",t?i:s),r.value=t?i:s,t&&r.setAttribute("checked",""),r.addEventListener("os-checkbox-change",l=>{const c=l.detail?.checked?i:s;r.value=c,r.setAttribute("value",c)}),a.appendChild(r),a}function Eo(n,e){if(e?.url){let o=document.getElementById("colors-css");o||(o=document.createElement("link"),o.rel="stylesheet",o.id="colors-css",document.head.appendChild(o)),o.href=e.url}document.querySelector(".os-shell")?.setAttribute("data-os-scheme",n);const t=`admin-color-${n}`;for(const o of Array.from(document.body.classList))o.startsWith("admin-color-")&&o!==t&&document.body.classList.remove(o);document.body.classList.add(t)}function So(n,e,t={}){const o=document.createElement("div");o.setAttribute("full-width",""),o.style.cssText="display:flex;flex-direction:column;gap:6px;";const i=document.createElement("span");i.style.cssText="font-size:11px;text-transform:uppercase;letter-spacing:0.04em;color:var(--os-ui-fg-muted, #50575e);font-weight:600;",i.textContent=d("Admin colour scheme"),o.appendChild(i);const s=document.createElement("os-text-field");s.setAttribute("name","meta.admin_color"),s.setAttribute("value",e),s.value=e,s.style.display="none",o.appendChild(s);const a=document.createElement("div");a.style.cssText="display:grid;grid-template-columns:repeat(auto-fill, minmax(140px, 1fr));gap:8px;",o.appendChild(a);let r=e;const l=u=>{s.value=u,s.setAttribute("value",u);for(const p of Array.from(a.children)){const h=p,g=h.dataset.scheme===u;h.style.borderColor=g?"var(--wp-admin-theme-color, #2271b1)":"var(--os-ui-border, #dcdcde)",h.style.boxShadow=g?"0 0 0 1px var(--wp-admin-theme-color, #2271b1) inset":"none",h.setAttribute("aria-checked",g?"true":"false")}},c=u=>{t.livePreview&&Eo(u,n[u])};for(const[u,p]of Object.entries(n)){const h=document.createElement("button");h.type="button",h.setAttribute("role","radio"),h.dataset.scheme=u,h.style.cssText=["appearance:none","border:1px solid var(--os-ui-border, #dcdcde)","background:var(--os-ui-card-bg, var(--os-ui-surface, #fff))","color:inherit","border-radius:8px","padding:10px 10px 8px","cursor:pointer","display:flex","flex-direction:column","gap:6px","text-align:left","min-width:0","transition:border-color 120ms ease, box-shadow 120ms ease"].join(";");const g=document.createElement("span");g.style.cssText="display:flex;height:18px;border-radius:4px;overflow:hidden;border:1px solid var(--os-ui-border, rgba(0,0,0,0.06));";const f=(p.colors??[]).slice(0,4);f.length===0&&f.push("#dcdcde","#dcdcde","#dcdcde");for(const v of f){const y=document.createElement("span");y.style.cssText=`flex:1 1 auto;background:${v};`,g.appendChild(y)}h.appendChild(g);const _=document.createElement("span");_.style.cssText="font-size:12px;font-weight:500;",_.textContent=p.name,h.appendChild(_),h.addEventListener("click",()=>{l(u),c(u)}),a.appendChild(h)}return l(e),o.revert=()=>{l(r),c(r)},o.commit=u=>{r=u},o}function zo(n,e,t){const o=document.createElement("div");o.setAttribute("full-width",""),o.style.cssText="display:flex;align-items:center;gap:12px;flex-wrap:wrap;";const i=document.createElement("span");i.style.cssText="font-size:13px;",i.textContent=d("Active sessions"),o.appendChild(i);const s=document.createElement("os-button");return s.setAttribute("variant","ghost"),s.setAttribute("type","button"),s.textContent=d(t?"Log out everywhere else":"Log this user out everywhere"),s.addEventListener("click",async a=>{a.preventDefault();try{await Ut(n,e,t?"others":"all"),n.toast(d("Sessions destroyed."),"success")}catch(r){n.toast(S(d("Could not destroy sessions (%s)."),String(r.message??r)),"error")}}),o.appendChild(s),o}function Lo(n,e){const t=document.createElement("div");t.setAttribute("full-width",""),t.style.cssText="display:flex;flex-direction:column;gap:8px;border:1px solid var(--os-ui-border, #dcdcde);border-radius:8px;padding:12px 14px;";const o=document.createElement("span");o.textContent=d("Application passwords"),o.style.cssText="font-size:13px;font-weight:600;",t.appendChild(o);const i=document.createElement("ul");i.style.cssText="list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px;",t.appendChild(i);const s=document.createElement("div");s.style.cssText="display:flex;gap:8px;align-items:flex-end;flex-wrap:wrap;margin-top:6px;";const a=document.createElement("os-text-field");a.setAttribute("label",d("New application password name")),a.setAttribute("placeholder",d("e.g. iPhone, WP-CLI, Backup tool")),a.style.flex="1 1 220px",s.appendChild(a);const r=document.createElement("os-button");r.setAttribute("variant","primary"),r.setAttribute("type","button"),r.textContent=d("Create"),s.appendChild(r),t.appendChild(s);const l=u=>{if(i.replaceChildren(),u.length===0){const p=document.createElement("li");p.style.cssText="font-size:12px;color:var(--os-ui-fg-muted, #50575e);",p.textContent=d("No application passwords issued yet."),i.appendChild(p);return}for(const p of u){const h=document.createElement("li");h.style.cssText="display:flex;align-items:center;gap:8px;font-size:12px;";const g=document.createElement("span");g.style.cssText="flex:1 1 auto;font-weight:500;",g.textContent=p.name,h.appendChild(g);const f=document.createElement("span");f.style.cssText="color:var(--os-ui-fg-muted, #8c8f94);",p.last_used?f.append(d("last used")," ",te(p.last_used)):f.textContent=d("never used"),h.appendChild(f);const _=document.createElement("os-button");_.setAttribute("variant","ghost"),_.setAttribute("type","button"),_.textContent=d("Revoke"),_.addEventListener("click",async v=>{v.preventDefault();try{await Ot(n,e,p.uuid),h.remove(),n.toast(d("Application password revoked."),"success")}catch(y){n.toast(String(y.message??y),"error")}}),h.appendChild(_),i.appendChild(h)}},c=async()=>{try{l(await qt(n,e))}catch{}};return c(),r.addEventListener("click",async u=>{u.preventDefault();const p=String(a.value??"").trim();if(!p){n.toast(d("Application password name is required."),"error");return}try{const h=await Bt(n,e,p);n.toast(S(d("Created. Copy the password now: %s"),h),"success"),He(h),a.value="",a.setAttribute("value",""),c()}catch(h){n.toast(String(h.message??h),"error")}}),t}const To="margin:18px 0 4px;font-size:13px;font-weight:600;text-transform:uppercase;letter-spacing:0.04em;color:var(--os-ui-fg-muted, #50575e);";async function Io(n,e,t,o={}){n.replaceChildren();const i=document.createElement("div");i.className="os-user-edit__skeleton",i.style.cssText="display:flex;align-items:center;justify-content:center;padding:48px;color:var(--os-ui-fg-muted, #50575e);font-size:13px;",i.textContent=d("Loading profile…"),n.appendChild(i);let s;try{s=await Dt(t,e)}catch(a){n.replaceChildren();const r=document.createElement("p");throw r.style.cssText="padding:32px;color:var(--os-ui-danger, #b32d2e);font-size:13px;text-align:center;",r.textContent=S(d("Could not load profile (%s)."),String(a.message??a)),n.appendChild(r),a}return n.replaceChildren(),No(n,s,e,t,o),s}function tt(n){const e=document.createElement("h3");return e.setAttribute("full-width",""),e.textContent=n,e.style.cssText=To,e}function ot(n,e,t,o){const i=document.createElement("os-select");return i.setAttribute("name",n),i.setAttribute("label",e),i.items=Object.entries(t).map(([s,a])=>({value:s,label:a})),i.value=o,i}function nt(n,e,t){const o=document.createElement("os-text-field");return o.setAttribute("name",n),o.setAttribute("type","password"),o.setAttribute("reveal",""),o.setAttribute("label",e),o.setAttribute("placeholder",t),o.setAttribute("autocomplete","new-password"),o}function P(n,e,t,o={}){const i=document.createElement("os-text-field");return i.setAttribute("name",n),i.setAttribute("label",e),i.setAttribute("value",t),i.value=t,o.required&&i.setAttribute("required",""),o.readonly&&i.setAttribute("readonly",""),o.type&&i.setAttribute("type",o.type),i}function No(n,e,t,o,i){const s=o.config,a=document.createElement("div");a.className="os-user-edit__profile";const r=document.createElement("os-form");r.setAttribute("submit-label",d("Save changes")),r.setAttribute("reset-label",d("Revert")),r.setAttribute("columns","auto");const l=document.createElement("div");l.setAttribute("slot","header");let c=it(e,s);l.appendChild(c),r.appendChild(l),r.appendChild(P("username",d("Username"),e.username,{readonly:!0})),r.appendChild(P("first_name",d("First name"),e.first_name)),r.appendChild(P("last_name",d("Last name"),e.last_name)),r.appendChild(P("nickname",d("Nickname"),e.nickname??"",{required:!0}));const u=document.createElement("os-select");u.setAttribute("name","name"),u.setAttribute("label",d("Display name publicly as")),u.items=Mo(e),u.value=e.name,r.appendChild(u),r.appendChild(P("email",d("Email (required)"),e.email,{required:!0,type:"email"})),r.appendChild(P("url",d("Website"),e.url,{type:"url"}));const p=e.meta??{};for(const[x,C]of Object.entries(s.contactMethods??{}))r.appendChild(P(`meta.${x}`,C,String(p[x]??"")));const h=document.createElement("os-textarea");h.setAttribute("name","description"),h.setAttribute("label",d("Biographical info")),h.setAttribute("placeholder",d("Share a little about yourself — visible on author archives.")),h.setAttribute("rows","4"),h.setAttribute("full-width",""),h.value=e.description,h.setAttribute("value",e.description),r.appendChild(h),r.appendChild(ot("locale",d("Language"),s.locales??{"":d("Site default")},String(e.locale??"")));const g=t===(s.currentUserId??0);if(!g){const x=s.assignableRoles??{},C=Object.keys(x).length>0?x:s.allRoles??{},$=Array.isArray(e.roles)?e.roles[0]??"":"";r.appendChild(ot("roles[0]",d("Role"),C,$))}r.appendChild(tt(d("Personal options")));const f=(x,C)=>String(p[x]??C)!=="false";r.appendChild(ne("meta.rich_editing",d("Disable the visual editor when writing"),!f("rich_editing",""),{trueValue:"false",falseValue:"true",fullWidth:!0})),r.appendChild(ne("meta.syntax_highlighting",d("Disable syntax highlighting when editing code"),!f("syntax_highlighting",""),{trueValue:"false",falseValue:"true",fullWidth:!0})),r.appendChild(ne("meta.comment_shortcuts",d("Enable keyboard shortcuts for comment moderation"),String(p.comment_shortcuts??"false")==="true",{fullWidth:!0})),r.appendChild(ne("meta.show_admin_bar_front",d("Show toolbar when viewing site"),f("show_admin_bar_front","true"),{fullWidth:!0}));const _=So(s.colorSchemes??{},String(p.admin_color??"fresh"),{livePreview:g});r.appendChild(_),r.appendChild(tt(d("Account management")));const v=document.createElement("div");v.setAttribute("full-width",""),v.style.cssText="display:flex;gap:12px;align-items:flex-end;flex-wrap:wrap;";const y=nt("password",d("New password"),d("Leave blank to keep the current password."));y.style.flex="1 1 280px",v.appendChild(y);const k=nt("password_confirm",d("Confirm new password"),d("Type the new password again."));k.setAttribute("full-width","");const A=document.createElement("os-button");A.setAttribute("variant","ghost"),A.setAttribute("type","button");const L=document.createElement("os-icon");L.setAttribute("name","randomize"),L.setAttribute("size","14"),A.append(L,document.createTextNode(d("Generate strong"))),A.addEventListener("click",x=>{x.preventDefault();const C=go(18);for(const $ of[y,k])$.value=C,$.setAttribute("value",C);He(C),o.toast(d("Password generated and copied to clipboard."),"success")}),v.appendChild(A),r.appendChild(v),r.appendChild(k),r.appendChild(zo(o,t,g)),r.appendChild(Lo(o,t)),r.addEventListener("os-form-reset",()=>_.revert());let j=!1;r.addEventListener("os-form-submit",x=>{Ce(x.detail.values)});const Ce=async x=>{if(j)return;j=!0,r.setBusy(!0),r.clearErrors();const C={first_name:x.first_name,last_name:x.last_name,nickname:x.nickname,name:x.name,email:x.email,url:x.url,description:x.description,locale:x.locale??""};if(typeof x.password=="string"&&x.password!==""){if(String(x.password_confirm??"")!==x.password){r.setError(d("The two password fields do not match.")),r.setFieldInvalid("password_confirm"),j=!1,r.setBusy(!1);return}C.password=x.password}typeof x["roles[0]"]=="string"&&x["roles[0]"]&&(C.roles=[x["roles[0]"]]);const $={};for(const[T,Y]of Object.entries(x))T.startsWith("meta.")&&($[T.slice(5)]=typeof Y=="boolean"?r.querySelector(`[name="${T}"]`)?.getAttribute("value")??String(Y):Y);Object.keys($).length>0&&(C.meta=$);const R=await Vt(o,t,C);if(j=!1,r.setBusy(!1),!R.ok){const T=R.message??Ro(R.error)??d("Save failed.");r.setError(T),o.toast(T,"error");for(const Y of Object.keys(R.fieldErrors??{}))r.setFieldInvalid(Y);_.revert(),console.warn("[user-edit] save failed",{code:R.error,message:R.message});return}o.toast(d("Profile saved."),"success"),typeof $.admin_color=="string"&&_.commit($.admin_color);for(const T of[y,k])T.value="",T.setAttribute("value","");if(R.user){Object.assign(e,R.user);const T=it(e,s);c.replaceWith(T),c=T,i.onSaved?.(e)}};a.appendChild(r),n.appendChild(a)}function it(n,e){const t=document.createElement("div");t.className="os-user-edit__header",t.style.cssText="display:flex;align-items:center;gap:16px;margin:0 0 12px;";const o=document.createElement("os-avatar");o.setAttribute("size","64"),(n.name||n.username)&&o.setAttribute("name",n.name||n.username||""),n.id>0&&o.setAttribute("user-id",String(n.id));const i=n.avatar_urls??{},s=i[96]??i[48]??"";s&&Zt(o,s),t.appendChild(o);const a=document.createElement("div");a.style.cssText="min-width:0;display:flex;flex-direction:column;gap:4px;";const r=document.createElement("div");r.style.cssText="font-size:18px;font-weight:600;letter-spacing:-0.01em;",r.textContent=n.name||n.username||`#${n.id}`,a.appendChild(r);const l=document.createElement("div");l.style.cssText="display:flex;align-items:center;gap:6px;font-size:12px;color:var(--os-ui-fg-muted, #50575e);flex-wrap:wrap;";const c=document.createElement("span");c.textContent=`@${n.username}`,l.appendChild(c);const u=Je(Array.isArray(n.roles)?n.roles:[],e);return u.style.justifyContent="flex-start",l.appendChild(u),a.appendChild(l),t.appendChild(a),t}function Mo(n){const e=new Set,t=o=>{const i=o.trim();i!==""&&e.add(i)};return t(n.username),t(n.nickname??""),t(n.first_name),t(n.last_name),(n.first_name||n.last_name)&&(t(`${n.first_name} ${n.last_name}`.trim()),t(`${n.last_name} ${n.first_name}`.trim())),n.name&&t(n.name),Array.from(e).map(o=>({value:o,label:o}))}function Ro(n){switch(n){case"rest_user_invalid_email":case"invalid_email":return d("Email address is not valid.");case"rest_user_email_exists":case"existing_user_email":return d("That email is already in use.");case"rest_user_invalid_role":return d("You are not allowed to assign that role.");default:return null}}function Po(n,e={}){const t=window.openStationConfig??{},o=new Headers(e.headers);return o.has("Accept")||o.set("Accept","application/json"),t.restNonce&&!o.has("X-WP-Nonce")&&o.set("X-WP-Nonce",t.restNonce),ht(at(String(t.restRoot??""),n),{credentials:"same-origin",...e,headers:o},{source:"user-profile"})}function Ho(n){window.wp?.os?.showToast?.({message:n})}class st extends HTMLElement{constructor(){super(...arguments),this._config={},this._fetch=null,this._toast=null,this._shellReady=!1,this._mountedFor=null,this._generation=0,this._scheduled=!1}static get observedAttributes(){return["user-id"]}get config(){return this._config}set config(e){this._config=e??{},this._schedule()}get fetch(){return this._fetch}set fetch(e){this._fetch=e,this._schedule()}get toast(){return this._toast}set toast(e){this._toast=e}connectedCallback(){this._shellReady||(this._shellReady=!0,this.classList.add("os-user-profile"),this.innerHTML=` | |
| 276 | + `}_onChange(e){if(this.disabled!==null)return;const t=e.target.checked;t?this.setAttribute("checked",""):this.removeAttribute("checked"),this.emit("os-checkbox-change",{checked:t})}};G.props=["label","checked","disabled"],G.styles=[jo],G.help=void 0;let Ce=G;I("os-checkbox-label",Ce);function ie(n,e,t,o={}){const i=o.trueValue??"true",s=o.falseValue??"false",a=document.createElement("span");o.fullWidth&&a.setAttribute("full-width","");const r=document.createElement("os-checkbox-label");return r.setAttribute("label",e),r.setAttribute("name",n),r.setAttribute("value",t?i:s),r.value=t?i:s,t&&r.setAttribute("checked",""),r.addEventListener("os-checkbox-change",l=>{const c=l.detail?.checked?i:s;r.value=c,r.setAttribute("value",c)}),a.appendChild(r),a}function Vo(n,e){if(e?.url){let o=document.getElementById("colors-css");o||(o=document.createElement("link"),o.rel="stylesheet",o.id="colors-css",document.head.appendChild(o)),o.href=e.url}document.querySelector(".os-shell")?.setAttribute("data-os-scheme",n);const t=`admin-color-${n}`;for(const o of Array.from(document.body.classList))o.startsWith("admin-color-")&&o!==t&&document.body.classList.remove(o);document.body.classList.add(t)}function Fo(n,e,t={}){const o=document.createElement("div");o.setAttribute("full-width",""),o.style.cssText="display:flex;flex-direction:column;gap:6px;";const i=document.createElement("span");i.style.cssText="font-size:11px;text-transform:uppercase;letter-spacing:0.04em;color:var(--os-ui-fg-muted, #50575e);font-weight:600;",i.textContent=u("Admin colour scheme"),o.appendChild(i);const s=document.createElement("os-text-field");s.setAttribute("name","meta.admin_color"),s.setAttribute("value",e),s.value=e,s.style.display="none",o.appendChild(s);const a=document.createElement("div");a.style.cssText="display:grid;grid-template-columns:repeat(auto-fill, minmax(140px, 1fr));gap:8px;",o.appendChild(a);let r=e;const l=d=>{s.value=d,s.setAttribute("value",d);for(const p of Array.from(a.children)){const h=p,b=h.dataset.scheme===d;h.style.borderColor=b?"var(--wp-admin-theme-color, #2271b1)":"var(--os-ui-border, #dcdcde)",h.style.boxShadow=b?"0 0 0 1px var(--wp-admin-theme-color, #2271b1) inset":"none",h.setAttribute("aria-checked",b?"true":"false")}},c=d=>{t.livePreview&&Vo(d,n[d])};for(const[d,p]of Object.entries(n)){const h=document.createElement("button");h.type="button",h.setAttribute("role","radio"),h.dataset.scheme=d,h.style.cssText=["appearance:none","border:1px solid var(--os-ui-border, #dcdcde)","background:var(--os-ui-card-bg, var(--os-ui-surface, #fff))","color:inherit","border-radius:8px","padding:10px 10px 8px","cursor:pointer","display:flex","flex-direction:column","gap:6px","text-align:left","min-width:0","transition:border-color 120ms ease, box-shadow 120ms ease"].join(";");const b=document.createElement("span");b.style.cssText="display:flex;height:18px;border-radius:4px;overflow:hidden;border:1px solid var(--os-ui-border, rgba(0,0,0,0.06));";const f=(p.colors??[]).slice(0,4);f.length===0&&f.push("#dcdcde","#dcdcde","#dcdcde");for(const _ of f){const y=document.createElement("span");y.style.cssText=`flex:1 1 auto;background:${_};`,b.appendChild(y)}h.appendChild(b);const x=document.createElement("span");x.style.cssText="font-size:12px;font-weight:500;",x.textContent=p.name,h.appendChild(x),h.addEventListener("click",()=>{l(d),c(d)}),a.appendChild(h)}return l(e),o.revert=()=>{l(r),c(r)},o.commit=d=>{r=d},o}function qo(n,e,t){const o=document.createElement("div");o.setAttribute("full-width",""),o.style.cssText="display:flex;align-items:center;gap:12px;flex-wrap:wrap;";const i=document.createElement("span");i.style.cssText="font-size:13px;",i.textContent=u("Active sessions"),o.appendChild(i);const s=document.createElement("os-button");return s.setAttribute("variant","ghost"),s.setAttribute("type","button"),s.textContent=u(t?"Log out everywhere else":"Log this user out everywhere"),s.addEventListener("click",async a=>{a.preventDefault();try{await Kt(n,e,t?"others":"all"),n.toast(u("Sessions destroyed."),"success")}catch(r){n.toast(T(u("Could not destroy sessions (%s)."),String(r.message??r)),"error")}}),o.appendChild(s),o}function Uo(n,e){const t=document.createElement("div");t.setAttribute("full-width",""),t.style.cssText="display:flex;flex-direction:column;gap:8px;border:1px solid var(--os-ui-border, #dcdcde);border-radius:8px;padding:12px 14px;";const o=document.createElement("span");o.textContent=u("Application passwords"),o.style.cssText="font-size:13px;font-weight:600;",t.appendChild(o);const i=document.createElement("ul");i.style.cssText="list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px;",t.appendChild(i);const s=document.createElement("div");s.style.cssText="display:flex;gap:8px;align-items:flex-end;flex-wrap:wrap;margin-top:6px;";const a=document.createElement("os-text-field");a.setAttribute("label",u("New application password name")),a.setAttribute("placeholder",u("e.g. iPhone, WP-CLI, Backup tool")),a.style.flex="1 1 220px",s.appendChild(a);const r=document.createElement("os-button");r.setAttribute("variant","primary"),r.setAttribute("type","button"),r.textContent=u("Create"),s.appendChild(r),t.appendChild(s);const l=d=>{if(i.replaceChildren(),d.length===0){const p=document.createElement("li");p.style.cssText="font-size:12px;color:var(--os-ui-fg-muted, #50575e);",p.textContent=u("No application passwords issued yet."),i.appendChild(p);return}for(const p of d){const h=document.createElement("li");h.style.cssText="display:flex;align-items:center;gap:8px;font-size:12px;";const b=document.createElement("span");b.style.cssText="flex:1 1 auto;font-weight:500;",b.textContent=p.name,h.appendChild(b);const f=document.createElement("span");f.style.cssText="color:var(--os-ui-fg-muted, #8c8f94);",p.last_used?f.append(u("last used")," ",te(p.last_used)):f.textContent=u("never used"),h.appendChild(f);const x=document.createElement("os-button");x.setAttribute("variant","ghost"),x.setAttribute("type","button"),x.textContent=u("Revoke"),x.addEventListener("click",async _=>{_.preventDefault();try{await Qt(n,e,p.uuid),h.remove(),n.toast(u("Application password revoked."),"success")}catch(y){n.toast(String(y.message??y),"error")}}),h.appendChild(x),i.appendChild(h)}},c=async()=>{try{l(await Gt(n,e))}catch{}};return c(),r.addEventListener("click",async d=>{d.preventDefault();const p=String(a.value??"").trim();if(!p){n.toast(u("Application password name is required."),"error");return}try{const h=await Yt(n,e,p);n.toast(T(u("Created. Copy the password now: %s"),h),"success"),je(h),a.value="",a.setAttribute("value",""),c()}catch(h){n.toast(String(h.message??h),"error")}}),t}const Bo="margin:18px 0 4px;font-size:13px;font-weight:600;text-transform:uppercase;letter-spacing:0.04em;color:var(--os-ui-fg-muted, #50575e);";async function Wo(n,e,t,o={}){n.replaceChildren();const i=document.createElement("div");i.className="os-user-edit__skeleton",i.style.cssText="display:flex;align-items:center;justify-content:center;padding:48px;color:var(--os-ui-fg-muted, #50575e);font-size:13px;",i.textContent=u("Loading profile…"),n.appendChild(i);let s;try{s=await Ot(t,e)}catch(a){n.replaceChildren();const r=document.createElement("p");throw r.style.cssText="padding:32px;color:var(--os-ui-danger, #b32d2e);font-size:13px;text-align:center;",r.textContent=T(u("Could not load profile (%s)."),String(a.message??a)),n.appendChild(r),a}return n.replaceChildren(),Oo(n,s,e,t,o),s}function st(n){const e=document.createElement("h3");return e.setAttribute("full-width",""),e.textContent=n,e.style.cssText=Bo,e}function rt(n,e,t,o){const i=document.createElement("os-select");return i.setAttribute("name",n),i.setAttribute("label",e),i.items=Object.entries(t).map(([s,a])=>({value:s,label:a})),i.value=o,i}function at(n,e,t){const o=document.createElement("os-text-field");return o.setAttribute("name",n),o.setAttribute("type","password"),o.setAttribute("reveal",""),o.setAttribute("label",e),o.setAttribute("placeholder",t),o.setAttribute("autocomplete","new-password"),o}function H(n,e,t,o={}){const i=document.createElement("os-text-field");return i.setAttribute("name",n),i.setAttribute("label",e),i.setAttribute("value",t),i.value=t,o.required&&i.setAttribute("required",""),o.readonly&&i.setAttribute("readonly",""),o.type&&i.setAttribute("type",o.type),i}function Oo(n,e,t,o,i){const s=o.config,a=document.createElement("div");a.className="os-user-edit__profile";const r=document.createElement("os-form");r.setAttribute("submit-label",u("Save changes")),r.setAttribute("reset-label",u("Revert")),r.setAttribute("columns","auto");const l=document.createElement("div");l.setAttribute("slot","header");let c=lt(e,s);l.appendChild(c),r.appendChild(l),r.appendChild(H("username",u("Username"),e.username,{readonly:!0})),r.appendChild(H("first_name",u("First name"),e.first_name)),r.appendChild(H("last_name",u("Last name"),e.last_name)),r.appendChild(H("nickname",u("Nickname"),e.nickname??"",{required:!0}));const d=document.createElement("os-select");d.setAttribute("name","name"),d.setAttribute("label",u("Display name publicly as")),d.items=Zo(e),d.value=e.name,r.appendChild(d),r.appendChild(H("email",u("Email (required)"),e.email,{required:!0,type:"email"})),r.appendChild(H("url",u("Website"),e.url,{type:"url"}));const p=e.meta??{};for(const[v,E]of Object.entries(s.contactMethods??{}))r.appendChild(H(`meta.${v}`,E,String(p[v]??"")));const h=document.createElement("os-textarea");h.setAttribute("name","description"),h.setAttribute("label",u("Biographical info")),h.setAttribute("placeholder",u("Share a little about yourself — visible on author archives.")),h.setAttribute("rows","4"),h.setAttribute("full-width",""),h.value=e.description,h.setAttribute("value",e.description),r.appendChild(h),r.appendChild(rt("locale",u("Language"),s.locales??{"":u("Site default")},String(e.locale??"")));const b=t===(s.currentUserId??0);if(!b){const v=s.assignableRoles??{},E=Object.keys(v).length>0?v:s.allRoles??{},L=Array.isArray(e.roles)?e.roles[0]??"":"";r.appendChild(rt("roles[0]",u("Role"),E,L))}r.appendChild(st(u("Personal options")));const f=(v,E)=>String(p[v]??E)!=="false";r.appendChild(ie("meta.rich_editing",u("Disable the visual editor when writing"),!f("rich_editing",""),{trueValue:"false",falseValue:"true",fullWidth:!0})),r.appendChild(ie("meta.syntax_highlighting",u("Disable syntax highlighting when editing code"),!f("syntax_highlighting",""),{trueValue:"false",falseValue:"true",fullWidth:!0})),r.appendChild(ie("meta.comment_shortcuts",u("Enable keyboard shortcuts for comment moderation"),String(p.comment_shortcuts??"false")==="true",{fullWidth:!0})),r.appendChild(ie("meta.show_admin_bar_front",u("Show toolbar when viewing site"),f("show_admin_bar_front","true"),{fullWidth:!0}));const x=Fo(s.colorSchemes??{},String(p.admin_color??"fresh"),{livePreview:b});r.appendChild(x),r.appendChild(st(u("Account management")));const _=document.createElement("div");_.setAttribute("full-width",""),_.style.cssText="display:flex;gap:12px;align-items:flex-end;flex-wrap:wrap;";const y=at("password",u("New password"),u("Leave blank to keep the current password."));y.style.flex="1 1 280px",_.appendChild(y);const k=at("password_confirm",u("Confirm new password"),u("Type the new password again."));k.setAttribute("full-width","");const C=document.createElement("os-button");C.setAttribute("variant","ghost"),C.setAttribute("type","button");const N=document.createElement("os-icon");N.setAttribute("name","randomize"),N.setAttribute("size","14"),C.append(N,document.createTextNode(u("Generate strong"))),C.addEventListener("click",v=>{v.preventDefault();const E=ko(18);for(const L of[y,k])L.value=E,L.setAttribute("value",E);je(E),o.toast(u("Password generated and copied to clipboard."),"success")}),_.appendChild(C),r.appendChild(_),r.appendChild(k),r.appendChild(qo(o,t,b)),r.appendChild(Uo(o,t)),r.addEventListener("os-form-reset",()=>x.revert());let M=!1;r.addEventListener("os-form-submit",v=>{Ae(v.detail.values)});const Ae=async v=>{if(M)return;M=!0,r.setBusy(!0),r.clearErrors();const E={first_name:v.first_name,last_name:v.last_name,nickname:v.nickname,name:v.name,email:v.email,url:v.url,description:v.description,locale:v.locale??""};if(typeof v.password=="string"&&v.password!==""){if(String(v.password_confirm??"")!==v.password){r.setError(u("The two password fields do not match.")),r.setFieldInvalid("password_confirm"),M=!1,r.setBusy(!1);return}E.password=v.password}typeof v["roles[0]"]=="string"&&v["roles[0]"]&&(E.roles=[v["roles[0]"]]);const L={};for(const[S,Y]of Object.entries(v))S.startsWith("meta.")&&(L[S.slice(5)]=typeof Y=="boolean"?r.querySelector(`[name="${S}"]`)?.getAttribute("value")??String(Y):Y);Object.keys(L).length>0&&(E.meta=L);let A;try{A=await Zt(o,t,E)}catch(S){A={ok:!1,message:S instanceof Error?S.message:u("Save failed.")}}finally{M=!1,r.setBusy(!1)}if(!A.ok){const S=A.message??Xo(A.error)??u("Save failed.");r.setError(S),o.toast(S,"error");for(const Y of Object.keys(A.fieldErrors??{}))r.setFieldInvalid(Y);x.revert(),console.warn("[user-edit] save failed",{code:A.error,message:A.message});return}o.toast(u("Profile saved."),"success"),typeof L.admin_color=="string"&&x.commit(L.admin_color);for(const S of[y,k])S.value="",S.setAttribute("value","");if(A.user){Object.assign(e,A.user);const S=lt(e,s);c.replaceWith(S),c=S,i.onSaved?.(e)}};a.appendChild(r),n.appendChild(a)}function lt(n,e){const t=document.createElement("div");t.className="os-user-edit__header",t.style.cssText="display:flex;align-items:center;gap:16px;margin:0 0 12px;";const o=document.createElement("os-avatar");o.setAttribute("size","64"),(n.name||n.username)&&o.setAttribute("name",n.name||n.username||""),n.id>0&&o.setAttribute("user-id",String(n.id));const i=n.avatar_urls??{},s=i[96]??i[48]??"";s&&eo(o,s),t.appendChild(o);const a=document.createElement("div");a.style.cssText="min-width:0;display:flex;flex-direction:column;gap:4px;";const r=document.createElement("div");r.style.cssText="font-size:18px;font-weight:600;letter-spacing:-0.01em;",r.textContent=n.name||n.username||`#${n.id}`,a.appendChild(r);const l=document.createElement("div");l.style.cssText="display:flex;align-items:center;gap:6px;font-size:12px;color:var(--os-ui-fg-muted, #50575e);flex-wrap:wrap;";const c=document.createElement("span");c.textContent=`@${n.username}`,l.appendChild(c);const d=nt(Array.isArray(n.roles)?n.roles:[],e);return d.style.justifyContent="flex-start",l.appendChild(d),a.appendChild(l),t.appendChild(a),t}function Zo(n){const e=new Set,t=o=>{const i=o.trim();i!==""&&e.add(i)};return t(n.username),t(n.nickname??""),t(n.first_name),t(n.last_name),(n.first_name||n.last_name)&&(t(`${n.first_name} ${n.last_name}`.trim()),t(`${n.last_name} ${n.first_name}`.trim())),n.name&&t(n.name),Array.from(e).map(o=>({value:o,label:o}))}function Xo(n){switch(n){case"rest_user_invalid_email":case"invalid_email":return u("Email address is not valid.");case"rest_user_email_exists":case"existing_user_email":return u("That email is already in use.");case"rest_user_invalid_role":return u("You are not allowed to assign that role.");default:return null}}function Ko(n,e={}){const t=window.openStationConfig??{},o=new Headers(e.headers);return o.has("Accept")||o.set("Accept","application/json"),t.restNonce&&!o.has("X-WP-Nonce")&&o.set("X-WP-Nonce",t.restNonce),gt(ht(String(t.restRoot??""),n),{credentials:"same-origin",...e,headers:o},{source:"user-profile"})}class ct extends HTMLElement{constructor(){super(...arguments),this._config={},this._fetch=null,this._toast=null,this._shellReady=!1,this._mountedFor=null,this._generation=0,this._scheduled=!1}static get observedAttributes(){return["user-id"]}get config(){return this._config}set config(e){this._config=e??{},this._schedule()}get fetch(){return this._fetch}set fetch(e){this._fetch=e,this._schedule()}get toast(){return this._toast}set toast(e){this._toast=e}connectedCallback(){this._shellReady||(this._shellReady=!0,this.classList.add("os-user-profile"),this.innerHTML=` | |
| 276 | 277 | <div class="os-users__edit-layout" data-os-user-profile-layout> |
| 277 | 278 | <aside class="os-users__edit-aside" data-os-user-profile-aside></aside> |
| 278 | 279 | <main class="os-users__edit-main"> |
| 279 | 280 | <div data-os-user-profile-form></div> |
| @@ -279,5 +280,5 @@ | ||
| 279 | 280 | <div data-os-user-profile-form></div> |
| 280 | 281 | <div class="os-users__edit-activity" data-os-user-profile-activity></div> |
| 281 | 282 | </main> |
| 282 | 283 | </div> |
| 283 | - `),this._schedule()}attributeChangedCallback(e,t,o){e==="user-id"&&t!==o&&this._schedule()}host(){return{config:this._config,fetch:this._fetch??Po,toast:this._toast??Ho}}refreshInsights(){return this._loadInsights(this._generation,!0)}_schedule(){this._scheduled||(this._scheduled=!0,queueMicrotask(()=>{this._scheduled=!1,this._mountIfNeeded()}))}_mountIfNeeded(){if(!this._shellReady||!this.isConnected)return;const e=parseInt(this.getAttribute("user-id")??"0",10);if(!Number.isFinite(e)||e<=0||e===this._mountedFor)return;this._mountedFor=e;const t=++this._generation,o=this.querySelector("[data-os-user-profile-form]");o&&(Io(o,e,this.host(),{onSaved:()=>{t===this._generation&&this.refreshInsights()}}).catch(()=>{}),this._loadInsights(t,!1))}async _loadInsights(e,t){const o=this.querySelector("[data-os-user-profile-aside]"),i=this.querySelector("[data-os-user-profile-activity]"),s=this._mountedFor;if(!(!o||!i||!s)){Ye(o),Ye(i);try{const a=await Ft(this.host(),s,t);if(e!==this._generation)return;xo(o,a,this._config),_o(i,a)}catch(a){if(e!==this._generation)return;Qe(o,a),Qe(i,a)}}}}return typeof customElements<"u"&&!customElements.get("os-user-profile")&&customElements.define("os-user-profile",st),ie.OsUserProfile=st,Object.defineProperty(ie,Symbol.toStringTag,{value:"Module"}),ie}({}); | |
| 284 | + `),this._schedule()}attributeChangedCallback(e,t,o){e==="user-id"&&t!==o&&this._schedule()}host(){return{config:this._config,fetch:this._fetch??Ko,toast:this._toast??(e=>{dt({message:e})})}}refreshInsights(){return this._loadInsights(this._generation,!0)}_schedule(){this._scheduled||(this._scheduled=!0,queueMicrotask(()=>{this._scheduled=!1,this._mountIfNeeded()}))}_mountIfNeeded(){if(!this._shellReady||!this.isConnected)return;const e=parseInt(this.getAttribute("user-id")??"0",10);if(!Number.isFinite(e)||e<=0||e===this._mountedFor)return;this._mountedFor=e;const t=++this._generation,o=this.querySelector("[data-os-user-profile-form]");o&&(Wo(o,e,this.host(),{onSaved:()=>{t===this._generation&&this.refreshInsights()}}).catch(()=>{}),this._loadInsights(t,!1))}async _loadInsights(e,t){const o=this.querySelector("[data-os-user-profile-aside]"),i=this.querySelector("[data-os-user-profile-activity]"),s=this._mountedFor;if(!(!o||!i||!s)){tt(o),tt(i);try{const a=await Xt(this.host(),s,t);if(e!==this._generation)return;zo(o,a,this._config),Io(i,a)}catch(a){if(e!==this._generation)return;ot(o,a),ot(i,a)}}}}return typeof customElements<"u"&&!customElements.get("os-user-profile")&&customElements.define("os-user-profile",ct),se.OsUserProfile=ct,Object.defineProperty(se,Symbol.toStringTag,{value:"Module"}),se}({}); | |