import{a as C}from"./asyncComputed.376cdc00.js";import{P as S}from"./project.5033d689.js";import"./console.a87f2a82.js";import{d as h,r as b,b as g,c as w,w as o,aJ as n,ey as I,u as a,c4 as E,cG as B,t as D,J as y,f as r,e as _,eC as j,bZ as T,eA as P,et as F,ew as V}from"./outputWidgets.c072fe4e.js";import"./index.90440471.js";import{n as N}from"./index.00103e26.js";import{c as A,A as H}from"./Title.e3dcb8ea.js";import{A as R,a as f}from"./index.4cff163b.js";import{A as k}from"./index.2e3640f1.js";import{F as $}from"./Form.9f52866c.js";import{A as x}from"./index.ec8e038a.js";import"./gateway.18ca6e0a.js";import"./activeRecord.fdc25b97.js";import"./pubsub.98ad9fe0.js";import"./CollapsePanel.ecfd8c73.js";import"./index.d808811c.js";import"./index.dce83dc7.js";import"./dayjs.a56ae918.js";import"./index.4e6af937.js";import"./index.8ab39784.js";import"./TabPane.df5f41ca.js";import"./index.c5fd7926.js";import"./index.148bcdd7.js";import"./index.d9c3e0de.js";import"./index.e5a5efcd.js";import"./index.e7c5574b.js";import"./index.96de14c0.js";import"./index.28ce0851.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]="ea44d9ca-5251-49ce-afa0-a64048704230",i._sentryDebugIdIdentifier="sentry-dbid-ea44d9ca-5251-49ce-afa0-a64048704230")}catch{}})();const J=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]=q=>d())},{default:o(()=>[n(" Save ")]),_:1},8,["class","loading","disabled"])}}}),K=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=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(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(J,{model:s.project,disabled:t.value!=="available",onError:m},null,8,["model","disabled"])]),_:1})]),_:1}))}}),L={key:0,class:"project-settings"},ge=h({__name:"ProjectSettings",setup(i){const t=P().params.projectId,{result:u}=C(()=>S.get(t));return(c,d)=>a(u)?(g(),F("div",L,[r(a(A),null,{default:o(()=>[n("Project Settings")]),_:1}),r(K,{project:a(u)},null,8,["project"])])):V("",!0)}});export{ge as default};
//# sourceMappingURL=ProjectSettings.b68f18bf.js.map
