diff --git a/jhub_apps/static/js/index.js b/jhub_apps/static/js/index.js index ff69df60..aa188f09 100644 --- a/jhub_apps/static/js/index.js +++ b/jhub_apps/static/js/index.js @@ -161,7 +161,7 @@ Error generating stack: `+s.message+` `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(o=>r.set(o)),r}static accessor(t){const r=(this[kx]=this[kx]={accessors:{}}).accessors,o=this.prototype;function s(i){const a=Cl(i);r[a]||(JG(o,i),r[a]=!0)}return te.isArray(t)?t.forEach(s):s(t),this}}gv.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);te.reduceDescriptors(gv.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});te.freezeMethods(gv);const Mo=gv;function gh(e,t){const n=this||T8,r=t||n,o=Mo.from(r.headers);let s=r.data;return te.forEach(e,function(a){s=a.call(n,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}function y5(e){return!!(e&&e.__CANCEL__)}function Pu(e,t,n){nt.call(this,e??"canceled",nt.ERR_CANCELED,t,n),this.name="CanceledError"}te.inherits(Pu,nt,{__CANCEL__:!0});function FG(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new nt("Request failed with status code "+n.status,[nt.ERR_BAD_REQUEST,nt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}const YG=co.hasStandardBrowserEnv?{write(e,t,n,r,o,s){const i=[e+"="+encodeURIComponent(t)];te.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),te.isString(r)&&i.push("path="+r),te.isString(o)&&i.push("domain="+o),s===!0&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function qG(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function ZG(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function g5(e,t){return e&&!qG(t)?ZG(e,t):t}const GG=co.hasStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let r;function o(s){let i=s;return t&&(n.setAttribute("href",i),i=n.href),n.setAttribute("href",i),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=o(window.location.href),function(i){const a=te.isString(i)?o(i):i;return a.protocol===r.protocol&&a.host===r.host}}():function(){return function(){return!0}}();function UG(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function QG(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o=0,s=0,i;return t=t!==void 0?t:1e3,function(l){const c=Date.now(),u=r[s];i||(i=c),n[o]=l,r[o]=c;let d=s,p=0;for(;d!==o;)p+=n[d++],d=d%e;if(o=(o+1)%e,o===s&&(s=(s+1)%e),c-i{const s=o.loaded,i=o.lengthComputable?o.total:void 0,a=s-n,l=r(a),c=s<=i;n=s;const u={loaded:s,total:i,progress:i?s/i:void 0,bytes:a,rate:l||void 0,estimated:l&&i&&c?(i-s)/l:void 0,event:o};u[t?"download":"upload"]=!0,e(u)}}const KG=typeof XMLHttpRequest<"u",_G=KG&&function(e){return new Promise(function(n,r){let o=e.data;const s=Mo.from(e.headers).normalize();let{responseType:i,withXSRFToken:a}=e,l;function c(){e.cancelToken&&e.cancelToken.unsubscribe(l),e.signal&&e.signal.removeEventListener("abort",l)}let u;if(te.isFormData(o)){if(co.hasStandardBrowserEnv||co.hasStandardBrowserWebWorkerEnv)s.setContentType(!1);else if((u=s.getContentType())!==!1){const[A,...w]=u?u.split(";").map(m=>m.trim()).filter(Boolean):[];s.setContentType([A||"multipart/form-data",...w].join("; "))}}let d=new XMLHttpRequest;if(e.auth){const A=e.auth.username||"",w=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";s.set("Authorization","Basic "+btoa(A+":"+w))}const p=g5(e.baseURL,e.url);d.open(e.method.toUpperCase(),h5(p,e.params,e.paramsSerializer),!0),d.timeout=e.timeout;function P(){if(!d)return;const A=Mo.from("getAllResponseHeaders"in d&&d.getAllResponseHeaders()),m={data:!i||i==="text"||i==="json"?d.responseText:d.response,status:d.status,statusText:d.statusText,headers:A,config:e,request:d};FG(function(y){n(y),c()},function(y){r(y),c()},m),d=null}if("onloadend"in d?d.onloadend=P:d.onreadystatechange=function(){!d||d.readyState!==4||d.status===0&&!(d.responseURL&&d.responseURL.indexOf("file:")===0)||setTimeout(P)},d.onabort=function(){d&&(r(new nt("Request aborted",nt.ECONNABORTED,e,d)),d=null)},d.onerror=function(){r(new nt("Network Error",nt.ERR_NETWORK,e,d)),d=null},d.ontimeout=function(){let w=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const m=e.transitional||m5;e.timeoutErrorMessage&&(w=e.timeoutErrorMessage),r(new nt(w,m.clarifyTimeoutError?nt.ETIMEDOUT:nt.ECONNABORTED,e,d)),d=null},co.hasStandardBrowserEnv&&(a&&te.isFunction(a)&&(a=a(e)),a||a!==!1&&GG(p))){const A=e.xsrfHeaderName&&e.xsrfCookieName&&YG.read(e.xsrfCookieName);A&&s.set(e.xsrfHeaderName,A)}o===void 0&&s.setContentType(null),"setRequestHeader"in d&&te.forEach(s.toJSON(),function(w,m){d.setRequestHeader(m,w)}),te.isUndefined(e.withCredentials)||(d.withCredentials=!!e.withCredentials),i&&i!=="json"&&(d.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&d.addEventListener("progress",Mx(e.onDownloadProgress,!0)),typeof e.onUploadProgress=="function"&&d.upload&&d.upload.addEventListener("progress",Mx(e.onUploadProgress)),(e.cancelToken||e.signal)&&(l=A=>{d&&(r(!A||A.type?new Pu(null,e,d):A),d.abort(),d=null)},e.cancelToken&&e.cancelToken.subscribe(l),e.signal&&(e.signal.aborted?l():e.signal.addEventListener("abort",l)));const h=UG(p);if(h&&co.protocols.indexOf(h)===-1){r(new nt("Unsupported protocol "+h+":",nt.ERR_BAD_REQUEST,e));return}d.send(o||null)})},dA={http:wG,xhr:_G};te.forEach(dA,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Lx=e=>`- ${e}`,$G=e=>te.isFunction(e)||e===null||e===!1,b5={getAdapter:e=>{e=te.isArray(e)?e:[e];const{length:t}=e;let n,r;const o={};for(let s=0;s`adapter ${a} `+(l===!1?"is not supported by the environment":"is not available in the build"));let i=t?s.length>1?`since : `+s.map(Lx).join(` `):" "+Lx(s[0]):"as no adapter specified";throw new nt("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return r},adapters:dA};function bh(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Pu(null,e)}function Xx(e){return bh(e),e.headers=Mo.from(e.headers),e.data=gh.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),b5.getAdapter(e.adapter||T8.adapter)(e).then(function(r){return bh(e),r.data=gh.call(e,e.transformResponse,r),r.headers=Mo.from(r.headers),r},function(r){return y5(r)||(bh(e),r&&r.response&&(r.response.data=gh.call(e,e.transformResponse,r.response),r.response.headers=Mo.from(r.response.headers))),Promise.reject(r)})}const Nx=e=>e instanceof Mo?{...e}:e;function Qa(e,t){t=t||{};const n={};function r(c,u,d){return te.isPlainObject(c)&&te.isPlainObject(u)?te.merge.call({caseless:d},c,u):te.isPlainObject(u)?te.merge({},u):te.isArray(u)?u.slice():u}function o(c,u,d){if(te.isUndefined(u)){if(!te.isUndefined(c))return r(void 0,c,d)}else return r(c,u,d)}function s(c,u){if(!te.isUndefined(u))return r(void 0,u)}function i(c,u){if(te.isUndefined(u)){if(!te.isUndefined(c))return r(void 0,c)}else return r(void 0,u)}function a(c,u,d){if(d in t)return r(c,u);if(d in e)return r(void 0,c)}const l={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(c,u)=>o(Nx(c),Nx(u),!0)};return te.forEach(Object.keys(Object.assign({},e,t)),function(u){const d=l[u]||o,p=d(e[u],t[u],u);te.isUndefined(p)&&d!==a||(n[u]=p)}),n}const x5="1.6.8",S8={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{S8[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Bx={};S8.transitional=function(t,n,r){function o(s,i){return"[Axios v"+x5+"] Transitional option '"+s+"'"+i+(r?". "+r:"")}return(s,i,a)=>{if(t===!1)throw new nt(o(i," has been removed"+(n?" in "+n:"")),nt.ERR_DEPRECATED);return n&&!Bx[i]&&(Bx[i]=!0,console.warn(o(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(s,i,a):!0}};function eU(e,t,n){if(typeof e!="object")throw new nt("options must be an object",nt.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const s=r[o],i=t[s];if(i){const a=e[s],l=a===void 0||i(a,s,e);if(l!==!0)throw new nt("option "+s+" must be "+l,nt.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new nt("Unknown option "+s,nt.ERR_BAD_OPTION)}}const pA={assertOptions:eU,validators:S8},qo=pA.validators;class bd{constructor(t){this.defaults=t,this.interceptors={request:new Ex,response:new Ex}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let o;Error.captureStackTrace?Error.captureStackTrace(o={}):o=new Error;const s=o.stack?o.stack.replace(/^.+\n/,""):"";r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=` -`+s):r.stack=s}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Qa(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:s}=n;r!==void 0&&pA.assertOptions(r,{silentJSONParsing:qo.transitional(qo.boolean),forcedJSONParsing:qo.transitional(qo.boolean),clarifyTimeoutError:qo.transitional(qo.boolean)},!1),o!=null&&(te.isFunction(o)?n.paramsSerializer={serialize:o}:pA.assertOptions(o,{encode:qo.function,serialize:qo.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=s&&te.merge(s.common,s[n.method]);s&&te.forEach(["delete","get","head","post","put","patch","common"],h=>{delete s[h]}),n.headers=Mo.concat(i,s);const a=[];let l=!0;this.interceptors.request.forEach(function(A){typeof A.runWhen=="function"&&A.runWhen(n)===!1||(l=l&&A.synchronous,a.unshift(A.fulfilled,A.rejected))});const c=[];this.interceptors.response.forEach(function(A){c.push(A.fulfilled,A.rejected)});let u,d=0,p;if(!l){const h=[Xx.bind(this),void 0];for(h.unshift.apply(h,a),h.push.apply(h,c),p=h.length,u=Promise.resolve(n);d{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](o);r._listeners=null}),this.promise.then=o=>{let s;const i=new Promise(a=>{r.subscribe(a),s=a}).then(o);return i.cancel=function(){r.unsubscribe(s)},i},t(function(s,i,a){r.reason||(r.reason=new Pu(s,i,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new R8(function(o){t=o}),cancel:t}}}const tU=R8;function nU(e){return function(n){return e.apply(null,n)}}function rU(e){return te.isObject(e)&&e.isAxiosError===!0}const vA={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(vA).forEach(([e,t])=>{vA[t]=e});const oU=vA;function w5(e){const t=new Cf(e),n=r5(Cf.prototype.request,t);return te.extend(n,Cf.prototype,t,{allOwnKeys:!0}),te.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return w5(Qa(e,o))},n}const Qt=w5(T8);Qt.Axios=Cf;Qt.CanceledError=Pu;Qt.CancelToken=tU;Qt.isCancel=y5;Qt.VERSION=x5;Qt.toFormData=yv;Qt.AxiosError=nt;Qt.Cancel=Qt.CanceledError;Qt.all=function(t){return Promise.all(t)};Qt.spread=nU;Qt.isAxiosError=rU;Qt.mergeConfig=Qa;Qt.AxiosHeaders=Mo;Qt.formToJSON=e=>P5(te.isHTMLForm(e)?new FormData(e):e);Qt.getAdapter=b5.getAdapter;Qt.HttpStatusCode=oU;Qt.default=Qt;const tn=Qt.create({baseURL:"/services/japps",headers:{"Content-Type":"application/json"}});tn.interceptors.response.use(e=>e,e=>{const t=e.response.status;(e.response.status===401||t===403)&&(window.location.href="/services/japps/jhub-login")});var yu=e=>e.type==="checkbox",na=e=>e instanceof Date,Sn=e=>e==null;const H5=e=>typeof e=="object";var sn=e=>!Sn(e)&&!Array.isArray(e)&&H5(e)&&!na(e),j5=e=>sn(e)&&e.target?yu(e.target)?e.target.checked:e.target.value:e,sU=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,z5=(e,t)=>e.has(sU(t)),iU=e=>{const t=e.constructor&&e.constructor.prototype;return sn(t)&&t.hasOwnProperty("isPrototypeOf")},E8=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Xn(e){let t;const n=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(E8&&(e instanceof Blob||e instanceof FileList))&&(n||sn(e)))if(t=n?[]:{},!n&&!iU(e))t=e;else for(const r in e)e.hasOwnProperty(r)&&(t[r]=Xn(e[r]));else return e;return t}var gu=e=>Array.isArray(e)?e.filter(Boolean):[],Wt=e=>e===void 0,xe=(e,t,n)=>{if(!t||!sn(e))return n;const r=gu(t.split(/[,[\].]+?/)).reduce((o,s)=>Sn(o)?o:o[s],e);return Wt(r)||r===e?Wt(e[t])?n:e[t]:r},Wr=e=>typeof e=="boolean";const xd={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Jr={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},jo={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},aU=De.createContext(null),k8=()=>De.useContext(aU);var O5=(e,t,n,r=!0)=>{const o={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(o,s,{get:()=>{const i=s;return t._proxyFormState[i]!==Jr.all&&(t._proxyFormState[i]=!r||Jr.all),n&&(n[i]=!0),e[i]}});return o},tr=e=>sn(e)&&!Object.keys(e).length,D5=(e,t,n,r)=>{n(e);const{name:o,...s}=e;return tr(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(i=>t[i]===(!r||Jr.all))},Tf=e=>Array.isArray(e)?e:[e],C5=(e,t,n)=>!e||!t||e===t||Tf(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r)));function M8(e){const t=De.useRef(e);t.current=e,De.useEffect(()=>{const n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}function lU(e){const t=k8(),{control:n=t.control,disabled:r,name:o,exact:s}=e||{},[i,a]=De.useState(n._formState),l=De.useRef(!0),c=De.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),u=De.useRef(o);return u.current=o,M8({disabled:r,next:d=>l.current&&C5(u.current,d.name,s)&&D5(d,c.current,n._updateFormState)&&a({...n._formState,...d}),subject:n._subjects.state}),De.useEffect(()=>(l.current=!0,c.current.isValid&&n._updateValid(!0),()=>{l.current=!1}),[n]),O5(i,n,c.current,!1)}var uo=e=>typeof e=="string",T5=(e,t,n,r,o)=>uo(e)?(r&&t.watch.add(e),xe(n,e,o)):Array.isArray(e)?e.map(s=>(r&&t.watch.add(s),xe(n,s))):(r&&(t.watchAll=!0),n);function cU(e){const t=k8(),{control:n=t.control,name:r,defaultValue:o,disabled:s,exact:i}=e||{},a=De.useRef(r);a.current=r,M8({disabled:s,subject:n._subjects.values,next:u=>{C5(a.current,u.name,i)&&c(Xn(T5(a.current,n._names,u.values||n._formValues,!1,o)))}});const[l,c]=De.useState(n._getWatch(r,o));return De.useEffect(()=>n._removeUnmounted()),l}var L8=e=>/^\w*$/.test(e),S5=e=>gu(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Pt=(e,t,n)=>{let r=-1;const o=L8(t)?[t]:S5(t),s=o.length,i=s-1;for(;++r{const u=o._options.shouldUnregister||s,d=(p,P)=>{const h=xe(o._fields,p);h&&(h._f.mount=P)};if(d(n,!0),u){const p=Xn(xe(o._options.defaultValues,n));Pt(o._defaultValues,n,p),Wt(xe(o._formValues,n))&&Pt(o._formValues,n,p)}return()=>{(i?u&&!o._state.action:u)?o.unregister(n):d(n,!1)}},[n,o,i,s]),De.useEffect(()=>{xe(o._fields,n)&&o._updateDisabledField({disabled:r,fields:o._fields,name:n,value:xe(o._fields,n)._f.value})},[r,n,o]),{field:{name:n,value:a,...Wr(r)||l.disabled?{disabled:l.disabled||r}:{},onChange:De.useCallback(u=>c.current.onChange({target:{value:j5(u),name:n},type:xd.CHANGE}),[n]),onBlur:De.useCallback(()=>c.current.onBlur({target:{value:xe(o._formValues,n),name:n},type:xd.BLUR}),[n,o]),ref:u=>{const d=xe(o._fields,n);d&&u&&(d._f.ref={focus:()=>u.focus(),select:()=>u.select(),setCustomValidity:p=>u.setCustomValidity(p),reportValidity:()=>u.reportValidity()})}},formState:l,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!xe(l.errors,n)},isDirty:{enumerable:!0,get:()=>!!xe(l.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!xe(l.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!xe(l.validatingFields,n)},error:{enumerable:!0,get:()=>xe(l.errors,n)}})}}const zo=e=>e.render(uU(e));var fU=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{},Vx=e=>({isOnSubmit:!e||e===Jr.onSubmit,isOnBlur:e===Jr.onBlur,isOnChange:e===Jr.onChange,isOnAll:e===Jr.all,isOnTouch:e===Jr.onTouched}),Ix=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const ac=(e,t,n,r)=>{for(const o of n||Object.keys(e)){const s=xe(e,o);if(s){const{_f:i,...a}=s;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],o)&&!r)break;if(i.ref&&t(i.ref,i.name)&&!r)break;ac(a,t)}else sn(a)&&ac(a,t)}}};var dU=(e,t,n)=>{const r=gu(xe(e,n));return Pt(r,"root",t[n]),Pt(e,n,r),e},X8=e=>e.type==="file",ps=e=>typeof e=="function",wd=e=>{if(!E8)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Sf=e=>uo(e),N8=e=>e.type==="radio",Hd=e=>e instanceof RegExp;const Wx={value:!1,isValid:!1},Jx={value:!0,isValid:!0};var R5=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Wt(e[0].attributes.value)?Wt(e[0].value)||e[0].value===""?Jx:{value:e[0].value,isValid:!0}:Jx:Wx}return Wx};const Fx={isValid:!1,value:null};var E5=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,Fx):Fx;function Yx(e,t,n="validate"){if(Sf(e)||Array.isArray(e)&&e.every(Sf)||Wr(e)&&!e)return{type:n,message:Sf(e)?e:"",ref:t}}var Li=e=>sn(e)&&!Hd(e)?e:{value:e,message:""},qx=async(e,t,n,r,o)=>{const{ref:s,refs:i,required:a,maxLength:l,minLength:c,min:u,max:d,pattern:p,validate:P,name:h,valueAsNumber:A,mount:w,disabled:m}=e._f,v=xe(t,h);if(!w||m)return{};const y=i?i[0]:s,b=R=>{r&&y.reportValidity&&(y.setCustomValidity(Wr(R)?"":R||""),y.reportValidity())},H={},z=N8(s),j=yu(s),O=z||j,C=(A||X8(s))&&Wt(s.value)&&Wt(v)||wd(s)&&s.value===""||v===""||Array.isArray(v)&&!v.length,T=fU.bind(null,h,n,H),V=(R,S,I,Y=jo.maxLength,q=jo.minLength)=>{const G=R?S:I;H[h]={type:R?Y:q,message:G,ref:s,...T(R?Y:q,G)}};if(o?!Array.isArray(v)||!v.length:a&&(!O&&(C||Sn(v))||Wr(v)&&!v||j&&!R5(i).isValid||z&&!E5(i).isValid)){const{value:R,message:S}=Sf(a)?{value:!!a,message:a}:Li(a);if(R&&(H[h]={type:jo.required,message:S,ref:y,...T(jo.required,S)},!n))return b(S),H}if(!C&&(!Sn(u)||!Sn(d))){let R,S;const I=Li(d),Y=Li(u);if(!Sn(v)&&!isNaN(v)){const q=s.valueAsNumber||v&&+v;Sn(I.value)||(R=q>I.value),Sn(Y.value)||(S=qnew Date(new Date().toDateString()+" "+Z),k=s.type=="time",B=s.type=="week";uo(I.value)&&v&&(R=k?G(v)>G(I.value):B?v>I.value:q>new Date(I.value)),uo(Y.value)&&v&&(S=k?G(v)+R.value,Y=!Sn(S.value)&&v.length<+S.value;if((I||Y)&&(V(I,R.message,S.message),!n))return b(H[h].message),H}if(p&&!C&&uo(v)){const{value:R,message:S}=Li(p);if(Hd(R)&&!v.match(R)&&(H[h]={type:jo.pattern,message:S,ref:s,...T(jo.pattern,S)},!n))return b(S),H}if(P){if(ps(P)){const R=await P(v,t),S=Yx(R,y);if(S&&(H[h]={...S,...T(jo.validate,S.message)},!n))return b(S.message),H}else if(sn(P)){let R={};for(const S in P){if(!tr(R)&&!n)break;const I=Yx(await P[S](v,t),y,S);I&&(R={...I,...T(S,I.message)},b(I.message),n&&(H[h]=R))}if(!tr(R)&&(H[h]={ref:y,...R},!n))return H}}return b(!0),H};function pU(e,t){const n=t.slice(0,-1).length;let r=0;for(;r{let e=[];return{get observers(){return e},next:o=>{for(const s of e)s.next&&s.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(s=>s!==o)}}),unsubscribe:()=>{e=[]}}},jd=e=>Sn(e)||!H5(e);function Ys(e,t){if(jd(e)||jd(t))return e===t;if(na(e)&&na(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n){const s=e[o];if(!r.includes(o))return!1;if(o!=="ref"){const i=t[o];if(na(s)&&na(i)||sn(s)&&sn(i)||Array.isArray(s)&&Array.isArray(i)?!Ys(s,i):s!==i)return!1}}return!0}var k5=e=>e.type==="select-multiple",hU=e=>N8(e)||yu(e),wh=e=>wd(e)&&e.isConnected,M5=e=>{for(const t in e)if(ps(e[t]))return!0;return!1};function zd(e,t={}){const n=Array.isArray(e);if(sn(e)||n)for(const r in e)Array.isArray(e[r])||sn(e[r])&&!M5(e[r])?(t[r]=Array.isArray(e[r])?[]:{},zd(e[r],t[r])):Sn(e[r])||(t[r]=!0);return t}function L5(e,t,n){const r=Array.isArray(e);if(sn(e)||r)for(const o in e)Array.isArray(e[o])||sn(e[o])&&!M5(e[o])?Wt(t)||jd(n[o])?n[o]=Array.isArray(e[o])?zd(e[o],[]):{...zd(e[o])}:L5(e[o],Sn(t)?{}:t[o],n[o]):n[o]=!Ys(e[o],t[o]);return n}var nf=(e,t)=>L5(e,t,zd(t)),X5=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>Wt(e)?e:t?e===""?NaN:e&&+e:n&&uo(e)?new Date(e):r?r(e):e;function Hh(e){const t=e.ref;if(!(e.refs?e.refs.every(n=>n.disabled):t.disabled))return X8(t)?t.files:N8(t)?E5(e.refs).value:k5(t)?[...t.selectedOptions].map(({value:n})=>n):yu(t)?R5(e.refs).value:X5(Wt(t.value)?e.ref.value:t.value,e)}var mU=(e,t,n,r)=>{const o={};for(const s of e){const i=xe(t,s);i&&Pt(o,s,i._f)}return{criteriaMode:n,names:[...e],fields:o,shouldUseNativeValidation:r}},Tl=e=>Wt(e)?e:Hd(e)?e.source:sn(e)?Hd(e.value)?e.value.source:e.value:e,AU=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function Zx(e,t,n){const r=xe(e,n);if(r||L8(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const s=o.join("."),i=xe(t,s),a=xe(e,s);if(i&&!Array.isArray(i)&&n!==s)return{name:n};if(a&&a.type)return{name:s,error:a};o.pop()}return{name:n}}var PU=(e,t,n,r,o)=>o.isOnAll?!1:!n&&o.isOnTouch?!(t||e):(n?r.isOnBlur:o.isOnBlur)?!e:(n?r.isOnChange:o.isOnChange)?e:!0,yU=(e,t)=>!gu(xe(e,t)).length&&_t(e,t);const gU={mode:Jr.onSubmit,reValidateMode:Jr.onChange,shouldFocusError:!0};function bU(e={}){let t={...gU,...e},n={submitCount:0,isDirty:!1,isLoading:ps(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},o=sn(t.defaultValues)||sn(t.values)?Xn(t.defaultValues||t.values)||{}:{},s=t.shouldUnregister?{}:Xn(o),i={action:!1,mount:!1,watch:!1},a={mount:new Set,unMount:new Set,array:new Set,watch:new Set},l,c=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={values:xh(),array:xh(),state:xh()},p=Vx(t.mode),P=Vx(t.reValidateMode),h=t.criteriaMode===Jr.all,A=D=>N=>{clearTimeout(c),c=setTimeout(D,N)},w=async D=>{if(u.isValid||D){const N=t.resolver?tr((await O()).errors):await T(r,!0);N!==n.isValid&&d.state.next({isValid:N})}},m=(D,N)=>{(u.isValidating||u.validatingFields)&&((D||Array.from(a.mount)).forEach(W=>{W&&(N?Pt(n.validatingFields,W,N):_t(n.validatingFields,W))}),d.state.next({validatingFields:n.validatingFields,isValidating:!tr(n.validatingFields)}))},v=(D,N=[],W,oe,ae=!0,_=!0)=>{if(oe&&W){if(i.action=!0,_&&Array.isArray(xe(r,D))){const ue=W(xe(r,D),oe.argA,oe.argB);ae&&Pt(r,D,ue)}if(_&&Array.isArray(xe(n.errors,D))){const ue=W(xe(n.errors,D),oe.argA,oe.argB);ae&&Pt(n.errors,D,ue),yU(n.errors,D)}if(u.touchedFields&&_&&Array.isArray(xe(n.touchedFields,D))){const ue=W(xe(n.touchedFields,D),oe.argA,oe.argB);ae&&Pt(n.touchedFields,D,ue)}u.dirtyFields&&(n.dirtyFields=nf(o,s)),d.state.next({name:D,isDirty:R(D,N),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Pt(s,D,N)},y=(D,N)=>{Pt(n.errors,D,N),d.state.next({errors:n.errors})},b=D=>{n.errors=D,d.state.next({errors:n.errors,isValid:!1})},H=(D,N,W,oe)=>{const ae=xe(r,D);if(ae){const _=xe(s,D,Wt(W)?xe(o,D):W);Wt(_)||oe&&oe.defaultChecked||N?Pt(s,D,N?_:Hh(ae._f)):Y(D,_),i.mount&&w()}},z=(D,N,W,oe,ae)=>{let _=!1,ue=!1;const Ee={name:D},Je=!!(xe(r,D)&&xe(r,D)._f.disabled);if(!W||oe){u.isDirty&&(ue=n.isDirty,n.isDirty=Ee.isDirty=R(),_=ue!==Ee.isDirty);const _e=Je||Ys(xe(o,D),N);ue=!!(!Je&&xe(n.dirtyFields,D)),_e||Je?_t(n.dirtyFields,D):Pt(n.dirtyFields,D,!0),Ee.dirtyFields=n.dirtyFields,_=_||u.dirtyFields&&ue!==!_e}if(W){const _e=xe(n.touchedFields,D);_e||(Pt(n.touchedFields,D,W),Ee.touchedFields=n.touchedFields,_=_||u.touchedFields&&_e!==W)}return _&&ae&&d.state.next(Ee),_?Ee:{}},j=(D,N,W,oe)=>{const ae=xe(n.errors,D),_=u.isValid&&Wr(N)&&n.isValid!==N;if(e.delayError&&W?(l=A(()=>y(D,W)),l(e.delayError)):(clearTimeout(c),l=null,W?Pt(n.errors,D,W):_t(n.errors,D)),(W?!Ys(ae,W):ae)||!tr(oe)||_){const ue={...oe,..._&&Wr(N)?{isValid:N}:{},errors:n.errors,name:D};n={...n,...ue},d.state.next(ue)}},O=async D=>{m(D,!0);const N=await t.resolver(s,t.context,mU(D||a.mount,r,t.criteriaMode,t.shouldUseNativeValidation));return m(D),N},C=async D=>{const{errors:N}=await O(D);if(D)for(const W of D){const oe=xe(N,W);oe?Pt(n.errors,W,oe):_t(n.errors,W)}else n.errors=N;return N},T=async(D,N,W={valid:!0})=>{for(const oe in D){const ae=D[oe];if(ae){const{_f:_,...ue}=ae;if(_){const Ee=a.array.has(_.name);m([oe],!0);const Je=await qx(ae,s,h,t.shouldUseNativeValidation&&!N,Ee);if(m([oe]),Je[_.name]&&(W.valid=!1,N))break;!N&&(xe(Je,_.name)?Ee?dU(n.errors,Je,_.name):Pt(n.errors,_.name,Je[_.name]):_t(n.errors,_.name))}ue&&await T(ue,N,W)}}return W.valid},V=()=>{for(const D of a.unMount){const N=xe(r,D);N&&(N._f.refs?N._f.refs.every(W=>!wh(W)):!wh(N._f.ref))&&$(D)}a.unMount=new Set},R=(D,N)=>(D&&N&&Pt(s,D,N),!Ys(ce(),o)),S=(D,N,W)=>T5(D,a,{...i.mount?s:Wt(N)?o:uo(D)?{[D]:N}:N},W,N),I=D=>gu(xe(i.mount?s:o,D,e.shouldUnregister?xe(o,D,[]):[])),Y=(D,N,W={})=>{const oe=xe(r,D);let ae=N;if(oe){const _=oe._f;_&&(!_.disabled&&Pt(s,D,X5(N,_)),ae=wd(_.ref)&&Sn(N)?"":N,k5(_.ref)?[..._.ref.options].forEach(ue=>ue.selected=ae.includes(ue.value)):_.refs?yu(_.ref)?_.refs.length>1?_.refs.forEach(ue=>(!ue.defaultChecked||!ue.disabled)&&(ue.checked=Array.isArray(ae)?!!ae.find(Ee=>Ee===ue.value):ae===ue.value)):_.refs[0]&&(_.refs[0].checked=!!ae):_.refs.forEach(ue=>ue.checked=ue.value===ae):X8(_.ref)?_.ref.value="":(_.ref.value=ae,_.ref.type||d.values.next({name:D,values:{...s}})))}(W.shouldDirty||W.shouldTouch)&&z(D,ae,W.shouldTouch,W.shouldDirty,!0),W.shouldValidate&&Z(D)},q=(D,N,W)=>{for(const oe in N){const ae=N[oe],_=`${D}.${oe}`,ue=xe(r,_);(a.array.has(D)||!jd(ae)||ue&&!ue._f)&&!na(ae)?q(_,ae,W):Y(_,ae,W)}},G=(D,N,W={})=>{const oe=xe(r,D),ae=a.array.has(D),_=Xn(N);Pt(s,D,_),ae?(d.array.next({name:D,values:{...s}}),(u.isDirty||u.dirtyFields)&&W.shouldDirty&&d.state.next({name:D,dirtyFields:nf(o,s),isDirty:R(D,_)})):oe&&!oe._f&&!Sn(_)?q(D,_,W):Y(D,_,W),Ix(D,a)&&d.state.next({...n}),d.values.next({name:i.mount?D:void 0,values:{...s}})},k=async D=>{i.mount=!0;const N=D.target;let W=N.name,oe=!0;const ae=xe(r,W),_=()=>N.type?Hh(ae._f):j5(D),ue=Ee=>{oe=Number.isNaN(Ee)||Ee===xe(s,W,Ee)};if(ae){let Ee,Je;const _e=_(),Be=D.type===xd.BLUR||D.type===xd.FOCUS_OUT,me=!AU(ae._f)&&!t.resolver&&!xe(n.errors,W)&&!ae._f.deps||PU(Be,xe(n.touchedFields,W),n.isSubmitted,P,p),$e=Ix(W,a,Be);Pt(s,W,_e),Be?(ae._f.onBlur&&ae._f.onBlur(D),l&&l(0)):ae._f.onChange&&ae._f.onChange(D);const Jt=z(W,_e,Be,!1),Rt=!tr(Jt)||$e;if(!Be&&d.values.next({name:W,type:D.type,values:{...s}}),me)return u.isValid&&w(),Rt&&d.state.next({name:W,...$e?{}:Jt});if(!Be&&$e&&d.state.next({...n}),t.resolver){const{errors:ze}=await O([W]);if(ue(_e),oe){const Ge=Zx(n.errors,r,W),X=Zx(ze,r,Ge.name||W);Ee=X.error,W=X.name,Je=tr(ze)}}else m([W],!0),Ee=(await qx(ae,s,h,t.shouldUseNativeValidation))[W],m([W]),ue(_e),oe&&(Ee?Je=!1:u.isValid&&(Je=await T(r,!0)));oe&&(ae._f.deps&&Z(ae._f.deps),j(W,Je,Ee,Jt))}},B=(D,N)=>{if(xe(n.errors,N)&&D.focus)return D.focus(),1},Z=async(D,N={})=>{let W,oe;const ae=Tf(D);if(t.resolver){const _=await C(Wt(D)?D:ae);W=tr(_),oe=D?!ae.some(ue=>xe(_,ue)):W}else D?(oe=(await Promise.all(ae.map(async _=>{const ue=xe(r,_);return await T(ue&&ue._f?{[_]:ue}:ue)}))).every(Boolean),!(!oe&&!n.isValid)&&w()):oe=W=await T(r);return d.state.next({...!uo(D)||u.isValid&&W!==n.isValid?{}:{name:D},...t.resolver||!D?{isValid:W}:{},errors:n.errors}),N.shouldFocus&&!oe&&ac(r,B,D?ae:a.mount),oe},ce=D=>{const N={...i.mount?s:o};return Wt(D)?N:uo(D)?xe(N,D):D.map(W=>xe(N,W))},E=(D,N)=>({invalid:!!xe((N||n).errors,D),isDirty:!!xe((N||n).dirtyFields,D),isTouched:!!xe((N||n).touchedFields,D),isValidating:!!xe((N||n).validatingFields,D),error:xe((N||n).errors,D)}),U=D=>{D&&Tf(D).forEach(N=>_t(n.errors,N)),d.state.next({errors:D?n.errors:{}})},F=(D,N,W)=>{const oe=(xe(r,D,{_f:{}})._f||{}).ref;Pt(n.errors,D,{...N,ref:oe}),d.state.next({name:D,errors:n.errors,isValid:!1}),W&&W.shouldFocus&&oe&&oe.focus&&oe.focus()},ie=(D,N)=>ps(D)?d.values.subscribe({next:W=>D(S(void 0,N),W)}):S(D,N,!0),$=(D,N={})=>{for(const W of D?Tf(D):a.mount)a.mount.delete(W),a.array.delete(W),N.keepValue||(_t(r,W),_t(s,W)),!N.keepError&&_t(n.errors,W),!N.keepDirty&&_t(n.dirtyFields,W),!N.keepTouched&&_t(n.touchedFields,W),!N.keepIsValidating&&_t(n.validatingFields,W),!t.shouldUnregister&&!N.keepDefaultValue&&_t(o,W);d.values.next({values:{...s}}),d.state.next({...n,...N.keepDirty?{isDirty:R()}:{}}),!N.keepIsValid&&w()},ye=({disabled:D,name:N,field:W,fields:oe,value:ae})=>{if(Wr(D)){const _=D?void 0:Wt(ae)?Hh(W?W._f:xe(oe,N)._f):ae;Pt(s,N,_),z(N,_,!1,!1,!0)}},de=(D,N={})=>{let W=xe(r,D);const oe=Wr(N.disabled);return Pt(r,D,{...W||{},_f:{...W&&W._f?W._f:{ref:{name:D}},name:D,mount:!0,...N}}),a.mount.add(D),W?ye({field:W,disabled:N.disabled,name:D,value:N.value}):H(D,!0,N.value),{...oe?{disabled:N.disabled}:{},...t.progressive?{required:!!N.required,min:Tl(N.min),max:Tl(N.max),minLength:Tl(N.minLength),maxLength:Tl(N.maxLength),pattern:Tl(N.pattern)}:{},name:D,onChange:k,onBlur:k,ref:ae=>{if(ae){de(D,N),W=xe(r,D);const _=Wt(ae.value)&&ae.querySelectorAll&&ae.querySelectorAll("input,select,textarea")[0]||ae,ue=hU(_),Ee=W._f.refs||[];if(ue?Ee.find(Je=>Je===_):_===W._f.ref)return;Pt(r,D,{_f:{...W._f,...ue?{refs:[...Ee.filter(wh),_,...Array.isArray(xe(o,D))?[{}]:[]],ref:{type:_.type,name:D}}:{ref:_}}}),H(D,!1,void 0,_)}else W=xe(r,D,{}),W._f&&(W._f.mount=!1),(t.shouldUnregister||N.shouldUnregister)&&!(z5(a.array,D)&&i.action)&&a.unMount.add(D)}}},ne=()=>t.shouldFocusError&&ac(r,B,a.mount),Ne=D=>{Wr(D)&&(d.state.next({disabled:D}),ac(r,(N,W)=>{let oe=D;const ae=xe(r,W);ae&&Wr(ae._f.disabled)&&(oe||(oe=ae._f.disabled)),N.disabled=oe},0,!1))},He=(D,N)=>async W=>{let oe;W&&(W.preventDefault&&W.preventDefault(),W.persist&&W.persist());let ae=Xn(s);if(d.state.next({isSubmitting:!0}),t.resolver){const{errors:_,values:ue}=await O();n.errors=_,ae=ue}else await T(r);if(_t(n.errors,"root"),tr(n.errors)){d.state.next({errors:{}});try{await D(ae,W)}catch(_){oe=_}}else N&&await N({...n.errors},W),ne(),setTimeout(ne);if(d.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:tr(n.errors)&&!oe,submitCount:n.submitCount+1,errors:n.errors}),oe)throw oe},we=(D,N={})=>{xe(r,D)&&(Wt(N.defaultValue)?G(D,Xn(xe(o,D))):(G(D,N.defaultValue),Pt(o,D,Xn(N.defaultValue))),N.keepTouched||_t(n.touchedFields,D),N.keepDirty||(_t(n.dirtyFields,D),n.isDirty=N.defaultValue?R(D,Xn(xe(o,D))):R()),N.keepError||(_t(n.errors,D),u.isValid&&w()),d.state.next({...n}))},ge=(D,N={})=>{const W=D?Xn(D):o,oe=Xn(W),ae=tr(D),_=ae?o:oe;if(N.keepDefaultValues||(o=W),!N.keepValues){if(N.keepDirtyValues)for(const ue of a.mount)xe(n.dirtyFields,ue)?Pt(_,ue,xe(s,ue)):G(ue,xe(_,ue));else{if(E8&&Wt(D))for(const ue of a.mount){const Ee=xe(r,ue);if(Ee&&Ee._f){const Je=Array.isArray(Ee._f.refs)?Ee._f.refs[0]:Ee._f.ref;if(wd(Je)){const _e=Je.closest("form");if(_e){_e.reset();break}}}}r={}}s=e.shouldUnregister?N.keepDefaultValues?Xn(o):{}:Xn(_),d.array.next({values:{..._}}),d.values.next({values:{..._}})}a={mount:N.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!u.isValid||!!N.keepIsValid||!!N.keepDirtyValues,i.watch=!!e.shouldUnregister,d.state.next({submitCount:N.keepSubmitCount?n.submitCount:0,isDirty:ae?!1:N.keepDirty?n.isDirty:!!(N.keepDefaultValues&&!Ys(D,o)),isSubmitted:N.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:ae?[]:N.keepDirtyValues?N.keepDefaultValues&&s?nf(o,s):n.dirtyFields:N.keepDefaultValues&&D?nf(o,D):{},touchedFields:N.keepTouched?n.touchedFields:{},errors:N.keepErrors?n.errors:{},isSubmitSuccessful:N.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},Ie=(D,N)=>ge(ps(D)?D(s):D,N);return{control:{register:de,unregister:$,getFieldState:E,handleSubmit:He,setError:F,_executeSchema:O,_getWatch:S,_getDirty:R,_updateValid:w,_removeUnmounted:V,_updateFieldArray:v,_updateDisabledField:ye,_getFieldArray:I,_reset:ge,_resetDefaultValues:()=>ps(t.defaultValues)&&t.defaultValues().then(D=>{Ie(D,t.resetOptions),d.state.next({isLoading:!1})}),_updateFormState:D=>{n={...n,...D}},_disableForm:Ne,_subjects:d,_proxyFormState:u,_setErrors:b,get _fields(){return r},get _formValues(){return s},get _state(){return i},set _state(D){i=D},get _defaultValues(){return o},get _names(){return a},set _names(D){a=D},get _formState(){return n},set _formState(D){n=D},get _options(){return t},set _options(D){t={...t,...D}}},trigger:Z,register:de,handleSubmit:He,watch:ie,setValue:G,getValues:ce,reset:Ie,resetField:we,clearErrors:U,unregister:$,setError:F,setFocus:(D,N={})=>{const W=xe(r,D),oe=W&&W._f;if(oe){const ae=oe.refs?oe.refs[0]:oe.ref;ae.focus&&(ae.focus(),N.shouldSelect&&ae.select())}},getFieldState:E}}function xU(e={}){const t=De.useRef(),n=De.useRef(),[r,o]=De.useState({isDirty:!1,isValidating:!1,isLoading:ps(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:ps(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...bU(e),formState:r});const s=t.current.control;return s._options=e,M8({subject:s._subjects.state,next:i=>{D5(i,s._proxyFormState,s._updateFormState,!0)&&o({...s._formState})}}),De.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),De.useEffect(()=>{if(s._proxyFormState.isDirty){const i=s._getDirty();i!==r.isDirty&&s._subjects.state.next({isDirty:i})}},[s,r.isDirty]),De.useEffect(()=>{e.values&&!Ys(e.values,n.current)?(s._reset(e.values,s._options.resetOptions),n.current=e.values,o(i=>({...i}))):s._resetDefaultValues()},[e.values,s]),De.useEffect(()=>{e.errors&&s._setErrors(e.errors)},[e.errors,s]),De.useEffect(()=>{s._state.mount||(s._updateValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),De.useEffect(()=>{e.shouldUnregister&&s._subjects.values.next({values:s._getWatch()})},[e.shouldUnregister,s]),t.current.formState=O5(r,s),t.current}const N5=({id:e})=>{var Ie;const t=KP(),[n,r]=g.useState(!1),[o]=Ye(Hi),[s,i]=g.useState(""),a=g.useRef(null),l=g.useRef(null),[c,u]=g.useState(!1),d=se=>{se&&(se.style.height="auto",se.style.height=se.scrollHeight+"px")},[,p]=Ye(Ur),[P,h]=Ye(F4),[A,w]=Ye(J4),[m,v]=Ye(q4),[y,b]=Ye(Y4),[H,z]=g.useState(!1),[j,O]=g.useState([]),[C,T]=g.useState([]),[V,R]=g.useState(!1),{data:S,error:I}=xr({queryKey:["app-form",e],queryFn:()=>tn.get(`/server/${e}`).then(se=>se.data),enabled:!!e}),{data:Y,isLoading:q}=xr({queryKey:["app-frameworks"],queryFn:()=>tn.get("/frameworks/").then(se=>se.data)}),{data:G,isLoading:k}=xr({queryKey:["app-environments"],queryFn:()=>tn.get("/conda-environments/").then(se=>se.data)}),{data:B,isLoading:Z}=xr({queryKey:["app-profiles"],queryFn:()=>tn.get("/spawner-profiles/").then(se=>se.data)}),{control:ce,handleSubmit:E,reset:U,watch:F,formState:{errors:ie}}=xU({defaultValues:{display_name:"",description:"",framework:"",thumbnail:"",filepath:"",conda_env:"",env:"",custom_command:"",profile:"",is_public:!1,keep_alive:!1}}),$=F("framework");g.useEffect(()=>{const se=a.current,re=()=>{l.current&&a.current&&(l.current.scrollTop=a.current.scrollTop)};return se==null||se.addEventListener("scroll",re),()=>se==null?void 0:se.removeEventListener("scroll",re)},[]);const ye=()=>{const se=s.slice(0,200),re=s.slice(200);return f.jsxs(f.Fragment,{children:[se,f.jsx("span",{style:{color:"red"},children:re})]})};function de(se){u(se)}const ne=({display_name:se,description:re,framework:We,thumbnail:D,filepath:N,conda_env:W,env:oe,custom_command:ae,profile:_})=>{const ue=MZ(se);if(B&&B.length>0){const Ee={jhub_app:!0,display_name:ue,description:re,framework:We,thumbnail:D,filepath:N,conda_env:W,env:oe?JSON.parse(oe):null,custom_command:ae,profile:_,is_public:H,share_with:{users:j,groups:C},keep_alive:V};h(Ee),t(`/server-types${e?`?id=${e}`:""}`)}else{const Ee={servername:A||ue,user_options:{jhub_app:!0,name:A||ue,display_name:ue,description:re||"",framework:We,thumbnail:D||"",filepath:N||"",conda_env:W||"",env:oe?JSON.parse(oe):null,custom_command:ae||"",profile:_||"",public:H,share_with:{users:j,groups:C},keep_alive:V}};r(!0),e?ge(Ee,{onSuccess:async()=>{window.location.assign(ir)},onError:async Je=>{r(!1),p(Je.message)}}):we(Ee,{onSuccess:async Je=>{const _e=o==null?void 0:o.name;if(_e&&(Je==null?void 0:Je.length)>1){const Be=Je[1];window.location.assign(`${ir}/spawn-pending/${_e}/${Be}`)}},onError:async Je=>{r(!1),p(Je.message)}})}},Ne=async({servername:se,user_options:re})=>{const We={accept:"application/json","Content-Type":"multipart/form-data"},D=new FormData;return D.append("data",JSON.stringify({servername:se,user_options:re})),m&&D.append("thumbnail",m),(await tn.post("/server",D,{headers:We})).data},He=async({servername:se,user_options:re})=>{const We={accept:"application/json","Content-Type":"multipart/form-data"},D=new FormData;return D.append("data",JSON.stringify({servername:se,user_options:re})),m?D.append("thumbnail",m):y&&D.append("thumbnail_data_url",y),(await tn.put(`/server/${se}`,D,{headers:We})).data},{mutate:we}=Fa({mutationFn:Ne,retry:1}),{mutate:ge}=Fa({mutationFn:He,retry:1});return g.useEffect(()=>{var se,re;S!=null&&S.name&&(S!=null&&S.user_options)&&(i(S.user_options.description||""),w((S==null?void 0:S.user_options.display_name)||""),U({...S.user_options,env:S.user_options.env?JSON.stringify(S.user_options.env):void 0}),z(S.user_options.public),R(S.user_options.keep_alive),b(S.user_options.thumbnail),O((se=S.user_options.share_with)==null?void 0:se.users),T((re=S.user_options.share_with)==null?void 0:re.groups))},[S,S==null?void 0:S.name,S==null?void 0:S.user_options,U,b,w]),g.useEffect(()=>{var se,re;P&&(U({display_name:P.display_name||"",description:P.description||"",framework:P.framework||"",filepath:P.filepath||"",conda_env:P.conda_env||"",env:P.env?JSON.stringify(P.env):void 0,custom_command:P.custom_command||"",profile:P.profile||""}),z(P.is_public),R(P.keep_alive),b(P.thumbnail),O((se=P.share_with)==null?void 0:se.users),T((re=P.share_with)==null?void 0:re.groups))},[P,U,b,w]),g.useEffect(()=>{I&&p(I.message)},[I,p]),f.jsxs("form",{id:"app-form",onSubmit:E(ne),className:"form",noValidate:!0,children:[f.jsxs("div",{className:"form-section",children:[f.jsx("h2",{children:"App Info"}),f.jsx(zo,{name:"display_name",control:ce,rules:Uu,render:({field:{ref:se,...re}})=>{var We;return f.jsx($r,{children:f.jsx(Fs,{...re,id:"display_name",label:"Name",placeholder:"Add app name",autoFocus:!0,required:!0,error:!!((We=ie.display_name)!=null&&We.message),inputProps:{maxLength:255}})})}}),f.jsx(zo,{name:"description",control:ce,render:({field:se})=>f.jsxs($r,{fullWidth:!0,className:"form-control outer-div",variant:"outlined",style:{position:"relative"},children:[f.jsx("label",{htmlFor:"description",className:"description-label"+(s.length>0||c?" label-float":""),style:{color:c?"#ba18da":s.length>0?"#646464":"transparent",backgroundColor:s.length>0||c?"#ffffff":"transparent"},children:"Description"}),f.jsx("textarea",{...se,ref:a,id:"description",value:s,onChange:re=>{i(re.target.value),se.onChange(re.target.value),d(re.target)},onFocus:()=>{de(!0)},onBlur:()=>{se.onBlur(),de(!1)},className:"description_text-field",placeholder:c?"Add app description (max. 200 characters)":"Description"}),f.jsx("div",{ref:l,className:"overlay-text",children:ye()}),f.jsxs(C2,{className:"form-helper-text",style:{textAlign:"right",marginRight:"0",fontSize:"1rem",color:s.length>200?"red":"inherit"},children:[s.length,"/200"]})]})})]}),f.jsxs("div",{className:"form-section",children:[f.jsx("h2",{children:"Configuration"}),f.jsx(zo,{name:"framework",control:ce,rules:Uu,render:({field:{ref:se,...re}})=>{var We;return f.jsxs($r,{children:[f.jsx(Rm,{id:"framework-label",required:!0,children:"Framework"}),f.jsx(fd,{...re,id:"framework",label:"Framework",required:!0,error:!!((We=ie.framework)!=null&&We.message),children:Y==null?void 0:Y.map(D=>f.jsx(xs,{value:D.name,children:D.display_name},D.name))})]})}}),$==="custom"?f.jsx(zo,{name:"custom_command",control:ce,rules:Uu,render:({field:{ref:se,...re}})=>f.jsx($r,{children:f.jsx(Fs,{...re,id:"custom_command",label:"Custom Command",required:$==="custom"})})}):f.jsx(f.Fragment,{}),G&&G.length>0?f.jsx(zo,{name:"conda_env",control:ce,rules:Uu,render:({field:{ref:se,...re}})=>{var We;return f.jsxs($r,{children:[f.jsx(Rm,{id:"framework-label",required:!0,children:"Software Environment"}),f.jsx(fd,{...re,id:"conda_env",label:"Software Environment",required:!0,error:!!((We=ie.conda_env)!=null&&We.message),children:G.map(D=>f.jsx(xs,{value:D,children:D},D))})]})}}):f.jsx(f.Fragment,{}),f.jsx(zo,{name:"filepath",control:ce,render:({field:{ref:se,...re}})=>{var We;return f.jsx($r,{children:f.jsx(Fs,{...re,id:"filepath",label:"File path",placeholder:'Enter the path to the file, e.g. "/shared/users/panel_basic.py"',error:!!((We=ie.filepath)!=null&&We.message)})})}}),f.jsx(zo,{name:"env",control:ce,render:({field:{ref:se,...re}})=>f.jsx($r,{children:f.jsx(Fs,{...re,id:"env",label:"Environment Variables",placeholder:'Enter valid json: {"KEY_1":"VALUE_1","KEY_2":"VALUE_2"}'})})}),f.jsxs(ut,{sx:{display:"flex",flexDirection:"row"},children:[f.jsx(JP,{placement:"bottom-start",title:f.jsx(zt,{sx:{fontSize:"10px",fontWeight:600},children:"Keep alive prevents the app from being suspended even when not in active use. Your app will be instantly available, but it will consume resources until manually stopped."}),children:f.jsx(n5,{fontSize:"small",sx:{position:"relative",top:"9px",left:"2px",color:"#0F10158F"}})}),f.jsx(zo,{name:"keep_alive",control:ce,render:({field:{ref:se,value:re,onChange:We,...D}})=>f.jsx($r,{sx:{flexDirection:"row"},children:f.jsx(fa,{control:f.jsx(G2,{...D,id:"keep_alive",checked:V,onChange:()=>{R(!V)}}),label:"Keep app alive",labelPlacement:"start"})})})]})]}),f.jsxs("div",{className:"form-section",children:[f.jsx("h2",{children:"Sharing"}),f.jsx(LU,{url:S==null?void 0:S.url,permissions:(Ie=S==null?void 0:S.user_options)==null?void 0:Ie.share_with,isPublic:H,setCurrentUserPermissions:O,setCurrentGroupPermissions:T,setIsPublic:z})]}),f.jsxs("div",{className:"form-section",children:[f.jsx("h2",{children:"App Thumbnail"}),f.jsx(zo,{name:"thumbnail",control:ce,render:({field:{ref:se,value:re,onChange:We,...D}})=>f.jsx($r,{children:f.jsx(AQ,{...D,id:"thumbnail",currentImage:y,setCurrentImage:b,currentFile:m,setCurrentFile:v})})})]}),f.jsx("hr",{}),f.jsxs("div",{className:"button-section",children:[f.jsx("div",{className:"prev",children:f.jsx(ct,{id:"cancel-btn",type:"button",variant:"text",color:"secondary",onClick:()=>Vr(`${ir}`),children:"Cancel"})}),f.jsx("div",{className:"next",children:f.jsx(ct,{id:"submit-btn",type:"submit",variant:"contained",color:"primary",disabled:q||k||Z||n||s.length>200,children:B&&B.length>0?f.jsx(f.Fragment,{children:"Next"}):e?f.jsx(f.Fragment,{children:"Save"}):f.jsx(f.Fragment,{children:"Create App"})})})]})]})};var B8={},wU=vt;Object.defineProperty(B8,"__esModule",{value:!0});var B5=B8.default=void 0,HU=wU(ht()),jU=f;B5=B8.default=(0,HU.default)((0,jU.jsx)("path",{d:"M15 20H5V7c0-.55-.45-1-1-1s-1 .45-1 1v13c0 1.1.9 2 2 2h10c.55 0 1-.45 1-1s-.45-1-1-1m5-4V4c0-1.1-.9-2-2-2H9c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h9c1.1 0 2-.9 2-2m-2 0H9V4h9z"}),"ContentCopyRounded");var V8={},zU=vt;Object.defineProperty(V8,"__esModule",{value:!0});var V5=V8.default=void 0,OU=zU(ht()),DU=f;V5=V8.default=(0,OU.default)((0,DU.jsx)("path",{d:"M15.41 16.59 10.83 12l4.58-4.59L14 6l-6 6 6 6z"}),"KeyboardArrowLeft");var I8={},CU=vt;Object.defineProperty(I8,"__esModule",{value:!0});var I5=I8.default=void 0,TU=CU(ht()),SU=f;I5=I8.default=(0,TU.default)((0,SU.jsx)("path",{d:"M8.59 16.59 13.17 12 8.59 7.41 10 6l6 6-6 6z"}),"KeyboardArrowRight");var W8={},RU=vt;Object.defineProperty(W8,"__esModule",{value:!0});var W5=W8.default=void 0,EU=RU(ht()),kU=f;W5=W8.default=(0,EU.default)((0,kU.jsx)("path",{d:"M4.47 21h15.06c1.54 0 2.5-1.67 1.73-3L13.73 4.99c-.77-1.33-2.69-1.33-3.46 0L2.74 18c-.77 1.33.19 3 1.73 3M12 14c-.55 0-1-.45-1-1v-2c0-.55.45-1 1-1s1 .45 1 1v2c0 .55-.45 1-1 1m1 4h-2v-2h2z"}),"WarningRounded");const ft=Q("div")(({theme:e})=>({padding:e.spacing(0)}));function MU(e){const{count:t,page:n,rowsPerPage:r,onPageChange:o}=e,s=a=>{o(a,n-1)},i=a=>{o(a,n+1)};return f.jsxs(ut,{sx:{flexShrink:0,ml:2.5},children:[f.jsx(Fr,{onClick:s,disabled:n===0,"aria-label":"previous page","data-testid":"previous-page",children:f.jsx(V5,{})}),f.jsx(Fr,{onClick:i,disabled:n>=Math.ceil(t/r)-1,"aria-label":"next page","data-testid":"next-page",children:f.jsx(I5,{})})]})}const LU=({url:e,permissions:t,isPublic:n,setCurrentUserPermissions:r,setCurrentGroupPermissions:o,setIsPublic:s})=>{const[i]=Ye(Hi),[a]=g.useState("Warning: adding individuals or groups will allow others to access this app."),[l,c]=g.useState(!1),[u,d]=g.useState([]),[p,P]=g.useState([]),[h,A]=g.useState([]),[w,m]=g.useState(0),[v]=g.useState(5),[y,b]=g.useState([]),H=()=>{if(p.length>0){const j=[...new Set([...h,...p])];A(j),o(()=>j.filter(O=>O.type==="group").map(O=>O.name)),r(()=>j.filter(O=>O.type==="user").map(O=>O.name))}b([])},z=(j,O)=>{j&&m(O)};return g.useEffect(()=>{if(i&&i.share_permissions){const j=[];j.push(...i.share_permissions.users.map(O=>({name:O,type:"user"}))),j.push(...i.share_permissions.groups.map(O=>({name:O,type:"group"}))),d(j)}},[i]),g.useEffect(()=>{if(t){const j=[];j.push(...t.users.map(O=>({name:O,type:"user"}))),j.push(...t.groups.map(O=>({name:O,type:"group"}))),A(j)}},[t]),f.jsx(ut,{id:"app-sharing",children:f.jsxs(mi,{direction:"column",children:[i!=null&&i.share_permissions?f.jsxs(f.Fragment,{children:[f.jsx(ft,{children:f.jsx(n2,{id:"sharing-notification",severity:"warning",icon:f.jsx(W5,{sx:{color:"#EAB54E"}}),sx:{mb:"16px"},children:a})}),f.jsxs(ft,{sx:{pb:"8px"},children:[f.jsx(zt,{variant:"subtitle1",children:"Individuals and group access"}),f.jsxs(ut,{sx:{display:"flex",flexDirection:"row",width:"100%",gap:"8px",py:"16px"},children:[f.jsx(ut,{sx:{display:"flex",flexDirection:"row",justifyContent:"flex-start"},children:f.jsx(PR,{disablePortal:!0,id:"share-permissions-autocomplete",options:u,getOptionLabel:j=>j.type==="user"?j.name:`${j.name} (Group)`,multiple:!0,disableCloseOnSelect:!0,clearOnBlur:!0,limitTags:2,sx:{width:470},renderInput:j=>f.jsx(Fs,{...j,placeholder:y.length>0?void 0:"Search one or more usernames or group names"}),value:y,onChange:(j,O)=>{j&&O&&(P(O),b(O))}})}),f.jsx(ut,{sx:{display:"flex",flexDirection:"row",justifyContent:"flex-end",margin:"auto auto"},children:f.jsx(ct,{variant:"contained",color:"primary",onClick:H,disabled:p.length===0,sx:{height:"42px"},children:"Share"})})]})]}),h.length>0?f.jsx(ft,{sx:{pb:"20px"},children:f.jsx(Dr,{elevation:0,children:f.jsx(_2,{children:f.jsxs(Q2,{"aria-label":"Individuals and Groups",size:"small",children:[f.jsx(K2,{children:(v>0?h.slice(w*v,w*v+v):h).map(j=>f.jsxs(dd,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[f.jsxs(Cn,{component:"td",scope:"row",sx:{fontSize:"16px"},children:[j.name," ",j.type==="group"?f.jsxs("span",{style:{fontWeight:600},children:[" ","(Group)"]}):f.jsx(f.Fragment,{})]}),f.jsx(Cn,{align:"right",children:f.jsx(ct,{variant:"text",color:"error",size:"small",sx:{fontWeight:"600",fontSize:"14px"},onClick:()=>{A(O=>O.filter(C=>C.name!==j.name)),j.type==="group"?o(O=>O.filter(C=>C!==j.name)):r(O=>O.filter(C=>C!==j.name))},children:"Remove"})})]},j.name))}),f.jsx(nN,{children:f.jsx(dd,{children:f.jsx(kN,{colSpan:2,count:h.length,rowsPerPage:v,rowsPerPageOptions:[5,10,25,{label:"All",value:-1}],page:w,showFirstButton:!1,showLastButton:!1,width:"500px",slotProps:{select:{inputProps:{"aria-label":"rows per page",width:"500px"},native:!1}},onPageChange:z,ActionsComponent:MU})})})]})})})}):f.jsx(f.Fragment,{})]}):f.jsx(f.Fragment,{}),f.jsx(ft,{sx:{pb:"16px"},children:f.jsx(ut,{children:f.jsx(Dr,{elevation:0,children:f.jsxs(mi,{direction:"column",children:[f.jsx(ft,{sx:{pt:"8px"},children:f.jsx(fa,{control:f.jsx(G2,{id:"is-public",checked:n,onChange:()=>s(!n)}),label:"Public access",labelPlacement:"start"})}),f.jsx(ft,{sx:{px:"16px",pt:"16px",pb:"4px"},children:f.jsx(ut,{sx:{display:"flex",flexDirection:"row",gap:"8px",pb:"8px"},children:n?f.jsxs(f.Fragment,{children:[f.jsx(hv,{sx:{fontSize:"24px"}}),f.jsx(zt,{variant:"body1",children:"Link sharing public"})]}):f.jsxs(f.Fragment,{children:[f.jsx(vv,{sx:{fontSize:"24px"}}),f.jsx(zt,{variant:"body1",children:"Link sharing restricted"})]})})}),f.jsx(ft,{sx:{pl:"16px",pb:"16px"},children:n?f.jsxs(zt,{variant:"body2",children:["This app is accessible to"," ",f.jsx(zt,{component:"span",variant:"body2",color:"error",children:"anyone via its link and sign in is not required."})]}):f.jsx(zt,{variant:"body2",children:"This app is accessible to you and the people added above via its link."})}),e?f.jsx(ft,{sx:{p:"16px",pt:0},children:f.jsx(Fs,{id:"sharing-link",placeholder:"http://","aria-label":"Sharing link",fullWidth:!0,InputProps:{endAdornment:f.jsx(M2,{position:"end",children:f.jsx(BC,{onClickAway:()=>c(!1),children:f.jsx(JP,{PopperProps:{disablePortal:!0},onClose:()=>c(!1),open:l,disableFocusListener:!0,disableHoverListener:!0,disableTouchListener:!0,title:"Copied to clipboard!",placement:"top",children:f.jsx(Fr,{id:"copy-to-clipboard",onClick:()=>{e&&window.isSecureContext&&(navigator.clipboard.writeText(Ox(e)),c(!0))},children:f.jsx(B5,{})})})})})},value:Ox(e)})}):f.jsx(f.Fragment,{})]})})})})]})})};var J5={exports:{}};/*! +`+s):r.stack=s}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Qa(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:s}=n;r!==void 0&&pA.assertOptions(r,{silentJSONParsing:qo.transitional(qo.boolean),forcedJSONParsing:qo.transitional(qo.boolean),clarifyTimeoutError:qo.transitional(qo.boolean)},!1),o!=null&&(te.isFunction(o)?n.paramsSerializer={serialize:o}:pA.assertOptions(o,{encode:qo.function,serialize:qo.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=s&&te.merge(s.common,s[n.method]);s&&te.forEach(["delete","get","head","post","put","patch","common"],h=>{delete s[h]}),n.headers=Mo.concat(i,s);const a=[];let l=!0;this.interceptors.request.forEach(function(A){typeof A.runWhen=="function"&&A.runWhen(n)===!1||(l=l&&A.synchronous,a.unshift(A.fulfilled,A.rejected))});const c=[];this.interceptors.response.forEach(function(A){c.push(A.fulfilled,A.rejected)});let u,d=0,p;if(!l){const h=[Xx.bind(this),void 0];for(h.unshift.apply(h,a),h.push.apply(h,c),p=h.length,u=Promise.resolve(n);d{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](o);r._listeners=null}),this.promise.then=o=>{let s;const i=new Promise(a=>{r.subscribe(a),s=a}).then(o);return i.cancel=function(){r.unsubscribe(s)},i},t(function(s,i,a){r.reason||(r.reason=new Pu(s,i,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new R8(function(o){t=o}),cancel:t}}}const tU=R8;function nU(e){return function(n){return e.apply(null,n)}}function rU(e){return te.isObject(e)&&e.isAxiosError===!0}const vA={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(vA).forEach(([e,t])=>{vA[t]=e});const oU=vA;function w5(e){const t=new Cf(e),n=r5(Cf.prototype.request,t);return te.extend(n,Cf.prototype,t,{allOwnKeys:!0}),te.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return w5(Qa(e,o))},n}const Qt=w5(T8);Qt.Axios=Cf;Qt.CanceledError=Pu;Qt.CancelToken=tU;Qt.isCancel=y5;Qt.VERSION=x5;Qt.toFormData=yv;Qt.AxiosError=nt;Qt.Cancel=Qt.CanceledError;Qt.all=function(t){return Promise.all(t)};Qt.spread=nU;Qt.isAxiosError=rU;Qt.mergeConfig=Qa;Qt.AxiosHeaders=Mo;Qt.formToJSON=e=>P5(te.isHTMLForm(e)?new FormData(e):e);Qt.getAdapter=b5.getAdapter;Qt.HttpStatusCode=oU;Qt.default=Qt;const tn=Qt.create({baseURL:"/services/japps",headers:{"Content-Type":"application/json"}});tn.interceptors.response.use(e=>e,e=>{const t=e.response.status;(e.response.status===401||t===403)&&(window.location.href="/services/japps/jhub-login")});var yu=e=>e.type==="checkbox",na=e=>e instanceof Date,Sn=e=>e==null;const H5=e=>typeof e=="object";var sn=e=>!Sn(e)&&!Array.isArray(e)&&H5(e)&&!na(e),j5=e=>sn(e)&&e.target?yu(e.target)?e.target.checked:e.target.value:e,sU=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,z5=(e,t)=>e.has(sU(t)),iU=e=>{const t=e.constructor&&e.constructor.prototype;return sn(t)&&t.hasOwnProperty("isPrototypeOf")},E8=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Xn(e){let t;const n=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(E8&&(e instanceof Blob||e instanceof FileList))&&(n||sn(e)))if(t=n?[]:{},!n&&!iU(e))t=e;else for(const r in e)e.hasOwnProperty(r)&&(t[r]=Xn(e[r]));else return e;return t}var gu=e=>Array.isArray(e)?e.filter(Boolean):[],Wt=e=>e===void 0,xe=(e,t,n)=>{if(!t||!sn(e))return n;const r=gu(t.split(/[,[\].]+?/)).reduce((o,s)=>Sn(o)?o:o[s],e);return Wt(r)||r===e?Wt(e[t])?n:e[t]:r},Wr=e=>typeof e=="boolean";const xd={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Jr={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},jo={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},aU=De.createContext(null),k8=()=>De.useContext(aU);var O5=(e,t,n,r=!0)=>{const o={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(o,s,{get:()=>{const i=s;return t._proxyFormState[i]!==Jr.all&&(t._proxyFormState[i]=!r||Jr.all),n&&(n[i]=!0),e[i]}});return o},tr=e=>sn(e)&&!Object.keys(e).length,D5=(e,t,n,r)=>{n(e);const{name:o,...s}=e;return tr(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(i=>t[i]===(!r||Jr.all))},Tf=e=>Array.isArray(e)?e:[e],C5=(e,t,n)=>!e||!t||e===t||Tf(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r)));function M8(e){const t=De.useRef(e);t.current=e,De.useEffect(()=>{const n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}function lU(e){const t=k8(),{control:n=t.control,disabled:r,name:o,exact:s}=e||{},[i,a]=De.useState(n._formState),l=De.useRef(!0),c=De.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),u=De.useRef(o);return u.current=o,M8({disabled:r,next:d=>l.current&&C5(u.current,d.name,s)&&D5(d,c.current,n._updateFormState)&&a({...n._formState,...d}),subject:n._subjects.state}),De.useEffect(()=>(l.current=!0,c.current.isValid&&n._updateValid(!0),()=>{l.current=!1}),[n]),O5(i,n,c.current,!1)}var uo=e=>typeof e=="string",T5=(e,t,n,r,o)=>uo(e)?(r&&t.watch.add(e),xe(n,e,o)):Array.isArray(e)?e.map(s=>(r&&t.watch.add(s),xe(n,s))):(r&&(t.watchAll=!0),n);function cU(e){const t=k8(),{control:n=t.control,name:r,defaultValue:o,disabled:s,exact:i}=e||{},a=De.useRef(r);a.current=r,M8({disabled:s,subject:n._subjects.values,next:u=>{C5(a.current,u.name,i)&&c(Xn(T5(a.current,n._names,u.values||n._formValues,!1,o)))}});const[l,c]=De.useState(n._getWatch(r,o));return De.useEffect(()=>n._removeUnmounted()),l}var L8=e=>/^\w*$/.test(e),S5=e=>gu(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Pt=(e,t,n)=>{let r=-1;const o=L8(t)?[t]:S5(t),s=o.length,i=s-1;for(;++r{const u=o._options.shouldUnregister||s,d=(p,P)=>{const h=xe(o._fields,p);h&&(h._f.mount=P)};if(d(n,!0),u){const p=Xn(xe(o._options.defaultValues,n));Pt(o._defaultValues,n,p),Wt(xe(o._formValues,n))&&Pt(o._formValues,n,p)}return()=>{(i?u&&!o._state.action:u)?o.unregister(n):d(n,!1)}},[n,o,i,s]),De.useEffect(()=>{xe(o._fields,n)&&o._updateDisabledField({disabled:r,fields:o._fields,name:n,value:xe(o._fields,n)._f.value})},[r,n,o]),{field:{name:n,value:a,...Wr(r)||l.disabled?{disabled:l.disabled||r}:{},onChange:De.useCallback(u=>c.current.onChange({target:{value:j5(u),name:n},type:xd.CHANGE}),[n]),onBlur:De.useCallback(()=>c.current.onBlur({target:{value:xe(o._formValues,n),name:n},type:xd.BLUR}),[n,o]),ref:u=>{const d=xe(o._fields,n);d&&u&&(d._f.ref={focus:()=>u.focus(),select:()=>u.select(),setCustomValidity:p=>u.setCustomValidity(p),reportValidity:()=>u.reportValidity()})}},formState:l,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!xe(l.errors,n)},isDirty:{enumerable:!0,get:()=>!!xe(l.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!xe(l.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!xe(l.validatingFields,n)},error:{enumerable:!0,get:()=>xe(l.errors,n)}})}}const zo=e=>e.render(uU(e));var fU=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{},Vx=e=>({isOnSubmit:!e||e===Jr.onSubmit,isOnBlur:e===Jr.onBlur,isOnChange:e===Jr.onChange,isOnAll:e===Jr.all,isOnTouch:e===Jr.onTouched}),Ix=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const ac=(e,t,n,r)=>{for(const o of n||Object.keys(e)){const s=xe(e,o);if(s){const{_f:i,...a}=s;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],o)&&!r)break;if(i.ref&&t(i.ref,i.name)&&!r)break;ac(a,t)}else sn(a)&&ac(a,t)}}};var dU=(e,t,n)=>{const r=gu(xe(e,n));return Pt(r,"root",t[n]),Pt(e,n,r),e},X8=e=>e.type==="file",ps=e=>typeof e=="function",wd=e=>{if(!E8)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Sf=e=>uo(e),N8=e=>e.type==="radio",Hd=e=>e instanceof RegExp;const Wx={value:!1,isValid:!1},Jx={value:!0,isValid:!0};var R5=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Wt(e[0].attributes.value)?Wt(e[0].value)||e[0].value===""?Jx:{value:e[0].value,isValid:!0}:Jx:Wx}return Wx};const Fx={isValid:!1,value:null};var E5=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,Fx):Fx;function Yx(e,t,n="validate"){if(Sf(e)||Array.isArray(e)&&e.every(Sf)||Wr(e)&&!e)return{type:n,message:Sf(e)?e:"",ref:t}}var Li=e=>sn(e)&&!Hd(e)?e:{value:e,message:""},qx=async(e,t,n,r,o)=>{const{ref:s,refs:i,required:a,maxLength:l,minLength:c,min:u,max:d,pattern:p,validate:P,name:h,valueAsNumber:A,mount:w,disabled:m}=e._f,v=xe(t,h);if(!w||m)return{};const y=i?i[0]:s,b=R=>{r&&y.reportValidity&&(y.setCustomValidity(Wr(R)?"":R||""),y.reportValidity())},H={},z=N8(s),j=yu(s),O=z||j,C=(A||X8(s))&&Wt(s.value)&&Wt(v)||wd(s)&&s.value===""||v===""||Array.isArray(v)&&!v.length,T=fU.bind(null,h,n,H),V=(R,S,I,Y=jo.maxLength,q=jo.minLength)=>{const G=R?S:I;H[h]={type:R?Y:q,message:G,ref:s,...T(R?Y:q,G)}};if(o?!Array.isArray(v)||!v.length:a&&(!O&&(C||Sn(v))||Wr(v)&&!v||j&&!R5(i).isValid||z&&!E5(i).isValid)){const{value:R,message:S}=Sf(a)?{value:!!a,message:a}:Li(a);if(R&&(H[h]={type:jo.required,message:S,ref:y,...T(jo.required,S)},!n))return b(S),H}if(!C&&(!Sn(u)||!Sn(d))){let R,S;const I=Li(d),Y=Li(u);if(!Sn(v)&&!isNaN(v)){const q=s.valueAsNumber||v&&+v;Sn(I.value)||(R=q>I.value),Sn(Y.value)||(S=qnew Date(new Date().toDateString()+" "+Z),k=s.type=="time",B=s.type=="week";uo(I.value)&&v&&(R=k?G(v)>G(I.value):B?v>I.value:q>new Date(I.value)),uo(Y.value)&&v&&(S=k?G(v)+R.value,Y=!Sn(S.value)&&v.length<+S.value;if((I||Y)&&(V(I,R.message,S.message),!n))return b(H[h].message),H}if(p&&!C&&uo(v)){const{value:R,message:S}=Li(p);if(Hd(R)&&!v.match(R)&&(H[h]={type:jo.pattern,message:S,ref:s,...T(jo.pattern,S)},!n))return b(S),H}if(P){if(ps(P)){const R=await P(v,t),S=Yx(R,y);if(S&&(H[h]={...S,...T(jo.validate,S.message)},!n))return b(S.message),H}else if(sn(P)){let R={};for(const S in P){if(!tr(R)&&!n)break;const I=Yx(await P[S](v,t),y,S);I&&(R={...I,...T(S,I.message)},b(I.message),n&&(H[h]=R))}if(!tr(R)&&(H[h]={ref:y,...R},!n))return H}}return b(!0),H};function pU(e,t){const n=t.slice(0,-1).length;let r=0;for(;r{let e=[];return{get observers(){return e},next:o=>{for(const s of e)s.next&&s.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(s=>s!==o)}}),unsubscribe:()=>{e=[]}}},jd=e=>Sn(e)||!H5(e);function Ys(e,t){if(jd(e)||jd(t))return e===t;if(na(e)&&na(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n){const s=e[o];if(!r.includes(o))return!1;if(o!=="ref"){const i=t[o];if(na(s)&&na(i)||sn(s)&&sn(i)||Array.isArray(s)&&Array.isArray(i)?!Ys(s,i):s!==i)return!1}}return!0}var k5=e=>e.type==="select-multiple",hU=e=>N8(e)||yu(e),wh=e=>wd(e)&&e.isConnected,M5=e=>{for(const t in e)if(ps(e[t]))return!0;return!1};function zd(e,t={}){const n=Array.isArray(e);if(sn(e)||n)for(const r in e)Array.isArray(e[r])||sn(e[r])&&!M5(e[r])?(t[r]=Array.isArray(e[r])?[]:{},zd(e[r],t[r])):Sn(e[r])||(t[r]=!0);return t}function L5(e,t,n){const r=Array.isArray(e);if(sn(e)||r)for(const o in e)Array.isArray(e[o])||sn(e[o])&&!M5(e[o])?Wt(t)||jd(n[o])?n[o]=Array.isArray(e[o])?zd(e[o],[]):{...zd(e[o])}:L5(e[o],Sn(t)?{}:t[o],n[o]):n[o]=!Ys(e[o],t[o]);return n}var nf=(e,t)=>L5(e,t,zd(t)),X5=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>Wt(e)?e:t?e===""?NaN:e&&+e:n&&uo(e)?new Date(e):r?r(e):e;function Hh(e){const t=e.ref;if(!(e.refs?e.refs.every(n=>n.disabled):t.disabled))return X8(t)?t.files:N8(t)?E5(e.refs).value:k5(t)?[...t.selectedOptions].map(({value:n})=>n):yu(t)?R5(e.refs).value:X5(Wt(t.value)?e.ref.value:t.value,e)}var mU=(e,t,n,r)=>{const o={};for(const s of e){const i=xe(t,s);i&&Pt(o,s,i._f)}return{criteriaMode:n,names:[...e],fields:o,shouldUseNativeValidation:r}},Tl=e=>Wt(e)?e:Hd(e)?e.source:sn(e)?Hd(e.value)?e.value.source:e.value:e,AU=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function Zx(e,t,n){const r=xe(e,n);if(r||L8(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const s=o.join("."),i=xe(t,s),a=xe(e,s);if(i&&!Array.isArray(i)&&n!==s)return{name:n};if(a&&a.type)return{name:s,error:a};o.pop()}return{name:n}}var PU=(e,t,n,r,o)=>o.isOnAll?!1:!n&&o.isOnTouch?!(t||e):(n?r.isOnBlur:o.isOnBlur)?!e:(n?r.isOnChange:o.isOnChange)?e:!0,yU=(e,t)=>!gu(xe(e,t)).length&&_t(e,t);const gU={mode:Jr.onSubmit,reValidateMode:Jr.onChange,shouldFocusError:!0};function bU(e={}){let t={...gU,...e},n={submitCount:0,isDirty:!1,isLoading:ps(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},o=sn(t.defaultValues)||sn(t.values)?Xn(t.defaultValues||t.values)||{}:{},s=t.shouldUnregister?{}:Xn(o),i={action:!1,mount:!1,watch:!1},a={mount:new Set,unMount:new Set,array:new Set,watch:new Set},l,c=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={values:xh(),array:xh(),state:xh()},p=Vx(t.mode),P=Vx(t.reValidateMode),h=t.criteriaMode===Jr.all,A=D=>N=>{clearTimeout(c),c=setTimeout(D,N)},w=async D=>{if(u.isValid||D){const N=t.resolver?tr((await O()).errors):await T(r,!0);N!==n.isValid&&d.state.next({isValid:N})}},m=(D,N)=>{(u.isValidating||u.validatingFields)&&((D||Array.from(a.mount)).forEach(W=>{W&&(N?Pt(n.validatingFields,W,N):_t(n.validatingFields,W))}),d.state.next({validatingFields:n.validatingFields,isValidating:!tr(n.validatingFields)}))},v=(D,N=[],W,oe,ae=!0,_=!0)=>{if(oe&&W){if(i.action=!0,_&&Array.isArray(xe(r,D))){const ue=W(xe(r,D),oe.argA,oe.argB);ae&&Pt(r,D,ue)}if(_&&Array.isArray(xe(n.errors,D))){const ue=W(xe(n.errors,D),oe.argA,oe.argB);ae&&Pt(n.errors,D,ue),yU(n.errors,D)}if(u.touchedFields&&_&&Array.isArray(xe(n.touchedFields,D))){const ue=W(xe(n.touchedFields,D),oe.argA,oe.argB);ae&&Pt(n.touchedFields,D,ue)}u.dirtyFields&&(n.dirtyFields=nf(o,s)),d.state.next({name:D,isDirty:R(D,N),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Pt(s,D,N)},y=(D,N)=>{Pt(n.errors,D,N),d.state.next({errors:n.errors})},b=D=>{n.errors=D,d.state.next({errors:n.errors,isValid:!1})},H=(D,N,W,oe)=>{const ae=xe(r,D);if(ae){const _=xe(s,D,Wt(W)?xe(o,D):W);Wt(_)||oe&&oe.defaultChecked||N?Pt(s,D,N?_:Hh(ae._f)):Y(D,_),i.mount&&w()}},z=(D,N,W,oe,ae)=>{let _=!1,ue=!1;const Ee={name:D},Je=!!(xe(r,D)&&xe(r,D)._f.disabled);if(!W||oe){u.isDirty&&(ue=n.isDirty,n.isDirty=Ee.isDirty=R(),_=ue!==Ee.isDirty);const _e=Je||Ys(xe(o,D),N);ue=!!(!Je&&xe(n.dirtyFields,D)),_e||Je?_t(n.dirtyFields,D):Pt(n.dirtyFields,D,!0),Ee.dirtyFields=n.dirtyFields,_=_||u.dirtyFields&&ue!==!_e}if(W){const _e=xe(n.touchedFields,D);_e||(Pt(n.touchedFields,D,W),Ee.touchedFields=n.touchedFields,_=_||u.touchedFields&&_e!==W)}return _&&ae&&d.state.next(Ee),_?Ee:{}},j=(D,N,W,oe)=>{const ae=xe(n.errors,D),_=u.isValid&&Wr(N)&&n.isValid!==N;if(e.delayError&&W?(l=A(()=>y(D,W)),l(e.delayError)):(clearTimeout(c),l=null,W?Pt(n.errors,D,W):_t(n.errors,D)),(W?!Ys(ae,W):ae)||!tr(oe)||_){const ue={...oe,..._&&Wr(N)?{isValid:N}:{},errors:n.errors,name:D};n={...n,...ue},d.state.next(ue)}},O=async D=>{m(D,!0);const N=await t.resolver(s,t.context,mU(D||a.mount,r,t.criteriaMode,t.shouldUseNativeValidation));return m(D),N},C=async D=>{const{errors:N}=await O(D);if(D)for(const W of D){const oe=xe(N,W);oe?Pt(n.errors,W,oe):_t(n.errors,W)}else n.errors=N;return N},T=async(D,N,W={valid:!0})=>{for(const oe in D){const ae=D[oe];if(ae){const{_f:_,...ue}=ae;if(_){const Ee=a.array.has(_.name);m([oe],!0);const Je=await qx(ae,s,h,t.shouldUseNativeValidation&&!N,Ee);if(m([oe]),Je[_.name]&&(W.valid=!1,N))break;!N&&(xe(Je,_.name)?Ee?dU(n.errors,Je,_.name):Pt(n.errors,_.name,Je[_.name]):_t(n.errors,_.name))}ue&&await T(ue,N,W)}}return W.valid},V=()=>{for(const D of a.unMount){const N=xe(r,D);N&&(N._f.refs?N._f.refs.every(W=>!wh(W)):!wh(N._f.ref))&&$(D)}a.unMount=new Set},R=(D,N)=>(D&&N&&Pt(s,D,N),!Ys(ce(),o)),S=(D,N,W)=>T5(D,a,{...i.mount?s:Wt(N)?o:uo(D)?{[D]:N}:N},W,N),I=D=>gu(xe(i.mount?s:o,D,e.shouldUnregister?xe(o,D,[]):[])),Y=(D,N,W={})=>{const oe=xe(r,D);let ae=N;if(oe){const _=oe._f;_&&(!_.disabled&&Pt(s,D,X5(N,_)),ae=wd(_.ref)&&Sn(N)?"":N,k5(_.ref)?[..._.ref.options].forEach(ue=>ue.selected=ae.includes(ue.value)):_.refs?yu(_.ref)?_.refs.length>1?_.refs.forEach(ue=>(!ue.defaultChecked||!ue.disabled)&&(ue.checked=Array.isArray(ae)?!!ae.find(Ee=>Ee===ue.value):ae===ue.value)):_.refs[0]&&(_.refs[0].checked=!!ae):_.refs.forEach(ue=>ue.checked=ue.value===ae):X8(_.ref)?_.ref.value="":(_.ref.value=ae,_.ref.type||d.values.next({name:D,values:{...s}})))}(W.shouldDirty||W.shouldTouch)&&z(D,ae,W.shouldTouch,W.shouldDirty,!0),W.shouldValidate&&Z(D)},q=(D,N,W)=>{for(const oe in N){const ae=N[oe],_=`${D}.${oe}`,ue=xe(r,_);(a.array.has(D)||!jd(ae)||ue&&!ue._f)&&!na(ae)?q(_,ae,W):Y(_,ae,W)}},G=(D,N,W={})=>{const oe=xe(r,D),ae=a.array.has(D),_=Xn(N);Pt(s,D,_),ae?(d.array.next({name:D,values:{...s}}),(u.isDirty||u.dirtyFields)&&W.shouldDirty&&d.state.next({name:D,dirtyFields:nf(o,s),isDirty:R(D,_)})):oe&&!oe._f&&!Sn(_)?q(D,_,W):Y(D,_,W),Ix(D,a)&&d.state.next({...n}),d.values.next({name:i.mount?D:void 0,values:{...s}})},k=async D=>{i.mount=!0;const N=D.target;let W=N.name,oe=!0;const ae=xe(r,W),_=()=>N.type?Hh(ae._f):j5(D),ue=Ee=>{oe=Number.isNaN(Ee)||Ee===xe(s,W,Ee)};if(ae){let Ee,Je;const _e=_(),Be=D.type===xd.BLUR||D.type===xd.FOCUS_OUT,me=!AU(ae._f)&&!t.resolver&&!xe(n.errors,W)&&!ae._f.deps||PU(Be,xe(n.touchedFields,W),n.isSubmitted,P,p),$e=Ix(W,a,Be);Pt(s,W,_e),Be?(ae._f.onBlur&&ae._f.onBlur(D),l&&l(0)):ae._f.onChange&&ae._f.onChange(D);const Jt=z(W,_e,Be,!1),Rt=!tr(Jt)||$e;if(!Be&&d.values.next({name:W,type:D.type,values:{...s}}),me)return u.isValid&&w(),Rt&&d.state.next({name:W,...$e?{}:Jt});if(!Be&&$e&&d.state.next({...n}),t.resolver){const{errors:ze}=await O([W]);if(ue(_e),oe){const Ge=Zx(n.errors,r,W),X=Zx(ze,r,Ge.name||W);Ee=X.error,W=X.name,Je=tr(ze)}}else m([W],!0),Ee=(await qx(ae,s,h,t.shouldUseNativeValidation))[W],m([W]),ue(_e),oe&&(Ee?Je=!1:u.isValid&&(Je=await T(r,!0)));oe&&(ae._f.deps&&Z(ae._f.deps),j(W,Je,Ee,Jt))}},B=(D,N)=>{if(xe(n.errors,N)&&D.focus)return D.focus(),1},Z=async(D,N={})=>{let W,oe;const ae=Tf(D);if(t.resolver){const _=await C(Wt(D)?D:ae);W=tr(_),oe=D?!ae.some(ue=>xe(_,ue)):W}else D?(oe=(await Promise.all(ae.map(async _=>{const ue=xe(r,_);return await T(ue&&ue._f?{[_]:ue}:ue)}))).every(Boolean),!(!oe&&!n.isValid)&&w()):oe=W=await T(r);return d.state.next({...!uo(D)||u.isValid&&W!==n.isValid?{}:{name:D},...t.resolver||!D?{isValid:W}:{},errors:n.errors}),N.shouldFocus&&!oe&&ac(r,B,D?ae:a.mount),oe},ce=D=>{const N={...i.mount?s:o};return Wt(D)?N:uo(D)?xe(N,D):D.map(W=>xe(N,W))},E=(D,N)=>({invalid:!!xe((N||n).errors,D),isDirty:!!xe((N||n).dirtyFields,D),isTouched:!!xe((N||n).touchedFields,D),isValidating:!!xe((N||n).validatingFields,D),error:xe((N||n).errors,D)}),U=D=>{D&&Tf(D).forEach(N=>_t(n.errors,N)),d.state.next({errors:D?n.errors:{}})},F=(D,N,W)=>{const oe=(xe(r,D,{_f:{}})._f||{}).ref;Pt(n.errors,D,{...N,ref:oe}),d.state.next({name:D,errors:n.errors,isValid:!1}),W&&W.shouldFocus&&oe&&oe.focus&&oe.focus()},ie=(D,N)=>ps(D)?d.values.subscribe({next:W=>D(S(void 0,N),W)}):S(D,N,!0),$=(D,N={})=>{for(const W of D?Tf(D):a.mount)a.mount.delete(W),a.array.delete(W),N.keepValue||(_t(r,W),_t(s,W)),!N.keepError&&_t(n.errors,W),!N.keepDirty&&_t(n.dirtyFields,W),!N.keepTouched&&_t(n.touchedFields,W),!N.keepIsValidating&&_t(n.validatingFields,W),!t.shouldUnregister&&!N.keepDefaultValue&&_t(o,W);d.values.next({values:{...s}}),d.state.next({...n,...N.keepDirty?{isDirty:R()}:{}}),!N.keepIsValid&&w()},ye=({disabled:D,name:N,field:W,fields:oe,value:ae})=>{if(Wr(D)){const _=D?void 0:Wt(ae)?Hh(W?W._f:xe(oe,N)._f):ae;Pt(s,N,_),z(N,_,!1,!1,!0)}},de=(D,N={})=>{let W=xe(r,D);const oe=Wr(N.disabled);return Pt(r,D,{...W||{},_f:{...W&&W._f?W._f:{ref:{name:D}},name:D,mount:!0,...N}}),a.mount.add(D),W?ye({field:W,disabled:N.disabled,name:D,value:N.value}):H(D,!0,N.value),{...oe?{disabled:N.disabled}:{},...t.progressive?{required:!!N.required,min:Tl(N.min),max:Tl(N.max),minLength:Tl(N.minLength),maxLength:Tl(N.maxLength),pattern:Tl(N.pattern)}:{},name:D,onChange:k,onBlur:k,ref:ae=>{if(ae){de(D,N),W=xe(r,D);const _=Wt(ae.value)&&ae.querySelectorAll&&ae.querySelectorAll("input,select,textarea")[0]||ae,ue=hU(_),Ee=W._f.refs||[];if(ue?Ee.find(Je=>Je===_):_===W._f.ref)return;Pt(r,D,{_f:{...W._f,...ue?{refs:[...Ee.filter(wh),_,...Array.isArray(xe(o,D))?[{}]:[]],ref:{type:_.type,name:D}}:{ref:_}}}),H(D,!1,void 0,_)}else W=xe(r,D,{}),W._f&&(W._f.mount=!1),(t.shouldUnregister||N.shouldUnregister)&&!(z5(a.array,D)&&i.action)&&a.unMount.add(D)}}},ne=()=>t.shouldFocusError&&ac(r,B,a.mount),Ne=D=>{Wr(D)&&(d.state.next({disabled:D}),ac(r,(N,W)=>{let oe=D;const ae=xe(r,W);ae&&Wr(ae._f.disabled)&&(oe||(oe=ae._f.disabled)),N.disabled=oe},0,!1))},He=(D,N)=>async W=>{let oe;W&&(W.preventDefault&&W.preventDefault(),W.persist&&W.persist());let ae=Xn(s);if(d.state.next({isSubmitting:!0}),t.resolver){const{errors:_,values:ue}=await O();n.errors=_,ae=ue}else await T(r);if(_t(n.errors,"root"),tr(n.errors)){d.state.next({errors:{}});try{await D(ae,W)}catch(_){oe=_}}else N&&await N({...n.errors},W),ne(),setTimeout(ne);if(d.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:tr(n.errors)&&!oe,submitCount:n.submitCount+1,errors:n.errors}),oe)throw oe},we=(D,N={})=>{xe(r,D)&&(Wt(N.defaultValue)?G(D,Xn(xe(o,D))):(G(D,N.defaultValue),Pt(o,D,Xn(N.defaultValue))),N.keepTouched||_t(n.touchedFields,D),N.keepDirty||(_t(n.dirtyFields,D),n.isDirty=N.defaultValue?R(D,Xn(xe(o,D))):R()),N.keepError||(_t(n.errors,D),u.isValid&&w()),d.state.next({...n}))},ge=(D,N={})=>{const W=D?Xn(D):o,oe=Xn(W),ae=tr(D),_=ae?o:oe;if(N.keepDefaultValues||(o=W),!N.keepValues){if(N.keepDirtyValues)for(const ue of a.mount)xe(n.dirtyFields,ue)?Pt(_,ue,xe(s,ue)):G(ue,xe(_,ue));else{if(E8&&Wt(D))for(const ue of a.mount){const Ee=xe(r,ue);if(Ee&&Ee._f){const Je=Array.isArray(Ee._f.refs)?Ee._f.refs[0]:Ee._f.ref;if(wd(Je)){const _e=Je.closest("form");if(_e){_e.reset();break}}}}r={}}s=e.shouldUnregister?N.keepDefaultValues?Xn(o):{}:Xn(_),d.array.next({values:{..._}}),d.values.next({values:{..._}})}a={mount:N.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!u.isValid||!!N.keepIsValid||!!N.keepDirtyValues,i.watch=!!e.shouldUnregister,d.state.next({submitCount:N.keepSubmitCount?n.submitCount:0,isDirty:ae?!1:N.keepDirty?n.isDirty:!!(N.keepDefaultValues&&!Ys(D,o)),isSubmitted:N.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:ae?[]:N.keepDirtyValues?N.keepDefaultValues&&s?nf(o,s):n.dirtyFields:N.keepDefaultValues&&D?nf(o,D):{},touchedFields:N.keepTouched?n.touchedFields:{},errors:N.keepErrors?n.errors:{},isSubmitSuccessful:N.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},Ie=(D,N)=>ge(ps(D)?D(s):D,N);return{control:{register:de,unregister:$,getFieldState:E,handleSubmit:He,setError:F,_executeSchema:O,_getWatch:S,_getDirty:R,_updateValid:w,_removeUnmounted:V,_updateFieldArray:v,_updateDisabledField:ye,_getFieldArray:I,_reset:ge,_resetDefaultValues:()=>ps(t.defaultValues)&&t.defaultValues().then(D=>{Ie(D,t.resetOptions),d.state.next({isLoading:!1})}),_updateFormState:D=>{n={...n,...D}},_disableForm:Ne,_subjects:d,_proxyFormState:u,_setErrors:b,get _fields(){return r},get _formValues(){return s},get _state(){return i},set _state(D){i=D},get _defaultValues(){return o},get _names(){return a},set _names(D){a=D},get _formState(){return n},set _formState(D){n=D},get _options(){return t},set _options(D){t={...t,...D}}},trigger:Z,register:de,handleSubmit:He,watch:ie,setValue:G,getValues:ce,reset:Ie,resetField:we,clearErrors:U,unregister:$,setError:F,setFocus:(D,N={})=>{const W=xe(r,D),oe=W&&W._f;if(oe){const ae=oe.refs?oe.refs[0]:oe.ref;ae.focus&&(ae.focus(),N.shouldSelect&&ae.select())}},getFieldState:E}}function xU(e={}){const t=De.useRef(),n=De.useRef(),[r,o]=De.useState({isDirty:!1,isValidating:!1,isLoading:ps(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:ps(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...bU(e),formState:r});const s=t.current.control;return s._options=e,M8({subject:s._subjects.state,next:i=>{D5(i,s._proxyFormState,s._updateFormState,!0)&&o({...s._formState})}}),De.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),De.useEffect(()=>{if(s._proxyFormState.isDirty){const i=s._getDirty();i!==r.isDirty&&s._subjects.state.next({isDirty:i})}},[s,r.isDirty]),De.useEffect(()=>{e.values&&!Ys(e.values,n.current)?(s._reset(e.values,s._options.resetOptions),n.current=e.values,o(i=>({...i}))):s._resetDefaultValues()},[e.values,s]),De.useEffect(()=>{e.errors&&s._setErrors(e.errors)},[e.errors,s]),De.useEffect(()=>{s._state.mount||(s._updateValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),De.useEffect(()=>{e.shouldUnregister&&s._subjects.values.next({values:s._getWatch()})},[e.shouldUnregister,s]),t.current.formState=O5(r,s),t.current}const N5=({id:e})=>{var Ie;const t=KP(),[n,r]=g.useState(!1),[o]=Ye(Hi),[s,i]=g.useState(""),a=g.useRef(null),l=g.useRef(null),[c,u]=g.useState(!1),d=se=>{se&&(se.style.height="auto",se.style.height=se.scrollHeight+"px")},[,p]=Ye(Ur),[P,h]=Ye(F4),[A,w]=Ye(J4),[m,v]=Ye(q4),[y,b]=Ye(Y4),[H,z]=g.useState(!1),[j,O]=g.useState([]),[C,T]=g.useState([]),[V,R]=g.useState(!1),{data:S,error:I}=xr({queryKey:["app-form",e],queryFn:()=>tn.get(`/server/${e}`).then(se=>se.data),enabled:!!e}),{data:Y,isLoading:q}=xr({queryKey:["app-frameworks"],queryFn:()=>tn.get("/frameworks/").then(se=>se.data)}),{data:G,isLoading:k}=xr({queryKey:["app-environments"],queryFn:()=>tn.get("/conda-environments/").then(se=>se.data)}),{data:B,isLoading:Z}=xr({queryKey:["app-profiles"],queryFn:()=>tn.get("/spawner-profiles/").then(se=>se.data)}),{control:ce,handleSubmit:E,reset:U,watch:F,formState:{errors:ie}}=xU({defaultValues:{display_name:"",description:"",framework:"",thumbnail:"",filepath:"",conda_env:"",env:"",custom_command:"",profile:"",is_public:!1,keep_alive:!1}}),$=F("framework");g.useEffect(()=>{const se=a.current,re=()=>{l.current&&a.current&&(l.current.scrollTop=a.current.scrollTop)};return se==null||se.addEventListener("scroll",re),()=>se==null?void 0:se.removeEventListener("scroll",re)},[]);const ye=()=>{const se=s.slice(0,200),re=s.slice(200);return f.jsxs(f.Fragment,{children:[se,f.jsx("span",{style:{color:"red"},children:re})]})};function de(se){u(se)}const ne=({display_name:se,description:re,framework:We,thumbnail:D,filepath:N,conda_env:W,env:oe,custom_command:ae,profile:_})=>{const ue=MZ(se);if(B&&B.length>0){const Ee={jhub_app:!0,display_name:ue,description:re,framework:We,thumbnail:D,filepath:N,conda_env:W,env:oe?JSON.parse(oe):null,custom_command:ae,profile:_,is_public:H,share_with:{users:j,groups:C},keep_alive:V};h(Ee),t(`/server-types${e?`?id=${e}`:""}`)}else{const Ee={servername:A||ue,user_options:{jhub_app:!0,name:A||ue,display_name:ue,description:re||"",framework:We,thumbnail:D||"",filepath:N||"",conda_env:W||"",env:oe?JSON.parse(oe):null,custom_command:ae||"",profile:_||"",public:H,share_with:{users:j,groups:C},keep_alive:V}};r(!0),e?ge(Ee,{onSuccess:async()=>{window.location.assign(ir)},onError:async Je=>{r(!1),p(Je.message)}}):we(Ee,{onSuccess:async Je=>{const _e=o==null?void 0:o.name;if(_e&&(Je==null?void 0:Je.length)>1){const Be=Je[1];window.location.assign(`${ir}/spawn-pending/${_e}/${Be}`)}},onError:async Je=>{r(!1),p(Je.message)}})}},Ne=async({servername:se,user_options:re})=>{const We={accept:"application/json","Content-Type":"multipart/form-data"},D=new FormData;return D.append("data",JSON.stringify({servername:se,user_options:re})),m&&D.append("thumbnail",m),(await tn.post("/server",D,{headers:We})).data},He=async({servername:se,user_options:re})=>{const We={accept:"application/json","Content-Type":"multipart/form-data"},D=new FormData;return D.append("data",JSON.stringify({servername:se,user_options:re})),m?D.append("thumbnail",m):y&&D.append("thumbnail_data_url",y),(await tn.put(`/server/${se}`,D,{headers:We})).data},{mutate:we}=Fa({mutationFn:Ne,retry:1}),{mutate:ge}=Fa({mutationFn:He,retry:1});return g.useEffect(()=>{var se,re;S!=null&&S.name&&(S!=null&&S.user_options)&&(w(S.name),i(S.user_options.description),U({...S.user_options,env:S.user_options.env?JSON.stringify(S.user_options.env):void 0}),z(S.user_options.public),R(S.user_options.keep_alive),b(S.user_options.thumbnail),O((se=S.user_options.share_with)==null?void 0:se.users),T((re=S.user_options.share_with)==null?void 0:re.groups))},[S,S==null?void 0:S.name,S==null?void 0:S.user_options,U,b,w]),g.useEffect(()=>{var se,re;P&&(U({display_name:P.display_name||"",description:P.description||"",framework:P.framework||"",filepath:P.filepath||"",conda_env:P.conda_env||"",env:P.env?JSON.stringify(P.env):void 0,custom_command:P.custom_command||"",profile:P.profile||""}),z(P.is_public),R(P.keep_alive),b(P.thumbnail),O((se=P.share_with)==null?void 0:se.users),T((re=P.share_with)==null?void 0:re.groups))},[P,U,b,w]),g.useEffect(()=>{I&&p(I.message)},[I,p]),f.jsxs("form",{id:"app-form",onSubmit:E(ne),className:"form",noValidate:!0,children:[f.jsxs("div",{className:"form-section",children:[f.jsx("h2",{children:"App Info"}),f.jsx(zo,{name:"display_name",control:ce,rules:Uu,render:({field:{ref:se,...re}})=>{var We;return f.jsx($r,{children:f.jsx(Fs,{...re,id:"display_name",label:"Name",placeholder:"Add app name",autoFocus:!0,required:!0,error:!!((We=ie.display_name)!=null&&We.message),inputProps:{maxLength:255}})})}}),f.jsx(zo,{name:"description",control:ce,render:({field:se})=>f.jsxs($r,{fullWidth:!0,className:"form-control outer-div",variant:"outlined",style:{position:"relative"},children:[f.jsx("label",{htmlFor:"description",className:"description-label"+(s.length>0||c?" label-float":""),style:{color:c?"#ba18da":s.length>0?"#646464":"transparent",backgroundColor:s.length>0||c?"#ffffff":"transparent"},children:"Description"}),f.jsx("textarea",{...se,ref:a,id:"description",value:s,onChange:re=>{i(re.target.value),se.onChange(re.target.value),d(re.target)},onFocus:()=>{de(!0)},onBlur:()=>{se.onBlur(),de(!1)},className:"description_text-field",placeholder:c?"Add app description (max. 200 characters)":"Description"}),f.jsx("div",{ref:l,className:"overlay-text",children:ye()}),f.jsxs(C2,{className:"form-helper-text",style:{textAlign:"right",marginRight:"0",fontSize:"1rem",color:s.length>200?"red":"inherit"},children:[s.length,"/200"]})]})})]}),f.jsxs("div",{className:"form-section",children:[f.jsx("h2",{children:"Configuration"}),f.jsx(zo,{name:"framework",control:ce,rules:Uu,render:({field:{ref:se,...re}})=>{var We;return f.jsxs($r,{children:[f.jsx(Rm,{id:"framework-label",required:!0,children:"Framework"}),f.jsx(fd,{...re,id:"framework",label:"Framework",required:!0,error:!!((We=ie.framework)!=null&&We.message),children:Y==null?void 0:Y.map(D=>f.jsx(xs,{value:D.name,children:D.display_name},D.name))})]})}}),$==="custom"?f.jsx(zo,{name:"custom_command",control:ce,rules:Uu,render:({field:{ref:se,...re}})=>f.jsx($r,{children:f.jsx(Fs,{...re,id:"custom_command",label:"Custom Command",required:$==="custom"})})}):f.jsx(f.Fragment,{}),G&&G.length>0?f.jsx(zo,{name:"conda_env",control:ce,rules:Uu,render:({field:{ref:se,...re}})=>{var We;return f.jsxs($r,{children:[f.jsx(Rm,{id:"framework-label",required:!0,children:"Software Environment"}),f.jsx(fd,{...re,id:"conda_env",label:"Software Environment",required:!0,error:!!((We=ie.conda_env)!=null&&We.message),children:G.map(D=>f.jsx(xs,{value:D,children:D},D))})]})}}):f.jsx(f.Fragment,{}),f.jsx(zo,{name:"filepath",control:ce,render:({field:{ref:se,...re}})=>{var We;return f.jsx($r,{children:f.jsx(Fs,{...re,id:"filepath",label:"File path",placeholder:'Enter the path to the file, e.g. "/shared/users/panel_basic.py"',error:!!((We=ie.filepath)!=null&&We.message)})})}}),f.jsx(zo,{name:"env",control:ce,render:({field:{ref:se,...re}})=>f.jsx($r,{children:f.jsx(Fs,{...re,id:"env",label:"Environment Variables",placeholder:'Enter valid json: {"KEY_1":"VALUE_1","KEY_2":"VALUE_2"}'})})}),f.jsxs(ut,{sx:{display:"flex",flexDirection:"row"},children:[f.jsx(JP,{placement:"bottom-start",title:f.jsx(zt,{sx:{fontSize:"10px",fontWeight:600},children:"Keep alive prevents the app from being suspended even when not in active use. Your app will be instantly available, but it will consume resources until manually stopped."}),children:f.jsx(n5,{fontSize:"small",sx:{position:"relative",top:"9px",left:"2px",color:"#0F10158F"}})}),f.jsx(zo,{name:"keep_alive",control:ce,render:({field:{ref:se,value:re,onChange:We,...D}})=>f.jsx($r,{sx:{flexDirection:"row"},children:f.jsx(fa,{control:f.jsx(G2,{...D,id:"keep_alive",checked:V,onChange:()=>{R(!V)}}),label:"Keep app alive",labelPlacement:"start"})})})]})]}),f.jsxs("div",{className:"form-section",children:[f.jsx("h2",{children:"Sharing"}),f.jsx(LU,{url:S==null?void 0:S.url,permissions:(Ie=S==null?void 0:S.user_options)==null?void 0:Ie.share_with,isPublic:H,setCurrentUserPermissions:O,setCurrentGroupPermissions:T,setIsPublic:z})]}),f.jsxs("div",{className:"form-section",children:[f.jsx("h2",{children:"App Thumbnail"}),f.jsx(zo,{name:"thumbnail",control:ce,render:({field:{ref:se,value:re,onChange:We,...D}})=>f.jsx($r,{children:f.jsx(AQ,{...D,id:"thumbnail",currentImage:y,setCurrentImage:b,currentFile:m,setCurrentFile:v})})})]}),f.jsx("hr",{}),f.jsxs("div",{className:"button-section",children:[f.jsx("div",{className:"prev",children:f.jsx(ct,{id:"cancel-btn",type:"button",variant:"text",color:"secondary",onClick:()=>Vr(`${ir}`),children:"Cancel"})}),f.jsx("div",{className:"next",children:f.jsx(ct,{id:"submit-btn",type:"submit",variant:"contained",color:"primary",disabled:q||k||Z||n||s.length>200,children:B&&B.length>0?f.jsx(f.Fragment,{children:"Next"}):e?f.jsx(f.Fragment,{children:"Save"}):f.jsx(f.Fragment,{children:"Create App"})})})]})]})};var B8={},wU=vt;Object.defineProperty(B8,"__esModule",{value:!0});var B5=B8.default=void 0,HU=wU(ht()),jU=f;B5=B8.default=(0,HU.default)((0,jU.jsx)("path",{d:"M15 20H5V7c0-.55-.45-1-1-1s-1 .45-1 1v13c0 1.1.9 2 2 2h10c.55 0 1-.45 1-1s-.45-1-1-1m5-4V4c0-1.1-.9-2-2-2H9c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h9c1.1 0 2-.9 2-2m-2 0H9V4h9z"}),"ContentCopyRounded");var V8={},zU=vt;Object.defineProperty(V8,"__esModule",{value:!0});var V5=V8.default=void 0,OU=zU(ht()),DU=f;V5=V8.default=(0,OU.default)((0,DU.jsx)("path",{d:"M15.41 16.59 10.83 12l4.58-4.59L14 6l-6 6 6 6z"}),"KeyboardArrowLeft");var I8={},CU=vt;Object.defineProperty(I8,"__esModule",{value:!0});var I5=I8.default=void 0,TU=CU(ht()),SU=f;I5=I8.default=(0,TU.default)((0,SU.jsx)("path",{d:"M8.59 16.59 13.17 12 8.59 7.41 10 6l6 6-6 6z"}),"KeyboardArrowRight");var W8={},RU=vt;Object.defineProperty(W8,"__esModule",{value:!0});var W5=W8.default=void 0,EU=RU(ht()),kU=f;W5=W8.default=(0,EU.default)((0,kU.jsx)("path",{d:"M4.47 21h15.06c1.54 0 2.5-1.67 1.73-3L13.73 4.99c-.77-1.33-2.69-1.33-3.46 0L2.74 18c-.77 1.33.19 3 1.73 3M12 14c-.55 0-1-.45-1-1v-2c0-.55.45-1 1-1s1 .45 1 1v2c0 .55-.45 1-1 1m1 4h-2v-2h2z"}),"WarningRounded");const ft=Q("div")(({theme:e})=>({padding:e.spacing(0)}));function MU(e){const{count:t,page:n,rowsPerPage:r,onPageChange:o}=e,s=a=>{o(a,n-1)},i=a=>{o(a,n+1)};return f.jsxs(ut,{sx:{flexShrink:0,ml:2.5},children:[f.jsx(Fr,{onClick:s,disabled:n===0,"aria-label":"previous page","data-testid":"previous-page",children:f.jsx(V5,{})}),f.jsx(Fr,{onClick:i,disabled:n>=Math.ceil(t/r)-1,"aria-label":"next page","data-testid":"next-page",children:f.jsx(I5,{})})]})}const LU=({url:e,permissions:t,isPublic:n,setCurrentUserPermissions:r,setCurrentGroupPermissions:o,setIsPublic:s})=>{const[i]=Ye(Hi),[a]=g.useState("Warning: adding individuals or groups will allow others to access this app."),[l,c]=g.useState(!1),[u,d]=g.useState([]),[p,P]=g.useState([]),[h,A]=g.useState([]),[w,m]=g.useState(0),[v]=g.useState(5),[y,b]=g.useState([]),H=()=>{if(p.length>0){const j=[...new Set([...h,...p])];A(j),o(()=>j.filter(O=>O.type==="group").map(O=>O.name)),r(()=>j.filter(O=>O.type==="user").map(O=>O.name))}b([])},z=(j,O)=>{j&&m(O)};return g.useEffect(()=>{if(i&&i.share_permissions){const j=[];j.push(...i.share_permissions.users.map(O=>({name:O,type:"user"}))),j.push(...i.share_permissions.groups.map(O=>({name:O,type:"group"}))),d(j)}},[i]),g.useEffect(()=>{if(t){const j=[];j.push(...t.users.map(O=>({name:O,type:"user"}))),j.push(...t.groups.map(O=>({name:O,type:"group"}))),A(j)}},[t]),f.jsx(ut,{id:"app-sharing",children:f.jsxs(mi,{direction:"column",children:[i!=null&&i.share_permissions?f.jsxs(f.Fragment,{children:[f.jsx(ft,{children:f.jsx(n2,{id:"sharing-notification",severity:"warning",icon:f.jsx(W5,{sx:{color:"#EAB54E"}}),sx:{mb:"16px"},children:a})}),f.jsxs(ft,{sx:{pb:"8px"},children:[f.jsx(zt,{variant:"subtitle1",children:"Individuals and group access"}),f.jsxs(ut,{sx:{display:"flex",flexDirection:"row",width:"100%",gap:"8px",py:"16px"},children:[f.jsx(ut,{sx:{display:"flex",flexDirection:"row",justifyContent:"flex-start"},children:f.jsx(PR,{disablePortal:!0,id:"share-permissions-autocomplete",options:u,getOptionLabel:j=>j.type==="user"?j.name:`${j.name} (Group)`,multiple:!0,disableCloseOnSelect:!0,clearOnBlur:!0,limitTags:2,sx:{width:470},renderInput:j=>f.jsx(Fs,{...j,placeholder:y.length>0?void 0:"Search one or more usernames or group names"}),value:y,onChange:(j,O)=>{j&&O&&(P(O),b(O))}})}),f.jsx(ut,{sx:{display:"flex",flexDirection:"row",justifyContent:"flex-end",margin:"auto auto"},children:f.jsx(ct,{variant:"contained",color:"primary",onClick:H,disabled:p.length===0,sx:{height:"42px"},children:"Share"})})]})]}),h.length>0?f.jsx(ft,{sx:{pb:"20px"},children:f.jsx(Dr,{elevation:0,children:f.jsx(_2,{children:f.jsxs(Q2,{"aria-label":"Individuals and Groups",size:"small",children:[f.jsx(K2,{children:(v>0?h.slice(w*v,w*v+v):h).map(j=>f.jsxs(dd,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[f.jsxs(Cn,{component:"td",scope:"row",sx:{fontSize:"16px"},children:[j.name," ",j.type==="group"?f.jsxs("span",{style:{fontWeight:600},children:[" ","(Group)"]}):f.jsx(f.Fragment,{})]}),f.jsx(Cn,{align:"right",children:f.jsx(ct,{variant:"text",color:"error",size:"small",sx:{fontWeight:"600",fontSize:"14px"},onClick:()=>{A(O=>O.filter(C=>C.name!==j.name)),j.type==="group"?o(O=>O.filter(C=>C!==j.name)):r(O=>O.filter(C=>C!==j.name))},children:"Remove"})})]},j.name))}),f.jsx(nN,{children:f.jsx(dd,{children:f.jsx(kN,{colSpan:2,count:h.length,rowsPerPage:v,rowsPerPageOptions:[5,10,25,{label:"All",value:-1}],page:w,showFirstButton:!1,showLastButton:!1,width:"500px",slotProps:{select:{inputProps:{"aria-label":"rows per page",width:"500px"},native:!1}},onPageChange:z,ActionsComponent:MU})})})]})})})}):f.jsx(f.Fragment,{})]}):f.jsx(f.Fragment,{}),f.jsx(ft,{sx:{pb:"16px"},children:f.jsx(ut,{children:f.jsx(Dr,{elevation:0,children:f.jsxs(mi,{direction:"column",children:[f.jsx(ft,{sx:{pt:"8px"},children:f.jsx(fa,{control:f.jsx(G2,{id:"is-public",checked:n,onChange:()=>s(!n)}),label:"Public access",labelPlacement:"start"})}),f.jsx(ft,{sx:{px:"16px",pt:"16px",pb:"4px"},children:f.jsx(ut,{sx:{display:"flex",flexDirection:"row",gap:"8px",pb:"8px"},children:n?f.jsxs(f.Fragment,{children:[f.jsx(hv,{sx:{fontSize:"24px"}}),f.jsx(zt,{variant:"body1",children:"Link sharing public"})]}):f.jsxs(f.Fragment,{children:[f.jsx(vv,{sx:{fontSize:"24px"}}),f.jsx(zt,{variant:"body1",children:"Link sharing restricted"})]})})}),f.jsx(ft,{sx:{pl:"16px",pb:"16px"},children:n?f.jsxs(zt,{variant:"body2",children:["This app is accessible to"," ",f.jsx(zt,{component:"span",variant:"body2",color:"error",children:"anyone via its link and sign in is not required."})]}):f.jsx(zt,{variant:"body2",children:"This app is accessible to you and the people added above via its link."})}),e?f.jsx(ft,{sx:{p:"16px",pt:0},children:f.jsx(Fs,{id:"sharing-link",placeholder:"http://","aria-label":"Sharing link",fullWidth:!0,InputProps:{endAdornment:f.jsx(M2,{position:"end",children:f.jsx(BC,{onClickAway:()=>c(!1),children:f.jsx(JP,{PopperProps:{disablePortal:!0},onClose:()=>c(!1),open:l,disableFocusListener:!0,disableHoverListener:!0,disableTouchListener:!0,title:"Copied to clipboard!",placement:"top",children:f.jsx(Fr,{id:"copy-to-clipboard",onClick:()=>{e&&window.isSecureContext&&(navigator.clipboard.writeText(Ox(e)),c(!0))},children:f.jsx(B5,{})})})})})},value:Ox(e)})}):f.jsx(f.Fragment,{})]})})})})]})})};var J5={exports:{}};/*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames diff --git a/ui/src/components/app-form/app-form.tsx b/ui/src/components/app-form/app-form.tsx index 241eb2c7..b64f7642 100644 --- a/ui/src/components/app-form/app-form.tsx +++ b/ui/src/components/app-form/app-form.tsx @@ -323,8 +323,8 @@ export const AppForm = ({ id }: AppFormProps): React.ReactElement => { // Populate form with existing app data useEffect(() => { if (formData?.name && formData?.user_options) { - setDescription(formData.user_options.description || ''); - setCurrentServerName(formData?.user_options.display_name || ''); + setCurrentServerName(formData.name); + setDescription(formData.user_options.description); reset({ ...formData.user_options, env: formData.user_options.env