import{a as D}from"./asyncComputed-IJY6wgme.js";import{d as v}from"./router-D5wfdag3.js";import{g as t,I as E,bd as B,d as j,r as T,N as x,e as p,B as F,m as y,G as l,D as o,Y as S,$ as u,aq as N,Z as c,q as g,V as h,aj as V,ak as U,M as q,al as H,E as R,S as $,l as M,p as G}from"./jwt-decode.esm-Dca5fHH5.js";import{P as C}from"./project-BZzoNeQM.js";import"./tables-BsqTY_wE.js";import{S as Y}from"./SaveButton-O5UjZDE_.js";import{S as Z}from"./index-ZQBk4l6i.js";import"./index-Cyx2lZTa.js";import"./record-BZIfMWML.js";import"./string-BYR4BIXr.js";import"./ExclamationCircleOutlined-BoIpZd7Q.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},n=new Error().stack;n&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[n]="d7ec44f4-30f5-425b-9244-a8657600c853",r._sentryDebugIdIdentifier="sentry-dbid-d7ec44f4-30f5-425b-9244-a8657600c853")}catch{}})();function _(r){for(var n=1;n<arguments.length;n++){var e=arguments[n]!=null?Object(arguments[n]):{},a=Object.keys(e);typeof Object.getOwnPropertySymbols=="function"&&(a=a.concat(Object.getOwnPropertySymbols(e).filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable}))),a.forEach(function(i){z(r,i,e[i])})}return r}function z(r,n,e){return n in r?Object.defineProperty(r,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[n]=e,r}var m=function(n,e){var a=_({},n,e.attrs);return t(E,_({},a,{icon:B}),null)};m.displayName="CopyOutlined";m.inheritAttrs=!1;const J=j({__name:"SubdomainEditor",props:{project:{}},emits:["change-subdomain"],setup(r,{emit:n}){const e=r,a=T(void 0),i=x.debounce(async()=>{try{const{available:s}=await e.project.checkSubdomain();a.value=s?"available":"unavailable"}catch{a.value=void 0}},500);function d(){if(!e.project.hasChangesDeep("subdomain")){a.value=void 0;return}e.project.subdomain?(a.value="loading",i()):a.value="invalid"}const f=p(()=>a.value!=="available"||!e.project.hasChangesDeep("subdomain")),w=async()=>{await navigator.clipboard.writeText(e.project.getUrl())},k=p(()=>{switch(a.value){case"invalid":return"error";case"loading":return"validating";case"available":return"success";case"unavailable":return"error";default:return}}),P=p(()=>{switch(a.value){case"loading":return"Checking availability...";case"available":return"Available";case"unavailable":return"Unavailable";case"invalid":return"Invalid subdomain";default:return}}),O=()=>{const s=C.formatSubdomain(e.project.subdomain);n("change-subdomain",s),d()};function I(){e.project.resetChanges(),a.value=void 0}return(s,b)=>(y(),F(o(Z),{direction:"vertical"},{default:l(()=>[t(o(S),{level:2},{default:l(()=>[u("Subdomain")]),_:1}),t(o(N),null,{default:l(()=>[u(" Every project in Abstra Cloud comes with a default subdomain, which will appear on all shared project links. ")]),_:1}),t(o(v),null,{default:l(()=>[t(o(c),null,{default:l(()=>[u("Forms available at:")]),_:1}),t(o(c),{code:""},{default:l(()=>[g("span",null,h(s.project.getUrl("[PATH]")),1)]),_:1})]),_:1}),t(o(v),null,{default:l(()=>[t(o(c),null,{default:l(()=>[u("Hooks available at:")]),_:1}),t(o(c),{code:""},{default:l(()=>[g("span",null,h(s.project.getUrl("_hooks/[PATH]")),1)]),_:1})]),_:1}),t(o(V),null,{default:l(()=>[t(o(U),{"validate-status":k.value,help:P.value,"has-feedback":""},{default:l(()=>[t(o(q),{gap:"middle"},{default:l(()=>[t(o(H),{value:s.project.subdomain,type:"text",loading:a.value==="loading",onBlur:O,onChange:b[0]||(b[0]=A=>n("change-subdomain",A.target.value))},{addonBefore:l(()=>[u("https://")]),addonAfter:l(()=>[u(".abstra.app/")]),_:1},8,["value","loading"]),t(o(R),{placement:"top",title:"Copy"},{default:l(()=>[t(o(m),{color:"red",onClick:w})]),_:1})]),_:1})]),_:1},8,["validate-status","help"]),t(Y,{model:s.project,disabled:f.value,onError:I},null,8,["model","disabled"])]),_:1})]),_:1}))}}),L={key:0,class:"project-settings"},se=j({__name:"ProjectSettings",setup(r){const e=$().params.projectId,{result:a}=D(()=>C.get(e)),i=d=>{a.value.subdomain=d};return(d,f)=>o(a)?(y(),M("div",L,[t(o(S),null,{default:l(()=>[u("Project Settings")]),_:1}),t(J,{project:o(a),onChangeSubdomain:i},null,8,["project"])])):G("",!0)}});export{se as default};
//# sourceMappingURL=ProjectSettings-BTIKgfBs.js.map
