@nocobase/plugin-auth 3.0.0-alpha.4 → 3.0.0-alpha.5
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/dist/client-v2/795.8e4b138118e322ab.js +10 -0
- package/dist/client-v2/841.9fafcb7049bfe687.js +10 -0
- package/dist/client-v2/authRoutePaths.d.ts +1 -1
- package/dist/client-v2/index.js +1 -1
- package/dist/client-v2/plugin.d.ts +10 -0
- package/dist/externalVersion.js +11 -11
- package/dist/node_modules/cron/package.json +1 -1
- package/dist/node_modules/ms/package.json +1 -1
- package/package.json +2 -2
- package/dist/client-v2/795.7100439b59804662.js +0 -10
- package/dist/client-v2/841.7a31cfa7c5c79d2d.js +0 -10
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_auth_client_v2=self.webpackChunk_nocobase_plugin_auth_client_v2||[]).push([["795"],{918:function(e,t,r){r.r(t),r.d(t,{default:function(){return d}});var n=r(59),a=r(485),o=r(155),l=r.n(o),u=r(442),s=r(488),i=r(824),c=r(927),m=r(434);function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function f(e,t,r,n,a,o,l){try{var u=e[o](l),s=u.value}catch(e){r(e);return}u.done?t(s):Promise.resolve(s).then(n,a)}function h(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],l=!0,u=!1;try{for(a=a.call(e);!(l=(r=a.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(e){u=!0,n=e}finally{try{l||null==a.return||a.return()}finally{if(u)throw n}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return p(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e){var t,r,p=e.authenticator,d=(0,a.useApp)(),y=(0,a.usePlugin)(m.A),v=(0,u.useLocation)(),b=(0,s.dE)().t,g=h(n.Form.useForm(),1)[0],w=h((0,o.useState)(""),2),P=w[0],S=w[1],E=h((0,o.useState)(!1),2),k=E[0],A=E[1],I=(0,i.go)(p.name),_=!!(null==p||null==(t=p.options)?void 0:t.allowSignUp),j=!!(null==p||null==(r=p.options)?void 0:r.enableResetPassword),F=y.getAuthRoutePath(v.pathname,"auth.signup"),C=(0,c.f1)(d,"auth.forgotPassword"),x=new URLSearchParams({name:p.name}),L=y.isScopedAuthRoute(v.pathname)?new URLSearchParams(v.search).get("redirect"):null;return null!==L&&x.set("redirect",L),l().createElement(n.Form,{form:g,layout:"vertical",onFinish:function(e){var t;return(t=function(){var t,r,n,a,o;return function(e,t){var r,n,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(l,"next",{value:s(0)}),u(l,"throw",{value:s(1)}),u(l,"return",{value:s(2)}),"function"==typeof Symbol&&u(l,Symbol.iterator,{value:function(){return this}}),l;function s(u){return function(s){var i=[u,s];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,i[0]&&(o=0)),o;)try{if(r=1,n&&(a=2&i[0]?n.return:i[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,i[1])).done)return a;switch(n=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,n=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===i[0]||2===i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){o.label=i[1];break}if(6===i[0]&&o.label<a[1]){o.label=a[1],a=i;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(i);break}a[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],n=0}finally{r=a=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}}(this,function(l){switch(l.label){case 0:S(""),A(!0),l.label=1;case 1:return l.trys.push([1,3,4,5]),[4,I.run(e)];case 2:return l.sent(),[3,5];case 3:return S((null==(t=l.sent())||null==(o=t.response)||null==(a=o.data)||null==(n=a.errors)||null==(r=n[0])?void 0:r.message)||(null==t?void 0:t.message)||String(t)),[3,5];case 4:return A(!1),[7];case 5:return[2]}})},function(){var e=this,r=arguments;return new Promise(function(n,a){var o=t.apply(e,r);function l(e){f(o,n,a,l,u,"next",e)}function u(e){f(o,n,a,l,u,"throw",e)}l(void 0)})})()}},P?l().createElement(n.Alert,{style:{marginBottom:16},type:"error",showIcon:!0,message:P}):null,l().createElement(n.Form.Item,{name:"account",rules:[{required:!0,message:b("Please enter your username or email")},{validator:function(e,t){return t?String(t).includes("@")?/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(String(t))?Promise.resolve():Promise.reject(Error(b("Please enter a valid email"))):/^[^@<>"'/]{1,50}$/.test(String(t))?Promise.resolve():Promise.reject(Error(b("Please enter a valid username"))):Promise.resolve()}}]},l().createElement(n.Input,{autoComplete:"username",placeholder:b("Username/Email")})),l().createElement(n.Form.Item,{name:"password",rules:[{required:!0,message:b("Please enter a password")}]},l().createElement(n.Input.Password,{autoComplete:"current-password",placeholder:b("Password")})),l().createElement(n.Form.Item,{style:{marginBottom:12}},l().createElement(n.Button,{loading:k,htmlType:"submit",type:"primary",block:!0},b("Sign in"))),l().createElement("div",{style:{display:"flex",justifyContent:"space-between",gap:12}},_?l().createElement(u.Link,{to:"".concat(F,"?").concat(x)},b("Create an account")):null,j?l().createElement(u.Link,{to:"".concat(C,"?name=").concat(p.name)},b("Forgot password")):null))}}}]);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_auth_client_v2=self.webpackChunk_nocobase_plugin_auth_client_v2||[]).push([["841"],{720:function(e,t,r){r.r(t),r.d(t,{default:function(){return v}});var n=r(59),a=r(155),o=r.n(a),l=r(442),u=r(230),i=r(953),s=r(485),c=r(488),m=r(295),p=r(434);function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function d(e,t,r,n,a,o,l){try{var u=e[o](l),i=u.value}catch(e){r(e);return}u.done?t(i):Promise.resolve(i).then(n,a)}function h(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],l=!0,u=!1;try{for(a=a.call(e);!(l=(r=a.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(e){u=!0,n=e}finally{try{l||null==a.return||a.return()}finally{if(u)throw n}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return f(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e){var t,r=e.authenticatorName,f=(0,s.useApp)(),v=(0,s.usePlugin)(p.A),y=(0,l.useLocation)(),b=(0,l.useNavigate)(),g=(0,c.dE)().t,w=(0,i.useTranslation)("lm-collections").t,E=(0,m.p)(r),S=h(n.Form.useForm(),1)[0],I=h((0,a.useState)(!1),2),P=I[0],k=I[1],A=h((0,a.useState)(""),2),x=A[0],C=A[1],_=v.getAuthRoutePath(y.pathname,"auth.signin"),F=v.isScopedAuthRoute(y.pathname)?new URLSearchParams(y.search).get("redirect"):null,T={pathname:_,search:null===F?"":"?redirect=".concat(encodeURIComponent(F))},j=(0,a.useMemo)(function(){var e;return((null==E||null==(e=E.options)?void 0:e.signupForm)||[]).filter(function(e){return null==e?void 0:e.show})},[E]);return(null==E||null==(t=E.options)?void 0:t.allowSignUp)?o().createElement(n.Form,{form:S,layout:"vertical",onFinish:function(e){var t;return(t=function(){var t,a,o,l,u;return function(e,t){var r,n,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(l,"next",{value:i(0)}),u(l,"throw",{value:i(1)}),u(l,"return",{value:i(2)}),"function"==typeof Symbol&&u(l,Symbol.iterator,{value:function(){return this}}),l;function i(u){return function(i){var s=[u,i];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,s[0]&&(o=0)),o;)try{if(r=1,n&&(a=2&s[0]?n.return:s[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,s[1])).done)return a;switch(n=0,a&&(s=[2&s[0],a.value]),s[0]){case 0:case 1:a=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===s[0]||2===s[0])){o=0;continue}if(3===s[0]&&(!a||s[1]>a[0]&&s[1]<a[3])){o.label=s[1];break}if(6===s[0]&&o.label<a[1]){o.label=a[1],a=s;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(s);break}a[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{r=a=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}}(this,function(i){switch(i.label){case 0:C(""),k(!0),i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,f.apiClient.auth.signUp(e,r)];case 2:return i.sent(),n.message.success(g("Sign up successfully, and automatically jump to the sign in page")),window.setTimeout(function(){b(T,{replace:!0})},2e3),[3,5];case 3:return C((null==(t=i.sent())||null==(u=t.response)||null==(l=u.data)||null==(o=l.errors)||null==(a=o[0])?void 0:a.message)||(null==t?void 0:t.message)||String(t)),[3,5];case 4:return k(!1),[7];case 5:return[2]}})},function(){var e=this,r=arguments;return new Promise(function(n,a){var o=t.apply(e,r);function l(e){d(o,n,a,l,u,"next",e)}function u(e){d(o,n,a,l,u,"throw",e)}l(void 0)})})()}},x?o().createElement(n.Alert,{style:{marginBottom:16},type:"error",showIcon:!0,message:x}):null,j.map(function(e){var t,r,a,l,i,s;return a=(r=(null==e?void 0:e.uiSchema)||{})["x-component"],l=r.title?w(u.Schema.compile(r.title,{t:g})):e.field,i=[],e.required&&i.push({required:!0,message:g("Please enter ".concat(e.field))}),"email"===e.field&&i.push({type:"email",message:g("Please enter a valid email address")}),s=o().createElement(n.Input,null),(null==(t=r.enum)?void 0:t.length)?s=o().createElement(n.Select,{options:r.enum.map(function(e){return{label:e.label||e.value,value:e.value}})}):"Checkbox"===a?s=o().createElement(n.Checkbox,null):("Input.TextArea"===a||"TextArea"===a)&&(s=o().createElement(n.Input.TextArea,{rows:4})),o().createElement(n.Form.Item,{key:e.field,name:e.field,label:l,valuePropName:"Checkbox"===a?"checked":"value",rules:i},s)}),o().createElement(n.Form.Item,{label:g("Password"),name:"password",rules:[{required:!0,message:g("Please enter a password")}]},o().createElement(n.Input.Password,{autoComplete:"new-password"})),o().createElement(n.Form.Item,{label:g("Confirm password"),name:"confirm_password",dependencies:["password"],rules:[{required:!0,message:g("Please enter the same password again")},function(e){var t=e.getFieldValue;return{validator:function(e,r){return r&&t("password")!==r?Promise.reject(Error(g("The passwords entered twice are inconsistent"))):Promise.resolve()}}}]},o().createElement(n.Input.Password,{autoComplete:"new-password"})),o().createElement(n.Form.Item,{style:{marginBottom:12}},o().createElement(n.Button,{loading:P,htmlType:"submit",type:"primary",block:!0},g("Sign up"))),o().createElement(l.Link,{to:T},g("Log in with an existing account"))):o().createElement(l.Navigate,{to:"/not-found",replace:!0})}}}]);
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
-
type AuthRouteName = 'auth.signin' | 'auth.signup' | 'auth.forgotPassword' | 'auth.resetPassword';
|
|
9
|
+
export type AuthRouteName = 'auth.signin' | 'auth.signup' | 'auth.forgotPassword' | 'auth.resetPassword';
|
|
10
10
|
type PluginSettingsRouteApplication = {
|
|
11
11
|
pluginSettingsManager: {
|
|
12
12
|
getRouteName: (name: string) => string;
|
package/dist/client-v2/index.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("react-router-dom"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("ahooks"),require("@nocobase/client-v2"),require("react"),require("antd"),require("@nocobase/utils/client"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-auth/client-v2",["react-i18next","react-router-dom","@formily/react","@ant-design/icons","@nocobase/flow-engine","ahooks","@nocobase/client-v2","react","antd","@nocobase/utils/client","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-auth/client-v2"]=t(require("react-i18next"),require("react-router-dom"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("ahooks"),require("@nocobase/client-v2"),require("react"),require("antd"),require("@nocobase/utils/client"),require("lodash")):e["@nocobase/plugin-auth/client-v2"]=t(e["react-i18next"],e["react-router-dom"],e["@formily/react"],e["@ant-design/icons"],e["@nocobase/flow-engine"],e.ahooks,e["@nocobase/client-v2"],e.react,e.antd,e["@nocobase/utils/client"],e.lodash)}(self,function(e,t,n,r,o,i,a,u,c,l,s){return function(){var f,p,d,h={432:function(e,t,n){e.exports=n(36).Symbol},77:function(e,t,n){var r=n(432),o=n(444),i=n(371),a=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":a&&a in Object(e)?o(e):i(e)}},625:function(e,t,n){var r=n(531),o=/^\s+/;e.exports=function(e){return e?e.slice(0,r(e)+1).replace(o,""):e}},565:function(e,t,n){e.exports="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g},444:function(e,t,n){var r=n(432),o=Object.prototype,i=o.hasOwnProperty,a=o.toString,u=r?r.toStringTag:void 0;e.exports=function(e){var t=i.call(e,u),n=e[u];try{e[u]=void 0;var r=!0}catch(e){}var o=a.call(e);return r&&(t?e[u]=n:delete e[u]),o}},371:function(e){var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},36:function(e,t,n){var r=n(565),o="object"==typeof self&&self&&self.Object===Object&&self;e.exports=r||o||Function("return this")()},531:function(e){var t=/\s/;e.exports=function(e){for(var n=e.length;n--&&t.test(e.charAt(n)););return n}},738:function(e,t,n){var r=n(130),o=n(593),i=n(909),a=Math.max,u=Math.min;e.exports=function(e,t,n){var c,l,s,f,p,d,h=0,m=!1,v=!1,y=!0;if("function"!=typeof e)throw TypeError("Expected a function");function g(t){var n=c,r=l;return c=l=void 0,h=t,f=e.apply(r,n)}function b(e){var n=e-d,r=e-h;return void 0===d||n>=t||n<0||v&&r>=s}function w(){var e,n,r,i=o();if(b(i))return E(i);p=setTimeout(w,(e=i-d,n=i-h,r=t-e,v?u(r,s-n):r))}function E(e){return(p=void 0,y&&c)?g(e):(c=l=void 0,f)}function S(){var e,n=o(),r=b(n);if(c=arguments,l=this,d=n,r){if(void 0===p)return h=e=d,p=setTimeout(w,t),m?g(e):f;if(v)return clearTimeout(p),p=setTimeout(w,t),g(d)}return void 0===p&&(p=setTimeout(w,t)),f}return t=i(t)||0,r(n)&&(m=!!n.leading,s=(v="maxWait"in n)?a(i(n.maxWait)||0,t):s,y="trailing"in n?!!n.trailing:y),S.cancel=function(){void 0!==p&&clearTimeout(p),h=0,c=d=l=p=void 0},S.flush=function(){return void 0===p?f:E(o())},S}},130:function(e){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},189:function(e){e.exports=function(e){return null!=e&&"object"==typeof e}},733:function(e,t,n){var r=n(77),o=n(189);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==r(e)}},593:function(e,t,n){var r=n(36);e.exports=function(){return r.Date.now()}},909:function(e,t,n){var r=n(625),o=n(130),i=n(733),a=0/0,u=/^[-+]0x[0-9a-f]+$/i,c=/^0b[01]+$/i,l=/^0o[0-7]+$/i,s=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(i(e))return a;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var n=c.test(e);return n||l.test(e)?s(e.slice(2),n?2:8):u.test(e)?a:+e}},829:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(59),o=n(155),i=n.n(o),a=n(442),u=n(953),c=n(485),l=n(89);function s(){var e,t=r.theme.useToken().token,n=((0,c.useSystemSettings)()||{}).data,o=(0,u.useTranslation)("lm-collections").t;return i().createElement("div",{style:{maxWidth:320,margin:"0 auto",paddingTop:"20vh",paddingBottom:"20vh"}},i().createElement("div",{style:{position:"fixed",top:t.paddingLG,right:t.paddingLG,color:t.colorText}},i().createElement(c.SwitchLanguage,null)),i().createElement("h1",{style:{textAlign:"center"}},o(null==n||null==(e=n.data)?void 0:e.title)),i().createElement(l.A,null,i().createElement(a.Outlet,null)),i().createElement("div",{style:{position:"absolute",bottom:0,left:0,width:"100%",paddingBottom:t.paddingLG,textAlign:"center",backgroundColor:t.colorBgContainer}},i().createElement(c.PoweredBy,null)))}},826:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return m}});var r=n(59),o=n(155),i=n.n(o),a=n(442),u=n(485),c=n(295),l=n(488),s=n(824),f=n(927);function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){n(e);return}u.done?t(c):Promise.resolve(c).then(r,o)}function h(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,u=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){u=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(u)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return p(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(){var e,t=(0,u.useApp)(),n=(0,l.dE)().t,p=h((0,a.useSearchParams)(),1)[0].get("name"),m=(0,c.p)(p),v=h(r.Form.useForm(),1)[0],y=h((0,o.useState)(!1),2),g=y[0],b=y[1],w=h((0,o.useState)(""),2),E=w[0],S=w[1],P=(0,f.f1)(t,"auth.signin");return((0,s.rN)(n("Reset password")),null==m||null==(e=m.options)?void 0:e.enableResetPassword)?i().createElement(r.Form,{form:v,layout:"vertical",onFinish:function(e){var o;return(o=function(){var o,i,a,u,c;return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(a,"next",{value:c(0)}),u(a,"throw",{value:c(1)}),u(a,"return",{value:c(2)}),"function"==typeof Symbol&&u(a,Symbol.iterator,{value:function(){return this}}),a;function c(u){return function(c){var l=[u,c];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(l){switch(l.label){case 0:S(""),b(!0),l.label=1;case 1:return l.trys.push([1,3,4,5]),[4,t.apiClient.auth.lostPassword(e)];case 2:return l.sent(),r.message.success(n("Reset email sent successfully")),v.resetFields(),[3,5];case 3:return S((null==(o=l.sent())||null==(c=o.response)||null==(u=c.data)||null==(a=u.errors)||null==(i=a[0])?void 0:i.message)||(null==o?void 0:o.message)||String(o)),[3,5];case 4:return b(!1),[7];case 5:return[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,r){var i=o.apply(e,t);function a(e){d(i,n,r,a,u,"next",e)}function u(e){d(i,n,r,a,u,"throw",e)}a(void 0)})})()}},E?i().createElement(r.Alert,{style:{marginBottom:16},type:"error",showIcon:!0,message:E}):null,i().createElement(r.Form.Item,{label:n("Reset password"),name:"email",rules:[{required:!0,message:n("Please fill in your email address")},{type:"email",message:n("Please enter a valid email")}]},i().createElement(r.Input,{placeholder:n("Please enter your email")})),i().createElement(r.Form.Item,{style:{marginBottom:12}},i().createElement(r.Button,{loading:g,htmlType:"submit",type:"primary",block:!0},n("Send reset email"))),i().createElement(a.Link,{to:P},n("Back to login"))):i().createElement(a.Navigate,{to:P,replace:!0})}},622:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return m}});var r=n(59),o=n(155),i=n.n(o),a=n(442),u=n(485),c=n(295),l=n(488),s=n(824),f=n(927);function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){n(e);return}u.done?t(c):Promise.resolve(c).then(r,o)}function h(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,u=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){u=!0,r=e}finally{try{a||null==o.return||o.return()}finally{if(u)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return p(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(){var e,t=(0,u.useApp)(),n=(0,l.dE)().t,p=(0,a.useNavigate)(),m=h((0,a.useSearchParams)(),1)[0],v=m.get("resetToken"),y=m.get("name"),g=(0,c.p)(y),b=h(r.Form.useForm(),1)[0],w=h((0,o.useState)(!1),2),E=w[0],S=w[1],P=h((0,o.useState)(!0),2),O=P[0],k=P[1],A=h((0,o.useState)(!1),2),x=A[0],T=A[1],j=h((0,o.useState)(""),2),_=j[0],I=j[1],C=(0,f.f1)(t,"auth.signin");return((0,s.rN)(n("Reset password")),(0,o.useEffect)(function(){var e=!0;if(!v){S(!0),k(!1);return}return t.apiClient.auth.checkResetToken({resetToken:v}).then(function(){e&&(S(!1),k(!1))}).catch(function(){e&&(S(!0),k(!1))}),function(){e=!1}},[t,v]),null==g||null==(e=g.options)?void 0:e.enableResetPassword)?O||v&&!E?i().createElement(r.Form,{form:b,layout:"vertical",onFinish:function(e){var o;return(o=function(){var o,i,a,u,c;return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(a,"next",{value:c(0)}),u(a,"throw",{value:c(1)}),u(a,"return",{value:c(2)}),"function"==typeof Symbol&&u(a,Symbol.iterator,{value:function(){return this}}),a;function c(u){return function(c){var l=[u,c];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(l){switch(l.label){case 0:I(""),T(!0),l.label=1;case 1:var s,f;return l.trys.push([1,3,4,5]),[4,t.apiClient.auth.resetPassword((s=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},e),f=f={resetToken:v},Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(f)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(f)).forEach(function(e){Object.defineProperty(s,e,Object.getOwnPropertyDescriptor(f,e))}),s))];case 2:return l.sent(),r.message.success(n("Password reset successful")),window.setTimeout(function(){p(C,{replace:!0})},1e3),[3,5];case 3:return I((null==(o=l.sent())||null==(c=o.response)||null==(u=c.data)||null==(a=u.errors)||null==(i=a[0])?void 0:i.message)||(null==o?void 0:o.message)||String(o)),[3,5];case 4:return T(!1),[7];case 5:return[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,r){var i=o.apply(e,t);function a(e){d(i,n,r,a,u,"next",e)}function u(e){d(i,n,r,a,u,"throw",e)}a(void 0)})})()}},_?i().createElement(r.Alert,{style:{marginBottom:16},type:"error",showIcon:!0,message:_}):null,i().createElement(r.Form.Item,{label:n("New password"),name:"password",rules:[{required:!0,message:n("Please enter new password")}]},i().createElement(r.Input.Password,{autoComplete:"new-password"})),i().createElement(r.Form.Item,{label:n("Confirm password"),name:"confirmPassword",dependencies:["password"],rules:[{required:!0,message:n("Please enter the same password again")},function(e){var t=e.getFieldValue;return{validator:function(e,r){return r&&t("password")!==r?Promise.reject(Error(n("The passwords entered twice are inconsistent"))):Promise.resolve()}}}]},i().createElement(r.Input.Password,{autoComplete:"new-password"})),i().createElement(r.Form.Item,{style:{marginBottom:12}},i().createElement(r.Button,{loading:x||O,htmlType:"submit",type:"primary",block:!0},n("Confirm"))),i().createElement(a.Link,{to:C},n("Go to login"))):i().createElement(r.Result,{status:"403",title:n("Reset link has expired"),extra:i().createElement(r.Button,{type:"primary",onClick:function(){return p(C)}},n("Go to login"))}):i().createElement(a.Navigate,{to:C,replace:!0})}},818:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return v}});var r=n(485),o=n(59),i=n(155),a=n.n(i),u=n(442),c=n(295),l=n(824),s=n(488),f=n(434),p=n(927);function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function h(e){var t=(0,r.usePlugin)(f.A);return(0,i.useMemo)(function(){var n={},r=!0,o=!1,i=void 0;try{for(var a,u=t.authTypes.getEntities()[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var c,l=(c=a.value,function(e){if(Array.isArray(e))return e}(c)||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,a=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){a=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(a)throw n}}return o}}(c)||function(e){if(e){if("string"==typeof e)return d(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return d(e,2)}}(c)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),s=l[0],f=l[1][e];f&&(n[s]=f)}}catch(e){o=!0,i=e}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}return n},[t,e])}function m(e){var t=new Map;return function(n){if(e[n])return t.has(n)||t.set(n,(0,i.lazy)(e[n])),t.get(n)}}function v(){var e=(0,r.useApp)(),t=(0,u.useLocation)(),n=(0,u.useNavigate)(),f=(0,s.dE)().t,d=(0,s.kj)(),v=(0,i.useContext)(c.m),y=h("signInFormLoader"),g=h("signInButtonLoader"),b=(0,i.useMemo)(function(){return m(y)},[y]),w=(0,i.useMemo)(function(){return m(g)},[g]);(0,l.rN)(f("Signin")),(0,i.useEffect)(function(){var o=new URLSearchParams(t.search),i=o.get("redirect"),a=(0,r.normalizeV2RedirectPath)(e,i,(0,p.Fo)(e));i!==a&&(o.set("redirect",a),n({pathname:t.pathname,search:"?".concat(o)},{replace:!0}))},[e,t.pathname,t.search,n]);var E=(0,i.useMemo)(function(){return v.map(function(e){var t=b(e.authType);if(!t)return null;var n=d(e.authTypeTitle||e.authType);return{key:e.name,label:e.title||"".concat(f("Sign-in")," (").concat(n,")"),children:a().createElement(i.Suspense,{fallback:a().createElement(o.Spin,null)},a().createElement(t,{authenticator:e}))}}).filter(Boolean)},[v,b,f,d]),S=(0,i.useMemo)(function(){return v.map(function(e,t){var n=w(e.authType);return n?a().createElement(i.Suspense,{key:"".concat(e.name,"-").concat(t),fallback:a().createElement(o.Spin,null)},a().createElement(n,{authenticator:e})):null}).filter(Boolean)},[v,w]);return v.length?a().createElement(o.Space,{direction:"vertical",style:{display:"flex"}},E.length>1?a().createElement(o.Tabs,{items:E}):E.length?E[0].children:null,S.length?a().createElement(o.Space,{direction:"vertical",style:{display:"flex"}},S):null):a().createElement(o.Empty,{description:f("No authentication methods available.")})}},872:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return d}});var r=n(485),o=n(59),i=n(155),a=n.n(i),u=n(442),c=n(295),l=n(824),s=n(488),f=n(434);function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(){var e,t=(0,s.dE)().t,n=((function(e){if(Array.isArray(e))return e})(e=(0,u.useSearchParams)())||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,a=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),1!==o.length);i=!0);}catch(e){a=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(a)throw n}}return o}}(e)||function(e){if(e){if("string"==typeof e)return p(e,1);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return p(e,1)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0].get("name"),d=(0,c.p)(n),h=(0,r.usePlugin)(f.A),m=(0,i.useMemo)(function(){if(!d)return null;var e,t=null==(e=h.authTypes.get(d.authType))?void 0:e.signUpFormLoader;return t?(0,i.lazy)(t):null},[d,h]);return((0,l.rN)(t("Signup")),d&&m)?a().createElement(i.Suspense,{fallback:a().createElement(o.Spin,null)},a().createElement(m,{authenticatorName:d.name})):a().createElement(o.Empty,{description:t("No authentication methods available.")})}},434:function(e,t,n){"use strict";n.d(t,{A:function(){return T},T:function(){return x}});var r=n(768),o=n(485),i=n(738),a=n.n(i),u=n(927),c=n(258),l=n(488);function s(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){n(e);return}u.done?t(c):Promise.resolve(c).then(r,o)}function f(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){s(i,r,o,a,u,"next",e)}function u(e){s(i,r,o,a,u,"throw",e)}a(void 0)})}}function p(e,t,n){return t=g(t),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e,S()?Reflect.construct(t,n||[],g(e).constructor):t.apply(e,n))}function d(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function h(e,t,n){return(h=S()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&w(o,n.prototype),o}).apply(null,arguments)}function m(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function v(e,t,n){return t&&m(e.prototype,t),n&&m(e,n),e}function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g(e){return(g=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function b(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&w(e,t)}function w(e,t){return(w=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function E(e){var t="function"==typeof Map?new Map:void 0;return(E=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return h(e,arguments,g(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),w(n,e)})(e)}function S(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(S=function(){return!!e})()}function P(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(a,"next",{value:c(0)}),u(a,"throw",{value:c(1)}),u(a,"return",{value:c(2)}),"function"==typeof Symbol&&u(a,Symbol.iterator,{value:function(){return this}}),a;function c(u){return function(c){var l=[u,c];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var O=function(e){function t(){var e;return d(this,t),e=p(this,t,arguments),y(e,"section","preferences"),y(e,"sort",350),y(e,"label","Language"),e}return b(t,e),v(t,[{key:"prepare",value:function(){return f(function(){var e,t,n,r,i;return P(this,function(a){switch(a.label){case 0:return[4,this.context.systemSettings.load()];case 1:return i=(null==(r=a.sent())||null==(e=r.data)?void 0:e.enabledLanguages)||[],this.options=i.map(function(e){var t;return{value:e,label:(null==(t=o.languageCodes[e])?void 0:t.label)||e}}),this.value=(null==(t=(n=this.context.app.apiClient.auth).getLocale)?void 0:t.call(n))||this.context.app.apiClient.auth.locale,this.ready=this.options.length>1,[2]}})}).call(this)}},{key:"onChange",value:function(e){return f(function(){return P(this,function(t){return this.context.app.apiClient.auth.setLocale(e),window.location.reload(),[2]})}).call(this)}}]),t}(o.UserCenterSelectItemModel);y(O,"itemId","language");var k={EMPTY_TOKEN:"EMPTY_TOKEN",EXPIRED_TOKEN:"EXPIRED_TOKEN",INVALID_TOKEN:"INVALID_TOKEN",TOKEN_RENEW_FAILED:"TOKEN_RENEW_FAILED",BLOCKED_TOKEN:"BLOCKED_TOKEN",EXPIRED_SESSION:"EXPIRED_SESSION",NOT_EXIST_USER:"NOT_EXIST_USER",SKIP_TOKEN_RENEW:"SKIP_TOKEN_RENEW",USER_HAS_NO_ROLES_ERR:"USER_HAS_NO_ROLES_ERR"},A=a()(function(e){e()},3e3,{leading:!0,trailing:!1}),x=function(e){function t(){var e;return d(this,t),e=p(this,t,arguments),y(e,"authTypes",new r.Registry),e}return b(t,e),v(t,[{key:"registerType",value:function(e,t){this.authTypes.register(e,t)}},{key:"registerSignInRoute",value:function(e,t){this.router.add("auth.".concat(e),{path:t,skipAuthCheck:!0,componentLoader:function(){return Promise.resolve().then(n.bind(n,818))}})}},{key:"load",value:function(){return f(function(){return P(this,function(e){return this.app.providers.unshift([c.A,{}]),this.app.flowEngine.registerModels({UserCenterLanguageItemModel:O}),this.addRoutes(),this.registerPresetAuthType(),this.registerSettingsPages(),this.installInterceptors(),[2]})}).call(this)}},{key:"registerSettingsPages",value:function(){var e=this,t=function(t){return e.app.i18n.t(t,{ns:l.CU})};this.pluginSettingsManager.addMenuItem({key:l.CU,title:t("Authentication"),icon:"LoginOutlined",aclSnippet:"pm.auth"}),this.pluginSettingsManager.addPageTabItem({menuKey:l.CU,key:"authenticators",title:t("Authenticators"),icon:"LoginOutlined",aclSnippet:"pm.auth.authenticators",sort:1,componentLoader:function(){return n.e("9").then(n.bind(n,648))}}),this.pluginSettingsManager.addPageTabItem({menuKey:"security",key:"token-policy",title:t("Token policy"),icon:"ApiOutlined",aclSnippet:"pm.security.token-policy",sort:0,componentLoader:function(){return n.e("657").then(n.bind(n,632))}})}},{key:"addRoutes",value:function(){this.router.add("auth",{componentLoader:function(){return Promise.resolve().then(n.bind(n,829))}}),this.router.add("auth.signin",{path:"/signin",skipAuthCheck:!0,componentLoader:function(){return Promise.resolve().then(n.bind(n,818))}}),this.router.add("auth.signup",{path:"/signup",skipAuthCheck:!0,componentLoader:function(){return Promise.resolve().then(n.bind(n,872))}}),this.router.add("auth.forgotPassword",{path:"/forgot-password",skipAuthCheck:!0,componentLoader:function(){return Promise.resolve().then(n.bind(n,826))}}),this.router.add("auth.resetPassword",{path:"/reset-password",skipAuthCheck:!0,componentLoader:function(){return Promise.resolve().then(n.bind(n,622))}})}},{key:"registerPresetAuthType",value:function(){this.registerType("Email/Password",{signInFormLoader:function(){return n.e("795").then(n.bind(n,918))},signUpFormLoader:function(){return n.e("841").then(n.bind(n,720))},adminSettingsFormLoader:function(){return n.e("217").then(n.bind(n,264))}})}},{key:"installInterceptors",value:function(){var e=this;this.app.apiClient.axios.interceptors.response.handlers.unshift({fulfilled:function(t){var n,r=null==t||null==(n=t.headers)?void 0:n["x-new-token"];return r&&e.app.apiClient.auth.setToken(r),t},rejected:function(t){var n,r,i,a,c,l,s,f,p=null==t||null==(r=t.response)||null==(n=r.headers)?void 0:n["x-new-token"],d=null==t||null==(a=t.response)||null==(i=a.data)?void 0:i.errors,h=Array.isArray(d)?d[0]:null,m=(null==(l=e.app.router.router)||null==(c=l.state)?void 0:c.location)||window.location,v=(null==m?void 0:m.pathname)||window.location.pathname,y=(null==t?void 0:t.status)||(null==t||null==(s=t.response)?void 0:s.status);if(p&&e.app.apiClient.auth.setToken(p),401===y&&(null==h?void 0:h.code)&&k[null==h?void 0:h.code]&&(e.app.apiClient.auth.setToken(""),e.app.apiClient.auth.setRole(""),e.app.apiClient.auth.setAuthenticator("")),401===y&&!(null==(f=t.config)?void 0:f.skipAuth)&&(null==h?void 0:h.code)&&k[null==h?void 0:h.code]){if((null==h?void 0:h.code)===k.SKIP_TOKEN_RENEW)throw t;var g=e.app.router.isSkippedAuthCheckRoute(v);if(g&&(t.config.skipNotify=!0),!g){var b=(0,o.getCurrentV2RedirectPath)(e.app,m);return A(function(){if(e.app.apiClient.auth.setToken(""),(0,u.Py)(e.app))(0,o.redirectToV2Signin)(e.app,b);else{var t=(0,o.resolveUnauthenticatedSignInRoute)(e.app,v);e.app.router.navigate("".concat(t,"?redirect=").concat(encodeURIComponent(b)),{replace:!0})}}),new Promise(function(){})}}throw t},synchronous:!1,runWhen:null})}}]),t}(E(o.Plugin)),T=x},258:function(e,t,n){"use strict";var r=n(485),o=n(155),i=n.n(o),a=n(442);t.A=function(e){var t=e.children,n=(0,r.useApp)(),u=(0,a.useNavigate)(),c=(0,a.useLocation)();return(0,o.useEffect)(function(){var e=new URLSearchParams(c.search),t=e.get("token"),r=e.get("authenticator");if(t){n.apiClient.auth.setToken(t),n.apiClient.auth.setAuthenticator(r),e.delete("token"),e.delete("authenticator");var o=e.toString();u({pathname:c.pathname,search:o?"?".concat(o):""},{replace:!0})}},[n,c.pathname,c.search,u]),i().createElement(i().Fragment,null,t)}},89:function(e,t,n){"use strict";var r=n(59),o=n(155),i=n.n(o),a=n(485),u=n(295);function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}t.A=function(e){var t,n,l=e.children,s=(0,a.useApp)(),f=function(e){if(Array.isArray(e))return e}(t=(0,o.useState)({authenticators:[],error:null,loading:!0}))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,a=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){a=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(a)throw n}}return o}}(t)||function(e){if(e){if("string"==typeof e)return c(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return c(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),p=f[0],d=f[1];return((0,o.useEffect)(function(){var e=!0;return s.apiClient.resource("authenticators").publicList().then(function(t){var n;e&&d({authenticators:(null==t||null==(n=t.data)?void 0:n.data)||[],error:null,loading:!1})}).catch(function(t){e&&d({authenticators:[],error:t,loading:!1})}),function(){e=!1}},[s]),p.loading)?i().createElement("div",{style:{textAlign:"center",marginTop:20}},i().createElement(r.Spin,null)):p.error?i().createElement(r.Alert,{type:"error",showIcon:!0,message:(null==(n=p.error)?void 0:n.message)||"Failed to load authenticators"}):i().createElement(u.m.Provider,{value:p.authenticators},l)}},927:function(e,t,n){"use strict";n.d(t,{Fo:function(){return a},Py:function(){return i},f1:function(){return o}});var r={"auth.signin":"/signin","auth.signup":"/signup","auth.forgotPassword":"/forgot-password","auth.resetPassword":"/reset-password"};function o(e,t){var n,o=null==(n=e.router.get(t))?void 0:n.path;return"string"==typeof o?o:r[t]}function i(e){return"settings."===e.pluginSettingsManager.getRouteName("")}function a(e){return i(e)?e.pluginSettingsManager.getRoutePath(""):"/"}},295:function(e,t,n){"use strict";n.d(t,{m:function(){return o},p:function(){return i}});var r=n(155),o=(0,r.createContext)([]);o.displayName="AuthenticatorsContext";var i=function(e){return(0,r.useContext)(o).find(function(t){return t.name===e})}},824:function(e,t,n){"use strict";n.d(t,{go:function(){return p},rN:function(){return f},wn:function(){return s}});var r=n(155),o=n(442),i=n(485),a=n(927);function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function c(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){n(e);return}u.done?t(c):Promise.resolve(c).then(r,o)}function l(e){var t=new URL("/".concat(String(e||"/").trim()).replace(/\/{2,}/g,"/"),window.location.origin).pathname;return"/"===t?t:t.replace(/\/+$/,"")}function s(e){var t,n=(0,i.useApp)(),c=(0,o.useNavigate)(),s=(function(e){if(Array.isArray(e))return e}(t=(0,o.useSearchParams)())||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,a=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),1!==o.length);i=!0);}catch(e){a=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(a)throw n}}return o}}(t)||function(e){if(e){if("string"==typeof e)return u(e,1);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return u(e,1)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0];return(0,r.useCallback)(function(){var t,r,o=s.get("redirect"),u=e||(0,a.Fo)(n),f=o||void 0===e&&(0,a.Py)(n)?(0,i.normalizeV2RedirectPath)(n,o,u):u;!function(e,t){if(!t.startsWith("/")||t.startsWith("//")||t.startsWith("/\\"))return!1;var n,r,o,i,u,c,s=null==(u=(c=e.router).getBasename)?void 0:u.call(c),f=l(e.getPublicPath()),p=(r=l(f).replace(/\/+$/,""),o=l(s||"/"),i=r&&(o===r||o.startsWith("".concat(r,"/")))?o.slice(r.length)||"/":o,(null==(n=/^\/settings(\/(?:apps|_app)\/[^/]+)(?=\/|$)/.exec(i))?void 0:n[1])||""),d=f.split("/");(0,a.Py)(e)||d.pop();var h=l(d.join("/")||"/").replace(/\/+$/,""),m=p?"".concat(h,"/settings").concat(p):"".concat(h,"/settings")||"/settings",v=l(t.split(/[?#]/)[0]);return v===m||v.startsWith("".concat(m,"/"))}(n,f)?c(function(e,t){if(!t||"/"===t)return e.startsWith("/")?e:"/".concat(e);var n=t.endsWith("/")?t.slice(0,-1):t;return e===n?"/":e.startsWith("".concat(n,"/"))?e.slice(n.length)||"/":e}(f,null==(t=(r=n.router).getBasename)?void 0:t.call(r)),{replace:!0}):window.location.replace(f)},[n,c,e,s])}function f(e){(0,r.useEffect)(function(){document.title=e},[e])}function p(e){var t=(0,i.useApp)(),n=s();return{run:function(r){var o;return(o=function(){return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(a,"next",{value:c(0)}),u(a,"throw",{value:c(1)}),u(a,"return",{value:c(2)}),"function"==typeof Symbol&&u(a,Symbol.iterator,{value:function(){return this}}),a;function c(u){return function(c){var l=[u,c];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(o){switch(o.label){case 0:return[4,t.apiClient.auth.signIn(r,e)];case 1:return o.sent(),[4,t.apiClient.request({url:"/auth:check",skipAuth:!0,skipNotify:!0}).catch(function(){})];case 2:return o.sent(),n(),[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,r){var i=o.apply(e,t);function a(e){c(i,n,r,a,u,"next",e)}function u(e){c(i,n,r,a,u,"throw",e)}a(void 0)})})()}}}},488:function(e,t,n){"use strict";n.d(t,{CU:function(){return i},dE:function(){return a},kj:function(){return u}});var r=n(694),o=n(953),i="auth";function a(){return(0,o.useTranslation)([i,"client"],{nsMode:"fallback"})}function u(){var e=(0,r.useFlowEngine)();return function(t){return e.context.t(t,{ns:[i,"client"],nsMode:"fallback"})}}},375:function(e){"use strict";e.exports=r},230:function(e){"use strict";e.exports=n},485:function(e){"use strict";e.exports=a},694:function(e){"use strict";e.exports=o},768:function(e){"use strict";e.exports=l},6:function(e){"use strict";e.exports=i},59:function(e){"use strict";e.exports=c},773:function(e){"use strict";e.exports=s},155:function(e){"use strict";e.exports=u},953:function(t){"use strict";t.exports=e},442:function(e){"use strict";e.exports=t}},m={};function v(e){var t=m[e];if(void 0!==t)return t.exports;var n=m[e]={exports:{}};return h[e](n,n.exports,v),n.exports}v.m=h,v.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return v.d(t,{a:t}),t},v.d=function(e,t){for(var n in t)v.o(t,n)&&!v.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},v.f={},v.e=function(e){return Promise.all(Object.keys(v.f).reduce(function(t,n){return v.f[n](e,t),t},[]))},v.u=function(e){return""+e+"."+({217:"1510705562d97555",657:"2a9dcca9ddc31ec0",795:"7100439b59804662",841:"7a31cfa7c5c79d2d",9:"c10c60a4ecc4256d"})[e]+".js"},v.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),v.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},y={},v.l=function(e,t,n,r){if(y[e])return void y[e].push(t);if(void 0!==n)for(var o,i,a=document.getElementsByTagName("script"),u=0;u<a.length;u++){var c=a[u];if(c.getAttribute("src")==e||c.getAttribute("data-rspack")=="@nocobase/plugin-auth/client-v2:"+n){o=c;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,v.nc&&o.setAttribute("nonce",v.nc),o.setAttribute("data-rspack","@nocobase/plugin-auth/client-v2:"+n),o.src=e),y[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=y[e];if(delete y[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},v.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},v.g.importScripts&&(g=v.g.location+"");var y,g,b=v.g.document;if(!g&&b&&(b.currentScript&&"SCRIPT"===b.currentScript.tagName.toUpperCase()&&(g=b.currentScript.src),!g)){var w=b.getElementsByTagName("script");if(w.length)for(var E=w.length-1;E>-1&&(!g||!/^http(s?):/.test(g));)g=w[E--].src}if(!g)throw Error("Automatic publicPath is not supported in this browser");v.p=g.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),f={889:0},v.f.j=function(e,t){var n=v.o(f,e)?f[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=f[e]=[t,r]});t.push(n[2]=r);var o=v.p+v.u(e),i=Error();v.l(o,function(t){if(v.o(f,e)&&(0!==(n=f[e])&&(f[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},p=function(e,t){var n,r,o=t[0],i=t[1],a=t[2],u=0;if(o.some(function(e){return 0!==f[e]})){for(n in i)v.o(i,n)&&(v.m[n]=i[n]);a&&a(v)}for(e&&e(t);u<o.length;u++)r=o[u],v.o(f,r)&&f[r]&&f[r][0](),f[r]=0},(d=self.webpackChunk_nocobase_plugin_auth_client_v2=self.webpackChunk_nocobase_plugin_auth_client_v2||[]).forEach(p.bind(null,0)),d.push=p.bind(null,d.push.bind(d));var S={};return!function(){"use strict";var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src){var n=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");n.indexOf("/static/plugins/@nocobase/plugin-auth/dist/client-v2/")>=0&&(e=n.replace(/\/[^\/]+$/,"/"))}if(!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/@nocobase/plugin-auth/dist/client-v2/")}if(!e){var o=window.__nocobase_modern_client_prefix__||"v",i="/"+(o=String(o).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var a=window.location.pathname||"/",u=a.indexOf(i);e=u>=0?a.slice(0,u+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-auth/dist/client-v2/"}v.p=e}(),!function(){"use strict";v.r(S),v.d(S,{AuthLayout:function(){return o.default},AuthProvider:function(){return l.A},AuthenticatorsContext:function(){return t.m},AuthenticatorsContextProvider:function(){return s.A},ForgotPasswordPage:function(){return u.default},NAMESPACE:function(){return n.CU},PluginAuthClientV2:function(){return e.T},ResetPasswordPage:function(){return c.default},SignInPage:function(){return i.default},SignUpPage:function(){return a.default},default:function(){return e.A},useAuthTranslation:function(){return n.dE},useAuthenticator:function(){return t.p},useDocumentTitle:function(){return r.rN},useRedirect:function(){return r.wn},useSignIn:function(){return r.go},useT:function(){return n.kj}});var e=v(434),t=v(295),n=v(488),r=v(824),o=v(829),i=v(818),a=v(872),u=v(826),c=v(622),l=v(258),s=v(89)}(),S}()});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("react-router-dom"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("ahooks"),require("@nocobase/client-v2"),require("react"),require("antd"),require("@nocobase/utils/client"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-auth/client-v2",["react-i18next","react-router-dom","@formily/react","@ant-design/icons","@nocobase/flow-engine","ahooks","@nocobase/client-v2","react","antd","@nocobase/utils/client","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-auth/client-v2"]=t(require("react-i18next"),require("react-router-dom"),require("@formily/react"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("ahooks"),require("@nocobase/client-v2"),require("react"),require("antd"),require("@nocobase/utils/client"),require("lodash")):e["@nocobase/plugin-auth/client-v2"]=t(e["react-i18next"],e["react-router-dom"],e["@formily/react"],e["@ant-design/icons"],e["@nocobase/flow-engine"],e.ahooks,e["@nocobase/client-v2"],e.react,e.antd,e["@nocobase/utils/client"],e.lodash)}(self,function(e,t,n,r,o,a,i,u,c,l,s){return function(){var f,p,h,d={432:function(e,t,n){e.exports=n(36).Symbol},77:function(e,t,n){var r=n(432),o=n(444),a=n(371),i=r?r.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":i&&i in Object(e)?o(e):a(e)}},625:function(e,t,n){var r=n(531),o=/^\s+/;e.exports=function(e){return e?e.slice(0,r(e)+1).replace(o,""):e}},565:function(e,t,n){e.exports="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g},444:function(e,t,n){var r=n(432),o=Object.prototype,a=o.hasOwnProperty,i=o.toString,u=r?r.toStringTag:void 0;e.exports=function(e){var t=a.call(e,u),n=e[u];try{e[u]=void 0;var r=!0}catch(e){}var o=i.call(e);return r&&(t?e[u]=n:delete e[u]),o}},371:function(e){var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},36:function(e,t,n){var r=n(565),o="object"==typeof self&&self&&self.Object===Object&&self;e.exports=r||o||Function("return this")()},531:function(e){var t=/\s/;e.exports=function(e){for(var n=e.length;n--&&t.test(e.charAt(n)););return n}},738:function(e,t,n){var r=n(130),o=n(593),a=n(909),i=Math.max,u=Math.min;e.exports=function(e,t,n){var c,l,s,f,p,h,d=0,v=!1,y=!1,m=!0;if("function"!=typeof e)throw TypeError("Expected a function");function g(t){var n=c,r=l;return c=l=void 0,d=t,f=e.apply(r,n)}function b(e){var n=e-h,r=e-d;return void 0===h||n>=t||n<0||y&&r>=s}function w(){var e,n,r,a=o();if(b(a))return S(a);p=setTimeout(w,(e=a-h,n=a-d,r=t-e,y?u(r,s-n):r))}function S(e){return(p=void 0,m&&c)?g(e):(c=l=void 0,f)}function E(){var e,n=o(),r=b(n);if(c=arguments,l=this,h=n,r){if(void 0===p)return d=e=h,p=setTimeout(w,t),v?g(e):f;if(y)return clearTimeout(p),p=setTimeout(w,t),g(h)}return void 0===p&&(p=setTimeout(w,t)),f}return t=a(t)||0,r(n)&&(v=!!n.leading,s=(y="maxWait"in n)?i(a(n.maxWait)||0,t):s,m="trailing"in n?!!n.trailing:m),E.cancel=function(){void 0!==p&&clearTimeout(p),d=0,c=h=l=p=void 0},E.flush=function(){return void 0===p?f:S(o())},E}},130:function(e){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},189:function(e){e.exports=function(e){return null!=e&&"object"==typeof e}},733:function(e,t,n){var r=n(77),o=n(189);e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==r(e)}},593:function(e,t,n){var r=n(36);e.exports=function(){return r.Date.now()}},909:function(e,t,n){var r=n(625),o=n(130),a=n(733),i=0/0,u=/^[-+]0x[0-9a-f]+$/i,c=/^0b[01]+$/i,l=/^0o[0-7]+$/i,s=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(a(e))return i;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var n=c.test(e);return n||l.test(e)?s(e.slice(2),n?2:8):u.test(e)?i:+e}},829:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return s}});var r=n(59),o=n(155),a=n.n(o),i=n(442),u=n(953),c=n(485),l=n(89);function s(){var e,t=r.theme.useToken().token,n=((0,c.useSystemSettings)()||{}).data,o=(0,u.useTranslation)("lm-collections").t;return a().createElement("div",{style:{maxWidth:320,margin:"0 auto",paddingTop:"20vh",paddingBottom:"20vh"}},a().createElement("div",{style:{position:"fixed",top:t.paddingLG,right:t.paddingLG,color:t.colorText}},a().createElement(c.SwitchLanguage,null)),a().createElement("h1",{style:{textAlign:"center"}},o(null==n||null==(e=n.data)?void 0:e.title)),a().createElement(l.A,null,a().createElement(i.Outlet,null)),a().createElement("div",{style:{position:"absolute",bottom:0,left:0,width:"100%",paddingBottom:t.paddingLG,textAlign:"center",backgroundColor:t.colorBgContainer}},a().createElement(c.PoweredBy,null)))}},826:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return v}});var r=n(59),o=n(155),a=n.n(o),i=n(442),u=n(485),c=n(295),l=n(488),s=n(824),f=n(927);function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function h(e,t,n,r,o,a,i){try{var u=e[a](i),c=u.value}catch(e){n(e);return}u.done?t(c):Promise.resolve(c).then(r,o)}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],i=!0,u=!1;try{for(o=o.call(e);!(i=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){u=!0,r=e}finally{try{i||null==o.return||o.return()}finally{if(u)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return p(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(){var e,t=(0,u.useApp)(),n=(0,l.dE)().t,p=d((0,i.useSearchParams)(),1)[0].get("name"),v=(0,c.p)(p),y=d(r.Form.useForm(),1)[0],m=d((0,o.useState)(!1),2),g=m[0],b=m[1],w=d((0,o.useState)(""),2),S=w[0],E=w[1],P=(0,f.f1)(t,"auth.signin");return((0,s.rN)(n("Reset password")),null==v||null==(e=v.options)?void 0:e.enableResetPassword)?a().createElement(r.Form,{form:y,layout:"vertical",onFinish:function(e){var o;return(o=function(){var o,a,i,u,c;return function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(i,"next",{value:c(0)}),u(i,"throw",{value:c(1)}),u(i,"return",{value:c(2)}),"function"==typeof Symbol&&u(i,Symbol.iterator,{value:function(){return this}}),i;function c(u){return function(c){var l=[u,c];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,r=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){a=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){a.label=l[1];break}if(6===l[0]&&a.label<o[1]){a.label=o[1],o=l;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(l);break}o[2]&&a.ops.pop(),a.trys.pop();continue}l=t.call(e,a)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(l){switch(l.label){case 0:E(""),b(!0),l.label=1;case 1:return l.trys.push([1,3,4,5]),[4,t.apiClient.auth.lostPassword(e)];case 2:return l.sent(),r.message.success(n("Reset email sent successfully")),y.resetFields(),[3,5];case 3:return E((null==(o=l.sent())||null==(c=o.response)||null==(u=c.data)||null==(i=u.errors)||null==(a=i[0])?void 0:a.message)||(null==o?void 0:o.message)||String(o)),[3,5];case 4:return b(!1),[7];case 5:return[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,r){var a=o.apply(e,t);function i(e){h(a,n,r,i,u,"next",e)}function u(e){h(a,n,r,i,u,"throw",e)}i(void 0)})})()}},S?a().createElement(r.Alert,{style:{marginBottom:16},type:"error",showIcon:!0,message:S}):null,a().createElement(r.Form.Item,{label:n("Reset password"),name:"email",rules:[{required:!0,message:n("Please fill in your email address")},{type:"email",message:n("Please enter a valid email")}]},a().createElement(r.Input,{placeholder:n("Please enter your email")})),a().createElement(r.Form.Item,{style:{marginBottom:12}},a().createElement(r.Button,{loading:g,htmlType:"submit",type:"primary",block:!0},n("Send reset email"))),a().createElement(i.Link,{to:P},n("Back to login"))):a().createElement(i.Navigate,{to:P,replace:!0})}},622:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return v}});var r=n(59),o=n(155),a=n.n(o),i=n(442),u=n(485),c=n(295),l=n(488),s=n(824),f=n(927);function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function h(e,t,n,r,o,a,i){try{var u=e[a](i),c=u.value}catch(e){n(e);return}u.done?t(c):Promise.resolve(c).then(r,o)}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],i=!0,u=!1;try{for(o=o.call(e);!(i=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){u=!0,r=e}finally{try{i||null==o.return||o.return()}finally{if(u)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return p(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(){var e,t=(0,u.useApp)(),n=(0,l.dE)().t,p=(0,i.useNavigate)(),v=d((0,i.useSearchParams)(),1)[0],y=v.get("resetToken"),m=v.get("name"),g=(0,c.p)(m),b=d(r.Form.useForm(),1)[0],w=d((0,o.useState)(!1),2),S=w[0],E=w[1],P=d((0,o.useState)(!0),2),k=P[0],A=P[1],O=d((0,o.useState)(!1),2),x=O[0],T=O[1],j=d((0,o.useState)(""),2),_=j[0],I=j[1],C=(0,f.f1)(t,"auth.signin");return((0,s.rN)(n("Reset password")),(0,o.useEffect)(function(){var e=!0;if(!y){E(!0),A(!1);return}return t.apiClient.auth.checkResetToken({resetToken:y}).then(function(){e&&(E(!1),A(!1))}).catch(function(){e&&(E(!0),A(!1))}),function(){e=!1}},[t,y]),null==g||null==(e=g.options)?void 0:e.enableResetPassword)?k||y&&!S?a().createElement(r.Form,{form:b,layout:"vertical",onFinish:function(e){var o;return(o=function(){var o,a,i,u,c;return function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(i,"next",{value:c(0)}),u(i,"throw",{value:c(1)}),u(i,"return",{value:c(2)}),"function"==typeof Symbol&&u(i,Symbol.iterator,{value:function(){return this}}),i;function c(u){return function(c){var l=[u,c];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,r=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){a=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){a.label=l[1];break}if(6===l[0]&&a.label<o[1]){a.label=o[1],o=l;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(l);break}o[2]&&a.ops.pop(),a.trys.pop();continue}l=t.call(e,a)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(l){switch(l.label){case 0:I(""),T(!0),l.label=1;case 1:var s,f;return l.trys.push([1,3,4,5]),[4,t.apiClient.auth.resetPassword((s=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},e),f=f={resetToken:y},Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(f)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(f)).forEach(function(e){Object.defineProperty(s,e,Object.getOwnPropertyDescriptor(f,e))}),s))];case 2:return l.sent(),r.message.success(n("Password reset successful")),window.setTimeout(function(){p(C,{replace:!0})},1e3),[3,5];case 3:return I((null==(o=l.sent())||null==(c=o.response)||null==(u=c.data)||null==(i=u.errors)||null==(a=i[0])?void 0:a.message)||(null==o?void 0:o.message)||String(o)),[3,5];case 4:return T(!1),[7];case 5:return[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,r){var a=o.apply(e,t);function i(e){h(a,n,r,i,u,"next",e)}function u(e){h(a,n,r,i,u,"throw",e)}i(void 0)})})()}},_?a().createElement(r.Alert,{style:{marginBottom:16},type:"error",showIcon:!0,message:_}):null,a().createElement(r.Form.Item,{label:n("New password"),name:"password",rules:[{required:!0,message:n("Please enter new password")}]},a().createElement(r.Input.Password,{autoComplete:"new-password"})),a().createElement(r.Form.Item,{label:n("Confirm password"),name:"confirmPassword",dependencies:["password"],rules:[{required:!0,message:n("Please enter the same password again")},function(e){var t=e.getFieldValue;return{validator:function(e,r){return r&&t("password")!==r?Promise.reject(Error(n("The passwords entered twice are inconsistent"))):Promise.resolve()}}}]},a().createElement(r.Input.Password,{autoComplete:"new-password"})),a().createElement(r.Form.Item,{style:{marginBottom:12}},a().createElement(r.Button,{loading:x||k,htmlType:"submit",type:"primary",block:!0},n("Confirm"))),a().createElement(i.Link,{to:C},n("Go to login"))):a().createElement(r.Result,{status:"403",title:n("Reset link has expired"),extra:a().createElement(r.Button,{type:"primary",onClick:function(){return p(C)}},n("Go to login"))}):a().createElement(i.Navigate,{to:C,replace:!0})}},818:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return v}});var r=n(485),o=n(59),a=n(155),i=n.n(a),u=n(442),c=n(295),l=n(824),s=n(488),f=n(434);function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function h(e){var t=(0,r.usePlugin)(f.A);return(0,a.useMemo)(function(){var n={},r=!0,o=!1,a=void 0;try{for(var i,u=t.authTypes.getEntities()[Symbol.iterator]();!(r=(i=u.next()).done);r=!0){var c,l=(c=i.value,function(e){if(Array.isArray(e))return e}(c)||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],a=!0,i=!1;try{for(r=r.call(e);!(a=(t=r.next()).done)&&(o.push(t.value),2!==o.length);a=!0);}catch(e){i=!0,n=e}finally{try{a||null==r.return||r.return()}finally{if(i)throw n}}return o}}(c)||function(e){if(e){if("string"==typeof e)return p(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return p(e,2)}}(c)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),s=l[0],f=l[1][e];f&&(n[s]=f)}}catch(e){o=!0,a=e}finally{try{r||null==u.return||u.return()}finally{if(o)throw a}}return n},[t,e])}function d(e){var t=new Map;return function(n){if(e[n])return t.has(n)||t.set(n,(0,a.lazy)(e[n])),t.get(n)}}function v(){var e=(0,r.useApp)(),t=(0,r.usePlugin)(f.A),n=(0,u.useLocation)(),p=(0,u.useNavigate)(),v=(0,s.dE)().t,y=(0,s.kj)(),m=(0,a.useContext)(c.m),g=h("signInFormLoader"),b=h("signInButtonLoader"),w=(0,a.useMemo)(function(){return d(g)},[g]),S=(0,a.useMemo)(function(){return d(b)},[b]),E=t.getAuthRedirectFallbackPath(n.pathname);(0,l.rN)(v("Signin")),(0,a.useEffect)(function(){var t=new URLSearchParams(n.search),o=t.get("redirect"),a=(0,r.normalizeV2RedirectPath)(e,o,E);o!==a&&(t.set("redirect",a),p({pathname:n.pathname,search:"?".concat(t)},{replace:!0}))},[e,E,n.pathname,n.search,p]);var P=(0,a.useMemo)(function(){return m.map(function(e){var t=w(e.authType);if(!t)return null;var n=y(e.authTypeTitle||e.authType);return{key:e.name,label:e.title||"".concat(v("Sign-in")," (").concat(n,")"),children:i().createElement(a.Suspense,{fallback:i().createElement(o.Spin,null)},i().createElement(t,{authenticator:e}))}}).filter(Boolean)},[m,w,v,y]),k=(0,a.useMemo)(function(){return m.map(function(e,t){var n=S(e.authType);return n?i().createElement(a.Suspense,{key:"".concat(e.name,"-").concat(t),fallback:i().createElement(o.Spin,null)},i().createElement(n,{authenticator:e})):null}).filter(Boolean)},[m,S]);return m.length?i().createElement(o.Space,{direction:"vertical",style:{display:"flex"}},P.length>1?i().createElement(o.Tabs,{items:P}):P.length?P[0].children:null,k.length?i().createElement(o.Space,{direction:"vertical",style:{display:"flex"}},k):null):i().createElement(o.Empty,{description:v("No authentication methods available.")})}},872:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return h}});var r=n(485),o=n(59),a=n(155),i=n.n(a),u=n(442),c=n(295),l=n(824),s=n(488),f=n(434);function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function h(){var e,t=(0,s.dE)().t,n=((function(e){if(Array.isArray(e))return e})(e=(0,u.useSearchParams)())||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],a=!0,i=!1;try{for(r=r.call(e);!(a=(t=r.next()).done)&&(o.push(t.value),1!==o.length);a=!0);}catch(e){i=!0,n=e}finally{try{a||null==r.return||r.return()}finally{if(i)throw n}}return o}}(e)||function(e){if(e){if("string"==typeof e)return p(e,1);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return p(e,1)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0].get("name"),h=(0,c.p)(n),d=(0,r.usePlugin)(f.A),v=(0,a.useMemo)(function(){if(!h)return null;var e,t=null==(e=d.authTypes.get(h.authType))?void 0:e.signUpFormLoader;return t?(0,a.lazy)(t):null},[h,d]);return((0,l.rN)(t("Signup")),h&&v)?i().createElement(a.Suspense,{fallback:i().createElement(o.Spin,null)},i().createElement(v,{authenticatorName:h.name})):i().createElement(o.Empty,{description:t("No authentication methods available.")})}},434:function(e,t,n){"use strict";n.d(t,{A:function(){return j},T:function(){return T}});var r=n(768),o=n(485),a=n(738),i=n.n(a),u=n(927),c=n(258),l=n(488);function s(e,t,n,r,o,a,i){try{var u=e[a](i),c=u.value}catch(e){n(e);return}u.done?t(c):Promise.resolve(c).then(r,o)}function f(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){s(a,r,o,i,u,"next",e)}function u(e){s(a,r,o,i,u,"throw",e)}i(void 0)})}}function p(e,t,n){return t=g(t),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e,E()?Reflect.construct(t,n||[],g(e).constructor):t.apply(e,n))}function h(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function d(e,t,n){return(d=E()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&w(o,n.prototype),o}).apply(null,arguments)}function v(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function y(e,t,n){return t&&v(e.prototype,t),n&&v(e,n),e}function m(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g(e){return(g=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function b(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&w(e,t)}function w(e,t){return(w=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function S(e){var t="function"==typeof Map?new Map:void 0;return(S=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return d(e,arguments,g(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),w(n,e)})(e)}function E(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(E=function(){return!!e})()}function P(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(i,"next",{value:c(0)}),u(i,"throw",{value:c(1)}),u(i,"return",{value:c(2)}),"function"==typeof Symbol&&u(i,Symbol.iterator,{value:function(){return this}}),i;function c(u){return function(c){var l=[u,c];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,r=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){a=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){a.label=l[1];break}if(6===l[0]&&a.label<o[1]){a.label=o[1],o=l;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(l);break}o[2]&&a.ops.pop(),a.trys.pop();continue}l=t.call(e,a)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var k=function(e){function t(){var e;return h(this,t),e=p(this,t,arguments),m(e,"section","preferences"),m(e,"sort",350),m(e,"label","Language"),e}return b(t,e),y(t,[{key:"prepare",value:function(){return f(function(){var e,t,n,r,a;return P(this,function(i){switch(i.label){case 0:return[4,this.context.systemSettings.load()];case 1:return a=(null==(r=i.sent())||null==(e=r.data)?void 0:e.enabledLanguages)||[],this.options=a.map(function(e){var t;return{value:e,label:(null==(t=o.languageCodes[e])?void 0:t.label)||e}}),this.value=(null==(t=(n=this.context.app.apiClient.auth).getLocale)?void 0:t.call(n))||this.context.app.apiClient.auth.locale,this.ready=this.options.length>1,[2]}})}).call(this)}},{key:"onChange",value:function(e){return f(function(){return P(this,function(t){return this.context.app.apiClient.auth.setLocale(e),window.location.reload(),[2]})}).call(this)}}]),t}(o.UserCenterSelectItemModel);function A(e){var t="/".concat(e.trim().replace(/^\/+|\/+$/g,""));return"/"===t?t:t.replace(/\/+$/g,"")}m(k,"itemId","language");var O={EMPTY_TOKEN:"EMPTY_TOKEN",EXPIRED_TOKEN:"EXPIRED_TOKEN",INVALID_TOKEN:"INVALID_TOKEN",TOKEN_RENEW_FAILED:"TOKEN_RENEW_FAILED",BLOCKED_TOKEN:"BLOCKED_TOKEN",EXPIRED_SESSION:"EXPIRED_SESSION",NOT_EXIST_USER:"NOT_EXIST_USER",SKIP_TOKEN_RENEW:"SKIP_TOKEN_RENEW",USER_HAS_NO_ROLES_ERR:"USER_HAS_NO_ROLES_ERR"},x=i()(function(e){e()},3e3,{leading:!0,trailing:!1}),T=function(e){function t(){var e;return h(this,t),e=p(this,t,arguments),m(e,"authTypes",new r.Registry),m(e,"authRouteScopes",new Map),e}return b(t,e),y(t,[{key:"registerType",value:function(e,t){this.authTypes.register(e,t)}},{key:"registerSignInRoute",value:function(e,t){this.router.add("auth.".concat(e),{path:t,skipAuthCheck:!0,componentLoader:function(){return Promise.resolve().then(n.bind(n,818))}})}},{key:"registerAuthRouteScope",value:function(e,t,r){var o=A(t),a="/"===o?"":o,i={basePath:o,"auth.signin":"".concat(a,"/signin"),"auth.signup":"".concat(a,"/signup")};this.authRouteScopes.set(e,i),this.registerSignInRoute((null==r?void 0:r.signin)||"".concat(e,"Signin"),i["auth.signin"]),this.router.add("auth.".concat((null==r?void 0:r.signup)||"".concat(e,"Signup")),{path:i["auth.signup"],skipAuthCheck:!0,componentLoader:function(){return Promise.resolve().then(n.bind(n,872))}})}},{key:"getAuthRoutePath",value:function(e,t){var n=A(e),r=!0,o=!1,a=void 0;try{for(var i,c=this.authRouteScopes.values()[Symbol.iterator]();!(r=(i=c.next()).done);r=!0){var l=i.value;if(l["auth.signin"]===n||l["auth.signup"]===n)return"auth.signin"===t||"auth.signup"===t?l[t]:(0,u.f1)(this.app,t)}}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}return(0,u.f1)(this.app,t)}},{key:"isScopedAuthRoute",value:function(e){var t=A(e),n=!0,r=!1,o=void 0;try{for(var a,i=this.authRouteScopes.values()[Symbol.iterator]();!(n=(a=i.next()).done);n=!0){var u=a.value;if(u["auth.signin"]===t||u["auth.signup"]===t)return!0}}catch(e){r=!0,o=e}finally{try{n||null==i.return||i.return()}finally{if(r)throw o}}return!1}},{key:"getAuthRedirectFallbackPath",value:function(e){var t=A(e),n=!0,r=!1,o=void 0;try{for(var a,i=this.authRouteScopes.values()[Symbol.iterator]();!(n=(a=i.next()).done);n=!0){var c=a.value;if(c["auth.signin"]===t)return c.basePath}}catch(e){r=!0,o=e}finally{try{n||null==i.return||i.return()}finally{if(r)throw o}}return(0,u.Fo)(this.app)}},{key:"load",value:function(){return f(function(){return P(this,function(e){return this.app.providers.unshift([c.A,{}]),this.app.flowEngine.registerModels({UserCenterLanguageItemModel:k}),this.addRoutes(),this.registerPresetAuthType(),this.registerSettingsPages(),this.installInterceptors(),[2]})}).call(this)}},{key:"registerSettingsPages",value:function(){var e=this,t=function(t){return e.app.i18n.t(t,{ns:l.CU})};this.pluginSettingsManager.addMenuItem({key:l.CU,title:t("Authentication"),icon:"LoginOutlined",aclSnippet:"pm.auth"}),this.pluginSettingsManager.addPageTabItem({menuKey:l.CU,key:"authenticators",title:t("Authenticators"),icon:"LoginOutlined",aclSnippet:"pm.auth.authenticators",sort:1,componentLoader:function(){return n.e("9").then(n.bind(n,648))}}),this.pluginSettingsManager.addPageTabItem({menuKey:"security",key:"token-policy",title:t("Token policy"),icon:"ApiOutlined",aclSnippet:"pm.security.token-policy",sort:0,componentLoader:function(){return n.e("657").then(n.bind(n,632))}})}},{key:"addRoutes",value:function(){this.router.add("auth",{componentLoader:function(){return Promise.resolve().then(n.bind(n,829))}}),this.router.add("auth.signin",{path:"/signin",skipAuthCheck:!0,componentLoader:function(){return Promise.resolve().then(n.bind(n,818))}}),this.router.add("auth.signup",{path:"/signup",skipAuthCheck:!0,componentLoader:function(){return Promise.resolve().then(n.bind(n,872))}}),this.router.add("auth.forgotPassword",{path:"/forgot-password",skipAuthCheck:!0,componentLoader:function(){return Promise.resolve().then(n.bind(n,826))}}),this.router.add("auth.resetPassword",{path:"/reset-password",skipAuthCheck:!0,componentLoader:function(){return Promise.resolve().then(n.bind(n,622))}})}},{key:"registerPresetAuthType",value:function(){this.registerType("Email/Password",{signInFormLoader:function(){return n.e("795").then(n.bind(n,918))},signUpFormLoader:function(){return n.e("841").then(n.bind(n,720))},adminSettingsFormLoader:function(){return n.e("217").then(n.bind(n,264))}})}},{key:"installInterceptors",value:function(){var e=this;this.app.apiClient.axios.interceptors.response.handlers.unshift({fulfilled:function(t){var n,r=null==t||null==(n=t.headers)?void 0:n["x-new-token"];return r&&e.app.apiClient.auth.setToken(r),t},rejected:function(t){var n,r,a,i,c,l,s,f,p=null==t||null==(r=t.response)||null==(n=r.headers)?void 0:n["x-new-token"],h=null==t||null==(i=t.response)||null==(a=i.data)?void 0:a.errors,d=Array.isArray(h)?h[0]:null,v=(null==(l=e.app.router.router)||null==(c=l.state)?void 0:c.location)||window.location,y=(null==v?void 0:v.pathname)||window.location.pathname,m=(null==t?void 0:t.status)||(null==t||null==(s=t.response)?void 0:s.status);if(p&&e.app.apiClient.auth.setToken(p),401===m&&(null==d?void 0:d.code)&&O[null==d?void 0:d.code]&&(e.app.apiClient.auth.setToken(""),e.app.apiClient.auth.setRole(""),e.app.apiClient.auth.setAuthenticator("")),401===m&&!(null==(f=t.config)?void 0:f.skipAuth)&&(null==d?void 0:d.code)&&O[null==d?void 0:d.code]){if((null==d?void 0:d.code)===O.SKIP_TOKEN_RENEW)throw t;var g=e.app.router.isSkippedAuthCheckRoute(y);if(g&&(t.config.skipNotify=!0),!g){var b=(0,o.getCurrentV2RedirectPath)(e.app,v);return x(function(){if(e.app.apiClient.auth.setToken(""),(0,u.Py)(e.app))(0,o.redirectToV2Signin)(e.app,b);else{var t=(0,o.resolveUnauthenticatedSignInRoute)(e.app,y);e.app.router.navigate("".concat(t,"?redirect=").concat(encodeURIComponent(b)),{replace:!0})}}),new Promise(function(){})}}throw t},synchronous:!1,runWhen:null})}}]),t}(S(o.Plugin)),j=T},258:function(e,t,n){"use strict";var r=n(485),o=n(155),a=n.n(o),i=n(442);t.A=function(e){var t=e.children,n=(0,r.useApp)(),u=(0,i.useNavigate)(),c=(0,i.useLocation)();return(0,o.useEffect)(function(){var e=new URLSearchParams(c.search),t=e.get("token"),r=e.get("authenticator");if(t){n.apiClient.auth.setToken(t),n.apiClient.auth.setAuthenticator(r),e.delete("token"),e.delete("authenticator");var o=e.toString();u({pathname:c.pathname,search:o?"?".concat(o):""},{replace:!0})}},[n,c.pathname,c.search,u]),a().createElement(a().Fragment,null,t)}},89:function(e,t,n){"use strict";var r=n(59),o=n(155),a=n.n(o),i=n(485),u=n(295);function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}t.A=function(e){var t,n,l=e.children,s=(0,i.useApp)(),f=function(e){if(Array.isArray(e))return e}(t=(0,o.useState)({authenticators:[],error:null,loading:!0}))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],a=!0,i=!1;try{for(r=r.call(e);!(a=(t=r.next()).done)&&(o.push(t.value),2!==o.length);a=!0);}catch(e){i=!0,n=e}finally{try{a||null==r.return||r.return()}finally{if(i)throw n}}return o}}(t)||function(e){if(e){if("string"==typeof e)return c(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return c(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),p=f[0],h=f[1];return((0,o.useEffect)(function(){var e=!0;return s.apiClient.resource("authenticators").publicList().then(function(t){var n;e&&h({authenticators:(null==t||null==(n=t.data)?void 0:n.data)||[],error:null,loading:!1})}).catch(function(t){e&&h({authenticators:[],error:t,loading:!1})}),function(){e=!1}},[s]),p.loading)?a().createElement("div",{style:{textAlign:"center",marginTop:20}},a().createElement(r.Spin,null)):p.error?a().createElement(r.Alert,{type:"error",showIcon:!0,message:(null==(n=p.error)?void 0:n.message)||"Failed to load authenticators"}):a().createElement(u.m.Provider,{value:p.authenticators},l)}},927:function(e,t,n){"use strict";n.d(t,{Fo:function(){return i},Py:function(){return a},f1:function(){return o}});var r={"auth.signin":"/signin","auth.signup":"/signup","auth.forgotPassword":"/forgot-password","auth.resetPassword":"/reset-password"};function o(e,t){var n,o=null==(n=e.router.get(t))?void 0:n.path;return"string"==typeof o?o:r[t]}function a(e){return"settings."===e.pluginSettingsManager.getRouteName("")}function i(e){return a(e)?e.pluginSettingsManager.getRoutePath(""):"/"}},295:function(e,t,n){"use strict";n.d(t,{m:function(){return o},p:function(){return a}});var r=n(155),o=(0,r.createContext)([]);o.displayName="AuthenticatorsContext";var a=function(e){return(0,r.useContext)(o).find(function(t){return t.name===e})}},824:function(e,t,n){"use strict";n.d(t,{go:function(){return p},rN:function(){return f},wn:function(){return s}});var r=n(155),o=n(442),a=n(485),i=n(927);function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function c(e,t,n,r,o,a,i){try{var u=e[a](i),c=u.value}catch(e){n(e);return}u.done?t(c):Promise.resolve(c).then(r,o)}function l(e){var t=new URL("/".concat(String(e||"/").trim()).replace(/\/{2,}/g,"/"),window.location.origin).pathname;return"/"===t?t:t.replace(/\/+$/,"")}function s(e){var t,n=(0,a.useApp)(),c=(0,o.useNavigate)(),s=(function(e){if(Array.isArray(e))return e}(t=(0,o.useSearchParams)())||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],a=!0,i=!1;try{for(r=r.call(e);!(a=(t=r.next()).done)&&(o.push(t.value),1!==o.length);a=!0);}catch(e){i=!0,n=e}finally{try{a||null==r.return||r.return()}finally{if(i)throw n}}return o}}(t)||function(e){if(e){if("string"==typeof e)return u(e,1);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return u(e,1)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0];return(0,r.useCallback)(function(){var t,r,o=s.get("redirect"),u=e||(0,i.Fo)(n),f=o||void 0===e&&(0,i.Py)(n)?(0,a.normalizeV2RedirectPath)(n,o,u):u;!function(e,t){if(!t.startsWith("/")||t.startsWith("//")||t.startsWith("/\\"))return!1;var n,r,o,a,u,c,s=null==(u=(c=e.router).getBasename)?void 0:u.call(c),f=l(e.getPublicPath()),p=(r=l(f).replace(/\/+$/,""),o=l(s||"/"),a=r&&(o===r||o.startsWith("".concat(r,"/")))?o.slice(r.length)||"/":o,(null==(n=/^\/settings(\/(?:apps|_app)\/[^/]+)(?=\/|$)/.exec(a))?void 0:n[1])||""),h=f.split("/");(0,i.Py)(e)||h.pop();var d=l(h.join("/")||"/").replace(/\/+$/,""),v=p?"".concat(d,"/settings").concat(p):"".concat(d,"/settings")||"/settings",y=l(t.split(/[?#]/)[0]);return y===v||y.startsWith("".concat(v,"/"))}(n,f)?c(function(e,t){if(!t||"/"===t)return e.startsWith("/")?e:"/".concat(e);var n=t.endsWith("/")?t.slice(0,-1):t;return e===n?"/":e.startsWith("".concat(n,"/"))?e.slice(n.length)||"/":e}(f,null==(t=(r=n.router).getBasename)?void 0:t.call(r)),{replace:!0}):window.location.replace(f)},[n,c,e,s])}function f(e){(0,r.useEffect)(function(){document.title=e},[e])}function p(e){var t=(0,a.useApp)(),n=s();return{run:function(r){var o;return(o=function(){return function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(i,"next",{value:c(0)}),u(i,"throw",{value:c(1)}),u(i,"return",{value:c(2)}),"function"==typeof Symbol&&u(i,Symbol.iterator,{value:function(){return this}}),i;function c(u){return function(c){var l=[u,c];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,r=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){a=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){a.label=l[1];break}if(6===l[0]&&a.label<o[1]){a.label=o[1],o=l;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(l);break}o[2]&&a.ops.pop(),a.trys.pop();continue}l=t.call(e,a)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(o){switch(o.label){case 0:return[4,t.apiClient.auth.signIn(r,e)];case 1:return o.sent(),[4,t.apiClient.request({url:"/auth:check",skipAuth:!0,skipNotify:!0}).catch(function(){})];case 2:return o.sent(),n(),[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,r){var a=o.apply(e,t);function i(e){c(a,n,r,i,u,"next",e)}function u(e){c(a,n,r,i,u,"throw",e)}i(void 0)})})()}}}},488:function(e,t,n){"use strict";n.d(t,{CU:function(){return a},dE:function(){return i},kj:function(){return u}});var r=n(694),o=n(953),a="auth";function i(){return(0,o.useTranslation)([a,"client"],{nsMode:"fallback"})}function u(){var e=(0,r.useFlowEngine)();return function(t){return e.context.t(t,{ns:[a,"client"],nsMode:"fallback"})}}},375:function(e){"use strict";e.exports=r},230:function(e){"use strict";e.exports=n},485:function(e){"use strict";e.exports=i},694:function(e){"use strict";e.exports=o},768:function(e){"use strict";e.exports=l},6:function(e){"use strict";e.exports=a},59:function(e){"use strict";e.exports=c},773:function(e){"use strict";e.exports=s},155:function(e){"use strict";e.exports=u},953:function(t){"use strict";t.exports=e},442:function(e){"use strict";e.exports=t}},v={};function y(e){var t=v[e];if(void 0!==t)return t.exports;var n=v[e]={exports:{}};return d[e](n,n.exports,y),n.exports}y.m=d,y.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return y.d(t,{a:t}),t},y.d=function(e,t){for(var n in t)y.o(t,n)&&!y.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},y.f={},y.e=function(e){return Promise.all(Object.keys(y.f).reduce(function(t,n){return y.f[n](e,t),t},[]))},y.u=function(e){return""+e+"."+({217:"1510705562d97555",657:"2a9dcca9ddc31ec0",795:"8e4b138118e322ab",841:"9fafcb7049bfe687",9:"c10c60a4ecc4256d"})[e]+".js"},y.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),y.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},m={},y.l=function(e,t,n,r){if(m[e])return void m[e].push(t);if(void 0!==n)for(var o,a,i=document.getElementsByTagName("script"),u=0;u<i.length;u++){var c=i[u];if(c.getAttribute("src")==e||c.getAttribute("data-rspack")=="@nocobase/plugin-auth/client-v2:"+n){o=c;break}}o||(a=!0,(o=document.createElement("script")).timeout=120,y.nc&&o.setAttribute("nonce",y.nc),o.setAttribute("data-rspack","@nocobase/plugin-auth/client-v2:"+n),o.src=e),m[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=m[e];if(delete m[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),a&&document.head.appendChild(o)},y.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},y.g.importScripts&&(g=y.g.location+"");var m,g,b=y.g.document;if(!g&&b&&(b.currentScript&&"SCRIPT"===b.currentScript.tagName.toUpperCase()&&(g=b.currentScript.src),!g)){var w=b.getElementsByTagName("script");if(w.length)for(var S=w.length-1;S>-1&&(!g||!/^http(s?):/.test(g));)g=w[S--].src}if(!g)throw Error("Automatic publicPath is not supported in this browser");y.p=g.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),f={889:0},y.f.j=function(e,t){var n=y.o(f,e)?f[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=f[e]=[t,r]});t.push(n[2]=r);var o=y.p+y.u(e),a=Error();y.l(o,function(t){if(y.o(f,e)&&(0!==(n=f[e])&&(f[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;a.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",a.name="ChunkLoadError",a.type=r,a.request=o,n[1](a)}},"chunk-"+e,e)}},p=function(e,t){var n,r,o=t[0],a=t[1],i=t[2],u=0;if(o.some(function(e){return 0!==f[e]})){for(n in a)y.o(a,n)&&(y.m[n]=a[n]);i&&i(y)}for(e&&e(t);u<o.length;u++)r=o[u],y.o(f,r)&&f[r]&&f[r][0](),f[r]=0},(h=self.webpackChunk_nocobase_plugin_auth_client_v2=self.webpackChunk_nocobase_plugin_auth_client_v2||[]).forEach(p.bind(null,0)),h.push=p.bind(null,h.push.bind(h));var E={};return!function(){"use strict";var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src){var n=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");n.indexOf("/static/plugins/@nocobase/plugin-auth/dist/client-v2/")>=0&&(e=n.replace(/\/[^\/]+$/,"/"))}if(!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/@nocobase/plugin-auth/dist/client-v2/")}if(!e){var o=window.__nocobase_modern_client_prefix__||"v",a="/"+(o=String(o).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var i=window.location.pathname||"/",u=i.indexOf(a);e=u>=0?i.slice(0,u+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-auth/dist/client-v2/"}y.p=e}(),!function(){"use strict";y.r(E),y.d(E,{AuthLayout:function(){return o.default},AuthProvider:function(){return l.A},AuthenticatorsContext:function(){return t.m},AuthenticatorsContextProvider:function(){return s.A},ForgotPasswordPage:function(){return u.default},NAMESPACE:function(){return n.CU},PluginAuthClientV2:function(){return e.T},ResetPasswordPage:function(){return c.default},SignInPage:function(){return a.default},SignUpPage:function(){return i.default},default:function(){return e.A},useAuthTranslation:function(){return n.dE},useAuthenticator:function(){return t.p},useDocumentTitle:function(){return r.rN},useRedirect:function(){return r.wn},useSignIn:function(){return r.go},useT:function(){return n.kj}});var e=y(434),t=y(295),n=y(488),r=y(824),o=y(829),a=y(818),i=y(872),u=y(826),c=y(622),l=y(258),s=y(89)}(),E}()});
|
|
@@ -9,9 +9,14 @@
|
|
|
9
9
|
import type { ComponentType } from 'react';
|
|
10
10
|
import { Plugin } from '@nocobase/client-v2';
|
|
11
11
|
import type { Authenticator as AuthenticatorType } from './authenticator';
|
|
12
|
+
import { type AuthRouteName } from './authRoutePaths';
|
|
12
13
|
type LoaderOf<P = Record<string, never>> = () => Promise<{
|
|
13
14
|
default: ComponentType<P>;
|
|
14
15
|
}>;
|
|
16
|
+
type AuthRouteScopeNames = {
|
|
17
|
+
signin?: string;
|
|
18
|
+
signup?: string;
|
|
19
|
+
};
|
|
15
20
|
/**
|
|
16
21
|
* V2 auth-type registration. Every form/button is registered as an async `import()` loader rather than a synchronous component reference. Consumers resolve them with `React.lazy` at render time so each auth-type contributes its own webpack chunk and is only fetched when an authenticator of that type is actually shown.
|
|
17
22
|
*
|
|
@@ -37,8 +42,13 @@ export type AuthOptions = {
|
|
|
37
42
|
};
|
|
38
43
|
export declare class PluginAuthClientV2 extends Plugin {
|
|
39
44
|
authTypes: any;
|
|
45
|
+
private authRouteScopes;
|
|
40
46
|
registerType(authType: string, options: AuthOptions): void;
|
|
41
47
|
registerSignInRoute(name: string, path: string): void;
|
|
48
|
+
registerAuthRouteScope(name: string, basePath: string, routeNames?: AuthRouteScopeNames): void;
|
|
49
|
+
getAuthRoutePath(pathname: string, name: AuthRouteName): string;
|
|
50
|
+
isScopedAuthRoute(pathname: string): boolean;
|
|
51
|
+
getAuthRedirectFallbackPath(pathname: string): string;
|
|
42
52
|
load(): Promise<void>;
|
|
43
53
|
private registerSettingsPages;
|
|
44
54
|
private addRoutes;
|
package/dist/externalVersion.js
CHANGED
|
@@ -8,21 +8,21 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "3.0.0-alpha.
|
|
11
|
+
"@nocobase/client": "3.0.0-alpha.5",
|
|
12
12
|
"react": "18.2.0",
|
|
13
13
|
"react-router-dom": "6.30.1",
|
|
14
|
-
"@nocobase/utils": "3.0.0-alpha.
|
|
14
|
+
"@nocobase/utils": "3.0.0-alpha.5",
|
|
15
15
|
"axios": "1.7.7",
|
|
16
16
|
"lodash": "4.18.1",
|
|
17
|
-
"@nocobase/client-v2": "3.0.0-alpha.
|
|
18
|
-
"@nocobase/flow-engine": "3.0.0-alpha.
|
|
17
|
+
"@nocobase/client-v2": "3.0.0-alpha.5",
|
|
18
|
+
"@nocobase/flow-engine": "3.0.0-alpha.5",
|
|
19
19
|
"react-i18next": "11.18.6",
|
|
20
|
-
"@nocobase/auth": "3.0.0-alpha.
|
|
21
|
-
"@nocobase/database": "3.0.0-alpha.
|
|
22
|
-
"@nocobase/cache": "3.0.0-alpha.
|
|
23
|
-
"@nocobase/server": "3.0.0-alpha.
|
|
24
|
-
"@nocobase/logger": "3.0.0-alpha.
|
|
25
|
-
"@nocobase/test": "3.0.0-alpha.
|
|
20
|
+
"@nocobase/auth": "3.0.0-alpha.5",
|
|
21
|
+
"@nocobase/database": "3.0.0-alpha.5",
|
|
22
|
+
"@nocobase/cache": "3.0.0-alpha.5",
|
|
23
|
+
"@nocobase/server": "3.0.0-alpha.5",
|
|
24
|
+
"@nocobase/logger": "3.0.0-alpha.5",
|
|
25
|
+
"@nocobase/test": "3.0.0-alpha.5",
|
|
26
26
|
"@formily/antd-v5": "1.2.3",
|
|
27
27
|
"antd": "5.24.2",
|
|
28
28
|
"@formily/shared": "2.3.7",
|
|
@@ -30,6 +30,6 @@ module.exports = {
|
|
|
30
30
|
"@emotion/css": "11.13.0",
|
|
31
31
|
"@ant-design/icons": "5.6.1",
|
|
32
32
|
"ahooks": "3.7.8",
|
|
33
|
-
"@nocobase/actions": "3.0.0-alpha.
|
|
33
|
+
"@nocobase/actions": "3.0.0-alpha.5",
|
|
34
34
|
"@formily/core": "2.3.7"
|
|
35
35
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"cron","description":"Cron jobs for your node","version":"2.4.4","author":"Nick Campbell <nicholas.j.campbell@gmail.com> (https://github.com/ncb000gt)","bugs":{"url":"https://github.com/kelektiv/node-cron/issues"},"repository":{"type":"git","url":"https://github.com/kelektiv/node-cron.git"},"main":"lib/cron","scripts":{"lint":"eslint {lib,tests}/*.js","test":"jest --coverage","test:watch":"jest --watch --coverage","test:types":"tsd","prepare":"husky install","release":"semantic-release"},"types":"types/index.d.ts","dependencies":{"@types/luxon":"~3.3.0","luxon":"~3.3.0"},"devDependencies":{"@commitlint/cli":"~17.6.6","@insurgentlab/commitlint-config":"^18.1.0","@insurgentlab/conventional-changelog-preset":"~6.0.3","@semantic-release/changelog":"~6.0.x","@semantic-release/commit-analyzer":"~9.0.x","@semantic-release/git":"~10.0.x","@semantic-release/github":"~8.1.x","@semantic-release/npm":"~10.0.x","@semantic-release/release-notes-generator":"~11.0.x","chai":"~4.2.x","eslint":"~8.36.x","eslint-config-prettier":"^8.7.x","eslint-config-standard":"~17.0.x","eslint-plugin-import":"~2.27.x","eslint-plugin-jest":"~27.2.x","eslint-plugin-n":"~15.6.x","eslint-plugin-prettier":"~4.2.x","eslint-plugin-promise":"~6.1.x","husky":"^8.0.3","jest":"~29.5.x","prettier":"~2.8.x","semantic-release":"~21.0.x","sinon":"^15.0.x","tsd":"^0.28.1"},"keywords":["cron","node cron","node-cron","schedule","scheduler","cronjob","cron job"],"license":"MIT","contributors":["Brandon der Blätter <https://interlucid.com/contact/> (https://github.com/intcreator)","Romain Beauxis <toots@rastageeks.org> (https://github.com/toots)","James Padolsey <> (https://github.com/jamespadolsey)","Finn Herpich <fh@three-heads.de> (https://github.com/ErrorProne)","Clifton Cunningham <clifton.cunningham@gmail.com> (https://github.com/cliftonc)","Eric Abouaf <eric.abouaf@gmail.com> (https://github.com/neyric)","humanchimp <morphcham@gmail.com> (https://github.com/humanchimp)","Craig Condon <craig@spiceapps.com> (https://github.com/spiceapps)","Dan Bear <daniel@hulu.com> (https://github.com/danhbear)","Vadim Baryshev <vadimbaryshev@gmail.com> (https://github.com/baryshev)","Leandro Ferrari <lfthomaz@gmail.com> (https://github.com/lfthomaz)","Gregg Zigler <greggzigler@gmail.com> (https://github.com/greggzigler)","Jordan Abderrachid <jabderrachid@gmail.com> (https://github.com/jordanabderrachid)","Masakazu Matsushita <matsukaz@gmail.com> (matsukaz)","Christopher Lunt <me@kirisu.co.uk> (https://github.com/kirisu)"],"jest":{"collectCoverage":true,"collectCoverageFrom":["lib/*.js"],"coverageThreshold":{"global":{"statements":80,"branches":80,"functions":70,"lines":80}}},"files":["lib","types","CHANGELOG.md","LICENSE","README.md"],"_lastModified":"2026-
|
|
1
|
+
{"name":"cron","description":"Cron jobs for your node","version":"2.4.4","author":"Nick Campbell <nicholas.j.campbell@gmail.com> (https://github.com/ncb000gt)","bugs":{"url":"https://github.com/kelektiv/node-cron/issues"},"repository":{"type":"git","url":"https://github.com/kelektiv/node-cron.git"},"main":"lib/cron","scripts":{"lint":"eslint {lib,tests}/*.js","test":"jest --coverage","test:watch":"jest --watch --coverage","test:types":"tsd","prepare":"husky install","release":"semantic-release"},"types":"types/index.d.ts","dependencies":{"@types/luxon":"~3.3.0","luxon":"~3.3.0"},"devDependencies":{"@commitlint/cli":"~17.6.6","@insurgentlab/commitlint-config":"^18.1.0","@insurgentlab/conventional-changelog-preset":"~6.0.3","@semantic-release/changelog":"~6.0.x","@semantic-release/commit-analyzer":"~9.0.x","@semantic-release/git":"~10.0.x","@semantic-release/github":"~8.1.x","@semantic-release/npm":"~10.0.x","@semantic-release/release-notes-generator":"~11.0.x","chai":"~4.2.x","eslint":"~8.36.x","eslint-config-prettier":"^8.7.x","eslint-config-standard":"~17.0.x","eslint-plugin-import":"~2.27.x","eslint-plugin-jest":"~27.2.x","eslint-plugin-n":"~15.6.x","eslint-plugin-prettier":"~4.2.x","eslint-plugin-promise":"~6.1.x","husky":"^8.0.3","jest":"~29.5.x","prettier":"~2.8.x","semantic-release":"~21.0.x","sinon":"^15.0.x","tsd":"^0.28.1"},"keywords":["cron","node cron","node-cron","schedule","scheduler","cronjob","cron job"],"license":"MIT","contributors":["Brandon der Blätter <https://interlucid.com/contact/> (https://github.com/intcreator)","Romain Beauxis <toots@rastageeks.org> (https://github.com/toots)","James Padolsey <> (https://github.com/jamespadolsey)","Finn Herpich <fh@three-heads.de> (https://github.com/ErrorProne)","Clifton Cunningham <clifton.cunningham@gmail.com> (https://github.com/cliftonc)","Eric Abouaf <eric.abouaf@gmail.com> (https://github.com/neyric)","humanchimp <morphcham@gmail.com> (https://github.com/humanchimp)","Craig Condon <craig@spiceapps.com> (https://github.com/spiceapps)","Dan Bear <daniel@hulu.com> (https://github.com/danhbear)","Vadim Baryshev <vadimbaryshev@gmail.com> (https://github.com/baryshev)","Leandro Ferrari <lfthomaz@gmail.com> (https://github.com/lfthomaz)","Gregg Zigler <greggzigler@gmail.com> (https://github.com/greggzigler)","Jordan Abderrachid <jabderrachid@gmail.com> (https://github.com/jordanabderrachid)","Masakazu Matsushita <matsukaz@gmail.com> (matsukaz)","Christopher Lunt <me@kirisu.co.uk> (https://github.com/kirisu)"],"jest":{"collectCoverage":true,"collectCoverageFrom":["lib/*.js"],"coverageThreshold":{"global":{"statements":80,"branches":80,"functions":70,"lines":80}}},"files":["lib","types","CHANGELOG.md","LICENSE","README.md"],"_lastModified":"2026-08-01T20:51:35.234Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"ms","version":"2.1.3","description":"Tiny millisecond conversion utility","repository":"vercel/ms","main":"./index","files":["index.js"],"scripts":{"precommit":"lint-staged","lint":"eslint lib/* bin/*","test":"mocha tests.js"},"eslintConfig":{"extends":"eslint:recommended","env":{"node":true,"es6":true}},"lint-staged":{"*.js":["npm run lint","prettier --single-quote --write","git add"]},"license":"MIT","devDependencies":{"eslint":"4.18.2","expect.js":"0.3.1","husky":"0.14.3","lint-staged":"5.0.0","mocha":"4.0.1","prettier":"2.0.5"},"_lastModified":"2026-
|
|
1
|
+
{"name":"ms","version":"2.1.3","description":"Tiny millisecond conversion utility","repository":"vercel/ms","main":"./index","files":["index.js"],"scripts":{"precommit":"lint-staged","lint":"eslint lib/* bin/*","test":"mocha tests.js"},"eslintConfig":{"extends":"eslint:recommended","env":{"node":true,"es6":true}},"lint-staged":{"*.js":["npm run lint","prettier --single-quote --write","git add"]},"license":"MIT","devDependencies":{"eslint":"4.18.2","expect.js":"0.3.1","husky":"0.14.3","lint-staged":"5.0.0","mocha":"4.0.1","prettier":"2.0.5"},"_lastModified":"2026-08-01T20:51:35.330Z"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-auth",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.5",
|
|
4
4
|
"main": "./dist/server/index.js",
|
|
5
5
|
"homepage": "https://docs.nocobase.com/handbook/auth",
|
|
6
6
|
"homepage.ru-RU": "https://docs-ru.nocobase.com/handbook/auth",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"description": "User authentication management, including password, SMS, and support for Single Sign-On (SSO) protocols, with extensibility.",
|
|
32
32
|
"description.ru-RU": "Управление аутентификацией пользователей: пароли, SMS, поддержка протоколов единого входа (SSO) и возможность расширения.",
|
|
33
33
|
"description.zh-CN": "用户认证管理,包括基础的密码认证、短信认证、SSO 协议的认证等,可扩展。",
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "82c7ed1cdb2f247c190582e34ee37f154cac0968",
|
|
35
35
|
"keywords": [
|
|
36
36
|
"Authentication",
|
|
37
37
|
"Security"
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
"use strict";(self.webpackChunk_nocobase_plugin_auth_client_v2=self.webpackChunk_nocobase_plugin_auth_client_v2||[]).push([["795"],{918:function(e,t,r){r.r(t),r.d(t,{default:function(){return y}});var n=r(59),a=r(485),o=r(155),l=r.n(o),u=r(442),s=r(488),i=r(824),c=r(927);function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function f(e,t,r,n,a,o,l){try{var u=e[o](l),s=u.value}catch(e){r(e);return}u.done?t(s):Promise.resolve(s).then(n,a)}function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],l=!0,u=!1;try{for(a=a.call(e);!(l=(r=a.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(e){u=!0,n=e}finally{try{l||null==a.return||a.return()}finally{if(u)throw n}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return m(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return m(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e){var t,r,m=e.authenticator,y=(0,a.useApp)(),d=(0,s.dE)().t,v=p(n.Form.useForm(),1)[0],h=p((0,o.useState)(""),2),b=h[0],g=h[1],w=p((0,o.useState)(!1),2),E=w[0],P=w[1],S=(0,i.go)(m.name),k=!!(null==m||null==(t=m.options)?void 0:t.allowSignUp),I=!!(null==m||null==(r=m.options)?void 0:r.enableResetPassword),_=(0,c.f1)(y,"auth.signup"),j=(0,c.f1)(y,"auth.forgotPassword");return l().createElement(n.Form,{form:v,layout:"vertical",onFinish:function(e){var t;return(t=function(){var t,r,n,a,o;return function(e,t){var r,n,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(l,"next",{value:s(0)}),u(l,"throw",{value:s(1)}),u(l,"return",{value:s(2)}),"function"==typeof Symbol&&u(l,Symbol.iterator,{value:function(){return this}}),l;function s(u){return function(s){var i=[u,s];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,i[0]&&(o=0)),o;)try{if(r=1,n&&(a=2&i[0]?n.return:i[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,i[1])).done)return a;switch(n=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,n=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===i[0]||2===i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]<a[3])){o.label=i[1];break}if(6===i[0]&&o.label<a[1]){o.label=a[1],a=i;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(i);break}a[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],n=0}finally{r=a=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}}(this,function(l){switch(l.label){case 0:g(""),P(!0),l.label=1;case 1:return l.trys.push([1,3,4,5]),[4,S.run(e)];case 2:return l.sent(),[3,5];case 3:return g((null==(t=l.sent())||null==(o=t.response)||null==(a=o.data)||null==(n=a.errors)||null==(r=n[0])?void 0:r.message)||(null==t?void 0:t.message)||String(t)),[3,5];case 4:return P(!1),[7];case 5:return[2]}})},function(){var e=this,r=arguments;return new Promise(function(n,a){var o=t.apply(e,r);function l(e){f(o,n,a,l,u,"next",e)}function u(e){f(o,n,a,l,u,"throw",e)}l(void 0)})})()}},b?l().createElement(n.Alert,{style:{marginBottom:16},type:"error",showIcon:!0,message:b}):null,l().createElement(n.Form.Item,{name:"account",rules:[{required:!0,message:d("Please enter your username or email")},{validator:function(e,t){return t?String(t).includes("@")?/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(String(t))?Promise.resolve():Promise.reject(Error(d("Please enter a valid email"))):/^[^@<>"'/]{1,50}$/.test(String(t))?Promise.resolve():Promise.reject(Error(d("Please enter a valid username"))):Promise.resolve()}}]},l().createElement(n.Input,{autoComplete:"username",placeholder:d("Username/Email")})),l().createElement(n.Form.Item,{name:"password",rules:[{required:!0,message:d("Please enter a password")}]},l().createElement(n.Input.Password,{autoComplete:"current-password",placeholder:d("Password")})),l().createElement(n.Form.Item,{style:{marginBottom:12}},l().createElement(n.Button,{loading:E,htmlType:"submit",type:"primary",block:!0},d("Sign in"))),l().createElement("div",{style:{display:"flex",justifyContent:"space-between",gap:12}},k?l().createElement(u.Link,{to:"".concat(_,"?name=").concat(m.name)},d("Create an account")):null,I?l().createElement(u.Link,{to:"".concat(j,"?name=").concat(m.name)},d("Forgot password")):null))}}}]);
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
"use strict";(self.webpackChunk_nocobase_plugin_auth_client_v2=self.webpackChunk_nocobase_plugin_auth_client_v2||[]).push([["841"],{720:function(e,t,r){r.r(t),r.d(t,{default:function(){return v}});var n=r(59),a=r(155),l=r.n(a),o=r(442),u=r(230),i=r(953),s=r(485),c=r(488),m=r(295),p=r(927);function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function d(e,t,r,n,a,l,o){try{var u=e[l](o),i=u.value}catch(e){r(e);return}u.done?t(i):Promise.resolve(i).then(n,a)}function h(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var l=[],o=!0,u=!1;try{for(a=a.call(e);!(o=(r=a.next()).done)&&(l.push(r.value),!t||l.length!==t);o=!0);}catch(e){u=!0,n=e}finally{try{o||null==a.return||a.return()}finally{if(u)throw n}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return f(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e){var t,r=e.authenticatorName,f=(0,s.useApp)(),v=(0,o.useNavigate)(),y=(0,c.dE)().t,b=(0,i.useTranslation)("lm-collections").t,g=(0,m.p)(r),w=h(n.Form.useForm(),1)[0],E=h((0,a.useState)(!1),2),S=E[0],k=E[1],I=h((0,a.useState)(""),2),x=I[0],P=I[1],A=(0,p.f1)(f,"auth.signin"),_=(0,a.useMemo)(function(){var e;return((null==g||null==(e=g.options)?void 0:e.signupForm)||[]).filter(function(e){return null==e?void 0:e.show})},[g]);return(null==g||null==(t=g.options)?void 0:t.allowSignUp)?l().createElement(n.Form,{form:w,layout:"vertical",onFinish:function(e){var t;return(t=function(){var t,a,l,o,u;return function(e,t){var r,n,a,l={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(o,"next",{value:i(0)}),u(o,"throw",{value:i(1)}),u(o,"return",{value:i(2)}),"function"==typeof Symbol&&u(o,Symbol.iterator,{value:function(){return this}}),o;function i(u){return function(i){var s=[u,i];if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(l=0)),l;)try{if(r=1,n&&(a=2&s[0]?n.return:s[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,s[1])).done)return a;switch(n=0,a&&(s=[2&s[0],a.value]),s[0]){case 0:case 1:a=s;break;case 4:return l.label++,{value:s[1],done:!1};case 5:l.label++,n=s[1],s=[0];continue;case 7:s=l.ops.pop(),l.trys.pop();continue;default:if(!(a=(a=l.trys).length>0&&a[a.length-1])&&(6===s[0]||2===s[0])){l=0;continue}if(3===s[0]&&(!a||s[1]>a[0]&&s[1]<a[3])){l.label=s[1];break}if(6===s[0]&&l.label<a[1]){l.label=a[1],a=s;break}if(a&&l.label<a[2]){l.label=a[2],l.ops.push(s);break}a[2]&&l.ops.pop(),l.trys.pop();continue}s=t.call(e,l)}catch(e){s=[6,e],n=0}finally{r=a=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}}(this,function(i){switch(i.label){case 0:P(""),k(!0),i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,f.apiClient.auth.signUp(e,r)];case 2:return i.sent(),n.message.success(y("Sign up successfully, and automatically jump to the sign in page")),window.setTimeout(function(){v(A,{replace:!0})},2e3),[3,5];case 3:return P((null==(t=i.sent())||null==(u=t.response)||null==(o=u.data)||null==(l=o.errors)||null==(a=l[0])?void 0:a.message)||(null==t?void 0:t.message)||String(t)),[3,5];case 4:return k(!1),[7];case 5:return[2]}})},function(){var e=this,r=arguments;return new Promise(function(n,a){var l=t.apply(e,r);function o(e){d(l,n,a,o,u,"next",e)}function u(e){d(l,n,a,o,u,"throw",e)}o(void 0)})})()}},x?l().createElement(n.Alert,{style:{marginBottom:16},type:"error",showIcon:!0,message:x}):null,_.map(function(e){var t,r,a,o,i,s;return a=(r=(null==e?void 0:e.uiSchema)||{})["x-component"],o=r.title?b(u.Schema.compile(r.title,{t:y})):e.field,i=[],e.required&&i.push({required:!0,message:y("Please enter ".concat(e.field))}),"email"===e.field&&i.push({type:"email",message:y("Please enter a valid email address")}),s=l().createElement(n.Input,null),(null==(t=r.enum)?void 0:t.length)?s=l().createElement(n.Select,{options:r.enum.map(function(e){return{label:e.label||e.value,value:e.value}})}):"Checkbox"===a?s=l().createElement(n.Checkbox,null):("Input.TextArea"===a||"TextArea"===a)&&(s=l().createElement(n.Input.TextArea,{rows:4})),l().createElement(n.Form.Item,{key:e.field,name:e.field,label:o,valuePropName:"Checkbox"===a?"checked":"value",rules:i},s)}),l().createElement(n.Form.Item,{label:y("Password"),name:"password",rules:[{required:!0,message:y("Please enter a password")}]},l().createElement(n.Input.Password,{autoComplete:"new-password"})),l().createElement(n.Form.Item,{label:y("Confirm password"),name:"confirm_password",dependencies:["password"],rules:[{required:!0,message:y("Please enter the same password again")},function(e){var t=e.getFieldValue;return{validator:function(e,r){return r&&t("password")!==r?Promise.reject(Error(y("The passwords entered twice are inconsistent"))):Promise.resolve()}}}]},l().createElement(n.Input.Password,{autoComplete:"new-password"})),l().createElement(n.Form.Item,{style:{marginBottom:12}},l().createElement(n.Button,{loading:S,htmlType:"submit",type:"primary",block:!0},y("Sign up"))),l().createElement(o.Link,{to:A},y("Log in with an existing account"))):l().createElement(o.Navigate,{to:"/not-found",replace:!0})}}}]);
|