@spectric/ui 0.0.15 → 0.0.17
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/classes/DisposibleElement.d.ts +1 -0
- package/dist/classes/index.d.ts +2 -0
- package/dist/components/color_picker/ColorPicker.d.ts +59 -0
- package/dist/components/color_picker/index.d.ts +0 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/input.d.ts +3 -1
- package/dist/components/table/body.d.ts +2 -2
- package/dist/components/table/cell.d.ts +5 -2
- package/dist/components/table/header.d.ts +9 -3
- package/dist/components/table/table.d.ts +18 -6
- package/dist/components/table/virtualBody.d.ts +2 -2
- package/dist/components/tooltip/popover.d.ts +85 -0
- package/dist/components/tooltip/tooltip.d.ts +14 -15
- package/dist/custom-elements.json +83 -8
- package/dist/index.d.ts +58 -0
- package/dist/index.es.js +2640 -2243
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +183 -132
- package/dist/index.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/utils/index.d.ts +3 -0
- package/package.json +6 -2
- package/src/classes/DisposibleElement.ts +3 -0
- package/src/classes/index.ts +2 -0
- package/src/components/color_picker/ColorPicker.css +4 -0
- package/src/components/color_picker/ColorPicker.ts +244 -0
- package/src/components/color_picker/index.ts +1 -0
- package/src/components/index.ts +3 -1
- package/src/components/input.css +38 -1
- package/src/components/input.ts +34 -7
- package/src/components/table/__tests__/table.spec.ts +91 -0
- package/src/components/table/body.ts +2 -2
- package/src/components/table/cell.ts +34 -8
- package/src/components/table/header.css +54 -0
- package/src/components/table/header.ts +144 -49
- package/src/components/table/table.css +20 -33
- package/src/components/table/table.ts +50 -16
- package/src/components/table/virtualBody.ts +2 -2
- package/src/components/tooltip/popover.ts +221 -0
- package/src/components/tooltip/tooltip.css +21 -16
- package/src/components/tooltip/tooltip.ts +17 -124
- package/src/index.ts +8 -1
- package/src/stories/fixtures/ExampleContent.ts +3 -3
- package/src/stories/table.stories.ts +5 -5
- package/src/utils/index.ts +3 -0
package/dist/index.umd.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(h,se){typeof exports=="object"&&typeof module<"u"?se(exports):typeof define=="function"&&define.amd?define(["exports"],se):(h=typeof globalThis<"u"?globalThis:h||self,se(h["Spectric-UI"]={}))})(this,function(h){"use strict";/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/var
|
|
5
|
+
*/var Ni;const se=globalThis,Mt=se.ShadowRoot&&(se.ShadyCSS===void 0||se.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,It=Symbol(),Qr=new WeakMap;let qr=class{constructor(e,n,i){if(this._$cssResult$=!0,i!==It)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=n}get styleSheet(){let e=this.o;const n=this.t;if(Mt&&e===void 0){const i=n!==void 0&&n.length===1;i&&(e=Qr.get(n)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&Qr.set(n,e))}return e}toString(){return this.cssText}};const Us=s=>new qr(typeof s=="string"?s:s+"",void 0,It),I=(s,...e)=>{const n=s.length===1?s[0]:e.reduce((i,o,t)=>i+(c=>{if(c._$cssResult$===!0)return c.cssText;if(typeof c=="number")return c;throw Error("Value passed to 'css' function must be a 'css' function result: "+c+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+s[t+1],s[0]);return new qr(n,s,It)},Fs=(s,e)=>{if(Mt)s.adoptedStyleSheets=e.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(const n of e){const i=document.createElement("style"),o=se.litNonce;o!==void 0&&i.setAttribute("nonce",o),i.textContent=n.cssText,s.appendChild(i)}},Wr=Mt?s=>s:s=>s instanceof CSSStyleSheet?(e=>{let n="";for(const i of e.cssRules)n+=i.cssText;return Us(n)})(s):s;/**
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2017 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/const{is:
|
|
9
|
+
*/const{is:Qs,defineProperty:qs,getOwnPropertyDescriptor:Ws,getOwnPropertyNames:Vs,getOwnPropertySymbols:Ys,getPrototypeOf:Ks}=Object,ne=globalThis,Vr=ne.trustedTypes,Zs=Vr?Vr.emptyScript:"",Ht=ne.reactiveElementPolyfillSupport,qe=(s,e)=>s,pt={toAttribute(s,e){switch(e){case Boolean:s=s?Zs:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,e){let n=s;switch(e){case Boolean:n=s!==null;break;case Number:n=s===null?null:Number(s);break;case Object:case Array:try{n=JSON.parse(s)}catch{n=null}}return n}},Ut=(s,e)=>!Qs(s,e),Yr={attribute:!0,type:String,converter:pt,reflect:!1,hasChanged:Ut};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),ne.litPropertyMetadata??(ne.litPropertyMetadata=new WeakMap);class Te extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,n=Yr){if(n.state&&(n.attribute=!1),this._$Ei(),this.elementProperties.set(e,n),!n.noAccessor){const i=Symbol(),o=this.getPropertyDescriptor(e,i,n);o!==void 0&&qs(this.prototype,e,o)}}static getPropertyDescriptor(e,n,i){const{get:o,set:t}=Ws(this.prototype,e)??{get(){return this[n]},set(c){this[n]=c}};return{get(){return o==null?void 0:o.call(this)},set(c){const d=o==null?void 0:o.call(this);t.call(this,c),this.requestUpdate(e,d,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Yr}static _$Ei(){if(this.hasOwnProperty(qe("elementProperties")))return;const e=Ks(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(qe("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(qe("properties"))){const n=this.properties,i=[...Vs(n),...Ys(n)];for(const o of i)this.createProperty(o,n[o])}const e=this[Symbol.metadata];if(e!==null){const n=litPropertyMetadata.get(e);if(n!==void 0)for(const[i,o]of n)this.elementProperties.set(i,o)}this._$Eh=new Map;for(const[n,i]of this.elementProperties){const o=this._$Eu(n,i);o!==void 0&&this._$Eh.set(o,n)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const n=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const o of i)n.unshift(Wr(o))}else e!==void 0&&n.push(Wr(e));return n}static _$Eu(e,n){const i=n.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(n=>this.enableUpdating=n),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(n=>n(this))}addController(e){var n;(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((n=e.hostConnected)==null||n.call(e))}removeController(e){var n;(n=this._$EO)==null||n.delete(e)}_$E_(){const e=new Map,n=this.constructor.elementProperties;for(const i of n.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Fs(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(n=>{var i;return(i=n.hostConnected)==null?void 0:i.call(n)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(n=>{var i;return(i=n.hostDisconnected)==null?void 0:i.call(n)})}attributeChangedCallback(e,n,i){this._$AK(e,i)}_$EC(e,n){var t;const i=this.constructor.elementProperties.get(e),o=this.constructor._$Eu(e,i);if(o!==void 0&&i.reflect===!0){const c=(((t=i.converter)==null?void 0:t.toAttribute)!==void 0?i.converter:pt).toAttribute(n,i.type);this._$Em=e,c==null?this.removeAttribute(o):this.setAttribute(o,c),this._$Em=null}}_$AK(e,n){var t;const i=this.constructor,o=i._$Eh.get(e);if(o!==void 0&&this._$Em!==o){const c=i.getPropertyOptions(o),d=typeof c.converter=="function"?{fromAttribute:c.converter}:((t=c.converter)==null?void 0:t.fromAttribute)!==void 0?c.converter:pt;this._$Em=o,this[o]=d.fromAttribute(n,c.type),this._$Em=null}}requestUpdate(e,n,i){if(e!==void 0){if(i??(i=this.constructor.getPropertyOptions(e)),!(i.hasChanged??Ut)(this[e],n))return;this.P(e,n,i)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(e,n,i){this._$AL.has(e)||this._$AL.set(e,n),i.reflect===!0&&this._$Em!==e&&(this._$Ej??(this._$Ej=new Set)).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(n){Promise.reject(n)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[t,c]of this._$Ep)this[t]=c;this._$Ep=void 0}const o=this.constructor.elementProperties;if(o.size>0)for(const[t,c]of o)c.wrapped!==!0||this._$AL.has(t)||this[t]===void 0||this.P(t,this[t],c)}let e=!1;const n=this._$AL;try{e=this.shouldUpdate(n),e?(this.willUpdate(n),(i=this._$EO)==null||i.forEach(o=>{var t;return(t=o.hostUpdate)==null?void 0:t.call(o)}),this.update(n)):this._$EU()}catch(o){throw e=!1,this._$EU(),o}e&&this._$AE(n)}willUpdate(e){}_$AE(e){var n;(n=this._$EO)==null||n.forEach(i=>{var o;return(o=i.hostUpdated)==null?void 0:o.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&(this._$Ej=this._$Ej.forEach(n=>this._$EC(n,this[n]))),this._$EU()}updated(e){}firstUpdated(e){}}Te.elementStyles=[],Te.shadowRootOptions={mode:"open"},Te[qe("elementProperties")]=new Map,Te[qe("finalized")]=new Map,Ht==null||Ht({ReactiveElement:Te}),(ne.reactiveElementVersions??(ne.reactiveElementVersions=[])).push("2.0.4");/**
|
|
10
10
|
* @license
|
|
11
11
|
* Copyright 2017 Google LLC
|
|
12
12
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
-
*/const
|
|
14
|
-
\f\r]`,
|
|
15
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
13
|
+
*/const We=globalThis,ut=We.trustedTypes,Kr=ut?ut.createPolicy("lit-html",{createHTML:s=>s}):void 0,Ft="$lit$",te=`lit$${Math.random().toFixed(9).slice(2)}$`,Qt="?"+te,Xs=`<${Qt}>`,ge=document,Ve=()=>ge.createComment(""),Ye=s=>s===null||typeof s!="object"&&typeof s!="function",qt=Array.isArray,Zr=s=>qt(s)||typeof(s==null?void 0:s[Symbol.iterator])=="function",Wt=`[
|
|
14
|
+
\f\r]`,Ke=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Xr=/-->/g,Gr=/>/g,ve=RegExp(`>|${Wt}(?:([^\\s"'>=/]+)(${Wt}*=${Wt}*(?:[^
|
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Jr=/'/g,ei=/"/g,ti=/^(?:script|style|textarea|title)$/i,Gs=s=>(e,...n)=>({_$litType$:s,strings:e,values:n}),S=Gs(1),oe=Symbol.for("lit-noChange"),P=Symbol.for("lit-nothing"),ri=new WeakMap,be=ge.createTreeWalker(ge,129);function ii(s,e){if(!qt(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return Kr!==void 0?Kr.createHTML(e):e}const si=(s,e)=>{const n=s.length-1,i=[];let o,t=e===2?"<svg>":e===3?"<math>":"",c=Ke;for(let d=0;d<n;d++){const f=s[d];let y,x,$=-1,E=0;for(;E<f.length&&(c.lastIndex=E,x=c.exec(f),x!==null);)E=c.lastIndex,c===Ke?x[1]==="!--"?c=Xr:x[1]!==void 0?c=Gr:x[2]!==void 0?(ti.test(x[2])&&(o=RegExp("</"+x[2],"g")),c=ve):x[3]!==void 0&&(c=ve):c===ve?x[0]===">"?(c=o??Ke,$=-1):x[1]===void 0?$=-2:($=c.lastIndex-x[2].length,y=x[1],c=x[3]===void 0?ve:x[3]==='"'?ei:Jr):c===ei||c===Jr?c=ve:c===Xr||c===Gr?c=Ke:(c=ve,o=void 0);const C=c===ve&&s[d+1].startsWith("/>")?" ":"";t+=c===Ke?f+Xs:$>=0?(i.push(y),f.slice(0,$)+Ft+f.slice($)+te+C):f+te+($===-2?d:C)}return[ii(s,t+(s[n]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),i]};class Ze{constructor({strings:e,_$litType$:n},i){let o;this.parts=[];let t=0,c=0;const d=e.length-1,f=this.parts,[y,x]=si(e,n);if(this.el=Ze.createElement(y,i),be.currentNode=this.el.content,n===2||n===3){const $=this.el.content.firstChild;$.replaceWith(...$.childNodes)}for(;(o=be.nextNode())!==null&&f.length<d;){if(o.nodeType===1){if(o.hasAttributes())for(const $ of o.getAttributeNames())if($.endsWith(Ft)){const E=x[c++],C=o.getAttribute($).split(te),k=/([.?@])?(.*)/.exec(E);f.push({type:1,index:t,name:k[2],strings:C,ctor:k[1]==="."?oi:k[1]==="?"?ai:k[1]==="@"?li:Xe}),o.removeAttribute($)}else $.startsWith(te)&&(f.push({type:6,index:t}),o.removeAttribute($));if(ti.test(o.tagName)){const $=o.textContent.split(te),E=$.length-1;if(E>0){o.textContent=ut?ut.emptyScript:"";for(let C=0;C<E;C++)o.append($[C],Ve()),be.nextNode(),f.push({type:2,index:++t});o.append($[E],Ve())}}}else if(o.nodeType===8)if(o.data===Qt)f.push({type:2,index:t});else{let $=-1;for(;($=o.data.indexOf(te,$+1))!==-1;)f.push({type:7,index:t}),$+=te.length-1}t++}}static createElement(e,n){const i=ge.createElement("template");return i.innerHTML=e,i}}function me(s,e,n=s,i){var c,d;if(e===oe)return e;let o=i!==void 0?(c=n._$Co)==null?void 0:c[i]:n._$Cl;const t=Ye(e)?void 0:e._$litDirective$;return(o==null?void 0:o.constructor)!==t&&((d=o==null?void 0:o._$AO)==null||d.call(o,!1),t===void 0?o=void 0:(o=new t(s),o._$AT(s,n,i)),i!==void 0?(n._$Co??(n._$Co=[]))[i]=o:n._$Cl=o),o!==void 0&&(e=me(s,o._$AS(s,e.values),o,i)),e}let ni=class{constructor(e,n){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:n},parts:i}=this._$AD,o=((e==null?void 0:e.creationScope)??ge).importNode(n,!0);be.currentNode=o;let t=be.nextNode(),c=0,d=0,f=i[0];for(;f!==void 0;){if(c===f.index){let y;f.type===2?y=new Oe(t,t.nextSibling,this,e):f.type===1?y=new f.ctor(t,f.name,f.strings,this,e):f.type===6&&(y=new ci(t,this,e)),this._$AV.push(y),f=i[++d]}c!==(f==null?void 0:f.index)&&(t=be.nextNode(),c++)}return be.currentNode=ge,o}p(e){let n=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,n),n+=i.strings.length-2):i._$AI(e[n])),n++}};class Oe{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,n,i,o){this.type=2,this._$AH=P,this._$AN=void 0,this._$AA=e,this._$AB=n,this._$AM=i,this.options=o,this._$Cv=(o==null?void 0:o.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const n=this._$AM;return n!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=n.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,n=this){e=me(this,e,n),Ye(e)?e===P||e==null||e===""?(this._$AH!==P&&this._$AR(),this._$AH=P):e!==this._$AH&&e!==oe&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Zr(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==P&&Ye(this._$AH)?this._$AA.nextSibling.data=e:this.T(ge.createTextNode(e)),this._$AH=e}$(e){var t;const{values:n,_$litType$:i}=e,o=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=Ze.createElement(ii(i.h,i.h[0]),this.options)),i);if(((t=this._$AH)==null?void 0:t._$AD)===o)this._$AH.p(n);else{const c=new ni(o,this),d=c.u(this.options);c.p(n),this.T(d),this._$AH=c}}_$AC(e){let n=ri.get(e.strings);return n===void 0&&ri.set(e.strings,n=new Ze(e)),n}k(e){qt(this._$AH)||(this._$AH=[],this._$AR());const n=this._$AH;let i,o=0;for(const t of e)o===n.length?n.push(i=new Oe(this.O(Ve()),this.O(Ve()),this,this.options)):i=n[o],i._$AI(t),o++;o<n.length&&(this._$AR(i&&i._$AB.nextSibling,o),n.length=o)}_$AR(e=this._$AA.nextSibling,n){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,n);e&&e!==this._$AB;){const o=e.nextSibling;e.remove(),e=o}}setConnected(e){var n;this._$AM===void 0&&(this._$Cv=e,(n=this._$AP)==null||n.call(this,e))}}class Xe{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,n,i,o,t){this.type=1,this._$AH=P,this._$AN=void 0,this.element=e,this.name=n,this._$AM=o,this.options=t,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=P}_$AI(e,n=this,i,o){const t=this.strings;let c=!1;if(t===void 0)e=me(this,e,n,0),c=!Ye(e)||e!==this._$AH&&e!==oe,c&&(this._$AH=e);else{const d=e;let f,y;for(e=t[0],f=0;f<t.length-1;f++)y=me(this,d[i+f],n,f),y===oe&&(y=this._$AH[f]),c||(c=!Ye(y)||y!==this._$AH[f]),y===P?e=P:e!==P&&(e+=(y??"")+t[f+1]),this._$AH[f]=y}c&&!o&&this.j(e)}j(e){e===P?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class oi extends Xe{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===P?void 0:e}}class ai extends Xe{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==P)}}class li extends Xe{constructor(e,n,i,o,t){super(e,n,i,o,t),this.type=5}_$AI(e,n=this){if((e=me(this,e,n,0)??P)===oe)return;const i=this._$AH,o=e===P&&i!==P||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,t=e!==P&&(i===P||o);o&&this.element.removeEventListener(this.name,this,i),t&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var n;typeof this._$AH=="function"?this._$AH.call(((n=this.options)==null?void 0:n.host)??this.element,e):this._$AH.handleEvent(e)}}class ci{constructor(e,n,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=n,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){me(this,e)}}const Js={M:Ft,P:te,A:Qt,C:1,L:si,R:ni,D:Zr,V:me,I:Oe,H:Xe,N:ai,U:li,B:oi,F:ci},Vt=We.litHtmlPolyfillSupport;Vt==null||Vt(Ze,Oe),(We.litHtmlVersions??(We.litHtmlVersions=[])).push("3.2.1");const Ge=(s,e,n)=>{const i=(n==null?void 0:n.renderBefore)??e;let o=i._$litPart$;if(o===void 0){const t=(n==null?void 0:n.renderBefore)??null;i._$litPart$=o=new Oe(e.insertBefore(Ve(),t),t,void 0,n??{})}return o._$AI(s),o};/**
|
|
16
16
|
* @license
|
|
17
17
|
* Copyright 2017 Google LLC
|
|
18
18
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
|
-
*/let
|
|
19
|
+
*/let D=class extends Te{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var n;const e=super.createRenderRoot();return(n=this.renderOptions).renderBefore??(n.renderBefore=e.firstChild),e}update(e){const n=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Ge(n,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)==null||e.setConnected(!1)}render(){return oe}};D._$litElement$=!0,D.finalized=!0,(Ni=globalThis.litElementHydrateSupport)==null||Ni.call(globalThis,{LitElement:D});const Yt=globalThis.litElementPolyfillSupport;Yt==null||Yt({LitElement:D}),(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.1");/**
|
|
20
20
|
* @license
|
|
21
21
|
* Copyright 2017 Google LLC
|
|
22
22
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
23
|
-
*/const
|
|
23
|
+
*/const Kt={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Je=s=>(...e)=>({_$litDirective$:s,values:e});let ht=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,n,i){this._$Ct=e,this._$AM=n,this._$Ci=i}_$AS(e,n){return this.update(e,n)}update(e,n){return this.render(...n)}};/**
|
|
24
24
|
* @license
|
|
25
25
|
* Copyright 2018 Google LLC
|
|
26
26
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
|
-
*/const
|
|
27
|
+
*/const pi="important",en=" !"+pi,Zt=Je(class extends ht{constructor(s){var e;if(super(s),s.type!==Kt.ATTRIBUTE||s.name!=="style"||((e=s.strings)==null?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(s){return Object.keys(s).reduce((e,n)=>{const i=s[n];return i==null?e:e+`${n=n.includes("-")?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${i};`},"")}update(s,[e]){const{style:n}=s.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(const i of this.ft)e[i]==null&&(this.ft.delete(i),i.includes("-")?n.removeProperty(i):n[i]=null);for(const i in e){const o=e[i];if(o!=null){this.ft.add(i);const t=typeof o=="string"&&o.endsWith(en);i.includes("-")||t?n.setProperty(i,t?o.slice(0,-11):o,t?pi:""):n[i]=o}}return oe}}),tn=I`
|
|
28
28
|
:host{
|
|
29
29
|
display: inline-block;
|
|
30
30
|
--text-on-color: var(--spectric-text-on-color, #ffffff);
|
|
@@ -269,68 +269,72 @@ opacity:1
|
|
|
269
269
|
* @license
|
|
270
270
|
* Copyright 2017 Google LLC
|
|
271
271
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
272
|
-
*/const
|
|
272
|
+
*/const O=s=>(e,n)=>{n!==void 0?n.addInitializer(()=>{customElements.define(s,e)}):customElements.define(s,e)};/**
|
|
273
273
|
* @license
|
|
274
274
|
* Copyright 2017 Google LLC
|
|
275
275
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
276
|
-
*/const
|
|
276
|
+
*/const rn={attribute:!0,type:String,converter:pt,reflect:!1,hasChanged:Ut},sn=(s=rn,e,n)=>{const{kind:i,metadata:o}=n;let t=globalThis.litPropertyMetadata.get(o);if(t===void 0&&globalThis.litPropertyMetadata.set(o,t=new Map),t.set(n.name,s),i==="accessor"){const{name:c}=n;return{set(d){const f=e.get.call(this);e.set.call(this,d),this.requestUpdate(c,f,s)},init(d){return d!==void 0&&this.P(c,void 0,s),d}}}if(i==="setter"){const{name:c}=n;return function(d){const f=this[c];e.call(this,d),this.requestUpdate(c,f,s)}}throw Error("Unsupported decorator location: "+i)};function b(s){return(e,n)=>typeof n=="object"?sn(s,e,n):((i,o,t)=>{const c=o.hasOwnProperty(t);return o.constructor.createProperty(t,c?{...i,wrapped:!0}:i),c?Object.getOwnPropertyDescriptor(o,t):void 0})(s,e,n)}/**
|
|
277
277
|
* @license
|
|
278
278
|
* Copyright 2017 Google LLC
|
|
279
279
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
280
|
-
*/function
|
|
280
|
+
*/function F(s){return b({...s,state:!0,attribute:!1})}/**
|
|
281
281
|
* @license
|
|
282
282
|
* Copyright 2017 Google LLC
|
|
283
283
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
284
|
-
*/
|
|
284
|
+
*/function nn(s){return(e,n)=>{const i=typeof e=="function"?e:e[n];Object.assign(i,s)}}/**
|
|
285
285
|
* @license
|
|
286
286
|
* Copyright 2017 Google LLC
|
|
287
287
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
288
|
-
*/
|
|
288
|
+
*/const ui=(s,e,n)=>(n.configurable=!0,n.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(s,e,n),n);/**
|
|
289
289
|
* @license
|
|
290
290
|
* Copyright 2017 Google LLC
|
|
291
291
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
292
|
-
*/function
|
|
293
|
-
|
|
292
|
+
*/function ye(s,e){return(n,i,o)=>{const t=c=>{var d;return((d=c.renderRoot)==null?void 0:d.querySelector(s))??null};return ui(n,i,{get(){return t(this)}})}}/**
|
|
293
|
+
* @license
|
|
294
|
+
* Copyright 2017 Google LLC
|
|
295
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
296
|
+
*/function dt(s){return(e,n)=>ui(e,n,{async get(){var i;return await this.updateComplete,((i=this.renderRoot)==null?void 0:i.querySelector(s))??null}})}let Xt=0;const hi=()=>Xt;class di{constructor(e,n,i,o){this._handler=i,this._type=n,this._handler=i,this._options=o||!1,e instanceof Promise?e.then(t=>{this._handler&&(this._node=t,this._node.addEventListener(this._type,this._handler,this._options))}):typeof e=="function"?(this._node=e(),this._node.addEventListener(this._type,this._handler,this._options)):(this._node=e,this._node.addEventListener(this._type,this._handler,this._options)),Xt+=1}dispose(){this._handler&&(this._node&&(Xt-=1,this._node.removeEventListener(this._type,this._handler,this._options)),this._node=void 0,this._handler=void 0)}}class ae extends D{constructor(){super(...arguments),this._disposables=new Set,this._isDisposed=!1,this._disposableListeners=[],this._connected=!1}addDisposableListener(e,n,i,o){if(this._disposableListeners.find(c=>c.event===n&&c.target===e&&c.handler===i)){console.warn("Event handler already exists best practice is to add the this in the constructor");return}this._disposableListeners.push({target:e,event:n,handler:i,options:o}),this._connected&&this.registerDisposable(new di(e,n,i,o))}registerDisposable(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?console.warn(new Error("Trying to add a disposable to something that has already been disposed of. The added object will be leaked!").stack):this._disposables.add(e),e}connectedCallback(){super.connectedCallback(),this._connected=!0,this._isDisposed=!1,this._disposableListeners.forEach(({target:e,event:n,handler:i,options:o})=>{this.registerDisposable(new di(e,n,i,o))})}disconnectedCallback(){super.disconnectedCallback(),this._connected=!1,this._disposables.forEach(e=>{e.dispose()}),this._isDisposed=!0}}var on=Object.defineProperty,an=Object.getOwnPropertyDescriptor,V=(s,e,n,i)=>{for(var o=i>1?void 0:i?an(e,n):e,t=s.length-1,c;t>=0;t--)(c=s[t])&&(o=(i?c(e,n,o):c(o))||o);return i&&o&&on(e,n,o),o},Gt=(s=>(s.large="large",s.medium="medium",s.small="small",s.xsmall="xsmall",s.xxsmall="xxsmall",s.tiny="tiny",s))(Gt||{}),Jt=(s=>(s.primary="primary",s.secondary="secondary",s.text="text",s))(Jt||{});const ln={primary:"spectric-button--primary",secondary:"spectric-button--secondary",text:"spectric-button--text"};h.SpectricButton=class extends ae{constructor(){super(),this.variant="primary",this.disabled=!1,this.size="small",this.label="",this.danger=!1,this.icon=!1,this.tooltipPosition="right",this._onClick=e=>{if(e instanceof CustomEvent||(e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation(),this.disabled))return;const n={bubbles:!0,composed:!0,detail:e};this.dispatchEvent(new CustomEvent("click",n))},this.addDisposableListener(this,"click",this._onClick,{capture:!0})}render(){const e=ln[this.variant]||"spectric-button--primary";return S`
|
|
297
|
+
${this.tooltip?S`<spectric-tooltip .text=${this.tooltip} .position=${this.tooltipPosition||"right"} .triggerTarget=${this}></spectric-tooltip>`:null}
|
|
294
298
|
<button
|
|
295
299
|
type="button"
|
|
296
300
|
?disabled=${this.disabled}
|
|
297
|
-
class=${["spectric-button",`spectric-button-danger--${this.danger||!1}`,`spectric-button--${this.size||"medium"}`,
|
|
298
|
-
style=${
|
|
301
|
+
class=${["spectric-button",`spectric-button-danger--${this.danger||!1}`,`spectric-button--${this.size||"medium"}`,e].join(" ")}
|
|
302
|
+
style=${Zt({backgroundColor:this.backgroundColor})}
|
|
299
303
|
>
|
|
300
304
|
<span class="animation"></span>
|
|
301
305
|
<slot>${this.label}</slot>
|
|
302
306
|
</button>
|
|
303
|
-
`}},
|
|
307
|
+
`}},h.SpectricButton.styles=tn,V([b({type:String,reflect:!0})],h.SpectricButton.prototype,"variant",2),V([b({type:Boolean,reflect:!0})],h.SpectricButton.prototype,"disabled",2),V([b({type:String,reflect:!0})],h.SpectricButton.prototype,"backgroundColor",2),V([b({type:String,reflect:!0})],h.SpectricButton.prototype,"size",2),V([b({type:String,reflect:!0})],h.SpectricButton.prototype,"label",2),V([b({type:Boolean,reflect:!0})],h.SpectricButton.prototype,"danger",2),V([b({type:Boolean,reflect:!0})],h.SpectricButton.prototype,"icon",2),V([b({type:String,reflect:!0})],h.SpectricButton.prototype,"tooltip",2),V([b({type:String,reflect:!0})],h.SpectricButton.prototype,"tooltipPosition",2),h.SpectricButton=V([O("spectric-button")],h.SpectricButton);/**
|
|
304
308
|
* @license
|
|
305
309
|
* Copyright 2020 Google LLC
|
|
306
310
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
307
|
-
*/const{I:
|
|
311
|
+
*/const{I:cn}=Js,fi=(s,e)=>(s==null?void 0:s._$litType$)!==void 0,pn=s=>{var e;return((e=s==null?void 0:s._$litType$)==null?void 0:e.h)!=null},un=s=>s.strings===void 0,gi=()=>document.createComment(""),$e=(s,e,n)=>{var t;const i=s._$AA.parentNode,o=e===void 0?s._$AB:e._$AA;if(n===void 0){const c=i.insertBefore(gi(),o),d=i.insertBefore(gi(),o);n=new cn(c,d,s,s.options)}else{const c=n._$AB.nextSibling,d=n._$AM,f=d!==s;if(f){let y;(t=n._$AQ)==null||t.call(n,s),n._$AM=s,n._$AP!==void 0&&(y=s._$AU)!==d._$AU&&n._$AP(y)}if(c!==o||f){let y=n._$AA;for(;y!==c;){const x=y.nextSibling;i.insertBefore(y,o),y=x}}}return n},we=(s,e,n=s)=>(s._$AI(e,n),s),hn={},er=(s,e=hn)=>s._$AH=e,tr=s=>s._$AH,rr=s=>{var i;(i=s._$AP)==null||i.call(s,!1,!0);let e=s._$AA;const n=s._$AB.nextSibling;for(;e!==n;){const o=e.nextSibling;e.remove(),e=o}},dn=s=>{s._$AR()};/**
|
|
308
312
|
* @license
|
|
309
313
|
* Copyright 2017 Google LLC
|
|
310
314
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
311
|
-
*/const
|
|
315
|
+
*/const et=(s,e)=>{var i;const n=s._$AN;if(n===void 0)return!1;for(const o of n)(i=o._$AO)==null||i.call(o,e,!1),et(o,e);return!0},ft=s=>{let e,n;do{if((e=s._$AM)===void 0)break;n=e._$AN,n.delete(s),s=e}while((n==null?void 0:n.size)===0)},vi=s=>{for(let e;e=s._$AM;s=e){let n=e._$AN;if(n===void 0)e._$AN=n=new Set;else if(n.has(s))break;n.add(s),vn(e)}};function fn(s){this._$AN!==void 0?(ft(this),this._$AM=s,vi(this)):this._$AM=s}function gn(s,e=!1,n=0){const i=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(e)if(Array.isArray(i))for(let t=n;t<i.length;t++)et(i[t],!1),ft(i[t]);else i!=null&&(et(i,!1),ft(i));else et(this,s)}const vn=s=>{s.type==Kt.CHILD&&(s._$AP??(s._$AP=gn),s._$AQ??(s._$AQ=fn))};class bi extends ht{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,n,i){super._$AT(e,n,i),vi(this),this.isConnected=e._$AU}_$AO(e,n=!0){var i,o;e!==this.isConnected&&(this.isConnected=e,e?(i=this.reconnected)==null||i.call(this):(o=this.disconnected)==null||o.call(this)),n&&(et(this,e),ft(this))}setValue(e){if(un(this._$Ct))this._$Ct._$AI(e,this);else{const n=[...this._$Ct._$AH];n[this._$Ci]=e,this._$Ct._$AI(n,this,0)}}disconnected(){}reconnected(){}}/**
|
|
312
316
|
* @license
|
|
313
317
|
* Copyright 2020 Google LLC
|
|
314
318
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
315
|
-
*/const
|
|
319
|
+
*/const tt=()=>new bn;let bn=class{};const ir=new WeakMap,rt=Je(class extends bi{render(s){return P}update(s,[e]){var i;const n=e!==this.Y;return n&&this.Y!==void 0&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.Y=e,this.ht=(i=s.options)==null?void 0:i.host,this.rt(this.ct=s.element)),P}rt(s){if(this.isConnected||(s=void 0),typeof this.Y=="function"){const e=this.ht??globalThis;let n=ir.get(e);n===void 0&&(n=new WeakMap,ir.set(e,n)),n.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),n.set(this.Y,s),s!==void 0&&this.Y.call(this.ht,s)}else this.Y.value=s}get lt(){var s,e;return typeof this.Y=="function"?(s=ir.get(this.ht??globalThis))==null?void 0:s.get(this.Y):(e=this.Y)==null?void 0:e.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),sr=class{constructor(e){return this.buffer=e,this.u8=new Uint8Array(e),new Proxy(this,{get(n,i){return n[i]?n[i]:n.getBit(i)}})}getBit(e){var n=this.u8[e>>3],i=e&7;return n>>7-i&1}setBit(e,n){var i=e&7;n?this.u8[e>>3]|=128>>i:this.u8[e>>3]&=~(128>>i)}get length(){return this.u8.byteLength*8}set(e,n){for(let i=n||0,o=0,t=e.length;o<t;i++,o++)this.setBit(i,e[o])}subarray(e,n){let i=[];e=e||0,n=n||this.length,n=n>this.length?this.length:n;for(let o=e;o<n;o++)i.push(this.getBit(o));return i}},mi=(s,e)=>{let n;return(...i)=>{clearTimeout(n),n=window.setTimeout(()=>s.apply(void 0,i),e)}},gt=s=>{var e;return(...n)=>{e&&cancelAnimationFrame(e),e=requestAnimationFrame(()=>{s.apply(void 0,n)})}};var mn=Object.defineProperty,yn=Object.getOwnPropertyDescriptor,_e=(s,e,n,i)=>{for(var o=i>1?void 0:i?yn(e,n):e,t=s.length-1,c;t>=0;t--)(c=s[t])&&(o=(i?c(e,n,o):c(o))||o);return i&&o&&mn(e,n,o),o};const $n=["mousemove","click","dblclick","mousedown","mouseup","contextmenu"],vt={width:200,height:200},bt={width:10,height:10};h.BitDisplayCanvas=class extends ae{constructor(){super(),this.arrayBuffer=new ArrayBuffer(0),this.frameWidth=100,this.scale=1,this.width=200,this.height=200,this.state={},this.yStart=0,this.xStart=0,this.refs={viewport:tt(),canvas:tt(),scrollDiv:tt()},this.color="#000000",this.onThemeChange=()=>{let i=getComputedStyle(this);this.color!=i.color&&(this.color=i.color,this.paint())},this.onResize=()=>{this.calculateViewport()},this.handleScroll=()=>{if(!this.refs.viewport.value)return;const i=this.getPxPerBit();this.yStart=this.refs.viewport.value.scrollTop?Math.floor(this.refs.viewport.value.scrollTop/i)+1:0,this.xStart=this.refs.viewport.value.scrollLeft?Math.floor(this.refs.viewport.value.scrollLeft/i)+1:0,this.paint()};let e=new ResizeObserver(this.onResize);e.dispose=()=>{this.resizeObserver.disconnect()},this.resizeObserver=e,this.addDisposableListener(document.body,"theme-change",this.onThemeChange);var n={};$n.forEach(i=>{this.addDisposableListener(this._canvas,i,gt(async o=>{o.stopImmediatePropagation(),o.stopPropagation(),o.preventDefault();var t=await this._canvas;let c=t.getBoundingClientRect(),d={x:Math.floor(Math.abs(o.clientX-c.left)),y:Math.floor(Math.abs(o.clientY-c.top))},f=this.canvasPositionToBit(d);if(i==="mousemove"&&n[i]==f)return;n[i]=f;let y="bit"+String(i).charAt(0).toUpperCase()+String(i).slice(1);if(f!=-1){let x=new CustomEvent(y,{detail:{bitIndex:f,position:d,nativeEvent:o}});this.dispatchEvent(x)}}))})}connectedCallback(){this.onResize(),super.connectedCallback(),this.registerDisposable(this.resizeObserver),this.resizeObserver.observe(this)}updated(e){e.has("arrayBuffer")&&this.arrayBuffer&&(this._bitArray=new sr(this.arrayBuffer));const n=["arrayBuffer","scale","frameWidth","width","height"];for(const i of n)if(e.has(i)){this.paint();return}}canvasPositionToBit(e){let n=Math.floor(e.x/this.scale),i=Math.floor(e.y/this.scale);return n>this.frameWidth-1?-1:this.yStart*this.frameWidth+this.xStart+(i*this.frameWidth+n)}paint(){if(!this.refs.canvas.value||!this._bitArray)return;const{frameWidth:e,_bitArray:n}=this;if(e<=0)return;this.calculateViewport();const{width:i=vt.width,height:o=vt.height}=this,t=this.getPxPerBit(),c=this.refs.canvas.value.getContext("2d");if(!c)return;this.state.scale!=t&&(c.reset(),c.scale(t,t));let d=getComputedStyle(this);c.fillStyle=d.color,c.clearRect(0,0,i,o);let f=0;for(let y=this.yStart*e+this.xStart,x=n.length;y<x;y++){let $=y%e-this.xStart;if(!($<0)){if(Math.floor($*t)>i){f++,y=f*e+this.yStart*e+this.xStart-1;continue}if(Math.floor(f*t)>o)break;n.getBit(y)===1&&c.fillRect($,f,1,1),(y+1)%e===0&&y>=e-1&&f++}}}getPxPerBit(){return this.scale>0?this.scale:1}calculateViewport(){const{frameWidth:e,_bitArray:n}=this;if(this.refs.scrollDiv.value){var i=this.getPxPerBit();const o=n.length/e*i,t=e*i,c=this.refs.scrollDiv.value;c.style.width=t+"px",c.style.height=o+"px"}}render(){const{height:e=vt.height,width:n=vt.width}=this;return S`
|
|
316
320
|
<div
|
|
317
321
|
id="viewport"
|
|
318
|
-
${
|
|
322
|
+
${rt(this.refs.viewport)}
|
|
319
323
|
@scroll=${this.handleScroll}
|
|
320
|
-
style=${`width:${
|
|
324
|
+
style=${`width:${n+bt.width}px;height:${e+bt.height}px;overflow:auto;position:relative`}
|
|
321
325
|
>
|
|
322
326
|
<div
|
|
323
327
|
id="fakescrolldiv"
|
|
324
|
-
${
|
|
328
|
+
${rt(this.refs.scrollDiv)}
|
|
325
329
|
>
|
|
326
330
|
</div>
|
|
327
331
|
</div>
|
|
328
332
|
<canvas
|
|
329
|
-
${
|
|
330
|
-
width=${
|
|
331
|
-
height=${
|
|
333
|
+
${rt(this.refs.canvas)}
|
|
334
|
+
width=${n}
|
|
335
|
+
height=${e}
|
|
332
336
|
></canvas>
|
|
333
|
-
`}},
|
|
337
|
+
`}},h.BitDisplayCanvas.styles=I`
|
|
334
338
|
:host{
|
|
335
339
|
position: relative;
|
|
336
340
|
--border-radius: var(--spectric-border-radius,4em);
|
|
@@ -354,8 +358,8 @@ opacity:1
|
|
|
354
358
|
background-color:var(--background-color);
|
|
355
359
|
}
|
|
356
360
|
::-webkit-scrollbar {
|
|
357
|
-
height: ${
|
|
358
|
-
width: ${
|
|
361
|
+
height: ${bt.height}px;
|
|
362
|
+
width: ${bt.width}px;
|
|
359
363
|
|
|
360
364
|
}
|
|
361
365
|
|
|
@@ -426,7 +430,7 @@ opacity:1
|
|
|
426
430
|
|
|
427
431
|
}
|
|
428
432
|
|
|
429
|
-
`,
|
|
433
|
+
`,_e([b({type:Object,attribute:!1})],h.BitDisplayCanvas.prototype,"arrayBuffer",2),_e([b({type:Number})],h.BitDisplayCanvas.prototype,"frameWidth",2),_e([b({type:Number})],h.BitDisplayCanvas.prototype,"scale",2),_e([b({type:Number})],h.BitDisplayCanvas.prototype,"width",2),_e([b({type:Number})],h.BitDisplayCanvas.prototype,"height",2),_e([dt("canvas")],h.BitDisplayCanvas.prototype,"_canvas",2),h.BitDisplayCanvas=_e([O("spectric-bit-display")],h.BitDisplayCanvas);const wn=I`.spectric-header {
|
|
430
434
|
display: flex;
|
|
431
435
|
justify-content: space-between;
|
|
432
436
|
align-items: center;
|
|
@@ -461,7 +465,7 @@ opacity:1
|
|
|
461
465
|
color: #333;
|
|
462
466
|
font-size: 14px;
|
|
463
467
|
}
|
|
464
|
-
`;var
|
|
468
|
+
`;var _n=Object.defineProperty,Sn=Object.getOwnPropertyDescriptor,mt=(s,e,n,i)=>{for(var o=i>1?void 0:i?Sn(e,n):e,t=s.length-1,c;t>=0;t--)(c=s[t])&&(o=(i?c(e,n,o):c(o))||o);return i&&o&&_n(e,n,o),o};h.Header=class extends D{constructor(){super(...arguments),this.showCreateAccount=!1,this.showLoginButton=!1,this.username="",this.onLogout=()=>{const e={bubbles:!0,composed:!0};this.dispatchEvent(new CustomEvent("logout",e))},this.onLogin=()=>{const e={bubbles:!0,composed:!0};this.dispatchEvent(new CustomEvent("login",e))},this.onCreateAccount=()=>{const e={bubbles:!0,composed:!0};this.dispatchEvent(new CustomEvent("createAccount",e))}}render(){return S`
|
|
465
469
|
<header>
|
|
466
470
|
<div class="spectric-header">
|
|
467
471
|
<div style="flex-grow:1;">
|
|
@@ -469,10 +473,10 @@ opacity:1
|
|
|
469
473
|
<h1><slot name="name"></slot></h1>
|
|
470
474
|
<slot name="center"></slot>
|
|
471
475
|
</div>
|
|
472
|
-
${this.showLoginButton!==!1?
|
|
476
|
+
${this.showLoginButton!==!1?S`
|
|
473
477
|
<div>
|
|
474
|
-
${this.username&&this.username!==""?
|
|
475
|
-
${this.showCreateAccount!==!1?
|
|
478
|
+
${this.username&&this.username!==""?S`<spectric-button variant="secondary" size="small" @click=${this.onLogout}>Log out</spectric-button>`:S`
|
|
479
|
+
${this.showCreateAccount!==!1?S`<spectric-button variant="text" size="small" @click=${this.onCreateAccount}>Sign up</spectric-button>`:null}
|
|
476
480
|
<spectric-button variant="primary" size="small" @click=${this.onLogin}>Log in</spectric-button>`}
|
|
477
481
|
|
|
478
482
|
|
|
@@ -480,12 +484,12 @@ opacity:1
|
|
|
480
484
|
<slot name="end"></slot>
|
|
481
485
|
</div>
|
|
482
486
|
</header>
|
|
483
|
-
`}},
|
|
484
|
-
<header style=${
|
|
487
|
+
`}},h.Header.styles=wn,mt([b({type:Boolean,reflect:!0})],h.Header.prototype,"showCreateAccount",2),mt([b({type:Boolean,reflect:!0})],h.Header.prototype,"showLoginButton",2),mt([b({type:String,reflect:!0})],h.Header.prototype,"username",2),h.Header=mt([O("spectric-header")],h.Header);var An=Object.defineProperty,xn=Object.getOwnPropertyDescriptor,De=(s,e,n,i)=>{for(var o=i>1?void 0:i?xn(e,n):e,t=s.length-1,c;t>=0;t--)(c=s[t])&&(o=(i?c(e,n,o):c(o))||o);return i&&o&&An(e,n,o),o};const Cn={display:"flex",alignItems:"center",backgroundColor:"black",color:"white",textAlign:"center"};let Se=class extends D{constructor(){super(...arguments),this.dismissable=!1,this.text="",this.bannerId="",this.headerStyle={},this._dismissed=!1,this.onDismiss=s=>{s.preventDefault(),s.stopPropagation();const e={bubbles:!0,composed:!0};this._dismissed=!0;let{bannerId:n,text:i,headerStyle:o,dismissable:t}=this;this.dispatchEvent(new CustomEvent("bannerDismissed",{detail:{bannerId:n,text:i,headerStyle:o,dismissable:t},...e}))}}render(){if(!this._dismissed)return S`
|
|
488
|
+
<header style=${Zt({...Cn,...this.headerStyle})}>
|
|
485
489
|
<div style="flex-grow:1"><slot name="text">${this.text}</slot><slot></slot></div>
|
|
486
|
-
${this.dismissable?
|
|
490
|
+
${this.dismissable?S`<spectric-button size="small" @click=${this.onDismiss}>X</spectric-button>`:null}
|
|
487
491
|
</header>
|
|
488
|
-
`}};
|
|
492
|
+
`}};De([b({type:Boolean,reflect:!0})],Se.prototype,"dismissable",2),De([b({type:String,reflect:!0})],Se.prototype,"text",2),De([b({type:String,reflect:!0})],Se.prototype,"bannerId",2),De([b({type:Object})],Se.prototype,"headerStyle",2),De([b({state:!0,type:Boolean,attribute:!1})],Se.prototype,"_dismissed",2),Se=De([O("spectric-banner")],Se);const En=I`
|
|
489
493
|
|
|
490
494
|
:host {
|
|
491
495
|
height:100vh;
|
|
@@ -645,30 +649,30 @@ article{
|
|
|
645
649
|
* @license
|
|
646
650
|
* Copyright 2018 Google LLC
|
|
647
651
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
648
|
-
*/const
|
|
652
|
+
*/const nr=s=>s??P;class or extends bi{constructor(){super(...arguments),this.prevData={}}render(e){return P}update(e,[n]){var i;this.element!==e.element&&(this.element=e.element),this.host=((i=e.options)==null?void 0:i.host)||this.element,this.apply(n),this.groom(n),this.prevData={...n}}apply(e){if(!e)return;const{element:n}=this;for(const i in e){const o=e[i];n[i]!==o&&(n[i]=o)}}groom(e){const{prevData:n,element:i}=this;if(n)for(const o in n)(!e||!(o in e)&&i[o]===n[o])&&(i[o]=void 0)}}const Ae=Je(or);var ar=(s=>(s.None="none",s.Uscui="us.cui",s.Usclassified="us.classified",s.Usunclassified="us.unclassified",s.Usconfidential="us.confidential",s.Ussecret="us.secret",s.Ustopsecret="us.topsecret",s.UstopsecretSi="us.topsecret.si",s.Uknotset="uk.notset",s.Ukofficial="uk.official",s.Uksecret="uk.secret",s.Uktopsecret="uk.topsecret",s.Caprotected_a="ca.protected_a",s.Caprotected_b="ca.protected_b",s.Caprotected_c="ca.protected_c",s.Caconfidential="ca.confidential",s.Casecret="ca.secret",s.Catopsecret="ca.topsecret",s.Auunofficial="au.unofficial",s.Auofficial="au.official",s.Auofficialsensitive="au.officialsensitive",s.Auconfidential="au.confidential",s.Ausecret="au.secret",s.Autopsecret="au.topsecret",s))(ar||{});const yt={none:{},"us.cui":{color:"white",backgroundColor:"#3D1E5A",content:"Controlled Unclassified Information"},"us.classified":{color:"white",backgroundColor:"#723D9A",content:"Classified"},"us.unclassified":{color:"white",backgroundColor:"#007A33",content:"Unclassified"},"us.confidential":{color:"white",backgroundColor:"#0033A0",content:"Confidential"},"us.secret":{color:"white",backgroundColor:"#C8102E",content:"Secret"},"us.topsecret":{color:"white",backgroundColor:"#FF671F",content:"Top Secret"},"us.topsecret.si":{color:"black",backgroundColor:"#F7EA48",content:"Top Secret//SI"},"uk.notset":{color:"white",backgroundColor:" #616161",content:"Not Set"},"uk.official":{color:"white",backgroundColor:"#2B71C7",content:"For Offical Use"},"uk.secret":{color:"white",backgroundColor:"#F39C2C",content:"Secret"},"uk.topsecret":{color:"white",backgroundColor:"#AA0000",content:"Top Secret"},"ca.protected_a":{color:"white",backgroundColor:"#227ABC",content:"PROTECTED A"},"ca.protected_b":{color:"white",backgroundColor:"#900FB5",content:"PROTECTED B"},"ca.protected_c":{color:"white",backgroundColor:"#460FB5",content:"PROTECTED C"},"ca.confidential":{color:"white",backgroundColor:"#0033a0",content:"Confidential"},"ca.secret":{color:"white",backgroundColor:"#c8102e",content:"Secret"},"ca.topsecret":{color:"white",backgroundColor:"#ff671f",content:"Top Secret"},"au.unofficial":{color:"#666",backgroundColor:"#ffffffff",content:"Unofficial"},"au.official":{color:"#666",backgroundColor:"#ffffffff",content:"Official"},"au.officialsensitive":{color:"#666",backgroundColor:"#ffffffff",content:"Official Sentitive"},"au.confidential":{color:"white",backgroundColor:"#4F81BD",content:"Confidential"},"au.secret":{color:"black",backgroundColor:" #E5B8B7",content:"Secret"},"au.topsecret":{color:"black",backgroundColor:"#AA0000",content:"Top Secret"}};var kn=Object.defineProperty,Pn=Object.getOwnPropertyDescriptor,Y=(s,e,n,i)=>{for(var o=i>1?void 0:i?Pn(e,n):e,t=s.length-1,c;t>=0;t--)(c=s[t])&&(o=(i?c(e,n,o):c(o))||o);return i&&o&&kn(e,n,o),o};h.SpectricPage=class extends D{constructor(){super(...arguments),this.showHeader=!0,this.headerSticky=!0,this.classificationLevel=ar.None,this.classificationText="",this.notifications=[],this.showCreateAccount=!1,this.showLoginButton=!0,this.username=""}render(){this.classificationLevel&&!yt[this.classificationLevel]&&(console.warn("Unknown classification",this.classificationLevel),this.classificationLevel=ar.None);const e=this.classificationLevel?this.classificationText||yt[this.classificationLevel].content:"",n=this.showHeader?S`<spectric-header ?showCreateAccount=${this.showCreateAccount} .showLoginButton=${this.showLoginButton} username=${nr(this.username)}>
|
|
649
653
|
<slot name="branding" slot="branding"></slot>
|
|
650
654
|
<slot name="name" slot="name"></slot>
|
|
651
655
|
<slot name="center" slot="center"></slot>
|
|
652
656
|
<slot name="end" slot="end"></slot>
|
|
653
|
-
</spectric-header>`:null;return
|
|
654
|
-
${this.classificationLevel&&
|
|
657
|
+
</spectric-header>`:null;return S`
|
|
658
|
+
${this.classificationLevel&&e?S`
|
|
655
659
|
<!-- Classification Banner -->
|
|
656
|
-
<spectric-banner ${
|
|
660
|
+
<spectric-banner ${Ae({text:e,headerStyle:yt[this.classificationLevel]})}></spectric-banner>
|
|
657
661
|
`:null}
|
|
658
|
-
<spectric-theme theme=${
|
|
659
|
-
${this.notifications?this.notifications.map(i=>
|
|
660
|
-
${this.headerSticky?
|
|
662
|
+
<spectric-theme theme=${nr(this.theme)}>
|
|
663
|
+
${this.notifications?this.notifications.map(i=>S`<spectric-banner ${Ae(i)} ></spectric-banner>`):null}
|
|
664
|
+
${this.headerSticky?n:null}
|
|
661
665
|
<article>
|
|
662
|
-
${this.headerSticky?null:
|
|
666
|
+
${this.headerSticky?null:n}
|
|
663
667
|
<section class="spectric-page">
|
|
664
668
|
<slot name="content"></slot>
|
|
665
669
|
<slot></slot>
|
|
666
670
|
</section>
|
|
667
671
|
</article>
|
|
668
672
|
</spectric-theme>
|
|
669
|
-
${this.classificationLevel&&
|
|
673
|
+
${this.classificationLevel&&e?S`<spectric-banner ${Ae({text:e,headerStyle:yt[this.classificationLevel]})}></spectric-banner>`:null}
|
|
670
674
|
|
|
671
|
-
`}},
|
|
675
|
+
`}},h.SpectricPage.styles=En,Y([b({type:Boolean,reflect:!0})],h.SpectricPage.prototype,"showHeader",2),Y([b({type:Boolean,reflect:!0})],h.SpectricPage.prototype,"headerSticky",2),Y([b({type:String,reflect:!0})],h.SpectricPage.prototype,"classificationLevel",2),Y([b({type:String,reflect:!0})],h.SpectricPage.prototype,"classificationText",2),Y([b({type:Array,reflect:!0})],h.SpectricPage.prototype,"notifications",2),Y([b({type:Boolean,reflect:!0})],h.SpectricPage.prototype,"showCreateAccount",2),Y([b({type:Boolean,reflect:!0})],h.SpectricPage.prototype,"showLoginButton",2),Y([b({type:String,reflect:!0})],h.SpectricPage.prototype,"username",2),Y([b({type:String,reflect:!0})],h.SpectricPage.prototype,"theme",2),h.SpectricPage=Y([O("spectric-page")],h.SpectricPage);var Tn=Object.defineProperty,On=Object.getOwnPropertyDescriptor,T=(s,e,n,i)=>{for(var o=i>1?void 0:i?On(e,n):e,t=s.length-1,c;t>=0;t--)(c=s[t])&&(o=(i?c(e,n,o):c(o))||o);return i&&o&&Tn(e,n,o),o},lr=(s=>(s.Text="text",s.TextArea="text-area",s.number="number",s.color="color",s.date="date",s.datetime="datetime-local",s.email="email",s.file="file",s.hidden="hidden",s.password="password",s.checkbox="checkbox",s.range="range",s))(lr||{});h.SpectricInput=class extends D{constructor(){super(...arguments),this.placeholder="",this.readonly=!1,this.variant="text",this.disabled=!1,this.label="",this.hidePasswordLabel="Hide",this.showPasswordLabel="Show",this.showPasswordVisibilityToggle=!0,this.helperText="",this.invalid=!1,this.required=!1,this.invalidText="",this.name="",this.pattern="",this.maxCount=0,this._value="",this._showPassword=!1,this.autocomplete="off",this._handleInput=({target:e})=>{const n=e;this.value=n.value,this.invalid=!n.validity.valid},this.handleTogglePasswordVisibility=()=>{this._showPassword=!this._showPassword,this.requestUpdate()}}createRenderRoot(){return this}get selectionStart(){return this._input?this._input.selectionStart:null}get value(){return this._input?this.variant=="number"?parseFloat(this._input.value):this._input.value:this._value}set value(e){const n=this._value;this._value=e,this.requestUpdate("value",n),this._input&&(this._input.value=String(e))}blur(){this._input&&this._input.blur()}focus(e){this._input&&(this._input.blur(),this._input.focus(e))}setSelectionRange(e,n,i="none"){this._input&&this._input.setSelectionRange(e,n,i)}updated(e){e.has("checked")&&this.dispatchEvent(new Event("change",{bubbles:!0}))}_handleChange(e){e.stopPropagation(),this.dispatchEvent(new Event("change",{bubbles:!0}))}render(){switch(this.variant){case"text":case"password":case"number":case"email":case"date":case"datetime-local":case"file":case"range":return S`
|
|
672
676
|
<div class="inputWrapper">
|
|
673
677
|
<div class="text-input__label-helper-wrapper">
|
|
674
678
|
<div class="--text-input__label-wrapper">
|
|
@@ -682,20 +686,20 @@ article{
|
|
|
682
686
|
?disabled="${this.disabled}"
|
|
683
687
|
aria-describedby="helper-text"
|
|
684
688
|
id="input"
|
|
685
|
-
name="${
|
|
686
|
-
pattern="${
|
|
687
|
-
placeholder="${
|
|
688
|
-
autocomplete="${
|
|
689
|
+
name="${Le(this.name)}"
|
|
690
|
+
pattern="${Le(this.pattern)}"
|
|
691
|
+
placeholder="${Le(this.placeholder)}"
|
|
692
|
+
autocomplete="${Le(this.autocomplete)}"
|
|
689
693
|
?readonly="${this.readonly}"
|
|
690
694
|
?required="${this.required}"
|
|
691
|
-
type="${
|
|
695
|
+
type="${Le(this.variant!=="password"?this.variant:this._showPassword?"text":"password")}"
|
|
692
696
|
.value="${this._value}"
|
|
693
|
-
maxlength="${
|
|
697
|
+
maxlength="${Le(this.maxCount>0?this.maxCount:void 0)}"
|
|
694
698
|
@input="${this._handleInput}"
|
|
695
|
-
@change=${
|
|
699
|
+
@change=${this._handleChange}
|
|
696
700
|
/>
|
|
697
701
|
|
|
698
|
-
${this.variant==="password"&&this.showPasswordVisibilityToggle?
|
|
702
|
+
${this.variant==="password"&&this.showPasswordVisibilityToggle?S`
|
|
699
703
|
<spectric-button
|
|
700
704
|
size="small"
|
|
701
705
|
type="button"
|
|
@@ -707,24 +711,43 @@ article{
|
|
|
707
711
|
</div>
|
|
708
712
|
<div
|
|
709
713
|
id="helper-text"
|
|
714
|
+
class="${this.helperText||this.invalid?"":"hidden"}"
|
|
710
715
|
>
|
|
711
716
|
<slot name="helper-text"> ${this.invalid?this.invalidText:this.helperText} </slot>
|
|
712
717
|
</div>
|
|
713
718
|
|
|
714
719
|
</div>
|
|
715
720
|
</div>
|
|
716
|
-
`;case"
|
|
721
|
+
`;case"color":return S`<div class="inputWrapper">
|
|
722
|
+
<div class="text-input__label-helper-wrapper">
|
|
723
|
+
<div class="--text-input__label-wrapper">
|
|
724
|
+
${this.label} ${this.maxCount>0&&this._value?`${this._value.length}/${this.maxCount}`:null}
|
|
725
|
+
</div>
|
|
726
|
+
</div>
|
|
727
|
+
<div class="fieldwrapper">
|
|
728
|
+
<div ?data-invalid="${this.invalid}" class="inputContainer">
|
|
729
|
+
<spectric-colorpicker @change=${e=>{this.value=e.target.value,this._handleChange(e)}}></spectric-colorpicker>
|
|
730
|
+
</div>
|
|
731
|
+
<div
|
|
732
|
+
id="helper-text"
|
|
733
|
+
class="${this.helperText||this.invalid?"":"hidden"}"
|
|
734
|
+
>
|
|
735
|
+
<slot name="helper-text"> ${this.invalid?this.invalidText:this.helperText} </slot>
|
|
736
|
+
</div>
|
|
737
|
+
|
|
738
|
+
</div>
|
|
739
|
+
</div>`;case"hidden":return S`<input type="hidden"/>`;case"checkbox":return S`
|
|
717
740
|
<div class="checkbox">
|
|
718
741
|
<spectric-button @click=${()=>{this.checked=!this.checked,this.value=!!this.checked}} icon size=${this.size||"xxsmall"} variant=${this.checked?"primary":"secondary"}>${this.checked?"✓":" "}</spectric-button>
|
|
719
|
-
${this.invalid||this.helperText?
|
|
742
|
+
${this.invalid||this.helperText?S`<spectric-tooltip text=${this.invalid||this.helperText}></spectric-tooltip>`:null}
|
|
720
743
|
${this.label}
|
|
721
744
|
</div>
|
|
722
745
|
</label>
|
|
723
|
-
`}return`Not yet implemented ${this.variant}`}},T([
|
|
724
|
-
`);super(
|
|
725
|
-
`},
|
|
726
|
-
`?(a.seenCR||a.line++,a.column=1,a.seenCR=!1):u==="\r"||u==="\u2028"||u==="\u2029"?(a.line++,a.column=1,a.seenCR=!0):(a.column++,a.seenCR=!1),l++;return _t[r]=a,a}function At(r,a){var l=ls(r),u=ls(a);return{start:{offset:r,line:l.line,column:l.column},end:{offset:a,line:u.line,column:u.column}}}function m(r){c<K||(c>K&&(K=c,fr=[]),fr.push(r))}function ps(r,a,l,u){function b(L){var B=1;for(L.sort(function(le,Q){return le.description<Q.description?-1:le.description>Q.description?1:0});B<L.length;)L[B-1]===L[B]?L.splice(B,1):B++}function _(L,B){function le(Fc){function Ot(ee){return ee.charCodeAt(0).toString(16).toUpperCase()}return Fc.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E\x0F]/g,function(ee){return"\\x0"+Ot(ee)}).replace(/[\x10-\x1F\x80-\xFF]/g,function(ee){return"\\x"+Ot(ee)}).replace(/[\u0100-\u0FFF]/g,function(ee){return"\\u0"+Ot(ee)}).replace(/[\u1000-\uFFFF]/g,function(ee){return"\\u"+Ot(ee)})}var Q=new Array(L.length),ks,Ps,it;for(it=0;it<L.length;it++)Q[it]=L[it].description;return ks=L.length>1?Q.slice(0,-1).join(", ")+" or "+Q[L.length-1]:Q[0],Ps=B?'"'+le(B)+'"':"end of input","Expected "+ks+" but "+Ps+" found."}return a!==null&&b(a),new t(r!==null?r:_(a,l),a,l,u)}function us(){var r,a,l,u;for(r=c,a=[],l=w();l!==e;)a.push(l),l=w();return a!==e?(l=xt(),l===e&&(l=null),l!==e?(u=Pt(),u!==e?(S=r,a=g(l,u),r=a):(c=r,r=e)):(c=r,r=e)):(c=r,r=e),r}function xt(){var r,a,l,u;return r=c,S=c,a=$(),a?a=void 0:a=e,a!==e?(l=Ac(),l!==e?(a=[a,l],r=a):(c=r,r=e)):(c=r,r=e),r===e&&(r=c,a=gr(),a!==e?(l=Et(),l!==e?(u=xt(),u!==e?(S=r,a=C(a,u),r=a):(c=r,r=e)):(c=r,r=e)):(c=r,r=e),r===e&&(r=gr())),r}function gr(){var r,a,l,u;return r=c,a=ds(),a!==e?(l=Ct(),l!==e?(u=gr(),u!==e?(S=r,a=y(a,u),r=a):(c=r,r=e)):(c=r,r=e)):(c=r,r=e),r===e&&(r=ds()),r}function ds(){var r,a,l;return r=c,a=yr(),a!==e?(l=hs(),l!==e?(S=r,a=E(l),r=a):(c=r,r=e)):(c=r,r=e),r===e&&(r=hs()),r}function hs(){var r,a,l,u,b,_;if(r=c,i.charCodeAt(c)===40?(a=x,c++):(a=e,f===0&&m(k)),a!==e){for(l=[],u=w();u!==e;)l.push(u),u=w();l!==e?(u=xt(),u!==e?(b=Pt(),b!==e?(i.charCodeAt(c)===41?(_=N,c++):(_=e,f===0&&m(z)),_!==e?(S=r,a=M(u,b),r=a):(c=r,r=e)):(c=r,r=e)):(c=r,r=e)):(c=r,r=e)}else c=r,r=e;return r===e&&(r=gc()),r}function gc(){var r,a,l,u,b,_,L,B,le,Q;if(r=c,a=br(),a!==e){for(l=[],u=w();u!==e;)l.push(u),u=w();if(l!==e)if(i.charCodeAt(c)===58?(u=Y,c++):(u=e,f===0&&m(U)),u!==e){for(b=[],_=w();_!==e;)b.push(_),_=w();if(b!==e)if(i.charCodeAt(c)===123?(_=Oe,c++):(_=e,f===0&&m(nr)),_!==e){for(L=[],B=w();B!==e;)L.push(B),B=w();L!==e?(B=xt(),B!==e?(le=Pt(),le!==e?(i.charCodeAt(c)===125?(Q=ar,c++):(Q=e,f===0&&m(cr)),Q!==e?(S=r,a=la(a,B,le),r=a):(c=r,r=e)):(c=r,r=e)):(c=r,r=e)):(c=r,r=e)}else c=r,r=e;else c=r,r=e}else c=r,r=e;else c=r,r=e}else c=r,r=e;return r===e&&(r=bc()),r}function bc(){var r;return r=vc(),r===e&&(r=mc(),r===e&&(r=yc())),r}function br(){var r;return f++,r=$r(),f--,r===e&&f===0&&m(pa),r}function vc(){var r,a,l,u,b,_;if(r=c,a=br(),a!==e){for(l=[],u=w();u!==e;)l.push(u),u=w();if(l!==e)if(u=ys(),u!==e){for(b=[],_=w();_!==e;)b.push(_),_=w();b!==e?(_=$r(),_!==e?(S=r,a=ua(a,u,_),r=a):(c=r,r=e)):(c=r,r=e)}else c=r,r=e;else c=r,r=e}else c=r,r=e;return r}function mc(){var r,a,l,u,b,_;if(r=c,a=br(),a!==e){for(l=[],u=w();u!==e;)l.push(u),u=w();if(l!==e)if(i.charCodeAt(c)===58?(u=Y,c++):(u=e,f===0&&m(U)),u!==e){for(b=[],_=w();_!==e;)b.push(_),_=w();b!==e?(_=vr(),_!==e?(S=r,a=da(a,_),r=a):(c=r,r=e)):(c=r,r=e)}else c=r,r=e;else c=r,r=e}else c=r,r=e;return r}function yc(){var r,a;return r=c,a=bs(),a!==e&&(S=r,a=ha(a)),r=a,r}function vr(){var r,a,l,u,b,_;if(r=c,i.charCodeAt(c)===40?(a=x,c++):(a=e,f===0&&m(k)),a!==e){for(l=[],u=w();u!==e;)l.push(u),u=w();l!==e?(u=fs(),u!==e?(b=Pt(),b!==e?(i.charCodeAt(c)===41?(_=N,c++):(_=e,f===0&&m(z)),_!==e?(S=r,a=fa(u,b),r=a):(c=r,r=e)):(c=r,r=e)):(c=r,r=e)):(c=r,r=e)}else c=r,r=e;return r===e&&(r=bs()),r}function fs(){var r,a,l,u;return r=c,a=mr(),a!==e?(l=Et(),l!==e?(u=fs(),u!==e?(S=r,a=ga(a,u),r=a):(c=r,r=e)):(c=r,r=e)):(c=r,r=e),r===e&&(r=mr()),r}function mr(){var r,a,l,u;return r=c,a=gs(),a!==e?(l=Ct(),l!==e?(u=mr(),u!==e?(S=r,a=ba(a,u),r=a):(c=r,r=e)):(c=r,r=e)):(c=r,r=e),r===e&&(r=gs()),r}function gs(){var r,a,l;return r=c,a=yr(),a!==e?(l=vr(),l!==e?(S=r,a=va(l),r=a):(c=r,r=e)):(c=r,r=e),r===e&&(r=vr()),r}function bs(){var r,a;return f++,r=c,a=kt(),a!==e&&(S=r,a=ya(a)),r=a,r===e&&(r=c,a=vs(),a!==e&&(S=r,a=$a(a)),r=a),f--,r===e&&(a=e,f===0&&m(ma)),r}function Et(){var r,a,l,u,b;if(f++,r=c,a=[],l=w(),l!==e)for(;l!==e;)a.push(l),l=w();else a=e;if(a!==e)if(i.substr(c,2).toLowerCase()===Si?(l=i.substr(c,2),c+=2):(l=e,f===0&&m(Ai)),l!==e){if(u=[],b=w(),b!==e)for(;b!==e;)u.push(b),b=w();else u=e;u!==e?(a=[a,l,u],r=a):(c=r,r=e)}else c=r,r=e;else c=r,r=e;return r===e&&(r=c,S=c,a=$(),a?a=void 0:a=e,a!==e?(l=$s(),l!==e?(a=[a,l],r=a):(c=r,r=e)):(c=r,r=e)),f--,r===e&&(a=e,f===0&&m(wa)),r}function Ct(){var r,a,l,u,b;if(f++,r=c,a=[],l=w(),l!==e)for(;l!==e;)a.push(l),l=w();else a=e;if(a!==e)if(i.substr(c,3).toLowerCase()===xi?(l=i.substr(c,3),c+=3):(l=e,f===0&&m(Ei)),l!==e){if(u=[],b=w(),b!==e)for(;b!==e;)u.push(b),b=w();else u=e;u!==e?(a=[a,l,u],r=a):(c=r,r=e)}else c=r,r=e;else c=r,r=e;return r===e&&(r=c,S=c,a=$(),a?a=void 0:a=e,a!==e?(l=ws(),l!==e?(a=[a,l],r=a):(c=r,r=e)):(c=r,r=e)),f--,r===e&&(a=e,f===0&&m(_a)),r}function yr(){var r,a,l,u;if(f++,r=c,i.substr(c,3).toLowerCase()===Ci?(a=i.substr(c,3),c+=3):(a=e,f===0&&m(ki)),a!==e){if(l=[],u=w(),u!==e)for(;u!==e;)l.push(u),u=w();else l=e;l!==e?(a=[a,l],r=a):(c=r,r=e)}else c=r,r=e;return r===e&&(r=c,S=c,a=$(),a?a=void 0:a=e,a!==e?(l=_s(),l!==e?(a=[a,l],r=a):(c=r,r=e)):(c=r,r=e)),f--,r===e&&(a=e,f===0&&m(Sa)),r}function $r(){var r;return f++,r=kt(),r===e&&(r=vs()),f--,r===e&&f===0&&m(Aa),r}function kt(){var r,a,l,u,b,_;if(r=c,i.charCodeAt(c)===34?(a=Ge,c++):(a=e,f===0&&m(Je)),a!==e){for(l=[],u=Ne();u!==e;)l.push(u),u=Ne();if(l!==e)if(u=rt(),u!==e){for(b=[],_=Ne();_!==e;)b.push(_),_=Ne();b!==e?(i.charCodeAt(c)===34?(_=Ge,c++):(_=e,f===0&&m(Je)),_!==e?(S=r,a=lr(l,u,b),r=a):(c=r,r=e)):(c=r,r=e)}else c=r,r=e;else c=r,r=e}else c=r,r=e;if(r===e)if(r=c,i.charCodeAt(c)===34?(a=Ge,c++):(a=e,f===0&&m(Je)),a!==e){for(l=[],u=Ne();u!==e;)l.push(u),u=Ne();l!==e?(i.charCodeAt(c)===34?(u=Ge,c++):(u=e,f===0&&m(Je)),u!==e?(S=r,a=xa(l),r=a):(c=r,r=e)):(c=r,r=e)}else c=r,r=e;return r}function Ne(){var r,a,l;return r=wr(),r===e&&(r=c,i.charCodeAt(c)===92?(a=et,c++):(a=e,f===0&&m(tt)),a!==e?(Ea.test(i.charAt(c))?(l=i.charAt(c),c++):(l=e,f===0&&m(Ca)),l!==e?(S=r,a=yt(l),r=a):(c=r,r=e)):(c=r,r=e),r===e&&(r=c,a=c,f++,l=rt(),f--,l===e?a=void 0:(c=a,a=e),a!==e?(ka.test(i.charAt(c))?(l=i.charAt(c),c++):(l=e,f===0&&m(Pa)),l!==e?(S=r,a=yt(l),r=a):(c=r,r=e)):(c=r,r=e))),r}function vs(){var r,a,l,u,b;for(r=c,a=[],l=Be();l!==e;)a.push(l),l=Be();if(a!==e)if(l=rt(),l!==e){for(u=[],b=Be();b!==e;)u.push(b),b=Be();u!==e?(S=r,a=lr(a,l,u),r=a):(c=r,r=e)}else c=r,r=e;else c=r,r=e;if(r===e){if(r=c,a=[],l=Be(),l!==e)for(;l!==e;)a.push(l),l=Be();else a=e;a!==e&&(S=r,a=Ta(a)),r=a}return r}function Be(){var r,a,l,u,b;return r=wr(),r===e&&(r=wc(),r===e&&(r=_c(),r===e&&(r=$c(),r===e&&(r=c,a=c,f++,l=ms(),f--,l===e?a=void 0:(c=a,a=e),a!==e?(l=c,f++,u=Sc(),f--,u===e?l=void 0:(c=l,l=e),l!==e?(u=c,f++,b=rt(),f--,b===e?u=void 0:(c=u,u=e),u!==e?(i.length>c?(b=i.charAt(c),c++):(b=e,f===0&&m(Pi)),b!==e?(S=r,a=yt(b),r=a):(c=r,r=e)):(c=r,r=e)):(c=r,r=e)):(c=r,r=e))))),r}function $c(){var r,a;return r=c,i.charCodeAt(c)===42?(a=$t,c++):(a=e,f===0&&m(wt)),a!==e&&(S=r,a=Oa()),r=a,r}function Pt(){var r,a,l,u,b;for(r=c,a=[],l=w();l!==e;)a.push(l),l=w();if(a!==e)if(l=rt(),l!==e){for(u=[],b=w();b!==e;)u.push(b),b=w();u!==e?(S=r,a=lr(a,l,u),r=a):(c=r,r=e)}else c=r,r=e;else c=r,r=e;if(r===e)for(r=[],a=w();a!==e;)r.push(a),a=w();return r}function wr(){var r,a;return r=c,i.substr(c,2)===Ti?(a=Ti,c+=2):(a=e,f===0&&m(Da)),a!==e&&(S=r,a=La()),r=a,r===e&&(r=c,i.substr(c,2)===Oi?(a=Oi,c+=2):(a=e,f===0&&m(Na)),a!==e&&(S=r,a=Ba()),r=a,r===e&&(r=c,i.substr(c,2)===Di?(a=Di,c+=2):(a=e,f===0&&m(ja)),a!==e&&(S=r,a=za()),r=a)),r}function wc(){var r,a,l;return r=c,i.charCodeAt(c)===92?(a=et,c++):(a=e,f===0&&m(tt)),a!==e?(l=ms(),l!==e?(S=r,a=yt(l),r=a):(c=r,r=e)):(c=r,r=e),r}function _c(){var r,a,l;return r=c,i.charCodeAt(c)===92?(a=et,c++):(a=e,f===0&&m(tt)),a!==e?(i.substr(c,2).toLowerCase()===Si?(l=i.substr(c,2),c+=2):(l=e,f===0&&m(Ai)),l===e&&(i.substr(c,3).toLowerCase()===xi?(l=i.substr(c,3),c+=3):(l=e,f===0&&m(Ei)),l===e&&(i.substr(c,3).toLowerCase()===Ci?(l=i.substr(c,3),c+=3):(l=e,f===0&&m(ki)))),l!==e?(S=r,a=Ra(l),r=a):(c=r,r=e)):(c=r,r=e),r}function Sc(){var r;return r=Et(),r===e&&(r=Ct(),r===e&&(r=yr())),r}function ms(){var r;return Ma.test(i.charAt(c))?(r=i.charAt(c),c++):(r=e,f===0&&m(Ia)),r}function ys(){var r,a;return r=c,i.substr(c,2)===Li?(a=Li,c+=2):(a=e,f===0&&m(Ua)),a!==e&&(S=r,a=Fa()),r=a,r===e&&(r=c,i.substr(c,2)===Ni?(a=Ni,c+=2):(a=e,f===0&&m(Ha)),a!==e&&(S=r,a=Qa()),r=a,r===e&&(r=c,i.charCodeAt(c)===60?(a=Bi,c++):(a=e,f===0&&m(ji)),a!==e&&(S=r,a=qa()),r=a,r===e&&(r=c,i.charCodeAt(c)===62?(a=zi,c++):(a=e,f===0&&m(Ri)),a!==e&&(S=r,a=Wa()),r=a))),r}function w(){var r;return f++,Ya.test(i.charAt(c))?(r=i.charAt(c),c++):(r=e,f===0&&m(Ka)),f--,r===e&&f===0&&m(Va),r}function rt(){var r,a,l;return r=c,S=c,a=Za(),a?a=void 0:a=e,a!==e?(i.substr(c,14)===Mi?(l=Mi,c+=14):(l=e,f===0&&m(Xa)),l!==e?(S=r,a=Ga(),r=a):(c=r,r=e)):(c=r,r=e),r}function $s(){var r,a,l,u,b;for(r=c,a=[],l=w();l!==e;)a.push(l),l=w();if(a!==e)if(i.substr(c,2)===Ii?(l=Ii,c+=2):(l=e,f===0&&m(Ja)),l!==e){for(u=[],b=w();b!==e;)u.push(b),b=w();u!==e?(S=r,a=ec(),r=a):(c=r,r=e)}else c=r,r=e;else c=r,r=e;return r}function ws(){var r,a,l,u,b;for(r=c,a=[],l=w();l!==e;)a.push(l),l=w();if(a!==e)if(i.substr(c,2)===Ui?(l=Ui,c+=2):(l=e,f===0&&m(tc)),l!==e){for(u=[],b=w();b!==e;)u.push(b),b=w();u!==e?(S=r,a=Fi(),r=a):(c=r,r=e)}else c=r,r=e;else c=r,r=e;return r===e&&(r=c,i.charCodeAt(c)===43?(a=Hi,c++):(a=e,f===0&&m(Qi)),a!==e&&(S=r,a=Fi()),r=a),r}function _s(){var r,a;return r=c,i.charCodeAt(c)===45?(a=qi,c++):(a=e,f===0&&m(Wi)),a!==e&&(S=r,a=Vi()),r=a,r===e&&(r=c,i.charCodeAt(c)===33?(a=Yi,c++):(a=e,f===0&&m(Ki)),a!==e&&(S=r,a=Vi()),r=a),r}function Ac(){var r;return r=xc(),r===e&&(r=Ss(),r===e&&(r=Ec())),r}function xc(){var r,a,l,u,b,_;if(r=c,a=je(),a!==e){for(l=[],u=w();u!==e;)l.push(u),u=w();if(l!==e)if(i.charCodeAt(c)===58?(u=Y,c++):(u=e,f===0&&m(U)),u!==e){for(b=[],_=w();_!==e;)b.push(_),_=w();b!==e?(_=Ss(),_!==e?(a=[a,l,u,b,_],r=a):(c=r,r=e)):(c=r,r=e)}else c=r,r=e;else c=r,r=e}else c=r,r=e;return r}function Ss(){var r;return r=Cc(),r===e&&(r=_r(),r===e&&(r=kc(),r===e&&(r=Pc(),r===e&&(r=Tc(),r===e&&(r=Oc()))))),r}function Ec(){var r,a,l,u,b,_;if(r=c,i.substr(c,8)===Zi?(a=Zi,c+=8):(a=e,f===0&&m(rc)),a!==e){for(l=[],u=w();u!==e;)l.push(u),u=w();if(l!==e)if(i.charCodeAt(c)===58?(u=Y,c++):(u=e,f===0&&m(U)),u!==e){for(b=[],_=w();_!==e;)b.push(_),_=w();b!==e?(_=je(),_!==e?(S=r,a=ic(),r=a):(c=r,r=e)):(c=r,r=e)}else c=r,r=e;else c=r,r=e}else c=r,r=e;return r}function Cc(){var r,a,l,u,b,_,L;if(r=c,a=ys(),a!==e){for(l=[],u=w();u!==e;)l.push(u),u=w();l!==e?(u=je(),u!==e?(S=r,a=Xi(),r=a):(c=r,r=e)):(c=r,r=e)}else c=r,r=e;if(r===e)if(r=c,a=Nc(),a!==e){for(l=[],u=w();u!==e;)l.push(u),u=w();l!==e?(u=je(),u!==e?(b=Es(),b!==e?(_=je(),_!==e?(L=Bc(),L!==e?(S=r,a=Xi(),r=a):(c=r,r=e)):(c=r,r=e)):(c=r,r=e)):(c=r,r=e)):(c=r,r=e)}else c=r,r=e;return r}function _r(){var r,a,l,u,b;for(r=c,a=[],l=Tt(),l===e&&(i.charCodeAt(c)===42?(l=$t,c++):(l=e,f===0&&m(wt)));l!==e;)a.push(l),l=Tt(),l===e&&(i.charCodeAt(c)===42?(l=$t,c++):(l=e,f===0&&m(wt)));if(a!==e)if(i.charCodeAt(c)===63?(l=Gi,c++):(l=e,f===0&&m(Ji)),l!==e){for(u=[],b=_r();b!==e;)u.push(b),b=_r();u!==e?(S=r,a=sc(),r=a):(c=r,r=e)}else c=r,r=e;else c=r,r=e;return r}function kc(){var r,a,l,u;if(r=c,i.charCodeAt(c)===47?(a=pr,c++):(a=e,f===0&&m(ur)),a!==e){for(l=[],es.test(i.charAt(c))?(u=i.charAt(c),c++):(u=e,f===0&&m(ts));u!==e;)l.push(u),es.test(i.charAt(c))?(u=i.charAt(c),c++):(u=e,f===0&&m(ts));l!==e?(i.charCodeAt(c)===47?(u=pr,c++):(u=e,f===0&&m(ur)),u!==e?(S=r,a=oc(),r=a):(c=r,r=e)):(c=r,r=e)}else c=r,r=e;return r}function Pc(){var r,a,l,u,b;if(r=c,a=As(),a!==e)if(i.charCodeAt(c)===126?(l=dr,c++):(l=e,f===0&&m(hr)),l!==e){for(u=[],De.test(i.charAt(c))?(b=i.charAt(c),c++):(b=e,f===0&&m(Le));b!==e;)u.push(b),De.test(i.charAt(c))?(b=i.charAt(c),c++):(b=e,f===0&&m(Le));u!==e?(S=r,a=nc(),r=a):(c=r,r=e)}else c=r,r=e;else c=r,r=e;return r}function Tc(){var r,a,l,u,b;if(r=c,a=kt(),a!==e)if(i.charCodeAt(c)===126?(l=dr,c++):(l=e,f===0&&m(hr)),l!==e){for(u=[],De.test(i.charAt(c))?(b=i.charAt(c),c++):(b=e,f===0&&m(Le));b!==e;)u.push(b),De.test(i.charAt(c))?(b=i.charAt(c),c++):(b=e,f===0&&m(Le));u!==e?(S=r,a=ac(),r=a):(c=r,r=e)}else c=r,r=e;else c=r,r=e;return r}function Oc(){var r,a,l,u,b;if(r=c,a=je(),a!==e)if(i.charCodeAt(c)===94?(l=rs,c++):(l=e,f===0&&m(is)),l!==e){for(u=[],De.test(i.charAt(c))?(b=i.charAt(c),c++):(b=e,f===0&&m(Le));b!==e;)u.push(b),De.test(i.charAt(c))?(b=i.charAt(c),c++):(b=e,f===0&&m(Le));u!==e?(S=r,a=cc(),r=a):(c=r,r=e)}else c=r,r=e;else c=r,r=e;return r}function je(){var r;return r=kt(),r===e&&(r=As()),r}function As(){var r,a;if(r=[],a=Tt(),a!==e)for(;a!==e;)r.push(a),a=Tt();else r=e;return r}function Tt(){var r,a,l,u;return r=wr(),r===e&&(r=Lc(),r===e&&(r=c,a=c,f++,l=xs(),f--,l===e?a=void 0:(c=a,a=e),a!==e?(l=c,f++,u=Dc(),f--,u===e?l=void 0:(c=l,l=e),l!==e?(i.length>c?(u=i.charAt(c),c++):(u=e,f===0&&m(Pi)),u!==e?(a=[a,l,u],r=a):(c=r,r=e)):(c=r,r=e)):(c=r,r=e))),r}function Dc(){var r;return r=Et(),r===e&&(r=Ct(),r===e&&(r=$s(),r===e&&(r=ws(),r===e&&(r=_s(),r===e&&(r=Es()))))),r}function Lc(){var r,a,l;return r=c,i.charCodeAt(c)===92?(a=et,c++):(a=e,f===0&&m(tt)),a!==e?(l=xs(),l!==e?(S=r,a=lc(),r=a):(c=r,r=e)):(c=r,r=e),r}function xs(){var r;return i.charCodeAt(c)===43?(r=Hi,c++):(r=e,f===0&&m(Qi)),r===e&&(i.charCodeAt(c)===45?(r=qi,c++):(r=e,f===0&&m(Wi)),r===e&&(i.charCodeAt(c)===61?(r=pc,c++):(r=e,f===0&&m(uc)),r===e&&(i.charCodeAt(c)===62?(r=zi,c++):(r=e,f===0&&m(Ri)),r===e&&(i.charCodeAt(c)===60?(r=Bi,c++):(r=e,f===0&&m(ji)),r===e&&(i.charCodeAt(c)===33?(r=Yi,c++):(r=e,f===0&&m(Ki)),r===e&&(i.charCodeAt(c)===40?(r=x,c++):(r=e,f===0&&m(k)),r===e&&(i.charCodeAt(c)===41?(r=N,c++):(r=e,f===0&&m(z)),r===e&&(i.charCodeAt(c)===123?(r=Oe,c++):(r=e,f===0&&m(nr)),r===e&&(i.charCodeAt(c)===125?(r=ar,c++):(r=e,f===0&&m(cr)),r===e&&(i.charCodeAt(c)===91?(r=ss,c++):(r=e,f===0&&m(os)),r===e&&(i.charCodeAt(c)===93?(r=ns,c++):(r=e,f===0&&m(as)),r===e&&(i.charCodeAt(c)===94?(r=rs,c++):(r=e,f===0&&m(is)),r===e&&(i.charCodeAt(c)===34?(r=Ge,c++):(r=e,f===0&&m(Je)),r===e&&(i.charCodeAt(c)===126?(r=dr,c++):(r=e,f===0&&m(hr)),r===e&&(i.charCodeAt(c)===42?(r=$t,c++):(r=e,f===0&&m(wt)),r===e&&(i.charCodeAt(c)===63?(r=Gi,c++):(r=e,f===0&&m(Ji)),r===e&&(i.charCodeAt(c)===58?(r=Y,c++):(r=e,f===0&&m(U)),r===e&&(i.charCodeAt(c)===92?(r=et,c++):(r=e,f===0&&m(tt)),r===e&&(i.charCodeAt(c)===47?(r=pr,c++):(r=e,f===0&&m(ur))))))))))))))))))))),r}function Es(){var r,a,l,u,b;if(r=c,a=[],l=w(),l!==e)for(;l!==e;)a.push(l),l=w();else a=e;if(a!==e)if(i.substr(c,2)===cs?(l=cs,c+=2):(l=e,f===0&&m(dc)),l!==e){if(u=[],b=w(),b!==e)for(;b!==e;)u.push(b),b=w();else u=e;u!==e?(a=[a,l,u],r=a):(c=r,r=e)}else c=r,r=e;else c=r,r=e;return r}function Nc(){var r;return i.charCodeAt(c)===91?(r=ss,c++):(r=e,f===0&&m(os)),r===e&&(i.charCodeAt(c)===123?(r=Oe,c++):(r=e,f===0&&m(nr))),r}function Bc(){var r;return i.charCodeAt(c)===93?(r=ns,c++):(r=e,f===0&&m(as)),r===e&&(i.charCodeAt(c)===125?(r=ar,c++):(r=e,f===0&&m(cr))),r}const{errorOnLuceneSyntax:jc,parseCursor:zc,cursorSymbol:Rc,allowLeadingWildcards:Mc=!0,helpers:{nodeTypes:we}}=n,Z=we.function.buildNodeWithArgumentNodes,ce=we.literal.buildNode,Ic=we.wildcard.buildNode,Uc=we.namedArg.buildNode,{wildcardSymbol:Cs}=we.wildcard;if(St=h(),St!==e&&c===i.length)return St;throw St!==e&&c<i.length&&m({type:"end",description:"end of input"}),ps(null,fr,K<i.length?i.charAt(K):null,K<i.length?At(K,K+1):At(K,K))}return{SyntaxError:t,parse:s}}(),Xt=(o,t={},s=gt)=>{if(typeof o>"u")throw new Error("expression must be a string, got undefined instead");return s(o,{...t,helpers:{nodeTypes:J}})},Ce=(o,t={})=>Xt(o,{...t,startRule:"Literal"},gt),bt=(o,t={})=>{try{return Xt(o,t,gt)}catch(s){throw s.name==="SyntaxError"?new ei(s,o):s}},Ao=o=>{try{return Xt(o,{errorOnLuceneSyntax:!0},gt),!1}catch(t){return t.message.startsWith("Lucene")}},j=(o,t,s,i)=>(t=void 0,!o||!o.type||!J[o.type]?j(J.function.buildNode("and",[]),t):J[o.type].toOpenSearchQuery(o,t,s,i)),G="@kuery-wildcard@";function xo(o){return o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Eo(o){return o.replace(/[+-=&|><!(){}[\]^"~*?:\\/]/g,"\\$&")}function Co(o){return o.includes(G)?{type:"wildcard",value:o}:Ce(o)}function ti(o,t){const{value:s}=o,i=s.split(G).map(xo).join("[\\s\\S]*");return new RegExp(`^${i}$`).test(t)}function ko(o){const{value:t}=o;return t.split(G).join("*")}function Gt(o){const{value:t}=o;return t.split(G).map(Eo).join("*")}function Po(o){const{value:t}=o;return t.startsWith(G)&&t.replace(G,"").length>0}const To=Object.freeze(Object.defineProperty({__proto__:null,buildNode:Co,hasLeadingWildcard:Po,test:ti,toOpenSearchQuery:ko,toQueryStringQuery:Gt,wildcardSymbol:G},Symbol.toStringTag,{value:"Module"}));function Jt(o,t){if(!t)return[];if(o.type==="literal"){const s=Zt(o),i=t.fields.find(n=>n.name===s);return i?[i]:[]}else if(o.type==="wildcard")return t.fields.filter(i=>ti(o,i.name))}function Qc(o){return o}function ri(o,t,s){const i={...o,value:s?`${s}.${o.value}`:o.value};if(!t||i.type==="wildcard"&&!s)return i;const e=Jt(i,t).reduce((p,h)=>{const g=h.subType&&h.subType.nested?h.subType.nested.path:void 0;return s&&!g?[...p,`${h.name} is not a nested field but is in nested group "${s}" in the DQL expression.`]:g&&!s?[...p,`${h.name} is a nested field, but is not in a nested group in the DQL expression.`]:g!==s?[...p,`Nested field ${h.name} is being queried with the incorrect nested path. The correct path is ${h.subType.nested.path}.`]:p},[]);if(e.length>0)throw new Error(e.join(`
|
|
727
|
-
`));return i}function
|
|
746
|
+
`}return`Not yet implemented ${this.variant}`}},T([b({type:Boolean,reflect:!0})],h.SpectricInput.prototype,"checked",2),T([b({type:String,reflect:!0})],h.SpectricInput.prototype,"placeholder",2),T([b({type:Boolean,reflect:!0})],h.SpectricInput.prototype,"readonly",2),T([b({type:String,reflect:!0})],h.SpectricInput.prototype,"variant",2),T([b({type:Boolean,reflect:!0})],h.SpectricInput.prototype,"disabled",2),T([b({type:String,reflect:!0})],h.SpectricInput.prototype,"label",2),T([b()],h.SpectricInput.prototype,"hidePasswordLabel",2),T([b()],h.SpectricInput.prototype,"showPasswordLabel",2),T([b({type:Boolean,reflect:!0})],h.SpectricInput.prototype,"showPasswordVisibilityToggle",2),T([b({type:String,reflect:!0})],h.SpectricInput.prototype,"helperText",2),T([b({type:Boolean,reflect:!0})],h.SpectricInput.prototype,"invalid",2),T([b({type:Boolean,reflect:!0})],h.SpectricInput.prototype,"required",2),T([b({type:String,reflect:!0})],h.SpectricInput.prototype,"invalidText",2),T([b()],h.SpectricInput.prototype,"name",2),T([b()],h.SpectricInput.prototype,"pattern",2),T([b({type:Number,reflect:!0})],h.SpectricInput.prototype,"maxCount",2),T([b({reflect:!0})],h.SpectricInput.prototype,"autocomplete",2),T([b({reflect:!0})],h.SpectricInput.prototype,"value",1),T([ye("input")],h.SpectricInput.prototype,"_input",2),T([nn({capture:!0})],h.SpectricInput.prototype,"_handleChange",1),h.SpectricInput=T([O("spectric-input")],h.SpectricInput);const Le=s=>nr(s===""?void 0:s??void 0),Dn="end of input",Ln={fieldName:"field name",value:"value",literal:"literal",whitespace:"whitespace"};class yi extends Error{constructor(e,n){let i=e.message;if(e.expected){const c=e.expected.map(f=>Ln[f.description]||f.description).join(", ");let d=e.found?`"${e.found}"`:Dn;i=`Expected ${c} but ${d} found.`}const o=[i,n,"-".repeat(e.location.start.offset)+"^"].join(`
|
|
747
|
+
`);super(o),this.name="DQLSyntaxError",this.shortMessage=i}}function Ne(s){return{type:"literal",value:s}}function cr(s){return s.value}const Nn=Object.freeze(Object.defineProperty({__proto__:null,buildNode:Ne,toOpenSearchQuery:cr},Symbol.toStringTag,{value:"Module"})),{SyntaxError:lc,parse:$t}=function(){function s(i,o){function t(){this.constructor=i}t.prototype=o.prototype,i.prototype=new t}function e(i,o,t,c){this.message=i,this.expected=o,this.found=t,this.location=c,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,e)}s(e,Error);function n(i){var o=arguments.length>1?arguments[1]:{},t={},c={start:Ss,Literal:Hr},d=Ss,f=function(r,a){return a.type==="cursor"?{...a,suggestionTypes:["conjunction"]}:r!==null?r:Pe.function.buildNode("is","*","*")},y=function(){return tc},x=function(r,a){const p=[r,a].find(u=>u.type==="cursor");return p||ee("or",[r,a])},$=function(r,a){const p=[r,a].find(u=>u.type==="cursor");return p||ee("and",[r,a])},E=function(r){return r.type==="cursor"?r:ee("not",[r])},C="(",k={type:"literal",value:"(",description:'"("'},N=")",R={type:"literal",value:")",description:'")"'},M=function(r,a){return a.type==="cursor"?{...a,suggestionTypes:["conjunction"]}:r},G=":",U={type:"literal",value:":",description:'":"'},Me="{",Er={type:"literal",value:"{",description:'"{"'},kr="}",Pr={type:"literal",value:"}",description:'"}"'},ka=function(r,a,p){return a.type==="cursor"?{...a,nestedPath:a.nestedPath?`${r.value}.${a.nestedPath}`:r.value}:p.type==="cursor"?{...p,suggestionTypes:["conjunction"]}:ee("nested",[r,a])},Pa={type:"other",description:"fieldName"},Ta=function(r,a,p){if(p.type==="cursor")return{...p,suggestionTypes:["conjunction"]};const u=oc(a,p);return ee("range",[r,u])},Oa=function(r,a){return a.type==="cursor"?{...a,fieldName:r.value,suggestionTypes:["value","conjunction"]}:a(r)},Da=function(r){if(r.type==="cursor"){const p=`${r.prefix}${r.suffix}`.trim();return{...r,fieldName:p,suggestionTypes:["field","operator","conjunction"]}}const a=de(null);return r(a)},La=function(r,a){return a.type==="cursor"?{...a,suggestionTypes:["conjunction"]}:r},Na=function(r,a){const p=[r,a].find(u=>u.type==="cursor");return p?{...p,suggestionTypes:["value"]}:u=>ee("or",[r(u),a(u)])},za=function(r,a){const p=[r,a].find(u=>u.type==="cursor");return p?{...p,suggestionTypes:["value"]}:u=>ee("and",[r(u),a(u)])},ja=function(r){return r.type==="cursor"?{...list,suggestionTypes:["value"]}:a=>ee("not",[r(a)])},Ba={type:"other",description:"value"},Ra=function(r){if(r.type==="cursor")return r;const a=de(!0);return p=>ee("is",[p,r,a])},Ma=function(r){if(r.type==="cursor")return r;!sc&&r.type==="wildcard"&&Pe.wildcard.hasLeadingWildcard(r)&&q("Leading wildcards are disabled. See query:allowLeadingWildcards in Advanced Settings.");const a=de(!1);return p=>ee("is",[p,r,a])},Ia={type:"other",description:"OR"},zi="or",ji={type:"literal",value:"or",description:'"or"'},Ha={type:"other",description:"AND"},Bi="and",Ri={type:"literal",value:"and",description:'"and"'},Ua={type:"other",description:"NOT"},Mi="not",Ii={type:"literal",value:"not",description:'"not"'},Fa={type:"other",description:"literal"},st='"',nt={type:"literal",value:'"',description:'"\\""'},Tr=function(r,a,p){const{start:u,end:v}=Ll();return{type:"cursor",start:u.offset,end:v.offset-a.length,prefix:r.join(""),suffix:p.join(""),text:Dl().replace(a,"")}},Qa=function(r){return de(r.join(""))},ot="\\",at={type:"literal",value:"\\",description:'"\\\\"'},qa=/^[\\"]/,Wa={type:"class",value:'[\\\\"]',description:'[\\\\"]'},Ct=function(r){return r},Va=/^[^"]/,Ya={type:"class",value:'[^"]',description:'[^"]'},Ka=function(r){const a=r.join("").trim();return a==="null"?de(null):a==="true"?de(!0):a==="false"?de(!1):r.includes(Ms)?nc(a):de(/^(-?[1-9]+\d*([.]\d+)?)$|^(-?0[.]\d*[1-9]+)$|^0$|^0.0$|^[.]\d{1,}$/.test(a)?isFinite(a)&&(a>Number.MAX_SAFE_INTEGER||a<Number.MIN_SAFE_INTEGER)?BigInt(a):Number(a):a)},Hi={type:"any",description:"any character"},Et="*",kt={type:"literal",value:"*",description:'"*"'},Za=function(){return Ms},Ui="\\t",Xa={type:"literal",value:"\\t",description:'"\\\\t"'},Ga=function(){return" "},Fi="\\r",Ja={type:"literal",value:"\\r",description:'"\\\\r"'},el=function(){return"\r"},Qi="\\n",tl={type:"literal",value:"\\n",description:'"\\\\n"'},rl=function(){return`
|
|
748
|
+
`},il=function(r){return r},sl=/^[\\():<>"*{}]/,nl={type:"class",value:'[\\\\():<>"*{}]',description:'[\\\\():<>"*{}]'},qi="<=",ol={type:"literal",value:"<=",description:'"<="'},al=function(){return"lte"},Wi=">=",ll={type:"literal",value:">=",description:'">="'},cl=function(){return"gte"},Vi="<",Yi={type:"literal",value:"<",description:'"<"'},pl=function(){return"lt"},Ki=">",Zi={type:"literal",value:">",description:'">"'},ul=function(){return"gt"},hl={type:"other",description:"whitespace"},dl=/^[ \t\r\n]/,fl={type:"class",value:"[\\ \\t\\r\\n]",description:"[\\ \\t\\r\\n]"},gl=function(){return rc},Xi="@kuery-cursor@",vl={type:"literal",value:"@kuery-cursor@",description:'"@kuery-cursor@"'},bl=function(){return ic},Gi="||",ml={type:"literal",value:"||",description:'"||"'},yl=function(){q("LuceneOr")},Ji="&&",$l={type:"literal",value:"&&",description:'"&&"'},es=function(){q("LuceneAnd")},ts="+",rs={type:"literal",value:"+",description:'"+"'},is="-",ss={type:"literal",value:"-",description:'"-"'},ns=function(){q("LuceneNot")},os="!",as={type:"literal",value:"!",description:'"!"'},ls="_exists_",wl={type:"literal",value:"_exists_",description:'"_exists_"'},_l=function(){q("LuceneExists")},cs=function(){q("LuceneRange")},ps="?",us={type:"literal",value:"?",description:'"?"'},Sl=function(){q("LuceneWildcard")},Or="/",Dr={type:"literal",value:"/",description:'"/"'},hs=/^[^\/]/,ds={type:"class",value:"[^/]",description:"[^/]"},Al=function(){q("LuceneRegex")},Lr="~",Nr={type:"literal",value:"~",description:'"~"'},Ie=/^[0-9]/,He={type:"class",value:"[0-9]",description:"[0-9]"},xl=function(){q("LuceneFuzzy")},Cl=function(){q("LuceneProximity")},fs="^",gs={type:"literal",value:"^",description:'"^"'},El=function(){q("LuceneBoost")},kl=function(){return char},Pl="=",Tl={type:"literal",value:"=",description:'"="'},vs="[",bs={type:"literal",value:"[",description:'"["'},ms="]",ys={type:"literal",value:"]",description:'"]"'},$s="TO",Ol={type:"literal",value:"TO",description:'"TO"'},l=0,A=0,Pt=[{line:1,column:1,seenCR:!1}],J=0,zr=[],g=0,Tt;if("startRule"in o){if(!(o.startRule in c))throw new Error(`Can't start parsing from rule "`+o.startRule+'".');d=c[o.startRule]}function Dl(){return i.substring(A,l)}function Ll(){return Ot(A,l)}function q(r){throw _s(r,null,i.substring(A,l),Ot(A,l))}function ws(r){var a=Pt[r],p,u;if(a)return a;for(p=r-1;!Pt[p];)p--;for(a=Pt[p],a={line:a.line,column:a.column,seenCR:a.seenCR};p<r;)u=i.charAt(p),u===`
|
|
749
|
+
`?(a.seenCR||a.line++,a.column=1,a.seenCR=!1):u==="\r"||u==="\u2028"||u==="\u2029"?(a.line++,a.column=1,a.seenCR=!0):(a.column++,a.seenCR=!1),p++;return Pt[r]=a,a}function Ot(r,a){var p=ws(r),u=ws(a);return{start:{offset:r,line:p.line,column:p.column},end:{offset:a,line:u.line,column:u.column}}}function m(r){l<J||(l>J&&(J=l,zr=[]),zr.push(r))}function _s(r,a,p,u){function v(L){var z=1;for(L.sort(function(fe,W){return fe.description<W.description?-1:fe.description>W.description?1:0});z<L.length;)L[z-1]===L[z]?L.splice(z,1):z++}function _(L,z){function fe(ac){function Rt(ie){return ie.charCodeAt(0).toString(16).toUpperCase()}return ac.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E\x0F]/g,function(ie){return"\\x0"+Rt(ie)}).replace(/[\x10-\x1F\x80-\xFF]/g,function(ie){return"\\x"+Rt(ie)}).replace(/[\u0100-\u0FFF]/g,function(ie){return"\\u0"+Rt(ie)}).replace(/[\u1000-\uFFFF]/g,function(ie){return"\\u"+Rt(ie)})}var W=new Array(L.length),Is,Hs,ct;for(ct=0;ct<L.length;ct++)W[ct]=L[ct].description;return Is=L.length>1?W.slice(0,-1).join(", ")+" or "+W[L.length-1]:W[0],Hs=z?'"'+fe(z)+'"':"end of input","Expected "+Is+" but "+Hs+" found."}return a!==null&&v(a),new e(r!==null?r:_(a,p),a,p,u)}function Ss(){var r,a,p,u;for(r=l,a=[],p=w();p!==t;)a.push(p),p=w();return a!==t?(p=Dt(),p===t&&(p=null),p!==t?(u=jt(),u!==t?(A=r,a=f(p,u),r=a):(l=r,r=t)):(l=r,r=t)):(l=r,r=t),r}function Dt(){var r,a,p,u;return r=l,A=l,a=y(),a?a=void 0:a=t,a!==t?(p=Fl(),p!==t?(a=[a,p],r=a):(l=r,r=t)):(l=r,r=t),r===t&&(r=l,a=jr(),a!==t?(p=Lt(),p!==t?(u=Dt(),u!==t?(A=r,a=x(a,u),r=a):(l=r,r=t)):(l=r,r=t)):(l=r,r=t),r===t&&(r=jr())),r}function jr(){var r,a,p,u;return r=l,a=As(),a!==t?(p=Nt(),p!==t?(u=jr(),u!==t?(A=r,a=$(a,u),r=a):(l=r,r=t)):(l=r,r=t)):(l=r,r=t),r===t&&(r=As()),r}function As(){var r,a,p;return r=l,a=Ir(),a!==t?(p=xs(),p!==t?(A=r,a=E(p),r=a):(l=r,r=t)):(l=r,r=t),r===t&&(r=xs()),r}function xs(){var r,a,p,u,v,_;if(r=l,i.charCodeAt(l)===40?(a=C,l++):(a=t,g===0&&m(k)),a!==t){for(p=[],u=w();u!==t;)p.push(u),u=w();p!==t?(u=Dt(),u!==t?(v=jt(),v!==t?(i.charCodeAt(l)===41?(_=N,l++):(_=t,g===0&&m(R)),_!==t?(A=r,a=M(u,v),r=a):(l=r,r=t)):(l=r,r=t)):(l=r,r=t)):(l=r,r=t)}else l=r,r=t;return r===t&&(r=Nl()),r}function Nl(){var r,a,p,u,v,_,L,z,fe,W;if(r=l,a=Br(),a!==t){for(p=[],u=w();u!==t;)p.push(u),u=w();if(p!==t)if(i.charCodeAt(l)===58?(u=G,l++):(u=t,g===0&&m(U)),u!==t){for(v=[],_=w();_!==t;)v.push(_),_=w();if(v!==t)if(i.charCodeAt(l)===123?(_=Me,l++):(_=t,g===0&&m(Er)),_!==t){for(L=[],z=w();z!==t;)L.push(z),z=w();L!==t?(z=Dt(),z!==t?(fe=jt(),fe!==t?(i.charCodeAt(l)===125?(W=kr,l++):(W=t,g===0&&m(Pr)),W!==t?(A=r,a=ka(a,z,fe),r=a):(l=r,r=t)):(l=r,r=t)):(l=r,r=t)):(l=r,r=t)}else l=r,r=t;else l=r,r=t}else l=r,r=t;else l=r,r=t}else l=r,r=t;return r===t&&(r=zl()),r}function zl(){var r;return r=jl(),r===t&&(r=Bl(),r===t&&(r=Rl())),r}function Br(){var r;return g++,r=Hr(),g--,r===t&&g===0&&m(Pa),r}function jl(){var r,a,p,u,v,_;if(r=l,a=Br(),a!==t){for(p=[],u=w();u!==t;)p.push(u),u=w();if(p!==t)if(u=Os(),u!==t){for(v=[],_=w();_!==t;)v.push(_),_=w();v!==t?(_=Hr(),_!==t?(A=r,a=Ta(a,u,_),r=a):(l=r,r=t)):(l=r,r=t)}else l=r,r=t;else l=r,r=t}else l=r,r=t;return r}function Bl(){var r,a,p,u,v,_;if(r=l,a=Br(),a!==t){for(p=[],u=w();u!==t;)p.push(u),u=w();if(p!==t)if(i.charCodeAt(l)===58?(u=G,l++):(u=t,g===0&&m(U)),u!==t){for(v=[],_=w();_!==t;)v.push(_),_=w();v!==t?(_=Rr(),_!==t?(A=r,a=Oa(a,_),r=a):(l=r,r=t)):(l=r,r=t)}else l=r,r=t;else l=r,r=t}else l=r,r=t;return r}function Rl(){var r,a;return r=l,a=ks(),a!==t&&(A=r,a=Da(a)),r=a,r}function Rr(){var r,a,p,u,v,_;if(r=l,i.charCodeAt(l)===40?(a=C,l++):(a=t,g===0&&m(k)),a!==t){for(p=[],u=w();u!==t;)p.push(u),u=w();p!==t?(u=Cs(),u!==t?(v=jt(),v!==t?(i.charCodeAt(l)===41?(_=N,l++):(_=t,g===0&&m(R)),_!==t?(A=r,a=La(u,v),r=a):(l=r,r=t)):(l=r,r=t)):(l=r,r=t)):(l=r,r=t)}else l=r,r=t;return r===t&&(r=ks()),r}function Cs(){var r,a,p,u;return r=l,a=Mr(),a!==t?(p=Lt(),p!==t?(u=Cs(),u!==t?(A=r,a=Na(a,u),r=a):(l=r,r=t)):(l=r,r=t)):(l=r,r=t),r===t&&(r=Mr()),r}function Mr(){var r,a,p,u;return r=l,a=Es(),a!==t?(p=Nt(),p!==t?(u=Mr(),u!==t?(A=r,a=za(a,u),r=a):(l=r,r=t)):(l=r,r=t)):(l=r,r=t),r===t&&(r=Es()),r}function Es(){var r,a,p;return r=l,a=Ir(),a!==t?(p=Rr(),p!==t?(A=r,a=ja(p),r=a):(l=r,r=t)):(l=r,r=t),r===t&&(r=Rr()),r}function ks(){var r,a;return g++,r=l,a=zt(),a!==t&&(A=r,a=Ra(a)),r=a,r===t&&(r=l,a=Ps(),a!==t&&(A=r,a=Ma(a)),r=a),g--,r===t&&(a=t,g===0&&m(Ba)),r}function Lt(){var r,a,p,u,v;if(g++,r=l,a=[],p=w(),p!==t)for(;p!==t;)a.push(p),p=w();else a=t;if(a!==t)if(i.substr(l,2).toLowerCase()===zi?(p=i.substr(l,2),l+=2):(p=t,g===0&&m(ji)),p!==t){if(u=[],v=w(),v!==t)for(;v!==t;)u.push(v),v=w();else u=t;u!==t?(a=[a,p,u],r=a):(l=r,r=t)}else l=r,r=t;else l=r,r=t;return r===t&&(r=l,A=l,a=y(),a?a=void 0:a=t,a!==t?(p=Ds(),p!==t?(a=[a,p],r=a):(l=r,r=t)):(l=r,r=t)),g--,r===t&&(a=t,g===0&&m(Ia)),r}function Nt(){var r,a,p,u,v;if(g++,r=l,a=[],p=w(),p!==t)for(;p!==t;)a.push(p),p=w();else a=t;if(a!==t)if(i.substr(l,3).toLowerCase()===Bi?(p=i.substr(l,3),l+=3):(p=t,g===0&&m(Ri)),p!==t){if(u=[],v=w(),v!==t)for(;v!==t;)u.push(v),v=w();else u=t;u!==t?(a=[a,p,u],r=a):(l=r,r=t)}else l=r,r=t;else l=r,r=t;return r===t&&(r=l,A=l,a=y(),a?a=void 0:a=t,a!==t?(p=Ls(),p!==t?(a=[a,p],r=a):(l=r,r=t)):(l=r,r=t)),g--,r===t&&(a=t,g===0&&m(Ha)),r}function Ir(){var r,a,p,u;if(g++,r=l,i.substr(l,3).toLowerCase()===Mi?(a=i.substr(l,3),l+=3):(a=t,g===0&&m(Ii)),a!==t){if(p=[],u=w(),u!==t)for(;u!==t;)p.push(u),u=w();else p=t;p!==t?(a=[a,p],r=a):(l=r,r=t)}else l=r,r=t;return r===t&&(r=l,A=l,a=y(),a?a=void 0:a=t,a!==t?(p=Ns(),p!==t?(a=[a,p],r=a):(l=r,r=t)):(l=r,r=t)),g--,r===t&&(a=t,g===0&&m(Ua)),r}function Hr(){var r;return g++,r=zt(),r===t&&(r=Ps()),g--,r===t&&g===0&&m(Fa),r}function zt(){var r,a,p,u,v,_;if(r=l,i.charCodeAt(l)===34?(a=st,l++):(a=t,g===0&&m(nt)),a!==t){for(p=[],u=Ue();u!==t;)p.push(u),u=Ue();if(p!==t)if(u=lt(),u!==t){for(v=[],_=Ue();_!==t;)v.push(_),_=Ue();v!==t?(i.charCodeAt(l)===34?(_=st,l++):(_=t,g===0&&m(nt)),_!==t?(A=r,a=Tr(p,u,v),r=a):(l=r,r=t)):(l=r,r=t)}else l=r,r=t;else l=r,r=t}else l=r,r=t;if(r===t)if(r=l,i.charCodeAt(l)===34?(a=st,l++):(a=t,g===0&&m(nt)),a!==t){for(p=[],u=Ue();u!==t;)p.push(u),u=Ue();p!==t?(i.charCodeAt(l)===34?(u=st,l++):(u=t,g===0&&m(nt)),u!==t?(A=r,a=Qa(p),r=a):(l=r,r=t)):(l=r,r=t)}else l=r,r=t;return r}function Ue(){var r,a,p;return r=Ur(),r===t&&(r=l,i.charCodeAt(l)===92?(a=ot,l++):(a=t,g===0&&m(at)),a!==t?(qa.test(i.charAt(l))?(p=i.charAt(l),l++):(p=t,g===0&&m(Wa)),p!==t?(A=r,a=Ct(p),r=a):(l=r,r=t)):(l=r,r=t),r===t&&(r=l,a=l,g++,p=lt(),g--,p===t?a=void 0:(l=a,a=t),a!==t?(Va.test(i.charAt(l))?(p=i.charAt(l),l++):(p=t,g===0&&m(Ya)),p!==t?(A=r,a=Ct(p),r=a):(l=r,r=t)):(l=r,r=t))),r}function Ps(){var r,a,p,u,v;for(r=l,a=[],p=Fe();p!==t;)a.push(p),p=Fe();if(a!==t)if(p=lt(),p!==t){for(u=[],v=Fe();v!==t;)u.push(v),v=Fe();u!==t?(A=r,a=Tr(a,p,u),r=a):(l=r,r=t)}else l=r,r=t;else l=r,r=t;if(r===t){if(r=l,a=[],p=Fe(),p!==t)for(;p!==t;)a.push(p),p=Fe();else a=t;a!==t&&(A=r,a=Ka(a)),r=a}return r}function Fe(){var r,a,p,u,v;return r=Ur(),r===t&&(r=Il(),r===t&&(r=Hl(),r===t&&(r=Ml(),r===t&&(r=l,a=l,g++,p=Ts(),g--,p===t?a=void 0:(l=a,a=t),a!==t?(p=l,g++,u=Ul(),g--,u===t?p=void 0:(l=p,p=t),p!==t?(u=l,g++,v=lt(),g--,v===t?u=void 0:(l=u,u=t),u!==t?(i.length>l?(v=i.charAt(l),l++):(v=t,g===0&&m(Hi)),v!==t?(A=r,a=Ct(v),r=a):(l=r,r=t)):(l=r,r=t)):(l=r,r=t)):(l=r,r=t))))),r}function Ml(){var r,a;return r=l,i.charCodeAt(l)===42?(a=Et,l++):(a=t,g===0&&m(kt)),a!==t&&(A=r,a=Za()),r=a,r}function jt(){var r,a,p,u,v;for(r=l,a=[],p=w();p!==t;)a.push(p),p=w();if(a!==t)if(p=lt(),p!==t){for(u=[],v=w();v!==t;)u.push(v),v=w();u!==t?(A=r,a=Tr(a,p,u),r=a):(l=r,r=t)}else l=r,r=t;else l=r,r=t;if(r===t)for(r=[],a=w();a!==t;)r.push(a),a=w();return r}function Ur(){var r,a;return r=l,i.substr(l,2)===Ui?(a=Ui,l+=2):(a=t,g===0&&m(Xa)),a!==t&&(A=r,a=Ga()),r=a,r===t&&(r=l,i.substr(l,2)===Fi?(a=Fi,l+=2):(a=t,g===0&&m(Ja)),a!==t&&(A=r,a=el()),r=a,r===t&&(r=l,i.substr(l,2)===Qi?(a=Qi,l+=2):(a=t,g===0&&m(tl)),a!==t&&(A=r,a=rl()),r=a)),r}function Il(){var r,a,p;return r=l,i.charCodeAt(l)===92?(a=ot,l++):(a=t,g===0&&m(at)),a!==t?(p=Ts(),p!==t?(A=r,a=Ct(p),r=a):(l=r,r=t)):(l=r,r=t),r}function Hl(){var r,a,p;return r=l,i.charCodeAt(l)===92?(a=ot,l++):(a=t,g===0&&m(at)),a!==t?(i.substr(l,2).toLowerCase()===zi?(p=i.substr(l,2),l+=2):(p=t,g===0&&m(ji)),p===t&&(i.substr(l,3).toLowerCase()===Bi?(p=i.substr(l,3),l+=3):(p=t,g===0&&m(Ri)),p===t&&(i.substr(l,3).toLowerCase()===Mi?(p=i.substr(l,3),l+=3):(p=t,g===0&&m(Ii)))),p!==t?(A=r,a=il(p),r=a):(l=r,r=t)):(l=r,r=t),r}function Ul(){var r;return r=Lt(),r===t&&(r=Nt(),r===t&&(r=Ir())),r}function Ts(){var r;return sl.test(i.charAt(l))?(r=i.charAt(l),l++):(r=t,g===0&&m(nl)),r}function Os(){var r,a;return r=l,i.substr(l,2)===qi?(a=qi,l+=2):(a=t,g===0&&m(ol)),a!==t&&(A=r,a=al()),r=a,r===t&&(r=l,i.substr(l,2)===Wi?(a=Wi,l+=2):(a=t,g===0&&m(ll)),a!==t&&(A=r,a=cl()),r=a,r===t&&(r=l,i.charCodeAt(l)===60?(a=Vi,l++):(a=t,g===0&&m(Yi)),a!==t&&(A=r,a=pl()),r=a,r===t&&(r=l,i.charCodeAt(l)===62?(a=Ki,l++):(a=t,g===0&&m(Zi)),a!==t&&(A=r,a=ul()),r=a))),r}function w(){var r;return g++,dl.test(i.charAt(l))?(r=i.charAt(l),l++):(r=t,g===0&&m(fl)),g--,r===t&&g===0&&m(hl),r}function lt(){var r,a,p;return r=l,A=l,a=gl(),a?a=void 0:a=t,a!==t?(i.substr(l,14)===Xi?(p=Xi,l+=14):(p=t,g===0&&m(vl)),p!==t?(A=r,a=bl(),r=a):(l=r,r=t)):(l=r,r=t),r}function Ds(){var r,a,p,u,v;for(r=l,a=[],p=w();p!==t;)a.push(p),p=w();if(a!==t)if(i.substr(l,2)===Gi?(p=Gi,l+=2):(p=t,g===0&&m(ml)),p!==t){for(u=[],v=w();v!==t;)u.push(v),v=w();u!==t?(A=r,a=yl(),r=a):(l=r,r=t)}else l=r,r=t;else l=r,r=t;return r}function Ls(){var r,a,p,u,v;for(r=l,a=[],p=w();p!==t;)a.push(p),p=w();if(a!==t)if(i.substr(l,2)===Ji?(p=Ji,l+=2):(p=t,g===0&&m($l)),p!==t){for(u=[],v=w();v!==t;)u.push(v),v=w();u!==t?(A=r,a=es(),r=a):(l=r,r=t)}else l=r,r=t;else l=r,r=t;return r===t&&(r=l,i.charCodeAt(l)===43?(a=ts,l++):(a=t,g===0&&m(rs)),a!==t&&(A=r,a=es()),r=a),r}function Ns(){var r,a;return r=l,i.charCodeAt(l)===45?(a=is,l++):(a=t,g===0&&m(ss)),a!==t&&(A=r,a=ns()),r=a,r===t&&(r=l,i.charCodeAt(l)===33?(a=os,l++):(a=t,g===0&&m(as)),a!==t&&(A=r,a=ns()),r=a),r}function Fl(){var r;return r=Ql(),r===t&&(r=zs(),r===t&&(r=ql())),r}function Ql(){var r,a,p,u,v,_;if(r=l,a=Qe(),a!==t){for(p=[],u=w();u!==t;)p.push(u),u=w();if(p!==t)if(i.charCodeAt(l)===58?(u=G,l++):(u=t,g===0&&m(U)),u!==t){for(v=[],_=w();_!==t;)v.push(_),_=w();v!==t?(_=zs(),_!==t?(a=[a,p,u,v,_],r=a):(l=r,r=t)):(l=r,r=t)}else l=r,r=t;else l=r,r=t}else l=r,r=t;return r}function zs(){var r;return r=Wl(),r===t&&(r=Fr(),r===t&&(r=Vl(),r===t&&(r=Yl(),r===t&&(r=Kl(),r===t&&(r=Zl()))))),r}function ql(){var r,a,p,u,v,_;if(r=l,i.substr(l,8)===ls?(a=ls,l+=8):(a=t,g===0&&m(wl)),a!==t){for(p=[],u=w();u!==t;)p.push(u),u=w();if(p!==t)if(i.charCodeAt(l)===58?(u=G,l++):(u=t,g===0&&m(U)),u!==t){for(v=[],_=w();_!==t;)v.push(_),_=w();v!==t?(_=Qe(),_!==t?(A=r,a=_l(),r=a):(l=r,r=t)):(l=r,r=t)}else l=r,r=t;else l=r,r=t}else l=r,r=t;return r}function Wl(){var r,a,p,u,v,_,L;if(r=l,a=Os(),a!==t){for(p=[],u=w();u!==t;)p.push(u),u=w();p!==t?(u=Qe(),u!==t?(A=r,a=cs(),r=a):(l=r,r=t)):(l=r,r=t)}else l=r,r=t;if(r===t)if(r=l,a=Jl(),a!==t){for(p=[],u=w();u!==t;)p.push(u),u=w();p!==t?(u=Qe(),u!==t?(v=Rs(),v!==t?(_=Qe(),_!==t?(L=ec(),L!==t?(A=r,a=cs(),r=a):(l=r,r=t)):(l=r,r=t)):(l=r,r=t)):(l=r,r=t)):(l=r,r=t)}else l=r,r=t;return r}function Fr(){var r,a,p,u,v;for(r=l,a=[],p=Bt(),p===t&&(i.charCodeAt(l)===42?(p=Et,l++):(p=t,g===0&&m(kt)));p!==t;)a.push(p),p=Bt(),p===t&&(i.charCodeAt(l)===42?(p=Et,l++):(p=t,g===0&&m(kt)));if(a!==t)if(i.charCodeAt(l)===63?(p=ps,l++):(p=t,g===0&&m(us)),p!==t){for(u=[],v=Fr();v!==t;)u.push(v),v=Fr();u!==t?(A=r,a=Sl(),r=a):(l=r,r=t)}else l=r,r=t;else l=r,r=t;return r}function Vl(){var r,a,p,u;if(r=l,i.charCodeAt(l)===47?(a=Or,l++):(a=t,g===0&&m(Dr)),a!==t){for(p=[],hs.test(i.charAt(l))?(u=i.charAt(l),l++):(u=t,g===0&&m(ds));u!==t;)p.push(u),hs.test(i.charAt(l))?(u=i.charAt(l),l++):(u=t,g===0&&m(ds));p!==t?(i.charCodeAt(l)===47?(u=Or,l++):(u=t,g===0&&m(Dr)),u!==t?(A=r,a=Al(),r=a):(l=r,r=t)):(l=r,r=t)}else l=r,r=t;return r}function Yl(){var r,a,p,u,v;if(r=l,a=js(),a!==t)if(i.charCodeAt(l)===126?(p=Lr,l++):(p=t,g===0&&m(Nr)),p!==t){for(u=[],Ie.test(i.charAt(l))?(v=i.charAt(l),l++):(v=t,g===0&&m(He));v!==t;)u.push(v),Ie.test(i.charAt(l))?(v=i.charAt(l),l++):(v=t,g===0&&m(He));u!==t?(A=r,a=xl(),r=a):(l=r,r=t)}else l=r,r=t;else l=r,r=t;return r}function Kl(){var r,a,p,u,v;if(r=l,a=zt(),a!==t)if(i.charCodeAt(l)===126?(p=Lr,l++):(p=t,g===0&&m(Nr)),p!==t){for(u=[],Ie.test(i.charAt(l))?(v=i.charAt(l),l++):(v=t,g===0&&m(He));v!==t;)u.push(v),Ie.test(i.charAt(l))?(v=i.charAt(l),l++):(v=t,g===0&&m(He));u!==t?(A=r,a=Cl(),r=a):(l=r,r=t)}else l=r,r=t;else l=r,r=t;return r}function Zl(){var r,a,p,u,v;if(r=l,a=Qe(),a!==t)if(i.charCodeAt(l)===94?(p=fs,l++):(p=t,g===0&&m(gs)),p!==t){for(u=[],Ie.test(i.charAt(l))?(v=i.charAt(l),l++):(v=t,g===0&&m(He));v!==t;)u.push(v),Ie.test(i.charAt(l))?(v=i.charAt(l),l++):(v=t,g===0&&m(He));u!==t?(A=r,a=El(),r=a):(l=r,r=t)}else l=r,r=t;else l=r,r=t;return r}function Qe(){var r;return r=zt(),r===t&&(r=js()),r}function js(){var r,a;if(r=[],a=Bt(),a!==t)for(;a!==t;)r.push(a),a=Bt();else r=t;return r}function Bt(){var r,a,p,u;return r=Ur(),r===t&&(r=Gl(),r===t&&(r=l,a=l,g++,p=Bs(),g--,p===t?a=void 0:(l=a,a=t),a!==t?(p=l,g++,u=Xl(),g--,u===t?p=void 0:(l=p,p=t),p!==t?(i.length>l?(u=i.charAt(l),l++):(u=t,g===0&&m(Hi)),u!==t?(a=[a,p,u],r=a):(l=r,r=t)):(l=r,r=t)):(l=r,r=t))),r}function Xl(){var r;return r=Lt(),r===t&&(r=Nt(),r===t&&(r=Ds(),r===t&&(r=Ls(),r===t&&(r=Ns(),r===t&&(r=Rs()))))),r}function Gl(){var r,a,p;return r=l,i.charCodeAt(l)===92?(a=ot,l++):(a=t,g===0&&m(at)),a!==t?(p=Bs(),p!==t?(A=r,a=kl(),r=a):(l=r,r=t)):(l=r,r=t),r}function Bs(){var r;return i.charCodeAt(l)===43?(r=ts,l++):(r=t,g===0&&m(rs)),r===t&&(i.charCodeAt(l)===45?(r=is,l++):(r=t,g===0&&m(ss)),r===t&&(i.charCodeAt(l)===61?(r=Pl,l++):(r=t,g===0&&m(Tl)),r===t&&(i.charCodeAt(l)===62?(r=Ki,l++):(r=t,g===0&&m(Zi)),r===t&&(i.charCodeAt(l)===60?(r=Vi,l++):(r=t,g===0&&m(Yi)),r===t&&(i.charCodeAt(l)===33?(r=os,l++):(r=t,g===0&&m(as)),r===t&&(i.charCodeAt(l)===40?(r=C,l++):(r=t,g===0&&m(k)),r===t&&(i.charCodeAt(l)===41?(r=N,l++):(r=t,g===0&&m(R)),r===t&&(i.charCodeAt(l)===123?(r=Me,l++):(r=t,g===0&&m(Er)),r===t&&(i.charCodeAt(l)===125?(r=kr,l++):(r=t,g===0&&m(Pr)),r===t&&(i.charCodeAt(l)===91?(r=vs,l++):(r=t,g===0&&m(bs)),r===t&&(i.charCodeAt(l)===93?(r=ms,l++):(r=t,g===0&&m(ys)),r===t&&(i.charCodeAt(l)===94?(r=fs,l++):(r=t,g===0&&m(gs)),r===t&&(i.charCodeAt(l)===34?(r=st,l++):(r=t,g===0&&m(nt)),r===t&&(i.charCodeAt(l)===126?(r=Lr,l++):(r=t,g===0&&m(Nr)),r===t&&(i.charCodeAt(l)===42?(r=Et,l++):(r=t,g===0&&m(kt)),r===t&&(i.charCodeAt(l)===63?(r=ps,l++):(r=t,g===0&&m(us)),r===t&&(i.charCodeAt(l)===58?(r=G,l++):(r=t,g===0&&m(U)),r===t&&(i.charCodeAt(l)===92?(r=ot,l++):(r=t,g===0&&m(at)),r===t&&(i.charCodeAt(l)===47?(r=Or,l++):(r=t,g===0&&m(Dr))))))))))))))))))))),r}function Rs(){var r,a,p,u,v;if(r=l,a=[],p=w(),p!==t)for(;p!==t;)a.push(p),p=w();else a=t;if(a!==t)if(i.substr(l,2)===$s?(p=$s,l+=2):(p=t,g===0&&m(Ol)),p!==t){if(u=[],v=w(),v!==t)for(;v!==t;)u.push(v),v=w();else u=t;u!==t?(a=[a,p,u],r=a):(l=r,r=t)}else l=r,r=t;else l=r,r=t;return r}function Jl(){var r;return i.charCodeAt(l)===91?(r=vs,l++):(r=t,g===0&&m(bs)),r===t&&(i.charCodeAt(l)===123?(r=Me,l++):(r=t,g===0&&m(Er))),r}function ec(){var r;return i.charCodeAt(l)===93?(r=ms,l++):(r=t,g===0&&m(ys)),r===t&&(i.charCodeAt(l)===125?(r=kr,l++):(r=t,g===0&&m(Pr))),r}const{errorOnLuceneSyntax:tc,parseCursor:rc,cursorSymbol:ic,allowLeadingWildcards:sc=!0,helpers:{nodeTypes:Pe}}=o,ee=Pe.function.buildNodeWithArgumentNodes,de=Pe.literal.buildNode,nc=Pe.wildcard.buildNode,oc=Pe.namedArg.buildNode,{wildcardSymbol:Ms}=Pe.wildcard;if(Tt=d(),Tt!==t&&l===i.length)return Tt;throw Tt!==t&&l<i.length&&m({type:"end",description:"end of input"}),_s(null,zr,J<i.length?i.charAt(J):null,J<i.length?Ot(J,J+1):Ot(J,J))}return{SyntaxError:e,parse:n}}(),pr=(s,e={},n=$t)=>{if(typeof s>"u")throw new Error("expression must be a string, got undefined instead");return n(s,{...e,helpers:{nodeTypes:K}})},ze=(s,e={})=>pr(s,{...e,startRule:"Literal"},$t),wt=(s,e={})=>{try{return pr(s,e,$t)}catch(n){throw n.name==="SyntaxError"?new yi(n,s):n}},zn=s=>{try{return pr(s,{errorOnLuceneSyntax:!0},$t),!1}catch(e){return e.message.startsWith("Lucene")}},j=(s,e,n,i)=>(e=void 0,!s||!s.type||!K[s.type]?j(K.function.buildNode("and",[]),e):K[s.type].toOpenSearchQuery(s,e,n,i)),re="@kuery-wildcard@";function jn(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Bn(s){return s.replace(/[+-=&|><!(){}[\]^"~*?:\\/]/g,"\\$&")}function Rn(s){return s.includes(re)?{type:"wildcard",value:s}:ze(s)}function $i(s,e){const{value:n}=s,i=n.split(re).map(jn).join("[\\s\\S]*");return new RegExp(`^${i}$`).test(e)}function Mn(s){const{value:e}=s;return e.split(re).join("*")}function ur(s){const{value:e}=s;return e.split(re).map(Bn).join("*")}function In(s){const{value:e}=s;return e.startsWith(re)&&e.replace(re,"").length>0}const Hn=Object.freeze(Object.defineProperty({__proto__:null,buildNode:Rn,hasLeadingWildcard:In,test:$i,toOpenSearchQuery:Mn,toQueryStringQuery:ur,wildcardSymbol:re},Symbol.toStringTag,{value:"Module"}));function hr(s,e){if(!e)return[];if(s.type==="literal"){const n=cr(s),i=e.fields.find(o=>o.name===n);return i?[i]:[]}else if(s.type==="wildcard")return e.fields.filter(i=>$i(s,i.name))}function cc(s){return s}function wi(s,e,n){const i={...s,value:n?`${n}.${s.value}`:s.value};if(!e||i.type==="wildcard"&&!n)return i;const t=hr(i,e).reduce((c,d)=>{const f=d.subType&&d.subType.nested?d.subType.nested.path:void 0;return n&&!f?[...c,`${d.name} is not a nested field but is in nested group "${n}" in the DQL expression.`]:f&&!n?[...c,`${d.name} is a nested field, but is not in a nested group in the DQL expression.`]:f!==n?[...c,`Nested field ${d.name} is being queried with the incorrect nested path. The correct path is ${d.subType.nested.path}.`]:c},[]);if(t.length>0)throw new Error(t.join(`
|
|
750
|
+
`));return i}function Un(s,e,n=!1){if(s===void 0)throw new Error("fieldName is a required argument");if(e===void 0)throw new Error("value is a required argument");const i=typeof s=="string"?ze(s):Ne(s),o=typeof e=="string"?ze(e):Ne(e),t=Ne(n);return{arguments:[i,o,t]}}function Fn(s,e,n={},i={}){const{arguments:[o,t,c]}=s,d=wi(o,e,i!=null&&i.nested?i.nested.path:void 0),f=j(d),y=t!==void 0?j(t):t,x=c.value?"phrase":"best_fields";if(d.value===null)return t.type==="wildcard"?{query_string:{query:ur(t)}}:{multi_match:{type:x,query:y,lenient:!0}};const $=e?hr(d,e):[];$&&$.length===0&&$.push({name:j(d),scripted:!1,type:""});const E=t.type==="wildcard"&&y==="*",C=d.type==="wildcard"&&f==="*"||$&&e&&$.length===e.fields.length;return E&&C?{match_all:{}}:{bool:{should:$.reduce((R,M)=>{const G=U=>{var Me;return d.type!=="wildcard"||!((Me=M.subType)!=null&&Me.nested)||i!=null&&i.nested?U:{nested:{path:M.subType.nested.path,query:U,score_mode:"none"}}};if(M.scripted)return[];if(E)return[...R,G({exists:{field:M.name}})];if(t.type==="wildcard")return[...R,G({query_string:{fields:[M.name],query:ur(t)}})];if(M.type==="date"){const U=n.dateFormatTZ?{time_zone:n.dateFormatTZ}:{};return[...R,G({range:{[M.name]:{gte:y,lte:y,...U}}})]}else{const U=x==="phrase"?"match_phrase":"match";return[...R,G({[U]:{[M.name]:y}})]}},[])||[],minimum_should_match:1}}}const Qn=Object.freeze(Object.defineProperty({__proto__:null,buildNodeParams:Un,toOpenSearchQuery:Fn},Symbol.toStringTag,{value:"Module"}));function qn(s){return{arguments:s}}function Wn(s,e,n={},i={}){return{bool:{filter:(s.arguments||[]).map(t=>j(t,e,n,i))}}}const Vn=Object.freeze(Object.defineProperty({__proto__:null,buildNodeParams:qn,toOpenSearchQuery:Wn},Symbol.toStringTag,{value:"Module"}));function Yn(s){return{arguments:s}}function Kn(s,e,n={},i={}){return{bool:{should:(s.arguments||[]).map(t=>j(t,e,n,i)),minimum_should_match:1}}}const Zn=Object.freeze(Object.defineProperty({__proto__:null,buildNodeParams:Yn,toOpenSearchQuery:Kn},Symbol.toStringTag,{value:"Module"}));function Xn(s){return{arguments:[s]}}function Gn(s,e,n={},i={}){const[o]=s.arguments;return{bool:{must_not:j(o,e,n,i)}}}const Jn=Object.freeze(Object.defineProperty({__proto__:null,buildNodeParams:Xn,toOpenSearchQuery:Gn},Symbol.toStringTag,{value:"Module"}));function eo(s,...e){let n={};for(let i of e)n[i]=s[i];return n}function to(s,e){const n=eo(e,"gt","lt","gte","lte","format"),i=typeof s=="string"?ze(s):K.literal.buildNode(s),o=Object.entries(n).map(t=>{let[c,d]=t;return K.namedArg.buildNode(c,d)});return{arguments:[i,...o]}}function ro(s,e,n={},i={}){const[o,...t]=s.arguments,c=wi(o,e,i!=null&&i.nested?i.nested.path:void 0),d=e?hr(c,e):[],f=io(t),y=Object.fromEntries(Object.entries(f).map(([$,E])=>[$,j(E)]));return d&&d.length===0&&d.push({name:j(c),scripted:!1,type:""}),{bool:{should:d.map($=>{const E=C=>{var k;return c.type!=="wildcard"||!((k=$.subType)!=null&&k.nested)||i.nested?C:{nested:{path:$.subType.nested.path,query:C,score_mode:"none"}}};if($.scripted)return{};if($.type==="date"){const C=n.dateFormatTZ?{time_zone:n.dateFormatTZ}:{};return E({range:{[$.name]:{...y,...C}}})}return E({range:{[$.name]:y}})}),minimum_should_match:1}}}function io(s){if(s.gt&&s.gte||s.lt&&s.lte)throw new Error("range ends cannot be both inclusive and exclusive");const e=["gte","lte","format"];return s.reduce((n,i,o)=>(i.type==="namedArg"?n[i.name]=i.value:n[e[o]]=i,n),{})}const so=Object.freeze(Object.defineProperty({__proto__:null,buildNodeParams:to,toOpenSearchQuery:ro},Symbol.toStringTag,{value:"Module"}));function no(s){return{arguments:[Ne(s)]}}function oo(s,e,n={},i={}){const{arguments:[o]}=s,t={...o,value:i!=null&&i.nested?`${i.nested.path}.${o.value}`:o.value},c=cr(t),d=((e==null?void 0:e.fields)||[]).find(f=>f.name===c);if(d&&d.scripted)throw new Error("Exists query does not support scripted fields");return{exists:{field:c}}}const ao=Object.freeze(Object.defineProperty({__proto__:null,buildNodeParams:no,toOpenSearchQuery:oo},Symbol.toStringTag,{value:"Module"}));function lo(s,e){return{arguments:[typeof s=="string"?ze(s):Ne(s),e]}}function co(s,e,n={},i={}){var f;const[o,t]=s.arguments,c=j(o),d=(f=i==null?void 0:i.nested)!=null&&f.path?`${i.nested.path}.${c}`:c;return{nested:{path:d,query:j(t,e,n,{...i,nested:{path:d}}),score_mode:"none"}}}const dr={is:Qn,and:Vn,or:Zn,not:Jn,range:so,exists:ao,nested:Object.freeze(Object.defineProperty({__proto__:null,buildNodeParams:lo,toOpenSearchQuery:co},Symbol.toStringTag,{value:"Module"}))};function po(s,...e){const n=dr[s];if(n===void 0)throw new Error(`Unknown function "${s}"`);return{type:"function",function:s,...n.buildNodeParams(...e)}}function uo(s,e){if(dr[s]===void 0)throw new Error(`Unknown function "${s}"`);return{type:"function",function:s,arguments:e}}function ho(s,e,n,i){return dr[s.function].toOpenSearchQuery(s,e,n,i)}const fo=Object.freeze(Object.defineProperty({__proto__:null,buildNode:po,buildNodeWithArgumentNodes:uo,toOpenSearchQuery:ho},Symbol.toStringTag,{value:"Module"}));function go(s,e){const n=e.type==="literal"?e:K.literal.buildNode(e);return{type:"namedArg",name:s,value:n}}function vo(s){return j(s.value)}const K={function:fo,literal:Nn,namedArg:Object.freeze(Object.defineProperty({__proto__:null,buildNode:go,toOpenSearchQuery:vo},Symbol.toStringTag,{value:"Module"})),wildcard:Hn},bo=re,mo=(s,e)=>"("+(s.arguments||[]).map(i=>xe(i,e)).join(" AND ")+")",yo=(s,e)=>{var{arguments:[n,i,o]}=s;let t="=";i.type==="wildcard"&&(t="");let c=xe(i);o=o.value||typeof c=="string",i.type==="literal"&&o&&(c=`'${c}'`),i.type==="literal"&&!o&&(c=`${c}`);let d=xe(n);return d==null?e&&o?`(${e.filter(f=>f.type==="string").map(f=>`${f.name} ILIKE '%${i.value}%'`).join(" OR ")})`:e&&!o&&(i.value===!0||i.value===!1)?`(${e.filter(f=>f.type==="boolean").map(f=>`${f.name}=${i.value}`).join(" OR ")})`:"":d+t+c},$o=(s,e)=>"("+(s.arguments||[]).map(i=>xe(i,e)).join(" OR ")+")",wo=(s,e)=>{const[n]=s.arguments;return"NOT ("+xe(n,e)+")"},_o={gt:">",lt:"<",gte:">=",lte:"<="},So={is:yo,and:mo,or:$o,not:wo,range:s=>{const[e,n]=s.arguments;let i=n.value;const o=_o[n.name];let t=xe(i);return i.type==="literal"&&(t=`${t}`),`${e.value} ${o} ${t}`},exists:s=>{const[e]=s.arguments;return`${e.value} IS NOT NULL`},nested:s=>(console.warn("Nested types dont exist in CQL",s),"")},Ao={function:(s,e)=>So[s.function](s,e),literal:s=>s.value,wildcard:s=>{const{value:e}=s;return` LIKE '${e.split(bo).join("%")}'`}},xe=(s,e)=>{const n=Ao[s.type];return n(s,e)},xo=re,Co=s=>({$and:(s.arguments||[]).map(i=>le(i))}),Eo=s=>{const{arguments:[e,n]}=s;let i=le(n);if(n.type==="wildcard"&&n.value==="@kuery-wildcard@")return _i(s);let t={};return t[le(e)]={$eq:i},t},ko=s=>({$or:(s.arguments||[]).map(n=>le(n))}),Po=s=>{const[e]=s.arguments;let n={};return n={$ne:le(e)},n},To={gt:"$gt",lt:"$lt",gte:"$gte",lte:"$lte"},Oo=s=>{const[e,n]=s.arguments;let i=n.value;const o=To[n.name];let t=le(i),c={};return c[e.value]={},c[e.value][o]=t,c},_i=s=>{const[e]=s.arguments;return{[le(e)]:{$ne:null}}},Do={is:Eo,and:Co,or:ko,not:Po,range:Oo,exists:_i,nested:s=>(console.warn("TODO Implement nested search",s),"")},Lo={function:s=>Do[s.function](s),literal:s=>s.value,wildcard:s=>{const{value:e}=s;return`/${e.split(xo).join(".*")}/`}},le=(s,e)=>{const n=Lo[s.type];return n(s,e)},No=Object.freeze(Object.defineProperty({__proto__:null,DQLSyntaxError:yi,doesKueryExpressionHaveLuceneSyntaxError:zn,fromKueryExpression:wt,fromLiteralExpression:ze,nodeTypes:K,parse:wt,toCql:xe,toDSL:j,toMongo:le,toOpenSearchQuery:j},Symbol.toStringTag,{value:"Module"})),zo=I`
|
|
728
751
|
:host {
|
|
729
752
|
--dialog-padding: var(--spectric-dialog-padding, 5px);
|
|
730
753
|
--dialog-background:var(--spectric-background,rgb(246, 249, 252));
|
|
@@ -771,11 +794,11 @@ spectric-button{
|
|
|
771
794
|
right: 0;
|
|
772
795
|
top: 0;
|
|
773
796
|
}
|
|
774
|
-
`;var
|
|
797
|
+
`;var jo=Object.defineProperty,Bo=Object.getOwnPropertyDescriptor,ce=(s,e,n,i)=>{for(var o=i>1?void 0:i?Bo(e,n):e,t=s.length-1,c;t>=0;t--)(c=s[t])&&(o=(i?c(e,n,o):c(o))||o);return i&&o&&jo(e,n,o),o};const _t="spectric-dialog";h.DialogElement=class extends D{constructor(){super(...arguments),this.open=!1,this.dismissable=!0,this.hideBackdrop=!1,this.title="",this.closeOnEscape=!0,this.closeOnOutsideClick=!0,this.clickHandler=async e=>{const n=await this.dialogElement;!this.dismissable||!this.closeOnOutsideClick||n===e.target&&(this.open=!1)},this._handleKeyDown=e=>{this.closeOnEscape||e.preventDefault(),this.open&&this.closeOnEscape&&e.key==="Escape"&&(this.open=!1)},this._onClose=e=>{e.preventDefault(),e.stopPropagation(),this.open=!1,this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}}static display(e,n){let i=document.createElement(_t);i.addEventListener("close",()=>{i.remove()});for(let t in e)i[t]=e[t];let o=document.createDocumentFragment();return Ge(n,o),i.appendChild(o),i.open=!0,document.body.appendChild(i),i}connectedCallback(){super.connectedCallback(),this.dialogElement.then(e=>e.addEventListener("keydown",this._handleKeyDown))}disconnectedCallback(){super.disconnectedCallback(),this.dialogElement.then(e=>e.removeEventListener("keydown",this._handleKeyDown))}updated(e){e.has("open")&&this.dialogElement.then(n=>{this.open?n.showModal():n.close()})}render(){return S`
|
|
775
798
|
<dialog class=${this.hideBackdrop?"":"backdrop"} @close=${this._onClose} @click=${this.clickHandler}>
|
|
776
799
|
<spectric-panel>
|
|
777
800
|
<div class="modal">
|
|
778
|
-
${this.dismissable?
|
|
801
|
+
${this.dismissable?S`<spectric-button variant="text" size="small" @click=${()=>{this.open=!1}}>X</spectric-button>`:null}
|
|
779
802
|
<h3 >
|
|
780
803
|
<slot name="title">
|
|
781
804
|
${this.title.length?this.title:null}
|
|
@@ -787,17 +810,17 @@ spectric-button{
|
|
|
787
810
|
</div>
|
|
788
811
|
</spectric-panel>
|
|
789
812
|
</dialog>
|
|
790
|
-
`}},
|
|
813
|
+
`}},h.DialogElement.styles=zo,ce([b({type:Boolean,reflect:!0})],h.DialogElement.prototype,"open",2),ce([b({type:Boolean,reflect:!0})],h.DialogElement.prototype,"dismissable",2),ce([b({type:Boolean,reflect:!0})],h.DialogElement.prototype,"hideBackdrop",2),ce([b({type:String,reflect:!0})],h.DialogElement.prototype,"title",2),ce([b({type:Boolean,reflect:!0})],h.DialogElement.prototype,"closeOnEscape",2),ce([b({type:Boolean,reflect:!0})],h.DialogElement.prototype,"closeOnOutsideClick",2),ce([dt("dialog")],h.DialogElement.prototype,"dialogElement",2),h.DialogElement=ce([O(_t)],h.DialogElement);var Ro=Object.defineProperty,Mo=Object.getOwnPropertyDescriptor,Z=(s,e,n,i)=>{for(var o=i>1?void 0:i?Mo(e,n):e,t=s.length-1,c;t>=0;t--)(c=s[t])&&(o=(i?c(e,n,o):c(o))||o);return i&&o&&Ro(e,n,o),o},fr=(s=>(s.MONGO="toMongo",s.CQL="toCql",s.DSL="toDSL",s.AST="AST",s))(fr||{});const Si={eq:{value:" : ",label:" equals some value"},gt:{value:" > ",label:" is greater than some value"},lt:{value:" < ",label:" is less than some value"},gte:{value:" >= ",label:" is greater than or equal to some value"},lte:{value:" <= ",label:" is less than or equal to some value"}},Io={eq:{value:": ",label:" equals some value"},exists:{value:": *",label:" exists in any form"}},Ho=[{value:": true",label:" value is true"},{value:": false",label:"value is false"}],Uo=Object.fromEntries(Object.entries(Si).map(([s,e])=>[s,{value:e.value,label:(e.label||"").replace("value","date-time")}]));h.SpectricQuery=class extends D{constructor(){super(),this.placeholder="",this._value="",this.value="",this.outputLanguage="AST",this.completions=[],this.completionIndex=0,this.fields=[],this._parseQuery=(e=void 0)=>{let n;if(e&&(e!=null&&e.currentTarget)&&(this.value=e.currentTarget.value),this.value)try{e&&e.data=="("&&(this.value=this.value+" )",this._input.setSelectionRange(this.value.length-2,this.value.length-2));let t=this.value;this._input.selectionStart!==null&&(t=t.substring(0,this._input.selectionStart)+"@kuery-cursor@"+t.substring(this._input.selectionStart));let c=wt(t,{parseCursor:!0,cursorSymbol:"@kuery-cursor@",allowLeadingWildcards:!1});this.autoComplete(c)}catch{return}try{n=wt(this.value,{allowLeadingWildcards:!1})}catch{return}let i;this.outputLanguage=="AST"?i=n:i=No[this.outputLanguage](n,this.fields);let o=new CustomEvent("change",{detail:i});this.dispatchEvent(o)},this.getValuesForField=async(e,n)=>(console.log("getValuesForField isn't set no values returned",e,n),[]),this._selectCompletion=async()=>{if(!this.suggestion)return;let e=this.completions[this.completionIndex],n=this.value.substring(0,e.start)+e.value,i=n.length,o=this.value.substring(e.end);if(e.value.includes(o)?this.value=n:this.value=n+this.value.substring(e.end),this._input.value=this.value,this._input.setSelectionRange(i,i),e.onSelect){let t=await e.onSelect();t!==void 0&&(this.value+=t,setTimeout(()=>{this._input.focus()}))}this.completionIndex=0,this.completions=[],this._parseQuery(),this._input.focus()},this._handleArrows=e=>{var n;e.key==="Escape"&&(this.completions=[]),(e.key=="ArrowLeft"||e.key==="ArrowRight")&&setTimeout(this._parseQuery,100),this.completions.length&&["ArrowUp","ArrowDown","Enter","Tab"].includes(e.key)&&this.suggestion&&(e.preventDefault(),(e.key==="ArrowDown"||e.key==="Tab")&&(this.completionIndex+=1,this.completionIndex>this.completions.length-1&&(this.completionIndex=0)),e.key==="ArrowUp"&&(this.completionIndex-=1,this.completionIndex<0&&(this.completionIndex=this.completions.length-1)),(n=this._asyncAutocomplete)==null||n.then(i=>{let o=i.querySelector(".option.active");o&&o.scrollIntoView({block:"nearest"})}),e.key==="Enter"&&this._selectCompletion())},this.uuid=crypto.randomUUID()}createRenderRoot(){return this}async autoComplete(e){if(this.completions=[],e.type!=="cursor")return;let n=[];this.suggestion=e;let{start:i,end:o}=e;for(let t of e.suggestionTypes){if(t=="conjunction"&&e.text.endsWith(" ")&&n.push(...["and ","or "].map(c=>({type:t,value:c,start:o,end:o}))),t==="field"){let c=this.fields.filter(d=>d.name.includes(e.fieldName)||d.name.includes(e.prefix)).map(d=>[{type:t,value:d.name,start:i,end:o}]).flat();n.push(...c)}if(t==="operator"){let c=this.fields.find(d=>d.name===e.fieldName);c&&(c.type==="number"?n.push(...Object.values(Si).map(d=>({type:t,...d,start:o,end:o}))):c.type==="string"?c.format==="date-time"?n.push(...Object.values(Uo).map(d=>({type:t,...d,start:o,end:o,onSelect:async()=>{let f=await this.getValuesForField(e.fieldName,e.prefix);f.length===0&&(f=["now-1m","now-1d","now-1M"]);let y,x=tt();return await new Promise($=>{let E=h.DialogElement.display({},S`
|
|
791
814
|
<div class="query-bar-date-quick-select">
|
|
792
|
-
${
|
|
815
|
+
${f.map(C=>S`<a href="#" @click=${k=>{k.preventDefault(),y=`"${C}"`,$(y),E.open=!1}}>${C}</a>`)}
|
|
793
816
|
</div>
|
|
794
|
-
<spectric-input variant="datetime-local" @change=${
|
|
795
|
-
<spectric-button ${
|
|
796
|
-
`)})
|
|
797
|
-
<spectric-input .value=${this.value} .placeholder=${this.placeholder} style=${`anchor-name:--${this.uuid};`} autocomplete="off" @input=${this._parseQuery} @keydown=${this._handleArrows} @change=${
|
|
817
|
+
<spectric-input variant="datetime-local" @change=${C=>{if(!C.target)return;y=`"${new Date(C.target.value+":00.000Z").toISOString()}"`,x.value.disabled=y===void 0}}></spectric-input>
|
|
818
|
+
<spectric-button ${rt(x)} .disabled=${!0} @click=${()=>{$(y),E.open=!1}}>Submit</spectric-button>
|
|
819
|
+
`)}),y}}))):n.push(...Object.values(Io).map(d=>({type:t,...d,start:o,end:o}))):c.type==="boolean"&&n.push(...Ho.map(d=>({type:t,...d,start:o,end:o}))))}if(t==="value"){let c=this.fields.find(d=>d.name===e.fieldName);if(c&&c.type=="boolean")n.push({type:t,value:"true",start:i,end:o},{type:t,value:"false",start:i,end:o});else{console.log(`invoke callback to get values for ${e.fieldName}`);let d=await this.getValuesForField(e.fieldName,e.prefix);(c==null?void 0:c.type)==="string"&&(d=d.map(f=>`"${f}"`)),n.push(...d.map(f=>({type:t,value:f,start:i,end:o})))}}}if(this.completions=n,this.completions.length&&this._autocomplete){let{width:t,left:c,bottom:d}=this._input.getBoundingClientRect();this._autocomplete.showPopover(),"anchorName"in document.documentElement.style||(this._autocomplete.style.left=`${c+3.75}px`,this._autocomplete.style.top=`${d}px`),this._autocomplete.style.width=`${t-15}px`}}updated(e){e.has("outputLanguage")&&this._parseQuery()}render(){return S`
|
|
820
|
+
<spectric-input .value=${this.value} .placeholder=${this.placeholder} style=${`anchor-name:--${this.uuid};`} autocomplete="off" @input=${this._parseQuery} @keydown=${this._handleArrows} @change=${e=>e.stopPropagation()}></spectric-input>
|
|
798
821
|
<div class="autocomplete" popover style=${`position-anchor: --${this.uuid};`}>
|
|
799
|
-
${this.completions.map((
|
|
800
|
-
</div>`}},
|
|
822
|
+
${this.completions.map((e,n)=>S`<div @click=${()=>{this.completionIndex=n,this._selectCompletion()}} class=${this.completionIndex==n?"option active":"option"}><span class="optiontype ${e.type}">${e.type}</span> <span class="value">${e.value}</span> <span class="label">${e.label}</span></span> </div></div>`)}
|
|
823
|
+
</div>`}},Z([b({type:String,reflect:!0})],h.SpectricQuery.prototype,"placeholder",2),Z([b({type:String,reflect:!0})],h.SpectricQuery.prototype,"value",2),Z([b({type:String,reflect:!0})],h.SpectricQuery.prototype,"outputLanguage",2),Z([F()],h.SpectricQuery.prototype,"completions",2),Z([F()],h.SpectricQuery.prototype,"completionIndex",2),Z([b({type:Array,reflect:!0})],h.SpectricQuery.prototype,"fields",2),Z([ye(".autocomplete")],h.SpectricQuery.prototype,"_autocomplete",2),Z([dt(".autocomplete")],h.SpectricQuery.prototype,"_asyncAutocomplete",2),Z([ye("spectric-input")],h.SpectricQuery.prototype,"_input",2),h.SpectricQuery=Z([O("spectric-query")],h.SpectricQuery);const Ai=I`
|
|
801
824
|
border-color: color-mix(in hsl, var(--panel-color, #0b0b0b), var(--spectric-input-color, #000000) 3%);
|
|
802
825
|
background-color: var(--panel-color,#0b0b0b);
|
|
803
826
|
--spectric-input-color: var(--spectric-background);
|
|
@@ -805,7 +828,7 @@ spectric-button{
|
|
|
805
828
|
--spectric-text-primary:var(--text-primary);
|
|
806
829
|
--spectric-text-secondary:var(--text-secondary);
|
|
807
830
|
filter: drop-shadow(0px 1px 3px color-mix(in srgb, var(--text-secondary, #3c4c5b), transparent 50%));
|
|
808
|
-
`,
|
|
831
|
+
`,xi=I`
|
|
809
832
|
border-color: color-mix(in hsl, var(--panel-color-inverse,#f4f4f4), var(--spectric-input-color, #000000) 3%);
|
|
810
833
|
background-color: var(--panel-color-inverse,#0b0b0b);
|
|
811
834
|
color:var(--text-primary,#3c4c5b);
|
|
@@ -813,7 +836,7 @@ spectric-button{
|
|
|
813
836
|
--spectric-text-primary:var(--text-secondary);
|
|
814
837
|
--spectric-text-secondary:var(--text-primary);
|
|
815
838
|
filter: drop-shadow(0px 1px 3px color-mix(in srgb, var(--text-primary, #3c4c5b), transparent 70%));
|
|
816
|
-
`,
|
|
839
|
+
`,Fo=I`
|
|
817
840
|
:host{
|
|
818
841
|
display:block;
|
|
819
842
|
border:2px solid black;
|
|
@@ -823,20 +846,20 @@ spectric-button{
|
|
|
823
846
|
|
|
824
847
|
}
|
|
825
848
|
:host(spectric-panel[level='0']) {
|
|
826
|
-
${
|
|
849
|
+
${Ai};
|
|
827
850
|
}
|
|
828
851
|
|
|
829
852
|
:host(spectric-panel[level='1']) {
|
|
830
|
-
${
|
|
853
|
+
${xi};
|
|
831
854
|
}
|
|
832
855
|
|
|
833
856
|
:host(spectric-panel[level='2']) {
|
|
834
|
-
${
|
|
857
|
+
${Ai};
|
|
835
858
|
}
|
|
836
859
|
:host(spectric-panel[level='3']) {
|
|
837
|
-
${
|
|
860
|
+
${xi};
|
|
838
861
|
}
|
|
839
|
-
`;var
|
|
862
|
+
`;var Qo=Object.defineProperty,qo=Object.getOwnPropertyDescriptor,gr=(s,e,n,i)=>{for(var o=i>1?void 0:i?qo(e,n):e,t=s.length-1,c;t>=0;t--)(c=s[t])&&(o=(i?c(e,n,o):c(o))||o);return i&&o&&Qo(e,n,o),o};h.SpectricPanel=class extends D{constructor(){super(...arguments),this.level=0}updated(){this.layers||(this.layers=this.querySelectorAll("spectric-panel")),this.layers.forEach(e=>{e.setAttribute("level",((this.level+1)%4).toString())}),this.dispatchEvent(new CustomEvent("use-layer",{bubbles:!0,cancelable:!0,composed:!0,detail:{layer:this,level:this.level}}))}render(){return S` <slot></slot> `}},h.SpectricPanel.styles=Fo,gr([b({type:Number,reflect:!0})],h.SpectricPanel.prototype,"level",2),gr([b({attribute:!1})],h.SpectricPanel.prototype,"layers",2),h.SpectricPanel=gr([O("spectric-panel")],h.SpectricPanel);var Wo=Object.defineProperty,Vo=Object.getOwnPropertyDescriptor,Ci=(s,e,n,i)=>{for(var o=i>1?void 0:i?Vo(e,n):e,t=s.length-1,c;t>=0;t--)(c=s[t])&&(o=(i?c(e,n,o):c(o))||o);return i&&o&&Wo(e,n,o),o};const Ei={"--primary":{control:"color"},"--secondary":{control:"color"},"--tertiary":{control:"color"},"--disabled":{control:"color"},"--background":{control:"color"},"--background-inverse":{control:"color"},"--text-primary":{control:"color"},"--text-secondary":{control:"color"},"--text-on-color":{control:"color"},"--border-radius":{control:"text"}},ki={"--secondary":"#77878b","--tertiary":"#c7c7c7","--disabled":"#000000","--text-primary":"#cccccc","--text-secondary":"#cccccc","--text-on-color":"#ededed","--background":"#181818","--background-inverse":"#37373d"},Pi={...ki,"--primary":"#ffd45a","--text-on-color":"#4f4f4f"},vr={undefined:{},light:{},dark:ki,spectric:Pi,spectricFlat:{...Pi,"--border-radius":"1px"}},Ti=Object.fromEntries(Object.keys(vr).map(s=>[s,s])),Yo=`
|
|
840
863
|
--spectric-background: var(--background,#ffffff);
|
|
841
864
|
--spectric-background-hover:var(--background-hover,rgba(141, 141, 141, 0.12));
|
|
842
865
|
--spectric-background-inverse: var(--background-inverse,#f4f4f4);
|
|
@@ -879,12 +902,12 @@ spectric-button{
|
|
|
879
902
|
--spectric-text-on-color-disabled: var(--disabled,#c6c6c6)
|
|
880
903
|
--spectric-button-disabled: #c6c6c6;
|
|
881
904
|
color: var(--spectric-text-primary);
|
|
882
|
-
`;
|
|
883
|
-
`);return
|
|
884
|
-
${this.theme&&this.theme!=="light"?
|
|
905
|
+
`;h.SpectricThemeProvider=class extends D{constructor(){super(...arguments),this.theme="undefined"}updated(e){if(e.has("theme")&&this.theme!=e.get("theme")){const n={old:e.get("theme"),new:this.theme};this.dispatchEvent(new CustomEvent("theme-change",{detail:n,bubbles:!0,composed:!0}))}}render(){let e=Object.keys(vr).includes(this.theme)?this.theme:"undefined",n=Object.entries(vr[e]).map(i=>`${i[0]}:${i[1]};`).join(`
|
|
906
|
+
`);return S`
|
|
907
|
+
${this.theme&&this.theme!=="light"?S`
|
|
885
908
|
<style>:host{
|
|
886
|
-
${
|
|
887
|
-
${
|
|
909
|
+
${n};
|
|
910
|
+
${Yo}
|
|
888
911
|
}
|
|
889
912
|
/* Webkit psudo elements don't pick up variables defined by the host */
|
|
890
913
|
::-webkit-scrollbar-thumb {
|
|
@@ -955,9 +978,9 @@ spectric-button{
|
|
|
955
978
|
}
|
|
956
979
|
</style>`:null}
|
|
957
980
|
<slot></slot>
|
|
958
|
-
`}},
|
|
981
|
+
`}},h.SpectricThemeProvider.styles=I`:host{
|
|
959
982
|
display:contents;
|
|
960
|
-
}`,
|
|
983
|
+
}`,Ci([b({reflect:!0})],h.SpectricThemeProvider.prototype,"theme",2),h.SpectricThemeProvider=Ci([O("spectric-theme")],h.SpectricThemeProvider);const Ko=I`
|
|
961
984
|
:host {
|
|
962
985
|
display: block;
|
|
963
986
|
height: 100%;
|
|
@@ -1020,7 +1043,7 @@ spectric-button{
|
|
|
1020
1043
|
width: 5px;
|
|
1021
1044
|
cursor: ew-resize;
|
|
1022
1045
|
}
|
|
1023
|
-
`;var
|
|
1046
|
+
`;var Zo=Object.defineProperty,Xo=Object.getOwnPropertyDescriptor,H=(s,e,n,i)=>{for(var o=i>1?void 0:i?Xo(e,n):e,t=s.length-1,c;t>=0;t--)(c=s[t])&&(o=(i?c(e,n,o):c(o))||o);return i&&o&&Zo(e,n,o),o},br=(s=>(s.horizontal="horizontal",s.vertical="vertical",s))(br||{});const mr="spectric-splitview";h.SplitView=class extends ae{constructor(){super(),this.orientation="horizontal",this.percentage=50,this.invisible=!1,this.min=10,this.max=90,this.useSavedState=!0,this.isDragging=!1,this._error=!1,this._emitChange=()=>{let{percentage:n,orientation:i,invisible:o,min:t,max:c,useSavedState:d}=this,f=this.getAttribute("id");f&&this.useSavedState&&localStorage.setItem(`splitview-${f}`,String(n)),this.dispatchEvent(new CustomEvent("change",{detail:{orientation:i,percentage:n,invisible:o,min:t,max:c,useSavedState:d}}))},this._onMouseMove=gt(n=>{if(this.isDragging){const i=this.getBoundingClientRect();let o,t;this.orientation==="horizontal"?(o=n.clientX-i.left,t=o/i.width*100):(o=n.clientY-i.top,t=o/i.height*100),t=Math.min(Math.max(t,this.min),this.max),this.percentage=t,this._emitChange()}}),this._assignSlot=n=>{if(!n.target)return;let o=n.target.assignedNodes().filter(t=>t instanceof HTMLElement);o.length>2&&console.log("cannot assign more than 2 elements to a split view"),o.forEach(t=>{if(this._panel1.assignedNodes().length===0){t.slot="panel1";return}if(this._panel2.assignedNodes().length===0){t.slot="panel2";return}this._error="Too many element assigned to split view splitter can only have a maximum of 2 children",console.warn("Too many element assigned to split view splitter can only have a maximum of 2 children")})};let e=this.getAttribute("id");if(e&&this.useSavedState){let n=localStorage.getItem(`splitview-${e}`);n&&(this.percentage=parseFloat(n))}this.addDisposableListener(this._splitter,"mousedown",()=>{this.isDragging=!0}),this.addDisposableListener(this._splitter,"dblclick",()=>{this.percentage=50,this._emitChange()}),this.addDisposableListener(document.body,"mousemove",this._onMouseMove),this.addDisposableListener(document.body,"mouseup",()=>{this.isDragging=!1})}updated(e){e.has("percentage")&&(this.percentage=Math.min(Math.max(Number(this.percentage),this.min),this.max))}render(){return S`
|
|
1024
1047
|
<div class="split-view ${this.orientation} ${this._error?"error":""} ${this.isDragging?"active":""}" style="--split-percentage: ${this.percentage}%;">
|
|
1025
1048
|
<span class="error-display">${this._error}</span>
|
|
1026
1049
|
<div class="panel" style="${this.orientation==="horizontal"?"flex: var(--split-percentage, 50%)":"max-height: var(--split-percentage, 50%)"}">
|
|
@@ -1032,15 +1055,15 @@ spectric-button{
|
|
|
1032
1055
|
</div>
|
|
1033
1056
|
</div>
|
|
1034
1057
|
<slot @slotchange=${this._assignSlot} style="display:none"></slot>
|
|
1035
|
-
`}},
|
|
1058
|
+
`}},h.SplitView.styles=Ko,H([b({type:String})],h.SplitView.prototype,"orientation",2),H([b({type:Number,reflect:!0})],h.SplitView.prototype,"percentage",2),H([b({type:Boolean})],h.SplitView.prototype,"invisible",2),H([b({type:Number,reflect:!0})],h.SplitView.prototype,"min",2),H([b({type:Number,reflect:!0})],h.SplitView.prototype,"max",2),H([b({type:Boolean,reflect:!0})],h.SplitView.prototype,"useSavedState",2),H([F()],h.SplitView.prototype,"isDragging",2),H([F()],h.SplitView.prototype,"_error",2),H([dt(".splitter")],h.SplitView.prototype,"_splitter",2),H([ye("slot[name='panel1']")],h.SplitView.prototype,"_panel1",2),H([ye("slot[name='panel2']")],h.SplitView.prototype,"_panel2",2),h.SplitView=H([O(mr)],h.SplitView);var Go=Object.defineProperty,Jo=Object.getOwnPropertyDescriptor,Ce=(s,e,n,i)=>{for(var o=i>1?void 0:i?Jo(e,n):e,t=s.length-1,c;t>=0;t--)(c=s[t])&&(o=(i?c(e,n,o):c(o))||o);return i&&o&&Go(e,n,o),o};const yr="spectric-pagination";console.log("Pagination"),h.PaginationElement=class extends D{constructor(){super(...arguments),this.page=1,this.pageSize=10,this.pageSizeOptions=[10,20,50,100,1e3],this.size="xsmall",this._handlePageUp=()=>{this.page+=1,this._emitChange()},this._handlePageDown=()=>{this.page-=1,this._emitChange()},this._handleSizeChange=e=>{e.stopPropagation(),e.preventDefault();let n=parseInt(e.target.value);this.pageSize=n,this._emitChange()},this._emitChange=()=>{let{page:e,pageSize:n}=this;this.dispatchEvent(new CustomEvent("change",{detail:{page:e,pageSize:n}}))}}createRenderRoot(){return this}updated(e){e.has("pageSize")&&!this.pageSizeOptions.includes(this.pageSize)&&(this.pageSizeOptions=[...this.pageSizeOptions,this.pageSize].sort((n,i)=>n-i),requestAnimationFrame(()=>{this.select&&this.select.value!==String(this.pageSize)&&(this.select.value=String(this.pageSize))}))}render(){let e=this.page*this.pageSize,n=!0;this.totalItems&&e<this.totalItems&&(n=!1);let i="";return this.totalItems&&(i=`${this.page} of ${Math.ceil(this.totalItems/this.pageSize)}`),S`
|
|
1036
1059
|
<div class="spectric-pagination-container">
|
|
1037
1060
|
<div>
|
|
1038
1061
|
<!-- TODO/FIXME Make a select component and use it for cross browser styling-->
|
|
1039
1062
|
<select @change=${this._handleSizeChange} .value=${String(this.pageSize)}>
|
|
1040
|
-
${this.pageSizeOptions.map(
|
|
1063
|
+
${this.pageSizeOptions.map(o=>S`<option .value=${String(o)} class=${String(o)===String(this.pageSize)?"selected":""}>${o}</option>`)}
|
|
1041
1064
|
</select>
|
|
1042
1065
|
</div>
|
|
1043
|
-
${this.totalItems?
|
|
1066
|
+
${this.totalItems?S`
|
|
1044
1067
|
<div class="spectric-pagination-text">${`Items ${(this.page-1)*this.pageSize}-${Math.min(this.page*this.pageSize,this.totalItems)} of ${this.totalItems}`}</div>
|
|
1045
1068
|
<div class="spectric-pagination-container">
|
|
1046
1069
|
<div>
|
|
@@ -1048,76 +1071,104 @@ spectric-button{
|
|
|
1048
1071
|
</div>
|
|
1049
1072
|
<div>
|
|
1050
1073
|
<spectric-button size=${this.size} ?disabled=${this.page===1} @click=${this._handlePageDown} icon>🠈</spectric-button>
|
|
1051
|
-
<spectric-button size=${this.size} ?disabled=${
|
|
1074
|
+
<spectric-button size=${this.size} ?disabled=${n} @click=${this._handlePageUp} icon>🠊</spectric-button>
|
|
1052
1075
|
</div>
|
|
1053
1076
|
</div>
|
|
1054
1077
|
`:null}
|
|
1055
1078
|
</div>
|
|
1056
|
-
`}}
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1079
|
+
`}},Ce([b({type:Number,reflect:!0})],h.PaginationElement.prototype,"page",2),Ce([b({type:Number,reflect:!0})],h.PaginationElement.prototype,"pageSize",2),Ce([b({type:Number,reflect:!0})],h.PaginationElement.prototype,"totalItems",2),Ce([b({type:Array})],h.PaginationElement.prototype,"pageSizeOptions",2),Ce([ye("select")],h.PaginationElement.prototype,"select",2),Ce([b({type:String,reflect:!0})],h.PaginationElement.prototype,"size",2),h.PaginationElement=Ce([O(yr)],h.PaginationElement);const ea=Object.freeze(Object.defineProperty({__proto__:null,BitArray:sr,DisposableElement:ae,getListeners:hi},Symbol.toStringTag,{value:"Module"}));var ta=Object.defineProperty,ra=Object.getOwnPropertyDescriptor,$r=(s,e,n,i)=>{for(var o=i>1?void 0:i?ra(e,n):e,t=s.length-1,c;t>=0;t--)(c=s[t])&&(o=(i?c(e,n,o):c(o))||o);return i&&o&&ta(e,n,o),o};const ia="spectric-table-header";let St=class extends ae{constructor(){super(),this.columns=[],this._handleSortChange=s=>{this._resizeStart||(s=JSON.parse(JSON.stringify(s)),s.sortable&&(s.sortDirection===B.none||s.sortDirection===void 0?s.sortDirection=B.ascending:s.sortDirection===B.ascending?s.sortDirection=B.descending:s.sortDirection===B.descending&&(s.sortDirection=B.none),this.dispatchEvent(new CustomEvent("sortChange",{composed:!0,bubbles:!0,detail:s}))))},this._handleResizeStart=(s,e)=>{this._resizeStart={event:s,column:e}},this._handleResizeEnd=s=>{var i;if(!this._resizeStart)return;let e=s.pageX-((i=this._resizeStart)==null?void 0:i.event.pageX),n=this._resizeStart.column.width;if(console.log(e),this._resizeStart.column.width)this._resizeStart.column.width=this._resizeStart.column.width+e;else{let o=this._resizeStart.event.target.closest("td");this._resizeStart.column.width=o.getBoundingClientRect().width+e}console.log(n,this._resizeStart.column.width),this.dispatchEvent(new CustomEvent("columnResize",{detail:this._resizeStart.column})),requestAnimationFrame(()=>{if(this._resizeStart=void 0,window.getSelection){let o=window.getSelection();o&&o.removeAllRanges()}})},this.addDisposableListener(()=>document.body,"mouseup",this._handleResizeEnd)}createRenderRoot(){return this}render(){return S`
|
|
1080
|
+
<tr>
|
|
1081
|
+
${this.columns.map(s=>this.renderCell(s))}
|
|
1082
|
+
</tr>
|
|
1083
|
+
`}renderCell(s){let e=["header-contents"];s.filterable,s.sortable&&e.push("sortable"),this._resizeStart&&e.push("resizing");let n=s.width?`min-width:${s.width}px;max-width:${s.width}px;`:"",i=s.sortDirection===B.ascending?"🠉":s.sortDirection==B.descending?"🠋":"",o=s.sortDirection||B.none,c=s.allowResize||s.allowResize===void 0?S`<div
|
|
1084
|
+
class="header-resize-handle"
|
|
1085
|
+
@mousedown=${d=>{this._handleResizeStart(d,s)}}
|
|
1086
|
+
@mouseup=${this._handleResizeEnd}
|
|
1087
|
+
></div>`:null;return S` <td
|
|
1088
|
+
@click=${()=>this._handleSortChange(s)}
|
|
1089
|
+
style="${n}"
|
|
1090
|
+
>
|
|
1091
|
+
${c}
|
|
1092
|
+
<div class=${e.join(" ")}>
|
|
1093
|
+
${s.title||s.key}
|
|
1094
|
+
<span class="sort-direction ${o}">${i}</span>
|
|
1095
|
+
</div>
|
|
1096
|
+
</td>`}};$r([b({type:Array,attribute:!1})],St.prototype,"columns",2),$r([F()],St.prototype,"_resizeStart",2),St=$r([O(ia)],St);/**
|
|
1066
1097
|
* @license
|
|
1067
1098
|
* Copyright 2017 Google LLC
|
|
1068
1099
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1069
|
-
*/const
|
|
1100
|
+
*/const Oi=s=>pn(s)?s._$litType$.h:s.strings,sa=Je(class extends ht{constructor(s){super(s),this.et=new WeakMap}render(s){return[s]}update(s,[e]){const n=fi(this.it)?Oi(this.it):null,i=fi(e)?Oi(e):null;if(n!==null&&(i===null||n!==i)){const o=tr(s).pop();let t=this.et.get(n);if(t===void 0){const c=document.createDocumentFragment();t=Ge(P,c),t.setConnected(!1),this.et.set(n,t)}er(t,[o]),$e(t,void 0,o)}if(i!==null){if(n===null||n!==i){const o=this.et.get(i);if(o!==void 0){const t=tr(o).pop();dn(s),$e(s,void 0,t),er(s,[t])}}this.it=e}else this.it=void 0;return this.render(e)}});var na=Object.defineProperty,oa=Object.getOwnPropertyDescriptor,je=(s,e,n,i)=>{for(var o=i>1?void 0:i?oa(e,n):e,t=s.length-1,c;t>=0;t--)(c=s[t])&&(o=(i?c(e,n,o):c(o))||o);return i&&o&&na(e,n,o),o};const aa="spectric-table-cell";let Ee=class extends D{constructor(){super(...arguments),this.overflow="",this.styleRules={whiteSpace:"",width:""},this._handleFilterOut=()=>{let s;this.column.key&&typeof this.row=="object"&&(s=Be(this.row,this.column.key)),this._emitFilter({include:!1,row:this.row,value:s,column:this.column})},this._handleFilterFor=()=>{let s;this.column.key&&typeof this.row=="object"&&(s=Be(this.row,this.column.key)),this._emitFilter({include:!0,row:this.row,value:s,column:this.column})},this._displayTooltip=()=>{let s=this.querySelector("div.cell-contents"),e=this.querySelector("span");if(s&&e){let n=e.getBoundingClientRect(),i=s.getBoundingClientRect();n.width*n.height>i.width*i.height?(console.log("We need to show a tooltip witht he content because we are overflowing"),this.overflow=this.getRenderedValue(),this.updateComplete.then(()=>{let o=this.querySelector("spectric-tooltip");o&&o.showToolTip()})):this.overflow=""}}}createRenderRoot(){return this}updated(s){}_emitFilter(s){this.dispatchEvent(new CustomEvent("filter",{composed:!0,bubbles:!0,detail:s}))}getRenderedValue(){let s;return this.column.render?s=this.column.render(this.row,this.index,this.table):this.column.key&&typeof this.row=="object"?s=Be(this.row,this.column.key):s=S`error`,s}render(){let s=this.getRenderedValue(),e=["cell-contents"];this.column.filterable&&e.push("filterable");let n=sa(this.column.filterable?S`<div class="table-cell-actions">
|
|
1070
1101
|
<spectric-button @click=${this._handleFilterOut} size="tiny" variant="text" icon tooltip="Filter Out Value">-</spectric-button>
|
|
1071
|
-
<spectric-button @click=${this._handleFilterFor} size="tiny" variant="text" icon tooltip="Filter For Value">+</spectric-button></div>`:null);return this.styleRules={width:this.column.width?this.column.width+"px":
|
|
1072
|
-
<td style=${
|
|
1073
|
-
${
|
|
1074
|
-
<div class=${
|
|
1102
|
+
<spectric-button @click=${this._handleFilterFor} size="tiny" variant="text" icon tooltip="Filter For Value">+</spectric-button></div>`:null);return this.styleRules={width:this.column.width?this.column.width+"px":null,whiteSpace:this.column.whiteSpace||null},S`
|
|
1103
|
+
<td style=${Zt(this.styleRules)} @mouseenter=${this._displayTooltip}>
|
|
1104
|
+
${n}
|
|
1105
|
+
<div class=${e.join(" ")}>${this.overflow?S`<spectric-tooltip .text=${this.overflow}></spectric-tooltip>`:null}<span>${s}</span></div>
|
|
1075
1106
|
</td>
|
|
1076
|
-
`}};
|
|
1107
|
+
`}};je([b({type:Object,attribute:!1})],Ee.prototype,"row",2),je([b({type:Number,attribute:!1})],Ee.prototype,"index",2),je([b({type:Object,attribute:!1})],Ee.prototype,"column",2),je([F()],Ee.prototype,"overflow",2),je([ye("td")],Ee.prototype,"td",2),Ee=je([O(aa)],Ee);const Be=(s,e)=>{let n=e.split("."),i=s[n[0]];return i==null||n.length>1&&(i=Be(i,n.slice(1).join("."))),i};/**
|
|
1077
1108
|
* @license
|
|
1078
1109
|
* Copyright 2017 Google LLC
|
|
1079
1110
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
1080
|
-
*/const
|
|
1111
|
+
*/const Di=(s,e,n)=>{const i=new Map;for(let o=e;o<=n;o++)i.set(s[o],o);return i},At=Je(class extends ht{constructor(s){if(super(s),s.type!==Kt.CHILD)throw Error("repeat() can only be used in text expressions")}dt(s,e,n){let i;n===void 0?n=e:e!==void 0&&(i=e);const o=[],t=[];let c=0;for(const d of s)o[c]=i?i(d,c):c,t[c]=n(d,c),c++;return{values:t,keys:o}}render(s,e,n){return this.dt(s,e,n).values}update(s,[e,n,i]){const o=tr(s),{values:t,keys:c}=this.dt(e,n,i);if(!Array.isArray(o))return this.ut=c,t;const d=this.ut??(this.ut=[]),f=[];let y,x,$=0,E=o.length-1,C=0,k=t.length-1;for(;$<=E&&C<=k;)if(o[$]===null)$++;else if(o[E]===null)E--;else if(d[$]===c[C])f[C]=we(o[$],t[C]),$++,C++;else if(d[E]===c[k])f[k]=we(o[E],t[k]),E--,k--;else if(d[$]===c[k])f[k]=we(o[$],t[k]),$e(s,f[k+1],o[$]),$++,k--;else if(d[E]===c[C])f[C]=we(o[E],t[C]),$e(s,o[$],o[E]),E--,C++;else if(y===void 0&&(y=Di(c,C,k),x=Di(d,$,E)),y.has(d[$]))if(y.has(d[E])){const N=x.get(c[C]),R=N!==void 0?o[N]:null;if(R===null){const M=$e(s,o[$]);we(M,t[C]),f[C]=M}else f[C]=we(R,t[C]),$e(s,o[$],R),o[N]=null;C++}else rr(o[E]),E--;else rr(o[$]),$++;for(;C<=k;){const N=$e(s,f[k+1]);we(N,t[C]),f[C++]=N}for(;$<=E;){const N=o[$++];N!==null&&rr(N)}return this.ut=c,er(s,f),oe}});var la=Object.defineProperty,ca=Object.getOwnPropertyDescriptor,wr=(s,e,n,i)=>{for(var o=i>1?void 0:i?ca(e,n):e,t=s.length-1,c;t>=0;t--)(c=s[t])&&(o=(i?c(e,n,o):c(o))||o);return i&&o&&la(e,n,o),o};const pa="spectric-table-body";let xt=class extends D{constructor(){super(...arguments),this.data=[],this.columns=[]}createRenderRoot(){return this}firstUpdated(s){this.data.length>100&&console.warn("Table is rendering excessive amounts of data to the DOM you should set rowHeight and use a virtualized scroll or use pagination")}render(){return S`
|
|
1081
1112
|
<body>
|
|
1082
|
-
${
|
|
1083
|
-
<tr class="${
|
|
1084
|
-
${
|
|
1113
|
+
${At(this.data,(s,e)=>S`
|
|
1114
|
+
<tr class="${e%2===0?"odd":""}">
|
|
1115
|
+
${At(this.columns,n=>S`<spectric-table-cell .column=${n} .index=${e} .row=${s} .columns=${this.columns}></spectric-table-cell>`)}
|
|
1085
1116
|
</tr>`)}
|
|
1086
1117
|
|
|
1087
1118
|
</body>
|
|
1088
|
-
`}};
|
|
1089
|
-
<tr style="height:${$}px" class="virtual-scroll-spacer">
|
|
1090
|
-
<td colspan="${this.columns.length}"></td></tr>`:null,x=A`
|
|
1119
|
+
`}};wr([b({type:Array,attribute:!1})],xt.prototype,"data",2),wr([b({type:Array,attribute:!1})],xt.prototype,"columns",2),xt=wr([O(pa)],xt);var ua=Object.defineProperty,ha=Object.getOwnPropertyDescriptor,it=(s,e,n,i)=>{for(var o=i>1?void 0:i?ha(e,n):e,t=s.length-1,c;t>=0;t--)(c=s[t])&&(o=(i?c(e,n,o):c(o))||o);return i&&o&&ua(e,n,o),o};const da="spectric-table-virtual-body";let Re=class extends ae{constructor(){super(),this.data=[],this.columns=[],this.rowHeight=30,this.startIndex=0,this.addDisposableListener(()=>this.table.querySelector(".table-wrapper"),"scroll",()=>{const s=this.table.querySelector(".table-wrapper").scrollTop;requestAnimationFrame(()=>{this.startIndex=Math.floor(s/this.rowHeight)})})}firstUpdated(){this.columns.forEach(s=>{s.width||console.warn("When using virtual scrolling it is recomended to set the width of the columns to prevent columns widths from jittering during scroll")})}createRenderRoot(){return this}render(){let s=this.data.length,e=10,n=this.table.querySelector("spectric-table-header").clientHeight,i=this.table.querySelector(".table-wrapper"),o=Math.max(this.startIndex-e,0);const t=Math.ceil((i.clientHeight-n)/this.rowHeight),c=Math.min(o+t+e,s),d=c-o;let f=s*this.rowHeight,y=o*this.rowHeight+(i.scrollTop-o*this.rowHeight);c===s&&(y=o*this.rowHeight);let x=d*this.rowHeight,$=f-y-x,E=this.startIndex!=0?S`
|
|
1091
1120
|
<tr style="height:${y}px" class="virtual-scroll-spacer">
|
|
1092
|
-
<td colspan="${this.columns.length}"></td></tr
|
|
1093
|
-
|
|
1121
|
+
<td colspan="${this.columns.length}"></td></tr>`:null,C=S`
|
|
1122
|
+
<tr style="height:${$}px" class="virtual-scroll-spacer">
|
|
1123
|
+
<td colspan="${this.columns.length}"></td></tr>`;return S`
|
|
1124
|
+
<div style="height:${f}px;position: absolute;overflow-x: hidden;overflow-y: hidden;z-index:-1;width:1px;"></div>
|
|
1094
1125
|
<tbody>
|
|
1095
1126
|
${E}
|
|
1096
1127
|
</tbody>
|
|
1097
|
-
<div style="display:table-row-group;max-height:${
|
|
1128
|
+
<div style="display:table-row-group;max-height:${x}px; overflow:hidden;">
|
|
1098
1129
|
|
|
1099
|
-
${
|
|
1100
|
-
<tr class="${(N+
|
|
1101
|
-
${
|
|
1130
|
+
${At(this.data.slice(Math.max(o,0),c),(k,N)=>S`
|
|
1131
|
+
<tr class="${(N+o)%2===0?"odd":""}">
|
|
1132
|
+
${At(this.columns,R=>S`<spectric-table-cell .column=${R} .row=${k} .index=${N+o} .columns=${this.columns}></spectric-table-cell>`)}
|
|
1102
1133
|
</tr>`)}
|
|
1103
1134
|
</div>
|
|
1104
1135
|
<tbody>
|
|
1105
|
-
${
|
|
1136
|
+
${$>0?C:null}
|
|
1106
1137
|
</tbody>
|
|
1107
1138
|
|
|
1108
|
-
`}};
|
|
1109
|
-
<div class="table-wrapper" style="--rowHeight:${this.
|
|
1139
|
+
`}};it([b({type:Array,attribute:!1})],Re.prototype,"data",2),it([b({type:Array,attribute:!1})],Re.prototype,"columns",2),it([b({type:Number,attribute:!1})],Re.prototype,"rowHeight",2),it([b({type:Number,state:!0})],Re.prototype,"startIndex",2),Re=it([O(da)],Re);function Li(s){let e=!1,n;return function(...i){return e||(e=!0,n=s.apply(this,i)),n}}const fa=s=>s.map(({key:e,sortDirection:n,compareFn:i})=>(o,t)=>{if(!e)return;let c=Be(o,e),d=Be(t,e);if(i)return i(o,t);if(typeof c=="number"||typeof c=="bigint"||typeof c=="boolean"){let f=c-d;return n===B.descending&&(f=f*-1),f}else if(typeof c=="string")return c.localeCompare(d)*(n===B.descending?-1:1)});var ga=Object.defineProperty,va=Object.getOwnPropertyDescriptor,X=(s,e,n,i)=>{for(var o=i>1?void 0:i?va(e,n):e,t=s.length-1,c;t>=0;t--)(c=s[t])&&(o=(i?c(e,n,o):c(o))||o);return i&&o&&ga(e,n,o),o};const _r="spectric-table";var Sr=(s=>(s.multi="multi",s.single="single",s.none="none",s))(Sr||{}),Ar=(s=>(s.multi="multi",s.single="single",s))(Ar||{}),B=(s=>(s.ascending="ascending",s.descending="descending",s.none="none",s))(B||{});h.SpectricTableElement=class extends D{constructor(){super(...arguments),this.data=[],this.columns=[],this.select="none",this.sort="single",this.sortOrder=[],this.rowHeight=25,this.fontSize=16,this._handlePaginationChange=e=>{if(this.pagination){let n={...this.pagination,...e.detail},{totalItems:i,page:o,pageSize:t}=n;i&&o&&t&&(o-1)*t>i&&(n.page=1),this.pagination=n}this.dispatchEvent(new CustomEvent("paginationChange",{detail:e.detail})),this._emitChange()},this._handleSortChange=e=>{let n=e.detail,i=this.columns.find(o=>o.key==n.key);if(!i||i.key===void 0){console.warn("Unable to find sort column");return}if(this.sort=="single"&&(this.columns.forEach(o=>{o.sortDirection="none"}),this.sortOrder=[]),i.sortDirection=n.sortDirection,!i.sortDirection||i.sortDirection==="none"){let o=this.sortOrder.findIndex(t=>t===i.key);o!==-1&&this.sortOrder.splice(o,1)}else this.sortOrder.findIndex(t=>t===i.key)===-1&&(this.sortOrder=[...this.sortOrder,i.key]);this.columns=[...this.columns],this._emitChange()},this._handleColumnResize=e=>{let n=e.detail,i=this.columns.findIndex(o=>o.key==n.key);this.columns[i]={...this.columns[i]},this.columns=[...this.columns],this._emitChange()},this._emitChange=()=>{let{pagination:e,columns:n,sortOrder:i}=this;this.dispatchEvent(new CustomEvent("change",{detail:{pagination:e,columns:n,sortOrder:i}}))},this.__DO_NOT_USE_filter=()=>{this.dispatchEvent(new CustomEvent("filter")),this.dispatchEvent(new CustomEvent("sortChange"))},this.selected=[],this._handleSelectAllChange=e=>{e.stopPropagation(),e.target.checked?this.selectAll():this.deselectAll()}}static getDefaultDataSorterAndPaginatior(e){return n=>{let i=(n.sortOrder||[]).map(d=>n.columns.find(f=>f.key===d)),o=[...e];if(i.length){let d=fa(i);o.sort((f,y)=>{for(let x of d){let $=x(f,y);if($)return $}return 0})}if(!n.pagination)return o;let{page:t,pageSize:c}=n.pagination;return!t||!c?o:n.pagination?o.slice((t-1)*c,t*c):o}}createRenderRoot(){return this}deselectAll(){this.selected=[],this.dispatchEvent(new CustomEvent("selected",{detail:this.selected}))}selectAll(){this.selected=[...this.data],this.dispatchEvent(new CustomEvent("selected",{detail:this.selected}))}update(e){e.has("select")&&this.select==="single"&&this.selected.length>1&&(this.selected=[this.selected[0]],this.dispatchEvent(new CustomEvent("selected",{detail:[...this.selected]}))),super.update(e)}render(){let e=this.columns.filter(o=>!o.hidden);this.select!=="none"&&e.unshift({title:this.select==="multi"?S`<spectric-input variant="checkbox" @change=${this._handleSelectAllChange} .helperText=${"Select All"}></spectric-input>`:null,render:o=>{let t=document.createElement("div"),c=this.selected.includes(o),d=S`<spectric-input variant="checkbox" class="table-checkbox-${this.select}" ${Ae({checked:c})} @change=${f=>{f.stopPropagation();let y=this.selected.findIndex(x=>x===o);if(!(f.target.checked&&y!==-1)){{if(!f.target.checked&&y===-1)return;!f.target.checked&&y!==-1&&this.selected.splice(y,1)}f.target.checked&&(this.select==="single"&&(this.selected=[]),this.selected.push(o)),this.dispatchEvent(new CustomEvent("selected",{detail:[...this.selected]}))}}}></spectric-input>`;return Ge(d,t),d}});const n=4;let i=this.rowHeight-n;return i<this.fontSize+n&&(i=this.fontSize+n),S`
|
|
1140
|
+
<div class="table-wrapper" style="--rowHeight:${i}px;--fontSize:${this.fontSize}px;--lineClamp:${Math.floor(i/this.fontSize)}">
|
|
1110
1141
|
<div role="table">
|
|
1111
|
-
<spectric-table-header .columns=${
|
|
1112
|
-
|
|
1142
|
+
<spectric-table-header .columns=${e} @sortChange=${this._handleSortChange} @columnResize=${this._handleColumnResize}></spectric-table-header>
|
|
1143
|
+
<spectric-table-virtual-body .columns=${e} .data=${this.data} .table=${this} .rowHeight=${i}></spectric-table-virtual-body>
|
|
1113
1144
|
</div>
|
|
1114
1145
|
</div>
|
|
1115
|
-
${this.pagination?
|
|
1116
|
-
`}},
|
|
1146
|
+
${this.pagination?S`<spectric-pagination ${Ae(this.pagination)} @change=${this._handlePaginationChange}></spectric-pagination>`:null}
|
|
1147
|
+
`}},X([b({type:Array,attribute:!1})],h.SpectricTableElement.prototype,"data",2),X([b({type:Object,attribute:!1})],h.SpectricTableElement.prototype,"pagination",2),X([b({attribute:!1})],h.SpectricTableElement.prototype,"columns",2),X([b({type:String,reflect:!0})],h.SpectricTableElement.prototype,"select",2),X([b({type:String,reflect:!0})],h.SpectricTableElement.prototype,"sort",2),X([b({type:Array,reflect:!1})],h.SpectricTableElement.prototype,"sortOrder",2),X([b({type:Number,reflect:!0})],h.SpectricTableElement.prototype,"rowHeight",2),X([b({type:Number,reflect:!0})],h.SpectricTableElement.prototype,"fontSize",2),X([F()],h.SpectricTableElement.prototype,"selected",2),h.SpectricTableElement=X([O(_r)],h.SpectricTableElement);var ba=Object.defineProperty,ma=Object.getOwnPropertyDescriptor,pe=(s,e,n,i)=>{for(var o=i>1?void 0:i?ma(e,n):e,t=s.length-1,c;t>=0;t--)(c=s[t])&&(o=(i?c(e,n,o):c(o))||o);return i&&o&&ba(e,n,o),o};const ya="spectric-popover";let Q=class extends ae{constructor(){super(),this.delay=100,this.animationDuration=0,this.text="",this.position="right",this.maxWidth=300,this.portalTarget=document.body,this.open=!1,this._getMousePosition=s=>{this.mouseLocation={left:s.clientX,top:s.clientY},this.position=="mouse"&&this.open&&!this.mouseframe&&(this.mouseframe=requestAnimationFrame(()=>this.positionTooltip()))},this.applyStyle=s=>{Object.entries(s).forEach(([e,n])=>{this.portalElement.style.setProperty(e,n)})},this.positionTooltip=()=>{if(!this.target)return;let s=getComputedStyle(this),e={"--spectric-primary":s.getPropertyValue("--spectric-primary"),"--spectric-background-inverse":s.getPropertyValue("--spectric-background-inverse"),"--spectric-background-hover":s.getPropertyValue("--spectric-background-hover"),"--spectric-text-on-color":s.getPropertyValue("--spectric-text-on-color"),"--spectric-border-radius":s.getPropertyValue("--spectric-border-radius")};const n=this.target.getBoundingClientRect(),i=this.portalElement.getBoundingClientRect();this.target!==document.body&&this.maxWidth&&this.maxWidth>0&&(i.width=Math.min(i.width,this.maxWidth));let o;this.position==="mouse"&&this.mouseLocation?(this.mouseframe=void 0,o={left:this.mouseLocation.left+10+"px",top:this.mouseLocation.top-i.height/2+"px"}):this.position==="top"?o={top:n.top-i.height+"px",left:n.left+n.width/2-i.width/2+"px"}:this.position==="bottom"?o={top:n.bottom+"px",left:n.left+n.width/2-i.width/2+"px"}:this.position==="left"?o={top:Math.max(0,n.top+n.height/2-i.height/2)+"px",left:n.left-i.width+"px"}:this.position==="right"?o={top:Math.max(0,n.top+n.height/2-i.height/2)+"px",left:n.right+"px"}:(o={left:"0px",top:"0px"},console.error("Unknown position... Maybe we sould implement auto?")),this.applyStyle({...e,...o}),this.position!=="mouse"&&this.portalElement.animate({opacity:[0,1]},{duration:this.animationDuration})},this.showPopover=this.showPopover.bind(this),this.hidePopover=this.hidePopover.bind(this),this.addDisposableListener(()=>this.target,"mousemove",this._getMousePosition)}get target(){return this.triggerTarget||this.parentElement}connectedCallback(){super.connectedCallback(),this.portalElement=document.createElement("div"),this.portalElement.className="spectric-tooltip-portal",console.log("connected")}disconnectedCallback(){super.disconnectedCallback(),this.portalElement.remove(),this.portalElement=void 0}hidePopover(){this.timer&&clearTimeout(this.timer),this.open=!1,this.portalElement.remove()}async showPopover(){this.timer&&clearTimeout(this.timer),await new Promise(e=>{this.timer=window.setTimeout(e,this.delay)}),this.portalElement.className=`spectric-popover-portal ${this.position}`;const s=S`<div class="tooltip-container">
|
|
1117
1148
|
<span class="tooltip-caret"></span>
|
|
1118
1149
|
<div class="tooltip-content">${this.text}</div>
|
|
1119
|
-
</div>`;
|
|
1150
|
+
</div>`;Ge(s,this.portalElement),!(!this.target||!this.target.checkVisibility())&&(this.portalTarget.appendChild(this.portalElement),this.open=!0,requestAnimationFrame(this.positionTooltip))}render(){return S`<!-- ToolTip -->`}};Q.styles=I`:host{max-height: 0px;
|
|
1120
1151
|
max-width: 0px;
|
|
1121
1152
|
display: none;
|
|
1122
|
-
pointer-events:none;}`,
|
|
1153
|
+
pointer-events:none;}`,pe([b({type:Number,reflect:!0})],Q.prototype,"delay",2),pe([b({type:Number,reflect:!0})],Q.prototype,"animationDuration",2),pe([b({type:String,reflect:!1})],Q.prototype,"text",2),pe([b({type:String,reflect:!0})],Q.prototype,"position",2),pe([b({type:Number,reflect:!0})],Q.prototype,"maxWidth",2),pe([b({attribute:!1})],Q.prototype,"portalTarget",2),pe([b({attribute:!1})],Q.prototype,"triggerTarget",2),Q=pe([O(ya)],Q);var $a=Object.defineProperty,wa=Object.getOwnPropertyDescriptor,ue=(s,e,n,i)=>{for(var o=i>1?void 0:i?wa(e,n):e,t=s.length-1,c;t>=0;t--)(c=s[t])&&(o=(i?c(e,n,o):c(o))||o);return i&&o&&$a(e,n,o),o};const xr="spectric-tooltip";var Cr=(s=>(s.top="top",s.bottom="bottom",s.left="left",s.right="right",s.mouse="mouse",s))(Cr||{});h.TooltipElement=class extends Q{constructor(){super(),this.delay=100,this.animationDuration=0,this.text="",this.position="right",this.maxWidth=300,this.portalTarget=document.body,this.open=!1,this.addDisposableListener(()=>this.target,"mouseover",this.showToolTip),this.addDisposableListener(()=>this.target,"mouseleave",this.hidePopover)}async showToolTip(){await super.showPopover(),this.portalElement.classList.add("spectric-tooltip-portal")}render(){return S`<!-- ToolTip -->`}},h.TooltipElement.styles=I`:host{max-height: 0px;
|
|
1154
|
+
max-width: 0px;
|
|
1155
|
+
display: none;
|
|
1156
|
+
pointer-events:none;}`,ue([b({type:Number,reflect:!0})],h.TooltipElement.prototype,"delay",2),ue([b({type:Number,reflect:!0})],h.TooltipElement.prototype,"animationDuration",2),ue([b({type:String,reflect:!1})],h.TooltipElement.prototype,"text",2),ue([b({type:String,reflect:!0})],h.TooltipElement.prototype,"position",2),ue([b({type:Number,reflect:!0})],h.TooltipElement.prototype,"maxWidth",2),ue([b({attribute:!1})],h.TooltipElement.prototype,"portalTarget",2),ue([b({attribute:!1})],h.TooltipElement.prototype,"triggerTarget",2),h.TooltipElement=ue([O(xr)],h.TooltipElement);var _a=Object.defineProperty,Sa=Object.getOwnPropertyDescriptor,ke=(s,e,n,i)=>{for(var o=i>1?void 0:i?Sa(e,n):e,t=s.length-1,c;t>=0;t--)(c=s[t])&&(o=(i?c(e,n,o):c(o))||o);return i&&o&&_a(e,n,o),o};let he=class extends D{constructor(){super(...arguments),this.value="#FF0000FF",this.showAlpha=!0,this.hue=0,this.alpha=1,this.saturation=1,this.lightness=1,this.canvas=tt(),this.sldown=!1,this._handleSaturationLightnessClick=s=>{if(!this.canvas.value)return;let{offsetX:e,offsetY:n}=s;this.saturation=e/this.canvas.value.width,this.lightness=(this.canvas.value.height-n)/this.canvas.value.height,this.updateValue()},this._handleHueChange=s=>{this.hue=parseInt(String(s.target.value))/100*360,s.target.style.setProperty("accent-color",`hsl(${this.hue}deg 100% 50%)`),this.renderHueSaturationGrid(),this.updateValue()},this._handleAlphaChange=s=>{this.alpha=parseInt(String(s.target.value))/100,console.log(this.alpha,s),this.updateValue()},this._handleApply=()=>{var s;console.log(this.hue,this.saturation,this.lightness,this.alpha),this.updateValue(),console.log(this.value),(s=this.querySelector("spectric-popover"))==null||s.hidePopover()},this._cancel=()=>{var s;this.original&&(this.value=this.original),(s=this.querySelector("spectric-popover"))==null||s.hidePopover()},this._openPopover=async()=>{var s;for(this.original=this.value,(s=this.querySelector("spectric-popover"))==null||s.showPopover();!this.canvas.value;)await new Promise(e=>setTimeout(e,100));this.renderHueSaturationGrid()}}createRenderRoot(){return this}update(s){if(s.has("value")){let{h:e,s:n,l:i,a:o}=Ca(this.value);this.hue=e,this.saturation=n,this.lightness=i,this.alpha=o,this.renderHueSaturationGrid()}super.update(s)}renderHueSaturationGrid(){if(console.log("canvas render"),!this.canvas.value)return;let e=this.canvas.value.getContext("2d");if(!e)return;let n=this.canvas.value.width/100,i=this.canvas.value.height/100,o=0,t=0;for(let c of Aa(this.hue))e.fillStyle=c,e.fillRect(o,t,n,i),o+=n,o=o%(n*101),o||(t+=i)}updateValue(){this.value=xa(this.hue,this.saturation*100,this.lightness*100)+Math.round(this.alpha*255).toString(16).padStart(2,"0")}getPopover(){return S`
|
|
1157
|
+
<spectric-input label="Hue" class="hue-gradient" variant="range" .value=${this.hue||0} style="accent-color:hsl(${this.hue}deg 100% 50%)" @change=${this._handleHueChange}></spectric-input>
|
|
1158
|
+
<canvas ${rt(this.canvas)} width=200 height=100 class="saturation-lightness-grid" @click=${this._handleSaturationLightnessClick}
|
|
1159
|
+
@mousedown=${()=>{this.sldown=!0}}
|
|
1160
|
+
@mouseup=${()=>this.sldown=!1}
|
|
1161
|
+
@mousemove=${s=>{this.sldown&&this._handleSaturationLightnessClick(s)}}
|
|
1162
|
+
></canvas>
|
|
1163
|
+
<spectric-input class="alpha-gradient" ?hidden=${!this.showAlpha} label="Opacity" variant="range" .value=${(this.alpha||1)*100} @change=${this._handleAlphaChange}></spectric-input>
|
|
1164
|
+
<div class="color-picker-footer">
|
|
1165
|
+
<spectric-button @click=${this._handleApply}>Apply</spectric-button>
|
|
1166
|
+
<spectric-button variant="secondary" @click=${this._cancel}>Cancel</spectric-button>
|
|
1167
|
+
</div>
|
|
1168
|
+
`}render(){return S`
|
|
1169
|
+
<spectric-button variant="text" @click=${this._openPopover}>
|
|
1170
|
+
<spectric-popover .text=${this.getPopover()} icon variant="text"></spectric-popover>
|
|
1171
|
+
<div style="width:15px;height:15px;background-color:${this.value}"></div>
|
|
1172
|
+
</spectric-button>
|
|
1173
|
+
`}};ke([b({type:String,reflect:!0})],he.prototype,"value",2),ke([b({type:Boolean,reflect:!0})],he.prototype,"showAlpha",2),ke([F()],he.prototype,"hue",2),ke([F()],he.prototype,"alpha",2),ke([F()],he.prototype,"saturation",2),ke([F()],he.prototype,"lightness",2),he=ke([O("spectric-colorpicker")],he);function*Aa(s){for(let e=100;e>=0;e--)for(let n=0;n<=100;n++)yield`hsl(${s}, ${n}%, ${e}%)`}function xa(s,e,n){n/=100;const i=e*Math.min(n,1-n)/100,o=t=>{const c=(t+s/30)%12,d=n-i*Math.max(Math.min(c-3,9-c,1),-1);return Math.round(255*d).toString(16).padStart(2,"0")};return`#${o(0)}${o(8)}${o(4)}`}function Ca(s){let e=0,n=0,i=0,o=255;s.length===4||s.length===5?(e=parseInt(s[1]+s[1],16),n=parseInt(s[2]+s[2],16),i=parseInt(s[3]+s[3],16),s.length===5&&(o=parseInt(s[4]+s[4],16))):(s.length===7||s.length===9)&&(e=parseInt(s.substring(1,3),16),n=parseInt(s.substring(3,5),16),i=parseInt(s.substring(5,7),16),s.length===9&&(o=parseInt(s.substring(7,9),16))),e/=255,n/=255,i/=255,o/=255;const t=Math.max(e,n,i),c=Math.min(e,n,i);let d=0,f=0,y=(t+c)/2;if(t===c)d=0,f=0;else{const x=t-c;switch(f=y>.5?x/(2-t-c):x/(t+c),t){case e:d=(n-i)/x+(n<i?6:0);break;case n:d=(i-e)/x+2;break;case i:d=(e-n)/x+4;break}d/=6}return d=Math.round(d*360),{h:d,s:f,l:y,a:o}}const Ea={...ea,...Object.freeze(Object.defineProperty({__proto__:null,get BitDisplayCanvas(){return h.BitDisplayCanvas},ButtonSizes:Gt,ButtonVariants:Jt,CSSPropsControls:Ei,get DialogElement(){return h.DialogElement},DialogElementTag:_t,ElementTag:mr,get Header(){return h.Header},InputVariants:lr,Orientations:br,get PaginationElement(){return h.PaginationElement},PaginationElementTag:yr,get SpectricButton(){return h.SpectricButton},get SpectricInput(){return h.SpectricInput},get SpectricPage(){return h.SpectricPage},get SpectricPanel(){return h.SpectricPanel},get SpectricQuery(){return h.SpectricQuery},get SpectricTableElement(){return h.SpectricTableElement},get SpectricThemeProvider(){return h.SpectricThemeProvider},get SplitView(){return h.SplitView},SupportedLanguages:fr,TableElementTag:_r,TableSelectOptions:Sr,TableSortDirection:B,TableSortOption:Ar,ThemeSelections:Ti,get TooltipElement(){return h.TooltipElement},TooltipElementTag:xr,TooltipPostions:Cr,nodeTypes:K},Symbol.toStringTag,{value:"Module"})),...Object.freeze(Object.defineProperty({__proto__:null,SpreadPropsDirective:or,debounce:mi,debounceAnimation:gt,once:Li,spreadProps:Ae},Symbol.toStringTag,{value:"Module"}))};h.BitArray=sr,h.ButtonSizes=Gt,h.ButtonVariants=Jt,h.CSSPropsControls=Ei,h.DialogElementTag=_t,h.DisposableElement=ae,h.ElementTag=mr,h.InputVariants=lr,h.Orientations=br,h.PaginationElementTag=yr,h.SpreadPropsDirective=or,h.SupportedLanguages=fr,h.TableElementTag=_r,h.TableSelectOptions=Sr,h.TableSortDirection=B,h.TableSortOption=Ar,h.ThemeSelections=Ti,h.TooltipElementTag=xr,h.TooltipPostions=Cr,h.debounce=mi,h.debounceAnimation=gt,h.default=Ea,h.getListeners=hi,h.nodeTypes=K,h.once=Li,h.spreadProps=Ae,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1123
1174
|
//# sourceMappingURL=index.umd.js.map
|