import{a as I}from"./asyncComputed.6b982433.js";import{a as _}from"./router.55b997dc.js";import{d as k,r as y,b as h,c as S,w as a,ar as n,ez as P,u as e,bV as T,cz as F,eL as H,H as w,f as t,e as m,eD as f,bO as U,ev as D,ex as B,cF as V,eB as N}from"./outputWidgets.84fe9cdf.js";import"./index.46fac088.js";import{P as E}from"./project.27c9517e.js";import{A as j}from"./Title.59475fea.js";import{A as C}from"./Paragraph.7a7aafbc.js";import{A as i}from"./Text.6c3b9f60.js";import{A as $}from"./FormItem.3f0afd7c.js";import{F as z}from"./Form.ff60b0b9.js";import"./index.cf4c23b9.js";import"./record.d584e714.js";import"./pubsub.e099f5f1.js";import"./Base.3448c1ef.js";import"./hasIn.892e96d0.js";(function(){try{var u=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},s=new Error().stack;s&&(u._sentryDebugIds=u._sentryDebugIds||{},u._sentryDebugIds[s]="f386e891-4914-4109-8faa-015a76face12",u._sentryDebugIdIdentifier="sentry-dbid-f386e891-4914-4109-8faa-015a76face12")}catch{}})();const L=k({__name:"SaveButton",props:{model:{},disabled:{type:Boolean}},emits:["error"],setup(u,{emit:s}){const l=u,d=y(!1),v=y(null);async function c(){d.value=!0;try{await l.model.save()}catch(o){o instanceof Error&&(s("error",o),F.error({message:"Error",description:o.message}),v.value=o)}finally{d.value=!1}}return addEventListener("keydown",o=>{(o.metaKey||o.ctrlKey)&&o.key==="s"&&(o.preventDefault(),c())}),addEventListener("beforeunload",o=>{l.model.hasChanges()&&(o.preventDefault(),o.returnValue="")}),(o,b)=>{var g,r,p;return h(),S(e(T),{class:P(["save-button",{changes:(g=o.model)==null?void 0:g.hasChanges()}]),loading:d.value,disabled:(p=o.disabled)!=null?p:!((r=o.model)!=null&&r.hasChanges()),onClick:b[0]||(b[0]=A=>c())},{default:a(()=>[n(" Save ")]),_:1},8,["class","loading","disabled"])}}}),R={key:0},K=k({__name:"SubdomainEditor",props:{project:{}},setup(u){const s=u,l=y(void 0),d=H.exports.debounce(async()=>{try{const{available:r}=await s.project.checkSubdomain();l.value=r?"available":"unavailable"}catch{l.value=void 0}},500);function v(){s.project.subdomain?(l.value="loading",d()):l.value="invalid"}const c=w(()=>{switch(l.value){case"invalid":return"error";case"loading":return"validating";case"available":return"success";case"unavailable":return"error";default:return}}),o=w(()=>{switch(l.value){case"loading":return"Checking availability...";case"available":return"Available";case"unavailable":return"Unavailable";case"invalid":return"Invalid subdomain";default:return}}),b=()=>{s.project.subdomain=E.formatSubdomain(s.project.subdomain),v()};function g(){s.project.resetChanges(),l.value=void 0}return(r,p)=>(h(),S(e(V),{direction:"vertical"},{default:a(()=>[t(e(j),{level:2},{default:a(()=>[n("Subdomain")]),_:1}),t(e(C),null,{default:a(()=>[n(" Every project in Abstra Cloud comes with a default subdomain, which will appear on all shared project links. ")]),_:1}),t(e(_),null,{default:a(()=>[t(e(i),null,{default:a(()=>[n("Forms available at:")]),_:1}),t(e(i),{code:""},{default:a(()=>[m("span",null,f(r.project.getUrl("[PATH]")),1)]),_:1})]),_:1}),t(e(_),null,{default:a(()=>[t(e(i),null,{default:a(()=>[n("Hooks available at:")]),_:1}),t(e(i),{code:""},{default:a(()=>[m("span",null,f(r.project.getUrl("_hooks/[PATH]")),1)]),_:1})]),_:1}),t(e(z),null,{default:a(()=>[t(e($),{"validate-status":c.value,help:o.value,"has-feedback":""},{default:a(()=>[t(e(U),{value:r.project.subdomain,"onUpdate:value":p[0]||(p[0]=A=>r.project.subdomain=A),type:"text",loading:l.value==="loading",onBlur:b},{addonBefore:a(()=>[n("https://")]),addonAfter:a(()=>[n(".abstra.app")]),_:1},8,["value","loading"])]),_:1},8,["validate-status","help"]),t(L,{model:r.project,disabled:l.value!=="available",onError:g},null,8,["model","disabled"])]),_:1}),r.project.customDomain?(h(),D("div",R,[t(e(j),{level:2},{default:a(()=>[n("Custom Domain")]),_:1}),t(e(C),null,{default:a(()=>[n(" Your project also has a custom domain: "),t(e(i),{code:""},{default:a(()=>[m("span",null,f(r.project.customDomain),1)]),_:1})]),_:1}),t(e(_),null,{default:a(()=>[t(e(i),null,{default:a(()=>[n("Forms available at:")]),_:1}),t(e(i),{code:""},{default:a(()=>[m("span",null,f(r.project.getCustomDomainUrl("[PATH]")),1)]),_:1})]),_:1}),t(e(_),null,{default:a(()=>[t(e(i),null,{default:a(()=>[n("Hooks available at:")]),_:1}),t(e(i),{code:""},{default:a(()=>[m("span",null,f(r.project.getCustomDomainUrl("_hooks/[PATH]")),1)]),_:1})]),_:1})])):B("",!0)]),_:1}))}}),q={key:0,class:"project-settings"},re=k({__name:"ProjectSettings",setup(u){const l=N().params.projectId,{result:d}=I(()=>E.get(l));return(v,c)=>e(d)?(h(),D("div",q,[t(e(j),null,{default:a(()=>[n("Project Settings")]),_:1}),t(K,{project:e(d)},null,8,["project"])])):B("",!0)}});export{re as default};
//# sourceMappingURL=ProjectSettings.81a48fe1.js.map
