Liferay.Loader.define("@liferay/search-experiences-web@3.0.7/sxp_blueprint_admin/js/shared/JSONSXPElement",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/drop-down","@frontend-taglib-clay$clayui/form","@frontend-taglib-clay$clayui/icon","@frontend-taglib-clay$clayui/list","@frontend-taglib-clay$clayui/sticker","liferay!frontend-js-react-web$classnames","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","../../schemas/sxp-query-element.schema.json","../utils/data","../utils/language","./ThemeContext","./sxp_element/JSONInput"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var l=b(a("@frontend-taglib-clay$clayui/button")),n=b(a("@frontend-taglib-clay$clayui/drop-down")),u=b(a("@frontend-taglib-clay$clayui/form")),i=b(a("@frontend-taglib-clay$clayui/icon")),r=b(a("@frontend-taglib-clay$clayui/list")),d=b(a("@frontend-taglib-clay$clayui/sticker")),o=b(a("liferay!frontend-js-react-web$classnames")),c=(a("liferay!frontend-js-react-web$prop-types"),function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=g();if(t&&t.has(e))return t.get(e);var a={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var u=l?Object.getOwnPropertyDescriptor(e,n):null;u&&(u.get||u.set)?Object.defineProperty(a,n,u):a[n]=e[n]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react"))),f=b(a("../../schemas/sxp-query-element.schema.json")),s=a("../utils/data"),m=a("../utils/language"),y=b(a("./ThemeContext")),p=b(a("./sxp_element/JSONInput"));function g(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return g=function(){return e},e}function b(e){return e&&e.__esModule?e:{default:e}}function E({collapseAll:e,sxpElement:t,error:a={},id:g,index:b,isSubmitting:E,onDeleteSXPElement:x,prefixedId:h,readOnly:v,setFieldTouched:$=(()=>{}),setFieldValue:j=(()=>{}),touched:w={},uiConfigurationValues:I={}}){var O;const{locale:L}=(0,c.useContext)(y.default),[_,C]=(0,c.useState)(!1),[F,T]=(0,c.useState)(e),N=(0,m.getLocalizedText)(t.description_i18n,L),S=(0,m.getLocalizedText)(t.title_i18n,L);(0,c.useEffect)((()=>{T(e)}),[e]);const P=()=>w.uiConfigurationValues&&w.uiConfigurationValues.sxpElement&&a.uiConfigurationValues&&!!a.uiConfigurationValues.sxpElement;return c.default.createElement("div",{className:"sheet sxp-element",id:h},c.default.createElement(r.default,{className:"configuration-header-list"},c.default.createElement(r.default.Item,{flex:!0},c.default.createElement(r.default.ItemField,null,c.default.createElement(d.default,{size:"md"},c.default.createElement(i.default,{symbol:(null===(O=t.elementDefinition)||void 0===O?void 0:O.icon)||s.DEFAULT_SXP_ELEMENT_ICON}))),c.default.createElement(r.default.ItemField,{expand:!0},S&&c.default.createElement(r.default.ItemTitle,null,S),N&&c.default.createElement(r.default.ItemText,{subtext:!0},N)),x&&c.default.createElement(n.default,{active:_,alignmentPosition:3,onActiveChange:C,trigger:c.default.createElement(r.default.ItemField,null,c.default.createElement(l.default,{"aria-label":Liferay.Language.get("dropdown"),className:"component-action",displayType:"unstyled"},c.default.createElement(i.default,{symbol:"ellipsis-v"})))},c.default.createElement(n.default.ItemList,null,c.default.createElement(n.default.Item,{onClick:()=>x(g)},Liferay.Language.get("remove")))),c.default.createElement(r.default.ItemField,null,c.default.createElement(l.default,{"aria-label":F?Liferay.Language.get("expand"):Liferay.Language.get("collapse"),className:"component-action",displayType:"unstyled",onClick:()=>{T(!F)}},c.default.createElement(i.default,{symbol:F?"angle-right":"angle-down"}))))),!F&&c.default.createElement("div",{className:(0,o.default)("json-configuration-editor",{"has-error":P()})},c.default.createElement(p.default,{autocompleteSchema:f.default,disabled:E,name:"elementInstances[".concat(b,"].uiConfigurationValues.sxpElement"),readOnly:v,setFieldTouched:$,setFieldValue:j,value:I.sxpElement||JSON.stringify(t,null,"\t")}),P()&&c.default.createElement(u.default.FeedbackGroup,null,c.default.createElement(u.default.FeedbackItem,null,c.default.createElement(u.default.FeedbackIndicator,{symbol:"exclamation-full"}),a.uiConfigurationValues.sxpElement))))}var x=c.default.memo(E);t.default=x}}));
//# sourceMappingURL=JSONSXPElement.js.map