@nocobase/plugin-auth 2.1.0-alpha.12 → 2.1.0-alpha.14

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.
@@ -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("@emotion/css"),require("react-router-dom"),require("@formily/antd-v5"),require("@formily/react"),require("@ant-design/icons"),require("@formily/shared"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/core"),require("@nocobase/utils/client")):"function"==typeof define&&define.amd?define("@nocobase/plugin-auth",["react-i18next","@emotion/css","react-router-dom","@formily/antd-v5","@formily/react","@ant-design/icons","@formily/shared","react","antd","@nocobase/client","@formily/core","@nocobase/utils/client"],t):"object"==typeof exports?exports["@nocobase/plugin-auth"]=t(require("react-i18next"),require("@emotion/css"),require("react-router-dom"),require("@formily/antd-v5"),require("@formily/react"),require("@ant-design/icons"),require("@formily/shared"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/core"),require("@nocobase/utils/client")):e["@nocobase/plugin-auth"]=t(e["react-i18next"],e["@emotion/css"],e["react-router-dom"],e["@formily/antd-v5"],e["@formily/react"],e["@ant-design/icons"],e["@formily/shared"],e.react,e.antd,e["@nocobase/client"],e["@formily/core"],e["@nocobase/utils/client"])}(self,function(e,t,n,r,o,i,a,u,c,l,s,p){return function(){var f,d,m,y={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,p,f,d,m=0,y=!1,v=!1,b=!0;if("function"!=typeof e)throw TypeError("Expected a function");function h(t){var n=c,r=l;return c=l=void 0,m=t,p=e.apply(r,n)}function g(e){var n=e-d,r=e-m;return void 0===d||n>=t||n<0||v&&r>=s}function x(){var e,n,r,i=o();if(g(i))return w(i);f=setTimeout(x,(e=i-d,n=i-m,r=t-e,v?u(r,s-n):r))}function w(e){return(f=void 0,b&&c)?h(e):(c=l=void 0,p)}function S(){var e,n=o(),r=g(n);if(c=arguments,l=this,d=n,r){if(void 0===f)return m=e=d,f=setTimeout(x,t),y?h(e):p;if(v)return clearTimeout(f),f=setTimeout(x,t),h(d)}return void 0===f&&(f=setTimeout(x,t)),p}return t=i(t)||0,r(n)&&(y=!!n.leading,s=(v="maxWait"in n)?a(i(n.maxWait)||0,t):s,b="trailing"in n?!!n.trailing:b),S.cancel=function(){void 0!==f&&clearTimeout(f),m=0,c=d=l=f=void 0},S.flush=function(){return void 0===f?p:w(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}},574:function(e,t,n){"use strict";n.r(t),n.d(t,{AuthLayout:function(){return z},default:function(){return G},useRedirect:function(){return i.useRedirect},PluginAuthClient:function(){return H},AuthenticatorsContext:function(){return v.m},useAuthenticator:function(){return v.p},AuthenticatorsContextProvider:function(){return K},useSignIn:function(){return i.useSignIn}});var r=n(342),o=n(768),i=n(751),a=n(738),u=n.n(a),c={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"},l=u()(function(e){e()},3e3,{leading:!0,trailing:!1}),s=n(872),p=n(230),f=n(155),d=n.n(f),m=n(59),y=n(442),v=n(706);function b(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,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 g(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 b(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 b(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.")}()}var x=function(){var e,t=(0,s.dE)().t,n=g((0,y.useSearchParams)(),1)[0].get("name"),o=(0,v.p)(n);return(null==o||null==(e=o.options)?void 0:e.enableResetPassword)?d().createElement(r.SchemaComponent,{schema:{type:"object",name:"forgotPasswordForm","x-component":"FormV2",properties:{email:{type:"string","x-component":"Input",title:'{{t("Reset password")}}',required:!0,"x-validator":"{{(value) => {\n if (!value) {\n return '';\n }\n if (!/^[\\w-]+(\\.[\\w-]+)*@[\\w-]+(\\.[\\w-]+)+$/.test(value)) {\n return t(\"Please enter a valid email\");\n }\n }}}","x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Please enter your email")}}',style:{}}},actions:{type:"void","x-component":"div",properties:{submit:{title:'{{t("Send reset email")}}',type:"void","x-component":"Action","x-component-props":{htmlType:"submit",block:!0,type:"primary",useAction:function(){var e=(0,p.useForm)(),t=(0,r.useAPIClient)(),n=(0,s.dE)().t,o=g(d().useState(!1),2),i=o[0],a=o[1];return{run:function(){var r;return(r=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(r){switch(r.label){case 0:return[4,e.submit()];case 1:r.sent(),a(!0),r.label=2;case 2:return r.trys.push([2,,4,5]),[4,t.auth.lostPassword(e.values)];case 3:return r.sent(),[3,5];case 4:return a(!1),[7];case 5:return m.message.success(n("Reset email sent successfully")),e.reset(),[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,o){var i=r.apply(e,t);function a(e){h(i,n,o,a,u,"next",e)}function u(e){h(i,n,o,a,u,"throw",e)}a(void 0)})})()},loading:i}}}}}},signUp:{type:"void","x-component":"Link","x-component-props":{to:"/signin"},"x-content":'{{t("Back to login")}}'}}},scope:{t:t}}):d().createElement(y.Navigate,{to:"/not-found",replace:!0})};function w(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 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 P(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 w(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 w(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.")}()}var O=function(){var e,t=(0,s.dE)().t,n=(0,r.useAPIClient)(),o=P((0,y.useSearchParams)(),1)[0],i=o.get("resetToken"),a=(0,r.useNavigateNoUpdate)(),u=P(d().useState(!1),2),c=u[0],l=u[1],b=o.get("name"),h=(0,v.p)(b);return((0,f.useEffect)(function(){n.auth.checkResetToken({resetToken:i}).then(function(){l(!1)}).catch(function(e){l(!0)})},[]),null==h||null==(e=h.options)?void 0:e.enableResetPassword)?!i||c?d().createElement(m.Result,{status:"403",title:t("Reset link has expired"),extra:d().createElement(m.Button,{type:"primary",onClick:function(){return a("/signin")}},t("Go to login"))}):d().createElement(r.SchemaComponent,{schema:{type:"object",name:"resetPasswordForm","x-component":"FormV2",properties:{password:{type:"string","x-component":"Password",title:'{{t("New password")}}',required:!0,"x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Please enter new password")}}'}},confirmPassword:{type:"string","x-component":"Password",title:'{{t("Confirm password")}}',required:!0,"x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Please enter the same password again")}}'},"x-validator":"{{(value, rules, {form}) => {\n if (!value) {\n return '';\n }\n if (value !== form.values.password) {\n return t(\"The passwords entered twice are inconsistent\");\n }\n }}}"},actions:{type:"void","x-component":"div",properties:{submit:{title:'{{t("Confirm")}}',type:"void","x-component":"Action","x-component-props":{htmlType:"submit",block:!0,type:"primary",useAction:function(){var e=(0,p.useForm)(),t=(0,r.useAPIClient)(),n=(0,s.dE)().t,o=new URLSearchParams(window.location.search).get("resetToken"),i=P(d().useState(!1),2),a=i[0],u=i[1];return{run:function(){var r;return(r=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(r){switch(r.label){case 0:return[4,e.submit()];case 1:r.sent(),u(!0),r.label=2;case 2:var i,a;return r.trys.push([2,,4,5]),[4,t.auth.resetPassword((i=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.values),a=a={resetToken:o},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(a)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(a)).forEach(function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(a,e))}),i))];case 3:return r.sent(),[3,5];case 4:return u(!1),[7];case 5:return m.message.success(n("Password reset successful")),setTimeout(function(){window.location.href="/signin"},1e3),[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,o){var i=r.apply(e,t);function a(e){S(i,n,o,a,u,"next",e)}function u(e){S(i,n,o,a,u,"throw",e)}a(void 0)})})()},loading:a}}}}}},signUp:{type:"void","x-component":"Link","x-component-props":{to:"/signin"},"x-content":'{{t("Go to login")}}'}}},scope:{t:t}}):d().createElement(y.Navigate,{to:"/not-found",replace:!0})};function E(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 j(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 T(e,t,n){return(T=C()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&I(o,n.prototype),o}).apply(null,arguments)}function A(e){return(A=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function I(e,t){return(I=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function k(e){var t="function"==typeof Map?new Map:void 0;return(k=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 T(e,arguments,A(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),I(n,e)})(e)}function C(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(C=function(){return!!e})()}var F=(0,r.lazy)(function(){return n.e("443").then(n.bind(n,862))},"AuthProvider").AuthProvider,R=(0,r.lazy)(function(){return Promise.resolve().then(n.bind(n,751))},"Options","SignInForm","SignUpForm"),_=R.Options,N=R.SignInForm,U=R.SignUpForm,q=(0,r.lazy)(function(){return Promise.resolve().then(n.bind(n,350))},"AuthLayout","SignInPage","SignUpPage"),$=q.AuthLayout,L=q.SignInPage,M=q.SignUpPage,D=(0,r.lazy)(function(){return n.e("611").then(n.bind(n,718))},"Authenticator").Authenticator,V=(0,r.lazy)(function(){return n.e("680").then(n.bind(n,971))},"TokenPolicySettings").TokenPolicySettings,B=(0,r.lazy)(function(){return Promise.resolve().then(n.bind(n,350))},"AuthenticatorsContextProvider","AuthLayout"),K=B.AuthenticatorsContextProvider,z=B.AuthLayout,H=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t,r,i,a,u;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=A(t),i=e=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}(this,C()?Reflect.construct(t,r||[],A(this).constructor):t.apply(this,r)),a="authTypes",u=new o.Registry,a in i?Object.defineProperty(i,a,{value:u,enumerable:!0,configurable:!0,writable:!0}):i[a]=u,e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&I(n,e),t=[{key:"registerType",value:function(e,t){this.authTypes.register(e,t)}},{key:"load",value:function(){var e;return(e=function(){var e,t,n;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(r){var o,i;return this.app.pluginSettingsManager.add(s.CU,{icon:"LoginOutlined",title:'{{t("Authentication", { ns: "'.concat(s.CU,'" })}}'),aclSnippet:"pm.auth"}),this.app.pluginSettingsManager.add("auth.authenticators",{icon:"LoginOutlined",title:'{{t("Authenticators", { ns: "'.concat(s.CU,'" })}}'),Component:D,aclSnippet:"pm.auth.authenticators",sort:1}),this.router.add("auth",{Component:"AuthLayout"}),this.router.add("auth.signin",{path:"/signin",Component:"SignInPage"}),this.router.add("auth.signup",{path:"/signup",Component:"SignUpPage"}),this.router.add("auth.forgotPassword",{path:"/forgot-password",Component:"ForgotPasswordPage"}),this.router.add("auth.resetPassword",{path:"/reset-password",Component:"ResetPasswordPage"}),this.app.addComponents({AuthLayout:$,SignInPage:L,SignUpPage:M,ForgotPasswordPage:x,ResetPasswordPage:O}),this.app.providers.unshift([F,{}]),this.registerType("Email/Password",{components:{SignInForm:N,SignUpForm:U,AdminSettingsForm:_}}),this.app.pluginSettingsManager.add("security.token-policy",{title:'{{t("Token policy", { ns: "'.concat(s.CU,'" })}}'),Component:V,aclSnippet:"pm.security.token-policy",icon:"ApiOutlined",sort:0}),t=(e=function(e){if(Array.isArray(e))return e}(((o=({app:this.app}).app).apiClient.axios,i=[function(e){var t,n=null==e||null==(t=e.headers)?void 0:t["x-new-token"];return n&&o.apiClient.auth.setToken(n),e},function(e){var t,n,r,i,a,u=null==e||null==(n=e.response)||null==(t=n.headers)?void 0:t["x-new-token"],s=null==e||null==(i=e.response)||null==(r=i.data)?void 0:r.errors,p=Array.isArray(s)?s[0]:null,f=o.router.state.location,d=f.pathname,m=f.search,y=o.router.basename;if(u&&o.apiClient.auth.setToken(u),401===e.status&&(null==p?void 0:p.code)&&c[p.code]&&(o.apiClient.auth.setToken(""),d===o.getHref("signin")&&(null==p?void 0:p.code)!==c.EMPTY_TOKEN&&e.config&&(e.config.skipNotify=!1),(null==p?void 0:p.code)==="USER_HAS_NO_ROLES_ERR"&&(e.config.skipNotify=!0,o.error=p)),401===e.status&&!(null==(a=e.config)?void 0:a.skipAuth)&&(null==p?void 0:p.code)&&c[p.code]){if(!p||(null==p?void 0:p.code)===c.SKIP_TOKEN_RENEW)throw e;var v=o.router.isSkippedAuthCheckRoute(d);if(v&&(e.config.skipNotify=!0),d!==o.getHref("signin")&&!v){var b,h,g=(b=y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),h=new RegExp("^".concat(b.replace(/\/?$/,""),"(\\/|$)")),d.replace(h,"/")||d);l(function(){o.apiClient.auth.setToken(null),o.router.navigate("/signin?redirect=".concat(g).concat(m),{replace:!0})})}}throw e}]))||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}}(i)||function(e){if(e){if("string"==typeof e)return E(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 E(e,2)}}(i)||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],n=e[1],this.app.apiClient.axios.interceptors.response.handlers.unshift({fulfilled:t,rejected:n,synchronous:!1,runWhen:null}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){j(i,r,o,a,u,"next",e)}function u(e){j(i,r,o,a,u,"throw",e)}a(void 0)})}).call(this)}}],function(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)}}(n.prototype,t),n}(k(r.Plugin)),G=H},706: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})}},751:function(e,t,n){"use strict";n.r(t),n.d(t,{Options:function(){return R},SignInForm:function(){return y},SignUpForm:function(){return O},useRedirect:function(){return f},useSignUp:function(){return P},useSignIn:function(){return d}});var r=n(342),o=n(155),i=n.n(o),a=n(872),u=n(350),c=n(442),l=n(230);function s(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 p(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(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/admin",n=(0,c.useNavigate)(),r=(function(e){if(Array.isArray(e))return e}(e=(0,c.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 s(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 s(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];return(0,o.useCallback)(function(){n(r.get("redirect")||t,{replace:!0})},[n,t,r])}var d=function(e){var t=(0,l.useForm)(),n=(0,r.useAPIClient)(),o=f(),i=(0,r.useCurrentUserContext)().refreshAsync;return{run:function(){var r;return(r=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(r){switch(r.label){case 0:return[4,t.submit()];case 1:return r.sent(),[4,n.auth.signIn(t.values,e)];case 2:return r.sent(),[4,i()];case 3:return r.sent(),o(),[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,o){var i=r.apply(e,t);function a(e){p(i,n,o,a,u,"next",e)}function u(e){p(i,n,o,a,u,"throw",e)}a(void 0)})})()}}},m=function(e){var t=e.showForgotPassword;return{type:"object",name:"passwordForm","x-component":"FormV2",properties:{account:{type:"string","x-component":"Input","x-validator":'{{(value) => {\n if (!value) {\n return t("Please enter your username or email");\n }\n if (value.includes(\'@\')) {\n if (!/^[\\w-]+(\\.[\\w-]+)*@[\\w-]+(\\.[\\w-]+)+$/.test(value)) {\n return t("Please enter a valid email");\n }\n } else {\n return /^[^@<>"\'/]{1,50}$/.test(value) || t("Please enter a valid username");\n }\n }}}',"x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Username/Email")}}',style:{}}},password:{type:"string","x-component":"Password",required:!0,"x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Password")}}',style:{},showForgotPassword:t}},actions:{type:"void","x-component":"div",properties:{submit:{title:'{{t("Sign in")}}',type:"void","x-component":"Action","x-component-props":{htmlType:"submit",block:!0,type:"primary",useAction:"{{ useBasicSignIn }}",style:{width:"100%"}}}}},links:{type:"void","x-component":"div","x-component-props":{style:{display:"flex",justifyContent:"space-between"}},properties:{signUp:{type:"void","x-component":"Link","x-component-props":{to:"{{ signUpLink }}"},"x-content":'{{t("Create an account")}}',"x-visible":"{{ allowSignUp }}"},forgotPassword:{type:"void","x-component":"Link","x-component-props":{to:'{{"/forgot-password?name=" + authenticator.name}}'},"x-content":'{{t("Forgot password")}}',"x-visible":t}}}}}},y=function(e){var t=(0,a.dE)().t,n=e.authenticator,o=n.authType,c=n.name,l=n.options,s=!!(0,u.useSignUpForms)()[o]&&null!=l&&!!l.allowSignUp,p="/signup?name=".concat(c);return i().createElement(r.SchemaComponent,{schema:m({showForgotPassword:!!(null==l?void 0:l.enableResetPassword)}),scope:{useBasicSignIn:function(){return d(c)},allowSignUp:s,signUpLink:p,t:t,authenticator:n}})},v=n(166),b=n(59),h=n(953),g=n(706);function x(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 w(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}function S(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}var P=function(e){var t=(0,c.useNavigate)(),n=(0,l.useForm)(),o=(0,r.useAPIClient)(),i=(0,h.useTranslation)().t;return{run:function(){var r;return(r=function(){var r;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(a){switch(a.label){case 0:return[4,n.submit()];case 1:return a.sent(),[4,o.auth.signUp(n.values,null==e?void 0:e.authenticator)];case 2:return a.sent(),b.message.success((null==e||null==(r=e.message)?void 0:r.success)||i("Sign up successfully, and automatically jump to the sign in page")),setTimeout(function(){t("/signin")},2e3),[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,o){var i=r.apply(e,t);function a(e){x(i,n,o,a,u,"next",e)}function u(e){x(i,n,o,a,u,"throw",e)}a(void 0)})})()}}},O=function(e){var t=e.authenticatorName,n=(0,a.dE)().t,u=(0,h.useTranslation)("lm-collections").t,s=(0,g.p)(t).options,p=s.signupForm,f=(0,o.useMemo)(function(){return p.filter(function(e){return e.show}).reduce(function(e,t){var r=S(w({},t.uiSchema),{title:t.uiSchema.title?u(l.Schema.compile(t.uiSchema.title,{t:n})):""});return e[t.field]=S(w({},r),{required:t.required,"x-decorator":"FormItem"}),e},{})},[p]);if(!(null==s?void 0:s.allowSignUp))return i().createElement(c.Navigate,{to:"/not-found",replace:!0});var d={type:"object",name:(0,v.uid)(),"x-component":"FormV2",properties:S(w({},f),{password:{type:"string",required:!0,title:'{{t("Password")}}',"x-component":"Password","x-decorator":"FormItem","x-validator":{password:!0},"x-component-props":{checkStrength:!0,style:{}},"x-reactions":[{dependencies:[".confirm_password"],fulfill:{state:{selfErrors:'{{$deps[0] && $self.value && $self.value !== $deps[0] ? t("Password mismatch") : ""}}'}}}]},confirm_password:{type:"string",required:!0,"x-component":"Password","x-decorator":"FormItem",title:'{{t("Confirm password")}}',"x-validator":{password:!0},"x-component-props":{style:{}},"x-reactions":[{dependencies:[".password"],fulfill:{state:{selfErrors:'{{$deps[0] && $self.value && $self.value !== $deps[0] ? t("Password mismatch") : ""}}'}}}]},actions:{type:"void","x-component":"div",properties:{submit:{title:'{{t("Sign up")}}',type:"void","x-component":"Action","x-component-props":{block:!0,type:"primary",htmlType:"submit",useAction:"{{ useBasicSignUp }}",style:{width:"100%"}}}}},link:{type:"void","x-component":"div",properties:{link:{type:"void","x-component":"Link","x-component-props":{to:"/signin"},"x-content":'{{t("Log in with an existing account")}}'}}}})};return i().createElement(r.SchemaComponent,{schema:d,scope:{useBasicSignUp:function(){return P({authenticator:t})},t:n}})},E=n(418);function j(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 T(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function A(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){T(e,t,n[t])})}return e}function I(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function k(e){return function(e){if(Array.isArray(e))return j(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e){if(e){if("string"==typeof e)return j(e,void 0);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 j(e,void 0)}}(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var C=function(){var e=(0,r.useRecord)(),t=(0,r.useCollectionManager)().getCollection("users").fields.filter(function(e){var t;return!e.hidden&&!e.target&&e.interface&&!(null==(t=e.uiSchema)?void 0:t["x-read-pretty"])}),n=t.map(function(e){var t;return{value:e.name,label:null==(t=e.uiSchema)?void 0:t.title}}),u=(0,o.useMemo)(function(){var n=((null==(u=e.options)||null==(a=u.public)?void 0:a.signupForm)||[]).filter(function(e){return t.find(function(t){return t.name===e.field})}),r=!0,o=!1,i=void 0;try{for(var a,u,c,l=t[Symbol.iterator]();!(r=(c=l.next()).done);r=!0)!function(){var e=c.value;n.find(function(t){return t.field===e.name})||n.push({field:e.name,show:"username"===e.name,required:"username"===e.name})}()}catch(e){o=!0,i=e}finally{try{r||null==l.return||l.return()}finally{if(o)throw i}}return n},[t,e]);return(0,o.useEffect)(function(){var t;e.options=I(A({},e.options),{public:I(A({},null==(t=e.options)?void 0:t.public),{signupForm:u})})},[e,u]),i().createElement(r.SchemaComponent,{components:{ArrayTable:E.ArrayTable},schema:{type:"void",properties:{"public.signupForm":{title:'{{t("Sign up form")}}',type:"array","x-decorator":"FormItem","x-component":"ArrayTable","x-component-props":{bordered:!1},"x-validator":"{{ (value) => {\n const check = value?.some((item) => ['username', 'email'].includes(item.field) && item.show && item.required);\n if (!check) {\n return t('At least one of the username or email fields is required');\n }\n} }}",default:u,items:{type:"object","x-decorator":"ArrayItems.Item",properties:{column0:{type:"void","x-component":"ArrayTable.Column","x-component-props":{width:20,align:"center"},properties:{sort:{type:"void","x-component":"ArrayTable.SortHandle"}}},column1:{type:"void","x-component":"ArrayTable.Column","x-component-props":{width:100,title:(0,a.vV)("Field")},properties:{field:{type:"string","x-decorator":"FormItem","x-component":"Select",enum:n,"x-read-pretty":!0}}},column2:{type:"void","x-component":"ArrayTable.Column","x-component-props":{width:80,title:(0,a.vV)("Show")},properties:{show:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-reactions":{dependencies:[".required"],fulfill:{state:{value:"{{ $deps[0] || $self.value }}"}}}}}},column3:{type:"void","x-component":"ArrayTable.Column","x-component-props":{width:80,title:(0,a.vV)("Required")},properties:{required:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-reactions":{dependencies:[".show"],fulfill:{state:{value:"{{ !$deps[0] ? false : $self.value }}"}}}}}}}}}}}})},F=function(){var e=(0,a.dE)().t;return[(0,r.useGlobalVariable)("$env"),(0,r.useCurrentUserVariable)({maxDepth:1}).currentUserSettings,(0,r.useSystemSettingsVariable)().systemSettings,{value:"$resetLink",label:e("Reset password link")},{value:"$resetLinkExpiration",label:e("Reset link expiration (minutes)")}].filter(Boolean)},R=function(){var e=(0,a.dE)().t,t=F(),n=i().createElement("span",null,e("No notification channels found. Please "),i().createElement(c.Link,{to:"/admin/settings/notification-manager/channels"},e("add one first")),".");return i().createElement(r.SchemaComponent,{scope:{t:e},components:{Alert:b.Alert,SignupFormSettings:C,FormTab:E.FormTab},schema:{type:"object",properties:{notice:{type:"void","x-decorator":"FormItem","x-component":"Alert","x-component-props":{showIcon:!0,message:'{{t("The authentication allows users to sign in via username or email.")}}'}},collapse:{type:"void","x-component":"FormTab",properties:{basic:{type:"void","x-component":"FormTab.TabPane","x-component-props":{tab:(0,a.vV)("Sign up settings")},properties:T({"public.allowSignUp":{"x-decorator":"FormItem",type:"boolean",title:'{{t("Allow to sign up")}}',"x-component":"Checkbox",default:!0}},(0,v.uid)(),{type:"void","x-component":"SignupFormSettings"})},forgetPassword:{type:"void","x-component":"FormTab.TabPane","x-component-props":{tab:(0,a.vV)("Forgot password")},properties:{"public.enableResetPassword":{"x-decorator":"FormItem",type:"boolean",title:'{{t("Enable forget password")}}',"x-component":"Checkbox",default:!1},divider1:{type:"void","x-component":function(){return i().createElement(b.Divider,{orientation:"left",orientationMargin:"0"},e("1. Select notification channel"))},"x-reactions":[{dependencies:[".public.enableResetPassword"],fulfill:{state:{visible:"{{$deps[0]}}"}}}]},notificationChannel:{type:"string",title:'{{t("Notification channel (Email)")}}',required:!0,"x-decorator":"FormItem","x-component":"RemoteSelect","x-component-props":{multiple:!1,manual:!1,fieldNames:{label:"title",value:"name"},service:{resource:"notificationChannels",action:"list",params:{filter:{notificationType:"email"}}},notFoundContent:n},"x-reactions":[{dependencies:[".public.enableResetPassword"],fulfill:{state:{visible:"{{$deps[0]}}"}}}],description:'{{t("The notification channel used to send the reset password email, only support email channel")}}'},divider2:{type:"void","x-component":function(){return i().createElement(b.Divider,{orientation:"left",orientationMargin:"0"},e("2. Configure reset email"))},"x-reactions":[{dependencies:[".public.enableResetPassword"],fulfill:{state:{visible:"{{$deps[0]}}"}}}]},emailSubject:{type:"string",required:!0,title:'{{t("Subject")}}',"x-decorator":"FormItem","x-component":"Variable.TextArea","x-component-props":{scope:k(t)},"x-reactions":[{dependencies:[".public.enableResetPassword"],fulfill:{state:{visible:"{{$deps[0]}}",initialValue:'{{t("defaultResetPasswordEmailSubject")}}'}}}],default:'{{t("defaultResetPasswordEmailSubject")}}'},emailContentType:{type:"string",title:'{{t("Content type")}}',required:!0,"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:"HTML",value:"html"},{label:'{{t("Plain text")}}',value:"text"}],default:"html","x-reactions":[{dependencies:[".public.enableResetPassword"],fulfill:{state:{visible:"{{$deps[0]}}",initialValue:"html"}}}]},emailContentHTML:{type:"string",required:!0,title:'{{t("Content")}}',"x-decorator":"FormItem","x-component":"Variable.RawTextArea","x-component-props":{scope:k(t),placeholder:"Hi,",autoSize:{minRows:10}},"x-reactions":[{dependencies:[".public.enableResetPassword",".emailContentType"],fulfill:{state:{visible:'{{$deps[0] && $deps[1] === "html"}}',initialValue:'{{t("defaultResetPasswordEmailContentHTML")}}'}}}],default:'{{t("defaultResetPasswordEmailContentHTML")}}'},emailContentText:{type:"string",required:!0,title:'{{t("Content")}}',"x-decorator":"FormItem","x-component":"Variable.RawTextArea","x-component-props":{scope:k(t),autoSize:{minRows:10}},"x-reactions":[{dependencies:[".public.enableResetPassword",".emailContentType"],fulfill:{state:{visible:'{{$deps[0] && $deps[1] === "text"}}',initialValue:'{{t("defaultResetPasswordEmailContentText")}}'}}}],default:'{{t("defaultResetPasswordEmailContentText")}}'},resetTokenExpiresIn:{type:"number",title:'{{t("Reset link expiration")}}',"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{suffix:e("Minutes"),style:{width:"100%"}},default:120,required:!0,"x-reactions":[{dependencies:[".public.enableResetPassword"],fulfill:{state:{visible:"{{$deps[0]}}",initialValue:120}}}]}}}}}}}})}},872:function(e,t,n){"use strict";n.d(t,{CU:function(){return i},dE:function(){return a},vV:function(){return u}});var r=n(953),o=n(342),i="auth";function a(){return(0,r.useTranslation)([i,"client"],{nsMode:"fallback"})}function u(e){return o.i18n.t(e,{ns:[i,"client"],nsMode:"fallback"})}},350:function(e,t,n){"use strict";n.r(t),n.d(t,{AuthLayout:function(){return d},useSignInButtons:function(){return P},SignUpPage:function(){return k},useSignInForms:function(){return S},useSignUpForms:function(){return I},SignupPageContext:function(){return T},AuthenticatorsContextProvider:function(){return f},SignupPageProvider:function(){return A},SignInPage:function(){return O}});var r=n(477),o=n(342),i=n(59),a=n(155),u=n.n(a),c=n(442),l=n(953),s=n(706);function p(){var e,t,n=(e=["\n position: absolute;\n bottom: 0;\n width: 100%;\n left: 0;\n text-align: center;\n padding-bottom: 24px;\n background-color: ",";\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return p=function(){return n},n}var f=function(e){var t=e.children,n=(0,o.useAPIClient)(),r=(0,o.useRequest)(function(){return n.resource("authenticators").publicList().then(function(e){var t;return(null==e||null==(t=e.data)?void 0:t.data)||[]})}),a=r.data,c=r.error;if(r.loading)return u().createElement("div",{style:{textAlign:"center",marginTop:20}},u().createElement(i.Spin,null));if(c)throw c;return u().createElement(s.m.Provider,{value:void 0===a?[]:a},t)};function d(){var e,t=((0,o.useSystemSettings)()||{}).data,n=(0,o.useToken)().token,i=(0,l.useTranslation)("lm-collections").t;return u().createElement("div",{style:{maxWidth:320,margin:"0 auto",paddingTop:"20vh",paddingBottom:"20vh"}},u().createElement("div",{style:{position:"fixed",top:"2em",right:"2em"}},u().createElement(o.SwitchLanguage,null)),u().createElement("h1",{style:{textAlign:"center"}},u().createElement(o.ReadPretty.TextArea,{value:i(null==t||null==(e=t.data)?void 0:e.title)})),u().createElement(f,null,u().createElement(c.Outlet,null)),u().createElement("div",{className:(0,r.css)(p(),n.colorBgContainer)},u().createElement(o.PoweredBy,null)))}var m=n(574),y=n(872),v=n(230);function b(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){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 b(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 b(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 g(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function x(){var e=g(["\n display: flex;\n "]);return x=function(){return e},e}function w(){var e=g(["\n display: flex;\n "]);return w=function(){return e},e}var S=function(){var e=(0,o.usePlugin)(m.default).authTypes.getEntities(),t={},n=!0,r=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done);n=!0){var c,l=h(a.value,2),s=l[0],p=l[1];(null==(c=p.components)?void 0:c.SignInForm)&&(t[s]=p.components.SignInForm)}}catch(e){r=!0,i=e}finally{try{n||null==u.return||u.return()}finally{if(r)throw i}}return t},P=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=(0,o.usePlugin)(m.default).authTypes.getEntities(),n={},r=!0,i=!1,a=void 0;try{for(var c,l=t[Symbol.iterator]();!(r=(c=l.next()).done);r=!0){var s,p=h(c.value,2),f=p[0],d=p[1];(null==(s=d.components)?void 0:s.SignInButton)&&(n[f]=d.components.SignInButton)}}catch(e){i=!0,a=e}finally{try{r||null==l.return||l.return()}finally{if(i)throw a}}var y=Object.keys(n);return e.filter(function(e){return y.includes(e.authType)}).map(function(e,t){return u().createElement(n[e.authType],{key:t,authenticator:e})})},O=function(){var e=(0,y.dE)().t;(0,o.useCurrentDocumentTitle)("Signin"),(0,o.useViewport)();var t=S(),n=(0,a.useContext)(s.m),c=P(n);if(!n.length)return u().createElement("div",{style:{color:"#ccc"}},e("No authentication methods available."));var l=n.map(function(n){var r=t[n.authType];if(r){var o="".concat(e("Sign-in")," (").concat(v.Schema.compile(n.authTypeTitle||n.authType,{t:e}),")");return 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}({component:(0,a.createElement)(r,{authenticator:n}),tabTitle:n.title||o},n)}}).filter(function(e){return e});return u().createElement(i.Space,{direction:"vertical",className:(0,r.css)(x())},l.length>1?u().createElement(i.Tabs,{items:l.map(function(e){return{label:e.tabTitle,key:e.name,children:e.component}})}):l.length?u().createElement("div",null,l[0].component):u().createElement(u().Fragment,null),u().createElement(i.Space,{direction:"vertical",className:(0,r.css)(w())},c))};function E(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 j(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 E(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 E(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.")}()}var T=(0,a.createContext)({});T.displayName="SignupPageContext";var A=function(e){var t=(0,a.useContext)(T);return t[e.authType]={component:e.component},u().createElement(T.Provider,{value:t},e.children)},I=function(){var e=(0,o.usePlugin)(m.default).authTypes.getEntities(),t={},n=!0,r=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done);n=!0){var c,l=j(a.value,2),s=l[0],p=l[1];(null==(c=p.components)?void 0:c.SignUpForm)&&(t[s]=p.components.SignUpForm)}}catch(e){r=!0,i=e}finally{try{n||null==u.return||u.return()}finally{if(r)throw i}}return t},k=function(){(0,o.useViewport)(),(0,o.useCurrentDocumentTitle)("Signup");var e=I(),t=j((0,c.useSearchParams)(),1)[0].get("name"),n=((0,s.p)(t)||{}).authType;return e[n]?(0,a.createElement)(e[n],{authenticatorName:t}):u().createElement(c.Navigate,{to:"/not-found",replace:!0})}},375:function(e){"use strict";e.exports=i},477:function(e){"use strict";e.exports=t},418:function(e){"use strict";e.exports=r},452:function(e){"use strict";e.exports=s},230:function(e){"use strict";e.exports=o},166:function(e){"use strict";e.exports=a},342:function(e){"use strict";e.exports=l},768:function(e){"use strict";e.exports=p},59:function(e){"use strict";e.exports=c},155:function(e){"use strict";e.exports=u},953:function(t){"use strict";t.exports=e},442:function(e){"use strict";e.exports=n},577:function(e,t,n){"use strict";var r=window.__nocobase_public_path__||"";if(!r&&window.location&&window.location.pathname){var o=window.location.pathname||"/",i=o.indexOf("/v2/");r=i>=0?o.slice(0,i+1):"/"}r&&(r=r.replace(/\/v2\/?$/,"/")),r||(r="/"),"/"!==r.charAt(r.length-1)&&(r+="/"),n.p=r+"static/plugins/@nocobase/plugin-auth/dist/client/"}},v={};function b(e){var t=v[e];if(void 0!==t)return t.exports;var n=v[e]={exports:{}};return y[e](n,n.exports,b),n.exports}b.m=y,b.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return b.d(t,{a:t}),t},b.d=function(e,t){for(var n in t)b.o(t,n)&&!b.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},b.f={},b.e=function(e){return Promise.all(Object.keys(b.f).reduce(function(t,n){return b.f[n](e,t),t},[]))},b.u=function(e){return""+({443:"a06984e0ca47df7a",611:"29ed4f742b8d53cf",680:"8ce04d54ea9d62a7"})[e]+".js"},b.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),b.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},h={},b.l=function(e,t,n,r){if(h[e])return void h[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:"+n){o=c;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,b.nc&&o.setAttribute("nonce",b.nc),o.setAttribute("data-rspack","@nocobase/plugin-auth:"+n),o.src=e),h[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=h[e];if(delete h[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)},b.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},b.g.importScripts&&(g=b.g.location+"");var h,g,x=b.g.document;if(!g&&x&&(x.currentScript&&"SCRIPT"===x.currentScript.tagName.toUpperCase()&&(g=x.currentScript.src),!g)){var w=x.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");return b.p=g.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),f={889:0},b.f.j=function(e,t){var n=b.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=b.p+b.u(e),i=Error();b.l(o,function(t){if(b.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)}},d=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)b.o(i,n)&&(b.m[n]=i[n]);a&&a(b)}for(e&&e(t);u<o.length;u++)r=o[u],b.o(f,r)&&f[r]&&f[r][0](),f[r]=0},(m=self.webpackChunk_nocobase_plugin_auth=self.webpackChunk_nocobase_plugin_auth||[]).forEach(d.bind(null,0)),m.push=d.bind(null,m.push.bind(m)),b(577),b(574)}()});
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@emotion/css"),require("react-router-dom"),require("@formily/antd-v5"),require("@formily/react"),require("@ant-design/icons"),require("@formily/shared"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/core"),require("@nocobase/utils/client")):"function"==typeof define&&define.amd?define("@nocobase/plugin-auth",["react-i18next","@emotion/css","react-router-dom","@formily/antd-v5","@formily/react","@ant-design/icons","@formily/shared","react","antd","@nocobase/client","@formily/core","@nocobase/utils/client"],t):"object"==typeof exports?exports["@nocobase/plugin-auth"]=t(require("react-i18next"),require("@emotion/css"),require("react-router-dom"),require("@formily/antd-v5"),require("@formily/react"),require("@ant-design/icons"),require("@formily/shared"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/core"),require("@nocobase/utils/client")):e["@nocobase/plugin-auth"]=t(e["react-i18next"],e["@emotion/css"],e["react-router-dom"],e["@formily/antd-v5"],e["@formily/react"],e["@ant-design/icons"],e["@formily/shared"],e.react,e.antd,e["@nocobase/client"],e["@formily/core"],e["@nocobase/utils/client"])}(self,function(e,t,n,r,o,i,a,u,c,l,s,p){return function(){var f,d,m,y={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,p,f,d,m=0,y=!1,v=!1,b=!0;if("function"!=typeof e)throw TypeError("Expected a function");function h(t){var n=c,r=l;return c=l=void 0,m=t,p=e.apply(r,n)}function g(e){var n=e-d,r=e-m;return void 0===d||n>=t||n<0||v&&r>=s}function x(){var e,n,r,i=o();if(g(i))return w(i);f=setTimeout(x,(e=i-d,n=i-m,r=t-e,v?u(r,s-n):r))}function w(e){return(f=void 0,b&&c)?h(e):(c=l=void 0,p)}function S(){var e,n=o(),r=g(n);if(c=arguments,l=this,d=n,r){if(void 0===f)return m=e=d,f=setTimeout(x,t),y?h(e):p;if(v)return clearTimeout(f),f=setTimeout(x,t),h(d)}return void 0===f&&(f=setTimeout(x,t)),p}return t=i(t)||0,r(n)&&(y=!!n.leading,s=(v="maxWait"in n)?a(i(n.maxWait)||0,t):s,b="trailing"in n?!!n.trailing:b),S.cancel=function(){void 0!==f&&clearTimeout(f),m=0,c=d=l=f=void 0},S.flush=function(){return void 0===f?p:w(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}},574:function(e,t,n){"use strict";n.r(t),n.d(t,{AuthLayout:function(){return z},default:function(){return G},useRedirect:function(){return i.useRedirect},PluginAuthClient:function(){return H},AuthenticatorsContext:function(){return v.m},useAuthenticator:function(){return v.p},AuthenticatorsContextProvider:function(){return K},useSignIn:function(){return i.useSignIn}});var r=n(342),o=n(768),i=n(751),a=n(738),u=n.n(a),c={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"},l=u()(function(e){e()},3e3,{leading:!0,trailing:!1}),s=n(872),p=n(230),f=n(155),d=n.n(f),m=n(59),y=n(442),v=n(706);function b(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,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 g(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 b(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 b(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.")}()}var x=function(){var e,t=(0,s.dE)().t,n=g((0,y.useSearchParams)(),1)[0].get("name"),o=(0,v.p)(n);return(null==o||null==(e=o.options)?void 0:e.enableResetPassword)?d().createElement(r.SchemaComponent,{schema:{type:"object",name:"forgotPasswordForm","x-component":"FormV2",properties:{email:{type:"string","x-component":"Input",title:'{{t("Reset password")}}',required:!0,"x-validator":"{{(value) => {\n if (!value) {\n return '';\n }\n if (!/^[\\w-]+(\\.[\\w-]+)*@[\\w-]+(\\.[\\w-]+)+$/.test(value)) {\n return t(\"Please enter a valid email\");\n }\n }}}","x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Please enter your email")}}',style:{}}},actions:{type:"void","x-component":"div",properties:{submit:{title:'{{t("Send reset email")}}',type:"void","x-component":"Action","x-component-props":{htmlType:"submit",block:!0,type:"primary",useAction:function(){var e=(0,p.useForm)(),t=(0,r.useAPIClient)(),n=(0,s.dE)().t,o=g(d().useState(!1),2),i=o[0],a=o[1];return{run:function(){var r;return(r=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(r){switch(r.label){case 0:return[4,e.submit()];case 1:r.sent(),a(!0),r.label=2;case 2:return r.trys.push([2,,4,5]),[4,t.auth.lostPassword(e.values)];case 3:return r.sent(),[3,5];case 4:return a(!1),[7];case 5:return m.message.success(n("Reset email sent successfully")),e.reset(),[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,o){var i=r.apply(e,t);function a(e){h(i,n,o,a,u,"next",e)}function u(e){h(i,n,o,a,u,"throw",e)}a(void 0)})})()},loading:i}}}}}},signUp:{type:"void","x-component":"Link","x-component-props":{to:"/signin"},"x-content":'{{t("Back to login")}}'}}},scope:{t:t}}):d().createElement(y.Navigate,{to:"/not-found",replace:!0})};function w(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 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 P(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 w(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 w(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.")}()}var O=function(){var e,t=(0,s.dE)().t,n=(0,r.useAPIClient)(),o=P((0,y.useSearchParams)(),1)[0],i=o.get("resetToken"),a=(0,r.useNavigateNoUpdate)(),u=P(d().useState(!1),2),c=u[0],l=u[1],b=o.get("name"),h=(0,v.p)(b);return((0,f.useEffect)(function(){n.auth.checkResetToken({resetToken:i}).then(function(){l(!1)}).catch(function(e){l(!0)})},[]),null==h||null==(e=h.options)?void 0:e.enableResetPassword)?!i||c?d().createElement(m.Result,{status:"403",title:t("Reset link has expired"),extra:d().createElement(m.Button,{type:"primary",onClick:function(){return a("/signin")}},t("Go to login"))}):d().createElement(r.SchemaComponent,{schema:{type:"object",name:"resetPasswordForm","x-component":"FormV2",properties:{password:{type:"string","x-component":"Password",title:'{{t("New password")}}',required:!0,"x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Please enter new password")}}'}},confirmPassword:{type:"string","x-component":"Password",title:'{{t("Confirm password")}}',required:!0,"x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Please enter the same password again")}}'},"x-validator":"{{(value, rules, {form}) => {\n if (!value) {\n return '';\n }\n if (value !== form.values.password) {\n return t(\"The passwords entered twice are inconsistent\");\n }\n }}}"},actions:{type:"void","x-component":"div",properties:{submit:{title:'{{t("Confirm")}}',type:"void","x-component":"Action","x-component-props":{htmlType:"submit",block:!0,type:"primary",useAction:function(){var e=(0,p.useForm)(),t=(0,r.useAPIClient)(),n=(0,s.dE)().t,o=new URLSearchParams(window.location.search).get("resetToken"),i=P(d().useState(!1),2),a=i[0],u=i[1];return{run:function(){var r;return(r=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(r){switch(r.label){case 0:return[4,e.submit()];case 1:r.sent(),u(!0),r.label=2;case 2:var i,a;return r.trys.push([2,,4,5]),[4,t.auth.resetPassword((i=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.values),a=a={resetToken:o},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(a)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(a)).forEach(function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(a,e))}),i))];case 3:return r.sent(),[3,5];case 4:return u(!1),[7];case 5:return m.message.success(n("Password reset successful")),setTimeout(function(){window.location.href="/signin"},1e3),[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,o){var i=r.apply(e,t);function a(e){S(i,n,o,a,u,"next",e)}function u(e){S(i,n,o,a,u,"throw",e)}a(void 0)})})()},loading:a}}}}}},signUp:{type:"void","x-component":"Link","x-component-props":{to:"/signin"},"x-content":'{{t("Go to login")}}'}}},scope:{t:t}}):d().createElement(y.Navigate,{to:"/not-found",replace:!0})};function E(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 j(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 T(e,t,n){return(T=C()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&k(o,n.prototype),o}).apply(null,arguments)}function A(e){return(A=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function k(e,t){return(k=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function I(e){var t="function"==typeof Map?new Map:void 0;return(I=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 T(e,arguments,A(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),k(n,e)})(e)}function C(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(C=function(){return!!e})()}var F=(0,r.lazy)(function(){return n.e("443").then(n.bind(n,862))},"AuthProvider").AuthProvider,R=(0,r.lazy)(function(){return Promise.resolve().then(n.bind(n,751))},"Options","SignInForm","SignUpForm"),_=R.Options,N=R.SignInForm,U=R.SignUpForm,$=(0,r.lazy)(function(){return Promise.resolve().then(n.bind(n,350))},"AuthLayout","SignInPage","SignUpPage"),q=$.AuthLayout,L=$.SignInPage,M=$.SignUpPage,D=(0,r.lazy)(function(){return n.e("611").then(n.bind(n,718))},"Authenticator").Authenticator,V=(0,r.lazy)(function(){return n.e("680").then(n.bind(n,971))},"TokenPolicySettings").TokenPolicySettings,B=(0,r.lazy)(function(){return Promise.resolve().then(n.bind(n,350))},"AuthenticatorsContextProvider","AuthLayout"),K=B.AuthenticatorsContextProvider,z=B.AuthLayout,H=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t,r,i,a,u;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,r=arguments,t=A(t),i=e=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}(this,C()?Reflect.construct(t,r||[],A(this).constructor):t.apply(this,r)),a="authTypes",u=new o.Registry,a in i?Object.defineProperty(i,a,{value:u,enumerable:!0,configurable:!0,writable:!0}):i[a]=u,e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&k(n,e),t=[{key:"registerType",value:function(e,t){this.authTypes.register(e,t)}},{key:"load",value:function(){var e;return(e=function(){var e,t,n;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(r){var o,i;return this.app.pluginSettingsManager.add(s.CU,{icon:"LoginOutlined",title:'{{t("Authentication", { ns: "'.concat(s.CU,'" })}}'),aclSnippet:"pm.auth"}),this.app.pluginSettingsManager.add("auth.authenticators",{icon:"LoginOutlined",title:'{{t("Authenticators", { ns: "'.concat(s.CU,'" })}}'),Component:D,aclSnippet:"pm.auth.authenticators",sort:1}),this.router.add("auth",{Component:"AuthLayout"}),this.router.add("auth.signin",{path:"/signin",Component:"SignInPage"}),this.router.add("auth.signup",{path:"/signup",Component:"SignUpPage"}),this.router.add("auth.forgotPassword",{path:"/forgot-password",Component:"ForgotPasswordPage"}),this.router.add("auth.resetPassword",{path:"/reset-password",Component:"ResetPasswordPage"}),this.app.addComponents({AuthLayout:q,SignInPage:L,SignUpPage:M,ForgotPasswordPage:x,ResetPasswordPage:O}),this.app.providers.unshift([F,{}]),this.registerType("Email/Password",{components:{SignInForm:N,SignUpForm:U,AdminSettingsForm:_}}),this.app.pluginSettingsManager.add("security.token-policy",{title:'{{t("Token policy", { ns: "'.concat(s.CU,'" })}}'),Component:V,aclSnippet:"pm.security.token-policy",icon:"ApiOutlined",sort:0}),t=(e=function(e){if(Array.isArray(e))return e}(((o=({app:this.app}).app).apiClient.axios,i=[function(e){var t,n=null==e||null==(t=e.headers)?void 0:t["x-new-token"];return n&&o.apiClient.auth.setToken(n),e},function(e){var t,n,r,i,a,u=null==e||null==(n=e.response)||null==(t=n.headers)?void 0:t["x-new-token"],s=null==e||null==(i=e.response)||null==(r=i.data)?void 0:r.errors,p=Array.isArray(s)?s[0]:null,f=o.router.state.location,d=f.pathname,m=f.search,y=o.router.basename;if(u&&o.apiClient.auth.setToken(u),401===e.status&&(null==p?void 0:p.code)&&c[p.code]&&(o.apiClient.auth.setToken(""),d===o.getHref("signin")&&(null==p?void 0:p.code)!==c.EMPTY_TOKEN&&e.config&&(e.config.skipNotify=!1),(null==p?void 0:p.code)==="USER_HAS_NO_ROLES_ERR"&&(e.config.skipNotify=!0,o.error=p)),401===e.status&&!(null==(a=e.config)?void 0:a.skipAuth)&&(null==p?void 0:p.code)&&c[p.code]){if(!p||(null==p?void 0:p.code)===c.SKIP_TOKEN_RENEW)throw e;var v=o.router.isSkippedAuthCheckRoute(d);if(v&&(e.config.skipNotify=!0),d!==o.getHref("signin")&&!v){var b,h,g=(b=y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),h=new RegExp("^".concat(b.replace(/\/?$/,""),"(\\/|$)")),d.replace(h,"/")||d);l(function(){o.apiClient.auth.setToken(null),o.router.navigate("/signin?redirect=".concat(g).concat(m),{replace:!0})})}}throw e}]))||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}}(i)||function(e){if(e){if("string"==typeof e)return E(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 E(e,2)}}(i)||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],n=e[1],this.app.apiClient.axios.interceptors.response.handlers.unshift({fulfilled:t,rejected:n,synchronous:!1,runWhen:null}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){j(i,r,o,a,u,"next",e)}function u(e){j(i,r,o,a,u,"throw",e)}a(void 0)})}).call(this)}}],function(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)}}(n.prototype,t),n}(I(r.Plugin)),G=H},706: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})}},751:function(e,t,n){"use strict";n.r(t),n.d(t,{Options:function(){return R},SignInForm:function(){return y},SignUpForm:function(){return O},useRedirect:function(){return f},useSignUp:function(){return P},useSignIn:function(){return d}});var r=n(342),o=n(155),i=n.n(o),a=n(872),u=n(350),c=n(442),l=n(230);function s(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 p(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(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/admin",n=(0,c.useNavigate)(),r=(function(e){if(Array.isArray(e))return e}(e=(0,c.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 s(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 s(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];return(0,o.useCallback)(function(){n(r.get("redirect")||t,{replace:!0})},[n,t,r])}var d=function(e){var t=(0,l.useForm)(),n=(0,r.useAPIClient)(),o=f(),i=(0,r.useCurrentUserContext)().refreshAsync;return{run:function(){var r;return(r=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(r){switch(r.label){case 0:return[4,t.submit()];case 1:return r.sent(),[4,n.auth.signIn(t.values,e)];case 2:return r.sent(),[4,i()];case 3:return r.sent(),o(),[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,o){var i=r.apply(e,t);function a(e){p(i,n,o,a,u,"next",e)}function u(e){p(i,n,o,a,u,"throw",e)}a(void 0)})})()}}},m=function(e){var t=e.showForgotPassword;return{type:"object",name:"passwordForm","x-component":"FormV2",properties:{account:{type:"string","x-component":"Input","x-validator":'{{(value) => {\n if (!value) {\n return t("Please enter your username or email");\n }\n if (value.includes(\'@\')) {\n if (!/^[\\w-]+(\\.[\\w-]+)*@[\\w-]+(\\.[\\w-]+)+$/.test(value)) {\n return t("Please enter a valid email");\n }\n } else {\n return /^[^@<>"\'/]{1,50}$/.test(value) || t("Please enter a valid username");\n }\n }}}',"x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Username/Email")}}',style:{}}},password:{type:"string","x-component":"Password",required:!0,"x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Password")}}',style:{},showForgotPassword:t}},actions:{type:"void","x-component":"div",properties:{submit:{title:'{{t("Sign in")}}',type:"void","x-component":"Action","x-component-props":{htmlType:"submit",block:!0,type:"primary",useAction:"{{ useBasicSignIn }}",style:{width:"100%"}}}}},links:{type:"void","x-component":"div","x-component-props":{style:{display:"flex",justifyContent:"space-between"}},properties:{signUp:{type:"void","x-component":"Link","x-component-props":{to:"{{ signUpLink }}"},"x-content":'{{t("Create an account")}}',"x-visible":"{{ allowSignUp }}"},forgotPassword:{type:"void","x-component":"Link","x-component-props":{to:'{{"/forgot-password?name=" + authenticator.name}}'},"x-content":'{{t("Forgot password")}}',"x-visible":t}}}}}},y=function(e){var t=(0,a.dE)().t,n=e.authenticator,o=n.authType,c=n.name,l=n.options,s=!!(0,u.useSignUpForms)()[o]&&null!=l&&!!l.allowSignUp,p="/signup?name=".concat(c);return i().createElement(r.SchemaComponent,{schema:m({showForgotPassword:!!(null==l?void 0:l.enableResetPassword)}),scope:{useBasicSignIn:function(){return d(c)},allowSignUp:s,signUpLink:p,t:t,authenticator:n}})},v=n(166),b=n(59),h=n(953),g=n(706);function x(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 w(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}function S(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}var P=function(e){var t=(0,c.useNavigate)(),n=(0,l.useForm)(),o=(0,r.useAPIClient)(),i=(0,h.useTranslation)().t;return{run:function(){var r;return(r=function(){var r;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(a){switch(a.label){case 0:return[4,n.submit()];case 1:return a.sent(),[4,o.auth.signUp(n.values,null==e?void 0:e.authenticator)];case 2:return a.sent(),b.message.success((null==e||null==(r=e.message)?void 0:r.success)||i("Sign up successfully, and automatically jump to the sign in page")),setTimeout(function(){t("/signin")},2e3),[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,o){var i=r.apply(e,t);function a(e){x(i,n,o,a,u,"next",e)}function u(e){x(i,n,o,a,u,"throw",e)}a(void 0)})})()}}},O=function(e){var t=e.authenticatorName,n=(0,a.dE)().t,u=(0,h.useTranslation)("lm-collections").t,s=(0,g.p)(t).options,p=s.signupForm,f=(0,o.useMemo)(function(){return p.filter(function(e){return e.show}).reduce(function(e,t){var r=S(w({},t.uiSchema),{title:t.uiSchema.title?u(l.Schema.compile(t.uiSchema.title,{t:n})):""});return e[t.field]=S(w({},r),{required:t.required,"x-decorator":"FormItem"}),e},{})},[p]);if(!(null==s?void 0:s.allowSignUp))return i().createElement(c.Navigate,{to:"/not-found",replace:!0});var d={type:"object",name:(0,v.uid)(),"x-component":"FormV2",properties:S(w({},f),{password:{type:"string",required:!0,title:'{{t("Password")}}',"x-component":"Password","x-decorator":"FormItem","x-validator":{password:!0},"x-component-props":{checkStrength:!0,style:{}},"x-reactions":[{dependencies:[".confirm_password"],fulfill:{state:{selfErrors:'{{$deps[0] && $self.value && $self.value !== $deps[0] ? t("Password mismatch") : ""}}'}}}]},confirm_password:{type:"string",required:!0,"x-component":"Password","x-decorator":"FormItem",title:'{{t("Confirm password")}}',"x-validator":{password:!0},"x-component-props":{style:{}},"x-reactions":[{dependencies:[".password"],fulfill:{state:{selfErrors:'{{$deps[0] && $self.value && $self.value !== $deps[0] ? t("Password mismatch") : ""}}'}}}]},actions:{type:"void","x-component":"div",properties:{submit:{title:'{{t("Sign up")}}',type:"void","x-component":"Action","x-component-props":{block:!0,type:"primary",htmlType:"submit",useAction:"{{ useBasicSignUp }}",style:{width:"100%"}}}}},link:{type:"void","x-component":"div",properties:{link:{type:"void","x-component":"Link","x-component-props":{to:"/signin"},"x-content":'{{t("Log in with an existing account")}}'}}}})};return i().createElement(r.SchemaComponent,{schema:d,scope:{useBasicSignUp:function(){return P({authenticator:t})},t:n}})},E=n(418);function j(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 T(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function A(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){T(e,t,n[t])})}return e}function k(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function I(e){return function(e){if(Array.isArray(e))return j(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e){if(e){if("string"==typeof e)return j(e,void 0);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 j(e,void 0)}}(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var C=function(){var e=(0,r.useRecord)(),t=(0,r.useCollectionManager)().getCollection("users").fields.filter(function(e){var t;return!e.hidden&&!e.target&&e.interface&&!(null==(t=e.uiSchema)?void 0:t["x-read-pretty"])}),n=t.map(function(e){var t;return{value:e.name,label:null==(t=e.uiSchema)?void 0:t.title}}),u=(0,o.useMemo)(function(){var n=((null==(u=e.options)||null==(a=u.public)?void 0:a.signupForm)||[]).filter(function(e){return t.find(function(t){return t.name===e.field})}),r=!0,o=!1,i=void 0;try{for(var a,u,c,l=t[Symbol.iterator]();!(r=(c=l.next()).done);r=!0)!function(){var e=c.value;n.find(function(t){return t.field===e.name})||n.push({field:e.name,show:"username"===e.name,required:"username"===e.name})}()}catch(e){o=!0,i=e}finally{try{r||null==l.return||l.return()}finally{if(o)throw i}}return n},[t,e]);return(0,o.useEffect)(function(){var t;e.options=k(A({},e.options),{public:k(A({},null==(t=e.options)?void 0:t.public),{signupForm:u})})},[e,u]),i().createElement(r.SchemaComponent,{components:{ArrayTable:E.ArrayTable},schema:{type:"void",properties:{"public.signupForm":{title:'{{t("Sign up form")}}',type:"array","x-decorator":"FormItem","x-component":"ArrayTable","x-component-props":{bordered:!1},"x-validator":"{{ (value) => {\n const check = value?.some((item) => ['username', 'email'].includes(item.field) && item.show && item.required);\n if (!check) {\n return t('At least one of the username or email fields is required');\n }\n} }}",default:u,items:{type:"object","x-decorator":"ArrayItems.Item",properties:{column0:{type:"void","x-component":"ArrayTable.Column","x-component-props":{width:20,align:"center"},properties:{sort:{type:"void","x-component":"ArrayTable.SortHandle"}}},column1:{type:"void","x-component":"ArrayTable.Column","x-component-props":{width:100,title:(0,a.vV)("Field")},properties:{field:{type:"string","x-decorator":"FormItem","x-component":"Select",enum:n,"x-read-pretty":!0}}},column2:{type:"void","x-component":"ArrayTable.Column","x-component-props":{width:80,title:(0,a.vV)("Show")},properties:{show:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-reactions":{dependencies:[".required"],fulfill:{state:{value:"{{ $deps[0] || $self.value }}"}}}}}},column3:{type:"void","x-component":"ArrayTable.Column","x-component-props":{width:80,title:(0,a.vV)("Required")},properties:{required:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-reactions":{dependencies:[".show"],fulfill:{state:{value:"{{ !$deps[0] ? false : $self.value }}"}}}}}}}}}}}})},F=function(){var e=(0,a.dE)().t;return[(0,r.useGlobalVariable)("$env"),(0,r.useCurrentUserVariable)({maxDepth:1}).currentUserSettings,(0,r.useSystemSettingsVariable)().systemSettings,{value:"$resetLink",label:e("Reset password link")},{value:"$resetLinkExpiration",label:e("Reset link expiration (minutes)")}].filter(Boolean)},R=function(){var e=(0,a.dE)().t,t=F(),n=i().createElement("span",null,e("No notification channels found. Please "),i().createElement(c.Link,{to:"/admin/settings/notification-manager/channels"},e("add one first")),".");return i().createElement(r.SchemaComponent,{scope:{t:e},components:{Alert:b.Alert,SignupFormSettings:C,FormTab:E.FormTab},schema:{type:"object",properties:{notice:{type:"void","x-decorator":"FormItem","x-component":"Alert","x-component-props":{showIcon:!0,message:'{{t("The authentication allows users to sign in via username or email.")}}'}},collapse:{type:"void","x-component":"FormTab",properties:{basic:{type:"void","x-component":"FormTab.TabPane","x-component-props":{tab:(0,a.vV)("Sign up settings")},properties:T({"public.allowSignUp":{"x-decorator":"FormItem",type:"boolean",title:'{{t("Allow to sign up")}}',"x-component":"Checkbox",default:!0}},(0,v.uid)(),{type:"void","x-component":"SignupFormSettings"})},forgetPassword:{type:"void","x-component":"FormTab.TabPane","x-component-props":{tab:(0,a.vV)("Forgot password")},properties:{"public.enableResetPassword":{"x-decorator":"FormItem",type:"boolean",title:'{{t("Enable forget password")}}',"x-component":"Checkbox",default:!1},divider1:{type:"void","x-component":function(){return i().createElement(b.Divider,{orientation:"left",orientationMargin:"0"},e("1. Select notification channel"))},"x-reactions":[{dependencies:[".public.enableResetPassword"],fulfill:{state:{visible:"{{$deps[0]}}"}}}]},notificationChannel:{type:"string",title:'{{t("Notification channel (Email)")}}',required:!0,"x-decorator":"FormItem","x-component":"RemoteSelect","x-component-props":{multiple:!1,manual:!1,fieldNames:{label:"title",value:"name"},service:{resource:"notificationChannels",action:"list",params:{filter:{notificationType:"email"}}},notFoundContent:n},"x-reactions":[{dependencies:[".public.enableResetPassword"],fulfill:{state:{visible:"{{$deps[0]}}"}}}],description:'{{t("The notification channel used to send the reset password email, only support email channel")}}'},divider2:{type:"void","x-component":function(){return i().createElement(b.Divider,{orientation:"left",orientationMargin:"0"},e("2. Configure reset email"))},"x-reactions":[{dependencies:[".public.enableResetPassword"],fulfill:{state:{visible:"{{$deps[0]}}"}}}]},emailSubject:{type:"string",required:!0,title:'{{t("Subject")}}',"x-decorator":"FormItem","x-component":"Variable.TextArea","x-component-props":{scope:I(t)},"x-reactions":[{dependencies:[".public.enableResetPassword"],fulfill:{state:{visible:"{{$deps[0]}}",initialValue:'{{t("defaultResetPasswordEmailSubject")}}'}}}],default:'{{t("defaultResetPasswordEmailSubject")}}'},emailContentType:{type:"string",title:'{{t("Content type")}}',required:!0,"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:"HTML",value:"html"},{label:'{{t("Plain text")}}',value:"text"}],default:"html","x-reactions":[{dependencies:[".public.enableResetPassword"],fulfill:{state:{visible:"{{$deps[0]}}",initialValue:"html"}}}]},emailContentHTML:{type:"string",required:!0,title:'{{t("Content")}}',"x-decorator":"FormItem","x-component":"Variable.RawTextArea","x-component-props":{scope:I(t),placeholder:"Hi,",autoSize:{minRows:10}},"x-reactions":[{dependencies:[".public.enableResetPassword",".emailContentType"],fulfill:{state:{visible:'{{$deps[0] && $deps[1] === "html"}}',initialValue:'{{t("defaultResetPasswordEmailContentHTML")}}'}}}],default:'{{t("defaultResetPasswordEmailContentHTML")}}'},emailContentText:{type:"string",required:!0,title:'{{t("Content")}}',"x-decorator":"FormItem","x-component":"Variable.RawTextArea","x-component-props":{scope:I(t),autoSize:{minRows:10}},"x-reactions":[{dependencies:[".public.enableResetPassword",".emailContentType"],fulfill:{state:{visible:'{{$deps[0] && $deps[1] === "text"}}',initialValue:'{{t("defaultResetPasswordEmailContentText")}}'}}}],default:'{{t("defaultResetPasswordEmailContentText")}}'},resetTokenExpiresIn:{type:"number",title:'{{t("Reset link expiration")}}',"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{suffix:e("Minutes"),style:{width:"100%"}},default:120,required:!0,"x-reactions":[{dependencies:[".public.enableResetPassword"],fulfill:{state:{visible:"{{$deps[0]}}",initialValue:120}}}]}}}}}}}})}},872:function(e,t,n){"use strict";n.d(t,{CU:function(){return i},dE:function(){return a},vV:function(){return u}});var r=n(953),o=n(342),i="auth";function a(){return(0,r.useTranslation)([i,"client"],{nsMode:"fallback"})}function u(e){return o.i18n.t(e,{ns:[i,"client"],nsMode:"fallback"})}},350:function(e,t,n){"use strict";n.r(t),n.d(t,{AuthLayout:function(){return d},useSignInButtons:function(){return P},SignUpPage:function(){return I},useSignInForms:function(){return S},useSignUpForms:function(){return k},SignupPageContext:function(){return T},AuthenticatorsContextProvider:function(){return f},SignupPageProvider:function(){return A},SignInPage:function(){return O}});var r=n(477),o=n(342),i=n(59),a=n(155),u=n.n(a),c=n(442),l=n(953),s=n(706);function p(){var e,t,n=(e=["\n position: absolute;\n bottom: 0;\n width: 100%;\n left: 0;\n text-align: center;\n padding-bottom: 24px;\n background-color: ",";\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return p=function(){return n},n}var f=function(e){var t=e.children,n=(0,o.useAPIClient)(),r=(0,o.useRequest)(function(){return n.resource("authenticators").publicList().then(function(e){var t;return(null==e||null==(t=e.data)?void 0:t.data)||[]})}),a=r.data,c=r.error;if(r.loading)return u().createElement("div",{style:{textAlign:"center",marginTop:20}},u().createElement(i.Spin,null));if(c)throw c;return u().createElement(s.m.Provider,{value:void 0===a?[]:a},t)};function d(){var e,t=((0,o.useSystemSettings)()||{}).data,n=(0,o.useToken)().token,i=(0,l.useTranslation)("lm-collections").t;return u().createElement("div",{style:{maxWidth:320,margin:"0 auto",paddingTop:"20vh",paddingBottom:"20vh"}},u().createElement("div",{style:{position:"fixed",top:"2em",right:"2em"}},u().createElement(o.SwitchLanguage,null)),u().createElement("h1",{style:{textAlign:"center"}},u().createElement(o.ReadPretty.TextArea,{value:i(null==t||null==(e=t.data)?void 0:e.title)})),u().createElement(f,null,u().createElement(c.Outlet,null)),u().createElement("div",{className:(0,r.css)(p(),n.colorBgContainer)},u().createElement(o.PoweredBy,null)))}var m=n(574),y=n(872),v=n(230);function b(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){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 b(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 b(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 g(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function x(){var e=g(["\n display: flex;\n "]);return x=function(){return e},e}function w(){var e=g(["\n display: flex;\n "]);return w=function(){return e},e}var S=function(){var e=(0,o.usePlugin)(m.default).authTypes.getEntities(),t={},n=!0,r=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done);n=!0){var c,l=h(a.value,2),s=l[0],p=l[1];(null==(c=p.components)?void 0:c.SignInForm)&&(t[s]=p.components.SignInForm)}}catch(e){r=!0,i=e}finally{try{n||null==u.return||u.return()}finally{if(r)throw i}}return t},P=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=(0,o.usePlugin)(m.default).authTypes.getEntities(),n={},r=!0,i=!1,a=void 0;try{for(var c,l=t[Symbol.iterator]();!(r=(c=l.next()).done);r=!0){var s,p=h(c.value,2),f=p[0],d=p[1];(null==(s=d.components)?void 0:s.SignInButton)&&(n[f]=d.components.SignInButton)}}catch(e){i=!0,a=e}finally{try{r||null==l.return||l.return()}finally{if(i)throw a}}var y=Object.keys(n);return e.filter(function(e){return y.includes(e.authType)}).map(function(e,t){return u().createElement(n[e.authType],{key:t,authenticator:e})})},O=function(){var e=(0,y.dE)().t;(0,o.useCurrentDocumentTitle)("Signin"),(0,o.useViewport)();var t=S(),n=(0,a.useContext)(s.m),c=P(n);if(!n.length)return u().createElement("div",{style:{color:"#ccc"}},e("No authentication methods available."));var l=n.map(function(n){var r=t[n.authType];if(r){var o="".concat(e("Sign-in")," (").concat(v.Schema.compile(n.authTypeTitle||n.authType,{t:e}),")");return 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}({component:(0,a.createElement)(r,{authenticator:n}),tabTitle:n.title||o},n)}}).filter(function(e){return e});return u().createElement(i.Space,{direction:"vertical",className:(0,r.css)(x())},l.length>1?u().createElement(i.Tabs,{items:l.map(function(e){return{label:e.tabTitle,key:e.name,children:e.component}})}):l.length?u().createElement("div",null,l[0].component):u().createElement(u().Fragment,null),u().createElement(i.Space,{direction:"vertical",className:(0,r.css)(w())},c))};function E(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 j(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 E(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 E(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.")}()}var T=(0,a.createContext)({});T.displayName="SignupPageContext";var A=function(e){var t=(0,a.useContext)(T);return t[e.authType]={component:e.component},u().createElement(T.Provider,{value:t},e.children)},k=function(){var e=(0,o.usePlugin)(m.default).authTypes.getEntities(),t={},n=!0,r=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done);n=!0){var c,l=j(a.value,2),s=l[0],p=l[1];(null==(c=p.components)?void 0:c.SignUpForm)&&(t[s]=p.components.SignUpForm)}}catch(e){r=!0,i=e}finally{try{n||null==u.return||u.return()}finally{if(r)throw i}}return t},I=function(){(0,o.useViewport)(),(0,o.useCurrentDocumentTitle)("Signup");var e=k(),t=j((0,c.useSearchParams)(),1)[0].get("name"),n=((0,s.p)(t)||{}).authType;return e[n]?(0,a.createElement)(e[n],{authenticatorName:t}):u().createElement(c.Navigate,{to:"/not-found",replace:!0})}},375:function(e){"use strict";e.exports=i},477:function(e){"use strict";e.exports=t},418:function(e){"use strict";e.exports=r},452:function(e){"use strict";e.exports=s},230:function(e){"use strict";e.exports=o},166:function(e){"use strict";e.exports=a},342:function(e){"use strict";e.exports=l},768:function(e){"use strict";e.exports=p},59:function(e){"use strict";e.exports=c},155:function(e){"use strict";e.exports=u},953:function(t){"use strict";t.exports=e},442:function(e){"use strict";e.exports=n},754:function(e,t,n){"use strict";var r="",o="u">typeof document?document.currentScript:null;if(o&&o.src&&(r=o.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!r){var i=window.__webpack_public_path__||"";i&&("/"!==i.charAt(i.length-1)&&(i+="/"),r=i+"static/plugins/@nocobase/plugin-auth/dist/client/")}if(!r){if(!(r=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var a=window.location.pathname||"/",u=a.indexOf("/v2/");r=u>=0?a.slice(0,u+1):"/"}r&&(r=r.replace(/\/v2\/?$/,"/")),r||(r="/"),"/"!==r.charAt(r.length-1)&&(r+="/"),r+="static/plugins/@nocobase/plugin-auth/dist/client/"}n.p=r}},v={};function b(e){var t=v[e];if(void 0!==t)return t.exports;var n=v[e]={exports:{}};return y[e](n,n.exports,b),n.exports}b.m=y,b.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return b.d(t,{a:t}),t},b.d=function(e,t){for(var n in t)b.o(t,n)&&!b.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},b.f={},b.e=function(e){return Promise.all(Object.keys(b.f).reduce(function(t,n){return b.f[n](e,t),t},[]))},b.u=function(e){return""+({443:"a06984e0ca47df7a",611:"29ed4f742b8d53cf",680:"8ce04d54ea9d62a7"})[e]+".js"},b.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),b.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},h={},b.l=function(e,t,n,r){if(h[e])return void h[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:"+n){o=c;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,b.nc&&o.setAttribute("nonce",b.nc),o.setAttribute("data-rspack","@nocobase/plugin-auth:"+n),o.src=e),h[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=h[e];if(delete h[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)},b.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},b.g.importScripts&&(g=b.g.location+"");var h,g,x=b.g.document;if(!g&&x&&(x.currentScript&&"SCRIPT"===x.currentScript.tagName.toUpperCase()&&(g=x.currentScript.src),!g)){var w=x.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");return b.p=g.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),f={889:0},b.f.j=function(e,t){var n=b.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=b.p+b.u(e),i=Error();b.l(o,function(t){if(b.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)}},d=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)b.o(i,n)&&(b.m[n]=i[n]);a&&a(b)}for(e&&e(t);u<o.length;u++)r=o[u],b.o(f,r)&&f[r]&&f[r][0](),f[r]=0},(m=self.webpackChunk_nocobase_plugin_auth=self.webpackChunk_nocobase_plugin_auth||[]).forEach(d.bind(null,0)),m.push=d.bind(null,m.push.bind(m)),b(754),b(574)}()});
@@ -8,18 +8,18 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.1.0-alpha.12",
11
+ "@nocobase/client": "2.1.0-alpha.14",
12
12
  "react": "18.2.0",
13
13
  "react-router-dom": "6.30.1",
14
- "@nocobase/utils": "2.1.0-alpha.12",
14
+ "@nocobase/utils": "2.1.0-alpha.14",
15
15
  "axios": "1.7.7",
16
16
  "lodash": "4.17.21",
17
- "@nocobase/auth": "2.1.0-alpha.12",
18
- "@nocobase/database": "2.1.0-alpha.12",
19
- "@nocobase/cache": "2.1.0-alpha.12",
20
- "@nocobase/server": "2.1.0-alpha.12",
21
- "@nocobase/logger": "2.1.0-alpha.12",
22
- "@nocobase/test": "2.1.0-alpha.12",
17
+ "@nocobase/auth": "2.1.0-alpha.14",
18
+ "@nocobase/database": "2.1.0-alpha.14",
19
+ "@nocobase/cache": "2.1.0-alpha.14",
20
+ "@nocobase/server": "2.1.0-alpha.14",
21
+ "@nocobase/logger": "2.1.0-alpha.14",
22
+ "@nocobase/test": "2.1.0-alpha.14",
23
23
  "@formily/antd-v5": "1.2.3",
24
24
  "antd": "5.24.2",
25
25
  "@formily/shared": "2.3.7",
@@ -27,6 +27,6 @@ module.exports = {
27
27
  "react-i18next": "11.18.6",
28
28
  "@emotion/css": "11.13.0",
29
29
  "@ant-design/icons": "5.6.1",
30
- "@nocobase/actions": "2.1.0-alpha.12",
30
+ "@nocobase/actions": "2.1.0-alpha.14",
31
31
  "@formily/core": "2.3.7"
32
32
  };
@@ -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-03-25T14:05:17.311Z"}
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-04-07T15:54:14.621Z"}
@@ -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-03-25T14:05:17.422Z"}
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-04-07T15:54:14.714Z"}
@@ -116,35 +116,43 @@ class TokenController {
116
116
  return data;
117
117
  }
118
118
  renew = async (jti) => {
119
- const repo = this.app.db.getRepository(import_constants.issuedTokensCollectionName);
120
119
  const model = this.app.db.getModel(import_constants.issuedTokensCollectionName);
121
- const newId = (0, import_crypto.randomUUID)();
122
- const issuedTime = Date.now();
123
- const [count] = await model.update(
124
- { jti: newId, issuedTime },
125
- { where: { jti } }
126
- );
127
- if (count === 1) {
128
- await this.cache.set(`jti-renewed-cahce:${jti}`, { jti: newId, issuedTime }, import_constants.RENEWED_JTI_CACHE_MS);
129
- this.logger.info("jti renewed", { oldJti: jti, newJti: newId, issuedTime });
130
- return { jti: newId, issuedTime };
131
- } else {
132
- const cachedJtiData = await this.cache.get(`jti-renewed-cahce:${jti}`);
133
- if (cachedJtiData) {
134
- return cachedJtiData;
135
- }
136
- this.logger.error("jti renew failed", {
137
- module: "auth",
138
- submodule: "token-controller",
139
- method: "renew",
140
- jti,
141
- code: import_auth.AuthErrorCode.TOKEN_RENEW_FAILED
142
- });
143
- throw new import_auth.AuthError({
144
- message: "Your session has expired. Please sign in again.",
145
- code: import_auth.AuthErrorCode.TOKEN_RENEW_FAILED
146
- });
120
+ const cacheKey = `jti-renewed-cahce:${jti}`;
121
+ const cachedJtiData = await this.cache.get(cacheKey);
122
+ if (cachedJtiData) {
123
+ return cachedJtiData;
147
124
  }
125
+ return await this.cache.wrap(
126
+ cacheKey,
127
+ async () => {
128
+ const newId = (0, import_crypto.randomUUID)();
129
+ const issuedTime = Date.now();
130
+ const [count] = await model.update(
131
+ { jti: newId, issuedTime },
132
+ { where: { jti } }
133
+ );
134
+ if (count === 1) {
135
+ this.logger.info("jti renewed", { oldJti: jti, newJti: newId, issuedTime });
136
+ return { jti: newId, issuedTime };
137
+ }
138
+ const renewedJtiData = await this.cache.get(cacheKey);
139
+ if (renewedJtiData) {
140
+ return renewedJtiData;
141
+ }
142
+ this.logger.error("jti renew failed", {
143
+ module: "auth",
144
+ submodule: "token-controller",
145
+ method: "renew",
146
+ jti,
147
+ code: import_auth.AuthErrorCode.TOKEN_RENEW_FAILED
148
+ });
149
+ throw new import_auth.AuthError({
150
+ message: "Your session has expired. Please sign in again.",
151
+ code: import_auth.AuthErrorCode.TOKEN_RENEW_FAILED
152
+ });
153
+ },
154
+ import_constants.RENEWED_JTI_CACHE_MS
155
+ );
148
156
  };
149
157
  }
150
158
  // Annotate the CommonJS export names for ESM import in node:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-auth",
3
- "version": "2.1.0-alpha.12",
3
+ "version": "2.1.0-alpha.14",
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",
@@ -30,7 +30,7 @@
30
30
  "description": "User authentication management, including password, SMS, and support for Single Sign-On (SSO) protocols, with extensibility.",
31
31
  "description.ru-RU": "Управление аутентификацией пользователей: пароли, SMS, поддержка протоколов единого входа (SSO) и возможность расширения.",
32
32
  "description.zh-CN": "用户认证管理,包括基础的密码认证、短信认证、SSO 协议的认证等,可扩展。",
33
- "gitHead": "f12c4a75470590b1670ce54510b96ef94c2cd7a2",
33
+ "gitHead": "d8735b541de0ff9557bba704de49c799b4962672",
34
34
  "keywords": [
35
35
  "Authentication",
36
36
  "Security"