import{a as D}from"./asyncComputed.47aec2b5.js";import{g as v}from"./router.4dfadf5d.js";import{f as t,e7 as T,f4 as x,d as j,r as B,ej as E,c as p,a as F,b as l,u as n,o as y,g as u,A as S,d7 as N,d8 as c,e as g,ed as h,cx as V,dc as U,bJ as H,aV as R,cw as $,eb as q,a5 as J,h as M}from"./jwt-decode.esm.54a1ea22.js";import{a as C}from"./project.1b8374f4.js";import"./tables.1bcb1140.js";import{S as z}from"./SaveButton.428227de.js";import{A as G}from"./index.966ac1b9.js";import"./index.c7a996a6.js";import"./record.e83a2eb2.js";import"./string.61e11a30.js";import"./ExclamationCircleOutlined.d0aa47da.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},o=new Error().stack;o&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[o]="19d3f70b-4002-47f5-9587-37ae0de78b39",r._sentryDebugIdIdentifier="sentry-dbid-19d3f70b-4002-47f5-9587-37ae0de78b39")}catch{}})();function _(r){for(var o=1;o<arguments.length;o++){var e=arguments[o]!=null?Object(arguments[o]):{},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){L(r,i,e[i])})}return r}function L(r,o,e){return o in r?Object.defineProperty(r,o,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[o]=e,r}var f=function(o,e){var a=_({},o,e.attrs);return t(T,_({},a,{icon:x}),null)};f.displayName="CopyOutlined";f.inheritAttrs=!1;const Q=f,W=j({__name:"SubdomainEditor",props:{project:{}},emits:["change-subdomain"],setup(r,{emit:o}){const e=r,a=B(void 0),i=E.exports.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 b=p(()=>a.value!=="available"||!e.project.hasChangesDeep("subdomain")),w=async()=>{await navigator.clipboard.writeText(e.project.getUrl())},A=p(()=>{switch(a.value){case"invalid":return"error";case"loading":return"validating";case"available":return"success";case"unavailable":return"error";default:return}}),k=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);o("change-subdomain",s),d()};function P(){e.project.resetChanges(),a.value=void 0}return(s,m)=>(y(),F(n(G),{direction:"vertical"},{default:l(()=>[t(n(S),{level:2},{default:l(()=>[u("Subdomain")]),_:1}),t(n(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(n(v),null,{default:l(()=>[t(n(c),null,{default:l(()=>[u("Forms available at:")]),_:1}),t(n(c),{code:""},{default:l(()=>[g("span",null,h(s.project.getUrl("[PATH]")),1)]),_:1})]),_:1}),t(n(v),null,{default:l(()=>[t(n(c),null,{default:l(()=>[u("Hooks available at:")]),_:1}),t(n(c),{code:""},{default:l(()=>[g("span",null,h(s.project.getUrl("_hooks/[PATH]")),1)]),_:1})]),_:1}),t(n($),null,{default:l(()=>[t(n(V),{"validate-status":A.value,help:k.value,"has-feedback":""},{default:l(()=>[t(n(U),{gap:"middle"},{default:l(()=>[t(n(H),{value:s.project.subdomain,type:"text",loading:a.value==="loading",onBlur:O,onChange:m[0]||(m[0]=I=>o("change-subdomain",I.target.value))},{addonBefore:l(()=>[u("https://")]),addonAfter:l(()=>[u(".abstra.app/")]),_:1},8,["value","loading"]),t(n(R),{placement:"top",title:"Copy"},{default:l(()=>[t(n(Q),{color:"red",onClick:w})]),_:1})]),_:1})]),_:1},8,["validate-status","help"]),t(z,{model:s.project,disabled:b.value,onError:P},null,8,["model","disabled"])]),_:1})]),_:1}))}}),X={key:0,class:"project-settings"},ie=j({__name:"ProjectSettings",setup(r){const e=q().params.projectId,{result:a}=D(()=>C.get(e)),i=d=>{a.value.subdomain=d};return(d,b)=>n(a)?(y(),J("div",X,[t(n(S),null,{default:l(()=>[u("Project Settings")]),_:1}),t(W,{project:n(a),onChangeSubdomain:i},null,8,["project"])])):M("",!0)}});export{ie as default};
//# sourceMappingURL=ProjectSettings.d065c292.js.map
