@nocobase/plugin-multi-portal 3.0.0-alpha.6 → 3.0.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client-v2/354.87f18462949b5c23.js +10 -0
- package/dist/client-v2/556.443e73c9ca4c18b9.js +10 -0
- package/dist/client-v2/778.affaa69b23857ef2.js +10 -0
- package/dist/client-v2/993.7a1cc7aa6cec0160.js +10 -0
- package/dist/client-v2/PortalAccessBoundary.d.ts +49 -0
- package/dist/client-v2/index.js +1 -1
- package/dist/client-v2/interceptor.d.ts +13 -0
- package/dist/client-v2/models/MultiPortalLayoutModels.d.ts +14 -0
- package/dist/client-v2/models/MultiPortalMobilePageModels.d.ts +2 -0
- package/dist/client-v2/portalAccess.d.ts +73 -0
- package/dist/externalVersion.js +10 -9
- package/dist/locale/en-US.json +16 -2
- package/dist/locale/zh-CN.json +16 -2
- package/dist/node_modules/tar/package.json +1 -1
- package/dist/server/plugin.d.ts +1 -0
- package/dist/server/plugin.js +107 -44
- package/package.json +3 -3
- package/dist/client-v2/354.7be267ae5d61a878.js +0 -10
- package/dist/client-v2/556.64742ccddb8fe2f0.js +0 -10
- package/dist/client-v2/778.c98e7ec542d931fe.js +0 -10
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,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}()});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("ahooks"),require("axios"),require("@ant-design/icons"),require("@nocobase/client-v2"),require("react-router-dom"),require("@nocobase/plugin-ui-layout/client-v2"),require("react"),require("antd"),require("@nocobase/flow-engine"),require("antd-style")):"function"==typeof define&&define.amd?define("@nocobase/plugin-multi-portal/client-v2",["ahooks","axios","@ant-design/icons","@nocobase/client-v2","react-router-dom","@nocobase/plugin-ui-layout/client-v2","react","antd","@nocobase/flow-engine","antd-style"],t):"object"==typeof exports?exports["@nocobase/plugin-multi-portal/client-v2"]=t(require("ahooks"),require("axios"),require("@ant-design/icons"),require("@nocobase/client-v2"),require("react-router-dom"),require("@nocobase/plugin-ui-layout/client-v2"),require("react"),require("antd"),require("@nocobase/flow-engine"),require("antd-style")):e["@nocobase/plugin-multi-portal/client-v2"]=t(e.ahooks,e.axios,e["@ant-design/icons"],e["@nocobase/client-v2"],e["react-router-dom"],e["@nocobase/plugin-ui-layout/client-v2"],e.react,e.antd,e["@nocobase/flow-engine"],e["antd-style"])}(self,function(e,t,r,n,o,a,i,l,u,c){return function(){"use strict";var s,f,p,d={344:function(e,t,r){r.d(t,{g_:function(){return S},oM:function(){return w}});var n=r(485),o=r(59),a=r(155),i=r.n(a),l=r(442),u=r(143);function c(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 s(e,t,r,n,o,a,i){try{var l=e[a](i),u=l.value}catch(e){r(e);return}l.done?t(u):Promise.resolve(u).then(n,o)}function f(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function i(e){s(a,n,o,i,l,"next",e)}function l(e){s(a,n,o,i,l,"throw",e)}i(void 0)})}}function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],i=!0,l=!1;try{for(o=o.call(e);!(i=(r=o.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,n=e}finally{try{i||null==o.return||o.return()}finally{if(l)throw n}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return c(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 c(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e){return e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function h(e,t){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=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var y=(0,a.createContext)(null),v=function(){return function(){}},b=function(){return null};function m(e){var t,r,n=e.apiClient,l=e.denied,u=e.reload,c=e.t,s=e.userRoles,d=o.theme.useToken().token,y=(0,a.useMemo)(function(){var e;return e=s.filter(function(e){return"__union__"!==e.name}),l.allowAnonymous&&!e.some(function(e){return"anonymous"===e.name})&&e.push({name:"anonymous",title:c("Anonymous")}),"allow-use-union"===l.roleMode&&e.unshift({name:"__union__",title:c("Full permissions")}),e},[l,c,s]),v="only-use-union"===l.roleMode?"__union__":l.role||n.auth.role||(null==(t=y[0])?void 0:t.name)||"",b=p((0,a.useState)(v),2),m=b[0],g=b[1],w=p((0,a.useState)(!1),2),S=w[0],P=w[1],k=p((0,a.useState)(""),2),O=k[0],A=k[1];(0,a.useEffect)(function(){g(v),A("")},[v]);var j=(0,a.useCallback)(function(e){return f(function(){var t;return h(this,function(r){switch(r.label){case 0:t=n.auth.role||m,A(""),P(!0),g(e),n.auth.setRole(e),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,n.resource("users").setDefaultRole({values:{roleName:e}})];case 2:return r.sent(),u(),[3,5];case 3:return r.sent(),n.auth.setRole(t||null),g(t||""),A(c("Failed to switch role")),[3,5];case 4:return P(!1),[7];case 5:return[2]}})})()},[n,m,u,c]),x=y.length>1&&"only-use-union"!==l.roleMode;return i().createElement(o.Card,{"aria-label":c("Switch role"),extra:i().createElement(o.Space,{size:"small"},i().createElement(o.Typography.Text,{type:"secondary"},c("Current role")),i().createElement(o.Tag,{style:{marginInlineEnd:0}},"__union__"===m?c("Full permissions"):(null==(r=y.find(function(e){return e.name===m}))?void 0:r.title)||m)),role:"region",style:{textAlign:"start",width:"100%"},styles:{title:{fontWeight:"normal"}},title:c("Switch role")},i().createElement(o.Space,{direction:"vertical",size:d.marginXS,style:{width:"100%"}},x?i().createElement(i().Fragment,null,i().createElement(o.Typography.Text,null,c("Select role")),i().createElement(o.Select,{"aria-label":c("Switch role"),disabled:S,loading:S,onChange:j,options:y.map(function(e){return{label:e.title||e.name,value:e.name}}),value:m,style:{width:"100%"}}),i().createElement(o.Typography.Text,{type:"secondary"},c("Portal access will be checked again after switching."))):null,O?i().createElement(o.Alert,{showIcon:!0,type:"error",message:O}):null))}function g(e){var t=e.access,r=e.apiClient,n=e.reload,l=void 0===n?function(){return window.location.reload()}:n,u=e.renderAllowed,c=e.retry,s=e.t,d=e.userRoles,y=o.theme.useToken().token,v=p((0,a.useState)(!1),2),b=v[0],g=v[1],w=(0,a.useMemo)(function(){return{alignItems:"center",background:y.colorBgLayout,display:"flex",justifyContent:"center",minHeight:"100vh",padding:y.paddingLG}},[y.colorBgLayout,y.paddingLG]),S=(0,a.useMemo)(function(){return{width:"100%"}},[]),P=(0,a.useMemo)(function(){return{marginInline:"auto",maxWidth:y.screenXS,width:"100%"}},[y.screenXS]),k=d.filter(function(e){return"__union__"!==e.name}).length>1,O=(0,a.useCallback)(function(){return f(function(){return h(this,function(e){switch(e.label){case 0:g(!0),e.label=1;case 1:return e.trys.push([1,,3,4]),[4,c()];case 2:return e.sent(),[3,4];case 3:return g(!1),[7];case 4:return[2]}})})()},[c]);return"allowed"===t.status?i().createElement(i().Fragment,null,u()):"checking"===t.status?i().createElement("div",{role:"status","aria-label":s("Checking Portal access"),style:w},i().createElement(o.Spin,{size:"large"})):"denied"===t.status&&t.denied?i().createElement("main",{style:w},i().createElement(o.Result,{style:S,status:"403",title:s("No access to this Portal"),subTitle:s("Please switch to a role that can access this Portal."),extra:k?i().createElement("div",{style:P},i().createElement(m,{apiClient:r,denied:t.denied,reload:l,t:s,userRoles:d})):void 0})):i().createElement("main",{style:w},i().createElement(o.Result,{style:S,status:"error",title:s("Failed to check Portal access"),subTitle:s("Unable to verify whether the current role can access this Portal."),extra:i().createElement(o.Button,{loading:b,onClick:O,type:"primary"},s("Retry"))}))}function w(e){var t=e.children,r=e.controller,o=(0,n.useApp)(),u=(0,n.useACLContext)(),c=null==u?void 0:u.refresh,s=(0,l.useLocation)();(0,a.useSyncExternalStore)(r.subscribe,r.getSnapshot,r.getSnapshot);var f=r.resolvePortal(s.pathname),p=o.apiClient.auth.role,d=(null==f?void 0:f.authCheck)===!1?null:f?"".concat(f.portalName,"\0").concat(p||""):null,h=(0,a.useRef)(),v=(0,a.useCallback)(function(){return(null==c?void 0:c())||r.checkAccess()},[c,r]),b=(0,a.useCallback)(function(e){return r.invalidate(e,o.apiClient.auth.role),v()},[o.apiClient.auth.role,r,v]);(0,a.useEffect)(function(){var e=h.current;if(h.current=d,!(!f||!1===f.authCheck||o.router.isSkippedAuthCheckRoute(s.pathname))){var t=function(){v().catch(function(e){console.error("[NocoBase] Failed to refresh Portal access.",e)})};if(void 0===e){if(c)return;var n=!0;return queueMicrotask(function(){n&&r.needsCheck(f.portalName,p)&&t()}),function(){n=!1}}var a=e!==d;a&&r.invalidate(f.portalName,p),(a||r.needsCheck(f.portalName,p))&&t()}},[c,o,r,s.pathname,f,p,d,v]);var m=(0,a.useMemo)(function(){return{controller:r,retry:b}},[r,b]);return i().createElement(y.Provider,{value:m},t)}function S(e){var t,r=e.portalUid,o=e.renderAllowed,l=(0,a.useContext)(y),c=(0,n.useApp)(),s=(0,n.useCurrentUserContext)(),f=(0,u.kj)();(0,a.useSyncExternalStore)((null==l?void 0:l.controller.subscribe)||v,(null==l?void 0:l.controller.getSnapshot)||b,(null==l?void 0:l.controller.getSnapshot)||b);var p=null==l?void 0:l.controller.getPortalByUid(r);if(!l||!p||!1===p.authCheck)return i().createElement(i().Fragment,null,o());var h=function(e,t){if(!e||(void 0===e?"undefined":d(e))!=="object")return[];var r=e.roles;return Array.isArray(r)?r.flatMap(function(e){if(!e||(void 0===e?"undefined":d(e))!=="object"||"string"!=typeof e.name)return[];var r=e.name,n=e.title;return[{name:r,title:t("string"==typeof n?n:void 0)||r}]}):[]}(null==s||null==(t=s.data)?void 0:t.data,function(e){return e?String(c.flowEngine.context.t(e)):""}),m=l.controller.getAccessState(p.portalName,c.apiClient.auth.role);return i().createElement(g,{access:m,apiClient:c.apiClient,renderAllowed:o,retry:function(){return l.retry(p.portalName)},t:function(e){return String(f(e))},userRoles:h})}},337:function(e,t,r){r.d(t,{G:function(){return u}});var n=r(694);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e){var t=e||{};return{apps:Array.isArray(t.apps)?t.apps:[],portals:Array.isArray(t.portals)?t.portals:[]}}var i=function(){var e;function t(e){if(!(this instanceof t))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=e,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 e=[{key:"load",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.app.apiClient;return this.loaded&&!this.request?Promise.resolve(this.payload):this.requestPortals(e)}},{key:"reload",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.app.apiClient;return this.requestPortals(e,{force:!0,invalidateEntryActions:!0})}},{key:"requestPortals",value:function(e){var t=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=e.silent)?void 0:n.call(e))||e).request({url:"app:getPortals",skipNotify:!0}).then(function(e){var n,i,l,u=a(null!=(n=null==e||null==(i=e.data)?void 0:i.data)?n:null==e?void 0:e.data);return o===t.requestId&&(t.payload=u,t.loaded=!0,t.revision+=1,r.invalidateEntryActions&&(null==(l=t.app.entryActionManager)||l.invalidate())),u}).catch(function(e){throw e}).finally(function(){o===t.requestId&&(t.loading=!1,t.request=void 0)})}return this.request}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),t}(),l=new WeakMap;function u(e){var t=l.get(e);return t||(t=new i(e),l.set(e,t)),t}},143:function(e,t,r){r.d(t,{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(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 i(){var e=(0,n.useFlowEngine)();return function(t,r){return e.context.t(t,a({ns:[o.UU,"client"]},r))}}function l(e){return a({ns:[o.UU,"client"]},e)}function u(e){return(0,n.tExpr)(e,{ns:[o.UU,"client"]})}},756:function(e,t,r){r.d(t,{Q:function(){return P},u:function(){return w}});var n=r(485);function o(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 a(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e){if(e){if("string"==typeof e)return o(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return o(e,void 0)}}(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var i="no-code",l="/settings",u=function(e){var t=null==e?void 0:e.trim();return t&&"/"!==t?"/".concat(t.replace(/^\/+/,"")):"/"},c=function(e){var t=u(e).replace(/\/+$/,"");return""===t||"/"===t?"":t},s=function(e,t){var r=c(e),n=u(t);return!r||n===r||n.startsWith("".concat(r,"/"))?n:"".concat(r).concat(n)};function f(e){return"ai"===e?"ai":i}function p(e){return"ai"===f(e)?"/x":"/".concat((0,n.getModernClientPrefix)())}function d(){return Array.from(new Set([p(i),"/x","/v"]))}function h(e,t){var r=u(t);return d().includes(r)?"".concat(c(e)).concat(r):s(e,r)}function y(e,t){var r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],n=c(e),o=p(t);if(!n)return o;var i=r?n.match(/^(.*)\/(apps|_app)\/([^/]+)$/):null;if(i){var u=i[1]||"",s=!0,h=!1,y=void 0;try{for(var v,b=a(d()).concat([l])[Symbol.iterator]();!(s=(v=b.next()).done);s=!0){var m=v.value;if(u===m){u="";break}if(u.endsWith(m)){u=u.slice(0,-m.length);break}}}catch(e){h=!0,y=e}finally{try{s||null==b.return||b.return()}finally{if(h)throw y}}var g="ai"===f(t)?"apps":i[2];return"".concat(u).concat(o,"/").concat(g,"/").concat(i[3])}var w=!0,S=!1,P=void 0;try{for(var k,O=d()[Symbol.iterator]();!(w=(k=O.next()).done);w=!0){var A=k.value;if(n===A)return o;if(n.endsWith(A))return"".concat(n.slice(0,-A.length)).concat(o)}}catch(e){S=!0,P=e}finally{try{w||null==O.return||O.return()}finally{if(S)throw P}}return"".concat(n).concat(o)}function v(e,t){var r=c(t),n=u(e);return r?n===r?"/":n.startsWith("".concat(r,"/"))?n.slice(r.length)||"/":n:n}function b(e,t,r){var n=!(arguments.length>3)||void 0===arguments[3]||arguments[3],o=u(e),i=d(),l=[y(t,r,n),y(t,"ai"===f(r)?"no-code":"ai",n)],c=!0,s=!1,p=void 0;try{for(var h,b=l[Symbol.iterator]();!(c=(h=b.next()).done);c=!0){var m=h.value,g=v(o,m);if(g!==o&&i.includes(g))return g}}catch(e){s=!0,p=e}finally{try{c||null==b.return||b.return()}finally{if(s)throw p}}if(i.includes(o))return o;var w=!0,S=!1,P=void 0;try{for(var k,O=a(l).concat(a(i))[Symbol.iterator]();!(w=(k=O.next()).done);w=!0){var A=k.value;o=v(o,A)}}catch(e){S=!0,P=e}finally{try{w||null==O.return||O.return()}finally{if(S)throw P}}return o}function m(e){return"function"==typeof(null==e?void 0:e.getPublicPath)}function g(e,t){var r,n=null==e||null==(r=e.getPublicPath)?void 0:r.call(e);return!("main"===(e&&"name"in e&&"string"==typeof e.name?e.name:void 0)&&n&&c(n)===c(t))}function w(e,t,r){var o,a,i,l,s=t.trim();if(/^[a-z][a-z\d+\-.]*:\/\//i.test(s)||s.startsWith("//"))return s;var f=(null==e||null==(a=e.router)||null==(o=a.getBasename)?void 0:o.call(a))||(null==e||null==(i=e.router)?void 0:i.basename);if(f){var p=m(e)?(0,n.getV2EffectiveBasePath)({getPublicPath:e.getPublicPath,router:{getBasename:function(){var t,r,n;return(null==(r=e.router)||null==(t=r.getBasename)?void 0:t.call(r))||(null==(n=e.router)?void 0:n.basename)}}}):f,d=g(e,p);return h(y(p,r,d),b(s,p,r,d))}if(null==e?void 0:e.getRouteUrl){var v,w,S=e.getRouteUrl(s),P=(v=u(S))===(w=u(s))?"":v.endsWith(w)?c(v.slice(0,-w.length)):void 0;if(void 0!==P){var k=g(e,P);return h(y(P,r,k),b(s,P,r,k))}return u(S)}var O=null==e||null==(l=e.getPublicPath)?void 0:l.call(e),A=g(e,O);return h(y(O,r,A),b(s,O,r,A))}function S(e){var t=c(e),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(t===d)return l;var h=t.match(new RegExp("^(.*)".concat(d,"/(apps|_app)/([^/]+)$")));if(h)return"".concat(h[1]).concat(l,"/").concat(h[2],"/").concat(h[3]);if(t.endsWith(d))return"".concat(t.slice(0,-d.length)).concat(l)}}catch(e){o=!0,a=e}finally{try{n||null==f.return||f.return()}finally{if(o)throw a}}return s(t,l)}function P(e){var t,r,o,a,i=(null==e||null==(r=e.router)||null==(t=r.getBasename)?void 0:t.call(r))||(null==e||null==(o=e.router)?void 0:o.basename);return i?S(m(e)?(0,n.getV2EffectiveBasePath)({getPublicPath:e.getPublicPath,router:{getBasename:function(){var t,r,n;return(null==(r=e.router)||null==(t=r.getBasename)?void 0:t.call(r))||(null==(n=e.router)?void 0:n.basename)}}}):i):S(null==e||null==(a=e.getPublicPath)?void 0:a.call(e))}},624:function(e,t,r){r.d(t,{Cn:function(){return c},Jx:function(){return n},R$:function(){return o},Xc:function(){return u},ig:function(){return a}});var n="__default_mobile__",o="admin-layout-model",a="mobile-layout-model",i=new Set(["__default_admin__",n]),l=new Set([o,a]);function u(e){return"string"==typeof e&&i.has(e)}function c(e){return"string"==typeof e&&l.has(e)}},375:function(e){e.exports=r},485:function(e){e.exports=n},694:function(e){e.exports=u},69:function(e){e.exports=a},625:function(t){t.exports=e},59:function(e){e.exports=l},235:function(e){e.exports=c},742:function(e){e.exports=t},155:function(e){e.exports=i},442:function(e){e.exports=o}},h={};function y(e){var t=h[e];if(void 0!==t)return t.exports;var r=h[e]={exports:{}};return d[e](r,r.exports,y),r.exports}y.m=d,y.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return y.d(t,{a:t}),t},y.d=function(e,t){for(var r in t)y.o(t,r)&&!y.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},y.f={},y.e=function(e){return Promise.all(Object.keys(y.f).reduce(function(t,r){return y.f[r](e,t),t},[]))},y.u=function(e){return""+e+"."+({354:"87f18462949b5c23",499:"245037eea4cc7266",556:"443e73c9ca4c18b9",778:"affaa69b23857ef2",993:"7a1cc7aa6cec0160"})[e]+".js"},y.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),y.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},v={},y.l=function(e,t,r,n){if(v[e])return void v[e].push(t);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")==e||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=e),v[e]=[t];var c=function(t,r){o.onerror=o.onload=null,clearTimeout(s);var n=v[e];if(delete v[e],o.parentNode&&o.parentNode.removeChild(o),n&&n.forEach(function(e){return e(r)}),t)return t(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(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},y.g.importScripts&&(b=y.g.location+"");var v,b,m=y.g.document;if(!b&&m&&(m.currentScript&&"SCRIPT"===m.currentScript.tagName.toUpperCase()&&(b=m.currentScript.src),!b)){var g=m.getElementsByTagName("script");if(g.length)for(var w=g.length-1;w>-1&&(!b||!/^http(s?):/.test(b));)b=g[w--].src}if(!b)throw Error("Automatic publicPath is not supported in this browser");y.p=b.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),s={889:0},y.f.j=function(e,t){var r=y.o(s,e)?s[e]:void 0;if(0!==r)if(r)t.push(r[2]);else{var n=new Promise(function(t,n){r=s[e]=[t,n]});t.push(r[2]=n);var o=y.p+y.u(e),a=Error();y.l(o,function(t){if(y.o(s,e)&&(0!==(r=s[e])&&(s[e]=void 0),r)){var n=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;a.message="Loading chunk "+e+" failed.\n("+n+": "+o+")",a.name="ChunkLoadError",a.type=n,a.request=o,r[1](a)}},"chunk-"+e,e)}},f=function(e,t){var r,n,o=t[0],a=t[1],i=t[2],l=0;if(o.some(function(e){return 0!==s[e]})){for(r in a)y.o(a,r)&&(y.m[r]=a[r]);i&&i(y)}for(e&&e(t);l<o.length;l++)n=o[l],y.o(s,n)&&s[n]&&s[n][0](),s[n]=0},(p=self.webpackChunk_nocobase_plugin_multi_portal_client_v2=self.webpackChunk_nocobase_plugin_multi_portal_client_v2||[]).forEach(f.bind(null,0)),p.push=f.bind(null,p.push.bind(p));var S={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src){var r=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");r.indexOf("/static/plugins/@nocobase/plugin-multi-portal/dist/client-v2/")>=0&&(e=r.replace(/\/[^\/]+$/,"/"))}if(!e){var n=window.__webpack_public_path__||"";n&&("/"!==n.charAt(n.length-1)&&(n+="/"),e=n+"static/plugins/@nocobase/plugin-multi-portal/dist/client-v2/")}if(!e){var o=window.__nocobase_modern_client_prefix__||"v",a="/"+(o=String(o).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var i=window.location.pathname||"/",l=i.indexOf(a);e=l>=0?i.slice(0,l+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-multi-portal/dist/client-v2/"}y.p=e}(),!function(){y.r(S),y.d(S,{default:function(){return ek}});var e,t=y(485),r=y(155),n=y.n(r),o=y(344),a=y(442),i=y(756);function l(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 u(e,t,r,n,o,a,i){try{var l=e[a](i),u=l.value}catch(e){r(e);return}l.done?t(u):Promise.resolve(u).then(n,o)}function c(e){return"".concat(e.search||"").concat(e.hash||"")}function s(e){var o,s=e.runtimeRegistrationFailed,f=void 0!==s&&s,p=(0,t.useApp)(),d=(0,a.useLocation)(),h=function(e){if(Array.isArray(e))return e}(o=(0,r.useState)())||function(e){var t,r,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],a=!0,i=!1;try{for(n=n.call(e);!(a=(t=n.next()).done)&&(o.push(t.value),2!==o.length);a=!0);}catch(e){i=!0,r=e}finally{try{a||null==n.return||n.return()}finally{if(i)throw r}}return o}}(o)||function(e){if(e){if("string"==typeof e)return l(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return l(e,2)}}(o)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),y=h[0],v=h[1],b=(0,r.useRef)();return((0,r.useEffect)(function(){if(f)return void window.location.replace("".concat((0,i.Q)(p)).concat(c(d)));var e,t=!0;return(e=function(){var e,r,n;return function(e,t){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=t.call(e,a)}catch(e){c=[6,e],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 a;if(r=o.sent(),!t)return[2];if((a=n=null==r||null==(e=r.data)?void 0:e.data)&&(void 0===a?"undefined":a&&"u">typeof Symbol&&a.constructor===Symbol?"symbol":typeof a)=="object"&&"string"==typeof a.uid&&a.uid.length>0&&("no-code"===a.portalType||"ai"===a.portalType)&&"string"==typeof a.routePath&&a.routePath.trim().length>0){if("no-code"===n.portalType&&!p.layoutManager.listLayouts().some(function(e){return e.uid===n.uid}))return window.location.replace("".concat((0,i.Q)(p)).concat(c(d))),[2];return v(n),[2]}return window.location.replace("".concat((0,i.Q)(p)).concat(c(d))),[3,3];case 2:if(o.sent(),!t)return[2];return window.location.replace("".concat((0,i.Q)(p)).concat(c(d))),[3,3];case 3:return[2]}})},function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function i(e){u(a,n,o,i,l,"next",e)}function l(e){u(a,n,o,i,l,"throw",e)}i(void 0)})})(),function(){t=!1}},[p,d,f]),(0,r.useEffect)(function(){if(y&&"ai"===y.portalType){var e="".concat((0,i.u)(p,y.routePath,y.portalType)).concat(c(d));b.current!==e&&(b.current=e,window.location.replace(e))}},[p,d,y]),y&&"ai"!==y.portalType)?n().createElement(a.Navigate,{replace:!0,to:{pathname:y.routePath,search:d.search,hash:d.hash}}):null}var f=y(337);function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function d(e,t,r,n,o,a,i){try{var l=e[a](i),u=l.value}catch(e){r(e);return}l.done?t(u):Promise.resolve(u).then(n,o)}function h(e){return function(e){if(Array.isArray(e))return p(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e){if(e){if("string"==typeof e)return p(e,void 0);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return p(e,void 0)}}(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var v=["action-panel","app-switcher"],b="main";function m(e){return e.title||e.routePath}function g(e){var t=new Set;return e.filter(function(e){return!t.has(e)&&(t.add(e),!0)})}function w(e,t,r){return e===b?r("Main application"):(null==t?void 0:t.title)||e}var P=y(624);function k(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 O(e,t,r,n,o,a,i){try{var l=e[a](i),u=l.value}catch(e){r(e);return}l.done?t(u):Promise.resolve(u).then(n,o)}function A(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function i(e){O(a,n,o,i,l,"next",e)}function l(e){O(a,n,o,i,l,"throw",e)}i(void 0)})}}function j(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 x(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 M(e,t){if(null==e)return{};var r,n,o,a={};if("u">typeof Reflect&&Reflect.ownKeys){for(o=0,r=Reflect.ownKeys(Object(e));o<r.length;o++)n=r[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n]);return a}if(a=function(e,t){if(null==e)return{};var r,n,o={},a=Object.getOwnPropertyNames(e);for(n=0;n<a.length;n++)r=a[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,t),Object.getOwnPropertySymbols)for(o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)n=r[o],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n]);return a}function E(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],i=!0,l=!1;try{for(o=o.call(e);!(i=(r=o.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){l=!0,n=e}finally{try{i||null==o.return||o.return()}finally{if(l)throw n}}return a}}(e,t)||_(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function R(e){return function(e){if(Array.isArray(e))return k(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_(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 C(e){return e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _(e,t){if(e){if("string"==typeof e)return k(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 k(e,t)}}function I(e,t){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=t.call(e,a)}catch(e){c=[6,e],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var q=Symbol("multiPortalRouteRepositoryState");function T(e){var t;return(null==(t=e.scopeStack[e.scopeStack.length-1])?void 0:t.scope)||{cacheKey:"admin-layout-model",uiLayoutUid:"admin-layout-model"}}function N(e){return e.getAPIClient()}function L(e){return"string"==typeof e.portalUid}function U(e){var t=e.children;return j({},(e.multiPortals,e.uiLayouts,M(e,["children","multiPortals","uiLayouts"])),Array.isArray(t)?{children:t.map(function(e){return U(e)})}:{})}function B(e,t,r){return A(function(){var n,o,a,i;return I(this,function(l){switch(l.label){case 0:return o=(r.refreshRequestIds.get(t.cacheKey)||0)+1,r.refreshRequestIds.set(t.cacheKey,o),[4,N(e).request({url:"/desktopRoutes:listAccessible",params:{tree:!0,sort:"sort",portal:t.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(t.cacheKey)===o&&e.setRoutes(i,t.cacheKey),[2,i]}})})()}function D(e,t,r,n,o,a,i){try{var l=e[a](i),u=l.value}catch(e){r(e);return}l.done?t(u):Promise.resolve(u).then(n,o)}function W(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var z="MultiPortalMobileLayoutModel",$=(W(e={},P.R$,{layoutModelClass:"MultiPortalDesktopLayoutModel"}),W(e,P.ig,{layoutModelClass:z,rootPageModelClass:"MultiPortalMobileRootPageModel",childPageModelClass:"MultiPortalMobileChildPageModel"}),e),G={layoutModelClass:z,rootPageModelClass:"MobileRootPageModel",childPageModelClass:"MobileChildPageModel"};function K(e){return"no-code"===(e.portalType||"no-code")}var F=y(625),H=y(59),X=y(235),Q=y(143);function J(e,t,r,n,o,a,i){try{var l=e[a](i),u=l.value}catch(e){r(e);return}l.done?t(u):Promise.resolve(u).then(n,o)}function Z(e){return(Z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function V(e,t){return(V=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Y(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Y=function(){return!!e})()}var ee=H.Typography.Text;function et(e){var t=e.controlHeightLG+e.paddingSM+e.paddingXXS,r=e.paddingLG-e.paddingXXS;return{avatarSize:t,cardHeight:t+2*r,gridMinColumnWidth:9*e.controlHeightLG,iconSize:e.fontSizeHeading3+e.marginXXS,paddingBlock:r}}var er=(0,X.createStyles)(function(e){var t=e.token;return{portalItem:{"&:hover":{background:t.colorBgTextHover,borderColor:t.colorBorder,boxShadow:t.boxShadowTertiary,color:t.colorText,transform:"translateY(-".concat(t.lineWidth,"px)")},"&:focus-visible":{outline:"".concat(t.controlOutlineWidth,"px solid ").concat(t.colorPrimaryBorder),outlineOffset:t.controlOutlineWidth},".ant-typography":{color:"inherit"}}}});function en(e){var t;return(null==(t=e.title)?void 0:t.trim())||e.uid}function eo(e){var r,o,a,i,l=e.record,u=e.token,c=et(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(H.Avatar,{shape:"square",size:c.avatarSize,style:f,icon:null},n().createElement(t.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(e,t){var r=0,n=!0,o=!1,a=void 0;try{for(var i,l=e[Symbol.iterator]();!(n=(i=l.next()).done);n=!0){var u=i.value;r=(31*r+u.charCodeAt(0))%0x7fffffff}}catch(e){o=!0,a=e}finally{try{n||null==l.return||l.return()}finally{if(o)throw a}}return Math.abs(r)%t}("".concat(l.uid,":").concat(l.title||""),r.length)];return n().createElement(H.Avatar,{"aria-hidden":!0,shape:"square",size:c.avatarSize,style:(o=function(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}({},f),a=a={background:p.background,color:p.color,fontWeight:u.fontWeightStrong},Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(a)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(a)).forEach(function(e){Object.defineProperty(o,e,Object.getOwnPropertyDescriptor(a,e))}),o)},(en(l).trim()[0]||"P").toUpperCase())}function ea(e){var t=e.model,o=H.theme.useToken().token,a=er().styles,l=(0,r.useMemo)(function(){return et(o)},[o]),u=t.context.app,c=t.translate,s=(0,F.useRequest)(function(){var e;return(e=function(){var e,t,r;return function(e,t){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=t.call(e,a)}catch(e){c=[6,e],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==(e=u.apiClient)?void 0:e.request({url:"multiPortals:listAccessible",method:"get",skipNotify:!0})];case 1:return[2,Array.isArray(null==(r=n.sent())||null==(t=r.data)?void 0:t.data)?r.data.data:[]]}})},function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function i(e){J(a,n,o,i,l,"next",e)}function l(e){J(a,n,o,i,l,"throw",e)}i(void 0)})})()}),f=s.data,p=s.error,d=s.loading,h=null!=f?f:[],y=(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]),v=(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(H.Alert,{type:"warning",message:c("Failed to load portals"),showIcon:!0}):d?n().createElement("div",{style:{minHeight:l.cardHeight}}):0===h.length?n().createElement(H.Empty,{image:H.Empty.PRESENTED_IMAGE_SIMPLE,description:c("No portals")}):n().createElement("div",{"data-testid":"multi-portal-block-grid",style:y},h.map(function(e){var t=en(e);return n().createElement("a",{key:e.uid,href:(0,i.u)(u,e.routePath,e.portalType),target:"_blank",rel:"noopener noreferrer","data-testid":"multi-portal-block-card",className:a.portalItem,style:v},n().createElement(eo,{record:e,token:o}),n().createElement(ee,{strong:!0,ellipsis:!0,style:{flex:1,fontSize:o.fontSizeLG,lineHeight:o.lineHeightLG,marginBottom:0,minWidth:0},title:t},t))}))}var ei=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=Z(e),function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,Y()?Reflect.construct(e,t||[],Z(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&V(r,e),t=[{key:"renderComponent",value:function(){return n().createElement(ea,{model:this})}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(r.prototype,t),r}(t.BlockModel);ei.define({label:(0,Q.MZ)("Portals"),hide:!0,createModelOptions:{use:"MultiPortalBlockModel",stepParams:{cardSettings:{titleDescription:{title:(0,Q.MZ)("Portals")}}}},sort:600});var el=y(742);function eu(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 ec(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function es(e){return e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var ef=new Set(["admin","forgot-password","reset-password","settings","signin","signup"]);function ep(e){return"string"==typeof e&&e.trim()?e.trim():void 0}function ed(e){var t=e.split(/[?#]/,1)[0]||"/",r="/".concat(t.replace(/^\/+|\/+$/g,""));return"/"===r?r:r.replace(/\/+$/g,"")}function eh(e){return e.enabled&&"no-code"===(e.portalType||"no-code")}function ey(e,t){return"".concat(e,"\0").concat(t||"")}var ev=function(){var e;function t(e){var r=this;if(!(this instanceof t))throw TypeError("Cannot call a class as a function");ec(this,"apiClient",void 0),ec(this,"getCurrentPathname",void 0),ec(this,"getBasename",void 0),ec(this,"recordsByUid",new Map),ec(this,"records",[]),ec(this,"recordsLoaded",!1),ec(this,"generations",new Map),ec(this,"states",new Map),ec(this,"listeners",new Set),ec(this,"snapshot",null),ec(this,"requestInterceptor",void 0),ec(this,"responseInterceptor",void 0),ec(this,"subscribe",function(e){return r.listeners.add(e),function(){r.listeners.delete(e)}}),ec(this,"getSnapshot",function(){return r.snapshot}),this.apiClient=e.apiClient,this.getCurrentPathname=e.getCurrentPathname,this.getBasename=e.getBasename||function(){}}return e=[{key:"setRecords",value:function(e){this.records=e.filter(eh),this.records.sort(function(e,t){return ed(t.routePath).length-ed(e.routePath).length}),this.recordsByUid.clear();var t=!0,r=!1,n=void 0;try{for(var o,a=this.records[Symbol.iterator]();!(t=(o=a.next()).done);t=!0){var i=o.value;this.recordsByUid.set(i.uid,i)}}catch(e){r=!0,n=e}finally{try{t||null==a.return||a.return()}finally{if(r)throw n}}this.recordsLoaded=!0,this.emit()}},{key:"getPortalByUid",value:function(e){return this.recordsByUid.get(e)}},{key:"resolvePortal",value:function(){var e,t,r,n,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getCurrentPathname(),a=(e=this.getBasename(),t=ed(o),"/"===(r=ed(e||"/"))?t:t===r?"/":t.startsWith("".concat(r,"/"))?ed(t.slice(r.length)):t),i=this.records.find(function(e){var t,r,n;return t=e.routePath,(r=ed(a))===(n=ed(t))||r.startsWith("".concat(n,"/"))});if(i||this.recordsLoaded)return i;var l=(function(e){if(Array.isArray(e))return e}(n=a.replace(/^\/+/,"").split("/"))||function(e){var t,r,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],a=!0,i=!1;try{for(n=n.call(e);!(a=(t=n.next()).done)&&(o.push(t.value),1!==o.length);a=!0);}catch(e){i=!0,r=e}finally{try{a||null==n.return||n.return()}finally{if(i)throw r}}return o}}(n)||function(e){if(e){if("string"==typeof e)return eu(e,1);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return eu(e,1)}}(n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0];if(!(!l||ef.has(l))&&/^[a-z0-9][a-z0-9_-]*$/.test(l))return{uid:l,portalName:l,routePath:"/".concat(l),authCheck:!0,enabled:!0,portalType:"no-code"}}},{key:"install",value:function(){var e=this;void 0===this.requestInterceptor&&void 0===this.responseInterceptor&&(this.requestInterceptor=this.apiClient.axios.interceptors.request.use(function(t){var r,n,o="string"==typeof(r=t.url)&&/^(?:https?:)?\/\//i.test(r.trim())?void 0:e.resolvePortal(),a=el.AxiosHeaders.from(t.headers);if(o?a.set("X-Portal",o.portalName):a.delete("X-Portal"),t.headers=a,(null==o?void 0:o.authCheck)!==!1&&"string"==typeof(n=t.url)&&"roles:check"===n.split(/[?#]/,1)[0].replace(/^\/+/,"")){var i=ep(e.apiClient.auth.role),l=ey(o.portalName,i),u=(e.generations.get(l)||0)+1,c={generation:u,portalName:o.portalName,requestedRole:i};e.generations.set(l,u),t.__multiPortalAccess=c,e.setState(l,{generation:u,portalName:o.portalName,requestedRole:i,role:i,status:"checking"})}return t}),this.responseInterceptor=this.apiClient.axios.interceptors.response.use(function(t){var r=t.config.__multiPortalAccess;if(r&&e.isLatest(r)){var n=function(e){if(e&&(void 0===e?"undefined":es(e))==="object"){var t=e.data;if(t&&(void 0===t?"undefined":es(t))==="object")return ep(t.role)}}(t.data)||r.requestedRole,o={generation:r.generation,portalName:r.portalName,requestedRole:r.requestedRole,role:n,status:"allowed"};e.setResolvedState(r,o)}return t},function(t){var r,n,o,a=(null==(n=t.response)||null==(r=n.config)?void 0:r.__multiPortalAccess)||(null==(o=t.config)?void 0:o.__multiPortalAccess);if(a&&e.isLatest(a)){var i=function(e,t){var r=e.response;if((null==r?void 0:r.status)===403&&r.data&&"object"===es(r.data)){var n=r.data;if((Array.isArray(n.errors)?n.errors:[]).find(function(e){return!!e&&(void 0===e?"undefined":es(e))==="object"&&"PORTAL_ACCESS_DENIED"===e.code})&&n.data&&"object"===es(n.data)){var o=n.data;if(o.portalName===t)return{portalName:t,role:ep(o.role),roles:Array.isArray(o.roles)?o.roles.filter(function(e){return"string"==typeof e}):void 0,roleMode:"string"==typeof o.roleMode?o.roleMode:void 0,allowAnonymous:"boolean"==typeof o.allowAnonymous?o.allowAnonymous:void 0}}}}(t,a.portalName),l=i?{denied:i,generation:a.generation,portalName:a.portalName,requestedRole:a.requestedRole,role:i.role||a.requestedRole,status:"denied"}:{generation:a.generation,portalName:a.portalName,requestedRole:a.requestedRole,role:a.requestedRole,status:"error"};e.setResolvedState(a,l)}return Promise.reject(t)}))}},{key:"dispose",value:function(){void 0!==this.requestInterceptor&&(this.apiClient.axios.interceptors.request.eject(this.requestInterceptor),this.requestInterceptor=void 0),void 0!==this.responseInterceptor&&(this.apiClient.axios.interceptors.response.eject(this.responseInterceptor),this.responseInterceptor=void 0)}},{key:"getAccessState",value:function(e,t){var r,n=ep(t),o=this.states.get(ey(e,n));return o||((null==(r=this.snapshot)?void 0:r.portalName)!==e||this.snapshot.requestedRole&&this.snapshot.role!==n?{generation:0,portalName:e,requestedRole:n,role:n,status:"checking"}:this.snapshot)}},{key:"needsCheck",value:function(e,t){var r,n=ep(t);return!this.states.has(ey(e,n))&&!((null==(r=this.snapshot)?void 0:r.portalName)===e&&(!this.snapshot.requestedRole||this.snapshot.role===n))}},{key:"invalidate",value:function(e,t){var r=ep(t),n=ey(e,r),o=(this.generations.get(n)||0)+1;this.generations.set(n,o);var a={generation:o,portalName:e,requestedRole:r,role:r,status:"checking"};this.states.set(n,a),this.snapshot=a,this.emit()}},{key:"checkAccess",value:function(){return this.apiClient.request({url:"roles:check",skipAuth:!0,skipNotify:!0})}},{key:"isLatest",value:function(e){return this.generations.get(ey(e.portalName,e.requestedRole))===e.generation}},{key:"setResolvedState",value:function(e,t){var r;this.states.set(ey(e.portalName,e.requestedRole),t),t.role&&t.role!==e.requestedRole&&this.states.set(ey(e.portalName,t.role),t),(null==(r=this.resolvePortal())?void 0:r.portalName)===e.portalName&&(this.snapshot=t),this.emit()}},{key:"setState",value:function(e,t){var r;this.states.set(e,t),(null==(r=this.resolvePortal())?void 0:r.portalName)===t.portalName&&(this.snapshot=t),this.emit()}},{key:"emit",value:function(){var e=!0,t=!1,r=void 0;try{for(var n,o=this.listeners[Symbol.iterator]();!(e=(n=o.next()).done);e=!0)(0,n.value)()}catch(e){t=!0,r=e}finally{try{e||null==o.return||o.return()}finally{if(t)throw r}}}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),t}();function eb(e,t,r,n,o,a,i){try{var l=e[a](i),u=l.value}catch(e){r(e);return}l.done?t(u):Promise.resolve(u).then(n,o)}function em(e,t,r){return(em=eP()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&ew(o,r.prototype),o}).apply(null,arguments)}function eg(e){return(eg=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ew(e,t){return(ew=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function eS(e){var t="function"==typeof Map?new Map:void 0;return(eS=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return em(e,arguments,eg(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),ew(r,e)})(e)}function eP(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eP=function(){return!!e})()}var ek=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=eg(e),function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,eP()?Reflect.construct(e,t||[],eg(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&ew(r,e),t=[{key:"load",value:function(){var e;return(e=function(){var e,t,r,a,i;return function(e,t){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=t.call(e,a)}catch(e){c=[6,e],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(l){var u,c,p,S,k;switch(l.label){case 0:if(e=this,t=String(this.t("Portal manager")),this.app.flowEngine.registerModels({MultiPortalBlockModel:ei}),this.app.flowEngine.registerModelLoaders({MultiPortalDesktopLayoutModel:{loader:function(){return y.e("993").then(y.bind(y,984))}},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:t,icon:"PartitionOutlined",aclSnippet:"pm.multi-portal",showTabs:!0,sort:-300}),this.pluginSettingsManager.addPageTabItem({menuKey:"multi-portal",key:"index",title:t,aclSnippet:"pm.multi-portal",componentLoader:function(){return y.e("556").then(y.bind(y,524))}}),!function(e,t){var r,n=e.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(t("Portals")),sort:22,componentLoader:function(){return y.e("778").then(y.bind(y,177))}})}}(this.app,function(t){return e.t(t)}),!function(e,t){if(e.entryActionManager){var r=(0,f.G)(e),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;e.entryActionManager.register("multi-portal:portals:".concat(u),{scope:u,sort:200,provider:function(){return(function(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function i(e){d(a,n,o,i,l,"next",e)}function l(e){d(a,n,o,i,l,"throw",e)}i(void 0)})}})(function(){var e,n,o,a,i,l,u;return function(e,t){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=t.call(e,a)}catch(e){c=[6,e],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=(e=c.sent()).portals).length<=1)return[2,[]];return o=new Map(e.apps.map(function(e){return[e.name,e]})),a=function(e){var t=new Map,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,u=m(l);t.set(u,(t.get(u)||0)+1)}}catch(e){n=!0,o=e}finally{try{r||null==i.return||i.return()}finally{if(n)throw o}}return t}(n),s=e.apps,i=s.length>0||g(n.map(function(e){return e.appName})).length>1,l=function(e,r){var o=function(e,t,r){var n=m(e);return t.some(function(t){return t!==e&&t.appName===e.appName&&m(t)===n&&t.layout!==e.layout})?"".concat(n," (").concat(r("mobile"===e.layout?"Mobile":"Desktop"),")"):n}(e,n,t),l=i||(a.get(m(e))||0)>1?function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:m(e),o=w(e.appName,t,r);return o?"".concat(o," / ").concat(n):n}(e,r,t,o):o,u=function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:m(e),o=w(e.appName,t,r);return o?"".concat(o," / ").concat(n):n}(e,r,t,o);return{key:"multi-portal:portal:".concat(e.appName,":").concat(e.uid||e.routePath),label:o,createModelOptions:{use:"PortalEntryActionModel",props:{title:l,icon:e.icon||"PartitionOutlined",entryPortalTitle:l,entryPortalTargetTitle:u,entryPortal:e,entryPortalApp:r}}}},u=i?(function(e,t){var r=g(t.map(function(e){return e.appName})),n=e.map(function(e){return e.name});return g(h(r.includes(b)?[b]:[]).concat(h(n),h(r)))})(e.apps,n).map(function(e){var r=o.get(e),a=n.filter(function(t){return t.appName===e});return a.length?{key:"multi-portal:app:".concat(e),label:w(e,r,t),children:a.map(function(e){return l(e,r)})}:null}).filter(function(e){return!!e}):n.map(function(e){return l(e,o.get(e.appName))}),[2,u.length?[{key:"multi-portal:portals",label:t("Portals"),children:u}]:[]]}})})()}})}}catch(e){o=!0,a=e}finally{try{n||null==l.return||l.return()}finally{if(o)throw a}}}}(this.app,function(t){return String(e.t(t))}),"settings."===this.pluginSettingsManager.getRouteName(""))return[2];(r=new ev({apiClient:this.app.apiClient,getBasename:function(){return e.app.router.getBasename()},getCurrentPathname:function(){return function(e){var t,r;try{var n,o,a=null==(o=e.router.state)||null==(n=o.location)?void 0:n.pathname;if(a)return a}catch(e){}return(null==(r=globalThis.window)||null==(t=r.location)?void 0:t.pathname)||"/"}(e.app)}})).install(),this.app.use(o.oM,{controller:r}),a=!1,this.router.add("root",{path:"/",Component:function(){return n().createElement(s,{runtimeRegistrationFailed:a})},authCheck:!1,skipAuthCheck:!0}),l.label=1;case 1:return l.trys.push([1,3,,4]),[4,(u=this.app.apiClient,(c=function(){var e,t,r;return function(e,t){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=t.call(e,a)}catch(e){c=[6,e],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,u.request({url:"multiPortals:listEnabled",method:"get",skipAuth:!0,skipNotify:!0})];case 1:if(!Array.isArray(r=null==(t=n.sent())||null==(e=t.data)?void 0:e.data))throw Error("multiPortals:listEnabled returned an invalid response");return[2,r]}})},function(){var e=this,t=arguments;return new Promise(function(r,n){var o=c.apply(e,t);function a(e){D(o,r,n,a,i,"next",e)}function i(e){D(o,r,n,a,i,"throw",e)}a(void 0)})})())];case 2:return i=l.sent(),p=this.app,S=new Set(function(e,t){var r=[],n=new Set(e.listLayouts().map(function(e){return e.uid})),o=new Set,a=new Set,i=new Set,l=!0,u=!1,c=void 0;try{for(var s,f=t[Symbol.iterator]();!(l=(s=f.next()).done);l=!0){var p=s.value;if(p.enabled&&K(p)){var d=function(e){if(!e.enabled||!K(e))return null;var t,r,n,o=e.uiLayoutUid||"";if(!(0,P.Cn)(o))return null;var a=o===P.ig&&e.uid===P.Jx?G:(0,P.Cn)(o)?$[o]:void 0;return a?(r=function(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){W(e,t,r[t])})}return e}({routeName:(t=e.uid,"".concat("multiPortalLayout_").concat(encodeURIComponent(t).replace(/\./g,"%2E"))),routePath:e.routePath,uid:e.uid},a),n=n={authCheck:e.authCheck},Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(n)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(n,e))}),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)||e.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(e){u=!0,c=e}finally{try{l||null==f.return||f.return()}finally{if(u)throw c}}var h=[],y=!0,v=!1,b=void 0;try{for(var m,g=r[Symbol.iterator]();!(y=(m=g.next()).done);y=!0){var w=m.value,S=w.options,k=w.record;e.registerLayout(S),h.push(k.uid)}}catch(e){v=!0,b=e}finally{try{y||null==g.return||g.return()}finally{if(v)throw b}}return h}(p.layoutManager,i)),k=i.filter(function(e){return S.has(e.uid)}).map(function(e){var t;return{cacheKey:(t=e.uid,"".concat("portal:").concat(t)),portalUid:e.uid}}),function(e,t){if(e&&(void 0===e?"undefined":C(e))==="object"){if(e[q]){e[q].portalScopes=t;return}var r=N(e),n={loadingPromises:new Map,layoutScopes:new Map,originalActivateLayout:e.activateLayout.bind(e),originalApiRequest:r.request.bind(r),originalCreateRoute:e.createRoute.bind(e),originalDeleteRoute:e.deleteRoute.bind(e),originalEnsureAccessibleLoaded:e.ensureAccessibleLoaded.bind(e),originalMoveRoute:e.moveRoute.bind(e),originalRefreshAccessible:e.refreshAccessible.bind(e),originalUpdateRoute:e.updateRoute.bind(e),portalScopes:t,refreshRequestIds:new Map,scopeStack:[]};e[q]=n,r.request=function(e){return n.originalApiRequest(function(e,t){var r,n=T(t);if(!n.portalUid||!("string"==typeof e.url&&e.url.replace(/^\/+/,"").startsWith("desktopRoutes:")))return e;var o=(r=e.params)&&(void 0===r?"undefined":C(r))==="object"&&!Array.isArray(r)?j({},e.params):{};return delete o.layout,delete o.portal,x(j({},e),{params:x(j({},o),{portal:n.portalUid})})}(e,n))},e.activateLayout=function(e){var t,r,o,a,i,l,u=(t="string"==typeof(l=null==e?void 0:e.uid)&&l.trim()?l:"admin-layout-model",r=n.portalScopes,o=n.layoutScopes,(i=(a=new Map(r().filter(function(e){return"string"==typeof(null==e?void 0:e.portalUid)&&!!e.portalUid.trim()&&"string"==typeof e.cacheKey&&!!e.cacheKey.trim()}).map(function(e){return[e.portalUid,e]}))).get(t))||function(e,t,r){var n=new Set(R(t.values()).map(function(e){return e.cacheKey})),o=new Set(R(r.entries()).filter(function(t){return E(t,1)[0]!==e}).map(function(e){return E(e,2)[1].cacheKey})),a=r.get(e);if(a&&!n.has(a.cacheKey)&&!o.has(a.cacheKey))return a;for(var i=e;n.has(i)||o.has(i);)i="layout:".concat(i);var l={cacheKey:i,uiLayoutUid:e};return r.set(e,l),l}(t,a,o)),c=Symbol("multi-portal-route-scope"),s=n.originalActivateLayout(x(j({},e),{uid:u.cacheKey}));return n.scopeStack.push({deactivate:s,scope:u,token:c}),function(){var e=n.scopeStack.findIndex(function(e){return e.token===c});e>=0&&n.scopeStack.splice(e,1),s()}},e.refreshAccessible=function(){return A(function(){var t;return I(this,function(r){return L(t=T(n))?[2,B(e,t,n)]:[2,n.originalRefreshAccessible()]})})()},e.ensureAccessibleLoaded=function(){return A(function(){var t,r,o;return I(this,function(a){return L(t=T(n))?e.isAccessibleLoaded()?[2,e.listAccessible()]:(r=n.loadingPromises.get(t.cacheKey))?[2,r]:(o=B(e,t,n).finally(function(){n.loadingPromises.get(t.cacheKey)===o&&n.loadingPromises.delete(t.cacheKey)}),n.loadingPromises.set(t.cacheKey,o),[2,o]):[2,n.originalEnsureAccessibleLoaded()]})})()},e.createRoute=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return A(function(){var o,a,i,l;return I(this,function(u){switch(u.label){case 0:if(!(o=T(n)).portalUid)return[2,n.originalCreateRoute(t,r)];return i=void 0===(a=r.refreshAfterMutation)||a,[4,N(e).resource("desktopRoutes").create({values:U(t),portal:o.portalUid})];case 1:if(l=u.sent(),!i)return[3,3];return[4,e.refreshAccessible()];case 2:u.sent(),u.label=3;case 3:return[2,l]}})})()},e.updateRoute=function(t,r){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return A(function(){var a,i,l,u,c;return I(this,function(s){switch(s.label){case 0:if(!(a=T(n)).portalUid)return[2,n.originalUpdateRoute(t,r,o)];return l=void 0===(i=o.refreshAfterMutation)||i,u=U(r),[4,N(e).resource("desktopRoutes").update(Array.isArray(t)?{filter:{id:{$in:t}},values:u,portal:a.portalUid}:{filterByTk:t,values:u,portal:a.portalUid})];case 1:if(c=s.sent(),!l)return[3,3];return[4,e.refreshAccessible()];case 2:s.sent(),s.label=3;case 3:return[2,c]}})})()},e.deleteRoute=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return A(function(){var o,a,i,l;return I(this,function(u){switch(u.label){case 0:if(!(o=T(n)).portalUid)return[2,n.originalDeleteRoute(t,r)];return i=void 0===(a=r.refreshAfterMutation)||a,[4,N(e).resource("desktopRoutes").destroy({filterByTk:t,portal:o.portalUid})];case 1:if(l=u.sent(),!i)return[3,3];return[4,e.refreshAccessible()];case 2:u.sent(),u.label=3;case 3:return[2,l]}})})()},e.moveRoute=function(t){return A(function(){var r,o,a,i,l;return I(this,function(u){switch(u.label){case 0:if(!(r=T(n)).portalUid)return[2,n.originalMoveRoute(t)];return a=void 0===(o=t.refreshAfterMove)||o,i=M(t,["refreshAfterMove"]),[4,N(e).resource("desktopRoutes").move(x(j({},i),{portal:r.portalUid}))];case 1:if(l=u.sent(),!a)return[3,3];return[4,e.refreshAccessible()];case 2:u.sent(),u.label=3;case 3:return[2,l]}})})()}}}(function(e){if(null==(t=e.context)?void 0:t.routeRepository)return e.context.routeRepository;var t,r,n=null==(r=e.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}(p),function(){return k}),r.setRecords(i),!function(e,t){if(e&&("function"==typeof e.registerAuthRouteScope||"function"==typeof e.registerSignInRoute)){var r=!0,n=!1,o=void 0;try{for(var a,i=t[Symbol.iterator]();!(r=(a=i.next()).done);r=!0){var l,u=a.value;if(u.enabled&&"no-code"===(u.portalType||"no-code")){var c=encodeURIComponent(u.uid).replace(/\./g,"%2E"),s="multiPortal_".concat(c),f="multiPortalSignin_".concat(c);"function"==typeof e.registerAuthRouteScope?e.registerAuthRouteScope(s,u.routePath,{signin:f,signup:"multiPortalSignup_".concat(c)}):null==(l=e.registerSignInRoute)||l.call(e,f,"".concat(u.routePath.replace(/\/+$/g,""),"/signin"))}}}catch(e){n=!0,o=e}finally{try{r||null==i.return||i.return()}finally{if(n)throw o}}}}(this.app.pm.get("@nocobase/plugin-auth"),i),[3,4];case 3:return console.error("[NocoBase] Failed to register multi-portals.",l.sent()),r.setRecords([]),a=!0,[3,4];case 4:return[2]}})},function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function i(e){eb(a,n,o,i,l,"next",e)}function l(e){eb(a,n,o,i,l,"throw",e)}i(void 0)})}).call(this)}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(r.prototype,t),r}(eS(t.Plugin))}(),S}()});
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
import type { Application } from '@nocobase/client-v2';
|
|
10
|
+
import type { MultiPortalRuntimeRecord } from './layoutRegistration';
|
|
11
|
+
export declare function getPortalPathname(pathname: string, publicPath: string): string;
|
|
12
|
+
export declare function getPortalNameForPathname(pathname: string, records: MultiPortalRuntimeRecord[]): string;
|
|
13
|
+
export declare function installMultiPortalRequestInterceptor(apiClient: Pick<Application['apiClient'], 'axios'>, records: MultiPortalRuntimeRecord[], getPathname?: () => string): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
import { AdminLayoutModel } from '@nocobase/client-v2';
|
|
10
|
+
import React from 'react';
|
|
11
|
+
export declare class MultiPortalDesktopLayoutModel extends AdminLayoutModel {
|
|
12
|
+
render(): React.JSX.Element;
|
|
13
|
+
}
|
|
14
|
+
export default MultiPortalDesktopLayoutModel;
|
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { ChildPageTabModel, RootPageTabModel } from '@nocobase/client-v2';
|
|
10
10
|
import { MobileChildPageModel, MobileLayoutModel, MobileRootPageModel } from '@nocobase/plugin-ui-layout/client-v2';
|
|
11
|
+
import React from 'react';
|
|
11
12
|
export declare class MultiPortalMobileLayoutModel extends MobileLayoutModel {
|
|
13
|
+
render(): React.JSX.Element;
|
|
12
14
|
}
|
|
13
15
|
export declare class MultiPortalMobileRootPageModel extends MobileRootPageModel {
|
|
14
16
|
constructor(options: ConstructorParameters<typeof MobileRootPageModel>[0]);
|
|
@@ -0,0 +1,73 @@
|
|
|
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
|
+
import { type AxiosInstance, type AxiosRequestConfig, type AxiosResponse } from 'axios';
|
|
10
|
+
import type { MultiPortalRuntimeRecord } from './layoutRegistration';
|
|
11
|
+
export declare const PORTAL_ACCESS_DENIED_CODE = "PORTAL_ACCESS_DENIED";
|
|
12
|
+
export type PortalRoleMode = 'default' | 'allow-use-union' | 'only-use-union' | string;
|
|
13
|
+
export type PortalAccessDeniedContext = {
|
|
14
|
+
portalName: string;
|
|
15
|
+
role?: string;
|
|
16
|
+
roles?: string[];
|
|
17
|
+
roleMode?: PortalRoleMode;
|
|
18
|
+
allowAnonymous?: boolean;
|
|
19
|
+
};
|
|
20
|
+
export type PortalAccessState = {
|
|
21
|
+
status: 'checking' | 'allowed' | 'denied' | 'error';
|
|
22
|
+
portalName: string;
|
|
23
|
+
role?: string;
|
|
24
|
+
requestedRole?: string;
|
|
25
|
+
generation: number;
|
|
26
|
+
denied?: PortalAccessDeniedContext;
|
|
27
|
+
};
|
|
28
|
+
type PortalAccessAuth = {
|
|
29
|
+
role?: string | null;
|
|
30
|
+
setRole: (role: string | null) => void;
|
|
31
|
+
};
|
|
32
|
+
export type PortalAccessApiClient = {
|
|
33
|
+
axios: AxiosInstance;
|
|
34
|
+
auth: PortalAccessAuth;
|
|
35
|
+
request: (config: AxiosRequestConfig) => Promise<AxiosResponse<unknown>>;
|
|
36
|
+
resource: (name: string) => unknown;
|
|
37
|
+
};
|
|
38
|
+
type PortalAccessControllerOptions = {
|
|
39
|
+
apiClient: PortalAccessApiClient;
|
|
40
|
+
getCurrentPathname: () => string;
|
|
41
|
+
getBasename?: () => string | undefined;
|
|
42
|
+
};
|
|
43
|
+
export declare class PortalAccessController {
|
|
44
|
+
private readonly apiClient;
|
|
45
|
+
private readonly getCurrentPathname;
|
|
46
|
+
private readonly getBasename;
|
|
47
|
+
private readonly recordsByUid;
|
|
48
|
+
private records;
|
|
49
|
+
private recordsLoaded;
|
|
50
|
+
private readonly generations;
|
|
51
|
+
private readonly states;
|
|
52
|
+
private readonly listeners;
|
|
53
|
+
private snapshot;
|
|
54
|
+
private requestInterceptor?;
|
|
55
|
+
private responseInterceptor?;
|
|
56
|
+
constructor(options: PortalAccessControllerOptions);
|
|
57
|
+
setRecords(records: MultiPortalRuntimeRecord[]): void;
|
|
58
|
+
getPortalByUid(uid: string): MultiPortalRuntimeRecord;
|
|
59
|
+
resolvePortal(pathname?: string): MultiPortalRuntimeRecord;
|
|
60
|
+
install(): void;
|
|
61
|
+
dispose(): void;
|
|
62
|
+
getAccessState(portalName: string, role?: string | null): PortalAccessState;
|
|
63
|
+
needsCheck(portalName: string, role?: string | null): boolean;
|
|
64
|
+
invalidate(portalName: string, role?: string | null): void;
|
|
65
|
+
checkAccess(): Promise<AxiosResponse<unknown, any>>;
|
|
66
|
+
subscribe: (listener: () => void) => () => void;
|
|
67
|
+
getSnapshot: () => PortalAccessState;
|
|
68
|
+
private isLatest;
|
|
69
|
+
private setResolvedState;
|
|
70
|
+
private setState;
|
|
71
|
+
private emit;
|
|
72
|
+
}
|
|
73
|
+
export {};
|
package/dist/externalVersion.js
CHANGED
|
@@ -8,19 +8,20 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/flow-engine": "3.0.0-alpha.
|
|
12
|
-
"@nocobase/client": "3.0.0-alpha.
|
|
13
|
-
"@nocobase/client-v2": "3.0.0-alpha.
|
|
11
|
+
"@nocobase/flow-engine": "3.0.0-alpha.8",
|
|
12
|
+
"@nocobase/client": "3.0.0-alpha.8",
|
|
13
|
+
"@nocobase/client-v2": "3.0.0-alpha.8",
|
|
14
|
+
"antd": "5.24.2",
|
|
14
15
|
"react": "18.2.0",
|
|
15
16
|
"react-router-dom": "6.30.1",
|
|
16
|
-
"
|
|
17
|
-
"@nocobase/
|
|
18
|
-
"@nocobase/
|
|
19
|
-
"@nocobase/
|
|
20
|
-
"
|
|
17
|
+
"axios": "1.7.7",
|
|
18
|
+
"@nocobase/database": "3.0.0-alpha.8",
|
|
19
|
+
"@nocobase/server": "3.0.0-alpha.8",
|
|
20
|
+
"@nocobase/resourcer": "3.0.0-alpha.8",
|
|
21
|
+
"@nocobase/utils": "3.0.0-alpha.8",
|
|
21
22
|
"ahooks": "3.7.8",
|
|
22
23
|
"antd-style": "3.7.1",
|
|
23
|
-
"@nocobase/plugin-ui-layout": "3.0.0-alpha.
|
|
24
|
+
"@nocobase/plugin-ui-layout": "3.0.0-alpha.8",
|
|
24
25
|
"@ant-design/icons": "5.6.1",
|
|
25
26
|
"sequelize": "6.35.2"
|
|
26
27
|
};
|
package/dist/locale/en-US.json
CHANGED
|
@@ -108,7 +108,6 @@
|
|
|
108
108
|
"If selected, the page will display Tab pages.": "If selected, the page will display Tab pages.",
|
|
109
109
|
"If selected, the route will be displayed in the menu.": "If selected, the route will be displayed in the menu.",
|
|
110
110
|
"Link": "Link",
|
|
111
|
-
"Managed by layout permissions": "Managed by layout permissions",
|
|
112
111
|
"Name": "Name",
|
|
113
112
|
"Page": "Page",
|
|
114
113
|
"Path": "Path",
|
|
@@ -132,7 +131,9 @@
|
|
|
132
131
|
"Users enter this portal by default when they open the application without specifying one.": "Users enter this portal by default when they open the application without specifying one.",
|
|
133
132
|
"Use multiPortals:setDefault to update the default Portal": "Use multiPortals:setDefault to update the default Portal",
|
|
134
133
|
"filterByTk is required": "filterByTk is required",
|
|
134
|
+
"Invalid Portal context": "Invalid Portal context",
|
|
135
135
|
"Portal not found": "Portal not found",
|
|
136
|
+
"You do not have access to this Portal": "You do not have access to this Portal",
|
|
136
137
|
"Disabled Portal cannot be set as default": "Disabled Portal cannot be set as default",
|
|
137
138
|
"Portal device configuration is invalid": "Portal device configuration is invalid",
|
|
138
139
|
"Unsupported Portal type cannot be set as default": "Unsupported Portal type cannot be set as default",
|
|
@@ -146,5 +147,18 @@
|
|
|
146
147
|
"Example:": "Example:",
|
|
147
148
|
"Shown on the portal card.": "Shown on the portal card.",
|
|
148
149
|
"Device": "Device",
|
|
149
|
-
"No-code portals render with the components of this device; AI portals use it for grouping.": "No-code portals render with the components of this device; AI portals use it for grouping."
|
|
150
|
+
"No-code portals render with the components of this device; AI portals use it for grouping.": "No-code portals render with the components of this device; AI portals use it for grouping.",
|
|
151
|
+
"Anonymous": "Anonymous",
|
|
152
|
+
"Checking Portal access": "Checking Portal access",
|
|
153
|
+
"Current role": "Current role",
|
|
154
|
+
"Failed to check Portal access": "Failed to check Portal access",
|
|
155
|
+
"Failed to switch role": "Failed to switch role",
|
|
156
|
+
"Full permissions": "Full permissions",
|
|
157
|
+
"No access to this Portal": "No access to this Portal",
|
|
158
|
+
"Please switch to a role that can access this Portal.": "Please switch to a role that can access this Portal.",
|
|
159
|
+
"Portal access will be checked again after switching.": "Portal access will be checked again after switching.",
|
|
160
|
+
"Retry": "Retry",
|
|
161
|
+
"Select role": "Select role",
|
|
162
|
+
"Switch role": "Switch role",
|
|
163
|
+
"Unable to verify whether the current role can access this Portal.": "Unable to verify whether the current role can access this Portal."
|
|
150
164
|
}
|
package/dist/locale/zh-CN.json
CHANGED
|
@@ -108,7 +108,6 @@
|
|
|
108
108
|
"If selected, the page will display Tab pages.": "勾选后,页面将显示标签页。",
|
|
109
109
|
"If selected, the route will be displayed in the menu.": "勾选后,路由会在菜单中显示。",
|
|
110
110
|
"Link": "链接",
|
|
111
|
-
"Managed by layout permissions": "沿用布局权限",
|
|
112
111
|
"Name": "名称",
|
|
113
112
|
"Page": "页面",
|
|
114
113
|
"Path": "路径",
|
|
@@ -132,7 +131,9 @@
|
|
|
132
131
|
"Users enter this portal by default when they open the application without specifying one.": "用户未指定门户访问应用时,将默认进入此门户。",
|
|
133
132
|
"Use multiPortals:setDefault to update the default Portal": "请使用 multiPortals:setDefault 更新默认门户",
|
|
134
133
|
"filterByTk is required": "filterByTk 为必填项",
|
|
134
|
+
"Invalid Portal context": "Portal 上下文无效",
|
|
135
135
|
"Portal not found": "门户不存在",
|
|
136
|
+
"You do not have access to this Portal": "您无权访问此 Portal",
|
|
136
137
|
"Disabled Portal cannot be set as default": "已禁用的门户不能设为默认",
|
|
137
138
|
"Portal device configuration is invalid": "门户设备配置无效",
|
|
138
139
|
"Unsupported Portal type cannot be set as default": "不支持的门户类型不能设为默认",
|
|
@@ -146,5 +147,18 @@
|
|
|
146
147
|
"Example:": "示例:",
|
|
147
148
|
"Shown on the portal card.": "显示在门户卡片上。",
|
|
148
149
|
"Device": "设备",
|
|
149
|
-
"No-code portals render with the components of this device; AI portals use it for grouping.": "无代码门户按此选择组件形态;AI 门户用它做归类。"
|
|
150
|
+
"No-code portals render with the components of this device; AI portals use it for grouping.": "无代码门户按此选择组件形态;AI 门户用它做归类。",
|
|
151
|
+
"Anonymous": "匿名用户",
|
|
152
|
+
"Checking Portal access": "正在检查门户访问权限",
|
|
153
|
+
"Current role": "当前角色",
|
|
154
|
+
"Failed to check Portal access": "门户访问权限检查失败",
|
|
155
|
+
"Failed to switch role": "切换角色失败",
|
|
156
|
+
"Full permissions": "全部权限",
|
|
157
|
+
"No access to this Portal": "无权访问此门户",
|
|
158
|
+
"Please switch to a role that can access this Portal.": "当前角色没有访问权限,请切换角色后重试。",
|
|
159
|
+
"Portal access will be checked again after switching.": "切换后将重新检查门户访问权限",
|
|
160
|
+
"Retry": "重试",
|
|
161
|
+
"Select role": "选择角色",
|
|
162
|
+
"Switch role": "切换角色",
|
|
163
|
+
"Unable to verify whether the current role can access this Portal.": "暂时无法确认当前角色是否有权访问此门户。"
|
|
150
164
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"author":"Isaac Z. Schlueter","name":"tar","description":"tar for node","version":"7.5.15","repository":{"type":"git","url":"https://github.com/isaacs/node-tar.git"},"scripts":{"genparse":"node scripts/generate-parse-fixtures.js","snap":"tap","test":"tap","pretest":"npm run prepare","presnap":"npm run prepare","prepare":"tshy && bash scripts/build.sh","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags","format":"prettier --write . --log-level warn","typedoc":"typedoc --tsconfig .tshy/esm.json ./src/*.ts","lint":"oxlint --fix src test","postsnap":"npm run lint","postlint":"npm run format"},"dependencies":{"@isaacs/fs-minipass":"^4.0.0","chownr":"^3.0.0","minipass":"^7.1.2","minizlib":"^3.1.0","yallist":"^5.0.0"},"devDependencies":{"@types/node":"^25.5.0","chmodr":"^2.0.2","end-of-stream":"^1.4.3","esbuild":"^0.27.4","events-to-array":"^2.0.3","mutate-fs":"^2.1.1","nock":"^13.5.4","oxlint":"^1.57.0","oxlint-tsgolint":"^0.17.3","prettier":"^3.8.1","rimraf":"^6.1.2","tap":"^21.6.2","tshy":"^3.3.2","typedoc":"^0.28.18"},"license":"BlueOak-1.0.0","engines":{"node":">=18"},"files":["dist"],"tshy":{"exports":{"./package.json":"./package.json",".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.min.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.min.js"}},"./raw":"./src/index.ts","./c":"./src/create.ts","./create":"./src/create.ts","./replace":"./src/create.ts","./r":"./src/create.ts","./list":"./src/list.ts","./t":"./src/list.ts","./update":"./src/update.ts","./u":"./src/update.ts","./extract":"./src/extract.ts","./x":"./src/extract.ts","./pack":"./src/pack.ts","./unpack":"./src/unpack.ts","./parse":"./src/parse.ts","./read-entry":"./src/read-entry.ts","./write-entry":"./src/write-entry.ts","./header":"./src/header.ts","./pax":"./src/pax.ts","./types":"./src/types.ts"}},"exports":{"./package.json":"./package.json",".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.min.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.min.js"}},"./raw":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}},"./c":{"import":{"types":"./dist/esm/create.d.ts","default":"./dist/esm/create.js"},"require":{"types":"./dist/commonjs/create.d.ts","default":"./dist/commonjs/create.js"}},"./create":{"import":{"types":"./dist/esm/create.d.ts","default":"./dist/esm/create.js"},"require":{"types":"./dist/commonjs/create.d.ts","default":"./dist/commonjs/create.js"}},"./replace":{"import":{"types":"./dist/esm/create.d.ts","default":"./dist/esm/create.js"},"require":{"types":"./dist/commonjs/create.d.ts","default":"./dist/commonjs/create.js"}},"./r":{"import":{"types":"./dist/esm/create.d.ts","default":"./dist/esm/create.js"},"require":{"types":"./dist/commonjs/create.d.ts","default":"./dist/commonjs/create.js"}},"./list":{"import":{"types":"./dist/esm/list.d.ts","default":"./dist/esm/list.js"},"require":{"types":"./dist/commonjs/list.d.ts","default":"./dist/commonjs/list.js"}},"./t":{"import":{"types":"./dist/esm/list.d.ts","default":"./dist/esm/list.js"},"require":{"types":"./dist/commonjs/list.d.ts","default":"./dist/commonjs/list.js"}},"./update":{"import":{"types":"./dist/esm/update.d.ts","default":"./dist/esm/update.js"},"require":{"types":"./dist/commonjs/update.d.ts","default":"./dist/commonjs/update.js"}},"./u":{"import":{"types":"./dist/esm/update.d.ts","default":"./dist/esm/update.js"},"require":{"types":"./dist/commonjs/update.d.ts","default":"./dist/commonjs/update.js"}},"./extract":{"import":{"types":"./dist/esm/extract.d.ts","default":"./dist/esm/extract.js"},"require":{"types":"./dist/commonjs/extract.d.ts","default":"./dist/commonjs/extract.js"}},"./x":{"import":{"types":"./dist/esm/extract.d.ts","default":"./dist/esm/extract.js"},"require":{"types":"./dist/commonjs/extract.d.ts","default":"./dist/commonjs/extract.js"}},"./pack":{"import":{"types":"./dist/esm/pack.d.ts","default":"./dist/esm/pack.js"},"require":{"types":"./dist/commonjs/pack.d.ts","default":"./dist/commonjs/pack.js"}},"./unpack":{"import":{"types":"./dist/esm/unpack.d.ts","default":"./dist/esm/unpack.js"},"require":{"types":"./dist/commonjs/unpack.d.ts","default":"./dist/commonjs/unpack.js"}},"./parse":{"import":{"types":"./dist/esm/parse.d.ts","default":"./dist/esm/parse.js"},"require":{"types":"./dist/commonjs/parse.d.ts","default":"./dist/commonjs/parse.js"}},"./read-entry":{"import":{"types":"./dist/esm/read-entry.d.ts","default":"./dist/esm/read-entry.js"},"require":{"types":"./dist/commonjs/read-entry.d.ts","default":"./dist/commonjs/read-entry.js"}},"./write-entry":{"import":{"types":"./dist/esm/write-entry.d.ts","default":"./dist/esm/write-entry.js"},"require":{"types":"./dist/commonjs/write-entry.d.ts","default":"./dist/commonjs/write-entry.js"}},"./header":{"import":{"types":"./dist/esm/header.d.ts","default":"./dist/esm/header.js"},"require":{"types":"./dist/commonjs/header.d.ts","default":"./dist/commonjs/header.js"}},"./pax":{"import":{"types":"./dist/esm/pax.d.ts","default":"./dist/esm/pax.js"},"require":{"types":"./dist/commonjs/pax.d.ts","default":"./dist/commonjs/pax.js"}},"./types":{"import":{"types":"./dist/esm/types.d.ts","default":"./dist/esm/types.js"},"require":{"types":"./dist/commonjs/types.d.ts","default":"./dist/commonjs/types.js"}}},"type":"module","main":"./dist/commonjs/index.min.js","types":"./dist/commonjs/index.d.ts","module":"./dist/esm/index.min.js","_lastModified":"2026-08-
|
|
1
|
+
{"author":"Isaac Z. Schlueter","name":"tar","description":"tar for node","version":"7.5.15","repository":{"type":"git","url":"https://github.com/isaacs/node-tar.git"},"scripts":{"genparse":"node scripts/generate-parse-fixtures.js","snap":"tap","test":"tap","pretest":"npm run prepare","presnap":"npm run prepare","prepare":"tshy && bash scripts/build.sh","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags","format":"prettier --write . --log-level warn","typedoc":"typedoc --tsconfig .tshy/esm.json ./src/*.ts","lint":"oxlint --fix src test","postsnap":"npm run lint","postlint":"npm run format"},"dependencies":{"@isaacs/fs-minipass":"^4.0.0","chownr":"^3.0.0","minipass":"^7.1.2","minizlib":"^3.1.0","yallist":"^5.0.0"},"devDependencies":{"@types/node":"^25.5.0","chmodr":"^2.0.2","end-of-stream":"^1.4.3","esbuild":"^0.27.4","events-to-array":"^2.0.3","mutate-fs":"^2.1.1","nock":"^13.5.4","oxlint":"^1.57.0","oxlint-tsgolint":"^0.17.3","prettier":"^3.8.1","rimraf":"^6.1.2","tap":"^21.6.2","tshy":"^3.3.2","typedoc":"^0.28.18"},"license":"BlueOak-1.0.0","engines":{"node":">=18"},"files":["dist"],"tshy":{"exports":{"./package.json":"./package.json",".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.min.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.min.js"}},"./raw":"./src/index.ts","./c":"./src/create.ts","./create":"./src/create.ts","./replace":"./src/create.ts","./r":"./src/create.ts","./list":"./src/list.ts","./t":"./src/list.ts","./update":"./src/update.ts","./u":"./src/update.ts","./extract":"./src/extract.ts","./x":"./src/extract.ts","./pack":"./src/pack.ts","./unpack":"./src/unpack.ts","./parse":"./src/parse.ts","./read-entry":"./src/read-entry.ts","./write-entry":"./src/write-entry.ts","./header":"./src/header.ts","./pax":"./src/pax.ts","./types":"./src/types.ts"}},"exports":{"./package.json":"./package.json",".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.min.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.min.js"}},"./raw":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}},"./c":{"import":{"types":"./dist/esm/create.d.ts","default":"./dist/esm/create.js"},"require":{"types":"./dist/commonjs/create.d.ts","default":"./dist/commonjs/create.js"}},"./create":{"import":{"types":"./dist/esm/create.d.ts","default":"./dist/esm/create.js"},"require":{"types":"./dist/commonjs/create.d.ts","default":"./dist/commonjs/create.js"}},"./replace":{"import":{"types":"./dist/esm/create.d.ts","default":"./dist/esm/create.js"},"require":{"types":"./dist/commonjs/create.d.ts","default":"./dist/commonjs/create.js"}},"./r":{"import":{"types":"./dist/esm/create.d.ts","default":"./dist/esm/create.js"},"require":{"types":"./dist/commonjs/create.d.ts","default":"./dist/commonjs/create.js"}},"./list":{"import":{"types":"./dist/esm/list.d.ts","default":"./dist/esm/list.js"},"require":{"types":"./dist/commonjs/list.d.ts","default":"./dist/commonjs/list.js"}},"./t":{"import":{"types":"./dist/esm/list.d.ts","default":"./dist/esm/list.js"},"require":{"types":"./dist/commonjs/list.d.ts","default":"./dist/commonjs/list.js"}},"./update":{"import":{"types":"./dist/esm/update.d.ts","default":"./dist/esm/update.js"},"require":{"types":"./dist/commonjs/update.d.ts","default":"./dist/commonjs/update.js"}},"./u":{"import":{"types":"./dist/esm/update.d.ts","default":"./dist/esm/update.js"},"require":{"types":"./dist/commonjs/update.d.ts","default":"./dist/commonjs/update.js"}},"./extract":{"import":{"types":"./dist/esm/extract.d.ts","default":"./dist/esm/extract.js"},"require":{"types":"./dist/commonjs/extract.d.ts","default":"./dist/commonjs/extract.js"}},"./x":{"import":{"types":"./dist/esm/extract.d.ts","default":"./dist/esm/extract.js"},"require":{"types":"./dist/commonjs/extract.d.ts","default":"./dist/commonjs/extract.js"}},"./pack":{"import":{"types":"./dist/esm/pack.d.ts","default":"./dist/esm/pack.js"},"require":{"types":"./dist/commonjs/pack.d.ts","default":"./dist/commonjs/pack.js"}},"./unpack":{"import":{"types":"./dist/esm/unpack.d.ts","default":"./dist/esm/unpack.js"},"require":{"types":"./dist/commonjs/unpack.d.ts","default":"./dist/commonjs/unpack.js"}},"./parse":{"import":{"types":"./dist/esm/parse.d.ts","default":"./dist/esm/parse.js"},"require":{"types":"./dist/commonjs/parse.d.ts","default":"./dist/commonjs/parse.js"}},"./read-entry":{"import":{"types":"./dist/esm/read-entry.d.ts","default":"./dist/esm/read-entry.js"},"require":{"types":"./dist/commonjs/read-entry.d.ts","default":"./dist/commonjs/read-entry.js"}},"./write-entry":{"import":{"types":"./dist/esm/write-entry.d.ts","default":"./dist/esm/write-entry.js"},"require":{"types":"./dist/commonjs/write-entry.d.ts","default":"./dist/commonjs/write-entry.js"}},"./header":{"import":{"types":"./dist/esm/header.d.ts","default":"./dist/esm/header.js"},"require":{"types":"./dist/commonjs/header.d.ts","default":"./dist/commonjs/header.js"}},"./pax":{"import":{"types":"./dist/esm/pax.d.ts","default":"./dist/esm/pax.js"},"require":{"types":"./dist/commonjs/pax.d.ts","default":"./dist/commonjs/pax.js"}},"./types":{"import":{"types":"./dist/esm/types.d.ts","default":"./dist/esm/types.js"},"require":{"types":"./dist/commonjs/types.d.ts","default":"./dist/commonjs/types.js"}}},"type":"module","main":"./dist/commonjs/index.min.js","types":"./dist/commonjs/index.d.ts","module":"./dist/esm/index.min.js","_lastModified":"2026-08-10T06:31:54.674Z"}
|
package/dist/server/plugin.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ type AppPortalManifestItem = {
|
|
|
25
25
|
export declare class PluginMultiPortalServer extends Plugin {
|
|
26
26
|
private portalStorageTaskKeys;
|
|
27
27
|
private portalStorageTasks;
|
|
28
|
+
private deprecatedInitPortalEnvWarningEmitted;
|
|
28
29
|
afterAdd(): Promise<void>;
|
|
29
30
|
private getAppName;
|
|
30
31
|
private getCurrentStorageAppName;
|