import{a as T}from"./asyncComputed.29ba9357.js";import{g}from"./router.95e6e4b6.js";import{f as n,ex as B,fv as E,d as y,r as F,eH as N,c as f,a as V,b as i,u as e,o as S,g as d,t as u,i as s,A as C,de as H,df as b,e as h,cE as R,dj as U,bQ as $,b0 as q,cD as M,ac as Q,h as z,eA as G}from"./jwt-decode.esm.7c9b757c.js";import{a as w}from"./project.b76602c4.js";import"./tables.4a013a6e.js";import{S as J}from"./SaveButton.4ee075ff.js";import{b as L}from"./index.b636bb44.js";import"./index.33534fc9.js";import"./record.c6bfac6e.js";import"./string.fea0919a.js";import"./ExclamationCircleOutlined.a946d051.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},r=new Error().stack;r&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[r]="34ae78e5-847f-49bd-9479-b5a3a16edaf9",t._sentryDebugIdIdentifier="sentry-dbid-34ae78e5-847f-49bd-9479-b5a3a16edaf9")}catch{}})();function j(t){for(var r=1;r<arguments.length;r++){var a=arguments[r]!=null?Object(arguments[r]):{},l=Object.keys(a);typeof Object.getOwnPropertySymbols=="function"&&(l=l.concat(Object.getOwnPropertySymbols(a).filter(function(o){return Object.getOwnPropertyDescriptor(a,o).enumerable}))),l.forEach(function(o){W(t,o,a[o])})}return t}function W(t,r,a){return r in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a,t}var v=function(r,a){var l=j({},r,a.attrs);return n(B,j({},l,{icon:E}),null)};v.displayName="CopyOutlined";v.inheritAttrs=!1;const X=v,Y=y({__name:"SubdomainEditor",props:{project:{}},emits:["change-subdomain"],setup(t,{emit:r}){const a=t,l=r,o=F(void 0),m=N.exports.debounce(async()=>{try{const{available:p}=await a.project.checkSubdomain();o.value=p?"available":"unavailable"}catch{o.value=void 0}},500);function _(){if(!a.project.hasChangesDeep("subdomain")){o.value=void 0;return}a.project.subdomain?(o.value="loading",m()):o.value="invalid"}const A=f(()=>o.value!=="available"||!a.project.hasChangesDeep("subdomain")),O=async()=>{await navigator.clipboard.writeText(a.project.getUrl())},k=f(()=>{switch(o.value){case"invalid":return"error";case"loading":return"validating";case"available":return"success";case"unavailable":return"error";default:return}}),x=f(()=>{switch(o.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}}),P=()=>{const p=w.formatSubdomain(a.project.subdomain);l("change-subdomain",p),_()};function D(){a.project.resetChanges(),o.value=void 0}return(p,c)=>(S(),V(e(L),{direction:"vertical"},{default:i(()=>[n(e(C),{level:2},{default:i(()=>[d(u(e(s).translate("i18n_subdomaineditor_title")),1)]),_:1}),n(e(H),null,{default:i(()=>[d(u(e(s).translate("i18n_subdomaineditor_description")),1)]),_:1}),n(e(g),null,{default:i(()=>[n(e(b),null,{default:i(()=>[d(u(e(s).translate("i18n_subdomaineditor_forms_available")),1)]),_:1}),n(e(b),{code:""},{default:i(()=>[h("span",null,u(t.project.getUrl("[PATH]")),1)]),_:1})]),_:1}),n(e(g),null,{default:i(()=>[n(e(b),null,{default:i(()=>[d(u(e(s).translate("i18n_subdomaineditor_hooks_available")),1)]),_:1}),n(e(b),{code:""},{default:i(()=>[h("span",null,u(t.project.getUrl("_hooks/[PATH]")),1)]),_:1})]),_:1}),n(e(M),null,{default:i(()=>[n(e(R),{"validate-status":k.value,help:x.value,"has-feedback":""},{default:i(()=>[n(e(U),{gap:"middle"},{default:i(()=>[n(e($),{value:t.project.subdomain,type:"text",loading:o.value==="loading",onBlur:P,onChange:c[0]||(c[0]=I=>l("change-subdomain",I.target.value))},{addonBefore:i(()=>[...c[1]||(c[1]=[d("https://",-1)])]),addonAfter:i(()=>[...c[2]||(c[2]=[d(".abstra.app/",-1)])]),_:1},8,["value","loading"]),n(e(q),{placement:"top",title:e(s).translate("i18n_subdomaineditor_copy")},{default:i(()=>[n(e(X),{color:"red",onClick:O})]),_:1},8,["title"])]),_:1})]),_:1},8,["validate-status","help"]),n(J,{model:t.project,disabled:A.value,onError:D},null,8,["model","disabled"])]),_:1})]),_:1}))}}),Z={key:0,class:"project-settings"},ue=y({__name:"ProjectSettings",setup(t){const a=G().params.projectId,{result:l}=T(()=>w.get(a)),o=m=>{l.value.subdomain=m};return(m,_)=>e(l)?(S(),Q("div",Z,[n(e(C),null,{default:i(()=>[d(u(e(s).translate("i18n_projectsettingsview_title")),1)]),_:1}),n(Y,{project:e(l),onChangeSubdomain:o},null,8,["project"])])):z("",!0)}});export{ue as default};
//# sourceMappingURL=ProjectSettings.9d56ae2e.js.map
