import{a as B}from"./asyncComputed-Pl8A6UUZ.js";import{c as g}from"./router-C9ojQjj-.js";import{m as n,I as D,br as E,e as y,r as F,l as N,b as f,i as s,f as V,h as S,w as i,j as e,ao as w,k as u,t as d,aS as R,T as p,s as h,aj as U,ak as H,J as $,al as q,F as J,an as M,p as z,g as G}from"./jwt-decode.esm-og2W_mys.js";import{a as k}from"./project-t7d7Fcqy.js";import"./tables-BDU7F3na.js";import{S as L}from"./SaveButton-BkkBdr-O.js";import{S as Q}from"./index--EPiUUke.js";import"./ts.worker-BQuKpghy.js";import"./record-D5CgGTou.js";import"./string-zda83L05.js";import"./ExclamationCircleOutlined-DnBletNh.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]="f6bec1a6-c656-4f1b-9325-176439beb047",a._sentryDebugIdIdentifier="sentry-dbid-f6bec1a6-c656-4f1b-9325-176439beb047")}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),b=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",b()):o.value="invalid"}const C=f(()=>o.value!=="available"||!t.project.hasChanges("subdomain")),O=async()=>{await navigator.clipboard.writeText(t.project.getUrl())},P=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=k.formatSubdomain(t.project.subdomain);l("change-subdomain",m),_()};function T(){t.project.resetChanges(),o.value=void 0}return(m,c)=>(S(),V(e(Q),{direction:"vertical"},{default:i(()=>[n(e(w),{level:2},{default:i(()=>[u(d(e(s).translate("i18n_subdomaineditor_title")),1)]),_:1}),n(e(R),null,{default:i(()=>[u(d(e(s).translate("i18n_subdomaineditor_description")),1)]),_:1}),n(e(g),null,{default:i(()=>[n(e(p),null,{default:i(()=>[u(d(e(s).translate("i18n_subdomaineditor_forms_available")),1)]),_:1}),n(e(p),{code:""},{default:i(()=>[h("span",null,d(a.project.getUrl("[PATH]")),1)]),_:1})]),_:1}),n(e(g),null,{default:i(()=>[n(e(p),null,{default:i(()=>[u(d(e(s).translate("i18n_subdomaineditor_hooks_available")),1)]),_:1}),n(e(p),{code:""},{default:i(()=>[h("span",null,d(a.project.getUrl("_hooks/[PATH]")),1)]),_:1})]),_:1}),n(e(U),null,{default:i(()=>[n(e(H),{"validate-status":P.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]=A=>l("change-subdomain",A.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:O})]),_:1},8,["title"])]),_:1})]),_:1},8,["validate-status","help"]),n(L,{model:a.project,disabled:C.value,onError:T},null,8,["model","disabled"])]),_:1})]),_:1}))}}),Y={key:0,class:"project-settings"},ue=y({__name:"ProjectSettings",setup(a){const t=M().params.projectId,{result:l}=B(()=>k.get(t)),o=b=>{l.value.subdomain=b};return(b,_)=>e(l)?(S(),z("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"])])):G("",!0)}});export{ue as default};
//# sourceMappingURL=ProjectSettings-QWTefdgc.js.map
