| @@ -1,5 +1,5 @@ | ||
| 1 | -var openStationApp_trash=function(ee){"use strict";const mt="desktop-mode";function be(){return window.wp?.i18n}function u(o,e=mt){return be()?.__(o,e)??o}function K(o,...e){const t=be()?.sprintf;if(t)return t(o,...e);let n=0;return o.replace(/%(?:(\d+)\$)?[sd]/g,(s,i)=>{const r=i?Number.parseInt(i,10)-1:n++;return String(e[r]??"")})}function C(o,...e){return{__wpdHtml:!0,strings:o,values:e}}function bt(o){return!!o&&o.__wpdHtml===!0}const gt="$$wpd$$",y=/\$\$wpd\$\$(\d+)\$\$/g,yt="$$wpd-node$$",kt=/^\$\$wpd-node\$\$(\d+)\$\$$/,_t=new Set(["style","script","textarea","title"]);function vt(o){let e="",t=!1,n=null,s=!1,i=null,r="",a=!1;for(let l=0;l<o.length;l++){const c=o[l];e+=c;for(let d=0;d<c.length;d++){const h=c[d];if(s){c.startsWith("-->",d)&&(s=!1,d+=2);continue}if(i!==null){h==="<"&&c[d+1]==="/"&&c.slice(d+2,d+2+i.length).toLowerCase()===i&&(d+=1+i.length,i=null,t=!0,a=!1,r="");continue}if(n!==null){h===n&&(n=null);continue}if(t){h==='"'||h==="'"?(n=h,a=!1):h===">"?(t=!1,a=!1,_t.has(r)&&(i=r),r=""):a&&(/[a-zA-Z0-9-]/.test(h)?r+=h.toLowerCase():a=!1);continue}if(c.startsWith("<!--",d)){s=!0,d+=3;continue}const p=c[d+1]??"";h==="<"&&/[a-zA-Z/!]/.test(p)&&(t=!0,r="",a=/[a-zA-Z]/.test(p))}l<o.length-1&&(e+=t||s||i!==null?`${gt}${l}$$`:`<!--${yt}${l}$$-->`)}return e}const ge=new WeakMap;function ye(o){const e=ge.get(o);if(e)return e;const t=document.createElement("template");t.innerHTML=vt(o);const n=[],s=(a,l)=>{if(a.nodeType===Node.ELEMENT_NODE){const h=a;for(const p of Array.from(h.attributes)){const m=p.name,f=p.value,k=m[0];if(y.test(f))if(y.lastIndex=0,k==="@"){const g=y.exec(f);y.lastIndex=0,n.push({path:l,kind:"event",name:m.slice(1),valueIndex:g?Number(g[1]):0}),h.removeAttribute(m)}else if(k==="."){const g=y.exec(f);y.lastIndex=0,n.push({path:l,kind:"prop",name:m.slice(1),valueIndex:g?Number(g[1]):0}),h.removeAttribute(m)}else if(k==="?"){const g=y.exec(f);y.lastIndex=0,n.push({path:l,kind:"bool",name:m.slice(1),valueIndex:g?Number(g[1]):0}),h.removeAttribute(m)}else{const g=[],A=[];let S=0,N;for(y.lastIndex=0;(N=y.exec(f))!==null;)g.push(f.slice(S,N.index)),A.push(Number(N[1])),S=N.index+N[0].length;g.push(f.slice(S)),n.push({path:l,kind:"attr",name:m,template:g,valueIndices:A}),h.setAttribute(m,"")}}}const c=Array.from(a.childNodes);let d=0;for(let h=0;h<c.length;h++){const p=c[h],m=h+d;if(p.nodeType===Node.COMMENT_NODE){const f=kt.exec(p.data);if(f){const k=document.createTextNode("");p.parentNode.replaceChild(k,p),n.push({path:[...l,m],kind:"node",valueIndex:Number(f[1])})}continue}if(p.nodeType===Node.TEXT_NODE){const f=p.textContent||"";if(!y.test(f)){y.lastIndex=0;continue}y.lastIndex=0;const k=p.parentNode;let g=0,A;const S=[],N=[];for(y.lastIndex=0;(A=y.exec(f))!==null;){A.index>g&&S.push(document.createTextNode(f.slice(g,A.index)));const me=document.createTextNode("");S.push(me),N.push({path:[...l,m+S.length-1],kind:"node",valueIndex:Number(A[1])}),g=A.index+A[0].length}g<f.length&&S.push(document.createTextNode(f.slice(g)));for(const me of S)k.insertBefore(me,p);k.removeChild(p),d+=S.length-1,n.push(...N)}else s(p,[...l,m])}};s(t.content,[]);const r={template:t,buildParts:a=>{const l=[];for(const c of n){let d=a;for(const h of c.path)d=d.childNodes[h];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 ge.set(o,r),r}const ke=new WeakMap;function wt(o,e){for(const t of o.nodes)if(t.parentNode!==e)return!1;return!0}function z(o,e){const t=ke.get(e);if(t&&t.strings===o.strings&&wt(t,e)){U(t.parts,o.values);return}const n=ye(o.strings),s=n.template.content.cloneNode(!0),i=n.buildParts(s),r=Array.from(s.childNodes);for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(s),U(i,o.values),ke.set(e,{strings:o.strings,parts:i,nodes:r})}function U(o,e){for(const t of o)if(t.kind==="node")G(t.child,e[t.valueIndex]);else if(t.kind==="attr"){let n=t.template[0];for(let s=0;s<t.valueIndices.length;s++)n+=_e(e[t.valueIndices[s]]),n+=t.template[s+1];n!==t.last&&(t.last=n,n===""?t.element.removeAttribute(t.name):t.element.setAttribute(t.name,n))}else if(t.kind==="event"){const n=e[t.valueIndex];n!==t.current&&(t.current&&t.element.removeEventListener(t.name,t.current),n&&t.element.addEventListener(t.name,n),t.current=n)}else if(t.kind==="prop"){const n=e[t.valueIndex];n!==t.last&&(t.last=n,t.element[t.name]=n)}else if(t.kind==="bool"){const n=!!e[t.valueIndex];n!==t.last&&(t.last=n,n?t.element.setAttribute(t.name,""):t.element.removeAttribute(t.name))}}function G(o,e){if(e==null||e===!1){o.state&&(T(o.state),o.state=null);return}if(Array.isArray(e)){Et(o,e);return}if(bt(e)){Ct(o,e);return}if(e instanceof Node){xt(o,e);return}St(o,_e(e))}function xt(o,e){const t=o.state;t?.shape==="node"&&t.node===e||(t&&T(t),D(o,[e]),o.state={shape:"node",node:e})}function St(o,e){const t=o.state;if(t?.shape==="text"){t.text!==e&&(t.node.textContent=e,t.text=e);return}t&&T(t);const n=document.createTextNode(e);D(o,[n]),o.state={shape:"text",node:n,text:e}}function Ct(o,e){const t=o.state;if(t?.shape==="template"&&t.strings===e.strings){U(t.parts,e.values);return}t&&T(t);const n=ye(e.strings),s=n.template.content.cloneNode(!0),i=n.buildParts(s),r=Array.from(s.childNodes);D(o,[s]),U(i,e.values),o.state={shape:"template",strings:e.strings,parts:i,nodes:r}}function Et(o,e){const t=o.state;if(t?.shape==="array"){const s=Math.min(t.entries.length,e.length);for(let i=0;i<s;i++)G(t.entries[i],e[i]);if(e.length<t.entries.length){for(let i=e.length;i<t.entries.length;i++){const r=t.entries[i];r.state&&T(r.state),r.anchor.remove()}t.entries.length=e.length}else for(let i=t.entries.length;i<e.length;i++){const r=document.createTextNode("");D(o,[r]);const a={anchor:r,state:null};G(a,e[i]),t.entries.push(a)}return}t&&T(t);const n=[];for(const s of e){const i=document.createTextNode("");D(o,[i]);const r={anchor:i,state:null};G(r,s),n.push(r)}o.state={shape:"array",entries:n}}function D(o,e){const t=o.anchor.parentNode;if(t)for(const n of e)t.insertBefore(n,o.anchor)}function T(o){if(o.shape==="text"){o.node.remove();return}if(o.shape==="template"){for(const e of o.parts)e.kind==="node"&&e.child.state&&(T(e.child.state),e.child.state=null);for(const e of o.nodes)e.parentNode&&e.parentNode.removeChild(e);return}if(o.shape==="node"){o.node.parentNode&&o.node.parentNode.removeChild(o.node);return}for(const e of o.entries)e.state&&T(e.state),e.anchor.remove()}function _e(o){return o==null||o===!1?"":String(o)}const At="data-os-mode";function ve(o=typeof document<"u"?document.documentElement:null){return!!o&&o.getAttribute(At)==="mobile"}function Tt(o,e=null){const t=e??(typeof document<"u"?document.documentElement:null);if(!!t&&ve(t)){o.hasAttribute("stacked")||o.setAttribute("stacked","");const i=o.getAttribute("sticky-columns");return i!==null&&(o.setAttribute("data-os-sticky-columns",i),o.removeAttribute("sticky-columns")),!0}o.hasAttribute("stacked")&&o.removeAttribute("stacked");const s=o.getAttribute("data-os-sticky-columns");return s!==null&&(o.setAttribute("sticky-columns",s),o.removeAttribute("data-os-sticky-columns")),!1}function Rt(o,e){const t=e.local??{},n={id:o,hasLocal:r=>Object.prototype.hasOwnProperty.call(t,r),runLocal:(r,a,l,c)=>{const d=t[r];if(!d)return a;const h={...a},p=d(h,l,c);return p===void 0?h:p},render:r=>{z(e.view(r),r.root),e.updated?.(r)},mounted:r=>e.mounted?.(r)},{placeholder:s}=e;s&&(n.placeholder=r=>s(r));const i=window;return(i.openStationApps??(i.openStationApps={}))[o]=n,n}const we="__openStationSharedStores";function $t(){const o=window;let e=o[we];return e||(e=new Map,o[we]=e),e}function X(o,e){const t=$t();let n=t.get(o);n||(n={state:e(),listeners:new Set,rebuild:e},t.set(o,n));const s={get state(){return n.state},set state(i){n.state=i},getState(){return n.state},notify(){for(const i of Array.from(n.listeners))try{i(n.state)}catch(r){console.error(`[desktop-mode/shared-store:${o}] subscriber threw:`,r)}},subscribe(i){return n.listeners.add(i),()=>{n.listeners.delete(i)}},setState(i){const r=n.state;if(typeof r!="object"||r===null){console.warn(`[desktop-mode/shared-store:${o}] setState called on a primitive store; use the state setter instead.`);return}Object.assign(r,i),s.notify()},reset(){const i=n.rebuild(),r=n.state;if(typeof r=="object"&&r!==null&&typeof i=="object"&&i!==null){const a=r;for(const l of Object.keys(a))delete a[l];Object.assign(a,i)}else n.state=i;n.listeners.clear()}};return s}const v=X("openstation/trash-optimistic",()=>({changes:new Map,reconcile:new Set})),E=o=>`${o.type}:${o.id}`;function Lt(){return Array.from(v.state.changes.values())}function It(o,e){const t=v.subscribe(o);return e&&v.state.reconcile.add(e),()=>{t(),e&&v.state.reconcile.delete(e)}}function te(o,e="in"){const t=E(o);if(v.state.changes.get(t)?.pending)return null;const n={item:o,direction:e,pending:!0};return v.state.changes.set(t,n),v.notify(),{async finish(s){v.state.changes.get(t)!==n||!n.pending||(n.pending=!1,s&&(v.notify(),await Promise.allSettled(Array.from(v.state.reconcile,async i=>i()))),v.state.changes.get(t)===n&&(v.state.changes.delete(t),v.notify()))}}}function xe(o,e,t="",n=""){const s=new Map(o.map(r=>[E(r),r]));let i=e;for(const{item:r,direction:a}of Lt()){const l=E(r);if(a==="out"){s.delete(l)&&i--;continue}const c=(!t||t===r.type||t==="desktop"&&["placement","shortcut","folder"].includes(r.type))&&(!n||`${r.title} ${r.subtitle}`.toLocaleLowerCase().includes(n.toLocaleLowerCase()));s.has(l)||i++,c&&s.set(l,{...s.get(l)??r,can_restore:!1,can_purge:!1})}return{items:Array.from(s.values()),total:Math.max(0,i)}}const I=class I extends HTMLElement{constructor(){super(),this._renderScheduled=!1,this._propValues={},this.constructor.shadow?(this.attachShadow({mode:"open"}),this._renderRoot=this.shadowRoot):this._renderRoot=this,this._installPropAccessors()}static get observedAttributes(){return this.props.map(Ce)}connectedCallback(){this._adoptStyles(),this.requestUpdate()}attributeChangedCallback(e,t,n){if(t===n)return;const s=Nt(e);this._propValues[s]=n,this.requestUpdate()}get classNames(){return Array.from(this.classList)}set classNames(e){if(e==null){this.removeAttribute("class");return}const n=(Array.isArray(e)?e:String(e).split(/\s+/)).map(s=>String(s).trim()).filter(s=>s!=="");this.className=n.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 n=Ce(t);Object.defineProperty(this,t,{get:()=>t in this._propValues?this._propValues[t]:this.getAttribute(n),set:s=>{let i;s==null||s===!1?i=null:s===!0?i="":i=String(s),this._propValues[t]=i,i===null?this.removeAttribute(n):this.setAttribute(n,i),this.requestUpdate()},enumerable:!0,configurable:!0})}}_scheduleRender(){this._renderScheduled||!this.isConnected||(this._renderScheduled=!0,queueMicrotask(()=>{this._renderScheduled=!1,this.isConnected&&z(this.render(),this._renderRoot)}))}_adoptStyles(){const e=this.constructor;if(e.styles.length!==0)if(e.shadow&&this.shadowRoot){const t=e.styles.map(n=>n.sheet).filter(n=>n!==null);if(this.shadowRoot.adoptedStyleSheets=t,t.length!==e.styles.length){for(const n of e.styles)if(!n.sheet){const s=document.createElement("style");s.textContent=n.cssText,this.shadowRoot.appendChild(s)}}}else this._adoptLightStyles(e)}_adoptLightStyles(e){if(!I._lightStylesAdopted.has(e)){I._lightStylesAdopted.add(e);for(const t of e.styles){const n=document.createElement("style");n.dataset.osUi=this.tagName.toLowerCase(),n.textContent=t.cssText,document.head.appendChild(n)}}}};I.props=[],I.styles=[],I.shadow=!0,I._lightStylesAdopted=new WeakSet;let Y=I;function Se(o,e){customElements.get(o)||customElements.define(o,e)}function Ce(o){return o.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function Nt(o){return o.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}const Ot=(()=>{try{return typeof new CSSStyleSheet().replaceSync=="function"}catch{return!1}})();function _(o,...e){let t=o[0];for(let n=1;n<o.length;n++){const s=e[n-1];if(typeof s=="string"||typeof s=="number")t+=String(s);else if(s&&s.__wpdCss)t+=s.cssText;else throw new TypeError("[os-ui] css`` interpolations must be strings, numbers, or other css`` results. Got: "+typeof s);t+=o[n]}if(Ot){const n=new CSSStyleSheet;return n.replaceSync(t),{__wpdCss:!0,sheet:n,cssText:t}}return{__wpdCss:!0,sheet:null,cssText:t}}const Ee=_`: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 ) )}`,Mt=_` .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%}}`,Pt=_` .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%}}`,Ht=_` .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}}`,zt=_` .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}}`,Dt=_` .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}}`,jt=_` .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%}}`,Wt=_` .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}}`,Ft=_` 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}}`,Ae=_` 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}}`,qt=_` @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}}`;_` ${Ee} ${Mt} ${Pt} ${Ht} ${zt} ${Dt} ${jt} ${Wt} ${Ft} ${Ae} ${qt} `;const Bt=_` ${Ee} ${Ae}:host{display:block;--_bg:var( --os-ui-table-bg,var( --os-ui-surface,#fff ) );--_border:var( --os-ui-table-border,var( --os-ui-border,rgba( 0,0,0,0.08 ) ) );--_column-border:var( --os-ui-table-column-border,var( --os-ui-border-strong,rgba( 0,0,0,0.14 ) ) );--_header-bg:var( --os-ui-table-header-bg,var( --os-ui-surface-elevated,#f6f7f7 ) );--_row-hover:var( --os-ui-table-row-hover,var( --os-ui-hover,rgba( 0,0,0,0.04 ) ) );--_stripe:var( --os-ui-table-stripe,var( --os-ui-surface-subtle,rgba( 0,0,0,0.03 ) ) );--_cell-padding:var( --os-ui-table-cell-padding,8px 12px );--_font-size:var( --os-ui-table-font-size,13px );--_max-height:var( --os-ui-table-max-height,none );font-size:var( --_font-size );color:inherit}:host( [ hidden ] ){display:none}.scroll{position:relative;overflow:auto;max-height:var( --_max-height );border:1px solid var( --_border );border-radius:4px;background:var( --_bg )}table{width:100%;border-collapse:separate;border-spacing:0;background:var( --_bg )}thead th{text-align:start;font-weight:600;background-color:var( --_header-bg );background-image:var( --os-ui-table-header-bg-image,none );background-repeat:var( --os-ui-table-header-bg-image-repeat,repeat );background-size:var( --os-ui-table-header-bg-image-size,auto );background-position:var( --os-ui-table-header-bg-image-position,center );padding:var( --_cell-padding );border-bottom:1px solid var( --_border );white-space:nowrap}tbody td{padding:var( --_cell-padding );border-bottom:1px solid var( --_border );background-color:var( --_bg );vertical-align:middle}tbody tr:last-child td{border-bottom:0}:host( [ striped ] ) tbody tr:nth-child( odd ) td{background-image:linear-gradient( var( --_stripe ),var( --_stripe ) )}:host( [ hover ] ) tbody tr:hover td{background-image:linear-gradient( var( --_row-hover ),var( --_row-hover ) )}:host( [ hover ][ striped ] ) tbody tr:nth-child( odd ):hover td{background-image:linear-gradient( var( --_row-hover ),var( --_row-hover ) ),linear-gradient( var( --_stripe ),var( --_stripe ) )}:host( [ compact ] ){--os-ui-table-cell-padding:4px 8px;--os-ui-table-font-size:12px}:host( [ bordered ] ) thead th,:host( [ bordered ] ) tbody td{border-inline-end:1px solid var( --_column-border )}:host( [ bordered ] ) thead th:last-child,:host( [ bordered ] ) tbody td:last-child{border-inline-end:0}th.is-sticky,td.is-sticky{position:sticky;z-index:10}tbody td.is-sticky{background-color:var( --_bg )}thead th.is-sticky{background-color:var( --_header-bg );background-image:var( --os-ui-table-header-bg-image,none );background-repeat:var( --os-ui-table-header-bg-image-repeat,repeat );background-size:var( --os-ui-table-header-bg-image-size,auto );background-position:var( --os-ui-table-header-bg-image-position,center );z-index:30}:host( [ sticky-header ] ) thead th{position:sticky;top:0;z-index:20}:host( [ sticky-header ] ) thead tr.filter-row th{top:var( --os-ui-table-header-height,33px );z-index:20}:host( [ sticky-header ] ) thead th.is-sticky{z-index:40}:host( [ sticky-header ] ) thead tr.filter-row th.is-sticky{z-index:40}th.is-sticky-edge,td.is-sticky-edge{border-inline-end:var( --os-ui-table-sticky-edge,2px solid var( --_border ) )}.align-center{text-align:center}.align-end{text-align:end}.filter-row th{padding:4px 8px;background-color:var( --_header-bg );background-image:var( --os-ui-table-header-bg-image,none );background-repeat:var( --os-ui-table-header-bg-image-repeat,repeat );background-size:var( --os-ui-table-header-bg-image-size,auto );background-position:var( --os-ui-table-header-bg-image-position,center );border-bottom:1px solid var( --_border );font-weight:400}.filter-input,.filter-select{width:100%;min-width:60px;box-sizing:border-box;padding:4px 6px;font:inherit;color:inherit;background-color:var( --_bg );border:1px solid var( --_border );border-radius:3px}.filter-input:focus,.filter-select:focus{outline:none;border-color:var( --os-ui-accent,#2271b1 );box-shadow:var( --_holo-focus-field )}.expander{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;padding:0;border:0;background:transparent;color:inherit;cursor:pointer;border-radius:3px;font-size:11px;line-height:1}.expander:hover{background:var( --os-ui-hover,rgba( 0,0,0,0.06 ) )}td.col-expander,th.col-expander{width:36px;min-width:36px;padding-left:0;padding-right:0;text-align:center}tr.subtable td{padding:0;background-color:var( --_bg );background-image:linear-gradient( var( --_stripe ),var( --_stripe ) );border-bottom:1px solid var( --_border )}tr.subtable .subtable-inner{padding:8px 12px 8px 32px}tr.empty td{padding:24px;text-align:center;color:var( --os-ui-text-muted,var( --os-ui-fg-muted,rgba( 0,0,0,0.55 ) ) );font-style:italic}thead th.is-sortable{cursor:pointer;user-select:none}thead th.is-sortable:hover{background-image:linear-gradient( var( --_row-hover ),var( --_row-hover ) )}thead th.is-sortable:focus-visible{outline:none;box-shadow:inset 0 0 0 2px var( --os-ui-accent,#2271b1 )}.sort-indicator{font-size:10px;color:var( --os-ui-text-muted,var( --os-ui-fg-muted,rgba( 0,0,0,0.55 ) ) );margin-inline-start:2px}thead th.sort-asc .sort-indicator,thead th.sort-desc .sort-indicator{color:var( --wp-admin-theme-color,#2271b1 )}td.col-select,th.col-select{width:40px;min-width:40px;padding-left:0;padding-right:0;text-align:center}.select-all-checkbox,.select-row-checkbox{cursor:pointer;margin:0}tbody tr.is-selected td{background-color:color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 10%,var( --_bg ) );background-image:none}tbody tr.is-selected:hover td{background-color:color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 16%,var( --_bg ) )}tbody tr.is-selected td:first-child{box-shadow:inset 3px 0 0 0 var( --os-ui-accent,#2271b1 )}tbody:dir( rtl ) tr.is-selected td:first-child{box-shadow:inset -3px 0 0 0 var( --os-ui-accent,#2271b1 )}:host( [ stacked ] ) .scroll{border:0;border-radius:0}:host( [ stacked ] ) table,:host( [ stacked ] ) tbody{display:block;width:100%}:host( [ stacked ] ) colgroup,:host( [ stacked ] ) thead{display:none}:host( [ stacked ] ) tbody tr{display:flex;align-items:flex-start;gap:12px;padding:12px 14px;border-bottom:1px solid var( --_border );background-color:var( --_bg )}:host( [ stacked ] ) tbody tr:last-child{border-bottom:0}:host( [ stacked ] ) tbody td{display:block;padding:0;border:0;background-color:transparent;background-image:none;box-shadow:none;min-width:0;width:auto;vertical-align:baseline}:host( [ stacked ] ) tbody tr.is-selected td,:host( [ stacked ] ) tbody tr.is-selected:hover td,:host( [ stacked ][ striped ] ) tbody tr:nth-child( odd ) td,:host( [ stacked ][ hover ] ) tbody tr:hover td,:host( [ stacked ][ hover ][ striped ] ) tbody tr:nth-child( odd ):hover td,:host( [ stacked ][ bordered ] ) tbody td{padding:0;border:0;background-color:transparent;background-image:none;box-shadow:none}:host( [ stacked ][ hover ] ) tbody tr:hover{background-image:linear-gradient( var( --_row-hover ),var( --_row-hover ) )}:host( [ stacked ] ) tbody tr.is-selected,:host( [ stacked ] ) tbody tr.is-selected:hover{background-color:color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 10%,var( --_bg ) );background-image:none;box-shadow:inset 3px 0 0 0 var( --os-ui-accent,#2271b1 )}:host( [ stacked ] ) tbody:dir( rtl ) tr.is-selected{box-shadow:inset -3px 0 0 0 var( --os-ui-accent,#2271b1 )}:host( [ stacked ] ) tbody td.col-select,:host( [ stacked ] ) tbody td.col-expander{flex:0 0 auto;display:flex;align-items:center;justify-content:center;min-width:0}:host( [ stacked ] ) tbody td.col-select{width:44px;height:44px;margin:-11px 0 -11px -11px;cursor:pointer}:host( [ stacked ] ) .select-row-checkbox{width:22px;height:22px}:host( [ stacked ] ) tbody td.col-expander{width:28px;height:22px;margin-inline-start:-4px}:host( [ stacked ] ) tbody td.stack-body{flex:1 1 auto;display:flex;flex-direction:column;gap:4px;min-width:0}.stack-cell{display:flex;align-items:baseline;gap:6px;min-width:0;line-height:1.4}.stack-title{font-size:15px;font-weight:600;line-height:1.35}.stack-meta{font-size:13px}.stack-label{flex:0 0 auto;font-size:12px;color:var( --os-ui-text-muted,var( --os-ui-fg-muted,rgba( 0,0,0,0.55 ) ) )}.stack-label::after{content:'ยท';margin-inline-start:6px}.stack-value{flex:1 1 auto;min-width:0;display:flex;align-items:center;flex-wrap:wrap;gap:6px}.stack-actions{margin-block-start:6px}.stack-actions .stack-value{gap:8px}.stack-actions .stack-value>*{justify-content:flex-start;max-width:100%}:host( [ stacked ] ) tr.subtable,:host( [ stacked ] ) tr.empty{display:block;padding:0}:host( [ stacked ] ) tr.subtable td{background-image:linear-gradient( var( --_stripe ),var( --_stripe ) )}:host( [ stacked ] ) tr.subtable .subtable-inner{padding:8px 14px 12px}:host( [ stacked ] ) tr.empty td{padding:24px}:host( [ stacked ] ) tr.skeleton{display:block;padding:14px;border-bottom:1px solid var( --_border )}:host( [ stacked ] ) tr.skeleton td.stack-body{gap:8px}:host( [ stacked ] ) tr.skeleton .skeleton-bar:first-child{height:15px}tbody tr.skeleton td{padding:var( --_cell-padding )}.skeleton-bar{display:block;height:12px;border-radius:3px;background:linear-gradient( 90deg,var( --os-ui-table-skeleton-color,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) ) 0%,var( --os-ui-table-skeleton-highlight,var( --os-ui-hover,rgba( 0,0,0,0.14 ) ) ) 50%,var( --os-ui-table-skeleton-color,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) ) 100% );background-size:200% 100%;animation:os-table-skeleton-pulse 1.4s ease-in-out infinite}@keyframes os-table-skeleton-pulse{0%{background-position:200% 50%}100%{background-position:-200% 50%}}@media ( prefers-reduced-motion:reduce ){.skeleton-bar{animation:none}}`,O="__wpd_expander__",M="__wpd_select__",B=class B extends Y{constructor(){super(...arguments),this._data=[],this._columns=[],this._filters={},this._expanded=new Set,this._subTable=null,this._sort=null,this._selection=new Set,this._getRowId=(e,t)=>t,this._filterCache=new Map,this._paintScheduled=!1,this._stacked=!1,this._stickyHeaderWarned=!1,this._stickyRaceWarned=!1,this._resizeObserver=null,this._stickyMicroScheduled=!1,this._stickyRafHandle=null,this._loadingDesyncWarned=!1,this._lastStickyIndex=-1}get data(){return this._data}set data(e){this._data=Array.isArray(e)?e.slice():[],this._expanded.clear(),this._schedulePaint()}get columns(){return this._columns}set columns(e){this._columns=Array.isArray(e)?e.slice():[];const t=new Set(this._columns.map(n=>n.key));for(const n of Object.keys(this._filters))t.has(n)||delete this._filters[n];for(const n of Array.from(this._filterCache.keys()))t.has(n)||this._filterCache.delete(n);this._sort&&!t.has(this._sort.key)&&(this._sort=null),this._schedulePaint()}get filters(){return{...this._filters}}set filters(e){this._filters=e?{...e}:{},this._schedulePaint()}get sort(){return this._sort?{...this._sort}:null}set sort(e){this._sort=e?{...e}:null,this._schedulePaint()}get selection(){return new Set(this._selection)}set selection(e){this._selection=new Set(e??[]),this._schedulePaint()}get selectedRows(){const e=[];return this._data.forEach((t,n)=>{this._selection.has(this._getRowId(t,n))&&e.push(t)}),e}get visibleRows(){return this._filteredRows().map(e=>e.row)}get getRowId(){return this._getRowId}set getRowId(e){this._getRowId=typeof e=="function"?e:(t,n)=>n,this._schedulePaint()}get subTable(){return this._subTable}set subTable(e){this._subTable=typeof e=="function"?e:null,this._expanded.clear(),this._schedulePaint()}get expanded(){return new Set(this._expanded)}set expanded(e){this._expanded=new Set(e??[]),this._schedulePaint()}expand(e){e<0||e>=this._data.length||this._expanded.has(e)||(this._expanded.add(e),this.emit("os-table-expand-change",{row:this._data[e],index:e,expanded:!0}),this._schedulePaint())}collapse(e){this._expanded.has(e)&&(this._expanded.delete(e),this.emit("os-table-expand-change",{row:this._data[e],index:e,expanded:!1}),this._schedulePaint())}expandAll(){if(!this._subTable)return;let e=!1;for(let t=0;t<this._data.length;t++)this._subTable(this._data[t],t)&&(this._expanded.has(t)||(this._expanded.add(t),e=!0));e&&this._schedulePaint()}collapseAll(){this._expanded.size!==0&&(this._expanded.clear(),this._schedulePaint())}isExpanded(e){return this._expanded.has(e)}clearFilters(){Object.keys(this._filters).length!==0&&(this._filters={},this.emit("os-table-filter-change",{filters:{}}),this._schedulePaint())}clearSort(){this._sort!==null&&(this._sort=null,this.emit("os-table-sort-change",{sort:null}),this._schedulePaint())}select(e){if(this._selection.has(e))return;const t=this._readSelectable(),n=t==="single"?Array.from(this._selection):[];t==="single"&&this._selection.clear(),this._selection.add(e),this._emitSelectionChange(),this._syncSelectionDom([e,...n])}deselect(e){this._selection.delete(e)&&(this._emitSelectionChange(),this._syncSelectionDom([e]))}selectAll(){if(this._readSelectable()==="multi"){for(const{row:e,index:t}of this._filteredRows())this._selection.add(this._getRowId(e,t));this._emitSelectionChange(),this._syncSelectionDom("all")}}clearSelection(){this._selection.size!==0&&(this._selection.clear(),this._emitSelectionChange(),this._syncSelectionDom("all"))}_syncSelectionDom(e){const t=this.shadowRoot;if(!t)return;const n=t.querySelector("tbody");if(!n)return;let s=null;if(e!=="all"){s=new Set;for(const a of e)s.add(String(a))}const i=n.querySelectorAll("tr[data-row-id]");for(const a of i){const l=a.dataset.rowId;if(l===void 0||s&&!s.has(l))continue;const c=Number(a.dataset.rowIndex);if(!Number.isFinite(c))continue;const d=this._data[c];if(d===void 0)continue;const h=this._getRowId(d,c),p=this._selection.has(h);a.classList.toggle("is-selected",p);const m=a.querySelector("input.select-row-checkbox");m&&m.checked!==p&&(m.checked=p)}const r=t.querySelector("thead .select-all-checkbox");if(r){const{total:a,selected:l}=this._visibleSelectionStats();r.checked=a>0&&l===a,r.indeterminate=l>0&&l<a}}scrollToRow(e){const t=this.shadowRoot;if(!t)return;const s=t.querySelectorAll("tbody tr:not(.subtable):not(.empty):not(.skeleton)")[e];s&&s.scrollIntoView({block:"nearest",inline:"nearest"})}connectedCallback(){super.connectedCallback(),this._schedulePaint()}disconnectedCallback(){this._resizeObserver?.disconnect(),this._resizeObserver=null,this._stickyRafHandle!==null&&typeof cancelAnimationFrame<"u"&&(cancelAnimationFrame(this._stickyRafHandle),this._stickyRafHandle=null)}recomputeLayout(){this._applyStickyOffsets(),this._measureHeaderHeight()}render(){return C` | |
| 1 | +var openStationApp_trash=function(te){"use strict";const we="desktop-mode";function oe(){return window.wp?.i18n}function h(t,e=we){return oe()?.__(t,e)??t}function se(t,e,o,s=we){return oe()?._n(t,e,o,s)??(o===1?t:e)}function C(t,...e){const o=oe()?.sprintf;if(o)return o(t,...e);let s=0;return t.replace(/%(?:(\d+)\$)?[sd]/g,(n,r)=>{const i=r?Number.parseInt(r,10)-1:s++;return String(e[i]??"")})}function E(t,...e){return{__wpdHtml:!0,strings:t,values:e}}function Et(t){return!!t&&t.__wpdHtml===!0}const At="$$wpd$$",y=/\$\$wpd\$\$(\d+)\$\$/g,Tt="$$wpd-node$$",Rt=/^\$\$wpd-node\$\$(\d+)\$\$$/,$t=new Set(["style","script","textarea","title"]);function Lt(t){let e="",o=!1,s=null,n=!1,r=null,i="",a=!1;for(let l=0;l<t.length;l++){const c=t[l];e+=c;for(let d=0;d<c.length;d++){const u=c[d];if(n){c.startsWith("-->",d)&&(n=!1,d+=2);continue}if(r!==null){u==="<"&&c[d+1]==="/"&&c.slice(d+2,d+2+r.length).toLowerCase()===r&&(d+=1+r.length,r=null,o=!0,a=!1,i="");continue}if(s!==null){u===s&&(s=null);continue}if(o){u==='"'||u==="'"?(s=u,a=!1):u===">"?(o=!1,a=!1,$t.has(i)&&(r=i),i=""):a&&(/[a-zA-Z0-9-]/.test(u)?i+=u.toLowerCase():a=!1);continue}if(c.startsWith("<!--",d)){n=!0,d+=3;continue}const f=c[d+1]??"";u==="<"&&/[a-zA-Z/!]/.test(f)&&(o=!0,i="",a=/[a-zA-Z]/.test(f))}l<t.length-1&&(e+=o||n||r!==null?`${At}${l}$$`:`<!--${Tt}${l}$$-->`)}return e}const xe=new WeakMap;function Se(t){const e=xe.get(t);if(e)return e;const o=document.createElement("template");o.innerHTML=Lt(t);const s=[],n=(a,l)=>{if(a.nodeType===Node.ELEMENT_NODE){const u=a;for(const f of Array.from(u.attributes)){const m=f.name,p=f.value,_=m[0];if(y.test(p))if(y.lastIndex=0,_==="@"){const g=y.exec(p);y.lastIndex=0,s.push({path:l,kind:"event",name:m.slice(1),valueIndex:g?Number(g[1]):0}),u.removeAttribute(m)}else if(_==="."){const g=y.exec(p);y.lastIndex=0,s.push({path:l,kind:"prop",name:m.slice(1),valueIndex:g?Number(g[1]):0}),u.removeAttribute(m)}else if(_==="?"){const g=y.exec(p);y.lastIndex=0,s.push({path:l,kind:"bool",name:m.slice(1),valueIndex:g?Number(g[1]):0}),u.removeAttribute(m)}else{const g=[],T=[];let S=0,N;for(y.lastIndex=0;(N=y.exec(p))!==null;)g.push(p.slice(S,N.index)),T.push(Number(N[1])),S=N.index+N[0].length;g.push(p.slice(S)),s.push({path:l,kind:"attr",name:m,template:g,valueIndices:T}),u.setAttribute(m,"")}}}const c=Array.from(a.childNodes);let d=0;for(let u=0;u<c.length;u++){const f=c[u],m=u+d;if(f.nodeType===Node.COMMENT_NODE){const p=Rt.exec(f.data);if(p){const _=document.createTextNode("");f.parentNode.replaceChild(_,f),s.push({path:[...l,m],kind:"node",valueIndex:Number(p[1])})}continue}if(f.nodeType===Node.TEXT_NODE){const p=f.textContent||"";if(!y.test(p)){y.lastIndex=0;continue}y.lastIndex=0;const _=f.parentNode;let g=0,T;const S=[],N=[];for(y.lastIndex=0;(T=y.exec(p))!==null;){T.index>g&&S.push(document.createTextNode(p.slice(g,T.index)));const ve=document.createTextNode("");S.push(ve),N.push({path:[...l,m+S.length-1],kind:"node",valueIndex:Number(T[1])}),g=T.index+T[0].length}g<p.length&&S.push(document.createTextNode(p.slice(g)));for(const ve of S)_.insertBefore(ve,f);_.removeChild(f),d+=S.length-1,s.push(...N)}else n(f,[...l,m])}};n(o.content,[]);const i={template:o,buildParts:a=>{const l=[];for(const c of s){let d=a;for(const u of c.path)d=d.childNodes[u];c.kind==="node"?l.push({kind:"node",valueIndex:c.valueIndex,child:{anchor:d,state:null}}):c.kind==="attr"?l.push({kind:"attr",element:d,name:c.name,template:c.template,valueIndices:c.valueIndices}):c.kind==="event"?l.push({kind:"event",valueIndex:c.valueIndex,element:d,name:c.name}):c.kind==="prop"?l.push({kind:"prop",valueIndex:c.valueIndex,element:d,name:c.name}):c.kind==="bool"&&l.push({kind:"bool",valueIndex:c.valueIndex,element:d,name:c.name})}return l}};return xe.set(t,i),i}const Ce=new WeakMap;function It(t,e){for(const o of t.nodes)if(o.parentNode!==e)return!1;return!0}function D(t,e){const o=Ce.get(e);if(o&&o.strings===t.strings&&It(o,e)){U(o.parts,t.values);return}const s=Se(t.strings),n=s.template.content.cloneNode(!0),r=s.buildParts(n),i=Array.from(n.childNodes);for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(n),U(r,t.values),Ce.set(e,{strings:t.strings,parts:r,nodes:i})}function U(t,e){for(const o of t)if(o.kind==="node")G(o.child,e[o.valueIndex]);else if(o.kind==="attr"){let s=o.template[0];for(let n=0;n<o.valueIndices.length;n++)s+=Ee(e[o.valueIndices[n]]),s+=o.template[n+1];s!==o.last&&(o.last=s,s===""?o.element.removeAttribute(o.name):o.element.setAttribute(o.name,s))}else if(o.kind==="event"){const s=e[o.valueIndex];s!==o.current&&(o.current&&o.element.removeEventListener(o.name,o.current),s&&o.element.addEventListener(o.name,s),o.current=s)}else if(o.kind==="prop"){const s=e[o.valueIndex];s!==o.last&&(o.last=s,o.element[o.name]=s)}else if(o.kind==="bool"){const s=!!e[o.valueIndex];s!==o.last&&(o.last=s,s?o.element.setAttribute(o.name,""):o.element.removeAttribute(o.name))}}function G(t,e){if(e==null||e===!1){t.state&&(R(t.state),t.state=null);return}if(Array.isArray(e)){Pt(t,e);return}if(Et(e)){Ot(t,e);return}if(e instanceof Node){Mt(t,e);return}Nt(t,Ee(e))}function Mt(t,e){const o=t.state;o?.shape==="node"&&o.node===e||(o&&R(o),j(t,[e]),t.state={shape:"node",node:e})}function Nt(t,e){const o=t.state;if(o?.shape==="text"){o.text!==e&&(o.node.textContent=e,o.text=e);return}o&&R(o);const s=document.createTextNode(e);j(t,[s]),t.state={shape:"text",node:s,text:e}}function Ot(t,e){const o=t.state;if(o?.shape==="template"&&o.strings===e.strings){U(o.parts,e.values);return}o&&R(o);const s=Se(e.strings),n=s.template.content.cloneNode(!0),r=s.buildParts(n),i=Array.from(n.childNodes);j(t,[n]),U(r,e.values),t.state={shape:"template",strings:e.strings,parts:r,nodes:i}}function Pt(t,e){const o=t.state;if(o?.shape==="array"){const n=Math.min(o.entries.length,e.length);for(let r=0;r<n;r++)G(o.entries[r],e[r]);if(e.length<o.entries.length){for(let r=e.length;r<o.entries.length;r++){const i=o.entries[r];i.state&&R(i.state),i.anchor.remove()}o.entries.length=e.length}else for(let r=o.entries.length;r<e.length;r++){const i=document.createTextNode("");j(t,[i]);const a={anchor:i,state:null};G(a,e[r]),o.entries.push(a)}return}o&&R(o);const s=[];for(const n of e){const r=document.createTextNode("");j(t,[r]);const i={anchor:r,state:null};G(i,n),s.push(i)}t.state={shape:"array",entries:s}}function j(t,e){const o=t.anchor.parentNode;if(o)for(const s of e)o.insertBefore(s,t.anchor)}function R(t){if(t.shape==="text"){t.node.remove();return}if(t.shape==="template"){for(const e of t.parts)e.kind==="node"&&e.child.state&&(R(e.child.state),e.child.state=null);for(const e of t.nodes)e.parentNode&&e.parentNode.removeChild(e);return}if(t.shape==="node"){t.node.parentNode&&t.node.parentNode.removeChild(t.node);return}for(const e of t.entries)e.state&&R(e.state),e.anchor.remove()}function Ee(t){return t==null||t===!1?"":String(t)}const Ht="data-os-mode";function Ae(t=typeof document<"u"?document.documentElement:null){return!!t&&t.getAttribute(Ht)==="mobile"}function zt(t,e=null){const o=e??(typeof document<"u"?document.documentElement:null);if(!!o&&Ae(o)){t.hasAttribute("stacked")||t.setAttribute("stacked","");const r=t.getAttribute("sticky-columns");return r!==null&&(t.setAttribute("data-os-sticky-columns",r),t.removeAttribute("sticky-columns")),!0}t.hasAttribute("stacked")&&t.removeAttribute("stacked");const n=t.getAttribute("data-os-sticky-columns");return n!==null&&(t.setAttribute("sticky-columns",n),t.removeAttribute("data-os-sticky-columns")),!1}function Dt(t,e){const o=e.local??{},s={id:t,hasLocal:i=>Object.prototype.hasOwnProperty.call(o,i),runLocal:(i,a,l,c)=>{const d=o[i];if(!d)return a;const u={...a},f=d(u,l,c);return f===void 0?u:f},render:i=>{D(e.view(i),i.root),e.updated?.(i)},mounted:i=>e.mounted?.(i)},{placeholder:n}=e;n&&(s.placeholder=i=>n(i));const r=window;return(r.openStationApps??(r.openStationApps={}))[t]=s,s}class Te extends Error{constructor(e,o){super(e||o.serverMessage||`HTTP ${o.status}`),this.name="RestError",this.status=o.status,this.code=o.code,this.data=o.data,this.serverMessage=o.serverMessage??""}}function Re(t){return t instanceof Te}function jt(t){const e=typeof t=="object"&&t!==null?t:void 0;return{code:typeof e?.code=="string"?e.code:void 0,data:e?.data,serverMessage:typeof e?.message=="string"?e.message:""}}function Ft(t,e,o=""){return new Te(o,{status:t,...jt(e)})}async function $e(t,e=""){let o=null;try{o=await t.json()}catch{o=null}return Ft(t.status,o,e)}const Wt="rest_cookie_invalid_nonce",Le=()=>h("Could not reach the site. Check your connection and try again.","desktop-mode");function Ie(t){return typeof navigator<"u"&&navigator.onLine===!1?!0:t instanceof TypeError}function qt(t){return Re(t)?t.code===Wt||t.status===401?"session":t.status>=200&&t.status<300?"unreadable":t.status===404?"gone":t.status>=500?"server":t.status>=400?"refused":"unknown":Ie(t)?"offline":"unknown"}function Bt(t){return Re(t)?t.serverMessage:Ie(t)?Le():t instanceof Error?t.message:""}function Vt(t,e){const{fallback:o,lead:s}=e,n=qt(t),r=n==="offline"||n==="unreadable"?"warning":"error";let i="",a=!0;switch(n){case"offline":i=Le();break;case"session":i=h("Your session has expired. Reload the page and try again.","desktop-mode");break;case"unreadable":i=h("The site sent an unreadable reply. Reload the page to check whether the change went through.","desktop-mode");break;case"gone":case"refused":case"server":{const c=t;c.serverMessage?i=c.serverMessage:n==="gone"?(i=h("It no longer exists. Reload the page to catch up.","desktop-mode"),a=!1):n==="server"?(i=C(h("The server answered with error %d.","desktop-mode"),c.status),a=!1):(i=C(h("The server refused the request (HTTP %d).","desktop-mode"),c.status),a=!1);break}case"unknown":default:i=Bt(t);break}let l;return s?l=i?`${s}: ${i}`:o:i?a?l=i:l=`${o} ${i}`:l=o,{message:l,reason:i,kind:n,type:r}}function ne(t,e,o){if(!t)return;const{duration:s,...n}=o,r=Vt(e,n),i={message:r.message,type:r.type};s&&(i.duration=s),t(i)}const Me="__openStationSharedStores";function Kt(){const t=window;let e=t[Me];return e||(e=new Map,t[Me]=e),e}function X(t,e){const o=Kt();let s=o.get(t);s||(s={state:e(),listeners:new Set,rebuild:e},o.set(t,s));const n={get state(){return s.state},set state(r){s.state=r},getState(){return s.state},notify(){for(const r of Array.from(s.listeners))try{r(s.state)}catch(i){console.error(`[desktop-mode/shared-store:${t}] subscriber threw:`,i)}},subscribe(r){return s.listeners.add(r),()=>{s.listeners.delete(r)}},setState(r){const i=s.state;if(typeof i!="object"||i===null){console.warn(`[desktop-mode/shared-store:${t}] setState called on a primitive store; use the state setter instead.`);return}Object.assign(i,r),n.notify()},reset(){const r=s.rebuild(),i=s.state;if(typeof i=="object"&&i!==null&&typeof r=="object"&&r!==null){const a=i;for(const l of Object.keys(a))delete a[l];Object.assign(a,r)}else s.state=r;s.listeners.clear()}};return n}const v=X("openstation/trash-optimistic",()=>({changes:new Map,reconcile:new Set})),A=t=>`${t.type}:${t.id}`;function Ut(){return Array.from(v.state.changes.values())}function Gt(t,e){const o=v.subscribe(t);return e&&v.state.reconcile.add(e),()=>{o(),e&&v.state.reconcile.delete(e)}}function re(t,e="in"){const o=A(t);if(v.state.changes.get(o)?.pending)return null;const s={item:t,direction:e,pending:!0};return v.state.changes.set(o,s),v.notify(),{async finish(n){v.state.changes.get(o)!==s||!s.pending||(s.pending=!1,n&&(v.notify(),await Promise.allSettled(Array.from(v.state.reconcile,async r=>r()))),v.state.changes.get(o)===s&&(v.state.changes.delete(o),v.notify()))}}}function Ne(t,e,o="",s=""){const n=new Map(t.map(i=>[A(i),i]));let r=e;for(const{item:i,direction:a}of Ut()){const l=A(i);if(a==="out"){n.delete(l)&&r--;continue}const c=(!o||o===i.type||o==="desktop"&&["placement","shortcut","folder"].includes(i.type))&&(!s||`${i.title} ${i.subtitle}`.toLocaleLowerCase().includes(s.toLocaleLowerCase()));n.has(l)||r++,c&&n.set(l,{...n.get(l)??i,can_restore:!1,can_purge:!1})}return{items:Array.from(n.values()),total:Math.max(0,r)}}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(Pe)}connectedCallback(){this._adoptStyles(),this.requestUpdate()}attributeChangedCallback(e,o,s){if(o===s)return;const n=Xt(e);this._propValues[n]=s,this.requestUpdate()}get classNames(){return Array.from(this.classList)}set classNames(e){if(e==null){this.removeAttribute("class");return}const s=(Array.isArray(e)?e:String(e).split(/\s+/)).map(n=>String(n).trim()).filter(n=>n!=="");this.className=s.join(" ")}requestUpdate(){this._scheduleRender()}emit(e,o){return this.dispatchEvent(new CustomEvent(e,{detail:o,bubbles:!0,composed:!0}))}_installPropAccessors(){const e=this.constructor;for(const o of e.props){if(Object.getOwnPropertyDescriptor(this,o))continue;const s=Pe(o);Object.defineProperty(this,o,{get:()=>o in this._propValues?this._propValues[o]:this.getAttribute(s),set:n=>{let r;n==null||n===!1?r=null:n===!0?r="":r=String(n),this._propValues[o]=r,r===null?this.removeAttribute(s):this.setAttribute(s,r),this.requestUpdate()},enumerable:!0,configurable:!0})}}_scheduleRender(){this._renderScheduled||!this.isConnected||(this._renderScheduled=!0,queueMicrotask(()=>{this._renderScheduled=!1,this.isConnected&&D(this.render(),this._renderRoot)}))}_adoptStyles(){const e=this.constructor;if(e.styles.length!==0)if(e.shadow&&this.shadowRoot){const o=e.styles.map(s=>s.sheet).filter(s=>s!==null);if(this.shadowRoot.adoptedStyleSheets=o,o.length!==e.styles.length){for(const s of e.styles)if(!s.sheet){const n=document.createElement("style");n.textContent=s.cssText,this.shadowRoot.appendChild(n)}}}else this._adoptLightStyles(e)}_adoptLightStyles(e){if(!M._lightStylesAdopted.has(e)){M._lightStylesAdopted.add(e);for(const o of e.styles){const s=document.createElement("style");s.dataset.osUi=this.tagName.toLowerCase(),s.textContent=o.cssText,document.head.appendChild(s)}}}};M.props=[],M.styles=[],M.shadow=!0,M._lightStylesAdopted=new WeakSet;let Y=M;function Oe(t,e){customElements.get(t)||customElements.define(t,e)}function Pe(t){return t.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function Xt(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}const Yt=(()=>{try{return typeof new CSSStyleSheet().replaceSync=="function"}catch{return!1}})();function k(t,...e){let o=t[0];for(let s=1;s<t.length;s++){const n=e[s-1];if(typeof n=="string"||typeof n=="number")o+=String(n);else if(n&&n.__wpdCss)o+=n.cssText;else throw new TypeError("[os-ui] css`` interpolations must be strings, numbers, or other css`` results. Got: "+typeof n);o+=t[s]}if(Yt){const s=new CSSStyleSheet;return s.replaceSync(o),{__wpdCss:!0,sheet:s,cssText:o}}return{__wpdCss:!0,sheet:null,cssText:o}}const He=k`: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 ) )}`,Zt=k` .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%}}`,Jt=k` .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%}}`,Qt=k` .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}}`,eo=k` .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}}`,to=k` .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}}`,oo=k` .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=k` .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}}`,no=k` 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}}`,ze=k` 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}}`,ro=k` @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}}`;k` ${He} ${Zt} ${Jt} ${Qt} ${eo} ${to} ${oo} ${so} ${no} ${ze} ${ro} `;const io=k` ${He} ${ze}:host{display:block;--_bg:var( --os-ui-table-bg,var( --os-ui-surface,#fff ) );--_border:var( --os-ui-table-border,var( --os-ui-border,rgba( 0,0,0,0.08 ) ) );--_column-border:var( --os-ui-table-column-border,var( --os-ui-border-strong,rgba( 0,0,0,0.14 ) ) );--_header-bg:var( --os-ui-table-header-bg,var( --os-ui-surface-elevated,#f6f7f7 ) );--_row-hover:var( --os-ui-table-row-hover,var( --os-ui-hover,rgba( 0,0,0,0.04 ) ) );--_stripe:var( --os-ui-table-stripe,var( --os-ui-surface-subtle,rgba( 0,0,0,0.03 ) ) );--_cell-padding:var( --os-ui-table-cell-padding,8px 12px );--_font-size:var( --os-ui-table-font-size,13px );--_max-height:var( --os-ui-table-max-height,none );font-size:var( --_font-size );color:inherit}:host( [ hidden ] ){display:none}.scroll{position:relative;overflow:auto;max-height:var( --_max-height );border:1px solid var( --_border );border-radius:4px;background:var( --_bg )}table{width:100%;border-collapse:separate;border-spacing:0;background:var( --_bg )}thead th{text-align:start;font-weight:600;background-color:var( --_header-bg );background-image:var( --os-ui-table-header-bg-image,none );background-repeat:var( --os-ui-table-header-bg-image-repeat,repeat );background-size:var( --os-ui-table-header-bg-image-size,auto );background-position:var( --os-ui-table-header-bg-image-position,center );padding:var( --_cell-padding );border-bottom:1px solid var( --_border );white-space:nowrap}tbody td{padding:var( --_cell-padding );border-bottom:1px solid var( --_border );background-color:var( --_bg );vertical-align:middle}tbody tr:last-child td{border-bottom:0}:host( [ striped ] ) tbody tr:nth-child( odd ) td{background-image:linear-gradient( var( --_stripe ),var( --_stripe ) )}:host( [ hover ] ) tbody tr:hover td{background-image:linear-gradient( var( --_row-hover ),var( --_row-hover ) )}:host( [ hover ][ striped ] ) tbody tr:nth-child( odd ):hover td{background-image:linear-gradient( var( --_row-hover ),var( --_row-hover ) ),linear-gradient( var( --_stripe ),var( --_stripe ) )}:host( [ compact ] ){--os-ui-table-cell-padding:4px 8px;--os-ui-table-font-size:12px}:host( [ bordered ] ) thead th,:host( [ bordered ] ) tbody td{border-inline-end:1px solid var( --_column-border )}:host( [ bordered ] ) thead th:last-child,:host( [ bordered ] ) tbody td:last-child{border-inline-end:0}th.is-sticky,td.is-sticky{position:sticky;z-index:10}tbody td.is-sticky{background-color:var( --_bg )}thead th.is-sticky{background-color:var( --_header-bg );background-image:var( --os-ui-table-header-bg-image,none );background-repeat:var( --os-ui-table-header-bg-image-repeat,repeat );background-size:var( --os-ui-table-header-bg-image-size,auto );background-position:var( --os-ui-table-header-bg-image-position,center );z-index:30}:host( [ sticky-header ] ) thead th{position:sticky;top:0;z-index:20}:host( [ sticky-header ] ) thead tr.filter-row th{top:var( --os-ui-table-header-height,33px );z-index:20}:host( [ sticky-header ] ) thead th.is-sticky{z-index:40}:host( [ sticky-header ] ) thead tr.filter-row th.is-sticky{z-index:40}th.is-sticky-edge,td.is-sticky-edge{border-inline-end:var( --os-ui-table-sticky-edge,2px solid var( --_border ) )}.align-center{text-align:center}.align-end{text-align:end}.filter-row th{padding:4px 8px;background-color:var( --_header-bg );background-image:var( --os-ui-table-header-bg-image,none );background-repeat:var( --os-ui-table-header-bg-image-repeat,repeat );background-size:var( --os-ui-table-header-bg-image-size,auto );background-position:var( --os-ui-table-header-bg-image-position,center );border-bottom:1px solid var( --_border );font-weight:400}.filter-input,.filter-select{width:100%;min-width:60px;box-sizing:border-box;padding:4px 6px;font:inherit;color:inherit;background-color:var( --_bg );border:1px solid var( --_border );border-radius:3px}.filter-input:focus,.filter-select:focus{outline:none;border-color:var( --os-ui-accent,#2271b1 );box-shadow:var( --_holo-focus-field )}.expander{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;padding:0;border:0;background:transparent;color:inherit;cursor:pointer;border-radius:3px;font-size:11px;line-height:1}.expander:hover{background:var( --os-ui-hover,rgba( 0,0,0,0.06 ) )}td.col-expander,th.col-expander{width:36px;min-width:36px;padding-left:0;padding-right:0;text-align:center}tr.subtable td{padding:0;background-color:var( --_bg );background-image:linear-gradient( var( --_stripe ),var( --_stripe ) );border-bottom:1px solid var( --_border )}tr.subtable .subtable-inner{padding:8px 12px 8px 32px}tr.empty td{padding:24px;text-align:center;color:var( --os-ui-text-muted,var( --os-ui-fg-muted,rgba( 0,0,0,0.55 ) ) );font-style:italic}thead th.is-sortable{cursor:pointer;user-select:none}thead th.is-sortable:hover{background-image:linear-gradient( var( --_row-hover ),var( --_row-hover ) )}thead th.is-sortable:focus-visible{outline:none;box-shadow:inset 0 0 0 2px var( --os-ui-accent,#2271b1 )}.sort-indicator{font-size:10px;color:var( --os-ui-text-muted,var( --os-ui-fg-muted,rgba( 0,0,0,0.55 ) ) );margin-inline-start:2px}thead th.sort-asc .sort-indicator,thead th.sort-desc .sort-indicator{color:var( --wp-admin-theme-color,#2271b1 )}td.col-select,th.col-select{width:40px;min-width:40px;padding-left:0;padding-right:0;text-align:center}.select-all-checkbox,.select-row-checkbox{cursor:pointer;margin:0}tbody tr.is-selected td{background-color:color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 10%,var( --_bg ) );background-image:none}tbody tr.is-selected:hover td{background-color:color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 16%,var( --_bg ) )}tbody tr.is-selected td:first-child{box-shadow:inset 3px 0 0 0 var( --os-ui-accent,#2271b1 )}tbody:dir( rtl ) tr.is-selected td:first-child{box-shadow:inset -3px 0 0 0 var( --os-ui-accent,#2271b1 )}:host( [ stacked ] ) .scroll{border:0;border-radius:0}:host( [ stacked ] ) table,:host( [ stacked ] ) tbody{display:block;width:100%}:host( [ stacked ] ) colgroup,:host( [ stacked ] ) thead{display:none}:host( [ stacked ] ) tbody tr{display:flex;align-items:flex-start;gap:12px;padding:12px 14px;border-bottom:1px solid var( --_border );background-color:var( --_bg )}:host( [ stacked ] ) tbody tr:last-child{border-bottom:0}:host( [ stacked ] ) tbody td{display:block;padding:0;border:0;background-color:transparent;background-image:none;box-shadow:none;min-width:0;width:auto;vertical-align:baseline}:host( [ stacked ] ) tbody tr.is-selected td,:host( [ stacked ] ) tbody tr.is-selected:hover td,:host( [ stacked ][ striped ] ) tbody tr:nth-child( odd ) td,:host( [ stacked ][ hover ] ) tbody tr:hover td,:host( [ stacked ][ hover ][ striped ] ) tbody tr:nth-child( odd ):hover td,:host( [ stacked ][ bordered ] ) tbody td{padding:0;border:0;background-color:transparent;background-image:none;box-shadow:none}:host( [ stacked ][ hover ] ) tbody tr:hover{background-image:linear-gradient( var( --_row-hover ),var( --_row-hover ) )}:host( [ stacked ] ) tbody tr.is-selected,:host( [ stacked ] ) tbody tr.is-selected:hover{background-color:color-mix( in srgb,var( --wp-admin-theme-color,#2271b1 ) 10%,var( --_bg ) );background-image:none;box-shadow:inset 3px 0 0 0 var( --os-ui-accent,#2271b1 )}:host( [ stacked ] ) tbody:dir( rtl ) tr.is-selected{box-shadow:inset -3px 0 0 0 var( --os-ui-accent,#2271b1 )}:host( [ stacked ] ) tbody td.col-select,:host( [ stacked ] ) tbody td.col-expander{flex:0 0 auto;display:flex;align-items:center;justify-content:center;min-width:0}:host( [ stacked ] ) tbody td.col-select{width:44px;height:44px;margin:-11px 0 -11px -11px;cursor:pointer}:host( [ stacked ] ) .select-row-checkbox{width:22px;height:22px}:host( [ stacked ] ) tbody td.col-expander{width:28px;height:22px;margin-inline-start:-4px}:host( [ stacked ] ) tbody td.stack-body{flex:1 1 auto;display:flex;flex-direction:column;gap:4px;min-width:0}.stack-cell{display:flex;align-items:baseline;gap:6px;min-width:0;line-height:1.4}.stack-title{font-size:15px;font-weight:600;line-height:1.35}.stack-meta{font-size:13px}.stack-label{flex:0 0 auto;font-size:12px;color:var( --os-ui-text-muted,var( --os-ui-fg-muted,rgba( 0,0,0,0.55 ) ) )}.stack-label::after{content:'ยท';margin-inline-start:6px}.stack-value{flex:1 1 auto;min-width:0;display:flex;align-items:center;flex-wrap:wrap;gap:6px}.stack-actions{margin-block-start:6px}.stack-actions .stack-value{gap:8px}.stack-actions .stack-value>*{justify-content:flex-start;max-width:100%}:host( [ stacked ] ) tr.subtable,:host( [ stacked ] ) tr.empty{display:block;padding:0}:host( [ stacked ] ) tr.subtable td{background-image:linear-gradient( var( --_stripe ),var( --_stripe ) )}:host( [ stacked ] ) tr.subtable .subtable-inner{padding:8px 14px 12px}:host( [ stacked ] ) tr.empty td{padding:24px}:host( [ stacked ] ) tr.skeleton{display:block;padding:14px;border-bottom:1px solid var( --_border )}:host( [ stacked ] ) tr.skeleton td.stack-body{gap:8px}:host( [ stacked ] ) tr.skeleton .skeleton-bar:first-child{height:15px}tbody tr.skeleton td{padding:var( --_cell-padding )}.skeleton-bar{display:block;height:12px;border-radius:3px;background:linear-gradient( 90deg,var( --os-ui-table-skeleton-color,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) ) 0%,var( --os-ui-table-skeleton-highlight,var( --os-ui-hover,rgba( 0,0,0,0.14 ) ) ) 50%,var( --os-ui-table-skeleton-color,var( --os-ui-hover,rgba( 0,0,0,0.06 ) ) ) 100% );background-size:200% 100%;animation:os-table-skeleton-pulse 1.4s ease-in-out infinite}@keyframes os-table-skeleton-pulse{0%{background-position:200% 50%}100%{background-position:-200% 50%}}@media ( prefers-reduced-motion:reduce ){.skeleton-bar{animation:none}}`,O="__wpd_expander__",P="__wpd_select__",V=class V extends Y{constructor(){super(...arguments),this._data=[],this._columns=[],this._filters={},this._expanded=new Set,this._subTable=null,this._sort=null,this._selection=new Set,this._getRowId=(e,o)=>o,this._filterCache=new Map,this._paintScheduled=!1,this._stacked=!1,this._stickyHeaderWarned=!1,this._stickyRaceWarned=!1,this._resizeObserver=null,this._stickyMicroScheduled=!1,this._stickyRafHandle=null,this._loadingDesyncWarned=!1,this._lastStickyIndex=-1}get data(){return this._data}set data(e){this._data=Array.isArray(e)?e.slice():[],this._expanded.clear(),this._schedulePaint()}get columns(){return this._columns}set columns(e){this._columns=Array.isArray(e)?e.slice():[];const o=new Set(this._columns.map(s=>s.key));for(const s of Object.keys(this._filters))o.has(s)||delete this._filters[s];for(const s of Array.from(this._filterCache.keys()))o.has(s)||this._filterCache.delete(s);this._sort&&!o.has(this._sort.key)&&(this._sort=null),this._schedulePaint()}get filters(){return{...this._filters}}set filters(e){this._filters=e?{...e}:{},this._schedulePaint()}get sort(){return this._sort?{...this._sort}:null}set sort(e){this._sort=e?{...e}:null,this._schedulePaint()}get selection(){return new Set(this._selection)}set selection(e){this._selection=new Set(e??[]),this._schedulePaint()}get selectedRows(){const e=[];return this._data.forEach((o,s)=>{this._selection.has(this._getRowId(o,s))&&e.push(o)}),e}get visibleRows(){return this._filteredRows().map(e=>e.row)}get getRowId(){return this._getRowId}set getRowId(e){this._getRowId=typeof e=="function"?e:(o,s)=>s,this._schedulePaint()}get subTable(){return this._subTable}set subTable(e){this._subTable=typeof e=="function"?e:null,this._expanded.clear(),this._schedulePaint()}get expanded(){return new Set(this._expanded)}set expanded(e){this._expanded=new Set(e??[]),this._schedulePaint()}expand(e){e<0||e>=this._data.length||this._expanded.has(e)||(this._expanded.add(e),this.emit("os-table-expand-change",{row:this._data[e],index:e,expanded:!0}),this._schedulePaint())}collapse(e){this._expanded.has(e)&&(this._expanded.delete(e),this.emit("os-table-expand-change",{row:this._data[e],index:e,expanded:!1}),this._schedulePaint())}expandAll(){if(!this._subTable)return;let e=!1;for(let o=0;o<this._data.length;o++)this._subTable(this._data[o],o)&&(this._expanded.has(o)||(this._expanded.add(o),e=!0));e&&this._schedulePaint()}collapseAll(){this._expanded.size!==0&&(this._expanded.clear(),this._schedulePaint())}isExpanded(e){return this._expanded.has(e)}clearFilters(){Object.keys(this._filters).length!==0&&(this._filters={},this.emit("os-table-filter-change",{filters:{}}),this._schedulePaint())}clearSort(){this._sort!==null&&(this._sort=null,this.emit("os-table-sort-change",{sort:null}),this._schedulePaint())}select(e){if(this._selection.has(e))return;const o=this._readSelectable(),s=o==="single"?Array.from(this._selection):[];o==="single"&&this._selection.clear(),this._selection.add(e),this._emitSelectionChange(),this._syncSelectionDom([e,...s])}deselect(e){this._selection.delete(e)&&(this._emitSelectionChange(),this._syncSelectionDom([e]))}selectAll(){if(this._readSelectable()==="multi"){for(const{row:e,index:o}of this._filteredRows())this._selection.add(this._getRowId(e,o));this._emitSelectionChange(),this._syncSelectionDom("all")}}clearSelection(){this._selection.size!==0&&(this._selection.clear(),this._emitSelectionChange(),this._syncSelectionDom("all"))}_syncSelectionDom(e){const o=this.shadowRoot;if(!o)return;const s=o.querySelector("tbody");if(!s)return;let n=null;if(e!=="all"){n=new Set;for(const a of e)n.add(String(a))}const r=s.querySelectorAll("tr[data-row-id]");for(const a of r){const l=a.dataset.rowId;if(l===void 0||n&&!n.has(l))continue;const c=Number(a.dataset.rowIndex);if(!Number.isFinite(c))continue;const d=this._data[c];if(d===void 0)continue;const u=this._getRowId(d,c),f=this._selection.has(u);a.classList.toggle("is-selected",f);const m=a.querySelector("input.select-row-checkbox");m&&m.checked!==f&&(m.checked=f)}const i=o.querySelector("thead .select-all-checkbox");if(i){const{total:a,selected:l}=this._visibleSelectionStats();i.checked=a>0&&l===a,i.indeterminate=l>0&&l<a}}scrollToRow(e){const o=this.shadowRoot;if(!o)return;const n=o.querySelectorAll("tbody tr:not(.subtable):not(.empty):not(.skeleton)")[e];n&&n.scrollIntoView({block:"nearest",inline:"nearest"})}connectedCallback(){super.connectedCallback(),this._schedulePaint()}disconnectedCallback(){this._resizeObserver?.disconnect(),this._resizeObserver=null,this._stickyRafHandle!==null&&typeof cancelAnimationFrame<"u"&&(cancelAnimationFrame(this._stickyRafHandle),this._stickyRafHandle=null)}recomputeLayout(){this._applyStickyOffsets(),this._measureHeaderHeight()}render(){return E` | |
| 2 | 2 | <div class="scroll" part="scroll"> |
| 3 | 3 | <table part="table"> |
| 4 | 4 | <colgroup></colgroup> |
| 5 | 5 | <thead></thead> |
| @@ -5,60 +5,60 @@ | ||
| 5 | 5 | <thead></thead> |
| 6 | 6 | <tbody></tbody> |
| 7 | 7 | </table> |
| 8 | 8 | </div> |
| 9 | - `}requestUpdate(){super.requestUpdate(),this._schedulePaint()}_schedulePaint(){this._paintScheduled||!this.isConnected||(this._paintScheduled=!0,queueMicrotask(()=>{this._paintScheduled=!1,this.isConnected&&this._paint()}))}_paint(){const e=this.shadowRoot;if(!e)return;e.querySelector("tbody")||z(this.render(),e);const t=e.querySelector("colgroup"),n=e.querySelector("thead"),s=e.querySelector("tbody");if(!t||!n||!s)return;const i=this._effectiveColumns();this._stacked=this.hasAttribute("stacked");const r=this._readStickyColumns();this._lastStickyIndex=this._computeLastStickyIndex(i,r),this._paintColgroup(t,i),this._paintHead(n,i,r),this._paintBody(s,i,r),this._applyStickyOffsets(),this._measureHeaderHeight(),this._scheduleStickyOffsets(),this._maybeWarnStickyHeader(),this._maybeWarnLoadingDesync(s),this._ensureResizeObserver()}_maybeWarnLoadingDesync(e){this._loadingDesyncWarned||this.hasAttribute("loading")&&(e.querySelector("tr.skeleton")||(this._loadingDesyncWarned=!0,console.warn("[os-table] `loading` attribute is set but no skeleton rows rendered. Either attributeChangedCallback didn't route through requestUpdate (framework regression), or `loading` was set after the most recent paint and no follow-up trigger ran. Toggling `data` will force a paint as a workaround.")))}_scheduleStickyOffsets(){this._stickyMicroScheduled||(this._stickyMicroScheduled=!0,queueMicrotask(()=>{this._stickyMicroScheduled=!1,this.isConnected&&this._applyStickyOffsets()})),this._stickyRafHandle===null&&typeof requestAnimationFrame<"u"&&(this._stickyRafHandle=requestAnimationFrame(()=>{this._stickyRafHandle=null,this.isConnected&&(this._applyStickyOffsets(),this._measureHeaderHeight())}))}_ensureResizeObserver(){if(this._resizeObserver||typeof ResizeObserver>"u")return;const e=this.shadowRoot?.querySelector(".scroll");e&&(this._resizeObserver=new ResizeObserver(()=>{this.isConnected&&(this._applyStickyOffsets(),this._measureHeaderHeight(),this._stickyHeaderWarned=!1,this._maybeWarnStickyHeader())}),this._resizeObserver.observe(e),this._resizeObserver.observe(this))}_paintColgroup(e,t){const n=[];for(const s of t){const i=document.createElement("col");s.width&&(i.style.width=s.width),n.push(i)}e.replaceChildren(...n)}_paintHead(e,t,n){const s=document.createElement("tr");s.setAttribute("part","header-row");for(let l=0;l<t.length;l++)s.appendChild(this._buildHeaderCell(t[l],l,n));const i=e.querySelector(':scope > tr[part="header-row"]');i?e.replaceChild(s,i):e.insertBefore(s,e.firstChild);const r=t.some(l=>l.filter||Array.isArray(l.filterOptions)||typeof l.filterRender=="function");let a=e.querySelector(":scope > tr.filter-row");if(r){const l=[];for(let h=0;h<t.length;h++)l.push(this._buildFilterCell(t[h],h,n));a||(a=document.createElement("tr"),a.classList.add("filter-row"),a.setAttribute("part","filter-row"),e.appendChild(a));const c=Array.from(a.children);let d=c.length===l.length;if(d){for(let h=0;h<l.length;h++)if(c[h]!==l[h]){d=!1;break}}if(!d){const h=new Set(l);for(const p of l)a.appendChild(p);for(const p of Array.from(a.children))h.has(p)||a.removeChild(p)}}else a&&a.remove()}_buildHeaderCell(e,t,n){const s=document.createElement("th");if(s.setAttribute("scope","col"),s.dataset.key=e.key,this._applyCellClasses(s,e,t,n),e.minWidth&&(s.style.minWidth=e.minWidth),e.key===M){if(this._readSelectable()==="multi"){const r=document.createElement("input");r.type="checkbox",r.className="select-all-checkbox",r.setAttribute("data-noclick",""),r.setAttribute("aria-label","Select all rows");const{total:a,selected:l}=this._visibleSelectionStats();r.checked=a>0&&l===a,r.indeterminate=l>0&&l<a,r.addEventListener("change",()=>{r.checked?this.selectAll():this.clearSelection()}),s.appendChild(r)}return s}if(s.textContent=e.label??(e.key===O?"":e.key),e.sortable){s.classList.add("is-sortable");const i=this._sort?.key===e.key,r=document.createElement("span");r.className="sort-indicator";let a="";i&&(a=this._sort.direction==="asc"?" โฒ":" โผ"),r.textContent=a,s.appendChild(r),i&&s.classList.add(this._sort.direction==="asc"?"sort-asc":"sort-desc"),s.addEventListener("click",()=>this._cycleSort(e.key))}return s}_buildFilterCell(e,t,n){const s=this._filterCache.get(e.key),i=Array.isArray(e.filterOptions),r=typeof e.filterRender=="function";let a;if(!e.filter&&!i&&!r||e.key===O||e.key===M?a="none":r?a="custom":e.filter==="select"||i?a="select":a="text",s&&s.kind===a){if(s.th.className="",this._applyCellClasses(s.th,e,t,n),a==="select"){const h=s.control,p=this._resolveFilterOptions(e),m=p.map(f=>f.value).join("|");m!==s.optionsKey?(this._populateSelect(h,p,this._filters[e.key]??""),s.optionsKey=m):h.value=this._filters[e.key]??""}else if(a==="text"){const h=s.control,p=this._filters[e.key]??"";h.value!==p&&h.ownerDocument.activeElement!==h&&(h.value=p)}else a==="custom"&&e.filterRender&&e.filterRender(s.th,{value:this._filters[e.key]??"",setValue:h=>this._onFilterChange(e.key,h),col:e});return s.th}const l=document.createElement("th");if(this._applyCellClasses(l,e,t,n),a==="none")return this._filterCache.set(e.key,{th:l,control:null,optionsKey:"",kind:"none"}),l;if(a==="custom"&&e.filterRender)return e.filterRender(l,{value:this._filters[e.key]??"",setValue:h=>this._onFilterChange(e.key,h),col:e}),this._filterCache.set(e.key,{th:l,control:null,optionsKey:"",kind:"custom"}),l;let c,d="";if(a==="select"){const h=document.createElement("select");h.classList.add("filter-select"),h.setAttribute("data-noclick",""),h.setAttribute("aria-label",`Filter ${e.label??e.key}`);const p=this._resolveFilterOptions(e);this._populateSelect(h,p,this._filters[e.key]??""),d=p.map(m=>m.value).join("|"),h.addEventListener("change",()=>{this._onFilterChange(e.key,h.value)}),c=h}else{const h=document.createElement("input");h.type="search",h.classList.add("filter-input"),h.setAttribute("data-noclick",""),h.setAttribute("placeholder","Filterโฆ"),h.setAttribute("aria-label",`Filter ${e.label??e.key}`),h.value=this._filters[e.key]??"",h.addEventListener("input",()=>{this._onFilterChange(e.key,h.value)}),c=h}return l.appendChild(c),this._filterCache.set(e.key,{th:l,control:c,optionsKey:d,kind:a}),l}_populateSelect(e,t,n){e.replaceChildren();const s=document.createElement("option");s.value="",s.textContent="All",e.appendChild(s);for(const i of t){const r=document.createElement("option");r.value=i.value,r.textContent=i.label,i.value===n&&(r.selected=!0),e.appendChild(r)}e.value=n}_resolveFilterOptions(e){return Array.isArray(e.filterOptions)?e.filterOptions:this._uniqueValues(e.key).map(t=>({value:t,label:t}))}_paintBody(e,t,n){if(e.replaceChildren(),this.hasAttribute("loading")){const i=this._readLoadingRows();for(let r=0;r<i;r++)e.appendChild(this._buildSkeletonRow(t,r));return}const s=this._sortedRows(this._filteredRows());if(s.length===0){e.appendChild(this._buildEmptyRow(t.length));return}for(const{row:i,index:r}of s)if(e.appendChild(this._stacked?this._buildStackedRow(i,r,t):this._buildBodyRow(i,r,t,n)),this._expanded.has(r)&&this._subTable){const a=this._subTable(i,r);a&&e.appendChild(this._buildSubTableRow(a,t.length))}}_buildEmptyRow(e){const t=document.createElement("tr");t.classList.add("empty");const n=document.createElement("td");n.colSpan=e;const s=document.createElement("slot");return s.name="empty",s.textContent=this.getAttribute("empty")||"No data",n.appendChild(s),t.appendChild(n),t}_buildSkeletonRow(e,t){const n=document.createElement("tr");if(n.classList.add("skeleton"),n.setAttribute("aria-hidden","true"),this._stacked){n.classList.add("stack-row");const s=document.createElement("td");s.className="stack-body",s.colSpan=Math.max(1,e.length);for(const i of[55+t*7%25,30+t*11%15]){const r=document.createElement("span");r.className="skeleton-bar",r.style.width=`${i}%`,s.appendChild(r)}return n.appendChild(s),n}for(const s of e){const i=document.createElement("td"),r=document.createElement("span");r.className="skeleton-bar";const a=50+(t*7+n.children.length*13)%40;r.style.width=`${a}%`,i.appendChild(r),n.appendChild(i)}return n}_buildBodyRow(e,t,n,s){const i=document.createElement("tr");i.setAttribute("part","row"),i.dataset.rowIndex=String(t);const r=this._getRowId(e,t);i.dataset.rowId=String(r),this._selection.has(r)&&i.classList.add("is-selected"),i.addEventListener("click",a=>{this._onRowClick(e,t,a)});for(let a=0;a<n.length;a++)i.appendChild(this._buildBodyCell(n[a],a,e,t,s));return i}_buildStackedRow(e,t,n){const s=document.createElement("tr");s.setAttribute("part","row"),s.classList.add("stack-row"),s.dataset.rowIndex=String(t);const i=this._getRowId(e,t);s.dataset.rowId=String(i),this._selection.has(i)&&s.classList.add("is-selected"),s.addEventListener("click",c=>{this._onRowClick(e,t,c)});const r=document.createElement("td");r.className="stack-body";let a=0,l=0;for(let c=0;c<n.length;c++){const d=n[c];if(d.key===M||d.key===O){s.appendChild(this._buildBodyCell(d,c,e,t,0));continue}l++;const h=Vt(d,a++);if(h==="hidden")continue;const p=document.createElement("div");if(p.className=`stack-cell stack-${h}`,p.dataset.key=d.key,h==="meta"&&d.label){const k=document.createElement("span");k.className="stack-label",k.textContent=d.label,p.appendChild(k)}const m=document.createElement("span");m.className="stack-value";const f=e[d.key];d.render?this._mountCellContent(m,d.render(f,e,t)):f!=null&&(m.textContent=String(f)),p.appendChild(m),r.appendChild(p)}return r.colSpan=Math.max(1,l),s.appendChild(r),s}_buildBodyCell(e,t,n,s,i){const r=document.createElement("td");if(this._applyCellClasses(r,e,t,i),e.minWidth&&(r.style.minWidth=e.minWidth),e.key===M){const l=this._getRowId(n,s),c=document.createElement("input");return c.type="checkbox",c.className="select-row-checkbox",c.setAttribute("data-noclick",""),c.setAttribute("aria-label","Select row"),c.checked=this._selection.has(l),c.addEventListener("change",()=>{c.checked?this.select(l):this.deselect(l)}),r.appendChild(c),this._stacked&&(r.setAttribute("data-noclick",""),r.addEventListener("click",d=>{d.target===r&&(c.checked=!c.checked,c.dispatchEvent(new Event("change")))})),r}if(e.key===O){if(!(this._subTable?!!this._subTable(n,s):!1))return r;const c=this._expanded.has(s),d=document.createElement("button");return d.type="button",d.className="expander",d.setAttribute("data-noclick",""),d.setAttribute("aria-expanded",c?"true":"false"),d.setAttribute("aria-label",c?"Collapse row":"Expand row"),d.textContent=c?"โพ":"โธ",d.addEventListener("click",h=>{this._toggleRow(s,n,h)}),r.appendChild(d),r}const a=n[e.key];if(e.render){const l=e.render(a,n,s);this._mountCellContent(r,l)}else a!=null&&(r.textContent=String(a));return r}_buildSubTableRow(e,t){const n=document.createElement("tr");n.classList.add("subtable"),n.setAttribute("part","subtable-row");const s=document.createElement("td");s.colSpan=t;const i=document.createElement("div");if(i.classList.add("subtable-inner"),e instanceof Node)i.appendChild(e);else if(Te(e))z(e,i);else{const r=document.createElement("os-table");r.columns=e.columns,r.data=e.data,e.subTable&&(r.subTable=e.subTable),i.appendChild(r)}return s.appendChild(i),n.appendChild(s),n}_mountCellContent(e,t){if(typeof t=="string"){e.textContent=t;return}if(t instanceof Node){e.appendChild(t);return}Te(t)&&z(t,e)}_onFilterChange(e,t){t===""?delete this._filters[e]:this._filters[e]=t,this.emit("os-table-filter-change",{filters:{...this._filters}});const s=this.shadowRoot?.querySelector("tbody");if(s){const i=this._effectiveColumns(),r=this._readStickyColumns();this._lastStickyIndex=this._computeLastStickyIndex(i,r),this._paintBody(s,i,r),this._applyStickyOffsets()}}_onRowClick(e,t,n){const s=n.composedPath?.()??[];for(const i of s){if(i instanceof Element&&i.hasAttribute("data-noclick"))return;if(i===this)break}this.emit("os-table-row-click",{row:e,index:t,originalEvent:n})}_toggleRow(e,t,n){n.stopPropagation();const s=this._expanded.has(e);s?this._expanded.delete(e):this._expanded.add(e),this.emit("os-table-expand-change",{row:t,index:e,expanded:!s}),this._schedulePaint()}_cycleSort(e){!this._sort||this._sort.key!==e?this._sort={key:e,direction:"asc"}:this._sort.direction==="asc"?this._sort={key:e,direction:"desc"}:this._sort=null,this.emit("os-table-sort-change",{sort:this._sort?{...this._sort}:null}),this._schedulePaint()}_emitSelectionChange(){this.emit("os-table-selection-change",{selection:Array.from(this._selection),rows:this.selectedRows})}_filteredRows(){const e=[],t=Object.keys(this._filters).filter(n=>this._filters[n]!=="");for(let n=0;n<this._data.length;n++){const s=this._data[n];let i=!0;for(const r of t){const a=this._columns.find(h=>h.key===r);if(a&&typeof a.filterRender=="function")continue;const l=this._filters[r]??"",c=s[r],d=c==null?"":String(c);if(a?.filter==="select"){if(d!==l){i=!1;break}}else if(!d.toLowerCase().includes(l.toLowerCase())){i=!1;break}}i&&e.push({row:s,index:n})}return e}_sortedRows(e){if(!this._sort)return e;const t=this._columns.find(i=>i.key===this._sort.key);if(!t)return e;const n=this._sort.direction==="desc"?-1:1,s=e.slice();return s.sort((i,r)=>{const a=t.sortValue?t.sortValue(i.row,i.row[t.key]):i.row[t.key],l=t.sortValue?t.sortValue(r.row,r.row[t.key]):r.row[t.key];return Kt(a,l)*n}),s}_uniqueValues(e){const t=new Set;for(const n of this._data){const s=n[e];s!=null&&t.add(String(s))}return Array.from(t).sort()}_visibleSelectionStats(){let e=0,t=0;for(const{row:n,index:s}of this._filteredRows())e++,this._selection.has(this._getRowId(n,s))&&t++;return{total:e,selected:t}}_readStickyColumns(){const e=parseInt(this.getAttribute("sticky-columns")||"0",10);return Number.isFinite(e)&&e>0?e:0}_readLoadingRows(){const e=parseInt(this.getAttribute("loading-rows")||"5",10);return Number.isFinite(e)&&e>0?Math.min(e,100):5}_readSelectable(){const e=this.getAttribute("selectable");return e==="single"?"single":e==="multi"||e===""?"multi":null}_isStickyIndex(e,t,n){return this._stacked||n.sticky===!1?!1:n.sticky===!0?!0:e<t}_computeLastStickyIndex(e,t){let n=-1;for(let s=0;s<e.length;s++)this._isStickyIndex(s,t,e[s])&&(n=s);return n}_applyCellClasses(e,t,n,s){t.key===O&&e.classList.add("col-expander"),t.key===M&&e.classList.add("col-select"),t.align==="center"&&e.classList.add("align-center"),t.align==="end"&&e.classList.add("align-end"),this._isStickyIndex(n,s,t)&&(e.classList.add("is-sticky"),n===this._lastStickyIndex&&e.classList.add("is-sticky-edge"))}_effectiveColumns(){const e=[];return this._readSelectable()&&e.push({key:M,label:"",width:"40px",align:"center"}),this._subTable&&e.push({key:O,label:"",width:"36px",align:"center"}),e.push(...this._columns),e}_applyStickyOffsets(){const e=this.shadowRoot;if(!e)return;const t=e.querySelector("thead tr");if(!t)return;const n=Array.from(t.children),s=[];let i=0;for(let a=0;a<n.length;a++)s[a]=i,n[a].classList.contains("is-sticky")&&(i+=n[a].offsetWidth);e.querySelectorAll("thead tr, tbody tr:not(.subtable):not(.empty):not(.skeleton)").forEach(a=>{const l=Array.from(a.children);for(let c=0;c<l.length;c++)l[c].classList.contains("is-sticky")&&(l[c].style.insetInlineStart=`${s[c]}px`)}),this._maybeWarnStickyOffsetRace(n,s)}_maybeWarnStickyOffsetRace(e,t){if(this._stickyRaceWarned)return;const n=this._readStickyColumns();if(n<2)return;const s=Math.min(n-1,e.length-1);if(s<=0||t[s]!==0||this.offsetWidth===0)return;this._stickyRaceWarned=!0;const i=e[0]?.offsetWidth??0;console.warn(`[os-table] sticky-columns: column ${s} resolved to inset-inline-start: 0px while the host is visible. ths[0].offsetWidth was ${i}px at measurement time. Likely a layout race โ call recomputeLayout() after the panel finishes its mount/transition, or wrap the assignment of \`data\` in a requestAnimationFrame.`)}_measureHeaderHeight(){const e=this.shadowRoot;if(!e)return;const t=e.querySelector("thead tr");if(!t)return;const n=t.offsetHeight;n>0&&this.style.setProperty("--os-ui-table-header-height",`${n}px`)}_maybeWarnStickyHeader(){if(this._stickyHeaderWarned||!this.hasAttribute("sticky-header")||this.hasAttribute("loading")||this._data.length<8)return;const e=this.shadowRoot?.querySelector(".scroll");e&&e.offsetWidth!==0&&e.scrollHeight<=e.clientHeight+1&&(this._stickyHeaderWarned=!0,console.warn("[os-table] sticky-header is set but the table has no scroll container. Set --os-ui-table-max-height on the host (or wrap it in a scrolling parent) so the header has something to stick to."))}};B.props=["stickyColumns","stickyHeader","striped","hover","compact","bordered","empty","loading","loadingRows","selectable","stacked"],B.styles=[Bt],B.help=void 0;let oe=B;function Te(o){return!!o&&o.__wpdHtml===!0}function Vt(o,e){return o.stack?o.stack:e===0?"title":o.label?"meta":"actions"}function Kt(o,e){if(o===e)return 0;if(o==null)return-1;if(e==null)return 1;if(typeof o=="number"&&typeof e=="number")return o-e;if(o instanceof Date&&e instanceof Date)return o.getTime()-e.getTime();const t=Number(o),n=Number(e);return Number.isFinite(t)&&Number.isFinite(n)?t-n:String(o).localeCompare(String(e))}Se("os-table",oe);const Ut=1e3;async function Gt(o){const{emptyBin:e,onProgress:t,maxIterations:n=Ut}=o;let s=0,i=0,r=0,a=0,l="iteration-cap";for(let c=0;c<n;c++){const d=await e();if(s+=d.purged,i+=d.skipped,a=d.remaining,c===0&&(r=s+d.remaining),t?.({purged:s,skipped:i,initialTotal:r}),d.remaining===0){l="empty";break}if(d.purged===0&&d.skipped>0){l="no-progress";break}}return{purged:s,skipped:i,initialTotal:r,remaining:a,stoppedBecause:l}}const Xt="os-recycle-bin-changed",Yt="openstation_recycle_bin_seen_ts",Zt="os-recycle-bin-changed",b={started:!1,seenTs:0,postMessageHandler:null,heartbeatSendHandler:null,heartbeatTickHandler:null};function Re(o,e){const t={kind:"external",ok:0,errors:[],source:o,ts:e};document.dispatchEvent(new CustomEvent(Xt,{detail:t}));const n=window.wp?.hooks;n&&typeof n.doAction=="function"&&n.doAction("openstation.recycleBin.changed",t)}function Jt(){if(b.started)return;b.started=!0,b.seenTs=Date.now();const o=window.location.origin;b.postMessageHandler=t=>{if(t.origin!==o)return;const n=t.data;if(!n||n.type!==Zt)return;const s=typeof n.ts=="number"?n.ts:Date.now();s<=b.seenTs||(b.seenTs=s,Re("chromeless",s))},window.addEventListener("message",b.postMessageHandler);const e=window.jQuery;e&&(b.heartbeatSendHandler=(...t)=>{const n=t[1];n&&(n[Yt]=b.seenTs)},e(document).on("heartbeat-send",b.heartbeatSendHandler),b.heartbeatTickHandler=(...t)=>{const s=t[1]?.openstation_recycle_bin;if(!s)return;const i=typeof s.ts=="number"?s.ts:0;i>b.seenTs&&(b.seenTs=i,s.changed&&Re("heartbeat",i))},e(document).on("heartbeat-tick",b.heartbeatTickHandler))}function Qt(){if(!b.started)return;b.started=!1,b.postMessageHandler&&(window.removeEventListener("message",b.postMessageHandler),b.postMessageHandler=null);const o=window.jQuery;o&&(b.heartbeatSendHandler&&o(document).off("heartbeat-send",b.heartbeatSendHandler),b.heartbeatTickHandler&&o(document).off("heartbeat-tick",b.heartbeatTickHandler)),b.heartbeatSendHandler=null,b.heartbeatTickHandler=null}function $e(o){const e=document.createElement("textarea");return e.innerHTML=o,e.value}const eo=_`:host{display:inline;color:inherit;font:inherit}`,Z=new Set;let j=null;const to=3e4;function oo(){j===null&&(j=window.setInterval(()=>{for(const o of Z)o.tick()},to))}function no(){j!==null&&Z.size===0&&(window.clearInterval(j),j=null)}function so(o){if(!o)return null;const e=t=>{const n=new Date(t);return Number.isNaN(n.getTime())?null:n};return io(o)?e(o):e(o.replace(" ","T")+"Z")}function io(o){const e=Math.max(o.indexOf("T"),o.indexOf(" ")),t=e===-1?"":o.slice(e+1);return/(?:[Zz]|[+-]\d{2}:?\d{2})$/.test(t)}let ne=null,se=null;function Le(){return typeof navigator<"u"&&navigator.language||"en"}function ro(){return ne||(ne=new Intl.RelativeTimeFormat(Le(),{numeric:"auto"})),ne}function Ie(){return se||(se=new Intl.RelativeTimeFormat(Le(),{numeric:"always",style:"narrow"})),se}function ao(o,e){const t=ro(),n=o.getTime()-e,s=Math.round(n/1e3),i=Math.abs;return i(s)<45?t.format(0,"second"):Ne(t,s)}function Ne(o,e){const t=Math.abs,n=Math.round(e/60);if(t(n)<45)return o.format(n,"minute");const s=Math.round(n/60);if(t(s)<22)return o.format(s,"hour");const i=Math.round(s/24);if(t(i)<26)return o.format(i,"day");const r=Math.round(i/30);if(t(r)<11)return o.format(r,"month");const a=Math.round(i/365);return o.format(a,"year")}function lo(o,e){const t=Math.round((o.getTime()-e)/1e3),n=Math.abs;return n(t)<45?Ie().format(0,"second"):n(t)>604800?o.toLocaleDateString(void 0,{month:"short",day:"numeric"}):Ne(Ie(),t)}const V=class V extends Y{connectedCallback(){super.connectedCallback(),Z.add(this),oo()}disconnectedCallback(){Z.delete(this),no()}tick(){this.requestUpdate()}render(){const e=this.datetime,t=so(e);if(!t)return C`<span>${e??""}</span>`;const n=Date.now(),s=this.hasAttribute("compact")?lo(t,n):ao(t,n),i=t.toLocaleString();return C`<time datetime=${t.toISOString()} title=${i} | |
| 10 | - >${s}</time | |
| 11 | - >`}};V.props=["datetime","compact"],V.styles=[eo],V.help=void 0;let ie=V;Se("os-relative-time",ie);function co(){const o=window.wp?.hooks;if(!o)throw new Error("[openstation] `window.wp.hooks` is not available. The plugin declares `wp-hooks` as a script dependency; if you are seeing this error, verify the enqueue order.");return o}function Oe(o,e,...t){return co().applyFilters(o,e,...t)}const Me={DESKTOP_THEME_ICON:"os.os-theme.icon",DESKTOP_THEME_ICON_COLOR:"os.os-theme.icon-color"},Pe=X("desktop-mode/dock-rail-registry",()=>({registry:new Map,listeners:new Set,activeId:"default"}));Pe.state.registry,Pe.state.listeners;class ho extends Error{constructor(e,t,n){super(`[openstation] ${e} registration rejected โ fields: `+t.join(", ")+"."),this.name="RegistrationError",this.kind=e,this.errors=t,this.def=n}}function uo(o,e,t){if(e.length!==0)throw new ho(o,e,t)}const R=[[0,0],[100,0],[100,100],[0,100]],po=48,fo=80,re=6,ae=8,He=4,ze=3,De=64,le=105,$=2;function je(o){return`${Math.round(o*1e3)/1e3}%`}function L(o){return o.slice().reverse()}function W(o,e,t,n){return[[o,e],[t,e],[t,n],[o,n]]}function mo(o,e,t,n){const s=[];for(let i=0;i<n;i++){const r=i/n*Math.PI*2;s.push([o+Math.cos(r)*t,e+Math.sin(r)*t])}return s}function x(o,e=[]){const t=[],n=s=>{t.push(`${je(s[0])} ${je(s[1])}`)};for(const s of o)n(s);if(e.length>0){n(o[0]);for(const s of e){for(const i of s)n(i);n(s[0]),n(o[0])}}return`polygon( ${t.join(", ")} )`}function We(o){return x(R,[L(mo(50,50,o,po))])}function Fe(o){return x(R,[L(W(50-o,-$,50+o,100+$))])}function qe(o){const e=100/re,t=[];for(let n=0;n<re;n++){const s=n*e;t.push(L(W(-$,s,100+$,s+o)))}return x(R,t)}function Be(o){return x(R,[L(W(-$,50-o,100+$,50+o))])}function Ve(o){const e=100/ae,t=[];for(let n=0;n<ae;n++){const s=n*e;t.push(L(W(s,-$,s+o,100+$)))}return x(R,t)}function Ke(o){return x(R,[L([[50,50-o],[50+o,50],[50,50+o],[50-o,50]])])}function Ue(o){const e=100/He,t=100/ze,n=[];for(let s=0;s<ze;s++)for(let i=0;i<He;i++){const r=i*e+e/2,a=s*t+t/2,l=e/2*o,c=t/2*o;n.push(L(W(r-l,a-c,r+l,a+c)))}return x(R,n)}function Ge(o){const e=-Math.PI/2,t=o/180*Math.PI,n=[[50,50]];for(let s=0;s<De;s++){const i=e+s/(De-1)*t;n.push([50+Math.cos(i)*le,50+Math.sin(i)*le])}return x(R,[L(n)])}function bo(){return{from:We(0),to:We(fo)}}function go(){return{from:Fe(0),to:Fe(52)}}function yo(){return{from:qe(0),to:qe(100/re+.5)}}function ko(){return{from:Be(0),to:Be(52)}}function _o(){return{from:Ve(0),to:Ve(100/ae+.5)}}function vo(){return{from:Ke(0),to:Ke(le)}}function wo(){return{from:Ue(0),to:Ue(1.04)}}function xo(){return{from:Ge(0),to:Ge(360)}}function So(){return{from:"inset( 0% 0% 0% 0% )",to:"inset( 0% 0% 100% 0% )"}}function Co(){return{from:"inset( 0% 0% 0% 0% )",to:"inset( 0% 0% 0% 100% )"}}function Eo(){return{from:x([[-60,0],[100,0],[100,100],[0,100]]),to:x([[100,0],[260,0],[260,100],[160,100]])}}const ce=6,de=100,P=de/2,J=200,Xe=90,Ye=["#5c5c6d","#525261","#484855","#3e3e49","#34343d","#2a2a31"],Ao="#101014",To=1.25,H="http://www.w3.org/2000/svg";let Ro=0;function Q(o){return Math.round(o*1e3)/1e3}function he(o){return o/ce*Math.PI*2-Math.PI/2}function $o(o){const t=he(o)+Math.PI/ce+Math.PI/2;return{x:Math.cos(t),y:Math.sin(t)}}function Lo(o){const e=he(o),t=he(o+1);return[[P,P],[P+Math.cos(e)*J,P+Math.sin(e)*J],[P+Math.cos(t)*J,P+Math.sin(t)*J]]}function Ze(o,e){const t=Lo(o),n=document.createElementNS(H,"path");return n.setAttribute("d",`M ${t.map(([s,i])=>`${Q(s)} ${Q(i)}`).join(" L ")} Z`),e?n.setAttribute("fill","#fff"):(n.setAttribute("fill",Ye[o%Ye.length]),n.setAttribute("stroke",Ao),n.setAttribute("stroke-width",String(To)),n.setAttribute("vector-effect","non-scaling-stroke"),n.setAttribute("stroke-linejoin","round")),n}function Io(){const o=`os-iris-${++Ro}`,e=document.createElementNS(H,"svg");e.setAttribute("viewBox",`0 0 ${de} ${de}`),e.setAttribute("preserveAspectRatio","none"),e.setAttribute("aria-hidden","true"),e.style.width="100%",e.style.height="100%",e.style.display="block";const t=document.createElementNS(H,"defs"),n=document.createElementNS(H,"mask");n.setAttribute("id",o);const s=document.createElementNS(H,"g"),i=document.createElementNS(H,"g");i.setAttribute("mask",`url(#${o})`);const r=[];for(let l=0;l<ce;l++){const c=Ze(l,!0),d=Ze(l,!1);s.appendChild(c),i.appendChild(d),r.push({el:c,index:l},{el:d,index:l})}n.appendChild(s),t.appendChild(n),e.appendChild(t),e.appendChild(i);const a=document.createElement("div");return a.appendChild(e),{element:a,play:l=>r.map(({el:c,index:d})=>{const h=$o(d),p=Q(h.x*Xe),m=Q(h.y*Xe);return c.animate([{transform:"translate( 0px, 0px )"},{transform:`translate( ${p}px, ${m}px )`}],{duration:l.duration,easing:l.easing,delay:l.delay,fill:"both"})})}}const No="none",Je=X("desktop-mode/window-reveal-registry",()=>({registry:new Map,listeners:new Set})),Oo=Je.state.registry,Mo=Je.state.listeners,Qe=/^[a-z0-9_/-]+$/;function et(o){const e=/^\s*([a-zA-Z-]+)\s*\(/.exec(o);return e?e[1].toLowerCase():""}function tt(o,e){const t=[],n=typeof o.from=="string"&&o.from.trim()!=="",s=typeof o.to=="string"&&o.to.trim()!=="";if(n||t.push(`${e}.from (missing โ the clip-path covering the window)`),s||t.push(`${e}.to (missing โ the clip-path uncovering the window)`),n&&s){const i=et(o.from),r=et(o.to);i===""||r===""?t.push(`${e}.from|to (must be shape functions, e.g. \`inset( โฆ )\` or \`polygon( โฆ )\` โ bare keywords like \`none\` cannot be animated)`):i!==r&&t.push(`${e}.from|to (must use the same shape function to interpolate โ got \`${i}()\` and \`${r}()\`)`)}return t}function Po(o){if(typeof KeyframeEffect!="function")return!0;try{return new KeyframeEffect(null,null,{easing:o}),!0}catch{return!1}}function w(o){const e=[];if(!o||typeof o!="object")e.push("def (not an object)");else{typeof o.id!="string"||o.id.trim()===""?e.push("id (missing)"):Qe.test(o.id.trim().toLowerCase())?o.id.trim().toLowerCase()===No&&e.push('id ("none" is reserved)'):e.push(`id (must match ${Qe} โ lowercase alphanum, hyphens, underscores, slashes for vendor/sub-id)`),(typeof o.label!="string"||o.label.trim()==="")&&e.push("label (missing)");const n=o.render!==void 0,s=Array.isArray(o.layers),i=o.from!==void 0||o.to!==void 0;n&&typeof o.render!="function"?e.push("render (not a function)"):n&&(s||i)?e.push("render|layers|from|to (supply exactly one of: a from/to pair, a layers array, or a render function)"):n||(s&&i?e.push("layers|from|to (supply EITHER a single from/to pair OR a layers array, not both)"):s?(o.layers.length===0&&e.push("layers (empty โ supply at least one matched pair)"),o.layers.forEach((r,a)=>{if(!r||typeof r!="object"){e.push(`layers[ ${a} ] (not an object)`);return}e.push(...tt(r,`layers[ ${a} ]`))})):e.push(...tt(o,"").map(r=>r.replace(/^\./,"")))),o.easing!==void 0&&(typeof o.easing!="string"||o.easing.trim()===""?e.push("easing (not a non-empty string)"):Po(o.easing)||e.push("easing (not an easing the browser can parse โ `Element.animate()` would throw at play time, with the covering surface already over the window)"))}uo("WindowReveal",e,o);const t=o.id.trim().toLowerCase();Oo.set(t,{...o,id:t}),Ho()}function Ho(){const o=Array.from(Mo);for(const e of o)try{e()}catch(t){typeof console<"u"&&console.error("[openstation] window-reveal registry listener threw:",t)}}w({id:"sweep",label:u("Sweep"),description:u("A straight edge travels across the window, uncovering the page behind it."),...Co(),duration:420}),w({id:"iris",label:u("Iris"),description:u("The page opens out from the centre of the window, like a camera shutter."),...bo(),duration:520}),w({id:"curtain",label:u("Curtain"),description:u("Two panels part from the middle of the window and slide off the sides."),...go(),duration:480}),w({id:"blinds",label:u("Blinds"),description:u("Six horizontal slats retract at once, letting the page through between them."),...yo(),duration:560}),w({id:"diagonal",label:u("Diagonal"),description:u("A slanted edge sweeps off the trailing corner of the window."),...Eo(),duration:460}),w({id:"rise",label:u("Rise"),description:u("The page rises into the window from the bottom edge upward."),...So(),duration:440}),w({id:"shutter",label:u("Shutter"),description:u("Two panels part from the middle of the window and slide off the top and bottom."),...ko(),duration:480}),w({id:"slats",label:u("Slats"),description:u("Eight vertical slats retract at once, letting the page through between them."),..._o(),duration:560}),w({id:"diamond",label:u("Diamond"),description:u("The page opens out from the centre of the window through a growing rhombus."),...vo(),duration:520}),w({id:"mosaic",label:u("Mosaic"),description:u("The page arrives as a grid of tiles, each opening out from its own centre."),...wo(),duration:600}),w({id:"obturator",label:u("Camera shutter"),description:u("Six wedges slide aside in unison, opening a hexagonal aperture from the centre like the iris of a camera lens."),render:Io,duration:720,edgeLag:0}),w({id:"radar",label:u("Radar"),description:u("A spoke sweeps a full turn around the centre of the window, uncovering the page behind it."),...xo(),duration:760});const ot={dockSize:["compact","default","large"],desktopLayout:["classic","unified"],dockPlacement:["bottom","left","right"],windowRadius:["sharp","default","round"],adminBarMode:["static","dynamic","hidden"]},nt=["dockRailRenderer","windowReveal","accent"],st={windowRevealDuration:{min:80,max:4e3}},zo=/^[a-z0-9_-]+$/;[...Object.keys(ot),...nt,...Object.keys(st)];function Do(o){if(!o||typeof o!="object"||Array.isArray(o))return{};const e=o,t={},n={};for(const[s,i]of Object.entries(ot)){const r=e[s];typeof r=="string"&&i.includes(r)&&(t[s]=r)}for(const s of nt){const i=e[s];typeof i=="string"&&zo.test(i)&&(t[s]=i)}for(const[s,i]of Object.entries(st)){const r=e[s];typeof r=="number"&&Number.isFinite(r)&&(n[s]=Math.min(i.max,Math.max(i.min,Math.round(r))))}return{...t,...n}}const jo=/^[a-z0-9_-]+$/,it=128;function Wo(o){return typeof o!="string"||o===""||o.length>2048?!1:o.startsWith("dashicons-")||o.startsWith("https://")||o.startsWith("http://")||o.startsWith("data:image/")}function Fo(o){if(!o||typeof o!="object")return null;const e=o,t=typeof e.slug=="string"?e.slug:"";if(!jo.test(t))return null;const n={};if(e.icons&&typeof e.icons=="object"){let l=0;for(const[c,d]of Object.entries(e.icons)){if(l>=it)break;c===""||!Wo(d)||(n[c]=d,l+=1)}}const s={};if(e.tokens&&typeof e.tokens=="object")for(const[l,c]of Object.entries(e.tokens))typeof c=="string"&&(s[l]=c);const i=[];if(Array.isArray(e.fonts))for(const l of e.fonts)typeof l=="string"&&l!==""&&i.push(l);const r={};if(e.iconColors&&typeof e.iconColors=="object"){let l=0;for(const[c,d]of Object.entries(e.iconColors)){if(l>=it)break;c===""||typeof d!="string"||d===""||(r[c]=d,l+=1)}}const a=l=>typeof e[l]=="string"?e[l]:"";return{id:a("id")||t,slug:t,name:a("name")||t,version:a("version"),author:a("author"),description:a("description"),previewUrl:a("previewUrl"),cssUrl:a("cssUrl"),cssText:a("cssText"),tokens:s,fonts:i,icons:n,iconColors:r,recommendedOsSettings:Do(e.recommendedOsSettings),installedAt:typeof e.installedAt=="number"?e.installedAt:0,source:e.source==="code"?"code":"upload",cssDeferred:e.cssDeferred===!0}}function qo(){const e=window.openStationConfig?.serverDesktopThemes,t=[];if(Array.isArray(e))for(const n of e){const s=Fo(n);s&&t.push(s)}return{themes:t,activeId:null,activeIcons:null,activeIconColors:null}}const Bo=X("desktop-mode/desktop-themes",qo);function rt(){return Bo}function Vo(o){const e=rt().state;if(e.activeIcons===null)return null;const t=e.activeIcons[o];if(typeof t!="string"||t==="")return null;const n=Oe(Me.DESKTOP_THEME_ICON,t,{slot:o,themeId:e.activeId??""});return typeof n=="string"&&n!==""?n:null}function Ko(o){const e=rt().state;if(e.activeIconColors===null||!o)return null;const t=e.activeIconColors[o];if(typeof t!="string"||t==="")return null;const n=Oe(Me.DESKTOP_THEME_ICON_COLOR,t,{slot:o,themeId:e.activeId??""});return typeof n=="string"&&n!==""?Uo(n):null}function Uo(o){const e=o.trim();if(e===""||e.length>64||/[;{}<>"'\\]/.test(e))return null;let t=0;for(const n of e)if(n==="(")t+=1;else if(n===")"&&(t-=1,t<0))return null;return t===0?e:null}const at={RECYCLE_RESTORE:"RECYCLE_RESTORE",RECYCLE_DELETE:"RECYCLE_DELETE"};function Go(o){const e=document.createElement("button");e.type="button",e.setAttribute("data-noclick",""),e.setAttribute("aria-label",o.label),e.title=o.label;const t=o.variant==="danger",n=t?"var( --os-ui-danger, #d63638 )":"var( --os-ui-fg-muted, #50575e )",s=t?"var( --os-ui-danger, #d63638 )":"var( --os-ui-border, #c3c4c7 )",i="var( --os-ui-surface, #fff )",r=()=>{e.style.background=i,e.style.color=n,e.style.borderColor=s},a=()=>{t?(e.style.background="var( --os-ui-danger, #d63638 )",e.style.color="var( --os-ui-fg-on-accent, #fff )",e.style.borderColor="var( --os-ui-danger, #d63638 )"):(e.style.background="var( --os-ui-hover, #f0f0f1 )",e.style.color="var( --os-ui-fg, #1d2327 )",e.style.borderColor="var( --os-ui-border-strong, #8c8f94 )")},l=o.labelled===!0;if(e.style.cssText=["display: inline-flex","align-items: center","justify-content: center",l?"gap: 6px":"",l?"flex: 0 0 auto":"flex: 0 0 30px",l?"width: auto":"width: 30px",l?"height: 36px":"height: 30px",l?"padding: 0 12px":"padding: 0",l?"font-size: 13px":"",l?"font-weight: 600":"","margin: 0","border: 1px solid "+s,"border-radius: 6px","background: "+i,"color: "+n,"cursor: pointer","box-sizing: border-box","line-height: 1","font: inherit","transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease"].join(";"),e.addEventListener("mouseenter",a),e.addEventListener("mouseleave",r),e.addEventListener("focus",a),e.addEventListener("blur",r),e.appendChild(o.glyph),l){const c=document.createElement("span");c.textContent=o.label,c.style.cssText="white-space: nowrap; line-height: 1;",e.appendChild(c)}return e.addEventListener("click",c=>{c.stopPropagation(),o.onClick()}),e}function Xo(o){return o==="attachment"?"attachment":o==="comment"?"comment":"post"}const lt={post:{bg:"#dbe9fe",fg:"#1d4ed8"},page:{bg:"#e0f2fe",fg:"#075985"},attachment:{bg:"#fef3c7",fg:"#92400e"},comment:{bg:"#dcfce7",fg:"#166534"},_default:{bg:"var( --os-ui-surface-sunken, #e5e7eb )",fg:"var( --os-ui-fg-muted, #374151 )"}};function Yo(o){return o?o.replace(/[_-]+/g," ").replace(/\b\w/g,e=>e.toUpperCase()):""}function Zo(o){const e=o.type_label&&o.type_label.length>0?o.type_label:Yo(o.type),t=lt[o.type]??lt._default,n=document.createElement("span");return n.setAttribute("data-os-recycle-bin-type-badge",o.type),n.textContent=e,n.style.cssText=["display: inline-flex","align-items: center","flex-shrink: 0","padding: 2px 8px","border-radius: 999px","font-size: 11px","font-weight: 600","line-height: 1.4","letter-spacing: 0.2px","text-transform: uppercase","white-space: nowrap","background: "+t.bg,"color: "+t.fg].join(";"),n}const Jo={restore:'<path d="M12 5V2L7 6l5 4V7c2.76 0 5 2.24 5 5 0 .83-.21 1.61-.57 2.3l1.46 1.46A6.96 6.96 0 0 0 19 12c0-3.87-3.13-7-7-7zm0 12c-2.76 0-5-2.24-5-5 0-.83.21-1.61.57-2.3L6.11 8.24A6.96 6.96 0 0 0 5 12c0 3.87 3.13 7 7 7v3l5-4-5-4v3z" fill="currentColor"/>',trash:'<path d="M9 3v1H4v2h1v13a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6h1V4h-5V3H9zm0 5h2v9H9V8zm4 0h2v9h-2V8z" fill="currentColor"/>'};function ct(o){const e=o.icon==="restore"?at.RECYCLE_RESTORE:at.RECYCLE_DELETE,t=Vo(e),n=Ko(e)??"currentColor",s=t!==null&&!t.startsWith("dashicons-")&&/^(https?:\/\/|data:image\/)/i.test(t)&&!/['"()\\<>\s]/.test(t);let i;if(s){const r=document.createElement("span");r.setAttribute("aria-hidden","true"),r.style.cssText=["display: block","width: 18px","height: 18px","flex-shrink: 0",`background-color: ${n}`,`-webkit-mask: url("${t}") center / contain no-repeat`,`mask: url("${t}") center / contain no-repeat`].join(";"),i=r}else{const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("width","18"),a.setAttribute("height","18"),a.setAttribute("viewBox","0 0 24 24"),a.setAttribute("aria-hidden","true"),a.setAttribute("focusable","false"),a.style.display="block",a.innerHTML=Jo[o.icon]??"",i=a}return Go({label:o.label,glyph:i,onClick:o.onClick,variant:o.variant,labelled:o.labelled})}function Qo(o,e={}){const t=e.phone===!0,n=t?"font-weight:600;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere;":"font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:320px;",s=[{key:"title",label:u("Title"),sortable:!0,stack:"title",render:(r,a)=>{const l=document.createElement("span");if(l.style.cssText="display:flex;align-items:center;gap:10px;min-width:0;",a.preview&&a.type==="attachment"&&a.mime.startsWith("image/")){const f=document.createElement("img");f.src=a.preview,f.alt="",f.loading="lazy",f.style.cssText="width:36px;height:36px;border-radius:4px;object-fit:cover;display:block;flex-shrink:0;",l.appendChild(f)}const d=document.createElement("span");d.style.cssText="display:flex;flex-direction:column;gap:2px;min-width:0;";const h=document.createElement("span");h.style.cssText="display:flex;align-items:center;gap:8px;min-width:0;",h.appendChild(Zo(a));const p=document.createElement("span");p.style.cssText=n;const m=$e(a.title);if(p.textContent=m,p.title=m,h.appendChild(p),d.appendChild(h),a.subtitle){const f=document.createElement("span");f.style.cssText="font-size:12px;color:var( --os-ui-fg-muted, #50575e );white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:320px;";const k=$e(a.subtitle);f.textContent=k,f.title=k,d.appendChild(f)}return l.appendChild(d),l}},{key:"deleted_at",label:u("Deleted"),sortable:!0,stack:"meta",width:"180px",sortValue:r=>Date.parse(r.deleted_at+"Z")||0,render:(r,a)=>{const l=document.createElement("os-relative-time");return l.setAttribute("datetime",a.deleted_at),l}},{key:"deleted_by",label:u("By"),sortable:!0,stack:"meta",width:"160px",render:(r,a)=>a.deleted_by||"โ"},{key:"__actions",label:"",stack:"actions",width:"96px",align:"end",render:(r,a)=>{const l=document.createElement("span");return l.style.cssText=t?"display:flex;gap:8px;align-items:center;flex-wrap:wrap;line-height:1;":"display:inline-flex;gap:4px;justify-content:flex-end;align-items:center;flex-wrap:nowrap;white-space:nowrap;line-height:1;",a.can_restore&&l.appendChild(ct({label:u("Restore"),icon:"restore",labelled:t,onClick:()=>o.onRestore({id:a.id,type:a.type})})),a.can_purge&&l.appendChild(ct({label:u("Delete forever"),icon:"trash",variant:"danger",labelled:t,onClick:()=>o.onPurge({id:a.id,type:a.type})})),l}}],i=window.wp?.hooks;return i&&typeof i.applyFilters=="function"?i.applyFilters("openstation.recycleBin.columns",s):s}const dt="desktop-mode-recycle-bin",F=()=>({selected:[],listKey:"",fingerprint:"",empty:{mode:"idle",purged:0,total:0},refreshTimer:null,lastArt:"",phoneColumns:null});function en(o){return o.length===0?"":o.map(e=>JSON.stringify(e)).sort().join("|")}function ue(o,e){const t={kind:o,ok:e,errors:[],source:"local"};document.dispatchEvent(new CustomEvent("os-recycle-bin-changed",{detail:t}));const n=window.wp?.hooks;n&&typeof n.doAction=="function"&&n.doAction("openstation.recycleBin.changed",t)}const pe=o=>o.root.querySelector("[data-os-trash-table]");function q(o){const e=pe(o);if(!e)return[];const t=new Set(Array.from(e.selection??[],String)),n=[];for(const s of e.visibleRows??[])t.has(`${s.type}:${s.id}`)&&n.push({id:s.id,type:s.type});return n}function fe(o){pe(o)?.clearSelection(),o.ui(F).selected=[]}async function ht(o,e,t){const n=e.flatMap(s=>{const i=o.data.items.find(a=>E(a)===E(s)),r=i&&te(i,"out");return r?[{ref:s,operation:r}]:[]});if(n.length!==0){fe(o);try{const s=await o.dispatch(t,{items:n.map(a=>a.ref)}),i=new Set(o.data.items.map(E));let r=0;for(const{ref:a,operation:l}of n){const c=s&&!i.has(E(a));r+=Number(c),l.finish(c)}r>0&&ue(t,r)}catch{for(const{operation:s}of n)s.finish(!1)}}}async function ut(o,e){await ht(o,e,"restore")}async function pt(o,e){if(e.length===0)return;await o.host.confirm?.({title:u("Delete forever?"),message:K(u("Permanently delete %d item(s)? This cannot be undone."),e.length),confirmLabel:u("Delete forever"),danger:!0})&&await ht(o,e,"purge")}async function tn(o,e){if(e.length===0)return;const t=window.wp?.os?.files?.rest;fe(o);const n=e.flatMap(r=>{const a=o.data.items.find(c=>E(c)===E(r)),l=a&&te(a,"out");return l?[l]:[]});let s=0,i=0;for(const r of e){let a;try{const c=await o.fetch("desktop-mode/v1/recycle-bin/restore",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:[r]})});if(!c.ok)throw new Error(String(c.status));a=await c.json()}catch(c){console.error("[trash] pin-to-desktop restore failed",c);continue}if(!a.ok.includes(r.id))continue;i+=1;const l=Xo(r.type);if(!(!t||!l)){try{await t.createPlacement({type:l,ref:String(r.id),x:16+s%5*96,y:16+Math.floor(s/5)*110})}catch(c){console.error("[trash] pin-to-desktop placement failed",c)}s+=1}}ue("restore",i);try{await o.dispatch("refresh")}finally{n.forEach(r=>void r.finish(!1))}}async function on(o){if(!await o.host.confirm?.({title:u("Empty Trash?"),message:u("Permanently delete ALL items in the Trash? This includes every type and any items hidden by the current filter or search. This cannot be undone."),confirmLabel:u("Empty Trash"),danger:!0}))return;const t=o.ui(F),n=o.data.items.flatMap(s=>{const i=te(s,"out");return i?[i]:[]});t.empty={mode:"starting",purged:0,total:0},o.repaint();try{const s=await Gt({emptyBin:async()=>{const i=await o.fetch("desktop-mode/v1/recycle-bin/empty",{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"});if(!i.ok)throw new Error(String(i.status));return await i.json()},onProgress:({purged:i,initialTotal:r})=>{t.empty={mode:"progress",purged:i,total:r},o.repaint()}});ue("empty",s.purged),s.skipped>0&&o.host.toast?.({message:K(u("%d item(s) skipped (insufficient permissions)."),s.skipped)})}catch(s){console.error("[trash] empty failed",s)}finally{t.empty={mode:"idle",purged:0,total:0},fe(o);try{await o.dispatch("refresh")}finally{n.forEach(s=>void s.finish(!1)),o.repaint()}}}function nn(o){return o.empty.mode==="idle"?u("Empty Trash"):o.empty.mode==="starting"||o.empty.total===0?u("Emptyingโฆ"):K(u("Emptyingโฆ %1$d of %2$d"),o.empty.purged,o.empty.total)}function ft(o,e,t){return C` | |
| 12 | - <span class="os-recycle-bin__count">${K(u("%d selected"),e.selected.length)}</span> | |
| 13 | - <os-button variant="secondary" @click=${()=>void ut(o,q(o))}> | |
| 9 | + `}requestUpdate(){super.requestUpdate(),this._schedulePaint()}_schedulePaint(){this._paintScheduled||!this.isConnected||(this._paintScheduled=!0,queueMicrotask(()=>{this._paintScheduled=!1,this.isConnected&&this._paint()}))}_paint(){const e=this.shadowRoot;if(!e)return;e.querySelector("tbody")||D(this.render(),e);const o=e.querySelector("colgroup"),s=e.querySelector("thead"),n=e.querySelector("tbody");if(!o||!s||!n)return;const r=this._effectiveColumns();this._stacked=this.hasAttribute("stacked");const i=this._readStickyColumns();this._lastStickyIndex=this._computeLastStickyIndex(r,i),this._paintColgroup(o,r),this._paintHead(s,r,i),this._paintBody(n,r,i),this._applyStickyOffsets(),this._measureHeaderHeight(),this._scheduleStickyOffsets(),this._maybeWarnStickyHeader(),this._maybeWarnLoadingDesync(n),this._ensureResizeObserver()}_maybeWarnLoadingDesync(e){this._loadingDesyncWarned||this.hasAttribute("loading")&&(e.querySelector("tr.skeleton")||(this._loadingDesyncWarned=!0,console.warn("[os-table] `loading` attribute is set but no skeleton rows rendered. Either attributeChangedCallback didn't route through requestUpdate (framework regression), or `loading` was set after the most recent paint and no follow-up trigger ran. Toggling `data` will force a paint as a workaround.")))}_scheduleStickyOffsets(){this._stickyMicroScheduled||(this._stickyMicroScheduled=!0,queueMicrotask(()=>{this._stickyMicroScheduled=!1,this.isConnected&&this._applyStickyOffsets()})),this._stickyRafHandle===null&&typeof requestAnimationFrame<"u"&&(this._stickyRafHandle=requestAnimationFrame(()=>{this._stickyRafHandle=null,this.isConnected&&(this._applyStickyOffsets(),this._measureHeaderHeight())}))}_ensureResizeObserver(){if(this._resizeObserver||typeof ResizeObserver>"u")return;const e=this.shadowRoot?.querySelector(".scroll");e&&(this._resizeObserver=new ResizeObserver(()=>{this.isConnected&&(this._applyStickyOffsets(),this._measureHeaderHeight(),this._stickyHeaderWarned=!1,this._maybeWarnStickyHeader())}),this._resizeObserver.observe(e),this._resizeObserver.observe(this))}_paintColgroup(e,o){const s=[];for(const n of o){const r=document.createElement("col");n.width&&(r.style.width=n.width),s.push(r)}e.replaceChildren(...s)}_paintHead(e,o,s){const n=document.createElement("tr");n.setAttribute("part","header-row");for(let l=0;l<o.length;l++)n.appendChild(this._buildHeaderCell(o[l],l,s));const r=e.querySelector(':scope > tr[part="header-row"]');r?e.replaceChild(n,r):e.insertBefore(n,e.firstChild);const i=o.some(l=>l.filter||Array.isArray(l.filterOptions)||typeof l.filterRender=="function");let a=e.querySelector(":scope > tr.filter-row");if(i){const l=[];for(let u=0;u<o.length;u++)l.push(this._buildFilterCell(o[u],u,s));a||(a=document.createElement("tr"),a.classList.add("filter-row"),a.setAttribute("part","filter-row"),e.appendChild(a));const c=Array.from(a.children);let d=c.length===l.length;if(d){for(let u=0;u<l.length;u++)if(c[u]!==l[u]){d=!1;break}}if(!d){const u=new Set(l);for(const f of l)a.appendChild(f);for(const f of Array.from(a.children))u.has(f)||a.removeChild(f)}}else a&&a.remove()}_buildHeaderCell(e,o,s){const n=document.createElement("th");if(n.setAttribute("scope","col"),n.dataset.key=e.key,this._applyCellClasses(n,e,o,s),e.minWidth&&(n.style.minWidth=e.minWidth),e.key===P){if(this._readSelectable()==="multi"){const i=document.createElement("input");i.type="checkbox",i.className="select-all-checkbox",i.setAttribute("data-noclick",""),i.setAttribute("aria-label","Select all rows");const{total:a,selected:l}=this._visibleSelectionStats();i.checked=a>0&&l===a,i.indeterminate=l>0&&l<a,i.addEventListener("change",()=>{i.checked?this.selectAll():this.clearSelection()}),n.appendChild(i)}return n}if(n.textContent=e.label??(e.key===O?"":e.key),e.sortable){n.classList.add("is-sortable");const r=this._sort?.key===e.key,i=document.createElement("span");i.className="sort-indicator";let a="";r&&(a=this._sort.direction==="asc"?" โฒ":" โผ"),i.textContent=a,n.appendChild(i),r&&n.classList.add(this._sort.direction==="asc"?"sort-asc":"sort-desc"),n.addEventListener("click",()=>this._cycleSort(e.key))}return n}_buildFilterCell(e,o,s){const n=this._filterCache.get(e.key),r=Array.isArray(e.filterOptions),i=typeof e.filterRender=="function";let a;if(!e.filter&&!r&&!i||e.key===O||e.key===P?a="none":i?a="custom":e.filter==="select"||r?a="select":a="text",n&&n.kind===a){if(n.th.className="",this._applyCellClasses(n.th,e,o,s),a==="select"){const u=n.control,f=this._resolveFilterOptions(e),m=f.map(p=>p.value).join("|");m!==n.optionsKey?(this._populateSelect(u,f,this._filters[e.key]??""),n.optionsKey=m):u.value=this._filters[e.key]??""}else if(a==="text"){const u=n.control,f=this._filters[e.key]??"";u.value!==f&&u.ownerDocument.activeElement!==u&&(u.value=f)}else a==="custom"&&e.filterRender&&e.filterRender(n.th,{value:this._filters[e.key]??"",setValue:u=>this._onFilterChange(e.key,u),col:e});return n.th}const l=document.createElement("th");if(this._applyCellClasses(l,e,o,s),a==="none")return this._filterCache.set(e.key,{th:l,control:null,optionsKey:"",kind:"none"}),l;if(a==="custom"&&e.filterRender)return e.filterRender(l,{value:this._filters[e.key]??"",setValue:u=>this._onFilterChange(e.key,u),col:e}),this._filterCache.set(e.key,{th:l,control:null,optionsKey:"",kind:"custom"}),l;let c,d="";if(a==="select"){const u=document.createElement("select");u.classList.add("filter-select"),u.setAttribute("data-noclick",""),u.setAttribute("aria-label",`Filter ${e.label??e.key}`);const f=this._resolveFilterOptions(e);this._populateSelect(u,f,this._filters[e.key]??""),d=f.map(m=>m.value).join("|"),u.addEventListener("change",()=>{this._onFilterChange(e.key,u.value)}),c=u}else{const u=document.createElement("input");u.type="search",u.classList.add("filter-input"),u.setAttribute("data-noclick",""),u.setAttribute("placeholder","Filterโฆ"),u.setAttribute("aria-label",`Filter ${e.label??e.key}`),u.value=this._filters[e.key]??"",u.addEventListener("input",()=>{this._onFilterChange(e.key,u.value)}),c=u}return l.appendChild(c),this._filterCache.set(e.key,{th:l,control:c,optionsKey:d,kind:a}),l}_populateSelect(e,o,s){e.replaceChildren();const n=document.createElement("option");n.value="",n.textContent="All",e.appendChild(n);for(const r of o){const i=document.createElement("option");i.value=r.value,i.textContent=r.label,r.value===s&&(i.selected=!0),e.appendChild(i)}e.value=s}_resolveFilterOptions(e){return Array.isArray(e.filterOptions)?e.filterOptions:this._uniqueValues(e.key).map(o=>({value:o,label:o}))}_paintBody(e,o,s){if(e.replaceChildren(),this.hasAttribute("loading")){const r=this._readLoadingRows();for(let i=0;i<r;i++)e.appendChild(this._buildSkeletonRow(o,i));return}const n=this._sortedRows(this._filteredRows());if(n.length===0){e.appendChild(this._buildEmptyRow(o.length));return}for(const{row:r,index:i}of n)if(e.appendChild(this._stacked?this._buildStackedRow(r,i,o):this._buildBodyRow(r,i,o,s)),this._expanded.has(i)&&this._subTable){const a=this._subTable(r,i);a&&e.appendChild(this._buildSubTableRow(a,o.length))}}_buildEmptyRow(e){const o=document.createElement("tr");o.classList.add("empty");const s=document.createElement("td");s.colSpan=e;const n=document.createElement("slot");return n.name="empty",n.textContent=this.getAttribute("empty")||"No data",s.appendChild(n),o.appendChild(s),o}_buildSkeletonRow(e,o){const s=document.createElement("tr");if(s.classList.add("skeleton"),s.setAttribute("aria-hidden","true"),this._stacked){s.classList.add("stack-row");const n=document.createElement("td");n.className="stack-body",n.colSpan=Math.max(1,e.length);for(const r of[55+o*7%25,30+o*11%15]){const i=document.createElement("span");i.className="skeleton-bar",i.style.width=`${r}%`,n.appendChild(i)}return s.appendChild(n),s}for(const n of e){const r=document.createElement("td"),i=document.createElement("span");i.className="skeleton-bar";const a=50+(o*7+s.children.length*13)%40;i.style.width=`${a}%`,r.appendChild(i),s.appendChild(r)}return s}_buildBodyRow(e,o,s,n){const r=document.createElement("tr");r.setAttribute("part","row"),r.dataset.rowIndex=String(o);const i=this._getRowId(e,o);r.dataset.rowId=String(i),this._selection.has(i)&&r.classList.add("is-selected"),r.addEventListener("click",a=>{this._onRowClick(e,o,a)});for(let a=0;a<s.length;a++)r.appendChild(this._buildBodyCell(s[a],a,e,o,n));return r}_buildStackedRow(e,o,s){const n=document.createElement("tr");n.setAttribute("part","row"),n.classList.add("stack-row"),n.dataset.rowIndex=String(o);const r=this._getRowId(e,o);n.dataset.rowId=String(r),this._selection.has(r)&&n.classList.add("is-selected"),n.addEventListener("click",c=>{this._onRowClick(e,o,c)});const i=document.createElement("td");i.className="stack-body";let a=0,l=0;for(let c=0;c<s.length;c++){const d=s[c];if(d.key===P||d.key===O){n.appendChild(this._buildBodyCell(d,c,e,o,0));continue}l++;const u=ao(d,a++);if(u==="hidden")continue;const f=document.createElement("div");if(f.className=`stack-cell stack-${u}`,f.dataset.key=d.key,u==="meta"&&d.label){const g=document.createElement("span");g.className="stack-label",g.textContent=d.label,f.appendChild(g)}const m=document.createElement("span");m.className="stack-value";const p=e[d.key],_=Z(p);d.render?this._mountCellContent(m,d.render(p,e,o)):_!==null?m.appendChild(this._slotFor(_)):p!=null&&(m.textContent=String(p)),f.appendChild(m),i.appendChild(f)}return i.colSpan=Math.max(1,l),n.appendChild(i),n}_buildBodyCell(e,o,s,n,r){const i=document.createElement("td");if(this._applyCellClasses(i,e,o,r),e.minWidth&&(i.style.minWidth=e.minWidth),e.key===P){const c=this._getRowId(s,n),d=document.createElement("input");return d.type="checkbox",d.className="select-row-checkbox",d.setAttribute("data-noclick",""),d.setAttribute("aria-label","Select row"),d.checked=this._selection.has(c),d.addEventListener("change",()=>{d.checked?this.select(c):this.deselect(c)}),i.appendChild(d),this._stacked&&(i.setAttribute("data-noclick",""),i.addEventListener("click",u=>{u.target===i&&(d.checked=!d.checked,d.dispatchEvent(new Event("change")))})),i}if(e.key===O){if(!(this._subTable?!!this._subTable(s,n):!1))return i;const d=this._expanded.has(n),u=document.createElement("button");return u.type="button",u.className="expander",u.setAttribute("data-noclick",""),u.setAttribute("aria-expanded",d?"true":"false"),u.setAttribute("aria-label",d?"Collapse row":"Expand row"),u.textContent=d?"โพ":"โธ",u.addEventListener("click",f=>{this._toggleRow(n,s,f)}),i.appendChild(u),i}const a=s[e.key],l=Z(a);if(e.render){const c=e.render(a,s,n);this._mountCellContent(i,c)}else l!==null?i.appendChild(this._slotFor(l)):a!=null&&(i.textContent=String(a));return i}_slotFor(e){const o=document.createElement("slot");return o.name=e,o}_buildSubTableRow(e,o){const s=document.createElement("tr");s.classList.add("subtable"),s.setAttribute("part","subtable-row");const n=document.createElement("td");n.colSpan=o;const r=document.createElement("div");if(r.classList.add("subtable-inner"),e instanceof Node)r.appendChild(e);else if(De(e))D(e,r);else{const i=document.createElement("os-table");i.columns=e.columns,i.data=e.data,e.subTable&&(i.subTable=e.subTable),r.appendChild(i)}return n.appendChild(r),s.appendChild(n),s}_mountCellContent(e,o){if(typeof o=="string"){e.textContent=o;return}if(o instanceof Node){e.appendChild(o);return}De(o)&&D(o,e)}_onFilterChange(e,o){o===""?delete this._filters[e]:this._filters[e]=o,this.emit("os-table-filter-change",{filters:{...this._filters}});const n=this.shadowRoot?.querySelector("tbody");if(n){const r=this._effectiveColumns(),i=this._readStickyColumns();this._lastStickyIndex=this._computeLastStickyIndex(r,i),this._paintBody(n,r,i),this._applyStickyOffsets()}}_onRowClick(e,o,s){const n=s.composedPath?.()??[];for(const r of n){if(r instanceof Element&&r.hasAttribute("data-noclick"))return;if(r===this)break}this.emit("os-table-row-click",{row:e,index:o,originalEvent:s})}_toggleRow(e,o,s){s.stopPropagation();const n=this._expanded.has(e);n?this._expanded.delete(e):this._expanded.add(e),this.emit("os-table-expand-change",{row:o,index:e,expanded:!n}),this._schedulePaint()}_cycleSort(e){!this._sort||this._sort.key!==e?this._sort={key:e,direction:"asc"}:this._sort.direction==="asc"?this._sort={key:e,direction:"desc"}:this._sort=null,this.emit("os-table-sort-change",{sort:this._sort?{...this._sort}:null}),this._schedulePaint()}_emitSelectionChange(){this.emit("os-table-selection-change",{selection:Array.from(this._selection),rows:this.selectedRows})}_filteredRows(){const e=[],o=Object.keys(this._filters).filter(s=>this._filters[s]!=="");for(let s=0;s<this._data.length;s++){const n=this._data[s];let r=!0;for(const i of o){const a=this._columns.find(u=>u.key===i);if(a&&typeof a.filterRender=="function")continue;const l=this._filters[i]??"",c=n[i],d=ae(c);if(a?.filter==="select"){if(d!==l){r=!1;break}}else if(!d.toLowerCase().includes(l.toLowerCase())){r=!1;break}}r&&e.push({row:n,index:s})}return e}_sortedRows(e){if(!this._sort)return e;const o=this._columns.find(r=>r.key===this._sort.key);if(!o)return e;const s=this._sort.direction==="desc"?-1:1,n=e.slice();return n.sort((r,i)=>{const a=r.row[o.key],l=i.row[o.key],c=o.sortValue?o.sortValue(r.row,a):je(a),d=o.sortValue?o.sortValue(i.row,l):je(l);return lo(c,d)*s}),n}_uniqueValues(e){const o=new Set;for(const s of this._data){const n=s[e];n!=null&&o.add(ae(n))}return Array.from(o).sort()}_visibleSelectionStats(){let e=0,o=0;for(const{row:s,index:n}of this._filteredRows())e++,this._selection.has(this._getRowId(s,n))&&o++;return{total:e,selected:o}}_readStickyColumns(){const e=parseInt(this.getAttribute("sticky-columns")||"0",10);return Number.isFinite(e)&&e>0?e:0}_readLoadingRows(){const e=parseInt(this.getAttribute("loading-rows")||"5",10);return Number.isFinite(e)&&e>0?Math.min(e,100):5}_readSelectable(){const e=this.getAttribute("selectable");return e==="single"?"single":e==="multi"||e===""?"multi":null}_isStickyIndex(e,o,s){return this._stacked||s.sticky===!1?!1:s.sticky===!0?!0:e<o}_computeLastStickyIndex(e,o){let s=-1;for(let n=0;n<e.length;n++)this._isStickyIndex(n,o,e[n])&&(s=n);return s}_applyCellClasses(e,o,s,n){o.key===O&&e.classList.add("col-expander"),o.key===P&&e.classList.add("col-select"),o.align==="center"&&e.classList.add("align-center"),o.align==="end"&&e.classList.add("align-end"),this._isStickyIndex(s,n,o)&&(e.classList.add("is-sticky"),s===this._lastStickyIndex&&e.classList.add("is-sticky-edge"))}_effectiveColumns(){const e=[];return this._readSelectable()&&e.push({key:P,label:"",width:"40px",align:"center"}),this._subTable&&e.push({key:O,label:"",width:"36px",align:"center"}),e.push(...this._columns),e}_applyStickyOffsets(){const e=this.shadowRoot;if(!e)return;const o=e.querySelector("thead tr");if(!o)return;const s=Array.from(o.children),n=[];let r=0;for(let a=0;a<s.length;a++)n[a]=r,s[a].classList.contains("is-sticky")&&(r+=s[a].offsetWidth);e.querySelectorAll("thead tr, tbody tr:not(.subtable):not(.empty):not(.skeleton)").forEach(a=>{const l=Array.from(a.children);for(let c=0;c<l.length;c++)l[c].classList.contains("is-sticky")&&(l[c].style.insetInlineStart=`${n[c]}px`)}),this._maybeWarnStickyOffsetRace(s,n)}_maybeWarnStickyOffsetRace(e,o){if(this._stickyRaceWarned)return;const s=this._readStickyColumns();if(s<2)return;const n=Math.min(s-1,e.length-1);if(n<=0||o[n]!==0||this.offsetWidth===0)return;this._stickyRaceWarned=!0;const r=e[0]?.offsetWidth??0;console.warn(`[os-table] sticky-columns: column ${n} resolved to inset-inline-start: 0px while the host is visible. ths[0].offsetWidth was ${r}px at measurement time. Likely a layout race โ call recomputeLayout() after the panel finishes its mount/transition, or wrap the assignment of \`data\` in a requestAnimationFrame.`)}_measureHeaderHeight(){const e=this.shadowRoot;if(!e)return;const o=e.querySelector("thead tr");if(!o)return;const s=o.offsetHeight;s>0&&this.style.setProperty("--os-ui-table-header-height",`${s}px`)}_maybeWarnStickyHeader(){if(this._stickyHeaderWarned||!this.hasAttribute("sticky-header")||this.hasAttribute("loading")||this._data.length<8)return;const e=this.shadowRoot?.querySelector(".scroll");e&&e.offsetWidth!==0&&e.scrollHeight<=e.clientHeight+1&&(this._stickyHeaderWarned=!0,console.warn("[os-table] sticky-header is set but the table has no scroll container. Set --os-ui-table-max-height on the host (or wrap it in a scrolling parent) so the header has something to stick to."))}};V.props=["stickyColumns","stickyHeader","striped","hover","compact","bordered","empty","loading","loadingRows","selectable","stacked"],V.styles=[io],V.help=void 0;let ie=V;function De(t){return!!t&&t.__wpdHtml===!0}function ao(t,e){return t.stack?t.stack:e===0?"title":t.label?"meta":"actions"}function Z(t){return t&&typeof t=="object"&&typeof t.slot=="string"?t.slot:null}function ae(t){if(t==null)return"";if(Z(t)!==null){const e=t.text;return e==null?"":String(e)}return String(t)}function je(t){return Z(t)!==null?ae(t):t}function lo(t,e){if(t===e)return 0;if(t==null)return-1;if(e==null)return 1;if(typeof t=="number"&&typeof e=="number")return t-e;if(t instanceof Date&&e instanceof Date)return t.getTime()-e.getTime();const o=Number(t),s=Number(e);return Number.isFinite(o)&&Number.isFinite(s)?o-s:String(t).localeCompare(String(e))}Oe("os-table",ie);const co=1e3;async function uo(t){const{emptyBin:e,onProgress:o,maxIterations:s=co}=t;let n=0,r=0,i=0,a=0,l="iteration-cap";for(let c=0;c<s;c++){const d=await e();if(n+=d.purged,r+=d.skipped,a=d.remaining,c===0&&(i=n+d.remaining),o?.({purged:n,skipped:r,initialTotal:i}),d.remaining===0){l="empty";break}if(d.purged===0&&d.skipped>0){l="no-progress";break}}return{purged:n,skipped:r,initialTotal:i,remaining:a,stoppedBecause:l}}const ho="os-recycle-bin-changed",fo="openstation_recycle_bin_seen_ts",po="os-recycle-bin-changed",b={started:!1,seenTs:0,postMessageHandler:null,heartbeatSendHandler:null,heartbeatTickHandler:null};function Fe(t,e){const o={kind:"external",ok:0,errors:[],source:t,ts:e};document.dispatchEvent(new CustomEvent(ho,{detail:o}));const s=window.wp?.hooks;s&&typeof s.doAction=="function"&&s.doAction("openstation.recycleBin.changed",o)}function mo(){if(b.started)return;b.started=!0,b.seenTs=Date.now();const t=window.location.origin;b.postMessageHandler=o=>{if(o.origin!==t)return;const s=o.data;if(!s||s.type!==po)return;const n=typeof s.ts=="number"?s.ts:Date.now();n<=b.seenTs||(b.seenTs=n,Fe("chromeless",n))},window.addEventListener("message",b.postMessageHandler);const e=window.jQuery;e&&(b.heartbeatSendHandler=(...o)=>{const s=o[1];s&&(s[fo]=b.seenTs)},e(document).on("heartbeat-send",b.heartbeatSendHandler),b.heartbeatTickHandler=(...o)=>{const n=o[1]?.openstation_recycle_bin;if(!n)return;const r=typeof n.ts=="number"?n.ts:0;r>b.seenTs&&(b.seenTs=r,n.changed&&Fe("heartbeat",r))},e(document).on("heartbeat-tick",b.heartbeatTickHandler))}function bo(){if(!b.started)return;b.started=!1,b.postMessageHandler&&(window.removeEventListener("message",b.postMessageHandler),b.postMessageHandler=null);const t=window.jQuery;t&&(b.heartbeatSendHandler&&t(document).off("heartbeat-send",b.heartbeatSendHandler),b.heartbeatTickHandler&&t(document).off("heartbeat-tick",b.heartbeatTickHandler)),b.heartbeatSendHandler=null,b.heartbeatTickHandler=null}function le(t){const e=document.createElement("textarea");return e.innerHTML=t,e.value}const go=k`:host{display:inline;color:inherit;font:inherit}`,J=new Set;let F=null;const yo=3e4;function ko(){F===null&&(F=window.setInterval(()=>{for(const t of J)t.tick()},yo))}function _o(){F!==null&&J.size===0&&(window.clearInterval(F),F=null)}function vo(t){if(!t)return null;const e=o=>{const s=new Date(o);return Number.isNaN(s.getTime())?null:s};return wo(t)?e(t):e(t.replace(" ","T")+"Z")}function wo(t){const e=Math.max(t.indexOf("T"),t.indexOf(" ")),o=e===-1?"":t.slice(e+1);return/(?:[Zz]|[+-]\d{2}:?\d{2})$/.test(o)}let ce=null,de=null;function We(){return typeof navigator<"u"&&navigator.language||"en"}function xo(){return ce||(ce=new Intl.RelativeTimeFormat(We(),{numeric:"auto"})),ce}function qe(){return de||(de=new Intl.RelativeTimeFormat(We(),{numeric:"always",style:"narrow"})),de}function So(t,e){const o=xo(),s=t.getTime()-e,n=Math.round(s/1e3),r=Math.abs;return r(n)<45?o.format(0,"second"):Be(o,n)}function Be(t,e){const o=Math.abs,s=Math.round(e/60);if(o(s)<45)return t.format(s,"minute");const n=Math.round(s/60);if(o(n)<22)return t.format(n,"hour");const r=Math.round(n/24);if(o(r)<26)return t.format(r,"day");const i=Math.round(r/30);if(o(i)<11)return t.format(i,"month");const a=Math.round(r/365);return t.format(a,"year")}function Co(t,e){const o=Math.round((t.getTime()-e)/1e3),s=Math.abs;return s(o)<45?qe().format(0,"second"):s(o)>604800?t.toLocaleDateString(void 0,{month:"short",day:"numeric"}):Be(qe(),o)}const K=class K extends Y{connectedCallback(){super.connectedCallback(),J.add(this),ko()}disconnectedCallback(){J.delete(this),_o()}tick(){this.requestUpdate()}render(){const e=this.datetime,o=vo(e);if(!o)return E`<span>${e??""}</span>`;const s=Date.now(),n=this.hasAttribute("compact")?Co(o,s):So(o,s),r=o.toLocaleString();return E`<time datetime=${o.toISOString()} title=${r} | |
| 10 | + >${n}</time | |
| 11 | + >`}};K.props=["datetime","compact"],K.styles=[go],K.help=void 0;let ue=K;Oe("os-relative-time",ue);function Eo(){const t=window.wp?.hooks;if(!t)throw new Error("[openstation] `window.wp.hooks` is not available. The plugin declares `wp-hooks` as a script dependency; if you are seeing this error, verify the enqueue order.");return t}function Ve(t,e,...o){return Eo().applyFilters(t,e,...o)}const Ke={DESKTOP_THEME_ICON:"os.os-theme.icon",DESKTOP_THEME_ICON_COLOR:"os.os-theme.icon-color"},Ue=X("desktop-mode/dock-rail-registry",()=>({registry:new Map,listeners:new Set,activeId:"default"}));Ue.state.registry,Ue.state.listeners;class Ao extends Error{constructor(e,o,s){super(`[openstation] ${e} registration rejected โ fields: `+o.join(", ")+"."),this.name="RegistrationError",this.kind=e,this.errors=o,this.def=s}}function To(t,e,o){if(e.length!==0)throw new Ao(t,e,o)}const $=[[0,0],[100,0],[100,100],[0,100]],Ro=48,$o=80,he=6,fe=8,Ge=4,Xe=3,Ye=64,pe=105,L=2;function Ze(t){return`${Math.round(t*1e3)/1e3}%`}function I(t){return t.slice().reverse()}function W(t,e,o,s){return[[t,e],[o,e],[o,s],[t,s]]}function Lo(t,e,o,s){const n=[];for(let r=0;r<s;r++){const i=r/s*Math.PI*2;n.push([t+Math.cos(i)*o,e+Math.sin(i)*o])}return n}function x(t,e=[]){const o=[],s=n=>{o.push(`${Ze(n[0])} ${Ze(n[1])}`)};for(const n of t)s(n);if(e.length>0){s(t[0]);for(const n of e){for(const r of n)s(r);s(n[0]),s(t[0])}}return`polygon( ${o.join(", ")} )`}function Je(t){return x($,[I(Lo(50,50,t,Ro))])}function Qe(t){return x($,[I(W(50-t,-L,50+t,100+L))])}function et(t){const e=100/he,o=[];for(let s=0;s<he;s++){const n=s*e;o.push(I(W(-L,n,100+L,n+t)))}return x($,o)}function tt(t){return x($,[I(W(-L,50-t,100+L,50+t))])}function ot(t){const e=100/fe,o=[];for(let s=0;s<fe;s++){const n=s*e;o.push(I(W(n,-L,n+t,100+L)))}return x($,o)}function st(t){return x($,[I([[50,50-t],[50+t,50],[50,50+t],[50-t,50]])])}function nt(t){const e=100/Ge,o=100/Xe,s=[];for(let n=0;n<Xe;n++)for(let r=0;r<Ge;r++){const i=r*e+e/2,a=n*o+o/2,l=e/2*t,c=o/2*t;s.push(I(W(i-l,a-c,i+l,a+c)))}return x($,s)}function rt(t){const e=-Math.PI/2,o=t/180*Math.PI,s=[[50,50]];for(let n=0;n<Ye;n++){const r=e+n/(Ye-1)*o;s.push([50+Math.cos(r)*pe,50+Math.sin(r)*pe])}return x($,[I(s)])}function Io(){return{from:Je(0),to:Je($o)}}function Mo(){return{from:Qe(0),to:Qe(52)}}function No(){return{from:et(0),to:et(100/he+.5)}}function Oo(){return{from:tt(0),to:tt(52)}}function Po(){return{from:ot(0),to:ot(100/fe+.5)}}function Ho(){return{from:st(0),to:st(pe)}}function zo(){return{from:nt(0),to:nt(1.04)}}function Do(){return{from:rt(0),to:rt(360)}}function jo(){return{from:"inset( 0% 0% 0% 0% )",to:"inset( 0% 0% 100% 0% )"}}function Fo(){return{from:"inset( 0% 0% 0% 0% )",to:"inset( 0% 0% 0% 100% )"}}function Wo(){return{from:x([[-60,0],[100,0],[100,100],[0,100]]),to:x([[100,0],[260,0],[260,100],[160,100]])}}const me=6,be=100,H=be/2,Q=200,it=90,at=["#5c5c6d","#525261","#484855","#3e3e49","#34343d","#2a2a31"],qo="#101014",Bo=1.25,z="http://www.w3.org/2000/svg";let Vo=0;function ee(t){return Math.round(t*1e3)/1e3}function ge(t){return t/me*Math.PI*2-Math.PI/2}function Ko(t){const o=ge(t)+Math.PI/me+Math.PI/2;return{x:Math.cos(o),y:Math.sin(o)}}function Uo(t){const e=ge(t),o=ge(t+1);return[[H,H],[H+Math.cos(e)*Q,H+Math.sin(e)*Q],[H+Math.cos(o)*Q,H+Math.sin(o)*Q]]}function lt(t,e){const o=Uo(t),s=document.createElementNS(z,"path");return s.setAttribute("d",`M ${o.map(([n,r])=>`${ee(n)} ${ee(r)}`).join(" L ")} Z`),e?s.setAttribute("fill","#fff"):(s.setAttribute("fill",at[t%at.length]),s.setAttribute("stroke",qo),s.setAttribute("stroke-width",String(Bo)),s.setAttribute("vector-effect","non-scaling-stroke"),s.setAttribute("stroke-linejoin","round")),s}function Go(){const t=`os-iris-${++Vo}`,e=document.createElementNS(z,"svg");e.setAttribute("viewBox",`0 0 ${be} ${be}`),e.setAttribute("preserveAspectRatio","none"),e.setAttribute("aria-hidden","true"),e.style.width="100%",e.style.height="100%",e.style.display="block";const o=document.createElementNS(z,"defs"),s=document.createElementNS(z,"mask");s.setAttribute("id",t);const n=document.createElementNS(z,"g"),r=document.createElementNS(z,"g");r.setAttribute("mask",`url(#${t})`);const i=[];for(let l=0;l<me;l++){const c=lt(l,!0),d=lt(l,!1);n.appendChild(c),r.appendChild(d),i.push({el:c,index:l},{el:d,index:l})}s.appendChild(n),o.appendChild(s),e.appendChild(o),e.appendChild(r);const a=document.createElement("div");return a.appendChild(e),{element:a,play:l=>i.map(({el:c,index:d})=>{const u=Ko(d),f=ee(u.x*it),m=ee(u.y*it);return c.animate([{transform:"translate( 0px, 0px )"},{transform:`translate( ${f}px, ${m}px )`}],{duration:l.duration,easing:l.easing,delay:l.delay,fill:"both"})})}}const Xo="none",ct=X("desktop-mode/window-reveal-registry",()=>({registry:new Map,listeners:new Set})),Yo=ct.state.registry,Zo=ct.state.listeners,dt=/^[a-z0-9_/-]+$/;function ut(t){const e=/^\s*([a-zA-Z-]+)\s*\(/.exec(t);return e?e[1].toLowerCase():""}function ht(t,e){const o=[],s=typeof t.from=="string"&&t.from.trim()!=="",n=typeof t.to=="string"&&t.to.trim()!=="";if(s||o.push(`${e}.from (missing โ the clip-path covering the window)`),n||o.push(`${e}.to (missing โ the clip-path uncovering the window)`),s&&n){const r=ut(t.from),i=ut(t.to);r===""||i===""?o.push(`${e}.from|to (must be shape functions, e.g. \`inset( โฆ )\` or \`polygon( โฆ )\` โ bare keywords like \`none\` cannot be animated)`):r!==i&&o.push(`${e}.from|to (must use the same shape function to interpolate โ got \`${r}()\` and \`${i}()\`)`)}return o}function Jo(t){if(typeof KeyframeEffect!="function")return!0;try{return new KeyframeEffect(null,null,{easing:t}),!0}catch{return!1}}function w(t){const e=[];if(!t||typeof t!="object")e.push("def (not an object)");else{typeof t.id!="string"||t.id.trim()===""?e.push("id (missing)"):dt.test(t.id.trim().toLowerCase())?t.id.trim().toLowerCase()===Xo&&e.push('id ("none" is reserved)'):e.push(`id (must match ${dt} โ lowercase alphanum, hyphens, underscores, slashes for vendor/sub-id)`),(typeof t.label!="string"||t.label.trim()==="")&&e.push("label (missing)");const s=t.render!==void 0,n=Array.isArray(t.layers),r=t.from!==void 0||t.to!==void 0;s&&typeof t.render!="function"?e.push("render (not a function)"):s&&(n||r)?e.push("render|layers|from|to (supply exactly one of: a from/to pair, a layers array, or a render function)"):s||(n&&r?e.push("layers|from|to (supply EITHER a single from/to pair OR a layers array, not both)"):n?(t.layers.length===0&&e.push("layers (empty โ supply at least one matched pair)"),t.layers.forEach((i,a)=>{if(!i||typeof i!="object"){e.push(`layers[ ${a} ] (not an object)`);return}e.push(...ht(i,`layers[ ${a} ]`))})):e.push(...ht(t,"").map(i=>i.replace(/^\./,"")))),t.easing!==void 0&&(typeof t.easing!="string"||t.easing.trim()===""?e.push("easing (not a non-empty string)"):Jo(t.easing)||e.push("easing (not an easing the browser can parse โ `Element.animate()` would throw at play time, with the covering surface already over the window)"))}To("WindowReveal",e,t);const o=t.id.trim().toLowerCase();Yo.set(o,{...t,id:o}),Qo()}function Qo(){const t=Array.from(Zo);for(const e of t)try{e()}catch(o){typeof console<"u"&&console.error("[openstation] window-reveal registry listener threw:",o)}}w({id:"sweep",label:h("Sweep"),description:h("A straight edge travels across the window, uncovering the page behind it."),...Fo(),duration:420}),w({id:"iris",label:h("Iris"),description:h("The page opens out from the centre of the window, like a camera shutter."),...Io(),duration:520}),w({id:"curtain",label:h("Curtain"),description:h("Two panels part from the middle of the window and slide off the sides."),...Mo(),duration:480}),w({id:"blinds",label:h("Blinds"),description:h("Six horizontal slats retract at once, letting the page through between them."),...No(),duration:560}),w({id:"diagonal",label:h("Diagonal"),description:h("A slanted edge sweeps off the trailing corner of the window."),...Wo(),duration:460}),w({id:"rise",label:h("Rise"),description:h("The page rises into the window from the bottom edge upward."),...jo(),duration:440}),w({id:"shutter",label:h("Shutter"),description:h("Two panels part from the middle of the window and slide off the top and bottom."),...Oo(),duration:480}),w({id:"slats",label:h("Slats"),description:h("Eight vertical slats retract at once, letting the page through between them."),...Po(),duration:560}),w({id:"diamond",label:h("Diamond"),description:h("The page opens out from the centre of the window through a growing rhombus."),...Ho(),duration:520}),w({id:"mosaic",label:h("Mosaic"),description:h("The page arrives as a grid of tiles, each opening out from its own centre."),...zo(),duration:600}),w({id:"obturator",label:h("Camera shutter"),description:h("Six wedges slide aside in unison, opening a hexagonal aperture from the centre like the iris of a camera lens."),render:Go,duration:720,edgeLag:0}),w({id:"radar",label:h("Radar"),description:h("A spoke sweeps a full turn around the centre of the window, uncovering the page behind it."),...Do(),duration:760});const ft={dockSize:["compact","default","large"],desktopLayout:["classic","unified"],dockPlacement:["bottom","left","right"],windowRadius:["sharp","default","round"],adminBarMode:["static","dynamic","hidden"]},pt=["dockRailRenderer","windowReveal","accent"],mt={windowRevealDuration:{min:80,max:4e3}},es=/^[a-z0-9_-]+$/;[...Object.keys(ft),...pt,...Object.keys(mt)];function ts(t){if(!t||typeof t!="object"||Array.isArray(t))return{};const e=t,o={},s={};for(const[n,r]of Object.entries(ft)){const i=e[n];typeof i=="string"&&r.includes(i)&&(o[n]=i)}for(const n of pt){const r=e[n];typeof r=="string"&&es.test(r)&&(o[n]=r)}for(const[n,r]of Object.entries(mt)){const i=e[n];typeof i=="number"&&Number.isFinite(i)&&(s[n]=Math.min(r.max,Math.max(r.min,Math.round(i))))}return{...o,...s}}const os=/^[a-z0-9_-]+$/,bt=128;function ss(t){return typeof t!="string"||t===""||t.length>2048?!1:t.startsWith("dashicons-")||t.startsWith("https://")||t.startsWith("http://")||t.startsWith("data:image/")}function ns(t){if(!t||typeof t!="object")return null;const e=t,o=typeof e.slug=="string"?e.slug:"";if(!os.test(o))return null;const s={};if(e.icons&&typeof e.icons=="object"){let l=0;for(const[c,d]of Object.entries(e.icons)){if(l>=bt)break;c===""||!ss(d)||(s[c]=d,l+=1)}}const n={};if(e.tokens&&typeof e.tokens=="object")for(const[l,c]of Object.entries(e.tokens))typeof c=="string"&&(n[l]=c);const r=[];if(Array.isArray(e.fonts))for(const l of e.fonts)typeof l=="string"&&l!==""&&r.push(l);const i={};if(e.iconColors&&typeof e.iconColors=="object"){let l=0;for(const[c,d]of Object.entries(e.iconColors)){if(l>=bt)break;c===""||typeof d!="string"||d===""||(i[c]=d,l+=1)}}const a=l=>typeof e[l]=="string"?e[l]:"";return{id:a("id")||o,slug:o,name:a("name")||o,version:a("version"),author:a("author"),description:a("description"),previewUrl:a("previewUrl"),cssUrl:a("cssUrl"),cssText:a("cssText"),tokens:n,fonts:r,icons:s,iconColors:i,recommendedOsSettings:ts(e.recommendedOsSettings),installedAt:typeof e.installedAt=="number"?e.installedAt:0,source:e.source==="code"?"code":"upload",cssDeferred:e.cssDeferred===!0}}function rs(){const e=window.openStationConfig?.serverDesktopThemes,o=[];if(Array.isArray(e))for(const s of e){const n=ns(s);n&&o.push(n)}return{themes:o,activeId:null,activeIcons:null,activeIconColors:null}}const is=X("desktop-mode/desktop-themes",rs);function gt(){return is}function as(t){const e=gt().state;if(e.activeIcons===null)return null;const o=e.activeIcons[t];if(typeof o!="string"||o==="")return null;const s=Ve(Ke.DESKTOP_THEME_ICON,o,{slot:t,themeId:e.activeId??""});return typeof s=="string"&&s!==""?s:null}function ls(t){const e=gt().state;if(e.activeIconColors===null||!t)return null;const o=e.activeIconColors[t];if(typeof o!="string"||o==="")return null;const s=Ve(Ke.DESKTOP_THEME_ICON_COLOR,o,{slot:t,themeId:e.activeId??""});return typeof s=="string"&&s!==""?cs(s):null}function cs(t){const e=t.trim();if(e===""||e.length>64||/[;{}<>"'\\]/.test(e))return null;let o=0;for(const s of e)if(s==="(")o+=1;else if(s===")"&&(o-=1,o<0))return null;return o===0?e:null}const yt={RECYCLE_RESTORE:"RECYCLE_RESTORE",RECYCLE_DELETE:"RECYCLE_DELETE"};function ds(t){const e=document.createElement("button");e.type="button",e.setAttribute("data-noclick",""),e.setAttribute("aria-label",t.label),e.title=t.label;const o=t.variant==="danger",s=o?"var( --os-ui-danger, #d63638 )":"var( --os-ui-fg-muted, #50575e )",n=o?"var( --os-ui-danger, #d63638 )":"var( --os-ui-border, #c3c4c7 )",r="var( --os-ui-surface, #fff )",i=()=>{e.style.background=r,e.style.color=s,e.style.borderColor=n},a=()=>{o?(e.style.background="var( --os-ui-danger, #d63638 )",e.style.color="var( --os-ui-fg-on-accent, #fff )",e.style.borderColor="var( --os-ui-danger, #d63638 )"):(e.style.background="var( --os-ui-hover, #f0f0f1 )",e.style.color="var( --os-ui-fg, #1d2327 )",e.style.borderColor="var( --os-ui-border-strong, #8c8f94 )")},l=t.labelled===!0;if(e.style.cssText=["display: inline-flex","align-items: center","justify-content: center",l?"gap: 6px":"",l?"flex: 0 0 auto":"flex: 0 0 30px",l?"width: auto":"width: 30px",l?"height: 36px":"height: 30px",l?"padding: 0 12px":"padding: 0",l?"font-size: 13px":"",l?"font-weight: 600":"","margin: 0","border: 1px solid "+n,"border-radius: 6px","background: "+r,"color: "+s,"cursor: pointer","box-sizing: border-box","line-height: 1","font: inherit","transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease"].join(";"),e.addEventListener("mouseenter",a),e.addEventListener("mouseleave",i),e.addEventListener("focus",a),e.addEventListener("blur",i),e.appendChild(t.glyph),l){const c=document.createElement("span");c.textContent=t.label,c.style.cssText="white-space: nowrap; line-height: 1;",e.appendChild(c)}return e.addEventListener("click",c=>{c.stopPropagation(),t.onClick()}),e}function us(t){return t==="attachment"?"attachment":t==="comment"?"comment":"post"}const kt={post:{bg:"#dbe9fe",fg:"#1d4ed8"},page:{bg:"#e0f2fe",fg:"#075985"},attachment:{bg:"#fef3c7",fg:"#92400e"},comment:{bg:"#dcfce7",fg:"#166534"},_default:{bg:"var( --os-ui-surface-sunken, #e5e7eb )",fg:"var( --os-ui-fg-muted, #374151 )"}};function hs(t){return t?t.replace(/[_-]+/g," ").replace(/\b\w/g,e=>e.toUpperCase()):""}function fs(t){const e=t.type_label&&t.type_label.length>0?t.type_label:hs(t.type),o=kt[t.type]??kt._default,s=document.createElement("span");return s.setAttribute("data-os-recycle-bin-type-badge",t.type),s.textContent=e,s.style.cssText=["display: inline-flex","align-items: center","flex-shrink: 0","padding: 2px 8px","border-radius: 999px","font-size: 11px","font-weight: 600","line-height: 1.4","letter-spacing: 0.2px","text-transform: uppercase","white-space: nowrap","background: "+o.bg,"color: "+o.fg].join(";"),s}const ps={restore:'<path d="M12 5V2L7 6l5 4V7c2.76 0 5 2.24 5 5 0 .83-.21 1.61-.57 2.3l1.46 1.46A6.96 6.96 0 0 0 19 12c0-3.87-3.13-7-7-7zm0 12c-2.76 0-5-2.24-5-5 0-.83.21-1.61.57-2.3L6.11 8.24A6.96 6.96 0 0 0 5 12c0 3.87 3.13 7 7 7v3l5-4-5-4v3z" fill="currentColor"/>',trash:'<path d="M9 3v1H4v2h1v13a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6h1V4h-5V3H9zm0 5h2v9H9V8zm4 0h2v9h-2V8z" fill="currentColor"/>'};function _t(t){const e=t.icon==="restore"?yt.RECYCLE_RESTORE:yt.RECYCLE_DELETE,o=as(e),s=ls(e)??"currentColor",n=o!==null&&!o.startsWith("dashicons-")&&/^(https?:\/\/|data:image\/)/i.test(o)&&!/['"()\\<>\s]/.test(o);let r;if(n){const i=document.createElement("span");i.setAttribute("aria-hidden","true"),i.style.cssText=["display: block","width: 18px","height: 18px","flex-shrink: 0",`background-color: ${s}`,`-webkit-mask: url("${o}") center / contain no-repeat`,`mask: url("${o}") center / contain no-repeat`].join(";"),r=i}else{const a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("width","18"),a.setAttribute("height","18"),a.setAttribute("viewBox","0 0 24 24"),a.setAttribute("aria-hidden","true"),a.setAttribute("focusable","false"),a.style.display="block",a.innerHTML=ps[t.icon]??"",r=a}return ds({label:t.label,glyph:r,onClick:t.onClick,variant:t.variant,labelled:t.labelled})}function ms(t,e={}){const o=e.phone===!0,s=o?"font-weight:600;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere;":"font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:320px;",n=[{key:"title",label:h("Title"),sortable:!0,stack:"title",render:(i,a)=>{const l=document.createElement("span");if(l.style.cssText="display:flex;align-items:center;gap:10px;min-width:0;",a.preview&&a.type==="attachment"&&a.mime.startsWith("image/")){const p=document.createElement("img");p.src=a.preview,p.alt="",p.loading="lazy",p.style.cssText="width:36px;height:36px;border-radius:4px;object-fit:cover;display:block;flex-shrink:0;",l.appendChild(p)}const d=document.createElement("span");d.style.cssText="display:flex;flex-direction:column;gap:2px;min-width:0;";const u=document.createElement("span");u.style.cssText="display:flex;align-items:center;gap:8px;min-width:0;",u.appendChild(fs(a));const f=document.createElement("span");f.style.cssText=s;const m=le(a.title);if(f.textContent=m,f.title=m,u.appendChild(f),d.appendChild(u),a.subtitle){const p=document.createElement("span");p.style.cssText="font-size:12px;color:var( --os-ui-fg-muted, #50575e );white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:320px;";const _=le(a.subtitle);p.textContent=_,p.title=_,d.appendChild(p)}return l.appendChild(d),l}},{key:"deleted_at",label:h("Deleted"),sortable:!0,stack:"meta",width:"180px",sortValue:i=>Date.parse(i.deleted_at+"Z")||0,render:(i,a)=>{const l=document.createElement("os-relative-time");return l.setAttribute("datetime",a.deleted_at),l}},{key:"deleted_by",label:h("By"),sortable:!0,stack:"meta",width:"160px",render:(i,a)=>le(a.deleted_by??"")||"โ"},{key:"__actions",label:"",stack:"actions",width:"96px",align:"end",render:(i,a)=>{const l=document.createElement("span");return l.style.cssText=o?"display:flex;gap:8px;align-items:center;flex-wrap:wrap;line-height:1;":"display:inline-flex;gap:4px;justify-content:flex-end;align-items:center;flex-wrap:nowrap;white-space:nowrap;line-height:1;",a.can_restore&&l.appendChild(_t({label:h("Restore"),icon:"restore",labelled:o,onClick:()=>t.onRestore({id:a.id,type:a.type})})),a.can_purge&&l.appendChild(_t({label:h("Delete forever"),icon:"trash",variant:"danger",labelled:o,onClick:()=>t.onPurge({id:a.id,type:a.type})})),l}}],r=window.wp?.hooks;return r&&typeof r.applyFilters=="function"?r.applyFilters("openstation.recycleBin.columns",n):n}const vt="desktop-mode-recycle-bin",q=()=>({selected:[],listKey:"",fingerprint:"",empty:{mode:"idle",purged:0,total:0},refreshTimer:null,lastArt:"",phoneColumns:null});function bs(t){return t.length===0?"":t.map(e=>JSON.stringify(e)).sort().join("|")}function ye(t,e){const o={kind:t,ok:e,errors:[],source:"local"};document.dispatchEvent(new CustomEvent("os-recycle-bin-changed",{detail:o}));const s=window.wp?.hooks;s&&typeof s.doAction=="function"&&s.doAction("openstation.recycleBin.changed",o)}const ke=t=>t.root.querySelector("[data-os-trash-table]");function B(t){const e=ke(t);if(!e)return[];const o=new Set(Array.from(e.selection??[],String)),s=[];for(const n of e.visibleRows??[])o.has(`${n.type}:${n.id}`)&&s.push({id:n.id,type:n.type});return s}function _e(t){ke(t)?.clearSelection(),t.ui(q).selected=[]}async function wt(t,e,o){const s=e.flatMap(n=>{const r=t.data.items.find(a=>A(a)===A(n)),i=r&&re(r,"out");return i?[{ref:n,operation:i}]:[]});if(s.length!==0){_e(t);try{const n=await t.dispatch(o,{items:s.map(l=>l.ref)}),r=new Set(t.data.items.map(A));let i=0;for(const{ref:l,operation:c}of s){const d=n&&!r.has(A(l));i+=Number(d),c.finish(d)}i>0&&ye(o,i);const a=n?s.length-i:0;a>0&&t.host.toast?.({message:C(o==="restore"?se("%d item could not be restored.","%d items could not be restored.",a):se("%d item could not be deleted.","%d items could not be deleted.",a),a),type:"error"})}catch(n){for(const{operation:r}of s)r.finish(!1);ne(t.host.toast,n,{fallback:h(o==="restore"?"Could not restore the selected items.":"Could not delete the selected items.")})}}}async function xt(t,e){await wt(t,e,"restore")}async function St(t,e){if(e.length===0)return;await t.host.confirm?.({title:h("Delete forever?"),message:C(h("Permanently delete %d item(s)? This cannot be undone."),e.length),confirmLabel:h("Delete forever"),danger:!0})&&await wt(t,e,"purge")}async function gs(t,e){if(e.length===0)return;const o=window.wp?.os?.files?.rest;_e(t);const s=e.flatMap(l=>{const c=t.data.items.find(u=>A(u)===A(l)),d=c&&re(c,"out");return d?[d]:[]});let n=0,r=0,i,a=0;for(const l of e){let c;try{const u=await t.fetch("desktop-mode/v1/recycle-bin/restore",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:[l]})});if(!u.ok)throw await $e(u);c=await u.json()}catch(u){console.error("[trash] pin-to-desktop restore failed",u),r+=1,i??(i=u);continue}if(!c.ok.includes(l.id))continue;a+=1;const d=us(l.type);if(!(!o||!d)){try{await o.createPlacement({type:d,ref:String(l.id),x:16+n%5*96,y:16+Math.floor(n/5)*110})}catch(u){console.error("[trash] pin-to-desktop placement failed",u)}n+=1}}ye("restore",a),r>0&&ne(t.host.toast,i,{fallback:C(se("%d item could not be restored.","%d items could not be restored.",r),r)});try{await t.dispatch("refresh")}finally{s.forEach(l=>void l.finish(!1))}}async function ys(t){if(!await t.host.confirm?.({title:h("Empty Trash?"),message:h("Permanently delete ALL items in the Trash? This includes every type and any items hidden by the current filter or search. This cannot be undone."),confirmLabel:h("Empty Trash"),danger:!0}))return;const o=t.ui(q),s=t.data.items.flatMap(n=>{const r=re(n,"out");return r?[r]:[]});o.empty={mode:"starting",purged:0,total:0},t.repaint();try{const n=await uo({emptyBin:async()=>{const r=await t.fetch("desktop-mode/v1/recycle-bin/empty",{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"});if(!r.ok)throw await $e(r);return await r.json()},onProgress:({purged:r,initialTotal:i})=>{o.empty={mode:"progress",purged:r,total:i},t.repaint()}});ye("empty",n.purged),n.skipped>0&&t.host.toast?.({message:C(h("%d item(s) skipped (insufficient permissions)."),n.skipped)})}catch(n){console.error("[trash] empty failed",n),ne(t.host.toast,n,{fallback:h("Could not empty the Recycle Bin.")})}finally{o.empty={mode:"idle",purged:0,total:0},_e(t);try{await t.dispatch("refresh")}finally{s.forEach(n=>void n.finish(!1)),t.repaint()}}}function ks(t){return t.empty.mode==="idle"?h("Empty Trash"):t.empty.mode==="starting"||t.empty.total===0?h("Emptyingโฆ"):C(h("Emptyingโฆ %1$d of %2$d"),t.empty.purged,t.empty.total)}function Ct(t,e,o){return E` | |
| 12 | + <span class="os-recycle-bin__count">${C(h("%d selected"),e.selected.length)}</span> | |
| 13 | + <os-button variant="secondary" @click=${()=>void xt(t,B(t))}> | |
| 14 | 14 | <span class="dashicons dashicons-image-rotate" aria-hidden="true"></span> |
| 15 | - ${u("Restore")} | |
| 15 | + ${h("Restore")} | |
| 16 | 16 | </os-button> |
| 17 | - ${t?"":C`<os-button variant="secondary" @click=${()=>void tn(o,q(o))}> | |
| 17 | + ${o?"":E`<os-button variant="secondary" @click=${()=>void gs(t,B(t))}> | |
| 18 | 18 | <span class="dashicons dashicons-desktop" aria-hidden="true"></span> |
| 19 | - ${u("Pin to desktop")} | |
| 19 | + ${h("Pin to desktop")} | |
| 20 | 20 | </os-button>`} |
| 21 | - <os-button variant="danger" @click=${()=>void pt(o,q(o))}> | |
| 21 | + <os-button variant="danger" @click=${()=>void St(t,B(t))}> | |
| 22 | 22 | <span class="dashicons dashicons-trash" aria-hidden="true"></span> |
| 23 | - ${u("Delete forever")} | |
| 23 | + ${h("Delete forever")} | |
| 24 | 24 | </os-button> |
| 25 | - `}const sn=Rt(dt,{view:o=>{const{state:e,data:t}=o,n=o.ui(F),s=xe(t.items,t.total,e.filter,e.search).total>0||n.empty.mode!=="idle",i=n.empty.mode!=="idle",r=ve(),a=n.selected.length>0;return C` | |
| 25 | + `}const _s=Dt(vt,{view:t=>{const{state:e,data:o}=t,s=t.ui(q),n=Ne(o.items,o.total,e.filter,e.search).total>0||s.empty.mode!=="idle",r=s.empty.mode!=="idle",i=Ae(),a=s.selected.length>0;return E` | |
| 26 | 26 | <div class="desktop-mode-recycle-bin" data-os-recycle-bin-root> |
| 27 | - <header class="os-recycle-bin__toolbar" ?hidden=${!s}> | |
| 27 | + <header class="os-recycle-bin__toolbar" ?hidden=${!n}> | |
| 28 | 28 | <div class="os-recycle-bin__toolbar-left"> |
| 29 | - <os-segmented os-bind="filter" os-action="refresh" value=${e.filter} label=${u("Filter by type")}> | |
| 30 | - <os-segment value="">${u("All")}</os-segment> | |
| 31 | - <os-segment value="post">${u("Posts")}</os-segment> | |
| 32 | - <os-segment value="page">${u("Pages")}</os-segment> | |
| 33 | - ${t.mediaTrash?C`<os-segment value="attachment">${u("Media")}</os-segment>`:""} | |
| 34 | - <os-segment value="comment">${u("Comments")}</os-segment> | |
| 35 | - <os-segment value="desktop">${u("Desktop")}</os-segment> | |
| 29 | + <os-segmented os-bind="filter" os-action="refresh" value=${e.filter} label=${h("Filter by type")}> | |
| 30 | + <os-segment value="">${h("All")}</os-segment> | |
| 31 | + <os-segment value="post">${h("Posts")}</os-segment> | |
| 32 | + <os-segment value="page">${h("Pages")}</os-segment> | |
| 33 | + ${o.mediaTrash?E`<os-segment value="attachment">${h("Media")}</os-segment>`:""} | |
| 34 | + <os-segment value="comment">${h("Comments")}</os-segment> | |
| 35 | + <os-segment value="desktop">${h("Desktop")}</os-segment> | |
| 36 | 36 | </os-segmented> |
| 37 | 37 | <os-text-field |
| 38 | 38 | type="search" |
| 39 | - label=${u("Search trash")} | |
| 39 | + label=${h("Search trash")} | |
| 40 | 40 | hide-label |
| 41 | 41 | os-bind="search" |
| 42 | 42 | os-action="refresh" |
| 43 | - placeholder=${u("Search trashโฆ")} | |
| 43 | + placeholder=${h("Search trashโฆ")} | |
| 44 | 44 | ></os-text-field> |
| 45 | 45 | </div> |
| 46 | - ${r?"":C`<div class="os-recycle-bin__toolbar-right" ?hidden=${!a}> | |
| 47 | - ${ft(o,n,!1)} | |
| 46 | + ${i?"":E`<div class="os-recycle-bin__toolbar-right" ?hidden=${!a}> | |
| 47 | + ${Ct(t,s,!1)} | |
| 48 | 48 | </div>`} |
| 49 | 49 | <div class="os-recycle-bin__toolbar-trailing"> |
| 50 | - <os-button variant="ghost" os-action="refresh" title=${u("Refresh")}> | |
| 50 | + <os-button variant="ghost" os-action="refresh" title=${h("Refresh")}> | |
| 51 | 51 | <span class="dashicons dashicons-update" aria-hidden="true"></span> |
| 52 | 52 | </os-button> |
| 53 | 53 | <os-button |
| 54 | 54 | variant="danger" |
| 55 | - ?disabled=${i} | |
| 56 | - aria-busy=${i?"true":"false"} | |
| 57 | - @click=${()=>void on(o)} | |
| 55 | + ?disabled=${r} | |
| 56 | + aria-busy=${r?"true":"false"} | |
| 57 | + @click=${()=>void ys(t)} | |
| 58 | 58 | > |
| 59 | 59 | <span class="dashicons dashicons-trash" aria-hidden="true"></span> |
| 60 | - ${nn(n)} | |
| 60 | + ${ks(s)} | |
| 61 | 61 | </os-button> |
| 62 | 62 | </div> |
| 63 | 63 | </header> |
| 64 | 64 | <div class="os-recycle-bin__body"> |
| @@ -64,11 +64,11 @@ | ||
| 64 | 64 | <div class="os-recycle-bin__body"> |
| 65 | 65 | <os-empty-state |
| 66 | 66 | role="status" |
| 67 | 67 | icon="trash" |
| 68 | - heading=${u("The Trash is empty.")} | |
| 69 | - description=${u("Deleted posts, pages, and media show up here. Restoring puts them back where they were.")} | |
| 70 | - ?hidden=${s} | |
| 68 | + heading=${h("The Trash is empty.")} | |
| 69 | + description=${h("Deleted posts, pages, and media show up here. Restoring puts them back where they were.")} | |
| 70 | + ?hidden=${n} | |
| 71 | 71 | ></os-empty-state> |
| 72 | 72 | <os-table |
| 73 | 73 | data-os-trash-table |
| 74 | 74 | os-preserve |
| @@ -75,13 +75,13 @@ | ||
| 75 | 75 | selectable="multi" |
| 76 | 76 | sticky-header |
| 77 | 77 | hover |
| 78 | 78 | striped |
| 79 | - empty=${u("No items match the current filter or search.")} | |
| 80 | - ?hidden=${!s} | |
| 79 | + empty=${h("No items match the current filter or search.")} | |
| 80 | + ?hidden=${!n} | |
| 81 | 81 | ></os-table> |
| 82 | 82 | </div> |
| 83 | - ${r&&s?C`<footer class="os-recycle-bin__bulk" ?hidden=${!a}> | |
| 84 | - ${ft(o,n,!0)} | |
| 83 | + ${i&&n?E`<footer class="os-recycle-bin__bulk" ?hidden=${!a}> | |
| 84 | + ${Ct(t,s,!0)} | |
| 85 | 85 | </footer>`:""} |
| 86 | 86 | </div> |
| 87 | - `},mounted:o=>{Jt(),o.dispatch("refresh");let e=null;const t=It(()=>o.repaint(),()=>(e??(e=Promise.resolve().then(()=>(e=null,o.dispatch("refresh")))),e)),n=o.ui(F),s=r=>{const a=r.detail;!a?.source||a.source==="local"||(n.refreshTimer!==null&&window.clearTimeout(n.refreshTimer),n.refreshTimer=window.setTimeout(()=>{n.refreshTimer=null,o.dispatch("refresh")},200))};document.addEventListener("os-recycle-bin-changed",s);const i=()=>o.repaint();return document.addEventListener("os-mode-changed",i),()=>{t(),Qt(),document.removeEventListener("os-recycle-bin-changed",s),document.removeEventListener("os-mode-changed",i),n.refreshTimer!==null&&window.clearTimeout(n.refreshTimer)}},updated:o=>{const e=pe(o);if(!e)return;const t=o.ui(F),n=Tt(e);n!==t.phoneColumns&&(t.phoneColumns=n,e.columns=Qo({onRestore:l=>void ut(o,[l]),onPurge:l=>void pt(o,[l])},{phone:n})),e.hasAttribute("data-os-trash-wired")||(e.setAttribute("data-os-trash-wired",""),e.getRowId=l=>`${l.type}:${l.id}`,e.sort={key:"deleted_at",direction:"desc"},e.addEventListener("os-table-selection-change",()=>{t.selected=q(o),o.repaint()}));const s=`${o.state.filter}|${o.state.search}`;s!==t.listKey&&(t.listKey=s,(e.selection?.size??0)>0&&e.clearSelection(),t.selected=[]);const i=xe(o.data.items,o.data.total,o.state.filter,o.state.search),r=en(i.items);if(r!==t.fingerprint){t.fingerprint=r,e.data=i.items;const l=new Set((e.visibleRows??[]).map(d=>`${d.type}:${d.id}`)),c=Array.from(e.selection??[],String).filter(d=>l.has(d));c.length!==(e.selection?.size??0)&&(e.selection=c,t.selected=q(o))}const a=String(o.extra[i.total>0?"full":"empty"]??"");a&&a!==t.lastArt&&(t.lastArt=a,o.host.setIcon?.(dt,a))}});return ee.default=sn,Object.defineProperties(ee,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),ee}({}); | |
| 87 | + `},mounted:t=>{mo(),t.dispatch("refresh");let e=null;const o=Gt(()=>t.repaint(),()=>(e??(e=Promise.resolve().then(()=>(e=null,t.dispatch("refresh")))),e)),s=t.ui(q),n=i=>{const a=i.detail;!a?.source||a.source==="local"||(s.refreshTimer!==null&&window.clearTimeout(s.refreshTimer),s.refreshTimer=window.setTimeout(()=>{s.refreshTimer=null,t.dispatch("refresh")},200))};document.addEventListener("os-recycle-bin-changed",n);const r=()=>t.repaint();return document.addEventListener("os-mode-changed",r),()=>{o(),bo(),document.removeEventListener("os-recycle-bin-changed",n),document.removeEventListener("os-mode-changed",r),s.refreshTimer!==null&&window.clearTimeout(s.refreshTimer)}},updated:t=>{const e=ke(t);if(!e)return;const o=t.ui(q),s=zt(e);s!==o.phoneColumns&&(o.phoneColumns=s,e.columns=ms({onRestore:l=>void xt(t,[l]),onPurge:l=>void St(t,[l])},{phone:s})),e.hasAttribute("data-os-trash-wired")||(e.setAttribute("data-os-trash-wired",""),e.getRowId=l=>`${l.type}:${l.id}`,e.sort={key:"deleted_at",direction:"desc"},e.addEventListener("os-table-selection-change",()=>{o.selected=B(t),t.repaint()}));const n=`${t.state.filter}|${t.state.search}`;n!==o.listKey&&(o.listKey=n,(e.selection?.size??0)>0&&e.clearSelection(),o.selected=[]);const r=Ne(t.data.items,t.data.total,t.state.filter,t.state.search),i=bs(r.items);if(i!==o.fingerprint){o.fingerprint=i,e.data=r.items;const l=new Set((e.visibleRows??[]).map(d=>`${d.type}:${d.id}`)),c=Array.from(e.selection??[],String).filter(d=>l.has(d));c.length!==(e.selection?.size??0)&&(e.selection=c,o.selected=B(t))}const a=String(t.extra[r.total>0?"full":"empty"]??"");a&&a!==o.lastArt&&(o.lastArt=a,t.host.setIcon?.(vt,a))}});return te.default=_s,Object.defineProperties(te,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),te}({}); | |