1 |
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6860],{56716:function(e,t,n){"use strict";var a=n(52322),s=n(81076),r=n(32079),i=n(99248),o=n(96958),l=n(46594);t.Z=e=>{let{language:t,officialSupport:n,docsUrl:c,gitUrl:d,altIconName:u}=e;return(0,a.jsxs)("div",{className:"flex items-start space-x-6",children:[(0,a.jsx)("img",{src:"".concat(i.GW,"/img/libraries/").concat(u?"".concat(u,"-icon.svg"):"".concat(t.toLowerCase(),"-icon.svg")),alt:"".concat(t," logo"),width:"21"}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("div",{children:(0,a.jsxs)("h5",{className:"flex items-center gap-2 text-base text-foreground",children:[t," ",!n&&(0,a.jsx)(s.C,{variant:"brand",children:"Community"})]})}),(0,a.jsxs)("div",{className:"flex gap-2",children:[c&&(0,a.jsx)("a",{href:c,target:"_blank",rel:"noreferrer",children:(0,a.jsx)(r.z,{icon:(0,a.jsx)(o.Z,{}),type:"default",children:"Docs"})}),(0,a.jsx)("a",{href:d,target:"_blank",rel:"noreferrer",children:(0,a.jsx)(r.z,{icon:(0,a.jsx)(l.Z,{}),type:"default",children:"See GitHub"})})]})]})]})}},1875:function(e,t,n){"use strict";var a=n(52322),s=n(99248),r=n(91179),i=n(6659),o=n(39097),l=n.n(o);t.Z=e=>{let{framework:t,title:n,description:o,url:c}=e,{resolvedTheme:d}=(0,i.F)();return(0,a.jsx)(l(),{href:c,target:"_blank",rel:"noreferrer",children:(0,a.jsxs)("div",{className:"group relative border bg-surface-100 border-overlay flex h-32 flex-row rounded-md p-4 hover:bg-overlay-hover transition duration-150 ease-in-out",children:[(0,a.jsx)("div",{className:"mr-4 flex flex-col",children:(0,a.jsx)("img",{className:"transition-all group-hover:scale-110",src:"".concat(s.GW,"/img/libraries/").concat(t.toLowerCase()).concat(["expo","nextjs"].includes(t.toLowerCase())&&(null==d?void 0:d.includes("dark"))?"-dark":"","-icon.svg"),alt:"".concat(t," logo"),width:26,height:26})}),(0,a.jsxs)("div",{className:"w-4/5 space-y-2",children:[(0,a.jsx)("h5",{className:"text-foreground",children:n}),(0,a.jsx)("p",{className:"text-sm text-foreground-light",children:o})]}),(0,a.jsx)("div",{className:" absolute right-4 top-3 text-foreground-lighter transition-all duration-200 group-hover:right-3 group-hover:text-foreground ",children:(0,a.jsx)(r.Z,{})})]})})}},35898:function(e,t,n){"use strict";n.d(t,{B:function(){return s},l:function(){return a}});let a=[{language:"JavaScript",officialSupport:!0,releaseState:void 0,docsUrl:"https://supabase.com/docs/reference/javascript/installing",gitUrl:"https://github.com/supabase/supabase-js"},{language:"Flutter",officialSupport:!0,releaseState:void 0,docsUrl:"https://supabase.com/docs/reference/dart/installing",gitUrl:"https://github.com/supabase/supabase-flutter"},{language:"Python",officialSupport:!0,releaseState:"Alpha",docsUrl:"https://supabase.com/docs/reference/python/initializing",gitUrl:"https://github.com/supabase/supabase-py"},{language:"C#",officialSupport:!1,releaseState:void 0,docsUrl:"https://supabase.com/docs/reference/csharp/installing",gitUrl:"https://github.com/supabase-community/supabase-csharp",altIconName:"c-sharp"},{language:"Swift",officialSupport:!0,releaseState:void 0,docsUrl:"https://supabase.com/docs/reference/swift/initializing",gitUrl:"https://github.com/supabase/supabase-swift"},{language:"Kotlin",officialSupport:!1,releaseState:void 0,docsUrl:"https://supabase.com/docs/reference/kotlin/installing",gitUrl:"https://github.com/supabase-community/supabase-kt"}],s=[{framework:"Svelte",title:"Svelte kanban board",description:"A Trello clone using Supabase as the storage system.",url:"https://github.com/joshnuss/supabase-kanban",type:"app"},{framework:"nextjs",title:"Next.js Realtime chat app",description:"Next.js Slack clone app using Supabase realtime subscriptions",url:"https://github.com/supabase/supabase/tree/master/examples/slack-clone/nextjs-slack-clone",type:"app"},{framework:"nextjs",title:"Next.js Subscription and Auth",description:"The all-in-one starter kit for high-performance SaaS applications.",url:"https://github.com/vercel/nextjs-subscription-payments",type:"app"},{framework:"Expo",title:"Expo Starter",description:"Template bottom tabs with auth flow (Typescript)",url:"https://github.com/codingki/react-native-expo-template/tree/master/template-typescript-bottom-tabs-supabase-auth-flow",type:"mobile"},{framework:"NestJS",title:"NestJS example",description:"NestJS example using Supabase Auth",url:"https://github.com/hiro1107/nestjs-supabase-auth",type:"app"},{framework:"React",title:"React realtime chat app",description:"Example app of real-time chat using supabase realtime api",url:"https://github.com/shwosner/realtime-chat-supabase-react",type:"app"},{framework:"nextjs",title:"Next.js todo list app",description:"Next.js todo list example",url:"https://github.com/supabase/supabase/tree/master/examples/todo-list/nextjs-todo-list",type:"app"},{framework:"Svelte",title:"Svelte todo list app",description:"Sveltejs todo with TailwindCSS and Snowpack",url:"https://github.com/supabase/supabase/tree/master/examples/todo-list/sveltejs-todo-list",type:"app"},{framework:"Flutter",title:"Flutter chat app",description:"A Flutter chat app built with supabase-flutter",url:"https://github.com/supabase-community/flutter-chat",type:"mobile"},{framework:"Swift",title:"Swift user management app",description:"Swift user management app using supabase-swift",url:"https://github.com/supabase/supabase-swift/tree/main/Examples/UserManagement",type:"mobile"},{framework:"Swift",title:"Swift Slack Clone",description:"Swift Slack clone app using supabase-swift",url:"https://github.com/supabase/supabase-swift/tree/main/Examples/SlackClone",type:"mobile"},{framework:"Flutter",title:"Flutter MFA app",description:"A Flutter app demonstrating how to implement MFA",url:"https://github.com/supabase/supabase/tree/master/examples/auth/flutter-mfa"},{framework:"NuxtJS",title:"NuxtJS todo list app",description:"NuxtJS todo app example",url:"https://github.com/nuxt-modules/supabase/tree/main/demo"}]},88137:function(e,t,n){"use strict";n.d(t,{Z:function(){return w}});var a=n(52322),s=n(59491),r=n(5632),i=n(2784),o=n(56958),l=n(92293),c=n(27570),d=n(29887),u=n(85945),p=n(48228),h=n(31696),m=n(27181);async function g(e){let{projectRef:t}=e,{data:n,error:a}=await (0,h.IV)("/platform/projects/{ref}",{params:{path:{ref:t}}});return a&&(0,h.S3)(a),n}let f=function(){let{onSuccess:e,onError:t,...n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=(0,u.NL)();return(0,p.D)(e=>g(e),{async onSuccess(t,n,s){await a.invalidateQueries(m.i.list()),await (null==e?void 0:e(t,n,s))},async onError(e,n,a){void 0===t?o.Am.error("Failed to delete project: ".concat(e.message)):t(e,n,a)},...n})};var x=n(93463),j=n(87175),b=n(89823),y=n(750),v=n(34820),w=e=>{var t,n;let{visible:u,onClose:p}=e,h=(0,r.useRouter)(),{project:m}=(0,c.d2)(),g=(0,b.l)(),w=null==m?void 0:m.ref,{data:N}=(0,x.Gl)({orgSlug:null==g?void 0:g.slug}),k="free"===(null!==(n=null==N?void 0:null===(t=N.plan)||void 0===t?void 0:t.id)&&void 0!==n?n:"free"),[S,_]=(0,i.useState)(""),[C,E]=(0,i.useState)([]),{mutate:A,isLoading:T}=f({onSuccess:async()=>{if(!k)try{await R({projectRef:w,message:S,reasons:C.reduce((e,t)=>"".concat(e,"- ").concat(t,"\n"),""),exitAction:"delete"})}catch(e){}o.Am.success("Successfully deleted ".concat(null==m?void 0:m.name)),h.push("/projects")}}),{mutateAsync:R,isLoading:L}=(0,d.S)(),z=T||L;(0,i.useEffect)(()=>{u&&(E([]),_(""))},[u]),(0,j.Xo)(s.KA.UPDATE,"projects",{resource:{project_id:null==m?void 0:m.id}});let I=e=>{E(void 0===C.find(t=>t===e)?C.concat([e]):C.filter(t=>t!==e))};async function U(){if(void 0!==m){if(!k&&0===C.length)return o.Am.error("Please select at least one reason for deleting your project");A({projectRef:m.ref})}}return(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(v.Z,{visible:u,loading:z,size:k?"small":"medium",title:"Confirm deletion of ".concat(null==m?void 0:m.name),variant:"destructive",alert:{title:k?"This action cannot be undone.":"This will permanently delete the ".concat(null==m?void 0:m.name),description:k?"":"All project data will be lost, and cannot be undone"},text:k?"This will permanently delete the ".concat(null==m?void 0:m.name," project and all of its data."):void 0,confirmPlaceholder:"Type the project name in here",confirmString:(null==m?void 0:m.name)||"",confirmLabel:"I understand, delete this project",onConfirm:U,onCancel:()=>{z||p()},children:!k&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("h4",{className:"text-base",children:"Help us improve."}),(0,a.jsx)("p",{className:"text-sm text-foreground-light",children:"We always strive to improve Supabase as much as we can. Please let us know the reasons you are deleting your project so that we can improve in the future."})]}),(0,a.jsxs)("div",{className:"space-y-4 pt-4",children:[(0,a.jsx)("div",{className:"flex flex-wrap gap-2","data-toggle":"buttons",children:l.Y.map(e=>{let t=C.find(t=>t===e);return(0,a.jsxs)("label",{className:["flex cursor-pointer items-center space-x-2 rounded-md py-1","pl-2 pr-3 text-center text-sm shadow-sm transition-all duration-100","".concat(t?" bg-foreground text-background opacity-100 hover:bg-opacity-75":" bg-border-strong text-foreground opacity-25 hover:opacity-50")].join(" "),children:[(0,a.jsx)("input",{type:"checkbox",name:"options",value:e,className:"hidden",onClick:e=>I(e.target.value)}),(0,a.jsx)("div",{children:e})]},e)})}),(0,a.jsx)("div",{className:"text-area-text-sm",children:(0,a.jsx)(y.Z.TextArea,{name:"message",label:"Anything else that we can improve on?",rows:3,value:S,onChange:e=>_(e.target.value)})})]})]})})})}},3837:function(e,t,n){"use strict";n.d(t,{N:function(){return N}});var a=n(52322),s=n(99959),r=n(39097),i=n.n(r),o=n(2784),l=n(14674),c=n(74122),d=n(76651),u=n(67277);let p=e=>e.length?e.filter(e=>{if(!e.capped||!e.available_in_plan||e.unlimited)return!1;let t=e.pricing_free_units||0;return e.usage>t}).map(e=>e.metric):[];var h=n(93463),m=n(82718),g=n(89823),f=n(26211),x=n(99248),j=n(81076),b=e=>{let{defaultValue:t}=e;return(0,a.jsx)(a.Fragment,{children:(null==t?void 0:t.length)?t.map((e,t)=>(0,a.jsxs)(o.Fragment,{children:[t>0&&(0,a.jsx)("span",{className:"text-border-stronger dark:text-border-strong",children:(0,a.jsx)("svg",{viewBox:"0 0 24 24",width:"16",height:"16",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round",fill:"none",shapeRendering:"geometricPrecision",children:(0,a.jsx)("path",{d:"M16 3.549L7.12 20.600"})})}),(0,a.jsx)("a",{onClick:e.onClick||(()=>{}),className:"text-gray-1100 block px-2 py-1 text-xs leading-5 focus:bg-gray-100 focus:text-gray-900 focus:outline-none ".concat(e.onClick?"cursor-pointer hover:text-white":""),children:e.label})]},e.key)):null})},y=n(88739),v=n(72742),w=n(67517),N=e=>{let{customHeaderComponents:t,breadcrumbs:n=[],headerBorder:r=!0}=e,{ref:N}=(0,s.UO)(),k=(0,f.V)(),S=(0,g.l)(),_=(null==k?void 0:k.is_branch_enabled)===!0,{data:C}=(0,m.v)({orgSlug:null==S?void 0:S.slug}),E=(0,o.useMemo)(()=>!!C&&p((null==C?void 0:C.usages)||[]).length>0,[C]),{data:A}=(0,h.Gl)({orgSlug:null==S?void 0:S.slug}),T=(null==A?void 0:A.usage_billing_enabled)===!0,R=((null==A?void 0:A.plan.id)==="free"||(null==A?void 0:A.plan.id)==="pro")&&!T&&E;return(0,a.jsxs)("div",{className:"flex h-12 max-h-12 min-h-12 items-center justify-between py-2 px-5 bg-dash-sidebar ".concat(r?"border-b border-default":""),children:[(0,a.jsxs)("div",{className:"-ml-2 flex items-center text-sm",children:[N&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.Z,{}),N&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-border-stronger",children:(0,a.jsx)("svg",{viewBox:"0 0 24 24",width:"16",height:"16",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round",fill:"none",shapeRendering:"geometricPrecision",children:(0,a.jsx)("path",{d:"M16 3.549L7.12 20.600"})})}),(0,a.jsx)(u.Z,{}),R&&(0,a.jsx)("div",{className:"ml-2",children:(0,a.jsx)(i(),{href:"/org/".concat(null==S?void 0:S.slug,"/usage"),children:(0,a.jsx)(j.C,{variant:"destructive",children:"Exceeding usage limits"})})})]}),k&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-border-stronger",children:(0,a.jsx)("svg",{viewBox:"0 0 24 24",width:"16",height:"16",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round",fill:"none",shapeRendering:"geometricPrecision",children:(0,a.jsx)("path",{d:"M16 3.549L7.12 20.600"})})}),_?(0,a.jsx)(l.Z,{}):(0,a.jsx)(c.Z,{})]})]}),(0,a.jsx)(b,{defaultValue:n})]}),(0,a.jsxs)("div",{className:"flex items-center gap-x-2",children:[t&&t,x.Qy&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(y.v,{}),(0,a.jsx)(w.Z,{}),(0,a.jsx)(v.Z,{})]})]})]})}},90345:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var a=n(52322),s=n(99959),r=n(41679),i=n(26198);t.C=()=>{var e;let{ref:t}=(0,s.UO)(),{data:n,isLoading:l}=(0,i.Sy)(),c="default"!==t?null==n?void 0:null===(e=n.find(e=>e.ref===t))||void 0===e?void 0:e.name:"Welcome to your project";return(0,a.jsxs)("div",{className:"w-full mx-auto my-16 space-y-16 max-w-7xl",children:[(0,a.jsx)("div",{className:"flex items-center mx-6 space-x-6",children:l?(0,a.jsx)(r.Z,{className:"h-9 w-40"}):(0,a.jsx)("h1",{className:"text-3xl",children:c})}),(0,a.jsx)("div",{className:"mx-6",children:(0,a.jsx)(o,{})}),(0,a.jsxs)("div",{className:"mx-6 space-y-4",children:[(0,a.jsx)(r.Z,{className:"w-40 h-7"}),(0,a.jsx)(r.Z,{className:"w-full h-32"})]})]})};let o=()=>(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)(r.Z,{className:"w-40 h-7"}),(0,a.jsxs)("div",{className:"flex md:gap-4 lg:gap-8",children:[(0,a.jsx)(r.Z,{className:"w-full h-[304px]"}),(0,a.jsx)(r.Z,{className:"w-full h-[304px]"}),(0,a.jsx)(r.Z,{className:"w-full h-[304px]"}),(0,a.jsx)(r.Z,{className:"w-full h-[304px]"})]})]})},16860:function(e,t,n){"use strict";n.d(t,{$:function(){return ny},Z:function(){return nv}});var a=n(52322),s=n(99959),r=n(97729),i=n.n(r),o=n(5632),l=n(2784),c=n(49251),d=n(32079),u=n(53535),p=n(22721),h=n(16289),m=n(62614),g=n(80435),f=e=>{var t;let{apikey:n,endpoint:r,selectedLanguage:i,snippet:o,children:l}=e,{ref:c}=(0,s.UO)(),d=null===(t=o[i])||void 0===t?void 0:t.call(o,n,r).replaceAll("[ref]",null!=c?c:"");return(0,a.jsxs)("div",{id:o.key,className:"space-y-4 py-6 pb-2 last:pb-6",children:[(0,a.jsxs)("div",{className:"px-4 space-y-4",children:[(0,a.jsx)("h2",{className:"doc-heading",children:o.title}),void 0!==o.description&&(0,a.jsx)("div",{className:"doc-section",children:(0,a.jsx)("article",{className:"text text-sm text-foreground-light",children:(0,a.jsx)(g.U,{className:"max-w-none",content:o.description.replaceAll("[ref]",null!=c?c:"_")})})})]}),l,void 0!==d&&(0,a.jsx)("div",{className:"px-4 codeblock-container",children:(0,a.jsx)("div",{className:"bg rounded p-2",children:(0,a.jsx)(m.Z,{className:i,children:d})})})]})};let x=[{name:"Connect",key:"introduction"},{name:"User Management",key:"user-management"},{name:"Tables & Views",key:"entities"},{name:"Stored Procedures",key:"stored-procedures"},{name:"Storage",key:"storage"},{name:"Edge Functions",key:"edge-functions"},{name:"Realtime",key:"realtime"}],j={init:{key:"introduction",category:"introduction",title:"Connect to your project",description:"Projects have a RESTful endpoint that you can use with your project's API key to query and manage your database. Put these keys in your .env file.",js:(e,t)=>"\nimport { createClient } from '@supabase/supabase-js'\n\nconst supabaseUrl = '".concat(t,"'\nconst supabaseKey = process.env.SUPABASE_KEY\nconst supabase = createClient(supabaseUrl, supabaseKey)"),bash:()=>"# No client library required for Bash."},clientApiKeys:{key:"client-api-keys",category:"introduction",title:"Client API Keys",description:'Client keys allow "anonymous access" to your database, until the user has logged in. After logging in, the keys will switch to the user\'s own login token.\n\nIn this documentation, we will refer to the key using the name `SUPABASE_KEY`. You can find the `anon` key in the [API settings](/project/[ref]/settings/api) page.',js:(e,t)=>"\nconst SUPABASE_KEY = '".concat(e,"'\nconst SUPABASE_URL = '").concat(t,"'\nconst supabase = createClient(SUPABASE_URL, process.env.SUPABASE_KEY);"),bash:(e,t)=>"".concat(e)},serviceApiKeys:{key:"service-keys",category:"introduction",title:"Service Keys",description:"Service keys have *FULL* access to your data, bypassing any security policies. Be VERY careful where you expose these keys. They should only be used on a server and never on a client or browser.\n\nIn this documentation, we refer to the key using the name `SERVICE_KEY`. You can find the `service_role` key above or in the [API settings](/project/[ref]/settings/api) page.",js:(e,t)=>"\nconst SUPABASE_KEY = '".concat(e,"'\nconst SUPABASE_URL = 'https://").concat(t,"'\nconst supabase = createClient(SUPABASE_URL, process.env.SUPABASE_KEY);"),bash:(e,t)=>"".concat(e)},userManagement:{key:"user-management",category:"user-management",title:"Introduction",description:"Supabase makes it easy to manage your users.\n\n Supabase assigns each user a unique ID. You can reference this ID anywhere in your database. For example, you might create a `profiles` table references the user using a `user_id` field.\n\n Supabase already has built in the routes to sign up, login, and log out for managing users in your apps and websites.",js:void 0,bash:void 0},signUp:{key:"sign-up",category:"user-management",title:"Sign up",description:'Allow your users to sign up and create a new account\n\n After they have signed up, all interactions using the Supabase client will be performed as "that user".',js:(e,t)=>"\nconst { data, error } = await supabase.auth.signUp({\n email: 'someone@email.com',\n password: 'some-secure-password'\n})",bash:(e,t)=>"\ncurl -X POST '".concat(t,"/auth/v1/signup' \\\n-H \"apikey: ").concat(e,'" \\\n-H "Content-Type: application/json" \\\n-d \'{\n "email": "someone@email.com",\n "password": "some-secure-password"\n}\'')},emailLogin:{key:"email-login",category:"user-management",title:"Log in with Email/Password",description:'\nIf an account is created, users can login to your app.\n\nAfter they have logged in, all interactions using the Supabase JS client will be performed as "that user".',js:(e,t)=>"\nconst { data, error } = await supabase.auth.signInWithPassword({\n email: 'someone@email.com',\n password: 'some-secure-password'\n})\n ",bash:(e,t)=>"\ncurl -X POST '".concat(t,"/auth/v1/token?grant_type=password' \\\n-H \"apikey: ").concat(e,'" \\\n-H "Content-Type: application/json" \\\n-d \'{\n "email": "someone@email.com",\n "password": "some-secure-password"\n}\'\n ')},magicLinkLogin:{key:"magic-link-login",category:"user-management",title:"Log in with Magic Link via Email",description:'\nSend a user a passwordless link which they can use to redeem an access_token.\n\nAfter they have clicked the link, all interactions using the Supabase JS client will be performed as "that user".',js:(e,t)=>"\nconst { data, error } = await supabase.auth.signInWithOtp({\n email: 'someone@email.com'\n})\n ",bash:(e,t)=>"\ncurl -X POST '".concat(t,"/auth/v1/magiclink' \\\n-H \"apikey: ").concat(e,'" \\\n-H "Content-Type: application/json" \\\n-d \'{\n "email": "someone@email.com"\n}\'\n ')},phoneLogin:{key:"phone-log-in",category:"user-management",title:"Sign up with Phone/Password",description:"\nA phone number can be used instead of an email as a primary account confirmation mechanism.\n\nThe user will receive a mobile OTP via sms with which they can verify that they control the phone number.\n\nYou must enter your own twilio credentials on the auth settings page to enable sms confirmations.",js:(e,t)=>"\nconst { data, error } = await supabase.auth.signUp({\n phone: '+13334445555',\n password: 'some-password'\n})\n ",bash:(e,t)=>"\ncurl -X POST '".concat(t,"/auth/v1/signup' \\\n-H \"apikey: ").concat(e,'" \\\n-H "Content-Type: application/json" \\\n-d \'{\n "phone": "+13334445555",\n "password": "some-password"\n}\'\n ')},smsLogin:{key:"sms-otp-log-in",category:"user-management",title:"Login via SMS OTP",description:"\nSMS OTPs work like magic links, except you have to provide an interface for the user to verify the 6 digit number they receive.\n\nYou must enter your own twilio credentials on the auth settings page to enable SMS-based Logins.",js:(e,t)=>"\nconst { data, error } = await supabase.auth.signInWithOtp({\n phone: '+13334445555'\n})\n ",bash:(e,t)=>"\ncurl -X POST '".concat(t,"/auth/v1/otp' \\\n-H \"apikey: ").concat(e,'" \\\n-H "Content-Type: application/json" \\\n-d \'{\n "phone": "+13334445555"\n}\'\n ')},smsVerify:{key:"sms-verify",category:"user-management",title:"Verify an SMS OTP",description:"\nOnce the user has received the OTP, have them enter it in a form and send it for verification\n\nYou must enter your own twilio credentials on the auth settings page to enable SMS-based OTP verification.",js:(e,t)=>"\nconst { data, error } = await supabase.auth.verifyOtp({\n phone: '+13334445555',\n token: '123456',\n type: 'sms'\n})\n ",bash:(e,t)=>"\ncurl -X POST '".concat(t,"/auth/v1/verify' \\\n-H \"apikey: ").concat(e,'" \\\n-H "Content-Type: application/json" \\\n-d \'{\n "type": "sms",\n "phone": "+13334445555",\n "token": "123456"\n}\'\n ')},oauthLogin:{key:"oauth-login",category:"user-management",title:"Log in with Third Party OAuth",description:'\nUsers can log in with Third Party OAuth like Google, Facebook, GitHub, and more. You must first enable each of these in the Auth Providers settings [here](https://supabase.com).\n\nView all the available [Third Party OAuth providers](https://supabase.com).\n\nAfter they have logged in, all interactions using the Supabase JS client will be performed as "that user".\n\nGenerate your Client ID and secret from: [Google](https://console.developers.google.com/apis/credentials), [Github](https://github.com/settings/applications/new), [Gitlab](https://gitlab.com/oauth/applications), [Facebook](https://developers.facebook.com/apps), and [Bitbucket](https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud).',js:(e,t)=>"\nconst { data, error } = await supabase.auth.signInWithOAuth({\n provider: 'github'\n})\n ",bash:(e,t)=>"No available command"},user:{key:"get-user",category:"user-management",title:"Get user",description:"Get the JSON object for the logged in user.",js:(e,t)=>"\nconst { data: { user } } = await supabase.auth.getUser()\n ",bash:(e,t)=>"\ncurl -X GET '".concat(t,"/auth/v1/user' \\\n-H \"apikey: ").concat(e,'" \\\n-H "Authorization: Bearer USER_TOKEN"\n ')},forgotPassWordEmail:{key:"forgot-password-email",category:"user-management",title:"Forgot password / email",description:'Sends the user a log in link via email. Once logged in you should direct the user to a new password form. And use "Update User" below to save the new password.',js:(e,t)=>"\nconst { data, error } = await supabase.auth.resetPasswordForEmail(email)\n ",bash:(e,t)=>"\ncurl -X POST '".concat(t,"/auth/v1/recover' \\\n-H \"apikey: ").concat(e,'" \\\n-H "Content-Type: application/json" \\\n-d \'{\n"email": "someone@email.com"\n}\'\n')},updateUser:{key:"update-user",category:"user-management",title:"Update User",description:"Update the user with a new email or password. Each key (email, password, and data) is optional.",js:(e,t)=>'\nconst { data, error } = await supabase.auth.updateUser({\n email: "new@email.com",\n password: "new-password",\n data: { hello: \'world\' }\n})\n ',bash:(e,t)=>"\ncurl -X PUT '".concat(t,"/auth/v1/user' \\\n-H \"apikey: ").concat(e,'" \\\n-H "Authorization: Bearer <USERS-ACCESS-TOKEN>" \\\n-H "Content-Type: application/json" \\\n-d \'{\n"email": "someone@email.com",\n"password": "new-password",\n"data": {\n "key": "value"\n}\n}\'\n')},logout:{key:"log-out",category:"user-management",title:"Log out",description:'After calling log out, all interactions using the Supabase JS client will be "anonymous".',js:(e,t)=>"\nconst { error } = await supabase.auth.signOut()\n ",bash:(e,t)=>"\ncurl -X POST '".concat(t,"/auth/v1/logout' \\\n-H \"apikey: ").concat(e,'" \\\n-H "Content-Type: application/json" \\\n-H "Authorization: Bearer USER_TOKEN"\n ')},emailInvite:{key:"email-invite",category:"user-management",title:"Invite user over email",description:'\nSend a user a passwordless link which they can use to sign up and log in.\n\nAfter they have clicked the link, all interactions using the Supabase JS client will be performed as "that user".\n\nThis endpoint requires you use the `service_role_key` when initializing the client, and should only be invoked from the server, never from the client.',js:(e,t)=>"\nconst { data, error } = await supabase.auth.api.inviteUserByEmail('someone@email.com')\n ",bash:(e,t)=>"\ncurl -X POST '".concat(t,"/auth/v1/invite' \\\n-H \"apikey: ").concat(e,'" \\\n-H "Authorization: Bearer ').concat(e,'" \\\n-H "Content-Type: application/json" \\\n-d \'{\n "email": "someone@email.com"\n}\'\n ')},storage:{key:"storage",category:"storage",title:"Introduction",description:"Supabase Storage makes it simple to upload and serve files of any size, providing a robust framework for file access controls.\n\nYou can use Supabase Storage to store images, videos, documents, and any other file type. Serve your assets with a global CDN to reduce latency from over 285 cities globally. Supabase Storage includes a built-in image optimizer, so you can resize and compress your media files on the fly.",js:void 0,bash:void 0},edgeFunctions:{key:"edge-function",category:"edge-functions",title:"Introduction",description:"\nEdge Functions are server-side TypeScript functions, distributed globally at the edge—close to your users. They can be used for listening to webhooks or integrating your Supabase project with third-parties like Stripe. Edge Functions are developed using Deno, which offers a few benefits to you as a developer:\n",js:void 0,bash:void 0},edgeFunctionsPreReq:{key:"edge-function-pre-req",category:"edge-functions",title:"Pre-requisites",description:"\nFollow the steps to prepare your Supabase project on your local machine.\n\n- Install the Supabase [CLI](https://supabase.com/docs/guides/cli).\n- [Login to the CLI](https://supabase.com/docs/reference/cli/usage#supabase-login) using the command: `supabase login`..\n- [Initialize Supabase](https://supabase.com/docs/guides/getting-started/local-development#getting-started) inside your project using the command: `supabase init`..\n- [Link to your Remote Project](https://supabase.com/docs/reference/cli/usage#supabase-link) using the command `supabase link --project-ref [ref]`..\n- Setup your environment: Follow the steps [here](https://supabase.com/docs/guides/functions/quickstart#setting-up-your-environment).\n",js:void 0,bash:void 0},createEdgeFunction:{key:"create-edge-function",category:"edge-functions",title:"Create an Edge Function",description:"\nCreate a Supabase Edge Function locally via the Supabase CLI.\n",js:()=>"// Create an edge function via the Supabase CLI",bash:()=>"\nsupabase functions new hello-world\n"},deployEdgeFunction:{key:"deploy-edge-function",category:"edge-functions",title:"Deploy an Edge Function",description:"\nDeploy a Supabase Edge Function to your Supabase project via the Supabase CLI.\n",js:()=>"// Deploy an edge function via the Supabase CLI",bash:()=>"supabase functions deploy hello-world --project-ref [ref]\n"},entitiesIntroduction:{key:"entities-introduction",category:"entities",title:"Introduction",description:"\nAll views and tables in the `public` schema, and those accessible by the active database role for a request are available for querying via the API.\n\nIf you don't want to expose tables in your API, simply add them to a different schema (not the `public` schema).\n",js:void 0,bash:void 0},generatingTypes:{key:"generating-types",category:"entities",title:"Generating Types",description:"\nSupabase APIs are generated from your database, which means that we can use database introspection to generate type-safe API definitions.\n\nYou can generate types from your database either through the [Supabase CLI](https://supabase.com/docs/guides/database/api/generating-types), or by downloading the types file via the button on the right and importing it in your application within `src/index.ts`.\n",js:void 0,bash:void 0},graphql:{key:"graphql",category:"entities",title:"GraphQL vs PostgREST",description:"\nIf you have a GraphQL background, you might be wondering if you can fetch your data in a single round-trip. The answer is yes! The syntax is very similar. This example shows how you might achieve the same thing with Apollo GraphQL and Supabase.\n\nStill want GraphQL?\nIf you still want to use GraphQL, you can. Supabase provides you with a full Postgres database, so as long as your middleware can connect to the database then you can still use the tools you love. You can find the database connection details [in the settings](/project/[ref]/settings/database).\n",js:(e,t)=>"\n// With Apollo GraphQL\nconst { loading, error, data } = useQuery(gql`\n query GetDogs {\n dogs {\n id\n breed\n owner {\n id\n name\n }\n }\n }\n `)\n\n// With Supabase\nconst { data, error } = await supabase\n .from('dogs')\n .select(`\n id, breed,\n owner (id, name)\n `)\n",bash:(e,t)=>"\n// With Apollo GraphQL\nconst { loading, error, data } = useQuery(gql`\n query GetDogs {\n dogs {\n id\n breed\n owner {\n id\n name\n }\n }\n }\n `)\n\n// With Supabase\nconst { data, error } = await supabase\n .from('dogs')\n .select(`\n id, breed,\n owner (id, name)\n `)\n "},storedProceduresIntroduction:{key:"stored-procedures-introduction",category:"stored-procedures",title:"Introduction",description:"\nAll of your database stored procedures are available on your API. This means you can build your logic directly into the database (if you're brave enough)!\n\nThe API endpoint supports POST (and in some cases GET) to execute the function.\n",js:void 0,bash:void 0},realtime:{key:"realtime-introduction",category:"realtime",title:"Introduction",description:"\nSupabase provides a globally distributed cluster of Realtime servers that enable the following functionality:\n\n- [Broadcast](https://supabase.com/docs/guides/realtime/broadcast): Send ephemeral messages from client to clients with low latency.\n- [Presence](https://supabase.com/docs/guides/realtime/presence): Track and synchronize shared state between clients.\n- [Postgres Changes](https://supabase.com/docs/guides/realtime/postgres-changes): Listen to Postgres database changes and send them to authorized clients.\n",js:void 0,bash:void 0},subscribeChannel:{key:"subscribe-to-channel",category:"realtime",title:"Subscribe to channel",description:"\nCreates an event handler that listens to changes.\n\n- By default, Broadcast and Presence are enabled for all projects.\n- By default, listening to database changes is disabled for new projects due to database performance and security concerns. You can turn it on by managing Realtime's [replication](https://supabase.com/docs/guides/api#realtime-api-overview).\n- You can receive the \"previous\" data for updates and deletes by setting the table's `REPLICA IDENTITY` to `FULL` (e.g., `ALTER TABLE your_table REPLICA IDENTITY FULL;`).\n- Row level security is not applied to delete statements. When RLS is enabled and replica identity is set to full, only the primary key is sent to clients.\n",js:()=>"\nsupabase\n .channel('any')\n .on('broadcast', { event: 'cursor-pos' }, payload => {\n console.log('Cursor position received!', payload)\n })\n .subscribe((status) => {\n if (status === 'SUBSCRIBED') {\n channel.send({\n type: 'broadcast',\n event: 'cursor-pos',\n payload: { x: Math.random(), y: Math.random() },\n })\n }\n })\n ",bash:()=>"# Realtime streams are only supported by our client libraries"},unsubscribeChannel:{key:"unsubscribe-channel",category:"realtime",title:"Unsubscribe from a channel",description:"\nUnsubscribes and removes Realtime channel from Realtime client.\n\nRemoving a channel is a great way to maintain the performance of your project's Realtime service as well as your database if you're listening to Postgres changes. Supabase will automatically handle cleanup 30 seconds after a client is disconnected, but unused channels may cause degradation as more clients are simultaneously subscribed.\n",js:()=>"supabase.removeChannel(myChannel)",bash:()=>"# Realtime streams are only supported by our client libraries"},unsubscribeChannels:{key:"unsubscribe-channels",category:"realtime",title:"Unsubscribe from all channels",description:"\nUnsubscribes and removes all Realtime channels from Realtime client.\n\nRemoving a channel is a great way to maintain the performance of your project's Realtime service as well as your database if you're listening to Postgres changes. Supabase will automatically handle cleanup 30 seconds after a client is disconnected, but unused channels may cause degradation as more clients are simultaneously subscribed.\n",js:()=>"supabase.removeChannels()",bash:()=>"# Realtime streams are only supported by our client libraries"},retrieveAllChannels:{key:"unsubscribe-channel",category:"realtime",title:"Unsubscribe from a channel",description:"\nReturns all Realtime channels.\n",js:()=>"const channels = supabase.getChannels()",bash:()=>"# Realtime streams are only supported by our client libraries"}},b={rpcSingle:{key:"invoke-function",title:"Invoke function",category:"stored-procedures",description:void 0,docsUrl:"https://supabase.com/docs/reference/javascript/rpc",code:e=>{let{rpcName:t,rpcParams:n,endpoint:a,apiKey:s,showBearer:r=!0}=e,i=n.map(e=>'"'.concat(e.name,'": "value"')).join(", "),o=!n.length,l=o?"":", {".concat(n.length?n.map(e=>"\n ".concat(e.name)).join(", ").concat("\n "):"","}");return[{key:"rpc-single",title:void 0,bash:"\n curl -X POST '".concat(a,"/rest/v1/rpc/").concat(t,"' \\").concat(o?"":"\n-d '{ ".concat(i," }' \\"),'\n -H "Content-Type: application/json" \\\n -H "apikey: ').concat(s,'" ').concat(r?'\\\n -H "Authorization: Bearer '.concat(s,'"'):"","\n "),js:"\nlet { data, error } = await supabase\n .rpc('".concat(t,"'").concat(l,")\n\nif (error) console.error(error)\nelse console.log(data)\n ")}]}},readRows:{key:"read-rows",title:"Read rows",category:"entities",docsUrl:"https://supabase.com/docs/reference/javascript/select",description:"To read rows in this table, use the `select` method.",code:e=>{let{resourceId:t,endpoint:n,apikey:a}=e;return[{key:"read-all-rows",title:"Read all rows",bash:"\ncurl '".concat(n,"/rest/v1/").concat(t,"?select=*' \\\n-H \"apikey: ").concat(a,'" \\\n-H "Authorization: Bearer ').concat(a,'"\n '),js:"\nlet { data: ".concat(t,", error } = await supabase\n .from('").concat(t,"')\n .select('*')\n ")},{key:"read-specific-columns",title:"Read specific columns",bash:"\ncurl '".concat(n,"/rest/v1/").concat(t,"?select=some_column,other_column' \\\n-H \"apikey: ").concat(a,'" \\\n-H "Authorization: Bearer ').concat(a,'"\n '),js:"\nlet { data: ".concat(t,", error } = await supabase\n .from('").concat(t,"')\n .select('some_column,other_column')\n ")},{key:"read-foreign-tables",title:"Read referenced tables",bash:"\ncurl '".concat(n,"/rest/v1/").concat(t,"?select=some_column,other_table(foreign_key)' \\\n-H \"apikey: ").concat(a,'" \\\n-H "Authorization: Bearer ').concat(a,'"\n '),js:"\nlet { data: ".concat(t,", error } = await supabase\n .from('").concat(t,"')\n .select(`\n some_column,\n other_table (\n foreign_key\n )\n `)\n ")},{key:"with-pagination",title:"With pagination",bash:"\ncurl '".concat(n,"/rest/v1/").concat(t,"?select=*' \\\n-H \"apikey: ").concat(a,'" \\\n-H "Authorization: Bearer ').concat(a,'" \\\n-H "Range: 0-9"\n '),js:"\nlet { data: ".concat(t,", error } = await supabase\n .from('").concat(t,"')\n .select('*')\n .range(0, 9)\n ")}]}},filtering:{key:"filter-rows",category:"entities",title:"Filtering",description:"Supabase provides a wide range of filters",docsUrl:"https://supabase.com/docs/reference/javascript/using-filters",code:e=>{let{resourceId:t,endpoint:n,apikey:a}=e;return[{key:"with-filtering",title:"With filtering",bash:"\ncurl '".concat(n,"/rest/v1/").concat(t,"?id=eq.1&select=*' \\\n-H \"apikey: ").concat(a,'" \\\n-H "Authorization: Bearer ').concat(a,'" \\\n-H "Range: 0-9"\n '),js:"\nlet { data: ".concat(t,", error } = await supabase\n .from('").concat(t,"')\n .select(\"*\")\n\n // Filters\n .eq('column', 'Equal to')\n .gt('column', 'Greater than')\n .lt('column', 'Less than')\n .gte('column', 'Greater than or equal to')\n .lte('column', 'Less than or equal to')\n .like('column', '%CaseSensitive%')\n .ilike('column', '%CaseInsensitive%')\n .is('column', null)\n .in('column', ['Array', 'Values'])\n .neq('column', 'Not equal to')\n\n // Arrays\n .contains('array_column', ['array', 'contains'])\n .containedBy('array_column', ['contained', 'by'])\n ")}]}},insertRows:{key:"insert-rows",category:"entities",title:"Insert rows",description:"\n`insert` lets you insert into your tables. You can also insert in bulk and do UPSERT.\n\n`insert` will also return the replaced values for UPSERT.\n",docsUrl:"https://supabase.com/docs/reference/javascript/insert",code:e=>{let{resourceId:t,endpoint:n,apikey:a}=e;return[{key:"insert-a-row",title:"Insert a row",bash:"\ncurl -X POST '".concat(n,"/rest/v1/").concat(t,"' \\\n-H \"apikey: ").concat(a,'" \\\n-H "Authorization: Bearer ').concat(a,'" \\\n-H "Content-Type: application/json" \\\n-H "Prefer: return=minimal" \\\n-d \'{ "some_column": "someValue", "other_column": "otherValue" }\'\n '),js:"\nconst { data, error } = await supabase\n .from('".concat(t,"')\n .insert([\n { some_column: 'someValue', other_column: 'otherValue' },\n ])\n .select()\n ")},{key:"insert-many-rows",title:"Insert many rows",bash:"\ncurl -X POST '".concat(n,"/rest/v1/").concat(t,"' \\\n-H \"apikey: ").concat(a,'" \\\n-H "Authorization: Bearer ').concat(a,'" \\\n-H "Content-Type: application/json" \\\n-d \'[{ "some_column": "someValue" }, { "other_column": "otherValue" }]\'\n '),js:"\nconst { data, error } = await supabase\n .from('".concat(t,"')\n .insert([\n { some_column: 'someValue' },\n { some_column: 'otherValue' },\n ])\n .select()\n ")},{key:"upsert-matching-rows",title:"Upsert matching rows",bash:"\ncurl -X POST '".concat(n,"/rest/v1/").concat(t,"' \\\n-H \"apikey: ").concat(a,'" \\\n-H "Authorization: Bearer ').concat(a,'" \\\n-H "Content-Type: application/json" \\\n-H "Prefer: resolution=merge-duplicates" \\\n-d \'{ "some_column": "someValue", "other_column": "otherValue" }\'\n '),js:"\nconst { data, error } = await supabase\n .from('".concat(t,"')\n .upsert({ some_column: 'someValue' })\n .select()\n ")}]}},updateRows:{key:"update-rows",category:"entities",title:"Update rows",description:"\n`update` lets you update rows. `update` will match all rows by default. You can update specific rows using horizontal filters, e.g. `eq`, `lt`, and `is`.\n\n`update` will also return the replaced values for UPDATE.\n",docsUrl:"https://supabase.com/docs/reference/javascript/update",code:e=>{let{resourceId:t,endpoint:n,apikey:a}=e;return[{key:"update-matching-rows",title:"Update matching rows",bash:"\ncurl -X PATCH '".concat(n,"/rest/v1/").concat(t,"?some_column=eq.someValue' \\\n-H \"apikey: ").concat(a,'" \\\n-H "Authorization: Bearer ').concat(a,'" \\\n-H "Content-Type: application/json" \\\n-H "Prefer: return=minimal" \\\n-d \'{ "other_column": "otherValue" }\'\n '),js:"\nconst { data, error } = await supabase\n .from('".concat(t,"')\n .update({ other_column: 'otherValue' })\n .eq('some_column', 'someValue')\n .select()\n ")}]}},deleteRows:{key:"delete-rows",category:"entities",title:"Delete rows",description:"\n`delete` lets you delete rows. `delete` will match all rows by default, so remember to specify your filters!\n",docsUrl:"https://supabase.com/docs/reference/javascript/delete",code:e=>{let{resourceId:t,endpoint:n,apikey:a}=e;return[{key:"delete-matching-rows",title:"Delete matching rows",bash:"\ncurl -X DELETE '".concat(n,"/rest/v1/").concat(t,"?some_column=eq.someValue' \\\n-H \"apikey: ").concat(a,'" \\\n-H "Authorization: Bearer ').concat(a,'"\n '),js:"\nconst { error } = await supabase\n .from('".concat(t,"')\n .delete()\n .eq('some_column', 'someValue')\n ")}]}},subscribeChanges:{key:"subscribe-changes",category:"entities",title:"Subscribe to changes",description:"\nSupabase provides realtime functionality and broadcasts database changes to authorized users depending on Row Level Security (RLS) policies.\n",docsUrl:"https://supabase.com/docs/reference/javascript/subscribe",code:e=>{let{resourceId:t}=e;return[{key:"subscribe-all-events",title:"Subscribe to all events",bash:"# Realtime streams are only supported by our client libraries",js:"\nconst channels = supabase.channel('custom-all-channel')\n .on(\n 'postgres_changes',\n { event: '*', schema: 'public', table: '".concat(t,"' },\n (payload) => {\n console.log('Change received!', payload)\n }\n )\n .subscribe()")},{key:"subscribe-to-inserts",title:"Subscribe to inserts",bash:"# Realtime streams are only supported by our client libraries",js:"\nconst channels = supabase.channel('custom-insert-channel')\n .on(\n 'postgres_changes',\n { event: 'INSERT', schema: 'public', table: '".concat(t,"' },\n (payload) => {\n console.log('Change received!', payload)\n }\n )\n .subscribe()")},{key:"subscribe-to-updates",title:"Subscribe to updates",bash:"# Realtime streams are only supported by our client libraries",js:"\nconst channels = supabase.channel('custom-update-channel')\n .on(\n 'postgres_changes',\n { event: 'UPDATE', schema: 'public', table: '".concat(t,"' },\n (payload) => {\n console.log('Change received!', payload)\n }\n )\n .subscribe()")},{key:"subscribe-to-deletes",title:"Subscribe to deletes",bash:"# Realtime streams are only supported by our client libraries",js:"\nconst channels = supabase.channel('custom-delete-channel')\n .on(\n 'postgres_changes',\n { event: 'DELETE', schema: 'public', table: '".concat(t,"' },\n (payload) => {\n console.log('Change received!', payload)\n }\n )\n .subscribe()")},{key:"subscribe-to-specific-rows",title:"Subscribe to specific rows",bash:"# Realtime streams are only supported by our client libraries",js:"\nconst channels = supabase.channel('custom-filter-channel')\n .on(\n 'postgres_changes',\n { event: '*', schema: 'public', table: '".concat(t,"', filter: 'some_column=eq.some_value' },\n (payload) => {\n console.log('Change received!', payload)\n }\n )\n .subscribe()")}]}},uploadFile:{key:"upload-file",category:"storage",title:"Upload a file",docsUrl:"https://supabase.com/docs/reference/javascript/storage-from-upload",description:"\nUpload a file to an existing bucket. RLS policy permissions required:\n- `buckets` table permissions: none\n- `objects` table permissions: only `insert` when you are uploading new files and `select`, `insert`, and `update` when you are upserting files.\n",code:e=>{let{name:t,apikey:n,endpoint:a}=e;return[{key:"storage-upload-file",title:void 0,bash:"\ncurl -X POST '".concat(a,"/storage/v1/object/").concat(t,"/folder/avatar1.png' \\\n-H 'Content-Type: image/png' \\\n-H \"Authorization: Bearer ").concat(n,"\" \\\n--data-binary @/path/to/your/file'\n-H 'Content-Type: multipart/form-data' \\\n-H \"Authorization: Bearer ").concat(n,"\" \\\n--data-raw $'your_file_data'\n "),js:"\nconst avatarFile = event.target.files[0]\nconst { data, error } = await supabase\n .storage\n .from('".concat(t,"')\n .upload('folder/avatar1.png', avatarFile, {\n cacheControl: '3600',\n upsert: false\n })\n")}]}},deleteFiles:{key:"delete-files",category:"storage",title:"Delete files",docsUrl:"https://supabase.com/docs/reference/javascript/storage-from-remove",description:"\nDelete files within the bucket. RLS policy permissions required:\n- `buckets` table permissions: none\n- `objects` table permissions: `delete` and `select`\n",code:e=>{let{name:t,apikey:n,endpoint:a}=e;return[{key:"storage-delete-files",title:void 0,bash:"\ncurl -X DELETE '".concat(a,"/storage/v1/object/").concat(t,'\' \\\n-H "Content-Type: application/json" \\\n-H "Authorization: Bearer ').concat(n,'" \\\n-d \'{ "prefixes": ["file_name", "another_file_name"] }\'\n'),js:"\nconst { data, error } = await supabase\n .storage\n .from('".concat(t,"')\n .remove(['folder/avatar1.png'])\n ")}]}},listFiles:{key:"list-files",category:"storage",title:"List all files",docsUrl:"https://supabase.com/docs/reference/javascript/storage-from-list",description:"\nList all files within the bucket. RLS policy permissions required:\n- `buckets` table permissions: none\n- `objects` table permissions: `select`\n",code:e=>{let{name:t,apikey:n,endpoint:a}=e;return[{key:"storage-list-files",title:void 0,bash:"\ncurl -X POST '".concat(a,"/storage/v1/object/list/").concat(t,'\' \\\n-H "Content-Type: application/json" \\\n-H "Authorization: Bearer ').concat(n,'" \\\n-d \'{ "limit": 100, "offset": 0, "prefix": "", "sortBy": { "column": "name", "order": "asc" } }\''),js:"\nconst { data, error } = await supabase\n .storage\n .from('".concat(t,"')\n .list('folder', {\n limit: 100,\n offset: 0,\n sortBy: { column: 'name', order: 'asc' },\n })\n ")}]}},downloadFile:{key:"download-file",category:"storage",title:"Download a file",docsUrl:"https://supabase.com/docs/reference/javascript/storage-from-download",description:"\nDownloads a file from a private bucket. For public buckets, make a request to the URL returned from getPublicUrl instead. RLS policy permissions required:\n- `buckets` table permissions: none\n- `objects` table permissions: `select`\n",code:e=>{let{name:t,apikey:n,endpoint:a}=e;return[{key:"storage-download-file",title:void 0,bash:"\ncurl -X GET '".concat(a,"/storage/v1/object/").concat(t,'/folder/avatar1.png\' \\\n-H "Content-Type: application/json" \\\n-H "Authorization: Bearer ').concat(n,'" \\\n--output avatar1.png\n'),js:"\nconst { data, error } = await supabase\n .storage\n .from('".concat(t,"')\n .download('folder/avatar1.png')\n ")}]}},createSignedURL:{key:"create-signed-url",category:"storage",title:"Create a signed URL",docsUrl:"https://supabase.com/docs/reference/javascript/storage-from-createsignedurl",description:"\nCreate a signed URL which can be used to share a file for a fixed amount of time. RLS policy permissions required:\n- `buckets` table permissions: none\n- `objects` table permissions: `select`\n",code:e=>{let{name:t,apikey:n,endpoint:a}=e;return[{key:"storage-create-signed-url",title:void 0,bash:"\ncurl -X POST '".concat(a,"/storage/v1/object/sign/").concat(t,'/folder/avatar1.png\' \\\n-H "Content-Type: application/json" \\\n-H "Authorization: Bearer ').concat(n,'" \\\n-d \'{ "expiresIn": 60 }\'\n '),js:"\nconst { data, error } = await supabase\n .storage\n .from('".concat(t,"')\n .createSignedUrl('folder/avatar1.png', 60)\n ")}]}},retrievePublicURL:{key:"retrieve-public-url",category:"storage",title:"Retrieve public URL",docsUrl:"https://supabase.com/docs/reference/javascript/storage-from-getpublicurl",description:'\nA simple convenience function to get the URL for an asset in a public bucket. If you do not want to use this function, you can construct the public URL by concatenating the bucket URL with the path to the asset.\n\nThis function does not verify if the bucket is public. If a public URL is created for a bucket which is not public, you will not be able to download the asset.\n\nThe bucket needs to be set to public, either via `updateBucket()` or by going to Storage on supabase.com/dashboard, clicking the overflow menu on a bucket and choosing "Make public"\n\nRLS policy permissions required:\n- `buckets` table permissions: none\n- `objects` table permissions: none\n',code:e=>{let{name:t,apikey:n,endpoint:a}=e;return[{key:"storage-retrieve-public-url",title:void 0,bash:"\n# No bash command available.\n# You can construct the public URL by concatenating the bucket URL with the path to the asset\n# e.g ".concat(a,"/storage/v1/object/public/").concat(t,"/folder/avatar1.png"),js:"\nconst { data } = supabase\n .storage\n .from('".concat(t,"')\n .getPublicUrl('folder/avatar1.png')\n ")}]}},invokeEdgeFunction:{key:"invoke-edge-function",category:"edge-functions",title:"Invoke an edge function",docsUrl:"https://supabase.com/docs/reference/javascript/functions-invoke",description:"\nInvokes a Supabase Edge Function. Requires an Authorization header, and invoke params generally match the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) spec.\n\nWhen you pass in a body to your function, we automatically attach the `Content-Type` header for `Blob`, `ArrayBuffer`, `File`, `FormData` and `String`. If it doesn't match any of these types we assume the payload is `json`, serialize it and attach the `Content-Type` header as `application/json`. You can override this behavior by passing in a `Content-Type` header of your own.\n\nResponses are automatically parsed as `json`, `blob` and `form-data` depending on the `Content-Type` header sent by your function. Responses are parsed as `text` by default.\n",code:e=>{let{name:t,endpoint:n,apikey:a}=e;return[{key:"invoke-edge-function",title:void 0,bash:"\ncurl --request POST '".concat(n,"/functions/v1/").concat(t,"' \\\n--header 'Authorization: Bearer ").concat(a,"' \\\n--header 'Content-Type: application/json' \\\n--data '{ \"name\": \"Functions\" }'\n "),js:"\nconst { data, error } = await supabase\n .functions\n .invoke('".concat(t,"', {\n body: { foo: 'bar' }\n })")}]}}};var y=e=>{let{language:t}=e;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(f,{selectedLanguage:t,snippet:j.edgeFunctions}),(0,a.jsx)(f,{selectedLanguage:t,snippet:j.edgeFunctionsPreReq}),(0,a.jsx)(f,{selectedLanguage:t,snippet:j.createEdgeFunction}),(0,a.jsx)(f,{selectedLanguage:t,snippet:j.deployEdgeFunction})]})},v=n(39097),w=n.n(v),N=n(56958),k=n(65416),S=n(17172),_=n(17913),C=e=>{let{language:t}=e,{ref:n}=(0,s.UO)(),[r,i]=(0,l.useState)(!1),o=async()=>{try{i(!0);let e=await (0,k.J)({ref:n}),t=document.createElement("a");t.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(e.types)),t.setAttribute("download","supabase.ts"),t.style.display="none",document.body.appendChild(t),t.click(),document.body.removeChild(t),N.Am.success("Successfully generated types! File is being downloaded")}catch(e){N.Am.error("Failed to generate types: ".concat(e.message))}finally{i(!1)}};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(f,{selectedLanguage:t,snippet:j.entitiesIntroduction}),(0,a.jsxs)("div",{children:[(0,a.jsx)(f,{selectedLanguage:t,snippet:j.generatingTypes}),(0,a.jsxs)("div",{className:"flex items-center space-x-2 px-4 mt-3",children:[(0,a.jsx)(d.z,{asChild:!0,type:"default",icon:(0,a.jsx)(S.Z,{}),children:(0,a.jsx)(w(),{href:"https://supabase.com/docs/guides/database/api/generating-types",target:"_blank",rel:"noreferrer",children:"Documentation"})}),(0,a.jsx)(d.z,{type:"default",disabled:r,loading:r,icon:(0,a.jsx)(_.Z,{strokeWidth:1.5}),onClick:o,children:"Generate and download types"})]}),(0,a.jsx)("p",{className:"text-xs text-foreground-light px-4 mt-2",children:"Remember to re-generate and download this file as you make changes to your tables."})]}),(0,a.jsx)(f,{selectedLanguage:t,snippet:j.graphql})]})},E=n(750),A=n(82955),T=n(94299),R=e=>{var t;let{showKeys:n,language:r,apikey:i,endpoint:o}=e,{ref:c}=(0,s.UO)(),{data:p}=(0,u.q)({projectRef:c}),[h,m]=(0,l.useState)();(0,l.useEffect)(()=>{void 0!==h&&setTimeout(()=>m(void 0),2e3)},[h]);let g=n&&null!==(t=null==p?void 0:p.autoApiService.serviceApiKey)&&void 0!==t?t:"SUPABASE_CLIENT_SERVICE_KEY";return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(f,{selectedLanguage:r,apikey:i,endpoint:o,snippet:j.init,children:(0,a.jsxs)("div",{className:"px-4 space-y-6",children:[(0,a.jsxs)("div",{className:"flex space-x-4 mt-8",children:[(0,a.jsx)("p",{className:"text-sm w-40",children:"Project URL"}),(0,a.jsx)(E.Z,{disabled:!0,readOnly:!0,copy:!0,size:"small",value:o,className:"w-full"})]}),(0,a.jsxs)("div",{className:"flex space-x-4",children:[(0,a.jsx)("p",{className:"text-sm w-40",children:"Client API key"}),(0,a.jsx)(E.Z,{disabled:!0,readOnly:!0,size:"small",value:n?i:"Reveal API keys via dropdown in the header",className:"w-full",descriptionText:"This key is safe to use in a browser if you have enabled Row Level Security (RLS) for your tables and configured policies.",actions:[(0,a.jsx)(d.z,{type:"default",icon:(0,a.jsx)(T.Z,{}),onClick:()=>{var e;m("anon"),(0,A.vQ)(null!==(e=null==p?void 0:p.autoApiService.defaultApiKey)&&void 0!==e?e:"SUPABASE_CLIENT_ANON_KEY")},children:"anon"===h?"Copied":"Copy"},"copy")]})]}),(0,a.jsxs)("div",{className:"flex space-x-4",children:[(0,a.jsx)("p",{className:"text-sm w-40 mb-16",children:"Service key"}),(0,a.jsx)(E.Z,{disabled:!0,readOnly:!0,size:"small",value:n?g:"Reveal API keys via dropdown in the header",className:"w-full",descriptionText:(0,a.jsxs)("p",{children:["This key has the ability to bypass Row Level Security."," ",(0,a.jsx)("span",{className:"text-amber-900",children:"Never share it publicly."})]}),actions:[(0,a.jsx)(d.z,{type:"default",icon:(0,a.jsx)(T.Z,{}),onClick:()=>{var e;m("service"),(0,A.vQ)(null!==(e=null==p?void 0:p.autoApiService.serviceApiKey)&&void 0!==e?e:"SUPABASE_CLIENT_SERVICE_KEY")},children:"service"===h?"Copied":"Copy"},"copy")]})]})]})}),(0,a.jsx)(f,{selectedLanguage:r,apikey:i,endpoint:o,snippet:j.clientApiKeys}),(0,a.jsx)(f,{selectedLanguage:r,apikey:g,endpoint:o,snippet:j.serviceApiKeys})]})},L=e=>{let{language:t}=e;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(f,{selectedLanguage:t,snippet:j.realtime}),(0,a.jsx)(f,{selectedLanguage:t,snippet:j.subscribeChannel}),(0,a.jsx)(f,{selectedLanguage:t,snippet:j.unsubscribeChannel}),(0,a.jsx)(f,{selectedLanguage:t,snippet:j.unsubscribeChannels}),(0,a.jsx)(f,{selectedLanguage:t,snippet:j.retrieveAllChannels})]})},z=e=>{let{language:t}=e;return(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(f,{selectedLanguage:t,snippet:j.storage})})},I=e=>{let{language:t}=e;return(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(f,{selectedLanguage:t,snippet:j.storedProceduresIntroduction})})},U=e=>{let{language:t,apikey:n,endpoint:s}=e;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(f,{selectedLanguage:t,snippet:j.userManagement}),(0,a.jsx)(f,{selectedLanguage:t,apikey:n,endpoint:s,snippet:j.signUp}),(0,a.jsx)(f,{selectedLanguage:t,apikey:n,endpoint:s,snippet:j.emailLogin}),(0,a.jsx)(f,{selectedLanguage:t,apikey:n,endpoint:s,snippet:j.magicLinkLogin}),(0,a.jsx)(f,{selectedLanguage:t,apikey:n,endpoint:s,snippet:j.phoneLogin}),(0,a.jsx)(f,{selectedLanguage:t,apikey:n,endpoint:s,snippet:j.smsLogin}),(0,a.jsx)(f,{selectedLanguage:t,apikey:n,endpoint:s,snippet:j.smsVerify}),(0,a.jsx)(f,{selectedLanguage:t,apikey:n,endpoint:s,snippet:j.oauthLogin}),(0,a.jsx)(f,{selectedLanguage:t,apikey:n,endpoint:s,snippet:j.user}),(0,a.jsx)(f,{selectedLanguage:t,apikey:n,endpoint:s,snippet:j.forgotPassWordEmail}),(0,a.jsx)(f,{selectedLanguage:t,apikey:n,endpoint:s,snippet:j.updateUser}),(0,a.jsx)(f,{selectedLanguage:t,apikey:n,endpoint:s,snippet:j.logout}),(0,a.jsx)(f,{selectedLanguage:t,apikey:n,endpoint:s,snippet:j.emailInvite})]})},P=n(81076),O=n(88787),Z=e=>{let{selectedLanguage:t,snippet:n,codeSnippets:r}=e,{ref:i}=(0,s.UO)();return(0,a.jsxs)("div",{id:n.key,className:"space-y-4 py-6",children:[(0,a.jsxs)("div",{className:"px-4 space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("h2",{className:"doc-heading",children:n.title}),void 0!==n.docsUrl&&(0,a.jsx)(d.z,{asChild:!0,type:"default",icon:(0,a.jsx)(S.Z,{}),children:(0,a.jsx)(w(),{href:n.docsUrl,target:"_blank",rel:"noreferrer",children:"Documentation"})})]}),void 0!==n.description&&(0,a.jsx)("div",{className:"doc-section",children:(0,a.jsx)("article",{className:"text text-sm text-foreground-light",children:(0,a.jsx)(g.U,{className:"max-w-none",content:n.description.replaceAll("[ref]",null!=i?i:"_")})})})]}),r.map(e=>(0,a.jsxs)("div",{className:"px-4 space-y-2",children:[(0,a.jsx)("p",{className:"text-sm text-foreground-light",children:e.title}),(0,a.jsx)("div",{className:"codeblock-container",children:(0,a.jsx)("div",{className:"bg rounded p-2",children:(0,a.jsx)(m.Z,{className:t,children:e[t]})})})]},e.key))]})},F=e=>{let{language:t,apikey:n,endpoint:r}=e,{ref:i}=(0,s.UO)(),o=(0,h.WZ)(),{data:l}=(0,O.K)({projectRef:i}),c=o.activeDocsSection[1],d=(null!=l?l:[]).find(e=>e.name===c),u=null==d?void 0:d.allowed_mime_types,p=null==d?void 0:d.file_size_limit;return void 0===d?null:(0,a.jsxs)("div",{className:"divide-y",children:[(0,a.jsxs)("div",{className:"space-y-1 px-4 py-4",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("h2",{className:"text-xl",children:d.name}),(0,a.jsx)(P.C,{variant:d.public?"warning":"default",children:d.public?"Public":"Private"})]}),(0,a.jsxs)("p",{className:"text-sm text-foreground-light",children:["Allowed MIME types:"," ",null===u?"All types are allowed":0===(null!=u?u:[]).length?"No types are allowed":(null!=u?u:[]).length>1?(null!=u?u:[]).join(", "):"Unknown"]}),(0,a.jsxs)("p",{className:"text-sm text-foreground-light",children:["Max file size limit:"," ",null===p?"No limit":"".concat((0,A.td)(p))]})]}),(0,a.jsx)(Z,{selectedLanguage:t,snippet:b.uploadFile,codeSnippets:b.uploadFile.code({name:c,apikey:n,endpoint:r})}),(0,a.jsx)(Z,{selectedLanguage:t,snippet:b.deleteFiles,codeSnippets:b.deleteFiles.code({name:c,apikey:n,endpoint:r})}),(0,a.jsx)(Z,{selectedLanguage:t,snippet:b.listFiles,codeSnippets:b.listFiles.code({name:c,apikey:n,endpoint:r})}),(0,a.jsx)(Z,{selectedLanguage:t,snippet:b.downloadFile,codeSnippets:b.downloadFile.code({name:c,apikey:n,endpoint:r})}),d.public?(0,a.jsx)(Z,{selectedLanguage:t,snippet:b.retrievePublicURL,codeSnippets:b.retrievePublicURL.code({name:c,apikey:n,endpoint:r})}):(0,a.jsx)(Z,{selectedLanguage:t,snippet:b.createSignedURL,codeSnippets:b.createSignedURL.code({name:c,apikey:n,endpoint:r})})]})},D=n(21970),W=e=>{let{language:t,apikey:n="API_KEY",endpoint:r}=e,{ref:i}=(0,s.UO)(),o=(0,h.WZ)(),{data:l}=(0,D.I)({projectRef:i}),c=o.activeDocsSection[1],d=(null!=l?l:[]).find(e=>e.name===c);return void 0===d?null:(0,a.jsxs)("div",{className:"divide-y",children:[(0,a.jsx)("div",{className:"space-y-1 px-4 py-4",children:(0,a.jsx)("div",{className:"flex items-center space-x-2",children:(0,a.jsx)("h2",{className:"text-xl",children:d.name})})}),(0,a.jsx)(Z,{selectedLanguage:t,snippet:b.invokeEdgeFunction,codeSnippets:b.invokeEdgeFunction.code({name:c,endpoint:"".concat(r),apikey:n})})]})},H=n(15735),q=n(36203);let Y=e=>{{let t=document.getElementById(e);t&&t.scrollIntoView({behavior:"smooth"})}},B=e=>{let t=e.lastIndexOf("Note:\nThis is a Primary Key.<pk/>"),n=e.lastIndexOf("Note:\nThis is a Foreign Key to"),a=e;return t>=0&&(a=a.substring(0,t)),n>=0&&(a=a.substring(0,n)),a};var M=n(99248),G=n(63203),V=n(78232),J=n(61786),K=n(90504),Q=e=>{let{simplifiedVersion:t=!1}=e,n=(0,h.WZ)(),[s,r]=(0,l.useState)(!1),i=e=>{n.setDocsLanguage(e),r(!1)};return(0,a.jsx)("div",{className:"flex items-center gap-x-2",children:(0,a.jsxs)(J.J2,{modal:!1,open:s,onOpenChange:r,children:[(0,a.jsx)(J.xo,{asChild:!0,children:(0,a.jsx)(d.z,{type:"default",className:t?"px-1":"",icon:t?"js"===n.docsLanguage?(0,a.jsx)("img",{src:"".concat(M.GW,"/img/libraries/javascript-icon.svg"),alt:"javascript logo",width:"14"}):(0,a.jsx)(G.Z,{size:14,strokeWidth:2.5}):void 0,iconRight:!t&&(0,a.jsx)(V.Z,{size:14,strokeWidth:2}),children:t?void 0:"Language: ".concat("js"===n.docsLanguage?"Javascript":"Bash")})}),(0,a.jsx)(J.yk,{className:"p-0 w-24",side:"bottom",align:"end",children:(0,a.jsx)(K.mY,{children:(0,a.jsx)(K.e8,{children:(0,a.jsxs)(K.fu,{children:[(0,a.jsx)(K.di,{className:"cursor-pointer",onSelect:()=>i("js"),onClick:()=>i("js"),children:(0,a.jsx)("p",{children:"Javascript"})}),(0,a.jsx)(K.di,{className:"cursor-pointer",onSelect:()=>i("bash"),onClick:()=>i("bash"),children:(0,a.jsx)("p",{children:"Bash"})})]})})})})]})})},X=e=>{var t,n;let{language:r,apikey:i="",endpoint:o=""}=e,{ref:c}=(0,s.UO)(),d=(0,h.WZ)().activeDocsSection[1],{data:u,refetch:p}=(0,q.a)({projectRef:c}),m=null==u?void 0:null===(t=u.definitions)||void 0===t?void 0:t[d],g=void 0!==m?Object.entries(m.properties).map(e=>{var t;let[n,a]=e;return{...a,id:n,required:(null!==(t=null==m?void 0:m.required)&&void 0!==t?t:[]).includes(n)}}):[];return((0,l.useEffect)(()=>{void 0!==d&&p()},[d]),void 0===d)?null:(0,a.jsxs)("div",{className:"divide-y relative",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 py-4 sticky top-0 bg-surface-100 z-10 border-b shadow-md",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-y-1",children:[(0,a.jsx)("h2",{className:"text-xl",children:d}),(0,a.jsx)("p",{className:"text-sm text-foreground-light",children:null!==(n=null==m?void 0:m.description)&&void 0!==n?n:"No description available"})]}),(0,a.jsx)(Q,{})]}),(0,a.jsxs)("div",{className:"space-y-2 px-4 py-4 !border-t-0",children:[(0,a.jsx)("p",{className:"text-sm text-foreground-light",children:"Columns"}),(0,a.jsx)(H.Z,{head:[(0,a.jsx)(H.Z.th,{children:"Name"},"name"),(0,a.jsx)(H.Z.th,{children:"Format"},"format"),(0,a.jsx)(H.Z.th,{children:"Type"},"type"),(0,a.jsx)(H.Z.th,{children:"Description"},"description")],body:g.map(e=>{var t;let n=function(e,t){if(void 0===e&&("jsonb"===t||"json"===t))return"json";switch(e){case"string":return"string";case"integer":case"number":return"number";case"json":return"json";case"boolean":return"boolean";default:return e}}(e.type,e.format);return(0,a.jsxs)(H.Z.tr,{children:[(0,a.jsx)(H.Z.td,{title:e.id,children:e.id}),(0,a.jsx)(H.Z.td,{title:e.format,children:(0,a.jsx)("p",{className:"truncate",children:e.format})}),(0,a.jsx)(H.Z.td,{title:n,children:n}),(0,a.jsx)(H.Z.td,{title:e.description,children:B(null!==(t=e.description)&&void 0!==t?t:"").trim()})]},e.id)})})]}),(0,a.jsx)(Z,{selectedLanguage:r,snippet:b.readRows,codeSnippets:b.readRows.code({resourceId:d,endpoint:o,apikey:i})}),(0,a.jsx)(Z,{selectedLanguage:r,snippet:b.filtering,codeSnippets:b.filtering.code({resourceId:d,endpoint:o,apikey:i})}),(0,a.jsx)(Z,{selectedLanguage:r,snippet:b.insertRows,codeSnippets:b.insertRows.code({resourceId:d,endpoint:o,apikey:i})}),(0,a.jsx)(Z,{selectedLanguage:r,snippet:b.updateRows,codeSnippets:b.updateRows.code({resourceId:d,endpoint:o,apikey:i})}),(0,a.jsx)(Z,{selectedLanguage:r,snippet:b.deleteRows,codeSnippets:b.deleteRows.code({resourceId:d,endpoint:o,apikey:i})}),(0,a.jsx)(Z,{selectedLanguage:r,snippet:b.subscribeChanges,codeSnippets:b.subscribeChanges.code({resourceId:d})})]})},$=n(26002);let ee=e=>{var t,n;let{language:r}=e,{ref:i}=(0,s.UO)(),o=(0,h.WZ)(),{data:c,refetch:d}=(0,q.a)({projectRef:i}),{data:u,refetch:p}=(0,$.H)({projectRef:i}),m=null!==(n=null==u?void 0:u.functions)&&void 0!==n?n:[],g=o.activeDocsSection[1],f=m.find(e=>e.name===g),{post:{parameters:x}}=null!=f?f:{},j=null==c?void 0:c.paths[null==f?void 0:f.path],y=null==j?void 0:null===(t=j.post)||void 0===t?void 0:t.summary,v=Object.entries(x&&x[0]&&x[0].schema&&x[0].schema.properties?x[0].schema.properties:{}).map(e=>{let[t,n]=e;return{name:t,...n,required:x[0].schema.required.includes(t)}}).filter(e=>!!e.name);return((0,l.useEffect)(()=>{void 0!==g&&(d(),p())},[g]),void 0===f)?null:(0,a.jsxs)("div",{className:"divide-y",children:[(0,a.jsxs)("div",{className:"space-y-1 px-4 py-4",children:[(0,a.jsx)("h2",{className:"text-xl",children:f.name}),(0,a.jsx)("p",{className:"text-sm text-foreground-light",children:null!=y?y:"No description available"})]}),(0,a.jsxs)("div",{className:"space-y-2 px-4 py-4",children:[(0,a.jsx)("p",{className:"text-sm text-foreground-light",children:"Function arguments"}),(0,a.jsx)(H.Z,{head:[(0,a.jsx)(H.Z.th,{children:"Name"},"name"),(0,a.jsx)(H.Z.th,{children:"Format"},"format"),(0,a.jsx)(H.Z.th,{children:"Type"},"type"),(0,a.jsx)(H.Z.th,{},"required")],body:v.map(e=>(0,a.jsxs)(H.Z.tr,{children:[(0,a.jsx)(H.Z.td,{title:e.name,children:(0,a.jsx)("p",{className:"font-mono text-xs text-foreground truncate",children:e.name})}),(0,a.jsx)(H.Z.td,{title:e.format,children:e.format}),(0,a.jsx)(H.Z.td,{title:e.type,children:e.type}),(0,a.jsx)(H.Z.td,{children:e.required?(0,a.jsx)(P.C,{variant:"warning",children:"Required"}):(0,a.jsx)(P.C,{variant:"default",children:"Optional"})})]},e.name))})]}),(0,a.jsx)(Z,{selectedLanguage:r,snippet:b.rpcSingle,codeSnippets:b.rpcSingle.code({rpcName:g,rpcParams:v,endpoint:"endpoint",apiKey:"apiKey",showBearer:!0})})]})};var et=n(38183),en=n(40654),ea=n(96958),es=n(57234);let er=()=>(0,a.jsx)("div",{className:"border-t !mt-3 pb-1 mx-3"});var ei=()=>{var e,t;let{ref:n}=(0,s.UO)(),r=(0,h.WZ)(),{projectAuthAll:i,projectStorageAll:o,projectEdgeFunctionAll:c,realtimeAll:u}=(0,en.N)(["project_auth:all","project_storage:all","project_edge_function:all","realtime:all"]),p=x.filter(e=>"user-management"===e.key?i:"storage"===e.key?o:"edge-functions"===e.key?c:"realtime"!==e.key||u),{data:m}=(0,$.H)({projectRef:n}),g=null!==(e=null==m?void 0:m.tables)&&void 0!==e?e:[],f=null!==(t=null==m?void 0:m.functions)&&void 0!==t?t:[],{data:b}=(0,O.K)({projectRef:n}),{data:y}=(0,D.I)({projectRef:n});return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"px-2 py-4 border-b",children:p.map(e=>{let t=r.activeDocsSection[0]===e.key,n=Object.values(j).filter(t=>t.category===e.key);return(0,a.jsxs)(l.Fragment,{children:[(0,a.jsx)("div",{className:"cursor-pointer text-sm py-2 px-3 rounded-md transition ".concat(t?"bg-surface-300":""),onClick:()=>r.setActiveDocsSection([e.key]),children:e.name}),t&&n.length>0&&(0,a.jsxs)("div",{className:"space-y-2 py-2",children:[n.map(t=>(0,a.jsx)("p",{title:t.title,className:"text-sm text-foreground-light px-4 hover:text-foreground transition cursor-pointer",onClick:()=>{r.setActiveDocsSection([e.key]),Y(t.key)},children:t.title},t.key)),"entities"===e.key&&(0,a.jsxs)(a.Fragment,{children:[g.length>0&&(0,a.jsx)(er,{}),g.map(t=>(0,a.jsx)("p",{title:t.name,className:"text-sm text-foreground-light px-4 hover:text-foreground transition cursor-pointer",onClick:()=>r.setActiveDocsSection([e.key,t.name]),children:t.name},t.name))]}),"stored-procedures"===e.key&&(0,a.jsxs)(a.Fragment,{children:[f.length>0&&(0,a.jsx)(er,{}),f.map(t=>(0,a.jsx)("p",{title:t.name,className:"text-sm text-foreground-light px-4 hover:text-foreground transition cursor-pointer",onClick:()=>r.setActiveDocsSection([e.key,t.name]),children:t.name},t.name))]}),"storage"===e.key&&(0,a.jsxs)(a.Fragment,{children:[(null!=b?b:[]).length>0&&(0,a.jsx)(er,{}),(null!=b?b:[]).map(t=>(0,a.jsx)("p",{title:t.name,className:"text-sm text-foreground-light px-4 hover:text-foreground transition cursor-pointer",onClick:()=>r.setActiveDocsSection([e.key,t.name]),children:t.name},t.name))]}),"edge-functions"===e.key&&(0,a.jsxs)(a.Fragment,{children:[(null!=y?y:[]).length>0&&(0,a.jsx)(er,{}),(null!=y?y:[]).map(t=>(0,a.jsx)("p",{title:t.name,className:"text-sm text-foreground-light px-4 hover:text-foreground transition cursor-pointer",onClick:()=>r.setActiveDocsSection([e.key,t.name]),children:t.name},t.name))]})]})]},e.key)})}),(0,a.jsxs)("div",{className:"px-2 py-4 border-b",children:[(0,a.jsx)(d.z,{block:!0,asChild:!0,type:"text",size:"small",icon:(0,a.jsx)(et.Z,{src:"".concat(M.GW,"/img/graphql.svg"),style:{width:"".concat(16,"px"),height:"".concat(16,"px")},className:"text-foreground",preProcessor:e=>e.replace(/svg/,'svg class="m-auto text-color-inherit"')}),onClick:()=>r.setShowProjectApiDocs(!1),children:(0,a.jsx)(w(),{className:"!justify-start",href:"/project/".concat(n,"/api/graphiql"),children:"GraphiQL"})}),(0,a.jsx)(d.z,{block:!0,asChild:!0,type:"text",size:"small",icon:(0,a.jsx)(ea.Z,{}),children:(0,a.jsx)(w(),{href:"https://supabase.com/docs/guides/graphql",target:"_blank",rel:"noreferrer",className:"!justify-start",children:"GraphQL guide"})})]}),(0,a.jsxs)("div",{className:"px-2 py-4",children:[(0,a.jsx)(d.z,{block:!0,asChild:!0,type:"text",size:"small",icon:(0,a.jsx)(es.Z,{}),children:(0,a.jsx)(w(),{href:"https://supabase.com/docs",target:"_blank",rel:"noreferrer",className:"!justify-start",children:"Documentation"})}),(0,a.jsx)(d.z,{block:!0,asChild:!0,type:"text",size:"small",icon:(0,a.jsx)(ea.Z,{}),children:(0,a.jsx)(w(),{href:"https://supabase.com/docs/guides/api",target:"_blank",rel:"noreferrer",className:"!justify-start",children:"REST guide"})})]})]})},eo=n(95492),el=n(63910),ec=n(78645),ed=n(30339),eu=()=>{var e,t;let{ref:n}=(0,s.UO)(),r=(0,h.WZ)(),[i,o]=(0,l.useState)(!1),c=(0,el.cg)(),{data:u}=(0,$.H)({projectRef:n}),p=null!==(e=null==u?void 0:u.tables)&&void 0!==e?e:[],m=null!==(t=null==u?void 0:u.functions)&&void 0!==t?t:[],[g,f]=r.activeDocsSection,{data:x}=(0,O.K)({projectRef:n}),{data:j}=(0,D.I)({projectRef:n}),y=(null!=x?x:[]).find(e=>e.name===f),v={entities:{title:"Tables & Views",options:p,docsUrl:"https://supabase.com/docs/reference/javascript/select"},"stored-procedures":{title:"Stored Procedures",options:m,docsUrl:"https://supabase.com/docs/reference/javascript/rpc"},storage:{title:"Storage",options:null!=x?x:[],docsUrl:"https://supabase.com/docs/reference/javascript/storage-createbucket"},"edge-functions":{title:"Edge Functions",options:null!=j?j:[],docsUrl:"https://supabase.com/docs/reference/javascript/functions-invoke"}},N=e=>{r.setActiveDocsSection([r.activeDocsSection[0],e]),o(!1)},k=Object.values(b).filter(e=>e.category===r.activeDocsSection[0]);return(0,a.jsxs)("div",{className:"py-4",children:[(0,a.jsxs)("div",{className:"px-4 flex items-center space-x-2 mb-2",children:[c&&(0,a.jsx)(d.z,{type:"text",icon:(0,a.jsx)(ec.Z,{}),className:"px-1",onClick:()=>r.setActiveDocsSection([r.activeDocsSection[0]])}),(0,a.jsx)("p",{className:"text-sm text-foreground-light capitalize",children:v[g].title})]}),(0,a.jsxs)(J.J2,{open:i,onOpenChange:o,modal:!1,children:[(0,a.jsx)(J.xo,{asChild:!0,children:(0,a.jsx)("div",{className:"px-4",children:(0,a.jsx)(d.z,{block:!0,type:"default",size:"small",className:"[&>span]:w-full",children:(0,a.jsx)("div",{children:(0,a.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,a.jsx)("p",{children:r.activeDocsSection[1]}),(0,a.jsx)("div",{children:(0,a.jsx)(ed.Z,{className:"rotate-90",strokeWidth:1.5,size:12})})]})})})})}),(0,a.jsx)(J.yk,{className:"p-0 w-60",side:"bottom",align:"center",children:(0,a.jsx)(K.mY,{children:(0,a.jsx)(K.e8,{children:(0,a.jsx)(K.fu,{children:v[g].options.map(e=>(0,a.jsx)(K.di,{className:"cursor-pointer",onSelect:()=>N(e.name),onClick:()=>N(e.name),children:(0,a.jsx)("p",{children:e.name})},e.name))})})})})]}),(0,a.jsx)("div",{className:"px-2 py-4 space-y-2",children:k.map(e=>"storage"===g&&void 0!==y&&(!y.public&&"retrieve-public-url"===e.key||y.public&&"create-signed-url"===e.key)?null:(0,a.jsx)("p",{title:e.title,className:"text-sm text-foreground-light px-4 hover:text-foreground transition cursor-pointer",onClick:()=>Y(e.key),children:e.title},e.key))}),(0,a.jsx)("div",{className:"px-4 py-4 border-t space-y-2",children:(0,a.jsxs)(eo.bZ,{className:"p-3",children:[(0,a.jsx)(eo.Cd,{children:(0,a.jsx)("p",{className:"text-xs",children:"Unable to find what you're looking for?"})}),(0,a.jsxs)(eo.X,{className:"space-y-1",children:[(0,a.jsx)("p",{className:"text-xs !leading-normal",children:"The API methods shown here are only the commonly used ones to get you started building quickly."}),(0,a.jsx)("p",{className:"text-xs !leading-normal",children:"Head over to our docs site for the full API documentation."}),(0,a.jsx)(d.z,{asChild:!0,className:"!mt-2",size:"tiny",type:"default",icon:(0,a.jsx)(S.Z,{strokeWidth:1.5}),children:(0,a.jsx)(w(),{href:v[g].docsUrl,target:"_blank",rel:"noreferrer",children:"Documentation"})})]})]})})]})},ep=()=>{var e,t,n,r;let{ref:i}=(0,s.UO)(),o=(0,h.WZ)(),m=2===o.activeDocsSection.length&&"entities"===o.activeDocsSection[0],[g,f]=(0,l.useState)(!1),x=o.docsLanguage,{data:j}=(0,u.q)({projectRef:i}),{data:b}=(0,p.z)({projectRef:i}),v=g&&null!==(n=null==j?void 0:j.autoApiService.defaultApiKey)&&void 0!==n?n:"SUPABASE_CLIENT_ANON_KEY",w=(null==b?void 0:null===(e=b.customDomain)||void 0===e?void 0:e.status)==="active"?"https://".concat(null===(t=b.customDomain)||void 0===t?void 0:t.hostname):"https://".concat(null!==(r=null==j?void 0:j.autoApiService.endpoint)&&void 0!==r?r:"");return(0,a.jsx)(c.ZP,{hideFooter:!0,size:"xxlarge",className:"max-w-5xl",visible:o.showProjectApiDocs,onCancel:()=>o.setShowProjectApiDocs(!1),children:(0,a.jsxs)("div",{className:"flex items-start h-full",children:[(0,a.jsxs)("div",{className:"w-72 border-r h-full",children:[(0,a.jsxs)("div",{className:"border-b px-4 py-2 flex items-center justify-between",children:[(0,a.jsx)("h4",{children:"API Docs"}),(0,a.jsxs)("div",{className:"flex items-center space-x-1",children:[!m&&(0,a.jsx)(Q,{simplifiedVersion:!0}),(0,a.jsx)(d.z,{type:"default",onClick:()=>f(!g),children:g?"Hide keys":"Show keys"})]})]}),1===o.activeDocsSection.length?(0,a.jsx)(ei,{}):(0,a.jsx)(eu,{})]}),(0,a.jsxs)("div",{className:"flex-1 divide-y space-y-4 max-h-screen overflow-auto",children:["introduction"===o.activeDocsSection[0]&&(0,a.jsx)(R,{showKeys:g,language:x,apikey:v,endpoint:w}),"user-management"===o.activeDocsSection[0]&&(0,a.jsx)(U,{language:x,apikey:v,endpoint:w}),"realtime"===o.activeDocsSection[0]&&(0,a.jsx)(L,{language:x}),"storage"===o.activeDocsSection[0]&&(0,a.jsx)(a.Fragment,{children:void 0!==o.activeDocsSection[1]?(0,a.jsx)(F,{language:x,apikey:v,endpoint:w}):(0,a.jsx)(z,{language:x})}),"edge-functions"===o.activeDocsSection[0]&&(0,a.jsx)(a.Fragment,{children:void 0!==o.activeDocsSection[1]?(0,a.jsx)(W,{language:x,apikey:v,endpoint:w}):(0,a.jsx)(y,{language:x})}),"entities"===o.activeDocsSection[0]&&(0,a.jsx)(a.Fragment,{children:void 0!==o.activeDocsSection[1]?(0,a.jsx)(X,{language:x,apikey:v,endpoint:w}):(0,a.jsx)(C,{language:x})}),"stored-procedures"===o.activeDocsSection[0]&&(0,a.jsx)(a.Fragment,{children:void 0!==o.activeDocsSection[1]?(0,a.jsx)(ee,{language:x}):(0,a.jsx)(I,{language:x})})]})]})})},eh=n(22150),em=n(78696),eg=n(89823),ef=n(26211),ex=n(83690),ej=n(37970),eb=n(8040),ey=()=>{let e=(0,h.WZ)(),t=(0,eg.l)(),n=(0,eh.C)(),s=(0,ef.V)(),[r,i]=(0,em.l)(null==s?void 0:s.ref),o=n||!M.Qy;return(0,a.jsx)(ex.Z,{hideFooter:!0,header:"Supabase AI Settings",visible:e.showAiSettingsModal,onCancel:()=>e.setShowAiSettingsModal(!1),children:(0,a.jsxs)(ex.Z.Content,{className:"flex flex-col items-start justify-between gap-y-4",children:[(0,a.jsxs)("div",{className:"flex flex-col justify-between gap-y-2 text-sm",children:[(0,a.jsx)("p",{className:"text-foreground-light",children:"Schemas metadata to be shared with OpenAI"}),(0,a.jsx)(eb.J,{size:"small",label:o&&r.length>0?"".concat(r.length," schema").concat(r.length>1?"s":""," selected"):"No schemas selected",disabled:M.Qy&&!n,selectedSchemas:r,onSelectSchemas:i}),(0,a.jsx)("p",{className:"text-foreground-lighter",children:"Metadata includes table names, column names and their corresponding data types in the request. This will generate queries that are more relevant to your project."})]}),M.Qy&&!n&&t&&(0,a.jsxs)(eo.bZ,{variant:"warning",children:[(0,a.jsx)(ej.aN,{}),(0,a.jsx)(eo.Cd,{children:"Your organization does not allow sending anonymous data to OpenAI"}),(0,a.jsx)(eo.X,{children:"This option is only available if your organization has opted-in to sending anonymous data to OpenAI. You may configure your opt-in preferences through your organization's settings."}),(0,a.jsx)(eo.X,{className:"mt-3",children:(0,a.jsx)(d.z,{asChild:!0,type:"default",children:(0,a.jsx)(w(),{target:"_blank",rel:"noreferrer",href:"/org/".concat(t.slug,"/general"),className:"flex flex-row gap-1 items-center",children:"Head to organization settings"})})})]})]})})},ev=n(25733),ew=n(43683),eN=n(94865),ek=n(22293),eS=n(67815),e_=()=>{var e,t,n,r,i,l;let{ref:c}=(0,s.UO)(),u=(0,o.useRouter)(),{data:p}=(0,ew.q)(),h=null===(e=null!=p?p:[])||void 0===e?void 0:e.find(e=>e.project===c),m=void 0!==h?h.is_readonly_mode_enabled?["is_readonly_mode_enabled"]:Object.keys(h).filter(e=>"project"!==e&&"is_readonly_mode_enabled"!==e&&null!==h[e]):[],g=void 0!==h&&m.some(e=>"critical"===h[e]),f=m.includes("is_readonly_mode_enabled")||g,x=void 0!==h?(0,ek.L)(h,m[0],"bannerContent"):void 0,j=m.length>1?eN.x.multiple_resource_warnings.bannerContent[g?"critical":"warning"].title:null==x?void 0:x.title,b=m.length>1?eN.x.multiple_resource_warnings.bannerContent[g?"critical":"warning"].description:null==x?void 0:x.description,y=m.length>1?eN.x.multiple_resource_warnings.docsUrl:null===(t=eN.x[m[0]])||void 0===t?void 0:t.docsUrl,v=m.length>1?eN.x.multiple_resource_warnings.metric:null===(n=eN.x[m[0]])||void 0===n?void 0:n.metric,N=null===(i=void 0===v?void 0:null===v?"/project/[ref]/settings/[infra-path]":"disk_space"===v||"read_only"===v?"/project/[ref]/settings/database":"auth_email_rate_limit"===v?"/project/[ref]/settings/auth":"/project/[ref]/settings/[infra-path]#".concat(v))||void 0===i?void 0:null===(r=i.replace("[ref]",null!=c?c:"default"))||void 0===r?void 0:r.replace("[infra-path]","infrastructure"),k=m.length>1?eN.x.multiple_resource_warnings.buttonText:null===(l=eN.x[m[0]])||void 0===l?void 0:l.buttonText;return 0===m.length||void 0===x||(u.pathname.endsWith("/usage")||u.pathname.endsWith("/infrastructure"))&&!m.includes("is_readonly_mode_enabled")||m.includes("is_readonly_mode_enabled")&&u.pathname.endsWith("settings/database")?null:(0,a.jsxs)(eo.bZ,{variant:f?"destructive":"warning",className:"border-0 border-r-0 rounded-none [&>svg]:left-6 px-6 [&>svg]:w-[26px] [&>svg]:h-[26px]",children:[(0,a.jsx)(eS.Z,{}),(0,a.jsx)(eo.Cd,{children:j}),(0,a.jsx)(eo.X,{children:b}),(0,a.jsxs)("div",{className:"absolute top-5 right-5 flex items-center space-x-2",children:[void 0!==y&&(0,a.jsx)(d.z,{asChild:!0,type:"default",icon:(0,a.jsx)(S.Z,{}),children:(0,a.jsx)("a",{href:y,target:"_blank",rel:"noreferrer",children:"Learn more"})}),void 0!==N&&(0,a.jsx)(d.z,{asChild:!0,type:"default",children:(0,a.jsx)(w(),{href:N,children:null!=k?k:"Check"})})]})]})},eC=n(3373),eE=n(75939),eA=n(9109),eT=n(79983),eR=n(54383),eL=n(39428),ez=n(88883),eI=n(56974),eU=n.n(eI),eP=n(63955),eO=n(30195),eZ=n(59491),eF=n(36660),eD=n(56006),eW=n(41679),eH=n(17001),eq=n(92849),eY=n(51448),eB=n(61660),eM=n(93463),eG=n(69923),eV=n(87175),eJ=n(94175),eK=n(26163),eQ=n(53020),eX=n(22574),e$=n(44778),e0=()=>{let{ref:e}=(0,s.UO)(),t=(0,h.WZ)(),n=(0,eV.Xo)(eZ.KA.BILLING_WRITE,"stripe.subscriptions");return(0,a.jsxs)(eo.bZ,{className:"rounded-none px-7 py-6 [&>svg]:top-6 [&>svg]:left-6 !border-t-0 !border-l-0 !border-r-0",children:[(0,a.jsx)(eo.Cd,{className:"text-base",children:"We strongly encourage enabling Point in Time Recovery (PITR)"}),(0,a.jsx)(eo.X,{children:'This is to ensure that you can always recover data if you make a "bad migration". For example, if you accidentally delete a column or some of your production data.'}),n?(0,a.jsx)(d.z,{size:"tiny",type:"default",className:"mt-4",children:(0,a.jsx)(w(),{href:"/project/".concat(e,"/settings/addons?panel=pitr"),onClick:()=>t.setShowEnableBranchingModal(!1),children:"Enable PITR add-on"})}):(0,a.jsx)(e$.u,{disabled:!0,size:"tiny",type:"default",className:"mt-4",tooltip:{content:{side:"bottom",text:"You need additional permissions to amend subscriptions"}},children:"Enable PITR add-on"})]})},e1=n(52006),e2=()=>{let e=(0,h.WZ)(),t=(0,eg.l)();return(0,a.jsxs)(eo.bZ,{className:"rounded-none px-7 py-6 [&>svg]:top-6 [&>svg]:left-6 border-0 border-y",children:[(0,a.jsx)(e1.Z,{}),(0,a.jsx)(eo.Cd,{children:"Database branching is only available on the Pro Plan and above"}),(0,a.jsx)(eo.X,{children:"Go to your organization's billing settings and upgrade your plan to enable branching for this project"}),(0,a.jsx)(eo.X,{children:(0,a.jsx)(d.z,{size:"tiny",type:"default",className:"mt-4",children:(0,a.jsx)(w(),{href:"/org/".concat(null==t?void 0:t.slug,"/billing?panel=subscriptionPlan"),onClick:()=>e.setShowEnableBranchingModal(!1),children:"Upgrade to Pro"})})})]})},e3=()=>{let{ref:e}=(0,s.UO)(),t=(0,h.WZ)();return(0,a.jsxs)(eo.bZ,{className:"rounded-none px-7 py-6 [&>svg]:top-6 [&>svg]:left-6 !border-t-0 !border-l-0 !border-r-0",children:[(0,a.jsx)(e1.Z,{}),(0,a.jsx)(eo.Cd,{className:"text-base",children:"Your project needs to be on Postgres 15 to enable branching"}),(0,a.jsx)(eo.X,{children:"Head over to your project's infrastructure settings to upgrade to the latest version of Postgres before enabling branching."}),(0,a.jsx)(eo.X,{children:(0,a.jsx)(d.z,{size:"tiny",type:"default",className:"mt-4",children:(0,a.jsx)(w(),{href:"/project/".concat(e,"/settings/infrastructure"),onClick:()=>t.setShowEnableBranchingModal(!1),children:"Head to project settings"})})})]})},e4=n(84247),e6=n(45010),e5=n(76141),e9=n(26205),e8=n(42070),e7=e=>{var t,n,r,i,o;let{form:l,isChecking:c,isValid:u,githubConnection:p}=e,{ref:h}=(0,s.UO)(),m=(0,eg.l)(),g=(0,e9.x5)();function f(){g.setGithubConnectionsOpen(!0)}return(0,a.jsx)("div",{className:"border-t border-b",children:(0,a.jsx)(ex.Z.Content,{className:"px-7",children:(0,a.jsxs)("div",{className:"py-6",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("p",{children:"Git Connection"}),(0,a.jsx)(P.C,{variant:"warning",children:"Required"})]}),(0,a.jsx)("p",{className:"text-sm text-foreground-light !mb-4",children:void 0!==p?"Your database preview branches will be based on the branches in the following repository that your project is connected with:":"Your database preview branches will be based on the branches in the Git repository that your project is connected with."}),p?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("ul",{className:"mb-3",children:(0,a.jsx)(e4.jA,{type:"GitHub",connection:{id:String(p.id),added_by:{id:String(null===(t=p.user)||void 0===t?void 0:t.id),primary_email:null!==(i=null===(n=p.user)||void 0===n?void 0:n.primary_email)&&void 0!==i?i:"",username:null!==(o=null===(r=p.user)||void 0===r?void 0:r.username)&&void 0!==o?o:""},foreign_project_id:String(p.repository.id),supabase_project_ref:p.project.ref,organization_integration_id:"unused",inserted_at:p.inserted_at,updated_at:p.updated_at,metadata:{name:p.repository.name}},showNode:!1,actions:(0,a.jsx)(d.z,{type:"default",onClick:()=>f(),children:"Configure connection"}),orientation:"horizontal"})}),(0,a.jsx)(eX.Wi,{control:l.control,name:"branchName",render:e=>{let{field:t}=e;return(0,a.jsxs)(eX.xJ,{className:"flex flex-col gap-y-1 relative",children:[(0,a.jsx)("label",{className:"text-sm text-foreground-light",children:"Choose your production branch"}),(0,a.jsx)(eX.NI,{children:(0,a.jsx)(e8.I,{...t,placeholder:"e.g main"})}),(0,a.jsx)("div",{className:"absolute top-9 right-3",children:c?(0,a.jsx)(e6.Z,{size:14,className:"animate-spin"}):u?(0,a.jsx)(e5.Z,{size:14,className:"text-brand",strokeWidth:2}):null}),(0,a.jsx)(eX.zG,{})]})}})]}):(0,a.jsx)(e4.FP,{showNode:!1,onClick:()=>f(),orgSlug:null==m?void 0:m.slug})]})})})},te=()=>{var e,t,n,r,i;let{ref:o}=(0,s.UO)(),c=(0,h.WZ)(),u=(0,eg.l)(),[p,m]=(0,l.useState)(!1);(0,eV.Xo)(eZ.KA.CREATE,"preview_branches");let{data:g,error:f,isLoading:x,isSuccess:j,isError:b}=(0,eB.q)({organizationId:null==u?void 0:u.id}),{data:y,error:v,isLoading:k,isError:_,isSuccess:C}=(0,eq.D)({projectRef:o}),E=Number(null!==(n=null===(e=eU()(null!==(t=null==y?void 0:y.current_app_version.split("-"))&&void 0!==t?t:[]))||void 0===e?void 0:e.split(".")[0])&&void 0!==n?n:0)>=15,{data:A}=(0,eM.Gl)({orgSlug:null==u?void 0:u.slug}),T=(null==A?void 0:A.plan.id)==="free",{data:R}=(0,eG.F)({projectRef:o}),L=void 0!==(null!==(r=null==R?void 0:R.selected_addons)&&void 0!==r?r:[]).find(e=>"pitr"===e.type),z=null==g?void 0:g.find(e=>e.project.ref===o),[I,U]=null!==(i=null==z?void 0:z.repository.name.split("/"))&&void 0!==i?i:[],{mutateAsync:P,isLoading:O}=(0,eY.s)({onError:()=>{}}),{mutate:Z,isLoading:F}=(0,eH.J)({onSuccess:()=>{N.Am.success("Successfully created new branch"),c.setShowEnableBranchingModal(!1)}}),D="enable-branching-form",W=eO.Ry({branchName:eO.Z_().refine(e=>e.length>1,"Please enter a branch name from ".concat(I,"/").concat(U)).refine(async e=>{try{if(e.length>0){if(!(null==z?void 0:z.id))throw Error("No GitHub connection found");await P({connectionId:z.id,branchName:e}),m(!0)}return!0}catch(e){return m(!1),!1}},"Unable to find branch from ".concat(I,"/").concat(U))}),H=(0,eP.cI)({mode:"onBlur",reValidateMode:"onChange",resolver:(0,ez.F)(W),defaultValues:{branchName:""}}),q=j&&C,Y=H.getValues("branchName").length>0&&!O&&p;return(0,l.useEffect)(()=>{H&&c.showEnableBranchingModal&&(m(!1),H.reset())},[H,c.showEnableBranchingModal]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ex.Z,{hideFooter:!0,visible:c.showEnableBranchingModal,onCancel:()=>c.setShowEnableBranchingModal(!1),className:"block",size:"medium",hideClose:!0,children:(0,a.jsx)(eX.l0,{...H,children:(0,a.jsxs)("form",{id:D,onSubmit:H.handleSubmit(e=>{if(!o)return console.error("Project ref is required");Z({projectRef:o,branchName:e.branchName,gitBranch:e.branchName})}),onChange:()=>m(!1),children:[(0,a.jsxs)(ex.Z.Content,{className:"flex items-center justify-between space-x-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-x-4",children:[(0,a.jsx)(eJ.Z,{strokeWidth:2,size:20}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-foreground",children:"Enable database branching"}),(0,a.jsx)("p",{className:"text-sm text-foreground-light",children:"Manage environments in Supabase"})]})]}),(0,a.jsx)(d.z,{type:"default",icon:(0,a.jsx)(S.Z,{strokeWidth:1.5}),children:(0,a.jsx)(w(),{href:"https://supabase.com/docs/guides/platform/branching",target:"_blank",rel:"noreferrer",children:"Documentation"})})]}),(x||k)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ex.Z.Separator,{}),(0,a.jsx)(ex.Z.Content,{className:"px-7 py-6",children:(0,a.jsx)(eW.A,{})}),(0,a.jsx)(ex.Z.Separator,{})]}),(b||_)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ex.Z.Separator,{}),(0,a.jsx)(ex.Z.Content,{className:"px-7 py-6",children:b?(0,a.jsx)(eD.Z,{error:f,subject:"Failed to retrieve connections"}):_?(0,a.jsx)(eD.Z,{error:v,subject:"Failed to retrieve Postgres version"}):null}),(0,a.jsx)(ex.Z.Separator,{})]}),q&&(0,a.jsxs)(a.Fragment,{children:[T?(0,a.jsx)(e2,{}):E?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(e7,{form:H,isChecking:O,isValid:Y,githubConnection:z}),!L&&(0,a.jsx)(e0,{})]}):(0,a.jsx)(e3,{}),(0,a.jsxs)(ex.Z.Content,{className:"py-6 flex flex-col gap-3",children:[(0,a.jsx)("p",{className:"text-sm text-foreground-light",children:"Please keep in mind the following:"}),(0,a.jsxs)("div",{className:"flex flex-row gap-4",children:[(0,a.jsx)("div",{children:(0,a.jsx)("figure",{className:"w-10 h-10 rounded-md bg-info-200 border border-info-400 flex items-center justify-center",children:(0,a.jsx)(eK.Z,{className:"text-info",size:20,strokeWidth:2})})}),(0,a.jsxs)("div",{className:"flex flex-col gap-y-1",children:[(0,a.jsx)("p",{className:"text-sm text-foreground",children:"Preview branches are billed $0.32 per day"}),(0,a.jsx)("p",{className:"text-sm text-foreground-light",children:"This cost will continue for as long as the branch has not been removed."})]})]}),(0,a.jsxs)("div",{className:"flex flex-row gap-4 mt-2",children:[(0,a.jsx)("div",{children:(0,a.jsx)("figure",{className:"w-10 h-10 rounded-md bg-info-200 border border-info-400 flex items-center justify-center",children:(0,a.jsx)(eQ.Z,{className:"text-info",size:20,strokeWidth:2})})}),(0,a.jsxs)("div",{className:"flex flex-col gap-y-1",children:[(0,a.jsx)("p",{className:"text-sm text-foreground",children:"Migrations are applied from your GitHub repository"}),(0,a.jsxs)("p",{className:"text-sm text-foreground-light",children:["Migration files in your ",(0,a.jsx)("code",{className:"text-xs",children:"./supabase"})," ","directory will run on both Preview Branches and Production when pushing and merging branches."]})]})]})]}),(0,a.jsx)(ex.Z.Separator,{})]}),(0,a.jsxs)(ex.Z.Content,{className:"flex items-center gap-3",children:[(0,a.jsx)(d.z,{size:"medium",block:!0,disabled:F,type:"default",onClick:()=>c.setShowEnableBranchingModal(!1),children:"Cancel"}),(0,a.jsx)(d.z,{block:!0,size:"medium",form:D,disabled:!q||F||!Y,loading:F,type:"primary",htmlType:"submit",children:"I understand, enable branching"})]})]})})}),(0,a.jsx)(eF.Z,{projectRef:o})]})},tt=n(85945),tn=n(56716),ta=n(1875),ts=n(35898),tr=n(41582),ti=n(31779),to=n(26198),tl=n(88354),tc=n(63480),td=()=>{let{ref:e}=(0,s.UO)(),t=(0,ef.V)(),n=(0,tt.NL)(),r=(0,l.useRef)();async function i(){if(!t)return;let a=await (0,tl.GC)("".concat(M.T5,"/projects/").concat(t.ref,"/status"),{timeout:2e3});if(a&&!a.error){let{status:t}=a;t===M.S.ACTIVE_HEALTHY&&(clearInterval(r.current),e&&await (0,ti.H0)(n,e),await (0,to.fr)(n))}}return((0,l.useEffect)(()=>(r.current=window.setInterval(i,4e3),()=>{clearInterval(r.current)}),[]),void 0===t)?null:(0,a.jsxs)("div",{className:"mx-auto my-16 w-full max-w-7xl items-center justify-center",children:[(0,a.jsxs)("div",{className:"mx-6 flex flex-col space-y-16",children:[(0,a.jsxs)("div",{className:" flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,a.jsx)("h1",{className:"text-3xl text-foreground",children:null==t?void 0:t.name}),(0,a.jsx)(P.C,{variant:"default",className:"bg-surface-100 bg-opacity-100",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(e6.Z,{className:"animate-spin",size:12}),(0,a.jsx)("span",{children:t.status===M.S.UNKNOWN?"Initiating project set up":"Setting up project"})]})})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("p",{className:"text-sm text-foreground-light",children:[" ","We are provisioning your database and API endpoints"]}),(0,a.jsx)("p",{className:"text-sm text-foreground-light",children:" This may take a few minutes"})]})]}),(0,a.jsx)("div",{children:(0,a.jsxs)("div",{className:" grid grid-cols-12 gap-12",children:[(0,a.jsxs)("div",{className:"col-span-12 space-y-12 lg:col-span-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"text-base text-foreground",children:"While you wait"}),(0,a.jsx)(tu,{description:(0,a.jsxs)("p",{className:"text-sm text-foreground-light",children:["Browse the Supabase"," ",(0,a.jsx)(w(),{href:"https://supabase.com/docs",className:"mb-0 text-brand transition-colors hover:text-brand-600",target:"_blank",rel:"noreferrer",children:"documentation"}),"."]})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"text-base text-foreground",children:"Not working?"}),(0,a.jsx)(tu,{description:(0,a.jsx)("p",{className:"text-sm text-foreground-light",children:"Try refreshing after a couple of minutes."})}),(0,a.jsx)("ul",{children:(0,a.jsx)(tu,{description:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{className:"mb-4 text-sm text-foreground-light",children:"If your dashboard hasn't connected within 2 minutes, you can open a support ticket."}),(0,a.jsx)(d.z,{asChild:!0,type:"default",children:(0,a.jsx)(w(),{href:"/support/new",children:"Contact support team"})})]})})})]})]}),(0,a.jsxs)("div",{className:"col-span-12 lg:col-span-8",children:[(0,a.jsx)(tr.D,{}),(0,a.jsx)(tr.m,{})]})]})})]}),t.status===M.S.COMING_UP&&(0,a.jsxs)("div",{className:"mx-auto my-16 w-full max-w-7xl space-y-16",children:[(0,a.jsxs)("div",{className:"space-y-8",children:[(0,a.jsx)("div",{className:"mx-6",children:(0,a.jsx)("h5",{children:"Client libraries"})}),(0,a.jsx)("div",{className:"mx-6 mb-12 grid gap-12 md:grid-cols-3",children:ts.l.map(e=>(0,a.jsx)(tn.Z,{...e},e.language))})]}),(0,a.jsxs)("div",{className:"space-y-8",children:[(0,a.jsx)("div",{className:"mx-6",children:(0,a.jsx)("h5",{children:"Example projects"})}),(0,a.jsx)("div",{className:"mx-6 grid gap-8 md:grid-cols-2 lg:grid-cols-3",children:ts.B.map(e=>(0,a.jsx)(ta.Z,{...e},e.url))})]})]})]})};let tu=e=>{let{description:t}=e;return(0,a.jsxs)("li",{className:"my-3 flex flex-wrap space-x-3",children:[(0,a.jsx)("div",{className:"mt-0.5",children:(0,a.jsx)(tc.Z,{className:"text-foreground-lighter",size:14})}),(0,a.jsx)("div",{className:"flex-1",children:t})]})};var tp=n(33706),th=n(4678),tm=n.n(th);async function tg(e,t){if(void 0===e)return!1;let{kpsVersion:n,timeout:a}=null!=t?t:{};return tm().gte(tm().coerce(null!=n?n:"kps-v0.0.1"),tm().coerce("kps-v3.8.6"))?tx(e,a):tf(e,a)}async function tf(e,t){let{error:n}=await (0,tl.pu)("".concat(M.T5,"/projects/").concat(e,"/api/rest"),[],{timeout:null!=t?t:2e3});return void 0===n}async function tx(e,t){let{error:n}=await (0,tl.GC)("".concat(M.T5,"/projects/").concat(e,"/live"),{timeout:null!=t?t:2e3});return void 0===n}var tj=n(6838),tb=n(91550),ty=n(16483),tv=e=>{let{project:t}=e,{ref:n}=(0,s.UO)(),r=(0,tt.NL)(),i=(0,l.useRef)();(0,l.useEffect)(()=>{if(t.restUrl)return i.current=window.setInterval(o,4e3),()=>{clearInterval(i.current)}},[t]);let o=async()=>{await tg(t.ref,{kpsVersion:t.kpsVersion})&&(clearInterval(i.current),(0,to.Ob)(r,t.ref,"ONLINE"),await (0,ti.H0)(r,t.ref))};return(0,a.jsx)(a.Fragment,{children:(0,a.jsx)("div",{className:"mx-auto my-16 w-full max-w-7xl space-y-16",children:(0,a.jsxs)("div",{className:"mx-6 space-y-16",children:[(0,a.jsxs)("div",{className:"flex flex-col space-y-4 lg:flex-row lg:items-center lg:space-y-0 lg:space-x-6",children:[(0,a.jsx)("h1",{className:"text-3xl",children:t.name}),(0,a.jsx)("div",{children:(0,a.jsx)(P.C,{variant:"brand",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(tj.Z,{className:"animate-spin",size:12}),(0,a.jsx)("span",{children:"Connecting to project"})]})})})]}),(0,a.jsx)("div",{className:"flex h-[500px] items-center justify-center rounded border border-overlay bg-surface-100 p-8",children:(0,a.jsxs)("div",{className:"w-[440px] space-y-4",children:[(0,a.jsxs)("div",{className:"mx-auto flex max-w-[300px] items-center justify-center",children:[(0,a.jsx)("div",{children:(0,a.jsx)("div",{className:"flex items-center justify-center w-12 h-12 rounded-md border",children:(0,a.jsx)(tb.Z,{className:"text-foreground-light",size:30,strokeWidth:1.5})})}),(0,a.jsx)(tp.Z,{active:!0}),(0,a.jsx)("div",{children:(0,a.jsx)("div",{className:"flex items-center justify-center w-12 h-12 rounded-md border",children:(0,a.jsx)(ty.Z,{className:"text-foreground-light",size:30,strokeWidth:1.5})})})]}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("p",{className:"text-center",children:["Connecting to ",t.name]}),(0,a.jsx)("p",{className:"text-center text-sm text-foreground-light",children:"If you are unable to connect after a few minutes, check your project's health to verify if it's running into any resource constraints."})]}),(0,a.jsxs)("div",{className:"flex items-center justify-center space-x-2",children:[(0,a.jsx)(d.z,{asChild:!0,type:"default",children:(0,a.jsx)(w(),{href:"/project/".concat(n,"/settings/infrastructure"),children:"Check database health"})}),(0,a.jsx)(d.z,{asChild:!0,type:"default",icon:(0,a.jsx)(S.Z,{strokeWidth:1.5}),children:(0,a.jsx)(w(),{href:"https://supabase.com/docs/guides/platform/troubleshooting#unable-to-connect-to-your-supabase-project",className:"translate-y-[1px]",children:"Troubleshooting"})})]})]})})]})})})},tw=n(3837),tN=n(90345),tk=n(18094),tS=n(84336),t_=n.n(tS),tC=n(68806),tE=n(62046),tA=n(19999),tT=n(39383),tR=n(6659),tL=n(33750),tz=n(74067),tI=n(95392),tU=n(34503),tP=n(26994),tO=n(68791),tZ=n(27570),tF=n(13265),tD=n(54026);let tW=(e,t)=>{let n=(null==t?void 0:t.status)===M.S.COMING_UP,s="/project/".concat(e);return[{key:"editor",label:"Table Editor",icon:(0,a.jsx)(tk.dD,{size:tK,strokeWidth:tQ}),link:e&&(n?s:"/project/".concat(e,"/editor"))},{key:"sql",label:"SQL Editor",icon:(0,a.jsx)(tk.vu,{size:tK,strokeWidth:tQ}),link:M.Qy?e&&(n?s:"/project/".concat(e,"/sql/new")):"/project/".concat(e,"/sql/1")}]},tH=(e,t,n)=>{var s,r,i,o;let l=(null==t?void 0:t.status)===M.S.COMING_UP,c="/project/".concat(e),d=null===(s=null==n?void 0:n.auth)||void 0===s||s,u=null===(r=null==n?void 0:n.edgeFunctions)||void 0===r||r,p=null===(i=null==n?void 0:n.storage)||void 0===i||i,h=null===(o=null==n?void 0:n.realtime)||void 0===o||o;return[{key:"database",label:"Database",icon:(0,a.jsx)(tk.vo,{size:tK,strokeWidth:tQ}),link:e&&(l?c:"/project/".concat(e,"/database/tables"))},...d?[{key:"auth",label:"Authentication",icon:(0,a.jsx)(tk.gx,{size:tK,strokeWidth:tQ}),link:e&&(l?c:"/project/".concat(e,"/auth/users"))}]:[],...p?[{key:"storage",label:"Storage",icon:(0,a.jsx)(tk.Ke,{size:tK,strokeWidth:tQ}),link:e&&(l?c:"/project/".concat(e,"/storage/buckets"))}]:[],...M.Qy&&u?[{key:"functions",label:"Edge Functions",icon:(0,a.jsx)(tk.hL,{size:tK,strokeWidth:tQ}),link:e&&(l?c:"/project/".concat(e,"/functions"))}]:[],...h?[{key:"realtime",label:"Realtime",icon:(0,a.jsx)(tk.Z7,{size:tK,strokeWidth:tQ}),link:e&&(l?c:"/project/".concat(e,"/realtime/inspector"))}]:[]]},tq=(e,t)=>{let n=(null==t?void 0:t.status)===M.S.COMING_UP,s="/project/".concat(e);return[{key:"advisors",label:"Advisors",icon:(0,a.jsx)(tF.Z,{size:tK,strokeWidth:tQ}),link:e&&(n?s:"/project/".concat(e,"/advisors/security"))},...M.Qy?[{key:"reports",label:"Reports",icon:(0,a.jsx)(tk.Aq,{size:tK,strokeWidth:tQ}),link:e&&(n?s:"/project/".concat(e,"/reports"))}]:[],{key:"logs",label:"Logs",icon:(0,a.jsx)(tD.Z,{size:tK,strokeWidth:tQ}),link:e&&(n?s:"/project/".concat(e,"/logs/explorer"))},{key:"api",label:"API Docs",icon:(0,a.jsx)(eQ.Z,{size:tK,strokeWidth:tQ}),link:e&&(n?s:"/project/".concat(e,"/api"))}]},tY=(e,t)=>[...M.Qy?[{key:"settings",label:"Project Settings",icon:(0,a.jsx)(tA.Z,{size:tK,strokeWidth:tQ}),link:e&&"/project/".concat(e,"/settings/general")}]:[]],tB=(0,l.forwardRef)((e,t)=>{let{icon:n,rightText:s,...r}=e;return(0,a.jsxs)(d.z,{ref:t,type:"text",size:"tiny",...r,className:(0,eR.cn)("h-10 [&>span]:relative [&>span]:items-center [&>span]:gap-3 [&>span]:flex [&>span]:w-full [&>span]:h-full p-0",r.className),children:[(0,a.jsx)("div",{className:"absolute left-2 text-foreground-lighter",children:n}),(0,a.jsx)("span",{className:(0,eR.cn)("absolute left-7 group-data-[state=expanded]:left-10","opacity-0 group-data-[state=expanded]:opacity-100","w-[10rem] text-sm flex flex-col items-center","transition-all"),children:(0,a.jsx)("span",{className:"w-full text-left text-foreground-light truncate",children:r.children})}),s&&(0,a.jsx)("div",{className:(0,eR.cn)("absolute right-2 flex items-center","opacity-0 transition-all","group-data-[state=expanded]:opacity-100 "),children:s})]})});tB.displayName="NavigationIconButton";var tM=n(34291),tG=n.n(tM);let tV=(0,l.forwardRef)((e,t)=>{let{route:n,isActive:s=!1,onClick:r=tG(),...i}=e,o=(0,h.WZ)(),l=["absolute left-0 top-0 flex rounded items-center h-10 w-10 items-center justify-center text-foreground-lighter","group-hover/item:text-foreground-light",s&&"!text-foreground","transition-colors"],c=["relative","h-10 w-10 group-data-[state=expanded]:w-full","transition-all duration-200","flex items-center rounded","group-data-[state=collapsed]:justify-center","group-data-[state=expanded]:-space-x-2","hover:bg-surface-200","group/item","".concat(s&&"!bg-selection shadow-sm")];return void 0!==n.link?(0,a.jsxs)(w(),{role:"button","aria-current":s,ref:t,href:n.link,...i,onClick:r,className:(0,eR.cn)(c,i.className),children:[(0,a.jsx)("span",{id:"icon-link",className:(0,eR.cn)(...l),...i,children:n.icon}),(0,a.jsx)("span",{"aria-hidden":o.navigationPanelOpen||void 0,className:(0,eR.cn)("min-w-[128px] text-sm text-foreground-light","group-hover/item:text-foreground","group-aria-current/item:text-foreground","absolute left-7 group-data-[state=expanded]:left-12","opacity-0 group-data-[state=expanded]:opacity-100","".concat(s&&"text-foreground hover:text-foreground"),"transition-all"),children:n.label})]}):(0,a.jsx)("span",{ref:t,...i})});tV.displayName="NavigationIconLink";var tJ=n(52903);let tK=20,tQ=1.5;var tX=()=>{(0,A.fV)();let e=(0,o.useRouter)(),{profile:t}=(0,tz.Un)(),{project:n}=(0,tZ.d2)(),{theme:r,setTheme:i}=(0,tR.F)(),{ref:c}=(0,s.UO)(),u=(0,tO.FX)(),p=(0,h.WZ)(),m=(0,tL.QJ)(),g=(0,eE.P)("navigationLayoutV2"),f=(0,el.cg)(),[x,j]=(0,l.useState)(!1),{projectAuthAll:b,projectEdgeFunctionAll:y,projectStorageAll:v,realtimeAll:N}=(0,en.N)(["project_auth:all","project_edge_function:all","project_storage:all","realtime:all"]),{data:k}=(0,tJ.U)({projectRef:null==n?void 0:n.ref}),S=(null!=k?k:[]).filter(e=>e.categories.includes("SECURITY")),_=S.filter(e=>"ERROR"===e.level),C=e.pathname.split("/")[3],E=tW(c,n),T=tH(c,n,{auth:b,edgeFunctions:y,storage:v,realtime:N}),R=(0,eE.P)("warehouse"),L=tq(c,n),z=tY(c,n),I=e=>{p.setNavigationPanelOpen(!1,"icon-link"===e.target.id||["svg","path"].includes(e.target.localName))};return(0,a.jsx)("div",{className:"w-14 h-full flex flex-col",children:(0,a.jsxs)("nav",{"data-state":p.navigationPanelOpen?"expanded":"collapsed",className:(0,eR.cn)("group py-2 z-10 h-full w-14 data-[state=expanded]:w-[13rem]","border-r bg-dash-sidebar border-default data-[state=expanded]:shadow-xl","transition-width duration-200","hide-scrollbar flex flex-col justify-between overflow-y-auto"),onMouseEnter:()=>p.setNavigationPanelOpen(!0),onMouseLeave:()=>{x||p.setNavigationPanelOpen(!1)},children:[(0,a.jsxs)("ul",{className:"flex flex-col gap-y-1 justify-start px-2 relative",children:[(!g||!M.Qy)&&(0,a.jsx)(w(),{href:M.Qy?"/projects":"/project/".concat(c),className:"mx-2 flex items-center h-[40px]",onClick:I,children:(0,a.jsx)("img",{alt:"Supabase",src:"".concat(e.basePath,"/img/supabase-logo.svg"),className:"absolute h-[40px] w-6 cursor-pointer rounded"})}),(0,a.jsx)(tV,{isActive:t_()(C)&&!t_()(e.query.ref),route:{key:"HOME",label:"Home",icon:(0,a.jsx)(tk.SK,{size:tK,strokeWidth:tQ}),link:"/project/".concat(c)},onClick:I}),(0,a.jsx)(tI.Z,{className:"my-1 bg-border-muted"}),E.map(e=>(0,a.jsx)(tV,{route:e,isActive:C===e.key,onClick:I},e.key)),(0,a.jsx)(tI.Z,{className:"my-1 bg-border-muted"}),T.map(e=>(0,a.jsx)(tV,{route:e,isActive:C===e.key,onClick:I},e.key)),(0,a.jsx)(tI.Z,{className:"my-1 bg-border-muted"}),L.map(e=>{if("api"===e.key&&f)return(0,a.jsx)(tB,{onClick:()=>{p.setShowProjectApiDocs(!0),p.setNavigationPanelOpen(!1)},icon:(0,a.jsx)(eQ.Z,{size:tK,strokeWidth:tQ}),children:"Project API"},e.key);if("advisors"===e.key)return(0,a.jsxs)("div",{className:"relative",children:[S.length>0&&(0,a.jsx)("div",{className:(0,eR.cn)("absolute flex h-2 w-2 left-6 top-2 z-10 rounded-full",_.length>0?"bg-destructive-600":"bg-warning-600")}),(0,a.jsx)(tV,{route:e,isActive:C===e.key,onClick:I})]},e.key);if("logs"!==e.key)return(0,a.jsx)(tV,{route:e,isActive:C===e.key,onClick:I},e.key);{let t=R?"Logs & Analytics":e.label,n={...e,label:t};return(0,a.jsx)(tV,{route:n,isActive:C===n.key,onClick:I},n.key)}})]}),(0,a.jsxs)("ul",{className:"flex flex-col px-2 gap-y-1",children:[z.map(e=>(0,a.jsx)(tV,{route:e,isActive:C===e.key,onClick:I},e.key)),M.Qy&&(0,a.jsx)(tB,{size:"tiny",onClick:()=>{u(!0),p.setNavigationPanelOpen(!1)},type:"text",icon:(0,a.jsx)(tC.Z,{size:tK,strokeWidth:tQ}),rightText:(0,a.jsxs)("div",{className:(0,eR.cn)("flex items-center gap-1","h-6 py-1.5 px-2 leading-none","bg-surface-100 text-foreground-lighter","border border-default rounded-md","shadow-xs shadow-background-surface-100"),children:[(0,a.jsx)(tE.Z,{size:11.5,strokeWidth:1.5}),(0,a.jsx)("p",{className:"text-xs",children:"K"})]}),children:"Search"}),(0,a.jsxs)(tU.h_,{open:x,onOpenChange:e=>{j(e),!1===e&&p.setNavigationPanelOpen(!1)},children:[(0,a.jsx)(tU.$F,{asChild:!0,children:(0,a.jsx)(d.z,{type:"text",size:"tiny",className:(0,eR.cn)("mt-3 h-10 [&>span]:relative [&>span]:flex [&>span]:w-full [&>span]:h-full p-0"),block:!0,children:(0,a.jsxs)("div",{className:"relative w-full h-full flex items-center justify-center",children:[(0,a.jsx)("figure",{className:"absolute left-1.5 min-h-6 min-w-6 bg-foreground rounded-full flex items-center justify-center",children:(0,a.jsx)(tk.n5,{size:tK-2,strokeWidth:tQ,className:"text-background"})}),(0,a.jsx)("span",{className:(0,eR.cn)("w-[8rem] flex flex-col items-start text-sm truncate","absolute left-7 group-data-[state=expanded]:left-10","group-data-[state=collapsed]:opacity-0 group-data-[state=expanded]:opacity-100","transition-all"),children:t&&M.Qy&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{title:t.username,className:"w-full text-left text-foreground truncate",children:t.username}),t.primary_email!==t.username&&(0,a.jsx)("span",{title:t.primary_email,className:"w-full text-left text-foreground-light text-xs truncate",children:t.primary_email})]})})]})})}),(0,a.jsxs)(tU.AW,{side:"top",align:"start",children:[M.Qy&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"px-2 py-1 flex flex-col gap-0 text-sm",children:t&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{title:t.username,className:"w-full text-left text-foreground truncate",children:t.username}),t.primary_email!==t.username&&(0,a.jsx)("span",{title:t.primary_email,className:"w-full text-left text-foreground-light text-xs truncate",children:t.primary_email})]})}),(0,a.jsx)(tU.VD,{}),(0,a.jsxs)(tU.Qk,{children:[(0,a.jsx)(tU.Xi,{className:"flex gap-2",asChild:!0,children:(0,a.jsxs)(w(),{href:"/account/me",children:[(0,a.jsx)(tA.Z,{size:14,strokeWidth:1.5,className:"text-foreground-lighter"}),"Account preferences"]})}),(0,a.jsxs)(tU.Xi,{className:"flex gap-2",onClick:()=>p.setShowFeaturePreviewModal(!0),onSelect:()=>p.setShowFeaturePreviewModal(!0),children:[(0,a.jsx)(tT.Z,{size:14,strokeWidth:1.5,className:"text-foreground-lighter"}),"Feature previews"]}),(0,a.jsx)(tU.VD,{})]})]}),(0,a.jsxs)(tU.Qk,{children:[(0,a.jsx)(tU.Ju,{children:"Theme"}),(0,a.jsx)(tU._x,{value:r,onValueChange:e=>{i(e)},children:tP.J.map(e=>(0,a.jsx)(tU.qB,{value:e.value,children:e.name},e.value))})]}),M.Qy&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(tU.VD,{}),(0,a.jsx)(tU.Qk,{children:(0,a.jsx)(tU.Xi,{onSelect:async()=>{await m(),await e.push("/sign-in")},children:"Log out"})})]})]})]})]})]})})},t$=()=>{let{project:e}=(0,tZ.d2)();return(0,a.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,a.jsx)("div",{className:"bg-surface-100 border border-overlay rounded-md w-3/4 lg:w-1/2",children:(0,a.jsxs)("div",{className:"space-y-6 pt-6",children:[(0,a.jsxs)("div",{className:"flex px-8 space-x-8",children:[(0,a.jsx)("div",{className:"mt-1",children:(0,a.jsx)(ej.ku,{className:"w-5 h-5"})}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("p",{children:"Something went wrong while pausing your project"}),(0,a.jsx)("p",{className:"text-sm text-foreground-light",children:"Your project's data is intact, but your project is inaccessible due to the failure while pausing. Please contact support for assistance."})]})]}),(0,a.jsx)("div",{className:"border-t border-overlay flex items-center justify-end py-4 px-8",children:(0,a.jsx)(d.z,{asChild:!0,type:"default",children:(0,a.jsx)(w(),{href:"/support/new?category=Database_unresponsive&ref=".concat(null==e?void 0:e.ref,"&subject=Restoration%20failed%20for%20project"),children:"Contact support"})})})]})})})},t0=n(36492),t1=n(31696),t2=n(27181);async function t3(e,t){let{projectRef:n}=e;if(!n)throw Error("Project ref is required");let{data:a,error:s}=await (0,t1.U2)("/platform/projects/{ref}/status",{params:{path:{ref:n}},signal:t});return s&&(0,t1.S3)(s),a}let t4=function(e){let{projectRef:t}=e,{enabled:n=!0,...a}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,t0.a)(t2.i.status(t),e=>{let{signal:n}=e;return t3({projectRef:t},n)},{enabled:n&&void 0!==t,...a})};var t6=n(7968),t5=e=>{let{project:t}=e,{ref:n}=(0,s.UO)(),r=(0,tt.NL)(),[i,o]=(0,l.useState)(!1);return t4({projectRef:n},{enabled:i,refetchInterval:e=>(null==e?void 0:e.status)!==M.S.INACTIVE&&2e3,onSuccess:async e=>{e.status===M.S.INACTIVE&&(n&&await (0,ti.H0)(r,n),await (0,to.fr)(r))}}),(0,l.useEffect)(()=>{setTimeout(()=>o(!0),4e3)},[]),(0,a.jsx)("div",{className:"mx-auto my-16 w-full max-w-7xl space-y-16",children:(0,a.jsxs)("div",{className:"mx-6 space-y-16",children:[(0,a.jsxs)("div",{className:"flex flex-col space-y-4 lg:flex-row lg:items-center lg:space-y-0 lg:space-x-6",children:[(0,a.jsx)("h1",{className:"text-3xl",children:t.name}),(0,a.jsx)("div",{children:(0,a.jsx)(P.C,{children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(tj.Z,{className:"animate-spin",size:12}),(0,a.jsx)("span",{children:"Pausing project"})]})})})]}),(0,a.jsx)("div",{className:"mx-auto mt-8 mb-16 w-full max-w-7xl",children:(0,a.jsx)("div",{className:"mx-6 flex h-[500px] items-center justify-center rounded border border-overlay bg-surface-100 p-8",children:(0,a.jsxs)("div",{className:"grid w-[380px] gap-4",children:[(0,a.jsxs)("div",{className:"relative mx-auto max-w-[300px]",children:[(0,a.jsx)("div",{className:"absolute flex h-full w-full items-center justify-center",children:(0,a.jsx)(tj.Z,{className:"animate-spin",size:20,strokeWidth:2})}),(0,a.jsx)(t6.Z,{className:"text-foreground-lighter",size:50,strokeWidth:1.5})]}),(0,a.jsxs)("p",{className:"text-center",children:["Pausing ",t.name]}),(0,a.jsx)("p",{className:"mt-4 text-center text-sm text-foreground-light",children:"You may restore your project anytime thereafter, and your data will be restored to when it was initially paused."})]})})})]})})},t9=e=>{let{title:t,children:n}=e;return(0,a.jsxs)("div",{className:"hide-scrollbar flex flex-col w-full h-full bg-dash-sidebar border-default ",children:[(0,a.jsx)("div",{className:"border-default flex max-h-12 items-center border-b px-6",style:{minHeight:"3rem"},children:(0,a.jsx)("h4",{className:"text-lg",children:t})}),(0,a.jsx)("div",{className:"flex-grow overflow-y-auto",children:n})]})},t8=n(45889),t7=()=>{let{ref:e}=(0,s.UO)();return(0,ti.ix)({ref:e},{refetchInterval:e=>(null==e?void 0:e.status)!==M.S.ACTIVE_HEALTHY&&4e3}),(0,a.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,a.jsx)("div",{className:"bg-surface-100 border border-overlay rounded-md w-3/4 lg:w-1/2",children:(0,a.jsx)("div",{className:"space-y-6 py-6",children:(0,a.jsxs)("div",{className:"flex px-8 space-x-8",children:[(0,a.jsx)("div",{className:"mt-1",children:(0,a.jsx)(e6.Z,{className:"animate-spin",size:18})}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("p",{children:"Restarting..."}),(0,a.jsx)("p",{className:"text-sm text-foreground-light",children:"Restarting can take a few minutes. Your project will be offline while it restarts."})]})]})})})})},ne=n(78549),nt=n(3536),nn=n(88137),na=()=>{let{project:e}=(0,tZ.d2)(),[t,n]=(0,l.useState)(!1);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,a.jsx)("div",{className:"bg-surface-100 border border-overlay rounded-md w-3/4 lg:w-1/2",children:(0,a.jsxs)("div",{className:"space-y-6 pt-6",children:[(0,a.jsxs)("div",{className:"flex px-8 space-x-8",children:[(0,a.jsx)("div",{className:"mt-1",children:(0,a.jsx)(ej.ku,{className:"w-5 h-5"})}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("p",{children:"Something went wrong while restoring your project"}),(0,a.jsx)("p",{className:"text-sm text-foreground-light",children:"Your project's data is intact, but your project is inaccessible due to the restoration failure. Please contact support for assistance."})]})]}),(0,a.jsxs)("div",{className:"border-t border-overlay flex items-center justify-end py-4 px-8 gap-x-2",children:[(0,a.jsx)(d.z,{asChild:!0,type:"default",children:(0,a.jsx)(w(),{href:"/support/new?category=Database_unresponsive&ref=".concat(null==e?void 0:e.ref,"&subject=Restoration%20failed%20for%20project"),children:"Contact support"})}),(0,a.jsxs)(tU.h_,{children:[(0,a.jsx)(tU.$F,{children:(0,a.jsx)(d.z,{type:"default",className:"px-1.5",icon:(0,a.jsx)(ne.Z,{})})}),(0,a.jsx)(tU.AW,{className:"w-72",align:"end",children:(0,a.jsxs)(tU.Xi,{onClick:()=>n(!0),className:"items-start gap-x-2",children:[(0,a.jsx)("div",{className:"translate-y-0.5",children:(0,a.jsx)(nt.Z,{size:14})}),(0,a.jsxs)("div",{className:"",children:[(0,a.jsx)("p",{children:"Delete project"}),(0,a.jsx)("p",{className:"text-foreground-lighter",children:"Project cannot be restored once it is deleted"})]})]})})]})]})]})})}),(0,a.jsx)(nn.Z,{visible:t,onClose:()=>n(!1)})]})},ns=n(38187),nr=()=>{let{ref:e}=(0,s.UO)(),t=(0,tt.NL)(),{project:n}=(0,tZ.d2)(),r=(0,l.useRef)(),[i,o]=(0,l.useState)(!1),[c,u]=(0,l.useState)(!1);async function p(){if(!n)return;let a=await (0,tl.GC)("".concat(M.T5,"/projects/").concat(n.ref,"/status"),{timeout:2e3});if(a&&!a.error){let{status:n}=a;n===M.S.ACTIVE_HEALTHY?(clearInterval(r.current),u(!0)):t.invalidateQueries(t2.i.detail(e))}}(0,l.useEffect)(()=>(r.current=window.setInterval(p,4e3),()=>clearInterval(r.current)),[]);let h=async()=>{if(!n)return console.error("Project is required");o(!0),e&&await (0,ti.H0)(t,e)};return(0,a.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,a.jsx)("div",{className:"bg-surface-100 border border-overlay rounded-md w-3/4 lg:w-1/2",children:c?(0,a.jsxs)("div",{className:"space-y-6 pt-6",children:[(0,a.jsxs)("div",{className:"flex px-8 space-x-8",children:[(0,a.jsx)("div",{className:"mt-1",children:(0,a.jsx)(ns.Z,{className:"text-brand",size:18,strokeWidth:2})}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("p",{children:"Restoration complete!"}),(0,a.jsx)("p",{className:"text-sm text-foreground-light",children:"Your project has been successfully restored and is now back online."})]})]}),(0,a.jsx)("div",{className:"border-t border-overlay flex items-center justify-end py-4 px-8",children:(0,a.jsx)(d.z,{disabled:i,loading:i,onClick:h,children:"Return to project"})})]}):(0,a.jsx)("div",{className:"space-y-6 py-6",children:(0,a.jsxs)("div",{className:"flex px-8 space-x-8",children:[(0,a.jsx)("div",{className:"mt-1",children:(0,a.jsx)(tj.Z,{className:"animate-spin",size:18})}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("p",{children:"Restoration in progress"}),(0,a.jsx)("p",{className:"text-sm text-foreground-light",children:"Restoration can take from a few minutes up to several hours depending on the size of your database. Your project will be offline while the restoration is running."})]})]})})})})},ni=n(24990),no=n(63059),nl=n(28879),nc=n.n(nl),nd=n(70293),nu=n(56490);let np=[{key:no.L9.Started,initial:"Prepare new server",progress:"Preparing new server",completed:"Prepared new server"},{key:no.L9.LaunchedUpgradedInstance,initial:"Prepare new server for migration",progress:"Preparing new server for migration",completed:"New server ready for migration"},{key:no.L9.DetachedVolumeFromUpgradedInstance,initial:"Execute pre-upgrade checks",progress:"Executing pre-upgrade checks",completed:"Completed pre-upgrade checks"},{key:no.L9.AttachedVolumeToOriginalInstance,initial:"Shut down API services",progress:"Shutting down API services",completed:"Completed shutting down API services"},{key:no.L9.InitiatedDataUpgrade,initial:"Migrate to new database",progress:"Migrating to new database",completed:"Completed migration to new database"},{key:no.L9.CompletedDataUpgrade,initial:"Execute database migration",progress:"Executing database migration",completed:"Completed database migration"},{key:no.L9.DetachedVolumeFromOriginalInstance,initial:"Update database extensions",progress:"Updating database extensions",completed:"Updated database extensions"},{key:no.L9.AttachedVolumeToUpgradedInstance,initial:"Optimize database",progress:"Optimizing database",completed:"Completed optimization of database"}];var nh=n(99064),nm=n(25097),ng=()=>{var e;let{ref:t}=(0,nd.UO)(),n=(0,tt.NL)(),{project:s}=(0,tZ.d2)(),[r,i]=(0,l.useState)(!1),[o,c]=(0,l.useState)(!1),{data:u}=(0,nu.h)({projectRef:t,projectStatus:null==s?void 0:s.status},{enabled:M.Qy}),{initiated_at:p,status:h,progress:m,target_version:g,error:f}=null!==(e=null==u?void 0:u.databaseUpgradeStatus)&&void 0!==e?e:{},x=Number((m||"").split("_")[0]),j=h===no.h.Failed,b=h===no.h.Upgraded,y=h===no.h.Upgrading&&m===no.L9.CompletedUpgrade,v=nc().utc(null!=p?p:0).format("DD MMM YYYY HH:mm:ss"),N=nc().utc(null!=p?p:0).local().format("DD MMM YYYY HH:mm:ss (ZZ)"),k=async()=>{i(!0),t&&await (0,ti.H0)(n,t)},S="Upgrade information:%0A• Initiated at: ".concat(p,"%0A• Target Version: ").concat(g,"%0A• Error: ").concat(f);return(0,a.jsx)("div",{className:"w-full mx-auto my-16 space-y-16 max-w-7xl",children:(0,a.jsxs)("div",{className:"mx-6 space-y-16",children:[(0,a.jsx)("div",{className:"flex flex-col space-y-4 lg:flex-row lg:items-center lg:space-y-0 lg:space-x-6",children:(0,a.jsx)("h1",{className:"text-3xl",children:null==s?void 0:s.name})}),(0,a.jsx)("div",{className:"w-full mx-auto mt-8 mb-16 max-w-7xl",children:(0,a.jsx)("div",{className:"flex h-[500px] items-center justify-center rounded border border-muted bg-surface-100 p-8",children:b?(0,a.jsxs)("div",{className:"grid gap-4",children:[(0,a.jsx)("div",{className:"relative mx-auto max-w-[300px]",children:(0,a.jsx)(ns.Z,{className:"text-brand",size:40,strokeWidth:1.5})}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("p",{className:"text-center",children:"Upgrade completed!"}),(0,a.jsxs)("p",{className:"mt-4 text-center text-sm text-foreground-light w-[300px] mx-auto",children:["Your project has been successfully upgraded to Postgres ",g," and is now back online."]})]}),(0,a.jsx)("div",{className:"mx-auto",children:(0,a.jsx)(d.z,{loading:r,disabled:r,onClick:k,children:"Return to project"})})]}):j?(0,a.jsxs)("div",{className:"grid gap-4",children:[(0,a.jsx)("div",{className:"relative mx-auto max-w-[300px]",children:(0,a.jsx)(e1.Z,{className:"text-amber-900",size:40,strokeWidth:1.5})}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("p",{className:"text-center",children:"We ran into an issue while upgrading your project"}),(0,a.jsx)("p",{className:"mt-4 text-center text-sm text-foreground-light w-[450px] mx-auto",children:"Your project is back online and its data is not affected. Please reach out to us via our support form for assistance with the upgrade."})]}),(0,a.jsxs)("div",{className:"flex items-center mx-auto space-x-2",children:[(0,a.jsx)(d.z,{asChild:!0,type:"default",children:(0,a.jsx)(w(),{href:"/support/new?category=Database_unresponsive&ref=".concat(t,"&subject=").concat("Upgrade%20failed%20for%20project","&message=").concat(S),target:"_blank",rel:"noreferrer",children:"Contact support"})}),(0,a.jsx)(d.z,{loading:r,disabled:r,onClick:k,children:"Return to project"})]})]}):(0,a.jsxs)("div",{className:"grid w-[480px] gap-4",children:[(0,a.jsxs)("div",{className:"relative mx-auto max-w-[300px]",children:[(0,a.jsx)("div",{className:"absolute flex items-center justify-center w-full h-full",children:(0,a.jsx)(tA.Z,{className:"animate-spin",size:20,strokeWidth:2})}),(0,a.jsx)(t6.Z,{className:"text-foreground-lighter",size:50,strokeWidth:1.5})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[y?(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-center",children:"Performing a full backup"}),(0,a.jsx)("p",{className:"text-sm text-center text-foreground-light",children:"Upgrade is now complete, and your project is online. A full backup is now being performed to ensure that there is a proper base backup available post-upgrade. This can take from a few minutes up to several hours depending on the size of your database."})]}):(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-center",children:"Upgrading in progress"}),(0,a.jsx)("p",{className:"text-sm text-center text-foreground-light",children:"Upgrades can take from a few minutes up to several hours depending on the size of your database. Your project will be offline while it is being upgraded."})]}),(0,a.jsxs)("div",{className:"!mt-4 !mb-2 py-3 px-4 transition-all overflow-hidden border rounded relative",style:{maxHeight:o?"500px":"110px"},children:[o?(0,a.jsx)(nh.Z,{size:14,strokeWidth:2,className:"absolute z-10 cursor-pointer top-3 right-3",onClick:()=>c(!1)}):(0,a.jsx)(nm.Z,{size:14,strokeWidth:2,className:"absolute z-10 cursor-pointer top-3 right-3",onClick:()=>c(!0)}),(0,a.jsx)("div",{className:"space-y-2 transition-all",style:{translate:o?"0px 0px":"0px ".concat(-((x-2<=0?0:x>6?5:x-2)*28),"px")},children:np.map((e,t)=>{let n=e.key===m,s=x>t;return(0,a.jsxs)("div",{className:"flex items-center space-x-4",children:[n?(0,a.jsx)("div",{className:"flex items-center justify-center w-5 h-5 rounded-full",children:(0,a.jsx)(tj.Z,{size:20,className:"animate-spin text-foreground-light",strokeWidth:2})}):s?(0,a.jsx)("div",{className:"flex items-center justify-center w-5 h-5 border rounded-full bg-brand border-brand",children:(0,a.jsx)(e5.Z,{size:12,className:"text-white",strokeWidth:3})}):(0,a.jsx)("div",{className:"flex items-center justify-center w-5 h-5 border rounded-full bg-overlay-hover"}),(0,a.jsx)("p",{className:"text-sm ".concat(n?"text-foreground":s?"text-foreground-light":"text-foreground-lighter"," hover:text-foreground transition"),children:n?e.progress:s?e.completed:e.initial})]},e.key)})})]}),void 0!==p&&(0,a.jsxs)(ni.fC,{delayDuration:0,children:[(0,a.jsx)(ni.xz,{className:"w-full",children:(0,a.jsxs)("p",{className:"text-sm text-center text-foreground-light",children:["Started on: ",v," (UTC)"]})}),(0,a.jsx)(ni.h_,{children:(0,a.jsxs)(ni.VY,{side:"bottom",children:[(0,a.jsx)(ni.Eh,{className:"radix-tooltip-arrow"}),(0,a.jsx)("div",{className:"rounded bg-alternative py-1 px-2 leading-none shadow border border-background",children:(0,a.jsx)("span",{className:"text-xs text-foreground",children:N})})]})})]})]})]})})})]})})};let nf=["/project/[ref]/settings/general","/project/[ref]/settings/database","/project/[ref]/settings/storage","/project/[ref]/settings/infrastructure","/project/[ref]/settings/addons"],nx=["/project/[ref]/branches","/project/[ref]/database/backups/scheduled","/project/[ref]/settings/addons"],nj=["/project/[ref]/reports","/project/[ref]/settings/general","/project/[ref]/settings/database","/project/[ref]/settings/infrastructure","/project/[ref]/settings/addons"],nb=e=>{let{title:t,isLoading:n=!1,isBlocking:r=!0,product:l="",productMenu:c,children:d,hideHeader:u=!1,hideIconBar:p=!1,selectedTable:h,resizableSidebar:m=!1}=e,g=(0,o.useRouter)(),{ref:f}=(0,s.UO)(),x=(0,eg.l)(),j=(0,ef.V)(),b=null==j?void 0:j.name,y=null==x?void 0:x.name,v=(0,eE.P)("navigationLayoutV2"),w=(null==j?void 0:j.status)===M.S.INACTIVE,N="/project/[ref]"===g.pathname||g.pathname.includes("/project/[ref]/settings"),k=w&&!N;return(0,a.jsx)(eL.Z,{children:(0,a.jsxs)(tZ.Ml,{projectRef:f,children:[(0,a.jsxs)(i(),{children:[(0,a.jsx)("title",{children:t?"".concat(t," | Supabase"):h?"".concat(h," | ").concat(b," | ").concat(y," | Supabase"):b?"".concat(b," | ").concat(y," | Supabase"):y?"".concat(y," | Supabase"):"Supabase"}),(0,a.jsx)("meta",{name:"description",content:"Supabase Studio"})]}),(0,a.jsxs)("div",{className:"flex h-full",children:[!p&&(0,a.jsx)(tX,{}),(0,a.jsxs)(eT.pO,{className:"flex h-full",direction:"horizontal",autoSaveId:"project-layout",children:[!k&&c&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(eT.ee,{className:(0,eR.cn)(m?"min-w-64 max-w-[32rem]":"min-w-64 max-w-64"),defaultSize:1,children:(0,a.jsx)(nw,{isLoading:n,isBlocking:r,productMenu:c,children:(0,a.jsx)(t9,{title:l,children:c})})}),(0,a.jsx)(eT.Dp,{withHandle:!0,disabled:!m})]}),(0,a.jsx)(eT.ee,{className:"h-full",children:(0,a.jsxs)("main",{className:"h-full flex flex-col flex-1 w-full overflow-x-hidden",children:[!v&&!u&&M.Qy&&(0,a.jsx)(tw.N,{}),k?(0,a.jsx)("div",{className:"mx-auto my-16 w-full h-full max-w-7xl flex items-center",children:(0,a.jsx)("div",{className:"w-full",children:(0,a.jsx)(t8.Z,{product:l})})}):(0,a.jsxs)(nN,{isLoading:n,isBlocking:r,children:[(0,a.jsx)(e_,{}),d]})]})})]})]}),(0,a.jsx)(te,{}),(0,a.jsx)(ey,{}),(0,a.jsx)(ep,{})]})})},ny=(0,eC.Q)(nb);var nv=nb;let nw=e=>{let{isLoading:t,isBlocking:n=!0,productMenu:a,children:s}=e,r=(0,o.useRouter)(),i=(0,ef.V)(),l=!nf.includes(r.pathname);return n?!t&&a&&(!l||l&&void 0!==i)?s:null:s},nN=e=>{let{isLoading:t,isBlocking:n=!0,children:r}=e,i=(0,o.useRouter)(),{ref:c}=(0,s.UO)(),d=(0,eA.TF)(),u=(0,ef.V)(),p=i.pathname.includes("/project/[ref]/settings"),h="/project/[ref]/settings/vault"===i.pathname,m=!p&&!nx.includes(i.pathname)||h,g=!nj.includes(i.pathname),f=!nf.includes(i.pathname),x=(null==u?void 0:u.status)===M.S.RESTARTING,j=(null==u?void 0:u.status)===M.S.UPGRADING,b=(null==u?void 0:u.status)===M.S.RESTORING,y=(null==u?void 0:u.status)===M.S.RESTORE_FAILED,v=(null==u?void 0:u.status)===M.S.COMING_UP||(null==u?void 0:u.status)===M.S.UNKNOWN,w=(null==u?void 0:u.status)===M.S.GOING_DOWN||(null==u?void 0:u.status)===M.S.PAUSING,N=(null==u?void 0:u.status)===M.S.PAUSE_FAILED,k=(null==u?void 0:u.postgrestStatus)==="OFFLINE";return((0,l.useEffect)(()=>{c&&d.setSelectedDatabaseId(c)},[c]),n&&(t||f&&void 0===u))?i.pathname.endsWith("[ref]")?(0,a.jsx)(tN.C,{}):(0,a.jsx)(ev.Z,{}):x?(0,a.jsx)(t7,{}):j?(0,a.jsx)(ng,{}):w?(0,a.jsx)(t5,{project:u}):N?(0,a.jsx)(t$,{}):g&&k?(0,a.jsx)(tv,{project:u}):m&&b?(0,a.jsx)(nr,{}):y?(0,a.jsx)(na,{}):m&&v?(0,a.jsx)(td,{}):(0,a.jsx)(l.Fragment,{children:r},null==u?void 0:u.ref)}},45889:function(e,t,n){"use strict";n.d(t,{Z:function(){return q}});var a=n(52322),s=n(59491),r=n(85945),i=n(28879),o=n.n(i),l=n(71007),c=n(17913),d=n(39097),u=n.n(d),p=n(2784),h=n(56958),m=n(99959),g=n(56006),f=n(44778),x=n(84234),j=n(28119),b=n(36492),y=n(31696),v=n(27181);async function w(e,t){let{ref:n}=e;if(!n)throw Error("Project ref is required");let{data:a,error:s}=await (0,y.U2)("/platform/projects/{ref}/pause/status",{params:{path:{ref:n}},signal:t});return s&&(0,y.S3)(s),a}let N=function(e){let{ref:t}=e,{enabled:n=!0,...a}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,b.a)(v.i.pauseStatus(t),e=>{let{signal:n}=e;return w({ref:t},n)},{enabled:n&&void 0!==t,...a})};var k=n(48228);async function S(e){let{ref:t}=e,{data:n,error:a}=await (0,y.v_)("/platform/projects/{ref}/restore",{params:{path:{ref:t}},body:{}});return a&&(0,y.S3)(a),n}let _=function(){let{onSuccess:e,onError:t,...n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,k.D)(e=>S(e),{async onSuccess(t,n,a){await (null==e?void 0:e(t,n,a))},async onError(e,n,a){void 0===t?h.Am.error("Failed to restore project: ".concat(e.message)):t(e,n,a)},...n})};var C=n(26198),E=n(93463),A=n(87175),T=n(89823),R=n(75939),L=n(99248),z=n(95492),I=n(37970),U=n(2322),P=n(32079),O=n(83690),Z=n(81384),F=n(73831),D=n(27570),W=n(17172);let H=()=>(0,a.jsxs)(z.bZ,{children:[(0,a.jsx)(I.aN,{}),(0,a.jsx)(z.Cd,{children:"Project will count towards compute usage once restored"}),(0,a.jsx)(z.X,{children:"For every hour your instance is active, we will bill you based on the compute size of your project."}),(0,a.jsx)(z.X,{className:"mt-3",children:(0,a.jsx)(P.z,{asChild:!0,type:"default",icon:(0,a.jsx)(W.Z,{}),children:(0,a.jsx)("a",{href:"https://supabase.com/docs/guides/platform/org-based-billing#billing-for-compute-compute-hours",target:"_blank",rel:"noreferrer",children:"More information"})})})]});var q=e=>{var t,n,i,d,b,y;let{product:v}=e,{ref:w}=(0,m.UO)(),k=(0,r.NL)(),{project:S}=(0,D.d2)(),W=(0,T.l)(),q=(0,R.P)("enforceNinetyDayUnpauseExpiry"),Y=null==W?void 0:W.slug,{data:B}=(0,E.Gl)({orgSlug:Y}),{data:M,error:G,isError:V,isSuccess:J,isLoading:K}=N({ref:w},{enabled:(null==S?void 0:S.status)===L.S.INACTIVE&&q}),Q=null!==(i=null!==(n=null==M?void 0:M.remaining_days_till_restore_disabled)&&void 0!==n?n:null==M?void 0:M.max_days_till_restore_disabled)&&void 0!==i?i:0,X=(null==B?void 0:null===(t=B.plan)||void 0===t?void 0:t.id)==="free",$=q&&J&&!M.can_restore,ee=null==M?void 0:M.latest_downloadable_backup_id,{data:et}=(0,j.u)({slug:Y},{enabled:X}),en=(et||[]).length>0,[ea,es]=(0,p.useState)(!1),[er,ei]=(0,p.useState)(!1),{mutate:eo}=_({onSuccess:(e,t)=>{(0,C.k7)(k,t.ref,L.S.RESTORING),h.Am.success("Restoring project")}}),{mutate:el,isLoading:ec}=(0,x.s)({onSuccess:e=>{let{fileUrl:t}=e,n=document.createElement("a");n.href=t,document.body.appendChild(n),n.click(),document.body.removeChild(n)}}),ed=(0,A.Xo)(s.KA.INFRA_EXECUTE,"queue_jobs.projects.initialize_or_resume"),eu=()=>void 0===w?console.error("Project ref is required"):ee?void el({ref:w,backup:{id:ee,project_id:-1,inserted_at:"",isPhysicalBackup:!1,status:{}}}):h.Am.error("No backups available for download");return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"space-y-4",children:(0,a.jsx)("div",{className:"w-full mx-auto mb-16 max-w-7xl",children:(0,a.jsx)("div",{className:"mx-6 flex h-[500px] items-center justify-center rounded border border-overlay bg-surface-100 p-8",children:(0,a.jsxs)("div",{className:"grid w-[550px] gap-4",children:[(0,a.jsx)("div",{className:"mx-auto flex max-w-[300px] items-center justify-center space-x-4 lg:space-x-8",children:(0,a.jsx)(l.Z,{className:"text-foreground-light",size:50,strokeWidth:1.5})}),(0,a.jsxs)("div",{className:"flex flex-col gap-y-2",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-y-1",children:[(0,a.jsxs)("p",{className:"text-center",children:['The project "',null!==(d=null==S?void 0:S.name)&&void 0!==d?d:"",'" is currently paused.']}),(0,a.jsxs)("p",{className:"text-sm text-foreground-light text-center",children:["All of your project's data is still intact, but your project is inaccessible while paused."," ",void 0!==v?(0,a.jsxs)(a.Fragment,{children:["Restore this project to access the"," ",(0,a.jsx)("span",{className:"text-brand",children:v})," page"]}):"Restore this project and get back to building!"]})]}),q&&(0,a.jsxs)(a.Fragment,{children:[K&&(0,a.jsx)(Z.A,{}),V&&(0,a.jsx)(g.Z,{error:G,subject:"Failed to retrieve pause status"}),J&&(0,a.jsx)(a.Fragment,{children:$?(0,a.jsxs)(z.bZ,{variant:"warning",children:[(0,a.jsx)(I.aN,{}),(0,a.jsx)(z.Cd,{children:"Project cannot be restored through the dashboard"}),(0,a.jsxs)(z.X,{children:["This project has been paused for over"," ",(0,a.jsxs)("span",{className:"text-foreground",children:[null!==(b=null==M?void 0:M.max_days_till_restore_disabled)&&void 0!==b?b:90," days"]})," ","and cannot be restored through the dashboard. However, your data remains intact and can be downloaded as a backup."]}),(0,a.jsx)(z.X,{className:"flex items-center gap-x-2 mt-3",children:(0,a.jsxs)(U.u,{children:[(0,a.jsx)(U.aJ,{asChild:!0,children:(0,a.jsx)(P.z,{type:"default",icon:(0,a.jsx)(c.Z,{}),loading:ec,disabled:!ee,className:"pointer-events-auto",onClick:()=>eu(),children:"Download backup"})}),!ee&&(0,a.jsx)(U._v,{side:"bottom",children:"No backups available, please reach out via support for assistance"})]})})]}):X?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{className:"text-sm text-foreground-light text-center",children:"To prevent future pauses, consider upgrading to Pro."}),(0,a.jsxs)(z.bZ,{children:[(0,a.jsxs)(z.Cd,{children:["Project can be restored through the dashboard within the next"," ",Q," day",Q>1?"s":""]}),(0,a.jsxs)(z.X,{children:["Free projects cannot be restored through the dashboard if they are paused for more than"," ",(0,a.jsxs)("span",{className:"text-foreground",children:[null==M?void 0:M.max_days_till_restore_disabled," days"]}),". The latest that your project can be restored is by"," ",(0,a.jsx)("span",{className:"text-foreground",children:o()().utc().add(null!==(y=M.max_days_till_restore_disabled)&&void 0!==y?y:0,"day").format("DD MMM YYYY")}),". However, your database backup will still be available for download thereafter."]})]})]}):(0,a.jsx)(H,{})})]}),!q&&!X&&(0,a.jsx)(H,{})]}),(!q||J&&!$)&&(0,a.jsxs)("div",{className:"flex items-center justify-center gap-4",children:[(0,a.jsx)(f.u,{size:"tiny",type:"default",disabled:!ed,onClick:()=>{ed?en?ei(!0):es(!0):h.Am.error("You do not have the required permissions to restore this project")},tooltip:{content:{side:"bottom",text:"You need additional permissions to resume this project"}},children:"Restore project"}),X?(0,a.jsx)(P.z,{asChild:!0,type:"primary",children:(0,a.jsx)(u(),{href:"/org/".concat(Y,"/billing?panel=subscriptionPlan"),children:"Upgrade to Pro"})}):(0,a.jsx)(P.z,{asChild:!0,type:"default",children:(0,a.jsx)(u(),{href:"/project/".concat(w,"/settings/general"),children:"View project settings"})})]})]})})})}),(0,a.jsx)(F.Z,{visible:ea,title:"Restore this project",description:"Confirm to restore this project? Your project's data will be restored to when it was initially paused.",buttonLabel:"Restore project",buttonLoadingLabel:"Restoring project",onSelectCancel:()=>es(!1),onSelectConfirm:()=>{if(!S)return h.Am.error("Unable to restore: project is required");eo({ref:S.ref})}}),(0,a.jsxs)(O.Z,{hideFooter:!0,visible:er,size:"medium",header:"Your organization has members who have exceeded their free project limits",onCancel:()=>ei(!1),children:[(0,a.jsxs)(O.Z.Content,{className:"space-y-2",children:[(0,a.jsx)("p",{className:"text-sm text-foreground-light",children:"The following members have reached their maximum limits for the number of active free plan projects within organizations where they are an administrator or owner:"}),(0,a.jsx)("ul",{className:"pl-5 text-sm list-disc text-foreground-light",children:(et||[]).map((e,t)=>(0,a.jsxs)("li",{children:[e.username||e.primary_email," (Limit: ",e.free_project_limit," free projects)"]},"member-".concat(t)))}),(0,a.jsx)("p",{className:"text-sm text-foreground-light",children:"These members will need to either delete, pause, or upgrade one or more of these projects before you're able to unpause this project."})]}),(0,a.jsx)(O.Z.Separator,{}),(0,a.jsx)(O.Z.Content,{children:(0,a.jsx)(P.z,{htmlType:"button",type:"default",onClick:()=>ei(!1),block:!0,children:"Understood"})})]})]})}},62614:function(e,t,n){"use strict";n.d(t,{Z:function(){return d}});var a=n(52322),s=n(8286),r=n(2784),i=n(32079),o=n(6659),l=n(82955);!function(e){let t=[/\b(?:async|sync|yield)\*/,/\b(?:abstract|assert|async|await|break|case|catch|class|const|continue|covariant|default|deferred|do|dynamic|else|enum|export|extends|extension|external|factory|final|finally|for|get|hide|if|implements|import|in|interface|library|mixin|new|null|on|operator|part|rethrow|return|set|show|static|super|switch|sync|this|throw|try|typedef|var|void|while|with|yield)\b/],n=/(^|[^\w.])(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,a={pattern:RegExp(n+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}}}};e.languages.dart=e.languages.extend("clike",{"class-name":[a,{pattern:RegExp(n+/[A-Z]\w*(?=\s+\w+\s*[;,=()])/.source),lookbehind:!0,inside:a.inside}],keyword:t,operator:/\bis!|\b(?:as|is)\b|\+\+|--|&&|\|\||<<=?|>>=?|~(?:\/=?)?|[+\-*\/%&^|=!<>]=?|\?/}),e.languages.insertBefore("dart","string",{"string-literal":{pattern:/r?(?:("""|''')[\s\S]*?\1|(["'])(?:\\.|(?!\2)[^\\\r\n])*\2(?!\2))/,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$(?:\w+|\{(?:[^{}]|\{[^{}]*\})*\})/,lookbehind:!0,inside:{punctuation:/^\$\{?|\}$/,expression:{pattern:/[\s\S]+/,inside:e.languages.dart}}},string:/[\s\S]+/}},string:void 0}),e.languages.insertBefore("dart","class-name",{metadata:{pattern:/@\w+/,alias:"function"}}),e.languages.insertBefore("dart","class-name",{generics:{pattern:/<(?:[\w\s,.&?]|<(?:[\w\s,.&?]|<(?:[\w\s,.&?]|<[\w\s,.&?]*>)*>)*>)*>/,inside:{"class-name":a,keyword:t,punctuation:/[<>(),.:]/,operator:/[?&|]/}}})}(s.p1);let c={defaultLanguage:"js"};var d=e=>{var t;let{children:n,parentClassName:d,className:u,showCopy:p=!0}=e,{resolvedTheme:h}=(0,o.F)(),[m,g]=(0,r.useState)(!1),f=(0,r.useRef)(null),x=[];(0,r.useEffect)(()=>{if(!m)return;let e=setTimeout(()=>g(!1),2e3);return()=>clearTimeout(e)},[m]);let j=u&&u.replace(/language-/,"");!j&&c.defaultLanguage&&(j=c.defaultLanguage);let b=e=>{(0,l.vQ)(e,()=>g(!0))};return(0,a.jsx)(s.y$,{theme:"dark"===h?s.np.nightOwl:s.np.nightOwlLight,code:null!==(t=null==n?void 0:n.trim())&&void 0!==t?t:"",language:j,children:e=>{let{className:t,tokens:s,getLineProps:r,getTokenProps:o}=e;return(0,a.jsxs)("div",{className:"Code codeBlockWrapper group",children:[(0,a.jsx)("pre",{ref:f,className:"codeBlock ".concat(t," ").concat(d),children:s.map((e,t)=>{let n=r({line:e,key:t});return x.includes(t+1)&&(n.className="".concat(n.className," docusaurus-highlight-code-line")),(0,a.jsx)("div",{...n,children:e.map((e,t)=>(0,a.jsx)("span",{...o({token:e,key:t})},t))},t)})}),p&&(0,a.jsx)("div",{className:"invisible absolute right-0 top-0 opacity-0 transition-opacity group-hover:visible group-hover:opacity-100",children:(0,a.jsx)(i.z,{size:"tiny",type:"default",onClick:()=>b(n),children:m?"Copied":"Copy"})})]})}})}},41582:function(e,t,n){"use strict";n.d(t,{D:function(){return x},m:function(){return y}});var a=n(52322),s=n(59491),r=n(63059),i=n(32079),o=n(750),l=n(70293),c=n(64306),d=n(22532),u=n(44085),p=n(87175),h=n(99248),m=n(96958),g=n(52006),f=n(45010),x=()=>{var e,t;let{ref:n}=(0,l.UO)(),{data:x,isError:j,isLoading:b}=(0,u.o)({projectRef:n}),{data:y,isError:v,isLoading:w}=(0,d.t)({projectRef:n}),N=null==y?void 0:y.jwtSecretUpdateStatus,k=(0,p.Xo)(s.KA.READ,"service_api_keys"),S=void 0===N||N===r.JwtSecretUpdateStatus.Updated,_=(null!==(e=null==x?void 0:x.services)&&void 0!==e?e:[]).find(e=>e.app.id==h.pG),C=null!==(t=null==_?void 0:_.service_api_keys)&&void 0!==t?t:[],E=0===C.length;return(0,a.jsx)(c.Z,{title:(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("h5",{className:"text-base",children:"Project API keys"}),(0,a.jsxs)("p",{className:"text-sm text-foreground-light",children:["Your API is secured behind an API gateway which requires an API Key for every request.",(0,a.jsx)("br",{}),"You can use the keys below in the Supabase client libraries.",(0,a.jsx)("br",{}),(0,a.jsx)("a",{href:"https://supabase.com/docs#client-libraries",target:"_blank",rel:"noreferrer",children:(0,a.jsx)(i.z,{icon:(0,a.jsx)(m.Z,{}),type:"default",className:"mt-4",children:"Client Docs"})})]})]}),children:j||v?(0,a.jsxs)("div",{className:"flex items-center justify-center py-8 space-x-2",children:[(0,a.jsx)(g.Z,{size:16,strokeWidth:1.5}),(0,a.jsx)("p",{className:"text-sm text-foreground-light",children:j?"Failed to retrieve API keys":"Failed to update JWT secret"})]}):E||b||w?(0,a.jsxs)("div",{className:"flex items-center justify-center py-8 space-x-2",children:[(0,a.jsx)(f.Z,{className:"animate-spin",size:16,strokeWidth:1.5}),(0,a.jsx)("p",{className:"text-sm text-foreground-light",children:b||E?"Retrieving API keys":"JWT secret is being updated"})]}):C.map((e,t)=>{var n,s;return(0,a.jsx)(c.Z.Content,{className:t>=1&&"border-t border-panel-border-interior-light [[data-theme*=dark]_&]:border-panel-border-interior-dark",children:(0,a.jsx)(o.Z,{readOnly:!0,disabled:!0,layout:"horizontal",className:"input-mono",label:(0,a.jsxs)(a.Fragment,{children:[null===(n=e.tags)||void 0===n?void 0:n.split(",").map((e,t)=>(0,a.jsx)("code",{className:"text-xs text-code",children:e},"".concat(e).concat(t))),"service_role"===e.tags&&(0,a.jsx)(a.Fragment,{children:(0,a.jsx)("code",{className:"bg-red-900 text-xs text-white",children:"secret"})}),"anon"===e.tags&&(0,a.jsx)("code",{className:"text-xs text-code",children:"public"})]}),copy:k&&S,reveal:"anon"!==e.tags&&k&&S,value:k?N===r.JwtSecretUpdateStatus.Failed?"JWT secret update failed, new API key may have issues":N===r.JwtSecretUpdateStatus.Updating?"Updating JWT secret...":null!==(s=null==e?void 0:e.api_key)&&void 0!==s?s:"You need additional permissions to view API keys":"You need additional permissions to view API keys",onChange:()=>{},descriptionText:"service_role"===e.tags?"This key has the ability to bypass Row Level Security. Never share it publicly.":"This key is safe to use in a browser if you have enabled Row Level Security for your tables and configured policies."})},e.api_key)})})},j=n(99959),b=n(6838),y=()=>{var e,t,n,s,i;let{ref:l}=(0,j.UO)(),{data:p,isLoading:m,isError:f}=(0,u.o)({projectRef:l}),{data:x,isError:y,isLoading:w}=(0,d.t)({projectRef:l}),N=null==x?void 0:x.jwtSecretUpdateStatus,k=void 0===N||N===r.JwtSecretUpdateStatus.Updated,S=null!==(t=null==p?void 0:null===(e=p.project)||void 0===e?void 0:e.jwt_secret)&&void 0!==t?t:"",_=(null!==(n=null==p?void 0:p.services)&&void 0!==n?n:[]).find(e=>e.app.id==h.pG),C=null==_?void 0:_.app_config,E="".concat(null!==(s=null==C?void 0:C.protocol)&&void 0!==s?s:"https","://").concat(null!==(i=null==C?void 0:C.endpoint)&&void 0!==i?i:"-");return(0,a.jsx)(v,{children:f||y?(0,a.jsxs)("div",{className:"flex items-center justify-center py-8 space-x-2",children:[(0,a.jsx)(g.Z,{size:16,strokeWidth:1.5}),(0,a.jsx)("p",{className:"text-sm text-foreground-light",children:f?"Failed to retrieve configuration":"Failed to update JWT secret"})]}):m||w?(0,a.jsxs)("div",{className:"flex items-center justify-center py-8 space-x-2",children:[(0,a.jsx)(b.Z,{className:"animate-spin",size:16,strokeWidth:1.5}),(0,a.jsx)("p",{className:"text-sm text-foreground-light",children:m?"Retrieving API keys":"JWT secret is being updated"})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(c.Z.Content,{children:(0,a.jsx)(o.Z,{label:"URL",readOnly:!0,copy:!0,disabled:!0,className:"input-mono",value:E,descriptionText:"A RESTful endpoint for querying and managing your database.",layout:"horizontal"})}),(0,a.jsx)(c.Z.Content,{className:"border-t border-panel-border-interior-light [[data-theme*=dark]_&]:border-panel-border-interior-dark",children:(0,a.jsx)(o.Z,{label:"JWT Secret",readOnly:!0,copy:k,reveal:k,disabled:!0,value:N===r.JwtSecretUpdateStatus.Failed?"JWT secret update failed":N===r.JwtSecretUpdateStatus.Updating?"Updating JWT secret...":S,className:"input-mono",descriptionText:"Used to decode your JWTs. You can also use this to mint your own JWTs.",layout:"horizontal"})})]})})};let v=e=>{let{children:t}=e;return(0,a.jsx)(c.Z,{title:(0,a.jsx)("div",{className:"space-y-3",children:(0,a.jsx)("h5",{className:"text-base",children:"Project Configuration"})}),children:t})}},94865:function(e,t,n){"use strict";n.d(t,{x:function(){return a}});let a={is_readonly_mode_enabled:{bannerContent:{warning:{title:"Your project is currently in read-only mode and is no longer accepting write requests",description:"You will need to manually override read-only mode and reduce the disk size to below 95%"},critical:{title:"Your project is currently in read-only mode and is no longer accepting write requests",description:"You will need to manually override read-only mode and reduce the disk size to below 95%"}},cardContent:{warning:{title:"Project is in read-only mode",description:"Database is no longer accepting write requests."},critical:{title:"Project is in read-only mode",description:"Database is no longer accepting write requests."}},docsUrl:"https://supabase.com/docs/guides/platform/database-size#disabling-read-only-mode",buttonText:"View database settings",metric:"read_only"},disk_io_exhaustion:{bannerContent:{warning:{title:"Your project is about to deplete its Disk IO Budget, and may become unresponsive once fully exhausted",description:"You will need to optimize your performance or upgrade your compute. Check the usage page for more recent and detailed statistics."},critical:{title:"Your project has depleted its Disk IO Budget, and may become unresponsive",description:"You will need to optimize your performance or upgrade your compute. Check the usage page for more recent and detailed statistics."}},cardContent:{warning:{title:"Project is depleting its Disk IO Budget",description:"It may become unresponsive if fully exhausted"},critical:{title:"Project has depleted its Disk IO Budget",description:"It may become unresponsive"}},docsUrl:"https://supabase.com/docs/guides/platform/exhaust-disk-io",buttonText:"Check usage",metric:"disk_io"},disk_space_exhaustion:{bannerContent:{warning:{title:"Your project is about to exhaust its available disk space, and may become unresponsive once fully exhausted",description:"You can opt to increase your disk size up to 200GB on the database settings page."},critical:{title:"Your project has exhausted its available disk space, and may become unresponsive",description:"You can opt to increase your disk size up to 200GB on the database settings page."}},cardContent:{warning:{title:"Project is exhausting its available disk space",description:"It may become unresponsive if fully exhausted"},critical:{title:"Project has exhausted its available disk space",description:"It may become unresponsive"}},docsUrl:"https://supabase.com/docs/guides/platform/database-size#disk-management",buttonText:void 0,metric:"disk_space"},cpu_exhaustion:{bannerContent:{warning:{title:"Your project is currently facing high CPU usage, and its performance is affected",description:"You will need to optimize your performance or upgrade your compute. Check the usage page for more recent and detailed statistics."},critical:{title:"Your project's CPU usage is at 100% and its performance is affected",description:"You will need to optimize your performance or upgrade your compute. Check the usage page for more recent and detailed statistics."}},cardContent:{warning:{title:"Project has high CPU usage",description:"Performance is affected"},critical:{title:"Project CPU usage is at 100%",description:"Performance is affected"}},docsUrl:"https://supabase.com/docs/guides/platform/exhaust-cpu",buttonText:"Check usage",metric:"cpu"},memory_and_swap_exhaustion:{bannerContent:{warning:{title:"Your project is currently facing high memory usage, and its performance is affected",description:"You will need to optimize your performance or upgrade your compute. Check the usage page for more recent and detailed statistics."},critical:{title:"Your project's memory usage is at 100%, and its performance is affected",description:"You will need to optimize your performance or upgrade your compute. Check the usage page for more recent and detailed statistics."}},cardContent:{warning:{title:"Project has high memory usage",description:"Performance is affected"},critical:{title:"Project memory usage is at 100%",description:"Performance is affected"}},docsUrl:"https://supabase.com/docs/guides/platform/exhaust-ram",buttonText:"Check usage",metric:"ram"},auth_rate_limit_exhaustion:{bannerContent:{warning:{title:"Your project has exceeded email rate limits in the past 24 hours and may not reliably send auth related emails to users",description:"Set up a custom SMTP and adjust rate limits where necessary to ensure that emails are sent out reliably."},critical:{title:void 0,description:void 0}},cardContent:{warning:{title:"Your project has exceeded email rate limits",description:"You will need to set up a custom SMTP provider and adjust rate limits where necessary"},critical:{title:void 0,description:void 0}},docsUrl:"https://supabase.com/docs/guides/platform/going-into-prod#auth-rate-limits",buttonText:"Enable Custom SMTP",metric:"auth_email_rate_limit"},multiple_resource_warnings:{bannerContent:{warning:{title:"Your project is currently exhausting multiple resources, and its performance is affected",description:"Check which resources are reaching their threshold on your project's usage page."},critical:{title:"Your project has exhausted multiple resources, and its performance is affected",description:"Check which resources have reached their threshold on your project's usage page."}},cardContent:{warning:{title:"Project is exhausting multiple resources",description:"Performance is affected."},critical:{title:"Project has exhausted multiple resources",description:"Performance is affected."}},docsUrl:void 0,buttonText:"Check usage",metric:null}}},22293:function(e,t,n){"use strict";n.d(t,{L:function(){return s}});var a=n(94865);let s=(e,t,n)=>{var s,r;if("is_readonly_mode_enabled"===t)return a.x.is_readonly_mode_enabled.cardContent.warning;let i=e[t];if("string"==typeof i)return null===(r=a.x[t])||void 0===r?void 0:null===(s=r[n])||void 0===s?void 0:s[i]}},8040:function(e,t,n){"use strict";n.d(t,{J:function(){return m}});var a=n(52322),s=n(90038),r=n(76141),i=n(2784),o=n(27570),l=n(49650),c=n(32079),d=n(95492),u=n(61786),p=n(90504),h=n(19869);let m=e=>{let{className:t,disabled:n=!1,size:m="tiny",showError:g=!0,selectedSchemas:f=[],excludedSchemas:x=[],label:j,onSelectSchemas:b}=e,[y,v]=(0,i.useState)(!1),{project:w}=(0,o.d2)(),{data:N,isLoading:k,isSuccess:S,isError:_,error:C,refetch:E}=(0,l.Q)({projectRef:null==w?void 0:w.ref,connectionString:null==w?void 0:w.connectionString}),A=(N||[]).filter(e=>!x.includes(e.name)).sort((e,t)=>e.name.localeCompare(t.name)),T=e=>{f.includes(e)?b(f.filter(t=>t!==e)):b([...f,e].sort((e,t)=>e.localeCompare(t)))};return(0,a.jsxs)("div",{className:t,children:[k&&(0,a.jsx)(c.z,{type:"default",className:"justify-start",block:!0,size:m,loading:!0,children:"Loading schemas..."}),g&&_&&(0,a.jsxs)(d.bZ,{variant:"warning",className:"!px-3 !py-3",children:[(0,a.jsx)(d.Cd,{className:"text-xs text-amber-900",children:"Failed to load schemas"}),(0,a.jsxs)(d.X,{className:"text-xs mb-2 break-words",children:["Error: ",null==C?void 0:C.message]}),(0,a.jsx)(c.z,{type:"default",size:"tiny",onClick:()=>E(),children:"Reload schemas"})]}),S&&(0,a.jsxs)(u.J2,{open:y,onOpenChange:v,modal:!1,children:[(0,a.jsx)(u.xo,{asChild:!0,children:(0,a.jsx)(c.z,{size:m,disabled:n,type:"default",className:"w-full [&>span]:w-full",iconRight:(0,a.jsx)(s.Z,{className:"text-foreground-muted",strokeWidth:2,size:14}),children:(0,a.jsx)("div",{className:"w-full flex",children:(0,a.jsx)("p",{className:"text-foreground",children:j})})})}),(0,a.jsx)(u.yk,{className:"p-0 w-56",side:"bottom",align:"start",children:(0,a.jsxs)(p.mY,{children:[(0,a.jsx)(p.sZ,{placeholder:"Find schema..."}),(0,a.jsxs)(p.e8,{children:[(0,a.jsx)(p.rb,{children:"No schemas found"}),(0,a.jsx)(p.fu,{children:(0,a.jsx)(h.x,{className:(A||[]).length>7?"h-[210px]":"",children:null==A?void 0:A.map(e=>(0,a.jsxs)(p.di,{className:"cursor-pointer flex items-center justify-between space-x-2 w-full",onSelect:()=>T(e.name),onClick:()=>T(e.name),children:[(0,a.jsx)("span",{children:e.name}),f.includes(e.name)&&(0,a.jsx)(r.Z,{className:"text-brand",strokeWidth:2,size:16})]},e.id))})})]})]})})]})]})}},17001:function(e,t,n){"use strict";n.d(t,{J:function(){return d}});var a=n(85945),s=n(48228),r=n(56958),i=n(31696),o=n(27181),l=n(79073);async function c(e){let{projectRef:t,branchName:n,gitBranch:a,region:s}=e,{data:r,error:o}=await (0,i.v_)("/v1/projects/{ref}/branches",{params:{path:{ref:t}},body:{branch_name:n,git_branch:a,region:s}});return o&&(0,i.S3)(o),r}let d=function(){let{onSuccess:e,onError:t,...n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=(0,a.NL)();return(0,s.D)(e=>c(e),{async onSuccess(t,n,a){let{projectRef:s}=n;await i.invalidateQueries(l.x.list(s)),await i.invalidateQueries(o.i.detail(s)),await i.invalidateQueries(o.i.list()),await (null==e?void 0:e(t,n,a))},async onError(e,n,a){void 0===t?r.Am.error("Failed to create branch: ".concat(e.message)):t(e,n,a)},...n})}},22532:function(e,t,n){"use strict";n.d(t,{t:function(){return d}});var a=n(63059),s=n(85945),r=n(36492),i=n(88354),o=n(99248),l=n(45101);async function c(e,t){var n;let{projectRef:a}=e;if(!a)throw Error("projectRef is required");let s=await (0,i.U2)("".concat(o.T5,"/props/project/").concat(a,"/jwt-secret-update-status"),{signal:t});if(s.error)throw s.error;let r=null==s?void 0:null===(n=s.jwtSecretUpdateStatus)||void 0===n?void 0:n.meta;return{changeTrackingId:null==r?void 0:r.change_tracking_id,jwtSecretUpdateError:null==r?void 0:r.error,jwtSecretUpdateProgress:null==r?void 0:r.progress,jwtSecretUpdateStatus:null==r?void 0:r.status}}let d=function(e){let{projectRef:t}=e,{enabled:n=!0,...i}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=(0,s.NL)();return(0,r.a)(l.U.jwtSecretUpdatingStatus(t),e=>{let{signal:n}=e;return c({projectRef:t},n)},{enabled:n&&void 0!==t,refetchInterval(e){if(!e)return!1;let{jwtSecretUpdateStatus:t}=e;return t===a.JwtSecretUpdateStatus.Updating&&1e3},onSuccess(){o.invalidateQueries(l.U.postgrest(t))},...i})}},45101:function(e,t,n){"use strict";n.d(t,{U:function(){return a}});let a={pgBouncerStatus:e=>["projects",e,"pgbouncer"],settings:e=>["projects",e,"settings"],api:e=>["projects",e,"settings","api"],postgrest:e=>["projects",e,"postgrest"],jwtSecretUpdatingStatus:e=>["projects",e,"jwt-secret-updating-status"],storage:e=>["projects",e,"storage"],upgradeEligibility:e=>["projects",e,"upgrade-eligibility"],upgradeStatus:e=>["projects",e,"upgrade-status"]}},53535:function(e,t,n){"use strict";n.d(t,{q:function(){return o}});var a=n(36492),s=n(31696),r=n(45101);async function i(e,t){let{projectRef:n}=e;if(!n)throw Error("projectRef is required");let{data:a,error:r}=await (0,s.U2)("/platform/props/project/{ref}/api",{params:{path:{ref:n}},signal:t});return r&&(0,s.S3)(r),a}let o=function(e){let{projectRef:t}=e,{enabled:n=!0,...s}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,a.a)(r.U.api(t),e=>{let{signal:n}=e;return i({projectRef:t},n)},{enabled:n&&void 0!==t,refetchInterval(e,t){var n;if(!e)return!1;let{autoApiService:a}=e;return 0===(null!==(n=null==a?void 0:a.service_api_keys)&&void 0!==n?n:[]).length?2e3:0},...s})}},44085:function(e,t,n){"use strict";n.d(t,{o:function(){return l}});var a=n(36492),s=n(31696),r=n(99248),i=n(45101);async function o(e,t){let{projectRef:n}=e;if(!n)throw Error("projectRef is required");let{data:a,error:r}=await (0,s.U2)("/platform/props/project/{ref}/settings",{params:{path:{ref:n}},signal:t});return r&&(0,s.S3)(r),a}let l=function(e){let{projectRef:t}=e,{enabled:n=!0,...s}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,a.a)(i.U.settings(t),e=>{let{signal:n}=e;return o({projectRef:t},n)},{enabled:n&&void 0!==t,refetchInterval(e){var t,n;let a=(null!==(t=null==e?void 0:e.services)&&void 0!==t?t:[]).find(e=>e.app.id==r.pG);return 0===(null!==(n=null==a?void 0:a.service_api_keys)&&void 0!==n?n:[]).length?2e3:0},...s})}},92849:function(e,t,n){"use strict";n.d(t,{D:function(){return d}});var a=n(36492),s=n(99959),r=n(31696),i=n(26211),o=n(85193),l=n(45101);async function c(e,t){let{projectRef:n}=e;if(!n)throw Error("projectRef is required");let{data:a,error:s}=await (0,r.U2)("/v1/projects/{ref}/upgrade/eligibility",{params:{path:{ref:n}}});return s&&(0,r.S3)(s),a}let d=function(e){let{projectRef:t}=e,{enabled:n=!0,...r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},d=(0,i.N)(t);return(0,a.a)(l.U.upgradeEligibility(t),e=>{let{signal:n}=e;return c({projectRef:t},n)},{enabled:n&&void 0!==d&&d.status===o.S.ACTIVE_HEALTHY&&void 0!==t&&s.Qy,...r})}},56490:function(e,t,n){"use strict";n.d(t,{h:function(){return d}});var a=n(85945),s=n(36492),r=n(63059),i=n(88354),o=n(99248),l=n(45101);async function c(e,t){let{projectRef:n}=e;if(!n)throw Error("projectRef is required");let a=await (0,i.U2)("".concat(o.Q2,"/projects/").concat(n,"/upgrade/status"),{signal:t});if(a.error)throw a.error;return a}let d=function(e){let{projectRef:t,projectStatus:n}=e,{enabled:i=!0,...d}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=(0,a.NL)();return(0,s.a)(l.U.upgradeStatus(t),e=>{let{signal:n}=e;return c({projectRef:t},n)},{enabled:i&&void 0!==t,refetchInterval(e){var t,a;return!!e&&(n===o.S.UPGRADING&&(null===(t=e.databaseUpgradeStatus)||void 0===t?void 0:t.status)!==r.h.Upgrading||(null===(a=e.databaseUpgradeStatus)||void 0===a?void 0:a.status)===r.h.Upgrading)&&5e3},onSuccess(e){var n;(null===(n=e.databaseUpgradeStatus)||void 0===n?void 0:n.status)===r.h.Upgraded&&u.invalidateQueries(l.U.upgradeEligibility(t))},...d})}},22721:function(e,t,n){"use strict";n.d(t,{z:function(){return l}});var a=n(36492),s=n(31696),r=n(99248),i=n(42282);async function o(e,t){let{projectRef:n}=e;if(!n)throw Error("projectRef is required");let{data:a,error:r}=await (0,s.U2)("/v1/projects/{ref}/custom-hostname",{params:{path:{ref:n}},signal:t});if(r){var i,o;if(null===(i=r.message)||void 0===i?void 0:i.includes("not allowed to set up custom domain"))return{customDomain:null,status:"0_not_allowed"};if(null===(o=r.message)||void 0===o?void 0:o.includes("custom hostname configuration"))return{customDomain:null,status:"0_no_hostname_configured"};(0,s.S3)(r)}return{customDomain:a.data.result,status:a.status}}let l=function(e){let{projectRef:t}=e,{enabled:n=!0,...s}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,a.a)(i.A.list(t),e=>{let{signal:n}=e;return o({projectRef:t},n)},{enabled:n&&r.Qy&&void 0!==t,...s})}},42282:function(e,t,n){"use strict";n.d(t,{A:function(){return a}});let a={list:e=>["projects",e,"custom-domains"]}},84234:function(e,t,n){"use strict";n.d(t,{s:function(){return o}});var a=n(48228),s=n(56958),r=n(31696);async function i(e){let{ref:t,backup:n}=e,{data:a,error:s}=await (0,r.v_)("/platform/database/{ref}/backups/download",{params:{path:{ref:t}},body:{id:n.id,inserted_at:n.inserted_at,project_id:n.project_id,data:{},s3_bucket:"deprecated",s3_path:"deprecated",status:"deprecated"}});return s&&(0,r.S3)(s),a}let o=function(){let{onSuccess:e,onError:t,...n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,a.D)(e=>i(e),{async onSuccess(t,n,a){await (null==e?void 0:e(t,n,a))},async onError(e,n,a){void 0===t?s.Am.error("Failed to download backup: ".concat(e.message)):t(e,n,a)},...n})}},49650:function(e,t,n){"use strict";n.d(t,{Q:function(){return o},X:function(){return l}});var a=n(98402),s=n(18592),r=n(18545);let i=a.Z.schemas.list(),o=function(e){let{projectRef:t,connectionString:n}=e,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,s.cp)({projectRef:t,connectionString:n,sql:i.sql,queryKey:["schemas","list"]},{select:e=>e.result,...a})};function l(e,t){return e.invalidateQueries(r.M.query(t,["schemas","list"]))}},36203:function(e,t,n){"use strict";n.d(t,{a:function(){return o}});var a=n(36492),s=n(31696);let r=e=>["projects",e,"docs"];async function i(e,t){let{projectRef:n}=e;if(!n)throw Error("projectRef is required");let{data:a,error:r}=await (0,s.U2)("/platform/projects/{ref}/api/rest",{params:{path:{ref:n}},signal:t});return r&&(0,s.S3)(r),a}let o=function(e){let{projectRef:t}=e,{enabled:n=!0,...s}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,a.a)(r(t),e=>{let{signal:n}=e;return i({projectRef:t},n)},{enabled:n&&void 0!==t,...s})}},21970:function(e,t,n){"use strict";n.d(t,{I:function(){return l}});var a=n(36492),s=n(31696),r=n(99248),i=n(66437);async function o(e,t){let{projectRef:n}=e;if(!n)throw Error("projectRef is required");let{data:a,error:r}=await (0,s.U2)("/v1/projects/{ref}/functions",{params:{path:{ref:n}},signal:t});return r&&(0,s.S3)(r),a}let l=function(e){let{projectRef:t}=e,{enabled:n=!0,...s}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,a.a)(i.f.list(t),e=>{let{signal:n}=e;return o({projectRef:t},n)},{enabled:r.Qy&&n&&void 0!==t,...s})}},66437:function(e,t,n){"use strict";n.d(t,{f:function(){return a}});let a={list:e=>["projects",e,"edge-functions"],detail:(e,t)=>["projects",e,"edge-function",t]}},51448:function(e,t,n){"use strict";n.d(t,{s:function(){return o}});var a=n(48228),s=n(56958),r=n(31696);async function i(e,t){let{connectionId:n,branchName:a}=e,{data:s,error:i}=await (0,r.U2)("/platform/integrations/github/branches/{connectionId}/{branchName}",{params:{path:{connectionId:n,branchName:a}},signal:t});return i&&(0,r.S3)(i),s}let o=function(){let{onSuccess:e,onError:t,...n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,a.D)(e=>i(e),{async onSuccess(t,n,a){await (null==e?void 0:e(t,n,a))},async onError(e,n,a){void 0===t?s.Am.error("Failed to check Github branch: ".concat(e.message)):t(e,n,a)},...n})}},93276:function(e,t,n){"use strict";n.d(t,{X:function(){return a}});let a={lint:e=>["projects",e,"lint"]}},52903:function(e,t,n){"use strict";n.d(t,{U:function(){return o}});var a=n(36492),s=n(31696),r=n(93276);async function i(e,t){let{projectRef:n}=e;if(!n)throw Error("Project ref is required");let{data:a,error:r}=await (0,s.U2)("/platform/projects/{ref}/run-lints",{params:{path:{ref:n}},signal:t});return r&&(0,s.S3)(r),a}let o=function(e){let{projectRef:t}=e,{enabled:n=!0,...s}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,a.a)(r.X.lint(t),e=>{let{signal:n}=e;return i({projectRef:t},n)},{enabled:n&&void 0!==t,...s})}},26002:function(e,t,n){"use strict";n.d(t,{H:function(){return o}});var a=n(36492),s=n(31696);let r=e=>["projects",e,"open-api-spec"];async function i(e,t){let{projectRef:n}=e;if(!n)throw Error("projectRef is required");let{data:a,error:r}=await (0,s.U2)("/platform/projects/{ref}/api/rest",{params:{path:{ref:n}},signal:t});r&&(0,s.S3)(r);let i=a.definitions?Object.entries(a.definitions).map(e=>{let[t,n]=e;return{...n,name:t,fields:Object.entries(n.properties||{}).map(e=>{let[t,n]=e;return{...n,name:t}})}}):[],o=a.paths?Object.entries(a.paths).map(e=>{let[t,n]=e;return{...n,path:t,name:t.replace("/rpc/","")}}).filter(e=>e.path.includes("/rpc")).sort((e,t)=>e.name.localeCompare(t.name)):[];return{data:a,tables:i,functions:o}}let o=function(e){let{projectRef:t}=e,{enabled:n=!0,...s}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,a.a)(r(t),e=>{let{signal:n}=e;return i({projectRef:t},n)},{enabled:n&&void 0!==t,...s})}},65416:function(e,t,n){"use strict";n.d(t,{J:function(){return s}});var a=n(31696);async function s(e,t){let{ref:n}=e;if(!n)throw Error("Project ref is required");let{data:s,error:r}=await (0,a.U2)("/v1/projects/{ref}/types/typescript",{params:{path:{ref:n}},signal:t});return r&&(0,a.S3)(r),s}n(27181)},18592:function(e,t,n){"use strict";n.d(t,{Rj:function(){return o},cp:function(){return l}});var a=n(36492),s=n(31696),r=n(35432),i=n(18545);async function o(e,t){var n,a,i;let{projectRef:o,connectionString:l,sql:c,queryKey:d,handleError:u,isRoleImpersonationEnabled:p=!1}=e;if(!o)throw Error("projectRef is required");let h=new Headers;l&&h.set("x-connection-encrypted",l);let{data:m,error:g}=await (0,s.v_)("/platform/pg-meta/{ref}/query",{signal:t,params:{header:{"x-connection-encrypted":null!=l?l:""},path:{ref:o},query:{key:null!==(a=null==d?void 0:d.filter(e=>"string"==typeof e).join("-"))&&void 0!==a?a:""}},body:{query:c},headers:Object.fromEntries(h)});if(g){if(p&&"object"==typeof g&&null!==g&&"error"in g&&"formattedError"in g){let e=g,t=/LINE (\d+):/im,[,n]=null!==(i=t.exec(e.error))&&void 0!==i?i:[],a=Number(n);isNaN(a)||(e={...e,error:e.error.replace(t,"LINE ".concat(a-r.Yc,":")),formattedError:e.formattedError.replace(t,"LINE ".concat(a-r.Yc,":"))}),g=e}if(void 0!==u)return u(g);(0,s.S3)(g)}return p&&Array.isArray(m)&&(null==m?void 0:null===(n=m[0])||void 0===n?void 0:n[r.$y])===1?{result:[]}:{result:m}}let l=function(e){let{projectRef:t,connectionString:n,sql:s,queryKey:r,handleError:l,isRoleImpersonationEnabled:c}=e,{enabled:d=!0,...u}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,a.a)(i.M.query(t,null!=r?r:[btoa(s)]),e=>{let{signal:a}=e;return o({projectRef:t,connectionString:n,sql:s,queryKey:r,handleError:l,isRoleImpersonationEnabled:c},a)},{enabled:d&&void 0!==t,staleTime:0,...u})}},18545:function(e,t,n){"use strict";n.d(t,{M:function(){return a}});let a={query:(e,t)=>["projects",e,"query",...t]}},88787:function(e,t,n){"use strict";n.d(t,{K:function(){return o}});var a=n(36492),s=n(31696),r=n(42654);async function i(e,t){let{projectRef:n}=e;if(!n)throw Error("projectRef is required");let{data:a,error:r}=await (0,s.U2)("/platform/storage/{ref}/buckets",{params:{path:{ref:n}},signal:t});return r&&(0,s.S3)(r),a}let o=function(e){let{projectRef:t}=e,{enabled:n=!0,...s}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,a.a)(r.m.buckets(t),e=>{let{signal:n}=e;return i({projectRef:t},n)},{enabled:n&&void 0!==t,...s,retry:(e,t)=>!("object"==typeof t&&null!==t&&t.message.startsWith("Tenant config")&&t.message.endsWith("not found"))&&e<3})}},42654:function(e,t,n){"use strict";n.d(t,{m:function(){return a}});let a={buckets:e=>["projects",e,"buckets"]}},69923:function(e,t,n){"use strict";n.d(t,{F:function(){return o}});var a=n(36492),s=n(31696),r=n(94896);async function i(e,t){let{projectRef:n}=e;if(!n)throw Error("projectRef is required");let{error:a,data:r}=await (0,s.U2)("/platform/projects/{ref}/billing/addons",{params:{path:{ref:n}},signal:t});return a&&(0,s.S3)(a),r}let o=function(e){let{projectRef:t}=e,{enabled:n=!0,...s}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,a.a)(r.U.addons(t),e=>{let{signal:n}=e;return i({projectRef:t},n)},{enabled:n&&void 0!==t,...s})}},43683:function(e,t,n){"use strict";n.d(t,{q:function(){return l}});var a=n(36492),s=n(99959),r=n(31696),i=n(99445);async function o(e){let{data:t,error:n}=await (0,r.U2)("/platform/projects-resource-warnings",{signal:e});return n&&(0,r.S3)(n),t}let l=function(){let{enabled:e=!0,...t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,a.a)(i.Z.resourceWarnings(),e=>{let{signal:t}=e;return o(t)},{enabled:s.Qy&&e,staleTime:18e5,...t})}},23770:function(e,t,n){"use strict";n.d(t,{_:function(){return i},l:function(){return o}});var a=n(85945),s=n(36492),r=n(2784);function i(e,t){let[n,a]=(0,r.useState)(()=>{try{let n=window.localStorage.getItem(e);return n?JSON.parse(n):t}catch(e){return console.log(e),t}}),s=(0,r.useCallback)(t=>{try{let s=t instanceof Function?t(n):t;a(s),window.localStorage.setItem(e,JSON.stringify(s))}catch(e){console.log(e)}},[e,n]);return[n,s]}function o(e,t){let n=(0,a.NL)(),r=["localStorage",e],{data:i=t}=(0,s.a)(r,()=>{let n=window.localStorage.getItem(e);return n?JSON.parse(n):t});return[i,t=>{let a=t instanceof Function?t(i):t;window.localStorage.setItem(e,JSON.stringify(a)),n.setQueryData(r,a),n.invalidateQueries(r)}]}},78696:function(e,t,n){"use strict";n.d(t,{l:function(){return r}});var a=n(23770),s=n(99248);function r(e){let[t,n]=(0,a.l)(s.dA.SQL_EDITOR_AI_SCHEMA(e),["public"]);return e?[t,n]:[[],()=>{}]}},35432:function(e,t,n){"use strict";n.d(t,{$y:function(){return i},Jh:function(){return o},Wn:function(){return u},Yc:function(){return r}});var a=n(82955);function s(e,t){let n=new Date;n.setTime(n.getTime()+36e5);let s=Math.floor(n.getTime()/1e3),r=Math.floor(Date.now()/1e3);if("authenticated"===t.role){var i,o;let n=t.user;return{aal:null!==(i=t.aal)&&void 0!==i?i:"aal1",amr:[{method:"password",timestamp:r}],app_metadata:n.raw_app_meta_data,aud:"authenticated",email:n.email,exp:s,iat:r,iss:"https://".concat(e,".supabase.co/auth/v1"),phone:n.phone,role:null!==(o=n.role)&&void 0!==o?o:t.role,session_id:(0,a.k$)(),sub:n.id,user_metadata:n.raw_user_meta_data,is_anonymous:n.is_anonymous}}return{iss:"supabase",ref:e,role:t.role,iat:r,exp:s}}let r=11,i="ROLE_IMPERSONATION_NO_RESULTS";function o(e,t){var n;let{projectRef:a,role:r}=t;if(void 0===r)return e;let o="postgrest"===r.type?function(e,t){let n=s(e,t);return"\n select set_config('role', '".concat(t.role,"', true),\n set_config('request.jwt.claims', '").concat(JSON.stringify(n),"', true),\n set_config('request.method', 'POST', true),\n set_config('request.path', '/impersonation-example-request-path', true),\n set_config('request.headers', '{\"accept\": \"*/*\"}', true);\n ").trim()}(a,r):(n=r.role,"\n set local role '".concat(n,"';\n "));return"\n ".concat(o,'\n\n -- If the users sql returns no rows, pg-meta will\n -- fallback to returning the result of the impersonation sql.\n select 1 as "').concat(i,'";\n\n ').concat(e,"\n ")}function l(e){return new TextEncoder().encode(e)}function c(e){return btoa(String.fromCharCode(...new Uint8Array("string"==typeof e?l(e):e))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function d(e,t){let n=c(l(JSON.stringify({alg:"HS256",typ:"JWT"})))+"."+c(l(JSON.stringify(e))),a=c(new Uint8Array(await window.crypto.subtle.sign({name:"HMAC"},await window.crypto.subtle.importKey("raw",l(t),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"]),l(n))));return"".concat(n,".").concat(a)}function u(e,t,n){return d(s(e,n),t)}},98402:function(e,t,n){"use strict";n.d(t,{Z:function(){return E}});var a={};n.r(a),n.d(a,{create:function(){return N},list:function(){return b},pgFunctionArrayZod:function(){return x},pgFunctionCreateZod:function(){return v},pgFunctionDeleteZod:function(){return _},pgFunctionOptionalZod:function(){return j},pgFunctionUpdateZod:function(){return k},pgFunctionZod:function(){return f},remove:function(){return C},retrieve:function(){return y},update:function(){return S}});var s=n(56124);let r='\n-- Can\'t use pg_authid here since some managed Postgres providers don\'t expose it\n-- https://github.com/supabase/postgres-meta/issues/212\n\nselect\n r.oid :: int8 as id,\n rolname as name,\n rolsuper as "isSuperuser",\n rolcreatedb as "canCreateDb",\n rolcreaterole as "canCreateRole",\n rolinherit as "inheritRole",\n rolcanlogin as "canLogin",\n rolreplication as "isReplicationRole",\n rolbypassrls as "canBypassRls",\n (\n select\n count(*)\n from\n pg_stat_activity\n where\n r.rolname = pg_stat_activity.usename\n ) as "activeConnections",\n case when rolconnlimit = -1 then current_setting(\'max_connections\') :: int8\n else rolconnlimit\n end as "connectionLimit",\n rolvaliduntil as "validUntil",\n coalesce(r_config.role_configs, \'{}\') as config\nfrom\n pg_roles r\n left join (\n select\n oid,\n jsonb_object_agg(param, value) filter (where param is not null) as role_configs\n from\n (\n select\n oid,\n (string_to_array(unnest(rolconfig), \'=\'))[1] as param,\n (string_to_array(unnest(rolconfig), \'=\'))[2] as value\n from\n pg_roles\n ) as _\n group by\n oid\n ) r_config on r_config.oid = r.oid\n';var i=n(30195);let o=i.z.object({id:i.z.number(),name:i.z.string(),isSuperuser:i.z.boolean(),canCreateDb:i.z.boolean(),canCreateRole:i.z.boolean(),inheritRole:i.z.boolean(),canLogin:i.z.boolean(),isReplicationRole:i.z.boolean(),canBypassRls:i.z.boolean(),activeConnections:i.z.number(),connectionLimit:i.z.number(),validUntil:i.z.union([i.z.string(),i.z.null()]),config:i.z.record(i.z.string(),i.z.string())}),l=i.z.array(o),c=i.z.optional(o),d=["information_schema","pg_catalog","pg_toast"],u="\n-- Adapted from information_schema.schemata\n\nselect\n n.oid::int8 as id,\n n.nspname as name,\n u.rolname as owner\nfrom\n pg_namespace n,\n pg_roles u\nwhere\n n.nspowner = u.oid\n and (\n pg_has_role(n.nspowner, 'USAGE')\n or has_schema_privilege(n.oid, 'CREATE, USAGE')\n )\n and not pg_catalog.starts_with(n.nspname, 'pg_temp_')\n and not pg_catalog.starts_with(n.nspname, 'pg_toast_temp_')\n",p=i.z.object({id:i.z.number(),name:i.z.string(),owner:i.z.string()}),h=i.z.array(p),m=i.z.optional(p),g="\n-- CTE with sane arg_modes, arg_names, and arg_types.\n-- All three are always of the same length.\n-- All three include all args, including OUT and TABLE args.\nwith functions as (\n select\n *,\n -- proargmodes is null when all arg modes are IN\n coalesce(\n p.proargmodes,\n array_fill('i'::text, array[cardinality(coalesce(p.proallargtypes, p.proargtypes))])\n ) as arg_modes,\n -- proargnames is null when all args are unnamed\n coalesce(\n p.proargnames,\n array_fill(''::text, array[cardinality(coalesce(p.proallargtypes, p.proargtypes))])\n ) as arg_names,\n -- proallargtypes is null when all arg modes are IN\n coalesce(p.proallargtypes, p.proargtypes) as arg_types,\n array_cat(\n array_fill(false, array[pronargs - pronargdefaults]),\n array_fill(true, array[pronargdefaults])) as arg_has_defaults\n from\n pg_proc as p\n where\n p.prokind = 'f'\n)\nselect\n f.oid::int8 as id,\n n.nspname as schema,\n f.proname as name,\n l.lanname as language,\n case\n when l.lanname = 'internal' then ''\n else f.prosrc\n end as definition,\n case\n when l.lanname = 'internal' then f.prosrc\n else pg_get_functiondef(f.oid)\n end as complete_statement,\n coalesce(f_args.args, '[]') as args,\n pg_get_function_arguments(f.oid) as argument_types,\n pg_get_function_identity_arguments(f.oid) as identity_argument_types,\n f.prorettype::int8 as return_type_id,\n pg_get_function_result(f.oid) as return_type,\n nullif(rt.typrelid::int8, 0) as return_type_relation_id,\n f.proretset as is_set_returning_function,\n case\n when f.provolatile = 'i' then 'IMMUTABLE'\n when f.provolatile = 's' then 'STABLE'\n when f.provolatile = 'v' then 'VOLATILE'\n end as behavior,\n f.prosecdef as security_definer,\n f_config.config_params as config_params\nfrom\n functions f\n left join pg_namespace n on f.pronamespace = n.oid\n left join pg_language l on f.prolang = l.oid\n left join pg_type rt on rt.oid = f.prorettype\n left join (\n select\n oid,\n jsonb_object_agg(param, value) filter (where param is not null) as config_params\n from\n (\n select\n oid,\n (string_to_array(unnest(proconfig), '='))[1] as param,\n (string_to_array(unnest(proconfig), '='))[2] as value\n from\n functions\n ) as t\n group by\n oid\n ) f_config on f_config.oid = f.oid\n left join (\n select\n oid,\n jsonb_agg(jsonb_build_object(\n 'mode', t2.mode,\n 'name', name,\n 'type_id', type_id,\n 'has_default', has_default\n )) as args\n from\n (\n select\n oid,\n unnest(arg_modes) as mode,\n unnest(arg_names) as name,\n unnest(arg_types)::int8 as type_id,\n unnest(arg_has_defaults) as has_default\n from\n functions\n ) as t1,\n lateral (\n select\n case\n when t1.mode = 'i' then 'in'\n when t1.mode = 'o' then 'out'\n when t1.mode = 'b' then 'inout'\n when t1.mode = 'v' then 'variadic'\n else 'table'\n end as mode\n ) as t2\n group by\n t1.oid\n ) f_args on f_args.oid = f.oid\n",f=i.z.object({id:i.z.number(),schema:i.z.string(),name:i.z.string(),language:i.z.string(),definition:i.z.string(),complete_statement:i.z.string(),args:i.z.array(i.z.object({mode:i.z.union([i.z.literal("in"),i.z.literal("out"),i.z.literal("inout"),i.z.literal("variadic"),i.z.literal("table")]),name:i.z.string(),type_id:i.z.number(),has_default:i.z.boolean()})),argument_types:i.z.string(),identity_argument_types:i.z.string(),return_type_id:i.z.number(),return_type:i.z.string(),return_type_relation_id:i.z.union([i.z.number(),i.z.null()]),is_set_returning_function:i.z.boolean(),behavior:i.z.union([i.z.literal("IMMUTABLE"),i.z.literal("STABLE"),i.z.literal("VOLATILE")]),security_definer:i.z.boolean(),config_params:i.z.union([i.z.record(i.z.string(),i.z.string()),i.z.null()])}),x=i.z.array(f),j=i.z.optional(f);function b(){var e,t;let{includeSystemSchemas:n=!1,includedSchemas:a,excludedSchemas:r,limit:i,offset:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},l="\n with f as (\n ".concat(g,"\n )\n select\n f.*\n from f\n "),c=(e=r,((t=n?void 0:d)&&(e=t.concat(null!=e?e:[])),null==a?void 0:a.length)?"IN (".concat(a.map(s.i0).join(","),")"):(null==e?void 0:e.length)?"NOT IN (".concat(e.map(s.i0).join(","),")"):"");return c&&(l+=" where schema ".concat(c)),i&&(l="".concat(l," limit ").concat(i)),o&&(l="".concat(l," offset ").concat(o)),{sql:l,zod:x}}function y(e){let{id:t,name:n,schema:a="public",args:r=[]}=e;if(t)return{sql:"\n with f as (\n ".concat(g,"\n )\n select\n f.*\n from f where id = ").concat((0,s.i0)(t),";"),zod:j};if(n&&a&&r)return{sql:"with f as (\n ".concat(g,"\n )\n select\n f.*\n from f join pg_proc as p on id = p.oid where schema = ").concat((0,s.i0)(a)," and name = ").concat((0,s.i0)(n)," and p.proargtypes::text = ").concat(r.length?"(\n select string_agg(type_oid::text, ' ') from (\n select (\n split_args.arr[\n array_length(\n split_args.arr,\n 1\n )\n ]::regtype::oid\n ) as type_oid from (\n select string_to_array(\n unnest(\n array[".concat(r.map(s.i0),"]\n ),\n ' '\n ) as arr\n ) as split_args\n ) args\n )"):(0,s.i0)("")),zod:j};throw Error("Must provide either id or name and schema")}let v=i.z.object({name:i.z.string(),definition:i.z.string(),args:i.z.array(i.z.string()).optional(),behavior:i.z.enum(["IMMUTABLE","STABLE","VOLATILE"]).optional(),config_params:i.z.record(i.z.string(),i.z.string()).optional(),schema:i.z.string().optional(),language:i.z.string().optional(),return_type:i.z.string().optional(),security_definer:i.z.boolean().optional()});function w(e){let{name:t,schema:n,args:a,definition:r,return_type:i,language:o,behavior:l,security_definer:c,config_params:d}=e,{replace:u=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"\n CREATE ".concat(u?"OR REPLACE":""," FUNCTION ").concat((0,s.yR)(n),".").concat((0,s.yR)(t),"(").concat((null==a?void 0:a.join(", "))||"",")\n RETURNS ").concat(i,"\n AS ").concat((0,s.i0)(r),"\n LANGUAGE ").concat(o,"\n ").concat(l,"\n CALLED ON NULL INPUT\n ").concat(c?"SECURITY DEFINER":"SECURITY INVOKER","\n ").concat(d?Object.entries(d).map(e=>{let[t,n]=e;return"SET ".concat(t," ").concat("FROM CURRENT"===n[0]?"FROM CURRENT":"TO "+n)}).join("\n"):"",";\n ")}function N(e){let{name:t,schema:n="public",args:a=[],definition:s,return_type:r="void",language:o="sql",behavior:l="VOLATILE",security_definer:c=!1,config_params:d={}}=e;return{sql:w({name:t,schema:n,args:a,definition:s,return_type:r,language:o,behavior:l,security_definer:c,config_params:d}),zod:i.z.void()}}let k=i.z.object({name:i.z.string().optional(),schema:i.z.string().optional(),definition:i.z.string().optional()});function S(e,t){var n;let{name:a,schema:r,definition:o}=t,l=e.argument_types.split(", "),c=e.identity_argument_types,d="string"==typeof o?w({...e,definition:o,args:l,config_params:null!==(n=e.config_params)&&void 0!==n?n:{}},{replace:!0}):"",u=a&&a!==e.name?"ALTER FUNCTION ".concat((0,s.yR)(e.schema),".").concat((0,s.yR)(e.name),"(").concat(c,") RENAME TO ").concat((0,s.yR)(a),";"):"",p=r&&r!==e.schema?"ALTER FUNCTION ".concat((0,s.yR)(e.schema),".").concat((0,s.yR)(a||e.name),"(").concat(c,") SET SCHEMA ").concat((0,s.yR)(r),";"):"";return{sql:"\n DO LANGUAGE plpgsql $$\n BEGIN\n IF ".concat("string"==typeof o?"TRUE":"FALSE"," THEN\n ").concat(d,"\n\n IF (\n SELECT id\n FROM (").concat(g,") AS f\n WHERE f.schema = ").concat((0,s.i0)(e.schema),"\n AND f.name = ").concat((0,s.i0)(e.name),"\n AND f.identity_argument_types = ").concat((0,s.i0)(c),"\n ) != ").concat(e.id," THEN\n RAISE EXCEPTION 'Cannot find function \"").concat(e.schema,'"."').concat(e.name,'"(').concat(c,")';\n END IF;\n END IF;\n\n ").concat(u,"\n\n ").concat(p,"\n END;\n $$;\n "),zod:i.z.void()}}let _=i.z.object({cascade:i.z.boolean().default(!1).optional()});function C(e){let{cascade:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return{sql:"DROP FUNCTION ".concat((0,s.yR)(e.schema),".").concat((0,s.yR)(e.name),"\n (").concat(e.identity_argument_types,")\n ").concat(t?"CASCADE":"RESTRICT",";"),zod:i.z.void()}}var E={roles:{list:function(){let{includeDefaultRoles:e=!1,limit:t,offset:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a="\nwith\n roles as (".concat(r,")\nselect\n *\nfrom\n roles\nwhere\n true\n");return e||(a+=" and not pg_catalog.starts_with(name, 'pg_')"),t&&(a+=" limit ".concat(t)),n&&(a+=" offset ".concat(n)),{sql:a,zod:l}},retrieve:function(e){let{id:t,name:n}=e;return t?{sql:"".concat(r," where r.oid = ").concat((0,s.i0)(t),";"),zod:c}:{sql:"".concat(r," where rolname = ").concat((0,s.i0)(n),";"),zod:c}},create:function(e){let{name:t,isSuperuser:n=!1,canCreateDb:a=!1,canCreateRole:r=!1,inheritRole:i=!0,canLogin:o=!1,isReplicationRole:l=!1,canBypassRls:c=!1,connectionLimit:d=-1,password:u,validUntil:p,memberOf:h=[],members:m=[],admins:g=[],config:f={}}=e;return{sql:"\ncreate role ".concat((0,s.yR)(t),"\n ").concat(n?"superuser":"","\n ").concat(a?"createdb":"","\n ").concat(r?"createrole":"","\n ").concat(i?"":"noinherit","\n ").concat(o?"login":"","\n ").concat(l?"replication":"","\n ").concat(c?"bypassrls":"","\n connection limit ").concat(d,"\n ").concat(void 0===u?"":"password ".concat((0,s.i0)(u)),"\n ").concat(void 0===p?"":"valid until ".concat((0,s.i0)(p)),"\n ").concat(0===h.length?"":"in role ".concat(h.map(s.yR).join(",")),"\n ").concat(0===m.length?"":"role ".concat(m.map(s.yR).join(",")),"\n ").concat(0===g.length?"":"admin ".concat(g.map(s.yR).join(",")),"\n ;\n").concat(Object.entries(f).map(e=>{let[n,a]=e;return"alter role ".concat((0,s.yR)(t)," set ").concat((0,s.yR)(n)," = ").concat((0,s.i0)(a),";")}).join("\n"),"\n")}},update:function(e,t){let{id:n,name:a}=e,{name:r,isSuperuser:i,canCreateDb:o,canCreateRole:l,inheritRole:c,canLogin:d,isReplicationRole:u,canBypassRls:p,connectionLimit:h,password:m,validUntil:g}=t;return{sql:"\ndo $$\ndeclare\n id oid := ".concat(void 0===n?"".concat((0,s.i0)(a),"::regrole"):(0,s.i0)(n),";\n old record;\nbegin\n select * into old from pg_roles where oid = id;\n if old is null then\n raise exception 'Cannot find role with id %', id;\n end if;\n\n execute(format('alter role %I\n ").concat(void 0===i?"":i?"superuser":"nosuperuser","\n ").concat(void 0===o?"":o?"createdb":"nocreatedb","\n ").concat(void 0===l?"":l?"createrole":"nocreaterole","\n ").concat(void 0===c?"":c?"inherit":"noinherit","\n ").concat(void 0===d?"":d?"login":"nologin","\n ").concat(void 0===u?"":u?"replication":"noreplication","\n ").concat(void 0===p?"":p?"bypassrls":"nobypassrls","\n ").concat(void 0===h?"":"connection limit ".concat((0,s.i0)(h)),"\n ").concat(void 0===m?"":"password ".concat((0,s.i0)(m)),"\n ").concat(void 0===g?"":"valid until ".concat((0,s.i0)(g)),"\n ', old.rolname));\n\n ").concat(void 0===r?"":"\n -- Using the same name in the rename clause gives an error, so only do it if the new name is different.\n if new_name != old.nspname then\n execute(format('alter role %I rename to ".concat((0,s.yR)(r),";', old.nspname));\n end if;\n "),"\nend\n$$;\n")}},remove:function(e){let{id:t,name:n}=e,{ifExists:a=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return{sql:"\ndo $$\ndeclare\n id oid := ".concat(void 0===t?"".concat((0,s.i0)(n),"::regrole"):(0,s.i0)(t),";\n old record;\nbegin\n select * into old from pg_roles where oid = id;\n if old is null then\n raise exception 'Cannot find role with id %', id;\n end if;\n\n execute(format('drop role ").concat(a?"if exists":""," %I;', old.rolname));\nend\n$$;\n")}},zod:o},schemas:{list:function(){let{includeSystemSchemas:e=!1,limit:t,offset:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=u;return e||(a="".concat(a," and not (n.nspname in (").concat(d.map(s.i0).join(","),"))")),t&&(a="".concat(a," limit ").concat(t)),n&&(a="".concat(a," offset ").concat(n)),{sql:a,zod:h}},retrieve:function(e){let{id:t,name:n}=e;return t?{sql:"".concat(u," and n.oid = ").concat((0,s.i0)(t),";"),zod:m}:{sql:"".concat(u," and n.nspname = ").concat((0,s.i0)(n),";"),zod:m}},create:function(e){let{name:t,owner:n}=e;return{sql:"create schema ".concat((0,s.yR)(t),"\n ").concat(void 0===n?"":"authorization ".concat((0,s.yR)(n)),";\n")}},update:function(e,t){let{id:n,name:a}=e,{name:r,owner:i}=t;return{sql:"\ndo $$\ndeclare\n id oid := ".concat(void 0===n?"".concat((0,s.i0)(a),"::regnamespace"):(0,s.i0)(n),";\n old record;\n new_name text := ").concat(void 0===r?null:(0,s.i0)(r),";\n new_owner text := ").concat(void 0===i?null:(0,s.i0)(i),";\nbegin\n select * into old from pg_namespace where oid = id;\n if old is null then\n raise exception 'Cannot find schema with id %', id;\n end if;\n\n if new_owner is not null then\n execute(format('alter schema %I owner to %I;', old.nspname, new_owner));\n end if;\n\n -- Using the same name in the rename clause gives an error, so only do it if the new name is different.\n if new_name is not null and new_name != old.nspname then\n execute(format('alter schema %I rename to %I;', old.nspname, new_name));\n end if;\nend\n$$;\n")}},remove:function(e){let{id:t,name:n}=e,{cascade:a=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return{sql:"\ndo $$\ndeclare\n id oid := ".concat(void 0===t?"".concat((0,s.i0)(n),"::regnamespace"):(0,s.i0)(t),";\n old record;\n cascade bool := ").concat((0,s.i0)(a),";\nbegin\n select * into old from pg_namespace where oid = id;\n if old is null then\n raise exception 'Cannot find schema with id %', id;\n end if;\n\n execute(format('drop schema %I %s;', old.nspname, case when cascade then 'cascade' else 'restrict' end));\nend\n$$;\n")}},zod:p},functions:a}},56124:function(e,t,n){"use strict";n.d(t,{WU:function(){return l},yR:function(){return i},i0:function(){return o}});let a=new Set(["AES128","AES256","ALL","ALLOWOVERWRITE","ANALYSE","ANALYZE","AND","ANY","ARRAY","AS","ASC","ASYMMETRIC","AUTHORIZATION","BACKUP","BETWEEN","BINARY","BLANKSASNULL","BOTH","BYTEDICT","CASE","CAST","CHECK","COLLATE","COLUMN","CONSTRAINT","CREATE","CREDENTIALS","CROSS","CURRENT_CATALOG","CURRENT_DATE","CURRENT_ROLE","CURRENT_TIME","CURRENT_TIMESTAMP","CURRENT_USER","CURRENT_USER_ID","DEFAULT","DEFERRABLE","DEFLATE","DEFRAG","DELTA","DELTA32K","DESC","DISABLE","DISTINCT","DO","ELSE","EMPTYASNULL","ENABLE","ENCODE","ENCRYPT","ENCRYPTION","END","EXCEPT","EXPLICIT","FALSE","FETCH","FOR","FOREIGN","FREEZE","FROM","FULL","GLOBALDICT256","GLOBALDICT64K","GRANT","GROUP","GZIP","HAVING","IDENTITY","IGNORE","ILIKE","IN","INITIALLY","INNER","INTERSECT","INTO","IS","ISNULL","JOIN","LATERAL","LEADING","LEFT","LIKE","LIMIT","LOCALTIME","LOCALTIMESTAMP","LUN","LUNS","LZO","LZOP","MINUS","MOSTLY13","MOSTLY32","MOSTLY8","NATURAL","NEW","NOT","NOTNULL","NULL","NULLS","OFF","OFFLINE","OFFSET","OLD","ON","ONLY","OPEN","OR","ORDER","OUTER","OVERLAPS","PARALLEL","PARTITION","PERCENT","PLACING","PRIMARY","RAW","READRATIO","RECOVER","REFERENCES","REJECTLOG","RESORT","RESTORE","RETURNING","RIGHT","SELECT","SESSION_USER","SIMILAR","SOME","SYMMETRIC","SYSDATE","SYSTEM","TABLE","TAG","TDES","TEXT255","TEXT32K","THEN","TO","TOP","TRAILING","TRUE","TRUNCATECOLUMNS","UNION","UNIQUE","USER","USING","VARIADIC","VERBOSE","WALLET","WHEN","WHERE","WINDOW","WITH","WITHOUT"]);function s(e){return e.replace("T"," ").replace("Z","+00")}function r(e,t,n){let a="";for(let[s,r]of(a+=e?" (":"(",t.entries()))a+=(0===s?"":", ")+n(r);return a+")"}function i(e){if(null==e)throw Error("SQL identifier cannot be null or undefined");if(!1===e)return'"f"';if(!0===e)return'"t"';if(e instanceof Date)return'"'.concat(s(e.toISOString()),'"');if(Array.isArray(e)){let t=[];for(let n of e){if(!0===Array.isArray(n))throw TypeError("Nested array to grouped list conversion is not supported for SQL identifier");t.push(i(n))}return t.toString()}if(e===Object(e))throw Error("SQL identifier cannot be an object");let t=String(e).slice(0);if(!0===/^[_a-z][\d$_a-z]*$/.test(t)&&!1==!!a.has(t.toUpperCase()))return t;let n='"';for(let e of t)n+='"'===e?e+e:e;return n+'"'}function o(e){let t,n="";if(null==e)return"NULL";if("bigint"==typeof e)return BigInt(e).toString();if(e===Number.POSITIVE_INFINITY)return"'Infinity'";if(e===Number.NEGATIVE_INFINITY)return"'-Infinity'";if(Number.isNaN(e))return"'NaN'";if("number"==typeof e)return Number(e).toString();if(!1===e)return"'f'";if(!0===e)return"'t'";if(e instanceof Date)return"'".concat(s(e.toISOString()),"'");if(Array.isArray(e)){let t=[];for(let[n,a]of e.entries())!0===Array.isArray(a)?t.push(r(0!==n,a,o)):t.push(o(a));return t.toString()}e===Object(e)?(t="jsonb",n=JSON.stringify(e)):n=String(e).slice(0);let a=!1,i="'";for(let e of n)"'"===e?i+=e+e:"\\"===e?(i+=e+e,a=!0):i+=e;return i+="'",!0===a&&(i="E".concat(i)),t&&(i+="::".concat(t)),i}function l(e){for(var t=arguments.length,n=Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];return function(e,t){let n=0,a="%(%|(\\d+\\$)?[",l=RegExp(a+="ILs])","g");return e.replace(l,(e,a)=>{if("%"===a)return"%";let l=n,c=a.split("$");if(c.length>1&&(l=Number.parseInt(c[0],10)-1,a=c[1]),l<0)throw Error("specified argument 0 but arguments start at 1");if(l>t.length-1)throw Error("too few arguments");return(n=l+1,"I"===a)?i(t[l]):"L"===a?o(t[l]):"s"===a?function e(t){if(null==t)return"";if(!1===t)return"f";if(!0===t)return"t";if(t instanceof Date)return s(t.toISOString());if(Array.isArray(t)){let n=[];for(let[a,s]of t.entries())null!=s&&(!0===Array.isArray(s)?n.push(r(0!==a,s,e)):n.push(e(s)));return n.toString()}return t===Object(t)?JSON.stringify(t):String(t).toString().slice(0)}(t[l]):void 0})}(e,n)}},73831:function(e,t,n){"use strict";var a=n(52322),s=n(2784),r=n(83690),i=n(62277),o=n(32079);t.Z=e=>{let{visible:t=!1,danger:n=!1,title:l="",description:c="",size:d="small",buttonLabel:u="",buttonLoadingLabel:p="",onSelectCancel:h=()=>{},onSelectConfirm:m=()=>{}}=e;(0,s.useEffect)(()=>{t&&f(!1)},[t]);let[g,f]=(0,s.useState)(!1),x=()=>{f(!0),m()};return(0,a.jsx)(r.Z,{header:l,visible:t,title:l,description:c,size:d,hideFooter:!0,onCancel:h,children:(0,a.jsx)(i.Z,{initialValues:{},validateOnBlur:!0,onSubmit:()=>x(),validate:()=>[],children:()=>(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(r.Z.Content,{children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(o.z,{block:!0,htmlType:"button",type:"default",onClick:h,disabled:g,children:"Cancel"}),(0,a.jsx)(o.z,{htmlType:"submit",block:!0,type:n?"danger":"primary",disabled:g,loading:g,children:p&&g?p:u||"Confirm"})]})})})})})}},34820:function(e,t,n){"use strict";var a=n(52322),s=n(88883),r=n(2784),i=n(63955),o=n(41909),l=n(54383),c=n(22574),d=n(42070),u=n(32079),p=n(71550),h=n(30195);let m=(0,r.forwardRef)((e,t)=>{let{title:n,size:m="small",onConfirm:g,visible:f,onCancel:x,loading:j,cancelLabel:b="Cancel",confirmLabel:y="Submit",confirmPlaceholder:v,confirmString:w,alert:N,input:k,label:S,description:_,formMessage:C,text:E,children:A,blockDeleteButton:T=!0,variant:R="default",...L}=e,z=h.z.object({confirmValue:h.z.literal(w,{required_error:"Value entered does not match."})}),I=(0,i.cI)({resolver:(0,s.F)(z),defaultValues:{confirmValue:""}});return(0,r.useEffect)(()=>{w&&I.reset()},[w]),(0,a.jsx)(o.Vq,{open:f,...L,onOpenChange:()=>{f&&x()},children:(0,a.jsxs)(o.cZ,{ref:t,className:"p-0 gap-0 pb-5 !block",size:m,children:[(0,a.jsx)(o.fK,{className:(0,l.cn)("border-b"),padding:"small",children:(0,a.jsx)(o.$N,{className:"",children:n})}),N&&(0,a.jsx)(p.J,{type:R,label:N.title,description:N.description,className:"border-r-0 border-l-0 rounded-none -mt-px [&_svg]:ml-0.5 mb-0",...null==N?void 0:N.base}),A&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.VO,{padding:"small",children:A}),(0,a.jsx)(o.P3,{})]}),void 0!==E&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.VO,{className:"p-5",padding:"small",children:(0,a.jsx)("p",{className:"text-foreground-light text-sm",children:E})}),(0,a.jsx)(o.P3,{})]}),(0,a.jsx)(c.l0,{...I,children:(0,a.jsxs)("form",{onSubmit:I.handleSubmit(function(e){g()}),className:"px-5 flex flex-col gap-2 pt-3",children:[(0,a.jsx)(c.Wi,{control:I.control,name:"confirmValue",render:e=>{let{field:t}=e;return(0,a.jsxs)(c.xJ,{className:"flex flex-col gap-y-1",children:[(0,a.jsxs)(c.lX,{...S,children:["Type ",(0,a.jsx)("span",{className:"text-foreground break-all",children:w})," to confirm."]}),(0,a.jsx)(c.NI,{children:(0,a.jsx)(d.I,{placeholder:v,...k,...t})}),(0,a.jsx)(c.pf,{..._}),(0,a.jsx)(c.zG,{...C})]})}}),(0,a.jsxs)("div",{className:"flex gap-2",children:[!T&&(0,a.jsx)(u.z,{size:"medium",block:!0,type:"default",disabled:j,onClick:x,children:b}),(0,a.jsx)(u.z,{block:!0,size:"medium",type:"destructive"===R?"danger":"warning"===R?"warning":"primary",htmlType:"submit",loading:j,disabled:j,className:"truncate",children:y})]})]})})]})})});m.displayName="TextConfirmModal",t.Z=m},25733:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var a=n(52322),s=n(18209),r=n.n(s),i=()=>(0,a.jsx)("div",{className:"w-full h-full flex flex-col items-center justify-center",children:(0,a.jsx)("div",{children:(0,a.jsx)("svg",{width:"60",height:"62",viewBox:"0 0 60 62",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:r().loading,children:(0,a.jsx)("path",{d:"M30.2571 4.12811L30.257 4.12389C30.2133 1.21067 26.5349 -0.034778 24.7224 2.24311L1.76109 31.0996C-1.21104 34.8348 1.45637 40.34 6.23131 40.34H29.4845L29.7563 58.4432C29.8 61.3564 33.4783 62.6016 35.2908 60.324L34.8996 60.0127L35.2908 60.324L58.2521 31.4674C61.2241 27.7322 58.5568 22.227 53.782 22.227H30.3762L30.2571 4.12811Z",stroke:"hsl(var(--brand-default))",strokeWidth:2,strokeLinecap:"round"})})})})},79983:function(e,t,n){"use strict";n.d(t,{Dp:function(){return c},ee:function(){return l},pO:function(){return o}});var a=n(52322),s=n(62221),r=n(95641),i=n(54383);let o=e=>{let{className:t,...n}=e;return(0,a.jsx)(r.eh,{className:(0,i.cn)("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",t),...n})},l=r.s_,c=e=>{let{withHandle:t,className:n,...o}=e;return(0,a.jsx)(r.OT,{className:(0,i.cn)("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90","data-[resize-handle-state=drag]:bg-border-strong","group","transition-colors",n),...o,children:t&&(0,a.jsx)("div",{className:(0,i.cn)("z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border focus:bg-surface-400","opacity-0 transition-opacity duration-200","group-data-[resize-handle-state=hover]:opacity-100","hover:bg-surface-400","group-data-[resize-handle-state=drag]:opacity-100","group-data-[resize-handle-state=drag]:bg-foreground-muted"),children:(0,a.jsx)(s.Z,{className:"h-2.5 w-2.5"})})})}},95392:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var a=n(52322),s=n(4504),r=n(2784),i=n(54383);let o=r.forwardRef((e,t)=>{let{className:n,orientation:r="horizontal",decorative:o=!0,...l}=e;return(0,a.jsx)(s.f,{ref:t,decorative:o,orientation:r,className:(0,i.cn)("shrink-0 bg-border-muted","horizontal"===r?"h-[1px] w-full":"h-full w-[1px]",n),...l})});o.displayName=s.f.displayName},18209:function(e){e.exports={loading:"loading-anim_loading__rDN7u",dash:"loading-anim_dash__HIPR0"}}}]);
|