1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6839],{11227:function(e,t,n){var a,s,r;s=[],void 0!==(r="function"==typeof(a=function(){"use strict";function t(e,t,n){var a=new XMLHttpRequest;a.open("GET",e),a.responseType="blob",a.onload=function(){o(a.response,t,n)},a.onerror=function(){console.error("could not download file")},a.send()}function a(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return 200<=t.status&&299>=t.status}function s(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(n){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var r="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof n.g&&n.g.global===n.g?n.g:void 0,l=r.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),o=r.saveAs||("object"!=typeof window||window!==r?function(){}:"download"in HTMLAnchorElement.prototype&&!l?function(e,n,l){var o=r.URL||r.webkitURL,i=document.createElement("a");n=n||e.name||"download",i.download=n,i.rel="noopener","string"==typeof e?(i.href=e,i.origin===location.origin?s(i):a(i.href)?t(e,n,l):s(i,i.target="_blank")):(i.href=o.createObjectURL(e),setTimeout(function(){o.revokeObjectURL(i.href)},4e4),setTimeout(function(){s(i)},0))}:"msSaveOrOpenBlob"in navigator?function(e,n,r){if(n=n||e.name||"download","string"!=typeof e){var l;navigator.msSaveOrOpenBlob((void 0===(l=r)?l={autoBom:!1}:"object"!=typeof l&&(console.warn("Deprecated: Expected third argument to be a object"),l={autoBom:!l}),l.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\uFEFF",e],{type:e.type}):e),n)}else if(a(e))t(e,n,r);else{var o=document.createElement("a");o.href=e,o.target="_blank",setTimeout(function(){s(o)})}}:function(e,n,a,s){if((s=s||open("","_blank"))&&(s.document.title=s.document.body.innerText="downloading..."),"string"==typeof e)return t(e,n,a);var o="application/octet-stream"===e.type,i=/constructor/i.test(r.HTMLElement)||r.safari,c=/CriOS\/[\d]+/.test(navigator.userAgent);if((c||o&&i||l)&&"undefined"!=typeof FileReader){var d=new FileReader;d.onloadend=function(){var e=d.result;e=c?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),s?s.location.href=e:location=e,s=null},d.readAsDataURL(e)}else{var u=r.URL||r.webkitURL,f=u.createObjectURL(e);s?s.location=f:location.href=f,s=null,setTimeout(function(){u.revokeObjectURL(f)},4e4)}});r.saveAs=o.saveAs=o,e.exports=o})?a.apply(t,s):a)&&(e.exports=r)},98664:function(e,t,n){"use strict";n.d(t,{Kb:function(){return a},WW:function(){return r},XQ:function(){return l},co:function(){return s}});let a="glass-color border-0 p-0 md:max-w-[1344px] md:rounded-[var(--portal-roundness)]",s="min-[860px]:top-[120px] min-[860px]:bottom-8 min-[860px]:translate-y-0 min-[860px]:overflow-hidden",r="xl:left-[349px] xl:right-4 xl:w-auto xl:max-w-none xl:translate-x-0",l="xl:pl-[349px] xl:pr-4"},46839:function(e,t,n){"use strict";n.r(t),n.d(t,{UploadsContent:function(){return D},default:function(){return Z}});var a,s,r=n(11527),l=n(50959),o=n(57355),i=n(88717),c=n(63947),d=n(94985),u=n(97442),f=n(32975),p=n(98664),m=n(43352),h=n(53346),x=n(37110),v=n(7242),g=n(18905),w=n(50323),y=n(70577),b=n(82139),j=n(71428),k=n(57897),N=n(8807),S=n(22711),E=n(80320),M=n(21661);let O=async e=>{let{rawStorageUrl:t}=e,n={sample:""};if(!t)return n;let a=await fetch(t);if(!a.ok)throw Error(a.statusText);let s=await a.text();return s&&(n.sample=s.slice(0,600)||""),n},R=e=>(0,M.a)({queryKey:["document-sample-content",e.rawStorageUrl],queryFn:async()=>O(e)});var C=n(81474),A=n(32362),V=n(36789),L=n(11227),T=n.n(L);function P(){return(P=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(null,arguments)}var U=function(e){return l.createElement("svg",P({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},e),a||(a=l.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 17 17 7M7 7h10v10"}
1)))};function I(){return(I=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(null,arguments)}var z=function(e){return l.createElement("svg",I({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},e),s||(s=l.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21H3M7 10l5 5 5-5M12 15V3"})))},B=e=>{var t,n;let{data:{documentId:a,formId:s,responseId:o,name:i,storageUrl:c,rawStorageUrl:u,pickaxe:p,createdAt:h,isUserAssociated:g}}=e,w=(0,d.m)(),{t:y}=(0,v.$G)("popup"),{setSessionId:j,setIsNewChat:N}=(0,A.T)(),[S,M]=(0,l.useState)(!1),[O,L]=(0,l.useState)(!1),[P,I]=(0,l.useState)(!1),{isNavigating:B,onGoTo:D}=(0,E.E)(),Z=R({rawStorageUrl:u}),_=m.S.useUtils(),F=m.S.user.delete.documents.useMutation({onSuccess:async()=>{await _.user.get.documentsInfinite.invalidate()}}),W=(0,l.useMemo)(()=>(0,V.WU)(h,"MMM d, yyyy h:mmaaa"),[h]),H=async()=>{try{M(!0);let e=await fetch(c);if(!e.ok)throw Error("Failed to download document");let t=await e.blob();T()(t,i)}catch(e){alert(w((0,f.Z)(e)))}finally{M(!1)}},$=async()=>
1{try{L(!0),await F.mutateAsync({documentIds:[a]})}catch(e){alert(w((0,f.Z)(e)))}finally{L(!1)}},q=async()=>{try{if(!o||!s)return;I(!0),await D({type:"pickaxe",id:s}),await new Promise(e=>setTimeout(e,200)),j(o),N(!1),(0,C.cm)("sessionId",o)}finally{I(!1)}};return(0,r.jsxs)(x.E.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:"glass flex min-h-[263px] w-full min-w-0 flex-col overflow-hidden rounded-[var(--portal-roundness)] md:h-[263px] md:min-w-[376px]",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-6 border-b bg-white/40 p-4 glass-dark:bg-black/50",children:[(0,r.jsxs)("div",{className:"flex min-w-0 flex-col gap-0.5",children:[(0,r.jsx)("p",{className:"truncate text-lg font-semibold",children:i}),(0,r.jsx)("p",{className:"text-sm opacity-70",children:W})]}),(0,r.jsxs)("div",{className:"mt-0.5 flex gap-4",children:[(0,r.jsx)(k.z,{variant:"transparent",size:"blank",className:"[&_svg]:size-[18px]",onClick:H,disabled:S||O||B||P,children:(0,r.jsx)(z,{})}),(0,r.jsx)(k.z,{variant:"transparent",size:"blank",className:"[&_svg]:size-[18px]",onClick:$,disabled:O||S||B||P,children:(0,r.jsx)(b.Z,{})})]})]}),(0,r.jsx)("div",{className:"min-h-[135px] p-4 font-semilight opacity-90",children:(0,r.jsx)("p",{className:"line-clamp-4 text-sm",children:(null===(t=Z.data)||void 0===t?void 0:t.sample)||y("uploads.noContentAvailable",{defaultValue:"No content available"})})}),!g&&!!o&&(!!p||!!s)&&(0,r.jsxs)("div",{className:"flex items-center justify-between gap-1 border-t bg-white/40 px-4 py-1 glass-dark:bg-black/50",children:[(0,r.jsx)("p",{className:"truncate text-sm opacity-70",children:"".concat(y("uploads.usedOnlyIn",{defaultValue:"Used only in"})," ").concat(null!==(n=null==p?void 0:p.formtitle)&&void 0!==n?n:s)}),(0,r.jsx)("div",{className:"flex justify-end",children:(0,r.jsxs)(k.z,{variant:"transparent",onClick:q,disabled:O||S||B||P,children:[y("uploads.seeChat",{defaultValue:"See chat"}),(0,r.jsx)(U,{})]})})]})]})};let D=e=>{let{className:t}=e,n=(0,d.m)(),{t:a}=(0,v.$G)("popup"),{search:s,searchQuery:i,setSearchQuery:c}=(0,o.R)(),[p,h]=(0,l.useState)(!1),j=m.S.useUtils(),N=m.S.user.get.documentsInfinite.useInfiniteQuery({search:s,limit:6},{getNextPageParam:e=>e.nextCursor}),E=m.S.user.delete.allDocuments.useMutation({onSuccess:async()=>{await j.user.get.documentsInfinite.invalidate()}}),M=(0,l.useMemo)(()=>{var e;return(null===(e=N.data)||void 0===e?void 0:e.pages.flatMap(e=>e.documents))||[]},[N.data]),{ref:O}=(0,g.YD)({async onChange(e){e&&N.hasNextPage&&(await new Promise(e=>setTimeout(e,200)),N.fetchNextPage())}}),R=async()=>{try{if(!confirm(a("delete-uploads",{defaultValue:"Are you sure you want to delete all uploads? This action cannot be undone."})))return;h(!0),await E.mutateAsync()}catch(e){alert(n((0,f.Z)(e)))}finally{h(!1)}};return(0,r.jsxs)("div",{className:(0,u.Z)("flex flex-grow flex-col gap-6 p-8 pt-6",t),children:[(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(y.Z,{className:"pointer-events-none absolute left-4 top-1/2 z-10 size-5 shrink-0 -translate-y-1/2 text-black/80 glass-dark:text-white/80"}),(0,r.jsx)(S.I,{type:"text",placeholder:a("uploads.searchPlaceholder",{defaultValue:"Search Documents"}),className:"h-14 rounded-[var(--portal-roundness)] pl-12 placeholder:text-black/80 glass-dark:placeholder:text-white/80",value:i,onChange:e=>c(e.target.value)})]}),(0,r.jsxs)("div",{className:"glass flex flex-col rounded-[var(--portal-roundness)] bg-white/20 glass-dark:bg-black/20 md:min-h-0 md:flex-1",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-4 border-b px-8 py-6",children:[(0,r.jsx)("p",{children:"".concat(M.length," ").concat(a("uploads.documents",{defaultValue:"Documents"}))}),M.length>0&&(0,r.jsxs)(k.z,{variant:"transparent",className:"p-0 px-4",onClick:R,disabled:p,children:[(0,r.jsx)(b.Z,{}),a("deleteAll",{defaultValue:"Delete all"})]})]}),(0,r.jsxs)("div",{className:"relative flex flex-wrap gap-6 p-8",children:[M.map((e,t)=>(0,r.jsx)(B,{data:e},t)),N.hasNextPage&&(0,r.jsx)("div",{className:"absolute bottom-4 left-1/2 flex -translate-x-1/2 items-center justify-center",children:(0,r.jsxs)("button",{className:"flex select-none flex-col items-center justify-between pt-[2em] outline-none disabled:cursor-wait disabled:opacity-50",disabled:N.isFetchingNextPage,onClick:()=>N.fetchNextPage(),children:[(0,r.jsxs)(x.E.div,{animate:{y:[-5,5]},transition:{repeat:1/0,repeatType:"reverse",duration:1,ease:"easeInOut"},className:"flex items-center justify-center gap-2",children:[(0,r.jsx)("p",{className:"text-sm font-semibold",children:a("seeMore",{defaultValue:"See more"})}),(0,r.jsx)(w.Z,{className:"h-5 w-5 shrink-0"})]}),(0,r.jsx)("div",{ref:O,className:"invisible h-2 w-2"})]})})]})]})]})};var Z=e=>{let{isOpen:t,onClose:n}=e,{t:a}=(0,v.$G)("popup"),{isSidebarOpen:s}=(0,c.D)(),{style:l}=(0,i.H)();return(0,r.jsx)(N.Vq,{open:t,onOpenChange:n,children:(0,r.jsx)(N.cZ,{className:(0,u.Z)(p.Kb,p.co,s&&p.WW),..."Real Head Pro"!==l.font&&{style:{fontFamily:l.font}},children:(0,r.jsxs)("div",{className:"flex h-full flex-col overflow-hidden rounded-[var(--portal-roundness)] border shadow-lg",children:[(0,r.jsxs)(N.fK,{className:"p-4 px-8 md:rounded-t-[var(--portal-roundness)]",children:[(0,r.jsx)(N.$N,{className:"font-semibold",children:a("uploads.title",{defaultValue:"Search"})}
1),(0,r.jsx)(h.TX,{children:(0,r.jsx)(N.Be,{children:a("uploads.searchPlaceholder",{defaultValue:"Search Documents"})})}),(0,r.jsx)(k.z,{variant:"transparent",size:"icon",onClick:n,children:(0,r.jsx)(j.Z,{})})]}),(0,r.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto scrollbar",children:(0,r.jsx)(D,{})})]})})})}},18905:function(e,t,n){"use strict";n.d(t,{YD:function(){return c}});var a=n(50959),s=Object.defineProperty,r=new Map,l=new WeakMap,o=0,i=void 0;function c({threshold:e,delay:t,trackVisibility:n,rootMargin:s,root:c,triggerOnce:d,skip:u,initialInView:f,fallbackInView:p,onChange:m}={}){var h;let[x,v]=a.useState(null),g=a.useRef(m),[w,y]=a.useState({inView:!!f,entry:void 0});g.current=m,a.useEffect(()=>{let a;if(!u&&x)return a=function(e,t,n={},a=i){if(void 0===window.IntersectionObserver&&void 0!==a){let s=e.getBoundingClientRect();return t(a,{isIntersecting:a,target:e,intersectionRatio:"number"==typeof n.threshold?n.threshold:0,time:0,boundingClientRect:s,intersectionRect:s,rootBounds:s}),()=>{}}let{id:s,observer:c,elements:d}=function(e){let t=Object.keys(e).sort().filter(t=>void 0!==e[t]).map(t=>{var n;return`${t}_${"root"===t?(n=e.root)?(l.has(n)||(o+=1,l.set(n,o.toString())),l.get(n)):"0":e[t]}`}).toString(),n=r.get(t);if(!n){let a;let s=new Map,l=new IntersectionObserver(t=>{t.forEach(t=>{var n;let r=t.isIntersecting&&a.some(e=>t.intersectionRatio>=e);e.trackVisibility&&void 0===t.isVisible&&(t.isVisible=r),null==(n=s.get(t.target))||n.forEach(e=>{e(r,t)})})},e);a=l.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),n={id:t,observer:l,elements:s},r.set(t,n)}return n}(n),u=d.get(e)||[];return d.has(e)||d.set(e,u),u.push(t),c.observe(e),function(){u.splice(u.indexOf(t),1),0===u.length&&(d.delete(e),c.unobserve(e)),0===d.size&&(c.disconnect(),r.delete(s))}}(x,(e,t)=>{y({inView:e,entry:t}),g.current&&g.current(e,t),t.isIntersecting&&d&&a&&(a(),a=void 0)},{root:c,rootMargin:s,threshold:e,trackVisibility:n,delay:t},p),()=>{a&&a()}},[Array.isArray(e)?e.toString():e,x,c,s,d,u,n,p,t]);let b=null==(h=w.entry)?void 0:h.target,j=a.useRef(void 0);x||!b||d||u||j.current===b||(j.current=b,y({inView:!!f,entry:void 0}));let k=[v,w.inView,w.entry];return k.ref=k[0],k.inView=k[1],k.entry=k[2],k}a.Component}}]);
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.