import{proxyCustomElement as e,HTMLElement as i,createEvent as t,h as s,transformTag as r}from"@stencil/core/internal/client";import{n as l}from"./index.esm.js";import{d as o}from"./lime-query-filter-comparison.js";import{e as m,b as n,d as p}from"./lime-query-filter-expression.js";import{d as u}from"./lime-query-value-input.js";import{d as a}from"./property-selector.js";const b=e(class extends i{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.expressionChange=t(this,"expressionChange",7),this.handleAddFirstCondition=()=>{this.expressionChange.emit({key:"",op:l.EQUALS,exp:""})},this.handlePromoteAndAdd=()=>{this.expression&&this.expressionChange.emit({op:l.AND,exp:[this.expression,{key:"",op:l.EQUALS,exp:""}]})},this.handleExpressionChange=e=>{var i;e.stopPropagation(),this.expressionChange.emit(null!==(i=e.detail)&&void 0!==i?i:void 0)}}render(){return this.expression?this.needsPromotion()?this.renderWithPromotionButton():s("limebb-lime-query-filter-expression",{platform:this.platform,context:this.context,limetype:this.limetype,activeLimetype:this.activeLimetype,expression:this.expression,onExpressionChange:this.handleExpressionChange}):this.renderEmptyState()}needsPromotion(){return!!this.expression&&("key"in this.expression||this.expression.op===l.NOT)}renderEmptyState(){return s("limel-button",{label:"Condition",icon:{name:"plus_math",title:"Add"},onClick:this.handleAddFirstCondition})}renderWithPromotionButton(){return s("div",{class:"expression-with-promotion"},s("limebb-lime-query-filter-expression",{platform:this.platform,context:this.context,limetype:this.limetype,activeLimetype:this.activeLimetype,expression:this.expression,onExpressionChange:this.handleExpressionChange}),s("limel-button",{label:"Add another condition",icon:"plus_math",onClick:this.handlePromoteAndAdd}))}static get style(){return".expression-with-promotion{display:flex;flex-direction:column;gap:1rem}limel-button{width:100%}.query-options-section{margin-top:1rem}"}},[1,"limebb-lime-query-filter-builder",{platform:[16],context:[16],limetype:[1],activeLimetype:[1,"active-limetype"],expression:[16]}]);function c(){"undefined"!=typeof customElements&&["limebb-lime-query-filter-builder","limebb-lime-query-filter-comparison","limebb-lime-query-filter-expression","limebb-lime-query-filter-group","limebb-lime-query-filter-not","limebb-lime-query-value-input","limebb-property-selector"].forEach((e=>{switch(e){case"limebb-lime-query-filter-builder":customElements.get(r(e))||customElements.define(r(e),b);break;case"limebb-lime-query-filter-comparison":customElements.get(r(e))||o();break;case"limebb-lime-query-filter-expression":customElements.get(r(e))||p();break;case"limebb-lime-query-filter-group":customElements.get(r(e))||n();break;case"limebb-lime-query-filter-not":customElements.get(r(e))||m();break;case"limebb-lime-query-value-input":customElements.get(r(e))||u();break;case"limebb-property-selector":customElements.get(r(e))||a()}}))}export{b as L,c as d}