framer-api 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +263 -1
- package/dist/index.js +6 -6
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -60,6 +60,16 @@ interface SubmitAgentClarificationOptions {
|
|
|
60
60
|
conversationId: string;
|
|
61
61
|
answers: AgentClarificationAnswer[];
|
|
62
62
|
}
|
|
63
|
+
interface RunSupervisorAgentCommandOptions {
|
|
64
|
+
goal: string;
|
|
65
|
+
model: string;
|
|
66
|
+
pagePath?: string;
|
|
67
|
+
maxSteps?: number;
|
|
68
|
+
}
|
|
69
|
+
interface RunSupervisorAgentCommandResult {
|
|
70
|
+
filename: string;
|
|
71
|
+
archiveBase64: string;
|
|
72
|
+
}
|
|
63
73
|
interface AgentTurnOptions {
|
|
64
74
|
/**
|
|
65
75
|
* Treat these nodes as the implicit selection for this agent turn.
|
|
@@ -4646,9 +4656,22 @@ declare const readProjectForAgent: unique symbol;
|
|
|
4646
4656
|
declare const getAgentSystemPrompt: unique symbol;
|
|
4647
4657
|
declare const getAgentContext: unique symbol;
|
|
4648
4658
|
declare const applyAgentChanges: unique symbol;
|
|
4659
|
+
declare const flattenComponentInstanceForAgent: unique symbol;
|
|
4660
|
+
declare const getAncestorsForAgent: unique symbol;
|
|
4661
|
+
declare const getGroundNodeForAgent: unique symbol;
|
|
4662
|
+
declare const getNodeForAgent: unique symbol;
|
|
4663
|
+
declare const getNodesForAgent: unique symbol;
|
|
4664
|
+
declare const getNodesOfTypesForAgent: unique symbol;
|
|
4665
|
+
declare const getParentNodeForAgent: unique symbol;
|
|
4666
|
+
declare const getScopeNodeForAgent: unique symbol;
|
|
4667
|
+
declare const makeExternalComponentLocalForAgent: unique symbol;
|
|
4668
|
+
declare const publishForAgent: unique symbol;
|
|
4669
|
+
declare const queryImagesForAgent: unique symbol;
|
|
4670
|
+
declare const reviewChangesForAgent: unique symbol;
|
|
4649
4671
|
declare const startAgentConversation: unique symbol;
|
|
4650
4672
|
declare const continueAgentConversation: unique symbol;
|
|
4651
4673
|
declare const submitAgentClarification: unique symbol;
|
|
4674
|
+
declare const runSupervisorAgentCommand: unique symbol;
|
|
4652
4675
|
declare const $framerApiOnly: {
|
|
4653
4676
|
readonly publish: typeof publish;
|
|
4654
4677
|
readonly getDeployments: typeof getDeployments;
|
|
@@ -4661,9 +4684,22 @@ declare const $framerApiOnly: {
|
|
|
4661
4684
|
readonly getAgentSystemPrompt: typeof getAgentSystemPrompt;
|
|
4662
4685
|
readonly getAgentContext: typeof getAgentContext;
|
|
4663
4686
|
readonly applyAgentChanges: typeof applyAgentChanges;
|
|
4687
|
+
readonly flattenComponentInstanceForAgent: typeof flattenComponentInstanceForAgent;
|
|
4688
|
+
readonly getAncestorsForAgent: typeof getAncestorsForAgent;
|
|
4689
|
+
readonly getGroundNodeForAgent: typeof getGroundNodeForAgent;
|
|
4690
|
+
readonly getNodeForAgent: typeof getNodeForAgent;
|
|
4691
|
+
readonly getNodesForAgent: typeof getNodesForAgent;
|
|
4692
|
+
readonly getNodesOfTypesForAgent: typeof getNodesOfTypesForAgent;
|
|
4693
|
+
readonly getParentNodeForAgent: typeof getParentNodeForAgent;
|
|
4694
|
+
readonly getScopeNodeForAgent: typeof getScopeNodeForAgent;
|
|
4695
|
+
readonly makeExternalComponentLocalForAgent: typeof makeExternalComponentLocalForAgent;
|
|
4696
|
+
readonly publishForAgent: typeof publishForAgent;
|
|
4697
|
+
readonly queryImagesForAgent: typeof queryImagesForAgent;
|
|
4698
|
+
readonly reviewChangesForAgent: typeof reviewChangesForAgent;
|
|
4664
4699
|
readonly startAgentConversation: typeof startAgentConversation;
|
|
4665
4700
|
readonly continueAgentConversation: typeof continueAgentConversation;
|
|
4666
4701
|
readonly submitAgentClarification: typeof submitAgentClarification;
|
|
4702
|
+
readonly runSupervisorAgentCommand: typeof runSupervisorAgentCommand;
|
|
4667
4703
|
};
|
|
4668
4704
|
|
|
4669
4705
|
type Ownership = {
|
|
@@ -4737,7 +4773,7 @@ type AllMembers = Omit<FramerPluginAPIAlpha, "isAllowedTo" | "subscribeToIsAllow
|
|
|
4737
4773
|
"WebPageNode.clone": WebPageNode["clone"];
|
|
4738
4774
|
"DesignPageNode.clone": DesignPageNode["clone"];
|
|
4739
4775
|
} & NamespaceMembers<ColorStyle, "ColorStyle"> & NamespaceMembers<TextStyle, "TextStyle"> & NamespaceMembers<Variable, "Variable"> & NamespaceMembers<BooleanVariable, "BooleanVariable", Variable> & NamespaceMembers<NumberVariable, "NumberVariable", Variable> & NamespaceMembers<StringVariable, "StringVariable", Variable> & NamespaceMembers<FormattedTextVariable, "FormattedTextVariable", Variable> & NamespaceMembers<EnumCase, "EnumCase"> & NamespaceMembers<EnumVariable, "EnumVariable", Variable> & NamespaceMembers<ColorVariable, "ColorVariable", Variable> & NamespaceMembers<ImageVariable, "ImageVariable", Variable> & NamespaceMembers<FileVariable, "FileVariable", Variable> & NamespaceMembers<LinkVariable, "LinkVariable", Variable> & NamespaceMembers<DateVariable, "DateVariable", Variable> & NamespaceMembers<BorderVariable, "BorderVariable", Variable> & NamespaceMembers<UnsupportedVariable, "UnsupportedVariable", Variable> & NamespaceMembers<VectorSet, "VectorSet"> & NamespaceMembers<VectorSetItem, "VectorSetItem">;
|
|
4740
|
-
declare const unprotectedMessageTypesSource: ["closeNotification", "closePlugin", "setCloseWarning", "getActiveCollection", "getActiveLocale", "getActiveManagedCollection", "getCanvasRoot", "getChildren", "getCollection", "getCollectionFields", "getCollectionFields2", "getCollectionItems", "getCollectionItems2", "getCollections", "getColorStyle", "getColorStyles", "getCurrentUser", "getCurrentUser2", "getCustomCode", "getDefaultLocale", "getFont", "getFonts", "getImage", "getImageData", "getLocales", "getLocaleLanguages", "getLocaleRegions", "getLocalizationGroups", "getManagedCollection", "getManagedCollectionFields", "getManagedCollectionFields2", "getManagedCollectionItemIds", "getManagedCollections", "getNode", "getNodesWithAttribute", "getNodesWithAttributeSet", "getNodesWithType", "getParent", "getPluginData", "getPluginDataForNode", "getPluginDataKeys", "getPluginDataKeysForNode", "getProjectInfo", "getProjectInfo2", "getPublishInfo", "getRect", "getSelection", "getSVGForNode", "getText", "getTextForNode", "getTextStyle", "getTextStyles", "hideUI", "setBackgroundMessage", "notify", "onPointerDown", "setActiveCollection", "setSelection", "showUI", "getCodeFileVersionContent", "typecheckCode", "getCodeFileVersions", "getCodeFiles", "getCodeFile", "getRedirects", "uploadFile", "uploadFiles", "uploadImage", "uploadImages", "zoomIntoView", "navigateTo", "getRuntimeErrorForModule", "getRuntimeErrorForCodeComponentNode", "showProgressOnInstances", "removeProgressFromInstances", "addComponentInstancePlaceholder", "updateComponentInstancePlaceholder", "removeComponentInstancePlaceholder", "setMenu", "showContextMenu", "getBreakpointSuggestionsForWebPage", "getActiveCollectionItemForWebPage", "getVariables", "getVectorSets", "getVectorSetItems", "getVectorSetItemVariables", "getChangedPaths", "getChangeContributors", "getDeployments", "readProjectForAgent", "getAgentSystemPrompt", "getAgentContext", "INTERNAL_getAiServiceInfo", "INTERNAL_sendTrackingEvent", "INTERNAL_getCurrentUser", "INTERNAL_getProjectInfo", "INTERNAL_getHTMLForNode", "getAiServiceInfo", "sendTrackingEvent", "unstable_getCodeFile", "unstable_getCodeFiles", "unstable_getCodeFileVersionContent", "unstable_getCodeFileLint2", "unstable_getCodeFileTypecheck2", "unstable_getCodeFileVersions", "lintCode"];
|
|
4776
|
+
declare const unprotectedMessageTypesSource: ["closeNotification", "closePlugin", "setCloseWarning", "getActiveCollection", "getActiveLocale", "getActiveManagedCollection", "getCanvasRoot", "getChildren", "getCollection", "getCollectionFields", "getCollectionFields2", "getCollectionItems", "getCollectionItems2", "getCollections", "getColorStyle", "getColorStyles", "getCurrentUser", "getCurrentUser2", "getCustomCode", "getDefaultLocale", "getFont", "getFonts", "getImage", "getImageData", "getLocales", "getLocaleLanguages", "getLocaleRegions", "getLocalizationGroups", "getManagedCollection", "getManagedCollectionFields", "getManagedCollectionFields2", "getManagedCollectionItemIds", "getManagedCollections", "getNode", "getNodesWithAttribute", "getNodesWithAttributeSet", "getNodesWithType", "getParent", "getPluginData", "getPluginDataForNode", "getPluginDataKeys", "getPluginDataKeysForNode", "getProjectInfo", "getProjectInfo2", "getPublishInfo", "getRect", "getSelection", "getSVGForNode", "getText", "getTextForNode", "getTextStyle", "getTextStyles", "hideUI", "setBackgroundMessage", "notify", "onPointerDown", "setActiveCollection", "setSelection", "showUI", "getCodeFileVersionContent", "typecheckCode", "getCodeFileVersions", "getCodeFiles", "getCodeFile", "getRedirects", "uploadFile", "uploadFiles", "uploadImage", "uploadImages", "zoomIntoView", "navigateTo", "getRuntimeErrorForModule", "getRuntimeErrorForCodeComponentNode", "showProgressOnInstances", "removeProgressFromInstances", "addComponentInstancePlaceholder", "updateComponentInstancePlaceholder", "removeComponentInstancePlaceholder", "setMenu", "showContextMenu", "getBreakpointSuggestionsForWebPage", "getActiveCollectionItemForWebPage", "getVariables", "getVectorSets", "getVectorSetItems", "getVectorSetItemVariables", "getChangedPaths", "getChangeContributors", "getDeployments", "readProjectForAgent", "getAgentSystemPrompt", "getAgentContext", "queryImagesForAgent", "reviewChangesForAgent", "getNodeForAgent", "getNodesForAgent", "getNodesOfTypesForAgent", "getScopeNodeForAgent", "getGroundNodeForAgent", "getParentNodeForAgent", "getAncestorsForAgent", "INTERNAL_getAiServiceInfo", "INTERNAL_sendTrackingEvent", "INTERNAL_getCurrentUser", "INTERNAL_getProjectInfo", "INTERNAL_getHTMLForNode", "getAiServiceInfo", "sendTrackingEvent", "unstable_getCodeFile", "unstable_getCodeFiles", "unstable_getCodeFileVersionContent", "unstable_getCodeFileLint2", "unstable_getCodeFileTypecheck2", "unstable_getCodeFileVersions", "lintCode"];
|
|
4741
4777
|
type UnprotectedMessageType = (typeof unprotectedMessageTypesSource)[number];
|
|
4742
4778
|
type ProtectedMessageType = Exclude<keyof PluginMessageAPI, UnprotectedMessageType>;
|
|
4743
4779
|
type Method = keyof {
|
|
@@ -4985,9 +5021,22 @@ declare const methodToMessageTypes: {
|
|
|
4985
5021
|
readonly [getAgentSystemPrompt]: [];
|
|
4986
5022
|
readonly [getAgentContext]: [];
|
|
4987
5023
|
readonly [applyAgentChanges]: ["applyAgentChanges"];
|
|
5024
|
+
readonly [flattenComponentInstanceForAgent]: ["flattenComponentInstanceForAgent"];
|
|
5025
|
+
readonly [getAncestorsForAgent]: [];
|
|
5026
|
+
readonly [getGroundNodeForAgent]: [];
|
|
5027
|
+
readonly [getNodeForAgent]: [];
|
|
5028
|
+
readonly [getNodesForAgent]: [];
|
|
5029
|
+
readonly [getNodesOfTypesForAgent]: [];
|
|
5030
|
+
readonly [getParentNodeForAgent]: [];
|
|
5031
|
+
readonly [getScopeNodeForAgent]: [];
|
|
5032
|
+
readonly [makeExternalComponentLocalForAgent]: ["makeExternalComponentLocalForAgent"];
|
|
5033
|
+
readonly [publishForAgent]: ["publishForAgent"];
|
|
5034
|
+
readonly [queryImagesForAgent]: [];
|
|
5035
|
+
readonly [reviewChangesForAgent]: [];
|
|
4988
5036
|
readonly [startAgentConversation]: ["startAgentConversation"];
|
|
4989
5037
|
readonly [continueAgentConversation]: ["continueAgentConversation"];
|
|
4990
5038
|
readonly [submitAgentClarification]: ["submitAgentClarification"];
|
|
5039
|
+
readonly [runSupervisorAgentCommand]: ["runSupervisorAgentCommand"];
|
|
4991
5040
|
};
|
|
4992
5041
|
type AllMethods = keyof {
|
|
4993
5042
|
[K in Method as (typeof methodToMessageTypes)[K] extends [] ? never : K]: (typeof methodToMessageTypes)[K];
|
|
@@ -5130,6 +5179,8 @@ interface ThemeTokens {
|
|
|
5130
5179
|
"--framer-color-bg": string;
|
|
5131
5180
|
"--framer-color-bg-secondary": string;
|
|
5132
5181
|
"--framer-color-bg-tertiary": string;
|
|
5182
|
+
"--framer-color-control": string;
|
|
5183
|
+
"--framer-color-control-hover": string;
|
|
5133
5184
|
"--framer-color-divider": string;
|
|
5134
5185
|
"--framer-color-tint-extra-dark": string;
|
|
5135
5186
|
}
|
|
@@ -6533,12 +6584,157 @@ declare class FramerPluginAPIAlpha extends FramerPluginAPIBeta {
|
|
|
6533
6584
|
[$framerApiOnly.applyAgentChanges](dsl: string, options?: {
|
|
6534
6585
|
pagePath?: string;
|
|
6535
6586
|
}): Promise<void>;
|
|
6587
|
+
/**
|
|
6588
|
+
* Executes the publish flow on behalf of an agent.
|
|
6589
|
+
*
|
|
6590
|
+
* The input schema is documented in the string returned by {@link getAgentSystemPrompt}.
|
|
6591
|
+
*
|
|
6592
|
+
* @param input - Action-discriminated input object (preview / confirm_publish / deploy_to_production).
|
|
6593
|
+
* @returns The action's result — status, publish URLs, and any errors, warnings, or changes.
|
|
6594
|
+
*/
|
|
6595
|
+
[$framerApiOnly.publishForAgent](input?: Record<string, unknown>): Promise<unknown>;
|
|
6596
|
+
/**
|
|
6597
|
+
* Searches for stock images to use on the canvas (e.g. `"FrameNode"` `fill` values). Returns
|
|
6598
|
+
* candidate images with preview thumbnails and a `url` field for each. The returned URLs are
|
|
6599
|
+
* registered as trusted for this session so they can be applied directly via `fill="<url>"`
|
|
6600
|
+
* in a subsequent {@link applyAgentChanges} DSL command. Without calling this method first,
|
|
6601
|
+
* external image URLs are rejected at apply time.
|
|
6602
|
+
*
|
|
6603
|
+
* The input schema is documented in the string returned by {@link getAgentSystemPrompt}.
|
|
6604
|
+
*
|
|
6605
|
+
* @param input - Search input object (source / query / count / orientation).
|
|
6606
|
+
* @returns An object describing the candidates or an error.
|
|
6607
|
+
*/
|
|
6608
|
+
[$framerApiOnly.queryImagesForAgent](input: Record<string, unknown>): Promise<unknown>;
|
|
6609
|
+
/**
|
|
6610
|
+
* Reviews changes made by prior {@link applyAgentChanges} calls in this session.
|
|
6611
|
+
*
|
|
6612
|
+
* Consumes accumulated diagnostics from the session's agent context.
|
|
6613
|
+
*
|
|
6614
|
+
* @param options.pagePath - Target page path (e.g. `"/about"`). Defaults to the active page.
|
|
6615
|
+
* @returns The session's accumulated changes, errors, warnings, and deferred trait reports.
|
|
6616
|
+
*/
|
|
6617
|
+
[$framerApiOnly.reviewChangesForAgent](options?: {
|
|
6618
|
+
pagePath?: string;
|
|
6619
|
+
}): Promise<unknown>;
|
|
6620
|
+
/**
|
|
6621
|
+
* Flattens a local component instance into raw editable layers.
|
|
6622
|
+
*
|
|
6623
|
+
* @param input - `{ id }`: the id of the component instance to flatten.
|
|
6624
|
+
* @param options.pagePath - Target page path (e.g. `"/about"`). Defaults to the active page.
|
|
6625
|
+
* @returns The flatten result — `success` with a `replacementId`, or `blocked` with a reason.
|
|
6626
|
+
*/
|
|
6627
|
+
[$framerApiOnly.flattenComponentInstanceForAgent](input: {
|
|
6628
|
+
id: string;
|
|
6629
|
+
}, options?: {
|
|
6630
|
+
pagePath?: string;
|
|
6631
|
+
}): Promise<unknown>;
|
|
6632
|
+
/**
|
|
6633
|
+
* Converts an external component into a local project component.
|
|
6634
|
+
*
|
|
6635
|
+
* @param input - `{ id, replaceAll? }`: the id of the external instance, and whether to replace all instances.
|
|
6636
|
+
* @param options.pagePath - Target page path (e.g. `"/about"`). Defaults to the active page.
|
|
6637
|
+
* @returns `success` (with the local component name), `needs_confirmation` (retry with `replaceAll`), or `blocked` with a reason.
|
|
6638
|
+
*/
|
|
6639
|
+
[$framerApiOnly.makeExternalComponentLocalForAgent](input: {
|
|
6640
|
+
id: string;
|
|
6641
|
+
replaceAll?: boolean;
|
|
6642
|
+
}, options?: {
|
|
6643
|
+
pagePath?: string;
|
|
6644
|
+
}): Promise<unknown>;
|
|
6645
|
+
/**
|
|
6646
|
+
* Get a single node on the page, including its children.
|
|
6647
|
+
*
|
|
6648
|
+
* @param input - `{ id }`: the id of the node to read.
|
|
6649
|
+
* @param options.pagePath - Target page path (e.g. `"/about"`). Defaults to the active page.
|
|
6650
|
+
* @returns The node, or `null` if no node with that id exists on the page.
|
|
6651
|
+
*/
|
|
6652
|
+
[$framerApiOnly.getNodeForAgent](input: {
|
|
6653
|
+
id: string;
|
|
6654
|
+
}, options?: {
|
|
6655
|
+
pagePath?: string;
|
|
6656
|
+
}): Promise<unknown>;
|
|
6657
|
+
/**
|
|
6658
|
+
* Get multiple nodes on the page, including their children.
|
|
6659
|
+
* Ids that don't resolve to a node are skipped.
|
|
6660
|
+
*
|
|
6661
|
+
* @param input - `{ ids }`: the ids of the nodes to read.
|
|
6662
|
+
* @param options.pagePath - Target page path (e.g. `"/about"`). Defaults to the active page.
|
|
6663
|
+
* @returns The nodes that were found, in input order.
|
|
6664
|
+
*/
|
|
6665
|
+
[$framerApiOnly.getNodesForAgent](input: {
|
|
6666
|
+
ids: readonly string[];
|
|
6667
|
+
}, options?: {
|
|
6668
|
+
pagePath?: string;
|
|
6669
|
+
}): Promise<unknown>;
|
|
6670
|
+
/**
|
|
6671
|
+
* Get every node on the page of one or more kinds (e.g. `"FrameNode"`, `"RichTextNode"`, `"ComponentInstanceNode"`).
|
|
6672
|
+
*
|
|
6673
|
+
* @param input - `{ types }`: the node kinds to match.
|
|
6674
|
+
* @param options.pagePath - Target page path (e.g. `"/about"`). Defaults to the active page.
|
|
6675
|
+
* @returns The matching nodes without their children.
|
|
6676
|
+
*/
|
|
6677
|
+
[$framerApiOnly.getNodesOfTypesForAgent](input: {
|
|
6678
|
+
types: readonly string[];
|
|
6679
|
+
}, options?: {
|
|
6680
|
+
pagePath?: string;
|
|
6681
|
+
}): Promise<unknown>;
|
|
6682
|
+
/**
|
|
6683
|
+
* Get the scope node (page or component) that contains the given node.
|
|
6684
|
+
*
|
|
6685
|
+
* @param input - `{ id }`: the id of a node inside the scope.
|
|
6686
|
+
* @param options.pagePath - Target page path (e.g. `"/about"`). Defaults to the active page.
|
|
6687
|
+
* @returns The enclosing scope node, or `null` if the node isn't in any scope.
|
|
6688
|
+
*/
|
|
6689
|
+
[$framerApiOnly.getScopeNodeForAgent](input: {
|
|
6690
|
+
id: string;
|
|
6691
|
+
}, options?: {
|
|
6692
|
+
pagePath?: string;
|
|
6693
|
+
}): Promise<unknown>;
|
|
6694
|
+
/**
|
|
6695
|
+
* Get the top-level node on the canvas that contains the given node.
|
|
6696
|
+
*
|
|
6697
|
+
* @param input - `{ id }`: the id of a descendant node.
|
|
6698
|
+
* @param options.pagePath - Target page path (e.g. `"/about"`). Defaults to the active page.
|
|
6699
|
+
* @returns The top-level node, or `null` if none applies.
|
|
6700
|
+
*/
|
|
6701
|
+
[$framerApiOnly.getGroundNodeForAgent](input: {
|
|
6702
|
+
id: string;
|
|
6703
|
+
}, options?: {
|
|
6704
|
+
pagePath?: string;
|
|
6705
|
+
}): Promise<unknown>;
|
|
6706
|
+
/**
|
|
6707
|
+
* Get the direct parent of a node.
|
|
6708
|
+
*
|
|
6709
|
+
* @param input - `{ id }`: the id of the child node.
|
|
6710
|
+
* @param options.pagePath - Target page path (e.g. `"/about"`). Defaults to the active page.
|
|
6711
|
+
* @returns The parent node, or `null` if the node has no parent or doesn't exist.
|
|
6712
|
+
*/
|
|
6713
|
+
[$framerApiOnly.getParentNodeForAgent](input: {
|
|
6714
|
+
id: string;
|
|
6715
|
+
}, options?: {
|
|
6716
|
+
pagePath?: string;
|
|
6717
|
+
}): Promise<unknown>;
|
|
6718
|
+
/**
|
|
6719
|
+
* Get every ancestor of a node, from the direct parent up to the page root.
|
|
6720
|
+
*
|
|
6721
|
+
* @param input - `{ id }`: the id of the node to start from.
|
|
6722
|
+
* @param options.pagePath - Target page path (e.g. `"/about"`). Defaults to the active page.
|
|
6723
|
+
* @returns The ancestors ordered from closest parent to the page root.
|
|
6724
|
+
*/
|
|
6725
|
+
[$framerApiOnly.getAncestorsForAgent](input: {
|
|
6726
|
+
id: string;
|
|
6727
|
+
}, options?: {
|
|
6728
|
+
pagePath?: string;
|
|
6729
|
+
}): Promise<unknown>;
|
|
6536
6730
|
/** @internal - Available only through framer-api */
|
|
6537
6731
|
[$framerApiOnly.startAgentConversation](prompt: string, options?: StartAgentConversationOptions): Promise<StartAgentConversationResult>;
|
|
6538
6732
|
/** @internal - Available only through framer-api */
|
|
6539
6733
|
[$framerApiOnly.continueAgentConversation](prompt: string, options: ContinueAgentConversationOptions): Promise<ContinueAgentConversationResult>;
|
|
6540
6734
|
/** @internal - Available only through framer-api */
|
|
6541
6735
|
[$framerApiOnly.submitAgentClarification](options: SubmitAgentClarificationOptions): Promise<SubmitAgentClarificationResult>;
|
|
6736
|
+
/** @internal - Available only through framer-api */
|
|
6737
|
+
[$framerApiOnly.runSupervisorAgentCommand](options: RunSupervisorAgentCommandOptions): Promise<RunSupervisorAgentCommandResult>;
|
|
6542
6738
|
}
|
|
6543
6739
|
/**
|
|
6544
6740
|
* Methods that are only available through framer-api (server API),
|
|
@@ -6836,11 +7032,76 @@ interface PluginMessageAPI {
|
|
|
6836
7032
|
pagePath?: string;
|
|
6837
7033
|
}) => Promise<void>;
|
|
6838
7034
|
/** @alpha */
|
|
7035
|
+
publishForAgent: (input?: Record<string, unknown>) => Promise<unknown>;
|
|
7036
|
+
/** @alpha */
|
|
7037
|
+
queryImagesForAgent: (input: Record<string, unknown>) => Promise<unknown>;
|
|
7038
|
+
/** @alpha */
|
|
7039
|
+
reviewChangesForAgent: (options?: {
|
|
7040
|
+
pagePath?: string;
|
|
7041
|
+
}) => Promise<unknown>;
|
|
7042
|
+
/** @alpha */
|
|
7043
|
+
flattenComponentInstanceForAgent: (input: {
|
|
7044
|
+
id: string;
|
|
7045
|
+
}, options?: {
|
|
7046
|
+
pagePath?: string;
|
|
7047
|
+
}) => Promise<unknown>;
|
|
7048
|
+
/** @alpha */
|
|
7049
|
+
makeExternalComponentLocalForAgent: (input: {
|
|
7050
|
+
id: string;
|
|
7051
|
+
replaceAll?: boolean;
|
|
7052
|
+
}, options?: {
|
|
7053
|
+
pagePath?: string;
|
|
7054
|
+
}) => Promise<unknown>;
|
|
7055
|
+
/** @alpha */
|
|
7056
|
+
getNodeForAgent: (input: {
|
|
7057
|
+
id: string;
|
|
7058
|
+
}, options?: {
|
|
7059
|
+
pagePath?: string;
|
|
7060
|
+
}) => Promise<unknown>;
|
|
7061
|
+
/** @alpha */
|
|
7062
|
+
getNodesForAgent: (input: {
|
|
7063
|
+
ids: readonly string[];
|
|
7064
|
+
}, options?: {
|
|
7065
|
+
pagePath?: string;
|
|
7066
|
+
}) => Promise<unknown>;
|
|
7067
|
+
/** @alpha */
|
|
7068
|
+
getNodesOfTypesForAgent: (input: {
|
|
7069
|
+
types: readonly string[];
|
|
7070
|
+
}, options?: {
|
|
7071
|
+
pagePath?: string;
|
|
7072
|
+
}) => Promise<unknown>;
|
|
7073
|
+
/** @alpha */
|
|
7074
|
+
getScopeNodeForAgent: (input: {
|
|
7075
|
+
id: string;
|
|
7076
|
+
}, options?: {
|
|
7077
|
+
pagePath?: string;
|
|
7078
|
+
}) => Promise<unknown>;
|
|
7079
|
+
/** @alpha */
|
|
7080
|
+
getGroundNodeForAgent: (input: {
|
|
7081
|
+
id: string;
|
|
7082
|
+
}, options?: {
|
|
7083
|
+
pagePath?: string;
|
|
7084
|
+
}) => Promise<unknown>;
|
|
7085
|
+
/** @alpha */
|
|
7086
|
+
getParentNodeForAgent: (input: {
|
|
7087
|
+
id: string;
|
|
7088
|
+
}, options?: {
|
|
7089
|
+
pagePath?: string;
|
|
7090
|
+
}) => Promise<unknown>;
|
|
7091
|
+
/** @alpha */
|
|
7092
|
+
getAncestorsForAgent: (input: {
|
|
7093
|
+
id: string;
|
|
7094
|
+
}, options?: {
|
|
7095
|
+
pagePath?: string;
|
|
7096
|
+
}) => Promise<unknown>;
|
|
7097
|
+
/** @alpha */
|
|
6839
7098
|
startAgentConversation: (prompt: string, options?: StartAgentConversationOptions) => Promise<StartAgentConversationResult>;
|
|
6840
7099
|
/** @alpha */
|
|
6841
7100
|
continueAgentConversation: (prompt: string, options: ContinueAgentConversationOptions) => Promise<ContinueAgentConversationResult>;
|
|
6842
7101
|
/** @alpha */
|
|
6843
7102
|
submitAgentClarification: (options: SubmitAgentClarificationOptions) => Promise<SubmitAgentClarificationResult>;
|
|
7103
|
+
/** @alpha */
|
|
7104
|
+
runSupervisorAgentCommand: (options: RunSupervisorAgentCommandOptions) => Promise<RunSupervisorAgentCommandResult>;
|
|
6844
7105
|
[getAiServiceInfoMessageType]: (version?: AiServiceVersion) => Promise<AiServiceInfo>;
|
|
6845
7106
|
[sendTrackingEventMessageType]: (key: string, value: string, identifier: string) => Promise<void>;
|
|
6846
7107
|
[getCurrentUserMessageType]: () => Promise<User>;
|
|
@@ -6923,6 +7184,7 @@ declare class PluginEngine {
|
|
|
6923
7184
|
onMessage: (eventOrMessage: unknown) => void;
|
|
6924
7185
|
private getOnActionFromCallbackMap;
|
|
6925
7186
|
applyPluginTheme: (theme: Theme) => void;
|
|
7187
|
+
private applyPrereleaseStyles;
|
|
6926
7188
|
cloneNode(nodeId: NodeId): Promise<AnyNode | null>;
|
|
6927
7189
|
cloneWebPage(nodeId: NodeId, options?: WebPageCloneOptions): Promise<WebPageNode>;
|
|
6928
7190
|
cloneDesignPage(nodeId: NodeId, options?: DesignPageCloneOptions): Promise<DesignPageNode>;
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {env,isDeno,isWorkerd}from'std-env';import*as ue from'devalue';/* Framer API SDK v0.1.
|
|
2
|
-
var
|
|
1
|
+
import {env,isDeno,isWorkerd}from'std-env';import*as ue from'devalue';/* Framer API SDK v0.1.8 */
|
|
2
|
+
var fo=Object.defineProperty;var r=(n,e)=>fo(n,"name",{value:e,configurable:true});function pt(n){return n!==void 0}r(pt,"isDefined");function Ci(n){return n===void 0}r(Ci,"isUndefined");function I(n){return n===null}r(I,"isNull");function Ii(n){return n!==null}r(Ii,"isNotNull");function Pe(n){return n===true||n===false}r(Pe,"isBoolean");function f(n){return typeof n=="string"}r(f,"isString");function q(n){return typeof n=="number"&&Number.isFinite(n)}r(q,"isNumber");function yo(n){return typeof n=="function"}r(yo,"isFunction");function k(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}r(k,"isObject");function Se(n){if(typeof n!="object"||n===null)return false;let e=Object.getPrototypeOf(n);return e===null||e===Object.prototype}r(Se,"isPlainObject");function mt(n){return Array.isArray(n)}r(mt,"isArray");function Fe(n,e){throw e instanceof Error?e:e!==void 0?new Error(String(e)):new Error(n?`Unexpected value: ${n}`:"Application entered invalid state")}r(Fe,"assertNever");function c(n,...e){if(n)return;let t=Error("Assertion Error"+(e.length>0?": "+e.join(" "):""));if(t.stack)try{let i=t.stack.split(`
|
|
3
3
|
`);i[1]?.includes("assert")?(i.splice(1,1),t.stack=i.join(`
|
|
4
4
|
`)):i[0]?.includes("assert")&&(i.splice(0,1),t.stack=i.join(`
|
|
5
|
-
`));}catch{}throw t}r(c,"assert");function P(n){for(let e of Reflect.ownKeys(n)){let t=n[e];!t||typeof t!="object"&&!to(t)||P(t);}return Object.freeze(n)}r(P,"deepFreeze");function di(n){return [n.slice(0,-1),n.at(-1)]}r(di,"splitRestAndLast");var g="__class";var qt=Symbol(),Yt=Symbol(),Xt=Symbol(),Zt=Symbol(),no=Symbol(),io=Symbol(),ro=Symbol(),oo=Symbol(),ao=Symbol(),Jt=Symbol(),Qt=Symbol(),l={getAiServiceInfo:qt,sendTrackingEvent:Yt,getCurrentUser:Xt,getProjectInfo:Zt,environmentInfo:no,initialState:io,showUncheckedPermissionToasts:ro,marshal:oo,unmarshal:ao,getHTMLForNode:Jt,setHTMLForNode:Qt},pe="INTERNAL_",gt=`${pe}getAiServiceInfo`,ft=`${pe}sendTrackingEvent`,yt=`${pe}getCurrentUser`,ht=`${pe}getProjectInfo`,me=`${pe}getHTMLForNode`,ge=`${pe}setHTMLForNode`;var M=class{static{r(this,"VariableBase");}#e;#t;get nodeId(){return this.#t.nodeId}get nodeType(){return this.#t.nodeType}get id(){return this.#t.id}get name(){return this.#t.name}get description(){return this.#t.description??null}constructor(e,t){this.#e=e,this.#t=t;}async setAttributes(e){let t=await this.#e.invoke("updateVariable",this.nodeId,this.id,{...e,type:this.type});if(C(t))return null;let i=this.constructor;return new i(this.#e,t)}async remove(){await this.#e.invoke("removeVariables",this.nodeId,[this.id]);}},w="Variable";function V(n){let e=n.at(0);return c(!si(e)),`${e.toLowerCase()}${n.slice(1,-w.length)}`}r(V,"classToType");var so=`Boolean${w}`,lo=V(so),De=class n extends M{static{r(this,"BooleanVariable");}type=lo;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},uo=`Number${w}`,co=V(uo),ve=class n extends M{static{r(this,"NumberVariable");}type=co;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},po=`String${w}`,mo=V(po),Ne=class n extends M{static{r(this,"StringVariable");}type=mo;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},go=`FormattedText${w}`,fo=V(go),ke=class n extends M{static{r(this,"FormattedTextVariable");}type=fo;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},yo=`Enum${w}`,ho=V(yo),Y=class n{static{r(this,"EnumCase");}#e;#t;#n;#i;get id(){return this.#i.id}get name(){return this.#i.name}get nameByLocale(){return this.#i.nameByLocale}constructor(e,t,i,o){this.#e=e,this.#t=t,this.#n=i,this.#i=o;}async setAttributes(e){let t=await this.#e.invoke("updateEnumCase",this.#t,this.#n,this.id,e);return t?new n(this.#e,this.#t,this.#n,t):null}async remove(){await this.#e.invoke("removeEnumCase",this.#t,this.#n,this.id);}},Ee=class n extends M{static{r(this,"EnumVariable");}type=ho;#e;#t;#n;get cases(){return this.#n||(this.#n=P(this.#t.cases.map(e=>new Y(this.#e,this.nodeId,this.id,e)))),this.#n}constructor(e,t){super(e,t),this.#e=e,this.#t=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#t}async addCase(e){let t=await this.#e.invoke("addEnumCase",this.nodeId,this.id,e);return t?new Y(this.#e,this.nodeId,this.id,t):null}async setCaseOrder(e){await this.#e.invoke("setEnumCaseOrder",this.nodeId,this.id,e);}},bo=`Color${w}`,xo=V(bo),Me=class n extends M{static{r(this,"ColorVariable");}type=xo;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},Co=`Image${w}`,Io=V(Co),Ae=class n extends M{static{r(this,"ImageVariable");}type=Io;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},To=`File${w}`,Po=V(To),we=class n extends M{static{r(this,"FileVariable");}type=Po;#e;get allowedFileTypes(){return this.#e.allowedFileTypes}constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},So=`Link${w}`,Fo=V(So),Ve=class n extends M{static{r(this,"LinkVariable");}type=Fo;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},Do=`Date${w}`,vo=V(Do),We=class n extends M{static{r(this,"DateVariable");}type=vo;#e;get displayTime(){return this.#e.displayTime}constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},No=`Border${w}`,ko=V(No),Le=class n extends M{static{r(this,"BorderVariable");}type=ko;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},Eo=`Unsupported${w}`,Mo=V(Eo),Re=class n extends M{static{r(this,"UnsupportedVariable");}type=Mo;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}};function ui(n){return n instanceof M}r(ui,"isVariable");function Ao(n){return ui(n)&&n.nodeType==="component"}r(Ao,"isComponentVariable");var B=class{static{r(this,"FieldBase");}#e;#t;#n;get id(){return this.#n.id}get name(){return this.#n.name}constructor(e,t,i){this.#e=e,this.#t=t,this.#n=i;}async setAttributes(e){let t={...e,type:this.type,id:this.id},[i]=await this.#e.invoke("addCollectionFields2",this.#t,[t]);if(c(pt(i)),C(i))return null;c(i.type===this.type);let o=this.constructor;return new o(this.#e,this.#t,i)}async remove(){await this.#e.invoke("removeCollectionFields",this.#t,[this.id]);}},R=class extends B{static{r(this,"FieldBaseWithRequired");}#e;get required(){return this.#e.required}constructor(e,t,i){super(e,t,i),this.#e=i;}},bt=class extends B{static{r(this,"BooleanField");}type=nn},xt=class extends B{static{r(this,"ColorField");}type=rn},Ct=class extends B{static{r(this,"NumberField");}type=on},It=class extends R{static{r(this,"StringField");}type=an;#e;constructor(e,t,i){super(e,t,i),this.#e=i;}get basedOn(){return this.#e.basedOn}},Tt=class extends R{static{r(this,"FormattedTextField");}type=sn},Be=class extends R{static{r(this,"ImageField");}type=ln},Pt=class extends R{static{r(this,"LinkField");}type=un},St=class extends R{static{r(this,"DateField");}type=cn;#e;get displayTime(){return this.#e.displayTime}constructor(e,t,i){super(e,t,i),this.#e=i;}},Ft=class extends B{static{r(this,"FieldDivider");}type=yn},Ue=class extends B{static{r(this,"UnsupportedField");}type=hn},Dt=class extends R{static{r(this,"FileField");}type=pn;#e;get allowedFileTypes(){return this.#e.allowedFileTypes}constructor(e,t,i){super(e,t,i),this.#e=i;}},vt=class extends B{static{r(this,"EnumField");}type=mn;#e;#t;#n;#i;get cases(){return this.#i||(this.#i=this.#n.cases.map(e=>new Y(this.#e,this.#t,this.id,e)),P(this.#i)),this.#i}constructor(e,t,i){super(e,t,i),this.#e=e,this.#t=t,this.#n=i;}async addCase(e){let t=await this.#e.invoke("addEnumCase",this.#t,this.id,e);return t?new Y(this.#e,this.#t,this.id,t):null}async setCaseOrder(e){await this.#e.invoke("setEnumCaseOrder",this.#t,this.id,e);}},Nt=class extends R{static{r(this,"CollectionReferenceField");}type=gn;#e;get collectionId(){return this.#e.collectionId}constructor(e,t,i){super(e,t,i),this.#e=i;}},kt=class extends R{static{r(this,"MultiCollectionReferenceField");}type=fn;#e;get collectionId(){return this.#e.collectionId}constructor(e,t,i){super(e,t,i),this.#e=i;}},en=class extends R{static{r(this,"ArrayField");}type=dn;fields;constructor(e,t,i){super(e,t,i);let o=i.fields[0];this.fields=[new Be(e,t,o)];}};function tn(n,e,t){return n.map(i=>{switch(i.type){case nn:return new bt(e,t,i);case rn:return new xt(e,t,i);case on:return new Ct(e,t,i);case an:return new It(e,t,i);case sn:return new Tt(e,t,i);case ln:return new Be(e,t,i);case un:return new Pt(e,t,i);case cn:return new St(e,t,i);case yn:return new Ft(e,t,i);case hn:return new Ue(e,t,i);case pn:return new Dt(e,t,i);case mn:return new vt(e,t,i);case gn:return new Nt(e,t,i);case fn:return new kt(e,t,i);case dn:return new en(e,t,i);default:return new Ue(e,t,i)}})}r(tn,"fieldDefinitionDataArrayToFieldClassInstances");function wo(n){return n instanceof B}r(wo,"isField");var ci="action";function Vo(n){return !!n&&ci in n&&f(n[ci])}r(Vo,"isLocalizedValueUpdate");function pi(n){return Object.keys(n).reduce((e,t)=>{let i=n[t];return Vo(i)&&(e[t]=i),e},{})}r(pi,"filterInlineLocalizationValues");var Oe=class n{static{r(this,"FileAsset");}id;url;extension;constructor(e){this.url=e.url,this.id=e.id,this.extension=e.extension;}static[l.unmarshal](e,t){return new n(t)}[l.marshal](){return {[g]:"FileAsset",id:this.id,url:this.url,extension:this.extension}}};function Wo(n){return n instanceof Oe}r(Wo,"isFileAsset");var Lo="ImageAsset";function mi(n){return N(n)?n[g]===Lo:false}r(mi,"isImageAssetData");var X=class n{static{r(this,"ImageAsset");}id;url;thumbnailUrl;altText;resolution;#e;#t;constructor(e,t){this.#t=e,this.url=t.url,this.id=t.id,this.thumbnailUrl=t.thumbnailUrl,this.altText=t.altText,this.resolution=t.resolution;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return {[g]:"ImageAsset",id:this.id,url:this.url,thumbnailUrl:this.thumbnailUrl,altText:this.altText,resolution:this.resolution}}cloneWithAttributes({altText:e,resolution:t}){return new n(this.#t,{[g]:"ImageAsset",id:this.id,url:this.url,thumbnailUrl:this.thumbnailUrl,altText:e??this.altText,resolution:t??this.resolution})}async measure(){return Uo(this.url)}async getData(){if(this.#e&&this.#e.bytes.length>0)return this.#e;let e=await this.#t.invoke("getImageData",{id:this.id,resolution:this.resolution});if(!e)throw new Error("Failed to load image data");return this.#e=e,e}async loadBitmap(){let{mimeType:e,bytes:t}=await this.getData(),i=new Blob([t],{type:e});return createImageBitmap(i)}async loadImage(){let e=await this.getData(),t=URL.createObjectURL(new Blob([e.bytes]));return new Promise((i,o)=>{let a=new Image;a.onload=()=>i(a),a.onerror=()=>o(),a.src=t;})}};function Ro(n){return n instanceof X}r(Ro,"isImageAsset");function Z(n){return n.type==="bytes"?[n.bytes.buffer]:[]}r(Z,"getTransferable");function Bo(n){if(!N(n))return false;let e="bytes",t="mimeType";return !(!(e in n)||!(t in n)||!(n[e]instanceof Uint8Array)||!f(n[t]))}r(Bo,"isBytesData");async function ze(n){if(n instanceof File)return Cn(n);let e=await gi(n.image);return {name:n.name,altText:n.altText,resolution:n.resolution,preferredImageRendering:n.preferredImageRendering,...e}}r(ze,"createImageTransferFromInput");async function bn(n){if(n instanceof File)return Cn(n);let e=await gi(n.file);return {name:n.name,...e}}r(bn,"createFileTransferFromInput");async function gi(n){return n instanceof File?Cn(n):Bo(n)?{type:"bytes",mimeType:n.mimeType,bytes:n.bytes}:{type:"url",url:n}}r(gi,"createAssetTransferFromAssetInput");function xn(n){return Promise.all(n.map(ze))}r(xn,"createNamedAssetDataTransferFromInput");async function Cn(n){return new Promise((e,t)=>{let i=new FileReader;i.onload=o=>{let a=n.type,s=o.target?.result;if(!s||!(s instanceof ArrayBuffer)){t(new Error("Failed to read file, arrayBuffer is null"));return}let d=new Uint8Array(s);e({bytes:d,mimeType:a,type:"bytes",name:n.name});},i.onerror=o=>{t(o);},i.readAsArrayBuffer(n);})}r(Cn,"getAssetDataFromFile");async function Uo(n){let e=n instanceof File,t=e?URL.createObjectURL(n):n,i=new Image;return i.crossOrigin="anonymous",new Promise((o,a)=>{i.onload=()=>{o({width:i.naturalWidth,height:i.naturalHeight});},i.onerror=s=>{a(s);},i.src=t;}).finally(()=>{e&&URL.revokeObjectURL(t);})}r(Uo,"measureImage");var Et=class{static{r(this,"ComputedValueBase");}};var Oo="unsupported",Ge=class n extends Et{static{r(this,"UnsupportedComputedValue");}type=Oo;#e;constructor(e){super(),this.#e=e;}static[l.unmarshal](e,t){return new n(t)}[l.marshal](){return this.#e}};function zo(n){return n instanceof Et}r(zo,"isComputedValue");var Go="Font";function yi(n){return N(n)&&n[g]===Go}r(yi,"isFontData");function Ko(n){if(!q(n))return false;switch(n){case 100:case 200:case 300:case 400:case 500:case 600:case 700:case 800:case 900:return true;default:return false}}r(Ko,"isFontWeight");function $o(n){if(!f(n))return false;switch(n){case "normal":case "italic":return true;default:return false}}r($o,"isFontStyle");function hi(n){return N(n)?f(n.family)&&f(n.selector)&&Ko(n.weight)&&$o(n.style):false}r(hi,"isFont");var G=class n{static{r(this,"Font");}selector;family;weight;style;constructor(e){this.selector=e.selector,this.family=e.family,this.weight=e.weight,this.style=e.style;}static[l.unmarshal](e,t){let i=fi.get(t.selector);if(i)return i;let o=new n(t);return fi.set(t.selector,o),o}[l.marshal](){return {[g]:"Font",selector:this.selector,family:this.family,weight:this.weight,style:this.style}}},fi=new Map;var Mt="plugin-marshal";function In(n){return N(n)&&l.marshal in n}r(In,"isSelfMarshalable");function W(n){if(In(n))return n[l.marshal]();if(mt(n))return n.map(W);if(Se(n)){let e={};for(let t of Object.keys(n))e[t]=W(n[t]);return e}return n}r(W,"marshal");var jo="LinearGradient",Ho="RadialGradient",_o="ConicGradient",fe=class{static{r(this,"GradientBase");}#e;get stops(){return this.#e.stops}constructor(e){this.#e=e;}cloneWithAttributes(e){let t=this.constructor;return new t({...this.#e,...e})}},Ke=class n extends fe{static{r(this,"LinearGradient");}[g]=jo;#e;get angle(){return this.#e.angle}constructor(e){super(e),this.#e=e;}static[l.unmarshal](e,t){return new n({...t,stops:y(e,t.stops)})}[l.marshal](){return W({...this.#e,[g]:this[g]})}toCSS(){let e=this.#e.stops.map(t=>(c(f(t.color),"ColorStyle not supported yet"),`${t.color} ${t.position*100}%`)).join(", ");return `linear-gradient(${this.angle}deg, ${e})`}},$e=class n extends fe{static{r(this,"RadialGradient");}[g]=Ho;#e;get width(){return this.#e.width}get height(){return this.#e.height}get x(){return this.#e.x}get y(){return this.#e.y}constructor(e){super(e),this.#e=e;}static[l.unmarshal](e,t){return new n({...t,stops:y(e,t.stops)})}[l.marshal](){return W({...this.#e,[g]:this[g]})}toCSS(){let e=this.stops.map((t,i)=>{c(f(t.color),"ColorStyle not supported yet");let o=this.stops[i+1],a=t.position===1&&o?.position===1?t.position-1e-4:t.position;return `${t.color} ${a*100}%`}).join(", ");return `radial-gradient(${this.width} ${this.height} at ${this.x} ${this.y}, ${e})`}},je=class n extends fe{static{r(this,"ConicGradient");}[g]=_o;#e;get angle(){return this.#e.angle}get x(){return this.#e.x}get y(){return this.#e.y}constructor(e){super(e),this.#e=e;}static[l.unmarshal](e,t){return new n({...t,stops:y(e,t.stops)})}[l.marshal](){return W({...this.#e,[g]:this[g]})}toCSS(){let e=this.stops.map(t=>(c(f(t.color),"ColorStyle not supported yet"),`${t.color} ${t.position*360}deg`)).join(", ");return `conic-gradient(from ${this.angle}deg at ${this.x} ${this.y}, ${e})`}};function bi(n){return n instanceof fe}r(bi,"isGradient");var qo="ColorStyle";function At(n){return N(n)?n[g]===qo:false}r(At,"isColorStyleData");var ne=class n{static{r(this,"ColorStyle");}id;name;path;light;dark;#e;constructor(e,t){this.id=t.id,this.name=t.name,this.light=t.light,this.dark=t.dark,this.path=t.path,this.#e=e;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return {[g]:"ColorStyle",id:this.id,name:this.name,light:this.light,dark:this.dark,path:this.path}}async setAttributes(e){let t=await this.#e.invoke("setColorStyleAttributes",this.id,e);return t?new n(this.#e,t):null}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async setPluginData(e,t){return this.#e.invoke("setPluginDataForNode",this.id,e,t)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}async remove(){return this.#e.invoke("removeColorStyle",this.id)}};function ye(n){return n instanceof ne}r(ye,"isColorStyle");var Yo="TextStyle";function xi(n){return N(n)?n[g]===Yo:false}r(xi,"isTextStyleData");var He=class n{static{r(this,"TextStyle");}id;name;path;tag;font;boldFont;italicFont;boldItalicFont;color;transform;alignment;decoration;decorationColor;decorationThickness;decorationStyle;decorationSkipInk;decorationOffset;balance;breakpoints;minWidth;fontSize;letterSpacing;lineHeight;paragraphSpacing;#e;constructor(e,t){this.id=t.id,this.name=t.name,this.path=t.path,this.tag=t.tag,this.font=G[l.unmarshal](e,t.font),this.boldFont=t.boldFont&&G[l.unmarshal](e,t.boldFont),this.italicFont=t.italicFont&&G[l.unmarshal](e,t.italicFont),this.boldItalicFont=t.boldItalicFont&&G[l.unmarshal](e,t.boldItalicFont),this.color=At(t.color)?ne[l.unmarshal](e,t.color):t.color,this.transform=t.transform,this.alignment=t.alignment,this.decoration=t.decoration,this.decorationColor=At(t.decorationColor)?ne[l.unmarshal](e,t.decorationColor):t.decorationColor,this.decorationThickness=t.decorationThickness,this.decorationStyle=t.decorationStyle,this.decorationSkipInk=t.decorationSkipInk,this.decorationOffset=t.decorationOffset,this.balance=t.balance,this.breakpoints=t.breakpoints,this.minWidth=t.minWidth,this.fontSize=t.fontSize,this.letterSpacing=t.letterSpacing,this.lineHeight=t.lineHeight,this.paragraphSpacing=t.paragraphSpacing,this.#e=e;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return {[g]:"TextStyle",id:this.id,name:this.name,path:this.path,tag:this.tag,font:this.font[l.marshal](),boldFont:this.boldFont?.[l.marshal]()??null,italicFont:this.italicFont?.[l.marshal]()??null,boldItalicFont:this.boldItalicFont?.[l.marshal]()??null,color:ye(this.color)?this.color[l.marshal]():this.color,transform:this.transform,alignment:this.alignment,decoration:this.decoration,decorationColor:ye(this.decorationColor)?this.decorationColor[l.marshal]():this.decorationColor,decorationThickness:this.decorationThickness,decorationStyle:this.decorationStyle,decorationSkipInk:this.decorationSkipInk,decorationOffset:this.decorationOffset,balance:this.balance,breakpoints:this.breakpoints,minWidth:this.minWidth,fontSize:this.fontSize,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,paragraphSpacing:this.paragraphSpacing}}async setAttributes(e){let t=await this.#e.invoke("setTextStyleAttributes",this.id,e);return t?new n(this.#e,t):null}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async setPluginData(e,t){return this.#e.invoke("setPluginDataForNode",this.id,e,t)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}async remove(){return this.#e.invoke("removeTextStyle",this.id)}};function Tn(n){return n instanceof He}r(Tn,"isTextStyle");var Ci={ColorStyle:ne,ConicGradient:je,FileAsset:Oe,Font:G,ImageAsset:X,LinearGradient:Ke,RadialGradient:$e,TextStyle:He,BooleanVariable:De,BorderVariable:Le,ColorVariable:Me,DateVariable:We,EnumVariable:Ee,FileVariable:we,FormattedTextVariable:ke,ImageVariable:Ae,LinkVariable:Ve,NumberVariable:ve,StringVariable:Ne,UnsupportedVariable:Re,UnsupportedComputedValue:Ge};function Xo(n){return Se(n)&&f(n[g])&&n[g]in Ci}r(Xo,"isSelfUnmarshalable");function y(n,e){if(Xo(e))return Ci[e[g]][l.unmarshal](n,e);if(mt(e))return e.map(t=>y(n,t));if(Se(e)){let t={};for(let i of Object.keys(e))t[i]=y(n,e[i]);return t}return e}r(y,"unmarshal");var Zo={array:false,boolean:false,collectionReference:false,color:false,date:false,enum:false,file:false,formattedText:false,image:true,link:false,multiCollectionReference:false,number:false,string:false,unsupported:false};function Jo(n){return Zo[n]}r(Jo,"isSupportedArrayItemFieldType");function Qo(n){return Jo(n.type)}r(Qo,"isSupportedArrayItemFieldDataEntry");var nn="boolean",rn="color",on="number",an="string",sn="formattedText",ln="image",dn="array",un="link",cn="date",pn="file",mn="enum",gn="collectionReference",fn="multiCollectionReference",yn="divider",hn="unsupported";function ea(n){return n.map(e=>{if(e.type!=="enum")return e;let t=e.cases.map(i=>{let o=i.nameByLocale?pi(i.nameByLocale):void 0;return {...i,nameByLocale:o}});return {...e,cases:t}})}r(ea,"sanitizeEnumFieldForMessage");function Ii(n,e){let t={};for(let i in n){let o=n[i];if(!o)continue;if(o.type!=="array"){t[i]=y(e,o);continue}let a=o.value.map(s=>{let d=Ii(s.fieldData,e),u={};for(let I in d){let S=d[I];c(S&&Qo(S),"Unsupported array item field data entry"),u[I]=S;}return {...s,fieldData:u}});t[i]={...o,value:a};}return t}r(Ii,"deserializeFieldData");var he=class{static{r(this,"ManagedCollection");}id;name;readonly;managedBy;#e;constructor(e,t){this.id=e.id,this.name=e.name,this.readonly=e.readonly,c(e.managedBy!=="user","Managed Collection can only be managed by a plugin"),this.managedBy=e.managedBy,this.#e=t,P(this);}async getItemIds(){return this.#e.invoke("getManagedCollectionItemIds",this.id)}async setItemOrder(e){return this.#e.invoke("setManagedCollectionItemOrder",this.id,e)}async getFields(){return this.#e.invoke("getManagedCollectionFields2",this.id)}async setFields(e){let t=ea(e);return this.#e.invoke("setManagedCollectionFields",this.id,t)}async addItems(e){return this.#e.invoke("addManagedCollectionItems2",this.id,e)}async removeItems(e){return this.#e.invoke("removeManagedCollectionItems",this.id,e)}async setAsActive(){return this.#e.invoke("setActiveCollection",this.id)}async setPluginData(e,t){return this.#e.invoke("setPluginDataForNode",this.id,e,t)}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}async navigateTo(e){return this.#e.invoke("navigateTo",this.id,e)}},ie=class{static{r(this,"Collection");}id;name;slugFieldName;slugFieldBasedOn;readonly;managedBy;#e;constructor(e,t){this.id=e.id,this.name=e.name,this.slugFieldName=e.slugFieldName,this.slugFieldBasedOn=e.slugFieldBasedOn,this.readonly=e.readonly,this.managedBy=e.managedBy,this.#e=t,P(this);}async setItemOrder(e){return this.#e.invoke("setCollectionItemOrder",this.id,e)}async getFields(){let e=await this.#e.invoke("getCollectionFields2",this.id,true);return tn(e,this.#e,this.id)}async addFields(e){let t=await this.#e.invoke("addCollectionFields2",this.id,e);return c(t.every(li)),tn(t,this.#e,this.id)}async removeFields(e){return this.#e.invoke("removeCollectionFields",this.id,e)}async setFieldOrder(e){return this.#e.invoke("setCollectionFieldOrder",this.id,e)}async getItems(){return (await this.#e.invoke("getCollectionItems2",this.id)).map(t=>new _e(t,this.#e))}async addItems(e){await this.#e.invoke("addCollectionItems2",this.id,e);}async removeItems(e){return this.#e.invoke("removeCollectionItems",e)}async setAsActive(){return this.#e.invoke("setActiveCollection",this.id)}async setPluginData(e,t){return this.#e.invoke("setPluginDataForNode",this.id,e,t)}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}async navigateTo(e){return this.#e.invoke("navigateTo",this.id,e)}},_e=class n{static{r(this,"CollectionItem");}id;nodeId;slug;slugByLocale;draft;fieldData;#e;constructor(e,t){let i=Ii(e.fieldData,t);this.id=e.externalId??e.nodeId,this.nodeId=e.nodeId,this.slug=e.slug,this.slugByLocale=e.slugByLocale,this.draft=e.draft??false,this.fieldData=i,this.#e=t,P(this);}async remove(){return this.#e.invoke("removeCollectionItems",[this.id])}async setAttributes(e){let t=await this.#e.invoke("setCollectionItemAttributes2",this.id,e);return t?new n(t,this.#e):null}async setPluginData(e,t){return this.#e.invoke("setPluginDataForNode",this.id,e,t)}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}async navigateTo(e){return this.#e.invoke("navigateTo",this.nodeId,e)}};var ta={fixed:true,sticky:true,absolute:true,relative:true},Ti="position";function ul(n){if(!(Ti in n))return false;let e=n[Ti];return f(e)&&ta[e]===true}r(ul,"supportsPosition");var Pi="top";function cl(n){if(!(Pi in n))return false;let e=n[Pi];return f(e)||C(e)}r(cl,"supportsPins");var Si="width";function pl(n){if(!(Si in n))return false;let e=n[Si];return f(e)||C(e)}r(pl,"supportsSize");var Fi="maxWidth";function ml(n){if(!(Fi in n))return false;let e=n[Fi];return f(e)||C(e)}r(ml,"supportsSizeConstraints");var Di="aspectRatio";function gl(n){if(!(Di in n))return false;let e=n[Di];return q(e)||C(e)}r(gl,"supportsAspectRatio");var vi="name";function fl(n){if(!(vi in n))return false;let e=n[vi];return f(e)||C(e)}r(fl,"supportsName");var Ni="visible";function yl(n){if(!(Ni in n))return false;let e=n[Ni];return Pe(e)}r(yl,"supportsVisible");var ki="locked";function hl(n){if(!(ki in n))return false;let e=n[ki];return Pe(e)}r(hl,"supportsLocked");var Ei="backgroundColor";function bl(n){if(!(Ei in n))return false;let e=n[Ei];return f(e)||ye(e)||C(e)}r(bl,"supportsBackgroundColor");var Mi="backgroundColor";function xl(n){if(!(Mi in n))return false;let e=n[Mi];return f(e)||At(e)||C(e)}r(xl,"supportsBackgroundColorData");var Ai="backgroundImage";function Cl(n){if(!(Ai in n))return false;let e=n[Ai];return e instanceof X||C(e)}r(Cl,"supportsBackgroundImage");var wi="backgroundImage";function Il(n){if(!(wi in n))return false;let e=n[wi];return e instanceof X?false:mi(e)||C(e)}r(Il,"supportsBackgroundImageData");var Vi="backgroundGradient";function Tl(n){if(!(Vi in n))return false;let e=n[Vi];return bi(e)||C(e)}r(Tl,"supportsBackgroundGradient");var Wi="backgroundGradient";function Pl(n){if(!(Wi in n))return false;let e=n[Wi];return N(e)||C(e)}r(Pl,"supportsBackgroundGradientData");var Li="rotation";function Sl(n){if(!(Li in n))return false;let e=n[Li];return q(e)}r(Sl,"supportsRotation");var Ri="opacity";function Fl(n){if(!(Ri in n))return false;let e=n[Ri];return q(e)}r(Fl,"supportsOpacity");var Bi="borderRadius";function Dl(n){if(!(Bi in n))return false;let e=n[Bi];return f(e)||C(e)}r(Dl,"supportsBorderRadius");var Ui="border";function vl(n){if(!(Ui in n))return false;let e=n[Ui];return C(e)||ye(e.color)}r(vl,"supportsBorder");var Oi="svg";function Nl(n){if(!(Oi in n))return false;let e=n[Oi];return f(e)}r(Nl,"supportsSVG");var zi="textTruncation";function kl(n){if(!(zi in n))return false;let e=n[zi];return q(e)||C(e)}r(kl,"supportsTextTruncation");var Gi="zIndex";function El(n){if(!(Gi in n))return false;let e=n[Gi];return q(e)||C(e)}r(El,"supportsZIndex");var Ki="overflow";function Ml(n){if(!(Ki in n))return false;let e=n[Ki];return f(e)||C(e)}r(Ml,"supportsOverflow");var $i="componentIdentifier";function Al(n){if(!($i in n))return false;let e=n[$i];return f(e)}r(Al,"supportsComponentInfo");var ji="font";function wl(n){if(!(ji in n))return false;let e=n[ji];return hi(e)}r(wl,"supportsFont");var Hi="font";function Vl(n){if(!(Hi in n))return false;let e=n[Hi];return yi(e)||C(e)}r(Vl,"supportsFontData");var _i="inlineTextStyle";function Wl(n){if(!(_i in n))return false;let e=n[_i];return Tn(e)||C(e)}r(Wl,"supportsInlineTextStyle");var qi="inlineTextStyle";function Ll(n){if(!(qi in n))return false;let e=n[qi];return xi(e)||C(e)}r(Ll,"supportsInlineTextStyleData");var Yi="link";function Rl(n){if(!(Yi in n))return false;let e=n[Yi];return f(e)||C(e)}r(Rl,"supportsLink");var Xi="imageRendering";function Bl(n){if(!(Xi in n))return false;let e=n[Xi];return f(e)||C(e)}r(Bl,"supportsImageRendering");var Zi="layout";function er(n){if(!(Zi in n))return false;let e=n[Zi];return f(e)||C(e)}r(er,"supportsLayout");function Ul(n){return er(n)?n.layout==="stack":false}r(Ul,"hasStackLayout");function Ol(n){return er(n)?n.layout==="grid":false}r(Ol,"hasGridLayout");var Ji="isVariant";function tr(n){if(!(Ji in n))return false;let e=n[Ji];return Pe(e)}r(tr,"supportsComponentVariant");function Pn(n){return tr(n)?n.isVariant:false}r(Pn,"isComponentVariant");function nr(n){return !tr(n)||!Pn(n)?false:!C(n.gesture)}r(nr,"isComponentGestureVariant");var Qi="isBreakpoint";function na(n){if(!(Qi in n))return false;let e=n[Qi];return Pe(e)}r(na,"supportsBreakpoint");function ir(n){return na(n)?n.isBreakpoint:false}r(ir,"isBreakpoint");var L=class{static{r(this,"NodeMethods");}id;originalId;#e;constructor(e,t){this.id=e.id,this.originalId=e.originalId??null,this.#e=t;}get isReplica(){return this.originalId!==null}async remove(){return this.#e.invoke("removeNodes2",[this.id])}async select(){return this.#e.invoke("setSelection",[this.id])}async clone(){return this.#e.cloneNode(this.id)}async setAttributes(e){if(this[g]==="UnknownNode")throw Error("Can not set attributes on unknown node");return this.#e.setAttributes(this.id,e)}async getRect(){return this.#e.invoke("getRect",this.id)}async zoomIntoView(e){return this.#e.invoke("zoomIntoView",[this.id],e)}async navigateTo(e){return this.#e.invoke("navigateTo",this.id,e)}async getParent(){return this.#e.getParent(this.id)}async getChildren(){return re(this)?Promise.resolve([]):this.#e.getChildren(this.id)}async getNodesWithType(e){return re(this)?Promise.resolve([]):(await this.#e.invoke("getNodesWithType",this.id,e)).map(i=>x(i,this.#e))}async getNodesWithAttribute(e){return re(this)?Promise.resolve([]):(await this.#e.invoke("getNodesWithAttribute",this.id,e)).map(i=>x(i,this.#e))}async getNodesWithAttributeSet(e){return re(this)?Promise.resolve([]):(await this.#e.invoke("getNodesWithAttributeSet",this.id,e)).map(i=>x(i,this.#e))}async*walk(){if(yield this,!re(this))for(let e of await this.getChildren())yield*e.walk();}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async setPluginData(e,t){return this.#e.invoke("setPluginDataForNode",this.id,e,t)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}},U=class extends L{static{r(this,"FrameNode");}[g]="FrameNode";name;visible;locked;backgroundColor;backgroundImage;backgroundGradient;rotation;opacity;borderRadius;border;imageRendering;position;top;right;bottom;left;centerX;centerY;width;height;maxWidth;minWidth;maxHeight;minHeight;aspectRatio;zIndex;link;linkOpenInNewTab;linkSmoothScroll;linkClickTrackingId;linkRelValues;linkPreserveParams;overflow;overflowX;overflowY;layout;gap;padding;stackDirection;stackDistribution;stackAlignment;stackWrapEnabled;gridColumnCount;gridRowCount;gridAlignment;gridColumnWidthType;gridColumnWidth;gridColumnMinWidth;gridRowHeightType;gridRowHeight;gridItemFillCellWidth;gridItemFillCellHeight;gridItemHorizontalAlignment;gridItemVerticalAlignment;gridItemColumnSpan;gridItemRowSpan;isVariant;isPrimaryVariant;isBreakpoint;isPrimaryBreakpoint;inheritsFromId;gesture;constructor(e,t){super(e,t),this.name=e.name??null,this.visible=e.visible??true,this.locked=e.locked??false,this.backgroundColor=y(t,e.backgroundColor)??null,this.backgroundImage=y(t,e.backgroundImage)??null,this.rotation=e.rotation??0,this.opacity=e.opacity??1,this.borderRadius=e.borderRadius??null,this.border=y(t,e.border)??null,this.backgroundGradient=y(t,e.backgroundGradient)??null,this.imageRendering=e.imageRendering??null,this.position=e.position,this.left=e.left??null,this.right=e.right??null,this.top=e.top??null,this.bottom=e.bottom??null,this.centerX=e.centerX??null,this.centerY=e.centerY??null,this.width=e.width??null,this.height=e.height??null,this.maxWidth=e.maxWidth??null,this.minWidth=e.minWidth??null,this.maxHeight=e.maxHeight??null,this.minHeight=e.minHeight??null,this.aspectRatio=e.aspectRatio??null,this.zIndex=e.zIndex??null,this.link=e.link??null,this.linkOpenInNewTab=e.linkOpenInNewTab??null,this.linkSmoothScroll=e.linkSmoothScroll??null,this.linkClickTrackingId=e.linkClickTrackingId??null,this.linkRelValues=e.linkRelValues??null,this.linkPreserveParams=e.linkPreserveParams??null,this.overflow=e.overflow??null,this.overflowX=e.overflowX??null,this.overflowY=e.overflowY??null,this.layout=e.layout??null,this.gap=e.gap??null,this.padding=e.padding??null,this.stackDirection=e.stackDirection??null,this.stackDistribution=e.stackDistribution??null,this.stackAlignment=e.stackAlignment??null,this.stackWrapEnabled=e.stackWrapEnabled??null,this.gridColumnCount=e.gridColumnCount??null,this.gridRowCount=e.gridRowCount??null,this.gridAlignment=e.gridAlignment??null,this.gridColumnWidthType=e.gridColumnWidthType??null,this.gridColumnWidth=e.gridColumnWidth??null,this.gridColumnMinWidth=e.gridColumnMinWidth??null,this.gridRowHeightType=e.gridRowHeightType??null,this.gridRowHeight=e.gridRowHeight??null,this.gridItemFillCellWidth=e.gridItemFillCellWidth??null,this.gridItemFillCellHeight=e.gridItemFillCellHeight??null,this.gridItemHorizontalAlignment=e.gridItemHorizontalAlignment??null,this.gridItemVerticalAlignment=e.gridItemVerticalAlignment??null,this.gridItemColumnSpan=e.gridItemColumnSpan??null,this.gridItemRowSpan=e.gridItemRowSpan??null,this.inheritsFromId=e.inheritsFromId??null,this.gesture=e.gesture??null,this.isVariant=e.isVariant??false,this.isPrimaryVariant=e.isPrimaryVariant??false,this.isBreakpoint=e.isBreakpoint??false,this.isPrimaryBreakpoint=e.isPrimaryBreakpoint??false,P(this);}},oe=class extends L{static{r(this,"TextNode");}[g]="TextNode";name;visible;locked;rotation;opacity;zIndex;font;inlineTextStyle;position;top;right;bottom;left;centerX;centerY;width;height;maxWidth;minWidth;maxHeight;minHeight;link;linkOpenInNewTab;linkSmoothScroll;linkClickTrackingId;linkRelValues;linkPreserveParams;gridItemFillCellWidth;gridItemFillCellHeight;gridItemHorizontalAlignment;gridItemVerticalAlignment;gridItemColumnSpan;gridItemRowSpan;overflow;overflowX;overflowY;textTruncation;#e;constructor(e,t){super(e,t),this.#e=t,this.name=e.name??null,this.visible=e.visible??true,this.locked=e.locked??false,this.rotation=e.rotation??0,this.opacity=e.opacity??1,this.zIndex=e.zIndex??null,this.font=y(t,e.font)??null,this.inlineTextStyle=y(t,e.inlineTextStyle)??null,this.position=e.position,this.left=e.left??null,this.right=e.right??null,this.top=e.top??null,this.bottom=e.bottom??null,this.centerX=e.centerX??null,this.centerY=e.centerY??null,this.width=e.width??null,this.height=e.height??null,this.maxWidth=e.maxWidth??null,this.minWidth=e.minWidth??null,this.maxHeight=e.maxHeight??null,this.minHeight=e.minHeight??null,this.link=e.link??null,this.linkOpenInNewTab=e.linkOpenInNewTab??null,this.linkSmoothScroll=e.linkSmoothScroll??null,this.linkClickTrackingId=e.linkClickTrackingId??null,this.linkRelValues=e.linkRelValues??null,this.linkPreserveParams=e.linkPreserveParams??null,this.overflow=e.overflow??null,this.overflowX=e.overflowX??null,this.overflowY=e.overflowY??null,this.textTruncation=e.textTruncation??null,this.gridItemFillCellWidth=e.gridItemFillCellWidth??null,this.gridItemFillCellHeight=e.gridItemFillCellHeight??null,this.gridItemHorizontalAlignment=e.gridItemHorizontalAlignment??null,this.gridItemVerticalAlignment=e.gridItemVerticalAlignment??null,this.gridItemColumnSpan=e.gridItemColumnSpan??null,this.gridItemRowSpan=e.gridItemRowSpan??null,P(this);}async setText(e){await this.#e.invoke("setTextForNode",this.id,e);}async getText(){return this.#e.invoke("getTextForNode",this.id)}async setHTML(e){await this.#e.invoke(ge,this.id,e),await new Promise(t=>{setTimeout(t,30);});}async getHTML(){return this.#e.invoke(me,this.id)}},qe=class extends L{static{r(this,"SVGNode");}[g]="SVGNode";name;visible;locked;svg;rotation;opacity;position;top;right;bottom;left;centerX;centerY;width;height;constructor(e,t){super(e,t),this.name=e.name??null,this.visible=e.visible??true,this.locked=e.locked??false,this.svg=e.svg,this.rotation=e.rotation??0,this.opacity=e.opacity??1,this.position=e.position,this.left=e.left??null,this.right=e.right??null,this.top=e.top??null,this.bottom=e.bottom??null,this.centerX=e.centerX??null,this.centerY=e.centerY??null,this.width=e.width??null,this.height=e.height??null,P(this);}},Ye=class extends L{static{r(this,"VectorSetItemNode");}[g]="VectorSetItemNode";name;visible;locked;top;right;bottom;left;centerX;centerY;width;height;#e;constructor(e,t){super(e,t),this.#e=t,this.name=e.name??null,this.visible=e.visible??true,this.locked=e.locked??false,this.top=e.top??null,this.right=e.right??null,this.bottom=e.bottom??null,this.left=e.left??null,this.centerX=e.centerX??null,this.centerY=e.centerY??null,this.width=e.width??null,this.height=e.height??null,P(this);}async getSVG(){return this.#e.invoke("getSVGForNode",this.id)}},Xe=class extends L{static{r(this,"ComponentInstanceNode");}[g]="ComponentInstanceNode";name;visible;locked;componentIdentifier;insertURL;componentName;controls;rotation;opacity;position;top;right;bottom;left;centerX;centerY;width;height;maxWidth;minWidth;maxHeight;minHeight;aspectRatio;#e;#t;#n;get typedControls(){return this.#n||(this.#n=y(this.#e,this.#t.typedControls)??{}),this.#n}constructor(e,t){super(e,t),this.#e=t,this.#t=e,this.name=e.name??null,this.visible=e.visible??true,this.locked=e.locked??false,this.componentIdentifier=e.componentIdentifier,this.componentName=e.componentName??null,this.insertURL=e.insertURL??null,this.controls=y(t,e.controls)??{},this.rotation=e.rotation??0,this.opacity=e.opacity??1,this.position=e.position,this.left=e.left??null,this.right=e.right??null,this.top=e.top??null,this.bottom=e.bottom??null,this.centerX=e.centerX??null,this.centerY=e.centerY??null,this.width=e.width??null,this.height=e.height??null,this.maxWidth=e.maxWidth??null,this.minWidth=e.minWidth??null,this.maxHeight=e.maxHeight??null,this.minHeight=e.minHeight??null,this.aspectRatio=e.aspectRatio??null,P(this);}async getRuntimeError(){return this.#e.invoke("getRuntimeErrorForCodeComponentNode",this.id)}},K=class extends L{static{r(this,"WebPageNode");}[g]="WebPageNode";#e;path;collectionId;constructor(e,t){super(e,t),this.path=e.path??null,this.collectionId=e.collectionId??null,this.#e=t,P(this);}async clone(e){return this.#e.cloneWebPage(this.id,e)}getBreakpointSuggestions(){return this.#e.invoke("getBreakpointSuggestionsForWebPage",this.id)}async addBreakpoint(e,t){let i=await this.#e.invoke("addBreakpointToWebPage",this.id,e,t),o=x(i,this.#e);return c(o instanceof U),c(ir(o),"Expected node to be a FrameNode"),o}async getActiveCollectionItem(){let e=await this.#e.invoke("getActiveCollectionItemForWebPage",this.id);return e?new _e(e,this.#e):null}},ae=class extends L{static{r(this,"ComponentNode");}[g]="ComponentNode";name;componentIdentifier;insertURL;componentName;#e;constructor(e,t){super(e,t),this.#e=t,this.componentIdentifier=e.componentIdentifier,this.insertURL=e.insertURL??null,this.componentName=e.componentName??null,this.name=e.name??null,P(this);}async addVariant(e,t){let i=await this.#e.invoke("addVariantToComponent",this.id,e,t);if(!i)throw new Error("Failed to add variant to component");let o=x(i,this.#e);return c(o instanceof U),c(Pn(o),"Node is not a component variant"),o}async addGestureVariant(e,t,i){let o=await this.#e.invoke("addGestureVariantToComponent",this.id,e,t,i);if(!o)throw new Error("Failed to add state to component");let a=x(o,this.#e);return c(a instanceof U),c(nr(a),"Node is not a gesture variant"),a}async getVariables(){let e=await this.#e.invoke("getVariables",this.id);return y(this.#e,e)}async addVariables(e){let t=await this.#e.invoke("addVariables",this.id,W(e));return y(this.#e,t)}async removeVariables(e){await this.#e.invoke("removeVariables",this.id,e);}async setVariableOrder(e){await this.#e.invoke("setVariableOrder",this.id,e);}},Ze=class extends L{static{r(this,"VectorSetNode");}[g]="VectorSetNode";name;constructor(e,t){super(e,t),this.name=e.name??null,P(this);}},$=class extends L{static{r(this,"DesignPageNode");}[g]="DesignPageNode";name;#e;constructor(e,t){super(e,t),this.#e=t,this.name=e.name??null,P(this);}async clone(e){return this.#e.cloneDesignPage(this.id,e)}},Je=class extends L{static{r(this,"UnknownNode");}[g]="UnknownNode";constructor(e,t){super(e,t),P(this);}async clone(){throw new Error("Cannot clone an unknown node")}};function x(n,e){switch(n[g]){case "DesignPageNode":return new $(n,e);case "WebPageNode":return new K(n,e);case "ComponentNode":return new ae(n,e);case "VectorSetNode":return new Ze(n,e);case "VectorSetItemNode":return new Ye(n,e);case "ComponentInstanceNode":return new Xe(n,e);case "FrameNode":return new U(n,e);case "SVGNode":return new qe(n,e);case "TextNode":return new oe(n,e);case "UnknownNode":return new Je(n,e);default:return new Je(n,e)}}r(x,"convertRawNodeDataToNode");function wt(n){return n instanceof U}r(wt,"isFrameNode");function rr(n){return n instanceof oe}r(rr,"isTextNode");function or(n){return n instanceof qe}r(or,"isSVGNode");function be(n){return n instanceof Xe}r(be,"isComponentInstanceNode");function ar(n){return n instanceof K}r(ar,"isWebPageNode");function sr(n){return n instanceof ae}r(sr,"isComponentNode");function lr(n){return n instanceof $}r(lr,"isDesignPageNode");function dr(n){return n instanceof Ze}r(dr,"isVectorSetNode");function ur(n){return n instanceof Ye}r(ur,"isVectorSetItemNode");function re(n){return n instanceof Je}r(re,"isUnknownNode");function Qe(n){return !!(wt(n)||rr(n)||be(n)||or(n)||ur(n)||re(n))}r(Qe,"isCanvasNode");function Sn(n){return !!(ar(n)||lr(n)||sr(n)||dr(n)||re(n))}r(Sn,"isCanvasRootNode");var et=class{static{r(this,"VectorSet");}id;name;owner;#e;constructor(e,t){this.id=e.id,this.name=e.name,this.owner=e.owner,this.#e=t;}async getItems(){return (await this.#e.invoke("getVectorSetItems",this.id)).map(t=>new Vt(t,this.#e))}},Vt=class{static{r(this,"VectorSetItem");}id;name;insertUrl;iconUrl;#e;#t;constructor(e,t){this.id=e.id,this.name=e.name,this.insertUrl=e.insertUrl,this.iconUrl=e.iconUrl,this.#e=e.moduleId,this.#t=t;}async getVariables(){return this.#t.invoke("getVectorSetItemVariables",this.id,this.#e)}};var tt=class extends Error{static{r(this,"FramerPluginError");}name=this.constructor.name},J=class extends Error{static{r(this,"FramerPluginClosedError");}name=this.constructor.name};function ia(n){return n.type==="separator"}r(ia,"isSeparatorMenuItem");function Wt(n,e){let t=[];for(let i of n){if(ia(i)){t.push(i);continue}let{onAction:o,...a}=i,s=a;if(i.onAction){let d=Math.random();e.set(d,i.onAction),s.actionId=d;}i.submenu&&(s.submenu=Wt(i.submenu,e)),t.push(s);}return t}r(Wt,"addMenuItemsToOnActionCallbackMap");var Lt="type",cr={[Lt]:"pluginReadySignal"},oa="pluginReadyResponse";var aa={methodResponse:true,subscriptionMessage:true,permissionUpdate:true,menuAction:true};function pr(n){return N(n)&&f(n[Lt])&&n[Lt]in aa}r(pr,"isVekterToPluginNonHandshakeMessage");function mr(n){return N(n)&&n[Lt]===oa}r(mr,"isPluginReadyResponse");var Fn=Symbol(),Dn=Symbol(),vn=Symbol(),Nn=Symbol(),kn=Symbol(),En=Symbol(),Mn=Symbol(),An=Symbol(),wn=Symbol(),Vn=Symbol(),Wn=Symbol(),Ln=Symbol(),Rn=Symbol(),Bn=Symbol(),v={publish:Fn,getDeployments:Dn,deploy:vn,getChangedPaths:Nn,getChangeContributors:kn,createManagedCollection:En,rejectAllPending:Mn,readProjectForAgent:An,getAgentSystemPrompt:wn,getAgentContext:Vn,applyAgentChanges:Wn,startAgentConversation:Ln,continueAgentConversation:Rn,submitAgentClarification:Bn};function Un(n){return typeof n=="string"&&n in v}r(Un,"isFramerApiOnlyMethod");var sa=["unstable_getCodeFile","unstable_getCodeFiles","unstable_getCodeFileVersionContent","unstable_getCodeFileLint2","unstable_getCodeFileTypecheck2","unstable_getCodeFileVersions","lintCode"],la=["closeNotification","closePlugin","setCloseWarning","getActiveCollection","getActiveLocale","getActiveManagedCollection","getCanvasRoot","getChildren","getCollection","getCollectionFields","getCollectionFields2","getCollectionItems","getCollectionItems2","getCollections","getColorStyle","getColorStyles","getCurrentUser","getCurrentUser2","getCustomCode","getDefaultLocale","getFont","getFonts","getImage","getImageData","getLocales","getLocaleLanguages","getLocaleRegions","getLocalizationGroups","getManagedCollection","getManagedCollectionFields","getManagedCollectionFields2","getManagedCollectionItemIds","getManagedCollections","getNode","getNodesWithAttribute","getNodesWithAttributeSet","getNodesWithType","getParent","getPluginData","getPluginDataForNode","getPluginDataKeys","getPluginDataKeysForNode","getProjectInfo","getProjectInfo2","getPublishInfo","getRect","getSelection","getSVGForNode","getText","getTextForNode","getTextStyle","getTextStyles","hideUI","setBackgroundMessage","notify","onPointerDown","setActiveCollection","setSelection","showUI","getCodeFileVersionContent","typecheckCode","getCodeFileVersions","getCodeFiles","getCodeFile","getRedirects","uploadFile","uploadFiles","uploadImage","uploadImages","zoomIntoView","navigateTo","getRuntimeErrorForModule","getRuntimeErrorForCodeComponentNode","showProgressOnInstances","removeProgressFromInstances","addComponentInstancePlaceholder","updateComponentInstancePlaceholder","removeComponentInstancePlaceholder","setMenu","showContextMenu","getBreakpointSuggestionsForWebPage","getActiveCollectionItemForWebPage","getVariables","getVectorSets","getVectorSetItems","getVectorSetItemVariables","getChangedPaths","getChangeContributors","getDeployments","readProjectForAgent","getAgentSystemPrompt","getAgentContext",gt,ft,yt,ht,me,"getAiServiceInfo","sendTrackingEvent",...sa];new Set(la);var On={addComponentInstance:["addComponentInstance"],addComponentInstancePlaceholder:[],addDetachedComponentLayers:["addDetachedComponentLayers"],addImage:["addImage"],addImages:["addImages"],addSVG:["addSVG"],addText:["addText"],addRedirects:["addRedirects"],getRedirects:[],removeRedirects:["removeRedirects"],setRedirectOrder:["setRedirectOrder"],subscribeToRedirects:[],cloneNode:["cloneNode"],closePlugin:[],createColorStyle:["createColorStyle"],createFrameNode:["createNode"],createTextNode:["createNode"],createComponentNode:["createNode"],createTextStyle:["createTextStyle"],createDesignPage:["createDesignPage"],createWebPage:["createWebPage"],getActiveCollection:[],getActiveLocale:[],getActiveManagedCollection:[],getCanvasRoot:[],getChildren:[],getCollection:[],getCollections:[],getColorStyle:[],getColorStyles:[],getCurrentUser:[],getCustomCode:[],getDefaultLocale:[],getFont:[],getFonts:[],getImage:[],getLocales:[],getLocalizationGroups:[],getManagedCollection:[],getManagedCollections:[],getNode:[],getNodesWithAttribute:[],getNodesWithAttributeSet:[],getNodesWithType:[],getParent:[],getPluginData:[],getPluginDataKeys:[],getProjectInfo:[],getPublishInfo:[],getRect:[],getSelection:[],getText:[],getTextStyle:[],getTextStyles:[],hideUI:[],setBackgroundMessage:[],setCloseWarning:[],lintCode:[],makeDraggable:["onDragEnd","onDragStart","onDrag","setDragData","preloadDetachedComponentLayers","preloadImageUrlForInsertion","preloadDragPreviewImage"],notify:[],preloadDetachedComponentLayers:["preloadDetachedComponentLayers"],preloadDragPreviewImage:["preloadDragPreviewImage"],preloadImageUrlForInsertion:["preloadImageUrlForInsertion"],removeNode:["removeNodes2"],removeNodes:["removeNodes2"],setAttributes:["setAttributes"],setCustomCode:["setCustomCode"],setImage:["setImage"],setLocalizationData:["setLocalizationData"],createLocale:["createLocale"],getLocaleLanguages:[],getLocaleRegions:[],setMenu:[],showContextMenu:[],setParent:["setParent"],setPluginData:["setPluginData"],setSelection:[],setText:["setText"],typecheckCode:[],showUI:[],subscribeToCanvasRoot:[],subscribeToColorStyles:[],subscribeToCustomCode:[],subscribeToImage:[],subscribeToPublishInfo:[],subscribeToSelection:[],subscribeToText:[],subscribeToTextStyles:[],createCodeFile:["createCodeFile"],unstable_ensureMinimumDependencyVersion:["unstable_ensureMinimumDependencyVersion"],getCodeFiles:[],getCodeFile:[],subscribeToCodeFiles:[],subscribeToOpenCodeFile:[],uploadFile:[],uploadFiles:[],uploadImage:[],uploadImages:[],zoomIntoView:[],navigateTo:[],getVectorSets:[],"VectorSet.getItems":[],"VectorSetItem.getVariables":[],"Node.navigateTo":[],"CodeFile.navigateTo":[],"Collection.navigateTo":[],"ManagedCollection.navigateTo":[],"CollectionItem.navigateTo":[],"ComponentInstanceNode.getRuntimeError":[],"ImageAsset.cloneWithAttributes":[],"ImageAsset.getData":[],"ImageAsset.loadBitmap":[],"ImageAsset.loadImage":[],"ImageAsset.measure":[],"CodeFile.remove":["removeCodeFile"],"CodeFile.rename":["renameCodeFile"],"CodeFile.setFileContent":["setCodeFileContent"],"CodeFile.getVersions":[],"CodeFile.showProgressOnInstances":[],"CodeFile.removeProgressFromInstances":[],"CodeFile.lint":[],"CodeFile.typecheck":[],"CodeFileVersion.getContent":[],"ComponentInstancePlaceholder.setAttributes":[],"ComponentInstancePlaceholder.remove":[],"ComponentInstancePlaceholder.replaceWithComponentInstance":["replaceComponentInstancePlaceholderWithComponentInstance"],"Field.remove":["removeCollectionFields"],"Field.setAttributes":["addCollectionFields2"],"EnumField.addCase":["addEnumCase"],"EnumField.setCaseOrder":["setEnumCaseOrder"],"Collection.addFields":["addCollectionFields2"],"Collection.addItems":["addCollectionItems2"],"Collection.getFields":[],"Collection.getItems":[],"Collection.getPluginData":[],"Collection.getPluginDataKeys":[],"Collection.removeFields":["removeCollectionFields"],"Collection.removeItems":["removeCollectionItems"],"Collection.setAsActive":[],"Collection.setFieldOrder":["setCollectionFieldOrder"],"Collection.setItemOrder":["setCollectionItemOrder"],"Collection.setPluginData":["setPluginDataForNode"],"CollectionItem.getPluginData":[],"CollectionItem.getPluginDataKeys":[],"CollectionItem.remove":["removeCollectionItems"],"CollectionItem.setAttributes":["setCollectionItemAttributes2"],"CollectionItem.setPluginData":["setPluginDataForNode"],"ManagedCollection.addItems":["addManagedCollectionItems2"],"ManagedCollection.getFields":[],"ManagedCollection.getItemIds":[],"ManagedCollection.getPluginData":[],"ManagedCollection.getPluginDataKeys":[],"ManagedCollection.removeItems":["removeManagedCollectionItems"],"ManagedCollection.setAsActive":[],"ManagedCollection.setFields":["setManagedCollectionFields"],"ManagedCollection.setItemOrder":["setManagedCollectionItemOrder"],"ManagedCollection.setPluginData":["setPluginDataForNode"],"Node.clone":["cloneNode","cloneWebPage","cloneDesignPage"],"WebPageNode.clone":["cloneWebPage"],"DesignPageNode.clone":["cloneDesignPage"],"Node.getChildren":[],"Node.getNodesWithAttribute":[],"Node.getNodesWithAttributeSet":[],"Node.getNodesWithType":[],"Node.getParent":[],"Node.getPluginData":[],"Node.getPluginDataKeys":[],"Node.getRect":[],"Node.remove":["removeNodes2"],"Node.select":[],"Node.setAttributes":["setAttributes"],"Node.setPluginData":["setPluginDataForNode"],"Node.walk":[],"Node.zoomIntoView":[],"TextNode.getText":[],"TextNode.setText":["setTextForNode"],"TextNode.setHTML":[ge],"TextNode.getHTML":[],"ComponentNode.addVariant":["addVariantToComponent"],"ComponentNode.addGestureVariant":["addGestureVariantToComponent"],"ComponentNode.getVariables":[],"ComponentNode.addVariables":["addVariables"],"ComponentNode.removeVariables":["removeVariables"],"WebPageNode.getBreakpointSuggestions":[],"WebPageNode.addBreakpoint":["addBreakpointToWebPage"],"WebPageNode.getActiveCollectionItem":[],"ColorStyle.getPluginData":[],"ColorStyle.getPluginDataKeys":[],"ColorStyle.remove":["removeColorStyle"],"ColorStyle.setAttributes":["setColorStyleAttributes"],"ColorStyle.setPluginData":["setPluginDataForNode"],"TextStyle.getPluginData":[],"TextStyle.getPluginDataKeys":[],"TextStyle.remove":["removeTextStyle"],"TextStyle.setAttributes":["setTextStyleAttributes"],"TextStyle.setPluginData":["setPluginDataForNode"],"Variable.setAttributes":["updateVariable"],"Variable.remove":["removeVariables"],"ComponentNode.setVariableOrder":["setVariableOrder"],"EnumCase.remove":["removeEnumCase"],"EnumCase.setAttributes":["updateEnumCase"],"EnumVariable.addCase":["addEnumCase"],"EnumVariable.setCaseOrder":["setEnumCaseOrder"],createCollection:["createCollection"],createManagedCollection:["createManagedCollection"],[qt]:[],[Yt]:[],[Xt]:[],[Zt]:[],[Jt]:[],[Qt]:[],[Fn]:["publish"],[Dn]:[],[vn]:["deploy"],[Nn]:[],[kn]:[],[En]:["createManagedCollection"],[Mn]:[],[An]:[],[wn]:[],[Vn]:[],[Wn]:["applyAgentChanges"],[Ln]:["startAgentConversation"],[Rn]:["continueAgentConversation"],[Bn]:["submitAgentClarification"]},Rt=[];for(let n of Object.keys(On))On[n].length!==0&&Rt.push(n);P(Rt);function zn(n){let e={};for(let t of Rt){let i=On[t];e[t]=i.every(o=>n[o]);}return e}r(zn,"createPerMethodPermissionMap");function gr(){let n={};for(let e of Rt)n[e]=true;return n}r(gr,"createPerMethodPermissionMapForTesting");var xe=null;function fr(n){if(typeof window>"u")return;if(!xe){let t=document.createElement("style");document.head.appendChild(t),xe=t.sheet;}if(!xe){n();return}let e=xe.insertRule("* { transition: none !important; animation: none !important; }");n(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{xe&&xe.deleteRule(e);});});}r(fr,"withDisabledCssTransitions");var nt=class{static{r(this,"PluginEngine");}methodInvocationId=0;notificationId=0;postMessage;methodResponseHandlers=new Map;mode;subscriptions=new Map;perMethodPermissionMap;permissionSubscriptions=new Set;messageTypesCheckedInIsAllowedTo=new Set;showUncheckedPermissionToasts=true;environmentInfo=null;initialState;menuItemOnActionCallbackMap=new Map;contextMenuItemOnActionCallbackMap=new Map;rejectAllPending(e){for(let[t,i]of this.methodResponseHandlers)i.reject(e),this.methodResponseHandlers.delete(t);}constructor(e){if(!e){this.postMessage=()=>{},this.mode="canvas",this.perMethodPermissionMap=gr(),this.initialState={mode:"canvas",intent:"plugin/open"};return}switch(e.transport.onMessage(this.onMessage),typeof window<"u"&&(window.addEventListener("error",t=>{t.error instanceof J&&(t.preventDefault(),t.stopImmediatePropagation());}),window.addEventListener("unhandledrejection",t=>{t.reason instanceof J&&(t.preventDefault(),t.stopImmediatePropagation());})),this.mode=e.mode,this.initialState=e.initialState??{mode:e.mode,intent:"plugin/open"},this.environmentInfo=e.environmentInfo,this.perMethodPermissionMap=zn(e.permissionMap),this.postMessage=(t,i)=>e.transport.send(t,i),this.mode){case "canvas":case "image":case "editImage":case "configureManagedCollection":case "syncManagedCollection":case "collection":case "localization":case "code":typeof window<"u"&&window.addEventListener("pointerdown",()=>{this.invoke("onPointerDown");}),e.theme&&this.applyPluginTheme(e.theme),this.subscribe("theme",this.applyPluginTheme);break;case "api":break;default:Fe(this.mode);}}async invoke(e,...t){return this.invokeTransferable(e,void 0,...t)}async invokeTransferable(e,t,...i){return new Promise((a,s)=>{let d={type:"methodInvocation",methodName:e,id:this.methodInvocationId,args:i.map(W)};this.methodInvocationId+=1,this.methodResponseHandlers.set(d.id,{resolve:a,reject:s}),this.postMessage(d,t);})}subscribe(e,t){this.postMessage({type:"subscribe",topic:e});let i=this.subscriptions.get(e)??new Set;return i.add(t),this.subscriptions.set(e,i),()=>{let o=this.subscriptions.get(e)??new Set;o.delete(t),o.size===0&&this.postMessage({type:"unsubscribe",topic:e}),this.subscriptions.set(e,o);}}onMessage=r(e=>{let t=e?.data??e;if(pr(t))switch(t.type){case "permissionUpdate":{this.perMethodPermissionMap=zn(t.permissionMap);for(let i of this.permissionSubscriptions)i();break}case "methodResponse":{let i=this.methodResponseHandlers.get(t.id);if(!i){switch(this.mode){case "canvas":case "image":case "editImage":case "configureManagedCollection":case "syncManagedCollection":case "collection":case "localization":case "code":throw new Error(`No handler for response with id ${t.id}`);case "api":{if(!(t.id<this.methodInvocationId))throw new Error(`No handler for unknown response id ${t.id}`);break}default:Fe(this.mode);}break}this.methodResponseHandlers.delete(t.id),f(t.error)?i.reject(new tt(t.error)):i.resolve(t.result);break}case "subscriptionMessage":{let{topic:i,payload:o}=t,a=this.subscriptions.get(i);if(!a)throw new Error("Received a subscription message but no handler present");for(let s of a)s(o);break}case "menuAction":{let i=this.getOnActionFromCallbackMap(t.actionId,t.actionType);if(!i)throw new Error("Menu action received for an unknown menu item");i();break}default:Fe(t);}},"onMessage");getOnActionFromCallbackMap(e,t){switch(t){case "pluginMenu":return this.menuItemOnActionCallbackMap.get(e);case "contextMenu":return this.contextMenuItemOnActionCallbackMap.get(e);default:Fe(t);}}applyPluginTheme=r(e=>{fr(()=>{document.body.setAttribute("data-framer-theme",e.mode);for(let t in e.tokens)document.body.style.setProperty(t,e.tokens[t]);});},"applyPluginTheme");async cloneNode(e){let t=await this.invoke("cloneNode",e);return t?x(t,this):null}async cloneWebPage(e,t){let i=await this.invoke("cloneWebPage",e,t);c(i,"Expected to receive data for cloned web page");let o=x(i,this);return c(o instanceof K,"Expected cloned node to be an instance of WebPageNode"),o}async cloneDesignPage(e,t){let i=await this.invoke("cloneDesignPage",e,t);c(i,"Expected to receive data for cloned design page");let o=x(i,this);return c(o instanceof $,"Expected cloned node to be an instance of DesignPageNode"),o}async setAttributes(e,t){let i=await this.invoke("setAttributes",e,t);return i?x(i,this):null}async getParent(e){let t=await this.invoke("getParent",e);return t?x(t,this):null}async getChildren(e){return (await this.invoke("getChildren",e)).map(i=>{let o=x(i,this);return c(Qe(o)),o})}notify=r((e,t)=>{let i=`notification-${this.notificationId}`;return this.notificationId+=1,this.invoke("notify",e,{notificationId:i,variant:t?.variant??"info",buttonText:t?.button?.text,durationMs:t?.durationMs}).then(o=>{o==="actionButtonClicked"&&t?.button?.onClick&&t.button.onClick(),t?.onDisappear&&t.onDisappear();}),{close:r(()=>this.invoke("closeNotification",i),"close")}},"notify");async setMenu(e){this.menuItemOnActionCallbackMap=new Map;let t=Wt(e,this.menuItemOnActionCallbackMap);await this.invoke("setMenu",t);}async showContextMenu(e,t){this.contextMenuItemOnActionCallbackMap=new Map;let i=Wt(e,this.contextMenuItemOnActionCallbackMap);await this.invoke("showContextMenu",i,t);}};function da(n){return n.type==="component"}r(da,"isCodeFileComponentExport");function ua(n){return n.type==="override"}r(ua,"isCodeFileOverrideExport");var Gn=class{static{r(this,"CodeFileVersion");}#e;#t;get id(){return this.#e.id}get name(){return this.#e.name}get createdAt(){return this.#e.createdAt}get createdBy(){return this.#e.createdBy}constructor(e,t){this.#t=t,this.#e=e;}async getContent(){return await this.#t.invoke("getCodeFileVersionContent",this.#e.fileId,this.#e.id)}},Q=class n{static{r(this,"CodeFile");}#e;#t;get id(){return this.#e.id}get name(){return this.#e.name}get path(){return this.#e.path}get content(){return this.#e.content}get exports(){return this.#e.exports}get versionId(){return this.#e.versionId}constructor(e,t){this.#t=t,this.#e=e;}async setFileContent(e){let t=await this.#t.invoke("setCodeFileContent",this.id,e);return new n(t,this.#t)}async rename(e){let t=await this.#t.invoke("renameCodeFile",this.id,e);return new n(t,this.#t)}async remove(){return this.#t.invoke("removeCodeFile",this.id)}async getVersions(){return (await this.#t.invoke("getCodeFileVersions",this.id)).map(t=>new Gn(t,this.#t))}async showProgressOnInstances(e){return this.#t.invoke("showProgressOnInstances",this.id,e)}async removeProgressFromInstances(){return this.#t.invoke("removeProgressFromInstances",this.id)}async lint(e){return Promise.resolve([])}async typecheck(e){return await this.#t.invoke("typecheckCode",this.name,this.content,e,this.id)}async navigateTo(){return this.#t.invoke("navigateTo",this.id)}};var Bt=class n{static{r(this,"ComponentInstancePlaceholder");}#e;#t;constructor(e,t){this.#e=e,this.#t=t;}get id(){return this.#e.id}get width(){return this.#e.width}get height(){return this.#e.height}get title(){return this.#e.title}get codePreview(){return this.#e.codePreview}async setAttributes(e){let t=await this.#t.invoke("updateComponentInstancePlaceholder",this.id,e);return t?new n(t,this.#t):null}async remove(){await this.#t.invoke("removeComponentInstancePlaceholder",this.id);}async replaceWithComponentInstance(e,t){let i=await this.#t.invoke("replaceComponentInstancePlaceholderWithComponentInstance",this.id,e,t);if(!i)return null;let o=x(i,this.#t);return c(be(o)),o}};var ca=(()=>{let n=null;return {disableUntilMouseUp:r(()=>{if(n)return;n=document.createElement("style"),n.textContent="* { pointer-events: none !important; user-select: none !important; -webkit-user-select: none !important; }",document.head.appendChild(n);let e=r(()=>{n&&(document.head.removeChild(n),n=null,o());},"enablePointerEvents"),t=r(a=>{a.buttons>0&&a.buttons&1||e();},"handlePointerChange"),i=r(()=>{e();},"handleBlur");window.addEventListener("pointerup",t,true),window.addEventListener("pointermove",t,true),window.addEventListener("blur",i);function o(){window.removeEventListener("pointerup",t,true),window.removeEventListener("pointermove",t,true),window.removeEventListener("blur",i);}r(o,"cleanup");},"disableUntilMouseUp")}})(),yr=5,pa=(()=>{let n=1;return {next:r(()=>`drag-${n++}`,"next")}})();function ma(){}r(ma,"noop");function hr(n,e,t,i){if(n.mode!=="canvas")return ma;let o=pa.next(),a=document.body.style.cursor,s={type:"idle"},d=document.body,u=se.subscribeToIsAllowedTo("makeDraggable",m=>{m||T();}),I=r(m=>{se.isAllowedTo("makeDraggable")&&s.type!=="idle"&&(s.type==="dragging"&&n.invoke("onDragEnd",{...m,dragSessionId:o}).then(h=>{try{i?.(h);}catch{}}).catch(h=>{if(h instanceof Error){i?.({status:"error",reason:h.message});return}if(typeof h=="string"){i?.({status:"error",reason:h});return}i?.({status:"error"});}),T());},"endDrag"),S=r(m=>{if(!se.isAllowedTo("makeDraggable")||s.type==="idle")return;if(!(m.buttons>0&&!!(m.buttons&1))){I({cancelled:false});return}let{clientX:A,clientY:z}=m;if(s.type==="pointerDown"){let E=A-s.dragStart.mouse.x,ct=z-s.dragStart.mouse.y;if(Math.abs(E)<yr&&Math.abs(ct)<yr)return;s={type:"dragging",dragStart:s.dragStart},n.invoke("onDragStart",s.dragStart),document.getSelection()?.empty(),ca.disableUntilMouseUp();}d.setPointerCapture(m.pointerId);let te={x:A,y:z};n.invoke("onDrag",{dragSessionId:o,mouse:te}).then(E=>{s.type==="dragging"&&(document.body.style.cursor=E??"");});},"handlePointerChange"),O=r(m=>{m.key==="Escape"&&I({cancelled:true});},"handleKeyDown"),_=r(()=>{I({cancelled:true});},"handleBlur"),b=r(m=>{if(!se.isAllowedTo("makeDraggable"))return;I({cancelled:true});let h=e.getBoundingClientRect(),A={x:h.x,y:h.y,width:h.width,height:h.height},z,te=e.querySelectorAll("svg");if(te.length===1){let ce=te.item(0).getBoundingClientRect();z={x:ce.x,y:ce.y,width:ce.width,height:ce.height};}let E={x:m.clientX,y:m.clientY};s={type:"pointerDown",dragStart:{dragSessionId:o,elementRect:A,svgRect:z,mouse:E}},n.invoke("setDragData",o,t()),d.addEventListener("pointermove",S,true),d.addEventListener("pointerup",S,true),window.addEventListener("keydown",O,true),window.addEventListener("blur",_);},"handlePointerDown"),p=r(()=>{if(!se.isAllowedTo("makeDraggable"))return;let m=t();m.type==="detachedComponentLayers"&&n.invoke("preloadDetachedComponentLayers",m.url),m.type==="image"&&n.invoke("preloadImageUrlForInsertion",m.image),m.previewImage&&n.invoke("preloadDragPreviewImage",m.previewImage);},"preload");e.addEventListener("pointerdown",b),e.addEventListener("mouseenter",p);function T(){s={type:"idle"},document.body.style.cursor=a,d.removeEventListener("pointermove",S,true),d.removeEventListener("pointerup",S,true),window.removeEventListener("keydown",O,true),window.removeEventListener("blur",_);}return r(T,"dragCleanup"),()=>{e.removeEventListener("pointerdown",b),e.removeEventListener("mouseenter",p),I({cancelled:true}),u();}}r(hr,"makeDraggable");var Ce=class n{static{r(this,"Redirect");}#e;#t;get id(){return this.#e.id}get from(){return this.#e.from}get to(){return this.#e.to}get expandToAllLocales(){return this.#e.expandToAllLocales}constructor(e,t){this.#t=t,this.#e=e;}remove(){return this.#t.invoke("removeRedirects",[this.id])}async setAttributes(e){let t={...e,id:this.id},[i]=await this.#t.invoke("addRedirects",[t]);return c(pt(i)),C(i)?null:new n(i,this.#t)}};var Kn=class{static{r(this,"FramerPluginAPI");}#e;constructor(e){this.#e=e;}get mode(){return this.#e.mode}isAllowedTo(...e){return e.every(t=>this.#e.perMethodPermissionMap[t])}subscribeToIsAllowedTo(...e){let[t,i]=di(e),o=this.isAllowedTo(...t),a=r(()=>{let s=this.isAllowedTo(...t);s!==o&&(o=s,i(o));},"update");return this.#e.permissionSubscriptions.add(a),()=>{this.#e.permissionSubscriptions.delete(a);}}async showUI(e){return this.#e.invoke("showUI",e)}async hideUI(){return this.#e.invoke("hideUI")}async setBackgroundMessage(e){return this.#e.invoke("setBackgroundMessage",e)}closePlugin(e,t){throw this.#e.invoke("closePlugin",e,t),new J}async getCurrentUser(){return this.#e.invoke("getCurrentUser2")}async getProjectInfo(){return this.#e.invoke("getProjectInfo2")}async getSelection(){return (await this.#e.invoke("getSelection")).map(t=>{let i=x(t,this.#e);return c(Qe(i)),i})}async setSelection(e){let t=f(e)?[e]:Array.from(e);return this.#e.invoke("setSelection",t)}subscribeToSelection(e){return this.#e.subscribe("selection",t=>{let i=t.map(o=>{let a=x(o,this.#e);return c(Qe(a)),a});e(i);})}async getCanvasRoot(){let e=await this.#e.invoke("getCanvasRoot"),t=x(e,this.#e);return c(Sn(t)),t}subscribeToCanvasRoot(e){return this.#e.subscribe("canvasRoot",t=>{let i=x(t,this.#e);c(Sn(i)),e(i);})}async getPublishInfo(){return this.#e.invoke("getPublishInfo")}subscribeToPublishInfo(e){return this.#e.subscribe("publishInfo",e)}async createFrameNode(e,t){let i=await this.#e.invoke("createNode","FrameNode",t??null,e);if(!i)return null;let o=x(i,this.#e);return c(o instanceof U),o}async removeNodes(e){return this.#e.invoke("removeNodes2",e)}async removeNode(e){return this.removeNodes([e])}async cloneNode(e){return this.#e.cloneNode(e)}async getNode(e){let t=await this.#e.invoke("getNode",e);return t?x(t,this.#e):null}async getParent(e){return this.#e.getParent(e)}async getChildren(e){return this.#e.getChildren(e)}async getRect(e){return this.#e.invoke("getRect",e)}async zoomIntoView(e,t){let i=f(e)?[e]:Array.from(e);return this.#e.invoke("zoomIntoView",i,t)}async setAttributes(e,t){return this.#e.setAttributes(e,t)}async setParent(e,t,i){return this.#e.invoke("setParent",e,t,i)}async getNodesWithType(e){return (await this.#e.invoke("getNodesWithType",null,e)).map(i=>x(i,this.#e))}async getNodesWithAttribute(e){return (await this.#e.invoke("getNodesWithAttribute",null,e)).map(i=>x(i,this.#e))}async getNodesWithAttributeSet(e){return (await this.#e.invoke("getNodesWithAttributeSet",null,e)).map(i=>x(i,this.#e))}async getImage(){let e=await this.#e.invoke("getImage");return e?y(this.#e,e):null}subscribeToImage(e){return this.#e.subscribe("image",t=>{if(!t){e(null);return}e(y(this.#e,t));})}async addImage(e){let t=await ze(e),i=Z(t);return this.#e.invokeTransferable("addImage",i,t)}async setImage(e){let t=await ze(e),i=Z(t);return this.#e.invokeTransferable("setImage",i,t)}async uploadImage(e){let t=await ze(e),i=Z(t),o=await this.#e.invokeTransferable("uploadImage",i,t);return y(this.#e,o)}async addImages(e){let t=await xn(e),i=t.flatMap(Z);await this.#e.invokeTransferable("addImages",i,t);}async uploadImages(e){let t=await xn(e),i=t.flatMap(Z),o=await this.#e.invokeTransferable("uploadImages",i,t);return y(this.#e,o)}async uploadFile(e){let t=await bn(e),i=await this.#e.invokeTransferable("uploadFile",Z(t),t);return y(this.#e,i)}async uploadFiles(e){let t=await Promise.all(e.map(bn)),i=t.flatMap(Z),o=await this.#e.invokeTransferable("uploadFiles",i,t);return y(this.#e,o)}async addSVG(e){return this.#e.invoke("addSVG",e)}async addComponentInstance({url:e,attributes:t,parentId:i}){let o=await this.#e.invoke("addComponentInstance",{url:e,attributes:t,parentId:i}),a=x(o,this.#e);return c(be(a)),a}async addDetachedComponentLayers({url:e,layout:t,attributes:i}){let o=await this.#e.invoke("addDetachedComponentLayers",{url:e,layout:t,attributes:i}),a=x(o,this.#e);return c(wt(a)),a}async preloadDetachedComponentLayers(e){await this.#e.invoke("preloadDetachedComponentLayers",e);}async preloadImageUrlForInsertion(e){await this.#e.invoke("preloadImageUrlForInsertion",e);}async preloadDragPreviewImage(e){await this.#e.invoke("preloadDragPreviewImage",e);}async getText(){return this.#e.invoke("getText")}async setText(e){return this.#e.invoke("setText",e)}async addText(e,t){return this.#e.invoke("addText",e,t)}async setCustomCode(e){return this.#e.invoke("setCustomCode",e)}async getCustomCode(){return this.#e.invoke("getCustomCode")}subscribeToCustomCode(e){return this.#e.subscribe("customCode",e)}subscribeToText(e){return this.#e.subscribe("text",e)}makeDraggable(e,t,i){return hr(this.#e,e,t,i)}async getActiveManagedCollection(){let e=await this.#e.invoke("getActiveManagedCollection");return c(e,"Collection data must be defined"),new he(e,this.#e)}async getManagedCollection(){return this.getActiveManagedCollection()}async getManagedCollections(){let e=await this.#e.invoke("getManagedCollections");return c(e,"Collections data must be defined"),e.map(t=>new he(t,this.#e))}async getCollection(e){let t=await this.#e.invoke("getCollection",e);return t?new ie(t,this.#e):null}async getActiveCollection(){let e=await this.#e.invoke("getActiveCollection");return e?new ie(e,this.#e):null}async getCollections(){return (await this.#e.invoke("getCollections")).map(t=>new ie(t,this.#e))}notify=r((e,t)=>this.#e.notify(e,t),"notify");async getPluginData(e){return this.#e.invoke("getPluginData",e)}async setPluginData(e,t){return this.#e.invoke("setPluginData",e,t)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeys")}async getColorStyles(){let e=await this.#e.invoke("getColorStyles");return y(this.#e,e)}async getColorStyle(e){let t=await this.#e.invoke("getColorStyle",e);return t?y(this.#e,t):null}async createColorStyle(e){let t=await this.#e.invoke("createColorStyle",e);return y(this.#e,t)}subscribeToColorStyles(e){return this.#e.subscribe("colorStyles",t=>{let i=y(this.#e,t);return e(i)})}async getTextStyles(){let e=await this.#e.invoke("getTextStyles");return y(this.#e,e)}async getTextStyle(e){let t=await this.#e.invoke("getTextStyle",e);return t?y(this.#e,t):null}async createTextStyle(e){let t=await this.#e.invoke("createTextStyle",e);return y(this.#e,t)}subscribeToTextStyles(e){return this.#e.subscribe("textStyles",t=>{let i=y(this.#e,t);return e(i)})}async getFont(e,t){let i=await this.#e.invoke("getFont",e,t);return i?y(this.#e,i):null}async getFonts(){let e=await this.#e.invoke("getFonts");return y(this.#e,e)}getLocales(){return this.#e.invoke("getLocales")}getDefaultLocale(){return this.#e.invoke("getDefaultLocale")}getActiveLocale(){return this.#e.invoke("getActiveLocale")}async getLocalizationGroups(e){return this.#e.invoke("getLocalizationGroups",e)}setLocalizationData(e){return this.#e.invoke("setLocalizationData",e)}async getRedirects(){return (await this.#e.invoke("getRedirects")).map(t=>new Ce(t,this.#e))}subscribeToRedirects(e){return this.#e.subscribe("redirects",t=>{let i=t.map(o=>new Ce(o,this.#e));return e(i)})}async addRedirects(e){return (await this.#e.invoke("addRedirects",e)).map(i=>new Ce(i,this.#e))}async removeRedirects(e){return this.#e.invoke("removeRedirects",e)}async setRedirectOrder(e){return this.#e.invoke("setRedirectOrder",e)}async createCodeFile(e,t,i){let o=await this.#e.invoke("createCodeFile",e,t,i);return new Q(o,this.#e)}async getCodeFiles(){let e=await this.#e.invoke("getCodeFiles"),t=[];for(let i of e)t.push(new Q(i,this.#e));return t}async getCodeFile(e){let t=await this.#e.invoke("getCodeFile",e);return t?new Q(t,this.#e):null}lintCode(e,t,i){return Promise.resolve([])}typecheckCode(e,t,i,o){return this.#e.invoke("typecheckCode",e,t,i,o)}subscribeToCodeFiles(e){return this.#e.subscribe("codeFiles",t=>{let i=t?.map(o=>new Q(o,this.#e));return e(i)})}setMenu(e){return this.#e.setMenu(e)}showContextMenu(e,t){return this.#e.showContextMenu(e,t)}async unstable_ensureMinimumDependencyVersion(e,t){return this.#e.invoke("unstable_ensureMinimumDependencyVersion",e,t)}async navigateTo(e,t){return this.#e.invoke("navigateTo",e,t)}subscribeToOpenCodeFile(e){return this.#e.subscribe("openCodeFile",t=>{let i=t?new Q(t,this.#e):null;return e(i)})}async createDesignPage(e){let t=await this.#e.invoke("createDesignPage",e),i=x(t,this.#e);return c(i instanceof $,"Expected node to be a DesignPageNode"),i}async createWebPage(e){let t=await this.#e.invoke("createWebPage",e),i=x(t,this.#e);return c(i instanceof K,"Expected node to be a WebPageNode"),i}async createCollection(e){let t=await this.#e.invoke("createCollection",e);return new ie(t,this.#e)}async createManagedCollection(e){let t=await this.#e.invoke("createManagedCollection",e);return new he(t,this.#e)}async setCloseWarning(e){return this.#e.invoke("setCloseWarning",e)}get[l.initialState](){return this.#e.initialState}},$n=class extends Kn{static{r(this,"FramerPluginAPIBeta");}#e;constructor(e){super(e),this.#e=e,this.#e;}},it=class extends $n{static{r(this,"FramerPluginAPIAlpha");}#e;constructor(e){super(e),this.#e=e,this.#e;}async addComponentInstancePlaceholder(e){let t=await this.#e.invoke("addComponentInstancePlaceholder",e);return new Bt(t,this.#e)}async[l.getAiServiceInfo](e){return this.#e.invoke(gt,e)}async[l.sendTrackingEvent](e,t,i){return this.#e.invoke(ft,e,t,i)}async[l.getCurrentUser](){return this.#e.invoke(yt)}async[l.getProjectInfo](){return this.#e.invoke(ht)}async[l.getHTMLForNode](e){return this.#e.invoke(me,e)}async[l.setHTMLForNode](e,t){return this.#e.invoke(ge,e,t)}get[l.environmentInfo](){return this.#e.environmentInfo}get[l.showUncheckedPermissionToasts](){return this.#e.showUncheckedPermissionToasts}set[l.showUncheckedPermissionToasts](e){this.#e.showUncheckedPermissionToasts=e;}async createTextNode(e,t){let i=await this.#e.invoke("createNode","TextNode",t??null,e);if(!i)return null;let o=x(i,this.#e);return c(o instanceof oe),o}async createComponentNode(e){let t=await this.#e.invoke("createNode","ComponentNode",null,{name:e});if(!t)return null;let i=x(t,this.#e);return c(i instanceof ae),i}async getVectorSets(){return (await this.#e.invoke("getVectorSets")).map(t=>new et(t,this.#e))}async createLocale(e){return this.#e.invoke("createLocale",e)}async getLocaleLanguages(){return this.#e.invoke("getLocaleLanguages")}async getLocaleRegions(e){return this.#e.invoke("getLocaleRegions",e)}async[v.publish](){return this.#e.invoke("publish")}async[v.getDeployments](){return this.#e.invoke("getDeployments")}async[v.deploy](e,t){return this.#e.invoke("deploy",e,t)}async[v.getChangedPaths](){return this.#e.invoke("getChangedPaths")}async[v.getChangeContributors](e,t){return this.#e.invoke("getChangeContributors",e,t)}async[v.createManagedCollection](e){return this.createManagedCollection(e)}[v.rejectAllPending](e){this.#e.rejectAllPending(e);}async[v.getAgentSystemPrompt](){return this.#e.invoke("getAgentSystemPrompt")}async[v.getAgentContext](e){return this.#e.invoke("getAgentContext",e)}async[v.readProjectForAgent](e,t){return this.#e.invoke("readProjectForAgent",e,t)}async[v.applyAgentChanges](e,t){return this.#e.invoke("applyAgentChanges",e,t)}async[v.startAgentConversation](e,t){return this.#e.invoke("startAgentConversation",e,t)}async[v.continueAgentConversation](e,t){return this.#e.invoke("continueAgentConversation",e,t)}async[v.submitAgentClarification](e){return this.#e.invoke("submitAgentClarification",e)}};var jn=class{constructor(e){this.origin=e;}origin;static{r(this,"IframeTransport");}send(e,t){window.parent.postMessage(e,this.origin,t);}onMessage(e){window.addEventListener("message",e);}};async function ga(){return new Promise(n=>{function e({data:t,origin:i}){if(!mr(t))return;window.removeEventListener("message",e);let a={transport:new jn(i),mode:t.mode,permissionMap:t.permissionMap,environmentInfo:t.environmentInfo,origin:i,theme:t.theme??null,initialState:t.initialState};n(a);}r(e,"handshakeListener"),window.addEventListener("message",e),window.parent.postMessage(cr,"*");})}r(ga,"createBrowserContext");async function fa(){return typeof window>"u"||"Deno"in globalThis?null:ga()}r(fa,"bootstrap");var br=await fa(),se=br?new it(new nt(br)):new Proxy({},{get(n,e){throw new Error(`Cannot access framer.${String(e)} in server runtime. Use createFramerInstance() with a custom transport.`)}});function xr(n){return new it(new nt(n))}r(xr,"createFramerInstance");var Cr={};function ha(n){if(env)try{Object.assign(env,n);}catch{}Object.assign(Cr,n);}r(ha,"configure");function Ie(n,e){let t=Cr[n]??env[n];return t&&t.length>0?t:e}r(Ie,"getEnv");var Ir=isWorkerd,_n=globalThis.WebSocket;async function Tr(n,e){let t=new URL(n.href);t.protocol=t.protocol==="wss:"?"https:":t.protocol==="ws:"?"http:":t.protocol;let o=(await fetch(t.href,{headers:{Upgrade:"websocket",...e}})).webSocket;if(!o)throw new Error("WebSocket upgrade failed - server did not accept");return o.accept(),o}r(Tr,"connectWebSocketCF");var Pr,Sr;try{Pr=await import('fs'),Sr=await import('path');}catch{}var qn=Pr,Yn=Sr;var le=(u=>(u.PROJECT_CLOSED="PROJECT_CLOSED",u.POOL_EXHAUSTED="POOL_EXHAUSTED",u.TIMEOUT="TIMEOUT",u.INTERNAL="INTERNAL",u.NODE_NOT_FOUND="NODE_NOT_FOUND",u.SCREENSHOT_TOO_LARGE="SCREENSHOT_TOO_LARGE",u.INVALID_REQUEST="INVALID_REQUEST",u.UNAUTHORIZED="UNAUTHORIZED",u))(le||{}),D=class extends Error{static{r(this,"FramerAPIError");}code;constructor(e,t){super(e),this.name="FramerAPIError",this.code=t,this.stack=void 0;}};function ba(n){return n instanceof D?n.code==="POOL_EXHAUSTED":false}r(ba,"isRetryableError");var xa=new Map(Object.values(le).map(n=>[n,n]));function Dr(n){return typeof n=="string"?xa.get(n)??"INTERNAL":"INTERNAL"}r(Dr,"parseErrorCode");var Ca={pluginMarshalTag:Mt};var Xn={silent:0,error:1,warn:2,info:3,debug:4};function Ia(){let n=Ie("FRAMER_API_LOG_LEVEL")?.toLowerCase();return n&&n in Xn?n:"warn"}r(Ia,"getLogLevel");var Zn=Ia();function rt(n){return Xn[n]<=Xn[Zn]}r(rt,"shouldLog");var ot=globalThis.console,Ta="\x1B[90m",Pa="\x1B[0m";function Sa(n){return n?`[FramerAPI:${n}]`:"[FramerAPI]"}r(Sa,"formatPrefix");function Fa(n,...e){return [Ta+n,...e,Pa]}r(Fa,"formatDebug");function vr(n){let e=Sa(n);return {warn:r((...t)=>{rt("warn")&&ot.warn(e,...t);},"warn"),error:r((...t)=>{rt("error")&&ot.error(e,...t);},"error"),log:r((...t)=>{rt("info")&&ot.log(e,...t);},"log"),info:r((...t)=>{rt("info")&&ot.info(e,...t);},"info"),debug:r((...t)=>{rt("debug")&&ot.debug(...Fa(e,...t));},"debug"),setLevel:r(t=>{Zn=t;},"setLevel"),getLevel:r(()=>Zn,"getLevel"),withRequestId:r(t=>vr(t),"withRequestId")}}r(vr,"createLogger");var k=vr();k.warn;k.error;k.log;k.info;k.debug;k.setLevel;k.getLevel;var Ut="0.1.6";function ee(n,...e){if(n)return;let t=Error("Assertion Error"+(e.length>0?": "+e.join(" "):""));if(t.stack)try{let i=t.stack.split(`
|
|
5
|
+
`));}catch{}throw t}r(c,"assert");function S(n){for(let e of Reflect.ownKeys(n)){let t=n[e];!t||typeof t!="object"&&!yo(t)||S(t);}return Object.freeze(n)}r(S,"deepFreeze");function Ti(n){return [n.slice(0,-1),n.at(-1)]}r(Ti,"splitRestAndLast");var g="__class";var qt=Symbol(),Yt=Symbol(),Xt=Symbol(),Zt=Symbol(),ho=Symbol(),bo=Symbol(),xo=Symbol(),Co=Symbol(),Io=Symbol(),Jt=Symbol(),Qt=Symbol(),l={getAiServiceInfo:qt,sendTrackingEvent:Yt,getCurrentUser:Xt,getProjectInfo:Zt,environmentInfo:ho,initialState:bo,showUncheckedPermissionToasts:xo,marshal:Co,unmarshal:Io,getHTMLForNode:Jt,setHTMLForNode:Qt},pe="INTERNAL_",gt=`${pe}getAiServiceInfo`,ft=`${pe}sendTrackingEvent`,yt=`${pe}getCurrentUser`,ht=`${pe}getProjectInfo`,me=`${pe}getHTMLForNode`,ge=`${pe}setHTMLForNode`;var E=class{static{r(this,"VariableBase");}#e;#t;get nodeId(){return this.#t.nodeId}get nodeType(){return this.#t.nodeType}get id(){return this.#t.id}get name(){return this.#t.name}get description(){return this.#t.description??null}constructor(e,t){this.#e=e,this.#t=t;}async setAttributes(e){let t=await this.#e.invoke("updateVariable",this.nodeId,this.id,{...e,type:this.type});if(I(t))return null;let i=this.constructor;return new i(this.#e,t)}async remove(){await this.#e.invoke("removeVariables",this.nodeId,[this.id]);}},w="Variable";function V(n){let e=n.at(0);return c(!Ci(e)),`${e.toLowerCase()}${n.slice(1,-w.length)}`}r(V,"classToType");var To=`Boolean${w}`,Po=V(To),ve=class n extends E{static{r(this,"BooleanVariable");}type=Po;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},So=`Number${w}`,Fo=V(So),De=class n extends E{static{r(this,"NumberVariable");}type=Fo;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},vo=`String${w}`,Do=V(vo),ke=class n extends E{static{r(this,"StringVariable");}type=Do;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},ko=`FormattedText${w}`,No=V(ko),Ne=class n extends E{static{r(this,"FormattedTextVariable");}type=No;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},Ao=`Enum${w}`,Eo=V(Ao),Y=class n{static{r(this,"EnumCase");}#e;#t;#n;#i;get id(){return this.#i.id}get name(){return this.#i.name}get nameByLocale(){return this.#i.nameByLocale}constructor(e,t,i,o){this.#e=e,this.#t=t,this.#n=i,this.#i=o;}async setAttributes(e){let t=await this.#e.invoke("updateEnumCase",this.#t,this.#n,this.id,e);return t?new n(this.#e,this.#t,this.#n,t):null}async remove(){await this.#e.invoke("removeEnumCase",this.#t,this.#n,this.id);}},Ae=class n extends E{static{r(this,"EnumVariable");}type=Eo;#e;#t;#n;get cases(){return this.#n||(this.#n=S(this.#t.cases.map(e=>new Y(this.#e,this.nodeId,this.id,e)))),this.#n}constructor(e,t){super(e,t),this.#e=e,this.#t=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#t}async addCase(e){let t=await this.#e.invoke("addEnumCase",this.nodeId,this.id,e);return t?new Y(this.#e,this.nodeId,this.id,t):null}async setCaseOrder(e){await this.#e.invoke("setEnumCaseOrder",this.nodeId,this.id,e);}},Mo=`Color${w}`,wo=V(Mo),Ee=class n extends E{static{r(this,"ColorVariable");}type=wo;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},Vo=`Image${w}`,Lo=V(Vo),Me=class n extends E{static{r(this,"ImageVariable");}type=Lo;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},Wo=`File${w}`,Ro=V(Wo),we=class n extends E{static{r(this,"FileVariable");}type=Ro;#e;get allowedFileTypes(){return this.#e.allowedFileTypes}constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},Bo=`Link${w}`,Uo=V(Bo),Ve=class n extends E{static{r(this,"LinkVariable");}type=Uo;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},Oo=`Date${w}`,zo=V(Oo),Le=class n extends E{static{r(this,"DateVariable");}type=zo;#e;get displayTime(){return this.#e.displayTime}constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},Go=`Border${w}`,Ko=V(Go),We=class n extends E{static{r(this,"BorderVariable");}type=Ko;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},$o=`Unsupported${w}`,jo=V($o),Re=class n extends E{static{r(this,"UnsupportedVariable");}type=jo;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}};function Pi(n){return n instanceof E}r(Pi,"isVariable");function Ho(n){return Pi(n)&&n.nodeType==="component"}r(Ho,"isComponentVariable");var B=class{static{r(this,"FieldBase");}#e;#t;#n;get id(){return this.#n.id}get name(){return this.#n.name}constructor(e,t,i){this.#e=e,this.#t=t,this.#n=i;}async setAttributes(e){let t={...e,type:this.type,id:this.id},[i]=await this.#e.invoke("addCollectionFields2",this.#t,[t]);if(c(pt(i)),I(i))return null;c(i.type===this.type);let o=this.constructor;return new o(this.#e,this.#t,i)}async remove(){await this.#e.invoke("removeCollectionFields",this.#t,[this.id]);}},R=class extends B{static{r(this,"FieldBaseWithRequired");}#e;get required(){return this.#e.required}constructor(e,t,i){super(e,t,i),this.#e=i;}},bt=class extends B{static{r(this,"BooleanField");}type=nn},xt=class extends B{static{r(this,"ColorField");}type=rn},Ct=class extends B{static{r(this,"NumberField");}type=on},It=class extends R{static{r(this,"StringField");}type=an;#e;constructor(e,t,i){super(e,t,i),this.#e=i;}get basedOn(){return this.#e.basedOn}},Tt=class extends R{static{r(this,"FormattedTextField");}type=sn},Be=class extends R{static{r(this,"ImageField");}type=ln},Pt=class extends R{static{r(this,"LinkField");}type=un},St=class extends R{static{r(this,"DateField");}type=cn;#e;get displayTime(){return this.#e.displayTime}constructor(e,t,i){super(e,t,i),this.#e=i;}},Ft=class extends B{static{r(this,"FieldDivider");}type=yn},Ue=class extends B{static{r(this,"UnsupportedField");}type=hn},vt=class extends R{static{r(this,"FileField");}type=pn;#e;get allowedFileTypes(){return this.#e.allowedFileTypes}constructor(e,t,i){super(e,t,i),this.#e=i;}},Dt=class extends B{static{r(this,"EnumField");}type=mn;#e;#t;#n;#i;get cases(){return this.#i||(this.#i=this.#n.cases.map(e=>new Y(this.#e,this.#t,this.id,e)),S(this.#i)),this.#i}constructor(e,t,i){super(e,t,i),this.#e=e,this.#t=t,this.#n=i;}async addCase(e){let t=await this.#e.invoke("addEnumCase",this.#t,this.id,e);return t?new Y(this.#e,this.#t,this.id,t):null}async setCaseOrder(e){await this.#e.invoke("setEnumCaseOrder",this.#t,this.id,e);}},kt=class extends R{static{r(this,"CollectionReferenceField");}type=gn;#e;get collectionId(){return this.#e.collectionId}constructor(e,t,i){super(e,t,i),this.#e=i;}},Nt=class extends R{static{r(this,"MultiCollectionReferenceField");}type=fn;#e;get collectionId(){return this.#e.collectionId}constructor(e,t,i){super(e,t,i),this.#e=i;}},en=class extends R{static{r(this,"ArrayField");}type=dn;fields;constructor(e,t,i){super(e,t,i);let o=i.fields[0];this.fields=[new Be(e,t,o)];}};function tn(n,e,t){return n.map(i=>{switch(i.type){case nn:return new bt(e,t,i);case rn:return new xt(e,t,i);case on:return new Ct(e,t,i);case an:return new It(e,t,i);case sn:return new Tt(e,t,i);case ln:return new Be(e,t,i);case un:return new Pt(e,t,i);case cn:return new St(e,t,i);case yn:return new Ft(e,t,i);case hn:return new Ue(e,t,i);case pn:return new vt(e,t,i);case mn:return new Dt(e,t,i);case gn:return new kt(e,t,i);case fn:return new Nt(e,t,i);case dn:return new en(e,t,i);default:return new Ue(e,t,i)}})}r(tn,"fieldDefinitionDataArrayToFieldClassInstances");function _o(n){return n instanceof B}r(_o,"isField");var Si="action";function qo(n){return !!n&&Si in n&&f(n[Si])}r(qo,"isLocalizedValueUpdate");function Fi(n){return Object.keys(n).reduce((e,t)=>{let i=n[t];return qo(i)&&(e[t]=i),e},{})}r(Fi,"filterInlineLocalizationValues");var Oe=class n{static{r(this,"FileAsset");}id;url;extension;constructor(e){this.url=e.url,this.id=e.id,this.extension=e.extension;}static[l.unmarshal](e,t){return new n(t)}[l.marshal](){return {[g]:"FileAsset",id:this.id,url:this.url,extension:this.extension}}};function Yo(n){return n instanceof Oe}r(Yo,"isFileAsset");var Xo="ImageAsset";function vi(n){return k(n)?n[g]===Xo:false}r(vi,"isImageAssetData");var X=class n{static{r(this,"ImageAsset");}id;url;thumbnailUrl;altText;resolution;#e;#t;constructor(e,t){this.#t=e,this.url=t.url,this.id=t.id,this.thumbnailUrl=t.thumbnailUrl,this.altText=t.altText,this.resolution=t.resolution;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return {[g]:"ImageAsset",id:this.id,url:this.url,thumbnailUrl:this.thumbnailUrl,altText:this.altText,resolution:this.resolution}}cloneWithAttributes({altText:e,resolution:t}){return new n(this.#t,{[g]:"ImageAsset",id:this.id,url:this.url,thumbnailUrl:this.thumbnailUrl,altText:e??this.altText,resolution:t??this.resolution})}async measure(){return Qo(this.url)}async getData(){if(this.#e&&this.#e.bytes.length>0)return this.#e;let e=await this.#t.invoke("getImageData",{id:this.id,resolution:this.resolution});if(!e)throw new Error("Failed to load image data");return this.#e=e,e}async loadBitmap(){let{mimeType:e,bytes:t}=await this.getData(),i=new Blob([t],{type:e});return createImageBitmap(i)}async loadImage(){let e=await this.getData(),t=URL.createObjectURL(new Blob([e.bytes]));return new Promise((i,o)=>{let a=new Image;a.onload=()=>i(a),a.onerror=()=>o(),a.src=t;})}};function Zo(n){return n instanceof X}r(Zo,"isImageAsset");function Z(n){return n.type==="bytes"?[n.bytes.buffer]:[]}r(Z,"getTransferable");function Jo(n){if(!k(n))return false;let e="bytes",t="mimeType";return !(!(e in n)||!(t in n)||!(n[e]instanceof Uint8Array)||!f(n[t]))}r(Jo,"isBytesData");async function ze(n){if(n instanceof File)return Cn(n);let e=await Di(n.image);return {name:n.name,altText:n.altText,resolution:n.resolution,preferredImageRendering:n.preferredImageRendering,...e}}r(ze,"createImageTransferFromInput");async function bn(n){if(n instanceof File)return Cn(n);let e=await Di(n.file);return {name:n.name,...e}}r(bn,"createFileTransferFromInput");async function Di(n){return n instanceof File?Cn(n):Jo(n)?{type:"bytes",mimeType:n.mimeType,bytes:n.bytes}:{type:"url",url:n}}r(Di,"createAssetTransferFromAssetInput");function xn(n){return Promise.all(n.map(ze))}r(xn,"createNamedAssetDataTransferFromInput");async function Cn(n){return new Promise((e,t)=>{let i=new FileReader;i.onload=o=>{let a=n.type,s=o.target?.result;if(!s||!(s instanceof ArrayBuffer)){t(new Error("Failed to read file, arrayBuffer is null"));return}let d=new Uint8Array(s);e({bytes:d,mimeType:a,type:"bytes",name:n.name});},i.onerror=o=>{t(o);},i.readAsArrayBuffer(n);})}r(Cn,"getAssetDataFromFile");async function Qo(n){let e=n instanceof File,t=e?URL.createObjectURL(n):n,i=new Image;return i.crossOrigin="anonymous",new Promise((o,a)=>{i.onload=()=>{o({width:i.naturalWidth,height:i.naturalHeight});},i.onerror=s=>{a(s);},i.src=t;}).finally(()=>{e&&URL.revokeObjectURL(t);})}r(Qo,"measureImage");var At=class{static{r(this,"ComputedValueBase");}};var ea="unsupported",Ge=class n extends At{static{r(this,"UnsupportedComputedValue");}type=ea;#e;constructor(e){super(),this.#e=e;}static[l.unmarshal](e,t){return new n(t)}[l.marshal](){return this.#e}};function ta(n){return n instanceof At}r(ta,"isComputedValue");var na="Font";function Ni(n){return k(n)&&n[g]===na}r(Ni,"isFontData");function ia(n){if(!q(n))return false;switch(n){case 100:case 200:case 300:case 400:case 500:case 600:case 700:case 800:case 900:return true;default:return false}}r(ia,"isFontWeight");function ra(n){if(!f(n))return false;switch(n){case "normal":case "italic":return true;default:return false}}r(ra,"isFontStyle");function Ai(n){return k(n)?f(n.family)&&f(n.selector)&&ia(n.weight)&&ra(n.style):false}r(Ai,"isFont");var G=class n{static{r(this,"Font");}selector;family;weight;style;constructor(e){this.selector=e.selector,this.family=e.family,this.weight=e.weight,this.style=e.style;}static[l.unmarshal](e,t){let i=ki.get(t.selector);if(i)return i;let o=new n(t);return ki.set(t.selector,o),o}[l.marshal](){return {[g]:"Font",selector:this.selector,family:this.family,weight:this.weight,style:this.style}}},ki=new Map;var Et="plugin-marshal";function In(n){return k(n)&&l.marshal in n}r(In,"isSelfMarshalable");function L(n){if(In(n))return n[l.marshal]();if(mt(n))return n.map(L);if(Se(n)){let e={};for(let t of Object.keys(n))e[t]=L(n[t]);return e}return n}r(L,"marshal");var oa="LinearGradient",aa="RadialGradient",sa="ConicGradient",fe=class{static{r(this,"GradientBase");}#e;get stops(){return this.#e.stops}constructor(e){this.#e=e;}cloneWithAttributes(e){let t=this.constructor;return new t({...this.#e,...e})}},Ke=class n extends fe{static{r(this,"LinearGradient");}[g]=oa;#e;get angle(){return this.#e.angle}constructor(e){super(e),this.#e=e;}static[l.unmarshal](e,t){return new n({...t,stops:y(e,t.stops)})}[l.marshal](){return L({...this.#e,[g]:this[g]})}toCSS(){let e=this.#e.stops.map(t=>(c(f(t.color),"ColorStyle not supported yet"),`${t.color} ${t.position*100}%`)).join(", ");return `linear-gradient(${this.angle}deg, ${e})`}},$e=class n extends fe{static{r(this,"RadialGradient");}[g]=aa;#e;get width(){return this.#e.width}get height(){return this.#e.height}get x(){return this.#e.x}get y(){return this.#e.y}constructor(e){super(e),this.#e=e;}static[l.unmarshal](e,t){return new n({...t,stops:y(e,t.stops)})}[l.marshal](){return L({...this.#e,[g]:this[g]})}toCSS(){let e=this.stops.map((t,i)=>{c(f(t.color),"ColorStyle not supported yet");let o=this.stops[i+1],a=t.position===1&&o?.position===1?t.position-1e-4:t.position;return `${t.color} ${a*100}%`}).join(", ");return `radial-gradient(${this.width} ${this.height} at ${this.x} ${this.y}, ${e})`}},je=class n extends fe{static{r(this,"ConicGradient");}[g]=sa;#e;get angle(){return this.#e.angle}get x(){return this.#e.x}get y(){return this.#e.y}constructor(e){super(e),this.#e=e;}static[l.unmarshal](e,t){return new n({...t,stops:y(e,t.stops)})}[l.marshal](){return L({...this.#e,[g]:this[g]})}toCSS(){let e=this.stops.map(t=>(c(f(t.color),"ColorStyle not supported yet"),`${t.color} ${t.position*360}deg`)).join(", ");return `conic-gradient(from ${this.angle}deg at ${this.x} ${this.y}, ${e})`}};function Ei(n){return n instanceof fe}r(Ei,"isGradient");var la="ColorStyle";function Mt(n){return k(n)?n[g]===la:false}r(Mt,"isColorStyleData");var ne=class n{static{r(this,"ColorStyle");}id;name;path;light;dark;#e;constructor(e,t){this.id=t.id,this.name=t.name,this.light=t.light,this.dark=t.dark,this.path=t.path,this.#e=e;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return {[g]:"ColorStyle",id:this.id,name:this.name,light:this.light,dark:this.dark,path:this.path}}async setAttributes(e){let t=await this.#e.invoke("setColorStyleAttributes",this.id,e);return t?new n(this.#e,t):null}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async setPluginData(e,t){return this.#e.invoke("setPluginDataForNode",this.id,e,t)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}async remove(){return this.#e.invoke("removeColorStyle",this.id)}};function ye(n){return n instanceof ne}r(ye,"isColorStyle");var da="TextStyle";function Mi(n){return k(n)?n[g]===da:false}r(Mi,"isTextStyleData");var He=class n{static{r(this,"TextStyle");}id;name;path;tag;font;boldFont;italicFont;boldItalicFont;color;transform;alignment;decoration;decorationColor;decorationThickness;decorationStyle;decorationSkipInk;decorationOffset;balance;breakpoints;minWidth;fontSize;letterSpacing;lineHeight;paragraphSpacing;#e;constructor(e,t){this.id=t.id,this.name=t.name,this.path=t.path,this.tag=t.tag,this.font=G[l.unmarshal](e,t.font),this.boldFont=t.boldFont&&G[l.unmarshal](e,t.boldFont),this.italicFont=t.italicFont&&G[l.unmarshal](e,t.italicFont),this.boldItalicFont=t.boldItalicFont&&G[l.unmarshal](e,t.boldItalicFont),this.color=Mt(t.color)?ne[l.unmarshal](e,t.color):t.color,this.transform=t.transform,this.alignment=t.alignment,this.decoration=t.decoration,this.decorationColor=Mt(t.decorationColor)?ne[l.unmarshal](e,t.decorationColor):t.decorationColor,this.decorationThickness=t.decorationThickness,this.decorationStyle=t.decorationStyle,this.decorationSkipInk=t.decorationSkipInk,this.decorationOffset=t.decorationOffset,this.balance=t.balance,this.breakpoints=t.breakpoints,this.minWidth=t.minWidth,this.fontSize=t.fontSize,this.letterSpacing=t.letterSpacing,this.lineHeight=t.lineHeight,this.paragraphSpacing=t.paragraphSpacing,this.#e=e;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return {[g]:"TextStyle",id:this.id,name:this.name,path:this.path,tag:this.tag,font:this.font[l.marshal](),boldFont:this.boldFont?.[l.marshal]()??null,italicFont:this.italicFont?.[l.marshal]()??null,boldItalicFont:this.boldItalicFont?.[l.marshal]()??null,color:ye(this.color)?this.color[l.marshal]():this.color,transform:this.transform,alignment:this.alignment,decoration:this.decoration,decorationColor:ye(this.decorationColor)?this.decorationColor[l.marshal]():this.decorationColor,decorationThickness:this.decorationThickness,decorationStyle:this.decorationStyle,decorationSkipInk:this.decorationSkipInk,decorationOffset:this.decorationOffset,balance:this.balance,breakpoints:this.breakpoints,minWidth:this.minWidth,fontSize:this.fontSize,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,paragraphSpacing:this.paragraphSpacing}}async setAttributes(e){let t=await this.#e.invoke("setTextStyleAttributes",this.id,e);return t?new n(this.#e,t):null}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async setPluginData(e,t){return this.#e.invoke("setPluginDataForNode",this.id,e,t)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}async remove(){return this.#e.invoke("removeTextStyle",this.id)}};function Tn(n){return n instanceof He}r(Tn,"isTextStyle");var wi={ColorStyle:ne,ConicGradient:je,FileAsset:Oe,Font:G,ImageAsset:X,LinearGradient:Ke,RadialGradient:$e,TextStyle:He,BooleanVariable:ve,BorderVariable:We,ColorVariable:Ee,DateVariable:Le,EnumVariable:Ae,FileVariable:we,FormattedTextVariable:Ne,ImageVariable:Me,LinkVariable:Ve,NumberVariable:De,StringVariable:ke,UnsupportedVariable:Re,UnsupportedComputedValue:Ge};function ua(n){return Se(n)&&f(n[g])&&n[g]in wi}r(ua,"isSelfUnmarshalable");function y(n,e){if(ua(e))return wi[e[g]][l.unmarshal](n,e);if(mt(e))return e.map(t=>y(n,t));if(Se(e)){let t={};for(let i of Object.keys(e))t[i]=y(n,e[i]);return t}return e}r(y,"unmarshal");var ca={array:false,boolean:false,collectionReference:false,color:false,date:false,enum:false,file:false,formattedText:false,image:true,link:false,multiCollectionReference:false,number:false,string:false,unsupported:false};function pa(n){return ca[n]}r(pa,"isSupportedArrayItemFieldType");function ma(n){return pa(n.type)}r(ma,"isSupportedArrayItemFieldDataEntry");var nn="boolean",rn="color",on="number",an="string",sn="formattedText",ln="image",dn="array",un="link",cn="date",pn="file",mn="enum",gn="collectionReference",fn="multiCollectionReference",yn="divider",hn="unsupported";function ga(n){return n.map(e=>{if(e.type!=="enum")return e;let t=e.cases.map(i=>{let o=i.nameByLocale?Fi(i.nameByLocale):void 0;return {...i,nameByLocale:o}});return {...e,cases:t}})}r(ga,"sanitizeEnumFieldForMessage");function Vi(n,e){let t={};for(let i in n){let o=n[i];if(!o)continue;if(o.type!=="array"){t[i]=y(e,o);continue}let a=o.value.map(s=>{let d=Vi(s.fieldData,e),u={};for(let T in d){let F=d[T];c(F&&ma(F),"Unsupported array item field data entry"),u[T]=F;}return {...s,fieldData:u}});t[i]={...o,value:a};}return t}r(Vi,"deserializeFieldData");var he=class{static{r(this,"ManagedCollection");}id;name;readonly;managedBy;#e;constructor(e,t){this.id=e.id,this.name=e.name,this.readonly=e.readonly,c(e.managedBy!=="user","Managed Collection can only be managed by a plugin"),this.managedBy=e.managedBy,this.#e=t,S(this);}async getItemIds(){return this.#e.invoke("getManagedCollectionItemIds",this.id)}async setItemOrder(e){return this.#e.invoke("setManagedCollectionItemOrder",this.id,e)}async getFields(){return this.#e.invoke("getManagedCollectionFields2",this.id)}async setFields(e){let t=ga(e);return this.#e.invoke("setManagedCollectionFields",this.id,t)}async addItems(e){return this.#e.invoke("addManagedCollectionItems2",this.id,e)}async removeItems(e){return this.#e.invoke("removeManagedCollectionItems",this.id,e)}async setAsActive(){return this.#e.invoke("setActiveCollection",this.id)}async setPluginData(e,t){return this.#e.invoke("setPluginDataForNode",this.id,e,t)}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}async navigateTo(e){return this.#e.invoke("navigateTo",this.id,e)}},ie=class{static{r(this,"Collection");}id;name;slugFieldName;slugFieldBasedOn;readonly;managedBy;#e;constructor(e,t){this.id=e.id,this.name=e.name,this.slugFieldName=e.slugFieldName,this.slugFieldBasedOn=e.slugFieldBasedOn,this.readonly=e.readonly,this.managedBy=e.managedBy,this.#e=t,S(this);}async setItemOrder(e){return this.#e.invoke("setCollectionItemOrder",this.id,e)}async getFields(){let e=await this.#e.invoke("getCollectionFields2",this.id,true);return tn(e,this.#e,this.id)}async addFields(e){let t=await this.#e.invoke("addCollectionFields2",this.id,e);return c(t.every(Ii)),tn(t,this.#e,this.id)}async removeFields(e){return this.#e.invoke("removeCollectionFields",this.id,e)}async setFieldOrder(e){return this.#e.invoke("setCollectionFieldOrder",this.id,e)}async getItems(){return (await this.#e.invoke("getCollectionItems2",this.id)).map(t=>new _e(t,this.#e))}async addItems(e){await this.#e.invoke("addCollectionItems2",this.id,e);}async removeItems(e){return this.#e.invoke("removeCollectionItems",e)}async setAsActive(){return this.#e.invoke("setActiveCollection",this.id)}async setPluginData(e,t){return this.#e.invoke("setPluginDataForNode",this.id,e,t)}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}async navigateTo(e){return this.#e.invoke("navigateTo",this.id,e)}},_e=class n{static{r(this,"CollectionItem");}id;nodeId;slug;slugByLocale;draft;fieldData;#e;constructor(e,t){let i=Vi(e.fieldData,t);this.id=e.externalId??e.nodeId,this.nodeId=e.nodeId,this.slug=e.slug,this.slugByLocale=e.slugByLocale,this.draft=e.draft??false,this.fieldData=i,this.#e=t,S(this);}async remove(){return this.#e.invoke("removeCollectionItems",[this.id])}async setAttributes(e){let t=await this.#e.invoke("setCollectionItemAttributes2",this.id,e);return t?new n(t,this.#e):null}async setPluginData(e,t){return this.#e.invoke("setPluginDataForNode",this.id,e,t)}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}async navigateTo(e){return this.#e.invoke("navigateTo",this.nodeId,e)}};var fa={fixed:true,sticky:true,absolute:true,relative:true},Li="position";function Sl(n){if(!(Li in n))return false;let e=n[Li];return f(e)&&fa[e]===true}r(Sl,"supportsPosition");var Wi="top";function Fl(n){if(!(Wi in n))return false;let e=n[Wi];return f(e)||I(e)}r(Fl,"supportsPins");var Ri="width";function vl(n){if(!(Ri in n))return false;let e=n[Ri];return f(e)||I(e)}r(vl,"supportsSize");var Bi="maxWidth";function Dl(n){if(!(Bi in n))return false;let e=n[Bi];return f(e)||I(e)}r(Dl,"supportsSizeConstraints");var Ui="aspectRatio";function kl(n){if(!(Ui in n))return false;let e=n[Ui];return q(e)||I(e)}r(kl,"supportsAspectRatio");var Oi="name";function Nl(n){if(!(Oi in n))return false;let e=n[Oi];return f(e)||I(e)}r(Nl,"supportsName");var zi="visible";function Al(n){if(!(zi in n))return false;let e=n[zi];return Pe(e)}r(Al,"supportsVisible");var Gi="locked";function El(n){if(!(Gi in n))return false;let e=n[Gi];return Pe(e)}r(El,"supportsLocked");var Ki="backgroundColor";function Ml(n){if(!(Ki in n))return false;let e=n[Ki];return f(e)||ye(e)||I(e)}r(Ml,"supportsBackgroundColor");var $i="backgroundColor";function wl(n){if(!($i in n))return false;let e=n[$i];return f(e)||Mt(e)||I(e)}r(wl,"supportsBackgroundColorData");var ji="backgroundImage";function Vl(n){if(!(ji in n))return false;let e=n[ji];return e instanceof X||I(e)}r(Vl,"supportsBackgroundImage");var Hi="backgroundImage";function Ll(n){if(!(Hi in n))return false;let e=n[Hi];return e instanceof X?false:vi(e)||I(e)}r(Ll,"supportsBackgroundImageData");var _i="backgroundGradient";function Wl(n){if(!(_i in n))return false;let e=n[_i];return Ei(e)||I(e)}r(Wl,"supportsBackgroundGradient");var qi="backgroundGradient";function Rl(n){if(!(qi in n))return false;let e=n[qi];return k(e)||I(e)}r(Rl,"supportsBackgroundGradientData");var Yi="rotation";function Bl(n){if(!(Yi in n))return false;let e=n[Yi];return q(e)}r(Bl,"supportsRotation");var Xi="opacity";function Ul(n){if(!(Xi in n))return false;let e=n[Xi];return q(e)}r(Ul,"supportsOpacity");var Zi="borderRadius";function Ol(n){if(!(Zi in n))return false;let e=n[Zi];return f(e)||I(e)}r(Ol,"supportsBorderRadius");var Ji="border";function zl(n){if(!(Ji in n))return false;let e=n[Ji];return I(e)||ye(e.color)}r(zl,"supportsBorder");var Qi="svg";function Gl(n){if(!(Qi in n))return false;let e=n[Qi];return f(e)}r(Gl,"supportsSVG");var er="textTruncation";function Kl(n){if(!(er in n))return false;let e=n[er];return q(e)||I(e)}r(Kl,"supportsTextTruncation");var tr="zIndex";function $l(n){if(!(tr in n))return false;let e=n[tr];return q(e)||I(e)}r($l,"supportsZIndex");var nr="overflow";function jl(n){if(!(nr in n))return false;let e=n[nr];return f(e)||I(e)}r(jl,"supportsOverflow");var ir="componentIdentifier";function Hl(n){if(!(ir in n))return false;let e=n[ir];return f(e)}r(Hl,"supportsComponentInfo");var rr="font";function _l(n){if(!(rr in n))return false;let e=n[rr];return Ai(e)}r(_l,"supportsFont");var or="font";function ql(n){if(!(or in n))return false;let e=n[or];return Ni(e)||I(e)}r(ql,"supportsFontData");var ar="inlineTextStyle";function Yl(n){if(!(ar in n))return false;let e=n[ar];return Tn(e)||I(e)}r(Yl,"supportsInlineTextStyle");var sr="inlineTextStyle";function Xl(n){if(!(sr in n))return false;let e=n[sr];return Mi(e)||I(e)}r(Xl,"supportsInlineTextStyleData");var lr="link";function Zl(n){if(!(lr in n))return false;let e=n[lr];return f(e)||I(e)}r(Zl,"supportsLink");var dr="imageRendering";function Jl(n){if(!(dr in n))return false;let e=n[dr];return f(e)||I(e)}r(Jl,"supportsImageRendering");var ur="layout";function mr(n){if(!(ur in n))return false;let e=n[ur];return f(e)||I(e)}r(mr,"supportsLayout");function Ql(n){return mr(n)?n.layout==="stack":false}r(Ql,"hasStackLayout");function ed(n){return mr(n)?n.layout==="grid":false}r(ed,"hasGridLayout");var cr="isVariant";function gr(n){if(!(cr in n))return false;let e=n[cr];return Pe(e)}r(gr,"supportsComponentVariant");function Pn(n){return gr(n)?n.isVariant:false}r(Pn,"isComponentVariant");function fr(n){return !gr(n)||!Pn(n)?false:!I(n.gesture)}r(fr,"isComponentGestureVariant");var pr="isBreakpoint";function ya(n){if(!(pr in n))return false;let e=n[pr];return Pe(e)}r(ya,"supportsBreakpoint");function yr(n){return ya(n)?n.isBreakpoint:false}r(yr,"isBreakpoint");var W=class{static{r(this,"NodeMethods");}id;originalId;#e;constructor(e,t){this.id=e.id,this.originalId=e.originalId??null,this.#e=t;}get isReplica(){return this.originalId!==null}async remove(){return this.#e.invoke("removeNodes2",[this.id])}async select(){return this.#e.invoke("setSelection",[this.id])}async clone(){return this.#e.cloneNode(this.id)}async setAttributes(e){if(this[g]==="UnknownNode")throw Error("Can not set attributes on unknown node");return this.#e.setAttributes(this.id,e)}async getRect(){return this.#e.invoke("getRect",this.id)}async zoomIntoView(e){return this.#e.invoke("zoomIntoView",[this.id],e)}async navigateTo(e){return this.#e.invoke("navigateTo",this.id,e)}async getParent(){return this.#e.getParent(this.id)}async getChildren(){return re(this)?Promise.resolve([]):this.#e.getChildren(this.id)}async getNodesWithType(e){return re(this)?Promise.resolve([]):(await this.#e.invoke("getNodesWithType",this.id,e)).map(i=>C(i,this.#e))}async getNodesWithAttribute(e){return re(this)?Promise.resolve([]):(await this.#e.invoke("getNodesWithAttribute",this.id,e)).map(i=>C(i,this.#e))}async getNodesWithAttributeSet(e){return re(this)?Promise.resolve([]):(await this.#e.invoke("getNodesWithAttributeSet",this.id,e)).map(i=>C(i,this.#e))}async*walk(){if(yield this,!re(this))for(let e of await this.getChildren())yield*e.walk();}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async setPluginData(e,t){return this.#e.invoke("setPluginDataForNode",this.id,e,t)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}},U=class extends W{static{r(this,"FrameNode");}[g]="FrameNode";name;visible;locked;backgroundColor;backgroundImage;backgroundGradient;rotation;opacity;borderRadius;border;imageRendering;position;top;right;bottom;left;centerX;centerY;width;height;maxWidth;minWidth;maxHeight;minHeight;aspectRatio;zIndex;link;linkOpenInNewTab;linkSmoothScroll;linkClickTrackingId;linkRelValues;linkPreserveParams;overflow;overflowX;overflowY;layout;gap;padding;stackDirection;stackDistribution;stackAlignment;stackWrapEnabled;gridColumnCount;gridRowCount;gridAlignment;gridColumnWidthType;gridColumnWidth;gridColumnMinWidth;gridRowHeightType;gridRowHeight;gridItemFillCellWidth;gridItemFillCellHeight;gridItemHorizontalAlignment;gridItemVerticalAlignment;gridItemColumnSpan;gridItemRowSpan;isVariant;isPrimaryVariant;isBreakpoint;isPrimaryBreakpoint;inheritsFromId;gesture;constructor(e,t){super(e,t),this.name=e.name??null,this.visible=e.visible??true,this.locked=e.locked??false,this.backgroundColor=y(t,e.backgroundColor)??null,this.backgroundImage=y(t,e.backgroundImage)??null,this.rotation=e.rotation??0,this.opacity=e.opacity??1,this.borderRadius=e.borderRadius??null,this.border=y(t,e.border)??null,this.backgroundGradient=y(t,e.backgroundGradient)??null,this.imageRendering=e.imageRendering??null,this.position=e.position,this.left=e.left??null,this.right=e.right??null,this.top=e.top??null,this.bottom=e.bottom??null,this.centerX=e.centerX??null,this.centerY=e.centerY??null,this.width=e.width??null,this.height=e.height??null,this.maxWidth=e.maxWidth??null,this.minWidth=e.minWidth??null,this.maxHeight=e.maxHeight??null,this.minHeight=e.minHeight??null,this.aspectRatio=e.aspectRatio??null,this.zIndex=e.zIndex??null,this.link=e.link??null,this.linkOpenInNewTab=e.linkOpenInNewTab??null,this.linkSmoothScroll=e.linkSmoothScroll??null,this.linkClickTrackingId=e.linkClickTrackingId??null,this.linkRelValues=e.linkRelValues??null,this.linkPreserveParams=e.linkPreserveParams??null,this.overflow=e.overflow??null,this.overflowX=e.overflowX??null,this.overflowY=e.overflowY??null,this.layout=e.layout??null,this.gap=e.gap??null,this.padding=e.padding??null,this.stackDirection=e.stackDirection??null,this.stackDistribution=e.stackDistribution??null,this.stackAlignment=e.stackAlignment??null,this.stackWrapEnabled=e.stackWrapEnabled??null,this.gridColumnCount=e.gridColumnCount??null,this.gridRowCount=e.gridRowCount??null,this.gridAlignment=e.gridAlignment??null,this.gridColumnWidthType=e.gridColumnWidthType??null,this.gridColumnWidth=e.gridColumnWidth??null,this.gridColumnMinWidth=e.gridColumnMinWidth??null,this.gridRowHeightType=e.gridRowHeightType??null,this.gridRowHeight=e.gridRowHeight??null,this.gridItemFillCellWidth=e.gridItemFillCellWidth??null,this.gridItemFillCellHeight=e.gridItemFillCellHeight??null,this.gridItemHorizontalAlignment=e.gridItemHorizontalAlignment??null,this.gridItemVerticalAlignment=e.gridItemVerticalAlignment??null,this.gridItemColumnSpan=e.gridItemColumnSpan??null,this.gridItemRowSpan=e.gridItemRowSpan??null,this.inheritsFromId=e.inheritsFromId??null,this.gesture=e.gesture??null,this.isVariant=e.isVariant??false,this.isPrimaryVariant=e.isPrimaryVariant??false,this.isBreakpoint=e.isBreakpoint??false,this.isPrimaryBreakpoint=e.isPrimaryBreakpoint??false,S(this);}},oe=class extends W{static{r(this,"TextNode");}[g]="TextNode";name;visible;locked;rotation;opacity;zIndex;font;inlineTextStyle;position;top;right;bottom;left;centerX;centerY;width;height;maxWidth;minWidth;maxHeight;minHeight;link;linkOpenInNewTab;linkSmoothScroll;linkClickTrackingId;linkRelValues;linkPreserveParams;gridItemFillCellWidth;gridItemFillCellHeight;gridItemHorizontalAlignment;gridItemVerticalAlignment;gridItemColumnSpan;gridItemRowSpan;overflow;overflowX;overflowY;textTruncation;#e;constructor(e,t){super(e,t),this.#e=t,this.name=e.name??null,this.visible=e.visible??true,this.locked=e.locked??false,this.rotation=e.rotation??0,this.opacity=e.opacity??1,this.zIndex=e.zIndex??null,this.font=y(t,e.font)??null,this.inlineTextStyle=y(t,e.inlineTextStyle)??null,this.position=e.position,this.left=e.left??null,this.right=e.right??null,this.top=e.top??null,this.bottom=e.bottom??null,this.centerX=e.centerX??null,this.centerY=e.centerY??null,this.width=e.width??null,this.height=e.height??null,this.maxWidth=e.maxWidth??null,this.minWidth=e.minWidth??null,this.maxHeight=e.maxHeight??null,this.minHeight=e.minHeight??null,this.link=e.link??null,this.linkOpenInNewTab=e.linkOpenInNewTab??null,this.linkSmoothScroll=e.linkSmoothScroll??null,this.linkClickTrackingId=e.linkClickTrackingId??null,this.linkRelValues=e.linkRelValues??null,this.linkPreserveParams=e.linkPreserveParams??null,this.overflow=e.overflow??null,this.overflowX=e.overflowX??null,this.overflowY=e.overflowY??null,this.textTruncation=e.textTruncation??null,this.gridItemFillCellWidth=e.gridItemFillCellWidth??null,this.gridItemFillCellHeight=e.gridItemFillCellHeight??null,this.gridItemHorizontalAlignment=e.gridItemHorizontalAlignment??null,this.gridItemVerticalAlignment=e.gridItemVerticalAlignment??null,this.gridItemColumnSpan=e.gridItemColumnSpan??null,this.gridItemRowSpan=e.gridItemRowSpan??null,S(this);}async setText(e){await this.#e.invoke("setTextForNode",this.id,e);}async getText(){return this.#e.invoke("getTextForNode",this.id)}async setHTML(e){await this.#e.invoke(ge,this.id,e),await new Promise(t=>{setTimeout(t,30);});}async getHTML(){return this.#e.invoke(me,this.id)}},qe=class extends W{static{r(this,"SVGNode");}[g]="SVGNode";name;visible;locked;svg;rotation;opacity;position;top;right;bottom;left;centerX;centerY;width;height;constructor(e,t){super(e,t),this.name=e.name??null,this.visible=e.visible??true,this.locked=e.locked??false,this.svg=e.svg,this.rotation=e.rotation??0,this.opacity=e.opacity??1,this.position=e.position,this.left=e.left??null,this.right=e.right??null,this.top=e.top??null,this.bottom=e.bottom??null,this.centerX=e.centerX??null,this.centerY=e.centerY??null,this.width=e.width??null,this.height=e.height??null,S(this);}},Ye=class extends W{static{r(this,"VectorSetItemNode");}[g]="VectorSetItemNode";name;visible;locked;top;right;bottom;left;centerX;centerY;width;height;#e;constructor(e,t){super(e,t),this.#e=t,this.name=e.name??null,this.visible=e.visible??true,this.locked=e.locked??false,this.top=e.top??null,this.right=e.right??null,this.bottom=e.bottom??null,this.left=e.left??null,this.centerX=e.centerX??null,this.centerY=e.centerY??null,this.width=e.width??null,this.height=e.height??null,S(this);}async getSVG(){return this.#e.invoke("getSVGForNode",this.id)}},Xe=class extends W{static{r(this,"ComponentInstanceNode");}[g]="ComponentInstanceNode";name;visible;locked;componentIdentifier;insertURL;componentName;controls;rotation;opacity;position;top;right;bottom;left;centerX;centerY;width;height;maxWidth;minWidth;maxHeight;minHeight;aspectRatio;#e;#t;#n;get typedControls(){return this.#n||(this.#n=y(this.#e,this.#t.typedControls)??{}),this.#n}constructor(e,t){super(e,t),this.#e=t,this.#t=e,this.name=e.name??null,this.visible=e.visible??true,this.locked=e.locked??false,this.componentIdentifier=e.componentIdentifier,this.componentName=e.componentName??null,this.insertURL=e.insertURL??null,this.controls=y(t,e.controls)??{},this.rotation=e.rotation??0,this.opacity=e.opacity??1,this.position=e.position,this.left=e.left??null,this.right=e.right??null,this.top=e.top??null,this.bottom=e.bottom??null,this.centerX=e.centerX??null,this.centerY=e.centerY??null,this.width=e.width??null,this.height=e.height??null,this.maxWidth=e.maxWidth??null,this.minWidth=e.minWidth??null,this.maxHeight=e.maxHeight??null,this.minHeight=e.minHeight??null,this.aspectRatio=e.aspectRatio??null,S(this);}async getRuntimeError(){return this.#e.invoke("getRuntimeErrorForCodeComponentNode",this.id)}},K=class extends W{static{r(this,"WebPageNode");}[g]="WebPageNode";#e;path;collectionId;constructor(e,t){super(e,t),this.path=e.path??null,this.collectionId=e.collectionId??null,this.#e=t,S(this);}async clone(e){return this.#e.cloneWebPage(this.id,e)}getBreakpointSuggestions(){return this.#e.invoke("getBreakpointSuggestionsForWebPage",this.id)}async addBreakpoint(e,t){let i=await this.#e.invoke("addBreakpointToWebPage",this.id,e,t),o=C(i,this.#e);return c(o instanceof U),c(yr(o),"Expected node to be a FrameNode"),o}async getActiveCollectionItem(){let e=await this.#e.invoke("getActiveCollectionItemForWebPage",this.id);return e?new _e(e,this.#e):null}},ae=class extends W{static{r(this,"ComponentNode");}[g]="ComponentNode";name;componentIdentifier;insertURL;componentName;#e;constructor(e,t){super(e,t),this.#e=t,this.componentIdentifier=e.componentIdentifier,this.insertURL=e.insertURL??null,this.componentName=e.componentName??null,this.name=e.name??null,S(this);}async addVariant(e,t){let i=await this.#e.invoke("addVariantToComponent",this.id,e,t);if(!i)throw new Error("Failed to add variant to component");let o=C(i,this.#e);return c(o instanceof U),c(Pn(o),"Node is not a component variant"),o}async addGestureVariant(e,t,i){let o=await this.#e.invoke("addGestureVariantToComponent",this.id,e,t,i);if(!o)throw new Error("Failed to add state to component");let a=C(o,this.#e);return c(a instanceof U),c(fr(a),"Node is not a gesture variant"),a}async getVariables(){let e=await this.#e.invoke("getVariables",this.id);return y(this.#e,e)}async addVariables(e){let t=await this.#e.invoke("addVariables",this.id,L(e));return y(this.#e,t)}async removeVariables(e){await this.#e.invoke("removeVariables",this.id,e);}async setVariableOrder(e){await this.#e.invoke("setVariableOrder",this.id,e);}},Ze=class extends W{static{r(this,"VectorSetNode");}[g]="VectorSetNode";name;constructor(e,t){super(e,t),this.name=e.name??null,S(this);}},$=class extends W{static{r(this,"DesignPageNode");}[g]="DesignPageNode";name;#e;constructor(e,t){super(e,t),this.#e=t,this.name=e.name??null,S(this);}async clone(e){return this.#e.cloneDesignPage(this.id,e)}},Je=class extends W{static{r(this,"UnknownNode");}[g]="UnknownNode";constructor(e,t){super(e,t),S(this);}async clone(){throw new Error("Cannot clone an unknown node")}};function C(n,e){switch(n[g]){case "DesignPageNode":return new $(n,e);case "WebPageNode":return new K(n,e);case "ComponentNode":return new ae(n,e);case "VectorSetNode":return new Ze(n,e);case "VectorSetItemNode":return new Ye(n,e);case "ComponentInstanceNode":return new Xe(n,e);case "FrameNode":return new U(n,e);case "SVGNode":return new qe(n,e);case "TextNode":return new oe(n,e);case "UnknownNode":return new Je(n,e);default:return new Je(n,e)}}r(C,"convertRawNodeDataToNode");function wt(n){return n instanceof U}r(wt,"isFrameNode");function hr(n){return n instanceof oe}r(hr,"isTextNode");function br(n){return n instanceof qe}r(br,"isSVGNode");function be(n){return n instanceof Xe}r(be,"isComponentInstanceNode");function xr(n){return n instanceof K}r(xr,"isWebPageNode");function Cr(n){return n instanceof ae}r(Cr,"isComponentNode");function Ir(n){return n instanceof $}r(Ir,"isDesignPageNode");function Tr(n){return n instanceof Ze}r(Tr,"isVectorSetNode");function Pr(n){return n instanceof Ye}r(Pr,"isVectorSetItemNode");function re(n){return n instanceof Je}r(re,"isUnknownNode");function Qe(n){return !!(wt(n)||hr(n)||be(n)||br(n)||Pr(n)||re(n))}r(Qe,"isCanvasNode");function Sn(n){return !!(xr(n)||Ir(n)||Cr(n)||Tr(n)||re(n))}r(Sn,"isCanvasRootNode");var et=class{static{r(this,"VectorSet");}id;name;owner;#e;constructor(e,t){this.id=e.id,this.name=e.name,this.owner=e.owner,this.#e=t;}async getItems(){return (await this.#e.invoke("getVectorSetItems",this.id)).map(t=>new Vt(t,this.#e))}},Vt=class{static{r(this,"VectorSetItem");}id;name;insertUrl;iconUrl;#e;#t;constructor(e,t){this.id=e.id,this.name=e.name,this.insertUrl=e.insertUrl,this.iconUrl=e.iconUrl,this.#e=e.moduleId,this.#t=t;}async getVariables(){return this.#t.invoke("getVectorSetItemVariables",this.id,this.#e)}};var tt=class extends Error{static{r(this,"FramerPluginError");}name=this.constructor.name},J=class extends Error{static{r(this,"FramerPluginClosedError");}name=this.constructor.name};function ha(n){return n.type==="separator"}r(ha,"isSeparatorMenuItem");function Lt(n,e){let t=[];for(let i of n){if(ha(i)){t.push(i);continue}let{onAction:o,...a}=i,s=a;if(i.onAction){let d=Math.random();e.set(d,i.onAction),s.actionId=d;}i.submenu&&(s.submenu=Lt(i.submenu,e)),t.push(s);}return t}r(Lt,"addMenuItemsToOnActionCallbackMap");var Wt="type",Sr={[Wt]:"pluginReadySignal"},xa="pluginReadyResponse";var Ca={methodResponse:true,subscriptionMessage:true,permissionUpdate:true,menuAction:true};function Fr(n){return k(n)&&f(n[Wt])&&n[Wt]in Ca}r(Fr,"isVekterToPluginNonHandshakeMessage");function vr(n){return k(n)&&n[Wt]===xa}r(vr,"isPluginReadyResponse");var Fn=Symbol(),vn=Symbol(),Dn=Symbol(),kn=Symbol(),Nn=Symbol(),An=Symbol(),En=Symbol(),Mn=Symbol(),wn=Symbol(),Vn=Symbol(),Ln=Symbol(),Wn=Symbol(),Rn=Symbol(),Bn=Symbol(),Un=Symbol(),On=Symbol(),zn=Symbol(),Gn=Symbol(),Kn=Symbol(),$n=Symbol(),jn=Symbol(),Hn=Symbol(),_n=Symbol(),qn=Symbol(),Yn=Symbol(),Xn=Symbol(),Zn=Symbol(),x={publish:Fn,getDeployments:vn,deploy:Dn,getChangedPaths:kn,getChangeContributors:Nn,createManagedCollection:An,rejectAllPending:En,readProjectForAgent:Mn,getAgentSystemPrompt:wn,getAgentContext:Vn,applyAgentChanges:Ln,flattenComponentInstanceForAgent:Wn,getAncestorsForAgent:Rn,getGroundNodeForAgent:Bn,getNodeForAgent:Un,getNodesForAgent:On,getNodesOfTypesForAgent:zn,getParentNodeForAgent:Gn,getScopeNodeForAgent:Kn,makeExternalComponentLocalForAgent:$n,publishForAgent:jn,queryImagesForAgent:Hn,reviewChangesForAgent:_n,startAgentConversation:qn,continueAgentConversation:Yn,submitAgentClarification:Xn,runSupervisorAgentCommand:Zn};function Jn(n){return typeof n=="string"&&n in x}r(Jn,"isFramerApiOnlyMethod");var Ia=["unstable_getCodeFile","unstable_getCodeFiles","unstable_getCodeFileVersionContent","unstable_getCodeFileLint2","unstable_getCodeFileTypecheck2","unstable_getCodeFileVersions","lintCode"],Ta=["closeNotification","closePlugin","setCloseWarning","getActiveCollection","getActiveLocale","getActiveManagedCollection","getCanvasRoot","getChildren","getCollection","getCollectionFields","getCollectionFields2","getCollectionItems","getCollectionItems2","getCollections","getColorStyle","getColorStyles","getCurrentUser","getCurrentUser2","getCustomCode","getDefaultLocale","getFont","getFonts","getImage","getImageData","getLocales","getLocaleLanguages","getLocaleRegions","getLocalizationGroups","getManagedCollection","getManagedCollectionFields","getManagedCollectionFields2","getManagedCollectionItemIds","getManagedCollections","getNode","getNodesWithAttribute","getNodesWithAttributeSet","getNodesWithType","getParent","getPluginData","getPluginDataForNode","getPluginDataKeys","getPluginDataKeysForNode","getProjectInfo","getProjectInfo2","getPublishInfo","getRect","getSelection","getSVGForNode","getText","getTextForNode","getTextStyle","getTextStyles","hideUI","setBackgroundMessage","notify","onPointerDown","setActiveCollection","setSelection","showUI","getCodeFileVersionContent","typecheckCode","getCodeFileVersions","getCodeFiles","getCodeFile","getRedirects","uploadFile","uploadFiles","uploadImage","uploadImages","zoomIntoView","navigateTo","getRuntimeErrorForModule","getRuntimeErrorForCodeComponentNode","showProgressOnInstances","removeProgressFromInstances","addComponentInstancePlaceholder","updateComponentInstancePlaceholder","removeComponentInstancePlaceholder","setMenu","showContextMenu","getBreakpointSuggestionsForWebPage","getActiveCollectionItemForWebPage","getVariables","getVectorSets","getVectorSetItems","getVectorSetItemVariables","getChangedPaths","getChangeContributors","getDeployments","readProjectForAgent","getAgentSystemPrompt","getAgentContext","queryImagesForAgent","reviewChangesForAgent","getNodeForAgent","getNodesForAgent","getNodesOfTypesForAgent","getScopeNodeForAgent","getGroundNodeForAgent","getParentNodeForAgent","getAncestorsForAgent",gt,ft,yt,ht,me,"getAiServiceInfo","sendTrackingEvent",...Ia];new Set(Ta);var Qn={addComponentInstance:["addComponentInstance"],addComponentInstancePlaceholder:[],addDetachedComponentLayers:["addDetachedComponentLayers"],addImage:["addImage"],addImages:["addImages"],addSVG:["addSVG"],addText:["addText"],addRedirects:["addRedirects"],getRedirects:[],removeRedirects:["removeRedirects"],setRedirectOrder:["setRedirectOrder"],subscribeToRedirects:[],cloneNode:["cloneNode"],closePlugin:[],createColorStyle:["createColorStyle"],createFrameNode:["createNode"],createTextNode:["createNode"],createComponentNode:["createNode"],createTextStyle:["createTextStyle"],createDesignPage:["createDesignPage"],createWebPage:["createWebPage"],getActiveCollection:[],getActiveLocale:[],getActiveManagedCollection:[],getCanvasRoot:[],getChildren:[],getCollection:[],getCollections:[],getColorStyle:[],getColorStyles:[],getCurrentUser:[],getCustomCode:[],getDefaultLocale:[],getFont:[],getFonts:[],getImage:[],getLocales:[],getLocalizationGroups:[],getManagedCollection:[],getManagedCollections:[],getNode:[],getNodesWithAttribute:[],getNodesWithAttributeSet:[],getNodesWithType:[],getParent:[],getPluginData:[],getPluginDataKeys:[],getProjectInfo:[],getPublishInfo:[],getRect:[],getSelection:[],getText:[],getTextStyle:[],getTextStyles:[],hideUI:[],setBackgroundMessage:[],setCloseWarning:[],lintCode:[],makeDraggable:["onDragEnd","onDragStart","onDrag","setDragData","preloadDetachedComponentLayers","preloadImageUrlForInsertion","preloadDragPreviewImage"],notify:[],preloadDetachedComponentLayers:["preloadDetachedComponentLayers"],preloadDragPreviewImage:["preloadDragPreviewImage"],preloadImageUrlForInsertion:["preloadImageUrlForInsertion"],removeNode:["removeNodes2"],removeNodes:["removeNodes2"],setAttributes:["setAttributes"],setCustomCode:["setCustomCode"],setImage:["setImage"],setLocalizationData:["setLocalizationData"],createLocale:["createLocale"],getLocaleLanguages:[],getLocaleRegions:[],setMenu:[],showContextMenu:[],setParent:["setParent"],setPluginData:["setPluginData"],setSelection:[],setText:["setText"],typecheckCode:[],showUI:[],subscribeToCanvasRoot:[],subscribeToColorStyles:[],subscribeToCustomCode:[],subscribeToImage:[],subscribeToPublishInfo:[],subscribeToSelection:[],subscribeToText:[],subscribeToTextStyles:[],createCodeFile:["createCodeFile"],unstable_ensureMinimumDependencyVersion:["unstable_ensureMinimumDependencyVersion"],getCodeFiles:[],getCodeFile:[],subscribeToCodeFiles:[],subscribeToOpenCodeFile:[],uploadFile:[],uploadFiles:[],uploadImage:[],uploadImages:[],zoomIntoView:[],navigateTo:[],getVectorSets:[],"VectorSet.getItems":[],"VectorSetItem.getVariables":[],"Node.navigateTo":[],"CodeFile.navigateTo":[],"Collection.navigateTo":[],"ManagedCollection.navigateTo":[],"CollectionItem.navigateTo":[],"ComponentInstanceNode.getRuntimeError":[],"ImageAsset.cloneWithAttributes":[],"ImageAsset.getData":[],"ImageAsset.loadBitmap":[],"ImageAsset.loadImage":[],"ImageAsset.measure":[],"CodeFile.remove":["removeCodeFile"],"CodeFile.rename":["renameCodeFile"],"CodeFile.setFileContent":["setCodeFileContent"],"CodeFile.getVersions":[],"CodeFile.showProgressOnInstances":[],"CodeFile.removeProgressFromInstances":[],"CodeFile.lint":[],"CodeFile.typecheck":[],"CodeFileVersion.getContent":[],"ComponentInstancePlaceholder.setAttributes":[],"ComponentInstancePlaceholder.remove":[],"ComponentInstancePlaceholder.replaceWithComponentInstance":["replaceComponentInstancePlaceholderWithComponentInstance"],"Field.remove":["removeCollectionFields"],"Field.setAttributes":["addCollectionFields2"],"EnumField.addCase":["addEnumCase"],"EnumField.setCaseOrder":["setEnumCaseOrder"],"Collection.addFields":["addCollectionFields2"],"Collection.addItems":["addCollectionItems2"],"Collection.getFields":[],"Collection.getItems":[],"Collection.getPluginData":[],"Collection.getPluginDataKeys":[],"Collection.removeFields":["removeCollectionFields"],"Collection.removeItems":["removeCollectionItems"],"Collection.setAsActive":[],"Collection.setFieldOrder":["setCollectionFieldOrder"],"Collection.setItemOrder":["setCollectionItemOrder"],"Collection.setPluginData":["setPluginDataForNode"],"CollectionItem.getPluginData":[],"CollectionItem.getPluginDataKeys":[],"CollectionItem.remove":["removeCollectionItems"],"CollectionItem.setAttributes":["setCollectionItemAttributes2"],"CollectionItem.setPluginData":["setPluginDataForNode"],"ManagedCollection.addItems":["addManagedCollectionItems2"],"ManagedCollection.getFields":[],"ManagedCollection.getItemIds":[],"ManagedCollection.getPluginData":[],"ManagedCollection.getPluginDataKeys":[],"ManagedCollection.removeItems":["removeManagedCollectionItems"],"ManagedCollection.setAsActive":[],"ManagedCollection.setFields":["setManagedCollectionFields"],"ManagedCollection.setItemOrder":["setManagedCollectionItemOrder"],"ManagedCollection.setPluginData":["setPluginDataForNode"],"Node.clone":["cloneNode","cloneWebPage","cloneDesignPage"],"WebPageNode.clone":["cloneWebPage"],"DesignPageNode.clone":["cloneDesignPage"],"Node.getChildren":[],"Node.getNodesWithAttribute":[],"Node.getNodesWithAttributeSet":[],"Node.getNodesWithType":[],"Node.getParent":[],"Node.getPluginData":[],"Node.getPluginDataKeys":[],"Node.getRect":[],"Node.remove":["removeNodes2"],"Node.select":[],"Node.setAttributes":["setAttributes"],"Node.setPluginData":["setPluginDataForNode"],"Node.walk":[],"Node.zoomIntoView":[],"TextNode.getText":[],"TextNode.setText":["setTextForNode"],"TextNode.setHTML":[ge],"TextNode.getHTML":[],"ComponentNode.addVariant":["addVariantToComponent"],"ComponentNode.addGestureVariant":["addGestureVariantToComponent"],"ComponentNode.getVariables":[],"ComponentNode.addVariables":["addVariables"],"ComponentNode.removeVariables":["removeVariables"],"WebPageNode.getBreakpointSuggestions":[],"WebPageNode.addBreakpoint":["addBreakpointToWebPage"],"WebPageNode.getActiveCollectionItem":[],"ColorStyle.getPluginData":[],"ColorStyle.getPluginDataKeys":[],"ColorStyle.remove":["removeColorStyle"],"ColorStyle.setAttributes":["setColorStyleAttributes"],"ColorStyle.setPluginData":["setPluginDataForNode"],"TextStyle.getPluginData":[],"TextStyle.getPluginDataKeys":[],"TextStyle.remove":["removeTextStyle"],"TextStyle.setAttributes":["setTextStyleAttributes"],"TextStyle.setPluginData":["setPluginDataForNode"],"Variable.setAttributes":["updateVariable"],"Variable.remove":["removeVariables"],"ComponentNode.setVariableOrder":["setVariableOrder"],"EnumCase.remove":["removeEnumCase"],"EnumCase.setAttributes":["updateEnumCase"],"EnumVariable.addCase":["addEnumCase"],"EnumVariable.setCaseOrder":["setEnumCaseOrder"],createCollection:["createCollection"],createManagedCollection:["createManagedCollection"],[qt]:[],[Yt]:[],[Xt]:[],[Zt]:[],[Jt]:[],[Qt]:[],[Fn]:["publish"],[vn]:[],[Dn]:["deploy"],[kn]:[],[Nn]:[],[An]:["createManagedCollection"],[En]:[],[Mn]:[],[wn]:[],[Vn]:[],[Ln]:["applyAgentChanges"],[Wn]:["flattenComponentInstanceForAgent"],[Rn]:[],[Bn]:[],[Un]:[],[On]:[],[zn]:[],[Gn]:[],[Kn]:[],[$n]:["makeExternalComponentLocalForAgent"],[jn]:["publishForAgent"],[Hn]:[],[_n]:[],[qn]:["startAgentConversation"],[Yn]:["continueAgentConversation"],[Xn]:["submitAgentClarification"],[Zn]:["runSupervisorAgentCommand"]},Rt=[];for(let n of Object.keys(Qn))Qn[n].length!==0&&Rt.push(n);S(Rt);function ei(n){let e={};for(let t of Rt){let i=Qn[t];e[t]=i.every(o=>n[o]);}return e}r(ei,"createPerMethodPermissionMap");function Dr(){let n={};for(let e of Rt)n[e]=true;return n}r(Dr,"createPerMethodPermissionMapForTesting");var xe=null;function kr(n){if(typeof window>"u")return;if(!xe){let t=document.createElement("style");document.head.appendChild(t),xe=t.sheet;}if(!xe){n();return}let e=xe.insertRule("* { transition: none !important; animation: none !important; }");n(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{xe&&xe.deleteRule(e);});});}r(kr,"withDisabledCssTransitions");var nt=class{static{r(this,"PluginEngine");}methodInvocationId=0;notificationId=0;postMessage;methodResponseHandlers=new Map;mode;subscriptions=new Map;perMethodPermissionMap;permissionSubscriptions=new Set;messageTypesCheckedInIsAllowedTo=new Set;showUncheckedPermissionToasts=true;environmentInfo=null;initialState;menuItemOnActionCallbackMap=new Map;contextMenuItemOnActionCallbackMap=new Map;rejectAllPending(e){for(let[t,i]of this.methodResponseHandlers)i.reject(e),this.methodResponseHandlers.delete(t);}constructor(e){if(!e){this.postMessage=()=>{},this.mode="canvas",this.perMethodPermissionMap=Dr(),this.initialState={mode:"canvas",intent:"plugin/open"};return}switch(e.transport.onMessage(this.onMessage),typeof window<"u"&&(window.addEventListener("error",t=>{t.error instanceof J&&(t.preventDefault(),t.stopImmediatePropagation());}),window.addEventListener("unhandledrejection",t=>{t.reason instanceof J&&(t.preventDefault(),t.stopImmediatePropagation());})),this.mode=e.mode,this.initialState=e.initialState??{mode:e.mode,intent:"plugin/open"},this.environmentInfo=e.environmentInfo,this.perMethodPermissionMap=ei(e.permissionMap),this.postMessage=(t,i)=>e.transport.send(t,i),this.mode){case "canvas":case "image":case "editImage":case "configureManagedCollection":case "syncManagedCollection":case "collection":case "localization":case "code":typeof window<"u"&&window.addEventListener("pointerdown",()=>{this.invoke("onPointerDown");}),e.theme&&this.applyPluginTheme(e.theme),this.subscribe("theme",this.applyPluginTheme),this.applyPrereleaseStyles();break;case "api":break;default:Fe(this.mode);}}async invoke(e,...t){return this.invokeTransferable(e,void 0,...t)}async invokeTransferable(e,t,...i){return new Promise((a,s)=>{let d={type:"methodInvocation",methodName:e,id:this.methodInvocationId,args:i.map(L)};this.methodInvocationId+=1,this.methodResponseHandlers.set(d.id,{resolve:a,reject:s}),this.postMessage(d,t);})}subscribe(e,t){this.postMessage({type:"subscribe",topic:e});let i=this.subscriptions.get(e)??new Set;return i.add(t),this.subscriptions.set(e,i),()=>{let o=this.subscriptions.get(e)??new Set;o.delete(t),o.size===0&&this.postMessage({type:"unsubscribe",topic:e}),this.subscriptions.set(e,o);}}onMessage=r(e=>{let t=e?.data??e;if(Fr(t))switch(t.type){case "permissionUpdate":{this.perMethodPermissionMap=ei(t.permissionMap);for(let i of this.permissionSubscriptions)i();break}case "methodResponse":{let i=this.methodResponseHandlers.get(t.id);if(!i){switch(this.mode){case "canvas":case "image":case "editImage":case "configureManagedCollection":case "syncManagedCollection":case "collection":case "localization":case "code":throw new Error(`No handler for response with id ${t.id}`);case "api":{if(!(t.id<this.methodInvocationId))throw new Error(`No handler for unknown response id ${t.id}`);break}default:Fe(this.mode);}break}this.methodResponseHandlers.delete(t.id),f(t.error)?i.reject(new tt(t.error)):i.resolve(t.result);break}case "subscriptionMessage":{let{topic:i,payload:o}=t,a=this.subscriptions.get(i);if(!a)throw new Error("Received a subscription message but no handler present");for(let s of a)s(o);break}case "menuAction":{let i=this.getOnActionFromCallbackMap(t.actionId,t.actionType);if(!i)throw new Error("Menu action received for an unknown menu item");i();break}default:Fe(t);}},"onMessage");getOnActionFromCallbackMap(e,t){switch(t){case "pluginMenu":return this.menuItemOnActionCallbackMap.get(e);case "contextMenu":return this.contextMenuItemOnActionCallbackMap.get(e);default:Fe(t);}}applyPluginTheme=r(e=>{kr(()=>{document.body.setAttribute("data-framer-theme",e.mode);for(let t in e.tokens)document.body.style.setProperty(t,e.tokens[t]);});},"applyPluginTheme");applyPrereleaseStyles(){typeof window>"u"||new URLSearchParams(window.location.search).get("styles")==="prerelease"&&document.body.setAttribute("data-framer-styles","prerelease");}async cloneNode(e){let t=await this.invoke("cloneNode",e);return t?C(t,this):null}async cloneWebPage(e,t){let i=await this.invoke("cloneWebPage",e,t);c(i,"Expected to receive data for cloned web page");let o=C(i,this);return c(o instanceof K,"Expected cloned node to be an instance of WebPageNode"),o}async cloneDesignPage(e,t){let i=await this.invoke("cloneDesignPage",e,t);c(i,"Expected to receive data for cloned design page");let o=C(i,this);return c(o instanceof $,"Expected cloned node to be an instance of DesignPageNode"),o}async setAttributes(e,t){let i=await this.invoke("setAttributes",e,t);return i?C(i,this):null}async getParent(e){let t=await this.invoke("getParent",e);return t?C(t,this):null}async getChildren(e){return (await this.invoke("getChildren",e)).map(i=>{let o=C(i,this);return c(Qe(o)),o})}notify=r((e,t)=>{let i=`notification-${this.notificationId}`;return this.notificationId+=1,this.invoke("notify",e,{notificationId:i,variant:t?.variant??"info",buttonText:t?.button?.text,durationMs:t?.durationMs}).then(o=>{o==="actionButtonClicked"&&t?.button?.onClick&&t.button.onClick(),t?.onDisappear&&t.onDisappear();}),{close:r(()=>this.invoke("closeNotification",i),"close")}},"notify");async setMenu(e){this.menuItemOnActionCallbackMap=new Map;let t=Lt(e,this.menuItemOnActionCallbackMap);await this.invoke("setMenu",t);}async showContextMenu(e,t){this.contextMenuItemOnActionCallbackMap=new Map;let i=Lt(e,this.contextMenuItemOnActionCallbackMap);await this.invoke("showContextMenu",i,t);}};function Pa(n){return n.type==="component"}r(Pa,"isCodeFileComponentExport");function Sa(n){return n.type==="override"}r(Sa,"isCodeFileOverrideExport");var ti=class{static{r(this,"CodeFileVersion");}#e;#t;get id(){return this.#e.id}get name(){return this.#e.name}get createdAt(){return this.#e.createdAt}get createdBy(){return this.#e.createdBy}constructor(e,t){this.#t=t,this.#e=e;}async getContent(){return await this.#t.invoke("getCodeFileVersionContent",this.#e.fileId,this.#e.id)}},Q=class n{static{r(this,"CodeFile");}#e;#t;get id(){return this.#e.id}get name(){return this.#e.name}get path(){return this.#e.path}get content(){return this.#e.content}get exports(){return this.#e.exports}get versionId(){return this.#e.versionId}constructor(e,t){this.#t=t,this.#e=e;}async setFileContent(e){let t=await this.#t.invoke("setCodeFileContent",this.id,e);return new n(t,this.#t)}async rename(e){let t=await this.#t.invoke("renameCodeFile",this.id,e);return new n(t,this.#t)}async remove(){return this.#t.invoke("removeCodeFile",this.id)}async getVersions(){return (await this.#t.invoke("getCodeFileVersions",this.id)).map(t=>new ti(t,this.#t))}async showProgressOnInstances(e){return this.#t.invoke("showProgressOnInstances",this.id,e)}async removeProgressFromInstances(){return this.#t.invoke("removeProgressFromInstances",this.id)}async lint(e){return Promise.resolve([])}async typecheck(e){return await this.#t.invoke("typecheckCode",this.name,this.content,e,this.id)}async navigateTo(){return this.#t.invoke("navigateTo",this.id)}};var Bt=class n{static{r(this,"ComponentInstancePlaceholder");}#e;#t;constructor(e,t){this.#e=e,this.#t=t;}get id(){return this.#e.id}get width(){return this.#e.width}get height(){return this.#e.height}get title(){return this.#e.title}get codePreview(){return this.#e.codePreview}async setAttributes(e){let t=await this.#t.invoke("updateComponentInstancePlaceholder",this.id,e);return t?new n(t,this.#t):null}async remove(){await this.#t.invoke("removeComponentInstancePlaceholder",this.id);}async replaceWithComponentInstance(e,t){let i=await this.#t.invoke("replaceComponentInstancePlaceholderWithComponentInstance",this.id,e,t);if(!i)return null;let o=C(i,this.#t);return c(be(o)),o}};var Fa=(()=>{let n=null;return {disableUntilMouseUp:r(()=>{if(n)return;n=document.createElement("style"),n.textContent="* { pointer-events: none !important; user-select: none !important; -webkit-user-select: none !important; }",document.head.appendChild(n);let e=r(()=>{n&&(document.head.removeChild(n),n=null,o());},"enablePointerEvents"),t=r(a=>{a.buttons>0&&a.buttons&1||e();},"handlePointerChange"),i=r(()=>{e();},"handleBlur");window.addEventListener("pointerup",t,true),window.addEventListener("pointermove",t,true),window.addEventListener("blur",i);function o(){window.removeEventListener("pointerup",t,true),window.removeEventListener("pointermove",t,true),window.removeEventListener("blur",i);}r(o,"cleanup");},"disableUntilMouseUp")}})(),Nr=5,va=(()=>{let n=1;return {next:r(()=>`drag-${n++}`,"next")}})();function Da(){}r(Da,"noop");function Ar(n,e,t,i){if(n.mode!=="canvas")return Da;let o=va.next(),a=document.body.style.cursor,s={type:"idle"},d=document.body,u=se.subscribeToIsAllowedTo("makeDraggable",m=>{m||P();}),T=r(m=>{se.isAllowedTo("makeDraggable")&&s.type!=="idle"&&(s.type==="dragging"&&n.invoke("onDragEnd",{...m,dragSessionId:o}).then(h=>{try{i?.(h);}catch{}}).catch(h=>{if(h instanceof Error){i?.({status:"error",reason:h.message});return}if(typeof h=="string"){i?.({status:"error",reason:h});return}i?.({status:"error"});}),P());},"endDrag"),F=r(m=>{if(!se.isAllowedTo("makeDraggable")||s.type==="idle")return;if(!(m.buttons>0&&!!(m.buttons&1))){T({cancelled:false});return}let{clientX:M,clientY:z}=m;if(s.type==="pointerDown"){let A=M-s.dragStart.mouse.x,ct=z-s.dragStart.mouse.y;if(Math.abs(A)<Nr&&Math.abs(ct)<Nr)return;s={type:"dragging",dragStart:s.dragStart},n.invoke("onDragStart",s.dragStart),document.getSelection()?.empty(),Fa.disableUntilMouseUp();}d.setPointerCapture(m.pointerId);let te={x:M,y:z};n.invoke("onDrag",{dragSessionId:o,mouse:te}).then(A=>{s.type==="dragging"&&(document.body.style.cursor=A??"");});},"handlePointerChange"),O=r(m=>{m.key==="Escape"&&T({cancelled:true});},"handleKeyDown"),_=r(()=>{T({cancelled:true});},"handleBlur"),b=r(m=>{if(!se.isAllowedTo("makeDraggable"))return;T({cancelled:true});let h=e.getBoundingClientRect(),M={x:h.x,y:h.y,width:h.width,height:h.height},z,te=e.querySelectorAll("svg");if(te.length===1){let ce=te.item(0).getBoundingClientRect();z={x:ce.x,y:ce.y,width:ce.width,height:ce.height};}let A={x:m.clientX,y:m.clientY};s={type:"pointerDown",dragStart:{dragSessionId:o,elementRect:M,svgRect:z,mouse:A}},n.invoke("setDragData",o,t()),d.addEventListener("pointermove",F,true),d.addEventListener("pointerup",F,true),window.addEventListener("keydown",O,true),window.addEventListener("blur",_);},"handlePointerDown"),p=r(()=>{if(!se.isAllowedTo("makeDraggable"))return;let m=t();m.type==="detachedComponentLayers"&&n.invoke("preloadDetachedComponentLayers",m.url),m.type==="image"&&n.invoke("preloadImageUrlForInsertion",m.image),m.previewImage&&n.invoke("preloadDragPreviewImage",m.previewImage);},"preload");e.addEventListener("pointerdown",b),e.addEventListener("mouseenter",p);function P(){s={type:"idle"},document.body.style.cursor=a,d.removeEventListener("pointermove",F,true),d.removeEventListener("pointerup",F,true),window.removeEventListener("keydown",O,true),window.removeEventListener("blur",_);}return r(P,"dragCleanup"),()=>{e.removeEventListener("pointerdown",b),e.removeEventListener("mouseenter",p),T({cancelled:true}),u();}}r(Ar,"makeDraggable");var Ce=class n{static{r(this,"Redirect");}#e;#t;get id(){return this.#e.id}get from(){return this.#e.from}get to(){return this.#e.to}get expandToAllLocales(){return this.#e.expandToAllLocales}constructor(e,t){this.#t=t,this.#e=e;}remove(){return this.#t.invoke("removeRedirects",[this.id])}async setAttributes(e){let t={...e,id:this.id},[i]=await this.#t.invoke("addRedirects",[t]);return c(pt(i)),I(i)?null:new n(i,this.#t)}};var ni=class{static{r(this,"FramerPluginAPI");}#e;constructor(e){this.#e=e;}get mode(){return this.#e.mode}isAllowedTo(...e){return e.every(t=>this.#e.perMethodPermissionMap[t])}subscribeToIsAllowedTo(...e){let[t,i]=Ti(e),o=this.isAllowedTo(...t),a=r(()=>{let s=this.isAllowedTo(...t);s!==o&&(o=s,i(o));},"update");return this.#e.permissionSubscriptions.add(a),()=>{this.#e.permissionSubscriptions.delete(a);}}async showUI(e){return this.#e.invoke("showUI",e)}async hideUI(){return this.#e.invoke("hideUI")}async setBackgroundMessage(e){return this.#e.invoke("setBackgroundMessage",e)}closePlugin(e,t){throw this.#e.invoke("closePlugin",e,t),new J}async getCurrentUser(){return this.#e.invoke("getCurrentUser2")}async getProjectInfo(){return this.#e.invoke("getProjectInfo2")}async getSelection(){return (await this.#e.invoke("getSelection")).map(t=>{let i=C(t,this.#e);return c(Qe(i)),i})}async setSelection(e){let t=f(e)?[e]:Array.from(e);return this.#e.invoke("setSelection",t)}subscribeToSelection(e){return this.#e.subscribe("selection",t=>{let i=t.map(o=>{let a=C(o,this.#e);return c(Qe(a)),a});e(i);})}async getCanvasRoot(){let e=await this.#e.invoke("getCanvasRoot"),t=C(e,this.#e);return c(Sn(t)),t}subscribeToCanvasRoot(e){return this.#e.subscribe("canvasRoot",t=>{let i=C(t,this.#e);c(Sn(i)),e(i);})}async getPublishInfo(){return this.#e.invoke("getPublishInfo")}subscribeToPublishInfo(e){return this.#e.subscribe("publishInfo",e)}async createFrameNode(e,t){let i=await this.#e.invoke("createNode","FrameNode",t??null,e);if(!i)return null;let o=C(i,this.#e);return c(o instanceof U),o}async removeNodes(e){return this.#e.invoke("removeNodes2",e)}async removeNode(e){return this.removeNodes([e])}async cloneNode(e){return this.#e.cloneNode(e)}async getNode(e){let t=await this.#e.invoke("getNode",e);return t?C(t,this.#e):null}async getParent(e){return this.#e.getParent(e)}async getChildren(e){return this.#e.getChildren(e)}async getRect(e){return this.#e.invoke("getRect",e)}async zoomIntoView(e,t){let i=f(e)?[e]:Array.from(e);return this.#e.invoke("zoomIntoView",i,t)}async setAttributes(e,t){return this.#e.setAttributes(e,t)}async setParent(e,t,i){return this.#e.invoke("setParent",e,t,i)}async getNodesWithType(e){return (await this.#e.invoke("getNodesWithType",null,e)).map(i=>C(i,this.#e))}async getNodesWithAttribute(e){return (await this.#e.invoke("getNodesWithAttribute",null,e)).map(i=>C(i,this.#e))}async getNodesWithAttributeSet(e){return (await this.#e.invoke("getNodesWithAttributeSet",null,e)).map(i=>C(i,this.#e))}async getImage(){let e=await this.#e.invoke("getImage");return e?y(this.#e,e):null}subscribeToImage(e){return this.#e.subscribe("image",t=>{if(!t){e(null);return}e(y(this.#e,t));})}async addImage(e){let t=await ze(e),i=Z(t);return this.#e.invokeTransferable("addImage",i,t)}async setImage(e){let t=await ze(e),i=Z(t);return this.#e.invokeTransferable("setImage",i,t)}async uploadImage(e){let t=await ze(e),i=Z(t),o=await this.#e.invokeTransferable("uploadImage",i,t);return y(this.#e,o)}async addImages(e){let t=await xn(e),i=t.flatMap(Z);await this.#e.invokeTransferable("addImages",i,t);}async uploadImages(e){let t=await xn(e),i=t.flatMap(Z),o=await this.#e.invokeTransferable("uploadImages",i,t);return y(this.#e,o)}async uploadFile(e){let t=await bn(e),i=await this.#e.invokeTransferable("uploadFile",Z(t),t);return y(this.#e,i)}async uploadFiles(e){let t=await Promise.all(e.map(bn)),i=t.flatMap(Z),o=await this.#e.invokeTransferable("uploadFiles",i,t);return y(this.#e,o)}async addSVG(e){return this.#e.invoke("addSVG",e)}async addComponentInstance({url:e,attributes:t,parentId:i}){let o=await this.#e.invoke("addComponentInstance",{url:e,attributes:t,parentId:i}),a=C(o,this.#e);return c(be(a)),a}async addDetachedComponentLayers({url:e,layout:t,attributes:i}){let o=await this.#e.invoke("addDetachedComponentLayers",{url:e,layout:t,attributes:i}),a=C(o,this.#e);return c(wt(a)),a}async preloadDetachedComponentLayers(e){await this.#e.invoke("preloadDetachedComponentLayers",e);}async preloadImageUrlForInsertion(e){await this.#e.invoke("preloadImageUrlForInsertion",e);}async preloadDragPreviewImage(e){await this.#e.invoke("preloadDragPreviewImage",e);}async getText(){return this.#e.invoke("getText")}async setText(e){return this.#e.invoke("setText",e)}async addText(e,t){return this.#e.invoke("addText",e,t)}async setCustomCode(e){return this.#e.invoke("setCustomCode",e)}async getCustomCode(){return this.#e.invoke("getCustomCode")}subscribeToCustomCode(e){return this.#e.subscribe("customCode",e)}subscribeToText(e){return this.#e.subscribe("text",e)}makeDraggable(e,t,i){return Ar(this.#e,e,t,i)}async getActiveManagedCollection(){let e=await this.#e.invoke("getActiveManagedCollection");return c(e,"Collection data must be defined"),new he(e,this.#e)}async getManagedCollection(){return this.getActiveManagedCollection()}async getManagedCollections(){let e=await this.#e.invoke("getManagedCollections");return c(e,"Collections data must be defined"),e.map(t=>new he(t,this.#e))}async getCollection(e){let t=await this.#e.invoke("getCollection",e);return t?new ie(t,this.#e):null}async getActiveCollection(){let e=await this.#e.invoke("getActiveCollection");return e?new ie(e,this.#e):null}async getCollections(){return (await this.#e.invoke("getCollections")).map(t=>new ie(t,this.#e))}notify=r((e,t)=>this.#e.notify(e,t),"notify");async getPluginData(e){return this.#e.invoke("getPluginData",e)}async setPluginData(e,t){return this.#e.invoke("setPluginData",e,t)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeys")}async getColorStyles(){let e=await this.#e.invoke("getColorStyles");return y(this.#e,e)}async getColorStyle(e){let t=await this.#e.invoke("getColorStyle",e);return t?y(this.#e,t):null}async createColorStyle(e){let t=await this.#e.invoke("createColorStyle",e);return y(this.#e,t)}subscribeToColorStyles(e){return this.#e.subscribe("colorStyles",t=>{let i=y(this.#e,t);return e(i)})}async getTextStyles(){let e=await this.#e.invoke("getTextStyles");return y(this.#e,e)}async getTextStyle(e){let t=await this.#e.invoke("getTextStyle",e);return t?y(this.#e,t):null}async createTextStyle(e){let t=await this.#e.invoke("createTextStyle",e);return y(this.#e,t)}subscribeToTextStyles(e){return this.#e.subscribe("textStyles",t=>{let i=y(this.#e,t);return e(i)})}async getFont(e,t){let i=await this.#e.invoke("getFont",e,t);return i?y(this.#e,i):null}async getFonts(){let e=await this.#e.invoke("getFonts");return y(this.#e,e)}getLocales(){return this.#e.invoke("getLocales")}getDefaultLocale(){return this.#e.invoke("getDefaultLocale")}getActiveLocale(){return this.#e.invoke("getActiveLocale")}async getLocalizationGroups(e){return this.#e.invoke("getLocalizationGroups",e)}setLocalizationData(e){return this.#e.invoke("setLocalizationData",e)}async getRedirects(){return (await this.#e.invoke("getRedirects")).map(t=>new Ce(t,this.#e))}subscribeToRedirects(e){return this.#e.subscribe("redirects",t=>{let i=t.map(o=>new Ce(o,this.#e));return e(i)})}async addRedirects(e){return (await this.#e.invoke("addRedirects",e)).map(i=>new Ce(i,this.#e))}async removeRedirects(e){return this.#e.invoke("removeRedirects",e)}async setRedirectOrder(e){return this.#e.invoke("setRedirectOrder",e)}async createCodeFile(e,t,i){let o=await this.#e.invoke("createCodeFile",e,t,i);return new Q(o,this.#e)}async getCodeFiles(){let e=await this.#e.invoke("getCodeFiles"),t=[];for(let i of e)t.push(new Q(i,this.#e));return t}async getCodeFile(e){let t=await this.#e.invoke("getCodeFile",e);return t?new Q(t,this.#e):null}lintCode(e,t,i){return Promise.resolve([])}typecheckCode(e,t,i,o){return this.#e.invoke("typecheckCode",e,t,i,o)}subscribeToCodeFiles(e){return this.#e.subscribe("codeFiles",t=>{let i=t?.map(o=>new Q(o,this.#e));return e(i)})}setMenu(e){return this.#e.setMenu(e)}showContextMenu(e,t){return this.#e.showContextMenu(e,t)}async unstable_ensureMinimumDependencyVersion(e,t){return this.#e.invoke("unstable_ensureMinimumDependencyVersion",e,t)}async navigateTo(e,t){return this.#e.invoke("navigateTo",e,t)}subscribeToOpenCodeFile(e){return this.#e.subscribe("openCodeFile",t=>{let i=t?new Q(t,this.#e):null;return e(i)})}async createDesignPage(e){let t=await this.#e.invoke("createDesignPage",e),i=C(t,this.#e);return c(i instanceof $,"Expected node to be a DesignPageNode"),i}async createWebPage(e){let t=await this.#e.invoke("createWebPage",e),i=C(t,this.#e);return c(i instanceof K,"Expected node to be a WebPageNode"),i}async createCollection(e){let t=await this.#e.invoke("createCollection",e);return new ie(t,this.#e)}async createManagedCollection(e){let t=await this.#e.invoke("createManagedCollection",e);return new he(t,this.#e)}async setCloseWarning(e){return this.#e.invoke("setCloseWarning",e)}get[l.initialState](){return this.#e.initialState}},ii=class extends ni{static{r(this,"FramerPluginAPIBeta");}#e;constructor(e){super(e),this.#e=e,this.#e;}},it=class extends ii{static{r(this,"FramerPluginAPIAlpha");}#e;constructor(e){super(e),this.#e=e,this.#e;}async addComponentInstancePlaceholder(e){let t=await this.#e.invoke("addComponentInstancePlaceholder",e);return new Bt(t,this.#e)}async[l.getAiServiceInfo](e){return this.#e.invoke(gt,e)}async[l.sendTrackingEvent](e,t,i){return this.#e.invoke(ft,e,t,i)}async[l.getCurrentUser](){return this.#e.invoke(yt)}async[l.getProjectInfo](){return this.#e.invoke(ht)}async[l.getHTMLForNode](e){return this.#e.invoke(me,e)}async[l.setHTMLForNode](e,t){return this.#e.invoke(ge,e,t)}get[l.environmentInfo](){return this.#e.environmentInfo}get[l.showUncheckedPermissionToasts](){return this.#e.showUncheckedPermissionToasts}set[l.showUncheckedPermissionToasts](e){this.#e.showUncheckedPermissionToasts=e;}async createTextNode(e,t){let i=await this.#e.invoke("createNode","TextNode",t??null,e);if(!i)return null;let o=C(i,this.#e);return c(o instanceof oe),o}async createComponentNode(e){let t=await this.#e.invoke("createNode","ComponentNode",null,{name:e});if(!t)return null;let i=C(t,this.#e);return c(i instanceof ae),i}async getVectorSets(){return (await this.#e.invoke("getVectorSets")).map(t=>new et(t,this.#e))}async createLocale(e){return this.#e.invoke("createLocale",e)}async getLocaleLanguages(){return this.#e.invoke("getLocaleLanguages")}async getLocaleRegions(e){return this.#e.invoke("getLocaleRegions",e)}async[x.publish](){return this.#e.invoke("publish")}async[x.getDeployments](){return this.#e.invoke("getDeployments")}async[x.deploy](e,t){return this.#e.invoke("deploy",e,t)}async[x.getChangedPaths](){return this.#e.invoke("getChangedPaths")}async[x.getChangeContributors](e,t){return this.#e.invoke("getChangeContributors",e,t)}async[x.createManagedCollection](e){return this.createManagedCollection(e)}[x.rejectAllPending](e){this.#e.rejectAllPending(e);}async[x.getAgentSystemPrompt](){return this.#e.invoke("getAgentSystemPrompt")}async[x.getAgentContext](e){return this.#e.invoke("getAgentContext",e)}async[x.readProjectForAgent](e,t){return this.#e.invoke("readProjectForAgent",e,t)}async[x.applyAgentChanges](e,t){return this.#e.invoke("applyAgentChanges",e,t)}async[x.publishForAgent](e){return this.#e.invoke("publishForAgent",e)}async[x.queryImagesForAgent](e){return this.#e.invoke("queryImagesForAgent",e)}async[x.reviewChangesForAgent](e){return this.#e.invoke("reviewChangesForAgent",e)}async[x.flattenComponentInstanceForAgent](e,t){return this.#e.invoke("flattenComponentInstanceForAgent",e,t)}async[x.makeExternalComponentLocalForAgent](e,t){return this.#e.invoke("makeExternalComponentLocalForAgent",e,t)}async[x.getNodeForAgent](e,t){return this.#e.invoke("getNodeForAgent",e,t)}async[x.getNodesForAgent](e,t){return this.#e.invoke("getNodesForAgent",e,t)}async[x.getNodesOfTypesForAgent](e,t){return this.#e.invoke("getNodesOfTypesForAgent",e,t)}async[x.getScopeNodeForAgent](e,t){return this.#e.invoke("getScopeNodeForAgent",e,t)}async[x.getGroundNodeForAgent](e,t){return this.#e.invoke("getGroundNodeForAgent",e,t)}async[x.getParentNodeForAgent](e,t){return this.#e.invoke("getParentNodeForAgent",e,t)}async[x.getAncestorsForAgent](e,t){return this.#e.invoke("getAncestorsForAgent",e,t)}async[x.startAgentConversation](e,t){return this.#e.invoke("startAgentConversation",e,t)}async[x.continueAgentConversation](e,t){return this.#e.invoke("continueAgentConversation",e,t)}async[x.submitAgentClarification](e){return this.#e.invoke("submitAgentClarification",e)}async[x.runSupervisorAgentCommand](e){return this.#e.invoke("runSupervisorAgentCommand",e)}};var ri=class{constructor(e){this.origin=e;}origin;static{r(this,"IframeTransport");}send(e,t){window.parent.postMessage(e,this.origin,t);}onMessage(e){window.addEventListener("message",e);}};async function ka(){return new Promise(n=>{function e({data:t,origin:i}){if(!vr(t))return;window.removeEventListener("message",e);let a={transport:new ri(i),mode:t.mode,permissionMap:t.permissionMap,environmentInfo:t.environmentInfo,origin:i,theme:t.theme??null,initialState:t.initialState};n(a);}r(e,"handshakeListener"),window.addEventListener("message",e),window.parent.postMessage(Sr,"*");})}r(ka,"createBrowserContext");async function Na(){return typeof window>"u"||"Deno"in globalThis?null:ka()}r(Na,"bootstrap");var Er=await Na(),se=Er?new it(new nt(Er)):new Proxy({},{get(n,e){throw new Error(`Cannot access framer.${String(e)} in server runtime. Use createFramerInstance() with a custom transport.`)}});function Mr(n){return new it(new nt(n))}r(Mr,"createFramerInstance");var wr={};function Ea(n){if(env)try{Object.assign(env,n);}catch{}Object.assign(wr,n);}r(Ea,"configure");function Ie(n,e){let t=wr[n]??env[n];return t&&t.length>0?t:e}r(Ie,"getEnv");var Vr=isWorkerd,ai=globalThis.WebSocket;async function Lr(n,e){let t=new URL(n.href);t.protocol=t.protocol==="wss:"?"https:":t.protocol==="ws:"?"http:":t.protocol;let o=(await fetch(t.href,{headers:{Upgrade:"websocket",...e}})).webSocket;if(!o)throw new Error("WebSocket upgrade failed - server did not accept");return o.accept(),o}r(Lr,"connectWebSocketCF");var Wr,Rr;try{Wr=await import('fs'),Rr=await import('path');}catch{}var si=Wr,li=Rr;var le=(u=>(u.PROJECT_CLOSED="PROJECT_CLOSED",u.POOL_EXHAUSTED="POOL_EXHAUSTED",u.TIMEOUT="TIMEOUT",u.INTERNAL="INTERNAL",u.NODE_NOT_FOUND="NODE_NOT_FOUND",u.SCREENSHOT_TOO_LARGE="SCREENSHOT_TOO_LARGE",u.INVALID_REQUEST="INVALID_REQUEST",u.UNAUTHORIZED="UNAUTHORIZED",u))(le||{}),D=class extends Error{static{r(this,"FramerAPIError");}code;constructor(e,t){super(e),this.name="FramerAPIError",this.code=t,this.stack=void 0;}};function Ma(n){return n instanceof D?n.code==="POOL_EXHAUSTED":false}r(Ma,"isRetryableError");var wa=new Map(Object.values(le).map(n=>[n,n]));function Ur(n){return typeof n=="string"?wa.get(n)??"INTERNAL":"INTERNAL"}r(Ur,"parseErrorCode");var Va={pluginMarshalTag:Et};var di={silent:0,error:1,warn:2,info:3,debug:4};function La(){let n=Ie("FRAMER_API_LOG_LEVEL")?.toLowerCase();return n&&n in di?n:"warn"}r(La,"getLogLevel");var ui=La();function rt(n){return di[n]<=di[ui]}r(rt,"shouldLog");var ot=globalThis.console,Wa="\x1B[90m",Ra="\x1B[0m";function Ba(n){return n?`[FramerAPI:${n}]`:"[FramerAPI]"}r(Ba,"formatPrefix");function Ua(n,...e){return [Wa+n,...e,Ra]}r(Ua,"formatDebug");function Or(n){let e=Ba(n);return {warn:r((...t)=>{rt("warn")&&ot.warn(e,...t);},"warn"),error:r((...t)=>{rt("error")&&ot.error(e,...t);},"error"),log:r((...t)=>{rt("info")&&ot.log(e,...t);},"log"),info:r((...t)=>{rt("info")&&ot.info(e,...t);},"info"),debug:r((...t)=>{rt("debug")&&ot.debug(...Ua(e,...t));},"debug"),setLevel:r(t=>{ui=t;},"setLevel"),getLevel:r(()=>ui,"getLevel"),withRequestId:r(t=>Or(t),"withRequestId")}}r(Or,"createLogger");var N=Or();N.warn;N.error;N.log;N.info;N.debug;N.setLevel;N.getLevel;var Ut="0.1.8";var zr="wss://api.framer.com/channel/headless-plugin";function ee(n,...e){if(n)return;let t=Error("Assertion Error"+(e.length>0?": "+e.join(" "):""));if(t.stack)try{let i=t.stack.split(`
|
|
6
6
|
`);i[1]?.includes("assert")?(i.splice(1,1),t.stack=i.join(`
|
|
7
7
|
`)):i[0]?.includes("assert")&&(i.splice(0,1),t.stack=i.join(`
|
|
8
|
-
`));}catch{}throw t}r(ee,"assert");var
|
|
9
|
-
`)};return n.logs&&console?.warn("extras.logs is reserved for log replay buffer, use another key"),e},"enrichWithLogs"),Kt=class{constructor(e,t){this.id=e;this.errorIsCritical=t??(e==="fatal"||e.endsWith(":fatal"));}id;static{r(this,"Logger");}level=3;didLog={};errorIsCritical;extend(e){let t=this.id+":"+e;return dt(t)}getBufferedMessages(){return j.filter(e=>e.logger===this)}setLevel(e){let t=this.level;return this.level=e,t}isLoggingTraceMessages(){return this.level>=0}trace=r((...e)=>{if(this.level>0)return;let t=de(this,0,e);console?.log(...t.toConsoleMessage());},"trace");debug=r((...e)=>{let t=de(this,1,e);this.level>1||console?.log(...t.toConsoleMessage());},"debug");info=r((...e)=>{let t=de(this,2,e);this.level>2||console?.info(...t.toConsoleMessage());},"info");warn=r((...e)=>{let t=de(this,3,e);this.level>3||console?.warn(...t.toConsoleMessage());},"warn");warnOncePerMinute=r((e,...t)=>{let i=this.didLog[e];if(i&&i>Date.now())return;this.didLog[e]=Date.now()+1e3*60,t.unshift(e);let o=de(this,3,t);this.level>3||console?.warn(...o.toConsoleMessage());},"warnOncePerMinute");error=r((...e)=>{let t=de(this,4,e);this.level>4||console?.error(...t.toConsoleMessage());},"error");errorOncePerMinute=r((e,...t)=>{let i=this.didLog[e];if(i&&i>Date.now())return;this.didLog[e]=Date.now()+1e3*60,t.unshift(e);let o=de(this,4,t);this.level>4||console?.error(...o.toConsoleMessage());},"errorOncePerMinute");reportWithoutLogging=r((e,t,i,o)=>{let a=Va(t??{}),s=kr({caller:this.reportWithoutLogging,error:e,tags:{...i,handler:"logger",where:this.id},extras:t,critical:o??this.errorIsCritical});return [a,s]},"reportWithoutLogging");reportError=r((e,t,i,o)=>{let[a,s]=this.reportWithoutLogging(e,t,i,o);a?this.error(s,a):this.error(s);},"reportError");reportErrorWithThrottle=r((e,t,i,o,a)=>{if(!Wa(t))return;let s=this.didLog[t.message];s&&s>Date.now()||(this.didLog[t.message]=Date.now()+e,this.reportError(t,i,o,a));},"reportErrorWithThrottle");reportErrorOncePerMinute=r((e,t,i,o)=>this.reportErrorWithThrottle(1e3*60,e,t,i,o),"reportErrorOncePerMinute");reportErrorOnceEveryTenMinutes=r((e,t,i,o)=>this.reportErrorWithThrottle(1e3*60*10,e,t,i,o),"reportErrorOnceEveryTenMinutes");reportCriticalError=r((e,t,i)=>this.reportError(e,t,i,true),"reportCriticalError")};function Wa(n){return Object.prototype.hasOwnProperty.call(n,"message")}r(Wa,"isErrorWithMessage");function zr(n){return n.replace(/[/\-\\^$*+?.()|[\]{}]/gu,"\\$&")}r(zr,"escapeRegExp");function La(n,e,t){let i=ti[t];if(!i)return n;let o=`${i}: [${e}]`,a=zr(o).replace("\\[","\\*?\\["),s=new RegExp(`^(?:T?\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z\\s+)?${a}\\s*`);return n.replace(s,"")}r(La,"stripLogEntryPrefix");var $r;(_=>{function n(b,...p){return b.concat(p)}_.push=n,r(n,"push");function e(b){return b.slice(0,-1)}_.pop=e,r(e,"pop");function t(b,...p){return p.concat(b)}_.unshift=t,r(t,"unshift");function i(b,p,...T){let m=b.length;if(p<0||p>m)throw Error("index out of range: "+p);let h=b.slice();return h.splice(p,0,...T),h}_.insert=i,r(i,"insert");function o(b,p,T){let m=b.length;if(p<0||p>=m)throw Error("index out of range: "+p);let h=Array.isArray(T)?T:[T],A=b.slice();return A.splice(p,1,...h),A}_.replace=o,r(o,"replace");function a(b,p){let T=b.length;if(p<0||p>=T)throw Error("index out of range: "+p);let m=b.slice();return m.splice(p,1),m}_.remove=a,r(a,"remove");function s(b,p,T){let m=b.length;if(p<0||p>=m)throw Error("from index out of range: "+p);if(T<0||T>=m)throw Error("to index out of range: "+T);let h=b.slice();if(T===p)return h;let A=h[p];return p<T?(h.splice(T+1,0,A),h.splice(p,1)):(h.splice(p,1),h.splice(T,0,A)),h}_.move=s,r(s,"move");function d(b,p){let T=[],m=Math.min(b.length,p.length);for(let h=0;h<m;h++)T.push([b[h],p[h]]);return T}_.zip=d,r(d,"zip");function u(b,p,T){let m=b.slice(),h=m[p];return h===void 0||(m[p]=T(h)),m}_.update=u,r(u,"update");function I(b){return Array.from(new Set(b))}_.unique=I,r(I,"unique");function S(b,...p){return Array.from(new Set([...b,...p.flat()]))}_.union=S,r(S,"union");function O(b,p){return b.filter(p)}_.filter=O,r(O,"filter");})($r||={});var Ga=Object.prototype.hasOwnProperty;function Ka(n,e){return Ga.call(n,e)}r(Ka,"hasOwnProperty");var jr;(i=>{function n(o,a){for(let s of Object.keys(o))Ka(a,s)||delete o[s];for(let s of Object.keys(a))o[s]===void 0&&(o[s]=a[s]);return Object.setPrototypeOf(o,Object.getPrototypeOf(a)),o}i.morphUsingTemplate=n,r(n,"morphUsingTemplate");function e(o,a){a&&Object.assign(o,a);}i.writeOnce=e,r(e,"writeOnce");function t(o,a){return Object.assign(Object.create(Object.getPrototypeOf(o)),o,a)}i.update=t,r(t,"update");})(jr||={});var Hr;(o=>{function n(a,...s){return new Set([...a,...s])}o.add=n,r(n,"add");function e(a,...s){let d=new Set(a);for(let u of s)d.delete(u);return d}o.remove=e,r(e,"remove");function t(...a){let s=new Set;for(let d of a)for(let u of d)s.add(u);return s}o.union=t,r(t,"union");function i(a,s){return a.has(s)?o.remove(a,s):o.add(a,s)}o.toggle=i,r(i,"toggle");})(Hr||={});var _r;(i=>{function n(o,...a){let s=new Map;o.forEach((u,I)=>s.set(I,u));let d=false;for(let u of a)u&&(u.forEach((I,S)=>s.set(S,I)),d=true);return d?s:o}i.merge=n,r(n,"merge");function e(o,a,s){let d=new Map(o);return d.set(a,s),d}i.set=e,r(e,"set");function t(o,a){let s=new Map(o);return s.delete(a),s}i.remove=t,r(t,"remove");})(_r||={});var $t=class extends Promise{static{r(this,"ResolvablePromise");}_state="initial";resolve;reject;get state(){return this._state}pending(){return this._state="pending",this}isResolved(){return this._state==="fulfilled"||this._state==="rejected"}constructor(){let e,t;super((i,o)=>{e=i,t=o;}),this.resolve=i=>{this._state="fulfilled",e(i);},this.reject=i=>{this._state="rejected",t(i);};}};$t.prototype.constructor=Promise;dt("task-queue");function qr(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}r(qr,"isObject");var _a=-1,jt=class{static{r(this,"WebSocketTransport");}onError;closed=false;ws;messageHandlers=new Set;chunkBuffers=new Map;constructor(e){this.ws=e,this.setupListeners();}setupListeners(){this.ws.addEventListener("close",this.handleClose),this.ws.addEventListener("message",this.handleMessage);}removeListeners(){this.ws.removeEventListener("close",this.handleClose),this.ws.removeEventListener("message",this.handleMessage);}handleClose=r(()=>{this.removeListeners(),this.closed=true,this.chunkBuffers.clear(),this.onError?.(new D("Connection closed","PROJECT_CLOSED"));},"handleClose");handleMessage=r(e=>{let t=typeof e.data=="string"?e.data:String(e.data),i=this.tryParseChunkEnvelope(t);if(i){let o=this.handleChunk(i);if(!o)return;let a=new MessageEvent("message",{data:o});if(this.tryHandleDebugArchive(o))return;for(let s of this.messageHandlers)s(a);return}if(!this.tryHandleDebugArchive(t))for(let o of this.messageHandlers)o(e);},"handleMessage");tryHandleDebugArchive(e){try{let t=ue.parse(e);if(qr(t)&&t.type==="debug-archive")return oi(t.data),!0}catch{}return false}replaceSocket(e){this.removeListeners(),this.chunkBuffers.clear(),this.ws=e,this.closed=false,this.setupListeners();}setOnError(e){this.onError=e;}send(e){if(this.closed)throw new D("Connection closed","PROJECT_CLOSED");this.ws.send(ue.stringify(e,{[Mt]:t=>In(t)&&W(t)}));}handleChunk(e){let t=this.chunkBuffers.get(e.id);return t||(t=[],this.chunkBuffers.set(e.id,t)),t.push(e.data),e.seq===_a?(this.chunkBuffers.delete(e.id),t.join("")):null}tryParseChunkEnvelope(e){if(!e.startsWith('{"$chunk":'))return null;try{let t=JSON.parse(e);if(t.$chunk===1&&typeof t.id=="string"&&typeof t.seq=="number")return t}catch{}return null}onMessage(e){let t=r(i=>{let o=typeof i.data=="string"?i.data:String(i.data);this.dispatchMessage(o,e);},"listener");this.messageHandlers.add(t);}dispatchMessage(e,t){let i=ue.parse(e);if(qr(i)&&i.type==="error"){let o=i.message||JSON.stringify(i),a=i.code??"INTERNAL";k.error(`Server error: ${o}`),this.onError?.(new D(`Server error: ${o}`,a));return}t(i);}};function oi(n){ee(qn,"File system module is not available."),ee(Yn,"Path module is not available.");let t=`debug-archive-${new Date().toISOString().replace(/[:.]/gu,"-")}.zip`,i=process.cwd(),o=Yn.resolve(i,t);qn.writeFileSync(o,Buffer.from(n)),k.info(`Debug archive saved to ${o}`);}r(oi,"handleDebugArchive");function Te(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}r(Te,"isObject");var qa={type:"pluginReadySignal"};function Ya(n){return Te(n)&&n.type==="pluginReadyResponse"}r(Ya,"isPluginReadyResponse");var Yr=9e4,Xa=2e4;function Za(n,e){return new Promise(t=>{let i=setTimeout(()=>{n.removeEventListener("message",o),t();},e),o=r(a=>{if(!(typeof a.data!="string"&&!(a.data instanceof String)))try{let s=ue.parse(a.data);Te(s)&&s.type==="disconnect-ack"&&(clearTimeout(i),n.removeEventListener("message",o),t());}catch{}},"handler");n.addEventListener("message",o);})}r(Za,"waitForDisconnectAck");async function Ja(n,e){let t={Authorization:`Token ${e}`};if(Ir)return k.debug("Using Cloudflare Workers WebSocket connection"),Tr(n,t);if(isDeno)return new _n(n.href,[`token.${e}`]);let i=n.hostname==="api.framerlocal.com",o=process.env.NODE_TLS_REJECT_UNAUTHORIZED;i&&(process.env.NODE_TLS_REJECT_UNAUTHORIZED="0"),k.debug("Using standard WebSocket connection");let a=new _n(n.href,{headers:t});return i&&(process.env.NODE_TLS_REJECT_UNAUTHORIZED=o),a}r(Ja,"createWebSocket");async function Ht(n,e,t,i){let o=new URL(i??Ie("FRAMER_HEADLESS_SERVER_URL","wss://api.framer.com/channel/headless-plugin"));o.protocol=o.protocol==="https:"?"wss:":o.protocol==="http:"?"ws:":o.protocol,o.searchParams.set("projectId",n),o.searchParams.set("sdkVersion",Ut),t&&o.searchParams.set("clientId",t),k.debug(`Connecting to ${o.href}`);let a=await Ja(o,e);k.debug(`WebSocket created, readyState: ${a.readyState}`);let s,d,u=k,I=false,S=setInterval(()=>{a.readyState===a.OPEN&&(a.send(ue.stringify({type:"ping"})),u.debug("Sent ping"));},Xa),O=r(()=>{clearInterval(S),a.readyState!==a.CLOSED&&a.readyState!==a.CLOSING&&a.close(1e3,"Client disconnect");},"forceClose"),_=r(async()=>{clearInterval(S),!(a.readyState===a.CLOSED||a.readyState===a.CLOSING)&&(I&&(u.debug("Initiating graceful disconnect"),a.send(ue.stringify({type:"client-disconnect"})),await Za(a,15e3)),a.readyState!==a.CLOSED&&a.readyState!==a.CLOSING&&a.close(1e3,"Client disconnect"));},"cleanup"),b=await new Promise((p,T)=>{let m=setTimeout(()=>{O(),T(new D(`Connection timeout after ${Yr}ms`,"TIMEOUT"));},Yr),h=r(()=>{u.debug("WebSocket opened, waiting for ready");},"onOpen"),A=r(E=>{u.debug("WebSocket error:",E),clearTimeout(m),O(),T(new D("No connection to the server","INTERNAL"));},"onError"),z=r(E=>{u.debug(`WebSocket closed: code=${E.code}, reason=${E.reason||"(no reason)"}, wasClean=${E.wasClean}`),clearTimeout(m),clearInterval(S),T(new D(`Connection to the server was closed (code: ${E.code})`,"PROJECT_CLOSED"));},"onClose");function te(E){u.debug("Received message");let ct=typeof E.data=="string"?E.data:E.data.toString(),F=ue.parse(ct);if(u.debug(`Message type: ${F.type}`),F.type==="error"){clearTimeout(m),a.removeEventListener("close",z),a.removeEventListener("error",A);let ce=Dr(F.code);T(new D(F.message||"Server error",ce)),O();}else F.type==="ready"?(Te(F)&&"requestId"in F&&(s=String(F.requestId),u=k.withRequestId(s),u.debug(`Server request ID: ${s}`)),Te(F)&&"sessionId"in F&&(d=String(F.sessionId),u.debug(`Server session ID: ${d}`)),Te(F)&&"version"in F&&u.debug(`Server version: ${F.version}`),Te(F)&&F.gracefulDisconnect===true&&(I=true),u.debug("Sending pluginReadySignal"),a.send(ue.stringify(qa))):F.type==="debug-archive"?oi(F.data):Ya(F)&&(clearTimeout(m),a.removeEventListener("message",te),a.removeEventListener("error",A),a.removeEventListener("close",z),p(F));}r(te,"handshakeMessageHandler"),a.addEventListener("open",h),a.addEventListener("message",te),a.addEventListener("error",A),a.addEventListener("close",z);});return a.addEventListener("close",()=>{_();}),{ws:a,pluginReadyData:b,requestId:s,sessionId:d,clientId:t,logger:u,gracefulDisconnect:I,cleanup:_}}r(Ht,"connectAndHandshake");var Xr={showUI:false,hideUI:false,closePlugin:false,setCloseWarning:true,notify:false,setMenu:false,showContextMenu:false,preloadDetachedComponentLayers:false,preloadDragPreviewImage:false,preloadImageUrlForInsertion:false,setBackgroundMessage:false,getSelection:false,getActiveCollection:false,getActiveManagedCollection:false,getActiveLocale:false,zoomIntoView:false,navigateTo:false,getPluginData:false,setPluginData:false,getPluginDataKeys:false,makeDraggable:false,subscribeToSelection:false,subscribeToImage:false,subscribeToText:false,subscribeToCustomCode:false,subscribeToColorStyles:false,subscribeToTextStyles:false,subscribeToRedirects:false,subscribeToCodeFiles:false,subscribeToOpenCodeFile:false,subscribeToIsAllowedTo:false,subscribeToCanvasRoot:false,subscribeToPublishInfo:false,unstable_ensureMinimumDependencyVersion:false,removeNode:true,removeNodes:true,addSVG:true,getRect:true,setText:true,getText:true,addText:true,setCustomCode:true,getCustomCode:true,getLocales:true,getDefaultLocale:true,getLocalizationGroups:true,setLocalizationData:true,createLocale:true,getLocaleLanguages:true,getLocaleRegions:true,getCurrentUser:true,getProjectInfo:true,setSelection:true,getCanvasRoot:true,getPublishInfo:true,cloneNode:true,getNode:true,getParent:true,getChildren:true,setAttributes:true,getNodesWithType:true,getNodesWithAttribute:true,getNodesWithAttributeSet:true,addImages:true,getImage:true,addImage:true,setImage:true,uploadImage:true,uploadImages:true,uploadFile:true,uploadFiles:true,setParent:true,addComponentInstance:true,addDetachedComponentLayers:true,getManagedCollection:true,getManagedCollections:true,getCollection:true,getCollections:true,getColorStyle:true,getColorStyles:true,createColorStyle:true,getTextStyle:true,getTextStyles:true,createTextStyle:true,getFont:true,getFonts:true,createCodeFile:true,getCodeFiles:true,getCodeFile:true,lintCode:true,typecheckCode:true,addRedirects:true,getRedirects:true,setRedirectOrder:true,removeRedirects:true,addComponentInstancePlaceholder:true,createCollection:true,getVectorSets:true,createDesignPage:true,createWebPage:true,createTextNode:true,createComponentNode:true,mode:true,isAllowedTo:false,createFrameNode:true,createManagedCollection:true};function ai(n){return n in Xr?Xr[n]===true:false}r(ai,"isAllowedMethod");var _t=class n{static{r(this,"FramerAPI");}requestId;sessionId;#e;#t;#n;#i=new Map;#r=new Map;#p=0;#a;#s;#l;#d;constructor(e){this.#t=e.pluginAPI,this.#n=e.transport,this.#e=e.cleanup,this.#a=e.projectId,this.#s=e.apiKey,this.#l=e.serverUrl,this.requestId=e.requestId,this.sessionId=e.sessionId,this.#d=e.clientId,this.#n.onMessage(t=>{this.#m(t);}),this.#n.setOnError(t=>{this.#u(t);});}#u(e){for(let t of this.#i.values())t.reject(e);this.#i.clear();for(let t of this.#r.values())t.reject(e);this.#r.clear(),this.#t[v.rejectAllPending](e);}#c(){return `req-${++this.#p}-${Date.now()}`}#m=r(e=>{switch(e.type){case "screenshotResult":{let t=this.#i.get(e.id);if(t){this.#i.delete(e.id);let i=Buffer.from(e.data,"base64");t.resolve({data:i,mimeType:e.mimeType});}return true}case "screenshotError":{let t=this.#i.get(e.id);if(t){this.#i.delete(e.id);let i=e.code??"INTERNAL";t.reject(new D(e.error,i));}return true}case "exportSVGResult":{let t=this.#r.get(e.id);return t&&(this.#r.delete(e.id),t.resolve(e.data)),true}case "exportSVGError":{let t=this.#r.get(e.id);if(t){this.#r.delete(e.id);let i=e.code??"INTERNAL";t.reject(new D(e.error,i));}return true}default:return false}},"#handleServerApiResponse");static create(e){let t=new n(e);return new Proxy(t,{get(i,o){if(o in i)return Reflect.get(i,o);if(Un(o)){let s=v[o],d=Reflect.get(i.#t,s);return typeof d=="function"?d.bind(i.#t):d}if(!ai(o))return;let a=Reflect.get(i.#t,o);return typeof a=="function"?a.bind(i.#t):a},has(i,o){return o in i||Un(o)?true:ai(o)?o in i.#t:false}})}async#o(){this.#u(new D("Connection closed","PROJECT_CLOSED")),await this.#e();}disconnect=r(()=>this.#o(),"disconnect");reconnect=r(async()=>{await this.#o();let e=await Ht(this.#a,this.#s,this.#d,this.#l);this.#n.replaceSocket(e.ws),this.#e=e.cleanup,this.requestId=e.requestId,this.sessionId=e.sessionId;},"reconnect");screenshot=r((e,t)=>{let i=this.#c(),{format:o,quality:a,scale:s,clip:d}=t??{};return new Promise((u,I)=>{this.#i.set(i,{resolve:u,reject:I}),this.#n.send({type:"screenshot",id:i,nodeId:e,format:o,quality:a,scale:s,clip:d});})},"screenshot");exportSVG=r(e=>{let t=this.#c();return new Promise((i,o)=>{this.#r.set(t,{resolve:i,reject:o}),this.#n.send({type:"exportSVG",id:t,nodeId:e});})},"exportSVG");[Symbol.dispose]=()=>{this.#o();};[Symbol.asyncDispose]=()=>this.#o()};var Qa=/^.+--([A-Za-z0-9]+)/u,Zr=/^[A-Za-z0-9]{20}$/u;function Jr(n){if(Zr.test(n))return n;try{let t=new URL(n,"https://framer.com").pathname.split("/").filter(Boolean),i=t.findIndex(o=>o.toLowerCase()==="projects");if(i>=0){let o=t[i+1];if(o!==void 0){let a=decodeURIComponent(o),d=a.match(Qa)?.[1]??a;if(Zr.test(d))return d}}return null}catch{return null}}r(Jr,"parseProjectId");async function Qr(n,e,t){let i=performance.now();if(!n)throw new D("FRAMER_PROJECT_URL environment variable is required","INVALID_REQUEST");let o=Jr(n);if(!o)throw new D(`Invalid project URL or ID: ${n}`,"INVALID_REQUEST");let a=e??Ie("FRAMER_API_KEY");if(!a)throw new D("FRAMER_API_KEY environment variable is required","INVALID_REQUEST");let s=t?.clientId?.trim()||`framer-api/${Ut}`,d=await Ht(o,a,s,t?.serverUrl);try{let u=new jt(d.ws),I={transport:u,mode:d.pluginReadyData.mode,permissionMap:d.pluginReadyData.permissionMap,environmentInfo:d.pluginReadyData.environmentInfo,origin:null,theme:null,initialState:d.pluginReadyData.initialState},S=xr(I),O=r(async()=>{let _=((performance.now()-i)/1e3).toFixed(2);d.logger.debug(`Connection ended after ${_}s`),await d.cleanup();},"cleanup");return _t.create({pluginAPI:S,transport:u,cleanup:O,projectId:o,apiKey:a,serverUrl:t?.serverUrl,clientId:d.clientId,requestId:d.requestId,sessionId:d.sessionId})}catch(u){throw await d.cleanup(),u}}r(Qr,"connect");async function es(n,e,t,i){let o=await Qr(n,t,i);try{return await e(o)}finally{await o.disconnect();}}r(es,"withConnection");
|
|
10
|
-
export{
|
|
8
|
+
`));}catch{}throw t}r(ee,"assert");var Gr;function Kr({error:n,tags:e,extras:t,critical:i,caller:o}){ee(Gr,"Set up an error callback with setErrorReporter, or configure Sentry with initializeEnvironment");let a=pi(n,o);return Gr({error:a,tags:{...a.tags,...e},extras:{...a.extras,...t},critical:!!i}),a}r(Kr,"reportError");function pi(n,e=pi){return n instanceof Error?n:new ci(n,e)}r(pi,"reportableError");var ci=class extends Error{static{r(this,"UnhandledError");}constructor(e,t){let i=e?JSON.stringify(e):"No error message provided";if(super(i),this.message=i,t&&Error.captureStackTrace)Error.captureStackTrace(this,t);else try{throw new Error}catch(o){this.stack=o.stack;}}};var at=typeof window<"u"&&!("Deno"in globalThis)?window.location.hostname:void 0,$r=!!(at&&["web.framerlocal.com","localhost","127.0.0.1","[::1]"].includes(at)),mi=(()=>{if(!at)return;if($r)return {main:at,previewLink:void 0};let n=/^(([^.]+\.)?beta\.)?((?:development\.)?framer\.com)$/u,e=at.match(n);if(!(!e||!e[3]))return {previewLink:e[2]&&e[0],main:e[3]}})();({isDevelopment:mi?.main==="development.framer.com",isProduction:mi?.main==="framer.com"});var Ot;function zt(){return typeof window>"u"?{}:Ot||(Ot=Ga(),Ot)}r(zt,"getServiceMap");function Ga(){let n=window.location,e=window?.bootstrap?.services;if(e)return e;let t;try{if(t=window.top.location.origin,e=window.top?.bootstrap?.services,e)return e}catch{}if(t&&t!==n.origin)throw Error(`Unexpectedly embedded by ${t} (expected ${n.origin})`);if(n.origin.endsWith("framer.com")||n.origin.endsWith("framer.dev"))throw Error("ServiceMap data was not provided in document");try{let i=new URLSearchParams(n.search).get("services")||new URLSearchParams(n.hash.substring(1)).get("services");i&&(e=JSON.parse(i));}catch{}if(e&&typeof e=="object"&&e.api)return e;throw Error("ServiceMap requested but not available")}r(Ga,"extractServiceMap");function st(n,e=0,t=new Set){if(n===null)return n;if(typeof n=="function")return `[Function: ${n.name??"unknown"}]`;if(typeof n!="object")return n;if(n instanceof Error)return `[${n.toString()}]`;if(t.has(n))return "[Circular]";if(e>2)return "...";t.add(n);try{if("toJSON"in n&&typeof n.toJSON=="function")return st(n.toJSON(),e+1,t);if(Array.isArray(n))return n.map(i=>st(i,e+1,t));if(Object.getPrototypeOf(n)!==Object.prototype)return `[Object: ${"__class"in n&&n.__class||n.constructor?.name}]`;{let i={};for(let[o,a]of Object.entries(n))i[o]=st(a,e+1,t);return i}}catch(i){return `[Throws: ${i instanceof Error?i.message:i}]`}finally{t.delete(n);}}r(st,"jsonSafeCopy");var gi=["trace","debug","info","warn","error"],Ka=["\u{1F50D}","\u{1F9EA}","\u2139\uFE0F","\u26A0\uFE0F","\u274C"],$a=[":trace",":debug",":info",":warn",":error"],_r="logTimestamps";function qr(n){return new Date(n).toISOString().substring(10,24)}r(qr,"formatLogTimestamp");function Yr(n,e){let t=[];for(let i of n.split(/[ ,]/u)){let o=i.trim();if(o.length===0)continue;let a=1,s=false;o.startsWith("-")&&(o=o.slice(1),a=3,s=true);for(let T=0;T<=4;T++){let F=$a[T];if(F&&o.endsWith(F)){a=T,s&&(a+=1),o=o.slice(0,o.length-F.length),o.length===0&&(o="*");break}}let d=new RegExp("^"+to(o).replace(/\\\*/gu,".*")+"$"),u=0;for(let T of e)T.id.match(d)&&(T.level=a,++u);u===0&&t.push(i);}return t}r(Yr,"applyLogLevelSpec");var lt=class n{constructor(e,t,i){this.logger=e;this.level=t;this.parts=i;this.id=n.nextId++,this.time=Date.now();}logger;level;parts;static{r(this,"LogEntry");}static nextId=0;id;time;stringPrefix;cachedMessage;toMessage(){if(this.stringPrefix)return this.cachedMessage??this.parts;let e=[gi[this.level]+": ["+this.logger.id+"]"];Gt&&e.unshift(qr(this.time)),this.stringPrefix=e.join(" ");let t=this.parts[0];if(typeof t=="string"){let i=Xa(t,this.logger.id,this.level);this.cachedMessage=[i.length>0?`${this.stringPrefix} ${i}`:this.stringPrefix,...this.parts.slice(1)];}else this.cachedMessage=[this.stringPrefix,...this.parts];return this.cachedMessage}resetMessagePrefix(){this.stringPrefix=void 0,this.cachedMessage=void 0;}toConsoleMessage(){let e=this.toMessage().slice(),t=e[0];if(typeof t!="string")return e;let i=gi[this.level],o=Ka[this.level];i&&o&&(e[0]=t.replace(`${i}:`,`${o}`));let a=`[${this.logger.id}]`,s=e[0];if(typeof s!="string")return e;let d=s.indexOf(a);return d<0||(e[0]=s.slice(0,d)+"%c"+a+"%c"+s.slice(d+a.length),e.splice(1,0,"color: #9ca3af","")),e}toString(){return this.toMessage().map(e=>{let t=typeof e;if(t==="string")return e;if(t==="function")return `[Function: ${e.name??"unknown"}]`;if(e instanceof Error)return e.stack??e.toString();let i=JSON.stringify(st(e));return i?.length>253?i.slice(0,250)+"...":i}).join(" ")}},H="*:app:info,app:info",Gt=true,Xr=typeof process<"u"&&!!process.kill,ja=Xr&&!!process.env.CI;ja?H="-:warn":Xr&&(H="");try{typeof window<"u"&&window.localStorage&&(H=window.localStorage.logLevel||H,Gt=window.localStorage[_r]!=="false");}catch{}try{typeof process<"u"&&(H=process.env.DEBUG||H);}catch{}try{typeof window<"u"&&Object.assign(window,{setLogLevel:Qr,setLogTimestamps:eo});}catch{}try{typeof window<"u"&&window.postMessage&&window.top===window&&window.addEventListener("message",n=>{if(!n.data||typeof n.data!="object")return;let{loggerId:e,level:t,parts:i,printed:o}=n.data;if(typeof e!="string"||!Array.isArray(i)||i.length<1||typeof t!="number")return;let a=dt(e);if(t<0||t>5)return;i[0]=i[0].replace("[","*[");let s=new lt(a,t,i);s.stringPrefix=i[0],j.push(s),!o&&(a.level>t||console?.log(...s.toConsoleMessage()));});}catch{}var yi;try{typeof window<"u"&&window.postMessage&&window.parent!==window&&!window.location.pathname.startsWith("/edit")&&(yi=r(n=>{try{let e=n.toMessage().map(s=>st(s)),t=n.logger,i=n.level,o=t.level<=n.level,a={loggerId:t.id,level:i,parts:e,printed:o};window.parent?.postMessage(a,zt().app);}catch{}},"postLogEntry"));}catch{}var fi={},j=[],Zr=1e3;function de(n,e,t){let i=new lt(n,e,t);for(j.push(i),yi?.(i);j.length>Zr;)j.shift();return i}r(de,"createLogEntry");function Jr(n){return typeof n=="number"&&(Zr=n),j}r(Jr,"getLogReplayBuffer");var Ha=/\/(?<filename>[^/.]+)(?=\.(?:debug\.)?html$)/u,Hr;function _a(){if(!(typeof window>"u"||!window.location))return Hr??=Ha.exec(window.location.pathname)?.groups?.filename,Hr}r(_a,"getFilenameFromWindowPathname");function dt(n){let e=_a();n=(e?e+":":"")+n;let t=fi[n];if(t)return t;let i=new Kt(n);return fi[n]=i,Yr(H,[i]),yi?.(new lt(i,-1,[])),i}r(dt,"getLogger");function Qr(n,e=true){try{typeof window<"u"&&window.localStorage&&(window.localStorage.logLevel=n);}catch{}let t=H;H=n;let i=Object.values(fi);for(let a of i)a.level=3;let o=Yr(n,i);if(o.length>0&&console?.warn("Some log level specs matched no loggers:",o),e&&j.length>0){console?.log("--- LOG REPLAY ---");for(let a of j)a.logger.level>a.level||(a.level>=3?console?.warn(...a.toConsoleMessage()):console?.log(...a.toConsoleMessage()));console?.log("--- END OF LOG REPLAY ---");}return t}r(Qr,"setLogLevel");function eo(n){let e=Gt;Gt=n;for(let t of j)t.resetMessagePrefix();try{typeof window<"u"&&window.localStorage&&(window.localStorage[_r]=String(n));}catch{}return e}r(eo,"setLogTimestamps");var qa=r(n=>{let e={...n,logs:Jr().slice(-50).map(t=>t.toString().slice(0,600)).join(`
|
|
9
|
+
`)};return n.logs&&console?.warn("extras.logs is reserved for log replay buffer, use another key"),e},"enrichWithLogs"),Kt=class{constructor(e,t){this.id=e;this.errorIsCritical=t??(e==="fatal"||e.endsWith(":fatal"));}id;static{r(this,"Logger");}level=3;didLog={};errorIsCritical;extend(e){let t=this.id+":"+e;return dt(t)}getBufferedMessages(){return j.filter(e=>e.logger===this)}setLevel(e){let t=this.level;return this.level=e,t}isLoggingTraceMessages(){return this.level>=0}trace=r((...e)=>{if(this.level>0)return;let t=de(this,0,e);console?.log(...t.toConsoleMessage());},"trace");debug=r((...e)=>{let t=de(this,1,e);this.level>1||console?.log(...t.toConsoleMessage());},"debug");info=r((...e)=>{let t=de(this,2,e);this.level>2||console?.info(...t.toConsoleMessage());},"info");warn=r((...e)=>{let t=de(this,3,e);this.level>3||console?.warn(...t.toConsoleMessage());},"warn");warnOncePerMinute=r((e,...t)=>{let i=this.didLog[e];if(i&&i>Date.now())return;this.didLog[e]=Date.now()+1e3*60,t.unshift(e);let o=de(this,3,t);this.level>3||console?.warn(...o.toConsoleMessage());},"warnOncePerMinute");error=r((...e)=>{let t=de(this,4,e);this.level>4||console?.error(...t.toConsoleMessage());},"error");errorOncePerMinute=r((e,...t)=>{let i=this.didLog[e];if(i&&i>Date.now())return;this.didLog[e]=Date.now()+1e3*60,t.unshift(e);let o=de(this,4,t);this.level>4||console?.error(...o.toConsoleMessage());},"errorOncePerMinute");reportWithoutLogging=r((e,t,i,o)=>{let a=qa(t??{}),s=Kr({caller:this.reportWithoutLogging,error:e,tags:{...i,handler:"logger",where:this.id},extras:t,critical:o??this.errorIsCritical});return [a,s]},"reportWithoutLogging");reportError=r((e,t,i,o)=>{let[a,s]=this.reportWithoutLogging(e,t,i,o);a?this.error(s,a):this.error(s);},"reportError");reportErrorWithThrottle=r((e,t,i,o,a)=>{if(!Ya(t))return;let s=this.didLog[t.message];s&&s>Date.now()||(this.didLog[t.message]=Date.now()+e,this.reportError(t,i,o,a));},"reportErrorWithThrottle");reportErrorOncePerMinute=r((e,t,i,o)=>this.reportErrorWithThrottle(1e3*60,e,t,i,o),"reportErrorOncePerMinute");reportErrorOnceEveryTenMinutes=r((e,t,i,o)=>this.reportErrorWithThrottle(1e3*60*10,e,t,i,o),"reportErrorOnceEveryTenMinutes");reportCriticalError=r((e,t,i)=>this.reportError(e,t,i,true),"reportCriticalError")};function Ya(n){return Object.prototype.hasOwnProperty.call(n,"message")}r(Ya,"isErrorWithMessage");function to(n){return n.replace(/[/\-\\^$*+?.()|[\]{}]/gu,"\\$&")}r(to,"escapeRegExp");function Xa(n,e,t){let i=gi[t];if(!i)return n;let o=`${i}: [${e}]`,a=to(o).replace("\\[","\\*?\\["),s=new RegExp(`^(?:T?\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z\\s+)?${a}\\s*`);return n.replace(s,"")}r(Xa,"stripLogEntryPrefix");var ro;(_=>{function n(b,...p){return b.concat(p)}_.push=n,r(n,"push");function e(b){return b.slice(0,-1)}_.pop=e,r(e,"pop");function t(b,...p){return p.concat(b)}_.unshift=t,r(t,"unshift");function i(b,p,...P){let m=b.length;if(p<0||p>m)throw Error("index out of range: "+p);let h=b.slice();return h.splice(p,0,...P),h}_.insert=i,r(i,"insert");function o(b,p,P){let m=b.length;if(p<0||p>=m)throw Error("index out of range: "+p);let h=Array.isArray(P)?P:[P],M=b.slice();return M.splice(p,1,...h),M}_.replace=o,r(o,"replace");function a(b,p){let P=b.length;if(p<0||p>=P)throw Error("index out of range: "+p);let m=b.slice();return m.splice(p,1),m}_.remove=a,r(a,"remove");function s(b,p,P){let m=b.length;if(p<0||p>=m)throw Error("from index out of range: "+p);if(P<0||P>=m)throw Error("to index out of range: "+P);let h=b.slice();if(P===p)return h;let M=h[p];return p<P?(h.splice(P+1,0,M),h.splice(p,1)):(h.splice(p,1),h.splice(P,0,M)),h}_.move=s,r(s,"move");function d(b,p){let P=[],m=Math.min(b.length,p.length);for(let h=0;h<m;h++)P.push([b[h],p[h]]);return P}_.zip=d,r(d,"zip");function u(b,p,P){let m=b.slice(),h=m[p];return h===void 0||(m[p]=P(h)),m}_.update=u,r(u,"update");function T(b){return Array.from(new Set(b))}_.unique=T,r(T,"unique");function F(b,...p){return Array.from(new Set([...b,...p.flat()]))}_.union=F,r(F,"union");function O(b,p){return b.filter(p)}_.filter=O,r(O,"filter");})(ro||={});var ns=Object.prototype.hasOwnProperty;function is(n,e){return ns.call(n,e)}r(is,"hasOwnProperty");var oo;(i=>{function n(o,a){for(let s of Object.keys(o))is(a,s)||delete o[s];for(let s of Object.keys(a))o[s]===void 0&&(o[s]=a[s]);return Object.setPrototypeOf(o,Object.getPrototypeOf(a)),o}i.morphUsingTemplate=n,r(n,"morphUsingTemplate");function e(o,a){a&&Object.assign(o,a);}i.writeOnce=e,r(e,"writeOnce");function t(o,a){return Object.assign(Object.create(Object.getPrototypeOf(o)),o,a)}i.update=t,r(t,"update");})(oo||={});var ao;(o=>{function n(a,...s){return new Set([...a,...s])}o.add=n,r(n,"add");function e(a,...s){let d=new Set(a);for(let u of s)d.delete(u);return d}o.remove=e,r(e,"remove");function t(...a){let s=new Set;for(let d of a)for(let u of d)s.add(u);return s}o.union=t,r(t,"union");function i(a,s){return a.has(s)?o.remove(a,s):o.add(a,s)}o.toggle=i,r(i,"toggle");})(ao||={});var so;(i=>{function n(o,...a){let s=new Map;o.forEach((u,T)=>s.set(T,u));let d=false;for(let u of a)u&&(u.forEach((T,F)=>s.set(F,T)),d=true);return d?s:o}i.merge=n,r(n,"merge");function e(o,a,s){let d=new Map(o);return d.set(a,s),d}i.set=e,r(e,"set");function t(o,a){let s=new Map(o);return s.delete(a),s}i.remove=t,r(t,"remove");})(so||={});var $t=class extends Promise{static{r(this,"ResolvablePromise");}_state="initial";resolve;reject;get state(){return this._state}pending(){return this._state="pending",this}isResolved(){return this._state==="fulfilled"||this._state==="rejected"}constructor(){let e,t;super((i,o)=>{e=i,t=o;}),this.resolve=i=>{this._state="fulfilled",e(i);},this.reject=i=>{this._state="rejected",t(i);};}};$t.prototype.constructor=Promise;dt("task-queue");function lo(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}r(lo,"isObject");var ss=-1,jt=class{static{r(this,"WebSocketTransport");}onError;closed=false;ws;messageHandlers=new Set;chunkBuffers=new Map;constructor(e){this.ws=e,this.setupListeners();}setupListeners(){this.ws.addEventListener("close",this.handleClose),this.ws.addEventListener("message",this.handleMessage);}removeListeners(){this.ws.removeEventListener("close",this.handleClose),this.ws.removeEventListener("message",this.handleMessage);}handleClose=r(()=>{this.removeListeners(),this.closed=true,this.chunkBuffers.clear(),this.onError?.(new D("Connection closed","PROJECT_CLOSED"));},"handleClose");handleMessage=r(e=>{let t=typeof e.data=="string"?e.data:String(e.data),i=this.tryParseChunkEnvelope(t);if(i){let o=this.handleChunk(i);if(!o)return;let a=new MessageEvent("message",{data:o});if(this.tryHandleDebugArchive(o))return;for(let s of this.messageHandlers)s(a);return}if(!this.tryHandleDebugArchive(t))for(let o of this.messageHandlers)o(e);},"handleMessage");tryHandleDebugArchive(e){try{let t=ue.parse(e);if(lo(t)&&t.type==="debug-archive")return bi(t.data),!0}catch{}return false}replaceSocket(e){this.removeListeners(),this.chunkBuffers.clear(),this.ws=e,this.closed=false,this.setupListeners();}setOnError(e){this.onError=e;}send(e){if(this.closed)throw new D("Connection closed","PROJECT_CLOSED");this.ws.send(ue.stringify(e,{[Et]:t=>In(t)&&L(t)}));}handleChunk(e){let t=this.chunkBuffers.get(e.id);return t||(t=[],this.chunkBuffers.set(e.id,t)),t.push(e.data),e.seq===ss?(this.chunkBuffers.delete(e.id),t.join("")):null}tryParseChunkEnvelope(e){if(!e.startsWith('{"$chunk":'))return null;try{let t=JSON.parse(e);if(t.$chunk===1&&typeof t.id=="string"&&typeof t.seq=="number")return t}catch{}return null}onMessage(e){let t=r(i=>{let o=typeof i.data=="string"?i.data:String(i.data);this.dispatchMessage(o,e);},"listener");this.messageHandlers.add(t);}dispatchMessage(e,t){let i=ue.parse(e);if(lo(i)&&i.type==="error"){let o=i.message||JSON.stringify(i),a=i.code??"INTERNAL";N.error(`Server error: ${o}`),this.onError?.(new D(`Server error: ${o}`,a));return}t(i);}};function bi(n){ee(si,"File system module is not available."),ee(li,"Path module is not available.");let t=`debug-archive-${new Date().toISOString().replace(/[:.]/gu,"-")}.zip`,i=process.cwd(),o=li.resolve(i,t);si.writeFileSync(o,Buffer.from(n)),N.info(`Debug archive saved to ${o}`);}r(bi,"handleDebugArchive");function Te(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}r(Te,"isObject");var ls={type:"pluginReadySignal"};function ds(n){return Te(n)&&n.type==="pluginReadyResponse"}r(ds,"isPluginReadyResponse");var uo=9e4,us=2e4;function cs(n,e){return new Promise(t=>{let i=setTimeout(()=>{n.removeEventListener("message",o),t();},e),o=r(a=>{if(!(typeof a.data!="string"&&!(a.data instanceof String)))try{let s=ue.parse(a.data);Te(s)&&s.type==="disconnect-ack"&&(clearTimeout(i),n.removeEventListener("message",o),t());}catch{}},"handler");n.addEventListener("message",o);})}r(cs,"waitForDisconnectAck");async function ps(n,e){let t={Authorization:`Token ${e}`};if(Vr)return N.debug("Using Cloudflare Workers WebSocket connection"),Lr(n,t);if(isDeno)return new ai(n.href,[`token.${e}`]);let i=n.hostname==="api.framerlocal.com",o=process.env.NODE_TLS_REJECT_UNAUTHORIZED;i&&(process.env.NODE_TLS_REJECT_UNAUTHORIZED="0"),N.debug("Using standard WebSocket connection");let a=new ai(n.href,{headers:t});return i&&(process.env.NODE_TLS_REJECT_UNAUTHORIZED=o),a}r(ps,"createWebSocket");async function Ht(n,e,t,i){let o=new URL(i??Ie("FRAMER_HEADLESS_SERVER_URL",zr));o.protocol=o.protocol==="https:"?"wss:":o.protocol==="http:"?"ws:":o.protocol,o.searchParams.set("projectId",n),o.searchParams.set("sdkVersion",Ut),t&&o.searchParams.set("clientId",t),N.debug(`Connecting to ${o.href}`);let a=await ps(o,e);N.debug(`WebSocket created, readyState: ${a.readyState}`);let s,d,u=N,T=false,F=setInterval(()=>{a.readyState===a.OPEN&&(a.send(ue.stringify({type:"ping"})),u.debug("Sent ping"));},us),O=r(()=>{clearInterval(F),a.readyState!==a.CLOSED&&a.readyState!==a.CLOSING&&a.close(1e3,"Client disconnect");},"forceClose"),_=r(async()=>{clearInterval(F),!(a.readyState===a.CLOSED||a.readyState===a.CLOSING)&&(T&&(u.debug("Initiating graceful disconnect"),a.send(ue.stringify({type:"client-disconnect"})),await cs(a,15e3)),a.readyState!==a.CLOSED&&a.readyState!==a.CLOSING&&a.close(1e3,"Client disconnect"));},"cleanup"),b=await new Promise((p,P)=>{let m=setTimeout(()=>{O(),P(new D(`Connection timeout after ${uo}ms`,"TIMEOUT"));},uo),h=r(()=>{u.debug("WebSocket opened, waiting for ready");},"onOpen"),M=r(A=>{u.debug("WebSocket error:",A),clearTimeout(m),O(),P(new D("No connection to the server","INTERNAL"));},"onError"),z=r(A=>{u.debug(`WebSocket closed: code=${A.code}, reason=${A.reason||"(no reason)"}, wasClean=${A.wasClean}`),clearTimeout(m),clearInterval(F),P(new D(`Connection to the server was closed (code: ${A.code})`,"PROJECT_CLOSED"));},"onClose");function te(A){u.debug("Received message");let ct=typeof A.data=="string"?A.data:A.data.toString(),v=ue.parse(ct);if(u.debug(`Message type: ${v.type}`),v.type==="error"){clearTimeout(m),a.removeEventListener("close",z),a.removeEventListener("error",M);let ce=Ur(v.code);P(new D(v.message||"Server error",ce)),O();}else v.type==="ready"?(Te(v)&&"requestId"in v&&(s=String(v.requestId),u=N.withRequestId(s),u.debug(`Server request ID: ${s}`)),Te(v)&&"sessionId"in v&&(d=String(v.sessionId),u.debug(`Server session ID: ${d}`)),Te(v)&&"version"in v&&u.debug(`Server version: ${v.version}`),Te(v)&&v.gracefulDisconnect===true&&(T=true),u.debug("Sending pluginReadySignal"),a.send(ue.stringify(ls))):v.type==="debug-archive"?bi(v.data):ds(v)&&(clearTimeout(m),a.removeEventListener("message",te),a.removeEventListener("error",M),a.removeEventListener("close",z),p(v));}r(te,"handshakeMessageHandler"),a.addEventListener("open",h),a.addEventListener("message",te),a.addEventListener("error",M),a.addEventListener("close",z);});return a.addEventListener("close",()=>{_();}),{ws:a,pluginReadyData:b,requestId:s,sessionId:d,clientId:t,logger:u,gracefulDisconnect:T,cleanup:_}}r(Ht,"connectAndHandshake");var co={showUI:false,hideUI:false,closePlugin:false,setCloseWarning:true,notify:false,setMenu:false,showContextMenu:false,preloadDetachedComponentLayers:false,preloadDragPreviewImage:false,preloadImageUrlForInsertion:false,setBackgroundMessage:false,getSelection:false,getActiveCollection:false,getActiveManagedCollection:false,getActiveLocale:false,zoomIntoView:false,navigateTo:false,getPluginData:false,setPluginData:false,getPluginDataKeys:false,makeDraggable:false,subscribeToSelection:false,subscribeToImage:false,subscribeToText:false,subscribeToCustomCode:false,subscribeToColorStyles:false,subscribeToTextStyles:false,subscribeToRedirects:false,subscribeToCodeFiles:false,subscribeToOpenCodeFile:false,subscribeToIsAllowedTo:false,subscribeToCanvasRoot:false,subscribeToPublishInfo:false,unstable_ensureMinimumDependencyVersion:false,removeNode:true,removeNodes:true,addSVG:true,getRect:true,setText:true,getText:true,addText:true,setCustomCode:true,getCustomCode:true,getLocales:true,getDefaultLocale:true,getLocalizationGroups:true,setLocalizationData:true,createLocale:true,getLocaleLanguages:true,getLocaleRegions:true,getCurrentUser:true,getProjectInfo:true,setSelection:true,getCanvasRoot:true,getPublishInfo:true,cloneNode:true,getNode:true,getParent:true,getChildren:true,setAttributes:true,getNodesWithType:true,getNodesWithAttribute:true,getNodesWithAttributeSet:true,addImages:true,getImage:true,addImage:true,setImage:true,uploadImage:true,uploadImages:true,uploadFile:true,uploadFiles:true,setParent:true,addComponentInstance:true,addDetachedComponentLayers:true,getManagedCollection:true,getManagedCollections:true,getCollection:true,getCollections:true,getColorStyle:true,getColorStyles:true,createColorStyle:true,getTextStyle:true,getTextStyles:true,createTextStyle:true,getFont:true,getFonts:true,createCodeFile:true,getCodeFiles:true,getCodeFile:true,lintCode:true,typecheckCode:true,addRedirects:true,getRedirects:true,setRedirectOrder:true,removeRedirects:true,addComponentInstancePlaceholder:true,createCollection:true,getVectorSets:true,createDesignPage:true,createWebPage:true,createTextNode:true,createComponentNode:true,mode:true,isAllowedTo:false,createFrameNode:true,createManagedCollection:true};function xi(n){return n in co?co[n]===true:false}r(xi,"isAllowedMethod");var _t=class n{static{r(this,"FramerAPI");}requestId;sessionId;#e;#t;#n;#i=new Map;#r=new Map;#p=0;#a;#s;#l;#d;constructor(e){this.#t=e.pluginAPI,this.#n=e.transport,this.#e=e.cleanup,this.#a=e.projectId,this.#s=e.apiKey,this.#l=e.serverUrl,this.requestId=e.requestId,this.sessionId=e.sessionId,this.#d=e.clientId,this.#n.onMessage(t=>{this.#m(t);}),this.#n.setOnError(t=>{this.#u(t);});}#u(e){for(let t of this.#i.values())t.reject(e);this.#i.clear();for(let t of this.#r.values())t.reject(e);this.#r.clear(),this.#t[x.rejectAllPending](e);}#c(){return `req-${++this.#p}-${Date.now()}`}#m=r(e=>{switch(e.type){case "screenshotResult":{let t=this.#i.get(e.id);if(t){this.#i.delete(e.id);let i=Buffer.from(e.data,"base64");t.resolve({data:i,mimeType:e.mimeType});}return true}case "screenshotError":{let t=this.#i.get(e.id);if(t){this.#i.delete(e.id);let i=e.code??"INTERNAL";t.reject(new D(e.error,i));}return true}case "exportSVGResult":{let t=this.#r.get(e.id);return t&&(this.#r.delete(e.id),t.resolve(e.data)),true}case "exportSVGError":{let t=this.#r.get(e.id);if(t){this.#r.delete(e.id);let i=e.code??"INTERNAL";t.reject(new D(e.error,i));}return true}default:return false}},"#handleServerApiResponse");static create(e){let t=new n(e);return new Proxy(t,{get(i,o){if(o in i)return Reflect.get(i,o);if(Jn(o)){let s=x[o],d=Reflect.get(i.#t,s);return typeof d=="function"?d.bind(i.#t):d}if(!xi(o))return;let a=Reflect.get(i.#t,o);return typeof a=="function"?a.bind(i.#t):a},has(i,o){return o in i||Jn(o)?true:xi(o)?o in i.#t:false}})}async#o(){this.#u(new D("Connection closed","PROJECT_CLOSED")),await this.#e();}disconnect=r(()=>this.#o(),"disconnect");reconnect=r(async()=>{await this.#o();let e=await Ht(this.#a,this.#s,this.#d,this.#l);this.#n.replaceSocket(e.ws),this.#e=e.cleanup,this.requestId=e.requestId,this.sessionId=e.sessionId;},"reconnect");screenshot=r((e,t)=>{let i=this.#c(),{format:o,quality:a,scale:s,clip:d}=t??{};return new Promise((u,T)=>{this.#i.set(i,{resolve:u,reject:T}),this.#n.send({type:"screenshot",id:i,nodeId:e,format:o,quality:a,scale:s,clip:d});})},"screenshot");exportSVG=r(e=>{let t=this.#c();return new Promise((i,o)=>{this.#r.set(t,{resolve:i,reject:o}),this.#n.send({type:"exportSVG",id:t,nodeId:e});})},"exportSVG");[Symbol.dispose]=()=>{this.#o();};[Symbol.asyncDispose]=()=>this.#o()};var ms=/^.+--([A-Za-z0-9]+)/u,po=/^[A-Za-z0-9]{20}$/u;function mo(n){if(po.test(n))return n;try{let t=new URL(n,"https://framer.com").pathname.split("/").filter(Boolean),i=t.findIndex(o=>o.toLowerCase()==="projects");if(i>=0){let o=t[i+1];if(o!==void 0){let a=decodeURIComponent(o),d=a.match(ms)?.[1]??a;if(po.test(d))return d}}return null}catch{return null}}r(mo,"parseProjectId");async function go(n,e,t){let i=performance.now();if(!n)throw new D("FRAMER_PROJECT_URL environment variable is required","INVALID_REQUEST");let o=mo(n);if(!o)throw new D(`Invalid project URL or ID: ${n}`,"INVALID_REQUEST");let a=e??Ie("FRAMER_API_KEY");if(!a)throw new D("FRAMER_API_KEY environment variable is required","INVALID_REQUEST");let s=t?.clientId?.trim()||`framer-api/${Ut}`,d=await Ht(o,a,s,t?.serverUrl);try{let u=new jt(d.ws),T={transport:u,mode:d.pluginReadyData.mode,permissionMap:d.pluginReadyData.permissionMap,environmentInfo:d.pluginReadyData.environmentInfo,origin:null,theme:null,initialState:d.pluginReadyData.initialState},F=Mr(T),O=r(async()=>{let _=((performance.now()-i)/1e3).toFixed(2);d.logger.debug(`Connection ended after ${_}s`),await d.cleanup();},"cleanup");return _t.create({pluginAPI:F,transport:u,cleanup:O,projectId:o,apiKey:a,serverUrl:t?.serverUrl,clientId:d.clientId,requestId:d.requestId,sessionId:d.sessionId})}catch(u){throw await d.cleanup(),u}}r(go,"connect");async function gs(n,e,t,i){let o=await go(n,t,i);try{return await e(o)}finally{await o.disconnect();}}r(gs,"withConnection");
|
|
10
|
+
export{Va as $framerApiInternal,bt as BooleanField,ve as BooleanVariable,We as BorderVariable,kt as CollectionReferenceField,xt as ColorField,Ee as ColorVariable,Xe as ComponentInstanceNode,ae as ComponentNode,je as ConicGradient,St as DateField,Le as DateVariable,$ as DesignPageNode,Y as EnumCase,Dt as EnumField,Ae as EnumVariable,le as ErrorCode,Ft as FieldDivider,vt as FileField,we as FileVariable,Tt as FormattedTextField,Ne as FormattedTextVariable,U as FrameNode,D as FramerAPIError,J as FramerPluginClosedError,tt as FramerPluginError,Be as ImageField,Me as ImageVariable,Ke as LinearGradient,Pt as LinkField,Ve as LinkVariable,Nt as MultiCollectionReferenceField,Ct as NumberField,De as NumberVariable,$e as RadialGradient,qe as SVGNode,It as StringField,ke as StringVariable,oe as TextNode,Ge as UnsupportedComputedValue,Ue as UnsupportedField,Re as UnsupportedVariable,et as VectorSet,Vt as VectorSetItem,Ye as VectorSetItemNode,Ze as VectorSetNode,K as WebPageNode,Ea as configure,go as connect,se as framer,ed as hasGridLayout,Ql as hasStackLayout,yr as isBreakpoint,Pa as isCodeFileComponentExport,Sa as isCodeFileOverrideExport,ye as isColorStyle,fr as isComponentGestureVariant,be as isComponentInstanceNode,Cr as isComponentNode,Ho as isComponentVariable,Pn as isComponentVariant,ta as isComputedValue,Ir as isDesignPageNode,_o as isField,Yo as isFileAsset,wt as isFrameNode,Zo as isImageAsset,Ma as isRetryableError,br as isSVGNode,hr as isTextNode,Tn as isTextStyle,Pi as isVariable,Pr as isVectorSetItemNode,Tr as isVectorSetNode,xr as isWebPageNode,kl as supportsAspectRatio,Ml as supportsBackgroundColor,wl as supportsBackgroundColorData,Wl as supportsBackgroundGradient,Rl as supportsBackgroundGradientData,Vl as supportsBackgroundImage,Ll as supportsBackgroundImageData,zl as supportsBorder,Ol as supportsBorderRadius,ya as supportsBreakpoint,Hl as supportsComponentInfo,gr as supportsComponentVariant,_l as supportsFont,ql as supportsFontData,Jl as supportsImageRendering,Yl as supportsInlineTextStyle,Xl as supportsInlineTextStyleData,mr as supportsLayout,Zl as supportsLink,El as supportsLocked,Nl as supportsName,Ul as supportsOpacity,jl as supportsOverflow,Fl as supportsPins,Sl as supportsPosition,Bl as supportsRotation,Gl as supportsSVG,vl as supportsSize,Dl as supportsSizeConstraints,Kl as supportsTextTruncation,Al as supportsVisible,$l as supportsZIndex,gs as withConnection};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "framer-api",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@swc/jest": "^0.2.37",
|
|
44
44
|
"@types/node": "24.10.15",
|
|
45
45
|
"eslint-plugin-framer-studio": "1.0.0",
|
|
46
|
-
"framer-plugin": "3.11.0-alpha.
|
|
46
|
+
"framer-plugin": "3.11.0-alpha.13",
|
|
47
47
|
"tsup": "^8.5.1",
|
|
48
48
|
"tsx": "^4.19.2",
|
|
49
49
|
"typescript": "^5.9.2",
|