@abtnode/webapp 1.16.27-beta-91ff0d1b → 1.16.27-beta-725ce3a6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blocklet.js +1 -1
- package/blocklet.yml +1 -1
- package/build/asset-manifest.json +27 -29
- package/build/index.html +1 -1
- package/build/service-worker.js +1 -1
- package/build/static/js/1059.368e5e41.chunk.js +1 -0
- package/build/static/js/1575.66d74b08.chunk.js +1 -0
- package/build/static/js/{175.a3dd5077.chunk.js → 175.ce609330.chunk.js} +1 -1
- package/build/static/js/2019.07718ce4.chunk.js +1 -0
- package/build/static/js/2168.6656fd50.chunk.js +1 -0
- package/build/static/js/233.86a89c13.chunk.js +1 -0
- package/build/static/js/{2362.e2682916.chunk.js → 2362.ec251904.chunk.js} +1 -1
- package/build/static/js/3803.826645be.chunk.js +1 -0
- package/build/static/js/3930.f00d8525.chunk.js +1 -0
- package/build/static/js/4423.3e5f07b2.chunk.js +1 -0
- package/build/static/js/4465.f4d3a5e6.chunk.js +1 -0
- package/build/static/js/4804.4255fd49.chunk.js +2 -0
- package/build/static/js/{4804.0799b676.chunk.js.LICENSE.txt → 4804.4255fd49.chunk.js.LICENSE.txt} +7 -0
- package/build/static/js/{506.fe1f4c17.chunk.js → 506.66a371f9.chunk.js} +1 -1
- package/build/static/js/5312.d69643df.chunk.js +1 -0
- package/build/static/js/5570.5f6bc222.chunk.js +2 -0
- package/build/static/js/5672.eeaa5281.chunk.js +1 -0
- package/build/static/js/5748.2d9a7831.chunk.js +1 -0
- package/build/static/js/6511.3b864fc0.chunk.js +1 -0
- package/build/static/js/6906.fd6c5ca2.chunk.js +1 -0
- package/build/static/js/6944.5b0a1cfe.chunk.js +1 -0
- package/build/static/js/7097.038b785a.chunk.js +2 -0
- package/build/static/js/8170.2556eb7f.chunk.js +1 -0
- package/build/static/js/8590.b41a3584.chunk.js +1 -0
- package/build/static/js/9586.c2089ac7.chunk.js +1 -0
- package/build/static/js/main.06175ef5.js +2 -0
- package/build/static/js/{main.94a581d5.js.LICENSE.txt → main.06175ef5.js.LICENSE.txt} +2 -0
- package/package.json +1 -1
- package/build/static/js/1059.263e9674.chunk.js +0 -1
- package/build/static/js/1575.9d833322.chunk.js +0 -1
- package/build/static/js/2019.be4d0938.chunk.js +0 -1
- package/build/static/js/2168.642bfc2e.chunk.js +0 -1
- package/build/static/js/233.b835e8e5.chunk.js +0 -1
- package/build/static/js/2842.1eebcd69.chunk.js +0 -1
- package/build/static/js/3803.da1833cb.chunk.js +0 -1
- package/build/static/js/3930.8d260ff3.chunk.js +0 -1
- package/build/static/js/4296.2dd20fb1.chunk.js +0 -1
- package/build/static/js/4423.2d8235f0.chunk.js +0 -1
- package/build/static/js/4465.e7f19f54.chunk.js +0 -1
- package/build/static/js/4804.0799b676.chunk.js +0 -2
- package/build/static/js/5312.fa7da622.chunk.js +0 -1
- package/build/static/js/5570.744c0299.chunk.js +0 -2
- package/build/static/js/5748.07f6d8b4.chunk.js +0 -1
- package/build/static/js/6511.7e5a293c.chunk.js +0 -1
- package/build/static/js/6906.2d0d6c42.chunk.js +0 -1
- package/build/static/js/6944.f2a319f5.chunk.js +0 -1
- package/build/static/js/8170.b9b80743.chunk.js +0 -1
- package/build/static/js/8590.d0c4bffa.chunk.js +0 -1
- package/build/static/js/9132.7199c98e.chunk.js +0 -1
- package/build/static/js/9282.9940b6e0.chunk.js +0 -2
- package/build/static/js/9586.d0145a1f.chunk.js +0 -1
- package/build/static/js/main.94a581d5.js +0 -2
- /package/build/static/js/{5570.744c0299.chunk.js.LICENSE.txt → 5570.5f6bc222.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{9282.9940b6e0.chunk.js.LICENSE.txt → 7097.038b785a.chunk.js.LICENSE.txt} +0 -0
package/build/static/js/{4804.0799b676.chunk.js.LICENSE.txt → 4804.4255fd49.chunk.js.LICENSE.txt}
RENAMED
|
@@ -24,6 +24,13 @@
|
|
|
24
24
|
|
|
25
25
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
26
26
|
|
|
27
|
+
/**
|
|
28
|
+
* @module xbytes
|
|
29
|
+
* @license Apache-2.0
|
|
30
|
+
* @author Miraculous Owonubi
|
|
31
|
+
* @copyright (c) 2019 Miraculous Owonubi
|
|
32
|
+
*/
|
|
33
|
+
|
|
27
34
|
/**
|
|
28
35
|
* Takes a string with placeholder variables like `%{smart_count} file selected`
|
|
29
36
|
* and replaces it with values from options `{smart_count: 5}`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[506],{80506:(e,t,r)=>{r.d(t,{Qr:()=>I,cI:()=>Ce,qo:()=>N});var s=r(5057),a=e=>"checkbox"===e.type,i=e=>e instanceof Date,n=e=>null==e;const l=e=>"object"===typeof e;var o=e=>!n(e)&&!Array.isArray(e)&&l(e)&&!i(e),u=e=>o(e)&&e.target?a(e.target)?e.target.checked:e.target.value:e,d=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),c=e=>{const t=e.constructor&&e.constructor.prototype;return o(t)&&t.hasOwnProperty("isPrototypeOf")},f="undefined"!==typeof window&&"undefined"!==typeof window.HTMLElement&&"undefined"!==typeof document;function m(e){let t;const r=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else{if(f&&(e instanceof Blob||e instanceof FileList)||!r&&!o(e))return e;if(t=r?[]:{},r||c(e))for(const r in e)e.hasOwnProperty(r)&&(t[r]=m(e[r]));else t=e}return t}var y=e=>Array.isArray(e)?e.filter(Boolean):[],v=e=>void 0===e,h=(e,t,r)=>{if(!t||!o(e))return r;const s=y(t.split(/[,[\].]+?/)).reduce(((e,t)=>n(e)?e:e[t]),e);return v(s)||s===e?v(e[t])?r:e[t]:s},g=e=>"boolean"===typeof e;const b={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},p={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},_="max",V="min",F="maxLength",A="minLength",S="pattern",w="required",x="validate",D=s.createContext(null),k=()=>s.useContext(D);var C=function(e,t,r){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const a={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(a,i,{get:()=>{const a=i;return t._proxyFormState[a]!==p.all&&(t._proxyFormState[a]=!s||p.all),r&&(r[a]=!0),e[a]}});return a},E=e=>o(e)&&!Object.keys(e).length,O=(e,t,r,s)=>{r(e);const{name:a,...i}=e;return E(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find((e=>t[e]===(!s||p.all)))},U=e=>Array.isArray(e)?e:[e],j=(e,t,r)=>!e||!t||e===t||U(e).some((e=>e&&(r?e===t:e.startsWith(t)||t.startsWith(e))));function T(e){const t=s.useRef(e);t.current=e,s.useEffect((()=>{const r=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{r&&r.unsubscribe()}}),[e.disabled])}var L=e=>"string"===typeof e,B=(e,t,r,s,a)=>L(e)?(s&&t.watch.add(e),h(r,e,a)):Array.isArray(e)?e.map((e=>(s&&t.watch.add(e),h(r,e)))):(s&&(t.watchAll=!0),r);function N(e){const t=k(),{control:r=t.control,name:a,defaultValue:i,disabled:n,exact:l}=e||{},o=s.useRef(a);o.current=a,T({disabled:n,subject:r._subjects.values,next:e=>{j(o.current,e.name,l)&&d(m(B(o.current,r._names,e.values||r._formValues,!1,i)))}});const[u,d]=s.useState(r._getWatch(a,i));return s.useEffect((()=>r._removeUnmounted())),u}var M=e=>/^\w*$/.test(e),R=e=>y(e.replace(/["|']|\]/g,"").split(/\.|\[/)),q=(e,t,r)=>{let s=-1;const a=M(t)?[t]:R(t),i=a.length,n=i-1;for(;++s<i;){const t=a[s];let i=r;if(s!==n){const r=e[t];i=o(r)||Array.isArray(r)?r:isNaN(+a[s+1])?{}:[]}e[t]=i,e=e[t]}return e};function P(e){const t=k(),{name:r,disabled:a,control:i=t.control,shouldUnregister:n}=e,l=d(i._names.array,r),o=N({control:i,name:r,defaultValue:h(i._formValues,r,h(i._defaultValues,r,e.defaultValue)),exact:!0}),c=function(e){const t=k(),{control:r=t.control,disabled:a,name:i,exact:n}=e||{},[l,o]=s.useState(r._formState),u=s.useRef(!0),d=s.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),c=s.useRef(i);return c.current=i,T({disabled:a,next:e=>u.current&&j(c.current,e.name,n)&&O(e,d.current,r._updateFormState)&&o({...r._formState,...e}),subject:r._subjects.state}),s.useEffect((()=>(u.current=!0,d.current.isValid&&r._updateValid(!0),()=>{u.current=!1})),[r]),C(l,r,d.current,!1)}({control:i,name:r}),f=s.useRef(i.register(r,{...e.rules,value:o,...g(e.disabled)?{disabled:e.disabled}:{}}));return s.useEffect((()=>{const e=i._options.shouldUnregister||n,t=(e,t)=>{const r=h(i._fields,e);r&&(r._f.mount=t)};if(t(r,!0),e){const e=m(h(i._options.defaultValues,r));q(i._defaultValues,r,e),v(h(i._formValues,r))&&q(i._formValues,r,e)}return()=>{(l?e&&!i._state.action:e)?i.unregister(r):t(r,!1)}}),[r,i,l,n]),s.useEffect((()=>{h(i._fields,r)&&i._updateDisabledField({disabled:a,fields:i._fields,name:r,value:h(i._fields,r)._f.value})}),[a,r,i]),{field:{name:r,value:o,...g(a)||c.disabled?{disabled:c.disabled||a}:{},onChange:s.useCallback((e=>f.current.onChange({target:{value:u(e),name:r},type:b.CHANGE})),[r]),onBlur:s.useCallback((()=>f.current.onBlur({target:{value:h(i._formValues,r),name:r},type:b.BLUR})),[r,i]),ref:e=>{const t=h(i._fields,r);t&&e&&(t._f.ref={focus:()=>e.focus(),select:()=>e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})}},formState:c,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!h(c.errors,r)},isDirty:{enumerable:!0,get:()=>!!h(c.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!h(c.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!h(c.validatingFields,r)},error:{enumerable:!0,get:()=>h(c.errors,r)}})}}const I=e=>e.render(P(e));var W=(e,t,r,s,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[s]:a||!0}}:{},H=e=>({isOnSubmit:!e||e===p.onSubmit,isOnBlur:e===p.onBlur,isOnChange:e===p.onChange,isOnAll:e===p.all,isOnTouch:e===p.onTouched}),G=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some((t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))));const $=(e,t,r,s)=>{for(const a of r||Object.keys(e)){const r=h(e,a);if(r){const{_f:e,...i}=r;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],a)&&!s)break;if(e.ref&&t(e.ref,e.name)&&!s)break;$(i,t)}else o(i)&&$(i,t)}}};var Q=(e,t,r)=>{const s=y(h(e,r));return q(s,"root",t[r]),q(e,r,s),e},z=e=>"file"===e.type,J=e=>"function"===typeof e,K=e=>{if(!f)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},X=e=>L(e),Y=e=>"radio"===e.type,Z=e=>e instanceof RegExp;const ee={value:!1,isValid:!1},te={value:!0,isValid:!0};var re=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter((e=>e&&e.checked&&!e.disabled)).map((e=>e.value));return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!v(e[0].attributes.value)?v(e[0].value)||""===e[0].value?te:{value:e[0].value,isValid:!0}:te:ee}return ee};const se={isValid:!1,value:null};var ae=e=>Array.isArray(e)?e.reduce(((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e),se):se;function ie(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"validate";if(X(e)||Array.isArray(e)&&e.every(X)||g(e)&&!e)return{type:r,message:X(e)?e:"",ref:t}}var ne=e=>o(e)&&!Z(e)?e:{value:e,message:""},le=async(e,t,r,s,i)=>{const{ref:l,refs:u,required:d,maxLength:c,minLength:f,min:m,max:y,pattern:b,validate:p,name:D,valueAsNumber:k,mount:C,disabled:O}=e._f,U=h(t,D);if(!C||O)return{};const j=u?u[0]:l,T=e=>{s&&j.reportValidity&&(j.setCustomValidity(g(e)?"":e||""),j.reportValidity())},B={},N=Y(l),M=a(l),R=N||M,q=(k||z(l))&&v(l.value)&&v(U)||K(l)&&""===l.value||""===U||Array.isArray(U)&&!U.length,P=W.bind(null,D,r,B),I=function(e,t,r){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:F,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:A;const i=e?t:r;B[D]={type:e?s:a,message:i,ref:l,...P(e?s:a,i)}};if(i?!Array.isArray(U)||!U.length:d&&(!R&&(q||n(U))||g(U)&&!U||M&&!re(u).isValid||N&&!ae(u).isValid)){const{value:e,message:t}=X(d)?{value:!!d,message:d}:ne(d);if(e&&(B[D]={type:w,message:t,ref:j,...P(w,t)},!r))return T(t),B}if(!q&&(!n(m)||!n(y))){let e,t;const s=ne(y),a=ne(m);if(n(U)||isNaN(U)){const r=l.valueAsDate||new Date(U),i=e=>new Date((new Date).toDateString()+" "+e),n="time"==l.type,o="week"==l.type;L(s.value)&&U&&(e=n?i(U)>i(s.value):o?U>s.value:r>new Date(s.value)),L(a.value)&&U&&(t=n?i(U)<i(a.value):o?U<a.value:r<new Date(a.value))}else{const r=l.valueAsNumber||(U?+U:U);n(s.value)||(e=r>s.value),n(a.value)||(t=r<a.value)}if((e||t)&&(I(!!e,s.message,a.message,_,V),!r))return T(B[D].message),B}if((c||f)&&!q&&(L(U)||i&&Array.isArray(U))){const e=ne(c),t=ne(f),s=!n(e.value)&&U.length>+e.value,a=!n(t.value)&&U.length<+t.value;if((s||a)&&(I(s,e.message,t.message),!r))return T(B[D].message),B}if(b&&!q&&L(U)){const{value:e,message:t}=ne(b);if(Z(e)&&!U.match(e)&&(B[D]={type:S,message:t,ref:l,...P(S,t)},!r))return T(t),B}if(p)if(J(p)){const e=ie(await p(U,t),j);if(e&&(B[D]={...e,...P(x,e.message)},!r))return T(e.message),B}else if(o(p)){let e={};for(const s in p){if(!E(e)&&!r)break;const a=ie(await p[s](U,t),j,s);a&&(e={...a,...P(s,a.message)},T(a.message),r&&(B[D]=e))}if(!E(e)&&(B[D]={ref:j,...e},!r))return B}return T(!0),B};function oe(e,t){const r=Array.isArray(t)?t:M(t)?[t]:R(t),s=1===r.length?e:function(e,t){const r=t.slice(0,-1).length;let s=0;for(;s<r;)e=v(e)?s++:e[t[s++]];return e}(e,r),a=r.length-1,i=r[a];return s&&delete s[i],0!==a&&(o(s)&&E(s)||Array.isArray(s)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!v(e[t]))return!1;return!0}(s))&&oe(e,r.slice(0,-1)),e}var ue=()=>{let e=[];return{get observers(){return e},next:t=>{for(const r of e)r.next&&r.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter((e=>e!==t))}}),unsubscribe:()=>{e=[]}}},de=e=>n(e)||!l(e);function ce(e,t){if(de(e)||de(t))return e===t;if(i(e)&&i(t))return e.getTime()===t.getTime();const r=Object.keys(e),s=Object.keys(t);if(r.length!==s.length)return!1;for(const a of r){const r=e[a];if(!s.includes(a))return!1;if("ref"!==a){const e=t[a];if(i(r)&&i(e)||o(r)&&o(e)||Array.isArray(r)&&Array.isArray(e)?!ce(r,e):r!==e)return!1}}return!0}var fe=e=>"select-multiple"===e.type,me=e=>Y(e)||a(e),ye=e=>K(e)&&e.isConnected,ve=e=>{for(const t in e)if(J(e[t]))return!0;return!1};function he(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=Array.isArray(e);if(o(e)||r)for(const s in e)Array.isArray(e[s])||o(e[s])&&!ve(e[s])?(t[s]=Array.isArray(e[s])?[]:{},he(e[s],t[s])):n(e[s])||(t[s]=!0);return t}function ge(e,t,r){const s=Array.isArray(e);if(o(e)||s)for(const a in e)Array.isArray(e[a])||o(e[a])&&!ve(e[a])?v(t)||de(r[a])?r[a]=Array.isArray(e[a])?he(e[a],[]):{...he(e[a])}:ge(e[a],n(t)?{}:t[a],r[a]):r[a]=!ce(e[a],t[a]);return r}var be=(e,t)=>ge(e,t,he(t)),pe=(e,t)=>{let{valueAsNumber:r,valueAsDate:s,setValueAs:a}=t;return v(e)?e:r?""===e?NaN:e?+e:e:s&&L(e)?new Date(e):a?a(e):e};function _e(e){const t=e.ref;if(!(e.refs?e.refs.every((e=>e.disabled)):t.disabled))return z(t)?t.files:Y(t)?ae(e.refs).value:fe(t)?[...t.selectedOptions].map((e=>{let{value:t}=e;return t})):a(t)?re(e.refs).value:pe(v(t.value)?e.ref.value:t.value,e)}var Ve=(e,t,r,s)=>{const a={};for(const i of e){const e=h(t,i);e&&q(a,i,e._f)}return{criteriaMode:r,names:[...e],fields:a,shouldUseNativeValidation:s}},Fe=e=>v(e)?e:Z(e)?e.source:o(e)?Z(e.value)?e.value.source:e.value:e,Ae=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function Se(e,t,r){const s=h(e,r);if(s||M(r))return{error:s,name:r};const a=r.split(".");for(;a.length;){const s=a.join("."),i=h(t,s),n=h(e,s);if(i&&!Array.isArray(i)&&r!==s)return{name:r};if(n&&n.type)return{name:s,error:n};a.pop()}return{name:r}}var we=(e,t,r,s,a)=>!a.isOnAll&&(!r&&a.isOnTouch?!(t||e):(r?s.isOnBlur:a.isOnBlur)?!e:!(r?s.isOnChange:a.isOnChange)||e),xe=(e,t)=>!y(h(e,t)).length&&oe(e,t);const De={mode:p.onSubmit,reValidateMode:p.onChange,shouldFocusError:!0};function ke(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r={...De,...t},s={submitCount:0,isDirty:!1,isLoading:J(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},l={},c=(o(r.defaultValues)||o(r.values))&&m(r.defaultValues||r.values)||{},_=r.shouldUnregister?{}:m(c),V={action:!1,mount:!1,watch:!1},F={mount:new Set,unMount:new Set,array:new Set,watch:new Set},A=0;const S={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},w={values:ue(),array:ue(),state:ue()},x=H(r.mode),D=H(r.reValidateMode),k=r.criteriaMode===p.all,C=async e=>{if(S.isValid||e){const e=r.resolver?E((await M()).errors):await R(l,!0);e!==s.isValid&&w.state.next({isValid:e})}},O=(e,t)=>{(S.isValidating||S.validatingFields)&&((e||Array.from(F.mount)).forEach((e=>{e&&(t?q(s.validatingFields,e,t):oe(s.validatingFields,e))})),w.state.next({validatingFields:s.validatingFields,isValidating:!E(s.validatingFields)}))},j=(e,t,r,s)=>{const a=h(l,e);if(a){const i=h(_,e,v(r)?h(c,e):r);v(i)||s&&s.defaultChecked||t?q(_,e,t?i:_e(a._f)):W(e,i),V.mount&&C()}},T=(e,t,r,a,i)=>{let n=!1,o=!1;const u={name:e},d=!(!h(l,e)||!h(l,e)._f.disabled);if(!r||a){S.isDirty&&(o=s.isDirty,s.isDirty=u.isDirty=P(),n=o!==u.isDirty);const r=d||ce(h(c,e),t);o=!(d||!h(s.dirtyFields,e)),r||d?oe(s.dirtyFields,e):q(s.dirtyFields,e,!0),u.dirtyFields=s.dirtyFields,n=n||S.dirtyFields&&o!==!r}if(r){const t=h(s.touchedFields,e);t||(q(s.touchedFields,e,r),u.touchedFields=s.touchedFields,n=n||S.touchedFields&&t!==r)}return n&&i&&w.state.next(u),n?u:{}},N=(r,a,i,n)=>{const l=h(s.errors,r),o=S.isValid&&g(a)&&s.isValid!==a;var u;if(t.delayError&&i?(u=()=>((e,t)=>{q(s.errors,e,t),w.state.next({errors:s.errors})})(r,i),e=e=>{clearTimeout(A),A=setTimeout(u,e)},e(t.delayError)):(clearTimeout(A),e=null,i?q(s.errors,r,i):oe(s.errors,r)),(i?!ce(l,i):l)||!E(n)||o){const e={...n,...o&&g(a)?{isValid:a}:{},errors:s.errors,name:r};s={...s,...e},w.state.next(e)}},M=async e=>{O(e,!0);const t=await r.resolver(_,r.context,Ve(e||F.mount,l,r.criteriaMode,r.shouldUseNativeValidation));return O(e),t},R=async function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{valid:!0};for(const i in e){const n=e[i];if(n){const{_f:e,...l}=n;if(e){const l=F.array.has(e.name);O([i],!0);const o=await le(n,_,k,r.shouldUseNativeValidation&&!t,l);if(O([i]),o[e.name]&&(a.valid=!1,t))break;!t&&(h(o,e.name)?l?Q(s.errors,o,e.name):q(s.errors,e.name,o[e.name]):oe(s.errors,e.name))}l&&await R(l,t,a)}}return a.valid},P=(e,t)=>(e&&t&&q(_,e,t),!ce(re(),c)),I=(e,t,r)=>B(e,F,{...V.mount?_:v(t)?c:L(e)?{[e]:t}:t},r,t),W=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const s=h(l,e);let i=t;if(s){const r=s._f;r&&(!r.disabled&&q(_,e,pe(t,r)),i=K(r.ref)&&n(t)?"":t,fe(r.ref)?[...r.ref.options].forEach((e=>e.selected=i.includes(e.value))):r.refs?a(r.ref)?r.refs.length>1?r.refs.forEach((e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(i)?!!i.find((t=>t===e.value)):i===e.value))):r.refs[0]&&(r.refs[0].checked=!!i):r.refs.forEach((e=>e.checked=e.value===i)):z(r.ref)?r.ref.value="":(r.ref.value=i,r.ref.type||w.values.next({name:e,values:{..._}})))}(r.shouldDirty||r.shouldTouch)&&T(e,i,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&te(e)},X=(e,t,r)=>{for(const s in t){const a=t[s],n="".concat(e,".").concat(s),o=h(l,n);!F.array.has(e)&&de(a)&&(!o||o._f)||i(a)?W(n,a,r):X(n,a,r)}},Y=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=h(l,e),i=F.array.has(e),o=m(t);q(_,e,o),i?(w.array.next({name:e,values:{..._}}),(S.isDirty||S.dirtyFields)&&r.shouldDirty&&w.state.next({name:e,dirtyFields:be(c,_),isDirty:P(e,o)})):!a||a._f||n(o)?W(e,o,r):X(e,o,r),G(e,F)&&w.state.next({...s}),w.values.next({name:V.mount?e:void 0,values:{..._}})},Z=async t=>{V.mount=!0;const a=t.target;let i=a.name,n=!0;const o=h(l,i),d=e=>{n=Number.isNaN(e)||e===h(_,i,e)};if(o){let c,f;const m=a.type?_e(o._f):u(t),y=t.type===b.BLUR||t.type===b.FOCUS_OUT,v=!Ae(o._f)&&!r.resolver&&!h(s.errors,i)&&!o._f.deps||we(y,h(s.touchedFields,i),s.isSubmitted,D,x),g=G(i,F,y);q(_,i,m),y?(o._f.onBlur&&o._f.onBlur(t),e&&e(0)):o._f.onChange&&o._f.onChange(t);const p=T(i,m,y,!1),V=!E(p)||g;if(!y&&w.values.next({name:i,type:t.type,values:{..._}}),v)return S.isValid&&C(),V&&w.state.next({name:i,...g?{}:p});if(!y&&g&&w.state.next({...s}),r.resolver){const{errors:e}=await M([i]);if(d(m),n){const t=Se(s.errors,l,i),r=Se(e,l,t.name||i);c=r.error,i=r.name,f=E(e)}}else O([i],!0),c=(await le(o,_,k,r.shouldUseNativeValidation))[i],O([i]),d(m),n&&(c?f=!1:S.isValid&&(f=await R(l,!0)));n&&(o._f.deps&&te(o._f.deps),N(i,f,c,p))}},ee=(e,t)=>{if(h(s.errors,t)&&e.focus)return e.focus(),1},te=async function(e){let t,a,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=U(e);if(r.resolver){const r=await(async e=>{const{errors:t}=await M(e);if(e)for(const r of e){const e=h(t,r);e?q(s.errors,r,e):oe(s.errors,r)}else s.errors=t;return t})(v(e)?e:n);t=E(r),a=e?!n.some((e=>h(r,e))):t}else e?(a=(await Promise.all(n.map((async e=>{const t=h(l,e);return await R(t&&t._f?{[e]:t}:t)})))).every(Boolean),(a||s.isValid)&&C()):a=t=await R(l);return w.state.next({...!L(e)||S.isValid&&t!==s.isValid?{}:{name:e},...r.resolver||!e?{isValid:t}:{},errors:s.errors}),i.shouldFocus&&!a&&$(l,ee,e?n:F.mount),a},re=e=>{const t={...c,...V.mount?_:{}};return v(e)?t:L(e)?h(t,e):e.map((e=>h(t,e)))},se=(e,t)=>({invalid:!!h((t||s).errors,e),isDirty:!!h((t||s).dirtyFields,e),isTouched:!!h((t||s).touchedFields,e),isValidating:!!h((t||s).validatingFields,e),error:h((t||s).errors,e)}),ae=(e,t,r)=>{const a=(h(l,e,{_f:{}})._f||{}).ref;q(s.errors,e,{...t,ref:a}),w.state.next({name:e,errors:s.errors,isValid:!1}),r&&r.shouldFocus&&a&&a.focus&&a.focus()},ie=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for(const a of e?U(e):F.mount)F.mount.delete(a),F.array.delete(a),t.keepValue||(oe(l,a),oe(_,a)),!t.keepError&&oe(s.errors,a),!t.keepDirty&&oe(s.dirtyFields,a),!t.keepTouched&&oe(s.touchedFields,a),!t.keepIsValidating&&oe(s.validatingFields,a),!r.shouldUnregister&&!t.keepDefaultValue&&oe(c,a);w.values.next({values:{..._}}),w.state.next({...s,...t.keepDirty?{isDirty:P()}:{}}),!t.keepIsValid&&C()},ne=e=>{let{disabled:t,name:r,field:s,fields:a,value:i}=e;if(g(t)){const e=t?void 0:v(i)?_e(s?s._f:h(a,r)._f):i;q(_,r,e),T(r,e,!1,!1,!0)}},ve=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=h(l,e);const a=g(t.disabled);return q(l,e,{...s||{},_f:{...s&&s._f?s._f:{ref:{name:e}},name:e,mount:!0,...t}}),F.mount.add(e),s?ne({field:s,disabled:t.disabled,name:e,value:t.value}):j(e,!0,t.value),{...a?{disabled:t.disabled}:{},...r.progressive?{required:!!t.required,min:Fe(t.min),max:Fe(t.max),minLength:Fe(t.minLength),maxLength:Fe(t.maxLength),pattern:Fe(t.pattern)}:{},name:e,onChange:Z,onBlur:Z,ref:a=>{if(a){ve(e,t),s=h(l,e);const r=v(a.value)&&a.querySelectorAll&&a.querySelectorAll("input,select,textarea")[0]||a,i=me(r),n=s._f.refs||[];if(i?n.find((e=>e===r)):r===s._f.ref)return;q(l,e,{_f:{...s._f,...i?{refs:[...n.filter(ye),r,...Array.isArray(h(c,e))?[{}]:[]],ref:{type:r.type,name:e}}:{ref:r}}}),j(e,!1,void 0,r)}else s=h(l,e,{}),s._f&&(s._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&(!d(F.array,e)||!V.action)&&F.unMount.add(e)}}},he=()=>r.shouldFocusError&&$(l,ee,F.mount),ge=(e,t)=>async a=>{let i;a&&(a.preventDefault&&a.preventDefault(),a.persist&&a.persist());let n=m(_);if(w.state.next({isSubmitting:!0}),r.resolver){const{errors:e,values:t}=await M();s.errors=e,n=t}else await R(l);if(oe(s.errors,"root"),E(s.errors)){w.state.next({errors:{}});try{await e(n,a)}catch(o){i=o}}else t&&await t({...s.errors},a),he(),setTimeout(he);if(w.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:E(s.errors)&&!i,submitCount:s.submitCount+1,errors:s.errors}),i)throw i},ke=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const a=e?m(e):c,i=m(a),n=E(e),o=n?c:i;if(r.keepDefaultValues||(c=a),!r.keepValues){if(r.keepDirtyValues)for(const e of F.mount)h(s.dirtyFields,e)?q(o,e,h(_,e)):Y(e,h(o,e));else{if(f&&v(e))for(const e of F.mount){const t=h(l,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(K(e)){const t=e.closest("form");if(t){t.reset();break}}}}l={}}_=t.shouldUnregister?r.keepDefaultValues?m(c):{}:m(o),w.array.next({values:{...o}}),w.values.next({values:{...o}})}F={mount:r.keepDirtyValues?F.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},V.mount=!S.isValid||!!r.keepIsValid||!!r.keepDirtyValues,V.watch=!!t.shouldUnregister,w.state.next({submitCount:r.keepSubmitCount?s.submitCount:0,isDirty:!n&&(r.keepDirty?s.isDirty:!(!r.keepDefaultValues||ce(e,c))),isSubmitted:!!r.keepIsSubmitted&&s.isSubmitted,dirtyFields:n?[]:r.keepDirtyValues?r.keepDefaultValues&&_?be(c,_):s.dirtyFields:r.keepDefaultValues&&e?be(c,e):{},touchedFields:r.keepTouched?s.touchedFields:{},errors:r.keepErrors?s.errors:{},isSubmitSuccessful:!!r.keepIsSubmitSuccessful&&s.isSubmitSuccessful,isSubmitting:!1})},Ce=(e,t)=>ke(J(e)?e(_):e,t);return{control:{register:ve,unregister:ie,getFieldState:se,handleSubmit:ge,setError:ae,_executeSchema:M,_getWatch:I,_getDirty:P,_updateValid:C,_removeUnmounted:()=>{for(const e of F.unMount){const t=h(l,e);t&&(t._f.refs?t._f.refs.every((e=>!ye(e))):!ye(t._f.ref))&&ie(e)}F.unMount=new Set},_updateFieldArray:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0,i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];if(a&&r){if(V.action=!0,n&&Array.isArray(h(l,e))){const t=r(h(l,e),a.argA,a.argB);i&&q(l,e,t)}if(n&&Array.isArray(h(s.errors,e))){const t=r(h(s.errors,e),a.argA,a.argB);i&&q(s.errors,e,t),xe(s.errors,e)}if(S.touchedFields&&n&&Array.isArray(h(s.touchedFields,e))){const t=r(h(s.touchedFields,e),a.argA,a.argB);i&&q(s.touchedFields,e,t)}S.dirtyFields&&(s.dirtyFields=be(c,_)),w.state.next({name:e,isDirty:P(e,t),dirtyFields:s.dirtyFields,errors:s.errors,isValid:s.isValid})}else q(_,e,t)},_updateDisabledField:ne,_getFieldArray:e=>y(h(V.mount?_:c,e,t.shouldUnregister?h(c,e,[]):[])),_reset:ke,_resetDefaultValues:()=>J(r.defaultValues)&&r.defaultValues().then((e=>{Ce(e,r.resetOptions),w.state.next({isLoading:!1})})),_updateFormState:e=>{s={...s,...e}},_disableForm:e=>{g(e)&&(w.state.next({disabled:e}),$(l,((t,r)=>{let s=e;const a=h(l,r);a&&g(a._f.disabled)&&(s||(s=a._f.disabled)),t.disabled=s}),0,!1))},_subjects:w,_proxyFormState:S,_setErrors:e=>{s.errors=e,w.state.next({errors:s.errors,isValid:!1})},get _fields(){return l},get _formValues(){return _},get _state(){return V},set _state(e){V=e},get _defaultValues(){return c},get _names(){return F},set _names(e){F=e},get _formState(){return s},set _formState(e){s=e},get _options(){return r},set _options(e){r={...r,...e}}},trigger:te,register:ve,handleSubmit:ge,watch:(e,t)=>J(e)?w.values.subscribe({next:r=>e(I(void 0,t),r)}):I(e,t,!0),setValue:Y,getValues:re,reset:Ce,resetField:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};h(l,e)&&(v(t.defaultValue)?Y(e,m(h(c,e))):(Y(e,t.defaultValue),q(c,e,m(t.defaultValue))),t.keepTouched||oe(s.touchedFields,e),t.keepDirty||(oe(s.dirtyFields,e),s.isDirty=t.defaultValue?P(e,m(h(c,e))):P()),t.keepError||(oe(s.errors,e),S.isValid&&C()),w.state.next({...s}))},clearErrors:e=>{e&&U(e).forEach((e=>oe(s.errors,e))),w.state.next({errors:e?s.errors:{}})},unregister:ie,setError:ae,setFocus:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=h(l,e),s=r&&r._f;if(s){const e=s.refs?s.refs[0]:s.ref;e.focus&&(e.focus(),t.shouldSelect&&e.select())}},getFieldState:se}}function Ce(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=s.useRef(),r=s.useRef(),[a,i]=s.useState({isDirty:!1,isValidating:!1,isLoading:J(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:J(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...ke(e),formState:a});const n=t.current.control;return n._options=e,T({subject:n._subjects.state,next:e=>{O(e,n._proxyFormState,n._updateFormState,!0)&&i({...n._formState})}}),s.useEffect((()=>n._disableForm(e.disabled)),[n,e.disabled]),s.useEffect((()=>{if(n._proxyFormState.isDirty){const e=n._getDirty();e!==a.isDirty&&n._subjects.state.next({isDirty:e})}}),[n,a.isDirty]),s.useEffect((()=>{e.values&&!ce(e.values,r.current)?(n._reset(e.values,n._options.resetOptions),r.current=e.values,i((e=>({...e})))):n._resetDefaultValues()}),[e.values,n]),s.useEffect((()=>{e.errors&&n._setErrors(e.errors)}),[e.errors,n]),s.useEffect((()=>{n._state.mount||(n._updateValid(),n._state.mount=!0),n._state.watch&&(n._state.watch=!1,n._subjects.state.next({...n._formState})),n._removeUnmounted()})),s.useEffect((()=>{e.shouldUnregister&&n._subjects.values.next({values:n._getWatch()})}),[e.shouldUnregister,n]),t.current.formState=C(a,n),t.current}}}]);
|
|
1
|
+
"use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[506],{80506:(e,t,r)=>{r.d(t,{Qr:()=>I,cI:()=>Ce,qo:()=>N});var s=r(5057),a=e=>"checkbox"===e.type,i=e=>e instanceof Date,n=e=>null==e;const l=e=>"object"===typeof e;var o=e=>!n(e)&&!Array.isArray(e)&&l(e)&&!i(e),u=e=>o(e)&&e.target?a(e.target)?e.target.checked:e.target.value:e,d=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),c=e=>{const t=e.constructor&&e.constructor.prototype;return o(t)&&t.hasOwnProperty("isPrototypeOf")},f="undefined"!==typeof window&&"undefined"!==typeof window.HTMLElement&&"undefined"!==typeof document;function m(e){let t;const r=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else{if(f&&(e instanceof Blob||e instanceof FileList)||!r&&!o(e))return e;if(t=r?[]:{},r||c(e))for(const r in e)e.hasOwnProperty(r)&&(t[r]=m(e[r]));else t=e}return t}var y=e=>Array.isArray(e)?e.filter(Boolean):[],v=e=>void 0===e,h=(e,t,r)=>{if(!t||!o(e))return r;const s=y(t.split(/[,[\].]+?/)).reduce(((e,t)=>n(e)?e:e[t]),e);return v(s)||s===e?v(e[t])?r:e[t]:s},g=e=>"boolean"===typeof e;const b={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},p={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},_="max",V="min",F="maxLength",A="minLength",S="pattern",w="required",x="validate",D=s.createContext(null),k=()=>s.useContext(D);var C=function(e,t,r){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const a={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(a,i,{get:()=>{const a=i;return t._proxyFormState[a]!==p.all&&(t._proxyFormState[a]=!s||p.all),r&&(r[a]=!0),e[a]}});return a},E=e=>o(e)&&!Object.keys(e).length,O=(e,t,r,s)=>{r(e);const{name:a,...i}=e;return E(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find((e=>t[e]===(!s||p.all)))},U=e=>Array.isArray(e)?e:[e],j=(e,t,r)=>!e||!t||e===t||U(e).some((e=>e&&(r?e===t:e.startsWith(t)||t.startsWith(e))));function T(e){const t=s.useRef(e);t.current=e,s.useEffect((()=>{const r=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{r&&r.unsubscribe()}}),[e.disabled])}var L=e=>"string"===typeof e,B=(e,t,r,s,a)=>L(e)?(s&&t.watch.add(e),h(r,e,a)):Array.isArray(e)?e.map((e=>(s&&t.watch.add(e),h(r,e)))):(s&&(t.watchAll=!0),r);function N(e){const t=k(),{control:r=t.control,name:a,defaultValue:i,disabled:n,exact:l}=e||{},o=s.useRef(a);o.current=a,T({disabled:n,subject:r._subjects.values,next:e=>{j(o.current,e.name,l)&&d(m(B(o.current,r._names,e.values||r._formValues,!1,i)))}});const[u,d]=s.useState(r._getWatch(a,i));return s.useEffect((()=>r._removeUnmounted())),u}var M=e=>/^\w*$/.test(e),R=e=>y(e.replace(/["|']|\]/g,"").split(/\.|\[/)),q=(e,t,r)=>{let s=-1;const a=M(t)?[t]:R(t),i=a.length,n=i-1;for(;++s<i;){const t=a[s];let i=r;if(s!==n){const r=e[t];i=o(r)||Array.isArray(r)?r:isNaN(+a[s+1])?{}:[]}e[t]=i,e=e[t]}return e};function P(e){const t=k(),{name:r,disabled:a,control:i=t.control,shouldUnregister:n}=e,l=d(i._names.array,r),o=N({control:i,name:r,defaultValue:h(i._formValues,r,h(i._defaultValues,r,e.defaultValue)),exact:!0}),c=function(e){const t=k(),{control:r=t.control,disabled:a,name:i,exact:n}=e||{},[l,o]=s.useState(r._formState),u=s.useRef(!0),d=s.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),c=s.useRef(i);return c.current=i,T({disabled:a,next:e=>u.current&&j(c.current,e.name,n)&&O(e,d.current,r._updateFormState)&&o({...r._formState,...e}),subject:r._subjects.state}),s.useEffect((()=>(u.current=!0,d.current.isValid&&r._updateValid(!0),()=>{u.current=!1})),[r]),C(l,r,d.current,!1)}({control:i,name:r}),f=s.useRef(i.register(r,{...e.rules,value:o,...g(e.disabled)?{disabled:e.disabled}:{}}));return s.useEffect((()=>{const e=i._options.shouldUnregister||n,t=(e,t)=>{const r=h(i._fields,e);r&&(r._f.mount=t)};if(t(r,!0),e){const e=m(h(i._options.defaultValues,r));q(i._defaultValues,r,e),v(h(i._formValues,r))&&q(i._formValues,r,e)}return()=>{(l?e&&!i._state.action:e)?i.unregister(r):t(r,!1)}}),[r,i,l,n]),s.useEffect((()=>{h(i._fields,r)&&i._updateDisabledField({disabled:a,fields:i._fields,name:r,value:h(i._fields,r)._f.value})}),[a,r,i]),{field:{name:r,value:o,...g(a)||c.disabled?{disabled:c.disabled||a}:{},onChange:s.useCallback((e=>f.current.onChange({target:{value:u(e),name:r},type:b.CHANGE})),[r]),onBlur:s.useCallback((()=>f.current.onBlur({target:{value:h(i._formValues,r),name:r},type:b.BLUR})),[r,i]),ref:e=>{const t=h(i._fields,r);t&&e&&(t._f.ref={focus:()=>e.focus(),select:()=>e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})}},formState:c,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!h(c.errors,r)},isDirty:{enumerable:!0,get:()=>!!h(c.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!h(c.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!h(c.validatingFields,r)},error:{enumerable:!0,get:()=>h(c.errors,r)}})}}const I=e=>e.render(P(e));var W=(e,t,r,s,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[s]:a||!0}}:{},H=e=>({isOnSubmit:!e||e===p.onSubmit,isOnBlur:e===p.onBlur,isOnChange:e===p.onChange,isOnAll:e===p.all,isOnTouch:e===p.onTouched}),G=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some((t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))));const $=(e,t,r,s)=>{for(const a of r||Object.keys(e)){const r=h(e,a);if(r){const{_f:e,...i}=r;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],a)&&!s)break;if(e.ref&&t(e.ref,e.name)&&!s)break;$(i,t)}else o(i)&&$(i,t)}}};var Q=(e,t,r)=>{const s=y(h(e,r));return q(s,"root",t[r]),q(e,r,s),e},z=e=>"file"===e.type,J=e=>"function"===typeof e,K=e=>{if(!f)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},X=e=>L(e),Y=e=>"radio"===e.type,Z=e=>e instanceof RegExp;const ee={value:!1,isValid:!1},te={value:!0,isValid:!0};var re=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter((e=>e&&e.checked&&!e.disabled)).map((e=>e.value));return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!v(e[0].attributes.value)?v(e[0].value)||""===e[0].value?te:{value:e[0].value,isValid:!0}:te:ee}return ee};const se={isValid:!1,value:null};var ae=e=>Array.isArray(e)?e.reduce(((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e),se):se;function ie(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"validate";if(X(e)||Array.isArray(e)&&e.every(X)||g(e)&&!e)return{type:r,message:X(e)?e:"",ref:t}}var ne=e=>o(e)&&!Z(e)?e:{value:e,message:""},le=async(e,t,r,s,i)=>{const{ref:l,refs:u,required:d,maxLength:c,minLength:f,min:m,max:y,pattern:b,validate:p,name:D,valueAsNumber:k,mount:C,disabled:O}=e._f,U=h(t,D);if(!C||O)return{};const j=u?u[0]:l,T=e=>{s&&j.reportValidity&&(j.setCustomValidity(g(e)?"":e||""),j.reportValidity())},B={},N=Y(l),M=a(l),R=N||M,q=(k||z(l))&&v(l.value)&&v(U)||K(l)&&""===l.value||""===U||Array.isArray(U)&&!U.length,P=W.bind(null,D,r,B),I=function(e,t,r){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:F,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:A;const i=e?t:r;B[D]={type:e?s:a,message:i,ref:l,...P(e?s:a,i)}};if(i?!Array.isArray(U)||!U.length:d&&(!R&&(q||n(U))||g(U)&&!U||M&&!re(u).isValid||N&&!ae(u).isValid)){const{value:e,message:t}=X(d)?{value:!!d,message:d}:ne(d);if(e&&(B[D]={type:w,message:t,ref:j,...P(w,t)},!r))return T(t),B}if(!q&&(!n(m)||!n(y))){let e,t;const s=ne(y),a=ne(m);if(n(U)||isNaN(U)){const r=l.valueAsDate||new Date(U),i=e=>new Date((new Date).toDateString()+" "+e),n="time"==l.type,o="week"==l.type;L(s.value)&&U&&(e=n?i(U)>i(s.value):o?U>s.value:r>new Date(s.value)),L(a.value)&&U&&(t=n?i(U)<i(a.value):o?U<a.value:r<new Date(a.value))}else{const r=l.valueAsNumber||(U?+U:U);n(s.value)||(e=r>s.value),n(a.value)||(t=r<a.value)}if((e||t)&&(I(!!e,s.message,a.message,_,V),!r))return T(B[D].message),B}if((c||f)&&!q&&(L(U)||i&&Array.isArray(U))){const e=ne(c),t=ne(f),s=!n(e.value)&&U.length>+e.value,a=!n(t.value)&&U.length<+t.value;if((s||a)&&(I(s,e.message,t.message),!r))return T(B[D].message),B}if(b&&!q&&L(U)){const{value:e,message:t}=ne(b);if(Z(e)&&!U.match(e)&&(B[D]={type:S,message:t,ref:l,...P(S,t)},!r))return T(t),B}if(p)if(J(p)){const e=ie(await p(U,t),j);if(e&&(B[D]={...e,...P(x,e.message)},!r))return T(e.message),B}else if(o(p)){let e={};for(const s in p){if(!E(e)&&!r)break;const a=ie(await p[s](U,t),j,s);a&&(e={...a,...P(s,a.message)},T(a.message),r&&(B[D]=e))}if(!E(e)&&(B[D]={ref:j,...e},!r))return B}return T(!0),B};function oe(e,t){const r=Array.isArray(t)?t:M(t)?[t]:R(t),s=1===r.length?e:function(e,t){const r=t.slice(0,-1).length;let s=0;for(;s<r;)e=v(e)?s++:e[t[s++]];return e}(e,r),a=r.length-1,i=r[a];return s&&delete s[i],0!==a&&(o(s)&&E(s)||Array.isArray(s)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!v(e[t]))return!1;return!0}(s))&&oe(e,r.slice(0,-1)),e}var ue=()=>{let e=[];return{get observers(){return e},next:t=>{for(const r of e)r.next&&r.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter((e=>e!==t))}}),unsubscribe:()=>{e=[]}}},de=e=>n(e)||!l(e);function ce(e,t){if(de(e)||de(t))return e===t;if(i(e)&&i(t))return e.getTime()===t.getTime();const r=Object.keys(e),s=Object.keys(t);if(r.length!==s.length)return!1;for(const a of r){const r=e[a];if(!s.includes(a))return!1;if("ref"!==a){const e=t[a];if(i(r)&&i(e)||o(r)&&o(e)||Array.isArray(r)&&Array.isArray(e)?!ce(r,e):r!==e)return!1}}return!0}var fe=e=>"select-multiple"===e.type,me=e=>Y(e)||a(e),ye=e=>K(e)&&e.isConnected,ve=e=>{for(const t in e)if(J(e[t]))return!0;return!1};function he(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=Array.isArray(e);if(o(e)||r)for(const s in e)Array.isArray(e[s])||o(e[s])&&!ve(e[s])?(t[s]=Array.isArray(e[s])?[]:{},he(e[s],t[s])):n(e[s])||(t[s]=!0);return t}function ge(e,t,r){const s=Array.isArray(e);if(o(e)||s)for(const a in e)Array.isArray(e[a])||o(e[a])&&!ve(e[a])?v(t)||de(r[a])?r[a]=Array.isArray(e[a])?he(e[a],[]):{...he(e[a])}:ge(e[a],n(t)?{}:t[a],r[a]):r[a]=!ce(e[a],t[a]);return r}var be=(e,t)=>ge(e,t,he(t)),pe=(e,t)=>{let{valueAsNumber:r,valueAsDate:s,setValueAs:a}=t;return v(e)?e:r?""===e?NaN:e?+e:e:s&&L(e)?new Date(e):a?a(e):e};function _e(e){const t=e.ref;if(!(e.refs?e.refs.every((e=>e.disabled)):t.disabled))return z(t)?t.files:Y(t)?ae(e.refs).value:fe(t)?[...t.selectedOptions].map((e=>{let{value:t}=e;return t})):a(t)?re(e.refs).value:pe(v(t.value)?e.ref.value:t.value,e)}var Ve=(e,t,r,s)=>{const a={};for(const i of e){const e=h(t,i);e&&q(a,i,e._f)}return{criteriaMode:r,names:[...e],fields:a,shouldUseNativeValidation:s}},Fe=e=>v(e)?e:Z(e)?e.source:o(e)?Z(e.value)?e.value.source:e.value:e,Ae=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function Se(e,t,r){const s=h(e,r);if(s||M(r))return{error:s,name:r};const a=r.split(".");for(;a.length;){const s=a.join("."),i=h(t,s),n=h(e,s);if(i&&!Array.isArray(i)&&r!==s)return{name:r};if(n&&n.type)return{name:s,error:n};a.pop()}return{name:r}}var we=(e,t,r,s,a)=>!a.isOnAll&&(!r&&a.isOnTouch?!(t||e):(r?s.isOnBlur:a.isOnBlur)?!e:!(r?s.isOnChange:a.isOnChange)||e),xe=(e,t)=>!y(h(e,t)).length&&oe(e,t);const De={mode:p.onSubmit,reValidateMode:p.onChange,shouldFocusError:!0};function ke(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r={...De,...t},s={submitCount:0,isDirty:!1,isLoading:J(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},l={},c=(o(r.defaultValues)||o(r.values))&&m(r.defaultValues||r.values)||{},_=r.shouldUnregister?{}:m(c),V={action:!1,mount:!1,watch:!1},F={mount:new Set,unMount:new Set,array:new Set,watch:new Set},A=0;const S={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},w={values:ue(),array:ue(),state:ue()},x=H(r.mode),D=H(r.reValidateMode),k=r.criteriaMode===p.all,C=async e=>{if(S.isValid||e){const e=r.resolver?E((await M()).errors):await R(l,!0);e!==s.isValid&&w.state.next({isValid:e})}},O=(e,t)=>{(S.isValidating||S.validatingFields)&&((e||Array.from(F.mount)).forEach((e=>{e&&(t?q(s.validatingFields,e,t):oe(s.validatingFields,e))})),w.state.next({validatingFields:s.validatingFields,isValidating:!E(s.validatingFields)}))},j=(e,t,r,s)=>{const a=h(l,e);if(a){const i=h(_,e,v(r)?h(c,e):r);v(i)||s&&s.defaultChecked||t?q(_,e,t?i:_e(a._f)):W(e,i),V.mount&&C()}},T=(e,t,r,a,i)=>{let n=!1,o=!1;const u={name:e},d=!(!h(l,e)||!h(l,e)._f.disabled);if(!r||a){S.isDirty&&(o=s.isDirty,s.isDirty=u.isDirty=P(),n=o!==u.isDirty);const r=d||ce(h(c,e),t);o=!(d||!h(s.dirtyFields,e)),r||d?oe(s.dirtyFields,e):q(s.dirtyFields,e,!0),u.dirtyFields=s.dirtyFields,n=n||S.dirtyFields&&o!==!r}if(r){const t=h(s.touchedFields,e);t||(q(s.touchedFields,e,r),u.touchedFields=s.touchedFields,n=n||S.touchedFields&&t!==r)}return n&&i&&w.state.next(u),n?u:{}},N=(r,a,i,n)=>{const l=h(s.errors,r),o=S.isValid&&g(a)&&s.isValid!==a;var u;if(t.delayError&&i?(u=()=>((e,t)=>{q(s.errors,e,t),w.state.next({errors:s.errors})})(r,i),e=e=>{clearTimeout(A),A=setTimeout(u,e)},e(t.delayError)):(clearTimeout(A),e=null,i?q(s.errors,r,i):oe(s.errors,r)),(i?!ce(l,i):l)||!E(n)||o){const e={...n,...o&&g(a)?{isValid:a}:{},errors:s.errors,name:r};s={...s,...e},w.state.next(e)}},M=async e=>{O(e,!0);const t=await r.resolver(_,r.context,Ve(e||F.mount,l,r.criteriaMode,r.shouldUseNativeValidation));return O(e),t},R=async function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{valid:!0};for(const i in e){const n=e[i];if(n){const{_f:e,...l}=n;if(e){const l=F.array.has(e.name);O([i],!0);const o=await le(n,_,k,r.shouldUseNativeValidation&&!t,l);if(O([i]),o[e.name]&&(a.valid=!1,t))break;!t&&(h(o,e.name)?l?Q(s.errors,o,e.name):q(s.errors,e.name,o[e.name]):oe(s.errors,e.name))}l&&await R(l,t,a)}}return a.valid},P=(e,t)=>(e&&t&&q(_,e,t),!ce(re(),c)),I=(e,t,r)=>B(e,F,{...V.mount?_:v(t)?c:L(e)?{[e]:t}:t},r,t),W=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const s=h(l,e);let i=t;if(s){const r=s._f;r&&(!r.disabled&&q(_,e,pe(t,r)),i=K(r.ref)&&n(t)?"":t,fe(r.ref)?[...r.ref.options].forEach((e=>e.selected=i.includes(e.value))):r.refs?a(r.ref)?r.refs.length>1?r.refs.forEach((e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(i)?!!i.find((t=>t===e.value)):i===e.value))):r.refs[0]&&(r.refs[0].checked=!!i):r.refs.forEach((e=>e.checked=e.value===i)):z(r.ref)?r.ref.value="":(r.ref.value=i,r.ref.type||w.values.next({name:e,values:{..._}})))}(r.shouldDirty||r.shouldTouch)&&T(e,i,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&te(e)},X=(e,t,r)=>{for(const s in t){const a=t[s],n="".concat(e,".").concat(s),o=h(l,n);!F.array.has(e)&&de(a)&&(!o||o._f)||i(a)?W(n,a,r):X(n,a,r)}},Y=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=h(l,e),i=F.array.has(e),o=m(t);q(_,e,o),i?(w.array.next({name:e,values:{..._}}),(S.isDirty||S.dirtyFields)&&r.shouldDirty&&w.state.next({name:e,dirtyFields:be(c,_),isDirty:P(e,o)})):!a||a._f||n(o)?W(e,o,r):X(e,o,r),G(e,F)&&w.state.next({...s}),w.values.next({name:V.mount?e:void 0,values:{..._}})},Z=async t=>{V.mount=!0;const a=t.target;let i=a.name,n=!0;const o=h(l,i),d=e=>{n=Number.isNaN(e)||e===h(_,i,e)};if(o){let c,f;const m=a.type?_e(o._f):u(t),y=t.type===b.BLUR||t.type===b.FOCUS_OUT,v=!Ae(o._f)&&!r.resolver&&!h(s.errors,i)&&!o._f.deps||we(y,h(s.touchedFields,i),s.isSubmitted,D,x),g=G(i,F,y);q(_,i,m),y?(o._f.onBlur&&o._f.onBlur(t),e&&e(0)):o._f.onChange&&o._f.onChange(t);const p=T(i,m,y,!1),V=!E(p)||g;if(!y&&w.values.next({name:i,type:t.type,values:{..._}}),v)return S.isValid&&C(),V&&w.state.next({name:i,...g?{}:p});if(!y&&g&&w.state.next({...s}),r.resolver){const{errors:e}=await M([i]);if(d(m),n){const t=Se(s.errors,l,i),r=Se(e,l,t.name||i);c=r.error,i=r.name,f=E(e)}}else O([i],!0),c=(await le(o,_,k,r.shouldUseNativeValidation))[i],O([i]),d(m),n&&(c?f=!1:S.isValid&&(f=await R(l,!0)));n&&(o._f.deps&&te(o._f.deps),N(i,f,c,p))}},ee=(e,t)=>{if(h(s.errors,t)&&e.focus)return e.focus(),1},te=async function(e){let t,a,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=U(e);if(r.resolver){const r=await(async e=>{const{errors:t}=await M(e);if(e)for(const r of e){const e=h(t,r);e?q(s.errors,r,e):oe(s.errors,r)}else s.errors=t;return t})(v(e)?e:n);t=E(r),a=e?!n.some((e=>h(r,e))):t}else e?(a=(await Promise.all(n.map((async e=>{const t=h(l,e);return await R(t&&t._f?{[e]:t}:t)})))).every(Boolean),(a||s.isValid)&&C()):a=t=await R(l);return w.state.next({...!L(e)||S.isValid&&t!==s.isValid?{}:{name:e},...r.resolver||!e?{isValid:t}:{},errors:s.errors}),i.shouldFocus&&!a&&$(l,ee,e?n:F.mount),a},re=e=>{const t={...V.mount?_:c};return v(e)?t:L(e)?h(t,e):e.map((e=>h(t,e)))},se=(e,t)=>({invalid:!!h((t||s).errors,e),isDirty:!!h((t||s).dirtyFields,e),isTouched:!!h((t||s).touchedFields,e),isValidating:!!h((t||s).validatingFields,e),error:h((t||s).errors,e)}),ae=(e,t,r)=>{const a=(h(l,e,{_f:{}})._f||{}).ref;q(s.errors,e,{...t,ref:a}),w.state.next({name:e,errors:s.errors,isValid:!1}),r&&r.shouldFocus&&a&&a.focus&&a.focus()},ie=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for(const a of e?U(e):F.mount)F.mount.delete(a),F.array.delete(a),t.keepValue||(oe(l,a),oe(_,a)),!t.keepError&&oe(s.errors,a),!t.keepDirty&&oe(s.dirtyFields,a),!t.keepTouched&&oe(s.touchedFields,a),!t.keepIsValidating&&oe(s.validatingFields,a),!r.shouldUnregister&&!t.keepDefaultValue&&oe(c,a);w.values.next({values:{..._}}),w.state.next({...s,...t.keepDirty?{isDirty:P()}:{}}),!t.keepIsValid&&C()},ne=e=>{let{disabled:t,name:r,field:s,fields:a,value:i}=e;if(g(t)){const e=t?void 0:v(i)?_e(s?s._f:h(a,r)._f):i;q(_,r,e),T(r,e,!1,!1,!0)}},ve=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=h(l,e);const a=g(t.disabled);return q(l,e,{...s||{},_f:{...s&&s._f?s._f:{ref:{name:e}},name:e,mount:!0,...t}}),F.mount.add(e),s?ne({field:s,disabled:t.disabled,name:e,value:t.value}):j(e,!0,t.value),{...a?{disabled:t.disabled}:{},...r.progressive?{required:!!t.required,min:Fe(t.min),max:Fe(t.max),minLength:Fe(t.minLength),maxLength:Fe(t.maxLength),pattern:Fe(t.pattern)}:{},name:e,onChange:Z,onBlur:Z,ref:a=>{if(a){ve(e,t),s=h(l,e);const r=v(a.value)&&a.querySelectorAll&&a.querySelectorAll("input,select,textarea")[0]||a,i=me(r),n=s._f.refs||[];if(i?n.find((e=>e===r)):r===s._f.ref)return;q(l,e,{_f:{...s._f,...i?{refs:[...n.filter(ye),r,...Array.isArray(h(c,e))?[{}]:[]],ref:{type:r.type,name:e}}:{ref:r}}}),j(e,!1,void 0,r)}else s=h(l,e,{}),s._f&&(s._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&(!d(F.array,e)||!V.action)&&F.unMount.add(e)}}},he=()=>r.shouldFocusError&&$(l,ee,F.mount),ge=(e,t)=>async a=>{let i;a&&(a.preventDefault&&a.preventDefault(),a.persist&&a.persist());let n=m(_);if(w.state.next({isSubmitting:!0}),r.resolver){const{errors:e,values:t}=await M();s.errors=e,n=t}else await R(l);if(oe(s.errors,"root"),E(s.errors)){w.state.next({errors:{}});try{await e(n,a)}catch(o){i=o}}else t&&await t({...s.errors},a),he(),setTimeout(he);if(w.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:E(s.errors)&&!i,submitCount:s.submitCount+1,errors:s.errors}),i)throw i},ke=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const a=e?m(e):c,i=m(a),n=E(e),o=n?c:i;if(r.keepDefaultValues||(c=a),!r.keepValues){if(r.keepDirtyValues)for(const e of F.mount)h(s.dirtyFields,e)?q(o,e,h(_,e)):Y(e,h(o,e));else{if(f&&v(e))for(const e of F.mount){const t=h(l,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(K(e)){const t=e.closest("form");if(t){t.reset();break}}}}l={}}_=t.shouldUnregister?r.keepDefaultValues?m(c):{}:m(o),w.array.next({values:{...o}}),w.values.next({values:{...o}})}F={mount:r.keepDirtyValues?F.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},V.mount=!S.isValid||!!r.keepIsValid||!!r.keepDirtyValues,V.watch=!!t.shouldUnregister,w.state.next({submitCount:r.keepSubmitCount?s.submitCount:0,isDirty:!n&&(r.keepDirty?s.isDirty:!(!r.keepDefaultValues||ce(e,c))),isSubmitted:!!r.keepIsSubmitted&&s.isSubmitted,dirtyFields:n?[]:r.keepDirtyValues?r.keepDefaultValues&&_?be(c,_):s.dirtyFields:r.keepDefaultValues&&e?be(c,e):{},touchedFields:r.keepTouched?s.touchedFields:{},errors:r.keepErrors?s.errors:{},isSubmitSuccessful:!!r.keepIsSubmitSuccessful&&s.isSubmitSuccessful,isSubmitting:!1})},Ce=(e,t)=>ke(J(e)?e(_):e,t);return{control:{register:ve,unregister:ie,getFieldState:se,handleSubmit:ge,setError:ae,_executeSchema:M,_getWatch:I,_getDirty:P,_updateValid:C,_removeUnmounted:()=>{for(const e of F.unMount){const t=h(l,e);t&&(t._f.refs?t._f.refs.every((e=>!ye(e))):!ye(t._f.ref))&&ie(e)}F.unMount=new Set},_updateFieldArray:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0,i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];if(a&&r){if(V.action=!0,n&&Array.isArray(h(l,e))){const t=r(h(l,e),a.argA,a.argB);i&&q(l,e,t)}if(n&&Array.isArray(h(s.errors,e))){const t=r(h(s.errors,e),a.argA,a.argB);i&&q(s.errors,e,t),xe(s.errors,e)}if(S.touchedFields&&n&&Array.isArray(h(s.touchedFields,e))){const t=r(h(s.touchedFields,e),a.argA,a.argB);i&&q(s.touchedFields,e,t)}S.dirtyFields&&(s.dirtyFields=be(c,_)),w.state.next({name:e,isDirty:P(e,t),dirtyFields:s.dirtyFields,errors:s.errors,isValid:s.isValid})}else q(_,e,t)},_updateDisabledField:ne,_getFieldArray:e=>y(h(V.mount?_:c,e,t.shouldUnregister?h(c,e,[]):[])),_reset:ke,_resetDefaultValues:()=>J(r.defaultValues)&&r.defaultValues().then((e=>{Ce(e,r.resetOptions),w.state.next({isLoading:!1})})),_updateFormState:e=>{s={...s,...e}},_disableForm:e=>{g(e)&&(w.state.next({disabled:e}),$(l,((t,r)=>{let s=e;const a=h(l,r);a&&g(a._f.disabled)&&(s||(s=a._f.disabled)),t.disabled=s}),0,!1))},_subjects:w,_proxyFormState:S,_setErrors:e=>{s.errors=e,w.state.next({errors:s.errors,isValid:!1})},get _fields(){return l},get _formValues(){return _},get _state(){return V},set _state(e){V=e},get _defaultValues(){return c},get _names(){return F},set _names(e){F=e},get _formState(){return s},set _formState(e){s=e},get _options(){return r},set _options(e){r={...r,...e}}},trigger:te,register:ve,handleSubmit:ge,watch:(e,t)=>J(e)?w.values.subscribe({next:r=>e(I(void 0,t),r)}):I(e,t,!0),setValue:Y,getValues:re,reset:Ce,resetField:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};h(l,e)&&(v(t.defaultValue)?Y(e,m(h(c,e))):(Y(e,t.defaultValue),q(c,e,m(t.defaultValue))),t.keepTouched||oe(s.touchedFields,e),t.keepDirty||(oe(s.dirtyFields,e),s.isDirty=t.defaultValue?P(e,m(h(c,e))):P()),t.keepError||(oe(s.errors,e),S.isValid&&C()),w.state.next({...s}))},clearErrors:e=>{e&&U(e).forEach((e=>oe(s.errors,e))),w.state.next({errors:e?s.errors:{}})},unregister:ie,setError:ae,setFocus:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=h(l,e),s=r&&r._f;if(s){const e=s.refs?s.refs[0]:s.ref;e.focus&&(e.focus(),t.shouldSelect&&e.select())}},getFieldState:se}}function Ce(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=s.useRef(),r=s.useRef(),[a,i]=s.useState({isDirty:!1,isValidating:!1,isLoading:J(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:J(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...ke(e),formState:a});const n=t.current.control;return n._options=e,T({subject:n._subjects.state,next:e=>{O(e,n._proxyFormState,n._updateFormState,!0)&&i({...n._formState})}}),s.useEffect((()=>n._disableForm(e.disabled)),[n,e.disabled]),s.useEffect((()=>{if(n._proxyFormState.isDirty){const e=n._getDirty();e!==a.isDirty&&n._subjects.state.next({isDirty:e})}}),[n,a.isDirty]),s.useEffect((()=>{e.values&&!ce(e.values,r.current)?(n._reset(e.values,n._options.resetOptions),r.current=e.values,i((e=>({...e})))):n._resetDefaultValues()}),[e.values,n]),s.useEffect((()=>{e.errors&&n._setErrors(e.errors)}),[e.errors,n]),s.useEffect((()=>{n._state.mount||(n._updateValid(),n._state.mount=!0),n._state.watch&&(n._state.watch=!1,n._subjects.state.next({...n._formState})),n._removeUnmounted()})),s.useEffect((()=>{e.shouldUnregister&&n._subjects.values.next({values:n._getWatch()})}),[e.shouldUnregister,n]),t.current.formState=C(a,n),t.current}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_abtnode_webapp=self.webpackChunk_abtnode_webapp||[]).push([[5312],{80378:(e,n,t)=>{t.d(n,{Z:()=>p});var i=t(55898),o=t.n(i),l=t(62681),a=t(72333),r=t(6352),s=t.n(r),c=t(35432),d=t(58238),u=t(46090);var m=t(96266);function p(e){let{blocklet:n,style:t,size:i,ancestors:o,...r}=e;const p=(0,d.h6)(),{logoUrl:h,inService:f}=function(e){var n;let{blocklet:t,ancestors:i=[]}=e;const o=(0,d.h6)(),{inService:l}=o,a="?v=".concat(null===t||void 0===t||null===(n=t.meta)||void 0===n?void 0:n.version).concat((0,u.XN)(null===t||void 0===t?void 0:t.status)?"~":"");let r=l?s()(u.zn,c.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo-bundle",a):s()(o.imgPrefix,"blocklet.png");if("registry"===t.source&&t.deployedFrom&&t.meta.logo)r=s()(t.deployedFrom,(0,u.lk)(t.meta.bundleDid,t.meta.logo),a);else{const e=window.env.apiPrefix||"/",n=i.concat(t),o=l?n.slice(1):n;r=s()(e,"/blocklet/logo-bundle".concat(o.map((e=>"/".concat(e.meta.did))).join("")),a)}return{logoUrl:r,inService:l}}({blocklet:n,ancestors:o}),{variant:g}=r,x=f?()=>{}:e=>{e.target.src="".concat(p.imgPrefix,"/blocklet.png")};let v=(0,m.jsx)("img",{src:h,onError:x,alt:n.meta.name,style:{width:i}});return n.meta.logo||(v=(0,m.jsx)(a.Z,{did:n.meta.did||"",responsive:!0})),(0,m.jsx)(l.Z,{variant:g||"square",style:Object.assign({backgroundColor:"transparent",width:i,height:i,borderRadius:10},t),...r,children:v})}p.propTypes={blocklet:o().object.isRequired,style:o().object,size:o().oneOfType([o().number,o().string]),ancestors:o().array},p.defaultProps={style:{},size:40,ancestors:[]}},74286:(e,n,t)=>{t.d(n,{Z:()=>r});var i=t(55898),o=t.n(i),l=t(39948),a=t(96266);function r(e){let{depth:n,className:t}=e;return(0,a.jsx)(l.Z,{ml:Math.max(2*(n-1),0),className:t,sx:{borderBottom:1,borderColor:"rgba(0,0,0,0.12)"}},"group-collapse-box")}r.propTypes={depth:o().number,className:o().string},r.defaultProps={depth:1,className:""}},44784:(e,n,t)=>{t.d(n,{Z:()=>d});var i,o=t(71171),l=t(33518),a=t(82790),r=t(96266);function s(e){let{labelProps:n,className:t,style:i,...o}=e;const l={...n,labelPlacement:(null===n||void 0===n?void 0:n.labelPlacement)||"start"};return(0,r.jsx)(c,{className:t,style:i,children:(0,r.jsx)(a.Z,{labelProps:l,...o})})}s.propTypes=a.Z.propTypes,s.defaultProps=a.Z.defaultProps;const c=l.Z.div(i||(i=(0,o.Z)(["\n max-width: 300px;\n > label {\n display: flex;\n justify-content: space-between;\n width: 100%;\n margin-left: 0;\n margin-right: 0;\n }\n "," {\n max-width: 100%;\n }\n"])),(e=>{let{theme:n}=e;return n.breakpoints.down("sm")})),d=s},59375:(e,n,t)=>{t.d(n,{Z:()=>Z});var i,o=t(71171),l=t(5057),a=t(55898),r=t.n(a),s=t(6352),c=t.n(s),d=t(33518),u=t(92706),m=t.n(u),p=t(39948),h=t(52277),f=t.n(h),g=t(68420),x=t(96266);const v=(0,l.lazy)((()=>Promise.all([t.e(6547),t.e(5760),t.e(6743),t.e(7097),t.e(1294),t.e(4804)]).then(t.bind(t,84804)).then((e=>({default:e.Uploader}))))),b="/blocklet/logo/upload";function Z(e){let{url:n,height:t,width:i,enabled:o,type:a,did:r,prefix:s,headers:d,onUploaded:u}=e;const{t:m}=(0,g.PE)(),h=(0,l.useRef)(null),Z={cursor:o?"pointer":"default","&::after":{content:'"'.concat(m("common.switch"),'"')}};return(0,x.jsxs)(j,{id:"uploader-".concat(r,"-").concat(a),children:[(0,x.jsx)(v,{ref:h,popup:!0,onUploadFinish:()=>{var e;u(),null===(e=h.current)||void 0===e||e.close()},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:c()(s,b,a,r),disableMediaKitPrefix:!0},coreProps:{restrictions:{allowedFileTypes:["image/*",".jpg",".jpeg",".png",".gif",".svg"],maxFileSize:10485760,maxNumberOfFiles:1}},tusProps:{headers:d}}),(0,x.jsx)(p.Z,{className:f()("uploader-wrapper",o&&"enabled"),sx:Z,onClick:()=>{var e;null===(e=h.current)||void 0===e||e.open()},children:(0,x.jsx)("img",{alt:"Logo",src:n,style:{height:t,width:i}})})]},"uploader-".concat(r,"-").concat(a))}Z.propTypes={url:r().string.isRequired,type:r().oneOf(["square","rect","favicon"]).isRequired,did:r().string.isRequired,prefix:r().string.isRequired,headers:r().func,onUploaded:r().func,height:r().number,width:r().any,enabled:r().bool},Z.defaultProps={height:80,width:"auto",enabled:!0,headers:()=>({}),onUploaded:m()};const j=d.Z.div(i||(i=(0,o.Z)(["\n .uploader-wrapper {\n display: inline-flex;\n position: relative;\n font-size: 0px;\n &.enabled {\n cursor: pointer;\n }\n &::after {\n display: none;\n }\n &.enabled::after {\n display: block;\n opacity: 0;\n position: absolute;\n bottom: 0;\n background: rgba(0, 0, 0, 0.2);\n left: 0;\n right: 0;\n height: 2.2em;\n color: white;\n text-align: center;\n font-size: 12px;\n line-height: 2em;\n transition: opacity 0.3s ease;\n }\n &:hover::after {\n opacity: 1;\n }\n }\n"])))},48579:(e,n,t)=>{t.r(n),t.d(n,{default:()=>_t});var i,o=t(71171),l=t(5057),a=t(33518),r=t(55898),s=t.n(r),c=t(96181),d=t(6352),u=t.n(d),m=t(35432),p=t(39948),h=t(55402),f=t(82275),g=t(96399),x=t(65688),v=t(37633),b=t(48037),Z=t(92273),j=t(76720),y=t(15849),k=t(68420),C=t(94464),S=t(38242),w=t(80378),E=t(1722),L=t(43681),P=t.n(L),T=t(50482),O=t.n(T),N=t(16147),R=t(29034),_=t(28726),A=t(80578),I=t(77277),B=t(86229),D=t(28641),F=t(44846),z=t(13727),U=t(56184),K=t(67680),W=t(19654),q=t(90067),M=t(39646),G=t(43897),V=t(47020),H=t(49020),Y=t(35406),J=t(11875),Q=t(95890),X=t(96266);function $(e){let{label:n,disabled:t,required:i,initialValue:o,onChange:a,style:r,onSubmit:s,triggers:c,options:d,formatterBeforeSubmit:u,helperText:m,placeholder:h,renderImage:f,renderLabel:g,filterKeys:x,noEmpty:v,...b}=e;const[Z,j]=(0,l.useState)(!1),[y,k]=(0,l.useState)(!1),[C,S]=l.useState(""),[w,E]=(0,l.useState)(o),[L,P]=(0,l.useState)(w),T=(0,l.useMemo)((()=>{if(!d)return{};const e={};return d.forEach((n=>{e[n.code]=n})),e}),[d]),O=Z?(0,X.jsx)(M.Z,{options:d,value:L,onChange:(e,n)=>{if(!Array.isArray(n))return P([]),void a([]);const t=n.filter((e=>T[e]));if(!t.length)return P([]),void a([]);P(t),a(t)},inputValue:C,onInputChange:(e,n)=>{S(n)},PopperComponent:ne,fullWidth:!0,multiple:!0,variant:"outlined",margin:"dense",filterOptions:()=>{if(!d)return[];if(!C)return d.map((e=>e.code));const e=new RegExp(C.toLowerCase());return d.filter((n=>{for(let i=0;i<x.length;i++){var t;const o=x[i];if(e.test(null===(t=n[o])||void 0===t?void 0:t.toLowerCase()))return!0}return!1})).map((e=>e.code))},getOptionLabel:e=>{var n;return null===(n=T[e])||void 0===n?void 0:n.name},renderInput:e=>(0,X.jsx)(V.Z,{...e,label:"",placeholder:h}),renderOption:(e,n)=>{var t;const i=-1!==L.indexOf(n);return(0,l.createElement)(ee,{component:"li",...e,key:n},f(T[n]||{}),(0,X.jsx)(p.Z,{sx:{"& > img":{mr:2,flexShrink:0}},style:{flex:1,fontWeight:i?"700":"normal"},children:g(n,T[n])||(null===(t=T[n])||void 0===t?void 0:t.name)}),(0,X.jsx)(p.Z,{component:z.default,sx:{opacity:.5,width:18,height:18},style:{visibility:i?"visible":"hidden"}}))},...b}):(0,X.jsx)(p.Z,{px:1,className:"form-item-input slot",style:{whiteSpace:"pre-wrap"},children:L.filter((e=>d.some((n=>n.code===e)))).map((e=>(0,X.jsx)(W.Z,{label:d.find((n=>n.code===e)).name,style:{marginRight:8},size:"small"},e)))});return(0,X.jsx)(J.Z,{className:"form",style:r,children:(0,X.jsxs)(p.Z,{className:"form-item",children:[(0,X.jsxs)(p.Z,{className:"form-item-label",children:[n,i&&(0,X.jsx)(Y.Z,{})]}),(0,X.jsxs)(p.Z,{className:"form-item-body",children:[(0,X.jsx)(p.Z,{className:"form-item-input",children:O}),(0,X.jsx)(p.Z,{className:"form-item-action",children:Z?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(K.Z,{"data-cy":"schema-form-item-confirm",onClick:async()=>{k(!0);try{!1===await s("function"===typeof u?u(L):L)?P(w):v&&!L.length?(P(o),E(o)):(P(L),E(L))}catch(e){P(w)}finally{k(!1),j(!1)}},disabled:t||y,size:"large",children:y?(0,X.jsx)(F.Z,{size:24}):(0,X.jsx)(U.Z,{})}),(0,X.jsx)(K.Z,{"data-cy":"schema-form-item-cancel",onClick:()=>{P(w),j(!1)},disabled:t||y,size:"large",children:(0,X.jsx)(z.default,{})})]}):(0,X.jsx)(Q.Z,{triggers:c,onEnterEdit:()=>j(!0),disabled:t})})]}),Z&&m&&(0,X.jsx)(q.Z,{children:m})]})})}$.propTypes={style:s().object,onSubmit:s().func,onChange:s().func,label:s().string,initialValue:s().string,required:s().bool,disabled:s().bool,triggers:s().array,options:s().array,helperText:s().string,formatterBeforeSubmit:s().func,placeholder:s().string,renderImage:s().func,filterKeys:s().arrayOf(s().string),noEmpty:s().bool,renderLabel:s().func},$.defaultProps={style:{},onSubmit:()=>{},onChange:()=>{},label:"",initialValue:"",required:!1,disabled:!1,triggers:[],options:[],helperText:"",formatterBeforeSubmit:e=>e.join(","),placeholder:"",filterKeys:["name"],renderImage:()=>null,renderLabel:(e,n)=>"",noEmpty:!1};const ee=a.Z.div(i||(i=(0,o.Z)(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n height: 48px;\n border-bottom: 1px solid rgba(0, 0, 0, 0.08);\n font-size: 1.1em;\n"]))),ne=(0,a.Z)(H.Z)((()=>({["& .".concat(G.Z.paper)]:{boxShadow:"0px 8px 12px rgba(92, 92, 92, 0.04), 0px -10px 12px rgba(92, 92, 92, 0.04)",borderRadius:"6px",width:"100%",border:"1px solid rgba(0, 0, 0, 0.12)",color:"inherit",fontSize:13,position:"absolute",left:0,top:0},["& .".concat(G.Z.listbox)]:{padding:0}})));var te,ie=t(58238),oe=t(46090),le=t(54063),ae=t(63406),re=t(78410),se=t(31853),ce=t(88577),de=t(70461),ue=t(73545),me=t(29054);function pe(e){let{initialValue:n,onChange:t,disabled:i,loading:o}=e;const{t:l}=(0,k.PE)(),{api:a}=(0,ue.T)(),{blocklet:r}=(0,me.y0)(),[s,c]=(0,se.Z)({newAppSk:"",isConnectOpen:!1}),d=()=>c({isConnectOpen:!1}),u=r.structVersion===m.APP_STRUCT_VERSION?[{key:"rotate-with-did-wallet",title:"Migrate with DID Wallet",handler:()=>{(0,oe.An)(r.status)?B.Z.error(l("blocklet.error.isRunning")):(0,S.isInProgress)(r.status)?B.Z.error(l("blocklet.error.isInProgress")):c({isConnectOpen:!0})}}]:[];return[(0,X.jsx)(D.Z,{disabled:i,loading:o,initialValue:n,onSubmit:e=>(c({newAppSk:e}),!1),triggers:u,secure:!0}),s.newAppSk&&(0,X.jsx)(de.Z,{title:l("blocklet.config.appSkTitle"),description:(0,X.jsxs)(p.Z,{children:[(0,X.jsx)(p.Z,{children:l("blocklet.config.appSkChangeTip")}),(0,X.jsx)(p.Z,{fontWeight:"bold",mt:2,children:l("blocklet.config.appDidChangeTip")}),(0,X.jsxs)(he,{children:[(0,X.jsx)("li",{children:l("blocklet.config.appDidChangeTipL1")}),(0,X.jsx)("li",{children:l("blocklet.config.appDidChangeTipL2")})]})]}),confirm:l("confirm"),cancel:l("cancel"),onConfirm:()=>(async e=>{try{await t(e)}finally{c({newAppSk:""})}})(s.newAppSk),onCancel:()=>c({newAppSk:""})}),(0,X.jsx)(ce.Z,{popup:!0,open:s.isConnectOpen,forceConnected:!1,saveConnect:!1,action:"rotate-key-pair",checkFn:a.get,checkTimeout:3e5,onSuccess:d,extraParams:{appDid:r.appDid},messages:{title:l("setup.keyPair.title"),scan:l("setup.keyPair.scan"),confirm:l("setup.keyPair.confirm"),success:l("setup.keyPair.success")},onClose:d})]}pe.propTypes={initialValue:s().string,onChange:s().func,disabled:s().bool,loading:s().bool},pe.defaultProps={initialValue:"default",onChange:()=>{},disabled:!1,loading:!1};const he=(0,a.Z)("ul")(te||(te=(0,o.Z)(["\n padding-left: 16px;\n li {\n margin-top: 8px;\n list-style: disk;\n font-weight: bold;\n }\n"])));var fe,ge=t(13128),xe=t(55372),ve=t(11750),be=t(88574),Ze=t(26174),je=t(88092),ye=t(50185),ke=t(17425);function Ce(e){let{onCancel:n,onSuccess:t,onError:i}=e;const{api:o}=(0,l.useContext)(ue.B),[a,r]=(0,l.useState)(!1),{t:s,locale:c}=(0,k.PE)(),[d,u]=(0,l.useState)(""),[m,h]=(0,l.useState)(!1),[f,g]=(0,l.useState)(0),[x,v]=(0,l.useState)(""),{endpoint:b}=(0,ke.DJ)(),[Z,j]=(0,l.useState)(!1),y=e=>{u(null),r(!0);try{v(e.result),g(S.length-1)}catch(n){const e=(0,oe.Z)(n);u(e),i(n)}finally{r(!1)}},C=()=>{h(!1),g(0)},S=[{body:(0,X.jsxs)(p.Z,{children:[(0,X.jsx)(ve.Z,{children:s("team.transferApp.transferDialog.tips.progress")}),(0,X.jsx)(ve.Z,{mt:3,mb:2,children:s("team.transferApp.transferDialog.tips.newOwnerPermissions")})]}),cancel:s("common.cancel"),confirm:s("team.transferApp.transferDialog.createTransferLink"),onCancel:n,onConfirm:()=>{h(!0),g(1)}},{body:()=>(0,X.jsx)(ce.Z,{action:"transfer-app-owner",open:m,locale:c,checkFn:o.get,onClose:C,onSuccess:y,checkTimeout:3e5,extraParams:{},messages:{title:s("team.transferApp.connectDialog.title"),scan:s("team.transferApp.connectDialog.scan"),confirm:s("team.transferApp.connectDialog.confirm"),success:s("team.transferApp.connectDialog.success")},popup:!0})},{body:()=>{const e=(0,oe.VP)({transferId:x.transferId,endpoint:b});return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(p.Z,{component:Se,dangerouslySetInnerHTML:{__html:s("team.transferApp.transferDialog.createSuccessTip1")}}),(0,X.jsx)(p.Z,{component:Se,mt:2,children:(0,X.jsx)(Se,{children:s("team.transferApp.transferDialog.createSuccessTip3")})}),(0,X.jsxs)(p.Z,{children:[(0,X.jsx)(p.Z,{component:Se,mt:2,children:(0,X.jsx)(Se,{children:s("team.transferApp.transferDialog.createSuccessTip2",{expireDate:(0,oe.B2)(x.expireDate,c)})})}),(0,X.jsx)(p.Z,{my:1,children:(0,X.jsx)(ye.Z,{children:e})})]}),(0,X.jsx)("div",{children:(0,X.jsx)(Ze.Z,{value:"end",control:(0,X.jsx)(je.Z,{checked:Z,onChange:e=>j(e.target.checked)}),label:s("team.transferApp.transferDialog.iKnow"),labelPlacement:"end"})})]})},confirm:s("common.confirm"),onConfirm:t}],w=S[f];return(0,X.jsxs)(ge.ZP,{title:(0,X.jsx)(Se,{className:"title",children:s("team.transferApp.transferDialog.title")}),fullWidth:!0,open:!0,showCloseButton:!1,actions:(0,X.jsxs)(X.Fragment,{children:[w.cancel&&(0,X.jsx)(_.Z,{onClick:w.onCancel,color:"inherit",children:w.cancel}),(0,X.jsxs)(_.Z,{onClick:w.onConfirm,color:"error",disabled:a||f===S.length-1&&!Z,variant:"contained",autoFocus:!0,children:[a&&(0,X.jsx)(F.Z,{size:16}),w.confirm]})]}),children:[(0,X.jsx)(xe.Z,{component:"div",children:"function"===typeof w.body?w.body():w.body}),!!d&&(0,X.jsx)(be.Z,{type:"error",variant:"icon",children:d})]})}Ce.propTypes={onCancel:s().func.isRequired,onSuccess:s().func.isRequired,onError:s().func},Ce.defaultProps={onError:()=>{}};const Se=a.Z.div(fe||(fe=(0,o.Z)(["\n font-size: 16px;\n font-weight: bold;\n &.title {\n font-size: 20px;\n }\n"])));var we,Ee=t(49522),Le=t(59375);const Pe=Object.keys(I.SUPPORTED_LANGUAGES).map((e=>({code:e,name:I.SUPPORTED_LANGUAGES[e].nativeName,enName:I.SUPPORTED_LANGUAGES[e].name}))),Te=["name","enName","code"];function Oe(e){var n;let{blocklet:t,onUpdate:i,hasPermission:o,...a}=e;const{api:r,inService:s,prefix:c,getSessionInHeader:d,ws:{useSubscription:u}}=(0,ie.h6)(),{t:h}=(0,l.useContext)(k.RD),[f,g]=(0,l.useState)(""),[x,v]=(0,l.useState)(""),[b,Z]=(0,l.useState)(!1),j=(0,S.getWhoCanAccess)(t),y=null===t||void 0===t||null===(n=t.settings)||void 0===n?void 0:n.publicToStore,C=x||!o,{logoUrl:w,rectLogoUrl:E,faviconUrl:L}=(0,Ee.Z)({blocklet:t}),{did:T}=t.meta,{site:F}=t,z=P()(t.meta,"capabilities.clusterMode",!1);if(u(m.EVENTS.NODE_RUNTIME_INFO,(e=>{z&&g(P()(e,"cpu.physicalCores",""))})),(0,oe.wS)(t.status))return null;const U=t.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_DELETABLE)),K=!U||"yes"===U.value,W=t.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LANGUAGES)),q=t.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL)),M=t.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_TENANT_MODE)),G=(null===M||void 0===M?void 0:M.value)||I.BLOCKLET_TENANT_MODES.SINGLE,V=t.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER)),H=t.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR)),Y=[{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_NAME,description:h("blocklet.config.name"),value:t.environments.find((e=>"BLOCKLET_APP_NAME"===e.key)).value},{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_DESCRIPTION,description:h("blocklet.config.description"),value:t.environments.find((e=>"BLOCKLET_APP_DESCRIPTION"===e.key)).value},{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL,description:h("blocklet.config.appUrl"),value:q?q.value:""},{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_OWNER,description:h("blocklet.config.copyrightOwner"),value:V?V.value:""},{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_COPYRIGHT_YEAR,description:h("blocklet.config.copyrightYear"),value:H?H.value:""}];if(z){const e=t.configs.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE)),n=e?e.value:f;Y.push({key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE,description:h("blocklet.config.clusterSize"),value:n,cpuCores:f})}const J=async(e,n)=>{if(e===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE){const e=(0,oe.I)({value:n,cpuCores:f});if(e)return void B.Z.error(e)}const o=[{key:e,value:n}];try{v(!0);const{blocklet:e}=await r.configBlocklet({input:{did:t.meta.did,configs:o}});i(e)}catch(l){B.Z.error(l.message)}finally{v(!1)}},Q=(e,n)=>async o=>{if(!x){v(!0);try{const{checked:l}=o.target,{blocklet:a}=await r.configBlocklet({input:{did:t.meta.did,configs:[{key:I.BLOCKLET_CONFIGURABLE_KEY[e],value:n(l)}]}});i(a)}catch(l){B.Z.error(l.message)}finally{v(!1)}}},ee=Q("BLOCKLET_DELETABLE",(e=>e?"no":"yes")),ne=Q("BLOCKLET_APP_TENANT_MODE",(e=>e?I.BLOCKLET_TENANT_MODES.MULTIPLE:I.BLOCKLET_TENANT_MODES.SINGLE));return(0,X.jsxs)(Ae,{...a,children:[Y.map((e=>(0,X.jsxs)(p.Z,{className:"config-form",mt:2,children:[(0,X.jsx)(p.Z,{className:"config-label",fontSize:14,mb:0,children:e.description}),(0,X.jsx)(D.Z,{style:{marginTop:0},disabled:C,loading:x,initialValue:e.value,onSubmit:n=>J(e.key,n)})]}))),(0,X.jsx)(p.Z,{className:"config-form",component:R.Z,my:3}),(0,X.jsx)(p.Z,{className:"config-label",fontSize:14,mb:1,sx:{flexGrow:0,width:"auto"},children:h("blocklet.config.logoSquare")}),(0,X.jsx)(Le.Z,{did:t.meta.did,height:80,width:80,type:"square",prefix:c,url:w,enabled:o,headers:d}),(0,X.jsx)(p.Z,{className:"config-label",fontSize:14,mt:4,children:h("blocklet.config.logoRect")}),(0,X.jsx)(p.Z,{mb:1.5,className:"config-desc",children:h("blocklet.config.logoRectDesc")}),(0,X.jsx)(Le.Z,{did:t.meta.did,height:80,type:"rect",prefix:c,url:E,enabled:o,headers:d}),(0,X.jsx)(p.Z,{className:"config-label",fontSize:14,mt:4,children:h("blocklet.config.logoFavicon")}),(0,X.jsx)(p.Z,{mb:1.5,className:"config-desc",children:h("blocklet.config.logoFaviconDesc")}),(0,X.jsx)(Le.Z,{did:t.meta.did,height:25,width:25,type:"favicon",prefix:c,url:L,enabled:o,headers:d}),(0,X.jsx)(p.Z,{className:"config-form",children:"all"===j&&"registry"===t.source&&(0,X.jsxs)(p.Z,{className:"config-item",children:[(0,X.jsxs)(p.Z,{className:"config-label",children:[h("blocklet.config.access.publicToStore"),(0,X.jsx)(p.Z,{className:"config-desc",children:h("blocklet.config.access.publicInstanceTip")})]}),(0,X.jsx)(N.Z,{disabled:C,checked:y,defaultChecked:!0,onChange:async e=>{if(!x){v(!0);try{const{checked:n}=e.target,{blocklet:o}=await r.configPublicToStore({input:{did:t.meta.did,publicToStore:n}});i(o)}catch(n){B.Z.error(n.message)}finally{v(!1)}}}})]})}),(0,X.jsx)(p.Z,{className:"config-form",component:R.Z,my:3}),(0,X.jsxs)(p.Z,{className:"config-form",mt:2,children:[(0,X.jsx)(p.Z,{className:"config-label",fontSize:14,mb:0,children:h("blocklet.config.languages")}),(0,X.jsx)($,{style:{marginTop:0},disabled:C,loading:x,options:Pe,noEmpty:!0,initialValue:W?W.value.split(","):["en","zh"],onSubmit:e=>J("BLOCKLET_APP_LANGUAGES",e),helperText:h("blocklet.config.selectLanguagesTip"),placeholder:h("blocklet.config.languagesSearch"),filterKeys:Te,renderLabel:(e,n)=>n.name===n.enName?"".concat(n.name," (").concat(e.toUpperCase(),")"):"".concat(n.name,", ").concat(n.enName," (").concat(e.toUpperCase(),")")})]}),(0,X.jsx)(p.Z,{className:"config-form",component:R.Z,my:3}),(0,X.jsx)(p.Z,{className:"config-form",mt:2,children:(0,X.jsx)(p.Z,{className:"config-label",mb:0,children:h("common.security")})}),(0,X.jsxs)(p.Z,{className:"config-form",mt:2,children:[(0,X.jsx)(p.Z,{className:"config-label",fontSize:14,mb:0,children:h("router.domainSecurity.cors.title")}),(0,X.jsx)(p.Z,{mb:1.5,className:"config-desc",children:h("router.domainSecurity.cors.description",{name:"the blocklet"})}),(0,X.jsx)(D.Z,{style:{marginTop:0},disabled:C,loading:x,initialValue:(F.corsAllowedOrigins||[]).join(", "),onSubmit:async e=>{const n=F.corsAllowedOrigins||[],i=e.split(",").map((e=>e.trim())).filter(Boolean);if(O()(n,i))return!1;try{v(!0);const e=i.length?i:["__none__"];await r.updateRoutingSite({input:{id:F.id,corsAllowedOrigins:e,teamDid:t.meta.did}}),v(!1)}catch(o){return B.Z.error(o.message),v(!1),!1}return!0}})]}),(0,X.jsx)(p.Z,{className:"config-form",component:R.Z,my:3}),(0,X.jsx)(p.Z,{mb:2,className:"config-label",fontSize:20,children:h("blocklet.config.dangerZone")}),(0,X.jsxs)(p.Z,{px:2,py:1,sx:{border:"1px solid red",borderRadius:2},children:[(0,X.jsx)(p.Z,{className:"config-form",children:!s&&(0,X.jsxs)(p.Z,{className:"config-item",children:[(0,X.jsxs)(p.Z,{className:"config-label",children:[h("blocklet.config.deletable.name"),(0,X.jsx)(p.Z,{className:"config-desc",children:h(K?"blocklet.config.deletable.disable":"blocklet.config.deletable.enable")})]}),(0,X.jsx)(N.Z,{disabled:C,checked:!K,defaultChecked:!0,onChange:ee})]})}),(0,X.jsxs)(p.Z,{className:"config-form",mt:2,children:[(0,X.jsx)(p.Z,{className:"config-label",fontSize:14,mb:0,children:h("blocklet.config.sk")}),(0,X.jsx)(pe,{disabled:C,loading:x,initialValue:t.environments.find((e=>"BLOCKLET_APP_SK"===e.key)).value,onChange:async e=>{if(!x){v(!0);try{const{blocklet:n}=await r.configBlocklet({input:{did:t.meta.did,configs:[{key:I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SK,value:e}]}});i(n)}catch(n){B.Z.error(n.message)}finally{v(!1)}}}})]}),s&&(0,X.jsx)(ae.Z,{role:"owner",children:e=>(e||le.C)&&(0,X.jsxs)(p.Z,{className:"config-form",mt:2,children:[(0,X.jsxs)(p.Z,{className:"config-item",children:[(0,X.jsx)(p.Z,{className:"config-label",mb:0,children:h("team.transferApp.name")}),(0,X.jsxs)(_.Z,{style:{flexShrink:0},variant:"contained",edge:"end",color:"error",size:"small","data-cy":"transfer-app",onClick:()=>Z(!0),children:[(0,X.jsx)(A.Z,{style:{fontSize:"1.3em",marginRight:4}}),h("team.transferApp.name")]})]}),b&&(0,X.jsx)(Ce,{onCancel:()=>Z(!1),onSuccess:()=>Z(!1)})]})}),(0,X.jsx)(p.Z,{className:"config-form",mt:2,children:(0,X.jsxs)(p.Z,{className:"config-item",children:[(0,X.jsxs)(p.Z,{className:"config-label",children:[h("blocklet.config.clearCache.name"),(0,X.jsx)(p.Z,{className:"config-desc",children:h("blocklet.config.clearCache.purpose")})]}),(0,X.jsx)(re.Z,{teamDid:T})]})}),(0,X.jsx)(p.Z,{className:"config-form",children:(0,X.jsxs)(p.Z,{className:"config-item",children:[(0,X.jsxs)(p.Z,{className:"config-label",children:[h("blocklet.config.tenantMode.name"),(0,X.jsx)(p.Z,{className:"config-desc",children:h("blocklet.config.tenantMode.".concat(G))})]}),(0,X.jsx)(N.Z,{disabled:C,checked:G===I.BLOCKLET_TENANT_MODES.MULTIPLE,onChange:ne})]})})]})]})}const Ne=(0,ae.V)(Oe,"mutate_blocklets"),Re=(0,ae.V)(Oe,"",oe.Wf);function _e(e){const{inService:n}=(0,ie.h6)();return n?(0,X.jsx)(Re,{...e}):(0,X.jsx)(Ne,{...e})}Oe.propTypes={blocklet:s().object.isRequired,onUpdate:s().func,hasPermission:s().bool},Oe.defaultProps={onUpdate:()=>{},hasPermission:!1};const Ae=a.Z.div(we||(we=(0,o.Z)(["\n padding-top: 24px;\n .config-form {\n flex-grow: 1;\n overflow-y: auto;\n "," {\n width: 100%;\n flex-shrink: 0;\n padding: 0 24px;\n transform: translate(0, 0);\n }\n }\n\n .config-item {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin: 16px 0;\n }\n\n .config-label {\n font-weight: bold;\n }\n\n .config-desc {\n font-weight: normal;\n font-size: 12px;\n color: #666;\n }\n\n .form-item {\n margin-top: 0;\n }\n"])),(e=>e.theme.breakpoints.down("md")));var Ie=t(25710),Be=t(93066),De=t(80576),Fe=t(8708),ze=t.n(Fe),Ue=t(12673),Ke=t(99360),We=t(80506),qe=t(766),Me=t.n(qe),Ge=t(24529),Ve=t.n(Ge),He=t(16727),Ye=t.n(He),Je=t(92706),Qe=t.n(Je);const Xe=(0,l.forwardRef)(((e,n)=>{const{t:t}=(0,l.useContext)(k.RD),i=(0,Ue.Z)({show:!1,title:"",content:"",onConfirm:Qe(),onCancel:Qe(),loading:!1}),o=(0,Ke.Z)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i.show=!0,i.title=e.title,i.content=e.content,i.onConfirm=e.onConfirm||Qe(),i.onCancel=e.onCancel||Qe(),i.loading=!1})),a=(0,Ke.Z)((()=>{i.title="",i.content="",i.onConfirm=Qe(),i.onCancel=Qe()})),r=(0,Ke.Z)((()=>{i.show=!1,setTimeout((()=>{a()}),300)})),s=(0,Ke.Z)((()=>{r(),null===i||void 0===i||i.onCancel()}),[]),c=(0,Ke.Z)((async()=>{i.loading=!0;try{await(null===i||void 0===i?void 0:i.onConfirm(r))}finally{i.loading=!1}}),[]);return(0,l.useImperativeHandle)(n,(()=>({open:o,close:r})),[o,r]),(0,X.jsx)(ge.I4,{open:i.show,title:i.title,onConfirm:c,onCancel:s,confirmButton:{text:t("common.confirm"),props:{variant:"contained",color:"primary",loading:i.loading}},cancelButton:{text:t("common.cancel"),props:{variant:"outlined",color:"primary"}},children:i.content instanceof Function?i.content():i.content})}));function $e(){const e=(0,l.useRef)(null),n=(0,Ke.Z)((function(){for(var n,t=arguments.length,i=new Array(t),o=0;o<t;o++)i[o]=arguments[o];null===(n=e.current)||void 0===n||n.open(...i)})),t=(0,Ke.Z)((function(){for(var n,t=arguments.length,i=new Array(t),o=0;o<t;o++)i[o]=arguments[o];null===(n=e.current)||void 0===n||n.close(...i)})),i={open:n,close:t};return{confirmHolder:(0,X.jsx)(Xe,{ref:e}),confirmApi:i}}const en={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:""};const nn=function(){var e,n;const{api:t}=(0,ie.h6)(),{blocklet:i}=(0,me.y0)(),{t:o}=(0,k.PE)(),{confirmApi:l,confirmHolder:a}=$e(),r=null===i||void 0===i||null===(e=i.meta)||void 0===e?void 0:e.did,s=Object.assign({...en},(null===i||void 0===i||null===(n=i.settings)||void 0===n||null===(n=n.notification)||void 0===n?void 0:n.email)||{}),{handleSubmit:c,control:d,formState:u,watch:m,reset:h}=(0,We.cI)({defaultValues:ze()(s,Object.keys(en))}),f=(0,Ue.Z)({testReceiver:"",testReceiverError:""}),g=m("enabled"),x=(0,Ke.Z)((async function(e,n){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];try{var l;const{blocklet:n}=await t.configNotification({input:{did:r,notification:JSON.stringify({email:e})}}),a=Object.assign({...en},(null===n||void 0===n||null===(l=n.settings)||void 0===l||null===(l=l.notification)||void 0===l?void 0:l.email)||{});h(a),i&&B.Z.success(o("oauth.saveSuccess"))}catch(a){if(!i)throw a;B.Z.error(a.message||o("oauth.saveFailed"))}})),v=(0,Ke.Z)((async(e,n,i)=>{try{u.isDirty&&await x(e,n,!1),await t.sendEmail({input:{did:r,receiver:i,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification"})}}),B.Z.success(o("notification.email.testSuccess"))}catch(l){B.Z.error(l.message||o("notification.email.testfailed"))}})),b=(0,Ke.Z)(((e,n)=>{f.testReceiver="",f.testReceiverError="",l.open({title:o("notification.email.testSendEmail"),content:()=>(0,X.jsx)(p.Z,{sx:{width:"300px"},children:(0,X.jsx)(V.Z,{fullWidth:!0,name:"testReceiver",label:o("notification.email.inputTestReceiver"),value:f.testReceiver,onChange:e=>{f.testReceiver=e.target.value},error:!!f.testReceiverError,helperText:f.testReceiverError||"\u3000"})}),async onConfirm(t){var i;const l=null===(i=f.testReceiver)||void 0===i?void 0:i.trim();l?Me()(l)?(f.testReceiverError="",await v(e,n,l),t()):f.testReceiverError=o("notification.email.receiverInvalid"):f.testReceiverError=o("notification.email.receiverRequired")}})})),Z=(0,Ke.Z)((e=>{const n=null===e||void 0===e?void 0:e.trim();return n?!!Me()(n)||o("notification.email.fromInvalid"):o("notification.email.fromRequired")})),j=(0,Ke.Z)((e=>{const n=null===e||void 0===e?void 0:e.trim();return n?!!Ve()(n,{require_host:!1,protocols:[]})||o("notification.email.hostInvalid"):o("notification.email.hostRequired")})),y=(0,Ke.Z)((e=>e?!!Ye()(e)||o("notification.email.portInvalid"):o("notification.email.portRequired"))),C=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("notification.email.userRequired"))),S=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("notification.email.passwordRequired"))),w=(0,Ke.Z)((()=>!0));return(0,X.jsxs)(p.Z,{children:[(0,X.jsxs)("form",{onSubmit:c(x),disabled:!0,children:[(0,X.jsx)(We.Qr,{name:"enabled",control:d,render:e=>{let{field:n}=e;return(0,X.jsx)(Ze.Z,{control:(0,X.jsx)(N.Z,{checked:n.value,...n}),label:o("notification.email.enable"),sx:{marginBottom:"8px"}})}}),(0,X.jsx)(We.Qr,{name:"from",control:d,rules:{validate:g?Z:w},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,label:o("notification.email.from"),error:!!u.errors[t.name],helperText:(null===(n=u.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!g})})}}),(0,X.jsx)(We.Qr,{name:"host",control:d,rules:{validate:g?j:w},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,error:!!u.errors[t.name],label:o("notification.email.host"),helperText:(null===(n=u.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!g})})}}),(0,X.jsx)(We.Qr,{name:"port",control:d,rules:{validate:g?y:w},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,type:"number",error:!!u.errors[t.name],label:o("notification.email.port"),helperText:(null===(n=u.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!g})})}}),(0,X.jsx)(We.Qr,{name:"user",control:d,rules:{validate:g?C:w},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,error:!!u.errors[t.name],label:o("notification.email.user"),helperText:(null===(n=u.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!g})})}}),(0,X.jsx)(We.Qr,{name:"password",control:d,rules:{validate:g?S:w},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,type:"password",error:!!u.errors[t.name],label:o("notification.email.password"),helperText:(null===(n=u.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!g})})}}),(0,X.jsx)(We.Qr,{name:"secure",control:d,rules:{validate:w},render:e=>{let{field:n}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(Ze.Z,{control:(0,X.jsx)(N.Z,{checked:n.value,...n,disabled:!g}),label:o("notification.email.secure"),style:{marginBottom:16}})})}}),(0,X.jsx)(_.Z,{variant:"outlined",color:"warning",onClick:c(b),sx:{mr:2},disabled:!g,children:o("oauth.runTest")}),(0,X.jsx)(_.Z,{type:"submit",variant:"contained",disabled:!u.isDirty,children:o("oauth.save")})]}),a]})},tn=[{label:(0,X.jsx)(p.Z,{textAlign:"center",width:"100%",children:"Email"}),value:"email"},{label:(0,X.jsx)(p.Z,{textAlign:"center",width:"100%",children:"More"}),value:"more"}];const on=function(){const[e,n]=(0,l.useState)(tn[0].value),{t:t}=(0,l.useContext)(k.RD),i=(0,Be.Z)((()=>({email:(0,X.jsx)(nn,{}),more:(0,X.jsx)(p.Z,{children:(0,X.jsx)(Ie.Z,{children:t("notification.comingSoon")})})})),[t]);return(0,X.jsxs)(p.Z,{children:[(0,X.jsx)(C.Z,{tabs:tn,current:e,onChange:n}),(0,X.jsx)(p.Z,{marginTop:"10px",children:i[e]})]})};var ln=t(96366),an=t(75239),rn=t(48342),sn=t(94552),cn=t(24558),dn=t(74286),un=t(74490),mn=t(76667),pn=t(70648),hn=t(44067),fn=t(7664),gn=t(44123),xn=t(53906);const vn=[{value:m.WHO_CAN_ACCESS.ALL,icon:xn.Z,title:{zh:"\u6240\u6709\u4eba\u53ef\u8bbf\u95ee",en:"Accessible to all"},description:{zh:"\u5411\u6240\u6709\u4eba\u5f00\u653e\uff0c\u65e0\u9700\u901a\u884c\u8bc1\u5373\u53ef\u8bbf\u95ee\u5e94\u7528",en:"Open to the world anyone can access without passport"}},{value:m.WHO_CAN_ACCESS.INVITED,icon:gn.Z,title:{zh:"\u53ea\u6709\u88ab\u9080\u8bf7\u7684\u4eba\u53ef\u4ee5\u8bbf\u95ee",en:"Only invited people can access"},description:{zh:"\u7a0d\u540e\u60a8\u53ef\u4ee5\u5728\u7ba1\u7406\u9875\u9762\u4e2d\u9080\u8bf7\u6210\u5458",en:"You can invite members later in the admin page"}},{value:m.WHO_CAN_ACCESS.OWNER,icon:fn.Z,title:{zh:"\u53ea\u6709\u5e94\u7528\u6240\u6709\u8005\u53ef\u4ee5\u8bbf\u95ee",en:"Only Owner of the blocklet can access"},description:{zh:"\u5fc5\u987b\u63d0\u4f9b\u6240\u6709\u8005\u901a\u884c\u8bc1\u624d\u80fd\u8bbf\u95ee\u5e94\u7528",en:"You must provide owner passport to access this application"}}];var bn,Zn;const jn="roles",yn=[...vn,{value:jn,icon:pn.Z,title:{zh:"\u6307\u5b9a\u901a\u884c\u8bc1\u53ef\u8bbf\u95ee",en:"Accessible to selected passports"},description:{zh:"\u53ea\u6709\u6307\u5b9a\u7684\u901a\u884c\u8bc1\u53ef\u4ee5\u8bbf\u95ee",en:"Only specified passports can access"}}],kn=(e,n)=>{if(e&&e.startsWith(m.WHO_CAN_ACCESS_PREFIX_ROLES)){const t=(0,S.getRolesFromAuthConfig)({whoCanAccess:e}),i=n.filter((e=>t.includes(e.name)));return{access:jn,roles:i}}return{access:e,roles:[]}},Cn=function(e,n){let{roles:t=[]}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=(e.configs||[]).find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.COMPONENT_ACCESS_WHO));if(i)return kn(i.value,t);if(n&&P()(n,"settings.whoCanAccess")&&P()(n,"settings.whoCanAccess")!==m.WHO_CAN_ACCESS.ALL)return kn(P()(n,"settings.whoCanAccess"),t);const o=(0,S.findServiceFromMeta)(e.meta,m.NODE_SERVICES.AUTH);return P()(o,"config.whoCanAccess")?kn(o.config.whoCanAccess,t):{access:m.WHO_CAN_ACCESS.ALL,roles:[]}};function Sn(e){let{blocklet:n,ancestors:t,children:i}=e;const o=(0,ln.Z)(),[a,r]=(0,l.useState)(""),{t:s,locale:c}=(0,k.PE)(),{api:d}=(0,ie.h6)(),{roles:u}=(0,ke.DJ)(),[h,f]=(0,l.useState)(""),g=t[0]||n,{access:x,roles:v}=Cn(n,g,{roles:u}),[b,Z]=(0,l.useState)(x),[j,y]=(0,l.useState)(v),C=[...t.map((e=>e.meta.did)),n.meta.did],w={marginRight:4,fontSize:18,verticalAlign:"text-bottom",color:o.palette.text.secondary},E=t.concat(n).map((e=>(0,S.getDisplayName)(e,!0))).join(" / ");if((0,oe.wS)(n.status))return null;if("unknown"===n.status&&(0,oe.wS)(n.status))return null;const L=()=>{r(!1)},P=e=>{e.stopPropagation(),r(!0)},T=h||b===jn&&!j.length;return["function"===typeof i?i({open:P}):(0,X.jsx)(K.Z,{onClick:P,"data-cy":"action-config-component",children:(0,X.jsx)(mn.default,{})}),a&&(0,X.jsxs)(wn,{open:!0,fullWidth:!0,title:E,onClose:L,PaperProps:{style:{minHeight:"auto"}},actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(_.Z,{onClick:L,color:"inherit","data-cy":"config-access-cancel",children:s("common.cancel")}),(0,X.jsxs)(_.Z,{onClick:async()=>{if(!h){f(!0);try{let e=b;e===jn&&(e="".concat(m.WHO_CAN_ACCESS_PREFIX_ROLES).concat(j.map((e=>e.name)).join(","))),await d.updateWhoCanAccess({input:{did:C,whoCanAccess:e}}),B.Z.success(s("blocklet.config.access.updatedTip")),L(),f(!1)}catch(e){f(!1),B.Z.error((0,oe.Z)(e))}}},color:"primary",disabled:T,variant:"contained",autoFocus:!0,"data-cy":"config-access-confirm",children:[h&&(0,X.jsx)(F.Z,{size:16}),s("common.confirm")]})]}),children:[(0,X.jsx)(p.Z,{mt:4,mb:3,children:(0,X.jsx)(V.Z,{label:s("blocklet.config.access.description"),select:!0,fullWidth:!0,value:b,onChange:e=>{const{value:n}=e.target;Z(n)},"data-cy":"config-access-select",SelectProps:{renderValue:e=>{const n=yn.find((n=>n.value===e));return n?(0,X.jsxs)(p.Z,{children:[(0,X.jsx)(n.icon,{style:w}),n.title[c]]}):null}},children:yn.map((e=>(0,X.jsxs)(En,{value:e.value,sx:{display:"block"},"data-cy":"config-access-opt-".concat(e.value),children:[(0,X.jsxs)(p.Z,{display:"flex",alignItems:"center",children:[(0,X.jsx)(e.icon,{style:w}),(0,X.jsx)(p.Z,{children:e.title[c]})]}),(0,X.jsx)(p.Z,{children:(0,X.jsx)(p.Z,{className:"tip",children:e.description[c]})})]})))})}),b===jn&&(0,X.jsx)(p.Z,{mt:4,mb:3,children:(0,X.jsx)(V.Z,{label:s("blocklet.config.access.description"),select:!0,fullWidth:!0,value:j.map((e=>e.name)),onChange:e=>{y(u.filter((n=>(e.target.value||[]).includes(n.name))))},SelectProps:{multiple:!0,renderValue:e=>(0,X.jsx)(p.Z,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:e.map((e=>{const n=u.find((n=>n.name===e));return(0,X.jsx)(W.Z,{label:n.title},n.text)}))})},children:u.map((e=>{let{name:n,title:t}=e;return(0,X.jsxs)(un.Z,{value:n,children:[(0,X.jsx)(je.Z,{checked:j.some((e=>e.name===n))}),(0,X.jsx)(hn.Z,{primary:t})]},n)}))})})]})]}Sn.propTypes={blocklet:s().object.isRequired,ancestors:s().array,children:s().any},Sn.defaultProps={ancestors:[],children:null};const wn=(0,a.Z)(ge.ZP)(bn||(bn=(0,o.Z)(["\n .MuiDialogContent-root {\n padding-top: 0;\n margin-top: -32px;\n }\n .MuiToolbar-root {\n padding-right: 12px;\n }\n .ux-dialog_right {\n padding-right: 20px;\n }\n"]))),En=(0,a.Z)(un.Z)(Zn||(Zn=(0,o.Z)(["\n .tip {\n font-size: 12px;\n color: ",";\n }\n"])),(e=>e.theme.palette.text.secondary));var Ln;function Pn(e){var n;let{blocklet:t,ancestors:i,depth:o}=e;const a=(0,ln.Z)(),{t:r,locale:s}=(0,k.PE)(),{roles:c}=(0,ke.DJ)(),[d,u]=(0,l.useState)(!0),{recommendedDomain:m}=(0,me.y0)(),h=i[0]||t,f="/".concat(i.map((e=>e.mountPoint||"/")).join("/"),"/").concat(t.mountPoint||"/").replace(/\/+/g,"/"),g=(0,oe.vH)({blocklet:h,domain:{value:m},mountPoint:f,params:(0,oe.f0)(h,s)}),x={fill:a.palette.text.secondary},v=o>0&&t.children.length>0,b=(0,X.jsx)(K.Z,{size:"small",children:d?(0,X.jsx)(j.Z,{fontSize:"inherit"}):(0,X.jsx)(Z.default,{fontSize:"inherit"})}),{access:y,roles:C}=Cn(t,h,{roles:c});let E;if("roles"!==y)E=vn.find((e=>e.value===y))||vn[2];else{const e=C.map((e=>e.title)).join("/");E={title:{zh:"\u53ea\u6709 ".concat(e," \u53ef\u4ee5\u8bbf\u95ee"),en:"Only ".concat(e," can access")}}}return[(o>0||"gateway"!==t.meta.group)&&(0,X.jsxs)(p.Z,{display:"flex",py:2,className:"component-item",justifyContent:"space-between",alignItems:"center",children:[(0,X.jsxs)(p.Z,{pl:Math.max(2*(o-1),0),width:{xs:300,md:400},display:"flex",alignItems:"center",style:{cursor:v?"pointer":"cursor"},onClick:()=>v&&u(!d),children:[v?b:(0,X.jsx)(p.Z,{width:28}),(0,X.jsx)(w.Z,{blocklet:t,ancestors:i}),(0,X.jsxs)(p.Z,{ml:"16px",children:[(0,X.jsx)(p.Z,{style:{color:"#222",fontSize:18},children:(0,S.getDisplayName)(t,!0)}),(0,X.jsx)(p.Z,{display:"flex",alignItems:"center",children:(0,X.jsx)(p.Z,{color:"text.secondary",children:E.title[s]})})]})]},t),(0,X.jsxs)(p.Z,{children:[(0,X.jsx)(an.Z,{title:r("common.visit"),children:(0,X.jsx)("a",{target:"_blank",href:g,rel:"noopener noreferrer",title:g,children:(0,X.jsx)(K.Z,{children:(0,X.jsx)(sn.Z,{})})})}),(0,X.jsx)(Sn,{blocklet:t,ancestors:i,children:e=>{let{open:n}=e;return(0,X.jsx)(an.Z,{title:r("common.edit"),children:(0,X.jsx)(K.Z,{onClick:n,"data-cy":"btn-edit-".concat(t.meta.did),children:(0,X.jsx)(cn.Z,{style:x})})})}})]},"actions")]},"group-not-gateway-box"),(0,X.jsx)(dn.Z,{depth:o},"line"),null!==(n=t.children)&&void 0!==n&&n.length?(0,X.jsx)(rn.Z,{in:d,children:t.children.map((e=>(0,X.jsx)(Pn,{blocklet:e,ancestors:[...i,t],depth:o+1},"".concat(o+1,"-").concat(e.meta.did))))},"blocklet-collapse"):null]}function Tn(){const{t:e}=(0,k.PE)(),{blocklet:n}=(0,me.y0)(),t=[...n.children]||[];return"gateway"!==n.meta.group&&t.unshift(n),(0,X.jsx)(On,{component:"div",children:t&&t.length?[(0,X.jsx)(p.Z,{mt:2,ml:{xs:"-12px",md:"-24px"},style:{maxWidth:1080},children:(0,X.jsx)(Pn,{blocklet:n},"0-".concat(n.meta.did))},"top-blocklet-".concat(n.meta.did))]:(0,X.jsx)(p.Z,{mt:8,children:(0,X.jsx)(Ie.Z,{children:e("blocklet.component.noComponent")})})})}Pn.propTypes={blocklet:s().object.isRequired,ancestors:s().array,depth:s().number},Pn.defaultProps={ancestors:[],depth:0},Tn.propTypes={};const On=(0,a.Z)(p.Z)(Ln||(Ln=(0,o.Z)(["\n .title {\n font-size: 1.2rem;\n font-weight: bold;\n margin-top: ",";\n margin-bottom: ",";\n &.first {\n margin-top: 0;\n }\n }\n"])),(e=>e.theme.spacing(5)),(e=>e.theme.spacing(3)));var Nn=t(36095),Rn=t(20877),_n=t(55498),An=t(21764),In=t(25125),Bn=t(13573),Dn=t(69210),Fn=t(56556),zn=t(44784);const Un={enabled:!1,domain:"",clientId:"",clientSecret:""};const Kn=function(){var e,n;const{api:t}=(0,ie.h6)(),{blocklet:i}=(0,me.y0)(),{t:o}=(0,k.PE)(),l=null===i||void 0===i||null===(e=i.meta)||void 0===e?void 0:e.did,a=Object.assign({...Un},(null===i||void 0===i||null===(n=i.settings)||void 0===n||null===(n=n.oauth)||void 0===n?void 0:n.auth0)||{}),{handleSubmit:r,control:s,formState:c,watch:d,reset:u}=(0,We.cI)({defaultValues:ze()(a,Object.keys(Un))}),m=d("enabled"),h=(0,Ke.Z)((async e=>{try{var n;const{blocklet:i}=await t.configOAuth({input:{did:l,oauth:JSON.stringify({auth0:e})}}),a=Object.assign({...Un},(null===i||void 0===i||null===(n=i.settings)||void 0===n||null===(n=n.oauth)||void 0===n?void 0:n.auth0)||{});u(a),B.Z.success(o("oauth.saveSuccess"))}catch(i){B.Z.error(i.message||o("oauth.saveFailed"))}})),f=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.auth0.domainDescription"))),g=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.auth0.clientIdDescription"))),x=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.auth0.clientSecretDescription"))),v=(0,Ke.Z)((()=>!0));return(0,X.jsx)(p.Z,{children:(0,X.jsxs)("form",{onSubmit:r(h),disabled:!0,children:[(0,X.jsx)(We.Qr,{name:"enabled",control:s,render:e=>{let{field:n}=e;return(0,X.jsx)(Ze.Z,{control:(0,X.jsx)(zn.Z,{checked:n.value,style:{marginRight:"6px"},...n}),label:o("oauth.auth0.enable"),sx:{marginBottom:2,ml:1}})}}),(0,X.jsx)(We.Qr,{name:"domain",control:s,rules:{validate:m?f:v},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,label:o("oauth.auth0.domain"),error:!!c.errors[t.name],helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(We.Qr,{name:"clientId",control:s,rules:{validate:m?g:v},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,error:!!c.errors[t.name],label:o("oauth.auth0.clientId"),helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(We.Qr,{name:"clientSecret",control:s,rules:{validate:m?x:v},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,type:"password",error:!!c.errors[t.name],label:o("oauth.auth0.clientSecret"),helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(Fn.Z,{type:"submit",variant:"contained",onSubmit:r(h),disabled:!c.isDirty,children:o("oauth.save")})]})})},Wn={enabled:!1,clientId:"",clientSecret:""};const qn=function(){var e,n;const{api:t}=(0,ie.h6)(),{blocklet:i}=(0,me.y0)(),{t:o}=(0,k.PE)(),l=null===i||void 0===i||null===(e=i.meta)||void 0===e?void 0:e.did,a=Object.assign({...Wn},(null===i||void 0===i||null===(n=i.settings)||void 0===n||null===(n=n.oauth)||void 0===n?void 0:n.github)||{}),{handleSubmit:r,control:s,formState:c,watch:d,reset:u}=(0,We.cI)({defaultValues:ze()(a,Object.keys(Wn))}),m=d("enabled"),h=(0,Ke.Z)((async e=>{try{var n;const{blocklet:i}=await t.configOAuth({input:{did:l,oauth:JSON.stringify({github:e})}}),a=Object.assign({...Wn},(null===i||void 0===i||null===(n=i.settings)||void 0===n||null===(n=n.oauth)||void 0===n?void 0:n.github)||{});u(a),B.Z.success(o("oauth.saveSuccess"))}catch(i){B.Z.error(i.message||o("oauth.saveFailed"))}})),f=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.github.clientIdDescription"))),g=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.github.clientSecretDescription"))),x=(0,Ke.Z)((()=>!0));return(0,X.jsx)(p.Z,{children:(0,X.jsxs)("form",{onSubmit:r(h),disabled:!0,children:[(0,X.jsx)(We.Qr,{name:"enabled",control:s,render:e=>{let{field:n}=e;return(0,X.jsx)(Ze.Z,{control:(0,X.jsx)(zn.Z,{checked:n.value,style:{marginRight:"6px"},...n}),label:o("oauth.github.enable"),sx:{marginBottom:2,ml:1}})}}),(0,X.jsx)(We.Qr,{name:"clientId",control:s,rules:{validate:m?f:x},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,error:!!c.errors[t.name],label:o("oauth.github.clientId"),helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(We.Qr,{name:"clientSecret",control:s,rules:{validate:m?g:x},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,type:"password",label:o("oauth.github.clientSecret"),error:!!c.errors[t.name],helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(Fn.Z,{type:"submit",variant:"contained",onSubmit:r(h),disabled:!c.isDirty,children:o("oauth.save")})]})})},Mn={enabled:!1,clientId:"",clientSecret:""};const Gn=function(){var e,n;const{api:t}=(0,ie.h6)(),{blocklet:i}=(0,me.y0)(),{t:o}=(0,k.PE)(),l=null===i||void 0===i||null===(e=i.meta)||void 0===e?void 0:e.did,a=Object.assign({...Mn},(null===i||void 0===i||null===(n=i.settings)||void 0===n||null===(n=n.oauth)||void 0===n?void 0:n.google)||{}),{handleSubmit:r,control:s,formState:c,watch:d,reset:u}=(0,We.cI)({defaultValues:ze()(a,Object.keys(Mn))}),m=d("enabled"),h=(0,Ke.Z)((async e=>{try{var n;const{blocklet:i}=await t.configOAuth({input:{did:l,oauth:JSON.stringify({google:e})}}),a=Object.assign({...Mn},(null===i||void 0===i||null===(n=i.settings)||void 0===n||null===(n=n.oauth)||void 0===n?void 0:n.google)||{});u(a),B.Z.success(o("oauth.saveSuccess"))}catch(i){B.Z.error(i.message||o("oauth.saveFailed"))}})),f=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.google.clientIdDescription"))),g=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.google.clientSecretDescription"))),x=(0,Ke.Z)((()=>!0));return(0,X.jsx)(p.Z,{children:(0,X.jsxs)("form",{onSubmit:r(h),disabled:!0,children:[(0,X.jsx)(We.Qr,{name:"enabled",control:s,render:e=>{let{field:n}=e;return(0,X.jsx)(Ze.Z,{control:(0,X.jsx)(zn.Z,{checked:n.value,style:{marginRight:"6px"},...n}),label:o("oauth.google.enable"),sx:{marginBottom:2,ml:1}})}}),(0,X.jsx)(We.Qr,{name:"clientId",control:s,rules:{validate:m?f:x},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,error:!!c.errors[t.name],label:o("oauth.google.clientId"),helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(We.Qr,{name:"clientSecret",control:s,rules:{validate:m?g:x},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,type:"password",label:o("oauth.google.clientSecret"),error:!!c.errors[t.name],helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(Fn.Z,{type:"submit",variant:"contained",onSubmit:r(h),disabled:!c.isDirty,children:o("oauth.save")})]})})},Vn={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};const Hn=function(){var e,n;const{api:t}=(0,ie.h6)(),{blocklet:i}=(0,me.y0)(),{t:o}=(0,k.PE)(),l=null===i||void 0===i||null===(e=i.meta)||void 0===e?void 0:e.did,a=Object.assign({...Vn},(null===i||void 0===i||null===(n=i.settings)||void 0===n||null===(n=n.oauth)||void 0===n?void 0:n.apple)||{}),{handleSubmit:r,control:s,formState:c,watch:d,reset:u}=(0,We.cI)({defaultValues:ze()(a,Object.keys(Vn))}),m=d("enabled"),h=(0,Ke.Z)((async e=>{try{var n;const{blocklet:i}=await t.configOAuth({input:{did:l,oauth:JSON.stringify({apple:e})}}),a=Object.assign({...Vn},(null===i||void 0===i||null===(n=i.settings)||void 0===n||null===(n=n.oauth)||void 0===n?void 0:n.apple)||{});u(a),B.Z.success(o("oauth.saveSuccess"))}catch(i){B.Z.error(i.message||o("oauth.saveFailed"))}})),f=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.apple.teamIdDescription"))),g=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.apple.serviceIdDescription"))),x=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.apple.keyIdDescription"))),v=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.apple.authKeyDescription"))),b=(0,Ke.Z)((e=>!(null===e||void 0===e||!e.trim())||o("oauth.apple.bundleIdDescription"))),Z=(0,Ke.Z)((()=>!0));return(0,X.jsx)(p.Z,{children:(0,X.jsxs)("form",{onSubmit:r(h),disabled:!0,children:[(0,X.jsx)(We.Qr,{name:"enabled",control:s,render:e=>{let{field:n}=e;return(0,X.jsx)(Ze.Z,{control:(0,X.jsx)(zn.Z,{checked:n.value,style:{marginRight:"6px"},...n}),label:o("oauth.apple.enable"),sx:{marginBottom:2,ml:1}})}}),(0,X.jsx)(We.Qr,{name:"teamId",control:s,rules:{validate:m?f:Z},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,error:!!c.errors[t.name],label:o("oauth.apple.teamId"),helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(We.Qr,{name:"bundleId",control:s,rules:{validate:m?b:Z},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,error:!!c.errors[t.name],label:o("oauth.apple.bundleId"),helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(We.Qr,{name:"serviceId",control:s,rules:{validate:m?g:Z},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,error:!!c.errors[t.name],label:o("oauth.apple.serviceId"),helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(We.Qr,{name:"keyId",control:s,rules:{validate:m?x:Z},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,error:!!c.errors[t.name],label:o("oauth.apple.keyId"),helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(We.Qr,{name:"authKey",control:s,rules:{validate:m?v:Z},render:e=>{var n;let{field:t}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,children:(0,X.jsx)(V.Z,{...t,type:"password",multiline:!0,rows:4,label:o("oauth.apple.authKey"),error:!!c.errors[t.name],helperText:(null===(n=c.errors[t.name])||void 0===n?void 0:n.message)||"\u3000",disabled:!m})})}}),(0,X.jsx)(Fn.Z,{type:"submit",variant:"contained",onSubmit:r(h),disabled:!c.isDirty,children:o("oauth.save")})]})})};var Yn=t(46711),Jn=t(2266),Qn=t(76223),Xn=t(34435),$n=t(6837);function et(e){let{title:n,id:t,children:i,index:o,onMove:a,defaultExpand:r,onEnd:s}=e;const[c,d]=(0,l.useState)(r),u=(0,l.useRef)(null),m=(0,l.useRef)(null),[{handlerId:h},f]=(0,Yn.L)({accept:"dragItem",collect:e=>({handlerId:e.getHandlerId()}),hover(e,n){var t,i;if(!u.current)return;const l=e.index,r=o;if(l===r)return;const s=null===(t=u.current)||void 0===t?void 0:t.getBoundingClientRect(),c=null===(i=m.current)||void 0===i?void 0:i.getBoundingClientRect(),d=(c.bottom-c.top)/2,p=n.getClientOffset().y-s.top;l<r&&p<d||l>r&&p>d||(a(l,r),e.index=r)}}),[{isDragging:g},x]=(0,Jn.c)({item:{index:o,type:"dragItem"},collect:e=>({isDragging:e.isDragging()}),end:s});x(m),f(u);const v=g?.5:1,b=(0,Ke.Z)((e=>{e.preventDefault(),e.stopPropagation(),d(!c)}));return(0,X.jsxs)(p.Z,{ref:u,sx:{borderBottom:"1px solid ".concat(Qn.E.lineBorderStrong)},children:[(0,X.jsx)(p.Z,{sx:{cursor:"pointer","&:hover":{backgroundColor:Qn.E.backgroundsBgSubtileHover},borderRadius:2},ref:m,"data-handler-id":h,children:(0,X.jsxs)(p.Z,{sx:{py:1.5,px:1,opacity:v,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:b,children:[(0,X.jsx)(p.Z,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:Qn.E.textMuted,"&:hover":{color:Qn.E.textSubtitle}},children:(0,X.jsx)(_n.JO,{fontSize:20,icon:Xn.Z})}),(0,X.jsx)(ve.Z,{sx:{flex:1},children:n}),(0,X.jsx)(K.Z,{size:"small",sx:{pointerEvents:"auto",transform:c?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:(0,X.jsx)(_n.JO,{icon:$n.Z,style:{transform:"scale(1.5)"}})})]})}),(0,X.jsx)(p.Z,{sx:{pl:4,py:1,display:c?"block":"none"},children:i})]})}et.propTypes={title:s().string.isRequired,id:s().string.isRequired,children:s().node.isRequired,index:s().number.isRequired,onMove:s().func.isRequired,onEnd:s().func.isRequired,defaultExpand:s().bool},et.defaultProps={defaultExpand:!0};const nt=[{name:"github",title:"GitHub",icon:(0,X.jsx)(_n.JO,{icon:In.Z}),component:(0,X.jsx)(qn,{})},{name:"google",title:"Google",icon:(0,X.jsx)(_n.JO,{icon:Bn.Z}),component:(0,X.jsx)(Gn,{})},{name:"apple",title:"Apple",icon:(0,X.jsx)(_n.JO,{icon:An.Z}),component:(0,X.jsx)(Hn,{})},{name:"auth0",title:"Auth0",icon:(0,X.jsx)(_n.JO,{icon:Dn.Z}),component:(0,X.jsx)(Kn,{})}],tt=["github","google","apple","auth0"];function it(){var e,n;const{api:t}=(0,ie.h6)(),{blocklet:i}=(0,me.y0)(),o=null===i||void 0===i||null===(e=i.meta)||void 0===e?void 0:e.did,l=(null===i||void 0===i||null===(n=i.settings)||void 0===n?void 0:n.oauth)||{},a=Object.keys(l).sort(((e,n)=>{var t,i,o;return void 0!==(null===(t=l[e])||void 0===t?void 0:t.order)&&void 0!==(null===(i=l[n])||void 0===i?void 0:i.order)?l[e].order-l[n].order:void 0!==(null===(o=l[e])||void 0===o?void 0:o.order)?-1:1}));for(const p of tt)a.includes(p)||a.push(p);const r=(0,Ue.Z)(a.reduce(((e,n,t)=>Object.assign(e,{[n]:t})),{})),s=(0,Be.Z)((()=>{const e=[...nt];return e.sort(((e,n)=>r[e.name]-r[n.name])),e}),[r.auth0,r.github,r.google]),c={};"undefined"!==typeof window&&(c.context=window);const d=(0,Ke.Z)((async e=>{const n={};Object.keys(e).forEach((t=>{n[t]={order:e[t]}})),await t.configOAuth({input:{did:o,oauth:JSON.stringify(n)}})})),u=(0,Ke.Z)(((e,n)=>{const t=s[e],i=s[n];r[t.name]=n,r[i.name]=e})),m=(0,Ke.Z)((async()=>{await d(r)}));return(0,X.jsx)(p.Z,{children:(0,X.jsx)(Nn.W,{backend:Rn.HTML5Backend,...c,children:s.map(((e,n)=>(0,X.jsx)(et,{index:n,id:e.name,title:e.title,icon:e.icon,onMove:u,onEnd:m,defaultExpand:e.enabled,children:e.component},e.name)))})})}var ot=t(62362),lt=t(24103);const at={ttl:m.SESSION_TTL};function rt(e){const n=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?86400*e.ttl:e.ttl/86400;return{...e,ttl:n}}function st(){var e,n;const{api:t}=(0,ie.h6)(),{blocklet:i}=(0,me.y0)(),o=null===i||void 0===i||null===(e=i.meta)||void 0===e?void 0:e.did,l=Object.assign({},at,(null===i||void 0===i||null===(n=i.settings)||void 0===n?void 0:n.session)||{}),{handleSubmit:a,control:r,formState:s,reset:c}=(0,We.cI)({defaultValues:ze()(rt(l),["ttl"])}),{t:d}=(0,k.PE)(),u=(0,Ke.Z)((async e=>{try{var n;const{blocklet:i}=await t.updateAppSessionConfig({input:{did:o,config:rt(e,!0)}}),l=Object.assign({},at,ze()((null===i||void 0===i||null===(n=i.settings)||void 0===n?void 0:n.session)||{},["ttl"]));c(rt(l)),B.Z.success(d("common.configSuccess"))}catch(i){B.Z.error(i.message)}}));return(0,X.jsx)(p.Z,{children:(0,X.jsxs)("form",{onSubmit:a(u),disabled:!0,children:[(0,X.jsx)(We.Qr,{name:"ttl",control:r,render:e=>{let{field:n}=e;return(0,X.jsx)(De.Z,{fullWidth:!0,sx:{mb:2},children:(0,X.jsxs)(lt.Z,{px:3,children:[(0,X.jsx)(p.Z,{mx:-3,my:.5,children:d("blocklet.config.session.ttl",{day:n.value})}),(0,X.jsx)(ot.ZP,{...n,defaultValue:7,step:1,marks:[{value:1,label:d("blocklet.config.session.day",{day:1})},{value:7,label:d("blocklet.config.session.days",{day:7})},{value:14,label:d("blocklet.config.session.days",{day:14})},{value:21,label:d("blocklet.config.session.days",{day:21})},{value:30,label:d("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto",style:{maxWidth:"360px"}})]})})}}),(0,X.jsx)(Fn.Z,{type:"submit",variant:"contained",onSubmit:a(u),disabled:!s.isDirty,children:d("oauth.save")})]})})}var ct=t(82555),dt=t(30333),ut=t(75760),mt=t(97038),pt=t(64886),ht=t(42080),ft=t.n(ht),gt=t(75506),xt=t.n(gt),vt=t(47685),bt=t(13260),Zt=t(82434),jt=t.n(Zt);const yt=(0,l.forwardRef)(((e,n)=>{var t;const{t:i}=(0,l.useContext)(k.RD),{blocklet:o}=(0,me.y0)(),{api:a}=(0,ie.h6)(),r=(0,Ue.Z)({mode:"view",show:!1,data:{},callback:Qe()}),s=(0,vt.Fg)(),c=(null===s||void 0===s||null===(t=s.transitions)||void 0===t||null===(t=t.duration)||void 0===t?void 0:t.leavingScreen)||300,d=(0,Ke.Z)((()=>{r.mode="view",r.data={},r.callback=Qe()}),[]),m=(0,Ke.Z)((()=>{r.show=!1,setTimeout((()=>{d()}),c)}),[]),h=(0,Ke.Z)((e=>{r.mode="view",r.show=!0,r.data=e}),[]),f=(0,Ke.Z)((function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Qe();r.mode="approve",r.show=!0,r.data=e,r.callback=n}),[]);(0,l.useImperativeHandle)(n,(()=>({open:h,close:m,approve:f})),[h,m,f]);const g=(0,Be.Z)((()=>{if(!r.show)return[];r.data.migratedFrom=[r.data.appId,r.data.appPid];const e=["appName","appLogo","appId","appPid","migratedFrom","appDescription","appUrl","version","appliedAt","status","serverId","serverVersion"];return!1!==r.data.isMaster&&ft()(e,"appliedAt","status"),e.map((e=>{const n=i("federated.info.".concat(e));let t=r.data[e];if("appName"===e&&r.data.isMaster&&(t=(0,X.jsxs)(p.Z,{children:[(0,X.jsx)(ct.Z,{component:dt.Z}),t]})),["appId","appPid","serverId"].includes(e)&&(t=(0,X.jsx)(bt.kL,{children:t})),["appUrl"].includes(e)&&(t=(0,X.jsx)(p.Z,{component:"a",href:t,target:"_blank",children:t})),["appLogo"].includes(e)){const e=jt()(t)?t:u()(r.data.appUrl||"",t||"");try{const n=new URL(e);n.searchParams.set("imageFilter","resize"),n.searchParams.set("w","80"),n.searchParams.set("h","80"),t=(0,X.jsx)("img",{src:n.href,width:"60",height:"60",alt:r.data.appName})}catch{t=(0,X.jsx)("img",{src:e,width:"60",height:"60",alt:r.data.appName})}}if("status"===e&&(t=t&&i("federated.status.".concat(t))),"migratedFrom"===e){t=(r.data.migratedFrom||[]).filter((e=>![r.data.appId,r.data.appPid].includes(e))).map((e=>(0,X.jsx)(bt.kL,{children:e})))}return xt()(t)&&(t="-"),{name:n,value:t}}))}),[r.data]),x="approve"===r.mode,v=(0,Ke.Z)((async()=>{await a.auditFederatedLogin({input:{memberPid:r.data.appPid,did:o.appPid,status:"rejected"}}),m(),null===r||void 0===r||r.callback(!1)})),b=(0,Ke.Z)((async()=>{await a.auditFederatedLogin({input:{memberPid:r.data.appPid,did:o.appPid,status:"approved"}}),m(),null===r||void 0===r||r.callback(!0)}));return(0,X.jsx)(ge.ZP,{open:r.show,title:i(x?"federated.approveToJoinLogin":"federated.siteDetail"),onClose:m,actions:x?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Fn.Z,{color:"error",variant:"contained",onClick:v,children:i("common.reject")}),(0,X.jsx)(Fn.Z,{variant:"contained",onClick:b,children:i("common.approve")})]}):(0,X.jsx)(Fn.Z,{variant:"outlined",onClick:m,children:i("common.close")}),children:g.map((e=>(0,X.jsx)(pt.Z,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:180,name:e.name,children:e.value},e.name)))})}));var kt=t(79842),Ct=t(85408),St=t.n(Ct);const wt=(0,l.forwardRef)(((e,n)=>{var t;const i=(0,vt.Fg)(),o=(null===i||void 0===i||null===(t=i.transitions)||void 0===t||null===(t=t.duration)||void 0===t?void 0:t.leavingScreen)||300,{t:a}=(0,l.useContext)(k.RD),r=(0,Ue.Z)({show:!1,data:{link:""}}),s=(0,Ke.Z)((()=>{r.data.link=""}),[]),c=(0,Ke.Z)((()=>{r.show=!1,setTimeout((()=>{s()}),o)}),[]),d=(0,Ke.Z)((e=>{let{link:n}=e;r.show=!0,r.data.link=n}),[]);(0,l.useImperativeHandle)(n,(()=>({open:d,close:c})),[d,c]);const u=(0,Ke.Z)((()=>{St()(r.data.link),c()}),[c]);return(0,X.jsxs)(ge.ZP,{open:r.show,title:a("federated.joinFederatedLogin"),onClose:c,PaperProps:{style:{minHeight:"unset"}},actions:(0,X.jsx)(_.Z,{color:"primary",autoFocus:!0,variant:"contained",onClick:u,children:a("common.copyAndClose")}),children:[(0,X.jsx)(p.Z,{mb:1,children:a("federated.inviteJoinFederatedLoginDescription")}),(0,X.jsx)(p.Z,{sx:{"& .copy-button":{display:"none !important"}},children:(0,X.jsx)(kt.Z,{language:"shell",style:{marginBottom:0},children:r.data.link})})]})}));function Et(e){var n,t,i;let{mode:o}=e;const a=(0,l.useRef)(null),r=(0,l.useRef)(null),{t:s,locale:c}=(0,l.useContext)(k.RD),{blocklet:d,actions:{refreshBlocklet:u}}=(0,me.y0)(),{confirmApi:m,confirmHolder:h}=$e(),{api:f}=(0,ie.h6)(),g=(null===(n=d.settings.federated)||void 0===n?void 0:n.sites)||[],x=(null===(t=d.settings.federated)||void 0===t?void 0:t.config)||{},v=!1!==x.isMaster,b=(0,Ke.Z)((e=>{var n;null===(n=r.current)||void 0===n||n.open(e)})),Z=(0,Ke.Z)((e=>{var n;null===(n=r.current)||void 0===n||n.approve(e,u)})),j=(0,Ke.Z)((e=>{m.open({title:s("federated.disableFederatedLogin"),content:s("federated.disableFederatedLoginDescription"),async onConfirm(n){await f.auditFederatedLogin({input:{memberPid:e.appPid,did:d.appPid,status:"revoked"}}),n()}})})),y=(0,Ke.Z)((e=>{m.open({title:s("federated.enableFederatedLogin"),content:s("federated.enableFederatedLoginDescription"),async onConfirm(n){await f.auditFederatedLogin({input:{memberPid:e.appPid,did:d.appPid,status:"approved"}}),n()}})})),C=(0,Be.Z)((()=>{const e=[{label:s("common.name"),name:"appName",options:{customBodyRenderLite:e=>{const n=g[e],t=!1!==n.isMaster;return(0,X.jsx)(p.Z,{display:"inline-block",children:(0,X.jsxs)(p.Z,{component:"a",display:"flex",alignItems:"center",href:n.appUrl,target:"_blank",onClick:e=>{e.stopPropagation()},children:[t&&(0,X.jsx)(ct.Z,{component:dt.Z,style:{marginRight:"4px"}}),n.appName]})})}}},{label:s("common.did"),name:"appId",options:{customBodyRenderLite:e=>{const n=g[e];return(0,X.jsx)(mt.Z,{children:n.appId})}}},{label:s("common.status"),name:"status",options:{customBodyRenderLite:e=>{const n=g[e],t=!1!==n.isMaster;return(0,X.jsx)(p.Z,{children:t?"-":s("federated.status.".concat(n.status))})}}}];return v&&e.push({label:s("common.actions"),name:"actions",options:{customBodyRenderLite:e=>{const n=g[e],t=!1!==n.isMaster;return(0,X.jsx)(p.Z,{display:"flex",gap:1,children:t?(0,X.jsxs)(X.Fragment,{children:["rejected"===n.status&&(0,X.jsx)(_.Z,{variant:"contained",color:"error",size:"small",onClick:e=>{e.stopPropagation()},children:s("federated.status.rejected")}),"revoked"===n.status&&(0,X.jsx)(_.Z,{variant:"contained",color:"secondary",size:"small",onClick:e=>{e.stopPropagation()},children:s("federated.status.revoked")})]}):(0,X.jsxs)(X.Fragment,{children:["pending"===n.status&&(0,X.jsx)(_.Z,{variant:"contained",color:"primary",size:"small",onClick:e=>{e.stopPropagation(),Z(n)},children:s("federated.status.pending")}),"approved"===n.status&&(0,X.jsx)(_.Z,{variant:"contained",color:"error",size:"small",onClick:e=>{e.stopPropagation(),j(n)},style:{whiteSpace:"nowrap"},children:s("federated.revoke")}),"revoked"===n.status&&(0,X.jsx)(_.Z,{variant:"contained",color:"warning",size:"small",onClick:e=>{e.stopPropagation(),y(n)},style:{whiteSpace:"nowrap"},children:s("federated.approve")})]})})}}}),e}),[x.appId,g,v,s]),S=(0,Be.Z)((()=>({sort:!0,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick(e,n){let{dataIndex:t}=n;const i=g[t];b(i)}})),[]),w=(0,Ke.Z)((()=>{const e=d.environments.find((e=>e.key===I.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL));var n;null!==e&&void 0!==e&&e.value?null===(n=a.current)||void 0===n||n.open({link:e.value}):B.Z.error(s("federated.failedToGetFederatedLoginLink"))}),[null===(i=d.site)||void 0===i||null===(i=i.domainAliases)||void 0===i||null===(i=i[0])||void 0===i?void 0:i.href]),E=(0,Ke.Z)((()=>{m.open({title:s("federated.quitFederatedLogin"),content:s("federated.quitFederatedLoginDescription"),async onConfirm(e){await f.quitFederatedLogin({input:{did:d.appPid}}),e()}})})),L=(0,Ke.Z)((()=>{m.open({title:s("federated.disbandFederatedLogin"),content:s("federated.disbandFederatedLoginDescription"),async onConfirm(e){await f.disbandFederatedLogin({input:{did:d.appPid}}),e()}})})),P=[];return"master"!==o?P.push((0,X.jsx)(_.Z,{size:"small",variant:"contained",color:"error",onClick:E,sx:{ml:1},children:s("federated.quitFederatedLogin")},"quitFederatedLogin")):(P.push((0,X.jsx)(_.Z,{size:"small",variant:"contained",onClick:w,sx:{ml:1},children:s("federated.inviteJoinFederatedLogin")},"inviteJoinFederatedLogin")),P.push((0,X.jsx)(_.Z,{color:"error",size:"small",variant:"contained",onClick:L,sx:{ml:1},children:s("federated.disbandFederatedLogin")},"disbandFederatedLogin"))),(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ut.Z,{className:"main-table",locale:c,data:g,columns:C,customButtons:P,title:(0,X.jsx)(p.Z,{className:"table-toolbar-left",children:s("oauth.federated")}),options:S}),h,(0,X.jsx)(wt,{ref:a}),(0,X.jsx)(yt,{ref:r})]})}Et.propTypes={mode:s().oneOf(["member","master"])},Et.defaultProps={mode:"member"};const Lt=Et,Pt=(0,l.forwardRef)(((e,n)=>{var t;const{t:i}=(0,l.useContext)(k.RD),{api:o}=(0,ie.h6)(),{blocklet:a}=(0,me.y0)(),r=null===a||void 0===a?void 0:a.appPid,s=(0,vt.Fg)(),c=(null===s||void 0===s||null===(t=s.transitions)||void 0===t||null===(t=t.duration)||void 0===t?void 0:t.leavingScreen)||300,d=(0,Ue.Z)({show:!1,appUrl:"",appUrlError:"",callback:Qe()}),u=(0,Ke.Z)((()=>{d.appUrl="",d.appUrlError="",d.callback=Qe()}),[]),m=(0,Ke.Z)((()=>{d.show=!1,setTimeout((()=>{u()}),c)}),[]),h=(0,Ke.Z)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Qe();d.show=!0,d.callback=e}),[]);(0,l.useImperativeHandle)(n,(()=>({open:h,close:m})),[h,m]);const f=(0,Ke.Z)((e=>{if(!e)throw new Error(i("federated.federatedJoinAppUrlRequired"));if(!jt()(e))throw new Error(i("federated.federatedJoinAppUrlInvalid"))})),g=(0,Ke.Z)((async()=>{try{f(d.appUrl);const e=await o.joinFederatedLogin({input:{did:r,appUrl:d.appUrl}});d.show=!1,m(),null===d||void 0===d||d.callback(e)}catch(e){d.appUrlError=e.message}}),[m,r]);return(0,X.jsxs)(ge.ZP,{open:d.show,title:i("federated.joinFederatedLogin"),onClose:m,PaperProps:{style:{minHeight:"unset"}},actions:(0,X.jsx)(_.Z,{color:"primary",autoFocus:!0,variant:"contained",onClick:g,children:i("common.confirm")}),children:[(0,X.jsx)(p.Z,{mb:1,children:i("federated.joinFederatedLoginDescription")}),(0,X.jsx)(V.Z,{fullWidth:!0,variant:"outlined",margin:"dense",placeholder:i("federated.federatedJoinAppUrl"),label:i("federated.federatedJoinAppUrl"),value:d.appUrl,error:!!d.appUrlError,helperText:d.appUrlError||"eg: https://www.arcblock.io",onChange:e=>{d.appUrl=e.target.value}})]})}));function Tt(){var e,n;const t=(0,l.useRef)(null),i=(0,l.useRef)(null),{t:o}=(0,l.useContext)(k.RD),{blocklet:a,actions:{refreshBlocklet:r}}=(0,me.y0)(),s=(0,Ke.Z)((()=>{var e;const n=null===(e=a.site)||void 0===e||null===(e=e.domainAliases)||void 0===e||null===(e=e[0])||void 0===e?void 0:e.href;if(n)try{var i;const e=new URL(n);null===(i=t.current)||void 0===i||i.open({link:e.origin})}catch{B.Z.error(o("federated.failedToGetFederatedLoginLink"))}}),[null===(e=a.site)||void 0===e||null===(e=e.domainAliases)||void 0===e||null===(e=e[0])||void 0===e?void 0:e.href]),c=(0,Ke.Z)((()=>{var e;null===(e=i.current)||void 0===e||e.open((()=>{r()}))}),[r]);if((null===(n=a.settings.federated)||void 0===n?void 0:n.sites.length)>0){var d;const e=!1!==(null===(d=a.settings.federated)||void 0===d?void 0:d.config.isMaster);return(0,X.jsx)(Lt,{mode:e?"master":"member"})}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(p.Z,{display:"flex",flexDirection:"column",gap:2,justifyContent:"center",alignItems:"center",minHeight:"200px",children:[(0,X.jsx)(_.Z,{variant:"contained",onClick:s,children:o("federated.inviteJoinFederatedLogin")}),(0,X.jsx)(R.Z,{sx:{width:"150px",color:"rgba(0, 0, 0, 0.3)"},children:"OR"}),(0,X.jsx)(_.Z,{variant:"outlined",onClick:c,children:o("federated.joinFederatedLogin")})]}),(0,X.jsx)(wt,{ref:t}),(0,X.jsx)(Pt,{ref:i})]})}const Ot=function(){const{t:e}=(0,l.useContext)(k.RD),n=[{label:(0,X.jsx)(p.Z,{textAlign:"center",width:"100%",children:e("oauth.commonSettings")}),value:"settings"},{label:(0,X.jsx)(p.Z,{textAlign:"center",width:"100%",children:e("oauth.federated")}),value:"federated"},{label:(0,X.jsx)(p.Z,{textAlign:"center",width:"100%",children:e("oauth.oauth")}),value:"oauth"},{label:(0,X.jsx)(p.Z,{textAlign:"center",width:"100%",children:e("oauth.moreLogin")}),value:"more"}],[t,i]=(0,l.useState)(n[0].value),o=(0,Be.Z)((()=>({oauth:(0,X.jsx)(it,{}),federated:(0,X.jsx)(Tt,{}),more:(0,X.jsx)(p.Z,{children:(0,X.jsx)(Ie.Z,{children:e("oauth.comingSoon")})}),settings:(0,X.jsx)(p.Z,{children:(0,X.jsx)(st,{})})})),[e]);return(0,X.jsxs)(p.Z,{children:[(0,X.jsx)(C.Z,{tabs:n,current:t,onChange:i}),(0,X.jsx)(p.Z,{marginTop:"10px",children:o[t]})]})};var Nt;const Rt=e=>{let{tabs:n,blocklet:t,ancestors:i=[],depth:o=1,t:l}=e;const a=[...i.map((e=>e.meta.did)),t.meta.did].join("/"),r=!(null!==i&&void 0!==i&&i.length);n.push({label:(0,X.jsxs)(p.Z,{pl:2*Math.max(1,o-1),display:"flex",alignItems:"center",justifyContent:"flex-start",children:[r?(0,X.jsx)(E.Z,{size:24,blocklet:t}):(0,X.jsx)(w.Z,{size:24,blocklet:t,ancestors:i}),(0,X.jsx)(p.Z,{ml:"16px",children:(0,X.jsx)(p.Z,{style:{color:"#222"},children:r?l("blocklet.component.container"):(0,S.getDisplayName)(t,!0)})})]},a),value:a}),t.children.length>0&&t.children.forEach((e=>{Rt({tabs:n,blocklet:e,ancestors:[...i,t],depth:o+1,t:l})}))};function _t(e){let{blocklet:n,onUpdate:t,...i}=e;const{t:o}=(0,l.useContext)(k.RD),{info:a,inService:r}=(0,ie.h6)(),[s,d]=(0,l.useState)(!0),[S,w]=(0,y.useSearchParams)(),E=S.get("tab")||"general",L=[{label:(0,X.jsxs)(p.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-general",children:[(0,X.jsx)(f.Z,{sx:{fontSize:24}}),(0,X.jsx)(p.Z,{ml:"16px",children:(0,X.jsx)(p.Z,{style:{color:"#222"},children:o("common.general")})})]},"general"),value:"general"},{label:(0,X.jsxs)(p.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-access",children:[(0,X.jsx)(g.Z,{sx:{fontSize:24}}),(0,X.jsx)(p.Z,{ml:"16px",children:(0,X.jsx)(p.Z,{style:{color:"#222"},children:o("common.access")})})]},"access"),value:"access"},{label:(0,X.jsxs)(p.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-authentication",children:[(0,X.jsx)(x.Z,{sx:{fontSize:24}}),(0,X.jsx)(p.Z,{ml:"16px",children:(0,X.jsx)(p.Z,{style:{color:"#222"},children:o("common.login")})})]},"authentication"),value:"authentication"},{label:(0,X.jsxs)(p.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-notification",children:[(0,X.jsx)(v.Z,{sx:{fontSize:24}}),(0,X.jsx)(p.Z,{ml:"16px",children:(0,X.jsx)(p.Z,{style:{color:"#222"},children:o("common.notification")})})]},"notification"),value:"notification"},{label:(0,X.jsxs)(p.Z,{display:"flex",alignItems:"center","data-cy":"configuration-tab-preference",children:[(0,X.jsx)(p.Z,{ml:-2,style:{transform:"translateY(2px)"},children:s?(0,X.jsx)(j.Z,{fontSize:"inherit"}):(0,X.jsx)(Z.default,{fontSize:"inherit"})}),(0,X.jsx)(b.Z,{sx:{fontSize:24}}),(0,X.jsx)(p.Z,{ml:"16px",children:(0,X.jsx)(p.Z,{style:{color:"#222"},children:o("common.preferences")})})]},"preference"),value:"preference"}];s&&Rt({tabs:L,blocklet:n,t:o});let P=null;if("general"===E)P=(0,X.jsx)(_e,{blocklet:n,onUpdate:t});else if("access"===E)P=(0,X.jsx)(Tn,{});else if("authentication"===E)P=(0,X.jsx)(Ot,{});else if("notification"===E)P=(0,X.jsx)(on,{});else{const e=r?m.WELLKNOWN_SERVICE_PATH_PREFIX:a.routing.adminPath,n=new URLSearchParams;r||n.set("authKey","__sst"),n.set("schemaKey",u()(window.location.origin,e,"/api/preferences?id=".concat(encodeURIComponent(E)))),P=(0,X.jsx)(c.Z,{url:"".concat(u()(window.location.origin,e,"/hosted/form-collector/"),"?").concat(n.toString()),width:"100%",height:"100%",frameBorder:0,styles:{border:0}})}return(0,X.jsx)(At,{...i,children:(0,X.jsxs)(h.ZP,{container:!0,spacing:4,columns:24,children:[(0,X.jsx)(h.ZP,{item:!0,sm:7,md:5,children:(0,X.jsx)(C.Z,{tabs:L,current:E,orientation:"vertical",onChange:e=>{"preference"===e?d(!s):w((n=>("general"===e?n.delete("tab"):n.set("tab",e),n)))},sx:{borderRight:1,height:"100%",borderColor:"divider"}})}),(0,X.jsx)(h.ZP,{item:!0,sm:17,md:19,children:(0,X.jsx)(p.Z,{style:{minHeight:"66vh",height:"100%",position:"relative",overflow:"hidden"},children:P})})]})})}_t.propTypes={blocklet:s().object.isRequired,onUpdate:s().func},_t.defaultProps={onUpdate:()=>{}};const At=a.Z.div(Nt||(Nt=(0,o.Z)(["\n .MuiTab-root {\n text-align: left;\n align-items: flex-start;\n font-weight: normal;\n }\n .Mui-selected {\n font-weight: bold;\n }\n"])))},78410:(e,n,t)=>{t.d(n,{Z:()=>m});var i=t(5057),o=t(86229),l=t(28726),a=t(44846),r=t(68420),s=t(46090),c=t(58238),d=t(70461),u=t(96266);function m(e){let{teamDid:n,size:t="small",...m}=e;const{t:p}=(0,r.PE)(),{api:h}=(0,c.h6)(),[f,g]=(0,i.useState)(!1),[x,v]=(0,i.useState)(null),b={title:p("blocklet.config.clearCache.title"),description:p("blocklet.config.clearCache.description"),confirm:p("common.confirm"),cancel:p("common.cancel"),onConfirm:async()=>{try{var e;g(!0);const t=await h.clearCache({input:{teamDid:n}});o.Z.success(p("blocklet.config.clearCache.success",{count:(null===(e=t.removed)||void 0===e?void 0:e.length)||0}))}catch(t){o.Z.error((0,s.Z)(t))}finally{g(!1),v(null)}},onCancel:()=>{g(!1),v(null)}};return(0,u.jsxs)("div",{...m,children:[(0,u.jsxs)(l.Z,{onClick:()=>v(b),color:"error",variant:"outlined",size:t,children:[f?(0,u.jsx)(a.Z,{size:16,style:{marginRight:5}}):null,p("blocklet.config.clearCache.action")]}),x&&(0,u.jsx)(d.Z,{title:x.title,description:x.description,confirm:x.confirm,cancel:x.cancel,onConfirm:x.onConfirm,onCancel:x.onCancel})]})}},50185:(e,n,t)=>{t.d(n,{Z:()=>c});var i=t(5057),o=t(55898),l=t.n(o),a=t(12937),r=t(68420),s=t(96266);function c(e){let{children:n,...t}=e;const{t:o}=(0,i.useContext)(r.RD);return(0,s.jsx)(a.Z,{tip:o("common.copyTip"),copiedTip:o("common.copiedTip"),...t,children:n})}c.propTypes={children:l().any.isRequired}},28641:(e,n,t)=>{t.d(n,{Z:()=>x});var i=t(5057),o=t(55898),l=t.n(o),a=t(39948),r=t(47020),s=t(44846),c=t(13727),d=t(56184),u=t(67680),m=t(35406),p=t(11875),h=t(95890),f=t(96266);const g=(e,n,t)=>null===e&&n&&t?"******":e?n?"******":e:"";function x(e){let{label:n,disabled:t,required:o,initialValue:l,onChange:x,placeholder:v,style:b,onSubmit:Z,secure:j,triggers:y,formatterBeforeSubmit:k,...C}=e;const[S,w]=(0,i.useState)(!1),[E,L]=(0,i.useState)(!1),[P,T]=(0,i.useState)(j&&"__encrypted__"===l?null:l),[O,N]=(0,i.useState)(P),R=async()=>{L(!0);try{if(!1===await Z(O))N(P);else{let e=O;"function"===typeof k&&(e=k(O)),N(e),T(e)}}catch(e){N(P)}finally{L(!1),w(!1)}},_=S?(0,f.jsx)(r.Z,{style:{flex:1},fullWidth:!0,value:O,onChange:e=>{var n;n=e.target.value,N(n),x(n)},autoFocus:!0,size:"small",variant:"outlined",placeholder:v,onKeyDown:e=>{"Enter"===e.key&&R()},disabled:t,type:j?"password":"text",...C}):(0,f.jsx)(a.Z,{px:1,className:"form-item-input slot",style:{whiteSpace:"pre-wrap"},children:g(O,j,l)});return(0,f.jsx)(p.Z,{className:"form",style:b,children:(0,f.jsxs)(a.Z,{className:"form-item",children:[(0,f.jsxs)(a.Z,{className:"form-item-label",children:[n,o&&(0,f.jsx)(m.Z,{})]}),(0,f.jsxs)(a.Z,{className:"form-item-body",children:[(0,f.jsx)(a.Z,{className:"form-item-input",children:_}),(0,f.jsx)(a.Z,{className:"form-item-action",children:S?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(u.Z,{"data-cy":"schema-form-item-confirm",onClick:R,disabled:t||E,size:"large",children:E?(0,f.jsx)(s.Z,{size:24}):(0,f.jsx)(d.Z,{})}),(0,f.jsx)(u.Z,{"data-cy":"schema-form-item-cancel",onClick:()=>{N(P),w(!1)},disabled:t||E,size:"large",children:(0,f.jsx)(c.default,{})})]}):(0,f.jsx)(h.Z,{triggers:y,onEnterEdit:()=>w(!0),disabled:t})})]})]})})}x.propTypes={style:l().object,onSubmit:l().func,onChange:l().func,label:l().string,initialValue:l().string,placeholder:l().string,required:l().bool,disabled:l().bool,secure:l().bool,triggers:l().array,formatterBeforeSubmit:l().func},x.defaultProps={style:{},onSubmit:()=>{},onChange:()=>{},label:"",initialValue:"",placeholder:"",required:!1,disabled:!1,secure:!1,triggers:[],formatterBeforeSubmit:null}},11875:(e,n,t)=>{t.d(n,{Z:()=>r});var i,o=t(71171),l=t(33518),a=t(39948);const r=(0,l.Z)(a.Z)(i||(i=(0,o.Z)(["\n width: 100%;\n flex-grow: 1;\n overflow-y: auto;\n "," {\n width: 100%;\n flex-shrink: 0;\n padding: 0 24px;\n transform: translate(0, 0);\n /* max-height: 60vh; */\n }\n\n .form-item {\n width: 100%;\n margin-bottom: 24px;\n position: relative;\n "," {\n flex-wrap: wrap;\n justify-content: space-between;\n width: 100%;\n flex-shrink: 0;\n }\n }\n\n .form-item-body {\n display: flex;\n align-items: center;\n width: 100%;\n margin-top: 4px;\n }\n\n .form-item-label {\n line-height: 1.2;\n font-size: 14px;\n color: #888;\n font-weight: bold;\n\n "," {\n text-align: left;\n width: auto;\n flex-grow: 1;\n }\n }\n\n .form-item-input {\n flex-grow: 1;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n\n &.slot {\n height: 40px;\n line-height: 40px;\n background: #f8f8f8;\n font-size: 16px;\n\n .MuiChip-root {\n margin-top: -4px;\n }\n }\n\n .MuiSelect-select {\n padding: 8px;\n }\n }\n\n .form-item-action {\n // width: 100px;\n text-align: left;\n margin-left: 12px;\n flex-shrink: 0;\n "," {\n width: auto;\n margin-left: 0px;\n }\n .MuiIconButton-root {\n padding: 8px;\n svg {\n fill: #888;\n }\n &.Mui-disabled {\n opacity: 0.4;\n }\n }\n }\n"])),(e=>e.theme.breakpoints.down("md")),(e=>e.theme.breakpoints.down("md")),(e=>e.theme.breakpoints.down("md")),(e=>e.theme.breakpoints.down("md")))},95890:(e,n,t)=>{t.d(n,{Z:()=>x});var i=t(5057),o=t(55898),l=t.n(o),a=t(24558),r=t(67680),s=t(56556),c=t(80633),d=t(49390),u=t(72113),m=t(25228),p=t(49020),h=t(74490),f=t(1733),g=t(96266);function x(e){let{triggers:n,onEnterEdit:t,disabled:o}=e;const l=i.useRef(null),[x,v]=i.useState(!1);return 0===n.length?(0,g.jsx)(r.Z,{"data-cy":"schema-form-item-edit",onClick:t,disabled:o,size:"large",children:(0,g.jsx)(a.Z,{})}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(c.Z,{variant:"outlined",ref:l,"aria-label":"split button",children:[(0,g.jsx)(s.Z,{"data-cy":"schema-form-item-edit",onClick:t,disabled:o,size:"large",children:(0,g.jsx)(a.Z,{})}),(0,g.jsx)(s.Z,{size:"small","aria-controls":x?"split-button-menu":void 0,"aria-expanded":x?"true":void 0,onClick:()=>{v((e=>!e))},children:(0,g.jsx)(d.Z,{})})]}),(0,g.jsx)(p.Z,{sx:{zIndex:9999},open:x,anchorEl:l.current,role:void 0,placement:"bottom-end",children:(0,g.jsx)(m.Z,{children:(0,g.jsx)(u.d,{onClickAway:e=>{l.current&&l.current.contains(e.target)||v(!1)},children:(0,g.jsx)(f.Z,{id:"split-button-menu",autoFocusItem:!0,children:n.map((e=>(0,g.jsx)(h.Z,{onClick:()=>{return n=e.handler,v(!1),void n();var n},children:e.title},e.key)))})})})})]})}x.propTypes={triggers:l().arrayOf(l().shape({key:l().string.isRequired,title:l().string.isRequired,handler:l().func.isRequired})),onEnterEdit:l().func.isRequired,disabled:l().bool.isRequired},x.defaultProps={triggers:[]}},35406:(e,n,t)=>{t.d(n,{Z:()=>l});var i,o=t(71171);const l=t(33518).Z.span(i||(i=(0,o.Z)(["\n color: ",";\n &::before {\n content: '*';\n }\n"])),(e=>e.theme.palette.error.main))},54063:(e,n,t)=>{t.d(n,{C:()=>i});const i="true"===localStorage.getItem("enableDebug")}}]);
|