import{a as T}from"./asyncComputed.7bc1692e.js";import{g}from"./router.a8616541.js";import{f as n,ee as x,f8 as B,d as y,r as E,en as F,c as b,a as N,b as i,u as e,o as S,g as d,t as c,i as l,A as C,de as V,df as m,e as h,cE as R,dj as U,bQ as $,b0 as H,cD as q,ei as M,ac as Q,h as z}from"./jwt-decode.esm.c9c37cdc.js";import{a as w}from"./project.9a068e8d.js";import"./tables.2e1c934b.js";import{S as G}from"./SaveButton.c3f2a4bb.js";import{A as J}from"./index.bc97991a.js";import"./index.da4f9d54.js";import"./record.a33d29b1.js";import"./string.8fab6b53.js";import"./ExclamationCircleOutlined.5d5c3f30.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]="b6a084ec-aec7-4663-9188-0e031a02ca49",r._sentryDebugIdIdentifier="sentry-dbid-b6a084ec-aec7-4663-9188-0e031a02ca49")}catch{}})();function j(r){for(var o=1;o<arguments.length;o++){var a=arguments[o]!=null?Object(arguments[o]):{},t=Object.keys(a);typeof Object.getOwnPropertySymbols=="function"&&(t=t.concat(Object.getOwnPropertySymbols(a).filter(function(u){return Object.getOwnPropertyDescriptor(a,u).enumerable}))),t.forEach(function(u){L(r,u,a[u])})}return r}function L(r,o,a){return o in r?Object.defineProperty(r,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[o]=a,r}var f=function(o,a){var t=j({},o,a.attrs);return n(x,j({},t,{icon:B}),null)};f.displayName="CopyOutlined";f.inheritAttrs=!1;const W=f,X=y({__name:"SubdomainEditor",props:{project:{}},emits:["change-subdomain"],setup(r,{emit:o}){const a=r,t=E(void 0),u=F.exports.debounce(async()=>{try{const{available:s}=await a.project.checkSubdomain();t.value=s?"available":"unavailable"}catch{t.value=void 0}},500);function p(){if(!a.project.hasChangesDeep("subdomain")){t.value=void 0;return}a.project.subdomain?(t.value="loading",u()):t.value="invalid"}const v=b(()=>t.value!=="available"||!a.project.hasChangesDeep("subdomain")),A=async()=>{await navigator.clipboard.writeText(a.project.getUrl())},O=b(()=>{switch(t.value){case"invalid":return"error";case"loading":return"validating";case"available":return"success";case"unavailable":return"error";default:return}}),k=b(()=>{switch(t.value){case"loading":return l.translate("i18n_subdomaineditor_checking");case"available":return l.translate("i18n_subdomaineditor_available");case"unavailable":return l.translate("i18n_subdomaineditor_unavailable");case"invalid":return l.translate("i18n_subdomaineditor_invalid");default:return}}),P=()=>{const s=w.formatSubdomain(a.project.subdomain);o("change-subdomain",s),p()};function D(){a.project.resetChanges(),t.value=void 0}return(s,_)=>(S(),N(e(J),{direction:"vertical"},{default:i(()=>[n(e(C),{level:2},{default:i(()=>[d(c(e(l).translate("i18n_subdomaineditor_title")),1)]),_:1}),n(e(V),null,{default:i(()=>[d(c(e(l).translate("i18n_subdomaineditor_description")),1)]),_:1}),n(e(g),null,{default:i(()=>[n(e(m),null,{default:i(()=>[d(c(e(l).translate("i18n_subdomaineditor_forms_available")),1)]),_:1}),n(e(m),{code:""},{default:i(()=>[h("span",null,c(s.project.getUrl("[PATH]")),1)]),_:1})]),_:1}),n(e(g),null,{default:i(()=>[n(e(m),null,{default:i(()=>[d(c(e(l).translate("i18n_subdomaineditor_hooks_available")),1)]),_:1}),n(e(m),{code:""},{default:i(()=>[h("span",null,c(s.project.getUrl("_hooks/[PATH]")),1)]),_:1})]),_:1}),n(e(q),null,{default:i(()=>[n(e(R),{"validate-status":O.value,help:k.value,"has-feedback":""},{default:i(()=>[n(e(U),{gap:"middle"},{default:i(()=>[n(e($),{value:s.project.subdomain,type:"text",loading:t.value==="loading",onBlur:P,onChange:_[0]||(_[0]=I=>o("change-subdomain",I.target.value))},{addonBefore:i(()=>[d("https://")]),addonAfter:i(()=>[d(".abstra.app/")]),_:1},8,["value","loading"]),n(e(H),{placement:"top",title:e(l).translate("i18n_subdomaineditor_copy")},{default:i(()=>[n(e(W),{color:"red",onClick:A})]),_:1},8,["title"])]),_:1})]),_:1},8,["validate-status","help"]),n(G,{model:s.project,disabled:v.value,onError:D},null,8,["model","disabled"])]),_:1})]),_:1}))}}),Y={key:0,class:"project-settings"},ue=y({__name:"ProjectSettings",setup(r){const a=M().params.projectId,{result:t}=T(()=>w.get(a)),u=p=>{t.value.subdomain=p};return(p,v)=>e(t)?(S(),Q("div",Y,[n(e(C),null,{default:i(()=>[d(c(e(l).translate("i18n_projectsettingsview_title")),1)]),_:1}),n(X,{project:e(t),onChangeSubdomain:u},null,8,["project"])])):z("",!0)}});export{ue as default};
//# sourceMappingURL=ProjectSettings.f8c6f60a.js.map
