@next-bricks/ai-portal 0.53.0 → 0.55.0

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.
Files changed (88) hide show
  1. package/dist/bricks.json +21 -19
  2. package/dist/chunks/1864.4bd403fd.js +2 -0
  3. package/dist/chunks/1864.4bd403fd.js.map +1 -0
  4. package/dist/chunks/1889.b7766f77.js +2 -0
  5. package/dist/chunks/1889.b7766f77.js.map +1 -0
  6. package/dist/chunks/2761.561a580a.js +2 -0
  7. package/dist/chunks/2761.561a580a.js.map +1 -0
  8. package/dist/chunks/3227.689d8678.js +2 -0
  9. package/dist/chunks/3227.689d8678.js.map +1 -0
  10. package/dist/chunks/4888.42dd29a2.js +3 -0
  11. package/dist/chunks/4888.42dd29a2.js.map +1 -0
  12. package/dist/chunks/6201.fa3b6e24.js +2 -0
  13. package/dist/chunks/6201.fa3b6e24.js.map +1 -0
  14. package/dist/chunks/{6593.1afe9a04.js → 6593.58eda50f.js} +2 -2
  15. package/dist/chunks/6593.58eda50f.js.map +1 -0
  16. package/dist/chunks/7279.af201b60.js +3 -0
  17. package/dist/chunks/{6947.1cec7258.js.LICENSE.txt → 7279.af201b60.js.LICENSE.txt} +0 -6
  18. package/dist/chunks/7279.af201b60.js.map +1 -0
  19. package/dist/chunks/9388.e48bb229.js +2 -0
  20. package/dist/chunks/9388.e48bb229.js.map +1 -0
  21. package/dist/chunks/chat-box.8e064684.js +2 -0
  22. package/dist/chunks/chat-box.8e064684.js.map +1 -0
  23. package/dist/chunks/chat-input.dd3d2035.js +2 -0
  24. package/dist/chunks/chat-input.dd3d2035.js.map +1 -0
  25. package/dist/chunks/{cruise-canvas.60fa24a3.js → cruise-canvas.c494563b.js} +2 -2
  26. package/dist/chunks/{cruise-canvas.60fa24a3.js.map → cruise-canvas.c494563b.js.map} +1 -1
  27. package/dist/chunks/elevo-card.49b42ed0.js +3 -0
  28. package/dist/chunks/elevo-card.49b42ed0.js.map +1 -0
  29. package/dist/chunks/flow-tabs.ce40cc92.js +2 -0
  30. package/dist/chunks/flow-tabs.ce40cc92.js.map +1 -0
  31. package/dist/chunks/main.6b7402db.js +2 -0
  32. package/dist/chunks/main.6b7402db.js.map +1 -0
  33. package/dist/chunks/set-chat-command.367b9c88.js +2 -0
  34. package/dist/chunks/set-chat-command.367b9c88.js.map +1 -0
  35. package/dist/chunks/stage-flow.4c7ea7d9.js +2 -0
  36. package/dist/chunks/stage-flow.4c7ea7d9.js.map +1 -0
  37. package/dist/examples.json +11 -11
  38. package/dist/images/0e7e6764.png +0 -0
  39. package/dist/images/7944ebaf.png +0 -0
  40. package/dist/images/c7ec12fe.png +0 -0
  41. package/dist/index.14c08956.js +2 -0
  42. package/dist/index.14c08956.js.map +1 -0
  43. package/dist/manifest.json +182 -165
  44. package/dist/types.json +1071 -616
  45. package/dist-types/bootstrap.d.ts +1 -0
  46. package/dist-types/chat-box/FileListComponent.d.ts +8 -0
  47. package/dist-types/chat-box/UploadButton.d.ts +9 -0
  48. package/dist-types/chat-box/bricks.d.ts +8 -0
  49. package/dist-types/chat-box/index.d.ts +6 -1
  50. package/dist-types/chat-box/interfaces.d.ts +8 -0
  51. package/dist-types/data-providers/set-chat-command.d.ts +7 -0
  52. package/dist-types/data-providers/set-chat-command.spec.d.ts +1 -0
  53. package/dist-types/shared/interfaces.d.ts +9 -0
  54. package/dist-types/stage-flow/i18n.d.ts +3 -1
  55. package/dist-types/stage-flow/index.d.ts +2 -0
  56. package/package.json +2 -2
  57. package/dist/chunks/1334.aae33a33.js +0 -2
  58. package/dist/chunks/1334.aae33a33.js.map +0 -1
  59. package/dist/chunks/1889.0cd5c088.js +0 -2
  60. package/dist/chunks/1889.0cd5c088.js.map +0 -1
  61. package/dist/chunks/2142.0599aecd.js +0 -2
  62. package/dist/chunks/2142.0599aecd.js.map +0 -1
  63. package/dist/chunks/2893.c26f0be9.js +0 -2
  64. package/dist/chunks/2893.c26f0be9.js.map +0 -1
  65. package/dist/chunks/3020.acf9607e.js +0 -2
  66. package/dist/chunks/3020.acf9607e.js.map +0 -1
  67. package/dist/chunks/6201.58eeb93e.js +0 -2
  68. package/dist/chunks/6201.58eeb93e.js.map +0 -1
  69. package/dist/chunks/6593.1afe9a04.js.map +0 -1
  70. package/dist/chunks/6947.1cec7258.js +0 -3
  71. package/dist/chunks/6947.1cec7258.js.map +0 -1
  72. package/dist/chunks/chat-box.59ab1b62.js +0 -2
  73. package/dist/chunks/chat-box.59ab1b62.js.map +0 -1
  74. package/dist/chunks/chat-input.b09e4ba0.js +0 -3
  75. package/dist/chunks/chat-input.b09e4ba0.js.map +0 -1
  76. package/dist/chunks/elevo-card.731505e0.js +0 -3
  77. package/dist/chunks/elevo-card.731505e0.js.map +0 -1
  78. package/dist/chunks/flow-tabs.222a11ea.js +0 -3
  79. package/dist/chunks/flow-tabs.222a11ea.js.LICENSE.txt +0 -5
  80. package/dist/chunks/flow-tabs.222a11ea.js.map +0 -1
  81. package/dist/chunks/main.2188a2bf.js +0 -2
  82. package/dist/chunks/main.2188a2bf.js.map +0 -1
  83. package/dist/chunks/stage-flow.7cfa123d.js +0 -2
  84. package/dist/chunks/stage-flow.7cfa123d.js.map +0 -1
  85. package/dist/index.7d776211.js +0 -2
  86. package/dist/index.7d776211.js.map +0 -1
  87. /package/dist/chunks/{chat-input.b09e4ba0.js.LICENSE.txt → 4888.42dd29a2.js.LICENSE.txt} +0 -0
  88. /package/dist/chunks/{elevo-card.731505e0.js.LICENSE.txt → elevo-card.49b42ed0.js.LICENSE.txt} +0 -0
@@ -28,3 +28,4 @@ import "./sticky-container/index.js";
28
28
  import "./elevo-card/index.js";
29
29
  import "./flow-tabs/index.js";
30
30
  import "./stage-flow/index.js";
31
+ import "./data-providers/set-chat-command.js";
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import type { FileItem } from "./interfaces";
3
+ export interface FileListComponentProps {
4
+ files: FileItem[];
5
+ onRemove: (uid: number, abortController: AbortController | undefined) => void;
6
+ onAdd: () => void;
7
+ }
8
+ export declare function FileListComponent({ files, onRemove, onAdd, }: FileListComponentProps): React.JSX.Element;
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import type { FileItem } from "./interfaces";
3
+ export interface UploadButtonProps {
4
+ onChange?: (files: FileItem[] | undefined) => void;
5
+ }
6
+ export interface UploadButtonRef {
7
+ requestUpload: () => void;
8
+ }
9
+ export declare const UploadButton: React.ForwardRefExoticComponent<UploadButtonProps & React.RefAttributes<UploadButtonRef>>;
@@ -0,0 +1,8 @@
1
+ import type { GeneralIcon, GeneralIconProps } from "@next-bricks/icons/general-icon";
2
+ import type { ActionsEvents, ActionsEventsMapping, ActionsProps, EoActions } from "@next-bricks/basic/actions";
3
+ import type { IconButton, IconButtonProps } from "../icon-button";
4
+ export declare const WrappedIcon: import("@next-core/react-element").WrappedBrick<GeneralIcon, GeneralIconProps>;
5
+ export declare const WrappedActions: import("@next-core/react-element").WrappedBrickWithEventsMap<EoActions, ActionsProps & {
6
+ activeKeys?: (string | number)[];
7
+ }, ActionsEvents, ActionsEventsMapping>;
8
+ export declare const WrappedIconButton: import("@next-core/react-element").WrappedBrick<IconButton, IconButtonProps>;
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import { ReactNextElement } from "@next-core/react-element";
3
3
  import "@next-core/theme";
4
+ import type { CommandPayload } from "../shared/interfaces.js";
4
5
  export declare const ChatBoxComponent: React.ForwardRefExoticComponent<Omit<ChatBoxComponentProps, "ref"> & React.RefAttributes<ChatBoxRef>>;
5
6
  export interface ChatBoxProps {
6
7
  disabled?: boolean;
@@ -8,6 +9,7 @@ export interface ChatBoxProps {
8
9
  autoFocus?: boolean;
9
10
  aiEmployees?: AIEmployee[];
10
11
  commands?: Command[];
12
+ uploadBucket?: string;
11
13
  }
12
14
  export interface AIEmployee {
13
15
  employeeId: string;
@@ -22,6 +24,7 @@ export interface Command {
22
24
  label: string;
23
25
  value: string;
24
26
  options?: Command[];
27
+ payload?: CommandPayload;
25
28
  }
26
29
  /**
27
30
  * 构件 `ai-portal.chat-box`
@@ -34,6 +37,7 @@ export declare class ChatBox extends ReactNextElement implements ChatBoxProps {
34
37
  accessor autoFocus: boolean | undefined;
35
38
  accessor aiEmployees: AIEmployee[] | undefined;
36
39
  accessor commands: Command[] | undefined;
40
+ accessor uploadBucket: string | undefined;
37
41
  setValue(value: string): void;
38
42
  getValue(): string | undefined;
39
43
  focusOnInput(): void | undefined;
@@ -42,7 +46,8 @@ export declare class ChatBox extends ReactNextElement implements ChatBoxProps {
42
46
  interface ChatBoxComponentProps extends ChatBoxProps {
43
47
  onSubmit: (value: string) => void;
44
48
  onEmployeeMention: (employee: AIEmployee | null) => void;
45
- onCommandSelect: (command: string | null) => void;
49
+ onCommandSelect: (command: CommandPayload | null) => void;
50
+ onFilesChange: (files: string[] | null | undefined) => void;
46
51
  ref?: React.Ref<ChatBoxRef>;
47
52
  }
48
53
  export {};
@@ -0,0 +1,8 @@
1
+ export interface FileItem {
2
+ uid: number;
3
+ file: File;
4
+ status: FileStatus;
5
+ uploadedName?: string;
6
+ abortController?: AbortController;
7
+ }
8
+ export type FileStatus = "ready" | "uploading" | "done" | "failed";
@@ -0,0 +1,7 @@
1
+ import type { CommandPayload } from "../shared/interfaces.js";
2
+ export interface ChatCommand {
3
+ command: string;
4
+ payload: CommandPayload;
5
+ }
6
+ export declare function setChatCommand(command: ChatCommand | null): void;
7
+ export declare function getChatCommand(): ChatCommand | null;
@@ -104,6 +104,7 @@ export interface JobPatch extends Partial<Job> {
104
104
  export interface RequestStore {
105
105
  conversationId: string;
106
106
  content: string;
107
+ cmd?: CommandPayload;
107
108
  }
108
109
  export interface GeneratedView {
109
110
  viewId: string;
@@ -133,3 +134,11 @@ export interface ConversationError {
133
134
  jobs: string[];
134
135
  error?: string;
135
136
  }
137
+ export type CommandPayload = CommandPayloadServiceFlowStarting;
138
+ export interface CommandPayloadServiceFlowStarting {
139
+ type: "serviceFlowStarting";
140
+ serviceFlowStarting: {
141
+ spaceInstanceId: string;
142
+ flowInstanceId?: string;
143
+ };
144
+ }
@@ -5,7 +5,9 @@ export declare enum K {
5
5
  DELETE_STAGE = "DELETE_STAGE",
6
6
  DELETE_STAGE_TIPS = "DELETE_STAGE_TIPS",
7
7
  DELETE = "DELETE",
8
- ADD_ACTIVITY = "ADD_ACTIVITY"
8
+ ADD_ACTIVITY = "ADD_ACTIVITY",
9
+ STAGE_NAME_EXISTS = "STAGE_NAME_EXISTS",
10
+ ACTIVITY_NAME_EXISTS = "ACTIVITY_NAME_EXISTS"
9
11
  }
10
12
  export declare const NS = "bricks/ai-portal/stage-flow";
11
13
  export declare const locales: {
@@ -4,6 +4,7 @@ import "@next-core/theme";
4
4
  export interface StageFlowProps {
5
5
  spec?: Stage[];
6
6
  aiEmployees?: AIEmployee[];
7
+ readOnly?: boolean;
7
8
  }
8
9
  export interface Stage {
9
10
  name: string;
@@ -32,6 +33,7 @@ export declare class StageFlow extends ReactNextElement implements StageFlowProp
32
33
  #private;
33
34
  accessor spec: Stage[] | undefined;
34
35
  accessor aiEmployees: AIEmployee[] | undefined;
36
+ accessor readOnly: boolean | undefined;
35
37
  addActivity(stage: Stage, activity: FlowActivity): void;
36
38
  editActivity(stage: Stage, activity: FlowActivity, activityIndex: number): void;
37
39
  deleteActivity(stage: Stage, activityIndex: number): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next-bricks/ai-portal",
3
- "version": "0.53.0",
3
+ "version": "0.55.0",
4
4
  "homepage": "https://github.com/easyops-cn/next-advanced-bricks/tree/master/bricks/ai-portal",
5
5
  "repository": {
6
6
  "type": "git",
@@ -47,5 +47,5 @@
47
47
  "@next-bricks/presentational": "*",
48
48
  "@next-bricks/vs": "*"
49
49
  },
50
- "gitHead": "00a68ef7344f877afc0223f00e30509749405a53"
50
+ "gitHead": "e7cda4d9f829a0395da2471e7d1058ea21394dd3"
51
51
  }
@@ -1,2 +0,0 @@
1
- (()=>{"use strict";var e,n,t,r,o,s,i,a,d,l,u,p,c,f,m,g,h,y,v,b={41334:(e,n,t)=>{var r=t(40580),o=t(58135),s=t(80004);const i="next-tsx",a=["callApi","callHttp","callTool"];function d(e,n){return!e.async&&!e.generator||(n.errors.push({message:"Function cannot be async or generator",node:e,severity:"error"}),!1)}function l(e,n){return!!e.referencesImport(i,n)||e.node.name===n&&!e.scope.getBinding(e.node.name)}function u(e,n){let t=null;return o.traverse(e,{enter(e,n){var r;!t&&(o.isFunctionExpression(e)||o.isStatement(e)||o.isAwaitExpression(e)||o.isYieldExpression(e)||o.isJSX(e)||o.isArrowFunctionExpression(e)&&(e.async||e.generator||o.isBlockStatement(e.body)||o.isObjectProperty(null===(r=n[n.length-1])||void 0===r?void 0:r.node)))&&(t=e)}}),!t||(null==n||n.errors.push({message:`Unsupported expression type: ${t.type}`,node:t,severity:"error"}),!1)}function p(e){return e.isNullLiteral()||e.isIdentifier()&&"undefined"===e.node.name&&void 0===e.scope.getBinding("undefined")}const c=/^<%=?\s/,f=/\s%>$/;function m(e){if("string"!=typeof e)return!1;const n=e.trim();return c.test(n)&&f.test(n)}function g(e,n,t,r){var o;const s=[],i={TSTypeAnnotation(e){s.push({type:"annotation",start:e.node.start,end:e.node.end}),e.skip()},TSTypeParameterInstantiation(e){s.push({type:"annotation",start:e.node.start,end:e.node.end}),e.skip()},TSAsExpression(e){s.push({type:"annotation",start:e.node.expression.end,end:e.node.end}),e.skip()},Identifier(e){var r,o,i,a,d,l;if(!e.isReferencedIdentifier())return;const u=e.parentPath.isObjectProperty()&&e.parentPath.node.shorthand,p=e.node.name,c=e.scope.getBindingIdentifier(p);if(c){var f,m;let l;switch(c){case null===(r=t.eventBinding)||void 0===r?void 0:r.id:l=null!==(o=t.eventBinding)&&void 0!==o&&o.isCallback?"EVENT.detail":"EVENT";break;case null===(i=t.forEachBinding)||void 0===i?void 0:i.item:l="ITEM";break;case null===(a=t.forEachBinding)||void 0===a?void 0:a.index:l="INDEX";break;case null===(d=t.dataBinding)||void 0===d?void 0:d.id:l="DATA"}if(l)return void s.push({type:"id",start:e.node.start,end:e.node.end,replacement:l,shorthand:u?p:void 0});const g=null===(f=t.component)||void 0===f?void 0:f.bindingMap.get(c);g?"state"===g.kind||"resource"===g.kind||"constant"===g.kind||"param"===g.kind||"query"===g.kind?s.push({type:"id",start:e.node.start,end:e.node.end,replacement:"query"===g.kind?"QUERY":`${"template"===t.component.type?"STATE":"CTX"}.${c.name}`,shorthand:u?p:void 0}):n.errors.push({message:`Invalid usage of ${g.kind} variable "${c.name}"`,node:e.node,severity:"error"}):null!==(m=t.functionBindings)&&void 0!==m&&m.has(c)&&s.push({type:"id",start:e.node.start,end:e.node.end,replacement:`FN.${p}`,shorthand:u?p:void 0})}else null!==(l=t.contextBindings)&&void 0!==l&&l.includes(p)&&s.push({type:"id",start:e.node.start,end:e.node.end,replacement:`CTX.${p}`,shorthand:u?p:void 0})}};e.isIdentifier()&&i.Identifier(e),e.traverse(i),s.sort(((e,n)=>e.start-n.start));const a=[];let d=e.node.start;for(const e of s)a.push(n.source.substring(d,e.start),"annotation"===e.type?"":`${e.shorthand?`${e.shorthand}:`:""}${e.replacement}`),d=e.end;a.push(n.source.substring(d,e.node.end));const l=a.join("");return r?l:`<%${null!==(o=t.modifier)&&void 0!==o?o:""} ${l} %>`}const h=Symbol("ambiguous");function y(e,n,t){if(e.isTSAsExpression())return y(e.get("expression"),n,t);if(e.isObjectExpression())return function(e,n,t){const r=e.get("properties");if(r.some((e=>e.isSpreadElement()||e.isObjectProperty()&&(e.node.computed||e.node.shorthand)))&&u(e.node,n))return t.ambiguous?h:g(e,n,t);const o={};for(const e of r){if(!e.isObjectProperty()){n.errors.push({message:`Unsupported property type: ${e.type}`,node:e.node,severity:"error"});continue}if(e.node.computed||e.node.shorthand){n.errors.push({message:"Unsupported computed or shorthand object property",node:e.node.key,severity:"error"});continue}const r=e.get("key");let s;if(r.isIdentifier())s=r.node.name;else{if(!r.isStringLiteral()){n.errors.push({message:`Unsupported object key type: ${r.node.type}`,node:r.node,severity:"error"});continue}s=r.node.value}o[s]=y(e.get("value"),n,t)}return o}(e,n,t);if(e.isArrayExpression())return function(e,n,t){const r=e.get("elements");if(r.some((e=>!e||e.isSpreadElement()))&&u(e.node,n))return t.ambiguous?h:g(e,n,t);const o=[];for(const s of r)s.node?s.isSpreadElement()?n.errors.push({message:"Spread elements are not supported in array",node:s.node,severity:"error"}):o.push(y(s,n,t)):n.errors.push({message:"Array elements cannot be empty",node:e.node,severity:"error"});return o}(e,n,t);if(e.isStringLiteral()||e.isNumericLiteral()||e.isBooleanLiteral())return e.node.value;if(e.isNullLiteral())return null;if(!e.isIdentifier()||"undefined"!==e.node.name||void 0!==e.scope.getBinding("undefined")){if(t.allowUseBrick&&e.isArrowFunctionExpression()){const r=e.get("body");if(r.isBlockStatement())return n.errors.push({message:"Block statements are not supported in render callback",node:r.node,severity:"error"}),null;const o=[];for(const t of e.get("params")){if(!t.isIdentifier())return n.errors.push({message:`Unsupported parameter type: ${t.type}`,node:t.node,severity:"error"}),null;o.push(t.node.name)}return{params:o,children:A(r,n,t)}}return e.isExpression()?u(e.node,n)?t.ambiguous?h:g(e,n,t):null:(n.errors.push({message:`Unsupported value type: ${e.node.type}`,node:e.node,severity:"error"}),null)}}function v(e,n,t){let r=!1;return o.traverse(e.node,{enter(e,n){var t;let s;r||o.isStringLiteral(e)||o.isNumericLiteral(e)||o.isBooleanLiteral(e)||o.isNullLiteral(e)||o.isObjectExpression(e)||o.isArrayExpression(e)||o.isObjectProperty(e)||o.isIdentifier(e)&&(s=null===(t=n[n.length-1])||void 0===t?void 0:t.node,1)&&(s&&o.isObjectProperty(s)?!s.computed&&!s.shorthand:"undefined"===e.name)||(r=!0)}}),r&&u(e.node,null)?g(e,n,t):y(e,n,t)}const b={callApi:[2,3],callHttp:[1,2],callTool:[2,3]};function x(e,n,t){if(!e.isCallExpression()&&!e.isOptionalCallExpression())return n.errors.push({message:`Await expression must be a call expression, received ${e.node.type}`,node:e.node,severity:"error"}),null;const r=e.get("callee");let o;if(!r.isIdentifier())return n.errors.push({message:`Await expression must call an identifier, received ${r.type}`,node:r.node,severity:"error"}),null;for(const e of a)if(l(r,e)){o=e;break}if(!o)return n.errors.push({message:`Await expression must call "callApi", "callHttp" or "callTool", received "${r.node.name}"`,node:r.node,severity:"error"}),null;const s=b[o],i=e.get("arguments"),d=i.length<s[0];if((d||!s.includes(i.length))&&(n.errors.push({message:`"${o}()" expects ${s.join(" or ")} arguments, but got ${i.length}`,node:e.node,severity:d?"error":"warning"}),d))return null;let u;const c=i[0];if("callHttp"===o){const e=y(c,n,t);if("string"!=typeof e)return n.errors.push({message:`"${o}()" expects a string value as the first argument, but got ${typeof e}`,node:c.node,severity:"error"}),null;u={api:e,http:!0}}else if("callApi"===o){if(!c.isStringLiteral())return n.errors.push({message:`"${o}()" expects a string literal as the first argument, but got ${c.type}`,node:c.node,severity:"error"}),null;u={api:c.node.value}}else{const e=y(c,n,t);if("string"!=typeof e)return n.errors.push({message:`"${o}()" expects a string value as the first argument, but got ${typeof e}`,node:c.node,severity:"error"}),null;const r=i[1],s=y(r,n,t);if("string"!=typeof s)return n.errors.push({message:`"${o}()" expects a string value as the second argument, but got ${typeof s}`,node:r.node,severity:"error"}),null;const a=i[2];let d;a&&(d=y(a,n,t)),u={api:o,tool:{conversationId:e,stepId:s},params:d}}if("callApi"===o||"callHttp"===o){const e=i[1];if(e&&!p(e)){e.isObjectExpression()||n.errors.push({message:`Data source "params" prefers an object literal, but got ${e.type}`,node:e.node,severity:"notice"});const r=y(e,n,t);m(r)||"object"==typeof r&&null!==r?u.params=r:n.errors.push({message:"API params expects an object or expression, but got "+typeof r,node:e.node,severity:"error"})}}if("callApi"===o){const e=i[2];if(e&&!p(e))if(e.isObjectExpression()){const t=e.get("properties");for(const e of t){if(!e.isObjectProperty()){n.errors.push({message:`"callApi()" third param "meta" expects object properties, but got ${e.type}`,node:e.node,severity:"error"});continue}const t=e.get("key");if(!t.isIdentifier()){n.errors.push({message:`"callApi()" third param "meta" property key must be an identifier, but got ${t.type}`,node:t.node,severity:"error"});continue}if("objectId"!==t.node.name){n.errors.push({message:`"callApi()" third param "meta" property key must be "objectId", but got "${t.node.name}"`,node:t.node,severity:"error"});continue}const r=e.get("value");if(!p(r)){if(!r.isStringLiteral()){n.errors.push({message:`"callApi()" third param "meta" property "${t.node.name}" expects a string literal, but got ${r.type}`,node:r.node,severity:"error"});continue}u.objectId=r.node.value}}}else n.errors.push({message:`"callApi()" third param "meta" expects an object literal, but got ${e.type}`,node:e.node,severity:"error"})}return u}function $(e,n,t,r){if(!e.isArrowFunctionExpression())return n.errors.push({message:`Event handler must be an arrow function expression, but got ${e.type}`,node:e.node,severity:"error"}),null;const o=e.get("params");if(o.length>1)return n.errors.push({message:`Event handler arrow function must have at most one parameter, but got ${o.length}`,node:e.node,severity:"error"}),null;const s=o[0],i={...t,modifier:void 0,eventBinding:void 0};if(s){if(!s.isIdentifier())return n.errors.push({message:`Event handler arrow function parameter must be an identifier, but got ${s.type}`,node:s.node,severity:"error"}),null;i.eventBinding={id:s.node,isCallback:r}}const a=E(e.get("body"),n,i);return a?[].concat(a):null}function E(e,n,t){if(e.isBlockStatement())return e.get("body").flatMap((e=>E(e,n,t))).filter((e=>null!==e));if(e.isIfStatement())return{action:"conditional",payload:{test:y(e.get("test"),n,t),consequent:E(e.get("consequent"),n,t),alternate:e.node.alternate?E(e.get("alternate"),n,t):null}};if(e.isExpressionStatement())return E(e.get("expression"),n,t);if(e.isCallExpression()||e.isOptionalCallExpression()){const i=e.get("callee"),d=e.get("arguments");if(i.isIdentifier()){if(l(i,"showMessage"))return 1!==d.length?(n.errors.push({message:`"showMessage()" expects exactly 1 argument, but got ${d.length}`,node:e.node,severity:"error"}),null):{action:"show_message",payload:y(d[0],n,t)};if(l(i,"pushQuery"))return 1!==d.length&&2!==d.length?(n.errors.push({message:`"pushQuery()" expects 1 or 2 arguments, but got ${d.length}`,node:e.node,severity:"error"}),null):{action:"update_query",payload:{method:"push",args:d.map((e=>y(e,n,t)))}};for(const r of a)if(l(i,r)){const r=x(e,n,t);return r?(n.contracts.add(r.api),{action:"call_api",payload:r}):null}const o=i.scope.getBindingIdentifier(i.node.name);let s;var r;return o&&(s=null===(r=t.component)||void 0===r?void 0:r.bindingMap.get(o)),s?"setState"===s.kind?{action:"update_variable",payload:{name:s.id.name,value:void 0===d[0]?void 0:y(d[0],n,{...t,modifier:void 0})}}:(n.errors.push({message:`"${i.node.name}" is not callable`,node:i.node,severity:"error"}),null):(n.errors.push({message:`Function "${i.node.name}" is not defined`,node:i.node,severity:"error"}),null)}if(i.isMemberExpression()||i.isOptionalMemberExpression()){if(i.node.computed)return n.errors.push({message:"Event handler call expression with computed member expression is not supported",node:i.node,severity:"error"}),null;const e=i.get("object");if(e.isMemberExpression()||e.isOptionalMemberExpression()){const r=e.get("property");if(!e.node.computed&&r.isIdentifier()&&"current"===r.node.name){const r=e.get("object");if(r.isIdentifier()){var o;const e=r.scope.getBindingIdentifier(r.node.name);let a;var s;if(e&&(a=null===(s=t.component)||void 0===s?void 0:s.bindingMap.get(e)),!a)return n.errors.push({message:`Variable "${r.node.name}" is not defined`,node:r.node,severity:"error"}),null;if("ref"!==a.kind)return n.errors.push({message:`Variable "${r.node.name}" is not a ref, but a ${a.kind}`,node:r.node,severity:"error"}),null;const l=i.get("property");return l.isIdentifier()?{action:"call_ref",payload:{ref:a.id.name,method:l.node.name,args:d.map((e=>y(e,n,t))),scope:"template"===(null===(o=t.component)||void 0===o?void 0:o.type)?"template":"global"}}:(n.errors.push({message:"Event handler call expression with non-identifier property is not supported",node:l.node,severity:"error"}),null)}}}if(!e.isCallExpression())return n.errors.push({message:`Member expression in event handler expects a call expression as object, but got ${e.type}`,node:e.node,severity:"error"}),null;const r=e.get("callee");if(!r.isIdentifier())return n.errors.push({message:`Member expression in event handler expects an identifier as callee, but got ${r.type}`,node:r.node,severity:"error"}),null;const u=i.get("property");if(!u.isIdentifier())return n.errors.push({message:`Member expression in event handler expects an identifier as property, but got ${u.type}`,node:u.node,severity:"error"}),null;let p;for(const e of a)if(l(r,e)){p=e;break}if(p){if("then"!==u.node.name)return n.errors.push({message:`"${p}()" expects "then" as its method, but got ${u.node.name}`,node:u.node,severity:"error"}),null;if(1!==d.length)return n.errors.push({message:`"${p}().then()" expects exactly 1 argument, but got ${d.length}`,node:u.node,severity:"error"}),null;const r=x(e,n,t);if(!r)return null;n.contracts.add(r.api);const o=$(d[0],n,t,!0);return{action:"call_api",payload:r,callback:o?{success:o}:void 0}}return n.errors.push({message:`Unsupported action in event handler: ${r.node.name}`,node:r.node,severity:"error"}),null}}return n.errors.push({message:"Unsupported event handler",node:e.node,severity:"error"}),null}function S(e,n,t){var r;if(!e.isReferencedIdentifier())return null;const o=e.node.name,s=e.scope.getBinding(o);if(!s)return null;if(null!==(r=t.componentBindings)&&void 0!==r&&r.has(s.identifier))return{type:"local",name:o};if("module"===s.kind){if(s.path.isImportSpecifier()&&s.path.parentPath.isImportDeclaration()){const e=s.path.get("imported");if(!e.isIdentifier())return n.errors.push({message:`Unsupported import specifier type: ${e.type}`,node:e.node,severity:"error"}),null;const t=s.path.parentPath.get("source");return{type:"imported",name:e.node.name,importSource:t.node.value}}if(s.path.isImportDefaultSpecifier()&&s.path.parentPath.isImportDeclaration())return{type:"imported",importSource:s.path.parentPath.get("source").node.value}}return n.errors.push({message:`Unsupported component binding for "${o}"`,node:s.identifier,severity:"error"}),null}function w(e,n,t){var r,o;if(!e.isJSXExpressionContainer())return void n.errors.push({message:`The "ref" attribute in component expects a JSXExpressionContainer, but got ${null===(r=e.node)||void 0===r?void 0:r.type}`,node:null!==(o=e.node)&&void 0!==o?o:e.parent,severity:"error"});const s=e.get("expression");if(!s.isIdentifier())return void n.errors.push({message:`The "ref" attribute in component expects an identifier, but got ${s.node.type}`,node:s.node,severity:"error"});const i=s.node.name,a=s.scope.getBindingIdentifier(i);let d;var l;if(a&&(d=null===(l=t.component)||void 0===l?void 0:l.bindingMap.get(a)),d){if("ref"===d.kind)return d.id.name;n.errors.push({message:`The variable "${i}" is not a ref, but a ${d.kind}`,node:e.node,severity:"error"})}else n.errors.push({message:`The ref "${i}" is not defined`,node:e.node,severity:"error"})}function I(e){return e.slice(2).replace(/([a-z])([A-Z])/g,"$1.$2").toLowerCase()}function k(e,n,t){if(e.isJSXFragment())return e.get("children").flatMap((e=>k(e,n,t)));if(e.isJSXText())return e.node.value.trim()?{type:"text",text:e.node.value}:null;if(e.isJSXExpressionContainer())return k(e.get("expression"),n,t);if(e.isJSXEmptyExpression())return null;if(e.isJSXElement())return function(e,n,t){const r=e.get("openingElement"),s=r.get("name");if(!s.isJSXIdentifier())return n.errors.push({message:`Unsupported JSX element name type: ${s.type}`,node:s.node,severity:"error"}),null;if(l(s,"Fragment")){for(const e of r.node.attributes)o.isJSXAttribute(e)&&o.isJSXIdentifier(e.name)&&"key"===e.name.name||n.errors.push({message:"Invalid attribute for Fragment",node:e,severity:"error"});return e.get("children").flatMap((e=>k(e,n,t)))}const i=S(s,n,t),a={};let d,u;const p=l(s,"Route");for(const e of r.get("attributes")){if(e.isJSXSpreadAttribute()){n.errors.push({message:"Spread attributes are not supported in component",node:e.node,severity:"error"});continue}const r=e.get("name");if(!r.isJSXIdentifier()){n.errors.push({message:`Expected JSXIdentifier, but got ${r.node.type}`,node:r.node,severity:"error"});continue}const o=r.node.name;if("key"===o)continue;const s=e.get("value");if(p)if("component"===o){if(!s.isJSXExpressionContainer()){var c,f;n.errors.push({message:`The "component" attribute in Route expects a JSXExpressionContainer, but got ${null===(c=s.node)||void 0===c?void 0:c.type}`,node:null!==(f=s.node)&&void 0!==f?f:s.parent,severity:"error"});continue}const e=s.get("expression");if(!e.isIdentifier()){n.errors.push({message:`The "component" attribute in Route expects an identifier, but got ${e.node.type}`,node:e.node,severity:"error"});continue}const r=S(e,n,t);if(!r){n.errors.push({message:`The component "${e.node.name}" is not defined`,node:e.node,severity:"error"});continue}a.component={name:e.node.name,reference:r}}else if("path"===o){if(!s.isStringLiteral()){var m,g;n.errors.push({message:`The "path" attribute in Route expects a string literal, but got ${null===(m=s.node)||void 0===m?void 0:m.type}`,node:null!==(g=s.node)&&void 0!==g?g:s.parent,severity:"error"});continue}a.path=s.node.value}else n.errors.push({message:`Unsupported attribute "${o}" in Route`,node:r.node,severity:"error"});else if("ref"!==o)if(/^on[A-Z]/.test(o)){if(!s.isJSXExpressionContainer()){var h,y;n.errors.push({message:`Event handler "${o}" expects a JSXExpressionContainer, but got ${null===(h=s.node)||void 0===h?void 0:h.type}`,node:null!==(y=s.node)&&void 0!==y?y:s.parent,severity:"error"});continue}const e=s.get("expression");if(e.isJSXEmptyExpression()){n.errors.push({message:"Empty expression in events is not allowed",node:e.node,severity:"warning"});continue}let r=null;if(e.isIdentifier()){const n=e.scope.getBindingIdentifier(e.node.name);if(n){var b;const e=null===(b=t.component)||void 0===b?void 0:b.bindingMap.get(n);e&&"eventHandler"===e.kind&&(r=[{action:"dispatch_event",payload:{type:I(e.id.name),detail:"<% EVENT.detail %>"}}])}}r||(r=$(e,n,t)),r&&(null!=d||(d={}),d[I(o)]=r)}else if(null==s.node)a[o]=!0;else if(s.isStringLiteral())a[o]=s.node.value;else if(s.isJSXExpressionContainer()){const e=s.get("expression");e.isJSXEmptyExpression()?n.errors.push({message:`Empty expression in JSX attribute "${o}" is not allowed`,node:e.node,severity:"warning"}):a[o]=v(e,n,{...t,allowUseBrick:!0,modifier:"="})}else n.errors.push({message:`Unsupported attribute value type in component: ${s.node.type}`,node:s.node,severity:"error"});else u=w(s,n,t)}const{textContent:x,children:E}=j(e.get("children"),n,t);return x&&(a.textContent=x),{type:"component",component:{name:s.node.name,reference:i,properties:a,ref:u,events:d,children:E}}}(e,n,t);if(e.isCallExpression()){const r=e.get("callee");if(r.isMemberExpression()||r.isOptionalMemberExpression()){const o=r.get("property");if(o.isIdentifier()&&"map"===o.node.name){const o=e.get("arguments");if(o.length>0){const e=o[0];if(e.isArrowFunctionExpression()){const o=e.get("body");if(o.isExpression()&&T(o.node)){const o=r.get("object");if(!u(o.node,n))return null;const s=e.get("params");if(s.length>2)return n.errors.push({message:`Array map function with JSX elements must have at most two parameters, but got ${s.length}`,node:s[2].node,severity:"error"}),null;const i=s.find((e=>!e.isIdentifier()));if(i)return n.errors.push({message:`Array map function with JSX elements must have identifier parameters, but got ${i.type}`,node:i.node,severity:"error"}),null;const a={...t,forEachBinding:void 0};if(s.length>0){const[e,n]=s;a.forEachBinding={item:e.node,index:null==n?void 0:n.node}}return{type:"component",component:{name:"ForEach",properties:{dataSource:v(o,n,{...t,modifier:"="})},children:A(e.get("body"),n,a)}}}}}}}}else if(e.isConditionalExpression()){const r=e.get("test"),o=e.get("consequent"),s=e.get("alternate");if(T(o.node)||T(s.node))return u(r.node,n)?{type:"component",component:{name:"If",properties:{dataSource:v(r,n,{...t,modifier:"="})},children:[...A(o,n,t),...A(s,n,t).map((e=>({...e,slot:"else"})))]}}:null}else if(e.isLogicalExpression()){const r=e.get("left"),o=e.get("right"),s=e.node.operator;if(("&&"===s||"||"===s)&&T(o.node)){if(!u(r.node,n))return null;const e=A(o,n,t);return{type:"component",component:{name:"If",properties:{dataSource:v(r,n,{...t,modifier:"="})},children:"&&"===s?e:e.map((e=>({...e,slot:"else"})))}}}}return e.isExpression()?u(e.node,n)?{type:"expression",expression:e}:null:(n.errors.push({message:`Unsupported node type in JSX children: ${e.type}`,node:e.node,severity:"error"}),null)}function T(e){let n=!1;return o.traverse(e,{enter(e){n||!o.isJSXElement(e)&&!o.isJSXFragment(e)||(n=!0)}}),n}function j(e,n,t){let r=e.flatMap((e=>k(e,n,t))),o=r.every((e=>"text"===(null==e?void 0:e.type)));if(!o){let e=null;const n=[];for(const t of r){if(null===t);else if("text"===t.type||"expression"===t.type){var s,i,a;if("text"===(null===(s=e)||void 0===s?void 0:s.type)||"expression"===(null===(i=e)||void 0===i?void 0:i.type)){e={type:"merged",children:[e,t]},n.splice(n.length-1,1,e);continue}if("merged"===(null===(a=e)||void 0===a?void 0:a.type)){e.children.push(t);continue}}e=t,n.push(t)}r=n,o=r.every((e=>"text"===(null==e?void 0:e.type)||"merged"===(null==e?void 0:e.type)&&e.children.every((e=>"text"===e.type))))}return o?{textContent:r.flatMap((e=>"text"===e.type?e.text:e.children.map((e=>e.text)))).join("").trim()}:r.every((e=>!!e&&"component"!==e.type))?{textContent:P(r.flatMap((e=>"merged"===e.type?e.children:e)),n,t)}:{children:r.filter((e=>!!e)).map((e=>"component"===e.type?e.component:{name:"Plaintext",properties:{textContent:"text"===e.type?e.text:"expression"===e.type?g(e.expression,n,{...t,modifier:"="}):P(e.children,n,t)}}))}}function P(e,n,t){return n.usedHelpers.add("_helper_mergeTexts"),`<%= FN._helper_mergeTexts(${e.map((e=>"text"===e.type?JSON.stringify(e):`{type:"expression",value:(${g(e.expression,n,t,!0)})}`)).join(", ")}) %>`}function A(e,n,t){const{textContent:r,children:o}=j([e],n,t);return null!=o?o:[{name:"Plaintext",properties:{textContent:r}}]}function C(e){var n,t;const r=null===(n=e.children)||void 0===n?void 0:n.find((e=>{return t="View",function(e){return!e.reference||"imported"===e.reference.type&&e.reference.importSource===i}(n=e)&&(n.reference?n.reference.name===t:n.name===t);var n,t})),o=null==r||null===(t=r.properties)||void 0===t?void 0:t.title;if("string"==typeof o&&!m(o))return o}const B=s.default;function O(e,n,t,r,o,s,i){const a=x(e,n,t);if(!a)return null;n.contracts.add(a.api);const d={name:r,config:o,...a};if(s){var l;if(s.length>("catch"===i?1:2))return n.errors.push({message:`".${i}()" expects no more than 2 arguments, but got ${s.length}`,node:null===(l=s[1])||void 0===l?void 0:l.node,severity:"error"}),null;if(s.length>0){const e=X(s[0],n,t);e&&(d["catch"===i?"rejectTransform":"transform"]=e)}if("catch"!==i&&s.length>1){const e=X(s[1],n,t);e&&(d.rejectTransform=e)}}return d}function X(e,n,t){if(!e.isArrowFunctionExpression())return n.errors.push({message:`".then()" callback expects an arrow function, but got ${e.type}`,node:e.node,severity:"error"}),null;const r=e.get("body");if(!r.isExpression())return n.errors.push({message:`".then()" callback function body expects an expression, but got ${r.type}`,node:r.node,severity:"error"}),null;const o=e.get("params");var s,i;if(o.length>1)return n.errors.push({message:`".then()" callback function expects exactly 0 or 1 parameter, but got ${o.length}`,node:null!==(s=null===(i=o[1])||void 0===i?void 0:i.node)&&void 0!==s?s:e,severity:"error"}),null;const a={...t,dataBinding:void 0},d=o[0];if(o.length>0){if(!d.isIdentifier())return n.errors.push({message:`".then()" callback function parameter expects an identifier, but got ${d.type}`,node:d.node,severity:"error"}),null;a.dataBinding={id:d.node}}return g(r,n,a)}function J(e,n,t,r){const o=e.get("id");if(!o.isArrayPattern())return null;const s=o.get("elements");if(1!==s.length&&2!==s.length)return null;const i=s[0];if(!i.isIdentifier())return null;if(1!==n.length&&2!==n.length)return null;const a=n[0];if(!a.isArrowFunctionExpression())return null;if(!d(a.node,t))return null;const l=a.get("body");if(l.isBlockStatement())return null;if(!l.isCallExpression())return null;const u=l.get("callee");if(!u.isIdentifier()&&!u.isMemberExpression())return null;const p=n[1];let c;if(p){if(!p.isObjectExpression())return t.errors.push({message:`"useResource()" second argument must be an object expression, but got ${p.type}`,node:p.node,severity:"error"}),null;for(const e of p.get("properties")){if(!e.isObjectProperty())return t.errors.push({message:`Unsupported property type in "useResource()" second argument: ${e.type}`,node:e.node,severity:"error"}),null;const n=e.get("key");if(!n.isIdentifier())return t.errors.push({message:`"useResource()" second argument property key must be an identifier, but got ${n.type}`,node:n.node,severity:"error"}),null;if(e.node.computed)return t.errors.push({message:'"useResource()" second argument property key cannot be computed',node:n.node,severity:"error"}),null;if("enabled"!==n.node.name&&"fallback"!==n.node.name)return t.errors.push({message:`"useResource()" second argument property key must be "enabled" or "fallback", but got "${n.node.name}"`,node:n.node,severity:"error"}),null;null!=c||(c={}),c[n.node.name]=y(e.get("value"),t,r)}}let f=null;if(u.isMemberExpression()){const e=u.get("property");if(!e.isIdentifier()||u.node.computed||"then"!==e.node.name&&"catch"!==e.node.name)return t.errors.push({message:"Unexpected awaited expression",node:e.node,severity:"error"}),null;f=O(u.get("object"),t,r,i.node.name,c,l.get("arguments"),e.node.name)}else f=O(l,t,r,i.node.name,c);return f?{id:i.node,kind:"resource",resource:f}:null}function D(e,n,t,r){if(!d(e.node,n))return null;const o=new Map,s={bindingMap:o,type:t,id:e.node.id},i={...r,component:s},a=e.get("params");if("template"===t){if(a.length>1)return n.errors.push({message:`Component function can only have zero or one parameter, received ${a.length}`,node:e.node,severity:"error"}),null;if(a.length>0){const e=a[0];if(!e.isObjectPattern())return n.errors.push({message:`Component function parameter must be an object pattern, received ${e.type}`,node:e.node,severity:"error"}),null;for(const t of e.get("properties")){if(t.isRestElement())return n.errors.push({message:"Component function parameter rest element is not allowed",node:t.node,severity:"error"}),null;const e=t.node;if(e.computed||!e.shorthand)return n.errors.push({message:"Component function parameter properties must be shorthand and not computed",node:t.node,severity:"error"}),null;const r=t.get("key"),s=t.get("value");if(!r.isIdentifier())return n.errors.push({message:`Component function parameter property key must be an identifier, received ${r.type}`,node:r.node,severity:"error"}),null;const a=r.node.name;if(/^on[A-Z]/.test(a)){if(!s.isIdentifier())return n.errors.push({message:`Event handler parameter "${a}" must be an identifier, received ${s.type}`,node:s.node,severity:"error"}),null;o.set(s.node,{id:s.node,kind:"eventHandler"})}else{let e,t;if(s.isAssignmentPattern()){const r=s.get("left");r.isIdentifier()&&(e=r.node,t=y(s.get("right"),n,i))}else s.isIdentifier()&&(e=s.node);if(!e){n.errors.push({message:`Component function parameter property value must be an identifier or assignment pattern, received ${s.type}`,node:s.node,severity:"error"});continue}const r={id:e,kind:"param",initialValue:t};o.set(e,r)}}}}else if(a.length>0)return n.errors.push({message:`Page function cannot have parameters, received ${a.length}`,node:a[0].node,severity:"error"}),null;const u=e.get("body").get("body");for(const e of u)if(e.isVariableDeclaration()){if("const"!==e.node.kind){n.errors.push({message:`Only "const" variable declaration is allowed, received "${e.node.kind}"`,node:e.node,severity:"error"});continue}for(const t of e.get("declarations")){const e=t.get("init");if(e.isCallExpression()){const r=e.get("callee");if(r.isIdentifier()){const s=e.get("arguments");if(l(r,"useState")){const e=t.get("id");if(!e.isArrayPattern())continue;const r=e.get("elements");if(2!==r.length){n.errors.push({message:`useState() destructuring must have exactly two elements, received ${r.length}`,node:e.node,severity:"error"});continue}const a=r[0],d=r[1];if(!a.isIdentifier()||!d.isIdentifier()){n.errors.push({message:`useState() destructuring must have identifiers as elements, received ${r.map((e=>e.type)).join(", ")}`,node:e.node,severity:"error"});continue}const l={id:a.node,kind:"state"};o.set(a.node,l),o.set(d.node,{id:a.node,kind:"setState"}),s.length>0&&(l.initialValue=y(s[0],n,i)),s.length>1&&n.errors.push({message:`useState() only accepts at most one argument, received ${s.length}`,node:s[1].node,severity:"warning"});continue}if(l(r,"useResource")){const e=J(t,s,n,i);e&&o.set(e.id,e);continue}if(l(r,"useRef")){const e=t.get("id");if(!e.isIdentifier()){n.errors.push({message:`useRef() must be assigned to an identifier, received ${e.type}`,node:e.node,severity:"error"});continue}s.length>1&&n.errors.push({message:`useRef() only accepts at most one argument, received ${s.length}`,node:s[1].node,severity:"warning"});const r=s[0];r&&!r.isNullLiteral()&&n.errors.push({message:`useRef() first argument must be null, received ${r.type}`,node:r.node,severity:"warning"}),o.set(e.node,{id:e.node,kind:"ref"});continue}if(l(r,"useQuery")){const e=t.get("id");if(!e.isIdentifier()){n.errors.push({message:`useQuery() must be assigned to an identifier, received ${e.type}`,node:e.node,severity:"error"});continue}s.length>0&&n.errors.push({message:`useQuery() does not accept any arguments, received ${s.length}`,node:s[0].node,severity:"warning"}),o.set(e.node,{id:e.node,kind:"query"});continue}}}const r=t.get("id");if(!r.isIdentifier()){n.errors.push({message:`Expect an identifier as the variable name, received ${r.type}`,node:r.node,severity:"error"});continue}const s={id:r.node,kind:"constant"};o.set(r.node,s),e.node&&(s.initialValue=y(e,n,i))}}else if(e.isReturnStatement()){const t=e.get("argument");if(!t.isJSXElement()&&!t.isJSXFragment()){n.errors.push({message:`Expect JSX element or fragment as the return value, received ${t.type}`,node:t.node,severity:"error"});continue}s.children=A(t,n,i)}else e.isTSInterfaceDeclaration()||e.isTSTypeAliasDeclaration()||n.errors.push({message:`Unsupported top level statement type: ${e.type}`,node:e.node,severity:"error"});return s}function M(e,n,t){if(!d(e.node,n))return null;const r=[];e.traverse({Identifier(n){if(!n.isReferencedIdentifier())return;const o=n.parentPath.isObjectProperty()&&n.parentPath.node.shorthand,s=n.scope.getBindingIdentifier(n.node.name);var i;s&&s!==e.node.id&&null!==(i=t.functionBindings)&&void 0!==i&&i.has(s)&&r.push({type:"id",start:n.node.start,end:n.node.end,replacement:`FN.${s.name}`,shorthand:o?n.node.name:void 0})}}),r.sort(((e,n)=>e.start-n.start));const o=[];let s=e.node.start;for(const e of r)o.push(n.source.substring(s,e.start),`${e.shorthand?`${e.shorthand}:`:""}${e.replacement}`),s=e.end;return o.push(n.source.substring(s,e.node.end)),{name:e.node.id.name,source:o.join(""),typescript:!0}}const U=[".js",".jsx",".ts",".tsx"];function F(e,n,t){if(e.startsWith("/"))return R(e.slice(1),t);const r=n.substring(0,n.lastIndexOf("/")),o=r?r.split("/"):[],s=e.split("/");for(const e of s)"."!==e&&(".."===e?o.length>0&&o.pop():o.push(e));return R(o.join("/"),t)}function R(e,n){if(n.some((n=>n.filePath===e)))return e;for(const t of U)if(n.some((n=>n.filePath===`${e}${t}`)))return`${e}${t}`;return e}const N=s.default;var L=function(e){return e.TopLevelStatement="top level statement",e.NamedExportDeclaration="named export declaration",e.DefaultExportDeclaration="default export declaration",e}(L||{});function _(e){return e.name[0]>="A"&&e.name[0]<="Z"}function V(e,n,t,o){var s;const i=n.files.find((n=>n.filePath===e));if(!i)throw new Error(`File not found: ${e}`);if(n.modules.has(e))return;n.modules.set(e,null),t||(t=(0,r.parse)(i.content,{plugins:["jsx","typescript"],sourceType:"module",errorRecovery:!0}));const a=!n.entry,d=a?"entry":i.filePath.startsWith("Pages/")?"page":i.filePath.startsWith("Components/")?"template":"unknown",u={source:i.content,filePath:e,moduleType:d,defaultExport:null,namedExports:new Map,internals:[],errors:[],contracts:new Set,usedHelpers:new Set};if(null!==(s=t.errors)&&void 0!==s&&s.length)for(const e of t.errors)u.errors.push({message:`${e.code}: ${e.reasonCode}`,node:null,severity:"error"});a&&(n.entry=u),n.modules.set(e,u),function(e,n,t,r){const o=new Set,s=new Set,i={functionBindings:o,componentBindings:s,contextBindings:null==r?void 0:r.withContexts};N(t,{Program(t){const a=t.get("body"),d=[];let u=null,p=null;const c=[],f=(t,r)=>{if(t.isFunctionDeclaration()){const i=t.node.id;if(i&&(_(i)?s.add(i):o.add(i)),r===L.DefaultExportDeclaration)return void("app"===n.appType&&"entry"===e.moduleType?e.errors.push({message:"The entry module in an app cannot have a default export declaration.",node:t.node,severity:"error"}):u=t);if(!i)return void e.errors.push({message:"Function declaration must have a name",node:t.node,severity:"error"});r===L.NamedExportDeclaration?d.push({func:t,exported:!0}):d.push({func:t})}else if(t.isExportDefaultDeclaration()){const e=t.get("declaration");f(e,L.DefaultExportDeclaration)}else if(t.isExportNamedDeclaration()){const e=t.get("declaration");f(e,L.NamedExportDeclaration)}else if(t.isImportDeclaration()){const e=t.node.source.value;(e.startsWith(".")||e.startsWith("/"))&&c.push(e)}else t.isTSInterfaceDeclaration||t.isTSTypeAliasDeclaration()||e.errors.push({message:`Unsupported ${r} type: ${t.type}`,node:t.node,severity:"error"})};for(const t of a){if("app"===n.appType&&e===n.entry&&t.isExpressionStatement()){const n=t.get("expression");if(n.isCallExpression()){const t=n.get("callee");if(t.isIdentifier()&&l(t,"render")){const t=n.get("arguments");if(1!==t.length){e.errors.push({message:`render() expects exactly one argument, received: ${t.length}`,node:n.node,severity:"error"});continue}p=t[0];continue}}}f(t,L.TopLevelStatement)}for(const t of c)V(F(t,e.filePath,n.files),n,void 0,r);for(const{func:t,exported:r}of d){const o=t.node.id;if(_(o)){const s="app"===n.appType&&"entry"===e.moduleType?"page":"template",a=D(t,e,s,i);if(a){const n={type:s,component:a};r?e.namedExports.set(o.name,n):e.internals.push(n)}}else{const n=M(t,e,i);if(n){const t={type:"function",function:n};r?e.namedExports.set(o.name,t):e.internals.push(t)}}}if(u){const n="entry"===e.moduleType?"view":"page"===e.moduleType?"page":"template",t=D(u,e,n,i);t&&(e.defaultExport={type:n,component:t,..."view"===n?{title:C(t)}:{}})}if(p){const n=A(p,e,i);e.render={type:"render",children:n}}t.stop()}})}(u,n,t,o)}(0,t(47695).p)(class{parseView(e,n){return function(e,n){const t={appType:"view",modules:new Map,files:[{filePath:"View.tsx",content:e}],errors:[]};let s;try{s=(0,r.parse)(e,{plugins:["jsx","typescript"],sourceType:"module",errorRecovery:!0})}catch(e){return t.errors.push({message:`Failed to parse TSX: ${e}`,node:null,severity:"fatal"}),t}for(const e of s.program.body)if(o.isExportDefaultDeclaration(e)){if(o.isFunctionDeclaration(e.declaration))return V("View.tsx",t,s,n),t;break}return function(e,n,t,r){var o;const s=[];if(null!==(o=t.errors)&&void 0!==o&&o.length)for(const e of t.errors)s.push({message:`${e.code}: ${e.reasonCode}`,node:null,severity:"error"});const i=new Map,a={type:"view",bindingMap:i},d={component:a,contextBindings:null==r?void 0:r.withContexts},l={source:n.files.find((n=>n.filePath===e)).content,filePath:e,moduleType:"entry",defaultExport:{type:"view",component:a},internals:[],namedExports:new Map,errors:s,contracts:new Set,usedHelpers:new Set};B(t,{Program(e){const n=e.get("body");let t=!1;for(const e of n)if(e.isVariableDeclaration()){if(t){s.push({message:"Unexpected variable declaration after export",node:e.node,severity:"error"});continue}if("const"!==e.node.kind){s.push({message:`Only "const" variable declaration is allowed, received: ${e.node.kind}`,node:e.node,severity:"error"});continue}for(const n of e.get("declarations")){const e=n.get("id");if(!e.isIdentifier()){s.push({message:`Unsupported variable declaration pattern, expected: Identifier, received: ${e.type}`,node:e.node,severity:"error"});continue}const t={id:e.node,kind:"constant"},r=n.get("init");r.node&&(t.initialValue=y(r,l,d)),i.set(e.node,t)}}else if(e.isExportDefaultDeclaration()){t=!0;const n=e.get("declaration");n.isJSXElement()?a.children=A(n,l,d):s.push({message:`Default export must be a JSX element, received: ${n.type}`,node:e.node,severity:"error"});break}e.stop()}}),l.defaultExport.title=C(a),n.entry=l}("View.tsx",t,s,n),t}(e,n)}})}},x={};function $(e){var n=x[e];if(void 0!==n)return n.exports;var t=x[e]={exports:{}};return b[e].call(t.exports,t,t.exports,$),t.exports}$.m=b,$.c=x,$.x=()=>{var e=$.O(void 0,[8135,3735,580],(()=>$(41334)));return $.O(e)},e=[],$.O=(n,t,r,o)=>{if(!t){var s=1/0;for(l=0;l<e.length;l++){for(var[t,r,o]=e[l],i=!0,a=0;a<t.length;a++)(!1&o||s>=o)&&Object.keys($.O).every((e=>$.O[e](t[a])))?t.splice(a--,1):(i=!1,o<s&&(s=o));if(i){e.splice(l--,1);var d=r();void 0!==d&&(n=d)}}return n}o=o||0;for(var l=e.length;l>0&&e[l-1][2]>o;l--)e[l]=e[l-1];e[l]=[t,r,o]},$.d=(e,n)=>{for(var t in n)$.o(n,t)&&!$.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},$.f={},$.e=e=>Promise.all(Object.keys($.f).reduce(((n,t)=>($.f[t](e,n),n)),[])),$.u=e=>"chunks/"+e+"."+{3735:"8c1d82e7",6773:"afd27a30",8135:"3255c5ba"}[e]+".js",$.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),$.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),(()=>{$.S={};var e={},n={};$.I=(t,r)=>{r||(r=[]);var o=n[t];if(o||(o=n[t]={}),!(r.indexOf(o)>=0)){if(r.push(o),e[t])return e[t];$.o($.S,t)||($.S[t]={}),$.S[t];var s=[];return e[t]=s.length?Promise.all(s).then((()=>e[t]=1)):1}}})(),(()=>{var e;$.g.importScripts&&(e=$.g.location+"");var n=$.g.document;if(!e&&n&&(n.currentScript&&"SCRIPT"===n.currentScript.tagName.toUpperCase()&&(e=n.currentScript.src),!e)){var t=n.getElementsByTagName("script");if(t.length)for(var r=t.length-1;r>-1&&(!e||!/^http(s?):/.test(e));)e=t[r--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),$.p=e+"../"})(),n=e=>{var n=e=>e.split(".").map((e=>+e==e?+e:e)),t=/^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(e),r=t[1]?n(t[1]):[];return t[2]&&(r.length++,r.push.apply(r,n(t[2]))),t[3]&&(r.push([]),r.push.apply(r,n(t[3]))),r},t=(e,t)=>{e=n(e),t=n(t);for(var r=0;;){if(r>=e.length)return r<t.length&&"u"!=(typeof t[r])[0];var o=e[r],s=(typeof o)[0];if(r>=t.length)return"u"==s;var i=t[r],a=(typeof i)[0];if(s!=a)return"o"==s&&"n"==a||"s"==a||"u"==s;if("o"!=s&&"u"!=s&&o!=i)return o<i;r++}},r=e=>{var n=e[0],t="";if(1===e.length)return"*";if(n+.5){t+=0==n?">=":-1==n?"<":1==n?"^":2==n?"~":n>0?"=":"!=";for(var o=1,s=1;s<e.length;s++)o--,t+="u"==(typeof(a=e[s]))[0]?"-":(o>0?".":"")+(o=2,a);return t}var i=[];for(s=1;s<e.length;s++){var a=e[s];i.push(0===a?"not("+d()+")":1===a?"("+d()+" || "+d()+")":2===a?i.pop()+" "+i.pop():r(a))}return d();function d(){return i.pop().replace(/^\((.+)\)$/,"$1")}},o=(e,t)=>{if(0 in e){t=n(t);var r=e[0],s=r<0;s&&(r=-r-1);for(var i=0,a=1,d=!0;;a++,i++){var l,u,p=a<e.length?(typeof e[a])[0]:"";if(i>=t.length||"o"==(u=(typeof(l=t[i]))[0]))return!d||("u"==p?a>r&&!s:""==p!=s);if("u"==u){if(!d||"u"!=p)return!1}else if(d)if(p==u)if(a<=r){if(l!=e[a])return!1}else{if(s?l>e[a]:l<e[a])return!1;l!=e[a]&&(d=!1)}else if("s"!=p&&"n"!=p){if(s||a<=r)return!1;d=!1,a--}else{if(a<=r||u<p!=s)return!1;d=!1}else"s"!=p&&"n"!=p&&(d=!1,a--)}}var c=[],f=c.pop.bind(c);for(i=1;i<e.length;i++){var m=e[i];c.push(1==m?f()|f():2==m?f()&f():m?o(m,t):!f())}return!!f()},s=(e,n)=>e&&$.o(e,n),i=e=>(e.loaded=1,e.get()),a=e=>Object.keys(e).reduce(((n,t)=>(e[t].eager&&(n[t]=e[t]),n)),{}),d=(e,n,r)=>{var o=r?a(e[n]):e[n];return Object.keys(o).reduce(((e,n)=>!e||!o[e].loaded&&t(e,n)?n:e),0)},l=(e,n,t,o)=>"Unsatisfied version "+t+" from "+(t&&e[n][t].from)+" of shared singleton module "+n+" (required "+r(o)+")",u=e=>{throw new Error(e)},p=e=>{"undefined"!=typeof console&&console.warn&&console.warn(e)},c=(e,n,t)=>t?t():((e,n)=>u("Shared module "+n+" doesn't exist in shared scope "+e))(e,n),f=(e=>function(n,t,r,o,s){var i=$.I(n);return i&&i.then&&!r?i.then(e.bind(e,n,$.S[n],t,!1,o,s)):e(n,$.S[n],t,r,o,s)})(((e,n,t,r,a,u)=>{if(!s(n,t))return c(e,t,u);var f=d(n,t,r);return o(a,f)||p(l(n,t,f,a)),i(n[t][f])})),m={},g={40580:()=>f("default","@babel/parser",!1,[0],(()=>$.e(6773).then((()=>()=>$(46773)))))},h={580:[40580]},y={},$.f.consumes=(e,n)=>{$.o(h,e)&&h[e].forEach((e=>{if($.o(m,e))return n.push(m[e]);if(!y[e]){var t=n=>{m[e]=0,$.m[e]=t=>{delete $.c[e],t.exports=n()}};y[e]=!0;var r=n=>{delete m[e],$.m[e]=t=>{throw delete $.c[e],n}};try{var o=g[e]();o.then?n.push(m[e]=o.then(t).catch(r)):t(o)}catch(e){r(e)}}}))},(()=>{var e={1334:1};$.f.i=(n,t)=>{e[n]||580!=n&&importScripts($.p+$.u(n))};var n=globalThis.webpackChunk_next_bricks_ai_portal=globalThis.webpackChunk_next_bricks_ai_portal||[],t=n.push.bind(n);n.push=n=>{var[r,o,s]=n;for(var i in o)$.o(o,i)&&($.m[i]=o[i]);for(s&&s($);r.length;)e[r.pop()]=1;t(n)}})(),v=$.x,$.x=()=>Promise.all([8135,3735,580].map($.e,$)).then(v),$.x()})();
2
- //# sourceMappingURL=1334.aae33a33.js.map