framer-api 0.1.2 → 0.1.4
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 +52 -5
- package/dist/index.js +8 -8
- package/package.json +3 -6
package/dist/index.d.ts
CHANGED
|
@@ -91,6 +91,8 @@ interface TypecheckDiagnostic extends DiagnosticBase {
|
|
|
91
91
|
|
|
92
92
|
declare const getAiServiceInfo: unique symbol;
|
|
93
93
|
declare const sendTrackingEvent: unique symbol;
|
|
94
|
+
declare const getCurrentUser: unique symbol;
|
|
95
|
+
declare const getProjectInfo: unique symbol;
|
|
94
96
|
declare const environmentInfo: unique symbol;
|
|
95
97
|
declare const initialState: unique symbol;
|
|
96
98
|
declare const showUncheckedPermissionToasts: unique symbol;
|
|
@@ -101,6 +103,8 @@ declare const setHTMLForNode: unique symbol;
|
|
|
101
103
|
declare const $framerInternal: {
|
|
102
104
|
readonly getAiServiceInfo: typeof getAiServiceInfo;
|
|
103
105
|
readonly sendTrackingEvent: typeof sendTrackingEvent;
|
|
106
|
+
readonly getCurrentUser: typeof getCurrentUser;
|
|
107
|
+
readonly getProjectInfo: typeof getProjectInfo;
|
|
104
108
|
readonly environmentInfo: typeof environmentInfo;
|
|
105
109
|
readonly initialState: typeof initialState;
|
|
106
110
|
readonly showUncheckedPermissionToasts: typeof showUncheckedPermissionToasts;
|
|
@@ -111,6 +115,8 @@ declare const $framerInternal: {
|
|
|
111
115
|
};
|
|
112
116
|
declare const getAiServiceInfoMessageType = "INTERNAL_getAiServiceInfo";
|
|
113
117
|
declare const sendTrackingEventMessageType = "INTERNAL_sendTrackingEvent";
|
|
118
|
+
declare const getCurrentUserMessageType = "INTERNAL_getCurrentUser";
|
|
119
|
+
declare const getProjectInfoMessageType = "INTERNAL_getProjectInfo";
|
|
114
120
|
declare const getHTMLForNodeMessageType = "INTERNAL_getHTMLForNode";
|
|
115
121
|
declare const setHTMLForNodeMessageType = "INTERNAL_setHTMLForNode";
|
|
116
122
|
|
|
@@ -585,7 +591,7 @@ interface Location {
|
|
|
585
591
|
}
|
|
586
592
|
interface LocationControl extends ControlBase {
|
|
587
593
|
type: "location";
|
|
588
|
-
value?: Location | undefined;
|
|
594
|
+
value?: Location | UnsupportedVariable | undefined;
|
|
589
595
|
}
|
|
590
596
|
interface ImageControl extends ControlBase {
|
|
591
597
|
type: "image";
|
|
@@ -3402,7 +3408,7 @@ declare abstract class NodeMethods implements WithIdTrait, Navigable {
|
|
|
3402
3408
|
*
|
|
3403
3409
|
* Use `"Node.clone"` to check if this method is allowed.
|
|
3404
3410
|
*/
|
|
3405
|
-
clone(): Promise<
|
|
3411
|
+
clone(): Promise<typeof this | null>;
|
|
3406
3412
|
/**
|
|
3407
3413
|
* Set the attributes of this node. Attributes are merged with existing
|
|
3408
3414
|
* values, so only the provided attributes are updated.
|
|
@@ -3790,6 +3796,9 @@ declare class ComponentInstanceNode extends NodeMethods implements EditableCompo
|
|
|
3790
3796
|
getRuntimeError(): Promise<NodeRuntimeErrorResult | null>;
|
|
3791
3797
|
}
|
|
3792
3798
|
type EditableWebPageNodeAttributes = object;
|
|
3799
|
+
interface WebPageCloneOptions {
|
|
3800
|
+
path?: string;
|
|
3801
|
+
}
|
|
3793
3802
|
interface WebPageNodeData extends CommonNodeData, Partial<WithWebPageInfoTrait> {
|
|
3794
3803
|
[classKey]: "WebPageNode";
|
|
3795
3804
|
}
|
|
@@ -3810,6 +3819,11 @@ declare class WebPageNode extends NodeMethods implements EditableWebPageNodeAttr
|
|
|
3810
3819
|
*/
|
|
3811
3820
|
readonly collectionId: string | null;
|
|
3812
3821
|
constructor(rawData: WebPageNodeData, engine: PluginEngine);
|
|
3822
|
+
/**
|
|
3823
|
+
* Clone the WebPageNode into a new one with the same content and settings, as a draft
|
|
3824
|
+
* If the given path already exists, the cloned page will be created with a unique path.
|
|
3825
|
+
*/
|
|
3826
|
+
clone(options?: WebPageCloneOptions): Promise<this>;
|
|
3813
3827
|
/**
|
|
3814
3828
|
* Get a list of breakpoints suggestions that can be added to the WebPage.
|
|
3815
3829
|
*
|
|
@@ -3914,14 +3928,23 @@ declare class VectorSetNode extends NodeMethods implements EditableVectorSetNode
|
|
|
3914
3928
|
constructor(rawData: VectorSetNodeData, engine: PluginEngine);
|
|
3915
3929
|
}
|
|
3916
3930
|
type EditableDesignPageNodeAttributes = WithNameTrait;
|
|
3931
|
+
interface DesignPageCloneOptions {
|
|
3932
|
+
name?: string;
|
|
3933
|
+
}
|
|
3917
3934
|
interface DesignPageNodeData extends CommonNodeData, Partial<WithNameTrait> {
|
|
3918
3935
|
[classKey]: "DesignPageNode";
|
|
3919
3936
|
}
|
|
3920
3937
|
/** A design page (non-web canvas) in the project. */
|
|
3921
3938
|
declare class DesignPageNode extends NodeMethods implements EditableDesignPageNodeAttributes {
|
|
3939
|
+
#private;
|
|
3922
3940
|
readonly [classKey]: DesignPageNodeData[ClassKey];
|
|
3923
3941
|
readonly name: string | null;
|
|
3924
3942
|
constructor(rawData: DesignPageNodeData, engine: PluginEngine);
|
|
3943
|
+
/**
|
|
3944
|
+
* Clone the DesignPageNode into a new one with the same content
|
|
3945
|
+
* If the given name already exists, the cloned page will be created with a unique name.
|
|
3946
|
+
*/
|
|
3947
|
+
clone(options?: DesignPageCloneOptions): Promise<this>;
|
|
3925
3948
|
}
|
|
3926
3949
|
interface UnknownNodeData extends CommonNodeData {
|
|
3927
3950
|
[classKey]: "UnknownNode";
|
|
@@ -3934,6 +3957,7 @@ interface UnknownNodeData extends CommonNodeData {
|
|
|
3934
3957
|
declare class UnknownNode extends NodeMethods {
|
|
3935
3958
|
readonly [classKey]: UnknownNodeData[ClassKey];
|
|
3936
3959
|
constructor(rawData: UnknownNodeData, engine: PluginEngine);
|
|
3960
|
+
clone(): Promise<never>;
|
|
3937
3961
|
}
|
|
3938
3962
|
type CanvasRootNode = WebPageNode | DesignPageNode | ComponentNode | VectorSetNode | UnknownNode;
|
|
3939
3963
|
type CanvasNode = FrameNode | TextNode | ComponentInstanceNode | SVGNode | VectorSetItemNode | UnknownNode;
|
|
@@ -4367,8 +4391,11 @@ type PermissionMap = {
|
|
|
4367
4391
|
type NamespaceMembers<Class, Namespace extends string, Parent = undefined> = {
|
|
4368
4392
|
[Member in Exclude<keyof Class, keyof Parent> as Member extends string ? `${Namespace}.${Member}` : never]: Class[Member];
|
|
4369
4393
|
};
|
|
4370
|
-
type AllMembers = Omit<FramerPluginAPIAlpha, "isAllowedTo" | "subscribeToIsAllowedTo"> & NamespaceMembers<ImageAsset, "ImageAsset"> & NamespaceMembers<CodeFile, "CodeFile"> & NamespaceMembers<CodeFileVersion, "CodeFileVersion"> & NamespaceMembers<ComponentInstancePlaceholder, "ComponentInstancePlaceholder"> & NamespaceMembers<Field, "Field"> & NamespaceMembers<BooleanField, "BooleanField", Field> & NamespaceMembers<ColorField, "ColorField", Field> & NamespaceMembers<NumberField, "NumberField", Field> & NamespaceMembers<StringField, "StringField", Field> & NamespaceMembers<FormattedTextField, "FormattedTextField", Field> & NamespaceMembers<ImageField, "ImageField", Field> & NamespaceMembers<LinkField, "LinkField", Field> & NamespaceMembers<DateField, "DateField", Field> & NamespaceMembers<FieldDivider, "FieldDivider", Field> & NamespaceMembers<UnsupportedField, "UnsupportedField", Field> & NamespaceMembers<FileField, "FileField", Field> & NamespaceMembers<EnumField, "EnumField", Field> & NamespaceMembers<CollectionReferenceField, "CollectionReferenceField", Field> & NamespaceMembers<MultiCollectionReferenceField, "MultiCollectionReferenceField", Field> & NamespaceMembers<ManagedCollection, "ManagedCollection"> & NamespaceMembers<Collection, "Collection"> & NamespaceMembers<CollectionItem, "CollectionItem"> & NamespaceMembers<NodeMethods, "Node"> & NamespaceMembers<FrameNode, "FrameNode", NodeMethods> & NamespaceMembers<TextNode, "TextNode", NodeMethods> & NamespaceMembers<SVGNode, "SVGNode", NodeMethods> & NamespaceMembers<ComponentInstanceNode, "ComponentInstanceNode", NodeMethods> & NamespaceMembers<
|
|
4371
|
-
|
|
4394
|
+
type AllMembers = Omit<FramerPluginAPIAlpha, "isAllowedTo" | "subscribeToIsAllowedTo"> & NamespaceMembers<ImageAsset, "ImageAsset"> & NamespaceMembers<CodeFile, "CodeFile"> & NamespaceMembers<CodeFileVersion, "CodeFileVersion"> & NamespaceMembers<ComponentInstancePlaceholder, "ComponentInstancePlaceholder"> & NamespaceMembers<Field, "Field"> & NamespaceMembers<BooleanField, "BooleanField", Field> & NamespaceMembers<ColorField, "ColorField", Field> & NamespaceMembers<NumberField, "NumberField", Field> & NamespaceMembers<StringField, "StringField", Field> & NamespaceMembers<FormattedTextField, "FormattedTextField", Field> & NamespaceMembers<ImageField, "ImageField", Field> & NamespaceMembers<LinkField, "LinkField", Field> & NamespaceMembers<DateField, "DateField", Field> & NamespaceMembers<FieldDivider, "FieldDivider", Field> & NamespaceMembers<UnsupportedField, "UnsupportedField", Field> & NamespaceMembers<FileField, "FileField", Field> & NamespaceMembers<EnumField, "EnumField", Field> & NamespaceMembers<CollectionReferenceField, "CollectionReferenceField", Field> & NamespaceMembers<MultiCollectionReferenceField, "MultiCollectionReferenceField", Field> & NamespaceMembers<ManagedCollection, "ManagedCollection"> & NamespaceMembers<Collection, "Collection"> & NamespaceMembers<CollectionItem, "CollectionItem"> & NamespaceMembers<NodeMethods, "Node"> & NamespaceMembers<FrameNode, "FrameNode", NodeMethods> & NamespaceMembers<TextNode, "TextNode", NodeMethods> & NamespaceMembers<SVGNode, "SVGNode", NodeMethods> & NamespaceMembers<ComponentInstanceNode, "ComponentInstanceNode", NodeMethods> & NamespaceMembers<DesignPageNode, "DesignPageNode", NodeMethods> & NamespaceMembers<WebPageNode, "WebPageNode", NodeMethods> & NamespaceMembers<ComponentNode, "ComponentNode", NodeMethods> & NamespaceMembers<UnknownNode, "UnknownNode", NodeMethods> & {
|
|
4395
|
+
"WebPageNode.clone": WebPageNode["clone"];
|
|
4396
|
+
"DesignPageNode.clone": DesignPageNode["clone"];
|
|
4397
|
+
} & 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">;
|
|
4398
|
+
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"];
|
|
4372
4399
|
type UnprotectedMessageType = (typeof unprotectedMessageTypesSource)[number];
|
|
4373
4400
|
type ProtectedMessageType = Exclude<keyof PluginMessageAPI, UnprotectedMessageType>;
|
|
4374
4401
|
type Method = keyof {
|
|
@@ -4540,7 +4567,9 @@ declare const methodToMessageTypes: {
|
|
|
4540
4567
|
readonly "ManagedCollection.setFields": ["setManagedCollectionFields"];
|
|
4541
4568
|
readonly "ManagedCollection.setItemOrder": ["setManagedCollectionItemOrder"];
|
|
4542
4569
|
readonly "ManagedCollection.setPluginData": ["setPluginDataForNode"];
|
|
4543
|
-
readonly "Node.clone": ["cloneNode"];
|
|
4570
|
+
readonly "Node.clone": ["cloneNode", "cloneWebPage", "cloneDesignPage"];
|
|
4571
|
+
readonly "WebPageNode.clone": ["cloneWebPage"];
|
|
4572
|
+
readonly "DesignPageNode.clone": ["cloneDesignPage"];
|
|
4544
4573
|
readonly "Node.getChildren": [];
|
|
4545
4574
|
readonly "Node.getNodesWithAttribute": [];
|
|
4546
4575
|
readonly "Node.getNodesWithAttributeSet": [];
|
|
@@ -4599,6 +4628,8 @@ declare const methodToMessageTypes: {
|
|
|
4599
4628
|
readonly createManagedCollection: ["createManagedCollection"];
|
|
4600
4629
|
readonly [getAiServiceInfo]: [];
|
|
4601
4630
|
readonly [sendTrackingEvent]: [];
|
|
4631
|
+
readonly [getCurrentUser]: [];
|
|
4632
|
+
readonly [getProjectInfo]: [];
|
|
4602
4633
|
readonly [getHTMLForNode]: [];
|
|
4603
4634
|
readonly [setHTMLForNode]: [];
|
|
4604
4635
|
readonly [publish]: ["publish"];
|
|
@@ -5851,6 +5882,10 @@ declare class FramerPluginAPIAlpha extends FramerPluginAPIBeta {
|
|
|
5851
5882
|
/** @internal */
|
|
5852
5883
|
[$framerInternal.sendTrackingEvent](key: string, value: string, identifier: string): Promise<void>;
|
|
5853
5884
|
/** @internal */
|
|
5885
|
+
[$framerInternal.getCurrentUser](): Promise<User>;
|
|
5886
|
+
/** @internal */
|
|
5887
|
+
[$framerInternal.getProjectInfo](): Promise<ProjectInfo>;
|
|
5888
|
+
/** @internal */
|
|
5854
5889
|
[$framerInternal.getHTMLForNode](nodeId: NodeId): Promise<string | null>;
|
|
5855
5890
|
/** @internal */
|
|
5856
5891
|
[$framerInternal.setHTMLForNode](nodeId: NodeId, html: string): Promise<void>;
|
|
@@ -6123,6 +6158,8 @@ interface PluginMessageAPI {
|
|
|
6123
6158
|
getPublishInfo: () => Promise<PublishInfo>;
|
|
6124
6159
|
createNode: (type: CreateNodeType, parentId: NodeId | null, attributes: Record<string, unknown>) => Promise<SomeNodeData | null>;
|
|
6125
6160
|
cloneNode: (nodeId: NodeId) => Promise<SomeNodeData | null>;
|
|
6161
|
+
cloneWebPage: (nodeId: NodeId, options?: WebPageCloneOptions) => Promise<SomeNodeData | null>;
|
|
6162
|
+
cloneDesignPage: (nodeId: NodeId, options?: DesignPageCloneOptions) => Promise<SomeNodeData | null>;
|
|
6126
6163
|
getNode: (nodeId: NodeId) => Promise<SomeNodeData | null>;
|
|
6127
6164
|
getParent: (nodeId: NodeId) => Promise<SomeNodeData | null>;
|
|
6128
6165
|
getChildren: (nodeId: NodeId) => Promise<SomeNodeData[]>;
|
|
@@ -6295,6 +6332,8 @@ interface PluginMessageAPI {
|
|
|
6295
6332
|
}) => Promise<void>;
|
|
6296
6333
|
[getAiServiceInfoMessageType]: () => Promise<AiServiceInfo>;
|
|
6297
6334
|
[sendTrackingEventMessageType]: (key: string, value: string, identifier: string) => Promise<void>;
|
|
6335
|
+
[getCurrentUserMessageType]: () => Promise<User>;
|
|
6336
|
+
[getProjectInfoMessageType]: () => Promise<ProjectInfo>;
|
|
6298
6337
|
[getHTMLForNodeMessageType]: (nodeId: NodeId) => Promise<string | null>;
|
|
6299
6338
|
[setHTMLForNodeMessageType]: (nodeId: NodeId, html: string) => Promise<void>;
|
|
6300
6339
|
/** @deprecated Use `getAiServiceInfoMessageType`. */
|
|
@@ -6374,6 +6413,8 @@ declare class PluginEngine {
|
|
|
6374
6413
|
private getOnActionFromCallbackMap;
|
|
6375
6414
|
applyPluginTheme: (theme: Theme) => void;
|
|
6376
6415
|
cloneNode(nodeId: NodeId): Promise<AnyNode | null>;
|
|
6416
|
+
cloneWebPage(nodeId: NodeId, options?: WebPageCloneOptions): Promise<WebPageNode>;
|
|
6417
|
+
cloneDesignPage(nodeId: NodeId, options?: DesignPageCloneOptions): Promise<DesignPageNode>;
|
|
6377
6418
|
setAttributes(nodeId: NodeId, attributes: Partial<AnyEditableAttributes>): Promise<AnyNode | null>;
|
|
6378
6419
|
getParent(nodeId: NodeId): Promise<AnyNode | null>;
|
|
6379
6420
|
getChildren(nodeId: NodeId): Promise<CanvasNode[]>;
|
|
@@ -6743,6 +6784,12 @@ interface ConnectOptions {
|
|
|
6743
6784
|
* @internal
|
|
6744
6785
|
*/
|
|
6745
6786
|
serverUrl?: string;
|
|
6787
|
+
/**
|
|
6788
|
+
* Identifies the calling client (user-agent style, e.g. "framer-api/1.2.0").
|
|
6789
|
+
* Defaults to "framer-api/{version}" when not provided.
|
|
6790
|
+
* @internal
|
|
6791
|
+
*/
|
|
6792
|
+
clientId?: string;
|
|
6746
6793
|
}
|
|
6747
6794
|
declare function connect(projectUrlOrId: string, token?: string, options?: ConnectOptions): Promise<Framer>;
|
|
6748
6795
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as
|
|
1
|
+
import { env, isDeno, isWorkerd } from 'std-env';
|
|
2
|
+
import * as ue from 'devalue';
|
|
3
3
|
|
|
4
|
-
/* Framer API SDK v0.1.
|
|
5
|
-
var
|
|
4
|
+
/* Framer API SDK v0.1.4 */
|
|
5
|
+
var Yr=Object.defineProperty;var r=(n,e)=>Yr(n,"name",{value:e,configurable:true});function ut(n){return n!==undefined}r(ut,"isDefined");function ni(n){return n===undefined}r(ni,"isUndefined");function C(n){return n===null}r(C,"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 Xr(n){return typeof n=="function"}r(Xr,"isFunction");function v(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}r(v,"isObject");function ct(n){if(typeof n!="object"||n===null)return false;let e=Object.getPrototypeOf(n);return e===null||e===Object.prototype}r(ct,"isPlainObject");function Ht(n){return Array.isArray(n)}r(Ht,"isArray");function pt(n,e){throw e||new Error(n?`Unexpected value: ${n}`:"Application entered invalid state")}r(pt,"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(`
|
|
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(p,"assert");function S(n){for(let e of Reflect.ownKeys(n)){let t=n[e];!t||typeof t!="object"&&!Rr(t)||S(t);}return Object.freeze(n)}r(S,"deepFreeze");function Yn(n){return [n.slice(0,-1),n.at(-1)]}r(Yn,"splitRestAndLast");var c="__class";var Gt=Symbol(),Kt=Symbol(),Br=Symbol(),Ur=Symbol(),Or=Symbol(),zr=Symbol(),Gr=Symbol(),$t=Symbol(),Ht=Symbol(),l={getAiServiceInfo:Gt,sendTrackingEvent:Kt,environmentInfo:Br,initialState:Ur,showUncheckedPermissionToasts:Or,marshal:zr,unmarshal:Gr,getHTMLForNode:$t,setHTMLForNode:Ht},ct="INTERNAL_",pt=`${ct}getAiServiceInfo`,mt=`${ct}sendTrackingEvent`,ue=`${ct}getHTMLForNode`,ce=`${ct}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(x(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 p(!_n(e)),`${e.toLowerCase()}${n.slice(1,-w.length)}`}r(V,"classToType");var Kr=`Boolean${w}`,$r=V(Kr),Te=class n extends M{static{r(this,"BooleanVariable");}type=$r;#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}},Hr=`Number${w}`,jr=V(Hr),Pe=class n extends M{static{r(this,"NumberVariable");}type=jr;#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}},_r=`String${w}`,qr=V(_r),Se=class n extends M{static{r(this,"StringVariable");}type=qr;#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}},Yr=`FormattedText${w}`,Xr=V(Yr),Fe=class n extends M{static{r(this,"FormattedTextVariable");}type=Xr;#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}},Zr=`Enum${w}`,Jr=V(Zr),H=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);}},De=class n extends M{static{r(this,"EnumVariable");}type=Jr;#e;#t;#n;get cases(){return this.#n||(this.#n=S(this.#t.cases.map(e=>new H(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 H(this.#e,this.nodeId,this.id,t):null}async setCaseOrder(e){await this.#e.invoke("setEnumCaseOrder",this.nodeId,this.id,e);}},Qr=`Color${w}`,eo=V(Qr),ve=class n extends M{static{r(this,"ColorVariable");}type=eo;#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=`Image${w}`,no=V(to),Ne=class n extends M{static{r(this,"ImageVariable");}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}},io=`File${w}`,ro=V(io),ke=class n extends M{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}},oo=`Link${w}`,ao=V(oo),Ee=class n extends M{static{r(this,"LinkVariable");}type=ao;#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=`Date${w}`,lo=V(so),Me=class n extends M{static{r(this,"DateVariable");}type=lo;#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}},uo=`Border${w}`,co=V(uo),Ae=class n extends M{static{r(this,"BorderVariable");}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=`Unsupported${w}`,mo=V(po),we=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 Xn(n){return n instanceof M}r(Xn,"isVariable");function go(n){return Xn(n)&&n.nodeType==="component"}r(go,"isComponentVariable");var R=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(p(lt(i)),x(i))return null;p(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]);}},L=class extends R{static{r(this,"FieldBaseWithRequired");}#e;get required(){return this.#e.required}constructor(e,t,i){super(e,t,i),this.#e=i;}},gt=class extends R{static{r(this,"BooleanField");}type=qt},ft=class extends R{static{r(this,"ColorField");}type=Yt},yt=class extends R{static{r(this,"NumberField");}type=Xt},ht=class extends L{static{r(this,"StringField");}type=Zt;#e;constructor(e,t,i){super(e,t,i),this.#e=i;}get basedOn(){return this.#e.basedOn}},bt=class extends L{static{r(this,"FormattedTextField");}type=Jt},Ve=class extends L{static{r(this,"ImageField");}type=Qt},xt=class extends L{static{r(this,"LinkField");}type=tn},Ct=class extends L{static{r(this,"DateField");}type=nn;#e;get displayTime(){return this.#e.displayTime}constructor(e,t,i){super(e,t,i),this.#e=i;}},It=class extends R{static{r(this,"FieldDivider");}type=ln},We=class extends R{static{r(this,"UnsupportedField");}type=dn},Tt=class extends L{static{r(this,"FileField");}type=rn;#e;get allowedFileTypes(){return this.#e.allowedFileTypes}constructor(e,t,i){super(e,t,i),this.#e=i;}},Pt=class extends R{static{r(this,"EnumField");}type=on;#e;#t;#n;#i;get cases(){return this.#i||(this.#i=this.#n.cases.map(e=>new H(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 H(this.#e,this.#t,this.id,t):null}async setCaseOrder(e){await this.#e.invoke("setEnumCaseOrder",this.#t,this.id,e);}},St=class extends L{static{r(this,"CollectionReferenceField");}type=an;#e;get collectionId(){return this.#e.collectionId}constructor(e,t,i){super(e,t,i),this.#e=i;}},Ft=class extends L{static{r(this,"MultiCollectionReferenceField");}type=sn;#e;get collectionId(){return this.#e.collectionId}constructor(e,t,i){super(e,t,i),this.#e=i;}},jt=class extends L{static{r(this,"ArrayField");}type=en;fields;constructor(e,t,i){super(e,t,i);let o=i.fields[0];this.fields=[new Ve(e,t,o)];}};function _t(n,e,t){return n.map(i=>{switch(i.type){case qt:return new gt(e,t,i);case Yt:return new ft(e,t,i);case Xt:return new yt(e,t,i);case Zt:return new ht(e,t,i);case Jt:return new bt(e,t,i);case Qt:return new Ve(e,t,i);case tn:return new xt(e,t,i);case nn:return new Ct(e,t,i);case ln:return new It(e,t,i);case dn:return new We(e,t,i);case rn:return new Tt(e,t,i);case on:return new Pt(e,t,i);case an:return new St(e,t,i);case sn:return new Ft(e,t,i);case en:return new jt(e,t,i);default:return new We(e,t,i)}})}r(_t,"fieldDefinitionDataArrayToFieldClassInstances");function fo(n){return n instanceof R}r(fo,"isField");var Zn="action";function yo(n){return !!n&&Zn in n&&f(n[Zn])}r(yo,"isLocalizedValueUpdate");function Jn(n){return Object.keys(n).reduce((e,t)=>{let i=n[t];return yo(i)&&(e[t]=i),e},{})}r(Jn,"filterInlineLocalizationValues");var Le=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 {[c]:"FileAsset",id:this.id,url:this.url,extension:this.extension}}};function ho(n){return n instanceof Le}r(ho,"isFileAsset");var bo="ImageAsset";function Qn(n){return v(n)?n[c]===bo:false}r(Qn,"isImageAssetData");var j=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 {[c]:"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,{[c]:"ImageAsset",id:this.id,url:this.url,thumbnailUrl:this.thumbnailUrl,altText:e??this.altText,resolution:t??this.resolution})}async measure(){return Io(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 xo(n){return n instanceof j}r(xo,"isImageAsset");function _(n){return n.type==="bytes"?[n.bytes.buffer]:[]}r(_,"getTransferable");function Co(n){if(!v(n))return false;let e="bytes",t="mimeType";return !(!(e in n)||!(t in n)||!(n[e]instanceof Uint8Array)||!f(n[t]))}r(Co,"isBytesData");async function Re(n){if(n instanceof File)return pn(n);let e=await ei(n.image);return {name:n.name,altText:n.altText,resolution:n.resolution,preferredImageRendering:n.preferredImageRendering,...e}}r(Re,"createImageTransferFromInput");async function un(n){if(n instanceof File)return pn(n);let e=await ei(n.file);return {name:n.name,...e}}r(un,"createFileTransferFromInput");async function ei(n){return n instanceof File?pn(n):Co(n)?{type:"bytes",mimeType:n.mimeType,bytes:n.bytes}:{type:"url",url:n}}r(ei,"createAssetTransferFromAssetInput");function cn(n){return Promise.all(n.map(Re))}r(cn,"createNamedAssetDataTransferFromInput");async function pn(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(pn,"getAssetDataFromFile");async function Io(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(Io,"measureImage");var Dt=class{static{r(this,"ComputedValueBase");}};var To="unsupported",Be=class n extends Dt{static{r(this,"UnsupportedComputedValue");}type=To;#e;constructor(e){super(),this.#e=e;}static[l.unmarshal](e,t){return new n(t)}[l.marshal](){return this.#e}};function Po(n){return n instanceof Dt}r(Po,"isComputedValue");var So="Font";function ni(n){return v(n)&&n[c]===So}r(ni,"isFontData");function Fo(n){if(!$(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(Fo,"isFontWeight");function Do(n){if(!f(n))return false;switch(n){case "normal":case "italic":return true;default:return false}}r(Do,"isFontStyle");function ii(n){return v(n)?f(n.family)&&f(n.selector)&&Fo(n.weight)&&Do(n.style):false}r(ii,"isFont");var O=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=ti.get(t.selector);if(i)return i;let o=new n(t);return ti.set(t.selector,o),o}[l.marshal](){return {[c]:"Font",selector:this.selector,family:this.family,weight:this.weight,style:this.style}}},ti=new Map;var vo="LinearGradient",No="RadialGradient",ko="ConicGradient",pe=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})}},Ue=class n extends pe{static{r(this,"LinearGradient");}[c]=vo;#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 B({...this.#e,[c]:this[c]})}toCSS(){let e=this.#e.stops.map(t=>(p(f(t.color),"ColorStyle not supported yet"),`${t.color} ${t.position*100}%`)).join(", ");return `linear-gradient(${this.angle}deg, ${e})`}},Oe=class n extends pe{static{r(this,"RadialGradient");}[c]=No;#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 B({...this.#e,[c]:this[c]})}toCSS(){let e=this.stops.map((t,i)=>{p(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})`}},ze=class n extends pe{static{r(this,"ConicGradient");}[c]=ko;#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 B({...this.#e,[c]:this[c]})}toCSS(){let e=this.stops.map(t=>(p(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 ri(n){return n instanceof pe}r(ri,"isGradient");var Eo="ColorStyle";function vt(n){return v(n)?n[c]===Eo:false}r(vt,"isColorStyleData");var Q=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 {[c]:"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 me(n){return n instanceof Q}r(me,"isColorStyle");var Mo="TextStyle";function oi(n){return v(n)?n[c]===Mo:false}r(oi,"isTextStyleData");var Ge=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=O[l.unmarshal](e,t.font),this.boldFont=t.boldFont&&O[l.unmarshal](e,t.boldFont),this.italicFont=t.italicFont&&O[l.unmarshal](e,t.italicFont),this.boldItalicFont=t.boldItalicFont&&O[l.unmarshal](e,t.boldItalicFont),this.color=vt(t.color)?Q[l.unmarshal](e,t.color):t.color,this.transform=t.transform,this.alignment=t.alignment,this.decoration=t.decoration,this.decorationColor=vt(t.decorationColor)?Q[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 {[c]:"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:me(this.color)?this.color[l.marshal]():this.color,transform:this.transform,alignment:this.alignment,decoration:this.decoration,decorationColor:me(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 mn(n){return n instanceof Ge}r(mn,"isTextStyle");function Ao(n){return v(n)&&l.marshal in n}r(Ao,"isSelfMarshalable");function B(n){if(Ao(n))return n[l.marshal]();if(zt(n))return n.map(B);if(dt(n)){let e={};for(let t of Object.keys(n))e[t]=B(n[t]);return e}return n}r(B,"marshal");var ai={ColorStyle:Q,ConicGradient:ze,FileAsset:Le,Font:O,ImageAsset:j,LinearGradient:Ue,RadialGradient:Oe,TextStyle:Ge,BooleanVariable:Te,BorderVariable:Ae,ColorVariable:ve,DateVariable:Me,EnumVariable:De,FileVariable:ke,FormattedTextVariable:Fe,ImageVariable:Ne,LinkVariable:Ee,NumberVariable:Pe,StringVariable:Se,UnsupportedVariable:we,UnsupportedComputedValue:Be};function wo(n){return dt(n)&&f(n[c])&&n[c]in ai}r(wo,"isSelfUnmarshalable");function y(n,e){if(wo(e))return ai[e[c]][l.unmarshal](n,e);if(zt(e))return e.map(t=>y(n,t));if(dt(e)){let t={};for(let i of Object.keys(e))t[i]=y(n,e[i]);return t}return e}r(y,"unmarshal");var Vo={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 Wo(n){return Vo[n]}r(Wo,"isSupportedArrayItemFieldType");function Lo(n){return Wo(n.type)}r(Lo,"isSupportedArrayItemFieldDataEntry");var qt="boolean",Yt="color",Xt="number",Zt="string",Jt="formattedText",Qt="image",en="array",tn="link",nn="date",rn="file",on="enum",an="collectionReference",sn="multiCollectionReference",ln="divider",dn="unsupported";function Ro(n){return n.map(e=>{if(e.type!=="enum")return e;let t=e.cases.map(i=>{let o=i.nameByLocale?Jn(i.nameByLocale):undefined;return {...i,nameByLocale:o}});return {...e,cases:t}})}r(Ro,"sanitizeEnumFieldForMessage");function si(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=si(s.fieldData,e),h={};for(let C in d){let F=d[C];p(F&&Lo(F),"Unsupported array item field data entry"),h[C]=F;}return {...s,fieldData:h}});t[i]={...o,value:a};}return t}r(si,"deserializeFieldData");var ge=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,p(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=Ro(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)}},ee=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 _t(e,this.#e,this.id)}async addFields(e){let t=await this.#e.invoke("addCollectionFields2",this.id,e);return p(t.every(qn)),_t(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 Ke(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)}},Ke=class n{static{r(this,"CollectionItem");}id;nodeId;slug;slugByLocale;draft;fieldData;#e;constructor(e,t){let i=si(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 Bo={fixed:true,sticky:true,absolute:true,relative:true},li="position";function Ks(n){if(!(li in n))return false;let e=n[li];return f(e)&&Bo[e]===true}r(Ks,"supportsPosition");var di="top";function $s(n){if(!(di in n))return false;let e=n[di];return f(e)||x(e)}r($s,"supportsPins");var ui="width";function Hs(n){if(!(ui in n))return false;let e=n[ui];return f(e)||x(e)}r(Hs,"supportsSize");var ci="maxWidth";function js(n){if(!(ci in n))return false;let e=n[ci];return f(e)||x(e)}r(js,"supportsSizeConstraints");var pi="aspectRatio";function _s(n){if(!(pi in n))return false;let e=n[pi];return $(e)||x(e)}r(_s,"supportsAspectRatio");var mi="name";function qs(n){if(!(mi in n))return false;let e=n[mi];return f(e)||x(e)}r(qs,"supportsName");var gi="visible";function Ys(n){if(!(gi in n))return false;let e=n[gi];return Ie(e)}r(Ys,"supportsVisible");var fi="locked";function Xs(n){if(!(fi in n))return false;let e=n[fi];return Ie(e)}r(Xs,"supportsLocked");var yi="backgroundColor";function Zs(n){if(!(yi in n))return false;let e=n[yi];return f(e)||me(e)||x(e)}r(Zs,"supportsBackgroundColor");var hi="backgroundColor";function Js(n){if(!(hi in n))return false;let e=n[hi];return f(e)||vt(e)||x(e)}r(Js,"supportsBackgroundColorData");var bi="backgroundImage";function Qs(n){if(!(bi in n))return false;let e=n[bi];return e instanceof j||x(e)}r(Qs,"supportsBackgroundImage");var xi="backgroundImage";function el(n){if(!(xi in n))return false;let e=n[xi];return e instanceof j?false:Qn(e)||x(e)}r(el,"supportsBackgroundImageData");var Ci="backgroundGradient";function tl(n){if(!(Ci in n))return false;let e=n[Ci];return ri(e)||x(e)}r(tl,"supportsBackgroundGradient");var Ii="backgroundGradient";function nl(n){if(!(Ii in n))return false;let e=n[Ii];return v(e)||x(e)}r(nl,"supportsBackgroundGradientData");var Ti="rotation";function il(n){if(!(Ti in n))return false;let e=n[Ti];return $(e)}r(il,"supportsRotation");var Pi="opacity";function rl(n){if(!(Pi in n))return false;let e=n[Pi];return $(e)}r(rl,"supportsOpacity");var Si="borderRadius";function ol(n){if(!(Si in n))return false;let e=n[Si];return f(e)||x(e)}r(ol,"supportsBorderRadius");var Fi="border";function al(n){if(!(Fi in n))return false;let e=n[Fi];return x(e)||me(e.color)}r(al,"supportsBorder");var Di="svg";function sl(n){if(!(Di in n))return false;let e=n[Di];return f(e)}r(sl,"supportsSVG");var vi="textTruncation";function ll(n){if(!(vi in n))return false;let e=n[vi];return $(e)||x(e)}r(ll,"supportsTextTruncation");var Ni="zIndex";function dl(n){if(!(Ni in n))return false;let e=n[Ni];return $(e)||x(e)}r(dl,"supportsZIndex");var ki="overflow";function ul(n){if(!(ki in n))return false;let e=n[ki];return f(e)||x(e)}r(ul,"supportsOverflow");var Ei="componentIdentifier";function cl(n){if(!(Ei in n))return false;let e=n[Ei];return f(e)}r(cl,"supportsComponentInfo");var Mi="font";function pl(n){if(!(Mi in n))return false;let e=n[Mi];return ii(e)}r(pl,"supportsFont");var Ai="font";function ml(n){if(!(Ai in n))return false;let e=n[Ai];return ni(e)||x(e)}r(ml,"supportsFontData");var wi="inlineTextStyle";function gl(n){if(!(wi in n))return false;let e=n[wi];return mn(e)||x(e)}r(gl,"supportsInlineTextStyle");var Vi="inlineTextStyle";function fl(n){if(!(Vi in n))return false;let e=n[Vi];return oi(e)||x(e)}r(fl,"supportsInlineTextStyleData");var Wi="link";function yl(n){if(!(Wi in n))return false;let e=n[Wi];return f(e)||x(e)}r(yl,"supportsLink");var Li="imageRendering";function hl(n){if(!(Li in n))return false;let e=n[Li];return f(e)||x(e)}r(hl,"supportsImageRendering");var Ri="layout";function Oi(n){if(!(Ri in n))return false;let e=n[Ri];return f(e)||x(e)}r(Oi,"supportsLayout");function bl(n){return Oi(n)?n.layout==="stack":false}r(bl,"hasStackLayout");function xl(n){return Oi(n)?n.layout==="grid":false}r(xl,"hasGridLayout");var Bi="isVariant";function zi(n){if(!(Bi in n))return false;let e=n[Bi];return Ie(e)}r(zi,"supportsComponentVariant");function gn(n){return zi(n)?n.isVariant:false}r(gn,"isComponentVariant");function Gi(n){return !zi(n)||!gn(n)?false:!x(n.gesture)}r(Gi,"isComponentGestureVariant");var Ui="isBreakpoint";function Uo(n){if(!(Ui in n))return false;let e=n[Ui];return Ie(e)}r(Uo,"supportsBreakpoint");function Ki(n){return Uo(n)?n.isBreakpoint:false}r(Ki,"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(){if(this[c]==="UnknownNode")throw Error("Can not clone unknown node");return this.#e.cloneNode(this.id)}async setAttributes(e){if(this[c]==="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 te(this)?Promise.resolve([]):this.#e.getChildren(this.id)}async getNodesWithType(e){return te(this)?Promise.resolve([]):(await this.#e.invoke("getNodesWithType",this.id,e)).map(i=>I(i,this.#e))}async getNodesWithAttribute(e){return te(this)?Promise.resolve([]):(await this.#e.invoke("getNodesWithAttribute",this.id,e)).map(i=>I(i,this.#e))}async getNodesWithAttributeSet(e){return te(this)?Promise.resolve([]):(await this.#e.invoke("getNodesWithAttributeSet",this.id,e)).map(i=>I(i,this.#e))}async*walk(){if(yield this,!te(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");}[c]="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;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.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);}},ne=class extends W{static{r(this,"TextNode");}[c]="TextNode";name;visible;locked;rotation;opacity;zIndex;font;inlineTextStyle;position;top;right;bottom;left;centerX;centerY;width;height;maxWidth;minWidth;maxHeight;minHeight;link;linkOpenInNewTab;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.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(ce,this.id,e),await new Promise(t=>{setTimeout(t,30);});}async getHTML(){return this.#e.invoke(ue,this.id)}},$e=class extends W{static{r(this,"SVGNode");}[c]="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);}},He=class extends W{static{r(this,"VectorSetItemNode");}[c]="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)}},je=class extends W{static{r(this,"ComponentInstanceNode");}[c]="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)}},ie=class extends W{static{r(this,"WebPageNode");}[c]="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);}getBreakpointSuggestions(){return this.#e.invoke("getBreakpointSuggestionsForWebPage",this.id)}async addBreakpoint(e,t){let i=await this.#e.invoke("addBreakpointToWebPage",this.id,e,t),o=I(i,this.#e);return p(o instanceof U),p(Ki(o),"Expected node to be a FrameNode"),o}async getActiveCollectionItem(){let e=await this.#e.invoke("getActiveCollectionItemForWebPage",this.id);return e?new Ke(e,this.#e):null}},re=class extends W{static{r(this,"ComponentNode");}[c]="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=I(i,this.#e);return p(o instanceof U),p(gn(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=I(o,this.#e);return p(a instanceof U),p(Gi(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,B(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);}},_e=class extends W{static{r(this,"VectorSetNode");}[c]="VectorSetNode";name;constructor(e,t){super(e,t),this.name=e.name??null,S(this);}},oe=class extends W{static{r(this,"DesignPageNode");}[c]="DesignPageNode";name;constructor(e,t){super(e,t),this.name=e.name??null,S(this);}},qe=class extends W{static{r(this,"UnknownNode");}[c]="UnknownNode";constructor(e,t){super(e,t),S(this);}};function I(n,e){switch(n[c]){case "DesignPageNode":return new oe(n,e);case "WebPageNode":return new ie(n,e);case "ComponentNode":return new re(n,e);case "VectorSetNode":return new _e(n,e);case "VectorSetItemNode":return new He(n,e);case "ComponentInstanceNode":return new je(n,e);case "FrameNode":return new U(n,e);case "SVGNode":return new $e(n,e);case "TextNode":return new ne(n,e);case "UnknownNode":return new qe(n,e);default:return new qe(n,e)}}r(I,"convertRawNodeDataToNode");function Nt(n){return n instanceof U}r(Nt,"isFrameNode");function $i(n){return n instanceof ne}r($i,"isTextNode");function Hi(n){return n instanceof $e}r(Hi,"isSVGNode");function fe(n){return n instanceof je}r(fe,"isComponentInstanceNode");function ji(n){return n instanceof ie}r(ji,"isWebPageNode");function _i(n){return n instanceof re}r(_i,"isComponentNode");function qi(n){return n instanceof oe}r(qi,"isDesignPageNode");function Yi(n){return n instanceof _e}r(Yi,"isVectorSetNode");function Xi(n){return n instanceof He}r(Xi,"isVectorSetItemNode");function te(n){return n instanceof qe}r(te,"isUnknownNode");function Ye(n){return !!(Nt(n)||$i(n)||fe(n)||Hi(n)||Xi(n)||te(n))}r(Ye,"isCanvasNode");function fn(n){return !!(ji(n)||qi(n)||_i(n)||Yi(n)||te(n))}r(fn,"isCanvasRootNode");var Xe=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 kt(t,this.#e))}},kt=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 Ze=class extends Error{static{r(this,"FramerPluginError");}name=this.constructor.name},q=class extends Error{static{r(this,"FramerPluginClosedError");}name=this.constructor.name};function Oo(n){return n.type==="separator"}r(Oo,"isSeparatorMenuItem");function Et(n,e){let t=[];for(let i of n){if(Oo(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=Et(i.submenu,e)),t.push(s);}return t}r(Et,"addMenuItemsToOnActionCallbackMap");var Mt="type",Zi={[Mt]:"pluginReadySignal"},Go="pluginReadyResponse";var Ko={methodResponse:true,subscriptionMessage:true,permissionUpdate:true,menuAction:true};function Ji(n){return v(n)&&f(n[Mt])&&n[Mt]in Ko}r(Ji,"isVekterToPluginNonHandshakeMessage");function Qi(n){return v(n)&&n[Mt]===Go}r(Qi,"isPluginReadyResponse");var yn=Symbol(),hn=Symbol(),bn=Symbol(),xn=Symbol(),Cn=Symbol(),In=Symbol(),Tn=Symbol(),Pn=Symbol(),Sn=Symbol(),Fn=Symbol(),Dn=Symbol(),k={publish:yn,getDeployments:hn,deploy:bn,getChangedPaths:xn,getChangeContributors:Cn,createManagedCollection:In,rejectAllPending:Tn,readProjectForAgent:Pn,getAgentSystemPrompt:Sn,getAgentContext:Fn,applyAgentChanges:Dn};function vn(n){return typeof n=="string"&&n in k}r(vn,"isFramerApiOnlyMethod");var $o=["unstable_getCodeFile","unstable_getCodeFiles","unstable_getCodeFileVersionContent","unstable_getCodeFileLint2","unstable_getCodeFileTypecheck2","unstable_getCodeFileVersions","lintCode"],Ho=["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",pt,mt,ue,"getAiServiceInfo","sendTrackingEvent",...$o];new Set(Ho);var Nn={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"],"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":[ce],"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"],[Gt]:[],[Kt]:[],[$t]:[],[Ht]:[],[yn]:["publish"],[hn]:[],[bn]:["deploy"],[xn]:[],[Cn]:[],[In]:["createManagedCollection"],[Tn]:[],[Pn]:[],[Sn]:[],[Fn]:[],[Dn]:["applyAgentChanges"]},At=[];for(let n of Object.keys(Nn))Nn[n].length!==0&&At.push(n);S(At);function kn(n){let e={};for(let t of At){let i=Nn[t];e[t]=i.every(o=>n[o]);}return e}r(kn,"createPerMethodPermissionMap");function er(){let n={};for(let e of At)n[e]=true;return n}r(er,"createPerMethodPermissionMapForTesting");var ye=null;function tr(n){if(typeof window>"u")return;if(!ye){let t=document.createElement("style");document.head.appendChild(t),ye=t.sheet;}if(!ye){n();return}let e=ye.insertRule("* { transition: none !important; animation: none !important; }");n(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{ye&&ye.deleteRule(e);});});}r(tr,"withDisabledCssTransitions");var Je=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=er(),this.initialState={mode:"canvas",intent:"plugin/open"};return}switch(e.transport.onMessage(this.onMessage),typeof window<"u"&&(window.addEventListener("error",t=>{t.error instanceof q&&(t.preventDefault(),t.stopImmediatePropagation());}),window.addEventListener("unhandledrejection",t=>{t.reason instanceof q&&(t.preventDefault(),t.stopImmediatePropagation());})),this.mode=e.mode,this.initialState=e.initialState??{mode:e.mode,intent:"plugin/open"},this.environmentInfo=e.environmentInfo,this.perMethodPermissionMap=kn(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:ut(this.mode);}}async invoke(e,...t){return this.invokeTransferable(e,undefined,...t)}async invokeTransferable(e,t,...i){return new Promise((a,s)=>{let d={type:"methodInvocation",methodName:e,id:this.methodInvocationId,args:i.map(B)};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=e=>{let t=e?.data??e;if(Ji(t))switch(t.type){case "permissionUpdate":{this.perMethodPermissionMap=kn(t.permissionMap);for(let i of this.permissionSubscriptions)i();break}case "methodResponse":{let i=this.methodResponseHandlers.get(t.id);if(!i)throw new Error(`No handler for response with id ${t.id}`);this.methodResponseHandlers.delete(t.id),f(t.error)?i.reject(new Ze(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:ut(t);}};getOnActionFromCallbackMap(e,t){switch(t){case "pluginMenu":return this.menuItemOnActionCallbackMap.get(e);case "contextMenu":return this.contextMenuItemOnActionCallbackMap.get(e);default:ut(t);}}applyPluginTheme=e=>{tr(()=>{document.body.setAttribute("data-framer-theme",e.mode);for(let t in e.tokens)document.body.style.setProperty(t,e.tokens[t]);});};async cloneNode(e){let t=await this.invoke("cloneNode",e);return t?I(t,this):null}async setAttributes(e,t){let i=await this.invoke("setAttributes",e,t);return i?I(i,this):null}async getParent(e){let t=await this.invoke("getParent",e);return t?I(t,this):null}async getChildren(e){return (await this.invoke("getChildren",e)).map(i=>{let o=I(i,this);return p(Ye(o)),o})}notify=(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:()=>this.invoke("closeNotification",i)}};async setMenu(e){this.menuItemOnActionCallbackMap=new Map;let t=Et(e,this.menuItemOnActionCallbackMap);await this.invoke("setMenu",t);}async showContextMenu(e,t){this.contextMenuItemOnActionCallbackMap=new Map;let i=Et(e,this.contextMenuItemOnActionCallbackMap);await this.invoke("showContextMenu",i,t);}};function jo(n){return n.type==="component"}r(jo,"isCodeFileComponentExport");function _o(n){return n.type==="override"}r(_o,"isCodeFileOverrideExport");var En=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)}},Y=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 En(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 wt=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=I(i,this.#t);return p(fe(o)),o}};var qo=(()=>{let n=null;return {disableUntilMouseUp:()=>{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");}}})(),nr=5,Yo=(()=>{let n=1;return {next:()=>`drag-${n++}`}})();function Xo(){}r(Xo,"noop");function ir(n,e,t,i){if(n.mode!=="canvas")return Xo;let o=Yo.next(),a=document.body.style.cursor,s={type:"idle"},d=document.body,h=ae.subscribeToIsAllowedTo("makeDraggable",m=>{m||T();}),C=r(m=>{ae.isAllowedTo("makeDraggable")&&s.type!=="idle"&&(s.type==="dragging"&&n.invoke("onDragEnd",{...m,dragSessionId:o}).then(g=>{try{i?.(g);}catch{}}).catch(g=>{if(g instanceof Error){i?.({status:"error",reason:g.message});return}if(typeof g=="string"){i?.({status:"error",reason:g});return}i?.({status:"error"});}),T());},"endDrag"),F=r(m=>{if(!ae.isAllowedTo("makeDraggable")||s.type==="idle")return;if(!(m.buttons>0&&!!(m.buttons&1))){C({cancelled:false});return}let{clientX:A,clientY:K}=m;if(s.type==="pointerDown"){let J=A-s.dragStart.mouse.x,P=K-s.dragStart.mouse.y;if(Math.abs(J)<nr&&Math.abs(P)<nr)return;s={type:"dragging",dragStart:s.dragStart},n.invoke("onDragStart",s.dragStart),document.getSelection()?.empty(),qo.disableUntilMouseUp();}d.setPointerCapture(m.pointerId);let E={x:A,y:K};n.invoke("onDrag",{dragSessionId:o,mouse:E}).then(J=>{s.type==="dragging"&&(document.body.style.cursor=J??"");});},"handlePointerChange"),G=r(m=>{m.key==="Escape"&&C({cancelled:true});},"handleKeyDown"),Ce=r(()=>{C({cancelled:true});},"handleBlur"),b=r(m=>{if(!ae.isAllowedTo("makeDraggable"))return;C({cancelled:true});let g=e.getBoundingClientRect(),A={x:g.x,y:g.y,width:g.width,height:g.height},K,E=e.querySelectorAll("svg");if(E.length===1){let st=E.item(0).getBoundingClientRect();K={x:st.x,y:st.y,width:st.width,height:st.height};}let J={x:m.clientX,y:m.clientY};s={type:"pointerDown",dragStart:{dragSessionId:o,elementRect:A,svgRect:K,mouse:J}},n.invoke("setDragData",o,t()),d.addEventListener("pointermove",F,true),d.addEventListener("pointerup",F,true),window.addEventListener("keydown",G,true),window.addEventListener("blur",Ce);},"handlePointerDown"),u=r(()=>{if(!ae.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",u);function T(){s={type:"idle"},document.body.style.cursor=a,d.removeEventListener("pointermove",F,true),d.removeEventListener("pointerup",F,true),window.removeEventListener("keydown",G,true),window.removeEventListener("blur",Ce);}return r(T,"dragCleanup"),()=>{e.removeEventListener("pointerdown",b),e.removeEventListener("mouseenter",u),C({cancelled:true}),h();}}r(ir,"makeDraggable");var he=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 p(lt(i)),x(i)?null:new n(i,this.#t)}};var Mn=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]=Yn(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 q}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=I(t,this.#e);return p(Ye(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=I(o,this.#e);return p(Ye(a)),a});e(i);})}async getCanvasRoot(){let e=await this.#e.invoke("getCanvasRoot"),t=I(e,this.#e);return p(fn(t)),t}subscribeToCanvasRoot(e){return this.#e.subscribe("canvasRoot",t=>{let i=I(t,this.#e);p(fn(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=I(i,this.#e);return p(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?I(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=>I(i,this.#e))}async getNodesWithAttribute(e){return (await this.#e.invoke("getNodesWithAttribute",null,e)).map(i=>I(i,this.#e))}async getNodesWithAttributeSet(e){return (await this.#e.invoke("getNodesWithAttributeSet",null,e)).map(i=>I(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 Re(e),i=_(t);return this.#e.invokeTransferable("addImage",i,t)}async setImage(e){let t=await Re(e),i=_(t);return this.#e.invokeTransferable("setImage",i,t)}async uploadImage(e){let t=await Re(e),i=_(t),o=await this.#e.invokeTransferable("uploadImage",i,t);return y(this.#e,o)}async addImages(e){let t=await cn(e),i=t.flatMap(_);await this.#e.invokeTransferable("addImages",i,t);}async uploadImages(e){let t=await cn(e),i=t.flatMap(_),o=await this.#e.invokeTransferable("uploadImages",i,t);return y(this.#e,o)}async uploadFile(e){let t=await un(e),i=await this.#e.invokeTransferable("uploadFile",_(t),t);return y(this.#e,i)}async uploadFiles(e){let t=await Promise.all(e.map(un)),i=t.flatMap(_),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=I(o,this.#e);return p(fe(a)),a}async addDetachedComponentLayers({url:e,layout:t,attributes:i}){let o=await this.#e.invoke("addDetachedComponentLayers",{url:e,layout:t,attributes:i}),a=I(o,this.#e);return p(Nt(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 ir(this.#e,e,t,i)}async getActiveManagedCollection(){let e=await this.#e.invoke("getActiveManagedCollection");return p(e,"Collection data must be defined"),new ge(e,this.#e)}async getManagedCollection(){return this.getActiveManagedCollection()}async getManagedCollections(){let e=await this.#e.invoke("getManagedCollections");return p(e,"Collections data must be defined"),e.map(t=>new ge(t,this.#e))}async getCollection(e){let t=await this.#e.invoke("getCollection",e);return t?new ee(t,this.#e):null}async getActiveCollection(){let e=await this.#e.invoke("getActiveCollection");return e?new ee(e,this.#e):null}async getCollections(){return (await this.#e.invoke("getCollections")).map(t=>new ee(t,this.#e))}notify=(e,t)=>this.#e.notify(e,t);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(){return this.#e.invoke("getLocalizationGroups")}setLocalizationData(e){return this.#e.invoke("setLocalizationData",e)}async getRedirects(){return (await this.#e.invoke("getRedirects")).map(t=>new he(t,this.#e))}subscribeToRedirects(e){return this.#e.subscribe("redirects",t=>{let i=t.map(o=>new he(o,this.#e));return e(i)})}async addRedirects(e){return (await this.#e.invoke("addRedirects",e)).map(i=>new he(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 Y(o,this.#e)}async getCodeFiles(){let e=await this.#e.invoke("getCodeFiles"),t=[];for(let i of e)t.push(new Y(i,this.#e));return t}async getCodeFile(e){let t=await this.#e.invoke("getCodeFile",e);return t?new Y(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 Y(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 Y(t,this.#e):null;return e(i)})}async createDesignPage(e){let t=await this.#e.invoke("createDesignPage",e),i=I(t,this.#e);return p(i instanceof oe,"Expected node to be a DesignPageNode"),i}async createWebPage(e){let t=await this.#e.invoke("createWebPage",e),i=I(t,this.#e);return p(i instanceof ie,"Expected node to be a WebPageNode"),i}async createCollection(e){let t=await this.#e.invoke("createCollection",e);return new ee(t,this.#e)}async createManagedCollection(e){let t=await this.#e.invoke("createManagedCollection",e);return new ge(t,this.#e)}async setCloseWarning(e){return this.#e.invoke("setCloseWarning",e)}get[l.initialState](){return this.#e.initialState}},An=class extends Mn{static{r(this,"FramerPluginAPIBeta");}#e;constructor(e){super(e),this.#e=e,this.#e;}},Qe=class extends An{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 wt(t,this.#e)}async[l.getAiServiceInfo](){return this.#e.invoke(pt)}async[l.sendTrackingEvent](e,t,i){return this.#e.invoke(mt,e,t,i)}async[l.getHTMLForNode](e){return this.#e.invoke(ue,e)}async[l.setHTMLForNode](e,t){return this.#e.invoke(ce,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=I(i,this.#e);return p(o instanceof ne),o}async createComponentNode(e){let t=await this.#e.invoke("createNode","ComponentNode",null,{name:e});if(!t)return null;let i=I(t,this.#e);return p(i instanceof re),i}async getVectorSets(){return (await this.#e.invoke("getVectorSets")).map(t=>new Xe(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[k.publish](){return this.#e.invoke("publish")}async[k.getDeployments](){return this.#e.invoke("getDeployments")}async[k.deploy](e,t){return this.#e.invoke("deploy",e,t)}async[k.getChangedPaths](){return this.#e.invoke("getChangedPaths")}async[k.getChangeContributors](e,t){return this.#e.invoke("getChangeContributors",e,t)}async[k.createManagedCollection](e){return this.createManagedCollection(e)}[k.rejectAllPending](e){this.#e.rejectAllPending(e);}async[k.getAgentSystemPrompt](){return this.#e.invoke("getAgentSystemPrompt")}async[k.getAgentContext](e){return this.#e.invoke("getAgentContext",e)}async[k.readProjectForAgent](e,t){return this.#e.invoke("readProjectForAgent",e,t)}async[k.applyAgentChanges](e,t){return this.#e.invoke("applyAgentChanges",e,t)}};var wn=class{constructor(e){this.origin=e;}static{r(this,"IframeTransport");}send(e,t){window.parent.postMessage(e,this.origin,t);}onMessage(e){window.addEventListener("message",e);}};async function Zo(){return new Promise(n=>{function e({data:t,origin:i}){if(!Qi(t))return;window.removeEventListener("message",e);let a={transport:new wn(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(Zi,"*");})}r(Zo,"createBrowserContext");async function Jo(){return typeof window<"u"?Zo():null}r(Jo,"bootstrap");var rr=await Jo(),ae=rr?new Qe(new Je(rr)):new Proxy({},{get(n,e){throw new Error(`Cannot access framer.${String(e)} in server runtime. Use createFramerInstance() with a custom transport.`)}});function or(n){return new Qe(new Je(n))}r(or,"createFramerInstance");var ar=process$1.env;function ta(n){Object.assign(ar,n);}r(ta,"configure");function be(n,e){let t=ar[n];return t&&t.length>0?t:e}r(be,"getEnv");var sr=isWorkerd,lr=globalThis.WebSocket;async function dr(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(dr,"connectWebSocketCF");var ur,cr;try{ur=await import('node:fs'),cr=await import('node:path');}catch{}var Vn=ur,Wn=cr;var se=(h=>(h.PROJECT_CLOSED="PROJECT_CLOSED",h.POOL_EXHAUSTED="POOL_EXHAUSTED",h.TIMEOUT="TIMEOUT",h.INTERNAL="INTERNAL",h.NODE_NOT_FOUND="NODE_NOT_FOUND",h.SCREENSHOT_TOO_LARGE="SCREENSHOT_TOO_LARGE",h.INVALID_REQUEST="INVALID_REQUEST",h.UNAUTHORIZED="UNAUTHORIZED",h))(se||{}),D=class extends Error{static{r(this,"FramerAPIError");}code;constructor(e,t){super(e),this.name="FramerAPIError",this.code=t,this.stack=undefined;}};function na(n){return n instanceof D?n.code==="POOL_EXHAUSTED":false}r(na,"isRetryableError");var ia=new Map(Object.values(se).map(n=>[n,n]));function pr(n){return typeof n=="string"?ia.get(n)??"INTERNAL":"INTERNAL"}r(pr,"parseErrorCode");var Ln={silent:0,error:1,warn:2,info:3,debug:4};function ra(){let n=be("FRAMER_API_LOG_LEVEL")?.toLowerCase();return n&&n in Ln?n:"warn"}r(ra,"getLogLevel");var Rn=ra();function et(n){return Ln[n]<=Ln[Rn]}r(et,"shouldLog");var tt=globalThis.console,oa="\x1B[90m",aa="\x1B[0m";function sa(n){return n?`[FramerAPI:${n}]`:"[FramerAPI]"}r(sa,"formatPrefix");function la(n,...e){return [oa+n,...e,aa]}r(la,"formatDebug");function mr(n){let e=sa(n);return {warn:(...t)=>{et("warn")&&tt.warn(e,...t);},error:(...t)=>{et("error")&&tt.error(e,...t);},log:(...t)=>{et("info")&&tt.log(e,...t);},info:(...t)=>{et("info")&&tt.info(e,...t);},debug:(...t)=>{et("debug")&&tt.debug(...la(e,...t));},setLevel:t=>{Rn=t;},getLevel:()=>Rn,withRequestId:t=>mr(t)}}r(mr,"createLogger");var N=mr();N.warn;N.error;N.log;N.info;N.debug;N.setLevel;N.getLevel;function X(n,...e){if(n)return;let t=Error("Assertion Error"+(e.length>0?": "+e.join(" "):""));if(t.stack)try{let i=t.stack.split(`
|
|
8
|
+
`));}catch{}throw t}r(c,"assert");function P(n){for(let e of Reflect.ownKeys(n)){let t=n[e];!t||typeof t!="object"&&!Xr(t)||P(t);}return Object.freeze(n)}r(P,"deepFreeze");function ri(n){return [n.slice(0,-1),n.at(-1)]}r(ri,"splitRestAndLast");var g="__class";var _t=Symbol(),qt=Symbol(),Yt=Symbol(),Xt=Symbol(),Zr=Symbol(),Jr=Symbol(),Qr=Symbol(),eo=Symbol(),to=Symbol(),Zt=Symbol(),Jt=Symbol(),l={getAiServiceInfo:_t,sendTrackingEvent:qt,getCurrentUser:Yt,getProjectInfo:Xt,environmentInfo:Zr,initialState:Jr,showUncheckedPermissionToasts:Qr,marshal:eo,unmarshal:to,getHTMLForNode:Zt,setHTMLForNode:Jt},pe="INTERNAL_",mt=`${pe}getAiServiceInfo`,gt=`${pe}sendTrackingEvent`,ft=`${pe}getCurrentUser`,yt=`${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(!ni(e)),`${e.toLowerCase()}${n.slice(1,-w.length)}`}r(V,"classToType");var no=`Boolean${w}`,io=V(no),Se=class n extends M{static{r(this,"BooleanVariable");}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}},ro=`Number${w}`,oo=V(ro),Fe=class n extends M{static{r(this,"NumberVariable");}type=oo;#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=`String${w}`,so=V(ao),De=class n extends M{static{r(this,"StringVariable");}type=so;#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}},lo=`FormattedText${w}`,uo=V(lo),ve=class n extends M{static{r(this,"FormattedTextVariable");}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}},co=`Enum${w}`,po=V(co),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);}},Ne=class n extends M{static{r(this,"EnumVariable");}type=po;#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);}},mo=`Color${w}`,go=V(mo),Ee=class n extends M{static{r(this,"ColorVariable");}type=go;#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}},fo=`Image${w}`,yo=V(fo),ke=class n extends M{static{r(this,"ImageVariable");}type=yo;#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}},ho=`File${w}`,bo=V(ho),Me=class n extends M{static{r(this,"FileVariable");}type=bo;#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}},xo=`Link${w}`,Co=V(xo),Ae=class n extends M{static{r(this,"LinkVariable");}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}},Io=`Date${w}`,To=V(Io),we=class n extends M{static{r(this,"DateVariable");}type=To;#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}},Po=`Border${w}`,So=V(Po),Ve=class n extends M{static{r(this,"BorderVariable");}type=So;#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}},Fo=`Unsupported${w}`,Do=V(Fo),We=class n extends M{static{r(this,"UnsupportedVariable");}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}};function oi(n){return n instanceof M}r(oi,"isVariable");function vo(n){return oi(n)&&n.nodeType==="component"}r(vo,"isComponentVariable");var R=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(ut(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]);}},L=class extends R{static{r(this,"FieldBaseWithRequired");}#e;get required(){return this.#e.required}constructor(e,t,i){super(e,t,i),this.#e=i;}},ht=class extends R{static{r(this,"BooleanField");}type=tn},bt=class extends R{static{r(this,"ColorField");}type=nn},xt=class extends R{static{r(this,"NumberField");}type=rn},Ct=class extends L{static{r(this,"StringField");}type=on;#e;constructor(e,t,i){super(e,t,i),this.#e=i;}get basedOn(){return this.#e.basedOn}},It=class extends L{static{r(this,"FormattedTextField");}type=an},Le=class extends L{static{r(this,"ImageField");}type=sn},Tt=class extends L{static{r(this,"LinkField");}type=dn},Pt=class extends L{static{r(this,"DateField");}type=un;#e;get displayTime(){return this.#e.displayTime}constructor(e,t,i){super(e,t,i),this.#e=i;}},St=class extends R{static{r(this,"FieldDivider");}type=fn},Re=class extends R{static{r(this,"UnsupportedField");}type=yn},Ft=class extends L{static{r(this,"FileField");}type=cn;#e;get allowedFileTypes(){return this.#e.allowedFileTypes}constructor(e,t,i){super(e,t,i),this.#e=i;}},Dt=class extends R{static{r(this,"EnumField");}type=pn;#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);}},vt=class extends L{static{r(this,"CollectionReferenceField");}type=mn;#e;get collectionId(){return this.#e.collectionId}constructor(e,t,i){super(e,t,i),this.#e=i;}},Nt=class extends L{static{r(this,"MultiCollectionReferenceField");}type=gn;#e;get collectionId(){return this.#e.collectionId}constructor(e,t,i){super(e,t,i),this.#e=i;}},Qt=class extends L{static{r(this,"ArrayField");}type=ln;fields;constructor(e,t,i){super(e,t,i);let o=i.fields[0];this.fields=[new Le(e,t,o)];}};function en(n,e,t){return n.map(i=>{switch(i.type){case tn:return new ht(e,t,i);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 Le(e,t,i);case dn:return new Tt(e,t,i);case un:return new Pt(e,t,i);case fn:return new St(e,t,i);case yn:return new Re(e,t,i);case cn:return new Ft(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 ln:return new Qt(e,t,i);default:return new Re(e,t,i)}})}r(en,"fieldDefinitionDataArrayToFieldClassInstances");function No(n){return n instanceof R}r(No,"isField");var ai="action";function Eo(n){return !!n&&ai in n&&f(n[ai])}r(Eo,"isLocalizedValueUpdate");function si(n){return Object.keys(n).reduce((e,t)=>{let i=n[t];return Eo(i)&&(e[t]=i),e},{})}r(si,"filterInlineLocalizationValues");var Be=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 ko(n){return n instanceof Be}r(ko,"isFileAsset");var Mo="ImageAsset";function li(n){return v(n)?n[g]===Mo:false}r(li,"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 Vo(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 Ao(n){return n instanceof X}r(Ao,"isImageAsset");function Z(n){return n.type==="bytes"?[n.bytes.buffer]:[]}r(Z,"getTransferable");function wo(n){if(!v(n))return false;let e="bytes",t="mimeType";return !(!(e in n)||!(t in n)||!(n[e]instanceof Uint8Array)||!f(n[t]))}r(wo,"isBytesData");async function Ue(n){if(n instanceof File)return xn(n);let e=await di(n.image);return {name:n.name,altText:n.altText,resolution:n.resolution,preferredImageRendering:n.preferredImageRendering,...e}}r(Ue,"createImageTransferFromInput");async function hn(n){if(n instanceof File)return xn(n);let e=await di(n.file);return {name:n.name,...e}}r(hn,"createFileTransferFromInput");async function di(n){return n instanceof File?xn(n):wo(n)?{type:"bytes",mimeType:n.mimeType,bytes:n.bytes}:{type:"url",url:n}}r(di,"createAssetTransferFromAssetInput");function bn(n){return Promise.all(n.map(Ue))}r(bn,"createNamedAssetDataTransferFromInput");async function xn(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(xn,"getAssetDataFromFile");async function Vo(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(Vo,"measureImage");var Et=class{static{r(this,"ComputedValueBase");}};var Wo="unsupported",Oe=class n extends Et{static{r(this,"UnsupportedComputedValue");}type=Wo;#e;constructor(e){super(),this.#e=e;}static[l.unmarshal](e,t){return new n(t)}[l.marshal](){return this.#e}};function Lo(n){return n instanceof Et}r(Lo,"isComputedValue");var Ro="Font";function ci(n){return v(n)&&n[g]===Ro}r(ci,"isFontData");function Bo(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(Bo,"isFontWeight");function Uo(n){if(!f(n))return false;switch(n){case "normal":case "italic":return true;default:return false}}r(Uo,"isFontStyle");function pi(n){return v(n)?f(n.family)&&f(n.selector)&&Bo(n.weight)&&Uo(n.style):false}r(pi,"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=ui.get(t.selector);if(i)return i;let o=new n(t);return ui.set(t.selector,o),o}[l.marshal](){return {[g]:"Font",selector:this.selector,family:this.family,weight:this.weight,style:this.style}}},ui=new Map;var Oo="LinearGradient",zo="RadialGradient",Go="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})}},ze=class n extends fe{static{r(this,"LinearGradient");}[g]=Oo;#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 B({...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})`}},Ge=class n extends fe{static{r(this,"RadialGradient");}[g]=zo;#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 B({...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})`}},Ke=class n extends fe{static{r(this,"ConicGradient");}[g]=Go;#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 B({...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 mi(n){return n instanceof fe}r(mi,"isGradient");var Ko="ColorStyle";function kt(n){return v(n)?n[g]===Ko:false}r(kt,"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 $o="TextStyle";function gi(n){return v(n)?n[g]===$o:false}r(gi,"isTextStyleData");var $e=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=kt(t.color)?ne[l.unmarshal](e,t.color):t.color,this.transform=t.transform,this.alignment=t.alignment,this.decoration=t.decoration,this.decorationColor=kt(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 Cn(n){return n instanceof $e}r(Cn,"isTextStyle");function jo(n){return v(n)&&l.marshal in n}r(jo,"isSelfMarshalable");function B(n){if(jo(n))return n[l.marshal]();if(Ht(n))return n.map(B);if(ct(n)){let e={};for(let t of Object.keys(n))e[t]=B(n[t]);return e}return n}r(B,"marshal");var fi={ColorStyle:ne,ConicGradient:Ke,FileAsset:Be,Font:G,ImageAsset:X,LinearGradient:ze,RadialGradient:Ge,TextStyle:$e,BooleanVariable:Se,BorderVariable:Ve,ColorVariable:Ee,DateVariable:we,EnumVariable:Ne,FileVariable:Me,FormattedTextVariable:ve,ImageVariable:ke,LinkVariable:Ae,NumberVariable:Fe,StringVariable:De,UnsupportedVariable:We,UnsupportedComputedValue:Oe};function Ho(n){return ct(n)&&f(n[g])&&n[g]in fi}r(Ho,"isSelfUnmarshalable");function y(n,e){if(Ho(e))return fi[e[g]][l.unmarshal](n,e);if(Ht(e))return e.map(t=>y(n,t));if(ct(e)){let t={};for(let i of Object.keys(e))t[i]=y(n,e[i]);return t}return e}r(y,"unmarshal");var _o={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 qo(n){return _o[n]}r(qo,"isSupportedArrayItemFieldType");function Yo(n){return qo(n.type)}r(Yo,"isSupportedArrayItemFieldDataEntry");var tn="boolean",nn="color",rn="number",on="string",an="formattedText",sn="image",ln="array",dn="link",un="date",cn="file",pn="enum",mn="collectionReference",gn="multiCollectionReference",fn="divider",yn="unsupported";function Xo(n){return n.map(e=>{if(e.type!=="enum")return e;let t=e.cases.map(i=>{let o=i.nameByLocale?si(i.nameByLocale):undefined;return {...i,nameByLocale:o}});return {...e,cases:t}})}r(Xo,"sanitizeEnumFieldForMessage");function yi(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=yi(s.fieldData,e),u={};for(let I in d){let S=d[I];c(S&&Yo(S),"Unsupported array item field data entry"),u[I]=S;}return {...s,fieldData:u}});t[i]={...o,value:a};}return t}r(yi,"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=Xo(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 en(e,this.#e,this.id)}async addFields(e){let t=await this.#e.invoke("addCollectionFields2",this.id,e);return c(t.every(ii)),en(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 je(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)}},je=class n{static{r(this,"CollectionItem");}id;nodeId;slug;slugByLocale;draft;fieldData;#e;constructor(e,t){let i=yi(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 Zo={fixed:true,sticky:true,absolute:true,relative:true},hi="position";function tl(n){if(!(hi in n))return false;let e=n[hi];return f(e)&&Zo[e]===true}r(tl,"supportsPosition");var bi="top";function nl(n){if(!(bi in n))return false;let e=n[bi];return f(e)||C(e)}r(nl,"supportsPins");var xi="width";function il(n){if(!(xi in n))return false;let e=n[xi];return f(e)||C(e)}r(il,"supportsSize");var Ci="maxWidth";function rl(n){if(!(Ci in n))return false;let e=n[Ci];return f(e)||C(e)}r(rl,"supportsSizeConstraints");var Ii="aspectRatio";function ol(n){if(!(Ii in n))return false;let e=n[Ii];return q(e)||C(e)}r(ol,"supportsAspectRatio");var Ti="name";function al(n){if(!(Ti in n))return false;let e=n[Ti];return f(e)||C(e)}r(al,"supportsName");var Pi="visible";function sl(n){if(!(Pi in n))return false;let e=n[Pi];return Pe(e)}r(sl,"supportsVisible");var Si="locked";function ll(n){if(!(Si in n))return false;let e=n[Si];return Pe(e)}r(ll,"supportsLocked");var Fi="backgroundColor";function dl(n){if(!(Fi in n))return false;let e=n[Fi];return f(e)||ye(e)||C(e)}r(dl,"supportsBackgroundColor");var Di="backgroundColor";function ul(n){if(!(Di in n))return false;let e=n[Di];return f(e)||kt(e)||C(e)}r(ul,"supportsBackgroundColorData");var vi="backgroundImage";function cl(n){if(!(vi in n))return false;let e=n[vi];return e instanceof X||C(e)}r(cl,"supportsBackgroundImage");var Ni="backgroundImage";function pl(n){if(!(Ni in n))return false;let e=n[Ni];return e instanceof X?false:li(e)||C(e)}r(pl,"supportsBackgroundImageData");var Ei="backgroundGradient";function ml(n){if(!(Ei in n))return false;let e=n[Ei];return mi(e)||C(e)}r(ml,"supportsBackgroundGradient");var ki="backgroundGradient";function gl(n){if(!(ki in n))return false;let e=n[ki];return v(e)||C(e)}r(gl,"supportsBackgroundGradientData");var Mi="rotation";function fl(n){if(!(Mi in n))return false;let e=n[Mi];return q(e)}r(fl,"supportsRotation");var Ai="opacity";function yl(n){if(!(Ai in n))return false;let e=n[Ai];return q(e)}r(yl,"supportsOpacity");var wi="borderRadius";function hl(n){if(!(wi in n))return false;let e=n[wi];return f(e)||C(e)}r(hl,"supportsBorderRadius");var Vi="border";function bl(n){if(!(Vi in n))return false;let e=n[Vi];return C(e)||ye(e.color)}r(bl,"supportsBorder");var Wi="svg";function xl(n){if(!(Wi in n))return false;let e=n[Wi];return f(e)}r(xl,"supportsSVG");var Li="textTruncation";function Cl(n){if(!(Li in n))return false;let e=n[Li];return q(e)||C(e)}r(Cl,"supportsTextTruncation");var Ri="zIndex";function Il(n){if(!(Ri in n))return false;let e=n[Ri];return q(e)||C(e)}r(Il,"supportsZIndex");var Bi="overflow";function Tl(n){if(!(Bi in n))return false;let e=n[Bi];return f(e)||C(e)}r(Tl,"supportsOverflow");var Ui="componentIdentifier";function Pl(n){if(!(Ui in n))return false;let e=n[Ui];return f(e)}r(Pl,"supportsComponentInfo");var Oi="font";function Sl(n){if(!(Oi in n))return false;let e=n[Oi];return pi(e)}r(Sl,"supportsFont");var zi="font";function Fl(n){if(!(zi in n))return false;let e=n[zi];return ci(e)||C(e)}r(Fl,"supportsFontData");var Gi="inlineTextStyle";function Dl(n){if(!(Gi in n))return false;let e=n[Gi];return Cn(e)||C(e)}r(Dl,"supportsInlineTextStyle");var Ki="inlineTextStyle";function vl(n){if(!(Ki in n))return false;let e=n[Ki];return gi(e)||C(e)}r(vl,"supportsInlineTextStyleData");var $i="link";function Nl(n){if(!($i in n))return false;let e=n[$i];return f(e)||C(e)}r(Nl,"supportsLink");var ji="imageRendering";function El(n){if(!(ji in n))return false;let e=n[ji];return f(e)||C(e)}r(El,"supportsImageRendering");var Hi="layout";function Yi(n){if(!(Hi in n))return false;let e=n[Hi];return f(e)||C(e)}r(Yi,"supportsLayout");function kl(n){return Yi(n)?n.layout==="stack":false}r(kl,"hasStackLayout");function Ml(n){return Yi(n)?n.layout==="grid":false}r(Ml,"hasGridLayout");var _i="isVariant";function Xi(n){if(!(_i in n))return false;let e=n[_i];return Pe(e)}r(Xi,"supportsComponentVariant");function In(n){return Xi(n)?n.isVariant:false}r(In,"isComponentVariant");function Zi(n){return !Xi(n)||!In(n)?false:!C(n.gesture)}r(Zi,"isComponentGestureVariant");var qi="isBreakpoint";function Jo(n){if(!(qi in n))return false;let e=n[qi];return Pe(e)}r(Jo,"supportsBreakpoint");function Ji(n){return Jo(n)?n.isBreakpoint:false}r(Ji,"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=>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 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;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.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 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;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.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)}},He=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,P(this);}},_e=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,P(this);}async getSVG(){return this.#e.invoke("getSVGForNode",this.id)}},qe=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,P(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,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(Ji(o),"Expected node to be a FrameNode"),o}async getActiveCollectionItem(){let e=await this.#e.invoke("getActiveCollectionItemForWebPage",this.id);return e?new je(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,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(In(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(Zi(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,B(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);}},Ye=class extends W{static{r(this,"VectorSetNode");}[g]="VectorSetNode";name;constructor(e,t){super(e,t),this.name=e.name??null,P(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,P(this);}async clone(e){return this.#e.cloneDesignPage(this.id,e)}},Xe=class extends W{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 Ye(n,e);case "VectorSetItemNode":return new _e(n,e);case "ComponentInstanceNode":return new qe(n,e);case "FrameNode":return new U(n,e);case "SVGNode":return new He(n,e);case "TextNode":return new oe(n,e);case "UnknownNode":return new Xe(n,e);default:return new Xe(n,e)}}r(x,"convertRawNodeDataToNode");function Mt(n){return n instanceof U}r(Mt,"isFrameNode");function Qi(n){return n instanceof oe}r(Qi,"isTextNode");function er(n){return n instanceof He}r(er,"isSVGNode");function be(n){return n instanceof qe}r(be,"isComponentInstanceNode");function tr(n){return n instanceof K}r(tr,"isWebPageNode");function nr(n){return n instanceof ae}r(nr,"isComponentNode");function ir(n){return n instanceof $}r(ir,"isDesignPageNode");function rr(n){return n instanceof Ye}r(rr,"isVectorSetNode");function or(n){return n instanceof _e}r(or,"isVectorSetItemNode");function re(n){return n instanceof Xe}r(re,"isUnknownNode");function Ze(n){return !!(Mt(n)||Qi(n)||be(n)||er(n)||or(n)||re(n))}r(Ze,"isCanvasNode");function Tn(n){return !!(tr(n)||ir(n)||nr(n)||rr(n)||re(n))}r(Tn,"isCanvasRootNode");var Je=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 At(t,this.#e))}},At=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 Qe=class extends Error{static{r(this,"FramerPluginError");}name=this.constructor.name},J=class extends Error{static{r(this,"FramerPluginClosedError");}name=this.constructor.name};function Qo(n){return n.type==="separator"}r(Qo,"isSeparatorMenuItem");function wt(n,e){let t=[];for(let i of n){if(Qo(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 Vt="type",ar={[Vt]:"pluginReadySignal"},ta="pluginReadyResponse";var na={methodResponse:true,subscriptionMessage:true,permissionUpdate:true,menuAction:true};function sr(n){return v(n)&&f(n[Vt])&&n[Vt]in na}r(sr,"isVekterToPluginNonHandshakeMessage");function lr(n){return v(n)&&n[Vt]===ta}r(lr,"isPluginReadyResponse");var Pn=Symbol(),Sn=Symbol(),Fn=Symbol(),Dn=Symbol(),vn=Symbol(),Nn=Symbol(),En=Symbol(),kn=Symbol(),Mn=Symbol(),An=Symbol(),wn=Symbol(),k={publish:Pn,getDeployments:Sn,deploy:Fn,getChangedPaths:Dn,getChangeContributors:vn,createManagedCollection:Nn,rejectAllPending:En,readProjectForAgent:kn,getAgentSystemPrompt:Mn,getAgentContext:An,applyAgentChanges:wn};function Vn(n){return typeof n=="string"&&n in k}r(Vn,"isFramerApiOnlyMethod");var ia=["unstable_getCodeFile","unstable_getCodeFiles","unstable_getCodeFileVersionContent","unstable_getCodeFileLint2","unstable_getCodeFileTypecheck2","unstable_getCodeFileVersions","lintCode"],ra=["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",mt,gt,ft,yt,me,"getAiServiceInfo","sendTrackingEvent",...ia];new Set(ra);var Wn={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"],[_t]:[],[qt]:[],[Yt]:[],[Xt]:[],[Zt]:[],[Jt]:[],[Pn]:["publish"],[Sn]:[],[Fn]:["deploy"],[Dn]:[],[vn]:[],[Nn]:["createManagedCollection"],[En]:[],[kn]:[],[Mn]:[],[An]:[],[wn]:["applyAgentChanges"]},Wt=[];for(let n of Object.keys(Wn))Wn[n].length!==0&&Wt.push(n);P(Wt);function Ln(n){let e={};for(let t of Wt){let i=Wn[t];e[t]=i.every(o=>n[o]);}return e}r(Ln,"createPerMethodPermissionMap");function dr(){let n={};for(let e of Wt)n[e]=true;return n}r(dr,"createPerMethodPermissionMapForTesting");var xe=null;function ur(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(ur,"withDisabledCssTransitions");var et=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=Ln(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:pt(this.mode);}}async invoke(e,...t){return this.invokeTransferable(e,undefined,...t)}async invokeTransferable(e,t,...i){return new Promise((a,s)=>{let d={type:"methodInvocation",methodName:e,id:this.methodInvocationId,args:i.map(B)};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=e=>{let t=e?.data??e;if(sr(t))switch(t.type){case "permissionUpdate":{this.perMethodPermissionMap=Ln(t.permissionMap);for(let i of this.permissionSubscriptions)i();break}case "methodResponse":{let i=this.methodResponseHandlers.get(t.id);if(!i)throw new Error(`No handler for response with id ${t.id}`);this.methodResponseHandlers.delete(t.id),f(t.error)?i.reject(new Qe(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:pt(t);}};getOnActionFromCallbackMap(e,t){switch(t){case "pluginMenu":return this.menuItemOnActionCallbackMap.get(e);case "contextMenu":return this.contextMenuItemOnActionCallbackMap.get(e);default:pt(t);}}applyPluginTheme=e=>{ur(()=>{document.body.setAttribute("data-framer-theme",e.mode);for(let t in e.tokens)document.body.style.setProperty(t,e.tokens[t]);});};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(Ze(o)),o})}notify=(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:()=>this.invoke("closeNotification",i)}};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 oa(n){return n.type==="component"}r(oa,"isCodeFileComponentExport");function aa(n){return n.type==="override"}r(aa,"isCodeFileOverrideExport");var Rn=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 Rn(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 Lt=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 sa=(()=>{let n=null;return {disableUntilMouseUp:()=>{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");}}})(),cr=5,la=(()=>{let n=1;return {next:()=>`drag-${n++}`}})();function da(){}r(da,"noop");function pr(n,e,t,i){if(n.mode!=="canvas")return da;let o=la.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,dt=z-s.dragStart.mouse.y;if(Math.abs(E)<cr&&Math.abs(dt)<cr)return;s={type:"dragging",dragStart:s.dragStart},n.invoke("onDragStart",s.dragStart),document.getSelection()?.empty(),sa.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(pr,"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(ut(i)),C(i)?null:new n(i,this.#t)}};var Bn=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]=ri(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(Ze(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(Ze(a)),a});e(i);})}async getCanvasRoot(){let e=await this.#e.invoke("getCanvasRoot"),t=x(e,this.#e);return c(Tn(t)),t}subscribeToCanvasRoot(e){return this.#e.subscribe("canvasRoot",t=>{let i=x(t,this.#e);c(Tn(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 Ue(e),i=Z(t);return this.#e.invokeTransferable("addImage",i,t)}async setImage(e){let t=await Ue(e),i=Z(t);return this.#e.invokeTransferable("setImage",i,t)}async uploadImage(e){let t=await Ue(e),i=Z(t),o=await this.#e.invokeTransferable("uploadImage",i,t);return y(this.#e,o)}async addImages(e){let t=await bn(e),i=t.flatMap(Z);await this.#e.invokeTransferable("addImages",i,t);}async uploadImages(e){let t=await bn(e),i=t.flatMap(Z),o=await this.#e.invokeTransferable("uploadImages",i,t);return y(this.#e,o)}async uploadFile(e){let t=await hn(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(hn)),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(Mt(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 pr(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=(e,t)=>this.#e.notify(e,t);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(){return this.#e.invoke("getLocalizationGroups")}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}},Un=class extends Bn{static{r(this,"FramerPluginAPIBeta");}#e;constructor(e){super(e),this.#e=e,this.#e;}},tt=class extends Un{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 Lt(t,this.#e)}async[l.getAiServiceInfo](){return this.#e.invoke(mt)}async[l.sendTrackingEvent](e,t,i){return this.#e.invoke(gt,e,t,i)}async[l.getCurrentUser](){return this.#e.invoke(ft)}async[l.getProjectInfo](){return this.#e.invoke(yt)}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 Je(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[k.publish](){return this.#e.invoke("publish")}async[k.getDeployments](){return this.#e.invoke("getDeployments")}async[k.deploy](e,t){return this.#e.invoke("deploy",e,t)}async[k.getChangedPaths](){return this.#e.invoke("getChangedPaths")}async[k.getChangeContributors](e,t){return this.#e.invoke("getChangeContributors",e,t)}async[k.createManagedCollection](e){return this.createManagedCollection(e)}[k.rejectAllPending](e){this.#e.rejectAllPending(e);}async[k.getAgentSystemPrompt](){return this.#e.invoke("getAgentSystemPrompt")}async[k.getAgentContext](e){return this.#e.invoke("getAgentContext",e)}async[k.readProjectForAgent](e,t){return this.#e.invoke("readProjectForAgent",e,t)}async[k.applyAgentChanges](e,t){return this.#e.invoke("applyAgentChanges",e,t)}};var On=class{constructor(e){this.origin=e;}static{r(this,"IframeTransport");}send(e,t){window.parent.postMessage(e,this.origin,t);}onMessage(e){window.addEventListener("message",e);}};async function ua(){return new Promise(n=>{function e({data:t,origin:i}){if(!lr(t))return;window.removeEventListener("message",e);let a={transport:new On(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(ar,"*");})}r(ua,"createBrowserContext");async function ca(){return typeof window>"u"||"Deno"in globalThis?null:ua()}r(ca,"bootstrap");var mr=await ca(),se=mr?new tt(new et(mr)):new Proxy({},{get(n,e){throw new Error(`Cannot access framer.${String(e)} in server runtime. Use createFramerInstance() with a custom transport.`)}});function gr(n){return new tt(new et(n))}r(gr,"createFramerInstance");var fr={};function ma(n){if(env)try{Object.assign(env,n);}catch{}Object.assign(fr,n);}r(ma,"configure");function Ie(n,e){let t=fr[n]??env[n];return t&&t.length>0?t:e}r(Ie,"getEnv");var yr=isWorkerd,Gn=globalThis.WebSocket;async function hr(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(hr,"connectWebSocketCF");var br,xr;try{br=await import('node:fs'),xr=await import('node:path');}catch{}var Kn=br,$n=xr;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=undefined;}};function ga(n){return n instanceof D?n.code==="POOL_EXHAUSTED":false}r(ga,"isRetryableError");var fa=new Map(Object.values(le).map(n=>[n,n]));function Ir(n){return typeof n=="string"?fa.get(n)??"INTERNAL":"INTERNAL"}r(Ir,"parseErrorCode");var jn={silent:0,error:1,warn:2,info:3,debug:4};function ya(){let n=Ie("FRAMER_API_LOG_LEVEL")?.toLowerCase();return n&&n in jn?n:"warn"}r(ya,"getLogLevel");var Hn=ya();function nt(n){return jn[n]<=jn[Hn]}r(nt,"shouldLog");var it=globalThis.console,ha="\x1B[90m",ba="\x1B[0m";function xa(n){return n?`[FramerAPI:${n}]`:"[FramerAPI]"}r(xa,"formatPrefix");function Ca(n,...e){return [ha+n,...e,ba]}r(Ca,"formatDebug");function Tr(n){let e=xa(n);return {warn:(...t)=>{nt("warn")&&it.warn(e,...t);},error:(...t)=>{nt("error")&&it.error(e,...t);},log:(...t)=>{nt("info")&&it.log(e,...t);},info:(...t)=>{nt("info")&&it.info(e,...t);},debug:(...t)=>{nt("debug")&&it.debug(...Ca(e,...t));},setLevel:t=>{Hn=t;},getLevel:()=>Hn,withRequestId:t=>Tr(t)}}r(Tr,"createLogger");var N=Tr();N.warn;N.error;N.log;N.info;N.debug;N.setLevel;N.getLevel;var Rt="0.1.4";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(`
|
|
9
9
|
`);i[1]?.includes("assert")?(i.splice(1,1),t.stack=i.join(`
|
|
10
10
|
`)):i[0]?.includes("assert")&&(i.splice(0,1),t.stack=i.join(`
|
|
11
|
-
`));}catch{}throw t}r(
|
|
12
|
-
`)};return n.logs&&console?.warn("extras.logs is reserved for log replay buffer, use another key"),e},"enrichWithLogs"),Lt=class{constructor(e,t){this.id=e;this.errorIsCritical=t??(e==="fatal"||e.endsWith(":fatal"));}static{r(this,"Logger");}level=3;didLog={};errorIsCritical;extend(e){let t=this.id+":"+e;return ot(t)}getBufferedMessages(){return Z.filter(e=>e.logger===this)}setLevel(e){let t=this.level;return this.level=e,t}isLoggingTraceMessages(){return this.level>=0}trace=(...e)=>{if(this.level>0)return;let t=le(this,0,e);console?.log(...t.toMessage());};debug=(...e)=>{let t=le(this,1,e);this.level>1||console?.log(...t.toMessage());};info=(...e)=>{let t=le(this,2,e);this.level>2||console?.info(...t.toMessage());};warn=(...e)=>{let t=le(this,3,e);this.level>3||console?.warn(...t.toMessage());};warnOncePerMinute=(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=le(this,3,t);this.level>3||console?.warn(...o.toMessage());};error=(...e)=>{let t=le(this,4,e);this.level>4||console?.error(...t.toMessage());};errorOncePerMinute=(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=le(this,4,t);this.level>4||console?.error(...o.toMessage());};reportWithoutLogging=(e,t,i,o)=>{let a=ha(t??{}),s=fr({caller:this.reportWithoutLogging,error:e,tags:{...i,handler:"logger",where:this.id},extras:t,critical:o??this.errorIsCritical});return [a,s]};reportError=(e,t,i,o)=>{let[a,s]=this.reportWithoutLogging(e,t,i,o);a?this.error(s,a):this.error(s);};reportErrorOncePerMinute=(e,t)=>{if(!ba(e))return;let i=this.didLog[e.message];i&&i>Date.now()||(this.didLog[e.message]=Date.now()+1e3*60,this.reportError(e,t));};reportCriticalError=(e,t,i)=>this.reportError(e,t,i,true)};function ba(n){return Object.prototype.hasOwnProperty.call(n,"message")}r(ba,"isErrorWithMessage");function xa(n){return n.replace(/[/\-\\^$*+?.()|[\]{}]/gu,"\\$&")}r(xa,"escapeRegExp");var Dr;(Ce=>{function n(b,...u){return b.concat(u)}Ce.push=n,r(n,"push");function e(b){return b.slice(0,-1)}Ce.pop=e,r(e,"pop");function t(b,...u){return u.concat(b)}Ce.unshift=t,r(t,"unshift");function i(b,u,...T){let m=b.length;if(u<0||u>m)throw Error("index out of range: "+u);let g=b.slice();return g.splice(u,0,...T),g}Ce.insert=i,r(i,"insert");function o(b,u,T){let m=b.length;if(u<0||u>=m)throw Error("index out of range: "+u);let g=Array.isArray(T)?T:[T],A=b.slice();return A.splice(u,1,...g),A}Ce.replace=o,r(o,"replace");function a(b,u){let T=b.length;if(u<0||u>=T)throw Error("index out of range: "+u);let m=b.slice();return m.splice(u,1),m}Ce.remove=a,r(a,"remove");function s(b,u,T){let m=b.length;if(u<0||u>=m)throw Error("from index out of range: "+u);if(T<0||T>=m)throw Error("to index out of range: "+T);let g=b.slice();if(T===u)return g;let A=g[u];return u<T?(g.splice(T+1,0,A),g.splice(u,1)):(g.splice(u,1),g.splice(T,0,A)),g}Ce.move=s,r(s,"move");function d(b,u){let T=[],m=Math.min(b.length,u.length);for(let g=0;g<m;g++)T.push([b[g],u[g]]);return T}Ce.zip=d,r(d,"zip");function h(b,u,T){let m=b.slice(),g=m[u];return g===undefined||(m[u]=T(g)),m}Ce.update=h,r(h,"update");function C(b){return Array.from(new Set(b))}Ce.unique=C,r(C,"unique");function F(b,...u){return Array.from(new Set([...b,...u.flat()]))}Ce.union=F,r(F,"union");function G(b,u){return b.filter(u)}Ce.filter=G,r(G,"filter");})(Dr||={});var Da=Object.prototype.hasOwnProperty;function va(n,e){return Da.call(n,e)}r(va,"hasOwnProperty");var vr;(i=>{function n(o,a){for(let s of Object.keys(o))va(a,s)||delete o[s];for(let s of Object.keys(a))o[s]===undefined&&(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");})(vr||={});var Nr;(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 h of s)d.delete(h);return d}o.remove=e,r(e,"remove");function t(...a){let s=new Set;for(let d of a)for(let h of d)s.add(h);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");})(Nr||={});var kr;(i=>{function n(o,...a){let s=new Map;o.forEach((h,C)=>s.set(C,h));let d=false;for(let h of a)h&&(h.forEach((C,F)=>s.set(F,C)),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");})(kr||={});var Rt=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);};}};Rt.prototype.constructor=Promise;ot("task-queue");function Er(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}r(Er,"isObject");var Ma=-1,Bt=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=()=>{this.removeListeners(),this.closed=true,this.chunkBuffers.clear(),this.onError?.(new D("Connection closed","PROJECT_CLOSED"));};handleMessage=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);};tryHandleDebugArchive(e){try{let t=de.parse(e);if(Er(t)&&t.type==="debug-archive")return $n(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(de.stringify(e));}handleChunk(e){let t=this.chunkBuffers.get(e.id);return t||(t=[],this.chunkBuffers.set(e.id,t)),t.push(e.data),e.seq===Ma?(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=de.parse(e);if(Er(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 $n(n){X(Vn,"File system module is not available."),X(Wn,"Path module is not available.");let t=`debug-archive-${new Date().toISOString().replace(/[:.]/gu,"-")}.zip`,i=process.cwd(),o=Wn.resolve(i,t);Vn.writeFileSync(o,Buffer.from(n)),N.info(`Debug archive saved to ${o}`);}r($n,"handleDebugArchive");function xe(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}r(xe,"isObject");var Aa={type:"pluginReadySignal"};function wa(n){return xe(n)&&n.type==="pluginReadyResponse"}r(wa,"isPluginReadyResponse");var Mr=9e4,Va=2e4;function Wa(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=de.parse(a.data);xe(s)&&s.type==="disconnect-ack"&&(clearTimeout(i),n.removeEventListener("message",o),t());}catch{}},"handler");n.addEventListener("message",o);})}r(Wa,"waitForDisconnectAck");async function La(n,e){let t={Authorization:`Token ${e}`};if(sr)return N.debug("Using Cloudflare Workers WebSocket connection"),dr(n,t);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 lr(n.href,{headers:t});return i&&(process.env.NODE_TLS_REJECT_UNAUTHORIZED=o),a}r(La,"createWebSocket");async function Ut(n,e,t){let i=new URL(t??be("FRAMER_HEADLESS_SERVER_URL","wss://api.framer.com/channel/headless-plugin"));i.protocol=i.protocol==="https:"?"wss:":i.protocol==="http:"?"ws:":i.protocol,i.searchParams.set("projectId",n),i.searchParams.set("sdkVersion","0.1.2"),N.debug(`Connecting to ${i.href}`);let o=await La(i,e);N.debug(`WebSocket created, readyState: ${o.readyState}`);let a,s,d=N,h=false,C=setInterval(()=>{o.readyState===o.OPEN&&(o.send(de.stringify({type:"ping"})),d.debug("Sent ping"));},Va),F=r(()=>{clearInterval(C),o.readyState!==o.CLOSED&&o.readyState!==o.CLOSING&&o.close(1e3,"Client disconnect");},"forceClose"),G=r(async()=>{clearInterval(C),!(o.readyState===o.CLOSED||o.readyState===o.CLOSING)&&(h&&(d.debug("Initiating graceful disconnect"),o.send(de.stringify({type:"client-disconnect"})),await Wa(o,15e3)),o.readyState!==o.CLOSED&&o.readyState!==o.CLOSING&&o.close(1e3,"Client disconnect"));},"cleanup"),Ce=await new Promise((b,u)=>{let T=setTimeout(()=>{F(),u(new D(`Connection timeout after ${Mr}ms`,"TIMEOUT"));},Mr),m=r(()=>{d.debug("WebSocket opened, waiting for ready");},"onOpen"),g=r(E=>{d.debug("WebSocket error:",E),clearTimeout(T),F(),u(new D("No connection to the server","INTERNAL"));},"onError"),A=r(E=>{d.debug(`WebSocket closed: code=${E.code}, reason=${E.reason||"(no reason)"}, wasClean=${E.wasClean}`),clearTimeout(T),clearInterval(C),u(new D(`Connection to the server was closed (code: ${E.code})`,"PROJECT_CLOSED"));},"onClose");function K(E){d.debug("Received message");let J=typeof E.data=="string"?E.data:E.data.toString(),P=de.parse(J);if(d.debug(`Message type: ${P.type}`),P.type==="error"){clearTimeout(T),o.removeEventListener("close",A),o.removeEventListener("error",g);let jn=pr(P.code);u(new D(P.message||"Server error",jn)),F();}else P.type==="ready"?(xe(P)&&"requestId"in P&&(a=String(P.requestId),d=N.withRequestId(a),d.debug(`Server request ID: ${a}`)),xe(P)&&"sessionId"in P&&(s=String(P.sessionId),d.debug(`Server session ID: ${s}`)),xe(P)&&"version"in P&&d.debug(`Server version: ${P.version}`),xe(P)&&P.gracefulDisconnect===true&&(h=true),d.debug("Sending pluginReadySignal"),o.send(de.stringify(Aa))):P.type==="debug-archive"?$n(P.data):wa(P)&&(clearTimeout(T),o.removeEventListener("message",K),o.removeEventListener("error",g),o.removeEventListener("close",A),b(P));}r(K,"handshakeMessageHandler"),o.addEventListener("open",m),o.addEventListener("message",K),o.addEventListener("error",g),o.addEventListener("close",A);});return o.addEventListener("close",()=>{G();}),{ws:o,pluginReadyData:Ce,requestId:a,sessionId:s,logger:d,gracefulDisconnect:h,cleanup:G}}r(Ut,"connectAndHandshake");var Ar={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 Hn(n){return n in Ar?Ar[n]===true:false}r(Hn,"isAllowedMethod");var Ot=class n{static{r(this,"FramerAPI");}requestId;#e;#t;#n;#i=new Map;#r=new Map;#c=0;#a;#s;#l;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.#n.onMessage(t=>{this.#p(t);}),this.#n.setOnError(t=>{this.#d(t);});}#d(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[k.rejectAllPending](e);}#u(){return `req-${++this.#c}-${Date.now()}`}#p=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}};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(vn(o)){let s=k[o],d=Reflect.get(i.#t,s);return typeof d=="function"?d.bind(i.#t):d}if(!Hn(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||vn(o)?true:Hn(o)?o in i.#t:false}})}async#o(){this.#d(new D("Connection closed","PROJECT_CLOSED")),await this.#e();}disconnect=()=>this.#o();reconnect=async()=>{await this.#o();let e=await Ut(this.#a,this.#s,this.#l);this.#n.replaceSocket(e.ws),this.#e=e.cleanup,this.requestId=e.requestId;};screenshot=(e,t)=>{let i=this.#u(),{format:o,quality:a,scale:s,clip:d}=t??{};return new Promise((h,C)=>{this.#i.set(i,{resolve:h,reject:C}),this.#n.send({type:"screenshot",id:i,nodeId:e,format:o,quality:a,scale:s,clip:d});})};exportSVG=e=>{let t=this.#u();return new Promise((i,o)=>{this.#r.set(t,{resolve:i,reject:o}),this.#n.send({type:"exportSVG",id:t,nodeId:e});})};[Symbol.dispose]=()=>void this.#o();[Symbol.asyncDispose]=()=>this.#o()};var Ra=/^.+--([A-Za-z0-9]+)/u,wr=/^[A-Za-z0-9]{20}$/u;function Vr(n){if(wr.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(Ra)?.[1]??a;if(wr.test(d))return d}}return null}catch{return null}}r(Vr,"parseProjectId");async function Wr(n,e,t){let i=performance.now();if(!n)throw new D("FRAMER_PROJECT_URL environment variable is required","INVALID_REQUEST");let o=Vr(n);if(!o)throw new D(`Invalid project URL or ID: ${n}`,"INVALID_REQUEST");let a=e??be("FRAMER_API_KEY");if(!a)throw new D("FRAMER_API_KEY environment variable is required","INVALID_REQUEST");let s=await Ut(o,a,t?.serverUrl);try{let d=new Bt(s.ws),h={transport:d,mode:s.pluginReadyData.mode,permissionMap:s.pluginReadyData.permissionMap,environmentInfo:s.pluginReadyData.environmentInfo,origin:null,theme:null,initialState:s.pluginReadyData.initialState},C=or(h),F=r(async()=>{let G=((performance.now()-i)/1e3).toFixed(2);s.logger.debug(`Connection ended after ${G}s`),await s.cleanup();},"cleanup");return Ot.create({pluginAPI:C,transport:d,cleanup:F,projectId:o,apiKey:a,serverUrl:t?.serverUrl,requestId:s.requestId})}catch(d){throw await s.cleanup(),d}}r(Wr,"connect");async function Ba(n,e,t,i){let o=await Wr(n,t,i);try{return await e(o)}finally{await o.disconnect();}}r(Ba,"withConnection");
|
|
11
|
+
`));}catch{}throw t}r(ee,"assert");var Pr;function Sr({error:n,tags:e,extras:t,critical:i,caller:o}){ee(Pr,"Set up an error callback with setErrorReporter, or configure Sentry with initializeEnvironment");let a=qn(n,o);return Pr({error:a,tags:{...a.tags,...e},extras:{...a.extras,...t},critical:!!i}),a}r(Sr,"reportError");function qn(n,e=qn){return n instanceof Error?n:new _n(n,e)}r(qn,"reportableError");var _n=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 rt=typeof window<"u"&&!("Deno"in globalThis)?window.location.hostname:undefined,Fr=!!(rt&&["web.framerlocal.com","localhost","127.0.0.1","[::1]"].includes(rt)),Yn=(()=>{if(!rt)return;if(Fr)return {main:rt,previewLink:undefined};let n=/^(([^.]+\.)?beta\.)?((?:development\.)?framer\.com)$/u,e=rt.match(n);if(!(!e||!e[3]))return {previewLink:e[2]&&e[0],main:e[3]}})();({hosts:Yn,isDevelopment:Yn?.main==="development.framer.com",isProduction:Yn?.main==="framer.com",isLocal:Fr});var Bt;function Ut(){return typeof window>"u"?{}:Bt||(Bt=Pa(),Bt)}r(Ut,"getServiceMap");function Pa(){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(Pa,"extractServiceMap");function ot(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 ot(n.toJSON(),e+1,t);if(Array.isArray(n))return n.map(i=>ot(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]=ot(a,e+1,t);return i}}catch(i){return `[Throws: ${i instanceof Error?i.message:i}]`}finally{t.delete(n);}}r(ot,"jsonSafeCopy");var Xn=["trace","debug","info","warn","error"],Sa=["\u{1F50D}","\u{1F9EA}","\u2139\uFE0F","\u26A0\uFE0F","\u274C"],Fa=[":trace",":debug",":info",":warn",":error"],Nr="logTimestamps";function Er(n){return new Date(n).toISOString().substring(10,24)}r(Er,"formatLogTimestamp");function kr(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 I=0;I<=4;I++){let S=Fa[I];if(S&&o.endsWith(S)){a=I,s&&(a+=1),o=o.slice(0,o.length-S.length),o.length===0&&(o="*");break}}let d=new RegExp("^"+Lr(o).replace(/\\\*/gu,".*")+"$"),u=0;for(let I of e)I.id.match(d)&&(I.level=a,++u);u===0&&t.push(i);}return t}r(kr,"applyLogLevelSpec");var at=class n{constructor(e,t,i){this.logger=e;this.level=t;this.parts=i;this.id=n.nextId++,this.time=Date.now();}static{r(this,"LogEntry");}static nextId=0;id;time;stringPrefix;cachedMessage;toMessage(){if(this.stringPrefix)return this.cachedMessage??this.parts;let e=[Xn[this.level]+": ["+this.logger.id+"]"];Ot&&e.unshift(Er(this.time)),this.stringPrefix=e.join(" ");let t=this.parts[0];if(typeof t=="string"){let i=Ma(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=undefined,this.cachedMessage=undefined;}toConsoleMessage(){let e=this.toMessage().slice(),t=e[0];if(typeof t!="string")return e;let i=Xn[this.level],o=Sa[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(ot(e));return i?.length>253?i.slice(0,250)+"...":i}).join(" ")}},H="*:app:info,app:info",Ot=true,Mr=typeof process<"u"&&!!process.kill,Da=Mr&&!!process.env.CI;Da?H="-:warn":Mr&&(H="");try{typeof window<"u"&&window.localStorage&&(H=window.localStorage.logLevel||H,Ot=window.localStorage[Nr]!=="false");}catch{}try{typeof process<"u"&&(H=process.env.DEBUG||H);}catch{}try{typeof window<"u"&&Object.assign(window,{setLogLevel:Vr,setLogTimestamps:Wr});}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=st(e);if(t<0||t>5)return;i[0]=i[0].replace("[","*[");let s=new at(a,t,i);s.stringPrefix=i[0],j.push(s),!o&&(a.level>t||console?.log(...s.toConsoleMessage()));});}catch{}var Jn;try{typeof window<"u"&&window.postMessage&&window.parent!==window&&!window.location.pathname.startsWith("/edit")&&(Jn=r(n=>{try{let e=n.toMessage().map(s=>ot(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,Ut().app);}catch{}},"postLogEntry"));}catch{}var Zn={},j=[],Ar=1e3;function de(n,e,t){let i=new at(n,e,t);for(j.push(i),Jn?.(i);j.length>Ar;)j.shift();return i}r(de,"createLogEntry");function wr(n){return typeof n=="number"&&(Ar=n),j}r(wr,"getLogReplayBuffer");var va=/\/(?<filename>[^/.]+)(?=\.(?:debug\.)?html$)/u,vr;function Na(){if(!(typeof window>"u"||!window.location))return vr??=va.exec(window.location.pathname)?.groups?.filename,vr}r(Na,"getFilenameFromWindowPathname");function st(n){let e=Na();n=(e?e+":":"")+n;let t=Zn[n];if(t)return t;let i=new zt(n);return Zn[n]=i,kr(H,[i]),Jn?.(new at(i,-1,[])),i}r(st,"getLogger");function Vr(n,e=true){try{typeof window<"u"&&window.localStorage&&(window.localStorage.logLevel=n);}catch{}let t=H;H=n;let i=Object.values(Zn);for(let a of i)a.level=3;let o=kr(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(Vr,"setLogLevel");function Wr(n){let e=Ot;Ot=n;for(let t of j)t.resetMessagePrefix();try{typeof window<"u"&&window.localStorage&&(window.localStorage[Nr]=String(n));}catch{}return e}r(Wr,"setLogTimestamps");var Ea=r(n=>{let e={...n,logs:wr().slice(-50).map(t=>t.toString().slice(0,600)).join(`
|
|
12
|
+
`)};return n.logs&&console?.warn("extras.logs is reserved for log replay buffer, use another key"),e},"enrichWithLogs"),zt=class{constructor(e,t){this.id=e;this.errorIsCritical=t??(e==="fatal"||e.endsWith(":fatal"));}static{r(this,"Logger");}level=3;didLog={};errorIsCritical;extend(e){let t=this.id+":"+e;return st(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=(...e)=>{if(this.level>0)return;let t=de(this,0,e);console?.log(...t.toConsoleMessage());};debug=(...e)=>{let t=de(this,1,e);this.level>1||console?.log(...t.toConsoleMessage());};info=(...e)=>{let t=de(this,2,e);this.level>2||console?.info(...t.toConsoleMessage());};warn=(...e)=>{let t=de(this,3,e);this.level>3||console?.warn(...t.toConsoleMessage());};warnOncePerMinute=(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());};error=(...e)=>{let t=de(this,4,e);this.level>4||console?.error(...t.toConsoleMessage());};errorOncePerMinute=(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());};reportWithoutLogging=(e,t,i,o)=>{let a=Ea(t??{}),s=Sr({caller:this.reportWithoutLogging,error:e,tags:{...i,handler:"logger",where:this.id},extras:t,critical:o??this.errorIsCritical});return [a,s]};reportError=(e,t,i,o)=>{let[a,s]=this.reportWithoutLogging(e,t,i,o);a?this.error(s,a):this.error(s);};reportErrorOncePerMinute=(e,t)=>{if(!ka(e))return;let i=this.didLog[e.message];i&&i>Date.now()||(this.didLog[e.message]=Date.now()+1e3*60,this.reportError(e,t));};reportCriticalError=(e,t,i)=>this.reportError(e,t,i,true)};function ka(n){return Object.prototype.hasOwnProperty.call(n,"message")}r(ka,"isErrorWithMessage");function Lr(n){return n.replace(/[/\-\\^$*+?.()|[\]{}]/gu,"\\$&")}r(Lr,"escapeRegExp");function Ma(n,e,t){let i=Xn[t];if(!i)return n;let o=`${i}: [${e}]`,a=Lr(o).replace("\\[","\\*?\\["),s=new RegExp(`^(?:T?\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z\\s+)?${a}\\s*`);return n.replace(s,"")}r(Ma,"stripLogEntryPrefix");var Ur;(_=>{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===undefined||(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");})(Ur||={});var Ba=Object.prototype.hasOwnProperty;function Ua(n,e){return Ba.call(n,e)}r(Ua,"hasOwnProperty");var Or;(i=>{function n(o,a){for(let s of Object.keys(o))Ua(a,s)||delete o[s];for(let s of Object.keys(a))o[s]===undefined&&(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");})(Or||={});var zr;(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");})(zr||={});var Gr;(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");})(Gr||={});(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);};}});st("task-queue");function Kr(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}r(Kr,"isObject");var Ka=-1,Kt=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=()=>{this.removeListeners(),this.closed=true,this.chunkBuffers.clear(),this.onError?.(new D("Connection closed","PROJECT_CLOSED"));};handleMessage=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);};tryHandleDebugArchive(e){try{let t=ue.parse(e);if(Kr(t)&&t.type==="debug-archive")return ei(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));}handleChunk(e){let t=this.chunkBuffers.get(e.id);return t||(t=[],this.chunkBuffers.set(e.id,t)),t.push(e.data),e.seq===Ka?(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(Kr(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 ei(n){ee(Kn,"File system module is not available."),ee($n,"Path module is not available.");let t=`debug-archive-${new Date().toISOString().replace(/[:.]/gu,"-")}.zip`,i=process.cwd(),o=$n.resolve(i,t);Kn.writeFileSync(o,Buffer.from(n)),N.info(`Debug archive saved to ${o}`);}r(ei,"handleDebugArchive");function Te(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}r(Te,"isObject");var $a={type:"pluginReadySignal"};function ja(n){return Te(n)&&n.type==="pluginReadyResponse"}r(ja,"isPluginReadyResponse");var $r=9e4,Ha=2e4;function _a(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(_a,"waitForDisconnectAck");async function qa(n,e){let t={Authorization:`Token ${e}`};if(yr)return N.debug("Using Cloudflare Workers WebSocket connection"),hr(n,t);if(isDeno)return new Gn(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 Gn(n.href,{headers:t});return i&&(process.env.NODE_TLS_REJECT_UNAUTHORIZED=o),a}r(qa,"createWebSocket");async function $t(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",Rt),t&&o.searchParams.set("clientId",t),N.debug(`Connecting to ${o.href}`);let a=await qa(o,e);N.debug(`WebSocket created, readyState: ${a.readyState}`);let s,d,u=N,I=false,S=setInterval(()=>{a.readyState===a.OPEN&&(a.send(ue.stringify({type:"ping"})),u.debug("Sent ping"));},Ha),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 _a(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 ${$r}ms`,"TIMEOUT"));},$r),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 dt=typeof E.data=="string"?E.data:E.data.toString(),F=ue.parse(dt);if(u.debug(`Message type: ${F.type}`),F.type==="error"){clearTimeout(m),a.removeEventListener("close",z),a.removeEventListener("error",A);let ce=Ir(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=N.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($a))):F.type==="debug-archive"?ei(F.data):ja(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($t,"connectAndHandshake");var jr={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 ti(n){return n in jr?jr[n]===true:false}r(ti,"isAllowedMethod");var jt=class n{static{r(this,"FramerAPI");}requestId;#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.#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[k.rejectAllPending](e);}#c(){return `req-${++this.#p}-${Date.now()}`}#m=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}};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(Vn(o)){let s=k[o],d=Reflect.get(i.#t,s);return typeof d=="function"?d.bind(i.#t):d}if(!ti(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||Vn(o)?true:ti(o)?o in i.#t:false}})}async#o(){this.#u(new D("Connection closed","PROJECT_CLOSED")),await this.#e();}disconnect=()=>this.#o();reconnect=async()=>{await this.#o();let e=await $t(this.#a,this.#s,this.#d,this.#l);this.#n.replaceSocket(e.ws),this.#e=e.cleanup,this.requestId=e.requestId;};screenshot=(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});})};exportSVG=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});})};[Symbol.dispose]=()=>void this.#o();[Symbol.asyncDispose]=()=>this.#o()};var Ya=/^.+--([A-Za-z0-9]+)/u,Hr=/^[A-Za-z0-9]{20}$/u;function _r(n){if(Hr.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(Ya)?.[1]??a;if(Hr.test(d))return d}}return null}catch{return null}}r(_r,"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=_r(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/${Rt}`,d=await $t(o,a,s,t?.serverUrl);try{let u=new Kt(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=gr(I),O=r(async()=>{let _=((performance.now()-i)/1e3).toFixed(2);d.logger.debug(`Connection ended after ${_}s`),await d.cleanup();},"cleanup");return jt.create({pluginAPI:S,transport:u,cleanup:O,projectId:o,apiKey:a,serverUrl:t?.serverUrl,clientId:d.clientId,requestId:d.requestId})}catch(u){throw await d.cleanup(),u}}r(qr,"connect");async function Xa(n,e,t,i){let o=await qr(n,t,i);try{return await e(o)}finally{await o.disconnect();}}r(Xa,"withConnection");
|
|
13
13
|
|
|
14
|
-
export {
|
|
14
|
+
export { ht as BooleanField, Se as BooleanVariable, Ve as BorderVariable, vt as CollectionReferenceField, bt as ColorField, Ee as ColorVariable, qe as ComponentInstanceNode, ae as ComponentNode, Ke as ConicGradient, Pt as DateField, we as DateVariable, $ as DesignPageNode, Y as EnumCase, Dt as EnumField, Ne as EnumVariable, le as ErrorCode, St as FieldDivider, Ft as FileField, Me as FileVariable, It as FormattedTextField, ve as FormattedTextVariable, U as FrameNode, D as FramerAPIError, J as FramerPluginClosedError, Qe as FramerPluginError, Le as ImageField, ke as ImageVariable, ze as LinearGradient, Tt as LinkField, Ae as LinkVariable, Nt as MultiCollectionReferenceField, xt as NumberField, Fe as NumberVariable, Ge as RadialGradient, He as SVGNode, Ct as StringField, De as StringVariable, oe as TextNode, Oe as UnsupportedComputedValue, Re as UnsupportedField, We as UnsupportedVariable, Je as VectorSet, At as VectorSetItem, _e as VectorSetItemNode, Ye as VectorSetNode, K as WebPageNode, ma as configure, qr as connect, se as framer, Ml as hasGridLayout, kl as hasStackLayout, Ji as isBreakpoint, oa as isCodeFileComponentExport, aa as isCodeFileOverrideExport, ye as isColorStyle, Zi as isComponentGestureVariant, be as isComponentInstanceNode, nr as isComponentNode, vo as isComponentVariable, In as isComponentVariant, Lo as isComputedValue, ir as isDesignPageNode, No as isField, ko as isFileAsset, Mt as isFrameNode, Ao as isImageAsset, ga as isRetryableError, er as isSVGNode, Qi as isTextNode, Cn as isTextStyle, oi as isVariable, or as isVectorSetItemNode, rr as isVectorSetNode, tr as isWebPageNode, ol as supportsAspectRatio, dl as supportsBackgroundColor, ul as supportsBackgroundColorData, ml as supportsBackgroundGradient, gl as supportsBackgroundGradientData, cl as supportsBackgroundImage, pl as supportsBackgroundImageData, bl as supportsBorder, hl as supportsBorderRadius, Jo as supportsBreakpoint, Pl as supportsComponentInfo, Xi as supportsComponentVariant, Sl as supportsFont, Fl as supportsFontData, El as supportsImageRendering, Dl as supportsInlineTextStyle, vl as supportsInlineTextStyleData, Yi as supportsLayout, Nl as supportsLink, ll as supportsLocked, al as supportsName, yl as supportsOpacity, Tl as supportsOverflow, nl as supportsPins, tl as supportsPosition, fl as supportsRotation, xl as supportsSVG, il as supportsSize, rl as supportsSizeConstraints, Cl as supportsTextTruncation, sl as supportsVisible, Il as supportsZIndex, Xa 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.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"prepublishOnly": "echo 'Please use make for publishing' && exit 1"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"devalue": "^5.6.
|
|
33
|
-
"std-env": "^
|
|
32
|
+
"devalue": "^5.6.4",
|
|
33
|
+
"std-env": "^4.0.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@biomejs/biome": "1.9.4",
|
|
@@ -55,8 +55,5 @@
|
|
|
55
55
|
},
|
|
56
56
|
"engines": {
|
|
57
57
|
"node": ">=22"
|
|
58
|
-
},
|
|
59
|
-
"publishConfig": {
|
|
60
|
-
"registry": "https://registry.npmjs.org"
|
|
61
58
|
}
|
|
62
59
|
}
|