}){let c=`${this.#d||"search-item"}-result-${this.#y++}`;if("url"in r){let h="GENERAL"===u?`${o.o7[u]}`:`jump to this ${s.singularItemName}`,d=a?`, ${a}`:"",p=`${e?`${e} `:""}${t}${d}, ${h}`;this.#f.set(c,r.url);let m=null;return e&&(m=(0,l.qy)`
          <span>
            <div class="d-inline-flex position-relative">
              <div
                class="position-absolute rounded-1 flex-items-stretch height-full width-full"
                style="opacity: 0.1; background-color: var(${i})"
              ></div>
              <div class="px-1" style="color: var(${i})">${e}</div>
            </div>
            ${this.#V(t)}
          </span>
        `),(0,l.qy)`<li
        role="option"
        class="ActionListItem"
        data-type="url-result"
        id="${c}"
        data-value="${t}"
        aria-label="${p}"
        data-href="${r.url}"
        data-action="click:query-builder#navigate"
      >
        <span class="QueryBuilder-ListItem-link ActionListContent ActionListContent--visual16 QueryBuilder-ListItem">
          ${n?(0,l.qy)`<span id="${c}--leading" class="ActionListItem-visual ActionListItem-visual--leading">
                ${this.getLeadingVisual(n)}
              </span>`:null}
          <span class="ActionListItem-descriptionWrap">
            <span class="ActionListItem-label text-normal"> ${m||this.#V(t)} </span>
            ${a?(0,l.qy)`<span class="ActionListItem-description">${a}</span>`:null}
          </span>

          <span aria-hidden="true" class="ActionListItem-description QueryBuilder-ListItem-trailing"
            >${o.o7[u]}</span
          >
        </span>
      </li>`}if("commandName"in r){let e=o.o7[u]||o.o7.COMMAND,i=a?`, ${a}`:"",s=`${t}${i}, ${e}`;return(0,l.qy)`<li
        role="option"
        class="ActionListItem"
        data-type="command-result"
        id="${c}"
        data-value="${t}"
        data-command-name="${r.commandName}"
        data-command-payload="${JSON.stringify(r.data)}"
        aria-label="${s}"
      >
        <span class="ActionListContent ActionListContent--visual16 QueryBuilder-ListItem">
          ${n?(0,l.qy)`<span id="${c}--leading" class="ActionListItem-visual ActionListItem-visual--leading">
                ${this.getLeadingVisual(n)}
              </span>`:null}
          <span class="ActionListItem-descriptionWrap">
            <span class="ActionListItem-label text-normal"> ${this.#V(t)} </span>
            ${a?(0,l.qy)`<span class="ActionListItem-description">${a}</span>`:null}
          </span>

          <span aria-hidden="true" class="ActionListItem-description QueryBuilder-ListItem-trailing"
            >${e}</span
          >
        </span>
      </li>`}{let e="",i=0;"replaceQueryWith"in r&&(e=r.replaceQueryWith,i=r.moveCaretTo);let s="query"in r?o.o7[u]:o.k8;return(0,l.qy)` <li
        role="option"
        class="ActionListItem"
        data-type="query-result"
        data-value="${t}"
        aria-label="${t}${a?`, ${a}`:""}"
        data-replace-query-with="${e}"
        data-move-caret-to="${i}"
        id="${c}"
      >
        <span class="ActionListContent ActionListContent--visual16 QueryBuilder-ListItem">
          ${n?(0,l.qy)`<span id="${c}--leading" class="ActionListItem-visual ActionListItem-visual--leading">
                ${this.getLeadingVisual(n)}
              </span>`:null}
          <span class="ActionListItem-descriptionWrap">
            <span class="ActionListItem-label text-normal">${this.#V(t)}</span>
            ${a?(0,l.qy)`<span class="ActionListItem-description">${a}</span>`:null}
          </span>

          ${this.#l.size>0?(0,l.qy)`<span aria-hidden="true" class="ActionListItem-description QueryBuilder-ListItem-trailing"
                >${s}</span
              >`:(0,l.qy)``}
        </span>
      </li>`}}#V(t){let e=this.parser.flatten(this.parser.parse(t,0)),i=!this.#L,s=[];for(let t of e)if("filter"===t.type)s.push((0,l.qy)`<span>${t.filter}:</span
            ><span data-type="filter-value">${t.value}${i?" ":""}</span>`);else{let e="";t.style===o.VJ.Constant?e="qb-constant":t.style===o.VJ.Entity?e="qb-entity":t.style===o.VJ.FilterValue&&(e="qb-filter-value"),s.push((0,l.qy)`<span class="${e}">${t.value}${i?" ":""}</span>`)}return s}#k({singularItemName:t,icon:e,description:i,value:s}){let r=i?`, ${i}`:"",a=`${this.renderSingularItemNames?t:s}${r}`;return(0,l.qy)` <li
      role="option"
      class="ActionListItem"
      data-type="filter-result"
      data-value="${s}"
      id="${this.#d||"filter"}-result-${this.#M(s)}"
      aria-label="${a}, filter"
    >
      <span class="ActionListContent ActionListContent--visual16 QueryBuilder-ListItem">
        ${e?(0,l.qy)`<span
              id="${this.#d||"filter"}-result-${this.#M(s)}--leading"
              class="ActionListItem-visual ActionListItem-visual--leading"
            >
              ${this.getLeadingVisual(e)}
            </span>`:null}
        <span class="ActionListItem-descriptionWrap">
          <span class="ActionListItem-label text-normal">
            ${this.renderSingularItemNames?t:`${s}:`}
          </span>
          ${i?(0,l.qy)`<span class="ActionListItem-description">${i}</span>`:null}
        </span>

        ${this.#l.size>0?(0,l.qy)`<span aria-hidden="true" class="ActionListItem-description QueryBuilder-ListItem-trailing"
              >${o.k8}</span
            >`:(0,l.qy)``}
      </span>
    </li>`}#O({name:t,value:e,target:i,icon:s,avatar:r,description:a,inlineDescription:n,action:u}){let c=t&&t.length>0?t:e,h=a?`, ${a}`:"",d=i.singularItemName?`${c}${h}, autocomplete this ${i.singularItemName}`:`${c}${h}, ${i.name}`,p="",m=0;return u&&"replaceQueryWith"in u&&(p=u.replaceQueryWith,m=u.moveCaretTo),(0,l.qy)` <li
      role="option"
      class="ActionListItem"
      data-type="filter-item"
      data-replace-query-with="${p}"
      data-move-caret-to="${m}"
      data-value="${e}"
      id="${this.#d||"filter-item"}-result-${this.#M(e)}"
      aria-label="${d}"
    >
      <span class="ActionListContent ActionListContent--visual16 QueryBuilder-ListItem">
        ${s?(0,l.qy)`<span
              id="${this.#d||"filter-item"}-result-${this.#M(e)}--leading"
              class="ActionListItem-visual ActionListItem-visual--leading"
            >
              ${this.getLeadingVisual(s,r)}
            </span>`:null}
        <span class="${n?"ActionListItem-descriptionWrap-inline":"ActionListItem-descriptionWrap"}">
          <span class="ActionListItem-label text-normal">${c}</span>
          ${a?(0,l.qy)`<span class="ActionListItem-description">${a}</span>`:null}
        </span>

        ${this.#l.size>0?(0,l.qy)`<span aria-hidden="true" class="ActionListItem-description QueryBuilder-ListItem-trailing"
              >${o.k8}</span
            >`:(0,l.qy)``}
      </span>
    </li>`}updateScreenReaderFeedback(t){let e=new u("NEW_RESULTS",t,{});this.dispatchEvent(e),this.screenReaderFeedback.textContent=e.text}async clear(){this.dispatchEvent(new CustomEvent("query-builder:clear",{bubbles:!0,cancelable:!0}))&&await this.clearInput()}async clearInput({focusInput:t=!0}={}){await this.parseQuery([],t),this.#i=!0}async parseQuery(t,e=!0){this.#n?.abort();let{signal:i}=this.#n=new AbortController;if(t){let e=t.map(t=>"filter"===t.type?`${t.filter}:${t.value}`:t.value).join(this.#L?"":" "),i=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this.input),"value")?.set;i?i?.call(this.input,e):this.input.value=e,this.input.dispatchEvent(new Event("change",{bubbles:!0}))}else t=this.parseInputValue();if(this.lastParsedQuery=this.input.value,await new Promise(t=>requestAnimationFrame(t)),i.aborted||(this.styleInputText(t),e&&this.input.focus(),await new Promise(t=>setTimeout(t,100)),i.aborted))return;for(let t of this.#l.keys())this.#u.add(t);this.#h.clear(),this.#c.clear();let s=new o.P$(t,this.input.value,this.parsedMetadata);this.dispatchEvent(s);let r=!1;for(let t of this.#u.keys())this.#l.delete(t),this.#u.delete(t),r=!0;r&&this.#F(),this.updateVisibility()}#$(t){let e=this.#m.get(t);if(e)return e.slice();{let e=[];for(let i of t.split(/\s(?=(?:[^"]*"[^"]*")*[^"]*$)/g)){let t=i.indexOf(this.filterKey);if(t>0){let s=i.substring(0,t),r=i.substring(t+1);e.push(this.#r.has(s)?{type:"filter",filter:s,value:r}:{type:"text",value:i})}else e.push({type:"text",value:i})}return this.#m.set(t,[...e]),e}}styleInputText(t){this.#N(this.input.value);let e=document.createDocumentFragment();for(let i of t){let t=document.createElement("span"),s=document.createElement("span");s.textContent=" ";let r=!this.#L;if("filter"===i.type){let{filter:e,value:a}=i,n=document.createElement("span");t.setAttribute("data-type","filter-expression"),n.setAttribute("data-type","filter"),n.textContent=e;let l=document.createElement("span");l.textContent=this.filterKey;let o=document.createElement("span");o.setAttribute("data-type","filter-value"),o.textContent=a,t.appendChild(n),t.appendChild(l),t.appendChild(o),r&&t.appendChild(s)}else r?t.textContent=`${i.value} `:t.textContent=i.value,i.style===o.VJ.Constant?t.classList.add("qb-constant"):i.style===o.VJ.Entity?t.classList.add("qb-entity"):i.style===o.VJ.FilterValue&&t.classList.add("qb-filter-value");e.append(t),this.#D()}this.styledInputContent.replaceChildren(e)}#N(t){if(this.sizer.textContent="",null!==this.input.selectionStart&&this.input.selectionStart===this.input.selectionEnd){let e=this.input.selectionStart,i=document.createElement("span");this.sizer.append(t.substring(0,e),i,t.substring(e))}else this.sizer.textContent=t}#D(){let t=this.minWidth;requestAnimationFrame(()=>{let e=this.sizer.querySelector("span");e&&(e.offsetLeft<this.styledInputContainer.scrollLeft?this.styledInputContainer.scrollLeft=e.offsetLeft-t:e.offsetLeft>this.styledInputContainer.scrollLeft+this.styledInputContainer.clientWidth&&(this.styledInputContainer.scrollLeft=e.offsetLeft-this.styledInputContainer.clientWidth+t));let i=Math.max(this.sizer.scrollWidth+2,2*(""===this.input.value),t);this.input.style.width=`${i}px`})}#w(){return Object.keys(this.#s).length}}(0,s.Cg)([r.CF],h.prototype,"filterKey",void 0),(0,s.Cg)([r.CF],h.prototype,"minWidth",void 0),h=(0,s.Cg)([(0,r.p_)("query-builder")],h)}}]);
//# sourceMappingURL=35204-125aee152169b9ae-6b32d5a74d9061fd.js.mapӘ