@nocobase/plugin-multi-portal 3.0.0-alpha.4 → 3.0.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -5
- package/dist/client-v2/499.245037eea4cc7266.js +10 -0
- package/dist/client-v2/556.64742ccddb8fe2f0.js +10 -0
- package/dist/client-v2/index.js +1 -1
- package/dist/client-v2/layoutRegistration.d.ts +1 -5
- package/dist/client-v2/pages/MultiPortalsPage.d.ts +0 -26
- package/dist/constants.d.ts +7 -0
- package/dist/constants.js +27 -2
- package/dist/externalVersion.js +8 -8
- package/dist/locale/en-US.json +18 -14
- package/dist/locale/zh-CN.json +16 -12
- package/dist/node_modules/tar/package.json +1 -1
- package/dist/server/collections/multiPortals.js +2 -11
- package/dist/server/plugin.d.ts +3 -3
- package/dist/server/plugin.js +203 -238
- package/package.json +3 -3
- package/dist/client-v2/499.ef2ff0c022687485.js +0 -10
- package/dist/client-v2/556.37df9197ce5c3452.js +0 -10
package/README.md
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
# @nocobase/plugin-multi-portal
|
|
2
2
|
|
|
3
3
|
`@nocobase/plugin-multi-portal` is the built-in Portal registration and
|
|
4
|
-
permission layer built on top of `@nocobase/plugin-ui-layout`. A Portal
|
|
5
|
-
|
|
4
|
+
permission layer built on top of `@nocobase/plugin-ui-layout`. A Portal stores
|
|
5
|
+
its device type in `uiLayoutUid`: `admin-layout-model` means Desktop and
|
|
6
|
+
`mobile-layout-model` means Mobile. Portal availability depends on the Portal's
|
|
7
|
+
own `enabled` state, not on a matching UI Layout record.
|
|
6
8
|
|
|
7
9
|
For Client V2, enabled No-code Portals are the only source of registered Portal
|
|
8
10
|
routes. Fresh applications use Portal-scoped entry and route permissions.
|
|
9
|
-
Portals created while upgrading an existing
|
|
10
|
-
|
|
11
|
-
Client V2 share the same route tree without copying ACL data.
|
|
11
|
+
The fixed Admin and Mobile Portals created while upgrading an existing
|
|
12
|
+
application continue to use UI Layout route ownership and role permissions, so
|
|
13
|
+
Client V1 and Client V2 share the same route tree without copying ACL data.
|
|
12
14
|
|
|
13
15
|
UI Layout remains the layout and route-model base, and Client V1 keeps its
|
|
14
16
|
existing UI Layout registration behavior. AI Portals remain separate `/x`
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_multi_portal_client_v2=self.webpackChunk_nocobase_plugin_multi_portal_client_v2||[]).push([["499"],{918:function(t,e,n){n.r(e),n.d(e,{PortalEntryActionModel:function(){return $}});var r=n(485),i=n(694),o=n(143),a=n(337),l=n(756);function u(t){var e=null==t?void 0:t.trim();return e&&"/"!==e?"/".concat(e.replace(/^\/+/,"")):"/"}function c(t){var e=u(t).replace(/\/+$/,"");return""===e||"/"===e?"":e}function s(t,e){var n=c(t),r=u(e);return!n||r===n||r.startsWith("".concat(n,"/"))?r:"".concat(n).concat(r)}function p(t){return/^[a-z][a-z\d+\-.]*:\/\//i.test(t)||t.startsWith("//")}function f(t){var e=u(t);return[(0,r.getModernClientPrefix)(),"v","x"].some(function(t){return e===u(t)})}function y(t,e){var n=u(t),r=c(e);if(r){if(n===r)return"/";if(n.startsWith("".concat(r,"/")))return n.slice(r.length)||"/"}}function h(t,e,n){var r=e.trim();if(p(r))return r;var i=(0,l.u)(t,"/",n);if(f(r))return b(i,r);var o=u(r);if(void 0!==y(o,i))return o;var a="ai"===n?"no-code":"ai",c=y(o,(0,l.u)(t,"/",a));return void 0!==c?b(i,c):(0,l.u)(t,o,n)}function v(t){return c((function(t){var e,n,i,o;return"function"==typeof(null==t?void 0:t.getPublicPath)?c((0,r.getV2EffectiveBasePath)({getPublicPath:t.getPublicPath,router:{getBasename:function(){var e,n,r;return(null==(n=t.router)||null==(e=n.getBasename)?void 0:e.call(n))||(null==(r=t.router)?void 0:r.basename)}}})):c((null==t||null==(n=t.router)||null==(e=n.getBasename)?void 0:e.call(n))||(null==t||null==(i=t.router)?void 0:i.basename)||(null==t||null==(o=t.getPublicPath)?void 0:o.call(t)))})(t).replace(/\/(?:apps|_app)\/[^/]+$/,"")||"")}function b(t,e){return"".concat(t.replace(/\/+$/,"")).concat(u(e))}function d(t,e){return h({router:{basename:s(v(t),"/apps/".concat(e.appName))}},e.routePath,e.portalType)}function P(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function m(t,e,n,r,i,o,a){try{var l=t[o](a),u=l.value}catch(t){n(t);return}l.done?e(u):Promise.resolve(u).then(r,i)}function g(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function a(t){m(o,r,i,a,l,"next",t)}function l(t){m(o,r,i,a,l,"throw",t)}a(void 0)})}}function A(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function k(t,e,n){return(k="u">typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=T(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n||t):i.value}})(t,e,n||t)}function T(t){return(T=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function E(t,e){return(E=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function O(t){return function(t){if(Array.isArray(t))return P(t)}(t)||function(t){if("u">typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t){if(t){if("string"==typeof t)return P(t,void 0);var e=Object.prototype.toString.call(t).slice(8,-1);if("Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e)return Array.from(e);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return P(t,void 0)}}(t)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(w=function(){return!!t})()}function _(t,e){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(a,"next",{value:u(0)}),l(a,"throw",{value:u(1)}),l(a,"return",{value:u(2)}),"function"==typeof Symbol&&l(a,Symbol.iterator,{value:function(){return this}}),a;function u(l){return function(u){var c=[l,u];if(n)throw TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,r=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){o.label=c[1];break}if(6===c[0]&&o.label<i[1]){o.label=i[1],i=c;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(c);break}i[2]&&o.ops.pop(),o.trys.pop();continue}c=e.call(t,o)}catch(t){c=[6,t],r=0}finally{n=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var j="PartitionOutlined",R="buttonSettings",S="general";function x(t){return(null==t?void 0:t.title)||(null==t?void 0:t.routePath)}function D(t,e,n){if(t)return"main"===t.appName?(null==n?void 0:n("Main application"))||"Main":(null==e?void 0:e.title)||(null==e?void 0:e.name)||t.appName}function M(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:x(t),i=D(t,e,n);return i&&r?"".concat(i," / ").concat(r):r}function N(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:x(t),i=D(t,e,n);return i&&r?"".concat(i," / ").concat(r):r}function I(t){return t.entryPortalTitle||x(t.entryPortal)}function C(t,e){return t.entryPortalTargetTitle||N(t.entryPortal,t.entryPortalApp,e)||I(t)}function U(t,e){if(t)return e.portals.find(function(e){return t.appName===e.appName&&(!!t.uid&&!!e.uid&&t.uid===e.uid||t.routePath===e.routePath)})}function B(t){return O(new Set(t.filter(function(t){return!!t})))}function q(t,e,n){var r=x(t);return t&&r&&e.portals.some(function(e){return e.appName===t.appName&&x(e)===r&&e.layout!==t.layout})?"".concat(r," (").concat(n("mobile"===t.layout?"Mobile":"Desktop"),")"):r}var $=function(t){var e;if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");function n(){var t,e,r;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,r=arguments,e=T(e),A(t=function(t,e){var n;if(e&&("object"==((n=e)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof e))return e;if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(this,w()?Reflect.construct(e,r||[],T(this).constructor):e.apply(this,r)),"entryActionAvailability","available"),A(t,"availabilityRequest",void 0),A(t,"disposeAppPortalsReaction",void 0),A(t,"defaultProps",{type:"default",title:(0,o.MZ)("Portal"),icon:j}),A(t,"enableEditType",!1),A(t,"enableEditDanger",!1),A(t,"enableEditTitle",!0),A(t,"enableEditIconOnly",!1),t}return n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),t&&E(n,t),e=[{key:"onInit",value:function(t){k(T(n.prototype),"onInit",this).call(this,t),(0,i.define)(this,{entryActionAvailability:i.observable.ref}),this.syncEntryTitle(),this.checkEntryPortalAvailability()}},{key:"afterAddAsSubModel",value:function(){var t=this,e=this;return g(function(){return _(this,function(r){switch(r.label){case 0:return[4,k(T(n.prototype),"afterAddAsSubModel",t).call(e)];case 1:return r.sent(),this.syncEntryTitle(),[4,this.checkEntryPortalAvailability()];case 2:return r.sent(),[2]}})}).call(this)}},{key:"onMount",value:function(){var t=this;if(k(T(n.prototype),"onMount",this).call(this),!this.disposeAppPortalsReaction){var e=this.context.app;if(e){var r=(0,a.G)(e);this.disposeAppPortalsReaction=(0,i.reaction)(function(){return r.revision},function(){t.checkEntryPortalAvailability()})}}}},{key:"onUnmount",value:function(){var t;k(T(n.prototype),"onUnmount",this).call(this),null==(t=this.disposeAppPortalsReaction)||t.call(this),this.disposeAppPortalsReaction=void 0}},{key:"setProps",value:function(t,e){"string"==typeof t?k(T(n.prototype),"setProps",this).call(this,t,e):k(T(n.prototype),"setProps",this).call(this,t),this.syncEntryTitle()}},{key:"getTitle",value:function(){return k(T(n.prototype),"getTitle",this).call(this)||I(this.props)}},{key:"getTitleFieldDescription",value:function(){var t,e,n,r,i=(n=C(t=this.props,this.t),r=null==(e=t.entryPortal)?void 0:e.routePath,n&&r?"".concat(n," (").concat(r,")"):n||r);return i?"".concat(this.context.t("Target portal",(0,o.Dj)()),": ").concat(i):void 0}},{key:"isEntryActionAvailable",value:function(){return"available"===this.entryActionAvailability}},{key:"getEntryActionUnavailableMessage",value:function(){if("unavailable"===this.entryActionAvailability)return this.context.t("This entry is currently unavailable. Please check the application status.",(0,o.Dj)())}},{key:"isDefaultTitle",value:function(t){return"string"==typeof t&&[this.defaultProps.title,this.context.t("Portal",(0,o.Dj)()),"Portal"].filter(Boolean).includes(t)}},{key:"isDefaultIcon",value:function(t){return"string"==typeof t&&t===j}},{key:"isAutoTitle",value:function(t,e){return"string"==typeof t&&e.includes(t)}},{key:"syncEntryTitle",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=I(this.props),i=B([x(this.props.entryPortal),this.props.entryPortalTitle,C(this.props,this.t)].concat(O(e)));r&&(!this.props.title||this.isDefaultTitle(this.props.title)||this.isAutoTitle(this.props.title,i))&&k(T(n.prototype),"setProps",this).call(this,"title",r);var o=(null==(t=this.props.entryPortal)?void 0:t.icon)||j;o&&(!this.props.icon||this.isDefaultIcon(this.props.icon))&&k(T(n.prototype),"setProps",this).call(this,"icon",o),r&&this.syncTitleStepParams(r,o,i)}},{key:"syncTitleStepParams",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=this.getStepParams(R,S)||{},i={};(!r.title||this.isDefaultTitle(r.title)||this.isAutoTitle(r.title,n))&&(i.title=t),e&&(!r.icon||this.isDefaultIcon(r.icon))&&(i.icon=e),Object.keys(i).length&&this.setStepParams(R,S,i)}},{key:"onClick",value:function(){var t=this.props.entryPortal;if(t&&!this.hidden&&"available"===this.entryActionAvailability){var e=this.context.app,n=e?(0,a.G)(e).payload:void 0,r=n&&U(t,n)||t,i=(null==n?void 0:n.apps.find(function(t){return t.name===r.appName}))||this.props.entryPortalApp,o=function(t,e,n){if("main"===e.appName)return a=e.routePath,l=e.portalType,p(c=a.trim())?c:h({router:{basename:v(t)}},c,l);var r=u(e.routePath),i=(null==n?void 0:n.ssoEnabled)===!0,o=e.appName===((null==t?void 0:t.name)||"main");if(null==n?void 0:n.cname){var a,l,c,y,P=e.routePath.trim();if(p(P))return P;var m=(y=n.cname,/^https?:\/\//i.test(y)||y.startsWith("//")?y:"//".concat(y)),g=r;return("ai"===e.portalType?g=d(t,e):f(r)&&(g=h(void 0,r,e.portalType)),i)?"".concat(m.replace(/\/+$/,""),"/app-sso?redirect=").concat(encodeURIComponent(g)):b(m,g)}if(o&&!i)return h(t,e.routePath,e.portalType);if(!i)return d(t,e);var A="/apps/".concat(e.appName,"/app-sso?redirect=").concat(encodeURIComponent(r));return(null==t?void 0:t.getRouteUrl)?t.getRouteUrl(A):s(v(t),A)}(e,r,i);window.open(o,"_blank","noopener,noreferrer")}}},{key:"t",get:function(){var t=this;return function(e){return String(t.context.t(e,(0,o.Dj)()))}}},{key:"setEntryActionAvailability",value:function(t){this.entryActionAvailability!==t&&(this.entryActionAvailability=t)}},{key:"getAvailabilityForExistingPortal",value:function(t,e){var n,r,i,o,a=(n=t.appName,r=this.props.entryPortalApp,e.apps.find(function(t){return t.name===n})||((null==r?void 0:r.name)===n?r:void 0));return!(o=!(i=null==a?void 0:a.status)?[]:"string"==typeof i?[i]:Object.values(i).filter(function(t){return"string"==typeof t})).length||o.includes("running")?"available":"unavailable"}},{key:"syncCurrentPortal",value:function(t,e){var r=this.props.entryPortal,i=this.props.entryPortalApp,o=I(this.props),a=C(this.props,this.t),l=q(r,e,this.t),u=M(r,i,this.t,l),c=e.apps.find(function(e){return e.name===t.appName})||i,s=q(t,e,this.t),p=e.apps.length>0||B(e.portals.map(function(t){return t.appName})).length>1||o===u?M(t,c,this.t,s):s,f=N(t,c,this.t,s);k(T(n.prototype),"setProps",this).call(this,{entryPortal:t,entryPortalApp:c,entryPortalTitle:p,entryPortalTargetTitle:f}),this.syncEntryTitle(B([o,a,u,x(r)]))}},{key:"checkEntryPortalAvailability",value:function(){var t=this;return this.availabilityRequest||(this.availabilityRequest=this.loadEntryPortalAvailability().finally(function(){t.availabilityRequest=void 0})),this.availabilityRequest}},{key:"loadEntryPortalAvailability",value:function(){return g(function(){var t,e,n,r;return _(this,function(i){switch(i.label){case 0:if(t=this.props.entryPortal,e=this.context.app,!t||!e)return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,(0,a.G)(e).load()];case 2:return n=i.sent(),(r=U(t,n))?(this.setEntryActionAvailability(this.getAvailabilityForExistingPortal(r,n)),this.syncCurrentPortal(r,n)):this.setEntryActionAvailability("unavailable"),[3,4];case 3:return i.sent(),[2];case 4:return[2]}})}).call(this)}}],function(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}(n.prototype,e),n}(r.ActionModel);$.define({label:(0,o.MZ)("Portal")})}}]);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";(self.webpackChunk_nocobase_plugin_multi_portal_client_v2=self.webpackChunk_nocobase_plugin_multi_portal_client_v2||[]).push([["556"],{524:function(e,t,r){r.r(t),r.d(t,{createMultiPortal:function(){return ee},default:function(){return eI},deleteMultiPortals:function(){return er},setDefaultMultiPortal:function(){return en},updateMultiPortal:function(){return et}});var n=r(375),a=r(485),o=r(694),l=r(625),i=r(59),u=r(155),c=r.n(u),s=r(624),p=r(337),d=r(143),m=r(756);function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function y(e,t,r,n,a,o,l){try{var i=e[o](l),u=i.value}catch(e){r(e);return}i.done?t(u):Promise.resolve(u).then(n,a)}function b(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var o=e.apply(t,r);function l(e){y(o,n,a,l,i,"next",e)}function i(e){y(o,n,a,l,i,"throw",e)}l(void 0)})}}function h(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function g(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){h(e,t,r[t])})}return e}function v(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 r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function E(e,t){if(null==e)return{};var r,n,a,o={};if("u">typeof Reflect&&Reflect.ownKeys){for(a=0,r=Reflect.ownKeys(Object(e));a<r.length;a++)n=r[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n]);return o}if(o=function(e,t){if(null==e)return{};var r,n,a={},o=Object.getOwnPropertyNames(e);for(n=0;n<o.length;n++)r=o[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r]);return a}(e,t),Object.getOwnPropertySymbols)for(a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)n=r[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n]);return o}function w(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],l=!0,i=!1;try{for(a=a.call(e);!(l=(r=a.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(e){i=!0,n=e}finally{try{l||null==a.return||a.return()}finally{if(i)throw n}}return o}}(e,t)||S(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 k(e){return e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function S(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return f(e,t)}}function T(e,t){var r,n,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(l,"next",{value:u(0)}),i(l,"throw",{value:u(1)}),i(l,"return",{value:u(2)}),"function"==typeof Symbol&&i(l,Symbol.iterator,{value:function(){return this}}),l;function u(i){return function(u){var c=[i,u];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(o=0)),o;)try{if(r=1,n&&(a=2&c[0]?n.return:c[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,c[1])).done)return a;switch(n=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,n=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],n=0}finally{r=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var R={paddingInline:0},D=c().forwardRef(function(e,t){return c().createElement("div",{ref:t},c().createElement(a.IconPicker,e))});function I(e,t){var r="string"==typeof e.title?e.title.trim():"";return r||(e.type===a.NocoBaseDesktopRouteType.tabs?t("Untitled"):e.schemaUid||t("Untitled"))}function O(e,t){var r,n=null==(r=e.options)?void 0:r[t];return"string"==typeof n&&n.trim()?n.trim():""}function x(e){return O(e,"path")||O(e,"href")||O(e,"url")}function B(e){return e===a.NocoBaseDesktopRouteType.page||e===a.NocoBaseDesktopRouteType.flowPage}function P(e,t){if(void 0!==t){var r=!0,n=!1,a=void 0;try{for(var o,l=e[Symbol.iterator]();!(r=(o=l.next()).done);r=!0){var i,u=o.value;if(u.id===t)return u;var c=P(null!=(i=u.children)?i:[],t);if(c)return c}}catch(e){n=!0,a=e}finally{try{r||null==l.return||l.return()}finally{if(n)throw a}}}}function F(e){return!0!==e.hidden&&e.type!==a.NocoBaseDesktopRouteType.page}function C(e,t){return"".concat(e.replace(/\/+$/,""),"/").concat(t.replace(/^\/+/,""))}function j(e,t,r){if(e.type===a.NocoBaseDesktopRouteType.group||e.type===a.NocoBaseDesktopRouteType.link||!e.schemaUid)return"";if(e.type===a.NocoBaseDesktopRouteType.tabs){var n=P(r,e.parentId);return(null==n?void 0:n.schemaUid)?C(t.routePath,"".concat(n.schemaUid,"/tab/").concat(e.schemaUid)):""}return C(t.routePath,e.schemaUid)}function N(e,t,r){var n=null==(d=e.routePath)?void 0:d.trim(),l=(null!=(s=e.params)?s:[]).filter(function(e){var t,r;return!!(null==e||null==(t=e.name)?void 0:t.trim())||!!(null==e||null==(r=e.value)?void 0:r.trim())}),i=B(e.type),u=e.type===a.NocoBaseDesktopRouteType.tabs,c=v(g({},i||u?{schemaUid:(null==t?void 0:t.schemaUid)||(0,o.randomId)()}:{},u?{tabSchemaName:(null==t?void 0:t.tabSchemaName)||(0,o.randomId)()}:{},i?{enableTabs:!!e.enableTabs}:{}),{hideInMenu:!1===e.showInMenu,icon:e.icon,title:(null!=(p=e.title)?p:"").trim(),type:e.type});if(e.type===a.NocoBaseDesktopRouteType.link){var s,p,d,m,f=null!=(m=null==t?void 0:t.options)?m:{};f.href,f.params,f.path,f.url,c.options=g({},E(f,["href","params","path","url"]),n?h({},(null==r?void 0:r.mobile)?"url":"href",n):{},l.length?{params:l}:{})}return(null==r?void 0:r.withInitialPageTab)&&i?v(g({},c),{menuSchemaUid:(0,o.randomId)(),children:[{type:a.NocoBaseDesktopRouteType.tabs,schemaUid:(0,o.randomId)(),tabSchemaName:(0,o.randomId)(),hidden:!e.enableTabs}]}):c}function A(e){var t=e.type,r=(0,d.kj)();return c().createElement(i.Tag,{color:t===a.NocoBaseDesktopRouteType.flowPage||t===a.NocoBaseDesktopRouteType.page?"purple":t===a.NocoBaseDesktopRouteType.link?"red":t===a.NocoBaseDesktopRouteType.group?"blue":"default"},r(t===a.NocoBaseDesktopRouteType.group?"Group":t===a.NocoBaseDesktopRouteType.page||t===a.NocoBaseDesktopRouteType.flowPage?"Page":t===a.NocoBaseDesktopRouteType.link?"Link":t===a.NocoBaseDesktopRouteType.tabs?"Tab":"Unknown"))}function M(e){var t,r,o=(0,d.kj)(),l=i.theme.useToken().token,s=w(i.Form.useForm(),1)[0],p=w((0,u.useState)(!1),2),m=p[0],y=p[1],h=i.Form.useWatch("type",s),g=null!=(t=null==(r=e.initialRoute)?void 0:r.type)?t:h,v=(0,u.useMemo)(function(){var t,r,n,l,i,u;return t=o,(null==(n=(r={mobile:e.mobile,parentRoute:e.parentRoute}).parentRoute)?void 0:n.type)===a.NocoBaseDesktopRouteType.page||(null==(l=r.parentRoute)?void 0:l.type)===a.NocoBaseDesktopRouteType.flowPage?[{label:t("Tab"),value:a.NocoBaseDesktopRouteType.tabs}]:(null==(i=r.parentRoute)?void 0:i.type)===a.NocoBaseDesktopRouteType.group?[{label:t("Group"),value:a.NocoBaseDesktopRouteType.group},{label:t("Page"),value:a.NocoBaseDesktopRouteType.flowPage},{label:t("Link"),value:a.NocoBaseDesktopRouteType.link}]:((function(e){if(Array.isArray(e))return f(e)})(u=r.mobile?[]:[{label:t("Group"),value:a.NocoBaseDesktopRouteType.group}])||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(u)||S(u)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).concat([{label:t("Page"),value:a.NocoBaseDesktopRouteType.flowPage},{label:t("Link"),value:a.NocoBaseDesktopRouteType.link}])},[e.mobile,e.parentRoute,o]),E=(0,u.useMemo)(function(){var t,r,n,o,l,i,u,c,s;return{enableTabs:!!(null==(t=e.initialRoute)?void 0:t.enableTabs),icon:null==(r=e.initialRoute)?void 0:r.icon,params:e.initialRoute&&Array.isArray(i=null==(l=e.initialRoute.options)?void 0:l.params)?i.reduce(function(e,t){return t&&(void 0===t?"undefined":k(t))==="object"&&e.push({name:"string"==typeof t.name?t.name:"",value:"string"==typeof t.value?t.value:""}),e},[]):[],routePath:e.initialRoute?x(e.initialRoute):"",showInMenu:!e.initialRoute||!e.initialRoute.hideInMenu,title:(null==(n=e.initialRoute)?void 0:n.title)||"",type:(null==(o=e.initialRoute)?void 0:o.type)||((null==(c=(u={mobile:e.mobile,parentRoute:e.parentRoute}).parentRoute)?void 0:c.type)===a.NocoBaseDesktopRouteType.page||(null==(s=u.parentRoute)?void 0:s.type)===a.NocoBaseDesktopRouteType.flowPage?a.NocoBaseDesktopRouteType.tabs:a.NocoBaseDesktopRouteType.flowPage)}},[e.initialRoute,e.mobile,e.parentRoute]),R=(0,u.useMemo)(function(){return g===a.NocoBaseDesktopRouteType.tabs?void 0:[{message:o("Title field is required"),required:!0,whitespace:!0}]},[g,o]),I=(0,u.useCallback)(function(){return b(function(){var t;return T(this,function(r){switch(r.label){case 0:return[4,s.validateFields()];case 1:t=r.sent(),y(!0),r.label=2;case 2:return r.trys.push([2,,4,5]),[4,e.onSubmit(t)];case 3:return r.sent(),[3,5];case 4:return y(!1),[7];case 5:return[2]}})})()},[s,e]);return c().createElement(a.DrawerFormLayout,{cancelText:o("Cancel"),onSubmit:I,submitText:o("Submit"),submitting:m,title:e.title},c().createElement(i.Form,{form:s,initialValues:E,layout:"vertical"},e.initialRoute?c().createElement(c().Fragment,null,c().createElement(i.Form.Item,{hidden:!0,name:"type"},c().createElement(i.Input,null)),c().createElement(i.Form.Item,{label:o("Type")},c().createElement(A,{type:g}))):c().createElement(i.Form.Item,{label:o("Type"),name:"type",rules:[{message:o("The field value is required"),required:!0}]},c().createElement(i.Radio.Group,{options:v})),c().createElement(i.Form.Item,{label:o("Title"),name:"title",rules:R},c().createElement(i.Input,null)),c().createElement(i.Form.Item,{label:o("Icon"),name:"icon",rules:e.mobile?[{message:o("Icon field is required"),required:!0}]:void 0},c().createElement(D,null)),g===a.NocoBaseDesktopRouteType.link?c().createElement(c().Fragment,null,c().createElement(i.Form.Item,{extra:o("Do not concatenate search params in the URL"),label:o("URL"),name:"routePath",rules:[{message:o("URL field is required"),required:!0,whitespace:!0}]},c().createElement(i.Input.TextArea,{autoSize:!0})),c().createElement(i.Form.Item,{label:o("Search parameters")},c().createElement(i.Form.List,{name:"params"},function(e,t){var r=t.add,a=t.remove;return c().createElement(i.Space,{direction:"vertical",size:l.marginXS,style:{width:"100%"}},e.map(function(e){return c().createElement(i.Space.Compact,{block:!0,key:e.key},c().createElement(i.Form.Item,{name:[e.name,"name"],noStyle:!0},c().createElement(i.Input,{placeholder:o("Name")})),c().createElement(i.Form.Item,{name:[e.name,"value"],noStyle:!0},c().createElement(i.Input,{placeholder:o("Value")})),c().createElement(i.Button,{"aria-label":o("Delete"),icon:c().createElement(n.DeleteOutlined,null),onClick:function(){return a(e.name)}}))}),c().createElement(i.Button,{onClick:function(){return r()},type:"dashed"},o("Add parameter")))}))):null,c().createElement(i.Form.Item,{extra:o("If selected, the route will be displayed in the menu."),name:"showInMenu",valuePropName:"checked"},c().createElement(i.Checkbox,null,o("Show in menu"))),B(g)?c().createElement(i.Form.Item,{extra:o("If selected, the page will display Tab pages."),name:"enableTabs",valuePropName:"checked"},c().createElement(i.Checkbox,null,o("Enable page tabs"))):null))}function z(e){var t=(0,d.kj)(),r=w(i.Form.useForm(),1)[0],a=w((0,u.useState)(!1),2),o=a[0],l=a[1];return c().createElement(i.Popover,{content:c().createElement(i.Form,{form:r,layout:"vertical",onFinish:function(t){e.onApply(t),l(!1)},style:{width:260}},c().createElement(i.Form.Item,{label:t("Search routes"),name:"keyword"},c().createElement(i.Input,{allowClear:!0})),c().createElement(i.Space,null,c().createElement(i.Button,{htmlType:"submit",type:"primary"},t("Submit")),c().createElement(i.Button,{onClick:function(){r.resetFields(),e.onApply({}),l(!1)}},t("Cancel")))),onOpenChange:l,open:o,placement:"bottomLeft",trigger:"click"},c().createElement(i.Button,{"aria-label":t("Filter"),icon:c().createElement(n.FilterOutlined,null)},t("Filter")))}function U(e){var t=e.portal,r=(0,o.useFlowContext)(),l=(0,d.kj)(),p=c().useRef(l),f=i.App.useApp(),y=f.message,h=f.modal,S=i.theme.useToken().token,D=w((0,u.useState)([]),2),O=D[0],C=D[1],U=w((0,u.useState)(!1),2),L=U[0],q=U[1],G=w((0,u.useState)({}),2),_=G[0],W=G[1],V=w((0,u.useState)([]),2),X=V[0],H=V[1],$=(0,u.useMemo)(function(){return r.api.resource("desktopRoutes")},[r.api]),K=t.uid,Q=t.uiLayoutUid===s.ig;c().useEffect(function(){p.current=l},[l]);var J=(0,u.useCallback)(function(){return b(function(){var e,t;return T(this,function(n){switch(n.label){case 0:q(!0),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,r.api.request({url:"/desktopRoutes:list",method:"get",params:{paginate:!1,portal:K,sort:"sort",tree:!0},skipNotify:!0})];case 2:var a;return C(null!=(e=(!(a=null==(t=n.sent())?void 0:t.data)||(void 0===a?"undefined":k(a))!=="object"?{}:{data:Array.isArray(a.data)?a.data:[]}).data)?e:[]),H([]),[3,5];case 3:return n.sent(),y.error(p.current("Failed to load routes")),C([]),[3,5];case 4:return q(!1),[7];case 5:return[2]}})})()},[r.api,y,K]);c().useEffect(function(){J().catch(function(){})},[J]);var Y=(0,u.useCallback)(function(){return b(function(){return T(this,function(e){switch(e.label){case 0:return[4,J()];case 1:return e.sent(),[2]}})})()},[J]),Z=(0,u.useCallback)(function(e){return b(function(){var t,r,n,o,i,u,c,s,p,d,m;return T(this,function(f){switch(f.label){case 0:if(t=e.editingRoute,r=e.parentRoute,n=e.values,(null==t?void 0:t.id)===void 0)return[3,10];return o=B(t.type)&&!!n.enableTabs!==t.enableTabs,[4,$.update({filterByTk:t.id,portal:K,values:N(n,t,{mobile:Q})})];case 1:if(f.sent(),!o)return[3,9];i=!0,u=!1,c=void 0,f.label=2;case 2:var b;f.trys.push([2,7,8,9]),s=(null!=(b=t.children)?b:[]).filter(function(e){return e.type===a.NocoBaseDesktopRouteType.tabs})[Symbol.iterator](),f.label=3;case 3:if(i=(p=s.next()).done)return[3,6];if(void 0===(d=p.value).id)return[3,5];return[4,$.update({filterByTk:d.id,portal:K,values:{hidden:!n.enableTabs}})];case 4:f.sent(),f.label=5;case 5:return i=!0,[3,3];case 6:return[3,9];case 7:return m=f.sent(),u=!0,c=m,[3,9];case 8:try{i||null==s.return||s.return()}finally{if(u)throw c}return[7];case 9:return y.success(l("Updated successfully")),[3,12];case 10:return[4,$.create({portal:K,values:g({},N(n,void 0,{mobile:Q,withInitialPageTab:!0}),(null==r?void 0:r.id)!==void 0?{parentId:r.id}:{})})];case 11:f.sent(),y.success(l("Saved successfully")),f.label=12;case 12:return[4,Y()];case 13:return f.sent(),[2]}})})()},[$,y,Q,K,Y,l]),ee=(0,u.useCallback)(function(e){var t,n,a=e.editingRoute?null!=(t=P(O,e.editingRoute.id))?t:e.editingRoute:null,o=null!=(n=e.parentRoute)?n:null;r.viewer.drawer({width:S.screenSM,closable:!0,content:function(){return c().createElement(M,{initialRoute:a,mobile:Q,onSubmit:function(e){return Z({editingRoute:a,parentRoute:o,values:e})},parentRoute:o,title:a?l("Edit route"):o?l("Add child route"):l("Add new")})}})},[r.viewer,Q,O,Z,l,S.screenSM]),et=(0,u.useCallback)(function(e){return b(function(){return T(this,function(t){switch(t.label){case 0:return[4,$.destroy({filterByTk:e,portal:K})];case 1:return t.sent(),y.success(l("Deleted successfully")),[4,Y()];case 2:return t.sent(),[2]}})})()},[$,y,K,Y,l]),er=(0,u.useMemo)(function(){return X.filter(function(e){return"number"==typeof e||"string"==typeof e})},[X]),en=er.length>0,ea=(0,u.useMemo)(function(){return function e(t){return t.filter(F).map(function(t){var r=t.children,n=E(t,["children"]),a=r?e(r):[];return a.length?v(g({},n),{children:a}):n})}(O)},[O]),eo=(0,u.useMemo)(function(){return function e(t,r,n){var a=r.trim().toLowerCase();return a?t.reduce(function(t,r){var o,l=e(null!=(o=r.children)?o:[],a,n);return(I(r,n).toLowerCase().includes(a)||String(r.schemaUid||"").toLowerCase().includes(a)||String(r.type||"").toLowerCase().includes(a)||x(r).toLowerCase().includes(a)||l.length)&&t.push(v(g({},r),{children:l.length?l:r.children})),t},[]):t}(ea,_.keyword||"",l)},[_.keyword,l,ea]),el=(0,u.useCallback)(function(e){return b(function(){var t,r,n,a,o,i,u;return T(this,function(c){switch(c.label){case 0:t=!0,r=!1,n=void 0,c.label=1;case 1:c.trys.push([1,6,7,8]),a=er[Symbol.iterator](),c.label=2;case 2:if(t=(o=a.next()).done)return[3,5];return i=o.value,[4,$.update({filterByTk:i,portal:K,values:e})];case 3:c.sent(),c.label=4;case 4:return t=!0,[3,2];case 5:return[3,8];case 6:return u=c.sent(),r=!0,n=u,[3,8];case 7:try{t||null==a.return||a.return()}finally{if(r)throw n}return[7];case 8:return y.success(l("Updated successfully")),[4,Y()];case 9:return c.sent(),[2]}})})()},[$,y,K,Y,er,l]),ei=(0,u.useCallback)(function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];h.confirm({cancelText:l("Cancel"),content:l("Are you sure you want to delete it?"),okText:l("Delete"),onOk:function(){return b(function(){return T(this,function(t){switch(t.label){case 0:return[4,et(e)];case 1:return t.sent(),[2]}})})()},title:t?l("Delete routes"):l("Delete route")})},[et,h,l]),eu=(0,u.useMemo)(function(){return[{dataIndex:"title",title:l("Title"),width:260,render:function(e,t){return I(t,l)}},{dataIndex:"type",title:l("Type"),width:160,render:function(e){return c().createElement(A,{type:e})}},{dataIndex:"hideInMenu",title:l("Show in menu"),width:140,render:function(e){return e?c().createElement(n.CloseOutlined,{"aria-label":l("Hidden"),style:{color:S.colorError}}):c().createElement(n.CheckOutlined,{"aria-label":l("Shown"),style:{color:S.colorSuccess}})}},{dataIndex:"routePath",title:l("Path"),width:320,render:function(e,r){var n=j(r,t,O);return n?c().createElement(i.Typography.Paragraph,{copyable:!0,ellipsis:!0,style:{marginBottom:0}},n):null}},{dataIndex:"actions",title:l("Actions"),width:260,render:function(e,n){var o=I(n,l),u=j(n,t,O),s=u?(0,m.u)(r.app,u,t.portalType):"";return c().createElement(i.Space,{size:"small"},c().createElement(i.Button,{"aria-label":l("Add child {{route}}",{route:o}),disabled:!(n.type===a.NocoBaseDesktopRouteType.group||(n.type===a.NocoBaseDesktopRouteType.page||n.type===a.NocoBaseDesktopRouteType.flowPage)&&n.enableTabs),onClick:function(){return ee({parentRoute:n})},size:"small",style:R,type:"link"},l("Add child")),c().createElement(i.Button,{"aria-label":l("Edit {{route}}",{route:o}),onClick:function(){return ee({editingRoute:n})},size:"small",style:R,type:"link"},l("Edit")),c().createElement(i.Button,{"aria-label":l("View {{route}}",{route:o}),disabled:!u,href:s||void 0,rel:"noopener noreferrer",size:"small",style:R,target:"_blank",type:"link"},l("View")),c().createElement(i.Button,{"aria-label":l("Delete {{route}}",{route:o}),onClick:function(){return void 0!==n.id&&ei(n.id)},size:"small",style:R,type:"link"},l("Delete")))}}]},[r.app,ei,ee,t,O,l,S.colorError,S.colorSuccess]);return c().createElement(i.Space,{direction:"vertical",size:S.marginSM,style:{width:"100%"}},c().createElement(i.Space,{style:{justifyContent:"space-between",width:"100%"}},c().createElement(z,{onApply:W}),c().createElement(i.Space,null,c().createElement(i.Button,{icon:c().createElement(n.ReloadOutlined,null),loading:L,onClick:J},l("Refresh")),c().createElement(i.Button,{"aria-label":l("Delete"),disabled:!en,icon:c().createElement(n.DeleteOutlined,null),onClick:function(){return ei(er,!0)}},l("Delete")),c().createElement(i.Button,{"aria-label":l("Hide in menu"),disabled:!en,icon:c().createElement(n.EyeInvisibleOutlined,null),onClick:function(){return el({hideInMenu:!0})}},l("Hide in menu")),c().createElement(i.Button,{"aria-label":l("Show in menu"),disabled:!en,icon:c().createElement(n.EyeOutlined,null),onClick:function(){return el({hideInMenu:!1})}},l("Show in menu")),c().createElement(i.Button,{"aria-label":l("Add new"),icon:c().createElement(n.PlusOutlined,null),onClick:function(){return ee({})},type:"primary"},l("Add new")))),c().createElement(a.Table,{columns:eu,dataSource:eo,expandable:{rowExpandable:function(e){var t;return!!(null==(t=e.children)?void 0:t.length)}},loading:L,locale:{emptyText:l("No routes")},pagination:{pageSize:20,total:eo.length},rowKey:function(e){var t;return null!=(t=e.id)?t:String(e.schemaUid)},rowSelection:{onChange:H,selectedRowKeys:X}}))}function L(e){var t=e.portal,r=(0,d.kj)(),n=(0,o.useFlowView)(),a=i.theme.useToken().token;return c().createElement("div",{style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0}},n.Header?c().createElement(n.Header,{title:r("Routes")}):null,c().createElement("div",{style:{flex:1,minHeight:0,overflow:"auto",padding:a.paddingLG}},c().createElement(U,{portal:t})))}function q(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function G(e,t,r,n,a,o,l){try{var i=e[o](l),u=i.value}catch(e){r(e);return}i.done?t(u):Promise.resolve(u).then(n,a)}function _(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var o=e.apply(t,r);function l(e){G(o,n,a,l,i,"next",e)}function i(e){G(o,n,a,l,i,"throw",e)}l(void 0)})}}function W(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function V(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 r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function X(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,a=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],l=!0,i=!1;try{for(a=a.call(e);!(l=(r=a.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(e){i=!0,n=e}finally{try{l||null==a.return||a.return()}finally{if(i)throw n}}return o}}(e,t)||K(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 H(e){return function(e){if(Array.isArray(e))return q(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||K(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.")}()}function $(e){return e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function K(e,t){if(e){if("string"==typeof e)return q(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return q(e,t)}}function Q(e,t){var r,n,a,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(l,"next",{value:u(0)}),i(l,"throw",{value:u(1)}),i(l,"return",{value:u(2)}),"function"==typeof Symbol&&i(l,Symbol.iterator,{value:function(){return this}}),l;function u(i){return function(u){var c=[i,u];if(r)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(o=0)),o;)try{if(r=1,n&&(a=2&c[0]?n.return:c[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,c[1])).done)return a;switch(n=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return o.label++,{value:c[1],done:!1};case 5:o.label++,n=c[1],c=[0];continue;case 7:c=o.ops.pop(),o.trys.pop();continue;default:if(!(a=(a=o.trys).length>0&&a[a.length-1])&&(6===c[0]||2===c[0])){o=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){o.label=c[1];break}if(6===c[0]&&o.label<a[1]){o.label=a[1],a=c;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(c);break}a[2]&&o.ops.pop(),o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e],n=0}finally{r=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function J(e,t){if(e&&(void 0===e?"undefined":$(e))==="object")return e[t]}function Y(e){return"string"==typeof e&&e?e:void 0}function Z(e){var t=J(e,"response"),r=J(t,"data"),n=J(r,"errors");if(Array.isArray(n)){var a=n.map(function(e){return Y(J(e,"message"))}).filter(function(e){return!!e}).join("\n");if(a)return a}return Y(J(J(r,"error"),"message"))||Y(J(r,"message"))||Y(J(e,"message"))}function ee(e){return _(function(){return Q(this,function(t){switch(t.label){case 0:return[4,e.resource.create({values:e.values})];case 1:return t.sent(),e.onSubmitted(),[2]}})})()}function et(e){return _(function(){return Q(this,function(t){switch(t.label){case 0:return[4,e.resource.update({filterByTk:e.filterByTk,values:e.values})];case 1:if(t.sent(),!e.setAsDefault)return[3,3];return[4,e.resource.setDefault({filterByTk:e.filterByTk})];case 2:t.sent(),t.label=3;case 3:return e.onSubmitted(),[2]}})})()}function er(e){return _(function(){return Q(this,function(t){switch(t.label){case 0:return[4,e.resource.destroy({filterByTk:e.filterByTk})];case 1:return t.sent(),e.onDeleted(),[2]}})})()}function en(e){return _(function(){return Q(this,function(t){switch(t.label){case 0:return[4,e.resource.setDefault({filterByTk:e.filterByTk})];case 1:return t.sent(),e.onSubmitted(),[2]}})})()}D.displayName="IconPickerFormControl";var ea="no-code",eo=["no-code","ai"],el="nocobase",ei="main",eu={portalType:ea,uiLayoutUid:s.R$,enabled:!0},ec={alignItems:"flex-start"},es="multi-portal-described-radio",ep="\n.".concat(es," .ant-radio {\n align-self: flex-start;\n margin-top: 3px;\n}\n"),ed=/^[a-z0-9_-]+$/,em=c().forwardRef(function(e,t){return c().createElement("div",{ref:t},c().createElement(a.IconPicker,e))});function ef(e){var t=null==e?void 0:e.trim();if(t&&!ed.test(t))return"Portal name can only contain lowercase letters, numbers, hyphens, and underscores"}function ey(e){return"string"!=typeof e?null:e.trim()||null}function eb(e){var t=ey(e);return t&&eo.some(function(e){return e===t})?t:ea}function eh(e){var t=ey(e);return"nocobase"===t||"git"===t?t:el}function eg(e){var t,r,n,a,o,l,i,u=e.options||{},c=e.cover||null;if("ai"!==eb(e.portalType))return V(W({},u),{cover:c});var s=eh(null!=(t=e.sourceStorage)?t:u.sourceStorage);return"git"!==s?V(W({},u),{cover:c,sourceStorage:s}):V(W({},u),{cover:c,sourceStorage:s,git:V(W({},u.git),{repo:ey(null!=(r=e.gitRepo)?r:null==(o=u.git)?void 0:o.repo)||"",branch:ey(null!=(n=e.gitBranch)?n:null==(l=u.git)?void 0:l.branch)||ei,path:ey(null!=(a=e.gitPath)?a:null==(i=u.git)?void 0:i.path)||""})})}function ev(e){var t,r=function(e){if(e&&(void 0===e?"undefined":$(e))==="object"){var t,r,n,a=eh(e.sourceStorage);return"git"!==a?V(W({},e),{sourceStorage:a}):V(W({},e),{sourceStorage:a,git:V(W({},e.git),{repo:ey(null==(t=e.git)?void 0:t.repo)||"",branch:ey(null==(r=e.git)?void 0:r.branch)||ei,path:ey(null==(n=e.git)?void 0:n.path)||""})})}}(e.options);return W({title:e.title,uid:e.uid,portalType:eb(e.portalType),portalName:e.portalName,routePath:e.routePath,uiLayoutUid:e.uiLayoutUid||"",icon:null!=(t=e.icon)?t:null,enabled:e.enabled},r?{options:r}:{})}function eE(e){var t,r,n,a=ev(e),o=a.options,l=eh(null==o?void 0:o.sourceStorage);return V(W({},a),{sourceStorage:l,gitRepo:"git"===l&&(null==o||null==(t=o.git)?void 0:t.repo)||"",gitBranch:(null==o||null==(r=o.git)?void 0:r.branch)||ei,gitPath:(null==o||null==(n=o.git)?void 0:n.path)||"",cover:(null==o?void 0:o.cover)||null})}em.displayName="IconPickerFormControl";var ew={display:"grid",gap:16,gridTemplateColumns:"repeat(auto-fill, minmax(300px, 1fr))"},ek=[210,145,25,340,265,190,45,300,165,120];function eS(e){var t,r,o,l,u,s=e.href,p=e.openLabel,d=e.record,m=i.theme.useToken().token,f=!(6!==(t=(m.colorBgContainer||"").trim().replace("#","")).length||/[^0-9a-f]/i.test(t))&&(299*parseInt(t.slice(0,2),16)+587*parseInt(t.slice(2,4),16)+114*parseInt(t.slice(4,6),16))/1e3<128,y=(r=d.uid||d.portalName||"",o=ek[function(e){for(var t=0,r=0;r<e.length;r+=1)t=(t<<5)-t+e.charCodeAt(r)|0;return Math.abs(t)}(r)%ek.length],f?"hsl(".concat(o,", 32%, 38%)"):"hsl(".concat(o,", 38%, 46%)")),b=(d.title||d.portalName||"?").trim().charAt(0).toUpperCase(),h=null==(u=d.options)||null==(l=u.cover)?void 0:l.url,g=h?c().createElement("div",{"aria-hidden":!0,style:{background:"".concat(m.colorFillQuaternary,' center / cover no-repeat url("').concat(h,'")'),height:"100%",width:"100%"}}):c().createElement("div",{"aria-hidden":!0,style:{alignItems:"center",background:y,display:"flex",height:"100%",justifyContent:"center",overflow:"hidden",width:"100%"}},d.icon?c().createElement(a.Icon,{type:d.icon,style:{color:"#fff",fontSize:24}}):c().createElement("span",{style:{color:"#fff",fontSize:22,fontWeight:600,lineHeight:1}},b)),v=c().createElement("div",{className:"nb-portal-cover",style:{borderRadius:m.borderRadiusLG,height:56,overflow:"hidden",width:56}},g,c().createElement("button",{type:"button","aria-label":p,className:"nb-portal-cover-overlay",onClick:function(){return window.open(s,"_blank","noopener,noreferrer")}},c().createElement(n.ExportOutlined,{style:{fontSize:20}})));return c().createElement("div",{style:{flexShrink:0}},v)}function eT(e){var t=e.title,r=(0,u.useRef)(null),n=X((0,u.useState)(!1),2),a=n[0],o=n[1],l=(0,u.useCallback)(function(e){var t=r.current;o(!!(e&&t&&t.scrollWidth>t.clientWidth))},[]);return c().createElement("span",{style:{display:"block",minWidth:0,position:"relative"}},c().createElement(i.Typography.Text,{ref:r,strong:!0,ellipsis:!0,style:{display:"block",minWidth:0}},t),c().createElement(i.Tooltip,{title:t,open:a,onOpenChange:l},c().createElement("span",{"data-testid":"portal-title-tooltip-trigger",style:{inset:0,position:"absolute"}})))}function eR(e){var t=e.record,r=e.onSubmitted,n=(0,d.kj)(),l=(0,o.useFlowContext)(),s=i.theme.useToken().token,p=i.App.useApp().notification,m=X(i.Form.useForm(),1)[0],f=X((0,u.useState)(!1),2),y=f[0],b=f[1],h=(0,u.useMemo)(function(){return l.api.resource("multiPortals")},[l.api]),g=(0,u.useMemo)(function(){return eE(t)},[t]),v=(0,u.useCallback)(function(){return _(function(){var e,a,o;return Q(this,function(l){switch(l.label){case 0:return[4,m.validateFields()];case 1:l.sent(),e=m.getFieldsValue(!0),(a=ev(t)).options=eg(V(W({},eE(t),e),{portalType:"ai"})),b(!0),l.label=2;case 2:return l.trys.push([2,4,5,6]),[4,et({resource:h,filterByTk:t.uid,values:a,onSubmitted:r})];case 3:return l.sent(),[3,6];case 4:throw o=l.sent(),p.error({message:Z(o)||n("Failed to save portal"),role:"alert"}),o;case 5:return b(!1),[7];case 6:return[2]}})})()},[m,p,r,t,h,n]);return c().createElement(a.DrawerFormLayout,{title:n("Source management"),onSubmit:v,submitting:y,submitText:n("Submit"),cancelText:n("Cancel")},c().createElement("style",null,ep),c().createElement(i.Form,{form:m,layout:"vertical",initialValues:g},c().createElement(i.Form.Item,{name:"sourceStorage",label:n("Source management"),extra:n("Select how the application source code is stored and managed."),htmlFor:"multi-portal-source-storage-nocobase",rules:[{required:!0,message:n("The field value is required")}]},c().createElement(i.Radio.Group,{name:"multi-portal-source-storage",style:{width:"100%"}},c().createElement(i.Space,{direction:"vertical",style:{width:"100%"}},c().createElement(i.Radio,{className:es,id:"multi-portal-source-storage-nocobase",style:ec,value:"nocobase"},c().createElement("span",null,n("NocoBase")),c().createElement("div",{style:{color:s.colorTextDescription,fontSize:s.fontSizeSM}},n("Store and manage application source code in NocoBase."))),c().createElement(i.Radio,{className:es,style:ec,value:"git"},c().createElement("span",null,n("Git")),c().createElement("div",{style:{color:s.colorTextDescription,fontSize:s.fontSizeSM}},n("Store and manage application source code in a Git repository.")))))),c().createElement(i.Form.Item,{noStyle:!0,shouldUpdate:function(e,t){return e.sourceStorage!==t.sourceStorage}},function(e){return"git"===(0,e.getFieldValue)("sourceStorage")?c().createElement(c().Fragment,null,c().createElement(i.Form.Item,{name:"gitRepo",label:n("Git repository URL"),rules:[{required:!0,whitespace:!0,message:n("The field value is required")}]},c().createElement(i.Input,{placeholder:"git@github.com:nocobase/customer-portal.git",allowClear:!0})),c().createElement(i.Space,{size:s.marginSM,style:{display:"flex"},align:"start"},c().createElement(i.Form.Item,{name:"gitBranch",label:n("Git branch"),style:{flex:1}},c().createElement(i.Input,{placeholder:ei})),c().createElement(i.Form.Item,{name:"gitPath",label:n("Git path"),style:{flex:1},extra:n("Directory inside the Git repository for this portal. Leave empty for the root.")},c().createElement(i.Input,{placeholder:"/"})))):null})))}function eD(e){var t=e.record,r=e.onSubmitted,n=(0,d.kj)(),l=(0,o.useFlowContext)(),p=i.theme.useToken().token,m=i.App.useApp().notification,f=X(i.Form.useForm(),1)[0],y=X((0,u.useState)(!1),2),b=y[0],h=y[1],g=(0,u.useMemo)(function(){return l.api.resource("multiPortals")},[l.api]),v=(0,u.useMemo)(function(){return[{value:s.R$,label:n("Desktop")},{value:s.ig,label:n("Mobile")}]},[n]),E=i.Form.useWatch("enabled",f),w=(0,u.useMemo)(function(){return t?V(W({},eE(t)),{setAsDefault:!1}):V(W({},eu),{portalType:"ai",uid:"portal-".concat((0,o.randomId)()),sourceStorage:el,gitBranch:ei,gitPath:"",cover:null})},[t]),k=i.Form.useWatch("portalType",f),S=null!=k?k:w.portalType,T="ai"===S?"/x/":"/v/",R=(0,s.Xc)(null==t?void 0:t.uid)||!!t,D=(0,u.useCallback)(function(e){t||"ai"!==e.portalType||f.setFieldsValue({uiLayoutUid:s.R$})},[f,t]),I=(0,u.useCallback)(function(){return _(function(){var e,a,o;return Q(this,function(l){switch(l.label){case 0:return[4,f.validateFields()];case 1:l.sent(),a=function(e){var t,r=e.portalName.trim(),n=ef(r);if(n)throw Error(n);e.cover,e.gitBranch,e.gitPath,e.gitRepo,e.setAsDefault,e.sourceStorage;var a=function(e,t){if(null==e)return{};var r,n,a,o={};if("u">typeof Reflect&&Reflect.ownKeys){for(a=0,r=Reflect.ownKeys(Object(e));a<r.length;a++)n=r[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n]);return o}if(o=function(e,t){if(null==e)return{};var r,n,a={},o=Object.getOwnPropertyNames(e);for(n=0;n<o.length;n++)r=o[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r]);return a}(e,t),Object.getOwnPropertySymbols)for(a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)n=r[a],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n]);return o}(e,["cover","gitBranch","gitPath","gitRepo","setAsDefault","sourceStorage"]),o=eb(e.portalType);return V(W({},a),{title:e.title.trim(),uid:e.uid.trim(),portalType:o,portalName:r,routePath:"/".concat(r),icon:"string"!=typeof(t=e.icon)?null:t.trim()||null,options:eg(e)})}(e=f.getFieldsValue(!0)),h(!0),l.label=2;case 2:if(l.trys.push([2,7,8,9]),!t)return[3,4];return[4,et({resource:g,filterByTk:t.uid,values:a,setAsDefault:!0!==t.isDefault&&e.enabled&&!0===e.setAsDefault,onSubmitted:r})];case 3:return l.sent(),[3,6];case 4:return[4,ee({resource:g,values:a,onSubmitted:r})];case 5:l.sent(),l.label=6;case 6:return[3,9];case 7:throw o=l.sent(),m.error({message:Z(o)||n("Failed to save portal"),role:"alert"}),o;case 8:return h(!1),[7];case 9:return[2]}})})()},[f,m,r,t,g,n]);return c().createElement(a.DrawerFormLayout,{title:t?n("Edit portal"):n("Add portal"),onSubmit:I,submitting:b,submitText:n("Submit"),cancelText:n("Cancel")},c().createElement("style",null,ep),c().createElement(i.Form,{form:f,layout:"vertical",initialValues:w,onValuesChange:D},c().createElement(i.Form.Item,{name:"uid",hidden:!0,rules:[{required:!0,whitespace:!0,message:n("The field value is required")}]},c().createElement(i.Input,null)),c().createElement(i.Form.Item,{name:"portalName",label:n("Portal name"),extra:c().createElement(c().Fragment,null,c().createElement("div",null,n("Used to generate the portal URL.")),c().createElement("div",null,n("Example:")," ","".concat(T,"<name>"))),rules:[{required:!0,whitespace:!0,message:n("The field value is required")},{validator:function(e,t){var r=ef(t);return r?Promise.reject(Error(n(r))):Promise.resolve()}}]},c().createElement(i.Input,{disabled:R,addonBefore:T})),c().createElement(i.Form.Item,{name:"title",label:n("Title"),extra:n("Display name of the portal."),rules:[{required:!0,whitespace:!0,message:n("Title field is required")}]},c().createElement(i.Input,null)),c().createElement(i.Form.Item,{name:"portalType",label:n("Development mode"),htmlFor:"multi-portal-portal-type-ai",rules:[{required:!0,message:n("The field value is required")}]},c().createElement(i.Radio.Group,{name:"multi-portal-portal-type",disabled:R,style:{width:"100%"}},c().createElement(i.Space,{direction:"vertical",style:{width:"100%"}},c().createElement(i.Radio,{className:es,id:"multi-portal-portal-type-ai",style:ec,value:"ai"},c().createElement("span",null,n("AI mode")),c().createElement("div",{style:{color:p.colorTextDescription,fontSize:p.fontSizeSM}},n("Build complete business systems with AI agents and code.")),c().createElement("div",{style:{color:p.colorTextDescription,fontSize:p.fontSizeSM}},n("Users describe requirements in natural language, and AI agents create and modify applications, including interfaces, data models, business logic, roles and permissions, and more."))),c().createElement(i.Radio,{className:es,style:ec,value:"no-code"},c().createElement("span",null,n("No-code mode")),c().createElement("div",{style:{color:p.colorTextDescription,fontSize:p.fontSizeSM}},n("Build business systems through visual configuration.")),c().createElement("div",{style:{color:p.colorTextDescription,fontSize:p.fontSizeSM}},n("Users create applications through drag-and-drop configuration. AI can assist with creating, adjusting, and optimizing configurations such as data models, interfaces, workflows, and more.")))))),c().createElement(i.Divider,{style:{marginBlock:p.marginSM}}),c().createElement(i.Form.Item,{name:"uiLayoutUid",label:n("Device"),extra:n("No-code portals render with the components of this device; AI portals use it for grouping."),hidden:"ai"===S,dependencies:["portalType"],rules:[{validator:function(e,t){return(0,s.Cn)(t)?Promise.resolve():Promise.reject(Error(n("The field value is required")))}}]},c().createElement(i.Select,{disabled:!!t,options:v,showSearch:!0,optionFilterProp:"label"})),c().createElement(i.Form.Item,{name:"cover",label:n("Cover"),extra:n("Shown on the portal card.")},c().createElement(a.AttachmentUpload,{accept:"image/*",preview:{width:160,height:90,fit:"cover"},uploadText:n("Upload cover")})),c().createElement(i.Form.Item,{name:"icon",label:n("Icon"),extra:n("Used as the cover placeholder when no cover is uploaded.")},c().createElement(em,null)),c().createElement(i.Form.Item,{name:"enabled",label:n("Enabled"),valuePropName:"checked",extra:n("When disabled, this portal will not be registered or accessible.")},c().createElement(i.Switch,null)),t?c().createElement(i.Form.Item,{label:n("Default portal"),extra:n("Users enter this portal by default when they open the application without specifying one.")},t.isDefault?c().createElement(i.Switch,{"aria-label":n("Default portal"),checked:!0,disabled:!0}):c().createElement(i.Form.Item,{name:"setAsDefault",noStyle:!0,valuePropName:"checked"},c().createElement(i.Switch,{"aria-label":n("Default portal"),disabled:!1===E}))):null))}var eI=function(){var e,t=(0,d.kj)(),r=(0,o.useFlowContext)(),a=i.theme.useToken().token,f=i.App.useApp(),y=f.message,b=f.modal,h=X((0,u.useState)([]),2),g=h[0],v=h[1],E=X((0,u.useState)(),2),w=E[0],k=E[1],S=(0,u.useMemo)(function(){return r.api.resource("multiPortals")},[r.api]),T=(0,l.useRequest)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return _(function(){var t,r;return Q(this,function(n){switch(n.label){case 0:return[4,S.list({page:e,pageSize:20,sort:["createdAt"]})];case 1:return[2,null!=(t=null==(r=n.sent())?void 0:r.data)?t:{data:[]}]}})})()}),R=T.data,D=T.loading,I=(0,u.useMemo)(function(){return Array.isArray(null==R?void 0:R.data)?R.data:[]},[null==R?void 0:R.data]),O=(0,u.useMemo)(function(){var e=[{key:"ai",title:"AI",records:[]},{key:"no-code",title:"No-code",records:[]}],t=!0,r=!1,n=void 0;try{for(var a,o=I[Symbol.iterator]();!(t=(a=o.next()).done);t=!0){var l=a.value;e[+(eb(l.portalType)===ea)].records.push(l)}}catch(e){r=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(r)throw n}}return e.filter(function(e){return e.records.length>0})},[I]),x=(0,u.useMemo)(function(){return"\n.nb-portal-card {\n transition: box-shadow ".concat(a.motionDurationMid,";\n}\n.nb-portal-card:hover {\n box-shadow: ").concat(a.boxShadowSecondary,";\n}\n.nb-portal-cover {\n position: relative;\n}\n.nb-portal-cover-overlay {\n align-items: center;\n background: rgba(0, 0, 0, 0.45);\n border: 0;\n color: #fff;\n cursor: pointer;\n display: flex;\n inset: 0;\n justify-content: center;\n opacity: 0;\n padding: 0;\n position: absolute;\n transition: opacity ").concat(a.motionDurationMid,";\n}\n.nb-portal-card:hover .nb-portal-cover-overlay,\n.nb-portal-cover-overlay:focus-visible {\n opacity: 1;\n}\n")},[a]),B=(0,u.useMemo)(function(){var e,t,r,n=null==R?void 0:R.meta;return!!n&&{total:null!=(e=n.count)?e:I.length,pageSize:null!=(t=n.pageSize)?t:20,current:null!=(r=n.page)?r:1}},[null==R?void 0:R.meta,I.length]),P=(0,u.useCallback)(function(){var e,t;T.run(null!=(e=null==R||null==(t=R.meta)?void 0:t.page)?e:1)},[T,null==R||null==(e=R.meta)?void 0:e.page]),F=(0,u.useCallback)(function(){(0,p.G)(r.app).reload(r.api).catch(function(e){console.error("[NocoBase] Failed to refresh portal entry actions.",e)})},[r.api,r.app]),C=(0,u.useCallback)(function(){P(),F()},[F,P]),j=(0,u.useCallback)(function(e){r.viewer.drawer({width:a.screenMD,closable:!0,content:function(){return c().createElement(eD,{record:e,onSubmitted:C})}})},[r.viewer,C,a.screenMD]),N=(0,u.useCallback)(function(e){r.viewer.drawer({width:"80%",closable:!0,content:function(){return c().createElement(L,{portal:e})}})},[r.viewer]),A=(0,u.useCallback)(function(e){r.viewer.drawer({width:a.screenSM,closable:!0,content:function(){return c().createElement(eR,{record:e,onSubmitted:C})}})},[r.viewer,C,a.screenSM]),M=(0,u.useCallback)(function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};b.confirm({title:t("Delete portal"),content:c().createElement(c().Fragment,null,c().createElement("div",null,r.isBatch?t("Are you sure you want to delete the selected Multi-portal records?"):t("Are you sure you want to delete it?")),c().createElement("div",null,t("The corresponding portal directory will also be deleted."))),onOk:function(){return _(function(){return Q(this,function(t){switch(t.label){case 0:return[4,er({resource:S,filterByTk:e,onDeleted:C})];case 1:return t.sent(),[2]}})})()}})},[b,C,S,t]),z=(0,u.useCallback)(function(e,r){return _(function(){var n;return Q(this,function(a){switch(a.label){case 0:v(function(t){return t.includes(e.uid)?t:H(t).concat([e.uid])}),a.label=1;case 1:return a.trys.push([1,,3,4]),n=ev(e),delete n.uiLayoutUid,n.enabled=r,[4,et({resource:S,filterByTk:e.uid,values:n,onSubmitted:C})];case 2:return a.sent(),y.success(t("Updated successfully")),[3,4];case 3:return v(function(t){return t.filter(function(t){return t!==e.uid})}),[7];case 4:return[2]}})})()},[y,C,S,t]),U=(0,l.useMemoizedFn)(function(e){return _(function(){return Q(this,function(r){switch(r.label){case 0:k(e.uid),r.label=1;case 1:return r.trys.push([1,,3,4]),[4,en({resource:S,filterByTk:e.uid,onSubmitted:C})];case 2:return r.sent(),y.success(t("Default portal updated successfully")),[3,4];case 3:return k(void 0),[7];case 4:return[2]}})})()}),q=(0,u.useCallback)(function(e){var o,l=(0,m.u)(r.app,e.routePath,e.portalType),u=eb(e.portalType)===ea,p=!u||!e.enabled,d=(o=e.uiLayoutUid,o===s.R$?t("Desktop"):o===s.ig?t("Mobile"):o||""),f=c().createElement(i.Card,{className:"nb-portal-card",size:"small",styles:{body:{padding:a.paddingLG}},style:{cursor:"pointer",opacity:e.enabled?1:.6,overflow:"visible"},onClick:function(e){var t=e.target;!e.currentTarget.contains(t)||t.closest("button, a, .ant-switch")||window.open(l,"_blank","noopener,noreferrer")}},c().createElement(i.Flex,{align:"center",gap:a.margin},c().createElement(eS,{record:e,href:l,openLabel:t("View")}),c().createElement("div",{style:{flex:1,minWidth:0}},c().createElement(i.Flex,{align:"center",gap:a.marginXXS},c().createElement(eT,{title:e.title}),u&&d?c().createElement(i.Tooltip,{title:d},e.uiLayoutUid===s.ig?c().createElement(n.MobileOutlined,{"aria-label":d,style:{color:a.colorTextDescription,fontSize:a.fontSizeSM}}):c().createElement(n.DesktopOutlined,{"aria-label":d,style:{color:a.colorTextDescription,fontSize:a.fontSizeSM}})):null),c().createElement(i.Flex,{align:"center",gap:a.marginXXS,style:{minWidth:0}},c().createElement(i.Typography.Link,{href:l,target:"_blank",rel:"noopener noreferrer",ellipsis:!0,type:"secondary",style:{fontSize:a.fontSizeSM,minWidth:0}},l))),c().createElement(i.Flex,{align:"center",gap:a.marginXS,style:{alignSelf:"flex-start",flexShrink:0}},c().createElement(i.Tooltip,{title:e.isDefault?t("The default portal cannot be disabled"):""},c().createElement(i.Switch,{"aria-label":t("Enabled"),checked:e.enabled,disabled:!0===e.isDefault,loading:g.includes(e.uid)||w===e.uid,size:"small",onChange:function(t){return _(function(){return Q(this,function(r){switch(r.label){case 0:return[4,z(e,t)];case 1:return r.sent(),[2]}})})()}})),c().createElement(i.Dropdown,{trigger:["click"],menu:{items:[{key:"edit",icon:c().createElement(n.EditOutlined,null),label:t("Edit")}].concat(H(u?[]:[{key:"sourceManagement",icon:c().createElement(n.CodeOutlined,null),label:t("Source management")}]),H(p?[]:[{key:"routes",icon:c().createElement(n.ApartmentOutlined,null),label:t("Routes")}]),H(!0!==e.isDefault&&e.enabled?[{key:"default",icon:c().createElement(n.StarOutlined,null),label:t("Set as default")}]:[]),[{type:"divider"},{key:"delete",icon:c().createElement(n.DeleteOutlined,null),label:t("Delete")}]),onClick:function(t){var r=t.key;"edit"===r?j(e):"sourceManagement"===r?A(e):"routes"===r?N(e):"default"===r?U(e):"delete"===r&&M(e.uid)}}},c().createElement(i.Button,{"aria-label":t("More"),type:"text",size:"small",icon:c().createElement(n.EllipsisOutlined,null)})))));return c().createElement("div",{key:e.uid},e.isDefault?c().createElement(i.Badge.Ribbon,{text:t("Default"),color:a.colorWarning,placement:"start"},f):f)},[r.app,M,U,z,j,N,A,t,a.fontSizeSM,a.colorTextDescription,a.colorWarning,a.margin,a.marginXS,a.marginXXS,a.paddingLG,w,g]);return c().createElement("div",null,c().createElement("style",null,x),c().createElement(i.Flex,{justify:"space-between",align:"center",wrap:!0,gap:a.marginSM,style:{marginBottom:a.marginMD}},c().createElement(i.Typography.Text,{type:"secondary"},t("Each portal is a standalone front end with its own routes and menus.")),c().createElement(i.Space,null,c().createElement(i.Button,{icon:c().createElement(n.ReloadOutlined,null),onClick:C},t("Refresh")),c().createElement(i.Button,{type:"primary",icon:c().createElement(n.PlusOutlined,null),onClick:function(){return j()}},t("Add portal")))),c().createElement(i.Spin,{spinning:D},0!==I.length||D?O.map(function(e){return c().createElement("div",{key:e.key,style:{marginBottom:a.marginXL}},c().createElement(i.Flex,{align:"center",gap:a.marginXS,style:{marginBottom:a.marginSM}},c().createElement(i.Typography.Text,{strong:!0},t(e.title)),c().createElement(i.Typography.Text,{type:"secondary",style:{fontSize:a.fontSizeSM}},e.records.length),c().createElement("div",{style:{background:a.colorSplit,flex:1,height:a.lineWidth}})),c().createElement("div",{style:ew},e.records.map(q)))}):c().createElement(i.Empty,{description:t("No portals yet"),style:{padding:a.paddingXL}},c().createElement(i.Button,{type:"primary",icon:c().createElement(n.PlusOutlined,null),onClick:function(){return j()}},t("Add portal")))),B?c().createElement(i.Flex,{justify:"flex-end",style:{marginTop:a.marginMD}},c().createElement(i.Pagination,{current:B.current,pageSize:B.pageSize,total:B.total,showSizeChanger:!1,onChange:function(e){return T.run(e)}})):null)}}}]);
|
package/dist/client-v2/index.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("ahooks"),require("@nocobase/client-v2"),require("react-router-dom"),require("@nocobase/plugin-ui-layout/client-v2"),require("react"),require("antd"),require("antd-style"),require("@nocobase/flow-engine"),require("@ant-design/icons")):"function"==typeof define&&define.amd?define("@nocobase/plugin-multi-portal/client-v2",["ahooks","@nocobase/client-v2","react-router-dom","@nocobase/plugin-ui-layout/client-v2","react","antd","antd-style","@nocobase/flow-engine","@ant-design/icons"],e):"object"==typeof exports?exports["@nocobase/plugin-multi-portal/client-v2"]=e(require("ahooks"),require("@nocobase/client-v2"),require("react-router-dom"),require("@nocobase/plugin-ui-layout/client-v2"),require("react"),require("antd"),require("antd-style"),require("@nocobase/flow-engine"),require("@ant-design/icons")):t["@nocobase/plugin-multi-portal/client-v2"]=e(t.ahooks,t["@nocobase/client-v2"],t["react-router-dom"],t["@nocobase/plugin-ui-layout/client-v2"],t.react,t.antd,t["antd-style"],t["@nocobase/flow-engine"],t["@ant-design/icons"])}(self,function(t,e,r,n,o,a,i,l,u){return function(){"use strict";var c,s,f,p={337:function(t,e,r){r.d(e,{G:function(){return u}});var n=r(694);function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function a(t){var e=t||{};return{apps:Array.isArray(e.apps)?e.apps:[],portals:Array.isArray(e.portals)?e.portals:[]}}var i=function(){var t;function e(t){if(!(this instanceof e))throw TypeError("Cannot call a class as a function");o(this,"app",void 0),o(this,"payload",void 0),o(this,"loading",void 0),o(this,"revision",void 0),o(this,"loaded",void 0),o(this,"request",void 0),o(this,"requestId",void 0),this.app=t,this.payload=a(null),this.loading=!1,this.revision=0,this.loaded=!1,this.requestId=0,(0,n.define)(this,{payload:n.observable.ref,loading:n.observable.ref,revision:n.observable.ref})}return t=[{key:"load",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.app.apiClient;return this.loaded&&!this.request?Promise.resolve(this.payload):this.requestPortals(t)}},{key:"reload",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.app.apiClient;return this.requestPortals(t,{force:!0,invalidateEntryActions:!0})}},{key:"requestPortals",value:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.request||r.force){var n,o=++this.requestId;this.loading=!0,this.request=((null==(n=t.silent)?void 0:n.call(t))||t).request({url:"app:getPortals",skipNotify:!0}).then(function(t){var n,i,l,u=a(null!=(n=null==t||null==(i=t.data)?void 0:i.data)?n:null==t?void 0:t.data);return o===e.requestId&&(e.payload=u,e.loaded=!0,e.revision+=1,r.invalidateEntryActions&&(null==(l=e.app.entryActionManager)||l.invalidate())),u}).catch(function(t){throw t}).finally(function(){o===e.requestId&&(e.loading=!1,e.request=void 0)})}return this.request}}],function(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}(e.prototype,t),e}(),l=new WeakMap;function u(t){var e=l.get(t);return e||(e=new i(t),l.set(t,e)),e}},143:function(t,e,r){r.d(e,{Dj:function(){return l},kj:function(){return i},MZ:function(){return u}});var n=r(694),o=JSON.parse('{"UU":"@nocobase/plugin-multi-portal"}');function a(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),n.forEach(function(e){var n;n=r[e],e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n})}return t}function i(){var t=(0,n.useFlowEngine)();return function(e,r){return t.context.t(e,a({ns:[o.UU,"client"]},r))}}function l(t){return a({ns:[o.UU,"client"]},t)}function u(t){return(0,n.tExpr)(t,{ns:[o.UU,"client"]})}},756:function(t,e,r){r.d(e,{Q:function(){return w},u:function(){return g}});var n=r(485);function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function a(t){return function(t){if(Array.isArray(t))return o(t)}(t)||function(t){if("u">typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t){if(t){if("string"==typeof t)return o(t,void 0);var e=Object.prototype.toString.call(t).slice(8,-1);if("Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e)return Array.from(e);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return o(t,void 0)}}(t)||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 i="no-code",l="/settings",u=function(t){var e=null==t?void 0:t.trim();return e&&"/"!==e?"/".concat(e.replace(/^\/+/,"")):"/"},c=function(t){var e=u(t).replace(/\/+$/,"");return""===e||"/"===e?"":e},s=function(t,e){var r=c(t),n=u(e);return!r||n===r||n.startsWith("".concat(r,"/"))?n:"".concat(r).concat(n)};function f(t){return"ai"===t?"ai":i}function p(t){return"ai"===f(t)?"/x":"/".concat((0,n.getModernClientPrefix)())}function d(){return Array.from(new Set([p(i),"/x","/v"]))}function y(t,e){var r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],n=c(t),o=p(e);if(!n)return o;var i=r?n.match(/^(.*)\/(apps|_app)\/([^/]+)$/):null;if(i){var u=i[1]||"",s=!0,y=!1,v=void 0;try{for(var b,h=a(d()).concat([l])[Symbol.iterator]();!(s=(b=h.next()).done);s=!0){var g=b.value;if(u===g){u="";break}if(u.endsWith(g)){u=u.slice(0,-g.length);break}}}catch(t){y=!0,v=t}finally{try{s||null==h.return||h.return()}finally{if(y)throw v}}var m="ai"===f(e)?"apps":i[2];return"".concat(u).concat(o,"/").concat(m,"/").concat(i[3])}var w=!0,P=!1,S=void 0;try{for(var O,j=d()[Symbol.iterator]();!(w=(O=j.next()).done);w=!0){var k=O.value;if(n===k)return o;if(n.endsWith(k))return"".concat(n.slice(0,-k.length)).concat(o)}}catch(t){P=!0,S=t}finally{try{w||null==j.return||j.return()}finally{if(P)throw S}}return"".concat(n).concat(o)}function v(t,e,r){var n=!(arguments.length>3)||void 0===arguments[3]||arguments[3],o=u(t),i=!0,l=!1,s=void 0;try{for(var p,v=[y(e,r,n),y(e,"ai"===f(r)?"no-code":"ai",n)].concat(a(d()))[Symbol.iterator]();!(i=(p=v.next()).done);i=!0){var b=p.value;o=function(t,e){var r=c(e),n=u(t);return r?n===r?"/":n.startsWith("".concat(r,"/"))?n.slice(r.length)||"/":n:n}(o,b)}}catch(t){l=!0,s=t}finally{try{i||null==v.return||v.return()}finally{if(l)throw s}}return o}function b(t){return"function"==typeof(null==t?void 0:t.getPublicPath)}function h(t,e){var r,n=null==t||null==(r=t.getPublicPath)?void 0:r.call(t);return!("main"===(t&&"name"in t&&"string"==typeof t.name?t.name:void 0)&&n&&c(n)===c(e))}function g(t,e,r){var o,a,i,l,f=e.trim();if(/^[a-z][a-z\d+\-.]*:\/\//i.test(f)||f.startsWith("//"))return f;var p=(null==t||null==(a=t.router)||null==(o=a.getBasename)?void 0:o.call(a))||(null==t||null==(i=t.router)?void 0:i.basename);if(p){var d=b(t)?(0,n.getV2EffectiveBasePath)({getPublicPath:t.getPublicPath,router:{getBasename:function(){var e,r,n;return(null==(r=t.router)||null==(e=r.getBasename)?void 0:e.call(r))||(null==(n=t.router)?void 0:n.basename)}}}):p,g=h(t,d);return s(y(d,r,g),v(f,d,r,g))}if(null==t?void 0:t.getRouteUrl){var m,w,P=t.getRouteUrl(f),S=(m=u(P))===(w=u(f))?"":m.endsWith(w)?c(m.slice(0,-w.length)):void 0;if(void 0!==S){var O=h(t,S);return s(y(S,r,O),v(f,S,r,O))}return u(P)}var j=null==t||null==(l=t.getPublicPath)?void 0:l.call(t),k=h(t,j);return s(y(j,r,k),v(f,j,r,k))}function m(t){var e=c(t),r=Array.from(new Set([p(i),"/v"])),n=!0,o=!1,a=void 0;try{for(var u,f=r[Symbol.iterator]();!(n=(u=f.next()).done);n=!0){var d=u.value;if(e===d)return l;var y=e.match(new RegExp("^(.*)".concat(d,"/(apps|_app)/([^/]+)$")));if(y)return"".concat(y[1]).concat(l,"/").concat(y[2],"/").concat(y[3]);if(e.endsWith(d))return"".concat(e.slice(0,-d.length)).concat(l)}}catch(t){o=!0,a=t}finally{try{n||null==f.return||f.return()}finally{if(o)throw a}}return s(e,l)}function w(t){var e,r,o,a,i=(null==t||null==(r=t.router)||null==(e=r.getBasename)?void 0:e.call(r))||(null==t||null==(o=t.router)?void 0:o.basename);return i?m(b(t)?(0,n.getV2EffectiveBasePath)({getPublicPath:t.getPublicPath,router:{getBasename:function(){var e,r,n;return(null==(r=t.router)||null==(e=r.getBasename)?void 0:e.call(r))||(null==(n=t.router)?void 0:n.basename)}}}):i):m(null==t||null==(a=t.getPublicPath)?void 0:a.call(t))}},624:function(t,e,r){r.d(e,{Jx:function(){return n},Xc:function(){return a}});var n="__default_mobile__",o=new Set(["__default_admin__",n]);function a(t){return"string"==typeof t&&o.has(t)}},375:function(t){t.exports=u},485:function(t){t.exports=e},694:function(t){t.exports=l},69:function(t){t.exports=n},625:function(e){e.exports=t},59:function(t){t.exports=a},235:function(t){t.exports=i},155:function(t){t.exports=o},442:function(t){t.exports=r}},d={};function y(t){var e=d[t];if(void 0!==e)return e.exports;var r=d[t]={exports:{}};return p[t](r,r.exports,y),r.exports}y.m=p,y.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return y.d(e,{a:e}),e},y.d=function(t,e){for(var r in e)y.o(e,r)&&!y.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},y.f={},y.e=function(t){return Promise.all(Object.keys(y.f).reduce(function(e,r){return y.f[r](t,e),e},[]))},y.u=function(t){return""+t+"."+({354:"7be267ae5d61a878",499:"ef2ff0c022687485",556:"37df9197ce5c3452",778:"c98e7ec542d931fe"})[t]+".js"},y.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(t){if("object"==typeof window)return window}}(),y.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},v={},y.l=function(t,e,r,n){if(v[t])return void v[t].push(e);if(void 0!==r)for(var o,a,i=document.getElementsByTagName("script"),l=0;l<i.length;l++){var u=i[l];if(u.getAttribute("src")==t||u.getAttribute("data-rspack")=="@nocobase/plugin-multi-portal/client-v2:"+r){o=u;break}}o||(a=!0,(o=document.createElement("script")).timeout=120,y.nc&&o.setAttribute("nonce",y.nc),o.setAttribute("data-rspack","@nocobase/plugin-multi-portal/client-v2:"+r),o.src=t),v[t]=[e];var c=function(e,r){o.onerror=o.onload=null,clearTimeout(s);var n=v[t];if(delete v[t],o.parentNode&&o.parentNode.removeChild(o),n&&n.forEach(function(t){return t(r)}),e)return e(r)},s=setTimeout(c.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=c.bind(null,o.onerror),o.onload=c.bind(null,o.onload),a&&document.head.appendChild(o)},y.r=function(t){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},y.g.importScripts&&(b=y.g.location+"");var v,b,h=y.g.document;if(!b&&h&&(h.currentScript&&"SCRIPT"===h.currentScript.tagName.toUpperCase()&&(b=h.currentScript.src),!b)){var g=h.getElementsByTagName("script");if(g.length)for(var m=g.length-1;m>-1&&(!b||!/^http(s?):/.test(b));)b=g[m--].src}if(!b)throw Error("Automatic publicPath is not supported in this browser");y.p=b.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),c={889:0},y.f.j=function(t,e){var r=y.o(c,t)?c[t]:void 0;if(0!==r)if(r)e.push(r[2]);else{var n=new Promise(function(e,n){r=c[t]=[e,n]});e.push(r[2]=n);var o=y.p+y.u(t),a=Error();y.l(o,function(e){if(y.o(c,t)&&(0!==(r=c[t])&&(c[t]=void 0),r)){var n=e&&("load"===e.type?"missing":e.type),o=e&&e.target&&e.target.src;a.message="Loading chunk "+t+" failed.\n("+n+": "+o+")",a.name="ChunkLoadError",a.type=n,a.request=o,r[1](a)}},"chunk-"+t,t)}},s=function(t,e){var r,n,o=e[0],a=e[1],i=e[2],l=0;if(o.some(function(t){return 0!==c[t]})){for(r in a)y.o(a,r)&&(y.m[r]=a[r]);i&&i(y)}for(t&&t(e);l<o.length;l++)n=o[l],y.o(c,n)&&c[n]&&c[n][0](),c[n]=0},(f=self.webpackChunk_nocobase_plugin_multi_portal_client_v2=self.webpackChunk_nocobase_plugin_multi_portal_client_v2||[]).forEach(s.bind(null,0)),f.push=s.bind(null,f.push.bind(f));var w={};return!function(){var t="",e="u">typeof document?document.currentScript:null;if(e&&e.src){var r=e.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");r.indexOf("/static/plugins/@nocobase/plugin-multi-portal/dist/client-v2/")>=0&&(t=r.replace(/\/[^\/]+$/,"/"))}if(!t){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),t=n+"static/plugins/@nocobase/plugin-multi-portal/dist/client-v2/")}if(!t){var o=window.__nocobase_modern_client_prefix__||"v",a="/"+(o=String(o).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(t=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var i=window.location.pathname||"/",l=i.indexOf(a);t=l>=0?i.slice(0,l+1):"/"}t&&(t=t.replace(RegExp("/"+o+"/?$"),"/")),t||(t="/"),"/"!==t.charAt(t.length-1)&&(t+="/"),t+="static/plugins/@nocobase/plugin-multi-portal/dist/client-v2/"}y.p=t}(),!function(){y.r(w),y.d(w,{default:function(){return th}});var t,e=y(485),r=y(155),n=y.n(r),o=y(442),a=y(756);function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function l(t,e,r,n,o,a,i){try{var l=t[a](i),u=l.value}catch(t){r(t);return}l.done?e(u):Promise.resolve(u).then(n,o)}function u(t){return"".concat(t.search||"").concat(t.hash||"")}function c(t){var c,s=t.runtimeRegistrationFailed,f=void 0!==s&&s,p=(0,e.useApp)(),d=(0,o.useLocation)(),y=function(t){if(Array.isArray(t))return t}(c=(0,r.useState)())||function(t){var e,r,n=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var o=[],a=!0,i=!1;try{for(n=n.call(t);!(a=(e=n.next()).done)&&(o.push(e.value),2!==o.length);a=!0);}catch(t){i=!0,r=t}finally{try{a||null==n.return||n.return()}finally{if(i)throw r}}return o}}(c)||function(t){if(t){if("string"==typeof t)return i(t,2);var e=Object.prototype.toString.call(t).slice(8,-1);if("Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e)return Array.from(e);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return i(t,2)}}(c)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),v=y[0],b=y[1],h=(0,r.useRef)();return((0,r.useEffect)(function(){if(f)return void window.location.replace("".concat((0,a.Q)(p)).concat(u(d)));var t,e=!0;return(t=function(){var t,r,n;return function(t,e){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:u(0)}),l(i,"throw",{value:u(1)}),l(i,"return",{value:u(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function u(l){return function(u){var c=[l,u];if(r)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=e.call(t,a)}catch(t){c=[6,t],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,p.apiClient.request({url:"multiPortals:getDefault",method:"get",skipAuth:!0,skipNotify:!0})];case 1:var i;if(r=o.sent(),!e)return[2];if((i=n=null==r||null==(t=r.data)?void 0:t.data)&&(void 0===i?"undefined":i&&"u">typeof Symbol&&i.constructor===Symbol?"symbol":typeof i)=="object"&&"string"==typeof i.uid&&i.uid.length>0&&("no-code"===i.portalType||"ai"===i.portalType)&&"string"==typeof i.routePath&&i.routePath.trim().length>0){if("no-code"===n.portalType&&!p.layoutManager.listLayouts().some(function(t){return t.uid===n.uid}))return window.location.replace("".concat((0,a.Q)(p)).concat(u(d))),[2];return b(n),[2]}return window.location.replace("".concat((0,a.Q)(p)).concat(u(d))),[3,3];case 2:if(o.sent(),!e)return[2];return window.location.replace("".concat((0,a.Q)(p)).concat(u(d))),[3,3];case 3:return[2]}})},function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){l(a,n,o,i,u,"next",t)}function u(t){l(a,n,o,i,u,"throw",t)}i(void 0)})})(),function(){e=!1}},[p,d,f]),(0,r.useEffect)(function(){if(v&&"ai"===v.portalType){var t="".concat((0,a.u)(p,v.routePath,v.portalType)).concat(u(d));h.current!==t&&(h.current=t,window.location.replace(t))}},[p,d,v]),v&&"ai"!==v.portalType)?n().createElement(o.Navigate,{replace:!0,to:{pathname:v.routePath,search:d.search,hash:d.hash}}):null}var s=y(337);function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function p(t,e,r,n,o,a,i){try{var l=t[a](i),u=l.value}catch(t){r(t);return}l.done?e(u):Promise.resolve(u).then(n,o)}function d(t){return function(t){if(Array.isArray(t))return f(t)}(t)||function(t){if("u">typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t){if(t){if("string"==typeof t)return f(t,void 0);var e=Object.prototype.toString.call(t).slice(8,-1);if("Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e)return Array.from(e);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return f(t,void 0)}}(t)||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 v=["action-panel","app-switcher"],b="desktop",h="mobile",g="main";function m(t){return!!t&&(void 0===t?"undefined":t&&"u">typeof Symbol&&t.constructor===Symbol?"symbol":typeof t)=="object"}function P(t){return"string"==typeof t&&t?t:null}function S(t){var e=P(t);return!!e&&e.toLowerCase().includes(h)}function O(t){return t.title||t.routePath}function j(t){var e=new Set;return t.filter(function(t){return!e.has(t)&&(e.add(t),!0)})}function k(t,e,r){return t===g?r("Main application"):(null==e?void 0:e.title)||t}var M=y(624);function x(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function A(t,e,r,n,o,a,i){try{var l=t[a](i),u=l.value}catch(t){r(t);return}l.done?e(u):Promise.resolve(u).then(n,o)}function E(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){A(a,n,o,i,l,"next",t)}function l(t){A(a,n,o,i,l,"throw",t)}i(void 0)})}}function R(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),n.forEach(function(e){var n;n=r[e],e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n})}return t}function _(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):(function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e.push.apply(e,r)}return e})(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}),t}function T(t,e){if(null==t)return{};var r,n,o,a={};if("u">typeof Reflect&&Reflect.ownKeys){for(o=0,r=Reflect.ownKeys(Object(t));o<r.length;o++)n=r[o],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(a[n]=t[n]);return a}if(a=function(t,e){if(null==t)return{};var r,n,o={},a=Object.getOwnPropertyNames(t);for(n=0;n<a.length;n++)r=a[n],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r]);return o}(t,e),Object.getOwnPropertySymbols)for(o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)n=r[o],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(a[n]=t[n]);return a}function I(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r,n,o=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=o){var a=[],i=!0,l=!1;try{for(o=o.call(t);!(i=(r=o.next()).done)&&(a.push(r.value),!e||a.length!==e);i=!0);}catch(t){l=!0,n=t}finally{try{i||null==o.return||o.return()}finally{if(l)throw n}}return a}}(t,e)||L(t,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.")}()}function C(t){return function(t){if(Array.isArray(t))return x(t)}(t)||function(t){if("u">typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||L(t)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function q(t){return t&&"u">typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function L(t,e){if(t){if("string"==typeof t)return x(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return x(t,e)}}function U(t,e){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:u(0)}),l(i,"throw",{value:u(1)}),l(i,"return",{value:u(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function u(l){return function(u){var c=[l,u];if(r)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=e.call(t,a)}catch(t){c=[6,t],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var B=Symbol("multiPortalRouteRepositoryState");function N(t){var e;return(null==(e=t.scopeStack[t.scopeStack.length-1])?void 0:e.scope)||{cacheKey:"admin-layout-model",uiLayoutUid:"admin-layout-model"}}function D(t){return t.getAPIClient()}function W(t){return"string"==typeof t.portalUid}function K(t){var e=t.children;return R({},(t.multiPortals,t.uiLayouts,T(t,["children","multiPortals","uiLayouts"])),Array.isArray(e)?{children:e.map(function(t){return K(t)})}:{})}function z(t,e,r){return E(function(){var n,o,a,i;return U(this,function(l){switch(l.label){case 0:return o=(r.refreshRequestIds.get(e.cacheKey)||0)+1,r.refreshRequestIds.set(e.cacheKey,o),[4,D(t).request({url:"/desktopRoutes:listAccessible",params:{tree:!0,sort:"sort",portal:e.portalUid}})];case 1:return i=Array.isArray(null==(a=l.sent())||null==(n=a.data)?void 0:n.data)?a.data.data:[],r.refreshRequestIds.get(e.cacheKey)===o&&t.setRoutes(i,e.cacheKey),[2,i]}})})()}function G(t,e,r,n,o,a,i){try{var l=t[a](i),u=l.value}catch(t){r(t);return}l.done?e(u):Promise.resolve(u).then(n,o)}function $(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var H="mobile",F=($(t={},"desktop",{layoutModelClass:"AdminLayoutModel"}),$(t,H,{layoutModelClass:"MultiPortalMobileLayoutModel",rootPageModelClass:"MultiPortalMobileRootPageModel",childPageModelClass:"MultiPortalMobileChildPageModel"}),t),X={layoutModelClass:"MobileLayoutModel",rootPageModelClass:"MobileRootPageModel",childPageModelClass:"MobileChildPageModel"};function Q(t){return"no-code"===(t.portalType||"no-code")}var J=y(625),Z=y(59),V=y(235),Y=y(143);function tt(t,e,r,n,o,a,i){try{var l=t[a](i),u=l.value}catch(t){r(t);return}l.done?e(u):Promise.resolve(u).then(n,o)}function te(t){return(te=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function tr(t,e){return(tr=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function tn(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(tn=function(){return!!t})()}var to=Z.Typography.Text;function ta(t){var e=t.controlHeightLG+t.paddingSM+t.paddingXXS,r=t.paddingLG-t.paddingXXS;return{avatarSize:e,cardHeight:e+2*r,gridMinColumnWidth:9*t.controlHeightLG,iconSize:t.fontSizeHeading3+t.marginXXS,paddingBlock:r}}var ti=(0,V.createStyles)(function(t){var e=t.token;return{portalItem:{"&:hover":{background:e.colorBgTextHover,borderColor:e.colorBorder,boxShadow:e.boxShadowTertiary,color:e.colorText,transform:"translateY(-".concat(e.lineWidth,"px)")},"&:focus-visible":{outline:"".concat(e.controlOutlineWidth,"px solid ").concat(e.colorPrimaryBorder),outlineOffset:e.controlOutlineWidth},".ant-typography":{color:"inherit"}}}});function tl(t){var e;return(null==(e=t.title)?void 0:e.trim())||t.uid}function tu(t){var r,o,a,i,l=t.record,u=t.token,c=ta(u),s=null==(i=l.icon)?void 0:i.trim(),f={alignItems:"center",background:u.colorFillTertiary,borderRadius:u.borderRadiusLG,color:u.colorText,display:"flex",flex:"0 0 ".concat(c.avatarSize,"px"),fontSize:u.fontSizeHeading3,height:c.avatarSize,justifyContent:"center",lineHeight:1,width:c.avatarSize};if(s)return n().createElement(Z.Avatar,{shape:"square",size:c.avatarSize,style:f,icon:null},n().createElement(e.Icon,{type:s,"aria-hidden":!0,style:{color:u.colorPrimary,fontSize:c.iconSize}}));var p=(r=[{background:u.colorPrimaryBg,color:u.colorPrimary},{background:u.colorSuccessBg,color:u.colorSuccess},{background:u.colorWarningBg,color:u.colorWarning},{background:u.colorErrorBg,color:u.colorError},{background:u.colorInfoBg,color:u.colorInfo}])[function(t,e){var r=0,n=!0,o=!1,a=void 0;try{for(var i,l=t[Symbol.iterator]();!(n=(i=l.next()).done);n=!0){var u=i.value;r=(31*r+u.charCodeAt(0))%0x7fffffff}}catch(t){o=!0,a=t}finally{try{n||null==l.return||l.return()}finally{if(o)throw a}}return Math.abs(r)%e}("".concat(l.uid,":").concat(l.title||""),r.length)];return n().createElement(Z.Avatar,{"aria-hidden":!0,shape:"square",size:c.avatarSize,style:(o=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),n.forEach(function(e){var n;n=r[e],e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n})}return t}({},f),a=a={background:p.background,color:p.color,fontWeight:u.fontWeightStrong},Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(a)):(function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e.push.apply(e,r)}return e})(Object(a)).forEach(function(t){Object.defineProperty(o,t,Object.getOwnPropertyDescriptor(a,t))}),o)},(tl(l).trim()[0]||"P").toUpperCase())}function tc(t){var e=t.model,o=Z.theme.useToken().token,i=ti().styles,l=(0,r.useMemo)(function(){return ta(o)},[o]),u=e.context.app,c=e.translate,s=(0,J.useRequest)(function(){var t;return(t=function(){var t,e,r;return function(t,e){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:u(0)}),l(i,"throw",{value:u(1)}),l(i,"return",{value:u(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function u(l){return function(u){var c=[l,u];if(r)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=e.call(t,a)}catch(t){c=[6,t],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(n){switch(n.label){case 0:return[4,null==u||null==(t=u.apiClient)?void 0:t.request({url:"multiPortals:listAccessible",method:"get",skipNotify:!0})];case 1:return[2,Array.isArray(null==(r=n.sent())||null==(e=r.data)?void 0:e.data)?r.data.data:[]]}})},function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){tt(a,n,o,i,l,"next",t)}function l(t){tt(a,n,o,i,l,"throw",t)}i(void 0)})})()}),f=s.data,p=s.error,d=s.loading,y=null!=f?f:[],v=(0,r.useMemo)(function(){return{display:"grid",gap:o.marginSM,gridTemplateColumns:"repeat(auto-fill, minmax(min(100%, ".concat(l.gridMinColumnWidth,"px), 1fr))")}},[l.gridMinColumnWidth,o.marginSM]),b=(0,r.useMemo)(function(){return{alignItems:"center",background:o.colorBgContainer,border:"".concat(o.lineWidth,"px solid ").concat(o.colorBorderSecondary),borderRadius:o.borderRadiusLG,boxSizing:"border-box",color:o.colorText,display:"flex",gap:o.marginSM,height:l.cardHeight,padding:"".concat(l.paddingBlock,"px ").concat(o.paddingLG,"px"),textDecoration:"none",transition:"background ".concat(o.motionDurationMid,", border-color ").concat(o.motionDurationMid,", box-shadow ").concat(o.motionDurationMid,", transform ").concat(o.motionDurationMid)}},[l.cardHeight,l.paddingBlock,o.borderRadiusLG,o.colorBgContainer,o.colorBorderSecondary,o.colorText,o.lineWidth,o.marginSM,o.motionDurationMid,o.paddingLG]);return p?n().createElement(Z.Alert,{type:"warning",message:c("Failed to load portals"),showIcon:!0}):d?n().createElement("div",{style:{minHeight:l.cardHeight}}):0===y.length?n().createElement(Z.Empty,{image:Z.Empty.PRESENTED_IMAGE_SIMPLE,description:c("No portals")}):n().createElement("div",{"data-testid":"multi-portal-block-grid",style:v},y.map(function(t){var e=tl(t);return n().createElement("a",{key:t.uid,href:(0,a.u)(u,t.routePath,t.portalType),target:"_blank",rel:"noopener noreferrer","data-testid":"multi-portal-block-card",className:i.portalItem,style:b},n().createElement(tu,{record:t,token:o}),n().createElement(to,{strong:!0,ellipsis:!0,style:{flex:1,fontSize:o.fontSizeLG,lineHeight:o.lineHeightLG,marginBottom:0,minWidth:0},title:e},e))}))}var ts=function(t){var e;if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");function r(){var t,e;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return t=r,e=arguments,t=te(t),function(t,e){var r;if(e&&("object"==((r=e)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof e))return e;if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(this,tn()?Reflect.construct(t,e||[],te(this).constructor):t.apply(this,e))}return r.prototype=Object.create(t&&t.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),t&&tr(r,t),e=[{key:"renderComponent",value:function(){return n().createElement(tc,{model:this})}}],function(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}(r.prototype,e),r}(e.BlockModel);function tf(t,e,r,n,o,a,i){try{var l=t[a](i),u=l.value}catch(t){r(t);return}l.done?e(u):Promise.resolve(u).then(n,o)}function tp(t,e,r){return(tp=tb()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&ty(o,r.prototype),o}).apply(null,arguments)}ts.define({label:(0,Y.MZ)("Portals"),hide:!0,createModelOptions:{use:"MultiPortalBlockModel",stepParams:{cardSettings:{titleDescription:{title:(0,Y.MZ)("Portals")}}}},sort:600});function td(t){return(td=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function ty(t,e){return(ty=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function tv(t){var e="function"==typeof Map?new Map:void 0;return(tv=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return tp(t,arguments,td(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),ty(r,t)})(t)}function tb(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(tb=function(){return!!t})()}var th=function(t){var e;if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");function r(){var t,e;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return t=r,e=arguments,t=td(t),function(t,e){var r;if(e&&("object"==((r=e)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof e))return e;if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(this,tb()?Reflect.construct(t,e||[],td(this).constructor):t.apply(this,e))}return r.prototype=Object.create(t&&t.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),t&&ty(r,t),e=[{key:"load",value:function(){var t;return(t=function(){var t,e,r,o;return function(t,e){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:u(0)}),l(i,"throw",{value:u(1)}),l(i,"return",{value:u(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function u(l){return function(u){var c=[l,u];if(r)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=e.call(t,a)}catch(t){c=[6,t],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(a){var i,l,u,f,w;switch(a.label){case 0:if(t=this,e=String(this.t("Portal manager")),this.app.flowEngine.registerModels({MultiPortalBlockModel:ts}),this.app.flowEngine.registerModelLoaders({MultiPortalMobileLayoutModel:{loader:function(){return y.e("354").then(y.bind(y,833))}},MultiPortalMobileRootPageModel:{loader:function(){return y.e("354").then(y.bind(y,833))}},MultiPortalMobileChildPageModel:{loader:function(){return y.e("354").then(y.bind(y,833))}},MultiPortalMobileRootPageTabModel:{loader:function(){return y.e("354").then(y.bind(y,833))}},MultiPortalMobileChildPageTabModel:{loader:function(){return y.e("354").then(y.bind(y,833))}}}),this.app.entryActionManager&&this.app.flowEngine.registerModelLoaders({PortalEntryActionModel:{loader:function(){return y.e("499").then(y.bind(y,918))}}}),this.pluginSettingsManager.addMenuItem({key:"multi-portal",title:e,icon:"PartitionOutlined",aclSnippet:"pm.multi-portal",showTabs:!0,sort:-300}),this.pluginSettingsManager.addPageTabItem({menuKey:"multi-portal",key:"index",title:e,aclSnippet:"pm.multi-portal",componentLoader:function(){return y.e("556").then(y.bind(y,524))}}),!function(t,e){var r,n=t.pm;if(null==n?void 0:n.get){var o=n.get("acl")||n.get("@nocobase/plugin-acl");(null==o||null==(r=o.settingsUI)?void 0:r.addPermissionsTab)&&o.settingsUI.addPermissionsTab({key:"multi-portals",label:String(e("Portals")),sort:22,componentLoader:function(){return y.e("778").then(y.bind(y,177))}})}}(this.app,function(e){return t.t(e)}),!function(t,e){if(t.entryActionManager){var r=(0,s.G)(t),n=!0,o=!1,a=void 0;try{for(var i,l=v[Symbol.iterator]();!(n=(i=l.next()).done);n=!0){var u=i.value;t.entryActionManager.register("multi-portal:portals:".concat(u),{scope:u,sort:200,provider:function(t){return(function(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){p(a,n,o,i,l,"next",t)}function l(t){p(a,n,o,i,l,"throw",t)}i(void 0)})}})(function(){var n,o,a,i,l,u,c,s;return function(t,e){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:u(0)}),l(i,"throw",{value:u(1)}),l(i,"return",{value:u(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function u(l){return function(u){var c=[l,u];if(r)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=e.call(t,a)}catch(t){c=[6,t],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(f){switch(f.label){case 0:return[4,r.load()];case 1:var p;if(n=f.sent(),(a=(o=function(t){var e=function t(e){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Set;if(!m(e)||o.has(e))return n;o.add(e);var a=m(e)?e:null;return a&&(n.push(a),t(a.layoutContext,n,o),t(null==(r=a.model)?void 0:r.context,n,o)),n}(t),r=!0,n=!1,o=void 0;try{for(var a,i=e[Symbol.iterator]();!(r=(a=i.next()).done);r=!0){var l,u=a.value,c=P(null==(l=u.layout)?void 0:l.layoutType);if(c)return c}}catch(t){n=!0,o=t}finally{try{r||null==i.return||i.return()}finally{if(n)throw o}}if(e.some(function(t){var e,r,n;return!0===t.isMobileLayout||(null==(e=t.inputArgs)?void 0:e.isMobileLayout)===!0||(null==(n=t.view)||null==(r=n.inputArgs)?void 0:r.isMobileLayout)===!0}))return h;var s=!0,f=!1,p=void 0;try{for(var d,y=e[Symbol.iterator]();!(s=(d=y.next()).done);s=!0){var v=d.value,g=function(t){var e=[null==t?void 0:t.layoutModelClass,null==t?void 0:t.rootPageModelClass,null==t?void 0:t.childPageModelClass];return e.some(S)?h:e.some(P)?b:null}(v.layout);if(g)return g}}catch(t){f=!0,p=t}finally{try{s||null==y.return||y.return()}finally{if(f)throw p}}return e.some(function(t){var e,r,n;return!1===t.isMobileLayout||(null==(e=t.inputArgs)?void 0:e.isMobileLayout)===!1||(null==(n=t.view)||null==(r=n.inputArgs)?void 0:r.isMobileLayout)===!1})?b:null}(t))?n.portals.filter(function(t){return t.layout===o}):n.portals).length<=1)return[2,[]];return i=new Map(n.apps.map(function(t){return[t.name,t]})),l=function(t){var e=new Map,r=!0,n=!1,o=void 0;try{for(var a,i=t[Symbol.iterator]();!(r=(a=i.next()).done);r=!0){var l=a.value,u=O(l);e.set(u,(e.get(u)||0)+1)}}catch(t){n=!0,o=t}finally{try{r||null==i.return||i.return()}finally{if(n)throw o}}return e}(a),p=n.apps,u=p.length>0||j(a.map(function(t){return t.appName})).length>1,c=function(t,r){var n=u||(l.get(O(t))||0)>1?function(t,e,r){var n=O(t),o=k(t.appName,e,r);return o?"".concat(o," / ").concat(n):n}(t,r,e):O(t),o=function(t,e,r){var n=O(t),o=k(t.appName,e,r);return o?"".concat(o," / ").concat(n):n}(t,r,e);return function(t,e,r,n){var o=O(t);return{key:"multi-portal:portal:".concat(t.appName,":").concat(t.uid||t.routePath),label:o,createModelOptions:{use:"PortalEntryActionModel",props:{title:r,icon:t.icon||"PartitionOutlined",entryPortalTitle:r,entryPortalTargetTitle:n,entryPortal:t,entryPortalApp:e}}}}(t,r,n,o)},s=u?(function(t,e){var r=j(e.map(function(t){return t.appName})),n=t.map(function(t){return t.name});return j(d(r.includes(g)?[g]:[]).concat(d(n),d(r)))})(n.apps,a).map(function(t){var r=i.get(t),n=a.filter(function(e){return e.appName===t});return n.length?{key:"multi-portal:app:".concat(t),label:k(t,r,e),children:n.map(function(t){return c(t,r)})}:null}).filter(function(t){return!!t}):a.map(function(t){return c(t,i.get(t.appName))}),[2,s.length?[{key:"multi-portal:portals",label:e("Portals"),children:s}]:[]]}})})()}})}}catch(t){o=!0,a=t}finally{try{n||null==l.return||l.return()}finally{if(o)throw a}}}}(this.app,function(e){return String(t.t(e))}),"settings."===this.pluginSettingsManager.getRouteName(""))return[2];r=!1,this.router.add("root",{path:"/",Component:function(){return n().createElement(c,{runtimeRegistrationFailed:r})},authCheck:!1,skipAuthCheck:!0}),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,(i=this.app.apiClient,(l=function(){var t,e,r;return function(t,e){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:u(0)}),l(i,"throw",{value:u(1)}),l(i,"return",{value:u(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function u(l){return function(u){var c=[l,u];if(r)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=e.call(t,a)}catch(t){c=[6,t],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(n){switch(n.label){case 0:return[4,i.request({url:"multiPortals:listEnabled",method:"get",skipAuth:!0,skipNotify:!0})];case 1:if(!Array.isArray(r=null==(e=n.sent())||null==(t=e.data)?void 0:t.data))throw Error("multiPortals:listEnabled returned an invalid response");return[2,r]}})},function(){var t=this,e=arguments;return new Promise(function(r,n){var o=l.apply(t,e);function a(t){G(o,r,n,a,i,"next",t)}function i(t){G(o,r,n,a,i,"throw",t)}a(void 0)})})())];case 2:return o=a.sent(),u=this.app,f=new Set(function(t,e){var r=[],n=new Set(t.listLayouts().map(function(t){return t.uid})),o=new Set,a=new Set,i=new Set,l=!0,u=!1,c=void 0;try{for(var s,f=e[Symbol.iterator]();!(l=(s=f.next()).done);l=!0){var p,d=s.value;if(d.enabled&&Q(d)){var y=function(t){if(!t.enabled||!Q(t))return null;var e,r,n,o,a=(null==(o=t.uiLayout)?void 0:o.layoutType)||"",i=a===H&&t.uid===M.Jx?X:F[a];return i?(r=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),n.forEach(function(e){$(t,e,r[e])})}return t}({routeName:(e=t.uid,"".concat("multiPortalLayout_").concat(encodeURIComponent(e).replace(/\./g,"%2E"))),routePath:t.routePath,uid:t.uid},i),n=n={authCheck:t.authCheck},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):(function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e.push.apply(e,r)}return e})(Object(n)).forEach(function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(n,t))}),r):null}(d);if(!y)throw Error("Portal '".concat(d.uid,"' uses an unknown UI layout type '").concat((null==(p=d.uiLayout)?void 0:p.layoutType)||"","'."));if(o.has(d.uid)||n.has(d.uid))throw Error("Duplicate portal uid '".concat(d.uid,"'."));if(a.has(d.portalName))throw Error("Duplicate portal name '".concat(d.portalName,"'."));if(i.has(y.routeName)||t.hasLayout(y.routeName))throw Error("Duplicate portal layout route name '".concat(y.routeName,"'."));o.add(d.uid),a.add(d.portalName),i.add(y.routeName),r.push({options:y,record:d})}}}catch(t){u=!0,c=t}finally{try{l||null==f.return||f.return()}finally{if(u)throw c}}var v=[],b=!0,h=!1,g=void 0;try{for(var m,w=r[Symbol.iterator]();!(b=(m=w.next()).done);b=!0){var P=m.value,S=P.options,O=P.record;t.registerLayout(S),v.push(O.uid)}}catch(t){h=!0,g=t}finally{try{b||null==w.return||w.return()}finally{if(h)throw g}}return v}(u.layoutManager,o)),w=o.filter(function(t){return f.has(t.uid)}).map(function(t){var e;return{cacheKey:(e=t.uid,"".concat("portal:").concat(e)),portalUid:t.uid}}),function(t,e){if(t&&(void 0===t?"undefined":q(t))==="object"){if(t[B]){t[B].portalScopes=e;return}var r=D(t),n={loadingPromises:new Map,layoutScopes:new Map,originalActivateLayout:t.activateLayout.bind(t),originalApiRequest:r.request.bind(r),originalCreateRoute:t.createRoute.bind(t),originalDeleteRoute:t.deleteRoute.bind(t),originalEnsureAccessibleLoaded:t.ensureAccessibleLoaded.bind(t),originalMoveRoute:t.moveRoute.bind(t),originalRefreshAccessible:t.refreshAccessible.bind(t),originalUpdateRoute:t.updateRoute.bind(t),portalScopes:e,refreshRequestIds:new Map,scopeStack:[]};t[B]=n,r.request=function(t){return n.originalApiRequest(function(t,e){var r,n=N(e);if(!n.portalUid||!("string"==typeof t.url&&t.url.replace(/^\/+/,"").startsWith("desktopRoutes:")))return t;var o=(r=t.params)&&(void 0===r?"undefined":q(r))==="object"&&!Array.isArray(r)?R({},t.params):{};return delete o.layout,delete o.portal,_(R({},t),{params:_(R({},o),{portal:n.portalUid})})}(t,n))},t.activateLayout=function(t){var e,r,o,a,i,l,u=(e="string"==typeof(l=null==t?void 0:t.uid)&&l.trim()?l:"admin-layout-model",r=n.portalScopes,o=n.layoutScopes,(i=(a=new Map(r().filter(function(t){return"string"==typeof(null==t?void 0:t.portalUid)&&!!t.portalUid.trim()&&"string"==typeof t.cacheKey&&!!t.cacheKey.trim()}).map(function(t){return[t.portalUid,t]}))).get(e))||function(t,e,r){var n=new Set(C(e.values()).map(function(t){return t.cacheKey})),o=new Set(C(r.entries()).filter(function(e){return I(e,1)[0]!==t}).map(function(t){return I(t,2)[1].cacheKey})),a=r.get(t);if(a&&!n.has(a.cacheKey)&&!o.has(a.cacheKey))return a;for(var i=t;n.has(i)||o.has(i);)i="layout:".concat(i);var l={cacheKey:i,uiLayoutUid:t};return r.set(t,l),l}(e,a,o)),c=Symbol("multi-portal-route-scope"),s=n.originalActivateLayout(_(R({},t),{uid:u.cacheKey}));return n.scopeStack.push({deactivate:s,scope:u,token:c}),function(){var t=n.scopeStack.findIndex(function(t){return t.token===c});t>=0&&n.scopeStack.splice(t,1),s()}},t.refreshAccessible=function(){return E(function(){var e;return U(this,function(r){return W(e=N(n))?[2,z(t,e,n)]:[2,n.originalRefreshAccessible()]})})()},t.ensureAccessibleLoaded=function(){return E(function(){var e,r,o;return U(this,function(a){return W(e=N(n))?t.isAccessibleLoaded()?[2,t.listAccessible()]:(r=n.loadingPromises.get(e.cacheKey))?[2,r]:(o=z(t,e,n).finally(function(){n.loadingPromises.get(e.cacheKey)===o&&n.loadingPromises.delete(e.cacheKey)}),n.loadingPromises.set(e.cacheKey,o),[2,o]):[2,n.originalEnsureAccessibleLoaded()]})})()},t.createRoute=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return E(function(){var o,a,i,l;return U(this,function(u){switch(u.label){case 0:if(!(o=N(n)).portalUid)return[2,n.originalCreateRoute(e,r)];return i=void 0===(a=r.refreshAfterMutation)||a,[4,D(t).resource("desktopRoutes").create({values:K(e),portal:o.portalUid})];case 1:if(l=u.sent(),!i)return[3,3];return[4,t.refreshAccessible()];case 2:u.sent(),u.label=3;case 3:return[2,l]}})})()},t.updateRoute=function(e,r){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return E(function(){var a,i,l,u,c;return U(this,function(s){switch(s.label){case 0:if(!(a=N(n)).portalUid)return[2,n.originalUpdateRoute(e,r,o)];return l=void 0===(i=o.refreshAfterMutation)||i,u=K(r),[4,D(t).resource("desktopRoutes").update(Array.isArray(e)?{filter:{id:{$in:e}},values:u,portal:a.portalUid}:{filterByTk:e,values:u,portal:a.portalUid})];case 1:if(c=s.sent(),!l)return[3,3];return[4,t.refreshAccessible()];case 2:s.sent(),s.label=3;case 3:return[2,c]}})})()},t.deleteRoute=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return E(function(){var o,a,i,l;return U(this,function(u){switch(u.label){case 0:if(!(o=N(n)).portalUid)return[2,n.originalDeleteRoute(e,r)];return i=void 0===(a=r.refreshAfterMutation)||a,[4,D(t).resource("desktopRoutes").destroy({filterByTk:e,portal:o.portalUid})];case 1:if(l=u.sent(),!i)return[3,3];return[4,t.refreshAccessible()];case 2:u.sent(),u.label=3;case 3:return[2,l]}})})()},t.moveRoute=function(e){return E(function(){var r,o,a,i,l;return U(this,function(u){switch(u.label){case 0:if(!(r=N(n)).portalUid)return[2,n.originalMoveRoute(e)];return a=void 0===(o=e.refreshAfterMove)||o,i=T(e,["refreshAfterMove"]),[4,D(t).resource("desktopRoutes").move(_(R({},i),{portal:r.portalUid}))];case 1:if(l=u.sent(),!a)return[3,3];return[4,t.refreshAccessible()];case 2:u.sent(),u.label=3;case 3:return[2,l]}})})()}}}(function(t){if(null==(e=t.context)?void 0:e.routeRepository)return t.context.routeRepository;var e,r,n=null==(r=t.flowEngine)?void 0:r.context;if(n&&(void 0===n?"undefined":n&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)=="object"&&"routeRepository"in n)return n.routeRepository}(u),function(){return w}),!function(t,e){if(t&&"function"==typeof t.registerSignInRoute){var r=!0,n=!1,o=void 0;try{for(var a,i=e[Symbol.iterator]();!(r=(a=i.next()).done);r=!0){var l=a.value;if(l.enabled&&"no-code"===(l.portalType||"no-code")){var u="multiPortalSignin_".concat(encodeURIComponent(l.uid).replace(/\./g,"%2E")),c="".concat(l.routePath.replace(/\/+$/g,""),"/signin");t.registerSignInRoute(u,c)}}}catch(t){n=!0,o=t}finally{try{r||null==i.return||i.return()}finally{if(n)throw o}}}}(this.app.pm.get("@nocobase/plugin-auth"),o),[3,4];case 3:return console.error("[NocoBase] Failed to register multi-portals.",a.sent()),r=!0,[3,4];case 4:return[2]}})},function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){tf(a,n,o,i,l,"next",t)}function l(t){tf(a,n,o,i,l,"throw",t)}i(void 0)})}).call(this)}}],function(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}(r.prototype,e),r}(tv(e.Plugin))}(),w}()});
|
|
10
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("ahooks"),require("@nocobase/client-v2"),require("react-router-dom"),require("@nocobase/plugin-ui-layout/client-v2"),require("react"),require("antd"),require("antd-style"),require("@nocobase/flow-engine"),require("@ant-design/icons")):"function"==typeof define&&define.amd?define("@nocobase/plugin-multi-portal/client-v2",["ahooks","@nocobase/client-v2","react-router-dom","@nocobase/plugin-ui-layout/client-v2","react","antd","antd-style","@nocobase/flow-engine","@ant-design/icons"],e):"object"==typeof exports?exports["@nocobase/plugin-multi-portal/client-v2"]=e(require("ahooks"),require("@nocobase/client-v2"),require("react-router-dom"),require("@nocobase/plugin-ui-layout/client-v2"),require("react"),require("antd"),require("antd-style"),require("@nocobase/flow-engine"),require("@ant-design/icons")):t["@nocobase/plugin-multi-portal/client-v2"]=e(t.ahooks,t["@nocobase/client-v2"],t["react-router-dom"],t["@nocobase/plugin-ui-layout/client-v2"],t.react,t.antd,t["antd-style"],t["@nocobase/flow-engine"],t["@ant-design/icons"])}(self,function(t,e,r,n,o,a,i,u,l){return function(){"use strict";var c,s,f,p={337:function(t,e,r){r.d(e,{G:function(){return l}});var n=r(694);function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function a(t){var e=t||{};return{apps:Array.isArray(e.apps)?e.apps:[],portals:Array.isArray(e.portals)?e.portals:[]}}var i=function(){var t;function e(t){if(!(this instanceof e))throw TypeError("Cannot call a class as a function");o(this,"app",void 0),o(this,"payload",void 0),o(this,"loading",void 0),o(this,"revision",void 0),o(this,"loaded",void 0),o(this,"request",void 0),o(this,"requestId",void 0),this.app=t,this.payload=a(null),this.loading=!1,this.revision=0,this.loaded=!1,this.requestId=0,(0,n.define)(this,{payload:n.observable.ref,loading:n.observable.ref,revision:n.observable.ref})}return t=[{key:"load",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.app.apiClient;return this.loaded&&!this.request?Promise.resolve(this.payload):this.requestPortals(t)}},{key:"reload",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.app.apiClient;return this.requestPortals(t,{force:!0,invalidateEntryActions:!0})}},{key:"requestPortals",value:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.request||r.force){var n,o=++this.requestId;this.loading=!0,this.request=((null==(n=t.silent)?void 0:n.call(t))||t).request({url:"app:getPortals",skipNotify:!0}).then(function(t){var n,i,u,l=a(null!=(n=null==t||null==(i=t.data)?void 0:i.data)?n:null==t?void 0:t.data);return o===e.requestId&&(e.payload=l,e.loaded=!0,e.revision+=1,r.invalidateEntryActions&&(null==(u=e.app.entryActionManager)||u.invalidate())),l}).catch(function(t){throw t}).finally(function(){o===e.requestId&&(e.loading=!1,e.request=void 0)})}return this.request}}],function(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}(e.prototype,t),e}(),u=new WeakMap;function l(t){var e=u.get(t);return e||(e=new i(t),u.set(t,e)),e}},143:function(t,e,r){r.d(e,{Dj:function(){return u},kj:function(){return i},MZ:function(){return l}});var n=r(694),o=JSON.parse('{"UU":"@nocobase/plugin-multi-portal"}');function a(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),n.forEach(function(e){var n;n=r[e],e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n})}return t}function i(){var t=(0,n.useFlowEngine)();return function(e,r){return t.context.t(e,a({ns:[o.UU,"client"]},r))}}function u(t){return a({ns:[o.UU,"client"]},t)}function l(t){return(0,n.tExpr)(t,{ns:[o.UU,"client"]})}},756:function(t,e,r){r.d(e,{Q:function(){return w},u:function(){return g}});var n=r(485);function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function a(t){return function(t){if(Array.isArray(t))return o(t)}(t)||function(t){if("u">typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t){if(t){if("string"==typeof t)return o(t,void 0);var e=Object.prototype.toString.call(t).slice(8,-1);if("Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e)return Array.from(e);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return o(t,void 0)}}(t)||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 i="no-code",u="/settings",l=function(t){var e=null==t?void 0:t.trim();return e&&"/"!==e?"/".concat(e.replace(/^\/+/,"")):"/"},c=function(t){var e=l(t).replace(/\/+$/,"");return""===e||"/"===e?"":e},s=function(t,e){var r=c(t),n=l(e);return!r||n===r||n.startsWith("".concat(r,"/"))?n:"".concat(r).concat(n)};function f(t){return"ai"===t?"ai":i}function p(t){return"ai"===f(t)?"/x":"/".concat((0,n.getModernClientPrefix)())}function d(){return Array.from(new Set([p(i),"/x","/v"]))}function y(t,e){var r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],n=c(t),o=p(e);if(!n)return o;var i=r?n.match(/^(.*)\/(apps|_app)\/([^/]+)$/):null;if(i){var l=i[1]||"",s=!0,y=!1,b=void 0;try{for(var h,v=a(d()).concat([u])[Symbol.iterator]();!(s=(h=v.next()).done);s=!0){var g=h.value;if(l===g){l="";break}if(l.endsWith(g)){l=l.slice(0,-g.length);break}}}catch(t){y=!0,b=t}finally{try{s||null==v.return||v.return()}finally{if(y)throw b}}var m="ai"===f(e)?"apps":i[2];return"".concat(l).concat(o,"/").concat(m,"/").concat(i[3])}var w=!0,P=!1,S=void 0;try{for(var O,j=d()[Symbol.iterator]();!(w=(O=j.next()).done);w=!0){var k=O.value;if(n===k)return o;if(n.endsWith(k))return"".concat(n.slice(0,-k.length)).concat(o)}}catch(t){P=!0,S=t}finally{try{w||null==j.return||j.return()}finally{if(P)throw S}}return"".concat(n).concat(o)}function b(t,e,r){var n=!(arguments.length>3)||void 0===arguments[3]||arguments[3],o=l(t),i=!0,u=!1,s=void 0;try{for(var p,b=[y(e,r,n),y(e,"ai"===f(r)?"no-code":"ai",n)].concat(a(d()))[Symbol.iterator]();!(i=(p=b.next()).done);i=!0){var h=p.value;o=function(t,e){var r=c(e),n=l(t);return r?n===r?"/":n.startsWith("".concat(r,"/"))?n.slice(r.length)||"/":n:n}(o,h)}}catch(t){u=!0,s=t}finally{try{i||null==b.return||b.return()}finally{if(u)throw s}}return o}function h(t){return"function"==typeof(null==t?void 0:t.getPublicPath)}function v(t,e){var r,n=null==t||null==(r=t.getPublicPath)?void 0:r.call(t);return!("main"===(t&&"name"in t&&"string"==typeof t.name?t.name:void 0)&&n&&c(n)===c(e))}function g(t,e,r){var o,a,i,u,f=e.trim();if(/^[a-z][a-z\d+\-.]*:\/\//i.test(f)||f.startsWith("//"))return f;var p=(null==t||null==(a=t.router)||null==(o=a.getBasename)?void 0:o.call(a))||(null==t||null==(i=t.router)?void 0:i.basename);if(p){var d=h(t)?(0,n.getV2EffectiveBasePath)({getPublicPath:t.getPublicPath,router:{getBasename:function(){var e,r,n;return(null==(r=t.router)||null==(e=r.getBasename)?void 0:e.call(r))||(null==(n=t.router)?void 0:n.basename)}}}):p,g=v(t,d);return s(y(d,r,g),b(f,d,r,g))}if(null==t?void 0:t.getRouteUrl){var m,w,P=t.getRouteUrl(f),S=(m=l(P))===(w=l(f))?"":m.endsWith(w)?c(m.slice(0,-w.length)):void 0;if(void 0!==S){var O=v(t,S);return s(y(S,r,O),b(f,S,r,O))}return l(P)}var j=null==t||null==(u=t.getPublicPath)?void 0:u.call(t),k=v(t,j);return s(y(j,r,k),b(f,j,r,k))}function m(t){var e=c(t),r=Array.from(new Set([p(i),"/v"])),n=!0,o=!1,a=void 0;try{for(var l,f=r[Symbol.iterator]();!(n=(l=f.next()).done);n=!0){var d=l.value;if(e===d)return u;var y=e.match(new RegExp("^(.*)".concat(d,"/(apps|_app)/([^/]+)$")));if(y)return"".concat(y[1]).concat(u,"/").concat(y[2],"/").concat(y[3]);if(e.endsWith(d))return"".concat(e.slice(0,-d.length)).concat(u)}}catch(t){o=!0,a=t}finally{try{n||null==f.return||f.return()}finally{if(o)throw a}}return s(e,u)}function w(t){var e,r,o,a,i=(null==t||null==(r=t.router)||null==(e=r.getBasename)?void 0:e.call(r))||(null==t||null==(o=t.router)?void 0:o.basename);return i?m(h(t)?(0,n.getV2EffectiveBasePath)({getPublicPath:t.getPublicPath,router:{getBasename:function(){var e,r,n;return(null==(r=t.router)||null==(e=r.getBasename)?void 0:e.call(r))||(null==(n=t.router)?void 0:n.basename)}}}):i):m(null==t||null==(a=t.getPublicPath)?void 0:a.call(t))}},624:function(t,e,r){r.d(e,{Cn:function(){return c},Jx:function(){return n},R$:function(){return o},Xc:function(){return l},ig:function(){return a}});var n="__default_mobile__",o="admin-layout-model",a="mobile-layout-model",i=new Set(["__default_admin__",n]),u=new Set([o,a]);function l(t){return"string"==typeof t&&i.has(t)}function c(t){return"string"==typeof t&&u.has(t)}},375:function(t){t.exports=l},485:function(t){t.exports=e},694:function(t){t.exports=u},69:function(t){t.exports=n},625:function(e){e.exports=t},59:function(t){t.exports=a},235:function(t){t.exports=i},155:function(t){t.exports=o},442:function(t){t.exports=r}},d={};function y(t){var e=d[t];if(void 0!==e)return e.exports;var r=d[t]={exports:{}};return p[t](r,r.exports,y),r.exports}y.m=p,y.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return y.d(e,{a:e}),e},y.d=function(t,e){for(var r in e)y.o(e,r)&&!y.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},y.f={},y.e=function(t){return Promise.all(Object.keys(y.f).reduce(function(e,r){return y.f[r](t,e),e},[]))},y.u=function(t){return""+t+"."+({354:"7be267ae5d61a878",499:"245037eea4cc7266",556:"64742ccddb8fe2f0",778:"c98e7ec542d931fe"})[t]+".js"},y.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(t){if("object"==typeof window)return window}}(),y.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},b={},y.l=function(t,e,r,n){if(b[t])return void b[t].push(e);if(void 0!==r)for(var o,a,i=document.getElementsByTagName("script"),u=0;u<i.length;u++){var l=i[u];if(l.getAttribute("src")==t||l.getAttribute("data-rspack")=="@nocobase/plugin-multi-portal/client-v2:"+r){o=l;break}}o||(a=!0,(o=document.createElement("script")).timeout=120,y.nc&&o.setAttribute("nonce",y.nc),o.setAttribute("data-rspack","@nocobase/plugin-multi-portal/client-v2:"+r),o.src=t),b[t]=[e];var c=function(e,r){o.onerror=o.onload=null,clearTimeout(s);var n=b[t];if(delete b[t],o.parentNode&&o.parentNode.removeChild(o),n&&n.forEach(function(t){return t(r)}),e)return e(r)},s=setTimeout(c.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=c.bind(null,o.onerror),o.onload=c.bind(null,o.onload),a&&document.head.appendChild(o)},y.r=function(t){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},y.g.importScripts&&(h=y.g.location+"");var b,h,v=y.g.document;if(!h&&v&&(v.currentScript&&"SCRIPT"===v.currentScript.tagName.toUpperCase()&&(h=v.currentScript.src),!h)){var g=v.getElementsByTagName("script");if(g.length)for(var m=g.length-1;m>-1&&(!h||!/^http(s?):/.test(h));)h=g[m--].src}if(!h)throw Error("Automatic publicPath is not supported in this browser");y.p=h.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),c={889:0},y.f.j=function(t,e){var r=y.o(c,t)?c[t]:void 0;if(0!==r)if(r)e.push(r[2]);else{var n=new Promise(function(e,n){r=c[t]=[e,n]});e.push(r[2]=n);var o=y.p+y.u(t),a=Error();y.l(o,function(e){if(y.o(c,t)&&(0!==(r=c[t])&&(c[t]=void 0),r)){var n=e&&("load"===e.type?"missing":e.type),o=e&&e.target&&e.target.src;a.message="Loading chunk "+t+" failed.\n("+n+": "+o+")",a.name="ChunkLoadError",a.type=n,a.request=o,r[1](a)}},"chunk-"+t,t)}},s=function(t,e){var r,n,o=e[0],a=e[1],i=e[2],u=0;if(o.some(function(t){return 0!==c[t]})){for(r in a)y.o(a,r)&&(y.m[r]=a[r]);i&&i(y)}for(t&&t(e);u<o.length;u++)n=o[u],y.o(c,n)&&c[n]&&c[n][0](),c[n]=0},(f=self.webpackChunk_nocobase_plugin_multi_portal_client_v2=self.webpackChunk_nocobase_plugin_multi_portal_client_v2||[]).forEach(s.bind(null,0)),f.push=s.bind(null,f.push.bind(f));var w={};return!function(){var t="",e="u">typeof document?document.currentScript:null;if(e&&e.src){var r=e.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");r.indexOf("/static/plugins/@nocobase/plugin-multi-portal/dist/client-v2/")>=0&&(t=r.replace(/\/[^\/]+$/,"/"))}if(!t){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),t=n+"static/plugins/@nocobase/plugin-multi-portal/dist/client-v2/")}if(!t){var o=window.__nocobase_modern_client_prefix__||"v",a="/"+(o=String(o).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(t=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var i=window.location.pathname||"/",u=i.indexOf(a);t=u>=0?i.slice(0,u+1):"/"}t&&(t=t.replace(RegExp("/"+o+"/?$"),"/")),t||(t="/"),"/"!==t.charAt(t.length-1)&&(t+="/"),t+="static/plugins/@nocobase/plugin-multi-portal/dist/client-v2/"}y.p=t}(),!function(){y.r(w),y.d(w,{default:function(){return tf}});var t,e=y(485),r=y(155),n=y.n(r),o=y(442),a=y(756);function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function u(t,e,r,n,o,a,i){try{var u=t[a](i),l=u.value}catch(t){r(t);return}u.done?e(l):Promise.resolve(l).then(n,o)}function l(t){return"".concat(t.search||"").concat(t.hash||"")}function c(t){var c,s=t.runtimeRegistrationFailed,f=void 0!==s&&s,p=(0,e.useApp)(),d=(0,o.useLocation)(),y=function(t){if(Array.isArray(t))return t}(c=(0,r.useState)())||function(t){var e,r,n=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var o=[],a=!0,i=!1;try{for(n=n.call(t);!(a=(e=n.next()).done)&&(o.push(e.value),2!==o.length);a=!0);}catch(t){i=!0,r=t}finally{try{a||null==n.return||n.return()}finally{if(i)throw r}}return o}}(c)||function(t){if(t){if("string"==typeof t)return i(t,2);var e=Object.prototype.toString.call(t).slice(8,-1);if("Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e)return Array.from(e);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return i(t,2)}}(c)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),b=y[0],h=y[1],v=(0,r.useRef)();return((0,r.useEffect)(function(){if(f)return void window.location.replace("".concat((0,a.Q)(p)).concat(l(d)));var t,e=!0;return(t=function(){var t,r,n;return function(t,e){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(i,"next",{value:l(0)}),u(i,"throw",{value:l(1)}),u(i,"return",{value:l(2)}),"function"==typeof Symbol&&u(i,Symbol.iterator,{value:function(){return this}}),i;function l(u){return function(l){var c=[u,l];if(r)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=e.call(t,a)}catch(t){c=[6,t],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,p.apiClient.request({url:"multiPortals:getDefault",method:"get",skipAuth:!0,skipNotify:!0})];case 1:var i;if(r=o.sent(),!e)return[2];if((i=n=null==r||null==(t=r.data)?void 0:t.data)&&(void 0===i?"undefined":i&&"u">typeof Symbol&&i.constructor===Symbol?"symbol":typeof i)=="object"&&"string"==typeof i.uid&&i.uid.length>0&&("no-code"===i.portalType||"ai"===i.portalType)&&"string"==typeof i.routePath&&i.routePath.trim().length>0){if("no-code"===n.portalType&&!p.layoutManager.listLayouts().some(function(t){return t.uid===n.uid}))return window.location.replace("".concat((0,a.Q)(p)).concat(l(d))),[2];return h(n),[2]}return window.location.replace("".concat((0,a.Q)(p)).concat(l(d))),[3,3];case 2:if(o.sent(),!e)return[2];return window.location.replace("".concat((0,a.Q)(p)).concat(l(d))),[3,3];case 3:return[2]}})},function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){u(a,n,o,i,l,"next",t)}function l(t){u(a,n,o,i,l,"throw",t)}i(void 0)})})(),function(){e=!1}},[p,d,f]),(0,r.useEffect)(function(){if(b&&"ai"===b.portalType){var t="".concat((0,a.u)(p,b.routePath,b.portalType)).concat(l(d));v.current!==t&&(v.current=t,window.location.replace(t))}},[p,d,b]),b&&"ai"!==b.portalType)?n().createElement(o.Navigate,{replace:!0,to:{pathname:b.routePath,search:d.search,hash:d.hash}}):null}var s=y(337);function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function p(t,e,r,n,o,a,i){try{var u=t[a](i),l=u.value}catch(t){r(t);return}u.done?e(l):Promise.resolve(l).then(n,o)}function d(t){return function(t){if(Array.isArray(t))return f(t)}(t)||function(t){if("u">typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t){if(t){if("string"==typeof t)return f(t,void 0);var e=Object.prototype.toString.call(t).slice(8,-1);if("Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e)return Array.from(e);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return f(t,void 0)}}(t)||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 b=["action-panel","app-switcher"],h="main";function v(t){return t.title||t.routePath}function g(t){var e=new Set;return t.filter(function(t){return!e.has(t)&&(e.add(t),!0)})}function m(t,e,r){return t===h?r("Main application"):(null==e?void 0:e.title)||t}var P=y(624);function S(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function O(t,e,r,n,o,a,i){try{var u=t[a](i),l=u.value}catch(t){r(t);return}u.done?e(l):Promise.resolve(l).then(n,o)}function j(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){O(a,n,o,i,u,"next",t)}function u(t){O(a,n,o,i,u,"throw",t)}i(void 0)})}}function k(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),n.forEach(function(e){var n;n=r[e],e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n})}return t}function M(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):(function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e.push.apply(e,r)}return e})(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}),t}function x(t,e){if(null==t)return{};var r,n,o,a={};if("u">typeof Reflect&&Reflect.ownKeys){for(o=0,r=Reflect.ownKeys(Object(t));o<r.length;o++)n=r[o],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(a[n]=t[n]);return a}if(a=function(t,e){if(null==t)return{};var r,n,o={},a=Object.getOwnPropertyNames(t);for(n=0;n<a.length;n++)r=a[n],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r]);return o}(t,e),Object.getOwnPropertySymbols)for(o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)n=r[o],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(a[n]=t[n]);return a}function A(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r,n,o=null==t?null:"u">typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=o){var a=[],i=!0,u=!1;try{for(o=o.call(t);!(i=(r=o.next()).done)&&(a.push(r.value),!e||a.length!==e);i=!0);}catch(t){u=!0,n=t}finally{try{i||null==o.return||o.return()}finally{if(u)throw n}}return a}}(t,e)||_(t,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.")}()}function E(t){return function(t){if(Array.isArray(t))return S(t)}(t)||function(t){if("u">typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||_(t)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function R(t){return t&&"u">typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function _(t,e){if(t){if("string"==typeof t)return S(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return S(t,e)}}function I(t,e){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(i,"next",{value:l(0)}),u(i,"throw",{value:l(1)}),u(i,"return",{value:l(2)}),"function"==typeof Symbol&&u(i,Symbol.iterator,{value:function(){return this}}),i;function l(u){return function(l){var c=[u,l];if(r)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=e.call(t,a)}catch(t){c=[6,t],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var T=Symbol("multiPortalRouteRepositoryState");function C(t){var e;return(null==(e=t.scopeStack[t.scopeStack.length-1])?void 0:e.scope)||{cacheKey:"admin-layout-model",uiLayoutUid:"admin-layout-model"}}function q(t){return t.getAPIClient()}function U(t){return"string"==typeof t.portalUid}function L(t){var e=t.children;return k({},(t.multiPortals,t.uiLayouts,x(t,["children","multiPortals","uiLayouts"])),Array.isArray(e)?{children:e.map(function(t){return L(t)})}:{})}function B(t,e,r){return j(function(){var n,o,a,i;return I(this,function(u){switch(u.label){case 0:return o=(r.refreshRequestIds.get(e.cacheKey)||0)+1,r.refreshRequestIds.set(e.cacheKey,o),[4,q(t).request({url:"/desktopRoutes:listAccessible",params:{tree:!0,sort:"sort",portal:e.portalUid}})];case 1:return i=Array.isArray(null==(a=u.sent())||null==(n=a.data)?void 0:n.data)?a.data.data:[],r.refreshRequestIds.get(e.cacheKey)===o&&t.setRoutes(i,e.cacheKey),[2,i]}})})()}function N(t,e,r,n,o,a,i){try{var u=t[a](i),l=u.value}catch(t){r(t);return}u.done?e(l):Promise.resolve(l).then(n,o)}function D(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var W=(D(t={},P.R$,{layoutModelClass:"AdminLayoutModel"}),D(t,P.ig,{layoutModelClass:"MultiPortalMobileLayoutModel",rootPageModelClass:"MultiPortalMobileRootPageModel",childPageModelClass:"MultiPortalMobileChildPageModel"}),t),K={layoutModelClass:"MobileLayoutModel",rootPageModelClass:"MobileRootPageModel",childPageModelClass:"MobileChildPageModel"};function z(t){return"no-code"===(t.portalType||"no-code")}var G=y(625),$=y(59),H=y(235),F=y(143);function X(t,e,r,n,o,a,i){try{var u=t[a](i),l=u.value}catch(t){r(t);return}u.done?e(l):Promise.resolve(l).then(n,o)}function Q(t){return(Q=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function J(t,e){return(J=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Z(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Z=function(){return!!t})()}var V=$.Typography.Text;function Y(t){var e=t.controlHeightLG+t.paddingSM+t.paddingXXS,r=t.paddingLG-t.paddingXXS;return{avatarSize:e,cardHeight:e+2*r,gridMinColumnWidth:9*t.controlHeightLG,iconSize:t.fontSizeHeading3+t.marginXXS,paddingBlock:r}}var tt=(0,H.createStyles)(function(t){var e=t.token;return{portalItem:{"&:hover":{background:e.colorBgTextHover,borderColor:e.colorBorder,boxShadow:e.boxShadowTertiary,color:e.colorText,transform:"translateY(-".concat(e.lineWidth,"px)")},"&:focus-visible":{outline:"".concat(e.controlOutlineWidth,"px solid ").concat(e.colorPrimaryBorder),outlineOffset:e.controlOutlineWidth},".ant-typography":{color:"inherit"}}}});function te(t){var e;return(null==(e=t.title)?void 0:e.trim())||t.uid}function tr(t){var r,o,a,i,u=t.record,l=t.token,c=Y(l),s=null==(i=u.icon)?void 0:i.trim(),f={alignItems:"center",background:l.colorFillTertiary,borderRadius:l.borderRadiusLG,color:l.colorText,display:"flex",flex:"0 0 ".concat(c.avatarSize,"px"),fontSize:l.fontSizeHeading3,height:c.avatarSize,justifyContent:"center",lineHeight:1,width:c.avatarSize};if(s)return n().createElement($.Avatar,{shape:"square",size:c.avatarSize,style:f,icon:null},n().createElement(e.Icon,{type:s,"aria-hidden":!0,style:{color:l.colorPrimary,fontSize:c.iconSize}}));var p=(r=[{background:l.colorPrimaryBg,color:l.colorPrimary},{background:l.colorSuccessBg,color:l.colorSuccess},{background:l.colorWarningBg,color:l.colorWarning},{background:l.colorErrorBg,color:l.colorError},{background:l.colorInfoBg,color:l.colorInfo}])[function(t,e){var r=0,n=!0,o=!1,a=void 0;try{for(var i,u=t[Symbol.iterator]();!(n=(i=u.next()).done);n=!0){var l=i.value;r=(31*r+l.charCodeAt(0))%0x7fffffff}}catch(t){o=!0,a=t}finally{try{n||null==u.return||u.return()}finally{if(o)throw a}}return Math.abs(r)%e}("".concat(u.uid,":").concat(u.title||""),r.length)];return n().createElement($.Avatar,{"aria-hidden":!0,shape:"square",size:c.avatarSize,style:(o=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),n.forEach(function(e){var n;n=r[e],e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n})}return t}({},f),a=a={background:p.background,color:p.color,fontWeight:l.fontWeightStrong},Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(a)):(function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e.push.apply(e,r)}return e})(Object(a)).forEach(function(t){Object.defineProperty(o,t,Object.getOwnPropertyDescriptor(a,t))}),o)},(te(u).trim()[0]||"P").toUpperCase())}function tn(t){var e=t.model,o=$.theme.useToken().token,i=tt().styles,u=(0,r.useMemo)(function(){return Y(o)},[o]),l=e.context.app,c=e.translate,s=(0,G.useRequest)(function(){var t;return(t=function(){var t,e,r;return function(t,e){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(i,"next",{value:l(0)}),u(i,"throw",{value:l(1)}),u(i,"return",{value:l(2)}),"function"==typeof Symbol&&u(i,Symbol.iterator,{value:function(){return this}}),i;function l(u){return function(l){var c=[u,l];if(r)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=e.call(t,a)}catch(t){c=[6,t],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(n){switch(n.label){case 0:return[4,null==l||null==(t=l.apiClient)?void 0:t.request({url:"multiPortals:listAccessible",method:"get",skipNotify:!0})];case 1:return[2,Array.isArray(null==(r=n.sent())||null==(e=r.data)?void 0:e.data)?r.data.data:[]]}})},function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){X(a,n,o,i,u,"next",t)}function u(t){X(a,n,o,i,u,"throw",t)}i(void 0)})})()}),f=s.data,p=s.error,d=s.loading,y=null!=f?f:[],b=(0,r.useMemo)(function(){return{display:"grid",gap:o.marginSM,gridTemplateColumns:"repeat(auto-fill, minmax(min(100%, ".concat(u.gridMinColumnWidth,"px), 1fr))")}},[u.gridMinColumnWidth,o.marginSM]),h=(0,r.useMemo)(function(){return{alignItems:"center",background:o.colorBgContainer,border:"".concat(o.lineWidth,"px solid ").concat(o.colorBorderSecondary),borderRadius:o.borderRadiusLG,boxSizing:"border-box",color:o.colorText,display:"flex",gap:o.marginSM,height:u.cardHeight,padding:"".concat(u.paddingBlock,"px ").concat(o.paddingLG,"px"),textDecoration:"none",transition:"background ".concat(o.motionDurationMid,", border-color ").concat(o.motionDurationMid,", box-shadow ").concat(o.motionDurationMid,", transform ").concat(o.motionDurationMid)}},[u.cardHeight,u.paddingBlock,o.borderRadiusLG,o.colorBgContainer,o.colorBorderSecondary,o.colorText,o.lineWidth,o.marginSM,o.motionDurationMid,o.paddingLG]);return p?n().createElement($.Alert,{type:"warning",message:c("Failed to load portals"),showIcon:!0}):d?n().createElement("div",{style:{minHeight:u.cardHeight}}):0===y.length?n().createElement($.Empty,{image:$.Empty.PRESENTED_IMAGE_SIMPLE,description:c("No portals")}):n().createElement("div",{"data-testid":"multi-portal-block-grid",style:b},y.map(function(t){var e=te(t);return n().createElement("a",{key:t.uid,href:(0,a.u)(l,t.routePath,t.portalType),target:"_blank",rel:"noopener noreferrer","data-testid":"multi-portal-block-card",className:i.portalItem,style:h},n().createElement(tr,{record:t,token:o}),n().createElement(V,{strong:!0,ellipsis:!0,style:{flex:1,fontSize:o.fontSizeLG,lineHeight:o.lineHeightLG,marginBottom:0,minWidth:0},title:e},e))}))}var to=function(t){var e;if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");function r(){var t,e;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return t=r,e=arguments,t=Q(t),function(t,e){var r;if(e&&("object"==((r=e)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof e))return e;if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(this,Z()?Reflect.construct(t,e||[],Q(this).constructor):t.apply(this,e))}return r.prototype=Object.create(t&&t.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),t&&J(r,t),e=[{key:"renderComponent",value:function(){return n().createElement(tn,{model:this})}}],function(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}(r.prototype,e),r}(e.BlockModel);function ta(t,e,r,n,o,a,i){try{var u=t[a](i),l=u.value}catch(t){r(t);return}u.done?e(l):Promise.resolve(l).then(n,o)}function ti(t,e,r){return(ti=ts()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&tl(o,r.prototype),o}).apply(null,arguments)}to.define({label:(0,F.MZ)("Portals"),hide:!0,createModelOptions:{use:"MultiPortalBlockModel",stepParams:{cardSettings:{titleDescription:{title:(0,F.MZ)("Portals")}}}},sort:600});function tu(t){return(tu=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function tl(t,e){return(tl=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function tc(t){var e="function"==typeof Map?new Map:void 0;return(tc=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return ti(t,arguments,tu(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),tl(r,t)})(t)}function ts(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ts=function(){return!!t})()}var tf=function(t){var e;if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");function r(){var t,e;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return t=r,e=arguments,t=tu(t),function(t,e){var r;if(e&&("object"==((r=e)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof e))return e;if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(this,ts()?Reflect.construct(t,e||[],tu(this).constructor):t.apply(this,e))}return r.prototype=Object.create(t&&t.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),t&&tl(r,t),e=[{key:"load",value:function(){var t;return(t=function(){var t,e,r,o;return function(t,e){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(i,"next",{value:l(0)}),u(i,"throw",{value:l(1)}),u(i,"return",{value:l(2)}),"function"==typeof Symbol&&u(i,Symbol.iterator,{value:function(){return this}}),i;function l(u){return function(l){var c=[u,l];if(r)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=e.call(t,a)}catch(t){c=[6,t],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(a){var i,u,l,f,w;switch(a.label){case 0:if(t=this,e=String(this.t("Portal manager")),this.app.flowEngine.registerModels({MultiPortalBlockModel:to}),this.app.flowEngine.registerModelLoaders({MultiPortalMobileLayoutModel:{loader:function(){return y.e("354").then(y.bind(y,833))}},MultiPortalMobileRootPageModel:{loader:function(){return y.e("354").then(y.bind(y,833))}},MultiPortalMobileChildPageModel:{loader:function(){return y.e("354").then(y.bind(y,833))}},MultiPortalMobileRootPageTabModel:{loader:function(){return y.e("354").then(y.bind(y,833))}},MultiPortalMobileChildPageTabModel:{loader:function(){return y.e("354").then(y.bind(y,833))}}}),this.app.entryActionManager&&this.app.flowEngine.registerModelLoaders({PortalEntryActionModel:{loader:function(){return y.e("499").then(y.bind(y,918))}}}),this.pluginSettingsManager.addMenuItem({key:"multi-portal",title:e,icon:"PartitionOutlined",aclSnippet:"pm.multi-portal",showTabs:!0,sort:-300}),this.pluginSettingsManager.addPageTabItem({menuKey:"multi-portal",key:"index",title:e,aclSnippet:"pm.multi-portal",componentLoader:function(){return y.e("556").then(y.bind(y,524))}}),!function(t,e){var r,n=t.pm;if(null==n?void 0:n.get){var o=n.get("acl")||n.get("@nocobase/plugin-acl");(null==o||null==(r=o.settingsUI)?void 0:r.addPermissionsTab)&&o.settingsUI.addPermissionsTab({key:"multi-portals",label:String(e("Portals")),sort:22,componentLoader:function(){return y.e("778").then(y.bind(y,177))}})}}(this.app,function(e){return t.t(e)}),!function(t,e){if(t.entryActionManager){var r=(0,s.G)(t),n=!0,o=!1,a=void 0;try{for(var i,u=b[Symbol.iterator]();!(n=(i=u.next()).done);n=!0){var l=i.value;t.entryActionManager.register("multi-portal:portals:".concat(l),{scope:l,sort:200,provider:function(){return(function(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){p(a,n,o,i,u,"next",t)}function u(t){p(a,n,o,i,u,"throw",t)}i(void 0)})}})(function(){var t,n,o,a,i,u,l;return function(t,e){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(i,"next",{value:l(0)}),u(i,"throw",{value:l(1)}),u(i,"return",{value:l(2)}),"function"==typeof Symbol&&u(i,Symbol.iterator,{value:function(){return this}}),i;function l(u){return function(l){var c=[u,l];if(r)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=e.call(t,a)}catch(t){c=[6,t],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(c){switch(c.label){case 0:return[4,r.load()];case 1:var s;if((n=(t=c.sent()).portals).length<=1)return[2,[]];return o=new Map(t.apps.map(function(t){return[t.name,t]})),a=function(t){var e=new Map,r=!0,n=!1,o=void 0;try{for(var a,i=t[Symbol.iterator]();!(r=(a=i.next()).done);r=!0){var u=a.value,l=v(u);e.set(l,(e.get(l)||0)+1)}}catch(t){n=!0,o=t}finally{try{r||null==i.return||i.return()}finally{if(n)throw o}}return e}(n),s=t.apps,i=s.length>0||g(n.map(function(t){return t.appName})).length>1,u=function(t,r){var o=function(t,e,r){var n=v(t);return e.some(function(e){return e!==t&&e.appName===t.appName&&v(e)===n&&e.layout!==t.layout})?"".concat(n," (").concat(r("mobile"===t.layout?"Mobile":"Desktop"),")"):n}(t,n,e),u=i||(a.get(v(t))||0)>1?function(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:v(t),o=m(t.appName,e,r);return o?"".concat(o," / ").concat(n):n}(t,r,e,o):o,l=function(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:v(t),o=m(t.appName,e,r);return o?"".concat(o," / ").concat(n):n}(t,r,e,o);return{key:"multi-portal:portal:".concat(t.appName,":").concat(t.uid||t.routePath),label:o,createModelOptions:{use:"PortalEntryActionModel",props:{title:u,icon:t.icon||"PartitionOutlined",entryPortalTitle:u,entryPortalTargetTitle:l,entryPortal:t,entryPortalApp:r}}}},l=i?(function(t,e){var r=g(e.map(function(t){return t.appName})),n=t.map(function(t){return t.name});return g(d(r.includes(h)?[h]:[]).concat(d(n),d(r)))})(t.apps,n).map(function(t){var r=o.get(t),a=n.filter(function(e){return e.appName===t});return a.length?{key:"multi-portal:app:".concat(t),label:m(t,r,e),children:a.map(function(t){return u(t,r)})}:null}).filter(function(t){return!!t}):n.map(function(t){return u(t,o.get(t.appName))}),[2,l.length?[{key:"multi-portal:portals",label:e("Portals"),children:l}]:[]]}})})()}})}}catch(t){o=!0,a=t}finally{try{n||null==u.return||u.return()}finally{if(o)throw a}}}}(this.app,function(e){return String(t.t(e))}),"settings."===this.pluginSettingsManager.getRouteName(""))return[2];r=!1,this.router.add("root",{path:"/",Component:function(){return n().createElement(c,{runtimeRegistrationFailed:r})},authCheck:!1,skipAuthCheck:!0}),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,(i=this.app.apiClient,(u=function(){var t,e,r;return function(t,e){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(i,"next",{value:l(0)}),u(i,"throw",{value:l(1)}),u(i,"return",{value:l(2)}),"function"==typeof Symbol&&u(i,Symbol.iterator,{value:function(){return this}}),i;function l(u){return function(l){var c=[u,l];if(r)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=e.call(t,a)}catch(t){c=[6,t],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(n){switch(n.label){case 0:return[4,i.request({url:"multiPortals:listEnabled",method:"get",skipAuth:!0,skipNotify:!0})];case 1:if(!Array.isArray(r=null==(e=n.sent())||null==(t=e.data)?void 0:t.data))throw Error("multiPortals:listEnabled returned an invalid response");return[2,r]}})},function(){var t=this,e=arguments;return new Promise(function(r,n){var o=u.apply(t,e);function a(t){N(o,r,n,a,i,"next",t)}function i(t){N(o,r,n,a,i,"throw",t)}a(void 0)})})())];case 2:return o=a.sent(),l=this.app,f=new Set(function(t,e){var r=[],n=new Set(t.listLayouts().map(function(t){return t.uid})),o=new Set,a=new Set,i=new Set,u=!0,l=!1,c=void 0;try{for(var s,f=e[Symbol.iterator]();!(u=(s=f.next()).done);u=!0){var p=s.value;if(p.enabled&&z(p)){var d=function(t){if(!t.enabled||!z(t))return null;var e,r,n,o=t.uiLayoutUid||"";if(!(0,P.Cn)(o))return null;var a=o===P.ig&&t.uid===P.Jx?K:(0,P.Cn)(o)?W[o]:void 0;return a?(r=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),n.forEach(function(e){D(t,e,r[e])})}return t}({routeName:(e=t.uid,"".concat("multiPortalLayout_").concat(encodeURIComponent(e).replace(/\./g,"%2E"))),routePath:t.routePath,uid:t.uid},a),n=n={authCheck:t.authCheck},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):(function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e.push.apply(e,r)}return e})(Object(n)).forEach(function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(n,t))}),r):null}(p);if(!d)throw Error("Portal '".concat(p.uid,"' uses an unknown UI layout uid '").concat(p.uiLayoutUid||"","'."));if(o.has(p.uid)||n.has(p.uid))throw Error("Duplicate portal uid '".concat(p.uid,"'."));if(a.has(p.portalName))throw Error("Duplicate portal name '".concat(p.portalName,"'."));if(i.has(d.routeName)||t.hasLayout(d.routeName))throw Error("Duplicate portal layout route name '".concat(d.routeName,"'."));o.add(p.uid),a.add(p.portalName),i.add(d.routeName),r.push({options:d,record:p})}}}catch(t){l=!0,c=t}finally{try{u||null==f.return||f.return()}finally{if(l)throw c}}var y=[],b=!0,h=!1,v=void 0;try{for(var g,m=r[Symbol.iterator]();!(b=(g=m.next()).done);b=!0){var w=g.value,S=w.options,O=w.record;t.registerLayout(S),y.push(O.uid)}}catch(t){h=!0,v=t}finally{try{b||null==m.return||m.return()}finally{if(h)throw v}}return y}(l.layoutManager,o)),w=o.filter(function(t){return f.has(t.uid)}).map(function(t){var e;return{cacheKey:(e=t.uid,"".concat("portal:").concat(e)),portalUid:t.uid}}),function(t,e){if(t&&(void 0===t?"undefined":R(t))==="object"){if(t[T]){t[T].portalScopes=e;return}var r=q(t),n={loadingPromises:new Map,layoutScopes:new Map,originalActivateLayout:t.activateLayout.bind(t),originalApiRequest:r.request.bind(r),originalCreateRoute:t.createRoute.bind(t),originalDeleteRoute:t.deleteRoute.bind(t),originalEnsureAccessibleLoaded:t.ensureAccessibleLoaded.bind(t),originalMoveRoute:t.moveRoute.bind(t),originalRefreshAccessible:t.refreshAccessible.bind(t),originalUpdateRoute:t.updateRoute.bind(t),portalScopes:e,refreshRequestIds:new Map,scopeStack:[]};t[T]=n,r.request=function(t){return n.originalApiRequest(function(t,e){var r,n=C(e);if(!n.portalUid||!("string"==typeof t.url&&t.url.replace(/^\/+/,"").startsWith("desktopRoutes:")))return t;var o=(r=t.params)&&(void 0===r?"undefined":R(r))==="object"&&!Array.isArray(r)?k({},t.params):{};return delete o.layout,delete o.portal,M(k({},t),{params:M(k({},o),{portal:n.portalUid})})}(t,n))},t.activateLayout=function(t){var e,r,o,a,i,u,l=(e="string"==typeof(u=null==t?void 0:t.uid)&&u.trim()?u:"admin-layout-model",r=n.portalScopes,o=n.layoutScopes,(i=(a=new Map(r().filter(function(t){return"string"==typeof(null==t?void 0:t.portalUid)&&!!t.portalUid.trim()&&"string"==typeof t.cacheKey&&!!t.cacheKey.trim()}).map(function(t){return[t.portalUid,t]}))).get(e))||function(t,e,r){var n=new Set(E(e.values()).map(function(t){return t.cacheKey})),o=new Set(E(r.entries()).filter(function(e){return A(e,1)[0]!==t}).map(function(t){return A(t,2)[1].cacheKey})),a=r.get(t);if(a&&!n.has(a.cacheKey)&&!o.has(a.cacheKey))return a;for(var i=t;n.has(i)||o.has(i);)i="layout:".concat(i);var u={cacheKey:i,uiLayoutUid:t};return r.set(t,u),u}(e,a,o)),c=Symbol("multi-portal-route-scope"),s=n.originalActivateLayout(M(k({},t),{uid:l.cacheKey}));return n.scopeStack.push({deactivate:s,scope:l,token:c}),function(){var t=n.scopeStack.findIndex(function(t){return t.token===c});t>=0&&n.scopeStack.splice(t,1),s()}},t.refreshAccessible=function(){return j(function(){var e;return I(this,function(r){return U(e=C(n))?[2,B(t,e,n)]:[2,n.originalRefreshAccessible()]})})()},t.ensureAccessibleLoaded=function(){return j(function(){var e,r,o;return I(this,function(a){return U(e=C(n))?t.isAccessibleLoaded()?[2,t.listAccessible()]:(r=n.loadingPromises.get(e.cacheKey))?[2,r]:(o=B(t,e,n).finally(function(){n.loadingPromises.get(e.cacheKey)===o&&n.loadingPromises.delete(e.cacheKey)}),n.loadingPromises.set(e.cacheKey,o),[2,o]):[2,n.originalEnsureAccessibleLoaded()]})})()},t.createRoute=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return j(function(){var o,a,i,u;return I(this,function(l){switch(l.label){case 0:if(!(o=C(n)).portalUid)return[2,n.originalCreateRoute(e,r)];return i=void 0===(a=r.refreshAfterMutation)||a,[4,q(t).resource("desktopRoutes").create({values:L(e),portal:o.portalUid})];case 1:if(u=l.sent(),!i)return[3,3];return[4,t.refreshAccessible()];case 2:l.sent(),l.label=3;case 3:return[2,u]}})})()},t.updateRoute=function(e,r){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return j(function(){var a,i,u,l,c;return I(this,function(s){switch(s.label){case 0:if(!(a=C(n)).portalUid)return[2,n.originalUpdateRoute(e,r,o)];return u=void 0===(i=o.refreshAfterMutation)||i,l=L(r),[4,q(t).resource("desktopRoutes").update(Array.isArray(e)?{filter:{id:{$in:e}},values:l,portal:a.portalUid}:{filterByTk:e,values:l,portal:a.portalUid})];case 1:if(c=s.sent(),!u)return[3,3];return[4,t.refreshAccessible()];case 2:s.sent(),s.label=3;case 3:return[2,c]}})})()},t.deleteRoute=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return j(function(){var o,a,i,u;return I(this,function(l){switch(l.label){case 0:if(!(o=C(n)).portalUid)return[2,n.originalDeleteRoute(e,r)];return i=void 0===(a=r.refreshAfterMutation)||a,[4,q(t).resource("desktopRoutes").destroy({filterByTk:e,portal:o.portalUid})];case 1:if(u=l.sent(),!i)return[3,3];return[4,t.refreshAccessible()];case 2:l.sent(),l.label=3;case 3:return[2,u]}})})()},t.moveRoute=function(e){return j(function(){var r,o,a,i,u;return I(this,function(l){switch(l.label){case 0:if(!(r=C(n)).portalUid)return[2,n.originalMoveRoute(e)];return a=void 0===(o=e.refreshAfterMove)||o,i=x(e,["refreshAfterMove"]),[4,q(t).resource("desktopRoutes").move(M(k({},i),{portal:r.portalUid}))];case 1:if(u=l.sent(),!a)return[3,3];return[4,t.refreshAccessible()];case 2:l.sent(),l.label=3;case 3:return[2,u]}})})()}}}(function(t){if(null==(e=t.context)?void 0:e.routeRepository)return t.context.routeRepository;var e,r,n=null==(r=t.flowEngine)?void 0:r.context;if(n&&(void 0===n?"undefined":n&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)=="object"&&"routeRepository"in n)return n.routeRepository}(l),function(){return w}),!function(t,e){if(t&&("function"==typeof t.registerAuthRouteScope||"function"==typeof t.registerSignInRoute)){var r=!0,n=!1,o=void 0;try{for(var a,i=e[Symbol.iterator]();!(r=(a=i.next()).done);r=!0){var u,l=a.value;if(l.enabled&&"no-code"===(l.portalType||"no-code")){var c=encodeURIComponent(l.uid).replace(/\./g,"%2E"),s="multiPortal_".concat(c),f="multiPortalSignin_".concat(c);"function"==typeof t.registerAuthRouteScope?t.registerAuthRouteScope(s,l.routePath,{signin:f,signup:"multiPortalSignup_".concat(c)}):null==(u=t.registerSignInRoute)||u.call(t,f,"".concat(l.routePath.replace(/\/+$/g,""),"/signin"))}}}catch(t){n=!0,o=t}finally{try{r||null==i.return||i.return()}finally{if(n)throw o}}}}(this.app.pm.get("@nocobase/plugin-auth"),o),[3,4];case 3:return console.error("[NocoBase] Failed to register multi-portals.",a.sent()),r=!0,[3,4];case 4:return[2]}})},function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){ta(a,n,o,i,u,"next",t)}function u(t){ta(a,n,o,i,u,"throw",t)}i(void 0)})}).call(this)}}],function(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}(r.prototype,e),r}(tc(e.Plugin))}(),w}()});
|
|
@@ -17,11 +17,7 @@ export type MultiPortalRuntimeRecord = {
|
|
|
17
17
|
routePath: string;
|
|
18
18
|
authCheck: boolean;
|
|
19
19
|
enabled: boolean;
|
|
20
|
-
|
|
21
|
-
layoutType?: string;
|
|
22
|
-
routeName?: string;
|
|
23
|
-
routePath?: string;
|
|
24
|
-
};
|
|
20
|
+
uiLayoutUid?: string | null;
|
|
25
21
|
};
|
|
26
22
|
type MultiPortalRegistrationApp = {
|
|
27
23
|
apiClient: Pick<Application['apiClient'], 'request'>;
|
|
@@ -23,11 +23,6 @@ type MultiPortalOptions = {
|
|
|
23
23
|
};
|
|
24
24
|
export type MultiPortalRecord = MultiPortalFormValues & {
|
|
25
25
|
isDefault?: boolean | null;
|
|
26
|
-
uiLayout?: {
|
|
27
|
-
layoutType?: string;
|
|
28
|
-
title?: string;
|
|
29
|
-
uid?: string;
|
|
30
|
-
};
|
|
31
26
|
};
|
|
32
27
|
export type MultiPortalFormValues = {
|
|
33
28
|
title: string;
|
|
@@ -88,26 +83,5 @@ export declare function setDefaultMultiPortal(args: {
|
|
|
88
83
|
filterByTk: MultiPortalPrimaryKey;
|
|
89
84
|
onSubmitted: () => void;
|
|
90
85
|
}): Promise<void>;
|
|
91
|
-
/**
|
|
92
|
-
* 从 git 仓库地址里取出仓库名。
|
|
93
|
-
*
|
|
94
|
-
* 支持 `git@host:org/repo.git`、`https://host/org/repo(.git)`、以及末尾多余的斜杠。
|
|
95
|
-
*
|
|
96
|
-
* @param {string | undefined} repo 仓库地址
|
|
97
|
-
* @returns {string | undefined} 仓库名
|
|
98
|
-
*/
|
|
99
|
-
export declare function getRepoNameFromGitUrl(repo?: string | null): string;
|
|
100
|
-
/**
|
|
101
|
-
* 由 git 仓库地址推导 portal 的标题和名称。
|
|
102
|
-
*
|
|
103
|
-
* 只是给用户省一次输入,两个字段推导完仍然可改。
|
|
104
|
-
*
|
|
105
|
-
* @param {string | undefined} repo 仓库地址
|
|
106
|
-
* @returns {{ portalName: string; title: string } | undefined} 推导结果
|
|
107
|
-
*/
|
|
108
|
-
export declare function derivePortalNamingFromGitUrl(repo?: string | null): {
|
|
109
|
-
portalName: string;
|
|
110
|
-
title: string;
|
|
111
|
-
};
|
|
112
86
|
declare const MultiPortalsPage: React.FC;
|
|
113
87
|
export default MultiPortalsPage;
|
package/dist/constants.d.ts
CHANGED
|
@@ -9,4 +9,11 @@
|
|
|
9
9
|
export declare const DEFAULT_ADMIN_MULTI_PORTAL_UID = "__default_admin__";
|
|
10
10
|
export declare const DEFAULT_MOBILE_MULTI_PORTAL_UID = "__default_mobile__";
|
|
11
11
|
export declare const NAMESPACE = "@nocobase/plugin-multi-portal";
|
|
12
|
+
export declare const ADMIN_UI_LAYOUT_UID = "admin-layout-model";
|
|
13
|
+
export declare const MOBILE_UI_LAYOUT_UID = "mobile-layout-model";
|
|
14
|
+
export declare const MULTI_PORTAL_UI_LAYOUT_UIDS: readonly ["admin-layout-model", "mobile-layout-model"];
|
|
15
|
+
export type MultiPortalUiLayoutUid = (typeof MULTI_PORTAL_UI_LAYOUT_UIDS)[number];
|
|
16
|
+
export type MultiPortalLayoutType = 'desktop' | 'mobile';
|
|
12
17
|
export declare function isDefaultLayoutMultiPortalUid(uid: unknown): uid is string;
|
|
18
|
+
export declare function isMultiPortalUiLayoutUid(uid: unknown): uid is MultiPortalUiLayoutUid;
|
|
19
|
+
export declare function getMultiPortalLayoutType(uid: unknown): MultiPortalLayoutType | undefined;
|
package/dist/constants.js
CHANGED
|
@@ -26,26 +26,51 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
26
26
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
27
|
var constants_exports = {};
|
|
28
28
|
__export(constants_exports, {
|
|
29
|
+
ADMIN_UI_LAYOUT_UID: () => ADMIN_UI_LAYOUT_UID,
|
|
29
30
|
DEFAULT_ADMIN_MULTI_PORTAL_UID: () => DEFAULT_ADMIN_MULTI_PORTAL_UID,
|
|
30
31
|
DEFAULT_MOBILE_MULTI_PORTAL_UID: () => DEFAULT_MOBILE_MULTI_PORTAL_UID,
|
|
32
|
+
MOBILE_UI_LAYOUT_UID: () => MOBILE_UI_LAYOUT_UID,
|
|
33
|
+
MULTI_PORTAL_UI_LAYOUT_UIDS: () => MULTI_PORTAL_UI_LAYOUT_UIDS,
|
|
31
34
|
NAMESPACE: () => NAMESPACE,
|
|
32
|
-
|
|
35
|
+
getMultiPortalLayoutType: () => getMultiPortalLayoutType,
|
|
36
|
+
isDefaultLayoutMultiPortalUid: () => isDefaultLayoutMultiPortalUid,
|
|
37
|
+
isMultiPortalUiLayoutUid: () => isMultiPortalUiLayoutUid
|
|
33
38
|
});
|
|
34
39
|
module.exports = __toCommonJS(constants_exports);
|
|
35
40
|
const DEFAULT_ADMIN_MULTI_PORTAL_UID = "__default_admin__";
|
|
36
41
|
const DEFAULT_MOBILE_MULTI_PORTAL_UID = "__default_mobile__";
|
|
37
42
|
const NAMESPACE = "@nocobase/plugin-multi-portal";
|
|
43
|
+
const ADMIN_UI_LAYOUT_UID = "admin-layout-model";
|
|
44
|
+
const MOBILE_UI_LAYOUT_UID = "mobile-layout-model";
|
|
45
|
+
const MULTI_PORTAL_UI_LAYOUT_UIDS = [ADMIN_UI_LAYOUT_UID, MOBILE_UI_LAYOUT_UID];
|
|
38
46
|
const DEFAULT_LAYOUT_MULTI_PORTAL_UIDS = /* @__PURE__ */ new Set([
|
|
39
47
|
DEFAULT_ADMIN_MULTI_PORTAL_UID,
|
|
40
48
|
DEFAULT_MOBILE_MULTI_PORTAL_UID
|
|
41
49
|
]);
|
|
50
|
+
const MULTI_PORTAL_UI_LAYOUT_UID_SET = new Set(MULTI_PORTAL_UI_LAYOUT_UIDS);
|
|
42
51
|
function isDefaultLayoutMultiPortalUid(uid) {
|
|
43
52
|
return typeof uid === "string" && DEFAULT_LAYOUT_MULTI_PORTAL_UIDS.has(uid);
|
|
44
53
|
}
|
|
54
|
+
function isMultiPortalUiLayoutUid(uid) {
|
|
55
|
+
return typeof uid === "string" && MULTI_PORTAL_UI_LAYOUT_UID_SET.has(uid);
|
|
56
|
+
}
|
|
57
|
+
function getMultiPortalLayoutType(uid) {
|
|
58
|
+
if (uid === ADMIN_UI_LAYOUT_UID) {
|
|
59
|
+
return "desktop";
|
|
60
|
+
}
|
|
61
|
+
if (uid === MOBILE_UI_LAYOUT_UID) {
|
|
62
|
+
return "mobile";
|
|
63
|
+
}
|
|
64
|
+
}
|
|
45
65
|
// Annotate the CommonJS export names for ESM import in node:
|
|
46
66
|
0 && (module.exports = {
|
|
67
|
+
ADMIN_UI_LAYOUT_UID,
|
|
47
68
|
DEFAULT_ADMIN_MULTI_PORTAL_UID,
|
|
48
69
|
DEFAULT_MOBILE_MULTI_PORTAL_UID,
|
|
70
|
+
MOBILE_UI_LAYOUT_UID,
|
|
71
|
+
MULTI_PORTAL_UI_LAYOUT_UIDS,
|
|
49
72
|
NAMESPACE,
|
|
50
|
-
|
|
73
|
+
getMultiPortalLayoutType,
|
|
74
|
+
isDefaultLayoutMultiPortalUid,
|
|
75
|
+
isMultiPortalUiLayoutUid
|
|
51
76
|
});
|