redwax-cli 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +90 -3
- package/dashboard/apple-touch-icon.png +0 -0
- package/dashboard/assets/data-DnUM1Mpn.js +17 -0
- package/dashboard/assets/index-Cb3ZdSPZ.js +191 -0
- package/dashboard/assets/index-GSeTo6vS.css +1 -0
- package/dashboard/assets/radix-Cu8wEyce.js +41 -0
- package/dashboard/assets/react-Cnjii2my.js +59 -0
- package/dashboard/favicon.svg +12 -0
- package/dashboard/index.html +37 -0
- package/package.json +68 -6
- package/scripts/bundle.cjs +56 -0
- package/server/package.json +5 -0
- package/server/src/app.js +141 -0
- package/server/src/config/env.js +102 -0
- package/server/src/config/keys.js +81 -0
- package/server/src/config/metrics.js +161 -0
- package/server/src/config/openapi.js +507 -0
- package/server/src/controllers/auth.controller.js +115 -0
- package/server/src/controllers/project.controller.js +154 -0
- package/server/src/controllers/secret.controller.js +138 -0
- package/server/src/domain.js +49 -0
- package/server/src/middleware/auth.middleware.js +26 -0
- package/server/src/middleware/rateLimit.middleware.js +49 -0
- package/server/src/middleware/rbac.middleware.js +47 -0
- package/server/src/middleware/validate.middleware.js +35 -0
- package/server/src/models/AuditLog.model.js +32 -0
- package/server/src/models/Project.model.js +33 -0
- package/server/src/models/Secret.model.js +30 -0
- package/server/src/models/SecretVersion.model.js +25 -0
- package/server/src/models/User.model.js +31 -0
- package/server/src/routes/auth.routes.js +15 -0
- package/server/src/routes/project.routes.js +45 -0
- package/server/src/routes/secret.routes.js +44 -0
- package/server/src/services/audit.service.js +65 -0
- package/server/src/services/auth.service.js +130 -0
- package/server/src/services/crypto.service.js +73 -0
- package/server/src/services/project.service.js +178 -0
- package/server/src/services/secret.service.js +198 -0
- package/server/src/start.js +49 -0
- package/server/src/store/index.js +60 -0
- package/server/src/store/mongo.js +336 -0
- package/server/src/store/sqlite.js +538 -0
- package/server/src/store/sqliteRuntime.js +64 -0
- package/server/src/utils/apiError.js +10 -0
- package/server/src/utils/asyncHandler.js +8 -0
- package/server/src/utils/logger.js +20 -0
- package/server/src/utils/requestContext.js +19 -0
- package/src/commands/diff.js +64 -0
- package/src/commands/history.js +56 -0
- package/src/commands/init.js +59 -0
- package/src/commands/login.js +53 -0
- package/src/commands/logout.js +30 -0
- package/src/commands/pull.js +82 -0
- package/src/commands/push.js +76 -0
- package/src/commands/server.js +313 -0
- package/src/commands/whoami.js +26 -0
- package/src/index.js +52 -0
- package/src/lib/api.js +137 -0
- package/src/lib/config.js +36 -0
- package/src/lib/credentials.js +43 -0
- package/src/lib/dotenv.js +88 -0
- package/src/lib/prompt.js +50 -0
- package/src/lib/runtime.js +88 -0
- package/src/lib/ui.js +68 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import{a as $r,u as Xt,j as e,b as rt,c as Qt,Q as Or,d as Br}from"./data-DnUM1Mpn.js";import{c as _r,g as Vr,d as b,a as p,v as Fr,u as Bs,N as et,e as wt,L as Ue,f as Ur,h as vt,i as Zt,j as qr,k as Hr,l as de,B as Wr}from"./react-Cnjii2my.js";import{S as Gr,R as _s,P as Yr,C as Vs,I as Fs,a as Us,b as Kr,L as qs,c as Hs,d as Xr,T as Qr,D as Ws,e as Zr,f as Jt,g as Gs,h as Ys,i as Ks,j as Jr,k as ea,l as ta,O as sa,m as ra,n as aa,o as na,p as oa,q as Xs,r as ia,s as la,t as Qs,u as ca,v as Zs,w as da,x as ua,y as Js,z as er,A as ma,B as ha}from"./radix-Cu8wEyce.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))a(n);new MutationObserver(n=>{for(const o of n)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&a(l)}).observe(document,{childList:!0,subtree:!0});function r(n){const o={};return n.integrity&&(o.integrity=n.integrity),n.referrerPolicy&&(o.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?o.credentials="include":n.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function a(n){if(n.ep)return;n.ep=!0;const o=r(n);fetch(n.href,o)}})();var ft={},ws;function pa(){if(ws)return ft;ws=1;var t=_r();return ft.createRoot=t.createRoot,ft.hydrateRoot=t.hydrateRoot,ft}var fa=pa();const xa=Vr(fa);var ga=t=>{switch(t){case"success":return va;case"info":return wa;case"warning":return ja;case"error":return Na;default:return null}},ba=Array(12).fill(0),ya=({visible:t,className:s})=>b.createElement("div",{className:["sonner-loading-wrapper",s].filter(Boolean).join(" "),"data-visible":t},b.createElement("div",{className:"sonner-spinner"},ba.map((r,a)=>b.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${a}`})))),va=b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},b.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),ja=b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},b.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),wa=b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},b.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),Na=b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},b.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),ka=b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},b.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),b.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Ca=()=>{let[t,s]=b.useState(document.hidden);return b.useEffect(()=>{let r=()=>{s(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),t},Gt=1,Ea=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let s=this.subscribers.indexOf(t);this.subscribers.splice(s,1)}),this.publish=t=>{this.subscribers.forEach(s=>s(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var s;let{message:r,...a}=t,n=typeof(t==null?void 0:t.id)=="number"||((s=t.id)==null?void 0:s.length)>0?t.id:Gt++,o=this.toasts.find(i=>i.id===n),l=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(n)&&this.dismissedToasts.delete(n),o?this.toasts=this.toasts.map(i=>i.id===n?(this.publish({...i,...t,id:n,title:r}),{...i,...t,id:n,dismissible:l,title:r}):i):this.addToast({title:r,...a,dismissible:l,id:n}),n},this.dismiss=t=>(this.dismissedToasts.add(t),t||this.toasts.forEach(s=>{this.subscribers.forEach(r=>r({id:s.id,dismiss:!0}))}),this.subscribers.forEach(s=>s({id:t,dismiss:!0})),t),this.message=(t,s)=>this.create({...s,message:t}),this.error=(t,s)=>this.create({...s,message:t,type:"error"}),this.success=(t,s)=>this.create({...s,type:"success",message:t}),this.info=(t,s)=>this.create({...s,type:"info",message:t}),this.warning=(t,s)=>this.create({...s,type:"warning",message:t}),this.loading=(t,s)=>this.create({...s,type:"loading",message:t}),this.promise=(t,s)=>{if(!s)return;let r;s.loading!==void 0&&(r=this.create({...s,promise:t,type:"loading",message:s.loading,description:typeof s.description!="function"?s.description:void 0}));let a=t instanceof Promise?t:t(),n=r!==void 0,o,l=a.then(async d=>{if(o=["resolve",d],b.isValidElement(d))n=!1,this.create({id:r,type:"default",message:d});else if(Ra(d)&&!d.ok){n=!1;let u=typeof s.error=="function"?await s.error(`HTTP error! status: ${d.status}`):s.error,h=typeof s.description=="function"?await s.description(`HTTP error! status: ${d.status}`):s.description;this.create({id:r,type:"error",message:u,description:h})}else if(s.success!==void 0){n=!1;let u=typeof s.success=="function"?await s.success(d):s.success,h=typeof s.description=="function"?await s.description(d):s.description;this.create({id:r,type:"success",message:u,description:h})}}).catch(async d=>{if(o=["reject",d],s.error!==void 0){n=!1;let u=typeof s.error=="function"?await s.error(d):s.error,h=typeof s.description=="function"?await s.description(d):s.description;this.create({id:r,type:"error",message:u,description:h})}}).finally(()=>{var d;n&&(this.dismiss(r),r=void 0),(d=s.finally)==null||d.call(s)}),i=()=>new Promise((d,u)=>l.then(()=>o[0]==="reject"?u(o[1]):d(o[1])).catch(u));return typeof r!="string"&&typeof r!="number"?{unwrap:i}:Object.assign(r,{unwrap:i})},this.custom=(t,s)=>{let r=(s==null?void 0:s.id)||Gt++;return this.create({jsx:t(r),id:r,...s}),r},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},G=new Ea,Sa=(t,s)=>{let r=(s==null?void 0:s.id)||Gt++;return G.addToast({title:t,...s,id:r}),r},Ra=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",Aa=Sa,Ma=()=>G.toasts,Ta=()=>G.getActiveToasts(),oe=Object.assign(Aa,{success:G.success,info:G.info,warning:G.warning,error:G.error,custom:G.custom,message:G.message,promise:G.promise,dismiss:G.dismiss,loading:G.loading},{getHistory:Ma,getToasts:Ta});function La(t,{insertAt:s}={}){if(typeof document>"u")return;let r=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css",s==="top"&&r.firstChild?r.insertBefore(a,r.firstChild):r.appendChild(a),a.styleSheet?a.styleSheet.cssText=t:a.appendChild(document.createTextNode(t))}La(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
|
|
2
|
+
`);function xt(t){return t.label!==void 0}var Ia=3,za="32px",Pa="16px",Ns=4e3,Da=356,$a=14,Oa=20,Ba=200;function ne(...t){return t.filter(Boolean).join(" ")}function _a(t){let[s,r]=t.split("-"),a=[];return s&&a.push(s),r&&a.push(r),a}var Va=t=>{var s,r,a,n,o,l,i,d,u,h,f;let{invert:y,toast:c,unstyled:v,interacting:x,setHeights:g,visibleToasts:m,heights:E,index:w,toasts:z,expanded:M,removeToast:_,defaultRichColors:pe,closeButton:ke,style:fe,cancelButtonStyle:Ce,actionButtonStyle:xe,className:S="",descriptionClassName:Ee="",duration:te,position:Se,gap:Q,loadingIcon:Z,expandByDefault:ge,classNames:C,icons:F,closeButtonAriaLabel:X="Close toast",pauseWhenPageIsHidden:I}=t,[P,B]=b.useState(null),[W,Oe]=b.useState(null),[V,Pt]=b.useState(!1),[Ge,ht]=b.useState(!1),[Ye,Dt]=b.useState(!1),[ps,kr]=b.useState(!1),[Cr,fs]=b.useState(!1),[Er,$t]=b.useState(0),[Sr,xs]=b.useState(0),Ke=b.useRef(c.duration||te||Ns),gs=b.useRef(null),Re=b.useRef(null),Rr=w===0,Ar=w+1<=m,J=c.type,Be=c.dismissible!==!1,Mr=c.className||"",Tr=c.descriptionClassName||"",pt=b.useMemo(()=>E.findIndex(N=>N.toastId===c.id)||0,[E,c.id]),Lr=b.useMemo(()=>{var N;return(N=c.closeButton)!=null?N:ke},[c.closeButton,ke]),bs=b.useMemo(()=>c.duration||te||Ns,[c.duration,te]),Ot=b.useRef(0),_e=b.useRef(0),ys=b.useRef(0),Ve=b.useRef(null),[Ir,zr]=Se.split("-"),vs=b.useMemo(()=>E.reduce((N,T,O)=>O>=pt?N:N+T.height,0),[E,pt]),js=Ca(),Pr=c.invert||y,Bt=J==="loading";_e.current=b.useMemo(()=>pt*Q+vs,[pt,vs]),b.useEffect(()=>{Ke.current=bs},[bs]),b.useEffect(()=>{Pt(!0)},[]),b.useEffect(()=>{let N=Re.current;if(N){let T=N.getBoundingClientRect().height;return xs(T),g(O=>[{toastId:c.id,height:T,position:c.position},...O]),()=>g(O=>O.filter(se=>se.toastId!==c.id))}},[g,c.id]),b.useLayoutEffect(()=>{if(!V)return;let N=Re.current,T=N.style.height;N.style.height="auto";let O=N.getBoundingClientRect().height;N.style.height=T,xs(O),g(se=>se.find(re=>re.toastId===c.id)?se.map(re=>re.toastId===c.id?{...re,height:O}:re):[{toastId:c.id,height:O,position:c.position},...se])},[V,c.title,c.description,g,c.id]);let be=b.useCallback(()=>{ht(!0),$t(_e.current),g(N=>N.filter(T=>T.toastId!==c.id)),setTimeout(()=>{_(c)},Ba)},[c,_,g,_e]);b.useEffect(()=>{if(c.promise&&J==="loading"||c.duration===1/0||c.type==="loading")return;let N;return M||x||I&&js?(()=>{if(ys.current<Ot.current){let T=new Date().getTime()-Ot.current;Ke.current=Ke.current-T}ys.current=new Date().getTime()})():Ke.current!==1/0&&(Ot.current=new Date().getTime(),N=setTimeout(()=>{var T;(T=c.onAutoClose)==null||T.call(c,c),be()},Ke.current)),()=>clearTimeout(N)},[M,x,c,J,I,js,be]),b.useEffect(()=>{c.delete&&be()},[be,c.delete]);function Dr(){var N,T,O;return F!=null&&F.loading?b.createElement("div",{className:ne(C==null?void 0:C.loader,(N=c==null?void 0:c.classNames)==null?void 0:N.loader,"sonner-loader"),"data-visible":J==="loading"},F.loading):Z?b.createElement("div",{className:ne(C==null?void 0:C.loader,(T=c==null?void 0:c.classNames)==null?void 0:T.loader,"sonner-loader"),"data-visible":J==="loading"},Z):b.createElement(ya,{className:ne(C==null?void 0:C.loader,(O=c==null?void 0:c.classNames)==null?void 0:O.loader),visible:J==="loading"})}return b.createElement("li",{tabIndex:0,ref:Re,className:ne(S,Mr,C==null?void 0:C.toast,(s=c==null?void 0:c.classNames)==null?void 0:s.toast,C==null?void 0:C.default,C==null?void 0:C[J],(r=c==null?void 0:c.classNames)==null?void 0:r[J]),"data-sonner-toast":"","data-rich-colors":(a=c.richColors)!=null?a:pe,"data-styled":!(c.jsx||c.unstyled||v),"data-mounted":V,"data-promise":!!c.promise,"data-swiped":Cr,"data-removed":Ge,"data-visible":Ar,"data-y-position":Ir,"data-x-position":zr,"data-index":w,"data-front":Rr,"data-swiping":Ye,"data-dismissible":Be,"data-type":J,"data-invert":Pr,"data-swipe-out":ps,"data-swipe-direction":W,"data-expanded":!!(M||ge&&V),style:{"--index":w,"--toasts-before":w,"--z-index":z.length-w,"--offset":`${Ge?Er:_e.current}px`,"--initial-height":ge?"auto":`${Sr}px`,...fe,...c.style},onDragEnd:()=>{Dt(!1),B(null),Ve.current=null},onPointerDown:N=>{Bt||!Be||(gs.current=new Date,$t(_e.current),N.target.setPointerCapture(N.pointerId),N.target.tagName!=="BUTTON"&&(Dt(!0),Ve.current={x:N.clientX,y:N.clientY}))},onPointerUp:()=>{var N,T,O,se;if(ps||!Be)return;Ve.current=null;let re=Number(((N=Re.current)==null?void 0:N.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),ye=Number(((T=Re.current)==null?void 0:T.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Ae=new Date().getTime()-((O=gs.current)==null?void 0:O.getTime()),ae=P==="x"?re:ye,ve=Math.abs(ae)/Ae;if(Math.abs(ae)>=Oa||ve>.11){$t(_e.current),(se=c.onDismiss)==null||se.call(c,c),Oe(P==="x"?re>0?"right":"left":ye>0?"down":"up"),be(),kr(!0),fs(!1);return}Dt(!1),B(null)},onPointerMove:N=>{var T,O,se,re;if(!Ve.current||!Be||((T=window.getSelection())==null?void 0:T.toString().length)>0)return;let ye=N.clientY-Ve.current.y,Ae=N.clientX-Ve.current.x,ae=(O=t.swipeDirections)!=null?O:_a(Se);!P&&(Math.abs(Ae)>1||Math.abs(ye)>1)&&B(Math.abs(Ae)>Math.abs(ye)?"x":"y");let ve={x:0,y:0};P==="y"?(ae.includes("top")||ae.includes("bottom"))&&(ae.includes("top")&&ye<0||ae.includes("bottom")&&ye>0)&&(ve.y=ye):P==="x"&&(ae.includes("left")||ae.includes("right"))&&(ae.includes("left")&&Ae<0||ae.includes("right")&&Ae>0)&&(ve.x=Ae),(Math.abs(ve.x)>0||Math.abs(ve.y)>0)&&fs(!0),(se=Re.current)==null||se.style.setProperty("--swipe-amount-x",`${ve.x}px`),(re=Re.current)==null||re.style.setProperty("--swipe-amount-y",`${ve.y}px`)}},Lr&&!c.jsx?b.createElement("button",{"aria-label":X,"data-disabled":Bt,"data-close-button":!0,onClick:Bt||!Be?()=>{}:()=>{var N;be(),(N=c.onDismiss)==null||N.call(c,c)},className:ne(C==null?void 0:C.closeButton,(n=c==null?void 0:c.classNames)==null?void 0:n.closeButton)},(o=F==null?void 0:F.close)!=null?o:ka):null,c.jsx||p.isValidElement(c.title)?c.jsx?c.jsx:typeof c.title=="function"?c.title():c.title:b.createElement(b.Fragment,null,J||c.icon||c.promise?b.createElement("div",{"data-icon":"",className:ne(C==null?void 0:C.icon,(l=c==null?void 0:c.classNames)==null?void 0:l.icon)},c.promise||c.type==="loading"&&!c.icon?c.icon||Dr():null,c.type!=="loading"?c.icon||(F==null?void 0:F[J])||ga(J):null):null,b.createElement("div",{"data-content":"",className:ne(C==null?void 0:C.content,(i=c==null?void 0:c.classNames)==null?void 0:i.content)},b.createElement("div",{"data-title":"",className:ne(C==null?void 0:C.title,(d=c==null?void 0:c.classNames)==null?void 0:d.title)},typeof c.title=="function"?c.title():c.title),c.description?b.createElement("div",{"data-description":"",className:ne(Ee,Tr,C==null?void 0:C.description,(u=c==null?void 0:c.classNames)==null?void 0:u.description)},typeof c.description=="function"?c.description():c.description):null),p.isValidElement(c.cancel)?c.cancel:c.cancel&&xt(c.cancel)?b.createElement("button",{"data-button":!0,"data-cancel":!0,style:c.cancelButtonStyle||Ce,onClick:N=>{var T,O;xt(c.cancel)&&Be&&((O=(T=c.cancel).onClick)==null||O.call(T,N),be())},className:ne(C==null?void 0:C.cancelButton,(h=c==null?void 0:c.classNames)==null?void 0:h.cancelButton)},c.cancel.label):null,p.isValidElement(c.action)?c.action:c.action&&xt(c.action)?b.createElement("button",{"data-button":!0,"data-action":!0,style:c.actionButtonStyle||xe,onClick:N=>{var T,O;xt(c.action)&&((O=(T=c.action).onClick)==null||O.call(T,N),!N.defaultPrevented&&be())},className:ne(C==null?void 0:C.actionButton,(f=c==null?void 0:c.classNames)==null?void 0:f.actionButton)},c.action.label):null))};function ks(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function Fa(t,s){let r={};return[t,s].forEach((a,n)=>{let o=n===1,l=o?"--mobile-offset":"--offset",i=o?Pa:za;function d(u){["top","right","bottom","left"].forEach(h=>{r[`${l}-${h}`]=typeof u=="number"?`${u}px`:u})}typeof a=="number"||typeof a=="string"?d(a):typeof a=="object"?["top","right","bottom","left"].forEach(u=>{a[u]===void 0?r[`${l}-${u}`]=i:r[`${l}-${u}`]=typeof a[u]=="number"?`${a[u]}px`:a[u]}):d(i)}),r}var Ua=p.forwardRef(function(t,s){let{invert:r,position:a="bottom-right",hotkey:n=["altKey","KeyT"],expand:o,closeButton:l,className:i,offset:d,mobileOffset:u,theme:h="light",richColors:f,duration:y,style:c,visibleToasts:v=Ia,toastOptions:x,dir:g=ks(),gap:m=$a,loadingIcon:E,icons:w,containerAriaLabel:z="Notifications",pauseWhenPageIsHidden:M}=t,[_,pe]=b.useState([]),ke=b.useMemo(()=>Array.from(new Set([a].concat(_.filter(I=>I.position).map(I=>I.position)))),[_,a]),[fe,Ce]=b.useState([]),[xe,S]=b.useState(!1),[Ee,te]=b.useState(!1),[Se,Q]=b.useState(h!=="system"?h:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Z=b.useRef(null),ge=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),C=b.useRef(null),F=b.useRef(!1),X=b.useCallback(I=>{pe(P=>{var B;return(B=P.find(W=>W.id===I.id))!=null&&B.delete||G.dismiss(I.id),P.filter(({id:W})=>W!==I.id)})},[]);return b.useEffect(()=>G.subscribe(I=>{if(I.dismiss){pe(P=>P.map(B=>B.id===I.id?{...B,delete:!0}:B));return}setTimeout(()=>{Fr.flushSync(()=>{pe(P=>{let B=P.findIndex(W=>W.id===I.id);return B!==-1?[...P.slice(0,B),{...P[B],...I},...P.slice(B+1)]:[I,...P]})})})}),[]),b.useEffect(()=>{if(h!=="system"){Q(h);return}if(h==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?Q("dark"):Q("light")),typeof window>"u")return;let I=window.matchMedia("(prefers-color-scheme: dark)");try{I.addEventListener("change",({matches:P})=>{Q(P?"dark":"light")})}catch{I.addListener(({matches:B})=>{try{Q(B?"dark":"light")}catch(W){console.error(W)}})}},[h]),b.useEffect(()=>{_.length<=1&&S(!1)},[_]),b.useEffect(()=>{let I=P=>{var B,W;n.every(Oe=>P[Oe]||P.code===Oe)&&(S(!0),(B=Z.current)==null||B.focus()),P.code==="Escape"&&(document.activeElement===Z.current||(W=Z.current)!=null&&W.contains(document.activeElement))&&S(!1)};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[n]),b.useEffect(()=>{if(Z.current)return()=>{C.current&&(C.current.focus({preventScroll:!0}),C.current=null,F.current=!1)}},[Z.current]),b.createElement("section",{ref:s,"aria-label":`${z} ${ge}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},ke.map((I,P)=>{var B;let[W,Oe]=I.split("-");return _.length?b.createElement("ol",{key:I,dir:g==="auto"?ks():g,tabIndex:-1,ref:Z,className:i,"data-sonner-toaster":!0,"data-theme":Se,"data-y-position":W,"data-lifted":xe&&_.length>1&&!o,"data-x-position":Oe,style:{"--front-toast-height":`${((B=fe[0])==null?void 0:B.height)||0}px`,"--width":`${Da}px`,"--gap":`${m}px`,...c,...Fa(d,u)},onBlur:V=>{F.current&&!V.currentTarget.contains(V.relatedTarget)&&(F.current=!1,C.current&&(C.current.focus({preventScroll:!0}),C.current=null))},onFocus:V=>{V.target instanceof HTMLElement&&V.target.dataset.dismissible==="false"||F.current||(F.current=!0,C.current=V.relatedTarget)},onMouseEnter:()=>S(!0),onMouseMove:()=>S(!0),onMouseLeave:()=>{Ee||S(!1)},onDragEnd:()=>S(!1),onPointerDown:V=>{V.target instanceof HTMLElement&&V.target.dataset.dismissible==="false"||te(!0)},onPointerUp:()=>te(!1)},_.filter(V=>!V.position&&P===0||V.position===I).map((V,Pt)=>{var Ge,ht;return b.createElement(Va,{key:V.id,icons:w,index:Pt,toast:V,defaultRichColors:f,duration:(Ge=x==null?void 0:x.duration)!=null?Ge:y,className:x==null?void 0:x.className,descriptionClassName:x==null?void 0:x.descriptionClassName,invert:r,visibleToasts:v,closeButton:(ht=x==null?void 0:x.closeButton)!=null?ht:l,interacting:Ee,position:I,style:x==null?void 0:x.style,unstyled:x==null?void 0:x.unstyled,classNames:x==null?void 0:x.classNames,cancelButtonStyle:x==null?void 0:x.cancelButtonStyle,actionButtonStyle:x==null?void 0:x.actionButtonStyle,removeToast:X,toasts:_.filter(Ye=>Ye.position==V.position),heights:fe.filter(Ye=>Ye.position==V.position),setHeights:Ce,expandByDefault:o,gap:m,loadingIcon:E,expanded:xe,pauseWhenPageIsHidden:M,swipeDirections:t.swipeDirections})})):null}))});const L=$r.create({baseURL:"/api/v1",withCredentials:!0});let jt=sessionStorage.getItem("redwax.accessToken")||null;function Me(t){jt=t,t?sessionStorage.setItem("redwax.accessToken",t):sessionStorage.removeItem("redwax.accessToken")}const qa=()=>jt;let tr=()=>{};function Cs(t){tr=t}L.interceptors.request.use(t=>(jt&&(t.headers.Authorization=`Bearer ${jt}`),t));let gt=null;L.interceptors.response.use(t=>t,async t=>{var a,n,o,l;const s=t.config,r=((a=s==null?void 0:s.url)==null?void 0:a.includes("/auth/login"))||((n=s==null?void 0:s.url)==null?void 0:n.includes("/auth/register"))||((o=s==null?void 0:s.url)==null?void 0:o.includes("/auth/refresh"));if(((l=t.response)==null?void 0:l.status)!==401||s!=null&&s._retry||r)return Promise.reject(t);s._retry=!0;try{gt=gt||L.post("/auth/refresh").finally(()=>{gt=null});const{data:i}=await gt;return Me(i.accessToken),s.headers.Authorization=`Bearer ${i.accessToken}`,L(s)}catch(i){return Me(null),tr(),Promise.reject(i)}});const Xe={register:t=>L.post("/auth/register",t).then(s=>s.data),login:t=>L.post("/auth/login",t).then(s=>s.data),logout:()=>L.post("/auth/logout").then(t=>t.data),refresh:()=>L.post("/auth/refresh").then(t=>t.data),me:()=>L.get("/auth/me").then(t=>t.data.user)},sr=p.createContext(null);function Ha({children:t}){const[s,r]=p.useState(null),[a,n]=p.useState("loading"),o=Xt(),l=p.useCallback(()=>{Me(null),r(null),n("anonymous"),o.clear()},[o]);p.useEffect(()=>{let f=!1;return(async()=>{try{if(!qa()){const{accessToken:c}=await Xe.refresh();Me(c)}const y=await Xe.me();f||(r(y),n("authenticated"))}catch{f||(Me(null),n("anonymous"))}})(),()=>{f=!0}},[]),p.useEffect(()=>(Cs(l),()=>Cs(()=>{})),[l]);const i=p.useCallback(async f=>{const y=await Xe.login(f);return Me(y.accessToken),r(y.user),n("authenticated"),y.user},[]),d=p.useCallback(async f=>{const y=await Xe.register(f);return Me(y.accessToken),r(y.user),n("authenticated"),y.user},[]),u=p.useCallback(async()=>{try{await Xe.logout()}finally{l()}},[l]),h=p.useMemo(()=>({user:s,status:a,isAuthenticated:a==="authenticated",isLoading:a==="loading",login:i,register:d,logout:u}),[s,a,i,d,u]);return e.jsx(sr.Provider,{value:h,children:t})}function at(){const t=p.useContext(sr);if(!t)throw new Error("useAuth must be used inside an AuthProvider");return t}/**
|
|
3
|
+
* @license lucide-react v0.469.0 - ISC
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the ISC license.
|
|
6
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/const Wa=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),rr=(...t)=>t.filter((s,r,a)=>!!s&&s.trim()!==""&&a.indexOf(s)===r).join(" ").trim();/**
|
|
8
|
+
* @license lucide-react v0.469.0 - ISC
|
|
9
|
+
*
|
|
10
|
+
* This source code is licensed under the ISC license.
|
|
11
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
12
|
+
*/var Ga={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
13
|
+
* @license lucide-react v0.469.0 - ISC
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the ISC license.
|
|
16
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/const Ya=p.forwardRef(({color:t="currentColor",size:s=24,strokeWidth:r=2,absoluteStrokeWidth:a,className:n="",children:o,iconNode:l,...i},d)=>p.createElement("svg",{ref:d,...Ga,width:s,height:s,stroke:t,strokeWidth:a?Number(r)*24/Number(s):r,className:rr("lucide",n),...i},[...l.map(([u,h])=>p.createElement(u,h)),...Array.isArray(o)?o:[o]]));/**
|
|
18
|
+
* @license lucide-react v0.469.0 - ISC
|
|
19
|
+
*
|
|
20
|
+
* This source code is licensed under the ISC license.
|
|
21
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
22
|
+
*/const A=(t,s)=>{const r=p.forwardRef(({className:a,...n},o)=>p.createElement(Ya,{ref:o,iconNode:s,className:rr(`lucide-${Wa(t)}`,a),...n}));return r.displayName=`${t}`,r};/**
|
|
23
|
+
* @license lucide-react v0.469.0 - ISC
|
|
24
|
+
*
|
|
25
|
+
* This source code is licensed under the ISC license.
|
|
26
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
27
|
+
*/const Ka=A("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/**
|
|
28
|
+
* @license lucide-react v0.469.0 - ISC
|
|
29
|
+
*
|
|
30
|
+
* This source code is licensed under the ISC license.
|
|
31
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
32
|
+
*/const es=A("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
33
|
+
* @license lucide-react v0.469.0 - ISC
|
|
34
|
+
*
|
|
35
|
+
* This source code is licensed under the ISC license.
|
|
36
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
37
|
+
*/const Xa=A("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
38
|
+
* @license lucide-react v0.469.0 - ISC
|
|
39
|
+
*
|
|
40
|
+
* This source code is licensed under the ISC license.
|
|
41
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
42
|
+
*/const Qa=A("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
43
|
+
* @license lucide-react v0.469.0 - ISC
|
|
44
|
+
*
|
|
45
|
+
* This source code is licensed under the ISC license.
|
|
46
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
47
|
+
*/const Es=A("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
|
|
48
|
+
* @license lucide-react v0.469.0 - ISC
|
|
49
|
+
*
|
|
50
|
+
* This source code is licensed under the ISC license.
|
|
51
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
52
|
+
*/const Za=A("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
|
|
53
|
+
* @license lucide-react v0.469.0 - ISC
|
|
54
|
+
*
|
|
55
|
+
* This source code is licensed under the ISC license.
|
|
56
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
57
|
+
*/const Ja=A("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
|
|
58
|
+
* @license lucide-react v0.469.0 - ISC
|
|
59
|
+
*
|
|
60
|
+
* This source code is licensed under the ISC license.
|
|
61
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
62
|
+
*/const en=A("Crown",[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/**
|
|
63
|
+
* @license lucide-react v0.469.0 - ISC
|
|
64
|
+
*
|
|
65
|
+
* This source code is licensed under the ISC license.
|
|
66
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
67
|
+
*/const ar=A("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
|
|
68
|
+
* @license lucide-react v0.469.0 - ISC
|
|
69
|
+
*
|
|
70
|
+
* This source code is licensed under the ISC license.
|
|
71
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
72
|
+
*/const nr=A("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/**
|
|
73
|
+
* @license lucide-react v0.469.0 - ISC
|
|
74
|
+
*
|
|
75
|
+
* This source code is licensed under the ISC license.
|
|
76
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
77
|
+
*/const tn=A("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
|
|
78
|
+
* @license lucide-react v0.469.0 - ISC
|
|
79
|
+
*
|
|
80
|
+
* This source code is licensed under the ISC license.
|
|
81
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
82
|
+
*/const sn=A("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
|
|
83
|
+
* @license lucide-react v0.469.0 - ISC
|
|
84
|
+
*
|
|
85
|
+
* This source code is licensed under the ISC license.
|
|
86
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
87
|
+
*/const rn=A("FileUp",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]]);/**
|
|
88
|
+
* @license lucide-react v0.469.0 - ISC
|
|
89
|
+
*
|
|
90
|
+
* This source code is licensed under the ISC license.
|
|
91
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
92
|
+
*/const or=A("FolderGit2",[["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["path",{d:"M18 19c-2.8 0-5-2.2-5-5v8",key:"pkpw2h"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]);/**
|
|
93
|
+
* @license lucide-react v0.469.0 - ISC
|
|
94
|
+
*
|
|
95
|
+
* This source code is licensed under the ISC license.
|
|
96
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
97
|
+
*/const ir=A("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/**
|
|
98
|
+
* @license lucide-react v0.469.0 - ISC
|
|
99
|
+
*
|
|
100
|
+
* This source code is licensed under the ISC license.
|
|
101
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
102
|
+
*/const an=A("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
|
|
103
|
+
* @license lucide-react v0.469.0 - ISC
|
|
104
|
+
*
|
|
105
|
+
* This source code is licensed under the ISC license.
|
|
106
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
107
|
+
*/const lr=A("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/**
|
|
108
|
+
* @license lucide-react v0.469.0 - ISC
|
|
109
|
+
*
|
|
110
|
+
* This source code is licensed under the ISC license.
|
|
111
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
112
|
+
*/const Nt=A("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
113
|
+
* @license lucide-react v0.469.0 - ISC
|
|
114
|
+
*
|
|
115
|
+
* This source code is licensed under the ISC license.
|
|
116
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
117
|
+
*/const nn=A("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
|
|
118
|
+
* @license lucide-react v0.469.0 - ISC
|
|
119
|
+
*
|
|
120
|
+
* This source code is licensed under the ISC license.
|
|
121
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
122
|
+
*/const on=A("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
|
|
123
|
+
* @license lucide-react v0.469.0 - ISC
|
|
124
|
+
*
|
|
125
|
+
* This source code is licensed under the ISC license.
|
|
126
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
127
|
+
*/const ln=A("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
|
|
128
|
+
* @license lucide-react v0.469.0 - ISC
|
|
129
|
+
*
|
|
130
|
+
* This source code is licensed under the ISC license.
|
|
131
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
132
|
+
*/const cn=A("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
|
|
133
|
+
* @license lucide-react v0.469.0 - ISC
|
|
134
|
+
*
|
|
135
|
+
* This source code is licensed under the ISC license.
|
|
136
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
137
|
+
*/const ts=A("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
138
|
+
* @license lucide-react v0.469.0 - ISC
|
|
139
|
+
*
|
|
140
|
+
* This source code is licensed under the ISC license.
|
|
141
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
142
|
+
*/const dn=A("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
|
|
143
|
+
* @license lucide-react v0.469.0 - ISC
|
|
144
|
+
*
|
|
145
|
+
* This source code is licensed under the ISC license.
|
|
146
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
147
|
+
*/const cr=A("ScrollText",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/**
|
|
148
|
+
* @license lucide-react v0.469.0 - ISC
|
|
149
|
+
*
|
|
150
|
+
* This source code is licensed under the ISC license.
|
|
151
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
152
|
+
*/const un=A("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
153
|
+
* @license lucide-react v0.469.0 - ISC
|
|
154
|
+
*
|
|
155
|
+
* This source code is licensed under the ISC license.
|
|
156
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
157
|
+
*/const mn=A("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/**
|
|
158
|
+
* @license lucide-react v0.469.0 - ISC
|
|
159
|
+
*
|
|
160
|
+
* This source code is licensed under the ISC license.
|
|
161
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
162
|
+
*/const hn=A("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
|
|
163
|
+
* @license lucide-react v0.469.0 - ISC
|
|
164
|
+
*
|
|
165
|
+
* This source code is licensed under the ISC license.
|
|
166
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
167
|
+
*/const ss=A("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
|
|
168
|
+
* @license lucide-react v0.469.0 - ISC
|
|
169
|
+
*
|
|
170
|
+
* This source code is licensed under the ISC license.
|
|
171
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
172
|
+
*/const pn=A("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
|
|
173
|
+
* @license lucide-react v0.469.0 - ISC
|
|
174
|
+
*
|
|
175
|
+
* This source code is licensed under the ISC license.
|
|
176
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
177
|
+
*/const fn=A("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/**
|
|
178
|
+
* @license lucide-react v0.469.0 - ISC
|
|
179
|
+
*
|
|
180
|
+
* This source code is licensed under the ISC license.
|
|
181
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
182
|
+
*/const xn=A("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
|
|
183
|
+
* @license lucide-react v0.469.0 - ISC
|
|
184
|
+
*
|
|
185
|
+
* This source code is licensed under the ISC license.
|
|
186
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
187
|
+
*/const kt=A("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function gn({children:t}){const{isAuthenticated:s,isLoading:r}=at(),a=Bs();return r?e.jsxs("div",{className:"flex min-h-screen items-center justify-center",role:"status","aria-live":"polite",children:[e.jsx(Nt,{className:"h-6 w-6 animate-spin text-muted-foreground","aria-hidden":"true"}),e.jsx("span",{className:"sr-only",children:"Checking your session…"})]}):s?t:e.jsx(et,{to:"/login",state:{from:a},replace:!0})}function dr(t){var s,r,a="";if(typeof t=="string"||typeof t=="number")a+=t;else if(typeof t=="object")if(Array.isArray(t)){var n=t.length;for(s=0;s<n;s++)t[s]&&(r=dr(t[s]))&&(a&&(a+=" "),a+=r)}else for(r in t)t[r]&&(a&&(a+=" "),a+=r);return a}function ur(){for(var t,s,r=0,a="",n=arguments.length;r<n;r++)(t=arguments[r])&&(s=dr(t))&&(a&&(a+=" "),a+=s);return a}const Ss=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,Rs=ur,mr=(t,s)=>r=>{var a;if((s==null?void 0:s.variants)==null)return Rs(t,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:n,defaultVariants:o}=s,l=Object.keys(n).map(u=>{const h=r==null?void 0:r[u],f=o==null?void 0:o[u];if(h===null)return null;const y=Ss(h)||Ss(f);return n[u][y]}),i=r&&Object.entries(r).reduce((u,h)=>{let[f,y]=h;return y===void 0||(u[f]=y),u},{}),d=s==null||(a=s.compoundVariants)===null||a===void 0?void 0:a.reduce((u,h)=>{let{class:f,className:y,...c}=h;return Object.entries(c).every(v=>{let[x,g]=v;return Array.isArray(g)?g.includes({...o,...i}[x]):{...o,...i}[x]===g})?[...u,f,y]:u},[]);return Rs(t,l,d,r==null?void 0:r.class,r==null?void 0:r.className)},rs="-",bn=t=>{const s=vn(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:a}=t;return{getClassGroupId:l=>{const i=l.split(rs);return i[0]===""&&i.length!==1&&i.shift(),hr(i,s)||yn(l)},getConflictingClassGroupIds:(l,i)=>{const d=r[l]||[];return i&&a[l]?[...d,...a[l]]:d}}},hr=(t,s)=>{var l;if(t.length===0)return s.classGroupId;const r=t[0],a=s.nextPart.get(r),n=a?hr(t.slice(1),a):void 0;if(n)return n;if(s.validators.length===0)return;const o=t.join(rs);return(l=s.validators.find(({validator:i})=>i(o)))==null?void 0:l.classGroupId},As=/^\[(.+)\]$/,yn=t=>{if(As.test(t)){const s=As.exec(t)[1],r=s==null?void 0:s.substring(0,s.indexOf(":"));if(r)return"arbitrary.."+r}},vn=t=>{const{theme:s,prefix:r}=t,a={nextPart:new Map,validators:[]};return wn(Object.entries(t.classGroups),r).forEach(([o,l])=>{Yt(l,a,o,s)}),a},Yt=(t,s,r,a)=>{t.forEach(n=>{if(typeof n=="string"){const o=n===""?s:Ms(s,n);o.classGroupId=r;return}if(typeof n=="function"){if(jn(n)){Yt(n(a),s,r,a);return}s.validators.push({validator:n,classGroupId:r});return}Object.entries(n).forEach(([o,l])=>{Yt(l,Ms(s,o),r,a)})})},Ms=(t,s)=>{let r=t;return s.split(rs).forEach(a=>{r.nextPart.has(a)||r.nextPart.set(a,{nextPart:new Map,validators:[]}),r=r.nextPart.get(a)}),r},jn=t=>t.isThemeGetter,wn=(t,s)=>s?t.map(([r,a])=>{const n=a.map(o=>typeof o=="string"?s+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([l,i])=>[s+l,i])):o);return[r,n]}):t,Nn=t=>{if(t<1)return{get:()=>{},set:()=>{}};let s=0,r=new Map,a=new Map;const n=(o,l)=>{r.set(o,l),s++,s>t&&(s=0,a=r,r=new Map)};return{get(o){let l=r.get(o);if(l!==void 0)return l;if((l=a.get(o))!==void 0)return n(o,l),l},set(o,l){r.has(o)?r.set(o,l):n(o,l)}}},pr="!",kn=t=>{const{separator:s,experimentalParseClassName:r}=t,a=s.length===1,n=s[0],o=s.length,l=i=>{const d=[];let u=0,h=0,f;for(let g=0;g<i.length;g++){let m=i[g];if(u===0){if(m===n&&(a||i.slice(g,g+o)===s)){d.push(i.slice(h,g)),h=g+o;continue}if(m==="/"){f=g;continue}}m==="["?u++:m==="]"&&u--}const y=d.length===0?i:i.substring(h),c=y.startsWith(pr),v=c?y.substring(1):y,x=f&&f>h?f-h:void 0;return{modifiers:d,hasImportantModifier:c,baseClassName:v,maybePostfixModifierPosition:x}};return r?i=>r({className:i,parseClassName:l}):l},Cn=t=>{if(t.length<=1)return t;const s=[];let r=[];return t.forEach(a=>{a[0]==="["?(s.push(...r.sort(),a),r=[]):r.push(a)}),s.push(...r.sort()),s},En=t=>({cache:Nn(t.cacheSize),parseClassName:kn(t),...bn(t)}),Sn=/\s+/,Rn=(t,s)=>{const{parseClassName:r,getClassGroupId:a,getConflictingClassGroupIds:n}=s,o=[],l=t.trim().split(Sn);let i="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{modifiers:h,hasImportantModifier:f,baseClassName:y,maybePostfixModifierPosition:c}=r(u);let v=!!c,x=a(v?y.substring(0,c):y);if(!x){if(!v){i=u+(i.length>0?" "+i:i);continue}if(x=a(y),!x){i=u+(i.length>0?" "+i:i);continue}v=!1}const g=Cn(h).join(":"),m=f?g+pr:g,E=m+x;if(o.includes(E))continue;o.push(E);const w=n(x,v);for(let z=0;z<w.length;++z){const M=w[z];o.push(m+M)}i=u+(i.length>0?" "+i:i)}return i};function An(){let t=0,s,r,a="";for(;t<arguments.length;)(s=arguments[t++])&&(r=fr(s))&&(a&&(a+=" "),a+=r);return a}const fr=t=>{if(typeof t=="string")return t;let s,r="";for(let a=0;a<t.length;a++)t[a]&&(s=fr(t[a]))&&(r&&(r+=" "),r+=s);return r};function Mn(t,...s){let r,a,n,o=l;function l(d){const u=s.reduce((h,f)=>f(h),t());return r=En(u),a=r.cache.get,n=r.cache.set,o=i,i(d)}function i(d){const u=a(d);if(u)return u;const h=Rn(d,r);return n(d,h),h}return function(){return o(An.apply(null,arguments))}}const D=t=>{const s=r=>r[t]||[];return s.isThemeGetter=!0,s},xr=/^\[(?:([a-z-]+):)?(.+)\]$/i,Tn=/^\d+\/\d+$/,Ln=new Set(["px","full","screen"]),In=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,zn=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Pn=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Dn=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,$n=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ue=t=>Fe(t)||Ln.has(t)||Tn.test(t),je=t=>We(t,"length",Hn),Fe=t=>!!t&&!Number.isNaN(Number(t)),_t=t=>We(t,"number",Fe),Qe=t=>!!t&&Number.isInteger(Number(t)),On=t=>t.endsWith("%")&&Fe(t.slice(0,-1)),k=t=>xr.test(t),we=t=>In.test(t),Bn=new Set(["length","size","percentage"]),_n=t=>We(t,Bn,gr),Vn=t=>We(t,"position",gr),Fn=new Set(["image","url"]),Un=t=>We(t,Fn,Gn),qn=t=>We(t,"",Wn),Ze=()=>!0,We=(t,s,r)=>{const a=xr.exec(t);return a?a[1]?typeof s=="string"?a[1]===s:s.has(a[1]):r(a[2]):!1},Hn=t=>zn.test(t)&&!Pn.test(t),gr=()=>!1,Wn=t=>Dn.test(t),Gn=t=>$n.test(t),Yn=()=>{const t=D("colors"),s=D("spacing"),r=D("blur"),a=D("brightness"),n=D("borderColor"),o=D("borderRadius"),l=D("borderSpacing"),i=D("borderWidth"),d=D("contrast"),u=D("grayscale"),h=D("hueRotate"),f=D("invert"),y=D("gap"),c=D("gradientColorStops"),v=D("gradientColorStopPositions"),x=D("inset"),g=D("margin"),m=D("opacity"),E=D("padding"),w=D("saturate"),z=D("scale"),M=D("sepia"),_=D("skew"),pe=D("space"),ke=D("translate"),fe=()=>["auto","contain","none"],Ce=()=>["auto","hidden","clip","visible","scroll"],xe=()=>["auto",k,s],S=()=>[k,s],Ee=()=>["",ue,je],te=()=>["auto",Fe,k],Se=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Q=()=>["solid","dashed","dotted","double","none"],Z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ge=()=>["start","end","center","between","around","evenly","stretch"],C=()=>["","0",k],F=()=>["auto","avoid","all","avoid-page","page","left","right","column"],X=()=>[Fe,k];return{cacheSize:500,separator:":",theme:{colors:[Ze],spacing:[ue,je],blur:["none","",we,k],brightness:X(),borderColor:[t],borderRadius:["none","","full",we,k],borderSpacing:S(),borderWidth:Ee(),contrast:X(),grayscale:C(),hueRotate:X(),invert:C(),gap:S(),gradientColorStops:[t],gradientColorStopPositions:[On,je],inset:xe(),margin:xe(),opacity:X(),padding:S(),saturate:X(),scale:X(),sepia:C(),skew:X(),space:S(),translate:S()},classGroups:{aspect:[{aspect:["auto","square","video",k]}],container:["container"],columns:[{columns:[we]}],"break-after":[{"break-after":F()}],"break-before":[{"break-before":F()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...Se(),k]}],overflow:[{overflow:Ce()}],"overflow-x":[{"overflow-x":Ce()}],"overflow-y":[{"overflow-y":Ce()}],overscroll:[{overscroll:fe()}],"overscroll-x":[{"overscroll-x":fe()}],"overscroll-y":[{"overscroll-y":fe()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[x]}],"inset-x":[{"inset-x":[x]}],"inset-y":[{"inset-y":[x]}],start:[{start:[x]}],end:[{end:[x]}],top:[{top:[x]}],right:[{right:[x]}],bottom:[{bottom:[x]}],left:[{left:[x]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Qe,k]}],basis:[{basis:xe()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",k]}],grow:[{grow:C()}],shrink:[{shrink:C()}],order:[{order:["first","last","none",Qe,k]}],"grid-cols":[{"grid-cols":[Ze]}],"col-start-end":[{col:["auto",{span:["full",Qe,k]},k]}],"col-start":[{"col-start":te()}],"col-end":[{"col-end":te()}],"grid-rows":[{"grid-rows":[Ze]}],"row-start-end":[{row:["auto",{span:[Qe,k]},k]}],"row-start":[{"row-start":te()}],"row-end":[{"row-end":te()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",k]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",k]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal",...ge()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ge(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ge(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[E]}],px:[{px:[E]}],py:[{py:[E]}],ps:[{ps:[E]}],pe:[{pe:[E]}],pt:[{pt:[E]}],pr:[{pr:[E]}],pb:[{pb:[E]}],pl:[{pl:[E]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[pe]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[pe]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",k,s]}],"min-w":[{"min-w":[k,s,"min","max","fit"]}],"max-w":[{"max-w":[k,s,"none","full","min","max","fit","prose",{screen:[we]},we]}],h:[{h:[k,s,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[k,s,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[k,s,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[k,s,"auto","min","max","fit"]}],"font-size":[{text:["base",we,je]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",_t]}],"font-family":[{font:[Ze]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",k]}],"line-clamp":[{"line-clamp":["none",Fe,_t]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ue,k]}],"list-image":[{"list-image":["none",k]}],"list-style-type":[{list:["none","disc","decimal",k]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[m]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[m]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Q(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",ue,je]}],"underline-offset":[{"underline-offset":["auto",ue,k]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:S()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",k]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",k]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[m]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Se(),Vn]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",_n]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Un]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[v]}],"gradient-via-pos":[{via:[v]}],"gradient-to-pos":[{to:[v]}],"gradient-from":[{from:[c]}],"gradient-via":[{via:[c]}],"gradient-to":[{to:[c]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[i]}],"border-w-x":[{"border-x":[i]}],"border-w-y":[{"border-y":[i]}],"border-w-s":[{"border-s":[i]}],"border-w-e":[{"border-e":[i]}],"border-w-t":[{"border-t":[i]}],"border-w-r":[{"border-r":[i]}],"border-w-b":[{"border-b":[i]}],"border-w-l":[{"border-l":[i]}],"border-opacity":[{"border-opacity":[m]}],"border-style":[{border:[...Q(),"hidden"]}],"divide-x":[{"divide-x":[i]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[i]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[m]}],"divide-style":[{divide:Q()}],"border-color":[{border:[n]}],"border-color-x":[{"border-x":[n]}],"border-color-y":[{"border-y":[n]}],"border-color-s":[{"border-s":[n]}],"border-color-e":[{"border-e":[n]}],"border-color-t":[{"border-t":[n]}],"border-color-r":[{"border-r":[n]}],"border-color-b":[{"border-b":[n]}],"border-color-l":[{"border-l":[n]}],"divide-color":[{divide:[n]}],"outline-style":[{outline:["",...Q()]}],"outline-offset":[{"outline-offset":[ue,k]}],"outline-w":[{outline:[ue,je]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:Ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[m]}],"ring-offset-w":[{"ring-offset":[ue,je]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",we,qn]}],"shadow-color":[{shadow:[Ze]}],opacity:[{opacity:[m]}],"mix-blend":[{"mix-blend":[...Z(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Z()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[a]}],contrast:[{contrast:[d]}],"drop-shadow":[{"drop-shadow":["","none",we,k]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[f]}],saturate:[{saturate:[w]}],sepia:[{sepia:[M]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[a]}],"backdrop-contrast":[{"backdrop-contrast":[d]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[m]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[M]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[l]}],"border-spacing-x":[{"border-spacing-x":[l]}],"border-spacing-y":[{"border-spacing-y":[l]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",k]}],duration:[{duration:X()}],ease:[{ease:["linear","in","out","in-out",k]}],delay:[{delay:X()}],animate:[{animate:["none","spin","ping","pulse","bounce",k]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[z]}],"scale-x":[{"scale-x":[z]}],"scale-y":[{"scale-y":[z]}],rotate:[{rotate:[Qe,k]}],"translate-x":[{"translate-x":[ke]}],"translate-y":[{"translate-y":[ke]}],"skew-x":[{"skew-x":[_]}],"skew-y":[{"skew-y":[_]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",k]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",k]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":S()}],"scroll-mx":[{"scroll-mx":S()}],"scroll-my":[{"scroll-my":S()}],"scroll-ms":[{"scroll-ms":S()}],"scroll-me":[{"scroll-me":S()}],"scroll-mt":[{"scroll-mt":S()}],"scroll-mr":[{"scroll-mr":S()}],"scroll-mb":[{"scroll-mb":S()}],"scroll-ml":[{"scroll-ml":S()}],"scroll-p":[{"scroll-p":S()}],"scroll-px":[{"scroll-px":S()}],"scroll-py":[{"scroll-py":S()}],"scroll-ps":[{"scroll-ps":S()}],"scroll-pe":[{"scroll-pe":S()}],"scroll-pt":[{"scroll-pt":S()}],"scroll-pr":[{"scroll-pr":S()}],"scroll-pb":[{"scroll-pb":S()}],"scroll-pl":[{"scroll-pl":S()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",k]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[ue,je,_t]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},Kn=Mn(Yn);function j(...t){return Kn(ur(t))}function Ct(t){if(!t)return"—";const s=Math.round((Date.now()-new Date(t).getTime())/1e3),r=[["year",31536e3],["month",2592e3],["day",86400],["hour",3600],["minute",60]];if(s<60)return"just now";for(const[a,n]of r){const o=Math.floor(s/n);if(o>=1)return`${o} ${a}${o===1?"":"s"} ago`}return"just now"}function as(t){return t?new Date(t).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"—"}function H(t,s="Something went wrong"){var r,a;return((a=(r=t==null?void 0:t.response)==null?void 0:r.data)==null?void 0:a.error)||(t==null?void 0:t.message)||s}const Kt=mr("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-[13px] font-medium transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary-solid text-primary-foreground hover:bg-primary-solid/90",destructive:"bg-destructive-solid text-destructive-foreground hover:bg-destructive-solid/90",outline:"border border-input bg-transparent text-foreground hover:border-foreground/30 hover:bg-accent",secondary:"bg-secondary text-secondary-foreground hover:bg-accent",ghost:"text-muted-foreground hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-3.5",sm:"h-8 px-3 text-xs",lg:"h-10 px-5 text-sm",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),R=p.forwardRef(({className:t,variant:s,size:r,asChild:a=!1,loading:n=!1,children:o,disabled:l,...i},d)=>{const u=a?Gr:"button";return e.jsx(u,{ref:d,className:j(Kt({variant:s,size:r,className:t})),disabled:l||n,"aria-busy":n||void 0,...i,children:n?e.jsxs(e.Fragment,{children:[e.jsx(Nt,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}),o]}):o})});R.displayName="Button";const Y=p.forwardRef(({className:t,type:s="text",...r},a)=>e.jsx("input",{ref:a,type:s,className:j("flex h-9 w-full rounded-md border border-input bg-card px-3 text-[13px] transition-colors hover:border-foreground/30","placeholder:text-muted-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background","disabled:cursor-not-allowed disabled:opacity-50","aria-[invalid=true]:border-destructive aria-[invalid=true]:focus-visible:ring-destructive",t),...r}));Y.displayName="Input";const nt=p.forwardRef(({className:t,...s},r)=>e.jsx("textarea",{ref:r,className:j("flex min-h-[80px] w-full rounded-md border border-input bg-card px-3 py-2 text-[13px] transition-colors hover:border-foreground/30","placeholder:text-muted-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background","disabled:cursor-not-allowed disabled:opacity-50",t),...s}));nt.displayName="Textarea";const ns=p.forwardRef(({className:t,...s},r)=>e.jsx(_s,{ref:r,className:j("text-[13px] font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...s}));ns.displayName=_s.displayName;function K({id:t,label:s,error:r,hint:a,children:n,className:o}){const l=r?`${t}-error`:void 0,i=a?`${t}-hint`:void 0;return e.jsxs("div",{className:j("space-y-2",o),children:[e.jsx(ns,{htmlFor:t,children:s}),p.isValidElement(n)?p.cloneElement(n,{id:t,"aria-invalid":r?!0:void 0,"aria-describedby":[l,i].filter(Boolean).join(" ")||void 0}):n,a&&!r&&e.jsx("p",{id:i,className:"text-xs leading-relaxed text-muted-foreground",children:a}),r&&e.jsx("p",{id:l,role:"alert",className:"text-xs font-medium text-destructive",children:r})]})}function le({className:t,...s}){return e.jsx("div",{className:j("animate-pulse rounded-md bg-muted",t),...s})}const Ts={info:{className:"border-l-muted-foreground bg-muted/50",Icon:an,iconClass:"text-muted-foreground"},error:{className:"border-l-destructive bg-destructive/[0.06]",Icon:Es,iconClass:"text-destructive"},success:{className:"border-l-success bg-success/[0.06]",Icon:Za,iconClass:"text-success"},warning:{className:"border-l-warning bg-warning/[0.08]",Icon:Es,iconClass:"text-warning"}};function ee({variant:t="info",title:s,children:r,className:a}){const{className:n,Icon:o,iconClass:l}=Ts[t]||Ts.info;return e.jsxs("div",{role:t==="error"?"alert":"status",className:j("flex gap-3 rounded-md rounded-l-none border border-l-2 px-4 py-3.5 text-[13px]",n,a),children:[e.jsx(o,{className:j("mt-px h-4 w-4 shrink-0",l),"aria-hidden":"true"}),e.jsxs("div",{className:"space-y-1",children:[s&&e.jsx("p",{className:"font-medium leading-snug text-foreground",children:s}),r&&e.jsx("div",{className:"leading-relaxed text-muted-foreground",children:r})]})]})}function os({icon:t,title:s,description:r,action:a,className:n}){return e.jsxs("div",{className:j("flex flex-col items-start gap-4 rounded-lg border border-dashed bg-card/40 px-8 py-14",n),children:[t&&e.jsx(t,{className:"h-5 w-5 text-primary","aria-hidden":"true",strokeWidth:1.5}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-[15px] font-medium tracking-tight",children:s}),r&&e.jsx("p",{className:"max-w-md text-[13px] leading-relaxed text-muted-foreground",children:r})]}),a&&e.jsx("div",{className:"mt-2",children:a})]})}function Xn({title:t,description:s,actions:r,className:a,children:n}){return e.jsxs("div",{className:j("mb-8 flex flex-wrap items-start justify-between gap-4",a),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("h1",{className:"text-xl font-medium tracking-tight",children:t}),s&&e.jsx("p",{className:"text-[13px] text-muted-foreground",children:s}),n]}),r&&e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:r})]})}function bt({label:t,value:s,hint:r,accent:a=!1,className:n}){return e.jsxs("div",{className:j("flex flex-col gap-2 border-l px-5 py-1",a?"border-l-primary":"border-l-border",n),children:[e.jsx("p",{className:"label",children:t}),e.jsx("p",{className:"text-2xl font-medium leading-none tracking-tight",children:s}),r&&e.jsx("p",{className:"text-xs text-muted-foreground",children:r})]})}const Vt={blob:"M98.25 50C98.44 51.39 98.47 52.85 98.13 54.21C97.79 55.57 96.87 56.88 96.22 58.15C95.58 59.42 94.77 60.6 94.26 61.86C93.76 63.12 93.56 64.43 93.2 65.72C92.83 67.02 92.54 68.35 92.07 69.62C91.61 70.89 90.99 72.09 90.43 73.34C89.87 74.59 89.36 75.89 88.71 77.11C88.07 78.33 87.45 79.64 86.55 80.67C85.65 81.7 84.43 82.5 83.3 83.3C82.17 84.1 80.83 84.62 79.75 85.45C78.67 86.29 77.79 87.31 76.83 88.31C75.86 89.32 75.04 90.61 73.95 91.48C72.86 92.35 71.59 93.03 70.3 93.52C69 94.01 67.54 94.18 66.16 94.41C64.79 94.64 63.41 94.85 62.04 94.92C60.66 94.99 59.26 94.96 57.9 94.81C56.54 94.65 55.17 94.18 53.85 94.01C52.53 93.85 51.29 93.73 50 93.82C48.71 93.9 47.41 94.41 46.11 94.52C44.8 94.62 43.43 94.71 42.17 94.43C40.9 94.15 39.71 93.39 38.52 92.83C37.34 92.27 36.24 91.56 35.05 91.06C33.87 90.57 32.62 90.29 31.41 89.86C30.2 89.44 28.97 89.01 27.77 88.5C26.57 88 25.44 87.37 24.21 86.83C22.98 86.3 21.62 85.89 20.4 85.28C19.17 84.67 17.81 84.09 16.84 83.16C15.88 82.23 15.2 80.94 14.6 79.71C13.99 78.47 13.77 76.98 13.22 75.75C12.67 74.52 12.02 73.44 11.29 72.35C10.57 71.25 9.59 70.29 8.89 69.17C8.2 68.05 7.62 66.83 7.11 65.61C6.6 64.39 6.24 63.1 5.83 61.84C5.41 60.57 4.89 59.31 4.63 58C4.36 56.7 4.2 55.34 4.21 54.01C4.22 52.67 4.63 51.33 4.69 50C4.75 48.67 4.77 47.39 4.56 46.02C4.34 44.66 3.67 43.22 3.41 41.78C3.15 40.35 2.85 38.81 2.99 37.4C3.13 36 3.71 34.65 4.25 33.35C4.78 32.04 5.52 30.81 6.2 29.58C6.89 28.35 7.54 27.09 8.37 25.96C9.19 24.84 10.2 23.81 11.16 22.8C12.12 21.8 13.24 20.94 14.15 19.92C15.06 18.89 15.77 17.71 16.64 16.64C17.5 15.56 18.26 14.3 19.34 13.47C20.43 12.63 21.8 12.08 23.13 11.63C24.47 11.18 26.02 11.13 27.35 10.77C28.68 10.41 29.89 9.98 31.1 9.47C32.31 8.96 33.41 8.24 34.61 7.7C35.8 7.17 37.04 6.73 38.28 6.26C39.52 5.79 40.77 5.34 42.04 4.88C43.32 4.42 44.61 3.75 45.93 3.5C47.26 3.25 48.66 3.16 50 3.37C51.34 3.59 52.66 4.34 53.96 4.79C55.25 5.23 56.46 5.77 57.75 6.04C59.04 6.3 60.38 6.19 61.69 6.37C63 6.54 64.37 6.67 65.61 7.11C66.85 7.54 68 8.29 69.13 8.97C70.26 9.66 71.34 10.43 72.4 11.21C73.45 11.99 74.52 12.74 75.44 13.66C76.36 14.58 77.11 15.72 77.92 16.73C78.72 17.74 79.34 18.86 80.28 19.72C81.23 20.57 82.4 21.14 83.56 21.84C84.73 22.54 86.21 23.05 87.27 23.9C88.33 24.76 89.21 25.83 89.93 26.94C90.66 28.06 91.04 29.39 91.6 30.6C92.16 31.82 92.75 33.01 93.3 34.24C93.85 35.47 94.46 36.69 94.9 37.97C95.33 39.25 95.55 40.59 95.9 41.91C96.25 43.23 96.61 44.54 97 45.89C97.39 47.24 98.06 48.61 98.25 50Z",solid:["M37 30h8v40h-8z","M37 30h16a11 11 0 0 1 0 22h-16z","M46 50h8.5l9 20h-8.5z"],holes:["M45 37h7.5a4 4 0 0 1 0 8h-7.5z"]};function Je({className:t,color:s="hsl(var(--primary-solid))"}){const r=p.useId().replace(/:/g,"");return e.jsxs("svg",{viewBox:"0 0 100 100",className:j("h-6 w-6 shrink-0",t),"aria-hidden":"true",children:[e.jsxs("mask",{id:r,maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"100",height:"100",children:[e.jsx("rect",{width:"100",height:"100",fill:"#000"}),e.jsx("path",{d:Vt.blob,fill:"#fff"}),e.jsx("circle",{cx:"50",cy:"50",r:"36.5",fill:"none",stroke:"#000",strokeWidth:"2.6"}),Vt.solid.map(a=>e.jsx("path",{d:a,fill:"#000"},a)),Vt.holes.map(a=>e.jsx("path",{d:a,fill:"#fff"},a))]}),e.jsx("rect",{width:"100",height:"100",fill:s,mask:`url(#${r})`})]})}const Qn=[["AES-256-GCM","Every value is sealed before it reaches the database, with a fresh IV per write."],["Four roles","Owner, admin, developer and read-only, enforced from one shared permission matrix."],["Full history","Fifty versions per key, with a diff between any two and the name behind each change."]];function br({title:t,description:s,children:r,footer:a}){return e.jsxs("div",{className:"grid min-h-screen lg:grid-cols-[1.1fr_1fr]",children:[e.jsxs("aside",{className:"relative hidden flex-col justify-between overflow-hidden bg-cream p-12 text-cream-foreground lg:flex",children:[e.jsxs("span",{className:"flex items-center gap-2.5",children:[e.jsx(Je,{className:"h-7 w-7"}),e.jsx("span",{className:"text-[13px] font-medium uppercase tracking-[0.22em]",children:"Redwax"})]}),e.jsxs("div",{className:"max-w-md space-y-10",children:[e.jsx("h2",{className:"text-3xl font-normal leading-[1.1] tracking-[-0.03em]",children:"Secrets your team can share. Infrastructure you actually own."}),e.jsx("dl",{className:"space-y-6 border-t border-cream-foreground/15 pt-8",children:Qn.map(([n,o])=>e.jsxs("div",{className:"grid gap-1",children:[e.jsx("dt",{className:"font-mono text-[11px] uppercase tracking-[0.14em] opacity-70",children:n}),e.jsx("dd",{className:"text-[13px] leading-relaxed opacity-90",children:o})]},n))})]}),e.jsx("p",{className:"font-mono text-[11px] opacity-60",children:"Self-hosted · MIT licensed"})]}),e.jsx("main",{className:"flex items-center justify-center px-6 py-16",children:e.jsxs("div",{className:"w-full max-w-[22rem]",children:[e.jsxs("span",{className:"mb-10 flex items-center gap-2.5 lg:hidden",children:[e.jsx(Je,{className:"h-7 w-7"}),e.jsx("span",{className:"text-[13px] font-medium uppercase tracking-[0.22em]",children:"Redwax"})]}),e.jsxs("div",{className:"mb-8 space-y-2",children:[e.jsx("h1",{className:"text-xl font-medium tracking-tight",children:t}),e.jsx("p",{className:"text-[13px] leading-relaxed text-muted-foreground",children:s})]}),r,e.jsx("p",{className:"mt-8 border-t pt-6 text-[13px] text-muted-foreground",children:a})]})})]})}function Zn(){var y,c;const{login:t,isAuthenticated:s,isLoading:r}=at(),a=wt(),n=Bs(),[o,l]=p.useState({email:"",password:""}),[i,d]=p.useState(null),[u,h]=p.useState(!1);if(!r&&s)return e.jsx(et,{to:((c=(y=n.state)==null?void 0:y.from)==null?void 0:c.pathname)||"/projects",replace:!0});const f=async v=>{var x,g;v.preventDefault(),d(null),h(!0);try{await t(o),a(((g=(x=n.state)==null?void 0:x.from)==null?void 0:g.pathname)||"/projects",{replace:!0})}catch(m){d(H(m,"Could not sign in"))}finally{h(!1)}};return e.jsx(br,{title:"Sign in",description:"Access your team's secrets.",footer:e.jsxs(e.Fragment,{children:["No account yet?"," ",e.jsx(Ue,{to:"/register",className:"font-medium text-primary hover:underline",children:"Create one"})]}),children:e.jsxs("form",{onSubmit:f,className:"space-y-5",children:[i&&e.jsx(ee,{variant:"error",children:i}),e.jsx(K,{id:"email",label:"Email",children:e.jsx(Y,{type:"email",value:o.email,onChange:v=>l(x=>({...x,email:v.target.value})),autoComplete:"email",required:!0,autoFocus:!0})}),e.jsx(K,{id:"password",label:"Password",children:e.jsx(Y,{type:"password",value:o.password,onChange:v=>l(x=>({...x,password:v.target.value})),autoComplete:"current-password",required:!0})}),e.jsx(R,{type:"submit",size:"lg",className:"w-full",loading:u,children:"Sign in"})]})})}function Jn(){const{register:t,isAuthenticated:s,isLoading:r}=at(),a=wt(),[n,o]=p.useState({name:"",email:"",password:""}),[l,i]=p.useState({}),[d,u]=p.useState(null),[h,f]=p.useState(!1);if(!r&&s)return e.jsx(et,{to:"/projects",replace:!0});const y=()=>{const v={};return n.name.trim().length<2&&(v.name="Enter your full name"),/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(n.email)||(v.email="Enter a valid email address"),n.password.length<8&&(v.password="Use at least 8 characters"),i(v),Object.keys(v).length===0},c=async v=>{if(v.preventDefault(),u(null),!!y()){f(!0);try{await t(n),a("/projects",{replace:!0})}catch(x){u(H(x,"Could not create your account"))}finally{f(!1)}}};return e.jsx(br,{title:"Create an account",description:"The first step to never pasting a .env into Slack again.",footer:e.jsxs(e.Fragment,{children:["Already have an account?"," ",e.jsx(Ue,{to:"/login",className:"font-medium text-primary hover:underline",children:"Sign in"})]}),children:e.jsxs("form",{onSubmit:c,className:"space-y-5",noValidate:!0,children:[d&&e.jsx(ee,{variant:"error",children:d}),e.jsx(K,{id:"name",label:"Name",error:l.name,children:e.jsx(Y,{value:n.name,onChange:v=>o(x=>({...x,name:v.target.value})),autoComplete:"name",required:!0,autoFocus:!0})}),e.jsx(K,{id:"email",label:"Email",error:l.email,children:e.jsx(Y,{type:"email",value:n.email,onChange:v=>o(x=>({...x,email:v.target.value})),autoComplete:"email",required:!0})}),e.jsx(K,{id:"password",label:"Password",error:l.password,hint:"At least 8 characters",children:e.jsx(Y,{type:"password",value:n.password,onChange:v=>o(x=>({...x,password:v.target.value})),autoComplete:"new-password",required:!0})}),e.jsx(R,{type:"submit",size:"lg",className:"w-full",loading:h,children:"Create account"})]})})}var Ft,Ls;function eo(){if(Ls)return Ft;Ls=1;const t=Object.freeze({OWNER:"owner",ADMIN:"admin",DEVELOPER:"developer",READONLY:"readonly"}),s=Object.freeze(Object.values(t)),r=Object.freeze(["production","staging","development"]),a=/^[A-Z][A-Z0-9_]*$/,n=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,o=/^[a-z0-9]+(?:[-_][a-z0-9]+)*$/i,l=50,i=Object.freeze({READ_SECRETS:"secrets:read",WRITE_SECRETS:"secrets:write",DELETE_SECRETS:"secrets:delete",MANAGE_MEMBERS:"members:manage",UPDATE_PROJECT:"project:update",DELETE_PROJECT:"project:delete",VIEW_AUDIT:"audit:view"}),d=Object.freeze({[t.OWNER]:Object.freeze([i.READ_SECRETS,i.WRITE_SECRETS,i.DELETE_SECRETS,i.MANAGE_MEMBERS,i.UPDATE_PROJECT,i.DELETE_PROJECT,i.VIEW_AUDIT]),[t.ADMIN]:Object.freeze([i.READ_SECRETS,i.WRITE_SECRETS,i.DELETE_SECRETS,i.MANAGE_MEMBERS,i.UPDATE_PROJECT,i.VIEW_AUDIT]),[t.DEVELOPER]:Object.freeze([i.READ_SECRETS,i.WRITE_SECRETS]),[t.READONLY]:Object.freeze([i.READ_SECRETS])}),u=Object.freeze(["secret.read","secret.write","secret.delete","secret.export","member.invite","member.remove","member.role_change","project.create","project.delete","project.transfer"]);function h(y,c){return(d[y]||[]).includes(c)}function f(y){return String(y).toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)}return Ft={ROLES:t,ROLE_VALUES:s,DEFAULT_ENVIRONMENTS:r,KEY_REGEX:a,SLUG_REGEX:n,ENV_REGEX:o,MAX_SECRET_VERSIONS:l,PERMISSIONS:i,ROLE_PERMISSIONS:d,AUDIT_ACTIONS:u,can:h,slugify:f},Ft}var $=eo();const ie={list:()=>L.get("/projects").then(t=>t.data.projects),get:t=>L.get(`/projects/${t}`).then(s=>s.data.project),create:t=>L.post("/projects",t).then(s=>s.data.project),update:(t,s)=>L.patch(`/projects/${t}`,s).then(r=>r.data.project),remove:t=>L.delete(`/projects/${t}`).then(s=>s.data),addMember:(t,s)=>L.post(`/projects/${t}/members`,s).then(r=>r.data.project),updateMember:(t,s,r)=>L.patch(`/projects/${t}/members/${s}`,{role:r}).then(a=>a.data.project),removeMember:(t,s)=>L.delete(`/projects/${t}/members/${s}`).then(r=>r.data.project),transferOwner:(t,s)=>L.post(`/projects/${t}/transfer`,{userId:s}).then(r=>r.data.project),audit:(t,s)=>L.get(`/projects/${t}/audit`,{params:s}).then(r=>r.data),auditCsv:(t,s)=>L.get(`/projects/${t}/audit`,{params:{...s,format:"csv"},responseType:"text"}).then(r=>r.data)},tt={all:["projects"],detail:t=>["projects",t],audit:(t,s)=>["projects",t,"audit",s]};function to(){return rt({queryKey:tt.all,queryFn:ie.list})}function Et(t){return rt({queryKey:tt.detail(t),queryFn:()=>ie.get(t),enabled:!!t})}function $e({mutationFn:t,successMessage:s,projectId:r}){const a=Xt();return Qt({mutationFn:t,onSuccess:n=>{a.invalidateQueries({queryKey:tt.all}),r&&a.invalidateQueries({queryKey:tt.detail(r)}),s&&oe.success(typeof s=="function"?s(n):s)},onError:n=>oe.error(H(n))})}function so(){return $e({mutationFn:ie.create,successMessage:t=>`Created ${t.name}`})}function yr(t){return $e({projectId:t,mutationFn:s=>ie.update(t,s),successMessage:"Project updated"})}function ro(){return $e({mutationFn:ie.remove,successMessage:"Project deleted"})}function ao(t){return $e({projectId:t,mutationFn:s=>ie.addMember(t,s),successMessage:"Member added"})}function no(t){return $e({projectId:t,mutationFn:({userId:s,role:r})=>ie.updateMember(t,s,r),successMessage:"Role updated"})}function oo(t){return $e({projectId:t,mutationFn:s=>ie.removeMember(t,s),successMessage:"Member removed"})}function io(t){return $e({projectId:t,mutationFn:s=>ie.transferOwner(t,s),successMessage:"Ownership transferred"})}function lo(t,s){return rt({queryKey:tt.audit(t,s),queryFn:()=>ie.audit(t,s),enabled:!!t,placeholderData:r=>r})}const is=Xr,ls=Qr,St=p.forwardRef(({className:t,sideOffset:s=4,...r},a)=>e.jsx(Yr,{children:e.jsx(Vs,{ref:a,sideOffset:s,className:j("z-50 min-w-[11rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg shadow-black/10 animate-fade-in",t),...r})}));St.displayName=Vs.displayName;const Le=p.forwardRef(({className:t,destructive:s,...r},a)=>e.jsx(Fs,{ref:a,className:j("relative flex cursor-pointer select-none items-center gap-2.5 rounded-sm px-2 py-1.5 text-[13px] outline-none transition-colors","focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s&&"text-destructive focus:bg-destructive/10 focus:text-destructive",t),...r}));Le.displayName=Fs.displayName;const co=p.forwardRef(({className:t,children:s,checked:r,...a},n)=>e.jsxs(Us,{ref:n,checked:r,className:j("relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none","focus:bg-accent focus:text-accent-foreground",t),...a,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Kr,{children:e.jsx(es,{className:"h-4 w-4","aria-hidden":"true"})})}),s]}));co.displayName=Us.displayName;const vr=p.forwardRef(({className:t,...s},r)=>e.jsx(qs,{ref:r,className:j("px-2 py-2 text-[13px] font-medium",t),...s}));vr.displayName=qs.displayName;const jr=p.forwardRef(({className:t,...s},r)=>e.jsx(Hs,{ref:r,className:j("-mx-1 my-1 h-px bg-border",t),...s}));jr.displayName=Hs.displayName;function uo(){const[t,s]=p.useState(()=>localStorage.getItem("redwax.theme")||"light");return p.useEffect(()=>{document.documentElement.classList.toggle("dark",t==="dark"),localStorage.setItem("redwax.theme",t)},[t]),[t,()=>s(r=>r==="dark"?"light":"dark")]}const mo=[{to:"secrets",label:"Secrets",icon:lr},{to:"audit",label:"Audit log",icon:cr,permission:$.PERMISSIONS.VIEW_AUDIT},{to:"settings",label:"Settings",icon:mn}],Is=({isActive:t})=>j("flex items-center gap-2.5 rounded-md px-2.5 py-2 text-[13px] transition-colors",t?"bg-accent font-medium text-accent-foreground":"text-muted-foreground hover:bg-accent/60 hover:text-foreground");function zs({onNavigate:t}){var n;const s=Ur("/projects/:id/*"),r=(n=s==null?void 0:s.params)==null?void 0:n.id,{data:a}=Et(r);return e.jsxs("nav",{"aria-label":"Main",className:"flex flex-1 flex-col gap-7 overflow-y-auto px-3 py-5",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("p",{className:"label mb-2.5 px-2.5",children:"Workspace"}),e.jsxs(vt,{to:"/projects",end:!0,onClick:t,className:Is,children:[e.jsx(or,{className:"h-4 w-4","aria-hidden":"true"}),"All projects"]})]}),a&&e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("p",{className:"label mb-2.5 px-2.5 truncate",title:a.name,children:a.name}),mo.filter(o=>!o.permission||$.can(a.role,o.permission)).map(o=>e.jsxs(vt,{to:`/projects/${a.id}/${o.to}`,onClick:t,className:Is,children:[e.jsx(o.icon,{className:"h-4 w-4","aria-hidden":"true"}),o.label]},o.to))]})]})}function ce({children:t}){const{user:s,logout:r}=at(),a=wt(),[n,o]=uo(),[l,i]=p.useState(!1),d=async()=>{await r(),a("/login",{replace:!0})},u=((s==null?void 0:s.name)||"?").split(" ").slice(0,2).map(h=>h[0]).join("").toUpperCase();return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("a",{href:"#main",className:"sr-only-focusable absolute left-4 top-4 z-50 rounded-md bg-primary-solid px-4 py-2 text-sm text-primary-foreground",children:"Skip to content"}),e.jsxs("aside",{className:"fixed inset-y-0 left-0 z-30 hidden w-60 flex-col border-r bg-sidebar lg:flex",children:[e.jsx("div",{className:"flex h-14 items-center gap-2.5 border-b px-5",children:e.jsxs(Ue,{to:"/projects",className:"flex items-center gap-2.5 rounded-md",children:[e.jsx(Je,{}),e.jsx("span",{className:"text-[13px] font-medium uppercase tracking-[0.18em]",children:"Redwax"})]})}),e.jsx(zs,{}),e.jsx("div",{className:"border-t px-3 py-3",children:e.jsx("p",{className:"px-2.5 font-mono text-[10.5px] text-muted-foreground",children:"Self-hosted · MIT"})})]}),l&&e.jsx("div",{className:"fixed inset-0 z-50 bg-black/50 backdrop-blur-[2px] animate-fade-in lg:hidden",onClick:()=>i(!1),role:"presentation",children:e.jsxs("aside",{className:"flex h-full w-[17rem] flex-col border-r bg-sidebar animate-slide-in-left",onClick:h=>h.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Navigation",children:[e.jsxs("div",{className:"flex h-14 items-center justify-between border-b px-5",children:[e.jsxs("span",{className:"flex items-center gap-2.5",children:[e.jsx(Je,{}),e.jsx("span",{className:"text-[13px] font-medium uppercase tracking-[0.18em]",children:"Redwax"})]}),e.jsx(R,{variant:"ghost",size:"icon",onClick:()=>i(!1),"aria-label":"Close navigation",children:e.jsx(kt,{className:"h-4 w-4","aria-hidden":"true"})})]}),e.jsx(zs,{onNavigate:()=>i(!1)})]})}),e.jsxs("div",{className:"lg:pl-60",children:[e.jsx("header",{className:"sticky top-0 z-20 border-b bg-background/85 backdrop-blur",children:e.jsxs("div",{className:"flex h-14 items-center gap-3 px-5 lg:px-8",children:[e.jsx(R,{variant:"ghost",size:"icon",className:"lg:hidden",onClick:()=>i(!0),"aria-label":"Open navigation",children:e.jsx(on,{className:"h-4 w-4","aria-hidden":"true"})}),e.jsx(Ue,{to:"/projects",className:"flex items-center gap-2 lg:hidden",children:e.jsx(Je,{className:"h-5 w-5"})}),e.jsxs("div",{className:"ml-auto flex items-center gap-1.5",children:[e.jsx(R,{variant:"ghost",size:"icon",onClick:o,"aria-label":`Switch to ${n==="dark"?"light":"dark"} theme`,children:n==="dark"?e.jsx(hn,{className:"h-4 w-4","aria-hidden":"true"}):e.jsx(ln,{className:"h-4 w-4","aria-hidden":"true"})}),e.jsxs(is,{children:[e.jsx(ls,{asChild:!0,children:e.jsxs(R,{variant:"ghost",size:"sm",className:"gap-2 pl-1.5 pr-2.5",children:[e.jsx("span",{"aria-hidden":"true",className:"flex h-6 w-6 items-center justify-center rounded-sm bg-secondary font-mono text-[10px] font-medium text-foreground",children:u}),e.jsx("span",{className:"hidden text-foreground sm:inline",children:s==null?void 0:s.name})]})}),e.jsxs(St,{align:"end",className:"w-60",children:[e.jsxs(vr,{className:"font-normal",children:[e.jsx("p",{className:"text-[13px] font-medium",children:s==null?void 0:s.name}),e.jsx("p",{className:"truncate text-xs text-muted-foreground",children:s==null?void 0:s.email})]}),e.jsx(jr,{}),e.jsxs(Le,{destructive:!0,onSelect:d,children:[e.jsx(nn,{className:"h-4 w-4","aria-hidden":"true"}),"Sign out"]})]})]})]})]})}),e.jsx("main",{id:"main",className:"mx-auto max-w-[1400px] px-5 py-8 lg:px-8 lg:py-10",children:t})]})]})}const ho=mr("inline-flex items-center gap-1 rounded-sm border px-2 py-0.5 font-mono text-[11px] font-medium transition-colors",{variants:{variant:{default:"border-primary/25 bg-primary/[0.08] text-primary",secondary:"border-border bg-secondary text-muted-foreground",destructive:"border-destructive/25 bg-destructive/[0.08] text-destructive",success:"border-success/30 bg-success/[0.08] text-success",warning:"border-warning/40 bg-warning/[0.1] text-warning",cream:"border-cream/50 bg-cream/[0.35] text-cream-foreground dark:bg-cream/[0.1] dark:text-cream",outline:"border-border text-muted-foreground"}},defaultVariants:{variant:"default"}});function Ie({className:t,variant:s,...r}){return e.jsx("span",{className:j(ho({variant:s}),t),...r})}const po={owner:"default",admin:"cream",developer:"secondary",readonly:"outline"};function cs({role:t,className:s}){return e.jsx(Ie,{variant:po[t]||"secondary",className:j("capitalize",s),children:t})}const Rt=Jr,wr=Zr,ds=p.forwardRef(({className:t,...s},r)=>e.jsx(Ws,{ref:r,className:j("fixed inset-0 z-50 bg-black/50 backdrop-blur-[2px] animate-fade-in",t),...s}));ds.displayName=Ws.displayName;const At=p.forwardRef(({className:t,children:s,...r},a)=>e.jsxs(wr,{children:[e.jsx(ds,{}),e.jsxs(Jt,{ref:a,className:j("fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-5","border bg-card p-6 shadow-2xl shadow-black/20 sm:rounded-lg animate-zoom-in",t),...r,children:[s,e.jsxs(Gs,{className:"absolute right-4 top-4 rounded-sm p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",children:[e.jsx(kt,{className:"h-4 w-4","aria-hidden":"true"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));At.displayName=Jt.displayName;const Nr=p.forwardRef(({className:t,children:s,...r},a)=>e.jsxs(wr,{children:[e.jsx(ds,{}),e.jsxs(Jt,{ref:a,className:j("fixed inset-y-0 right-0 z-50 flex h-full w-full flex-col border-l bg-card shadow-2xl shadow-black/20","sm:max-w-xl animate-slide-in-right",t),...r,children:[s,e.jsxs(Gs,{className:"absolute right-4 top-4 rounded-sm p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",children:[e.jsx(kt,{className:"h-4 w-4","aria-hidden":"true"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Nr.displayName="DialogDrawer";const Mt=({className:t,...s})=>e.jsx("div",{className:j("flex flex-col gap-1.5 text-left",t),...s}),us=({className:t,...s})=>e.jsx("div",{className:j("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...s}),ot=p.forwardRef(({className:t,...s},r)=>e.jsx(Ys,{ref:r,className:j("text-base font-medium leading-none tracking-tight",t),...s}));ot.displayName=Ys.displayName;const it=p.forwardRef(({className:t,...s},r)=>e.jsx(Ks,{ref:r,className:j("text-[13px] leading-relaxed text-muted-foreground",t),...s}));it.displayName=Ks.displayName;const Ut={name:"",description:""};function fo({open:t,onOpenChange:s}){const[r,a]=p.useState(Ut),[n,o]=p.useState({}),l=so();p.useEffect(()=>{t&&(a(Ut),o({}))},[t]);const i=$.slugify(r.name),d=async u=>{if(u.preventDefault(),r.name.trim().length<2){o({name:"Give the project a name"});return}o({});try{await l.mutateAsync({name:r.name.trim(),description:r.description.trim()}),a(Ut),s(!1)}catch{}};return e.jsx(Rt,{open:t,onOpenChange:s,children:e.jsx(At,{children:e.jsxs("form",{onSubmit:d,className:"grid gap-5",children:[e.jsxs(Mt,{children:[e.jsx(ot,{children:"New project"}),e.jsx(it,{children:"It starts with production, staging and development environments. You can add more later."})]}),e.jsx(K,{id:"project-name",label:"Name",error:n.name,hint:i?`CLI slug: ${i}`:"Used to derive the CLI slug",children:e.jsx(Y,{value:r.name,onChange:u=>a(h=>({...h,name:u.target.value})),placeholder:"Payments API",autoFocus:!0})}),e.jsx(K,{id:"project-description",label:"Description",hint:"Optional",children:e.jsx(nt,{value:r.description,onChange:u=>a(h=>({...h,description:u.target.value})),rows:3,placeholder:"Billing and subscription service"})}),e.jsxs(us,{children:[e.jsx(R,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(R,{type:"submit",loading:l.isPending,children:"Create project"})]})]})})})}function xo({project:t}){return e.jsx("li",{children:e.jsxs(Ue,{to:`/projects/${t.id}/secrets`,className:"group flex h-full flex-col rounded-lg border bg-card transition-colors hover:border-primary/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 border-b px-5 py-4",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("h2",{className:"truncate text-[15px] font-medium tracking-tight",children:t.name}),e.jsx("p",{className:"truncate font-mono text-[11px] text-muted-foreground",children:t.slug})]}),e.jsx(Ka,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-all group-hover:-translate-y-0.5 group-hover:translate-x-0.5 group-hover:text-primary","aria-hidden":"true"})]}),e.jsxs("div",{className:"flex flex-1 flex-col gap-4 px-5 py-4",children:[t.description&&e.jsx("p",{className:"line-clamp-2 text-[13px] leading-relaxed text-muted-foreground",children:t.description}),e.jsxs("div",{className:"mt-auto space-y-3.5",children:[e.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.environments.map(s=>e.jsx(Ie,{variant:"secondary",children:s},s))}),e.jsxs("div",{className:"flex items-center justify-between gap-3 border-t pt-3.5 text-[11px] text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(xn,{className:"h-3 w-3","aria-hidden":"true"}),t.members.length," member",t.members.length===1?"":"s"]}),e.jsxs("span",{className:"numeric",children:["created ",Ct(t.createdAt)]}),e.jsx(cs,{role:t.role})]})]})]})]})})}function go(){const{data:t,isLoading:s,error:r}=to(),[a,n]=p.useState(!1),o=p.useMemo(()=>{if(!(t!=null&&t.length))return null;const l=new Set,i=new Set;t.forEach(u=>{u.environments.forEach(h=>l.add(h)),u.members.forEach(h=>i.add(h.id))});const d=t.filter(u=>u.role==="owner").length;return{projects:t.length,environments:l.size,people:i.size,owned:d}},[t]);return e.jsxs(ce,{children:[e.jsx(Xn,{title:"Projects",description:"Every project you are a member of.",actions:e.jsxs(R,{onClick:()=>n(!0),className:"gap-2",children:[e.jsx(ts,{className:"h-4 w-4","aria-hidden":"true"}),"New project"]})}),o&&e.jsxs("dl",{className:"mb-10 grid grid-cols-2 gap-y-6 border-y py-6 lg:grid-cols-4",children:[e.jsx(bt,{accent:!0,label:"Projects",value:o.projects}),e.jsx(bt,{label:"Environments",value:o.environments,hint:"distinct names"}),e.jsx(bt,{label:"People",value:o.people,hint:"across all projects"}),e.jsx(bt,{label:"You own",value:o.owned,hint:`of ${o.projects}`})]}),s&&e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 xl:grid-cols-3",role:"status","aria-live":"polite",children:[e.jsx("span",{className:"sr-only",children:"Loading projects…"}),Array.from({length:3}).map((l,i)=>e.jsx(le,{className:"h-48 w-full"},i))]}),r&&e.jsx(ee,{variant:"error",title:"Could not load projects",children:H(r)}),t&&t.length===0&&e.jsx(os,{icon:or,title:"No projects yet",description:"Create your first project, then run redwax init to link it to a repository.",action:e.jsx(R,{onClick:()=>n(!0),children:"Create a project"})}),t&&t.length>0&&e.jsx("ul",{className:"grid gap-4 sm:grid-cols-2 xl:grid-cols-3",children:t.map(l=>e.jsx(xo,{project:l},l.id))}),e.jsx(fo,{open:a,onOpenChange:n})]})}const bo=[{to:"secrets",label:"Secrets"},{to:"audit",label:"Audit log",permission:$.PERMISSIONS.VIEW_AUDIT},{to:"settings",label:"Settings"}];function ms({project:t}){const s=bo.filter(r=>!r.permission||$.can(t.role,r.permission));return e.jsxs("div",{className:"mb-8",children:[e.jsxs("nav",{"aria-label":"Breadcrumb",className:"mb-3 flex items-center gap-1.5 text-[13px] text-muted-foreground",children:[e.jsx(vt,{to:"/projects",className:"transition-colors hover:text-foreground",children:"Projects"}),e.jsx(Qa,{className:"h-3.5 w-3.5","aria-hidden":"true"}),e.jsx("span",{className:"text-foreground",children:t.name})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx("h1",{className:"text-xl font-medium tracking-tight",children:t.name}),e.jsx(cs,{role:t.role}),e.jsx("code",{className:"rounded-sm border bg-muted/60 px-2 py-0.5 font-mono text-[11px] text-muted-foreground",children:t.slug})]}),t.description&&e.jsx("p",{className:"mt-2 max-w-2xl text-[13px] leading-relaxed text-muted-foreground",children:t.description}),e.jsx("nav",{"aria-label":"Project sections",className:"mt-6 flex gap-6 border-b lg:hidden",children:s.map(r=>e.jsx(vt,{to:`/projects/${t.id}/${r.to}`,className:({isActive:a})=>j("-mb-px border-b-2 pb-2.5 text-[13px] transition-colors",a?"border-primary-solid font-medium text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:r.label},r.to))})]})}const yo={production:"data-[active=true]:border-primary-solid data-[active=true]:text-primary"};function vo({environments:t=[],value:s,onChange:r,className:a}){return e.jsx("div",{role:"group","aria-label":"Environment",className:j("inline-flex flex-wrap items-center gap-1 rounded-lg border bg-muted/50 p-1",a),children:t.map(n=>{const o=n===s;return e.jsx("button",{type:"button","data-active":o,"aria-pressed":o,onClick:()=>r(n),className:j("rounded-sm border border-transparent px-3 py-1.5 font-mono text-[12px] transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",o?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground",yo[n]),children:n},n)})})}const Tt=p.forwardRef(({className:t,...s},r)=>e.jsx("div",{className:"relative w-full overflow-x-auto",children:e.jsx("table",{ref:r,className:j("w-full caption-bottom text-[13px]",t),...s})}));Tt.displayName="Table";const Lt=p.forwardRef(({className:t,...s},r)=>e.jsx("thead",{ref:r,className:j("[&_tr]:border-b",t),...s}));Lt.displayName="TableHeader";const It=p.forwardRef(({className:t,...s},r)=>e.jsx("tbody",{ref:r,className:j("[&_tr:last-child]:border-0",t),...s}));It.displayName="TableBody";const ze=p.forwardRef(({className:t,...s},r)=>e.jsx("tr",{ref:r,className:j("border-b transition-colors hover:bg-accent/60",t),...s}));ze.displayName="TableRow";const U=p.forwardRef(({className:t,...s},r)=>e.jsx("th",{ref:r,scope:"col",className:j("label h-9 whitespace-nowrap bg-muted/40 px-3 text-left align-middle",t),...s}));U.displayName="TableHead";const q=p.forwardRef(({className:t,...s},r)=>e.jsx("td",{ref:r,className:j("px-3 py-3 align-middle",t),...s}));q.displayName="TableCell";const jo=p.forwardRef(({className:t,...s},r)=>e.jsx("caption",{ref:r,className:j("mt-4 text-sm text-muted-foreground",t),...s}));jo.displayName="TableCaption";function st({open:t,onOpenChange:s,title:r,description:a,confirmLabel:n="Confirm",cancelLabel:o="Cancel",onConfirm:l,destructive:i=!0,confirmPhrase:d,loading:u=!1}){const[h,f]=p.useState("");p.useEffect(()=>{t||f("")},[t]);const y=!!d&&h!==d;return e.jsx(ea,{open:t,onOpenChange:s,children:e.jsxs(ta,{children:[e.jsx(sa,{className:"fixed inset-0 z-50 bg-black/50 backdrop-blur-[2px] animate-fade-in"}),e.jsxs(ra,{className:j("fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4","border bg-card p-6 shadow-2xl shadow-black/20 sm:rounded-lg animate-zoom-in"),children:[e.jsx(aa,{className:"text-base font-medium tracking-tight",children:r}),e.jsx(na,{className:"text-[13px] leading-relaxed text-muted-foreground",children:a}),d&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("label",{htmlFor:"confirm-phrase",className:"text-[13px] font-medium",children:["Type ",e.jsx("span",{className:"font-mono font-semibold",children:d})," to confirm"]}),e.jsx("input",{id:"confirm-phrase",value:h,onChange:c=>f(c.target.value),autoComplete:"off",className:"flex h-9 w-full rounded-md border border-input bg-background px-3 font-mono text-[13px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"})]}),e.jsxs("div",{className:"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",children:[e.jsx(oa,{className:j(Kt({variant:"outline"})),children:o}),e.jsx("button",{type:"button",disabled:y||u,onClick:l,className:j(Kt({variant:i?"destructive":"default"})),children:u?"Working…":n})]})]})]})})}const Ne=t=>`/projects/${t}/secrets`,he={list:(t,s)=>L.get(Ne(t),{params:{environment:s}}).then(r=>r.data.secrets),reveal:(t,s,r)=>L.get(`${Ne(t)}/${encodeURIComponent(r)}`,{params:{environment:s}}).then(a=>a.data.secret),create:(t,s)=>L.post(Ne(t),s).then(r=>r.data.secret),update:(t,s,r)=>L.patch(`${Ne(t)}/${encodeURIComponent(s)}`,r).then(a=>a.data.secret),remove:(t,s,r)=>L.delete(`${Ne(t)}/${encodeURIComponent(r)}`,{params:{environment:s}}).then(a=>a.data),history:(t,s,r)=>L.get(`${Ne(t)}/${encodeURIComponent(r)}/history`,{params:{environment:s}}).then(a=>a.data),exportEnv:(t,s)=>L.get(`${Ne(t)}/export`,{params:{environment:s,format:"env"},responseType:"text"}).then(r=>r.data),bulkImport:(t,s)=>L.post(`${Ne(t)}/bulk`,s).then(r=>r.data)},hs={list:(t,s)=>["secrets",t,s],history:(t,s,r)=>["secrets",t,s,r,"history"]};function wo(t,s){return rt({queryKey:hs.list(t,s),queryFn:()=>he.list(t,s),enabled:!!(t&&s)})}function No(t,s,r,a=!0){return rt({queryKey:hs.history(t,s,r),queryFn:()=>he.history(t,s,r),enabled:!!(t&&s&&r&&a)})}function zt({projectId:t,environment:s,mutationFn:r,successMessage:a}){const n=Xt();return Qt({mutationFn:r,onSuccess:o=>{n.invalidateQueries({queryKey:hs.list(t,s)}),n.invalidateQueries({queryKey:["secrets",t,s],exact:!1}),a&&oe.success(typeof a=="function"?a(o):a)},onError:o=>oe.error(H(o))})}function ko(t,s){return zt({projectId:t,environment:s,mutationFn:r=>he.create(t,{...r,environment:s}),successMessage:r=>`${r.key} saved`})}function Co(t,s){return zt({projectId:t,environment:s,mutationFn:({key:r,...a})=>he.update(t,r,{...a,environment:s}),successMessage:r=>`${r.key} updated`})}function Eo(t,s){return zt({projectId:t,environment:s,mutationFn:r=>he.remove(t,s,r),successMessage:r=>`${r.key} deleted`})}function So(t,s){return zt({projectId:t,environment:s,mutationFn:r=>he.bulkImport(t,{...r,environment:s}),successMessage:r=>`Import complete — ${[r.created&&`${r.created} created`,r.updated&&`${r.updated} updated`,r.unchanged&&`${r.unchanged} unchanged`].filter(Boolean).join(", ")||"no changes"}`})}function Ro(t,s){return Qt({mutationFn:r=>he.reveal(t,s,r),onError:r=>oe.error(H(r))})}const Ao=3e4;function Mo({projectId:t,environment:s,secretKey:r}){const[a,n]=p.useState(null),[o,l]=p.useState(!1),i=p.useRef(null),d=Ro(t,s);p.useEffect(()=>()=>clearTimeout(i.current),[]),p.useEffect(()=>{n(null),clearTimeout(i.current)},[s,r]);const u=async()=>{if(a!==null){n(null),clearTimeout(i.current);return}try{const y=await d.mutateAsync(r);n(y.value),i.current=setTimeout(()=>n(null),Ao)}catch{}},h=async()=>{try{const y=a!==null?a:(await d.mutateAsync(r)).value;await navigator.clipboard.writeText(y),l(!0),setTimeout(()=>l(!1),2e3),oe.success(`${r} copied to clipboard`)}catch{oe.error("Could not copy to clipboard")}},f=a!==null;return e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",children:f?a===""?"(empty)":a:"••••••••••••"}),e.jsx(R,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:u,disabled:d.isPending,"aria-label":f?`Hide value of ${r}`:`Reveal value of ${r}`,children:d.isPending?e.jsx(Nt,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":"true"}):f?e.jsx(tn,{className:"h-3.5 w-3.5","aria-hidden":"true"}):e.jsx(sn,{className:"h-3.5 w-3.5","aria-hidden":"true"})}),e.jsx(R,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:h,"aria-label":`Copy value of ${r}`,children:o?e.jsx(es,{className:"h-3.5 w-3.5 text-success","aria-hidden":"true"}):e.jsx(Ja,{className:"h-3.5 w-3.5","aria-hidden":"true"})})]})}const qe=ma,He=ha,Pe=p.forwardRef(({className:t,children:s,...r},a)=>e.jsxs(Xs,{ref:a,className:j("flex h-9 w-full items-center justify-between gap-2 rounded-md border border-input bg-card px-3 text-[13px] transition-colors hover:border-foreground/30","placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background","disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...r,children:[s,e.jsx(ia,{asChild:!0,children:e.jsx(Xa,{className:"h-4 w-4 opacity-50","aria-hidden":"true"})})]}));Pe.displayName=Xs.displayName;const De=p.forwardRef(({className:t,children:s,position:r="popper",...a},n)=>e.jsx(la,{children:e.jsx(Qs,{ref:n,position:r,className:j("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-lg shadow-black/10 animate-fade-in",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1",t),...a,children:e.jsx(ca,{className:j("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s})})}));De.displayName=Qs.displayName;const me=p.forwardRef(({className:t,children:s,...r},a)=>e.jsxs(Zs,{ref:a,className:j("relative flex w-full cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-[13px] outline-none","focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...r,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(da,{children:e.jsx(es,{className:"h-4 w-4","aria-hidden":"true"})})}),e.jsx(ua,{children:s})]}));me.displayName=Zs.displayName;const To=p.forwardRef(({className:t,...s},r)=>e.jsx(Js,{ref:r,className:j("label px-2 py-1.5",t),...s}));To.displayName=Js.displayName;const Lo=p.forwardRef(({className:t,...s},r)=>e.jsx(er,{ref:r,className:j("-mx-1 my-1 h-px bg-muted",t),...s}));Lo.displayName=er.displayName;function Io(t="",s=""){const r=String(t).split(`
|
|
188
|
+
`),a=String(s).split(`
|
|
189
|
+
`),n=Array.from({length:r.length+1},()=>new Array(a.length+1).fill(0));for(let d=r.length-1;d>=0;d-=1)for(let u=a.length-1;u>=0;u-=1)n[d][u]=r[d]===a[u]?n[d+1][u+1]+1:Math.max(n[d+1][u],n[d][u+1]);const o=[];let l=0,i=0;for(;l<r.length&&i<a.length;)r[l]===a[i]?(o.push({type:"equal",value:r[l]}),l+=1,i+=1):n[l+1][i]>=n[l][i+1]?(o.push({type:"removed",value:r[l]}),l+=1):(o.push({type:"added",value:a[i]}),i+=1);for(;l<r.length;)o.push({type:"removed",value:r[l++]});for(;i<a.length;)o.push({type:"added",value:a[i++]});return o}const zo={created:"success",updated:"default",deleted:"destructive",restored:"warning"};function Po({before:t,after:s}){const r=p.useMemo(()=>Io(t??"",s??""),[t,s]);return t===s?e.jsx("p",{className:"p-4 text-[13px] text-muted-foreground",children:"These two versions are identical."}):e.jsx("div",{className:"overflow-x-auto rounded-md border bg-card font-mono text-[11.5px]",children:r.map((a,n)=>e.jsxs("div",{className:a.type==="added"?"flex gap-2 bg-success/10 px-3 py-1 text-success":a.type==="removed"?"flex gap-2 bg-destructive/10 px-3 py-1 text-destructive":"flex gap-2 px-3 py-1 text-muted-foreground",children:[e.jsx("span",{"aria-hidden":"true",className:"select-none opacity-60",children:a.type==="added"?"+":a.type==="removed"?"-":" "}),e.jsx("span",{className:"whitespace-pre-wrap break-all",children:a.value||" "})]},n))})}function Do({open:t,onOpenChange:s,projectId:r,environment:a,secretKey:n}){var g;const{data:o,isLoading:l,error:i}=No(r,a,n,t),[d,u]=p.useState(null),[h,f]=p.useState(null);p.useEffect(()=>{var w;if(!((w=o==null?void 0:o.versions)!=null&&w.length))return;const[m,E]=o.versions;f(String(m.version)),u(String((E||m).version))},[o]);const y=p.useMemo(()=>Object.fromEntries(((o==null?void 0:o.versions)||[]).map(m=>[String(m.version),m])),[o]),c=y[d],v=y[h],x=(((g=o==null?void 0:o.versions)==null?void 0:g.length)||0)>1;return e.jsx(Rt,{open:t,onOpenChange:s,children:e.jsxs(Nr,{"aria-describedby":"history-description",children:[e.jsxs(Mt,{className:"border-b px-6 py-5",children:[e.jsxs(ot,{className:"flex items-center gap-2",children:[e.jsx(ir,{className:"h-4 w-4","aria-hidden":"true"}),e.jsx("span",{className:"font-mono",children:n})]}),e.jsxs(it,{id:"history-description",children:[a," · up to 50 versions retained"]})]}),e.jsxs("div",{className:"flex-1 space-y-8 overflow-y-auto px-6 py-6",children:[l&&e.jsxs("div",{className:"flex items-center gap-2 text-[13px] text-muted-foreground",role:"status",children:[e.jsx(Nt,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}),"Loading history…"]}),i&&e.jsx(ee,{variant:"error",title:"Could not load history",children:H(i)}),o&&e.jsxs(e.Fragment,{children:[x&&e.jsxs("section",{className:"space-y-3",children:[e.jsx("h3",{className:"label mb-3",children:"Compare versions"}),e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{htmlFor:"diff-left",className:"mb-1.5 block text-xs text-muted-foreground",children:"From"}),e.jsxs(qe,{value:d??"",onValueChange:u,children:[e.jsx(Pe,{id:"diff-left",children:e.jsx(He,{})}),e.jsx(De,{children:o.versions.map(m=>e.jsxs(me,{value:String(m.version),children:["v",m.version]},m.version))})]})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{htmlFor:"diff-right",className:"mb-1.5 block text-xs text-muted-foreground",children:"To"}),e.jsxs(qe,{value:h??"",onValueChange:f,children:[e.jsx(Pe,{id:"diff-right",children:e.jsx(He,{})}),e.jsx(De,{children:o.versions.map(m=>e.jsxs(me,{value:String(m.version),children:["v",m.version]},m.version))})]})]})]}),c&&v&&e.jsx(Po,{before:c.value,after:v.value})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsx("h3",{className:"label mb-3",children:"Timeline"}),e.jsx("ol",{className:"space-y-3",children:o.versions.map(m=>{var E,w;return e.jsxs("li",{className:"rounded-md border bg-card p-3.5",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("span",{className:"font-mono text-[13px] font-medium",children:["v",m.version]}),e.jsx(Ie,{variant:zo[m.action]||"secondary",children:m.action}),m.version===o.currentVersion&&e.jsx(Ie,{variant:"outline",children:"current"}),e.jsx("span",{className:"numeric ml-auto text-[11px] text-muted-foreground",title:as(m.changedAt),children:Ct(m.changedAt)})]}),e.jsxs("p",{className:"mt-1.5 text-[11px] text-muted-foreground",children:["by ",((E=m.changedBy)==null?void 0:E.name)||"unknown",(w=m.changedBy)!=null&&w.email?` <${m.changedBy.email}>`:""]}),e.jsx("code",{className:"mt-2.5 block break-all rounded-sm border bg-muted/60 px-2 py-1.5 font-mono text-[11.5px]",children:m.value===null?"(deleted)":m.value===""?"(empty)":m.value})]},m.version)})})]})]})]})]})})}function $o({secrets:t=[],isLoading:s,error:r,projectId:a,environment:n,role:o,onEdit:l,onCreate:i}){const[d,u]=p.useState(null),[h,f]=p.useState(null),y=$.can(o,$.PERMISSIONS.WRITE_SECRETS),c=$.can(o,$.PERMISSIONS.DELETE_SECRETS),v=Eo(a,n),x=async()=>{await v.mutateAsync(h.key),f(null)};return s?e.jsxs("div",{className:"space-y-2",role:"status","aria-live":"polite",children:[e.jsx("span",{className:"sr-only",children:"Loading secrets…"}),Array.from({length:4}).map((g,m)=>e.jsx(le,{className:"h-12 w-full"},m))]}):r?e.jsx(ee,{variant:"error",title:"Could not load secrets",children:H(r)}):t.length?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"overflow-hidden rounded-lg border bg-card",children:e.jsxs(Tt,{children:[e.jsxs("caption",{className:"sr-only",children:["Secrets in the ",n," environment. Values are masked until revealed."]}),e.jsx(Lt,{children:e.jsxs(ze,{className:"hover:bg-transparent",children:[e.jsx(U,{className:"w-[26%]",children:"Key"}),e.jsx(U,{className:"w-[36%]",children:"Value"}),e.jsx(U,{className:"w-[8%] text-right",children:"Ver"}),e.jsx(U,{className:"w-[26%]",children:"Last updated"}),e.jsx(U,{className:"w-[4%]",children:e.jsx("span",{className:"sr-only",children:"Actions"})})]})}),e.jsx(It,{children:t.map(g=>{var m;return e.jsxs(ze,{className:"group",children:[e.jsx(q,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[g.sensitive&&e.jsx("span",{className:"h-4 w-0.5 shrink-0 rounded-full bg-primary-solid","aria-hidden":"true"}),e.jsx("code",{className:"truncate font-mono text-[12.5px] font-medium text-foreground",children:g.key}),g.sensitive&&e.jsx(Ie,{variant:"warning",children:"sensitive"})]})}),e.jsx(q,{children:e.jsx(Mo,{projectId:a,environment:n,secretKey:g.key})}),e.jsx(q,{className:"numeric text-right font-mono text-[12px] text-muted-foreground",children:g.version}),e.jsxs(q,{className:"text-muted-foreground",children:[e.jsx("span",{className:"numeric",title:as(g.updatedAt),children:Ct(g.updatedAt)}),((m=g.updatedBy)==null?void 0:m.name)&&e.jsxs("span",{className:"block text-[11px]",children:["by ",g.updatedBy.name]})]}),e.jsx(q,{children:e.jsxs(is,{children:[e.jsx(ls,{asChild:!0,children:e.jsx(R,{variant:"ghost",size:"icon",className:"h-8 w-8 opacity-60 transition-opacity group-hover:opacity-100 focus-visible:opacity-100","aria-label":`Actions for ${g.key}`,children:e.jsx(nr,{className:"h-4 w-4","aria-hidden":"true"})})}),e.jsxs(St,{align:"end",children:[e.jsxs(Le,{onSelect:()=>u(g.key),children:[e.jsx(ir,{className:"h-4 w-4","aria-hidden":"true"}),"View history"]}),y&&e.jsxs(Le,{onSelect:()=>l(g),children:[e.jsx(cn,{className:"h-4 w-4","aria-hidden":"true"}),"Edit value"]}),c&&e.jsxs(Le,{destructive:!0,onSelect:()=>f(g),children:[e.jsx(ss,{className:"h-4 w-4","aria-hidden":"true"}),"Delete"]})]})]})})]},g.id)})})]})}),d&&e.jsx(Do,{open:!0,onOpenChange:g=>!g&&u(null),projectId:a,environment:n,secretKey:d}),e.jsx(st,{open:!!h,onOpenChange:g=>!g&&f(null),title:`Delete ${h==null?void 0:h.key}?`,description:`It disappears from ${n} immediately, but the value stays in version history and can be restored by writing the key again.`,confirmLabel:"Delete secret",loading:v.isPending,onConfirm:x})]}):e.jsx(os,{icon:lr,title:`No secrets in ${n}`,description:y?"Add your first secret, import an existing .env file, or push one from the CLI with redwax push.":"Nothing has been added to this environment yet.",action:y&&e.jsx(R,{onClick:i,children:"Add a secret"})})}const Ps={key:"",value:"",sensitive:!1};function Ds({open:t,onOpenChange:s,projectId:r,environment:a,secret:n}){const o=!!n,[l,i]=p.useState(Ps),[d,u]=p.useState({}),[h,f]=p.useState(!1),[y,c]=p.useState(null),v=ko(r,a),x=Co(r,a);p.useEffect(()=>{if(t){if(u({}),c(null),!o){i(Ps);return}i({key:n.key,value:"",sensitive:n.sensitive}),f(!0),he.reveal(r,a,n.key).then(w=>i({key:w.key,value:w.value,sensitive:w.sensitive})).catch(w=>c(H(w))).finally(()=>f(!1))}},[t,o,n,r,a]);const g=()=>{const w={};return l.key.trim()?$.KEY_REGEX.test(l.key)||(w.key="Use SCREAMING_SNAKE_CASE, e.g. DATABASE_URL"):w.key="Key is required",l.value.length>1e4&&(w.value="Values are limited to 10,000 characters"),u(w),Object.keys(w).length===0},m=async w=>{if(w.preventDefault(),!!g())try{o?await x.mutateAsync({key:l.key,value:l.value,sensitive:l.sensitive}):await v.mutateAsync({key:l.key,value:l.value,sensitive:l.sensitive}),s(!1)}catch{}},E=v.isPending||x.isPending;return e.jsx(Rt,{open:t,onOpenChange:s,children:e.jsx(At,{children:e.jsxs("form",{onSubmit:m,className:"grid gap-4",children:[e.jsxs(Mt,{children:[e.jsx(ot,{children:o?`Edit ${n.key}`:"New secret"}),e.jsx(it,{children:o?"Saving creates a new version — the previous value stays in history.":"The value is encrypted with AES-256-GCM before it reaches the database."})]}),y&&e.jsx(ee,{variant:"error",title:"Could not load the current value",children:y}),e.jsx(K,{id:"secret-key",label:"Key",error:d.key,hint:o?void 0:"Uppercase letters, digits and underscores",children:e.jsx(Y,{value:l.key,onChange:w=>i(z=>({...z,key:w.target.value.toUpperCase()})),placeholder:"DATABASE_URL",disabled:o,autoComplete:"off",spellCheck:!1,className:"font-mono"})}),e.jsx(K,{id:"secret-value",label:"Value",error:d.value,children:e.jsx(nt,{value:l.value,onChange:w=>i(z=>({...z,value:w.target.value})),placeholder:h?"Loading current value…":"postgresql://user:pass@host:5432/db",disabled:h,autoComplete:"off",spellCheck:!1,className:"font-mono text-[12.5px]",rows:4})}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("input",{id:"secret-sensitive",type:"checkbox",checked:l.sensitive,onChange:w=>i(z=>({...z,sensitive:w.target.checked})),className:"mt-0.5 h-4 w-4 rounded border-input accent-primary"}),e.jsxs("div",{children:[e.jsx(ns,{htmlFor:"secret-sensitive",children:"Mark as sensitive"}),e.jsx("p",{className:"text-xs leading-relaxed text-muted-foreground",children:"Highlighted in the table as extra-careful-with-this."})]})]}),e.jsxs(us,{children:[e.jsx(R,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(R,{type:"submit",loading:E,disabled:h,children:o?"Save new version":"Create secret"})]})]})})})}function Oo(t){const s=[],r=[];for(const a of t.split(/\r?\n/)){const n=a.trim();if(!n||n.startsWith("#"))continue;const o=n.startsWith("export ")?n.slice(7).trim():n,l=o.indexOf("=");if(l<1){r.push(n);continue}const i=o.slice(0,l).trim();let d=o.slice(l+1).trim();d.length>=2&&(d.startsWith('"')&&d.endsWith('"')||d.startsWith("'")&&d.endsWith("'"))&&(d=d.slice(1,-1).replace(/\\n/g,`
|
|
190
|
+
`).replace(/\\"/g,'"')),/^[A-Z][A-Z0-9_]*$/.test(i)?s.push({key:i,value:d}):r.push(i)}return{secrets:s,invalid:r}}function Bo({open:t,onOpenChange:s,projectId:r,environment:a,canWrite:n}){const[o,l]=p.useState(""),[i,d]=p.useState(!1),u=So(r,a),{secrets:h,invalid:f}=Oo(o),y=async()=>{h.length&&(await u.mutateAsync({secrets:h}),l(""),s(!1))},c=async()=>{d(!0);try{const v=await he.exportEnv(r,a),x=URL.createObjectURL(new Blob([v],{type:"text/plain"})),g=document.createElement("a");g.href=x,g.download=`${a}.env`,document.body.appendChild(g),g.click(),g.remove(),URL.revokeObjectURL(x),oe.success(`Exported ${a}.env`)}catch(v){oe.error(H(v))}finally{d(!1)}};return e.jsx(Rt,{open:t,onOpenChange:s,children:e.jsxs(At,{className:"max-w-2xl",children:[e.jsxs(Mt,{children:[e.jsxs(ot,{children:["Import and export · ",a]}),e.jsx(it,{children:"Bulk-load an existing .env file, or download every secret in this environment."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-md border bg-card p-4",children:[e.jsxs("h3",{className:"mb-1.5 flex items-center gap-2 text-[13px] font-medium",children:[e.jsx(ar,{className:"h-4 w-4","aria-hidden":"true"}),"Export"]}),e.jsx("p",{className:"mb-4 text-[13px] leading-relaxed text-muted-foreground",children:"Downloads decrypted values and writes an audit entry. Serve this dashboard over HTTPS."}),e.jsxs(R,{variant:"outline",size:"sm",onClick:c,loading:i,children:["Download ",a,".env"]})]}),n&&e.jsxs("div",{className:"rounded-md border bg-card p-4",children:[e.jsxs("h3",{className:"mb-1.5 flex items-center gap-2 text-[13px] font-medium",children:[e.jsx(pn,{className:"h-4 w-4","aria-hidden":"true"}),"Import"]}),e.jsx(K,{id:"import-text",label:"",hint:"Existing keys are updated; unchanged values are skipped. Nothing is deleted.",children:e.jsx(nt,{value:o,onChange:v=>l(v.target.value),rows:8,spellCheck:!1,className:"font-mono text-xs",placeholder:`DATABASE_URL=postgres://localhost/app
|
|
191
|
+
API_KEY=abc123`})}),f.length>0&&e.jsxs(ee,{variant:"warning",className:"mt-3",title:`${f.length} line(s) will be skipped`,children:["Keys must be SCREAMING_SNAKE_CASE: ",f.slice(0,5).join(", "),f.length>5?"…":""]}),h.length>0&&e.jsxs("p",{className:"mt-3 text-[13px] text-muted-foreground",children:["Ready to import ",e.jsx("strong",{children:h.length})," key(s)."]})]})]}),e.jsxs(us,{children:[e.jsx(R,{variant:"outline",onClick:()=>s(!1),children:"Close"}),n&&e.jsxs(R,{onClick:y,loading:u.isPending,disabled:!h.length,children:["Import ",h.length||""," secret",h.length===1?"":"s"]})]})]})})}function _o(){var z;const{id:t}=Zt(),[s,r]=qr(),{data:a,isLoading:n,error:o}=Et(t),l=s.get("env")||((z=a==null?void 0:a.environments)==null?void 0:z[0]),[i,d]=p.useState(""),[u,h]=p.useState(null),[f,y]=p.useState(!1),[c,v]=p.useState(!1),{data:x,isLoading:g,error:m}=wo(t,l);p.useEffect(()=>{!a||!s.get("env")||a.environments.includes(s.get("env"))||r({env:a.environments[0]},{replace:!0})},[a,s,r]);const E=p.useMemo(()=>{if(!x)return[];const M=i.trim().toUpperCase();return M?x.filter(_=>_.key.includes(M)):x},[x,i]);if(n)return e.jsx(ce,{children:e.jsxs("div",{className:"space-y-4",role:"status","aria-live":"polite",children:[e.jsx("span",{className:"sr-only",children:"Loading project…"}),e.jsx(le,{className:"h-8 w-64"}),e.jsx(le,{className:"h-64 w-full"})]})});if(o)return e.jsx(ce,{children:e.jsx(ee,{variant:"error",title:"Could not load this project",children:H(o)})});const w=$.can(a.role,$.PERMISSIONS.WRITE_SECRETS);return e.jsxs(ce,{children:[e.jsx(ms,{project:a}),e.jsxs("div",{className:"mb-5 flex flex-wrap items-center gap-3",children:[e.jsx(vo,{environments:a.environments,value:l,onChange:M=>r({env:M})}),e.jsxs("div",{className:"relative min-w-[200px] flex-1",children:[e.jsx(un,{className:"pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground","aria-hidden":"true"}),e.jsx("label",{htmlFor:"secret-search",className:"sr-only",children:"Filter secrets by key"}),e.jsx(Y,{id:"secret-search",value:i,onChange:M=>d(M.target.value),placeholder:"Filter by key…",className:"pl-9 pr-9 font-mono"}),i&&e.jsx("button",{type:"button",onClick:()=>d(""),"aria-label":"Clear filter",className:"absolute right-2 top-1/2 -translate-y-1/2 rounded-sm p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:e.jsx(kt,{className:"h-3.5 w-3.5","aria-hidden":"true"})})]}),e.jsxs(R,{variant:"outline",onClick:()=>v(!0),className:"gap-2",children:[e.jsx(rn,{className:"h-4 w-4","aria-hidden":"true"}),"Import / export"]}),w&&e.jsxs(R,{onClick:()=>y(!0),className:"gap-2",children:[e.jsx(ts,{className:"h-4 w-4","aria-hidden":"true"}),"Add secret"]})]}),e.jsx("div",{className:"mb-3 flex items-baseline gap-2 text-[13px] text-muted-foreground","aria-live":"polite",children:x&&e.jsx("span",{className:"numeric",children:i?`${E.length} of ${x.length} key${x.length===1?"":"s"} match “${i}”`:`${x.length} key${x.length===1?"":"s"} in ${l}`})}),e.jsx($o,{secrets:E,isLoading:g,error:m,projectId:t,environment:l,role:a.role,onEdit:h,onCreate:()=>y(!0)}),e.jsx(Ds,{open:f,onOpenChange:y,projectId:t,environment:l,secret:null}),e.jsx(Ds,{open:!!u,onOpenChange:M=>!M&&h(null),projectId:t,environment:l,secret:u}),e.jsx(Bo,{open:c,onOpenChange:v,projectId:t,environment:l,canWrite:w})]})}const qt=864e5,Vo=45;function Fo(t){const s=new Date(t);return s.setHours(0,0,0,0),s}function Uo(t){if(!(t!=null&&t.length))return{buckets:[],grouping:"day"};const s=t.map(h=>Fo(h.timestamp).getTime()),r=Math.min(...s),a=Math.max(...s),o=Math.round((a-r)/qt)+1>Vo?"week":"day",l=o==="week"?qt*7:qt,i=o==="week"?a-Math.floor((a-r)/l)*l:r,d=new Map,u=Math.floor((a-i)/l)+1;for(let h=0;h<u;h+=1)d.set(i+h*l,0);return s.forEach(h=>{if(h<i)return;const f=i+Math.floor((h-i)/l)*l;d.set(f,(d.get(f)||0)+1)}),{grouping:o,buckets:[...d.entries()].sort((h,f)=>h[0]-f[0]).map(([h,f])=>({time:h,count:f}))}}const Ht=new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}),$s=new Intl.DateTimeFormat(void 0,{weekday:"short",year:"numeric",month:"short",day:"numeric"});function qo({entries:t,stale:s=!1,className:r}){const[a,n]=p.useState(null),{buckets:o,grouping:l}=p.useMemo(()=>Uo(t),[t]);if(o.length<2)return null;const i=Math.max(...o.map(f=>f.count)),d=o.findIndex(f=>f.count===i),u=o.reduce((f,y)=>f+y.count,0),h=a!==null?o[a]:null;return e.jsxs("figure",{className:j("rounded-lg border bg-card transition-opacity duration-200",s&&"opacity-60",r),children:[e.jsxs("figcaption",{className:"flex flex-wrap items-baseline justify-between gap-x-6 gap-y-1 border-b px-5 py-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h2",{className:"text-[15px] font-medium tracking-tight",children:"Activity"}),e.jsxs("p",{className:"text-[13px] text-muted-foreground",children:[u," ",u===1?"entry":"entries"," on this page, by ",l]})]}),e.jsx("p",{className:"text-[13px] text-muted-foreground","aria-live":"polite",children:h?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"numeric text-foreground",children:h.count})," on ",$s.format(new Date(h.time)),l==="week"&&" (week of)"]}):e.jsxs(e.Fragment,{children:["Peak ",e.jsx("span",{className:"numeric text-foreground",children:i})," per ",l]})})]}),e.jsx("div",{className:"px-5 pb-4 pt-6",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("div",{className:"numeric flex w-6 shrink-0 flex-col justify-between text-right text-[10px] text-muted-foreground",children:[e.jsx("span",{children:i}),e.jsx("span",{children:Math.round(i/2)}),e.jsx("span",{children:"0"})]}),e.jsxs("div",{className:"relative min-w-0 flex-1",children:[e.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 h-[104px]","aria-hidden":"true",children:[0,50,100].map(f=>e.jsx("span",{className:"absolute inset-x-0 h-px bg-border",style:{top:`${f}%`}},f))}),e.jsx("ol",{className:"relative flex h-[104px] items-end gap-[2px]",children:o.map((f,y)=>{const c=i?f.count/i*100:0,v=a===y;return e.jsx("li",{className:"flex h-full min-w-0 flex-1",children:e.jsxs("button",{type:"button",onMouseEnter:()=>n(y),onMouseLeave:()=>n(null),onFocus:()=>n(y),onBlur:()=>n(null),className:"group flex h-full w-full items-end rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-card",children:[e.jsxs("span",{className:"sr-only",children:[$s.format(new Date(f.time)),": ",f.count," entries"]}),e.jsx("span",{"aria-hidden":"true",className:j("w-full rounded-t-[4px] bg-primary-solid transition-opacity duration-150",v?"opacity-100":"opacity-80 group-hover:opacity-100"),style:{height:`${Math.max(c,f.count>0?3:0)}%`}})]})},f.time)})}),e.jsxs("div",{className:"numeric relative mt-2 h-4 text-[10px] text-muted-foreground",children:[e.jsx("span",{className:"absolute left-0",children:Ht.format(new Date(o[0].time))}),d>0&&d<o.length-1&&e.jsx("span",{className:"absolute -translate-x-1/2 whitespace-nowrap text-foreground",style:{left:`${(d+.5)/o.length*100}%`},children:Ht.format(new Date(o[d].time))}),e.jsx("span",{className:"absolute right-0",children:Ht.format(new Date(o[o.length-1].time))})]})]})]})})]})}const Ho={"secret.read":"secondary","secret.write":"default","secret.delete":"destructive","secret.export":"warning"},Te="__all__",Wt={page:1,limit:50,action:Te,user:Te,from:"",to:""};function Wo(){const{id:t}=Zt(),{data:s,isLoading:r,error:a}=Et(t),[n,o]=p.useState(Wt),[l,i]=p.useState(!1),d=Object.fromEntries(Object.entries(n).filter(([,m])=>m!==Te&&m!=="")),{data:u,isLoading:h,isFetching:f,error:y}=lo(t,d),c=m=>o(E=>({...E,...m,page:m.page??1})),v=n.action!==Te||n.user!==Te||n.from!==""||n.to!=="",x=async()=>{i(!0);try{const{page:m,limit:E,...w}=d,z=await ie.auditCsv(t,w),M=URL.createObjectURL(new Blob([z],{type:"text/csv"})),_=document.createElement("a");_.href=M,_.download=`audit-${s.slug}.csv`,document.body.appendChild(_),_.click(),_.remove(),URL.revokeObjectURL(M),oe.success("Audit log exported")}catch(m){oe.error(H(m))}finally{i(!1)}};if(r)return e.jsx(ce,{children:e.jsxs("div",{className:"space-y-4",role:"status",children:[e.jsx(le,{className:"h-8 w-64"}),e.jsx(le,{className:"h-64 w-full"})]})});if(a)return e.jsx(ce,{children:e.jsx(ee,{variant:"error",title:"Could not load this project",children:H(a)})});const g=u==null?void 0:u.pagination;return e.jsxs(ce,{children:[e.jsx(ms,{project:s}),e.jsxs("div",{className:"mb-6 flex flex-wrap items-end gap-3 rounded-lg border bg-card px-4 py-3.5",children:[e.jsxs("div",{className:"w-44",children:[e.jsx("label",{htmlFor:"filter-action",className:"label mb-1.5 block",children:"Action"}),e.jsxs(qe,{value:n.action,onValueChange:m=>c({action:m}),children:[e.jsx(Pe,{id:"filter-action",children:e.jsx(He,{})}),e.jsxs(De,{children:[e.jsx(me,{value:Te,children:"All actions"}),$.AUDIT_ACTIONS.map(m=>e.jsx(me,{value:m,children:m},m))]})]})]}),e.jsxs("div",{className:"w-52",children:[e.jsx("label",{htmlFor:"filter-user",className:"label mb-1.5 block",children:"User"}),e.jsxs(qe,{value:n.user,onValueChange:m=>c({user:m}),children:[e.jsx(Pe,{id:"filter-user",children:e.jsx(He,{})}),e.jsxs(De,{children:[e.jsx(me,{value:Te,children:"Everyone"}),s.members.map(m=>e.jsx(me,{value:m.id,children:m.name},m.id))]})]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"filter-from",className:"label mb-1.5 block",children:"From"}),e.jsx(Y,{id:"filter-from",type:"date",value:n.from,onChange:m=>c({from:m.target.value})})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"filter-to",className:"label mb-1.5 block",children:"To"}),e.jsx(Y,{id:"filter-to",type:"date",value:n.to,onChange:m=>c({to:m.target.value})})]}),e.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[v&&e.jsxs(R,{variant:"ghost",onClick:()=>o(Wt),className:"gap-2",children:[e.jsx(dn,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Reset"]}),e.jsxs(R,{variant:"outline",onClick:x,loading:l,className:"gap-2",children:[e.jsx(ar,{className:"h-4 w-4","aria-hidden":"true"}),"Export CSV"]})]})]}),y&&e.jsx(ee,{variant:"error",title:"Could not load the audit log",children:H(y)}),h&&!u&&e.jsxs("div",{className:"space-y-2",role:"status","aria-live":"polite",children:[e.jsx("span",{className:"sr-only",children:"Loading audit log…"}),e.jsx(le,{className:"h-44 w-full"}),Array.from({length:6}).map((m,E)=>e.jsx(le,{className:"h-11 w-full"},E))]}),u&&u.entries.length===0&&e.jsx(os,{icon:cr,title:"No matching activity",description:"Nothing in this project matches the current filters. Try widening the date range, or clearing the action and user filters.",action:v&&e.jsx(R,{variant:"outline",onClick:()=>o(Wt),children:"Clear filters"})}),u&&u.entries.length>0&&e.jsxs("div",{className:"space-y-6",children:[e.jsx(qo,{entries:u.entries,stale:f}),e.jsx("div",{className:`overflow-hidden rounded-lg border bg-card transition-opacity ${f?"opacity-60":""}`,children:e.jsxs(Tt,{children:[e.jsxs("caption",{className:"sr-only",children:["Audit entries for ",s.name]}),e.jsx(Lt,{children:e.jsxs(ze,{className:"hover:bg-transparent",children:[e.jsx(U,{children:"When"}),e.jsx(U,{children:"Who"}),e.jsx(U,{children:"Action"}),e.jsx(U,{children:"Key"}),e.jsx(U,{children:"Environment"}),e.jsx(U,{children:"IP"})]})}),e.jsx(It,{children:u.entries.map(m=>{var E,w;return e.jsxs(ze,{children:[e.jsx(q,{className:"numeric whitespace-nowrap text-muted-foreground",children:as(m.timestamp)}),e.jsxs(q,{children:[e.jsx("div",{className:"text-foreground",children:((E=m.user)==null?void 0:E.name)||"Unknown"}),e.jsx("div",{className:"text-[11px] text-muted-foreground",children:(w=m.user)==null?void 0:w.email})]}),e.jsx(q,{children:e.jsx(Ie,{variant:Ho[m.action]||"secondary",children:m.action})}),e.jsx(q,{className:"font-mono text-[12px]",children:m.secretKey||"—"}),e.jsx(q,{className:"text-muted-foreground",children:m.environment||"—"}),e.jsx(q,{className:"numeric font-mono text-[11px] text-muted-foreground",children:m.ip||"—"})]},m.id)})})]})}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("p",{className:"numeric text-[13px] text-muted-foreground","aria-live":"polite",children:["Page ",g.page," of ",g.pages," · ",g.total," entries"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(R,{variant:"outline",size:"sm",disabled:g.page<=1,onClick:()=>o(m=>({...m,page:m.page-1})),children:"Previous"}),e.jsx(R,{variant:"outline",size:"sm",disabled:g.page>=g.pages,onClick:()=>o(m=>({...m,page:m.page+1})),children:"Next"})]})]})]})]})}const Os=[$.ROLES.ADMIN,$.ROLES.DEVELOPER,$.ROLES.READONLY];function Go({project:t,currentUserId:s}){const[r,a]=p.useState(""),[n,o]=p.useState($.ROLES.DEVELOPER),[l,i]=p.useState(null),[d,u]=p.useState(null),h=ao(t.id),f=oo(t.id),y=no(t.id),c=io(t.id),v=$.can(t.role,$.PERMISSIONS.MANAGE_MEMBERS),x=t.role===$.ROLES.OWNER,g=async m=>{m.preventDefault(),r.trim()&&(await h.mutateAsync({email:r.trim().toLowerCase(),role:n}),a(""),o($.ROLES.DEVELOPER))};return e.jsxs("div",{className:"space-y-6",children:[v&&e.jsxs("form",{onSubmit:g,className:"flex flex-col gap-3 rounded-md border bg-muted/40 p-4 sm:flex-row sm:items-end",children:[e.jsx(K,{id:"member-email",label:"Add a member",hint:"They need a Redwax account already — v1 does not send invitation emails.",className:"flex-1",children:e.jsx(Y,{type:"email",value:r,onChange:m=>a(m.target.value),placeholder:"teammate@example.com",autoComplete:"off"})}),e.jsxs("div",{className:"sm:w-44",children:[e.jsx("label",{htmlFor:"member-role",className:"mb-2 block text-[13px] font-medium",children:"Role"}),e.jsxs(qe,{value:n,onValueChange:o,children:[e.jsx(Pe,{id:"member-role",children:e.jsx(He,{})}),e.jsx(De,{children:Os.map(m=>e.jsx(me,{value:m,className:"capitalize",children:m},m))})]})]}),e.jsxs(R,{type:"submit",loading:h.isPending,className:"gap-2",children:[e.jsx(fn,{className:"h-4 w-4","aria-hidden":"true"}),"Add"]})]}),e.jsx("div",{className:"overflow-hidden rounded-lg border bg-card",children:e.jsxs(Tt,{children:[e.jsxs("caption",{className:"sr-only",children:["Members of ",t.name]}),e.jsx(Lt,{children:e.jsxs(ze,{className:"hover:bg-transparent",children:[e.jsx(U,{children:"Member"}),e.jsx(U,{children:"Role"}),e.jsx(U,{children:"Added"}),e.jsx(U,{className:"w-10",children:e.jsx("span",{className:"sr-only",children:"Actions"})})]})}),e.jsx(It,{children:t.members.map(m=>{const E=m.id===s,w=m.role===$.ROLES.OWNER,z=v&&!w;return e.jsxs(ze,{children:[e.jsxs(q,{children:[e.jsxs("div",{className:"font-medium",children:[m.name,E&&e.jsx("span",{className:"ml-2 text-[11px] text-muted-foreground",children:"(you)"})]}),e.jsx("div",{className:"text-[11px] text-muted-foreground",children:m.email})]}),e.jsx(q,{children:z?e.jsxs(qe,{value:m.role,onValueChange:M=>y.mutate({userId:m.id,role:M}),children:[e.jsx(Pe,{className:"h-8 w-36","aria-label":`Role for ${m.email}`,children:e.jsx(He,{})}),e.jsx(De,{children:Os.map(M=>e.jsx(me,{value:M,className:"capitalize",children:M},M))})]}):e.jsx(cs,{role:m.role})}),e.jsx(q,{className:"numeric text-muted-foreground",children:Ct(m.addedAt)}),e.jsx(q,{children:z&&e.jsxs(is,{children:[e.jsx(ls,{asChild:!0,children:e.jsx(R,{variant:"ghost",size:"icon",className:"h-8 w-8","aria-label":`Actions for ${m.email}`,children:e.jsx(nr,{className:"h-4 w-4","aria-hidden":"true"})})}),e.jsxs(St,{align:"end",children:[x&&e.jsxs(Le,{onSelect:()=>u(m),children:[e.jsx(en,{className:"h-4 w-4","aria-hidden":"true"}),"Transfer ownership"]}),e.jsxs(Le,{destructive:!0,onSelect:()=>i(m),children:[e.jsx(ss,{className:"h-4 w-4","aria-hidden":"true"}),"Remove from project"]})]})]})})]},m.id)})})]})}),e.jsx(st,{open:!!l,onOpenChange:m=>!m&&i(null),title:`Remove ${l==null?void 0:l.name}?`,description:`They lose access to every environment in ${t.name} immediately.`,confirmLabel:"Remove member",loading:f.isPending,onConfirm:async()=>{await f.mutateAsync(l.id),i(null)}}),e.jsx(st,{open:!!d,onOpenChange:m=>!m&&u(null),title:`Make ${d==null?void 0:d.name} the owner?`,description:"You will be demoted to admin and will no longer be able to delete this project or transfer ownership again.",confirmLabel:"Transfer ownership",destructive:!1,loading:c.isPending,onConfirm:async()=>{await c.mutateAsync(d.id),u(null)}})]})}const lt=p.forwardRef(({className:t,...s},r)=>e.jsx("div",{ref:r,className:j("rounded-lg border bg-card text-card-foreground",t),...s}));lt.displayName="Card";const ct=p.forwardRef(({className:t,...s},r)=>e.jsx("div",{ref:r,className:j("flex flex-col gap-1.5 border-b px-5 py-4",t),...s}));ct.displayName="CardHeader";const dt=p.forwardRef(({className:t,as:s="h3",...r},a)=>e.jsx(s,{ref:a,className:j("text-[15px] font-medium leading-none tracking-tight",t),...r}));dt.displayName="CardTitle";const ut=p.forwardRef(({className:t,...s},r)=>e.jsx("p",{ref:r,className:j("text-[13px] leading-relaxed text-muted-foreground",t),...s}));ut.displayName="CardDescription";const mt=p.forwardRef(({className:t,...s},r)=>e.jsx("div",{ref:r,className:j("p-5",t),...s}));mt.displayName="CardContent";const Yo=p.forwardRef(({className:t,...s},r)=>e.jsx("div",{ref:r,className:j("flex items-center gap-2 border-t px-5 py-4",t),...s}));Yo.displayName="CardFooter";function Ko({project:t,editable:s}){const[r,a]=p.useState({name:t.name,description:t.description||""}),n=yr(t.id),o=r.name!==t.name||r.description!==(t.description||"");return e.jsxs(lt,{children:[e.jsxs(ct,{children:[e.jsx(dt,{as:"h2",children:"General"}),e.jsxs(ut,{children:["The slug ",e.jsx("code",{className:"rounded-sm border bg-muted/60 px-1.5 py-0.5 font-mono text-[11px]",children:t.slug})," is fixed — the CLI and existing",e.jsx("code",{className:"mx-1 rounded-sm border bg-muted/60 px-1.5 py-0.5 font-mono text-[11px]",children:".redwax"})," files depend on it."]})]}),e.jsx(mt,{children:e.jsxs("form",{className:"space-y-4",onSubmit:l=>{l.preventDefault(),n.mutate(r)},children:[e.jsx(K,{id:"project-name",label:"Name",children:e.jsx(Y,{value:r.name,onChange:l=>a(i=>({...i,name:l.target.value})),disabled:!s})}),e.jsx(K,{id:"project-description",label:"Description",children:e.jsx(nt,{value:r.description,onChange:l=>a(i=>({...i,description:l.target.value})),rows:3,disabled:!s})}),s&&e.jsx(R,{type:"submit",loading:n.isPending,disabled:!o,children:"Save changes"})]})})]})}function Xo({project:t,editable:s}){const[r,a]=p.useState(""),[n,o]=p.useState(null),l=yr(t.id),i=async d=>{d.preventDefault();const u=r.trim().toLowerCase();u&&(await l.mutateAsync({addEnvironment:u}),a(""))};return e.jsxs(lt,{children:[e.jsxs(ct,{children:[e.jsx(dt,{as:"h2",children:"Environments"}),e.jsx(ut,{children:"An environment can only be removed once it holds no secrets."})]}),e.jsxs(mt,{className:"space-y-4",children:[e.jsx("ul",{className:"flex flex-wrap gap-2",children:t.environments.map(d=>e.jsx("li",{children:e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-sm border bg-secondary px-2.5 py-1 font-mono text-[12px]",children:[d,s&&t.environments.length>1&&e.jsx("button",{type:"button",onClick:()=>o(d),className:"rounded-sm p-0.5 text-muted-foreground transition-colors hover:text-destructive focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":`Remove the ${d} environment`,children:e.jsx(ss,{className:"h-3 w-3","aria-hidden":"true"})})]})},d))}),s&&e.jsxs("form",{onSubmit:i,className:"flex items-end gap-2",children:[e.jsx(K,{id:"new-environment",label:"Add an environment",className:"flex-1 max-w-xs",children:e.jsx(Y,{value:r,onChange:d=>a(d.target.value),placeholder:"preview",autoComplete:"off"})}),e.jsxs(R,{type:"submit",variant:"outline",loading:l.isPending,className:"gap-2",children:[e.jsx(ts,{className:"h-4 w-4","aria-hidden":"true"}),"Add"]})]}),e.jsx(st,{open:!!n,onOpenChange:d=>!d&&o(null),title:`Remove the ${n} environment?`,description:"This is rejected if the environment still holds any secrets.",confirmLabel:"Remove environment",loading:l.isPending,onConfirm:async()=>{await l.mutateAsync({removeEnvironment:n}),o(null)}})]})]})}function Qo({project:t}){const[s,r]=p.useState(!1),a=wt(),n=ro();return e.jsxs(lt,{className:"border-destructive/40 bg-destructive/[0.03]",children:[e.jsxs(ct,{children:[e.jsx(dt,{as:"h2",className:"text-destructive",children:"Danger zone"}),e.jsx(ut,{children:"Deleting removes every secret, all version history and the entire audit trail. It cannot be undone."})]}),e.jsxs(mt,{children:[e.jsx(R,{variant:"destructive",onClick:()=>r(!0),children:"Delete this project"}),e.jsx(st,{open:s,onOpenChange:r,title:`Delete ${t.name}?`,description:"Every secret, version and audit record is destroyed permanently. Export anything you need first.",confirmLabel:"Delete project",confirmPhrase:t.slug,loading:n.isPending,onConfirm:async()=>{await n.mutateAsync(t.id),a("/projects",{replace:!0})}})]})]})}function Zo(){const{id:t}=Zt(),{user:s}=at(),{data:r,isLoading:a,error:n}=Et(t);if(a)return e.jsx(ce,{children:e.jsxs("div",{className:"space-y-4",role:"status",children:[e.jsx(le,{className:"h-8 w-64"}),e.jsx(le,{className:"h-64 w-full"})]})});if(n)return e.jsx(ce,{children:e.jsx(ee,{variant:"error",title:"Could not load this project",children:H(n)})});const o=$.can(r.role,$.PERMISSIONS.UPDATE_PROJECT),l=r.role===$.ROLES.OWNER;return e.jsxs(ce,{children:[e.jsx(ms,{project:r}),e.jsxs("div",{className:"grid max-w-3xl gap-5",children:[!o&&e.jsxs(ee,{variant:"info",title:"Read-only",children:["Your role is ",e.jsx(Ie,{variant:"secondary",className:"mx-1",children:r.role}),"so these settings cannot be changed."]}),e.jsx(Ko,{project:r,editable:o}),e.jsx(Xo,{project:r,editable:o}),e.jsxs(lt,{children:[e.jsxs(ct,{children:[e.jsx(dt,{as:"h2",children:"Members"}),e.jsx(ut,{children:"Owner and admin can manage members. Developers can read and write secrets; read-only can only read."})]}),e.jsx(mt,{children:e.jsx(Go,{project:r,currentUserId:s==null?void 0:s.id})})]}),l&&e.jsx(Qo,{project:r})]})]})}function Jo(){return e.jsxs("div",{className:"mx-auto flex min-h-screen max-w-md flex-col justify-center gap-5 px-6",children:[e.jsx("p",{className:"label",children:"Error 404"}),e.jsx("h1",{className:"text-2xl font-medium tracking-tight",children:"Page not found"}),e.jsx("p",{className:"text-[13px] leading-relaxed text-muted-foreground",children:"That page does not exist, or you do not have access to it."}),e.jsx(R,{asChild:!0,className:"mt-2 w-fit",children:e.jsx(Ue,{to:"/projects",children:"Back to projects"})})]})}const yt=t=>e.jsx(gn,{children:t});function ei(){return e.jsxs(Ha,{children:[e.jsxs(Hr,{children:[e.jsx(de,{path:"/login",element:e.jsx(Zn,{})}),e.jsx(de,{path:"/register",element:e.jsx(Jn,{})}),e.jsx(de,{path:"/projects",element:yt(e.jsx(go,{}))}),e.jsx(de,{path:"/projects/:id",element:e.jsx(et,{to:"secrets",replace:!0})}),e.jsx(de,{path:"/projects/:id/secrets",element:yt(e.jsx(_o,{}))}),e.jsx(de,{path:"/projects/:id/audit",element:yt(e.jsx(Wo,{}))}),e.jsx(de,{path:"/projects/:id/settings",element:yt(e.jsx(Zo,{}))}),e.jsx(de,{path:"/",element:e.jsx(et,{to:"/projects",replace:!0})}),e.jsx(de,{path:"*",element:e.jsx(Jo,{})})]}),e.jsx(Ua,{position:"bottom-right",richColors:!0,closeButton:!0})]})}const ti=new Or({defaultOptions:{queries:{staleTime:3e4,refetchOnWindowFocus:!1,retry:(t,s)=>{var a;const r=(a=s==null?void 0:s.response)==null?void 0:a.status;return r>=400&&r<500?!1:t<2}}}});localStorage.getItem("redwax.theme")==="dark"&&document.documentElement.classList.add("dark");xa.createRoot(document.getElementById("root")).render(e.jsx(b.StrictMode,{children:e.jsx(Br,{client:ti,children:e.jsx(Wr,{children:e.jsx(ei,{})})})}));
|