(globalThis.webpackChunkPlesk=globalThis.webpackChunkPlesk||[]).push([["components/pages/VirtualDirectoryPage/CreateDirectoryPage"],{1472(e,n,a){"use strict";a.r(n),a.d(n,{default:()=>o});var i=a(396),t=a(717),r=a(397);const o=({onClose:e,isOpen:n=!0,closeOnFormSuccess:a=!0,closeUrl:o="..",form:s,...l})=>{const d=(0,t.useNavigate)(),[c,u]=(0,i.useState)(n),m=(0,i.useRef)(null),p=(0,i.useCallback)((...n)=>{const a=e??(()=>d(o,{preventScrollReset:!0}));u(!1),m.current=setTimeout(()=>{a(...n),m.current=null},300)},[o,d,e]);(0,i.useEffect)(()=>()=>{m.current&&clearTimeout(m.current)},[]),(0,i.useEffect)(()=>{n?m.current&&clearTimeout(m.current):u(n)},[n]);const f=(0,i.useMemo)(()=>{if(s&&a){if((0,i.isValidElement)(s))return(0,i.cloneElement)(s,{onSuccess:(...e)=>{s.props.onSuccess?.(...e),p()}});if("object"==typeof s)return{...s,onSuccess:(...e)=>{s.onSuccess?.(...e),p()}}}return s},[a,p,s]);return(0,i.jsx)(r.Drawer,{...l,form:f,onClose:p,isOpen:c})}},2916(e,n,a){"use strict";a.r(n),a.d(n,{default:()=>b});var i=a(786),t=a(95),r=a(1472),o=a(809),s=a(663),l=a(1318),d=a(397),c=a(1255),u=a(2917),m=a.n(u),p=a(1265),f=a.n(p),v=a(717),k=a(396);const y=t.Locale.getTranslate("components.pages.VirtualDirectory.CreateDirectory"),h=({params:{domainId:e},...n})=>{const[a]=(0,v.useSearchParams)(),i=a.get("path")||"/",[t,u]=(0,k.useState)({name:""}),p=(0,k.useCallback)((e,n)=>{u(a=>(0,d.setIn)(a,e,n))},[]),[h]=(0,o.useMutation)(m(),{refetchQueries:[f()],onCompleted(e,{variables:{input:{name:n}}}){(0,s.addToast)({intent:"success",message:(0,k.jsx)(y,{content:"success",params:{name:(0,k.jsx)("b",{children:n})}})})},awaitRefetchQueries:!0});return(0,k.jsx)(r.default,{isOpen:!0,"data-type":"virtual-directory-create-directory-drawer",title:(0,k.jsx)(y,{content:"title"}),size:"sm",closeUrl:(0,c.buildUrl)(`/cp/domains/${e}/virtual-directory`,{path:i}),form:(0,k.jsx)(l.default,{onFieldChange:p,mutation:({variables:n})=>h({variables:{domainId:btoa(`Domain:${e}`),path:i,...n}}),values:t,applyButton:!1,...n,children:(0,k.jsx)(d.FormFieldText,{name:"name",label:(0,k.jsx)(y,{content:"name"}),required:!0})})})};h.propTypes={params:i.PropTypes.object.isRequired};const b=h},2915(e,n,a){"use strict";a.r(n),a.d(n,{default:()=>i.default});var i=a(2916)},2917(e){var n={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CreateDirectory"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"domainId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ID"}}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"path"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"input"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"DirectoryInput"}}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"createDirectory"},arguments:[{kind:"Argument",name:{kind:"Name",value:"domainId"},value:{kind:"Variable",name:{kind:"Name",value:"domainId"}}},{kind:"Argument",name:{kind:"Name",value:"path"},value:{kind:"Variable",name:{kind:"Name",value:"path"}}},{kind:"Argument",name:{kind:"Name",value:"input"},value:{kind:"Variable",name:{kind:"Name",value:"input"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]}]}}]}}],loc:{start:0,end:181}};n.loc.source={body:"mutation CreateDirectory($domainId: ID!, $path: String!, $input: DirectoryInput!) {\r\n    createDirectory(domainId: $domainId, path: $path, input: $input) {\r\n        name\r\n    }\r\n}\r\n",name:"GraphQL request",locationOffset:{line:1,column:1}};function a(e,n){if("FragmentSpread"===e.kind)n.add(e.name.value);else if("VariableDefinition"===e.kind){var i=e.type;"NamedType"===i.kind&&n.add(i.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(e){a(e,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(e){a(e,n)}),e.definitions&&e.definitions.forEach(function(e){a(e,n)})}var i={};function t(e,n){for(var a=0;a<e.definitions.length;a++){var i=e.definitions[a];if(i.name&&i.name.value==n)return i}}n.definitions.forEach(function(e){if(e.name){var n=new Set;a(e,n),i[e.name.value]=n}}),e.exports=n,e.exports.CreateDirectory=function(e,n){var a={kind:e.kind,definitions:[t(e,n)]};e.hasOwnProperty("loc")&&(a.loc=e.loc);var r=i[n]||new Set,o=new Set,s=new Set;for(r.forEach(function(e){s.add(e)});s.size>0;){var l=s;s=new Set,l.forEach(function(e){o.has(e)||(o.add(e),(i[e]||new Set).forEach(function(e){s.add(e)}))})}return o.forEach(function(n){var i=t(e,n);i&&a.definitions.push(i)}),a}(n,"CreateDirectory")}}]);
//# sourceMappingURL=CreateDirectoryPage.js.map?410fa4008937b264898c