@commmerce/ui 1.20.3 → 1.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base.js +4 -0
- package/dist/cdn.js +286 -282
- package/dist/components/app-frame.js +14 -5
- package/dist/components/bottom-navigation.d.ts +16 -0
- package/dist/components/bottom-navigation.js +19 -5
- package/dist/components/calendar.js +6 -5
- package/dist/components/link-tabs.js +1 -1
- package/dist/components/status-tabs.js +1 -1
- package/dist/custom-elements.json +49 -2
- package/dist/overlay.d.ts +4 -1
- package/dist/overlay.js +16 -5
- package/package.json +3 -3
package/dist/cdn.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
\f\r]`,pl=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
1
|
+
var gb=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||gb("Cannot "+e);var r=(o,n,e)=>(ou(o,n,"read from private field"),e?e.call(o):n.get(o)),m=(o,n,e)=>n.has(o)?gb("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(o):n.set(o,e),g=(o,n,e,t)=>(ou(o,n,"write to private field"),t?t.call(o,e):n.set(o,e),e),a=(o,n,e)=>(ou(o,n,"access private method"),e);var eh=globalThis,th=eh.ShadowRoot&&(eh.ShadyCSS===void 0||eh.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,lu=Symbol(),fb=new WeakMap,dl=class{constructor(n,e,t){if(this._$cssResult$=!0,t!==lu)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=n,this.t=e}get styleSheet(){let n=this.o,e=this.t;if(th&&n===void 0){let t=e!==void 0&&e.length===1;t&&(n=fb.get(e)),n===void 0&&((this.o=n=new CSSStyleSheet).replaceSync(this.cssText),t&&fb.set(e,n))}return n}toString(){return this.cssText}},ih=o=>new dl(typeof o=="string"?o:o+"",void 0,lu),w=(o,...n)=>{let e=o.length===1?o[0]:n.reduce((t,i,s)=>t+(l=>{if(l._$cssResult$===!0)return l.cssText;if(typeof l=="number")return l;throw Error("Value passed to 'css' function must be a 'css' function result: "+l+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+o[s+1],o[0]);return new dl(e,o,lu)},bb=(o,n)=>{if(th)o.adoptedStyleSheets=n.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of n){let t=document.createElement("style"),i=eh.litNonce;i!==void 0&&t.setAttribute("nonce",i),t.textContent=e.cssText,o.appendChild(t)}},cu=th?o=>o:o=>o instanceof CSSStyleSheet?(n=>{let e="";for(let t of n.cssRules)e+=t.cssText;return ih(e)})(o):o;var{is:qw,defineProperty:Ow,getOwnPropertyDescriptor:Bw,getOwnPropertyNames:Fw,getOwnPropertySymbols:Vw,getPrototypeOf:jw}=Object,rh=globalThis,vb=rh.trustedTypes,Uw=vb?vb.emptyScript:"",Kw=rh.reactiveElementPolyfillSupport,hl=(o,n)=>o,du={toAttribute(o,n){switch(n){case Boolean:o=o?Uw:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,n){let e=o;switch(n){case Boolean:e=o!==null;break;case Number:e=o===null?null:Number(o);break;case Object:case Array:try{e=JSON.parse(o)}catch{e=null}}return e}},xb=(o,n)=>!qw(o,n),yb={attribute:!0,type:String,converter:du,reflect:!1,useDefault:!1,hasChanged:xb};Symbol.metadata??=Symbol("metadata"),rh.litPropertyMetadata??=new WeakMap;var ei=class extends HTMLElement{static addInitializer(n){this._$Ei(),(this.l??=[]).push(n)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(n,e=yb){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(n)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(n,e),!e.noAccessor){let t=Symbol(),i=this.getPropertyDescriptor(n,t,e);i!==void 0&&Ow(this.prototype,n,i)}}static getPropertyDescriptor(n,e,t){let{get:i,set:s}=Bw(this.prototype,n)??{get(){return this[e]},set(l){this[e]=l}};return{get:i,set(l){let d=i?.call(this);s?.call(this,l),this.requestUpdate(n,d,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(n){return this.elementProperties.get(n)??yb}static _$Ei(){if(this.hasOwnProperty(hl("elementProperties")))return;let n=jw(this);n.finalize(),n.l!==void 0&&(this.l=[...n.l]),this.elementProperties=new Map(n.elementProperties)}static finalize(){if(this.hasOwnProperty(hl("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(hl("properties"))){let e=this.properties,t=[...Fw(e),...Vw(e)];for(let i of t)this.createProperty(i,e[i])}let n=this[Symbol.metadata];if(n!==null){let e=litPropertyMetadata.get(n);if(e!==void 0)for(let[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let i=this._$Eu(e,t);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(n){let e=[];if(Array.isArray(n)){let t=new Set(n.flat(1/0).reverse());for(let i of t)e.unshift(cu(i))}else n!==void 0&&e.push(cu(n));return e}static _$Eu(n,e){let t=e.attribute;return t===!1?void 0:typeof t=="string"?t:typeof n=="string"?n.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(n=>this.enableUpdating=n),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(n=>n(this))}addController(n){(this._$EO??=new Set).add(n),this.renderRoot!==void 0&&this.isConnected&&n.hostConnected?.()}removeController(n){this._$EO?.delete(n)}_$E_(){let n=new Map,e=this.constructor.elementProperties;for(let t of e.keys())this.hasOwnProperty(t)&&(n.set(t,this[t]),delete this[t]);n.size>0&&(this._$Ep=n)}createRenderRoot(){let n=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return bb(n,this.constructor.elementStyles),n}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(n=>n.hostConnected?.())}enableUpdating(n){}disconnectedCallback(){this._$EO?.forEach(n=>n.hostDisconnected?.())}attributeChangedCallback(n,e,t){this._$AK(n,t)}_$ET(n,e){let t=this.constructor.elementProperties.get(n),i=this.constructor._$Eu(n,t);if(i!==void 0&&t.reflect===!0){let s=(t.converter?.toAttribute!==void 0?t.converter:du).toAttribute(e,t.type);this._$Em=n,s==null?this.removeAttribute(i):this.setAttribute(i,s),this._$Em=null}}_$AK(n,e){let t=this.constructor,i=t._$Eh.get(n);if(i!==void 0&&this._$Em!==i){let s=t.getPropertyOptions(i),l=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:du;this._$Em=i;let d=l.fromAttribute(e,s.type);this[i]=d??this._$Ej?.get(i)??d,this._$Em=null}}requestUpdate(n,e,t,i=!1,s){if(n!==void 0){let l=this.constructor;if(i===!1&&(s=this[n]),t??=l.getPropertyOptions(n),!((t.hasChanged??xb)(s,e)||t.useDefault&&t.reflect&&s===this._$Ej?.get(n)&&!this.hasAttribute(l._$Eu(n,t))))return;this.C(n,e,t)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(n,e,{useDefault:t,reflect:i,wrapped:s},l){t&&!(this._$Ej??=new Map).has(n)&&(this._$Ej.set(n,l??e??this[n]),s!==!0||l!==void 0)||(this._$AL.has(n)||(this.hasUpdated||t||(e=void 0),this._$AL.set(n,e)),i===!0&&this._$Em!==n&&(this._$Eq??=new Set).add(n))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let n=this.scheduleUpdate();return n!=null&&await n,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,s]of this._$Ep)this[i]=s;this._$Ep=void 0}let t=this.constructor.elementProperties;if(t.size>0)for(let[i,s]of t){let{wrapped:l}=s,d=this[i];l!==!0||this._$AL.has(i)||d===void 0||this.C(i,void 0,s,d)}}let n=!1,e=this._$AL;try{n=this.shouldUpdate(e),n?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(t){throw n=!1,this._$EM(),t}n&&this._$AE(e)}willUpdate(n){}_$AE(n){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(n)),this.updated(n)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(n){return!0}update(n){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(n){}firstUpdated(n){}};ei.elementStyles=[],ei.shadowRootOptions={mode:"open"},ei[hl("elementProperties")]=new Map,ei[hl("finalized")]=new Map,Kw?.({ReactiveElement:ei}),(rh.reactiveElementVersions??=[]).push("2.1.2");var pu=globalThis,wb=o=>o,sh=pu.trustedTypes,$b=sh?sh.createPolicy("lit-html",{createHTML:o=>o}):void 0,mu="$lit$",ti=`lit$${Math.random().toFixed(9).slice(2)}$`,uu="?"+ti,Ww=`<${uu}>`,Mr=document,ml=()=>Mr.createComment(""),ul=o=>o===null||typeof o!="object"&&typeof o!="function",gu=Array.isArray,Cb=o=>gu(o)||typeof o?.[Symbol.iterator]=="function",hu=`[
|
|
2
|
+
\f\r]`,pl=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,kb=/-->/g,Eb=/>/g,kr=RegExp(`>|${hu}(?:([^\\s"'>=/]+)(${hu}*=${hu}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Mb=/'/g,_b=/"/g,zb=/^(?:script|style|textarea|title)$/i,fu=o=>(n,...e)=>({_$litType$:o,strings:n,values:e}),c=fu(1),ii=fu(2),s$=fu(3),Pe=Symbol.for("lit-noChange"),h=Symbol.for("lit-nothing"),Tb=new WeakMap,Er=Mr.createTreeWalker(Mr,129);function Sb(o,n){if(!gu(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return $b!==void 0?$b.createHTML(n):n}var Lb=(o,n)=>{let e=o.length-1,t=[],i,s=n===2?"<svg>":n===3?"<math>":"",l=pl;for(let d=0;d<e;d++){let p=o[d],u,b,f=-1,x=0;for(;x<p.length&&(l.lastIndex=x,b=l.exec(p),b!==null);)x=l.lastIndex,l===pl?b[1]==="!--"?l=kb:b[1]!==void 0?l=Eb:b[2]!==void 0?(zb.test(b[2])&&(i=RegExp("</"+b[2],"g")),l=kr):b[3]!==void 0&&(l=kr):l===kr?b[0]===">"?(l=i??pl,f=-1):b[1]===void 0?f=-2:(f=l.lastIndex-b[2].length,u=b[1],l=b[3]===void 0?kr:b[3]==='"'?_b:Mb):l===_b||l===Mb?l=kr:l===kb||l===Eb?l=pl:(l=kr,i=void 0);let v=l===kr&&o[d+1].startsWith("/>")?" ":"";s+=l===pl?p+Ww:f>=0?(t.push(u),p.slice(0,f)+mu+p.slice(f)+ti+v):p+ti+(f===-2?d:v)}return[Sb(o,s+(o[e]||"<?>")+(n===2?"</svg>":n===3?"</math>":"")),t]},gl=class o{constructor({strings:n,_$litType$:e},t){let i;this.parts=[];let s=0,l=0,d=n.length-1,p=this.parts,[u,b]=Lb(n,e);if(this.el=o.createElement(u,t),Er.currentNode=this.el.content,e===2||e===3){let f=this.el.content.firstChild;f.replaceWith(...f.childNodes)}for(;(i=Er.nextNode())!==null&&p.length<d;){if(i.nodeType===1){if(i.hasAttributes())for(let f of i.getAttributeNames())if(f.endsWith(mu)){let x=b[l++],v=i.getAttribute(f).split(ti),k=/([.?@])?(.*)/.exec(x);p.push({type:1,index:s,name:k[2],strings:v,ctor:k[1]==="."?nh:k[1]==="?"?oh:k[1]==="@"?lh:Tr}),i.removeAttribute(f)}else f.startsWith(ti)&&(p.push({type:6,index:s}),i.removeAttribute(f));if(zb.test(i.tagName)){let f=i.textContent.split(ti),x=f.length-1;if(x>0){i.textContent=sh?sh.emptyScript:"";for(let v=0;v<x;v++)i.append(f[v],ml()),Er.nextNode(),p.push({type:2,index:++s});i.append(f[x],ml())}}}else if(i.nodeType===8)if(i.data===uu)p.push({type:2,index:s});else{let f=-1;for(;(f=i.data.indexOf(ti,f+1))!==-1;)p.push({type:7,index:s}),f+=ti.length-1}s++}}static createElement(n,e){let t=Mr.createElement("template");return t.innerHTML=n,t}};function _r(o,n,e=o,t){if(n===Pe)return n;let i=t!==void 0?e._$Co?.[t]:e._$Cl,s=ul(n)?void 0:n._$litDirective$;return i?.constructor!==s&&(i?._$AO?.(!1),s===void 0?i=void 0:(i=new s(o),i._$AT(o,e,t)),t!==void 0?(e._$Co??=[])[t]=i:e._$Cl=i),i!==void 0&&(n=_r(o,i._$AS(o,n.values),i,t)),n}var ah=class{constructor(n,e){this._$AV=[],this._$AN=void 0,this._$AD=n,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(n){let{el:{content:e},parts:t}=this._$AD,i=(n?.creationScope??Mr).importNode(e,!0);Er.currentNode=i;let s=Er.nextNode(),l=0,d=0,p=t[0];for(;p!==void 0;){if(l===p.index){let u;p.type===2?u=new Xs(s,s.nextSibling,this,n):p.type===1?u=new p.ctor(s,p.name,p.strings,this,n):p.type===6&&(u=new ch(s,this,n)),this._$AV.push(u),p=t[++d]}l!==p?.index&&(s=Er.nextNode(),l++)}return Er.currentNode=Mr,i}p(n){let e=0;for(let t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(n,t,e),e+=t.strings.length-2):t._$AI(n[e])),e++}},Xs=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(n,e,t,i){this.type=2,this._$AH=h,this._$AN=void 0,this._$AA=n,this._$AB=e,this._$AM=t,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let n=this._$AA.parentNode,e=this._$AM;return e!==void 0&&n?.nodeType===11&&(n=e.parentNode),n}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(n,e=this){n=_r(this,n,e),ul(n)?n===h||n==null||n===""?(this._$AH!==h&&this._$AR(),this._$AH=h):n!==this._$AH&&n!==Pe&&this._(n):n._$litType$!==void 0?this.$(n):n.nodeType!==void 0?this.T(n):Cb(n)?this.k(n):this._(n)}O(n){return this._$AA.parentNode.insertBefore(n,this._$AB)}T(n){this._$AH!==n&&(this._$AR(),this._$AH=this.O(n))}_(n){this._$AH!==h&&ul(this._$AH)?this._$AA.nextSibling.data=n:this.T(Mr.createTextNode(n)),this._$AH=n}$(n){let{values:e,_$litType$:t}=n,i=typeof t=="number"?this._$AC(n):(t.el===void 0&&(t.el=gl.createElement(Sb(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===i)this._$AH.p(e);else{let s=new ah(i,this),l=s.u(this.options);s.p(e),this.T(l),this._$AH=s}}_$AC(n){let e=Tb.get(n.strings);return e===void 0&&Tb.set(n.strings,e=new gl(n)),e}k(n){gu(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,i=0;for(let s of n)i===e.length?e.push(t=new o(this.O(ml()),this.O(ml()),this,this.options)):t=e[i],t._$AI(s),i++;i<e.length&&(this._$AR(t&&t._$AB.nextSibling,i),e.length=i)}_$AR(n=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);n!==this._$AB;){let t=wb(n).nextSibling;wb(n).remove(),n=t}}setConnected(n){this._$AM===void 0&&(this._$Cv=n,this._$AP?.(n))}},Tr=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(n,e,t,i,s){this.type=1,this._$AH=h,this._$AN=void 0,this.element=n,this.name=e,this._$AM=i,this.options=s,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=h}_$AI(n,e=this,t,i){let s=this.strings,l=!1;if(s===void 0)n=_r(this,n,e,0),l=!ul(n)||n!==this._$AH&&n!==Pe,l&&(this._$AH=n);else{let d=n,p,u;for(n=s[0],p=0;p<s.length-1;p++)u=_r(this,d[t+p],e,p),u===Pe&&(u=this._$AH[p]),l||=!ul(u)||u!==this._$AH[p],u===h?n=h:n!==h&&(n+=(u??"")+s[p+1]),this._$AH[p]=u}l&&!i&&this.j(n)}j(n){n===h?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,n??"")}},nh=class extends Tr{constructor(){super(...arguments),this.type=3}j(n){this.element[this.name]=n===h?void 0:n}},oh=class extends Tr{constructor(){super(...arguments),this.type=4}j(n){this.element.toggleAttribute(this.name,!!n&&n!==h)}},lh=class extends Tr{constructor(n,e,t,i,s){super(n,e,t,i,s),this.type=5}_$AI(n,e=this){if((n=_r(this,n,e,0)??h)===Pe)return;let t=this._$AH,i=n===h&&t!==h||n.capture!==t.capture||n.once!==t.once||n.passive!==t.passive,s=n!==h&&(t===h||i);i&&this.element.removeEventListener(this.name,this,t),s&&this.element.addEventListener(this.name,this,n),this._$AH=n}handleEvent(n){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,n):this._$AH.handleEvent(n)}},ch=class{constructor(n,e,t){this.element=n,this.type=6,this._$AN=void 0,this._$AM=e,this.options=t}get _$AU(){return this._$AM._$AU}_$AI(n){_r(this,n)}},Ab={M:mu,P:ti,A:uu,C:1,L:Lb,R:ah,D:Cb,V:_r,I:Xs,H:Tr,N:oh,U:lh,B:nh,F:ch},Gw=pu.litHtmlPolyfillSupport;Gw?.(gl,Xs),(pu.litHtmlVersions??=[]).push("3.3.3");var Db=(o,n,e)=>{let t=e?.renderBefore??n,i=t._$litPart$;if(i===void 0){let s=e?.renderBefore??null;t._$litPart$=i=new Xs(n.insertBefore(ml(),s),s,void 0,e??{})}return i._$AI(o),i};var bu=globalThis,A=class extends ei{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let n=super.createRenderRoot();return this.renderOptions.renderBefore??=n.firstChild,n}update(n){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(n),this._$Do=Db(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Pe}};A._$litElement$=!0,A.finalized=!0,bu.litElementHydrateSupport?.({LitElement:A});var Yw=bu.litElementPolyfillSupport;Yw?.({LitElement:A});(bu.litElementVersions??=[]).push("4.2.2");var E=w`
|
|
4
4
|
:host {
|
|
5
5
|
font-family: var(--cm-font-sans, 'Poppins', system-ui, sans-serif);
|
|
6
6
|
color: var(--cm-text-default, #000);
|
|
@@ -8,17 +8,21 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
8
8
|
}
|
|
9
9
|
:host([hidden]) { display: none !important; }
|
|
10
10
|
*, *::before, *::after { box-sizing: inherit; }
|
|
11
|
-
|
|
11
|
+
/* Scroll areas scroll, but never draw a scrollbar: a classic (always-on) scrollbar takes width as it appears and
|
|
12
|
+
shifts the layout. Overflow is shown instead by the component (fades, "more" hints, sticky edges). */
|
|
13
|
+
:host, * { scrollbar-width: none; }
|
|
14
|
+
::-webkit-scrollbar { display: none; }
|
|
15
|
+
`,v$=w`
|
|
12
16
|
outline: 2px solid var(--cm-border-strong);
|
|
13
17
|
outline-offset: 2px;
|
|
14
|
-
`,
|
|
18
|
+
`,Xw=0,N=o=>`${o}-${++Xw}`;function $(o,n){customElements.get(o)||customElements.define(o,n)}function se(o,n){let e=o.key;return(e==="ArrowLeft"||e==="ArrowRight")&&getComputedStyle(n).direction==="rtl"?e==="ArrowLeft"?"ArrowRight":"ArrowLeft":e}var Jw={close:"Close",dismiss:"Dismiss",loading:"Loading",ascending:"ascending",descending:"descending"},dh={common:{...Jw}},fl={},bl={},hh;function z(o,n){return dh[o]={...dh[o],...n},n}function Qw(){return Object.fromEntries(Object.entries(dh).map(([o,n])=>[o,{...n}]))}function ph(o,n){for(let[e,t]of Object.entries(n??{}))t&&typeof t=="object"&&(o[e]={...o[e],...t})}function Zw(o,n){ph(n?bl[n.toLowerCase()]??={}:fl,o),gh()}function e0(o={}){"locale"in o&&(hh=o.locale||void 0),o.strings&&ph(fl,o.strings);for(let[n,e]of Object.entries(o.translations??{}))ph(bl[n.toLowerCase()]??={},e);gh()}function t0(){hh=void 0;for(let o of Object.keys(fl))delete fl[o];for(let o of Object.keys(bl))delete bl[o];gh()}function vl(o){if(hh)return hh;let n=o;for(;n;){if(n instanceof Element&&n.hasAttribute("lang")&&n.getAttribute("lang"))return n.getAttribute("lang");n=n.parentNode??(n instanceof ShadowRoot?n.host:null)}if(typeof document<"u"&&document.documentElement.lang)return document.documentElement.lang}var Rb=new Map;function xu(o,n,e,t){let i=`${o}|${n??""}|${JSON.stringify(e)}`,s=Rb.get(i);if(!s){try{s=t(n)}catch{s=t(void 0)}Rb.set(i,s)}return s}function wu(o,n={},e){return xu("n",e,n,t=>new Intl.NumberFormat(t,n)).format(o)}function me(o,n={},e){return xu("d",e,n,t=>new Intl.DateTimeFormat(t,n)).format(o)}function mh(o,n){return xu("p",n,{},e=>new Intl.PluralRules(e)).select(o)}function Hb(o,n={},e){if(o==null)return"";if(typeof o=="function")return String(o(n));let t;if(typeof o=="object"){let i=Number(n.count??0);t=o[mh(i,e)]??o.other??""}else t=String(o);return t.replace(/\{(\w+)\}/g,(i,s)=>{let l=n[s];return l===void 0?i:typeof l=="number"?wu(l,{},e):String(l)})}function i0(o,n,e,t){if(t&&t[n]!==void 0)return t[n];let i=[];if(e){let s=e.toLowerCase().split("-");for(let l=s.length;l>0;l--)i.push(s.slice(0,l).join("-"))}for(let s of o==="common"?["common"]:[o,"common"]){for(let d of i){let p=bl[d]?.[s]?.[n];if(p!==void 0)return p}let l=fl[s]?.[n]??dh[s]?.[n];if(l!==void 0)return l}}function uh(o,n,e,t,i){let s=vl(t);return Hb(i0(o,n,s,i),e,s)}var yu=new Set,vu;function gh(){for(let o of yu)o.requestUpdate()}function r0(){vu||typeof MutationObserver>"u"||typeof document>"u"||(vu=new MutationObserver(gh),vu.observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],subtree:!0}))}var s0=o=>o.replace(/^cm-/,"").replace(/-([a-z])/g,(n,e)=>e.toUpperCase()),C=class extends A{static finalize(){let n=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);if(!n(this,"finalized")&&n(this,"properties"))for(let[e,t]of Object.entries(this.properties)){let i=t.string;if(!i||n(this.prototype,e))continue;let s=Symbol(e);Object.defineProperty(this.prototype,e,{get(){return this[s]??this.t(i)},set(l){this[s]=l},configurable:!0,enumerable:!0})}super.finalize()}get stringsNamespace(){return s0(this.localName)}t(n,e){return uh(this.stringsNamespace,n,e,this,this.strings)}get locale(){return vl(this)}formatNumber(n,e){return wu(n,e,this.locale)}connectedCallback(){super.connectedCallback(),yu.add(this),r0()}disconnectedCallback(){super.disconnectedCallback(),yu.delete(this)}};C.properties={strings:{type:Object}};var fh={"chevron-down":"M6 9l6 6 6-6","chevron-up":"M6 15l6-6 6 6","chevron-right":"M9 6l6 6-6 6","chevron-left":"M15 6l-6 6 6 6",close:"M6 6l12 12M18 6L6 18",search:"M11 18a7 7 0 1 1 0-14 7 7 0 0 1 0 14zM16 16l4 4",filter:"M4 7h16M7 12h10M10 17h4",edit:"M4 20h4L19 9l-4-4L4 16v4zM14 6l4 4",eyedropper:"M14 6l4 4M12.5 7.5l4 4M15.5 3.5a2.1 2.1 0 013 0l2 2a2.1 2.1 0 010 3L18 11l-5-5 2.5-2.5zM14 9.5L5.5 18v2h2L16 11.5",trash:"M5 7h14M10 7V5h4v2M7 7l1 13h8l1-13M10 11v6M14 11v6","arrow-up-right":"M7 17L17 7M9 7h8v8",calendar:"M5 6h14v14H5zM5 10h14M9 4v4M15 4v4",upload:"M12 16V6M8 10l4-4 4 4M5 18h14",plus:"M12 5v14M5 12h14",check:"M5 12.5l4.5 4.5L19 7",bell:"M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15zM10 20h4",help:"M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18zM9.5 9.5a2.5 2.5 0 1 1 3.5 2.3c-.6.3-1 .9-1 1.6M12 17h.01",rocket:"M14 4c3 0 6 3 6 6l-6 6-6-6c0-3 3-6 6-6zM8 16l-3 3M10 18l-2 3M6 14l-3 2",home:"M4 11l8-7 8 7v9h-5v-6H9v6H4z",box:"M4 8l8-4 8 4v8l-8 4-8-4zM4 8l8 4 8-4M12 12v8",cart:"M5 8h14l-1 12H6zM9 8V6a3 3 0 0 1 6 0v2",more:"M6 12h.01M12 12h.01M18 12h.01",drag:"M9 6h.01M15 6h.01M9 12h.01M15 12h.01M9 18h.01M15 18h.01","eye-off":"M3 3l18 18M10.6 6.1A9 9 0 0 1 21 12a14 14 0 0 1-2.2 2.9M6.6 6.6A14 14 0 0 0 3 12s3 6 9 6a8 8 0 0 0 4-1",external:"M14 5h5v5M19 5l-8 8M18 14v5H5V6h5",users:"M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM2 21v-1a7 7 0 0 1 14 0v1M17 11a3 3 0 1 0 0-6M22 21v-1a5 5 0 0 0-4-5",chart:"M5 20V10M12 20V4M19 20v-7",settings:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM4 12h2M18 12h2M12 4v2M12 18v2M6.3 6.3l1.4 1.4M16.3 16.3l1.4 1.4M6.3 17.7l1.4-1.4M16.3 7.7l1.4-1.4",store:"M4 9l1-5h14l1 5M4 9h16v11H4zM9 20v-6h6v6",pin:"M15 4l5 5-3 1-4 4 1 4-2 2-4-4-4 4M8 12l4-4 1-3",clock:"M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18zM12 7v5l3 2",alert:"M12 4l9 16H3zM12 10v4M12 17h.01","check-circle":"M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18zM8 12l3 3 5-6","x-circle":"M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18zM9 9l6 6M15 9l-6 6",bag:"M6 8h12l1 12H5zM9 8a3 3 0 0 1 6 0",sun:"M12 16a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM12 2.5v2M12 19.5v2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M2.5 12h2M19.5 12h2M5.3 18.7l1.4-1.4M17.3 6.7l1.4-1.4",moon:"M19.5 14.5A8 8 0 0 1 9.5 4.5a8 8 0 1 0 10 10z",menu:"M4 7h16M4 12h16M4 17h16",copy:"M9 9h11v11H9zM5 15H4V4h11v1",code:"M8 8l-4 4 4 4M16 8l4 4-4 4M14 5l-4 14",download:"M12 4v11M7.5 10.5L12 15l4.5-4.5M5 19h14",book:"M5 5a2 2 0 0 1 2-2h12v15H7a2 2 0 0 0-2 2zM5 20a2 2 0 0 0 2 2h12v-4",pos:"M5 4h14v8H5zM3 16h18v4H3zM8 8h4M12 12v4",website:"M3 5h18v14H3zM3 9h18M9 13h6M9 16h4",apps:"M4 4h6v6H4zM14 4h6v6h-6zM4 14h6v6H4zM14 14h6v6h-6z",megaphone:"M4 10v4h3l8 5V5l-8 5zM18.5 9a4 4 0 0 1 0 6M7 14l1 5h3l-1-4",staff:"M5 4h14v17H5zM9 4V2h6v2M12 13a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5zM8 18a4 4 0 0 1 8 0",repeat:"M17 3l3 3-3 3M4 11V9a3 3 0 0 1 3-3h13M7 21l-3-3 3-3M20 13v2a3 3 0 0 1-3 3H4",wallet:"M4 6h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4zM4 6V5a1 1 0 0 1 1-1h11v2M15 13h2",user:"M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM4 21a8 8 0 0 1 16 0",star:"M12 3l2.8 5.7 6.2.9-4.5 4.4 1 6.2-5.5-2.9-5.5 2.9 1-6.2L3 9.6l6.2-.9z",percent:"M19 5L5 19M7 9a2 2 0 1 0 0-4 2 2 0 0 0 0 4zM17 19a2 2 0 1 0 0-4 2 2 0 0 0 0 4z","arrow-left":"M19 12H5M11 6l-6 6 6 6",send:"M21 3L10 14M21 3l-7 18-4-7-7-4z",link:"M10 14a4 4 0 0 0 6 0l3-3a4 4 0 0 0-6-6l-1 1M14 10a4 4 0 0 0-6 0l-3 3a4 4 0 0 0 6 6l1-1",share:"M18 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM18 22a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM8.6 13.5l6.8 4M15.4 6.5l-6.8 4",globe:"M12 21a9 9 0 1 1 0-18 9 9 0 0 1 0 18zM3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18",gift:"M4 11h16v9H4zM3 7h18v4H3zM12 7v13M12 7c-2 0-4-1-4-3s3-1 4 3c1-4 4-5 4-3s-2 3-4 3",mail:"M3 6h18v12H3zM3 6l9 7 9-7",chat:"M4 5h16v11h-9l-4 4v-4H4zM8 9.5h8M8 12.5h5",tag:"M4 4h7l9 9-7 7-9-9zM8.5 10a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z",building:"M3 21h18M5 21V4h9v17M14 10h5v11M8 8h3M8 12h3M8 16h3",map:"M3 6l6-2 6 2 6-2v14l-6 2-6-2-6 2zM9 4v14M15 6v14",note:"M6 3h8l4 4v14H6zM14 3v4h4M9 12h6M9 15h6M9 18h4",eye:"M3 12s3-6 9-6 9 6 9 6-3 6-9 6-9-6-9-6zM12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",inbox:"M3 13l3-8h12l3 8v6H3zM3 13h5l1 3h6l1-3h5",handshake:"M3 7v8M21 7v8M3 9l5-3h4l-3 3.5a1.5 1.5 0 0 0 2.2 2L13 9.5l5 5M21 9l-4-3h-5M3 15h2l5 4a1.4 1.4 0 0 0 2-2M10 15l3.5 3a1.4 1.4 0 0 0 2-2l-1.5-1.5","log-out":"M10 4H5v16h5M14 8l4 4-4 4M18 12H9",refresh:"M20 12a8 8 0 0 0-14.9-4M4 12a8 8 0 0 0 14.9 4M5 3.5V8h4.5M19 20.5V16h-4.5",tasks:"M5 5h14v14H5zM8.5 12l2.5 2.5 4.5-5",phone:"M5 4h3.5l1.5 4.5-2 1.5a11 11 0 0 0 6 6l1.5-2 4.5 1.5V19a1.5 1.5 0 0 1-1.5 1.5A15.5 15.5 0 0 1 3.5 5.5 1.5 1.5 0 0 1 5 4z",camera:"M3 8.5A1.5 1.5 0 0 1 4.5 7h3L9 4.5h6L16.5 7h3A1.5 1.5 0 0 1 21 8.5v9a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 3 17.5zM12 16.5a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7z",image:"M4 5h16v14H4zM4 16l4.5-4.5 4 4 2.5-2.5 5 5M15.5 10a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z","id-card":"M3 6h18v12H3zM8.5 11.5a1.75 1.75 0 1 0 0-3.5 1.75 1.75 0 0 0 0 3.5zM5.5 16a3 3 0 0 1 6 0M14 9.5h4M14 12.5h4M14 15.5h2.5",navigation:"M20 4l-6.5 16-2.5-7-7-2.5z","wifi-off":"M8.9 16.9a4 4 0 0 1 3.3-1.4M5.9 14.4a8 8 0 0 1 3-2.3M15.6 12.4a8 8 0 0 1 2.5 2M2.8 11.8a12 12 0 0 1 3-2.6M10.8 7.6a12 12 0 0 1 10.4 4.2M12 19.5h.01M3 3l18 18"},Nb=["more","drag"],$$=Object.keys(fh);var Pb=["chevron-left","chevron-right","arrow-left","arrow-up-right","send","log-out"],Js=class extends A{constructor(){super(...arguments);this.name="more";this.size=18;this.label="";this.mirror="auto"}render(){let e=fh[this.name]??fh.more,t=Nb.includes(this.name)?3:1.6;return ii`<svg width=${this.size} height=${this.size} viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
15
19
|
stroke-width=${t} stroke-linecap="round" stroke-linejoin="round"
|
|
16
20
|
role=${this.label?"img":h} aria-label=${this.label||h} aria-hidden=${this.label?h:"true"}
|
|
17
|
-
part="svg" class=${(this.mirror==="auto"?
|
|
21
|
+
part="svg" class=${(this.mirror==="auto"?Pb.includes(this.name):this.mirror==="always")?"flip":""}><path d=${e}></path></svg>`}};Js.properties={name:{reflect:!0},size:{type:Number},label:{},mirror:{}},Js.styles=w`
|
|
18
22
|
:host { display: inline-flex; flex: none; color: inherit; line-height: 0; }
|
|
19
23
|
svg { display: block; }
|
|
20
24
|
:host(:dir(rtl)) svg.flip { transform: scaleX(-1); }
|
|
21
|
-
`;$("cm-icon",Js);var
|
|
25
|
+
`;$("cm-icon",Js);var Ib=99,L$=z("button",{labelWithCount:"{label}, {count} unread",count:"{count} unread",countOverflow:"{max}+"}),bh,vh,yl,Cr=class extends C{constructor(){super();this.variant="secondary";this.size="medium";this.type="button";this.disabled=!1;this.loading=!1;this.iconOnly=!1;this.icon="";this.label="";this.count=0;m(this,bh,this.attachInternals());m(this,vh,e=>{if(this.disabled||this.loading){e.preventDefault(),e.stopImmediatePropagation();return}let t=r(this,bh).form;!t||this.href||(this.type==="submit"?t.requestSubmit():this.type==="reset"&&t.reset())});m(this,yl,!1);this.addEventListener("click",r(this,vh),{capture:!0})}updated(){this.iconOnly&&!this.label&&!this.textContent?.trim()&&!this.querySelector("[label]")&&!r(this,yl)&&(g(this,yl,!0),console.warn("cm-button: an icon-only button needs a `label` (its accessible name).",this))}render(){let e=Number.isFinite(this.count)&&this.count>0?Math.floor(this.count):0,t=this.loading?c`<span class="spinner" aria-hidden="true"></span>`:c`<slot name="icon">${this.icon?c`<cm-icon name=${this.icon} size="16"></cm-icon>`:h}</slot>`,i=this.iconOnly?c`<span class="vh"><slot></slot></span>`:c`<span class="text"><slot></slot></span>`,s=e?c`<span class="count" part="count" aria-hidden="true">${e>Ib?this.t("countOverflow",{max:Ib}):this.formatNumber(e)}</span>${this.iconOnly?h:c`<span class="vh"> ${this.t("count",{count:e})}</span>`}`:h,l=this.iconOnly&&(this.label||this.textContent?.trim())||"",d=!this.iconOnly||!l?h:e?this.t("labelWithCount",{label:l,count:e}):this.label||h,p=c`${t}${i}${s}`;return this.href&&!this.disabled?c`<a class="btn" part="control" href=${this.href} target=${this.target??h}
|
|
22
26
|
rel=${this.target==="_blank"?"noopener noreferrer":h} aria-label=${d}>${p}</a>`:c`<button class="btn" part="control" type="button"
|
|
23
27
|
?disabled=${this.disabled} aria-disabled=${this.loading?"true":h}
|
|
24
28
|
aria-busy=${this.loading?"true":h} aria-label=${d}>${p}</button>`}};bh=new WeakMap,vh=new WeakMap,yl=new WeakMap,Cr.formAssociated=!0,Cr.properties={variant:{reflect:!0},size:{reflect:!0},type:{},disabled:{type:Boolean,reflect:!0},loading:{type:Boolean,reflect:!0},href:{},target:{},iconOnly:{type:Boolean,reflect:!0,attribute:"icon-only"},icon:{},label:{},count:{type:Number},tone:{reflect:!0}},Cr.styles=[E,w`
|
|
@@ -110,7 +114,7 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
110
114
|
position: absolute; inset-block-start: -6px; inset-inline-end: -6px;
|
|
111
115
|
box-shadow: 0 0 0 2px var(--cm-bg-surface); pointer-events: none;
|
|
112
116
|
}
|
|
113
|
-
`];$("cm-button",Cr);var Qs=class extends A{constructor(){super(...arguments);this.value="";this.icon="";this.href="";this.disabled=!1;this.critical=!1;this.heading=!1;this.shortcut=""}render(){return null}toItem(){let e=(this.textContent??"").trim();return{label:e,value:this.value||e,icon:this.icon||void 0,href:this.href||void 0,disabled:this.disabled||void 0,critical:this.critical||void 0,heading:this.heading||void 0,shortcut:this.shortcut||void 0}}};Qs.properties={value:{reflect:!0},icon:{reflect:!0},href:{reflect:!0},disabled:{type:Boolean,reflect:!0},critical:{type:Boolean,reflect:!0},heading:{type:Boolean,reflect:!0},shortcut:{reflect:!0}},Qs.styles=w`:host { display: none; }`;$("cm-menu-item",Qs);function xl(o){let n=[];for(let e of Array.from(o.children))if(e.localName==="cm-menu-item"){let t=(e.textContent??"").trim(),i=s=>e.getAttribute(s)||void 0;n.push({label:t,value:i("value")??t,icon:i("icon"),href:i("href"),disabled:e.hasAttribute("disabled")||void 0,critical:e.hasAttribute("critical")||void 0,heading:e.hasAttribute("heading")||void 0,shortcut:i("shortcut")})}else e.localName==="hr"&&n.push({divider:!0});return n}function yh(o,n){let e=new MutationObserver(n);return e.observe(o,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),e}var
|
|
117
|
+
`];$("cm-button",Cr);var Qs=class extends A{constructor(){super(...arguments);this.value="";this.icon="";this.href="";this.disabled=!1;this.critical=!1;this.heading=!1;this.shortcut=""}render(){return null}toItem(){let e=(this.textContent??"").trim();return{label:e,value:this.value||e,icon:this.icon||void 0,href:this.href||void 0,disabled:this.disabled||void 0,critical:this.critical||void 0,heading:this.heading||void 0,shortcut:this.shortcut||void 0}}};Qs.properties={value:{reflect:!0},icon:{reflect:!0},href:{reflect:!0},disabled:{type:Boolean,reflect:!0},critical:{type:Boolean,reflect:!0},heading:{type:Boolean,reflect:!0},shortcut:{reflect:!0}},Qs.styles=w`:host { display: none; }`;$("cm-menu-item",Qs);function xl(o){let n=[];for(let e of Array.from(o.children))if(e.localName==="cm-menu-item"){let t=(e.textContent??"").trim(),i=s=>e.getAttribute(s)||void 0;n.push({label:t,value:i("value")??t,icon:i("icon"),href:i("href"),disabled:e.hasAttribute("disabled")||void 0,critical:e.hasAttribute("critical")||void 0,heading:e.hasAttribute("heading")||void 0,shortcut:i("shortcut")})}else e.localName==="hr"&&n.push({divider:!0});return n}function yh(o,n){let e=new MutationObserver(n);return e.observe(o,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),e}var Ie=w`
|
|
114
118
|
:where([popover]) { margin: 0; padding: 0; border: 0; color: inherit; background: none; overflow: visible; }
|
|
115
119
|
`,wl=8,Lt,Zs,ea,ta,zr,xe=class{constructor(){m(this,Lt,null);m(this,Zs,null);m(this,ea,{});m(this,ta,"");m(this,zr,()=>this.place())}get active(){return!!r(this,Lt)}open(n,e,t={}){if(!n||!e||typeof n.showPopover!="function")return!1;r(this,Lt)&&r(this,Lt)!==n&&this.close(),n.hasAttribute("popover")||n.setAttribute("popover","manual");let i=n.matches(":popover-open");if(!i){if(getComputedStyle(n).position==="static")return n.removeAttribute("popover"),!1;try{n.showPopover()}catch{return!1}}return n.matches(":popover-open")?(r(this,Lt)||g(this,ta,n.style.maxHeight),g(this,Lt,n),g(this,Zs,e),g(this,ea,t),Object.assign(n.style,{position:"fixed",inset:"auto",margin:"0"}),this.place(),i||(window.addEventListener("scroll",r(this,zr),!0),window.addEventListener("resize",r(this,zr))),!0):!1}place(){let n=r(this,Lt),e=r(this,Zs);if(!n||!e)return;let t=e.getBoundingClientRect(),i=document.documentElement.clientWidth,s=document.documentElement.clientHeight,l=r(this,ea).gap??4,d=r(this,ea).align??"start";n.style.maxHeight=r(this,ta),d==="stretch"&&(n.style.minWidth=`${Math.round(t.width)}px`);let p=n.getBoundingClientRect(),u=p.width,b=p.height,f=getComputedStyle(e).direction==="rtl",x=f?t.right-u:t.left,v=f?t.left:t.right-u,k=d==="end"?v:x;k+u>i-wl&&(k=f?x:v);let L=Math.max(0,Math.min(wl,t.left)),P=Math.min(i,Math.max(i-wl,t.right))-u;k=Math.max(L,Math.min(k,P));let U=s-t.bottom-l-wl,q=t.top-l-wl,O;if(b<=U||U>=q)O=t.bottom+l,b>U&&(n.style.maxHeight=`${Math.max(80,Math.floor(U))}px`);else{let be=Math.min(b,Math.floor(q));b>q&&(n.style.maxHeight=`${Math.max(80,be)}px`),O=t.top-l-be}n.style.left=`${k}px`,n.style.top=`${O}px`}close(){let n=r(this,Lt);if(window.removeEventListener("scroll",r(this,zr),!0),window.removeEventListener("resize",r(this,zr)),g(this,Lt,null),g(this,Zs,null),!!n){try{n.matches(":popover-open")&&n.hidePopover()}catch{}for(let e of["position","inset","margin","left","top","minWidth"])n.style[e]="";n.style.maxHeight=r(this,ta)}}};Lt=new WeakMap,Zs=new WeakMap,ea=new WeakMap,ta=new WeakMap,zr=new WeakMap;var ia=class extends C{constructor(){super(...arguments);this.size="large";this.custom=!1}onSlotChange(e){let t=e.target.assignedElements().length>0;t!==this.custom&&(this.custom=t,this.requestUpdate())}render(){let e=this.size==="small"?2.5:3;return c`<span class="spinner" part="spinner" role="status">
|
|
116
120
|
${this.custom?h:c`<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
|
|
@@ -137,18 +141,18 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
137
141
|
svg { animation-duration: 2.4s; }
|
|
138
142
|
.spinner { --cm-spinner-play-state: paused; }
|
|
139
143
|
}
|
|
140
|
-
`];$("cm-spinner",ia);var
|
|
144
|
+
`];$("cm-spinner",ia);var Y$=z("actionMenu",{label:"Actions"}),$l,Sr,Lr,kl,J,xh,El,wh,$h,kh,Eh,qb,sa,aa,na,ra,Mh,Ob,$u,Bb,Ft=class extends C{constructor(){super(...arguments);m(this,J);this.items=[];this.open=!1;this.triggerLabel="";this.iconOnly=!1;this.icon="more";this.align="start";this.heading="";this.subheading="";this.loading=!1;this.disabled=!1;this._slotted=[];this._active=-1;this._custom=!1;m(this,$l);m(this,Sr,N("cm-menu"));m(this,Lr,"");m(this,kl,0);m(this,El,e=>{this.open&&!e.composedPath().includes(this)&&a(this,J,kh).call(this,!1)});m(this,sa,new xe);m(this,aa,e=>{this.disabled||(e.key==="ArrowDown"?(e.preventDefault(),this.show("first")):e.key==="ArrowUp"?(e.preventDefault(),this.show("last")):e.key==="Escape"&&this.open&&(e.preventDefault(),e.stopPropagation(),this.hide(!0)))});m(this,na,()=>{this.disabled||(this.open?this.hide():this.show())});m(this,Mh,e=>{let t=a(this,J,$h).call(this),i=t.indexOf(this._active);switch(e.key){case"ArrowDown":e.preventDefault(),a(this,J,ra).call(this,t[(i+1)%t.length]);break;case"ArrowUp":e.preventDefault(),a(this,J,ra).call(this,t[(i-1+t.length)%t.length]);break;case"Home":e.preventDefault(),a(this,J,ra).call(this,t[0]);break;case"End":e.preventDefault(),a(this,J,ra).call(this,t[t.length-1]);break;case"Escape":e.preventDefault(),e.stopPropagation(),this.hide(!0);break;case"Tab":this.hide();break;default:if(e.key.length===1&&/\S/.test(e.key)&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let s=Date.now();g(this,Lr,(s-r(this,kl)<600?r(this,Lr):"")+e.key.toLowerCase()),g(this,kl,s);let l=this.menuItems,d=r(this,Lr).length>1?i:i+1,u=[...t.slice(Math.max(d,0)),...t.slice(0,Math.max(d,0))].find(b=>(l[b].label??"").toLowerCase().startsWith(r(this,Lr)));u!==void 0&&a(this,J,ra).call(this,u)}}})}connectedCallback(){super.connectedCallback(),a(this,J,xh).call(this),g(this,$l,yh(this,()=>a(this,J,xh).call(this))),document.addEventListener("pointerdown",r(this,El),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,$l)?.disconnect(),document.removeEventListener("pointerdown",r(this,El),!0),r(this,sa).close()}get menuItems(){return this.items.length?this.items:this._slotted}show(e="first"){let t=a(this,J,$h).call(this);this._active=e==="first"?t[0]??-1:t[t.length-1]??-1,a(this,J,kh).call(this,!0),this.updateComplete.then(()=>a(this,J,Eh).call(this))}hide(e=!1){a(this,J,kh).call(this,!1),e&&a(this,J,wh).call(this)?.focus()}updated(e){if(e.has("open")&&this.open&&a(this,J,qb).call(this),e.has("open")&&!this.open&&r(this,sa).close(),this._custom){let t=a(this,J,wh).call(this);if(t){let i=(s,l)=>{t.getAttribute(s)!==l&&t.setAttribute(s,l)};i("aria-haspopup","menu"),i("aria-expanded",String(this.open)),i("aria-controls",`${r(this,Sr)}-m`)}}if((e.has("open")||e.has("loading"))&&this.open&&this._active<0){let t=a(this,J,$h).call(this);this._active=t[0]??-1,this.updateComplete.then(()=>a(this,J,Eh).call(this))}}triggerTemplate(e,t){}headTemplate(){}render(){let e=this.menuItems,t=this.triggerLabel||this.label,i=this._custom?c`<slot name="trigger" @click=${r(this,na)} @keydown=${r(this,aa)} @slotchange=${()=>a(this,J,xh).call(this)}></slot>`:this.triggerTemplate(r(this,na),r(this,aa))??c`<button type="button" class="trigger ${this.iconOnly?"icon":""}" part="trigger" aria-haspopup="menu"
|
|
141
145
|
aria-expanded=${String(this.open)} aria-controls="${r(this,Sr)}-m" aria-label=${this.iconOnly?t:h}
|
|
142
146
|
?disabled=${this.disabled} @click=${r(this,na)} @keydown=${r(this,aa)}>${this.iconOnly?c`<cm-icon name=${this.icon} size="18"></cm-icon>`:c`<span>${t}</span><cm-icon name="chevron-down" size="14"></cm-icon>`}</button>`;return c`${i}
|
|
143
147
|
<div class="pop" part="menu" popover="manual" ?hidden=${!this.open}>
|
|
144
148
|
${this.headTemplate()??(this.heading?c`<div class="head" part="heading"><strong>${this.heading}</strong>${this.subheading?c`<span>${this.subheading}</span>`:h}</div>`:h)}
|
|
145
149
|
<div role="menu" id="${r(this,Sr)}-m" aria-label=${this.heading||this.label} aria-busy=${this.loading?"true":h} @keydown=${r(this,Mh)}>
|
|
146
|
-
${this.loading?c`<div class="loading" role="presentation"><cm-spinner size="small" aria-hidden="true"></cm-spinner><span>${this.t("loading")}</span></div>`:a(this,J,
|
|
150
|
+
${this.loading?c`<div class="loading" role="presentation"><cm-spinner size="small" aria-hidden="true"></cm-spinner><span>${this.t("loading")}</span></div>`:a(this,J,Bb).call(this,e)}
|
|
147
151
|
</div>
|
|
148
152
|
</div>
|
|
149
|
-
<slot hidden></slot>`}};$l=new WeakMap,Sr=new WeakMap,Lr=new WeakMap,kl=new WeakMap,J=new WeakSet,xh=function(){this._slotted=xl(this),this._custom=!!this.querySelector(':scope > [slot="trigger"]')},El=new WeakMap,wh=function(){return this._custom?this.querySelector(':scope > [slot="trigger"]'):this.renderRoot.querySelector(".trigger")},$h=function(){return this.loading?[]:this.menuItems.map((e,t)=>!e.divider&&!e.heading&&!e.disabled?t:-1).filter(e=>e>=0)},kh=function(e){this.open!==e&&(this.open=e,e||(this._active=-1),this.dispatchEvent(new CustomEvent("cm-toggle",{detail:{open:e},bubbles:!0,composed:!0})))},Eh=function(){this.renderRoot.querySelector(`[data-i="${this._active}"]`)?.focus()},
|
|
153
|
+
<slot hidden></slot>`}};$l=new WeakMap,Sr=new WeakMap,Lr=new WeakMap,kl=new WeakMap,J=new WeakSet,xh=function(){this._slotted=xl(this),this._custom=!!this.querySelector(':scope > [slot="trigger"]')},El=new WeakMap,wh=function(){return this._custom?this.querySelector(':scope > [slot="trigger"]'):this.renderRoot.querySelector(".trigger")},$h=function(){return this.loading?[]:this.menuItems.map((e,t)=>!e.divider&&!e.heading&&!e.disabled?t:-1).filter(e=>e>=0)},kh=function(e){this.open!==e&&(this.open=e,e||(this._active=-1),this.dispatchEvent(new CustomEvent("cm-toggle",{detail:{open:e},bubbles:!0,composed:!0})))},Eh=function(){this.renderRoot.querySelector(`[data-i="${this._active}"]`)?.focus()},qb=function(){let e=this.renderRoot.querySelector(".pop");if(!e||r(this,sa).open(e,a(this,J,wh).call(this)??this,{align:this.align==="end"?"end":"start"}))return;e.classList.remove("to-end","to-start");let t=e.getBoundingClientRect(),i=document.documentElement.clientWidth,s=8,l=getComputedStyle(this).direction==="rtl",d=l?t.left<s:t.right>i-s,p=l?t.right>i-s:t.left<s;this.align!=="end"&&d?e.classList.add("to-end"):this.align==="end"&&p&&e.classList.add("to-start")},sa=new WeakMap,aa=new WeakMap,na=new WeakMap,ra=function(e){this._active=e,this.updateComplete.then(()=>a(this,J,Eh).call(this))},Mh=new WeakMap,Ob=function(e,t){if(t.disabled){e.preventDefault();return}let i=this.dispatchEvent(new CustomEvent("cm-select",{detail:{value:t.value??t.label,item:t},bubbles:!0,composed:!0,cancelable:!0}));i||e.preventDefault(),this.hide(!t.href||!i)},$u=function(e,t){if(e.divider)return c`<div role="separator"></div>`;let i=`item${e.critical?" critical":""}${t===this._active?" active":""}`,s=c`${e.icon?c`<cm-icon name=${e.icon} size="16"></cm-icon>`:h}<span class="label">${e.label}</span>${e.shortcut?c`<span class="shortcut" part="shortcut" aria-hidden="true">${e.shortcut}</span>`:h}`,l={over:()=>{e.disabled||(this._active=t)},click:d=>a(this,J,Ob).call(this,d,e)};return e.href&&!e.disabled?c`<a class=${i} part="item" role="menuitem" tabindex="-1" data-i=${t} href=${e.href}
|
|
150
154
|
aria-keyshortcuts=${e.shortcut||h} @pointerenter=${l.over} @click=${l.click}>${s}</a>`:c`<button type="button" class=${i} part="item" role="menuitem" tabindex="-1" data-i=${t}
|
|
151
|
-
aria-disabled=${e.disabled?"true":h} aria-keyshortcuts=${e.shortcut||h} @pointerenter=${l.over} @click=${l.click}>${s}</button>`},
|
|
155
|
+
aria-disabled=${e.disabled?"true":h} aria-keyshortcuts=${e.shortcut||h} @pointerenter=${l.over} @click=${l.click}>${s}</button>`},Bb=function(e){let t=[];for(let i=0;i<e.length;i++){let s=e[i];if(!s.heading){t.push(a(this,J,$u).call(this,s,i));continue}let l=`${r(this,Sr)}-h${i}`,d=[],p=i+1;for(;p<e.length&&!e[p].heading&&!e[p].divider;p++)d.push(a(this,J,$u).call(this,e[p],p));t.push(c`<div role="group" aria-labelledby=${l}><div class="section" part="section" id=${l} role="presentation">${s.label}</div>${d}</div>`),i=p-1}return t},Ft.properties={items:{type:Array},open:{type:Boolean,reflect:!0},label:{string:"label"},triggerLabel:{attribute:"trigger-label"},iconOnly:{type:Boolean,attribute:"icon-only"},icon:{},align:{reflect:!0},heading:{},subheading:{},density:{reflect:!0},loading:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},_slotted:{state:!0},_active:{state:!0},_custom:{state:!0}},Ft.styles=[E,w`
|
|
152
156
|
:host { display: inline-block; position: relative; vertical-align: middle; }
|
|
153
157
|
.trigger {
|
|
154
158
|
display: inline-flex; align-items: center; gap: var(--cm-space-8); min-height: var(--cm-control-height-md, 36px); padding: 0 var(--cm-space-12); font: inherit; font-size: var(--cm-font-size-14); font-weight: 500;
|
|
@@ -211,12 +215,12 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
211
215
|
}
|
|
212
216
|
.loading { display: flex; align-items: center; gap: var(--cm-space-8); min-height: var(--cm-control-height-md, 36px); padding: var(--cm-space-4) var(--cm-space-12); font-size: var(--cm-font-size-14); color: var(--cm-text-tertiary); }
|
|
213
217
|
[role='separator'] { height: 0; margin: 4px 0; border-top: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
214
|
-
`];$("cm-action-menu",Ft);var
|
|
218
|
+
`];$("cm-action-menu",Ft);var t1=z("buttonGroup",{more:"More"}),Di="data-cm-overflow",a0=["disabled","loading","tone","icon","label","variant","size","icon-only","count","href","hidden","data-priority"],Ri,Ar,ri,Vt,Hi,Dr,Q,oa,Fb,Ml,ku,_h,Th,Vb,Ch,Eu,Mu,_u,la=class extends C{constructor(){super(...arguments);m(this,Q);this.overflow="wrap";this.align="start";this.label="";this._items=[];this._size="medium";m(this,Ri,[]);m(this,Ar);m(this,ri);m(this,Vt,0);m(this,Hi,new Set);m(this,Dr,!1);m(this,Ch,e=>{e.stopPropagation();let t=r(this,Ri)[Number(e.detail.value)];if(!t)return;g(this,Dr,!0),(t.shadowRoot?.querySelector('[part="control"]')??t).click(),requestAnimationFrame(()=>requestAnimationFrame(()=>a(this,Q,Eu).call(this)))})}get overflowing(){return[...r(this,Ri)]}connectedCallback(){super.connectedCallback(),g(this,Ar,new MutationObserver(e=>a(this,Q,Fb).call(this,e))),r(this,Ar).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:a0}),typeof ResizeObserver<"u"&&(g(this,ri,new ResizeObserver(()=>a(this,Q,oa).call(this))),r(this,ri).observe(this),g(this,Hi,new Set([this]))),document.fonts?.ready.then(()=>a(this,Q,oa).call(this)),a(this,Q,oa).call(this)}disconnectedCallback(){super.disconnectedCallback(),r(this,Ar)?.disconnect(),r(this,ri)?.disconnect(),r(this,Hi).clear(),cancelAnimationFrame(r(this,Vt)),g(this,Vt,0),a(this,Q,ku).call(this,a(this,Q,Ml).call(this))}updated(e){(e.has("overflow")||e.has("moreLabel")||e.has("moreIcon")||e.has("size"))&&a(this,Q,oa).call(this)}firstUpdated(){this.updateComplete.then(()=>this.relayout())}relayout(){cancelAnimationFrame(r(this,Vt)),g(this,Vt,0),a(this,Q,Th).call(this)}render(){let e=this.moreIcon!=null;return c`<div class="row" part="row" role="group" aria-label=${this.label||h}>
|
|
215
219
|
<slot></slot>
|
|
216
220
|
<cm-action-menu class="more ${this._size}${e?" icon":""}" part="more" hidden align="end"
|
|
217
221
|
.items=${this._items} label=${this.moreLabel} ?icon-only=${e} icon=${this.moreIcon||"more"}
|
|
218
222
|
@cm-select=${r(this,Ch)}></cm-action-menu>
|
|
219
|
-
</div>`}};Ri=new WeakMap,Ar=new WeakMap,ri=new WeakMap,Vt=new WeakMap,Hi=new WeakMap,Dr=new WeakMap,Q=new WeakSet,oa=function(){r(this,Vt)||!this.isConnected||g(this,Vt,requestAnimationFrame(()=>{g(this,Vt,0);let e=a(this,Q,Ml).call(this).map(t=>t.updateComplete).filter(Boolean);e.length?Promise.all(e).then(()=>a(this,Q,Th).call(this)):a(this,Q,Th).call(this)}))},
|
|
223
|
+
</div>`}};Ri=new WeakMap,Ar=new WeakMap,ri=new WeakMap,Vt=new WeakMap,Hi=new WeakMap,Dr=new WeakMap,Q=new WeakSet,oa=function(){r(this,Vt)||!this.isConnected||g(this,Vt,requestAnimationFrame(()=>{g(this,Vt,0);let e=a(this,Q,Ml).call(this).map(t=>t.updateComplete).filter(Boolean);e.length?Promise.all(e).then(()=>a(this,Q,Th).call(this)):a(this,Q,Th).call(this)}))},Fb=function(e){for(let t of e)for(let i of Array.from(t.removedNodes))i instanceof HTMLElement&&i.hasAttribute(Di)&&i.parentElement!==this&&(i.removeAttribute(Di),i.hidden=!1);a(this,Q,oa).call(this)},Ml=function(){return Array.from(this.children).filter(e=>e.localName==="cm-button"&&(!e.hidden||e.hasAttribute(Di)))},ku=function(e){for(let t of e)t.hasAttribute(Di)&&(t.removeAttribute(Di),t.hidden=!1)},_h=function(){return this.renderRoot.querySelector(".more")},Th=function(){let e=this.renderRoot.querySelector(".row"),t=a(this,Q,_h).call(this);if(!e||!t||!this.isConnected)return;let i=a(this,Q,Ml).call(this),s=this.shadowRoot.activeElement===t?t:i.find(b=>b.matches(":focus-within"))??null,l=i[0]?.getAttribute("size");this._size=this.size||(l==="slim"||l==="large"?l:"medium");let d=new Set;if(r(this,ri)){let b=new Set([this,t,...i]);for(let f of r(this,Hi))b.has(f)||r(this,ri).unobserve(f);for(let f of b)r(this,Hi).has(f)||r(this,ri).observe(f);g(this,Hi,b)}if(this.overflow==="menu"){a(this,Q,ku).call(this,i),t.hidden=!1;let b=e.clientWidth,f=parseFloat(getComputedStyle(e).columnGap)||0,x=Array.from(this.children).filter(L=>!L.hidden),v=new Map(x.map(L=>[L,L.getBoundingClientRect().width])),k=x.reduce((L,P)=>L+v.get(P),0)+f*Math.max(x.length-1,0);if(k>b+.5){let L=q=>{let O=q.dataset.priority;return O==="low"?0:O==="high"?2:q.getAttribute("variant")==="primary"?3:1},P=i.map((q,O)=>({b:q,i:O,r:L(q)})).sort((q,O)=>q.r-O.r||O.i-q.i),U=k+f+t.getBoundingClientRect().width;for(let{b:q}of P){if(U<=b+.5)break;d.add(q),U-=v.get(q)+f}}}for(let b of i)d.has(b)?(b.setAttribute(Di,""),b.hidden=!0):b.hasAttribute(Di)&&(b.removeAttribute(Di),b.hidden=!1);t.hidden=d.size===0,s===t&&t.hidden?a(this,Q,_u).call(this):s&&s!==t&&d.has(s)&&a(this,Q,Mu).call(this),d.size===0&&t.open&&t.hide(),r(this,Ar)?.takeRecords();let p=i.filter(b=>d.has(b));this._items=p.map((b,f)=>a(this,Q,Vb).call(this,b,f));let u=p.length!==r(this,Ri).length||p.some((b,f)=>b!==r(this,Ri)[f]);g(this,Ri,p),u&&this.dispatchEvent(new CustomEvent("cm-overflow-change",{detail:{hidden:[...p]},bubbles:!0,composed:!0})),r(this,Dr)&&this.updateComplete.then(()=>a(this,Q,Eu).call(this))},Vb=function(e,t){let i=Array.from(e.childNodes).filter(d=>!(d instanceof Element&&d.hasAttribute("slot"))).map(d=>d.textContent??"").join("").replace(/\s+/g," ").trim(),s=e.hasAttribute("icon-only")?e.getAttribute("label")||i:i||e.getAttribute("label")||"",l=e.getAttribute("icon")||e.querySelector(':scope > [slot="icon"]')?.getAttribute("name")||void 0;return{label:s,value:String(t),icon:l,disabled:e.hasAttribute("disabled")||e.hasAttribute("loading")||void 0,critical:e.getAttribute("tone")==="critical"||void 0}},Ch=new WeakMap,Eu=function(){if(!r(this,Dr))return;g(this,Dr,!1);let e=document.activeElement,t=a(this,Q,_h).call(this);(!e||e===document.body||e===document.documentElement||e===this&&(!t||t.hidden||this.shadowRoot.activeElement!==t))&&(t&&!t.hidden?a(this,Q,Mu).call(this):a(this,Q,_u).call(this))},Mu=function(){a(this,Q,_h).call(this)?.shadowRoot?.querySelector('[part="trigger"]')?.focus()},_u=function(){let e=a(this,Q,Ml).call(this).filter(i=>!i.hidden&&!i.hasAttribute("disabled")),t=e[e.length-1];(t?.shadowRoot?.querySelector('[part="control"]')??t)?.focus()},la.properties={overflow:{reflect:!0},moreLabel:{attribute:"more-label",string:"more"},moreIcon:{attribute:"more-icon"},size:{reflect:!0},align:{reflect:!0},label:{},_items:{state:!0},_size:{state:!0}},la.styles=[E,w`
|
|
220
224
|
:host { display: block; min-inline-size: 0; }
|
|
221
225
|
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cm-space-8); min-inline-size: 0; }
|
|
222
226
|
:host([align='end']) .row { justify-content: flex-end; }
|
|
@@ -240,7 +244,7 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
240
244
|
.more::part(trigger), .more.slim::part(trigger) { min-height: var(--cm-control-height-lg, 40px); }
|
|
241
245
|
.more.icon::part(trigger), .more.icon.slim::part(trigger) { width: var(--cm-control-height-lg, 40px); }
|
|
242
246
|
}
|
|
243
|
-
`];$("cm-button-group",la);var At={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ca=o=>(...n)=>({_$litDirective$:o,values:n}),Ni=class{constructor(n){}get _$AU(){return this._$AM._$AU}_$AT(n,e,t){this._$Ct=n,this._$AM=e,this._$Ci=t}_$AS(n,e){return this.update(n,e)}update(n,e){return this.render(...e)}};var{I:
|
|
247
|
+
`];$("cm-button-group",la);var At={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ca=o=>(...n)=>({_$litDirective$:o,values:n}),Ni=class{constructor(n){}get _$AU(){return this._$AM._$AU}_$AT(n,e,t){this._$Ct=n,this._$AM=e,this._$Ci=t}_$AS(n,e){return this.update(n,e)}update(n,e){return this.render(...e)}};var{I:n0}=Ab,jb=o=>o;var Kb=o=>o.strings===void 0,Ub=()=>document.createComment(""),da=(o,n,e)=>{let t=o._$AA.parentNode,i=n===void 0?o._$AB:n._$AA;if(e===void 0){let s=t.insertBefore(Ub(),i),l=t.insertBefore(Ub(),i);e=new n0(s,l,o,o.options)}else{let s=e._$AB.nextSibling,l=e._$AM,d=l!==o;if(d){let p;e._$AQ?.(o),e._$AM=o,e._$AP!==void 0&&(p=o._$AU)!==l._$AU&&e._$AP(p)}if(s!==i||d){let p=e._$AA;for(;p!==s;){let u=jb(p).nextSibling;jb(t).insertBefore(p,i),p=u}}}return e},Pi=(o,n,e=o)=>(o._$AI(n,e),o),o0={},zh=(o,n=o0)=>o._$AH=n,Wb=o=>o._$AH,Sh=o=>{o._$AR(),o._$AA.remove()};var ee=ca(class extends Ni{constructor(o){if(super(o),o.type!==At.PROPERTY&&o.type!==At.ATTRIBUTE&&o.type!==At.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!Kb(o))throw Error("`live` bindings can only contain a single expression")}render(o){return o}update(o,[n]){if(n===Pe||n===h)return n;let e=o.element,t=o.name;if(o.type===At.PROPERTY){if(n===e[t])return Pe}else if(o.type===At.BOOLEAN_ATTRIBUTE){if(!!n===e.hasAttribute(t))return Pe}else if(o.type===At.ATTRIBUTE&&e.getAttribute(t)===n+"")return Pe;return zh(o),n}});var bt=w`
|
|
244
248
|
:host {
|
|
245
249
|
--_cm-field-h: var(--cm-control-height-lg, 40px);
|
|
246
250
|
--_cm-field-font: var(--cm-font-size-14, 14px);
|
|
@@ -276,7 +280,7 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
276
280
|
[role='option']:not([aria-disabled='true']):not([aria-selected='true']):active { background: color-mix(in srgb, var(--cm-bg-hover), var(--cm-text-default) 8%); }
|
|
277
281
|
:host([size='small']) [role='option'] { min-height: var(--cm-control-height-sm, 32px); }
|
|
278
282
|
@media (pointer: coarse) { [role='option'], :host([size='small']) [role='option'] { min-height: var(--cm-control-height-touch, 44px); } }
|
|
279
|
-
`;var Lh=!1,Tu=!1,
|
|
283
|
+
`;var Lh=!1,Tu=!1,Gb=!1,Yb=()=>{Lh||(Lh=!0,setTimeout(()=>{Lh=!1,Tu=!1}))};function l0(){Gb||typeof document>"u"||(Gb=!0,document.addEventListener("click",Yb,!0),document.addEventListener("keydown",o=>{(o.key==="Enter"||o.ctrlKey||o.metaKey)&&Yb()},!0))}var et,Rr,pa,ma,Ii,_l,Hr,Tl,Cu,Cl,Ah,Dh,re=class{constructor(n,e,t){m(this,Tl);m(this,et);m(this,Rr);m(this,pa);m(this,ma,!1);m(this,Ii,!1);m(this,_l,"");m(this,Hr,!1);m(this,Cl,()=>{g(this,ma,!0)});m(this,Ah,n=>{let e=n.relatedTarget;e&&(r(this,et).contains(e)||r(this,et).shadowRoot?.contains(e))||r(this,et).updateComplete.then(()=>{if(!r(this,ma)||r(this,Ii))return;let t=r(this,Rr).validity;t.valid||t.valueMissing||(g(this,Ii,!0),r(this,et).requestUpdate())})});m(this,Dh,n=>{if(!(!Lh&&!r(this,Hr))){if(n.preventDefault(),g(this,Ii,!0),r(this,et).requestUpdate(),r(this,Hr)){r(this,pa).call(this);return}Tu||(Tu=!0,r(this,pa).call(this))}});g(this,et,n),g(this,Rr,e),g(this,pa,t??(()=>n.focus())),l0(),n.addEventListener("invalid",r(this,Dh)),n.addEventListener("input",r(this,Cl),!0),n.addEventListener("change",r(this,Cl),!0),n.addEventListener("focusout",r(this,Ah))}get message(){return a(this,Tl,Cu).call(this)}sync(){let n=a(this,Tl,Cu).call(this);r(this,et).toggleAttribute("data-cm-invalid",!!n),n!==r(this,_l)&&(g(this,_l,n),queueMicrotask(()=>r(this,et).requestUpdate()))}reset(){g(this,ma,g(this,Ii,!1)),r(this,et).requestUpdate()}report(n){g(this,Hr,!0);try{return n()}finally{g(this,Hr,!1)}}};et=new WeakMap,Rr=new WeakMap,pa=new WeakMap,ma=new WeakMap,Ii=new WeakMap,_l=new WeakMap,Hr=new WeakMap,Tl=new WeakSet,Cu=function(){return r(this,et).error?r(this,et).error:r(this,Ii)?r(this,Rr).validity.valid?"":r(this,Rr).validationMessage:""},Cl=new WeakMap,Ah=new WeakMap,Dh=new WeakMap;var E1=z("textField",{required:"Please fill in this field.",rangeUnderflow:"Enter {min} or later.",rangeOverflow:"Enter {max} or earlier.",numberUnderflow:"Enter {min} or more.",numberOverflow:"Enter {max} or less.",stepMismatch:"Enter a valid value. The two nearest are {lower} and {upper}.",badTime:"Enter a complete time.",badDateTime:"Enter a complete date and time.",badEmail:"Enter an email address like name@example.com.",badUrl:"Enter a web address like https://example.com.",badNumber:"Enter a number.",pattern:"Enter a value in the requested format.",tooShort:"Enter at least {min} characters.",tooLong:"Enter {max} characters or fewer."}),ue,Nr,si,Sl,oe,Xb,zl,Rh,Jb,zu,Su,Lu,qi=class extends C{constructor(){super(...arguments);m(this,oe);this.label="";this.hint="";this.helpText="";this.error="";this.name="";this.value="";this.placeholder="";this.type="text";this.multiline=!1;this.rows=4;this.required=!1;this.disabled=!1;this.readonly=!1;this.inputMode="";this.size="default";this.patternMessage="";m(this,ue,this.attachInternals());m(this,Nr,new re(this,r(this,ue)));m(this,si,N("cm-tf"));m(this,Sl,"")}connectedCallback(){super.connectedCallback(),g(this,Sl,this.value)}get form(){return r(this,ue).form}get validity(){return r(this,ue).validity}get validationMessage(){return r(this,ue).validationMessage}checkValidity(){return a(this,oe,zl).call(this),r(this,ue).checkValidity()}reportValidity(){return a(this,oe,zl).call(this),r(this,Nr).report(()=>r(this,ue).reportValidity())}formResetCallback(){this.value=r(this,Sl),this.error="",r(this,Nr).reset()}formDisabledCallback(e){this.disabled=e}updated(){r(this,ue).setFormValue(this.value),a(this,oe,zl).call(this)}render(){let e=r(this,Nr).message,t=[e&&`${r(this,si)}-err`,this.helpText&&`${r(this,si)}-help`].filter(Boolean).join(" ")||h,i={id:r(this,si),invalid:e?"true":h},s=this.minLength!=null&&this.minLength>0?this.minLength:h,l=this.maxLength!=null&&this.maxLength>=0?this.maxLength:h,d=this.multiline?c`<textarea class="input" part="input" id=${i.id} rows=${this.rows}
|
|
280
284
|
.value=${ee(this.value)} placeholder=${this.placeholder||h}
|
|
281
285
|
inputmode=${this.inputMode||h}
|
|
282
286
|
minlength=${s} maxlength=${l}
|
|
@@ -294,7 +298,7 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
294
298
|
${d}
|
|
295
299
|
${e?c`<p class="error" id="${r(this,si)}-err" role="alert">${e}</p>`:h}
|
|
296
300
|
${this.helpText?c`<p class="help" id="${r(this,si)}-help">${this.helpText}</p>`:h}
|
|
297
|
-
</div>`}};ue=new WeakMap,Nr=new WeakMap,si=new WeakMap,Sl=new WeakMap,oe=new WeakSet,
|
|
301
|
+
</div>`}};ue=new WeakMap,Nr=new WeakMap,si=new WeakMap,Sl=new WeakMap,oe=new WeakSet,Xb=function(e){if(!this.pattern)return!0;for(let t of["v","u"])try{return new RegExp(`^(?:${this.pattern})$`,t).test(e)}catch{}return!0},zl=function(){let e=this.renderRoot.querySelector(".input"),t=e instanceof HTMLInputElement?e.validity:null,i=this.type==="time"||this.type==="datetime-local";this.error?r(this,ue).setValidity({customError:!0},this.error,e??void 0):i&&t?.badInput?r(this,ue).setValidity({badInput:!0},this.t(this.type==="time"?"badTime":"badDateTime"),e??void 0):this.type==="number"&&t?.badInput?r(this,ue).setValidity({badInput:!0},this.t("badNumber"),e??void 0):this.required&&!this.value?r(this,ue).setValidity({valueMissing:!0},this.t("required"),e??void 0):!this.multiline&&t?.typeMismatch?r(this,ue).setValidity({typeMismatch:!0},this.t(this.type==="url"?"badUrl":"badEmail"),e??void 0):this.value&&this.minLength!=null&&this.minLength>0&&this.value.length<this.minLength?r(this,ue).setValidity({tooShort:!0},this.t("tooShort",{min:this.minLength}),e??void 0):this.value&&this.maxLength!=null&&this.maxLength>=0&&this.value.length>this.maxLength?r(this,ue).setValidity({tooLong:!0},this.t("tooLong",{max:this.maxLength}),e??void 0):this.value&&!a(this,oe,Xb).call(this,this.value)?r(this,ue).setValidity({patternMismatch:!0},this.patternMessage||this.t("pattern"),e??void 0):!this.multiline&&t?.rangeUnderflow?r(this,ue).setValidity({rangeUnderflow:!0},this.t(this.type==="number"?"numberUnderflow":"rangeUnderflow",{min:a(this,oe,Rh).call(this,this.min??"")}),e??void 0):!this.multiline&&t?.rangeOverflow?r(this,ue).setValidity({rangeOverflow:!0},this.t(this.type==="number"?"numberOverflow":"rangeOverflow",{max:a(this,oe,Rh).call(this,this.max??"")}),e??void 0):!this.multiline&&this.step&&t?.stepMismatch?r(this,ue).setValidity({stepMismatch:!0},this.t("stepMismatch",a(this,oe,Jb).call(this,e)),e??void 0):r(this,ue).setValidity({}),r(this,Nr).sync()},Rh=function(e){let t=this.locale;if(this.type==="number"&&e!==""&&Number.isFinite(Number(e)))return this.formatNumber(Number(e));if(this.type==="time"){let l=/^(\d{2}):(\d{2})/.exec(e);return l?me(new Date(2e3,0,1,+l[1],+l[2]),{hour:"numeric",minute:"2-digit"},t):e}let i=/^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2}))?/.exec(e);if(!i)return e;let s=new Date(+i[1],+i[2]-1,+i[3],+(i[4]??0),+(i[5]??0));return this.type==="datetime-local"?me(s,{day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit"},t):me(s,{day:"numeric",month:"short",year:"numeric"},t)},Jb=function(e){let t=this.type==="date"?864e5:this.type==="time"||this.type==="datetime-local"?1e3:1,i=Number(this.step)*t||(this.type==="date"?864e5:this.type==="number"?1:6e4),s=e.valueAsNumber,l=document.createElement("input");l.type=this.type,l.value=this.min??"";let d=Number.isFinite(l.valueAsNumber)?l.valueAsNumber:0,p=d+Math.floor((s-d)/i)*i,u=b=>{if(this.type==="number")return this.formatNumber(Number(b.toPrecision(12)));let x=new Date(b).toISOString();return a(this,oe,Rh).call(this,this.type==="time"?x.slice(11,16):this.type==="date"?x.slice(0,10):x.slice(0,16))};return{lower:u(p),upper:u(p+i)}},zu=function(e){this.value=e.target.value},Su=function(){a(this,oe,zl).call(this)},Lu=function(){this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},qi.formAssociated=!0,qi.shadowRootOptions={...A.shadowRootOptions,delegatesFocus:!0},qi.properties={label:{},hint:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},placeholder:{},type:{},multiline:{type:Boolean},rows:{type:Number},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},readonly:{type:Boolean,reflect:!0},autocomplete:{},inputMode:{attribute:"inputmode"},size:{reflect:!0},min:{},max:{},step:{},pattern:{},patternMessage:{attribute:"pattern-message"},minLength:{type:Number,attribute:"minlength"},maxLength:{type:Number,attribute:"maxlength"}},qi.styles=[E,bt,w`
|
|
298
302
|
:host { display: block; }
|
|
299
303
|
.input {
|
|
300
304
|
width: 100%; height: var(--_cm-field-h); padding: 0 var(--_cm-field-pad);
|
|
@@ -310,13 +314,13 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
310
314
|
.input:read-only, .input:disabled { background: var(--cm-bg-input-filled); }
|
|
311
315
|
.input:disabled { color: var(--cm-text-secondary); border-color: var(--cm-border-subtle); cursor: not-allowed; }
|
|
312
316
|
:host([error]:not([error=''])) .input, :host([data-cm-invalid]) .input { border-color: var(--cm-border-critical); }
|
|
313
|
-
`];$("cm-text-field",qi);var
|
|
317
|
+
`];$("cm-text-field",qi);var L1=z("checkbox",{required:"Please tick this box."}),vt,Pr,ai,Ll,Hh,Qb,Oi=class extends C{constructor(){super(...arguments);m(this,Hh);this.label="";this.description="";this.name="";this.value="on";this.checked=!1;this.indeterminate=!1;this.disabled=!1;this.required=!1;m(this,vt,this.attachInternals());m(this,Pr,new re(this,r(this,vt)));m(this,ai,N("cm-cb"));m(this,Ll,!1)}connectedCallback(){super.connectedCallback(),g(this,Ll,this.checked)}get form(){return r(this,vt).form}get validity(){return r(this,vt).validity}get validationMessage(){return r(this,vt).validationMessage}checkValidity(){return r(this,vt).checkValidity()}reportValidity(){return r(this,Pr).report(()=>r(this,vt).reportValidity())}formResetCallback(){this.checked=r(this,Ll),r(this,Pr).reset()}formDisabledCallback(e){this.disabled=e}updated(){r(this,vt).setFormValue(this.checked?this.value:null),this.required&&!this.checked?r(this,vt).setValidity({valueMissing:!0},this.t("required")):r(this,vt).setValidity({}),r(this,Pr).sync()}render(){let e=this.indeterminate?c`<svg width="12" height="12" viewBox="0 0 12 12" aria-hidden="true"><path d="M2 6h8" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>`:c`<svg width="12" height="12" viewBox="0 0 12 12" aria-hidden="true"><path d="M2 6.2 4.8 9 10 3" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>`,t=r(this,Pr).message,i=[this.description&&`${r(this,ai)}-d`,t&&`${r(this,ai)}-err`].filter(Boolean).join(" ");return c`<label for=${r(this,ai)}>
|
|
314
318
|
<input type="checkbox" id=${r(this,ai)} .checked=${this.checked} .indeterminate=${this.indeterminate}
|
|
315
319
|
?disabled=${this.disabled} ?required=${this.required} aria-invalid=${t?"true":h}
|
|
316
|
-
aria-describedby=${i||h} @change=${a(this,Hh,
|
|
320
|
+
aria-describedby=${i||h} @change=${a(this,Hh,Qb)} />
|
|
317
321
|
<span class="box" part="box">${e}</span>
|
|
318
322
|
${this.label||this.description?c`<span class="text"><span class="label">${this.label}<slot></slot></span>${this.description?c`<span class="desc" id="${r(this,ai)}-d">${this.description}</span>`:h}</span>`:c`<slot></slot>`}
|
|
319
|
-
</label>${t?c`<p class="error" id="${r(this,ai)}-err" role="alert">${t}</p>`:h}`}};vt=new WeakMap,Pr=new WeakMap,ai=new WeakMap,Ll=new WeakMap,Hh=new WeakSet,
|
|
323
|
+
</label>${t?c`<p class="error" id="${r(this,ai)}-err" role="alert">${t}</p>`:h}`}};vt=new WeakMap,Pr=new WeakMap,ai=new WeakMap,Ll=new WeakMap,Hh=new WeakSet,Qb=function(e){let t=e.target;this.checked=t.checked,this.indeterminate=!1,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},Oi.formAssociated=!0,Oi.shadowRootOptions={...A.shadowRootOptions,delegatesFocus:!0},Oi.properties={label:{},description:{},name:{reflect:!0},value:{},checked:{type:Boolean,reflect:!0},indeterminate:{type:Boolean},disabled:{type:Boolean,reflect:!0},required:{type:Boolean}},Oi.styles=[E,w`
|
|
320
324
|
:host { display: inline-flex; flex-direction: column; }
|
|
321
325
|
label { position: relative; display: inline-flex; align-items: flex-start; gap: var(--cm-space-8); padding-block: 2px; cursor: pointer; }
|
|
322
326
|
/* The 16px box (18px on touch screens, owner standard 1.6) sits centred on the label's first line (20px); the
|
|
@@ -369,7 +373,7 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
369
373
|
:host([disabled]) .dot, :host([group-disabled]) .dot { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); }
|
|
370
374
|
:host([disabled][checked]) .dot, :host([group-disabled][checked]) .dot { background: var(--cm-border-subtle); }
|
|
371
375
|
:host([disabled]) .label, :host([group-disabled]) .label { color: var(--cm-text-secondary); }
|
|
372
|
-
`];$("cm-radio",qr);var
|
|
376
|
+
`];$("cm-radio",qr);var I1=z("radioGroup",{required:"Please select one of these options."}),nt,Br,ni,Dl,Rl,Hl,ua,ge,Au,Ph,Ir,Du,ga,Ru,Ih,qh,Nh,Or=class extends C{constructor(){super();m(this,ge);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.orientation="vertical";this.required=!1;this.disabled=!1;m(this,nt,this.attachInternals());m(this,Br,new re(this,r(this,nt)));m(this,ni,N("cm-rg"));m(this,Dl,"");m(this,Rl,!0);m(this,Hl,!1);m(this,ua,!1);m(this,Ph,()=>{a(this,ge,Au).call(this),r(this,ga).call(this)});m(this,ga,()=>{let e=a(this,ge,Ir).call(this),t=!1;for(let s of e)s.checked=!!this.value&&s.value===this.value&&!t,s.checked&&(t=!0),s.groupDisabled=this.disabled;let i=e.find(s=>s.checked&&!s.disabled)??a(this,ge,Du).call(this)[0];for(let s of e)s._tabbable=s===i&&!this.disabled});m(this,Ih,e=>{let t=e.target.closest?.("cm-radio");!t||t.disabled||this.disabled||!this.contains(t)||a(this,ge,Ru).call(this,t,!0)});m(this,qh,e=>{let t=e.target.closest?.("cm-radio");if(!t||this.disabled)return;let i=a(this,ge,Du).call(this),s=i.indexOf(t),l=se(e,this),d;if(e.key==="ArrowDown"||l==="ArrowRight")d=i[(s+1)%i.length];else if(e.key==="ArrowUp"||l==="ArrowLeft")d=i[(s-1+i.length)%i.length];else if(e.key===" ")d=t.disabled?void 0:t;else return;e.preventDefault(),d&&a(this,ge,Ru).call(this,d,!0)});this.addEventListener("keydown",r(this,qh)),this.addEventListener("click",r(this,Ih))}connectedCallback(){super.connectedCallback(),a(this,ge,Au).call(this)}get form(){return r(this,nt).form}get validity(){return r(this,nt).validity}get validationMessage(){return r(this,nt).validationMessage}checkValidity(){return r(this,nt).checkValidity()}reportValidity(){return r(this,Br).report(()=>r(this,nt).reportValidity())}formResetCallback(){this.value=r(this,Dl),r(this,Br).reset()}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}focus(e){(a(this,ge,Ir).call(this).find(t=>t._tabbable)??a(this,ge,Ir).call(this)[0])?.focus(e)}updated(e){e.has("value")&&r(this,Hl)&&!r(this,ua)&&g(this,Rl,!1),g(this,Hl,!0),r(this,ga).call(this),r(this,nt).setFormValue(this.value||null,this.value);let t=a(this,ge,Ir).call(this)[0];this.error?r(this,nt).setValidity({customError:!0},this.error,t):this.required&&!this.value?r(this,nt).setValidity({valueMissing:!0},this.t("required"),t):r(this,nt).setValidity({}),r(this,Br).sync()}render(){let e=r(this,Br).message,t=[e&&`${r(this,ni)}-err`,this.helpText&&`${r(this,ni)}-help`].filter(Boolean).join(" ");return c`<div class="group" role="radiogroup" part="group"
|
|
373
377
|
aria-labelledby=${a(this,ge,Nh).call(this)?`${r(this,ni)}-l`:h} aria-label=${a(this,ge,Nh).call(this)?h:this.getAttribute("aria-label")??h}
|
|
374
378
|
aria-describedby=${t||h}
|
|
375
379
|
aria-required=${this.required?"true":h} aria-invalid=${e?"true":h}
|
|
@@ -387,13 +391,13 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
387
391
|
.error { color: var(--cm-text-critical); }
|
|
388
392
|
.options { display: flex; flex-direction: column; align-items: flex-start; gap: var(--cm-space-12); padding-top: var(--cm-space-4); }
|
|
389
393
|
:host([orientation='horizontal']) .options { flex-direction: row; flex-wrap: wrap; column-gap: var(--cm-space-24); }
|
|
390
|
-
`];$("cm-radio-group",Or);var fa,Fr,Nl,Oh,
|
|
394
|
+
`];$("cm-radio-group",Or);var fa,Fr,Nl,Oh,Zb,Bi=class extends A{constructor(){super(...arguments);m(this,Oh);this.label="";this.description="";this.name="";this.value="on";this.checked=!1;this.disabled=!1;m(this,fa,this.attachInternals());m(this,Fr,N("cm-tg"));m(this,Nl,!1)}connectedCallback(){super.connectedCallback(),g(this,Nl,this.checked)}get form(){return r(this,fa).form}checkValidity(){return r(this,fa).checkValidity()}formResetCallback(){this.checked=r(this,Nl)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.checked=e!=null}updated(){r(this,fa).setFormValue(this.checked?this.value:null)}render(){let e=this.label||this.description||this.textContent?.trim();return c`<label for=${r(this,Fr)}>
|
|
391
395
|
<input type="checkbox" role="switch" id=${r(this,Fr)} .checked=${this.checked} ?disabled=${this.disabled}
|
|
392
396
|
aria-label=${e?h:this.getAttribute("aria-label")??h}
|
|
393
|
-
aria-describedby=${this.description?`${r(this,Fr)}-d`:h} @change=${a(this,Oh,
|
|
397
|
+
aria-describedby=${this.description?`${r(this,Fr)}-d`:h} @change=${a(this,Oh,Zb)} />
|
|
394
398
|
<span class="track" part="track"><span class="thumb" part="thumb"></span></span>
|
|
395
399
|
${e?c`<span class="text"><span class="label">${this.label}<slot></slot></span>${this.description?c`<span class="desc" id="${r(this,Fr)}-d">${this.description}</span>`:h}</span>`:h}
|
|
396
|
-
</label>`}};fa=new WeakMap,Fr=new WeakMap,Nl=new WeakMap,Oh=new WeakSet,
|
|
400
|
+
</label>`}};fa=new WeakMap,Fr=new WeakMap,Nl=new WeakMap,Oh=new WeakSet,Zb=function(e){this.checked=e.target.checked,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},Bi.formAssociated=!0,Bi.shadowRootOptions={...A.shadowRootOptions,delegatesFocus:!0},Bi.properties={label:{},description:{},name:{reflect:!0},value:{},checked:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0}},Bi.styles=[E,w`
|
|
397
401
|
:host { display: inline-flex; }
|
|
398
402
|
label { position: relative; display: inline-flex; align-items: flex-start; gap: var(--cm-space-8); padding-block: 2px; cursor: pointer; }
|
|
399
403
|
/* A 36 x 20 track with a 16px thumb; the invisible input is a 24px-tall target. */
|
|
@@ -463,7 +467,7 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
463
467
|
}
|
|
464
468
|
`;function jh(o,n,e,t){return c`<div role="presentation" class="gh" id=${o}><span>${n}</span>${e!==void 0?c`<span class="count" aria-hidden="true">${e}</span><span class="vh">, ${t}</span>`:h}</div>`}function Uh(o,n=h){return c`${o.icon?c`<cm-icon name=${o.icon} size="16"></cm-icon>`:h}<span class="text"><span class="title">${o.title}</span>${o.description?c`<span class="vh">, </span><span class="desc">${o.description}</span>`:h}</span>${n}`}function Kh(o,n){let e=`${o.cls??""}${o.active?" active":""}`;return o.href?c`<a role="option" id=${o.id} class=${e} href=${o.href} tabindex="-1" aria-selected=${o.active?"true":"false"}
|
|
465
469
|
aria-keyshortcuts=${o.keyshortcuts||h} @pointerenter=${o.onHover} @click=${o.onChoose}>${n}</a>`:c`<div role="option" id=${o.id} class=${e} tabindex="-1" aria-selected=${o.active?"true":"false"}
|
|
466
|
-
aria-keyshortcuts=${o.keyshortcuts||h} @pointerenter=${o.onHover} @click=${o.onChoose}>${n}</div>`}function Wh(o,n,e){return e?o<0?n>0?0:e-1:(o+n+e)%e:-1}var
|
|
470
|
+
aria-keyshortcuts=${o.keyshortcuts||h} @pointerenter=${o.onHover} @click=${o.onChoose}>${n}</div>`}function Wh(o,n,e){return e?o<0?n>0?0:e-1:(o+n+e)%e:-1}var ek=z("select",{required:"Please select an item in the list.",grouped:"{group}: {label}"}),ot,jr,Te,xa,Dt,wa,Il,W,Hu,Ur,Nu,Pl,ya,Vr,Vi,Gh,Yh,ql,Xh,ev,Jh,ji=class extends C{constructor(){super(...arguments);m(this,W);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.placeholder="";this.options=[];this.required=!1;this.disabled=!1;this.open=!1;this.showGroup=!1;this.size="default";this.loading=!1;this._active=-1;this._slotted=[];m(this,ot,this.attachInternals());m(this,jr,new re(this,r(this,ot)));m(this,Te,N("cm-sel"));m(this,xa,"");m(this,Dt,"");m(this,wa,0);m(this,Il,new MutationObserver(()=>a(this,W,Hu).call(this)));m(this,Ur,new xe);m(this,Yh,e=>{if(this.disabled)return;let t=e.key;if(!this.open){if(["ArrowDown","ArrowUp","Enter"," "].includes(t)){e.preventDefault(),a(this,W,Pl).call(this);return}if(t==="Home"||t==="End"){e.preventDefault(),a(this,W,Pl).call(this),a(this,W,Vi).call(this,t==="Home"?"first":"last");return}if(t.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let i=a(this,W,Gh).call(this,t);a(this,W,Pl).call(this,i>=0?i:void 0)}return}switch(t){case"ArrowDown":e.preventDefault(),e.altKey?a(this,W,Vr).call(this,this._active):a(this,W,Vi).call(this,1);break;case"ArrowUp":e.preventDefault(),e.altKey?a(this,W,Vr).call(this,this._active):a(this,W,Vi).call(this,-1);break;case"Home":e.preventDefault(),a(this,W,Vi).call(this,"first");break;case"End":e.preventDefault(),a(this,W,Vi).call(this,"last");break;case"PageDown":e.preventDefault(),a(this,W,Vi).call(this,10);break;case"PageUp":e.preventDefault(),a(this,W,Vi).call(this,-10);break;case"Enter":e.preventDefault(),a(this,W,Vr).call(this,this._active);break;case"Escape":e.preventDefault(),e.stopPropagation(),a(this,W,ya).call(this);break;case"Tab":a(this,W,Vr).call(this,this._active);break;case" ":if(e.preventDefault(),r(this,Dt)&&Date.now()-r(this,wa)<500){let i=a(this,W,Gh).call(this," ");i>=0&&(this._active=i)}else a(this,W,Vr).call(this,this._active);break;default:if(t.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){let i=a(this,W,Gh).call(this,t);i>=0&&(this._active=i)}}});m(this,ql,e=>{this.open&&!e.composedPath().includes(this)&&a(this,W,ya).call(this)});m(this,Xh,()=>{this.disabled||(this.open?a(this,W,ya).call(this):a(this,W,Pl).call(this))});m(this,Jh,()=>this.renderRoot.querySelector(".box")?.focus())}connectedCallback(){super.connectedCallback(),a(this,W,Hu).call(this),r(this,Il).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected"]}),document.addEventListener("pointerdown",r(this,ql),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,Ur).close(),r(this,Il).disconnect(),document.removeEventListener("pointerdown",r(this,ql),!0)}get form(){return r(this,ot).form}get validity(){return r(this,ot).validity}get validationMessage(){return r(this,ot).validationMessage}checkValidity(){return r(this,ot).checkValidity()}reportValidity(){return r(this,jr).report(()=>r(this,ot).reportValidity())}formResetCallback(){this.value=r(this,xa),this.open=!1,r(this,jr).reset()}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){this.value=e}get items(){return this.options.length?va(this.options.map(e=>typeof e=="string"?{value:e,label:e}:e)):va(this._slotted)}firstUpdated(){r(this,xa)||g(this,xa,this.value)}updated(e){r(this,ot).setFormValue(this.value||null,this.value);let t=this.renderRoot.querySelector(".box")??void 0;this.error?r(this,ot).setValidity({customError:!0},this.error,t):this.required&&!this.value?r(this,ot).setValidity({valueMissing:!0},this.t("required"),t):r(this,ot).setValidity({}),r(this,jr).sync(),e.has("open")?this.open?r(this,Ur).open(this.renderRoot.querySelector("[role=listbox]"),this.renderRoot.querySelector(".box"),{align:"stretch"}):r(this,Ur).close():this.open&&e.has("items")&&r(this,Ur).place(),(e.has("_active")||e.has("open"))&&this.open&&this.renderRoot.querySelector(`#${r(this,Te)}-o${this._active}`)?.scrollIntoView({block:"nearest"})}render(){let e=this.items,t=e.find(p=>p.value===this.value),i=r(this,jr).message,s=[i&&`${r(this,Te)}-err`,this.helpText&&`${r(this,Te)}-help`].filter(Boolean).join(" "),l=this.getAttribute("aria-label"),d=(p,u)=>c`<li role="option" id="${r(this,Te)}-o${u}" class=${u===this._active?"active":""}
|
|
467
471
|
aria-selected=${p.value===this.value?"true":"false"} aria-disabled=${p.disabled?"true":h}
|
|
468
472
|
@pointerenter=${()=>!p.disabled&&(this._active=u)} @click=${()=>a(this,W,Vr).call(this,u)}>${p.label}</li>`;return c`<div class="field">
|
|
469
473
|
${this.label?c`<span class="label" id="${r(this,Te)}-l" part="label" @click=${r(this,Jh)}>${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>`:h}
|
|
@@ -476,7 +480,7 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
476
480
|
aria-required=${this.required?"true":h} aria-invalid=${i?"true":h}
|
|
477
481
|
aria-disabled=${this.disabled?"true":h} aria-describedby=${s||h} aria-busy=${this.loading?"true":h}
|
|
478
482
|
@click=${r(this,Xh)} @keydown=${r(this,Yh)} @blur=${()=>a(this,W,ya).call(this)}>
|
|
479
|
-
<span class="text ${t?"":"placeholder"}" id="${r(this,Te)}-v">${t?a(this,W,
|
|
483
|
+
<span class="text ${t?"":"placeholder"}" id="${r(this,Te)}-v">${t?a(this,W,ev).call(this,t):this.placeholder}</span>
|
|
480
484
|
${this.loading?c`<span class="spin"><cm-spinner size="small" aria-hidden="true"></cm-spinner></span>`:c`<cm-icon class="chev" name="chevron-down" size="16"></cm-icon>`}
|
|
481
485
|
</div>
|
|
482
486
|
<ul role="listbox" id="${r(this,Te)}-list" part="listbox" tabindex="-1" aria-labelledby=${this.label?`${r(this,Te)}-l`:h}
|
|
@@ -489,7 +493,7 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
489
493
|
${i?c`<p class="error" id="${r(this,Te)}-err" role="alert">${i}</p>`:h}
|
|
490
494
|
${this.helpText?c`<p class="help" id="${r(this,Te)}-help">${this.helpText}</p>`:h}
|
|
491
495
|
<slot></slot>
|
|
492
|
-
</div>`}};ot=new WeakMap,jr=new WeakMap,Te=new WeakMap,xa=new WeakMap,Dt=new WeakMap,wa=new WeakMap,Il=new WeakMap,W=new WeakSet,Hu=function(){let e=[...this.querySelectorAll("option")];this._slotted=e.map(t=>{let i=t.parentElement?.localName==="optgroup"?t.parentElement:null,s={value:t.value,label:t.label||t.textContent.trim(),disabled:t.disabled||!!i?.disabled};return i?.label&&(s.group=i.label),s}),!this.hasUpdated&&!this.value&&(this.value=e.find(t=>t.hasAttribute("selected"))?.value??"",g(this,xa,this.value))},Ur=new WeakMap,Nu=function(){return this.items.flatMap((e,t)=>e.disabled?[]:[t])},Pl=function(e){if(this.disabled||this.loading)return;let t=this.items.findIndex(i=>i.value===this.value);this.open=!0,this._active=e??(t>=0?t:a(this,W,Nu).call(this)[0]??-1)},ya=function(){this.open=!1},Vr=function(e){let t=this.items[e];!t||t.disabled||(a(this,W,ya).call(this),t.value!==this.value&&(this.value=t.value,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))))},Vi=function(e){let t=a(this,W,Nu).call(this);if(!t.length)return;if(e==="first")return void(this._active=t[0]);if(e==="last")return void(this._active=t[t.length-1]);let i=t.indexOf(this._active);this._active=i<0?t[0]:t[Math.min(t.length-1,Math.max(0,i+e))]},Gh=function(e){let t=Date.now();g(this,Dt,t-r(this,wa)>500?e:r(this,Dt)+e),g(this,wa,t);let i=this.items,s=this._active<0?0:this._active,l=r(this,Dt).split("").every(u=>u===r(this,Dt)[0]),d=l?r(this,Dt)[0]:r(this,Dt),p=l||r(this,Dt).length===1?s+1:s;for(let u=0;u<i.length;u++){let b=(p+u)%i.length;if(!i[b].disabled&&i[b].label.toLowerCase().startsWith(d.toLowerCase()))return b}return-1},Yh=new WeakMap,ql=new WeakMap,Xh=new WeakMap,
|
|
496
|
+
</div>`}};ot=new WeakMap,jr=new WeakMap,Te=new WeakMap,xa=new WeakMap,Dt=new WeakMap,wa=new WeakMap,Il=new WeakMap,W=new WeakSet,Hu=function(){let e=[...this.querySelectorAll("option")];this._slotted=e.map(t=>{let i=t.parentElement?.localName==="optgroup"?t.parentElement:null,s={value:t.value,label:t.label||t.textContent.trim(),disabled:t.disabled||!!i?.disabled};return i?.label&&(s.group=i.label),s}),!this.hasUpdated&&!this.value&&(this.value=e.find(t=>t.hasAttribute("selected"))?.value??"",g(this,xa,this.value))},Ur=new WeakMap,Nu=function(){return this.items.flatMap((e,t)=>e.disabled?[]:[t])},Pl=function(e){if(this.disabled||this.loading)return;let t=this.items.findIndex(i=>i.value===this.value);this.open=!0,this._active=e??(t>=0?t:a(this,W,Nu).call(this)[0]??-1)},ya=function(){this.open=!1},Vr=function(e){let t=this.items[e];!t||t.disabled||(a(this,W,ya).call(this),t.value!==this.value&&(this.value=t.value,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))))},Vi=function(e){let t=a(this,W,Nu).call(this);if(!t.length)return;if(e==="first")return void(this._active=t[0]);if(e==="last")return void(this._active=t[t.length-1]);let i=t.indexOf(this._active);this._active=i<0?t[0]:t[Math.min(t.length-1,Math.max(0,i+e))]},Gh=function(e){let t=Date.now();g(this,Dt,t-r(this,wa)>500?e:r(this,Dt)+e),g(this,wa,t);let i=this.items,s=this._active<0?0:this._active,l=r(this,Dt).split("").every(u=>u===r(this,Dt)[0]),d=l?r(this,Dt)[0]:r(this,Dt),p=l||r(this,Dt).length===1?s+1:s;for(let u=0;u<i.length;u++){let b=(p+u)%i.length;if(!i[b].disabled&&i[b].label.toLowerCase().startsWith(d.toLowerCase()))return b}return-1},Yh=new WeakMap,ql=new WeakMap,Xh=new WeakMap,ev=function(e){return this.showGroup&&e.group?this.t("grouped",{group:e.group,label:e.label}):e.label},Jh=new WeakMap,ji.formAssociated=!0,ji.shadowRootOptions={...A.shadowRootOptions,delegatesFocus:!0},ji.properties={label:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},placeholder:{},options:{type:Array},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},showGroup:{type:Boolean,attribute:"show-group"},size:{reflect:!0},loading:{type:Boolean,reflect:!0},_active:{state:!0},_slotted:{state:!0}},ji.styles=[E,Ie,bt,ha,Fi,w`
|
|
493
497
|
:host { display: block; position: relative; }
|
|
494
498
|
.label { cursor: default; }
|
|
495
499
|
.wrap { position: relative; }
|
|
@@ -522,16 +526,16 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
522
526
|
[role='group'] { display: block; }
|
|
523
527
|
slot { display: none; }
|
|
524
528
|
@media (prefers-reduced-motion: reduce) { .chev { transition: none; } }
|
|
525
|
-
`];$("cm-select",ji);var
|
|
529
|
+
`];$("cm-select",ji);var lk=z("search",{label:"Search",placeholder:"Search",filter:"Filter",filterApplied:"{label} ({count} applied)",clear:"Clear search"}),ka,Qh,Ol,je,$a,tv,iv,Pu,Ui=class extends C{constructor(){super(...arguments);m(this,je);this.name="";this.value="";this.filter=!1;this.filterCount=0;this.size="default";this.disabled=!1;m(this,ka,this.attachInternals());m(this,Qh,N("cm-search"));m(this,Ol,"")}connectedCallback(){super.connectedCallback(),g(this,Ol,this.value)}get form(){return r(this,ka).form}checkValidity(){return r(this,ka).checkValidity()}formResetCallback(){this.value=r(this,Ol)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}updated(){r(this,ka).setFormValue(this.value)}render(){return c`<div class="box" part="box">
|
|
526
530
|
<cm-icon class="icon" name="search" size="16"></cm-icon>
|
|
527
531
|
<input id=${r(this,Qh)} part="input" type="search" enterkeyhint="search" autocomplete="off"
|
|
528
532
|
aria-label=${this.label} .value=${ee(this.value)} placeholder=${this.placeholder||h} ?disabled=${this.disabled}
|
|
529
|
-
@input=${a(this,
|
|
530
|
-
${this.value&&!this.disabled?c`<button type="button" class="clear" part="clear" aria-label=${this.t("clear")} @click=${a(this,
|
|
533
|
+
@input=${a(this,je,tv)} @change=${()=>a(this,je,$a).call(this,"change")} @keydown=${a(this,je,iv)} />
|
|
534
|
+
${this.value&&!this.disabled?c`<button type="button" class="clear" part="clear" aria-label=${this.t("clear")} @click=${a(this,je,Pu)}><cm-icon name="close" size="16"></cm-icon></button>`:h}
|
|
531
535
|
${this.filter?c`<button type="button" class="filter" part="filter" ?disabled=${this.disabled}
|
|
532
536
|
aria-label=${this.filterCount>0?this.t("filterApplied",{label:this.filterLabel,count:this.filterCount}):this.filterLabel}
|
|
533
|
-
@click=${()=>a(this,
|
|
534
|
-
</div>`}};ka=new WeakMap,Qh=new WeakMap,Ol=new WeakMap,
|
|
537
|
+
@click=${()=>a(this,je,$a).call(this,"cm-filter")}><cm-icon name="filter" size="16"></cm-icon>${this.filterCount>0?c`<span class="count" aria-hidden="true">${this.filterCount}</span>`:h}</button>`:h}
|
|
538
|
+
</div>`}};ka=new WeakMap,Qh=new WeakMap,Ol=new WeakMap,je=new WeakSet,$a=function(e,t){this.dispatchEvent(t===void 0?new Event(e,{bubbles:!0,composed:!0}):new CustomEvent(e,{bubbles:!0,composed:!0,detail:t}))},tv=function(e){this.value=e.target.value},iv=function(e){e.key==="Enter"?a(this,je,$a).call(this,"cm-search",{value:this.value}):e.key==="Escape"&&this.value&&(e.preventDefault(),a(this,je,Pu).call(this))},Pu=function(){this.value="",this.renderRoot.querySelector("input")?.focus(),a(this,je,$a).call(this,"input"),a(this,je,$a).call(this,"change")},Ui.formAssociated=!0,Ui.shadowRootOptions={...A.shadowRootOptions,delegatesFocus:!0},Ui.properties={label:{string:"label"},name:{reflect:!0},value:{},placeholder:{string:"placeholder"},filter:{type:Boolean},filterLabel:{attribute:"filter-label",string:"filter"},filterCount:{type:Number,attribute:"filter-count"},size:{reflect:!0},disabled:{type:Boolean,reflect:!0}},Ui.styles=[E,bt,w`
|
|
535
539
|
:host { display: block; }
|
|
536
540
|
:host([size='large']) { --_cm-field-h: var(--cm-control-height-lg, 40px); }
|
|
537
541
|
@media (pointer: coarse) { :host([size='large']) { --_cm-field-h: var(--cm-control-height-touch, 44px); } button { width: 32px; height: 32px; } }
|
|
@@ -565,7 +569,7 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
565
569
|
:host([disabled]) .box { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); }
|
|
566
570
|
:host([disabled]) input { color: var(--cm-text-secondary); cursor: not-allowed; }
|
|
567
571
|
:host([disabled]) button { cursor: not-allowed; }
|
|
568
|
-
`];$("cm-search",Ui);var
|
|
572
|
+
`];$("cm-search",Ui);var uk=z("tag",{remove:"Remove {label}"}),Zh,rv,Kr=class extends C{constructor(){super(...arguments);m(this,Zh);this.removable=!1;this.removeLabel="";this.disabled=!1}render(){let e=this.removeLabel||this.t("remove",{label:this.textContent?.trim()??""}).trim();return c`<span class="tag" part="tag"><span class="text"><slot @slotchange=${()=>this.requestUpdate()}></slot></span>${this.removable?c`<button type="button" part="remove" aria-label=${e} ?disabled=${this.disabled} @click=${a(this,Zh,rv)}><cm-icon name="x-circle" size="14"></cm-icon></button>`:h}</span>`}};Zh=new WeakSet,rv=function(){this.disabled||this.dispatchEvent(new CustomEvent("cm-remove",{bubbles:!0,composed:!0}))},Kr.shadowRootOptions={...A.shadowRootOptions,delegatesFocus:!0},Kr.properties={removable:{type:Boolean,reflect:!0},removeLabel:{attribute:"remove-label"},disabled:{type:Boolean,reflect:!0}},Kr.styles=[E,w`
|
|
569
573
|
:host { display: inline-flex; vertical-align: middle; max-width: 100%; }
|
|
570
574
|
.tag {
|
|
571
575
|
display: inline-flex; align-items: center; gap: var(--cm-space-4); min-width: 0; height: 24px; padding: 0 var(--cm-space-8);
|
|
@@ -583,17 +587,17 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
583
587
|
button:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 0; }
|
|
584
588
|
:host([disabled]) .tag { color: var(--cm-text-secondary); border-color: var(--cm-border-subtle); }
|
|
585
589
|
:host([disabled]) button { cursor: not-allowed; color: var(--cm-text-secondary); background: none; }
|
|
586
|
-
`];$("cm-tag",Kr);var
|
|
587
|
-
`):[]:this.value=e)}get items(){return this.options?.length?va(this.options.map(e=>typeof e=="string"?{value:e,label:e}:e)):va(this._slotted)}get filteredItems(){let e=this._typing?this._query.trim().toLowerCase():"";return!e||this.filter==="none"?this.items:this.items.filter(t=>{let i=t.label.toLowerCase();return this.filter==="starts-with"?i.startsWith(e):i.includes(e)})}firstUpdated(){g(this,jl,{value:this.value,values:[...this.values]})}willUpdate(e){for(let t of this.items)r(this,_a).set(t.value,t.label),t.group&&r(this,Ul).set(t.value,t.group);if((e.has("value")||e.has("options")||e.has("_slotted")||e.has("showGroup"))&&!this.multiple&&!this._typing&&(this._query=this.value?a(this,H,Bl).call(this,this.value):""),e.has("_query")||e.has("options")||e.has("_slotted")||e.has("loading")){let t=a(this,H,Fl).call(this);this._active>=t.length&&(this._active=-1)}}updated(e){let t=this.open;t&&!r(this,li).active?r(this,li).open(this.renderRoot.querySelector(".pop"),this.renderRoot.querySelector(".box"),{align:"stretch"}):!t&&r(this,li).active?r(this,li).close():t&&r(this,li).place();let i=this.renderRoot.querySelector("input")??void 0;if(this.multiple)if(this.name&&this.values.length){let l=new FormData;for(let d of this.values)l.append(this.name,d);r(this,
|
|
588
|
-
`))}else r(this,
|
|
590
|
+
`];$("cm-tag",Kr);var Mk=z("combobox",{noResults:"No results",results:{one:"{count} result",other:"{count} results"},add:"Add \u201C{value}\u201D",remove:"Remove {label}",required:"Please select an item in the list.",requiredMultiple:"Choose at least one item.",grouped:"{group}: {label}",more:"+{count} more"}),Ue,Yr,Ce,jl,_a,Ul,Kl,Wl,H,Iu,sv,Bl,ep,Fl,li,Ea,Ma,oi,av,Vl,qu,Ou,Wr,tp,ip,Gr,nv,rp,sp,ap,ov,lv,Ki=class extends C{constructor(){super(...arguments);m(this,H);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.values=[];this.placeholder="";this.options=[];this.multiple=!1;this.size="default";this.allowCustom=!1;this.filter="contains";this.loading=!1;this.required=!1;this.disabled=!1;this.open=!1;this.showGroup=!1;this.maxTags=3;this._query="";this._focusIn=!1;this._active=-1;this._slotted=[];this._typing=!1;m(this,Ue,this.attachInternals());m(this,Yr,new re(this,r(this,Ue)));m(this,Ce,N("cm-cb"));m(this,jl,null);m(this,_a,new Map);m(this,Ul,new Map);m(this,Kl,new MutationObserver(()=>a(this,H,Iu).call(this)));m(this,Wl);m(this,li,new xe);m(this,tp,()=>{this._focusIn=!0});m(this,ip,()=>{setTimeout(()=>{this._focusIn=this.matches(":focus-within")})});m(this,rp,e=>{e.stopPropagation(),this._query=e.target.value,this._typing=!0,this._active=-1,a(this,H,Ma).call(this),this.dispatchEvent(new CustomEvent("cm-search",{detail:{query:this._query},bubbles:!0,composed:!0}))});m(this,sp,e=>{if(this.disabled)return;switch(e.key){case"ArrowDown":e.preventDefault(),this.open?a(this,H,Vl).call(this,1):(a(this,H,Ma).call(this),e.altKey||a(this,H,Vl).call(this,"first"));break;case"ArrowUp":e.preventDefault(),this.open?a(this,H,Vl).call(this,-1):(a(this,H,Ma).call(this),a(this,H,Vl).call(this,"last"));break;case"Enter":this.open&&this._active>=0?(e.preventDefault(),a(this,H,qu).call(this,this._active)):r(this,H,ep)&&(e.preventDefault(),a(this,H,Ou).call(this,r(this,H,ep)));break;case"Escape":this.open?(e.preventDefault(),e.stopPropagation(),a(this,H,oi).call(this)):this._query&&(e.preventDefault(),this._query="",this._typing=!0,!this.multiple&&this.value&&(this.value="",a(this,H,Ea).call(this)));break;case"ArrowLeft":case"ArrowRight":{let i=e.target;this.multiple&&this.values.length&&se(e,this)==="ArrowLeft"&&i.selectionStart===0&&i.selectionEnd===0&&(e.preventDefault(),a(this,H,oi).call(this),a(this,H,Gr).call(this,this.values.length-1));break}case"Backspace":this.multiple&&!this._query&&this.values.length&&(e.preventDefault(),this.removeValue(this.values[this.values.length-1]));break;case"Tab":a(this,H,oi).call(this);break;default:}});m(this,ap,()=>{queueMicrotask(()=>{this.shadowRoot?.activeElement!==this.renderRoot.querySelector("input")&&(a(this,H,oi).call(this),this._typing&&(this._typing=!1,this._query=this.multiple?"":this.value?a(this,H,Bl).call(this,this.value):""))})})}connectedCallback(){super.connectedCallback(),a(this,H,Iu).call(this),r(this,Kl).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected"]}),g(this,Wl,Bh(this,()=>this.open,()=>a(this,H,oi).call(this))),this.addEventListener("focusin",r(this,tp)),this.addEventListener("focusout",r(this,ip))}disconnectedCallback(){var e;super.disconnectedCallback(),r(this,li).close(),r(this,Kl).disconnect(),(e=r(this,Wl))==null||e.call(this)}get form(){return r(this,Ue).form}get validity(){return r(this,Ue).validity}get validationMessage(){return r(this,Ue).validationMessage}checkValidity(){return r(this,Ue).checkValidity()}reportValidity(){return r(this,Yr).report(()=>r(this,Ue).reportValidity())}formResetCallback(){let e=r(this,jl)??{value:"",values:[]};this.value=e.value,this.values=[...e.values],this._query="",this._typing=!1,this.open=!1,r(this,Yr).reset()}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){typeof e=="string"&&(this.multiple?this.values=e?e.split(`
|
|
591
|
+
`):[]:this.value=e)}get items(){return this.options?.length?va(this.options.map(e=>typeof e=="string"?{value:e,label:e}:e)):va(this._slotted)}get filteredItems(){let e=this._typing?this._query.trim().toLowerCase():"";return!e||this.filter==="none"?this.items:this.items.filter(t=>{let i=t.label.toLowerCase();return this.filter==="starts-with"?i.startsWith(e):i.includes(e)})}firstUpdated(){g(this,jl,{value:this.value,values:[...this.values]})}willUpdate(e){for(let t of this.items)r(this,_a).set(t.value,t.label),t.group&&r(this,Ul).set(t.value,t.group);if((e.has("value")||e.has("options")||e.has("_slotted")||e.has("showGroup"))&&!this.multiple&&!this._typing&&(this._query=this.value?a(this,H,Bl).call(this,this.value):""),e.has("_query")||e.has("options")||e.has("_slotted")||e.has("loading")){let t=a(this,H,Fl).call(this);this._active>=t.length&&(this._active=-1)}}updated(e){let t=this.open;t&&!r(this,li).active?r(this,li).open(this.renderRoot.querySelector(".pop"),this.renderRoot.querySelector(".box"),{align:"stretch"}):!t&&r(this,li).active?r(this,li).close():t&&r(this,li).place();let i=this.renderRoot.querySelector("input")??void 0;if(this.multiple)if(this.name&&this.values.length){let l=new FormData;for(let d of this.values)l.append(this.name,d);r(this,Ue).setFormValue(l,this.values.join(`
|
|
592
|
+
`))}else r(this,Ue).setFormValue(null);else r(this,Ue).setFormValue(this.value||null,this.value);let s=this.multiple?!this.values.length:!this.value;this.error?r(this,Ue).setValidity({customError:!0},this.error,i):this.required&&s?r(this,Ue).setValidity({valueMissing:!0},this.t(this.multiple?"requiredMultiple":"required"),i):r(this,Ue).setValidity({}),r(this,Yr).sync(),(e.has("_active")||e.has("open"))&&this.open&&this._active>=0&&this.renderRoot.querySelector(`#${r(this,Ce)}-o${this._active}`)?.scrollIntoView({block:"nearest"})}removeValue(e){this.values.includes(e)&&(this.values=this.values.filter(t=>t!==e),a(this,H,Ea).call(this))}focus(e){this.renderRoot.querySelector("input")?.focus(e)}render(){let e=a(this,H,Fl).call(this),t=r(this,Yr).message,i=[t&&`${r(this,Ce)}-err`,this.helpText&&`${r(this,Ce)}-help`].filter(Boolean).join(" "),s=this.getAttribute("aria-label"),l=u=>this.multiple?this.values.includes(u):u===this.value,d=(u,b)=>c`<li role="option" id="${r(this,Ce)}-o${b}" class=${b===this._active?"active":""}
|
|
589
593
|
aria-selected=${u.create?"false":l(u.value)?"true":"false"} aria-disabled=${u.disabled?"true":h}
|
|
590
594
|
@pointerenter=${()=>!u.disabled&&(this._active=b)} @click=${()=>a(this,H,qu).call(this,b)}>
|
|
591
|
-
${u.create?c`<cm-icon name="plus" size="16"></cm-icon><span class="create">${this.t("add",{value:u.label})}</span>`:c`${this.multiple?c`<cm-icon class="check" name="check" size="16"></cm-icon>`:h}<span>${a(this,H,
|
|
595
|
+
${u.create?c`<cm-icon name="plus" size="16"></cm-icon><span class="create">${this.t("add",{value:u.label})}</span>`:c`${this.multiple?c`<cm-icon class="check" name="check" size="16"></cm-icon>`:h}<span>${a(this,H,ov).call(this,u.label)}</span>`}</li>`,p=this.loading?this.loadingText||this.t("loading"):this.open?e.length?this.t("results",{count:e.length}):this.emptyText||this.t("noResults"):"";return c`<div class="field">
|
|
592
596
|
${this.label?c`<label class="label" id="${r(this,Ce)}-l" for="${r(this,Ce)}-in" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</label>`:h}
|
|
593
597
|
<div class="wrap">
|
|
594
598
|
<div class="box" part="box" @click=${u=>{u.target.closest("cm-tag[removable]")||a(this,H,Wr).call(this)}}>
|
|
595
599
|
<div class="chips ${this.multiple&&this.values.length?`has-tags${this._focusIn||this.open?"":" idle"}`:""}">
|
|
596
|
-
${this.multiple?a(this,H,
|
|
600
|
+
${this.multiple?a(this,H,lv).call(this):h}
|
|
597
601
|
<input id="${r(this,Ce)}-in" part="input" type="text" role="combobox" autocomplete="off" spellcheck="false"
|
|
598
602
|
.value=${ee(this._query)} placeholder=${this.multiple&&this.values.length?h:this.placeholder||h}
|
|
599
603
|
aria-label=${!this.label&&s?s:h}
|
|
@@ -620,10 +624,10 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
620
624
|
${t?c`<p class="error" id="${r(this,Ce)}-err" role="alert">${t}</p>`:h}
|
|
621
625
|
${this.helpText?c`<p class="help" id="${r(this,Ce)}-help">${this.helpText}</p>`:h}
|
|
622
626
|
<slot></slot>
|
|
623
|
-
</div>`}};
|
|
627
|
+
</div>`}};Ue=new WeakMap,Yr=new WeakMap,Ce=new WeakMap,jl=new WeakMap,_a=new WeakMap,Ul=new WeakMap,Kl=new WeakMap,Wl=new WeakMap,H=new WeakSet,Iu=function(){let e=[...this.querySelectorAll("option")];if(this._slotted=e.map(t=>{let i=t.parentElement?.localName==="optgroup"?t.parentElement:null,s={value:t.value,label:t.label||t.textContent.trim(),disabled:t.disabled||!!i?.disabled};return i?.label&&(s.group=i.label),s}),!this.hasUpdated){let t=e.filter(i=>i.hasAttribute("selected")).map(i=>i.value);this.multiple&&!this.values.length&&t.length&&(this.values=t),!this.multiple&&!this.value&&t.length&&(this.value=t[0])}},sv=function(e){return this.items.find(t=>t.value===e)?.label??r(this,_a).get(e)??e},Bl=function(e){let t=a(this,H,sv).call(this,e);if(!this.showGroup)return t;let i=this.items.find(s=>s.value===e)?.group??r(this,Ul).get(e);return i?this.t("grouped",{group:i,label:t}):t},ep=function(){if(!this.allowCustom||!this._typing)return"";let e=this._query.trim();if(!e)return"";let t=e.toLowerCase();return this.items.some(i=>i.label.toLowerCase()===t||i.value.toLowerCase()===t)||(this.multiple?this.values.some(i=>i.toLowerCase()===t):this.value.toLowerCase()===t)?"":e},Fl=function(){let e=this.loading?[]:[...this.filteredItems],t=r(this,H,ep);return t&&!this.loading&&e.push({value:t,label:t,create:!0}),e},li=new WeakMap,Ea=function(){this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},Ma=function(){this.disabled||(this.open=!0)},oi=function(){this.open=!1,this._active=-1},av=function(e=a(this,H,Fl).call(this)){return e.flatMap((t,i)=>t.disabled?[]:[i])},Vl=function(e){let t=a(this,H,av).call(this);if(!t.length){this._active=-1;return}if(e==="first")return void(this._active=t[0]);if(e==="last")return void(this._active=t[t.length-1]);let i=t.indexOf(this._active);if(i<0){this._active=e>0?t[0]:t[t.length-1];return}this._active=t[(i+e+t.length)%t.length]},qu=function(e){let t=a(this,H,Fl).call(this)[e];if(!(!t||t.disabled)){if(t.create){a(this,H,Ou).call(this,t.value);return}if(this.multiple){this.values=this.values.includes(t.value)?this.values.filter(i=>i!==t.value):[...this.values,t.value],this._query="",this._typing=!1,this._active=-1,a(this,H,Ea).call(this),a(this,H,Wr).call(this);return}a(this,H,oi).call(this),this._typing=!1,this._query=this.showGroup&&t.group?this.t("grouped",{group:t.group,label:t.label}):t.label,t.value!==this.value&&(this.value=t.value,a(this,H,Ea).call(this))}},Ou=function(e){this.dispatchEvent(new CustomEvent("cm-create",{detail:{value:e},bubbles:!0,composed:!0,cancelable:!0}))&&(r(this,_a).set(e,e),this.multiple?(this.values=[...this.values,e],this._query="",this._typing=!1,this._active=-1):(a(this,H,oi).call(this),this.value=e,this._typing=!1,this._query=e),a(this,H,Ea).call(this))},Wr=function(){this.renderRoot.querySelector("input")?.focus()},tp=new WeakMap,ip=new WeakMap,Gr=async function(e){await this.updateComplete;let t=this.renderRoot.querySelectorAll("cm-tag[data-i]");e>=0&&e<t.length?t[e].focus():a(this,H,Wr).call(this)},nv=function(e,t){let i=se(e,this),s=this.values.length-1;if(i==="ArrowLeft")e.preventDefault(),a(this,H,Gr).call(this,Math.max(0,t-1));else if(i==="ArrowRight")e.preventDefault(),a(this,H,Gr).call(this,t<s?t+1:-1);else if(i==="Home")e.preventDefault(),a(this,H,Gr).call(this,0);else if(i==="End")e.preventDefault(),a(this,H,Gr).call(this,s);else if(i==="Escape")e.preventDefault(),e.stopPropagation(),a(this,H,Wr).call(this);else if((i==="Backspace"||i==="Delete")&&!this.disabled){e.preventDefault(),this.removeValue(this.values[t]);let l=this.values.length;a(this,H,Gr).call(this,i==="Backspace"?t>0?t-1:l?0:-1:t<l?t:-1)}},rp=new WeakMap,sp=new WeakMap,ap=new WeakMap,ov=function(e){let t=this._typing?this._query.trim():"";if(!t||this.filter==="none")return e;let i=e.toLowerCase().indexOf(t.toLowerCase());return i<0||this.filter==="starts-with"&&i!==0?e:c`${e.slice(0,i)}<mark>${e.slice(i,i+t.length)}</mark>${e.slice(i+t.length)}`},lv=function(){let e=this.maxTags>0&&!this._focusIn&&!this.open&&this.values.length>this.maxTags?this.maxTags:this.values.length,t=this.values.length-e;return c`${this.values.slice(0,e).map((i,s)=>c`<cm-tag removable tabindex="-1" data-i=${s} part="tag" ?disabled=${this.disabled}
|
|
624
628
|
remove-label=${this.t("remove",{label:a(this,H,Bl).call(this,i)})}
|
|
625
|
-
@keydown=${l=>a(this,H,
|
|
626
|
-
@cm-remove=${()=>{this.removeValue(i),a(this,H,Wr).call(this)}}>${a(this,H,Bl).call(this,i)}</cm-tag>`)}${t?c`<cm-tag class="more" part="more">${this.t("more",{count:t})}</cm-tag>`:h}`},Ki.formAssociated=!0,Ki.shadowRootOptions={...A.shadowRootOptions,delegatesFocus:!0},Ki.properties={label:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},values:{type:Array},placeholder:{},options:{type:Array},multiple:{type:Boolean,reflect:!0},size:{reflect:!0},allowCustom:{type:Boolean,attribute:"allow-custom"},filter:{},loading:{type:Boolean,reflect:!0},emptyText:{attribute:"empty-text",string:"noResults"},loadingText:{attribute:"loading-text",string:"loading"},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},showGroup:{type:Boolean,attribute:"show-group"},maxTags:{type:Number,attribute:"max-tags"},_query:{state:!0},_focusIn:{state:!0},_active:{state:!0},_slotted:{state:!0},_typing:{state:!0}},Ki.styles=[E,bt,
|
|
629
|
+
@keydown=${l=>a(this,H,nv).call(this,l,s)}
|
|
630
|
+
@cm-remove=${()=>{this.removeValue(i),a(this,H,Wr).call(this)}}>${a(this,H,Bl).call(this,i)}</cm-tag>`)}${t?c`<cm-tag class="more" part="more">${this.t("more",{count:t})}</cm-tag>`:h}`},Ki.formAssociated=!0,Ki.shadowRootOptions={...A.shadowRootOptions,delegatesFocus:!0},Ki.properties={label:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},values:{type:Array},placeholder:{},options:{type:Array},multiple:{type:Boolean,reflect:!0},size:{reflect:!0},allowCustom:{type:Boolean,attribute:"allow-custom"},filter:{},loading:{type:Boolean,reflect:!0},emptyText:{attribute:"empty-text",string:"noResults"},loadingText:{attribute:"loading-text",string:"loading"},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},showGroup:{type:Boolean,attribute:"show-group"},maxTags:{type:Number,attribute:"max-tags"},_query:{state:!0},_focusIn:{state:!0},_active:{state:!0},_slotted:{state:!0},_typing:{state:!0}},Ki.styles=[E,bt,Ie,ba,ha,Fi,w`
|
|
627
631
|
:host { display: block; position: relative; }
|
|
628
632
|
.wrap { position: relative; }
|
|
629
633
|
.box {
|
|
@@ -664,7 +668,7 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
664
668
|
.create { font-style: normal; }
|
|
665
669
|
slot { display: none; }
|
|
666
670
|
@media (prefers-reduced-motion: reduce) { .chev { transition: none; } }
|
|
667
|
-
`];$("cm-combobox",Ki);function Gl(){let o=typeof navigator>"u"?void 0:navigator;return/mac|iphone|ipad|ipod/i.test(o?.userAgentData?.platform||o?.platform||"")}var
|
|
671
|
+
`];$("cm-combobox",Ki);function Gl(){let o=typeof navigator>"u"?void 0:navigator;return/mac|iphone|ipad|ipod/i.test(o?.userAgentData?.platform||o?.platform||"")}var c0={esc:"escape",return:"enter",space:" ",up:"arrowup",down:"arrowdown",left:"arrowleft",right:"arrowright",plus:"+"};function np(o,n){let e=o.trim().toLowerCase().split("+").map(s=>s.trim());e.length>1&&e[e.length-1]===""&&e[e.length-2]===""&&e.splice(-2,2,"+");let t=e.pop();if(!t)return null;let i={key:c0[t]??t,ctrl:!1,meta:!1,alt:!1,shift:!1};for(let s of e)if(s==="mod")n?i.meta=!0:i.ctrl=!0;else if(s==="ctrl"||s==="control")i.ctrl=!0;else if(s==="meta"||s==="cmd"||s==="command")i.meta=!0;else if(s==="alt"||s==="option"||s==="opt")i.alt=!0;else if(s==="shift")i.shift=!0;else return null;return i}function Bu(o,n=Gl()){let e=np(o,n);return!!e&&(e.ctrl||e.meta||e.alt)}function Fu(o,n,e=Gl()){let t=np(n,e);if(!t||!o.key||o.ctrlKey!==t.ctrl||o.metaKey!==t.meta||o.altKey!==t.alt)return!1;let i=/^[a-z0-9]$/.test(t.key);return(i||t.key.length>1)&&o.shiftKey!==t.shift?!1:o.key.toLowerCase()===t.key?!0:i?o.code===(/\d/.test(t.key)?`Digit${t.key}`:`Key${t.key.toUpperCase()}`):!1}function op(o){let n=o.composedPath()[0];return!!n&&(n.isContentEditable||/^(input|textarea|select)$/i.test(n.localName??""))}var d0={meta:"\u2318",ctrl:"\u2303",alt:"\u2325",shift:"\u21E7"},h0={meta:"Win",ctrl:"Ctrl",alt:"Alt",shift:"Shift"},p0={escape:"Esc",enter:"\u21B5"," ":"Space",arrowup:"\u2191",arrowdown:"\u2193",arrowleft:"\u2190",arrowright:"\u2192",backspace:"\u232B",delete:"Del",tab:"Tab",pageup:"PgUp",pagedown:"PgDn",home:"Home",end:"End"},m0=o=>p0[o]??(o.length===1?o.toUpperCase():o[0].toUpperCase()+o.slice(1));function lp(o,n=Gl()){let e=[];for(let t of o.trim().split(/\s+/).filter(Boolean)){let i=np(t,n);if(!i)return[o.trim()];let s=n?d0:h0,l=n?["ctrl","alt","shift","meta"]:["ctrl","meta","alt","shift"];for(let d of l)i[d]&&e.push(s[d]);e.push(m0(i.key))}return e}function cv(o,n=Gl()){if(/\s/.test(o.trim()))return"";let e=np(o,n);if(!e)return"";let t=e.key===" "?"Space":e.key.length===1?e.key.toUpperCase():e.key.replace(/^(arrow|page)?(\w)/,(i,s,l)=>s?`${s[0].toUpperCase()}${s.slice(1)}${l.toUpperCase()}`:l.toUpperCase());return[e.ctrl&&"Control",e.meta&&"Meta",e.alt&&"Alt",e.shift&&"Shift",t].filter(Boolean).join("+")}var Nk=z("globalSearch",{label:"Search",placeholder:"Search",noResults:"No results",results:{one:"{count} result",other:"{count} results"},seeAll:"See all",clear:"Clear search"}),yt,Xl,ie,cp,Yl,ci,Ta,Vu,dp,dv,hp,Jl,ju,hv,Xr=class extends C{constructor(){super(...arguments);m(this,ie);this.value="";this.results=[];this.loading=!1;this.open=!1;this.shortcut="";this._active=-1;m(this,yt,N("cm-gs"));m(this,Xl);m(this,ci,new xe);m(this,dp,e=>{this.value=e.target.value,this._active=-1,this.open=!!this.value.trim(),a(this,ie,Vu).call(this)});m(this,hp,e=>{switch(e.key){case"ArrowDown":case"ArrowUp":if(e.preventDefault(),!this.value.trim())break;this.open||(this.open=!0),a(this,ie,dv).call(this,e.key==="ArrowDown"?1:-1);break;case"Enter":r(this,ie,Yl)&&this._active>=0&&(e.preventDefault(),this.renderRoot.querySelector(`#${r(this,yt)}-o${this._active}`)?.click());break;case"Escape":r(this,ie,Yl)?(e.preventDefault(),e.stopPropagation(),a(this,ie,Ta).call(this)):this.value&&(e.preventDefault(),a(this,ie,ju).call(this,!1));break;case"Tab":a(this,ie,Ta).call(this);break;default:}});m(this,Jl,e=>{!this.shortcut||e.key!==this.shortcut||e.ctrlKey||e.metaKey||e.altKey||e.defaultPrevented||op(e)||this.getClientRects().length&&(e.preventDefault(),this.focus())})}connectedCallback(){super.connectedCallback(),g(this,Xl,Bh(this,()=>this.open,()=>a(this,ie,Ta).call(this))),document.addEventListener("keydown",r(this,Jl))}disconnectedCallback(){var e;super.disconnectedCallback(),r(this,ci).close(),(e=r(this,Xl))==null||e.call(this),document.removeEventListener("keydown",r(this,Jl))}willUpdate(e){(e.has("results")||e.has("loading")||e.has("value"))&&this._active>=a(this,ie,cp).call(this).length&&(this._active=-1)}updated(e){let t=r(this,ie,Yl);t&&!r(this,ci).active?r(this,ci).open(this.renderRoot.querySelector(".pop"),this.renderRoot.querySelector(".box"),{align:"stretch"}):!t&&r(this,ci).active?r(this,ci).close():t&&r(this,ci).place(),(e.has("_active")||e.has("open"))&&this.open&&this._active>=0&&this.renderRoot.querySelector(`#${r(this,yt)}-o${this._active}`)?.scrollIntoView({block:"nearest"})}render(){let e=a(this,ie,cp).call(this),t=r(this,ie,Yl),i=e.filter(u=>u.item).length,s=this.loading&&t?this.loadingText:t?e.length?this.t("results",{count:i}):this.emptyText:"",l=-1,d=(this.results??[]).filter(u=>u?.items?.length),p=(u,b,f="")=>{let x=++l;return Kh({id:`${r(this,yt)}-o${x}`,active:x===this._active,href:u.href,cls:f,onHover:()=>this._active=x,onChoose:v=>a(this,ie,hv).call(this,v,u)},b)};return c`<div class="wrap">
|
|
668
672
|
<div class="box" part="box" @click=${u=>{u.target===u.currentTarget&&this.focus()}}>
|
|
669
673
|
<cm-icon class="icon" name="search" size="16"></cm-icon>
|
|
670
674
|
|
|
@@ -688,7 +692,7 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
688
692
|
${this.loading?c`<p class="message"><cm-spinner size="small" aria-hidden="true"></cm-spinner><span aria-hidden="true">${this.loadingText}</span></p>`:e.length?h:c`<p class="message" aria-hidden="true">${this.emptyText}</p>`}
|
|
689
693
|
</div>
|
|
690
694
|
<span class="vh" role="status" aria-live="polite">${s}</span>
|
|
691
|
-
</div>`}};yt=new WeakMap,Xl=new WeakMap,ie=new WeakSet,cp=function(){return this.loading?[]:(this.results??[]).filter(e=>e?.items?.length).flatMap(e=>[...e.items.map(t=>({group:e,item:t,href:t.href})),...e.href?[{group:e,href:e.href}]:[]])},Yl=function(){return this.open&&!!this.value.trim()},ci=new WeakMap,Ta=function(){this.open=!1,this._active=-1},Vu=function(){this.dispatchEvent(new CustomEvent("cm-search",{detail:{query:this.value},bubbles:!0,composed:!0}))},dp=new WeakMap,
|
|
695
|
+
</div>`}};yt=new WeakMap,Xl=new WeakMap,ie=new WeakSet,cp=function(){return this.loading?[]:(this.results??[]).filter(e=>e?.items?.length).flatMap(e=>[...e.items.map(t=>({group:e,item:t,href:t.href})),...e.href?[{group:e,href:e.href}]:[]])},Yl=function(){return this.open&&!!this.value.trim()},ci=new WeakMap,Ta=function(){this.open=!1,this._active=-1},Vu=function(){this.dispatchEvent(new CustomEvent("cm-search",{detail:{query:this.value},bubbles:!0,composed:!0}))},dp=new WeakMap,dv=function(e){this._active=Wh(this._active,e,a(this,ie,cp).call(this).length)},hp=new WeakMap,Jl=new WeakMap,ju=function(e=!0){this.value="",a(this,ie,Ta).call(this),e&&this.renderRoot.querySelector("input")?.focus(),a(this,ie,Vu).call(this)},hv=function(e,t){this.dispatchEvent(new CustomEvent("cm-select",{detail:{href:t.href,item:t.item,group:t.group},bubbles:!0,composed:!0,cancelable:!0}))||e.preventDefault(),a(this,ie,Ta).call(this)},Xr.shadowRootOptions={...A.shadowRootOptions,delegatesFocus:!0},Xr.properties={label:{string:"label"},placeholder:{string:"placeholder"},value:{},results:{type:Array},loading:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},emptyText:{attribute:"empty-text",string:"noResults"},loadingText:{attribute:"loading-text",string:"loading"},seeAllLabel:{attribute:"see-all-label",string:"seeAll"},shortcut:{},_active:{state:!0}},Xr.styles=[E,Ie,ba,Fi,Vh,w`
|
|
692
696
|
:host { display: block; position: relative; }
|
|
693
697
|
.wrap { position: relative; }
|
|
694
698
|
.box {
|
|
@@ -718,7 +722,7 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
718
722
|
overflow-y: auto; max-height: var(--cm-global-search-results-max-height, min(480px, calc(100dvh - 140px)));
|
|
719
723
|
}
|
|
720
724
|
@media (pointer: coarse) { .box { min-height: var(--cm-control-height-touch); } input { font-size: var(--cm-font-size-16); } }
|
|
721
|
-
`];$("cm-global-search",Xr);var Uu=0,
|
|
725
|
+
`];$("cm-global-search",Xr);var Uu=0,pv="",mv="";function Ku(){if(Uu++===0){let o=document.documentElement;pv=o.style.overflow,mv=o.style.scrollbarGutter,window.innerWidth-o.clientWidth>0&&(o.style.scrollbarGutter="stable"),o.style.overflow="hidden"}}function Ql(){if(Uu>0&&--Uu===0){let o=document.documentElement;o.style.overflow=pv,o.style.scrollbarGutter=mv}}function Wu(){let o=document.activeElement;for(;o?.shadowRoot?.activeElement;)o=o.shadowRoot.activeElement;return o}var Ca,di,za,Sa,pp,mp,up,gp,fp,bp,le=class extends C{constructor(){super(...arguments);m(this,Sa);this.open=!1;this.label="";this.uid=N("cm-ovl");m(this,Ca,null);m(this,di,!1);m(this,za,!1);m(this,mp,e=>{e.key==="Escape"&&!e.defaultPrevented&&(e.preventDefault(),e.stopPropagation(),this.requestClose("escape"))});m(this,up,e=>{e.preventDefault(),this.requestClose("escape")});m(this,gp,()=>{this.open&&!this.dialog?.open&&(this.open=!1,a(this,Sa,pp).call(this))});m(this,fp,e=>{g(this,za,e.target===e.currentTarget)});m(this,bp,e=>{if(e.target===e.currentTarget&&r(this,za)){let t=e.currentTarget.getBoundingClientRect();(!(e.clientX>=t.left&&e.clientX<=t.right&&e.clientY>=t.top&&e.clientY<=t.bottom)||this.backdropFillsDialog)&&this.requestClose("backdrop")}g(this,za,!1)});this.backdropFillsDialog=!1}show(){this.open=!0}close(){this.open=!1}requestClose(e="method"){let t=this.dispatchEvent(new CustomEvent("cm-close",{detail:{reason:e},bubbles:!0,composed:!0,cancelable:!0}));return t&&(this.open=!1),t}closeNow(){this.open=!1;let e=this.dialog;e?.open&&(e.close(),a(this,Sa,pp).call(this))}get dialog(){return this.renderRoot?.querySelector("dialog")}updated(e){if(super.updated(e),!e.has("open"))return;let t=this.dialog;if(t)if(this.open&&!t.open){if(g(this,Ca,Wu()),!this.isConnected)return;t.showModal(),r(this,di)||(Ku(),g(this,di,!0)),this.focusFirst(),this.dispatchEvent(new CustomEvent("cm-open",{bubbles:!0,composed:!0}))}else!this.open&&t.open&&(t.close(),a(this,Sa,pp).call(this))}focusFirst(){let e=this.querySelector("[autofocus]");if(e){e.focus();return}this.renderRoot.querySelector(".panel")?.focus()}disconnectedCallback(){super.disconnectedCallback(),r(this,di)&&(Ql(),g(this,di,!1))}renderHeader(e=h){return c`<header class="head" part="header">
|
|
722
726
|
<h2 id="${this.uid}-h">${this.heading}</h2>${e}
|
|
723
727
|
<button type="button" class="x" part="close" aria-label=${this.closeLabel||this.t("close")} @click=${()=>this.requestClose("close-button")}>
|
|
724
728
|
<cm-icon name="close" size="18"></cm-icon></button>
|
|
@@ -758,7 +762,7 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
758
762
|
|
|
759
763
|
}
|
|
760
764
|
@keyframes cm-ovl-in { from { opacity: 0; } to { opacity: 1; } }
|
|
761
|
-
`];var
|
|
765
|
+
`];var Jk=z("commandPalette",{label:"Command palette",placeholder:"Search or run a command",recent:"Recent",noResults:"No results",results:{one:"{count} result",other:"{count} results"},seeAll:"See all"}),uv=o=>o.normalize("NFD").replace(/\p{M}/gu,"").toLocaleLowerCase();function gv(o,n){let e=uv(n).split(/\s+/).filter(Boolean);if(!e.length)return!0;let t=uv([o.title,...o.keywords??[]].join(" "));return e.every(i=>t.includes(i))}var ec,Ae,Gu,Yu,Zl,vp,yp,fv,bv,La=class extends le{constructor(){super();m(this,Ae);this.value="";this.results=[];this.actions=[];this.recent=[];this.loading=!1;this.shortcut="";this._active=-1;m(this,ec,e=>{!this.shortcut||e.defaultPrevented||e.repeat||!Fu(e,this.shortcut)||!this.open&&!Bu(this.shortcut)&&op(e)||this.open&&!Bu(this.shortcut)||(e.preventDefault(),this.toggle())});m(this,vp,e=>{this.value=e.target.value,this._active=a(this,Ae,Zl).call(this).length?0:-1,this.dispatchEvent(new CustomEvent("cm-search",{detail:{query:this.value},bubbles:!0,composed:!0}))});m(this,yp,e=>{let t=a(this,Ae,Zl).call(this).length;switch(e.key){case"ArrowDown":case"ArrowUp":e.preventDefault(),this._active=Wh(this._active,e.key==="ArrowDown"?1:-1,t);break;case"Home":case"End":if(e.shiftKey||!t)break;e.preventDefault(),this._active=e.key==="Home"?0:t-1;break;case"Enter":if(e.isComposing||this._active<0)break;e.preventDefault(),this.renderRoot.querySelector(`#${this.uid}-o${this._active}`)?.click();break;default:}});this.label=void 0}toggle(){this.open?this.requestClose("method"):this.show()}connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",r(this,ec))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",r(this,ec))}willUpdate(e){if(super.willUpdate?.(e),e.has("open")&&!this.open&&e.get("open")&&(this.value="",this._active=-1),["results","actions","recent","loading","value","open"].some(t=>e.has(t))){let t=a(this,Ae,Zl).call(this).length;(this._active>=t||this._active<0)&&(this._active=t?0:-1)}}updated(e){super.updated(e),(e.has("_active")||e.has("open"))&&this.open&&this._active>=0&&this.renderRoot.querySelector(`#${this.uid}-o${this._active}`)?.scrollIntoView({block:"nearest"})}focusFirst(){let e=this.renderRoot.querySelector("input");e?.focus(),e?.select()}render(){let e=this.open?a(this,Ae,Yu).call(this):[],t=a(this,Ae,Zl).call(this,e),i=r(this,Ae,Gu),s=t.filter(u=>u.item).length,l=!this.open||!i?"":this.loading?this.loadingText:t.length?this.t("results",{count:s}):this.emptyText,d=this.uid,p=-1;return this.renderDialog(c`<div class="panel" part="panel">
|
|
762
766
|
<div class="top">
|
|
763
767
|
<div class="box" part="box">
|
|
764
768
|
<cm-icon name="search" size="16"></cm-icon>
|
|
@@ -777,13 +781,13 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
777
781
|
<div role="listbox" id="${d}-list" part="listbox" aria-label=${this.label} ?hidden=${!t.length}>
|
|
778
782
|
${e.map((u,b)=>c`<div role="group" aria-labelledby="${d}-g${b}">
|
|
779
783
|
${jh(`${d}-g${b}`,u.group.label,u.group.total!==void 0?this.formatNumber(u.group.total):void 0,this.t("results",{count:u.group.total??0}))}
|
|
780
|
-
${u.rows.map(f=>{let x=++p,v=f.item;return Kh({id:`${d}-o${x}`,active:x===this._active,href:f.href,cls:v?"":"all",keyshortcuts:v?.shortcut?
|
|
784
|
+
${u.rows.map(f=>{let x=++p,v=f.item;return Kh({id:`${d}-o${x}`,active:x===this._active,href:f.href,cls:v?"":"all",keyshortcuts:v?.shortcut?cv(v.shortcut):void 0,onHover:()=>this._active=x,onChoose:k=>a(this,Ae,fv).call(this,k,f)},v?Uh(v,a(this,Ae,bv).call(this,v.shortcut)):c`<span class="text">${f.group.seeAllLabel||this.seeAllLabel}</span>`)})}
|
|
781
785
|
</div>`)}
|
|
782
786
|
</div>
|
|
783
787
|
${i&&!this.loading&&!t.length?c`<p class="message" aria-hidden="true">${this.emptyText}</p>`:h}
|
|
784
788
|
</div>
|
|
785
789
|
<span class="vh" role="status" aria-live="polite">${l}</span>
|
|
786
|
-
</div>`)}};ec=new WeakMap,Ae=new WeakSet,Gu=function(){return this.value.trim()},Yu=function(){let e=r(this,Ae,Gu),t=[],i=(s,l,d=!1)=>{let p=l.map(u=>({group:s,item:u,href:u.href}));d&&s.href&&p.push({group:s,href:s.href}),l.length&&t.push({group:s,rows:p})};if(!e)this.recent?.length&&i({label:this.recentLabel,items:this.recent},this.recent);else if(!this.loading)for(let s of this.results??[])s?.items?.length&&i(s,s.items,!0);for(let s of this.actions??[])s?.items?.length&&i(s,e?s.items.filter(l=>
|
|
790
|
+
</div>`)}};ec=new WeakMap,Ae=new WeakSet,Gu=function(){return this.value.trim()},Yu=function(){let e=r(this,Ae,Gu),t=[],i=(s,l,d=!1)=>{let p=l.map(u=>({group:s,item:u,href:u.href}));d&&s.href&&p.push({group:s,href:s.href}),l.length&&t.push({group:s,rows:p})};if(!e)this.recent?.length&&i({label:this.recentLabel,items:this.recent},this.recent);else if(!this.loading)for(let s of this.results??[])s?.items?.length&&i(s,s.items,!0);for(let s of this.actions??[])s?.items?.length&&i(s,e?s.items.filter(l=>gv(l,e)):s.items);return t},Zl=function(e=a(this,Ae,Yu).call(this)){return e.flatMap(t=>t.rows)},vp=new WeakMap,yp=new WeakMap,fv=function(e,t){if(this.closeNow(),!this.dispatchEvent(new CustomEvent("cm-select",{detail:{item:t.item,group:t.group,href:t.href},bubbles:!0,composed:!0,cancelable:!0}))){e.preventDefault();return}t.item?.run?.(t.item)},bv=function(e){return e?c`<span class="keys" aria-hidden="true">${lp(e).map(t=>c`<kbd>${t}</kbd>`)}</span>`:h},La.properties={...le.properties,label:{string:"label"},placeholder:{string:"placeholder"},value:{},results:{type:Array},actions:{type:Array},recent:{type:Array},loading:{type:Boolean,reflect:!0},shortcut:{},emptyText:{attribute:"empty-text",string:"noResults"},loadingText:{attribute:"loading-text",string:"loading"},recentLabel:{attribute:"recent-label",string:"recent"},seeAllLabel:{attribute:"see-all-label",string:"seeAll"},_active:{state:!0}},La.styles=[...le.overlayStyles,ba,Fi,Vh,w`
|
|
787
791
|
dialog {
|
|
788
792
|
position: fixed; inset: 0; margin: max(var(--cm-space-16), 12dvh) auto auto; height: fit-content;
|
|
789
793
|
width: min(var(--cm-command-palette-width, 640px), calc(100vw - 32px));
|
|
@@ -824,7 +828,7 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
824
828
|
.x { width: var(--cm-control-height-touch); height: var(--cm-control-height-touch); }
|
|
825
829
|
[role='option'] { min-height: var(--cm-control-height-touch); }
|
|
826
830
|
}
|
|
827
|
-
`];$("cm-command-palette",La);var
|
|
831
|
+
`];$("cm-command-palette",La);var u0=/^(\d{4})-(\d{2})-(\d{2})$/;function R(o){let n=u0.exec(o??"");if(!n)return null;let e=new Date(+n[1],+n[2]-1,+n[3]);return e.getFullYear()===+n[1]&&e.getMonth()===+n[2]-1&&e.getDate()===+n[3]?e:null}var jt=(o,n=2)=>String(o).padStart(n,"0"),B=o=>`${jt(o.getFullYear(),4)}-${jt(o.getMonth()+1)}-${jt(o.getDate())}`,Xu=()=>B(new Date),te=(o,n)=>new Date(o.getFullYear(),o.getMonth(),o.getDate()+n);function fe(o,n){let e=new Date(o.getFullYear(),o.getMonth()+n,1),t=new Date(e.getFullYear(),e.getMonth()+1,0).getDate();return new Date(e.getFullYear(),e.getMonth(),Math.min(o.getDate(),t))}var ze=o=>new Date(o.getFullYear(),o.getMonth(),1),Jr=o=>new Date(o.getFullYear(),o.getMonth()+1,0);var g0=/^([01]\d|2[0-3]):([0-5]\d)(?::[0-5]\d(?:\.\d{1,3})?)?$/;function ke(o){let n=g0.exec(o??"");return n?+n[1]*60+ +n[2]:null}var hi=o=>{let n=(Math.round(o)%1440+1440)%1440;return`${jt(Math.floor(n/60))}:${jt(n%60)}`};function xt(o){let[n="",e=""]=(o??"").split("T"),t=ke(e);return{date:R(n)?n:"",time:t===null?"":hi(t)}}function Ut(o,n=!1){let{date:e,time:t}=xt(o),i=R(e);if(!i)return null;let s=t?ke(t):n?1439:0;return new Date(i.getFullYear(),i.getMonth(),i.getDate(),Math.floor(s/60),s%60)}var xv=()=>{let o=new Date;return`${B(o)}T${jt(o.getHours())}:${jt(o.getMinutes())}`},vv=new Map;function Aa(o,n){let e=n==="h12"||n==="h23"?n:void 0,t=`${o}|${e??""}`,i=vv.get(t);if(i)return i;let s={hour:e==="h23"?"2-digit":"numeric",minute:"2-digit",numberingSystem:"latn",...e?{hourCycle:e}:{}},l=new Intl.DateTimeFormat(o,s),d=l.resolvedOptions().hourCycle,p=k=>new Date(2e3,0,1,k,30),u=k=>(new Intl.DateTimeFormat(o,{hour:"numeric",hourCycle:"h12"}).formatToParts(p(k)).find(L=>L.type==="dayPeriod")?.value??"").toLowerCase().replace(/[^\p{L}]/gu,""),b=(k,L)=>[...new Set([k,...L].filter(Boolean))],f=k=>k.replace(/[\u202f\u00a0]/g," "),x=f(l.formatToParts(p(9)).map(k=>k.type==="hour"?"{h}":k.type==="minute"?"{m}":k.value).join("")),v={format:k=>f(l.format(new Date(2e3,0,1,Math.floor(k/60),k%60))),dateTime:k=>me(k,{day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit",...e?{hourCycle:e}:{}},o),pattern:x,hour12:d==="h12"||d==="h11",am:b(u(9),["am","a"]),pm:b(u(15),["pm","p"])};return vv.set(t,v),v}var xp=(o,n)=>o.pattern.replace(/\{([hm])\}/g,(e,t)=>n[t]);function Qr(o,n){let e=o.trim().toLowerCase().normalize("NFKC");if(!e)return null;let t=e.replace(/[^\p{L}]/gu,""),i=!!t&&n.pm.includes(t),s=!!t&&n.am.includes(t);if(t&&!i&&!s)return null;let l=e.match(/\d+/g)??[],d,p;if(l.length===1){let u=l[0];if(u.length<=2)d=+u,p=0;else if(u.length<=4)d=+u.slice(0,-2),p=+u.slice(-2);else return null}else if(l.length===2||l.length===3){if(l[0].length>2||l[1].length!==2)return null;d=+l[0],p=+l[1]}else return null;if(p>59)return null;if(s||i){if(d<1||d>12)return null;d=d%12+(i?12:0)}else if(d>23)return null;return hi(d*60+p)}var Da={fromAttribute:o=>o?o.split(/[\s,]+/).filter(Boolean):[],toAttribute:o=>Array.isArray(o)?o.join(" "):o},tc=o=>Array.isArray(o)?o:typeof o=="string"?Da.fromAttribute(o):[];function Wi(o,n){let e=[n,vl(o)??"",navigator.language,"en"];for(let t of e)if(t)try{if(Intl.DateTimeFormat.supportedLocalesOf([t]).length)return t}catch{}return"en"}function Ra(o){try{let n=new Intl.Locale(o),e=n.getWeekInfo?.()??n.weekInfo;if(e?.firstDay)return e.firstDay%7}catch{}return 0}var yv=new Map;function Ha(o){let n=yv.get(o);if(n)return n;let e=v=>new Intl.DateTimeFormat(o,v),t=e({day:"2-digit",month:"2-digit",year:"numeric",numberingSystem:"latn"}),i=e({weekday:"short"}),s=e({weekday:"long"}),l=new Date(2024,0,7),d=t.formatToParts(new Date(2026,10,15)),p=d.filter(v=>v.type==="day"||v.type==="month"||v.type==="year").map(v=>v.type),u=d.map(v=>v.type==="day"?"{d}":v.type==="month"?"{m}":v.type==="year"?"{y}":v.value).join(""),b=(v,k)=>Array.from({length:12},(L,P)=>new Intl.DateTimeFormat(v,{month:k}).format(new Date(2024,P,1)).toLowerCase().replace(/\./g,"")),f=Array.from({length:12},(v,k)=>[...new Set([b(o,"long")[k],b(o,"short")[k],b("en","long")[k],b("en","short")[k]])]),x={short:v=>t.format(v),long:v=>me(v,{weekday:"long",day:"numeric",month:"long",year:"numeric"},o),medium:v=>me(v,{day:"numeric",month:"short",year:"numeric"},o),monthYear:v=>me(v,{month:"long",year:"numeric"},o),day:v=>me(v,{day:"numeric"},o),weekdaysShort:Array.from({length:7},(v,k)=>i.format(te(l,k))),weekdaysLong:Array.from({length:7},(v,k)=>s.format(te(l,k))),pattern:p.length===3?u:"{y}-{m}-{d}",order:p.length===3?p:["year","month","day"],months:f};return yv.set(o,x),x}var wp=(o,n)=>o.pattern.replace(/\{([dmy])\}/g,(e,t)=>n[t]);function Na(o,n){let e=o.trim().toLowerCase();if(!e)return null;let t=e.split(/[^\p{L}\p{N}]+/u).filter(Boolean);if(t.length!==3)return null;let i,s,l,d=t.findIndex(u=>/\p{L}/u.test(u));if(d>=0){let u=t[d];s=n.months.findIndex(v=>v.some(k=>k===u||u.length>=3&&k.startsWith(u)))+1;let b=t.filter((v,k)=>k!==d);if(!s||b.some(v=>!/^\d+$/.test(v)))return null;let f=b.findIndex(v=>v.length===4),x=f>=0?f:1;i=+b[x],l=+b[1-x],b[x].length<=2&&(i+=2e3)}else{if(t.some(f=>!/^\d+$/.test(f)))return null;let u=t[0].length===4?["year","month","day"]:n.order,b=f=>t[u.indexOf(f)];if(i=+b("year"),s=+b("month"),l=+b("day"),b("year").length<=2)i+=2e3;else if(b("year").length!==4)return null}let p=`${jt(i,4)}-${jt(s)}-${jt(l)}`;return R(p)?p:null}function $p(o,n,e,t){let i=(e.getDay()-t+7)%7;switch(o){case"ArrowRight":return te(e,1);case"ArrowLeft":return te(e,-1);case"ArrowDown":return te(e,7);case"ArrowUp":return te(e,-7);case"Home":return te(e,-i);case"End":return te(e,6-i);case"PageDown":return fe(e,n.shiftKey?12:1);case"PageUp":return fe(e,n.shiftKey?-12:-1);default:return null}}var Kt=(o,n,e)=>n&&o<n?n:e&&o>e?e:o;function ic(o){let{fmt:n,firstDay:e,month:t,focus:i,min:s,max:l}=o,d=ze(t),p=(d.getDay()-e+7)%7,u=Jr(t).getDate(),b=[],f=Array(p).fill(null);for(let q=1;q<=u;q++)f.push(new Date(t.getFullYear(),t.getMonth(),q)),f.length===7&&(b.push(f),f=[]);f.length&&b.push([...f,...Array(7-f.length).fill(null)]);let x=Array.from({length:7},(q,O)=>(O+e)%7),v=Xu(),k=!!s&&Jr(fe(d,-1))<s,L=!!l&&fe(d,1)>l,P=c`<thead class=${o.head==="title"?"vh-head":""}><tr>${x.map(q=>c`<th scope="col" abbr=${n.weekdaysLong[q]}><span aria-hidden="true">${n.weekdaysShort[q]}</span><span class="vh">${n.weekdaysLong[q]}</span></th>`)}</tr></thead>`,U=o.head==="title"?c`<h3 id="${o.id}-month" class="cal-month" part="calendar-month">${n.monthYear(t)}</h3>`:c`<div class="cal-head">
|
|
828
832
|
${o.hideNav==="previous"?c`<span class="cal-nav-gap"></span>`:c`<button type="button" class="cal-nav" part="calendar-nav" aria-label=${o.previousLabel} ?disabled=${k} @click=${()=>o.onMonth(-1)}><cm-icon name="chevron-left" size="18"></cm-icon></button>`}
|
|
829
833
|
<h2 id="${o.id}-month" class="cal-title" aria-live="polite">${n.monthYear(t)}</h2>
|
|
830
834
|
${o.hideNav==="next"?c`<span class="cal-nav-gap"></span>`:c`<button type="button" class="cal-nav" part="calendar-nav" aria-label=${o.nextLabel} ?disabled=${L} @click=${()=>o.onMonth(1)}><cm-icon name="chevron-right" size="18"></cm-icon></button>`}
|
|
@@ -903,7 +907,7 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
903
907
|
.wrap.timed { display: flex; flex-wrap: wrap; gap: var(--cm-space-8); }
|
|
904
908
|
.wrap.timed .box { width: auto; min-inline-size: 0; flex: 2 1 10.5rem; }
|
|
905
909
|
.wrap.timed .box.time { flex: 1 1 7.5rem; padding-inline: var(--_cm-field-pad); }
|
|
906
|
-
`;var
|
|
910
|
+
`;var hE=z("datePicker",{choose:"Choose date",chooseFor:"Choose date for {label}",change:"Change date, {date}",changeFor:"Change date for {label}, {date}",dialog:"Choose date",previousMonth:"Previous month",nextMonth:"Next month",patternDay:"dd",patternMonth:"mm",patternYear:"yyyy",badInput:"Enter a date like {pattern}.",required:"Enter or choose a date.",rangeUnderflow:"Choose {date} or later.",rangeOverflow:"Choose {date} or earlier.",unavailable:"This date isn't available. Choose another date.",time:"Time",timeFor:"Time for {label}",patternHour:"hh",patternMinute:"mm",badTime:"Enter a time like {pattern}.",timeMissing:"Enter a time.",stepMismatch:{one:"Choose a time on the minute.",other:"Choose a time in steps of {count} minutes."}}),Ba,we,ts,wt,Fa,gi,Ji,tt,lt,Va,ja,M,rc,Gi,Ua,Mp,Zr,Ia,pi,Yi,mi,ui,_p,Ju,Tp,qa,es,Cp,Qu,wv,zp,$v,kv,fi,Ka,Zu,Oa,sc,ac,eg,Ev,Sp,tg,ig,Lp,Ap,Dp,Rp,Hp,nc,Xi=class extends C{constructor(){super(...arguments);m(this,M);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.min="";this.max="";this.placeholder="";m(this,Ba,"");this.disabledDates=[];this.required=!1;this.disabled=!1;this.open=!1;this.size="default";this.time=!1;this.step=1;this.hourCycle="";this._text="";this._dateError="";this._timeError="";this._focus=new Date;m(this,we,this.attachInternals());m(this,ts,new re(this,r(this,we)));m(this,wt,N("cm-dp"));m(this,Fa,null);m(this,gi,!1);m(this,Ji,!1);m(this,tt,"");m(this,lt,"");m(this,Va,!1);m(this,ja,"");m(this,Ua,!1);m(this,fi,new xe);m(this,Ka,!1);m(this,Sp,e=>{e.key==="Enter"?a(this,M,eg).call(this):(e.key==="ArrowUp"||e.key==="ArrowDown")&&!e.altKey&&(e.preventDefault(),a(this,M,Ev).call(this,e.key==="ArrowUp"?1:-1))});m(this,Lp,()=>{this.disabled||(this.open?this.open=!1:(a(this,M,ac).call(this),this.show()))});m(this,Ap,e=>{e.key==="Enter"?a(this,M,ac).call(this):e.key==="ArrowDown"&&e.altKey?(e.preventDefault(),a(this,M,ac).call(this),this.show()):e.key==="Escape"&&this.open&&(e.preventDefault(),this.open=!1)});m(this,Dp,e=>{let t=$p(se(e,this),e,this._focus,r(this,M,Ju));if(t){e.preventDefault(),this._focus=Kt(t,r(this,M,mi),r(this,M,ui)),g(this,Ji,!0);return}(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),a(this,M,tg).call(this,this._focus))});m(this,Rp,e=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.open=!1,a(this,M,ig).call(this);return}Ep(e,e.currentTarget)});m(this,Hp,e=>{this._focus=Kt(fe(this._focus,e),r(this,M,mi),r(this,M,ui))});m(this,nc,e=>{this.open&&!e.composedPath().includes(this)&&(this.open=!1)})}get locale(){return r(this,Ba)}set locale(e){let t=r(this,Ba);g(this,Ba,e??""),this.requestUpdate("locale",t)}connectedCallback(){super.connectedCallback(),r(this,Fa)===null&&g(this,Fa,this.value),document.addEventListener("pointerdown",r(this,nc),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,fi).close(),document.removeEventListener("pointerdown",r(this,nc),!0)}get form(){return r(this,we).form}get validity(){return r(this,we).validity}get validationMessage(){return r(this,we).validationMessage}get valueAsDate(){return this.time?this.value?Ut(this.value):null:R(this.value)}checkValidity(){return a(this,M,zp).call(this),r(this,we).checkValidity()}reportValidity(){return a(this,M,zp).call(this),r(this,ts).report(()=>r(this,we).reportValidity())}formResetCallback(){r(this,ts).reset(),this._dateError=this._timeError="",this.value=r(this,Fa)??"",this.time&&(a(this,M,Qu).call(this,this.value),g(this,M,a(this,M,es).call(this,r(this,lt)),Gi)),this._text=a(this,M,qa).call(this,r(this,M,pi)),this.open=!1}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){this.value=e??""}show(){this.disabled||(a(this,M,wv).call(this),this.open=!0)}close(){this.open=!1}isUnavailable(e){let t=R(e);if(!t)return!0;let i=r(this,M,mi),s=r(this,M,ui);return i&&t<i||s&&t>s?!0:tc(this.disabledDates).includes(e)||!!this.isDateDisabled?.(e)}willUpdate(e){this.time&&(e.has("value")||e.has("time"))&&!r(this,Ua)?(a(this,M,Qu).call(this,this.value),r(this,Va)||g(this,M,a(this,M,es).call(this,r(this,lt)),Gi)):this.time&&(e.has("locale")||e.has("hourCycle"))&&r(this,lt)&&g(this,M,a(this,M,es).call(this,r(this,lt)),Gi),(e.has("value")||e.has("time"))&&!r(this,gi)?this._text=a(this,M,qa).call(this,r(this,M,pi)):e.has("locale")&&R(r(this,M,pi))&&(this._text=a(this,M,qa).call(this,r(this,M,pi))),e.has("value")&&!r(this,Ka)&&(this._dateError=this._timeError=""),g(this,Ka,!1),g(this,gi,!1),g(this,Va,!1),g(this,Ua,!1)}updated(e){this.open&&!r(this,fi).active?r(this,fi).open(this.renderRoot.querySelector(".pop"),this.renderRoot.querySelector(".wrap"),{align:"start",gap:8}):!this.open&&r(this,fi).active?r(this,fi).close():this.open&&r(this,fi).place(),r(this,we).setFormValue(this.value||null,this.time?this.value:this._text),a(this,M,zp).call(this),this.open&&r(this,Ji)&&(g(this,Ji,!1),this.renderRoot.querySelector('td[tabindex="0"]')?.focus()),e.has("open")&&e.get("open")===!0&&!this.open&&g(this,Ji,!1)}render(){let e=r(this,M,Zr),t=R(r(this,M,pi)),i=[this._dateError,this._timeError].filter(Boolean).join(" "),s=r(this,ts).message,l=this.error||i||s,d=!this.error&&!i&&!!s,p=[l&&`${r(this,wt)}-err`,this.helpText&&`${r(this,wt)}-help`].filter(Boolean).join(" "),u=this.getAttribute("aria-label"),b=this.label||u||"",f=ze(this._focus);return c`<div class="field">
|
|
907
911
|
${this.label?c`<label class="label" for="${r(this,wt)}-in" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</label>`:h}
|
|
908
912
|
<div class="wrap ${this.time?"timed":""}">
|
|
909
913
|
<div class="box ${this._dateError&&!this.error||d?"invalid":""}" part="box">
|
|
@@ -935,7 +939,7 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
935
939
|
</div>
|
|
936
940
|
${l?c`<p class="error" id="${r(this,wt)}-err" role="alert">${l}</p>`:h}
|
|
937
941
|
${this.helpText?c`<p class="help" id="${r(this,wt)}-help">${this.helpText}</p>`:h}
|
|
938
|
-
</div>`}};Ba=new WeakMap,we=new WeakMap,ts=new WeakMap,wt=new WeakMap,Fa=new WeakMap,gi=new WeakMap,Ji=new WeakMap,et=new WeakMap,lt=new WeakMap,Va=new WeakMap,ja=new WeakMap,M=new WeakSet,rc=function(){return r(this,ja)},Gi=function(e){e!==r(this,ja)&&(g(this,ja,e),this.requestUpdate())},Ua=new WeakMap,Mp=function(){return Wi(this,this.locale)},Zr=function(){return Ha(r(this,M,Mp))},Ia=function(){return Aa(r(this,M,Mp),this.hourCycle)},pi=function(){return this.time?r(this,et):this.value},Yi=function(e){return this.time&&e.trim().toLowerCase()==="now"?vv():e},mi=function(){return R(xt(a(this,M,Yi).call(this,this.min)).date||this.min)},ui=function(){return R(xt(a(this,M,Yi).call(this,this.max)).date||this.max)},_p=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=1440?e:1},Ju=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?Ra(r(this,M,Mp)):(Math.trunc(e)%7+7)%7},Tp=function(){return wp(r(this,M,Zr),{d:this.t("patternDay"),m:this.t("patternMonth"),y:this.t("patternYear")})},qa=function(e){let t=R(e);return t?r(this,M,Zr).short(t):e},es=function(e){let t=ke(e);return t===null?"":r(this,M,Ia).format(t)},Cp=function(){return xp(r(this,M,Ia),{h:this.t("patternHour"),m:this.t("patternMinute")})},Qu=function(e){let{date:t,time:i}=xt(e);g(this,et,t),g(this,lt,t?i:"")},yv=function(){let e=new Date,t=R(r(this,M,pi))??new Date(e.getFullYear(),e.getMonth(),e.getDate());this._focus=Kt(t,r(this,M,mi),r(this,M,ui)),g(this,Ji,!0)},zp=function(){a(this,M,xv).call(this),r(this,ts).sync()},xv=function(){let e=this.renderRoot.querySelector("input")??void 0,t=R(r(this,M,pi)),i=r(this,M,Zr);this.error?r(this,we).setValidity({customError:!0},this.error,e):this._text.trim()&&!t?r(this,we).setValidity({badInput:!0},this.t("badInput",{pattern:r(this,M,Tp)}),e):this.time?a(this,M,wv).call(this,t,e):this.required&&!t?r(this,we).setValidity({valueMissing:!0},this.t("required"),e):t&&r(this,M,mi)&&t<r(this,M,mi)?r(this,we).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:i.medium(r(this,M,mi))}),e):t&&r(this,M,ui)&&t>r(this,M,ui)?r(this,we).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:i.medium(r(this,M,ui))}),e):t&&this.isUnavailable(this.value)?r(this,we).setValidity({customError:!0},this.t("unavailable"),e):r(this,we).setValidity({})},wv=function(e,t){let i=this.renderRoot.querySelector("input.time-in")??t,s=(f,x,v,k=t)=>r(this,we).setValidity(f,this.t(x,v),k),l=ke(r(this,lt));if(r(this,M,rc).trim()&&l===null)return s({badInput:!0},"badTime",{pattern:r(this,M,Cp)},i);if(!e&&l===null)return this.required?s({valueMissing:!0},"required"):r(this,we).setValidity({});if(!e)return s({badInput:!0},"required");if(l===null)return s({badInput:!0},"timeMissing",void 0,i);let d=Ut(`${r(this,et)}T${r(this,lt)}`),p=Ut(a(this,M,Yi).call(this,this.min)),u=Ut(a(this,M,Yi).call(this,this.max),!0),b=(f,x)=>xt(f).time?r(this,M,Ia).dateTime(x):r(this,M,Zr).medium(x);if(p&&d<p)return s({rangeUnderflow:!0},"rangeUnderflow",{date:b(a(this,M,Yi).call(this,this.min),p)},i);if(u&&d>u)return s({rangeOverflow:!0},"rangeOverflow",{date:b(a(this,M,Yi).call(this,this.max),u)},i);if(l%r(this,M,_p))return s({stepMismatch:!0},"stepMismatch",{count:r(this,M,_p)},i);if(this.isUnavailable(r(this,et)))return s({customError:!0},"unavailable");r(this,we).setValidity({})},fi=new WeakMap,Ka=new WeakMap,Zu=function(e){e!==this.value&&(g(this,Ka,!0),this.value=e,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))},Oa=function(e,t){g(this,et,e),g(this,lt,t);let i=e&&t?`${e}T${t}`:"";g(this,Ua,!0),this.requestUpdate(),a(this,M,Zu).call(this,i)},sc=function(e){this.time?a(this,M,Oa).call(this,e,r(this,lt)):a(this,M,Zu).call(this,e)},ac=function(){let e=this._text.trim();if(this._dateError="",!e){a(this,M,sc).call(this,"");return}let t=Na(e,r(this,M,Zr));t?(a(this,M,sc).call(this,t),this._text=a(this,M,qa).call(this,t)):(g(this,gi,!0),a(this,M,sc).call(this,""),this._dateError=this.t("badInput",{pattern:r(this,M,Tp)}))},eg=function(){let e=r(this,M,rc).trim(),t=e?Qr(e,r(this,M,Ia)):"";if(g(this,gi,!0),t===null){g(this,Va,!0),a(this,M,Oa).call(this,r(this,et),""),this._timeError=this.t("badTime",{pattern:r(this,M,Cp)});return}this._timeError="",a(this,M,Oa).call(this,r(this,et),t),g(this,M,a(this,M,es).call(this,t),Gi)},$v=function(e){let t=r(this,M,_p),i=Qr(r(this,M,rc),r(this,M,Ia));if(!i){let p=xt(a(this,M,Yi).call(this,this.min)),u=new Date;if(i=p.time&&(!r(this,et)||r(this,et)===p.date)?p.time:hi(u.getHours()*60+u.getMinutes()),ke(i)%t===0){g(this,gi,!0),a(this,M,Oa).call(this,r(this,et),i),g(this,M,a(this,M,es).call(this,i),Gi);return}e=1}let s=ke(i),l=e>0?(Math.floor(s/t)+1)*t:(Math.ceil(s/t)-1)*t,d=hi(l>=1440?0:l<0?Math.floor(1439/t)*t:l);g(this,gi,!0),a(this,M,Oa).call(this,r(this,et),d),g(this,M,a(this,M,es).call(this,d),Gi)},Sp=new WeakMap,tg=function(e){let t=B(e);this.isUnavailable(t)||(this.open=!1,a(this,M,sc).call(this,t),this._text=a(this,M,qa).call(this,t),this._dateError="",this.time&&!r(this,lt)?this.updateComplete.then(()=>this.renderRoot.querySelector("input.time-in")?.focus()):a(this,M,ig).call(this))},ig=function(){this.renderRoot.querySelector(".trigger")?.focus()},Lp=new WeakMap,Ap=new WeakMap,Dp=new WeakMap,Rp=new WeakMap,Hp=new WeakMap,nc=new WeakMap,Xi.formAssociated=!0,Xi.shadowRootOptions={...A.shadowRootOptions,delegatesFocus:!0},Xi.properties={label:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},min:{},max:{},placeholder:{},locale:{noAccessor:!0},firstDayOfWeek:{type:Number,attribute:"first-day-of-week"},disabledDates:{attribute:"disabled-dates",converter:Da},isDateDisabled:{attribute:!1},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},size:{reflect:!0},time:{type:Boolean,reflect:!0},step:{type:Number},hourCycle:{attribute:"hour-cycle"},_text:{state:!0},_dateError:{state:!0},_timeError:{state:!0},_focus:{state:!0}},Xi.styles=[E,Pe,Pa,kp,w`.pop { min-width: 0; }`];$("cm-date-picker",Xi);var yE=z("dateRangePicker",{choose:"Choose dates",chooseFor:"Choose dates for {label}",change:"Change dates, {start} to {end}",changeFor:"Change dates for {label}, {start} to {end}",dialog:"Choose dates",previousMonth:"Previous month",nextMonth:"Next month",start:"Start date",end:"End date",presets:"Preset ranges",chooseStart:"Choose the start date.",chooseEnd:"Start date {date}. Choose the end date.",startNote:"start date",endNote:"end date",patternDay:"dd",patternMonth:"mm",patternYear:"yyyy",badStart:"Enter a start date like {pattern}.",badEnd:"Enter an end date like {pattern}.",required:"Enter or choose a start and end date.",endBeforeStart:"The end date is before the start date.",rangeUnderflow:"Choose {date} or later.",rangeOverflow:"Choose {date} or earlier.",unavailable:"A chosen date isn't available. Choose another date.",today:"Today",yesterday:"Yesterday",last7Days:"Last 7 days",last30Days:"Last 30 days",last90Days:"Last 90 days",thisMonth:"This month",lastMonth:"Last month",thisWeek:"This week",lastWeek:"Last week",last28Days:"Last 28 days",last12Months:"Last 12 months",thisYear:"This year",lastYear:"Last year",quarterToDate:"Quarter to date",lastQuarter:"Last quarter",dayCount:{one:"{count} day",other:"{count} days"},custom:"Custom",apply:"Apply",cancel:"Cancel",noRange:"No dates chosen"}),rg=(o,n)=>te(o,-((o.getDay()-n+7)%7)),kv={today:["Today",o=>[o,o]],yesterday:["Yesterday",o=>[te(o,-1),te(o,-1)]],"this-week":["This week",(o,n)=>[rg(o,n),o]],"last-week":["Last week",(o,n)=>[te(rg(o,n),-7),te(rg(o,n),-1)]],"last-7-days":["Last 7 days",o=>[te(o,-6),o]],"last-28-days":["Last 28 days",o=>[te(o,-27),o]],"last-30-days":["Last 30 days",o=>[te(o,-29),o]],"last-90-days":["Last 90 days",o=>[te(o,-89),o]],"last-12-months":["Last 12 months",o=>[te(fe(o,-12),1),o]],"this-month":["This month",o=>[ze(o),o]],"last-month":["Last month",o=>[ze(fe(o,-1)),Jr(fe(o,-1))]],"quarter-to-date":["Quarter to date",o=>[new Date(o.getFullYear(),o.getMonth()-o.getMonth()%3,1),o]],"last-quarter":["Last quarter",o=>{let n=new Date(o.getFullYear(),o.getMonth()-o.getMonth()%3-3,1);return[n,Jr(fe(n,2))]}],"this-year":["This year",o=>[new Date(o.getFullYear(),0,1),o]],"last-year":["Last year",o=>[new Date(o.getFullYear()-1,0,1),new Date(o.getFullYear()-1,11,31)]]},u0=o=>o.replace(/-([a-z0-9])/g,(n,e)=>e.toUpperCase());function Np(o,n=new Date,e,t=0){if(typeof o=="object"&&o)return o;let i=kv[o];if(!i||!Object.prototype.hasOwnProperty.call(kv,o))return null;let s=new Date(n.getFullYear(),n.getMonth(),n.getDate()),[l,d]=i[1](s,t);return{label:e?.(u0(o))||i[0],start:B(l),end:B(d)}}var g0=["custom","today","yesterday","this-week","last-7-days","last-week","last-28-days","last-30-days","this-month","last-month","last-90-days","quarter-to-date","this-year"],Ja,Ee,rs,Se,Qa,Za,Ue,en,Wt,er,_,is,oc,Pp,bi,Qi,Wa,lc,Ga,sg,Ip,cc,Ke,dc,Rt,vi,Ev,hc,Ya,qp,ag,ng,og,lg,Op,cg,Xa,uc,Bp,gc,fc,bc,pc,mc,Mv,_v,Zi=class extends C{constructor(){super(...arguments);m(this,_);this.label="";this.helpText="";this.error="";this.name="";this.startName="";this.endName="";this.start="";this.end="";this.min="";this.max="";m(this,Ja,"");this.disabledDates=[];this.presets=[];this.preset="";this.months=1;this.confirm=!1;this.variant="";this.required=!1;this.disabled=!1;this.open=!1;this.size="default";this._startText="";this._endText="";this._focus=new Date;this._draftStart="";this._draftEnd="";this._hover=null;this._view=ze(new Date);this._draftPreset="";this._dStartText="";this._dEndText="";m(this,Ee,this.attachInternals());m(this,rs,new re(this,r(this,Ee)));m(this,Se,N("cm-drp"));m(this,Qa,null);m(this,Za,!1);m(this,Ue,!1);m(this,en,!1);m(this,Wt,!1);m(this,er,!1);m(this,Ke,"start");m(this,vi,new xe);m(this,uc,()=>{this.disabled||(this.open?this.open=!1:(r(this,_,is)||(a(this,_,Ya).call(this,"start"),a(this,_,Ya).call(this,"end")),this.show()))});m(this,Bp,e=>t=>{t.key==="Enter"?a(this,_,Ya).call(this,e):t.key==="ArrowDown"&&t.altKey?(t.preventDefault(),a(this,_,Ya).call(this,e),this.show()):t.key==="Escape"&&this.open&&(t.preventDefault(),this.open=!1)});m(this,gc,e=>{let t=$p(se(e,this),e,this._focus,r(this,_,Qi));if(t){e.preventDefault(),this._focus=Kt(t,R(this.min),R(this.max)),a(this,_,Ga).call(this,this._focus),g(this,Wt,!0);return}(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),a(this,_,qp).call(this,this._focus))});m(this,fc,e=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.open=!1,a(this,_,Xa).call(this);return}Ep(e,e.currentTarget)});m(this,bc,e=>{this.open&&!e.composedPath().includes(this)&&(this.open=!1)})}get locale(){return r(this,Ja)}set locale(e){let t=r(this,Ja);g(this,Ja,e??""),this.requestUpdate("locale",t)}connectedCallback(){super.connectedCallback(),r(this,Qa)||g(this,Qa,[this.start,this.end,this.preset]),document.addEventListener("pointerdown",r(this,bc),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,vi).close(),document.removeEventListener("pointerdown",r(this,bc),!0)}get form(){return r(this,Ee).form}get validity(){return r(this,Ee).validity}get validationMessage(){return r(this,Ee).validationMessage}checkValidity(){return r(this,Ee).checkValidity()}reportValidity(){return r(this,rs).report(()=>r(this,Ee).reportValidity())}formResetCallback(){[this.start,this.end,this.preset]=r(this,Qa)??["","",""],this._startText=a(this,_,Rt).call(this,this.start),this._endText=a(this,_,Rt).call(this,this.end),this.open=!1,r(this,rs).reset()}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){[this.start="",this.end=""]=(e??"").split("/")}show(){if(this.disabled)return;this._draftStart=R(this.start)?this.start:"",this._draftEnd=R(this.end)?this.end:"",this._draftPreset=this.preset,this._hover=null,g(this,Ue,!1);let e=new Date,t=r(this,_,lc)===2?R(this.end)??R(this.start):R(this.start);this._view=ze(fe(Kt(t??new Date(e.getFullYear(),e.getMonth(),e.getDate()),R(this.min),R(this.max)),1-r(this,_,lc))),this._focus=Kt(R(this.start)??t??new Date(e.getFullYear(),e.getMonth(),e.getDate()),R(this.min),R(this.max)),a(this,_,Ga).call(this,this._focus),g(this,Ke,"start"),g(this,Wt,!0),g(this,er,!0),a(this,_,Wa).call(this),this.open=!0}close(){this.open=!1}isUnavailable(e){let t=R(e);if(!t)return!0;let i=R(this.min),s=R(this.max);return i&&t<i||s&&t>s?!0:tc(this.disabledDates).includes(e)||!!this.isDateDisabled?.(e)}willUpdate(e){if(e.has("preset")&&!r(this,Za)&&this.preset){let t=Np(this.preset,new Date,void 0,r(this,_,Qi));t&&(this.start=t.start,this.end=t.end)}g(this,Za,!1),r(this,en)||(e.has("start")&&(this._startText=a(this,_,Rt).call(this,this.start)),e.has("end")&&(this._endText=a(this,_,Rt).call(this,this.end))),g(this,en,!1),e.has("locale")&&(R(this.start)&&(this._startText=a(this,_,Rt).call(this,this.start)),R(this.end)&&(this._endText=a(this,_,Rt).call(this,this.end)))}updated(){this.open&&!r(this,vi).active?r(this,vi).open(this.renderRoot.querySelector(".pop"),this.renderRoot.querySelector(".wrap"),{align:"start",gap:8}):!this.open&&r(this,vi).active?r(this,vi).close():this.open&&r(this,vi).place();let e=R(this.start),t=R(this.end),i=new FormData;(this.name||this.startName)&&e&&i.append(this.startName||`${this.name}-start`,this.start),(this.name||this.endName)&&t&&i.append(this.endName||`${this.name}-end`,this.end),r(this,Ee).setFormValue(e||t?i:null,`${this.start}/${this.end}`);let s=r(this,_,is)?[]:[...this.renderRoot.querySelectorAll(".box input")],l=this.renderRoot.querySelector(".trigger")??void 0,[d,p]=[s[0]??l,s[1]??l],u=r(this,_,bi),b=R(this.min),f=R(this.max);if(this.error?r(this,Ee).setValidity({customError:!0},this.error,d):this._startText.trim()&&!e?r(this,Ee).setValidity({badInput:!0},this.t("badStart",{pattern:r(this,_,dc)}),d):this._endText.trim()&&!t?r(this,Ee).setValidity({badInput:!0},this.t("badEnd",{pattern:r(this,_,dc)}),p):this.required&&(!e||!t)?r(this,Ee).setValidity({valueMissing:!0},this.t("required"),e?p:d):e&&t&&t<e?r(this,Ee).setValidity({badInput:!0},this.t("endBeforeStart"),p):e&&b&&e<b||t&&b&&t<b?r(this,Ee).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:u.medium(b)}),d):e&&f&&e>f||t&&f&&t>f?r(this,Ee).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:u.medium(f)}),p):e&&this.isUnavailable(this.start)||t&&this.isUnavailable(this.end)?r(this,Ee).setValidity({customError:!0},this.t("unavailable"),d):r(this,Ee).setValidity({}),r(this,rs).sync(),this.open&&r(this,Wt)&&(g(this,Wt,!1),this.renderRoot.querySelector('td[tabindex="0"]')?.focus()),this.open&&r(this,er)){g(this,er,!1);let x=this.renderRoot.querySelector(".r-months"),v=R(this._draftStart)??this._focus,k=x?.querySelector(`[data-month="${B(ze(v)).slice(0,7)}"]`),L=x?.querySelector(".r-week");x&&k&&(x.scrollTop=k.offsetTop-(L?.offsetHeight??0))}}render(){let e=r(this,_,bi),t=R(this.start),i=R(this.end),s=r(this,rs).message,l=[s&&`${r(this,Se)}-err`,this.helpText&&`${r(this,Se)}-help`].filter(Boolean).join(" "),d=this.getAttribute("aria-label"),p=this.label||d||"",u=this.open?r(this,_,Ip):[],[b,f,x]=r(this,_,oc)?[this._draftStart,this._draftEnd,this._draftPreset]:[this.start,this.end,this.preset],v=!r(this,Ue)&&!!x&&u.some(K=>K.key===x),k=K=>!r(this,Ue)&&(v?K.key===x:K.start===b&&K.end===f),L=r(this,Ue)||!u.some(k)&&!!(b||f),P=r(this,_,lc),U=K=>ic({id:P===1?r(this,Se):`${r(this,Se)}-m${K}`,fmt:e,firstDay:r(this,_,Qi),month:fe(this._view,K),focus:this._focus,min:R(this.min),max:R(this.max),isDisabled:Z=>this.isUnavailable(B(Z)),mark:Z=>a(this,_,pc).call(this,Z),note:Z=>{let zt=a(this,_,pc).call(this,Z);return zt==="start"?this.t("startNote"):zt==="end"?this.t("endNote"):""},onPick:Z=>a(this,_,qp).call(this,Z),onKey:r(this,gc),onMonth:Z=>{this._view=fe(this._view,Z),this._focus=Kt(fe(this._focus,Z),R(this.min),R(this.max)),a(this,_,Ga).call(this,this._focus)},previousLabel:this.t("previousMonth"),nextLabel:this.t("nextMonth"),onHover:Z=>{r(this,Ke)==="end"&&(this._hover=Z)},hideNav:P===1?void 0:K===0?"next":"previous"}),q=R(this._draftStart),O=R(this._draftEnd),be=r(this,Ke)==="end"&&this._draftStart?this.t("chooseEnd",{date:e.medium(R(this._draftStart))}):this.t("chooseStart"),G=K=>{let Z=K==="start"?this._startText:this._endText;return c`<input id="${r(this,Se)}-${K}" type="text" autocomplete="off" spellcheck="false"
|
|
942
|
+
</div>`}};Ba=new WeakMap,we=new WeakMap,ts=new WeakMap,wt=new WeakMap,Fa=new WeakMap,gi=new WeakMap,Ji=new WeakMap,tt=new WeakMap,lt=new WeakMap,Va=new WeakMap,ja=new WeakMap,M=new WeakSet,rc=function(){return r(this,ja)},Gi=function(e){e!==r(this,ja)&&(g(this,ja,e),this.requestUpdate())},Ua=new WeakMap,Mp=function(){return Wi(this,this.locale)},Zr=function(){return Ha(r(this,M,Mp))},Ia=function(){return Aa(r(this,M,Mp),this.hourCycle)},pi=function(){return this.time?r(this,tt):this.value},Yi=function(e){return this.time&&e.trim().toLowerCase()==="now"?xv():e},mi=function(){return R(xt(a(this,M,Yi).call(this,this.min)).date||this.min)},ui=function(){return R(xt(a(this,M,Yi).call(this,this.max)).date||this.max)},_p=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=1440?e:1},Ju=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?Ra(r(this,M,Mp)):(Math.trunc(e)%7+7)%7},Tp=function(){return wp(r(this,M,Zr),{d:this.t("patternDay"),m:this.t("patternMonth"),y:this.t("patternYear")})},qa=function(e){let t=R(e);return t?r(this,M,Zr).short(t):e},es=function(e){let t=ke(e);return t===null?"":r(this,M,Ia).format(t)},Cp=function(){return xp(r(this,M,Ia),{h:this.t("patternHour"),m:this.t("patternMinute")})},Qu=function(e){let{date:t,time:i}=xt(e);g(this,tt,t),g(this,lt,t?i:"")},wv=function(){let e=new Date,t=R(r(this,M,pi))??new Date(e.getFullYear(),e.getMonth(),e.getDate());this._focus=Kt(t,r(this,M,mi),r(this,M,ui)),g(this,Ji,!0)},zp=function(){a(this,M,$v).call(this),r(this,ts).sync()},$v=function(){let e=this.renderRoot.querySelector("input")??void 0,t=R(r(this,M,pi)),i=r(this,M,Zr);this.error?r(this,we).setValidity({customError:!0},this.error,e):this._text.trim()&&!t?r(this,we).setValidity({badInput:!0},this.t("badInput",{pattern:r(this,M,Tp)}),e):this.time?a(this,M,kv).call(this,t,e):this.required&&!t?r(this,we).setValidity({valueMissing:!0},this.t("required"),e):t&&r(this,M,mi)&&t<r(this,M,mi)?r(this,we).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:i.medium(r(this,M,mi))}),e):t&&r(this,M,ui)&&t>r(this,M,ui)?r(this,we).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:i.medium(r(this,M,ui))}),e):t&&this.isUnavailable(this.value)?r(this,we).setValidity({customError:!0},this.t("unavailable"),e):r(this,we).setValidity({})},kv=function(e,t){let i=this.renderRoot.querySelector("input.time-in")??t,s=(f,x,v,k=t)=>r(this,we).setValidity(f,this.t(x,v),k),l=ke(r(this,lt));if(r(this,M,rc).trim()&&l===null)return s({badInput:!0},"badTime",{pattern:r(this,M,Cp)},i);if(!e&&l===null)return this.required?s({valueMissing:!0},"required"):r(this,we).setValidity({});if(!e)return s({badInput:!0},"required");if(l===null)return s({badInput:!0},"timeMissing",void 0,i);let d=Ut(`${r(this,tt)}T${r(this,lt)}`),p=Ut(a(this,M,Yi).call(this,this.min)),u=Ut(a(this,M,Yi).call(this,this.max),!0),b=(f,x)=>xt(f).time?r(this,M,Ia).dateTime(x):r(this,M,Zr).medium(x);if(p&&d<p)return s({rangeUnderflow:!0},"rangeUnderflow",{date:b(a(this,M,Yi).call(this,this.min),p)},i);if(u&&d>u)return s({rangeOverflow:!0},"rangeOverflow",{date:b(a(this,M,Yi).call(this,this.max),u)},i);if(l%r(this,M,_p))return s({stepMismatch:!0},"stepMismatch",{count:r(this,M,_p)},i);if(this.isUnavailable(r(this,tt)))return s({customError:!0},"unavailable");r(this,we).setValidity({})},fi=new WeakMap,Ka=new WeakMap,Zu=function(e){e!==this.value&&(g(this,Ka,!0),this.value=e,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))},Oa=function(e,t){g(this,tt,e),g(this,lt,t);let i=e&&t?`${e}T${t}`:"";g(this,Ua,!0),this.requestUpdate(),a(this,M,Zu).call(this,i)},sc=function(e){this.time?a(this,M,Oa).call(this,e,r(this,lt)):a(this,M,Zu).call(this,e)},ac=function(){let e=this._text.trim();if(this._dateError="",!e){a(this,M,sc).call(this,"");return}let t=Na(e,r(this,M,Zr));t?(a(this,M,sc).call(this,t),this._text=a(this,M,qa).call(this,t)):(g(this,gi,!0),a(this,M,sc).call(this,""),this._dateError=this.t("badInput",{pattern:r(this,M,Tp)}))},eg=function(){let e=r(this,M,rc).trim(),t=e?Qr(e,r(this,M,Ia)):"";if(g(this,gi,!0),t===null){g(this,Va,!0),a(this,M,Oa).call(this,r(this,tt),""),this._timeError=this.t("badTime",{pattern:r(this,M,Cp)});return}this._timeError="",a(this,M,Oa).call(this,r(this,tt),t),g(this,M,a(this,M,es).call(this,t),Gi)},Ev=function(e){let t=r(this,M,_p),i=Qr(r(this,M,rc),r(this,M,Ia));if(!i){let p=xt(a(this,M,Yi).call(this,this.min)),u=new Date;if(i=p.time&&(!r(this,tt)||r(this,tt)===p.date)?p.time:hi(u.getHours()*60+u.getMinutes()),ke(i)%t===0){g(this,gi,!0),a(this,M,Oa).call(this,r(this,tt),i),g(this,M,a(this,M,es).call(this,i),Gi);return}e=1}let s=ke(i),l=e>0?(Math.floor(s/t)+1)*t:(Math.ceil(s/t)-1)*t,d=hi(l>=1440?0:l<0?Math.floor(1439/t)*t:l);g(this,gi,!0),a(this,M,Oa).call(this,r(this,tt),d),g(this,M,a(this,M,es).call(this,d),Gi)},Sp=new WeakMap,tg=function(e){let t=B(e);this.isUnavailable(t)||(this.open=!1,a(this,M,sc).call(this,t),this._text=a(this,M,qa).call(this,t),this._dateError="",this.time&&!r(this,lt)?this.updateComplete.then(()=>this.renderRoot.querySelector("input.time-in")?.focus()):a(this,M,ig).call(this))},ig=function(){this.renderRoot.querySelector(".trigger")?.focus()},Lp=new WeakMap,Ap=new WeakMap,Dp=new WeakMap,Rp=new WeakMap,Hp=new WeakMap,nc=new WeakMap,Xi.formAssociated=!0,Xi.shadowRootOptions={...A.shadowRootOptions,delegatesFocus:!0},Xi.properties={label:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},min:{},max:{},placeholder:{},locale:{noAccessor:!0},firstDayOfWeek:{type:Number,attribute:"first-day-of-week"},disabledDates:{attribute:"disabled-dates",converter:Da},isDateDisabled:{attribute:!1},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},size:{reflect:!0},time:{type:Boolean,reflect:!0},step:{type:Number},hourCycle:{attribute:"hour-cycle"},_text:{state:!0},_dateError:{state:!0},_timeError:{state:!0},_focus:{state:!0}},Xi.styles=[E,Ie,Pa,kp,w`.pop { min-width: 0; }`];$("cm-date-picker",Xi);var wE=z("dateRangePicker",{choose:"Choose dates",chooseFor:"Choose dates for {label}",change:"Change dates, {start} to {end}",changeFor:"Change dates for {label}, {start} to {end}",dialog:"Choose dates",previousMonth:"Previous month",nextMonth:"Next month",start:"Start date",end:"End date",presets:"Preset ranges",chooseStart:"Choose the start date.",chooseEnd:"Start date {date}. Choose the end date.",startNote:"start date",endNote:"end date",patternDay:"dd",patternMonth:"mm",patternYear:"yyyy",badStart:"Enter a start date like {pattern}.",badEnd:"Enter an end date like {pattern}.",required:"Enter or choose a start and end date.",endBeforeStart:"The end date is before the start date.",rangeUnderflow:"Choose {date} or later.",rangeOverflow:"Choose {date} or earlier.",unavailable:"A chosen date isn't available. Choose another date.",today:"Today",yesterday:"Yesterday",last7Days:"Last 7 days",last30Days:"Last 30 days",last90Days:"Last 90 days",thisMonth:"This month",lastMonth:"Last month",thisWeek:"This week",lastWeek:"Last week",last28Days:"Last 28 days",last12Months:"Last 12 months",thisYear:"This year",lastYear:"Last year",quarterToDate:"Quarter to date",lastQuarter:"Last quarter",dayCount:{one:"{count} day",other:"{count} days"},custom:"Custom",apply:"Apply",cancel:"Cancel",noRange:"No dates chosen"}),rg=(o,n)=>te(o,-((o.getDay()-n+7)%7)),Mv={today:["Today",o=>[o,o]],yesterday:["Yesterday",o=>[te(o,-1),te(o,-1)]],"this-week":["This week",(o,n)=>[rg(o,n),o]],"last-week":["Last week",(o,n)=>[te(rg(o,n),-7),te(rg(o,n),-1)]],"last-7-days":["Last 7 days",o=>[te(o,-6),o]],"last-28-days":["Last 28 days",o=>[te(o,-27),o]],"last-30-days":["Last 30 days",o=>[te(o,-29),o]],"last-90-days":["Last 90 days",o=>[te(o,-89),o]],"last-12-months":["Last 12 months",o=>[te(fe(o,-12),1),o]],"this-month":["This month",o=>[ze(o),o]],"last-month":["Last month",o=>[ze(fe(o,-1)),Jr(fe(o,-1))]],"quarter-to-date":["Quarter to date",o=>[new Date(o.getFullYear(),o.getMonth()-o.getMonth()%3,1),o]],"last-quarter":["Last quarter",o=>{let n=new Date(o.getFullYear(),o.getMonth()-o.getMonth()%3-3,1);return[n,Jr(fe(n,2))]}],"this-year":["This year",o=>[new Date(o.getFullYear(),0,1),o]],"last-year":["Last year",o=>[new Date(o.getFullYear()-1,0,1),new Date(o.getFullYear()-1,11,31)]]},f0=o=>o.replace(/-([a-z0-9])/g,(n,e)=>e.toUpperCase());function Np(o,n=new Date,e,t=0){if(typeof o=="object"&&o)return o;let i=Mv[o];if(!i||!Object.prototype.hasOwnProperty.call(Mv,o))return null;let s=new Date(n.getFullYear(),n.getMonth(),n.getDate()),[l,d]=i[1](s,t);return{label:e?.(f0(o))||i[0],start:B(l),end:B(d)}}var b0=["custom","today","yesterday","this-week","last-7-days","last-week","last-28-days","last-30-days","this-month","last-month","last-90-days","quarter-to-date","this-year"],Ja,Ee,rs,Se,Qa,Za,Ke,en,Wt,er,_,is,oc,Pp,bi,Qi,Wa,lc,Ga,sg,Ip,cc,We,dc,Rt,vi,_v,hc,Ya,qp,ag,ng,og,lg,Op,cg,Xa,uc,Bp,gc,fc,bc,pc,mc,Tv,Cv,Zi=class extends C{constructor(){super(...arguments);m(this,_);this.label="";this.helpText="";this.error="";this.name="";this.startName="";this.endName="";this.start="";this.end="";this.min="";this.max="";m(this,Ja,"");this.disabledDates=[];this.presets=[];this.preset="";this.months=1;this.confirm=!1;this.variant="";this.required=!1;this.disabled=!1;this.open=!1;this.size="default";this._startText="";this._endText="";this._focus=new Date;this._draftStart="";this._draftEnd="";this._hover=null;this._view=ze(new Date);this._draftPreset="";this._dStartText="";this._dEndText="";m(this,Ee,this.attachInternals());m(this,rs,new re(this,r(this,Ee)));m(this,Se,N("cm-drp"));m(this,Qa,null);m(this,Za,!1);m(this,Ke,!1);m(this,en,!1);m(this,Wt,!1);m(this,er,!1);m(this,We,"start");m(this,vi,new xe);m(this,uc,()=>{this.disabled||(this.open?this.open=!1:(r(this,_,is)||(a(this,_,Ya).call(this,"start"),a(this,_,Ya).call(this,"end")),this.show()))});m(this,Bp,e=>t=>{t.key==="Enter"?a(this,_,Ya).call(this,e):t.key==="ArrowDown"&&t.altKey?(t.preventDefault(),a(this,_,Ya).call(this,e),this.show()):t.key==="Escape"&&this.open&&(t.preventDefault(),this.open=!1)});m(this,gc,e=>{let t=$p(se(e,this),e,this._focus,r(this,_,Qi));if(t){e.preventDefault(),this._focus=Kt(t,R(this.min),R(this.max)),a(this,_,Ga).call(this,this._focus),g(this,Wt,!0);return}(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),a(this,_,qp).call(this,this._focus))});m(this,fc,e=>{if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.open=!1,a(this,_,Xa).call(this);return}Ep(e,e.currentTarget)});m(this,bc,e=>{this.open&&!e.composedPath().includes(this)&&(this.open=!1)})}get locale(){return r(this,Ja)}set locale(e){let t=r(this,Ja);g(this,Ja,e??""),this.requestUpdate("locale",t)}connectedCallback(){super.connectedCallback(),r(this,Qa)||g(this,Qa,[this.start,this.end,this.preset]),document.addEventListener("pointerdown",r(this,bc),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,vi).close(),document.removeEventListener("pointerdown",r(this,bc),!0)}get form(){return r(this,Ee).form}get validity(){return r(this,Ee).validity}get validationMessage(){return r(this,Ee).validationMessage}checkValidity(){return r(this,Ee).checkValidity()}reportValidity(){return r(this,rs).report(()=>r(this,Ee).reportValidity())}formResetCallback(){[this.start,this.end,this.preset]=r(this,Qa)??["","",""],this._startText=a(this,_,Rt).call(this,this.start),this._endText=a(this,_,Rt).call(this,this.end),this.open=!1,r(this,rs).reset()}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){[this.start="",this.end=""]=(e??"").split("/")}show(){if(this.disabled)return;this._draftStart=R(this.start)?this.start:"",this._draftEnd=R(this.end)?this.end:"",this._draftPreset=this.preset,this._hover=null,g(this,Ke,!1);let e=new Date,t=r(this,_,lc)===2?R(this.end)??R(this.start):R(this.start);this._view=ze(fe(Kt(t??new Date(e.getFullYear(),e.getMonth(),e.getDate()),R(this.min),R(this.max)),1-r(this,_,lc))),this._focus=Kt(R(this.start)??t??new Date(e.getFullYear(),e.getMonth(),e.getDate()),R(this.min),R(this.max)),a(this,_,Ga).call(this,this._focus),g(this,We,"start"),g(this,Wt,!0),g(this,er,!0),a(this,_,Wa).call(this),this.open=!0}close(){this.open=!1}isUnavailable(e){let t=R(e);if(!t)return!0;let i=R(this.min),s=R(this.max);return i&&t<i||s&&t>s?!0:tc(this.disabledDates).includes(e)||!!this.isDateDisabled?.(e)}willUpdate(e){if(e.has("preset")&&!r(this,Za)&&this.preset){let t=Np(this.preset,new Date,void 0,r(this,_,Qi));t&&(this.start=t.start,this.end=t.end)}g(this,Za,!1),r(this,en)||(e.has("start")&&(this._startText=a(this,_,Rt).call(this,this.start)),e.has("end")&&(this._endText=a(this,_,Rt).call(this,this.end))),g(this,en,!1),e.has("locale")&&(R(this.start)&&(this._startText=a(this,_,Rt).call(this,this.start)),R(this.end)&&(this._endText=a(this,_,Rt).call(this,this.end)))}updated(){this.open&&!r(this,vi).active?r(this,vi).open(this.renderRoot.querySelector(".pop"),this.renderRoot.querySelector(".wrap"),{align:"start",gap:8}):!this.open&&r(this,vi).active?r(this,vi).close():this.open&&r(this,vi).place();let e=R(this.start),t=R(this.end),i=new FormData;(this.name||this.startName)&&e&&i.append(this.startName||`${this.name}-start`,this.start),(this.name||this.endName)&&t&&i.append(this.endName||`${this.name}-end`,this.end),r(this,Ee).setFormValue(e||t?i:null,`${this.start}/${this.end}`);let s=r(this,_,is)?[]:[...this.renderRoot.querySelectorAll(".box input")],l=this.renderRoot.querySelector(".trigger")??void 0,[d,p]=[s[0]??l,s[1]??l],u=r(this,_,bi),b=R(this.min),f=R(this.max);if(this.error?r(this,Ee).setValidity({customError:!0},this.error,d):this._startText.trim()&&!e?r(this,Ee).setValidity({badInput:!0},this.t("badStart",{pattern:r(this,_,dc)}),d):this._endText.trim()&&!t?r(this,Ee).setValidity({badInput:!0},this.t("badEnd",{pattern:r(this,_,dc)}),p):this.required&&(!e||!t)?r(this,Ee).setValidity({valueMissing:!0},this.t("required"),e?p:d):e&&t&&t<e?r(this,Ee).setValidity({badInput:!0},this.t("endBeforeStart"),p):e&&b&&e<b||t&&b&&t<b?r(this,Ee).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{date:u.medium(b)}),d):e&&f&&e>f||t&&f&&t>f?r(this,Ee).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{date:u.medium(f)}),p):e&&this.isUnavailable(this.start)||t&&this.isUnavailable(this.end)?r(this,Ee).setValidity({customError:!0},this.t("unavailable"),d):r(this,Ee).setValidity({}),r(this,rs).sync(),this.open&&r(this,Wt)&&(g(this,Wt,!1),this.renderRoot.querySelector('td[tabindex="0"]')?.focus()),this.open&&r(this,er)){g(this,er,!1);let x=this.renderRoot.querySelector(".r-months"),v=R(this._draftStart)??this._focus,k=x?.querySelector(`[data-month="${B(ze(v)).slice(0,7)}"]`),L=x?.querySelector(".r-week");x&&k&&(x.scrollTop=k.offsetTop-(L?.offsetHeight??0))}}render(){let e=r(this,_,bi),t=R(this.start),i=R(this.end),s=r(this,rs).message,l=[s&&`${r(this,Se)}-err`,this.helpText&&`${r(this,Se)}-help`].filter(Boolean).join(" "),d=this.getAttribute("aria-label"),p=this.label||d||"",u=this.open?r(this,_,Ip):[],[b,f,x]=r(this,_,oc)?[this._draftStart,this._draftEnd,this._draftPreset]:[this.start,this.end,this.preset],v=!r(this,Ke)&&!!x&&u.some(K=>K.key===x),k=K=>!r(this,Ke)&&(v?K.key===x:K.start===b&&K.end===f),L=r(this,Ke)||!u.some(k)&&!!(b||f),P=r(this,_,lc),U=K=>ic({id:P===1?r(this,Se):`${r(this,Se)}-m${K}`,fmt:e,firstDay:r(this,_,Qi),month:fe(this._view,K),focus:this._focus,min:R(this.min),max:R(this.max),isDisabled:Z=>this.isUnavailable(B(Z)),mark:Z=>a(this,_,pc).call(this,Z),note:Z=>{let zt=a(this,_,pc).call(this,Z);return zt==="start"?this.t("startNote"):zt==="end"?this.t("endNote"):""},onPick:Z=>a(this,_,qp).call(this,Z),onKey:r(this,gc),onMonth:Z=>{this._view=fe(this._view,Z),this._focus=Kt(fe(this._focus,Z),R(this.min),R(this.max)),a(this,_,Ga).call(this,this._focus)},previousLabel:this.t("previousMonth"),nextLabel:this.t("nextMonth"),onHover:Z=>{r(this,We)==="end"&&(this._hover=Z)},hideNav:P===1?void 0:K===0?"next":"previous"}),q=R(this._draftStart),O=R(this._draftEnd),be=r(this,We)==="end"&&this._draftStart?this.t("chooseEnd",{date:e.medium(R(this._draftStart))}):this.t("chooseStart"),G=K=>{let Z=K==="start"?this._startText:this._endText;return c`<input id="${r(this,Se)}-${K}" type="text" autocomplete="off" spellcheck="false"
|
|
939
943
|
.value=${ee(Z)} placeholder=${r(this,_,dc)}
|
|
940
944
|
aria-label=${K==="start"?this.startLabel||this.t("start"):this.endLabel||this.t("end")}
|
|
941
945
|
?required=${this.required} ?disabled=${this.disabled}
|
|
@@ -943,7 +947,7 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
943
947
|
@input=${zt=>{zt.stopPropagation();let $r=zt.target.value;K==="start"?this._startText=$r:this._endText=$r}}
|
|
944
948
|
@change=${()=>a(this,_,Ya).call(this,K)} @keydown=${r(this,Bp).call(this,K)} />`};return c`<div class="field" role="group" aria-labelledby=${this.label?`${r(this,Se)}-l`:h} aria-label=${!this.label&&d?d:h}>
|
|
945
949
|
${this.label?c`<span class="label" id="${r(this,Se)}-l" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>`:h}
|
|
946
|
-
${r(this,_,is)?a(this,_,
|
|
950
|
+
${r(this,_,is)?a(this,_,Cv).call(this,p,s,l):c`<div class="wrap">
|
|
947
951
|
<div class="box" part="box">
|
|
948
952
|
${G("start")}<span class="sep" aria-hidden="true">–</span>${G("end")}
|
|
949
953
|
<button type="button" class="trigger" part="trigger" ?disabled=${this.disabled}
|
|
@@ -973,10 +977,10 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
973
977
|
</div>`}
|
|
974
978
|
${s?c`<p class="error" id="${r(this,Se)}-err" role="alert">${s}</p>`:h}
|
|
975
979
|
${this.helpText?c`<p class="help" id="${r(this,Se)}-help">${this.helpText}</p>`:h}
|
|
976
|
-
</div>`}};Ja=new WeakMap,Ee=new WeakMap,rs=new WeakMap,Se=new WeakMap,Qa=new WeakMap,Za=new WeakMap,
|
|
980
|
+
</div>`}};Ja=new WeakMap,Ee=new WeakMap,rs=new WeakMap,Se=new WeakMap,Qa=new WeakMap,Za=new WeakMap,Ke=new WeakMap,en=new WeakMap,Wt=new WeakMap,er=new WeakMap,_=new WeakSet,is=function(){return this.variant==="report"},oc=function(){return this.confirm||r(this,_,is)},Pp=function(){return Wi(this,this.locale)},bi=function(){return Ha(r(this,_,Pp))},Qi=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?Ra(r(this,_,Pp)):(Math.trunc(e)%7+7)%7},Wa=function(){this._dStartText=a(this,_,Rt).call(this,this._draftStart),this._dEndText=a(this,_,Rt).call(this,this._draftEnd)},lc=function(){return Number(this.months)!==2||typeof matchMedia=="function"&&matchMedia("(max-width: 640px)").matches?1:2},Ga=function(e){let t=r(this,_,lc),i=ze(e);i<this._view?this._view=i:i>=fe(this._view,t)&&(this._view=fe(i,1-t))},sg=function(){let e=tc(this.presets);return e.length||!r(this,_,is)?e:b0},Ip=function(){return r(this,_,sg).flatMap(e=>{let t=Np(e,new Date,i=>this.t(i),r(this,_,Qi));return t?[{...t,key:typeof e=="string"?e:""}]:[]})},cc=function(){return r(this,_,sg).includes("custom")},We=new WeakMap,dc=function(){return wp(r(this,_,bi),{d:this.t("patternDay"),m:this.t("patternMonth"),y:this.t("patternYear")})},Rt=function(e){let t=R(e);return t?r(this,_,bi).short(t):e},vi=new WeakMap,_v=function(){this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},hc=function(e,t,i){let s=i??r(this,_,Ip).find(l=>l.key&&l.start===e&&l.end===t)?.key??"";s!==this.preset&&(g(this,Za,!0),this.preset=s),!(e===this.start&&t===this.end)&&(this.start=e,this.end=t,a(this,_,_v).call(this))},Ya=function(e){let t=(e==="start"?this._startText:this._endText).trim(),i=t?Na(t,r(this,_,bi)):"";t&&!i&&g(this,en,!0);let s=e==="start"?[i??"",this.end]:[this.start,i??""];a(this,_,hc).call(this,...s),i&&(e==="start"?this._startText=a(this,_,Rt).call(this,i):this._endText=a(this,_,Rt).call(this,i))},qp=function(e){let t=B(e);if(!this.isUnavailable(t)){if(this._draftPreset="",g(this,Ke,!0),r(this,We)==="start"||!this._draftStart||t<this._draftStart){this._draftStart=t,this._draftEnd="",g(this,We,"end"),this._focus=e,g(this,Wt,!0),a(this,_,Wa).call(this);return}if(this._draftEnd=t,a(this,_,Wa).call(this),g(this,We,"start"),r(this,_,oc)){this._focus=e,g(this,Wt,!0);return}this.open=!1,a(this,_,hc).call(this,this._draftStart,t,""),a(this,_,Xa).call(this)}},ag=function(e){if(r(this,_,oc)){this._draftStart=e.start,this._draftEnd=e.end,this._draftPreset=e.key,g(this,Ke,!1),g(this,We,"start");let t=R(e.end);this._focus=Kt(t,R(this.min),R(this.max)),a(this,_,Ga).call(this,R(e.start)),a(this,_,Ga).call(this,t),g(this,er,!0),a(this,_,Wa).call(this);return}this.open=!1,a(this,_,hc).call(this,e.start,e.end,e.key),a(this,_,Xa).call(this)},ng=function(){g(this,Ke,!0),this._draftPreset="",g(this,We,"start"),g(this,Wt,!0),this.requestUpdate()},og=function(){!this._draftStart||!this._draftEnd||(this.open=!1,a(this,_,hc).call(this,this._draftStart,this._draftEnd,r(this,Ke)?"":this._draftPreset||void 0),a(this,_,Xa).call(this))},lg=function(e){let t=(e==="start"?this._dStartText:this._dEndText).trim(),i=t?Na(t,r(this,_,bi)):"";if(i===null||i&&this.isUnavailable(i)){this.requestUpdate();return}g(this,Ke,!0),this._draftPreset="",e==="start"?(this._draftStart=i,i&&this._draftEnd&&this._draftEnd<i&&(this._draftEnd="")):i&&this._draftStart&&i<this._draftStart?(this._draftEnd=this._draftStart,this._draftStart=i):this._draftEnd=i,g(this,We,this._draftStart&&!this._draftEnd?"end":"start");let s=R(i);s&&(this._focus=s,g(this,er,e==="start")),a(this,_,Wa).call(this)},Op=function(e){let t=(e==="start"?this._dStartText:this._dEndText).trim();if(!t)return!1;let i=Na(t,r(this,_,bi));return!i||this.isUnavailable(i)},cg=function(){this.open=!1,a(this,_,Xa).call(this)},Xa=function(){this.renderRoot.querySelector(".trigger")?.focus()},uc=new WeakMap,Bp=new WeakMap,gc=new WeakMap,fc=new WeakMap,bc=new WeakMap,pc=function(e){let t=B(e),i=this._draftStart,s=this._draftEnd||(r(this,We)==="end"&&i?B(this._hover??this._focus):"");return t===i?"start":t===s&&s>i?"end":i&&s&&t>i&&t<s?"in-range":""},mc=function(e,t,i){let s=R(e),l=R(t);if(!s)return"";let d=new Intl.DateTimeFormat(r(this,_,Pp),{day:"numeric",month:"short",...i?{year:"numeric"}:{}}),p=d.formatRange;return(!l||+s==+l?d.format(s):p?p.call(d,s,l):`${d.format(s)} \u2013 ${d.format(l)}`).replace(/[\u202f\u2009\u00a0]/g," ")},Tv=function(){let e=[new Date,R(this._draftStart),R(this._draftEnd),this._focus].filter(p=>!!p).map(Number),t=fe(ze(new Date(Math.min(...e))),-12),i=fe(ze(new Date(Math.max(...e))),2),s=R(this.min),l=R(this.max);s&&ze(s)>t&&(t=ze(s)),l&&ze(l)<i&&(i=ze(l)),t>i&&(t=i);let d=[];for(let p=t;p<=i&&d.length<600;p=fe(p,1))d.push(p);return d},Cv=function(e,t,i){let s=r(this,_,bi),l=R(this.start),d=R(this.end),p=this.open?r(this,_,Ip):[],[u,b,f]=[this._draftStart,this._draftEnd,this._draftPreset],x=!r(this,Ke)&&!!f&&p.some(X=>X.key===f),v=X=>!r(this,Ke)&&(x?X.key===f:X.start===u&&X.end===b),k=r(this,Ke)||!p.some(v)&&!!(u||b),L=new Date().getFullYear(),P=this.preset&&this.preset!=="custom"?Np(this.preset,new Date,X=>this.t(X),r(this,_,Qi))?.label??"":l&&d&&r(this,_,cc)?this.t("custom"):"",U=l&&d?a(this,_,mc).call(this,this.start,this.end,!0):"",q=Array.from({length:7},(X,St)=>(St+r(this,_,Qi))%7),O=R(u),be=R(b),G=O&&be?Math.round((+be-+O)/864e5)+1:0,K=r(this,We)==="end"&&u?this.t("chooseEnd",{date:s.medium(O)}):this.t("chooseStart"),Z=l&&d?this.t(e?"changeFor":"change",{label:e,start:s.long(l),end:s.long(d)}):this.t(e?"chooseFor":"choose",{label:e}),zt=X=>{let St=a(this,_,Op).call(this,X);return c`<label class="r-in"><span>${X==="start"?this.startLabel||this.t("start"):this.endLabel||this.t("end")}</span>
|
|
977
981
|
<input id="${r(this,Se)}-d${X}" type="text" autocomplete="off" spellcheck="false" placeholder=${r(this,_,dc)}
|
|
978
982
|
.value=${ee(X==="start"?this._dStartText:this._dEndText)} aria-invalid=${St?"true":h}
|
|
979
|
-
@input=${pe=>{pe.stopPropagation();let
|
|
983
|
+
@input=${pe=>{pe.stopPropagation();let Ve=pe.target.value;X==="start"?this._dStartText=Ve:this._dEndText=Ve}}
|
|
980
984
|
@change=${pe=>{pe.stopPropagation(),a(this,_,lg).call(this,X)}}
|
|
981
985
|
@keydown=${pe=>{pe.key==="Enter"&&(pe.preventDefault(),a(this,_,lg).call(this,X))}} /></label>`},$r=X=>c`<li>
|
|
982
986
|
<button type="button" class="preset" data-preset=${X.key||h} aria-pressed=${v(X)?"true":"false"} @click=${()=>a(this,_,ag).call(this,X)}>
|
|
@@ -1002,7 +1006,7 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
1002
1006
|
<div class="r-inputs">${zt("start")}<span class="sep" aria-hidden="true">–</span>${zt("end")}</div>
|
|
1003
1007
|
<div class="r-months" part="months">
|
|
1004
1008
|
<div class="r-week" aria-hidden="true">${q.map(X=>c`<span>${s.weekdaysShort[X]}</span>`)}</div>
|
|
1005
|
-
${r(this,_,
|
|
1009
|
+
${r(this,_,Tv).map(X=>{let St=B(X).slice(0,7);return c`<div class="r-month" data-month=${St}>${ic({id:`${r(this,Se)}-${St}`,fmt:s,firstDay:r(this,_,Qi),month:X,focus:this._focus,head:"title",min:R(this.min),max:R(this.max),isDisabled:pe=>this.isUnavailable(B(pe)),mark:pe=>a(this,_,pc).call(this,pe),note:pe=>{let Ve=a(this,_,pc).call(this,pe);return Ve==="start"?this.t("startNote"):Ve==="end"?this.t("endNote"):""},onPick:pe=>a(this,_,qp).call(this,pe),onKey:r(this,gc),onMonth:()=>{},previousLabel:this.t("previousMonth"),nextLabel:this.t("nextMonth"),onHover:pe=>{r(this,We)==="end"&&(this._hover=pe)}})}</div>`})}
|
|
1006
1010
|
</div>
|
|
1007
1011
|
<p class="status vh" aria-live="polite">${K}</p>
|
|
1008
1012
|
</div>
|
|
@@ -1013,7 +1017,7 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
1013
1017
|
<button type="button" class="act primary" ?disabled=${!O||!be||a(this,_,Op).call(this,"start")||a(this,_,Op).call(this,"end")} @click=${()=>a(this,_,og).call(this)}>${this.t("apply")}</button>
|
|
1014
1018
|
</div>`:h}
|
|
1015
1019
|
</div>
|
|
1016
|
-
</div>`},Zi.formAssociated=!0,Zi.shadowRootOptions={...A.shadowRootOptions,delegatesFocus:!0},Zi.properties={label:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},startName:{attribute:"start-name"},endName:{attribute:"end-name"},start:{},end:{},min:{},max:{},locale:{noAccessor:!0},firstDayOfWeek:{type:Number,attribute:"first-day-of-week"},disabledDates:{attribute:"disabled-dates",converter:Da},isDateDisabled:{attribute:!1},presets:{converter:Da},preset:{reflect:!0},months:{type:Number,reflect:!0},confirm:{type:Boolean,reflect:!0},variant:{reflect:!0},_dStartText:{state:!0},_dEndText:{state:!0},startLabel:{attribute:"start-label",string:"start"},endLabel:{attribute:"end-label",string:"end"},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},size:{reflect:!0},_startText:{state:!0},_endText:{state:!0},_focus:{state:!0},_draftStart:{state:!0},_draftEnd:{state:!0},_hover:{state:!0},_view:{state:!0},_draftPreset:{state:!0}},Zi.styles=[E,
|
|
1020
|
+
</div>`},Zi.formAssociated=!0,Zi.shadowRootOptions={...A.shadowRootOptions,delegatesFocus:!0},Zi.properties={label:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},startName:{attribute:"start-name"},endName:{attribute:"end-name"},start:{},end:{},min:{},max:{},locale:{noAccessor:!0},firstDayOfWeek:{type:Number,attribute:"first-day-of-week"},disabledDates:{attribute:"disabled-dates",converter:Da},isDateDisabled:{attribute:!1},presets:{converter:Da},preset:{reflect:!0},months:{type:Number,reflect:!0},confirm:{type:Boolean,reflect:!0},variant:{reflect:!0},_dStartText:{state:!0},_dEndText:{state:!0},startLabel:{attribute:"start-label",string:"start"},endLabel:{attribute:"end-label",string:"end"},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},size:{reflect:!0},_startText:{state:!0},_endText:{state:!0},_focus:{state:!0},_draftStart:{state:!0},_draftEnd:{state:!0},_hover:{state:!0},_view:{state:!0},_draftPreset:{state:!0}},Zi.styles=[E,Ie,Pa,kp,w`
|
|
1017
1021
|
:host([data-cm-invalid]) .box { border-color: var(--cm-border-critical); }
|
|
1018
1022
|
.sep { flex: none; color: var(--cm-text-tertiary); }
|
|
1019
1023
|
input { flex: 0 1 6.6em; }
|
|
@@ -1122,7 +1126,7 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
1122
1126
|
.r-presets { flex: none; }
|
|
1123
1127
|
.r-months { flex-basis: min(312px, 40vh); }
|
|
1124
1128
|
}
|
|
1125
|
-
`];$("cm-date-range-picker",Zi);var
|
|
1129
|
+
`];$("cm-date-range-picker",Zi);var AE=z("timePicker",{showTimes:"Show times",times:"Times",timesFor:"Times for {label}",patternHour:"hh",patternMinute:"mm",badInput:"Enter a time like {pattern}.",required:"Enter or choose a time.",rangeUnderflow:"Choose {time} or later.",rangeOverflow:"Choose {time} or earlier.",stepMismatch:{one:"Choose a time on the minute.",other:"Choose a time in steps of {count} minutes."}}),sn,De,ss,$t,an,nn,yi,F,zv,tr,tn,Sv,dg,rn,Fp,Lv,hg,Av,Vp,jp,pg,Up,Kp,Wp,vc,ir=class extends C{constructor(){super(...arguments);m(this,F);this.label="";this.helpText="";this.error="";this.name="";this.value="";this.placeholder="";this.min="";this.max="";this.step=1;this.hourCycle="";m(this,sn,"");this.required=!1;this.disabled=!1;this.open=!1;this.size="default";this._text="";this._active=-1;m(this,De,this.attachInternals());m(this,ss,new re(this,r(this,De)));m(this,$t,N("cm-tp"));m(this,an,null);m(this,nn,!1);m(this,yi,new xe);m(this,Up,e=>{let t=r(this,F,Fp);switch(e.key){case"ArrowDown":case"ArrowUp":{if(e.preventDefault(),!this.open){this.show();return}if(!t.length)return;let i=e.key==="ArrowDown"?1:-1;this._active=this._active<0?0:Math.min(t.length-1,Math.max(0,this._active+i));return}case"PageDown":case"PageUp":if(!this.open||!t.length)return;e.preventDefault(),this._active=Math.min(t.length-1,Math.max(0,this._active+(e.key==="PageDown"?6:-6)));return;case"Enter":this.open&&this._active>=0&&t[this._active]!==void 0?(e.preventDefault(),a(this,F,pg).call(this,t[this._active])):(this.open=!1,a(this,F,jp).call(this));return;case"Escape":this.open&&(e.preventDefault(),e.stopPropagation(),this.open=!1);return;case"Tab":this.open=!1;return;default:}});m(this,Kp,e=>{if(e.stopPropagation(),this._text=e.target.value,this.open){let t=Qr(this._text,r(this,F,tr));t&&(this._active=a(this,F,hg).call(this,t))}});m(this,Wp,()=>{this.disabled||(this.open?this.open=!1:(a(this,F,jp).call(this),this.show()),this.renderRoot.querySelector("input")?.focus())});m(this,vc,e=>{this.open&&!e.composedPath().includes(this)&&(this.open=!1)})}get locale(){return r(this,sn)}set locale(e){let t=r(this,sn);g(this,sn,e??""),this.requestUpdate("locale",t)}get valueAsNumber(){return ke(this.value)}connectedCallback(){super.connectedCallback(),r(this,an)===null&&g(this,an,this.value),document.addEventListener("pointerdown",r(this,vc),!0)}disconnectedCallback(){super.disconnectedCallback(),r(this,yi).close(),document.removeEventListener("pointerdown",r(this,vc),!0)}get form(){return r(this,De).form}get validity(){return r(this,De).validity}get validationMessage(){return r(this,De).validationMessage}checkValidity(){return r(this,De).checkValidity()}reportValidity(){return r(this,ss).report(()=>r(this,De).reportValidity())}formResetCallback(){this.value=r(this,an)??"",this._text=a(this,F,rn).call(this,this.value),this.open=!1,r(this,ss).reset()}formDisabledCallback(e){this.disabled=e,e&&(this.open=!1)}formStateRestoreCallback(e){this.value=e??""}show(){this.disabled||(this._active=a(this,F,hg).call(this,ke(this.value)!==null?this.value:Qr(this._text,r(this,F,tr))??a(this,F,Lv).call(this)),this.open=!0)}close(){this.open=!1}willUpdate(e){e.has("value")&&!r(this,nn)?this._text=a(this,F,rn).call(this,this.value):(e.has("locale")||e.has("hourCycle"))&&ke(this.value)!==null&&(this._text=a(this,F,rn).call(this,this.value)),g(this,nn,!1)}updated(e){this.open&&!r(this,yi).active?r(this,yi).open(this.renderRoot.querySelector(".pop"),this.renderRoot.querySelector(".box"),{align:"stretch",gap:4}):!this.open&&r(this,yi).active?r(this,yi).close():this.open&&r(this,yi).place(),this.open&&a(this,F,Av).call(this,e.has("open"));let t=ke(this.value);r(this,De).setFormValue(t===null?null:this.value,this.value);let i=this.renderRoot.querySelector("input")??void 0,s=ke(this.min),l=ke(this.max),d=r(this,F,tr);this.error?r(this,De).setValidity({customError:!0},this.error,i):this._text.trim()&&t===null?r(this,De).setValidity({badInput:!0},this.t("badInput",{pattern:r(this,F,dg)}),i):this.required&&t===null?r(this,De).setValidity({valueMissing:!0},this.t("required"),i):t!==null&&s!==null&&t<s?r(this,De).setValidity({rangeUnderflow:!0},this.t("rangeUnderflow",{time:d.format(s)}),i):t!==null&&l!==null&&t>l?r(this,De).setValidity({rangeOverflow:!0},this.t("rangeOverflow",{time:d.format(l)}),i):t!==null&&t%r(this,F,tn)?r(this,De).setValidity({stepMismatch:!0},this.t("stepMismatch",{count:r(this,F,tn)}),i):r(this,De).setValidity({}),r(this,ss).sync()}render(){let e=r(this,F,tr),t=r(this,ss).message,i=[t&&`${r(this,$t)}-err`,this.helpText&&`${r(this,$t)}-help`].filter(Boolean).join(" "),s=this.getAttribute("aria-label"),l=this.label||s||"",d=this.open?r(this,F,Fp):[],p=ke(this.value),u=`${r(this,$t)}-list`;return c`<div class="field">
|
|
1126
1130
|
${this.label?c`<label class="label" for="${r(this,$t)}-in" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</label>`:h}
|
|
1127
1131
|
<div class="wrap">
|
|
1128
1132
|
<div class="box" part="box">
|
|
@@ -1148,7 +1152,7 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
1148
1152
|
</div>
|
|
1149
1153
|
${t?c`<p class="error" id="${r(this,$t)}-err" role="alert">${t}</p>`:h}
|
|
1150
1154
|
${this.helpText?c`<p class="help" id="${r(this,$t)}-help">${this.helpText}</p>`:h}
|
|
1151
|
-
</div>`}};sn=new WeakMap,De=new WeakMap,ss=new WeakMap,$t=new WeakMap,an=new WeakMap,nn=new WeakMap,yi=new WeakMap,F=new WeakSet,
|
|
1155
|
+
</div>`}};sn=new WeakMap,De=new WeakMap,ss=new WeakMap,$t=new WeakMap,an=new WeakMap,nn=new WeakMap,yi=new WeakMap,F=new WeakSet,zv=function(){return Wi(this,this.locale)},tr=function(){return Aa(r(this,F,zv),this.hourCycle)},tn=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=720?e:1},Sv=function(){let e=Math.trunc(Number(this.interval));return e>=1&&e<=720?e:r(this,F,tn)>=5?r(this,F,tn):30},dg=function(){return xp(r(this,F,tr),{h:this.t("patternHour"),m:this.t("patternMinute")})},rn=function(e){let t=ke(e);return t===null?"":r(this,F,tr).format(t)},Fp=function(){let e=ke(this.min)??0,t=ke(this.max)??1439,i=r(this,F,Sv),s=r(this,F,tn),l=[];for(let d=Math.ceil(e/i)*i;d<=t&&l.length<1440;d+=i)d%s===0&&l.push(d);return l},Lv=function(){let e=new Date;return hi(e.getHours()*60+e.getMinutes())},hg=function(e){let t=r(this,F,Fp);if(!t.length)return-1;let i=ke(e);if(i===null)return 0;let s=t.findIndex(l=>l>=i);return s===-1?t.length-1:s},Av=function(e){let t=this.renderRoot.querySelector("[role=listbox]"),i=this.renderRoot.querySelector("[role=option].active");if(!t||!i)return;let s=i.offsetTop-t.offsetTop,l=s+i.offsetHeight;e?t.scrollTop=s-(t.clientHeight-i.offsetHeight)/2:s<t.scrollTop?t.scrollTop=s:l>t.scrollTop+t.clientHeight&&(t.scrollTop=l-t.clientHeight)},Vp=function(e){e!==this.value&&(this.value=e,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))},jp=function(){let e=this._text.trim(),t=e?Qr(e,r(this,F,tr)):"";if(t===null){g(this,nn,!0),a(this,F,Vp).call(this,""),this.requestUpdate();return}a(this,F,Vp).call(this,t),this._text=a(this,F,rn).call(this,t)},pg=function(e){let t=hi(e);this.open=!1,a(this,F,Vp).call(this,t),this._text=a(this,F,rn).call(this,t),this.renderRoot.querySelector("input")?.focus()},Up=new WeakMap,Kp=new WeakMap,Wp=new WeakMap,vc=new WeakMap,ir.formAssociated=!0,ir.shadowRootOptions={...A.shadowRootOptions,delegatesFocus:!0},ir.properties={label:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},placeholder:{},min:{},max:{},step:{type:Number},interval:{type:Number},hourCycle:{attribute:"hour-cycle"},locale:{noAccessor:!0},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},size:{reflect:!0},_text:{state:!0},_active:{state:!0}},ir.styles=[E,Ie,Pa,ha,w`
|
|
1152
1156
|
:host([data-cm-invalid]) .box { border-color: var(--cm-border-critical); }
|
|
1153
1157
|
:host { max-width: 100%; }
|
|
1154
1158
|
.pop {
|
|
@@ -1162,17 +1166,17 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
1162
1166
|
[role='option'][aria-selected='true'] { background: var(--cm-action-primary); color: var(--cm-action-primary-text); }
|
|
1163
1167
|
[role='option'][aria-selected='true'].active { background: var(--cm-action-primary-hover); }
|
|
1164
1168
|
input { font-variant-numeric: tabular-nums; }
|
|
1165
|
-
`];$("cm-time-picker",ir);var
|
|
1169
|
+
`];$("cm-time-picker",ir);var qE=z("fileUpload",{prompt:"Drag files here or {browse}",browse:"Browse",drop:"Drop files to upload",uploading:"Uploading {name}",cancel:"Cancel uploading {name}",cancelShort:"Cancel",addMore:"Add more",files:"Chosen files",remove:"Remove {name}",kilobytes:"{size} KB",megabytes:"{size} MB",required:"Please choose a file.",wrongType:"{name} is not an allowed file type",tooLarge:"{name} is larger than {size}",tooMany:"You can add up to {max} files",takePhoto:"Take a photo",retake:"Retake",removePhoto:"Remove",retakeName:"Retake {name}",removeName:"Remove {name}",photo:"photo"});function v0(o,n){if(!n.trim())return!0;let e=o.name.toLowerCase(),t=o.type.toLowerCase();return n.split(",").map(i=>i.trim().toLowerCase()).filter(Boolean).some(i=>i.startsWith(".")?e.endsWith(i):i.endsWith("/*")?t.startsWith(i.slice(0,-1)):t===i)}var ct,xi,de,wi,j,yc,mg,Gp,Yp,ug,gg,fg,bg,as,Dv,Rv,vg,Hv,Nv,rr=class extends C{constructor(){super(...arguments);m(this,j);this.label="";this.hint="";this.name="";this.accept="";this.multiple=!1;this.maxSize=0;this.maxFiles=0;this.required=!1;this.disabled=!1;this.error="";this.files=[];this._rejected="";this._progress=new Map;this._fileErrors=new Map;this._over=!1;m(this,ct,this.attachInternals());m(this,xi,new re(this,r(this,ct)));m(this,de,N("cm-fu"));m(this,wi,new Map)}get form(){return r(this,ct).form}get validity(){return r(this,ct).validity}get validationMessage(){return r(this,ct).validationMessage}checkValidity(){return r(this,ct).checkValidity()}reportValidity(){return r(this,xi).report(()=>r(this,ct).reportValidity())}formResetCallback(){r(this,xi).reset(),this.files=[],this._rejected="",this._progress=new Map,this._fileErrors=new Map}formDisabledCallback(e){this.disabled=e}disconnectedCallback(){super.disconnectedCallback();for(let e of r(this,wi).values())URL.revokeObjectURL(e);r(this,wi).clear()}updated(e){if(e.has("files"))for(let[l,d]of r(this,wi))this.files.includes(l)||(URL.revokeObjectURL(d),r(this,wi).delete(l));let t=new FormData;for(let l of this.files)t.append(this.name||"file",l);r(this,ct).setFormValue(this.files.length?t:null);let i=(r(this,j,yc)&&this.files.length?this.renderRoot.querySelector(".retake"):this.renderRoot.querySelector("input"))??void 0,s=this.error||this._rejected;s?r(this,ct).setValidity({customError:!0},s,i):this.required&&!this.files.length?r(this,ct).setValidity({valueMissing:!0},this.t("required"),i):r(this,ct).setValidity({}),r(this,xi).sync()}addFiles(e){let t=[...e],i=[],s=[],l=[];for(let p of t)v0(p,r(this,j,mg))?this.maxSize&&p.size>this.maxSize?(s.push(p),l.push(this.t("tooLarge",{name:p.name,size:a(this,j,Yp).call(this,this.maxSize)}))):i.push(p):(s.push(p),l.push(this.t("wrongType",{name:p.name})));let d=r(this,j,Gp)?[...this.files,...i]:i.slice(-1);!r(this,j,Gp)&&!i.length&&(d=this.files),r(this,j,Gp)&&this.maxFiles&&d.length>this.maxFiles&&(s.push(...d.slice(this.maxFiles)),l.push(this.t("tooMany",{max:this.maxFiles})),d=d.slice(0,this.maxFiles)),this._rejected=l.join(". "),s.length&&this.dispatchEvent(new CustomEvent("cm-reject",{bubbles:!0,composed:!0,detail:{files:s}})),d!==this.files&&(d.length!==this.files.length||d.some((p,u)=>p!==this.files[u]))&&(this.files=d,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}setProgress(e,t){let i=new Map(this._progress);t==null?i.delete(e):i.set(e,Math.min(100,Math.max(0,Number(t)||0))),this._progress=i}setFileError(e,t){let i=new Map(this._fileErrors);t?i.set(e,t):i.delete(e),this._fileErrors=i}removeFile(e){this.files.includes(e)&&(this.files=this.files.filter(t=>t!==e),this._rejected="",this._progress.has(e)&&this.setProgress(e,null),this._fileErrors.has(e)&&this.setFileError(e,""),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.updateComplete.then(()=>this.renderRoot.querySelector("input")?.focus()))}render(){if(r(this,j,yc))return a(this,j,Nv).call(this);let e=this.error||this._rejected||r(this,xi).message,t=!this.files.length||this.multiple,i=this.files.length>0;return c`
|
|
1166
1170
|
${this.label||this.hint&&i?c`<div class="head">
|
|
1167
1171
|
${this.label?c`<span class="label" id="${r(this,de)}-l" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>`:h}
|
|
1168
1172
|
${this.hint&&i?c`<span class="hint" id="${r(this,de)}-hint">${this.hint}</span>`:h}
|
|
1169
1173
|
</div>`:h}
|
|
1170
1174
|
${i?c`<ul class="grid" part="files" role="list" style="list-style:none;margin:0;padding:0" aria-label=${this.t("files")}>
|
|
1171
|
-
${this.files.map(s=>a(this,j,
|
|
1175
|
+
${this.files.map(s=>a(this,j,Rv).call(this,s))}
|
|
1172
1176
|
${t?c`<li>${a(this,j,vg).call(this,!0)}</li>`:h}
|
|
1173
1177
|
</ul>`:a(this,j,vg).call(this,!1)}
|
|
1174
1178
|
${e?c`<p class="msg" id="${r(this,de)}-msg" role="alert">${e}</p>`:h}
|
|
1175
|
-
`}};ct=new WeakMap,xi=new WeakMap,de=new WeakMap,wi=new WeakMap,j=new WeakSet,yc=function(){return this.variant==="photo"},mg=function(){return this.accept||(r(this,j,yc)?"image/*":"")},Gp=function(){return this.multiple&&!r(this,j,yc)},Yp=function(e){return e>=1024*1024?this.t("megabytes",{size:this.formatNumber(+(e/1024/1024).toFixed(1),{useGrouping:!1})}):this.t("kilobytes",{size:this.formatNumber(Math.max(1,Math.round(e/1024)),{useGrouping:!1})})},ug=function(e){let t=r(this,wi).get(e);return t||(t=URL.createObjectURL(e),r(this,wi).set(e,t)),t},gg=function(e){return this._progress.has(e)},fg=function(e){let t=this.dispatchEvent(new CustomEvent("cm-cancel",{detail:{file:e},bubbles:!0,composed:!0,cancelable:!0}));this.setProgress(e,null),t&&this.removeFile(e)},bg=function(e){e.stopPropagation();let t=e.target;this.addFiles(t.files??[]),t.value=""},as=function(e){this.toggleAttribute("data-over",e),this._over=e},
|
|
1179
|
+
`}};ct=new WeakMap,xi=new WeakMap,de=new WeakMap,wi=new WeakMap,j=new WeakSet,yc=function(){return this.variant==="photo"},mg=function(){return this.accept||(r(this,j,yc)?"image/*":"")},Gp=function(){return this.multiple&&!r(this,j,yc)},Yp=function(e){return e>=1024*1024?this.t("megabytes",{size:this.formatNumber(+(e/1024/1024).toFixed(1),{useGrouping:!1})}):this.t("kilobytes",{size:this.formatNumber(Math.max(1,Math.round(e/1024)),{useGrouping:!1})})},ug=function(e){let t=r(this,wi).get(e);return t||(t=URL.createObjectURL(e),r(this,wi).set(e,t)),t},gg=function(e){return this._progress.has(e)},fg=function(e){let t=this.dispatchEvent(new CustomEvent("cm-cancel",{detail:{file:e},bubbles:!0,composed:!0,cancelable:!0}));this.setProgress(e,null),t&&this.removeFile(e)},bg=function(e){e.stopPropagation();let t=e.target;this.addFiles(t.files??[]),t.value=""},as=function(e){this.toggleAttribute("data-over",e),this._over=e},Dv=function(){if(this._over)return this.t("drop");let[e,t]=this.prompt.split("{browse}");return t===void 0?e:c`${e}<span class="browse">${this.t("browse")}</span>${t}`},Rv=function(e){let t=a(this,j,gg).call(this,e),i=this._fileErrors.get(e)??"",s=`${r(this,de)}-e${this.files.indexOf(e)}`,l=this._progress.get(e)??0;return c`<li class="item"><div class="file ${t?"busy":""} ${i?"invalid":""}">
|
|
1176
1180
|
${e.type.startsWith("image/")?c`<img src=${a(this,j,ug).call(this,e)} alt=${e.name} />`:c`<div class="doc"><cm-icon name="book" size="24"></cm-icon><span class="name">${e.name}</span><span class="size">${a(this,j,Yp).call(this,e.size)}</span></div>`}
|
|
1177
1181
|
${t?c`<div class="bar" part="progress" role="progressbar" aria-label=${this.t("uploading",{name:e.name})}
|
|
1178
1182
|
aria-valuemin="0" aria-valuemax="100" aria-valuenow=${Math.round(l)}><span style="inline-size:${l}%"></span></div>`:h}
|
|
@@ -1186,8 +1190,8 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
1186
1190
|
aria-describedby=${i||h} aria-invalid=${t?"true":h}
|
|
1187
1191
|
@change=${a(this,j,bg)} @cancel=${s=>s.stopPropagation()} />
|
|
1188
1192
|
${e?c`<cm-icon name="plus" size="24"></cm-icon><span id="${r(this,de)}-p">${this.t("addMore")}</span>`:c`<span class="ico"><cm-icon name="upload" size="20"></cm-icon></span>
|
|
1189
|
-
<span class="words"><span id="${r(this,de)}-p">${a(this,j,
|
|
1190
|
-
</label>`},
|
|
1193
|
+
<span class="words"><span id="${r(this,de)}-p">${a(this,j,Dv).call(this)}</span>${this.hint?c`<span class="hint" id="${r(this,de)}-hint">${this.hint}</span>`:h}</span>`}
|
|
1194
|
+
</label>`},Hv=function(){this.renderRoot.querySelector("input[type=file]")?.click()},Nv=function(){let e=this.files[0],t=this.error||this._rejected||e&&this._fileErrors.get(e)||r(this,xi).message,i=!!e&&a(this,j,gg).call(this,e),s=this.label||this.t("photo"),l=[this.hint&&`${r(this,de)}-hint`,t&&`${r(this,de)}-msg`].filter(Boolean).join(" "),d=u=>c`<input type="file" id=${r(this,de)} accept=${r(this,j,mg)} capture=${this.capture||h}
|
|
1191
1195
|
?disabled=${this.disabled} ?required=${this.required&&!e} tabindex=${u?"-1":h} aria-hidden=${u?"true":h}
|
|
1192
1196
|
?hidden=${u} aria-labelledby=${u?h:`${r(this,de)}-p`} aria-describedby=${!u&&l||h} aria-invalid=${t?"true":h}
|
|
1193
1197
|
@change=${a(this,j,bg)} @cancel=${b=>b.stopPropagation()} />`,p=this.hint?c`<span class="hint" id="${r(this,de)}-hint">${this.hint}</span>`:h;return c`
|
|
@@ -1201,7 +1205,7 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
1201
1205
|
${this.disabled?h:i?c`<div class="actions" part="actions">
|
|
1202
1206
|
<button type="button" class="action" aria-label=${this.t("cancel",{name:s})} @click=${()=>a(this,j,fg).call(this,e)}><cm-icon name="close" size="16"></cm-icon>${this.t("cancelShort")}</button>
|
|
1203
1207
|
</div>`:c`<div class="actions" part="actions">
|
|
1204
|
-
<button type="button" class="action retake" aria-label=${this.t("retakeName",{name:s})} aria-describedby=${t?`${r(this,de)}-msg`:h} @click=${a(this,j,
|
|
1208
|
+
<button type="button" class="action retake" aria-label=${this.t("retakeName",{name:s})} aria-describedby=${t?`${r(this,de)}-msg`:h} @click=${a(this,j,Hv)}><cm-icon name="camera" size="16"></cm-icon>${this.t("retake")}</button>
|
|
1205
1209
|
<button type="button" class="action" aria-label=${this.t("removeName",{name:s})} @click=${()=>this.removeFile(e)}><cm-icon name="trash" size="16"></cm-icon>${this.t("removePhoto")}</button>
|
|
1206
1210
|
</div>`}`:c`<label class="zone photo ${t?"invalid":""}" part="zone photo"
|
|
1207
1211
|
@dragenter=${()=>a(this,j,as).call(this,!0)} @dragleave=${()=>a(this,j,as).call(this,!1)} @drop=${()=>a(this,j,as).call(this,!1)}>
|
|
@@ -1295,7 +1299,7 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
1295
1299
|
@media (max-width: 640px) {
|
|
1296
1300
|
.label { font-size: var(--cm-type-heading-sm-resp-size); }
|
|
1297
1301
|
}
|
|
1298
|
-
`];$("cm-file-upload",rr);var $i=(o,n,e)=>Math.min(e,Math.max(n,o)),ns=(o,n=0)=>{let e=10**n;return Math.round(o*e)/e};function ls(o){let n=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(o.trim());return n?`#${(n[1].length===3?[...n[1]].map(t=>t+t).join(""):n[1]).toLowerCase()}`:null}function Xp(o,n){let e=/^(-?\d*\.?\d+(?:e-?\d+)?)(%)?$/i.exec(o.trim());if(!e)return null;let t=parseFloat(e[1]);return e[2]?t/100*n:t}function
|
|
1302
|
+
`];$("cm-file-upload",rr);var $i=(o,n,e)=>Math.min(e,Math.max(n,o)),ns=(o,n=0)=>{let e=10**n;return Math.round(o*e)/e};function ls(o){let n=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(o.trim());return n?`#${(n[1].length===3?[...n[1]].map(t=>t+t).join(""):n[1]).toLowerCase()}`:null}function Xp(o,n){let e=/^(-?\d*\.?\d+(?:e-?\d+)?)(%)?$/i.exec(o.trim());if(!e)return null;let t=parseFloat(e[1]);return e[2]?t/100*n:t}function Iv(o){let n=/^(-?\d*\.?\d+)(deg|turn|rad|grad)?$/i.exec(o.trim());if(!n)return null;let e=parseFloat(n[1]),t=(n[2]??"deg").toLowerCase();return((t==="turn"?e*360:t==="rad"?e*180/Math.PI:t==="grad"?e*.9:e)%360+360)%360}function y0(o){let n=o.trim(),e;if(n.includes(","))e=n.split(",").map(t=>t.trim());else{let[t,i]=n.split("/").map(s=>s.trim());e=t.split(/\s+/),i!==void 0&&e.push(i)}return e.length===3||e.length===4?e:null}function qe(o){let n=(o??"").trim().toLowerCase();if(!n)return null;if(n==="transparent")return{r:0,g:0,b:0,a:0};let e=/^#?([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.exec(n);if(e){let u=e[1];u.length<=4&&(u=[...u].map(f=>f+f).join(""));let b=f=>parseInt(u.slice(f,f+2),16);return{r:b(0),g:b(2),b:b(4),a:u.length===8?ns(b(6)/255,3):1}}let t=/^(rgba?|hsla?)\((.*)\)$/.exec(n);if(!t)return null;let i=y0(t[2]);if(!i)return null;let s=i[3]===void 0?1:Xp(i[3],1);if(s===null)return null;if(t[1].startsWith("rgb")){let[u,b,f]=i.slice(0,3).map(x=>Xp(x,255));return u===null||b===null||f===null?null:{r:$i(Math.round(u),0,255),g:$i(Math.round(b),0,255),b:$i(Math.round(f),0,255),a:$i(ns(s,3),0,1)}}let l=Iv(i[0]),d=Xp(i[1].endsWith("%")?i[1]:`${i[1]}%`,100),p=Xp(i[2].endsWith("%")?i[2]:`${i[2]}%`,100);return l===null||d===null||p===null?null:{...$c({h:l,s:$i(d,0,100),l:$i(p,0,100),a:1}),a:$i(ns(s,3),0,1)}}function Qp({r:o,g:n,b:e,a:t}){let i=o/255,s=n/255,l=e/255,d=Math.max(i,s,l),p=Math.min(i,s,l),u=d-p,b=0;return u&&(b=d===i?(s-l)/u%6:d===s?(l-i)/u+2:(i-s)/u+4),{h:(b*60+360)%360,s:d?u/d*100:0,v:d*100,a:t}}function Zp({h:o,s:n,v:e,a:t}){let i=n/100,s=e/100,l=d=>{let p=(d+o/60)%6;return s-s*i*Math.max(0,Math.min(p,4-p,1))};return{r:Math.round(l(5)*255),g:Math.round(l(3)*255),b:Math.round(l(1)*255),a:t}}function wc({r:o,g:n,b:e,a:t}){let i=o/255,s=n/255,l=e/255,d=Math.max(i,s,l),p=Math.min(i,s,l),u=d-p,b=(d+p)/2,f=u?u/(1-Math.abs(2*b-1)):0;return{h:Qp({r:o,g:n,b:e,a:t}).h,s:f*100,l:b*100,a:t}}function $c({h:o,s:n,l:e,a:t}){let i=n/100,s=e/100,l=u=>(u+o/30)%12,d=i*Math.min(s,1-s),p=u=>s-d*Math.max(-1,Math.min(l(u)-3,9-l(u),1));return{r:Math.round(p(0)*255),g:Math.round(p(8)*255),b:Math.round(p(4)*255),a:t}}var Jp=o=>Math.round(o).toString(16).padStart(2,"0"),xc=({r:o,g:n,b:e})=>`#${Jp(o)}${Jp(n)}${Jp(e)}`;function cs(o,n="hex"){let e=ns($i(o.a,0,1),2),t=e<1;if(n==="rgb")return t?`rgba(${o.r}, ${o.g}, ${o.b}, ${e})`:`rgb(${o.r}, ${o.g}, ${o.b})`;if(n==="hsl"){let{h:i,s,l}=wc(o),d=`${Math.round(i)}, ${Math.round(s)}%, ${Math.round(l)}%`;return t?`hsla(${d}, ${e})`:`hsl(${d})`}return t?`${xc(o)}${Jp(e*255)}`:xc(o)}function x0(o){let n=[],e=0,t=0;for(let i=0;i<o.length;i++)o[i]==="("?e++:o[i]===")"?e--:o[i]===","&&e===0&&(n.push(o.slice(t,i).trim()),t=i+1);return n.push(o.slice(t).trim()),n}var Pv={"to top":0,"to top right":45,"to right top":45,"to right":90,"to bottom right":135,"to right bottom":135,"to bottom":180,"to bottom left":225,"to left bottom":225,"to left":270,"to top left":315,"to left top":315};function Ht(o){let n=/^(linear|radial)-gradient\((.*)\)$/i.exec((o??"").trim());if(!n)return null;let e=n[1].toLowerCase(),t=x0(n[2]),i=180,s=t[0]?.toLowerCase().replace(/\s+/g," ")??"";if(e==="linear"){let p=Iv(s);p!==null&&/[a-z]/.test(s)?(i=p,t.shift()):s in Pv&&(i=Pv[s],t.shift())}else/^(circle|ellipse|closest|farthest|at )/.test(s)&&!qe(s.split(" ")[0])&&t.shift();let l=t.map(p=>{let u=/^(.*?)(?:\s+(-?\d*\.?\d+)%)?$/.exec(p);return{color:qe(u[1]),position:u[2]===void 0?void 0:$i(parseFloat(u[2]),0,100)}});if(l.length<2||l.some(p=>!p.color))return null;let d=l.map((p,u)=>({color:p.color,position:p.position??ns(u/(l.length-1)*100,1)}));return{type:e,angle:Math.round(i),stops:d}}function os(o,n="hex"){let e=[...o.stops].sort((t,i)=>t.position-i.position).map(t=>`${cs(t.color,n)} ${ns(t.position,1)}%`).join(", ");return o.type==="radial"?`radial-gradient(circle, ${e})`:`linear-gradient(${Math.round(o.angle)}deg, ${e})`}function qv(o,n){let e=[...o.stops].sort((t,i)=>t.position-i.position);if(n<=e[0].position)return{...e[0].color};for(let t=1;t<e.length;t++)if(n<=e[t].position){let i=e[t-1],s=e[t],l=(n-i.position)/(s.position-i.position||1),d=(p,u)=>p+(u-p)*l;return{r:Math.round(d(i.color.r,s.color.r)),g:Math.round(d(i.color.g,s.color.g)),b:Math.round(d(i.color.b,s.color.b)),a:ns(d(i.color.a,s.color.a),2)}}return{...e[e.length-1].color}}function kc(o,n){let e=qe(o),t=qe(n);if(e&&t)return e.r===t.r&&e.g===t.g&&e.b===t.b&&Math.abs(e.a-t.a)<.005;let i=Ht(o),s=Ht(n);return!!i&&!!s&&os(i)===os(s)}var yg=o=>!!qe(o)||!!Ht(o);var on=16;function em(o,n,e=16){let t=n.trim().toLowerCase();return[n.trim(),...o.filter(i=>i.trim().toLowerCase()!==t)].slice(0,e)}function xg(o="default",n=16){let e=`cm-recent-colors:${o}`,t=()=>{try{let i=JSON.parse(localStorage.getItem(e)??"[]");return Array.isArray(i)?i.filter(s=>typeof s=="string").slice(0,n):[]}catch{return[]}};return{recentColors:async()=>t(),async addRecentColor(i){let s=em(t(),i,n);try{localStorage.setItem(e,JSON.stringify(s))}catch{}return s}}}function w0(o){let n=o.baseUrl.replace(/\/+$/,""),e=async(t,i={})=>{let s=typeof o.headers=="function"?await o.headers():o.headers??{},l=await(o.fetch??fetch)(`${n}${t}`,{credentials:o.credentials??"same-origin",...i,headers:{Accept:"application/json",...i.body?{"Content-Type":"application/json"}:{},...s}});if(!l.ok)throw new Error(`Colour API ${t}: HTTP ${l.status}`);let d=await l.json();return Array.isArray(d?.colors)?d.colors:[]};return{brandColors:()=>e("/brand-colors"),recentColors:async()=>(await e("/recent-colors")).filter(t=>typeof t=="string"),addRecentColor:async t=>(await e("/recent-colors",{method:"POST",body:JSON.stringify({color:t})})).filter(i=>typeof i=="string")}}var XE=z("colorPicker",{label:"Colour picker",solid:"Solid",gradient:"Gradient",area:"Saturation and brightness",areaValue:"Saturation {s}%, brightness {v}%",hue:"Hue",opacity:"Opacity",format:"Colour format",hex:"Hex",rgb:"RGB",hsl:"HSL",red:"Red",green:"Green",blue:"Blue",saturation:"Saturation",lightness:"Lightness",eyedropper:"Pick a colour from the screen",gradientType:"Gradient type",linear:"Linear",radial:"Radial",angle:"Angle",stops:"Gradient stops",stop:"Stop {n}, {color} at {position}%",addStop:"Add stop",removeStop:"Remove stop",brand:"Brand colours",recent:"Recent",palette:"Palette",swatch:"{name}, {value}"}),Ov=["#000000","#707070","#c9c9c9","#de0000","#ad5500","#f1a953","#ffc107","#81bb47","#3c7c00","#5394d9","#2e6faf","#446beb"].map(o=>({value:o})),$0=["hex","rgb","hsl"],wg=o=>(o??[]).flatMap(n=>{let e=typeof n=="string"?{value:n}:n;return e&&typeof e.value=="string"&&(qe(e.value)||Ht(e.value))?[{value:e.value.trim(),name:e.name}]:[]}),sm,Tc,dn,Cc,ki,T,$g,kg,Bv,sr,ds,dt,Eg,Mg,_g,Fv,Vv,Ec,jv,Tg,Cg,Uv,tm,zg,Kv,Mc,im,_c,Sg,Wv,Gv,Yv,ln,Lg,Xv,Jv,rm,Qv,cn=class extends C{constructor(){super(...arguments);m(this,T);this.value="";this.format="hex";this.formats="hex rgb hsl";this.alpha=!1;this.gradient=!1;this.recentKey="";this.maxRecent=16;this.eyedropper=!0;this.disabled=!1;this._hsva={h:0,s:0,v:0,a:1};this._grad=null;this._stop=0;this._brand=[];this._recent=[];this._drafts={};m(this,sm,N("cm-cp"));m(this,Tc);m(this,dn);m(this,Cc);m(this,ki,null)}connectedCallback(){super.connectedCallback(),a(this,T,kg).call(this)}get allowedFormats(){let e=String(this.formats??"").split(/[\s,]+/).filter(t=>$0.includes(t));return e.length?e:["hex"]}get palette(){return this.swatches?wg(this.swatches):Ov}get brand(){return this.brandColors?wg(this.brandColors):this._brand}get recent(){return(this.recentColors??this._recent).filter(t=>qe(t)||this.gradient&&Ht(t)).filter(t=>this.alpha||(qe(t)?.a??1)===1).slice(0,this.maxRecent||16)}willUpdate(e){e.has("recentKey")&&g(this,Cc,void 0),(e.has("source")||e.has("recentKey"))&&a(this,T,kg).call(this),e.has("format")&&!this.allowedFormats.includes(this.format)&&(this.format=this.allowedFormats[0]),e.has("value")&&this.value!==r(this,Tc)&&a(this,T,Bv).call(this)}render(){let{h:e,s:t,v:i,a:s}=this._hsva,l=r(this,T,ds),d=xc(l),p=this.allowedFormats,u=this._grad,b=this.matches(":dir(rtl)"),f=this.eyedropper&&typeof window<"u"&&"EyeDropper"in window,x=u?os({...u,type:"linear",angle:b?270:90}):"";return c`<div class="panel" role="group" aria-label=${this.getAttribute("aria-label")||this.t("label")}>
|
|
1299
1303
|
${this.gradient?c`<div class="tabs" role="radiogroup" aria-label=${this.t("label")}>
|
|
1300
1304
|
<button type="button" role="radio" aria-checked=${u?"false":"true"} tabindex=${u?"-1":"0"} @click=${()=>a(this,T,Mc).call(this,!1)}
|
|
1301
1305
|
@keydown=${v=>{v.key.startsWith("Arrow")&&(v.preventDefault(),a(this,T,Mc).call(this,!0),this.updateComplete.then(()=>this.renderRoot.querySelectorAll(".tabs button")[1]?.focus()))}}>${this.t("solid")}</button>
|
|
@@ -1312,20 +1316,20 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
1312
1316
|
<button type="button" class="icon-btn" aria-label=${this.t("removeStop")} title=${this.t("removeStop")} ?disabled=${u.stops.length<=2}
|
|
1313
1317
|
@click=${()=>a(this,T,Lg).call(this,this._stop)}><cm-icon name="trash" size="16"></cm-icon></button>
|
|
1314
1318
|
</div>
|
|
1315
|
-
<div class="bar checker" role="group" aria-label=${this.t("stops")} @pointerdown=${a(this,T,
|
|
1319
|
+
<div class="bar checker" role="group" aria-label=${this.t("stops")} @pointerdown=${a(this,T,Wv)}>
|
|
1316
1320
|
<span class="fill" style="background:${x}"></span>
|
|
1317
1321
|
${u.stops.map((v,k)=>c`<button type="button" class="handle" role="slider" aria-orientation="horizontal"
|
|
1318
1322
|
aria-valuemin="0" aria-valuemax="100" aria-valuenow=${Math.round(v.position)}
|
|
1319
1323
|
aria-label=${this.t("stop",{n:k+1,color:cs(v.color,this.format),position:Math.round(v.position)})}
|
|
1320
1324
|
aria-current=${k===this._stop?"true":"false"} style="inset-inline-start:${v.position}%;background:${cs(v.color)}"
|
|
1321
|
-
@pointerdown=${L=>a(this,T,
|
|
1325
|
+
@pointerdown=${L=>a(this,T,Gv).call(this,L,k)} @pointermove=${L=>a(this,T,Yv).call(this,L,k)}
|
|
1322
1326
|
@pointerup=${a(this,T,Ec)} @pointercancel=${a(this,T,Ec)} @focus=${()=>{this._stop!==k&&a(this,T,_c).call(this,k)}}
|
|
1323
|
-
@keydown=${L=>a(this,T,
|
|
1327
|
+
@keydown=${L=>a(this,T,Xv).call(this,L,k)}></button>`)}
|
|
1324
1328
|
</div>`:h}
|
|
1325
1329
|
<div class="area" part="area" tabindex="0" role="slider" aria-label=${this.t("area")}
|
|
1326
1330
|
aria-valuetext=${this.t("areaValue",{s:Math.round(t),v:Math.round(i)})} aria-valuenow=${Math.round(t)} aria-valuemin="0" aria-valuemax="100"
|
|
1327
1331
|
style="background-color:hsl(${e} 100% 50%)"
|
|
1328
|
-
@pointerdown=${a(this,T,
|
|
1332
|
+
@pointerdown=${a(this,T,Fv)} @pointermove=${a(this,T,Vv)} @pointerup=${a(this,T,Ec)} @pointercancel=${a(this,T,Ec)} @keydown=${a(this,T,jv)}>
|
|
1329
1333
|
<span class="thumb" style="left:${b?100-t:t}%;top:${100-i}%;background:${d}"></span>
|
|
1330
1334
|
</div>
|
|
1331
1335
|
<div class="sliders">
|
|
@@ -1340,21 +1344,21 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
1340
1344
|
</div>
|
|
1341
1345
|
</div>
|
|
1342
1346
|
<div class="row">
|
|
1343
|
-
${p.length>1?c`<select aria-label=${this.t("format")} @change=${a(this,T,
|
|
1347
|
+
${p.length>1?c`<select aria-label=${this.t("format")} @change=${a(this,T,Uv)}>
|
|
1344
1348
|
${p.map(v=>c`<option value=${v} ?selected=${v===this.format} .selected=${ee(v===this.format)}>${this.t(v)}</option>`)}
|
|
1345
1349
|
</select>`:h}
|
|
1346
|
-
${a(this,T,
|
|
1347
|
-
${f?c`<button type="button" class="icon-btn" aria-label=${this.t("eyedropper")} title=${this.t("eyedropper")} @click=${a(this,T,
|
|
1350
|
+
${a(this,T,Qv).call(this)}
|
|
1351
|
+
${f?c`<button type="button" class="icon-btn" aria-label=${this.t("eyedropper")} title=${this.t("eyedropper")} @click=${a(this,T,Kv)}>
|
|
1348
1352
|
<cm-icon name="eyedropper" size="16"></cm-icon></button>`:h}
|
|
1349
1353
|
</div>
|
|
1350
1354
|
${a(this,T,rm).call(this,"brand",this.brand)}
|
|
1351
1355
|
${a(this,T,rm).call(this,"recent",this.recent.map(v=>({value:v})))}
|
|
1352
1356
|
${a(this,T,rm).call(this,"palette",this.palette)}
|
|
1353
|
-
</div>`}};sm=new WeakMap,Tc=new WeakMap,dn=new WeakMap,Cc=new WeakMap,ki=new WeakMap,T=new WeakSet,$g=function(){if(this.source)return this.source;if(this.recentKey)return r(this,Cc)??g(this,Cc,xg(this.recentKey))},kg=async function(){let e=a(this,T,$g).call(this);if(!e||e===r(this,dn))return;g(this,dn,e);let[t,i]=await Promise.allSettled([e.brandColors?.()??Promise.resolve([]),e.recentColors?.()??Promise.resolve([])]);r(this,dn)===e&&(t.status==="fulfilled"&&Array.isArray(t.value)&&(this._brand=wg(t.value)),i.status==="fulfilled"&&Array.isArray(i.value)&&(this._recent=i.value.filter(s=>typeof s=="string")))},
|
|
1357
|
+
</div>`}};sm=new WeakMap,Tc=new WeakMap,dn=new WeakMap,Cc=new WeakMap,ki=new WeakMap,T=new WeakSet,$g=function(){if(this.source)return this.source;if(this.recentKey)return r(this,Cc)??g(this,Cc,xg(this.recentKey))},kg=async function(){let e=a(this,T,$g).call(this);if(!e||e===r(this,dn))return;g(this,dn,e);let[t,i]=await Promise.allSettled([e.brandColors?.()??Promise.resolve([]),e.recentColors?.()??Promise.resolve([])]);r(this,dn)===e&&(t.status==="fulfilled"&&Array.isArray(t.value)&&(this._brand=wg(t.value)),i.status==="fulfilled"&&Array.isArray(i.value)&&(this._recent=i.value.filter(s=>typeof s=="string")))},Bv=function(){let e=(this.value??"").trim(),t=this.gradient?Ht(e):null;if(t)this._grad=t,this._stop=Math.min(this._stop,t.stops.length-1),a(this,T,sr).call(this,t.stops[this._stop].color);else{this._grad=null;let i=qe(e);i&&a(this,T,sr).call(this,i)}/^rgba?\(/i.test(e)&&this.allowedFormats.includes("rgb")?this.format="rgb":/^hsla?\(/i.test(e)&&this.allowedFormats.includes("hsl")&&(this.format="hsl"),this._drafts={}},sr=function(e){let t=Qp(e);(t.s===0||t.v===0)&&(t.h=this._hsva.h),t.v===0&&(t.s=this._hsva.s),this._hsva={...t,a:this.alpha?e.a:1}},ds=function(){return Zp(this._hsva)},dt=function(e=!1){let t;if(this._grad){let s=this._grad.stops.map((l,d)=>d===this._stop?{...l,color:r(this,T,ds)}:l);this._grad={...this._grad,stops:s},t=os(this._grad,this.format)}else t=cs(r(this,T,ds),this.format);let i=t!==this.value;g(this,Tc,t),this.value=t,i&&a(this,T,Eg).call(this,"input"),e&&a(this,T,Mg).call(this)},Eg=function(e){this.dispatchEvent(new Event(e,{bubbles:!0,composed:!0}))},Mg=function(){a(this,T,Eg).call(this,"change");let e=this.value;if(!e||[...this.brand,...this.palette].some(l=>kc(l.value,e)))return;let t=this.recentColors??this._recent;if(t[0]&&kc(t[0],e))return;let i=em(t,e,Math.max(this.maxRecent||16,16));this._recent=i,this.dispatchEvent(new CustomEvent("cm-recent-change",{detail:{colors:i},bubbles:!0,composed:!0})),a(this,T,$g).call(this)?.addRecentColor?.(e)?.then(l=>{Array.isArray(l)&&(this._recent=l)}).catch(()=>{})},_g=function(e){let t=e.currentTarget.getBoundingClientRect(),i=Math.min(1,Math.max(0,(e.clientX-t.left)/t.width)),s=Math.min(1,Math.max(0,(e.clientY-t.top)/t.height)),l=getComputedStyle(this).direction==="rtl";this._hsva={...this._hsva,s:(l?1-i:i)*100,v:(1-s)*100},a(this,T,dt).call(this)},Fv=function(e){if(e.button!==0)return;let t=e.currentTarget;try{t.setPointerCapture(e.pointerId)}catch{}t.focus(),g(this,ki,"area"),a(this,T,_g).call(this,e)},Vv=function(e){r(this,ki)==="area"&&a(this,T,_g).call(this,e)},Ec=function(){r(this,ki)!==null&&(g(this,ki,null),a(this,T,Mg).call(this))},jv=function(e){let t=e.shiftKey?10:1,i=getComputedStyle(this).direction==="rtl",{s,v:l}=this._hsva;if(e.key==="ArrowRight")s+=i?-t:t;else if(e.key==="ArrowLeft")s+=i?t:-t;else if(e.key==="ArrowUp")l+=t;else if(e.key==="ArrowDown")l-=t;else if(e.key==="Home")s=0;else if(e.key==="End")s=100;else if(e.key==="PageUp")l=100;else if(e.key==="PageDown")l=0;else return;e.preventDefault(),this._hsva={...this._hsva,s:Math.min(100,Math.max(0,s)),v:Math.min(100,Math.max(0,l))},a(this,T,dt).call(this,!0)},Tg=function(e,t){e.stopPropagation(),this._hsva={...this._hsva,h:Number(e.target.value)},a(this,T,dt).call(this,t)},Cg=function(e,t){e.stopPropagation(),this._hsva={...this._hsva,a:Number(e.target.value)/100},a(this,T,dt).call(this,t)},Uv=function(e){e.stopPropagation(),this.format=e.target.value,this._drafts={},this.value&&a(this,T,dt).call(this,!0)},tm=function(e,t,i){e.stopPropagation();let s=e.target.value,l=a(this,T,zg).call(this,t,s);if(!l){this._drafts={...this._drafts,[t]:s};return}this._drafts=i?{}:{...this._drafts,[t]:s},a(this,T,sr).call(this,l),a(this,T,dt).call(this,i)},zg=function(e,t){let i=r(this,T,ds);if(e==="hex"){let d=t.trim();if(!/^#?([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(d))return null;let p=qe(d);return p&&(this.alpha&&/^#?[0-9a-f]{8}$/i.test(d)?p:{...p,a:this._hsva.a})}let s=Number(t);if(t.trim()===""||!Number.isFinite(s))return null;if(e==="a")return s>=0&&s<=100?{...i,a:s/100}:null;if(e==="r"||e==="g"||e==="b")return s>=0&&s<=255?{...i,[e]:Math.round(s)}:null;let l=wc(i);return e==="h"?s>=0&&s<=360?$c({...l,h:s%360,a:i.a}):null:(e==="s"||e==="l")&&s>=0&&s<=100?$c({...l,[e]:s,a:i.a}):null},Kv=async function(){let e=window.EyeDropper;if(e)try{let{sRGBHex:t}=await new e().open(),i=qe(t);if(!i)return;a(this,T,sr).call(this,{...i,a:this._hsva.a}),a(this,T,dt).call(this,!0)}catch{}},Mc=function(e){if(e!==!!this._grad){if(e){let t=r(this,T,ds),i=Zp({...this._hsva,h:(this._hsva.h+60)%360,s:Math.max(this._hsva.s,40),v:Math.max(this._hsva.v,60)});this._grad={type:"linear",angle:90,stops:[{color:t,position:0},{color:i,position:100}]},this._stop=0}else this._grad=null;a(this,T,dt).call(this,!0)}},im=function(e,t=!0){this._grad&&(this._grad={...this._grad,...e},a(this,T,dt).call(this,t))},_c=function(e){this._grad&&(this._stop=e,a(this,T,sr).call(this,this._grad.stops[e].color),this._drafts={})},Sg=function(e,t){let i=t.getBoundingClientRect(),s=Math.min(1,Math.max(0,(e.clientX-i.left)/i.width));return Math.round((getComputedStyle(this).direction==="rtl"?1-s:s)*100)},Wv=function(e){if(!this._grad||e.button!==0||e.target.closest(".handle"))return;let t=a(this,T,Sg).call(this,e,e.currentTarget),i=qv(this._grad,t),s=[...this._grad.stops,{color:i,position:t}];this._grad={...this._grad,stops:s},a(this,T,_c).call(this,s.length-1),a(this,T,dt).call(this,!0),this.updateComplete.then(()=>this.renderRoot.querySelectorAll(".handle")[s.length-1]?.focus())},Gv=function(e,t){if(e.button===0){e.stopPropagation();try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}a(this,T,_c).call(this,t),g(this,ki,t)}},Yv=function(e,t){if(r(this,ki)!==t||!this._grad)return;let i=this.renderRoot.querySelector(".bar");a(this,T,ln).call(this,t,a(this,T,Sg).call(this,e,i),!1)},ln=function(e,t,i){if(!this._grad)return;let s=this._grad.stops.map((l,d)=>d===e?{...l,position:Math.min(100,Math.max(0,t))}:l);a(this,T,im).call(this,{stops:s},i)},Lg=function(e){if(!this._grad||this._grad.stops.length<=2)return;let t=this._grad.stops.filter((i,s)=>s!==e);this._grad={...this._grad,stops:t},a(this,T,_c).call(this,Math.min(e,t.length-1)),a(this,T,dt).call(this,!0),this.updateComplete.then(()=>this.renderRoot.querySelectorAll(".handle")[this._stop]?.focus())},Xv=function(e,t){if(!this._grad)return;let i=e.shiftKey?10:1,s=getComputedStyle(this).direction==="rtl",l=this._grad.stops[t].position;if(e.key==="ArrowRight"||e.key==="ArrowUp")a(this,T,ln).call(this,t,l+(s&&e.key==="ArrowRight"?-i:i),!0);else if(e.key==="ArrowLeft"||e.key==="ArrowDown")a(this,T,ln).call(this,t,l-(s&&e.key==="ArrowLeft"?-i:i),!0);else if(e.key==="Home")a(this,T,ln).call(this,t,0,!0);else if(e.key==="End")a(this,T,ln).call(this,t,100,!0);else if(e.key==="Delete"||e.key==="Backspace")a(this,T,Lg).call(this,t);else return;e.preventDefault()},Jv=function(e){let t=Ht(e);if(t&&this.gradient)this._grad=t,this._stop=0,a(this,T,sr).call(this,t.stops[0].color);else{let i=qe(e);if(!i)return;this._grad=null,a(this,T,sr).call(this,i)}this._drafts={},a(this,T,dt).call(this,!0)},rm=function(e,t){if(!t.length)return h;let i=`${r(this,sm)}-${e}`;return c`<div class="group" role="group" aria-labelledby=${i}>
|
|
1354
1358
|
<h3 id=${i}>${this.t(e)}</h3>
|
|
1355
1359
|
<div class="sws">${t.map(s=>{let l=s.name?this.t("swatch",{name:s.name,value:s.value}):s.value,d=!!this.value&&kc(s.value,this.value);return c`<button type="button" class="sw checker" part="swatch" aria-pressed=${d?"true":"false"} aria-label=${l} title=${s.name||s.value}
|
|
1356
|
-
@click=${()=>a(this,T,
|
|
1357
|
-
</div>`},
|
|
1360
|
+
@click=${()=>a(this,T,Jv).call(this,s.value)}><span style="background:${s.value}"></span></button>`})}</div>
|
|
1361
|
+
</div>`},Qv=function(){let e=r(this,T,ds),t=this._drafts,i=this.format,s=(d,p,u,b=!0)=>c`<input class="box ${b?"num":""}"
|
|
1358
1362
|
type="text" inputmode=${b?"numeric":"text"} autocomplete="off" spellcheck="false" aria-label=${p}
|
|
1359
1363
|
.value=${ee(t[d]??String(u))} aria-invalid=${t[d]!==void 0&&!a(this,T,zg).call(this,d,t[d])?"true":h}
|
|
1360
1364
|
@input=${f=>a(this,T,tm).call(this,f,d,!1)} @change=${f=>a(this,T,tm).call(this,f,d,!0)}
|
|
@@ -1443,15 +1447,15 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
1443
1447
|
.sw[aria-pressed='true'] { box-shadow: 0 0 0 2px var(--cm-bg-surface), 0 0 0 4px var(--cm-border-strong); }
|
|
1444
1448
|
.sw:focus-visible { outline-offset: 4px; }
|
|
1445
1449
|
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
1446
|
-
`];$("cm-color-picker",cn);var
|
|
1450
|
+
`];$("cm-color-picker",cn);var oM=z("colorField",{swatch:"{name}, {hex}",hex:"Hex code",hexNamed:"{label}, hex code",placeholder:"#RRGGBB",picker:"Choose a custom colour",pickerNamed:"Choose a custom colour for {label}",required:"Please choose a colour.",invalid:"Enter a colour as #RRGGBB, for example #2e6faf.",invalidAny:"Enter a colour such as #2e6faf or rgb(46, 111, 175).",value:"Colour value",valueNamed:"{label}, colour value",black:"Black",grey:"Grey",lightGrey:"Light grey",red:"Red",darkOrange:"Dark orange",orange:"Orange",yellow:"Yellow",lightGreen:"Light green",green:"Green",lightBlue:"Light blue",blue:"Blue",indigo:"Indigo"}),k0=[{value:"#000000",key:"black"},{value:"#707070",key:"grey"},{value:"#c9c9c9",key:"lightGrey"},{value:"#de0000",key:"red"},{value:"#ad5500",key:"darkOrange"},{value:"#f1a953",key:"orange"},{value:"#ffc107",key:"yellow"},{value:"#81bb47",key:"lightGreen"},{value:"#3c7c00",key:"green"},{value:"#5394d9",key:"lightBlue"},{value:"#2e6faf",key:"blue"},{value:"#446beb",key:"indigo"}],E0={fromAttribute:o=>o===null?!1:o==="native"?"native":!0,toAttribute:o=>o==="native"?"native":o?"":null},M0=o=>{let n=parseInt(o.slice(1),16);return[n>>16&255,n>>8&255,n&255].map(e=>e/255).map(e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4).reduce((e,t,i)=>e+t*[.2126,.7152,.0722][i],0)};function _0(o){let n=M0(o);return(n+.05)/.05>=1.05/(n+.05)?"#000000":"#ffffff"}var it,ps,ms,kt,zc,us,V,hn,hs,Sc,Ei,Ag,Zv,ey,Dg,ty,iy,ry,sy,ay,ny,oy,ly,ar=class extends C{constructor(){super(...arguments);m(this,V);this.label="";this.hint="";this.helpText="";this.error="";this.name="";this.value="";this.picker=!1;this.alpha=!1;this.gradient=!1;this.formats="hex";this.recentKey="";this._open=!1;this.required=!1;this.disabled=!1;this._invalid=!1;m(this,it,this.attachInternals());m(this,ps,new xe);m(this,ms,new re(this,r(this,it)));m(this,kt,N("cm-cf"));m(this,zc,"");m(this,us);m(this,Sc,e=>{this._open&&!e.composedPath().includes(this)&&(this._open=!1)})}connectedCallback(){super.connectedCallback(),g(this,zc,a(this,V,hs).call(this,this.value)??this.value),document.addEventListener("pointerdown",r(this,Sc),!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("pointerdown",r(this,Sc),!0),r(this,ps).close()}show(){!this.disabled&&this.picker&&this.picker!=="native"&&(this._open=!0)}close(){this._open=!1}get form(){return r(this,it).form}get validity(){return r(this,it).validity}get validationMessage(){return r(this,it).validationMessage}checkValidity(){return r(this,it).checkValidity()}reportValidity(){return r(this,ms).report(()=>r(this,it).reportValidity())}formResetCallback(){r(this,ms).reset(),this.value=r(this,zc),this._draft=void 0,this._invalid=!1}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}get items(){return this.swatches?this.swatches.flatMap(e=>{let t=typeof e=="string"?{value:e}:e,i=ls(t?.value??"")??(r(this,V,hn)&&t?.value&&yg(t.value)?t.value.trim():null);return i?[{value:i,name:t.name}]:[]}):k0.map(e=>({value:e.value,name:this.t(e.key)}))}willUpdate(e){if(e.has("value")){let t=a(this,V,hs).call(this,this.value??"");t&&t!==this.value&&(this.value=t),this.hasUpdated&&this.value!==r(this,us)&&(this._draft=void 0,this._invalid=!1),g(this,us,void 0)}}updated(e){if(e.has("_open")){let s=this.renderRoot.querySelector(".pop");this._open?(r(this,ps).open(s,this.renderRoot.querySelector(".anchor"),{align:"start",gap:8})||s?.setAttribute("data-open",""),this.renderRoot.querySelector("cm-color-picker")?.updateComplete.then(()=>{this.renderRoot.querySelector("cm-color-picker")?.shadowRoot?.querySelector(".area")?.focus()})):e.get("_open")&&(r(this,ps).close(),s?.removeAttribute("data-open"))}else this._open&&r(this,ps).place();let t=!this.value||a(this,V,hs).call(this,this.value)!==null;r(this,it).setFormValue(this.value&&t?this.value:null,this.value);let i=this.renderRoot.querySelector(".input")??void 0;this.error?r(this,it).setValidity({customError:!0},this.error,i):this._invalid||!t?r(this,it).setValidity({patternMismatch:!0},this.t(r(this,V,hn)?"invalidAny":"invalid"),i):this.required&&!this.value?r(this,it).setValidity({valueMissing:!0},this.t("required"),i):r(this,it).setValidity({}),r(this,ms).sync()}render(){let e=this.items,t=a(this,V,hs).call(this,this.value??""),i=e.findIndex(x=>x.value===t),s=r(this,V,hn),l=this.error||(this._invalid||this.value&&!t?this.t(s?"invalidAny":"invalid"):"")||r(this,ms).message,d=t?ls(t):null,p=t?`background:${t}`:h,u=[l&&`${r(this,kt)}-err`,this.helpText&&`${r(this,kt)}-help`].filter(Boolean).join(" ")||h,b=this.getAttribute("aria-label"),f=this.label||b||"";return c`<div class="field">
|
|
1447
1451
|
${this.label?c`<span class="label" id="${r(this,kt)}-l" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}${this.hint?c`<span class="hint">[${this.hint}]</span>`:h}</span>`:h}
|
|
1448
1452
|
${e.length?c`<div class="swatches" part="swatches" role="radiogroup"
|
|
1449
1453
|
aria-labelledby=${this.label?`${r(this,kt)}-l`:h} aria-label=${!this.label&&b?b:h}
|
|
1450
1454
|
aria-required=${this.required?"true":h} aria-describedby=${u}>
|
|
1451
1455
|
${e.map((x,v)=>{let k=x.name?this.t("swatch",{name:x.name,hex:x.value}):x.value;return c`<button type="button" class="swatch" part="swatch" role="radio" aria-checked=${v===i?"true":"false"}
|
|
1452
1456
|
aria-label=${k} title=${x.name||x.value} tabindex=${v===(i>=0?i:0)?"0":"-1"} ?disabled=${this.disabled}
|
|
1453
|
-
style="background-color:${x.value};color:${
|
|
1454
|
-
@click=${()=>a(this,V,Ag).call(this,v)} @keydown=${L=>a(this,V,
|
|
1457
|
+
style="background-color:${x.value};color:${_0(x.value)}"
|
|
1458
|
+
@click=${()=>a(this,V,Ag).call(this,v)} @keydown=${L=>a(this,V,Zv).call(this,L,v)}><cm-icon name="check" size="16"></cm-icon></button>`})}
|
|
1455
1459
|
</div>`:h}
|
|
1456
1460
|
<div class="row">
|
|
1457
1461
|
${this.picker&&this.picker!=="native"?c`<span class="anchor"><button type="button" class="pick checker-bg" part="picker" ?disabled=${this.disabled}
|
|
@@ -1462,15 +1466,15 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
1462
1466
|
<cm-icon name="edit" size="12" aria-hidden="true"></cm-icon>
|
|
1463
1467
|
</button>
|
|
1464
1468
|
<div class="pop" id="${r(this,kt)}-pop" role="dialog" aria-label=${f?this.t("pickerNamed",{label:f}):this.t("picker")}
|
|
1465
|
-
@keydown=${a(this,V,
|
|
1466
|
-
${this._open?c`<cm-color-picker .value=${this.value} .format=${a(this,V,
|
|
1469
|
+
@keydown=${a(this,V,oy)}>
|
|
1470
|
+
${this._open?c`<cm-color-picker .value=${this.value} .format=${a(this,V,ly).call(this)} .formats=${this.formats} .alpha=${this.alpha}
|
|
1467
1471
|
.gradient=${this.gradient} .swatches=${this.swatches?this.items:void 0} .brandColors=${this.brandColors}
|
|
1468
1472
|
.recentColors=${this.recentColors} .source=${this.source} .recentKey=${this.recentKey}
|
|
1469
|
-
@input=${a(this,V,
|
|
1473
|
+
@input=${a(this,V,ay)} @change=${a(this,V,ny)}></cm-color-picker>`:h}
|
|
1470
1474
|
</div></span>`:this.picker?c`<label class="pick" part="picker" style=${d?`background-color:${d}`:h}>
|
|
1471
1475
|
<input type="color" .value=${ee(d??"#000000")} ?disabled=${this.disabled}
|
|
1472
1476
|
aria-label=${f?this.t("pickerNamed",{label:f}):this.t("picker")}
|
|
1473
|
-
@input=${a(this,V,
|
|
1477
|
+
@input=${a(this,V,ry)} @change=${a(this,V,sy)} />
|
|
1474
1478
|
<cm-icon name="edit" size="12" aria-hidden="true"></cm-icon>
|
|
1475
1479
|
</label>`:c`<span class="preview" part="preview" aria-hidden="true" style=${p}></span>`}
|
|
1476
1480
|
<input part="input" id=${r(this,kt)} type="text" inputmode="text" autocomplete="off" spellcheck="false"
|
|
@@ -1478,11 +1482,11 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
1478
1482
|
aria-label=${s?f?this.t("valueNamed",{label:f}):this.t("value"):f?this.t("hexNamed",{label:f}):this.t("hex")}
|
|
1479
1483
|
?required=${this.required} ?disabled=${this.disabled}
|
|
1480
1484
|
aria-invalid=${l?"true":h} aria-describedby=${u}
|
|
1481
|
-
@input=${a(this,V,
|
|
1485
|
+
@input=${a(this,V,ey)} @change=${a(this,V,ty)} @keydown=${a(this,V,iy)} />
|
|
1482
1486
|
</div>
|
|
1483
1487
|
${l?c`<p class="error" id="${r(this,kt)}-err" role="alert">${l}</p>`:h}
|
|
1484
1488
|
${this.helpText?c`<p class="help" id="${r(this,kt)}-help">${this.helpText}</p>`:h}
|
|
1485
|
-
</div>`}};
|
|
1489
|
+
</div>`}};it=new WeakMap,ps=new WeakMap,ms=new WeakMap,kt=new WeakMap,zc=new WeakMap,us=new WeakMap,V=new WeakSet,hn=function(){return this.alpha||this.gradient||/rgb|hsl/.test(this.formats??"")},hs=function(e){let t=(e??"").trim(),i=ls(t);if(i)return i;if(!r(this,V,hn))return null;if(/^#[0-9a-f]{4}$|^#[0-9a-f]{8}$/i.test(t))return this.alpha?t.toLowerCase():null;if(Ht(t))return this.gradient?t:null;let s=qe(t);return s&&(this.alpha||s.a===1)?t:null},Sc=new WeakMap,Ei=function(...e){for(let t of e)this.dispatchEvent(new Event(t,{bubbles:!0,composed:!0}))},Ag=function(e){let t=this.items[e];!t||this.disabled||(this.updateComplete.then(()=>this.renderRoot.querySelectorAll(".swatch")[e]?.focus()),this._draft=void 0,this._invalid=!1,t.value!==this.value&&(this.value=t.value,a(this,V,Ei).call(this,"input","change")))},Zv=function(e,t){let i=this.items.length,s=se(e,this),l;if(s==="ArrowRight"||e.key==="ArrowDown")l=(t+1)%i;else if(s==="ArrowLeft"||e.key==="ArrowUp")l=(t-1+i)%i;else if(e.key==="Home")l=0;else if(e.key==="End")l=i-1;else if(e.key===" "||e.key==="Enter")l=t;else return;e.preventDefault(),a(this,V,Ag).call(this,l)},ey=function(e){e.stopPropagation();let t=e.target.value;this._draft=t;let i=/^#?[0-9a-f]{6}$/i.test(t.trim())?ls(t):r(this,V,hn)&&/\)\s*$|^#[0-9a-f]{8}$/i.test(t.trim())?a(this,V,hs).call(this,t):null;i&&i!==this.value&&(g(this,us,i),this.value=i,a(this,V,Ei).call(this,"input")),this._invalid&&(i||!t.trim())&&(this._invalid=!1)},Dg=function(){if(this._draft===void 0)return;let e=this._draft.trim(),t=e?a(this,V,hs).call(this,e):"";if(t===null){this._invalid=!0;return}let i=this.value;this.value=t,this._draft=void 0,this._invalid=!1,t!==i&&a(this,V,Ei).call(this,"input"),a(this,V,Ei).call(this,"change")},ty=function(e){e.stopPropagation(),a(this,V,Dg).call(this)},iy=function(e){e.key==="Enter"&&a(this,V,Dg).call(this)},ry=function(e){e.stopPropagation();let t=ls(e.target.value);!t||t===this.value||(this.value=t,this._draft=void 0,this._invalid=!1,a(this,V,Ei).call(this,"input"))},sy=function(e){e.stopPropagation(),a(this,V,Ei).call(this,"change")},ay=function(e){e.stopPropagation();let t=e.target.value;t!==this.value&&(g(this,us,t),this.value=t,this._draft=void 0,this._invalid=!1,a(this,V,Ei).call(this,"input"))},ny=function(e){e.stopPropagation(),a(this,V,Ei).call(this,"change")},oy=function(e){e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),this._open=!1,this.updateComplete.then(()=>this.renderRoot.querySelector("button.pick")?.focus()))},ly=function(){let e=this.value??"";return/^rgba?\(|gradient\(.*rgba?\(/i.test(e)?"rgb":/^hsla?\(|gradient\(.*hsla?\(/i.test(e)?"hsl":"hex"},ar.formAssociated=!0,ar.shadowRootOptions={...A.shadowRootOptions,delegatesFocus:!0},ar.properties={label:{},hint:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},swatches:{type:Array},picker:{converter:E0,reflect:!0},alpha:{type:Boolean},gradient:{type:Boolean},formats:{},brandColors:{type:Array,attribute:"brand-colors"},recentColors:{type:Array,attribute:"recent-colors"},source:{attribute:!1},recentKey:{attribute:"recent-key"},_open:{state:!0},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},_draft:{state:!0},_invalid:{state:!0}},ar.styles=[E,bt,Ie,w`
|
|
1486
1490
|
:host { display: block; }
|
|
1487
1491
|
.swatches { display: flex; flex-wrap: wrap; gap: var(--cm-space-8); padding: 4px; margin: -4px; }
|
|
1488
1492
|
.swatch {
|
|
@@ -1535,18 +1539,18 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
1535
1539
|
.pop:not(:popover-open):not([data-open]) { display: none; }
|
|
1536
1540
|
.anchor { position: relative; }
|
|
1537
1541
|
:host([disabled]) .preview { opacity: 0.4; }
|
|
1538
|
-
`];$("cm-color-field",ar);var
|
|
1542
|
+
`];$("cm-color-field",ar);var gM=z("signatureField",{modes:"How to sign",draw:"Draw",type:"Type",pad:"Signature drawing area",padSigned:"Signature drawing area, signed",instructions:"Draw your signature with a mouse, finger or pen. To sign with the keyboard, choose Type.",signHere:"Sign here",typeLabel:"Type your full name",typePlaceholder:"Type your full name",undo:"Undo",undoLabel:"Undo last stroke",clear:"Clear",clearLabel:"Clear signature",cleared:"Signature cleared",undone:"Last stroke removed",required:"Please sign here."}),Rg=3,am=.7,T0=.0055,nm="#000000",cy=8,Lc=2,C0=400,z0=(o,n)=>({x:(o.x+n.x)/2,y:(o.y+n.y)/2,p:(o.p+n.p)/2}),ht,fs,Ac,pn,Dc,Et,Mt,_t,or,lr,Ge,Rc,cr,mn,D,Hg,om,Ng,Mi,lm,Pg,Ig,dy,qg,cm,Og,dm,hy,Bg,py,gs,hm,Fg,Vg,my,jg,uy,Ug,gy,fy,nr=class extends C{constructor(){super(...arguments);m(this,D);this.label="";this.hint="";this.helpText="";this.error="";this.name="";this.value="";this.mode="draw";this.typedName="";this.required=!1;this.disabled=!1;this._announce="";m(this,ht,this.attachInternals());m(this,fs,new re(this,r(this,ht)));m(this,Ac,N("cm-sig"));m(this,pn,"");m(this,Dc,"");m(this,Et,[]);m(this,Mt);m(this,_t);m(this,or,"");m(this,lr,0);m(this,Ge);m(this,Rc,"");m(this,cr);m(this,mn,0)}connectedCallback(){super.connectedCallback(),this.hasUpdated?a(this,D,Hg).call(this):(g(this,pn,this.value),g(this,Dc,this.typedName))}disconnectedCallback(){super.disconnectedCallback(),r(this,cr)?.disconnect(),g(this,cr,void 0),cancelAnimationFrame(r(this,lr)),g(this,lr,0),r(this,Ge)&&(clearTimeout(r(this,Ge)),g(this,Ge,void 0))}get form(){return r(this,ht).form}get validity(){return r(this,ht).validity}get validationMessage(){return r(this,ht).validationMessage}checkValidity(){return r(this,ht).checkValidity()}reportValidity(){return r(this,fs).report(()=>r(this,ht).reportValidity())}formResetCallback(){r(this,fs).reset(),g(this,Et,[]),g(this,Mt,void 0),g(this,_t,void 0),r(this,Ge)&&(clearTimeout(r(this,Ge)),g(this,Ge,void 0)),this.typedName=r(this,Dc),r(this,pn)?(g(this,or,""),this.value=r(this,pn)):this.updateComplete.then(()=>a(this,D,gs).call(this,!1)),a(this,D,Mi).call(this)}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}get empty(){return this.mode==="type"?!this.typedName.trim():!r(this,Et).length&&!r(this,_t)}toDataURL(){return a(this,D,Fg).call(this)?.toDataURL("image/png")??""}toBlob(){let e=a(this,D,Fg).call(this);return e?new Promise(t=>e.toBlob(t,"image/png")):Promise.resolve(null)}clear(){this.mode==="type"?this.typedName="":(g(this,Et,[]),g(this,Mt,void 0),g(this,_t,void 0),a(this,D,Mi).call(this)),a(this,D,gs).call(this,!0)}undo(){this.mode==="draw"&&(r(this,Et).length?r(this,Et).pop():g(this,_t,void 0),g(this,Mt,void 0),a(this,D,Mi).call(this),a(this,D,gs).call(this,!0))}willUpdate(e){if(e.has("value")&&(this.value??"")!==r(this,or)){let t=this.value??"";if(g(this,or,t),g(this,Et,[]),g(this,Mt,void 0),!t)g(this,_t,void 0),this.hasUpdated&&(this.typedName="");else{let i=new Image;i.addEventListener("load",()=>{r(this,_t)===i&&a(this,D,Mi).call(this)}),i.src=t,g(this,_t,i),this.mode="draw"}a(this,D,Mi).call(this)}else if(this.hasUpdated&&(e.has("mode")||e.has("typedName")&&this.mode==="type")){let t=this.empty?"":this.toDataURL();g(this,or,t),this.value=t}}firstUpdated(){a(this,D,Hg).call(this),this.typedName&&!this.value&&this.updateComplete.then(()=>a(this,D,gs).call(this,!1)),a(this,D,dm).call(this)}updated(e){e.has("mode")&&this.mode==="type"&&a(this,D,dm).call(this),r(this,ht).setFormValue(this.value||null,this.value);let t=(this.mode==="type"?this.renderRoot.querySelector(".typed"):this.renderRoot.querySelector('.tab[aria-selected="true"]'))??void 0;this.error?r(this,ht).setValidity({customError:!0},this.error,t):this.required&&this.empty?r(this,ht).setValidity({valueMissing:!0},this.t("required"),t):r(this,ht).setValidity({}),r(this,fs).sync()}render(){let e=r(this,Ac),t=this.getAttribute("aria-label"),i=r(this,fs).message,s=[i&&`${e}-err`,this.helpText&&`${e}-help`].filter(Boolean).join(" "),l=this.empty,d=!r(this,Et).length&&!r(this,_t),p=u=>c`<button type="button" role="tab" class="tab" id="${e}-tab-${u}"
|
|
1539
1543
|
aria-selected=${this.mode===u?"true":"false"} aria-controls="${e}-panel-${u}"
|
|
1540
1544
|
tabindex=${this.mode===u?"0":"-1"} ?disabled=${this.disabled}
|
|
1541
|
-
@click=${()=>a(this,D,Vg).call(this,u,!0)} @keydown=${a(this,D,
|
|
1545
|
+
@click=${()=>a(this,D,Vg).call(this,u,!0)} @keydown=${a(this,D,my)}>${this.t(u)}</button>`;return c`<div class="field">
|
|
1542
1546
|
${this.label?c`<span class="label" id="${e}-l" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}${this.hint?c`<span class="hint">[${this.hint}]</span>`:h}</span>`:h}
|
|
1543
1547
|
<div class="bar">
|
|
1544
1548
|
<div class="tabs" role="tablist" part="tabs"
|
|
1545
1549
|
aria-labelledby=${this.label?`${e}-l`:h}
|
|
1546
1550
|
aria-label=${this.label?h:t||this.t("modes")}>${p("draw")}${p("type")}</div>
|
|
1547
1551
|
<div class="actions">
|
|
1548
|
-
${this.mode==="draw"?c`<button type="button" class="act" part="undo" aria-label=${this.t("undoLabel")} ?disabled=${this.disabled||d} @click=${a(this,D,
|
|
1549
|
-
<button type="button" class="act" part="clear" aria-label=${this.t("clearLabel")} ?disabled=${this.disabled||l} @click=${a(this,D,
|
|
1552
|
+
${this.mode==="draw"?c`<button type="button" class="act" part="undo" aria-label=${this.t("undoLabel")} ?disabled=${this.disabled||d} @click=${a(this,D,gy)}>${this.t("undo")}</button>`:h}
|
|
1553
|
+
<button type="button" class="act" part="clear" aria-label=${this.t("clearLabel")} ?disabled=${this.disabled||l} @click=${a(this,D,fy)}>${this.t("clear")}</button>
|
|
1550
1554
|
</div>
|
|
1551
1555
|
</div>
|
|
1552
1556
|
<div class="panel panel-draw" role="tabpanel" id="${e}-panel-draw" aria-labelledby="${e}-tab-draw"
|
|
@@ -1556,7 +1560,7 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
1556
1560
|
${d?c`<span class="here" aria-hidden="true">${this.t("signHere")}</span>`:h}
|
|
1557
1561
|
<canvas part="canvas" role="img" aria-label=${d?this.t("pad"):this.t("padSigned")}
|
|
1558
1562
|
aria-describedby=${[`${e}-instr`,s].filter(Boolean).join(" ")}
|
|
1559
|
-
@pointerdown=${a(this,D,
|
|
1563
|
+
@pointerdown=${a(this,D,dy)} @pointermove=${a(this,D,qg)} @pointerup=${a(this,D,cm)} @pointercancel=${a(this,D,cm)}
|
|
1560
1564
|
@lostpointercapture=${a(this,D,cm)} @transitionend=${()=>a(this,D,lm).call(this)}></canvas>
|
|
1561
1565
|
</div>
|
|
1562
1566
|
<span class="vh" id="${e}-instr">${this.t("instructions")}</span>
|
|
@@ -1569,13 +1573,13 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
1569
1573
|
aria-label=${this.label?`${this.label}: ${this.t("typeLabel")}`:this.t("typeLabel")}
|
|
1570
1574
|
aria-required=${this.required?"true":h} aria-invalid=${i?"true":h}
|
|
1571
1575
|
aria-describedby=${s||h} ?disabled=${this.disabled}
|
|
1572
|
-
@input=${a(this,D,
|
|
1576
|
+
@input=${a(this,D,hy)} @change=${a(this,D,py)} />
|
|
1573
1577
|
</div>
|
|
1574
1578
|
</div>
|
|
1575
1579
|
${i?c`<p class="error" id="${e}-err" role="alert">${i}</p>`:h}
|
|
1576
1580
|
${this.helpText?c`<p class="help" id="${e}-help">${this.helpText}</p>`:h}
|
|
1577
1581
|
<div class="vh" role="status" aria-live="polite">${this._announce}</div>
|
|
1578
|
-
</div>`}};ht=new WeakMap,fs=new WeakMap,Ac=new WeakMap,pn=new WeakMap,Dc=new WeakMap,Et=new WeakMap,Mt=new WeakMap,_t=new WeakMap,or=new WeakMap,lr=new WeakMap,
|
|
1582
|
+
</div>`}};ht=new WeakMap,fs=new WeakMap,Ac=new WeakMap,pn=new WeakMap,Dc=new WeakMap,Et=new WeakMap,Mt=new WeakMap,_t=new WeakMap,or=new WeakMap,lr=new WeakMap,Ge=new WeakMap,Rc=new WeakMap,cr=new WeakMap,mn=new WeakMap,D=new WeakSet,Hg=function(){let e=this.renderRoot.querySelector(".panel-draw .pad");!e||r(this,cr)||(g(this,cr,new ResizeObserver(()=>a(this,D,Ng).call(this))),r(this,cr).observe(e))},om=function(){return this.renderRoot.querySelector("canvas")},Ng=function(){let e=r(this,D,om);if(!e)return;let t=e.clientWidth,i=e.clientHeight;if(!t||!i)return;g(this,mn,t);let s=window.devicePixelRatio||1,l=Math.round(t*s),d=Math.round(i*s);(e.width!==l||e.height!==d)&&(e.width=l,e.height=d),a(this,D,lm).call(this)},Mi=function(){r(this,lr)||g(this,lr,requestAnimationFrame(()=>{g(this,lr,0),a(this,D,lm).call(this)}))},lm=function(){let e=r(this,D,om);if(!e||!e.width)return;let t=e.getContext("2d"),i=e.clientWidth||r(this,mn);if(!i)return;let s=e.width/i;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,e.width,e.height),t.setTransform(s,0,0,s,0,0);let l=getComputedStyle(e).color||nm;a(this,D,Pg).call(this,t,i,l,!0)},Pg=function(e,t,i,s){let l=t/Rg,d=r(this,_t);if(d?.complete&&d.naturalWidth){let p=Math.min(t*.9/d.naturalWidth,l*.9/d.naturalHeight),u=d.naturalWidth*p,b=d.naturalHeight*p,f=(t-u)/2,x=(l-b)/2;if(s&&!A0(i,nm)){let v=document.createElement("canvas");v.width=Math.max(1,Math.round(u*2)),v.height=Math.max(1,Math.round(b*2));let k=v.getContext("2d");k.drawImage(d,0,0,v.width,v.height),k.globalCompositeOperation="source-in",k.fillStyle=i,k.fillRect(0,0,v.width,v.height),e.drawImage(v,f,x,u,b)}else e.drawImage(d,f,x,u,b)}e.strokeStyle=i,e.fillStyle=i,e.lineCap="round",e.lineJoin="round";for(let p of r(this,Et))S0(e,p,t)},Ig=function(e,t){let i=e.pointerType==="pen"&&e.pressure>0?e.pressure:.5;return{x:(e.clientX-t.left)/t.width,y:(e.clientY-t.top)/t.width,p:i}},dy=function(e){if(this.disabled||r(this,Mt)||!e.isPrimary||e.pointerType==="mouse"&&e.button!==0)return;let t=e.currentTarget;e.preventDefault();try{t.setPointerCapture(e.pointerId)}catch{}let i=[a(this,D,Ig).call(this,e,t.getBoundingClientRect())];g(this,Mt,{id:e.pointerId,stroke:i}),r(this,Et).push(i),a(this,D,Mi).call(this)},qg=function(e){let t=r(this,Mt);if(!t||e.pointerId!==t.id)return;e.preventDefault();let i=e.currentTarget.getBoundingClientRect(),s=typeof e.getCoalescedEvents=="function"?e.getCoalescedEvents():[];for(let l of s.length?s:[e]){let d=a(this,D,Ig).call(this,l,i),p=t.stroke[t.stroke.length-1];Math.hypot(d.x-p.x,d.y-p.y)*i.width<1.5||t.stroke.push(d)}a(this,D,Mi).call(this)},cm=function(e){let t=r(this,Mt);if(!(!t||e.pointerId!==t.id)){e.type==="pointerup"&&a(this,D,qg).call(this,e),g(this,Mt,void 0);try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}a(this,D,Mi).call(this),a(this,D,gs).call(this,!0)}},Og=function(){let e=this.renderRoot.querySelector(".typed");return e&&getComputedStyle(e).fontFamily||"cursive"},dm=function(){let e=document.fonts;if(!e||!this.isConnected)return;let t=`400 40px ${r(this,D,Og)}`,i=!0;try{i=e.check(t,this.typedName||"Signature")}catch{}i||e.load(t,this.typedName||"Signature").then(()=>{this.mode==="type"&&this.typedName.trim()&&a(this,D,gs).call(this,!1)},()=>{})},hy=function(e){e.stopPropagation(),r(this,Ge)?clearTimeout(r(this,Ge)):g(this,Rc,this.value),this.typedName=e.target.value,g(this,Ge,setTimeout(()=>a(this,D,Bg).call(this),C0)),a(this,D,dm).call(this)},Bg=function(){r(this,Ge)&&(clearTimeout(r(this,Ge)),g(this,Ge,void 0),this.value!==r(this,Rc)&&a(this,D,hm).call(this))},py=function(e){e.stopPropagation(),this.updateComplete.then(()=>a(this,D,Bg).call(this))},gs=function(e){let t=this.empty?"":this.toDataURL(),i=t!==this.value;i&&(g(this,or,t),this.value=t),this.requestUpdate(),e&&i&&a(this,D,hm).call(this)},hm=function(){let e={value:this.value,empty:this.empty,mode:this.mode};this.dispatchEvent(new CustomEvent("cm-change",{detail:e,bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},Fg=function(){if(this.empty)return;let e=Math.max(r(this,D,om)?.clientWidth||r(this,mn)||600,300),t=e/Rg,i=document.createElement("canvas");i.width=Math.round(e*Lc),i.height=Math.round(t*Lc);let s=i.getContext("2d",{willReadFrequently:!0});if(s.scale(Lc,Lc),this.mode==="type"){let l=Math.min(t*.45,64),d=r(this,D,Og);s.font=`400 ${l}px ${d}`;let p=this.typedName.trim(),u=e-2*cy,b=s.measureText(p).width;b>u&&(l*=u/b,s.font=`400 ${l}px ${d}`),s.direction=getComputedStyle(this).direction==="rtl"?"rtl":"ltr",s.textAlign="center",s.textBaseline="alphabetic",s.fillStyle=nm,s.fillText(p,e/2,t*am)}else a(this,D,Pg).call(this,s,e,nm,!1);return L0(i,cy*Lc)},Vg=function(e,t){if(this.disabled||(t&&this.updateComplete.then(()=>this.renderRoot.querySelector(`#${r(this,Ac)}-tab-${e}`)?.focus()),e===this.mode))return;let i=this.value;this.mode=e,this.updateComplete.then(()=>{e==="draw"&&a(this,D,Ng).call(this),this.value!==i&&a(this,D,hm).call(this)})},my=function(e){let t=se(e,this),i;if(t==="ArrowRight"||t==="ArrowLeft")i=this.mode==="draw"?"type":"draw";else if(e.key==="Home")i="draw";else if(e.key==="End")i="type";else return;e.preventDefault(),a(this,D,Vg).call(this,i,!0)},jg=function(e){a(this,D,uy).call(this,this.t(e))},uy=function(e){this._announce="",this.updateComplete.then(()=>{this._announce=e})},Ug=function(e){this.updateComplete.then(()=>{let t=this.shadowRoot?.activeElement;if(!e||t&&!t.disabled)return;(this.mode==="type"?this.renderRoot.querySelector(".typed"):this.renderRoot.querySelector('.tab[aria-selected="true"]'))?.focus()})},gy=function(){if(this.disabled||this.mode!=="draw"||this.empty)return;let e=this.matches(":focus-within");this.undo(),a(this,D,jg).call(this,"undone"),a(this,D,Ug).call(this,e)},fy=function(){if(this.disabled||this.empty)return;let e=this.matches(":focus-within");this.clear(),a(this,D,jg).call(this,"cleared"),a(this,D,Ug).call(this,e)},nr.formAssociated=!0,nr.shadowRootOptions={...A.shadowRootOptions,delegatesFocus:!0},nr.properties={label:{},hint:{},helpText:{attribute:"help-text"},error:{reflect:!0},name:{reflect:!0},value:{},mode:{reflect:!0},typedName:{attribute:"typed-name"},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},_announce:{state:!0}},nr.styles=[E,w`
|
|
1579
1583
|
:host { display: block; }
|
|
1580
1584
|
.field { display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
1581
1585
|
.label { font-size: var(--cm-type-label-size); color: var(--cm-text-default); }
|
|
@@ -1641,7 +1645,7 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
1641
1645
|
@media (pointer: coarse) { .act, .tab { min-height: var(--cm-control-height-touch); } }
|
|
1642
1646
|
|
|
1643
1647
|
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
1644
|
-
`];function
|
|
1648
|
+
`];function S0(o,n,e){let t=d=>e*T0*(.35+d*1.3);if(n.length===1){o.beginPath(),o.arc(n[0].x*e,n[0].y*e,t(n[0].p)/2,0,Math.PI*2),o.fill();return}let i=d=>[d.x*e,d.y*e],s=n[0];for(let d=1;d<n.length-1;d++){let p=z0(n[d],n[d+1]);o.beginPath(),o.moveTo(...i(s)),o.quadraticCurveTo(...i(n[d]),...i(p)),o.lineWidth=t(n[d].p),o.stroke(),s=p}let l=n[n.length-1];o.beginPath(),o.moveTo(...i(s)),o.lineTo(...i(l)),o.lineWidth=t(l.p),o.stroke()}function L0(o,n){let{width:e,height:t}=o,i=o.getContext("2d",{willReadFrequently:!0}).getImageData(0,0,e,t).data,s=t,l=e,d=-1,p=-1;for(let b=0;b<t;b++){let f=b*e*4;for(let x=0;x<e;x++)i[f+x*4+3]>8&&(x<l&&(l=x),x>d&&(d=x),b<s&&(s=b),p=b)}if(d<0)return;let u=document.createElement("canvas");return u.width=d-l+1+2*n,u.height=p-s+1+2*n,u.getContext("2d").drawImage(o,l,s,d-l+1,p-s+1,n,n,d-l+1,p-s+1),u}function A0(o,n){let e=t=>{let i=/^#([0-9a-f]{6})$/i.exec(t.trim());if(i){let s=parseInt(i[1],16);return`${s>>16&255},${s>>8&255},${s&255}`}return(/\d+\s*,\s*\d+\s*,\s*\d+/.exec(t)?.[0]??t).replace(/\s/g,"")};return e(o)===e(n)}$("cm-signature-field",nr);var $M=z("optionGroup",{required:"Please select one of these options."}),Tt,bs,vs,un,Hc,Yt,Kg,Wg,by,Gt=class extends C{constructor(){super(...arguments);m(this,Yt);this.label="";this.name="";this.value="";this.options=[];this.required=!1;this.disabled=!1;this._slotted=[];m(this,Tt,this.attachInternals());m(this,bs,new re(this,r(this,Tt),()=>this.renderRoot.querySelector('button[tabindex="0"]')?.focus()));m(this,vs,N("cm-og"));m(this,un,"");m(this,Hc,new MutationObserver(()=>a(this,Yt,Kg).call(this)))}connectedCallback(){super.connectedCallback(),a(this,Yt,Kg).call(this),r(this,Hc).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","disabled","selected","tone"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,Hc).disconnect()}get form(){return r(this,Tt).form}get validity(){return r(this,Tt).validity}get validationMessage(){return r(this,Tt).validationMessage}checkValidity(){return r(this,Tt).checkValidity()}reportValidity(){return r(this,bs).report(()=>r(this,Tt).reportValidity())}formResetCallback(){this.value=r(this,un),r(this,bs).reset()}formDisabledCallback(e){this.disabled=e}formStateRestoreCallback(e){this.value=e}focus(e){this.renderRoot.querySelector('button[tabindex="0"]')?.focus(e)}get items(){return this.options.length?this.options.map(e=>typeof e=="string"?{value:e,label:e}:e):this._slotted}firstUpdated(){r(this,un)||g(this,un,this.value)}updated(){r(this,Tt).setFormValue(this.value||null,this.value);let e=this.renderRoot.querySelector("button")??void 0;this.required&&!this.value?r(this,Tt).setValidity({valueMissing:!0},this.t("required"),e):r(this,Tt).setValidity({}),r(this,bs).sync()}render(){let e=this.items,t=e.findIndex(d=>d.value===this.value&&!d.disabled),i=t>=0?t:e.findIndex(d=>!d.disabled),s=this.getAttribute("aria-label"),l=r(this,bs).message;return c`
|
|
1645
1649
|
${this.label?c`<span class="label" id="${r(this,vs)}-l" part="label">${this.label}${this.required?c`<span class="req" aria-hidden="true">*</span>`:h}</span>`:h}
|
|
1646
1650
|
<div class="options" part="options" role="radiogroup"
|
|
1647
1651
|
aria-labelledby=${this.label?`${r(this,vs)}-l`:h} aria-label=${!this.label&&s?s:h}
|
|
@@ -1649,11 +1653,11 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
1649
1653
|
aria-describedby=${l?`${r(this,vs)}-err`:h}>
|
|
1650
1654
|
${e.map((d,p)=>c`<button type="button" role="radio" part="option" class=${d.tone==="critical"||d.tone==="success"?`tone-${d.tone}`:h} aria-checked=${d.value===this.value?"true":"false"}
|
|
1651
1655
|
tabindex=${p===i?"0":"-1"} ?disabled=${this.disabled||!!d.disabled}
|
|
1652
|
-
@click=${()=>a(this,Yt,Wg).call(this,p)} @keydown=${u=>a(this,Yt,
|
|
1656
|
+
@click=${()=>a(this,Yt,Wg).call(this,p)} @keydown=${u=>a(this,Yt,by).call(this,u,p)}>${d.label}</button>`)}
|
|
1653
1657
|
</div>
|
|
1654
1658
|
${l?c`<p class="error" id="${r(this,vs)}-err" role="alert">${l}</p>`:h}
|
|
1655
1659
|
<slot></slot>
|
|
1656
|
-
`}};Tt=new WeakMap,bs=new WeakMap,vs=new WeakMap,un=new WeakMap,Hc=new WeakMap,Yt=new WeakSet,Kg=function(){let e=[...this.querySelectorAll("option")];this._slotted=e.map(t=>{let i={value:t.value,label:t.label||t.textContent.trim(),disabled:t.disabled},s=t.getAttribute("tone");return(s==="critical"||s==="success")&&(i.tone=s),i}),!this.hasUpdated&&!this.value&&(this.value=e.find(t=>t.hasAttribute("selected"))?.value??"",g(this,un,this.value))},Wg=function(e){let t=this.items[e];!t||t.disabled||this.disabled||(this.updateComplete.then(()=>this.renderRoot.querySelectorAll("button")[e]?.focus()),t.value!==this.value&&(this.value=t.value,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))))},
|
|
1660
|
+
`}};Tt=new WeakMap,bs=new WeakMap,vs=new WeakMap,un=new WeakMap,Hc=new WeakMap,Yt=new WeakSet,Kg=function(){let e=[...this.querySelectorAll("option")];this._slotted=e.map(t=>{let i={value:t.value,label:t.label||t.textContent.trim(),disabled:t.disabled},s=t.getAttribute("tone");return(s==="critical"||s==="success")&&(i.tone=s),i}),!this.hasUpdated&&!this.value&&(this.value=e.find(t=>t.hasAttribute("selected"))?.value??"",g(this,un,this.value))},Wg=function(e){let t=this.items[e];!t||t.disabled||this.disabled||(this.updateComplete.then(()=>this.renderRoot.querySelectorAll("button")[e]?.focus()),t.value!==this.value&&(this.value=t.value,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))))},by=function(e,t){let i=se(e,this),s=this.items.flatMap((p,u)=>p.disabled?[]:[u]),l=s.indexOf(t),d;if(i==="ArrowRight"||e.key==="ArrowDown")d=s[(l+1)%s.length];else if(i==="ArrowLeft"||e.key==="ArrowUp")d=s[(l-1+s.length)%s.length];else if(e.key==="Home")d=s[0];else if(e.key==="End")d=s[s.length-1];else return;e.preventDefault(),d!==void 0&&a(this,Yt,Wg).call(this,d)},Gt.formAssociated=!0,Gt.properties={label:{},name:{reflect:!0},value:{},options:{type:Array},required:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},_slotted:{state:!0}},Gt.styles=[E,w`
|
|
1657
1661
|
:host { display: block; }
|
|
1658
1662
|
.label {
|
|
1659
1663
|
display: block; margin-bottom: var(--cm-space-8);
|
|
@@ -1687,7 +1691,7 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
1687
1691
|
/* 1.14: the field's own message under the options. */
|
|
1688
1692
|
.error { margin: var(--cm-space-8) 0 0; font-size: var(--cm-type-body-xs-size); line-height: var(--cm-type-body-xs-line-height); color: var(--cm-text-critical); }
|
|
1689
1693
|
@media (pointer: coarse) { button { min-height: var(--cm-control-height-touch, 44px); } }
|
|
1690
|
-
`];$("cm-option-group",Gt);var
|
|
1694
|
+
`];$("cm-option-group",Gt);var zM=z("segmentedControl",{required:"Please select one of these options."}),gn=class extends Gt{constructor(){super(...arguments);this.size="default"}};gn.properties={...Gt.properties,size:{reflect:!0}},gn.styles=[E,w`
|
|
1691
1695
|
:host { display: inline-block; vertical-align: middle; max-width: 100%; --_h: var(--cm-control-height-md, 36px); }
|
|
1692
1696
|
:host([size='small']) { --_h: var(--cm-control-height-sm, 32px); }
|
|
1693
1697
|
@media (pointer: coarse) { :host, :host([size='small']) { --_h: var(--cm-control-height-touch, 44px); } }
|
|
@@ -1717,7 +1721,7 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
1717
1721
|
button[aria-checked='true']:disabled { background: var(--cm-bg-input-filled); border-color: var(--cm-border-subtle); }
|
|
1718
1722
|
:host([disabled]) .options { background: var(--cm-bg-input-filled); }
|
|
1719
1723
|
slot { display: none; }
|
|
1720
|
-
`];$("cm-segmented-control",gn);var
|
|
1724
|
+
`];$("cm-segmented-control",gn);var RM=z("pageHeader",{back:"Back to {label}",backOnly:"Back",breadcrumbs:"Breadcrumb",records:"Records",previous:"Previous",next:"Next"}),Nc,Gg,fn=class extends C{constructor(){super(...arguments);m(this,Nc);this.heading="";this.description="";this.breadcrumbs=[];this.backHref="";this.backLabel="";this.pagination=!1;this.hasPrevious=!1;this.hasNext=!1}render(){let e=Array.isArray(this.breadcrumbs)?this.breadcrumbs:[],t=this.backHref?{href:this.backHref,label:this.backLabel}:[...e].reverse().find(i=>i.href);return c`<header part="header">
|
|
1721
1725
|
<div class=${this.description?"lead described":"lead"}>
|
|
1722
1726
|
${t?c`<a class=${this.backHref?"back always":"back"} part="back" href=${t.href} aria-label=${t.label?this.t("back",{label:t.label}):this.t("backOnly")}><cm-icon name="chevron-left" size="20"></cm-icon></a>`:h}
|
|
1723
1727
|
<div class="titles">
|
|
@@ -1794,7 +1798,7 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
1794
1798
|
h1 { font-size: var(--cm-type-heading-lg-resp-size); line-height: var(--cm-type-heading-lg-resp-line-height); }
|
|
1795
1799
|
.actions { gap: var(--cm-space-8); }
|
|
1796
1800
|
}
|
|
1797
|
-
`];$("cm-page-header",fn);var
|
|
1801
|
+
`];$("cm-page-header",fn);var OM=z("actionBar",{label:"Actions"}),bn=class extends C{constructor(){super(...arguments);this.eyebrow="";this.heading="";this.tone="default";this.sticky=!1;this.label=""}render(){let e=this.tone==="critical";return c`<div class="bar" part="bar" role="region" aria-label=${this.label||this.heading||this.eyebrow||this.t("label")}>
|
|
1798
1802
|
<div class="lead">
|
|
1799
1803
|
${e?c`<span class="icon" aria-hidden="true"><cm-icon name="alert" size="20"></cm-icon></span>`:h}
|
|
1800
1804
|
<div class="text">
|
|
@@ -1835,13 +1839,13 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
1835
1839
|
|
|
1836
1840
|
.actions { gap: var(--cm-space-8); }
|
|
1837
1841
|
}
|
|
1838
|
-
`];$("cm-action-bar",bn);var
|
|
1842
|
+
`];$("cm-action-bar",bn);var UM=z("saveBar",{message:"Unsaved changes",save:"Save",discard:"Discard"}),Xt,ys,Pc,Ye,Yg,Xg,Jg,vy,yy,vn=class extends C{constructor(){super(...arguments);m(this,Ye);this.open=!1;this.loading=!1;this.saveDisabled=!1;this.form="";m(this,Xt,null);m(this,ys,()=>{this.open=!0});m(this,Pc,()=>{this.open=!1})}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>a(this,Ye,Yg).call(this))}disconnectedCallback(){super.disconnectedCallback(),a(this,Ye,Xg).call(this)}updated(e){e.has("form")&&this.isConnected&&a(this,Ye,Yg).call(this)}render(){return c`<div class="bar" part="bar" role="region" aria-label=${this.message}>
|
|
1839
1843
|
<p class="message" part="message" role="status">${this.open?this.message:""}</p>
|
|
1840
1844
|
<div class="actions">
|
|
1841
|
-
<cm-button size="large" ?disabled=${this.loading} @click=${a(this,
|
|
1842
|
-
<cm-button size="large" variant="primary" ?loading=${this.loading} ?disabled=${this.saveDisabled} @click=${a(this,
|
|
1845
|
+
<cm-button size="large" ?disabled=${this.loading} @click=${a(this,Ye,yy)}>${this.discardLabel}</cm-button>
|
|
1846
|
+
<cm-button size="large" variant="primary" ?loading=${this.loading} ?disabled=${this.saveDisabled} @click=${a(this,Ye,vy)}>${this.saveLabel}</cm-button>
|
|
1843
1847
|
</div>
|
|
1844
|
-
</div>`}};Xt=new WeakMap,ys=new WeakMap,Pc=new WeakMap,
|
|
1848
|
+
</div>`}};Xt=new WeakMap,ys=new WeakMap,Pc=new WeakMap,Ye=new WeakSet,Yg=function(){a(this,Ye,Xg).call(this);let e=this.form?this.getRootNode().getElementById?.(this.form):null;e instanceof HTMLFormElement&&(g(this,Xt,e),e.addEventListener("input",r(this,ys)),e.addEventListener("change",r(this,ys)),e.addEventListener("reset",r(this,Pc)))},Xg=function(){let e=r(this,Xt);e&&(e.removeEventListener("input",r(this,ys)),e.removeEventListener("change",r(this,ys)),e.removeEventListener("reset",r(this,Pc)),g(this,Xt,null))},Jg=function(e){return this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,cancelable:!0}))},vy=function(){this.loading||this.saveDisabled||a(this,Ye,Jg).call(this,"cm-save")&&r(this,Xt)&&r(this,Xt).requestSubmit()},yy=function(){this.loading||a(this,Ye,Jg).call(this,"cm-discard")&&r(this,Xt)&&(r(this,Xt).reset(),this.open=!1)},vn.properties={open:{type:Boolean,reflect:!0},message:{string:"message"},saveLabel:{attribute:"save-label",string:"save"},discardLabel:{attribute:"discard-label",string:"discard"},loading:{type:Boolean,reflect:!0},saveDisabled:{type:Boolean,attribute:"save-disabled"},form:{}},vn.styles=[E,w`
|
|
1845
1849
|
:host { display: block; position: sticky; bottom: 0; z-index: 20; }
|
|
1846
1850
|
:host(:not([open])) { display: none; }
|
|
1847
1851
|
.bar {
|
|
@@ -1857,7 +1861,7 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
1857
1861
|
.message { font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); font-weight: 500; }
|
|
1858
1862
|
|
|
1859
1863
|
}
|
|
1860
|
-
`];$("cm-save-bar",vn);var
|
|
1864
|
+
`];$("cm-save-bar",vn);var JM=z("infoItem",{edit:"Edit {label}"}),yn=class extends A{constructor(){super(...arguments);this.heading="";this.action="";this.actionLabel="";this.headingLevel=2;this.variant="default";this.layout="stacked";this._list=!0}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2));return c`<section part="panel" aria-label=${this.heading||h}>
|
|
1861
1865
|
${this.heading||this.action?c`<header>
|
|
1862
1866
|
<div class="title" role="heading" aria-level=${e} part="title">${this.heading}</div>
|
|
1863
1867
|
${this.action?c`<button class="action" type="button" part="action" aria-label=${this.actionLabel||h}
|
|
@@ -1942,22 +1946,22 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
1942
1946
|
.body[hidden] { display: none; }
|
|
1943
1947
|
|
|
1944
1948
|
|
|
1945
|
-
`];$("cm-accordion",wn);var
|
|
1949
|
+
`];$("cm-accordion",wn);var rt,ws,Qg,xy,$n=class extends A{constructor(){super(...arguments);m(this,rt);this.heading="";this.image="";this.icon="box";this.headingLevel=2;this.size="default";this.action="";this.actionHref="";this.hasText=!1;this.hasActions=!1;this.hasImage=!1}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2));if(this.size==="inline")return a(this,rt,xy).call(this,e);let t=this.image?c`<img src=${this.image} alt="" part="image">`:this.icon?c`<cm-icon name=${this.icon} size=${this.size==="large"||this.size==="small"?"48":"24"}></cm-icon>`:h;return c`<div class="wrap" part="empty-state">
|
|
1946
1950
|
<div class="circle" part="circle" aria-hidden=${this.hasImage?h:"true"}>
|
|
1947
|
-
<slot name="image" @slotchange=${i=>a(this,
|
|
1951
|
+
<slot name="image" @slotchange=${i=>a(this,rt,ws).call(this,i,"hasImage")}>${t}</slot>
|
|
1948
1952
|
</div>
|
|
1949
1953
|
<div class="title" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
1950
|
-
<div class="text" ?hidden=${!this.hasText}><slot @slotchange=${i=>a(this,
|
|
1951
|
-
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${i=>a(this,
|
|
1952
|
-
</div>`}};
|
|
1953
|
-
@click=${()=>this.dispatchEvent(new CustomEvent("cm-action",{bubbles:!0,composed:!0}))}>${this.action}</button>`:h},
|
|
1954
|
+
<div class="text" ?hidden=${!this.hasText}><slot @slotchange=${i=>a(this,rt,ws).call(this,i,"hasText")}></slot></div>
|
|
1955
|
+
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${i=>a(this,rt,ws).call(this,i,"hasActions")}></slot></div>${this.action?c`<div class="actions">${a(this,rt,Qg).call(this)}</div>`:h}
|
|
1956
|
+
</div>`}};rt=new WeakSet,ws=function(e,t){let i=e.target;this[t]=i.assignedNodes({flatten:!0}).some(s=>s.nodeType===1||s.textContent.trim()),this.requestUpdate()},Qg=function(){return this.action?this.actionHref?c`<a class="text-action" part="action" href=${this.actionHref}>${this.action}</a>`:c`<button class="text-action" type="button" part="action"
|
|
1957
|
+
@click=${()=>this.dispatchEvent(new CustomEvent("cm-action",{bubbles:!0,composed:!0}))}>${this.action}</button>`:h},xy=function(e){let t=this.image?c`<img src=${this.image} alt="" part="image">`:this.icon?c`<cm-icon name=${this.icon} size="20"></cm-icon>`:h;return c`<div class="wrap inline" part="empty-state">
|
|
1954
1958
|
<span class="icon" part="circle" aria-hidden=${this.hasImage?h:"true"} ?hidden=${!this.hasImage&&!this.image&&!this.icon}>
|
|
1955
|
-
<slot name="image" @slotchange=${i=>a(this,
|
|
1959
|
+
<slot name="image" @slotchange=${i=>a(this,rt,ws).call(this,i,"hasImage")}>${t}</slot>
|
|
1956
1960
|
</span>
|
|
1957
1961
|
<div class="line">
|
|
1958
1962
|
<div class="title" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
1959
|
-
<span class="text" ?hidden=${!this.hasText}> <slot @slotchange=${i=>a(this,
|
|
1960
|
-
<span class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${i=>a(this,
|
|
1963
|
+
<span class="text" ?hidden=${!this.hasText}> <slot @slotchange=${i=>a(this,rt,ws).call(this,i,"hasText")}></slot></span>${a(this,rt,Qg).call(this)}
|
|
1964
|
+
<span class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${i=>a(this,rt,ws).call(this,i,"hasActions")}></slot></span>
|
|
1961
1965
|
</div>
|
|
1962
1966
|
</div>`},$n.properties={heading:{},image:{},icon:{},headingLevel:{type:Number,attribute:"heading-level"},size:{reflect:!0},action:{},actionHref:{attribute:"action-href"}},$n.styles=[E,w`
|
|
1963
1967
|
:host { display: block; }
|
|
@@ -2008,7 +2012,7 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
2008
2012
|
:host([size='large']) .circle { width: 120px; height: 120px; }
|
|
2009
2013
|
:host([size='large']) .title { margin-top: var(--cm-space-16); }
|
|
2010
2014
|
}
|
|
2011
|
-
`];$("cm-empty-state",$n);var
|
|
2015
|
+
`];$("cm-empty-state",$n);var wy={small:34,medium:40,large:50,xlarge:186},kn=class extends A{constructor(){super(...arguments);this.variant="text";this.lines=1;this.size="large"}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-hidden","true")}render(){if(this.variant==="thumbnail"){let t=wy[this.size]??wy.large;return c`<span class="bone" part="bone" style="width:${t}px;height:${t}px"></span>`}if(this.variant==="block")return c`<span class="bone block" part="bone"></span>`;let e=Math.max(1,Math.floor(this.lines||1));return c`${Array.from({length:e},(t,i)=>c`<span class="bone line ${e>1&&i===e-1?"short":""}" part="bone"></span>`)}`}};kn.properties={variant:{reflect:!0},lines:{type:Number},size:{reflect:!0}},kn.styles=[E,w`
|
|
2012
2016
|
:host { display: block; --cm-skeleton-height: 120px; }
|
|
2013
2017
|
:host([variant='thumbnail']) { display: inline-block; vertical-align: middle; }
|
|
2014
2018
|
.bone {
|
|
@@ -2023,14 +2027,14 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
2023
2027
|
.bone { animation: none; background: var(--cm-thumb-bg); }
|
|
2024
2028
|
}
|
|
2025
2029
|
@media (forced-colors: active) { .bone { border: 1px solid CanvasText; } }
|
|
2026
|
-
`];$("cm-skeleton",kn);var
|
|
2030
|
+
`];$("cm-skeleton",kn);var D0=[472,90,90,251],R0=[94,266,134,191,138],En=class extends C{constructor(){super(...arguments);this.layout="two-column";this.navigation=!1}render(){let e=t=>t.map(i=>c`<span class="bone" style="height:${i}px"></span>`);return c`<div class="wrap" part="skeleton-display" aria-busy="true">
|
|
2027
2031
|
<span class="sr" role="status">${this.label}</span>
|
|
2028
2032
|
<div class="page" aria-hidden="true">
|
|
2029
2033
|
${this.navigation?c`<span class="bone nav"></span>`:h}
|
|
2030
2034
|
<span class="bone head"></span>
|
|
2031
2035
|
<div class="body">
|
|
2032
|
-
<div class="col main">${e(this.layout==="one-column"?[472,251]:
|
|
2033
|
-
<div class="col side">${e(
|
|
2036
|
+
<div class="col main">${e(this.layout==="one-column"?[472,251]:D0)}</div>
|
|
2037
|
+
<div class="col side">${e(R0)}</div>
|
|
2034
2038
|
</div>
|
|
2035
2039
|
</div>
|
|
2036
2040
|
</div>`}};En.properties={layout:{reflect:!0},navigation:{type:Boolean,reflect:!0},label:{string:"loading"}},En.styles=[E,w`
|
|
@@ -2057,11 +2061,11 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
2057
2061
|
.body { grid-template-columns: minmax(0, 1fr); }
|
|
2058
2062
|
.head { height: 60px; }
|
|
2059
2063
|
}
|
|
2060
|
-
`];$("cm-skeleton-display",En);var
|
|
2064
|
+
`];$("cm-skeleton-display",En);var b2=z("commentBox",{heading:"Comments",label:"Add a comment",action:"Post comment"}),pm,$y,Mn=class extends C{constructor(){super(...arguments);m(this,pm);this.author="";this.datetime="";this.time=""}connectedCallback(){super.connectedCallback(),!this.hasAttribute("role")&&this.parentElement?.localName==="cm-comment-box"&&this.setAttribute("role","listitem")}render(){let e=a(this,pm,$y).call(this);return c`<article part="comment">
|
|
2061
2065
|
${e?c`<time class="meta" part="time" datetime=${this.datetime||h}>${e}</time>`:h}
|
|
2062
2066
|
<div class="body" part="body"><slot></slot></div>
|
|
2063
2067
|
${this.author?c`<div class="meta" part="author">– ${this.author}</div>`:h}
|
|
2064
|
-
</article>`}};pm=new WeakSet
|
|
2068
|
+
</article>`}};pm=new WeakSet,$y=function(){if(this.time)return this.time;if(!this.datetime)return"";let e=new Date(this.datetime);return Number.isNaN(e.getTime())?this.datetime:me(e,{dateStyle:"medium",timeStyle:"short"},this.locale)},Mn.properties={author:{},datetime:{},time:{}},Mn.styles=[E,w`
|
|
2065
2069
|
:host { display: block; }
|
|
2066
2070
|
article {
|
|
2067
2071
|
display: flex; flex-direction: column; gap: var(--cm-space-4); padding: var(--cm-space-12);
|
|
@@ -2069,16 +2073,16 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
2069
2073
|
}
|
|
2070
2074
|
.meta { font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12); color: var(--cm-text-tertiary); }
|
|
2071
2075
|
.body { font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); overflow-wrap: anywhere; }
|
|
2072
|
-
`];$("cm-comment",Mn);var Ic,mm,
|
|
2076
|
+
`];$("cm-comment",Mn);var Ic,mm,ky,_n=class extends C{constructor(){super(...arguments);m(this,mm);this.placeholder="";this.value="";this.disabled=!1;this.headingLevel=2;m(this,Ic,N("cm-comment-box"));this.hasComments=!1}submit(){let e=this.renderRoot.querySelector("textarea"),t=(e?.value??this.value).trim();if(this.disabled)return;if(!t){e?.focus();return}let i=new CustomEvent("cm-submit",{bubbles:!0,composed:!0,cancelable:!0,detail:{value:t}});this.dispatchEvent(i)&&(this.value="",e&&(e.value=""))}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2));return c`<section part="comment-box" aria-labelledby="${r(this,Ic)}-h">
|
|
2073
2077
|
<div class="title" id="${r(this,Ic)}-h" role="heading" aria-level=${e} part="heading">${this.heading}</div>
|
|
2074
2078
|
<textarea part="input" aria-label=${this.label} placeholder=${this.placeholder||h} .value=${this.value}
|
|
2075
2079
|
?disabled=${this.disabled} @input=${t=>{this.value=t.target.value}}
|
|
2076
|
-
@keydown=${a(this,mm,
|
|
2080
|
+
@keydown=${a(this,mm,ky)}></textarea>
|
|
2077
2081
|
<div class="actions"><cm-button variant="primary" ?disabled=${this.disabled} @click=${()=>this.submit()}>${this.action}</cm-button></div>
|
|
2078
2082
|
<div class="list" role="list" ?hidden=${!this.hasComments}>
|
|
2079
2083
|
<slot @slotchange=${t=>{this.hasComments=t.target.assignedElements().length>0,this.requestUpdate()}}></slot>
|
|
2080
2084
|
</div>
|
|
2081
|
-
</section>`}};Ic=new WeakMap,mm=new WeakSet,
|
|
2085
|
+
</section>`}};Ic=new WeakMap,mm=new WeakSet,ky=function(e){e.key==="Enter"&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this.submit())},_n.properties={heading:{string:"heading"},label:{string:"label"},placeholder:{},action:{string:"action"},value:{},disabled:{type:Boolean,reflect:!0},headingLevel:{type:Number,attribute:"heading-level"}},_n.styles=[E,w`
|
|
2082
2086
|
:host { display: block; }
|
|
2083
2087
|
section { display: flex; flex-direction: column; gap: var(--cm-space-12); }
|
|
2084
2088
|
.title { margin: 0; font-size: var(--cm-type-heading-sm-size); line-height: var(--cm-type-heading-sm-line-height); font-weight: 600; }
|
|
@@ -2098,8 +2102,8 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
2098
2102
|
|
|
2099
2103
|
.actions { justify-content: flex-end; }
|
|
2100
2104
|
}
|
|
2101
|
-
`];$("cm-comment-box",_n);var um='button, a[href], input, select, textarea, [tabindex]:not([tabindex="-1"]), [part="control"]',Le,Cn,dr,hr,_i,zn,Sn,pt,Zg,gm,fm,bm,vm,Ln,$
|
|
2102
|
-
data-side=${this._side}>${this.content}</div>`}};Le=new WeakMap,Cn=new WeakMap,dr=new WeakMap,hr=new WeakMap,_i=new WeakMap,zn=new WeakMap,Sn=new WeakMap,pt=new WeakSet,Zg=function(){document.removeEventListener("keydown",r(this,Ln),!0),removeEventListener("scroll",r(this,Ti),!0),removeEventListener("resize",r(this,Ti))},gm=new WeakMap,fm=new WeakMap,bm=new WeakMap,vm=new WeakMap,Ln=new WeakMap
|
|
2105
|
+
`];$("cm-comment-box",_n);var um='button, a[href], input, select, textarea, [tabindex]:not([tabindex="-1"]), [part="control"]',Le,Cn,dr,hr,_i,zn,Sn,pt,Zg,gm,fm,bm,vm,Ln,Ey,$s,ef,tf,Ti,Tn=class extends A{constructor(){super(...arguments);m(this,pt);this.content="";this.placement="top";this.delay=400;this.open=!1;this.visualOnly=!1;this._side="top";m(this,Le);m(this,Cn);m(this,dr,[]);m(this,hr);m(this,_i);m(this,zn,!1);m(this,Sn,!1);m(this,gm,()=>{g(this,zn,!0),clearTimeout(r(this,_i)),this.open||g(this,_i,setTimeout(()=>this.show(),this.delay))});m(this,fm,()=>{g(this,zn,!1),clearTimeout(r(this,_i)),r(this,Sn)||this.hide()});m(this,bm,()=>{g(this,Sn,!0),this.show()});m(this,vm,e=>{e.relatedTarget&&this.contains(e.relatedTarget)||(g(this,Sn,!1),r(this,zn)||this.hide())});m(this,Ln,e=>{e.key==="Escape"&&this.open&&this.hide()});m(this,$s,()=>{let t=this.renderRoot.querySelector("slot")?.assignedElements({flatten:!0})[0];if(a(this,pt,tf).call(this),!t||!this.content||this.visualOnly)return;let i=t.updateComplete;t.localName.includes("-")&&i&&!t.shadowRoot?.querySelector(um)&&i.then(()=>{t.shadowRoot?.querySelector(um)&&r(this,$s).call(this)}),r(this,Le)||(g(this,Le,document.createElement("span")),r(this,Le).id=N("cm-tooltip"),r(this,Le).hidden=!0,r(this,Le).slot="description"),r(this,Le).textContent=this.content,r(this,Le).isConnected||this.append(r(this,Le));let s=a(this,pt,Ey).call(this,t);if(g(this,Cn,s),s.getRootNode()===r(this,Le).getRootNode()){let l=(s.getAttribute("aria-describedby")??"").split(/\s+/).filter(Boolean);l.includes(r(this,Le).id)||s.setAttribute("aria-describedby",[...l,r(this,Le).id].join(" "))}else"ariaDescribedByElements"in s?(a(this,pt,ef).call(this,s),g(this,hr,new MutationObserver(()=>{s.getAttribute("aria-describedby")!==""&&a(this,pt,ef).call(this,s)})),r(this,hr).observe(s,{attributes:!0,attributeFilter:["aria-describedby"]})):t.setAttribute("aria-describedby",r(this,Le).id)});m(this,Ti,()=>{let e=this.renderRoot.querySelector(".tip");if(!e||!this.open)return;let s=(this.renderRoot.querySelector("slot")?.assignedElements({flatten:!0})[0]??this).getBoundingClientRect(),l=e.getBoundingClientRect(),d=8,p=8,u=innerWidth,b=innerHeight,f=getComputedStyle(this).direction==="rtl",x=O=>O==="start"?f?"right":"left":O==="end"?f?"left":"right":O,v={top:s.top-d-l.height>=p,bottom:s.bottom+d+l.height<=b-p,left:s.left-d-l.width>=p,right:s.right+d+l.width<=u-p},k={top:"bottom",bottom:"top",left:"right",right:"left"},L=x(this.placement);!v[L]&&v[k[L]]&&(L=k[L]);let P,U;L==="top"||L==="bottom"?(P=s.left+s.width/2-l.width/2,U=L==="top"?s.top-d-l.height:s.bottom+d):(U=s.top+s.height/2-l.height/2,P=L==="left"?s.left-d-l.width:s.right+d),P=Math.min(Math.max(p,P),u-p-l.width),U=Math.min(Math.max(p,U),b-p-l.height),e.style.transform=`translate(${Math.round(P)}px, ${Math.round(U)}px)`;let q={top:"top",bottom:"bottom",left:f?"end":"start",right:f?"start":"end"};this._side=q[L]})}connectedCallback(){super.connectedCallback(),this.addEventListener("pointerenter",r(this,gm)),this.addEventListener("pointerleave",r(this,fm)),this.addEventListener("focusin",r(this,bm)),this.addEventListener("focusout",r(this,vm)),this.addEventListener("keydown",r(this,Ln)),this.hasUpdated&&r(this,$s).call(this)}disconnectedCallback(){super.disconnectedCallback(),this.hide(),a(this,pt,tf).call(this),a(this,pt,Zg).call(this),clearTimeout(r(this,_i))}show(){clearTimeout(r(this,_i)),!(this.open||!this.content)&&(this.open=!0,document.addEventListener("keydown",r(this,Ln),!0),addEventListener("scroll",r(this,Ti),!0),addEventListener("resize",r(this,Ti)),this.updateComplete.then(r(this,Ti)),this.dispatchEvent(new CustomEvent("cm-show",{bubbles:!0,composed:!0})))}hide(){clearTimeout(r(this,_i)),this.open&&(this.open=!1,a(this,pt,Zg).call(this),this.dispatchEvent(new CustomEvent("cm-hide",{bubbles:!0,composed:!0})))}updated(e){(e.has("content")||e.has("visualOnly"))&&(r(this,$s).call(this),this.content?this.open&&r(this,Ti).call(this):this.hide())}render(){return c`<slot @slotchange=${r(this,$s)}></slot><div class="tip" part="tooltip" role="tooltip" aria-hidden="true"
|
|
2106
|
+
data-side=${this._side}>${this.content}</div>`}};Le=new WeakMap,Cn=new WeakMap,dr=new WeakMap,hr=new WeakMap,_i=new WeakMap,zn=new WeakMap,Sn=new WeakMap,pt=new WeakSet,Zg=function(){document.removeEventListener("keydown",r(this,Ln),!0),removeEventListener("scroll",r(this,Ti),!0),removeEventListener("resize",r(this,Ti))},gm=new WeakMap,fm=new WeakMap,bm=new WeakMap,vm=new WeakMap,Ln=new WeakMap,Ey=function(e){return e.matches(um)&&!e.shadowRoot?e:e.shadowRoot?.querySelector(um)??e},$s=new WeakMap,ef=function(e){g(this,dr,(e.getAttribute("aria-describedby")??"").split(/\s+/).filter(Boolean));let t=e.getRootNode(),i=r(this,dr).map(s=>t.getElementById(s)).filter(s=>!!s);e.ariaDescribedByElements=[...i,r(this,Le)]},tf=function(){let e=r(this,Cn);if(!(!e||!r(this,Le))){if(r(this,hr))r(this,hr).disconnect(),g(this,hr,void 0),r(this,dr).length?e.setAttribute("aria-describedby",r(this,dr).join(" ")):e.removeAttribute("aria-describedby"),g(this,dr,[]);else{let t=(e.getAttribute("aria-describedby")??"").split(/\s+/).filter(i=>i&&i!==r(this,Le).id);t.length?e.setAttribute("aria-describedby",t.join(" ")):e.removeAttribute("aria-describedby")}g(this,Cn,void 0)}},Ti=new WeakMap,Tn.properties={content:{},placement:{reflect:!0},delay:{type:Number},open:{type:Boolean,reflect:!0},visualOnly:{type:Boolean,attribute:"visual-only"},_side:{state:!0}},Tn.styles=[E,w`
|
|
2103
2107
|
:host { display: inline-block; position: relative; }
|
|
2104
2108
|
.tip {
|
|
2105
2109
|
position: fixed; top: 0; left: 0; z-index: 1100; box-sizing: border-box;
|
|
@@ -2116,7 +2120,7 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
2116
2120
|
:host([open]) .tip { opacity: 1; visibility: visible; transition: opacity var(--cm-duration-fast) var(--cm-easing-standard); }
|
|
2117
2121
|
@media (prefers-reduced-motion: reduce) { .tip { transition: none; } }
|
|
2118
2122
|
@media (forced-colors: active) { .tip { border: 1px solid CanvasText; } }
|
|
2119
|
-
`];$("cm-tooltip",Tn);var
|
|
2123
|
+
`];$("cm-tooltip",Tn);var T2=z("timelineItem",{justNow:"Just now",minutesAgo:{one:"{count} minute ago",other:"{count} minutes ago"},hoursAgo:{one:"{count} hour ago",other:"{count} hours ago"},daysAgo:{one:"{count} day ago",other:"{count} days ago"},inMinutes:{one:"In {count} minute",other:"In {count} minutes"},inHours:{one:"In {count} hour",other:"In {count} hours"},inDays:{one:"In {count} day",other:"In {count} days"},showAll:"Show all",showLess:"Show less"}),C2=z("timeline",{label:"Activity",showMore:"Show more",loading:"Loading activity"}),H0=7,qc=new Set,Oc;function My(o,n){n?qc.add(o):qc.delete(o),qc.size&&!Oc&&(Oc=setInterval(()=>qc.forEach(e=>e.requestUpdate()),6e4)),!qc.size&&Oc&&(clearInterval(Oc),Oc=void 0)}var Bc,Es,Nt,rf,ym,_y,An=class extends C{constructor(){super(...arguments);m(this,Nt);this.icon="";this.tone="neutral";this.heading="";this.datetime="";this.time="";this.meta="";this.lines=3;this.expanded=!1;this._overflow=!1;this._body=!1;this._meta=!1;this._actions=!1;m(this,Bc,N("cm-tl"));m(this,Es)}connectedCallback(){super.connectedCallback(),My(this,!0)}disconnectedCallback(){super.disconnectedCallback(),My(this,!1),r(this,Es)?.disconnect(),g(this,Es,void 0)}firstUpdated(){let e=this.renderRoot.querySelector(".body");e&&typeof ResizeObserver<"u"&&(g(this,Es,new ResizeObserver(()=>a(this,Nt,rf).call(this))),r(this,Es).observe(e))}updated(e){(e.has("lines")||e.has("_body")||e.has("expanded"))&&a(this,Nt,rf).call(this)}get date(){if(!this.datetime)return;let e=new Date(this.datetime);return Number.isNaN(e.getTime())?void 0:e}get relativeTime(){if(this.time)return this.time;let e=this.date;if(!e)return this.datetime;let t=Date.now()-e.getTime(),i=t<0,s=Math.floor(Math.abs(t)/6e4);if(s<1)return this.t("justNow");if(s<60)return this.t(i?"inMinutes":"minutesAgo",{count:s});let l=Math.floor(s/60);if(l<24)return this.t(i?"inHours":"hoursAgo",{count:l});let d=Math.floor(l/24);return d<H0?this.t(i?"inDays":"daysAgo",{count:d}):me(e,{dateStyle:"medium"},this.locale)}get fullTime(){let e=this.date;return e?me(e,{dateStyle:"full",timeStyle:"short"},this.locale):""}render(){let e=this.relativeTime,t=this.fullTime,i=this.tone&&this.tone!=="neutral"?this.tone:"",s=this.lines>0&&!this.expanded,l=e?t?c`<cm-tooltip class="when" content=${t} visual-only placement="top"><time part="time" tabindex="0" datetime=${this.datetime}>${e}<span class="sr">, ${t}</span></time></cm-tooltip>`:c`<time class="when" part="time" datetime=${this.datetime||h}>${e}</time>`:h;return c`<div class="item">
|
|
2120
2124
|
<span class="icon ${i}" part="icon" aria-hidden="true">${this.icon?c`<cm-icon name=${this.icon} size="16"></cm-icon>`:c`<span class="dot"></span>`}</span>
|
|
2121
2125
|
<div class="main">
|
|
2122
2126
|
<div class="head">
|
|
@@ -2128,10 +2132,10 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
2128
2132
|
<div class="body ${s?"clamp":""}" id="${r(this,Bc)}-body" part="body" ?hidden=${!this._body}
|
|
2129
2133
|
style="--_lines: ${Math.max(1,this.lines||1)}"><slot @slotchange=${d=>a(this,Nt,ym).call(this,d,"_body")}></slot></div>
|
|
2130
2134
|
${this._body&&this._overflow?c`<button type="button" class="toggle" part="toggle" aria-expanded=${this.expanded?"true":"false"}
|
|
2131
|
-
aria-controls="${r(this,Bc)}-body" @click=${a(this,Nt,
|
|
2135
|
+
aria-controls="${r(this,Bc)}-body" @click=${a(this,Nt,_y)}>${this.expanded?this.t("showLess"):this.t("showAll")}</button>`:h}
|
|
2132
2136
|
<div class="actions" part="actions" ?hidden=${!this._actions}><slot name="actions" @slotchange=${d=>a(this,Nt,ym).call(this,d,"_actions")}></slot></div>
|
|
2133
2137
|
</div>
|
|
2134
|
-
</div>`}};Bc=new WeakMap,Es=new WeakMap,Nt=new WeakSet,rf=function(){let e=this.renderRoot.querySelector(".body");if(!e||!this._body||!(this.lines>0)){this._overflow=!1;return}let t=parseFloat(getComputedStyle(e).lineHeight)||20;this._overflow=e.scrollHeight>this.lines*t+1},ym=function(e,t){let i=e.target.assignedNodes({flatten:!0});this[t]=i.some(s=>s.nodeType===Node.ELEMENT_NODE||(s.textContent??"").trim())},
|
|
2138
|
+
</div>`}};Bc=new WeakMap,Es=new WeakMap,Nt=new WeakSet,rf=function(){let e=this.renderRoot.querySelector(".body");if(!e||!this._body||!(this.lines>0)){this._overflow=!1;return}let t=parseFloat(getComputedStyle(e).lineHeight)||20;this._overflow=e.scrollHeight>this.lines*t+1},ym=function(e,t){let i=e.target.assignedNodes({flatten:!0});this[t]=i.some(s=>s.nodeType===Node.ELEMENT_NODE||(s.textContent??"").trim())},_y=function(){this.expanded=!this.expanded},An.properties={icon:{reflect:!0},tone:{reflect:!0},heading:{},datetime:{reflect:!0},time:{},meta:{},lines:{type:Number},expanded:{type:Boolean,reflect:!0},_overflow:{state:!0},_body:{state:!0},_meta:{state:!0},_actions:{state:!0}},An.styles=[E,w`
|
|
2135
2139
|
:host { display: block; min-width: 0; font-size: 14px; line-height: 20px; }
|
|
2136
2140
|
.item { display: flex; gap: var(--cm-space-12); align-items: flex-start; }
|
|
2137
2141
|
.icon {
|
|
@@ -2176,16 +2180,16 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
2176
2180
|
[hidden] { display: none !important; }
|
|
2177
2181
|
.sr { position: absolute; inset-block-start: 0; inset-inline-start: 0; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
2178
2182
|
::slotted([slot='badge']) { flex: none; }
|
|
2179
|
-
`];$("cm-timeline-item",An);var Fc,Dn,Ms,sf,
|
|
2183
|
+
`];$("cm-timeline-item",An);var Fc,Dn,Ms,sf,Ty,ks=class extends C{constructor(){super(...arguments);m(this,Ms);this.hasMore=!1;this.loading=!1;this._items=[];this._empty=[];m(this,Fc,new MutationObserver(()=>a(this,Ms,sf).call(this)));m(this,Dn,!1)}connectedCallback(){super.connectedCallback(),a(this,Ms,sf).call(this),r(this,Fc).observe(this,{childList:!0,attributes:!0,attributeFilter:["slot"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,Fc).disconnect()}get items(){return[...this.children].filter(e=>e.localName==="cm-timeline-item"&&!e.hasAttribute("slot"))}willUpdate(){g(this,Dn,this.renderRoot?.activeElement?.localName==="cm-button")}updated(){this.renderRoot.querySelectorAll("li > slot").forEach((i,s)=>{this._items[s]&&i.assign(this._items[s])});let t=this.renderRoot.querySelector("slot.empty");t&&t.assign(...this._empty),r(this,Dn)&&!this.renderRoot.querySelector(".more cm-button")&&(g(this,Dn,!1),this.renderRoot.querySelector("ol")?.focus())}render(){let e=this._items,t=this.loading,i=t&&!e.length?c`<div class="loading" aria-hidden="true">${[0,1,2].map(()=>c`<div class="sk">
|
|
2180
2184
|
<cm-skeleton class="ic" variant="block"></cm-skeleton><cm-skeleton class="tx" lines="2"></cm-skeleton></div>`)}</div>`:h;return c`
|
|
2181
2185
|
${e.length?c`<ol part="list" aria-label=${this.label} aria-busy=${t?"true":"false"} tabindex="-1">
|
|
2182
2186
|
${e.map(()=>c`<li><slot></slot></li>`)}
|
|
2183
2187
|
</ol>`:h}
|
|
2184
2188
|
${i}
|
|
2185
2189
|
${!e.length&&!t?c`<slot class="empty"></slot>`:h}
|
|
2186
|
-
${this.hasMore&&e.length?c`<div class="more"><cm-button part="more" size="medium" ?loading=${t} @click=${a(this,Ms,
|
|
2190
|
+
${this.hasMore&&e.length?c`<div class="more"><cm-button part="more" size="medium" ?loading=${t} @click=${a(this,Ms,Ty)}>${this.moreLabel}</cm-button></div>`:h}
|
|
2187
2191
|
<span class="sr" role="status">${t?this.t("loading"):""}</span>
|
|
2188
|
-
`}};Fc=new WeakMap,Dn=new WeakMap,Ms=new WeakSet,sf=function(){this._items=this.items,this._empty=[...this.children].filter(e=>e.getAttribute("slot")==="empty")},
|
|
2192
|
+
`}};Fc=new WeakMap,Dn=new WeakMap,Ms=new WeakSet,sf=function(){this._items=this.items,this._empty=[...this.children].filter(e=>e.getAttribute("slot")==="empty")},Ty=function(){this.loading||this.dispatchEvent(new CustomEvent("cm-load-more",{bubbles:!0,composed:!0}))},ks.shadowRootOptions={...A.shadowRootOptions,slotAssignment:"manual"},ks.properties={label:{string:"label"},hasMore:{type:Boolean,attribute:"has-more",reflect:!0},loading:{type:Boolean,reflect:!0},moreLabel:{attribute:"more-label",string:"showMore"},_items:{state:!0},_empty:{state:!0}},ks.styles=[E,w`
|
|
2189
2193
|
:host { display: block; }
|
|
2190
2194
|
ol { margin: 0; padding: 0; list-style: none; }
|
|
2191
2195
|
ol:focus { outline: none; }
|
|
@@ -2208,7 +2212,7 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
2208
2212
|
@media (max-width: 640px) {
|
|
2209
2213
|
.more { padding-inline-start: 0; }
|
|
2210
2214
|
}
|
|
2211
|
-
`];$("cm-timeline",ks);var
|
|
2215
|
+
`];$("cm-timeline",ks);var R2=z("smartTip",{newTab:"(opens in a new tab)"}),H2=z("smartTips",{heading:"Smart tips",tourAction:"Start"}),Rn=class extends C{constructor(){super(...arguments);this.heading="";this.href="";this.target=""}connectedCallback(){super.connectedCallback(),!this.hasAttribute("role")&&this.parentElement?.localName==="cm-smart-tips"&&this.setAttribute("role","listitem")}render(){let e=this.target==="_blank";return c`<a part="tip" href=${this.href||h} target=${this.target||h} rel=${e?"noopener noreferrer":h}>
|
|
2212
2216
|
<span class="text">
|
|
2213
2217
|
<span class="title" part="heading">${this.heading}</span>
|
|
2214
2218
|
<span class="desc" part="description"><slot></slot></span>
|
|
@@ -2260,11 +2264,11 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
2260
2264
|
margin: var(--cm-space-8) 0 var(--cm-space-16); text-align: center; font-size: var(--cm-type-heading-sm-size); line-height: var(--cm-type-heading-sm-line-height); font-weight: 600;
|
|
2261
2265
|
}
|
|
2262
2266
|
.list { display: flex; flex-direction: column; gap: var(--cm-space-8); }
|
|
2263
|
-
`];$("cm-smart-tips",Hn);var
|
|
2267
|
+
`];$("cm-smart-tips",Hn);var O2=z("pagination",{label:"Pagination",rows:"Number of rows",summary:"Showing {from}\u2013{to} of {total} {resource}",page:"Page",of:"of {count}",previous:"Previous page",next:"Next page"}),Ci,Pn,Cy,zy,Nn=class extends C{constructor(){super(...arguments);m(this,Pn);this.page=1;this.total=0;this.pageSize=20;this.pageSizes=[10,20,50,100];this.resourceName="";this._draft=null;m(this,Ci,N("cm-pg"))}get pageCount(){return Math.max(1,Math.ceil((this.total||0)/Math.max(1,this.pageSize)))}goTo(e){let t=Math.min(this.pageCount,Math.max(1,Math.round(e)||1));if(this._draft=null,t===this.page){this.requestUpdate();return}this.page=t,this.dispatchEvent(new CustomEvent("cm-page-change",{detail:{page:t},bubbles:!0,composed:!0}))}render(){let e=this.pageCount,t=Math.min(e,Math.max(1,this.page)),i=this.total?(t-1)*this.pageSize+1:0,s=Math.min(this.total,t*this.pageSize),l=this.pageSizes??[];return c`
|
|
2264
2268
|
<nav part="bar" aria-label=${this.label}>
|
|
2265
2269
|
${l.length?c`<div class="rows" part="rows">
|
|
2266
2270
|
<label for="${r(this,Ci)}-s">${this.t("rows")}</label>
|
|
2267
|
-
<span class="field"><select id="${r(this,Ci)}-s" @change=${a(this,Pn,
|
|
2271
|
+
<span class="field"><select id="${r(this,Ci)}-s" @change=${a(this,Pn,Cy)}>
|
|
2268
2272
|
${(l.includes(this.pageSize)?l:[...l,this.pageSize].sort((d,p)=>d-p)).map(d=>c`<option value=${d} ?selected=${d===this.pageSize}>${d}</option>`)}
|
|
2269
2273
|
</select><cm-icon name="chevron-down" size="12"></cm-icon></span>
|
|
2270
2274
|
</div>`:h}
|
|
@@ -2275,7 +2279,7 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
2275
2279
|
<input id="${r(this,Ci)}-p" type="number" inputmode="numeric" min="1" max=${e}
|
|
2276
2280
|
.value=${this._draft??String(t)} aria-describedby="${r(this,Ci)}-of"
|
|
2277
2281
|
@input=${d=>this._draft=d.target.value}
|
|
2278
|
-
@keydown=${a(this,Pn,
|
|
2282
|
+
@keydown=${a(this,Pn,zy)}
|
|
2279
2283
|
@change=${d=>this.goTo(Number(d.target.value))} />
|
|
2280
2284
|
<span id="${r(this,Ci)}-of">${this.t("of",{count:e})}</span>
|
|
2281
2285
|
</span>
|
|
@@ -2287,7 +2291,7 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
2287
2291
|
</span>
|
|
2288
2292
|
</div>
|
|
2289
2293
|
</nav>
|
|
2290
|
-
`}};Ci=new WeakMap,Pn=new WeakSet,
|
|
2294
|
+
`}};Ci=new WeakMap,Pn=new WeakSet,Cy=function(e){let t=Number(e.target.value);t!==this.pageSize&&(this.pageSize=t,this.page=1,this.dispatchEvent(new CustomEvent("cm-page-size-change",{detail:{pageSize:t},bubbles:!0,composed:!0})))},zy=function(e){e.key==="Enter"?(e.preventDefault(),this.goTo(Number(e.target.value))):e.key==="Escape"&&(this._draft=null,e.target.value=String(this.page))},Nn.properties={page:{type:Number,reflect:!0},total:{type:Number},pageSize:{type:Number,attribute:"page-size"},pageSizes:{type:Array,attribute:"page-sizes"},label:{string:"label"},resourceName:{attribute:"resource-name"},_draft:{state:!0}},Nn.styles=[E,w`
|
|
2291
2295
|
:host { display: block; }
|
|
2292
2296
|
nav {
|
|
2293
2297
|
display: flex; align-items: center; gap: var(--cm-space-20); min-height: 48px; padding: 0 var(--cm-space-16);
|
|
@@ -2330,21 +2334,21 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
2330
2334
|
select, input { height: var(--cm-control-height-touch); }
|
|
2331
2335
|
button { width: var(--cm-control-height-touch); height: var(--cm-control-height-touch); }
|
|
2332
2336
|
}
|
|
2333
|
-
`];$("cm-pagination",Nn);var
|
|
2337
|
+
`];$("cm-pagination",Nn);var K2=z("statusTabs",{label:"Status",option:"{label} ({count})"}),qn,jc,Me,Vc,Sy,af,Ly,nf,Ay,In=class extends C{constructor(){super(...arguments);m(this,Me);this.value="";this.tabs=[];this.controls="";this.size="large";this.mobile="scroll";this._more="";m(this,qn,new ResizeObserver(()=>a(this,Me,Vc).call(this)));this._slotted=[];m(this,jc,new MutationObserver(()=>a(this,Me,af).call(this)))}connectedCallback(){super.connectedCallback(),a(this,Me,af).call(this),r(this,jc).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["value","label","count","disabled","selected"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,jc).disconnect(),r(this,qn).disconnect()}firstUpdated(){let e=this.renderRoot.querySelector(".tabs");r(this,qn).observe(e),e.addEventListener("scroll",()=>a(this,Me,Vc).call(this),{passive:!0}),document.fonts?.ready.then(()=>a(this,Me,Vc).call(this))}get items(){return this.tabs.length?this.tabs.map(e=>typeof e=="string"?{value:e,label:e}:e):this._slotted}focus(e){let t=this.renderRoot.querySelector(".pick select");t&&t.offsetParent!==null?t.focus(e):this.renderRoot.querySelector('button[tabindex="0"]')?.focus(e)}updated(e){a(this,Me,Vc).call(this);for(let s of this.renderRoot.querySelectorAll(".tabs > *"))r(this,qn).observe(s);if(!("ariaControlsElements"in Element.prototype))return;let t=this.getRootNode(),i=this.controls?t.getElementById?.(this.controls):null;for(let s of this.renderRoot.querySelectorAll("button, select"))s.ariaControlsElements=i?[i]:null}render(){let e=this.items,t=a(this,Me,Ly).call(this,e),i=this.getAttribute("aria-label")||this.t("label");return c`
|
|
2334
2338
|
<div class=${`tabs${this._more?` more-${this._more}`:""}`} part="tabs" role="tablist" aria-label=${i}>
|
|
2335
2339
|
${e.map((s,l)=>c`<button type="button" role="tab" part="tab" aria-selected=${l===t?"true":"false"}
|
|
2336
2340
|
tabindex=${l===t?"0":"-1"} ?disabled=${!!s.disabled}
|
|
2337
|
-
@click=${()=>a(this,Me,nf).call(this,l)} @keydown=${d=>a(this,Me,
|
|
2341
|
+
@click=${()=>a(this,Me,nf).call(this,l)} @keydown=${d=>a(this,Me,Ay).call(this,d,l)}><span class="label" data-text=${s.label}>${s.label}</span>${s.count!==void 0&&!Number.isNaN(s.count)?c`<span class="sr">, </span><span class="count" part="count">${this.formatNumber(s.count)}</span>`:h}</button>`)}
|
|
2338
2342
|
</div>
|
|
2339
|
-
${this.mobile==="select"?c`<div class="pick"><select part="select" aria-label=${i} @change=${a(this,Me,
|
|
2343
|
+
${this.mobile==="select"?c`<div class="pick"><select part="select" aria-label=${i} @change=${a(this,Me,Sy)}>
|
|
2340
2344
|
${e.map((s,l)=>c`<option value=${s.value} ?disabled=${!!s.disabled} ?selected=${l===t} .selected=${l===t}>${s.count!==void 0&&!Number.isNaN(s.count)?this.t("option",{label:s.label,count:s.count}):s.label}</option>`)}
|
|
2341
2345
|
</select><cm-icon name="chevron-down" size="16"></cm-icon></div>`:h}
|
|
2342
2346
|
<slot></slot>
|
|
2343
|
-
`}};qn=new WeakMap,jc=new WeakMap,Me=new WeakSet,Vc=function(){let e=this.renderRoot.querySelector(".tabs");if(!e)return;let t=e.scrollWidth-e.clientWidth,i=Math.abs(e.scrollLeft),s=t>1&&i>1,l=t>1&&i<t-1,d=s&&l?"both":s?"start":l?"end":"";d!==this._more&&(this._more=d)},
|
|
2347
|
+
`}};qn=new WeakMap,jc=new WeakMap,Me=new WeakSet,Vc=function(){let e=this.renderRoot.querySelector(".tabs");if(!e)return;let t=e.scrollWidth-e.clientWidth,i=Math.abs(e.scrollLeft),s=t>1&&i>1,l=t>1&&i<t-1,d=s&&l?"both":s?"start":l?"end":"";d!==this._more&&(this._more=d)},Sy=function(e){let t=e.target.value;t!==this.value&&(this.value=t,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))},af=function(){let e=[...this.querySelectorAll("option")];this._slotted=e.map(t=>{let i=t.getAttribute("count");return{value:t.value,label:t.label||t.textContent.trim(),count:i===null||i===""?void 0:Number(i),disabled:t.disabled}}),!this.hasUpdated&&!this.value&&(this.value=e.find(t=>t.hasAttribute("selected"))?.value??"")},Ly=function(e){let t=e.findIndex(i=>i.value===this.value&&!i.disabled);return t>=0?t:e.findIndex(i=>!i.disabled)},nf=function(e){let t=this.items[e];!t||t.disabled||(this.updateComplete.then(()=>{let i=this.renderRoot.querySelectorAll("button")[e];i?.focus(),i?.scrollIntoView?.({block:"nearest",inline:"nearest"})}),t.value!==this.value&&(this.value=t.value,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))))},Ay=function(e,t){let i=se(e,this),s=this.items.flatMap((p,u)=>p.disabled?[]:[u]),l=s.indexOf(t),d;if(i==="ArrowRight")d=s[(l+1)%s.length];else if(i==="ArrowLeft")d=s[(l-1+s.length)%s.length];else if(e.key==="Home")d=s[0];else if(e.key==="End")d=s[s.length-1];else return;e.preventDefault(),d!==void 0&&a(this,Me,nf).call(this,d)},In.properties={value:{reflect:!0},tabs:{type:Array},controls:{},size:{reflect:!0},mobile:{reflect:!0},_slotted:{state:!0},_more:{state:!0}},In.styles=[E,w`
|
|
2344
2348
|
:host { display: block; }
|
|
2345
2349
|
/* A 40px row: 14px labels (medium; semibold when chosen) over a 2px underline on a hairline. */
|
|
2346
2350
|
.tabs {
|
|
2347
|
-
display: flex; gap: var(--cm-space-24); overflow-x: auto;
|
|
2351
|
+
display: flex; gap: var(--cm-space-24); overflow-x: auto; padding: 2px 2px 0;
|
|
2348
2352
|
scroll-snap-type: x proximity; scroll-padding-inline: var(--cm-space-24);
|
|
2349
2353
|
font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); font-weight: 500; white-space: nowrap;
|
|
2350
2354
|
box-shadow: inset 0 calc(-1 * var(--cm-border-1)) 0 var(--cm-border-subtle);
|
|
@@ -2399,20 +2403,20 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
2399
2403
|
:host([mobile='select']) .tabs { display: none; }
|
|
2400
2404
|
:host([mobile='select']) .pick { display: block; }
|
|
2401
2405
|
}
|
|
2402
|
-
`];$("cm-status-tabs",In);var
|
|
2406
|
+
`];$("cm-status-tabs",In);var Q2=z("tableHeader",{selectAll:"Select all",sorted:", sorted {direction}",sortable:", sortable"}),xm,Uc,zi,of,Dy,Ry,On=class extends C{constructor(){super(...arguments);m(this,zi);this.columns=[];this.sort="";this.direction="ascending";this.selectable=!1;this.checked=!1;this.indeterminate=!1;this._slotted=[];this._inTable=!1;m(this,xm,N("cm-th"));m(this,Uc,new MutationObserver(()=>a(this,zi,of).call(this)))}connectedCallback(){super.connectedCallback(),this._inTable=!!this.parentElement?.closest('table, [role="table"], [role="grid"], [role="treegrid"]'),a(this,zi,of).call(this),r(this,Uc).observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0})}disconnectedCallback(){super.disconnectedCallback(),r(this,Uc).disconnect()}get items(){return this.columns.length?this.columns.map(e=>typeof e=="string"?{key:e,label:e}:{...e,key:e.key??e.label}):this._slotted}render(){let e=this._inTable,t=this.items;return c`
|
|
2403
2407
|
<div class="bar ${this.selectable?"sel":""}" part="bar" role=${e?"row":h}
|
|
2404
2408
|
style="--_cols: repeat(${Math.max(1,t.length)}, minmax(0, 1fr))">
|
|
2405
2409
|
${this.selectable?c`<span class="cell" role=${e?"columnheader":h}><span class="check">
|
|
2406
2410
|
<input id="${r(this,xm)}-all" type="checkbox" aria-label=${this.t("selectAll")} .checked=${this.checked} .indeterminate=${this.indeterminate}
|
|
2407
|
-
@change=${a(this,zi,
|
|
2411
|
+
@change=${a(this,zi,Ry)} />
|
|
2408
2412
|
<span class="box" aria-hidden="true">${this.indeterminate?c`<span class="dash"></span>`:this.checked?c`<cm-icon name="check" size="14"></cm-icon>`:h}</span>
|
|
2409
2413
|
</span></span>`:h}
|
|
2410
2414
|
${t.map(i=>{let s=this.sort===i.key,l=s?this.direction==="descending"?"descending":"ascending":"none",d=i.hidden?c`<span class="sr">${i.label}</span>`:i.label;return c`<span class="cell" part="cell" data-align=${i.align??"start"} role=${e?"columnheader":h}
|
|
2411
|
-
aria-sort=${e&&i.sortable?l:h}>${i.sortable?c`<button type="button" class=${s?"on":""} @click=${()=>a(this,zi,
|
|
2415
|
+
aria-sort=${e&&i.sortable?l:h}>${i.sortable?c`<button type="button" class=${s?"on":""} @click=${()=>a(this,zi,Dy).call(this,i)}>${d}${e?h:c`<span class="sr">${s?this.t("sorted",{direction:this.t(l)}):this.t("sortable")}</span>`}<cm-icon
|
|
2412
2416
|
name=${s&&this.direction==="descending"?"chevron-down":"chevron-up"} size="12"></cm-icon></button>`:d}</span>`})}
|
|
2413
2417
|
</div>
|
|
2414
2418
|
<slot></slot>
|
|
2415
|
-
`}};xm=new WeakMap,Uc=new WeakMap,zi=new WeakSet,of=function(){this._slotted=[...this.querySelectorAll("option")].map(e=>{let t=e.label||e.textContent.trim();return{key:e.getAttribute("value")??t,label:t,sortable:e.hasAttribute("sortable"),hidden:e.hasAttribute("hidden"),align:e.getAttribute("align")??"start"}})},
|
|
2419
|
+
`}};xm=new WeakMap,Uc=new WeakMap,zi=new WeakSet,of=function(){this._slotted=[...this.querySelectorAll("option")].map(e=>{let t=e.label||e.textContent.trim();return{key:e.getAttribute("value")??t,label:t,sortable:e.hasAttribute("sortable"),hidden:e.hasAttribute("hidden"),align:e.getAttribute("align")??"start"}})},Dy=function(e){let t=this.sort===e.key&&this.direction==="ascending"?"descending":"ascending";this.dispatchEvent(new CustomEvent("cm-sort",{detail:{key:e.key,direction:t},bubbles:!0,composed:!0}))},Ry=function(e){let t=e.target.checked;this.checked=t,this.indeterminate=!1,this.dispatchEvent(new CustomEvent("cm-select-all",{detail:{checked:t},bubbles:!0,composed:!0}))},On.properties={columns:{type:Array},sort:{reflect:!0},direction:{reflect:!0},selectable:{type:Boolean,reflect:!0},checked:{type:Boolean,reflect:!0},indeterminate:{type:Boolean,reflect:!0},resourceRows:{attribute:"resource-rows",reflect:!0},_slotted:{state:!0},_inTable:{state:!0}},On.styles=[E,w`
|
|
2416
2420
|
:host { display: block; }
|
|
2417
2421
|
slot { display: none; } /* <option> children are column data, not content */
|
|
2418
2422
|
.bar {
|
|
@@ -2467,10 +2471,10 @@ var ub=o=>{throw TypeError(o)};var ou=(o,n,e)=>n.has(o)||ub("Cannot "+e);var r=(
|
|
|
2467
2471
|
:host([resource-rows][mobile='stack']) .bar:not(.sel) { display: flex; flex-wrap: wrap; gap: var(--cm-space-4) var(--cm-space-12); padding-block: var(--cm-space-8); }
|
|
2468
2472
|
:host([resource-rows][mobile='stack']) .bar:not(.sel) > .cell:first-child { flex: 1 1 100%; }
|
|
2469
2473
|
}
|
|
2470
|
-
`];$("cm-table-header",On);var
|
|
2474
|
+
`];$("cm-table-header",On);var N0=`
|
|
2471
2475
|
[data-cm-density="compact"] { --cm-table-row-height: 40px; --cm-resource-row-height: 40px; --cm-resource-row-padding: 4px; --cm-resource-media-size: 32px; }
|
|
2472
2476
|
[data-cm-density="comfortable"] { --cm-table-row-height: 48px; --cm-resource-row-height: 56px; --cm-resource-row-padding: 8px; --cm-resource-media-size: 40px; }
|
|
2473
|
-
`,wm=null,
|
|
2477
|
+
`,wm=null,Hy=new WeakSet;function $m(o){if(typeof document>"u"||typeof CSSStyleSheet>"u")return;let n=[document],e=o.getRootNode();e instanceof ShadowRoot&&n.push(e);for(let t of n)if(!Hy.has(t)){Hy.add(t);try{wm||(wm=new CSSStyleSheet,wm.replaceSync(N0)),t.adoptedStyleSheets=[...t.adoptedStyleSheets,wm]}catch{}}}var o_=z("dataTable",{empty:"No data",sorted:"Sorted by {column}, {direction}",scrollHint:"Scroll for more",columns:"Columns",showColumns:"Show columns",resize:"Resize {column} column",resized:"{column} column, {width} pixels wide",viewAll:"View all fields",viewLess:"Hide fields",rowAction:"{action}, {name}"}),Ny=48,Py=16,Iy=!1,P0=`
|
|
2474
2478
|
cm-data-table > table { width: 100%; border-collapse: separate; border-spacing: 0; font: inherit; font-size: var(--cm-font-size-13); line-height: var(--cm-line-height-13); font-variant-numeric: tabular-nums; color: var(--cm-text-default); }
|
|
2475
2479
|
cm-data-table > table caption { text-align: start; font-weight: 600; font-size: var(--cm-font-size-16); line-height: var(--cm-line-height-16); padding-block-end: var(--cm-space-8); }
|
|
2476
2480
|
cm-data-table > table th, cm-data-table > table td { box-sizing: border-box; }
|
|
@@ -2519,11 +2523,11 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2519
2523
|
cm-data-table[mobile='cards'] > table td[data-type='actions'] { justify-content: flex-start; flex-wrap: wrap; padding-block-start: var(--cm-space-8); }
|
|
2520
2524
|
cm-data-table[mobile='cards'] > table td[data-type='actions'] > * { opacity: 1; }
|
|
2521
2525
|
}
|
|
2522
|
-
`;function
|
|
2526
|
+
`;function I0(){if(Iy||typeof document>"u")return;Iy=!0;let o=new CSSStyleSheet;o.replaceSync(P0),document.adoptedStyleSheets=[...document.adoptedStyleSheets,o]}var Kc=o=>o.type==="numeric"||o.type==="money",q0=o=>(o.align??(Kc(o)||o.type==="actions"?"end":"start"))==="end",O0=o=>!o.type||o.type==="text";function qy(o){if(typeof o=="number")return o;let n=String(o??"").trim(),e=/^\(.*\)$/.test(n)||/^-|^[^\d]*-\s*\d/.test(n),t=n.match(/\d[\d,]*(?:\.\d+)?/);if(!t)return NaN;let i=Number(t[0].replace(/,/g,""));return e?-i:i}var Oy=o=>o instanceof Date?o.getTime():typeof o=="number"?o:Date.parse(String(o??"")),By=new Map;function B0(o){let n=By.get(o??"");if(!n){try{n=new Intl.Collator(o,{numeric:!0,sensitivity:"base"})}catch{n=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"})}By.set(o??"",n)}return n}function Fy(o,n,e,t){let i=s=>s==null||s==="";return i(o)||i(n)?i(o)===i(n)?0:i(o)?1:-1:e==="numeric"||e==="money"?(qy(o)||0)-(qy(n)||0):e==="date"?(Oy(o)||0)-(Oy(n)||0):B0(t).compare(String(o),String(n))}var Vy=o=>o.parentElement??o.getRootNode().host??null,Kn,Wn,Wc,Gn,_s,Yn,Ts,Tm,S,lf,cf,df,jy,hf,Uy,Ky,Wy,Cs,Bn,Fn,km,Vn,jn,Em,pf,mf,uf,Gy,Yy,gf,ff,Mm,Xy,Jy,Qy,pr,_m,Xn,Zy,ex,tx,ix,rx,sx,ax,Un=class extends C{constructor(){super(...arguments);m(this,S);this.columns=[];this.rows=[];this.totals=null;this.caption="";this.captionHidden=!1;this.sort="";this.direction="ascending";this.sortMode="auto";this.stickyHeader=!1;this.stickyFirstColumn=!1;this.loading=!1;this.loadingRows=5;this.mobile="scroll";this.rowActions="hover";this.resizable=!1;this.columnPicker=!1;this._light=!1;this._announce="";this._widths={};this._expanded=new Set;this._picker=!1;this._overflows=!1;m(this,Kn,!1);m(this,Wn,N("cm-dt"));m(this,Wc,new MutationObserver(()=>a(this,S,lf).call(this)));m(this,Gn,typeof ResizeObserver>"u"?null:new ResizeObserver(()=>a(this,S,Bn).call(this)));m(this,_s,[]);m(this,Yn,0);m(this,Ts,-1);m(this,Tm,e=>{e.target?.closest?.("[data-lines]")&&a(this,S,Em).call(this,e)});m(this,Cs,()=>{r(this,Yn)||!this.stickyHeader||g(this,Yn,requestAnimationFrame(()=>{g(this,Yn,0),a(this,S,Bn).call(this)}))});m(this,pr,new xe);m(this,Xn,e=>{let t=this.renderRoot.querySelector(".tools");t&&!e.composedPath().includes(t)&&a(this,S,_m).call(this,!1)})}connectedCallback(){super.connectedCallback(),this.addEventListener("pointerover",r(this,Tm)),$m(this),a(this,S,lf).call(this),r(this,Wc).observe(this,{childList:!0,subtree:!0}),document.addEventListener("scroll",r(this,Cs),{capture:!0,passive:!0}),window.addEventListener("resize",r(this,Cs),{passive:!0})}disconnectedCallback(){super.disconnectedCallback(),r(this,pr).close(),r(this,Wc).disconnect(),r(this,Gn)?.disconnect(),g(this,_s,[]),document.removeEventListener("scroll",r(this,Cs),{capture:!0}),window.removeEventListener("resize",r(this,Cs)),document.removeEventListener("pointerdown",r(this,Xn),{capture:!0})}get sortedRows(){let e=[...this.rows??[]],t=this.columns.find(s=>s.key===this.sort);if(!t||this.sortMode==="manual")return e;let i=this.direction==="descending"?-1:1;return e.map((s,l)=>[s,l]).sort(([s,l],[d,p])=>{let u=s[t.key],b=d[t.key],f=u==null||u==="",x=b==null||b==="";return f||x?f===x?l-p:f?1:-1:i*Fy(u,b,t.type,this.locale)||l-p}).map(([s])=>s)}get visibleColumns(){return(this.columns??[]).filter(e=>e.visible!==!1)}updated(e){if(this._picker&&!r(this,pr).active?r(this,pr).open(this.renderRoot.querySelector(".panel"),this.renderRoot.querySelector(".pick"),{align:"end"}):!this._picker&&r(this,pr).active&&r(this,pr).close(),r(this,Kn)&&(e.has("sort")||e.has("direction"))&&this.sort){g(this,Kn,!1);let t=this.columns.find(i=>i.key===this.sort);t&&a(this,S,df).call(this,t.label,this.direction)}if(e.has("columns")){let t=e.get("columns")??[],i={...this._widths},s=!1;for(let l of this.columns??[]){let d=t.find(p=>p.key===l.key);l.width!==void 0&&d?.width!==l.width&&i[l.key]!==void 0&&(delete i[l.key],s=!0)}s&&(this._widths=i)}a(this,S,Wy).call(this),a(this,S,Bn).call(this)}render(){let e=c`<span class="sr" role="status">${this._announce}</span>`,t=c`<p class="hint" part="scroll-hint" aria-hidden="true">${this.t("scrollHint")}<cm-icon name="chevron-right" size="16"></cm-icon></p>`,i=c`<span class="fade s" aria-hidden="true"></span><span class="fade e" aria-hidden="true"></span>`,s=this.stickyHeader||this.stickyFirstColumn||this._overflows;if(this._light)return c`<div class="frame" part="frame"><div class="wrap"><div class="scroll" part="scroll" tabindex=${this._overflows?"0":h}
|
|
2523
2527
|
role=${this._overflows?"region":h} aria-label=${this._overflows?this.querySelector("caption")?.textContent?.trim()||h:h}
|
|
2524
2528
|
@scroll=${()=>a(this,S,Bn).call(this)}><slot></slot></div>${i}</div>${t}</div>${e}`;let l=this.visibleColumns,d=a(this,S,mf).call(this,l),p=this.mobile==="priority"?l.filter(v=>v.priority==="low"&&v!==d):[],u=this.sortedRows,b=Math.max(1,l.length),f=!this.loading&&u.length===0,x=this.mobile==="cards"&&!this.loading&&u.length>0;return c`
|
|
2525
2529
|
<div class="frame" part="frame" ?data-cards=${x}>
|
|
2526
|
-
${this.columnPicker?a(this,S,
|
|
2530
|
+
${this.columnPicker?a(this,S,tx).call(this):h}
|
|
2527
2531
|
<div class="wrap">
|
|
2528
2532
|
<div class="scroll" part="scroll" tabindex=${s?"0":h}
|
|
2529
2533
|
role=${s?"region":h}
|
|
@@ -2531,9 +2535,9 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2531
2535
|
<table part="table" aria-busy=${this.loading?"true":"false"} @pointerover=${a(this,S,Em)} @focusin=${a(this,S,pf)}
|
|
2532
2536
|
@focusout=${a(this,S,pf)}>
|
|
2533
2537
|
${this.caption?c`<caption part="caption">${this.caption}</caption>`:h}
|
|
2534
|
-
<thead><tr>${l.map(v=>a(this,S,
|
|
2538
|
+
<thead><tr>${l.map(v=>a(this,S,ix).call(this,v,d))}</tr></thead>
|
|
2535
2539
|
<tbody>
|
|
2536
|
-
${this.loading?Array.from({length:Math.max(1,this.loadingRows)},()=>c`<tr>${l.map(v=>c`<td class=${a(this,S,Vn).call(this,v,d)} style=${a(this,S,jn).call(this,v)}><cm-skeleton></cm-skeleton></td>`)}</tr>`):u.map((v,k)=>a(this,S,
|
|
2540
|
+
${this.loading?Array.from({length:Math.max(1,this.loadingRows)},()=>c`<tr>${l.map(v=>c`<td class=${a(this,S,Vn).call(this,v,d)} style=${a(this,S,jn).call(this,v)}><cm-skeleton></cm-skeleton></td>`)}</tr>`):u.map((v,k)=>a(this,S,rx).call(this,v,l,d,p,k))}
|
|
2537
2541
|
${f?c`<tr class="empty"><td colspan=${b}><slot name="empty">${this.t("empty")}</slot></td></tr>`:h}
|
|
2538
2542
|
</tbody>
|
|
2539
2543
|
${this.totals&&!this.loading&&!f?c`<tfoot><tr part="totals">${l.map(v=>c`<td class=${a(this,S,Vn).call(this,v,d)} style=${a(this,S,jn).call(this,v)}>${v.type==="actions"?h:a(this,S,Fn).call(this,this.totals[v.key])}</td>`)}</tr></tfoot>`:h}
|
|
@@ -2542,29 +2546,29 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2542
2546
|
${i}
|
|
2543
2547
|
</div>
|
|
2544
2548
|
${t}
|
|
2545
|
-
${x?a(this,S,
|
|
2549
|
+
${x?a(this,S,ax).call(this,u,l,d):h}
|
|
2546
2550
|
</div>${e}
|
|
2547
|
-
`}};Kn=new WeakMap,Wn=new WeakMap,Wc=new WeakMap,Gn=new WeakMap,_s=new WeakMap,Yn=new WeakMap,Ts=new WeakMap,Tm=new WeakMap,S=new WeakSet,lf=function(){this._light=!!this.querySelector(":scope > table"),this._light&&(
|
|
2551
|
+
`}};Kn=new WeakMap,Wn=new WeakMap,Wc=new WeakMap,Gn=new WeakMap,_s=new WeakMap,Yn=new WeakMap,Ts=new WeakMap,Tm=new WeakMap,S=new WeakSet,lf=function(){this._light=!!this.querySelector(":scope > table"),this._light&&(I0(),a(this,S,jy).call(this))},cf=function(e){this._announce=this._announce===e?`${e}\xA0`:e},df=function(e,t){a(this,S,cf).call(this,this.t("sorted",{column:e,direction:this.t(t)}))},jy=function(){let e=this.querySelector(":scope > table"),t=e?.tHead?.rows[0]?.cells;if(!t)return;let i=[...t];i.forEach((s,l)=>{if(!s.dataset.sort||s.querySelector(":scope > button.cm-sort"))return;s.dataset.type=s.dataset.sort;let d=document.createElement("button");d.type="button",d.className="cm-sort",d.append(...s.childNodes);let p=document.createElement("cm-icon");p.setAttribute("size","12"),d.append(p),s.append(d),s.hasAttribute("aria-sort")||s.setAttribute("aria-sort","none"),a(this,S,hf).call(this,s),d.addEventListener("click",()=>a(this,S,Uy).call(this,e,s,l))});for(let s of[...e.tBodies,...e.tFoot?[e.tFoot]:[]])for(let l of s.rows)[...l.cells].forEach((d,p)=>{let u=i[p];u&&(d.dataset.label||(d.dataset.label=(u.textContent??"").trim()),u.dataset.priority&&!d.dataset.priority&&(d.dataset.priority=u.dataset.priority),u.dataset.type==="actions"&&!d.dataset.type&&(d.dataset.type="actions"))})},hf=function(e){e.querySelector(":scope > button.cm-sort > cm-icon")?.setAttribute("name",e.getAttribute("aria-sort")==="descending"?"chevron-down":"chevron-up")},Uy=function(e,t,i){let s=(t.querySelector(":scope > button.cm-sort")?.textContent??"").trim(),l=t.dataset.key||s,d=t.getAttribute("aria-sort")==="ascending"?"descending":"ascending",p=new CustomEvent("cm-sort",{detail:{key:l,direction:d},bubbles:!0,composed:!0,cancelable:!0});if(!this.dispatchEvent(p)||this.sortMode==="manual")return;let u=t.dataset.sort,b=d==="descending"?-1:1;for(let f of e.tBodies){let x=k=>{let L=k.cells[i];return L?(L.dataset.value??L.textContent??"").trim():""},v=[...f.rows].map((k,L)=>[k,x(k),L]).sort(([,k,L],[,P,U])=>k===""||P===""?k===P?L-U:k===""?1:-1:b*Fy(k,P,u,this.locale)||L-U);f.append(...v.map(([k])=>k))}for(let f of e.tHead.rows[0].cells)f.dataset.sort&&(f.setAttribute("aria-sort",f===t?d:"none"),a(this,S,hf).call(this,f));a(this,S,df).call(this,s,d)},Ky=function(e){let t=this.sort===e.key&&this.direction==="ascending"?"descending":"ascending",i=new CustomEvent("cm-sort",{detail:{key:e.key,direction:t},bubbles:!0,composed:!0,cancelable:!0}),s=this.dispatchEvent(i);g(this,Kn,s),s&&this.sortMode!=="manual"&&(this.sort=e.key,this.direction=t)},Wy=function(){let e=[this.renderRoot.querySelector(".scroll"),this.renderRoot.querySelector("table")??this.querySelector(":scope > table")].filter(Boolean);e.length===r(this,_s).length&&e.every((t,i)=>t===r(this,_s)[i])||(r(this,Gn)?.disconnect(),e.forEach(t=>r(this,Gn)?.observe(t)),g(this,_s,e))},Cs=new WeakMap,Bn=function(){let e=this.renderRoot?.querySelector(".scroll"),t=this.renderRoot?.querySelector(".frame");if(!e||!t)return;let i=getComputedStyle(e).maxBlockSize!=="none",s=e.scrollWidth>e.clientWidth+1;s!==this._overflows&&(this._overflows=s),e.toggleAttribute("data-open",this.stickyHeader&&!i&&!s);let l=Math.abs(e.scrollLeft);t.toggleAttribute("data-more-start",s&&l>1),t.toggleAttribute("data-more-end",s&&l+e.clientWidth<e.scrollWidth-1);let d=this.renderRoot.querySelector("caption")??this.querySelector(":scope > table > caption"),p=d&&getComputedStyle(d).position!=="absolute"?`${d.offsetHeight}px`:"";e.parentElement.style.getPropertyValue("--_cap")!==p&&e.parentElement.style.setProperty("--_cap",p);let u=0,b=this.renderRoot.querySelector("table")??this.querySelector(":scope > table"),f=b?.tHead;if(this.stickyHeader&&!i&&s&&b&&f){let x=r(this,Ts)>0?r(this,Ts):0,v=f.getBoundingClientRect().top-x,k=b.getBoundingClientRect().bottom-x,L=0;for(let P=Vy(this);P&&P!==document.documentElement&&P!==document.body;P=Vy(P)){let U=getComputedStyle(P);/(auto|scroll|overlay|hidden|clip)/.test(U.overflowY)&&(L=Math.max(L,P.getBoundingClientRect().top+P.clientTop+(parseFloat(U.paddingTop)||0)))}L+=parseFloat(getComputedStyle(this).getPropertyValue("--cm-data-table-sticky-top"))||0,u=Math.max(0,Math.min(L-v,k-v-f.getBoundingClientRect().height))}for(let x of this.renderRoot.querySelectorAll(".rz")){let v=String(Math.round(x.closest("th").getBoundingClientRect().width));x.getAttribute("aria-valuenow")!==v&&x.setAttribute("aria-valuenow",v)}u!==r(this,Ts)&&(g(this,Ts,u),u?e.style.setProperty("--_shift",`${u}px`):e.style.removeProperty("--_shift"))},Fn=function(e){return e==null?"":e instanceof Date?me(e,{},this.locale):String(e)},km=function(e){return this._widths[e.key]??e.width},Vn=function(e,t){return[q0(e)&&"end",Kc(e)&&"num",(Kc(e)||e.type==="date")&&"nw",e.type==="actions"&&"act",e.priority==="low"&&e!==t&&"low",a(this,S,km).call(this,e)!==void 0&&"w"].filter(Boolean).join(" ")},jn=function(e){let t=a(this,S,km).call(this,e);return t===void 0?h:`--_w: ${t}px`},Em=function(e){let t=e.composedPath()[0]?.closest?.("[data-lines]");if(t&&this.contains(t)){t.scrollWidth>t.clientWidth+1||t.scrollHeight>t.clientHeight+1?t.title=t.textContent?.trim()??"":t.removeAttribute("title");return}let i=e.composedPath()[0]?.closest?.(".t");i&&(i.scrollWidth>i.clientWidth+1||i.scrollHeight>i.clientHeight+1?i.title=i.textContent??"":i.removeAttribute("title"))},pf=function(e){e.type==="focusin"&&a(this,S,Em).call(this,e);let t=e.composedPath().find(s=>s instanceof HTMLTableRowElement);if(!t)return;let i=e.type==="focusin"||e.relatedTarget instanceof Node&&t.contains(e.relatedTarget);t.toggleAttribute("data-focus",i)},mf=function(e){return e.find(t=>t.primary)??e.find(t=>t.type!=="actions")??e[0]},uf=function(e,t){return t?a(this,S,Fn).call(this,e[t.key]):""},Gy=function(e,t){let i=t[e.key];return Array.isArray(i)?i:e.actions??[]},Yy=function(e,t){let i=(this.rows??[]).indexOf(t);this.dispatchEvent(new CustomEvent("cm-row-action",{detail:{action:e.value??e.label,row:t,index:i},bubbles:!0,composed:!0}))},gf=function(e,t,i){return c`<span class="acts">${a(this,S,Gy).call(this,e,t).map(s=>c`<cm-button size="slim" icon=${s.icon??h}
|
|
2548
2552
|
?icon-only=${!!s.iconOnly} label=${s.iconOnly?this.t("rowAction",{action:s.label,name:i}):h} tone=${s.tone??h}
|
|
2549
|
-
@click=${()=>a(this,S,
|
|
2553
|
+
@click=${()=>a(this,S,Yy).call(this,s,t)}>${s.label}${s.iconOnly||!i?h:c`<span class="sr">, ${i}</span>`}</cm-button>`)}</span>`},ff=function(e,t,i){if(e.type==="actions")return a(this,S,gf).call(this,e,t,i);let s=a(this,S,Fn).call(this,t[e.key]);if(!O0(e))return s;let l=Math.trunc(Number(e.lines))||0;return l>1?c`<span class="t lines" style="--_lines: ${l}">${s}</span>`:c`<span class="t">${s}</span>`},Mm=function(e,t,i){let s=Math.max(Ny,Math.round(t));this._widths={...this._widths,[e.key]:s},i&&(a(this,S,cf).call(this,this.t("resized",{column:e.label,width:s})),this.dispatchEvent(new CustomEvent("cm-column-resize",{detail:{key:e.key,width:s},bubbles:!0,composed:!0})))},Xy=function(e,t){return a(this,S,km).call(this,e)??Math.round(t.closest("th").getBoundingClientRect().width)},Jy=function(e,t){let i=se(e,this);i!=="ArrowLeft"&&i!=="ArrowRight"||(e.preventDefault(),a(this,S,Mm).call(this,t,a(this,S,Xy).call(this,t,e.currentTarget)+(i==="ArrowRight"?Py:-Py),!0))},Qy=function(e,t){if(e.button!==0)return;e.preventDefault();let i=e.currentTarget,s=i.closest("th").getBoundingClientRect().width,l=e.clientX,d=getComputedStyle(this).direction==="rtl";try{i.setPointerCapture(e.pointerId)}catch{}i.setAttribute("data-dragging","");let p=s,u=f=>{p=s+(f.clientX-l)*(d?-1:1),a(this,S,Mm).call(this,t,p,!1)},b=()=>{i.removeEventListener("pointermove",u),i.removeEventListener("pointerup",b),i.removeEventListener("pointercancel",b),i.removeAttribute("data-dragging"),a(this,S,Mm).call(this,t,p,!0)};i.addEventListener("pointermove",u),i.addEventListener("pointerup",b),i.addEventListener("pointercancel",b)},pr=new WeakMap,_m=function(e=!this._picker){this._picker=e,e?document.addEventListener("pointerdown",r(this,Xn),{capture:!0}):document.removeEventListener("pointerdown",r(this,Xn),{capture:!0})},Xn=new WeakMap,Zy=function(e){e.key!=="Escape"||!this._picker||(e.stopPropagation(),a(this,S,_m).call(this,!1),this.renderRoot.querySelector(".pick")?.focus())},ex=function(e,t){let i=this.columns.map(s=>s.key===e?{...s,visible:t}:s);this.columns=i,this.dispatchEvent(new CustomEvent("cm-columns-change",{detail:{key:e,visible:t,columns:i},bubbles:!0,composed:!0}))},tx=function(){let e=this.columns??[],t=a(this,S,mf).call(this,this.visibleColumns);return c`<div class="tools" part="tools" @keydown=${a(this,S,Zy)}>
|
|
2550
2554
|
<button type="button" class="pick" part="column-picker" aria-expanded=${this._picker?"true":"false"} aria-controls="${r(this,Wn)}-cols"
|
|
2551
2555
|
@click=${()=>a(this,S,_m).call(this)}>${this.t("columns")}<cm-icon name="chevron-down" size="16" aria-hidden="true"></cm-icon></button>
|
|
2552
2556
|
<fieldset class="panel" id="${r(this,Wn)}-cols" part="column-panel" ?hidden=${!this._picker}>
|
|
2553
2557
|
<legend class="sr">${this.t("showColumns")}</legend>
|
|
2554
2558
|
${e.map(i=>c`<label class="opt"><input type="checkbox" .checked=${i.visible!==!1} ?disabled=${i===t}
|
|
2555
|
-
@change=${s=>a(this,S,
|
|
2559
|
+
@change=${s=>a(this,S,ex).call(this,i.key,s.target.checked)} />${i.label}</label>`)}
|
|
2556
2560
|
</fieldset>
|
|
2557
|
-
</div>`},
|
|
2561
|
+
</div>`},ix=function(e,t){let i=this.sort===e.key,s=i?this.direction:"none",d=e.hidden||e.type==="actions"?c`<span class="sr">${e.label}</span>`:c`<span class="t">${e.label}</span>`;return c`<th scope="col" class=${a(this,S,Vn).call(this,e,t)} style=${a(this,S,jn).call(this,e)} aria-sort=${e.sortable?s:h}><div class="h">${e.sortable?c`<button type="button" class="sort ${i?"on":""}" @click=${()=>a(this,S,Ky).call(this,e)}>${d}<cm-icon
|
|
2558
2562
|
name=${i&&this.direction==="descending"?"chevron-down":"chevron-up"} size="12"></cm-icon></button>`:d}${this.resizable&&e.type!=="actions"?c`<span class="rz" part="resize-handle" role="separator" aria-orientation="vertical" tabindex="0" aria-label=${this.t("resize",{column:e.label})}
|
|
2559
|
-
aria-valuemin=${
|
|
2560
|
-
@keydown=${p=>a(this,S,
|
|
2561
|
-
@click=${()=>a(this,S,
|
|
2562
|
-
<dl class="pairs">${s.map(f=>c`<dt>${f.label}</dt><dd class=${Kc(f)?"num":""}>${a(this,S,Fn).call(this,e[f.key])}</dd>`)}</dl></td></tr>`:h}`},
|
|
2563
|
+
aria-valuemin=${Ny} aria-valuemax="1600"
|
|
2564
|
+
@keydown=${p=>a(this,S,Jy).call(this,p,e)} @pointerdown=${p=>a(this,S,Qy).call(this,p,e)}></span>`:h}</div></th>`},rx=function(e,t,i,s,l){let d=a(this,S,uf).call(this,e,i),p=this._expanded.has(e),u=`${r(this,Wn)}-more-${l}`,b=c`<tr part="row">${t.map(f=>f===i?c`<th scope="row" class=${a(this,S,Vn).call(this,f,i)} style=${a(this,S,jn).call(this,f)} part="cell">${a(this,S,ff).call(this,f,e,d)}${s.length?c`<button type="button" class="more-btn" aria-expanded=${p?"true":"false"} aria-controls=${u}
|
|
2565
|
+
@click=${()=>a(this,S,sx).call(this,e)}>${this.t(p?"viewLess":"viewAll")}</button>`:h}</th>`:c`<td class=${a(this,S,Vn).call(this,f,i)} style=${a(this,S,jn).call(this,f)} part="cell">${a(this,S,ff).call(this,f,e,d)}</td>`)}</tr>`;return c`${b}${s.length&&p?c`<tr class="more" id=${u} part="row-details"><td colspan=${t.length-s.length}>
|
|
2566
|
+
<dl class="pairs">${s.map(f=>c`<dt>${f.label}</dt><dd class=${Kc(f)?"num":""}>${a(this,S,Fn).call(this,e[f.key])}</dd>`)}</dl></td></tr>`:h}`},sx=function(e){let t=new Set(this._expanded);t.has(e)?t.delete(e):t.add(e),this._expanded=t},ax=function(e,t,i){let s=t.filter(p=>p!==i&&p.type!=="actions"),l=t.filter(p=>p.type==="actions"),d=(p,u=!1)=>{let b=a(this,S,uf).call(this,p,i);return c`<li class="card ${u?"total":""}" part="card">
|
|
2563
2567
|
<p class="card-title">${b}</p>
|
|
2564
2568
|
${s.length?c`<dl class="pairs">${s.map(f=>c`<dt>${f.label}</dt><dd class=${Kc(f)?"num":""}>${a(this,S,Fn).call(this,p[f.key])}</dd>`)}</dl>`:h}
|
|
2565
2569
|
${!u&&l.length?c`<div class="card-actions">${l.map(f=>a(this,S,gf).call(this,f,p,b))}</div>`:h}
|
|
2566
2570
|
</li>`};return c`${this.caption?c`<p class="cards-caption" aria-hidden="true">${this.caption}</p>`:h}
|
|
2567
|
-
<ul class="cards" part="cards" aria-label=${this.caption||h}>${e.map(p=>d(p))}${this.totals?d(this.totals,!0):h}</ul>`},Un.properties={columns:{type:Array},rows:{type:Array},totals:{type:Object},caption:{},captionHidden:{type:Boolean,attribute:"caption-hidden",reflect:!0},sort:{reflect:!0},direction:{reflect:!0},sortMode:{attribute:"sort-mode",reflect:!0},stickyHeader:{type:Boolean,attribute:"sticky-header",reflect:!0},stickyFirstColumn:{type:Boolean,attribute:"sticky-first-column",reflect:!0},loading:{type:Boolean,reflect:!0},loadingRows:{type:Number,attribute:"loading-rows"},density:{reflect:!0},mobile:{reflect:!0},rowActions:{attribute:"row-actions",reflect:!0},resizable:{type:Boolean,reflect:!0},columnPicker:{type:Boolean,attribute:"column-picker",reflect:!0},_light:{state:!0},_announce:{state:!0},_widths:{state:!0},_expanded:{state:!0},_picker:{state:!0},_overflows:{state:!0}},Un.styles=[E,
|
|
2571
|
+
<ul class="cards" part="cards" aria-label=${this.caption||h}>${e.map(p=>d(p))}${this.totals?d(this.totals,!0):h}</ul>`},Un.properties={columns:{type:Array},rows:{type:Array},totals:{type:Object},caption:{},captionHidden:{type:Boolean,attribute:"caption-hidden",reflect:!0},sort:{reflect:!0},direction:{reflect:!0},sortMode:{attribute:"sort-mode",reflect:!0},stickyHeader:{type:Boolean,attribute:"sticky-header",reflect:!0},stickyFirstColumn:{type:Boolean,attribute:"sticky-first-column",reflect:!0},loading:{type:Boolean,reflect:!0},loadingRows:{type:Number,attribute:"loading-rows"},density:{reflect:!0},mobile:{reflect:!0},rowActions:{attribute:"row-actions",reflect:!0},resizable:{type:Boolean,reflect:!0},columnPicker:{type:Boolean,attribute:"column-picker",reflect:!0},_light:{state:!0},_announce:{state:!0},_widths:{state:!0},_expanded:{state:!0},_picker:{state:!0},_overflows:{state:!0}},Un.styles=[E,Ie,w`
|
|
2568
2572
|
:host { display: block; font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); font-variant-numeric: tabular-nums; }
|
|
2569
2573
|
:host([density='compact']) { --cm-table-row-height: 40px; }
|
|
2570
2574
|
:host([density='comfortable']) { --cm-table-row-height: 48px; }
|
|
@@ -2724,7 +2728,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2724
2728
|
:host([mobile='priority']) tr.more { display: table-row; }
|
|
2725
2729
|
}
|
|
2726
2730
|
@media (forced-colors: active) { button.sort cm-icon { opacity: 1; } .acts { opacity: 1 !important; } }
|
|
2727
|
-
`];$("cm-data-table",Un);var
|
|
2731
|
+
`];$("cm-data-table",Un);var u_=z("resourceItem",{select:"Select {name}"}),g_=z("resourceList",{resourceName:"item",resourceNamePlural:"items",select:"Select",selectPageHidden:"all {count} {resource} on this page",selectionOptions:"Selection options",selectPage:"Select all {count} on this page",selectAll:"Select all {count} {resource}",selectNone:"Select none",selected:"{count} {resource} selected.",allSelected:"All {count} {resource} selected.",clearSelection:"Clear selection",loading:"Loading {resource}"}),nx=w`
|
|
2728
2732
|
.check { position: relative; display: inline-flex; flex: none; width: 16px; height: 16px; }
|
|
2729
2733
|
.check input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
|
|
2730
2734
|
.check input:disabled { cursor: not-allowed; }
|
|
@@ -2736,17 +2740,17 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2736
2740
|
.dash { width: 50%; height: 2px; background: currentColor; }
|
|
2737
2741
|
.check input:focus-visible + .box { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
2738
2742
|
.check input:disabled + .box { border-color: var(--cm-border-subtle); background: var(--cm-bg-input-filled); }
|
|
2739
|
-
`,zm,eo,
|
|
2743
|
+
`,zm,eo,ox,lx,Qn=class extends C{constructor(){super();m(this,eo);this.value="";this.selected=!1;this.disabled=!1;this.href="";this.label="";this.selectable=!1;this.columns=!1;this.actions="auto";this._hasActions=!1;m(this,zm,this.attachInternals());r(this,zm).role="listitem"}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","listitem")}get name(){return this.label||this.textContent.replace(/\s+/g," ").trim()}toggle(e){if(this.disabled)return;let t=e??!this.selected;t!==this.selected&&(this.selected=t,this.dispatchEvent(new CustomEvent("cm-resource-select",{detail:{value:this.value,selected:t},bubbles:!0,composed:!0})))}render(){return c`
|
|
2740
2744
|
${this.href&&!this.disabled?c`<a href=${this.href} part="link"><span class="sr">${this.name}</span></a>`:h}
|
|
2741
|
-
<div class=${this._hasActions?"row has-actions":"row"} part="row" @click=${a(this,eo,
|
|
2745
|
+
<div class=${this._hasActions?"row has-actions":"row"} part="row" @click=${a(this,eo,lx)}>
|
|
2742
2746
|
${this.selectable?c`<span class="check" part="checkbox"><input type="checkbox" aria-label=${this.t("select",{name:this.name})} .checked=${this.selected}
|
|
2743
2747
|
?disabled=${this.disabled} @change=${e=>this.toggle(e.target.checked)} />
|
|
2744
2748
|
<span class="box" aria-hidden="true">${this.selected?c`<cm-icon name="check" size="12"></cm-icon>`:h}</span></span>`:h}
|
|
2745
2749
|
<span class="media"><slot name="media"></slot></span>
|
|
2746
2750
|
<div class="content" part="content"><slot></slot></div>
|
|
2747
|
-
<div class="actions" part="actions"><slot name="actions" @slotchange=${a(this,eo,
|
|
2751
|
+
<div class="actions" part="actions"><slot name="actions" @slotchange=${a(this,eo,ox)}></slot></div>
|
|
2748
2752
|
</div>
|
|
2749
|
-
`}};zm=new WeakMap,eo=new WeakSet,
|
|
2753
|
+
`}};zm=new WeakMap,eo=new WeakSet,ox=function(e){this._hasActions=e.target.assignedNodes().some(t=>t.nodeType===Node.ELEMENT_NODE||t.textContent?.trim())},lx=function(e){!this.selectable||this.href||this.disabled||e.composedPath().some(i=>i instanceof HTMLElement&&i!==this&&i.matches('a, button, input, select, textarea, label, [role="button"], cm-button'))||getSelection()?.toString()||this.toggle()},Qn.properties={value:{reflect:!0},selected:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},href:{},label:{},selectable:{type:Boolean,reflect:!0},columns:{type:Boolean,reflect:!0},mobile:{reflect:!0},actions:{reflect:!0},_hasActions:{state:!0}},Qn.styles=[E,nx,w`
|
|
2750
2754
|
:host { display: block; position: relative; border-bottom: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
2751
2755
|
:host(:last-child) { border-bottom: 0; }
|
|
2752
2756
|
/* 56px rows (a 40px thumbnail with space-8 above and below), 14px text; compact density (since 1.6): 40px rows,
|
|
@@ -2797,7 +2801,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2797
2801
|
:host([columns][mobile='stack']) ::slotted(*) { overflow-wrap: break-word; }
|
|
2798
2802
|
:host([columns][mobile='stack']) ::slotted(:first-child) { flex: 1 1 100%; }
|
|
2799
2803
|
}
|
|
2800
|
-
`];$("cm-resource-item",Qn);var Gc,Yc,Re,
|
|
2804
|
+
`];$("cm-resource-item",Qn);var Gc,Yc,Re,cx,bf,Sm,Lm,Jn,Cm,Am,Zn=class extends C{constructor(){super();m(this,Re);this.selectable=!1;this.total=0;this.resourceNamePlural="";this.loading=!1;this.allSelected=!1;this.hideSelectMenu=!1;this.label="";this.mobile="columns";this._count=0;this._rows=0;this._hasHeader=!1;this._hasTable=!1;this._hasActions=!1;m(this,Gc,N("cm-rl"));m(this,Yc,new Set);m(this,Sm,e=>{let t=e.target;this._hasHeader=t.assignedElements().length>0,a(this,Re,bf).call(this,t)});m(this,Lm,e=>{this._hasActions=e.target.assignedElements().length>0});m(this,Am,e=>{e.stopPropagation();let t=e.detail.value;t==="page"?this.selectPage(!0):t==="all"?this.selectAll():t==="none"&&this.clearSelection()});this.addEventListener("cm-resource-select",e=>{e.target!==this&&(this.allSelected=!1,a(this,Re,Jn).call(this),a(this,Re,Cm).call(this))})}connectedCallback(){super.connectedCallback(),$m(this)}get items(){return[...this.querySelectorAll(":scope > cm-resource-item")]}get selected(){return this.items.filter(e=>e.selected).map(e=>e.value)}selectPage(e=!0){this.items.forEach(t=>{t.disabled||(t.selected=e)}),e||(this.allSelected=!1),a(this,Re,Jn).call(this),a(this,Re,Cm).call(this)}selectAll(){this.items.forEach(e=>{e.disabled||(e.selected=!0)}),this.allSelected=!0,a(this,Re,Jn).call(this),a(this,Re,Cm).call(this)}clearSelection(){this.selectPage(!1)}updated(e){(e.has("selectable")||e.has("mobile"))&&(a(this,Re,Jn).call(this),a(this,Re,bf).call(this))}render(){let e=this._count,t=this._rows,i=this.items.filter(k=>!k.disabled).length,s=i>0&&e>=i,l=a(this,Re,cx).call(this),d=k=>mh(k,this.locale)==="one"?this.resourceName:l,p=this.total>t,u=h;this.allSelected?u=c`${this.t("allSelected",{count:Math.max(this.total,e),resource:l})} <button type="button" @click=${()=>this.clearSelection()}>${this.t("clearSelection")}</button>`:e&&(u=c`${this.t("selected",{count:e,resource:d(e)})}${s&&p?c` <button type="button" @click=${()=>this.selectAll()}>${this.t("selectAll",{count:this.total,resource:l})}</button>`:h}`);let b=e>0||this.allSelected,f=this._hasTable,x=!this.hideSelectMenu&&(!f||b),v=c`<slot name="actions" @slotchange=${r(this,Lm)}></slot>`;return c`
|
|
2801
2805
|
${this.selectable&&f?c`<div class="top ${this._hasActions?"has":""}" part="top-actions">${v}</div>`:h}
|
|
2802
2806
|
<div class="head ${this.selectable||this._hasHeader?"on":""} ${f?"over":""}">
|
|
2803
2807
|
<div class="header ${this._hasHeader?"has":""}"><slot name="header" @slotchange=${r(this,Sm)}></slot></div>
|
|
@@ -2822,7 +2826,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2822
2826
|
${this.loading?c`<span class="spinner" part="spinner" role="progressbar" aria-label=${this.t("loading",{resource:l})}></span>`:h}
|
|
2823
2827
|
</div>
|
|
2824
2828
|
<div class="empty ${t||this.loading?"":"show"}"><slot name="empty"></slot></div>
|
|
2825
|
-
`}};Gc=new WeakMap,Yc=new WeakMap,Re=new WeakSet,
|
|
2829
|
+
`}};Gc=new WeakMap,Yc=new WeakMap,Re=new WeakSet,cx=function(){if(this.resourceNamePlural)return this.resourceNamePlural;let e=this.resourceName;return e!==this.t("resourceName")?`${e}s`:this.t("resourceNamePlural")},bf=function(e=this.renderRoot?.querySelector('slot[name="header"]')){if(!e)return;let t=new Set;for(let i of e.assignedElements())i.localName==="cm-table-header"&&t.add(i),i.querySelectorAll("cm-table-header").forEach(s=>t.add(s));for(let i of r(this,Yc))t.has(i)||(i.removeAttribute("resource-rows"),i.removeAttribute("mobile"));for(let i of t)i.setAttribute("resource-rows",this.selectable?"selectable":"plain"),this.mobile==="stack"?i.setAttribute("mobile","stack"):i.removeAttribute("mobile");g(this,Yc,t),this._hasTable=t.size>0},Sm=new WeakMap,Lm=new WeakMap,Jn=function(){let e=this.items;e.forEach(t=>{t.selectable=this.selectable,t.mobile=this.mobile==="stack"?"stack":void 0}),this._rows=e.length,this._count=e.filter(t=>t.selected).length},Cm=function(){this.dispatchEvent(new CustomEvent("cm-selection-change",{detail:{selected:this.selected,all:this.allSelected},bubbles:!0,composed:!0}))},Am=new WeakMap,Zn.properties={selectable:{type:Boolean,reflect:!0},total:{type:Number},resourceName:{attribute:"resource-name",string:"resourceName"},resourceNamePlural:{attribute:"resource-name-plural"},loading:{type:Boolean,reflect:!0},allSelected:{type:Boolean,attribute:"all-selected",reflect:!0},hideSelectMenu:{type:Boolean,attribute:"hide-select-menu"},label:{},density:{reflect:!0},mobile:{reflect:!0},_count:{state:!0},_rows:{state:!0},_hasHeader:{state:!0},_hasTable:{state:!0},_hasActions:{state:!0}},Zn.styles=[E,nx,w`
|
|
2826
2830
|
:host { display: block; position: relative; background: var(--cm-bg-surface); border-radius: var(--cm-radius-md); --_pad: var(--cm-space-12); --_cm-row-inset: var(--_pad); }
|
|
2827
2831
|
/* Density (since 1.6): the rows are this element's children, so they inherit these. See density.ts. */
|
|
2828
2832
|
:host([density='compact']) { --cm-resource-row-height: 40px; --cm-resource-row-padding: 4px; --cm-resource-media-size: 32px; }
|
|
@@ -2880,11 +2884,11 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2880
2884
|
.toolbar .check { width: 20px; height: 20px; }
|
|
2881
2885
|
.spinner { width: 32px; height: 32px; margin: -16px; border-width: 3px; }
|
|
2882
2886
|
}
|
|
2883
|
-
`];$("cm-resource-list",Zn);var
|
|
2884
|
-
<div class="row" part="row" @dragover=${a(this,he,
|
|
2887
|
+
`];$("cm-resource-list",Zn);var w_=z("nestedItem",{reorder:"Reorder {label}",hint:"Press up or down arrow to move.",hintGroup:"Press up or down arrow to move. At either end of the list, the arrow moves it into the list before or after.",moved:"{label} moved to position {position} of {total}.",movedTo:"{label} moved to {list}, position {position} of {total}."}),$_=z("nestedList",{show:"Show {heading}",hide:"Hide {heading}"}),Rm,he,vf,yf,dx,hx,mr,px,mx,ux,xf,gx,Pt=class Pt extends C{constructor(){super();m(this,he);this.label="";this.value="";this.sortable=!1;this._hasChildren=!1;m(this,Rm,this.attachInternals());m(this,mr,!1);r(this,Rm).role="listitem"}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","listitem")}get list(){let e=this.parentElement;return e?.localName==="cm-nested-list"?e:null}moveToList(e,t){let i=this.list;if(!i||!e)return!1;if(e===i)return t===void 0?!1:this.moveTo(t);if(!i.group||e.group!==i.group)return!1;let s=e.items,l=Math.max(0,Math.min(s.length,t??s.length)),d={item:this,from:i.items.indexOf(this),to:l,fromList:i,toList:e};return this.dispatchEvent(new CustomEvent("cm-move",{detail:d,bubbles:!0,composed:!0,cancelable:!0}))?(e.insertBefore(this,s[l]??null),e.announce(this.t("movedTo",{label:this.label,list:e.heading,position:l+1,total:s.length+1})),!0):!1}get siblings(){return[...this.parentElement.children].filter(e=>e.localName==="cm-nested-item")}moveTo(e){let t=this.siblings,i=t.indexOf(this);if(e=Math.max(0,Math.min(t.length-1,e)),e===i)return!1;let s=new CustomEvent("cm-reorder",{detail:{item:this,from:i,to:e},bubbles:!0,composed:!0,cancelable:!0});if(!this.dispatchEvent(s))return!1;let l=t[e];return l.parentElement.insertBefore(this,e>i?l.nextSibling:l),this.closest("cm-nested-list")?.announce(this.t("moved",{label:this.label,position:e+1,total:t.length})),!0}render(){return c`
|
|
2888
|
+
<div class="row" part="row" @dragover=${a(this,he,ux)} @dragleave=${a(this,he,xf)} @drop=${a(this,he,gx)}>
|
|
2885
2889
|
${this.sortable?c`<button class="handle" type="button" part="handle" draggable="true" aria-label=${this.t("reorder",{label:this.label})}
|
|
2886
2890
|
aria-describedby="hint"
|
|
2887
|
-
@keydown=${a(this,he,
|
|
2891
|
+
@keydown=${a(this,he,dx)} @dragstart=${a(this,he,hx)} @pointerdown=${a(this,he,px)}
|
|
2888
2892
|
@dragend=${()=>{this.classList.remove("dragging"),Pt.dragged=null,Xc(this,null)}}><cm-icon name="drag" size="16"></cm-icon></button>`:h}
|
|
2889
2893
|
${this.sortable?c`<span class="sr" id="hint">${this.t(this.list?.group?"hintGroup":"hint")}</span>`:h}
|
|
2890
2894
|
<span class="label" part="label">${this.label}</span>
|
|
@@ -2893,7 +2897,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2893
2897
|
<div class="children ${this._hasChildren?"has":""}" role="list" aria-label=${this.label}>
|
|
2894
2898
|
<slot @slotchange=${e=>{let t=e.target.assignedElements().filter(i=>i.localName==="cm-nested-item");t.forEach(i=>i.sortable=this.sortable),this._hasChildren=t.length>0}}></slot>
|
|
2895
2899
|
</div>
|
|
2896
|
-
`}updated(e){e.has("sortable")&&[...this.children].forEach(t=>{t.localName==="cm-nested-item"&&(t.sortable=this.sortable)})}};Rm=new WeakMap,he=new WeakSet,vf=function(){let e=this.list;return e?.group?[...e.getRootNode().querySelectorAll("cm-nested-list")].filter(i=>i===e||i.group===e.group&&i.sortable&&(!i.collapsible||i.open)):[]},yf=function(){let e=()=>this.renderRoot.querySelector(".handle")?.focus();e(),requestAnimationFrame(e)},
|
|
2900
|
+
`}updated(e){e.has("sortable")&&[...this.children].forEach(t=>{t.localName==="cm-nested-item"&&(t.sortable=this.sortable)})}};Rm=new WeakMap,he=new WeakSet,vf=function(){let e=this.list;return e?.group?[...e.getRootNode().querySelectorAll("cm-nested-list")].filter(i=>i===e||i.group===e.group&&i.sortable&&(!i.collapsible||i.open)):[]},yf=function(){let e=()=>this.renderRoot.querySelector(".handle")?.focus();e(),requestAnimationFrame(e)},dx=function(e){let t=this.siblings.indexOf(this),i=e.key==="ArrowUp",s=e.key==="ArrowDown";if(i&&t===0||s&&t===this.siblings.length-1){let d=r(this,he,vf),p=d[d.indexOf(this.list)+(i?-1:1)];if(p){e.preventDefault(),this.moveToList(p,i?p.items.length:0)&&a(this,he,yf).call(this);return}}let l;if(e.key==="ArrowUp")l=t-1;else if(e.key==="ArrowDown")l=t+1;else if(e.key==="Home")l=0;else if(e.key==="End")l=this.siblings.length-1;else return;e.preventDefault(),this.moveTo(l)&&a(this,he,yf).call(this)},hx=function(e){if(e.stopPropagation(),r(this,mr)){e.preventDefault();return}Pt.dragged=this,this.classList.add("dragging"),e.dataTransfer?.setData("text/plain",this.label),e.dataTransfer&&(e.dataTransfer.effectAllowed="move")},mr=new WeakMap,px=function(e){if(e.pointerType==="mouse"||!e.isPrimary)return;let t=e.clientY,i=null,s=d=>{if(d.pointerId===e.pointerId){if(!r(this,mr)){if(Math.abs(d.clientY-t)<6)return;g(this,mr,!0),Pt.dragged=this,this.classList.add("dragging")}d.preventDefault(),i=a(this,he,mx).call(this,d.clientX,d.clientY),Xc(this,i)}},l=d=>{if(d.pointerId!==e.pointerId)return;document.removeEventListener("pointermove",s,!0),document.removeEventListener("pointerup",l,!0),document.removeEventListener("pointercancel",l,!0);let p=r(this,mr);g(this,mr,!1),Pt.dragged=null,this.classList.remove("dragging"),Xc(this,null),!(!p||d.type==="pointercancel"||!i)&&(i.list?this.moveToList(i.list,i.index):this.moveTo(i.index))};document.addEventListener("pointermove",s,!0),document.addEventListener("pointerup",l,!0),document.addEventListener("pointercancel",l,!0)},mx=function(e,t){for(let i of r(this,he,vf)){if(i===this.list)continue;let s=i.getBoundingClientRect();if(e>=s.left&&e<=s.right&&t>=s.top&&t<=s.bottom)return{list:i,index:Dm(i.items,this,t)}}return{index:Dm(this.siblings,this,t)}},ux=function(e){let t=Pt.dragged;if(!t||t===this||t.parentElement!==this.parentElement)return;e.preventDefault(),e.stopPropagation();let i=this.renderRoot.querySelector(".row").getBoundingClientRect(),s=e.clientY>i.top+i.height/2;this.classList.toggle("drop-after",s),this.classList.toggle("drop-before",!s)},xf=function(){this.classList.remove("drop-before","drop-after")},gx=function(e){let t=Pt.dragged;if(!t||t===this||t.parentElement!==this.parentElement)return;e.preventDefault(),e.stopPropagation();let i=this.classList.contains("drop-after");a(this,he,xf).call(this);let s=this.siblings,l=s.indexOf(t),d=s.indexOf(this)+(i?1:0);d>l&&(d-=1),t.moveTo(d)},Pt.properties={label:{},value:{reflect:!0},sortable:{type:Boolean,reflect:!0},_hasChildren:{state:!0}},Pt.styles=[E,w`
|
|
2897
2901
|
:host { display: block; }
|
|
2898
2902
|
.row {
|
|
2899
2903
|
display: flex; align-items: center; gap: var(--cm-space-12); min-height: 48px; padding: 0 var(--cm-space-16);
|
|
@@ -2920,20 +2924,20 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2920
2924
|
.actions { gap: var(--cm-space-8); }
|
|
2921
2925
|
.children { margin-inline-start: var(--cm-space-20); }
|
|
2922
2926
|
}
|
|
2923
|
-
`],Pt.dragged=null;var io=Pt;$("cm-nested-item",io);function Dm(o,n,e){return o.filter(t=>{if(t===n)return!1;let i=t.getBoundingClientRect();return i.top+i.height/2<e}).length}function Xc(o,n){if((o.list??o).getRootNode().querySelectorAll("cm-nested-item.drop-before, cm-nested-item.drop-after, cm-nested-list.drop-target").forEach(i=>i.classList.remove("drop-before","drop-after","drop-target")),!n)return;let t=(n.list?n.list.items:o.siblings).filter(i=>i!==o);t.length?n.index<t.length?t[n.index].classList.add("drop-before"):t[t.length-1].classList.add("drop-after"):n.list?.classList.add("drop-target")}var zs,
|
|
2927
|
+
`],Pt.dragged=null;var io=Pt;$("cm-nested-item",io);function Dm(o,n,e){return o.filter(t=>{if(t===n)return!1;let i=t.getBoundingClientRect();return i.top+i.height/2<e}).length}function Xc(o,n){if((o.list??o).getRootNode().querySelectorAll("cm-nested-item.drop-before, cm-nested-item.drop-after, cm-nested-list.drop-target").forEach(i=>i.classList.remove("drop-before","drop-after","drop-target")),!n)return;let t=(n.list?n.list.items:o.siblings).filter(i=>i!==o);t.length?n.index<t.length?t[n.index].classList.add("drop-before"):t[t.length-1].classList.add("drop-after"):n.list?.classList.add("drop-target")}var zs,st,fx,wf,$f,bx,vx,to=class extends C{constructor(){super(...arguments);m(this,st);this.heading="";this.headingLevel=2;this.sortable=!1;this.collapsible=!1;this.open=!0;this.group="";this._msg="";this._empty=!1;m(this,zs,N("cm-nl"))}get items(){return[...this.children].filter(e=>e.localName==="cm-nested-item")}announce(e){this._msg="",requestAnimationFrame(()=>this._msg=e)}willUpdate(){this.hasUpdated||(this._empty=!this.items.length)}updated(e){(e.has("sortable")||e.has("group"))&&a(this,st,wf).call(this)}render(){let e=Math.min(6,Math.max(1,this.headingLevel||2)),t=!this.collapsible||this.open;return c`
|
|
2924
2928
|
<div class="bar" part="bar">
|
|
2925
2929
|
<div class="title" part="heading" role="heading" aria-level=${e} id="${r(this,zs)}-h">${this.heading}</div>
|
|
2926
2930
|
<span class="actions"><slot name="actions"></slot></span>
|
|
2927
2931
|
${this.collapsible?c`<button class="toggle" type="button" part="toggle" aria-expanded=${t?"true":"false"} aria-controls="${r(this,zs)}-rows"
|
|
2928
|
-
aria-label=${this.t(t?"hide":"show",{heading:this.heading})} @click=${a(this,
|
|
2932
|
+
aria-label=${this.t(t?"hide":"show",{heading:this.heading})} @click=${a(this,st,fx)}>
|
|
2929
2933
|
<cm-icon name=${t?"chevron-up":"chevron-down"} size="16"></cm-icon></button>`:h}
|
|
2930
2934
|
</div>
|
|
2931
2935
|
<div class="rows ${this.group&&this._empty?"empty":""}" id="${r(this,zs)}-rows" role="list" aria-labelledby="${r(this,zs)}-h" ?hidden=${!t}
|
|
2932
|
-
@dragover=${a(this,
|
|
2933
|
-
<slot @slotchange=${()=>{a(this,
|
|
2936
|
+
@dragover=${a(this,st,bx)} @drop=${a(this,st,vx)}>
|
|
2937
|
+
<slot @slotchange=${()=>{a(this,st,wf).call(this),this._empty=!this.items.length}}></slot>
|
|
2934
2938
|
</div>
|
|
2935
2939
|
<span class="sr" role="status">${this._msg}</span>
|
|
2936
|
-
`}};zs=new WeakMap,
|
|
2940
|
+
`}};zs=new WeakMap,st=new WeakSet,fx=function(){this.open=!this.open,this.dispatchEvent(new CustomEvent("cm-toggle",{detail:{open:this.open},bubbles:!0,composed:!0}))},wf=function(){this.items.forEach(t=>{t.sortable=this.sortable,t.requestUpdate()})},$f=function(e){let t=e?.list;return!!e&&!!t&&t!==this&&!!this.group&&t.group===this.group&&this.sortable&&(!this.collapsible||this.open)},bx=function(e){let t=io.dragged;a(this,st,$f).call(this,t)&&(e.preventDefault(),Xc(t,{list:this,index:Dm(this.items,t,e.clientY)}))},vx=function(e){let t=io.dragged;if(!a(this,st,$f).call(this,t))return;e.preventDefault();let i=Dm(this.items,t,e.clientY);Xc(t,null),t.moveToList(this,i)},to.properties={heading:{},headingLevel:{type:Number,attribute:"heading-level"},sortable:{type:Boolean,reflect:!0},collapsible:{type:Boolean,reflect:!0},open:{type:Boolean,reflect:!0},group:{reflect:!0},_msg:{state:!0},_empty:{state:!0}},to.styles=[E,w`
|
|
2937
2941
|
:host { display: block; }
|
|
2938
2942
|
.bar {
|
|
2939
2943
|
display: flex; align-items: center; gap: var(--cm-space-12); min-height: 64px; padding: 0 var(--cm-space-20);
|
|
@@ -2957,7 +2961,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2957
2961
|
.title { font-size: var(--cm-type-heading-sm-size); line-height: var(--cm-type-heading-sm-line-height); }
|
|
2958
2962
|
.rows { margin-inline-start: var(--cm-space-8); }
|
|
2959
2963
|
}
|
|
2960
|
-
`];$("cm-nested-list",to);var
|
|
2964
|
+
`];$("cm-nested-list",to);var yx=(o,n,e)=>{let t=new Map;for(let i=n;i<=e;i++)t.set(o[i],i);return t},xx=ca(class extends Ni{constructor(o){if(super(o),o.type!==At.CHILD)throw Error("repeat() can only be used in text expressions")}dt(o,n,e){let t;e===void 0?e=n:n!==void 0&&(t=n);let i=[],s=[],l=0;for(let d of o)i[l]=t?t(d,l):l,s[l]=e(d,l),l++;return{values:s,keys:i}}render(o,n,e){return this.dt(o,n,e).values}update(o,[n,e,t]){let i=Wb(o),{values:s,keys:l}=this.dt(n,e,t);if(!Array.isArray(i))return this.ut=l,s;let d=this.ut??=[],p=[],u,b,f=0,x=i.length-1,v=0,k=s.length-1;for(;f<=x&&v<=k;)if(i[f]===null)f++;else if(i[x]===null)x--;else if(d[f]===l[v])p[v]=Pi(i[f],s[v]),f++,v++;else if(d[x]===l[k])p[k]=Pi(i[x],s[k]),x--,k--;else if(d[f]===l[k])p[k]=Pi(i[f],s[k]),da(o,p[k+1],i[f]),f++,k--;else if(d[x]===l[v])p[v]=Pi(i[x],s[v]),da(o,i[f],i[x]),x--,v++;else if(u===void 0&&(u=yx(l,v,k),b=yx(d,f,x)),u.has(d[f]))if(u.has(d[x])){let L=b.get(l[v]),P=L!==void 0?i[L]:null;if(P===null){let U=da(o,i[f]);Pi(U,s[v]),p[v]=U}else p[v]=Pi(P,s[v]),da(o,i[f],P),i[L]=null;v++}else Sh(i[x]),x--;else Sh(i[f]),f++;for(;v<=k;){let L=da(o,p[k+1]);Pi(L,s[v]),p[v++]=L}for(;f<=x;){let L=i[f++];L!==null&&Sh(L)}return this.ut=l,zh(o,p),Pe}});function wx(o,n,e){let t=l=>e.slotCount(l),i=l=>Math.max(0,t(l)-1),s=l=>{for(let d=n.group+l;d>=0&&d<e.groupCount();d+=l)if(t(d)>0)return{group:d,index:Math.min(n.index,i(d))};return{...n}};switch(o){case"ArrowRight":return s(1);case"ArrowLeft":return s(-1);case"ArrowDown":return{group:n.group,index:Math.min(n.index+1,i(n.group))};case"ArrowUp":return{group:n.group,index:Math.max(n.index-1,0)};case"Home":return{group:n.group,index:0};case"End":return{group:n.group,index:i(n.group)};default:return null}}var ve,mt,ut,Ls=class{constructor(n){m(this,ve);m(this,mt,null);m(this,ut,null);g(this,ve,n)}get active(){return r(this,mt)!==null}get from(){return r(this,mt)&&{...r(this,mt)}}get target(){return r(this,ut)&&{...r(this,ut)}}groupCount(){return r(this,ve).groupCount()}slotCount(n){return n>=0&&n<r(this,ve).groupCount()?r(this,ve).slotCount(n):0}pickUp(n){this.active&&this.cancel(),g(this,mt,{...n}),g(this,ut,{...n}),r(this,ve).onTarget?.(this.target),r(this,ve).announce(r(this,ve).messages.pickedUp(this.target))}moveTo(n){if(!r(this,ut))return;let e=Math.max(0,Math.min(n.group,r(this,ve).groupCount()-1)),t=this.slotCount(e);t<=0||(g(this,ut,{group:e,index:Math.max(0,Math.min(n.index,t-1))}),r(this,ve).onTarget?.(this.target),r(this,ve).announce(r(this,ve).messages.over(this.target)))}drop(){if(!r(this,mt)||!r(this,ut))return;let n=r(this,mt),e=r(this,ut);g(this,mt,g(this,ut,null)),r(this,ve).onTarget?.(null),r(this,ve).onDrop(n,e)}cancel(n=!1){if(!r(this,mt))return;let e=r(this,mt),t=n?"":r(this,ve).messages.cancelled(e);g(this,mt,g(this,ut,null)),r(this,ve).onTarget?.(null),r(this,ve).onCancel?.(e),t&&r(this,ve).announce(t)}handleKey(n,e=n.key){if(!this.active||n.altKey||n.ctrlKey||n.metaKey)return!1;if(e===" "||e==="Enter")return this.drop(),!0;if(e==="Escape")return this.cancel(),!0;if(e==="Tab")return this.cancel(),!1;let t=(r(this,ve).navigate??wx)(e,r(this,ut),this);return t?(this.moveTo(t),!0):!1}};ve=new WeakMap,mt=new WeakMap,ut=new WeakMap;var Jc,Ss,As=class{constructor(n=document,e="assertive"){m(this,Jc);m(this,Ss);let t=n.createElement("div");t.setAttribute("aria-live",e),t.setAttribute("aria-atomic","true"),t.className="cm-announcer",Object.assign(t.style,{position:"absolute",width:"1px",height:"1px",margin:"-1px",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:"0"}),this.element=t}get text(){return r(this,Ss)??this.element.textContent??""}announce(n){clearTimeout(r(this,Jc)),this.element.textContent===n?(this.element.textContent="",g(this,Ss,n),g(this,Jc,setTimeout(()=>{this.element.textContent=n,g(this,Ss,void 0)},50))):(g(this,Ss,void 0),this.element.textContent=n)}};Jc=new WeakMap,Ss=new WeakMap;var q_=z("boardCard",{roleDescription:"movable card",instructions:"Press Space to pick up. Then use the arrow keys to choose a column and a position, Space or Enter to drop, and Escape to cancel.",openHint:"Press Enter to open.",saving:"Saving"}),O_=z("boardColumn",{count:{one:"{count} card",other:"{count} cards"},loadMore:"Load more",loading:"Loading {column}",empty:"No cards"}),B_=z("board",{label:"Board",pickedUp:"Picked up {card}. Column {column}, position {position} of {count}.",over:"Column {column}, position {position} of {count}.",moved:"Moved {card} to {column}, position {position} of {count}.",sameSpot:"{card} dropped where it started.",cancelled:"Move cancelled. {card} is back in {column}.",refused:"{card} can't be moved to {column}.",reverted:"Couldn't move {card}. It is back in {column}."}),F0="input, select, textarea, [contenteditable], cm-action-menu, cm-select, cm-text-field, [data-no-drag]",Qc,Im,$x,Ds=class extends C{constructor(){super(...arguments);m(this,Im);this.value="";this.label="";this.heading="";this.href="";this.locked=!1;this.pending=!1;this.moving=!1;this._badges=!1;this._slottedTitle="";m(this,Qc,N("cm-bc"))}get name(){let e=i=>(i??"").replace(/\s+/g," ").trim();if(this.label)return this.label;if(this.heading)return this.heading;let t=this.querySelector(':scope > [slot="heading"]');return t?e(t.textContent):e(this.textContent).slice(0,80)}get key(){return this.value||this.name}get opener(){if(this.href)return this.renderRoot?.querySelector(".title a")??null;let e=this.querySelector(':scope > [slot="heading"]');return e?e.matches("a[href], button, cm-button")?e:e.querySelector("a[href], button, cm-button"):null}focusHandle(e){let t=this.renderRoot?.querySelector(".handle");t?t.focus(e):this.focus(e)}open(){let e=this.opener;return e?(e.click(),!0):!1}render(){let e=!!(this.href||this.querySelector(':scope > [slot="heading"] a[href], :scope > [slot="heading"] button, :scope > a[slot="heading"][href], :scope > button[slot="heading"]')),t=this.pending;return c`<div class="card" part="card">
|
|
2961
2965
|
${this.locked?h:c`<div class="handle" part="handle" tabindex="0" role="button" aria-roledescription=${this.t("roleDescription")}
|
|
2962
2966
|
aria-label=${t?`${this.name}, ${this.t("saving")}`:this.name} aria-describedby="${r(this,Qc)}-help"></div>`}
|
|
2963
2967
|
<div class="content">
|
|
@@ -2967,11 +2971,11 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2967
2971
|
<slot name="actions"></slot>
|
|
2968
2972
|
</div>
|
|
2969
2973
|
<div class="lines"><slot></slot></div>
|
|
2970
|
-
<div class="badges" ?hidden=${!this._badges}><slot name="badges" @slotchange=${i=>a(this,Im
|
|
2974
|
+
<div class="badges" ?hidden=${!this._badges}><slot name="badges" @slotchange=${i=>a(this,Im,$x).call(this,i,"_badges")}></slot></div>
|
|
2971
2975
|
</div>
|
|
2972
2976
|
${t?c`<cm-spinner class="spin" size="small" accessible-label=${this.t("saving")} aria-hidden="true"></cm-spinner>`:h}
|
|
2973
2977
|
<span id="${r(this,Qc)}-help" hidden>${e?`${this.t("openHint")} `:""}${this.t("instructions")}</span>
|
|
2974
|
-
</div>`}};Qc=new WeakMap,Im=new WeakSet
|
|
2978
|
+
</div>`}};Qc=new WeakMap,Im=new WeakSet,$x=function(e,t){this[t]=e.target.assignedElements({flatten:!0}).length>0},Ds.shadowRootOptions={...A.shadowRootOptions,delegatesFocus:!0},Ds.properties={value:{reflect:!0},label:{},heading:{},href:{},locked:{type:Boolean,reflect:!0},pending:{type:Boolean,reflect:!0},moving:{type:Boolean,reflect:!0},_badges:{state:!0},_slottedTitle:{state:!0}},Ds.styles=[E,w`
|
|
2975
2979
|
:host { display: block; position: relative; -webkit-touch-callout: none; font-size: 14px; line-height: 20px; }
|
|
2976
2980
|
.card {
|
|
2977
2981
|
position: relative; display: block; padding: var(--cm-space-12) var(--cm-space-12); background: var(--cm-bg-surface);
|
|
@@ -2996,7 +3000,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
2996
3000
|
:host([moving]) .content { opacity: 0.5; }
|
|
2997
3001
|
:host([ghost]) .card { cursor: grabbing; box-shadow: var(--cm-shadow-lg); border-color: var(--cm-border-subtle); }
|
|
2998
3002
|
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
2999
|
-
`];$("cm-board-card",Ds);var ao,Zc,no,oo,gr,Hm,
|
|
3003
|
+
`];$("cm-board-card",Ds);var ao,Zc,no,oo,gr,Hm,kx,Rs=class extends C{constructor(){super(...arguments);m(this,gr);this.value="";this.heading="";this.hasMore=!1;this.loading=!1;this.headingLevel=3;m(this,ao,!1);this._cards=[];this._drop=null;m(this,Zc,new MutationObserver(()=>a(this,gr,Hm).call(this)));m(this,no,N("cm-col"));m(this,oo,!1)}get collapsed(){return r(this,ao)}connectedCallback(){super.connectedCallback(),a(this,gr,Hm).call(this),r(this,Zc).observe(this,{childList:!0,attributes:!0,attributeFilter:["slot"]})}disconnectedCallback(){super.disconnectedCallback(),r(this,Zc).disconnect()}get cards(){return[...this.children].filter(e=>e.localName==="cm-board-card"&&!e.hasAttribute("slot"))}get key(){return this.value||this.heading}get count(){return typeof this.total=="number"&&!Number.isNaN(this.total)?this.total:this._cards.length}get scrollElement(){return this.renderRoot?.querySelector(".scroll")??null}_sync(){return a(this,gr,Hm).call(this),this.updateComplete}willUpdate(){let e=this.closest("cm-board");g(this,ao,!!e?.hideEmpty&&!this._cards.length&&!this.loading&&!(this.count>0)),this.toggleAttribute("collapsed",r(this,ao)),g(this,oo,this.renderRoot?.activeElement?.localName==="cm-button")}updated(){this.renderRoot.querySelectorAll("li > slot").forEach(i=>{let s=this._cards[Number(i.dataset.i)];s?i.assign(s):i.assign()});let t=i=>[...this.children].filter(s=>s.getAttribute("slot")===i);this.renderRoot.querySelector("slot.actions")?.assign(...t("actions")),this.renderRoot.querySelector("slot.empty")?.assign(...t("empty")),r(this,oo)&&!this.renderRoot.querySelector(".more cm-button")&&(g(this,oo,!1),this.renderRoot.querySelector("ul")?.focus())}render(){let e=this._cards,t=this._drop,i=this.count,s=t?e.filter(v=>v!==t.card):e,l=t?e.indexOf(t.card):-1,d=!!t&&!this.collapsed&&!(l>=0&&t.index===l),p=[];e.forEach((v,k)=>{d&&v!==t.card&&s.indexOf(v)===t.index&&p.push({key:"drop"}),p.push({key:v,card:v,i:k})}),d&&t.index>=s.length&&p.push({key:"drop"});let u=this.hasMore||i>e.length,b=this.loading,f=Math.min(6,Math.max(2,Math.round(this.headingLevel)||3)),x=this.t("count",{count:i});return c`<section aria-labelledby="${r(this,no)}-h" class=${t&&this.collapsed?"over":""}>
|
|
3000
3004
|
<header part="header">
|
|
3001
3005
|
<div class="title" id="${r(this,no)}-h" role="heading" aria-level=${f}>${this.heading}<span class="sr">, ${x}</span></div>
|
|
3002
3006
|
<span class="count" part="count" aria-hidden="true">${this.formatNumber(i)}</span>
|
|
@@ -3004,14 +3008,14 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3004
3008
|
</header>
|
|
3005
3009
|
<div class="scroll">
|
|
3006
3010
|
<ul part="list" role="list" aria-labelledby="${r(this,no)}-h" aria-busy=${b?"true":"false"} tabindex="-1" ?hidden=${this.collapsed}>
|
|
3007
|
-
${
|
|
3011
|
+
${xx(p,v=>v.key,v=>v.card?c`<li><slot data-i=${v.i}></slot></li>`:c`<li class="drop" aria-hidden="true"><div style="min-height:${Math.max(40,t.height)}px">${t.card.name}</div></li>`)}
|
|
3008
3012
|
</ul>
|
|
3009
3013
|
${b&&!e.length&&!this.collapsed?c`<div class="loading" aria-hidden="true"><cm-skeleton variant="block"></cm-skeleton><cm-skeleton variant="block"></cm-skeleton></div>`:h}
|
|
3010
3014
|
<div class="empty" ?hidden=${e.length>0||b||u||this.collapsed||d}><slot class="empty">${this.t("empty")}</slot></div>
|
|
3011
|
-
${u&&!this.collapsed?c`<div class="more"><cm-button part="more" size="medium" ?loading=${b} @click=${a(this,gr,
|
|
3015
|
+
${u&&!this.collapsed?c`<div class="more"><cm-button part="more" size="medium" ?loading=${b} @click=${a(this,gr,kx)}>${this.t("loadMore")}</cm-button></div>`:h}
|
|
3012
3016
|
</div>
|
|
3013
3017
|
<span class="sr" role="status">${b?this.t("loading",{column:this.heading}):""}</span>
|
|
3014
|
-
</section>`}};ao=new WeakMap,Zc=new WeakMap,no=new WeakMap,oo=new WeakMap,gr=new WeakSet,Hm=function(){this._cards=this.cards},
|
|
3018
|
+
</section>`}};ao=new WeakMap,Zc=new WeakMap,no=new WeakMap,oo=new WeakMap,gr=new WeakSet,Hm=function(){this._cards=this.cards},kx=function(){this.loading||this.dispatchEvent(new CustomEvent("cm-load-more",{detail:{column:this,value:this.key},bubbles:!0,composed:!0}))},Rs.shadowRootOptions={...A.shadowRootOptions,slotAssignment:"manual"},Rs.properties={value:{reflect:!0},heading:{},total:{type:Number},hasMore:{type:Boolean,attribute:"has-more",reflect:!0},loading:{type:Boolean,reflect:!0},headingLevel:{type:Number,attribute:"heading-level"},_cards:{state:!0},_drop:{state:!0}},Rs.styles=[E,w`
|
|
3015
3019
|
:host {
|
|
3016
3020
|
display: flex; flex-direction: column; flex: none; min-height: 0; max-height: 100%;
|
|
3017
3021
|
inline-size: var(--cm-board-column-width, 272px);
|
|
@@ -3048,9 +3052,9 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3048
3052
|
:host([collapsed]) .scroll { padding: 0; overflow: hidden; }
|
|
3049
3053
|
:host([collapsed]) .actions { display: none; }
|
|
3050
3054
|
:host([collapsed]) section.over { outline: 2px dashed var(--cm-border-strong); outline-offset: -2px; }
|
|
3051
|
-
`];$("cm-board-column",Rs);var
|
|
3055
|
+
`];$("cm-board-column",Rs);var Xe,Oe,$e,Hs,ce,I,kf,ro,Ex,Ef,Mx,_x,Tx,Cx,ed,zx,td,Mf,_f,Tf,Nm,Sx,id,rd,sd,ad,nd,od,ld,Cf,zf,Pm,Lx,ur,so=class extends C{constructor(){super();m(this,I);this.hideEmpty=!1;this.controlled=!1;this.dragging=!1;m(this,Xe,new As);m(this,Oe);m(this,$e,null);m(this,Hs,new WeakMap);m(this,ce,null);m(this,ed,e=>{if(r(this,ce)?.started&&e.key==="Escape"){e.preventDefault(),this.cancelMove();return}let t=se(e,this);if(r(this,Oe).active){r(this,Oe).handleKey(e,t)&&(e.preventDefault(),e.stopPropagation());return}let i=a(this,I,Cx).call(this,e.composedPath());if(!(!i||e.altKey||e.ctrlKey||e.metaKey)){if(e.key===" ")e.preventDefault(),this.pickUp(i);else if(e.key==="Enter")i.open()&&e.preventDefault();else if(t.startsWith("Arrow")){let s=a(this,I,zx).call(this,i,t);s&&(e.preventDefault(),s.focusHandle())}}});m(this,td,e=>{if(!r(this,Oe).active||!r(this,$e))return;let t=e.relatedTarget;t&&(t===r(this,$e).card||r(this,$e).card.contains(t))||!t&&document.hasFocus()===!1||queueMicrotask(()=>{r(this,Oe).active&&r(this,$e)&&!r(this,$e).card.matches(":focus-within")&&r(this,Oe).cancel()})});m(this,id,e=>{e.composedPath().some(t=>t.localName==="cm-board-card")&&e.preventDefault()});m(this,rd,e=>{if(r(this,ce)||!e.isPrimary||e.pointerType==="mouse"&&e.button!==0)return;let t=e.composedPath(),i=t.find(d=>d.localName==="cm-board-card");if(!i||i.locked||i.pending||t.some(d=>d instanceof Element&&d!==i&&d.matches?.(F0)))return;let s=a(this,I,ro).call(this,i);if(!s)return;r(this,Oe).active&&r(this,Oe).cancel();let l=i.getBoundingClientRect();g(this,ce,{card:i,pointerId:e.pointerId,type:e.pointerType,x0:e.clientX,y0:e.clientY,x:e.clientX,y:e.clientY,started:!1,dx:e.clientX-l.left,dy:e.clientY-l.top,width:l.width,height:l.height,from:s.column,fromIndex:s.index}),e.pointerType!=="mouse"&&(r(this,ce).timer=setTimeout(()=>{r(this,ce)&&!r(this,ce).started&&a(this,I,Cf).call(this)},300)),window.addEventListener("pointermove",r(this,nd),!0),window.addEventListener("pointerup",r(this,od),!0),window.addEventListener("pointercancel",r(this,ld),!0),window.addEventListener("touchmove",r(this,sd),{capture:!0,passive:!1}),window.addEventListener("contextmenu",r(this,ad),!0)});m(this,sd,e=>{r(this,ce)?.started&&e.cancelable&&e.preventDefault()});m(this,ad,e=>{r(this,ce)&&e.preventDefault()});m(this,nd,e=>{let t=r(this,ce);if(!(!t||e.pointerId!==t.pointerId)){if(t.x=e.clientX,t.y=e.clientY,!t.started){let i=Math.hypot(t.x-t.x0,t.y-t.y0);(t.type==="mouse"?i>4:i>8)&&(t.type==="mouse"?a(this,I,Cf).call(this):a(this,I,ur).call(this,!1));return}e.preventDefault(),a(this,I,zf).call(this),a(this,I,Pm).call(this)}});m(this,od,e=>{let t=r(this,ce);if(!t||e.pointerId!==t.pointerId)return;if(!t.started){a(this,I,ur).call(this,!1);return}let i=s=>{s.stopPropagation(),s.preventDefault()};window.addEventListener("click",i,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener("click",i,!0),0),a(this,I,ur).call(this,!0)});m(this,ld,e=>{r(this,ce)&&e.pointerId===r(this,ce).pointerId&&a(this,I,ur).call(this,!1)});g(this,Oe,new Ls({groupCount:()=>this.columns.length,slotCount:e=>{let t=this.columns[e];return!t||!r(this,$e)?0:t.cards.filter(i=>i!==r(this,$e).card).length+1},onTarget:e=>a(this,I,Mx).call(this,e),onDrop:(e,t)=>a(this,I,Tx).call(this,e,t),onCancel:()=>a(this,I,Ef).call(this),messages:{pickedUp:e=>a(this,I,kf).call(this,"pickedUp",e),over:e=>a(this,I,kf).call(this,"over",e),cancelled:e=>this.t("cancelled",{card:r(this,$e)?.card.name??"",column:this.columns[e.group]?.heading??""})},announce:e=>r(this,Xe).announce(e)}))}get columns(){return[...this.children].filter(e=>e.localName==="cm-board-column")}column(e){return this.columns.find(t=>t.key===e)}card(e){for(let t of this.columns){let i=t.cards.find(s=>s.key===e);if(i)return i}}get heldCard(){return r(this,$e)?.card??null}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",r(this,ed)),this.addEventListener("focusout",r(this,td)),this.addEventListener("pointerdown",r(this,rd)),this.addEventListener("dragstart",r(this,id))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",r(this,ed)),this.removeEventListener("focusout",r(this,td)),this.removeEventListener("pointerdown",r(this,rd)),this.removeEventListener("dragstart",r(this,id)),r(this,Oe).cancel(!0),a(this,I,ur).call(this,!1)}firstUpdated(){this.renderRoot.appendChild(r(this,Xe).element)}updated(e){e.has("hideEmpty")&&this.columns.forEach(t=>t.requestUpdate())}get announcement(){return r(this,Xe).text}announce(e){r(this,Xe).announce(e)}pickUp(e){let t=typeof e=="string"?this.card(e):e;if(!t||t.locked||t.pending)return!1;let i=a(this,I,ro).call(this,t);return i?(a(this,I,ur).call(this,!1),r(this,Oe).cancel(!0),g(this,$e,{card:t,column:i.column,index:i.index}),t.moving=!0,a(this,I,Ex).call(this,t),r(this,Oe).pickUp({group:i.group,index:i.index}),!0):!1}cancelMove(){let e=r(this,ce);e?.started&&(a(this,I,ur).call(this,!1),r(this,Xe).announce(this.t("cancelled",{card:e.card.name,column:e.from.heading}))),r(this,Oe).cancel()}moveCard(e,t,i){let s=typeof e=="string"?this.card(e):e,l=typeof t=="string"?this.column(t):t;if(!s||!l)return!1;let d=a(this,I,ro).call(this,s);if(!d)return!1;let p=l.cards.filter(b=>b!==s).length,u=Math.max(0,Math.min(i??p,p));return a(this,I,Nm).call(this,s,d.column,d.index,l,u,"api")}revert(e){let t=typeof e=="string"?this.card(e):e;if(!t)return!1;t.pending=!1;let i=r(this,Hs).get(t);if(this.controlled||!i||(r(this,Hs).delete(t),!i.from.isConnected||!this.contains(i.from)))return!1;let s=t.matches(":focus-within");return a(this,I,_f).call(this,t,i.from,i.fromIndex),i.totals&&a(this,I,Tf).call(this,i.to,i.from),a(this,I,Mf).call(this,i.to,i.from,s?t:null),r(this,Xe).announce(this.t("reverted",{card:t.name,column:i.from.heading})),!0}render(){return c`<div class="board" role="group" aria-label=${this.label}>
|
|
3052
3056
|
<div class="columns" part="columns"><slot @slotchange=${()=>this.requestUpdate()}></slot></div>
|
|
3053
|
-
</div>`}};
|
|
3057
|
+
</div>`}};Xe=new WeakMap,Oe=new WeakMap,$e=new WeakMap,Hs=new WeakMap,ce=new WeakMap,I=new WeakSet,kf=function(e,t){let i=this.columns[t.group];return this.t(e,{card:r(this,$e)?.card.name??"",column:i?.heading??"",position:t.index+1,count:r(this,Oe).slotCount(t.group)})},ro=function(e){let t=this.columns,i=t.findIndex(s=>s.contains(e)&&e.parentElement===s);return i<0?null:{column:t[i],group:i,index:t[i].cards.indexOf(e)}},Ex=function(e){let t=()=>!!e.shadowRoot?.activeElement?.classList.contains("handle");e.focusHandle({preventScroll:!0}),requestAnimationFrame(()=>{r(this,$e)?.card===e&&!t()&&e.focusHandle({preventScroll:!0})})},Ef=function(){r(this,$e)&&(r(this,$e).card.moving=!1),g(this,$e,null)},Mx=function(e){let t=r(this,$e);if(this.columns.forEach((i,s)=>{i._drop=t&&e&&s===e.group?{card:t.card,index:e.index,height:t.card.getBoundingClientRect().height}:null}),e){let i=this.columns[e.group];i?.updateComplete.then(()=>{let s=i.renderRoot.querySelector("li.drop")??(t&&t.column===i?t.card:i);a(this,I,_x).call(this,i,s)})}},_x=function(e,t){let i=this.renderRoot.querySelector(".columns");if(i){let l=i.getBoundingClientRect(),d=e.getBoundingClientRect();d.left<l.left?i.scrollLeft-=l.left-d.left+8:d.right>l.right&&(i.scrollLeft+=d.right-l.right+8)}let s=e.scrollElement;if(s){let l=s.getBoundingClientRect(),d=t.getBoundingClientRect();d.top<l.top?s.scrollTop-=l.top-d.top+8:d.bottom>l.bottom&&(s.scrollTop+=d.bottom-l.bottom+8)}},Tx=function(e,t){let i=r(this,$e);if(a(this,I,Ef).call(this),!i)return;let s=this.columns[t.group];a(this,I,Nm).call(this,i.card,i.column,e.index,s,t.index,"keyboard")},Cx=function(e){let t=e[0];if(!(t instanceof HTMLElement)||!t.classList?.contains("handle"))return null;let i=e.find(s=>s.localName==="cm-board-card");return i&&a(this,I,ro).call(this,i)?i:null},ed=new WeakMap,zx=function(e,t){let i=a(this,I,ro).call(this,e);if(!i)return null;let s=i.column.cards;if(t==="ArrowDown")return s[i.index+1]??null;if(t==="ArrowUp")return s[i.index-1]??null;let l=t==="ArrowRight"?1:-1,d=this.columns;for(let p=i.group+l;p>=0&&p<d.length;p+=l){let u=d[p].cards;if(u.length)return u[Math.min(i.index,u.length-1)]}return null},td=new WeakMap,Mf=function(e,t,i){e._sync(),t._sync().then(()=>{i?.isConnected&&i.focusHandle({preventScroll:!0})})},_f=function(e,t,i){let s=t.cards.filter(d=>d!==e),l=s[i];l?l.before(e):s.length?s[s.length-1].after(e):t.append(e)},Tf=function(e,t){e!==t&&(typeof e.total=="number"&&(e.total=Math.max(0,e.total-1)),typeof t.total=="number"&&(t.total=t.total+1))},Nm=function(e,t,i,s,l,d){let p=e.name;if(t===s&&i===l)return d!=="api"&&r(this,Xe).announce(this.t("sameSpot",{card:p})),d==="keyboard"&&e.focusHandle({preventScroll:!0}),!1;let u=[],b={value:e.key,card:e,from:t.key,to:s.key,fromColumn:t,toColumn:s,fromIndex:i,toIndex:l,source:d,waitUntil:v=>{u.push(Promise.resolve(v))}};if(!this.dispatchEvent(new CustomEvent("cm-move",{detail:b,bubbles:!0,composed:!0,cancelable:!0})))return r(this,Xe).announce(this.t("refused",{card:p,column:s.heading})),d==="keyboard"&&e.focusHandle({preventScroll:!0}),!1;let x=s.cards.filter(v=>v!==e).length+1;if(this.controlled)d==="keyboard"&&a(this,I,Sx).call(this,e.key,s);else{let v=d==="keyboard"||e.matches(":focus-within");a(this,I,_f).call(this,e,s,l);let k=t!==s;k&&a(this,I,Tf).call(this,t,s),r(this,Hs).set(e,{card:e,from:t,fromIndex:i,to:s,toIndex:l,totals:k}),a(this,I,Mf).call(this,t,s,v?e:null)}return r(this,Xe).announce(this.t("moved",{card:p,column:s.heading,position:l+1,count:x})),u.length&&(e.pending=!0,Promise.all(u).then(()=>{e.pending=!1,this.controlled||r(this,Hs).delete(e)},()=>{e.pending=!1,this.controlled?r(this,Xe).announce(this.t("reverted",{card:p,column:t.heading})):this.revert(e)})),!0},Sx=function(e,t){let i=()=>t.isConnected?t.cards.find(d=>d.key===e):void 0,s=()=>{let d=i(),p=!document.activeElement||document.activeElement===document.body||!document.activeElement.isConnected;return!d||!(p||this.contains(document.activeElement))?!1:(t._sync().then(()=>d.updateComplete).then(()=>{d.isConnected&&d.focusHandle({preventScroll:!0})}),!0)},l=new MutationObserver(()=>{s()&&l.disconnect()});l.observe(this,{childList:!0,subtree:!0}),setTimeout(()=>l.disconnect(),1e3)},id=new WeakMap,rd=new WeakMap,sd=new WeakMap,ad=new WeakMap,nd=new WeakMap,od=new WeakMap,ld=new WeakMap,Cf=function(){let e=r(this,ce);e.started=!0,clearTimeout(e.timer),getSelection()?.removeAllRanges();let t=e.card.cloneNode(!0);t.removeAttribute("id"),t.removeAttribute("moving"),t.setAttribute("ghost",""),t.setAttribute("aria-hidden","true"),t.setAttribute("inert",""),Object.assign(t.style,{position:"fixed",zIndex:"2147483000",left:"0",top:"0",width:`${e.width}px`,margin:"0",pointerEvents:"none",willChange:"transform"}),(this.ownerDocument.body??this.ownerDocument.documentElement).appendChild(t),e.ghost=t,e.card.moving=!0,this.dragging=!0,e.to=e.from,e.toIndex=e.fromIndex,r(this,Xe).announce(this.t("pickedUp",{card:e.card.name,column:e.from.heading,position:e.fromIndex+1,count:e.from.cards.length})),a(this,I,zf).call(this),a(this,I,Pm).call(this);let i=()=>{r(this,ce)?.started&&(a(this,I,Lx).call(this),r(this,ce).raf=requestAnimationFrame(i))};e.raf=requestAnimationFrame(i)},zf=function(){let e=r(this,ce);e?.ghost&&(e.ghost.style.transform=`translate(${e.x-e.dx}px, ${e.y-e.dy}px)`)},Pm=function(){let e=r(this,ce);if(!e)return;let t=this.columns;if(!t.length)return;let i=t[0],s=1/0;for(let u of t){let b=u.getBoundingClientRect(),f=e.x<b.left?b.left-e.x:e.x>b.right?e.x-b.right:0;f<s&&(i=u,s=f)}let l=i.cards.filter(u=>u!==e.card),d=l.length;if(i.collapsed)d=0;else for(let u=0;u<l.length;u++){let b=l[u].getBoundingClientRect();if(e.y<b.top+b.height/2){d=u;break}}if(i===e.to&&d===e.toIndex)return;let p=i!==e.to;e.to=i,e.toIndex=d,t.forEach(u=>{u._drop=u===i?{card:e.card,index:d,height:e.height}:null}),p&&r(this,Xe).announce(this.t("over",{column:i.heading,position:d+1,count:l.length+1}))},Lx=function(){let e=r(this,ce);if(!e)return;let t=48,i=16,s=x=>x<t?Math.ceil((t-Math.max(x,0))/t*i):0,l=!1,d=this.renderRoot.querySelector(".columns");if(d){let x=d.getBoundingClientRect(),v=s(e.x-x.left),k=s(x.right-e.x),L=d.scrollLeft;v?d.scrollLeft-=v:k&&(d.scrollLeft+=k),l||=d.scrollLeft!==L}let p=e.to?.scrollElement;if(p&&p.scrollHeight>p.clientHeight){let x=p.getBoundingClientRect();if(e.x>=x.left&&e.x<=x.right){let v=s(e.y-x.top),k=s(x.bottom-e.y),L=p.scrollTop;v?p.scrollTop-=v:k&&(p.scrollTop+=k),l||=p.scrollTop!==L}}let u=window.innerHeight,b=s(e.y),f=s(u-e.y);if(b||f){let x=window.scrollY;window.scrollBy(0,b?-b:f),l||=window.scrollY!==x}l&&a(this,I,Pm).call(this)},ur=function(e){let t=r(this,ce);t&&(g(this,ce,null),clearTimeout(t.timer),t.raf&&cancelAnimationFrame(t.raf),window.removeEventListener("pointermove",r(this,nd),!0),window.removeEventListener("pointerup",r(this,od),!0),window.removeEventListener("pointercancel",r(this,ld),!0),window.removeEventListener("touchmove",r(this,sd),!0),window.removeEventListener("contextmenu",r(this,ad),!0),t.ghost?.remove(),t.started&&(t.card.moving=!1,this.dragging=!1,this.columns.forEach(i=>{i._drop=null}),e&&t.to&&t.toIndex!==void 0&&a(this,I,Nm).call(this,t.card,t.from,t.fromIndex,t.to,t.toIndex,"pointer")))},so.properties={label:{string:"label"},hideEmpty:{type:Boolean,attribute:"hide-empty",reflect:!0},controlled:{type:Boolean,reflect:!0},dragging:{type:Boolean,reflect:!0}},so.styles=[E,w`
|
|
3054
3058
|
:host { position: relative; display: block; container-type: inline-size; container-name: cm-board; min-width: 0; }
|
|
3055
3059
|
.board { height: 100%; }
|
|
3056
3060
|
.columns {
|
|
@@ -3064,60 +3068,60 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3064
3068
|
::slotted(cm-board-column) { inline-size: calc(100% - 40px); scroll-snap-align: start; }
|
|
3065
3069
|
::slotted(cm-board-column[collapsed]) { inline-size: 48px; }
|
|
3066
3070
|
}
|
|
3067
|
-
`];$("cm-board",so);var W_=z("calendar",{label:"Calendar",previousMonth:"Previous month",nextMonth:"Next month",previousWeek:"Previous week",nextWeek:"Next week",previousDays:"Previous {count} days",nextDays:"Next {count} days",previousDay:"Previous day",nextDay:"Next day",today:"Today",views:"View",month:"Month",week:"Week",day:"Day",allDay:"All day",time:"Time",add:"Add",addOn:"Add on {date}",addAllDay:"Add an all-day event on {date}",addAt:"Add at {time}, {date}",more:"+{count} more",moreLabel:"{count} more on {date}",dayEvents:{one:"{date}, {count} event",other:"{date}, {count} events"},noEvents:"No events",loading:"Loading events",timeRange:"{start} to {end}",timed:"{date}, {time}",allDayOn:"{date}, all day",allDayRange:"{start} to {end}, all day",eventName:"{title}, {when}",eventNameKind:"{title}, {when}, {kind}",roleDescription:"movable event",openHint:"Press Enter to open.",instructions:"Press Space to pick up, then the arrow keys to choose a day or time, Space or Enter to drop and Escape to cancel.",gridHelp:"Use the arrow keys to move between days, times and events, and Page Up and Page Down for the previous or next period.",saving:"Saving",pickedUp:"Picked up {event}. {place}.",over:"{place}.",moved:"Moved {event} to {place}.",sameSpot:"{event} dropped where it started.",cancelled:"Move cancelled. {event} is back on {place}.",refused:"{event} can't be moved to {place}.",reverted:"Couldn't move {event}. It is back on {place}."}),ho=class extends A{constructor(){super(...arguments);this.value="";this.heading="";this.label="";this.start="";this.end="";this.allDay=!1;this.kind="";this.tone="neutral";this.icon="";this.href="";this.locked=!1;this.pending=!1;this.moving=!1}get name(){return this.label||this.heading||(this.textContent??"").replace(/\s+/g," ").trim()}get key(){return this.value||this.name}updated(){let e=this.parentElement;e?.localName==="cm-calendar"&&e.requestUpdate()}render(){return h}};ho.properties={value:{reflect:!0},heading:{},label:{},start:{},end:{},allDay:{type:Boolean,attribute:"all-day",reflect:!0},kind:{},tone:{reflect:!0},icon:{},href:{},locked:{type:Boolean,reflect:!0},pending:{type:Boolean,reflect:!0},moving:{type:Boolean,reflect:!0}},ho.styles=w`:host { display: none !important; }`;$("cm-calendar-event",ho);var Um=o=>String(o).padStart(2,"0"),Sx=o=>`${B(o)}T${Um(o.getHours())}:${Um(o.getMinutes())}`,qm=(o,n)=>Math.round((Date.UTC(n.getFullYear(),n.getMonth(),n.getDate())-Date.UTC(o.getFullYear(),o.getMonth(),o.getDate()))/864e5),Lx=["month","week","day"],B0=600,Ax=new Map,Dx=(o,n)=>{let e=`${o}|${JSON.stringify(n)}`,t=Ax.get(e);return t||(t=new Intl.DateTimeFormat(o,n),Ax.set(e,t)),t},Sf=o=>o.replace(/[ ]/g," ").trim(),mo,Xe,Je,He,ae,ne,Ps,Qt,ft,bd,vr,uo,go,fo,bo,vd,y,Oe,fr,cd,Om,Jt,Lf,dd,It,Af,Rx,qt,lo,Hx,Nx,gt,hd,pd,Bm,Px,Ix,qx,Ns,Df,md,Ox,ud,Bx,Fx,Vx,jx,yd,xd,Ux,Kx,wd,gd,Wx,Rf,Hf,Nf,Gx,Yx,Pf,If,qf,$d,Of,Xx,kd,Ed,Md,_d,Td,Cd,Bf,Fm,Jx,br,fd,Qx,Ff,Zx,Vm,Vf,co,jm,ew,tw,iw,rw,sw,po=class extends C{constructor(){super();m(this,y);this.view="month";this.date="";this.today="";this.step=15;m(this,mo,"");this.hourCycle="";this.dayStart=8;this.maxEvents=3;this.headingLevel=2;this.loading=!1;this.readonly=!1;this.controlled=!1;this.dragging=!1;this._narrow=!1;this._more="";this._target=null;m(this,Xe,N("cm-cal"));m(this,Je,new As);m(this,He);m(this,ae,null);m(this,ne,null);m(this,Ps,new WeakMap);m(this,Qt,"");m(this,ft,null);m(this,bd,"");m(this,vr,!0);m(this,uo,0);m(this,go,!1);m(this,fo);m(this,bo,0);m(this,vd,new MutationObserver(()=>this.requestUpdate()));m(this,yd,e=>{let t=e.composedPath()[0];if(t instanceof HTMLElement&&t.classList.contains("item")&&t.dataset.k){g(this,Qt,t.dataset.k);for(let i of a(this,y,ud).call(this))i.tabIndex=i===t?0:-1}});m(this,xd,e=>{let t=e.relatedTarget;if(this._more&&!r(this,ae)){let i=this.renderRoot.querySelector(".pop"),s=e.composedPath()[0];i&&i.contains(s)&&!(t&&i.contains(t))&&queueMicrotask(()=>{i.contains(this.renderRoot.activeElement)||(this._more="")})}!r(this,He).active||!r(this,ae)||!t&&document.hasFocus()===!1||this.updateComplete.then(()=>setTimeout(()=>{if(!r(this,He).active||!r(this,ae))return;this.renderRoot.activeElement?.dataset.ev!==r(this,ae).ev.key&&r(this,He).cancel()}))});m(this,wd,e=>{if(r(this,ne)?.started&&e.key==="Escape"){e.preventDefault(),this.cancelMove();return}let t=se(e,this);if(r(this,He).active){r(this,He).handleKey(e,t)&&(e.preventDefault(),e.stopPropagation());return}if(e.altKey||e.ctrlKey||e.metaKey)return;let i=e.composedPath()[0];if(!(i instanceof HTMLElement)||i.getRootNode()!==this.renderRoot)return;let s=i.closest(".pop");if(s&&e.key==="Escape"){e.preventDefault(),a(this,y,Vm).call(this,!0);return}if(i.dataset.ev&&e.key===" "){e.preventDefault(),g(this,uo,performance.now()+400),this.pickUp(i.dataset.ev,i.dataset.day);return}if(s&&(t==="ArrowDown"||t==="ArrowUp")){let d=[...s.querySelectorAll(".chip")],p=d[d.indexOf(i)+(t==="ArrowDown"?1:-1)];p&&(e.preventDefault(),p.focus());return}if(!i.classList.contains("item"))return;if(e.key==="PageUp"||e.key==="PageDown"){e.preventDefault(),a(this,y,Kx).call(this,i,e.key==="PageUp"?-1:1);return}let l=a(this,y,Ux).call(this,i,t);l?(e.preventDefault(),a(this,y,jx).call(this,l)):(t.startsWith("Arrow")||t==="Home"||t==="End")&&e.preventDefault()});m(this,$d,e=>{e.composedPath().some(t=>t.dataset?.ev)&&e.preventDefault()});m(this,kd,e=>{if(r(this,ne)||this.readonly||!e.isPrimary||e.pointerType==="mouse"&&e.button!==0)return;let t=e.composedPath().find(p=>p.dataset?.ev);if(!t)return;let i=this.event(t.dataset.ev),s=i&&a(this,y,lo).call(this,i);if(!s||i.locked||i.pending)return;let l=a(this,y,Hf).call(this,s,t.dataset.day??s.days[0]);if(!l)return;r(this,He).active&&r(this,He).cancel();let d=0;if(l.mode==="time"){let p=a(this,y,Of).call(this,e.clientX,e.clientY);p&&t.classList.contains("time")&&(d=Math.max(0,Math.min(s.dur,p.min-s.min)))}g(this,ne,{...l,pointerId:e.pointerId,type:e.pointerType,x0:e.clientX,y0:e.clientY,x:e.clientX,y:e.clientY,started:!1,grab:d,to:{...l.from}}),e.pointerType!=="mouse"&&(r(this,ne).timer=setTimeout(()=>{r(this,ne)&&!r(this,ne).started&&a(this,y,Bf).call(this)},300)),window.addEventListener("pointermove",r(this,_d),!0),window.addEventListener("pointerup",r(this,Td),!0),window.addEventListener("pointercancel",r(this,Cd),!0),window.addEventListener("touchmove",r(this,Ed),{capture:!0,passive:!1}),window.addEventListener("contextmenu",r(this,Md),!0)});m(this,Ed,e=>{r(this,ne)?.started&&e.cancelable&&e.preventDefault()});m(this,Md,e=>{r(this,ne)&&e.preventDefault()});m(this,_d,e=>{let t=r(this,ne);if(!(!t||e.pointerId!==t.pointerId)){if(t.x=e.clientX,t.y=e.clientY,!t.started){let i=Math.hypot(t.x-t.x0,t.y-t.y0);(t.type==="mouse"?i>4:i>8)&&(t.type==="mouse"?a(this,y,Bf).call(this):a(this,y,br).call(this,!1));return}e.preventDefault(),a(this,y,Fm).call(this)}});m(this,Td,e=>{let t=r(this,ne);if(!t||e.pointerId!==t.pointerId)return;if(!t.started){a(this,y,br).call(this,!1);return}let i=s=>{s.stopPropagation(),s.preventDefault()};window.addEventListener("click",i,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener("click",i,!0),0),a(this,y,br).call(this,!0)});m(this,Cd,e=>{r(this,ne)&&e.pointerId===r(this,ne).pointerId&&a(this,y,br).call(this,!1)});g(this,He,new Ls({groupCount:()=>a(this,y,qt).call(this).length,slotCount:()=>r(this,ae)?r(this,ae).mode==="day"?1:a(this,y,gd).call(this,r(this,ae).ev.dur):0,navigate:(e,t)=>a(this,y,Wx).call(this,e,t),onTarget:e=>a(this,y,Gx).call(this,e),onDrop:(e,t)=>a(this,y,Yx).call(this,e,t),onCancel:()=>a(this,y,Nf).call(this),messages:{pickedUp:e=>this.t("pickedUp",{event:r(this,ae)?.ev.name??"",place:a(this,y,Ns).call(this,r(this,ae),e)}),over:e=>this.t("over",{place:a(this,y,Ns).call(this,r(this,ae),e)}),cancelled:e=>this.t("cancelled",{event:r(this,ae)?.ev.name??"",place:a(this,y,Ns).call(this,r(this,ae),e)})},announce:e=>r(this,Je).announce(e)}))}get locale(){return r(this,mo)}set locale(e){let t=r(this,mo);g(this,mo,e??""),this.requestUpdate("locale",t)}get events(){return[...this.children].filter(e=>e.localName==="cm-calendar-event")}event(e){return this.events.find(t=>t.key===e)}get range(){let e=a(this,y,qt).call(this);return{view:r(this,y,Oe),start:B(e[0]),end:B(e[e.length-1])}}get heldEvent(){return r(this,ae)?.ev.el??null}get announcement(){return r(this,Je).text}announce(e){r(this,Je).announce(e)}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",r(this,wd)),this.addEventListener("focusin",r(this,yd)),this.addEventListener("focusout",r(this,xd)),this.addEventListener("pointerdown",r(this,kd)),this.addEventListener("dragstart",r(this,$d)),r(this,vd).observe(this,{childList:!0}),typeof ResizeObserver<"u"&&(g(this,fo,new ResizeObserver(()=>{cancelAnimationFrame(r(this,bo)),g(this,bo,requestAnimationFrame(()=>a(this,y,Df).call(this)))})),r(this,fo).observe(this)),a(this,y,Df).call(this)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",r(this,wd)),this.removeEventListener("focusin",r(this,yd)),this.removeEventListener("focusout",r(this,xd)),this.removeEventListener("pointerdown",r(this,kd)),this.removeEventListener("dragstart",r(this,$d)),r(this,vd).disconnect(),r(this,fo)?.disconnect(),cancelAnimationFrame(r(this,bo)),r(this,He).cancel(!0),a(this,y,br).call(this,!1)}willUpdate(e){e.has("view")&&(g(this,vr,!0),e.get("view")!==void 0&&(this._more="",r(this,He).cancel(!0))),(e.has("date")||e.has("_narrow"))&&(this._more=this._more&&this.range.start<=this._more&&this._more<=this.range.end?this._more:"")}firstUpdated(){this.renderRoot.appendChild(r(this,Je).element)}scrollToHour(e){let t=this.renderRoot.querySelector(".tg"),i=t?.querySelector(".tcell");!t||!i||(t.scrollTop=i.offsetHeight*Math.max(0,Math.min(23,Math.trunc(Number(e))||0)))}updated(e){if(e.has("dayStart")&&e.get("dayStart")!==void 0&&g(this,vr,!0),a(this,y,Vx).call(this),r(this,ft)){let l=a(this,y,Bx).call(this,r(this,ft).key);l?(g(this,ft,null),l.focus({preventScroll:!1})):Date.now()>r(this,ft).until&&g(this,ft,null)}r(this,go)&&(g(this,go,!1),(this.renderRoot.querySelector(".pop .chip")??this.renderRoot.querySelector(".pop button"))?.focus());let t=this.renderRoot.querySelector(".tg");if(t&&r(this,vr)){let l=t.querySelector(".tcell"),d=Math.max(0,Math.min(23,Math.trunc(Number(this.dayStart))||0));l&&(t.scrollTop=l.offsetHeight*d),g(this,vr,!1)}t||g(this,vr,!0),r(this,ae)&&this._target&&this.renderRoot.querySelector(".ph")?.scrollIntoView?.({block:"nearest",inline:"nearest"});let i=this.range,s=`${i.view}|${i.start}|${i.end}`;s!==r(this,bd)&&(g(this,bd,s),this.dispatchEvent(new CustomEvent("cm-range-change",{detail:i,bubbles:!0,composed:!0})))}previous(){this.date=B(a(this,y,md).call(this,r(this,y,It),-1))}next(){this.date=B(a(this,y,md).call(this,r(this,y,It),1))}goToToday(){this.date=r(this,y,dd)}pickUp(e,t){let i=typeof e=="string"?this.event(e):e;if(!i||i.locked||i.pending||this.readonly)return!1;let s=a(this,y,lo).call(this,i);if(!s)return!1;let l=a(this,y,qt).call(this).map(B),d=t&&s.days.includes(t)&&l.includes(t)?t:s.days.find(b=>l.includes(b));if(!d)return!1;let p=a(this,y,Hf).call(this,s,d);if(!p)return!1;a(this,y,br).call(this,!1),r(this,He).cancel(!0),this._more="",g(this,ae,p),i.moving=!0;let u=`ev:${s.key}:${d}`;return g(this,Qt,u),g(this,ft,{key:u,until:Date.now()+1e3}),this.requestUpdate(),r(this,He).pickUp(p.from),!0}cancelMove(){let e=r(this,ne);e?.started&&(a(this,y,br).call(this,!1),r(this,Je).announce(this.t("cancelled",{event:e.ev.name,place:a(this,y,Ns).call(this,e,e.from)}))),r(this,He).cancel()}moveEvent(e,t,i){let s=typeof e=="string"?this.event(e):e,l=s&&a(this,y,lo).call(this,s);if(!l)return!1;let d=l.allDay?R(xt(t).date||t):Ut(t);if(!d)return!1;let p=i?l.allDay?R(xt(i).date||i):Ut(i):null;return(!p||p<d)&&(p=l.allDay?te(d,qm(l.start,l.end)):new Date(d.getTime()+l.dur*6e4)),a(this,y,qf).call(this,l,d,p,"api",!1,B(d))}revert(e){let t=typeof e=="string"?this.event(e):e;if(!t)return!1;t.pending=!1;let i=r(this,Ps).get(t);if(this.controlled||!i)return!1;r(this,Ps).delete(t);let s=this.renderRoot.activeElement?.dataset.ev===t.key;t.start=i.start,t.end=i.end;let l=a(this,y,lo).call(this,t);return l&&s&&g(this,ft,{key:`ev:${l.key}:${l.days[0]}`,until:Date.now()+1e3}),r(this,Je).announce(this.t("reverted",{event:t.name,place:l?a(this,y,Bm).call(this,l):i.start})),!0}render(){let e=a(this,y,qt).call(this),t=a(this,y,Nx).call(this,a(this,y,Hx).call(this));return c`<div class="cal ${this._narrow?"narrow":""}" role="group" aria-label=${this.label}>
|
|
3068
|
-
${a(this,y,
|
|
3069
|
-
${r(this,y,
|
|
3071
|
+
`];$("cm-board",so);var Y_=z("calendar",{label:"Calendar",previousMonth:"Previous month",nextMonth:"Next month",previousWeek:"Previous week",nextWeek:"Next week",previousDays:"Previous {count} days",nextDays:"Next {count} days",previousDay:"Previous day",nextDay:"Next day",today:"Today",views:"View",month:"Month",week:"Week",day:"Day",allDay:"All day",time:"Time",add:"Add",addOn:"Add on {date}",addAllDay:"Add an all-day event on {date}",addAt:"Add at {time}, {date}",more:"+{count} more",moreLabel:"{count} more on {date}",dayEvents:{one:"{date}, {count} event",other:"{date}, {count} events"},noEvents:"No events",loading:"Loading events",timeRange:"{start} to {end}",timed:"{date}, {time}",allDayOn:"{date}, all day",allDayRange:"{start} to {end}, all day",eventName:"{title}, {when}",eventNameKind:"{title}, {when}, {kind}",roleDescription:"movable event",openHint:"Press Enter to open.",instructions:"Press Space to pick up, then the arrow keys to choose a day or time, Space or Enter to drop and Escape to cancel.",gridHelp:"Use the arrow keys to move between days, times and events, and Page Up and Page Down for the previous or next period.",saving:"Saving",pickedUp:"Picked up {event}. {place}.",over:"{place}.",moved:"Moved {event} to {place}.",sameSpot:"{event} dropped where it started.",cancelled:"Move cancelled. {event} is back on {place}.",refused:"{event} can't be moved to {place}.",reverted:"Couldn't move {event}. It is back on {place}."}),ho=class extends A{constructor(){super(...arguments);this.value="";this.heading="";this.label="";this.start="";this.end="";this.allDay=!1;this.kind="";this.tone="neutral";this.icon="";this.href="";this.locked=!1;this.pending=!1;this.moving=!1}get name(){return this.label||this.heading||(this.textContent??"").replace(/\s+/g," ").trim()}get key(){return this.value||this.name}updated(){let e=this.parentElement;e?.localName==="cm-calendar"&&e.requestUpdate()}render(){return h}};ho.properties={value:{reflect:!0},heading:{},label:{},start:{},end:{},allDay:{type:Boolean,attribute:"all-day",reflect:!0},kind:{},tone:{reflect:!0},icon:{},href:{},locked:{type:Boolean,reflect:!0},pending:{type:Boolean,reflect:!0},moving:{type:Boolean,reflect:!0}},ho.styles=w`:host { display: none !important; }`;$("cm-calendar-event",ho);var Um=o=>String(o).padStart(2,"0"),Ax=o=>`${B(o)}T${Um(o.getHours())}:${Um(o.getMinutes())}`,qm=(o,n)=>Math.round((Date.UTC(n.getFullYear(),n.getMonth(),n.getDate())-Date.UTC(o.getFullYear(),o.getMonth(),o.getDate()))/864e5),Dx=["month","week","day"],V0=600,Rx=new Map,Hx=(o,n)=>{let e=`${o}|${JSON.stringify(n)}`,t=Rx.get(e);return t||(t=new Intl.DateTimeFormat(o,n),Rx.set(e,t)),t},Sf=o=>o.replace(/[ ]/g," ").trim(),mo,Je,Qe,He,ae,ne,Ps,Qt,ft,bd,vr,uo,go,fo,bo,vd,y,Be,fr,cd,Om,Jt,Lf,dd,It,Af,Nx,qt,lo,Px,Ix,gt,hd,pd,Bm,qx,Ox,Bx,Ns,Df,md,Fx,ud,Vx,jx,Ux,Kx,yd,xd,Wx,Gx,wd,gd,Yx,Rf,Hf,Nf,Xx,Jx,Pf,If,qf,$d,Of,Qx,kd,Ed,Md,_d,Td,Cd,Bf,Fm,Zx,br,fd,ew,Ff,tw,Vm,Vf,co,jm,iw,rw,sw,aw,nw,po=class extends C{constructor(){super();m(this,y);this.view="month";this.date="";this.today="";this.step=15;m(this,mo,"");this.hourCycle="";this.dayStart=8;this.maxEvents=3;this.headingLevel=2;this.loading=!1;this.readonly=!1;this.controlled=!1;this.dragging=!1;this._narrow=!1;this._more="";this._target=null;m(this,Je,N("cm-cal"));m(this,Qe,new As);m(this,He);m(this,ae,null);m(this,ne,null);m(this,Ps,new WeakMap);m(this,Qt,"");m(this,ft,null);m(this,bd,"");m(this,vr,!0);m(this,uo,0);m(this,go,!1);m(this,fo);m(this,bo,0);m(this,vd,new MutationObserver(()=>this.requestUpdate()));m(this,yd,e=>{let t=e.composedPath()[0];if(t instanceof HTMLElement&&t.classList.contains("item")&&t.dataset.k){g(this,Qt,t.dataset.k);for(let i of a(this,y,ud).call(this))i.tabIndex=i===t?0:-1}});m(this,xd,e=>{let t=e.relatedTarget;if(this._more&&!r(this,ae)){let i=this.renderRoot.querySelector(".pop"),s=e.composedPath()[0];i&&i.contains(s)&&!(t&&i.contains(t))&&queueMicrotask(()=>{i.contains(this.renderRoot.activeElement)||(this._more="")})}!r(this,He).active||!r(this,ae)||!t&&document.hasFocus()===!1||this.updateComplete.then(()=>setTimeout(()=>{if(!r(this,He).active||!r(this,ae))return;this.renderRoot.activeElement?.dataset.ev!==r(this,ae).ev.key&&r(this,He).cancel()}))});m(this,wd,e=>{if(r(this,ne)?.started&&e.key==="Escape"){e.preventDefault(),this.cancelMove();return}let t=se(e,this);if(r(this,He).active){r(this,He).handleKey(e,t)&&(e.preventDefault(),e.stopPropagation());return}if(e.altKey||e.ctrlKey||e.metaKey)return;let i=e.composedPath()[0];if(!(i instanceof HTMLElement)||i.getRootNode()!==this.renderRoot)return;let s=i.closest(".pop");if(s&&e.key==="Escape"){e.preventDefault(),a(this,y,Vm).call(this,!0);return}if(i.dataset.ev&&e.key===" "){e.preventDefault(),g(this,uo,performance.now()+400),this.pickUp(i.dataset.ev,i.dataset.day);return}if(s&&(t==="ArrowDown"||t==="ArrowUp")){let d=[...s.querySelectorAll(".chip")],p=d[d.indexOf(i)+(t==="ArrowDown"?1:-1)];p&&(e.preventDefault(),p.focus());return}if(!i.classList.contains("item"))return;if(e.key==="PageUp"||e.key==="PageDown"){e.preventDefault(),a(this,y,Gx).call(this,i,e.key==="PageUp"?-1:1);return}let l=a(this,y,Wx).call(this,i,t);l?(e.preventDefault(),a(this,y,Kx).call(this,l)):(t.startsWith("Arrow")||t==="Home"||t==="End")&&e.preventDefault()});m(this,$d,e=>{e.composedPath().some(t=>t.dataset?.ev)&&e.preventDefault()});m(this,kd,e=>{if(r(this,ne)||this.readonly||!e.isPrimary||e.pointerType==="mouse"&&e.button!==0)return;let t=e.composedPath().find(p=>p.dataset?.ev);if(!t)return;let i=this.event(t.dataset.ev),s=i&&a(this,y,lo).call(this,i);if(!s||i.locked||i.pending)return;let l=a(this,y,Hf).call(this,s,t.dataset.day??s.days[0]);if(!l)return;r(this,He).active&&r(this,He).cancel();let d=0;if(l.mode==="time"){let p=a(this,y,Of).call(this,e.clientX,e.clientY);p&&t.classList.contains("time")&&(d=Math.max(0,Math.min(s.dur,p.min-s.min)))}g(this,ne,{...l,pointerId:e.pointerId,type:e.pointerType,x0:e.clientX,y0:e.clientY,x:e.clientX,y:e.clientY,started:!1,grab:d,to:{...l.from}}),e.pointerType!=="mouse"&&(r(this,ne).timer=setTimeout(()=>{r(this,ne)&&!r(this,ne).started&&a(this,y,Bf).call(this)},300)),window.addEventListener("pointermove",r(this,_d),!0),window.addEventListener("pointerup",r(this,Td),!0),window.addEventListener("pointercancel",r(this,Cd),!0),window.addEventListener("touchmove",r(this,Ed),{capture:!0,passive:!1}),window.addEventListener("contextmenu",r(this,Md),!0)});m(this,Ed,e=>{r(this,ne)?.started&&e.cancelable&&e.preventDefault()});m(this,Md,e=>{r(this,ne)&&e.preventDefault()});m(this,_d,e=>{let t=r(this,ne);if(!(!t||e.pointerId!==t.pointerId)){if(t.x=e.clientX,t.y=e.clientY,!t.started){let i=Math.hypot(t.x-t.x0,t.y-t.y0);(t.type==="mouse"?i>4:i>8)&&(t.type==="mouse"?a(this,y,Bf).call(this):a(this,y,br).call(this,!1));return}e.preventDefault(),a(this,y,Fm).call(this)}});m(this,Td,e=>{let t=r(this,ne);if(!t||e.pointerId!==t.pointerId)return;if(!t.started){a(this,y,br).call(this,!1);return}let i=s=>{s.stopPropagation(),s.preventDefault()};window.addEventListener("click",i,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener("click",i,!0),0),a(this,y,br).call(this,!0)});m(this,Cd,e=>{r(this,ne)&&e.pointerId===r(this,ne).pointerId&&a(this,y,br).call(this,!1)});g(this,He,new Ls({groupCount:()=>a(this,y,qt).call(this).length,slotCount:()=>r(this,ae)?r(this,ae).mode==="day"?1:a(this,y,gd).call(this,r(this,ae).ev.dur):0,navigate:(e,t)=>a(this,y,Yx).call(this,e,t),onTarget:e=>a(this,y,Xx).call(this,e),onDrop:(e,t)=>a(this,y,Jx).call(this,e,t),onCancel:()=>a(this,y,Nf).call(this),messages:{pickedUp:e=>this.t("pickedUp",{event:r(this,ae)?.ev.name??"",place:a(this,y,Ns).call(this,r(this,ae),e)}),over:e=>this.t("over",{place:a(this,y,Ns).call(this,r(this,ae),e)}),cancelled:e=>this.t("cancelled",{event:r(this,ae)?.ev.name??"",place:a(this,y,Ns).call(this,r(this,ae),e)})},announce:e=>r(this,Qe).announce(e)}))}get locale(){return r(this,mo)}set locale(e){let t=r(this,mo);g(this,mo,e??""),this.requestUpdate("locale",t)}get events(){return[...this.children].filter(e=>e.localName==="cm-calendar-event")}event(e){return this.events.find(t=>t.key===e)}get range(){let e=a(this,y,qt).call(this);return{view:r(this,y,Be),start:B(e[0]),end:B(e[e.length-1])}}get heldEvent(){return r(this,ae)?.ev.el??null}get announcement(){return r(this,Qe).text}announce(e){r(this,Qe).announce(e)}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",r(this,wd)),this.addEventListener("focusin",r(this,yd)),this.addEventListener("focusout",r(this,xd)),this.addEventListener("pointerdown",r(this,kd)),this.addEventListener("dragstart",r(this,$d)),r(this,vd).observe(this,{childList:!0}),typeof ResizeObserver<"u"&&(g(this,fo,new ResizeObserver(()=>{cancelAnimationFrame(r(this,bo)),g(this,bo,requestAnimationFrame(()=>a(this,y,Df).call(this)))})),r(this,fo).observe(this)),a(this,y,Df).call(this)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",r(this,wd)),this.removeEventListener("focusin",r(this,yd)),this.removeEventListener("focusout",r(this,xd)),this.removeEventListener("pointerdown",r(this,kd)),this.removeEventListener("dragstart",r(this,$d)),r(this,vd).disconnect(),r(this,fo)?.disconnect(),cancelAnimationFrame(r(this,bo)),r(this,He).cancel(!0),a(this,y,br).call(this,!1)}willUpdate(e){e.has("view")&&(g(this,vr,!0),e.get("view")!==void 0&&(this._more="",r(this,He).cancel(!0))),(e.has("date")||e.has("_narrow"))&&(this._more=this._more&&this.range.start<=this._more&&this._more<=this.range.end?this._more:"")}firstUpdated(){this.renderRoot.appendChild(r(this,Qe).element)}scrollToHour(e){let t=this.renderRoot.querySelector(".tg"),i=t?.querySelector(".tcell");!t||!i||(t.scrollTop=i.offsetHeight*Math.max(0,Math.min(23,Math.trunc(Number(e))||0)))}updated(e){if(e.has("dayStart")&&e.get("dayStart")!==void 0&&g(this,vr,!0),a(this,y,Ux).call(this),r(this,ft)){let l=a(this,y,Vx).call(this,r(this,ft).key);l?(g(this,ft,null),l.focus({preventScroll:!1})):Date.now()>r(this,ft).until&&g(this,ft,null)}r(this,go)&&(g(this,go,!1),(this.renderRoot.querySelector(".pop .chip")??this.renderRoot.querySelector(".pop button"))?.focus());let t=this.renderRoot.querySelector(".tg");if(t&&r(this,vr)){let l=t.querySelector(".tcell"),d=Math.max(0,Math.min(23,Math.trunc(Number(this.dayStart))||0));l&&(t.scrollTop=l.offsetHeight*d),g(this,vr,!1)}t||g(this,vr,!0),r(this,ae)&&this._target&&this.renderRoot.querySelector(".ph")?.scrollIntoView?.({block:"nearest",inline:"nearest"});let i=this.range,s=`${i.view}|${i.start}|${i.end}`;s!==r(this,bd)&&(g(this,bd,s),this.dispatchEvent(new CustomEvent("cm-range-change",{detail:i,bubbles:!0,composed:!0})))}previous(){this.date=B(a(this,y,md).call(this,r(this,y,It),-1))}next(){this.date=B(a(this,y,md).call(this,r(this,y,It),1))}goToToday(){this.date=r(this,y,dd)}pickUp(e,t){let i=typeof e=="string"?this.event(e):e;if(!i||i.locked||i.pending||this.readonly)return!1;let s=a(this,y,lo).call(this,i);if(!s)return!1;let l=a(this,y,qt).call(this).map(B),d=t&&s.days.includes(t)&&l.includes(t)?t:s.days.find(b=>l.includes(b));if(!d)return!1;let p=a(this,y,Hf).call(this,s,d);if(!p)return!1;a(this,y,br).call(this,!1),r(this,He).cancel(!0),this._more="",g(this,ae,p),i.moving=!0;let u=`ev:${s.key}:${d}`;return g(this,Qt,u),g(this,ft,{key:u,until:Date.now()+1e3}),this.requestUpdate(),r(this,He).pickUp(p.from),!0}cancelMove(){let e=r(this,ne);e?.started&&(a(this,y,br).call(this,!1),r(this,Qe).announce(this.t("cancelled",{event:e.ev.name,place:a(this,y,Ns).call(this,e,e.from)}))),r(this,He).cancel()}moveEvent(e,t,i){let s=typeof e=="string"?this.event(e):e,l=s&&a(this,y,lo).call(this,s);if(!l)return!1;let d=l.allDay?R(xt(t).date||t):Ut(t);if(!d)return!1;let p=i?l.allDay?R(xt(i).date||i):Ut(i):null;return(!p||p<d)&&(p=l.allDay?te(d,qm(l.start,l.end)):new Date(d.getTime()+l.dur*6e4)),a(this,y,qf).call(this,l,d,p,"api",!1,B(d))}revert(e){let t=typeof e=="string"?this.event(e):e;if(!t)return!1;t.pending=!1;let i=r(this,Ps).get(t);if(this.controlled||!i)return!1;r(this,Ps).delete(t);let s=this.renderRoot.activeElement?.dataset.ev===t.key;t.start=i.start,t.end=i.end;let l=a(this,y,lo).call(this,t);return l&&s&&g(this,ft,{key:`ev:${l.key}:${l.days[0]}`,until:Date.now()+1e3}),r(this,Qe).announce(this.t("reverted",{event:t.name,place:l?a(this,y,Bm).call(this,l):i.start})),!0}render(){let e=a(this,y,qt).call(this),t=a(this,y,Ix).call(this,a(this,y,Px).call(this));return c`<div class="cal ${this._narrow?"narrow":""}" role="group" aria-label=${this.label}>
|
|
3072
|
+
${a(this,y,iw).call(this,e)}
|
|
3073
|
+
${r(this,y,Be)==="month"?a(this,y,sw).call(this,e,t):a(this,y,nw).call(this,e,t)}
|
|
3070
3074
|
<span class="vh" role="status">${this.loading?this.t("loading"):""}</span>
|
|
3071
|
-
<span id="${r(this,
|
|
3072
|
-
<span id="${r(this,
|
|
3073
|
-
<span id="${r(this,
|
|
3074
|
-
</div>`}};mo=new WeakMap,Xe=new WeakMap,Je=new WeakMap,He=new WeakMap,ae=new WeakMap,ne=new WeakMap,Ps=new WeakMap,Qt=new WeakMap,ft=new WeakMap,bd=new WeakMap,vr=new WeakMap,uo=new WeakMap,go=new WeakMap,fo=new WeakMap,bo=new WeakMap,vd=new WeakMap,y=new WeakSet,Oe=function(){return Lx.includes(this.view)?this.view:"month"},fr=function(){return Wi(this,this.locale)},cd=function(){return Ha(r(this,y,fr))},Om=function(){return Aa(r(this,y,fr),this.hourCycle)},Jt=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=240?e:15},Lf=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?Ra(r(this,y,fr)):(Math.trunc(e)%7+7)%7},dd=function(){return R(this.today)?this.today:Xu()},It=function(){return R(this.date)??R(r(this,y,dd))},Af=function(){return r(this,y,Oe)==="month"&&this._narrow},Rx=function(){return r(this,y,Oe)!=="month"},qt=function(){let e=r(this,y,It),t=r(this,y,Lf);if(r(this,y,Oe)==="day")return[e];if(r(this,y,Oe)==="week"){if(this._narrow)return[e,te(e,1),te(e,2)];let d=te(e,-((e.getDay()-t+7)%7));return Array.from({length:7},(p,u)=>te(d,u))}let i=ze(e),s=te(i,-((i.getDay()-t+7)%7)),l=Math.ceil((qm(s,Jr(e))+1)/7)*7;return Array.from({length:l},(d,p)=>te(s,p))},lo=function(e){let t=e.name,i=!!R(e.start),s=e.allDay||i;if(s){let u=R(xt(e.start).date||e.start);if(!u)return null;let b=R(xt(e.end).date||e.end)??u;b<u&&(b=u);let f=Math.min(qm(u,b),366);return{el:e,key:e.key,name:t,allDay:s,start:u,end:b,min:0,dur:1440,days:Array.from({length:f+1},(x,v)=>B(te(u,v)))}}let l=Ut(e.start);if(!l)return null;let d=Ut(e.end);(!d||d<=l)&&(d=new Date(l.getTime()+30*6e4));let p=Math.max(1,Math.round((d.getTime()-l.getTime())/6e4));return{el:e,key:e.key,name:t,allDay:s,start:l,end:d,min:l.getHours()*60+l.getMinutes(),dur:p,days:[B(l)]}},Hx=function(){return this.events.map(e=>a(this,y,lo).call(this,e)).filter(e=>!!e)},Nx=function(e){let t=new Map;for(let i of e)for(let s of i.days)(t.get(s)??t.set(s,[]).get(s)).push(i);for(let i of t.values())i.sort((s,l)=>(s.allDay===l.allDay?0:s.allDay?-1:1)||s.start.getTime()-l.start.getTime()||s.name.localeCompare(l.name));return t},gt=function(e){return me(e,{weekday:"long",day:"numeric",month:"long"},r(this,y,fr))},hd=function(e){return r(this,y,Om).format((e%1440+1440)%1440)},pd=function(e,t){let i=this.hourCycle==="h12"||this.hourCycle==="h23"?{hourCycle:this.hourCycle}:{},s=Dx(r(this,y,fr),{hour:"numeric",minute:"2-digit",...i});try{if(B(e)===B(t)&&s.formatRangeToParts){let p=s.formatRangeToParts(e,t),u=p.findIndex(f=>f.source==="endRange"),b=-1;if(p.forEach((f,x)=>{f.source==="startRange"&&(b=x)}),b>=0&&u>b){let f=x=>Sf(x.map(v=>v.value).join(""));return this.t("timeRange",{start:f(p.slice(0,b+1)),end:f(p.slice(u))})}}}catch{}let l=B(e)===B(t),d=p=>l?a(this,y,hd).call(this,p.getHours()*60+p.getMinutes()):r(this,y,Om).dateTime(p);return this.t("timeRange",{start:d(e),end:d(t)})},Bm=function(e){return e.allDay?B(e.start)===B(e.end)?this.t("allDayOn",{date:a(this,y,gt).call(this,e.start)}):this.t("allDayRange",{start:a(this,y,gt).call(this,e.start),end:a(this,y,gt).call(this,e.end)}):B(e.start)!==B(e.end)&&!(e.end.getHours()===0&&e.end.getMinutes()===0&&qm(e.start,e.end)===1)?a(this,y,pd).call(this,e.start,e.end):this.t("timed",{date:a(this,y,gt).call(this,e.start),time:a(this,y,pd).call(this,e.start,e.end)})},Px=function(e){let t={title:e.name,when:a(this,y,Bm).call(this,e),kind:e.el.kind};return this.t(e.el.kind?"eventNameKind":"eventName",t)},Ix=function(e){let t=r(this,y,fr);if(r(this,y,Oe)==="month")return r(this,y,cd).monthYear(r(this,y,It));if(e.length===1)return me(e[0],{weekday:"long",day:"numeric",month:"long",year:"numeric"},t);let i=Dx(t,{day:"numeric",month:"short",year:"numeric"});try{if(i.formatRange)return Sf(i.formatRange(e[0],e[e.length-1]))}catch{}return`${i.format(e[0])} \u2013 ${i.format(e[e.length-1])}`},qx=function(e){return r(this,y,Om).hour12?Sf(me(new Date(2e3,0,1,e),{hour:"numeric",hourCycle:"h12"},r(this,y,fr))):a(this,y,hd).call(this,e*60)},Ns=function(e,t){let{start:i,end:s}=a(this,y,Rf).call(this,e,t);return e.mode==="time"?this.t("timed",{date:a(this,y,gt).call(this,i),time:a(this,y,pd).call(this,i,s)}):a(this,y,gt).call(this,te(R(e.origin),t.group-e.from.group))},Df=function(){let e=this.getBoundingClientRect().width;if(!e)return;let t=e<B0;t!==this._narrow&&(this._narrow=t)},md=function(e,t){return r(this,y,Oe)==="month"?fe(e,t):r(this,y,Oe)==="week"?te(e,t*(this._narrow?3:7)):te(e,t)},Ox=function(e){this.view!==e&&(this.view=e)},ud=function(){return[...this.renderRoot.querySelectorAll(".item")]},Bx=function(e){let t=[...this.renderRoot.querySelectorAll("[data-k]")],i=t.find(s=>s.dataset.k===e&&s.classList.contains("item"))??t.find(s=>s.dataset.k===e);if(i)return i;if(e.startsWith("ev:")&&!this.controlled){let s=e.slice(e.lastIndexOf(":")+1);return t.find(l=>l.dataset.k===`more:${s}`)??null}return null},Fx=function(){let e=B(r(this,y,It));if(r(this,y,Af))return`day:${e}`;if(r(this,y,Oe)==="month")return this.readonly?`cell:${e}`:`add:${e}`;let t=Math.max(0,Math.min(23,Math.trunc(Number(this.dayStart))||0));return`slot:${e}:${t}`},Vx=function(){let e=a(this,y,ud).call(this);if(!e.length)return;let t=e.find(i=>i.dataset.k===r(this,Qt))??e.find(i=>i.dataset.k===a(this,y,Fx).call(this))??e.find(i=>i.dataset.day===B(r(this,y,It)))??e[0];for(let i of e)i.tabIndex=i===t?0:-1},jx=function(e){g(this,Qt,e.dataset.k??"");for(let t of a(this,y,ud).call(this))t.tabIndex=t===e?0:-1;e.focus()},yd=new WeakMap,xd=new WeakMap,Ux=function(e,t){let i=new Map;for(let v of a(this,y,ud).call(this)){let k=Number(v.dataset.i);(i.get(k)??i.set(k,[]).get(k)).push(v)}let s=Number(e.dataset.i),l=i.get(s)??[e],d=Math.max(0,l.indexOf(e)),p=a(this,y,qt).call(this).length,u=r(this,y,Oe)==="month",b=e.dataset.row,f=(v,k)=>{let L=v>=0&&v<p?i.get(v):void 0;return(L?.length?k(L):void 0)??null},x=v=>u?v[Math.min(d,v.length-1)]:v.find(k=>k.dataset.row===b)??v[0];switch(t){case"ArrowRight":return f(s+1,x);case"ArrowLeft":return f(s-1,x);case"ArrowDown":return l[d+1]??(u?f(s+7,v=>v[0]):null);case"ArrowUp":return d>0?l[d-1]:u?f(s-7,v=>v[v.length-1]):null;case"Home":return u?f(s-s%7,v=>v[0]):f(0,x);case"End":return u?f(Math.min(p-1,s-s%7+6),v=>v[0]):f(p-1,x);default:return null}},Kx=function(e,t){let i=e.dataset.day??B(r(this,y,It)),s=a(this,y,md).call(this,R(i)??r(this,y,It),t),l=B(s),d=(e.dataset.k??"").split(":")[0],p;r(this,y,Af)?p=`day:${l}`:r(this,y,Oe)==="month"?p=this.readonly?`cell:${l}`:`add:${l}`:d==="adadd"||e.dataset.row==="a"?p=`adadd:${l}`:p=`slot:${l}:${e.dataset.row??this.dayStart}`,this.date=B(a(this,y,md).call(this,r(this,y,It),t)),g(this,Qt,p),g(this,ft,{key:p,until:Date.now()+1e3})},wd=new WeakMap,gd=function(e){return Math.floor((1440-Math.min(e,1440))/r(this,y,Jt))+1},Wx=function(e,t){let i=r(this,ae);if(!i)return null;let s=a(this,y,qt).call(this).length,l=b=>Math.max(0,Math.min(s-1,b));if(i.mode==="day"){let b=r(this,y,Oe)==="month";switch(e){case"ArrowRight":return{group:l(t.group+1),index:0};case"ArrowLeft":return{group:l(t.group-1),index:0};case"ArrowDown":return b?{group:t.group+7<s?t.group+7:t.group,index:0}:{...t};case"ArrowUp":return b?{group:t.group-7>=0?t.group-7:t.group,index:0}:{...t};case"Home":return{group:b?t.group-t.group%7:0,index:0};case"End":return{group:b?l(t.group-t.group%7+6):s-1,index:0};default:return null}}let d=a(this,y,gd).call(this,i.ev.dur)-1,p=Math.max(1,Math.round(60/r(this,y,Jt))),u=b=>Math.max(0,Math.min(d,b));switch(e){case"ArrowRight":return{group:l(t.group+1),index:t.index};case"ArrowLeft":return{group:l(t.group-1),index:t.index};case"ArrowDown":return{group:t.group,index:u(t.index+1)};case"ArrowUp":return{group:t.group,index:u(t.index-1)};case"PageDown":return{group:t.group,index:u(t.index+p)};case"PageUp":return{group:t.group,index:u(t.index-p)};case"Home":return{group:t.group,index:0};case"End":return{group:t.group,index:d};default:return null}},Rf=function(e,t){let{ev:i}=e;if(e.mode==="time"){let d=a(this,y,qt).call(this)[t.group]??R(e.origin),p=new Date(d.getFullYear(),d.getMonth(),d.getDate(),0,t.index*r(this,y,Jt));return{start:p,end:new Date(p.getTime()+i.dur*6e4)}}let s=t.group-e.from.group,l=d=>new Date(d.getFullYear(),d.getMonth(),d.getDate()+s,d.getHours(),d.getMinutes());return{start:l(i.start),end:l(i.end)}},Hf=function(e,t){let s=a(this,y,qt).call(this).map(B).indexOf(t);if(s<0)return null;let l=r(this,y,Rx)&&!e.allDay?"time":"day",d=l==="time"?Math.min(Math.floor(e.min/r(this,y,Jt)),a(this,y,gd).call(this,e.dur)-1):0;return{ev:e,origin:t,mode:l,from:{group:s,index:d}}},Nf=function(){r(this,ae)&&(r(this,ae).ev.el.moving=!1),g(this,ae,null),this._target=null},Gx=function(e){let t=r(this,ae);if(!t||!e){this._target=null;return}let i=B(a(this,y,qt).call(this)[e.group]??R(t.origin)),s=e.group===t.from.group&&e.index===t.from.index;this._target=s?null:{iso:i,min:t.mode==="time"?e.index*r(this,y,Jt):void 0}},Yx=function(e,t){let i=r(this,ae);a(this,y,Nf).call(this),i&&(g(this,uo,performance.now()+400),a(this,y,Pf).call(this,i,e,t,"keyboard"))},Pf=function(e,t,i,s){let l=t.group===i.group&&t.index===i.index,{start:d,end:p}=a(this,y,Rf).call(this,e,i),u=B(te(R(e.origin),i.group-t.group));a(this,y,qf).call(this,e.ev,d,p,s,l,e.mode==="time"?B(d):u)},If=function(e,t,i){return e?{start:B(t),end:B(i)}:{start:Sx(t),end:Sx(i)}},qf=function(e,t,i,s,l,d){let p=e.el,u=e.name,b=a(this,y,If).call(this,e.allDay,e.start,e.end),f=a(this,y,If).call(this,e.allDay,t,i),x=q=>{s==="keyboard"&&g(this,ft,{key:q,until:Date.now()+1e3})};if(l||b.start===f.start&&b.end===f.end)return s!=="api"&&r(this,Je).announce(this.t("sameSpot",{event:u})),this.requestUpdate(),!1;let v={...e,start:t,end:i},k=e.allDay?a(this,y,gt).call(this,t):this.t("timed",{date:a(this,y,gt).call(this,t),time:a(this,y,pd).call(this,t,i)}),L=[],P={value:e.key,event:p,from:b,to:f,allDay:e.allDay,source:s,waitUntil:q=>{L.push(Promise.resolve(q))}};return this.dispatchEvent(new CustomEvent("cm-move",{detail:P,bubbles:!0,composed:!0,cancelable:!0}))?(this.controlled||(r(this,Ps).set(p,b),p.start=f.start,p.end=f.end),x(`ev:${e.key}:${d}`),this.requestUpdate(),r(this,Je).announce(this.t("moved",{event:u,place:v.allDay?a(this,y,gt).call(this,t):k})),L.length&&(p.pending=!0,Promise.all(L).then(()=>{p.pending=!1,this.controlled||r(this,Ps).delete(p)},()=>{p.pending=!1,this.controlled?r(this,Je).announce(this.t("reverted",{event:u,place:a(this,y,Bm).call(this,e)})):this.revert(p)})),!0):(r(this,Je).announce(this.t("refused",{event:u,place:k})),this.requestUpdate(),!1)},$d=new WeakMap,Of=function(e,t){let i=[...this.renderRoot.querySelectorAll('.tcell[data-row="0"]')];if(!i.length)return null;let s=0,l=1/0;i.forEach((p,u)=>{let b=p.getBoundingClientRect(),f=e<b.left?b.left-e:e>b.right?e-b.right:0;f<l&&(l=f,s=Number(p.dataset.i??u))});let d=i[0].getBoundingClientRect();return{group:s,min:(t-d.top)/d.height*60}},Xx=function(e,t){let i=[...this.renderRoot.querySelectorAll("[data-drop]")];if(!i.length)return null;let s=null,l=1/0;for(let d of i){let p=d.getBoundingClientRect(),u=e<p.left?p.left-e:e>p.right?e-p.right:0,b=t<p.top?p.top-t:t>p.bottom?t-p.bottom:0,f=Math.hypot(u,b);f<l&&(l=f,s=d)}return s?Number(s.dataset.i):null},kd=new WeakMap,Ed=new WeakMap,Md=new WeakMap,_d=new WeakMap,Td=new WeakMap,Cd=new WeakMap,Bf=function(){let e=r(this,ne);e.started=!0,clearTimeout(e.timer),getSelection()?.removeAllRanges(),this._more="",e.ev.el.moving=!0,this.dragging=!0,r(this,Je).announce(this.t("pickedUp",{event:e.ev.name,place:a(this,y,Ns).call(this,e,e.from)})),a(this,y,Fm).call(this);let t=()=>{r(this,ne)?.started&&(a(this,y,Jx).call(this),r(this,ne).raf=requestAnimationFrame(t))};e.raf=requestAnimationFrame(t)},Fm=function(){let e=r(this,ne);if(!e)return;let t=null;if(e.mode==="time"){let l=a(this,y,Of).call(this,e.x,e.y);if(l){let d=a(this,y,gd).call(this,e.ev.dur)-1;t={group:l.group,index:Math.max(0,Math.min(d,Math.round((l.min-e.grab)/r(this,y,Jt))))}}}else{let l=a(this,y,Xx).call(this,e.x,e.y);l!==null&&(t={group:l,index:0})}if(!t||t.group===e.to.group&&t.index===e.to.index&&this._target)return;let i=t.group!==e.to.group;e.to=t;let s=t.group===e.from.group&&t.index===e.from.index;this._target=s?null:{iso:B(a(this,y,qt).call(this)[t.group]),min:e.mode==="time"?t.index*r(this,y,Jt):void 0},i&&r(this,Je).announce(this.t("over",{place:a(this,y,Ns).call(this,e,t)}))},Jx=function(){let e=r(this,ne),t=this.renderRoot.querySelector(".tg");if(!e||!t||e.mode!=="time")return;let i=40,s=14,l=x=>x<i?Math.ceil((i-Math.max(x,0))/i*s):0,d=t.getBoundingClientRect();if(e.x<d.left||e.x>d.right)return;let p=t.querySelector(".tg-top")?.getBoundingClientRect().bottom??d.top,u=l(e.y-p),b=l(d.bottom-e.y),f=t.scrollTop;u?t.scrollTop-=u:b&&(t.scrollTop+=b),t.scrollTop!==f&&a(this,y,Fm).call(this)},br=function(e){let t=r(this,ne);t&&(g(this,ne,null),clearTimeout(t.timer),t.raf&&cancelAnimationFrame(t.raf),window.removeEventListener("pointermove",r(this,_d),!0),window.removeEventListener("pointerup",r(this,Td),!0),window.removeEventListener("pointercancel",r(this,Cd),!0),window.removeEventListener("touchmove",r(this,Ed),!0),window.removeEventListener("contextmenu",r(this,Md),!0),t.started&&(t.ev.el.moving=!1,this.dragging=!1,this._target=null,e&&a(this,y,Pf).call(this,t,t.from,t.to,"pointer")))},fd=function(e,t){this.readonly||this.dispatchEvent(new CustomEvent("cm-add",{detail:{start:e,allDay:t,view:r(this,y,Oe)},bubbles:!0,composed:!0}))},Qx=function(e,t,i){let s=i*60;if(e.detail>0){let p=e.currentTarget.getBoundingClientRect(),u=Math.floor((e.clientY-p.top)/p.height*60/r(this,y,Jt))*r(this,y,Jt);s+=Math.max(0,Math.min(59,u))}let l=Math.floor(s/60),d=s%60;a(this,y,fd).call(this,`${t}T${Um(l)}:${Um(d)}`,!1)},Ff=function(e,t){if(performance.now()<r(this,uo)||r(this,He).active){e.preventDefault();return}this.dispatchEvent(new CustomEvent("cm-open",{detail:{value:t.key,event:t.el},bubbles:!0,composed:!0,cancelable:!0}))||e.preventDefault()},Zx=function(e){this._more=e,g(this,go,!0)},Vm=function(e){let t=this._more;this._more="",e&&t&&(g(this,Qt,`more:${t}`),g(this,ft,{key:`more:${t}`,until:Date.now()+1e3}))},Vf=function(){return r(this,ae)?.ev??(r(this,ne)?.started?r(this,ne).ev:null)},co=function(e,t,i,s,l,d={}){let p=e.el,u=p.pending,b=a(this,y,Px).call(this,e),f=!this.readonly&&!p.locked&&!u,x=["attention","information","success","critical"].includes(p.tone)?p.tone:"neutral",v=`chip ${s} tone-${x}${l?" item":""}${p.moving?" moving":""}${u?" pending":""}${p.locked?" locked":""}`,k=p.icon?c`<cm-icon name=${p.icon} size="14"></cm-icon>`:h,L=e.allDay?h:c`<span class="tm">${a(this,y,hd).call(this,e.min)}</span>`,P=p.kind&&(s!=="month"||!p.icon)?c`<span class="k">${p.kind}</span>`:h,U=u?c`<span class="spin" aria-hidden="true"></span>`:h,q=s==="time"?c`<span class="lead">${k}${L}${U}</span><span class="h">${e.name}</span>${P}`:c`${k}${L}<span class="h">${e.name}</span>${P}${U}`,O=u?`${b}, ${this.t("saving")}`:b,be=f?`${r(this,Xe)}-mv`:`${r(this,Xe)}-op`,G=`ev:${e.key}:${t}`,K=f?this.t("roleDescription"):h;return p.href?c`<a class=${v} href=${p.href} style=${d.style??h} data-k=${G} data-ev=${e.key} data-day=${t} data-i=${i}
|
|
3075
|
+
<span id="${r(this,Je)}-gh" hidden>${this.t("gridHelp")}</span>
|
|
3076
|
+
<span id="${r(this,Je)}-mv" hidden>${this.t("openHint")} ${this.t("instructions")}</span>
|
|
3077
|
+
<span id="${r(this,Je)}-op" hidden>${this.t("openHint")}</span>
|
|
3078
|
+
</div>`}};mo=new WeakMap,Je=new WeakMap,Qe=new WeakMap,He=new WeakMap,ae=new WeakMap,ne=new WeakMap,Ps=new WeakMap,Qt=new WeakMap,ft=new WeakMap,bd=new WeakMap,vr=new WeakMap,uo=new WeakMap,go=new WeakMap,fo=new WeakMap,bo=new WeakMap,vd=new WeakMap,y=new WeakSet,Be=function(){return Dx.includes(this.view)?this.view:"month"},fr=function(){return Wi(this,this.locale)},cd=function(){return Ha(r(this,y,fr))},Om=function(){return Aa(r(this,y,fr),this.hourCycle)},Jt=function(){let e=Math.trunc(Number(this.step));return e>=1&&e<=240?e:15},Lf=function(){let e=Number(this.firstDayOfWeek);return this.firstDayOfWeek==null||Number.isNaN(e)?Ra(r(this,y,fr)):(Math.trunc(e)%7+7)%7},dd=function(){return R(this.today)?this.today:Xu()},It=function(){return R(this.date)??R(r(this,y,dd))},Af=function(){return r(this,y,Be)==="month"&&this._narrow},Nx=function(){return r(this,y,Be)!=="month"},qt=function(){let e=r(this,y,It),t=r(this,y,Lf);if(r(this,y,Be)==="day")return[e];if(r(this,y,Be)==="week"){if(this._narrow)return[e,te(e,1),te(e,2)];let d=te(e,-((e.getDay()-t+7)%7));return Array.from({length:7},(p,u)=>te(d,u))}let i=ze(e),s=te(i,-((i.getDay()-t+7)%7)),l=Math.ceil((qm(s,Jr(e))+1)/7)*7;return Array.from({length:l},(d,p)=>te(s,p))},lo=function(e){let t=e.name,i=e.heading||(e.textContent??"").replace(/\s+/g," ").trim()||t,s=!!R(e.start),l=e.allDay||s;if(l){let b=R(xt(e.start).date||e.start);if(!b)return null;let f=R(xt(e.end).date||e.end)??b;f<b&&(f=b);let x=Math.min(qm(b,f),366);return{el:e,key:e.key,name:t,text:i,allDay:l,start:b,end:f,min:0,dur:1440,days:Array.from({length:x+1},(v,k)=>B(te(b,k)))}}let d=Ut(e.start);if(!d)return null;let p=Ut(e.end);(!p||p<=d)&&(p=new Date(d.getTime()+30*6e4));let u=Math.max(1,Math.round((p.getTime()-d.getTime())/6e4));return{el:e,key:e.key,name:t,text:i,allDay:l,start:d,end:p,min:d.getHours()*60+d.getMinutes(),dur:u,days:[B(d)]}},Px=function(){return this.events.map(e=>a(this,y,lo).call(this,e)).filter(e=>!!e)},Ix=function(e){let t=new Map;for(let i of e)for(let s of i.days)(t.get(s)??t.set(s,[]).get(s)).push(i);for(let i of t.values())i.sort((s,l)=>(s.allDay===l.allDay?0:s.allDay?-1:1)||s.start.getTime()-l.start.getTime()||s.name.localeCompare(l.name));return t},gt=function(e){return me(e,{weekday:"long",day:"numeric",month:"long"},r(this,y,fr))},hd=function(e){return r(this,y,Om).format((e%1440+1440)%1440)},pd=function(e,t){let i=this.hourCycle==="h12"||this.hourCycle==="h23"?{hourCycle:this.hourCycle}:{},s=Hx(r(this,y,fr),{hour:"numeric",minute:"2-digit",...i});try{if(B(e)===B(t)&&s.formatRangeToParts){let p=s.formatRangeToParts(e,t),u=p.findIndex(f=>f.source==="endRange"),b=-1;if(p.forEach((f,x)=>{f.source==="startRange"&&(b=x)}),b>=0&&u>b){let f=x=>Sf(x.map(v=>v.value).join(""));return this.t("timeRange",{start:f(p.slice(0,b+1)),end:f(p.slice(u))})}}}catch{}let l=B(e)===B(t),d=p=>l?a(this,y,hd).call(this,p.getHours()*60+p.getMinutes()):r(this,y,Om).dateTime(p);return this.t("timeRange",{start:d(e),end:d(t)})},Bm=function(e){return e.allDay?B(e.start)===B(e.end)?this.t("allDayOn",{date:a(this,y,gt).call(this,e.start)}):this.t("allDayRange",{start:a(this,y,gt).call(this,e.start),end:a(this,y,gt).call(this,e.end)}):B(e.start)!==B(e.end)&&!(e.end.getHours()===0&&e.end.getMinutes()===0&&qm(e.start,e.end)===1)?a(this,y,pd).call(this,e.start,e.end):this.t("timed",{date:a(this,y,gt).call(this,e.start),time:a(this,y,pd).call(this,e.start,e.end)})},qx=function(e){let t={title:e.name,when:a(this,y,Bm).call(this,e),kind:e.el.kind};return this.t(e.el.kind?"eventNameKind":"eventName",t)},Ox=function(e){let t=r(this,y,fr);if(r(this,y,Be)==="month")return r(this,y,cd).monthYear(r(this,y,It));if(e.length===1)return me(e[0],{weekday:"long",day:"numeric",month:"long",year:"numeric"},t);let i=Hx(t,{day:"numeric",month:"short",year:"numeric"});try{if(i.formatRange)return Sf(i.formatRange(e[0],e[e.length-1]))}catch{}return`${i.format(e[0])} \u2013 ${i.format(e[e.length-1])}`},Bx=function(e){return r(this,y,Om).hour12?Sf(me(new Date(2e3,0,1,e),{hour:"numeric",hourCycle:"h12"},r(this,y,fr))):a(this,y,hd).call(this,e*60)},Ns=function(e,t){let{start:i,end:s}=a(this,y,Rf).call(this,e,t);return e.mode==="time"?this.t("timed",{date:a(this,y,gt).call(this,i),time:a(this,y,pd).call(this,i,s)}):a(this,y,gt).call(this,te(R(e.origin),t.group-e.from.group))},Df=function(){let e=this.getBoundingClientRect().width;if(!e)return;let t=e<V0;t!==this._narrow&&(this._narrow=t)},md=function(e,t){return r(this,y,Be)==="month"?fe(e,t):r(this,y,Be)==="week"?te(e,t*(this._narrow?3:7)):te(e,t)},Fx=function(e){this.view!==e&&(this.view=e)},ud=function(){return[...this.renderRoot.querySelectorAll(".item")]},Vx=function(e){let t=[...this.renderRoot.querySelectorAll("[data-k]")],i=t.find(s=>s.dataset.k===e&&s.classList.contains("item"))??t.find(s=>s.dataset.k===e);if(i)return i;if(e.startsWith("ev:")&&!this.controlled){let s=e.slice(e.lastIndexOf(":")+1);return t.find(l=>l.dataset.k===`more:${s}`)??null}return null},jx=function(){let e=B(r(this,y,It));if(r(this,y,Af))return`day:${e}`;if(r(this,y,Be)==="month")return this.readonly?`cell:${e}`:`add:${e}`;let t=Math.max(0,Math.min(23,Math.trunc(Number(this.dayStart))||0));return`slot:${e}:${t}`},Ux=function(){let e=a(this,y,ud).call(this);if(!e.length)return;let t=e.find(i=>i.dataset.k===r(this,Qt))??e.find(i=>i.dataset.k===a(this,y,jx).call(this))??e.find(i=>i.dataset.day===B(r(this,y,It)))??e[0];for(let i of e)i.tabIndex=i===t?0:-1},Kx=function(e){g(this,Qt,e.dataset.k??"");for(let t of a(this,y,ud).call(this))t.tabIndex=t===e?0:-1;e.focus()},yd=new WeakMap,xd=new WeakMap,Wx=function(e,t){let i=new Map;for(let v of a(this,y,ud).call(this)){let k=Number(v.dataset.i);(i.get(k)??i.set(k,[]).get(k)).push(v)}let s=Number(e.dataset.i),l=i.get(s)??[e],d=Math.max(0,l.indexOf(e)),p=a(this,y,qt).call(this).length,u=r(this,y,Be)==="month",b=e.dataset.row,f=(v,k)=>{let L=v>=0&&v<p?i.get(v):void 0;return(L?.length?k(L):void 0)??null},x=v=>u?v[Math.min(d,v.length-1)]:v.find(k=>k.dataset.row===b)??v[0];switch(t){case"ArrowRight":return f(s+1,x);case"ArrowLeft":return f(s-1,x);case"ArrowDown":return l[d+1]??(u?f(s+7,v=>v[0]):null);case"ArrowUp":return d>0?l[d-1]:u?f(s-7,v=>v[v.length-1]):null;case"Home":return u?f(s-s%7,v=>v[0]):f(0,x);case"End":return u?f(Math.min(p-1,s-s%7+6),v=>v[0]):f(p-1,x);default:return null}},Gx=function(e,t){let i=e.dataset.day??B(r(this,y,It)),s=a(this,y,md).call(this,R(i)??r(this,y,It),t),l=B(s),d=(e.dataset.k??"").split(":")[0],p;r(this,y,Af)?p=`day:${l}`:r(this,y,Be)==="month"?p=this.readonly?`cell:${l}`:`add:${l}`:d==="adadd"||e.dataset.row==="a"?p=`adadd:${l}`:p=`slot:${l}:${e.dataset.row??this.dayStart}`,this.date=B(a(this,y,md).call(this,r(this,y,It),t)),g(this,Qt,p),g(this,ft,{key:p,until:Date.now()+1e3})},wd=new WeakMap,gd=function(e){return Math.floor((1440-Math.min(e,1440))/r(this,y,Jt))+1},Yx=function(e,t){let i=r(this,ae);if(!i)return null;let s=a(this,y,qt).call(this).length,l=b=>Math.max(0,Math.min(s-1,b));if(i.mode==="day"){let b=r(this,y,Be)==="month";switch(e){case"ArrowRight":return{group:l(t.group+1),index:0};case"ArrowLeft":return{group:l(t.group-1),index:0};case"ArrowDown":return b?{group:t.group+7<s?t.group+7:t.group,index:0}:{...t};case"ArrowUp":return b?{group:t.group-7>=0?t.group-7:t.group,index:0}:{...t};case"Home":return{group:b?t.group-t.group%7:0,index:0};case"End":return{group:b?l(t.group-t.group%7+6):s-1,index:0};default:return null}}let d=a(this,y,gd).call(this,i.ev.dur)-1,p=Math.max(1,Math.round(60/r(this,y,Jt))),u=b=>Math.max(0,Math.min(d,b));switch(e){case"ArrowRight":return{group:l(t.group+1),index:t.index};case"ArrowLeft":return{group:l(t.group-1),index:t.index};case"ArrowDown":return{group:t.group,index:u(t.index+1)};case"ArrowUp":return{group:t.group,index:u(t.index-1)};case"PageDown":return{group:t.group,index:u(t.index+p)};case"PageUp":return{group:t.group,index:u(t.index-p)};case"Home":return{group:t.group,index:0};case"End":return{group:t.group,index:d};default:return null}},Rf=function(e,t){let{ev:i}=e;if(e.mode==="time"){let d=a(this,y,qt).call(this)[t.group]??R(e.origin),p=new Date(d.getFullYear(),d.getMonth(),d.getDate(),0,t.index*r(this,y,Jt));return{start:p,end:new Date(p.getTime()+i.dur*6e4)}}let s=t.group-e.from.group,l=d=>new Date(d.getFullYear(),d.getMonth(),d.getDate()+s,d.getHours(),d.getMinutes());return{start:l(i.start),end:l(i.end)}},Hf=function(e,t){let s=a(this,y,qt).call(this).map(B).indexOf(t);if(s<0)return null;let l=r(this,y,Nx)&&!e.allDay?"time":"day",d=l==="time"?Math.min(Math.floor(e.min/r(this,y,Jt)),a(this,y,gd).call(this,e.dur)-1):0;return{ev:e,origin:t,mode:l,from:{group:s,index:d}}},Nf=function(){r(this,ae)&&(r(this,ae).ev.el.moving=!1),g(this,ae,null),this._target=null},Xx=function(e){let t=r(this,ae);if(!t||!e){this._target=null;return}let i=B(a(this,y,qt).call(this)[e.group]??R(t.origin)),s=e.group===t.from.group&&e.index===t.from.index;this._target=s?null:{iso:i,min:t.mode==="time"?e.index*r(this,y,Jt):void 0}},Jx=function(e,t){let i=r(this,ae);a(this,y,Nf).call(this),i&&(g(this,uo,performance.now()+400),a(this,y,Pf).call(this,i,e,t,"keyboard"))},Pf=function(e,t,i,s){let l=t.group===i.group&&t.index===i.index,{start:d,end:p}=a(this,y,Rf).call(this,e,i),u=B(te(R(e.origin),i.group-t.group));a(this,y,qf).call(this,e.ev,d,p,s,l,e.mode==="time"?B(d):u)},If=function(e,t,i){return e?{start:B(t),end:B(i)}:{start:Ax(t),end:Ax(i)}},qf=function(e,t,i,s,l,d){let p=e.el,u=e.name,b=a(this,y,If).call(this,e.allDay,e.start,e.end),f=a(this,y,If).call(this,e.allDay,t,i),x=q=>{s==="keyboard"&&g(this,ft,{key:q,until:Date.now()+1e3})};if(l||b.start===f.start&&b.end===f.end)return s!=="api"&&r(this,Qe).announce(this.t("sameSpot",{event:u})),this.requestUpdate(),!1;let v={...e,start:t,end:i},k=e.allDay?a(this,y,gt).call(this,t):this.t("timed",{date:a(this,y,gt).call(this,t),time:a(this,y,pd).call(this,t,i)}),L=[],P={value:e.key,event:p,from:b,to:f,allDay:e.allDay,source:s,waitUntil:q=>{L.push(Promise.resolve(q))}};return this.dispatchEvent(new CustomEvent("cm-move",{detail:P,bubbles:!0,composed:!0,cancelable:!0}))?(this.controlled||(r(this,Ps).set(p,b),p.start=f.start,p.end=f.end),x(`ev:${e.key}:${d}`),this.requestUpdate(),r(this,Qe).announce(this.t("moved",{event:u,place:v.allDay?a(this,y,gt).call(this,t):k})),L.length&&(p.pending=!0,Promise.all(L).then(()=>{p.pending=!1,this.controlled||r(this,Ps).delete(p)},()=>{p.pending=!1,this.controlled?r(this,Qe).announce(this.t("reverted",{event:u,place:a(this,y,Bm).call(this,e)})):this.revert(p)})),!0):(r(this,Qe).announce(this.t("refused",{event:u,place:k})),this.requestUpdate(),!1)},$d=new WeakMap,Of=function(e,t){let i=[...this.renderRoot.querySelectorAll('.tcell[data-row="0"]')];if(!i.length)return null;let s=0,l=1/0;i.forEach((p,u)=>{let b=p.getBoundingClientRect(),f=e<b.left?b.left-e:e>b.right?e-b.right:0;f<l&&(l=f,s=Number(p.dataset.i??u))});let d=i[0].getBoundingClientRect();return{group:s,min:(t-d.top)/d.height*60}},Qx=function(e,t){let i=[...this.renderRoot.querySelectorAll("[data-drop]")];if(!i.length)return null;let s=null,l=1/0;for(let d of i){let p=d.getBoundingClientRect(),u=e<p.left?p.left-e:e>p.right?e-p.right:0,b=t<p.top?p.top-t:t>p.bottom?t-p.bottom:0,f=Math.hypot(u,b);f<l&&(l=f,s=d)}return s?Number(s.dataset.i):null},kd=new WeakMap,Ed=new WeakMap,Md=new WeakMap,_d=new WeakMap,Td=new WeakMap,Cd=new WeakMap,Bf=function(){let e=r(this,ne);e.started=!0,clearTimeout(e.timer),getSelection()?.removeAllRanges(),this._more="",e.ev.el.moving=!0,this.dragging=!0,r(this,Qe).announce(this.t("pickedUp",{event:e.ev.name,place:a(this,y,Ns).call(this,e,e.from)})),a(this,y,Fm).call(this);let t=()=>{r(this,ne)?.started&&(a(this,y,Zx).call(this),r(this,ne).raf=requestAnimationFrame(t))};e.raf=requestAnimationFrame(t)},Fm=function(){let e=r(this,ne);if(!e)return;let t=null;if(e.mode==="time"){let l=a(this,y,Of).call(this,e.x,e.y);if(l){let d=a(this,y,gd).call(this,e.ev.dur)-1;t={group:l.group,index:Math.max(0,Math.min(d,Math.round((l.min-e.grab)/r(this,y,Jt))))}}}else{let l=a(this,y,Qx).call(this,e.x,e.y);l!==null&&(t={group:l,index:0})}if(!t||t.group===e.to.group&&t.index===e.to.index&&this._target)return;let i=t.group!==e.to.group;e.to=t;let s=t.group===e.from.group&&t.index===e.from.index;this._target=s?null:{iso:B(a(this,y,qt).call(this)[t.group]),min:e.mode==="time"?t.index*r(this,y,Jt):void 0},i&&r(this,Qe).announce(this.t("over",{place:a(this,y,Ns).call(this,e,t)}))},Zx=function(){let e=r(this,ne),t=this.renderRoot.querySelector(".tg");if(!e||!t||e.mode!=="time")return;let i=40,s=14,l=x=>x<i?Math.ceil((i-Math.max(x,0))/i*s):0,d=t.getBoundingClientRect();if(e.x<d.left||e.x>d.right)return;let p=t.querySelector(".tg-top")?.getBoundingClientRect().bottom??d.top,u=l(e.y-p),b=l(d.bottom-e.y),f=t.scrollTop;u?t.scrollTop-=u:b&&(t.scrollTop+=b),t.scrollTop!==f&&a(this,y,Fm).call(this)},br=function(e){let t=r(this,ne);t&&(g(this,ne,null),clearTimeout(t.timer),t.raf&&cancelAnimationFrame(t.raf),window.removeEventListener("pointermove",r(this,_d),!0),window.removeEventListener("pointerup",r(this,Td),!0),window.removeEventListener("pointercancel",r(this,Cd),!0),window.removeEventListener("touchmove",r(this,Ed),!0),window.removeEventListener("contextmenu",r(this,Md),!0),t.started&&(t.ev.el.moving=!1,this.dragging=!1,this._target=null,e&&a(this,y,Pf).call(this,t,t.from,t.to,"pointer")))},fd=function(e,t){this.readonly||this.dispatchEvent(new CustomEvent("cm-add",{detail:{start:e,allDay:t,view:r(this,y,Be)},bubbles:!0,composed:!0}))},ew=function(e,t,i){let s=i*60;if(e.detail>0){let p=e.currentTarget.getBoundingClientRect(),u=Math.floor((e.clientY-p.top)/p.height*60/r(this,y,Jt))*r(this,y,Jt);s+=Math.max(0,Math.min(59,u))}let l=Math.floor(s/60),d=s%60;a(this,y,fd).call(this,`${t}T${Um(l)}:${Um(d)}`,!1)},Ff=function(e,t){if(performance.now()<r(this,uo)||r(this,He).active){e.preventDefault();return}this.dispatchEvent(new CustomEvent("cm-open",{detail:{value:t.key,event:t.el},bubbles:!0,composed:!0,cancelable:!0}))||e.preventDefault()},tw=function(e){this._more=e,g(this,go,!0)},Vm=function(e){let t=this._more;this._more="",e&&t&&(g(this,Qt,`more:${t}`),g(this,ft,{key:`more:${t}`,until:Date.now()+1e3}))},Vf=function(){return r(this,ae)?.ev??(r(this,ne)?.started?r(this,ne).ev:null)},co=function(e,t,i,s,l,d={}){let p=e.el,u=p.pending,b=a(this,y,qx).call(this,e),f=!this.readonly&&!p.locked&&!u,x=["attention","information","success","critical"].includes(p.tone)?p.tone:"neutral",v=`chip ${s} tone-${x}${l?" item":""}${p.moving?" moving":""}${u?" pending":""}${p.locked?" locked":""}`,k=p.icon?c`<cm-icon name=${p.icon} size="14"></cm-icon>`:h,L=e.allDay?h:c`<span class="tm">${a(this,y,hd).call(this,e.min)}</span>`,P=p.kind&&(s!=="month"||!p.icon)?c`<span class="k">${p.kind}</span>`:h,U=u?c`<span class="spin" aria-hidden="true"></span>`:h,q=s==="time"?c`<span class="lead">${k}${L}${U}</span><span class="h">${e.text}</span>${P}`:c`${k}${L}<span class="h">${e.text}</span>${P}${U}`,O=u?`${b}, ${this.t("saving")}`:b,be=f?`${r(this,Je)}-mv`:`${r(this,Je)}-op`,G=`ev:${e.key}:${t}`,K=f?this.t("roleDescription"):h;return p.href?c`<a class=${v} href=${p.href} style=${d.style??h} data-k=${G} data-ev=${e.key} data-day=${t} data-i=${i}
|
|
3075
3079
|
data-row=${d.row??h} aria-label=${O} aria-describedby=${be} aria-roledescription=${K}
|
|
3076
3080
|
@click=${Z=>a(this,y,Ff).call(this,Z,e)}>${q}</a>`:c`<button type="button" class=${v} style=${d.style??h} data-k=${G} data-ev=${e.key} data-day=${t} data-i=${i}
|
|
3077
3081
|
data-row=${d.row??h} aria-label=${O} aria-describedby=${be} aria-roledescription=${K}
|
|
3078
|
-
@click=${Z=>a(this,y,Ff).call(this,Z,e)}>${q}</button>`},jm=function(e,t="",i){return c`<div class="ph ${t}" style=${i??h} aria-hidden="true">${e.
|
|
3082
|
+
@click=${Z=>a(this,y,Ff).call(this,Z,e)}>${q}</button>`},jm=function(e,t="",i){return c`<div class="ph ${t}" style=${i??h} aria-hidden="true">${e.text}</div>`},iw=function(e){let t=r(this,y,Be),i=t==="week"&&this._narrow,s=t==="month"?this.t("previousMonth"):i?this.t("previousDays",{count:3}):t==="week"?this.t("previousWeek"):this.t("previousDay"),l=t==="month"?this.t("nextMonth"):i?this.t("nextDays",{count:3}):t==="week"?this.t("nextWeek"):this.t("nextDay"),d=Math.min(6,Math.max(1,Math.round(Number(this.headingLevel))||2));return c`<div class="head" part="header">
|
|
3079
3083
|
<div class="nav">
|
|
3080
3084
|
<button type="button" class="hb icon prev" aria-label=${s} @click=${()=>this.previous()}><cm-icon name="chevron-left" size="18"></cm-icon></button>
|
|
3081
3085
|
<button type="button" class="hb today" @click=${()=>this.goToToday()}>${this.t("today")}</button>
|
|
3082
3086
|
<button type="button" class="hb icon next" aria-label=${l} @click=${()=>this.next()}><cm-icon name="chevron-right" size="18"></cm-icon></button>
|
|
3083
3087
|
</div>
|
|
3084
|
-
<div class="title" part="title" id="${r(this,
|
|
3088
|
+
<div class="title" part="title" id="${r(this,Je)}-t" role="heading" aria-level=${d} aria-live="polite">${a(this,y,Ox).call(this,e)}${this.loading?c`<cm-spinner size="small" aria-hidden="true"></cm-spinner>`:h}</div>
|
|
3085
3089
|
<div class="views" role="group" aria-label=${this.t("views")}>
|
|
3086
|
-
${
|
|
3090
|
+
${Dx.map(p=>c`<button type="button" class="hb" data-view=${p} aria-pressed=${p===t?"true":"false"} @click=${()=>a(this,y,Fx).call(this,p)}>${this.t(p)}</button>`)}
|
|
3087
3091
|
</div>
|
|
3088
|
-
</div>`},
|
|
3092
|
+
</div>`},rw=function(e){let t=r(this,y,cd),i=Array.from({length:7},(s,l)=>(l+r(this,y,Lf))%7);return c`<thead><tr>${i.map(s=>c`<th scope="col" abbr=${t.weekdaysLong[s]}><span aria-hidden="true">${e?t.weekdaysShort[s].slice(0,2):t.weekdaysShort[s]}</span><span class="vh">${t.weekdaysLong[s]}</span></th>`)}</tr></thead>`},sw=function(e,t){let i=r(this,y,It),s=r(this,y,dd),l=Math.max(1,Math.trunc(Number(this.maxEvents))||3),d=a(this,y,Vf).call(this),p=this._target,u=Array.from({length:e.length/7},(q,O)=>e.slice(O*7,O*7+7)),b=this._narrow,f=(q,O,be)=>{let G=B(q),K=t.get(G)??[],Z=a(this,y,gt).call(this,q),zt=`${q.getMonth()!==i.getMonth()?"other":""} ${G===s?"today":""} ${p?.iso===G?"over":""}`,$r=c`<span class="num" aria-hidden="true">${r(this,y,cd).day(q)}</span>`;if(b){let Ve=K.slice(0,3).map(Ys=>["attention","information","success","critical"].includes(Ys.el.tone)?Ys.el.tone:"neutral");return c`<td class=${zt} data-drop data-i=${O} aria-selected=${G===B(i)?"true":"false"} aria-current=${G===s?"date":h}>
|
|
3089
3093
|
<button type="button" class="dayb item" data-k="day:${G}" data-i=${O} data-day=${G} aria-label=${this.t("dayEvents",{date:Z,count:K.length})}
|
|
3090
|
-
@click=${()=>{this.date=G,g(this,Qt,`day:${G}`)}}>${$r}<span class="dots">${
|
|
3091
|
-
</td>`}let X=K,St=0;if(K.length>l){X=K.slice(0,l-1);let
|
|
3094
|
+
@click=${()=>{this.date=G,g(this,Qt,`day:${G}`)}}>${$r}<span class="dots">${Ve.map(Ys=>c`<span class="dot tone-${Ys}"></span>`)}</span></button>
|
|
3095
|
+
</td>`}let X=K,St=0;if(K.length>l){X=K.slice(0,l-1);let Ve=d&&K.find(Ys=>Ys.key===d.key);Ve&&!X.includes(Ve)&&(X=[...K.slice(0,l-2),Ve]),St=K.length-X.length}let pe=this.readonly;return c`<td class="${zt}${pe?" item":""}" data-drop data-i=${O} data-day=${G} data-k=${pe?`cell:${G}`:h}
|
|
3092
3096
|
aria-label=${pe?this.t("dayEvents",{date:Z,count:K.length}):h} aria-current=${G===s?"date":h}>
|
|
3093
3097
|
<div class="dh">${$r}<span class="vh">${Z}</span>
|
|
3094
3098
|
${pe?h:c`<button type="button" class="add item" data-k="add:${G}" data-i=${O} data-day=${G} aria-label=${this.t("addOn",{date:Z})}
|
|
3095
3099
|
@click=${()=>a(this,y,fd).call(this,G,!0)}><cm-icon name="plus" size="16"></cm-icon></button>`}
|
|
3096
3100
|
</div>
|
|
3097
3101
|
${X.length||p?.iso===G&&d?c`<ul class="evs">
|
|
3098
|
-
${X.map(
|
|
3102
|
+
${X.map(Ve=>c`<li>${a(this,y,co).call(this,Ve,G,O,"month",!0)}</li>`)}
|
|
3099
3103
|
${p?.iso===G&&d?c`<li aria-hidden="true">${a(this,y,jm).call(this,d)}</li>`:h}
|
|
3100
3104
|
</ul>`:h}
|
|
3101
3105
|
${St?c`<button type="button" class="more item" data-k="more:${G}" data-i=${O} data-day=${G} aria-haspopup="dialog"
|
|
3102
3106
|
aria-expanded=${this._more===G?"true":"false"} aria-label=${this.t("moreLabel",{count:St,date:Z})}
|
|
3103
|
-
@click=${()=>this._more===G?a(this,y,Vm).call(this,!1):a(this,y,
|
|
3107
|
+
@click=${()=>this._more===G?a(this,y,Vm).call(this,!1):a(this,y,tw).call(this,G)}>${this.t("more",{count:St})}</button>`:h}
|
|
3104
3108
|
${this._more===G?c`<div class="pop ${be>=4?"end":""}" role="dialog" aria-label=${Z}>
|
|
3105
3109
|
<div class="pop-h"><span>${Z}</span><button type="button" class="xb" aria-label=${this.t("close")} @click=${()=>a(this,y,Vm).call(this,!0)}><cm-icon name="close" size="16"></cm-icon></button></div>
|
|
3106
|
-
<ul>${K.map(
|
|
3110
|
+
<ul>${K.map(Ve=>c`<li>${a(this,y,co).call(this,Ve,G,O,"list",!1)}</li>`)}</ul>
|
|
3107
3111
|
</div>`:h}
|
|
3108
|
-
</td>`},x=c`<table class="month ${b?"compact":""}" part="grid" role="grid" aria-labelledby="${r(this,
|
|
3112
|
+
</td>`},x=c`<table class="month ${b?"compact":""}" part="grid" role="grid" aria-labelledby="${r(this,Je)}-t" aria-describedby="${r(this,Je)}-gh"
|
|
3109
3113
|
aria-busy=${this.loading?"true":"false"}>
|
|
3110
|
-
${a(this,y,
|
|
3114
|
+
${a(this,y,rw).call(this,b)}
|
|
3111
3115
|
<tbody>${u.map((q,O)=>c`<tr>${q.map((be,G)=>f(be,O*7+G,G))}</tr>`)}</tbody>
|
|
3112
3116
|
</table>`;if(!b)return x;let v=B(i),k=t.get(v)??[],L=e.findIndex(q=>B(q)===v),P=a(this,y,gt).call(this,i),U=Math.min(6,Math.max(1,Math.round(Number(this.headingLevel))||2)+1);return c`${x}
|
|
3113
|
-
<section class="agenda" part="agenda" aria-labelledby="${r(this,
|
|
3117
|
+
<section class="agenda" part="agenda" aria-labelledby="${r(this,Je)}-ag">
|
|
3114
3118
|
<div class="ag-h">
|
|
3115
|
-
<div class="ag-t" id="${r(this,
|
|
3119
|
+
<div class="ag-t" id="${r(this,Je)}-ag" role="heading" aria-level=${U}>${P}</div>
|
|
3116
3120
|
${this.readonly?h:c`<button type="button" class="hb ag-add" aria-label=${this.t("addOn",{date:P})} @click=${()=>a(this,y,fd).call(this,v,!0)}>
|
|
3117
3121
|
<cm-icon name="plus" size="16"></cm-icon>${this.t("add")}</button>`}
|
|
3118
3122
|
</div>
|
|
3119
3123
|
${k.length?c`<ul class="ag-list">${k.map(q=>c`<li>${a(this,y,co).call(this,q,v,L,"list",!1)}</li>`)}</ul>`:c`<p class="empty">${this.t("noEvents")}</p>`}
|
|
3120
|
-
</section>`},
|
|
3124
|
+
</section>`},aw=function(e){let t=new Map,i=e.filter(u=>!u.allDay).sort((u,b)=>u.min-b.min||b.dur-u.dur),s=[],l=[],d=-1,p=()=>{for(let u of s)t.get(u).lanes=l.length;s=[],l=[]};for(let u of i){let b=Math.min(1440,u.min+Math.max(u.dur,20));u.min>=d&&(p(),d=-1);let f=l.findIndex(x=>x<=u.min);f<0?(f=l.length,l.push(b)):l[f]=b,t.set(u,{lane:f,lanes:1}),s.push(u),d=Math.max(d,b)}return p(),t},nw=function(e,t){let i=r(this,y,dd),s=r(this,y,cd),l=a(this,y,Vf).call(this),d=this._target,p=this.readonly,u=e.map(f=>{let x=B(f),v=t.get(x)??[];return{d:f,iso:x,text:a(this,y,gt).call(this,f),allDay:v.filter(k=>k.allDay),timed:v.filter(k=>!k.allDay),lanes:a(this,y,aw).call(this,v)}}),b=Array.from({length:24},(f,x)=>x);return c`<div class="tg" part="grid" role="grid" aria-labelledby="${r(this,Je)}-t" aria-describedby="${r(this,Je)}-gh" aria-busy=${this.loading?"true":"false"}
|
|
3121
3125
|
style="--cols:${e.length}">
|
|
3122
3126
|
<div class="tg-top" role="rowgroup">
|
|
3123
3127
|
<div class="row" role="row">
|
|
@@ -3138,10 +3142,10 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3138
3142
|
</div>
|
|
3139
3143
|
<div class="tg-body" role="rowgroup">
|
|
3140
3144
|
${b.map(f=>c`<div class="row hr" role="row">
|
|
3141
|
-
<div class="axis" role="rowheader"><span>${a(this,y,
|
|
3145
|
+
<div class="axis" role="rowheader"><span>${a(this,y,Bx).call(this,f)}</span></div>
|
|
3142
3146
|
${u.map((x,v)=>{let k=x.timed.filter(P=>Math.floor(P.min/60)===f),L=l&&!l.allDay&&d?.iso===x.iso&&d.min!==void 0&&Math.floor(d.min/60)===f;return c`<div class="tcell" role="gridcell" data-i=${v} data-row=${f} data-day=${x.iso}>
|
|
3143
3147
|
${p?h:c`<button type="button" class="slot item" data-k="slot:${x.iso}:${f}" data-i=${v} data-row=${f} data-day=${x.iso}
|
|
3144
|
-
aria-label=${this.t("addAt",{time:a(this,y,hd).call(this,f*60),date:x.text})} @click=${P=>a(this,y,
|
|
3148
|
+
aria-label=${this.t("addAt",{time:a(this,y,hd).call(this,f*60),date:x.text})} @click=${P=>a(this,y,ew).call(this,P,x.iso,f)}></button>`}
|
|
3145
3149
|
${k.map(P=>{let U=x.lanes.get(P)??{lane:0,lanes:1},q=Math.min(P.dur,1440-P.min)/60;return a(this,y,co).call(this,P,x.iso,v,"time",!0,{row:String(f),style:`--top:${(P.min-f*60)/60};--len:${q};--lane:${U.lane};--lanes:${U.lanes}`})})}
|
|
3146
3150
|
${L?a(this,y,jm).call(this,l,"time",`--top:${(d.min-f*60)/60};--len:${Math.min(l.dur,1440-d.min)/60}`):h}
|
|
3147
3151
|
</div>`})}
|
|
@@ -3308,7 +3312,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3308
3312
|
.chip.time > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
3309
3313
|
.chip.time .lead { display: flex; align-items: center; gap: 4px; min-width: 0; }
|
|
3310
3314
|
.ph.time { position: absolute; z-index: 3; inset-inline: 0 2px; inset-block-start: calc(var(--top) * var(--h)); height: calc(var(--len) * var(--h)); align-items: flex-start; }
|
|
3311
|
-
`];$("cm-calendar",po);var
|
|
3315
|
+
`];$("cm-calendar",po);var tT=z("reportTile",{pinned:", pinned"}),Is=class extends C{constructor(){super(...arguments);this.label="";this.icon="chart";this.href="";this.pinned=!1}render(){let e=c`
|
|
3312
3316
|
<span class="icon" aria-hidden="true"><slot name="icon"><cm-icon name=${this.icon} size="40"></cm-icon></slot></span>
|
|
3313
3317
|
<span class="label">${this.label}</span>
|
|
3314
3318
|
${this.pinned?c`<span class="pin" part="pin"><cm-icon name="pin" size="16"></cm-icon>
|
|
@@ -3345,7 +3349,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3345
3349
|
.title { margin-bottom: var(--cm-space-8); }
|
|
3346
3350
|
.grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--cm-space-8); }
|
|
3347
3351
|
}
|
|
3348
|
-
`];$("cm-report-tiles",vo);var
|
|
3352
|
+
`];$("cm-report-tiles",vo);var nT=z("metric",{up:"Up {change}",down:"Down {change}",flat:"No change {change}",good:"{trend}, good",bad:"{trend}, bad",loadingValue:"Loading {label}"}),ow=/^\s*-?\d+(\.\d+)?\s*$/,yo=class extends C{constructor(){super(...arguments);this.label="";this.value="";this.hint="";this.change="";this.trendSentiment="auto";this.href="";this.loading=!1;this._hasHint=!1;this.onHintSlot=e=>{this._hasHint=e.target.assignedNodes({flatten:!1}).some(t=>t.nodeType===1||t.textContent?.trim())}}connectedCallback(){super.connectedCallback(),this._hasHint=!!this.querySelector(':scope > [slot="hint"]')}figure(){let e=this.value;if(e===""||e===null||e===void 0)return"";let t=typeof e=="number"?e:ow.test(String(e))?Number(e):NaN;return Number.isNaN(t)?String(e):this.formatNumber(t)}sentiment(){let e=this.trendSentiment;return e==="positive"||e==="negative"||e==="neutral"?e:this.trend==="up"?"positive":this.trend==="down"?"negative":"neutral"}renderChange(){let e=this.trend&&["up","down","flat"].includes(this.trend)?this.trend:void 0;if(!this.change&&!e)return h;if(!e)return c`<span class="change neutral" part="change">${this.change}</span>`;let t=this.sentiment(),i=this.t(e,{change:this.change}).trim(),s=t==="positive"?this.t("good",{trend:i}):t==="negative"?this.t("bad",{trend:i}):i;return c`<span class="change ${e} ${t}" part="change">
|
|
3349
3353
|
<cm-icon name=${e==="flat"?"arrow-left":"arrow-up-right"} size="16"></cm-icon><span aria-hidden="true">${this.change}</span><span class="sr">${s}</span>
|
|
3350
3354
|
</span>`}render(){let e=this._hasHint||!!this.hint,t=this.loading?c`<cm-skeleton variant="block"></cm-skeleton>`:this.figure(),i=this.renderChange(),s=i!==h||e,l=c`
|
|
3351
3355
|
<span class="label" id="label" part="label">${this.label}</span>
|
|
@@ -3354,7 +3358,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3354
3358
|
${i}
|
|
3355
3359
|
<span class="hint ${e?"on":""}" part="hint"><slot name="hint" @slotchange=${this.onHintSlot}>${this.hint}</slot></span>
|
|
3356
3360
|
</span>
|
|
3357
|
-
`,d=c`<span class="sr" role="status">${this.loading?this.t("loadingValue",{label:this.label}):""}</span>`,p=this.loading?"true":h;return this.href?c`<a class="tile" part="tile" href=${this.href} aria-labelledby="label value" aria-describedby=${s?"foot":h} aria-busy=${p}>${l}</a>${d}`:c`<div class="tile" part="tile" aria-busy=${p}>${l}</div>${d}`}};yo.properties={label:{},value:{converter:{fromAttribute:e=>e!==null&&
|
|
3361
|
+
`,d=c`<span class="sr" role="status">${this.loading?this.t("loadingValue",{label:this.label}):""}</span>`,p=this.loading?"true":h;return this.href?c`<a class="tile" part="tile" href=${this.href} aria-labelledby="label value" aria-describedby=${s?"foot":h} aria-busy=${p}>${l}</a>${d}`:c`<div class="tile" part="tile" aria-busy=${p}>${l}</div>${d}`}};yo.properties={label:{},value:{converter:{fromAttribute:e=>e!==null&&ow.test(e)?Number(e):e??"",toAttribute:e=>e==null?e:String(e)}},hint:{},change:{},trend:{reflect:!0},trendSentiment:{attribute:"trend-sentiment",reflect:!0},href:{},loading:{type:Boolean,reflect:!0},_hasHint:{state:!0}},yo.styles=[E,w`
|
|
3358
3362
|
:host { display: block; align-self: stretch; min-inline-size: 0; }
|
|
3359
3363
|
.tile {
|
|
3360
3364
|
display: flex; flex-direction: column; gap: 4px; block-size: 100%; min-inline-size: 0;
|
|
@@ -3390,13 +3394,13 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3390
3394
|
.value { font-size: var(--cm-type-heading-lg-resp-size); }
|
|
3391
3395
|
}
|
|
3392
3396
|
@media (forced-colors: active) { .change { color: CanvasText; } }
|
|
3393
|
-
`];$("cm-metric",yo);var xo=class extends A{constructor(){super(...arguments);this.label="";this.icon="";this.href="";this.value="";this.current=!1;this.badge="";this.expanded=!1;this.primary=!1}render(){return null}toItem(){return
|
|
3394
|
-
<nav part="nav" aria-label=${this.label||this.t("label")} @keydown=${a(this,Y,
|
|
3397
|
+
`];$("cm-metric",yo);var xo=class extends A{constructor(){super(...arguments);this.label="";this.icon="";this.href="";this.value="";this.current=!1;this.badge="";this.expanded=!1;this.primary=!1}render(){return null}toItem(){return lw(this)}};xo.properties={label:{reflect:!0},icon:{reflect:!0},href:{reflect:!0},value:{reflect:!0},current:{type:Boolean,reflect:!0},badge:{reflect:!0},expanded:{type:Boolean,reflect:!0},primary:{type:Boolean,reflect:!0}},xo.styles=w`:host { display: none !important; }`;$("cm-nav-item",xo);function lw(o){let n=i=>o.getAttribute(i),e={label:n("label")||""};n("icon")&&(e.icon=n("icon")),n("href")&&(e.href=n("href")),n("value")&&(e.value=n("value")),o.hasAttribute("current")&&(e.current=!0),n("badge")&&(e.badge=n("badge")),o.hasAttribute("expanded")&&(e.expanded=!0),o.hasAttribute("primary")&&(e.primary=!0);let t=Si(o);return t.length&&(e.items=t),e}var Si=o=>[...o.children].filter(n=>n.localName==="cm-nav-item").map(lw),jf=o=>o.value||o.href||o.label,Km=o=>!!o.current||!!o.items?.some(Km),yr=(o,n)=>{let e=new MutationObserver(n);return e.observe(o,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["label","icon","href","value","current","badge","expanded","primary"]}),e},xr=(o,n)=>o.dispatchEvent(new CustomEvent("cm-navigate",{bubbles:!0,composed:!0,cancelable:!0,detail:{item:n,value:jf(n),href:n.href??""}}));var gT=z("sideNavigation",{label:"Main",collapse:"Collapse menu",expand:"Expand menu"}),zd,Sd,Ym,Y,Uf,Wm,Kf,cw,dw,Wf,Gf,hw,Yf,Xf,Gm,Jf,pw,wo=class extends C{constructor(){super(...arguments);m(this,Y);this.items=[];this.collapsed=!1;this.collapsible=!1;this._slotted=[];this._open=new Set;m(this,zd,new Set);m(this,Sd);m(this,Ym,N("cm-sidenav"))}connectedCallback(){super.connectedCallback(),a(this,Y,Uf).call(this),g(this,Sd,yr(this,()=>a(this,Y,Uf).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,Sd)?.disconnect()}get navItems(){return this.items.length?this.items:this._slotted}willUpdate(){this.navItems.forEach((e,t)=>{let i=a(this,Y,Wm).call(this,e,t);r(this,zd).has(i)||!e.items?.length||(r(this,zd).add(i),(e.expanded||Km(e))&&this._open.add(i))})}toggle(e,t){let i=this.navItems[e];if(!i?.items?.length)return;let s=a(this,Y,Wm).call(this,i,e),l=t??!this._open.has(s);if(l===this._open.has(s))return;let d=new Set(this._open);l?d.add(s):d.delete(s),this._open=d,this.dispatchEvent(new CustomEvent("cm-expand",{bubbles:!0,composed:!0,detail:{item:i,expanded:l}}))}render(){let e=this.collapsed;return c`
|
|
3398
|
+
<nav part="nav" aria-label=${this.label||this.t("label")} @keydown=${a(this,Y,dw)}>
|
|
3395
3399
|
<slot name="header"></slot>
|
|
3396
3400
|
<ul part="list">
|
|
3397
3401
|
${this.navItems.map((t,i)=>{if(!t.items?.length)return c`<li>${a(this,Y,Jf).call(this,t,"",{index:i})}</li>`;let s=!e&&this._open.has(a(this,Y,Wm).call(this,t,i)),l=`${r(this,Ym)}-${i}`;return c`<li>
|
|
3398
3402
|
${a(this,Y,Gm).call(this,t,c`<button type="button" class="item parent ${Km(t)?"has-current":""}" part="item" data-index=${i}
|
|
3399
|
-
aria-expanded=${s?"true":"false"} aria-controls=${l} @click=${()=>e?a(this,Y,
|
|
3403
|
+
aria-expanded=${s?"true":"false"} aria-controls=${l} @click=${()=>e?a(this,Y,hw).call(this,i):this.toggle(i)}>
|
|
3400
3404
|
${a(this,Y,Yf).call(this,t)}${a(this,Y,Xf).call(this,t)}
|
|
3401
3405
|
${e?h:c`<cm-icon class="chev" name="chevron-down" size="16"></cm-icon>`}
|
|
3402
3406
|
</button>`)}
|
|
@@ -3405,13 +3409,13 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3405
3409
|
</ul>
|
|
3406
3410
|
</li>`})}
|
|
3407
3411
|
</ul>
|
|
3408
|
-
${a(this,Y,
|
|
3412
|
+
${a(this,Y,pw).call(this)}
|
|
3409
3413
|
<slot name="footer"></slot>
|
|
3410
3414
|
<slot hidden></slot>
|
|
3411
3415
|
</nav>
|
|
3412
|
-
`}};zd=new WeakMap,Sd=new WeakMap,Ym=new WeakMap,Y=new WeakSet,Uf=function(){this._slotted=Si(this)},Wm=function(e,t){return`${t}:${jf(e)}`},Kf=function(e,t){xr(this,t)||e.preventDefault()},
|
|
3416
|
+
`}};zd=new WeakMap,Sd=new WeakMap,Ym=new WeakMap,Y=new WeakSet,Uf=function(){this._slotted=Si(this)},Wm=function(e,t){return`${t}:${jf(e)}`},Kf=function(e,t){xr(this,t)||e.preventDefault()},cw=function(){return[...this.renderRoot.querySelectorAll(".item")].filter(e=>!e.closest("[hidden]"))},dw=function(e){let t=e.composedPath()[0]?.closest?.(".item");if(!t)return;let i=a(this,Y,cw).call(this),s=i.indexOf(t),l=Number(t.dataset.index),d=se(e,this),p;if(e.key==="ArrowDown")p=i[(s+1)%i.length];else if(e.key==="ArrowUp")p=i[(s-1+i.length)%i.length];else if(e.key==="Home")p=i[0];else if(e.key==="End")p=i[i.length-1];else{if(this.collapsed&&(d==="ArrowRight"||d==="ArrowLeft"))return;if(d==="ArrowRight"&&t.classList.contains("parent")){this.toggle(l,!0),e.preventDefault();return}else if(d==="ArrowLeft"){if(t.classList.contains("parent")?this.toggle(l,!1):t.dataset.parent&&(p=this.renderRoot.querySelector(`.parent[data-index="${t.dataset.parent}"]`)??void 0),!p){e.preventDefault();return}}else return}e.preventDefault(),p?.focus()},Wf=function(e,t=0){return e.flatMap(i=>[[i,t],...a(this,Y,Wf).call(this,i.items??[],t+1)])},Gf=function(e){if(e===this.collapsed)return!0;let t=this.dispatchEvent(new CustomEvent("cm-collapse",{bubbles:!0,composed:!0,cancelable:!0,detail:{collapsed:e}}));return t&&(this.collapsed=e),t},hw=function(e){a(this,Y,Gf).call(this,!1)&&(this.toggle(e,!0),this.updateComplete.then(()=>this.renderRoot.querySelector(`.parent[data-index="${e}"]`)?.focus()))},Yf=function(e){return e.icon?c`<cm-icon name=${e.icon} size="20"></cm-icon>`:this.collapsed?c`<span class="initial" aria-hidden="true">${([...e.label.trim()][0]??"").toLocaleUpperCase(this.locale)}</span>`:h},Xf=function(e){if(!this.collapsed)return c`<span class="label">${e.label}</span>${e.badge?c`<span class="badge">${e.badge}</span>`:h}`;let t=e.badge&&/^\d{1,2}\+?$/.test(e.badge.trim());return c`<span class="sr">${e.label}${e.badge?` (${e.badge})`:""}</span>${e.badge?c`<span class="dot ${t?"count":""}" aria-hidden="true">${t?e.badge:h}</span>`:h}`},Gm=function(e,t){return this.collapsed?c`<cm-tooltip content=${e.label} placement="end" visual-only>${t}</cm-tooltip>`:t},Jf=function(e,t,i={}){let s=c`${a(this,Y,Yf).call(this,e)}${a(this,Y,Xf).call(this,e)}`;return a(this,Y,Gm).call(this,e,e.href?c`<a class="item ${t}" part="item" href=${e.href} aria-current=${e.current?"page":h}
|
|
3413
3417
|
data-index=${i.index??h} data-parent=${i.parent??h} @click=${l=>a(this,Y,Kf).call(this,l,e)}>${s}</a>`:c`<button type="button" class="item ${t}" part="item" aria-current=${e.current?"page":h}
|
|
3414
|
-
data-index=${i.index??h} data-parent=${i.parent??h} @click=${l=>a(this,Y,Kf).call(this,l,e)}>${s}</button>`)},
|
|
3418
|
+
data-index=${i.index??h} data-parent=${i.parent??h} @click=${l=>a(this,Y,Kf).call(this,l,e)}>${s}</button>`)},pw=function(){if(!this.collapsible)return h;let e=this.t(this.collapsed?"expand":"collapse"),t=c`<cm-icon name=${this.collapsed?"chevron-right":"chevron-left"} size="20"></cm-icon>${this.collapsed?c`<span class="sr">${e}</span>`:c`<span class="label">${e}</span>`}`;return c`<div class="toggle-row">${a(this,Y,Gm).call(this,{label:e},c`<button type="button" class="item toggle" part="collapse-button"
|
|
3415
3419
|
@click=${()=>a(this,Y,Gf).call(this,!this.collapsed)}>${t}</button>`)}</div>`},wo.properties={items:{type:Array},label:{string:"label"},collapsed:{type:Boolean,reflect:!0},collapsible:{type:Boolean,reflect:!0},_slotted:{state:!0},_open:{state:!0}},wo.styles=[E,w`
|
|
3416
3420
|
:host { display: block; width: var(--cm-side-navigation-width, 220px); }
|
|
3417
3421
|
nav {
|
|
@@ -3457,7 +3461,7 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3457
3461
|
background: var(--cm-count-bg); box-shadow: 0 0 0 2px var(--cm-bg-dashboard);
|
|
3458
3462
|
}
|
|
3459
3463
|
.dot.count { inset-block-start: 2px; height: 16px; padding: 0 var(--cm-space-4); font-size: var(--cm-font-size-12); font-weight: 600; line-height: 16px; text-align: center; font-variant-numeric: tabular-nums; color: var(--cm-count-text); }
|
|
3460
|
-
`];$("cm-side-navigation",wo);function
|
|
3464
|
+
`];$("cm-side-navigation",wo);function mw(o){let n=o.trim().split(/[\s._@-]+/).filter(Boolean);if(!n.length)return"";let e=[...n[0]][0]??"",t=n.length>1&&!/[.@]/.test(o)?[...n[n.length-1]][0]??"":"";return(e+t).toLocaleUpperCase()}var $o=class extends A{constructor(){super(...arguments);this.name="";this.src="";this.size="medium";this.shape="round";this.decorative=!1;this._failed=!1}willUpdate(e){e.has("src")&&(this._failed=!1)}render(){let e=mw(this.name),t=this.decorative||!this.name?h:this.name,i=this.decorative||!this.name?"true":h,s,l="avatar";return this.src&&!this._failed?s=c`<img src=${this.src} alt="" @error=${()=>{this._failed=!0}}>`:e?s=c`<span aria-hidden="true">${e}</span>`:(l+=" icon",s=c`<cm-icon name=${this.shape==="square"?"store":"user"} size="18"></cm-icon>`),c`<span class=${l} part="avatar" role=${t===h?h:"img"} aria-label=${t} aria-hidden=${i}>${s}</span>`}};$o.properties={name:{},src:{},size:{reflect:!0},shape:{reflect:!0},decorative:{type:Boolean,reflect:!0},_failed:{state:!0}},$o.styles=[E,w`
|
|
3461
3465
|
:host { --_size: var(--cm-avatar-size, 36px); display: inline-flex; vertical-align: middle; flex: none; }
|
|
3462
3466
|
:host([size='small']) { --_size: var(--cm-avatar-size, 24px); }
|
|
3463
3467
|
:host([size='large']) { --_size: var(--cm-avatar-size, 48px); }
|
|
@@ -3470,22 +3474,22 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3470
3474
|
.icon { background: var(--cm-bg-input-filled); color: var(--cm-icon-selected); }
|
|
3471
3475
|
img { inline-size: 100%; block-size: 100%; object-fit: cover; display: block; }
|
|
3472
3476
|
@media (forced-colors: active) { .avatar { border: 1px solid CanvasText; } }
|
|
3473
|
-
`];$("cm-avatar",$o);var
|
|
3477
|
+
`];$("cm-avatar",$o);var MT=z("headerBar",{label:"Admin",store:"Store: {store}. Switch store",balance:"Wallet balance {balance}",account:"Account: {name}",search:"Search"}),Mo,Li,_o,Fe,Ld,Qf,ko,Eo=class extends C{constructor(){super();m(this,Fe);this.store="";this.balance="";this.userName="";this.avatarSrc="";this._narrow=!1;this._hasSearch=!1;this._searchOpen=!1;m(this,Mo);m(this,Li,!1);m(this,_o,null);this.addEventListener("cm-select",e=>{let t=a(this,Fe,Ld).call(this);this._searchOpen&&t&&e.composedPath().includes(t)&&this.closeSearch()})}get searchOpen(){return this._searchOpen}openSearch(){if(!this._narrow){a(this,Fe,Ld).call(this)?.focus();return}this._searchOpen||(g(this,_o,Wu()),this._searchOpen=!0)}closeSearch(){this._searchOpen&&(this._searchOpen=!1)}connectedCallback(){super.connectedCallback(),g(this,Mo,new ResizeObserver(([e])=>{let t=e.contentRect.width<=900;t!==this._narrow&&(this._narrow=t,t||this.closeSearch())})),r(this,Mo).observe(this)}disconnectedCallback(){super.disconnectedCallback(),r(this,Mo)?.disconnect(),r(this,Li)&&(Ql(),g(this,Li,!1))}updated(e){if(!e.has("_searchOpen"))return;let t=this.renderRoot.querySelector("dialog.layer");if(this._searchOpen&&t&&!t.open)t.showModal(),r(this,Li)||(Ku(),g(this,Li,!0)),a(this,Fe,Ld).call(this)?.focus(),a(this,Fe,ko).call(this,"cm-search-toggle",{open:!0});else if(!this._searchOpen&&e.get("_searchOpen")){t?.open&&t.close(),r(this,Li)&&(Ql(),g(this,Li,!1));let i=r(this,_o)??this.renderRoot.querySelector(".search-btn");g(this,_o,null),i?.isConnected&&i.focus(),a(this,Fe,ko).call(this,"cm-search-toggle",{open:!1})}}render(){return c`
|
|
3474
3478
|
<header part="bar" role="banner" aria-label=${this.label||h}>
|
|
3475
3479
|
<div class="logo"><slot name="logo"></slot></div>
|
|
3476
3480
|
${this.store?c`<button type="button" class="store" part="store" aria-haspopup="true" aria-label=${this.t("store",{store:this.store})}
|
|
3477
|
-
@click=${()=>a(this,
|
|
3478
|
-
${this._narrow?h:c`<div class="search${this._hasSearch?" has":""}" part="search"><slot name="search" @slotchange=${a(this,
|
|
3481
|
+
@click=${()=>a(this,Fe,ko).call(this,"cm-store-switch")}><span>${this.store}</span><cm-icon name="chevron-down" size="16"></cm-icon></button>`:h}
|
|
3482
|
+
${this._narrow?h:c`<div class="search${this._hasSearch?" has":""}" part="search"><slot name="search" @slotchange=${a(this,Fe,Qf)}></slot></div>`}
|
|
3479
3483
|
<span class="grow"></span>
|
|
3480
3484
|
<div class="end">
|
|
3481
3485
|
${this._narrow&&this._hasSearch?c`<button type="button" class="search-btn" part="search-button" aria-label=${this.searchLabel}
|
|
3482
3486
|
aria-haspopup="dialog" aria-expanded=${this._searchOpen?"true":"false"} @click=${()=>this.openSearch()}><cm-icon name="search" size="20"></cm-icon></button>`:h}
|
|
3483
3487
|
<div class="actions"><slot name="actions"></slot></div>
|
|
3484
3488
|
${this.balance?c`<button type="button" class="pill" part="balance" aria-label=${this.t("balance",{balance:this.balance})}
|
|
3485
|
-
@click=${()=>a(this,
|
|
3489
|
+
@click=${()=>a(this,Fe,ko).call(this,"cm-wallet")}>${this.balance}</button>`:h}
|
|
3486
3490
|
<slot name="end"></slot>
|
|
3487
3491
|
${this.userName?c`<button type="button" class="user" part="user" aria-haspopup="true" aria-label=${this.t("account",{name:this.userName})}
|
|
3488
|
-
@click=${()=>a(this,
|
|
3492
|
+
@click=${()=>a(this,Fe,ko).call(this,"cm-account")}><span class="name">${this.userName}</span>
|
|
3489
3493
|
<cm-avatar class="avatar" name=${this.userName} src=${this.avatarSrc} decorative></cm-avatar></button>`:h}
|
|
3490
3494
|
<slot name="account"></slot>
|
|
3491
3495
|
</div>
|
|
@@ -3494,11 +3498,11 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3494
3498
|
@keydown=${e=>{e.key==="Escape"&&!e.defaultPrevented&&(e.preventDefault(),this.closeSearch())}}
|
|
3495
3499
|
@cancel=${e=>{e.preventDefault(),this.closeSearch()}} @close=${()=>this.closeSearch()}>
|
|
3496
3500
|
<div class="layer-bar">
|
|
3497
|
-
<div class="layer-search"><slot name="search" @slotchange=${a(this,
|
|
3501
|
+
<div class="layer-search"><slot name="search" @slotchange=${a(this,Fe,Qf)}></slot></div>
|
|
3498
3502
|
<button type="button" class="layer-close" aria-label=${this.t("close")} @click=${()=>this.closeSearch()}><cm-icon name="close" size="20"></cm-icon></button>
|
|
3499
3503
|
</div>
|
|
3500
3504
|
</dialog>`:h}
|
|
3501
|
-
`}};Mo=new WeakMap,Li=new WeakMap,_o=new WeakMap,
|
|
3505
|
+
`}};Mo=new WeakMap,Li=new WeakMap,_o=new WeakMap,Fe=new WeakSet,Ld=function(){return this.querySelector(':scope > [slot="search"]')},Qf=function(){this._hasSearch=!!a(this,Fe,Ld).call(this)},ko=function(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t}))},Eo.properties={store:{},balance:{},userName:{attribute:"user-name"},avatarSrc:{attribute:"avatar-src"},label:{string:"label"},searchLabel:{attribute:"search-label",string:"search"},_narrow:{state:!0},_hasSearch:{state:!0},_searchOpen:{state:!0}},Eo.styles=[E,w`
|
|
3502
3506
|
:host {
|
|
3503
3507
|
display: block; background: var(--cm-bg-surface); container-type: inline-size;
|
|
3504
3508
|
--_h: var(--cm-control-height-md); --_touch: var(--cm-control-height-touch);
|
|
@@ -3575,10 +3579,11 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3575
3579
|
@media (pointer: coarse) {
|
|
3576
3580
|
@container (max-width: 640px) { .user { min-width: var(--_touch); } }
|
|
3577
3581
|
}
|
|
3578
|
-
`];$("cm-header-bar",Eo);var
|
|
3579
|
-
<ul>${this.navItems.slice(0,5).map(e=>c`<li>${a(this,qs,
|
|
3582
|
+
`];$("cm-header-bar",Eo);var AT=z("bottomNavigation",{label:"Main"}),Ad,qs,Zf,uw,To=class extends C{constructor(){super(...arguments);m(this,qs);this.items=[];this.fixed=!1;this.menuItem="";this.menuOpen=!1;this._slotted=[];m(this,Ad)}connectedCallback(){super.connectedCallback(),a(this,qs,Zf).call(this),g(this,Ad,yr(this,()=>a(this,qs,Zf).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,Ad)?.disconnect()}get navItems(){return this.items.length?this.items:this._slotted}render(){return c`<nav part="nav" aria-label=${this.label||this.t("label")}>
|
|
3583
|
+
<ul>${this.navItems.slice(0,5).map(e=>c`<li>${a(this,qs,uw).call(this,e)}</li>`)}</ul>
|
|
3580
3584
|
<slot hidden></slot>
|
|
3581
|
-
</nav>`}};Ad=new WeakMap,qs=new WeakSet,Zf=function(){this._slotted=Si(this)},
|
|
3585
|
+
</nav>`}};Ad=new WeakMap,qs=new WeakSet,Zf=function(){this._slotted=Si(this)},uw=function(e){let t=!!this.menuItem&&e.value===this.menuItem,i=this.menuOpen&&this.menuItem?t:!!e.current,s=`item ${e.primary?"primary":""} ${i?"on":""}`,l=c`<span class="icon">${e.icon?c`<cm-icon name=${e.icon} size=${e.primary?16:20}></cm-icon>`:h}</span><span class="label">${e.label}</span>`,d=p=>{xr(this,e)||p.preventDefault()};return e.href?c`<a class=${s} part="item" href=${e.href} aria-current=${e.current?"page":h} @click=${d}>${l}</a>`:c`<button type="button" class=${s} part="item" aria-current=${e.current?"page":h}
|
|
3586
|
+
aria-expanded=${t?String(this.menuOpen):h} @click=${d}>${l}</button>`},To.properties={items:{type:Array},label:{string:"label"},fixed:{type:Boolean,reflect:!0},menuItem:{attribute:"menu-item"},menuOpen:{type:Boolean,attribute:"menu-open",reflect:!0},_slotted:{state:!0}},To.styles=[E,w`
|
|
3582
3587
|
:host { display: block; }
|
|
3583
3588
|
:host([fixed]) { position: fixed; inset-inline: 0; bottom: 0; z-index: 20; }
|
|
3584
3589
|
nav {
|
|
@@ -3594,36 +3599,36 @@ cm-data-table:has(> table) { container-type: inline-size; }
|
|
|
3594
3599
|
font: inherit; font-size: var(--cm-font-size-12); line-height: var(--cm-line-height-12); font-weight: 500;
|
|
3595
3600
|
color: var(--cm-text-tertiary); text-decoration: none; background: none; border: 0; border-radius: var(--cm-radius-sm); cursor: pointer;
|
|
3596
3601
|
}
|
|
3597
|
-
.item:hover, .item
|
|
3602
|
+
.item:hover, .item.on { color: var(--cm-text-default); }
|
|
3598
3603
|
/* The current tab (1.19, from the CRM): bold label and a tinted pill behind the icon, so it shows in every look. */
|
|
3599
|
-
.item
|
|
3600
|
-
.item
|
|
3604
|
+
.item.on { font-weight: 600; }
|
|
3605
|
+
.item.on:not(.primary) .icon { background: var(--cm-bg-selected); color: var(--cm-icon-selected); }
|
|
3601
3606
|
.item:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 0; }
|
|
3602
3607
|
.icon { display: grid; place-items: center; width: calc(var(--cm-space-48) + var(--cm-space-8)); height: calc(var(--cm-space-24) + var(--cm-space-4)); border-radius: var(--cm-radius-full); }
|
|
3603
3608
|
.primary .icon { width: var(--cm-icon-size-lg); height: var(--cm-icon-size-lg); }
|
|
3604
3609
|
.primary .icon { color: var(--cm-action-primary-text); background: var(--cm-action-primary); border-radius: var(--cm-radius-xs); }
|
|
3605
3610
|
.label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
3606
|
-
`];$("cm-bottom-navigation",To);var
|
|
3611
|
+
`];$("cm-bottom-navigation",To);var qT=z("mobileMenu",{label:"Menu",profile:"Profile",store:"Logged in to store"}),Dd,Os,Ze,eb,gw,tb,ib,fw,Co=class extends C{constructor(){super(...arguments);m(this,Ze);this.items=[];this.store="";this.userName="";this.userEmail="";this.avatarSrc="";this._slotted=[];this._page=null;m(this,Dd);m(this,Os,N("cm-mmenu"))}connectedCallback(){super.connectedCallback(),a(this,Ze,eb).call(this),g(this,Dd,yr(this,()=>a(this,Ze,eb).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,Dd)?.disconnect()}get sections(){return this.items.length?this.items:this._slotted}back(){if(!this._page)return;let[e,t]=this._page;this._page=null,this.updateComplete.then(()=>this.renderRoot.querySelector(`[data-row="${e}-${t}"]`)?.focus())}render(){let e=this.sections,t=this._page?e[this._page[0]]?.items?.[this._page[1]]:void 0;return t?c`<nav part="nav" class="sub" aria-label=${this.label||this.t("label")} id="${r(this,Os)}-sub"
|
|
3607
3612
|
@keydown=${i=>{i.key==="Escape"&&(i.preventDefault(),this.back())}}>
|
|
3608
3613
|
<button type="button" class="back" part="back" @click=${()=>this.back()}><cm-icon name="arrow-left" size="16"></cm-icon>
|
|
3609
3614
|
${t.label}</button>
|
|
3610
|
-
<ul class="card" aria-label=${t.label}>${t.items.map(i=>c`<li>${a(this,
|
|
3615
|
+
<ul class="card" aria-label=${t.label}>${t.items.map(i=>c`<li>${a(this,Ze,ib).call(this,i,0,0,!0)}</li>`)}</ul>
|
|
3611
3616
|
<slot hidden></slot>
|
|
3612
3617
|
</nav>`:c`<nav part="nav" aria-label=${this.label||this.t("label")}>
|
|
3613
|
-
${a(this,
|
|
3618
|
+
${a(this,Ze,fw).call(this)}
|
|
3614
3619
|
${e.map((i,s)=>{let l=`${r(this,Os)}-s${s}`;return c`<section aria-labelledby=${i.label?l:h}>
|
|
3615
3620
|
${i.label?c`<h2 class="heading" id=${l}>${i.label}</h2>`:h}
|
|
3616
|
-
<ul class="card">${(i.items??[]).map((d,p)=>c`<li>${a(this,
|
|
3621
|
+
<ul class="card">${(i.items??[]).map((d,p)=>c`<li>${a(this,Ze,ib).call(this,d,s,p)}</li>`)}</ul>
|
|
3617
3622
|
</section>`})}
|
|
3618
3623
|
<slot hidden></slot>
|
|
3619
|
-
</nav>`}};Dd=new WeakMap,Os=new WeakMap,
|
|
3620
|
-
@click=${()=>a(this,
|
|
3624
|
+
</nav>`}};Dd=new WeakMap,Os=new WeakMap,Ze=new WeakSet,eb=function(){this._slotted=Si(this)},gw=function(e,t){this._page=[e,t],this.updateComplete.then(()=>this.renderRoot.querySelector(".back")?.focus())},tb=function(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))},ib=function(e,t,i,s=!1){let l=b=>{xr(this,e)||b.preventDefault()};if(e.primary&&!s)return c`<button type="button" class="row action" part="row" @click=${l}>${e.label}</button>`;let d=e.icon&&!s?c`<cm-icon class="icon" name=${e.icon} size="20"></cm-icon>`:h,p=e.badge?c`<span class="badge">${e.badge}</span>`:h;if(e.items?.length&&!s)return c`<button type="button" class="row" part="row" data-row="${t}-${i}"
|
|
3625
|
+
@click=${()=>a(this,Ze,gw).call(this,t,i)}>${d}<span class="text"><span class="label">${e.label}</span>${p}</span><cm-icon class="chev" name="chevron-right" size="16"></cm-icon></button>`;let u=c`${d}<span class="text"><span class="label">${e.label}</span>${p}</span>${e.href&&!s?c`<cm-icon class="chev" name="chevron-right" size="16"></cm-icon>`:h}`;return e.href?c`<a class="row" part="row" href=${e.href} aria-current=${e.current?"page":h} @click=${l}>${u}</a>`:c`<button type="button" class="row" part="row" aria-current=${e.current?"page":h} @click=${l}>${u}</button>`},fw=function(){if(!this.store&&!this.userName)return h;let e=this.userName.trim().charAt(0).toUpperCase();return c`<section aria-labelledby="${r(this,Os)}-profile">
|
|
3621
3626
|
<h2 class="heading" id="${r(this,Os)}-profile">${this.t("profile")}</h2>
|
|
3622
3627
|
<ul class="card">
|
|
3623
|
-
${this.store?c`<li><button type="button" class="row" part="row" @click=${()=>a(this,
|
|
3628
|
+
${this.store?c`<li><button type="button" class="row" part="row" @click=${()=>a(this,Ze,tb).call(this,"cm-store-switch")}>
|
|
3624
3629
|
<span class="stack"><span class="eyebrow">${this.t("store")}</span><span>${this.store}</span></span>
|
|
3625
3630
|
<cm-icon class="chev" name="chevron-right" size="16"></cm-icon></button></li>`:h}
|
|
3626
|
-
${this.userName?c`<li><button type="button" class="row" part="row" @click=${()=>a(this,
|
|
3631
|
+
${this.userName?c`<li><button type="button" class="row" part="row" @click=${()=>a(this,Ze,tb).call(this,"cm-account")}>
|
|
3627
3632
|
<span class="avatar">${this.avatarSrc?c`<img src=${this.avatarSrc} alt="">`:c`<span aria-hidden="true">${e}</span>`}</span>
|
|
3628
3633
|
<span class="stack"><span>${this.userName}</span>${this.userEmail?c`<span class="email">${this.userEmail}</span>`:h}</span>
|
|
3629
3634
|
<cm-icon class="chev" name="chevron-right" size="16"></cm-icon></button></li>`:h}
|
|
@@ -3674,12 +3679,12 @@ ${t.label}</button>
|
|
|
3674
3679
|
}
|
|
3675
3680
|
.back:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
3676
3681
|
.sub .row { font-size: var(--cm-font-size-14); line-height: var(--cm-line-height-14); }
|
|
3677
|
-
`];$("cm-mobile-menu",Co);var
|
|
3682
|
+
`];$("cm-mobile-menu",Co);var UT=z("flashOfferBar",{label:"Offer",dismiss:"Dismiss offer"}),Xm,bw,zo=class extends C{constructor(){super(...arguments);m(this,Xm);this.icon="send";this.dismissible=!1}render(){return c`<div class="bar" part="bar" role="region" aria-label=${this.label||this.t("label")}>
|
|
3678
3683
|
<span class="icon" aria-hidden="true"><slot name="icon">${this.icon?c`<cm-icon name=${this.icon} size="20"></cm-icon>`:h}</slot></span>
|
|
3679
3684
|
<span class="text"><slot></slot></span>
|
|
3680
|
-
${this.dismissible?c`<button type="button" class="close" part="close" aria-label=${this.t("dismiss")} @click=${a(this,Xm,
|
|
3685
|
+
${this.dismissible?c`<button type="button" class="close" part="close" aria-label=${this.t("dismiss")} @click=${a(this,Xm,bw)}><cm-icon name="close" size="16"></cm-icon>
|
|
3681
3686
|
</button>`:h}
|
|
3682
|
-
</div>`}};Xm=new WeakSet,
|
|
3687
|
+
</div>`}};Xm=new WeakSet,bw=function(){this.dispatchEvent(new CustomEvent("cm-dismiss",{bubbles:!0,composed:!0,cancelable:!0}))&&(this.hidden=!0)},zo.properties={icon:{},dismissible:{type:Boolean,reflect:!0},label:{string:"label"}},zo.styles=[E,w`
|
|
3683
3688
|
:host { display: block; }
|
|
3684
3689
|
.bar {
|
|
3685
3690
|
position: relative; display: flex; align-items: center; justify-content: center; gap: var(--cm-space-8); min-height: 48px;
|
|
@@ -3701,14 +3706,14 @@ ${t.label}</button>
|
|
|
3701
3706
|
@media (max-width: 640px) {
|
|
3702
3707
|
.bar { min-height: 44px; justify-content: flex-start; text-align: start; }
|
|
3703
3708
|
}
|
|
3704
|
-
`];$("cm-flash-offer-bar",zo);var
|
|
3709
|
+
`];$("cm-flash-offer-bar",zo);var QT=z("linkTabs",{label:"Sections"}),Hd,Lo,Nd,Ct,vw,Rd,rb,So=class extends C{constructor(){super(...arguments);m(this,Ct);this.items=[];this._slotted=[];this._more="";m(this,Hd);m(this,Lo,new ResizeObserver(()=>a(this,Ct,Rd).call(this)));m(this,Nd,"")}connectedCallback(){super.connectedCallback(),a(this,Ct,rb).call(this),g(this,Hd,yr(this,()=>a(this,Ct,rb).call(this)))}disconnectedCallback(){super.disconnectedCallback(),r(this,Hd)?.disconnect(),r(this,Lo).disconnect()}firstUpdated(){let e=this.renderRoot.querySelector("ul");r(this,Lo).observe(e),e.addEventListener("scroll",()=>a(this,Ct,Rd).call(this),{passive:!0}),document.fonts?.ready.then(()=>a(this,Ct,Rd).call(this))}updated(){for(let e of this.renderRoot.querySelectorAll("li"))r(this,Lo).observe(e);a(this,Ct,vw).call(this),a(this,Ct,Rd).call(this)}get tabs(){return this.items.length?this.items:this._slotted}render(){return c`<nav part="nav" aria-label=${this.label||this.t("label")}>
|
|
3705
3710
|
<ul part="tabs" class=${this._more?`more-${this._more}`:""}>${this.tabs.map(e=>c`<li><a part="tab" href=${e.href||"#"} aria-current=${e.current?"page":h}
|
|
3706
3711
|
@click=${t=>{xr(this,e)||t.preventDefault()}}>${e.label}${e.badge?c`<span class="badge">(${e.badge})</span>`:h}</a></li>`)}</ul>
|
|
3707
3712
|
<slot hidden></slot>
|
|
3708
|
-
</nav>`}};Hd=new WeakMap,Lo=new WeakMap,Nd=new WeakMap,Ct=new WeakSet,
|
|
3713
|
+
</nav>`}};Hd=new WeakMap,Lo=new WeakMap,Nd=new WeakMap,Ct=new WeakSet,vw=function(){let e=this.renderRoot.querySelector("ul"),t=this.renderRoot.querySelector('a[aria-current="page"]'),i=t?.getAttribute("href")??"";if(!e||!t||i===r(this,Nd)||e.scrollWidth<=e.clientWidth)return;g(this,Nd,i);let s=e.getBoundingClientRect(),l=t.getBoundingClientRect(),d=32;l.right>s.right-d?e.scrollLeft+=l.right-s.right+d:l.left<s.left+d&&(e.scrollLeft-=s.left+d-l.left)},Rd=function(){let e=this.renderRoot.querySelector("ul");if(!e)return;let t=e.scrollWidth-e.clientWidth,i=Math.abs(e.scrollLeft),s=t>1&&i>1,l=t>1&&i<t-1,d=s&&l?"both":s?"start":l?"end":"";d!==this._more&&(this._more=d)},rb=function(){this._slotted=Si(this)},So.properties={items:{type:Array},label:{string:"label"},_slotted:{state:!0},_more:{state:!0}},So.styles=[E,w`
|
|
3709
3714
|
:host { display: block; }
|
|
3710
3715
|
ul {
|
|
3711
|
-
display: flex; gap: var(--cm-space-24); margin: 0; padding: 2px 2px 0; list-style: none; overflow-x: auto;
|
|
3716
|
+
display: flex; gap: var(--cm-space-24); margin: 0; padding: 2px 2px 0; list-style: none; overflow-x: auto;
|
|
3712
3717
|
border-bottom: var(--cm-border-1) solid var(--cm-border-subtle); white-space: nowrap;
|
|
3713
3718
|
}
|
|
3714
3719
|
li { flex: none; display: flex; }
|
|
@@ -3731,7 +3736,7 @@ ${t.label}</button>
|
|
|
3731
3736
|
:host(:dir(rtl)) ul.more-start { mask-image: linear-gradient(to right, #000 calc(100% - var(--cm-space-32)), transparent); }
|
|
3732
3737
|
@media (max-width: 640px) { ul { gap: var(--cm-space-16); } }
|
|
3733
3738
|
|
|
3734
|
-
`];$("cm-link-tabs",So);var
|
|
3739
|
+
`];$("cm-link-tabs",So);var sC=z("appCard",{developer:"By {developer}",rating:"Rated {rating} out of 5",reviews:{one:"{count} Review",other:"{count} Reviews"},offer:"Offer: ",details:"View Details",detailsLabel:"View details of {name}"}),Ao=class extends C{constructor(){super(...arguments);this.name="";this.developer="";this.reviewsHref="";this.pricing="";this.offer="";this.href="";this.headingLevel=3}render(){let e=Math.min(6,Math.max(2,Math.round(this.headingLevel)||3)),t=typeof this.rating=="number"&&!Number.isNaN(this.rating),i=typeof this.reviews=="number"?this.t("reviews",{count:this.reviews}):"",s=t?this.formatNumber(this.rating,{minimumFractionDigits:1,maximumFractionDigits:1}):"";return c`<article part="card" aria-labelledby="name">
|
|
3735
3740
|
<div class="logo" part="logo"><slot name="logo"></slot></div>
|
|
3736
3741
|
<div class="status"><slot name="status"></slot></div>
|
|
3737
3742
|
<div class="name" id="name" role="heading" aria-level=${e}>${this.name}</div>
|
|
@@ -3780,21 +3785,21 @@ ${t.label}</button>
|
|
|
3780
3785
|
.actions { gap: var(--cm-space-8); }
|
|
3781
3786
|
.details { margin-inline-start: auto; }
|
|
3782
3787
|
}
|
|
3783
|
-
`];$("cm-app-card",Ao);var Jm,
|
|
3788
|
+
`];$("cm-app-card",Ao);var Jm,yw,Do=class extends le{constructor(){super(...arguments);m(this,Jm);this.size="medium";this._hasFooter=!1}connectedCallback(){super.connectedCallback(),this._hasFooter=!!this.querySelector(':scope > [slot="footer"]')}render(){return this.renderDialog(c`<div class="panel" part="panel" tabindex="-1">
|
|
3784
3789
|
${this.renderHeader()}
|
|
3785
3790
|
<div class="body" part="body"><slot></slot></div>
|
|
3786
|
-
<footer class="foot" part="footer" ?hidden=${!this._hasFooter}><slot name="footer" @slotchange=${a(this,Jm,
|
|
3787
|
-
</div>`)}};Jm=new WeakSet,
|
|
3791
|
+
<footer class="foot" part="footer" ?hidden=${!this._hasFooter}><slot name="footer" @slotchange=${a(this,Jm,yw)}></slot></footer>
|
|
3792
|
+
</div>`)}};Jm=new WeakSet,yw=function(e){this._hasFooter=e.target.assignedElements().length>0},Do.properties={...le.properties,size:{reflect:!0},_hasFooter:{state:!0}},Do.styles=[...le.overlayStyles,w`
|
|
3788
3793
|
dialog { position: fixed; inset: 0; margin: auto; width: min(var(--cm-modal-width, 620px), calc(100vw - 32px)); }
|
|
3789
3794
|
:host([size='small']) dialog { --cm-modal-width: 400px; }
|
|
3790
3795
|
:host([size='large']) dialog { --cm-modal-width: 900px; }
|
|
3791
3796
|
.panel { max-height: calc(100dvh - 64px); border-radius: var(--cm-radius-lg); box-shadow: var(--cm-shadow-lg); }
|
|
3792
3797
|
|
|
3793
|
-
`];$("cm-modal",Do);var Qm,
|
|
3798
|
+
`];$("cm-modal",Do);var Qm,xw,Zt=class extends le{constructor(){super(...arguments);m(this,Qm);this.size="medium";this._hasFooter=!1}connectedCallback(){super.connectedCallback(),this._hasFooter=!!this.querySelector(':scope > [slot="footer"]')}renderBody(){return c`<slot></slot>`}renderFooter(){return c`<slot name="footer" @slotchange=${a(this,Qm,xw)}></slot>`}get showFooter(){return this._hasFooter}render(){return this.renderDialog(c`<div class="panel" part="panel" tabindex="-1">
|
|
3794
3799
|
${this.renderHeader()}
|
|
3795
3800
|
<div class="body" part="body">${this.renderBody()}</div>
|
|
3796
3801
|
<footer class="foot" part="footer" ?hidden=${!this.showFooter}>${this.renderFooter()}</footer>
|
|
3797
|
-
</div>`)}};Qm=new WeakSet,
|
|
3802
|
+
</div>`)}};Qm=new WeakSet,xw=function(e){this._hasFooter=e.target.assignedElements().length>0},Zt.properties={...le.properties,size:{reflect:!0},_hasFooter:{state:!0}},Zt.styles=[...le.overlayStyles,w`
|
|
3798
3803
|
dialog {
|
|
3799
3804
|
position: fixed; inset-block: 0; inset-inline: auto 0; height: 100dvh; width: min(var(--cm-side-panel-width, 450px), 100vw);
|
|
3800
3805
|
}
|
|
@@ -3812,7 +3817,7 @@ ${t.label}</button>
|
|
|
3812
3817
|
.panel { border-radius: var(--cm-radius-lg); }
|
|
3813
3818
|
|
|
3814
3819
|
}
|
|
3815
|
-
`];$("cm-side-panel",Zt);var
|
|
3820
|
+
`];$("cm-side-panel",Zt);var xC=z("filterPanel",{heading:"Search and Filter",searchLabel:"Search",searchPlaceholder:"Search anything",apply:"Search",reset:"Reset"}),Ho,Zm,Ro=class extends Zt{constructor(){super(...arguments);this.search=!1;this.query="";m(this,Ho,()=>{this.dispatchEvent(new CustomEvent("cm-filter-apply",{detail:{values:this.values,query:this.query},bubbles:!0,composed:!0,cancelable:!0}))&&this.requestClose("action")});m(this,Zm,()=>{this.reset(),this.dispatchEvent(new CustomEvent("cm-filter-reset",{bubbles:!0,composed:!0}))})}get form(){return this.querySelector("form")}get values(){let e={},t=(s,l)=>{if(l==="")return;let d=e[s];e[s]=d===void 0?l:Array.isArray(d)?[...d,l]:[d,l]},i=this.form;if(i){for(let[s,l]of new FormData(i))typeof l=="string"&&t(s,l);return e}return this.querySelectorAll("[name]").forEach(s=>{let l=s.getAttribute("name");"checked"in s&&(s.type==="checkbox"||s.type==="radio"||s.localName.match(/^cm-(checkbox|radio|toggle)$/))?s.checked&&t(l,s.value||"on"):typeof s.value=="string"&&t(l,s.value)}),e}reset(){let e=this.form;e?e.reset():this.querySelectorAll("[name]").forEach(t=>t.formResetCallback?.()),this.query=""}renderBody(){return c`${this.search?c`<cm-search class="search" part="search" .value=${this.query} label=${this.searchLabel}
|
|
3816
3821
|
placeholder=${this.searchPlaceholder}
|
|
3817
3822
|
@input=${e=>{this.query=e.target.value}}
|
|
3818
3823
|
@cm-search=${e=>{e.stopPropagation(),r(this,Ho).call(this)}}></cm-search>`:h}
|
|
@@ -3821,7 +3826,7 @@ ${t.label}</button>
|
|
|
3821
3826
|
.search { display: block; margin-bottom: var(--cm-space-20); }
|
|
3822
3827
|
.foot { justify-content: center; }
|
|
3823
3828
|
::slotted(form) { display: grid; gap: var(--cm-space-12); }
|
|
3824
|
-
`];$("cm-filter-panel",Ro);var
|
|
3829
|
+
`];$("cm-filter-panel",Ro);var TC=z("accountMenu",{trigger:"Account: {name}"}),No=class extends Ft{constructor(){super();this.name="";this.avatarSrc="";this.meta="";this.profileHref="";this.orgName="";this.orgMeta="";this.orgHref="";this.plan="";this.align="end"}triggerTemplate(e,t){return c`<button type="button" class="trigger account" part="trigger" aria-haspopup="menu" aria-expanded=${String(this.open)}
|
|
3825
3830
|
aria-label=${this.t("trigger",{name:this.name})} ?disabled=${this.disabled} @click=${e} @keydown=${t}>
|
|
3826
3831
|
<cm-avatar name=${this.name} src=${this.avatarSrc||h} decorative></cm-avatar></button>`}headTemplate(){let e=(t,i,s,l,d)=>{let p=c`${s}<span class="who"><strong>${l}</strong>${d?c`<span>${d}</span>`:h}</span>${t?c`<cm-icon class="chev" name="chevron-right" size="16"></cm-icon>`:h}`;return t?c`<a class="row" part=${i} href=${t}>${p}</a>`:c`<div class="row" part=${i}>${p}</div>`};return c`<div class="acct">
|
|
3827
3832
|
${e(this.profileHref,"profile",c`<span class="ring"><cm-avatar name=${this.name} src=${this.avatarSrc||h} decorative></cm-avatar></span>`,this.name,this.meta)}
|
|
@@ -3861,8 +3866,8 @@ ${t.label}</button>
|
|
|
3861
3866
|
.plan cm-icon { color: var(--cm-text-success); }
|
|
3862
3867
|
.split { height: 0; margin: var(--cm-space-4) var(--cm-space-12); border-top: var(--cm-border-1) solid var(--cm-border-subtle); }
|
|
3863
3868
|
:host(:dir(rtl)) .chev { transform: scaleX(-1); }
|
|
3864
|
-
`];$("cm-account-menu",No);var
|
|
3865
|
-
<line class="base" x1="0" y1=${s} x2=${i} y2=${s}></line>${b}</svg>`}};Po.properties={values:{converter:{fromAttribute:
|
|
3869
|
+
`];$("cm-account-menu",No);var AC=z("sparkline",{summary:"{label}: {total} in all, peak {peak}, latest {latest}",summaryAt:"{label}: {total} in all, peak {peak} on {when}, latest {latest}",empty:"{label}: no data"}),j0=o=>{if(!o)return[];let n=o.trim(),e=[];if(n.startsWith("["))try{e=JSON.parse(n)}catch{e=[]}else e=n.split(",");return e.map(t=>{let i=Number(t);return Number.isFinite(i)?i:0})},U0=o=>{if(!o)return[];let n=o.trim();if(n.startsWith("["))try{return JSON.parse(n).map(String)}catch{return[]}return n.split(",").map(e=>e.trim())},Po=class extends C{constructor(){super(...arguments);this.values=[];this.labels=[];this.label="";this.type="bars";this.tone="neutral"}get summary(){let e=this.values??[],t=this.label||"";if(!e.length)return this.t("empty",{label:t});let i=e.reduce((u,b)=>u+b,0),s=Math.max(...e),l=e.indexOf(s),d={label:t,total:this.formatNumber(i),peak:this.formatNumber(s),latest:this.formatNumber(e[e.length-1])},p=this.labels?.[l];return p?this.t("summaryAt",{...d,when:p}):this.t("summary",d)}render(){let e=this.values??[],t=e.length,i=100,s=32,l=2,d=Math.max(1,...e.map(f=>Math.max(0,f))),p=f=>s-Math.max(0,f)/d*(s-l),u=f=>this.labels?.[f]?`${this.labels[f]}: ${this.formatNumber(e[f])}`:"",b=h;if(t&&this.type==="line"){let f=t>1?i/(t-1):0,x=e.map((k,L)=>`${(t>1?L*f:i/2).toFixed(2)},${p(k).toFixed(2)}`).join(" "),v=x.split(" ").pop().split(",");b=ii`<polyline class="line" points=${x}></polyline><line class="dot" x1=${v[0]} y1=${v[1]} x2=${v[0]} y2=${v[1]}></line>`}else if(t){let f=i/t,x=t>1?Math.min(f*.25,2):0,v=f-x;b=e.map((k,L)=>{let P=Math.max(k>0?1.5:0,s-p(k)),U=u(L);return ii`<rect class=${L===t-1?"bar last":"bar"} x=${(L*f+x/2).toFixed(2)} y=${(s-P).toFixed(2)} width=${v.toFixed(2)} height=${P.toFixed(2)} rx="0.6">${U?ii`<title>${U}</title>`:h}</rect>`})}return c`<svg part="chart" role="img" aria-label=${this.summary} viewBox="0 0 ${i} ${s}" preserveAspectRatio="none">
|
|
3870
|
+
<line class="base" x1="0" y1=${s} x2=${i} y2=${s}></line>${b}</svg>`}};Po.properties={values:{converter:{fromAttribute:j0}},labels:{converter:{fromAttribute:U0}},label:{},type:{reflect:!0},tone:{reflect:!0}},Po.styles=[E,w`
|
|
3866
3871
|
:host { display: block; width: 100%; max-width: var(--cm-sparkline-width, none); height: var(--cm-sparkline-height, 32px); color: var(--cm-icon-default); }
|
|
3867
3872
|
:host([tone='information']) { color: var(--cm-text-information); }
|
|
3868
3873
|
:host([tone='success']) { color: var(--cm-text-success); }
|
|
@@ -3875,15 +3880,15 @@ ${t.label}</button>
|
|
|
3875
3880
|
.line { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
|
|
3876
3881
|
.dot { stroke: var(--cm-text-default); stroke-width: 5; stroke-linecap: round; vector-effect: non-scaling-stroke; }
|
|
3877
3882
|
:host([tone='information']) .dot, :host([tone='success']) .dot { stroke: currentColor; }
|
|
3878
|
-
`];$("cm-sparkline",Po);var Pd,Bs,sb,
|
|
3883
|
+
`];$("cm-sparkline",Po);var Pd,Bs,sb,ww,Io=class extends le{constructor(){super(...arguments);m(this,Bs);this.heading="";this.items=[];this._slotted=[];m(this,Pd)}get sheetItems(){return this.items.length?this.items:this._slotted}connectedCallback(){super.connectedCallback(),this._slotted=xl(this),g(this,Pd,yh(this,()=>{this._slotted=xl(this)}))}disconnectedCallback(){super.disconnectedCallback(),r(this,Pd)?.disconnect()}render(){let e=this.sheetItems.filter(i=>!i.divider&&!i.heading),t=e.some(i=>i.icon);return this.renderDialog(c`<div class="panel" part="panel" tabindex="-1">
|
|
3879
3884
|
<button type="button" class="x" part="close" aria-label=${this.closeLabel||this.t("close")} @click=${()=>this.requestClose("close-button")}>
|
|
3880
3885
|
<cm-icon name="close" size="16"></cm-icon></button>
|
|
3881
3886
|
${this.heading?c`<h2 class="vh" id="${this.uid}-h">${this.heading}</h2>`:h}
|
|
3882
3887
|
<div class="content">
|
|
3883
|
-
${e.length?c`<ul class=${t?"icons":""} part="list">${e.map(i=>c`<li>${a(this,Bs,
|
|
3888
|
+
${e.length?c`<ul class=${t?"icons":""} part="list">${e.map(i=>c`<li>${a(this,Bs,ww).call(this,i)}</li>`)}</ul>`:h}
|
|
3884
3889
|
<slot ?hidden=${this._slotted.length>0}></slot>
|
|
3885
3890
|
</div>
|
|
3886
|
-
</div>`)}};Pd=new WeakMap,Bs=new WeakSet,sb=function(e,t){if(t.disabled){e.preventDefault();return}if(!this.dispatchEvent(new CustomEvent("cm-select",{detail:{value:t.value??t.label,item:t},bubbles:!0,composed:!0,cancelable:!0}))){e.preventDefault();return}this.requestClose("action")},
|
|
3891
|
+
</div>`)}};Pd=new WeakMap,Bs=new WeakSet,sb=function(e,t){if(t.disabled){e.preventDefault();return}if(!this.dispatchEvent(new CustomEvent("cm-select",{detail:{value:t.value??t.label,item:t},bubbles:!0,composed:!0,cancelable:!0}))){e.preventDefault();return}this.requestClose("action")},ww=function(e){let t=`row${e.critical?" critical":""}`,i=c`${e.icon?c`<cm-icon class="lead" name=${e.icon} size="16"></cm-icon>
|
|
3887
3892
|
`:h}<span class="label">${e.label}</span>${e.icon?c`<cm-icon name="chevron-right" size="16"></cm-icon>`:h}`;return e.href&&!e.disabled?c`<a class=${t} part="row" href=${e.href} @click=${s=>a(this,Bs,sb).call(this,s,e)}>${i}</a>`:c`<button type="button" class=${t} part="row" aria-disabled=${e.disabled?"true":h}
|
|
3888
3893
|
@click=${s=>a(this,Bs,sb).call(this,s,e)}>${i}</button>`},Io.properties={...le.properties,items:{type:Array},_slotted:{state:!0}},Io.styles=[...le.overlayStyles,w`
|
|
3889
3894
|
dialog {
|
|
@@ -3919,17 +3924,17 @@ ${t.label}</button>
|
|
|
3919
3924
|
}
|
|
3920
3925
|
@keyframes cm-sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
|
|
3921
3926
|
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
3922
|
-
`];$("cm-bottom-sheet",Io);var
|
|
3923
|
-
<cm-skeleton class="sk-ic" variant="block" style="--cm-skeleton-height:22px"></cm-skeleton><cm-skeleton class="sk-text"></cm-skeleton></li>`)}</ul>`:e.length?c`<ul class="list" part="list">${e.map(s=>c`<li>${a(this,
|
|
3927
|
+
`];$("cm-bottom-sheet",Io);var jC=z("notificationPanel",{heading:"Notifications",more:"See more notifications",empty:"No notifications yet.",unread:"Unread: ",markAllRead:"Mark all read"}),K0={information:"bag",attention:"alert",success:"check-circle",critical:"x-circle"},qo=class extends A{constructor(){super(...arguments);this.time="";this.tone="information";this.href="";this.unread=!1;this.value="";this.description="";this.icon=""}render(){return null}};qo.properties={time:{reflect:!0},tone:{reflect:!0},href:{reflect:!0},unread:{type:Boolean,reflect:!0},value:{reflect:!0},description:{reflect:!0},icon:{reflect:!0}},qo.styles=w`:host { display: none; }`;$("cm-notification-item",qo);var Bo,at,ab,nb,$w,kw,Ew,Oo=class extends le{constructor(){super(...arguments);m(this,at);this.items=[];this.moreHref="";this.markAllRead=!1;this.loading=!1;this._slotted=[];this._footer=!1;m(this,Bo)}connectedCallback(){super.connectedCallback(),a(this,at,ab).call(this),g(this,Bo,new MutationObserver(()=>a(this,at,ab).call(this))),r(this,Bo).observe(this,{childList:!0,subtree:!0,attributes:!0,characterData:!0})}disconnectedCallback(){super.disconnectedCallback(),r(this,Bo)?.disconnect()}get notifications(){return this.items.length?this.items:this._slotted}render(){let e=this.notifications,t=this.markAllRead&&!this.loading&&e.some(s=>s.unread)?c`<button type="button" class="mark" part="mark-all-read" @click=${a(this,at,kw)}>${this.markAllLabel}</button>`:h,i=this.loading?c`<ul class="loading" part="list" aria-hidden="true">${[0,1,2].map(()=>c`<li>
|
|
3928
|
+
<cm-skeleton class="sk-ic" variant="block" style="--cm-skeleton-height:22px"></cm-skeleton><cm-skeleton class="sk-text"></cm-skeleton></li>`)}</ul>`:e.length?c`<ul class="list" part="list">${e.map(s=>c`<li>${a(this,at,$w).call(this,s)}</li>`)}</ul>`:c`<p class="empty">${this.emptyText}</p>`;return this.renderDialog(c`<div class="panel" part="panel" tabindex="-1">
|
|
3924
3929
|
${this.renderHeader(t)}
|
|
3925
3930
|
${i}
|
|
3926
3931
|
<span class="vh" role="status">${this.loading?this.t("loading"):""}</span>
|
|
3927
3932
|
${this.moreHref?c`<a class="more" part="more" href=${this.moreHref}>${this.moreLabel}</a>`:h}
|
|
3928
|
-
<div class="footer" part="footer" ?hidden=${!this._footer}><slot name="footer" @slotchange=${a(this,
|
|
3933
|
+
<div class="footer" part="footer" ?hidden=${!this._footer}><slot name="footer" @slotchange=${a(this,at,Ew)}></slot></div>
|
|
3929
3934
|
<slot hidden></slot>
|
|
3930
|
-
</div>`)}};Bo=new WeakMap,
|
|
3935
|
+
</div>`)}};Bo=new WeakMap,at=new WeakSet,ab=function(){this._slotted=Array.from(this.querySelectorAll(":scope > cm-notification-item")).map(e=>{let t=i=>e.getAttribute(i)||void 0;return{label:(e.textContent??"").trim(),time:t("time"),tone:t("tone")??"information",href:t("href"),unread:e.hasAttribute("unread")||void 0,value:t("value"),description:t("description"),icon:t("icon")}})},nb=function(e,t){if(!this.dispatchEvent(new CustomEvent("cm-select",{detail:{value:t.value??t.href??t.label,item:t},bubbles:!0,composed:!0,cancelable:!0}))){e.preventDefault();return}this.requestClose("action")},$w=function(e){let t=e.tone??"information",i=e.description?c`<span class="title">${e.label}</span><span class="vh">, </span><span class="desc">${e.description}</span>`:e.label,s=c`<span class="ic ${t}" aria-hidden="true"><cm-icon name=${e.icon||K0[t]||"bell"} size="14"></cm-icon></span>
|
|
3931
3936
|
<span class="label">${e.unread?c`<span class="vh">${this.t("unread")}</span>`:h}${i}</span>
|
|
3932
|
-
${e.time?c`<time>${e.time}</time>`:h}`,l=`row${e.unread?" unread":""}`;return e.href?c`<a class=${l} part="row" href=${e.href} @click=${d=>a(this,
|
|
3937
|
+
${e.time?c`<time>${e.time}</time>`:h}`,l=`row${e.unread?" unread":""}`;return e.href?c`<a class=${l} part="row" href=${e.href} @click=${d=>a(this,at,nb).call(this,d,e)}>${s}</a>`:c`<button type="button" class=${l} part="row" @click=${d=>a(this,at,nb).call(this,d,e)}>${s}</button>`},kw=async function(e){let t=e.currentTarget;this.dispatchEvent(new CustomEvent("cm-mark-all-read",{bubbles:!0,composed:!0})),await new Promise(i=>setTimeout(i)),await this.updateComplete,!t.isConnected&&this.open&&this.renderRoot.querySelector(".panel")?.focus()},Ew=function(e){this._footer=e.target.assignedNodes({flatten:!0}).some(t=>t.nodeType===Node.ELEMENT_NODE||(t.textContent??"").trim())},Oo.properties={...le.properties,items:{type:Array},moreHref:{attribute:"more-href"},heading:{string:"heading"},moreLabel:{attribute:"more-label",string:"more"},emptyText:{attribute:"empty-text",string:"empty"},markAllRead:{type:Boolean,attribute:"mark-all-read"},markAllLabel:{attribute:"mark-all-label",string:"markAllRead"},loading:{type:Boolean,reflect:!0},_slotted:{state:!0},_footer:{state:!0}},Oo.styles=[...le.overlayStyles,w`
|
|
3933
3938
|
dialog {
|
|
3934
3939
|
position: fixed; inset-block: var(--cm-notification-panel-top, 64px) auto; inset-inline: auto var(--cm-notification-panel-end, 20px);
|
|
3935
3940
|
width: min(380px, calc(100vw - 32px));
|
|
@@ -3979,15 +3984,15 @@ ${t.label}</button>
|
|
|
3979
3984
|
@media (max-width: 599px) {
|
|
3980
3985
|
dialog { inset: var(--cm-notification-panel-top, 56px) 8px auto 8px; width: auto; }
|
|
3981
3986
|
}
|
|
3982
|
-
`];$("cm-notification-panel",Oo);var
|
|
3987
|
+
`];$("cm-notification-panel",Oo);var XC=z("toastRegion",{label:"Notifications"}),JC=z("toast",{undo:"Undo",shortcut:"Press F6 to reach it."}),Mw=()=>{let o=document.activeElement;for(;o?.shadowRoot?.activeElement;)o=o.shadowRoot.activeElement;return o&&o!==document.body?o:null},ob=(o,n)=>{for(let e=n;e;e=e.parentNode??e.host??null)if(e===o)return!0;return!1},W0=2e3,_w=1e4,Tw=150,Id,Ot,Ai,qd,Uo,Ko,Fs,wr,Vs,_e,eu,Cw,Fo,lb,Od,Bd,Fd,Vd,zw,Vo=class extends C{constructor(){super(...arguments);m(this,_e);this.message="";this.tone="default";this.actionLabel="";this.open=!0;this._inRegion=!1;this._primed=!1;m(this,Id);m(this,Ot);m(this,Ai,0);m(this,qd,0);m(this,Uo,!1);m(this,Ko,!1);m(this,Fs);m(this,wr);m(this,Vs);m(this,Od,()=>{g(this,Uo,!0),a(this,_e,lb).call(this)});m(this,Bd,()=>{g(this,Uo,!1),a(this,_e,Fo).call(this)});m(this,Fd,()=>{g(this,Ko,!0),a(this,_e,lb).call(this)});m(this,Vd,e=>{e.relatedTarget instanceof Node&&this.contains(e.relatedTarget)||e.relatedTarget instanceof Node&&this.shadowRoot?.contains(e.relatedTarget)||(g(this,Ko,!1),a(this,_e,Fo).call(this))})}get closed(){if(!r(this,Fs)){if(!this.open&&r(this,Vs))return Promise.resolve(r(this,Vs));g(this,Fs,new Promise(e=>{g(this,wr,e)}))}return r(this,Fs)}get effectiveDuration(){let e=this.duration??(this.actionLabel?_w:5e3);return Math.min(_w,Math.max(W0,Number(e)||5e3))}connectedCallback(){super.connectedCallback(),this._inRegion=!!this.parentElement?.closest("cm-toast-region"),!this._inRegion&&!this._primed&&g(this,Id,setTimeout(()=>{this._primed=!0},Tw)),this.addEventListener("pointerenter",r(this,Od)),this.addEventListener("pointerleave",r(this,Bd)),this.addEventListener("focusin",r(this,Fd)),this.addEventListener("focusout",r(this,Vd))}disconnectedCallback(){super.disconnectedCallback(),this.open&&r(this,wr)&&queueMicrotask(()=>{!this.isConnected&&this.open&&a(this,_e,eu).call(this,"removed")}),clearTimeout(r(this,Ot)),clearTimeout(r(this,Id)),this.removeEventListener("pointerenter",r(this,Od)),this.removeEventListener("pointerleave",r(this,Bd)),this.removeEventListener("focusin",r(this,Fd)),this.removeEventListener("focusout",r(this,Vd))}updated(e){e.has("open")&&e.get("open")!==void 0&&(this.open?g(this,Vs,void 0):r(this,wr)&&a(this,_e,eu).call(this,"close")),(e.has("open")||e.has("duration")||e.has("actionLabel")||e.has("_primed")||e.has("_inRegion"))&&(clearTimeout(r(this,Ot)),this.open&&(this._inRegion||this._primed)&&(g(this,Ai,this.effectiveDuration),a(this,_e,Fo).call(this)))}show(){this.open?(g(this,Ai,this.effectiveDuration),a(this,_e,Fo).call(this)):this.open=!0}dismiss(e="close"){let t=new CustomEvent("cm-dismiss",{bubbles:!0,composed:!0,cancelable:!0,detail:{reason:e}});return this.dispatchEvent(t)?(clearTimeout(r(this,Ot)),this.open=!1,a(this,_e,eu).call(this,e),!0):(e==="timeout"&&(g(this,Ai,this.effectiveDuration),a(this,_e,Fo).call(this)),!1)}render(){let e=c`<div class="toast" part="toast">
|
|
3983
3988
|
${this.tone==="critical"?c`<cm-icon class="icon" name="alert" size="20"></cm-icon>`:h}
|
|
3984
3989
|
<div class="message" part="message">${this.message}<slot></slot></div>
|
|
3985
|
-
${this.actionLabel?c`<button class="action" part="action" aria-keyshortcuts=${this._inRegion?"F6":h} @click=${a(this,_e,
|
|
3990
|
+
${this.actionLabel?c`<button class="action" part="action" aria-keyshortcuts=${this._inRegion?"F6":h} @click=${a(this,_e,zw)}>${this.actionLabel}</button>`:h}
|
|
3986
3991
|
<button class="close" part="close" aria-label=${this.t("dismiss")} @click=${()=>this.dismiss("close")}>
|
|
3987
3992
|
<svg width="16" height="16" viewBox="0 0 16 16" aria-hidden="true"><path d="m4 4 8 8M12 4l-8 8" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>
|
|
3988
3993
|
</button>
|
|
3989
3994
|
${this.actionLabel&&this._inRegion&&this.t("shortcut")?c`<span class="hint">${this.t("shortcut")}</span>`:h}
|
|
3990
|
-
</div>`;return this._inRegion?e:c`<div role="status" aria-live="polite" aria-atomic="false">${this.open&&this._primed?e:h}</div>`}};Id=new WeakMap,Ot=new WeakMap,Ai=new WeakMap,qd=new WeakMap,Uo=new WeakMap,Ko=new WeakMap,Fs=new WeakMap,wr=new WeakMap,Vs=new WeakMap,_e=new WeakSet,eu=function(e){g(this,Vs,e);let t=r(this,wr);g(this,Fs,g(this,wr,void 0)),t?.(e)},
|
|
3995
|
+
</div>`;return this._inRegion?e:c`<div role="status" aria-live="polite" aria-atomic="false">${this.open&&this._primed?e:h}</div>`}};Id=new WeakMap,Ot=new WeakMap,Ai=new WeakMap,qd=new WeakMap,Uo=new WeakMap,Ko=new WeakMap,Fs=new WeakMap,wr=new WeakMap,Vs=new WeakMap,_e=new WeakSet,eu=function(e){g(this,Vs,e);let t=r(this,wr);g(this,Fs,g(this,wr,void 0)),t?.(e)},Cw=function(){return r(this,Uo)||r(this,Ko)},Fo=function(){clearTimeout(r(this,Ot)),!(!this.open||r(this,_e,Cw))&&(g(this,qd,Date.now()),g(this,Ot,setTimeout(()=>this.dismiss("timeout"),r(this,Ai))))},lb=function(){r(this,Ot)!==void 0&&(clearTimeout(r(this,Ot)),g(this,Ot,void 0),g(this,Ai,Math.max(1e3,r(this,Ai)-(Date.now()-r(this,qd)))))},Od=new WeakMap,Bd=new WeakMap,Fd=new WeakMap,Vd=new WeakMap,zw=function(){let e=new CustomEvent("cm-action",{bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(e)&&this.dismiss("action")},Vo.properties={message:{},tone:{reflect:!0},duration:{type:Number},actionLabel:{attribute:"action-label"},open:{type:Boolean,reflect:!0},_inRegion:{state:!0},_primed:{state:!0}},Vo.styles=[E,w`
|
|
3991
3996
|
:host { display: block; pointer-events: auto; }
|
|
3992
3997
|
:host(:not([open])) { display: none; }
|
|
3993
3998
|
.toast {
|
|
@@ -4019,13 +4024,13 @@ ${t.label}</button>
|
|
|
4019
4024
|
:host([tone='critical']) button:hover { background: var(--cm-bg-hover); }
|
|
4020
4025
|
button:focus-visible { outline: 2px solid var(--cm-text-on-dark); outline-offset: 1px; }
|
|
4021
4026
|
:host([tone='critical']) button:focus-visible { outline-color: var(--cm-border-strong); }
|
|
4022
|
-
`];$("cm-toast",Vo);var js,jd,Ud,Kd,Wd,Gd,Wo,tu,jo=class extends C{constructor(){super(...arguments);m(this,Wo);this.max=3;m(this,js,null);m(this,jd,!1);m(this,Ud,e=>{let t=e.target;queueMicrotask(()=>{if(t.localName!=="cm-toast"||t.open)return;let i=t.matches(":focus-within");t.remove(),i&&a(this,Wo,tu).call(this)})});m(this,Kd,e=>{let t=e.relatedTarget;t&&!ob(this,t)&&g(this,js,t)});m(this,Wd,e=>{if(e.key!=="Escape"||e.defaultPrevented)return;let t=e.composedPath().find(i=>i.localName==="cm-toast");t&&t.parentElement===this&&(e.preventDefault(),t.dismiss("close"))});m(this,Gd,e=>{if(e.key!=="F6"||e.altKey||e.ctrlKey||e.metaKey||e.defaultPrevented)return;(this.matches(":focus-within")?a(this,Wo,tu).call(this):this.focusToast())&&e.preventDefault()})}connectedCallback(){super.connectedCallback(),this.setAttribute("role","status"),this.setAttribute("aria-live","polite"),this.setAttribute("aria-atomic","false"),this.hasAttribute("aria-label")||(this.setAttribute("aria-label",this.t("label")),g(this,jd,!0)),this.addEventListener("cm-dismiss",r(this,Ud)),this.addEventListener("focusin",r(this,Kd)),this.addEventListener("keydown",r(this,Wd)),document.addEventListener("keydown",r(this,Gd))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("cm-dismiss",r(this,Ud)),this.removeEventListener("focusin",r(this,Kd)),this.removeEventListener("keydown",r(this,Wd)),document.removeEventListener("keydown",r(this,Gd))}updated(){r(this,jd)&&this.setAttribute("aria-label",this.t("label"))}focusToast(){let e=[...this.querySelectorAll(":scope > cm-toast[open]")].reverse(),t=e.find(l=>l.actionLabel)??e[0],i=t?.shadowRoot?.querySelector(".action")??t?.shadowRoot?.querySelector(".close");if(!i)return!1;let s=
|
|
4027
|
+
`];$("cm-toast",Vo);var js,jd,Ud,Kd,Wd,Gd,Wo,tu,jo=class extends C{constructor(){super(...arguments);m(this,Wo);this.max=3;m(this,js,null);m(this,jd,!1);m(this,Ud,e=>{let t=e.target;queueMicrotask(()=>{if(t.localName!=="cm-toast"||t.open)return;let i=t.matches(":focus-within");t.remove(),i&&a(this,Wo,tu).call(this)})});m(this,Kd,e=>{let t=e.relatedTarget;t&&!ob(this,t)&&g(this,js,t)});m(this,Wd,e=>{if(e.key!=="Escape"||e.defaultPrevented)return;let t=e.composedPath().find(i=>i.localName==="cm-toast");t&&t.parentElement===this&&(e.preventDefault(),t.dismiss("close"))});m(this,Gd,e=>{if(e.key!=="F6"||e.altKey||e.ctrlKey||e.metaKey||e.defaultPrevented)return;(this.matches(":focus-within")?a(this,Wo,tu).call(this):this.focusToast())&&e.preventDefault()})}connectedCallback(){super.connectedCallback(),this.setAttribute("role","status"),this.setAttribute("aria-live","polite"),this.setAttribute("aria-atomic","false"),this.hasAttribute("aria-label")||(this.setAttribute("aria-label",this.t("label")),g(this,jd,!0)),this.addEventListener("cm-dismiss",r(this,Ud)),this.addEventListener("focusin",r(this,Kd)),this.addEventListener("keydown",r(this,Wd)),document.addEventListener("keydown",r(this,Gd))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("cm-dismiss",r(this,Ud)),this.removeEventListener("focusin",r(this,Kd)),this.removeEventListener("keydown",r(this,Wd)),document.removeEventListener("keydown",r(this,Gd))}updated(){r(this,jd)&&this.setAttribute("aria-label",this.t("label"))}focusToast(){let e=[...this.querySelectorAll(":scope > cm-toast[open]")].reverse(),t=e.find(l=>l.actionLabel)??e[0],i=t?.shadowRoot?.querySelector(".action")??t?.shadowRoot?.querySelector(".close");if(!i)return!1;let s=Mw();return s&&!ob(this,s)&&g(this,js,s),i.focus(),!0}add(e){this.append(e);let t=[...this.querySelectorAll(":scope > cm-toast")],i=t.slice(0,Math.max(0,t.length-Math.max(1,this.max))),s=i.some(l=>l.matches(":focus-within"));return i.forEach(l=>l.remove()),s&&a(this,Wo,tu).call(this),e}render(){return c`<slot></slot>`}};js=new WeakMap,jd=new WeakMap,Ud=new WeakMap,Kd=new WeakMap,Wd=new WeakMap,Gd=new WeakMap,Wo=new WeakSet,tu=function(){let e=r(this,js);return g(this,js,null),e?.isConnected?(e.focus(),ob(e,Mw())||e.shadowRoot?.querySelector("button, a[href], input, select, textarea, [tabindex]")?.focus(),!0):!1},jo.properties={max:{type:Number}},jo.styles=[E,w`
|
|
4023
4028
|
:host {
|
|
4024
4029
|
position: fixed; inset-block-end: var(--cm-space-20); inset-inline: 0; z-index: 1000;
|
|
4025
4030
|
display: flex; flex-direction: column; align-items: center; gap: var(--cm-space-8);
|
|
4026
4031
|
padding-inline: var(--cm-space-12); pointer-events: none;
|
|
4027
4032
|
}
|
|
4028
|
-
`];$("cm-toast-region",jo);function
|
|
4033
|
+
`];$("cm-toast-region",jo);function Sw(o,n={}){let e=n.root??document.body,t=e.querySelector(":scope > cm-toast-region"),i=!t;t||(t=document.createElement("cm-toast-region"),e.append(t));let s=document.createElement("cm-toast");if(s.message=String(o),n.tone&&(s.tone=n.tone),n.duration!==void 0&&(s.duration=n.duration),n.action){s.actionLabel=n.action.label;let l=n.action.onAction;s.addEventListener("cm-action",()=>l())}if(i){let l=t;return setTimeout(()=>l.add(s),Tw),s}return t.add(s)}async function G0(o,n,e){await o();let{message:t,undoLabel:i,...s}=e,l=i??uh("toast","undo",void 0,s.root??document.body),d=await Sw(t,{...s,action:{label:l,onAction:()=>{}}}).closed;return d==="action"&&await n(),d}var rz=z("progressBar",{inProgress:"In progress"}),iu,Go=class extends C{constructor(){super(...arguments);this.value=null;this.label="";this.labelHidden=!1;this.showValue=!1;this.size="medium";m(this,iu,N("cm-progress"))}get clampedValue(){let e=this.value;return e==null||Number.isNaN(Number(e))?null:Math.min(100,Math.max(0,Number(e)))}render(){let e=this.clampedValue,t=`${r(this,iu)}-label`;return c`
|
|
4029
4034
|
<div class="head ${this.labelHidden?"vh":""}">
|
|
4030
4035
|
<span id=${t} part="label">${this.label}</span>
|
|
4031
4036
|
${this.showValue&&e!==null?c`<span class="value" aria-hidden="true">${this.formatNumber(Math.round(e)/100,{style:"percent"})}</span>`:h}
|
|
@@ -4070,11 +4075,11 @@ ${t.label}</button>
|
|
|
4070
4075
|
:host([tone='success']) span { background: linear-gradient(var(--cm-bg-success-soft), var(--cm-bg-success-soft)), var(--cm-bg-surface); color: var(--cm-text-success); }
|
|
4071
4076
|
:host([tone='critical']) span { background: linear-gradient(var(--cm-bg-critical), var(--cm-bg-critical)), var(--cm-bg-surface); color: var(--cm-text-critical); }
|
|
4072
4077
|
:host([tone='attention']) span { background: linear-gradient(var(--cm-bg-attention), var(--cm-bg-attention)), var(--cm-bg-surface); color: var(--cm-text-attention); }
|
|
4073
|
-
`];$("cm-badge",Yo);var Jo,Qo,Bt,
|
|
4078
|
+
`];$("cm-badge",Yo);var Jo,Qo,Bt,Lw,Aw,Yd,Dw,ru,cb,Xo=class extends A{constructor(){super(...arguments);m(this,Bt);this.heading="";this.description="";this.flush=!1;this.headingLevel=2;this.variant="standard";this.href="";this.target="";this.selected=!1;this.label="";m(this,Jo,!1);m(this,Qo,!1);m(this,Yd,!1);m(this,ru,()=>{this.href||this.dispatchEvent(new CustomEvent("cm-action",{bubbles:!0,composed:!0}))})}willUpdate(){this.selected&&g(this,Yd,!0)}render(){let e=Math.min(6,Math.max(2,this.headingLevel||2)),t=r(this,Bt,Dw),i=t?a(this,Bt,cb).call(this,this.heading):this.heading,s=this.heading?c`<div role="heading" aria-level=${e} class="title" part="title"><span class="text">${i}</span><span class="adornment" ?hidden=${!r(this,Jo)}><slot name="title-adornment" @slotchange=${a(this,Bt,Lw)}></slot></span></div>`:h;return c`<section part="card" aria-label=${!t&&this.heading||h}>${t&&!this.heading?a(this,Bt,cb).call(this,h):h}
|
|
4074
4079
|
${this.heading||this.description?c`<header><div class="main">${this.heading?c`<span class="strut" aria-hidden="true">${this.heading}</span>`:h}${s}${this.description?c`<p class="desc">${this.description}</p>`:h}</div>
|
|
4075
|
-
<div class="actions"><slot name="actions"></slot></div></header>`:c`<div class="bare" ?hidden=${!r(this,Qo)}><div class="actions"><slot name="actions" @slotchange=${a(this,Bt,
|
|
4080
|
+
<div class="actions"><slot name="actions"></slot></div></header>`:c`<div class="bare" ?hidden=${!r(this,Qo)}><div class="actions"><slot name="actions" @slotchange=${a(this,Bt,Aw)}></slot></div></div>`}
|
|
4076
4081
|
<slot></slot>
|
|
4077
|
-
</section>`}};Jo=new WeakMap,Qo=new WeakMap,Bt=new WeakSet,
|
|
4082
|
+
</section>`}};Jo=new WeakMap,Qo=new WeakMap,Bt=new WeakSet,Lw=function(e){let t=e.target.assignedNodes().some(i=>i.nodeType===Node.ELEMENT_NODE||i.textContent?.trim());t!==r(this,Jo)&&(g(this,Jo,t),this.requestUpdate())},Aw=function(e){let t=e.target.assignedNodes().some(i=>i.nodeType===Node.ELEMENT_NODE||i.textContent?.trim());t!==r(this,Qo)&&(g(this,Qo,t),this.requestUpdate())},Yd=new WeakMap,Dw=function(){return String(this.variant||"").split(/\s+/).includes("interactive")},ru=new WeakMap,cb=function(e){let t=e===h?"hit cover":"hit",i=e===h?this.label||h:h;return this.href?c`<a class=${t} part="control" href=${this.href} target=${this.target||h} rel=${this.target==="_blank"?"noopener noreferrer":h}
|
|
4078
4083
|
aria-current=${this.selected?"true":h} aria-label=${i}>${e}</a>`:c`<button class=${t} part="control" type="button" aria-pressed=${this.selected?"true":r(this,Yd)?"false":h} aria-label=${i} @click=${r(this,ru)}>${e}</button>`},Xo.properties={heading:{},description:{},flush:{type:Boolean,reflect:!0},headingLevel:{type:Number,attribute:"heading-level"},variant:{reflect:!0},href:{},target:{},selected:{type:Boolean,reflect:!0},label:{}},Xo.styles=[E,w`
|
|
4079
4084
|
/* Owner standard (1.6): 24px padding and a 16px gap under the header; compact 16px and 12px; 16px on phones. */
|
|
4080
4085
|
:host { display: block; --_pad: var(--cm-space-24); --_gap: var(--cm-space-16); }
|
|
@@ -4127,7 +4132,7 @@ ${t.label}</button>
|
|
|
4127
4132
|
.bare { display: flex; justify-content: flex-end; margin-bottom: var(--_gap); }
|
|
4128
4133
|
.bare[hidden] { display: none; }
|
|
4129
4134
|
:host([flush]) .bare { padding: var(--_pad) var(--_pad) 0; margin-bottom: var(--cm-space-8); }
|
|
4130
|
-
`];$("cm-card",Xo);var
|
|
4135
|
+
`];$("cm-card",Xo);var Y0=["0","4","8","12","16","20","24","32","40","48","64"],X0={10:"8",15:"16",22:"24",30:"32"};function Zo(o,n){let e=(t,i)=>`:host([${o}='${t}']) { ${n}: ${i==="0"?"0px":`var(--cm-space-${i})`}; }`;return ih([...Y0.map(t=>e(t,t)),...Object.entries(X0).map(([t,i])=>e(t,i))].join(`
|
|
4131
4136
|
`))}var el=class extends A{constructor(){super(...arguments);this.direction="block";this.gap="20";this.wrap=!1}render(){return c`<slot></slot>`}};el.properties={direction:{reflect:!0},gap:{reflect:!0},align:{reflect:!0},justify:{reflect:!0},wrap:{type:Boolean,reflect:!0}},el.styles=[E,w`
|
|
4132
4137
|
:host { display: flex; flex-direction: column; gap: var(--cm-space-20); min-inline-size: 0; }
|
|
4133
4138
|
:host([direction='inline']) { flex-direction: row; align-items: center; }
|
|
@@ -4141,7 +4146,7 @@ ${t.label}</button>
|
|
|
4141
4146
|
:host([justify='center']) { justify-content: center; }
|
|
4142
4147
|
:host([justify='end']) { justify-content: flex-end; }
|
|
4143
4148
|
:host([justify='space-between']) { justify-content: space-between; }
|
|
4144
|
-
`,Zo("gap","gap")];$("cm-stack",el);var
|
|
4149
|
+
`,Zo("gap","gap")];$("cm-stack",el);var Rw="important",J0=" !"+Rw,Hw=ca(class extends Ni{constructor(o){if(super(o),o.type!==At.ATTRIBUTE||o.name!=="style"||o.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(o){return Object.keys(o).reduce((n,e)=>{let t=o[e];return t==null?n:n+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${t};`},"")}update(o,[n]){let{style:e}=o.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(n)),this.render(n);for(let t of this.ft)n[t]==null&&(this.ft.delete(t),t.includes("-")?e.removeProperty(t):e[t]=null);for(let t in n){let i=n[t];if(i!=null){this.ft.add(t);let s=typeof i=="string"&&i.endsWith(J0);t.includes("-")||s?e.setProperty(t,s?i.slice(0,-11):i,s?Rw:""):e[t]=i}}return Pe}});var tl=class extends A{constructor(){super(...arguments);this.columns=2;this.gap="20"}render(){let e=Math.max(1,Math.floor(Number(this.columns)||1)),t=this.minColumnWidth?.trim(),i=t?`repeat(auto-fit, minmax(min(100%, ${t}), 1fr))`:`repeat(${e}, minmax(0, 1fr))`;return c`<div class="grid ${t?"fit":"fixed"}" part="grid" style=${Hw({gridTemplateColumns:i})}><slot></slot></div>`}};tl.properties={columns:{type:Number,reflect:!0},minColumnWidth:{attribute:"min-column-width",reflect:!0},gap:{reflect:!0}},tl.styles=[E,w`
|
|
4145
4150
|
:host { display: block; container: cm-grid / inline-size; --_gap: var(--cm-space-20); }
|
|
4146
4151
|
.grid { display: grid; gap: var(--_gap); align-items: start; }
|
|
4147
4152
|
@container cm-grid (max-width: 640px) {
|
|
@@ -4193,7 +4198,7 @@ ${t.label}</button>
|
|
|
4193
4198
|
}
|
|
4194
4199
|
`,Zo("gap","--_gap")];var rl=class extends A{constructor(){super(...arguments);this.variant="full"}render(){return c`<slot></slot>`}};rl.properties={variant:{reflect:!0}},rl.styles=[E,w`
|
|
4195
4200
|
:host { display: flex; flex-direction: column; gap: var(--_cm-section-gap, var(--cm-space-24)); min-inline-size: 0; }
|
|
4196
|
-
`];$("cm-layout",il);$("cm-layout-section",rl);var pb=1024,
|
|
4201
|
+
`];$("cm-layout",il);$("cm-layout-section",rl);var pb=1024,Q0=()=>{let o=document.activeElement;for(;o?.shadowRoot?.activeElement;)o=o.shadowRoot.activeElement;return o},Gs,al,Ne,mb,ub,Ws,Nw,Qd,Zd,sl=class extends A{constructor(){super(...arguments);m(this,Ne);this.menuOpen=!1;this.menuItem="";this.panel=!1;this._wide=!1;m(this,Gs);m(this,al,null);m(this,Qd,e=>{if(!this.menuItem)return;let t=a(this,Ne,Nw).call(this,e),i=e.detail?.value;t==="bottom-navigation"&&i===this.menuItem?a(this,Ne,Ws).call(this,!this.menuOpen):(t==="mobile-menu"||t==="bottom-navigation")&&a(this,Ne,Ws).call(this,!1,!1)});m(this,Zd,e=>{e.key!=="Escape"||e.defaultPrevented||!this.menuItem||!this.menuOpen||this._wide||(e.preventDefault(),a(this,Ne,Ws).call(this,!1))})}connectedCallback(){super.connectedCallback(),this.addEventListener("cm-navigate",r(this,Qd)),this.addEventListener("keydown",r(this,Zd));let e=this.getBoundingClientRect().width;e>0&&(this._wide=e>=pb)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("cm-navigate",r(this,Qd)),this.removeEventListener("keydown",r(this,Zd)),r(this,Gs)?.disconnect(),g(this,Gs,void 0)}get wide(){return this._wide}firstUpdated(){let e=0;g(this,Gs,new ResizeObserver(()=>{a(this,Ne,mb).call(this);let t=this.renderRoot.querySelector(".probe").getBoundingClientRect().width;t>0&&t>=pb!==this._wide&&(cancelAnimationFrame(e),e=requestAnimationFrame(()=>{this._wide=t>=pb}))})),this.renderRoot.querySelectorAll(".probe, .header, .bottom").forEach(t=>r(this,Gs).observe(t))}updated(e){e.has("_wide")&&a(this,Ne,mb).call(this),(e.has("menuOpen")||e.has("menuItem"))&&a(this,Ne,ub).call(this)}openMenu(){a(this,Ne,Ws).call(this,!0)}closeMenu(){a(this,Ne,Ws).call(this,!1)}toggleMenu(){a(this,Ne,Ws).call(this,!this.menuOpen)}render(){let e=this._wide,t=this.menuOpen&&!e&&!!this.querySelector(':scope > [slot="mobile-menu"]');return c`<div class="frame ${e?"wide":""}" part="frame">
|
|
4197
4202
|
<div class="probe"></div>
|
|
4198
4203
|
<div class="header" part="header" ?inert=${t}><slot name="header"></slot></div>
|
|
4199
4204
|
<div class="body">
|
|
@@ -4201,8 +4206,8 @@ ${t.label}</button>
|
|
|
4201
4206
|
<main part="main" ?inert=${t}><slot></slot></main>
|
|
4202
4207
|
</div>
|
|
4203
4208
|
<div class="menu" part="mobile-menu" ?hidden=${!t}><slot name="mobile-menu" @slotchange=${()=>this.requestUpdate()}></slot></div>
|
|
4204
|
-
<div class="bottom" part="bottom-navigation" ?hidden=${e}><slot name="bottom-navigation"></slot></div>
|
|
4205
|
-
</div>`}};Gs=new WeakMap,al=new WeakMap,
|
|
4209
|
+
<div class="bottom" part="bottom-navigation" ?hidden=${e}><slot name="bottom-navigation" @slotchange=${()=>a(this,Ne,ub).call(this)}></slot></div>
|
|
4210
|
+
</div>`}};Gs=new WeakMap,al=new WeakMap,Ne=new WeakSet,mb=function(){let e=this.renderRoot.querySelector(".frame");if(!e)return;let t=i=>Math.round(this.renderRoot.querySelector(i)?.getBoundingClientRect().height??0);e.style.setProperty("--_header",`${t(".header")}px`),e.style.setProperty("--_bottom",`${this._wide?0:t(".bottom")}px`)},ub=function(){if(!this.menuItem)return;let e=this.querySelector(':scope > [slot="bottom-navigation"]');e&&(e.menuItem=this.menuItem,e.menuOpen=this.menuOpen)},Ws=function(e,t=!0){e!==this.menuOpen&&(e&&g(this,al,Q0()),this.menuOpen=e,this.dispatchEvent(new CustomEvent("cm-menu-toggle",{bubbles:!0,composed:!0,detail:{open:e}})),this.updateComplete.then(()=>{if(e){let i=this.querySelector(':scope > [slot="mobile-menu"]');(i?.shadowRoot??i)?.querySelector("a[href], button")?.focus()}else t&&(r(this,al)?.focus(),g(this,al,null))}))},Nw=function(e){return e.composedPath().find(i=>i.parentElement===this)?.getAttribute("slot")??""},Qd=new WeakMap,Zd=new WeakMap,sl.properties={menuOpen:{type:Boolean,attribute:"menu-open",reflect:!0},menuItem:{attribute:"menu-item"},panel:{type:Boolean,reflect:!0},_wide:{state:!0}},sl.styles=[E,w`
|
|
4206
4211
|
:host { display: block; min-block-size: var(--cm-app-frame-height, 100dvh); background: var(--cm-bg-page); --_header: 0px; --_bottom: 0px; }
|
|
4207
4212
|
.header { position: sticky; inset-block-start: 0; z-index: 30; padding-block-start: env(safe-area-inset-top, 0px); background: var(--cm-bg-surface); }
|
|
4208
4213
|
.body { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; }
|
|
@@ -4211,11 +4216,8 @@ ${t.label}</button>
|
|
|
4211
4216
|
position: sticky; inset-block-start: var(--_header); box-sizing: border-box;
|
|
4212
4217
|
max-block-size: calc(var(--cm-app-frame-height, 100dvh) - var(--_header));
|
|
4213
4218
|
overflow-y: auto; overscroll-behavior: contain;
|
|
4214
|
-
/* Scrolls, but no scrollbar: a classic (always-on) scrollbar takes width and shifts the layout. */
|
|
4215
|
-
scrollbar-width: none;
|
|
4216
4219
|
padding: var(--_gutter); padding-inline-end: 0;
|
|
4217
4220
|
}
|
|
4218
|
-
.nav::-webkit-scrollbar { display: none; }
|
|
4219
4221
|
.frame { --_gutter: var(--cm-app-frame-gutter, var(--cm-space-20)); }
|
|
4220
4222
|
main { display: block; min-inline-size: 0; padding-block-end: calc(var(--_bottom) + var(--cm-app-frame-bottom-offset, 0px)); }
|
|
4221
4223
|
/* Panel: the page in a white rounded card with a gutter on the grey page (the merchant dashboard frame). */
|
|
@@ -4232,8 +4234,10 @@ ${t.label}</button>
|
|
|
4232
4234
|
::slotted([slot='bottom-navigation']) { position: static; }
|
|
4233
4235
|
.menu {
|
|
4234
4236
|
position: fixed; inset: 0; z-index: 35; overflow-y: auto; overscroll-behavior: contain;
|
|
4237
|
+
scrollbar-width: none; /* scrolls without a scrollbar, like .nav */
|
|
4235
4238
|
padding-block: env(safe-area-inset-top, 0px) var(--_bottom); background: var(--cm-bg-page);
|
|
4236
4239
|
}
|
|
4240
|
+
.menu::-webkit-scrollbar { display: none; }
|
|
4237
4241
|
.probe { block-size: 0; }
|
|
4238
4242
|
[hidden] { display: none !important; }
|
|
4239
4243
|
`];$("cm-app-frame",sl);var nl=class extends A{constructor(){super(...arguments);this.width="";this.fullWidth=!1;this.narrow=!1}render(){return c`<slot name="header"></slot><div class="content" part="content"><slot></slot></div><slot name="footer"></slot>`}};nl.properties={width:{reflect:!0},fullWidth:{type:Boolean,attribute:"full-width",reflect:!0},narrow:{type:Boolean,reflect:!0}},nl.styles=[E,w`
|
|
@@ -4248,16 +4252,16 @@ ${t.label}</button>
|
|
|
4248
4252
|
:host([width='detail']) .content { max-inline-size: 1040px; }
|
|
4249
4253
|
:host([width='wide']) .content { max-inline-size: 1600px; }
|
|
4250
4254
|
@container cm-page (max-width: 640px) { .content { padding: var(--cm-space-16); } }
|
|
4251
|
-
`];$("cm-page",nl);var ll,
|
|
4255
|
+
`];$("cm-page",nl);var ll,Pw,Iw,ol=class extends C{constructor(){super(...arguments);m(this,ll);this.tone="attention";this.heading="";this.dismissible=!1;this.hasActions=!1}render(){let e=this.tone==="critical"?"alert":"status",t=this.tone==="success"?ii`<path d="m5 10.5 3 3 7-7" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>`:ii`<circle cx="10" cy="10" r="7.5" fill="none" stroke="currentColor" stroke-width="1.6"/><path d="M10 6v5M10 13.6v.2" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>`;return c`<div class="banner" part="banner" role=${e}>
|
|
4252
4256
|
<svg class="icon" width="20" height="20" viewBox="0 0 20 20" aria-hidden="true">${t}</svg>
|
|
4253
4257
|
<div class="body">
|
|
4254
4258
|
${this.heading?c`<p class="title">${this.heading}</p>`:h}
|
|
4255
4259
|
<div><slot></slot></div>
|
|
4256
|
-
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${a(this,ll,
|
|
4260
|
+
<div class="actions" ?hidden=${!this.hasActions}><slot name="actions" @slotchange=${a(this,ll,Pw)}></slot></div>
|
|
4257
4261
|
</div>
|
|
4258
|
-
${this.dismissible?c`<button class="close" aria-label=${this.t("dismiss")} @click=${a(this,ll,
|
|
4262
|
+
${this.dismissible?c`<button class="close" aria-label=${this.t("dismiss")} @click=${a(this,ll,Iw)}>
|
|
4259
4263
|
<svg width="16" height="16" viewBox="0 0 16 16" aria-hidden="true"><path d="m4 4 8 8M12 4l-8 8" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg></button>`:h}
|
|
4260
|
-
</div>`}};ll=new WeakSet,
|
|
4264
|
+
</div>`}};ll=new WeakSet,Pw=function(e){this.hasActions=e.target.assignedElements().length>0,this.requestUpdate()},Iw=function(){let e=new CustomEvent("cm-dismiss",{bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(e)&&(this.hidden=!0)},ol.properties={tone:{reflect:!0},heading:{},dismissible:{type:Boolean}},ol.styles=[E,w`
|
|
4261
4265
|
:host { display: block; }
|
|
4262
4266
|
.banner {
|
|
4263
4267
|
display: flex; gap: var(--cm-space-12); align-items: flex-start;
|
|
@@ -4281,7 +4285,7 @@ ${t.label}</button>
|
|
|
4281
4285
|
border-radius: var(--cm-radius-sm); color: inherit; cursor: pointer;
|
|
4282
4286
|
}
|
|
4283
4287
|
.close:focus-visible { outline: 2px solid var(--cm-border-strong); outline-offset: 2px; }
|
|
4284
|
-
`];$("cm-banner",ol);var
|
|
4288
|
+
`];$("cm-banner",ol);var Xz=z("thumbnail",{noImage:"{alt} (no image)"}),cl=class extends C{constructor(){super(...arguments);this.src="";this.alt="";this.size="medium";this.loading="eager";this._failed=!1}willUpdate(e){e.has("src")&&(this._failed=!1)}render(){if(this.src&&!this._failed)return c`<span class="box" part="thumbnail"><img src=${this.src} alt=${this.alt} loading=${this.loading}
|
|
4285
4289
|
@error=${()=>{this._failed=!0}}></span>`;let e=this.size==="small"?18:this.size==="large"?32:24;return c`<span class="box" part="thumbnail" role=${this.alt?"img":h}
|
|
4286
4290
|
aria-label=${this.alt?this.t("noImage",{alt:this.alt}):h} aria-hidden=${this.alt?h:"true"}>
|
|
4287
4291
|
<cm-icon name="box" size=${e}></cm-icon></span>`}};cl.properties={src:{},alt:{},size:{reflect:!0},loading:{},_failed:{state:!0}},cl.styles=[E,w`
|
|
@@ -4294,7 +4298,7 @@ ${t.label}</button>
|
|
|
4294
4298
|
background: var(--cm-thumb-bg); color: var(--cm-icon-selected);
|
|
4295
4299
|
}
|
|
4296
4300
|
img { inline-size: 100%; block-size: 100%; object-fit: contain; display: block; }
|
|
4297
|
-
`];$("cm-thumbnail",cl);export{As as Announcer,wn as CmAccordion,No as CmAccountMenu,bn as CmActionBar,Ft as CmActionMenu,Ao as CmAppCard,sl as CmAppFrame,$o as CmAvatar,Yo as CmBadge,ol as CmBanner,so as CmBoard,Ds as CmBoardCard,Rs as CmBoardColumn,To as CmBottomNavigation,Io as CmBottomSheet,Cr as CmButton,la as CmButtonGroup,po as CmCalendar,ho as CmCalendarEvent,Xo as CmCard,Oi as CmCheckbox,ar as CmColorField,cn as CmColorPicker,Ki as CmCombobox,La as CmCommandPalette,Mn as CmComment,_n as CmCommentBox,Un as CmDataTable,Xi as CmDatePicker,Zi as CmDateRangePicker,$n as CmEmptyState,rr as CmFileUpload,Ro as CmFilterPanel,zo as CmFlashOfferBar,Xr as CmGlobalSearch,tl as CmGrid,Eo as CmHeaderBar,Js as CmIcon,xn as CmInfoItem,yn as CmInfoPanel,il as CmLayout,rl as CmLayoutSection,So as CmLinkTabs,C as CmLocalizedElement,Qs as CmMenuItem,yo as CmMetric,Co as CmMobileMenu,Do as CmModal,xo as CmNavItem,io as CmNestedItem,to as CmNestedList,qo as CmNotificationItem,Oo as CmNotificationPanel,Gt as CmOptionGroup,nl as CmPage,fn as CmPageHeader,Nn as CmPagination,Go as CmProgressBar,qr as CmRadio,Or as CmRadioGroup,Is as CmReportTile,vo as CmReportTiles,Qn as CmResourceItem,Zn as CmResourceList,vn as CmSaveBar,Ui as CmSearch,gn as CmSegmentedControl,ji as CmSelect,wo as CmSideNavigation,Zt as CmSidePanel,nr as CmSignatureField,kn as CmSkeleton,En as CmSkeletonDisplay,Rn as CmSmartTip,Hn as CmSmartTips,Po as CmSparkline,ia as CmSpinner,el as CmStack,In as CmStatusTabs,On as CmTableHeader,Kr as CmTag,qi as CmTextField,cl as CmThumbnail,ir as CmTimePicker,ks as CmTimeline,An as CmTimelineItem,Vo as CmToast,jo as CmToastRegion,Bi as CmToggle,Tn as CmTooltip,
|
|
4301
|
+
`];$("cm-thumbnail",cl);export{As as Announcer,wn as CmAccordion,No as CmAccountMenu,bn as CmActionBar,Ft as CmActionMenu,Ao as CmAppCard,sl as CmAppFrame,$o as CmAvatar,Yo as CmBadge,ol as CmBanner,so as CmBoard,Ds as CmBoardCard,Rs as CmBoardColumn,To as CmBottomNavigation,Io as CmBottomSheet,Cr as CmButton,la as CmButtonGroup,po as CmCalendar,ho as CmCalendarEvent,Xo as CmCard,Oi as CmCheckbox,ar as CmColorField,cn as CmColorPicker,Ki as CmCombobox,La as CmCommandPalette,Mn as CmComment,_n as CmCommentBox,Un as CmDataTable,Xi as CmDatePicker,Zi as CmDateRangePicker,$n as CmEmptyState,rr as CmFileUpload,Ro as CmFilterPanel,zo as CmFlashOfferBar,Xr as CmGlobalSearch,tl as CmGrid,Eo as CmHeaderBar,Js as CmIcon,xn as CmInfoItem,yn as CmInfoPanel,il as CmLayout,rl as CmLayoutSection,So as CmLinkTabs,C as CmLocalizedElement,Qs as CmMenuItem,yo as CmMetric,Co as CmMobileMenu,Do as CmModal,xo as CmNavItem,io as CmNestedItem,to as CmNestedList,qo as CmNotificationItem,Oo as CmNotificationPanel,Gt as CmOptionGroup,nl as CmPage,fn as CmPageHeader,Nn as CmPagination,Go as CmProgressBar,qr as CmRadio,Or as CmRadioGroup,Is as CmReportTile,vo as CmReportTiles,Qn as CmResourceItem,Zn as CmResourceList,vn as CmSaveBar,Ui as CmSearch,gn as CmSegmentedControl,ji as CmSelect,wo as CmSideNavigation,Zt as CmSidePanel,nr as CmSignatureField,kn as CmSkeleton,En as CmSkeletonDisplay,Rn as CmSmartTip,Hn as CmSmartTips,Po as CmSparkline,ia as CmSpinner,el as CmStack,In as CmStatusTabs,On as CmTableHeader,Kr as CmTag,qi as CmTextField,cl as CmThumbnail,ir as CmTimePicker,ks as CmTimeline,An as CmTimelineItem,Vo as CmToast,jo as CmToastRegion,Bi as CmToggle,Tn as CmTooltip,Ov as DEFAULT_PALETTE,on as MAX_RECENT,Ls as MoveModel,gv as commandMatches,e0 as configure,z as defineStrings,Pb as directionalIcons,cs as formatColor,me as formatDate,os as formatGradient,Hb as formatMessage,wu as formatNumber,Qw as getDefaultStrings,$c as hslToRgb,Zp as hsvToRgb,w0 as httpColorSource,mw as initials,Gl as isApplePlatform,yg as isColorValue,wx as listNavigation,xg as localColorSource,vl as localeFor,Fu as matchesShortcut,ls as normalizeHex,qe as parseColor,Ht as parseGradient,mh as pluralCategory,em as pushRecent,t0 as resetStrings,Np as resolvePreset,wc as rgbToHsl,Qp as rgbToHsv,kc as sameColor,Zw as setStrings,lp as shortcutKeys,Sw as showToast,uh as translate,G0 as undoable};
|
|
4298
4302
|
/*! Bundled license information:
|
|
4299
4303
|
|
|
4300
4304
|
@lit/reactive-element/css-tag.js:
|