Liferay.Loader.define("journal-web@5.0.100/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","frontend-js-web","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=s(a("@frontend-taglib-clay$clayui/empty-state")),l=d(a("@frontend-taglib-clay$clayui/form")),u=s(a("@frontend-taglib-clay$clayui/icon")),o=s(a("@frontend-taglib-clay$clayui/layout")),c=a("frontend-js-web"),i=d(a("liferay!frontend-js-react-web$react"));function f(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return f=function(){return e},e}function d(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=f();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 s(e){return e&&e.__esModule?e:{default:e}}function y({filterQuery:e,handleSelectionChange:t,items:a}){const[l,o]=(0,i.useState)(a),c=(0,i.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 c.length?i.default.createElement(r.TreeView,{items:c,onItemsChange:o,showExpanderOnHover:!1},(e=>i.default.createElement(r.TreeView.Item,null,i.default.createElement(r.TreeView.ItemStack,{onClick:t=>f(t,e),onKeyUp:t=>d(t,e)},i.default.createElement(u.default,{symbol:"folder"}),e.name),i.default.createElement(r.TreeView.Group,{items:e.children},(e=>i.default.createElement(r.TreeView.Item,{onClick:t=>f(t,e),onKeyUp:t=>d(t,e)},i.default.createElement(u.default,{symbol:"folder"}),e.name)))))):i.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 m=({itemSelectorSaveEvent:e,nodes:t})=>{const[a,r]=(0,i.useState)("");return i.default.createElement(o.default.ContainerFluid,{className:"p-4 select-folder"},i.default.createElement(l.default.Group,null,i.default.createElement(l.ClayInput.Group,null,i.default.createElement(l.ClayInput.GroupItem,{prepend:!0},i.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"}),i.default.createElement(l.ClayInput.GroupInsetItem,{after:!0},i.default.createElement("div",{className:"link-monospaced"},i.default.createElement(u.default,{symbol:"search"})))))),i.default.createElement(y,{filterQuery:a,handleSelectionChange:t=>{(0,c.getOpener)().Liferay.fire(e,{data:{folderId:t.id,folderName:t.name}})},items:t}))};t.default=m}}));
//# sourceMappingURL=SelectFolder.js.map