@ixo/editor 2.14.0 → 2.15.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.
@@ -704,8 +704,8 @@ function PropertyValueInput({ property, value, onChange, disabled = false }) {
704
704
  // src/mantine/components/Base/BaseContainer.tsx
705
705
  import { Card } from "@mantine/core";
706
706
  import React6 from "react";
707
- function BaseContainer({ children, onClick }) {
708
- return /* @__PURE__ */ React6.createElement(Card, { withBorder: true, radius: "lg", style: { width: "100%", cursor: onClick ? "pointer" : "default", position: "relative" }, onClick }, children);
707
+ function BaseContainer({ children, onClick, style }) {
708
+ return /* @__PURE__ */ React6.createElement(Card, { withBorder: true, radius: "lg", style: { width: "100%", cursor: onClick ? "pointer" : "default", position: "relative", ...style }, onClick }, children);
709
709
  }
710
710
 
711
711
  // src/mantine/blocks/components/ConditionBuilder/ConditionRow.tsx
@@ -1060,6 +1060,10 @@ function BaseTextArea({ ...props }) {
1060
1060
  Textarea,
1061
1061
  {
1062
1062
  minRows: 2,
1063
+ draggable: true,
1064
+ autosize: true,
1065
+ maxRows: 10,
1066
+ resize: "vertical",
1063
1067
  radius: "md",
1064
1068
  styles: {
1065
1069
  input: {
@@ -1319,7 +1323,18 @@ import { Checkbox, Group as Group2, Stack as Stack7, Text as Text4 } from "@mant
1319
1323
 
1320
1324
  // src/mantine/utils/iconMap.tsx
1321
1325
  import React16 from "react";
1322
- import { IconSquareCheck, IconPlus, IconUserDollar, IconFileText, IconCheckbox, IconNote, IconChecklist, IconThumbUp, IconBell } from "@tabler/icons-react";
1326
+ import {
1327
+ IconSquareCheck,
1328
+ IconPlus,
1329
+ IconUserDollar,
1330
+ IconFileText,
1331
+ IconCheckbox,
1332
+ IconNote,
1333
+ IconChecklist,
1334
+ IconThumbUp,
1335
+ IconBell,
1336
+ IconFeather
1337
+ } from "@tabler/icons-react";
1323
1338
  var ICON_MAP = {
1324
1339
  "square-check": IconSquareCheck,
1325
1340
  "file-text": IconFileText,
@@ -1329,7 +1344,8 @@ var ICON_MAP = {
1329
1344
  "thumb-up": IconThumbUp,
1330
1345
  bell: IconBell,
1331
1346
  plus: IconPlus,
1332
- "dollar-sign": IconUserDollar
1347
+ "dollar-sign": IconUserDollar,
1348
+ feather: IconFeather
1333
1349
  };
1334
1350
  var getIcon = (fallback = "square-check", key, color = "white", size = 26, stroke = 1.5) => {
1335
1351
  const validKey = key in ICON_MAP ? key : fallback;
@@ -15768,208 +15784,1486 @@ var DomainCreatorBlockSpec = createReactBlockSpec13(
15768
15784
  }
15769
15785
  );
15770
15786
 
15771
- // src/mantine/blocks/registry/blockRegistry.ts
15772
- var BlockRegistry = class {
15773
- constructor() {
15774
- this.blocks = /* @__PURE__ */ new Map();
15775
- }
15776
- register(entry) {
15777
- this.blocks.set(entry.type, entry);
15778
- }
15779
- get(type) {
15780
- return this.blocks.get(type);
15781
- }
15782
- getAll() {
15783
- return new Map(this.blocks);
15784
- }
15785
- getValidDependencies(type) {
15786
- const entry = this.get(type);
15787
- return entry?.validDependencies || [];
15788
- }
15789
- getPropSchema(type) {
15790
- const entry = this.get(type);
15791
- return entry?.propSchema;
15792
- }
15793
- isValidDependency(blockType, dependencyType) {
15794
- const validDeps = this.getValidDependencies(blockType);
15795
- return validDeps.includes(dependencyType);
15796
- }
15797
- };
15798
- var blockRegistry = new BlockRegistry();
15799
- blockRegistry.register({
15800
- type: "proposal",
15801
- propSchema: {
15802
- title: "",
15803
- description: "",
15804
- icon: "\u{1F4DD}",
15805
- proposalId: "",
15806
- status: "draft",
15807
- contractAddress: "",
15808
- coreAddress: "",
15809
- createdProposalId: ""
15810
- },
15811
- validDependencies: [],
15812
- defaultProps: {
15813
- icon: "\u{1F4DD}",
15814
- status: "draft"
15815
- }
15816
- });
15817
- blockRegistry.register({
15818
- type: "proposalVote",
15819
- propSchema: {
15820
- title: "",
15821
- subtitle: "",
15822
- icon: "\u{1F5F3}\uFE0F",
15823
- status: "open",
15824
- daysLeft: 0,
15825
- proposalId: "",
15826
- proposalBlockId: "",
15827
- proposalContractAddress: ""
15828
- },
15829
- validDependencies: ["proposal"],
15830
- defaultProps: {
15831
- icon: "\u{1F5F3}\uFE0F",
15832
- status: "open",
15833
- daysLeft: 0,
15834
- proposalBlockId: ""
15835
- }
15836
- });
15837
- blockRegistry.register({
15838
- type: "list",
15839
- propSchema: {
15840
- title: "",
15841
- did: "",
15842
- fragmentIdentifier: ""
15843
- },
15844
- validDependencies: [],
15845
- defaultProps: {}
15846
- });
15847
- blockRegistry.register({
15848
- type: "overview",
15849
- propSchema: {
15850
- did: ""
15851
- },
15852
- validDependencies: [],
15853
- defaultProps: {}
15854
- });
15855
- blockRegistry.register({
15856
- type: "enumChecklist",
15857
- propSchema: {
15858
- listType: "",
15859
- listConfig: "{}"
15860
- },
15861
- validDependencies: [],
15862
- defaultProps: {}
15863
- });
15864
- blockRegistry.register({
15865
- type: "notify",
15866
- propSchema: {
15867
- title: "",
15868
- description: "",
15869
- icon: "bell",
15870
- channel: "email",
15871
- to: "[]",
15872
- cc: "[]",
15873
- bcc: "[]",
15874
- subject: "",
15875
- body: "",
15876
- bodyType: "text",
15877
- from: "",
15878
- replyTo: "",
15879
- templateId: "",
15880
- templateVariables: "{}",
15881
- status: "idle",
15882
- messageId: "",
15883
- sentAt: "",
15884
- errorMessage: "",
15885
- conditions: ""
15886
- },
15887
- validDependencies: [],
15888
- defaultProps: {
15889
- icon: "bell",
15890
- channel: "email",
15891
- bodyType: "text",
15892
- status: "idle"
15893
- }
15894
- });
15895
- blockRegistry.register({
15896
- type: "bid",
15897
- propSchema: {
15898
- title: "",
15899
- description: "",
15900
- did: "",
15901
- selectedCollections: "[]",
15902
- adminAddress: ""
15903
- },
15904
- validDependencies: [],
15905
- defaultProps: {}
15906
- });
15907
- blockRegistry.register({
15908
- type: "claim",
15909
- propSchema: {
15910
- title: "",
15911
- description: "",
15912
- icon: "square-check",
15913
- deedDid: "",
15914
- selectedCollections: "[]",
15915
- adminAddress: ""
15916
- },
15917
- validDependencies: [],
15918
- defaultProps: {
15919
- icon: "square-check"
15920
- }
15921
- });
15922
- blockRegistry.register({
15923
- type: "domainCreator",
15924
- propSchema: {
15925
- title: "",
15926
- description: "",
15927
- icon: "file-text",
15928
- surveySchema: "",
15929
- answers: "",
15930
- lastSubmission: ""
15931
- },
15932
- validDependencies: [],
15933
- defaultProps: {
15934
- icon: "file-text",
15935
- surveySchema: "",
15936
- answers: "",
15937
- lastSubmission: ""
15938
- }
15939
- });
15787
+ // src/mantine/blocks/protocolSelector/ProtocolSelectorBlockSpec.tsx
15788
+ import React173 from "react";
15789
+ import { createReactBlockSpec as createReactBlockSpec14 } from "@blocknote/react";
15940
15790
 
15941
- // src/mantine/blocks/hooks/useBlockDependencies.ts
15942
- import { useMemo as useMemo48, useEffect as useEffect42, useState as useState59, useCallback as useCallback40 } from "react";
15791
+ // src/mantine/blocks/protocolSelector/ProtocolSelectorBlock.tsx
15792
+ import React172 from "react";
15943
15793
 
15944
- // src/mantine/blocks/hooks/useDependsOn.ts
15945
- import { useMemo as useMemo49 } from "react";
15794
+ // src/mantine/blocks/protocolSelector/template/TemplateView.tsx
15795
+ import React168, { useMemo as useMemo49 } from "react";
15946
15796
 
15947
- // src/mantine/blocks/index.ts
15948
- var blockSpecs = {
15949
- checkbox: CheckboxBlockSpec,
15950
- list: ListBlockSpec,
15951
- enumChecklist: EnumChecklistBlock,
15952
- overview: OverviewBlock,
15953
- proposal: ProposalBlockSpec,
15954
- apiRequest: ApiRequestBlockSpec,
15955
- notify: NotifyBlockSpec,
15956
- claim: ClaimBlockSpec,
15957
- bid: BidBlockSpec,
15958
- evaluator: EvaluatorBlockSpec,
15959
- domainCreator: DomainCreatorBlockSpec,
15960
- visualization: VisualizationBlockSpec,
15961
- dynamicList: DynamicListBlockSpec
15797
+ // src/mantine/blocks/protocolSelector/template/TemplateConfig.tsx
15798
+ import React167, { useCallback as useCallback40 } from "react";
15799
+
15800
+ // src/mantine/blocks/protocolSelector/template/GeneralTab.tsx
15801
+ import React166, { useEffect as useEffect42, useMemo as useMemo48, useState as useState59 } from "react";
15802
+ import { Divider as Divider11, Stack as Stack113, Text as Text86, PillsInput as PillsInput2, Pill as Pill2, Box as Box30 } from "@mantine/core";
15803
+ var GeneralTab10 = ({ title, description, protocolDids, onTitleChange, onDescriptionChange, onProtocolDidsChange }) => {
15804
+ const [localTitle, setLocalTitle] = useState59(title || "");
15805
+ const [localDescription, setLocalDescription] = useState59(description || "");
15806
+ const [inputValue, setInputValue] = useState59("");
15807
+ const localDids = useMemo48(() => {
15808
+ try {
15809
+ const parsed = JSON.parse(protocolDids || "[]");
15810
+ return Array.isArray(parsed) ? parsed : [];
15811
+ } catch {
15812
+ return [];
15813
+ }
15814
+ }, [protocolDids]);
15815
+ useEffect42(() => {
15816
+ setLocalTitle(title || "");
15817
+ }, [title]);
15818
+ useEffect42(() => {
15819
+ setLocalDescription(description || "");
15820
+ }, [description]);
15821
+ const handleAddDid = () => {
15822
+ const trimmed = inputValue.trim();
15823
+ if (trimmed && !localDids.includes(trimmed)) {
15824
+ const newDids = [...localDids, trimmed];
15825
+ onProtocolDidsChange(JSON.stringify(newDids));
15826
+ setInputValue("");
15827
+ }
15828
+ };
15829
+ const handleRemoveDid = (didToRemove) => {
15830
+ const newDids = localDids.filter((did) => did !== didToRemove);
15831
+ onProtocolDidsChange(JSON.stringify(newDids));
15832
+ };
15833
+ return /* @__PURE__ */ React166.createElement(Stack113, { gap: "lg" }, /* @__PURE__ */ React166.createElement(Stack113, { gap: "xs" }, /* @__PURE__ */ React166.createElement(Text86, { size: "sm", fw: 600 }, "Title"), /* @__PURE__ */ React166.createElement(
15834
+ BaseTextInput,
15835
+ {
15836
+ placeholder: "e.g. Select type of the domain",
15837
+ value: localTitle,
15838
+ onChange: (event) => {
15839
+ const newTitle = event.currentTarget.value;
15840
+ setLocalTitle(newTitle);
15841
+ onTitleChange(newTitle);
15842
+ }
15843
+ }
15844
+ )), /* @__PURE__ */ React166.createElement(Stack113, { gap: "xs" }, /* @__PURE__ */ React166.createElement(
15845
+ BaseTextArea,
15846
+ {
15847
+ label: "Description",
15848
+ placeholder: "Describe what this selection is for",
15849
+ minRows: 3,
15850
+ value: localDescription,
15851
+ onChange: (event) => {
15852
+ const newDescription = event.currentTarget.value;
15853
+ setLocalDescription(newDescription);
15854
+ onDescriptionChange(newDescription);
15855
+ }
15856
+ }
15857
+ )), /* @__PURE__ */ React166.createElement(Divider11, { variant: "dashed" }), /* @__PURE__ */ React166.createElement(Stack113, { gap: "xs" }, /* @__PURE__ */ React166.createElement(Text86, { size: "sm", fw: 600 }, "Protocol DIDs"), /* @__PURE__ */ React166.createElement(Text86, { size: "xs", c: "dimmed" }, "Add the protocol DIDs that users can select from. Enter a DID and press Enter to add it."), /* @__PURE__ */ React166.createElement(PillsInput2, null, /* @__PURE__ */ React166.createElement(Pill2.Group, null, localDids.map((did) => /* @__PURE__ */ React166.createElement(Pill2, { key: did, withRemoveButton: true, onRemove: () => handleRemoveDid(did) }, did.length > 30 ? `${did.slice(0, 15)}...${did.slice(-12)}` : did)), /* @__PURE__ */ React166.createElement(
15858
+ PillsInput2.Field,
15859
+ {
15860
+ placeholder: localDids.length === 0 ? "Enter protocol DID and press Enter" : "",
15861
+ value: inputValue,
15862
+ onChange: (event) => setInputValue(event.currentTarget.value),
15863
+ onKeyDown: (event) => {
15864
+ if (event.key === "Enter") {
15865
+ event.preventDefault();
15866
+ handleAddDid();
15867
+ }
15868
+ }
15869
+ }
15870
+ ))), localDids.length > 0 && /* @__PURE__ */ React166.createElement(Box30, { mt: "xs" }, /* @__PURE__ */ React166.createElement(Text86, { size: "xs", c: "dimmed" }, localDids.length, " protocol", localDids.length !== 1 ? "s" : "", " configured"))));
15962
15871
  };
15963
- var getExtraSlashMenuItems = (editor) => {
15964
- const slashMenuList = [
15872
+
15873
+ // src/mantine/blocks/protocolSelector/template/TemplateConfig.tsx
15874
+ var TemplateConfig10 = ({ editor, block }) => {
15875
+ const { closePanel } = usePanelStore();
15876
+ const updateProp = useCallback40(
15877
+ (key, value) => {
15878
+ editor.updateBlock(block, {
15879
+ props: {
15880
+ ...block.props,
15881
+ [key]: value
15882
+ }
15883
+ });
15884
+ },
15885
+ [editor, block]
15886
+ );
15887
+ return /* @__PURE__ */ React167.createElement(BaseRightPanelLayout, { title: "Protocol Selector Settings", onClose: closePanel }, /* @__PURE__ */ React167.createElement(
15888
+ ReusablePanel,
15965
15889
  {
15966
- title: "Checkbox",
15967
- onItemClick: () => {
15968
- editor.insertBlocks(
15969
- [
15890
+ extraTabs: [
15891
+ {
15892
+ label: "General",
15893
+ value: "general",
15894
+ content: /* @__PURE__ */ React167.createElement(
15895
+ GeneralTab10,
15970
15896
  {
15971
- type: "checkbox",
15972
- props: {
15897
+ title: block.props.title || "",
15898
+ description: block.props.description || "",
15899
+ protocolDids: block.props.protocolDids || "[]",
15900
+ onTitleChange: (value) => updateProp("title", value),
15901
+ onDescriptionChange: (value) => updateProp("description", value),
15902
+ onProtocolDidsChange: (value) => updateProp("protocolDids", value)
15903
+ }
15904
+ )
15905
+ }
15906
+ ],
15907
+ context: { editor, block }
15908
+ }
15909
+ ));
15910
+ };
15911
+
15912
+ // src/mantine/blocks/protocolSelector/template/TemplateView.tsx
15913
+ import { Box as Box31, Group as Group51, Stack as Stack114, Text as Text87 } from "@mantine/core";
15914
+ import { IconCircleDashed as IconCircleDashed2 } from "@tabler/icons-react";
15915
+ var PROTOCOL_SELECTOR_TEMPLATE_PANEL_ID = "protocol-selector-template-panel";
15916
+ var ProtocolSelectorTemplateView = ({ editor, block }) => {
15917
+ const panelId = `${PROTOCOL_SELECTOR_TEMPLATE_PANEL_ID}-${block.id}`;
15918
+ const panelContent = useMemo49(() => /* @__PURE__ */ React168.createElement(TemplateConfig10, { editor, block }), [editor, block]);
15919
+ const { open } = usePanel(panelId, panelContent);
15920
+ const protocolDids = useMemo49(() => {
15921
+ try {
15922
+ const parsed = JSON.parse(block.props.protocolDids || "[]");
15923
+ return Array.isArray(parsed) ? parsed : [];
15924
+ } catch {
15925
+ return [];
15926
+ }
15927
+ }, [block.props.protocolDids]);
15928
+ return /* @__PURE__ */ React168.createElement(BaseContainer, { onClick: open }, /* @__PURE__ */ React168.createElement(Group51, { wrap: "nowrap", justify: "space-between", align: "center" }, /* @__PURE__ */ React168.createElement(Group51, { wrap: "nowrap", align: "center", gap: "md" }, /* @__PURE__ */ React168.createElement(
15929
+ Box31,
15930
+ {
15931
+ style: {
15932
+ width: 40,
15933
+ height: 40,
15934
+ borderRadius: "50%",
15935
+ border: "2px dashed var(--mantine-color-dark-3)",
15936
+ display: "flex",
15937
+ alignItems: "center",
15938
+ justifyContent: "center"
15939
+ }
15940
+ },
15941
+ /* @__PURE__ */ React168.createElement(IconCircleDashed2, { size: 20, color: "var(--mantine-color-dark-3)" })
15942
+ ), /* @__PURE__ */ React168.createElement(Stack114, { gap: 2, style: { flex: 1 } }, /* @__PURE__ */ React168.createElement(Text87, { fw: 500, size: "sm", contentEditable: false, lineClamp: 1 }, block.props.title || "Select type of the do..."), /* @__PURE__ */ React168.createElement(Text87, { size: "xs", c: "dimmed", contentEditable: false }, "Selection"))), /* @__PURE__ */ React168.createElement(Stack114, { gap: 2, align: "flex-end" }, /* @__PURE__ */ React168.createElement(Text87, { size: "sm", c: "dimmed", contentEditable: false }, "Pending"), /* @__PURE__ */ React168.createElement(Text87, { size: "xs", c: "dimmed", contentEditable: false }, protocolDids.length, " protocol", protocolDids.length !== 1 ? "s" : "", " configured"))));
15943
+ };
15944
+
15945
+ // src/mantine/blocks/protocolSelector/flow/FlowView.tsx
15946
+ import React171, { useMemo as useMemo51 } from "react";
15947
+ import { Badge as Badge24, Box as Box33, Group as Group53, Stack as Stack116, Text as Text89, Tooltip as Tooltip16 } from "@mantine/core";
15948
+ import { IconCircleDashed as IconCircleDashed3, IconChecks } from "@tabler/icons-react";
15949
+
15950
+ // src/mantine/blocks/protocolSelector/flow/ProtocolSelectionPanel.tsx
15951
+ import React170, { useState as useState60, useEffect as useEffect43, useMemo as useMemo50, useCallback as useCallback41 } from "react";
15952
+ import { Paper as Paper16, CloseButton as CloseButton9, Stack as Stack115, Text as Text88, Box as Box32, Group as Group52, Loader as Loader23 } from "@mantine/core";
15953
+
15954
+ // src/icons/EntityAvatar.tsx
15955
+ import React169 from "react";
15956
+ var EntityAvatar = ({ size = 32, style }) => {
15957
+ return /* @__PURE__ */ React169.createElement("svg", { width: size, height: size, viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", style }, /* @__PURE__ */ React169.createElement("rect", { width: "32", height: "32", rx: "16", fill: "#0B478E" }), /* @__PURE__ */ React169.createElement(
15958
+ "path",
15959
+ {
15960
+ fillRule: "evenodd",
15961
+ clipRule: "evenodd",
15962
+ d: "M22.4037 7.66251V10.0977H24.839C25.8991 10.0977 26.7482 10.0977 27.3639 10.1847C27.9691 10.2703 28.5581 10.4667 28.8008 11.0525C29.0434 11.6382 28.7658 12.1937 28.3983 12.6821C28.0245 13.179 27.4242 13.7794 26.6746 14.529L24.9528 16.2507L26.6745 17.9724C27.4242 18.722 28.0245 19.3224 28.3983 19.8194C28.7658 20.3077 29.0434 20.8632 28.8008 21.449C28.5581 22.0347 27.9691 22.2311 27.3639 22.3167C26.7482 22.4038 25.8991 22.4037 24.839 22.4037H22.4037V24.839C22.4037 25.8991 22.4038 26.7482 22.3167 27.3639C22.2311 27.9691 22.0347 28.5581 21.449 28.8008C20.8632 29.0434 20.3077 28.7658 19.8194 28.3983C19.3224 28.0245 18.7221 27.4242 17.9725 26.6746L16.2507 24.9528L14.529 26.6746C13.7794 27.4242 13.179 28.0245 12.6821 28.3983C12.1937 28.7658 11.6382 29.0434 11.0525 28.8008C10.4667 28.5581 10.2703 27.9691 10.1847 27.3639C10.0977 26.7482 10.0977 25.8991 10.0977 24.839V22.4037H7.6625C6.60236 22.4037 5.75328 22.4038 5.13756 22.3167C4.53241 22.2311 3.94331 22.0347 3.70068 21.449C3.45805 20.8632 3.73572 20.3077 4.10312 19.8194C4.47692 19.3224 5.07731 18.722 5.82693 17.9724L7.54864 16.2507L5.82695 14.529C5.07732 13.7794 4.47692 13.179 4.10312 12.6821C3.73572 12.1937 3.45805 11.6382 3.70068 11.0525C3.94331 10.4667 4.53241 10.2703 5.13756 10.1847C5.75327 10.0977 6.60233 10.0977 7.66245 10.0977H10.0977V7.66245C10.0977 6.60235 10.0977 5.75328 10.1847 5.13756C10.2703 4.53241 10.4667 3.94331 11.0525 3.70068C11.6382 3.45805 12.1937 3.73572 12.6821 4.10312C13.179 4.47692 13.7794 5.07731 14.529 5.82693L16.2507 7.54864L17.9724 5.82693C18.722 5.07732 19.3224 4.47692 19.8194 4.10312C20.3077 3.73572 20.8632 3.45805 21.449 3.70068C22.0347 3.94331 22.2311 4.53241 22.3167 5.13756C22.4038 5.75328 22.4037 6.60235 22.4037 7.66251ZM18.6213 6.53568C19.4077 5.74933 19.9604 5.19831 20.3964 4.8703C20.8476 4.53092 21.0089 4.55749 21.0816 4.58761C21.1543 4.61772 21.2871 4.71298 21.3662 5.27197C21.4426 5.81227 21.4437 6.59269 21.4437 7.7048V10.0977H18.7998L16.9295 8.22747L18.6213 6.53568ZM19.7598 11.0577H21.4437V12.7417L19.7598 11.0577ZM22.4037 11.0577V13.7017L24.274 15.5719L25.9658 13.8802C26.7521 13.0938 27.3031 12.5411 27.6311 12.105C27.9706 11.6539 27.944 11.4926 27.9139 11.4199C27.8837 11.3471 27.7885 11.2143 27.2295 11.1353C26.6892 11.0589 25.9087 11.0577 24.7967 11.0577H22.4037ZM20.9577 13.6132L21.4437 14.0993V14.7848C21.5751 15.2509 21.6453 15.7427 21.6453 16.2508C21.6453 16.7589 21.5751 17.2507 21.4437 17.7168V18.4022L20.9578 18.8881C20.4717 19.7538 19.7537 20.4718 18.8879 20.958L18.4022 21.4437H17.7171C17.2508 21.5751 16.759 21.6454 16.2507 21.6454C15.7423 21.6454 15.2505 21.5751 14.7842 21.4437H14.0993L13.6137 20.9581C12.7477 20.472 12.0294 19.7538 11.5433 18.8877L11.0577 18.4022V17.7173C10.9263 17.251 10.856 16.7591 10.856 16.2508C10.856 15.7425 10.9263 15.2506 11.0577 14.7842V14.0993L11.5434 13.6136C12.0295 12.7478 12.7476 12.0297 13.6134 11.5436L14.0993 11.0577H14.7846C15.2507 10.9264 15.7425 10.8561 16.2507 10.8561C16.7588 10.8561 17.2506 10.9264 17.7167 11.0577H18.4022L18.8882 11.5437C19.7538 12.0298 20.4716 12.7477 20.9577 13.6132ZM22.4037 15.0593V17.4422L23.5952 16.2507L22.4037 15.0593ZM19.7598 21.4437L21.4437 19.7598V21.4437H19.7598ZM22.4037 18.7998V21.4437H24.7967C25.9087 21.4437 26.6892 21.4426 27.2295 21.3662C27.7885 21.2871 27.8837 21.1543 27.9139 21.0816C27.944 21.0089 27.9706 20.8476 27.6311 20.3964C27.3031 19.9604 26.7521 19.4077 25.9658 18.6213L24.274 16.9295L22.4037 18.7998ZM18.7998 22.4037H21.4437V24.7967C21.4437 25.9087 21.4426 26.6892 21.3662 27.2295C21.2871 27.7885 21.1543 27.8837 21.0816 27.9139C21.0089 27.944 20.8476 27.9706 20.3964 27.6311C19.9604 27.3031 19.4077 26.7521 18.6213 25.9658L16.9295 24.274L18.7998 22.4037ZM17.4422 22.4037L16.2507 23.5952L15.0593 22.4037H17.4422ZM11.0577 19.7598L12.7417 21.4437H11.0577V19.7598ZM13.7017 22.4037H11.0577V24.7967C11.0577 25.9087 11.0589 26.6892 11.1353 27.2295C11.2143 27.7885 11.3471 27.8837 11.4199 27.9139C11.4926 27.944 11.6539 27.9706 12.105 27.6311C12.5411 27.3031 13.0938 26.7521 13.8802 25.9658L15.5719 24.274L13.7017 22.4037ZM10.0977 18.7998V21.4437H7.70477C6.59272 21.4437 5.81224 21.4426 5.27197 21.3662C4.71298 21.2871 4.61772 21.1543 4.58761 21.0816C4.55749 21.0089 4.53092 20.8476 4.8703 20.3964C5.19831 19.9604 5.74935 19.4077 6.53569 18.6213L8.22747 16.9295L10.0977 18.7998ZM10.0977 17.4422L8.90629 16.2507L10.0977 15.0593V17.4422ZM12.7417 11.0577L11.0577 12.7417V11.0577H12.7417ZM10.0977 13.7017V11.0577H7.70477C6.59272 11.0577 5.81224 11.0589 5.27197 11.1353C4.71298 11.2143 4.61772 11.3471 4.58761 11.4199C4.55749 11.4926 4.53092 11.6539 4.8703 12.105C5.19831 12.5411 5.74935 13.0938 6.53569 13.8802L8.22747 15.5719L10.0977 13.7017ZM13.7017 10.0977H11.0577V7.70475C11.0577 6.59269 11.0589 5.81227 11.1353 5.27197C11.2143 4.71298 11.3471 4.61772 11.4199 4.58761C11.4926 4.55749 11.6539 4.53092 12.105 4.8703C12.5411 5.19831 13.0938 5.74933 13.8802 6.53568L15.5719 8.22747L13.7017 10.0977ZM15.0593 10.0977L16.2507 8.90629L17.4422 10.0977H15.0593Z",
15963
+ fill: "url(#paint0_linear_entity)"
15964
+ }
15965
+ ), /* @__PURE__ */ React169.createElement(
15966
+ "path",
15967
+ {
15968
+ fillRule: "evenodd",
15969
+ clipRule: "evenodd",
15970
+ d: "M19.5819 8.21266L18.65 5.96285C18.2443 4.98338 17.9194 4.19893 17.6034 3.6634C17.2928 3.13706 16.8858 2.66797 16.2518 2.66797C15.6178 2.66797 15.2109 3.13706 14.9002 3.6634C14.5842 4.19892 14.2593 4.98336 13.8536 5.9628L12.9218 8.21229L10.6723 7.2805C9.69293 6.8748 8.9085 6.54989 8.30632 6.39469C7.71449 6.24216 7.09507 6.19821 6.64675 6.64653C6.19843 7.09485 6.24241 7.71426 6.39493 8.3061C6.55011 8.90824 6.87504 9.69266 7.28074 10.6721L8.21266 12.922L5.96279 13.8539C4.98336 14.2596 4.19892 14.5845 3.6634 14.9006C3.13706 15.2112 2.66797 15.6181 2.66797 16.2521C2.66797 16.8862 3.13706 17.2931 3.6634 17.6037C4.19891 17.9198 4.98331 18.2447 5.96269 18.6503L8.21229 19.5822L7.28052 21.8316C6.87482 22.8111 6.54988 23.5955 6.3947 24.1976C6.24218 24.7895 6.1982 25.4089 6.64652 25.8572C7.09484 26.3055 7.71426 26.2616 8.3061 26.109C8.90824 25.9538 9.69272 25.6289 10.6721 25.2232L12.922 24.2913L13.8539 26.5412C14.2596 27.5206 14.5845 28.305 14.9006 28.8406C15.2112 29.3669 15.6181 29.836 16.2521 29.836C16.8862 29.836 17.2931 29.3669 17.6037 28.8406C17.9198 28.305 18.2447 27.5207 18.6503 26.5413L19.5822 24.2916L21.8315 25.2234C22.811 25.6291 23.5955 25.9541 24.1976 26.1093C24.7895 26.2618 25.4089 26.3058 25.8572 25.8575C26.3055 25.4091 26.2616 24.7897 26.109 24.1979C25.9538 23.5957 25.6289 22.8113 25.2232 21.8319L24.2913 19.5819L26.5411 18.65C27.5206 18.2443 28.305 17.9194 28.8406 17.6034C29.3669 17.2928 29.836 16.8858 29.836 16.2518C29.836 15.6178 29.3669 15.2109 28.8406 14.9002C28.305 14.5842 27.5206 14.2593 26.5411 13.8536L24.2916 12.9218L25.2234 10.6723C25.6291 9.69293 25.9541 8.90845 26.1093 8.30632C26.2618 7.71448 26.3058 7.09506 25.8575 6.64674C25.4091 6.19842 24.7897 6.24242 24.1979 6.3949C23.5957 6.5501 22.8113 6.87506 21.8319 7.28072L19.5819 8.21266ZM15.727 4.15134C15.4497 4.62125 15.1499 5.34184 14.7243 6.36925L13.8088 8.57965L16.2524 9.59186L18.6951 8.58008L17.7793 6.36925C17.3537 5.34184 17.0539 4.62125 16.7766 4.15134C16.4897 3.66514 16.3305 3.62797 16.2518 3.62797C16.1731 3.62797 16.0139 3.66514 15.727 4.15134ZM19.0624 9.46701L17.5067 10.1114L19.7069 11.0227L19.0624 9.46701ZM20.9611 11.5423L19.9494 9.0996L22.1601 8.18386C23.1875 7.75832 23.9091 7.46072 24.4375 7.32456C24.9841 7.18365 25.123 7.26994 25.1786 7.32557C25.2343 7.3812 25.3206 7.52008 25.1796 8.06674C25.0435 8.59512 24.7459 9.31666 24.3203 10.3441L23.4048 12.5545L20.9611 11.5423ZM19.5888 12.013C19.9236 12.2768 20.2264 12.5795 20.4903 12.9142C21.0909 13.6758 21.4906 14.6031 21.6096 15.6163C21.634 15.8248 21.6466 16.037 21.6466 16.2521C21.6466 16.4674 21.6341 16.6798 21.6095 16.8886C21.4905 17.9012 21.091 18.828 20.4909 19.5893C20.2272 19.9237 19.9247 20.2263 19.5903 20.49C18.8286 21.091 17.9008 21.4909 16.8872 21.6097C16.6788 21.6342 16.4668 21.6468 16.252 21.6468C16.0367 21.6468 15.8244 21.6342 15.6159 21.6097C14.603 21.4907 13.6759 21.0911 12.9145 20.4907C12.5801 20.2271 12.2776 19.9247 12.0139 19.5904C11.4131 18.8287 11.0132 17.9009 10.8943 16.8874C10.8699 16.6791 10.8572 16.467 10.8572 16.2521C10.8572 16.0367 10.8699 15.8243 10.8944 15.6155C11.0135 14.603 11.4129 13.6762 12.013 12.915C12.2768 12.5803 12.5795 12.2776 12.9141 12.0137C13.6756 11.4132 14.603 11.0135 15.6161 10.8945C15.8246 10.87 16.0368 10.8574 16.252 10.8574C16.4674 10.8574 16.68 10.87 16.8889 10.8946C17.9012 11.0137 18.8278 11.4131 19.5888 12.013ZM22.3926 14.998L21.4807 12.7966L23.0374 13.4414L22.3926 14.998ZM22.3926 17.5067L21.4812 19.7068L23.037 19.0624L22.3926 17.5067ZM23.9239 18.6951L22.9121 16.2524L23.9243 13.8088L26.1347 14.7243C27.1621 15.1499 27.8827 15.4497 28.3526 15.727C28.8388 16.0139 28.876 16.1731 28.876 16.2518C28.876 16.3305 28.8388 16.4897 28.3526 16.7766C27.8827 17.0539 27.1621 17.3537 26.1347 17.7793L23.9239 18.6951ZM23.4043 19.9494L20.9617 20.9611L19.9495 23.4048L22.1599 24.3203C23.1873 24.7459 23.9088 25.0435 24.4372 25.1796C24.9839 25.3206 25.1227 25.2343 25.1784 25.1786C25.2341 25.123 25.3203 24.9841 25.1794 24.4375C25.0432 23.9091 24.7457 23.1875 24.3201 22.1601L23.4043 19.9494ZM19.0626 23.0374L19.7074 21.4807L17.5059 22.3926L19.0626 23.0374ZM14.9973 22.3926L12.7971 21.4812L13.4416 23.037L14.9973 22.3926ZM13.8089 23.9239L16.2516 22.9121L18.6952 23.9243L17.7796 26.1347C17.354 27.1621 17.0543 27.8827 16.777 28.3526C16.49 28.8388 16.3308 28.876 16.2521 28.876C16.1735 28.876 16.0143 28.8388 15.7273 28.3526C15.45 27.8827 15.1502 27.1621 14.7247 26.1347L13.8089 23.9239ZM12.5546 23.4043L11.5428 20.9617L9.09922 19.9495L8.18365 22.1599C7.75808 23.1873 7.46049 23.9088 7.32432 24.4372C7.18343 24.9839 7.26969 25.1227 7.32534 25.1784C7.38099 25.2341 7.51982 25.3203 8.06653 25.1794C8.5949 25.0432 9.3164 24.7457 10.3438 24.3201L12.5546 23.4043ZM9.46658 19.0626L11.0233 19.7074L10.1114 17.5059L9.46658 19.0626ZM10.1114 14.9973L11.0227 12.7971L9.46701 13.4416L10.1114 14.9973ZM8.58008 13.8089L9.59186 16.2516L8.57965 18.6952L6.36926 17.7796C5.34186 17.354 4.62125 17.0543 4.15134 16.777C3.66514 16.49 3.62797 16.3308 3.62797 16.2521C3.62797 16.1735 3.66514 16.0143 4.15134 15.7273C4.62125 15.45 5.34186 15.1502 6.36926 14.7247L8.58008 13.8089ZM9.0996 12.5546L11.5423 11.5428L12.5545 9.09922L10.3441 8.18365C9.31666 7.75805 8.59512 7.4605 8.06674 7.32434C7.52005 7.18344 7.38122 7.26968 7.32557 7.32536C7.26992 7.38098 7.18366 7.51981 7.32455 8.06653C7.46072 8.5949 7.7583 9.3164 8.18386 10.3438L9.0996 12.5546ZM13.4414 9.46658L12.7966 11.0233L14.998 10.1114L13.4414 9.46658Z",
15971
+ fill: "url(#paint1_linear_entity)"
15972
+ }
15973
+ ), /* @__PURE__ */ React169.createElement("defs", null, /* @__PURE__ */ React169.createElement("linearGradient", { id: "paint0_linear_entity", x1: "16.2507", y1: "2.55445", x2: "16.2507", y2: "29.947", gradientUnits: "userSpaceOnUse" }, /* @__PURE__ */ React169.createElement("stop", { stopColor: "#2BFFBF" }), /* @__PURE__ */ React169.createElement("stop", { offset: "1", stopColor: "#1BA897" })), /* @__PURE__ */ React169.createElement("linearGradient", { id: "paint1_linear_entity", x1: "10.3207", y1: "1.12708", x2: "20.2572", y2: "30.2205", gradientUnits: "userSpaceOnUse" }, /* @__PURE__ */ React169.createElement("stop", { stopColor: "#58F5FF" }), /* @__PURE__ */ React169.createElement("stop", { offset: "1", stopColor: "#1A7E8C" }))));
15974
+ };
15975
+ var EntityAvatar_default = EntityAvatar;
15976
+
15977
+ // src/mantine/blocks/protocolSelector/flow/ProtocolSelectionPanel.tsx
15978
+ var ProtocolSelectionPanel = ({ editor, block }) => {
15979
+ const { closePanel } = usePanelStore();
15980
+ const handlers = useBlocknoteHandlers();
15981
+ const protocolDids = useMemo50(() => {
15982
+ try {
15983
+ const parsed = JSON.parse(block.props.protocolDids || "[]");
15984
+ return Array.isArray(parsed) ? parsed : [];
15985
+ } catch {
15986
+ return [];
15987
+ }
15988
+ }, [block.props.protocolDids]);
15989
+ const [protocols, setProtocols] = useState60([]);
15990
+ useEffect43(() => {
15991
+ if (protocolDids.length === 0) {
15992
+ setProtocols([]);
15993
+ return;
15994
+ }
15995
+ const initialProtocols = protocolDids.map((did) => ({
15996
+ did,
15997
+ name: did,
15998
+ type: "Protocol",
15999
+ description: "",
16000
+ loading: true
16001
+ }));
16002
+ setProtocols(initialProtocols);
16003
+ protocolDids.forEach(async (did, index) => {
16004
+ try {
16005
+ if (handlers.getEntity) {
16006
+ const entity = await handlers.getEntity(did);
16007
+ console.log("entity", entity);
16008
+ let metadata = {};
16009
+ if (entity?.metadata) {
16010
+ try {
16011
+ metadata = typeof entity.metadata === "string" ? JSON.parse(entity.metadata) : entity.metadata;
16012
+ } catch {
16013
+ }
16014
+ }
16015
+ const rawType = entity?.type || "";
16016
+ const extractedType = rawType.includes("/") ? rawType.split("/").pop() || rawType : rawType;
16017
+ const displayType = extractedType.charAt(0).toUpperCase() + extractedType.slice(1);
16018
+ setProtocols(
16019
+ (prev) => prev.map(
16020
+ (p, i) => i === index ? {
16021
+ ...p,
16022
+ name: metadata?.name || entity?.id || did,
16023
+ type: displayType || "Protocol",
16024
+ description: metadata?.description || "",
16025
+ loading: false
16026
+ } : p
16027
+ )
16028
+ );
16029
+ } else {
16030
+ setProtocols(
16031
+ (prev) => prev.map(
16032
+ (p, i) => i === index ? {
16033
+ ...p,
16034
+ name: `Protocol ${index + 1}`,
16035
+ type: "Protocol",
16036
+ description: `DID: ${did}`,
16037
+ loading: false
16038
+ } : p
16039
+ )
16040
+ );
16041
+ }
16042
+ } catch (_error) {
16043
+ setProtocols(
16044
+ (prev) => prev.map(
16045
+ (p, i) => i === index ? {
16046
+ ...p,
16047
+ name: `Protocol ${index + 1}`,
16048
+ type: "Protocol",
16049
+ description: `DID: ${did}`,
16050
+ loading: false,
16051
+ error: "Failed to fetch entity info"
16052
+ } : p
16053
+ )
16054
+ );
16055
+ }
16056
+ });
16057
+ }, [protocolDids, handlers]);
16058
+ const handleSelectProtocol = useCallback41(
16059
+ (protocol) => {
16060
+ editor.updateBlock(block, {
16061
+ props: {
16062
+ ...block.props,
16063
+ selectedProtocolDid: protocol.did,
16064
+ selectedProtocolName: protocol.name,
16065
+ selectedProtocolType: protocol.type,
16066
+ status: "completed"
16067
+ }
16068
+ });
16069
+ closePanel();
16070
+ },
16071
+ [editor, block, closePanel]
16072
+ );
16073
+ const selectedDid = block.props.selectedProtocolDid;
16074
+ return /* @__PURE__ */ React170.createElement(
16075
+ Paper16,
16076
+ {
16077
+ p: "md",
16078
+ shadow: "sm",
16079
+ style: {
16080
+ height: "100%",
16081
+ display: "flex",
16082
+ flexDirection: "column",
16083
+ position: "relative"
16084
+ }
16085
+ },
16086
+ /* @__PURE__ */ React170.createElement(Group52, { justify: "space-between", align: "center", mb: "xl" }, /* @__PURE__ */ React170.createElement(Text88, { fz: 16, fw: 600 }, block.props.title || "Select Protocol"), /* @__PURE__ */ React170.createElement(CloseButton9, { onClick: closePanel })),
16087
+ /* @__PURE__ */ React170.createElement(Stack115, { gap: "sm", style: { flex: 1, overflow: "auto" } }, protocols.length === 0 ? /* @__PURE__ */ React170.createElement(Box32, { py: "md" }, /* @__PURE__ */ React170.createElement(Text88, { c: "dimmed", ta: "center" }, "No protocols configured.", /* @__PURE__ */ React170.createElement("br", null), "Add protocol DIDs in template mode.")) : protocols.map((protocol) => {
16088
+ const isSelected = protocol.did === selectedDid;
16089
+ return /* @__PURE__ */ React170.createElement(
16090
+ Box32,
16091
+ {
16092
+ key: protocol.did,
16093
+ onClick: () => !protocol.loading && handleSelectProtocol(protocol),
16094
+ style: {
16095
+ padding: "12px 16px",
16096
+ borderRadius: 12,
16097
+ border: isSelected ? "2px solid var(--mantine-primary-color-filled)" : "1px solid var(--mantine-color-dark-4)",
16098
+ backgroundColor: isSelected ? "var(--mantine-color-dark-6)" : "var(--mantine-color-dark-7)",
16099
+ cursor: protocol.loading ? "wait" : "pointer",
16100
+ transition: "all 0.15s ease",
16101
+ "&:hover": {
16102
+ backgroundColor: "var(--mantine-color-dark-6)"
16103
+ }
16104
+ }
16105
+ },
16106
+ /* @__PURE__ */ React170.createElement(Group52, { wrap: "nowrap", justify: "space-between", align: "flex-start" }, /* @__PURE__ */ React170.createElement(Group52, { wrap: "nowrap", align: "center", gap: "md", style: { flex: 1 } }, protocol.loading ? /* @__PURE__ */ React170.createElement(Loader23, { size: "xs", color: "white" }) : /* @__PURE__ */ React170.createElement(EntityAvatar_default, { size: 24 }), /* @__PURE__ */ React170.createElement(Stack115, { gap: 2, style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React170.createElement(Text88, { fw: 500, size: "sm", lineClamp: 1 }, protocol.loading ? "Loading..." : protocol.type), /* @__PURE__ */ React170.createElement(Text88, { size: "xs", c: "dimmed", lineClamp: 2 }, protocol.loading ? "Fetching protocol info..." : protocol.description || protocol.did))))
16107
+ );
16108
+ }))
16109
+ );
16110
+ };
16111
+
16112
+ // src/mantine/blocks/protocolSelector/flow/FlowView.tsx
16113
+ var PROTOCOL_SELECTOR_FLOW_PANEL_ID = "protocol-selector-flow-panel";
16114
+ var ProtocolSelectorFlowView = ({ editor, block, isDisabled }) => {
16115
+ const disabled = isDisabled?.isDisabled === "disable";
16116
+ const panelId = `${PROTOCOL_SELECTOR_FLOW_PANEL_ID}-${block.id}`;
16117
+ const isCompleted = block.props.status === "completed" && block.props.selectedProtocolDid;
16118
+ const panelContent = useMemo51(() => /* @__PURE__ */ React171.createElement(ProtocolSelectionPanel, { editor, block }), [editor, block]);
16119
+ const { open } = usePanel(panelId, panelContent);
16120
+ const handleClick = () => {
16121
+ if (disabled) return;
16122
+ open();
16123
+ };
16124
+ const containerContent = /* @__PURE__ */ React171.createElement(BaseContainer, { onClick: disabled ? void 0 : handleClick }, /* @__PURE__ */ React171.createElement(Group53, { wrap: "nowrap", justify: "space-between", align: "center" }, /* @__PURE__ */ React171.createElement(Group53, { wrap: "nowrap", align: "center", gap: "md" }, /* @__PURE__ */ React171.createElement(
16125
+ Box33,
16126
+ {
16127
+ style: {
16128
+ display: "flex",
16129
+ alignItems: "center",
16130
+ justifyContent: "center",
16131
+ opacity: disabled ? 0.5 : 1
16132
+ }
16133
+ },
16134
+ /* @__PURE__ */ React171.createElement(IconCircleDashed3, { size: 26, color: "white" })
16135
+ ), /* @__PURE__ */ React171.createElement(Stack116, { gap: 2, style: { flex: 1 } }, /* @__PURE__ */ React171.createElement(Text89, { fw: 500, size: "sm", lineClamp: 1, style: { opacity: disabled ? 0.5 : 1 } }, block.props.title || "Select Protocol"), isCompleted && block.props.selectedProtocolType ? /* @__PURE__ */ React171.createElement(Badge24, { size: "sm", styles: { root: { backgroundColor: "var(--mantine-primary-color-light)", color: "var(--mantine-primary-color-filled)" } } }, block.props.selectedProtocolType) : /* @__PURE__ */ React171.createElement(Text89, { size: "xs", c: "dimmed", style: { opacity: disabled ? 0.5 : 1 } }, "Selection"))), /* @__PURE__ */ React171.createElement(Stack116, { gap: 2, align: "flex-end" }, isCompleted ? /* @__PURE__ */ React171.createElement(React171.Fragment, null, /* @__PURE__ */ React171.createElement(Group53, { gap: 4 }, /* @__PURE__ */ React171.createElement(IconChecks, { size: 16, color: "var(--mantine-color-green-4)" }), /* @__PURE__ */ React171.createElement(Text89, { size: "sm", c: "green.4", fw: 500 }, "Completed")), /* @__PURE__ */ React171.createElement(Text89, { size: "xs", c: "dimmed", lineClamp: 1 }, block.props.selectedProtocolName || block.props.selectedProtocolDid)) : /* @__PURE__ */ React171.createElement(React171.Fragment, null, /* @__PURE__ */ React171.createElement(Text89, { size: "sm" }, "Pending"), /* @__PURE__ */ React171.createElement(Text89, { size: "xs", c: "dimmed" }, "Complete now")))));
16136
+ if (disabled && isDisabled?.message) {
16137
+ return /* @__PURE__ */ React171.createElement(Tooltip16, { label: isDisabled.message, position: "top", withArrow: true }, /* @__PURE__ */ React171.createElement(Box33, { style: { cursor: "not-allowed" } }, containerContent));
16138
+ }
16139
+ return containerContent;
16140
+ };
16141
+
16142
+ // src/mantine/blocks/protocolSelector/ProtocolSelectorBlock.tsx
16143
+ function ProtocolSelectorBlock({ editor, block }) {
16144
+ const { docType } = useBlocknoteContext();
16145
+ const { actions } = useBlockConditions(block, editor);
16146
+ if (docType === "template") {
16147
+ return /* @__PURE__ */ React172.createElement(ProtocolSelectorTemplateView, { editor, block });
16148
+ }
16149
+ const conditionConfig = parseConditionConfig(block.props.conditions);
16150
+ const hasVisibility = hasVisibilityConditions(conditionConfig);
16151
+ const showActionExists = actions.some((a) => a.action === "show");
16152
+ const shouldHide = hasVisibility && !showActionExists;
16153
+ if (shouldHide) {
16154
+ return null;
16155
+ }
16156
+ const hasEnable = hasEnableConditions(conditionConfig);
16157
+ const enableActionExists = actions.some((a) => a.action === "enable");
16158
+ const shouldDisable = hasEnable && !enableActionExists;
16159
+ return /* @__PURE__ */ React172.createElement(
16160
+ ProtocolSelectorFlowView,
16161
+ {
16162
+ block,
16163
+ editor,
16164
+ isDisabled: shouldDisable ? {
16165
+ isDisabled: "disable",
16166
+ message: "This protocol selector is currently disabled by conditions"
16167
+ } : void 0
16168
+ }
16169
+ );
16170
+ }
16171
+
16172
+ // src/mantine/blocks/protocolSelector/ProtocolSelectorBlockSpec.tsx
16173
+ var ProtocolSelectorBlockSpec = createReactBlockSpec14(
16174
+ {
16175
+ type: "protocolSelector",
16176
+ propSchema: {
16177
+ title: {
16178
+ default: ""
16179
+ },
16180
+ description: {
16181
+ default: ""
16182
+ },
16183
+ icon: {
16184
+ default: "git-branch"
16185
+ },
16186
+ protocolDids: {
16187
+ default: "[]"
16188
+ },
16189
+ selectedProtocolDid: {
16190
+ default: ""
16191
+ },
16192
+ selectedProtocolName: {
16193
+ default: ""
16194
+ },
16195
+ selectedProtocolType: {
16196
+ default: ""
16197
+ },
16198
+ status: {
16199
+ default: "pending"
16200
+ },
16201
+ conditions: {
16202
+ default: ""
16203
+ }
16204
+ },
16205
+ content: "none"
16206
+ },
16207
+ {
16208
+ render: (props) => {
16209
+ const ixoProps = props;
16210
+ return /* @__PURE__ */ React173.createElement(ProtocolSelectorBlock, { ...ixoProps });
16211
+ }
16212
+ }
16213
+ );
16214
+
16215
+ // src/mantine/blocks/form/FormBlockSpec.tsx
16216
+ import React180 from "react";
16217
+ import { createReactBlockSpec as createReactBlockSpec15 } from "@blocknote/react";
16218
+
16219
+ // src/mantine/blocks/form/FormBlock.tsx
16220
+ import React179 from "react";
16221
+
16222
+ // src/mantine/blocks/form/template/TemplateView.tsx
16223
+ import React176, { useMemo as useMemo52 } from "react";
16224
+ import { Badge as Badge25, Group as Group54, Stack as Stack117, Text as Text91 } from "@mantine/core";
16225
+
16226
+ // src/mantine/blocks/form/template/TemplateConfig.tsx
16227
+ import React175, { useCallback as useCallback42 } from "react";
16228
+ import { Paper as Paper17, CloseButton as CloseButton10, Title as Title13 } from "@mantine/core";
16229
+
16230
+ // src/mantine/blocks/form/template/GeneralTab.tsx
16231
+ import React174, { useEffect as useEffect44, useState as useState61 } from "react";
16232
+ import { Text as Text90 } from "@mantine/core";
16233
+ var GeneralTab11 = ({ title, description, icon, surveySchema, onTitleChange, onDescriptionChange, onIconChange, onSurveySchemaChange }) => {
16234
+ const [localTitle, setLocalTitle] = useState61(title || "");
16235
+ const [localDescription, setLocalDescription] = useState61(description || "");
16236
+ const [localIcon, setLocalIcon] = useState61(icon || "checklist");
16237
+ const [localSchema, setLocalSchema] = useState61(surveySchema || "");
16238
+ const [schemaError, setSchemaError] = useState61(null);
16239
+ useEffect44(() => setLocalTitle(title || ""), [title]);
16240
+ useEffect44(() => setLocalDescription(description || ""), [description]);
16241
+ useEffect44(() => setLocalIcon(icon || "checklist"), [icon]);
16242
+ useEffect44(() => setLocalSchema(surveySchema || ""), [surveySchema]);
16243
+ const handleSchemaChange = (value) => {
16244
+ setLocalSchema(value);
16245
+ setSchemaError(null);
16246
+ if (value.trim()) {
16247
+ try {
16248
+ JSON.parse(value);
16249
+ onSurveySchemaChange(value);
16250
+ } catch {
16251
+ setSchemaError("Invalid JSON format");
16252
+ }
16253
+ } else {
16254
+ onSurveySchemaChange("");
16255
+ }
16256
+ };
16257
+ return /* @__PURE__ */ React174.createElement(BaseSection, null, /* @__PURE__ */ React174.createElement(
16258
+ BaseTextInput,
16259
+ {
16260
+ label: "Title",
16261
+ placeholder: "e.g. Basic Information",
16262
+ value: localTitle,
16263
+ onChange: (event) => {
16264
+ const newValue = event.currentTarget.value;
16265
+ setLocalTitle(newValue);
16266
+ onTitleChange(newValue);
16267
+ }
16268
+ }
16269
+ ), /* @__PURE__ */ React174.createElement(
16270
+ BaseTextArea,
16271
+ {
16272
+ label: "Description",
16273
+ placeholder: "Short description of the form",
16274
+ minRows: 2,
16275
+ value: localDescription,
16276
+ onChange: (event) => {
16277
+ const newValue = event.currentTarget.value;
16278
+ setLocalDescription(newValue);
16279
+ onDescriptionChange(newValue);
16280
+ }
16281
+ }
16282
+ ), /* @__PURE__ */ React174.createElement(
16283
+ BaseTextInput,
16284
+ {
16285
+ label: "Icon",
16286
+ description: "Use a supported icon key (e.g. checklist, file-text, checkbox)",
16287
+ placeholder: "checklist",
16288
+ value: localIcon,
16289
+ onChange: (event) => {
16290
+ const newValue = event.currentTarget.value;
16291
+ setLocalIcon(newValue);
16292
+ onIconChange(newValue);
16293
+ }
16294
+ }
16295
+ ), /* @__PURE__ */ React174.createElement(
16296
+ BaseTextArea,
16297
+ {
16298
+ label: "Survey Schema (JSON)",
16299
+ description: "Paste your SurveyJS schema JSON here",
16300
+ placeholder: '{"elements": [{"type": "text", "name": "question1", "title": "Your question"}]}',
16301
+ minRows: 8,
16302
+ value: localSchema,
16303
+ onChange: (event) => handleSchemaChange(event.currentTarget.value),
16304
+ error: schemaError
16305
+ }
16306
+ ), localSchema && !schemaError && /* @__PURE__ */ React174.createElement(Text90, { size: "xs", c: "green" }, "\u2713 Valid JSON schema"));
16307
+ };
16308
+
16309
+ // src/mantine/blocks/form/template/TemplateConfig.tsx
16310
+ var TemplateConfig11 = ({ editor, block }) => {
16311
+ const { closePanel } = usePanelStore();
16312
+ const updateProp = useCallback42(
16313
+ (key, value) => {
16314
+ editor.updateBlock(block, {
16315
+ props: {
16316
+ ...block.props,
16317
+ [key]: value
16318
+ }
16319
+ });
16320
+ },
16321
+ [editor, block]
16322
+ );
16323
+ return /* @__PURE__ */ React175.createElement(
16324
+ Paper17,
16325
+ {
16326
+ p: "md",
16327
+ shadow: "sm",
16328
+ style: {
16329
+ height: "100%",
16330
+ display: "flex",
16331
+ flexDirection: "column"
16332
+ }
16333
+ },
16334
+ /* @__PURE__ */ React175.createElement(
16335
+ "div",
16336
+ {
16337
+ style: {
16338
+ display: "flex",
16339
+ justifyContent: "space-between",
16340
+ alignItems: "center",
16341
+ marginBottom: "1rem"
16342
+ }
16343
+ },
16344
+ /* @__PURE__ */ React175.createElement(Title13, { order: 3 }, "Form Settings"),
16345
+ /* @__PURE__ */ React175.createElement(CloseButton10, { onClick: closePanel })
16346
+ ),
16347
+ /* @__PURE__ */ React175.createElement(
16348
+ ReusablePanel,
16349
+ {
16350
+ extraTabs: [
16351
+ {
16352
+ label: "General",
16353
+ value: "general",
16354
+ content: /* @__PURE__ */ React175.createElement(
16355
+ GeneralTab11,
16356
+ {
16357
+ title: block.props.title || "",
16358
+ description: block.props.description || "",
16359
+ icon: block.props.icon || "checklist",
16360
+ surveySchema: block.props.surveySchema || "",
16361
+ onTitleChange: (value) => updateProp("title", value),
16362
+ onDescriptionChange: (value) => updateProp("description", value),
16363
+ onIconChange: (value) => updateProp("icon", value),
16364
+ onSurveySchemaChange: (value) => updateProp("surveySchema", value)
16365
+ }
16366
+ )
16367
+ }
16368
+ ],
16369
+ context: { editor, block }
16370
+ }
16371
+ )
16372
+ );
16373
+ };
16374
+
16375
+ // src/mantine/blocks/form/template/TemplateView.tsx
16376
+ var FORM_TEMPLATE_PANEL_ID = "form-template-panel";
16377
+ var FormTemplateView = ({ editor, block }) => {
16378
+ const panelId = `${FORM_TEMPLATE_PANEL_ID}-${block.id}`;
16379
+ const panelContent = useMemo52(() => /* @__PURE__ */ React176.createElement(TemplateConfig11, { editor, block }), [editor, block]);
16380
+ const { open } = usePanel(panelId, panelContent);
16381
+ const hasSchema = Boolean(block.props.surveySchema);
16382
+ return /* @__PURE__ */ React176.createElement(BaseContainer, { onClick: open }, /* @__PURE__ */ React176.createElement(Badge25, { size: "xs", variant: "light", color: "gray", style: { position: "absolute", top: 8, right: 8 } }, "Template"), /* @__PURE__ */ React176.createElement(Group54, { wrap: "nowrap", justify: "space-between", align: "center" }, /* @__PURE__ */ React176.createElement(Group54, { wrap: "nowrap", align: "center" }, getIcon("checklist", block.props.icon), /* @__PURE__ */ React176.createElement(Stack117, { gap: "xs", style: { flex: 1 } }, /* @__PURE__ */ React176.createElement(Text91, { fw: 500, size: "sm" }, block.props.title || "Form"), /* @__PURE__ */ React176.createElement(Text91, { size: "xs", c: "dimmed" }, hasSchema ? "Form configured" : "Click to configure form schema")))));
16383
+ };
16384
+
16385
+ // src/mantine/blocks/form/flow/FlowView.tsx
16386
+ import React178, { useMemo as useMemo54, useState as useState62, useCallback as useCallback44 } from "react";
16387
+ import { ActionIcon as ActionIcon26, Badge as Badge26, Group as Group56, Stack as Stack119, Text as Text93, Tooltip as Tooltip17 } from "@mantine/core";
16388
+ import { IconChevronRight as IconChevronRight7 } from "@tabler/icons-react";
16389
+
16390
+ // src/mantine/blocks/form/flow/FormPanel.tsx
16391
+ import React177, { useCallback as useCallback43, useEffect as useEffect45, useMemo as useMemo53, useRef as useRef10 } from "react";
16392
+ import { Alert as Alert23, CloseButton as CloseButton11, Group as Group55, Stack as Stack118, Text as Text92, Title as Title14 } from "@mantine/core";
16393
+ import { useDebouncedCallback as useDebouncedCallback2 } from "@mantine/hooks";
16394
+ import { IconAlertCircle as IconAlertCircle10 } from "@tabler/icons-react";
16395
+ import { Survey as Survey6, SurveyModel as SurveyModel6 } from "@ixo/surveys";
16396
+ var SYNC_DEBOUNCE_MS2 = 300;
16397
+ function deepEqual2(a, b) {
16398
+ if (a === b) return true;
16399
+ if (a === null || b === null) return a === b;
16400
+ if (typeof a !== typeof b) return false;
16401
+ if (typeof a !== "object") return false;
16402
+ if (Array.isArray(a) && Array.isArray(b)) {
16403
+ if (a.length !== b.length) return false;
16404
+ return a.every((item, index) => deepEqual2(item, b[index]));
16405
+ }
16406
+ if (Array.isArray(a) !== Array.isArray(b)) return false;
16407
+ const aObj = a;
16408
+ const bObj = b;
16409
+ const aKeys = Object.keys(aObj);
16410
+ const bKeys = Object.keys(bObj);
16411
+ if (aKeys.length !== bKeys.length) return false;
16412
+ return aKeys.every((key) => deepEqual2(aObj[key], bObj[key]));
16413
+ }
16414
+ var FormPanel = ({ editor, block, onComplete }) => {
16415
+ const { closePanel } = usePanelStore();
16416
+ const isUpdatingFromProp = useRef10(false);
16417
+ const lastSyncedAnswers = useRef10("");
16418
+ const surveySchema = useMemo53(() => {
16419
+ if (!block.props.surveySchema) return null;
16420
+ try {
16421
+ return JSON.parse(block.props.surveySchema);
16422
+ } catch {
16423
+ return null;
16424
+ }
16425
+ }, [block.props.surveySchema]);
16426
+ const surveyModel = useMemo53(() => {
16427
+ if (!surveySchema) return null;
16428
+ const model = new SurveyModel6(surveySchema);
16429
+ model.applyTheme(surveyTheme);
16430
+ model.showQuestionNumbers = "off";
16431
+ model.questionsOnPageMode = "singlePage";
16432
+ model.completeText = "Complete";
16433
+ return model;
16434
+ }, [surveySchema]);
16435
+ const syncPropToSurvey = useCallback43(
16436
+ (answersJson) => {
16437
+ if (!surveyModel || !answersJson || answersJson === lastSyncedAnswers.current) return;
16438
+ try {
16439
+ const answers = JSON.parse(answersJson);
16440
+ isUpdatingFromProp.current = true;
16441
+ Object.entries(answers).forEach(([key, value]) => {
16442
+ const currentValue = surveyModel.getValue(key);
16443
+ if (!deepEqual2(currentValue, value)) {
16444
+ surveyModel.setValue(key, value);
16445
+ }
16446
+ });
16447
+ lastSyncedAnswers.current = answersJson;
16448
+ } catch (err) {
16449
+ console.error("Failed to parse answers prop:", err);
16450
+ } finally {
16451
+ isUpdatingFromProp.current = false;
16452
+ }
16453
+ },
16454
+ [surveyModel]
16455
+ );
16456
+ const syncSurveyToProp = useDebouncedCallback2((data) => {
16457
+ const newAnswersJson = JSON.stringify(data);
16458
+ if (newAnswersJson === lastSyncedAnswers.current) return;
16459
+ lastSyncedAnswers.current = newAnswersJson;
16460
+ editor.updateBlock(block, {
16461
+ props: {
16462
+ ...block.props,
16463
+ answers: newAnswersJson
16464
+ }
16465
+ });
16466
+ }, SYNC_DEBOUNCE_MS2);
16467
+ useEffect45(() => {
16468
+ const answersJson = block.props.answers;
16469
+ if (answersJson) {
16470
+ syncPropToSurvey(answersJson);
16471
+ }
16472
+ }, [block.props.answers, syncPropToSurvey]);
16473
+ useEffect45(() => {
16474
+ if (!surveyModel) return;
16475
+ const handleValueChanged = () => {
16476
+ if (isUpdatingFromProp.current) return;
16477
+ syncSurveyToProp(surveyModel.data);
16478
+ };
16479
+ surveyModel.onValueChanged.add(handleValueChanged);
16480
+ return () => {
16481
+ surveyModel.onValueChanged.remove(handleValueChanged);
16482
+ };
16483
+ }, [surveyModel, syncSurveyToProp]);
16484
+ const handleSurveyComplete = useCallback43(
16485
+ (sender) => {
16486
+ const data = sender.data || {};
16487
+ const finalAnswersJson = JSON.stringify(data);
16488
+ lastSyncedAnswers.current = finalAnswersJson;
16489
+ editor.updateBlock(block, {
16490
+ props: {
16491
+ ...block.props,
16492
+ answers: finalAnswersJson,
16493
+ status: "completed",
16494
+ completedAt: (/* @__PURE__ */ new Date()).toISOString()
16495
+ }
16496
+ });
16497
+ onComplete?.();
16498
+ },
16499
+ [editor, block, onComplete]
16500
+ );
16501
+ useEffect45(() => {
16502
+ if (!surveyModel) return;
16503
+ surveyModel.onComplete.add(handleSurveyComplete);
16504
+ return () => {
16505
+ surveyModel.onComplete.remove(handleSurveyComplete);
16506
+ };
16507
+ }, [handleSurveyComplete, surveyModel]);
16508
+ const handleClose = useCallback43(() => {
16509
+ closePanel();
16510
+ }, [closePanel]);
16511
+ if (!surveySchema) {
16512
+ return /* @__PURE__ */ React177.createElement(Stack118, { gap: "md", p: "md" }, /* @__PURE__ */ React177.createElement(Group55, { justify: "space-between", align: "flex-start" }, /* @__PURE__ */ React177.createElement(Title14, { order: 5 }, block.props.title || "Form"), /* @__PURE__ */ React177.createElement(CloseButton11, { onClick: handleClose, title: "Close panel" })), /* @__PURE__ */ React177.createElement(Alert23, { icon: /* @__PURE__ */ React177.createElement(IconAlertCircle10, { size: 16 }), title: "Form Not Configured", color: "yellow" }, /* @__PURE__ */ React177.createElement(Text92, { size: "sm" }, "No survey schema has been configured for this form. Please configure it in template mode.")));
16513
+ }
16514
+ return /* @__PURE__ */ React177.createElement(Stack118, { bg: "#1a1a1a", gap: "md", p: "md" }, /* @__PURE__ */ React177.createElement(Group55, { justify: "space-between", align: "flex-start" }, /* @__PURE__ */ React177.createElement(Stack118, { gap: 4 }, /* @__PURE__ */ React177.createElement(Title14, { order: 5 }, block.props.title || "Form"), block.props.description && /* @__PURE__ */ React177.createElement(Text92, { size: "sm", c: "dimmed" }, block.props.description)), /* @__PURE__ */ React177.createElement(CloseButton11, { onClick: handleClose, title: "Close panel" })), surveyModel && /* @__PURE__ */ React177.createElement(Survey6, { model: surveyModel }));
16515
+ };
16516
+
16517
+ // src/mantine/blocks/form/flow/FlowView.tsx
16518
+ var FORM_FLOW_PANEL_ID = "form-flow-panel";
16519
+ var FormFlowView = ({ editor, block }) => {
16520
+ const [hasOpened, setHasOpened] = useState62(false);
16521
+ const status = block.props.status || "pending";
16522
+ const isCompleted = status === "completed";
16523
+ const handleComplete = useCallback44(() => {
16524
+ editor.updateBlock(block, {
16525
+ props: {
16526
+ ...block.props,
16527
+ status: "completed",
16528
+ completedAt: (/* @__PURE__ */ new Date()).toISOString()
16529
+ }
16530
+ });
16531
+ }, [editor, block]);
16532
+ const panelId = `${FORM_FLOW_PANEL_ID}-${block.id}`;
16533
+ const panelContent = useMemo54(() => /* @__PURE__ */ React178.createElement(FormPanel, { editor, block, onComplete: handleComplete }), [editor, block, handleComplete]);
16534
+ const { open } = usePanel(panelId, panelContent);
16535
+ const handleOpen = () => {
16536
+ setHasOpened(true);
16537
+ if (status === "pending") {
16538
+ editor.updateBlock(block, {
16539
+ props: {
16540
+ ...block.props,
16541
+ status: "in_progress"
16542
+ }
16543
+ });
16544
+ }
16545
+ open();
16546
+ };
16547
+ const getBadgeProps = () => {
16548
+ if (isCompleted) {
16549
+ return { variant: "light", color: "green", text: "Completed" };
16550
+ }
16551
+ if (status === "in_progress" || hasOpened) {
16552
+ return { variant: "light", color: "blue", text: "In Progress" };
16553
+ }
16554
+ return { variant: "light", color: "gray", text: "Pending" };
16555
+ };
16556
+ const badgeProps = getBadgeProps();
16557
+ const hasSchema = Boolean(block.props.surveySchema);
16558
+ return /* @__PURE__ */ React178.createElement(BaseContainer, { onClick: handleOpen }, /* @__PURE__ */ React178.createElement(Group56, { wrap: "nowrap", justify: "space-between", align: "center" }, /* @__PURE__ */ React178.createElement(Group56, { wrap: "nowrap", align: "center", style: { flex: 1 } }, getIcon("checklist", block.props.icon), /* @__PURE__ */ React178.createElement(Stack119, { gap: 4, style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React178.createElement(Group56, { gap: "xs", align: "center" }, /* @__PURE__ */ React178.createElement(Text93, { fw: 600, size: "sm" }, block.props.title || "Form"), /* @__PURE__ */ React178.createElement(
16559
+ Badge26,
16560
+ {
16561
+ size: "xs",
16562
+ variant: badgeProps.variant,
16563
+ color: badgeProps.color,
16564
+ styles: { root: { backgroundColor: `var(--mantine-color-${badgeProps.color}-6)`, color: "white" } }
16565
+ },
16566
+ badgeProps.text
16567
+ )), /* @__PURE__ */ React178.createElement(Text93, { size: "xs", c: "dimmed", lineClamp: 2 }, isCompleted ? `Completed on ${new Date(block.props.completedAt).toLocaleDateString()}` : (
16568
+ // : block.props.description || (hasSchema ? 'Click to fill out the form' : 'Form not configured')}
16569
+ hasSchema ? "Click to fill out the form" : "Form not configured"
16570
+ )))), /* @__PURE__ */ React178.createElement(Tooltip17, { label: isCompleted ? "View form" : "Fill form", withArrow: true }, /* @__PURE__ */ React178.createElement(ActionIcon26, { variant: "subtle", color: "blue" }, /* @__PURE__ */ React178.createElement(IconChevronRight7, { size: 18 })))));
16571
+ };
16572
+
16573
+ // src/mantine/blocks/form/FormBlock.tsx
16574
+ function FormBlock({ editor, block }) {
16575
+ const { docType } = useBlocknoteContext();
16576
+ if (docType === "template") {
16577
+ return /* @__PURE__ */ React179.createElement(FormTemplateView, { editor, block });
16578
+ }
16579
+ return /* @__PURE__ */ React179.createElement(FormFlowView, { editor, block });
16580
+ }
16581
+
16582
+ // src/mantine/blocks/form/FormBlockSpec.tsx
16583
+ var FormBlockSpec = createReactBlockSpec15(
16584
+ {
16585
+ type: "form",
16586
+ propSchema: {
16587
+ title: { default: "" },
16588
+ description: { default: "" },
16589
+ icon: { default: "checklist" },
16590
+ surveySchema: { default: "" },
16591
+ answers: { default: "" },
16592
+ status: { default: "pending" },
16593
+ completedAt: { default: "" }
16594
+ },
16595
+ content: "none"
16596
+ },
16597
+ {
16598
+ render: (props) => {
16599
+ const ixoProps = props;
16600
+ return /* @__PURE__ */ React180.createElement(FormBlock, { ...ixoProps });
16601
+ }
16602
+ }
16603
+ );
16604
+
16605
+ // src/mantine/blocks/domainCreatorSign/DomainCreatorSignBlockSpec.tsx
16606
+ import React187 from "react";
16607
+ import { createReactBlockSpec as createReactBlockSpec16 } from "@blocknote/react";
16608
+
16609
+ // src/mantine/blocks/domainCreatorSign/DomainCreatorSignBlock.tsx
16610
+ import React186 from "react";
16611
+
16612
+ // src/mantine/blocks/domainCreatorSign/template/TemplateView.tsx
16613
+ import React183, { useMemo as useMemo55 } from "react";
16614
+ import { Badge as Badge27, Group as Group57, Stack as Stack120, Text as Text94 } from "@mantine/core";
16615
+
16616
+ // src/mantine/blocks/domainCreatorSign/template/TemplateConfig.tsx
16617
+ import React182, { useCallback as useCallback45 } from "react";
16618
+ import { Paper as Paper18, CloseButton as CloseButton12, Title as Title15 } from "@mantine/core";
16619
+
16620
+ // src/mantine/blocks/domainCreatorSign/template/GeneralTab.tsx
16621
+ import React181, { useEffect as useEffect46, useState as useState63 } from "react";
16622
+ var GeneralTab12 = ({ title, description, icon, onTitleChange, onDescriptionChange, onIconChange }) => {
16623
+ const [localTitle, setLocalTitle] = useState63(title || "");
16624
+ const [localDescription, setLocalDescription] = useState63(description || "");
16625
+ const [localIcon, setLocalIcon] = useState63(icon || "file-text");
16626
+ useEffect46(() => setLocalTitle(title || ""), [title]);
16627
+ useEffect46(() => setLocalDescription(description || ""), [description]);
16628
+ useEffect46(() => setLocalIcon(icon || "file-text"), [icon]);
16629
+ return /* @__PURE__ */ React181.createElement(BaseSection, null, /* @__PURE__ */ React181.createElement(
16630
+ BaseTextInput,
16631
+ {
16632
+ label: "Title",
16633
+ placeholder: "e.g. Sign to Create Domain",
16634
+ value: localTitle,
16635
+ onChange: (event) => {
16636
+ const newValue = event.currentTarget.value;
16637
+ setLocalTitle(newValue);
16638
+ onTitleChange(newValue);
16639
+ }
16640
+ }
16641
+ ), /* @__PURE__ */ React181.createElement(
16642
+ BaseTextArea,
16643
+ {
16644
+ label: "Description",
16645
+ placeholder: "Short description",
16646
+ minRows: 2,
16647
+ value: localDescription,
16648
+ onChange: (event) => {
16649
+ const newValue = event.currentTarget.value;
16650
+ setLocalDescription(newValue);
16651
+ onDescriptionChange(newValue);
16652
+ }
16653
+ }
16654
+ ), /* @__PURE__ */ React181.createElement(
16655
+ BaseTextInput,
16656
+ {
16657
+ label: "Icon",
16658
+ description: "Use a supported icon key (e.g. file-text, checklist)",
16659
+ placeholder: "file-text",
16660
+ value: localIcon,
16661
+ onChange: (event) => {
16662
+ const newValue = event.currentTarget.value;
16663
+ setLocalIcon(newValue);
16664
+ onIconChange(newValue);
16665
+ }
16666
+ }
16667
+ ));
16668
+ };
16669
+
16670
+ // src/mantine/blocks/domainCreatorSign/template/TemplateConfig.tsx
16671
+ var TemplateConfig12 = ({ editor, block }) => {
16672
+ const { closePanel } = usePanelStore();
16673
+ const updateProp = useCallback45(
16674
+ (key, value) => {
16675
+ editor.updateBlock(block, {
16676
+ props: {
16677
+ ...block.props,
16678
+ [key]: value
16679
+ }
16680
+ });
16681
+ },
16682
+ [editor, block]
16683
+ );
16684
+ return /* @__PURE__ */ React182.createElement(
16685
+ Paper18,
16686
+ {
16687
+ p: "md",
16688
+ shadow: "sm",
16689
+ style: {
16690
+ height: "100%",
16691
+ display: "flex",
16692
+ flexDirection: "column"
16693
+ }
16694
+ },
16695
+ /* @__PURE__ */ React182.createElement(
16696
+ "div",
16697
+ {
16698
+ style: {
16699
+ display: "flex",
16700
+ justifyContent: "space-between",
16701
+ alignItems: "center",
16702
+ marginBottom: "1rem"
16703
+ }
16704
+ },
16705
+ /* @__PURE__ */ React182.createElement(Title15, { order: 5 }, "Sign to Create Settings"),
16706
+ /* @__PURE__ */ React182.createElement(CloseButton12, { onClick: closePanel })
16707
+ ),
16708
+ /* @__PURE__ */ React182.createElement(
16709
+ ReusablePanel,
16710
+ {
16711
+ extraTabs: [
16712
+ {
16713
+ label: "General",
16714
+ value: "general",
16715
+ content: /* @__PURE__ */ React182.createElement(
16716
+ GeneralTab12,
16717
+ {
16718
+ title: block.props.title || "",
16719
+ description: block.props.description || "",
16720
+ icon: block.props.icon || "file-text",
16721
+ onTitleChange: (value) => updateProp("title", value),
16722
+ onDescriptionChange: (value) => updateProp("description", value),
16723
+ onIconChange: (value) => updateProp("icon", value)
16724
+ }
16725
+ )
16726
+ }
16727
+ ],
16728
+ context: { editor, block }
16729
+ }
16730
+ )
16731
+ );
16732
+ };
16733
+
16734
+ // src/mantine/blocks/domainCreatorSign/template/TemplateView.tsx
16735
+ var DOMAIN_CREATOR_SIGN_TEMPLATE_PANEL_ID = "domain-creator-sign-template-panel";
16736
+ var DomainCreatorSignTemplateView = ({ editor, block }) => {
16737
+ const panelId = `${DOMAIN_CREATOR_SIGN_TEMPLATE_PANEL_ID}-${block.id}`;
16738
+ const panelContent = useMemo55(() => /* @__PURE__ */ React183.createElement(TemplateConfig12, { editor, block }), [editor, block]);
16739
+ const { open } = usePanel(panelId, panelContent);
16740
+ return /* @__PURE__ */ React183.createElement(BaseContainer, { onClick: open }, /* @__PURE__ */ React183.createElement(Badge27, { size: "xs", variant: "light", color: "gray", style: { position: "absolute", top: 8, right: 8 } }, "Template"), /* @__PURE__ */ React183.createElement(Group57, { wrap: "nowrap", justify: "space-between", align: "center" }, /* @__PURE__ */ React183.createElement(Group57, { wrap: "nowrap", align: "center" }, getIcon("feather", block.props.icon), /* @__PURE__ */ React183.createElement(Stack120, { gap: "xs", style: { flex: 1 } }, /* @__PURE__ */ React183.createElement(Text94, { fw: 500, size: "sm" }, block.props.title || "Sign to Create"), /* @__PURE__ */ React183.createElement(Text94, { size: "xs", c: "dimmed" }, "Sign")))));
16741
+ };
16742
+
16743
+ // src/mantine/blocks/domainCreatorSign/flow/FlowView.tsx
16744
+ import React185, { useCallback as useCallback47, useMemo as useMemo56, useEffect as useEffect47 } from "react";
16745
+ import { ActionIcon as ActionIcon27, Badge as Badge28, Button as Button33, Group as Group59, Stack as Stack122, Text as Text96, Tooltip as Tooltip18 } from "@mantine/core";
16746
+ import { IconChevronRight as IconChevronRight8, IconTestPipe, IconTrash as IconTrash5 } from "@tabler/icons-react";
16747
+
16748
+ // src/mantine/blocks/domainCreatorSign/flow/SignPanel.tsx
16749
+ import React184, { useCallback as useCallback46, useState as useState64 } from "react";
16750
+ import { Alert as Alert24, Button as Button32, CloseButton as CloseButton13, Group as Group58, Loader as Loader24, Stack as Stack121, Text as Text95, Title as Title16 } from "@mantine/core";
16751
+ import { IconAlertCircle as IconAlertCircle11, IconCheck as IconCheck5, IconSignature } from "@tabler/icons-react";
16752
+ var SignPanel = ({ editor, block, onComplete, onError }) => {
16753
+ const { closePanel } = usePanelStore();
16754
+ const { handlers } = useBlocknoteContext();
16755
+ const [flowStep, setFlowStep] = useState64(block.props.status === "completed" ? "success" : block.props.status === "error" ? "error" : "ready");
16756
+ const [error, setError] = useState64(block.props.errorMessage || null);
16757
+ const [createdEntityDid, setCreatedEntityDid] = useState64(block.props.entityDid || null);
16758
+ const getDomainCardData = useCallback46(() => {
16759
+ try {
16760
+ return JSON.parse(block.props.domainCardData || "{}");
16761
+ } catch {
16762
+ return null;
16763
+ }
16764
+ }, [block.props.domainCardData]);
16765
+ const processSignAndCreate = useCallback46(async () => {
16766
+ if (!handlers) {
16767
+ throw new Error("Handlers not available");
16768
+ }
16769
+ if (!handlers.signCredential) {
16770
+ throw new Error("signCredential handler not implemented");
16771
+ }
16772
+ if (!handlers.publicFileUpload) {
16773
+ throw new Error("publicFileUpload handler not available");
16774
+ }
16775
+ if (!handlers.createDomain) {
16776
+ throw new Error("createDomain handler not implemented");
16777
+ }
16778
+ if (!handlers.requestPin) {
16779
+ throw new Error("requestPin handler not available");
16780
+ }
16781
+ const domainCardData2 = getDomainCardData();
16782
+ if (!domainCardData2 || !domainCardData2.name) {
16783
+ throw new Error("Domain card data is missing or invalid");
16784
+ }
16785
+ const entityType = block.props.entityType || domainCardData2.type?.[0]?.replace("ixo:", "") || "dao";
16786
+ const issuerDid = handlers.getEntityDid?.() || handlers.getCurrentUser?.()?.address;
16787
+ if (!issuerDid) {
16788
+ throw new Error("Unable to determine issuer DID");
16789
+ }
16790
+ const entityDid = "did:ixo:entity:pending";
16791
+ const credentialSubject = {
16792
+ ...domainCardData2,
16793
+ id: entityDid
16794
+ };
16795
+ const unsignedCredential = buildVerifiableCredential({
16796
+ entityDid,
16797
+ issuerDid,
16798
+ credentialSubject,
16799
+ validFrom: domainCardData2.validFrom || (/* @__PURE__ */ new Date()).toISOString(),
16800
+ validUntil: domainCardData2.validUntil
16801
+ });
16802
+ setFlowStep("signing");
16803
+ editor.updateBlock(block, { props: { ...block.props, status: "signing" } });
16804
+ const pin = await handlers.requestPin({
16805
+ title: "Sign Domain Card",
16806
+ description: "Enter your PIN to sign the Domain Card credential",
16807
+ submitText: "Sign"
16808
+ });
16809
+ const { signedCredential } = await handlers.signCredential({
16810
+ issuerDid,
16811
+ issuerType: "user",
16812
+ credential: unsignedCredential,
16813
+ pin
16814
+ });
16815
+ setFlowStep("uploading");
16816
+ editor.updateBlock(block, { props: { ...block.props, status: "uploading" } });
16817
+ const credentialBlob = new Blob([JSON.stringify(signedCredential, null, 2)], {
16818
+ type: "application/json"
16819
+ });
16820
+ const credentialFile = new File([credentialBlob], "domainCard.json", {
16821
+ type: "application/json"
16822
+ });
16823
+ const uploadResult = await handlers.publicFileUpload(credentialFile);
16824
+ const domainCardLinkedResource = buildDomainCardLinkedResource({
16825
+ entityDid,
16826
+ cid: uploadResult.cid,
16827
+ serviceEndpoint: uploadResult.url,
16828
+ description: `Domain Card for ${domainCardData2.name || "Domain"}`
16829
+ });
16830
+ setFlowStep("creating");
16831
+ editor.updateBlock(block, { props: { ...block.props, status: "creating" } });
16832
+ const { entityDid: newEntityDid, transactionHash } = await handlers.createDomain({
16833
+ entityType,
16834
+ linkedResource: [domainCardLinkedResource],
16835
+ startDate: domainCardData2.validFrom,
16836
+ endDate: domainCardData2.validUntil
16837
+ });
16838
+ return {
16839
+ entityDid: newEntityDid,
16840
+ entityType,
16841
+ transactionHash
16842
+ };
16843
+ }, [handlers, getDomainCardData, block, editor]);
16844
+ const handleSign = useCallback46(async () => {
16845
+ try {
16846
+ const result = await processSignAndCreate();
16847
+ setCreatedEntityDid(result.entityDid);
16848
+ setFlowStep("success");
16849
+ onComplete?.(result);
16850
+ } catch (err) {
16851
+ console.error("Sign and create failed:", err);
16852
+ const errorMessage = err instanceof Error ? err.message : "Sign and create failed";
16853
+ setError(errorMessage);
16854
+ setFlowStep("error");
16855
+ onError?.(errorMessage);
16856
+ }
16857
+ }, [processSignAndCreate, onComplete, onError]);
16858
+ const handleRetry = useCallback46(() => {
16859
+ setFlowStep("ready");
16860
+ setError(null);
16861
+ editor.updateBlock(block, {
16862
+ props: {
16863
+ ...block.props,
16864
+ status: "ready",
16865
+ errorMessage: ""
16866
+ }
16867
+ });
16868
+ }, [editor, block]);
16869
+ const handleClose = useCallback46(() => {
16870
+ closePanel();
16871
+ }, [closePanel]);
16872
+ const handleVisitEntity = useCallback46(() => {
16873
+ const entityType = block.props.entityType || "dao";
16874
+ if (createdEntityDid && handlers?.redirectToEntityOverview) {
16875
+ handlers.redirectToEntityOverview(createdEntityDid, entityType);
16876
+ }
16877
+ }, [createdEntityDid, block.props.entityType, handlers]);
16878
+ if (flowStep === "signing" || flowStep === "uploading" || flowStep === "creating") {
16879
+ const stepMessages = {
16880
+ signing: "Signing Domain Card credential...",
16881
+ uploading: "Uploading credential to storage...",
16882
+ creating: "Creating domain entity..."
16883
+ };
16884
+ return /* @__PURE__ */ React184.createElement(Stack121, { gap: "md", p: "md", align: "center", justify: "center", style: { minHeight: 300 } }, /* @__PURE__ */ React184.createElement(Loader24, { size: "lg" }), /* @__PURE__ */ React184.createElement(Text95, { size: "sm", c: "dimmed" }, stepMessages[flowStep]));
16885
+ }
16886
+ if (flowStep === "success") {
16887
+ return /* @__PURE__ */ React184.createElement(Stack121, { gap: "md", p: "md" }, /* @__PURE__ */ React184.createElement(Group58, { justify: "space-between", align: "flex-start" }, /* @__PURE__ */ React184.createElement(Title16, { order: 5 }, block.props.title || "Sign to Create"), /* @__PURE__ */ React184.createElement(CloseButton13, { onClick: handleClose, title: "Close panel" })), /* @__PURE__ */ React184.createElement(Alert24, { icon: /* @__PURE__ */ React184.createElement(IconCheck5, { size: 16 }), title: "Domain Created Successfully", color: "green" }, /* @__PURE__ */ React184.createElement(Stack121, { gap: "xs" }, /* @__PURE__ */ React184.createElement(Text95, { size: "sm" }, "Your domain has been created and the Domain Card credential has been signed and stored."), createdEntityDid && /* @__PURE__ */ React184.createElement(Text95, { size: "xs", c: "dimmed" }, "Entity DID: ", createdEntityDid))), /* @__PURE__ */ React184.createElement(Button32, { onClick: handleVisitEntity }, "Visit Entity"));
16888
+ }
16889
+ if (flowStep === "error") {
16890
+ return /* @__PURE__ */ React184.createElement(Stack121, { gap: "md", p: "md" }, /* @__PURE__ */ React184.createElement(Group58, { justify: "space-between", align: "flex-start" }, /* @__PURE__ */ React184.createElement(Title16, { order: 5 }, block.props.title || "Sign to Create"), /* @__PURE__ */ React184.createElement(CloseButton13, { onClick: handleClose, title: "Close panel" })), /* @__PURE__ */ React184.createElement(Alert24, { icon: /* @__PURE__ */ React184.createElement(IconAlertCircle11, { size: 16 }), title: "Domain Creation Failed", color: "red" }, /* @__PURE__ */ React184.createElement(Text95, { size: "sm" }, error || "An unexpected error occurred")), /* @__PURE__ */ React184.createElement(Group58, null, /* @__PURE__ */ React184.createElement(Button32, { variant: "outline", onClick: handleRetry }, "Try Again"), /* @__PURE__ */ React184.createElement(Button32, { variant: "subtle", onClick: handleClose }, "Close")));
16891
+ }
16892
+ const domainCardData = getDomainCardData();
16893
+ return /* @__PURE__ */ React184.createElement(Stack121, { gap: "md", p: "md" }, /* @__PURE__ */ React184.createElement(Group58, { justify: "space-between", align: "flex-start" }, /* @__PURE__ */ React184.createElement(Stack121, { gap: 4 }, /* @__PURE__ */ React184.createElement(Title16, { order: 5 }, block.props.title || "Sign to Create"), /* @__PURE__ */ React184.createElement(Text95, { size: "sm", c: "dimmed" }, "Review and sign to create your domain.")), /* @__PURE__ */ React184.createElement(CloseButton13, { onClick: handleClose, title: "Close panel" })), /* @__PURE__ */ React184.createElement(Stack121, { gap: "xs", p: "md", style: { backgroundColor: "var(--mantine-color-dark-6)", borderRadius: 8 } }, /* @__PURE__ */ React184.createElement(Text95, { fw: 600, size: "sm" }, "Domain Card Summary"), /* @__PURE__ */ React184.createElement(Group58, { gap: "xs" }, /* @__PURE__ */ React184.createElement(Text95, { size: "xs", c: "dimmed", style: { width: 80 } }, "Name:"), /* @__PURE__ */ React184.createElement(Text95, { size: "xs" }, domainCardData?.name || "Not set")), /* @__PURE__ */ React184.createElement(Group58, { gap: "xs" }, /* @__PURE__ */ React184.createElement(Text95, { size: "xs", c: "dimmed", style: { width: 80 } }, "Type:"), /* @__PURE__ */ React184.createElement(Text95, { size: "xs" }, block.props.entityType || domainCardData?.type?.[0] || "dao")), domainCardData?.description && /* @__PURE__ */ React184.createElement(Group58, { gap: "xs", align: "flex-start" }, /* @__PURE__ */ React184.createElement(Text95, { size: "xs", c: "dimmed", style: { width: 80 } }, "Description:"), /* @__PURE__ */ React184.createElement(Text95, { size: "xs", lineClamp: 2, style: { flex: 1 } }, domainCardData.description))), /* @__PURE__ */ React184.createElement(Button32, { leftSection: /* @__PURE__ */ React184.createElement(IconSignature, { size: 18 }), onClick: handleSign, fullWidth: true }, "Sign & Create Domain"));
16894
+ };
16895
+
16896
+ // src/mantine/blocks/domainCreatorSign/flow/FlowView.tsx
16897
+ var DOMAIN_CREATOR_SIGN_FLOW_PANEL_ID = "domain-creator-sign-flow-panel";
16898
+ var IS_DEV = false;
16899
+ var DUMMY_DOMAIN_CARD_DATA = {
16900
+ type: ["ixo:dao"],
16901
+ name: "Test Domain",
16902
+ description: "A test domain created for development purposes.",
16903
+ keywords: ["test", "development", "demo"],
16904
+ url: "https://example.com"
16905
+ };
16906
+ function isDomainCardDataReady(domainCardData) {
16907
+ if (!domainCardData || domainCardData === "{}") return false;
16908
+ try {
16909
+ const parsed = JSON.parse(domainCardData);
16910
+ return Boolean(parsed && typeof parsed === "object" && parsed.name);
16911
+ } catch {
16912
+ return false;
16913
+ }
16914
+ }
16915
+ var DomainCreatorSignFlowView = ({ editor, block }) => {
16916
+ const status = block.props.status || "pending";
16917
+ const domainCardData = block.props.domainCardData || "{}";
16918
+ const isDataReady = isDomainCardDataReady(domainCardData);
16919
+ useEffect47(() => {
16920
+ if (status === "pending" && isDataReady) {
16921
+ editor.updateBlock(block, {
16922
+ props: {
16923
+ ...block.props,
16924
+ status: "ready"
16925
+ }
16926
+ });
16927
+ }
16928
+ }, [isDataReady, status, editor, block]);
16929
+ const handleComplete = useCallback47(
16930
+ (result) => {
16931
+ editor.updateBlock(block, {
16932
+ props: {
16933
+ ...block.props,
16934
+ status: "completed",
16935
+ entityDid: result.entityDid,
16936
+ transactionHash: result.transactionHash
16937
+ }
16938
+ });
16939
+ },
16940
+ [editor, block]
16941
+ );
16942
+ const handleError = useCallback47(
16943
+ (errorMessage) => {
16944
+ editor.updateBlock(block, {
16945
+ props: {
16946
+ ...block.props,
16947
+ status: "error",
16948
+ errorMessage
16949
+ }
16950
+ });
16951
+ },
16952
+ [editor, block]
16953
+ );
16954
+ const panelId = `${DOMAIN_CREATOR_SIGN_FLOW_PANEL_ID}-${block.id}`;
16955
+ const panelContent = useMemo56(() => /* @__PURE__ */ React185.createElement(SignPanel, { editor, block, onComplete: handleComplete, onError: handleError }), [editor, block, handleComplete, handleError]);
16956
+ const { open } = usePanel(panelId, panelContent);
16957
+ const handleOpen = () => {
16958
+ if (isDataReady || status === "completed" || status === "error") {
16959
+ open();
16960
+ }
16961
+ };
16962
+ const getBadgeProps = () => {
16963
+ switch (status) {
16964
+ case "completed":
16965
+ return { color: "green", text: "Created" };
16966
+ case "error":
16967
+ return { color: "red", text: "Error" };
16968
+ case "signing":
16969
+ case "uploading":
16970
+ case "creating":
16971
+ return { color: "blue", text: "In Progress" };
16972
+ case "ready":
16973
+ return { color: "teal", text: "Ready to sign" };
16974
+ default:
16975
+ return { color: "gray", text: "Waiting for data" };
16976
+ }
16977
+ };
16978
+ const badgeProps = getBadgeProps();
16979
+ const isClickable = isDataReady || status === "completed" || status === "error";
16980
+ const handlePrefillDummyData = useCallback47(
16981
+ (e) => {
16982
+ e.stopPropagation();
16983
+ editor.updateBlock(block, {
16984
+ props: {
16985
+ ...block.props,
16986
+ domainCardData: JSON.stringify(DUMMY_DOMAIN_CARD_DATA),
16987
+ entityType: "dao"
16988
+ }
16989
+ });
16990
+ },
16991
+ [editor, block]
16992
+ );
16993
+ const handleClearDummyData = useCallback47(
16994
+ (e) => {
16995
+ e.stopPropagation();
16996
+ editor.updateBlock(block, {
16997
+ props: {
16998
+ ...block.props,
16999
+ domainCardData: "{}",
17000
+ entityType: "",
17001
+ status: "pending"
17002
+ }
17003
+ });
17004
+ },
17005
+ [editor, block]
17006
+ );
17007
+ const getDescriptionText = () => {
17008
+ switch (status) {
17009
+ case "completed":
17010
+ return `Entity created: ${block.props.entityDid}`;
17011
+ case "error":
17012
+ return block.props.errorMessage || "An error occurred";
17013
+ case "ready":
17014
+ return "Click to sign and create the domain";
17015
+ default:
17016
+ return "Waiting for domain card data to be filled";
17017
+ }
17018
+ };
17019
+ return /* @__PURE__ */ React185.createElement(BaseContainer, { onClick: isClickable ? handleOpen : void 0, style: { opacity: isClickable ? 1 : 0.7, cursor: isClickable ? "pointer" : "not-allowed" } }, /* @__PURE__ */ React185.createElement(Group59, { wrap: "nowrap", justify: "space-between", align: "center" }, /* @__PURE__ */ React185.createElement(Group59, { wrap: "nowrap", align: "center", style: { flex: 1 } }, getIcon("feather", block.props.icon), /* @__PURE__ */ React185.createElement(Stack122, { gap: 4, style: { flex: 1, minWidth: 0 } }, /* @__PURE__ */ React185.createElement(Group59, { gap: "xs", align: "center" }, /* @__PURE__ */ React185.createElement(Text96, { fw: 600, size: "sm" }, block.props.title || "Sign to Create"), /* @__PURE__ */ React185.createElement(Badge28, { size: "xs", variant: "filled", color: badgeProps.color, styles: { root: { backgroundColor: `var(--mantine-color-${badgeProps.color}-6)`, color: "white" } } }, badgeProps.text)), /* @__PURE__ */ React185.createElement(Text96, { size: "xs", c: "dimmed", lineClamp: 2 }, getDescriptionText()))), IS_DEV && status === "pending" && !isDataReady && /* @__PURE__ */ React185.createElement(Button33, { size: "compact-xs", variant: "light", color: "orange", leftSection: /* @__PURE__ */ React185.createElement(IconTestPipe, { size: 14 }), onClick: handlePrefillDummyData }, "Test Data"), IS_DEV && isDataReady && /* @__PURE__ */ React185.createElement(Button33, { size: "compact-xs", variant: "light", color: "orange", leftSection: /* @__PURE__ */ React185.createElement(IconTrash5, { size: 14 }), onClick: handleClearDummyData }, "Clear Data"), isClickable && /* @__PURE__ */ React185.createElement(Tooltip18, { label: status === "completed" ? "View details" : "Sign & Create", withArrow: true }, /* @__PURE__ */ React185.createElement(ActionIcon27, { variant: "subtle", color: "blue" }, /* @__PURE__ */ React185.createElement(IconChevronRight8, { size: 18 })))));
17020
+ };
17021
+
17022
+ // src/mantine/blocks/domainCreatorSign/DomainCreatorSignBlock.tsx
17023
+ function DomainCreatorSignBlock({ editor, block }) {
17024
+ const { docType } = useBlocknoteContext();
17025
+ if (docType === "template") {
17026
+ return /* @__PURE__ */ React186.createElement(DomainCreatorSignTemplateView, { editor, block });
17027
+ }
17028
+ return /* @__PURE__ */ React186.createElement(DomainCreatorSignFlowView, { editor, block });
17029
+ }
17030
+
17031
+ // src/mantine/blocks/domainCreatorSign/DomainCreatorSignBlockSpec.tsx
17032
+ var DomainCreatorSignBlockSpec = createReactBlockSpec16(
17033
+ {
17034
+ type: "domainCreatorSign",
17035
+ propSchema: {
17036
+ title: { default: "" },
17037
+ description: { default: "" },
17038
+ icon: { default: "file-text" },
17039
+ // JSON string of credential subject data (oracle fills this)
17040
+ domainCardData: { default: "{}" },
17041
+ // Entity type from protocol selector or oracle
17042
+ entityType: { default: "" },
17043
+ // Status: pending | ready | signing | uploading | creating | completed | error
17044
+ status: { default: "pending" },
17045
+ // Created entity DID (after success)
17046
+ entityDid: { default: "" },
17047
+ // Transaction hash (after success)
17048
+ transactionHash: { default: "" },
17049
+ // Error message if failed
17050
+ errorMessage: { default: "" }
17051
+ },
17052
+ content: "none"
17053
+ },
17054
+ {
17055
+ render: (props) => {
17056
+ const ixoProps = props;
17057
+ return /* @__PURE__ */ React187.createElement(DomainCreatorSignBlock, { ...ixoProps });
17058
+ }
17059
+ }
17060
+ );
17061
+
17062
+ // src/mantine/blocks/registry/blockRegistry.ts
17063
+ var BlockRegistry = class {
17064
+ constructor() {
17065
+ this.blocks = /* @__PURE__ */ new Map();
17066
+ }
17067
+ register(entry) {
17068
+ this.blocks.set(entry.type, entry);
17069
+ }
17070
+ get(type) {
17071
+ return this.blocks.get(type);
17072
+ }
17073
+ getAll() {
17074
+ return new Map(this.blocks);
17075
+ }
17076
+ getValidDependencies(type) {
17077
+ const entry = this.get(type);
17078
+ return entry?.validDependencies || [];
17079
+ }
17080
+ getPropSchema(type) {
17081
+ const entry = this.get(type);
17082
+ return entry?.propSchema;
17083
+ }
17084
+ isValidDependency(blockType, dependencyType) {
17085
+ const validDeps = this.getValidDependencies(blockType);
17086
+ return validDeps.includes(dependencyType);
17087
+ }
17088
+ };
17089
+ var blockRegistry = new BlockRegistry();
17090
+ blockRegistry.register({
17091
+ type: "proposal",
17092
+ propSchema: {
17093
+ title: "",
17094
+ description: "",
17095
+ icon: "\u{1F4DD}",
17096
+ proposalId: "",
17097
+ status: "draft",
17098
+ contractAddress: "",
17099
+ coreAddress: "",
17100
+ createdProposalId: ""
17101
+ },
17102
+ validDependencies: [],
17103
+ defaultProps: {
17104
+ icon: "\u{1F4DD}",
17105
+ status: "draft"
17106
+ }
17107
+ });
17108
+ blockRegistry.register({
17109
+ type: "proposalVote",
17110
+ propSchema: {
17111
+ title: "",
17112
+ subtitle: "",
17113
+ icon: "\u{1F5F3}\uFE0F",
17114
+ status: "open",
17115
+ daysLeft: 0,
17116
+ proposalId: "",
17117
+ proposalBlockId: "",
17118
+ proposalContractAddress: ""
17119
+ },
17120
+ validDependencies: ["proposal"],
17121
+ defaultProps: {
17122
+ icon: "\u{1F5F3}\uFE0F",
17123
+ status: "open",
17124
+ daysLeft: 0,
17125
+ proposalBlockId: ""
17126
+ }
17127
+ });
17128
+ blockRegistry.register({
17129
+ type: "list",
17130
+ propSchema: {
17131
+ title: "",
17132
+ did: "",
17133
+ fragmentIdentifier: ""
17134
+ },
17135
+ validDependencies: [],
17136
+ defaultProps: {}
17137
+ });
17138
+ blockRegistry.register({
17139
+ type: "overview",
17140
+ propSchema: {
17141
+ did: ""
17142
+ },
17143
+ validDependencies: [],
17144
+ defaultProps: {}
17145
+ });
17146
+ blockRegistry.register({
17147
+ type: "enumChecklist",
17148
+ propSchema: {
17149
+ listType: "",
17150
+ listConfig: "{}"
17151
+ },
17152
+ validDependencies: [],
17153
+ defaultProps: {}
17154
+ });
17155
+ blockRegistry.register({
17156
+ type: "notify",
17157
+ propSchema: {
17158
+ title: "",
17159
+ description: "",
17160
+ icon: "bell",
17161
+ channel: "email",
17162
+ to: "[]",
17163
+ cc: "[]",
17164
+ bcc: "[]",
17165
+ subject: "",
17166
+ body: "",
17167
+ bodyType: "text",
17168
+ from: "",
17169
+ replyTo: "",
17170
+ templateId: "",
17171
+ templateVariables: "{}",
17172
+ status: "idle",
17173
+ messageId: "",
17174
+ sentAt: "",
17175
+ errorMessage: "",
17176
+ conditions: ""
17177
+ },
17178
+ validDependencies: [],
17179
+ defaultProps: {
17180
+ icon: "bell",
17181
+ channel: "email",
17182
+ bodyType: "text",
17183
+ status: "idle"
17184
+ }
17185
+ });
17186
+ blockRegistry.register({
17187
+ type: "bid",
17188
+ propSchema: {
17189
+ title: "",
17190
+ description: "",
17191
+ did: "",
17192
+ selectedCollections: "[]",
17193
+ adminAddress: ""
17194
+ },
17195
+ validDependencies: [],
17196
+ defaultProps: {}
17197
+ });
17198
+ blockRegistry.register({
17199
+ type: "claim",
17200
+ propSchema: {
17201
+ title: "",
17202
+ description: "",
17203
+ icon: "square-check",
17204
+ deedDid: "",
17205
+ selectedCollections: "[]",
17206
+ adminAddress: ""
17207
+ },
17208
+ validDependencies: [],
17209
+ defaultProps: {
17210
+ icon: "square-check"
17211
+ }
17212
+ });
17213
+ blockRegistry.register({
17214
+ type: "domainCreator",
17215
+ propSchema: {
17216
+ title: "",
17217
+ description: "",
17218
+ icon: "file-text",
17219
+ surveySchema: "",
17220
+ answers: "",
17221
+ lastSubmission: ""
17222
+ },
17223
+ validDependencies: [],
17224
+ defaultProps: {
17225
+ icon: "file-text",
17226
+ surveySchema: "",
17227
+ answers: "",
17228
+ lastSubmission: ""
17229
+ }
17230
+ });
17231
+
17232
+ // src/mantine/blocks/hooks/useBlockDependencies.ts
17233
+ import { useMemo as useMemo57, useEffect as useEffect48, useState as useState65, useCallback as useCallback48 } from "react";
17234
+
17235
+ // src/mantine/blocks/hooks/useDependsOn.ts
17236
+ import { useMemo as useMemo58 } from "react";
17237
+
17238
+ // src/mantine/blocks/index.ts
17239
+ var blockSpecs = {
17240
+ checkbox: CheckboxBlockSpec,
17241
+ list: ListBlockSpec,
17242
+ enumChecklist: EnumChecklistBlock,
17243
+ overview: OverviewBlock,
17244
+ proposal: ProposalBlockSpec,
17245
+ apiRequest: ApiRequestBlockSpec,
17246
+ notify: NotifyBlockSpec,
17247
+ claim: ClaimBlockSpec,
17248
+ bid: BidBlockSpec,
17249
+ evaluator: EvaluatorBlockSpec,
17250
+ domainCreator: DomainCreatorBlockSpec,
17251
+ visualization: VisualizationBlockSpec,
17252
+ dynamicList: DynamicListBlockSpec,
17253
+ protocolSelector: ProtocolSelectorBlockSpec,
17254
+ form: FormBlockSpec,
17255
+ domainCreatorSign: DomainCreatorSignBlockSpec
17256
+ };
17257
+ var getExtraSlashMenuItems = (editor) => {
17258
+ const slashMenuList = [
17259
+ {
17260
+ title: "Checkbox",
17261
+ onItemClick: () => {
17262
+ editor.insertBlocks(
17263
+ [
17264
+ {
17265
+ type: "checkbox",
17266
+ props: {
15973
17267
  checked: false,
15974
17268
  allowedCheckers: "all",
15975
17269
  initialChecked: false,
@@ -16226,6 +17520,87 @@ var getExtraSlashMenuItems = (editor) => {
16226
17520
  aliases: ["dynamic-list", "action-list", "ag-ui-list", "oracle-list"],
16227
17521
  group: "Basics",
16228
17522
  subtext: "Add a dynamic list from AG-UI with snapshot support"
17523
+ },
17524
+ {
17525
+ title: "Protocol Selector",
17526
+ onItemClick: () => {
17527
+ editor.insertBlocks(
17528
+ [
17529
+ {
17530
+ type: "protocolSelector",
17531
+ props: {
17532
+ title: "",
17533
+ description: "",
17534
+ icon: "git-branch",
17535
+ protocolDids: "[]",
17536
+ selectedProtocolDid: "",
17537
+ selectedProtocolName: "",
17538
+ status: "pending",
17539
+ conditions: ""
17540
+ }
17541
+ }
17542
+ ],
17543
+ editor.getTextCursorPosition().block,
17544
+ "after"
17545
+ );
17546
+ },
17547
+ aliases: ["protocol", "protocol-selector", "select-protocol", "domain-type"],
17548
+ group: "Domains",
17549
+ subtext: "Select a protocol from a predefined list"
17550
+ },
17551
+ {
17552
+ title: "Form",
17553
+ onItemClick: () => {
17554
+ editor.insertBlocks(
17555
+ [
17556
+ {
17557
+ type: "form",
17558
+ props: {
17559
+ title: "",
17560
+ description: "",
17561
+ icon: "checklist",
17562
+ surveySchema: "",
17563
+ answers: "",
17564
+ status: "pending",
17565
+ completedAt: ""
17566
+ }
17567
+ }
17568
+ ],
17569
+ editor.getTextCursorPosition().block,
17570
+ "after"
17571
+ );
17572
+ },
17573
+ aliases: ["form", "survey", "questionnaire", "input"],
17574
+ group: "Basics",
17575
+ subtext: "Add a configurable form with SurveyJS"
17576
+ },
17577
+ {
17578
+ title: "Sign to Create",
17579
+ onItemClick: () => {
17580
+ editor.insertBlocks(
17581
+ [
17582
+ {
17583
+ type: "domainCreatorSign",
17584
+ props: {
17585
+ title: "",
17586
+ description: "",
17587
+ icon: "feather",
17588
+ domainCardData: "{}",
17589
+ entityType: "",
17590
+ status: "pending",
17591
+ entityDid: "",
17592
+ transactionHash: "",
17593
+ errorMessage: ""
17594
+ }
17595
+ }
17596
+ ],
17597
+ editor.getTextCursorPosition().block,
17598
+ "after"
17599
+ );
17600
+ },
17601
+ aliases: ["domain-sign"],
17602
+ group: "Domains",
17603
+ subtext: "Sign domain card and create entity on-chain"
16229
17604
  }
16230
17605
  ];
16231
17606
  const yRoot = editor?._yRoot;
@@ -16306,15 +17681,15 @@ import { useCreateBlockNote as useCreateBlockNote2 } from "@blocknote/react";
16306
17681
  import { BlockNoteSchema as BlockNoteSchema2, defaultBlockSpecs as defaultBlockSpecs2, defaultInlineContentSpecs as defaultInlineContentSpecs2, defaultStyleSpecs as defaultStyleSpecs2 } from "@blocknote/core";
16307
17682
 
16308
17683
  // src/core/hooks/useMatrixProvider.ts
16309
- import { useEffect as useEffect43, useState as useState60, useRef as useRef10, useCallback as useCallback41, useMemo as useMemo50 } from "react";
17684
+ import { useEffect as useEffect49, useState as useState66, useRef as useRef11, useCallback as useCallback49, useMemo as useMemo59 } from "react";
16310
17685
  import { MatrixProvider } from "@ixo/matrix-crdt";
16311
17686
  function useMatrixProvider({ matrixClient, roomId, yDoc }) {
16312
- const [matrixProvider, setProvider] = useState60(null);
16313
- const [status, setStatus] = useState60("disconnected");
16314
- const isMountedRef = useRef10(true);
16315
- const providerRef = useRef10(null);
16316
- const retryTimeoutRef = useRef10(null);
16317
- const providerOptions = useMemo50(
17687
+ const [matrixProvider, setProvider] = useState66(null);
17688
+ const [status, setStatus] = useState66("disconnected");
17689
+ const isMountedRef = useRef11(true);
17690
+ const providerRef = useRef11(null);
17691
+ const retryTimeoutRef = useRef11(null);
17692
+ const providerOptions = useMemo59(
16318
17693
  () => ({
16319
17694
  translator: {
16320
17695
  updateEventType: "matrix-crdt.doc_update",
@@ -16327,22 +17702,22 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
16327
17702
  }),
16328
17703
  []
16329
17704
  );
16330
- const handleDocumentAvailable = useCallback41(() => {
17705
+ const handleDocumentAvailable = useCallback49(() => {
16331
17706
  if (isMountedRef.current) {
16332
17707
  setStatus("connected");
16333
17708
  }
16334
17709
  }, []);
16335
- const handleDocumentUnavailable = useCallback41(() => {
17710
+ const handleDocumentUnavailable = useCallback49(() => {
16336
17711
  if (isMountedRef.current) {
16337
17712
  setStatus("failed");
16338
17713
  }
16339
17714
  }, []);
16340
- const handleCanWriteChanged = useCallback41(() => {
17715
+ const handleCanWriteChanged = useCallback49(() => {
16341
17716
  if (isMountedRef.current && providerRef.current) {
16342
17717
  setStatus(providerRef.current.canWrite ? "connected" : "failed");
16343
17718
  }
16344
17719
  }, []);
16345
- const initProvider = useCallback41(async () => {
17720
+ const initProvider = useCallback49(async () => {
16346
17721
  if (!isMountedRef.current) return;
16347
17722
  if (retryTimeoutRef.current) {
16348
17723
  clearTimeout(retryTimeoutRef.current);
@@ -16375,7 +17750,7 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
16375
17750
  }
16376
17751
  }
16377
17752
  }, [matrixClient, providerOptions, handleDocumentAvailable, handleDocumentUnavailable, handleCanWriteChanged]);
16378
- useEffect43(() => {
17753
+ useEffect49(() => {
16379
17754
  isMountedRef.current = true;
16380
17755
  initProvider();
16381
17756
  return () => {
@@ -16392,7 +17767,7 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
16392
17767
  setStatus("disconnected");
16393
17768
  };
16394
17769
  }, [initProvider]);
16395
- useEffect43(() => {
17770
+ useEffect49(() => {
16396
17771
  return () => {
16397
17772
  isMountedRef.current = false;
16398
17773
  };
@@ -16401,17 +17776,17 @@ function useMatrixProvider({ matrixClient, roomId, yDoc }) {
16401
17776
  }
16402
17777
 
16403
17778
  // src/mantine/hooks/useCollaborativeYDoc.ts
16404
- import { useMemo as useMemo51 } from "react";
17779
+ import { useMemo as useMemo60 } from "react";
16405
17780
  import * as Y from "yjs";
16406
17781
  function useCollaborativeYDoc(_options) {
16407
- return useMemo51(() => {
17782
+ return useMemo60(() => {
16408
17783
  const doc = new Y.Doc();
16409
17784
  return doc;
16410
17785
  }, []);
16411
17786
  }
16412
17787
 
16413
17788
  // src/mantine/hooks/useCollaborativeIxoEditor.ts
16414
- import { useMemo as useMemo52, useEffect as useEffect44 } from "react";
17789
+ import { useMemo as useMemo61, useEffect as useEffect50 } from "react";
16415
17790
 
16416
17791
  // src/core/lib/matrixMetadata.ts
16417
17792
  var COVER_IMAGE_EVENT_TYPE = "ixo.page.cover_image";
@@ -16580,7 +17955,7 @@ function useCreateCollaborativeIxoEditor(options) {
16580
17955
  matrixClient,
16581
17956
  permissions = { write: false }
16582
17957
  } = options || {};
16583
- const memoizedUser = useMemo52(
17958
+ const memoizedUser = useMemo61(
16584
17959
  () => ({
16585
17960
  id: user?.id || "",
16586
17961
  name: user?.name || "",
@@ -16595,13 +17970,13 @@ function useCreateCollaborativeIxoEditor(options) {
16595
17970
  matrixClient,
16596
17971
  roomId: options.roomId
16597
17972
  });
16598
- const metadataManager = useMemo52(() => new MatrixMetadataManager(matrixClient, options.roomId), [matrixClient, options.roomId]);
16599
- useEffect44(() => {
17973
+ const metadataManager = useMemo61(() => new MatrixMetadataManager(matrixClient, options.roomId), [matrixClient, options.roomId]);
17974
+ useEffect50(() => {
16600
17975
  return () => {
16601
17976
  metadataManager.dispose();
16602
17977
  };
16603
17978
  }, [metadataManager]);
16604
- const defaultUploadFile = useMemo52(
17979
+ const defaultUploadFile = useMemo61(
16605
17980
  () => uploadFile || (async (file) => {
16606
17981
  return new Promise((resolve, reject) => {
16607
17982
  const reader = new FileReader();
@@ -16615,7 +17990,7 @@ function useCreateCollaborativeIxoEditor(options) {
16615
17990
  }),
16616
17991
  [uploadFile]
16617
17992
  );
16618
- const schema = useMemo52(
17993
+ const schema = useMemo61(
16619
17994
  () => BlockNoteSchema2.create({
16620
17995
  blockSpecs: {
16621
17996
  ...defaultBlockSpecs2,
@@ -16630,13 +18005,13 @@ function useCreateCollaborativeIxoEditor(options) {
16630
18005
  }),
16631
18006
  []
16632
18007
  );
16633
- const root = useMemo52(() => yDoc.getMap("root"), [yDoc]);
16634
- const documentFragment = useMemo52(() => yDoc.getXmlFragment("document"), [yDoc]);
16635
- const flowArray = useMemo52(() => yDoc.getArray("flow"), [yDoc]);
16636
- const runtimeMap = useMemo52(() => yDoc.getMap("runtime"), [yDoc]);
16637
- const delegationsMap = useMemo52(() => yDoc.getMap("delegations"), [yDoc]);
16638
- const userFragment = useMemo52(() => yDoc.getMap(memoizedUser.id), [yDoc, memoizedUser.id]);
16639
- const collaborationConfig = useMemo52(
18008
+ const root = useMemo61(() => yDoc.getMap("root"), [yDoc]);
18009
+ const documentFragment = useMemo61(() => yDoc.getXmlFragment("document"), [yDoc]);
18010
+ const flowArray = useMemo61(() => yDoc.getArray("flow"), [yDoc]);
18011
+ const runtimeMap = useMemo61(() => yDoc.getMap("runtime"), [yDoc]);
18012
+ const delegationsMap = useMemo61(() => yDoc.getMap("delegations"), [yDoc]);
18013
+ const userFragment = useMemo61(() => yDoc.getMap(memoizedUser.id), [yDoc, memoizedUser.id]);
18014
+ const collaborationConfig = useMemo61(
16640
18015
  () => ({
16641
18016
  provider: matrixProvider,
16642
18017
  fragment: documentFragment,
@@ -16648,7 +18023,7 @@ function useCreateCollaborativeIxoEditor(options) {
16648
18023
  }),
16649
18024
  [matrixProvider, documentFragment, memoizedUser.name, memoizedUser.color]
16650
18025
  );
16651
- const ixoConfig = useMemo52(
18026
+ const ixoConfig = useMemo61(
16652
18027
  () => ({
16653
18028
  theme,
16654
18029
  editable,
@@ -16667,7 +18042,7 @@ function useCreateCollaborativeIxoEditor(options) {
16667
18042
  uploadFile: defaultUploadFile,
16668
18043
  collaboration: collaborationConfig
16669
18044
  });
16670
- const titleText = useMemo52(() => yDoc.getText("title"), [yDoc]);
18045
+ const titleText = useMemo61(() => yDoc.getText("title"), [yDoc]);
16671
18046
  let ixoEditor;
16672
18047
  if (editor) {
16673
18048
  ixoEditor = editor;
@@ -16817,12 +18192,12 @@ function useCreateCollaborativeIxoEditor(options) {
16817
18192
  return void 0;
16818
18193
  };
16819
18194
  }
16820
- useEffect44(() => {
18195
+ useEffect50(() => {
16821
18196
  if (ixoEditor) {
16822
18197
  ixoEditor.isEditable = editable;
16823
18198
  }
16824
18199
  }, [ixoEditor, editable]);
16825
- useEffect44(() => {
18200
+ useEffect50(() => {
16826
18201
  if (connectionStatus !== "connected") {
16827
18202
  return;
16828
18203
  }
@@ -16855,8 +18230,8 @@ function useCreateCollaborativeIxoEditor(options) {
16855
18230
  }
16856
18231
 
16857
18232
  // src/mantine/components/CoverImage.tsx
16858
- import React167, { useState as useState61, useRef as useRef11, useEffect as useEffect45 } from "react";
16859
- import { Box as Box30, Group as Group51 } from "@mantine/core";
18233
+ import React189, { useState as useState67, useRef as useRef12, useEffect as useEffect51 } from "react";
18234
+ import { Box as Box34, Group as Group60 } from "@mantine/core";
16860
18235
 
16861
18236
  // src/core/lib/imageTransform.ts
16862
18237
  var CLOUDFLARE_CDN_BASE = "https://www.ixo.earth/cdn-cgi/image";
@@ -16989,11 +18364,11 @@ function transformIconImage(sourceUrl, size = "default", customOptions) {
16989
18364
  }
16990
18365
 
16991
18366
  // src/mantine/components/Base/CoverImageButton.tsx
16992
- import React166 from "react";
16993
- import { Button as Button32 } from "@mantine/core";
18367
+ import React188 from "react";
18368
+ import { Button as Button34 } from "@mantine/core";
16994
18369
  function CoverImageButton({ isActive = false, children, onClick, style }) {
16995
- return /* @__PURE__ */ React166.createElement(
16996
- Button32,
18370
+ return /* @__PURE__ */ React188.createElement(
18371
+ Button34,
16997
18372
  {
16998
18373
  onClick,
16999
18374
  variant: "filled",
@@ -17015,13 +18390,13 @@ function CoverImageButton({ isActive = false, children, onClick, style }) {
17015
18390
  // src/mantine/components/CoverImage.tsx
17016
18391
  function CoverImage({ coverImageUrl, logoUrl }) {
17017
18392
  const { editor, handlers, editable } = useBlocknoteContext();
17018
- const [isHovering, setIsHovering] = useState61(false);
17019
- const [isRepositioning, setIsRepositioning] = useState61(false);
17020
- const [coverPosition, setCoverPosition] = useState61(50);
17021
- const coverFileInputRef = useRef11(null);
17022
- const logoFileInputRef = useRef11(null);
17023
- const [metadata, setMetadata] = useState61(() => editor?.getPageMetadata?.() || null);
17024
- useEffect45(() => {
18393
+ const [isHovering, setIsHovering] = useState67(false);
18394
+ const [isRepositioning, setIsRepositioning] = useState67(false);
18395
+ const [coverPosition, setCoverPosition] = useState67(50);
18396
+ const coverFileInputRef = useRef12(null);
18397
+ const logoFileInputRef = useRef12(null);
18398
+ const [metadata, setMetadata] = useState67(() => editor?.getPageMetadata?.() || null);
18399
+ useEffect51(() => {
17025
18400
  if (!editor?._metadataManager) {
17026
18401
  return;
17027
18402
  }
@@ -17112,8 +18487,8 @@ function CoverImage({ coverImageUrl, logoUrl }) {
17112
18487
  return null;
17113
18488
  }
17114
18489
  if (!hasCover) {
17115
- return /* @__PURE__ */ React167.createElement(
17116
- Box30,
18490
+ return /* @__PURE__ */ React189.createElement(
18491
+ Box34,
17117
18492
  {
17118
18493
  style: {
17119
18494
  position: "relative",
@@ -17125,8 +18500,8 @@ function CoverImage({ coverImageUrl, logoUrl }) {
17125
18500
  onMouseEnter: () => editable && setIsHovering(true),
17126
18501
  onMouseLeave: () => editable && setIsHovering(false)
17127
18502
  },
17128
- /* @__PURE__ */ React167.createElement("div", { style: { maxWidth: "900px", margin: "0 auto", position: "relative", height: "100%" } }, /* @__PURE__ */ React167.createElement("input", { ref: coverFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "cover") }), /* @__PURE__ */ React167.createElement("input", { ref: logoFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "logo") }), editable && isHovering && !logoSrc && /* @__PURE__ */ React167.createElement(
17129
- Group51,
18503
+ /* @__PURE__ */ React189.createElement("div", { style: { maxWidth: "900px", margin: "0 auto", position: "relative", height: "100%" } }, /* @__PURE__ */ React189.createElement("input", { ref: coverFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "cover") }), /* @__PURE__ */ React189.createElement("input", { ref: logoFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "logo") }), editable && isHovering && !logoSrc && /* @__PURE__ */ React189.createElement(
18504
+ Group60,
17130
18505
  {
17131
18506
  gap: "xs",
17132
18507
  style: {
@@ -17136,10 +18511,10 @@ function CoverImage({ coverImageUrl, logoUrl }) {
17136
18511
  zIndex: 10
17137
18512
  }
17138
18513
  },
17139
- /* @__PURE__ */ React167.createElement(CoverImageButton, { onClick: handleAddLogo }, "Add icon"),
17140
- /* @__PURE__ */ React167.createElement(CoverImageButton, { onClick: handleAddCover }, "Add cover")
17141
- ), logoSrc && /* @__PURE__ */ React167.createElement(
17142
- Box30,
18514
+ /* @__PURE__ */ React189.createElement(CoverImageButton, { onClick: handleAddLogo }, "Add icon"),
18515
+ /* @__PURE__ */ React189.createElement(CoverImageButton, { onClick: handleAddCover }, "Add cover")
18516
+ ), logoSrc && /* @__PURE__ */ React189.createElement(
18517
+ Box34,
17143
18518
  {
17144
18519
  style: {
17145
18520
  position: "relative",
@@ -17152,7 +18527,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
17152
18527
  zIndex: 11
17153
18528
  }
17154
18529
  },
17155
- /* @__PURE__ */ React167.createElement(
18530
+ /* @__PURE__ */ React189.createElement(
17156
18531
  "img",
17157
18532
  {
17158
18533
  src: logoSrc,
@@ -17166,7 +18541,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
17166
18541
  }
17167
18542
  }
17168
18543
  ),
17169
- editable && isHovering && /* @__PURE__ */ React167.createElement(
18544
+ editable && isHovering && /* @__PURE__ */ React189.createElement(
17170
18545
  "div",
17171
18546
  {
17172
18547
  style: {
@@ -17181,15 +18556,15 @@ function CoverImage({ coverImageUrl, logoUrl }) {
17181
18556
  alignItems: "center"
17182
18557
  }
17183
18558
  },
17184
- /* @__PURE__ */ React167.createElement(CoverImageButton, { onClick: handleChangeLogo }, "Change"),
17185
- /* @__PURE__ */ React167.createElement(CoverImageButton, { onClick: handleRemoveLogo }, "Remove"),
17186
- /* @__PURE__ */ React167.createElement(CoverImageButton, { onClick: handleAddCover }, "Add cover")
18559
+ /* @__PURE__ */ React189.createElement(CoverImageButton, { onClick: handleChangeLogo }, "Change"),
18560
+ /* @__PURE__ */ React189.createElement(CoverImageButton, { onClick: handleRemoveLogo }, "Remove"),
18561
+ /* @__PURE__ */ React189.createElement(CoverImageButton, { onClick: handleAddCover }, "Add cover")
17187
18562
  )
17188
18563
  ))
17189
18564
  );
17190
18565
  }
17191
- return /* @__PURE__ */ React167.createElement(
17192
- Box30,
18566
+ return /* @__PURE__ */ React189.createElement(
18567
+ Box34,
17193
18568
  {
17194
18569
  style: {
17195
18570
  position: "relative",
@@ -17209,7 +18584,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
17209
18584
  onMouseMove: handleMouseMove,
17210
18585
  onClick: () => isRepositioning && setIsRepositioning(false)
17211
18586
  },
17212
- /* @__PURE__ */ React167.createElement(
18587
+ /* @__PURE__ */ React189.createElement(
17213
18588
  "img",
17214
18589
  {
17215
18590
  src: coverUrl,
@@ -17227,8 +18602,8 @@ function CoverImage({ coverImageUrl, logoUrl }) {
17227
18602
  }
17228
18603
  }
17229
18604
  ),
17230
- editable && isHovering && /* @__PURE__ */ React167.createElement(
17231
- Group51,
18605
+ editable && isHovering && /* @__PURE__ */ React189.createElement(
18606
+ Group60,
17232
18607
  {
17233
18608
  gap: "xs",
17234
18609
  style: {
@@ -17238,12 +18613,12 @@ function CoverImage({ coverImageUrl, logoUrl }) {
17238
18613
  zIndex: 10
17239
18614
  }
17240
18615
  },
17241
- /* @__PURE__ */ React167.createElement(CoverImageButton, { onClick: handleChangeCover }, "Change cover"),
17242
- /* @__PURE__ */ React167.createElement(CoverImageButton, { onClick: handleReposition, isActive: isRepositioning }, isRepositioning ? "Done" : "Reposition"),
17243
- /* @__PURE__ */ React167.createElement(CoverImageButton, { onClick: handleRemoveCover }, "Remove")
18616
+ /* @__PURE__ */ React189.createElement(CoverImageButton, { onClick: handleChangeCover }, "Change cover"),
18617
+ /* @__PURE__ */ React189.createElement(CoverImageButton, { onClick: handleReposition, isActive: isRepositioning }, isRepositioning ? "Done" : "Reposition"),
18618
+ /* @__PURE__ */ React189.createElement(CoverImageButton, { onClick: handleRemoveCover }, "Remove")
17244
18619
  ),
17245
- /* @__PURE__ */ React167.createElement("div", { style: { maxWidth: "900px", margin: "0 auto", position: "absolute", bottom: 0, left: -40, right: 0, height: "70px" } }, /* @__PURE__ */ React167.createElement(
17246
- Box30,
18620
+ /* @__PURE__ */ React189.createElement("div", { style: { maxWidth: "900px", margin: "0 auto", position: "absolute", bottom: 0, left: -40, right: 0, height: "70px" } }, /* @__PURE__ */ React189.createElement(
18621
+ Box34,
17247
18622
  {
17248
18623
  style: {
17249
18624
  position: "absolute",
@@ -17254,7 +18629,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
17254
18629
  zIndex: 11
17255
18630
  }
17256
18631
  },
17257
- logoSrc && /* @__PURE__ */ React167.createElement(
18632
+ logoSrc && /* @__PURE__ */ React189.createElement(
17258
18633
  "img",
17259
18634
  {
17260
18635
  src: logoSrc,
@@ -17268,10 +18643,10 @@ function CoverImage({ coverImageUrl, logoUrl }) {
17268
18643
  }
17269
18644
  }
17270
18645
  ),
17271
- editable && isHovering && /* @__PURE__ */ React167.createElement(React167.Fragment, null, logoSrc ? (
18646
+ editable && isHovering && /* @__PURE__ */ React189.createElement(React189.Fragment, null, logoSrc ? (
17272
18647
  // Logo exists: Show Change/Remove buttons when hovering on cover
17273
- /* @__PURE__ */ React167.createElement(
17274
- Group51,
18648
+ /* @__PURE__ */ React189.createElement(
18649
+ Group60,
17275
18650
  {
17276
18651
  gap: "xs",
17277
18652
  style: {
@@ -17281,12 +18656,12 @@ function CoverImage({ coverImageUrl, logoUrl }) {
17281
18656
  zIndex: 12
17282
18657
  }
17283
18658
  },
17284
- /* @__PURE__ */ React167.createElement(CoverImageButton, { onClick: handleChangeLogo }, "Change"),
17285
- /* @__PURE__ */ React167.createElement(CoverImageButton, { onClick: handleRemoveLogo }, "Remove")
18659
+ /* @__PURE__ */ React189.createElement(CoverImageButton, { onClick: handleChangeLogo }, "Change"),
18660
+ /* @__PURE__ */ React189.createElement(CoverImageButton, { onClick: handleRemoveLogo }, "Remove")
17286
18661
  )
17287
18662
  ) : (
17288
18663
  // No logo: Show "Add icon" button when hovering anywhere on cover
17289
- /* @__PURE__ */ React167.createElement(
18664
+ /* @__PURE__ */ React189.createElement(
17290
18665
  CoverImageButton,
17291
18666
  {
17292
18667
  onClick: handleAddLogo,
@@ -17302,13 +18677,13 @@ function CoverImage({ coverImageUrl, logoUrl }) {
17302
18677
  )
17303
18678
  ))
17304
18679
  )),
17305
- /* @__PURE__ */ React167.createElement("input", { ref: coverFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "cover") }),
17306
- /* @__PURE__ */ React167.createElement("input", { ref: logoFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "logo") })
18680
+ /* @__PURE__ */ React189.createElement("input", { ref: coverFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "cover") }),
18681
+ /* @__PURE__ */ React189.createElement("input", { ref: logoFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "logo") })
17307
18682
  );
17308
18683
  }
17309
18684
 
17310
18685
  // src/mantine/components/PageHeader.tsx
17311
- import React168, { useState as useState62, useRef as useRef12, useEffect as useEffect46 } from "react";
18686
+ import React190, { useState as useState68, useRef as useRef13, useEffect as useEffect52 } from "react";
17312
18687
  function PageHeader({
17313
18688
  title = "New page",
17314
18689
  icon,
@@ -17319,9 +18694,9 @@ function PageHeader({
17319
18694
  isFavorited = false,
17320
18695
  menuItems = []
17321
18696
  }) {
17322
- const [isMenuOpen, setIsMenuOpen] = useState62(false);
17323
- const menuRef = useRef12(null);
17324
- useEffect46(() => {
18697
+ const [isMenuOpen, setIsMenuOpen] = useState68(false);
18698
+ const menuRef = useRef13(null);
18699
+ useEffect52(() => {
17325
18700
  function handleClickOutside(event) {
17326
18701
  if (menuRef.current && !menuRef.current.contains(event.target)) {
17327
18702
  setIsMenuOpen(false);
@@ -17340,14 +18715,14 @@ function PageHeader({
17340
18715
  setIsMenuOpen(false);
17341
18716
  }
17342
18717
  };
17343
- return /* @__PURE__ */ React168.createElement("div", { style: styles.container }, /* @__PURE__ */ React168.createElement("div", { style: styles.leftSection }, /* @__PURE__ */ React168.createElement("span", { style: styles.icon }, icon || "\u{1F4C4}"), /* @__PURE__ */ React168.createElement("span", { style: styles.title }, title), isPrivate && /* @__PURE__ */ React168.createElement("button", { style: styles.privacyBadge }, /* @__PURE__ */ React168.createElement("span", { style: styles.lockIcon }, "\u{1F512}"), /* @__PURE__ */ React168.createElement("span", null, "Private"), /* @__PURE__ */ React168.createElement("span", { style: styles.chevron }, "\u25BE"))), /* @__PURE__ */ React168.createElement("div", { style: styles.rightSection }, lastEdited && /* @__PURE__ */ React168.createElement("span", { style: styles.editedText }, lastEdited), onShare && /* @__PURE__ */ React168.createElement("button", { style: styles.shareButton, onClick: onShare }, "Share"), onFavorite && /* @__PURE__ */ React168.createElement("button", { style: styles.iconButton, onClick: onFavorite }, isFavorited ? "\u2605" : "\u2606"), menuItems.length > 0 && /* @__PURE__ */ React168.createElement("div", { style: styles.menuContainer, ref: menuRef }, /* @__PURE__ */ React168.createElement(
18718
+ return /* @__PURE__ */ React190.createElement("div", { style: styles.container }, /* @__PURE__ */ React190.createElement("div", { style: styles.leftSection }, /* @__PURE__ */ React190.createElement("span", { style: styles.icon }, icon || "\u{1F4C4}"), /* @__PURE__ */ React190.createElement("span", { style: styles.title }, title), isPrivate && /* @__PURE__ */ React190.createElement("button", { style: styles.privacyBadge }, /* @__PURE__ */ React190.createElement("span", { style: styles.lockIcon }, "\u{1F512}"), /* @__PURE__ */ React190.createElement("span", null, "Private"), /* @__PURE__ */ React190.createElement("span", { style: styles.chevron }, "\u25BE"))), /* @__PURE__ */ React190.createElement("div", { style: styles.rightSection }, lastEdited && /* @__PURE__ */ React190.createElement("span", { style: styles.editedText }, lastEdited), onShare && /* @__PURE__ */ React190.createElement("button", { style: styles.shareButton, onClick: onShare }, "Share"), onFavorite && /* @__PURE__ */ React190.createElement("button", { style: styles.iconButton, onClick: onFavorite }, isFavorited ? "\u2605" : "\u2606"), menuItems.length > 0 && /* @__PURE__ */ React190.createElement("div", { style: styles.menuContainer, ref: menuRef }, /* @__PURE__ */ React190.createElement(
17344
18719
  "button",
17345
18720
  {
17346
18721
  style: styles.menuButton,
17347
18722
  onClick: () => setIsMenuOpen(!isMenuOpen),
17348
18723
  "aria-label": "Menu"
17349
18724
  },
17350
- /* @__PURE__ */ React168.createElement(
18725
+ /* @__PURE__ */ React190.createElement(
17351
18726
  "svg",
17352
18727
  {
17353
18728
  width: "16",
@@ -17355,11 +18730,11 @@ function PageHeader({
17355
18730
  viewBox: "0 0 16 16",
17356
18731
  fill: "currentColor"
17357
18732
  },
17358
- /* @__PURE__ */ React168.createElement("circle", { cx: "3", cy: "8", r: "1.5" }),
17359
- /* @__PURE__ */ React168.createElement("circle", { cx: "8", cy: "8", r: "1.5" }),
17360
- /* @__PURE__ */ React168.createElement("circle", { cx: "13", cy: "8", r: "1.5" })
18733
+ /* @__PURE__ */ React190.createElement("circle", { cx: "3", cy: "8", r: "1.5" }),
18734
+ /* @__PURE__ */ React190.createElement("circle", { cx: "8", cy: "8", r: "1.5" }),
18735
+ /* @__PURE__ */ React190.createElement("circle", { cx: "13", cy: "8", r: "1.5" })
17361
18736
  )
17362
- ), isMenuOpen && /* @__PURE__ */ React168.createElement("div", { style: styles.dropdown }, menuItems.map((item, index) => /* @__PURE__ */ React168.createElement(React168.Fragment, { key: index }, item.divider && index > 0 && /* @__PURE__ */ React168.createElement("div", { style: styles.divider }), /* @__PURE__ */ React168.createElement(
18737
+ ), isMenuOpen && /* @__PURE__ */ React190.createElement("div", { style: styles.dropdown }, menuItems.map((item, index) => /* @__PURE__ */ React190.createElement(React190.Fragment, { key: index }, item.divider && index > 0 && /* @__PURE__ */ React190.createElement("div", { style: styles.divider }), /* @__PURE__ */ React190.createElement(
17363
18738
  "button",
17364
18739
  {
17365
18740
  style: {
@@ -17369,8 +18744,8 @@ function PageHeader({
17369
18744
  onClick: () => handleMenuItemClick(item),
17370
18745
  disabled: item.disabled
17371
18746
  },
17372
- item.icon && /* @__PURE__ */ React168.createElement("span", { style: styles.menuItemIcon }, item.icon),
17373
- /* @__PURE__ */ React168.createElement("span", null, item.label)
18747
+ item.icon && /* @__PURE__ */ React190.createElement("span", { style: styles.menuItemIcon }, item.icon),
18748
+ /* @__PURE__ */ React190.createElement("span", null, item.label)
17374
18749
  )))))));
17375
18750
  }
17376
18751
  var styles = {
@@ -17501,8 +18876,8 @@ var styles = {
17501
18876
  };
17502
18877
 
17503
18878
  // src/mantine/components/ExternalDropZone.tsx
17504
- import React169, { useCallback as useCallback42, useEffect as useEffect47, useRef as useRef13, useState as useState63 } from "react";
17505
- import { Box as Box31 } from "@mantine/core";
18879
+ import React191, { useCallback as useCallback50, useEffect as useEffect53, useRef as useRef14, useState as useState69 } from "react";
18880
+ import { Box as Box35 } from "@mantine/core";
17506
18881
  var SCROLL_ZONE_SIZE = 80;
17507
18882
  var SCROLL_SPEED = 12;
17508
18883
  var ExternalDropZone = ({
@@ -17514,20 +18889,20 @@ var ExternalDropZone = ({
17514
18889
  onPlacementCancel,
17515
18890
  children
17516
18891
  }) => {
17517
- const containerRef = useRef13(null);
17518
- const [isValidDrag, setIsValidDrag] = useState63(false);
17519
- const [isHoveringInPlacementMode, setIsHoveringInPlacementMode] = useState63(false);
17520
- const [indicatorStyle, setIndicatorStyle] = useState63({});
17521
- const dropPositionRef = useRef13(null);
17522
- const scrollAnimationRef = useRef13(null);
17523
- const scrollDirectionRef = useRef13(null);
17524
- const scrollContainerRef = useRef13(null);
17525
- const getBlockElements = useCallback42(() => {
18892
+ const containerRef = useRef14(null);
18893
+ const [isValidDrag, setIsValidDrag] = useState69(false);
18894
+ const [isHoveringInPlacementMode, setIsHoveringInPlacementMode] = useState69(false);
18895
+ const [indicatorStyle, setIndicatorStyle] = useState69({});
18896
+ const dropPositionRef = useRef14(null);
18897
+ const scrollAnimationRef = useRef14(null);
18898
+ const scrollDirectionRef = useRef14(null);
18899
+ const scrollContainerRef = useRef14(null);
18900
+ const getBlockElements = useCallback50(() => {
17526
18901
  if (!containerRef.current) return [];
17527
18902
  const blocks = containerRef.current.querySelectorAll('[data-node-type="blockContainer"]');
17528
18903
  return Array.from(blocks);
17529
18904
  }, []);
17530
- const getScrollContainer = useCallback42(() => {
18905
+ const getScrollContainer = useCallback50(() => {
17531
18906
  if (scrollContainerRef.current) return scrollContainerRef.current;
17532
18907
  let element = containerRef.current;
17533
18908
  while (element) {
@@ -17542,7 +18917,7 @@ var ExternalDropZone = ({
17542
18917
  scrollContainerRef.current = window;
17543
18918
  return window;
17544
18919
  }, []);
17545
- const performScroll = useCallback42(() => {
18920
+ const performScroll = useCallback50(() => {
17546
18921
  const container = getScrollContainer();
17547
18922
  const direction = scrollDirectionRef.current;
17548
18923
  if (!direction) {
@@ -17557,7 +18932,7 @@ var ExternalDropZone = ({
17557
18932
  }
17558
18933
  scrollAnimationRef.current = requestAnimationFrame(performScroll);
17559
18934
  }, [getScrollContainer]);
17560
- const startAutoScroll = useCallback42(
18935
+ const startAutoScroll = useCallback50(
17561
18936
  (direction) => {
17562
18937
  if (scrollDirectionRef.current === direction) return;
17563
18938
  scrollDirectionRef.current = direction;
@@ -17567,14 +18942,14 @@ var ExternalDropZone = ({
17567
18942
  },
17568
18943
  [performScroll]
17569
18944
  );
17570
- const stopAutoScroll = useCallback42(() => {
18945
+ const stopAutoScroll = useCallback50(() => {
17571
18946
  scrollDirectionRef.current = null;
17572
18947
  if (scrollAnimationRef.current) {
17573
18948
  cancelAnimationFrame(scrollAnimationRef.current);
17574
18949
  scrollAnimationRef.current = null;
17575
18950
  }
17576
18951
  }, []);
17577
- const checkAutoScroll = useCallback42(
18952
+ const checkAutoScroll = useCallback50(
17578
18953
  (clientY) => {
17579
18954
  const container = getScrollContainer();
17580
18955
  let containerTop;
@@ -17597,7 +18972,7 @@ var ExternalDropZone = ({
17597
18972
  },
17598
18973
  [getScrollContainer, startAutoScroll, stopAutoScroll]
17599
18974
  );
17600
- const findDropPosition = useCallback42(
18975
+ const findDropPosition = useCallback50(
17601
18976
  (clientY) => {
17602
18977
  const blocks = getBlockElements();
17603
18978
  if (blocks.length === 0 || !editor?.document) return null;
@@ -17630,7 +19005,7 @@ var ExternalDropZone = ({
17630
19005
  },
17631
19006
  [getBlockElements, editor]
17632
19007
  );
17633
- const handleDragOver = useCallback42(
19008
+ const handleDragOver = useCallback50(
17634
19009
  (e) => {
17635
19010
  if (!e.dataTransfer.types.includes(acceptedType)) return;
17636
19011
  e.preventDefault();
@@ -17653,7 +19028,7 @@ var ExternalDropZone = ({
17653
19028
  },
17654
19029
  [acceptedType, findDropPosition, checkAutoScroll]
17655
19030
  );
17656
- const handleDragLeave = useCallback42(
19031
+ const handleDragLeave = useCallback50(
17657
19032
  (e) => {
17658
19033
  if (containerRef.current && !containerRef.current.contains(e.relatedTarget)) {
17659
19034
  setIsValidDrag(false);
@@ -17663,7 +19038,7 @@ var ExternalDropZone = ({
17663
19038
  },
17664
19039
  [stopAutoScroll]
17665
19040
  );
17666
- const handleDrop = useCallback42(
19041
+ const handleDrop = useCallback50(
17667
19042
  (e) => {
17668
19043
  e.preventDefault();
17669
19044
  e.stopPropagation();
@@ -17677,7 +19052,7 @@ var ExternalDropZone = ({
17677
19052
  },
17678
19053
  [onDrop, stopAutoScroll]
17679
19054
  );
17680
- useEffect47(() => {
19055
+ useEffect53(() => {
17681
19056
  const handleGlobalDragEnd = () => {
17682
19057
  setIsValidDrag(false);
17683
19058
  dropPositionRef.current = null;
@@ -17686,7 +19061,7 @@ var ExternalDropZone = ({
17686
19061
  window.addEventListener("dragend", handleGlobalDragEnd);
17687
19062
  return () => window.removeEventListener("dragend", handleGlobalDragEnd);
17688
19063
  }, [stopAutoScroll]);
17689
- const handleOverlayMouseMove = useCallback42(
19064
+ const handleOverlayMouseMove = useCallback50(
17690
19065
  (e) => {
17691
19066
  setIsHoveringInPlacementMode(true);
17692
19067
  checkAutoScroll(e.clientY);
@@ -17705,12 +19080,12 @@ var ExternalDropZone = ({
17705
19080
  },
17706
19081
  [findDropPosition, checkAutoScroll]
17707
19082
  );
17708
- const handleOverlayMouseLeave = useCallback42(() => {
19083
+ const handleOverlayMouseLeave = useCallback50(() => {
17709
19084
  setIsHoveringInPlacementMode(false);
17710
19085
  dropPositionRef.current = null;
17711
19086
  stopAutoScroll();
17712
19087
  }, [stopAutoScroll]);
17713
- const handleOverlayClick = useCallback42(
19088
+ const handleOverlayClick = useCallback50(
17714
19089
  (e) => {
17715
19090
  e.preventDefault();
17716
19091
  e.stopPropagation();
@@ -17724,7 +19099,7 @@ var ExternalDropZone = ({
17724
19099
  },
17725
19100
  [onDrop, stopAutoScroll]
17726
19101
  );
17727
- const handleOverlayWheel = useCallback42(
19102
+ const handleOverlayWheel = useCallback50(
17728
19103
  (e) => {
17729
19104
  const container = getScrollContainer();
17730
19105
  if (container === window) {
@@ -17735,7 +19110,7 @@ var ExternalDropZone = ({
17735
19110
  },
17736
19111
  [getScrollContainer]
17737
19112
  );
17738
- useEffect47(() => {
19113
+ useEffect53(() => {
17739
19114
  if (!isPlacementMode) return;
17740
19115
  const handleKeyDown = (e) => {
17741
19116
  if (e.key === "Escape") {
@@ -17758,13 +19133,13 @@ var ExternalDropZone = ({
17758
19133
  document.removeEventListener("click", handleGlobalClick, true);
17759
19134
  };
17760
19135
  }, [isPlacementMode, onPlacementCancel]);
17761
- useEffect47(() => {
19136
+ useEffect53(() => {
17762
19137
  if (!isPlacementMode) {
17763
19138
  setIsHoveringInPlacementMode(false);
17764
19139
  dropPositionRef.current = null;
17765
19140
  }
17766
19141
  }, [isPlacementMode]);
17767
- useEffect47(() => {
19142
+ useEffect53(() => {
17768
19143
  const isActive = isValidDrag || isPlacementMode && isHoveringInPlacementMode;
17769
19144
  if (isActive) {
17770
19145
  document.body.classList.add("external-artifact-drag-active");
@@ -17775,19 +19150,19 @@ var ExternalDropZone = ({
17775
19150
  document.body.classList.remove("external-artifact-drag-active");
17776
19151
  };
17777
19152
  }, [isValidDrag, isPlacementMode, isHoveringInPlacementMode]);
17778
- useEffect47(() => {
19153
+ useEffect53(() => {
17779
19154
  return () => {
17780
19155
  if (scrollAnimationRef.current) {
17781
19156
  cancelAnimationFrame(scrollAnimationRef.current);
17782
19157
  }
17783
19158
  };
17784
19159
  }, []);
17785
- const indicatorWithPosition = dropIndicator && React169.isValidElement(dropIndicator) ? React169.cloneElement(dropIndicator, {
19160
+ const indicatorWithPosition = dropIndicator && React191.isValidElement(dropIndicator) ? React191.cloneElement(dropIndicator, {
17786
19161
  indicatorTop: typeof indicatorStyle.top === "number" ? indicatorStyle.top : void 0
17787
19162
  }) : dropIndicator;
17788
19163
  const shouldShowIndicator = isValidDrag || isPlacementMode && isHoveringInPlacementMode;
17789
- return /* @__PURE__ */ React169.createElement(
17790
- Box31,
19164
+ return /* @__PURE__ */ React191.createElement(
19165
+ Box35,
17791
19166
  {
17792
19167
  ref: containerRef,
17793
19168
  style: {
@@ -17802,8 +19177,8 @@ var ExternalDropZone = ({
17802
19177
  "data-placement-mode": isPlacementMode ? "true" : void 0
17803
19178
  },
17804
19179
  children,
17805
- isPlacementMode && /* @__PURE__ */ React169.createElement(
17806
- Box31,
19180
+ isPlacementMode && /* @__PURE__ */ React191.createElement(
19181
+ Box35,
17807
19182
  {
17808
19183
  style: {
17809
19184
  position: "absolute",
@@ -17822,20 +19197,20 @@ var ExternalDropZone = ({
17822
19197
  onWheel: handleOverlayWheel
17823
19198
  }
17824
19199
  ),
17825
- shouldShowIndicator && indicatorWithPosition && /* @__PURE__ */ React169.createElement(Box31, { style: { ...indicatorStyle, background: "none", border: "none", boxShadow: "none" } }, indicatorWithPosition)
19200
+ shouldShowIndicator && indicatorWithPosition && /* @__PURE__ */ React191.createElement(Box35, { style: { ...indicatorStyle, background: "none", border: "none", boxShadow: "none" } }, indicatorWithPosition)
17826
19201
  );
17827
19202
  };
17828
19203
 
17829
19204
  // src/mantine/IxoEditor.tsx
17830
- import React171 from "react";
19205
+ import React193 from "react";
17831
19206
  import { getDefaultReactSlashMenuItems, SuggestionMenuController } from "@blocknote/react";
17832
19207
  import { BlockNoteView } from "@blocknote/mantine";
17833
19208
  import { filterSuggestionItems } from "@blocknote/core";
17834
19209
  import { MantineProvider } from "@mantine/core";
17835
19210
 
17836
19211
  // src/mantine/components/PanelContent.tsx
17837
- import React170 from "react";
17838
- import { Box as Box32 } from "@mantine/core";
19212
+ import React192 from "react";
19213
+ import { Box as Box36 } from "@mantine/core";
17839
19214
  var panelStyles = {
17840
19215
  light: {
17841
19216
  backgroundColor: "#ffffff",
@@ -17864,8 +19239,8 @@ function PanelContent({ theme }) {
17864
19239
  const { activePanel, registeredPanels } = usePanelStore();
17865
19240
  const isOpen = activePanel !== null;
17866
19241
  const content = activePanel ? registeredPanels.get(activePanel) : null;
17867
- return /* @__PURE__ */ React170.createElement(
17868
- Box32,
19242
+ return /* @__PURE__ */ React192.createElement(
19243
+ Box36,
17869
19244
  {
17870
19245
  pos: "sticky",
17871
19246
  right: 0,
@@ -17905,7 +19280,7 @@ function IxoEditorContent({
17905
19280
  }) {
17906
19281
  const { activePanel } = usePanelStore();
17907
19282
  const isPanelOpen = activePanel !== null;
17908
- const editorContent = /* @__PURE__ */ React171.createElement(
19283
+ const editorContent = /* @__PURE__ */ React193.createElement(
17909
19284
  BlockNoteView,
17910
19285
  {
17911
19286
  editor,
@@ -17920,7 +19295,7 @@ function IxoEditorContent({
17920
19295
  onChange,
17921
19296
  onSelectionChange
17922
19297
  },
17923
- config.slashMenu && /* @__PURE__ */ React171.createElement(
19298
+ config.slashMenu && /* @__PURE__ */ React193.createElement(
17924
19299
  SuggestionMenuController,
17925
19300
  {
17926
19301
  triggerCharacter: "/",
@@ -17933,7 +19308,7 @@ function IxoEditorContent({
17933
19308
  ),
17934
19309
  children
17935
19310
  );
17936
- return /* @__PURE__ */ React171.createElement("div", { style: { display: "flex", height: "100%", width: "100%", gap: 0 } }, /* @__PURE__ */ React171.createElement(
19311
+ return /* @__PURE__ */ React193.createElement("div", { style: { display: "flex", height: "100%", width: "100%", gap: 0 } }, /* @__PURE__ */ React193.createElement(
17937
19312
  "div",
17938
19313
  {
17939
19314
  className: `ixo-editor ixo-editor--theme-${config.theme} ${className}`,
@@ -17942,9 +19317,9 @@ function IxoEditorContent({
17942
19317
  transition: "width 0.2s ease"
17943
19318
  }
17944
19319
  },
17945
- selfNav && /* @__PURE__ */ React171.createElement(PageHeader, { ...pageHeaderProps }),
17946
- /* @__PURE__ */ React171.createElement(CoverImage, { coverImageUrl, logoUrl }),
17947
- (onExternalDrop || isPlacementMode) && isEditable ? /* @__PURE__ */ React171.createElement(
19320
+ selfNav && /* @__PURE__ */ React193.createElement(PageHeader, { ...pageHeaderProps }),
19321
+ /* @__PURE__ */ React193.createElement(CoverImage, { coverImageUrl, logoUrl }),
19322
+ (onExternalDrop || isPlacementMode) && isEditable ? /* @__PURE__ */ React193.createElement(
17948
19323
  ExternalDropZone,
17949
19324
  {
17950
19325
  editor,
@@ -17957,7 +19332,7 @@ function IxoEditorContent({
17957
19332
  },
17958
19333
  editorContent
17959
19334
  ) : editorContent
17960
- ), isPanelVisible && /* @__PURE__ */ React171.createElement(PanelContent, { theme: config.theme }));
19335
+ ), isPanelVisible && /* @__PURE__ */ React193.createElement(PanelContent, { theme: config.theme }));
17961
19336
  }
17962
19337
  function IxoEditor({
17963
19338
  editor,
@@ -17996,7 +19371,7 @@ function IxoEditor({
17996
19371
  tableHandles: true
17997
19372
  };
17998
19373
  const isEditable = editable;
17999
- const editorContent = /* @__PURE__ */ React171.createElement(
19374
+ const editorContent = /* @__PURE__ */ React193.createElement(
18000
19375
  BlocknoteProvider,
18001
19376
  {
18002
19377
  editor,
@@ -18007,7 +19382,7 @@ function IxoEditor({
18007
19382
  getDynamicListData,
18008
19383
  dynamicListPanelRenderer
18009
19384
  },
18010
- /* @__PURE__ */ React171.createElement(
19385
+ /* @__PURE__ */ React193.createElement(
18011
19386
  IxoEditorContent,
18012
19387
  {
18013
19388
  isPanelVisible,
@@ -18031,15 +19406,15 @@ function IxoEditor({
18031
19406
  )
18032
19407
  );
18033
19408
  if (mantineTheme) {
18034
- return /* @__PURE__ */ React171.createElement(MantineProvider, { theme: mantineTheme }, editorContent);
19409
+ return /* @__PURE__ */ React193.createElement(MantineProvider, { theme: mantineTheme }, editorContent);
18035
19410
  }
18036
19411
  return editorContent;
18037
19412
  }
18038
19413
 
18039
19414
  // src/mantine/components/EntitySigningSetup.tsx
18040
- import React172, { useState as useState64 } from "react";
18041
- import { Modal as Modal3, Stack as Stack113, Text as Text86, TextInput as TextInput6, Button as Button33, Alert as Alert23, Group as Group52 } from "@mantine/core";
18042
- import { IconAlertCircle as IconAlertCircle10, IconCheck as IconCheck5, IconKey as IconKey2 } from "@tabler/icons-react";
19415
+ import React194, { useState as useState70 } from "react";
19416
+ import { Modal as Modal3, Stack as Stack123, Text as Text97, TextInput as TextInput6, Button as Button35, Alert as Alert25, Group as Group61 } from "@mantine/core";
19417
+ import { IconAlertCircle as IconAlertCircle12, IconCheck as IconCheck6, IconKey as IconKey2 } from "@tabler/icons-react";
18043
19418
  var EntitySigningSetup = ({
18044
19419
  opened,
18045
19420
  onClose,
@@ -18047,11 +19422,11 @@ var EntitySigningSetup = ({
18047
19422
  entityName,
18048
19423
  onSetup
18049
19424
  }) => {
18050
- const [pin, setPin] = useState64("");
18051
- const [confirmPin, setConfirmPin] = useState64("");
18052
- const [loading, setLoading] = useState64(false);
18053
- const [error, setError] = useState64(null);
18054
- const [success, setSuccess] = useState64(false);
19425
+ const [pin, setPin] = useState70("");
19426
+ const [confirmPin, setConfirmPin] = useState70("");
19427
+ const [loading, setLoading] = useState70(false);
19428
+ const [error, setError] = useState70(null);
19429
+ const [success, setSuccess] = useState70(false);
18055
19430
  const handleSetup = async () => {
18056
19431
  if (pin.length < 4) {
18057
19432
  setError("PIN must be at least 4 characters");
@@ -18091,15 +19466,15 @@ var EntitySigningSetup = ({
18091
19466
  setSuccess(false);
18092
19467
  }
18093
19468
  };
18094
- return /* @__PURE__ */ React172.createElement(
19469
+ return /* @__PURE__ */ React194.createElement(
18095
19470
  Modal3,
18096
19471
  {
18097
19472
  opened,
18098
19473
  onClose: handleClose,
18099
- title: /* @__PURE__ */ React172.createElement(Group52, { gap: "xs" }, /* @__PURE__ */ React172.createElement(IconKey2, { size: 20 }), /* @__PURE__ */ React172.createElement(Text86, { fw: 600 }, "Entity Signing Setup")),
19474
+ title: /* @__PURE__ */ React194.createElement(Group61, { gap: "xs" }, /* @__PURE__ */ React194.createElement(IconKey2, { size: 20 }), /* @__PURE__ */ React194.createElement(Text97, { fw: 600 }, "Entity Signing Setup")),
18100
19475
  size: "md"
18101
19476
  },
18102
- /* @__PURE__ */ React172.createElement(Stack113, { gap: "md" }, success ? /* @__PURE__ */ React172.createElement(Alert23, { color: "green", icon: /* @__PURE__ */ React172.createElement(IconCheck5, { size: 16 }) }, "Entity signing key set up successfully!") : /* @__PURE__ */ React172.createElement(React172.Fragment, null, /* @__PURE__ */ React172.createElement(Text86, { size: "sm", c: "dimmed" }, "Flow authorization requires a signing key for", " ", /* @__PURE__ */ React172.createElement(Text86, { span: true, fw: 500 }, entityName || entityDid), "."), /* @__PURE__ */ React172.createElement(Alert23, { color: "blue", variant: "light" }, /* @__PURE__ */ React172.createElement(Text86, { size: "sm" }, "This is a ", /* @__PURE__ */ React172.createElement("strong", null, "one-time setup"), " that allows flows to grant permissions without requiring wallet signatures for each delegation.")), /* @__PURE__ */ React172.createElement(Stack113, { gap: "xs" }, /* @__PURE__ */ React172.createElement(Text86, { size: "sm", fw: 500 }, "What happens:"), /* @__PURE__ */ React172.createElement(Text86, { size: "sm", c: "dimmed" }, "1. A new signing key is generated"), /* @__PURE__ */ React172.createElement(Text86, { size: "sm", c: "dimmed" }, "2. Key is registered on the entity's DID document (requires wallet)"), /* @__PURE__ */ React172.createElement(Text86, { size: "sm", c: "dimmed" }, "3. Key is stored encrypted in the entity's Matrix room")), /* @__PURE__ */ React172.createElement(
19477
+ /* @__PURE__ */ React194.createElement(Stack123, { gap: "md" }, success ? /* @__PURE__ */ React194.createElement(Alert25, { color: "green", icon: /* @__PURE__ */ React194.createElement(IconCheck6, { size: 16 }) }, "Entity signing key set up successfully!") : /* @__PURE__ */ React194.createElement(React194.Fragment, null, /* @__PURE__ */ React194.createElement(Text97, { size: "sm", c: "dimmed" }, "Flow authorization requires a signing key for", " ", /* @__PURE__ */ React194.createElement(Text97, { span: true, fw: 500 }, entityName || entityDid), "."), /* @__PURE__ */ React194.createElement(Alert25, { color: "blue", variant: "light" }, /* @__PURE__ */ React194.createElement(Text97, { size: "sm" }, "This is a ", /* @__PURE__ */ React194.createElement("strong", null, "one-time setup"), " that allows flows to grant permissions without requiring wallet signatures for each delegation.")), /* @__PURE__ */ React194.createElement(Stack123, { gap: "xs" }, /* @__PURE__ */ React194.createElement(Text97, { size: "sm", fw: 500 }, "What happens:"), /* @__PURE__ */ React194.createElement(Text97, { size: "sm", c: "dimmed" }, "1. A new signing key is generated"), /* @__PURE__ */ React194.createElement(Text97, { size: "sm", c: "dimmed" }, "2. Key is registered on the entity's DID document (requires wallet)"), /* @__PURE__ */ React194.createElement(Text97, { size: "sm", c: "dimmed" }, "3. Key is stored encrypted in the entity's Matrix room")), /* @__PURE__ */ React194.createElement(
18103
19478
  TextInput6,
18104
19479
  {
18105
19480
  label: "Enter PIN to encrypt signing key",
@@ -18110,7 +19485,7 @@ var EntitySigningSetup = ({
18110
19485
  onChange: (e) => setPin(e.currentTarget.value),
18111
19486
  disabled: loading
18112
19487
  }
18113
- ), /* @__PURE__ */ React172.createElement(
19488
+ ), /* @__PURE__ */ React194.createElement(
18114
19489
  TextInput6,
18115
19490
  {
18116
19491
  label: "Confirm PIN",
@@ -18120,12 +19495,12 @@ var EntitySigningSetup = ({
18120
19495
  onChange: (e) => setConfirmPin(e.currentTarget.value),
18121
19496
  disabled: loading
18122
19497
  }
18123
- ), error && /* @__PURE__ */ React172.createElement(Alert23, { color: "red", icon: /* @__PURE__ */ React172.createElement(IconAlertCircle10, { size: 16 }) }, error), /* @__PURE__ */ React172.createElement(Group52, { justify: "flex-end", mt: "md" }, /* @__PURE__ */ React172.createElement(Button33, { variant: "subtle", onClick: handleClose, disabled: loading }, "Cancel"), /* @__PURE__ */ React172.createElement(
18124
- Button33,
19498
+ ), error && /* @__PURE__ */ React194.createElement(Alert25, { color: "red", icon: /* @__PURE__ */ React194.createElement(IconAlertCircle12, { size: 16 }) }, error), /* @__PURE__ */ React194.createElement(Group61, { justify: "flex-end", mt: "md" }, /* @__PURE__ */ React194.createElement(Button35, { variant: "subtle", onClick: handleClose, disabled: loading }, "Cancel"), /* @__PURE__ */ React194.createElement(
19499
+ Button35,
18125
19500
  {
18126
19501
  onClick: handleSetup,
18127
19502
  loading,
18128
- leftSection: /* @__PURE__ */ React172.createElement(IconKey2, { size: 16 })
19503
+ leftSection: /* @__PURE__ */ React194.createElement(IconKey2, { size: 16 })
18129
19504
  },
18130
19505
  "Setup Entity Signing"
18131
19506
  ))))
@@ -18133,9 +19508,9 @@ var EntitySigningSetup = ({
18133
19508
  };
18134
19509
 
18135
19510
  // src/mantine/components/FlowPermissionsPanel.tsx
18136
- import React173, { useState as useState65, useEffect as useEffect48, useMemo as useMemo53 } from "react";
18137
- import { Stack as Stack114, Text as Text87, Paper as Paper16, Group as Group53, Badge as Badge24, Button as Button34, ActionIcon as ActionIcon26, Loader as Loader23, Alert as Alert24, Divider as Divider11 } from "@mantine/core";
18138
- import { IconPlus as IconPlus5, IconTrash as IconTrash5, IconShieldCheck as IconShieldCheck2, IconUser as IconUser4, IconRobot as IconRobot3, IconBuilding } from "@tabler/icons-react";
19511
+ import React195, { useState as useState71, useEffect as useEffect54, useMemo as useMemo62 } from "react";
19512
+ import { Stack as Stack124, Text as Text98, Paper as Paper19, Group as Group62, Badge as Badge29, Button as Button36, ActionIcon as ActionIcon28, Loader as Loader25, Alert as Alert26, Divider as Divider12 } from "@mantine/core";
19513
+ import { IconPlus as IconPlus5, IconTrash as IconTrash6, IconShieldCheck as IconShieldCheck2, IconUser as IconUser4, IconRobot as IconRobot3, IconBuilding } from "@tabler/icons-react";
18139
19514
  var FlowPermissionsPanel = ({
18140
19515
  editor,
18141
19516
  entityDid,
@@ -18144,11 +19519,11 @@ var FlowPermissionsPanel = ({
18144
19519
  onRevokePermission,
18145
19520
  getUserDisplayName
18146
19521
  }) => {
18147
- const [delegations, setDelegations] = useState65([]);
18148
- const [loading, setLoading] = useState65(true);
18149
- const [revoking, setRevoking] = useState65(null);
18150
- const rootCapability = useMemo53(() => editor.getRootCapability?.(), [editor]);
18151
- useEffect48(() => {
19522
+ const [delegations, setDelegations] = useState71([]);
19523
+ const [loading, setLoading] = useState71(true);
19524
+ const [revoking, setRevoking] = useState71(null);
19525
+ const rootCapability = useMemo62(() => editor.getRootCapability?.(), [editor]);
19526
+ useEffect54(() => {
18152
19527
  const loadDelegations = async () => {
18153
19528
  setLoading(true);
18154
19529
  const allDelegations = editor.getAllDelegations?.() || [];
@@ -18187,11 +19562,11 @@ var FlowPermissionsPanel = ({
18187
19562
  const getIcon2 = (type) => {
18188
19563
  switch (type) {
18189
19564
  case "oracle":
18190
- return /* @__PURE__ */ React173.createElement(IconRobot3, { size: 16 });
19565
+ return /* @__PURE__ */ React195.createElement(IconRobot3, { size: 16 });
18191
19566
  case "entity":
18192
- return /* @__PURE__ */ React173.createElement(IconBuilding, { size: 16 });
19567
+ return /* @__PURE__ */ React195.createElement(IconBuilding, { size: 16 });
18193
19568
  default:
18194
- return /* @__PURE__ */ React173.createElement(IconUser4, { size: 16 });
19569
+ return /* @__PURE__ */ React195.createElement(IconUser4, { size: 16 });
18195
19570
  }
18196
19571
  };
18197
19572
  const formatCapabilities = (caps) => {
@@ -18210,8 +19585,8 @@ var FlowPermissionsPanel = ({
18210
19585
  if (date < /* @__PURE__ */ new Date()) return "Expired";
18211
19586
  return date.toLocaleDateString();
18212
19587
  };
18213
- return /* @__PURE__ */ React173.createElement(Stack114, { gap: "md" }, /* @__PURE__ */ React173.createElement(Stack114, { gap: "xs" }, /* @__PURE__ */ React173.createElement(Text87, { fw: 600, size: "sm" }, "Root Authority"), /* @__PURE__ */ React173.createElement(Paper16, { p: "sm", withBorder: true }, /* @__PURE__ */ React173.createElement(Group53, { gap: "xs" }, /* @__PURE__ */ React173.createElement(IconShieldCheck2, { size: 20, color: "var(--mantine-color-green-6)" }), /* @__PURE__ */ React173.createElement(Stack114, { gap: 2, style: { flex: 1 } }, /* @__PURE__ */ React173.createElement(Text87, { size: "sm", fw: 500 }, entityName || entityDid), /* @__PURE__ */ React173.createElement(Text87, { size: "xs", c: "dimmed" }, rootCapability ? `Granted: ${new Date(rootCapability.issuedAt).toLocaleDateString()}` : "Root capability not set up")), /* @__PURE__ */ React173.createElement(Badge24, { color: "green", variant: "light" }, "Entity")))), /* @__PURE__ */ React173.createElement(Divider11, { label: "Delegated Permissions", labelPosition: "center" }), loading ? /* @__PURE__ */ React173.createElement(Group53, { justify: "center", py: "xl" }, /* @__PURE__ */ React173.createElement(Loader23, { size: "sm" })) : delegations.length === 0 ? /* @__PURE__ */ React173.createElement(Alert24, { color: "gray", variant: "light" }, /* @__PURE__ */ React173.createElement(Text87, { size: "sm" }, "No permissions have been granted yet.")) : /* @__PURE__ */ React173.createElement(Stack114, { gap: "xs" }, delegations.map(({ capability, displayName, type }) => /* @__PURE__ */ React173.createElement(Paper16, { key: capability.id, p: "sm", withBorder: true }, /* @__PURE__ */ React173.createElement(Group53, { justify: "space-between" }, /* @__PURE__ */ React173.createElement(Group53, { gap: "xs" }, getIcon2(type), /* @__PURE__ */ React173.createElement(Stack114, { gap: 2 }, /* @__PURE__ */ React173.createElement(Text87, { size: "sm", fw: 500 }, displayName), /* @__PURE__ */ React173.createElement(Text87, { size: "xs", c: "dimmed" }, formatCapabilities(capability.capabilities)), /* @__PURE__ */ React173.createElement(Group53, { gap: "xs" }, /* @__PURE__ */ React173.createElement(Text87, { size: "xs", c: "dimmed" }, "Expires: ", formatExpiration(capability.expiration)), /* @__PURE__ */ React173.createElement(Text87, { size: "xs", c: "dimmed" }, "\u2022"), /* @__PURE__ */ React173.createElement(Text87, { size: "xs", c: "dimmed" }, "Granted by: ", capability.issuer === entityDid ? "Entity" : capability.issuer.slice(-8))))), /* @__PURE__ */ React173.createElement(
18214
- ActionIcon26,
19588
+ return /* @__PURE__ */ React195.createElement(Stack124, { gap: "md" }, /* @__PURE__ */ React195.createElement(Stack124, { gap: "xs" }, /* @__PURE__ */ React195.createElement(Text98, { fw: 600, size: "sm" }, "Root Authority"), /* @__PURE__ */ React195.createElement(Paper19, { p: "sm", withBorder: true }, /* @__PURE__ */ React195.createElement(Group62, { gap: "xs" }, /* @__PURE__ */ React195.createElement(IconShieldCheck2, { size: 20, color: "var(--mantine-color-green-6)" }), /* @__PURE__ */ React195.createElement(Stack124, { gap: 2, style: { flex: 1 } }, /* @__PURE__ */ React195.createElement(Text98, { size: "sm", fw: 500 }, entityName || entityDid), /* @__PURE__ */ React195.createElement(Text98, { size: "xs", c: "dimmed" }, rootCapability ? `Granted: ${new Date(rootCapability.issuedAt).toLocaleDateString()}` : "Root capability not set up")), /* @__PURE__ */ React195.createElement(Badge29, { color: "green", variant: "light" }, "Entity")))), /* @__PURE__ */ React195.createElement(Divider12, { label: "Delegated Permissions", labelPosition: "center" }), loading ? /* @__PURE__ */ React195.createElement(Group62, { justify: "center", py: "xl" }, /* @__PURE__ */ React195.createElement(Loader25, { size: "sm" })) : delegations.length === 0 ? /* @__PURE__ */ React195.createElement(Alert26, { color: "gray", variant: "light" }, /* @__PURE__ */ React195.createElement(Text98, { size: "sm" }, "No permissions have been granted yet.")) : /* @__PURE__ */ React195.createElement(Stack124, { gap: "xs" }, delegations.map(({ capability, displayName, type }) => /* @__PURE__ */ React195.createElement(Paper19, { key: capability.id, p: "sm", withBorder: true }, /* @__PURE__ */ React195.createElement(Group62, { justify: "space-between" }, /* @__PURE__ */ React195.createElement(Group62, { gap: "xs" }, getIcon2(type), /* @__PURE__ */ React195.createElement(Stack124, { gap: 2 }, /* @__PURE__ */ React195.createElement(Text98, { size: "sm", fw: 500 }, displayName), /* @__PURE__ */ React195.createElement(Text98, { size: "xs", c: "dimmed" }, formatCapabilities(capability.capabilities)), /* @__PURE__ */ React195.createElement(Group62, { gap: "xs" }, /* @__PURE__ */ React195.createElement(Text98, { size: "xs", c: "dimmed" }, "Expires: ", formatExpiration(capability.expiration)), /* @__PURE__ */ React195.createElement(Text98, { size: "xs", c: "dimmed" }, "\u2022"), /* @__PURE__ */ React195.createElement(Text98, { size: "xs", c: "dimmed" }, "Granted by: ", capability.issuer === entityDid ? "Entity" : capability.issuer.slice(-8))))), /* @__PURE__ */ React195.createElement(
19589
+ ActionIcon28,
18215
19590
  {
18216
19591
  color: "red",
18217
19592
  variant: "subtle",
@@ -18219,11 +19594,11 @@ var FlowPermissionsPanel = ({
18219
19594
  loading: revoking === capability.id,
18220
19595
  disabled: !!revoking
18221
19596
  },
18222
- /* @__PURE__ */ React173.createElement(IconTrash5, { size: 16 })
18223
- ))))), /* @__PURE__ */ React173.createElement(
18224
- Button34,
19597
+ /* @__PURE__ */ React195.createElement(IconTrash6, { size: 16 })
19598
+ ))))), /* @__PURE__ */ React195.createElement(
19599
+ Button36,
18225
19600
  {
18226
- leftSection: /* @__PURE__ */ React173.createElement(IconPlus5, { size: 16 }),
19601
+ leftSection: /* @__PURE__ */ React195.createElement(IconPlus5, { size: 16 }),
18227
19602
  variant: "light",
18228
19603
  onClick: onGrantPermission
18229
19604
  },
@@ -18232,22 +19607,22 @@ var FlowPermissionsPanel = ({
18232
19607
  };
18233
19608
 
18234
19609
  // src/mantine/components/GrantPermissionModal.tsx
18235
- import React174, { useState as useState66, useCallback as useCallback43 } from "react";
19610
+ import React196, { useState as useState72, useCallback as useCallback51 } from "react";
18236
19611
  import {
18237
19612
  Modal as Modal4,
18238
- Stack as Stack115,
18239
- Text as Text88,
19613
+ Stack as Stack125,
19614
+ Text as Text99,
18240
19615
  TextInput as TextInput7,
18241
- Button as Button35,
18242
- Group as Group54,
19616
+ Button as Button37,
19617
+ Group as Group63,
18243
19618
  Radio as Radio6,
18244
19619
  Checkbox as Checkbox12,
18245
- Alert as Alert25,
18246
- Paper as Paper17,
18247
- Loader as Loader24,
18248
- Badge as Badge25,
18249
- ActionIcon as ActionIcon27,
18250
- Divider as Divider12,
19620
+ Alert as Alert27,
19621
+ Paper as Paper20,
19622
+ Loader as Loader26,
19623
+ Badge as Badge30,
19624
+ ActionIcon as ActionIcon29,
19625
+ Divider as Divider13,
18251
19626
  NumberInput as NumberInput3
18252
19627
  } from "@mantine/core";
18253
19628
  import { IconSearch as IconSearch5, IconUser as IconUser5, IconRobot as IconRobot4, IconX as IconX8, IconShieldPlus as IconShieldPlus3 } from "@tabler/icons-react";
@@ -18264,21 +19639,21 @@ var GrantPermissionModal = ({
18264
19639
  const singleBlockMode = !!targetBlockId || blocks.length === 1;
18265
19640
  const fixedBlockId = targetBlockId || (blocks.length === 1 ? blocks[0].id : null);
18266
19641
  const fixedBlock = fixedBlockId ? blocks.find((b) => b.id === fixedBlockId) || blocks[0] : null;
18267
- const [recipientType, setRecipientType] = useState66("user");
18268
- const [searchQuery, setSearchQuery] = useState66("");
18269
- const [searchResults, setSearchResults] = useState66([]);
18270
- const [searching, setSearching] = useState66(false);
18271
- const [selectedRecipient, setSelectedRecipient] = useState66(null);
18272
- const [manualDid, setManualDid] = useState66("");
18273
- const [scopeType, setScopeType] = useState66("full");
18274
- const [selectedBlocks, setSelectedBlocks] = useState66([]);
18275
- const [expirationEnabled, setExpirationEnabled] = useState66(false);
18276
- const [expirationDays, setExpirationDays] = useState66(30);
18277
- const [canDelegate, setCanDelegate] = useState66(false);
18278
- const [pin, setPin] = useState66("");
18279
- const [loading, setLoading] = useState66(false);
18280
- const [error, setError] = useState66(null);
18281
- const handleSearch = useCallback43(async () => {
19642
+ const [recipientType, setRecipientType] = useState72("user");
19643
+ const [searchQuery, setSearchQuery] = useState72("");
19644
+ const [searchResults, setSearchResults] = useState72([]);
19645
+ const [searching, setSearching] = useState72(false);
19646
+ const [selectedRecipient, setSelectedRecipient] = useState72(null);
19647
+ const [manualDid, setManualDid] = useState72("");
19648
+ const [scopeType, setScopeType] = useState72("full");
19649
+ const [selectedBlocks, setSelectedBlocks] = useState72([]);
19650
+ const [expirationEnabled, setExpirationEnabled] = useState72(false);
19651
+ const [expirationDays, setExpirationDays] = useState72(30);
19652
+ const [canDelegate, setCanDelegate] = useState72(false);
19653
+ const [pin, setPin] = useState72("");
19654
+ const [loading, setLoading] = useState72(false);
19655
+ const [error, setError] = useState72(null);
19656
+ const handleSearch = useCallback51(async () => {
18282
19657
  if (searchQuery.length < 2) return;
18283
19658
  setSearching(true);
18284
19659
  try {
@@ -18365,30 +19740,30 @@ var GrantPermissionModal = ({
18365
19740
  resetForm();
18366
19741
  }
18367
19742
  };
18368
- return /* @__PURE__ */ React174.createElement(
19743
+ return /* @__PURE__ */ React196.createElement(
18369
19744
  Modal4,
18370
19745
  {
18371
19746
  opened,
18372
19747
  onClose: handleClose,
18373
- title: /* @__PURE__ */ React174.createElement(Group54, { gap: "xs" }, /* @__PURE__ */ React174.createElement(IconShieldPlus3, { size: 20 }), /* @__PURE__ */ React174.createElement(Text88, { fw: 600 }, "Grant Permission")),
19748
+ title: /* @__PURE__ */ React196.createElement(Group63, { gap: "xs" }, /* @__PURE__ */ React196.createElement(IconShieldPlus3, { size: 20 }), /* @__PURE__ */ React196.createElement(Text99, { fw: 600 }, "Grant Permission")),
18374
19749
  size: "lg"
18375
19750
  },
18376
- /* @__PURE__ */ React174.createElement(Stack115, { gap: "md" }, /* @__PURE__ */ React174.createElement(Stack115, { gap: "xs" }, /* @__PURE__ */ React174.createElement(Text88, { size: "sm", fw: 500 }, "Recipient Type"), /* @__PURE__ */ React174.createElement(Radio6.Group, { value: recipientType, onChange: (v) => {
19751
+ /* @__PURE__ */ React196.createElement(Stack125, { gap: "md" }, /* @__PURE__ */ React196.createElement(Stack125, { gap: "xs" }, /* @__PURE__ */ React196.createElement(Text99, { size: "sm", fw: 500 }, "Recipient Type"), /* @__PURE__ */ React196.createElement(Radio6.Group, { value: recipientType, onChange: (v) => {
18377
19752
  setRecipientType(v);
18378
19753
  setSelectedRecipient(null);
18379
19754
  setSearchResults([]);
18380
- } }, /* @__PURE__ */ React174.createElement(Group54, null, /* @__PURE__ */ React174.createElement(Radio6, { value: "user", label: "User" }), /* @__PURE__ */ React174.createElement(Radio6, { value: "oracle", label: "Oracle" }), /* @__PURE__ */ React174.createElement(Radio6, { value: "manual", label: "Enter DID" })))), recipientType !== "manual" ? /* @__PURE__ */ React174.createElement(Stack115, { gap: "xs" }, /* @__PURE__ */ React174.createElement(
19755
+ } }, /* @__PURE__ */ React196.createElement(Group63, null, /* @__PURE__ */ React196.createElement(Radio6, { value: "user", label: "User" }), /* @__PURE__ */ React196.createElement(Radio6, { value: "oracle", label: "Oracle" }), /* @__PURE__ */ React196.createElement(Radio6, { value: "manual", label: "Enter DID" })))), recipientType !== "manual" ? /* @__PURE__ */ React196.createElement(Stack125, { gap: "xs" }, /* @__PURE__ */ React196.createElement(
18381
19756
  TextInput7,
18382
19757
  {
18383
19758
  placeholder: recipientType === "oracle" ? "Search oracles..." : "Search users...",
18384
- leftSection: /* @__PURE__ */ React174.createElement(IconSearch5, { size: 16 }),
18385
- rightSection: searching ? /* @__PURE__ */ React174.createElement(Loader24, { size: 14 }) : null,
19759
+ leftSection: /* @__PURE__ */ React196.createElement(IconSearch5, { size: 16 }),
19760
+ rightSection: searching ? /* @__PURE__ */ React196.createElement(Loader26, { size: 14 }) : null,
18386
19761
  value: searchQuery,
18387
19762
  onChange: (e) => setSearchQuery(e.currentTarget.value),
18388
19763
  onKeyDown: (e) => e.key === "Enter" && handleSearch()
18389
19764
  }
18390
- ), selectedRecipient ? /* @__PURE__ */ React174.createElement(Paper17, { p: "sm", withBorder: true }, /* @__PURE__ */ React174.createElement(Group54, { justify: "space-between" }, /* @__PURE__ */ React174.createElement(Group54, { gap: "xs" }, recipientType === "oracle" ? /* @__PURE__ */ React174.createElement(IconRobot4, { size: 16 }) : /* @__PURE__ */ React174.createElement(IconUser5, { size: 16 }), /* @__PURE__ */ React174.createElement(Text88, { size: "sm" }, selectedRecipient.displayName), /* @__PURE__ */ React174.createElement(Badge25, { size: "xs", variant: "light" }, selectedRecipient.did.slice(-12))), /* @__PURE__ */ React174.createElement(ActionIcon27, { size: "sm", variant: "subtle", onClick: () => setSelectedRecipient(null) }, /* @__PURE__ */ React174.createElement(IconX8, { size: 14 })))) : searchResults.length > 0 ? /* @__PURE__ */ React174.createElement(Paper17, { p: "xs", withBorder: true, style: { maxHeight: 150, overflow: "auto" } }, /* @__PURE__ */ React174.createElement(Stack115, { gap: 4 }, searchResults.map((result) => /* @__PURE__ */ React174.createElement(
18391
- Button35,
19765
+ ), selectedRecipient ? /* @__PURE__ */ React196.createElement(Paper20, { p: "sm", withBorder: true }, /* @__PURE__ */ React196.createElement(Group63, { justify: "space-between" }, /* @__PURE__ */ React196.createElement(Group63, { gap: "xs" }, recipientType === "oracle" ? /* @__PURE__ */ React196.createElement(IconRobot4, { size: 16 }) : /* @__PURE__ */ React196.createElement(IconUser5, { size: 16 }), /* @__PURE__ */ React196.createElement(Text99, { size: "sm" }, selectedRecipient.displayName), /* @__PURE__ */ React196.createElement(Badge30, { size: "xs", variant: "light" }, selectedRecipient.did.slice(-12))), /* @__PURE__ */ React196.createElement(ActionIcon29, { size: "sm", variant: "subtle", onClick: () => setSelectedRecipient(null) }, /* @__PURE__ */ React196.createElement(IconX8, { size: 14 })))) : searchResults.length > 0 ? /* @__PURE__ */ React196.createElement(Paper20, { p: "xs", withBorder: true, style: { maxHeight: 150, overflow: "auto" } }, /* @__PURE__ */ React196.createElement(Stack125, { gap: 4 }, searchResults.map((result) => /* @__PURE__ */ React196.createElement(
19766
+ Button37,
18392
19767
  {
18393
19768
  key: result.did,
18394
19769
  variant: "subtle",
@@ -18397,7 +19772,7 @@ var GrantPermissionModal = ({
18397
19772
  onClick: () => setSelectedRecipient(result)
18398
19773
  },
18399
19774
  result.displayName
18400
- )))) : null) : /* @__PURE__ */ React174.createElement(
19775
+ )))) : null) : /* @__PURE__ */ React196.createElement(
18401
19776
  TextInput7,
18402
19777
  {
18403
19778
  label: "Recipient DID",
@@ -18405,12 +19780,12 @@ var GrantPermissionModal = ({
18405
19780
  value: manualDid,
18406
19781
  onChange: (e) => setManualDid(e.currentTarget.value)
18407
19782
  }
18408
- ), /* @__PURE__ */ React174.createElement(Divider12, null), /* @__PURE__ */ React174.createElement(Stack115, { gap: "xs" }, /* @__PURE__ */ React174.createElement(Text88, { size: "sm", fw: 500 }, "Permission Scope"), singleBlockMode && fixedBlock ? (
19783
+ ), /* @__PURE__ */ React196.createElement(Divider13, null), /* @__PURE__ */ React196.createElement(Stack125, { gap: "xs" }, /* @__PURE__ */ React196.createElement(Text99, { size: "sm", fw: 500 }, "Permission Scope"), singleBlockMode && fixedBlock ? (
18409
19784
  // Single block mode: show fixed block info
18410
- /* @__PURE__ */ React174.createElement(Paper17, { p: "sm", withBorder: true }, /* @__PURE__ */ React174.createElement(Group54, { gap: "xs" }, /* @__PURE__ */ React174.createElement(Badge25, { variant: "light", color: "blue" }, fixedBlock.type), /* @__PURE__ */ React174.createElement(Text88, { size: "sm" }, fixedBlock.name || `Block ${fixedBlock.id.slice(-8)}`)), /* @__PURE__ */ React174.createElement(Text88, { size: "xs", c: "dimmed", mt: "xs" }, "Permission will be granted to execute this specific block."))
19785
+ /* @__PURE__ */ React196.createElement(Paper20, { p: "sm", withBorder: true }, /* @__PURE__ */ React196.createElement(Group63, { gap: "xs" }, /* @__PURE__ */ React196.createElement(Badge30, { variant: "light", color: "blue" }, fixedBlock.type), /* @__PURE__ */ React196.createElement(Text99, { size: "sm" }, fixedBlock.name || `Block ${fixedBlock.id.slice(-8)}`)), /* @__PURE__ */ React196.createElement(Text99, { size: "xs", c: "dimmed", mt: "xs" }, "Permission will be granted to execute this specific block."))
18411
19786
  ) : (
18412
19787
  // Multi-block mode: show scope selection
18413
- /* @__PURE__ */ React174.createElement(React174.Fragment, null, /* @__PURE__ */ React174.createElement(Radio6.Group, { value: scopeType, onChange: (v) => setScopeType(v) }, /* @__PURE__ */ React174.createElement(Stack115, { gap: "xs" }, /* @__PURE__ */ React174.createElement(Radio6, { value: "full", label: "Full flow access (can execute any block)" }), /* @__PURE__ */ React174.createElement(Radio6, { value: "blocks", label: "Specific blocks only" }))), scopeType === "blocks" && /* @__PURE__ */ React174.createElement(Paper17, { p: "sm", withBorder: true, style: { maxHeight: 150, overflow: "auto" } }, /* @__PURE__ */ React174.createElement(Stack115, { gap: "xs" }, blocks.map((block) => /* @__PURE__ */ React174.createElement(
19788
+ /* @__PURE__ */ React196.createElement(React196.Fragment, null, /* @__PURE__ */ React196.createElement(Radio6.Group, { value: scopeType, onChange: (v) => setScopeType(v) }, /* @__PURE__ */ React196.createElement(Stack125, { gap: "xs" }, /* @__PURE__ */ React196.createElement(Radio6, { value: "full", label: "Full flow access (can execute any block)" }), /* @__PURE__ */ React196.createElement(Radio6, { value: "blocks", label: "Specific blocks only" }))), scopeType === "blocks" && /* @__PURE__ */ React196.createElement(Paper20, { p: "sm", withBorder: true, style: { maxHeight: 150, overflow: "auto" } }, /* @__PURE__ */ React196.createElement(Stack125, { gap: "xs" }, blocks.map((block) => /* @__PURE__ */ React196.createElement(
18414
19789
  Checkbox12,
18415
19790
  {
18416
19791
  key: block.id,
@@ -18425,14 +19800,14 @@ var GrantPermissionModal = ({
18425
19800
  }
18426
19801
  }
18427
19802
  )))))
18428
- )), /* @__PURE__ */ React174.createElement(Divider12, null), /* @__PURE__ */ React174.createElement(Stack115, { gap: "xs" }, /* @__PURE__ */ React174.createElement(
19803
+ )), /* @__PURE__ */ React196.createElement(Divider13, null), /* @__PURE__ */ React196.createElement(Stack125, { gap: "xs" }, /* @__PURE__ */ React196.createElement(
18429
19804
  Checkbox12,
18430
19805
  {
18431
19806
  label: "Set expiration",
18432
19807
  checked: expirationEnabled,
18433
19808
  onChange: (e) => setExpirationEnabled(e.currentTarget.checked)
18434
19809
  }
18435
- ), expirationEnabled && /* @__PURE__ */ React174.createElement(
19810
+ ), expirationEnabled && /* @__PURE__ */ React196.createElement(
18436
19811
  NumberInput3,
18437
19812
  {
18438
19813
  label: "Expires in (days)",
@@ -18442,7 +19817,7 @@ var GrantPermissionModal = ({
18442
19817
  min: 1,
18443
19818
  max: 365
18444
19819
  }
18445
- )), /* @__PURE__ */ React174.createElement(
19820
+ )), /* @__PURE__ */ React196.createElement(
18446
19821
  Checkbox12,
18447
19822
  {
18448
19823
  label: "Recipient can grant permissions to others",
@@ -18450,7 +19825,7 @@ var GrantPermissionModal = ({
18450
19825
  checked: canDelegate,
18451
19826
  onChange: (e) => setCanDelegate(e.currentTarget.checked)
18452
19827
  }
18453
- ), /* @__PURE__ */ React174.createElement(Divider12, null), /* @__PURE__ */ React174.createElement(
19828
+ ), /* @__PURE__ */ React196.createElement(Divider13, null), /* @__PURE__ */ React196.createElement(
18454
19829
  TextInput7,
18455
19830
  {
18456
19831
  label: "Enter your PIN to sign this delegation",
@@ -18459,7 +19834,7 @@ var GrantPermissionModal = ({
18459
19834
  value: pin,
18460
19835
  onChange: (e) => setPin(e.currentTarget.value)
18461
19836
  }
18462
- ), error && /* @__PURE__ */ React174.createElement(Alert25, { color: "red" }, error), /* @__PURE__ */ React174.createElement(Group54, { justify: "flex-end" }, /* @__PURE__ */ React174.createElement(Button35, { variant: "subtle", onClick: handleClose, disabled: loading }, "Cancel"), /* @__PURE__ */ React174.createElement(Button35, { onClick: handleGrant, loading }, "Grant Permission")))
19837
+ ), error && /* @__PURE__ */ React196.createElement(Alert27, { color: "red" }, error), /* @__PURE__ */ React196.createElement(Group63, { justify: "flex-end" }, /* @__PURE__ */ React196.createElement(Button37, { variant: "subtle", onClick: handleClose, disabled: loading }, "Cancel"), /* @__PURE__ */ React196.createElement(Button37, { onClick: handleGrant, loading }, "Grant Permission")))
18463
19838
  );
18464
19839
  };
18465
19840
 
@@ -18565,4 +19940,4 @@ export {
18565
19940
  ixoGraphQLClient,
18566
19941
  getEntity
18567
19942
  };
18568
- //# sourceMappingURL=chunk-LNFOOQY3.mjs.map
19943
+ //# sourceMappingURL=chunk-ER7KTMUM.mjs.map