1"use strict";(self.rspackChunkcircle=self.rspackChunkcircle||[]).push([[15091],{174119(e,t,n){n.d(t,{b:()=>el});var r=n(391426),o=n(974618),i=n(231127),s=n(973646),a=n(568316),l=n(791009),c=n(417980),u=n(570310),d=n(933578),m=n(717526),f=n(473617),p=n(125665),y=n(387099),b=function(e){var t=e.openFilePicker;return(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center gap-4 text-center",children:[(0,r.jsx)("div",{className:"text-dark",children:(0,r.jsx)(s.In,{className:"!h-[25px] !w-[25px]",type:"25-arrow",size:25,useWithStrokeCurrentColor:!0})}),(0,r.jsx)(a.o.LabelMd,{weight:"semibold",children:(0,c.t)("settings.community_bot.knowledge.custom.add_file_modal.uploader.title")}),(0,r.jsx)(a.o.LabelSm,{as:"div",children:(0,r.jsx)(p.E,{content:(0,c.t)("settings.community_bot.knowledge.custom.add_file_modal.uploader.description")})}),(0,r.jsx)(y.$,{variant:"secondary",onClick:function(e){e.stopPropagation(),t()},children:(0,c.t)("settings.community_bot.knowledge.custom.add_file_modal.uploader.button")})]})},g=function(e){var t=e.files,n=e.onRemoveFile,o=e.openFilePicker;return(0,r.jsx)("div",{className:"flex size-full flex-col",children:(0,r.jsx)("div",{className:"flex-1 overflow-auto",children:(0,r.jsxs)("div",{className:"flex min-h-full w-full flex-col items-center justify-center gap-4 py-4",children:[(0,r.jsx)("div",{className:"flex w-full flex-col items-center justify-center gap-2",children:t.map(function(e){var t,o;return(0,r.jsxs)("div",{className:"text-dark bg-tertiary border-primary flex w-full max-w-[450px] items-center justify-between rounded-md border p-2",children:[(0,r.jsx)(s.In,{className:"mr-3 shrink-0",type:"20-ai-file",size:20,useWithStrokeCurrentColor:!0}),(0,r.jsx)("div",{className:"min-w-0 flex-1 truncate text-sm",children:(0,r.jsx)(a.o.BodySm,{children:null==(t=e.file)?void 0:t.name})}),(0,r.jsx)("div",{className:"ml-2",children:"valid"===e.status?(0,r.jsx)(s.In,{type:"20-close",size:20,className:"cursor-pointer",useWithStrokeCurrentColor:!0,onClick:function(t){var r;t.stopPropagation(),(null==(r=e.file)?void 0:r.name)&&n(e.file.name)}}):(0,r.jsx)(s.In,{type:"loader",size:20,useWithStrokeCurrentColor:!0})})]},null==(o=e.file)?void 0:o.name)})}),(0,r.jsx)(y.$,{variant:"secondary",onClick:function(e){e.stopPropagation(),o()},children:(0,c.t)("settings.community_bot.knowledge.custom.add_file_modal.uploader.upload_more")})]})})})},h=n(562986),x=n(172676);function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function j(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],s=!0,a=!1;try{for(o=o.call(e);!(s=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);s=!0);}catch(e){a=!0,r=e}finally{try{s||null==o.return||o.return()}finally{if(a)throw r}}return i}}(e,t)||w(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _(e){return function(e){if(Array.isArray(e))return v(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||w(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(e,t){if(e){if("string"==typeof e)return v(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return v(e,t)}}var O={"text/plain":[".txt"],"application/pdf":[".pdf"],"application/x-subrip":[".srt"]},k="settings.community_bot.knowledge.custom.add_file_modal.uploader.errors",S=function(){var e=j((0,d.useState)([]),2),t=e[0],n=e[1],r=j((0,d.useState)([]),2),o=r[0],i=r[1],s=j((0,d.useState)([]),2),a=s[0],l=s[1],u=(0,x.C)(),f=u.fileStates,p=u.uploadFiles,y=u.reset,b=(0,m.d)().error,g=o.length>0&&f.some(function(e){return"uploading"===e.status}),v=(0,d.useMemo)(function(){return _(t.map(function(e){return{file:e.file,signedId:e.signedId,status:"val
1id"}})).concat(_(o.map(function(e,t){var n,r,o,i;return{file:e,signedId:null!=(n=null==(o=f[t])||null==(r=o.response)?void 0:r.signed_id)?n:null,status:(null==(i=f[t])?void 0:i.status)==="completed"?"valid":"selected"}})),_(a.map(function(e){return{file:e,signedId:null,status:"selected"}})))},[t,o,f,a]);(0,d.useEffect)(function(){if(0!==o.length&&0!==f.length&&f.every(function(e){return"completed"===e.status||"error"===e.status})){var e=[];f.forEach(function(t,n){"completed"===t.status?e.push({file:o[n],signedId:t.response.signed_id}):b((0,c.t)("".concat(k,".file_upload_failed"),{file_name:o[n].name}))}),n(function(t){return _(t).concat(_(e))}),i([]),y()}},[f,o,b,y]),(0,d.useEffect)(function(){a.length>0&&!g&&(i(a),p(a),l([]))},[a,g,p]);var w=t.length+o.length+a.length,S=(0,h.VB)({multiple:!0,accept:O,noClick:v.length>0,maxSize:0x6400000,onDropAccepted:function(e){w+e.length>15?b((0,c.t)("".concat(k,".max_files"),{max_files:15})):g?l(function(t){return _(t).concat(_(e))}):(i(e),p(e))},onDropRejected:function(e){e.forEach(function(e){b((0,c.t)("".concat(k,".rejected"),{file_name:e.file.name}))})}});return{files:v,isUploading:g,dropzone:S,removeFile:(0,d.useCallback)(function(e){n(function(t){return t.filter(function(t){return t.file.name!==e})})},[]),getSignedIds:(0,d.useCallback)(function(){return t.map(function(e){return e.signedId})},[t]),resetAll:(0,d.useCallback)(function(){n([]),i([]),l([]),y()},[y])}};function P(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function C(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}var N=function(e){var t=e.open,n=e.onOpenChange,o=S(),i=o.files,s=o.isUploading,a=o.dropzone,p=a.getRootProps,y=a.getInputProps,h=a.open,x=o.removeFile,v=o.getSignedIds,j=o.resetAll;(0,d.useEffect)(function(){t&&j()},[t,j]);var _=el(),w=(0,f.e0)({onSuccess:function(){n(!1)}}),O=(0,m.d)().error;return(0,r.jsx)(l.a.Root,{open:t,onOpenChange:n,size:"lg",children:(0,r.jsxs)(l.a.Content,{children:[(0,r.jsx)(l.a.Header,{title:(0,c.t)("settings.community_bot.knowledge.custom.add_file_modal.title")}),(0,r.jsx)(l.a.Body,{children:(0,r.jsxs)("div",C(P({},p()),{className:(0,u.x)("focus-within:border-secondary border-primary flex min-h-[200px] items-center justify-center rounded-md border border-dashed",{"cursor-pointer":0===i.length}),children:[0===i.length&&(0,r.jsx)(b,{openFilePicker:h}),i.length>0&&(0,r.jsx)(g,{files:i,onRemoveFile:x,openFilePicker:h}),(0,r.jsx)("input",C(P({},y()),{type:"file",className:"hidden"}))]}))}),(0,r.jsx)(l.a.Footer,{secondaryAction:{label:(0,c.t)("settings.community_bot.knowledge.custom.add_file_modal.footer.back"),onClick:function(){_.show()}},primaryAction:{label:(0,c.t)("settings.community_bot.knowledge.custom.add_file_modal.footer.add"),onClick:function(){w.mutate(v(),{onError:function(){O((0,c.t)("settings.community_bot.knowledge.custom.add_file_modal.footer.errors.upload_failed"))}})},disabled:w.isPending||0===i.length||s||i.some(function(e){return"valid"!==e.status}),loading:w.isPending}})]})})},I=n(737225),F=n(428266),K=n(278636),q=n(898666);function A(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function E(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}
1)(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}var B=function(){var e=(0,K.hS)(),t=el(),n=(0,m.d)().error,o=S(),i=o.files,s=o.isUploading,l=o.dropzone,d=l.getRootProps,p=l.getInputProps,h=l.open,x=o.removeFile,v=o.getSignedIds,j=(0,f.e0)({onSuccess:function(){e.remove()}});return(0,r.jsxs)(I.aF,{isOpen:e.visible,onClose:e.hide,children:[(0,r.jsx)(I.aF.Overlay,{}),(0,r.jsxs)(I.aF.Content,{size:"auto",className:"h-3 max-w-[720px] overflow-visible !rounded-t-none sm:h-full sm:!rounded-t-md md:max-h-[80vh] lg:max-h-[500px]",children:[(0,r.jsxs)("header",{className:"flex items-center justify-between px-5 py-4",children:[(0,r.jsx)(a.o.TitleSm,{weight:"semibold",children:(0,c.t)("settings.community_bot.knowledge.custom.add_file_modal.title")}),(0,r.jsx)("ul",{className:"text-darkest flex list-none items-center space-x-2",children:(0,r.jsx)("li",{children:(0,r.jsx)(q.$,{placement:"bottom",content:(0,c.t)("quick_post_v2.header.close"),children:(0,r.jsx)(F.K,{variant:"secondary",iconSize:20,onClick:e.hide,iconClassName:"!text-dark",name:"20-close",ariaLabel:(0,c.t)("quick_post_v2.header.close")})})})})]}),(0,r.jsx)("div",{className:"flex h-full flex-row overflow-hidden pb-4",children:(0,r.jsxs)("div",E(A({},d()),{className:(0,u.x)("focus-within:border-secondary border-primary mx-4 mb-4 flex size-full items-center justify-center rounded-md border border-dashed",{"cursor-pointer":0===i.length}),children:[0===i.length&&(0,r.jsx)(b,{openFilePicker:h}),i.length>0&&(0,r.jsx)(g,{files:i,onRemoveFile:x,openFilePicker:h}),(0,r.jsx)("input",E(A({},p()),{type:"file",className:"hidden"}))]}))}),(0,r.jsx)("footer",{className:"border-primary flex items-center justify-end border-t px-5 py-4","data-testid":"quick-post-footer",children:(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(y.$,{type:"button",variant:"secondary",onClick:function(){e.hide(),t.show()},children:(0,c.t)("settings.community_bot.knowledge.custom.add_file_modal.footer.back")}),(0,r.jsx)(y.$,{variant:"circle",type:"button",disabled:j.isPending||0===i.length||s||i.some(function(e){return"valid"!==e.status}),onClick:function(){j.mutate(v(),{onError:function(){n((0,c.t)("settings.community_bot.knowledge.custom.add_file_modal.footer.errors.upload_failed"))}})},children:(0,c.t)("settings.community_bot.knowledge.custom.add_file_modal.footer.add")})]})})]})]})},D=o.PT.create(function(){return(0,r.jsx)(B,{})}),T=o.PT.create(function(){var e=(0,o.hS)();return(0,r.jsx)(N,{open:e.visible,onOpenChange:function(t){t||e.hide()}})}),z=function(){var e=(0,i.T)("circle_v4_modals_enabled");return(0,o.hS)(e?T:D)},L=n(361971),R=n(531404),$=n(919109),Q=n(334552),M=n(288513),U=function(){var e,t,n=(0,L.xW)().control;return(0,r.jsx)("div",{className:"flex-1 overflow-auto px-5 py-4","data-ai-scrollable":!0,children:(0,r.jsxs)("div",{className:(0,u.x)((0,M.W2)("trix-v2"),"mx-auto grid h-full max-w-3xl grid-rows-[auto,auto,1fr]"),children:[(0,r.jsx)(L.xI,{control:n,name:"title",render:function(e){var t=e.field,n=t.onChange,o=t.value,i=t.name;return(0,r.jsx)($.A,{maxLength:255,draggable:!1,name:i,autoFocus:!0,value:null!=o?o:"",onChange:function(e){return n(e.target.value)},placeholder:(0,c.t)("settings.community_bot.knowledge.custom.placeholders.title"),className:"bg-primary text-dark placeholder:text-light placeholder:opacity-100 mb-2 block w-full resize-none border-none p-0 text-xl font-bold focus:ring-0",rows:1,onKeyPress:function(e){"Enter"===e.key&&e.preventDefault()},tabIndex:0})}}),(0,r.jsx)(R.P,(e=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},Q.Nr),t=t={placeholder:(0,c.t)("settings.community_bot.knowledge.custom.placeholders.body"),name:"body.body",className:"h-full",editorClassName:(0,u.x)("h-full",(0,M.W2)("quick-post-modal--v2"))},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}
1)(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e))]})})},W="add-snippet-form",V=function(e){var t,n=null==e||null==(t=e.body)?void 0:t.content;return!n||1===n.length&&"paragraph"===n[0].type&&!n[0].content},H=function(e){var t,n,o=e.open,i=e.onOpenChange,s=(0,L.mN)({mode:"all"}),a=s.watch(),u=a.title,m=a.body,p=!u||V(m)||s.formState.isSubmitting;(0,d.useEffect)(function(){o&&s.reset()},[o,s]);var y=(0,f.$3)({onSuccess:function(){return i(!1)}}),b=el();return(0,r.jsx)(l.a.Root,{open:o,onOpenChange:i,size:"lg",children:(0,r.jsxs)(l.a.Content,{children:[(0,r.jsx)(l.a.Header,{title:(0,c.t)("settings.community_bot.knowledge.custom.create_modal.title")}),(0,r.jsx)(l.a.Body,{children:(0,r.jsx)(L.Op,(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},s),n=n={children:(0,r.jsx)("form",{id:W,className:"flex min-h-[300px] flex-col [&>div]:px-0",onSubmit:s.handleSubmit(function(e){return y.mutate(e)}),children:(0,r.jsx)(U,{})})},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t))}),(0,r.jsx)(l.a.Footer,{secondaryAction:{label:(0,c.t)("settings.community_bot.knowledge.custom.add_file_modal.footer.back"),onClick:function(){b.show()}},primaryAction:{label:(0,c.t)("settings.community_bot.knowledge.custom.add"),type:"submit",form:W,disabled:p,loading:s.formState.isSubmitting}})]})})},G=n(927561),X=function(e){var t,n;return void 0===e||void 0===e.body||(null==e||null==(n=e.body)||null==(t=n.content)?void 0:t.length)===1&&"paragraph"===e.body.content[0].type&&!e.body.content[0].content},J=function(e){var t=e.label,n=e.onBack,o=(0,L.xW)(),i=o.watch,s=o.formState.isSubmitting,a=i(),l=a.title,u=a.body,d=!l||X(u)||s;return(0,r.jsx)("footer",{className:"border-primary flex items-center justify-end border-t px-5 py-4","data-testid":"quick-post-footer",children:(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[n&&(0,r.jsx)(y.$,{type:"button",variant:"secondary",onClick:n,children:(0,c.t)("settings.community_bot.knowledge.custom.add_file_modal.footer.back")}),(0,r.jsx)(y.$,{disabled:d,type:"submit",variant:"circle",children:t})]})})},Y=function(e){var t=e.defaultValues,n=e.onSubmit,o=e.actionLabel,i=e.onBack;return(0,r.jsxs)(G.l,{defaultValues:t,mode:"all",className:"h-[calc(100%-62px)]",formClassName:"h-full flex flex-col",onSubmit:n,children:[(0,r.jsx)(U,{}),(0,r.jsx)(J,{label:o,onBack:i})]})},Z=function(e){var t=e.title,n=(0,K.hS)();return(0,r.jsxs)("header",{className:"border-primary flex items-center justify-between border-b px-5 py-4",children:[(0,r.jsx)(a.o.TitleSm,{weight:"semibold",children:t}),(0,r.jsx)("ul",{className:"text-darkest flex list-none items-center space-x-2",children:(0,r.jsx)("li",{children:(0,r.jsx)(q.$,{placement:"bottom",content:(0,c.t)("quick_post_v2.header.close"),children:(0,r.jsx)(F.K,{variant:"secondary",iconSize:20,onClick:n.remove,iconClassName:"!text-dark",name:"20-close",ariaLabel:(0,c.t)("quick_post_v2.header.close")})})})})]})},ee=function(){var e=(0,K.hS)(),t=(0,f.$3)({onSuccess:e.remove}),n=el();return(0,r.jsxs)(I.aF,{isOpen:e.visible,onClose:e.hide,children:[(0,r.jsx)(I.aF.Overlay,{}),(0,r.jsxs)(I.aF.Content,{size:"auto",className:"h-full max-h-full max-w-[720px] overflow-visible !rounded-t-none sm:h-full sm:!rounded-t-md md:max-h-[80vh] lg:max-h-[550px]",children:[(0,r.jsx)(Z,{title:(0,c.t)("settings.community_bot.knowledge.custom.create_modal.title")}),(0,r.jsx)(Y,{defaultValues:{},onSubmit:function(e){return t.mutate(e)},actionLabel:(0,c.t)("settings.community_bot.knowledge.custom.add"),onBack:function(){e.hide(),n.show()}})]})]})},et=o.PT.create(function(){return(0,r.jsx)(ee,{})}),en=o.PT.create(function(){var e=(0,o.hS)();return(0,r.jsx)(H,{open:e.visible,onOpenChange:function(t){t||e.hide()}})}),er=function(){var e=(0,i.T)("circle_v4_modals_enabled");return(0,o.hS)(e?en:et)},eo=function(e){var t=e.open,n=e.onOpenChange,o=er(),i=z();return(0,r.jsx)(l.a.Root,{open:t,onOpenChange:n,size:"lg",children:(0,r.jsxs)(l.a.Content,{children:[(0,r.jsx)(l.a.Header,{title:(0,c.t)("settings.community_bot.knowledge.custom.add_content_modal.title")}),(0,r.jsx)(l.a.Body,{children:(0,r.jsxs)("div",{className:"flex flex-row gap-6",children:[(0,r.jsx)("button",{type:"button",className:"hover:border-secondary flex w-1/2 cursor-pointer flex-col justify-center rounded-md border","aria-label":(0,c.t)("settings.community_bot.knowledge.custom.add_content_modal.snippet.title"),onClick:function(){n(!1),o.show()},children:(0,r.jsxs)("div",{className:"m-2 flex flex-col items-start justify-start gap-2 p-3",children:[(0,r.jsx)("div",{className:"mb-2",children:(0,r.jsx)(s.In,{className:"!h-[36px] !w-[36px]",type:"36-ai-snippet",size:36})}),(0,r.jsx)(a.o.LabelMd,{weight:"semibold",children:(0,c.t)("settings.community_bot.knowledge.custom.add_content_modal.snippet.title")}),(0,r.jsx)(a.o.LabelXs,{children:(0,c.t)("settings.community_bot.knowledge.custom.add_content_modal.snippet.description")})]})}),(0,r.jsx)("button",{type:"button",className:"hover:border-secondary flex w-1/2 cursor-pointer flex-col justify-center rounded-md border","aria-label":(0,c.t)("settings.community_bot.knowledge.custom.add_content_modal.file.title"),onClick:function(){n(!1),i.show()},children:(0,r.jsxs)("div",{className:"m-2 flex flex-col items-start justify-start gap-2 p-3",children:[(0,r.jsx)("div",{className:"mb-2",children:(0,r.jsx)(s.In,{className:"!h-[36px] !w-[36px]",type:"36-ai-file",size:36})}),(0,r.jsx)(a.o.LabelMd,{weight:"semibold",children:(0,c.t)("settings.community_bot.knowledge.custom.add_content_modal.file.title")}),(0,r.jsx)(a.o.LabelXs,{children:(0,c.t)("settings.community_bot.knowledge.custom.add_content_modal.file.description")})]})})]})})]})})},ei=function(){var e=(0,K.hS)(),t=er(),n=z();return(0,r.jsxs)(I.aF,{isOpen:e.visible,onClose:e.hide,children:[(0,r.jsx)(I.aF.Overlay,{}),(0,r.jsxs)(I.aF.Content,{size:"auto",className:"h-3 max-w-[720px] overflow-visible !rou
1nded-t-none sm:h-full sm:!rounded-t-md md:max-h-[80vh] lg:max-h-[260px]",children:[(0,r.jsxs)("header",{className:"flex items-center justify-between px-8 pb-4 pt-6",children:[(0,r.jsx)(a.o.TitleSm,{weight:"semibold",children:(0,c.t)("settings.community_bot.knowledge.custom.add_content_modal.title")}),(0,r.jsx)("ul",{className:"text-darkest flex list-none items-center space-x-2",children:(0,r.jsx)("li",{children:(0,r.jsx)(q.$,{placement:"bottom",content:(0,c.t)("quick_post_v2.header.close"),children:(0,r.jsx)(F.K,{variant:"secondary",iconSize:20,onClick:e.hide,iconClassName:"!text-dark",name:"20-close",ariaLabel:(0,c.t)("quick_post_v2.header.close"),className:"!p-0"})})})})]}),(0,r.jsxs)("div",{className:"flex h-full flex-row gap-6 px-6 pb-6",children:[(0,r.jsx)("button",{type:"button",className:"hover:border-secondary flex h-full w-1/2 cursor-pointer flex-col justify-center rounded-md border","aria-label":(0,c.t)("settings.community_bot.knowledge.custom.add_content_modal.snippet.title"),onClick:function(){e.hide(),t.show()},children:(0,r.jsxs)("div",{className:"m-2 flex flex-col items-start justify-start gap-2 p-3",children:[(0,r.jsx)("div",{className:"mb-2",children:(0,r.jsx)(s.In,{className:"!h-[36px] !w-[36px]",type:"36-ai-snippet",size:36})}),(0,r.jsx)(a.o.LabelMd,{weight:"semibold",children:(0,c.t)("settings.community_bot.knowledge.custom.add_content_modal.snippet.title")}),(0,r.jsx)(a.o.LabelXs,{children:(0,c.t)("settings.community_bot.knowledge.custom.add_content_modal.snippet.description")})]})}),(0,r.jsx)("button",{type:"button",className:"hover:border-secondary flex h-full w-1/2 cursor-pointer flex-col justify-center rounded-md border","aria-label":(0,c.t)("settings.community_bot.knowledge.custom.add_content_modal.file.title"),onClick:function(){e.hide(),n.show()},children:(0,r.jsxs)("div",{className:"m-2 flex flex-col items-start justify-start gap-2 p-3",children:[(0,r.jsx)("div",{className:"mb-2",children:(0,r.jsx)(s.In,{className:"!h-[36px] !w-[36px]",type:"36-ai-file",size:36})}),(0,r.jsx)(a.o.LabelMd,{weight:"semibold",children:(0,c.t)("settings.community_bot.knowledge.custom.add_content_modal.file.title")}),(0,r.jsx)(a.o.LabelXs,{children:(0,c.t)("settings.community_bot.knowledge.custom.add_content_modal.file.description")})]})})]})]})]})},es=o.PT.create(function(){return(0,r.jsx)(ei,{})}),ea=o.PT.create(function(){var e=(0,o.hS)();return(0,r.jsx)(eo,{open:e.visible,onOpenChange:function(t){t||e.hide()}})}),el=function(){var e=(0,i.T)("circle_v4_modals_enabled");return(0,o.hS)(e?ea:es)}},550028(e,t,n){n.d(t,{X:()=>b});var r=n(391426),o=n(213317),i=n(126032),s=n(570310),a=n(355104),l=n(398501),c=n(417980),u=function(e){var t=e.value,n=e.onChange;return(0,r.jsx)(l.dJ,{chip:(0,c.t)("settings.community_bot.knowledge.filters.name_chip"),title:(0,c.t)("settings.community_bot.knowledge.filters.name_title"),selectedText:t,onApply:function(e){return n(e||"")},isInitialOpen:!1,shouldShowRemoveButton:!0,children:(0,r.jsx)(l.zb,{name:"name-filter",placeholder:(0,c.t)("settings.community_bot.knowledge.filters.name_search_placeholder"),defaultValue:t})})},d=n(797602),m=function(e){var t=e.value,n=e.onChange;return(0,r.jsx)(d.P,{localeNamespace:"community_bot.bot_builder.knowledge_page.filters.space_groups",isInitialOpen:!1,onApply:n,changeUrl:!1,value:t,shouldShowRemoveButton:!0})},f=n(710537),p=n(825582),y=function(e){var t,n=e.value,o=e.onChange,i=e.options,s=(null==(t=i.find(function(e){return e.value===n}))?void 0:t.label)||"";return(0,r.jsxs)(f.d,{onApply:function(e){if(null===e)o("");else e&&(void 0===e?"undefined":e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)=="object"&&"value"in e&&"string"==typeof e.value&&o(e.value)},children:[(0,r.jsx)(f.d.Chip,{renderSelectedValue:function(){return s},children:(0,c.t)("settings.community_bot.knowledge.filters.type_chip")}),(0,r.jsx)(f.d.Popover,{title:(0,c.t)("settings.community_bot.knowledge.filters.type_title"),isInitialOpen:!1,shouldShowRemoveButton:!0,children:(0,r.jsx)(p.u,{options:i,legend:(0,c.t)("settings.community_bot.knowledge.filters.type_legend"),value:n})})]})},b=function(e){var t=e.name,n=e.onNameChange,l=e.type,c=e.onTypeChange,d=e.typeOptions,f=e.spaceGroup,p=e.onSpaceGroupChange,b=e.showSpaceGroup,g=e.isModal,h=void 0!==g&&g,x=e.hasBorder,v=void 0===x||x,j=e.hasPadding,_=void 0===j||j,w=(0,a.c)().isCircleV4,O=(0,i.Yo)();return(0,r.jsx)("div",{className:(0,s.x)((0,s.x)({"bg-primary dark:bg-secondary":w,"bg-primary":!w}),_&&(h?"px-5":"px-6"),_&&!h&&O&&"lg:px-9",v&&(!O||h)&&"border-primary border-b"),children:(0,r.jsx)("div",{className:(0,s.x)("flex items-center justify-between gap-x-1 py-3",v&&O&&!h&&"border-primary border-b"),children:(0,r.jsxs)(o.U,{children:[(0,r.jsx)(u,{value:t,onChange:n}
1),(0,r.jsx)(y,{value:l,onChange:c,options:d}),void 0!==b&&b&&p&&(0,r.jsx)(m,{value:f||"",onChange:p})]})})})}},589335(e,t,n){var r=n(51730),o=n(915779),i=n(258752),s=n(274685),a=n(417980),l=n(717526);function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}var d=["internal_api","community_bot","spaces"],m=["internal_api","community_bot","setting"],f=function(e){var t=e.currentPage,n=e.name,s=e.type,a=e.spaceGroup,l=(0,i.IT)({queryKey:((function(e){if(Array.isArray(e))return c(e)})(d)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(d)||function(e){if(e){if("string"==typeof e)return c(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return c(e,void 0)}}(d)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).concat([t,n,s,a]),queryFn:function(){return(0,r.i_)(o.iK.communityBot.spaces.index({params:u({page:t,per_page:10},n?{name:n}:{},s?{type:s}:{},a?{space_group:a}:{})}))},keepPreviousData:!0});return{data:l.data,error:l.error,isLoading:l.isLoading,isFetching:l.isFetching,refetch:l.refetch,hasActiveFilters:!!(n||s||a)}},p=function(){return(0,i.IT)({queryKey:m,queryFn:function(){return(0,r.i_)(o.iK.communityBot.setting.show())},staleTime:1/0})},y=function(){var e=(0,s.jE)(),t=(0,l.d)(),n=t.success,c=t.error;return(0,i.n_)({mutationFn:function(e){var t={community_bot_setting:u({},e)};return(0,r.$H)(o.iK.communityBot.setting.update(),t)},onSuccess:function(){e.invalidateQueries({queryKey:m}),e.invalidateQueries({queryKey:d}),n((0,a.t)("changes_saved"))},onError:function(){c((0,a.t)("request_failure_message"))}})};n.d(t,{Bf:()=>p,Kn:()=>d,Vd:()=>y,hP:()=>f})},473617(e,t,n){var r=n(51730),o=n(915779),i=n(421369),s=n(505774),a=n(258752),l=n(274685),c=n(417980),u=n(717526);function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function m(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}var f=i.B.key("index"),p=function(e){var t=e.currentPage,n=e.title,i=e.type,s=(0,a.IT)({queryKey:((function(e){if(Array.isArray(e))return d(e)})(f)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(f)||function(e){if(e){if("string"==typeof e)return d(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return d(e,void 0)}}(f)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).concat([t,n,i]),queryFn:function(){return(0,r.i_)(o.iK.communityBot.snippets.index({params:m({page:t,per_page:30},n?{title:n}:{},i?{type:i}:{})}))}});return{data:s.data,error:s.error,isLoading:s.isLoading,isFetching:s.isFetching,refetch:s.refetch,hasActiveFilters:!!(n||i)}},y=function(e){var t=e.id;return(0,a.IT)(["snippets",t,"preview"],function(){return(0,r.i_)(o.iK.communityBot.snippets.showPreview({id:t}))})},b=function(e){var t=e.onSuccess,n=(0,l.jE)(),i=(0,u.d)(),d=i.success,m=i.error;return(0,a.n_)({mutationFn:function(e){return(0,r.Dc)(o.iK.communityBot.snippets.bulkDestroy(),{ids:e.ids})},onSuccess:function(e,r){var o,i;n.invalidateQueries({queryKey:f}),n.invalidateQueries({queryKey:s.FL}),null==(o=r.ids)||o.forEach(function(e){n.invalidateQueries({queryKey:["snippet",e]})}),t(),d((0,c.t)("settings.community_bot.knowledge.custom.resources_deleted_success",{count:null==(i=r.ids)?void 0:i.length}))},onError:function(){m((0,c.t)("request_failure_message"))}})},g=function(e){var t=e.onSuccess,n=(0,l.jE)(),i=(0,u.d)(),d=i.success,p=i.error;return(0,a.n_)({mutationFn:function(e){var t=e.id,n=m({},function(e,t){if(null==e)return{};var n,r,o,i={};if("u">typeof Reflect&&Reflect.ownKeys){for(n=Reflect.ownKeys(Object(e)),o=0;o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r]);return i}if(i=function(e,t){if(null==e)return{};var n,r,o={},i=Object.getOwnPropertyNames(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n]);return o}(e,t),Object.getOwnPropertySymbols)for(n=Object.getOwnPropertySymbols(e),o=0;o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r]);return i}(e,["id"]));return(0,r.$H)(o.iK.communityBot.snippets.update({id:t}),n)},onSuccess:function(e){n.invalidateQueries({queryKey:f}),n.invalidateQueries({queryKey:s.FL}),n.invalidateQueries({queryKey:["snippets",e.id]}),t(),d((0,c.t)("changes_saved"))},onError:function(){p((0,c.t)("request_failure_message"))}})},h=function(e){var t=e.onSuccess,n=(0,u.d)(),i=n.success,d=n.error,m=(0,l.jE)();return(0,a.n_)({mutationFn:function(e){return(0,r.oK)(o.iK.communityBot.snippets.create(),{snippet:e})}
1,onSuccess:function(){m.invalidateQueries({queryKey:f}),m.invalidateQueries({queryKey:s.FL}),i((0,c.t)("settings.community_bot.knowledge.custom.resource_created_success")),t()},onError:function(){return d((0,c.t)("quick_post.toasts.failed_to_create"))}})},x=function(e){var t=e.onSuccess,n=(0,u.d)(),i=n.success,d=n.error,m=(0,l.jE)();return(0,a.n_)({mutationFn:function(e){return(0,r.oK)(o.iK.communityBot.snippets.createFromFiles(),{files:e})},onSuccess:function(){m.invalidateQueries({queryKey:f}),m.invalidateQueries({queryKey:s.FL}),i((0,c.t)("settings.community_bot.knowledge.custom.files_uploaded")),t()},onError:function(){return d((0,c.t)("quick_post.toasts.failed_to_create"))}})};n.d(t,{$3:()=>h,Rh:()=>f,e0:()=>x,eS:()=>y,nR:()=>g,p6:()=>b,ul:()=>p})},334552(e,t,n){var r={disabledExtensions:["file","image","embeds","poll","cta","ai_copilot","horizontal_rule","code_block","mention","entities"],disabledSlashMenuCategories:["Upload","Embed"],disabledSlashMenuCommands:["image","giphy","audio","video","pdf","file","poll","code"]};n.d(t,{Nr:()=>r})},421369(e,t,n){var r=n(649942),o=n(505774),i=n(75132),s=(0,r.y)("community-bot-snippet"),a={all:function(){return Promise.all([i.q.invalidateQueries({queryKey:s.root()}),i.q.invalidateQueries({queryKey:o.FL})])}};n.d(t,{B:()=>s,h:()=>a})},538823(e,t,n){var r=n(391426),o=n(517338),i=function(e){var t=e.type;return(0,r.jsx)(o.E,{label:t})};n.d(t,{w:()=>i})},505774(e,t,n){var r=n(51730),o=n(915779),i=n(258752);function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function l(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e){if(e){if("string"==typeof e)return s(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return s(e,void 0)}}(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var c=["internal_api","community_bot","custom_resources"],u=l(c).concat(["for_knowledge"]),d=l(c).concat(["for_import"]),m=function(e){var t=e.currentPage,n=e.snippetIds;return(0,i.IT)({queryKey:l(u).concat([n]),queryFn:function(){return(0,r.oK)(o.iK.communityBot.customResources.index({params:{page:t,per_page:10,imported:"true"}}),{snippet_ids:n})},keepPreviousData:!0})},f=function(e){var t=e.currentPage,n=e.snippetIds,s=e.title,c=e.type;return(0,i.IT)({queryKey:l(d).concat([n,s,c]),queryFn:function(){return(0,r.oK)(o.iK.communityBot.customResources.index({params:a({page:t,per_page:10,imported:"false"},s?{title:s}:{},c?{type:c}:{})}),{snippet_ids:n})},keepPreviousData:!0})},p=["internal_api","community_bot","community_resources","for_knowledge"],y=["internal_api","community_bot","community_resources","for_import"],b=function(e){var t=e.currentPage,n=e.spaceIds;return(0,i.IT)({queryKey:l(p).concat([n]),queryFn:function(){return(0,r.oK)(o.iK.communityBot.communityResources.index({params:{page:t,per_page:10,imported:"true"}}),{space_ids:n})},keepPreviousData:!0})},g=function(e){var t=e.currentPage,n=e.spaceIds,s=e.name,c=e.type,u=e.spaceGroup;return(0,i.IT)({queryKey:l(y).concat([n,s,c,u]),queryFn:function(){return(0,r.oK)(o.iK.communityBot.communityResources.index({params:a({page:t,per_page:10,imported:"false"},s?{name:s}:{},c?{type:c}:{},u?{space_group:u}:{})}),{space_ids:n})},keepPreviousData:!0})};n.d(t,{FL:()=>c,HA:()=>u,Jf:()=>m,K5:()=>p,WY:()=>f,gC:()=>b,iZ:()=>d,vg:()=>g,xU:()=>y})}}]); 2//# sourceMappingURL=/packs/js/15091-ed84ff4a7b08bfd3.chunk.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.