import{a as B}from"./asyncComputed-D5HqUDwR.js";import{d as g}from"./router-BhKBgDIv.js";import{j as n,I as D,bu as E,a as y,r as F,a9 as N,c as f,af as s,p as U,e as S,w as i,u as e,aj as w,S as u,U as d,aQ as V,ak as b,h,aJ as R,aK as H,v as $,aL as q,A as J,ac as L,b as M,g as Q}from"./jwt-decode.esm-DyyavT6h.js";import{P as C}from"./project-DU7AsmUe.js";import"./tables-sMYALme4.js";import{S as z}from"./SaveButton-B1RTX8sL.js";import{S as G}from"./index-DdqJ9EQR.js";import"./ts.worker-Do44s_XH.js";import"./record-Dva_8M1P.js";import"./string-C33uYcCb.js";import"./ExclamationCircleOutlined-xUHIZHGs.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},r=new Error().stack;r&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[r]="433ee15e-0642-4194-8014-8aeb775c9bd1",a._sentryDebugIdIdentifier="sentry-dbid-433ee15e-0642-4194-8014-8aeb775c9bd1")}catch{}})();function j(a){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?Object(arguments[r]):{},l=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(l=l.concat(Object.getOwnPropertySymbols(t).filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),l.forEach(function(o){W(a,o,t[o])})}return a}function W(a,r,t){return r in a?Object.defineProperty(a,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[r]=t,a}var v=function(r,t){var l=j({},r,t.attrs);return n(D,j({},l,{icon:E}),null)};v.displayName="CopyOutlined";v.inheritAttrs=!1;const X=y({__name:"SubdomainEditor",props:{project:{}},emits:["change-subdomain"],setup(a,{emit:r}){const t=a,l=r,o=F(void 0),p=N.debounce(async()=>{try{const{available:m}=await t.project.checkSubdomain();o.value=m?"available":"unavailable"}catch{o.value=void 0}},500);function _(){if(!t.project.hasChanges("subdomain")){o.value=void 0;return}t.project.subdomain?(o.value="loading",p()):o.value="invalid"}const k=f(()=>o.value!=="available"||!t.project.hasChanges("subdomain")),P=async()=>{await navigator.clipboard.writeText(t.project.getUrl())},O=f(()=>{switch(o.value){case"invalid":return"error";case"loading":return"validating";case"available":return"success";case"unavailable":return"error";default:return}}),I=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}}),x=()=>{const m=C.formatSubdomain(t.project.subdomain);l("change-subdomain",m),_()};function A(){t.project.resetChanges(),o.value=void 0}return(m,c)=>(S(),U(e(G),{direction:"vertical"},{default:i(()=>[n(e(w),{level:2},{default:i(()=>[u(d(e(s).translate("i18n_subdomaineditor_title")),1)]),_:1}),n(e(V),null,{default:i(()=>[u(d(e(s).translate("i18n_subdomaineditor_description")),1)]),_:1}),n(e(g),null,{default:i(()=>[n(e(b),null,{default:i(()=>[u(d(e(s).translate("i18n_subdomaineditor_forms_available")),1)]),_:1}),n(e(b),{code:""},{default:i(()=>[h("span",null,d(a.project.getUrl("[PATH]")),1)]),_:1})]),_:1}),n(e(g),null,{default:i(()=>[n(e(b),null,{default:i(()=>[u(d(e(s).translate("i18n_subdomaineditor_hooks_available")),1)]),_:1}),n(e(b),{code:""},{default:i(()=>[h("span",null,d(a.project.getUrl("_hooks/[PATH]")),1)]),_:1})]),_:1}),n(e(R),null,{default:i(()=>[n(e(H),{"validate-status":O.value,help:I.value,"has-feedback":""},{default:i(()=>[n(e($),{gap:"middle"},{default:i(()=>[n(e(q),{value:a.project.subdomain,type:"text",loading:o.value==="loading",onBlur:x,onChange:c[0]||(c[0]=T=>l("change-subdomain",T.target.value))},{addonBefore:i(()=>[...c[1]||(c[1]=[u("https://",-1)])]),addonAfter:i(()=>[...c[2]||(c[2]=[u(".abstra.app/",-1)])]),_:1},8,["value","loading"]),n(e(J),{placement:"top",title:e(s).translate("i18n_subdomaineditor_copy")},{default:i(()=>[n(e(v),{color:"red",onClick:P})]),_:1},8,["title"])]),_:1})]),_:1},8,["validate-status","help"]),n(z,{model:a.project,disabled:k.value,onError:A},null,8,["model","disabled"])]),_:1})]),_:1}))}}),Y={key:0,class:"project-settings"},ue=y({__name:"ProjectSettings",setup(a){const t=L().params.projectId,{result:l}=B(()=>C.get(t)),o=p=>{l.value.subdomain=p};return(p,_)=>e(l)?(S(),M("div",Y,[n(e(w),null,{default:i(()=>[u(d(e(s).translate("i18n_projectsettingsview_title")),1)]),_:1}),n(X,{project:e(l),onChangeSubdomain:o},null,8,["project"])])):Q("",!0)}});export{ue as default};
//# sourceMappingURL=ProjectSettings-BG0F1jKW.js.map
