@next-core/brick-container 3.5.19 → 3.5.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next-core/brick-container",
3
- "version": "3.5.19",
3
+ "version": "3.5.21",
4
4
  "description": "Brick Container Server",
5
5
  "homepage": "https://github.com/easyops-cn/next-core/tree/v3/packages/brick-container",
6
6
  "license": "GPL-3.0",
@@ -45,11 +45,11 @@
45
45
  "@next-api-sdk/api-gateway-sdk": "^1.1.0",
46
46
  "@next-api-sdk/micro-app-standalone-sdk": "^1.1.0",
47
47
  "@next-core/build-next-bricks": "^1.13.4",
48
- "@next-core/easyops-runtime": "^0.6.20",
49
- "@next-core/http": "^1.0.8",
48
+ "@next-core/easyops-runtime": "^0.6.21",
49
+ "@next-core/http": "^1.1.0",
50
50
  "@next-core/i18n": "^1.0.24",
51
51
  "@next-core/loader": "^1.4.0",
52
- "@next-core/runtime": "^1.21.1",
52
+ "@next-core/runtime": "^1.21.2",
53
53
  "@next-core/test-next": "^1.0.8",
54
54
  "@next-core/theme": "^1.1.1",
55
55
  "@next-core/types": "^1.6.0",
@@ -64,5 +64,5 @@
64
64
  "@next-core/runtime": "*",
65
65
  "@next-core/utils": "*"
66
66
  },
67
- "gitHead": "2a0572667e1d95a2cf324067efdcfa948623fba2"
67
+ "gitHead": "31e5b227a3a50a5cebb41daed142e588c4781d4f"
68
68
  }
@@ -46,6 +46,76 @@ def get_snippets_from_stories(stories_content):
46
46
  return ret_snippets
47
47
 
48
48
 
49
+ def get_v3_story(br):
50
+ story_id = br.get("name", "")
51
+ if not story_id:
52
+ return
53
+ story = { "storyId": story_id, "v3Brick": True, "type": "brick" }
54
+ desc = br.get("description")
55
+ if type(desc) != dict:
56
+ desc = {"en": desc, "zh": desc}
57
+ story["description"] = desc
58
+
59
+ text = br.get("text")
60
+ if not text:
61
+ text = desc
62
+ story["text"] = text
63
+
64
+ story["category"] = br.get("category", "other")
65
+ story["alias"] = br.get("alias", [])
66
+ story["icon"] = br.get("icon")
67
+
68
+ doc = br.get("doc", {})
69
+ properties = br.get("properties")
70
+ events = br.get("events")
71
+ slots = br.get("slots")
72
+ methods = br.get("methods")
73
+ parts = br.get("parts")
74
+ if "id" not in doc:
75
+ doc["id"] = story_id
76
+ if "name" not in doc:
77
+ doc["name"] = story_id
78
+ if "docKink" not in doc:
79
+ doc["docKink"] = "brick"
80
+ if "description" not in doc:
81
+ doc["description"] = desc
82
+ if "properties" not in doc:
83
+ doc["properties"] = properties
84
+ if "events" not in doc:
85
+ doc["events"] = events
86
+ if "methods" not in doc:
87
+ doc["methods"] = methods
88
+ if "parts" not in doc:
89
+ doc["parts"] = parts
90
+ # TODO: interface in doc
91
+ story["doc"] = doc
92
+
93
+ # TODO: conf
94
+
95
+ return story
96
+
97
+
98
+ def collect_stories(install_path):
99
+ stories_path = os.path.join(install_path, "dist", "stories.json")
100
+ manifest_path = os.path.join(install_path, "dist", "manifest.json")
101
+ # v2 brick
102
+ if os.path.exists(stories_path):
103
+ with open(stories_path) as stories_file:
104
+ stories_content = simplejson.load(stories_file)
105
+ return stories_content
106
+ # v3 brick
107
+ elif os.path.exists(manifest_path):
108
+ with open(manifest_path) as manifest_file:
109
+ manifest_content = simplejson.load(manifest_file)
110
+ stories_content = []
111
+ for br in manifest_content.get("bricks", []):
112
+ story = get_v3_story(br)
113
+ if story:
114
+ stories_content.append(story)
115
+ return stories_content
116
+ return []
117
+
118
+
49
119
  def collect(install_path):
50
120
  if not os.path.exists(install_path):
51
121
  raise Exception("could not find install path {}".format(install_path))
@@ -60,10 +130,7 @@ def collect(install_path):
60
130
  stories_path = os.path.join(install_path, "dist", "stories.json")
61
131
  with open(bricks_path) as bricks_file:
62
132
  bricks_content = simplejson.load(bricks_file)
63
- stories_content = []
64
- if os.path.exists(stories_path):
65
- with open(stories_path) as stories_file:
66
- stories_content = simplejson.load(stories_file)
133
+ stories_content = collect_stories(install_path)
67
134
  snippets_from_stories = get_snippets_from_stories(stories_content)
68
135
  snippets_path = os.path.join(install_path, "dist", "snippets.json")
69
136
  snippets_content = {"snippets": []}
@@ -237,3 +304,4 @@ if __name__ == "__main__":
237
304
  report_nt(org, install_path)
238
305
  else:
239
306
  sys.exit(0)
307
+
@@ -1,2 +0,0 @@
1
- "use strict";(self.webpackChunk_next_core_brick_container=self.webpackChunk_next_core_brick_container||[]).push([[321],{3350:(e,t,r)=>{r.r(t);var n=r(4795),a=r(3028),i=r(1181),o=r(9516),s=r(6236),c=r(1995);r(5745),XMLHttpRequest.prototype.origOpen=XMLHttpRequest.prototype.open,XMLHttpRequest.prototype.open=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.origOpen.apply(this,t);var n=c.auth.getAuth().csrfToken;n&&this.setRequestHeader("X-CSRF-Token",n)};var l=r(1989);function u(){return p.apply(this,arguments)}function p(){return(p=(0,n.Z)((function*(){if(!window.NO_AUTH_GUARD){var e=yield(0,l.u)();e.loggedIn&&c.auth.authenticate(e)}}))).apply(this,arguments)}var d=r(2159),f=r(9397),v=r(9505),h=r(8843),m=r(9686),g=r(5178),y=r(9169),b=r(3934);function w(e,t,r){return{get(n){if(t)return"".concat((0,i.getBasePath)(),"api/gateway/object_store.object_store.GetObject/api/v1/objectStore/bucket/next-builder/object/").concat(n);var a=window.APP_ROOT?"".concat(window.APP_ROOT,"-/"):"";return window.APP_ID&&window.APP_ID!==e&&(a=a.replace(new RegExp("(^|/)".concat((0,g.escapeRegExp)(window.APP_ID),"/")),"$1".concat(e,"/")).replace(/\/\d+\.\d+\.\d+\//,"/".concat(r,"/"))),a.startsWith("/")||(a=(0,i.getBasePath)()+a),"".concat(a,"micro-apps/").concat(e,"/images/").concat(n)}}}var S=["feature_flags"],E=["featureFlags","misc"];function k(){return(k=(0,n.Z)((function*(){var e=[o.http.get(window.BOOTSTRAP_FILE),o.http.get("".concat(window.APP_ROOT,"conf.yaml"),{responseType:"text"}),(0,v.I)().catch((e=>{console.warn("request runtime api from api-gateway failed: ",e,", something might went wrong running standalone micro app")}))];if(!window.NO_AUTH_GUARD){var t,r=window.APP_ID||(window.APP_ROOT&&(t=window.APP_ROOT.match(/^(?:(?:\/next)?\/)?sa-static\/([^/]+)\/versions\//))?t[1]:null);r&&Z(r)}var[n,i,s]=yield Promise.all(e);return function(e,t){var r;try{r=t?(0,y.safeLoad)(t,{schema:y.JSON_SCHEMA,json:!0}):void 0}catch(e){throw console.error("Parse conf.yaml failed",e),new Error("Invalid conf.yaml")}if(r){var{sys_settings:n,user_config:i,user_config_by_apps:o}=r;if(n){var{feature_flags:s}=n,c=(0,d.Z)(n,S);e.settings=(0,a.Z)({featureFlags:s},c)}if(i&&1===e.storyboards.length)e.storyboards[0].app.userConfig=i;else if(o)for(var{app:l}of e.storyboards)(0,m.hasOwnProperty)(o,l.id)&&(l.userConfig=o[l.id])}}(n,i),function(e,t){var r;if(t){var{featureFlags:n,misc:i}=t,o=(0,d.Z)(t,E),s=null!==(r=e.settings)&&void 0!==r?r:e.settings={};s.featureFlags=(0,a.Z)((0,a.Z)({},s.featureFlags),n),s.misc=(0,a.Z)((0,a.Z)({},s.misc),i),Object.assign(s,o)}}(n,null==s?void 0:s.settings),n}))).apply(this,arguments)}var A=new Map;function Z(e){return P.apply(this,arguments)}function P(){return(P=(0,n.Z)((function*(e){if(A.has(e))return A.get(e);var t=(0,b.z)(e).catch((e=>{console.warn("request standalone runtime api from micro-app-standalone failed: ",e,", something might went wrong running standalone micro app")}));return A.set(e,t),t}))).apply(this,arguments)}function I(){return(I=(0,n.Z)((function*(e){if(window.STANDALONE_MICRO_APPS){if(!window.NO_AUTH_GUARD){var t=yield Z(e.app.id);if(t){var{userConfig:r,injectMenus:n}=t;e.app.userConfig=(0,a.Z)((0,a.Z)({},e.app.userConfig),r),function(e){if(Array.isArray(e))for(var t of e)t.overrideApp&&O(t.overrideApp)}(n),e.meta=(0,a.Z)((0,a.Z)({},e.meta),{},{injectMenus:n})}}}else{var{routes:i,meta:o,app:s}=yield(0,h.i)(e.app.id,{});Object.assign(e,{routes:i,meta:o,app:(0,a.Z)((0,a.Z)({},e.app),s)})}!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/")){var r=e.app.menuIcon.imgSrc.split("/"),n=r[r.length-1],a=w(e.app.id,e.app.isBuildPush,e.app.currentVersion).get(n);e.app.menuIcon.imgSrc=a}}(e),O(e.app)}))).apply(this,arguments)}function O(e){e.config=(0,m.deepFreeze)((0,g.merge)({},e.defaultConfig,e.userConfig))}var C=r(2923),x=!1,T=/^https?:\/\/localhost(?:$|:)/;function R(){return(R=(0,n.Z)((function*(e,t){if(x||!t)return!1;if("failed"===(yield e))return!1;x=!0;var r=t===location.origin||T.test(t)||T.test(location.origin);if(!r){var{allowedPreviewFromOrigins:n}=(0,i.getRuntime)().getMiscSettings();Array.isArray(n)&&(r=n.some((e=>e===t))),r||console.error("Preview is disallowed, from origin: ".concat(t,", while allowing: ").concat(JSON.stringify(n)))}return r}))).apply(this,arguments)}var B=["agent"];o.http.interceptors.request.use((e=>{var t,r,n;null!==(t=e.options)&&void 0!==t&&null!==(t=t.interceptorParams)&&void 0!==t&&t.ignoreLoadingBar||window.dispatchEvent(new Event("request.start"));var i=new Headers((null===(r=e.options)||void 0===r?void 0:r.headers)||{});i.set("lang",null!==(n=s.i18n.resolvedLanguage)&&void 0!==n?n:s.i18n.language);var{csrfToken:o}=c.auth.getAuth();o&&i.set("X-CSRF-Token",o);var l=(()=>{for(var e="",t=0;t<16;t+=1)e+="0123456789abcdef"[Math.floor(16*Math.random())];return e})();return i.set("X-B3-Traceid","ffffffffffffffff".concat(l)),i.set("X-B3-Spanid",l),i.set("X-B3-Sampled","1"),(0,a.Z)((0,a.Z)({},e),{},{options:(0,a.Z)((0,a.Z)({},e.options),{},{headers:i})})})),o.http.interceptors.response.use((function(e){return window.dispatchEvent(new Event("request.end")),e}),(function(e){return window.dispatchEvent(new Event("request.end")),Promise.reject(e)}));var M=document.querySelector("#global-loading-bar");M.classList.add("rendered");var _=!1,L=0;function F(){var e=L>0;e!==_&&(_=e,M.classList[e?"add":"remove"]("loading"))}window.addEventListener("request.start",(()=>{L++,F()})),window.addEventListener("request.end",(()=>{L>0&&(L--,F())}));var U=(0,i.createRuntime)({hooks:{auth:c.auth,fulfilStoryboard:function(e){return I.apply(this,arguments)},checkPermissions:c.checkPermissions,flowApi:c.flowApi,checkInstalledApps:c.checkInstalledApps,menu:c.menu,images:{imagesFactory:w,widgetImagesFactory:function(e,t){return{get(r){var n;return"".concat(null!==(n=window.PUBLIC_ROOT)&&void 0!==n?n:"","bricks/").concat(e,"/").concat(window.PUBLIC_ROOT_WITH_VERSION&&t?"".concat(t,"/"):"","dist/assets/").concat(r)}}}},messageDispatcher:c.messageDispatcher}});function N(){return(N=(0,n.Z)((function*(){try{var[,e]=yield Promise.all([u(),window.STANDALONE_MICRO_APPS?function(){return k.apply(this,arguments)}():(0,f.S)({appFields:"defaultConfig,userConfig,locales,name,homepage,id,currentVersion,installStatus,internal,status,icons,standaloneMode",ignoreTemplateFields:"templates",ignoreBrickFields:"bricks,processors,providers,editors"})]);return yield U.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: ".concat((0,i.httpErrorToString)(e)),"failed"}}))).apply(this,arguments)}var j=function(){return N.apply(this,arguments)}();window.parent!==window&&function(e){var t=function(){var r=(0,n.Z)((function*(r){var{data:n,origin:a}=r,i=function(e){return"preview-container"===(null==e?void 0:e.sender)&&"start-preview"===e.type}(n),o=function(e){return"ui-test-preview"===(null==e?void 0:e.channel)&&"initialize"===e.type}(n);if(i||o){window.removeEventListener("message",t);var s=yield function(e,t){return R.apply(this,arguments)}(e,a);if(s){var c,l;if(i){var u=n.options;({agent:c}=u),l=(0,d.Z)(u,B)}else({agent:c,options:l}=n.payload);yield(0,C.loadBricksImperatively)([c.brick],[c.pkg]);var p=document.createElement(c.brick);yield p.resolve(a,l)}}}));return function(e){return r.apply(this,arguments)}}();window.addEventListener("message",t)}(j)},6919:(e,t,r)=>{r.r(t),r.d(t,{cook:()=>F,isEvaluable:()=>z,isTrackAll:()=>G,precook:()=>D,precookFunction:()=>q,preevaluate:()=>H,shouldAllowRecursiveEvaluations:()=>K});var n=r(6666);class a{constructor(){(0,n.Z)(this,"VariableEnvironment",void 0),(0,n.Z)(this,"LexicalEnvironment",void 0),(0,n.Z)(this,"Function",void 0)}}class i{constructor(e){(0,n.Z)(this,"OuterEnv",void 0),(0,n.Z)(this,"bindingMap",new Map),this.OuterEnv=e}HasBinding(e){return this.bindingMap.has(e)}CreateMutableBinding(e,t){return this.bindingMap.set(e,{mutable:!0,deletable:t}),h(void 0)}CreateImmutableBinding(e,t){return this.bindingMap.set(e,{strict:t}),h(void 0)}InitializeBinding(e,t){var r=this.bindingMap.get(e);return Object.assign(r,{initialized:!0,value:t}),h(void 0)}SetMutableBinding(e,t,r){var n=this.bindingMap.get(e);if(!n.initialized)throw new ReferenceError("".concat(e," is not initialized"));if(!n.mutable)throw new TypeError("Assignment to constant variable");return n.value=t,h(void 0)}GetBindingValue(e,t){var r=this.bindingMap.get(e);if(!r.initialized)throw new ReferenceError("".concat(e," is not initialized"));return r.value}}class o extends i{}class s extends i{}var c=Symbol.for("SourceNode"),l=Symbol.for("FormalParameters"),u=Symbol.for("ECMAScriptCode"),p=Symbol.for("Environment"),d=Symbol.for("IsConstructor");class f{constructor(e,t,r){(0,n.Z)(this,"Base",void 0),(0,n.Z)(this,"ReferenceName",void 0),(0,n.Z)(this,"Strict",void 0),this.Base=e,this.ReferenceName=t,this.Strict=r}}class v{constructor(e,t){(0,n.Z)(this,"Type",void 0),(0,n.Z)(this,"Value",void 0),this.Type=e,this.Value=t}}function h(e){return new v("normal",e)}var m=Symbol("empty completion");function g(e){var t=new Set,r=e=>{if(Array.isArray(e))for(var n of e)r(n);else if(e)switch(e.type){case"Identifier":return void t.add(e.name);case"VariableDeclaration":return r(e.declarations);case"VariableDeclarator":case"FunctionDeclaration":return r(e.id);case"ArrayPattern":return r(e.elements);case"AssignmentPattern":return r(e.left);case"ObjectPattern":return r(e.properties);case"Property":return r(e.value);case"RestElement":return r(e.argument)}};return r(e),Array.from(t)}function y(e){var 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 b(e,t){var r=[],n={var:t.var},a=(e,t)=>{if(Array.isArray(e))for(var i of e)a(i,t);else if(e){switch(e.type){case"FunctionDeclaration":return void(Number(!t.var)^Number(t.topLevel)&&r.push(e));case"VariableDeclaration":return void(Number(!t.var)^Number("var"===e.kind)&&r.push(e));case"SwitchCase":return void a(e.consequent,n);case"CatchClause":return void a(e.body,n)}if(t.var)switch(e.type){case"BlockStatement":case"DoWhileStatement":case"WhileStatement":return void a(e.body,n);case"IfStatement":return a(e.consequent,n),void a(e.alternate,n);case"ForStatement":return a(e.init,n),void a(e.body,n);case"ForInStatement":case"ForOfStatement":return a(e.left,n),void a(e.body,n);case"SwitchStatement":return void a(e.cases,n);case"TryStatement":return a(e.block,n),a(e.handler,n),void a(e.finalizer,n)}}};return a(e,t),r}function w(e){return"unresolvable"!==e.Base&&!(e.Base instanceof i)}function S(e,t){return e.Base.InitializeBinding(e.ReferenceName,t)}function E(e,t,r){if(null==t)return e;var n=Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t));for(var a of n)if(!r.has(a)){var i=Object.getOwnPropertyDescriptor(t,a);null!=i&&i.enumerable&&(e[a]=t[a])}return e}function k(e,t){var r="const"===e.kind;for(var n of g(e))r?t.CreateImmutableBinding(n,!0):t.CreateMutableBinding(n,!1)}function A(e){return"normal"===e.Type||"continue"==e.Type}function Z(e,t){return e.Value!==m?e:new v(e.Type,t)}function P(e){if(e instanceof v&&(e=e.Value),!(e instanceof f))return e;if("unresolvable"===e.Base)throw new ReferenceError("".concat(e.ReferenceName," is not defined"));return e.Base instanceof i?e.Base.GetBindingValue(e.ReferenceName,e.Strict):e.Base[e.ReferenceName]}function I(e){return"symbol"==typeof e?e:String(e)}function O(e,t){return e[t]}function C(e,t){if("unresolvable"===e.Base)throw new ReferenceError("".concat(e.ReferenceName," is not defined"));return e.Base instanceof i?e.Base.SetMutableBinding(e.ReferenceName,t,e.Strict):(e.Base[e.ReferenceName]=t,h(void 0))}function x(e){if(t=e,!(Array.isArray(t)||null!=t&&"function"==typeof t[Symbol.iterator]))throw new TypeError("".concat(typeof e," is not iterable"));var t;return e[Symbol.iterator]()}function T(e){if(null==e)throw new TypeError("Cannot destructure properties of undefined or null")}function R(e,t,r){return e?e.HasBinding(t)?new f(e,t,r):R(e.OuterEnv,t,r):new f("unresolvable",t,r)}function B(e,t,r){switch(t){case"+":return e+r;case"-":return e-r;case"/":return e/r;case"%":return e%r;case"*":return e*r;case"**":return e**r;case"==":return e==r;case"===":return e===r;case"!=":return e!=r;case"!==":return e!==r;case">":return e>r;case"<":return e<r;case">=":return e>=r;case"<=":return e<=r}throw new SyntaxError("Unsupported binary operator `".concat(t,"`"))}var M=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")}()]);function _(e){if(M.has(e))throw new TypeError("Cannot access reserved objects such as `Function`.")}var L=new WeakSet([Array,Map,Set,URLSearchParams,WeakMap,WeakSet,RegExp]);function F(e,t){var r,{rules:n,globalVariables:i={},hooks:M={}}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},F="FunctionDeclaration"!==e.type,U=new o(null),N=new a;N.VariableEnvironment=U,N.LexicalEnvironment=U;var j=[N];for(var[D,V]of Object.entries(i))U.CreateImmutableBinding(D,!0),U.InitializeBinding(D,V);var W=new WeakMap;function $(e,r){var n,a,i;switch(null===(n=M.beforeEvaluate)||void 0===n||n.call(M,e),e.type){case"ArrayExpression":var s=[];for(var c of e.elements)if(c)if("SpreadElement"===c.type){var l=P($(c.argument));s.push(...l)}else s.push(P($(c)));else s.length+=1;return h(s);case"ArrowFunctionExpression":return pe(e),h(ie(e,q().LexicalEnvironment,!1));case"BinaryExpression":var u=P($(e.left)),p=$(e.right).Value,y=P(p);if(F&&"|>"===e.operator){if("function"!=typeof y){var b=t.substring(e.right.start,e.right.end);throw new TypeError("".concat(b," is not a function"))}var O;return p instanceof f&&w(p)&&(O=p.Base),h(y.call(O,u))}return h(B(u,e.operator,y));case"CallExpression":var T=$(e.callee,r).Value,R=P(T);return null==R&&(e.optional||null!=r&&r.skipped)?(r.skipped=!0,h(void 0)):(_(R),te(R,T,e.arguments,e.callee));case"ChainExpression":return $(e.expression,{});case"ConditionalExpression":return h(P($(P($(e.test))?e.consequent:e.alternate)));case"Identifier":return h(H(e.name));case"Literal":if(e.regex){if(null===e.value)throw new SyntaxError("Invalid regular expression: ".concat(e.raw));if(e.regex.flags.includes("u"))throw new SyntaxError("Unsupported unicode flag in regular expression: ".concat(e.raw))}return h(e.value);case"LogicalExpression":var U=P($(e.left));switch(e.operator){case"&&":return h(U&&P($(e.right)));case"||":return h(U||P($(e.right)));case"??":return h(null!=U?U:P($(e.right)));default:throw new SyntaxError("Unsupported logical operator '".concat(e.operator,"'"))}case"MemberExpression":var N=P($(e.object,r).Value);if(null==N&&(e.optional||null!=r&&r.skipped))return r.skipped=!0,h(void 0);_(N);var j=e.computed?function(e,t,r){var n=I(P($(t)));return new f(e,n,!0)}(N,e.property):function(e,t,r){var n=t.name;return new f(e,n,!0)}(N,e.property);return _(j),h(j);case"NewExpression":return function(e,r){var n=P($(e)),a=re(r);if("function"!=typeof n||!1===n[d]){var i=t.substring(e.start,e.end);throw new TypeError("".concat(i," is not a constructor"))}if(!function(e){return L.has(e)||e===Date}(n)){var o=t.substring(e.start,e.end);throw new TypeError("".concat(o," is not an allowed constructor"))}return h(new n(...a))}(e.callee,e.arguments);case"ObjectExpression":var D={};for(var V of e.properties)if("SpreadElement"===V.type)E(D,P($(V.argument)),new Set);else{if("init"!==V.kind)throw new SyntaxError("Unsupported object getter/setter");var W=V.computed||"Identifier"!==V.key.type?se(V.key):V.key.name;if("__proto__"===W)throw new TypeError("Setting '__proto__' property is not allowed");D[W]=P($(V.value))}return h(D);case"SequenceExpression":var J;for(var X of e.expressions)J=h(P($(X)));return J;case"TemplateLiteral":var Q=[e.quasis[0].value.cooked],ae=0;for(var ce of e.expressions){var le=P($(ce));Q.push(String(le)),Q.push(e.quasis[ae+=1].value.cooked)}return h(Q.join(""));case"TaggedTemplateExpression":var ue=$(e.tag).Value,de=P(ue);return _(de),te(de,ue,e.quasi,e.tag);case"UnaryExpression":var fe=$(e.argument).Value;if(!F&&"delete"===e.operator){if(!(fe instanceof f))return h(!0);if(w(fe))return h(delete fe.Base[fe.ReferenceName])}return"typeof"===e.operator?fe instanceof f&&"unresolvable"===fe.Base?h("undefined"):h(typeof P(fe)):h(function(e,t){switch(t){case"!":return!e;case"+":return+e;case"-":return-e;case"void":return}throw new SyntaxError("Unsupported unary operator `".concat(t,"`"))}(P(fe),e.operator))}if(!F)switch(e.type){case"AssignmentExpression":if("="===e.operator){if("ArrayPattern"!==e.left.type&&"ObjectPattern"!==e.left.type){var ve=$(e.left).Value,he=P($(e.right));return C(ve,he),h(he)}var me=P($(e.right));return Y(e.left,me),h(me)}var ge=$(e.left).Value,ye=P(ge),be=P($(e.right)),we=function(e,t,r){switch(t){case"+=":case"-=":case"*=":case"/=":case"%=":case"**=":return B(e,t.substr(0,t.length-1),r)}throw new SyntaxError("Unsupported assignment operator `".concat(t,"`"))}(ye,e.operator,be);return C(ge,we),h(we);case"BlockStatement":if(!e.body.length)return h(m);var Se=q().LexicalEnvironment,Ee=new o(Se);ee(e.body,Ee),q().LexicalEnvironment=Ee;var ke=ne(e.body);return q().LexicalEnvironment=Se,ke;case"BreakStatement":return new v("break",m);case"ContinueStatement":return new v("continue",m);case"EmptyStatement":case"FunctionDeclaration":return h(m);case"DoWhileStatement":return z(function(e){for(var t;;){var r=$(e.body);if(!A(r))return Z(r,t);if(r.Value!==m&&(t=r.Value),!P($(e.test)))return h(t)}}(e));case"ExpressionStatement":case"TSAsExpression":return $(e.expression);case"ForInStatement":case"ForOfStatement":return z(function(e){var t=e.left,r="VariableDeclaration"===t.type?"var"===t.kind?"varBinding":"lexicalBinding":"assignment",n="lexicalBinding"===r?g(t):[],a="ForInStatement"===e.type?"enumerate":"iterate",i=function(e,t,r){var n=q(),a=n.LexicalEnvironment;if(e.length>0){var i=new o(a);for(var s of e)i.CreateMutableBinding(s,!1);n.LexicalEnvironment=i}var c=$(t);n.LexicalEnvironment=a;var l=P(c);if("enumerate"===r){if(null==l)return new v("break",m);var u=function*(e){for(var t in e)yield t}(l);return h(u)}return h(x(l))}(n,e.right,a);return"normal"!==i.Type?i:function(e,t,r,n,a){for(var i,s="assignment"===a?e:e.declarations[0].id,c=q().LexicalEnvironment,l="ObjectPattern"===s.type||"ArrayPattern"===s.type;;){var{done:u,value:p}=r.next();if(u)return h(i);var d=void 0,f=void 0;if("lexicalBinding"===a){if(k(e,f=new o(c)),q().LexicalEnvironment=f,!l){var[v]=g(s);d=H(v)}}else l||(d=$(s).Value);l?"assignment"===a?Y(s,p):oe(s,p,"varBinding"===a?void 0:f):"lexicalBinding"===a?S(d,p):C(d,p);var y=$(t);if(q().LexicalEnvironment=c,!A(y)){var b=Z(y,i);if("enumerate"!==n&&void 0!==r.return){var w=r.return();if(!w||!["object","function"].includes(typeof w))throw new TypeError("Iterator result is not an object")}return b}y.Value!==m&&(i=y.Value)}}(t,e.body,i.Value,a,r)}(e));case"ForStatement":return z(function(e){var t;if("VariableDeclaration"===(null===(t=e.init)||void 0===t?void 0:t.type)){if("var"===e.init.kind)return $(e.init),G(e.test,e.update,e.body,[]);var r=q().LexicalEnvironment,n=new o(r),a="const"===e.init.kind,i=g(e.init);for(var s of i)a?n.CreateImmutableBinding(s,!0):n.CreateMutableBinding(s,!1);q().LexicalEnvironment=n,$(e.init);var c=a?[]:Array.from(i),l=G(e.test,e.update,e.body,c);return q().LexicalEnvironment=r,l}return e.init&&P($(e.init)),G(e.test,e.update,e.body,[])}(e));case"FunctionExpression":return pe(e),h(function(e){var t=q().LexicalEnvironment;if(e.id){var r=e.id.name,n=new o(t);n.CreateImmutableBinding(r,!1);var a=ie(e,n,!0);return n.InitializeBinding(r,a),a}return ie(e,t,!0)}(e));case"IfStatement":return P($(e.test))?(null!==(a=M.beforeBranch)&&void 0!==a&&a.call(M,e,"if"),Z($(e.consequent),void 0)):(null!==(i=M.beforeBranch)&&void 0!==i&&i.call(M,e,"else"),e.alternate?Z($(e.alternate),void 0):h(void 0));case"ReturnStatement":var Ae;return e.argument&&(Ae=P($(e.argument))),new v("return",Ae);case"ThrowStatement":throw P($(e.argument));case"UpdateExpression":var Ze=$(e.argument).Value,Pe=Number(P(Ze)),Ie="++"===e.operator?Pe+1:Pe-1;return C(Ze,Ie),h(e.prefix?Ie:Pe);case"SwitchCase":return ne(e.consequent);case"SwitchStatement":var Oe=P($(e.discriminant)),Ce=q().LexicalEnvironment,xe=new o(Ce);ee(e.cases,xe),q().LexicalEnvironment=xe;var Te=function(e,t){var r,n=e.findIndex((e=>!e.test)),a=n>=0,i=a?e.slice(0,n):e,o=!1;for(var s of i)if(o||(o=K(s,t)),o){var c=$(s);if(c.Value!==m&&(r=c.Value),"normal"!==c.Type)return Z(c,r)}if(!a)return h(r);var l=!1,u=e.slice(n+1);if(!o)for(var p of u)if(l||(l=K(p,t)),l){var d=$(p);if(d.Value!==m&&(r=d.Value),"normal"!==d.Type)return Z(d,r)}if(l)return h(r);var f=$(e[n]);if(f.Value!==m&&(r=f.Value),"normal"!==f.Type)return Z(f,r);for(var v of u){var g=$(v);if(g.Value!==m&&(r=g.Value),"normal"!==g.Type)return Z(g,r)}return h(r)}(e.cases,Oe);return q().LexicalEnvironment=Ce,z(Te);case"TryStatement":var Re;try{Re=$(e.block)}catch(t){if(!e.handler)throw t;var Be;null===(Be=M.beforeEvaluate)||void 0===Be||Be.call(M,e.handler),Re=function(e,t){if(!e.param)return $(e.body);var r=q().LexicalEnvironment,n=new o(r);for(var a of g(e.param))n.CreateMutableBinding(a,!1);q().LexicalEnvironment=n,oe(e.param,t,n);var i=$(e.body);return q().LexicalEnvironment=r,i}(e.handler,t)}finally{if(e.finalizer){var Me=$(e.finalizer);"normal"!==Me.Type&&(Re=Me)}}return Re;case"VariableDeclaration":var _e;for(var Le of e.declarations)if(Le.init)if("Identifier"===Le.id.type){var Fe=H(Le.id.name),Ue=P($(Le.init));_e="var"===e.kind?C(Fe,Ue):S(Fe,Ue)}else{var Ne=P($(Le.init));_e=oe(Le.id,Ne,"var"===e.kind?void 0:q().LexicalEnvironment)}else _e="var"===e.kind?h(m):S(H(Le.id.name),void 0);return _e;case"WhileStatement":return z(function(e){for(var t;;){if(!P($(e.test)))return h(t);var r=$(e.body);if(!A(r))return Z(r,t);r.Value!==m&&(t=r.Value)}}(e))}throw new SyntaxError("Unsupported node type `".concat(e.type,"`"))}function q(){return j[j.length-1]}function H(e,t){return t||(t=q().LexicalEnvironment),R(t,e,!0)}function z(e){return"break"===e.Type?e.Value===m?h(void 0):h(e.Value):e}function K(e,t){return t===P($(e.test))}function G(e,t,r,n){var a;for(J(n);;){if(e&&!P($(e)))return h(a);var i=$(r);if(!A(i))return Z(i,a);i.Value&&(a=i.Value),J(n),t&&P($(t))}}function J(e){if(0!==e.length){var t=q().LexicalEnvironment,r=t.OuterEnv,n=new o(r);for(var a of e){n.CreateMutableBinding(a,!1);var i=t.GetBindingValue(a,!1);n.InitializeBinding(a,i)}q().LexicalEnvironment=n}}function Y(e,t){if("ObjectPattern"===e.type)return T(t),e.properties.length>0&&function(e,t){var r=new Set;for(var n of e)if("Property"===n.type){var a=n.computed||"Identifier"!==n.key.type?se(n.key):n.key.name,i="AssignmentPattern"===n.value.type?n.value.left:n.value;if("Identifier"===i.type){var o=H(i.name),s=O(t,a);"AssignmentPattern"===n.value.type&&void 0===s&&(s=P($(n.value.right))),C(o,s),r.add(a)}else X(n.value,t,a),r.add(a)}else Q(n,t,r)}(e.properties,t),h(m);var r=x(t);return function(e,t){var r=h(m);for(var n of e)if(n){var a="RestElement"===n.type?n.argument:"AssignmentPattern"===n.type?n.left:n,i="ArrayPattern"===a.type||"ObjectPattern"===a.type,o=void 0;i||(o=$(a).Value);var s=void 0;if("RestElement"!==n.type){var{done:c,value:l}=t.next(),u=c?void 0:l;s="AssignmentPattern"===n.type&&void 0===u?P($(n.right)):u}else{s=[];for(var p=0;;){var{done:d,value:f}=t.next();if(d)break;s[p]=f,p++}}r=i?Y(a,s):C(o,s)}else t.next(),r=h(m);return r}(e.elements,r)}function X(e,t,r){var n,a="AssignmentPattern"===e.type?e.left:e,i="ArrayPattern"===a.type||"ObjectPattern"===a.type;i||(n=$(a).Value);var o,s=O(t,r);return o="AssignmentPattern"===e.type&&void 0===s?P($(e.right)):s,i?Y(a,o):C(n,o)}function Q(e,t,r){return C($(e.argument).Value,E({},t,r))}function ee(e,t){var r=b(e,{var:!1,topLevel:!1});for(var n of r){var a="VariableDeclaration"===n.type&&"const"===n.kind;for(var i of g(n))a?t.CreateImmutableBinding(i,!0):t.CreateMutableBinding(i,!1);if("FunctionDeclaration"===n.type){var[o]=g(n),s=ae(n,t);t.InitializeBinding(o,s)}}}function te(e,r,n,a){var i;r instanceof f&&w(r)&&(i=r.Base);var o=re(n);if("function"!=typeof e){var s=t.substring(a.start,a.end);throw new TypeError("".concat(s," is not a function"))}var c=e.apply(i,o);return _(c),h(c)}function re(e){var t=[];if(Array.isArray(e))for(var r of e)if("SpreadElement"===r.type){var n=P($(r.argument));t.push(...n)}else t.push(P($(r)));else for(var a of(t.push(function(e){var t=W.get(e);if(t)return t;var r=e.quasis.map((e=>e.value.raw)),n=e.quasis.map((e=>e.value.cooked));return Object.freeze(r),Object.defineProperty(n,"raw",{value:r,writable:!1,enumerable:!1,configurable:!1}),Object.freeze(n),W.set(e,n),n}(e)),e.expressions))t.push(P($(a)));return t}function ne(e){var t=h(m);for(var r of e){var n=$(r);if("normal"!==n.Type)return n;t=Z(t,n.Value)}return t}function ae(e,t){return ie(e,t,!0)}function ie(e,t,r){var i=function(){return function(e,t){var r;null===(r=M.beforeCall)||void 0===r||r.call(M,e[c]),function(e){var t=new a;t.Function=e;var r=new s(e[p]);t.VariableEnvironment=r,t.LexicalEnvironment=r,j.push(t)}(e);var i=function(e,t){return function(e,t,r){return function(e,t){for(var r=q(),a=e[u],i=e[l],s=g(i),c=y(i),p=b(a,{var:!0,topLevel:!0}),d=g(p),f=[],v=[],h=p.length-1;h>=0;h--){var m=p[h];if("FunctionDeclaration"===m.type){pe(m);var[w]=g(m);f.includes(w)||(f.unshift(w),v.unshift(m))}else if(null!=n&&n.noVar)throw new SyntaxError("Var declaration is not recommended, use `let` or `const` instead")}var S,E=r.LexicalEnvironment;for(var k of s)E.CreateMutableBinding(k,!1);if(le(i,x(t),E),c)for(var A of(S=new o(E),r.VariableEnvironment=S,d)){S.CreateMutableBinding(A,!1);var Z=void 0;s.includes(A)&&!f.includes(A)&&(Z=E.GetBindingValue(A,!1)),S.InitializeBinding(A,Z)}else{for(var P of d)s.includes(P)||(E.CreateMutableBinding(P,!1),E.InitializeBinding(P,void 0));S=E}var I=S;r.LexicalEnvironment=I;var O=b(a,{var:!1,topLevel:!0});for(var C of O)for(var T of g(C))"const"===C.kind?I.CreateImmutableBinding(T,!0):I.CreateMutableBinding(T,!1);for(var R of v){var[B]=g(R),M=ae(R,I);S.SetMutableBinding(B,M,!1)}}(t,r),Array.isArray(e)?ne(e):new v("return",P($(e)))}(e[u],e,t)}(e,t);if(j.pop(),"return"===i.Type)return i.Value}(i,arguments)};return Object.defineProperties(i,{[c]:{value:e},[l]:{value:e.params},[u]:{value:"BlockStatement"===e.body.type?e.body.body:e.body},[p]:{value:t},[d]:{value:r}}),i}function oe(e,t,r){switch(e.type){case"Identifier":return function(e,t,r){return r.InitializeBinding(e,t),h(m)}(e.name,t,r);case"ObjectPattern":return T(t),function(e,t,r){var n=new Set;for(var a of e){if("RestElement"===a.type)return ce(a,t,r,n);if(a.computed||"Identifier"!==a.key.type){var i=se(a.key);ue(a.value,t,r,i),n.add(i)}else ue(a.value,t,r,a.key.name),n.add(a.key.name)}return h(m)}(e.properties,t,r);case"ArrayPattern":var n=x(t);return le(e.elements,n,r)}}function se(e){return I(P($(e)))}function ce(e,t,r,n){var a=H(e.argument.name,r),i=E({},t,n);return r?S(a,i):C(a,i)}function le(e,t,r){if(0===e.length)return h(m);var n;for(var a of e)if(a)if("RestElement"===a.type)if("Identifier"===a.argument.type)for(var i=H(a.argument.name,r),o=[],s=0;;){var{done:c,value:l}=t.next();if(c){n=r?S(i,o):C(i,o);break}o[s]=l,s++}else for(var u=[],p=0;;){var{done:d,value:f}=t.next();if(d){n=oe(a.argument,u,r);break}u[p]=f,p++}else{var v="AssignmentPattern"===a.type?a.left:a;switch(v.type){case"ObjectPattern":case"ArrayPattern":var g=void 0,{done:y,value:b}=t.next();y||(g=b),"AssignmentPattern"===a.type&&void 0===g&&(g=P($(a.right))),n=oe(v,g,r);break;case"Identifier":var w=H(v.name,r),E=void 0,{done:k,value:A}=t.next();k||(E=A),"AssignmentPattern"===a.type&&void 0===E&&(E=P($(a.right))),n=r?S(w,E):C(w,E)}}else t.next(),n=h(m);return n}function ue(e,t,r,n){if("Identifier"===e.type||"AssignmentPattern"===e.type&&"Identifier"===e.left.type){var a=H("Identifier"===e.type?e.name:e.left.name,r),i=O(t,n);return"AssignmentPattern"===e.type&&void 0===i&&(i=P($(e.right))),r?S(a,i):C(a,i)}var o=O(t,n);return"AssignmentPattern"===e.type&&void 0===o&&(o=P($(e.right))),oe("AssignmentPattern"===e.type?e.left:e,o,r)}function pe(e){if(e.async||e.generator)throw new SyntaxError("".concat(e.async?"Async":"Generator"," function is not allowed"));if(F&&!e.expression)throw new SyntaxError("Only an `Expression` is allowed in `ArrowFunctionExpression`'s body")}if(F)return P($(e));null===(r=M.beforeEvaluate)||void 0===r||r.call(M,e),pe(e);var[de]=g(e);U.CreateImmutableBinding(de,!0);var fe=ae(e,U);return U.InitializeBinding(de,fe),fe}var U=r(3028);class N{constructor(){(0,n.Z)(this,"VariableEnvironment",void 0),(0,n.Z)(this,"LexicalEnvironment",void 0)}}class j{constructor(e){(0,n.Z)(this,"OuterEnv",void 0),(0,n.Z)(this,"bindingSet",new Set),this.OuterEnv=e}HasBinding(e){return this.bindingSet.has(e)}CreateBinding(e){this.bindingSet.add(e)}}function D(e){var{expressionOnly:t,visitors:r,withParent:n,hooks:a={}}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=new Set,o=[],s=new j(null),c=new N;function l(){return o[o.length-1]}function u(e,t,r){for(var n of t)p(e[n],null==r?void 0:r.concat({node:e,key:n}))}function p(e,n){if(Array.isArray(e))e.forEach(((e,t)=>{p(e,n?n.slice(0,-1).concat((0,U.Z)((0,U.Z)({},n[n.length-1]),{},{index:t})):n)}));else if(e){var o,s;switch(null===(o=a.beforeVisit)||void 0===o||o.call(a,e,n),function(e){var t,n;r&&(t=r,n=e.type,Object.prototype.hasOwnProperty.call(t,n))&&r[e.type](e)}(e),e.type){case"Identifier":var c;return V=e.name,void(f(l().LexicalEnvironment,V)||(null===(c=a.beforeVisitGlobal)||void 0===c||c.call(a,e,n),i.add(e.name)));case"ArrayExpression":case"ArrayPattern":return void u(e,["elements"],n);case"ArrowFunctionExpression":return void h(m(e,l().LexicalEnvironment),n);case"AssignmentPattern":case"BinaryExpression":case"LogicalExpression":return void u(e,["left","right"],n);case"CallExpression":case"NewExpression":return void u(e,["callee","arguments"],n);case"ChainExpression":return void u(e,["expression"],n);case"ConditionalExpression":return void u(e,["test","consequent","alternate"],n);case"MemberExpression":return u(e,["object"],n),void(e.computed&&u(e,["property"],n));case"ObjectExpression":case"ObjectPattern":return void u(e,["properties"],n);case"Property":return e.computed&&u(e,["key"],n),void u(e,["value"],n);case"RestElement":case"SpreadElement":case"UnaryExpression":return void u(e,["argument"],n);case"SequenceExpression":case"TemplateLiteral":return void u(e,["expressions"],n);case"TaggedTemplateExpression":return void u(e,["tag","quasi"],n);case"Literal":return}if(!t)switch(e.type){case"AssignmentExpression":return void u(e,["right","left"],n);case"BlockStatement":if(!e.body.length)return;var y=l(),b=y.LexicalEnvironment,w=new j(b);return v(e.body,w),y.LexicalEnvironment=w,u(e,["body"],n),void(y.LexicalEnvironment=b);case"BreakStatement":case"ContinueStatement":case"EmptyStatement":return;case"CatchClause":var S=l(),E=S.LexicalEnvironment,k=new j(E);return d(e.param,k),S.LexicalEnvironment=k,u(e,["param","body"],n),void(S.LexicalEnvironment=E);case"DoWhileStatement":return void u(e,["body","test"],n);case"ExpressionStatement":case"TSAsExpression":return void u(e,["expression"],n);case"ForInStatement":case"ForOfStatement":var A="VariableDeclaration"===e.left.type&&"var"!==e.left.kind,Z=l(),P=Z.LexicalEnvironment;if(A){var I=new j(P);d(e.left,I),Z.LexicalEnvironment=I}if(u(e,["right"],n),Z.LexicalEnvironment=P,A){var O=new j(P);d(e.left,O),Z.LexicalEnvironment=O}return u(e,["left","body"],n),void(Z.LexicalEnvironment=P);case"ForStatement":var C,x="VariableDeclaration"===(null===(C=e.init)||void 0===C?void 0:C.type)&&"var"!==e.init.kind,T=l(),R=T.LexicalEnvironment;if(x){var B=new j(R);d(e.init,B),T.LexicalEnvironment=B}return u(e,["init","test","body","update"],n),void(T.LexicalEnvironment=R);case"FunctionDeclaration":var[M]=g(e),_=l().LexicalEnvironment,L=m(e,_);return _.CreateBinding(M),void h(L,n);case"FunctionExpression":return void h(function(e){var t=l().LexicalEnvironment;if(!e.id)return m(e,t);var r=e.id.name,n=new j(t);return n.CreateBinding(r),m(e,n)}(e),n);case"IfStatement":return void u(e,["test","consequent","alternate"],n);case"ReturnStatement":case"ThrowStatement":case"UpdateExpression":return void u(e,["argument"],n);case"SwitchCase":return void u(e,["test","consequent"],n);case"SwitchStatement":u(e,["discriminant"],n);var F=l(),N=F.LexicalEnvironment,D=new j(N);return v(e.cases,D),F.LexicalEnvironment=D,u(e,["cases"],n),void(F.LexicalEnvironment=N);case"TryStatement":return void u(e,["block","handler","finalizer"],n);case"VariableDeclaration":return void u(e,["declarations"],n);case"VariableDeclarator":return void u(e,["id","init"],n);case"WhileStatement":return void u(e,["test","body"],n)}(null===(s=a.beforeVisitUnknown)||void 0===s?void 0:s.call(a,e,n))||console.warn("Unsupported node type `".concat(e.type,"`"))}var V}function d(e,t){for(var r of g(e))t.CreateBinding(r)}function f(e,t){return!!e&&(e.HasBinding(t)||f(e.OuterEnv,t))}function v(e,t){d(b(e,{var:!1,topLevel:!1}),t)}function h(e,t){var r,n,a;r=e,n=new N,a=new j(r.Environment),n.VariableEnvironment=a,n.LexicalEnvironment=a,o.push(n),function(e,t){var r,n=l(),a=e.ECMAScriptCode,i=e.FormalParameters,o=y(i),s=g(b(a,{var:!0,topLevel:!0})),c=n.LexicalEnvironment;if(d(i,c),p(i,null==t?void 0:t.concat({node:e.Function,key:"params"})),o)for(var u of(r=new j(c),n.VariableEnvironment=r,s))r.CreateBinding(u);else{for(var f of s)c.CreateBinding(f);r=c}var v=r;n.LexicalEnvironment=v,d(b(a,{var:!1,topLevel:!0}),v)}(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"}:[])),o.pop()}function m(e,t){return{Function:e,FormalParameters:e.params,ECMAScriptCode:"BlockStatement"===e.body.type?e.body.body:e.body,Environment:t}}return c.VariableEnvironment=s,c.LexicalEnvironment=s,o.push(c),p(e,n?[]:void 0),i}var V=r(2159),W=r(1874),$=["typescript"];function q(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{typescript:r}=t,n=(0,V.Z)(t,$),a=function(e){var{typescript:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=(0,W.Qc)(e,{plugins:["estree",t&&"typescript"].filter(Boolean),strictMode:!0,attachComment:!1}).program.body,n=t?[]:r;if(t)for(var a of r)if(a.type.startsWith("TS")){if(/Enum|Import|Export/.test(a.type))throw new SyntaxError("Unsupported TypeScript syntax: ".concat(a.type))}else n.push(a);if(0===n.length)throw new SyntaxError("Function declaration not found");if(n.length>1||"FunctionDeclaration"!==n[0].type)throw new SyntaxError("Expect a single function declaration at top level, but received: ".concat(n.map((e=>'"'.concat(e.type,'"'))).join(", ")));return n[0]}(e,{typescript:r});return{function:a,attemptToVisitGlobals:D(a,n)}}function H(e,t){var r=[],n=e.replace(/^\s*<%[~=]?\s|\s%>\s*$/g,(e=>(r.push(e),""))),a=function(e){return(0,W.BJ)(e,{plugins:["estree",["pipelineOperator",{proposal:"minimal"}]],attachComment:!1})}(n);return{expression:a,attemptToVisitGlobals:D(a,(0,U.Z)((0,U.Z)({},t),{},{expressionOnly:!0})),source:n,prefix:r[0],suffix:r[1]}}function z(e){return/^\s*<%[~=]?\s/.test(e)&&/\s%>\s*$/.test(e)}function K(e){return/^\s*<%~\s/.test(e)}function G(e){return/^\s*<%=\s/.test(e)&&/\s%>\s*$/.test(e)}},8539:(e,t,r)=>{r.r(t),r.d(t,{auth:()=>n,checkInstalledApps:()=>a,checkPermissions:()=>Xe,flowApi:()=>i,menu:()=>o,messageDispatcher:()=>Qe});var n={};r.r(n),r.d(n,{authenticate:()=>f,getAuth:()=>v,isLoggedIn:()=>m,logout:()=>h});var a={};r.r(a),r.d(a,{getCheckedApp:()=>ne,preCheckInstalledApps:()=>ee,waitForCheckingApps:()=>te});var i={};r.r(i),r.d(i,{FLOW_API_PROVIDER:()=>oe,clearCollectWidgetContract:()=>ye,collectContract:()=>me,collectWidgetContract:()=>ge,getArgsOfFlowApi:()=>Se,isFlowApiProvider:()=>we,registerFlowApiProvider:()=>ue});var o={};r.r(o),r.d(o,{fetchMenuById:()=>Je,getMenuById:()=>Ge});var s=r(4795),c=r(5178),l=r(3105),u=r(485),p=r(3028),d={};function f(e){Object.assign(d,{org:e.org,username:e.username,userInstanceId:e.userInstanceId,loginFrom:e.loginFrom,accessRule:e.accessRule,isAdmin:e.isAdmin,csrfToken:e.csrfToken,license:e.license,userShowValue:e.userShowValue})}function v(){return(0,p.Z)({},d)}function h(){for(var e of Object.keys(d))d[e]=void 0;g.length=0,y.clear()}function m(){return void 0!==d.username}var g=[],y=new Map;function b(){return(b=(0,s.Z)((function*(e,t){if(m()&&!v().isAdmin&&Array.isArray(e.permissionsPreCheck))return S(yield t(e.permissionsPreCheck))}))).apply(this,arguments)}function w(e){if(m()&&!v().isAdmin)return S((0,l.scanPermissionActionsInAny)(e))}function S(e){return E.apply(this,arguments)}function E(){return(E=(0,s.Z)((function*(e){var t=(0,c.difference)(e,[...g]);if(0!==t.length){g.push(...t);try{var r=yield(0,u.w)({actions:t});for(var n of r.actions)y.set(n.action,n.authorizationStatus),"undefined"===n.authorizationStatus&&console.error('Undefined permission action: "'.concat(n.action,'"'))}catch(e){console.error("Pre-check permissions failed",e)}}}))).apply(this,arguments)}var k=r(5866),A=r(3395),Z=r(6171),P=r(381),I=r(687),O=r(1181),C=1e3,x=6,T=new WeakMap,R=new WeakMap,B=new WeakMap,M=new WeakMap,_=new WeakMap,L=new WeakMap,F=new WeakMap,U=new WeakSet,N=new WeakSet;class j{constructor(e){(0,k.Z)(this,N),(0,k.Z)(this,U),(0,A.Z)(this,T,{writable:!0,value:void 0}),(0,A.Z)(this,R,{writable:!0,value:void 0}),(0,A.Z)(this,B,{writable:!0,value:[]}),(0,A.Z)(this,M,{writable:!0,value:new Set}),(0,A.Z)(this,_,{writable:!0,value:new Set}),(0,A.Z)(this,L,{writable:!0,value:0}),(0,A.Z)(this,F,{writable:!0,value:!1}),(0,P.Z)(this,T,e)}send(e){(0,I.Z)(this,R)||(0,P.Z)(this,R,(0,Z.Z)(this,U,D).call(this));var t=JSON.stringify(e);(0,I.Z)(this,R).readyState===WebSocket.OPEN?(0,I.Z)(this,R).send(t):(0,I.Z)(this,B).push(t)}onMessage(e){(0,I.Z)(this,M).add(e)}onClose(e){(0,I.Z)(this,_).add(e)}reset(){(0,I.Z)(this,B).length=0,(0,I.Z)(this,M).clear(),(0,I.Z)(this,_).clear()}close(){var e;(0,P.Z)(this,F,!0),(null===(e=(0,I.Z)(this,R))||void 0===e?void 0:e.readyState)===WebSocket.OPEN&&(0,I.Z)(this,R).close()}}function D(){console.log("WebSocket connecting ...");var e=new WebSocket((0,I.Z)(this,T));return e.addEventListener("open",(t=>{for(var r of(console.log("WebSocket open:",t),(0,P.Z)(this,L,0),(0,I.Z)(this,B)))e.send(r);(0,I.Z)(this,B).length=0})),e.addEventListener("close",(e=>{if(!(0,I.Z)(this,F)){for(var t of(console.log("WebSocket close:",e),(0,I.Z)(this,_)))t();1e3!==e.code&&(0,Z.Z)(this,N,V).call(this)}})),e.addEventListener("error",(e=>{console.error("WebSocket error:",e)})),e.addEventListener("message",(e=>{var t=JSON.parse(e.data);for(var r of(0,I.Z)(this,M))r(t)})),e}function V(){if((0,I.Z)(this,L)>=x)console.error("WebSocket connect retry limit exceeded");else{var e=Math.pow(2,(0,I.Z)(this,L))*C;console.log("WebSocket will reconnect after %d seconds",e/1e3),setTimeout((()=>{var e;(0,P.Z)(this,L,(e=(0,I.Z)(this,L),++e)),(0,P.Z)(this,R,(0,Z.Z)(this,U,D).call(this))}),e)}}var W=new WeakMap,$=new WeakMap,q=new WeakMap,H=new WeakMap,z=new WeakSet;function K(){if(!(0,I.Z)(this,W)){var e="https:"===location.protocol?"wss:":"ws:",t="".concat(e,"//").concat(window.location.host).concat((0,O.getBasePath)(),"api/websocket_service/v1/ws");(0,P.Z)(this,W,new j(t))}return(0,I.Z)(this,W)}function G(e,t,r,n){var a=(0,I.Z)(this,$)[e].get(n);if(a)return a;var i={event:"sub"===e?"TOPIC.SUB":"TOPIC.UNSUB",payload:r},o=new Promise(((t,n)=>{var a=J(r);(0,I.Z)(this,H).onMessage((r=>{var i=r.event===("sub"===e?"TOPIC.SUB_SUCCESS":"TOPIC.UNSUB_SUCCESS"),o=r.event===("sub"===e?"TOPIC.SUB_FAILED":"TOPIC.UNSUB_FAILED");(i||o)&&a===J(r.payload)&&(i?t:n)(r)})),(0,I.Z)(this,H).send(i)}));return"sub"===e&&(0,I.Z)(this,q).set(t,n),(0,I.Z)(this,$)[e].set(n,o),o}function J(e){var{system:t,topic:r}=e;return JSON.stringify({system:t,topic:r})}var Y=r(5049),X=new Map,Q=new Map;function ee(e,t){if(window.STANDALONE_MICRO_APPS&&!window.NO_AUTH_GUARD){var r=function(e){var t,r={usedArgs:new Set},{customTemplates:n,menus:a}=null!==(t=e.meta)&&void 0!==t?t:{};return(0,l.traverseStoryboardExpressions)([e.routes,n,a],((e,t)=>{(0,l.collectInstalledAppsHasUsage)(r,e,t)}),"INSTALLED_APPS"),[...r.usedArgs]}(e),n=[];for(var a of r)X.has(a)||t(a)||n.push(a);if(0===n.length)return;var i=(0,Y.$)({query:{appId:{$in:n}},fields:["appId","currentVersion","installStatus"]}).catch((e=>{console.error("Get off site standalone micro-apps failed",e)})),o=function(e){X.set(e,i.then((t=>{var r,n=null==t||null===(r=t.list)||void 0===r?void 0:r.find((t=>t.appId===e)),a=n?(0,p.Z)((0,p.Z)({},n),{},{id:e}):void 0;return Q.set(e,a),a})))};for(var s of n)o(s)}}function te(e){return re.apply(this,arguments)}function re(){return(re=(0,s.Z)((function*(e){yield Promise.all(e.map((e=>X.get(e))))}))).apply(this,arguments)}function ne(e){if(window.STANDALONE_MICRO_APPS)return Q.get(e)}var ae=r(9686),ie=r(9516),oe="core.provider-flow-api";function se(e,t){return e.some((e=>e.source===t))}function ce(e){return le.apply(this,arguments)}function le(){return le=(0,s.Z)((function*(e){for(var t,{url:r,originalUri:n,method:a="GET",responseWrapper:i=!0,ext_fields:o=[],request:s,isFileType:l}=e,u=["get","delete","head"].includes(a.toLowerCase()),d=l?{responseType:"blob"}:{},f=arguments.length,v=new Array(f>1?f-1:0),h=1;h<f;h++)v[h-1]=arguments[h];if(u){var m,g,y,b,w,S;n&&"object"===(null==s?void 0:s.type)&&(null!==(m=null===(g=n.match(/:([^/]+)/g))||void 0===g?void 0:g.length)&&void 0!==m?m:0)===(null!==(y=null===(b=s.fields)||void 0===b?void 0:b.length)&&void 0!==y?y:0)?[S]=v:[w,S]=v,t=yield ie.http.simpleRequest(a,r,(0,p.Z)((0,p.Z)({params:w},d),S))}else{var E=function(e){if(!e||"object"!==e.type)return!1;var t=e=>!(0,c.isEmpty)(e)&&e.some((e=>["file","file[]"].includes(e.type)||t(e.fields)));return t(e.fields)}(s),k=function(e){for(var t=se(e,"query"),r=se(e,"body"),n=arguments.length,a=new Array(n>1?n-1:0),i=1;i<n;i++)a[i-1]=arguments[i];if(t){if(r){var[o,s,c]=a;return{data:o,options:(0,p.Z)({params:s},c)}}var[l,u]=a;return{data:{},options:(0,p.Z)({params:l},u)}}var[d,f]=a;return{data:d,options:f}}(o,...v);t=yield ie.http.requestWithBody(a,r,E?function(e){if(e instanceof FormData)return e;var t=new FormData,r=function(e){Array.isArray(a)?a.forEach((r=>{t.append(e,r)})):!(0,c.isObject)(a)||a instanceof Blob||a instanceof Date?t.append(e,a):Object.entries(a).forEach((r=>{var[n,a]=r;t.append("".concat(e,"[").concat(n,"]"),a)}))};for(var[n,a]of Object.entries(e))r(n);return t}(k.data):k.data,(0,p.Z)((0,p.Z)({},d),k.options))}return!l&&i?t.data:t})),le.apply(this,arguments)}function ue(){customElements.define(oe,(0,ae.createProviderClass)(ce))}var pe=r(9169),de=r(7301),fe=new Map,ve=new Map,he=(e,t)=>{null==e||e.forEach((e=>{t.set("".concat(e.namespaceId,".").concat(e.name),e)}))};function me(e){he(e,fe)}function ge(e){he(e,ve)}function ye(){ve.clear()}var be=new Map;function we(e){return e.includes("@")}function Se(e,t,r){return Ee.apply(this,arguments)}function Ee(){return Ee=(0,s.Z)((function*(e,t,r){if(!e.includes(":"))throw new Error("You're using legacy Custom API \"".concat(e,'" which is dropped in v3, please use Flow API instead'));var n=yield function(e){var t=be.get(e);return t||(t=function(e){return ke.apply(this,arguments)}(e),be.set(e,t)),t}(e);if(!n)throw new Error('Flow API not found: "'.concat(e,'"'));var a=function(e,t){var r,n,a="string"==typeof t.contract?pe.safeLoad(t.contract,{schema:pe.JSON_SCHEMA,json:!0}):t.contract,{uri:i,method:o="GET",ext_fields:s}=null!==(r=null==a?void 0:a.endpoint)&&void 0!==r?r:{},c=!(null==a||!a.response)&&!1!==a.response.wrapper;if(!i)throw new Error('Missing endpoint.uri in contract of provider "'.concat(e,'"'));return{uri:i,method:"list"===o.toLowerCase()?"get":o,ext_fields:s,name:t.name,namespace:t.namespace,serviceName:t.serviceName,version:t.version,isFileType:"file"===(null==a||null===(n=a.response)||void 0===n?void 0:n.type),responseWrapper:c,request:null==a?void 0:a.request}}(e,n);return function(e,t,r){var n,{uri:a,method:i,ext_fields:o,name:s,namespace:c,serviceName:l,responseWrapper:u,version:p,isFileType:d,request:f}=e,v=d&&"saveAs"===r;v&&(n=t.shift());var{url:h,args:m}=function(e,t,r,n,a,i){var o=i?a?"api/gateway/".concat(a):"api/gateway/".concat(n,".").concat(r,"@").concat(i):"api/gateway/api_service.".concat(n,".").concat(r),s=t.slice();return{url:o+e.replace(/:([^/]+)/g,(()=>s.shift())),args:s}}(a,t,s,c,l,p);return[...v?[n]:[],{url:h,originalUri:a,method:i,ext_fields:o,responseWrapper:u,request:f,isFileType:d},...m]}(a,t,r)})),Ee.apply(this,arguments)}function ke(){return(ke=(0,s.Z)((function*(e){var[t,r]=e.split("@"),[n,a]=r.split(":"),i=function(e){return fe.get(e)||ve.get(e)}("".concat(t,".").concat(n));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}};var o,{contractData:s}=yield(0,de.e)({contractName:"".concat(t,".").concat(n),version:a});return s?{name:s.name,namespace:null===(o=s.namespace)||void 0===o||null===(o=o[0])||void 0===o?void 0:o.name,serviceName:s.serviceName,version:s.version,contract:{endpoint:s.endpoint,response:s.response,request:s.request}}:void 0}))).apply(this,arguments)}var Ae=r(2159),Ze=r(2021),Pe=r(1206),Ie=r(6236),Oe=Symbol("appId"),Ce=Symbol("menuI18nNamespace"),xe=Symbol("overrideApp");function Te(){return(Te=(0,s.Z)((function*(e,t,r,n){if(e.dynamicItems&&e.itemsResolve){var a=e.app[0].appId,i=t;if(a!==t.app.id){var o,s=window.STANDALONE_MICRO_APPS?e.overrideApp:null===(o=n.getStoryboardByAppId(a))||void 0===o?void 0:o.app;i=(0,p.Z)((0,p.Z)({},t),{},{overrideApp:s,appendI18nNamespace:r.get(e)})}var c=yield n.resolveData((0,p.Z)({transform:"items"},e.itemsResolve),i);e.items=c.items}}))).apply(this,arguments)}function Re(){return Re=(0,s.Z)((function*(e,t,r){var n=e.find((e=>"inject"!==e.type));if(n){var a=[],i=new Map,o=new WeakMap,s=function*(){if(c.i18n){var e="menu/".concat(c.menuId,"~").concat(c.app[0].appId,"+").concat(c.instanceId);Object.entries(c.i18n).forEach((t=>{var[r,n]=t;Ie.i18n.addResourceBundle(r,e,n)})),o.set(c,e)}};for(var c of e)yield*s();for(var l of(yield Promise.all(e.map((e=>function(e,t,r,n){return Te.apply(this,arguments)}(e,t,o,r)))),e)){var u;if(null!==(u=l.items)&&void 0!==u&&u.length)if("inject"===l.type&&l.injectMenuGroupId){var d=i.get(l.injectMenuGroupId);d||(d=[],i.set(l.injectMenuGroupId,d)),d.push(l)}else a.push(l)}return(0,p.Z)((0,p.Z)({},n),{},{items:a.flatMap((e=>Be(e.items,e,i,o))),[Ce]:o.get(n),[xe]:n.overrideApp})}})),Re.apply(this,arguments)}function Be(e,t,r,n){return null==e?void 0:e.map((e=>{var a,i=e.groupId&&r.get(e.groupId);return i&&r.delete(e.groupId),(0,p.Z)((0,p.Z)({},e),{},{children:(null!==(a=Be(e.children,t,r,n))&&void 0!==a?a:[]).concat(i?i.flatMap((e=>Be(e.items,e,r,n))):[]),[Oe]:t.app[0].appId,[Ce]:n.get(t),[xe]:t.overrideApp})}))}function Me(e){e.items=_e(e.items)}function _e(e){return function(e){return(0,c.sortBy)(e,(e=>{var t;return null!==(t=e.sort)&&void 0!==t?t:-1/0}))}(e).map((e=>(0,p.Z)((0,p.Z)({},e),{},{children:_e(e.children)})))}var Le=r(8183),Fe=r(9044),Ue=["children"];function Ne(e,t,r,n){if("titleDataSource"in e&&(0,ae.isObject)(e.titleDataSource)&&Object.entries(e.titleDataSource).every((e=>{var[t,r]=e;return null===r||""===r}))&&delete e.titleDataSource,"if"in e&&null===e.if&&delete e.if,"to"in e&&e.to&&!(0,Fe.isEvaluable)(e.to)){var a=Le.pipes.yaml(e.to);(0,ae.isObject)(a)&&["pathname","search","hash"].some((e=>(0,ae.hasOwnProperty)(a,e)))&&(e.to=a)}var i=r;if(t!==r.app.id){var o,s=window.STANDALONE_MICRO_APPS?e[xe]:null===(o=n.getStoryboardByAppId(t))||void 0===o?void 0:o.app;i=(0,p.Z)((0,p.Z)({},r),{},{overrideApp:s,appendI18nNamespace:e[Ce]})}return n.asyncComputeRealValue(e,i,{ignoreSymbols:!0})}function je(e,t,r){return Promise.all(e.map(function(){var e=(0,s.Z)((function*(e){var{children:n}=e,a=(0,Ae.Z)(e,Ue),[i,o]=yield Promise.all([Ne(a,a[Oe],t,r),n&&(yield je(n,t,r))]);return(0,p.Z)((0,p.Z)({},i),{},{children:o})}));return function(t){return e.apply(this,arguments)}}()))}var De=r(682),Ve=new Map;function We(e){return $e.apply(this,arguments)}function $e(){return($e=(0,s.Z)((function*(e){if(e.title||(0,c.isEmpty)(e.titleDataSource))return e.title;var t=JSON.stringify(e.titleDataSource);if(Ve.has(t))return Ve.get(t);var r,{objectId:n,instanceId:a,attributeId:i}=e.titleDataSource,o=null!=i?i:"name",s=yield(0,De.q)(n,a,{fields:o});if("#showKey"===i&&Array.isArray(s[o])){var[l,...u]=s[o];r=u.length>0?"".concat(l,"(").concat(u.join(","),")"):String(l)}else r=String(s[o]);return Ve.set(t,r),r}))).apply(this,arguments)}var qe=["items","app"],He=new Map,ze=new Map;function Ke(e){return null==e?void 0:e.filter(O.checkIfOfComputed).map((e=>{var t=Ke(e.children);return"group"===e.type?{type:"group",title:e.text,childLayout:e.childLayout,items:t}:null!=t&&t.length?{type:"subMenu",childLayout:e.childLayout,title:e.text,icon:e.icon,items:t,defaultExpanded:e.defaultExpanded}:e}))}function Ge(e){return ze.get(e)}function Je(e,t,r){var n=He.get(e);return n||(n=function(e,t,r){return Ye.apply(this,arguments)}(e,t,r)),n}function Ye(){return Ye=(0,s.Z)((function*(e,t,r){var n=window.STANDALONE_MICRO_APPS?function(e,t,r){var n,a,i,o,s=r.getStoryboardByAppId(t);return(null!==(n=null!==(a=null===(i=s.meta)||void 0===i?void 0:i.injectMenus)&&void 0!==a?a:null===(o=s.meta)||void 0===o?void 0:o.menus)&&void 0!==n?n:[]).filter((t=>t.menuId===e)).map((e=>{var r;return(0,p.Z)((0,p.Z)({},e),null!==(r=e.app)&&void 0!==r&&null!==(r=r[0])&&void 0!==r&&r.appId?{}:{app:[{appId:t}]})}))}(e,t.app.id,r):t.flags["three-level-menu-layout"]?(yield(0,Pe.h)(e,{menuObjectId:"EASYOPS_STORYBOARD_MENU"})).menus:(yield(0,Ze.x)("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,a=yield function(e,t,r){return Re.apply(this,arguments)}(n,t,r);if(!a)throw new Error("Menu not found: ".concat(e));Me(a);var{items:i,app:o}=a,s=(0,Ae.Z)(a,qe),l=(0,p.Z)((0,p.Z)({},t),{},{pendingPermissionsPreCheck:[...t.pendingPermissionsPreCheck,w([i,s])]});delete l.tplStateStoreId,delete l.forEachItem;var u=o[0].appId,[d,f]=yield Promise.all([Ne(s,u,l,r),je(i,l,r)]),v=(0,p.Z)((0,p.Z)({title:yield We(d)},(0,c.pick)(d,["icon","link","defaultCollapsed","defaultCollapsedBreakpoint"])),{},{menuItems:Ke(f)});ze.set(e,v)})),Ye.apply(this,arguments)}var Xe=Object.freeze({checkPermissions:function(){if(!m())return!1;if(v().isAdmin)return!0;for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];for(var n of t)switch(y.get(n)){case"unauthorized":case"undefined":return!1;case void 0:return console.error('Un-checked permission action: "'.concat(n,'", please make sure the permission to check is defined in permissionsPreCheck.')),!1}return!0},preCheckPermissions:function(e){if(m()&&!v().isAdmin)return S((0,l.scanPermissionActionsInStoryboard)(e))},preCheckPermissionsForBrickOrRoute:function(e,t){return b.apply(this,arguments)}}),Qe=new class{constructor(){(0,k.Z)(this,z),(0,A.Z)(this,H,{get:K,set:void 0}),(0,A.Z)(this,W,{writable:!0,value:void 0}),(0,A.Z)(this,$,{writable:!0,value:{sub:new Map,unsub:new Map}}),(0,A.Z)(this,q,{writable:!0,value:new Map})}subscribe(e,t){var r=JSON.stringify(t);return(0,Z.Z)(this,z,G).call(this,"sub",e,t,r)}unsubscribe(e){var t=(0,I.Z)(this,q).get(e);if(!t){var r='The message channel to unsubscribe "'.concat(e,'" is not found');return console.error(r),Promise.reject(new Error(r))}var n=JSON.parse(t),a=(0,Z.Z)(this,z,G).call(this,"unsub",e,n,t);return(0,I.Z)(this,$).sub.delete(t),a.then((()=>{(0,I.Z)(this,q).delete(e)})),a}onMessage(e,t){var r=(0,I.Z)(this,q).get(e);r?(0,I.Z)(this,H).onMessage((e=>{"MESSAGE.PUSH"===e.event&&function(e,t){var r=JSON.parse(e);return r.system===t.system&&(r.topic===t.topic||"string"==typeof r.topic&&r.topic.includes("*")&&new RegExp("^".concat(r.topic.replace(/([^*]*)\*([^*]*)/g,((e,t,r)=>"".concat((0,c.escapeRegExp)(t),"[^/]*").concat((0,c.escapeRegExp)(r)))),"$")).test(t.topic))}(r,e.payload)&&t(e.payload.message)})):console.error('Message channel: "'.concat(e,'" not found'))}onClose(e){(0,I.Z)(this,H).onClose(e)}reset(){var e;(0,I.Z)(this,$).sub.clear(),(0,I.Z)(this,$).unsub.clear(),(0,I.Z)(this,q).clear(),null===(e=(0,I.Z)(this,W))||void 0===e||e.reset()}}},2424:(e,t,r)=>{r.r(t),r.d(t,{HttpAbortError:()=>m,HttpFetchError:()=>f,HttpParseError:()=>h,HttpResponseError:()=>v,createHttpInstance:()=>_,defaultAdapter:()=>C,fetch:()=>n,getUrlWithParams:()=>I,http:()=>M,isHttpAbortError:()=>A});var n=(e,t)=>{var r=new Request(e,Object.assign({credentials:"same-origin"},t));return self.fetch(r)},a=r(5866),i=r(3395),o=r(6666),s=r(687),c=r(6171),l=r(381),u=r(3028),p=r(2159),d=r(4795);class f extends Error{constructor(e){super(e),this.name="HttpFetchError",Error.captureStackTrace&&Error.captureStackTrace(this,f)}}class v extends Error{constructor(e,t){super(e.statusText),(0,o.Z)(this,"response",void 0),(0,o.Z)(this,"responseJson",void 0),this.name="HttpResponseError",Error.captureStackTrace&&Error.captureStackTrace(this,v),this.response=e,this.responseJson=t}}class h extends Error{constructor(e){super(e.statusText),(0,o.Z)(this,"response",void 0),this.name="HttpParseError",Error.captureStackTrace&&Error.captureStackTrace(this,h),this.response=e}}class m extends Error{constructor(e){super(e),this.name="HttpAbortError"}}class g{constructor(){(0,o.Z)(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)}))}}var y=["params","responseType","interceptorParams","observe","noAbortOnRouteChange","useCache"],b=["params","responseType","interceptorParams","observe","noAbortOnRouteChange","useCache","headers"],w=["body","method"];function S(e){return null==e}var E=document.querySelector("base"),k=E?E.href:location.origin+"/",A=e=>e instanceof DOMException&&20===e.code,Z=(e,t)=>({error:e,config:t}),P=function(){var e=(0,d.Z)((function*(e,t,r){return new Promise(function(){var a=(0,d.Z)((function*(a,i){var o;r.url=e;var{responseType:s}=r.options||{};s||(s="json");try{o=yield n(e,t)}catch(e){return void i(Z(A(e)?new m(e.toString()):new f(e.toString()),r))}if(o.ok){var c;try{c=yield o[s]()}catch(e){return void i(Z(A(e)?new m(e.toString()):new h(o),r))}a({config:r,status:o.status,statusText:o.statusText,headers:o.headers,data:c})}else{var l;try{l=yield o.json()}catch(e){}i(Z(new v(o,l),r))}}));return function(e,t){return a.apply(this,arguments)}}())}));return function(t,r,n){return e.apply(this,arguments)}}(),I=(e,t)=>{if(t){var r=new URL(e,k);t instanceof URLSearchParams?t.forEach((function(e,t){r.searchParams.append(t,e)})):Object.entries(t).forEach((e=>{var[t,n]=e;Array.isArray(n)?n.forEach((e=>{r.searchParams.append(t,S(e)?"":e)})):r.searchParams.append(t,S(n)?"":n)}));var{href:n}=r;return n.startsWith(k)?n.substr(k.length):n}return e},O=(e,t)=>{if(void 0!==e){var r=new Headers(t||{}),n="Content-Type",a=e;return r.has(n)||("string"==typeof e?r.set(n,"application/x-www-form-urlencoded"):e instanceof FormData||(r.set(n,"application/json"),a=JSON.stringify(e))),{body:a,headers:r}}return{headers:t}},C=e=>{var{url:t,method:r,data:n}=e;return["DELETE","GET","HEAD"].includes(e.method)?((e,t,r)=>{var n=r.options||{},{params:a,responseType:i,interceptorParams:o,observe:s,noAbortOnRouteChange:c,useCache:l}=n,d=(0,p.Z)(n,y);return P(I(t,a),(0,u.Z)((0,u.Z)({},d),{},{method:e}),r)})(r,t,e):((e,t,r,n)=>{var a=n.options||{},{params:i,responseType:o,interceptorParams:s,observe:c,noAbortOnRouteChange:l,useCache:d,headers:f}=a,v=(0,p.Z)(a,b);return P(I(t,i),(0,u.Z)((0,u.Z)({},v),{},{method:e},O(r,f)),n)})(r,t,n,e)},x=new WeakMap,T=new WeakSet;class R{constructor(e){var t=this;(0,a.Z)(this,T),(0,o.Z)(this,"interceptors",void 0),(0,i.Z)(this,x,{writable:!0,value:C}),(0,o.Z)(this,"request",function(){var e=(0,d.Z)((function*(e,r,n){var a=r||{},{body:i,method:o}=a,s=(0,p.Z)(a,w);return(0,c.Z)(t,T,B).call(t,{url:e,data:i,method:o||"GET",options:(0,u.Z)((0,u.Z)({},n||{}),s)})}));return function(t,r,n){return e.apply(this,arguments)}}()),(0,o.Z)(this,"simpleRequest",(function(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return(0,c.Z)(t,T,B).call(t,{url:r,method:e,options:n})})),(0,o.Z)(this,"requestWithBody",(function(e,r,n){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return(0,c.Z)(t,T,B).call(t,{url:r,method:e,data:n,options:a})})),this.interceptors={request:new g,response:new g},null!=e&&e.adapter&&(0,l.Z)(this,x,e.adapter)}getUrlWithParams(e,t){return I(e,t)}getBodyAndHeaders(e,t){return O(e,t)}get(e,t){return(0,c.Z)(this,T,B).call(this,{url:e,method:"GET",options:t})}delete(e,t){return(0,c.Z)(this,T,B).call(this,{url:e,method:"DELETE",options:t})}head(e,t){return(0,c.Z)(this,T,B).call(this,{url:e,method:"HEAD",options:t})}post(e,t,r){return(0,c.Z)(this,T,B).call(this,{url:e,method:"POST",data:t,options:r})}put(e,t,r){return(0,c.Z)(this,T,B).call(this,{url:e,method:"PUT",data:t,options:r})}patch(e,t,r){return(0,c.Z)(this,T,B).call(this,{url:e,method:"PATCH",data:t,options:r})}}function B(e){var t=[],r=Promise.resolve(e);for(this.interceptors.request.forEach((e=>{t.push(e.fulfilled,e.rejected)})),t.push((e=>(0,s.Z)(this,x).call(this,e)),void 0),this.interceptors.response.forEach((e=>{t.push(e.fulfilled,e.rejected)})),t.push((e=>{var t;return"response"===(null===(t=e.config.options)||void 0===t?void 0:t.observe)?e:e.data}),(e=>Promise.reject(e.error)));t.length;)r=r.then(t.shift(),t.shift());return r}var M=new R;function _(e){M=new R(e)}},4034:(e,t,r)=>{r.r(t),r.d(t,{i18n:()=>p,i18nText:()=>u,initializeI18n:()=>c});var n=r(3239),a=r(6236),i=r(6473),o=!1,s=new Set;function c(e,t){if(o||(o=!0,a.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&&!s.has(e))for(var[r,n]of(s.add(e),Object.entries(t)))a.i18n.addResourceBundle(r,e,n)}var l=r(9686);function u(e){var t;if(e){var r=null!==(t=a.i18n.language)&&void 0!==t?t:"zh-CN";if((0,l.hasOwnProperty)(e,r))return e[r];var n=r.split("-")[0];if(n!==r)return(0,l.hasOwnProperty)(e,n)?e[n]:void 0;var i="".concat(n,"-");for(var o of Object.keys(e))if(o.startsWith(i))return e[o]}}var p=n.default},7920:(e,t,r)=>{r.r(t),r.d(t,{inject:()=>k,transform:()=>E,transformAndInject:()=>A});var n=r(5178),a=r(8183),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}({}),o=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}({}),s=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([].concat(e).map((e=>(0,n.escapeRegExp)(e))).join("|"),")\\{"))}function l(e){var t,r=S(e),n=null===(t=r.match(e.beginPlaceholder))||void 0===t?void 0:t[0],a=n?r.indexOf(n):-1;if(a>=0&&n&&"{"!==r.charAt(a+n.length)){var s=e.cursor+a;a>0&&e.tokens.push({type:o.Raw,value:r.substring(0,a)}),e.tokens.push({type:o.BeginPlaceHolder,loc:{start:s,end:s+n.length},value:n.substring(0,n.length-1)}),e.cursor+=a+n.length,e.status=i.ExpectField}else e.tokens.push({type:o.Raw,value:r}),e.cursor=e.raw.length}function u(e){e.cursor+=S(e).match(/^[ \r\n\t]*/)[0].length}function p(e){var[t]=S(e).match(/^(?:[\*\x2D\.0-9A-\[\]_a-z\x80-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*/);e.tokens.push({type:o.Field,value:t}),e.cursor+=t.length,e.status=i.ExpectOptionalBeginDefault}function d(e){"="===S(e).charAt(0)?(e.tokens.push({type:o.BeginDefault}),e.cursor+=1,e.status=i.ExpectDefaultValue):e.status=i.ExpectOptionalBeginPipe}function f(e){w(e,i.ExpectOptionalBeginPipe)}function v(e){"|"===S(e).charAt(0)?(e.tokens.push({type:o.BeginPipe}),e.cursor+=1,e.status=i.ExpectPipeIdentifier):e.status=i.ExpectPlaceholderEnd}function h(e){var t=S(e).match(/^[a-zA-Z]\w*/);if(!t)throw new Error("Expected a pipe identifier at index ".concat(e.cursor," near: ").concat(JSON.stringify(e.raw.substring(e.cursor))));var r=t[0];e.tokens.push({type:o.PipeIdentifier,value:r}),e.cursor+=r.length,e.status=i.ExpectOptionalBeginPipeParameter}function m(e){":"===S(e).charAt(0)?(e.tokens.push({type:o.BeginPipeParameter}),e.cursor+=1,e.status=i.ExpectPipeParameter):e.status=i.ExpectOptionalBeginPipe}function g(e){w(e,i.ExpectOptionalBeginPipeParameter)}function y(e){if("}"!==S(e).charAt(0))throw new Error("Expected a placeholder end '}' at index ".concat(e.cursor," near: ").concat(JSON.stringify(e.raw.substring(e.cursor))));e.tokens.push({type:o.EndPlaceHolder,loc:{start:e.cursor,end:e.cursor+1}}),e.cursor+=1,e.status=i.Initial}var b=new Map([["false",!1],["null",null],["true",!0]]);function w(e,t){var r=S(e);if(/[0-9[{"]/.test(r.charAt(0))||/-[0-9]/.test(r.substring(0,2)))!function(e,t){for(var r=S(e),n=r.charAt(0),a="["===n?s.Array:"{"===n?s.Object:'"'===n?s.String:s.Others,i=0,c=0,l=0,u=!1,p=!1,d=!1;i<r.length;){var f=r.charAt(i);if(p)p=!1;else if(u)'"'===f?u=!1:"\\"===f&&(p=!0);else switch(f){case"[":l+=1;break;case"{":c+=1;break;case"]":l-=1;break;case"}":c-=1;break;case'"':u=!0}switch(i+=1,a){case s.Array:d=!l;break;case s.Object:d=!c;break;case s.String:d=!u;break;default:d=i<r.length&&/[^a-z0-9E.+-]/.test(r.charAt(i))}if(d)break}if(!d)throw new Error("Failed to match a JSON value at index ".concat(e.cursor," near: ").concat(JSON.stringify(e.raw.substring(e.cursor))));e.tokens.push({type:o.JsonValue,value:JSON.parse(r.substring(0,i))}),e.cursor+=i,e.status=t}(e,t);else{var[n]=S(e).match(/^(?:[\x2D0-9A-Z_a-z\x80-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*/);b.has(n)?e.tokens.push({type:o.JsonValue,value:b.get(n)}):e.tokens.push({type:o.LiteralString,value:n}),e.cursor+=n.length,e.status=t}}function S(e){return e.raw.substring(e.cursor)}function E(e,t){return Z(e,"@",t)}function k(e,t){return Z(e,"$",t)}function A(e,t){return Z(e,["@","$"],t)}function Z(e,t,r){if(!function(e,t){return c(t).test(e)}(e,t))return e;var s,b,w=(s=r.data,function(e){var t=e.field?(0,n.get)(s,e.field):s;return void 0===t&&(t=e.defaultValue),(0,a.processPipes)(t,e.pipes)}),S=function(e,t){return function(r){var i,o,s=r.field.match(/^(?:(QUERY(?:_ARRAY)?|EVENT|query|event|APP|HASH|ANCHOR|SYS|FLAGS|CTX)\.)?(.+)$/);if(!s)return t.substring(r.loc.start,r.loc.end);var c,[,l,u]=s;!l&&/^[A-Z_]+$/.test(u)&&(l=u,u="*");var p={SYS:"sys",FLAGS:"flags"};switch(l){case"QUERY":case"query":c="*"===u?e.query:e.query.has(u)?e.query.get(u):void 0;break;case"QUERY_ARRAY":c=e.query.has(u)?e.query.getAll(u):void 0;break;case"EVENT":case"event":if(void 0===e.event)return t.substring(r.loc.start,r.loc.end);c="*"===u?e.event:(0,n.get)(e.event,u);break;case"APP":c="*"===u?null!==(i=e.overrideApp)&&void 0!==i?i:e.app:(0,n.get)(null!==(o=e.overrideApp)&&void 0!==o?o:e.app,u);break;case"HASH":c=e.location.hash;break;case"SYS":case"FLAGS":c="*"===u?e[p[l]]:(0,n.get)(e[p[l]],u);break;case"ANCHOR":var d=e.location.hash?e.location.hash.substr(1):null;c="*"===u?d:(0,n.get)(d,u);break;case"CTX":var f=t.substring(r.loc.start,r.loc.end);return console.error('CTX is not supported in placeholder any more: "'.concat(f,'"')),f;default:if(!e.match)return t.substring(r.loc.start,r.loc.end);c=e.match.params[u]}return void 0===c&&(c=r.defaultValue),(0,a.processPipes)(c,r.pipes)}}(r,e);return b=function(e,t){return function(e){var t,r={type:"InjectableString",elements:[]};function n(r){return r===e[0].type&&(t=e.shift(),!0)}function a(r){if(t=e.shift(),Array.isArray(r)?!r.includes(t.type):r!==t.type)throw new Error("Expected token: ".concat(r,", received token: ").concat(t.type))}for(;e.length>0;)if(n(o.Raw))r.elements.push({type:"RawString",value:t.value});else{a(o.BeginPlaceHolder);var i=t.loc.start,s=t.value;a(o.Field);var c={type:"Placeholder",symbol:s,field:t.value,defaultValue:void 0,pipes:[],loc:{start:i,end:i}};for(r.elements.push(c),n(o.BeginDefault)&&(a([o.JsonValue,o.LiteralString]),c.defaultValue=t.value);n(o.BeginPipe);){a(o.PipeIdentifier);var l={type:"PipeCall",identifier:t.value,parameters:[]};for(c.pipes.push(l);n(o.BeginPipeParameter);)a([o.JsonValue,o.LiteralString]),l.parameters.push(t.value)}a(o.EndPlaceHolder),c.loc.end=t.loc.end}return r}(function(e,t){for(var r={beginPlaceholder:c(t),raw:e,cursor:0,status:i.Initial,tokens:[]};r.cursor<e.length;)switch(r.status){case i.Initial:l(r);break;case i.ExpectField:u(r),p(r);break;case i.ExpectOptionalBeginDefault:u(r),d(r);break;case i.ExpectDefaultValue:u(r),f(r);break;case i.ExpectOptionalBeginPipe:u(r),v(r);break;case i.ExpectPipeIdentifier:u(r),h(r);break;case i.ExpectOptionalBeginPipeParameter:u(r),m(r);break;case i.ExpectPipeParameter:u(r),g(r);break;case i.ExpectPlaceholderEnd:u(r),y(r)}if(r.status!==i.Initial)throw new Error("Expected a placeholder end '}' at the end");return r.tokens}(e,t))}(e,t).elements.map((e=>"RawString"===e.type?e.value:"$"===e.symbol?S(e):w(e))),1===b.length?b[0]:b.join("")}},8524:(e,t,r)=>{r.r(t),r.d(t,{enqueueStableLoadBricks:()=>m,enqueueStableLoadProcessors:()=>g,flushStableLoadBricks:()=>h,loadBricksImperatively:()=>y,loadProcessorsImperatively:()=>w,loadScript:()=>o,loadSharedModule:()=>u,loadStyle:()=>s});var n=r(3028),a=new Map;function i(e,t,r,o){if(Array.isArray(t))return Promise.all(t.map((t=>i(e,t,r))));var s=r&&!/^https?:/.test(t)?"".concat(r).concat(t):t,c=a.get(s);if(c)return c;var l=new Promise(((t,r)=>{var a=()=>{window.dispatchEvent(new Event("request.end"))},i=document.createElement("style"===e?"link":"script");"script"===e?Object.assign(i,(0,n.Z)((0,n.Z)({type:"text/javascript",async:!0},o),{},{src:s})):Object.assign(i,(0,n.Z)((0,n.Z)({rel:"stylesheet"},o),{},{href:s})),i.onload=()=>{t(s),a()},i.onerror=e=>{r(e),a()};var c=document.currentScript||document.getElementsByTagName("script")[0];c.parentNode.insertBefore(i,c),window.dispatchEvent(new Event("request.start"))}));return a.set(s,l),l}function o(e,t,r){return i("script",e,t,r)}function s(e,t,r){return i("style",e,t,r)}var c,l=r(4795);function u(e,t){return p.apply(this,arguments)}function p(){return(p=(0,l.Z)((function*(e,t){yield r.I("default");var n=window[e];return yield n.init(r.S.default),(yield n.get(t))()}))).apply(this,arguments)}var d,f=!1,v=new Promise((e=>{c=e}));function h(){f||c()}function m(e,t){return O(P("bricks",e,t))}function g(e,t){return O(P("processors",e,t))}function y(e,t){return b.apply(this,arguments)}function b(){return(b=(0,l.Z)((function*(e,t){var r=P("bricks",e,t);return h(),O(r)}))).apply(this,arguments)}function w(e,t){var r=P("processors",e,t);return h(),O(r)}var S="v2-adapter.load-bricks";function E(e,t,r){var n=new Map,a=new Set,i=t=>{var o;if(!a.has(t)){var s,c,l;if(a.add(t),"processors"===e||t.includes(".")){[c,l]=t.split(".");var u="bricks/".concat("processors"===e?c.replace(/[A-Z]/g,(e=>"-".concat(e[0].toLocaleLowerCase()))).replace(/_[0-9]/g,(e=>"-".concat(e[1]))):c);s=r.get(u)}else for(var p of(l=t,r.values())){var d;if(null!==(d=p.elements)&&void 0!==d&&d.some((e=>e===l))){s=p;break}}if(s){var f=n.get(s);f||(f=[],n.set(s,f)),f.push(l);var v=null===(o=s.dependencies)||void 0===o?void 0:o[t];if(v)for(var h of v)i(h)}else console.error("Package for ".concat(t," not found."))}};for(var o of t)i(o);return n}function k(e,t,r){return A.apply(this,arguments)}function A(){return(A=(0,l.Z)((function*(e,t,r){var n="".concat("processors"===e?"./processors/":"./").concat(r);try{yield u(t,n)}catch(r){throw console.error(r),new Error("Load ".concat(e,' of "').concat(t.split("/").pop(),".").concat(n.split("/").pop(),'" failed'))}}))).apply(this,arguments)}function Z(e,t,r){return t.map(function(){var t=(0,l.Z)((function*(t){var n;return yield o(t.filePath,null!==(n=window.PUBLIC_ROOT)&&void 0!==n?n:""),yield v,Promise.all(r.get(t).map((r=>k(e,t.id,r))))}));return function(e){return t.apply(this,arguments)}}())}function P(e,t,r){return I.apply(this,arguments)}function I(){return I=(0,l.Z)((function*(e,t,r){var n=new Map;for(var a of r){var i,s=null!==(i=a.id)&&void 0!==i?i:x(a.filePath);n.set(s,a)}var u,p,v=E(e,t,n),h=[],m=[];for(var g of v.keys())g.id?"bricks/basic"===g.id?u=g:m.push(g):(h.push(g),(p=n.get("bricks/v2-adapter"))||console.error("Using v2 bricks, but v2-adapter not found"));var y,b=p,w=u;if(w){var A,P=o(w.filePath,null!==(A=window.PUBLIC_ROOT)&&void 0!==A?A:"");f||(f=!0,P.then((()=>Promise.resolve())).then(c)),y=P.then((()=>Promise.all(v.get(w).map((t=>k(e,w.id,t))))))}var I=[y].concat(Z(e,m,v));if(b&&h.length>0){if(!d){var O=E("bricks",[S],n),C=[...O.keys()],T=function(){var e=(0,l.Z)((function*(){return yield Promise.all(Z("bricks",C,O)),document.createElement(S)}));return function(){return e.apply(this,arguments)}}();d=T()}I.push(d.then((t=>Promise.all(h.map((n=>{var a=x(n.filePath).split("/")[1];return t.resolve(b.filePath,n.filePath,"bricks"===e?v.get(n).map((e=>"".concat(a,".").concat(e))):[],n.dll,r)}))))))}yield Promise.all(I)})),I.apply(this,arguments)}function O(e){return C.apply(this,arguments)}function C(){return(C=(0,l.Z)((function*(e){window.dispatchEvent(new Event("request.start"));try{yield e}finally{window.dispatchEvent(new Event("request.end"))}}))).apply(this,arguments)}function x(e){return e.split("/").slice(0,2).join("/")}},5152:(e,t,r)=>{r.r(t),r.d(t,{pipes:()=>n.pipes,processPipes:()=>i,utils:()=>n.utils});var n=r(665),a=new Map(Array.from(Object.entries(n.pipes)));function i(e,t){if(0===t.length)return e;var r=e;for(var n of t){var i=a.get(n.identifier);if(!i)return void console.warn("Unknown pipe: ".concat(n.identifier));r=i(r,...n.parameters)}return r}},2263:(e,t,r)=>{r.r(t),r.d(t,{Dialog:()=>$t,Notification:()=>Yt,StoryboardFunctionRegistryFactory:()=>fe,__secret_internals:()=>n,__test_only:()=>{},applyTheme:()=>te,authenticate:()=>ka,batchSetAppsLocalTheme:()=>re,checkIfByTransform:()=>yt,checkIfOfComputed:()=>mt,createHistory:()=>A,createRuntime:()=>fa,customProcessors:()=>M,customTemplates:()=>xe,fetchByProvider:()=>Ia,getAuth:()=>Aa,getBasePath:()=>v,getCssPropertyValue:()=>ce,getCurrentMode:()=>oe,getCurrentTheme:()=>ee,getHistory:()=>Z,getPageInfo:()=>_n,getRuntime:()=>va,handleHttpError:()=>Jt,httpErrorToString:()=>qt,isLoggedIn:()=>Pa,isUnauthenticatedError:()=>Ht,logout:()=>Za,matchPath:()=>xt,registerWidgetFunctions:()=>_e,registerWidgetI18n:()=>F,unstable_createRoot:()=>Ca});var n={};r.r(n),r.d(n,{getAddedContracts:()=>za,getAllContextValues:()=>$a,getBrickPackagesById:()=>qa,getContextValue:()=>Wa,getRenderId:()=>Ha,legacyDoTransform:()=>Ma,mountUseBrick:()=>Ra,renderUseBrick:()=>xa,unmountUseBrick:()=>Ba,updateSnippetPreviewSettings:()=>Da,updateStoryboard:()=>_a,updateStoryboardByRoute:()=>La,updateStoryboardBySnippet:()=>ja,updateStoryboardByTemplate:()=>Fa,updateTemplatePreviewSettings:()=>Ua});var a=r(3028),i=r(4795),o=r(3395),s=r(381),c=r(687),l=r(6236),u=r(2923),p=r(9686),d=r(8874),f=(r(8525),r(7857));function v(){var e=document.querySelector("base");return e?e.getAttribute("href"):"/"}var h=r(2159),m=r(5178);function g(e,t){var r=(0,m.orderBy)(e,(e=>{var t,r;return null!==(t=null===(r=e.app.homepage)||void 0===r?void 0:r.length)&&void 0!==t?t:0}),"desc");for(var n of r){var a=n.app.homepage;if("string"==typeof a&&"/"===a[0]&&y(a,t))return n}}function y(e,t){return"/"===e?t===e:"".concat(t.replace(/\/+$/,""),"/").startsWith("".concat(e.replace(/\/+$/,""),"/"))}function b(e){var t;return!e||(null===(t=va().getCurrentApp())||void 0===t?void 0:t.id)!==e.app.id&&!window.STANDALONE_MICRO_APPS&&e.app.standaloneMode}var w,S=["extraQuery","clear","keepHash"],E=!1;function k(e,t){t(!(E=!confirm(e)))}function A(){if(!w){var e=(0,f.createBrowserHistory)({basename:v().replace(/\/$/,""),getUserConfirmation:k});Object.assign(e,function(e){var t,{push:r,replace:n}=e;function i(e,t,n){E=!1,r(e,t),null==n||n(E)}function o(e,t,r){E=!1,n(e,t),null==r||r(E)}function s(t){return function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2?arguments[2]:void 0,{extraQuery:s,clear:c,keepHash:l}=n,u=(0,h.Z)(n,S),p=new URLSearchParams(c?"":e.location.search),d={};for(var[f,v]of(Object.assign(d,r,s),Object.entries(d)))if(Array.isArray(v))for(var m of(p.delete(f),v))p.append(f,m);else null==v||""===v?p.delete(f):p.set(f,v);("push"===t?i:o)("?".concat(p.toString()).concat(l?e.location.hash:""),u,a)}}return(0,a.Z)({pushQuery:s("push"),replaceQuery:s("replace"),pushAnchor:function(t,r,n){i((0,a.Z)((0,a.Z)({},e.location),{},{key:void 0,hash:t,state:(0,a.Z)({notify:!1},r)}),void 0,n)},reload:function(t){o((0,a.Z)((0,a.Z)({},e.location),{},{state:(0,a.Z)((0,a.Z)({},e.location.state),{},{notify:!0})}),void 0,t)},setBlockMessage:function(e){t=e},getBlockMessage:function(){return t},unblock:function(){t=void 0}},function(e){var{push:t,replace:r}=e;function n(n){return function(a,i,o){var s,c="string"==typeof a;return"string"==typeof(s=c?(0,f.parsePath)(a).pathname:a.pathname)&&s.startsWith("/")&&b(function(e){var t,r;return g(null!==(t=null===(r=la)||void 0===r?void 0:r.storyboards)&&void 0!==t?t:[],e)}(s))?location["push"===n?"assign":"replace"](c?v()+a.substring(1):e.createHref(a)):("push"===n?t:r)(a,i,o)}}return{push:n("push"),replace:n("replace")}}((0,a.Z)((0,a.Z)({},e),{},{push:i,replace:o})))}(e)),w=e}return w}function Z(){var e;return null!==(e=w)&&void 0!==e?e:function(){var{dll:e}=window;if("function"==typeof e)return e("tYg3").getHistory()}()}var P=r(5866),I=r(6171),O=r(9516),C=r(9044),x=r(3105),T=r(3393),R=r(5603),B=new WeakMap,M=new class{constructor(){(0,o.Z)(this,B,{writable:!0,value:new Map})}define(e,t){var[r,n]=e.split("."),a=(0,c.Z)(this,B).get(r);if(a||(a=new Map,(0,c.Z)(this,B).set(r,a)),a.has(n))throw new Error('Custom processor of "'.concat(e,'" already registered'));a.set(n,t)}get(e){return(0,c.Z)(this,B).get(e)}};function _(e){var{app:t,meta:r}=e;if(null!=r&&r.i18n){var n=L("app",t.id),a=[];return Object.entries(r.i18n).forEach((e=>{var[t,r]=e;l.i18n.addResourceBundle(t,n,r),a.push(t)})),()=>{for(var e of a)l.i18n.removeResourceBundle(e,n)}}}function L(e,t){return"".concat(e,"/").concat(t)}function F(e,t){var r=L("widget",e);Object.entries(t).forEach((e=>{var[t,n]=e;l.i18n.addResourceBundle(t,r,n)}))}function U(e){return l.i18n.getFixedT(null,L("widget",e))}var N,j="brick-next-devtools-panel",D="devtools-frame-active-change",V="devtools-panel-change",W=!0;function $(){return window.__BRICK_NEXT_DEVTOOLS_HOOK__}var q=()=>{throw new Error("Can't modify read-only proxy object")},H={set:q,defineProperty:q,deleteProperty:q,setPrototypeOf:q};function z(e){return new Proxy(e,H)}function K(e){var{get:t,ownKeys:r}=e;return $()?z(Object.fromEntries(r(null).map((e=>[e,t(null,e,null)])))):new Proxy(Object.freeze({}),{get:t})}var G="light",J=new p.JsonStorage(localStorage),Y="apps-theme";function X(e){if("dark"!==e&&"light"!==e&&"dark-v2"!==e)throw new Error("Unsupported theme: ".concat(e));G=e}function Q(){return G}function ee(){return document.documentElement.dataset.theme}function te(e){e?X(e):e=Q(),e!==ee()&&(document.documentElement.dataset.theme=e,window.dispatchEvent(new CustomEvent("theme.change",{detail:e})))}function re(e){J.setItem(Y,(0,a.Z)((0,a.Z)({},ne()),e))}function ne(){var e,t;try{t=J.getItem(Y)}catch(e){console.error("JSON parse error inside `getLocalAppsTheme()`")}return null!==(e=t)&&void 0!==e?e:{}}var ae="default";function ie(e){if("dashboard"!==e&&"default"!==e)throw new Error("Unsupported mode: ".concat(e));ae=e}function oe(){return document.documentElement.dataset.mode}function se(e){e?ie(e):e=ae,e!==oe()&&(document.documentElement.dataset.mode=e,window.dispatchEvent(new CustomEvent("mode.change",{detail:e})))}function ce(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document.documentElement;return r&&(null===(t=window.getComputedStyle(r))||void 0===t?void 0:t.getPropertyValue(e))||""}function le(e,t){var r={};for(var n of e){var a=ue(n,t);void 0!==a&&(r[n]=a)}return r}function ue(e,t){var r,n,a,{collectCoverage:i,widgetId:o,widgetVersion:s,app:c,appendI18nNamespace:u,storyboardFunctions:p,isStoryboardFunction:d}=t;switch(e){case"BASE_URL":return i?"/next":v().replace(/\/$/,"");case"FN":return p;case"IMG":return i?{get:e=>"mock/images/".concat(e)}:o?null==pa||null===(r=pa.images)||void 0===r?void 0:r.widgetImagesFactory(o,s):null==pa||null===(n=pa.images)||void 0===n?void 0:n.imagesFactory(c.id,c.isBuildPush,c.currentVersion);case"I18N":return i?m.identity:o?U(o):l.i18n.getFixedT(null,[u,L("app",c.id)].filter(Boolean));case"I18N_TEXT":return i?pe:l.i18nText;case"PERMISSIONS":return z({check:i?de:null==pa||null===(a=pa.checkPermissions)||void 0===a?void 0:a.checkPermissions});case"THEME":return z({getTheme:i?()=>"light":Q});case"console":return d?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 pe(e){return null==e?void 0:e.en}function de(){return!0}function fe(){var e,{widgetId:t,widgetVersion:r,collectCoverage:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=new Map,o=new Proxy(Object.freeze({}),{get:(a,s)=>function(a){var s,c=i.get(a);if(c){if(c.processed)return c.cooked;n&&(s=n.createCollector(a));var l=(0,C.precookFunction)(c.source,{typescript:c.typescript,hooks:s&&{beforeVisit:s.beforeVisit}});return c.cooked=(0,C.cook)(l.function,c.source,{rules:{noVar:!0},globalVariables:(0,R.supply)(l.attemptToVisitGlobals,le(l.attemptToVisitGlobals,{collectCoverage:n,widgetId:t,widgetVersion:r,app:e,storyboardFunctions:o,isStoryboardFunction:!0}),!!n),hooks:s&&{beforeEvaluate:s.beforeEvaluate,beforeCall:s.beforeCall,beforeBranch:s.beforeBranch}}),c.processed=!0,c.cooked}}(s)});return{storyboardFunctions:o,registerStoryboardFunctions:function(t,r){if(r&&(e=r),i.clear(),Array.isArray(t))for(var n of t){var a=(0,x.strictCollectMemberUsageInFunction)(n,"FN"),o=(0,x.strictCollectMemberUsageInFunction)(n,"PERMISSIONS").has("check");i.set(n.name,{source:n.source,typescript:n.typescript,deps:a,hasPermissionsCheck:o})}},updateStoryboardFunction(e,t){var r=(0,a.Z)((0,a.Z)({},t),{},{name:e}),n=(0,x.strictCollectMemberUsageInFunction)(r,"FN"),o=(0,x.strictCollectMemberUsageInFunction)(r,"PERMISSIONS").has("check");i.set(e,{source:t.source,typescript:t.typescript,deps:n,hasPermissionsCheck:o})},checkPermissionsUsage(e){var t=new Set,r=e=>{if(!t.has(e)){t.add(e);var n=i.get(e);return!!n&&(n.hasPermissionsCheck||[...n.deps].some(r))}return!1};return e.some(r)}}}var{storyboardFunctions:ve,registerStoryboardFunctions:he,checkPermissionsUsage:me}=fe(),ge=r(761),ye=function(e){return e.xLarge="xLarge",e.large="large",e.medium="medium",e.small="small",e.xSmall="xSmall",e}({}),be=new Map([[ye.xLarge,"1920px"],[ye.large,"1600px"],[ye.medium,"1280px"],[ye.small,"1024px"],[ye.xSmall,0]]),we=new ge.Z,Se={},Ee={};function ke(e,t){var r=!1;for(var[n]of(Se[t]=e.matches,be))if(Se[n]&&Ee.breakpoint!==n){Ee.breakpoint=n,r=!0;break}r&&we.dispatchEvent(new CustomEvent("change",{detail:Ee}))}be.forEach(((e,t)=>{var r=window.matchMedia("(min-width: ".concat(e,")"));ke(r,t),r.addEventListener?r.addEventListener("change",(e=>{ke(e,t)})):r.addListener((e=>{ke(e,t)}))}));var Ae=()=>Ee;function Ze(e){return function(t){var r,n="local"===e?localStorage:sessionStorage;return JSON.parse(null!==(r=n.getItem(t))&&void 0!==r?r:"null")}}function Pe(e){var t,r;return!(null===(t=e?e.flags:null===(r=va())||void 0===r?void 0:r.getFeatureFlags())||void 0===t||!t["brick-next-v3-strict-mode"])}function Ie(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),a=2;a<r;a++)n[a-2]=arguments[a];var i=0===n.length?"":",";e?console.error("".concat(t," is dropped in v3 strict mode").concat(i),...n):console.warn("".concat(t," is deprecated in v3 and will be dropped in strict mode").concat(i),...n)}var Oe=new Set(["prefix"]),Ce=new WeakMap,xe=new class{constructor(){(0,o.Z)(this,Ce,{writable:!0,value:new Map})}define(e,t){var r,n,i,o,s=(0,c.Z)(this,Ce).has(e);s?console.warn('Custom template of "'.concat(e,'" already registered.')):(s=!!customElements.get(e))&&console.warn('Custom template of "'.concat(e,'" already defined by customElements.'));var l=Pe(),u=null!==(r=null===(n=t.proxy)||void 0===n?void 0:n.properties)&&void 0!==r?r:{},p=[],d=[];for(var[f,v]of Object.entries(u))v.asVariable?(Ie(l,"Template `asVariable`",e,f),l||d.push(f)):v.mergeProperty||v.refTransform?console.error("Template `mergeProperty` and `refTransform` are dropped in v3:",e,f):v.ref&&p.push([f,v]);var h=(0,a.Z)((0,a.Z)({},t),{},{proxy:(0,a.Z)((0,a.Z)({},t.proxy),{},{properties:Object.fromEntries(p)}),state:(t.state?l?t.state:t.state.map((e=>(0,a.Z)({expose:!0},e))):[]).concat(d.map((e=>({name:e,expose:!0}))))});(0,c.Z)(this,Ce).set(e,(0,a.Z)((0,a.Z)({},h),{},{name:e}));var g,y,b=(g=h.state,(0,m.uniq)(null!==(y=null==g?void 0:g.filter((e=>e.expose)).map((e=>e.name)))&&void 0!==y?y:[])),w=Object.entries(null!==(i=null===(o=h.proxy)||void 0===o?void 0:o.methods)&&void 0!==i?i:{}),S=b.concat(p.map((e=>e[0]))),E=w.map((e=>e[0])),k=S.concat(E).filter((e=>e in HTMLElement.prototype&&!Oe.has(e)));if(k.length>0&&(Ie(l,"Using native HTMLElement properties as template properties or methods",e,...k),l))throw new Error('In custom template "'.concat(e,'", ').concat(k.map((e=>'"'.concat(e,'"'))).join(", ")," are native HTMLElement properties, and should be avoid to be used as brick properties or methods."));if(!s){class t extends HTMLElement{get $$typeof(){return"custom-template"}static get _dev_only_definedProperties(){return S}static get _dev_only_definedMethods(){return E}$$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(){var e=this.shadowRoot;e||(e=this.attachShadow({mode:"open"}));var t=document.createDocumentFragment(),r=document.createElement("style");r.textContent=":host{display:block}:host([hidden]){display:none}";var n=document.createElement("slot");t.appendChild(r),t.appendChild(n),e.appendChild(t)}disconnectedCallback(){this.shadowRoot&&(this.shadowRoot.textContent="")}}var A=function(r){if(p.some((e=>e[0]===r)))return console.error('Cannot define an exposed state that is also a proxy property: "'.concat(r,'" in ').concat(e)),"continue";Object.defineProperty(t.prototype,r,{get(){return this.$$tplStateStore.getValue(r)},set(e){var t;null===(t=this.$$tplStateStore)||void 0===t||t.updateValue(r,e,"replace")},enumerable:!0})};for(var Z of b)A(Z);var P=function(e,r){Object.defineProperty(t.prototype,e,{get(){var t;return this.$$getElementByRef(r.ref)[null!==(t=r.refProperty)&&void 0!==t?t:e]},set(t){var n,a,i=null===(n=this.$$getElementByRef)||void 0===n?void 0:n.call(this,r.ref);i&&(i[null!==(a=r.refProperty)&&void 0!==a?a:e]=t)},enumerable:!0})};for(var[I,O]of p)P(I,O);var C=function(e,r){Object.defineProperty(t.prototype,e,{value(){var t;this.$$getElementByRef(r.ref)[null!==(t=r.refMethod)&&void 0!==t?t:e](...arguments)},enumerable:!0})};for(var[x,T]of w)C(x,T);customElements.define(e,t)}}get(e){return(0,c.Z)(this,Ce).get(e)}};function Te(e,t,r){var{tplStateStoreId:n,tplStateStoreMap:a}=e;if(!n)throw new Error('Using "'.concat(t,'" outside of a custom template').concat(null!=r?r:""));var i=a.get(n);if(!i)throw new Error('Template state store is not found when using "'.concat(t,'"').concat(null!=r?r:"",".\nThis is a bug of Brick Next, please report it."));return i}function Re(e,t,r){var n=Te(e,t,r).hostBrick.element;if(!n)throw new Error('Template host element is gone when using "'.concat(t,'"').concat(null!=r?r:"",".\nThis is a bug of Brick Next, please report it."));return n}var Be=new Map,Me=new Proxy(Object.freeze({}),{get:(e,t)=>Be.get(t)});function _e(e,t,r){if(Be.has(e))throw new Error('Widget functions of "'.concat(e,'" already registered'));var{storyboardFunctions:n,registerStoryboardFunctions:a}=fe({widgetId:e,widgetVersion:r});Be.set(e,n),a(t)}var Le=r(953);function Fe(e,t){var r=Ea(e);if(!r&&null!=pa&&pa.checkInstalledApps&&(r=pa.checkInstalledApps.getCheckedApp(e)),!r||"running"===r.installStatus)return!1;if(!t||!r.currentVersion)return!0;var n=t.match(/^([><]=?|=)(.*)$/);try{if(!n)throw new TypeError("Invalid match version: ".concat(t));return(0,Le.q)(r.currentVersion,n[2],n[1])}catch(e){console.error(e)}return!1}function Ue(e,t,r){var{formStateStoreId:n,formStateStoreMap:a}=e;if(!n)throw new Error('Using "'.concat(t,'" outside of form renderer').concat(null!=r?r:""));var i=a.get(n);if(!i)throw new Error('Form state store is not found when using "'.concat(t,'"').concat(null!=r?r:"",".\nThis is a bug of Brick Next, please report it."));return i}var Ne=new Map;function je(e){return De.apply(this,arguments)}function De(){return De=(0,i.Z)((function*(e){var t,r=null==pa||null===(t=pa.flowApi)||void 0===t?void 0:t.isFlowApiProvider(e);r&&(e=pa.flowApi.FLOW_API_PROVIDER);var n=Ne.get(e);if(n)return n;if(e.includes("-")&&!customElements.get(e))if(r)pa.flowApi.registerFlowApiProvider();else if(yield(0,u.loadBricksImperatively)([e],ya()),!customElements.get(e))throw new Error('Provider not defined: "'.concat(e,'".'));return n=document.createElement(e),Ne.set(e,n),n})),De.apply(this,arguments)}var Ve=new WeakSet;function We(e){if((0,p.isObject)(e)&&!$e(e))if(Ve.add(e),Array.isArray(e))e.forEach(We);else{var t=Object.getPrototypeOf(e);t&&t.constructor!==Object||Object.values(e).forEach(We)}}function $e(e){return Ve.has(e)}var qe=new Map;function He(e,t,r){return ze.apply(this,arguments)}function ze(){return(ze=(0,i.Z)((function*(e,t,r){var{useProvider:n,method:i="resolve",args:o=[],onReject:s}=e,{provider:c,field:l}=e;if(c&&!n)throw new Error("You're using \"provider: ".concat(c,'" which is dropped in v3, please use "useProvider" instead'));var u=null!=l;if(u){var p=Pe();if(Ie(p,"`resolve.field`"),p)throw new Error("Using deprecated `resolve.field`")}var d,[f,v]=yield Promise.all([je(n),ct(o,t)]),h=Ke(f,n,i,v,r,o),{transform:g}=e;try{var y=yield h;We(d=u?(0,m.get)(y,l):y)}catch(e){if(!function(e){return!(null==e||!e.transform)}(s))throw e;g=s.transform,d=e}return g?"string"==typeof g?{[g]:d}:ct(g,(0,a.Z)((0,a.Z)({},t),{},{data:d})):d}))).apply(this,arguments)}function Ke(e,t,r,n,a,i){return Ge.apply(this,arguments)}function Ge(){return Ge=(0,i.Z)((function*(e,t,r,n,a,o){var s,c;try{s=JSON.stringify({useProvider:t,method:r,args:n})}catch(e){if(!o)throw e;s=JSON.stringify({useProvider:t,method:r,originalArgs:o})}return"reload"!==(null==a?void 0:a.cache)&&(c=qe.get(s)),c||(c=(0,i.Z)((function*(){var a,i=null!=pa&&null!==(a=pa.flowApi)&&void 0!==a&&a.isFlowApiProvider(t)?yield pa.flowApi.getArgsOfFlowApi(t,n,r):n;return e.resolve(...i)}))(),qe.set(s,c)),c})),Ge.apply(this,arguments)}var Je=Symbol.for("pre.evaluated.raw"),Ye=Symbol.for("pre.evaluated.context");function Xe(e){return!(null==e||!e[Je])}function Qe(e){return e[Je]}function et(e){return"string"==typeof e?(0,C.shouldAllowRecursiveEvaluations)(e):(0,C.shouldAllowRecursiveEvaluations)(e[Je])}var tt=new WeakSet([SyntaxError,TypeError,ReferenceError]);function rt(e){return tt.has(e.constructor)?e.constructor:TypeError}function nt(){return(nt=(0,i.Z)((function*(e,t,r){var{blockingList:n,run:a}=at(e,t,r,!0);return yield Promise.all(n),a()}))).apply(this,arguments)}function at(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3?arguments[3]:void 0,i=[];if("string"!=typeof e){var o=(0,m.omit)(t,["pendingPermissionsPreCheck","tplStateStoreMap","tplStateStoreScope","formStateStoreMap","formStateStoreScope"]);t=(0,a.Z)((0,a.Z)({},e[Ye]),o),e=e[Je]}var s,c={usedArgs:new Set},l={usedArgs:new Set};try{s=(0,C.preevaluate)(e,{withParent:!0,hooks:{beforeVisitGlobal(e,t){(0,x.collectAppGetMenuUsage)(c,e,t),(0,x.collectInstalledAppsHasUsage)(l,e,t)}}})}catch(t){var d="".concat(t.message,', in "').concat(e,'"');throw new(rt(t))(d)}if(c.hasNonStaticUsage)throw new Error('Non-static usage of "APP.getMenu" is prohibited in v3, check your expression: "'.concat(e,'"'));if(l.hasNonStaticUsage)throw new Error('Non-static usage of "INSTALLED_APPS.has" is prohibited in v3, check your expression: "'.concat(e,'"'));var f,v,h,g,y={},{attemptToVisitGlobals:b}=s;if(r.lazy||b.has("EVENT")&&!(0,p.hasOwnProperty)(t,"event")||b.has("DATA")&&!(0,p.hasOwnProperty)(t,"data"))return{blockingList:i,run:()=>Object.keys(t).length>0?{[Je]:e,[Ye]:t}:e};var w,S,E=Pe(t);(b.has("STATE")||!E&&b.has("TPL"))&&(g=Te(t,"STATE",': "'.concat(e,'"'))),b.has("FORM_STATE")&&(S=Ue(t,"FORM_STATE",': "'.concat(e,'"')));var k=$();if(n||k){if(b.has("CTX")&&(f=(0,x.strictCollectMemberUsage)(e,"CTX"),n&&i.push(t.ctxStore.waitFor(f))),g){if(h=(0,x.strictCollectMemberUsage)(e,"STATE"),!E){var A=(0,x.strictCollectMemberUsage)(e,"TPL");for(var Z of A)h.add(Z)}n&&i.push(g.waitFor(h))}S&&(w=(0,x.strictCollectMemberUsage)(e,"FORM_STATE"),n&&i.push(S.waitFor(w))),b.has("PROCESSORS")&&(v=(0,x.strictCollectMemberUsage)(e,"PROCESSORS",2),n&&i.push((0,u.loadProcessorsImperatively)(v,ya())))}if(n){var P,I=b.has("PERMISSIONS");if(!I&&b.has("FN")){var O=[...(0,x.strictCollectMemberUsage)(e,"FN")];I=me(O)}if(I&&i.push(...t.pendingPermissionsPreCheck),c.usedArgs.size>0&&null!=pa&&pa.menu){var T=[...c.usedArgs];i.push(Promise.all(T.map((e=>pa.menu.fetchMenuById(e,t,{getStoryboardByAppId:Sa,resolveData:He,asyncComputeRealValue:ct})))))}l.usedArgs.size>0&&i.push(null==pa||null===(P=pa.checkInstalledApps)||void 0===P?void 0:P.waitForCheckingApps([...l.usedArgs]))}return{blockingList:i,run(){var r,n,i,o,{app:c,location:l,query:u,match:d,flags:k,sys:A,ctxStore:Z,data:P,event:I}=t,O=null!==(r=t.overrideApp)&&void 0!==r?r:c;for(var x of b)switch(x){case"ANCHOR":y[x]=l.hash?l.hash.substring(1):null;break;case"APP":y[x]=(0,a.Z)((0,a.Z)({},(0,m.cloneDeep)(O)),{},{getMenu:null==pa||null===(n=pa.menu)||void 0===n?void 0:n.getMenuById});break;case"CTX":y[x]=K({get:(e,t)=>Z.getValue(t),ownKeys:()=>Array.from(f)});break;case"DATA":y[x]=P;break;case"EVENT":y[x]=I;break;case"FLAGS":y[x]=z(k);break;case"FORM_STATE":y[x]=K({get:(e,t)=>S.getValue(t),ownKeys:()=>Array.from(w)});break;case"HASH":y[x]=l.hash;break;case"INSTALLED_APPS":y[x]=z({has:Fe});break;case"ITEM":(0,p.hasOwnProperty)(t,"forEachItem")?y[x]=t.forEachItem:console.error('Using `ITEM` but no `:forEach` is found, check your expression: "'.concat(e,'"'));break;case"LOCAL_STORAGE":y[x]=z({getItem:Ze("local")});break;case"MEDIA":y[x]=z(Ae());break;case"MISC":y[x]=va().getMiscSettings();break;case"PARAMS":y[x]=new URLSearchParams(u);break;case"PATH":y[x]=z(null!==(i=null==d?void 0:d.params)&&void 0!==i?i:{});break;case"PATH_NAME":y[x]=l.pathname;break;case"PROCESSORS":y[x]=K({get(e,t){var r=M.get(t);if(!r)throw new Error("'PROCESSORS.".concat(t,"' is not registered! Have you installed the relevant brick package?"));return K({get:(e,t)=>r.get(t),ownKeys:()=>Array.from(r.keys())})},ownKeys(){var e=new Set;for(var t of v){var r=t.split(".")[0];e.add(r)}return Array.from(e)}});break;case"QUERY":y[x]=Object.fromEntries(Array.from(u.keys()).map((e=>[e,u.get(e)])));break;case"QUERY_ARRAY":y[x]=Object.fromEntries(Array.from(u.keys()).map((e=>[e,u.getAll(e)])));break;case"SESSION_STORAGE":y[x]=z({getItem:Ze("session")});break;case"TPL":if(Ie(E,'Using "TPL" in expression','check your expression: "'.concat(e,'"')),E)break;case"STATE":y[x]=K({get:(e,t)=>g.getValue(t),ownKeys:()=>Array.from(h)});break;case"SYS":y[x]=z(null!=A?A:{});break;case"__WIDGET_FN__":y[x]=Me;break;case"__WIDGET_IMG__":y[x]=null==pa||null===(o=pa.images)||void 0===o?void 0:o.widgetImagesFactory;break;case"__WIDGET_I18N__":y[x]=U}Object.assign(y,le(s.attemptToVisitGlobals,{storyboardFunctions:ve,app:t.app,appendI18nNamespace:t.appendI18nNamespace}));try{var T=(0,C.cook)(s.expression,s.source,{globalVariables:(0,R.supply)(s.attemptToVisitGlobals,y)});return function(e,t){var r=$();if(r&&W&&(!N||"Evaluations"===N)){var n=()=>{var n;null===(n=r.emit)||void 0===n||n.call(r,{type:e,payload:t})};"function"==typeof window.requestIdleCallback?window.requestIdleCallback(n):setTimeout(n,0)}}("evaluation",{raw:e,context:y,result:T}),T}catch(t){var B="".concat(t.message,', in "').concat(e,'"');throw new(rt(t))(B)}}}}var it=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 ot(e){switch(e){case it.USE_BRICK_PROPERTIES:case it.USE_BRICK_TRANSFORM:case it.USE_BRICK_EVENTS:case it.USE_BRICK_IF:case it.USE_BRICK_LIFECYCLE:case it.USE_BRICK_DATA_SOURCE:return!0}return!1}function st(e,t,r){if(ot(e))return e;if(t)switch(e){case it.USE_BRICK:return it.USE_BRICK_ITEM;case it.USE_BRICK_SLOTS_ITEM_BRICKS:return it.USE_BRICK_SLOTS_ITEM_BRICKS_ITEM}else switch(e){case it.INITIAL:if("useBrick"===r)return it.USE_BRICK;break;case it.USE_BRICK:case it.USE_BRICK_ITEM:case it.USE_BRICK_SLOTS_ITEM_BRICKS_ITEM:switch(r){case"properties":return it.USE_BRICK_PROPERTIES;case"transform":return it.USE_BRICK_TRANSFORM;case"dataSource":return it.USE_BRICK_DATA_SOURCE;case"events":return it.USE_BRICK_EVENTS;case"slots":return it.USE_BRICK_SLOTS;case"children":return it.USE_BRICK_SLOTS_ITEM_BRICKS;case"if":return it.USE_BRICK_IF;case"lifeCycle":return it.USE_BRICK_LIFECYCLE}break;case it.USE_BRICK_SLOTS:return it.USE_BRICK_SLOTS_ITEM;case it.USE_BRICK_SLOTS_ITEM:if("bricks"===r)return it.USE_BRICK_SLOTS_ITEM_BRICKS}return it.INITIAL}function ct(e,t){return lt.apply(this,arguments)}function lt(){return lt=(0,i.Z)((function*(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=Xe(e);if(n||"string"==typeof e){var a,i=r.$$lazyForUseBrick&&ot(r.$$stateOfUseBrick),o=i;return n||(0,C.isEvaluable)(e)?(a=yield function(e,t,r){return nt.apply(this,arguments)}(e,t,{lazy:i}),o=et(e)):a=i?e:((0,p.hasOwnProperty)(t,"data")?r.noInject?T.transform:T.transformAndInject:r.noInject?dt:T.inject)(e,t),o||We(a),a}if(!(0,p.isObject)(e)||$e(e)||"function"==typeof e)return e;if(Array.isArray(e)){var s=pt(r,!0);return Promise.all(e.map((e=>ct(e,t,s))))}return Object.fromEntries((yield Promise.all(Object.entries(e).map((e=>{var[n,a]=e;return Promise.all([ct(n,t),ct(a,t,pt(r,!1,n))])})))).concat(r.ignoreSymbols?[]:Object.getOwnPropertySymbols(e).map((t=>[t,e[t]]))))})),lt.apply(this,arguments)}function ut(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=Xe(e);if(n||"string"==typeof e){var a,i=r.$$lazyForUseBrick&&ot(r.$$stateOfUseBrick),o=i;return n||(0,C.isEvaluable)(e)?(a=function(e,t,r){var{run:n}=at(e,t,void 0,!1);return n()}(e,t),o=et(e)):a=i?e:((0,p.hasOwnProperty)(t,"data")?r.noInject?T.transform:T.transformAndInject:r.noInject?dt:T.inject)(e,t),o||We(a),a}if(!(0,p.isObject)(e)||$e(e)||"function"==typeof e)return e;if(Array.isArray(e)){var s=pt(r,!0);return e.map((e=>ut(e,t,s)))}return Object.fromEntries(Object.entries(e).map((e=>{var[n,a]=e;return[ut(n,t),ut(a,t,pt(r,!1,n))]})).concat(r.ignoreSymbols?[]:Object.getOwnPropertySymbols(e).map((t=>[t,e[t]]))))}function pt(e,t,r){return e.$$lazyForUseBrick?(0,a.Z)((0,a.Z)({},e),{},{$$stateOfUseBrick:st(e.$$stateOfUseBrick,t,r)}):e}function dt(e){return e}function ft(e,t){return vt.apply(this,arguments)}function vt(){return(vt=(0,i.Z)((function*(e,t){return!(0,p.hasOwnProperty)(e,"if")||!!("string"==typeof e.if||Xe(e.if)?yield ct(e.if,t):e.if)}))).apply(this,arguments)}function ht(e,t){return!(0,p.hasOwnProperty)(e,"if")||!!("string"==typeof e.if||Xe(e.if)?ut(e.if,t):e.if)}function mt(e){return!(0,p.hasOwnProperty)(e,"if")||!!e.if}function gt(){return(gt=(0,i.Z)((function*(e,t){return(0,p.isObject)(e.if)&&!Xe(e.if)?mt(yield He(e.if,t)):ft(e,t)}))).apply(this,arguments)}function yt(e,t){return ht(e,{data:t})}function bt(e){var t=!1,r=!1,n=!1;if("string"==typeof e?(0,C.isEvaluable)(e):Xe(e)){var a="string"==typeof e?e:Qe(e);if((0,C.isTrackAll)(a)){var i=(0,x.trackAll)(a);i&&(t=i.context,r=i.state,n=i.formState)}else t=(0,x.track)(a,"track context","CTX"),r=(0,x.track)(a,"track state","STATE"),n=(0,x.track)(a,"track formstate","FORM_STATE")}return{contextNames:t,stateNames:r,formStateNames:n}}function wt(e,t){return St.apply(this,arguments)}function St(){return(St=(0,i.Z)((function*(e,t){for(var[r,n,a]of e)if(r===t){var i=yield n;if(void 0!==i||!a)return i}}))).apply(this,arguments)}function Et(e){return kt.apply(this,arguments)}function kt(){return(kt=(0,i.Z)((function*(e){var t={};for(var[r,n,a]of e){var i=yield n;void 0===i&&a||!("style"!==r&&"dataset"!==r||(0,p.isObject)(i))||(t[r]=i)}return t}))).apply(this,arguments)}function At(e,t){if(t)for(var[r,n]of Object.entries(t))switch(r){case"style":case"dataset":for(var[a,i]of Object.entries(n))e[r][a]=i;break;case"constructor":case"__proto__":case"innerHTML":throw new Error("set `".concat(r,"` is prohibited"));default:e[r]=n}}function Zt(e,t,r){var n=function(e,t){return(0,p.isObject)(e)?Object.fromEntries(Object.entries(e).map((e=>{var[r,n]=e,a=ut(n,t,{$$lazyForUseBrick:!0,$$stateOfUseBrick:"useBrick"===r?it.USE_BRICK:it.INITIAL});if("style"!==r&&"dataset"!==r||(0,p.isObject)(a))return[r,a]})).filter(Boolean)):{}}(t,r);Array.isArray(e)||(e=[e]),e.forEach((e=>{At(e,n)}))}var Pt=r(6903),It=new Map,Ot=1e4,Ct=0;function xt(e,t){var{path:r,exact:n=!1,strict:a=!1,sensitive:i=!0}=t;return(Array.isArray(r)?r:[r]).reduce(((t,r)=>{if(t)return t;var{regexp:o,keys:s}=function(e,t){var r="".concat(t.end).concat(t.strict).concat(t.sensitive),n=It.get(r);n||It.set(r,n=new Map);var a=n.get(e);if(a)return a;var i=[],o={regexp:(0,Pt.Bo)(e,i,t),keys:i};return Ct<Ot&&(n.set(e,o),Ct++),o}(r,{end:n,strict:a,sensitive:i}),c=o.exec(e);if(!c)return null;var[l,...u]=c,p=e===l;return n&&!p?null:{path:r,url:"/"===r&&""===l?"/":l,isExact:p,params:s.reduce(((e,t,r)=>(e[t.name]=u[r],e)),{})}}),null)}function Tt(){return(Tt=(0,i.Z)((function*(e,t){for(var r of e){if("string"!=typeof r.path)throw console.error("Invalid route with invalid path:",r),new Error("Invalid route with invalid type of path: ".concat(typeof r.path));var n=Rt(r,t.app.homepage,t.location.pathname);if(n&&(yield ft(r,t)))return t.app.noAuthGuard||r.public||null==pa||!pa.auth||pa.auth.isLoggedIn()?{match:n,route:r}:"unauthenticated"}return"missed"}))).apply(this,arguments)}function Rt(e,t,r){return xt(r,{path:e.path.replace(/^\$\{APP.homepage\}/,t),exact:e.exact})}var Bt,Mt=Symbol.for("tpl.asyncComputedPropsFromHost"),_t=Symbol.for("tpl.stateStoreId"),Lt=Symbol.for("tpl.externalForEachItem"),Ft=r(6666),Ut=new Set,Nt=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}({}),jt={[Nt.REQUEST_FAILED]:"Request Failed",[Nt.SOMETHING_WENT_WRONG]:"Something went wrong!",[Nt.LOGIN_TIMEOUT_MESSAGE]:"You haven't logged in or your login session has expired. Login right now?",[Nt.NETWORK_ERROR]:"Network error, please check your network."},Dt={[Nt.REQUEST_FAILED]:"请求失败",[Nt.SOMETHING_WENT_WRONG]:"出现了一些问题!",[Nt.LOGIN_TIMEOUT_MESSAGE]:"您还未登录或登录信息已过期,现在重新登录?",[Nt.NETWORK_ERROR]:"网络错误,请检查您的网络连接。"},Vt="core/runtime",Wt={en:jt,zh:Dt},$t=Object.freeze({show:function(e){return Bt?Bt.resolve(e):"confirm"===e.type?confirm(e.content)?new Promise((e=>setTimeout((()=>{e()}),1))):new Promise(((e,t)=>setTimeout((()=>{t()}),1))):(alert(e.content),new Promise((e=>setTimeout((()=>{e()}),1e3))))}});function qt(e){if(e instanceof Event&&e.target instanceof HTMLScriptElement)return e.target.src;if(e instanceof O.HttpFetchError)return l.i18n.t("".concat(Vt,":").concat(Nt.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 Ht(e){return e instanceof O.HttpResponseError&&401===e.response.status&&!!e.responseJson&&100003===e.responseJson.code}var zt,Kt,Gt=!1;function Jt(e){if(!(e instanceof O.HttpAbortError)){if(Ht(e)&&!window.NO_AUTH_GUARD){if(Gt)return;return Gt=!0,void $t.show({type:"confirm",content:l.i18n.t("".concat(Vt,":").concat(Nt.LOGIN_TIMEOUT_MESSAGE))}).then((()=>{var e,t;e=va().getFeatureFlags()["sso-enabled"],(t=Z()).push(e?"/sso-auth/login":"/auth/login",{from:(0,a.Z)((0,a.Z)({},t.location),{},{state:void 0})}),Gt=!1}),(()=>{Gt=!1}))}console.error(e);var t=qt(e);t!==zt&&(zt=t,$t.show({type:"error",title:l.i18n.t("".concat(Vt,":").concat(Nt.REQUEST_FAILED)),content:t,contentStyle:{whiteSpace:"pre-wrap"}}).then((()=>{zt=void 0})))}}var Yt=Object.freeze({show:function(e){Kt?Kt.resolve(e):alert(e.message)}});function Xt(e,t,r){t&&Object.entries(t).forEach((t=>{var[n,a]=t,i=nr(a,r,{element:e});for(var o of(e.addEventListener(n,i),e.$$listeners||(e.$$listeners=[]),e.$$listeners.push([n,i]),e.$$eventListeners||(e.$$eventListeners=[]),[].concat(a)))e.$$eventListeners.push([n,null,o])}))}function Qt(e){return"string"==typeof e.action}function er(e){return"string"==typeof e.useProvider}function tr(e){return!(!e.target&&!e.targetRef||!e.method&&!e.properties)}function rr(e){return!!e.then}function nr(e,t,r){return function(n){var i,o;for(var s of[].concat(e))if(ht(s,(0,a.Z)((0,a.Z)({},t),{},{event:n})))if(rr(s))nr(s.then,t,r)(n);else if(Qt(s)){var[c,l]=s.action.split(".");switch(s.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":lr(n,l,s.args,s.callback,t);break;case"window.open":ur(n,s.args,t);break;case"location.reload":case"location.assign":hr(n,l,s.args,t);break;case"localStorage.setItem":case"localStorage.removeItem":case"sessionStorage.setItem":case"sessionStorage.removeItem":mr(n,c,l,s.args,t);break;case"event.preventDefault":n.preventDefault();break;case"console.log":case"console.error":case"console.warn":case"console.info":gr(n,l,s.args,t);break;case"message.success":case"message.error":case"message.info":case"message.warn":yr(n,l,s.args,t);break;case"handleHttpError":Jt(n.detail);break;case"context.assign":case"context.replace":case"context.refresh":case"context.load":dr(n,l,s.args,null===(i=s.batch)||void 0===i||i,s.callback,t);break;case"state.update":case"state.refresh":case"state.load":fr(n,l,s.args,null===(o=s.batch)||void 0===o||o,s.callback,t);break;case"tpl.dispatchEvent":var[u,p]=Er(s.args,t,n);Re(t,s.action,": ".concat(u)).dispatchEvent(new CustomEvent(u,p));break;case"formstate.update":vr(n,s.args,s.callback,t);break;case"message.subscribe":case"message.unsubscribe":br(n,l,s.args,t,r,s.callback);break;case"theme.setDarkTheme":case"theme.setLightTheme":te("theme.setDarkTheme"===s.action?"dark":"light");break;case"theme.setTheme":var[d]=Er(s.args,t,n);te(d);break;case"mode.setDashboardMode":case"mode.setDefaultMode":se("mode.setDashboardMode"===s.action?"dashboard":"default");break;default:console.error("unknown event listener action:",s.action)}}else er(s)?ar(n,s,t,r):tr(s)?or(n,s,t,r):console.error("unknown event handler:",s);else s.else&&nr(s.else,t,r)(n)}}function ar(e,t,r,n){return ir.apply(this,arguments)}function ir(){return(ir=(0,i.Z)((function*(e,t,r,n){try{sr(e,yield je(t.useProvider),t,"saveAs"!==t.method?"resolve":"saveAs",r,n)}catch(e){console.error(qt(e))}}))).apply(this,arguments)}function or(e,t,r,n){var i=[],o=t.target,s=t.targetRef,c=o;if(("string"==typeof o?(0,C.isEvaluable)(o):Xe(o))&&(c=ut(o,(0,a.Z)((0,a.Z)({},r),{},{event:e}))),"string"==typeof c)if("_self"===c)i.push(n.element);else if(t.multiple)i=Array.from(document.querySelectorAll(c));else{var l=document.querySelector(c);null!==l&&i.push(l)}else if(c)c instanceof HTMLElement?i.push(c):console.error("unexpected target:",c);else if(s){var u=s;("string"==typeof s?(0,C.isEvaluable)(s):Xe(s))&&(u=ut(s,(0,a.Z)((0,a.Z)({},r),{},{event:e})));var p=[].concat(u),d=Re(r,"targetRef",": ".concat(p.join(", ")));i.push(...p.map((e=>{var t;return null===(t=d.$$getElementByRef)||void 0===t?void 0:t.call(d,e)})).filter(Boolean))}0!==i.length?function(e){return!!e.method}(t)?i.forEach((a=>{sr(e,a,t,t.method,r,n,{useEventAsDefault:!0})})):function(e){return!!e.properties}(t)&&Zt(i,t.properties,(0,a.Z)((0,a.Z)({},r),{},{event:e})):console.error("target not found:",o||s)}function sr(e,t,r,n,a,i,o){return cr.apply(this,arguments)}function cr(){return cr=(0,i.Z)((function*(e,t,r,n,o,s,c){var l;if("function"==typeof t[n]){var u=function(){var a=(0,i.Z)((function*(){var a,i=Er(r.args,o,e,c);return er(r)&&null!=pa&&null!==(a=pa.flowApi)&&void 0!==a&&a.isFlowApiProvider(r.useProvider)&&(i=yield pa.flowApi.getArgsOfFlowApi(r.useProvider,i,n)),t[n](...i)}));return function(){return a.apply(this,arguments)}}();if(r.callback){var p,d=Sr(r.callback,o,s),f={progress:d("progress"),success:d("success"),error:d("error"),finally:d("finally")};if(er(r)&&(p=ut(r.poll,(0,a.Z)((0,a.Z)({},o),{},{event:e}))),null!==(l=p)&&void 0!==l&&l.enabled)!function(e,t,r){var n,{progress:a,success:o,error:s,finally:c}=t,{interval:l,leadingRequestDelay:u,continueOnError:p,delegateLoadingBar:d,expectPollEnd:f,expectPollStopImmediately:v}=r,h=ba();function m(){return g.apply(this,arguments)}function g(){return(g=(0,i.Z)((function*(){var t;Ut.delete(n);try{if(!(t=null==v?void 0:v())){var r=yield e();(t=(null==v?void 0:v())||h!==ba())||(null==a||a(r),null!=f&&f(r)?(d&&window.dispatchEvent(new Event("request.end")),null==o||o(r),null==c||c()):y(null!=l?l:3e3))}}catch(e){(t=(null==v?void 0:v())||h!==ba())||(null==s||s(e),p?y(null!=l?l:3e3):null==c||c())}finally{d&&t&&window.dispatchEvent(new Event("request.end"))}}))).apply(this,arguments)}function y(e){n=setTimeout(m,e),Ut.add(n)}y(null!=u?u:0),d&&window.dispatchEvent(new Event("request.start"))}(u,f,p);else try{var v=yield u();f.success(v)}catch(e){f.error(e)}finally{f.finally()}}else u()}else console.error("target has no method:",{target:t,method:n})})),cr.apply(this,arguments)}function lr(e,t,r,n,a){var i=0,o=!1,s=t;switch(t){case"push":case"replace":case"pushQuery":case"replaceQuery":case"pushAnchor":i=2,o=!0;break;case"reload":o=!0;break;case"block":i=1,s="setBlockMessage"}var c=[];if(i>0&&((c=Er(r,a,e,{useEventDetailAsDefault:!0})).length=i),o&&n){var l=Sr(n,a,void 0);c.push((e=>{l(e?"error":"success")({blocked:e}),l("finally")({blocked:e})}))}Z()[s](...c)}function ur(e,t,r){var[n,a,i]=Er(t,r,e);window.open(n,a||"_self",i)}function pr(e,t,r,n,a,i){t?n.updateValues(e,r,(e=>Er(e,a,i)[0])):e.forEach((e=>{var{name:t,value:o}=Er([e],a,i)[0];n.updateValue(t,o,r)}))}function dr(e,t,r,n,a,i){if(!Array.isArray(r)||!r.every(p.isObject)||"assign"!==t&&"replace"!==t){var[o,s]=Er(r,i,e);i.ctxStore.updateValue(o,s,t,a,i)}else pr(r,n,t,i.ctxStore,i,e)}function fr(e,t,r,n,a,i){if(Array.isArray(r)&&r.every(p.isObject)&&"update"===t)pr(r,n,"replace",Te(i,"state.".concat(t),": ".concat(JSON.stringify(r))),i,e);else{var[o,s]=Er(r,i,e);Te(i,"state.".concat(t),": ".concat(o)).updateValue(o,s,"update"===t?"replace":t,a,i)}}function vr(e,t,r,n){var[a,i]=Er(t,n,e);Ue(n,"formstate.update",": ".concat(a)).updateValue(a,i,"replace",r,n)}function hr(e,t,r,n){if("assign"===t){var[a]=Er(r,n,e);location.assign(a)}else location[t]()}function mr(e,t,r,n,a){var i="localStorage"===t?localStorage:sessionStorage,[o,s]=Er(n,a,e);"setItem"===r?void 0!==s&&i.setItem(o,JSON.stringify(s)):i.removeItem(o)}function gr(e,t,r,n){console[t](...Er(r,n,e,{useEventAsDefault:!0}))}function yr(e,t,r,n){var a=Er(r,n,e,{useEventAsDefault:!0});Yt.show({type:t,message:a[0]})}function br(e,t,r,n,a,i){return wr.apply(this,arguments)}function wr(){return(wr=(0,i.Z)((function*(e,t,r,n,a,i){var o=()=>{var a,i=Er(r,n,e);return null==pa||null===(a=pa.messageDispatcher)||void 0===a?void 0:a[t](...i)};if(i){var s=Sr(i,n,a);try{var c=yield o();s("success")(c)}catch(e){s("error")(e)}finally{s("finally")()}}else o()}))).apply(this,arguments)}function Sr(e,t,r){return function(n){return function(a){var i=null==e?void 0:e[n];if(i)try{var o=new CustomEvent("callback.".concat(n),{detail:a});nr(i,t,r)(o)}catch(e){console.error(e)}else"error"===n&&console.error("Unhandled callback error:",a)}}}function Er(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return Array.isArray(e)?ut(e,(0,a.Z)((0,a.Z)({},t),{},{event:r})):n.useEventAsDefault?[r]:n.useEventDetailAsDefault?[r.detail]:[]}var kr=["onBeforePageLoad","onPageLoad","onBeforePageLeave","onPageLeave","onAnchorLoad","onAnchorUnload"];class Ar{constructor(e,t,r){(0,Ft.Z)(this,"type",void 0),(0,Ft.Z)(this,"data",new Map),(0,Ft.Z)(this,"changeEventType",void 0),(0,Ft.Z)(this,"pendingStack",[]),(0,Ft.Z)(this,"hostBrick",void 0),(0,Ft.Z)(this,"batchUpdate",!1),(0,Ft.Z)(this,"batchUpdateContextsNames",[]),(0,Ft.Z)(this,"rendererContext",void 0),(0,Ft.Z)(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=r}getAllValues(){return Object.fromEntries([...this.data.entries()].map((e=>{var[t,{value:r}]=e;return[t,r]})))}getValue(e){var t;return null===(t=this.data.get(e))||void 0===t?void 0:t.value}getAffectListByContext(e){var t=[e];return this.data.forEach(((e,r)=>{e.deps&&e.deps.some((e=>t.includes(e)))&&t.push(r)&&t.push(...this.getAffectListByContext(r))})),t.shift(),[...new Set(t)]}updateValues(e,t,r){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");var n={},a={},i=[];e.forEach((e=>{var{name:a,value:o}=r([e]),s=this.data.get(a);i.push(...this.getAffectListByContext(a)),s&&(n[a]=s),this.updateValue(a,o,t)})),i.filter((e=>!n[e])).forEach((e=>{var t=this.data.get(e);t&&(a[e]=t)}));var o=e=>{for(var t in e){var r,n=e[t];null===(r=n.eventTarget)||void 0===r||r.dispatchEvent(new CustomEvent(this.changeEventType,{detail:n.value}))}};o(n),o(a),this.batchUpdate=!1}updateValue(e,t,r,n,i){var o=this.data.get(e);if(!o)throw new Error("".concat(this.type," '").concat(e,"' is not defined"));if("refresh"!==r&&"load"!==r)"replace"===r?o.value=t:(0,p.isObject)(o.value)?Object.assign(o.value,t):(console.warn('Non-object current value of "'.concat(this.type,".").concat(e,'" for "context.assign", try "context.replace" instead.')),o.value=t),this.batchUpdate||o.eventTarget.dispatchEvent(new CustomEvent(this.changeEventType,{detail:o.value}));else{if(!o.load)throw new Error("You can not ".concat(r,' "').concat(this.type,".").concat(e,'" which has no resolve'));var s;if("load"===r&&(o.loaded?s=Promise.resolve(o.value):o.loading&&(s=o.loading)),s||(s=o.loading=o.load((0,a.Z)({cache:"load"===r?"default":"reload"},t))).then((e=>{o.loaded=!0,o.value=e,o.eventTarget.dispatchEvent(new CustomEvent(this.changeEventType,{detail:o.value}))}),(e=>{null!=n&&n.error||Jt(e)})),n){var c=Sr(n,i);s.then((e=>{c("success")({value:e}),c("finally")()}),(e=>{c("error")(e),c("finally")()}))}}}define(e,t,r,n){if(Array.isArray(e)&&e.length>0){var a=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"CTX",n=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"CTX",r=new Map;for(var n of e){var a=(0,x.collectMemberUsage)([n.if,n.value,n.resolve],t);r.set(n,a)}return r}(e,r),a=new Map;for(var o of Array.from(n.keys()).map((e=>e.name))){var s;a.set(o,(null!==(s=a.get(o))&&void 0!==s?s:0)+1)}var c=Array.from(n.values()).some((e=>e.hasNonStaticUsage)),l=new WeakSet,u=new Map,p=new Map([...new Set(e.map((e=>e.name)))].map((e=>[e,new Promise(((t,r)=>{u.set(e,{resolve:t,reject:r})}))]))),d=function(){var e=(0,i.Z)((function*(e){var r;l.add(e);var i=yield t(e);n.delete(e);var o=null!==(r=a.get(e.name))&&void 0!==r?r:0;if(i){if(u.get(e.name).resolve(),a.delete(e.name),0===o)throw new Error("Duplicated context defined: ".concat(e.name))}else 1===o?(u.get(e.name).resolve(),a.delete(e.name)):a.set(e.name,o-1);yield v()}));return function(t){return e.apply(this,arguments)}}(),f=c;function v(){return h.apply(this,arguments)}function h(){return h=(0,i.Z)((function*(){var e=Array.from(n.entries()).filter(function(e,t){return(r,n)=>t?0===n:![...r[1].usedProperties].some((t=>e.has(t)))}(a,f)).map((e=>e[0])).filter((e=>!l.has(e)));yield Promise.all(e.map(d))})),h.apply(this,arguments)}return{pendingResult:v().then((0,i.Z)((function*(){for(var e of(n.size>0&&(function(e,t){var r=new Map(e),n=new Set(Array.from(r.keys()).map((e=>e.name))),a=()=>{var e=!1;for(var[t,i]of r.entries())[...i.usedProperties].some((e=>n.has(e)))||(r.delete(t),n.delete(t.name),e=!0);e&&a()};if(a(),r.size>0)throw new ReferenceError("Circular ".concat(t," detected: ").concat(Array.from(r.keys()).map((e=>e.name)).join(", ")))}(n,r),f=!0,yield v()),u.values()))e.resolve()}))).catch((e=>{for(var t of u.values())t.reject(e);throw e})),pendingContexts:p}}(e,(e=>this.resolve(e,t,r,n)),this.type);this.pendingStack.push(a)}}onChange(e,t){var r;null===(r=this.data.get(e))||void 0===r||r.eventTarget.addEventListener(this.changeEventType,t)}waitFor(e){var t=this;return(0,i.Z)((function*(){var r=function*(t){yield Promise.all([...e].map((e=>t.get(e))))};for(var{pendingContexts:n}of t.pendingStack)yield*r(n)}))()}waitForAll(){var e=this;return(0,i.Z)((function*(){for(var{pendingContexts:t}of e.pendingStack)for(var r of t.values())r.catch((()=>{}));for(var{pendingResult:n}of e.pendingStack)yield n}))()}mountAsyncData(e){this.data.forEach((t=>{var r;if(t.async&&(!e||null!==(r=this.routeMap.get(e))&&void 0!==r&&r.has(t.name))){if(t.asyncMounted)return void console.error('Async data "'.concat(t.name,'" already mounted. This is a bug of Brick Next, please report it.'));t.asyncMounted=!0,t.loading.then((e=>{t.loaded=!0,t.value=e,t.eventTarget.dispatchEvent(new CustomEvent(this.changeEventType,{detail:e}))}))}}))}resolve(e,t,r,n){var o=this;return(0,i.Z)((function*(){if(!(yield ft(e,t)))return!1;var s,c,l;r&&("STATE"===o.type?e.expose:"FORM_STATE"===o.type)&&(s=yield wt(r,e.name));var u="eager";if(void 0===s){if(e.resolve){var d=(0,a.Z)({transform:"value"},e.resolve);if(yield ft(e.resolve,t))c=function(){var e=(0,i.Z)((function*(e){return(yield He(d,t,e)).value}));return function(t){return e.apply(this,arguments)}}(),"eager"==(u=e.resolve.async?"async":e.resolve.lazy?"lazy":"eager")?s=yield c():"async"===u&&(l=c());else if(!(0,p.hasOwnProperty)(e,"value"))return!1}c&&"eager"===u||void 0===e.value||(s=yield ct(e.value,t))}var f={name:e.name,value:s,eventTarget:new ge.Z,load:c,loaded:"eager"===u,loading:l,async:"async"===u,deps:[]};if("lazy"===u){var v,{trigger:h}=e.resolve;h&&kr.includes(h)&&(null===(v=o.rendererContext)||void 0===v||v.registerArbitraryLifeCycle(h,(()=>{o.updateValue(e.name,void 0,"load")})))}if(e.onChange&&f.eventTarget.addEventListener(o.changeEventType,nr(e.onChange,t)),e.track){var m=(0,x.strictCollectMemberUsage)(c?e.resolve:e.value,o.type);for(var g of(!c&&(f.deps=[...m]),m))o.onChange(g,o.batchAddListener((()=>{c?o.updateValue(e.name,{cache:"default"},"refresh"):o.updateValue(e.name,ut(e.value,t),"replace")}),e))}if(o.data.has(e.name))throw new Error("".concat(o.type," '").concat(e.name,"' has already been declared"));if(o.data.set(e.name,f),Array.isArray(n))for(var y of n){var b=o.routeMap.get(y);b?b.add(e.name):o.routeMap.set(y,new Set([e.name]))}return!0}))()}disposeDataInRoutes(e){for(var t of e){var r=this.routeMap.get(t);if(void 0!==r)for(var n of r)this.data.delete(n)}}batchAddListener(e,t){return r=>{this.batchUpdate&&this.batchUpdateContextsNames.includes(t.name)||e(r)}}}function Zr(e,t,r){var n,a,{reversedProxies:i,asyncHostPropertyEntries:o,externalSlots:s,tplStateStoreId:c,hostBrick:l}=e;if(t&&i){var u=i.properties.get(t);u&&(a=o,n=u.map((e=>{var{from:t,to:r}=e,n=a.filter((e=>e[0]===t));if(n.length>0&&r.refProperty)return[r.refProperty,wt(n,t),!0]})).filter(Boolean));var d=i.slots.get(t);if(d&&s){var f=new Map;for(var{from:v,to:h}of d){var g,y,b,w,S=null!==(g=null===(y=s[v])||void 0===y?void 0:y.bricks)&&void 0!==g?g:[];if(S.length){var E=null!==(b=h.refSlot)&&void 0!==b?b:v,k=f.get(E);if(!k){k=[];for(var A=(0,p.hasOwnProperty)(r,E)?r[E].bricks.length+1:1,Z=0;Z<A;Z+=1)k.push([]);f.set(E,k)}var P=null!==(w=h.refPosition)&&void 0!==w?w:-1;k[(0,m.clamp)(P<0?k.length+P:P,0,k.length-1)].push(...(0,p.hasOwnProperty)(l.runtimeContext,"forEachItem")?Pr(S,l.runtimeContext.forEachItem):S)}}var I=function(){(0,p.hasOwnProperty)(r,O)||(r[O]={type:"bricks",bricks:[]});var e=r[O];e.bricks=C.flatMap(((t,r)=>r<e.bricks.length?t.concat(e.bricks[r]):t)),0===e.bricks.length&&delete r[O]};for(var[O,C]of f.entries())I()}}return{[Mt]:n,[_t]:c}}function Pr(e,t){return e.map((e=>{var r;return(0,a.Z)((0,a.Z)({},e),{},{[Lt]:t,slots:Object.fromEntries(Object.entries(null!==(r=e.slots)&&void 0!==r?r:{}).map((e=>{var r,[n,a]=e;return[n,"routes"===a.type?{type:"routes",routes:Ir(a.routes,t)}:{type:"bricks",bricks:Pr(null!==(r=a.bricks)&&void 0!==r?r:[],t)}]})))})}))}function Ir(e,t){return e.map((e=>e.type&&"bricks"!==e.type?e:(0,a.Z)((0,a.Z)({},e),{},{bricks:Pr(e.bricks,t)})))}var Or=["properties","slots","children"];function Cr(e,t){function r(e){return(0,p.isObject)(e)&&"function"!=typeof e?Array.isArray(e)?e.map(r):Object.fromEntries(Object.entries(e).map((e=>{var[t,a]=e;return(0,p.isObject)(a)&&"useBrick"===t?Array.isArray(a)?[t,a.map(n)]:[t,n(a)]:[t,r(a)]})).concat(Object.getOwnPropertySymbols(e).map((t=>[t,e[t]])))):e}function n(e){var{properties:i,slots:o,children:s}=e,c=(0,h.Z)(e,Or),l=rn(s,o),u=Object.fromEntries(Object.entries(null!=l?l:{}).map((e=>{var t,[r,a]=e;return[r,{type:"bricks",bricks:(null!==(t=a.bricks)&&void 0!==t?t:[]).map(n)}]})));return(0,a.Z)((0,a.Z)({},c),{},{properties:r(i),slots:u},Zr(t,c.ref,u))}return r(e)}var xr=["slots","children"],Tr=["properties","slots","children"];function Rr(e,t,r,n,i){var o,s=(0,m.uniqueId)("tpl-state-"),c=(0,a.Z)((0,a.Z)({},r.runtimeContext),{},{tplStateStoreId:s});delete c.forEachItem,delete c.formStateStoreId;var l=new Ar("STATE",r,i);c.tplStateStoreMap.set(s,l),c.tplStateStoreScope&&c.tplStateStoreScope.push(l);var{bricks:u,proxy:p,state:d,contracts:f}=xe.get(e);null==pa||null===(o=pa.flowApi)||void 0===o||o.collectWidgetContract(f),l.define(d,c,n);var{slots:v,children:g}=t,y=(0,h.Z)(t,xr),b=(0,a.Z)((0,a.Z)({},y),{},{brick:e});r.tplHostMetadata={internalBricksByRef:new Map,tplStateStoreId:s,proxy:p};var w={properties:new Map,slots:new Map};if(null!=p&&p.properties)for(var[S,E]of Object.entries(p.properties)){var k=w.properties.get(E.ref);k||(k=[],w.properties.set(E.ref,k)),k.push({from:S,to:E})}if(null!=p&&p.slots)for(var[A,Z]of Object.entries(p.slots)){var P=w.slots.get(Z.ref);P||(P=[],w.slots.set(Z.ref,P)),P.push({from:A,to:Z})}var I={reversedProxies:w,asyncHostPropertyEntries:n,externalSlots:rn(g,v),tplStateStoreId:s,hostBrick:r};return b.slots={"":{type:"bricks",bricks:u.map((e=>Br(e,I)))}},b}function Br(e,t){null===e.if&&delete e.if;var{properties:r,slots:n,children:i}=e,o=(0,h.Z)(e,Tr),s=rn(i,n),c=Object.fromEntries(Object.entries(null!=s?s:{}).map((e=>{var r,[n,a]=e;return[n,{type:"bricks",bricks:(null!==(r=a.bricks)&&void 0!==r?r:[]).map((e=>Br(e,t)))}]})));return(0,a.Z)((0,a.Z)({},o),{},{properties:Cr(r,t),slots:c},Zr(t,o.ref,c))}var Mr=function(e){return e[e.ROOT=1]="ROOT",e[e.BRICK=2]="BRICK",e}({}),_r="form-renderer.form-renderer",Lr=Symbol.for("form.stateStoreId"),Fr=["forms.general-form","form.general-form","eo-form"];function Ur(e,t,r){var{id:n,bricks:i,events:o,context:s,mountPoint:c,instanceId:l}=e,{brick:u,properties:d}=e,f=t.find((e=>e.fieldId===n));if(f){var v=function(e){var t,r={id:e.fieldId,name:e.fieldId,label:e.name,dataset:{testid:e.fieldId}},n=()=>{var t,r;return{readOnly:null===(t=e.limit)||void 0===t?void 0:t.includes("READONLY"),required:null===(r=e.limit)||void 0===r?void 0:r.includes("REQUIRED")}};switch(e.fieldType){case"INT":t={brick:"forms.general-input-number",properties:(0,a.Z)((0,a.Z)((0,a.Z)({},r),n()),{},{placeholder:e.description,precision:0,inputBoxStyle:{width:"100%"}})};break;case"BOOLEAN":t={brick:"forms.general-switch",properties:(0,a.Z)((0,a.Z)({},r),n())};break;case"FLOAT":t={brick:"forms.general-input-number",properties:(0,a.Z)((0,a.Z)((0,a.Z)({},r),n()),{},{placeholder:e.description,inputBoxStyle:{width:"100%"}})};break;case"ENUM":t={brick:"forms.general-select",properties:(0,a.Z)((0,a.Z)((0,a.Z)({},r),n()),{},{options:[{label:"选项一",value:1},{label:"选项二",value:2}],placeholder:e.description,inputBoxStyle:{width:"100%"}})};break;case"ENUMS":t={brick:"forms.general-select",properties:(0,a.Z)((0,a.Z)((0,a.Z)({},r),n()),{},{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:(0,a.Z)((0,a.Z)((0,a.Z)({},r),n()),{},{placeholder:e.description})};break;case"IP":t={brick:"forms.general-input",properties:(0,a.Z)((0,a.Z)((0,a.Z)({},r),n()),{},{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:(0,a.Z)({},r)};break;case"ARRAY":t={brick:"forms.general-select",properties:(0,a.Z)({},r)};break;case"STRUCTURE":case"STRUCTURE_ARRAY":t={brick:"forms.cmdb-instance-select-panel",properties:(0,a.Z)((0,a.Z)({},r),n())};break;default:t={brick:"forms.general-input",properties:(0,a.Z)((0,a.Z)((0,a.Z)({},r),n()),{},{placeholder:e.description})}}return t}(f);u||(u=v.brick),d=(0,a.Z)((0,a.Z)({},v.properties),d)}var h={brick:u,properties:d,iid:l,slot:c,events:o,context:s,children:Nr(i,t,r),[Lr]:r};return(0,p.hasOwnProperty)(e,"if")&&(h.if=e.if),h}function Nr(e,t,r){if(Array.isArray(e))return e.map((e=>Ur(e,t,r)))}var jr=["blockingList","node","menuRequests","hasTrackingControls"],Dr=["if","permissionsPreCheck"],Vr=["formData"],Wr=["src"],$r=["href"];function qr(e,t,r,n,a,i,o){return Hr.apply(this,arguments)}function Hr(){return Hr=(0,i.Z)((function*(e,t,r,n,i,o,s){var c=yield function(e,t){return Tt.apply(this,arguments)}(t,r),l={blockingList:[],menuRequests:[]};switch(c){case"missed":break;case"unauthenticated":l.unauthenticated=!0;break;default:var p,d=l.route=c.route,f=(0,a.Z)((0,a.Z)({},r),{},{match:c.match});s&&f.ctxStore.disposeDataInRoutes(t);var v=i.concat(d);f.ctxStore.define(d.context,f,void 0,v),f.pendingPermissionsPreCheck.push(null==pa||null===(p=pa.checkPermissions)||void 0===p?void 0:p.preCheckPermissionsForBrickOrRoute(d,(e=>ct(e,f))));var{preLoadBricks:h}=d;if(Array.isArray(h)&&l.blockingList.push((0,u.loadBricksImperatively)(h,ya())),"redirect"===d.type){var m;if("string"!=typeof(m="string"==typeof d.redirect?yield ct(d.redirect,f):(yield He((0,a.Z)({transform:"redirect"},d.redirect),f)).redirect))throw console.error("Unexpected redirect result:",m),new Error("Unexpected type of redirect result: ".concat(typeof m));l.redirect={path:m}}else{var g=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 ct(e,t);console.warn("Set menu with resolve is not supported in v3 yet:",e)}}(d.menu,f);g&&l.menuRequests.push(g),"routes"===d.type?tn(l,yield qr(e,d.routes,f,n,v,o)):tn(l,yield zr(e,d.bricks,f,n,v,o)),e.tag===Mr.BRICK&&n.memoizeMenuRequests(d,l.menuRequests)}}return l})),Hr.apply(this,arguments)}function zr(e,t,r,n,a,i,o,s){return Kr.apply(this,arguments)}function Kr(){return(Kr=(0,i.Z)((function*(e,t,r,n,a,i,o,s){var c={blockingList:[],menuRequests:[]},l=null!=s?s:[];return(yield Promise.all(t.map(((t,s)=>Gr(e,t,r,n,a,i,l.concat(s),o&&new Map(o)))))).forEach(((t,r)=>{t.hasTrackingControls&&n.memoize(i,l.concat(r),t.node,e),tn(c,t)})),c}))).apply(this,arguments)}function Gr(e,t,r,n,a,i){return Jr.apply(this,arguments)}function Jr(){return Jr=(0,i.Z)((function*(e,t,r,n,o,s){var c,l,d=arguments.length>6&&void 0!==arguments[6]?arguments[6]:[],f=arguments.length>7&&void 0!==arguments[7]?arguments[7]:new Map,v={blockingList:[],menuRequests:[]};if(!t.brick)return t.template?console.error("Legacy templates are dropped in v3:",t):console.error("Invalid brick:",t),v;var{if:g,permissionsPreCheck:b}=t,w=(0,h.Z)(t,Dr);if(function(e){return"string"==typeof e?(0,C.isTrackAll)(e):Xe(e)&&(0,C.isTrackAll)(Qe(e))}(g))return Gr(e,(0,a.Z)({brick:":if",dataSource:g,permissionsPreCheck:b,slots:{"":{type:"bricks",bricks:[w]}}},Object.getOwnPropertySymbols(t).reduce(((e,r)=>(0,a.Z)((0,a.Z)({},e),{},{[r]:t[r]})),{})),r,n,o,s,d,f);var S=t[_t],E=t[Lr],k=(0,a.Z)((0,a.Z)({},r),{},{tplStateStoreId:S,formStateStoreId:E});(0,p.hasOwnProperty)(t,Lt)&&(k.forEachItem=t[Lt]);var{context:A}=t;if(Array.isArray(A)&&A.length>0){var Z=Pe(k);Ie(Z,"Defining context on bricks","check your brick:",t),Z||k.ctxStore.define(A,k)}if(k.pendingPermissionsPreCheck.push(null==pa||null===(c=pa.checkPermissions)||void 0===c?void 0:c.preCheckPermissionsForBrickOrRoute(t,(e=>ct(e,k)))),!(yield function(e,t){return gt.apply(this,arguments)}(t,k)))return v;var P=t.brick;if(P.startsWith(":")){!function(e){if(":forEach"!==e&&":if"!==e&&":switch"!==e)throw new Error('Unknown storyboard control node: "'.concat(e,'"'))}(P);var{dataSource:I}=t,O=function(){var r=(0,i.Z)((function*(r){var a,i=yield ct(I,r),c=":forEach"===P?"":":switch"===P?String(i):i?"":"else",l=rn(t.children,t.slots),u=l&&(0,p.hasOwnProperty)(l,c)&&(null===(a=l[c])||void 0===a?void 0:a.bricks);if(!Array.isArray(u))return v;switch(P){case":forEach":return Array.isArray(i)?function(e,t,r,n,a,i,o,s,c){return Yr.apply(this,arguments)}(e,i,u,r,n,o,s,f,d):v;case":if":case":switch":return zr(e,u,r,n,o,s,f,d)}}));return function(e){return r.apply(this,arguments)}}(),T=yield O(k),{contextNames:R,stateNames:B}=bt(I);if(R||B){T.hasTrackingControls=!0;var M=0,_=function(){var t=(0,i.Z)((function*(){var t=++M,[r,a,i]=en(k),o=yield O(r),c=[...a,...i];if(yield Qr(o,r,c),M===t)for(var l of(n.reRender(s,d,o.node,e),c))l.mountAsyncData()}));return function(){return t.apply(this,arguments)}}(),L=(0,m.debounce)(_);if(R)for(var F of R)k.ctxStore.onChange(F,L);if(B)for(var U of B)Te(k,"STATE",': "'.concat(I,'"')).onChange(U,L)}return T}/\.tpl-/.test(P)&&!xe.get(P)&&(yield nn((0,u.loadBricksImperatively)([P],ya()),"brick",P,n.unknownBricks));var N,j,D=function(e,t){if(!e.includes(".")&&e.startsWith("tpl-")&&t){var r="".concat(t,".").concat(e);if(xe.get(r))return r}return!!xe.get(e)&&e}(P,null===(l=k.app)||void 0===l?void 0:l.id);if(D){var V,W=null!==(V=f.get(D))&&void 0!==V?V:0;if(W>=10)throw new Error('Maximum custom template stack overflowed: "'.concat(D,'"'));f.set(D,W+1)}else P.includes("-")&&!customElements.get(P)&&(P===_r?customElements.define(_r,class extends HTMLElement{get $$typeof(){return"form-renderer"}}):v.blockingList.push(nn((0,u.enqueueStableLoadBricks)([P],ya()),"brick",P,n.unknownBricks)));if(P===_r){var $,q=null!==($=t.properties)&&void 0!==$?$:{};({formData:N}=q),j=(0,h.Z)(q,Vr)}else j=t.properties;var H=[],z=function(e,t,r){return(0,p.isObject)(e)?Object.entries(e).map((e=>{var[n,a]=e,{contextNames:i,stateNames:o,formStateNames:s}=bt(a);return(i||o||s)&&r.push({contextNames:i,stateNames:o,formStateNames:s,propName:n,propValue:a}),[n,ct(a,t,{$$lazyForUseBrick:!0,$$stateOfUseBrick:"useBrick"===n?it.USE_BRICK:it.INITIAL})]})):[]}(j,k,H),K=t[Mt];K&&z.push(...K);var G="script"===P;if(G||"link"===P){var J=yield Et(z);if(G?J.src:"stylesheet"===J.rel&&J.href){var Y,X=null!==(Y=window.PUBLIC_ROOT)&&void 0!==Y?Y:"";if(G){var{src:Q}=J,ee=(0,h.Z)(J,Wr);yield nn((0,u.loadScript)(Q,X,ee),"script",Q,"silent")}else{var{href:te}=J;ee=(0,h.Z)(J,$r),yield nn((0,u.loadStyle)(te,X,ee),"stylesheet",te,"silent")}return v}}var re={tag:Mr.BRICK,type:D||P,return:e,slotId:s,events:t.events,runtimeContext:k,portal:t.portal,iid:t.iid,ref:t.ref};v.node=re;var ne=(0,x.strictCollectMemberUsage)([t.events,t.lifeCycle],"PROCESSORS",2);ne.size>0&&v.blockingList.push(nn((0,u.loadProcessorsImperatively)(ne,ya()),"processors",[...ne].join(", "),n.unknownBricks));var ae=[],ie=function(){var e=(0,i.Z)((function*(){re.properties=yield Et(z),function(e,t){var r=function(t){var r=()=>{e.element&&Zt(e.element,{[t.propName]:t.propValue},e.runtimeContext)};if(t.contextNames)for(var n of t.contextNames)e.runtimeContext.ctxStore.onChange(n,r);if(t.stateNames){var a=Te(e.runtimeContext,"STATE",': "'.concat(t.propValue,'"'));for(var i of t.stateNames)a.onChange(i,r)}if(t.formStateNames){var o=Ue(e.runtimeContext,"FORM_STATE",': "'.concat(t.propValue,'"'));for(var s of t.formStateNames)o.onChange(s,r)}};for(var n of t)r(n)}(re,H)}));return function(){return e.apply(this,arguments)}}();ae.push(ie()),n.registerBrickLifeCycle(re,t.lifeCycle);var oe,se=t;D?se=Rr(D,t,re,z,n):P===_r&&(se=function(e,t,r,n,i){var o,s,c="string"==typeof e?JSON.parse(e):e,l=(0,m.uniqueId)("form-state-"),u=(0,a.Z)((0,a.Z)({},r.runtimeContext),{},{formStateStoreId:l});delete u.forEachItem,delete u.tplStateStoreId;var d=new Ar("FORM_STATE",void 0,i);u.formStateStoreMap.set(l,d),u.formStateStoreScope&&u.formStateStoreScope.push(d);var f=null!==(o=c.context)&&void 0!==o?o:[];f.some((e=>"params"===e.name))||f.push({name:"params"}),d.define(f,u,n);var v=Ur(c.formSchema,c.fields,l);return Fr.includes(v.brick)&&t.events&&(v.events=function(e,t){var r=null!=e?e:{};for(var[n,a]of Object.entries(t))r[n]=(0,p.hasOwnProperty)(r,n)?[r[n],a].flat():a;return r}(v.events,t.events)),"boolean"!=typeof(null===(s=t.properties)||void 0===s?void 0:s.renderRoot)||t.properties.renderRoot?(0,a.Z)((0,a.Z)({},t),{},{slots:void 0,children:[{brick:"eo-micro-view",properties:{style:{padding:"12px"}},children:[v]}]}):(0,a.Z)((0,a.Z)({},t),{},{slots:void 0,children:[v]})}(N,t,re,z,n)),se.portal&&(re.slotId=void 0),D?delete(oe=(0,a.Z)({},k)).forEachItem:oe=k;var ce=function(){var e=(0,i.Z)((function*(){var e=rn(se.children,se.slots);if(e){var t=new Set,r=yield Promise.all(Object.entries(e).map(((e,r)=>{var[s,c]=e;return"routes"!==c.type?zr(re,c.bricks,oe,n,o,s,f):(k.flags["incremental-sub-route-rendering"]&&(t.add(r),n.performIncrementalRender(function(){var e=(0,i.Z)((function*(e){var{homepage:t}=oe.app,{pathname:r}=e;if(!y(t,r)||!o.every((e=>Rt(e,t,r))))return!1;var i,[l,u,p]=en((0,a.Z)((0,a.Z)({},oe),{},{location:e,query:new URLSearchParams(e.search)})),d=!1,f=[];try{if(!(i=yield qr(re,c.routes,l,n,o,s,!0)).route)return!1;if(n.reBailout(i))return!0;f=[...u,...p],yield Qr(i,l,[l.ctxStore,...f]),yield n.reMergeMenuRequests(c.routes,i.route,i.menuRequests)}catch(e){console.error("Incremental sub-router failed:",e);var v=n.reCatch(e,re);if(!v)return!0;({failed:d,output:i}=v),yield n.reMergeMenuRequests(c.routes,i.route,i.menuRequests)}if(n.reRender(s,[],i.node,re),!d)for(var h of(l.ctxStore.mountAsyncData(i.route),f))h.mountAsyncData();return!0}));return function(t){return e.apply(this,arguments)}}())),qr(re,c.routes,oe,n,o,s))}))),c=(0,a.Z)((0,a.Z)({},v),{},{node:void 0,blockingList:[],menuRequests:[]});r.forEach(((e,r)=>{t.has(r)&&n.memoize(s,[],e.node,re),tn(c,e)})),c.node&&(re.child=c.node),tn(v,(0,a.Z)((0,a.Z)({},c),{},{node:void 0}))}}));return function(){return e.apply(this,arguments)}}();return ae.push(ce()),yield Promise.all(ae),v})),Jr.apply(this,arguments)}function Yr(){return(Yr=(0,i.Z)((function*(e,t,r,n,i,o,s,c,l){var u={blockingList:[],menuRequests:[]},p=t.length;return(yield Promise.all(t.map(((t,u)=>Promise.all(r.map(((r,d)=>Gr(e,r,(0,a.Z)((0,a.Z)({},n),{},{forEachItem:t}),i,o,s,l.concat(u*p+d),c&&new Map(c))))))))).flat().forEach(((t,r)=>{t.hasTrackingControls&&i.memoize(s,l.concat(r),t.node,e),tn(u,t)})),u}))).apply(this,arguments)}function Xr(e){return[e.ctxStore,...e.tplStateStoreMap.values(),...e.formStateStoreMap.values()]}function Qr(e,t,r){return(0,u.flushStableLoadBricks)(),Promise.all([...e.blockingList,...r.map((e=>e.waitForAll())),...t.pendingPermissionsPreCheck])}function en(e){var t=[],r=[];return[(0,a.Z)((0,a.Z)({},e),{},{tplStateStoreScope:t,formStateStoreScope:r}),t,r]}function tn(e,t){var{blockingList:r,node:n,menuRequests:a,hasTrackingControls:i}=t,o=(0,h.Z)(t,jr);if(e.blockingList.push(...r),e.menuRequests.push(...a),n)if(e.node){for(var s=e.node;s.sibling;)s=s.sibling;s.sibling=n}else e.node=n;Object.assign(e,o)}function rn(e,t){var r=t;if(Array.isArray(e)&&!r)for(var n of(r={},e)){var a,i=null!==(a=n.slot)&&void 0!==a?a:"";(0,p.hasOwnProperty)(r,i)||(r[i]={type:"bricks",bricks:[]}),r[i].bricks.push(n)}return r}function nn(e,t,r,n){return"silent"===n?e.catch((e=>{console.error("Load ".concat(t,' "').concat(r,'" failed:'),e)})):e}function an(e){var t,{ref:r,runtimeContext:n,element:a}=e;if(r&&n.tplStateStoreId){var{hostBrick:i}=Te(n,"bindTemplateProxy"),o=i.tplHostMetadata;o.internalBricksByRef.set(r,e);var s=null===(t=o.proxy)||void 0===t?void 0:t.events;if(s){var c=function(e){if(u.ref===r){var t,n,o,s=t=>{t.bubbles&&t.stopPropagation(),i.element.dispatchEvent(new CustomEvent(e,{detail:t.detail,bubbles:t.bubbles,cancelable:t.cancelable,composed:t.composed}))},c=null!==(t=u.refEvent)&&void 0!==t?t:e;a.addEventListener(c,s),null!==(o=(n=a).$$proxyListeners)&&void 0!==o||(n.$$proxyListeners=[]),a.$$proxyListeners.push([c,s])}};for(var[l,u]of Object.entries(s))c(l)}}}function on(e){var{ref:t,runtimeContext:r,element:n}=e;if(null!=r&&r.tplStateStoreId&&t){var{hostBrick:a}=Te(r,"unbindTemplateProxy"),i=a.tplHostMetadata;for(var[o,s]of(i.internalBricksByRef.delete(t),null!==(c=n.$$proxyListeners)&&void 0!==c?c:[])){var c;n.removeEventListener(o,s)}delete n.$$proxyListeners}}function sn(e){e.replaceChildren()}function cn(e,t){for(var r=e.child,n=[];r;){var a,i=r.type;i.includes("-")&&!customElements.get(i)&&console.error("Undefined custom element: ".concat(i)),"basic-bricks.script-brick"===i&&console.warn("`basic-bricks.script-brick` is deprecated, please take caution when using it");var o=t&&r===e.child?t:document.createElement(i);if(r.element=o,r.slotId&&o.setAttribute("slot",r.slotId),r.iid&&(o.dataset.iid=r.iid),null!==(a=r.tplHostMetadata)&&void 0!==a&&a.tplStateStoreId&&(o.dataset.tplStateStoreId=r.tplHostMetadata.tplStateStoreId),At(o,r.properties),Xt(o,r.events,r.runtimeContext),r.tplHostMetadata&&(o.$$tplStateStore=Te({tplStateStoreId:r.tplHostMetadata.tplStateStoreId,tplStateStoreMap:r.runtimeContext.tplStateStoreMap},"mount")),an(r),r.portal?n.push(o):r.return&&(r.return.childElements||(r.return.childElements=[]),r.return.childElements.push(o)),r.child)r=r.child;else if(r.sibling)r=r.sibling;else{for(var s,c=r.return;c;){var l;if(c.childElements)c.tag===Mr.ROOT?null===(l=c.container)||void 0===l||l.append(...c.childElements):c.element.append(...c.childElements),c.childElements=void 0;if(c.tag===Mr.ROOT&&n.length>0&&("function"==typeof c.createPortal?c.createPortal():c.createPortal).append(...n),c.sibling)break;c=c.return}r=null===(s=c)||void 0===s?void 0:s.sibling}}}var ln,un,pn=["onMount","onUnmount","onMediaChange","onScrollIntoView","onMessage","onMessageClose"],dn=["onBeforePageLoad","onPageLoad","onPageLeave","onBeforePageLeave","onAnchorLoad","onAnchorUnload"],fn=new WeakMap,vn=new WeakMap,hn=new WeakMap,mn=new WeakMap,gn=new WeakMap,yn=new WeakMap,bn=new WeakMap,wn=new WeakMap,Sn=new WeakMap,En=new WeakSet,kn=new WeakSet,An=new WeakSet,Zn=new WeakSet;class Pn{constructor(e,t){var r;(0,P.Z)(this,Zn),(0,P.Z)(this,An),(0,P.Z)(this,kn),(0,P.Z)(this,En),(0,Ft.Z)(this,"scope",void 0),(0,Ft.Z)(this,"unknownBricks",void 0),(0,o.Z)(this,fn,{writable:!0,value:void 0}),(0,o.Z)(this,vn,{writable:!0,value:{onBeforePageLoad:[],onPageLoad:[],onPageLeave:[],onBeforePageLeave:[],onAnchorLoad:[],onAnchorUnload:[],onMediaChange:[],onScrollIntoView:[],onMount:[],onUnmount:[],onMessage:[],onMessageClose:[]}}),(0,o.Z)(this,hn,{writable:!0,value:new Map}),(0,o.Z)(this,mn,{writable:!0,value:void 0}),(0,o.Z)(this,gn,{writable:!0,value:new Map}),(0,o.Z)(this,yn,{writable:!0,value:void 0}),(0,o.Z)(this,bn,{writable:!0,value:void 0}),(0,o.Z)(this,wn,{writable:!0,value:void 0}),(0,o.Z)(this,Sn,{writable:!0,value:[]}),this.scope=e,this.unknownBricks=null!==(r=null==t?void 0:t.unknownBricks)&&void 0!==r?r:"throw",(0,s.Z)(this,fn,null==t?void 0:t.routeHelper)}setInitialMenuRequests(e){(0,s.Z)(this,bn,e)}memoizeMenuRequests(e,t){(0,c.Z)(this,wn)||(0,s.Z)(this,wn,new WeakMap),(0,c.Z)(this,wn).set(e,t[0])}reMergeMenuRequests(e,t,r){var n=this;return(0,i.Z)((function*(){var a,i;for(var o of e)if(a=(0,c.Z)(n,wn).get(o)){i=o;break}var s=(0,c.Z)(n,bn),l=a?s.indexOf(a):-1;if(-1===l){if(!r.length)return;s.push(...r)}else s.splice(l,s.length-l,...r);i&&i!==t&&(0,c.Z)(n,wn).delete(i),yield(0,c.Z)(n,fn).mergeMenus(s)}))()}reBailout(e){return(0,c.Z)(this,fn).bailout(e)}reCatch(e,t){return(0,c.Z)(this,fn).catch(e,t)}didPerformIncrementalRender(e){var t=this;return(0,i.Z)((function*(){return(yield Promise.all((0,c.Z)(t,Sn).map((t=>t(e))))).some((e=>e))}))()}performIncrementalRender(e){(0,c.Z)(this,Sn).push(e)}registerBrickLifeCycle(e,t){if(t){var r=[...pn,..."page"===this.scope?dn:[]];for(var n of r){var a=t[n];a&&(0,c.Z)(this,vn)[n].push({brick:e,handlers:a})}(0,m.isEmpty)(t.useResolves)||console.error("`lifeCycle.useResolves` is dropped in v3:",t)}}registerArbitraryLifeCycle(e,t){var r=(0,c.Z)(this,gn).get(e);r?r.add(t):(0,c.Z)(this,gn).set(e,new Set([t]))}memoize(e,t,r,n){(0,c.Z)(this,yn)||(0,s.Z)(this,yn,new WeakMap);var a=[null!=e?e:"",...t].join("."),i=(0,c.Z)(this,yn).get(n);i||(i=new Map,(0,c.Z)(this,yn).set(n,i)),i.set(a,{node:r,last:Tn(r),lastNormal:Rn(r),lastPortal:Bn(r)})}reRender(e,t,r,n){var a,i,o,s,l,u=[null!=e?e:"",...t].join("."),p=(0,c.Z)(this,yn).get(n).get(u),{node:d,last:f,lastNormal:v,lastPortal:h}=p,m=null!==(a=null==v||null===(i=v.element)||void 0===i?void 0:i.nextSibling)&&void 0!==a?a:null,g=null!==(o=null==h||null===(s=h.element)||void 0===s?void 0:s.nextSibling)&&void 0!==o?o:null,y=Tn(r);p.node=r,p.last=y,p.lastNormal=Rn(r),p.lastPortal=Bn(r);for(var b=n.child;b&&b!==f;){if(b.sibling===d){l=b;break}b=b.sibling}var w=document.createDocumentFragment(),S=document.createDocumentFragment(),E={tag:Mr.ROOT,container:w,createPortal:S,child:r};for(b=r;b;)b.return=E,b=b.sibling;var k,A,Z=Mn(d,f);for((0,I.Z)(this,En,In).call(this,Z),cn(E),l?l.sibling=r:n.child=r,y&&(y.sibling=null==f?void 0:f.sibling),b=r;b;)b.return=n,b=b.sibling;if(n.tag===Mr.ROOT?null===(k=n.container)||void 0===k||k.insertBefore(w,m):null===(A=n.element)||void 0===A||A.insertBefore(w,m),S.childNodes.length>0){for(var P,O=r;O&&O.return;)O=O.return;if((null===(P=O)||void 0===P?void 0:P.tag)!==Mr.ROOT)throw new Error("Cannot find render root node");("function"==typeof O.createPortal?O.createPortal():O.createPortal).insertBefore(S,g)}var C=Mn(r,y);(0,I.Z)(this,kn,On).call(this,C)}dispose(){for(var e of Object.values((0,c.Z)(this,vn)))e.length=0;for(var t of(0,c.Z)(this,hn).values()){for(var r of t)r.disconnect();t.length=0}(0,c.Z)(this,hn).clear(),(0,c.Z)(this,mn)&&(we.removeEventListener("change",(0,c.Z)(this,mn)),(0,s.Z)(this,mn,void 0)),(0,s.Z)(this,yn,void 0),(0,s.Z)(this,bn,void 0),(0,s.Z)(this,wn,void 0),(0,c.Z)(this,gn).clear(),(0,c.Z)(this,Sn).length=0}dispatchBeforePageLoad(){(0,I.Z)(this,An,Cn).call(this,"onBeforePageLoad",new CustomEvent("page.beforeLoad"))}dispatchPageLoad(){var e=new CustomEvent("page.load");(0,I.Z)(this,An,Cn).call(this,"onPageLoad",e),window.dispatchEvent(e)}dispatchBeforePageLeave(e){(0,I.Z)(this,An,Cn).call(this,"onBeforePageLeave",new CustomEvent("page.beforeLeave",{detail:e}))}dispatchPageLeave(){(0,I.Z)(this,An,Cn).call(this,"onPageLeave",new CustomEvent("page.leave"))}dispatchAnchorLoad(){var{hash:e}=Z().location;e&&"#"!==e?(0,I.Z)(this,An,Cn).call(this,"onAnchorLoad",new CustomEvent("anchor.load",{detail:{hash:e,anchor:e.substring(1)}})):(0,I.Z)(this,An,Cn).call(this,"onAnchorUnload",new CustomEvent("anchor.unload"))}initializeScrollIntoView(){for(var{brick:e,handlers:t}of(0,c.Z)(this,vn).onScrollIntoView)(0,I.Z)(this,Zn,xn).call(this,e,t)}initializeMediaChange(){(0,s.Z)(this,mn,(e=>{(0,I.Z)(this,An,Cn).call(this,"onMediaChange",new CustomEvent("media.change",{detail:z(e.detail)}))})),we.addEventListener("change",(0,c.Z)(this,mn))}initializeMessageDispatcher(){var e,t=function(e){var t=function(t){var r;null==pa||null===(r=pa.messageDispatcher)||void 0===r||r.onMessage(t.channel,(r=>{nr(t.handlers,e.runtimeContext,e)(new CustomEvent("message.push",{detail:r}))}))};for(var r of[].concat(n))t(r)};for(var{brick:r,handlers:n}of(0,c.Z)(this,vn).onMessage)t(r);null==pa||null===(e=pa.messageDispatcher)||void 0===e||e.onClose((()=>{(0,I.Z)(this,An,Cn).call(this,"onMessageClose",new CustomEvent("message.close"))}))}dispatchOnMount(){(0,I.Z)(this,An,Cn).call(this,"onMount",new CustomEvent("mount"))}dispatchOnUnmount(){(0,I.Z)(this,An,Cn).call(this,"onUnmount",new CustomEvent("unmount"))}}function In(e){var t=[...pn,..."page"===this.scope?dn:[]],r=[];for(var n of t){var a=(0,m.remove)((0,c.Z)(this,vn)[n],(t=>e.has(t.brick)));"onUnmount"===n&&r.push(...a)}for(var i of e){var o,s,l=(0,c.Z)(this,hn).get(i);if(null!=l&&l.length){for(var u of l)u.disconnect();l.length=0,(0,c.Z)(this,hn).delete(i)}on(i),null===(o=i.element)||void 0===o||delete o.$$tplStateStore,null===(s=i.element)||void 0===s||s.remove()}var p=new CustomEvent("unmount");for(var{brick:d,handlers:f}of r)nr(f,d.runtimeContext,d)(p)}function On(e){var t=new CustomEvent("mount");for(var{brick:r,handlers:n}of(0,c.Z)(this,vn).onMount)e.has(r)&&nr(n,r.runtimeContext,r)(t);for(var{brick:a,handlers:i}of(0,c.Z)(this,vn).onScrollIntoView)e.has(a)&&(0,I.Z)(this,Zn,xn).call(this,a,i)}function Cn(e,t){for(var{brick:r,handlers:n}of(0,c.Z)(this,vn)[e])nr(n,r.runtimeContext,r)(t);var a=(0,c.Z)(this,gn).get(e);if(a)for(var i of a)i()}function xn(e,t){var r,n=null!==(r=t.threshold)&&void 0!==r?r:.1,a=new IntersectionObserver(((r,a)=>{r.forEach((r=>{r.isIntersecting&&r.intersectionRatio>=n&&(nr(t.handlers,e.runtimeContext,e)(new CustomEvent("scroll.into.view")),a.disconnect())}))}),{threshold:n});a.observe(e.element);var i=(0,c.Z)(this,hn).get(e);i||(i=[],(0,c.Z)(this,hn).set(e,i)),i.push(a)}function Tn(e){for(var t=e;null!==(r=t)&&void 0!==r&&r.sibling;){var r;t=t.sibling}return t}function Rn(e){for(var t,r=e;r;)r.portal||(t=r),r=r.sibling;return t}function Bn(e){for(var t,r=e;r;)if(r.portal&&(t=r),r.child)r=r.child;else if(r.sibling)r=r.sibling;else{for(var n,a=r.return;a&&!a.sibling;)a=a.return;r=null===(n=a)||void 0===n?void 0:n.sibling}return t}function Mn(e,t){for(var r=new Set,n=e;n;)if(r.add(n),n.child)n=n.child;else{if(n===t)break;if(n.sibling)n=n.sibling;else{for(var a,i=n.return;i&&i!==t&&!i.sibling;)i=i.return;if(i===t)break;n=null===(a=i)||void 0===a?void 0:a.sibling}}return r}function _n(){if(!ln){if(ln={isInIframe:!1,isInIframeOfSameSite:!1,isInIframeOfNext:!1,isInIframeOfVisualBuilder:!1,isInIframeOfLegacyConsole:!1},window!==window.parent){ln.isInIframe=!0;try{if(window.origin===window.parent.origin){ln.isInIframeOfSameSite=!0;var e="/next/"===v(),t=window.parent.location.pathname,r=t.startsWith("/next/");ln.isInIframeOfNext=0==(Number(e)^Number(r)),ln.isInIframeOfVisualBuilder=t.startsWith("".concat(r?"/next":"","/visual-builder/")),ln.isInIframeOfLegacyConsole=e&&!r}}catch(e){}}Object.freeze(ln)}return ln}function Ln(e){var t;if(!e.$$registerCustomTemplateProcessed){e.$$registerCustomTemplateProcessed=!0;var r=null===(t=e.meta)||void 0===t?void 0:t.customTemplates;if(Array.isArray(r))for(var n of r){var a=n.name.includes(".")?n.name:"".concat(e.app.id,".").concat(n.name);xe.define(a,n)}}}function Fn(){return Fn=(0,i.Z)((function*(e){if(!e.$$fulfilled)return e.$$fulfilling||(e.$$fulfilling=function(e){return Un.apply(this,arguments)}(e)),e.$$fulfilling})),Fn.apply(this,arguments)}function Un(){return(Un=(0,i.Z)((function*(e){var t;yield null==pa||null===(t=pa.fulfilStoryboard)||void 0===t?void 0:t.call(pa,e),_(e),Object.assign(e,{$$fulfilled:!0,$$fulfilling:null})}))).apply(this,arguments)}var Nn=new WeakMap,jn=new WeakMap,Dn=new WeakMap,Vn=new WeakMap,Wn=new WeakMap,$n=new WeakMap,qn=new WeakMap,Hn=new WeakMap,zn=new WeakMap,Kn=new WeakMap,Gn=new WeakMap,Jn=new WeakMap,Yn=new WeakSet,Xn=new WeakSet,Qn=new WeakSet,ea=new WeakSet;class ta{constructor(e){(0,P.Z)(this,ea),(0,P.Z)(this,Qn),(0,P.Z)(this,Xn),(0,P.Z)(this,Yn),(0,o.Z)(this,Nn,{writable:!0,value:void 0}),(0,o.Z)(this,jn,{writable:!0,value:!1}),(0,o.Z)(this,Dn,{writable:!0,value:void 0}),(0,o.Z)(this,Vn,{writable:!0,value:void 0}),(0,o.Z)(this,Wn,{writable:!0,value:void 0}),(0,o.Z)(this,$n,{writable:!0,value:void 0}),(0,o.Z)(this,qn,{writable:!0,value:new Set}),(0,o.Z)(this,Hn,{writable:!0,value:0}),(0,o.Z)(this,zn,{writable:!0,value:void 0}),(0,o.Z)(this,Kn,{writable:!0,value:void 0}),(0,o.Z)(this,Gn,{writable:!0,value:void 0}),(0,o.Z)(this,Jn,{writable:!0,value:void 0}),(0,s.Z)(this,Nn,e);var t=Z();window.addEventListener("beforeunload",(e=>{(0,I.Z)(this,Yn,ra).call(this,{})?(e.preventDefault(),e.returnValue=""):delete e.returnValue})),t.block(((e,t)=>(0,I.Z)(this,Yn,ra).call(this,{location:e,action:t})))}getRenderId(){return(0,c.Z)(this,zn)}getRuntimeContext(){return(0,c.Z)(this,Wn)}getRecentApps(){return{currentApp:(0,c.Z)(this,Kn),previousApp:(0,c.Z)(this,Gn)}}getNavConfig(){return(0,c.Z)(this,Jn)}bootstrap(){var e=this;window.AbortController&&(un=new AbortController,O.http.interceptors.request.use((e=>{var t;return(0,a.Z)((0,a.Z)({},e),{},{options:(0,a.Z)((0,a.Z)({},e.options),{},{signal:null!==(t=e.options)&&void 0!==t&&t.noAbortOnRouteChange?null:un.signal})})})));var t=Z();(0,s.Z)(this,Dn,t.location);var r=0;return t.listen(function(){var t=(0,i.Z)((function*(t,n){var i,o,l,u,p,d=++r,v={hash:void 0,state:void 0};if(void 0!==t.key&&("POP"!==n||void 0!==(0,c.Z)(e,Dn).key&&!1!==(null===(i=(0,c.Z)(e,Dn).state)||void 0===i?void 0:i.notify))||(v.key=void 0),((0,f.locationsAreEqual)((0,a.Z)((0,a.Z)({},(0,c.Z)(e,Dn)),v),(0,a.Z)((0,a.Z)({},t),v))||"POP"!==n&&!1===(null===(o=t.state)||void 0===o?void 0:o.notify))&&(u=!0),u||(u=yield null===(p=(0,c.Z)(e,$n))||void 0===p?void 0:p.didPerformIncrementalRender(t)),r===d)if(u)(0,s.Z)(e,Dn,t);else{if(un&&(un.abort(),un=new AbortController),(0,s.Z)(e,Dn,t),null===(l=(0,c.Z)(e,$n))||void 0===l||l.dispatchPageLeave(),"POP"===n&&b(g((0,c.Z)(e,Nn),t.pathname)))return void window.location.reload();(0,c.Z)(e,jn)?(0,s.Z)(e,Vn,t):(0,I.Z)(e,Qn,aa).call(e,t).catch(Jt)}}));return function(e,r){return t.apply(this,arguments)}}()),(0,I.Z)(this,Qn,aa).call(this,t.location)}}function ra(e){var t,r=Z(),n=r.getBlockMessage();null===(t=(0,c.Z)(this,$n))||void 0===t||t.dispatchBeforePageLeave(e);var a=r.getBlockMessage();return!n&&a&&r.unblock(),a}function na(e,t,r){var n,a;if((0,s.Z)(this,Hn,(n=(0,c.Z)(this,Hn),a=n++,n)),a>10){var i='Infinite redirect detected: from "'.concat(r.pathname).concat(r.search).concat(r.hash,'" to "').concat(e,'"');throw new Error(i)}Z().replace(e,t)}function aa(e){return ia.apply(this,arguments)}function ia(){return(ia=(0,i.Z)((function*(e){(0,s.Z)(this,jn,!0);try{yield(0,I.Z)(this,ea,oa).call(this,e)}finally{if((0,s.Z)(this,jn,!1),(0,c.Z)(this,Vn)){var t=(0,c.Z)(this,Vn);(0,s.Z)(this,Vn,void 0),yield(0,I.Z)(this,Qn,aa).call(this,t)}}}))).apply(this,arguments)}function oa(e){return sa.apply(this,arguments)}function sa(){return sa=(0,i.Z)((function*(e){var t,r,n=this;(0,s.Z)(this,zn,(0,m.uniqueId)("render-id-1")),Ve=new WeakSet,qe.clear(),null==pa||null===(t=pa.flowApi)||void 0===t||t.clearCollectWidgetContract(),Z().unblock();var o=performance.now(),l=g((0,c.Z)(this,Nn),e.pathname),u=null===(r=(0,c.Z)(this,Wn))||void 0===r?void 0:r.app;null!=l&&l.app&&(yield function(e){return Fn.apply(this,arguments)}(l));var p,d=(0,s.Z)(this,Kn,null==l?void 0:l.app),f=u&&d?u.id!==d.id:u!==d,v=va().getFeatureFlags(),h=(0,c.Z)(this,$n),y=(t,r)=>{(0,c.Z)(this,qn).add(h),(0,I.Z)(this,Xn,na).call(this,t,r,e)},b=()=>{var t=v["sso-enabled"]?"/sso-auth/login":"/auth/login";y(t,{from:e})},w=document.querySelector("#main-mount-point"),S=document.querySelector("#portal-mount-point"),E={tag:Mr.ROOT,container:w,createPortal:S},k=()=>{var e;for(var t of(sn(w),sn(S),(0,c.Z)(this,qn).add(h),(0,c.Z)(this,qn)))t&&(t.dispatchOnUnmount(),t.dispose());(0,c.Z)(this,qn).clear(),null==pa||null===(e=pa.messageDispatcher)||void 0===e||e.reset(),f&&((0,s.Z)(this,Gn,u),window.dispatchEvent(new CustomEvent("app.change",{detail:{previousApp:u,currentApp:d}})))};if(X(d&&(ne()[d.id]||d.theme)||"light"),ie("default"),d){var A,P,C,x,T,R;null==pa||null===(A=pa.checkInstalledApps)||void 0===A||A.preCheckInstalledApps(l,(e=>!!Ea(e)));var B={bailout:e=>e.unauthenticated?(b(),!0):e.redirect?(y(e.redirect.path,e.redirect.state),!0):void(0,s.Z)(this,Hn,0),mergeMenus:(p=(0,i.Z)((function*(e){var t=yield Promise.all(e);(0,s.Z)(n,Jn,function(e){var t={breadcrumb:[]};for(var r of e){var{breadcrumb:n}=r;n&&(n.overwrite?t.breadcrumb=n.items:t.breadcrumb.push(...n.items))}return t}(t))})),function(e){return p.apply(this,arguments)}),catch:(e,t)=>Ht(e)&&!window.NO_AUTH_GUARD?void b():e instanceof O.HttpAbortError?void(0,c.Z)(this,qn).add(h):{failed:!0,output:{node:{tag:Mr.BRICK,type:"div",properties:{textContent:qt(e)},runtimeContext:null,return:t},blockingList:[],menuRequests:[]}}},M=(0,s.Z)(this,$n,new Pn("page",{routeHelper:B})),_=(0,s.Z)(this,Wn,{app:d,location:e,query:new URLSearchParams(e.search),flags:v,sys:(0,a.Z)((0,a.Z)((0,a.Z)({},null==pa||null===(P=pa.auth)||void 0===P?void 0:P.getAuth()),_n()),{},{settings:{brand:va().getBrandSettings()}}),ctxStore:new Ar("CTX",void 0,M),pendingPermissionsPreCheck:[null==pa||null===(C=pa.checkPermissions)||void 0===C?void 0:C.preCheckPermissions(l)],tplStateStoreMap:new Map,formStateStoreMap:new Map});(0,s.Z)(this,Jn,void 0),Ln(l),he(null===(x=l.meta)||void 0===x?void 0:x.functions,d),null==pa||null===(T=pa.flowApi)||void 0===T||T.collectContract(null===(R=l.meta)||void 0===R?void 0:R.contracts);var L,F=!1,U=[];try{if(L=yield qr(E,function(e){if(window.parent===window)return e;var t=e,r=(0,m.findLastIndex)(t,(e=>e.path.startsWith("${APP.homepage}/_dev_only_/template-preview/")));t=[...t.slice(0,r+1),{path:"${APP.homepage}/_dev_only_/template-preview/:templateId",bricks:[{brick:"span"}],menu:!1,exact:!0},...t.slice(r+1)];var n=(0,m.findLastIndex)(t,(e=>e.path.startsWith("${APP.homepage}/_dev_only_/snippet-preview/")));return[...t.slice(0,n+1),{path:"${APP.homepage}/_dev_only_/snippet-preview/:snippetId",bricks:[{brick:"span"}],menu:!1,exact:!0},...t.slice(n+1)]}(l.routes),_,M,[]),B.bailout(L))return;U=Xr(_),yield Qr(L,_,U),yield B.mergeMenus(L.menuRequests),M.setInitialMenuRequests(L.menuRequests)}catch(e){console.error("Router failed:",e);var N=B.catch(e,E);if(!N)return;({failed:F,output:L}=N)}if(E.child=L.node,k(),L.route&&"routes"!==L.route.type||F){if(F||M.dispatchBeforePageLoad(),te(),se(),cn(E),window.scrollTo(0,0),!F)for(var j of(M.dispatchPageLoad(),M.dispatchAnchorLoad(),M.dispatchOnMount(),M.initializeScrollIntoView(),M.initializeMediaChange(),M.initializeMessageDispatcher(),U))j.mountAsyncData();var D=performance.now()-o;return void window.dispatchEvent(new CustomEvent("route.render",{detail:{renderTime:D}}))}}else{if(!window.NO_AUTH_GUARD&&null!=pa&&pa.auth&&!pa.auth.isLoggedIn())return void b();k()}te(),se();var V={tag:Mr.BRICK,type:"div",properties:{textContent:"Page not found"},runtimeContext:null,return:E};E.child=V,cn(E),window.scrollTo(0,0)})),sa.apply(this,arguments)}var ca,la,ua,pa,da="undefined"!=typeof BRICK_PACKAGES?BRICK_PACKAGES:null;function fa(e){if(ca)throw new Error("Cannot create multiple runtimes");return window.addEventListener("message",(e=>{var{data:t}=e;if((null==t?void 0:t.source)===j){var r=t.payload;switch(null==r?void 0:r.type){case D:W=r.active;break;case V:N=r.panel}}})),pa=null==e?void 0:e.hooks,(0,l.initializeI18n)(Vt,Wt),d.locale(l.i18n.language),l.i18n.on("languageChanged",(()=>{d.locale(l.i18n.language)})),A(),ca=new ga}function va(){return ca}var ha=new WeakMap,ma=new WeakMap;class ga{constructor(){(0,o.Z)(this,ha,{writable:!0,value:!1}),(0,o.Z)(this,ma,{writable:!0,value:!1})}initialize(e){var t,r;if((0,c.Z)(this,ha))throw new Error("The runtime cannot be initialized more than once");(0,s.Z)(this,ha,!0),function(e){if(Array.isArray(e.storyboards)){var t=function(){if(r.locales){var e="tmp/".concat(r.id);Object.entries(r.locales).forEach((t=>{var[r,n]=t;l.i18n.addResourceBundle(r,e,n)})),r.localeName=l.i18n.getFixedT(null,e)("name",r.name),Object.keys(r.locales).forEach((t=>{l.i18n.removeResourceBundle(t,e)}))}else r.localeName=r.name};for(var{app:r}of e.storyboards)t()}(0,p.isObject)(e.settings)&&(0,p.deepFreeze)(e.settings),e.brickPackages&&(0,p.deepFreeze)(e.brickPackages)}(e),la=e;var n,{notification:a,dialog:i}=null!==(t=null===(r=e.settings)||void 0===r?void 0:r.presetBricks)&&void 0!==t?t:{};!1!==a&&(n=null!=a?a:"basic.show-notification",(0,this.loadBricks)([n]).then((()=>{Kt=document.createElement(n)}),(e=>{console.error("Load notification service failed:",e)}))),!1!==i&&function(e,t){t([e]).then((()=>{Bt=document.createElement(e)}),(e=>{console.error("Load dialog service failed:",e)}))}(null!=i?i:"basic.show-dialog",this.loadBricks)}bootstrap(e){var t=this;return(0,i.Z)((function*(){if(e&&t.initialize(e),(0,c.Z)(t,ma))throw new Error("The runtime cannot be bootstrapped more than once");(0,s.Z)(t,ma,!0),ua=new ta(la.storyboards),yield ua.bootstrap()}))()}getRecentApps(){var e,t;return null!==(e=null===(t=ua)||void 0===t?void 0:t.getRecentApps())&&void 0!==e?e:{}}getCurrentApp(){var e;return null===(e=ua)||void 0===e?void 0:e.getRecentApps().currentApp}hasInstalledApp(e,t){return Fe(e,t)}getFeatureFlags(){var e,t;return(0,a.Z)((0,a.Z)((0,a.Z)({},null===(e=la)||void 0===e||null===(e=e.settings)||void 0===e?void 0:e.featureFlags),null===(t=ua)||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(0,a.Z)((0,a.Z)({},null===(e=la)||void 0===e||null===(e=e.settings)||void 0===e?void 0:e.misc),null===(t=ua)||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(0,a.Z)({base_title:"DevOps 管理专家"},null===(e=la)||void 0===e||null===(e=e.settings)||void 0===e?void 0:e.brand)}getLaunchpadSettings(){var e;return(0,a.Z)({columns:7,rows:4},null===(e=la)||void 0===e||null===(e=e.settings)||void 0===e?void 0:e.launchpad)}getDesktops(){var e,t;return null!==(e=null===(t=la)||void 0===t?void 0:t.desktops)&&void 0!==e?e:[]}getLaunchpadSiteMap(){var e,t;return null!==(e=null===(t=la)||void 0===t?void 0:t.siteSort)&&void 0!==e?e:[]}toggleLaunchpadEffect(e){document.body.classList.toggle("launchpad-open",e)}applyPageTitle(e){var t=this.getBrandSettings().base_title;document.title=e?"".concat(e," - ").concat(t):t}getNavConfig(){var e;return null===(e=ua)||void 0===e?void 0:e.getNavConfig()}loadBricks(e){return(0,u.loadBricksImperatively)(e,ya())}}function ya(){var e,t,r,n;return null!==(e=null!==(t=null!==(r=null===(n=la)||void 0===n?void 0:n.brickPackages)&&void 0!==r?r:da)&&void 0!==t?t:window.STANDALONE_BRICK_PACKAGES)&&void 0!==e?e:[]}function ba(){var e;return null===(e=ua)||void 0===e?void 0:e.getRenderId()}function wa(){var e;return null===(e=ua)||void 0===e?void 0:e.getRuntimeContext()}function Sa(e){var t;return null===(t=la)||void 0===t||null===(t=t.storyboards)||void 0===t?void 0:t.find((t=>t.app.id===e))}function Ea(e){var t;return null===(t=Sa(e))||void 0===t?void 0:t.app}function ka(){for(var e,t,r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];null==pa||null===(e=pa.auth)||void 0===e||null===(t=e.authenticate)||void 0===t||t.call(e,...n)}function Aa(){var e;return null==pa||null===(e=pa.auth)||void 0===e?void 0:e.getAuth()}function Za(){var e,t;return null==pa||null===(e=pa.auth)||void 0===e||null===(t=e.logout)||void 0===t?void 0:t.call(e)}function Pa(){var e;return null==pa||null===(e=pa.auth)||void 0===e?void 0:e.isLoggedIn()}function Ia(e,t,r){return Oa.apply(this,arguments)}function Oa(){return(Oa=(0,i.Z)((function*(e,t,r){return Ke(yield je(e),e,"resolve",t,r)}))).apply(this,arguments)}function Ca(e){var t,{portal:r,scope:n="fragment",unknownBricks:a}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=r;t=r||(()=>((o=document.createElement("div")).style.position="absolute",o.style.width=o.style.height="0",document.body.append(o),o));var s,c,l=!1;return{render(r){var u=arguments;return(0,i.Z)((function*(){var{theme:i,context:p,functions:d,templates:f,i18n:v}=u.length>1&&void 0!==u[1]?u[1]:{};if(l)throw new Error("The root is unmounted and cannot be rendered any more");var h=[].concat(r),m=s;s=new Pn(n,{unknownBricks:a});var g={ctxStore:new Ar("CTX",void 0,s),pendingPermissionsPreCheck:[],tplStateStoreMap:new Map,formStateStoreMap:new Map},y={tag:Mr.ROOT,container:e,createPortal:t};if("page"===n){var b;X(null!=i?i:"light"),ie("default");var w={id:"demo",homepage:"/demo"};g.app=w;var S={app:w,meta:{i18n:v,customTemplates:f}};null===(b=c)||void 0===b||b(),c=_(S),Ln(S),he(d,w)}g.ctxStore.define(p,g);var E,k=!1,A=[];try{E=yield zr(y,h,g,s,[]),A=Xr(g),yield Qr(E,g,A)}catch(e){k=!0,E={node:{tag:Mr.BRICK,type:"div",properties:{textContent:qt(e)},return:y,runtimeContext:null},blockingList:[],menuRequests:[]}}if(y.child=E.node,null==m||m.dispatchOnUnmount(),null==m||m.dispose(),sn(e),o&&sn(o),"page"===n&&(k||s.dispatchBeforePageLoad(),te(),se()),cn(y),"page"===n&&window.scrollTo(0,0),!k){for(var Z of A)Z.mountAsyncData();"page"===n&&s.dispatchPageLoad(),s.dispatchOnMount(),s.initializeScrollIntoView(),s.initializeMediaChange(),s.initializeMessageDispatcher()}}))()},unmount(){l||(l=!0,sn(e),o&&(sn(o),r||o.remove()))}}}function xa(e,t){return Ta.apply(this,arguments)}function Ta(){return(Ta=(0,i.Z)((function*(e,t){var r,n,i,[o,s,c]=en((0,a.Z)((0,a.Z)({},wa()),{},{data:t,pendingPermissionsPreCheck:[]}));null!==(r=o.tplStateStoreMap)&&void 0!==r||(o.tplStateStoreMap=new Map),null!==(n=o.formStateStoreMap)&&void 0!==n||(o.formStateStoreMap=new Map);var l=new Pn("fragment"),u={tag:Mr.ROOT,createPortal:null},p=e.transform,d=Pe();p&&Ie(d,"`useBrick.transform`",'please use "properties" instead, check your useBrick:',e);var f=yield Gr(u,d?e:(0,a.Z)((0,a.Z)({},e),{},{properties:(0,a.Z)((0,a.Z)({},e.properties),p)}),o,l,[]),v=[...s,...c];if(yield Qr(f,o,v),null!==(i=f.node)&&void 0!==i&&i.portal)throw new Error("The root brick of useBrick cannot be a portal brick");return u.child=f.node,{tagName:f.node?f.node.type:null,renderRoot:u,rendererContext:l,scopedStores:v}}))).apply(this,arguments)}function Ra(e,t){var r,{renderRoot:n,rendererContext:a,scopedStores:i}=e;for(var o of(n.createPortal=()=>{var e=document.querySelector("#portal-mount-point");return r=document.createElement("div"),e.appendChild(r),r},cn(n,t),a.dispatchOnMount(),a.initializeScrollIntoView(),a.initializeMediaChange(),a.initializeMessageDispatcher(),i))o.mountAsyncData();return{portal:r}}function Ba(e,t){var{rendererContext:r}=e;t.portal&&(sn(t.portal),t.portal.remove()),r.dispatchOnUnmount(),r.dispose()}function Ma(e,t,r){if(r)throw new Error("Legacy doTransform does not support options in v3");return ut(t,(0,a.Z)((0,a.Z)({},wa()),{},{data:e}),{noInject:!0})}function _a(e,t){var r=Sa(e);Object.assign(r,(0,a.Z)((0,a.Z)({},t),{},{$$fulfilling:null,$$fulfilled:!0,$$registerCustomTemplateProcessed:!1})),_(r)}function La(e,t){var r=Sa(e),n=!1,a=e=>"".concat(e.path,".").concat(e.exact),i=(e,r)=>e.map((e=>{var o=a(e);return"routes"===e.type?(e.routes=i(e.routes,r),e):o===r?(n=!0,t):e}));r.routes=i(r.routes,a(t)),n||r.routes.unshift(t)}function Fa(e,t,r){var n="".concat(e,".").concat(t.name);xe.define(n,{bricks:t.bricks,proxy:t.proxy,state:t.state}),Ua(e,t.name,r)}function Ua(e,t,r){Va(e,"${APP.homepage}/_dev_only_/template-preview/".concat(t),[(0,a.Z)({brick:t},(0,m.pick)(r,"properties","events","lifeCycle","context"))])}function Na(e){return"${APP.homepage}/_dev_only_/snippet-preview/".concat(e)}function ja(e,t){var r;Va(e,Na(t.snippetId),null!==(r=t.bricks)&&void 0!==r&&r.length?t.bricks:[{brick:"span"}],t.context)}var Da=ja;function Va(e,t,r,n){var{routes:a}=Sa(e),i=a.findIndex((e=>e.path===t)),o={path:t,bricks:r,context:n,menu:!1,exact:!0};-1===i?a.unshift(o):a.splice(i,1,o)}function Wa(e,t){var{tplStateStoreId:r}=t,n=wa();return r?Te((0,a.Z)((0,a.Z)({},n),{},{tplStateStoreId:r}),"STATE").getValue(e):n.ctxStore.getValue(e)}function $a(e){var{tplStateStoreId:t}=e,r=wa();return t?Te((0,a.Z)((0,a.Z)({},r),{},{tplStateStoreId:t}),"STATE").getAllValues():r.ctxStore.getAllValues()}function qa(e){return ya().find((t=>t.id?t.id===e:t.filePath.startsWith(e)))}function Ha(){return ba()}function za(e,t){return Ka.apply(this,arguments)}function Ka(){return(Ka=(0,i.Z)((function*(e,t){var r,{appId:n,updateStoryboardType:a,provider:i}=t,o=Sa(n);if("route"===a)r={routes:[e]};else if("template"===a)r={meta:{customTemplates:[e]}};else if("snippet"===a){var s,c=Na(e.snippetId);r={routes:[null==o||null===(s=o.routes)||void 0===s?void 0:s.find((e=>e.path===c))]}}var l=[];if(r&&i){yield(0,u.loadBricksImperatively)([i],ya());var p=document.createElement(i);(yield p.resolve(r)).forEach((e=>{var t,[r,n,a]=e.match(/(.*)@(.*):\d\.\d\.\d/);null!=o&&null!==(t=o.meta)&&void 0!==t&&null!==(t=t.contracts)&&void 0!==t&&t.some((e=>e.namespaceId===n&&e.name===a))||l.push(e)}))}return l}))).apply(this,arguments)}},7929:(e,t,r)=>{r.r(t),r.d(t,{supply:()=>s});var n=r(3028),a=r(5178),i=r(8874),o=r(8183);function s(e,t,r){var a=(0,n.Z)({},t);for(var i of(a[void 0]=void 0,e))if(!Object.prototype.hasOwnProperty.call(a,i)){var o=p(i,r);void 0!==o&&(a[i]=o)}return a}var c=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"]),l=new Set(["lang","langData","locale","localeData","defineLocale","updateLocale","updateOffset"]),u=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 p(e,t){switch(e){case"Object":return r=Object,n=["entries","fromEntries","keys","values"],Object.fromEntries(n.map((e=>[e,function(){for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return r[e].apply(r,n)}])));case"_":return Object.fromEntries(Object.entries(a).filter((e=>!c.has(e[0]))).concat(t?[["uniqueId",e=>"".concat(null!=e?e:"","42")]]:[]));case"moment":return Object.assign((function(){return i(...arguments)}),Object.fromEntries(Object.entries(i).filter((e=>!l.has(e[0])))));case"PIPES":return o.pipes;case"TAG_URL":return d(!0);case"SAFE_TAG_URL":return d();default:if(u.has(e))return window[e]}var r,n}function d(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];var i=[];return t.forEach(((t,r)=>{i.push(t),r<n.length&&i.push(e?String(n[r]).replace(/[^/]+/g,(e=>encodeURIComponent(e))):encodeURIComponent(String(n[r])))})),i.join("")}}},8486:(e,t,r)=>{function n(e){return class extends HTMLElement{get $$typeof(){return"provider"}resolve(){return e(...arguments)}}}function a(e){var t=Object.getOwnPropertyNames(e);for(var r of t){var n=e[r];n&&"object"==typeof n&&a(n)}return Object.freeze(e)}function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function o(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}r.r(t),r.d(t,{JsonStorage:()=>s,createProviderClass:()=>n,deepFreeze:()=>a,hasOwnProperty:()=>i,isObject:()=>o,unwrapProvider:()=>l});class s{constructor(e){var 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){var t;return JSON.parse(null!==(t=this.storage.getItem(this.prefix+e))&&void 0!==t?t:"null")}removeItem(e){return this.storage.removeItem(this.prefix+e)}clear(){return this.storage.clear()}}var c=new Map;function l(e){return function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var a=function(e){var t=c.get(e);return t||(t=document.createElement(e),c.set(e,t),t)}(e);return a.resolve(...r)}}},1259:(e,t,r)=>{function n(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return function(a,i){if("string"==typeof t?a.name===t:t.includes(a.name)){for(var o=[],s=1;s<=r;s++){var c=i[i.length-s];if("MemberExpression"===(null==c?void 0:c.node.type)&&"object"===c.key){var l=c.node;l.computed||"Identifier"!==l.property.type?l.computed&&"Literal"===l.property.type&&"string"==typeof l.property.value?o.push(n?"".concat(a.name,".").concat(l.property.value):l.property.value):e.hasNonStaticUsage=!0:o.push(n?"".concat(a.name,".").concat(l.property.name):l.property.name)}else e.hasNonStaticUsage=!0}o.length===r&&e.usedProperties.add(o.join("."))}}}function a(e,t){return function(r,n,a){if(n.name===e){var i=a[a.length-1],o=a[a.length-2];if("CallExpression"===(null==o?void 0:o.node.type)&&"callee"===(null==o?void 0:o.key)&&"MemberExpression"===(null==i?void 0:i.node.type)&&"object"===i.key&&(i.node.computed?"Literal"===i.node.property.type&&i.node.property.value===t:"Identifier"===i.node.property.type&&i.node.property.name===t)){var s=o.node.arguments;if(s.length>0){var c=s[0];"Literal"===c.type&&"string"==typeof c.value?r.usedArgs.add(c.value):r.hasNonStaticUsage=!0}}}}}r.r(t),r.d(t,{beforeVisitGlobalMember:()=>n,collectAppGetMenuUsage:()=>i,collectInstalledAppsHasUsage:()=>o,collectMemberUsage:()=>p,collectMemberUsageInFunction:()=>g,createProviderClass:()=>c.createProviderClass,scanPermissionActionsInAny:()=>S,scanPermissionActionsInStoryboard:()=>w,strictCollectMemberUsage:()=>u,strictCollectMemberUsageInFunction:()=>m,track:()=>d,trackAll:()=>f,traverseStoryboardExpressions:()=>l,traverseStoryboardFunction:()=>h,traverseStoryboardFunctions:()=>v,unwrapProvider:()=>c.unwrapProvider});var i=a("APP","getMenu"),o=a("INSTALLED_APPS","has"),s=r(9044),c=r(9686);function l(e,t,r){var n=new WeakSet,{matchExpressionString:a,visitNotMatchedExpressionString:i,visitNonExpressionString:o,visitObject:l}="string"==typeof r?{matchExpressionString:e=>e.includes(r)}:r;!function e(r){if("string"==typeof r)if((0,s.isEvaluable)(r))if(a(r))try{(0,s.preevaluate)(r,{withParent:!0,hooks:{beforeVisitGlobal(e,n){t(e,n,r)}}})}catch(e){console.error("Parse storyboard expression failed:",e)}else null==i||i(r);else null==o||o(r);else if((0,c.isObject)(r)){if(n.has(r))return;for(var u of(n.add(r),null==l||l(r),Array.isArray(r)?r:Object.values(r)))e(u)}}(e)}function u(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,{hasNonStaticUsage:n,nonStaticUsage:a,usedProperties:i}=p(e,t,r);if(n)throw new Error("Non-static usage of ".concat(t,' is prohibited, check your expression: "').concat(a,'"'));return i}function p(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a={usedProperties:new Set,hasNonStaticUsage:!1},i=n(a,t,r);return l(e,((e,t,r)=>{i(e,t),a.hasNonStaticUsage&&(a.nonStaticUsage=r)}),t),a}function d(e,t,r){if(e.includes(t)){var a,i={usedProperties:new Set,hasNonStaticUsage:!1},{expression:o}=(0,s.preevaluate)(e,{withParent:!0,hooks:{beforeVisitGlobal:n(i,r)}});if("SequenceExpression"===o.type&&(a=o.expressions[0])&&"Literal"===a.type&&a.value===t){if(i.usedProperties.size>0)return i.usedProperties;console.warn('You are using "'.concat(t,'" but no `').concat(r,"` usage found in your expression: ").concat(JSON.stringify(e)))}}return!1}function f(e){if(e){var t={usedProperties:new Set,hasNonStaticUsage:!1};if((0,s.preevaluate)(e,{withParent:!0,hooks:{beforeVisitGlobal:n(t,["CTX","STATE","FORM_STATE"],1,!0)}}),t.usedProperties.size>0){var r=[...t.usedProperties],a={context:!1,state:!1,formState:!1},i={CTX:"context",STATE:"state",FORM_STATE:"formState"};return r.forEach((e=>{var[t,r]=e.split(".");a[i[t]]||(a[i[t]]=[]),a[i[t]].push(r)})),a}console.warn('You are using track all but no "CTX" or "STATE" or "FORM_STATE" usage found in your expression: '.concat(JSON.stringify(e)))}return!1}function v(e,t){if(Array.isArray(e))for(var r of e)h(r,t)}function h(e,t){try{(0,s.precookFunction)(e.source,{typescript:e.typescript,withParent:!0,hooks:{beforeVisitGlobal:t}})}catch(t){console.error('Parse storyboard function "'.concat(e.name,'" failed:'),t)}}function m(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,{hasNonStaticUsage:n,usedProperties:a}=g(e,t,r);if(n)throw new Error("Non-static usage of ".concat(t,' is prohibited, check your function: "').concat(e.name,'"'));return a}function g(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a={usedProperties:new Set,hasNonStaticUsage:!1};return h(e,n(a,t,r)),a.usedProperties.delete(e.name),a}var y="PERMISSIONS",b="check";function w(e){var t,r=new Set,n=E(r),{customTemplates:a,functions:i}=null!==(t=e.meta)&&void 0!==t?t:{};return l([e.routes,a],n,y),v(i,n),Array.from(r)}function S(e){var t=new Set;return l(e,E(t),y),Array.from(t)}function E(e){return function(t,r){if(t.name===y){var n=r[r.length-1],a=r[r.length-2];if("CallExpression"===(null==a?void 0:a.node.type)&&"callee"===(null==a?void 0:a.key)&&"MemberExpression"===(null==n?void 0:n.node.type)&&"object"===n.key&&(n.node.computed?"Literal"===n.node.property.type&&n.node.property.value===b:"Identifier"===n.node.property.type&&n.node.property.name===b))for(var i of a.node.arguments)"Literal"===i.type&&"string"==typeof i.value&&e.add(i.value)}}}}}]);
2
- //# sourceMappingURL=core.9eb02801.js.map