"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3210],{3210:function(e,s,t){t.d(s,{k:function(){return H}});var r=t(5250),l=t(79),a=t(8944),n=t.n(a),c=t(7390),i=t(6807),o=t(7160),d=t(1166),h=t.n(d),x=t(5827),u=t.n(x),m=t(4112),f=t(9893),p=e=>(0,r.jsxs)("svg",{viewBox:"0 0 71 55",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,r.jsx)("g",{clipPath:"url(#a)",children:(0,r.jsx)("path",{d:"M60.105 4.898A58.55 58.55 0 0 0 45.653.415a.22.22 0 0 0-.233.11 40.784 40.784 0 0 0-1.8 3.697c-5.456-.817-10.886-.817-16.23 0-.485-1.164-1.201-2.587-1.828-3.697a.228.228 0 0 0-.233-.11 58.386 58.386 0 0 0-14.451 4.483.207.207 0 0 0-.095.082C1.578 18.73-.944 32.144.293 45.39a.244.244 0 0 0 .093.167c6.073 4.46 11.955 7.167 17.729 8.962a.23.23 0 0 0 .249-.082 42.08 42.08 0 0 0 3.627-5.9.225.225 0 0 0-.123-.312 38.772 38.772 0 0 1-5.539-2.64.228.228 0 0 1-.022-.378c.372-.279.744-.569 1.1-.862a.22.22 0 0 1 .23-.03c11.619 5.304 24.198 5.304 35.68 0a.219.219 0 0 1 .233.027c.356.293.728.586 1.103.865a.228.228 0 0 1-.02.378 36.384 36.384 0 0 1-5.54 2.637.227.227 0 0 0-.121.315 47.249 47.249 0 0 0 3.624 5.897.225.225 0 0 0 .249.084c5.801-1.794 11.684-4.502 17.757-8.961a.228.228 0 0 0 .092-.164c1.48-15.315-2.48-28.618-10.497-40.412a.18.18 0 0 0-.093-.084Zm-36.38 32.427c-3.497 0-6.38-3.211-6.38-7.156 0-3.944 2.827-7.156 6.38-7.156 3.583 0 6.438 3.24 6.382 7.156 0 3.945-2.827 7.156-6.381 7.156Zm23.593 0c-3.498 0-6.38-3.211-6.38-7.156 0-3.944 2.826-7.156 6.38-7.156 3.582 0 6.437 3.24 6.38 7.156 0 3.945-2.798 7.156-6.38 7.156Z",fill:"currentColor"})}),(0,r.jsx)("defs",{children:(0,r.jsxs)("clipPath",{id:"a",children:[(0,r.jsx)("path",{fill:"#fff",d:"M0 0h71v55H0z"}),"x"]})})]}),j=e=>(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:85.333,height:85.333,viewBox:"0 0 64 64",...e,children:(0,r.jsx)("path",{d:"M21.4 1C12.8 3.7 3.4 13.3 1 21.8-.5 27.3-.2 38 1.6 43.3 4.5 52 16.5 62.6 22.3 61.8c1.7-.2 2.3-1.1 2.5-3.5.3-2.9 0-3.3-2-3.3-4.6 0-6.9-1.3-9.8-5.6-3.4-5-2.6-5.8 1.3-1.4 2.1 2.4 3.5 3 6.6 3 2.8 0 4-.5 4.5-1.7.3-1 .9-2.4 1.2-3.1.4-.7-.2-1.2-1.6-1.2-1.1 0-3.8-.9-5.9-2-6.1-3-8.9-12.2-5.6-18 .8-1.4 1.4-4.4 1.5-6.8 0-4.5 1.2-5.2 5.3-3 1.2.6 6.4 1.1 11.7 1.1 5.3 0 10.5-.5 11.7-1.1 4.1-2.2 5.3-1.5 5.3 3 .1 2.4.7 5.4 1.5 6.8 3.3 5.8.5 15-5.6 18-2.1 1.1-4.7 2-5.9 2-2.1 0-2.6 1-1.1 2.6.6.5 1.1 3.8 1.3 7.4.3 5.8.5 6.5 2.5 6.8 6 .9 17.9-9.9 20.8-18.9 2.4-7 1.7-19.8-1.3-25.6C57.9 11 53.8 6.8 47.8 3.5 43.2 1 41.3.5 33.5.3 28.6.2 23.1.5 21.4 1z",fill:"currentColor"})}),b=t(4795),g=t.n(b),v=t(1599),N=t(4250);async function w(e){if(!e)return[];let s=await fetch("/api/graphql",{method:"Post",headers:{"content-type":"application/json"},body:JSON.stringify({query:"\n  query($query: String!) {\n    search(query: $query) {\n    doc {\n        title\n        link\n        description\n      }\n      matches {\n        kind\n        section {\n          link\n          heading\n          md\n        }\n      }\n    }\n  }\n",variables:{query:e}})}),t=await s.json();if(t.errors)throw Error(t.errors[0].message);return t.data.search}function y(){var e;let[s,t]=(0,l.useState)(!1),[a,c]=(0,l.useState)(""),i=(0,l.useRef)(null),o=(0,l.useRef)(null),d=(0,l.useRef)(null);e=()=>{if(s){var e;null===(e=d.current)||void 0===e||e.focus(),t(!1)}},(0,l.useEffect)(()=>{let s=s=>{!o.current||o.current.contains(s.target)||e()};return document.addEventListener("mousedown",s),document.addEventListener("touchstart",s),()=>{document.removeEventListener("mousedown",s),document.removeEventListener("touchstart",s)}},[o,e]),(0,l.useEffect)(()=>{function s(s){"Escape"===s.key&&e()}return window.addEventListener("keyup",s),()=>void window.removeEventListener("keyup",s)},[]);let h=(0,l.useMemo)(()=>g()(e=>{c(e.target.value)},300),[]),{data:x,isLoading:u,error:m}=(0,N.a)(["docsSearch",a],()=>w(a));return(0,r.jsxs)("details",{ref:o,className:"absolute top-0 z-10 h-full right-4",open:s,onToggle:e=>{let s=e.currentTarget.open;if(t(s),s){var r;null===(r=i.current)||void 0===r||r.focus()}},children:[(0,r.jsx)("summary",{ref:d,className:"p-4 -mr-2 cursor-pointer text-white",children:(0,r.jsx)(v.Z,{className:"h-6 w-6"})}),(0,r.jsxs)("div",{className:"absolute py-4 top-16 bottom-0 -right-4 dark:bg-[#282a36] shadow w-96 pb-4 px overflow-y-auto z-20 bg-white",children:[(0,r.jsx)("label",{htmlFor:"search-field",className:"sr-only",children:"Search"}),(0,r.jsxs)("div",{className:"relative w-full text-gray-400 focus-within:text-gray-600 dark:focus-within:text-gray-100",children:[(0,r.jsx)("div",{className:"absolute inset-y-0 left-2 flex items-center pointer-events-none",children:(0,r.jsx)(v.Z,{className:"h-5 w-5","aria-hidden":"true"})}),(0,r.jsx)("div",{className:"border-b border-gray-300 dark:border-gray-600 focus-within:border-green",children:(0,r.jsx)("input",{ref:i,id:"search-field",className:"block w-full h-full pl-10 pr-3 py-2 text-gray-900 dark:text-gray-100 placeholder-gray-500 focus:outline-none focus:placeholder-gray-400 dark:focus:placeholder-gray-600 border-0 border-b border-transparent focus:ring-0 light:rounded dark:bg-transparent",placeholder:"Search",type:"search",name:"search",onChange:h})})]}),(0,r.jsx)("div",{className:"dark:text-gray-100",children:u?(0,r.jsx)("div",{className:"p-4",children:"Searching..."}):m?(0,r.jsx)("pre",{children:m.message}):(0,r.jsx)("ul",{className:"mt-1",children:x.map(e=>(0,r.jsxs)("li",{className:"p-2 border-b border-gray-500 hover:border-green hover:bg-gray-100 dark:hover:bg-gray-800",children:[(0,r.jsxs)(n(),{href:e.doc.link,className:"block",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold",children:e.doc.title}),(0,r.jsxs)("p",{className:"text-sm px-2 text-gray-600 dark:text-gray-400",children:["- ",e.doc.description]})]}),(0,r.jsx)("ul",{className:"py-2",children:e.matches.filter(e=>"Heading"===e.kind||"Content"===e.kind).map(e=>{var s;return(0,r.jsx)("li",{className:"px-2",children:(0,r.jsx)(n(),{href:e.section.link,children:(0,r.jsxs)("h3",{className:"text-md hover:underline",children:["# ",null===(s=e.section)||void 0===s?void 0:s.heading]})})})})})]}))})})]})]})}var k=t(1727),E=t(8890);function C(e){var s;let{entry:t,active:a}=e,[c,i]=(0,l.useState)(a.startsWith(t.link));return(0,r.jsxs)("details",{open:c,children:[(0,r.jsx)("summary",{className:"block rounded-l hover:bg-green hover:text-white ".concat(a===t.link?"font-bold dark:text-white ":""),children:(0,r.jsxs)(n(),{href:t.link,className:"pl-2 py-1 select-none flex items-center justify-between",children:[t.name,(0,r.jsx)("div",{className:"px-2 py-1",onClick:e=>{e.preventDefault(),i(!c)},children:c?(0,r.jsx)(E.Z,{className:"h-4 mr-2"}):(0,r.jsx)(k.Z,{className:"h-4 mr-2"})})]})}),(0,r.jsx)("ol",{className:"block ml-2 pl-2 border-l border-darkGreen dark:border-white text-sm",children:null===(s=t.children)||void 0===s?void 0:s.map(e=>(0,r.jsx)("li",{children:(0,r.jsx)(n(),{href:e.link,className:"block rounded-l hover:bg-green hover:text-white pl-2 py-1 ".concat(a===e.link?"font-bold dark:text-white":""),children:e.name})},e.link))})]})}function L(e){let{table:s,active:t,className:l}=e;return(0,r.jsx)("nav",{className:"bg-[#22212C] dark:bg-[#282a36] shadow text-white w-[235px] pb-4 pl-4 overflow-y-auto z-10 ".concat(null!=l?l:""),children:(0,r.jsx)("ol",{children:s.entries.map(e=>(0,r.jsx)("li",{children:e.children&&e.children.length>0?(0,r.jsx)(C,{entry:e,active:t}):(0,r.jsx)(n(),{href:e.link,className:"block pl-2 py-1 rounded-l hover:bg-green hover:text-white ".concat(t===e.link?"rounded-l font-bold dark:text-white ":""),children:e.name})},e.link))})})}function P(e){let{children:s,toc:t}=e,l=(0,m.useRouter)();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(h(),{id:"9651a2459c10b849",children:"html,body,body>div:first-child,div#__next,div#__next>div{height:100%}div#__next{padding-top:4rem}details>summary{list-style:none}details>summary::-webkit-details-marker{display:none}"}),(0,r.jsxs)("div",{className:"jsx-9651a2459c10b849 h-full overflow-y-auto dark:bg-[#22212C]",children:[(0,r.jsxs)(u(),{children:[(0,r.jsx)("link",{rel:"stylesheet",href:"//cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/styles/atom-one-dark.min.css",className:"jsx-9651a2459c10b849"}),(0,r.jsx)("link",{rel:"shortcut icon",href:"/favicon.ico",className:"jsx-9651a2459c10b849"}),(0,r.jsx)("link",{rel:"canonical",href:"https://pothos-graphql.dev".concat(l.pathname),className:"jsx-9651a2459c10b849"}),(0,r.jsx)("meta",{httpEquiv:"content-language",content:"en-us",className:"jsx-9651a2459c10b849"}),"`",(0,r.jsx)("meta",{name:"theme-color",content:"#5E854C",className:"jsx-9651a2459c10b849"})]}),(0,r.jsxs)("header",{className:"jsx-9651a2459c10b849 px-16 xl:pl-4 z-10 fixed top-0 bottom-0 flex w-full h-16 py-2 shadow justify-between bg-green text-white",children:[(0,r.jsxs)(n(),{href:"/",children:[(0,r.jsx)("img",{alt:"Pothos GraphQL",src:"/assets/logo-name-dark.svg",className:"jsx-9651a2459c10b849 hidden sm:block h-full"}),(0,r.jsx)("img",{alt:"Pothos GraphQL",src:"/assets/logo-dark.svg",className:"jsx-9651a2459c10b849 sm:hidden h-full"})]}),(0,r.jsxs)("ul",{className:"jsx-9651a2459c10b849 flex space-x-3 h-full flex-row items-center lg:space-x-4",children:[(0,r.jsx)("li",{className:"jsx-9651a2459c10b849",children:(0,r.jsxs)("a",{href:"https://github.com/hayes/pothos",className:"jsx-9651a2459c10b849 flex space-x-2 hover:underline",children:[(0,r.jsx)(j,{height:24,width:24}),(0,r.jsx)("span",{className:"jsx-9651a2459c10b849",children:"GitHub"})]})}),(0,r.jsx)("li",{className:"jsx-9651a2459c10b849 hidden sm:block hover:underline",children:(0,r.jsxs)("a",{href:"https://discord.gg/mNe73qvwAB",className:"jsx-9651a2459c10b849 flex space-x-2 hover:underline",children:[(0,r.jsx)(p,{height:24,width:24}),(0,r.jsx)("span",{className:"jsx-9651a2459c10b849",children:"Discord"})]})}),(0,r.jsx)("li",{className:"jsx-9651a2459c10b849 hidden sm:block hover:underline",children:(0,r.jsx)("a",{href:"https://github.com/hayes/pothos/tree/main/examples",className:"jsx-9651a2459c10b849",children:"Examples"})})]})]}),(0,r.jsxs)("details",{className:"jsx-9651a2459c10b849 xl:hidden absolute top-0 z-20 h-full",children:[(0,r.jsx)("summary",{className:"jsx-9651a2459c10b849 p-4 text-white",children:(0,r.jsx)(f.Z,{className:"h-8"})}),(0,r.jsx)(L,{active:l.pathname,className:"absolute py-4 xl:hidden top-16 bottom-0",table:t})]}),(0,r.jsx)(y,{}),(0,r.jsx)(L,{className:"hidden xl:block absolute py-4 top-16 bottom-0",table:t,active:l.pathname}),(0,r.jsx)("div",{className:"jsx-9651a2459c10b849 flex items-center",children:(0,r.jsx)("section",{className:"jsx-9651a2459c10b849 relative mb-16 p-8 w-full md:w-[min(75%,800px)] xl:m-auto shadow min-h-[500px] dark:bg-[#22212C] dark:text-white",children:s})}),(0,r.jsx)("footer",{className:"jsx-9651a2459c10b849 flex justify-center m-12",children:(0,r.jsx)("div",{className:"jsx-9651a2459c10b849 text-align-center text-gray-400 text-xs",children:"\xa9 ".concat(new Date().getFullYear()," Michael Hayes")})})]})]})}var Z=t(4390),S=t(1759);function q(e){let{tag:s,id:t,children:l,className:a,...n}=e;return(0,r.jsx)("a",{href:"#".concat(t),className:"no-underline",children:(0,r.jsxs)(s,{className:"relative group items-center ".concat(a),id:t,...n,children:[t&&(0,r.jsx)("div",{className:"hidden group-hover:flex items-center absolute -left-6 right-full h-full ".concat(a),children:(0,r.jsx)(S.Z,{className:"h-2/3"})}),l]})})}function _(e){var s;let t=(0,m.useRouter)(),r=e.entries.flatMap(e=>[e,...null!==(s=e.children)&&void 0!==s?s:[]]),l=r.find(e=>e.link===t.pathname);if(!l)return null;let a=r.indexOf(l),n=r[a-1],c=r[a+1];return{...l,githubFile:"https://github.com/hayes/pothos/edit/main/website/pages".concat(l.link).concat(l.children?"/index.mdx":".mdx"),prevPage:n,nextPage:c}}function z(e){let{active:s,url:t,depth:l,text:a}=e,n=t.startsWith("#")?t.slice(1):null;return(0,r.jsx)("li",{className:"hover:bg-green my-1 ".concat(s?"border-l-2 border-darkGreen font-bold":"border-l-4 border-transparent"),children:(0,r.jsx)("a",{href:t,onClick:function(e){if(n){var s;e.preventDefault(),null===(s=document.getElementById(n))||void 0===s||s.scrollIntoView({behavior:"smooth",block:"start"})}},className:"block py-1 pl-".concat((l-2)*4+2),children:a})})}function R(e){var s;let{items:t,className:a,nav:c}=e,i=(0,l.useRef)(null),o=(0,l.useRef)([]),[d,h]=(0,l.useState)(null);function x(){var e;let s=i.current.parentElement,t=null!==(e=s.offsetTop)&&void 0!==e?e:0,r=s.getClientRects()[0];if(0===o.current.length)return;let l=o.current[0].id;for(let e of o.current)if(e.offset-t+r.y<=50)l=e.id;else break;h(l)}function m(){o.current=[],t.forEach(e=>{let s=e.url.startsWith("#")?e.url.slice(1):null,t=s&&document.getElementById(s);t&&o.current.push({id:s,offset:t.offsetTop})}),x()}(0,l.useEffect)(()=>{let e=new MutationObserver(m);return e.observe(i.current,{childList:!0,subtree:!0}),document.addEventListener("scroll",x,!0),window.addEventListener("resize",m),m(),()=>{e.disconnect(),document.removeEventListener("scroll",x,!0),window.removeEventListener("resize",m)}},[i,t]);let f=_(c);return(0,r.jsxs)("nav",{ref:i,className:"flex items-start pl-4 pr-2 ".concat(a," text-sm"),children:[(0,r.jsxs)(u(),{children:[(0,r.jsx)("title",{children:null!==(s=null==f?void 0:f.title)&&void 0!==s?s:"Pothos GraphQL"}),(null==f?void 0:f.description)&&(0,r.jsx)("meta",{name:"description",content:f.description})]}),f&&(0,r.jsxs)(n(),{href:f.githubFile,className:"flex space-x-2 mb-8 dark:text-white",children:[(0,r.jsx)(j,{height:20,width:20}),(0,r.jsx)("span",{children:"Edit on GitHub"})]}),(0,r.jsx)("ol",{className:"border-l border-darkGreen flex-shrink max-w-sm pr-2",children:t.map((e,s)=>(0,r.jsx)(z,{active:e.url.slice(1)===d,...e},e.url))})]})}let G={a:e=>{let{href:s,...t}=e;return(0,r.jsx)(n(),{href:s,...t,className:""})},h1:e=>(0,r.jsx)(q,{tag:"h1",...e,className:"text-3xl dark:!text-gray-200"}),h2:e=>(0,r.jsx)(q,{tag:"h2",...e,className:"text-3xl"}),h3:e=>(0,r.jsx)(q,{tag:"h3",...e,className:"text-3xl"}),h4:e=>(0,r.jsx)(q,{tag:"h4",...e,className:"text-3xl"}),inlineCode:e=>(0,r.jsx)("code",{...e}),pre:e=>(0,r.jsx)("pre",{className:"[&>code]:bg-transparent [&>code]:after:hidden [&>code]:font-normal",children:e.children}),code:e=>{var s;let t=/language-(\w+)/.exec(null!==(s=e.className)&&void 0!==s?s:"");return t?(0,r.jsx)("code",{children:e.children}):(0,r.jsx)("code",{...e,className:" bg-gray-200 dark:bg-gray-700 dark:text-white rounded before:content-[''] after:content-[''] px-2 font-semibold inline-block"})},Alert:function(e){let{children:s,title:t}=e;return(0,r.jsx)("div",{className:"bg-yellow-50 dark:bg-[#282a36] border-l-4 border-yellow-400 p-4",children:(0,r.jsxs)("div",{className:"flex",children:[(0,r.jsx)("div",{className:"flex-shrink-0",children:(0,r.jsx)(Z.Z,{className:"h-5 w-5 text-yellow-400","aria-hidden":"true"})}),(0,r.jsx)("div",{className:"ml-3",children:(0,r.jsx)("p",{className:"text-sm text-yellow-700 -my-4",children:s})})]})})}},M=l.useLayoutEffect;function H(e){let{children:s,nav:t}=e,a=(0,l.useRef)(null),[d,h]=(0,l.useState)([]);M(()=>{var e,s,t,r;h(Array.from(null!==(s=null===(e=a.current)||void 0===e?void 0:e.querySelectorAll("h2, h3"))&&void 0!==s?s:[]).map(e=>({url:"#".concat(e.id),depth:null!==(t=Number.parseInt(e.tagName.replace("H",""),10))&&void 0!==t?t:0,text:null!==(r=e.textContent)&&void 0!==r?r:""})))},[]);let x=_(t);return(0,r.jsx)(P,{toc:t,children:(0,r.jsxs)(o.Zo,{components:G,children:[(0,r.jsx)(R,{className:"fixed pt-8 top-16 right-4 hidden md:block md:w-[calc(100%-min(816px,75%))] xl:w-[calc(50%-min(416px,37.5%))] bottom-0 overflow-y-auto",items:d,nav:t,currentPage:x}),(0,r.jsxs)("div",{ref:a,className:"prose dark:prose-invert",children:[s,(0,r.jsxs)("div",{className:"mt-20 flex justify-center space-x-4",children:[(null==x?void 0:x.prevPage)&&(0,r.jsxs)(n(),{href:x.prevPage.link,className:"flex items-center space-x-2 border shadow p-4 text-gray-700 dark:text-gray-200 no-underline hover:shadow-md hover:underline",children:[(0,r.jsx)(c.Z,{height:22}),(0,r.jsx)("span",{children:x.prevPage.name})]}),(null==x?void 0:x.nextPage)&&(0,r.jsxs)(n(),{href:x.nextPage.link,className:"flex items-center space-x-2 border shadow p-4 text-gray-700  dark:text-gray-200 no-underline hover:shadow-md hover:underline",children:[(0,r.jsx)("span",{children:x.nextPage.name}),(0,r.jsx)(i.Z,{height:22})]})]})]})]})})}}}]);