import{a as C}from"./asyncComputed.c701d7b0.js";import{P as S}from"./project.f661f5a0.js";import"./console.3fb52eaf.js";import{d as h,r as b,b as g,c as w,w as o,aT as n,ey as I,u as a,c9 as E,cL as T,t as B,J as y,f as r,e as _,eC as j,c2 as D,eA as P,et as F,ew as V}from"./outputWidgets.75a5b0b9.js";import"./index.a131125e.js";import{n as N}from"./index.a1ee75ca.js";import{c as A,A as H}from"./Title.b6c9692d.js";import{A as L,a as f}from"./index.49e953af.js";import{A as k}from"./index.9c0809a0.js";import{F as R}from"./Form.2c716183.js";import{A as $}from"./index.4598445f.js";import"./gateway.99e43695.js";import"./activeRecord.115270b9.js";import"./pubsub.3fa240d3.js";import"./index.b50eb903.js";import"./index.b6767512.js";import"./dayjs.d3366d83.js";import"./index.e24c456b.js";import"./index.7aacb57f.js";import"./TabPane.0d7849ee.js";import"./index.e9ba5796.js";import"./CollapsePanel.46ee4c6b.js";import"./index.3916405f.js";import"./index.5a67eb5f.js";import"./index.fe803cdf.js";import"./index.5e9c5434.js";import"./index.00d295c9.js";import"./index.fc88890c.js";(function(){try{var i=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},l=new Error().stack;l&&(i._sentryDebugIds=i._sentryDebugIds||{},i._sentryDebugIds[l]="94a479fc-7453-424e-9c23-7aed126c6d23",i._sentryDebugIdIdentifier="sentry-dbid-94a479fc-7453-424e-9c23-7aed126c6d23")}catch{}})();const x=h({__name:"SaveButton",props:{model:{},disabled:{type:Boolean}},emits:["error"],setup(i,{emit:l}){const t=i,d=b(!1),c=b(null);async function u(){d.value=!0;try{await t.model.save()}catch(e){e instanceof Error&&(l("error",e),T.error({message:"Error",description:e.message}),c.value=e)}finally{d.value=!1}}return addEventListener("keydown",e=>{(e.metaKey||e.ctrlKey)&&e.key==="s"&&(e.preventDefault(),u())}),addEventListener("beforeunload",e=>{t.model.hasChanges()&&(e.preventDefault(),e.returnValue="")}),(e,p)=>{var m,s,v;return g(),w(a(E),{class:I(["save-button",{changes:(m=e.model)==null?void 0:m.hasChanges()}]),loading:d.value,disabled:(v=e.disabled)!=null?v:!((s=e.model)!=null&&s.hasChanges()),onClick:p[0]||(p[0]=z=>u())},{default:o(()=>[n(" Save ")]),_:1},8,["class","loading","disabled"])}}}),K=h({__name:"SubdomainEditor",props:{project:{}},setup(i){const l=i,t=b(void 0),d=B.exports.debounce(async()=>{try{const{available:s}=await l.project.checkSubdomain();t.value=s?"available":"unavailable"}catch{t.value=void 0}},500);function c(){l.project.subdomain?(t.value="loading",d()):t.value="invalid"}const u=y(()=>{switch(t.value){case"invalid":return"error";case"loading":return"validating";case"available":return"success";case"unavailable":return"error";default:return}}),e=y(()=>{switch(t.value){case"loading":return"Checking availability...";case"available":return"Available";case"unavailable":return"Unavailable";case"invalid":return"Invalid subdomain";default:return}}),p=s=>{l.project.subdomain=N(s.target.value,{replacement:"-",lower:!0,strict:!0}),c()};function m(){l.project.resetChanges(),t.value=void 0}return(s,v)=>(g(),w(a($),{direction:"vertical"},{default:o(()=>[r(a(A),{level:2},{default:o(()=>[n("Subdomain")]),_:1}),r(a(L),null,{default:o(()=>[n(" Every project in Abstra Cloud comes with a default subdomain, which will appear on all shared project links. ")]),_:1}),r(a(k),null,{default:o(()=>[r(a(f),null,{default:o(()=>[n("Forms and Dashes available at:")]),_:1}),r(a(f),{code:""},{default:o(()=>[n("https://"),_("span",null,j(s.project.subdomain),1),n(".abstra.app/[PATH] ")]),_:1})]),_:1}),r(a(k),null,{default:o(()=>[r(a(f),null,{default:o(()=>[n("Hooks available at:")]),_:1}),r(a(f),{code:""},{default:o(()=>[n(" https://"),_("span",null,j(s.project.subdomain),1),n(".abstra.app/_hooks/[PATH] ")]),_:1})]),_:1}),r(a(R),null,{default:o(()=>[r(a(H),{"validate-status":u.value,help:e.value,"has-feedback":""},{default:o(()=>[r(a(D),{value:s.project.subdomain,type:"text",loading:t.value==="loading",onInput:p},{addonBefore:o(()=>[n("https://")]),addonAfter:o(()=>[n(".abstra.app")]),_:1},8,["value","loading"])]),_:1},8,["validate-status","help"]),r(x,{model:s.project,disabled:t.value!=="available",onError:m},null,8,["model","disabled"])]),_:1})]),_:1}))}}),q={key:0,class:"project-settings"},ge=h({__name:"ProjectSettings",setup(i){const t=P().params.projectId,{result:d}=C(()=>S.get(t));return(c,u)=>a(d)?(g(),F("div",q,[r(a(A),null,{default:o(()=>[n("Project Settings")]),_:1}),r(K,{project:a(d)},null,8,["project"])])):V("",!0)}});export{ge as default};
//# sourceMappingURL=ProjectSettings.3d2fa7d0.js.map
