import{a as C}from"./asyncComputed.9bda3979.js";import{P as S}from"./project.c2b2df99.js";import"./console.ee73e2aa.js";import{d as h,r as b,b as g,c as w,w as o,b2 as n,ey as I,u as a,cd as E,cN as B,t as D,J as y,f as r,e as _,eC as j,c6 as T,eA as P,et as F,ew as N}from"./outputWidgets.b9aa154a.js";import"./index.4d631048.js";import{n as V}from"./index.ade1bec6.js";import{c as A,A as H}from"./Title.6cd833fd.js";import{A as R,a as f}from"./index.55488473.js";import{A as k}from"./index.23063916.js";import{F as $}from"./Form.55f226f4.js";import{A as x}from"./index.6b140cad.js";import"./gateway.5aa82c5f.js";import"./activeRecord.8939db5d.js";import"./pubsub.967f482a.js";import"./index.74d4e484.js";import"./index.29aa7167.js";import"./dayjs.d2a09bae.js";import"./index.ea68e603.js";import"./index.bb85a084.js";import"./TabPane.3d00468a.js";import"./index.ab1855db.js";import"./index.14f3ef13.js";import"./index.eb23b22d.js";import"./index.45ef6041.js";import"./index.45ac8fb9.js";import"./index.004b987c.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]="e44aaab2-06b4-41d9-ae09-320624f8a828",i._sentryDebugIdIdentifier="sentry-dbid-e44aaab2-06b4-41d9-ae09-320624f8a828")}catch{}})();const K=h({__name:"SaveButton",props:{model:{},disabled:{type:Boolean}},emits:["error"],setup(i,{emit:l}){const t=i,u=b(!1),c=b(null);async function d(){u.value=!0;try{await t.model.save()}catch(e){e instanceof Error&&(l("error",e),B.error({message:"Error",description:e.message}),c.value=e)}finally{u.value=!1}}return addEventListener("keydown",e=>{(e.metaKey||e.ctrlKey)&&e.key==="s"&&(e.preventDefault(),d())}),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:u.value,disabled:(v=e.disabled)!=null?v:!((s=e.model)!=null&&s.hasChanges()),onClick:p[0]||(p[0]=z=>d())},{default:o(()=>[n(" Save ")]),_:1},8,["class","loading","disabled"])}}}),L=h({__name:"SubdomainEditor",props:{project:{}},setup(i){const l=i,t=b(void 0),u=D.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",u()):t.value="invalid"}const d=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=V(s.target.value,{replacement:"-",lower:!0,strict:!0}),c()};function m(){l.project.resetChanges(),t.value=void 0}return(s,v)=>(g(),w(a(x),{direction:"vertical"},{default:o(()=>[r(a(A),{level:2},{default:o(()=>[n("Subdomain")]),_:1}),r(a(R),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($),null,{default:o(()=>[r(a(H),{"validate-status":d.value,help:e.value,"has-feedback":""},{default:o(()=>[r(a(T),{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(K,{model:s.project,disabled:t.value!=="available",onError:m},null,8,["model","disabled"])]),_:1})]),_:1}))}}),q={key:0,class:"project-settings"},be=h({__name:"ProjectSettings",setup(i){const t=P().params.projectId,{result:u}=C(()=>S.get(t));return(c,d)=>a(u)?(g(),F("div",q,[r(a(A),null,{default:o(()=>[n("Project Settings")]),_:1}),r(L,{project:a(u)},null,8,["project"])])):N("",!0)}});export{be as default};
//# sourceMappingURL=ProjectSettings.81b3f405.js.map
