import{c as _}from"./router-W58Zb32N.js";import{v as o,I,bB as B,e as j,r as D,ac as F,b as p,l as s,n as N,g as y,w as l,p as a,am as S,q as u,t as d,bl as V,T as f,k as g,ah as R,ai as U,E as q,aj as H,A as $,s as M,b9 as z,f as G,j as J}from"./jwt-decode.esm-CzNJpMna.js";import{a as w}from"./project-CUN2uQd6.js";import"./tables-B14bH8Kr.js";import{u as L}from"./projectStore-1e9Bdcb1.js";import{S as Q}from"./SaveButton-BzqbycQT.js";import{S as W}from"./index-2y0Q0tZ3.js";import"./ts.worker-yzRZJ3oC.js";import"./string-KT3da_dt.js";import"./organizationSwitcher-CIDAicHA.js";import"./organization-Dv2gjYZs.js";import"./ExclamationCircleOutlined-B2yXPxfh.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},r=new Error().stack;r&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[r]="199c3690-c664-43fe-94c7-29dca3f0e344",n._sentryDebugIdIdentifier="sentry-dbid-199c3690-c664-43fe-94c7-29dca3f0e344")}catch{}})();function h(n){for(var r=1;r<arguments.length;r++){var e=arguments[r]!=null?Object(arguments[r]):{},i=Object.keys(e);typeof Object.getOwnPropertySymbols=="function"&&(i=i.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.forEach(function(t){X(n,t,e[t])})}return n}function X(n,r,e){return r in n?Object.defineProperty(n,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[r]=e,n}var b=function(r,e){var i=h({},r,e.attrs);return o(I,h({},i,{icon:B}),null)};b.displayName="CopyOutlined";b.inheritAttrs=!1;const Y=j({__name:"SubdomainEditor",props:{project:{}},emits:["change-subdomain"],setup(n,{emit:r}){const e=n,i=r,t=D(void 0),v=F.debounce(async()=>{try{const{available:m}=await e.project.checkSubdomain();t.value=m?"available":"unavailable"}catch{t.value=void 0}},500);function P(){if(!e.project.hasChanges("subdomain")){t.value=void 0;return}e.project.subdomain?(t.value="loading",v()):t.value="invalid"}const k=p(()=>t.value!=="available"||!e.project.hasChanges("subdomain")),C=async()=>{await navigator.clipboard.writeText(e.project.getUrl())},O=p(()=>{switch(t.value){case"invalid":return"error";case"loading":return"validating";case"available":return"success";case"unavailable":return"error";default:return}}),x=p(()=>{switch(t.value){case"loading":return s.translate("i18n_subdomaineditor_checking");case"available":return s.translate("i18n_subdomaineditor_available");case"unavailable":return s.translate("i18n_subdomaineditor_unavailable");case"invalid":return s.translate("i18n_subdomaineditor_invalid");default:return}}),T=()=>{const m=w.formatSubdomain(e.project.subdomain);i("change-subdomain",m),P()};function A(){e.project.resetChanges(),t.value=void 0}return(m,c)=>(y(),N(a(W),{direction:"vertical"},{default:l(()=>[o(a(S),{level:2},{default:l(()=>[u(d(a(s).translate("i18n_subdomaineditor_title")),1)]),_:1}),o(a(V),null,{default:l(()=>[u(d(a(s).translate("i18n_subdomaineditor_description")),1)]),_:1}),o(a(_),null,{default:l(()=>[o(a(f),null,{default:l(()=>[u(d(a(s).translate("i18n_subdomaineditor_forms_available")),1)]),_:1}),o(a(f),{code:""},{default:l(()=>[g("span",null,d(n.project.getUrl("[PATH]")),1)]),_:1})]),_:1}),o(a(_),null,{default:l(()=>[o(a(f),null,{default:l(()=>[u(d(a(s).translate("i18n_subdomaineditor_hooks_available")),1)]),_:1}),o(a(f),{code:""},{default:l(()=>[g("span",null,d(n.project.getUrl("_hooks/[PATH]")),1)]),_:1})]),_:1}),o(a(R),null,{default:l(()=>[o(a(U),{"validate-status":O.value,help:x.value,"has-feedback":""},{default:l(()=>[o(a(q),{gap:"middle"},{default:l(()=>[o(a(H),{value:n.project.subdomain,type:"text",loading:t.value==="loading",onBlur:T,onChange:c[0]||(c[0]=E=>i("change-subdomain",E.target.value))},{addonBefore:l(()=>[...c[1]||(c[1]=[u("https://",-1)])]),addonAfter:l(()=>[...c[2]||(c[2]=[u(".abstra.app/",-1)])]),_:1},8,["value","loading"]),o(a($),{placement:"top",title:a(s).translate("i18n_subdomaineditor_copy")},{default:l(()=>[o(a(b),{color:"red",onClick:C})]),_:1},8,["title"])]),_:1})]),_:1},8,["validate-status","help"]),o(Q,{model:n.project,disabled:k.value,onError:A},null,8,["model","disabled"])]),_:1})]),_:1}))}}),Z={key:0,class:"project-settings"},ce=j({__name:"ProjectSettings",setup(n){const r=L(),e=M(null);z(()=>{const t=r.project;t&&!e.value&&(e.value=w.fromDTO(t))});const i=t=>{e.value&&(e.value.subdomain=t)};return(t,v)=>e.value?(y(),G("div",Z,[o(a(S),null,{default:l(()=>[u(d(a(s).translate("i18n_projectsettingsview_title")),1)]),_:1}),o(Y,{project:e.value,onChangeSubdomain:i},null,8,["project"])])):J("",!0)}});export{ce as default};
//# sourceMappingURL=ProjectSettings-C6lQ41CK.js.map
