import{proxyCustomElement as e,HTMLElement as t,createEvent as i,h as s,Host as r,transformTag as o}from"@stencil/core/internal/client";import{d as l}from"./property-selector.js";const n=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.itemChange=i(this,"itemChange",7),this.handlePathChange=e=>{e.stopPropagation();const t=e.detail;if(!t){const e=this.item[Object.keys(this.item)[0]]||"ASC";return void this.itemChange.emit({"":e})}const i=Object.keys(this.item)[0],s=this.item[i]||"ASC";this.itemChange.emit({[t]:s})},this.handleToggleDirection=()=>{const e=Object.keys(this.item)[0]||"",t="ASC"===(this.item[e]||"ASC")?"DESC":"ASC";this.itemChange.emit({[e]:t})},this.handleRemove=()=>{this.itemChange.emit(null)}}render(){const e=Object.keys(this.item)[0]||"",t=this.item[e]||"ASC";return s(r,{key:"f8b1d7505feec325eae8668672afe3768a4892aa"},s("limebb-property-selector",{key:"03f71edd8692c6a46612f87a9df21aabd2bf71eb",platform:this.platform,context:this.context,limetype:this.limetype,label:"Property",value:e,required:!0,onChange:this.handlePathChange}),s("div",{key:"a1a6db7060f8dc862d7acfb5750861293e2411d3",class:"control-buttons"},s("limel-icon-button",{key:"76703911899c38d71f116dc8256d00cb7c937971",icon:"ASC"===t?"sort_ascending":"sort_descending",label:"ASC"===t?"Ascending":"Descending",onClick:this.handleToggleDirection}),s("limel-icon-button",{key:"91a3370d5c6151370b96e7b67d59f226ad526f21",icon:"trash",label:"Remove",onClick:this.handleRemove})))}static get style(){return"*{box-sizing:border-box}:host(limebb-lime-query-order-by-item){box-sizing:border-box;display:flex;flex-direction:row;align-items:flex-start;gap:0.5rem;width:100%}limebb-property-selector{flex-grow:1}.control-buttons{flex-shrink:0;display:flex;align-items:center;gap:0.25rem}"}},[1,"limebb-lime-query-order-by-item",{platform:[16],context:[16],limetype:[1],item:[16]}]);function c(){"undefined"!=typeof customElements&&["limebb-lime-query-order-by-item","limebb-property-selector"].forEach((e=>{switch(e){case"limebb-lime-query-order-by-item":customElements.get(o(e))||customElements.define(o(e),n);break;case"limebb-property-selector":customElements.get(o(e))||l()}}))}export{n as O,c as d}