import{a as T}from"./asyncComputed.f9fa4c71.js";import{g}from"./router.29e08ea4.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.32f71954.js";import{a as w}from"./project.b14b799c.js";import"./tables.94d324c3.js";import{S as G}from"./SaveButton.813aaf8d.js";import{A as J}from"./index.c59ca45b.js";import"./index.2400150a.js";import"./record.41c9caee.js";import"./string.ff0b4ef9.js";import"./ExclamationCircleOutlined.380af12e.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]="c8c39a49-5c0c-45f8-b871-ce893648eb30",r._sentryDebugIdIdentifier="sentry-dbid-c8c39a49-5c0c-45f8-b871-ce893648eb30")}catch{}})();function j(r){for(var o=1;o<arguments.length;o++){var t=arguments[o]!=null?Object(arguments[o]):{},a=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(a=a.concat(Object.getOwnPropertySymbols(t).filter(function(u){return Object.getOwnPropertyDescriptor(t,u).enumerable}))),a.forEach(function(u){L(r,u,t[u])})}return r}function L(r,o,t){return o in r?Object.defineProperty(r,o,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[o]=t,r}var f=function(o,t){var a=j({},o,t.attrs);return n(x,j({},a,{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 t=r,a=E(void 0),u=F.exports.debounce(async()=>{try{const{available:s}=await t.project.checkSubdomain();a.value=s?"available":"unavailable"}catch{a.value=void 0}},500);function p(){if(!t.project.hasChangesDeep("subdomain")){a.value=void 0;return}t.project.subdomain?(a.value="loading",u()):a.value="invalid"}const v=b(()=>a.value!=="available"||!t.project.hasChangesDeep("subdomain")),A=async()=>{await navigator.clipboard.writeText(t.project.getUrl())},O=b(()=>{switch(a.value){case"invalid":return"error";case"loading":return"validating";case"available":return"success";case"unavailable":return"error";default:return}}),k=b(()=>{switch(a.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(t.project.subdomain);o("change-subdomain",s),p()};function D(){t.project.resetChanges(),a.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:a.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 t=M().params.projectId,{result:a}=T(()=>w.get(t)),u=p=>{a.value.subdomain=p};return(p,v)=>e(a)?(S(),Q("div",Y,[n(e(C),null,{default:i(()=>[d(c(e(l).translate("i18n_projectsettingsview_title")),1)]),_:1}),n(X,{project:e(a),onChangeSubdomain:u},null,8,["project"])])):z("",!0)}});export{ue as default};
//# sourceMappingURL=ProjectSettings.995a749e.js.map
