@next-core/brick-container 3.17.11 → 3.17.13

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.
@@ -1,2 +0,0 @@
1
- "use strict";(globalThis.webpackChunk_next_core_brick_container=globalThis.webpackChunk_next_core_brick_container||[]).push([[114],{1396:(e,t,n)=>{n.r(t);var r=n(3647),o=n(7551),i=n(832),s=n(9462);n(1795),XMLHttpRequest.prototype.origOpen=XMLHttpRequest.prototype.open,XMLHttpRequest.prototype.open=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.origOpen.apply(this,t);const r=s.auth.getAuth().csrfToken;r&&this.setRequestHeader("X-CSRF-Token",r)};var a=n(2193);let c=function(e){return e.LOGIN_CHANGED="LOGIN_CHANGED",e.LOGOUT_APPLIED="LOGOUT_APPLIED",e}({});const l={[c.LOGIN_CHANGED]:"You have logged in as another account, click OK to refresh the page.",[c.LOGOUT_APPLIED]:"Your account has been logged out, click OK to refresh the page."},u={[c.LOGIN_CHANGED]:"您已经登录另一个账号,点击确定刷新页面。",[c.LOGOUT_APPLIED]:"您的账号已经登出,点击确定刷新页面。"},d="-/container",p={en:l,zh:u},f="brick-next:authentication-change";let h=!1;async function m(e,t){h||"logout"!==e.type&&("check-login"!==e.type||e.org===t.org&&e.username===t.username)||!(0,r.getRuntime)().getFeatureFlags()["refresh-page-if-authentication-changed"]||(h=!0,await r.Dialog.show({type:"warn",content:i.i18n.t(`${d}:${"logout"===e.type?c.LOGOUT_APPLIED:c.LOGIN_CHANGED}`)}),window.location.reload())}async function g(){if(!window.NO_AUTH_GUARD){const e=await(0,a.n)();e.loggedIn&&(s.auth.authenticate(e),async function(e){if(window.BroadcastChannel){const t=new BroadcastChannel(f);t.postMessage({type:"check-login",org:e.org,username:e.username}),t.addEventListener("message",(t=>{m(t.data,e)}))}else{const t=new(0,(await n.e(96).then(n.bind(n,706))).BroadcastChannel)(f);t.postMessage({type:"check-login",org:e.org,username:e.username}),t.addEventListener("message",(t=>{m(t,e)}))}}(e))}}var v=n(7773),y=n(3443),w=n(9663),b=n(4113),E=n(1030),S=n(1060),A=n(4408);function k(e,t,n){return{get(o){if(t)return`${(0,r.getBasePath)()}api/gateway/object_store.object_store.GetObject/api/v1/objectStore/bucket/next-builder/object/${o}`;let i=window.APP_ROOT?`${window.APP_ROOT}${window.BOOTSTRAP_UNION_FILE&&window.PUBLIC_DEPS?"":"-/"}`:"";return window.APP_ID&&window.APP_ID!==e&&(i=i.replace(new RegExp(`(^|/)${(0,E.escapeRegExp)(window.APP_ID)}/`),`$1${e}/`).replace(/\/\d+\.\d+\.\d+\//,`/${n}/`)),i.startsWith("/")||(i=(0,r.getBasePath)()+i),window.BOOTSTRAP_UNION_FILE&&window.PUBLIC_DEPS?`${i}images/${o}`:`${i}micro-apps/${e}/images/${o}`}}}let I=null,P=[];const O=new Map;async function T(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"0.0.0";if(O.has(e))return O.get(e);const n=(0,A.a)(e,{params:{version:t}}).catch((e=>{console.warn("request standalone runtime api from micro-app-standalone failed: ",e,", something might went wrong running standalone micro app")}));return O.set(e,n),n}function C(e){e.config=(0,b.deepFreeze)((0,E.merge)({},e.defaultConfig,e.userConfig))}function x(e){var t;const n=(null===(t=e.config)||void 0===t||null===(t=t.settings)||void 0===t?void 0:t.locales)??e.locales;if(n){const t=`tmp/${e.id}`;Object.entries(n).forEach((e=>{let[n,r]=e;i.i18n.addResourceBundle(n,t,r)})),e.localeName=i.i18n.getFixedT(null,t)("name",e.name),Object.keys(n).forEach((e=>{i.i18n.removeResourceBundle(e,t)}))}else e.localeName=e.name}var R=n(3256);let _=!1;const L=/^https?:\/\/localhost(?:$|:)/;function B(e,t){var n;null!==(n=t.options)&&void 0!==n&&null!==(n=n.interceptorParams)&&void 0!==n&&n.ignoreLoadingBar||window.dispatchEvent(new Event(e))}s.analytics.initialize(`${(0,r.getBasePath)()}api/gateway/data_exchange.store.ClickHouseInsertData/api/v1/data_exchange/frontend_stat`),o.http.interceptors.request.use(s.analytics.http.onRequest),o.http.interceptors.request.use((e=>{var t;B("request.start",e);const n=new Headers((null===(t=e.options)||void 0===t?void 0:t.headers)||{});n.set("lang",i.i18n.resolvedLanguage??i.i18n.language);const{csrfToken:r}=s.auth.getAuth();r&&n.set("X-CSRF-Token",r);const o=function(e,t){if(null!==I&&P.some((n=>new RegExp(n.uri).test(e)&&function(e){const t=null==e?void 0:e.toUpperCase();return"LIST"===t?"GET":t}(n.method)===(null==t?void 0:t.toUpperCase()))))return{mockId:I,url:e.replace(/(^|\/)(api\/gateway\/.+?)(?:@\d+\.\d+\.\d+)?\/(.+)/,((e,t,n,r)=>`${t}${n}/${r}`)).replace(/(^|\/)api\/gateway\//,`$1api/gateway/mock_server.proxy.${I}/`)}}(e.url,e.method);o&&(e.url=o.url,n.set("easyops-mock-id",o.mockId));const a=(()=>{let e="";for(let t=0;t<16;t+=1)e+="0123456789abcdef"[Math.floor(16*Math.random())];return e})();return n.set("X-B3-Traceid",`ffffffffffffffff${a}`),n.set("X-B3-Spanid",a),n.set("X-B3-Sampled","1"),{...e,options:{...e.options,headers:n}}})),o.http.interceptors.response.use((function(e,t){return B("request.end",t),e}),(function(e,t){return B("request.end",t),Promise.reject(e)})),o.http.interceptors.response.use(s.analytics.http.onResponse,s.analytics.http.onResponseError);const M=document.querySelector("#global-loading-bar");M.classList.add("rendered");let $=!1,N=0;function U(){const e=N>0;e!==$&&($=e,M.classList[e?"add":"remove"]("loading"))}window.addEventListener("request.start",(()=>{N++,U()})),window.addEventListener("request.end",(()=>{N>0&&(N--,U())}));const F=(0,r.createRuntime)({hooks:{auth:s.auth,fulfilStoryboard:async function(e){var t;if(window.STANDALONE_MICRO_APPS){if(window.BOOTSTRAP_UNION_FILE&&!e.$$fullMerged){const t=`${window.APP_ROOT}${window.PUBLIC_DEPS?"":"-/"}${e.bootstrapFile}`,{storyboards:n}=await o.http.get(t),{routes:r,meta:i,app:s}=n[0];Object.assign(e,{routes:r,meta:i,app:{...e.app,...s},$$fullMerged:!0})}if(!window.NO_AUTH_GUARD){const t=await T(e.app.id,e.app.currentVersion);if(t){const{userConfig:n,injectMenus:r}=t;e.app.userConfig={...e.app.userConfig,...n},function(e){if(Array.isArray(e))for(const t of e)t.overrideApp&&(C(t.overrideApp),x(t.overrideApp))}(r),e.meta={...e.meta,injectMenus:r}}}}else{const{routes:t,meta:n,app:r}=await(0,w.m)(e.app.id,{});Object.assign(e,{routes:t,meta:n,app:{...e.app,...r}})}!function(e){var t;if(e.app.menuIcon&&"imgSrc"in e.app.menuIcon&&null!==(t=e.app.menuIcon.imgSrc)&&void 0!==t&&t.startsWith("api/")){const t=e.app.menuIcon.imgSrc.split("/"),n=t[t.length-1],r=k(e.app.id,e.app.isBuildPush,e.app.currentVersion).get(n);e.app.menuIcon.imgSrc=r}}(e),C(e.app),x(e.app),function(e){if(!e)return I=null,void(P=[]);I=e.mockId,P=e.mockList.map((e=>({...e,uri:`${s.flowApi.isFlowApiProvider(e.provider)?e.uri.replace(/(.+?)\/(.+)/,((e,t,n)=>`/${t}(@\\d+\\.\\d+\\.\\d+)?/${n}$`)):`/${e.uri.split(".").slice(2).join(".")}$`}`.replace(/:\w+/g,"([^/]+)")})))}(null===(t=e.meta)||void 0===t?void 0:t.mocks)},checkPermissions:s.checkPermissions,flowApi:s.flowApi,checkInstalledApps:s.checkInstalledApps,menu:s.menu,images:{imagesFactory:k,widgetImagesFactory:function(e,t){return{get:n=>`${window.PUBLIC_ROOT??""}bricks/${e}/${window.PUBLIC_ROOT_WITH_VERSION&&t?`${t}/`:""}dist/assets/${n}`}}},messageDispatcher:s.messageDispatcher,pageView:s.analytics.pageView}});(0,i.initializeI18n)(d,p);const j=async function(){try{const[,e]=await Promise.all([g(),window.STANDALONE_MICRO_APPS?async function(){const e=[window.BOOTSTRAP_UNION_FILE?o.http.get(window.BOOTSTRAP_UNION_FILE):o.http.get(window.BOOTSTRAP_FILE),window.BOOTSTRAP_UNION_FILE?Promise.resolve(""):o.http.get(`${window.APP_ROOT}conf.yaml`,{responseType:"text"}),(0,y.e)().catch((e=>{console.warn("request runtime api from api-gateway failed: ",e,", something might went wrong running standalone micro app")})),window.BOOTSTRAP_UNION_FILE?o.http.get(window.BOOTSTRAP_FILE):Promise.resolve(void 0)];if(!window.NO_AUTH_GUARD){const e=window.APP_ROOT?window.APP_ROOT.match(/^(?:(?:\/next)?\/)?sa-static\/([^/]+)\/versions\/([^/]+)\//)||window.APP_ROOT.match(/^(?:(?:\/next)?\/)?sa-static\/micro-apps\/(?:v2|v3)\/([^/]+)\/([^/]+)\//):null;e&&T(e[1],e[2])}const[t,n,r,i]=await Promise.all(e);return function(e,t){let n;try{n=t?(0,S.safeLoad)(t,{schema:S.JSON_SCHEMA,json:!0}):void 0}catch(e){throw console.error("Parse conf.yaml failed",e),new Error("Invalid conf.yaml")}if(n){const{sys_settings:t,user_config:r,user_config_by_apps:o}=n;if(t){const{feature_flags:n,...r}=t;e.settings={featureFlags:n,...r}}if(r&&1===e.storyboards.length)e.storyboards[0].app.userConfig=r;else if(o)for(const{app:t}of e.storyboards)(0,b.hasOwnProperty)(o,t.id)&&(t.userConfig=o[t.id])}}(t,n),function(e,t){if(!t)return;const{featureFlags:n,misc:r,...o}=t,i=e.settings??(e.settings={});i.featureFlags={...i.featureFlags,...n},i.misc={...i.misc,...r},Object.assign(i,o)}(t,null==r?void 0:r.settings),function(e,t){if(t){const{storyboards:n}=t,{routes:r,meta:o,app:i}=n[0],s=e.storyboards.find((e=>e.app.id===i.id));s&&Object.assign(s,{routes:r,meta:o,app:{...s.app,...i},$$fullMerged:!0})}}(t,i),t}():(0,v.K)({appFields:"defaultConfig,userConfig,locales,name,homepage,id,currentVersion,installStatus,internal,status,icons,standaloneMode",ignoreTemplateFields:"templates",ignoreBrickFields:"bricks,processors,providers,editors"})]);return await F.bootstrap(e),"ok"}catch(e){return console.error("bootstrap failed:",e),document.body.classList.add("bootstrap-error"),document.querySelector("#main-mount-point").textContent=`bootstrap failed: ${(0,r.httpErrorToString)(e)}`,"failed"}}();window.parent!==window&&function(e){const t=async n=>{let{data:o,origin:i}=n;const s=function(e){return"preview-container"===(null==e?void 0:e.sender)&&"start-preview"===e.type}(o),a=function(e){return"ui-test-preview"===(null==e?void 0:e.channel)&&"initialize"===e.type}(o);if(s||a){window.removeEventListener("message",t);const n=await async function(e,t){if(_||!t)return!1;if("failed"===await e)return!1;_=!0;let n=t===location.origin||L.test(t)||L.test(location.origin);if(!n){const{allowedPreviewFromOrigins:e}=(0,r.getRuntime)().getMiscSettings();Array.isArray(e)&&(n=e.some((e=>e===t))),n||console.error(`Preview is disallowed, from origin: ${t}, while allowing: ${JSON.stringify(e)}`)}return n}(e,i);if(n){let e,t;s?({agent:e,...t}=o.options):({agent:e,options:t}=o.payload),await(0,R.loadBricksImperatively)([e.brick],[e.pkg]);const n=document.createElement(e.brick);await n.resolve(i,t)}}};window.addEventListener("message",t)}(j),window.__dev_only_getAllContextValues=r.__secret_internals.getAllContextValues},4712:(e,t,n)=>{n.r(t),n.d(t,{__dev_only_clearGlobalExecutionContextStack:()=>H,__dev_only_getGlobalExecutionContextStack:()=>q,cook:()=>G,isEvaluable:()=>ee,isTrackAll:()=>ne,precook:()=>X,precookFunction:()=>Q,preevaluate:()=>Z,shouldAllowRecursiveEvaluations:()=>te});var r=n(4586);let o=function(e){return e[e.LEXICAL=0]="LEXICAL",e[e.STRICT=1]="STRICT",e}({});const i=Symbol.for("SourceNode"),s=Symbol.for("FormalParameters"),a=Symbol.for("ECMAScriptCode"),c=Symbol.for("Environment"),l=Symbol.for("IsConstructor"),u=Symbol.for("ThisMode"),d=Symbol.for("$DebuggerCall$"),p=Symbol.for("$DebuggerScope$"),f=Symbol.for("$DebuggerNode$"),h=Symbol.for("$DebuggerReturn$");class m{constructor(){(0,r.A)(this,"VariableEnvironment",void 0),(0,r.A)(this,"LexicalEnvironment",void 0),(0,r.A)(this,"Function",void 0)}}let g=function(e){return e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LEXICAL=1]="LEXICAL",e[e.INITIALIZED=2]="INITIALIZED",e}({});class v{constructor(e){(0,r.A)(this,"OuterEnv",void 0),(0,r.A)(this,"bindingMap",new Map),(0,r.A)(this,"ThisValue",void 0),(0,r.A)(this,"ThisBindingStatus",void 0),this.OuterEnv=e}HasBinding(e){return this.bindingMap.has(e)}CreateMutableBinding(e,t){return this.bindingMap.set(e,{mutable:!0,deletable:t}),S(void 0)}CreateImmutableBinding(e,t){return this.bindingMap.set(e,{strict:t}),S(void 0)}InitializeBinding(e,t){const n=this.bindingMap.get(e);return Object.assign(n,{initialized:!0,value:t}),S(void 0)}SetMutableBinding(e,t,n){const r=this.bindingMap.get(e);if(!r.initialized)throw new ReferenceError(`${e} is not initialized`);if(!r.mutable)throw new TypeError("Assignment to constant variable");return r.value=t,S(void 0)}GetBindingValue(e,t){const n=this.bindingMap.get(e);if(!n.initialized)throw new ReferenceError(`${e} is not initialized`);return n.value}HasThisBinding(){return!1}}class y extends v{}class w extends v{constructor(e){super(e[c]),e[u]===o.LEXICAL?this.ThisBindingStatus=g.LEXICAL:this.ThisBindingStatus=g.UNINITIALIZED}HasThisBinding(){return this.ThisBindingStatus!==g.LEXICAL}BindThisValue(e){if(this.ThisBindingStatus===g.INITIALIZED)throw new Error("This binding has been initialized");this.ThisValue=e,this.ThisBindingStatus=g.INITIALIZED}GetThisBinding(){if(this.ThisBindingStatus===g.UNINITIALIZED)throw new Error("This binding is not initialized");return this.ThisValue}}class b{constructor(e,t,n){(0,r.A)(this,"Base",void 0),(0,r.A)(this,"ReferenceName",void 0),(0,r.A)(this,"Strict",void 0),this.Base=e,this.ReferenceName=t,this.Strict=n}}class E{constructor(e,t){(0,r.A)(this,"Type",void 0),(0,r.A)(this,"Value",void 0),this.Type=e,this.Value=t}}function S(e){return new E("normal",e)}const A=Symbol("empty completion");function k(e){const t=new Set,n=e=>{if(Array.isArray(e))for(const t of e)n(t);else if(e)switch(e.type){case"Identifier":return void t.add(e.name);case"VariableDeclaration":return n(e.declarations);case"VariableDeclarator":case"FunctionDeclaration":return n(e.id);case"ArrayPattern":return n(e.elements);case"AssignmentPattern":return n(e.left);case"ObjectPattern":return n(e.properties);case"Property":return n(e.value);case"RestElement":return n(e.argument)}};return n(e),Array.from(t)}function I(e){const t=e=>{if(Array.isArray(e))return e.some(t);if(e)switch(e.type){case"ArrayPattern":return t(e.elements);case"AssignmentPattern":return!0;case"ObjectPattern":return t(e.properties);case"Property":return e.computed||t(e.value);case"RestElement":return t(e.argument)}};return t(e)}function P(e,t){const n=[],r={var:t.var},o=(e,t)=>{if(Array.isArray(e))for(const n of e)o(n,t);else if(e){switch(e.type){case"FunctionDeclaration":return void(Number(!t.var)^Number(t.topLevel)&&n.push(e));case"VariableDeclaration":return void(Number(!t.var)^Number("var"===e.kind)&&n.push(e));case"SwitchCase":return void o(e.consequent,r);case"CatchClause":return void o(e.body,r)}if(t.var)switch(e.type){case"BlockStatement":case"DoWhileStatement":case"WhileStatement":return void o(e.body,r);case"IfStatement":return o(e.consequent,r),void o(e.alternate,r);case"ForStatement":return o(e.init,r),void o(e.body,r);case"ForInStatement":case"ForOfStatement":return o(e.left,r),void o(e.body,r);case"SwitchStatement":return void o(e.cases,r);case"TryStatement":return o(e.block,r),o(e.handler,r),void o(e.finalizer,r)}}};return o(e,t),n}function O(e){return"unresolvable"!==e.Base&&!(e.Base instanceof v)}function T(e,t){return e.Base.InitializeBinding(e.ReferenceName,t)}function C(e,t,n){if(null==t)return e;const r=Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t));for(const o of r)if(!n.has(o)){const n=Object.getOwnPropertyDescriptor(t,o);null!=n&&n.enumerable&&(e[o]=t[o])}return e}function x(e,t){const n="const"===e.kind;for(const r of k(e))n?t.CreateImmutableBinding(r,!0):t.CreateMutableBinding(r,!1)}function R(e){return"normal"===e.Type||"continue"==e.Type}function _(e,t){return e.Value!==A?e:new E(e.Type,t)}function L(e){if(e instanceof E&&(e=e.Value),!(e instanceof b))return e;if("unresolvable"===e.Base)throw new ReferenceError(`${e.ReferenceName} is not defined`);return e.Base instanceof v?e.Base.GetBindingValue(e.ReferenceName,e.Strict):e.Base[e.ReferenceName]}function B(e){return"symbol"==typeof e?e:String(e)}function M(e,t){return e[t]}function $(e,t){if("unresolvable"===e.Base)throw new ReferenceError(`${e.ReferenceName} is not defined`);return e.Base instanceof v?e.Base.SetMutableBinding(e.ReferenceName,t,e.Strict):(e.Base[e.ReferenceName]=t,S(void 0))}function N(e){if(t=e,!(Array.isArray(t)||null!=t&&"function"==typeof t[Symbol.iterator]))throw new TypeError(typeof e+" is not iterable");var t;return e[Symbol.iterator]()}function U(e){if(null==e)throw new TypeError("Cannot destructure properties of undefined or null")}function F(e,t,n){return e?e.HasBinding(t)?new b(e,t,n):F(e.OuterEnv,t,n):new b("unresolvable",t,n)}function j(e,t,n){switch(t){case"+":return e+n;case"-":return e-n;case"/":return e/n;case"%":return e%n;case"*":return e*n;case"**":return e**n;case"==":return e==n;case"===":return e===n;case"!=":return e!=n;case"!==":return e!==n;case">":return e>n;case"<":return e<n;case">=":return e>=n;case"<=":return e<=n;case"in":return e in n}throw new SyntaxError(`Unsupported binary operator \`${t}\``)}const D=new WeakSet([Function,Object,Function.prototype,Object.prototype,function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("unable to locate global object")}()]),V=new WeakSet([Array,Map,Set,URLSearchParams,WeakMap,WeakSet,RegExp]),W=[];function H(){W.length=0}function q(){return W}function G(e,t){var n;let{rules:r,debug:g,externalSourceForDebug:v,globalVariables:H={},ArrayConstructor:q=Array,hooks:G={}}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const K="FunctionDeclaration"!==e.type;function J(e){v||function(e){if(D.has(e))throw new TypeError("Cannot access reserved objects such as `Function`.")}(e)}const X=new y(null),Y=new m;Y.VariableEnvironment=X,Y.LexicalEnvironment=X;const Q=[Y];for(const[e,t]of Object.entries(H))X.CreateImmutableBinding(e,!0),X.InitializeBinding(e,t);const Z=new WeakMap;let ee;function*te(e,n,r){var o,i;switch(null===(o=G.beforeEvaluate)||void 0===o||o.call(G,e),ee=e,g&&(r||e.type.endsWith("Statement")&&("ExpressionStatement"!==e.type||"CallExpression"!==e.expression.type&&"TaggedTemplateExpression"!==e.expression.type)&&"TryStatement"!==e.type&&"BlockStatement"!==e.type&&"DoWhileStatement"!==e.type&&"WhileStatement"!==e.type&&"ForStatement"!==e.type&&"ForInStatement"!==e.type&&"ForOfStatement"!==e.type)&&(yield),e.type){case"ArrayExpression":{const t=new q;for(const n of e.elements)if(n)if("SpreadElement"===n.type){const e=L(yield*te(n.argument));t.push(...e)}else t.push(L(yield*te(n)));else t.length+=1;return S(t)}case"ArrowFunctionExpression":return Te(e),S(be(e));case"BinaryExpression":{const n=L(yield*te(e.left)),r=yield*te(e.right),o=L(r);if(K&&"|>"===e.operator){if("function"!=typeof o){const n=t.substring(e.right.start,e.right.end);throw new TypeError(`${n} is not a function`)}let i;return r instanceof b&&O(r)&&(i=r.Base),S(o.call(i,n))}return S(j(n,e.operator,o))}case"CallExpression":{const t=(yield*te(e.callee,n)).Value,r=L(t);return null==r&&(e.optional||null!=n&&n.skipped)?(n.skipped=!0,S(void 0)):(J(r),g&&(yield),yield*pe(r,t,e.arguments,e.callee))}case"ChainExpression":return yield*te(e.expression,{});case"ConditionalExpression":return S(L(yield*te(L(yield*te(e.test))?e.consequent:e.alternate)));case"Identifier":return S(re(e.name));case"Literal":if(e.regex){if(null===e.value)throw new SyntaxError(`Invalid regular expression: ${e.raw}`);if(e.regex.flags.includes("u"))throw new SyntaxError(`Unsupported unicode flag in regular expression: ${e.raw}`)}return S(e.value);case"LogicalExpression":{const t=L(yield*te(e.left));switch(e.operator){case"&&":return S(t&&L(yield*te(e.right)));case"||":return S(t||L(yield*te(e.right)));case"??":return S(t??L(yield*te(e.right)));default:throw new SyntaxError(`Unsupported logical operator '${e.operator}'`)}}case"MemberExpression":{const t=L((yield*te(e.object,n)).Value);if(null==t&&(e.optional||null!=n&&n.skipped))return n.skipped=!0,S(void 0);J(t);const r=e.computed?yield*function*(e,t,n){const r=B(L(yield*te(t)));return new b(e,r,!0)}(t,e.property):function(e,t,n){ee=t;const r=t.name;return new b(e,r,!0)}(t,e.property);return J(r),S(r)}case"NewExpression":return yield*function*(e,n){const r=L(yield*te(e)),o=yield*fe(n);if("function"!=typeof r||!1===r[l]){const n=t.substring(e.start,e.end);throw new TypeError(`${n} is not a constructor`)}if(!v&&!function(e){return V.has(e)||e===Date}(r)&&r!==q){const n=t.substring(e.start,e.end);throw new TypeError(`${n} is not an allowed constructor`)}return S(new r(...o))}(e.callee,e.arguments);case"ObjectExpression":{const t={};for(const n of e.properties)if("SpreadElement"===n.type)C(t,L(yield*te(n.argument)),new Set);else{if("init"!==n.kind)throw new SyntaxError("Unsupported object getter/setter");const e=n.computed||"Identifier"!==n.key.type?yield*ke(n.key):n.key.name;if("__proto__"===e)throw new TypeError("Setting '__proto__' property is not allowed");const r=L(yield*te(n.value));n.method&&"function"==typeof r&&Ee(r,e),t[e]=r}return S(t)}case"SequenceExpression":{let t;for(const n of e.expressions)t=S(L(yield*te(n)));return t}case"TemplateLiteral":{const t=[e.quasis[0].value.cooked];let n=0;for(const r of e.expressions){const o=L(yield*te(r));t.push(String(o)),t.push(e.quasis[n+=1].value.cooked)}return S(t.join(""))}case"TaggedTemplateExpression":{const t=(yield*te(e.tag)).Value,n=L(t);return J(n),g&&(yield),yield*pe(n,t,e.quasi,e.tag)}case"UnaryExpression":{const t=(yield*te(e.argument)).Value;if(!K&&"delete"===e.operator){if(!(t instanceof b))return S(!0);if(O(t))return S(delete t.Base[t.ReferenceName])}return"typeof"===e.operator?t instanceof b&&"unresolvable"===t.Base?S("undefined"):S(typeof L(t)):S(function(e,t){switch(t){case"!":return!e;case"+":return+e;case"-":return-e;case"void":return}throw new SyntaxError(`Unsupported unary operator \`${t}\``)}(L(t),e.operator))}}if(!K)switch(e.type){case"AssignmentExpression":{if("="===e.operator){if("ArrayPattern"!==e.left.type&&"ObjectPattern"!==e.left.type){const t=(yield*te(e.left)).Value;let n;return n=ge(e.right)&&"Identifier"===e.left.type?ve(e.right,e.left.name):L(yield*te(e.right)),$(t,n),S(n)}const t=L(yield*te(e.right));return yield*ce(e.left,t),S(t)}const t=(yield*te(e.left)).Value,n=L(t),r=L(yield*te(e.right)),o=function(e,t,n){switch(t){case"+=":case"-=":case"*=":case"/=":case"%=":case"**=":return j(e,t.substr(0,t.length-1),n)}throw new SyntaxError(`Unsupported assignment operator \`${t}\``)}(n,e.operator,r);return $(t,o),S(o)}case"BlockStatement":{if(!e.body.length)return S(A);const t=ne().LexicalEnvironment,n=new y(t);de(e.body,n),ne().LexicalEnvironment=n;const r=yield*me(e.body);return ne().LexicalEnvironment=t,r}case"BreakStatement":return new E("break",A);case"ContinueStatement":return new E("continue",A);case"EmptyStatement":case"FunctionDeclaration":return S(A);case"DoWhileStatement":return oe(yield*function*(e){let t;for(;;){const n=yield*te(e.body);if(!R(n))return _(n,t);if(n.Value!==A&&(t=n.Value),!L(yield*te(e.test,void 0,!0)))return S(t)}}(e));case"ExpressionStatement":case"TSAsExpression":return yield*te(e.expression);case"ForInStatement":case"ForOfStatement":return oe(yield*function*(e){const t=e.left,n="VariableDeclaration"===t.type?"var"===t.kind?"varBinding":"lexicalBinding":"assignment",r="lexicalBinding"===n?k(t):[],o="ForInStatement"===e.type?"enumerate":"iterate",i=yield*function*(e,t,n){const r=ne(),o=r.LexicalEnvironment;if(e.length>0){const t=new y(o);for(const n of e)t.CreateMutableBinding(n,!1);r.LexicalEnvironment=t}const i=yield*te(t,void 0,!0);r.LexicalEnvironment=o;const s=L(i);return"enumerate"===n?null==s?new E("break",A):S(function*(e){for(const t in e)yield t}(s)):S(N(s))}(r,e.right,o);return"normal"!==i.Type?i:yield*function*(e,t,n,r,o){const i="assignment"===o?e:e.declarations[0].id,s=ne().LexicalEnvironment;let a;const c="ObjectPattern"===i.type||"ArrayPattern"===i.type;for(;;){ee=i;const{done:l,value:u}=n.next();if(l)return g&&(yield),S(a);let d,p;if("lexicalBinding"===o){if(p=new y(s),x(e,p),ne().LexicalEnvironment=p,g&&(yield),!c){const[e]=k(i);d=re(e)}}else g&&(yield),c||(d=(yield*te(i)).Value);c?"assignment"===o?yield*ce(i,u):"varBinding"===o?yield*Ae(i,u,void 0):yield*Ae(i,u,p):"lexicalBinding"===o?T(d,u):$(d,u);const f=yield*te(t);if(ne().LexicalEnvironment=s,!R(f)){const e=_(f,a);if("enumerate"!==r&&void 0!==n.return){const e=n.return();if(!e||!["object","function"].includes(typeof e))throw new TypeError("Iterator result is not an object")}return e}f.Value!==A&&(a=f.Value)}}(t,e.body,i.Value,o,n)}(e));case"ForStatement":return oe(yield*function*(e){var t;if("VariableDeclaration"===(null===(t=e.init)||void 0===t?void 0:t.type)){if("var"===e.init.kind)return yield*te(e.init),yield*se(e.test,e.update,e.body,[]);const t=ne().LexicalEnvironment,n=new y(t),r="const"===e.init.kind,o=k(e.init);for(const e of o)r?n.CreateImmutableBinding(e,!0):n.CreateMutableBinding(e,!1);ne().LexicalEnvironment=n,yield*te(e.init);const i=r?[]:Array.from(o),s=yield*se(e.test,e.update,e.body,i);return ne().LexicalEnvironment=t,s}return e.init&&L(yield*te(e.init)),yield*se(e.test,e.update,e.body,[])}(e));case"FunctionExpression":return Te(e),S(we(e));case"IfStatement":var s;return L(yield*te(e.test))?(null===(s=G.beforeBranch)||void 0===s||s.call(G,e,"if"),_(yield*te(e.consequent),void 0)):(null===(i=G.beforeBranch)||void 0===i||i.call(G,e,"else"),e.alternate?_(yield*te(e.alternate),void 0):S(void 0));case"ReturnStatement":{let t;return e.argument&&(t=L(yield*te(e.argument))),new E("return",t)}case"ThisExpression":if(!v)break;return S(function(){let e=ne().LexicalEnvironment;for(;e;){if(e.HasThisBinding())return e;e=e.OuterEnv}throw new Error("Accessing global this is forbidden")}().GetThisBinding());case"ThrowStatement":throw L(yield*te(e.argument));case"UpdateExpression":{const t=(yield*te(e.argument)).Value,n=Number(L(t)),r="++"===e.operator?n+1:n-1;return $(t,r),S(e.prefix?r:n)}case"SwitchCase":return yield*me(e.consequent);case"SwitchStatement":{const t=L(yield*te(e.discriminant)),n=ne().LexicalEnvironment,r=new y(n);de(e.cases,r),ne().LexicalEnvironment=r;const o=yield*function*(e,t){let n;const r=e.findIndex((e=>!e.test)),o=r>=0,i=o?e.slice(0,r):e;let s=!1;for(const e of i)if(s||(s=yield*ie(e,t)),s){const t=yield*te(e);if(t.Value!==A&&(n=t.Value),"normal"!==t.Type)return _(t,n)}if(!o)return S(n);let a=!1;const c=e.slice(r+1);if(!s)for(const e of c)if(a||(a=yield*ie(e,t)),a){const t=yield*te(e);if(t.Value!==A&&(n=t.Value),"normal"!==t.Type)return _(t,n)}if(a)return S(n);const l=yield*te(e[r]);if(l.Value!==A&&(n=l.Value),"normal"!==l.Type)return _(l,n);for(const e of c){const t=yield*te(e);if(t.Value!==A&&(n=t.Value),"normal"!==t.Type)return _(t,n)}return S(n)}(e.cases,t);return ne().LexicalEnvironment=n,oe(o)}case"TryStatement":{let t;try{t=yield*te(e.block)}catch(n){if(!e.handler)throw n;var a;ee=e.handler,null===(a=G.beforeEvaluate)||void 0===a||a.call(G,e.handler),t=yield*function*(e,t){if(!e.param)return yield*te(e.body);const n=ne().LexicalEnvironment,r=new y(n);for(const t of k(e.param))r.CreateMutableBinding(t,!1);ne().LexicalEnvironment=r,yield*Ae(e.param,t,r);const o=yield*te(e.body);return ne().LexicalEnvironment=n,o}(e.handler,n)}finally{if(e.finalizer){const n=yield*te(e.finalizer);"normal"!==n.Type&&(t=n)}}return t}case"VariableDeclaration":{let t;for(const n of e.declarations)if(ee=n,n.init)if("Identifier"===n.id.type){ee=n.init,g&&"CallExpression"!==ee.type&&"TaggedTemplateExpression"!==ee.type&&(yield);const r=n.id.name,o=re(r);let i;i=ge(n.init)?ve(n.init,r):L(yield*te(n.init)),t="var"===e.kind?$(o,i):T(o,i)}else{ee=n.init,g&&"CallExpression"!==ee.type&&"TaggedTemplateExpression"!==ee.type&&(yield);const r=L(yield*te(n.init));t=yield*Ae(n.id,r,"var"===e.kind?void 0:ne().LexicalEnvironment)}else t="var"===e.kind?S(A):T(re(n.id.name),void 0);return t}case"WhileStatement":return oe(yield*function*(e){let t;for(;;){if(!L(yield*te(e.test,void 0,!0)))return S(t);const n=yield*te(e.body);if(!R(n))return _(n,t);n.Value!==A&&(t=n.Value)}}(e))}throw new SyntaxError(`Unsupported node type \`${e.type}\``)}function ne(){return Q[Q.length-1]}function re(e,t){return t||(t=ne().LexicalEnvironment),F(t,e,!0)}function oe(e){return"break"===e.Type?e.Value===A?S(void 0):S(e.Value):e}function*ie(e,t){return t===L(yield*te(e.test))}function*se(e,t,n,r){let o;for(ae(r);;){if(e&&!L(yield*te(e,void 0,!0)))return S(o);const i=yield*te(n);if(!R(i))return _(i,o);i.Value&&(o=i.Value),ae(r),t&&L(yield*te(t,void 0,!0))}}function ae(e){if(0===e.length)return;const t=ne().LexicalEnvironment,n=t.OuterEnv,r=new y(n);for(const n of e){r.CreateMutableBinding(n,!1);const e=t.GetBindingValue(n,!1);r.InitializeBinding(n,e)}ne().LexicalEnvironment=r}function*ce(e,t){if("ObjectPattern"===e.type)return U(t),e.properties.length>0&&(yield*function*(e,t){const n=new Set;for(const r of e)if("Property"===r.type){const e=r.computed||"Identifier"!==r.key.type?yield*ke(r.key):r.key.name,o="AssignmentPattern"===r.value.type?r.value.left:r.value;if("Identifier"===o.type){const i=re(o.name);let s=M(t,e);"AssignmentPattern"===r.value.type&&void 0===s&&(s=ge(r.value.right)?ve(r.value.right,o.name):L(yield*te(r.value.right))),$(i,s),n.add(e)}else yield*le(r.value,t,e),n.add(e)}else yield*ue(r,t,n)}(e.properties,t)),S(A);const n=N(t);return yield*function*(e,t){let n=S(A);for(const r of e){if(!r){t.next(),n=S(A);continue}const e="RestElement"===r.type?r.argument:"AssignmentPattern"===r.type?r.left:r,o="ArrayPattern"===e.type||"ObjectPattern"===e.type;let i,s;if(o||(i=(yield*te(e)).Value),"RestElement"!==r.type){const{done:n,value:o}=t.next(),i=n?void 0:o;s="AssignmentPattern"===r.type&&void 0===i?ge(r.right)&&"Identifier"===e.type?ve(r.right,e.name):L(yield*te(r.right)):i}else{s=new q;let e=0;for(;;){const{done:n,value:r}=t.next();if(n)break;s[e]=r,e++}}n=o?yield*ce(e,s):$(i,s)}return n}(e.elements,n)}function*le(e,t,n){const r="AssignmentPattern"===e.type?e.left:e,o="ArrayPattern"===r.type||"ObjectPattern"===r.type;let i;o||(i=(yield*te(r)).Value);const s=M(t,n);let a;return a="AssignmentPattern"===e.type&&void 0===s?L(yield*te(e.right)):s,o?yield*ce(r,a):$(i,a)}function*ue(e,t,n){return $((yield*te(e.argument)).Value,C({},t,n))}function de(e,t){const n=P(e,{var:!1,topLevel:!1});for(const e of n){const n="VariableDeclaration"===e.type&&"const"===e.kind;for(const r of k(e))n?t.CreateImmutableBinding(r,!0):t.CreateMutableBinding(r,!1);if("FunctionDeclaration"===e.type){const[n]=k(e),r=ye(e,t);t.InitializeBinding(n,r)}}}function*pe(e,n,r,o){let i;n instanceof b&&O(n)&&(i=n.Base);const s=yield*fe(r);if("function"!=typeof e){const e=t.substring(o.start,o.end);throw new TypeError(`${e} is not a function`)}if(g||v){const t=e[d];if(t){const e=yield*t.apply(i,s);return J(e),S(e)}}const a=e.apply(i,s);return J(a),S(a)}function*fe(e){const t=[];if(Array.isArray(e))for(const n of e)if("SpreadElement"===n.type){const e=L(yield*te(n.argument));t.push(...e)}else t.push(L(yield*te(n)));else{t.push(function(e){const t=Z.get(e);if(t)return t;const n=e.quasis.map((e=>e.value.raw)),r=e.quasis.map((e=>e.value.cooked));return Object.freeze(n),Object.defineProperty(r,"raw",{value:n,writable:!1,enumerable:!1,configurable:!1}),Object.freeze(r),Z.set(e,r),r}(e));for(const n of e.expressions)t.push(L(yield*te(n)))}return t}function*he(e,t,n){var c;null===(c=G.beforeCall)||void 0===c||c.call(G,e[i]),function(e,t,n){if(e[u]===o.LEXICAL)return;const r=t.LexicalEnvironment;null==r||r.BindThisValue(n)}(e,function(e){const t=new m;t.Function=e;const n=new w(e);return t.VariableEnvironment=n,t.LexicalEnvironment=n,Q.push(t),W.push(t),t}(e),t);const l=yield*function*(e,t){return yield*function*(e,t,n){return yield*function*(e,t){const n=ne(),i=e[a],c=e[s],l=k(c),d=I(c),p=P(i,{var:!0,topLevel:!0}),f=k(p),h=[],m=[];for(let e=p.length-1;e>=0;e--){const t=p[e];if("FunctionDeclaration"===t.type){Te(t);const[e]=k(t);h.includes(e)||(h.unshift(e),m.unshift(t))}else if(null!=r&&r.noVar)throw new SyntaxError("Var declaration is not recommended, use `let` or `const` instead")}const g=!!v&&e[u]!==o.LEXICAL,w=n.LexicalEnvironment;for(const e of l)w.CreateMutableBinding(e,!1);let b=l;if(g){const e=function(e){const t=[...e],n={};Object.defineProperty(n,"length",{value:t.length,writable:!0,configurable:!0});for(let e=0;e<t.length;e++)n[String(e)]=t[e];Object.defineProperty(n,Symbol.iterator,{value:Array.prototype.values,writable:!0,configurable:!0});const r=()=>{throw new TypeError("'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them")};return Object.defineProperty(n,"callee",{get:r,set:r}),n}(t);w.CreateImmutableBinding("arguments",!1),w.InitializeBinding("arguments",e),b=l.concat("arguments")}const E=N(t);let S;if(yield*Pe(c,E,w),d){S=new y(w),n.VariableEnvironment=S;const e=[];for(const t of f)if(!e.includes(t)){let n;e.push(t),S.CreateMutableBinding(t,!1),b.includes(t)&&!h.includes(t)&&(n=w.GetBindingValue(t,!1)),S.InitializeBinding(t,n)}}else{const e=[...b];for(const t of f)e.includes(t)||(e.push(t),w.CreateMutableBinding(t,!1),w.InitializeBinding(t,void 0));S=w}const A=S;n.LexicalEnvironment=A;const O=P(i,{var:!1,topLevel:!0});for(const e of O)for(const t of k(e))"const"===e.kind?A.CreateImmutableBinding(t,!0):A.CreateMutableBinding(t,!1);for(const e of m){const[t]=k(e),n=ye(e,A);S.SetMutableBinding(t,n,!1)}}(t,n),Array.isArray(e)?yield*me(e):new E("return",L(yield*te(e)))}(e[a],e,t)}(e,n);if(g&&(ee={...e[i],[h]:!0},yield{type:"return",value:"return"===l.Type?l.Value:void 0}),Q.pop(),W.pop(),"return"===l.Type)return l.Value}function*me(e){let t=S(A);for(const n of e){const e=yield*te(n);if("normal"!==e.Type)return e;t=_(t,e.Value)}return t}function ge(e){return"FunctionExpression"===e.type&&!e.id||"ArrowFunctionExpression"===e.type}function ve(e,t){switch(e.type){case"FunctionExpression":return we(e,t);case"ArrowFunctionExpression":return be(e,t);default:throw new Error(`Unexpected node type for NamedEvaluation: ${e.type}`)}}function ye(e,t){const n=Se(e,t,!0,!1);return e.id&&Ee(n,e.id.name),n}function we(e,t){const n=ne().LexicalEnvironment;if(e.id){const t=e.id.name,r=new y(n);r.CreateImmutableBinding(t,!1);const o=Se(e,r,!0,!1);return Ee(o,t),r.InitializeBinding(t,o),o}{const r=Se(e,n,!0,!1);return Ee(r,t??""),r}}function be(e,t){const n=Se(e,ne().LexicalEnvironment,!1,!0);return Ee(n,t??""),n}function Ee(e,t){Object.defineProperty(e,"name",{value:t,configurable:!0})}function Se(e,t,n,r){const p=function(){return z(he(p,this,arguments))};return Object.defineProperties(p,{[i]:{value:e},[s]:{value:e.params},[a]:{value:"BlockStatement"===e.body.type?e.body.body:e.body},[c]:{value:t},[l]:{value:n},[u]:{value:r?o.LEXICAL:o.STRICT}}),(g||v)&&Object.defineProperty(p,d,{value:function(){return he(p,this,arguments)}}),p}function*Ae(e,t,n){switch(e.type){case"Identifier":return function(e,t,n){return n.InitializeBinding(e,t),S(A)}(e.name,t,n);case"ObjectPattern":return U(t),yield*function*(e,t,n){const r=new Set;for(const o of e){if("RestElement"===o.type)return Ie(o,t,n,r);if(o.computed||"Identifier"!==o.key.type){const e=yield*ke(o.key);yield*Oe(o.value,t,n,e),r.add(e)}else yield*Oe(o.value,t,n,o.key.name),r.add(o.key.name)}return S(A)}(e.properties,t,n);case"ArrayPattern":{const r=N(t);return yield*Pe(e.elements,r,n)}}}function*ke(e){return B(L(yield*te(e)))}function Ie(e,t,n,r){const o=re(e.argument.name,n),i=C({},t,r);return n?T(o,i):$(o,i)}function*Pe(e,t,n){if(0===e.length)return S(A);let r;for(const o of e)if(o)if("RestElement"===o.type)if("Identifier"===o.argument.type){const e=re(o.argument.name,n),i=new q;let s=0;for(;;){const{done:o,value:a}=t.next();if(o){r=n?T(e,i):$(e,i);break}i[s]=a,s++}}else{const e=new q;let i=0;for(;;){const{done:s,value:a}=t.next();if(s){r=yield*Ae(o.argument,e,n);break}e[i]=a,i++}}else{const e="AssignmentPattern"===o.type?o.left:o;switch(e.type){case"ObjectPattern":case"ArrayPattern":{let i;const{done:s,value:a}=t.next();s||(i=a),"AssignmentPattern"===o.type&&void 0===i&&(i=L(yield*te(o.right))),r=yield*Ae(e,i,n);break}case"Identifier":{const i=e.name,s=re(i,n);let a;const{done:c,value:l}=t.next();c||(a=l),"AssignmentPattern"===o.type&&void 0===a&&(a=ge(o.right)?ve(o.right,i):L(yield*te(o.right))),r=n?T(s,a):$(s,a);break}}}else t.next(),r=S(A);return r}function*Oe(e,t,n,r){if("Identifier"===e.type||"AssignmentPattern"===e.type&&"Identifier"===e.left.type){const o="Identifier"===e.type?e.name:e.left.name,i=re(o,n);let s=M(t,r);return"AssignmentPattern"===e.type&&void 0===s&&(s=ge(e.right)?ve(e.right,o):L(yield*te(e.right))),n?T(i,s):$(i,s)}let o=M(t,r);return"AssignmentPattern"===e.type&&void 0===o&&(o=L(yield*te(e.right))),yield*Ae("AssignmentPattern"===e.type?e.left:e,o,n)}function Te(e){if(e.async||e.generator)throw new SyntaxError((e.async?"Async":"Generator")+" function is not allowed");if(K&&!e.expression)throw new SyntaxError("Only an `Expression` is allowed in `ArrowFunctionExpression`'s body")}if(K)return L(z(te(e)));null===(n=G.beforeEvaluate)||void 0===n||n.call(G,e),Te(e);const[Ce]=k(e);X.CreateImmutableBinding(Ce,!0);const xe=ye(e,X);return X.InitializeBinding(Ce,xe),g&&Object.defineProperties(xe,{[p]:{value:function(){return ne().LexicalEnvironment}},[f]:{value:function(){return ee}}}),xe}function z(e){for(;;){const{done:t,value:n}=e.next();if(t)return n}}class K{constructor(){(0,r.A)(this,"VariableEnvironment",void 0),(0,r.A)(this,"LexicalEnvironment",void 0)}}class J{constructor(e){(0,r.A)(this,"OuterEnv",void 0),(0,r.A)(this,"bindingSet",new Set),this.OuterEnv=e}HasBinding(e){return this.bindingSet.has(e)}CreateBinding(e){this.bindingSet.add(e)}}function X(e){let{expressionOnly:t,visitors:n,withParent:r,externalSourceForDebug:o,hooks:i={}}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new Set,a=[],c=new J(null),l=new K;function u(){return a[a.length-1]}function d(e,t,n){for(const r of t)p(e[r],null==n?void 0:n.concat({node:e,key:r}))}function p(e,r){if(Array.isArray(e))e.forEach(((e,t)=>{p(e,r?r.slice(0,-1).concat({...r[r.length-1],index:t}):r)}));else if(e){var a,c;switch(null===(a=i.beforeVisit)||void 0===a||a.call(i,e,r),function(e){var t,r;n&&(t=n,r=e.type,Object.prototype.hasOwnProperty.call(t,r))&&n[e.type](e)}(e),e.type){case"Identifier":var l;return w=e.name,void(h(u().LexicalEnvironment,w)||(null===(l=i.beforeVisitGlobal)||void 0===l||l.call(i,e,r),s.add(e.name)));case"ArrayExpression":case"ArrayPattern":return void d(e,["elements"],r);case"ArrowFunctionExpression":return void g(v(e,u().LexicalEnvironment,!0),r);case"AssignmentPattern":case"BinaryExpression":case"LogicalExpression":return void d(e,["left","right"],r);case"CallExpression":case"NewExpression":return void d(e,["callee","arguments"],r);case"ChainExpression":return void d(e,["expression"],r);case"ConditionalExpression":return void d(e,["test","consequent","alternate"],r);case"MemberExpression":return d(e,["object"],r),void(e.computed&&d(e,["property"],r));case"ObjectExpression":case"ObjectPattern":return void d(e,["properties"],r);case"Property":return e.computed&&d(e,["key"],r),void d(e,["value"],r);case"RestElement":case"SpreadElement":case"UnaryExpression":return void d(e,["argument"],r);case"SequenceExpression":case"TemplateLiteral":return void d(e,["expressions"],r);case"TaggedTemplateExpression":return void d(e,["tag","quasi"],r);case"Literal":return}if(!t)switch(e.type){case"AssignmentExpression":return void d(e,["right","left"],r);case"BlockStatement":{if(!e.body.length)return;const t=u(),n=t.LexicalEnvironment,o=new J(n);return m(e.body,o),t.LexicalEnvironment=o,d(e,["body"],r),void(t.LexicalEnvironment=n)}case"BreakStatement":case"ContinueStatement":case"EmptyStatement":return;case"CatchClause":{const t=u(),n=t.LexicalEnvironment,o=new J(n);return f(e.param,o),t.LexicalEnvironment=o,d(e,["param","body"],r),void(t.LexicalEnvironment=n)}case"DoWhileStatement":return void d(e,["body","test"],r);case"ExpressionStatement":case"TSAsExpression":return void d(e,["expression"],r);case"ForInStatement":case"ForOfStatement":{const t="VariableDeclaration"===e.left.type&&"var"!==e.left.kind,n=u(),o=n.LexicalEnvironment;if(t){const t=new J(o);f(e.left,t),n.LexicalEnvironment=t}if(d(e,["right"],r),n.LexicalEnvironment=o,t){const t=new J(o);f(e.left,t),n.LexicalEnvironment=t}return d(e,["left","body"],r),void(n.LexicalEnvironment=o)}case"ForStatement":{var y;const t="VariableDeclaration"===(null===(y=e.init)||void 0===y?void 0:y.type)&&"var"!==e.init.kind,n=u(),o=n.LexicalEnvironment;if(t){const t=new J(o);f(e.init,t),n.LexicalEnvironment=t}return d(e,["init","test","body","update"],r),void(n.LexicalEnvironment=o)}case"FunctionDeclaration":{const[t]=k(e),n=u().LexicalEnvironment,o=v(e,n);return n.CreateBinding(t),void g(o,r)}case"FunctionExpression":{const t=function(e){const t=u().LexicalEnvironment;if(!e.id)return v(e,t);const n=e.id.name,r=new J(t);return r.CreateBinding(n),v(e,r)}(e);return void g(t,r)}case"IfStatement":return void d(e,["test","consequent","alternate"],r);case"ReturnStatement":case"ThrowStatement":case"UpdateExpression":return void d(e,["argument"],r);case"SwitchCase":return void d(e,["test","consequent"],r);case"SwitchStatement":{d(e,["discriminant"],r);const t=u(),n=t.LexicalEnvironment,o=new J(n);return m(e.cases,o),t.LexicalEnvironment=o,d(e,["cases"],r),void(t.LexicalEnvironment=n)}case"ThisExpression":if(!o)break;return;case"TryStatement":return void d(e,["block","handler","finalizer"],r);case"VariableDeclaration":return void d(e,["declarations"],r);case"VariableDeclarator":return void d(e,["id","init"],r);case"WhileStatement":return void d(e,["test","body"],r)}(null===(c=i.beforeVisitUnknown)||void 0===c?void 0:c.call(i,e,r))||console.warn(`Unsupported node type \`${e.type}\``)}var w}function f(e,t){for(const n of k(e))t.CreateBinding(n)}function h(e,t){return!!e&&(e.HasBinding(t)||h(e.OuterEnv,t))}function m(e,t){f(P(e,{var:!1,topLevel:!1}),t)}function g(e,t){!function(e){const t=new K,n=new J(e.Environment);t.VariableEnvironment=n,t.LexicalEnvironment=n,a.push(t)}(e),function(e,t){const n=u(),r=e.ECMAScriptCode,i=e.FormalParameters,s=I(i),a=k(P(r,{var:!0,topLevel:!0})),c=!!o&&"LEXICAL"!==e.ThisMode,l=n.LexicalEnvironment;let d;if(f(i,l),c&&l.CreateBinding("arguments"),p(i,null==t?void 0:t.concat({node:e.Function,key:"params"})),s){d=new J(l),n.VariableEnvironment=d;for(const e of a)d.CreateBinding(e)}else{for(const e of a)l.CreateBinding(e);d=l}const h=d;n.LexicalEnvironment=h,f(P(r,{var:!1,topLevel:!0}),h)}(e,t),p(e.ECMAScriptCode,null==t?void 0:t.concat({node:e.Function,key:"body"}).concat("BlockStatement"===e.Function.body.type?{node:e.Function.body,key:"body"}:[])),a.pop()}function v(e,t,n){return{Function:e,FormalParameters:e.params,ECMAScriptCode:"BlockStatement"===e.body.type?e.body.body:e.body,Environment:t,ThisMode:n?"LEXICAL":"STRICT"}}return l.VariableEnvironment=c,l.LexicalEnvironment=c,a.push(l),p(e,r?[]:void 0),s}var Y=n(1760);function Q(e){let{typescript:t,...n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=function(e){let{typescript:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=(0,Y.parse)(e,{plugins:["estree",t&&"typescript"].filter(Boolean),strictMode:!0,attachComment:!1}).program.body,r=t?[]:n;if(t)for(const e of n)if(e.type.startsWith("TS")){if(/Enum|Import|Export/.test(e.type))throw new SyntaxError(`Unsupported TypeScript syntax: ${e.type}`)}else r.push(e);if(0===r.length)throw new SyntaxError("Function declaration not found");if(r.length>1||"FunctionDeclaration"!==r[0].type)throw new SyntaxError(`Expect a single function declaration at top level, but received: ${r.map((e=>`"${e.type}"`)).join(", ")}`);return r[0]}(e,{typescript:t});return{function:r,attemptToVisitGlobals:X(r,n)}}function Z(e,t){const n=[],r=e.replace(/^\s*<%[~=]?\s|\s%>\s*$/g,(e=>(n.push(e),""))),o=function(e){return(0,Y.parseExpression)(e,{plugins:["estree",["pipelineOperator",{proposal:"minimal"}]],attachComment:!1})}(r);return{expression:o,attemptToVisitGlobals:X(o,{...t,expressionOnly:!0}),source:r,prefix:n[0],suffix:n[1]}}function ee(e){return/^\s*<%[~=]?\s/.test(e)&&/\s%>\s*$/.test(e)}function te(e){return/^\s*<%~\s/.test(e)}function ne(e){return/^\s*<%=\s/.test(e)&&/\s%>\s*$/.test(e)}},7800:(e,t,n)=>{n.r(t),n.d(t,{analytics:()=>l,auth:()=>ut,checkInstalledApps:()=>o,checkPermissions:()=>ct,flowApi:()=>i,menu:()=>s,messageDispatcher:()=>lt});var r={};n.r(r),n.d(r,{authenticate:()=>h,getAuth:()=>m,isLoggedIn:()=>v,logout:()=>g});var o={};n.r(o),n.d(o,{getCheckedApp:()=>ee,preCheckInstalledApps:()=>Q,waitForCheckingApps:()=>Z});var i={};n.r(i),n.d(i,{FLOW_API_PROVIDER:()=>re,clearCollectWidgetContract:()=>me,clearDebugContract:()=>ve,collectContract:()=>fe,collectDebugContract:()=>ge,collectWidgetContract:()=>he,getArgsOfFlowApi:()=>be,isFlowApiProvider:()=>we,registerFlowApiProvider:()=>se});var s={};n.r(s),n.d(s,{fetchMenuById:()=>We,getMenuById:()=>Ve});var a={};n.r(a),n.d(a,{onRequest:()=>rt,onResponse:()=>ot,onResponseError:()=>it});var c={};n.r(c),n.d(c,{create:()=>at});var l={};n.r(l),n.d(l,{http:()=>a,initialize:()=>tt,pageView:()=>c});var u=n(1030),d=n(5069),p=n(8187);const f={};function h(e){Object.assign(f,{org:e.org,username:e.username,userInstanceId:e.userInstanceId,loginFrom:e.loginFrom,accessRule:e.accessRule,isAdmin:e.isAdmin,csrfToken:e.csrfToken,license:e.license,accessToken:e.accessToken,userShowValue:e.userShowValue})}function m(){return{...f}}function g(){for(const e of Object.keys(f))f[e]=void 0;y.length=0,w.clear()}function v(){return void 0!==f.username}const y=[],w=new Map;function b(e){if(v()&&!m().isAdmin)return E((0,d.scanPermissionActionsInAny)(e))}async function E(e){const t=(0,u.difference)(e,[...y]);if(0!==t.length){y.push(...t);try{const e=await(0,p.V)({actions:t},{noAbortOnRouteChange:!0});for(const t of e.actions)w.set(t.action,t.authorizationStatus),"undefined"===t.authorizationStatus&&console.error(`Undefined permission action: "${t.action}"`)}catch(e){console.error("Pre-check permissions failed",e)}}}var S=n(4635),A=n(918),k=n(5536),I=n(2559),P=n(6121),O=n(829),T=n(3647);const C=1e3,x=6;var R=new WeakMap,_=new WeakMap,L=new WeakMap,B=new WeakMap,M=new WeakMap,$=new WeakMap,N=new WeakMap,U=new WeakSet;class F{constructor(e){(0,S.A)(this,U),(0,A.A)(this,R,void 0),(0,A.A)(this,_,void 0),(0,A.A)(this,L,[]),(0,A.A)(this,B,new Set),(0,A.A)(this,M,new Set),(0,A.A)(this,$,0),(0,A.A)(this,N,!1),(0,P.A)(R,this,e)}send(e){(0,O.A)(_,this)||(0,P.A)(_,this,(0,I.A)(U,this,j).call(this));const t=JSON.stringify(e);(0,O.A)(_,this).readyState===WebSocket.OPEN?(0,O.A)(_,this).send(t):(0,O.A)(L,this).push(t)}onMessage(e){(0,O.A)(B,this).add(e)}onClose(e){(0,O.A)(M,this).add(e)}reset(){(0,O.A)(L,this).length=0,(0,O.A)(B,this).clear(),(0,O.A)(M,this).clear()}close(){var e;(0,P.A)(N,this,!0),(null===(e=(0,O.A)(_,this))||void 0===e?void 0:e.readyState)===WebSocket.OPEN&&(0,O.A)(_,this).close()}}function j(){console.log("WebSocket connecting ...");const e=new WebSocket((0,O.A)(R,this));return e.addEventListener("open",(t=>{console.log("WebSocket open:",t),(0,P.A)($,this,0);for(const t of(0,O.A)(L,this))e.send(t);(0,O.A)(L,this).length=0})),e.addEventListener("close",(e=>{if(!(0,O.A)(N,this)){console.log("WebSocket close:",e);for(const e of(0,O.A)(M,this))e();1e3!==e.code&&(0,I.A)(U,this,D).call(this)}})),e.addEventListener("error",(e=>{console.error("WebSocket error:",e)})),e.addEventListener("message",(e=>{const t=JSON.parse(e.data);for(const e of(0,O.A)(B,this))e(t)})),e}function D(){if((0,O.A)($,this)>=x)return void console.error("WebSocket connect retry limit exceeded");const e=Math.pow(2,(0,O.A)($,this))*C;console.log("WebSocket will reconnect after %d seconds",e/1e3),setTimeout((()=>{var e;(0,P.A)($,this,(e=(0,O.A)($,this),++e)),(0,P.A)(_,this,(0,I.A)(U,this,j).call(this))}),e)}var V=new WeakMap,W=new WeakMap,H=new WeakMap,q=new WeakSet;function G(e){if(!(0,O.A)(V,e)){const t=`${"https:"===location.protocol?"wss:":"ws:"}//${window.location.host}${(0,T.getBasePath)()}api/websocket_service/v1/ws`;(0,P.A)(V,e,new F(t))}return(0,O.A)(V,e)}function z(e,t,n,r){const o=(0,O.A)(W,this)[e].get(r);if(o)return o;const i={event:"sub"===e?"TOPIC.SUB":"TOPIC.UNSUB",payload:n},s=new Promise(((t,r)=>{const o=K(n);(0,k.A)(q,this,G).onMessage((n=>{const i=n.event===("sub"===e?"TOPIC.SUB_SUCCESS":"TOPIC.UNSUB_SUCCESS"),s=n.event===("sub"===e?"TOPIC.SUB_FAILED":"TOPIC.UNSUB_FAILED");(i||s)&&o===K(n.payload)&&(i?t:r)(n)})),(0,k.A)(q,this,G).send(i)}));return"sub"===e&&(0,O.A)(H,this).set(t,r),(0,O.A)(W,this)[e].set(r,s),s}function K(e){const{system:t,topic:n}=e;return JSON.stringify({system:t,topic:n})}var J=n(8638);const X=new Map,Y=new Map;function Q(e,t){if(window.STANDALONE_MICRO_APPS&&!window.NO_AUTH_GUARD){const n=function(e){const t={usedArgs:new Set},{customTemplates:n,menus:r}=e.meta??{};return(0,d.traverseStoryboardExpressions)([e.routes,n,r],((e,n)=>{(0,d.collectInstalledAppsHasUsage)(t,e,n)}),"INSTALLED_APPS"),[...t.usedArgs]}(e),r=[];for(const e of n)X.has(e)||t(e)||r.push(e);if(0===r.length)return;const o=(0,J.k)({query:{appId:{$in:r}},fields:["appId","currentVersion","installStatus"]}).catch((e=>{console.error("Get off site standalone micro-apps failed",e)}));for(const e of r)X.set(e,o.then((t=>{var n;const r=null==t||null===(n=t.list)||void 0===n?void 0:n.find((t=>t.appId===e)),o=r?{...r,id:e}:void 0;return Y.set(e,o),o})))}}async function Z(e){await Promise.all(e.map((e=>X.get(e))))}function ee(e){if(window.STANDALONE_MICRO_APPS)return Y.get(e)}var te=n(4113),ne=n(7551);const re="core.provider-flow-api";function oe(e,t){return e.some((e=>e.source===t))}async function ie(e){let{url:t,originalUri:n,method:r="GET",responseWrapper:o=!0,ext_fields:i=[],request:s,isFileType:a,stream:c}=e;const l=["get","delete","head"].includes(r.toLowerCase()),d=a?{responseType:"blob"}:{};let p;for(var f=arguments.length,h=new Array(f>1?f-1:0),m=1;m<f;m++)h[m-1]=arguments[m];if(l){var g,v;let e,o;var y;if(n&&"object"===(null==s?void 0:s.type)&&((null===(g=n.match(/:([^/]+)/g))||void 0===g?void 0:g.length)??0)===((null===(v=s.fields)||void 0===v?void 0:v.length)??0)?[o]=h:[e,o]=h,c)return await(0,te.createSSEStream)(ne.http.getUrlWithParams(t,e),{...d,...o,method:r,headers:Object.fromEntries([...new Headers((null===(y=o)||void 0===y?void 0:y.headers)??{}).entries()])});p=await ne.http.simpleRequest(r,t,{params:e,...d,...o})}else{const e=function(e){if(!e||"object"!==e.type)return!1;const t=e=>!(0,u.isEmpty)(e)&&e.some((e=>["file","file[]"].includes(e.type)||t(e.fields)));return t(e.fields)}(s),n=function(e){const t=oe(e,"query"),n=oe(e,"body");for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];if(t){if(n){const[e,t,n]=o;return{data:e,options:{params:t,...n}}}const[e,t]=o;return{data:{},options:{params:e,...t}}}const[s,a]=o;return{data:s,options:a}}(i,...h),o=e?function(e){if(e instanceof FormData)return e;const t=new FormData;for(const[n,r]of Object.entries(e))Array.isArray(r)?r.forEach((e=>{t.append(n,e)})):!(0,u.isObject)(r)||r instanceof Blob||r instanceof Date?t.append(n,r):Object.entries(r).forEach((e=>{let[r,o]=e;t.append(`${n}[${r}]`,o)}));return t}(n.data):n.data;if(c){var w;const{body:e,headers:i}=ne.http.getBodyAndHeaders(o,null===(w=n.options)||void 0===w?void 0:w.headers);return await(0,te.createSSEStream)(t,{...d,...n.options,method:r,headers:Object.fromEntries([...new Headers(i??{}).entries()]),body:e})}p=await ne.http.requestWithBody(r,t,o,{...d,...n.options})}return!a&&o?p.data:p}function se(){customElements.define(re,(0,te.createProviderClass)(ie))}var ae=n(1060),ce=n(9150);const le=new Map,ue=new Map,de=new Map,pe=(e,t)=>{null==e||e.forEach((e=>{t.set(`${e.namespaceId}.${e.name}`,e)}))};function fe(e){pe(e,le)}function he(e){pe(e,ue)}function me(){ue.clear()}function ge(e){pe(e,de)}function ve(){de.clear()}const ye=new Map;function we(e){return e.includes("@")}async function be(e,t,n,r){if(!e.includes(":"))throw new Error(`You're using legacy Custom API "${e}" which is dropped in v3, please use Flow API instead`);const o=await async function(e){const[t,n]=e.split("@"),[r,o]=n.split(":"),i=function(e){return le.get(e)||ue.get(e)||de.get(e)}(`${t}.${r}`);if(i)return{name:i.name,namespace:i.namespaceId,serviceName:i.serviceName,version:i.version,contract:{endpoint:i.endpoint,response:i.response,request:i.request}};let s=ye.get(e);return s||(s=async function(e,t,n){var r;const{contractData:o}=await(0,ce.A)({contractName:`${e}.${t}`,version:n});return o?{name:o.name,namespace:null===(r=o.namespace)||void 0===r||null===(r=r[0])||void 0===r?void 0:r.name,serviceName:o.serviceName,version:o.version,contract:{endpoint:o.endpoint,response:o.response,request:o.request}}:null}(t,r,o),ye.set(e,s)),s}(e);if(!o)throw new Ee(`Flow API not found: "${e}"`);const i=function(e,t){var n;const r="string"==typeof t.contract?ae.safeLoad(t.contract,{schema:ae.JSON_SCHEMA,json:!0}):t.contract,{uri:o,method:i="GET",ext_fields:s}=(null==r?void 0:r.endpoint)??{},a=!(null==r||!r.response)&&!1!==r.response.wrapper;if(!o)throw new Error(`Missing endpoint.uri in contract of provider "${e}"`);return{uri:o,method:"list"===i.toLowerCase()?"get":i,ext_fields:s,name:t.name,namespace:t.namespace,serviceName:t.serviceName,version:t.version,isFileType:"file"===(null==r||null===(n=r.response)||void 0===n?void 0:n.type),responseWrapper:a,request:null==r?void 0:r.request}}(e,o);return function(e,t,n,r){let{uri:o,method:i,ext_fields:s,name:a,namespace:c,serviceName:l,responseWrapper:u,version:d,isFileType:p,request:f}=e;const h="saveAs"===n;let m;h&&(m=t.shift());const{url:g,args:v}=function(e,t,n,r,o,i){const s=i?"logic.api.gateway"===o||null!=o&&o.startsWith("logic.api.gateway.")?"":o?`api/gateway/${o}`:`api/gateway/${r}.${n}@${i}`:`api/gateway/api_service.${r}.${n}`,a=t.slice(),c=e.replace(/:([^/]+)/g,(()=>a.shift()));return{url:s?s+c:c.replace(/^\//,""),args:a}}(o,t,a,c,l,d);return[...h?[m]:[],{url:g,originalUri:o,method:i,ext_fields:s,responseWrapper:u,request:f,isFileType:p,stream:r},...v]}(i,t,n,r)}class Ee extends Error{constructor(e){super(e),this.name="FlowApiNotFoundError",Error.captureStackTrace&&Error.captureStackTrace(this,Ee)}}var Se=n(3733),Ae=n(5075),ke=n(832);const Ie=Symbol("appId"),Pe=Symbol("menuI18nNamespace"),Oe=Symbol("overrideApp");async function Te(e,t,n){const r=e.find((e=>"inject"!==e.type));if(!r)return;const o=[],i=new Map,s=new WeakMap;for(const t of e)if(t.i18n){const e=`menu/${t.menuId}~${t.app[0].appId}+${t.instanceId}`;Object.entries(t.i18n).forEach((t=>{let[n,r]=t;ke.i18n.addResourceBundle(n,e,r)})),s.set(t,e)}await Promise.all(e.map((e=>async function(e,t,n,r){if(e.dynamicItems&&e.itemsResolve){const i=e.app[0].appId,s={...t,pendingPermissionsPreCheck:[...t.pendingPermissionsPreCheck,b(e.itemsResolve)]};var o;i!==t.app.id&&(s.overrideApp=window.STANDALONE_MICRO_APPS?e.overrideApp:null===(o=r.getStoryboardByAppId(i))||void 0===o?void 0:o.app,s.appendI18nNamespace=n.get(e));const a=await r.resolveData({transform:"items",...e.itemsResolve},s);e.items=a.items}}(e,t,s,n))));for(const t of e){var a;if(null!==(a=t.items)&&void 0!==a&&a.length)if("inject"===t.type&&t.injectMenuGroupId){let e=i.get(t.injectMenuGroupId);e||(e=[],i.set(t.injectMenuGroupId,e)),e.push(t)}else o.push(t)}return{...r,items:o.flatMap((e=>Ce(e.items,e,i,s))),[Pe]:s.get(r),[Oe]:r.overrideApp}}function Ce(e,t,n,r){return null==e?void 0:e.map((e=>{const o=e.groupId&&n.get(e.groupId);return o&&n.delete(e.groupId),{...e,children:(Ce(e.children,t,n,r)??[]).concat(o?o.flatMap((e=>Ce(e.items,e,n,r))):[]),[Ie]:t.app[0].appId,[Pe]:r.get(t),[Oe]:t.overrideApp}}))}function xe(e){e.items=Re(e.items)}function Re(e){return function(e){return(0,u.sortBy)(e,(e=>e.sort??-1/0))}(e).map((e=>({...e,children:Re(e.children)})))}var _e=n(1894),Le=n(971);function Be(e,t,n,r){if("titleDataSource"in e&&(0,te.isObject)(e.titleDataSource)&&Object.entries(e.titleDataSource).every((e=>{let[,t]=e;return null===t||""===t}))&&delete e.titleDataSource,"if"in e&&null===e.if&&delete e.if,"to"in e&&e.to&&!(0,Le.isEvaluable)(e.to)){const t=_e.pipes.yaml(e.to);(0,te.isObject)(t)&&["pathname","search","hash"].some((e=>(0,te.hasOwnProperty)(t,e)))&&(e.to=t)}let o=n;if(t!==n.app.id){var i;const s=window.STANDALONE_MICRO_APPS?e[Oe]:null===(i=r.getStoryboardByAppId(t))||void 0===i?void 0:i.app;o={...n,overrideApp:s,appendI18nNamespace:e[Pe]}}return r.asyncComputeRealValue(e,o,{ignoreSymbols:!0})}function Me(e,t,n){return Promise.all(e.map((async e=>{let{children:r,...o}=e;const[i,s]=await Promise.all([Be(o,o[Ie],t,n),r&&await Me(r,t,n)]);return{...i,children:s}})))}var $e=n(8518);const Ne=new Map;async function Ue(e){if(e.title||(0,u.isEmpty)(e.titleDataSource))return e.title;const t=JSON.stringify(e.titleDataSource),n=Ne.get(t);if(void 0!==n)return n;const{objectId:r,instanceId:o,attributeId:i}=e.titleDataSource,s=i??"name",a=await(0,$e.y)(r,o,{fields:s});let c;if("#showKey"===i&&Array.isArray(a[s])){const[e,...t]=a[s];c=t.length>0?`${e}(${t.join(",")})`:String(e)}else c=String(a[s]);return Ne.set(t,c),c}const Fe=new Map,je=new Map;function De(e){return null==e?void 0:e.filter(T.checkIfOfComputed).map((e=>{const t=De(e.children);return"group"===e.type?{type:"group",title:e.text,childLayout:e.childLayout,items:t,groupId:e.groupId,groupFrom:e.groupFrom}:null!=t&&t.length?{type:"subMenu",childLayout:e.childLayout,title:e.text,icon:e.icon,items:t,defaultExpanded:e.defaultExpanded}:(0,u.omit)(e,["type","items","children"])}))}function Ve(e){return je.get(e)}function We(e,t,n){let r=Fe.get(e);return r||(r=async function(e,t,n){const r=window.STANDALONE_MICRO_APPS?function(e,t,n){var r,o;const i=n.getStoryboardByAppId(t);return((null===(r=i.meta)||void 0===r?void 0:r.injectMenus)??(null===(o=i.meta)||void 0===o?void 0:o.menus)??[]).filter((t=>t.menuId===e)).map((e=>{var n;return{...e,...null!==(n=e.app)&&void 0!==n&&null!==(n=n[0])&&void 0!==n&&n.appId?{}:{app:[{appId:t}]}}}))}(e,t.app.id,n):t.flags["three-level-menu-layout"]?(await(0,Ae.D)(e,{menuObjectId:"EASYOPS_STORYBOARD_MENU"})).menus:(await(0,Se.n)("EASYOPS_STORYBOARD_MENU",{page:1,page_size:200,fields:{menuId:!0,title:!0,icon:!0,link:!0,titleDataSource:!0,defaultCollapsed:!0,defaultCollapsedBreakpoint:!0,type:!0,injectMenuGroupId:!0,dynamicItems:!0,itemsResolve:!0,items:!0,i18n:!0,"items.children":!0,"app.appId":!0},query:{menuId:{$eq:e},app:{$size:{$gt:0}}}})).list,o=await Te(r,t,n);if(!o)throw new Error(`Menu not found: ${e}`);xe(o);const{items:i,app:s,...a}=o,c={...t,pendingPermissionsPreCheck:[...t.pendingPermissionsPreCheck,b([i,a])]};delete c.tplStateStoreId,delete c.forEachItem,delete c.forEachIndex;const l=s[0].appId,[d,p]=await Promise.all([Be(a,l,c,n),Me(i,c,n)]),f={title:await Ue(d),...(0,u.pick)(d,["icon","link","defaultCollapsed","defaultCollapsedBreakpoint"]),menuItems:De(p)};je.set(e,f)}(e,t,n)),r}const He=[];let qe=null;const Ge={maxWaitingTime:5e3,maxLoggedEvents:10};function ze(){clearTimeout(qe),He.length>Ge.maxLoggedEvents?Ke():qe=setTimeout(Ke,Ge.maxWaitingTime)}function Ke(){if(0===He.length)return;const e={model:"easyops.FRONTEND_STAT",columns:["_ver","st","et","lt","size","time","traceId","code","duration","page","uid","username","api","type","msg","status","pageId","route","apiCount","maxApiTimeCost","apiSizeCost","pageTitle"],data:He.splice(0,Ge.maxLoggedEvents)};var t;!function(e,t){const n=new Blob([JSON.stringify(t)],{type:"application/json"});window.navigator.sendBeacon(e,n)}(Ge.api,e),He.length&&(t=Ke,(window.requestIdleCallback||window.requestAnimationFrame||(e=>setTimeout(e,17)))(t))}function Je(){window.addEventListener("beforeunload",Ke,!1)}let Xe,Ye=!1,Qe=null,Ze=!0;const et=[];function tt(e){Ye||(Ye=!0,Xe||(Xe=function(e,t){return Object.assign(Ge,{...t,api:e}),{sendOnExit:Je,emit:ze}}(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}),Xe.sendOnExit()))}const nt=Symbol("HttpAnalytics");function rt(e){const t=Math.round(performance.now()),n=Date.now();return e[nt]={st:n,time:Math.round(n/1e3),perfStartTime:t},e}function ot(e,t){return st(!1,e,t)}function it(e,t){return st(!0,e,t)}function st(e,t,n){const r=Math.round(performance.now()),o=Date.now(),{[nt]:i,url:s}=n;if(i&&!(e&&t instanceof ne.HttpAbortError)){delete n[nt];const{st:c,time:l,perfStartTime:u}=i,{userInstanceId:d,username:p}=m();let f,h,g,v,y,w,b;if(e){const e=t instanceof ne.HttpResponseError;(e||t instanceof ne.HttpParseError)&&(({status:y,headers:w}=t.response),e&&(b=t.responseJson))}else({status:y,data:b,headers:w}=t);(0,te.isObject)(b)&&({code:f,message:h}=b),w instanceof Headers&&(g=w.get("x-b3-traceid"),v=w.get("content-length")),a={st:c,_ver:c,uid:d,username:p,time:l,et:o,page:location.href,duration:r-u,api:s,type:"api",code:f??-1,msg:h??"",status:y,traceId:g??"",size:v?Number(v):-1},Qe?He.push({...a,type:"apiRequest",...Qe}):et.push(a)}var a;return e?Promise.reject(t):t}function at(){const e=Math.round(performance.now()),t=Date.now();return et.length=0,Qe=null,function(n){let{status:r,path:o,pageTitle:i}=n;if("ok"!==r)return He.push(...et),void(et.length=0);const s=Math.round(performance.now())-e,a=Date.now(),{username:c}=m();(function(e){const t=function(){const e=URL.createObjectURL(new Blob([]));let t=e.substring(e.lastIndexOf("/")+1);return URL.revokeObjectURL(e),Ze&&(t="88-"+t,Ze=!1),t}(),{lt:n,route:r}=e;Qe={lt:n,route:r,pageId:t},He.push({...e,pageId:t,apiCount:et.length,maxApiTimeCost:Math.max(0,...et.map((e=>e.duration))),size:et.map((e=>e.size)).filter((e=>e>0)).reduce(((e,t)=>e+t),0)});for(const e of et)He.push({...e,...Qe});et.length=0,Xe.emit()})({type:"page",page:location.href,_ver:t,time:Math.round(t/1e3),st:t,et:a,lt:s,pageTitle:i,username:c,route:o}),window.dispatchEvent(new CustomEvent("route.render",{detail:{renderTime:s}}))}}const ct=Object.freeze({checkPermissions:function(){if(!v())return!1;if(m().isAdmin)return!0;for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(const e of t)switch(w.get(e)){case"unauthorized":case"undefined":return!1;case void 0:return console.error(`Un-checked permission action: "${e}", please make sure the permission to check is defined in permissionsPreCheck.`),!1}return!0},preCheckPermissions:function(e){if(v()&&!m().isAdmin)return E((0,d.scanPermissionActionsInStoryboard)(e))},preCheckPermissionsForBrickOrRoute:async function(e,t){if(v()&&!m().isAdmin&&Array.isArray(e.permissionsPreCheck))return E(await t(e.permissionsPreCheck))}}),lt=new class{constructor(){(0,S.A)(this,q),(0,A.A)(this,V,void 0),(0,A.A)(this,W,{sub:new Map,unsub:new Map}),(0,A.A)(this,H,new Map)}subscribe(e,t){const n=JSON.stringify(t);return(0,I.A)(q,this,z).call(this,"sub",e,t,n)}unsubscribe(e){const t=(0,O.A)(H,this).get(e);if(!t){const t=`The message channel to unsubscribe "${e}" is not found`;return console.error(t),Promise.reject(new Error(t))}const n=JSON.parse(t),r=(0,I.A)(q,this,z).call(this,"unsub",e,n,t);return(0,O.A)(W,this).sub.delete(t),r.then((()=>{(0,O.A)(H,this).delete(e)})),r}onMessage(e,t){let n=(0,O.A)(H,this).get(e),r=!1;(0,k.A)(q,this,G).onMessage((o=>{n||(n=(0,O.A)(H,this).get(e)),n?"MESSAGE.PUSH"===o.event&&function(e,t){const n=JSON.parse(e);return n.system===t.system&&(n.topic===t.topic||"string"==typeof n.topic&&n.topic.includes("*")&&new RegExp(`^${n.topic.replace(/([^*]*)\*([^*]*)/g,((e,t,n)=>`${(0,u.escapeRegExp)(t)}[^/]*${(0,u.escapeRegExp)(n)}`))}$`).test(t.topic))}(n,o.payload)&&t(o.payload.message):r||(console.error(`Message channel: "${e}" not found`),r=!0)}))}onClose(e){(0,k.A)(q,this,G).onClose(e)}reset(){var e;(0,O.A)(W,this).sub.clear(),(0,O.A)(W,this).unsub.clear(),(0,O.A)(H,this).clear(),null===(e=(0,O.A)(V,this))||void 0===e||e.reset()}},ut=function(){const e=(0,T.getV2RuntimeFromDll)();if(e)return Object.freeze((0,u.pick)(e,["authenticate","getAuth","isLoggedIn","logout"]))}()||r},2308:(e,t,n)=>{n.r(t),n.d(t,{HttpAbortError:()=>U,HttpFetchError:()=>M,HttpParseError:()=>N,HttpResponseError:()=>$,createHttpInstance:()=>D,defaultAdapter:()=>V,fetch:()=>B,http:()=>F,isHttpAbortError:()=>j});var r={};n.r(r),n.d(r,{HttpAbortError:()=>h,HttpFetchError:()=>d,HttpParseError:()=>f,HttpResponseError:()=>p,createHttpInstance:()=>C,defaultAdapter:()=>A,fetch:()=>o,getUrlWithParams:()=>E,http:()=>T,isHttpAbortError:()=>w});const o=(e,t)=>{const n=new Request(e,Object.assign({credentials:"same-origin"},t));return self.fetch(n)};var i=n(4635),s=n(918),a=n(4586),c=n(829),l=n(2559),u=n(6121);class d extends Error{constructor(e){super(e),this.name="HttpFetchError",Error.captureStackTrace&&Error.captureStackTrace(this,d)}}class p extends Error{constructor(e,t){super(e.statusText),(0,a.A)(this,"response",void 0),(0,a.A)(this,"responseJson",void 0),this.name="HttpResponseError",Error.captureStackTrace&&Error.captureStackTrace(this,p),this.response=e,this.responseJson=t}}class f extends Error{constructor(e){super(e.statusText),(0,a.A)(this,"response",void 0),this.name="HttpParseError",Error.captureStackTrace&&Error.captureStackTrace(this,f),this.response=e}}class h extends Error{constructor(e){super(e),this.name="HttpAbortError"}}class m{constructor(){(0,a.A)(this,"handlers",[])}use(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}forEach(e){this.handlers.forEach((t=>{null!==t&&e(t)}))}}function g(e){return null==e}const v=document.querySelector("base"),y=v?v.href:location.origin+"/",w=e=>e instanceof DOMException&&20===e.code,b=async(e,t,n)=>new Promise((async(r,i)=>{let s;n.url=e;let a,{responseType:c}=n.options||{};c||(c="json");try{s=await o(e,t)}catch(e){return void i(w(e)?new h(e.toString()):new d(e.toString()))}if(s.ok){try{a=await s[c]()}catch(e){return void i(w(e)?new h(e.toString()):new f(s))}r({status:s.status,statusText:s.statusText,headers:s.headers,data:a})}else{let e;try{e=await s.json()}catch{}i(new p(s,e))}})),E=(e,t)=>{if(t){const n=new URL(e,y);t instanceof URLSearchParams?t.forEach((function(e,t){n.searchParams.append(t,e)})):Object.entries(t).forEach((e=>{let[t,r]=e;Array.isArray(r)?r.forEach((e=>{n.searchParams.append(t,g(e)?"":e)})):n.searchParams.append(t,g(r)?"":r)}));const{href:r}=n;return r.startsWith(y)?r.substr(y.length):r}return e},S=(e,t)=>{if(void 0!==e){const n=new Headers(t||{}),r="Content-Type";let o=e;return n.has(r)||("string"==typeof e?n.set(r,"application/x-www-form-urlencoded"):e instanceof FormData||(n.set(r,"application/json"),o=JSON.stringify(e))),{body:o,headers:n}}return{headers:t}},A=e=>{const{url:t,method:n,data:r}=e;return["DELETE","GET","HEAD"].includes(e.method)?((e,t,n)=>{const{params:r,responseType:o,interceptorParams:i,observe:s,noAbortOnRouteChange:a,useCache:c,...l}=n.options||{};return b(E(t,r),{...l,method:e},n)})(n,t,e):((e,t,n,r)=>{const{params:o,headers:i,responseType:s,interceptorParams:a,observe:c,noAbortOnRouteChange:l,useCache:u,...d}=r.options||{};return b(E(t,o),{...d,method:e,...S(n,i)},r)})(n,t,r,e)};var k=new WeakMap,I=new WeakSet;class P{constructor(e){var t=this;(0,i.A)(this,I),(0,a.A)(this,"interceptors",void 0),(0,s.A)(this,k,A),(0,a.A)(this,"request",(async(e,t,n)=>{const{body:r,method:o,...i}=t||{};return(0,l.A)(I,this,O).call(this,{url:e,data:r,method:o||"GET",options:{...n||{},...i}})})),(0,a.A)(this,"simpleRequest",(function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return(0,l.A)(I,t,O).call(t,{url:n,method:e,options:r})})),(0,a.A)(this,"requestWithBody",(function(e,n,r){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return(0,l.A)(I,t,O).call(t,{url:n,method:e,data:r,options:o})})),this.interceptors={request:new m,response:new m},null!=e&&e.adapter&&(0,u.A)(k,this,e.adapter)}getUrlWithParams(e,t){return E(e,t)}getBodyAndHeaders(e,t){return S(e,t)}get(e,t){return(0,l.A)(I,this,O).call(this,{url:e,method:"GET",options:t})}delete(e,t){return(0,l.A)(I,this,O).call(this,{url:e,method:"DELETE",options:t})}head(e,t){return(0,l.A)(I,this,O).call(this,{url:e,method:"HEAD",options:t})}post(e,t,n){return(0,l.A)(I,this,O).call(this,{url:e,method:"POST",data:t,options:n})}put(e,t,n){return(0,l.A)(I,this,O).call(this,{url:e,method:"PUT",data:t,options:n})}patch(e,t,n){return(0,l.A)(I,this,O).call(this,{url:e,method:"PATCH",data:t,options:n})}}function O(e){const t=[];let n=Promise.resolve(e);for(this.interceptors.request.forEach((e=>{t.push(e.fulfilled,e.rejected)})),t.push((e=>(0,c.A)(k,this).call(this,e)),void 0),this.interceptors.response.forEach((n=>{t.push((t=>{var r;return null===(r=n.fulfilled)||void 0===r?void 0:r.call(n,t,e)}),(t=>{var r;return null===(r=n.rejected)||void 0===r?void 0:r.call(n,t,e)}))})),t.push((t=>{var n;return"response"===(null===(n=e.options)||void 0===n?void 0:n.observe)?t:t.data}),void 0);t.length;)n=n.then(t.shift(),t.shift());return n}let T=new P;function C(e){T=new P(e)}var x;let R,_;const{dll:L}=window;R=L&&null!==(x=window.BRICK_NEXT_VERSIONS)&&void 0!==x&&null!==(x=x["brick-container"])&&void 0!==x&&x.startsWith("2.")&&(_=L("JxWY"))?_:r;const{fetch:B,HttpFetchError:M,HttpResponseError:$,HttpParseError:N,HttpAbortError:U,http:F,isHttpAbortError:j,createHttpInstance:D,defaultAdapter:V}=R},7472:(e,t,n)=>{n.r(t),n.d(t,{i18n:()=>d,i18nText:()=>u,initializeI18n:()=>c});var r=n(9969),o=n(832),i=n(7072);let s=!1;const a=new Set;function c(e,t){if(s||(s=!0,o.i18n.use(i.default).init({fallbackLng:"zh",debug:!1,supportedLngs:["zh","en"],nonExplicitSupportedLngs:!0,interpolation:{escapeValue:!1},react:{useSuspense:!1},compatibilityJSON:"v3",resources:{}})),e&&t&&!a.has(e)){a.add(e);for(const[n,r]of Object.entries(t))o.i18n.addResourceBundle(n,e,r)}}var l=n(4113);function u(e){if(!e)return;const t=o.i18n.language??"zh-CN";if((0,l.hasOwnProperty)(e,t))return e[t];const n=t.split("-")[0];if(n!==t)return(0,l.hasOwnProperty)(e,n)?e[n]:void 0;const r=`${n}-`;for(const t of Object.keys(e))if(t.startsWith(r))return e[t]}const d=r.default},5774:(e,t,n)=>{n.r(t),n.d(t,{inject:()=>A,transform:()=>S,transformAndInject:()=>k});var r=n(1030),o=n(1894);let i=function(e){return e[e.Initial=0]="Initial",e[e.ExpectField=1]="ExpectField",e[e.ExpectOptionalBeginDefault=2]="ExpectOptionalBeginDefault",e[e.ExpectDefaultValue=3]="ExpectDefaultValue",e[e.ExpectOptionalBeginPipe=4]="ExpectOptionalBeginPipe",e[e.ExpectPipeIdentifier=5]="ExpectPipeIdentifier",e[e.ExpectOptionalBeginPipeParameter=6]="ExpectOptionalBeginPipeParameter",e[e.ExpectPipeParameter=7]="ExpectPipeParameter",e[e.ExpectPlaceholderEnd=8]="ExpectPlaceholderEnd",e}({}),s=function(e){return e.Raw="Raw",e.BeginPlaceHolder="BeginPlaceHolder",e.Field="Field",e.BeginDefault="BeginDefault",e.LiteralString="LiteralString",e.BeginPipe="BeginPipe",e.PipeIdentifier="PipeIdentifier",e.BeginPipeParameter="BeginPipeParameter",e.EndPlaceHolder="EndPlaceHolder",e.JsonValue="JsonValue",e}({}),a=function(e){return e[e.Array=0]="Array",e[e.Object=1]="Object",e[e.String=2]="String",e[e.Others=3]="Others",e}({});function c(e){return new RegExp(`(${[].concat(e).map((e=>(0,r.escapeRegExp)(e))).join("|")})\\{`)}function l(e){var t;const n=E(e),r=null===(t=n.match(e.beginPlaceholder))||void 0===t?void 0:t[0],o=r?n.indexOf(r):-1;if(o>=0&&r&&"{"!==n.charAt(o+r.length)){const t=e.cursor+o;o>0&&e.tokens.push({type:s.Raw,value:n.substring(0,o)}),e.tokens.push({type:s.BeginPlaceHolder,loc:{start:t,end:t+r.length},value:r.substring(0,r.length-1)}),e.cursor+=o+r.length,e.status=i.ExpectField}else e.tokens.push({type:s.Raw,value:n}),e.cursor=e.raw.length}function u(e){e.cursor+=E(e).match(/^[ \r\n\t]*/)[0].length}function d(e){const[t]=E(e).match(/^[\w.*[\]\-\u{80}-\u{10FFFF}]*/u);e.tokens.push({type:s.Field,value:t}),e.cursor+=t.length,e.status=i.ExpectOptionalBeginDefault}function p(e){"="===E(e).charAt(0)?(e.tokens.push({type:s.BeginDefault}),e.cursor+=1,e.status=i.ExpectDefaultValue):e.status=i.ExpectOptionalBeginPipe}function f(e){b(e,i.ExpectOptionalBeginPipe)}function h(e){"|"===E(e).charAt(0)?(e.tokens.push({type:s.BeginPipe}),e.cursor+=1,e.status=i.ExpectPipeIdentifier):e.status=i.ExpectPlaceholderEnd}function m(e){const t=E(e).match(/^[a-zA-Z]\w*/);if(!t)throw new Error(`Expected a pipe identifier at index ${e.cursor} near: ${JSON.stringify(e.raw.substring(e.cursor))}`);const n=t[0];e.tokens.push({type:s.PipeIdentifier,value:n}),e.cursor+=n.length,e.status=i.ExpectOptionalBeginPipeParameter}function g(e){":"===E(e).charAt(0)?(e.tokens.push({type:s.BeginPipeParameter}),e.cursor+=1,e.status=i.ExpectPipeParameter):e.status=i.ExpectOptionalBeginPipe}function v(e){b(e,i.ExpectOptionalBeginPipeParameter)}function y(e){if("}"!==E(e).charAt(0))throw new Error(`Expected a placeholder end '}' at index ${e.cursor} near: ${JSON.stringify(e.raw.substring(e.cursor))}`);e.tokens.push({type:s.EndPlaceHolder,loc:{start:e.cursor,end:e.cursor+1}}),e.cursor+=1,e.status=i.Initial}const w=new Map([["false",!1],["null",null],["true",!0]]);function b(e,t){const n=E(e);if(/[0-9[{"]/.test(n.charAt(0))||/-[0-9]/.test(n.substring(0,2)))!function(e,t){const n=E(e),r=n.charAt(0),o="["===r?a.Array:"{"===r?a.Object:'"'===r?a.String:a.Others;let i=0,c=0,l=0,u=!1,d=!1,p=!1;for(;i<n.length;){const e=n.charAt(i);if(d)d=!1;else if(u)'"'===e?u=!1:"\\"===e&&(d=!0);else switch(e){case"[":l+=1;break;case"{":c+=1;break;case"]":l-=1;break;case"}":c-=1;break;case'"':u=!0}switch(i+=1,o){case a.Array:p=!l;break;case a.Object:p=!c;break;case a.String:p=!u;break;default:p=i<n.length&&/[^a-z0-9E.+-]/.test(n.charAt(i))}if(p)break}if(!p)throw new Error(`Failed to match a JSON value at index ${e.cursor} near: ${JSON.stringify(e.raw.substring(e.cursor))}`);e.tokens.push({type:s.JsonValue,value:JSON.parse(n.substring(0,i))}),e.cursor+=i,e.status=t}(e,t);else{const[n]=E(e).match(/^[\w\-\u{80}-\u{10FFFF}]*/u);w.has(n)?e.tokens.push({type:s.JsonValue,value:w.get(n)}):e.tokens.push({type:s.LiteralString,value:n}),e.cursor+=n.length,e.status=t}}function E(e){return e.raw.substring(e.cursor)}function S(e,t){return I(e,"@",t)}function A(e,t){return I(e,"$",t)}function k(e,t){return I(e,["@","$"],t)}function I(e,t,n){if(!function(e,t){return c(t).test(e)}(e,t))return e;const a=(w=n.data,function(e){let t=e.field?(0,r.get)(w,e.field):w;return void 0===t&&(t=e.defaultValue),(0,o.processPipes)(t,e.pipes)});var w;const b=function(e,t){return function(n){const i=n.field.match(/^(?:(QUERY(?:_ARRAY)?|EVENT|query|event|APP|HASH|ANCHOR|SYS|FLAGS|CTX)\.)?(.+)$/);if(!i)return t.substring(n.loc.start,n.loc.end);let s,[,a,c]=i;!a&&/^[A-Z_]+$/.test(c)&&(a=c,c="*");const l={SYS:"sys",FLAGS:"flags"};switch(a){case"QUERY":case"query":s="*"===c?e.query:e.query.has(c)?e.query.get(c):void 0;break;case"QUERY_ARRAY":s=e.query.has(c)?e.query.getAll(c):void 0;break;case"EVENT":case"event":if(void 0===e.event)return t.substring(n.loc.start,n.loc.end);s="*"===c?e.event:(0,r.get)(e.event,c);break;case"APP":s="*"===c?e.overrideApp??e.app:(0,r.get)(e.overrideApp??e.app,c);break;case"HASH":s=e.location.hash;break;case"SYS":case"FLAGS":s="*"===c?e[l[a]]:(0,r.get)(e[l[a]],c);break;case"ANCHOR":{const t=e.location.hash?e.location.hash.substr(1):null;s="*"===c?t:(0,r.get)(t,c);break}case"CTX":{const e=t.substring(n.loc.start,n.loc.end);return console.error(`CTX is not supported in placeholder any more: "${e}"`),e}default:if(!e.match)return t.substring(n.loc.start,n.loc.end);s=e.match.params[c]}return void 0===s&&(s=n.defaultValue),(0,o.processPipes)(s,n.pipes)}}(n,e);return E=function(e,t){return function(e){const t={type:"InjectableString",elements:[]};let n;function r(t){return t===e[0].type&&(n=e.shift(),!0)}function o(t){if(n=e.shift(),Array.isArray(t)?!t.includes(n.type):t!==n.type)throw new Error(`Expected token: ${t}, received token: ${n.type}`)}for(;e.length>0;)if(r(s.Raw))t.elements.push({type:"RawString",value:n.value});else{o(s.BeginPlaceHolder);const e=n.loc.start,i=n.value;o(s.Field);const a={type:"Placeholder",symbol:i,field:n.value,defaultValue:void 0,pipes:[],loc:{start:e,end:e}};for(t.elements.push(a),r(s.BeginDefault)&&(o([s.JsonValue,s.LiteralString]),a.defaultValue=n.value);r(s.BeginPipe);){o(s.PipeIdentifier);const e={type:"PipeCall",identifier:n.value,parameters:[]};for(a.pipes.push(e);r(s.BeginPipeParameter);)o([s.JsonValue,s.LiteralString]),e.parameters.push(n.value)}o(s.EndPlaceHolder),a.loc.end=n.loc.end}return t}(function(e,t){const n={beginPlaceholder:c(t),raw:e,cursor:0,status:i.Initial,tokens:[]};for(;n.cursor<e.length;)switch(n.status){case i.Initial:l(n);break;case i.ExpectField:u(n),d(n);break;case i.ExpectOptionalBeginDefault:u(n),p(n);break;case i.ExpectDefaultValue:u(n),f(n);break;case i.ExpectOptionalBeginPipe:u(n),h(n);break;case i.ExpectPipeIdentifier:u(n),m(n);break;case i.ExpectOptionalBeginPipeParameter:u(n),g(n);break;case i.ExpectPipeParameter:u(n),v(n);break;case i.ExpectPlaceholderEnd:u(n),y(n)}if(n.status!==i.Initial)throw new Error("Expected a placeholder end '}' at the end");return n.tokens}(e,t))}(e,t).elements.map((e=>"RawString"===e.type?e.value:"$"===e.symbol?b(e):a(e))),1===E.length?E[0]:E.join("");var E}},7457:(e,t,n)=>{n.r(t),n.d(t,{enqueueStableLoadBricks:()=>p,enqueueStableLoadProcessors:()=>f,flushStableLoadBricks:()=>d,loadBricksImperatively:()=>h,loadEditorsImperatively:()=>g,loadProcessorsImperatively:()=>m,loadScript:()=>i,loadSharedModule:()=>a,loadStyle:()=>s});const r=new Map;function o(e,t,n,i){if(Array.isArray(t))return Promise.all(t.map((t=>o(e,t,n))));const s=n&&!/^https?:/.test(t)?`${n}${t}`:t,a=r.get(s);if(a)return a;const c=new Promise(((t,n)=>{const r=()=>{window.dispatchEvent(new Event("request.end"))},o=document.createElement("style"===e?"link":"script");"script"===e?Object.assign(o,{type:"text/javascript",async:!0,...i,src:s}):Object.assign(o,{rel:"stylesheet",...i,href:s}),o.onload=()=>{t(s),r()},o.onerror=e=>{n(e),r()};const a=document.currentScript||document.getElementsByTagName("script")[0];a.parentNode.insertBefore(o,a),window.dispatchEvent(new Event("request.start"))}));return r.set(s,c),c}function i(e,t,n){return o("script",e,t,n)}function s(e,t,n){return o("style",e,t,n)}async function a(e,t){await n.I("default");const r=window[e];return await r.init(n.S.default),(await r.get(t))()}let c,l=!1;const u=new Promise((e=>{c=e}));function d(){l||c()}function p(e,t){return A(S("bricks",e,t))}function f(e,t){return A(S("processors",e,t))}async function h(e,t){const n=S("bricks",e,t);return d(),A(n)}function m(e,t){const n=S("processors",e,t);return d(),A(n)}function g(e,t){const n=S("editors",e,t);return d(),A(n)}let v;const y="v2-adapter.load-bricks";function w(e,t,n){const r=new Map,o=new Set,i=t=>{var s;if(o.has(t))return;let a,c,l;if(o.add(t),"processors"===e||t.includes(".")){[c,l]=t.split(".");const r=`bricks/${"processors"===e?(f=c,f.replace(/[A-Z]/g,(e=>`-${e[0].toLocaleLowerCase()}`)).replace(/_[0-9]/g,(e=>`-${e[1]}`))):c}`;a=n.get(r)}else if("editors"===e){l=t;for(const e of n.values()){var u;null!==(u=e.propertyEditors??e.editors)&&void 0!==u&&u.some((e=>e===l))&&(a=e)}}else{let e;l=t;for(const r of n.values()){var d;if(null!==(d=r.elements)&&void 0!==d&&d.some((e=>e===l))){var p;if(null===(p=r.deprecatedElements)||void 0===p||!p.includes(t)){a=r;break}e=r}}!a&&e&&(a=e)}var f;if(!a)return void console.error(`Package for ${t} not found.`);let h=r.get(a);h||(h=[],r.set(a,h)),h.push({fullName:t,lastName:l});const m=null===(s=a.dependencies)||void 0===s?void 0:s[t];if(m)for(const e of m)i(e)};for(const e of t)i(e);return r}async function b(e,t,n){const r=`${"processors"===e||"editors"===e?`./${e}/`:"./"}${n.lastName}`;try{await a(t,r)}catch(t){throw console.error(t),new Error(`Load ${e} of "${n.fullName}" failed`)}}function E(e,t,n){return t.map((async t=>(await i(t.filePath,window.PUBLIC_ROOT??""),await u,Promise.all(n.get(t).map((n=>b(e,t.id,n)))))))}async function S(e,t,n){const r=new Map;for(const e of n){const t=e.id??k(e.filePath);r.set(t,e)}const o=w(e,t,r);let s;const a=[],u=[];let d;for(const e of o.keys())if(e.id)"bricks/basic"===e.id?s=e:u.push(e);else if(a.push(e),d=r.get("bricks/v2-adapter"),!d)throw new Error("Using v2 bricks, but v2-adapter not found");const p=d;let f;const h=s;if(h){const t=i(h.filePath,window.PUBLIC_ROOT??"");l||(l=!0,t.then((()=>Promise.resolve())).then(c)),f=t.then((()=>Promise.all(o.get(h).map((t=>b(e,h.id,t))))))}const m=[f].concat(E(e,u,o));if(p&&a.length>0){if(!v){const e=w("bricks",[y],r),t=[...e.keys()];v=(async()=>(await Promise.all(E("bricks",t,e)),document.createElement(y)))()}m.push(v.then((t=>Promise.all(a.map((r=>{const i=k(r.filePath).split("/")[1];return t.resolve(p.filePath,"editors"===e?r.propertyEditorsJsFilePath??r.filePath:r.filePath,"bricks"===e?o.get(r).map((e=>`${i}.${e.lastName}`)):[],r.dll,n)}))))))}await Promise.all(m)}async function A(e){window.dispatchEvent(new Event("request.start"));try{await e}finally{window.dispatchEvent(new Event("request.end"))}}function k(e){return e.split("/").slice(0,2).join("/")}},6605:(e,t,n)=>{n.r(t),n.d(t,{pipes:()=>r.pipes,processPipes:()=>i,utils:()=>r.utils});var r=n(161);const o=new Map(Array.from(Object.entries(r.pipes)));function i(e,t){if(0===t.length)return e;let n=e;for(const e of t){const t=o.get(e.identifier);if(!t)return void console.warn(`Unknown pipe: ${e.identifier}`);n=t(n,...e.parameters)}return n}},8967:(e,t,n)=>{n.r(t),n.d(t,{Dialog:()=>$t,Notification:()=>Ht,StoryboardFunctionRegistryFactory:()=>fe,__secret_internals:()=>r,__test_only:()=>{},applyTheme:()=>te,authenticate:()=>_o,batchSetAppsLocalTheme:()=>ne,checkIfByTransform:()=>pt,checkIfOfComputed:()=>dt,createHistory:()=>I,createRuntime:()=>bo,customEditors:()=>No,customProcessors:()=>L,customTemplates:()=>xe,fetchByProvider:()=>Uo,getAuth:()=>Lo,getBasePath:()=>m,getCssPropertyValue:()=>ce,getCurrentMode:()=>se,getCurrentTheme:()=>ee,getHistory:()=>P,getPageInfo:()=>Wr,getRealValue:()=>jo,getRuntime:()=>Eo,getV2RuntimeFromDll:()=>k,handleHttpError:()=>Wt,httpErrorToString:()=>Ut,isLoggedIn:()=>Mo,isUnauthenticatedError:()=>Ft,logout:()=>Bo,matchPath:()=>St,registerWidgetFunctions:()=>Me,registerWidgetI18n:()=>N,setUIVersion:()=>qr,unstable_createRoot:()=>Fo});var r={};n.r(r),n.d(r,{addRealTimeDataInspectHook:()=>mr,debugDataValue:()=>ur,getAddedContracts:()=>lr,getAllContextValues:()=>or,getBrickPackagesById:()=>ir,getContextValue:()=>rr,getLegalRuntimeValue:()=>dr,getRenderId:()=>cr,legacyDoTransform:()=>Kn,loadBricks:()=>sr,loadEditors:()=>ar,mountUseBrick:()=>Gn,renderUseBrick:()=>qn,setRealTimeDataInspectRoot:()=>hr,symbolForRootRuntimeContext:()=>Hn,unmountUseBrick:()=>zn,updateSnippetPreviewSettings:()=>tr,updateStoryboard:()=>Jn,updateStoryboardByRoute:()=>Xn,updateStoryboardBySnippet:()=>er,updateStoryboardByTemplate:()=>Yn,updateTemplatePreviewSettings:()=>Qn});var o=n(4635),i=n(4586),s=n(918),a=n(2559),c=n(6121),l=n(829),u=n(832),d=n(3256),p=n(4113),f=n(1302),h=(n(6036),n(2890));function m(){const e=document.querySelector("base");return e?e.getAttribute("href"):"/"}var g=n(1030);function v(e,t){const n=(0,g.orderBy)(e,(e=>{var t;return(null===(t=e.app.homepage)||void 0===t?void 0:t.length)??0}),"desc");for(const e of n){const n=e.app.homepage;if("string"==typeof n&&"/"===n[0]&&y(n,t))return e}}function y(e,t){return"/"===e?t===e:`${t.replace(/\/+$/,"")}/`.startsWith(`${e.replace(/\/+$/,"")}/`)}function w(e){var t;return!e||(null===(t=Eo().getCurrentApp())||void 0===t?void 0:t.id)!==e.app.id&&!window.STANDALONE_MICRO_APPS&&e.app.standaloneMode}let b,E=!1;function S(e,t){E=!confirm(e),t(!E)}function A(e){const{push:t,replace:n}=e;function r(r){return function(o,i,s){let a;const c="string"==typeof o;return a=c?(0,h.parsePath)(o).pathname:o.pathname,"string"==typeof a&&a.startsWith("/")&&w(function(e){var t;return v((null===(t=go)||void 0===t?void 0:t.storyboards)??[],e)}(a))?location["push"===r?"assign":"replace"](c?m()+o.substring(1):e.createHref(o)):("push"===r?t:n)(o,i,s)}}return{push:r("push"),replace:r("replace")}}function k(){var e;const{dll:t}=window;if(t&&null!==(e=window.BRICK_NEXT_VERSIONS)&&void 0!==e&&null!==(e=e["brick-container"])&&void 0!==e&&e.startsWith("2."))return t("tYg3")}function I(){if(!b){const e=(0,h.createBrowserHistory)({basename:m().replace(/\/$/,""),getUserConfirmation:S});Object.assign(e,function(e){const{push:t,replace:n}=e;function r(e,n,r){E=!1,t(e,n),null==r||r(E)}function o(e,t,r){E=!1,n(e,t),null==r||r(E)}function i(t){return function(n){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2?arguments[2]:void 0;const{extraQuery:a,clear:c,keepHash:l,...u}=i,d=new URLSearchParams(c?"":e.location.search),p={};Object.assign(p,n,a);for(const[e,t]of Object.entries(p))if(Array.isArray(t)){d.delete(e);for(const n of t)d.append(e,n)}else null==t||""===t?d.delete(e):d.set(e,t);("push"===t?r:o)(`?${d.toString()}${l?e.location.hash:""}`,u,s)}}let s;return{pushQuery:i("push"),replaceQuery:i("replace"),pushAnchor:function(t,n,o){r({...e.location,key:void 0,hash:t,state:{notify:!1,...n}},void 0,o)},reload:function(t){o({...e.location,state:{...e.location.state,notify:!0,noIncremental:!0}},void 0,t)},setBlockMessage:function(e){s=e},getBlockMessage:function(){return s},unblock:function(){s=void 0},...A({...e,push:r,replace:o})}}(e)),b=e}return b}const P=function(){const e=k();if(e)return e.getHistory}()||function(){return b};var O=n(7551),T=n(971),C=n(5069),x=n(9737),R=n(5074),_=new WeakMap;const L=function(){const e=k();if(e)return Object.freeze({define:(t,n)=>e.getRuntime().registerCustomProcessor(t,n)})}()||new class{constructor(){(0,s.A)(this,_,new Map)}define(e,t){const[n,r]=e.split(".");let o=(0,l.A)(_,this).get(n);if(o||(o=new Map,(0,l.A)(_,this).set(n,o)),o.has(r))throw new Error(`Custom processor of "${e}" already registered`);o.set(r,t)}get(e){return(0,l.A)(_,this).get(e)}};function B(e){let{app:t,meta:n}=e;if(null!=n&&n.i18n){const e=M("app",t.id),r=[];return Object.entries(n.i18n).forEach((t=>{let[n,o]=t;u.i18n.addResourceBundle(n,e,o),r.push(n)})),()=>{for(const t of r)u.i18n.removeResourceBundle(t,e)}}}function M(e,t){return`${e}/${t}`}function $(e){return u.i18n.getFixedT(null,M("widget",e))}const N=function(){const e=k();if(e)return function(t,n){return e.getRuntime().registerWidgetI18n(t,n)}}()||function(e,t){const n=M("widget",e);Object.entries(t).forEach((e=>{let[t,r]=e;u.i18n.addResourceBundle(t,n,r)}))},U="brick-next-devtools-panel",F="devtools-frame-active-change",j="devtools-panel-change";let D,V=!0;function W(e,t){const n=H();if(!n||"evaluation"===e&&(!V||D&&"Evaluations"!==D))return;const r=()=>{var r;null===(r=n.emit)||void 0===r||r.call(n,{type:e,payload:t})};"function"==typeof window.requestIdleCallback?window.requestIdleCallback(r):setTimeout(r,0)}function H(){return window.__BRICK_NEXT_DEVTOOLS_HOOK__}const q=()=>{throw new Error("Can't modify read-only proxy object")},G={set:q,defineProperty:q,deleteProperty:q,setPrototypeOf:q};function z(e){return new Proxy(e,G)}function K(e){let{get:t,ownKeys:n}=e;return H()?z(Object.fromEntries(n(null).map((e=>[e,t(null,e,null)])))):new Proxy(Object.freeze({}),{get:t})}let J="light";const X=new p.JsonStorage(localStorage),Y="apps-theme";function Q(e){if("dark"!==e&&"light"!==e&&"dark-v2"!==e)throw new Error(`Unsupported theme: ${e}`);J=e}function Z(){return J}function ee(){return document.documentElement.dataset.theme}function te(e){e?Q(e):e=Z(),e!==ee()&&(document.documentElement.dataset.theme=e,window.dispatchEvent(new CustomEvent("theme.change",{detail:e})))}function ne(e){X.setItem(Y,{...re(),...e})}function re(){let e;try{e=X.getItem(Y)}catch{console.error("JSON parse error inside `getLocalAppsTheme()`")}return e??{}}let oe="default";function ie(e){if("dashboard"!==e&&"default"!==e)throw new Error(`Unsupported mode: ${e}`);oe=e}function se(){return document.documentElement.dataset.mode}function ae(e){e?ie(e):e=oe,e!==se()&&(document.documentElement.dataset.mode=e,window.dispatchEvent(new CustomEvent("mode.change",{detail:e})))}function ce(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document.documentElement;return n&&(null===(t=window.getComputedStyle(n))||void 0===t?void 0:t.getPropertyValue(e))||""}function le(e,t){const n={};for(const r of e){const e=ue(r,t);void 0!==e&&(n[r]=e)}return n}function ue(e,t){var n,r,o;let{collectCoverage:i,widgetId:s,widgetVersion:a,app:c,appendI18nNamespace:l,storyboardFunctions:d,isStoryboardFunction:p}=t;switch(e){case"BASE_URL":return i?"/next":m().replace(/\/$/,"");case"FN":return d;case"IMG":return i?{get:e=>`mock/images/${e}`}:s?null==wo||null===(n=wo.images)||void 0===n?void 0:n.widgetImagesFactory(s,a):null==wo||null===(r=wo.images)||void 0===r?void 0:r.imagesFactory(c.id,c.isBuildPush,c.currentVersion);case"I18N":return i?g.identity:s?$(s):u.i18n.getFixedT(null,[l,M("app",c.id)].filter(Boolean));case"I18N_TEXT":return i?de:u.i18nText;case"PERMISSIONS":return z({check:i?pe:null==wo||null===(o=wo.checkPermissions)||void 0===o?void 0:o.checkPermissions});case"THEME":return z({getTheme:i?()=>"light":Z});case"console":return p?z(console):void 0;case"location":return i?{href:"http://localhost:3000/functions/test",origin:"http://localhost:3000",host:"localhost:3000",hostname:"localhost"}:{href:location.href,origin:location.origin,host:location.host,hostname:location.hostname}}}function de(e){return null==e?void 0:e.en}function pe(){return!0}function fe(){let{widgetId:e,widgetVersion:t,collectCoverage:n,debuggerOverrides:r}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const o=new Map,i=null==r?void 0:r({precookFunction:T.precookFunction,cook:T.cook,supply:R.supply}),s=new Proxy(Object.freeze({}),{get:(c,l)=>function(c){const l=o.get(c);if(!l)return;if(l.processed)return l.cooked;let u;n&&(u=n.createCollector(c));const d=(0,T.precookFunction)(l.source,{typescript:l.typescript,hooks:u&&{beforeVisit:u.beforeVisit}}),p=(0,R.supply)(d.attemptToVisitGlobals,le(d.attemptToVisitGlobals,{collectCoverage:n,widgetId:e,widgetVersion:t,app:a,storyboardFunctions:s,isStoryboardFunction:!0}),!!n);return l.cooked=(0,T.cook)(d.function,l.source,{rules:{noVar:!0},globalVariables:i?{...p,...null!=i&&i.LodashWithStaticFields&&d.attemptToVisitGlobals.has("_")?{_:{...p._,...i.LodashWithStaticFields}}:null,...null!=i&&i.ArrayConstructor&&d.attemptToVisitGlobals.has("Array")?{Array:i.ArrayConstructor}:null,...null!=i&&i.ObjectWithStaticFields&&d.attemptToVisitGlobals.has("Object")?{Object:{...p.Object,...i.ObjectWithStaticFields}}:null}:p,ArrayConstructor:null==i?void 0:i.ArrayConstructor,hooks:u&&{beforeEvaluate:u.beforeEvaluate,beforeCall:u.beforeCall,beforeBranch:u.beforeBranch},debug:!!r}),l.processed=!0,l.cooked}(l)});let a;return{storyboardFunctions:s,registerStoryboardFunctions:function(e,t){if(t&&(a=t),o.clear(),Array.isArray(e))for(const t of e){const e=(0,C.collectMemberUsageInFunction)(t,"FN",!!n),r=(0,C.collectMemberUsageInFunction)(t,"PERMISSIONS",!!n).has("check");o.set(t.name,{source:t.source,typescript:t.typescript,deps:e,hasPermissionsCheck:r})}},updateStoryboardFunction(e,t){const n={...t,name:e},r=(0,C.collectMemberUsageInFunction)(n,"FN",!0),i=(0,C.collectMemberUsageInFunction)(n,"PERMISSIONS",!0).has("check");o.set(e,{source:t.source,typescript:t.typescript,deps:r,hasPermissionsCheck:i})},checkPermissionsUsage(e){const t=new Set,n=e=>{if(!t.has(e)){t.add(e);const r=o.get(e);return!!r&&(r.hasPermissionsCheck||[...r.deps].some(n))}return!1};return e.some(n)},clearGlobalExecutionContextStack(){(0,T.__dev_only_clearGlobalExecutionContextStack)()},getGlobalExecutionContextStack:()=>(0,T.__dev_only_getGlobalExecutionContextStack)()}}const{storyboardFunctions:he,registerStoryboardFunctions:me,checkPermissionsUsage:ge}=fe();var ve=n(3601);let ye=function(e){return e.xLarge="xLarge",e.large="large",e.medium="medium",e.small="small",e.xSmall="xSmall",e}({});const we=new Map([[ye.xLarge,"1920px"],[ye.large,"1600px"],[ye.medium,"1280px"],[ye.small,"1024px"],[ye.xSmall,0]]),be=new ve.A,Ee={},Se={};function Ae(e,t){let n=!1;Ee[t]=e.matches;for(const[e]of we)if(Ee[e]&&Se.breakpoint!==e){Se.breakpoint=e,n=!0;break}n&&be.dispatchEvent(new CustomEvent("change",{detail:Se}))}we.forEach(((e,t)=>{const n=window.matchMedia(`(min-width: ${e})`);Ae(n,t),n.addEventListener?n.addEventListener("change",(e=>{Ae(e,t)})):n.addListener((e=>{Ae(e,t)}))}));const ke=()=>Se;function Ie(e){return function(t){const n="local"===e?localStorage:sessionStorage;return JSON.parse(n.getItem(t)??"null")}}function Pe(e){var t,n;return!(null===(t=e?e.flags:null===(n=Eo())||void 0===n?void 0:n.getFeatureFlags())||void 0===t||!t["brick-next-v3-strict-mode"])}function Oe(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];const i=0===r.length?"":",";e?console.error(`${t} is dropped in v3 strict mode${i}`,...r):console.warn(`${t} is deprecated in v3 and will be dropped in strict mode${i}`,...r)}const Te=new Set(["prefix"]);var Ce=new WeakMap;const xe=function(){const e=k();if(e)return Object.freeze({define:(t,n)=>e.getRuntime().registerCustomTemplate(t,n)})}()||new class{constructor(){(0,s.A)(this,Ce,new Map)}define(e,t){var n,r;let o=(0,l.A)(Ce,this).has(e);o?console.warn(`Custom template of "${e}" already registered.`):(o=!!customElements.get(e),o&&console.warn(`Custom template of "${e}" already defined by customElements.`));const i=Pe(),s=(null===(n=t.proxy)||void 0===n?void 0:n.properties)??{},a=[],c=[];for(const[t,n]of Object.entries(s))n.asVariable?(Oe(i,"Template `asVariable`",e,t),i||c.push(t)):n.mergeProperty||n.refTransform?console.error("Template `mergeProperty` and `refTransform` are dropped in v3:",e,t):n.ref&&a.push([t,n]);const u={...t,proxy:{...t.proxy,properties:Object.fromEntries(a)},state:(t.state?i?t.state:t.state.map((e=>({expose:!0,...e}))):[]).concat(c.map((e=>({name:e,expose:!0}))))};(0,l.A)(Ce,this).set(e,{...u,name:e});const d=(p=u.state,(0,g.uniq)((null==p?void 0:p.filter((e=>e.expose)).map((e=>e.name)))??[]));var p;const f=Object.entries((null===(r=u.proxy)||void 0===r?void 0:r.methods)??{}),h=d.concat(a.map((e=>e[0]))),m=f.map((e=>e[0])),v=h.concat(m).filter((e=>e in HTMLElement.prototype&&!Te.has(e)));if(v.length>0&&(Oe(i,"Using native HTMLElement properties as template properties or methods",e,...v),i))throw new Error(`In custom template "${e}", ${v.map((e=>`"${e}"`)).join(", ")} are native HTMLElement properties, and should be avoid to be used as brick properties or methods.`);if(!o){class t extends HTMLElement{get $$typeof(){return"custom-template"}static get _dev_only_definedProperties(){return h}static get _dev_only_definedMethods(){return m}$$getElementByRef(e){var t;return null===(t=this.$$tplStateStore)||void 0===t||null===(t=t.hostBrick)||void 0===t||null===(t=t.tplHostMetadata)||void 0===t||null===(t=t.internalBricksByRef.get(e))||void 0===t?void 0:t.element}connectedCallback(){let e=this.shadowRoot;e||(e=this.attachShadow({mode:"open"}));const t=document.createDocumentFragment(),n=document.createElement("style");n.textContent=":host{display:block}:host([hidden]){display:none}";const r=document.createElement("slot");t.appendChild(n),t.appendChild(r),e.appendChild(t)}disconnectedCallback(){this.shadowRoot&&(this.shadowRoot.textContent="")}}for(const n of d)a.some((e=>e[0]===n))?console.error(`Cannot define an exposed state that is also a proxy property: "${n}" in ${e}`):Object.defineProperty(t.prototype,n,{get(){return this.$$tplStateStore.getValue(n)},set(e){var t;null===(t=this.$$tplStateStore)||void 0===t||t.updateValue(n,e,"replace")},enumerable:!0});for(const[e,n]of a)Object.defineProperty(t.prototype,e,{get(){return this.$$getElementByRef(n.ref)[n.refProperty??e]},set(t){var r;const o=null===(r=this.$$getElementByRef)||void 0===r?void 0:r.call(this,n.ref);o&&(o[n.refProperty??e]=t)},enumerable:!0});for(const[e,n]of f)Object.defineProperty(t.prototype,e,{value(){this.$$getElementByRef(n.ref)[n.refMethod??e](...arguments)},enumerable:!0});customElements.define(e,t)}}get(e){return(0,l.A)(Ce,this).get(e)}};function Re(e,t,n){let{tplStateStoreId:r,tplStateStoreMap:o}=e;if(!r)throw new Error(`Using "${t}" outside of a custom template${n??""}`);const i=o.get(r);if(!i)throw new Error(`Template state store is not found when using "${t}"${n??""}.\nThis is a bug of Brick Next, please report it.`);return i}function _e(e,t,n){const r=Re(e,t,n).hostBrick.element;if(!r)throw new Error(`Template host element is gone when using "${t}"${n??""}.\nThis is a bug of Brick Next, please report it.`);return r}const Le=new Map,Be=new Proxy(Object.freeze({}),{get:(e,t)=>Le.get(t)}),Me=function(){const e=k();if(e)return function(t,n,r){return e.getRuntime().registerWidgetFunctions(t,n,r)}}()||function(e,t,n){if(Le.has(e))throw new Error(`Widget functions of "${e}" already registered`);const{storyboardFunctions:r,registerStoryboardFunctions:o}=fe({widgetId:e,widgetVersion:n});Le.set(e,r),o(t)};var $e=n(5462);function Ne(e,t){let n=Ro(e);if(!n&&null!=wo&&wo.checkInstalledApps&&(n=wo.checkInstalledApps.getCheckedApp(e)),!n||"running"===n.installStatus)return!1;if(!t||!n.currentVersion)return!0;const r=t.match(/^([><]=?|=)(.*)$/);try{if(!r)throw new TypeError(`Invalid match version: ${t}`);return(0,$e.U)(n.currentVersion,r[2],r[1])}catch(e){console.error(e)}return!1}function Ue(e,t,n){let{formStateStoreId:r,formStateStoreMap:o}=e;if(!r)throw new Error(`Using "${t}" outside of form renderer${n??""}`);const i=o.get(r);if(!i)throw new Error(`Form state store is not found when using "${t}"${n??""}.\nThis is a bug of Brick Next, please report it.`);return i}const Fe=new Map;async function je(e){var t;const n=null==wo||null===(t=wo.flowApi)||void 0===t?void 0:t.isFlowApiProvider(e);n&&(e=wo.flowApi.FLOW_API_PROVIDER);let r=Fe.get(e);if(r)return r;if(e.includes("-")&&!customElements.get(e))if(n)wo.flowApi.registerFlowApiProvider();else if(await(0,d.loadBricksImperatively)([e],Oo()),!customElements.get(e))throw new Error(`Provider not defined: "${e}".`);return r=document.createElement(e),Fe.set(e,r),r}let De=new WeakSet;function Ve(e){if((0,p.isObject)(e)&&!We(e))if(De.add(e),Array.isArray(e))e.forEach(Ve);else{const t=Object.getPrototypeOf(e);t&&t.constructor!==Object||Object.values(e).forEach(Ve)}}function We(e){return De.has(e)}const He=new Map;async function qe(e,t,n){const{useProvider:r,method:o="resolve",args:i=[],onReject:s}=e,{provider:a,field:c}=e;if(a&&!r)throw new Error(`You're using "provider: ${a}" which is dropped in v3, please use "useProvider" instead`);const l=null!=c;if(l){const e=Pe();if(Oe(e,"`resolve.field`"),e)throw new Error("Using deprecated `resolve.field`")}const[u,d]=await Promise.all([je(r),it(i,t)]),p=null==n?void 0:n.renderId,f=Ge(u,r,o,d,n,i,!!p&&p!==To());let h,{transform:m}=e;try{const e=await f;h=l?(0,g.get)(e,c):e,Ve(h)}catch(e){if(!function(e){return!(null==e||!e.transform)}(s))throw e;m=s.transform,h=e}return m?"string"==typeof m?{[m]:h}:it(m,{...t,data:h}):h}async function Ge(e,t,n,r,o,i,s){let a,c;try{a=JSON.stringify({useProvider:t,method:n,args:r})}catch(e){if(!i)throw e;a=JSON.stringify({useProvider:t,method:n,originalArgs:i})}return"reload"!==(null==o?void 0:o.cache)&&(c=He.get(a)),c||(c=(async o=>{const i=null!=wo&&null!==(o=wo.flowApi)&&void 0!==o&&o.isFlowApiProvider(t)?await wo.flowApi.getArgsOfFlowApi(t,r,n):r;return e[n](...i)})(),s||He.set(a,c)),c}const ze=Symbol.for("pre.evaluated.raw"),Ke=Symbol.for("pre.evaluated.context");function Je(e){return!(null==e||!e[ze])}function Xe(e){return e[ze]}function Ye(e){return"string"==typeof e?(0,T.shouldAllowRecursiveEvaluations)(e):(0,T.shouldAllowRecursiveEvaluations)(e[ze])}const Qe=new WeakSet([SyntaxError,TypeError,ReferenceError]);function Ze(e){return Qe.has(e.constructor)?e.constructor:TypeError}function et(e,t,n){const{run:r}=tt(e,t,n,!1);return r()}function tt(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;const o=[];if("string"!=typeof e){const n=(0,g.omit)(t,["pendingPermissionsPreCheck","tplStateStoreMap","tplStateStoreScope","formStateStoreMap","formStateStoreScope"]);t={...e[Ke],...n},e=e[ze]}const i={usedArgs:new Set},s={usedArgs:new Set};let a;try{a=(0,T.preevaluate)(e,{withParent:!0,hooks:{beforeVisitGlobal(e,t){(0,C.collectAppGetMenuUsage)(i,e,t),(0,C.collectInstalledAppsHasUsage)(s,e,t)}}})}catch(t){const n=`${t.message}, in "${e}"`;throw new(Ze(t))(n)}if(i.hasNonStaticUsage)throw new Error(`Non-static usage of "APP.getMenu" is prohibited in v3, check your expression: "${e}"`);if(s.hasNonStaticUsage)throw new Error(`Non-static usage of "INSTALLED_APPS.has" is prohibited in v3, check your expression: "${e}"`);const c={},{attemptToVisitGlobals:l}=a;if(n.lazy||l.has("EVENT")&&!(0,p.hasOwnProperty)(t,"event")||l.has("DATA")&&!(0,p.hasOwnProperty)(t,"data"))return{blockingList:o,run:()=>Object.keys(t).length>0?{[ze]:e,[Ke]:t}:e};let u,f,h,m;const v=Pe(t);let y,w;(l.has("STATE")||!v&&l.has("TPL"))&&(m=Re(t,"STATE",`: "${e}"`)),l.has("FORM_STATE")&&(w=Ue(t,"FORM_STATE",`: "${e}"`));const b=H();if(r||b){if(l.has("CTX")&&(u=(0,C.strictCollectMemberUsage)(e,"CTX"),r&&o.push(t.ctxStore.waitFor(u))),m){if(h=(0,C.strictCollectMemberUsage)(e,"STATE"),!v){const t=(0,C.strictCollectMemberUsage)(e,"TPL");for(const e of t)h.add(e)}r&&o.push(m.waitFor(h))}w&&(y=(0,C.strictCollectMemberUsage)(e,"FORM_STATE"),r&&o.push(w.waitFor(y))),l.has("PROCESSORS")&&(f=(0,C.strictCollectMemberUsage)(e,"PROCESSORS",2),r&&o.push((0,d.loadProcessorsImperatively)(f,Oo())))}if(r){let n=l.has("PERMISSIONS");if(!n&&l.has("FN")){const t=[...(0,C.strictCollectMemberUsage)(e,"FN")];n=ge(t)}if(n&&o.push(...t.pendingPermissionsPreCheck),i.usedArgs.size>0&&null!=wo&&wo.menu){const e=[...i.usedArgs];o.push(Promise.all(e.map((e=>wo.menu.fetchMenuById(e,t,{getStoryboardByAppId:xo,resolveData:qe,asyncComputeRealValue:it})))))}var E;s.usedArgs.size>0&&o.push(null==wo||null===(E=wo.checkInstalledApps)||void 0===E?void 0:E.waitForCheckingApps([...s.usedArgs]))}return{blockingList:o,run(){var n,r;const{app:o,location:i,query:s,match:d,flags:b,sys:E,ctxStore:S,data:A,event:k}=t,I=t.overrideApp??o;for(const o of l)switch(o){case"ANCHOR":c[o]=i.hash?i.hash.substring(1):null;break;case"APP":if(null==I)throw new ReferenceError(`APP is not defined, in "${e}"`);c[o]={...(0,g.cloneDeep)(I),getMenu:null==wo||null===(n=wo.menu)||void 0===n?void 0:n.getMenuById};break;case"CTX":c[o]=K({get:(e,t)=>S.getValue(t),ownKeys:()=>Array.from(u)});break;case"DATA":c[o]=A;break;case"EVENT":c[o]=k;break;case"FLAGS":c[o]=z(b);break;case"FORM_STATE":c[o]=K({get:(e,t)=>w.getValue(t),ownKeys:()=>Array.from(y)});break;case"HASH":c[o]=i.hash;break;case"INSTALLED_APPS":c[o]=z({has:Ne});break;case"ITEM":case"INDEX":{const n="ITEM"===o?"forEachItem":"forEachIndex";(0,p.hasOwnProperty)(t,n)?c[o]=t[n]:console.error(`Using \`${o}\` but no \`:forEach\` is found, check your expression: "${e}"`);break}case"LOCAL_STORAGE":c[o]=z({getItem:Ie("local")});break;case"MEDIA":c[o]=z(ke());break;case"MISC":c[o]=Eo().getMiscSettings();break;case"PARAMS":if(null==s)throw new ReferenceError(`PARAMS is not defined, in "${e}"`);c[o]=new URLSearchParams(s);break;case"PATH":c[o]=z((null==d?void 0:d.params)??{});break;case"PATH_NAME":c[o]=i.pathname;break;case"PROCESSORS":c[o]=K({get(e,t){const n=L.get(t);if(!n)throw new Error(`'PROCESSORS.${t}' is not registered! Have you installed the relevant brick package?`);return K({get:(e,t)=>n.get(t),ownKeys:()=>Array.from(n.keys())})},ownKeys(){const e=new Set;for(const t of f){const n=t.split(".")[0];e.add(n)}return Array.from(e)}});break;case"QUERY":if(null==s)throw new ReferenceError(`QUERY is not defined, in "${e}"`);c[o]=Object.fromEntries(Array.from(s.keys()).map((e=>[e,s.get(e)])));break;case"QUERY_ARRAY":if(null==s)throw new ReferenceError(`QUERY_ARRAY is not defined, in "${e}"`);c[o]=Object.fromEntries(Array.from(s.keys()).map((e=>[e,s.getAll(e)])));break;case"SESSION_STORAGE":c[o]=z({getItem:Ie("session")});break;case"TPL":if(Oe(v,'Using "TPL" in expression',`check your expression: "${e}"`),v)break;case"STATE":c[o]=K({get:(e,t)=>m.getValue(t),ownKeys:()=>Array.from(h)});break;case"SYS":c[o]=z(E??{});break;case"__WIDGET_FN__":c[o]=Be;break;case"__WIDGET_IMG__":c[o]=null==wo||null===(r=wo.images)||void 0===r?void 0:r.widgetImagesFactory;break;case"__WIDGET_I18N__":c[o]=$}Object.assign(c,le(a.attemptToVisitGlobals,{storyboardFunctions:he,app:I,appendI18nNamespace:t.appendI18nNamespace}));try{const t=(0,T.cook)(a.expression,a.source,{globalVariables:(0,R.supply)(a.attemptToVisitGlobals,c)});return W("evaluation",{raw:e,context:c,result:t}),t}catch(t){const n=`${t.message}, in "${e}"`;throw new(Ze(t))(n)}}}}let nt=function(e){return e[e.INITIAL=0]="INITIAL",e[e.USE_BRICK=1]="USE_BRICK",e[e.USE_BRICK_ITEM=2]="USE_BRICK_ITEM",e[e.USE_BRICK_PROPERTIES=3]="USE_BRICK_PROPERTIES",e[e.USE_BRICK_TRANSFORM=4]="USE_BRICK_TRANSFORM",e[e.USE_BRICK_EVENTS=5]="USE_BRICK_EVENTS",e[e.USE_BRICK_IF=6]="USE_BRICK_IF",e[e.USE_BRICK_SLOTS=7]="USE_BRICK_SLOTS",e[e.USE_BRICK_SLOTS_ITEM=8]="USE_BRICK_SLOTS_ITEM",e[e.USE_BRICK_SLOTS_ITEM_BRICKS=9]="USE_BRICK_SLOTS_ITEM_BRICKS",e[e.USE_BRICK_SLOTS_ITEM_BRICKS_ITEM=10]="USE_BRICK_SLOTS_ITEM_BRICKS_ITEM",e[e.USE_BRICK_LIFECYCLE=11]="USE_BRICK_LIFECYCLE",e[e.USE_BRICK_DATA_SOURCE=12]="USE_BRICK_DATA_SOURCE",e}({});function rt(e){switch(e){case nt.USE_BRICK_PROPERTIES:case nt.USE_BRICK_TRANSFORM:case nt.USE_BRICK_EVENTS:case nt.USE_BRICK_IF:case nt.USE_BRICK_LIFECYCLE:case nt.USE_BRICK_DATA_SOURCE:return!0}return!1}function ot(e,t,n){if(rt(e))return e;if(t)switch(e){case nt.USE_BRICK:return nt.USE_BRICK_ITEM;case nt.USE_BRICK_SLOTS_ITEM_BRICKS:return nt.USE_BRICK_SLOTS_ITEM_BRICKS_ITEM}else switch(e){case nt.INITIAL:if("useBrick"===n)return nt.USE_BRICK;break;case nt.USE_BRICK:case nt.USE_BRICK_ITEM:case nt.USE_BRICK_SLOTS_ITEM_BRICKS_ITEM:switch(n){case"properties":return nt.USE_BRICK_PROPERTIES;case"transform":return nt.USE_BRICK_TRANSFORM;case"dataSource":return nt.USE_BRICK_DATA_SOURCE;case"events":return nt.USE_BRICK_EVENTS;case"slots":return nt.USE_BRICK_SLOTS;case"children":return nt.USE_BRICK_SLOTS_ITEM_BRICKS;case"if":return nt.USE_BRICK_IF;case"lifeCycle":return nt.USE_BRICK_LIFECYCLE}break;case nt.USE_BRICK_SLOTS:return nt.USE_BRICK_SLOTS_ITEM;case nt.USE_BRICK_SLOTS_ITEM:if("bricks"===n)return nt.USE_BRICK_SLOTS_ITEM_BRICKS}return nt.INITIAL}async function it(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=Je(e);if(r||"string"==typeof e){const o=n.$$lazyForUseBrick&&rt(n.$$stateOfUseBrick);let i,s=o;return r||(0,T.isEvaluable)(e)?(i=await async function(e,t,n){const{blockingList:r,run:o}=tt(e,t,n,!0);return await Promise.all(r),o()}(e,t,{lazy:o}),s=Ye(e)):i=o?e:((0,p.hasOwnProperty)(t,"data")?n.noInject?x.transform:x.transformAndInject:n.noInject?ct:x.inject)(e,t),s||Ve(i),i}if(!(0,p.isObject)(e)||We(e)||"function"==typeof e)return e;if(Array.isArray(e)){const r=at(n,!0);return Promise.all(e.map((e=>it(e,t,r))))}return Object.fromEntries((await Promise.all(Object.entries(e).map((e=>{let[r,o]=e;return Promise.all([it(r,t),it(o,t,at(n,!1,r))])})))).concat(n.ignoreSymbols?[]:Object.getOwnPropertySymbols(e).map((t=>[t,e[t]]))))}function st(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=Je(e);if(r||"string"==typeof e){const o=n.$$lazyForUseBrick&&rt(n.$$stateOfUseBrick);let i,s=o;return r||(0,T.isEvaluable)(e)?(i=et(e,t),s=Ye(e)):i=o?e:((0,p.hasOwnProperty)(t,"data")?n.noInject?x.transform:x.transformAndInject:n.noInject?ct:x.inject)(e,t),s||Ve(i),i}if(!(0,p.isObject)(e)||We(e)||"function"==typeof e)return e;if(Array.isArray(e)){const r=at(n,!0);return e.map((e=>st(e,t,r)))}return Object.fromEntries(Object.entries(e).map((e=>{let[r,o]=e;return[st(r,t),st(o,t,at(n,!1,r))]})).concat(n.ignoreSymbols?[]:Object.getOwnPropertySymbols(e).map((t=>[t,e[t]]))))}function at(e,t,n){return e.$$lazyForUseBrick?{...e,$$stateOfUseBrick:ot(e.$$stateOfUseBrick,t,n)}:e}function ct(e){return e}async function lt(e,t){return!(0,p.hasOwnProperty)(e,"if")||!!("string"==typeof e.if||Je(e.if)?await it(e.if,t):e.if)}function ut(e,t){return!(0,p.hasOwnProperty)(e,"if")||!!("string"==typeof e.if||Je(e.if)?st(e.if,t):e.if)}function dt(e){return!(0,p.hasOwnProperty)(e,"if")||!!e.if}const pt=function(){const e=k();if(e)return e.looseCheckIfByTransform}()||function(e,t){return ut(e,{data:t})};function ft(e){let t=!1,n=!1,r=!1;if("string"==typeof e?(0,T.isEvaluable)(e):Je(e)){const o="string"==typeof e?e:Xe(e);if((0,T.isTrackAll)(o)){const e=(0,C.trackAll)(o);e&&(t=e.context,n=e.state,r=e.formState)}else t=(0,C.track)(o,"track context","CTX"),n=(0,C.track)(o,"track state","STATE"),r=(0,C.track)(o,"track formstate","FORM_STATE")}return{contextNames:t,stateNames:n,formStateNames:r}}async function ht(e,t){for(const[n,r,o]of e)if(n===t){const e=await r;if(void 0!==e||!o)return e}}async function mt(e){const t={};for(const[n,r,o]of e){const e=await r;void 0===e&&o||!("style"!==n&&"dataset"!==n||(0,p.isObject)(e))||(t[n]=e)}return t}function gt(e,t){if(t)for(const[n,r]of Object.entries(t))switch(n){case"style":case"dataset":for(const[t,o]of Object.entries(r))e[n][t]=o;break;case"constructor":case"__proto__":case"innerHTML":throw new Error(`set \`${n}\` is prohibited`);default:e[n]=r}}function vt(e,t,n){const r=function(e,t){return(0,p.isObject)(e)?Object.fromEntries(Object.entries(e).map((e=>{let[n,r]=e;const o=st(r,t,{$$lazyForUseBrick:!0,$$stateOfUseBrick:"useBrick"===n?nt.USE_BRICK:nt.INITIAL});if("style"!==n&&"dataset"!==n||(0,p.isObject)(o))return[n,o]})).filter(Boolean)):{}}(t,n);Array.isArray(e)||(e=[e]),e.forEach((e=>{gt(e,r)}))}var yt=n(264);const wt=new Map,bt=1e4;let Et=0;function St(e,t){const{path:n,exact:r=!1,strict:o=!1,sensitive:i=!0}=t;return(Array.isArray(n)?n:[n]).reduce(((t,n)=>{if(t)return t;const{regexp:s,keys:a}=function(e,t){const n=`${t.end}${t.strict}${t.sensitive}`;let r=wt.get(n);r||wt.set(n,r=new Map);const o=r.get(e);if(o)return o;const i=[],s={regexp:(0,yt.MM)(e,i,t),keys:i};return Et<bt&&(r.set(e,s),Et++),s}(n,{end:r,strict:o,sensitive:i}),c=s.exec(e);if(!c)return null;const[l,...u]=c,d=e===l;return r&&!d?null:{path:n,url:"/"===n&&""===l?"/":l,isExact:d,params:a.reduce(((e,t,n)=>(e[t.name]=u[n],e)),{})}}),null)}function At(e,t,n){return St(n,{path:e.path.replace(/^\$\{APP.homepage\}/,t),exact:e.exact})}const kt=Symbol.for("tpl.asyncComputedPropsFromHost"),It=Symbol.for("tpl.stateStoreId"),Pt=Symbol.for("tpl.externalForEachItem"),Ot=Symbol.for("tpl.externalForEachIndex"),Tt=Symbol.for("tpl.externalNoForEach"),Ct=new Set;let xt=function(e){return e.REQUEST_FAILED="REQUEST_FAILED",e.SOMETHING_WENT_WRONG="SOMETHING_WENT_WRONG",e.LOGIN_TIMEOUT_MESSAGE="LOGIN_TIMEOUT_MESSAGE",e.NETWORK_ERROR="NETWORK_ERROR",e}({});const Rt={[xt.REQUEST_FAILED]:"Request Failed",[xt.SOMETHING_WENT_WRONG]:"Something went wrong!",[xt.LOGIN_TIMEOUT_MESSAGE]:"You haven't logged in or your login session has expired. Login right now?",[xt.NETWORK_ERROR]:"Network error, please check your network."},_t={[xt.REQUEST_FAILED]:"请求失败",[xt.SOMETHING_WENT_WRONG]:"出现了一些问题!",[xt.LOGIN_TIMEOUT_MESSAGE]:"您还未登录或登录信息已过期,现在重新登录?",[xt.NETWORK_ERROR]:"网络错误,请检查您的网络连接。"},Lt="core/runtime",Bt={en:Rt,zh:_t};let Mt;const $t=Object.freeze({show:function(e){if(Mt)return Mt.resolve(e);if("confirm"===e.type){const t=confirm(e.content);return new Promise(((e,n)=>setTimeout((()=>{(t?e:n)()}),1)))}return alert(e.content),new Promise((e=>setTimeout((()=>{e()}),1)))}});function Nt(e){const{search:t,pathname:n}=e,r=n?window.btoa(encodeURIComponent(n)):"",o=t?window.btoa(encodeURIComponent(t)):"";document.cookie=`SALOGINPATH=${r}; path=/`,document.cookie=`SALOGINQUERY=${o}; path=/`}function Ut(e){if(e instanceof Event&&e.target instanceof HTMLScriptElement)return e.target.src;if(e instanceof O.HttpFetchError)return u.i18n.t(`${Lt}:${xt.NETWORK_ERROR}`);if(e instanceof O.HttpResponseError&&e.responseJson){if("string"==typeof e.responseJson.error)return e.responseJson.error;if("string"==typeof e.responseJson.msg)return e.responseJson.msg}return null==e?"Unknown error":e.toString()}function Ft(e){return e instanceof O.HttpResponseError&&401===e.response.status&&!!e.responseJson&&100003===e.responseJson.code}let jt,Dt,Vt=!1;function Wt(e){if(e instanceof O.HttpAbortError)return;if(Ft(e)&&!window.NO_AUTH_GUARD){if(Vt)return;return Vt=!0,void $t.show({type:"confirm",content:u.i18n.t(`${Lt}:${xt.LOGIN_TIMEOUT_MESSAGE}`)}).then((()=>{!function(){const e=Eo().getFeatureFlags()["sso-enabled"],t=P();Nt(t.location),t.push(e?"/sso-auth/login":"/auth/login",{from:{...t.location,state:void 0}})}(),Vt=!1}),(()=>{Vt=!1}))}console.error(e);const t=Ut(e);t!==jt&&(jt=t,$t.show({type:"error",title:u.i18n.t(`${Lt}:${xt.REQUEST_FAILED}`),content:t,contentStyle:{whiteSpace:"pre-wrap",wordBreak:"break-word"}}).then((()=>{jt=void 0})))}const Ht=Object.freeze({show:function(e){Dt?Dt.resolve(e):alert(e.message)}});function qt(e,t,n){t&&Object.entries(t).forEach((t=>{let[r,o]=t;const i=Xt(o,n,{element:e});e.addEventListener(r,i),e.$$listeners||(e.$$listeners=[]),e.$$listeners.push([r,i]),e.$$eventListeners||(e.$$eventListeners=[]);for(const t of[].concat(o))e.$$eventListeners.push([r,null,t])}))}function Gt(e){return"string"==typeof e.action}function zt(e){return"string"==typeof e.useProvider}function Kt(e){return!(!e.target&&!e.targetRef||!e.method&&!e.properties)}function Jt(e){return!!e.then}function Xt(e,t,n){return function(r){for(const o of[].concat(e))if(ut(o,{...t,event:r}))if(Jt(o))Xt(o.then,t,n)(r);else if(Gt(o)){const[e,i]=o.action.split(".");switch(o.action){case"history.push":case"history.replace":case"history.pushQuery":case"history.replaceQuery":case"history.pushAnchor":case"history.block":case"history.goBack":case"history.goForward":case"history.reload":case"history.unblock":en(r,i,o.args,o.callback,t);break;case"window.open":tn(r,o.args,t);break;case"location.reload":case"location.assign":an(r,i,o.args,t);break;case"localStorage.setItem":case"localStorage.removeItem":case"sessionStorage.setItem":case"sessionStorage.removeItem":cn(r,e,i,o.args,t);break;case"event.preventDefault":r.preventDefault();break;case"event.stopPropagation":r.stopPropagation();break;case"console.log":case"console.error":case"console.warn":case"console.info":ln(r,i,o.args,t);break;case"message.success":case"message.error":case"message.info":case"message.warn":un(r,i,o.args,t);break;case"handleHttpError":Wt(r.detail);break;case"context.assign":case"context.replace":case"context.refresh":case"context.load":rn(r,i,o.args,o.batch??!0,o.callback,t);break;case"state.update":case"state.refresh":case"state.load":on(r,i,o.args,o.batch??!0,o.callback,t);break;case"tpl.dispatchEvent":{const[e,n]=fn(o.args,t,r);_e(t,o.action,`: ${e}`).dispatchEvent(new CustomEvent(e,n));break}case"formstate.update":sn(r,o.args,o.callback,t);break;case"message.subscribe":case"message.unsubscribe":dn(r,i,o.args,t,n,o.callback);break;case"theme.setDarkTheme":case"theme.setLightTheme":te("theme.setDarkTheme"===o.action?"dark":"light");break;case"theme.setTheme":{const[e]=fn(o.args,t,r);te(e);break}case"mode.setDashboardMode":case"mode.setDefaultMode":ae("mode.setDashboardMode"===o.action?"dashboard":"default");break;default:console.error("unknown event listener action:",o.action)}}else zt(o)?Yt(r,o,t,n):Kt(o)?Qt(r,o,t,n):console.error("unknown event handler:",o);else o.else&&Xt(o.else,t,n)(r)}}async function Yt(e,t,n,r){try{Zt(e,await je(t.useProvider),t,"saveAs"!==t.method?"resolve":"saveAs",n,r)}catch(e){console.error(Ut(e))}}function Qt(e,t,n,r){let o=[];const i=t.target,s=t.targetRef;let a=i;if(("string"==typeof i?(0,T.isEvaluable)(i):Je(i))&&(a=st(i,{...n,event:e})),"string"==typeof a)if("_self"===a)o.push(r.element);else if(t.multiple)o=Array.from(document.querySelectorAll(a));else{const e=document.querySelector(a);null!==e&&o.push(e)}else if(a)a instanceof HTMLElement?o.push(a):console.error("unexpected target:",a);else if(s){let t=s;("string"==typeof s?(0,T.isEvaluable)(s):Je(s))&&(t=st(s,{...n,event:e}));const r=[].concat(t),i=_e(n,"targetRef",`: ${r.join(", ")}`);o.push(...r.map((e=>{var t;return null===(t=i.$$getElementByRef)||void 0===t?void 0:t.call(i,e)})).filter(Boolean))}0!==o.length?function(e){return!!e.method}(t)?o.forEach((o=>{Zt(e,o,t,t.method,n,r,{useEventAsDefault:!0})})):function(e){return!!e.properties}(t)&&vt(o,t.properties,{...n,event:e}):console.error("target not found:",i||s)}async function Zt(e,t,n,r,o,i,s){if("function"!=typeof t[r])return void console.error("target has no method:",{target:t,method:r});const a=async()=>{var i;let a=fn(n.args,o,e,s);var c;return zt(n)&&null!=wo&&null!==(i=wo.flowApi)&&void 0!==i&&i.isFlowApiProvider(n.useProvider)&&(a=await wo.flowApi.getArgsOfFlowApi(n.useProvider,a,r,null===(c=n.sse)||void 0===c?void 0:c.stream)),t[r](...a)};if(!n.callback)return void a();const c=pn(n.callback,o,i),l={progress:c("progress"),success:c("success"),error:c("error"),finally:c("finally")};if(zt(n)){var u,d;const t={...o,event:e};if(st(null===(u=n.sse)||void 0===u?void 0:u.stream,t))return void async function(e,t){let{progress:n,success:r,error:o,finally:i}=t;const s=To();try{const t=await e();for await(const e of t){if(s!==To())return;null==n||n(e)}if(s!==To())return;null==r||r()}catch(e){if(s!==To())return;null==o||o(e)}finally{null==i||i()}}(a,l);if(st(null===(d=n.poll)||void 0===d?void 0:d.enabled,t))return void function(e,t,n,r){let{progress:o,success:i,error:s,finally:a}=t;const{expectPollStopImmediately:c,expectPollEnd:l}=n,{interval:u,leadingRequestDelay:d,continueOnError:p,delegateLoadingBar:f}=st((0,g.pick)(n,["interval","leadingRequestDelay","continueOnError","delegateLoadingBar"]),r),h=To();let m;async function v(){let t;Ct.delete(m);try{var n;if(t=null===(n=st(c,r))||void 0===n?void 0:n(),t)null==a||a();else{var d;const n=await e(),s=null===(d=st(c,r))||void 0===d?void 0:d();var g;t=s||h!==To(),t?s&&(null==a||a()):(null==o||o(n),null!==(g=st(l,r))&&void 0!==g&&g(n)?(f&&window.dispatchEvent(new Event("request.end")),null==i||i(n),null==a||a()):y(u??3e3))}}catch(e){var v;const n=null===(v=st(c,r))||void 0===v?void 0:v();t=n||h!==To(),t?n&&(null==a||a()):(null==s||s(e),p?y(u??3e3):null==a||a())}finally{f&&t&&window.dispatchEvent(new Event("request.end"))}}function y(e){m=setTimeout(v,e),Ct.add(m)}y(d??0),f&&window.dispatchEvent(new Event("request.start"))}(a,l,n.poll,t)}try{const e=await a();l.success(e)}catch(e){l.error(e)}finally{l.finally()}}function en(e,t,n,r,o){let i=0,s=!1,a=t;switch(t){case"push":case"replace":case"pushQuery":case"replaceQuery":case"pushAnchor":i=2,s=!0;break;case"reload":s=!0;break;case"block":i=1,a="setBlockMessage"}let c=[];if(i>0&&(c=fn(n,o,e,{useEventDetailAsDefault:!0}),c.length=i),s&&r){const e=pn(r,o,void 0);c.push((t=>{e(t?"error":"success")({blocked:t}),e("finally")({blocked:t})}))}P()[a](...c)}function tn(e,t,n){const[r,o,i]=fn(t,n,e);window.open(r,o||"_self",i)}function nn(e,t,n,r,o,i){t?r.updateValues(e,n,(e=>fn(e,o,i)[0])):e.forEach((e=>{const{name:t,value:s}=fn([e],o,i)[0];r.updateValue(t,s,n)}))}function rn(e,t,n,r,o,i){if(!Array.isArray(n)||!n.every(p.isObject)||"assign"!==t&&"replace"!==t){const[r,s]=fn(n,i,e);i.ctxStore.updateValue(r,s,t,o,i)}else nn(n,r,t,i.ctxStore,i,e)}function on(e,t,n,r,o,i){if(Array.isArray(n)&&n.every(p.isObject)&&"update"===t)nn(n,r,"replace",Re(i,`state.${t}`,`: ${JSON.stringify(n)}`),i,e);else{const[r,s]=fn(n,i,e);Re(i,`state.${t}`,`: ${r}`).updateValue(r,s,"update"===t?"replace":t,o,i)}}function sn(e,t,n,r){const[o,i]=fn(t,r,e);Ue(r,"formstate.update",`: ${o}`).updateValue(o,i,"replace",n,r)}function an(e,t,n,r){if("assign"===t){const[t]=fn(n,r,e);location.assign(t)}else location[t]()}function cn(e,t,n,r,o){const i="localStorage"===t?localStorage:sessionStorage,[s,a]=fn(r,o,e);"setItem"===n?void 0!==a&&i.setItem(s,JSON.stringify(a)):i.removeItem(s)}function ln(e,t,n,r){console[t](...fn(n,r,e,{useEventAsDefault:!0}))}function un(e,t,n,r){const o=fn(n,r,e,{useEventAsDefault:!0});Ht.show({type:t,message:o[0]})}async function dn(e,t,n,r,o,i){const s=()=>{var o;const i=fn(n,r,e);return null==wo||null===(o=wo.messageDispatcher)||void 0===o?void 0:o[t](...i)};if(!i)return void s();const a=pn(i,r,o);try{const e=await s();a("success")(e)}catch(e){a("error")(e)}finally{a("finally")()}}function pn(e,t,n){return function(r){return function(o){const i=null==e?void 0:e[r];if(i)try{const e=new CustomEvent(`callback.${r}`,{detail:o});Xt(i,t,n)(e)}catch(e){console.error(e)}else"error"===r&&console.error("Unhandled callback error:",o)}}}function fn(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return Array.isArray(e)?st(e,{...t,event:n}):r.useEventAsDefault?[n]:r.useEventDetailAsDefault?[n.detail]:[]}function hn(e){var t;const{ref:n,runtimeContext:r,element:o}=e;if(!n||!r.tplStateStoreId)return;const{hostBrick:i}=Re(r,"bindTemplateProxy"),s=i.tplHostMetadata;s.internalBricksByRef.set(n,e);const a=null===(t=s.proxy)||void 0===t?void 0:t.events;if(a)for(const[e,t]of Object.entries(a))if(t.ref===n){var c;const n=t=>{t.bubbles&&t.stopPropagation(),i.element.dispatchEvent(new CustomEvent(e,{detail:t.detail,bubbles:t.bubbles,cancelable:t.cancelable,composed:t.composed}))},r=t.refEvent??e;o.addEventListener(r,n),(c=o).$$proxyListeners??(c.$$proxyListeners=[]),o.$$proxyListeners.push([r,n])}}function mn(e){const{ref:t,runtimeContext:n,element:r}=e;if(null==n||!n.tplStateStoreId||!t)return;const{hostBrick:o}=Re(n,"unbindTemplateProxy");o.tplHostMetadata.internalBricksByRef.delete(t);for(const[e,t]of r.$$proxyListeners??[])r.removeEventListener(e,t);delete r.$$proxyListeners}let gn=function(e){return e[e.ROOT=1]="ROOT",e[e.BRICK=2]="BRICK",e[e.PLACEHOLDER=3]="PLACEHOLDER",e}({});function vn(e){e.replaceChildren()}function yn(e,t){window.DISABLE_REACT_FLUSH_SYNC=!1;let n=e.child;const r=[];for(;n;){if(n.tag===gn.BRICK){var o;const i=n.type;i.includes("-")&&!customElements.get(i)&&console.error(`Undefined custom element: ${i}`),"basic-bricks.script-brick"===i&&console.warn("`basic-bricks.script-brick` is deprecated, please take caution when using it");const s=t&&n===e.child?t:document.createElement(i);n.element=s,n.slotId&&s.setAttribute("slot",n.slotId),n.iid&&(s.dataset.iid=n.iid),null!==(o=n.tplHostMetadata)&&void 0!==o&&o.tplStateStoreId&&(s.dataset.tplStateStoreId=n.tplHostMetadata.tplStateStoreId),gt(s,n.properties),qt(s,n.events,n.runtimeContext),n.tplHostMetadata&&(s.$$tplStateStore=Re({tplStateStoreId:n.tplHostMetadata.tplStateStoreId,tplStateStoreMap:n.runtimeContext.tplStateStoreMap},"mount")),hn(n),n.portal?r.push(s):n.return&&(n.return.childElements||(n.return.childElements=[]),n.return.childElements.push(s))}if(n.child)n=n.child;else if(n.sibling)n=n.sibling;else{var i;let e=n.return;for(;e;){var s;if(e.childElements)e.tag===gn.ROOT?null===(s=e.container)||void 0===s||s.append(...e.childElements):e.element.append(...e.childElements),e.childElements=void 0;if(e.tag===gn.ROOT&&r.length>0&&("function"==typeof e.createPortal?e.createPortal():e.createPortal).append(...r),e.sibling)break;e=e.return}n=null===(i=e)||void 0===i?void 0:i.sibling}}setTimeout((()=>{window.DISABLE_REACT_FLUSH_SYNC=!0}))}const wn=["onMount","onUnmount","onMediaChange","onScrollIntoView","onMessage","onMessageClose"],bn=["onBeforePageLoad","onPageLoad","onPageLeave","onBeforePageLeave","onAnchorLoad","onAnchorUnload"];var En=new WeakMap,Sn=new WeakMap,An=new WeakMap,kn=new WeakMap,In=new WeakMap,Pn=new WeakMap,On=new WeakMap,Tn=new WeakMap,Cn=new WeakMap,xn=new WeakSet;class Rn{constructor(e,t){(0,o.A)(this,xn),(0,i.A)(this,"scope",void 0),(0,i.A)(this,"unknownBricks",void 0),(0,i.A)(this,"renderId",void 0),(0,s.A)(this,En,void 0),(0,s.A)(this,Sn,{onBeforePageLoad:[],onPageLoad:[],onPageLeave:[],onBeforePageLeave:[],onAnchorLoad:[],onAnchorUnload:[],onMediaChange:[],onScrollIntoView:[],onMount:[],onUnmount:[],onMessage:[],onMessageClose:[]}),(0,s.A)(this,An,new Map),(0,s.A)(this,kn,void 0),(0,s.A)(this,In,new Map),(0,s.A)(this,Pn,void 0),(0,s.A)(this,On,void 0),(0,s.A)(this,Tn,new WeakMap),(0,s.A)(this,Cn,new Map),this.scope=e,this.unknownBricks=(null==t?void 0:t.unknownBricks)??"throw",(0,c.A)(En,this,null==t?void 0:t.routeHelper),this.renderId=null==t?void 0:t.renderId}setInitialMenuRequestNode(e){(0,c.A)(On,this,e)}memoizeMenuRequestNode(e,t){(0,l.A)(Tn,this).set(e,t)}getMenuRequests(){const e=[];let t=(0,l.A)(On,this);for(;t;)if(t.request&&e.push(t.request),t.child)t=t.child;else{for(var n;t&&!t.sibling;)t=t.return;t=null===(n=t)||void 0===n?void 0:n.sibling}return e}async reMergeMenuRequestNodes(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=(0,l.A)(Tn,this).get(t);(0,l.A)(Tn,this).set(t,n);let o,i=e.child;for(;i&&i!==r;)o=i,i=i.sibling;o?(o.sibling=n,n.sibling=null==r?void 0:r.sibling):e.child=n,await(0,l.A)(En,this).mergeMenus(this.getMenuRequests())}reBailout(e){return(0,l.A)(En,this).bailout(e)}reCatch(e,t){return(0,l.A)(En,this).catch(e,t)}async didPerformIncrementalRender(e,t){let n=!1;const r=[];for(const{parentRoutes:o,callback:i}of[...(0,l.A)(Cn,this).values()].reverse()){const s=o[o.length-1];if(r.includes(s))continue;const a=await i(e,t);a&&r.push(...o.slice(0,-1)),!1!==a&&(n=!0)}return n}performIncrementalRender(e,t,n){(0,l.A)(Cn,this).set(e,{parentRoutes:t,callback:n})}registerBrickLifeCycle(e,t){if(!t)return;const n=[...wn,..."page"===this.scope?bn:[]];for(const r of n){const n=t[r];n&&(0,l.A)(Sn,this)[r].push({brick:e,handlers:n})}(0,g.isEmpty)(t.useResolves)||console.error("`lifeCycle.useResolves` is dropped in v3:",t)}registerArbitraryLifeCycle(e,t){const n=(0,l.A)(In,this).get(e);n?n.add(t):(0,l.A)(In,this).set(e,new Set([t]))}memoize(e,t,n,r){(0,l.A)(Pn,this)||(0,c.A)(Pn,this,new WeakMap);const o=[e??"",...t].join(".");let i=(0,l.A)(Pn,this).get(r);i||(i=new Map,(0,l.A)(Pn,this).set(r,i)),i.set(o,{node:n,last:$n(n),lastNormal:Nn(n),lastPortal:Fn(n)})}reRender(e,t,n,r){const o=[e??"",...t].join("."),i=(0,l.A)(Pn,this).get(r).get(o),{node:s,last:c,lastNormal:u,lastPortal:d}=i;let p;const f=[];if((null==s?void 0:s.tag)===gn.PLACEHOLDER){var h,m;p=(null===(h=function(e){return Un(e,!0)}(s))||void 0===h?void 0:h.element)??null;const e=null===(m=function(e){return jn(e,!0)}(s))||void 0===m?void 0:m.element;e&&f.push(e)}else{var g,v;p=(null==u||null===(g=u.element)||void 0===g?void 0:g.nextSibling)??null;let e=null==d||null===(v=d.element)||void 0===v?void 0:v.nextSibling;for(;e&&(f.push(e),e instanceof HTMLElement&&"DIV"===e.tagName);)e=e.nextSibling}const y=$n(n);let w;i.node=n,i.last=y,i.lastNormal=Nn(n),i.lastPortal=Fn(n);let b=r.child;for(;b&&b!==c;){if(b.sibling===s){w=b;break}b=b.sibling}const E=document.createDocumentFragment(),S=document.createDocumentFragment(),A={tag:gn.ROOT,container:E,createPortal:S,child:n};for(b=n;b;)b.return=A,b=b.sibling;const k=Dn(s,c);for((0,a.A)(xn,this,_n).call(this,k),yn(A),w?w.sibling=n:r.child=n,y&&(y.sibling=null==c?void 0:c.sibling),b=n;b;)b.return=r,b=b.sibling;var I,P;if(r.tag===gn.ROOT?null===(I=r.container)||void 0===I||I.insertBefore(E,p):null===(P=r.element)||void 0===P||P.insertBefore(E,p),S.childNodes.length>0){var O;let e=n;for(;e&&e.return;)e=e.return;if((null===(O=e)||void 0===O?void 0:O.tag)!==gn.ROOT)throw new Error("Cannot find render root node. This is a bug of Brick Next, please report it.");const t="function"==typeof e.createPortal?e.createPortal():e.createPortal;let r=null;for(const e of f)if(t.contains(e)){r=e;break}t.insertBefore(S,r)}const T=Dn(n,y);(0,a.A)(xn,this,Ln).call(this,T)}dispose(){for(const e of Object.values((0,l.A)(Sn,this)))e.length=0;for(const e of(0,l.A)(An,this).values()){for(const t of e)t.disconnect();e.length=0}(0,l.A)(An,this).clear(),(0,l.A)(kn,this)&&(be.removeEventListener("change",(0,l.A)(kn,this)),(0,c.A)(kn,this,void 0)),(0,c.A)(Pn,this,void 0),(0,l.A)(In,this).clear(),(0,l.A)(Cn,this).clear(),(0,c.A)(Tn,this,void 0)}dispatchBeforePageLoad(){(0,a.A)(xn,this,Bn).call(this,"onBeforePageLoad",new CustomEvent("page.beforeLoad"))}dispatchPageLoad(){const e=new CustomEvent("page.load");(0,a.A)(xn,this,Bn).call(this,"onPageLoad",e),window.dispatchEvent(e)}dispatchBeforePageLeave(e){(0,a.A)(xn,this,Bn).call(this,"onBeforePageLeave",new CustomEvent("page.beforeLeave",{detail:e}))}dispatchPageLeave(){(0,a.A)(xn,this,Bn).call(this,"onPageLeave",new CustomEvent("page.leave"))}dispatchAnchorLoad(){const{hash:e}=P().location;e&&"#"!==e?(0,a.A)(xn,this,Bn).call(this,"onAnchorLoad",new CustomEvent("anchor.load",{detail:{hash:e,anchor:e.substring(1)}})):(0,a.A)(xn,this,Bn).call(this,"onAnchorUnload",new CustomEvent("anchor.unload"))}initializeScrollIntoView(){for(const{brick:e,handlers:t}of(0,l.A)(Sn,this).onScrollIntoView)(0,a.A)(xn,this,Mn).call(this,e,t)}initializeMediaChange(){(0,c.A)(kn,this,(e=>{(0,a.A)(xn,this,Bn).call(this,"onMediaChange",new CustomEvent("media.change",{detail:z(e.detail)}))})),be.addEventListener("change",(0,l.A)(kn,this))}initializeMessageDispatcher(){var e;for(const{brick:e,handlers:n}of(0,l.A)(Sn,this).onMessage)for(const r of[].concat(n)){var t;null==wo||null===(t=wo.messageDispatcher)||void 0===t||t.onMessage(r.channel,(t=>{Xt(r.handlers,e.runtimeContext,e)(new CustomEvent("message.push",{detail:t}))}))}null==wo||null===(e=wo.messageDispatcher)||void 0===e||e.onClose((()=>{(0,a.A)(xn,this,Bn).call(this,"onMessageClose",new CustomEvent("message.close"))}))}dispatchOnMount(){(0,a.A)(xn,this,Bn).call(this,"onMount",new CustomEvent("mount"))}dispatchOnUnmount(){(0,a.A)(xn,this,Bn).call(this,"onUnmount",new CustomEvent("unmount"))}}function _n(e){const t=[...wn,..."page"===this.scope?bn:[]],n=[];for(const r of t){const t=(0,g.remove)((0,l.A)(Sn,this)[r],(t=>e.has(t.brick)));"onUnmount"===r&&n.push(...t)}for(const t of e){var r,o;const e=(0,l.A)(An,this).get(t);if(null!=e&&e.length){for(const t of e)t.disconnect();e.length=0,(0,l.A)(An,this).delete(t)}mn(t),null===(r=t.element)||void 0===r||delete r.$$tplStateStore,null===(o=t.element)||void 0===o||o.remove()}const i=new CustomEvent("unmount");for(const{brick:e,handlers:t}of n)Xt(t,e.runtimeContext,e)(i)}function Ln(e){const t=new CustomEvent("mount");for(const{brick:n,handlers:r}of(0,l.A)(Sn,this).onMount)e.has(n)&&Xt(r,n.runtimeContext,n)(t);for(const{brick:t,handlers:n}of(0,l.A)(Sn,this).onScrollIntoView)e.has(t)&&(0,a.A)(xn,this,Mn).call(this,t,n)}function Bn(e,t){for(const{brick:n,handlers:r}of(0,l.A)(Sn,this)[e])Xt(r,n.runtimeContext,n)(t);const n=(0,l.A)(In,this).get(e);if(n)for(const e of n)e()}function Mn(e,t){const n=t.threshold??.1,r=new IntersectionObserver(((r,o)=>{r.forEach((r=>{r.isIntersecting&&r.intersectionRatio>=n&&(Xt(t.handlers,e.runtimeContext,e)(new CustomEvent("scroll.into.view")),o.disconnect())}))}),{threshold:n});r.observe(e.element);let o=(0,l.A)(An,this).get(e);o||(o=[],(0,l.A)(An,this).set(e,o)),o.push(r)}function $n(e){let t=e;for(;null!==(n=t)&&void 0!==n&&n.sibling;){var n;t=t.sibling}return t}function Nn(e){return Un(e,!1)}function Un(e,t){let n,r=e;for(;r;){if(r.tag===gn.BRICK&&!r.portal){if(t)return r;n=r}r=r.sibling}return n}function Fn(e){return jn(e,!1)}function jn(e,t){let n,r=e;for(;r;){if(r.tag===gn.BRICK&&r.portal){if(t)return r;n=r}if(r.child)r=r.child;else if(r.sibling)r=r.sibling;else{var o;let e=r.return;for(;e&&!e.sibling;)e=e.return;r=null===(o=e)||void 0===o?void 0:o.sibling}}return n}function Dn(e,t){const n=new Set;let r=e;for(;r;)if(r.tag===gn.BRICK&&n.add(r),r.child)r=r.child;else{if(r===t)break;if(r.sibling)r=r.sibling;else{var o;let e=r.return;for(;e&&e!==t&&!e.sibling;)e=e.return;if(e===t)break;r=null===(o=e)||void 0===o?void 0:o.sibling}}return n}const Vn=new Map;function Wn(e){return Vn.get(e)}const Hn=Symbol.for("root.runtimeContext");async function qn(e,t,n){var r,o;const[i,s,a]=Mr({...e[Hn]??Co(),data:t,pendingPermissionsPreCheck:[]});i.tplStateStoreMap??(i.tplStateStoreMap=new Map),i.formStateStoreMap??(i.formStateStoreMap=new Map);const c=new Rn("fragment"),l={tag:gn.ROOT,createPortal:null},u=e.transform,d=Pe();u&&Oe(d,"`useBrick.transform`",'please use "properties" instead, check your useBrick:',e);const p=await _r(l,d&&!n?e:{errorBoundary:n,...e,properties:{...e.properties,...u}},i,c,[],{}),f=[...s,...a];if(await Br(p,i,f),(null===(r=p.node)||void 0===r?void 0:r.tag)===gn.PLACEHOLDER)throw new Error("The root brick of useBrick cannot be an ignored control node");if(null!==(o=p.node)&&void 0!==o&&o.portal)throw new Error("The root brick of useBrick cannot be a portal brick");return l.child=p.node,{tagName:p.node?p.node.type:null,renderRoot:l,rendererContext:c,scopedStores:f}}function Gn(e,t){let n,{renderRoot:r,rendererContext:o,scopedStores:i}=e;r.createPortal=()=>{const e=document.querySelector("#portal-mount-point");return n=document.createElement("div"),e.appendChild(n),n},yn(r,t),o.dispatchOnMount(),o.initializeScrollIntoView(),o.initializeMediaChange(),o.initializeMessageDispatcher();for(const e of i)e.mountAsyncData();return{portal:n}}function zn(e,t){let{rendererContext:n}=e;t.portal&&(vn(t.portal),t.portal.remove()),n.dispatchOnUnmount(),n.dispose()}function Kn(e,t,n){if(n)throw new Error("Legacy doTransform does not support options in v3");return st(t,{...Co(),data:e},{noInject:!0})}function Jn(e,t){const n=xo(e);Object.assign(n,{...t,meta:{...n.meta,...t.meta},$$fulfilling:null,$$fulfilled:!0,$$registerCustomTemplateProcessed:!1}),B(n)}function Xn(e,t){const n=xo(e);let r=!1;const o=e=>`${e.path}.${e.exact}`,i=(e,n)=>e.map((e=>{const s=o(e);return"routes"===e.type?(e.routes=i(e.routes,n),e):s===n?(r=!0,t):e}));n.routes=i(n.routes,o(t)),r||n.routes.unshift(t)}function Yn(e,t,n){const r=`${e}.${t.name}`;xe.define(r,{bricks:t.bricks,proxy:t.proxy,state:t.state}),Qn(e,t.name,n)}function Qn(e,t,n){nr(e,`\${APP.homepage}/_dev_only_/template-preview/${t}`,[{brick:t,...(0,g.pick)(n,"properties","events","lifeCycle","context","slots","children")}])}function Zn(e){return`\${APP.homepage}/_dev_only_/snippet-preview/${e}`}function er(e,t){var n;nr(e,Zn(t.snippetId),null!==(n=t.bricks)&&void 0!==n&&n.length?t.bricks:[{brick:"span"}],t.context)}const tr=er;function nr(e,t,n,r){const{routes:o}=xo(e),i=o.findIndex((e=>e.path===t)),s={path:t,bricks:n,context:r,menu:!1,exact:!0};-1===i?o.unshift(s):o.splice(i,1,s)}function rr(e,t){let{tplStateStoreId:n}=t;const r=Co();return n?Re({...r,tplStateStoreId:n},"STATE").getValue(e):r.ctxStore.getValue(e)}function or(e){let{tplStateStoreId:t}=e;const n=Co();return t?Re({...n,tplStateStoreId:t},"STATE").getAllValues():n.ctxStore.getAllValues()}function ir(e){return Oo().find((t=>t.id?t.id===e:t.filePath.startsWith(`${e}/`)))}function sr(e){return(0,d.loadBricksImperatively)(e,Oo())}function ar(e,t){return(0,d.loadEditorsImperatively)(e,t??Oo())}function cr(){return To()}async function lr(e,t){let{appId:n,updateStoryboardType:r,collectUsedContracts:o}=t;const i=xo(n);let s;if("route"===r)s={routes:[e]};else if("template"===r)s={meta:{customTemplates:[e]}};else if("snippet"===r){var a;const t=Zn(e.snippetId);s={routes:[null==i||null===(a=i.routes)||void 0===a?void 0:a.find((e=>e.path===t))]}}const c=[];return s&&o&&(await o(s)).forEach((e=>{var t;const[n,r,o]=e.match(/(.*)@(.*):\d\.\d\.\d/);null!=i&&null!==(t=i.meta)&&void 0!==t&&null!==(t=t.contracts)&&void 0!==t&&t.some((e=>e.namespaceId===r&&e.name===o))||c.push(e)})),c}async function ur(e,t){let{tplStateStoreId:n,routeId:r}=t;const o={...Co(),tplStateStoreId:n,match:Wn(r)};return e.resolve?qe(e.resolve,o,{cache:"reload"}):it(e.value,o)}function dr(e){const t=Co();return{app:(null==t?void 0:t.overrideApp)??(null==t?void 0:t.app),location:(0,g.pick)(location,["href","origin","hostname","host"]),...(0,g.pick)(t,["query","sys"]),match:Wn(null==e?void 0:e.routeId)}}let pr;const fr=[];function hr(e){pr=e;const t=or({tplStateStoreId:e.tplStateStoreId});gr({changeType:"initialize",tplStateStoreId:e.tplStateStoreId,detail:{data:t}})}function mr(e){fr.push(e)}function gr(e){setTimeout((()=>{for(const t of fr)try{t(e)}catch(t){console.error(`RealTimeDataInspectHook failed (${e.changeType}):`,t)}}))}const vr=["onBeforePageLoad","onPageLoad","onBeforePageLeave","onPageLeave","onAnchorLoad","onAnchorUnload"];class yr{constructor(e,t,n,r){(0,i.A)(this,"type",void 0),(0,i.A)(this,"data",new Map),(0,i.A)(this,"changeEventType",void 0),(0,i.A)(this,"pendingStack",[]),(0,i.A)(this,"hostBrick",void 0),(0,i.A)(this,"stateStoreId",void 0),(0,i.A)(this,"batchUpdate",!1),(0,i.A)(this,"batchUpdateContextsNames",[]),(0,i.A)(this,"rendererContext",void 0),(0,i.A)(this,"routeMap",new WeakMap),this.type=e,this.changeEventType="FORM_STATE"===this.type?"formstate.change":"STATE"===this.type?"state.change":"context.change",this.hostBrick=t,this.rendererContext=n,this.stateStoreId=r}getAllValues(){return Object.fromEntries([...this.data.entries()].map((e=>{let[t,{value:n}]=e;return[t,n]})))}getValue(e){var t;return null===(t=this.data.get(e))||void 0===t?void 0:t.value}notifyRealTimeDataChange(e,t){if(pr){const{tplStateStoreId:n}=pr;(n?"STATE"===this.type&&this.stateStoreId===n:"CTX"===this.type)&&gr({changeType:"update",tplStateStoreId:n,detail:{name:e,value:t}})}}getAffectListByContext(e){const t=[e];return this.data.forEach(((e,n)=>{e.deps&&e.deps.some((e=>t.includes(e)))&&t.push(n)&&t.push(...this.getAffectListByContext(n))})),t.shift(),[...new Set(t)]}updateValues(e,t,n){if(this.batchUpdate=!0,this.batchUpdateContextsNames=e.map((e=>e.name)),[...new Set(this.batchUpdateContextsNames)].length!==this.batchUpdateContextsNames.length)throw new Error("Batch update not allow to update same item");const r={},o={},i=[];e.forEach((e=>{const{name:o,value:s}=n([e]),a=this.data.get(o);i.push(...this.getAffectListByContext(o)),a&&(r[o]=a),this.updateValue(o,s,t)})),i.filter((e=>!r[e])).forEach((e=>{const t=this.data.get(e);t&&(o[e]=t)}));const s=e=>{for(const n in e){var t;const r=e[n];null===(t=r.eventTarget)||void 0===t||t.dispatchEvent(new CustomEvent(this.changeEventType,{detail:r.value}))}};s(r),s(o),this.batchUpdate=!1}updateValue(e,t,n,r,o){const i=this.data.get(e);if(!i)throw new Error(`${this.type} '${e}' is not defined`);if("refresh"!==n&&"load"!==n)"replace"===n?i.value=t:(0,p.isObject)(i.value)?Object.assign(i.value,t):(console.warn(`Non-object current value of "${this.type}.${e}" for "context.assign", try "context.replace" instead.`),i.value=t),this.batchUpdate||i.eventTarget.dispatchEvent(new CustomEvent(this.changeEventType,{detail:i.value}));else{if(!i.useResolve)throw new Error(`You can not ${n} "${this.type}.${e}" which is not using resolve`);let s;"load"===n&&(i.loaded?s=Promise.resolve(i.value):i.loading&&(s=i.loading));const a=e=>{var t;let n;return"FlowApiNotFoundError"===(null==e?void 0:e.name)&&!!(n=null===(t=this.rendererContext)||void 0===t?void 0:t.renderId)&&n!==To()};if(s||(s=i.loading=i.load({cache:"load"===n?"default":"reload",...t}),s.then((e=>{this.finishLoad(i,e)}),(e=>{!i.useResolve||a(e)||null!=r&&r.error||Wt(e)}))),r){const e=pn(r,o);s.then((t=>{e("success")({value:t}),e("finally")()}),(t=>{!a(t)&&r.error&&e("error")(t),e("finally")()}))}}}finishLoad(e,t){e.useResolve&&(e.loaded=!0,e.value=t,e.eventTarget.dispatchEvent(new CustomEvent(this.changeEventType,{detail:t})))}define(e,t,n,r){if(Array.isArray(e)&&e.length>0){const o=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"CTX";const r=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"CTX",n=arguments.length>2?arguments[2]:void 0;const r=new Map;for(const o of e){const e=[o.if,o.value,o.resolve],i=(0,C.collectMemberUsage)(e,t);if(!n&&"STATE"===t){const t=(0,C.collectMemberUsage)(e,"TPL");for(const e of t.usedProperties)i.usedProperties.add(e);t.hasNonStaticUsage&&(i.hasNonStaticUsage=!0)}r.set(o,i)}return r}(e,n,arguments.length>3?arguments[3]:void 0),o=new Map;for(const e of Array.from(r.keys()).map((e=>e.name)))o.set(e,(o.get(e)??0)+1);const i=Array.from(r.values()).some((e=>e.hasNonStaticUsage)),s=new WeakSet,a=new Map,c=new Map([...new Set(e.map((e=>e.name)))].map((e=>[e,new Promise(((t,n)=>{a.set(e,{resolve:t,reject:n})}))]))),l=async e=>{s.add(e);const n=await t(e);r.delete(e);const i=o.get(e.name)??0;if(n){if(a.get(e.name).resolve(),o.delete(e.name),0===i)throw new Error(`Duplicated context defined: ${e.name}`)}else 1===i?(a.get(e.name).resolve(),o.delete(e.name)):o.set(e.name,i-1);await d()};let u=i;async function d(){const e=Array.from(r.entries()).filter(function(e,t){return(n,r)=>t?0===r:![...n[1].usedProperties].some((t=>e.has(t)))}(o,u)).map((e=>e[0])).filter((e=>!s.has(e)));await Promise.all(e.map(l))}return{pendingResult:d().then((async()=>{r.size>0&&(function(e,t){const n=new Map(e),r=new Set(Array.from(n.keys()).map((e=>e.name))),o=()=>{let e=!1;for(const[t,o]of n.entries())[...o.usedProperties].some((e=>r.has(e)))||(n.delete(t),r.delete(t.name),e=!0);e&&o()};if(o(),n.size>0)throw new ReferenceError(`Circular ${t} detected: ${Array.from(n.keys()).map((e=>e.name)).join(", ")}`)}(r,n),u=!0,await d());for(const e of a.values())e.resolve()})).catch((e=>{for(const t of a.values())t.reject(e);throw e})),pendingContexts:c}}(e,(e=>this.resolve(e,t,n,r)),this.type,Pe(t));this.pendingStack.push(o)}}onChange(e,t){var n;null===(n=this.data.get(e))||void 0===n||n.eventTarget.addEventListener(this.changeEventType,t)}async waitFor(e){for(const{pendingContexts:t}of this.pendingStack)await Promise.all([...e].map((e=>t.get(e))))}async waitForAll(){for(const{pendingContexts:e}of this.pendingStack)for(const t of e.values())t.catch((()=>{}));for(const{pendingResult:e}of this.pendingStack)await e}mountAsyncData(e){this.data.forEach((t=>{var n;if(t.async&&(!e||null!==(n=this.routeMap.get(e))&&void 0!==n&&n.has(t.name))){if(t.asyncMounted)return void console.error(`Async data "${t.name}" already mounted. This is a bug of Brick Next, please report it.`);t.asyncMounted=!0,t.loading.then((e=>{this.finishLoad(t,e)}))}}))}async resolve(e,t,n,r){if(!await lt(e,t))return!1;let o,i,s,a,c,l;if(n&&("STATE"===this.type?e.expose:"FORM_STATE"===this.type)&&(o=await ht(n,e.name)),void 0===o){if(e.resolve){const n=(0,p.hasOwnProperty)(e,"value");c=e.track&&n&&(0,p.hasOwnProperty)(e.resolve,"if")&&(0,C.strictCollectMemberUsage)(e.resolve.if,this.type).size>0;const r={transform:"value",...e.resolve};if(a=await lt(e.resolve,t),(a||c)&&(i=async e=>{var n;return(await qe(r,t,{...e,renderId:null===(n=this.rendererContext)||void 0===n?void 0:n.renderId})).value}),a)l=e.resolve.async?"async":e.resolve.lazy?"lazy":"eager","eager"===l?o=await i():"async"===l&&(s=i());else if(!n)return!1}a&&"eager"===l||void 0===e.value||(o=await it(e.value,t))}if(this.data.has(e.name))throw new Error(`${this.type} '${e.name}' has already been declared`);const u={name:e.name,value:o,eventTarget:new ve.A,useResolve:a,load:i,loaded:"eager"===l,loading:s,async:"async"===l,deps:[]};if("lazy"===l){const{trigger:t}=e.resolve;var d;t&&vr.includes(t)&&(null===(d=this.rendererContext)||void 0===d||d.registerArbitraryLifeCycle(t,(()=>{this.updateValue(e.name,void 0,"load")})))}if(e.onChange&&u.eventTarget.addEventListener(this.changeEventType,Xt(e.onChange,t)),e.track){const n=(0,C.strictCollectMemberUsage)(c?[e.resolve,e.value]:i?e.resolve:e.value,this.type);!i&&(u.deps=[...n]);for(const r of n)this.onChange(r,this.batchAddListener((()=>{u.useResolve=c?ut(e.resolve,t):!!i,u.useResolve?this.updateValue(e.name,{cache:"default"},"refresh"):this.updateValue(e.name,st(e.value,t),"replace")}),e))}if(u.eventTarget.addEventListener(this.changeEventType,(t=>{this.notifyRealTimeDataChange(e.name,t.detail)})),this.data.set(e.name,u),Array.isArray(r))for(const t of r){const n=this.routeMap.get(t);n?n.add(e.name):this.routeMap.set(t,new Set([e.name]))}return!0}disposeDataInRoutes(e){for(const t of e){const e=this.routeMap.get(t);if(void 0!==e)for(const t of e)this.data.delete(t)}}batchAddListener(e,t){return n=>{this.batchUpdate&&this.batchUpdateContextsNames.includes(t.name)||e(n)}}}function wr(e,t,n){const{reversedProxies:r,asyncHostPropertyEntries:o,externalSlots:i,tplStateStoreId:s,hostBrick:a}=e;let c;if(t&&r){const s=r.properties.get(t);s&&(u=o,c=s.map((e=>{let{from:t,to:n}=e;const r=u.filter((e=>e[0]===t));if(r.length>0&&n.refProperty)return[n.refProperty,ht(r,t),!0]})).filter(Boolean));const d=r.slots.get(t);if(d&&i){const t=new Map;for(const{from:r,to:o}of d){var l;const s=(null===(l=i[r])||void 0===l?void 0:l.bricks)??[];if(!s.length)continue;const c=o.refSlot??r;let u=t.get(c);if(!u){u=[];const e=(0,p.hasOwnProperty)(n,c)?n[c].bricks.length+1:1;for(let t=0;t<e;t+=1)u.push([]);t.set(c,u)}const d=o.refPosition??-1,f=(0,p.hasOwnProperty)(a.runtimeContext,"forEachItem");u[(0,g.clamp)(d<0?u.length+d:d,0,u.length-1)].push(..."base-layout-v3.tpl-scroll-load-list"!==e.__temporary_tpl_tag_name&&"shrcb-homepage.tpl-custom-scroll-load-list"!==e.__temporary_tpl_tag_name||f?br(s,f,a.runtimeContext.forEachItem,a.runtimeContext.forEachIndex):s)}for(const[e,r]of t.entries()){(0,p.hasOwnProperty)(n,e)||(n[e]={type:"bricks",bricks:[]});const t=n[e];t.bricks=r.flatMap(((e,n)=>n<t.bricks.length?e.concat(t.bricks[n]):e)),0===t.bricks.length&&delete n[e]}}}var u;return{[kt]:c,[It]:s}}function br(e,t,n,r){return e.map((e=>{let{children:o,slots:i,[Pt]:s,[Ot]:a,[Tt]:c,...l}=e;return{...l,...t?{[Pt]:n,[Ot]:r}:{[Tt]:!0},slots:":forEach"===l.brick?Ur(o,i):Object.fromEntries(Object.entries(Ur(o,i)??{}).map((e=>{let[o,i]=e;return[o,"routes"===i.type?{type:"routes",routes:Er(i.routes,t,n,r)}:{type:"bricks",bricks:br(i.bricks,t,n,r)}]})))}}))}function Er(e,t,n,r){return e.map((e=>"routes"===e.type?{...e,routes:Er(e.routes,t,n,r)}:"redirect"===e.type?e:{...e,bricks:br(e.bricks,t,n,r)}))}function Sr(e,t){function n(e){return(0,p.isObject)(e)&&"function"!=typeof e?Array.isArray(e)?e.map(n):Object.fromEntries(Object.entries(e).map((e=>{let[t,o]=e;return(0,p.isObject)(o)&&"useBrick"===t?Array.isArray(o)?[t,o.map(r)]:[t,r(o)]:[t,n(o)]})).concat(Object.getOwnPropertySymbols(e).map((t=>[t,e[t]])))):e}function r(e){const{properties:o,slots:i,children:s,...a}=e,c=Ur(s,i),l=Object.fromEntries(Object.entries(c??{}).map((e=>{let[t,n]=e;return[t,{type:"bricks",bricks:(n.bricks??[]).map(r)}]})));return{...a,properties:n(o),slots:l,...wr(t,a.ref,l)}}return n(e)}function Ar(e,t,n,r,o){var i;const s=(0,g.uniqueId)("tpl-state-"),a={...n.runtimeContext,tplStateStoreId:s};delete a.forEachItem,delete a.forEachIndex,delete a.formStateStoreId;const c=new yr("STATE",n,o,s);a.tplStateStoreMap.set(s,c),a.tplStateStoreScope&&a.tplStateStoreScope.push(c);const{bricks:l,proxy:u,state:d,contracts:p}=xe.get(e);null==wo||null===(i=wo.flowApi)||void 0===i||i.collectWidgetContract(p),c.define(d,a,r);const{slots:f,children:h,...m}=t,v={...m,brick:e};n.tplHostMetadata={internalBricksByRef:new Map,tplStateStoreId:s,proxy:u};const y={properties:new Map,slots:new Map};if(null!=u&&u.properties)for(const[e,t]of Object.entries(u.properties)){let n=y.properties.get(t.ref);n||(n=[],y.properties.set(t.ref,n)),n.push({from:e,to:t})}if(null!=u&&u.slots)for(const[e,t]of Object.entries(u.slots)){let n=y.slots.get(t.ref);n||(n=[],y.slots.set(t.ref,n)),n.push({from:e,to:t})}const w={reversedProxies:y,asyncHostPropertyEntries:r,externalSlots:Ur(h,f),tplStateStoreId:s,hostBrick:n,__temporary_tpl_tag_name:e};return v.slots={"":{type:"bricks",bricks:l.map((e=>kr(e,w)))}},v}function kr(e,t){null===e.if&&delete e.if;const{properties:n,slots:r,children:o,...i}=e,s=Ur(o,r),a=Object.fromEntries(Object.entries(s??{}).map((e=>{let[n,r]=e;return[n,{type:"bricks",bricks:(r.bricks??[]).map((e=>kr(e,t)))}]})));return{...i,properties:Sr(n,t),slots:a,...wr(t,i.ref,a)}}const Ir="form-renderer.form-renderer",Pr=Symbol.for("form.stateStoreId"),Or=["forms.general-form","form.general-form","eo-form"];function Tr(e,t,n){const{id:r,bricks:o,events:i,context:s,mountPoint:a,instanceId:c}=e;let{brick:l,properties:u}=e;const d=t.find((e=>e.fieldId===r));if(d){const e=function(e){let t;const n={id:e.fieldId,name:e.fieldId,label:e.name,dataset:{testid:e.fieldId}},r=()=>{var t,n;return{readOnly:null===(t=e.limit)||void 0===t?void 0:t.includes("READONLY"),required:null===(n=e.limit)||void 0===n?void 0:n.includes("REQUIRED")}};switch(e.fieldType){case"INT":t={brick:"forms.general-input-number",properties:{...n,...r(),placeholder:e.description,precision:0,inputBoxStyle:{width:"100%"}}};break;case"BOOLEAN":t={brick:"forms.general-switch",properties:{...n,...r()}};break;case"FLOAT":t={brick:"forms.general-input-number",properties:{...n,...r(),placeholder:e.description,inputBoxStyle:{width:"100%"}}};break;case"ENUM":t={brick:"forms.general-select",properties:{...n,...r(),options:[{label:"选项一",value:1},{label:"选项二",value:2}],placeholder:e.description,inputBoxStyle:{width:"100%"}}};break;case"ENUMS":t={brick:"forms.general-select",properties:{...n,...r(),mode:"multiple",options:[{label:"选项一",value:1},{label:"选项二",value:2}],placeholder:e.description,inputBoxStyle:{width:"100%"}}};break;case"DATE":case"TIME":t={brick:"forms.general-date-picker",properties:{...n,...r(),placeholder:e.description}};break;case"IP":t={brick:"forms.general-input",properties:{...n,...r(),placeholder:e.description,pattern:"((^s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]).){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))s*$)|(^s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:)))(%.+)?s*$))",message:{pattern:"输入字符不匹配IP格式"}}};break;case"JSON":t={brick:"forms.general-textarea",properties:{...n}};break;case"ARRAY":t={brick:"forms.general-select",properties:{...n}};break;case"STRUCTURE":case"STRUCTURE_ARRAY":t={brick:"forms.cmdb-instance-select-panel",properties:{...n,...r()}};break;default:t={brick:"forms.general-input",properties:{...n,...r(),placeholder:e.description}}}return t}(d);l||(l=e.brick),u={...e.properties,...u}}const f={brick:l,properties:u,iid:c,slot:a,events:i,context:s,children:Cr(o,t,n),[Pr]:n};return(0,p.hasOwnProperty)(e,"if")&&(f.if=e.if),f}function Cr(e,t,n){if(Array.isArray(e))return e.map((e=>Tr(e,t,n)))}async function xr(e,t,n,r,o,i,s,a){const c=await async function(e,t){for(const n of e){if("string"!=typeof n.path)throw console.error("Invalid route with invalid path:",n),new Error("Invalid route with invalid type of path: "+typeof n.path);const e=At(n,t.app.homepage,t.location.pathname);if(e&&await lt(n,t))return t.app.noAuthGuard||n.public||null==wo||!wo.auth||wo.auth.isLoggedIn()?{match:e,route:n}:"unauthenticated"}return"missed"}(t,n),l={blockingList:[]},u=l.menuRequestNode={return:i};switch(c){case"missed":break;case"unauthenticated":l.unauthenticated=!0;break;default:{var p;const i=l.route=c.route;l.path=c.match.path;const m={...n,match:c.match};i.iid&&(f=i.iid,h=c.match,Vn.set(f,h)),a&&m.ctxStore.disposeDataInRoutes(t);const g=o.concat(i);m.ctxStore.define(i.context,m,void 0,g),m.pendingPermissionsPreCheck.push(null==wo||null===(p=wo.checkPermissions)||void 0===p?void 0:p.preCheckPermissionsForBrickOrRoute(i,(e=>it(e,m))));const{preLoadBricks:v}=i;if(Array.isArray(v)&&l.blockingList.push((0,d.loadBricksImperatively)(v,Oo())),"redirect"===i.type){let e;if(e="string"==typeof i.redirect?await it(i.redirect,m):(await qe({transform:"redirect",...i.redirect},m)).redirect,"string"!=typeof e)throw console.error("Unexpected redirect result:",e),new Error("Unexpected type of redirect result: "+typeof e);l.redirect={path:e}}else{const n=function(e,t){if(e){if("brick"===e.type)throw console.error("Set menu with brick is dropped in v3:",e),new Error("Set menu with brick is dropped in v3");if("resolve"!==e.type)return it(e,t);console.warn("Set menu with resolve is not supported in v3 yet:",e)}}(i.menu,m);let o;n&&(u.request=n),a||r.memoizeMenuRequestNode(t,u),o="routes"===i.type?await xr(e,i.routes,m,r,g,u,s):await Rr(e,i.bricks,m,r,g,u,s),$r(l,o),Nr(u,o.menuRequestNode)}}}var f,h;return l}async function Rr(e,t,n,r,o,i,s,a,c){!function(e,t,n){function r(e){if((0,p.isObject)(e)&&"function"!=typeof e)if(Array.isArray(e))e.map(r);else for(const[t,n]of Object.entries(e))(0,p.isObject)(n)&&"useBrick"===t?Array.isArray(n)?n.forEach((e=>o(e,!0))):o(n,!0,!0):r(n)}function o(e,i,s){if(i&&(e[Hn]=t),r(e.properties),n&&!s)return;const a=Ur(e.children,e.slots);for(const e of Object.values(a??{}))for(const t of e.bricks??[])o(t,i)}for(const t of e)o(t)}(t,n,!0);const l={blockingList:[]},u=c??[];return(await Promise.all(t.map(((t,c)=>_r(e,t,n,r,o,i,s,u.concat(c),a&&new Map(a)))))).forEach(((t,n)=>{t.hasTrackingControls&&r.memoize(s,u.concat(n),t.node,e),$r(l,t)})),l}async function _r(e,t,n,r,o,i,s){let a=arguments.length>7&&void 0!==arguments[7]?arguments[7]:[],c=arguments.length>8&&void 0!==arguments[8]?arguments[8]:new Map;try{return await async function(e,t,n,r,o,i,s,a,c){var l,u;const f={blockingList:[]};if(!t.brick)return t.template?console.error("Legacy templates are dropped in v3:",t):console.error("Invalid brick:",t),f;const{if:h,permissionsPreCheck:m,...v}=t;if(function(e){return"string"==typeof e?(0,T.isTrackAll)(e):Je(e)&&(0,T.isTrackAll)(Xe(e))}(h))return _r(e,{brick:":if",dataSource:h,permissionsPreCheck:m,slots:{"":{type:"bricks",bricks:[v]}},...Object.getOwnPropertySymbols(t).reduce(((e,n)=>({...e,[n]:t[n]})),{})},n,r,o,i,s,a,c);const w=t[It],b=t[Pr],E={...n,tplStateStoreId:w,formStateStoreId:b};(0,p.hasOwnProperty)(t,Pt)?(E.forEachItem=t[Pt],E.forEachIndex=t[Ot]):t[Tt]&&(delete E.forEachItem,delete E.forEachIndex);const{context:S}=t;if(Array.isArray(S)&&S.length>0){const e=Pe(E);Oe(e,"Defining context on bricks","check your brick:",t),e||E.ctxStore.define(S,E)}if(E.pendingPermissionsPreCheck.push(null==wo||null===(l=wo.checkPermissions)||void 0===l?void 0:l.preCheckPermissionsForBrickOrRoute(t,(e=>it(e,E)))),!await async function(e,t){return(0,p.isObject)(e.if)&&!Je(e.if)?dt(await qe(e.if,t)):lt(e,t)}(t,E))return f;const A=t.brick;if(A.startsWith(":")){!function(e){if(":forEach"!==e&&":if"!==e&&":switch"!==e)throw new Error(`Unknown storyboard control node: "${e}"`)}(A);const{dataSource:n}=t,l=async l=>{var u;const d=await it(n,l),f=":forEach"===A?"":":switch"===A?String(d):d?"":"else",h=Ur(t.children,t.slots),m=h&&(0,p.hasOwnProperty)(h,f)&&(null===(u=h[f])||void 0===u?void 0:u.bricks);if(!Array.isArray(m))return{blockingList:[]};switch(A){case":forEach":return Array.isArray(d)?async function(e,t,n,r,o,i,s,a,c,l){const u={blockingList:[]},d=t.length,p=await Promise.all(t.map(((t,u)=>Promise.all(n.map(((n,p)=>_r(e,n,{...r,forEachItem:t,forEachIndex:u},o,i,s,a,l.concat(u*d+p),c&&new Map(c))))))));return p.flat().forEach(((t,n)=>{t.hasTrackingControls&&o.memoize(a,l.concat(n),t.node,e),$r(u,t)})),u}(e,d,m,l,r,o,i,s,c,a):{blockingList:[]};case":if":case":switch":return Rr(e,m,l,r,o,i,s,c,a)}},u=async t=>{const n=await l(t);return n.node??(n.node={tag:gn.PLACEHOLDER,return:e}),n},d=await u(E),{onMount:f,onUnmount:h}=t.lifeCycle??{},{contextNames:m,stateNames:v}=ft(n);if(m||v){d.hasTrackingControls=!0;let t=0;const o=async()=>{const n=++t,[o,i,c]=Mr(E),l=await u(o),d=[...i,...c];if(await Br(l,o,d),t===n){h&&Xt(h,E)(new CustomEvent("unmount",{detail:{rerender:!0}})),r.reRender(s,a,l.node,e),f&&Xt(f,o)(new CustomEvent("mount",{detail:{rerender:!0}}));for(const e of d)e.mountAsyncData()}},i=(0,g.debounce)(o);if(m)for(const e of m)E.ctxStore.onChange(e,i);if(v)for(const e of v)Re(E,"STATE",`: "${n}"`).onChange(e,i)}return f&&r.registerArbitraryLifeCycle("onMount",(()=>{Xt(f,E)(new CustomEvent("mount",{detail:{rerender:!1}}))})),h&&r.registerArbitraryLifeCycle("onUnmount",(()=>{Xt(h,E)(new CustomEvent("unmount",{detail:{rerender:!1}}))})),d}/\.tpl-/.test(A)&&!xe.get(A)&&await Fr((0,d.loadBricksImperatively)([A],Oo()),"brick",A,r.unknownBricks);const k=function(e,t){if(!e.includes(".")&&e.startsWith("tpl-")&&t){const n=`${t}.${e}`;if(xe.get(n))return n}return!!xe.get(e)&&e}(A,null===(u=E.app)||void 0===u?void 0:u.id);if(k){const e=c.get(k)??0;if(e>=10)throw new Error(`Maximum custom template stack overflowed: "${k}"`);c.set(k,e+1)}else A.includes("-")&&!customElements.get(A)&&(A===Ir?customElements.define(Ir,class extends HTMLElement{get $$typeof(){return"form-renderer"}}):f.blockingList.push(Fr((0,d.enqueueStableLoadBricks)([A],Oo()),"brick",A,r.unknownBricks)));let I,P;A===Ir?({formData:I,...P}=t.properties??{}):P=t.properties;const O=[],x=function(e,t,n){return(0,p.isObject)(e)?Object.entries(e).map((e=>{let[r,o]=e;const{contextNames:i,stateNames:s,formStateNames:a}=ft(o);return(i||s||a)&&n.push({contextNames:i,stateNames:s,formStateNames:a,propName:r,propValue:o}),[r,it(o,t,{$$lazyForUseBrick:!0,$$stateOfUseBrick:"useBrick"===r?nt.USE_BRICK:nt.INITIAL})]})):[]}(P,E,O),R=t[kt];R&&x.push(...R);const _="script"===A;if(_||"link"===A){const e=await mt(x);if(_?e.src:"stylesheet"===e.rel&&e.href){const t=window.PUBLIC_ROOT??"";if(_){const{src:n,...r}=e;await Fr((0,d.loadScript)(n,t,r),"script",n,"silent")}else{const{href:n,...r}=e;await Fr((0,d.loadStyle)(n,t,r),"stylesheet",n,"silent")}return f}}const L={tag:gn.BRICK,type:k||A,return:e,slotId:s,events:t.events,runtimeContext:E,portal:t.portal,iid:t.iid,ref:t.ref};f.node=L;const B=(0,C.strictCollectMemberUsage)([t.events,t.lifeCycle],"PROCESSORS",2);B.size>0&&f.blockingList.push(Fr((0,d.loadProcessorsImperatively)(B,Oo()),"processors",[...B].join(", "),r.unknownBricks));const M=[];M.push((async()=>{L.properties=await mt(x),function(e,t){for(const n of t){const t=()=>{e.element&&vt(e.element,{[n.propName]:n.propValue},e.runtimeContext)};if(n.contextNames)for(const r of n.contextNames)e.runtimeContext.ctxStore.onChange(r,t);if(n.stateNames){const r=Re(e.runtimeContext,"STATE",`: "${n.propValue}"`);for(const e of n.stateNames)r.onChange(e,t)}if(n.formStateNames){const r=Ue(e.runtimeContext,"FORM_STATE",`: "${n.propValue}"`);for(const e of n.formStateNames)r.onChange(e,t)}}}(L,O)})()),r.registerBrickLifeCycle(L,t.lifeCycle);let $,N=t;k?N=Ar(k,t,L,x,r):A===Ir&&(N=function(e,t,n,r,o){var i;const s="string"==typeof e?JSON.parse(e):e,a=(0,g.uniqueId)("form-state-"),c={...n.runtimeContext,formStateStoreId:a};delete c.forEachItem,delete c.forEachIndex,delete c.tplStateStoreId;const l=new yr("FORM_STATE",void 0,o,a);c.formStateStoreMap.set(a,l),c.formStateStoreScope&&c.formStateStoreScope.push(l);const u=s.context??[];u.some((e=>"params"===e.name))||u.push({name:"params"}),l.define(u,c,r);const d=Tr(s.formSchema,s.fields,a);return Or.includes(d.brick)&&t.events&&(d.events=function(e,t){const n=e??{};for(const[e,r]of Object.entries(t))n[e]=(0,p.hasOwnProperty)(n,e)?[n[e],r].flat():r;return n}(d.events,t.events)),"boolean"!=typeof(null===(i=t.properties)||void 0===i?void 0:i.renderRoot)||t.properties.renderRoot?{...t,slots:void 0,children:[{brick:"eo-micro-view",properties:{style:{padding:"12px"}},children:[d]}]}:{...t,slots:void 0,children:[d]}}(I,t,L,x,r)),N.portal&&(L.slotId=void 0),k?($={...E},delete $.forEachItem,delete $.forEachIndex):$=E;return M.push((async()=>{const e=Ur(N.children,N.slots);if(!e)return;const t=new Map,n=await Promise.all(Object.entries(e).map(((e,n)=>{let[s,a]=e;if("routes"!==a.type)return Rr(L,a.bricks,$,r,o,i,s,c);const l=o[o.length-1];return null!=l&&l.incrementalSubRoutes&&(t.set(n,s),r.performIncrementalRender(a,o,(async(e,t)=>{const{homepage:n}=$.app,{pathname:c}=e;if(!y(n,c)||!o.every((e=>{let r,o;return(r=At(e,n,t.pathname))&&(o=At(e,n,c))&&(e!==l||(0,g.isEqual)(r.params,o.params))})))return!1;const[u,d,p]=Mr({...$,location:e,query:new URLSearchParams(e.search)});let f,h=!1,m=[];try{if(f=await xr(L,a.routes,u,r,o,i,s,!0),f.route){if(r.reBailout(f))return!0;m=[...d,...p],await Br(f,u,[u.ctxStore,...m])}await r.reMergeMenuRequestNodes(i,a.routes,f.menuRequestNode)}catch(e){console.error("Incremental sub-router failed:",e);const t=r.reCatch(e,L);if(!t)return!0;({failed:h,output:f}=t),await r.reMergeMenuRequestNodes(i,a.routes,f.menuRequestNode)}if(r.reRender(s,[],f.node,L),!h){u.ctxStore.mountAsyncData(f.route);for(const e of m)e.mountAsyncData()}return!!f.route||null}))),xr(L,a.routes,$,r,o,i,s)}))),s={...f,node:void 0,blockingList:[],menuRequestNode:void 0};n.forEach(((e,n)=>{t.has(n)&&r.memoize(t.get(n),[],e.node,L),$r(s,e),function(e,t){const n=t.menuRequestNode;if(n)if(e.menuRequestNode){let t=e.menuRequestNode;for(;t.sibling;)t=t.sibling;t.sibling=n}else e.menuRequestNode=n}(s,e)})),s.node&&(L.child=s.node),$r(f,{...s,node:void 0}),Nr(i,f.menuRequestNode=s.menuRequestNode)})()),await Promise.all(M),f}(e,t,n,r,o,i,s,a,c)}catch(n){if(t.errorBoundary)return console.error("Error caught by error boundary:",n),{node:{tag:gn.BRICK,type:"div",properties:{textContent:Ut(n),dataset:{errorBoundary:""},style:{color:"var(--color-error)"}},runtimeContext:null,return:e},blockingList:[]};throw n}}function Lr(e){return[e.ctxStore,...e.tplStateStoreMap.values(),...e.formStateStoreMap.values()]}function Br(e,t,n){return(0,d.flushStableLoadBricks)(),Promise.all([...e.blockingList,...n.map((e=>e.waitForAll())),...t.pendingPermissionsPreCheck])}function Mr(e){const t=[],n=[];return[{...e,tplStateStoreScope:t,formStateStoreScope:n},t,n]}function $r(e,t){const{blockingList:n,node:r,menuRequestNode:o,hasTrackingControls:i,...s}=t;if(e.blockingList.push(...n),r)if(e.node){let t=e.node;for(;t.sibling;)t=t.sibling;t.sibling=r}else e.node=r;Object.assign(e,s)}function Nr(e,t){if(t)if(e.child){let n=e.child;for(;n.sibling;)n=n.sibling;n.sibling=t}else e.child=t}function Ur(e,t){let n=t;if(Array.isArray(e)&&!n){n={};for(const t of e){const e=t.slot??"";(0,p.hasOwnProperty)(n,e)||(n[e]={type:"bricks",bricks:[]}),n[e].bricks.push(t)}}return n}function Fr(e,t,n,r){return"silent"===r?e.catch((e=>{console.error('Load %s "%s" failed:',t,n,e)})):e}let jr,Dr,Vr;function Wr(){if(!jr){if(jr={isInIframe:!1,isInIframeOfSameSite:!1,isInIframeOfNext:!1,isInIframeOfVisualBuilder:!1,isInIframeOfLegacyConsole:!1},window!==window.parent){jr.isInIframe=!0;try{if(window.origin===window.parent.origin){jr.isInIframeOfSameSite=!0;const e="/next/"===m(),t=window.parent.location.pathname,n=t.startsWith("/next/");jr.isInIframeOfNext=0==(Number(e)^Number(n)),jr.isInIframeOfVisualBuilder=t.startsWith((n?"/next":"")+"/visual-builder/"),jr.isInIframeOfLegacyConsole=e&&!n}}catch(e){}}Object.freeze(jr)}return jr}function Hr(e){var t;if(e.$$registerCustomTemplateProcessed)return;e.$$registerCustomTemplateProcessed=!0;const n=null===(t=e.meta)||void 0===t?void 0:t.customTemplates;if(Array.isArray(n))for(const t of n){const n=t.name.includes(".")?t.name:`${e.app.id}.${t.name}`;xe.define(n,t)}}function qr(e){let t;t="8.2"===e?"v8-2":"v8",document.documentElement.dataset.ui=t}const Gr="basic.show-watermark";var zr=new WeakMap,Kr=new WeakMap,Jr=new WeakMap,Xr=new WeakMap,Yr=new WeakMap,Qr=new WeakMap,Zr=new WeakMap,eo=new WeakMap,to=new WeakMap,no=new WeakMap,ro=new WeakMap,oo=new WeakMap,io=new WeakSet;class so{constructor(e){(0,o.A)(this,io),(0,s.A)(this,zr,void 0),(0,s.A)(this,Kr,!1),(0,s.A)(this,Jr,void 0),(0,s.A)(this,Xr,void 0),(0,s.A)(this,Yr,void 0),(0,s.A)(this,Qr,void 0),(0,s.A)(this,Zr,new Set),(0,s.A)(this,eo,0),(0,s.A)(this,to,void 0),(0,s.A)(this,no,void 0),(0,s.A)(this,ro,void 0),(0,s.A)(this,oo,void 0),(0,c.A)(zr,this,e);const t=P();window.addEventListener("beforeunload",(e=>{(0,a.A)(io,this,ao).call(this,{})?(e.preventDefault(),e.returnValue=""):delete e.returnValue})),t.block(((e,t)=>(0,a.A)(io,this,ao).call(this,{location:e,action:t})))}getRenderId(){return(0,l.A)(to,this)}getRuntimeContext(){return(0,l.A)(Yr,this)}getRecentApps(){return{currentApp:(0,l.A)(no,this),previousApp:(0,l.A)(ro,this)}}getNavConfig(){return(0,l.A)(oo,this)}bootstrap(){window.AbortController&&(Dr=new AbortController,O.http.interceptors.request.use((e=>{var t;return{...e,options:{...e.options,signal:null!==(t=e.options)&&void 0!==t&&t.noAbortOnRouteChange?null:Dr.signal}}})));const e=P();(0,c.A)(Jr,this,e.location);let t=0;return e.listen((async(e,n)=>{var r,o,i,s;const u=++t;let d;const p={hash:void 0,state:void 0};var f;if(void 0!==e.key&&("POP"!==n||void 0!==(0,l.A)(Jr,this).key&&!1!==(null===(r=(0,l.A)(Jr,this).state)||void 0===r?void 0:r.notify))||(p.key=void 0),((0,h.locationsAreEqual)({...(0,l.A)(Jr,this),...p},{...e,...p})||"POP"!==n&&!1===(null===(o=e.state)||void 0===o?void 0:o.notify))&&(d=!0),d||null!==(i=e.state)&&void 0!==i&&i.noIncremental||(d=await(null===(f=(0,l.A)(Qr,this))||void 0===f?void 0:f.didPerformIncrementalRender(e,(0,l.A)(Jr,this)))),t===u)if(d)(0,c.A)(Jr,this,e);else{if(Dr&&(Dr.abort(),Dr=new AbortController),(0,c.A)(Jr,this,e),null===(s=(0,l.A)(Qr,this))||void 0===s||s.dispatchPageLeave(),"POP"===n&&w(v((0,l.A)(zr,this),e.pathname)))return void window.location.reload();(0,l.A)(Kr,this)?(0,c.A)(Xr,this,e):(W("locationChange"),(0,a.A)(io,this,lo).call(this,e).catch(Wt))}})),(0,a.A)(io,this,lo).call(this,e.location)}}function ao(e){var t;const n=P(),r=n.getBlockMessage();null===(t=(0,l.A)(Qr,this))||void 0===t||t.dispatchBeforePageLeave(e);const o=n.getBlockMessage();return!r&&o&&n.unblock(),o}function co(e,t,n){var r,o;if((0,c.A)(eo,this,(r=(0,l.A)(eo,this),o=r++,r)),o>10){const t=`Infinite redirect detected: from "${n.pathname}${n.search}${n.hash}" to "${e}"`;throw new Error(t)}P().replace(e,t)}async function lo(e){(0,c.A)(Kr,this,!0);try{await(0,a.A)(io,this,uo).call(this,e)}finally{if((0,c.A)(Kr,this,!1),(0,l.A)(Xr,this)){const e=(0,l.A)(Xr,this);(0,c.A)(Xr,this,void 0),await(0,a.A)(io,this,lo).call(this,e)}}}async function uo(e){var t,n,r,o;const i=(0,c.A)(to,this,(0,g.uniqueId)("render-id-"));De=new WeakSet,He.clear(),null==wo||null===(t=wo.flowApi)||void 0===t||t.clearCollectWidgetContract(),P().unblock();const s=null==wo||null===(n=wo.pageView)||void 0===n?void 0:n.create(),u=v((0,l.A)(zr,this),e.pathname),p=null===(r=(0,l.A)(Yr,this))||void 0===r?void 0:r.app,f=null==u||null===(o=u.app)||void 0===o?void 0:o.id;window.BOOTSTRAP_UNION_FILE&&f&&f!==(null==p?void 0:p.id)&&function(e){const{appId:t,version:n}=e;window.APP_ROOT_TPL&&(window.APP_ID=t,window.APP_ROOT=window.APP_ROOT_TPL.replace("{id}",t).replace("{version}",n))}({appId:f,version:u.app.currentVersion}),null!=u&&u.app&&await async function(e){if(!e.$$fulfilled)return e.$$fulfilling||(e.$$fulfilling=async function(e){var t;await(null==wo||null===(t=wo.fulfilStoryboard)||void 0===t?void 0:t.call(wo,e)),B(e),Object.assign(e,{$$fulfilled:!0,$$fulfilling:null})}(e)),e.$$fulfilling}(u);const h=(0,c.A)(no,this,null==u?void 0:u.app);!function(){var e,t,n,r,o;const i=Eo().getFeatureFlags(),s=Eo().getMiscSettings();if(!i["show-watermark"])return;const a="0.0.0"===(null===(e=window.APP_ROOT)||void 0===e||null===(e=e.match(/versions\/([^/]+)\//))||void 0===e?void 0:e[1])||"0.0.0"===(null===(t=window.APP_ROOT)||void 0===t||null===(t=t.match(/micro-apps\/(?:v2|v3)\/[^/]+\/([^/]+)/))||void 0===t?void 0:t[1]),c=(null==wo||null===(n=wo.auth)||void 0===n||null===(n=n.getAuth())||void 0===n?void 0:n.username)??"",l=s.watermarkConfig??{flags:{}},u={content:[..."string"==typeof l.content?[l.content]:l.content??[],null!==(r=l.flags)&&void 0!==r&&r["show-development"]&&a?"Development":"",null!==(o=l.flags)&&void 0!==o&&o["show-user"]?c:""].filter(Boolean),zIndex:1001,width:200,font:{fontSize:28},gap:[190,190],...(0,g.omit)(l,["content","flags"])};Vr?Vr.resolve(u):(0,d.loadBricksImperatively)([Gr],Oo()).then((()=>{Vr=document.createElement(Gr),Vr.resolve(u)}),(e=>{console.error("Load watermark service failed:",e)}))}();const m=p&&h?p.id!==h.id:p!==h,y=Eo().getFeatureFlags(),w=(0,l.A)(Qr,this),b=(t,n)=>{null==s||s({status:"redirected"}),(0,l.A)(Zr,this).add(w),(0,a.A)(io,this,co).call(this,t,n,e)},E=()=>{const t=y["sso-enabled"]?"/sso-auth/login":"/auth/login";Nt(e),b(t,{from:e})},S=document.querySelector("#main-mount-point"),A=document.querySelector("#portal-mount-point"),k={tag:gn.ROOT,container:S,createPortal:A},I=()=>{var e;vn(S),vn(A),(0,l.A)(Zr,this).add(w);for(const e of(0,l.A)(Zr,this))e&&(e.dispatchOnUnmount(),e.dispose());(0,l.A)(Zr,this).clear(),null==wo||null===(e=wo.messageDispatcher)||void 0===e||e.reset(),m&&((0,c.A)(ro,this,p),window.dispatchEvent(new CustomEvent("app.change",{detail:{previousApp:p,currentApp:h}})))};if(Q(h&&(re()[h.id]||h.theme)||"light"),ie("default"),h){var T,C,x,R,_,L;null==wo||null===(T=wo.checkInstalledApps)||void 0===T||T.preCheckInstalledApps(u,(e=>!!Ro(e)));const t={bailout:e=>e.unauthenticated?(E(),!0):e.redirect?(b(e.redirect.path,e.redirect.state),!0):void(0,c.A)(eo,this,0),mergeMenus:async e=>{const t=await Promise.all(e);(0,c.A)(oo,this,function(e){const t={breadcrumb:[]};for(const n of e){const{breadcrumb:e}=n;e&&(e.overwrite?t.breadcrumb=e.items:t.breadcrumb.push(...e.items))}return t}(t)),window.dispatchEvent(new CustomEvent("navConfig.change",{detail:(0,l.A)(oo,this)}))},catch:(t,n)=>{if(!Ft(t)||window.NO_AUTH_GUARD){if(!(t instanceof O.HttpAbortError)){const r=Eo().getMiscSettings().noAuthGuardLoginPath;return Ft(t)&&r?void b(r,{from:e}):{failed:!0,output:{node:{tag:gn.BRICK,type:"div",properties:{textContent:Ut(t),dataset:{errorBoundary:""},style:{color:"var(--color-error)"}},runtimeContext:null,return:n},blockingList:[]}}}(0,l.A)(Zr,this).add(w)}else E()}},n=(0,c.A)(Qr,this,new Rn("page",{routeHelper:t,renderId:i})),r=(0,c.A)(Yr,this,{app:h,location:e,query:new URLSearchParams(e.search),flags:y,sys:{...null==wo||null===(C=wo.auth)||void 0===C?void 0:C.getAuth(),...Wr(),settings:{brand:Eo().getBrandSettings()}},ctxStore:new yr("CTX",void 0,n),pendingPermissionsPreCheck:[null==wo||null===(x=wo.checkPermissions)||void 0===x?void 0:x.preCheckPermissions(u)],tplStateStoreMap:new Map,formStateStoreMap:new Map});(0,c.A)(oo,this,void 0),Hr(u),me(null===(R=u.meta)||void 0===R?void 0:R.functions,h),null==wo||null===(_=wo.flowApi)||void 0===_||_.collectContract(null===(L=u.meta)||void 0===L?void 0:L.contracts);let o,a=!1,d=[];try{Vn.clear();const e={};if(o=await xr(k,function(e){if(window.parent===window)return e;let t=e;const n=(0,g.findLastIndex)(t,(e=>e.path.startsWith("${APP.homepage}/_dev_only_/template-preview/")));t=[...t.slice(0,n+1),{path:"${APP.homepage}/_dev_only_/template-preview/:templateId",bricks:[{brick:"span"}],menu:!1,exact:!0},...t.slice(n+1)];const r=(0,g.findLastIndex)(t,(e=>e.path.startsWith("${APP.homepage}/_dev_only_/snippet-preview/")));return t=[...t.slice(0,r+1),{path:"${APP.homepage}/_dev_only_/snippet-preview/:snippetId",bricks:[{brick:"span"}],menu:!1,exact:!0},...t.slice(r+1)],t}(u.routes),r,n,[],e),t.bailout(o))return;d=Lr(r),await Br(o,r,d),e.child=o.menuRequestNode,n.setInitialMenuRequestNode(e),await t.mergeMenus(n.getMenuRequests())}catch(e){console.error("Router failed:",e);const n=t.catch(e,k);if(!n)return;({failed:a,output:o}=n)}if(k.child=o.node,I(),o.route&&"routes"!==o.route.type||a){if(a||n.dispatchBeforePageLoad(),te(),ae(),qr(null==h?void 0:h.uiVersion),yn(k),window.scrollTo(0,0),a)null==s||s({status:"failed"});else{n.dispatchPageLoad(),n.dispatchAnchorLoad(),n.dispatchOnMount(),n.initializeScrollIntoView(),n.initializeMediaChange(),n.initializeMessageDispatcher();for(const e of d)e.mountAsyncData();null==s||s({status:"ok",path:o.path,pageTitle:document.title})}return void W("rendered")}}else{if(!window.NO_AUTH_GUARD&&null!=wo&&wo.auth&&!wo.auth.isLoggedIn())return void E();I()}te(),ae();const M={tag:gn.BRICK,type:"div",properties:{textContent:"Page not found"},runtimeContext:null,return:k};k.child=M,yn(k),window.scrollTo(0,0),null==s||s({status:"not-found"}),W("rendered")}const po="undefined"!=typeof BRICK_PACKAGES?BRICK_PACKAGES:null;var fo=n(3999);function ho(e){const t=[];if(["light","dark"].forEach((n=>{if(e[n])switch(e.type){case"brandColor":t.push((0,fo.LP)(n,e[n]));break;case"baseColors":t.push((0,fo.eC)(n,e[n],e.backgroundColor));break;case"variables":t.push((0,fo.Gb)(n,e[n]))}})),t.length>0){const e=document.createElement("style");return e.textContent=t.join("\n\n"),document.head.appendChild(e),()=>{e.remove()}}}let mo,go,vo,yo,wo;function bo(e){if(mo)throw new Error("Cannot create multiple runtimes");return window.addEventListener("message",(e=>{let{data:t}=e;if((null==t?void 0:t.source)!==U)return;const n=t.payload;switch(null==n?void 0:n.type){case F:V=n.active;break;case j:D=n.panel}})),wo=null==e?void 0:e.hooks,(0,u.initializeI18n)(Lt,Bt),f.locale(u.i18n.language),u.i18n.on("languageChanged",(()=>{f.locale(u.i18n.language)})),I(),mo=new Io,mo}const Eo=function(){const e=k();if(e)return function(){return new Proxy(e.getRuntime(),{get(){switch(arguments.length<=1?void 0:arguments[1]){case"getCurrentApp":case"getRecentApps":case"hasInstalledApp":case"getDesktops":case"getLaunchpadSettings":case"getLaunchpadSiteMap":case"toggleLaunchpadEffect":case"applyPageTitle":case"getNavConfig":case"getFeatureFlags":case"getMiscSettings":case"getBrandSettings":return Reflect.get(...arguments)}}})}}()||function(){return mo};var So=new WeakMap,Ao=new WeakMap,ko=new WeakSet;class Io{constructor(){(0,o.A)(this,ko),(0,s.A)(this,So,!1),(0,s.A)(this,Ao,!1),(0,i.A)(this,"version",3)}initialize(e){var t;if((0,l.A)(So,this))throw new Error("The runtime cannot be initialized more than once");(0,c.A)(So,this,!0),function(e){(0,p.isObject)(e.settings)&&(0,p.deepFreeze)(e.settings),e.brickPackages&&(0,p.deepFreeze)(e.brickPackages)}(e),go=e;const{notification:n,dialog:r}=(0,a.A)(ko,this,Po).call(this);var o;!1!==n&&(o=n??"basic.show-notification",(0,this.loadBricks)([o]).then((()=>{Dt=document.createElement(o)}),(e=>{console.error("Load notification service failed:",e)}))),!1!==r&&function(e,t){t([e]).then((()=>{Mt=document.createElement(e)}),(e=>{console.error("Load dialog service failed:",e)}))}(r??"basic.show-dialog",this.loadBricks),function(e){e&&(e.brandColor?ho({type:"brandColor",...e.brandColor}):e.baseColors?ho({type:"baseColors",...e.baseColors}):e.variables&&ho({type:"variables",...e.variables}))}(null===(t=e.settings)||void 0===t||null===(t=t.misc)||void 0===t?void 0:t.theme)}async bootstrap(e){if(e&&this.initialize(e),(0,l.A)(Ao,this))throw new Error("The runtime cannot be bootstrapped more than once");(0,c.A)(Ao,this,!0),vo=new so(go.storyboards),await vo.bootstrap()}getRecentApps(){var e;return(null===(e=vo)||void 0===e?void 0:e.getRecentApps())??{}}getCurrentApp(){var e;return null===(e=vo)||void 0===e?void 0:e.getRecentApps().currentApp}hasInstalledApp(e,t){return Ne(e,t)}getFeatureFlags(){var e,t;return{...null===(e=go)||void 0===e||null===(e=e.settings)||void 0===e?void 0:e.featureFlags,...null===(t=vo)||void 0===t||null===(t=t.getRecentApps().currentApp)||void 0===t||null===(t=t.config)||void 0===t||null===(t=t.settings)||void 0===t?void 0:t.featureFlags,"migrate-to-brick-next-v3":!0}}getMiscSettings(){var e,t;return{...null===(e=go)||void 0===e||null===(e=e.settings)||void 0===e?void 0:e.misc,...null===(t=vo)||void 0===t||null===(t=t.getRecentApps().currentApp)||void 0===t||null===(t=t.config)||void 0===t||null===(t=t.settings)||void 0===t?void 0:t.misc}}getBrandSettings(){var e;return{base_title:"DevOps 管理专家",...null===(e=go)||void 0===e||null===(e=e.settings)||void 0===e?void 0:e.brand}}getLaunchpadSettings(){var e;return{columns:7,rows:4,...null===(e=go)||void 0===e||null===(e=e.settings)||void 0===e?void 0:e.launchpad}}getDesktops(){var e;return(null===(e=go)||void 0===e?void 0:e.desktops)??[]}getLaunchpadSiteMap(){var e;return(null===(e=go)||void 0===e?void 0:e.siteSort)??[]}toggleLaunchpadEffect(e){document.body.classList.toggle("launchpad-open",e)}applyPageTitle(e){const t=this.getBrandSettings().base_title;document.title=e?`${e} - ${t}`:t}getNavConfig(){var e;return null===(e=vo)||void 0===e?void 0:e.getNavConfig()}loadBricks(e){return(0,d.loadBricksImperatively)(e,Oo())}}function Po(){var e;return(null===(e=go)||void 0===e||null===(e=e.settings)||void 0===e?void 0:e.presetBricks)??{}}function Oo(){var e;return yo??(yo=function(e,t){if(null==t||!t.length)return e;const n=new Map;return[...t,...e].forEach((e=>{const t=e.filePath.split("/")[1];n.has(t)||n.set(t,e)})),Array.from(n.values())}((null===(e=go)||void 0===e?void 0:e.brickPackages)??po??window.STANDALONE_BRICK_PACKAGES??[],window.PUBLIC_DEPS))}function To(){var e;return null===(e=vo)||void 0===e?void 0:e.getRenderId()}function Co(){var e;return null===(e=vo)||void 0===e?void 0:e.getRuntimeContext()}function xo(e){var t;return null===(t=go)||void 0===t||null===(t=t.storyboards)||void 0===t?void 0:t.find((t=>t.app.id===e))}function Ro(e){var t;return null===(t=xo(e))||void 0===t?void 0:t.app}function _o(){for(var e,t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];null==wo||null===(e=wo.auth)||void 0===e||null===(t=e.authenticate)||void 0===t||t.call(e,...r)}function Lo(){var e;return null==wo||null===(e=wo.auth)||void 0===e?void 0:e.getAuth()}function Bo(){var e,t;return null==wo||null===(e=wo.auth)||void 0===e||null===(t=e.logout)||void 0===t?void 0:t.call(e)}function Mo(){var e;return null==wo||null===(e=wo.auth)||void 0===e?void 0:e.isLoggedIn()}var $o=new WeakMap;const No=new class{constructor(){(0,s.A)(this,$o,new Map)}define(e,t){if((0,l.A)($o,this).has(e))throw new Error(`Custom editor of "${e}" already registered`);(0,l.A)($o,this).set(e,t)}get(e){return(0,l.A)($o,this).get(e)}};async function Uo(e,t,n){return Ge(await je(e),e,"resolve",t,n)}function Fo(e){let t,{portal:n,scope:r="fragment",unknownBricks:o}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n;t=n||(()=>(i=document.createElement("div"),i.style.position="absolute",i.style.width=i.style.height="0",document.body.append(i),i));let s,a,c=!1;return{async render(n){let{theme:l,uiVersion:u,context:d,functions:p,templates:f,i18n:h,url:m,app:v}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(c)throw new Error("The root is unmounted and cannot be rendered any more");const y=[].concat(n),w=s,b=(0,g.uniqueId)("render-id-");s=new Rn(r,{unknownBricks:o,renderId:b});const E={ctxStore:new yr("CTX",void 0,s),pendingPermissionsPreCheck:[],tplStateStoreMap:new Map,formStateStoreMap:new Map};if(m){const e=new URL(m);E.query=e.searchParams,E.location={pathname:e.pathname,search:e.search,hash:e.hash,state:void 0}}const S={tag:gn.ROOT,container:e,createPortal:t};if("page"===r){var A;Q(l??"light"),ie("default"),qr(u),v??(v={id:"demo",homepage:"/demo"}),E.app=v;const e={app:v,meta:{i18n:h,customTemplates:f}};null===(A=a)||void 0===A||A(),a=B(e),Hr(e),me(p,v)}E.ctxStore.define(d,E);let k,I=!1,P=[];try{k=await Rr(S,y,E,s,[],{}),P=Lr(E),await Br(k,E,P)}catch(e){I=!0,k={node:{tag:gn.BRICK,type:"div",properties:{textContent:Ut(e),dataset:{errorBoundary:""},style:{color:"var(--color-error)"}},return:S,runtimeContext:null},blockingList:[]}}if(S.child=k.node,null==w||w.dispatchOnUnmount(),null==w||w.dispose(),vn(e),i&&vn(i),"page"===r&&(I||s.dispatchBeforePageLoad(),te(),ae()),yn(S),"page"===r&&window.scrollTo(0,0),!I){for(const e of P)e.mountAsyncData();"page"===r&&s.dispatchPageLoad(),s.dispatchOnMount(),s.initializeScrollIntoView(),s.initializeMediaChange(),s.initializeMessageDispatcher()}},unmount(){c||(c=!0,vn(e),i&&(vn(i),n||i.remove()))}}}function jo(e){let{useRealTimeQuery:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n={...Co()};t&&(n.query=new URLSearchParams(P().location.search));const r=t=>{if("string"==typeof t){if((0,T.isEvaluable)(t)){const e=et(t,n);return Ve(e),e}return(0,x.inject)(t,n)}return!(0,p.isObject)(t)||We(e)?t:Array.isArray(t)?t.map((e=>r(e))):Object.fromEntries(Object.entries(t).map((e=>{let[t,n]=e;return[r(t),r(n)]})))};return r(e)}},2561:(e,t,n)=>{n.r(t),n.d(t,{supply:()=>s});var r=n(1030),o=n(1302),i=n(1894);function s(e,t,n){const r={undefined:void 0};for(const o of e)if(!Object.prototype.hasOwnProperty.call(r,o))if(t&&Object.prototype.hasOwnProperty.call(t,o))r[o]=t[o];else{const e=u(o,n);void 0!==e&&(r[o]=e)}return r}const a=new Set(["fill","pull","pullAll","pullAllBy","pullAllWith","pullAt","remove","reverse","assign","assignIn","assignInWith","assignWith","defaults","defaultsDeep","merge","mergeWith","set","setWith","unset","update","updateWith","after","ary","before","bind","bindKey","curry","curryRight","debounce","defer","delay","flip","memoize","negate","once","overArgs","partial","partialRight","rearg","rest","spread","throttle","unary","wrap"]),c=new Set(["lang","langData","locale","localeData","defineLocale","updateLocale","updateOffset"]),l=new Set(["Array","Boolean","Date","Infinity","JSON","Math","NaN","Number","String","RegExp","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","isFinite","isNaN","parseFloat","parseInt","Map","Set","URLSearchParams","WeakMap","WeakSet","atob","btoa"]);function u(e,t){switch(e){case"Object":return n=Object,s=["entries","fromEntries","keys","values"],Object.fromEntries(s.map((e=>[e,function(){for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return n[e].apply(n,r)}])));case"_":return Object.fromEntries(Object.entries(r).filter((e=>!a.has(e[0]))).concat(t?[["uniqueId",e=>`${e??""}42`]]:[]));case"moment":return Object.assign((function(){return o(...arguments)}),Object.fromEntries(Object.entries(o).filter((e=>!c.has(e[0])))));case"PIPES":return i.pipes;case"TAG_URL":return d(!0);case"SAFE_TAG_URL":return d();default:if(l.has(e))return window[e]}var n,s}function d(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];const i=[];return t.forEach(((t,n)=>{i.push(t),n<r.length&&i.push(e?String(r[n]).replace(/[^/]+/g,(e=>encodeURIComponent(e))):encodeURIComponent(String(r[n])))})),i.join("")}}},916:(e,t,n)=>{n.r(t),n.d(t,{JsonStorage:()=>d,createProviderClass:()=>o,createSSEStream:()=>s,deepFreeze:()=>c,hasOwnProperty:()=>l,isObject:()=>u,unwrapProvider:()=>f});var r=n(5060);function o(e){return class extends HTMLElement{get $$typeof(){return"provider"}resolve(){return e(...arguments)}async saveAs(t){for(var n=arguments.length,o=new Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];const s=await e(...o);(0,r.saveAs)(s,t)}}}var i=n(2110);async function s(e,t){const n=[],r=[];let o=!1,s=!1;const{converter:c,...l}=t??{};function u(){r.forEach((e=>{let[t]=e;return t({value:void 0,done:!0})}))}function d(){o=!0,r.length=0,n.length=0}return await new Promise(((t,o)=>{(0,i.y)(e,{...l,openWhenHidden:!0,async onopen(e){if(!e.ok)throw console.error("open error",e.statusText),new Error(e.statusText);t(null)},onmessage(e){let t,o,i=!0;try{t=(c??a)(e.data,e.event)}catch(e){i=!1,o=e}if(r.length>0){const[e,n]=r.shift();i?e(t):n(o)}else n.push(i?{ok:!0,data:t}:{ok:!1,reason:o})},onclose(){s=!0,u()},onerror(e){throw e}}).catch((e=>{o(e),function(e){r.forEach((t=>{let[n,r]=t;return r(e)})),d()}(e)}))})),{next(){return o?this.return():new Promise(((e,t)=>{if(n.length>0){const r=n.shift();r.ok?e(r.data):t(r.reason)}else s?(d(),e({value:void 0,done:!0})):r.push([e,t])}))},return:()=>(u(),d(),Promise.resolve({value:void 0,done:!0})),throw:e=>(u(),d(),Promise.reject(e)),[Symbol.asyncIterator](){return this}}}function a(e,t){if("error"===t){var n;let t;console.error("Received error event:",e);try{t=JSON.parse(e)}catch{}throw new Error("string"==typeof(null===(n=t)||void 0===n?void 0:n.error)?t.error:e)}if("[DONE]"===e)return{value:void 0,done:!0};if(e.startsWith("[ERROR]"))throw console.error("Received error message:",e),new Error(e);try{return{value:JSON.parse(e),done:!1}}catch(t){throw console.error("Failed to parse message:",e),t}}function c(e){const t=Object.getOwnPropertyNames(e);for(const n of t){const t=e[n];t&&"object"==typeof t&&c(t)}return Object.freeze(e)}function l(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function u(e){const t=typeof e;return null!=e&&("object"==t||"function"==t)}class d{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"brick-next-";this.storage=e,this.prefix=t}setItem(e,t){this.storage.setItem(this.prefix+e,JSON.stringify(t))}getItem(e){return JSON.parse(this.storage.getItem(this.prefix+e)??"null")}removeItem(e){return this.storage.removeItem(this.prefix+e)}clear(){return this.storage.clear()}}const p=new Map;function f(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o=function(e){let t=p.get(e);return t||(t=document.createElement(e),p.set(e,t),t)}(e);return o.resolve(...n)}}},5177:(e,t,n)=>{function r(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return function(o,i){if("string"==typeof t?o.name===t:t.includes(o.name)){const t=[];for(let s=1;s<=n;s++){const n=i[i.length-s];if("MemberExpression"===(null==n?void 0:n.node.type)&&"object"===n.key){const i=n.node;i.computed||"Identifier"!==i.property.type?i.computed&&"Literal"===i.property.type&&"string"==typeof i.property.value?t.push(r?`${o.name}.${i.property.value}`:i.property.value):e.hasNonStaticUsage=!0:t.push(r?`${o.name}.${i.property.name}`:i.property.name)}else e.hasNonStaticUsage=!0}t.length===n&&e.usedProperties.add(t.join("."))}}}function o(e,t){return function(n,r,o){if(r.name===e){const e=o[o.length-1],r=o[o.length-2];if("CallExpression"===(null==r?void 0:r.node.type)&&"callee"===(null==r?void 0:r.key)&&"MemberExpression"===(null==e?void 0:e.node.type)&&"object"===e.key&&(e.node.computed?"Literal"===e.node.property.type&&e.node.property.value===t:"Identifier"===e.node.property.type&&e.node.property.name===t)){const e=r.node.arguments;if(e.length>0){const t=e[0];"Literal"===t.type&&"string"==typeof t.value?n.usedArgs.add(t.value):n.hasNonStaticUsage=!0}}}}}n.r(t),n.d(t,{beforeVisitGlobalMember:()=>r,collectAppGetMenuUsage:()=>i,collectInstalledAppsHasUsage:()=>s,collectMemberUsage:()=>d,collectMemberUsageInFunction:()=>g,createProviderClass:()=>c.createProviderClass,scanPermissionActionsInAny:()=>b,scanPermissionActionsInStoryboard:()=>w,strictCollectMemberUsage:()=>u,track:()=>p,trackAll:()=>f,traverseStoryboardExpressions:()=>l,traverseStoryboardFunction:()=>m,traverseStoryboardFunctions:()=>h,unwrapProvider:()=>c.unwrapProvider});const i=o("APP","getMenu"),s=o("INSTALLED_APPS","has");var a=n(971),c=n(4113);function l(e,t,n){const r=new WeakSet,{matchExpressionString:o,visitNotMatchedExpressionString:i,visitNonExpressionString:s,visitObject:l}="string"==typeof n?{matchExpressionString:e=>e.includes(n)}:n;!function e(n){if("string"==typeof n)if((0,a.isEvaluable)(n))if(o(n))try{(0,a.preevaluate)(n,{withParent:!0,hooks:{beforeVisitGlobal(e,r){t(e,r,n)}}})}catch(e){console.error("Parse storyboard expression failed:",e)}else null==i||i(n);else null==s||s(n);else if((0,c.isObject)(n)){if(r.has(n))return;r.add(n),null==l||l(n);for(const t of Array.isArray(n)?n:Object.values(n))e(t)}}(e)}function u(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;const{hasNonStaticUsage:r,nonStaticUsage:o,usedProperties:i}=d(e,t,n);if(r)throw new Error(`Non-static usage of ${t} is prohibited, check your expression: "${o}"`);return i}function d(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;const o={usedProperties:new Set,hasNonStaticUsage:!1},i=r(o,t,n);return l(e,((e,t,n)=>{i(e,t),o.hasNonStaticUsage&&(o.nonStaticUsage=n)}),t),o}function p(e,t,n){if(e.includes(t)){const o={usedProperties:new Set,hasNonStaticUsage:!1},{expression:i}=(0,a.preevaluate)(e,{withParent:!0,hooks:{beforeVisitGlobal:r(o,n)}});let s;if("SequenceExpression"===i.type&&(s=i.expressions[0])&&"Literal"===s.type&&s.value===t){if(o.usedProperties.size>0)return o.usedProperties;console.warn(`You are using "${t}" but no \`${n}\` usage found in your expression: ${JSON.stringify(e)}`)}}return!1}function f(e){if(e){const t={usedProperties:new Set,hasNonStaticUsage:!1};if((0,a.preevaluate)(e,{withParent:!0,hooks:{beforeVisitGlobal:r(t,["CTX","STATE","FORM_STATE"],1,!0)}}),t.usedProperties.size>0){const e=[...t.usedProperties],n={context:!1,state:!1,formState:!1},r={CTX:"context",STATE:"state",FORM_STATE:"formState"};return e.forEach((e=>{const[t,o]=e.split(".");n[r[t]]||(n[r[t]]=[]),n[r[t]].push(o)})),n}console.warn(`You are using track all but no "CTX" or "STATE" or "FORM_STATE" usage found in your expression: ${JSON.stringify(e)}`)}return!1}function h(e,t){if(Array.isArray(e))for(const n of e)m(n,t)}function m(e,t,n){try{(0,a.precookFunction)(e.source,{typescript:e.typescript,withParent:!0,hooks:{beforeVisitGlobal:t}})}catch(t){n||console.error(`Parse storyboard function "${e.name}" failed:`,t)}}function g(e,t,n){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;const i={usedProperties:new Set,hasNonStaticUsage:!1};if(m(e,r(i,t,o),n),i.hasNonStaticUsage&&!n)throw new Error(`Non-static usage of ${t} is prohibited, check your function: "${e.name}"`);return i.usedProperties.delete(e.name),i.usedProperties}const v="PERMISSIONS",y="check";function w(e){const t=new Set,n=E(t),{customTemplates:r,functions:o}=e.meta??{};return l([e.routes,r],n,v),h(o,n),Array.from(t)}function b(e){const t=new Set;return l(e,E(t),v),Array.from(t)}function E(e){return function(t,n){if(t.name===v){const t=n[n.length-1],r=n[n.length-2];if("CallExpression"===(null==r?void 0:r.node.type)&&"callee"===(null==r?void 0:r.key)&&"MemberExpression"===(null==t?void 0:t.node.type)&&"object"===t.key&&(t.node.computed?"Literal"===t.node.property.type&&t.node.property.value===y:"Identifier"===t.node.property.type&&t.node.property.name===y))for(const t of r.node.arguments)"Literal"===t.type&&"string"==typeof t.value&&e.add(t.value)}}}}}]);
2
- //# sourceMappingURL=core.48d5cedd.js.map