Liferay.Loader.define("journal-web@5.0.81/js/SelectFolder",["module","exports","require","@frontend-taglib-clay$clayui/core","@frontend-taglib-clay$clayui/empty-state","@frontend-taglib-clay$clayui/form","@frontend-taglib-clay$clayui/icon","@frontend-taglib-clay$clayui/layout","liferay!frontend-js-react-web$react"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=a("@frontend-taglib-clay$clayui/core"),n=d(a("@frontend-taglib-clay$clayui/empty-state")),l=f(a("@frontend-taglib-clay$clayui/form")),u=d(a("@frontend-taglib-clay$clayui/icon")),o=d(a("@frontend-taglib-clay$clayui/layout")),c=f(a("liferay!frontend-js-react-web$react"));function i(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return i=function(){return e},e}function f(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=i();if(t&&t.has(e))return t.get(e);var a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var l=r?Object.getOwnPropertyDescriptor(e,n):null;l&&(l.get||l.set)?Object.defineProperty(a,n,l):a[n]=e[n]}return a.default=e,t&&t.set(e,a),a}function d(e){return e&&e.__esModule?e:{default:e}}function s({filterQuery:e,handleSelectionChange:t,items:a}){const[l,o]=(0,c.useState)(a),i=(0,c.useMemo)((()=>e?((e,t)=>e.reduce((function e(a,r){var n;return(null===(n=r.name)||void 0===n?void 0:n.toLowerCase().includes(t.toLowerCase()))?a.push(r):r.children&&a.concat(r.children.reduce(e,a)),a}),[]))(l,e):l),[l,e]),f=(e,a)=>{e.preventDefault(),t(a)},d=(e,a)=>{" "!==e.key&&"Enter"!==e.key||(e.preventDefault(),t(a))};return i.length>0?c.default.createElement(r.TreeView,{items:i,onItemsChange:o,showExpanderOnHover:!1},(e=>c.default.createElement(r.TreeView.Item,null,c.default.createElement(r.TreeView.ItemStack,{onClick:t=>f(t,e),onKeyUp:t=>d(t,e)},c.default.createElement(u.default,{symbol:"folder"}),e.name),c.default.createElement(r.TreeView.Group,{items:e.children},(e=>c.default.createElement(r.TreeView.Item,{onClick:t=>f(t,e),onKeyUp:t=>d(t,e)},c.default.createElement(u.default,{symbol:"folder"}),e.name)))))):c.default.createElement(n.default,{description:Liferay.Language.get("try-again-with-a-different-search"),imgSrc:"".concat(themeDisplay.getPathThemeImages(),"/states/search_state.gif"),small:!0,title:Liferay.Language.get("no-results-found")})}var y=({itemSelectorSaveEvent:e,nodes:t})=>{const[a,r]=(0,c.useState)("");return c.default.createElement(o.default.ContainerFluid,{className:"p-4 select-folder"},c.default.createElement(l.default.Group,null,c.default.createElement(l.ClayInput.Group,null,c.default.createElement(l.ClayInput.GroupItem,{prepend:!0},c.default.createElement(l.ClayInput,{"aria-label":Liferay.Language.get("search"),className:"input-group-inset input-group-inset-after",onChange:e=>r(e.target.value),placeholder:"".concat(Liferay.Language.get("search")),type:"text"}),c.default.createElement(l.ClayInput.GroupInsetItem,{after:!0},c.default.createElement("div",{className:"link-monospaced"},c.default.createElement(u.default,{symbol:"search"})))))),c.default.createElement(s,{filterQuery:a,handleSelectionChange:t=>{Liferay.Util.getOpener().Liferay.fire(e,{data:{folderId:t.id,folderName:t.name}})},items:t}))};t.default=y}}));
//# sourceMappingURL=SelectFolder.js.map