"use strict";var e=require("@babel/runtime/helpers/slicedToArray"),i=require("react"),t=require("prop-types"),r=require("@material-ui/core"),n=require("../FolderMenuItem/index.js");require("../EditableItem/EditableItem/index.js");var d=require("../EditableItem/EditableItemWithBadge/index.js"),u=require("react/jsx-runtime");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=l(e),o=l(t),s=function(e){var t=e.folderColor,l=e.id,o=e.isCreatable,s=e.isOpen,f=e.items,c=e.name,m=e.onAdd,b=e.onFolderClick,q=e.onItemClick,p=e.onSave,C=e.selectedItemId,g=i.useState(s),x=a.default(g,2),I=x[0],j=x[1],R=function(e){return function(){return q(e)}},v=function(e){return function(i){return p({id:e,title:i})}};return u.jsxs("div",{children:[u.jsx(n,{folderColor:t,isCreatable:o,isOpen:I,isSelected:C===l,name:c,onAdd:function(){return m(l)},onClick:function(){I||j(!0),C!==l&&b()},onToggle:function(){return j(!I)}}),u.jsx(r.Collapse,{in:I,timeout:"auto",unmountOnExit:!0,children:u.jsx(r.List,{disablePadding:!0,children:f.map((function(e){return u.jsx(d,{isEditable:e.isEditable,isSelected:C===e.id,onClick:R(e),onSave:v(e.id),value:e.title},e.id)}))})})]})};s.propTypes={id:o.default.string.isRequired,isOpen:o.default.bool,selectedItemId:o.default.string.isRequired,items:o.default.arrayOf(o.default.shape({id:o.default.string.isRequired,title:o.default.string.isRequired,isEditable:o.default.bool,url:o.default.string.isRequired})),name:o.default.string.isRequired,onItemClick:o.default.func.isRequired,onFolderClick:o.default.func,folderColor:o.default.string.isRequired,isCreatable:o.default.bool,onSave:o.default.func.isRequired,onAdd:o.default.func.isRequired},s.defaultProps={isCreatable:!1,isOpen:!0,items:[],onFolderClick:function(){}},module.exports=s;
