framer-api 0.1.12 → 0.1.14-beta

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 CHANGED
@@ -4668,6 +4668,11 @@ declare const getChangeContributors: unique symbol;
4668
4668
  declare const createManagedCollection: unique symbol;
4669
4669
  declare const rejectAllPending: unique symbol;
4670
4670
  declare const readProjectForAgent: unique symbol;
4671
+ declare const readComponentControlsForAgent: unique symbol;
4672
+ declare const readIconSetControlsForAgent: unique symbol;
4673
+ declare const readIconsForAgent: unique symbol;
4674
+ declare const readLayoutTemplateControlsForAgent: unique symbol;
4675
+ declare const readShaderControlsForAgent: unique symbol;
4671
4676
  declare const getAgentSystemPrompt: unique symbol;
4672
4677
  declare const getAgentContext: unique symbol;
4673
4678
  declare const applyAgentChanges: unique symbol;
@@ -4690,7 +4695,9 @@ declare const startAgentConversation: unique symbol;
4690
4695
  declare const continueAgentConversation: unique symbol;
4691
4696
  declare const submitAgentClarification: unique symbol;
4692
4697
  declare const runSupervisorAgentCommand: unique symbol;
4698
+ declare const ping: unique symbol;
4693
4699
  declare const $framerApiOnly: {
4700
+ readonly ping: typeof ping;
4694
4701
  readonly publish: typeof publish;
4695
4702
  readonly getDeployments: typeof getDeployments;
4696
4703
  readonly deploy: typeof deploy;
@@ -4699,6 +4706,11 @@ declare const $framerApiOnly: {
4699
4706
  readonly createManagedCollection: typeof createManagedCollection;
4700
4707
  readonly rejectAllPending: typeof rejectAllPending;
4701
4708
  readonly readProjectForAgent: typeof readProjectForAgent;
4709
+ readonly readComponentControlsForAgent: typeof readComponentControlsForAgent;
4710
+ readonly readIconSetControlsForAgent: typeof readIconSetControlsForAgent;
4711
+ readonly readIconsForAgent: typeof readIconsForAgent;
4712
+ readonly readLayoutTemplateControlsForAgent: typeof readLayoutTemplateControlsForAgent;
4713
+ readonly readShaderControlsForAgent: typeof readShaderControlsForAgent;
4702
4714
  readonly getAgentSystemPrompt: typeof getAgentSystemPrompt;
4703
4715
  readonly getAgentContext: typeof getAgentContext;
4704
4716
  readonly applyAgentChanges: typeof applyAgentChanges;
@@ -4794,7 +4806,7 @@ type AllMembers = Omit<FramerPluginAPIAlpha, "isAllowedTo" | "subscribeToIsAllow
4794
4806
  "WebPageNode.clone": WebPageNode["clone"];
4795
4807
  "DesignPageNode.clone": DesignPageNode["clone"];
4796
4808
  } & 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">;
4797
- 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", "unstable_getDependencyVersion", "getRedirects", "uploadFile", "uploadFiles", "uploadImage", "uploadImages", "zoomIntoView", "navigateTo", "getRuntimeErrorForModule", "getRuntimeErrorForCodeComponentNode", "showProgressOnInstances", "removeProgressFromInstances", "addComponentInstancePlaceholder", "updateComponentInstancePlaceholder", "removeComponentInstancePlaceholder", "setMenu", "showContextMenu", "getBreakpointSuggestionsForWebPage", "getActiveCollectionItemForWebPage", "getVariables", "getVectorSets", "getVectorSetItems", "getVectorSetItemVariables", "getChangedPaths", "getChangeContributors", "getDeployments", "readProjectForAgent", "getAgentSystemPrompt", "getAgentContext", "queryImagesForAgent", "reviewChangesForAgent", "getNodeForAgent", "getNodesForAgent", "getNodesOfTypesForAgent", "getScopeNodeForAgent", "getGroundNodeForAgent", "getParentNodeForAgent", "getAncestorsForAgent", "paginateForAgent", "serializeForAgent", "serializeNodesForAgent", "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"];
4809
+ 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", "unstable_getDependencyVersion", "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", "readComponentControlsForAgent", "readIconSetControlsForAgent", "readIconsForAgent", "readLayoutTemplateControlsForAgent", "readShaderControlsForAgent", "getAgentSystemPrompt", "getAgentContext", "ping", "queryImagesForAgent", "reviewChangesForAgent", "getNodeForAgent", "getNodesForAgent", "getNodesOfTypesForAgent", "getScopeNodeForAgent", "getGroundNodeForAgent", "getParentNodeForAgent", "getAncestorsForAgent", "paginateForAgent", "serializeForAgent", "serializeNodesForAgent", "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"];
4798
4810
  type UnprotectedMessageType = (typeof unprotectedMessageTypesSource)[number];
4799
4811
  type ProtectedMessageType = Exclude<keyof PluginMessageAPI, UnprotectedMessageType>;
4800
4812
  type Method = keyof {
@@ -5040,8 +5052,14 @@ declare const methodToMessageTypes: {
5040
5052
  readonly [createManagedCollection]: ["createManagedCollection"];
5041
5053
  readonly [rejectAllPending]: [];
5042
5054
  readonly [readProjectForAgent]: [];
5055
+ readonly [readComponentControlsForAgent]: [];
5056
+ readonly [readIconSetControlsForAgent]: [];
5057
+ readonly [readIconsForAgent]: [];
5058
+ readonly [readLayoutTemplateControlsForAgent]: [];
5059
+ readonly [readShaderControlsForAgent]: [];
5043
5060
  readonly [getAgentSystemPrompt]: [];
5044
5061
  readonly [getAgentContext]: [];
5062
+ readonly [ping]: [];
5045
5063
  readonly [applyAgentChanges]: ["applyAgentChanges"];
5046
5064
  readonly [flattenComponentInstanceForAgent]: ["flattenComponentInstanceForAgent"];
5047
5065
  readonly [getAncestorsForAgent]: [];
@@ -6610,6 +6628,36 @@ declare class FramerPluginAPIAlpha extends FramerPluginAPIBeta {
6610
6628
  }): Promise<{
6611
6629
  results: unknown[];
6612
6630
  }>;
6631
+ /** @alpha */
6632
+ [$framerApiOnly.readComponentControlsForAgent](input: {
6633
+ componentIds: readonly string[];
6634
+ }, options?: {
6635
+ pagePath?: string;
6636
+ }): Promise<unknown>;
6637
+ /** @alpha */
6638
+ [$framerApiOnly.readIconSetControlsForAgent](input: {
6639
+ iconSetNames: readonly string[];
6640
+ }, options?: {
6641
+ pagePath?: string;
6642
+ }): Promise<unknown>;
6643
+ /** @alpha */
6644
+ [$framerApiOnly.readIconsForAgent](input: {
6645
+ iconSetName: string;
6646
+ }, options?: {
6647
+ pagePath?: string;
6648
+ }): Promise<string[]>;
6649
+ /** @alpha */
6650
+ [$framerApiOnly.readLayoutTemplateControlsForAgent](input: {
6651
+ layoutTemplateIds: readonly string[];
6652
+ }, options?: {
6653
+ pagePath?: string;
6654
+ }): Promise<unknown>;
6655
+ /** @alpha */
6656
+ [$framerApiOnly.readShaderControlsForAgent](input: {
6657
+ shaderNames: readonly string[];
6658
+ }, options?: {
6659
+ pagePath?: string;
6660
+ }): Promise<unknown>;
6613
6661
  /**
6614
6662
  * Applies commands to the canvas to create, update, remove, move, or duplicate nodes.
6615
6663
  *
@@ -6622,6 +6670,9 @@ declare class FramerPluginAPIAlpha extends FramerPluginAPIBeta {
6622
6670
  [$framerApiOnly.applyAgentChanges](dsl: string, options?: {
6623
6671
  pagePath?: string;
6624
6672
  }): Promise<void>;
6673
+ /** Liveness round-trip: resolves once Vekter's plugin handler answers. Used by the headless
6674
+ * backend to verify the transport actually routes, not just that the page is alive. */
6675
+ [$framerApiOnly.ping](): Promise<void>;
6625
6676
  /**
6626
6677
  * Executes the publish flow on behalf of an agent.
6627
6678
  *
@@ -7126,9 +7177,41 @@ interface PluginMessageAPI {
7126
7177
  results: unknown[];
7127
7178
  }>;
7128
7179
  /** @alpha */
7180
+ readComponentControlsForAgent: (input: {
7181
+ componentIds: readonly string[];
7182
+ }, options?: {
7183
+ pagePath?: string;
7184
+ }) => Promise<unknown>;
7185
+ /** @alpha */
7186
+ readIconSetControlsForAgent: (input: {
7187
+ iconSetNames: readonly string[];
7188
+ }, options?: {
7189
+ pagePath?: string;
7190
+ }) => Promise<unknown>;
7191
+ /** @alpha */
7192
+ readIconsForAgent: (input: {
7193
+ iconSetName: string;
7194
+ }, options?: {
7195
+ pagePath?: string;
7196
+ }) => Promise<string[]>;
7197
+ /** @alpha */
7198
+ readLayoutTemplateControlsForAgent: (input: {
7199
+ layoutTemplateIds: readonly string[];
7200
+ }, options?: {
7201
+ pagePath?: string;
7202
+ }) => Promise<unknown>;
7203
+ /** @alpha */
7204
+ readShaderControlsForAgent: (input: {
7205
+ shaderNames: readonly string[];
7206
+ }, options?: {
7207
+ pagePath?: string;
7208
+ }) => Promise<unknown>;
7209
+ /** @alpha */
7129
7210
  applyAgentChanges: (dsl: string, options?: {
7130
7211
  pagePath?: string;
7131
7212
  }) => Promise<void>;
7213
+ /** @alpha Liveness round-trip; resolves when Vekter's plugin handler answers. */
7214
+ ping: () => Promise<void>;
7132
7215
  /** @alpha */
7133
7216
  publishForAgent: (input?: Record<string, unknown>) => Promise<unknown>;
7134
7217
  /** @alpha */
@@ -7494,10 +7577,20 @@ interface FramerAPIErrorOptions {
7494
7577
  * (`record("plugin_method_error", { message })` etc.) — `err.message`
7495
7578
  * intentionally stays free of `[ref: …]` to keep BQ/NR cardinality low. */
7496
7579
  ref?: string;
7580
+ /** Server says re-issuing on a fresh session is expected to succeed (session
7581
+ * crash/close/recycle). Drives `isRetryableError`. */
7582
+ retryable?: boolean;
7583
+ /** Method(s) the server implicated in a session crash (in-flight, or the recent
7584
+ * trail when the session died between calls). Attribution for the caller. */
7585
+ recentMethods?: string[];
7497
7586
  }
7498
7587
  declare class FramerAPIError extends Error {
7499
7588
  readonly code: ErrorCode;
7500
7589
  readonly ref?: string;
7590
+ /** @see FramerAPIErrorOptions.retryable */
7591
+ readonly retryable: boolean;
7592
+ /** @see FramerAPIErrorOptions.recentMethods */
7593
+ readonly recentMethods?: string[];
7501
7594
  constructor(message: string, code: ErrorCode, options?: FramerAPIErrorOptions);
7502
7595
  toString(): string;
7503
7596
  }
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
- import {env,isDeno,isWorkerd}from'std-env';import*as ue from'devalue';/* Framer API SDK v0.1.12 */
2
- var Co=Object.defineProperty;var r=(n,e)=>Co(n,"name",{value:e,configurable:true});function pt(n){return n!==void 0}r(pt,"isDefined");function Si(n){return n===void 0}r(Si,"isUndefined");function I(n){return n===null}r(I,"isNull");function Fi(n){return n!==null}r(Fi,"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 Io(n){return typeof n=="function"}r(Io,"isFunction");function N(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}r(N,"isObject");function Se(n){if(typeof n!="object"||n===null)return false;let e=Object.getPrototypeOf(n);return e===null||e===Object.prototype}r(Se,"isPlainObject");function gt(n){return Array.isArray(n)}r(gt,"isArray");function Fe(n,e){throw e instanceof Error?e:e!==void 0?new Error(String(e)):new Error(n?`Unexpected value: ${n}`:"Application entered invalid state")}r(Fe,"assertNever");function u(n,...e){if(n)return;let t=Error("Assertion Error"+(e.length>0?": "+e.join(" "):""));if(t.stack)try{let i=t.stack.split(`
1
+ import {env,isDeno,isWorkerd}from'std-env';import*as ue from'devalue';/* Framer API SDK v0.1.14-beta */
2
+ var Po=Object.defineProperty;var r=(n,e)=>Po(n,"name",{value:e,configurable:true});function pt(n){return n!==void 0}r(pt,"isDefined");function ki(n){return n===void 0}r(ki,"isUndefined");function T(n){return n===null}r(T,"isNull");function Ni(n){return n!==null}r(Ni,"isNotNull");function Pe(n){return n===true||n===false}r(Pe,"isBoolean");function y(n){return typeof n=="string"}r(y,"isString");function q(n){return typeof n=="number"&&Number.isFinite(n)}r(q,"isNumber");function So(n){return typeof n=="function"}r(So,"isFunction");function N(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}r(N,"isObject");function Se(n){if(typeof n!="object"||n===null)return false;let e=Object.getPrototypeOf(n);return e===null||e===Object.prototype}r(Se,"isPlainObject");function gt(n){return Array.isArray(n)}r(gt,"isArray");function Fe(n,e){throw e instanceof Error?e:e!==void 0?new Error(String(e)):new Error(n?`Unexpected value: ${n}`:"Application entered invalid state")}r(Fe,"assertNever");function u(n,...e){if(n)return;let t=Error("Assertion Error"+(e.length>0?": "+e.join(" "):""));if(t.stack)try{let i=t.stack.split(`
3
3
  `);i[1]?.includes("assert")?(i.splice(1,1),t.stack=i.join(`
4
4
  `)):i[0]?.includes("assert")&&(i.splice(0,1),t.stack=i.join(`
5
- `));}catch{}throw t}r(u,"assert");function F(n){for(let e of Reflect.ownKeys(n)){let t=n[e];!t||typeof t!="object"&&!Io(t)||F(t);}return Object.freeze(n)}r(F,"deepFreeze");function vi(n){return [n.slice(0,-1),n.at(-1)]}r(vi,"splitRestAndLast");var g="__class";var qt=Symbol(),Yt=Symbol(),Xt=Symbol(),Zt=Symbol(),To=Symbol(),Po=Symbol(),So=Symbol(),Fo=Symbol(),vo=Symbol(),Jt=Symbol(),Qt=Symbol(),l={getAiServiceInfo:qt,sendTrackingEvent:Yt,getCurrentUser:Xt,getProjectInfo:Zt,environmentInfo:To,initialState:Po,showUncheckedPermissionToasts:So,marshal:Fo,unmarshal:vo,getHTMLForNode:Jt,setHTMLForNode:Qt},pe="INTERNAL_",mt=`${pe}getAiServiceInfo`,ft=`${pe}sendTrackingEvent`,yt=`${pe}getCurrentUser`,ht=`${pe}getProjectInfo`,ge=`${pe}getHTMLForNode`,me=`${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(I(t))return null;let i=this.constructor;return new i(this.#e,t)}async remove(){await this.#e.invoke("removeVariables",this.nodeId,[this.id]);}},V="Variable";function L(n){let e=n.at(0);return u(!Si(e)),`${e.toLowerCase()}${n.slice(1,-V.length)}`}r(L,"classToType");var Do=`Boolean${V}`,ko=L(Do),ve=class n extends M{static{r(this,"BooleanVariable");}type=ko;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},No=`Number${V}`,Ao=L(No),De=class n extends M{static{r(this,"NumberVariable");}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}},Eo=`String${V}`,Mo=L(Eo),ke=class n extends M{static{r(this,"StringVariable");}type=Mo;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},wo=`FormattedText${V}`,Vo=L(wo),Ne=class n extends M{static{r(this,"FormattedTextVariable");}type=Vo;#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=`Enum${V}`,Wo=L(Lo),Y=class n{static{r(this,"EnumCase");}#e;#t;#n;#i;get id(){return this.#i.id}get name(){return this.#i.name}get nameByLocale(){return this.#i.nameByLocale}constructor(e,t,i,o){this.#e=e,this.#t=t,this.#n=i,this.#i=o;}async setAttributes(e){let t=await this.#e.invoke("updateEnumCase",this.#t,this.#n,this.id,e);return t?new n(this.#e,this.#t,this.#n,t):null}async remove(){await this.#e.invoke("removeEnumCase",this.#t,this.#n,this.id);}},Ae=class n extends M{static{r(this,"EnumVariable");}type=Wo;#e;#t;#n;get cases(){return this.#n||(this.#n=F(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);}},Ro=`Color${V}`,Bo=L(Ro),Ee=class n extends M{static{r(this,"ColorVariable");}type=Bo;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},Uo=`Image${V}`,Oo=L(Uo),Me=class n extends M{static{r(this,"ImageVariable");}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}},zo=`File${V}`,Go=L(zo),we=class n extends M{static{r(this,"FileVariable");}type=Go;#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}},Ko=`Link${V}`,$o=L(Ko),Ve=class n extends M{static{r(this,"LinkVariable");}type=$o;#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=`Date${V}`,jo=L(Ho),Le=class n extends M{static{r(this,"DateVariable");}type=jo;#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}},_o=`Border${V}`,qo=L(_o),We=class n extends M{static{r(this,"BorderVariable");}type=qo;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},Yo=`Unsupported${V}`,Xo=L(Yo),Re=class n extends M{static{r(this,"UnsupportedVariable");}type=Xo;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}};function Di(n){return n instanceof M}r(Di,"isVariable");function Zo(n){return Di(n)&&n.nodeType==="component"}r(Zo,"isComponentVariable");var U=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(u(pt(i)),I(i))return null;u(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]);}},B=class extends U{static{r(this,"FieldBaseWithRequired");}#e;get required(){return this.#e.required}constructor(e,t,i){super(e,t,i),this.#e=i;}},bt=class extends U{static{r(this,"BooleanField");}type=nn},xt=class extends U{static{r(this,"ColorField");}type=rn},Ct=class extends U{static{r(this,"NumberField");}type=on},It=class extends B{static{r(this,"StringField");}type=an;#e;constructor(e,t,i){super(e,t,i),this.#e=i;}get basedOn(){return this.#e.basedOn}},Tt=class extends B{static{r(this,"FormattedTextField");}type=sn},Be=class extends B{static{r(this,"ImageField");}type=ln},Pt=class extends B{static{r(this,"LinkField");}type=un},St=class extends B{static{r(this,"DateField");}type=cn;#e;get displayTime(){return this.#e.displayTime}constructor(e,t,i){super(e,t,i),this.#e=i;}},Ft=class extends U{static{r(this,"FieldDivider");}type=yn},Ue=class extends U{static{r(this,"UnsupportedField");}type=hn},vt=class extends B{static{r(this,"FileField");}type=pn;#e;get allowedFileTypes(){return this.#e.allowedFileTypes}constructor(e,t,i){super(e,t,i),this.#e=i;}},Dt=class extends U{static{r(this,"EnumField");}type=gn;#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)),F(this.#i)),this.#i}constructor(e,t,i){super(e,t,i),this.#e=e,this.#t=t,this.#n=i;}async addCase(e){let t=await this.#e.invoke("addEnumCase",this.#t,this.id,e);return t?new Y(this.#e,this.#t,this.id,t):null}async setCaseOrder(e){await this.#e.invoke("setEnumCaseOrder",this.#t,this.id,e);}},kt=class extends B{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 B{static{r(this,"MultiCollectionReferenceField");}type=fn;#e;get collectionId(){return this.#e.collectionId}constructor(e,t,i){super(e,t,i),this.#e=i;}},en=class extends B{static{r(this,"ArrayField");}type=dn;fields;constructor(e,t,i){super(e,t,i);let o=i.fields[0];this.fields=[new Be(e,t,o)];}};function tn(n,e,t){return n.map(i=>{switch(i.type){case nn:return new bt(e,t,i);case rn:return new xt(e,t,i);case on:return new Ct(e,t,i);case an:return new It(e,t,i);case sn:return new Tt(e,t,i);case ln:return new Be(e,t,i);case un:return new Pt(e,t,i);case cn:return new St(e,t,i);case yn:return new Ft(e,t,i);case hn:return new Ue(e,t,i);case pn:return new vt(e,t,i);case gn:return new Dt(e,t,i);case mn:return new kt(e,t,i);case fn:return new Nt(e,t,i);case dn:return new en(e,t,i);default:return new Ue(e,t,i)}})}r(tn,"fieldDefinitionDataArrayToFieldClassInstances");function Jo(n){return n instanceof U}r(Jo,"isField");var ki="action";function Qo(n){return !!n&&ki in n&&f(n[ki])}r(Qo,"isLocalizedValueUpdate");function Ni(n){return Object.keys(n).reduce((e,t)=>{let i=n[t];return Qo(i)&&(e[t]=i),e},{})}r(Ni,"filterInlineLocalizationValues");var Oe=class n{static{r(this,"FileAsset");}id;url;extension;constructor(e){this.url=e.url,this.id=e.id,this.extension=e.extension;}static[l.unmarshal](e,t){return new n(t)}[l.marshal](){return {[g]:"FileAsset",id:this.id,url:this.url,extension:this.extension}}};function ea(n){return n instanceof Oe}r(ea,"isFileAsset");var ta="ImageAsset";function Ai(n){return N(n)?n[g]===ta:false}r(Ai,"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 ra(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 na(n){return n instanceof X}r(na,"isImageAsset");function Z(n){return n.type==="bytes"?[n.bytes.buffer]:[]}r(Z,"getTransferable");function ia(n){if(!N(n))return false;let e="bytes",t="mimeType";return !(!(e in n)||!(t in n)||!(n[e]instanceof Uint8Array)||!f(n[t]))}r(ia,"isBytesData");async function ze(n){if(n instanceof File)return Cn(n);let e=await Ei(n.image);return {name:n.name,altText:n.altText,resolution:n.resolution,preferredImageRendering:n.preferredImageRendering,...e}}r(ze,"createImageTransferFromInput");async function bn(n){if(n instanceof File)return Cn(n);let e=await Ei(n.file);return {name:n.name,...e}}r(bn,"createFileTransferFromInput");async function Ei(n){return n instanceof File?Cn(n):ia(n)?{type:"bytes",mimeType:n.mimeType,bytes:n.bytes}:{type:"url",url:n}}r(Ei,"createAssetTransferFromAssetInput");function xn(n){return Promise.all(n.map(ze))}r(xn,"createNamedAssetDataTransferFromInput");async function Cn(n){return new Promise((e,t)=>{let i=new FileReader;i.onload=o=>{let a=n.type,s=o.target?.result;if(!s||!(s instanceof ArrayBuffer)){t(new Error("Failed to read file, arrayBuffer is null"));return}let d=new Uint8Array(s);e({bytes:d,mimeType:a,type:"bytes",name:n.name});},i.onerror=o=>{t(o);},i.readAsArrayBuffer(n);})}r(Cn,"getAssetDataFromFile");async function ra(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(ra,"measureImage");var At=class{static{r(this,"ComputedValueBase");}};var oa="unsupported",Ge=class n extends At{static{r(this,"UnsupportedComputedValue");}type=oa;#e;constructor(e){super(),this.#e=e;}static[l.unmarshal](e,t){return new n(t)}[l.marshal](){return this.#e}};function aa(n){return n instanceof At}r(aa,"isComputedValue");var sa="Font";function wi(n){return N(n)&&n[g]===sa}r(wi,"isFontData");function la(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(la,"isFontWeight");function da(n){if(!f(n))return false;switch(n){case "normal":case "italic":return true;default:return false}}r(da,"isFontStyle");function Vi(n){return N(n)?f(n.family)&&f(n.selector)&&la(n.weight)&&da(n.style):false}r(Vi,"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=Mi.get(t.selector);if(i)return i;let o=new n(t);return Mi.set(t.selector,o),o}[l.marshal](){return {[g]:"Font",selector:this.selector,family:this.family,weight:this.weight,style:this.style}}},Mi=new Map;var Et="plugin-marshal";function In(n){return N(n)&&l.marshal in n}r(In,"isSelfMarshalable");function W(n){if(In(n))return n[l.marshal]();if(gt(n))return n.map(W);if(Se(n)){let e={};for(let t of Object.keys(n))e[t]=W(n[t]);return e}return n}r(W,"marshal");var ua="LinearGradient",ca="RadialGradient",pa="ConicGradient",fe=class{static{r(this,"GradientBase");}#e;get stops(){return this.#e.stops}constructor(e){this.#e=e;}cloneWithAttributes(e){let t=this.constructor;return new t({...this.#e,...e})}},Ke=class n extends fe{static{r(this,"LinearGradient");}[g]=ua;#e;get angle(){return this.#e.angle}constructor(e){super(e),this.#e=e;}static[l.unmarshal](e,t){return new n({...t,stops:y(e,t.stops)})}[l.marshal](){return W({...this.#e,[g]:this[g]})}toCSS(){let e=this.#e.stops.map(t=>(u(f(t.color),"ColorStyle not supported yet"),`${t.color} ${t.position*100}%`)).join(", ");return `linear-gradient(${this.angle}deg, ${e})`}},$e=class n extends fe{static{r(this,"RadialGradient");}[g]=ca;#e;get width(){return this.#e.width}get height(){return this.#e.height}get x(){return this.#e.x}get y(){return this.#e.y}constructor(e){super(e),this.#e=e;}static[l.unmarshal](e,t){return new n({...t,stops:y(e,t.stops)})}[l.marshal](){return W({...this.#e,[g]:this[g]})}toCSS(){let e=this.stops.map((t,i)=>{u(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})`}},He=class n extends fe{static{r(this,"ConicGradient");}[g]=pa;#e;get angle(){return this.#e.angle}get x(){return this.#e.x}get y(){return this.#e.y}constructor(e){super(e),this.#e=e;}static[l.unmarshal](e,t){return new n({...t,stops:y(e,t.stops)})}[l.marshal](){return W({...this.#e,[g]:this[g]})}toCSS(){let e=this.stops.map(t=>(u(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 Li(n){return n instanceof fe}r(Li,"isGradient");var ga="ColorStyle";function Mt(n){return N(n)?n[g]===ga:false}r(Mt,"isColorStyleData");var te=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 te}r(ye,"isColorStyle");var ma="TextStyle";function Wi(n){return N(n)?n[g]===ma:false}r(Wi,"isTextStyleData");var je=class n{static{r(this,"TextStyle");}id;name;path;tag;font;boldFont;italicFont;boldItalicFont;color;transform;alignment;decoration;decorationColor;decorationThickness;decorationStyle;decorationSkipInk;decorationOffset;balance;breakpoints;minWidth;fontSize;letterSpacing;lineHeight;paragraphSpacing;#e;constructor(e,t){this.id=t.id,this.name=t.name,this.path=t.path,this.tag=t.tag,this.font=G[l.unmarshal](e,t.font),this.boldFont=t.boldFont&&G[l.unmarshal](e,t.boldFont),this.italicFont=t.italicFont&&G[l.unmarshal](e,t.italicFont),this.boldItalicFont=t.boldItalicFont&&G[l.unmarshal](e,t.boldItalicFont),this.color=Mt(t.color)?te[l.unmarshal](e,t.color):t.color,this.transform=t.transform,this.alignment=t.alignment,this.decoration=t.decoration,this.decorationColor=Mt(t.decorationColor)?te[l.unmarshal](e,t.decorationColor):t.decorationColor,this.decorationThickness=t.decorationThickness,this.decorationStyle=t.decorationStyle,this.decorationSkipInk=t.decorationSkipInk,this.decorationOffset=t.decorationOffset,this.balance=t.balance,this.breakpoints=t.breakpoints,this.minWidth=t.minWidth,this.fontSize=t.fontSize,this.letterSpacing=t.letterSpacing,this.lineHeight=t.lineHeight,this.paragraphSpacing=t.paragraphSpacing,this.#e=e;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return {[g]:"TextStyle",id:this.id,name:this.name,path:this.path,tag:this.tag,font:this.font[l.marshal](),boldFont:this.boldFont?.[l.marshal]()??null,italicFont:this.italicFont?.[l.marshal]()??null,boldItalicFont:this.boldItalicFont?.[l.marshal]()??null,color:ye(this.color)?this.color[l.marshal]():this.color,transform:this.transform,alignment:this.alignment,decoration:this.decoration,decorationColor:ye(this.decorationColor)?this.decorationColor[l.marshal]():this.decorationColor,decorationThickness:this.decorationThickness,decorationStyle:this.decorationStyle,decorationSkipInk:this.decorationSkipInk,decorationOffset:this.decorationOffset,balance:this.balance,breakpoints:this.breakpoints,minWidth:this.minWidth,fontSize:this.fontSize,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,paragraphSpacing:this.paragraphSpacing}}async setAttributes(e){let t=await this.#e.invoke("setTextStyleAttributes",this.id,e);return t?new n(this.#e,t):null}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async setPluginData(e,t){return this.#e.invoke("setPluginDataForNode",this.id,e,t)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}async remove(){return this.#e.invoke("removeTextStyle",this.id)}};function Tn(n){return n instanceof je}r(Tn,"isTextStyle");var Ri={ColorStyle:te,ConicGradient:He,FileAsset:Oe,Font:G,ImageAsset:X,LinearGradient:Ke,RadialGradient:$e,TextStyle:je,BooleanVariable:ve,BorderVariable:We,ColorVariable:Ee,DateVariable:Le,EnumVariable:Ae,FileVariable:we,FormattedTextVariable:Ne,ImageVariable:Me,LinkVariable:Ve,NumberVariable:De,StringVariable:ke,UnsupportedVariable:Re,UnsupportedComputedValue:Ge};function fa(n){return Se(n)&&f(n[g])&&n[g]in Ri}r(fa,"isSelfUnmarshalable");function y(n,e){if(fa(e))return Ri[e[g]][l.unmarshal](n,e);if(gt(e))return e.map(t=>y(n,t));if(Se(e)){let t={};for(let i of Object.keys(e))t[i]=y(n,e[i]);return t}return e}r(y,"unmarshal");var ya={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 ha(n){return ya[n]}r(ha,"isSupportedArrayItemFieldType");function ba(n){return ha(n.type)}r(ba,"isSupportedArrayItemFieldDataEntry");var nn="boolean",rn="color",on="number",an="string",sn="formattedText",ln="image",dn="array",un="link",cn="date",pn="file",gn="enum",mn="collectionReference",fn="multiCollectionReference",yn="divider",hn="unsupported";function xa(n){return n.map(e=>{if(e.type!=="enum")return e;let t=e.cases.map(i=>{let o=i.nameByLocale?Ni(i.nameByLocale):void 0;return {...i,nameByLocale:o}});return {...e,cases:t}})}r(xa,"sanitizeEnumFieldForMessage");function Bi(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=Bi(s.fieldData,e),m={};for(let T in d){let v=d[T];u(v&&ba(v),"Unsupported array item field data entry"),m[T]=v;}return {...s,fieldData:m}});t[i]={...o,value:a};}return t}r(Bi,"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,u(e.managedBy!=="user","Managed Collection can only be managed by a plugin"),this.managedBy=e.managedBy,this.#e=t,F(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=xa(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)}},ne=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,F(this);}async setItemOrder(e){return this.#e.invoke("setCollectionItemOrder",this.id,e)}async getFields(){let e=await this.#e.invoke("getCollectionFields2",this.id,true);return tn(e,this.#e,this.id)}async addFields(e){let t=await this.#e.invoke("addCollectionFields2",this.id,e);return u(t.every(Fi)),tn(t,this.#e,this.id)}async removeFields(e){return this.#e.invoke("removeCollectionFields",this.id,e)}async setFieldOrder(e){return this.#e.invoke("setCollectionFieldOrder",this.id,e)}async getItems(){return (await this.#e.invoke("getCollectionItems2",this.id)).map(t=>new _e(t,this.#e))}async addItems(e){await this.#e.invoke("addCollectionItems2",this.id,e);}async removeItems(e){return this.#e.invoke("removeCollectionItems",e)}async setAsActive(){return this.#e.invoke("setActiveCollection",this.id)}async setPluginData(e,t){return this.#e.invoke("setPluginDataForNode",this.id,e,t)}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}async navigateTo(e){return this.#e.invoke("navigateTo",this.id,e)}},_e=class n{static{r(this,"CollectionItem");}id;nodeId;slug;slugByLocale;draft;fieldData;#e;constructor(e,t){let i=Bi(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,F(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 Ca={fixed:true,sticky:true,absolute:true,relative:true},Ui="position";function Nl(n){if(!(Ui in n))return false;let e=n[Ui];return f(e)&&Ca[e]===true}r(Nl,"supportsPosition");var Oi="top";function Al(n){if(!(Oi in n))return false;let e=n[Oi];return f(e)||I(e)}r(Al,"supportsPins");var zi="width";function El(n){if(!(zi in n))return false;let e=n[zi];return f(e)||I(e)}r(El,"supportsSize");var Gi="maxWidth";function Ml(n){if(!(Gi in n))return false;let e=n[Gi];return f(e)||I(e)}r(Ml,"supportsSizeConstraints");var Ki="aspectRatio";function wl(n){if(!(Ki in n))return false;let e=n[Ki];return q(e)||I(e)}r(wl,"supportsAspectRatio");var $i="name";function Vl(n){if(!($i in n))return false;let e=n[$i];return f(e)||I(e)}r(Vl,"supportsName");var Hi="visible";function Ll(n){if(!(Hi in n))return false;let e=n[Hi];return Pe(e)}r(Ll,"supportsVisible");var ji="locked";function Wl(n){if(!(ji in n))return false;let e=n[ji];return Pe(e)}r(Wl,"supportsLocked");var _i="backgroundColor";function Rl(n){if(!(_i in n))return false;let e=n[_i];return f(e)||ye(e)||I(e)}r(Rl,"supportsBackgroundColor");var qi="backgroundColor";function Bl(n){if(!(qi in n))return false;let e=n[qi];return f(e)||Mt(e)||I(e)}r(Bl,"supportsBackgroundColorData");var Yi="backgroundImage";function Ul(n){if(!(Yi in n))return false;let e=n[Yi];return e instanceof X||I(e)}r(Ul,"supportsBackgroundImage");var Xi="backgroundImage";function Ol(n){if(!(Xi in n))return false;let e=n[Xi];return e instanceof X?false:Ai(e)||I(e)}r(Ol,"supportsBackgroundImageData");var Zi="backgroundGradient";function zl(n){if(!(Zi in n))return false;let e=n[Zi];return Li(e)||I(e)}r(zl,"supportsBackgroundGradient");var Ji="backgroundGradient";function Gl(n){if(!(Ji in n))return false;let e=n[Ji];return N(e)||I(e)}r(Gl,"supportsBackgroundGradientData");var Qi="rotation";function Kl(n){if(!(Qi in n))return false;let e=n[Qi];return q(e)}r(Kl,"supportsRotation");var er="opacity";function $l(n){if(!(er in n))return false;let e=n[er];return q(e)}r($l,"supportsOpacity");var tr="borderRadius";function Hl(n){if(!(tr in n))return false;let e=n[tr];return f(e)||I(e)}r(Hl,"supportsBorderRadius");var nr="border";function jl(n){if(!(nr in n))return false;let e=n[nr];return I(e)||ye(e.color)}r(jl,"supportsBorder");var ir="svg";function _l(n){if(!(ir in n))return false;let e=n[ir];return f(e)}r(_l,"supportsSVG");var rr="textTruncation";function ql(n){if(!(rr in n))return false;let e=n[rr];return q(e)||I(e)}r(ql,"supportsTextTruncation");var or="zIndex";function Yl(n){if(!(or in n))return false;let e=n[or];return q(e)||I(e)}r(Yl,"supportsZIndex");var ar="overflow";function Xl(n){if(!(ar in n))return false;let e=n[ar];return f(e)||I(e)}r(Xl,"supportsOverflow");var sr="componentIdentifier";function Zl(n){if(!(sr in n))return false;let e=n[sr];return f(e)}r(Zl,"supportsComponentInfo");var lr="font";function Jl(n){if(!(lr in n))return false;let e=n[lr];return Vi(e)}r(Jl,"supportsFont");var dr="font";function Ql(n){if(!(dr in n))return false;let e=n[dr];return wi(e)||I(e)}r(Ql,"supportsFontData");var ur="inlineTextStyle";function ed(n){if(!(ur in n))return false;let e=n[ur];return Tn(e)||I(e)}r(ed,"supportsInlineTextStyle");var cr="inlineTextStyle";function td(n){if(!(cr in n))return false;let e=n[cr];return Wi(e)||I(e)}r(td,"supportsInlineTextStyleData");var pr="link";function nd(n){if(!(pr in n))return false;let e=n[pr];return f(e)||I(e)}r(nd,"supportsLink");var gr="imageRendering";function id(n){if(!(gr in n))return false;let e=n[gr];return f(e)||I(e)}r(id,"supportsImageRendering");var mr="layout";function hr(n){if(!(mr in n))return false;let e=n[mr];return f(e)||I(e)}r(hr,"supportsLayout");function rd(n){return hr(n)?n.layout==="stack":false}r(rd,"hasStackLayout");function od(n){return hr(n)?n.layout==="grid":false}r(od,"hasGridLayout");var fr="isVariant";function br(n){if(!(fr in n))return false;let e=n[fr];return Pe(e)}r(br,"supportsComponentVariant");function Pn(n){return br(n)?n.isVariant:false}r(Pn,"isComponentVariant");function xr(n){return !br(n)||!Pn(n)?false:!I(n.gesture)}r(xr,"isComponentGestureVariant");var yr="isBreakpoint";function Ia(n){if(!(yr in n))return false;let e=n[yr];return Pe(e)}r(Ia,"supportsBreakpoint");function Cr(n){return Ia(n)?n.isBreakpoint:false}r(Cr,"isBreakpoint");var R=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 ie(this)?Promise.resolve([]):this.#e.getChildren(this.id)}async getNodesWithType(e){return ie(this)?Promise.resolve([]):(await this.#e.invoke("getNodesWithType",this.id,e)).map(i=>C(i,this.#e))}async getNodesWithAttribute(e){return ie(this)?Promise.resolve([]):(await this.#e.invoke("getNodesWithAttribute",this.id,e)).map(i=>C(i,this.#e))}async getNodesWithAttributeSet(e){return ie(this)?Promise.resolve([]):(await this.#e.invoke("getNodesWithAttributeSet",this.id,e)).map(i=>C(i,this.#e))}async*walk(){if(yield this,!ie(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)}},O=class extends R{static{r(this,"FrameNode");}[g]="FrameNode";name;visible;locked;backgroundColor;backgroundImage;backgroundGradient;rotation;opacity;borderRadius;border;imageRendering;position;top;right;bottom;left;centerX;centerY;width;height;maxWidth;minWidth;maxHeight;minHeight;aspectRatio;zIndex;link;linkOpenInNewTab;linkSmoothScroll;linkClickTrackingId;linkRelValues;linkPreserveParams;overflow;overflowX;overflowY;layout;gap;padding;stackDirection;stackDistribution;stackAlignment;stackWrapEnabled;gridColumnCount;gridRowCount;gridAlignment;gridColumnWidthType;gridColumnWidth;gridColumnMinWidth;gridRowHeightType;gridRowHeight;gridItemFillCellWidth;gridItemFillCellHeight;gridItemHorizontalAlignment;gridItemVerticalAlignment;gridItemColumnSpan;gridItemRowSpan;isVariant;isPrimaryVariant;isBreakpoint;isPrimaryBreakpoint;inheritsFromId;gesture;constructor(e,t){super(e,t),this.name=e.name??null,this.visible=e.visible??true,this.locked=e.locked??false,this.backgroundColor=y(t,e.backgroundColor)??null,this.backgroundImage=y(t,e.backgroundImage)??null,this.rotation=e.rotation??0,this.opacity=e.opacity??1,this.borderRadius=e.borderRadius??null,this.border=y(t,e.border)??null,this.backgroundGradient=y(t,e.backgroundGradient)??null,this.imageRendering=e.imageRendering??null,this.position=e.position,this.left=e.left??null,this.right=e.right??null,this.top=e.top??null,this.bottom=e.bottom??null,this.centerX=e.centerX??null,this.centerY=e.centerY??null,this.width=e.width??null,this.height=e.height??null,this.maxWidth=e.maxWidth??null,this.minWidth=e.minWidth??null,this.maxHeight=e.maxHeight??null,this.minHeight=e.minHeight??null,this.aspectRatio=e.aspectRatio??null,this.zIndex=e.zIndex??null,this.link=e.link??null,this.linkOpenInNewTab=e.linkOpenInNewTab??null,this.linkSmoothScroll=e.linkSmoothScroll??null,this.linkClickTrackingId=e.linkClickTrackingId??null,this.linkRelValues=e.linkRelValues??null,this.linkPreserveParams=e.linkPreserveParams??null,this.overflow=e.overflow??null,this.overflowX=e.overflowX??null,this.overflowY=e.overflowY??null,this.layout=e.layout??null,this.gap=e.gap??null,this.padding=e.padding??null,this.stackDirection=e.stackDirection??null,this.stackDistribution=e.stackDistribution??null,this.stackAlignment=e.stackAlignment??null,this.stackWrapEnabled=e.stackWrapEnabled??null,this.gridColumnCount=e.gridColumnCount??null,this.gridRowCount=e.gridRowCount??null,this.gridAlignment=e.gridAlignment??null,this.gridColumnWidthType=e.gridColumnWidthType??null,this.gridColumnWidth=e.gridColumnWidth??null,this.gridColumnMinWidth=e.gridColumnMinWidth??null,this.gridRowHeightType=e.gridRowHeightType??null,this.gridRowHeight=e.gridRowHeight??null,this.gridItemFillCellWidth=e.gridItemFillCellWidth??null,this.gridItemFillCellHeight=e.gridItemFillCellHeight??null,this.gridItemHorizontalAlignment=e.gridItemHorizontalAlignment??null,this.gridItemVerticalAlignment=e.gridItemVerticalAlignment??null,this.gridItemColumnSpan=e.gridItemColumnSpan??null,this.gridItemRowSpan=e.gridItemRowSpan??null,this.inheritsFromId=e.inheritsFromId??null,this.gesture=e.gesture??null,this.isVariant=e.isVariant??false,this.isPrimaryVariant=e.isPrimaryVariant??false,this.isBreakpoint=e.isBreakpoint??false,this.isPrimaryBreakpoint=e.isPrimaryBreakpoint??false,F(this);}},re=class extends R{static{r(this,"TextNode");}[g]="TextNode";name;visible;locked;rotation;opacity;zIndex;font;inlineTextStyle;position;top;right;bottom;left;centerX;centerY;width;height;maxWidth;minWidth;maxHeight;minHeight;link;linkOpenInNewTab;linkSmoothScroll;linkClickTrackingId;linkRelValues;linkPreserveParams;gridItemFillCellWidth;gridItemFillCellHeight;gridItemHorizontalAlignment;gridItemVerticalAlignment;gridItemColumnSpan;gridItemRowSpan;overflow;overflowX;overflowY;textTruncation;#e;constructor(e,t){super(e,t),this.#e=t,this.name=e.name??null,this.visible=e.visible??true,this.locked=e.locked??false,this.rotation=e.rotation??0,this.opacity=e.opacity??1,this.zIndex=e.zIndex??null,this.font=y(t,e.font)??null,this.inlineTextStyle=y(t,e.inlineTextStyle)??null,this.position=e.position,this.left=e.left??null,this.right=e.right??null,this.top=e.top??null,this.bottom=e.bottom??null,this.centerX=e.centerX??null,this.centerY=e.centerY??null,this.width=e.width??null,this.height=e.height??null,this.maxWidth=e.maxWidth??null,this.minWidth=e.minWidth??null,this.maxHeight=e.maxHeight??null,this.minHeight=e.minHeight??null,this.link=e.link??null,this.linkOpenInNewTab=e.linkOpenInNewTab??null,this.linkSmoothScroll=e.linkSmoothScroll??null,this.linkClickTrackingId=e.linkClickTrackingId??null,this.linkRelValues=e.linkRelValues??null,this.linkPreserveParams=e.linkPreserveParams??null,this.overflow=e.overflow??null,this.overflowX=e.overflowX??null,this.overflowY=e.overflowY??null,this.textTruncation=e.textTruncation??null,this.gridItemFillCellWidth=e.gridItemFillCellWidth??null,this.gridItemFillCellHeight=e.gridItemFillCellHeight??null,this.gridItemHorizontalAlignment=e.gridItemHorizontalAlignment??null,this.gridItemVerticalAlignment=e.gridItemVerticalAlignment??null,this.gridItemColumnSpan=e.gridItemColumnSpan??null,this.gridItemRowSpan=e.gridItemRowSpan??null,F(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(me,this.id,e),await new Promise(t=>{setTimeout(t,30);});}async getHTML(){return this.#e.invoke(ge,this.id)}},qe=class extends R{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,F(this);}},Ye=class extends R{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,F(this);}async getSVG(){return this.#e.invoke("getSVGForNode",this.id)}},Xe=class extends R{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,F(this);}async getRuntimeError(){return this.#e.invoke("getRuntimeErrorForCodeComponentNode",this.id)}},K=class extends R{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,F(this);}async clone(e){return this.#e.cloneWebPage(this.id,e)}getBreakpointSuggestions(){return this.#e.invoke("getBreakpointSuggestionsForWebPage",this.id)}async addBreakpoint(e,t){let i=await this.#e.invoke("addBreakpointToWebPage",this.id,e,t),o=C(i,this.#e);return u(o instanceof O),u(Cr(o),"Expected node to be a FrameNode"),o}async getActiveCollectionItem(){let e=await this.#e.invoke("getActiveCollectionItemForWebPage",this.id);return e?new _e(e,this.#e):null}},oe=class extends R{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,F(this);}async addVariant(e,t){let i=await this.#e.invoke("addVariantToComponent",this.id,e,t);if(!i)throw new Error("Failed to add variant to component");let o=C(i,this.#e);return u(o instanceof O),u(Pn(o),"Node is not a component variant"),o}async addGestureVariant(e,t,i){let o=await this.#e.invoke("addGestureVariantToComponent",this.id,e,t,i);if(!o)throw new Error("Failed to add state to component");let a=C(o,this.#e);return u(a instanceof O),u(xr(a),"Node is not a gesture variant"),a}async getVariables(){let e=await this.#e.invoke("getVariables",this.id);return y(this.#e,e)}async addVariables(e){let t=await this.#e.invoke("addVariables",this.id,W(e));return y(this.#e,t)}async removeVariables(e){await this.#e.invoke("removeVariables",this.id,e);}async setVariableOrder(e){await this.#e.invoke("setVariableOrder",this.id,e);}},Ze=class extends R{static{r(this,"VectorSetNode");}[g]="VectorSetNode";name;constructor(e,t){super(e,t),this.name=e.name??null,F(this);}},$=class extends R{static{r(this,"DesignPageNode");}[g]="DesignPageNode";name;#e;constructor(e,t){super(e,t),this.#e=t,this.name=e.name??null,F(this);}async clone(e){return this.#e.cloneDesignPage(this.id,e)}},Je=class extends R{static{r(this,"UnknownNode");}[g]="UnknownNode";constructor(e,t){super(e,t),F(this);}async clone(){throw new Error("Cannot clone an unknown node")}};function C(n,e){switch(n[g]){case "DesignPageNode":return new $(n,e);case "WebPageNode":return new K(n,e);case "ComponentNode":return new oe(n,e);case "VectorSetNode":return new Ze(n,e);case "VectorSetItemNode":return new Ye(n,e);case "ComponentInstanceNode":return new Xe(n,e);case "FrameNode":return new O(n,e);case "SVGNode":return new qe(n,e);case "TextNode":return new re(n,e);case "UnknownNode":return new Je(n,e);default:return new Je(n,e)}}r(C,"convertRawNodeDataToNode");function wt(n){return n instanceof O}r(wt,"isFrameNode");function Ir(n){return n instanceof re}r(Ir,"isTextNode");function Tr(n){return n instanceof qe}r(Tr,"isSVGNode");function be(n){return n instanceof Xe}r(be,"isComponentInstanceNode");function Pr(n){return n instanceof K}r(Pr,"isWebPageNode");function Sr(n){return n instanceof oe}r(Sr,"isComponentNode");function Fr(n){return n instanceof $}r(Fr,"isDesignPageNode");function vr(n){return n instanceof Ze}r(vr,"isVectorSetNode");function Dr(n){return n instanceof Ye}r(Dr,"isVectorSetItemNode");function ie(n){return n instanceof Je}r(ie,"isUnknownNode");function Qe(n){return !!(wt(n)||Ir(n)||be(n)||Tr(n)||Dr(n)||ie(n))}r(Qe,"isCanvasNode");function Sn(n){return !!(Pr(n)||Fr(n)||Sr(n)||vr(n)||ie(n))}r(Sn,"isCanvasRootNode");var et=class{static{r(this,"VectorSet");}id;name;owner;#e;constructor(e,t){this.id=e.id,this.name=e.name,this.owner=e.owner,this.#e=t;}async getItems(){return (await this.#e.invoke("getVectorSetItems",this.id)).map(t=>new Vt(t,this.#e))}},Vt=class{static{r(this,"VectorSetItem");}id;name;insertUrl;iconUrl;#e;#t;constructor(e,t){this.id=e.id,this.name=e.name,this.insertUrl=e.insertUrl,this.iconUrl=e.iconUrl,this.#e=e.moduleId,this.#t=t;}async getVariables(){return this.#t.invoke("getVectorSetItemVariables",this.id,this.#e)}};var tt=class extends Error{static{r(this,"FramerPluginError");}name=this.constructor.name},J=class extends Error{static{r(this,"FramerPluginClosedError");}name=this.constructor.name};function Ta(n){return n.type==="separator"}r(Ta,"isSeparatorMenuItem");function Lt(n,e){let t=[];for(let i of n){if(Ta(i)){t.push(i);continue}let{onAction:o,...a}=i,s=a;if(i.onAction){let d=Math.random();e.set(d,i.onAction),s.actionId=d;}i.submenu&&(s.submenu=Lt(i.submenu,e)),t.push(s);}return t}r(Lt,"addMenuItemsToOnActionCallbackMap");var Wt="type",kr={[Wt]:"pluginReadySignal"},Sa="pluginReadyResponse";var Fa={methodResponse:true,subscriptionMessage:true,permissionUpdate:true,menuAction:true};function Nr(n){return N(n)&&f(n[Wt])&&n[Wt]in Fa}r(Nr,"isVekterToPluginNonHandshakeMessage");function Ar(n){return N(n)&&n[Wt]===Sa}r(Ar,"isPluginReadyResponse");var Fn=Symbol(),vn=Symbol(),Dn=Symbol(),kn=Symbol(),Nn=Symbol(),An=Symbol(),En=Symbol(),Mn=Symbol(),wn=Symbol(),Vn=Symbol(),Ln=Symbol(),Wn=Symbol(),Rn=Symbol(),Bn=Symbol(),Un=Symbol(),On=Symbol(),zn=Symbol(),Gn=Symbol(),Kn=Symbol(),$n=Symbol(),Hn=Symbol(),jn=Symbol(),_n=Symbol(),qn=Symbol(),Yn=Symbol(),Xn=Symbol(),Zn=Symbol(),Jn=Symbol(),Qn=Symbol(),ei=Symbol(),b={publish:Fn,getDeployments:vn,deploy:Dn,getChangedPaths:kn,getChangeContributors:Nn,createManagedCollection:An,rejectAllPending:En,readProjectForAgent:Mn,getAgentSystemPrompt:wn,getAgentContext:Vn,applyAgentChanges:Ln,flattenComponentInstanceForAgent:Wn,getAncestorsForAgent:Rn,getGroundNodeForAgent:Bn,getNodeForAgent:Un,getNodesForAgent:On,getNodesOfTypesForAgent:zn,getParentNodeForAgent:Gn,getScopeNodeForAgent:Kn,makeExternalComponentLocalForAgent:$n,paginateForAgent:Hn,publishForAgent:jn,queryImagesForAgent:_n,reviewChangesForAgent:qn,serializeForAgent:Yn,serializeNodesForAgent:Xn,startAgentConversation:Zn,continueAgentConversation:Jn,submitAgentClarification:Qn,runSupervisorAgentCommand:ei};function ti(n){return typeof n=="string"&&n in b}r(ti,"isFramerApiOnlyMethod");var va=["unstable_getCodeFile","unstable_getCodeFiles","unstable_getCodeFileVersionContent","unstable_getCodeFileLint2","unstable_getCodeFileTypecheck2","unstable_getCodeFileVersions","lintCode"],Da=["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","unstable_getDependencyVersion","getRedirects","uploadFile","uploadFiles","uploadImage","uploadImages","zoomIntoView","navigateTo","getRuntimeErrorForModule","getRuntimeErrorForCodeComponentNode","showProgressOnInstances","removeProgressFromInstances","addComponentInstancePlaceholder","updateComponentInstancePlaceholder","removeComponentInstancePlaceholder","setMenu","showContextMenu","getBreakpointSuggestionsForWebPage","getActiveCollectionItemForWebPage","getVariables","getVectorSets","getVectorSetItems","getVectorSetItemVariables","getChangedPaths","getChangeContributors","getDeployments","readProjectForAgent","getAgentSystemPrompt","getAgentContext","queryImagesForAgent","reviewChangesForAgent","getNodeForAgent","getNodesForAgent","getNodesOfTypesForAgent","getScopeNodeForAgent","getGroundNodeForAgent","getParentNodeForAgent","getAncestorsForAgent","paginateForAgent","serializeForAgent","serializeNodesForAgent",mt,ft,yt,ht,ge,"getAiServiceInfo","sendTrackingEvent",...va];new Set(Da);var ni={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_getDependencyVersion:[],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":[me],"TextNode.getHTML":[],"ComponentNode.addVariant":["addVariantToComponent"],"ComponentNode.addGestureVariant":["addGestureVariantToComponent"],"ComponentNode.getVariables":[],"ComponentNode.addVariables":["addVariables"],"ComponentNode.removeVariables":["removeVariables"],"WebPageNode.getBreakpointSuggestions":[],"WebPageNode.addBreakpoint":["addBreakpointToWebPage"],"WebPageNode.getActiveCollectionItem":[],"ColorStyle.getPluginData":[],"ColorStyle.getPluginDataKeys":[],"ColorStyle.remove":["removeColorStyle"],"ColorStyle.setAttributes":["setColorStyleAttributes"],"ColorStyle.setPluginData":["setPluginDataForNode"],"TextStyle.getPluginData":[],"TextStyle.getPluginDataKeys":[],"TextStyle.remove":["removeTextStyle"],"TextStyle.setAttributes":["setTextStyleAttributes"],"TextStyle.setPluginData":["setPluginDataForNode"],"Variable.setAttributes":["updateVariable"],"Variable.remove":["removeVariables"],"ComponentNode.setVariableOrder":["setVariableOrder"],"EnumCase.remove":["removeEnumCase"],"EnumCase.setAttributes":["updateEnumCase"],"EnumVariable.addCase":["addEnumCase"],"EnumVariable.setCaseOrder":["setEnumCaseOrder"],createCollection:["createCollection"],createManagedCollection:["createManagedCollection"],[qt]:[],[Yt]:[],[Xt]:[],[Zt]:[],[Jt]:[],[Qt]:[],[Fn]:["publish"],[vn]:[],[Dn]:["deploy"],[kn]:[],[Nn]:[],[An]:["createManagedCollection"],[En]:[],[Mn]:[],[wn]:[],[Vn]:[],[Ln]:["applyAgentChanges"],[Wn]:["flattenComponentInstanceForAgent"],[Rn]:[],[Bn]:[],[Un]:[],[On]:[],[zn]:[],[Gn]:[],[Kn]:[],[$n]:["makeExternalComponentLocalForAgent"],[Hn]:[],[jn]:["publishForAgent"],[_n]:[],[qn]:[],[Yn]:[],[Xn]:[],[Zn]:["startAgentConversation"],[Jn]:["continueAgentConversation"],[Qn]:["submitAgentClarification"],[ei]:["runSupervisorAgentCommand"]},Rt=[];for(let n of Object.keys(ni))ni[n].length!==0&&Rt.push(n);F(Rt);function ii(n){let e={};for(let t of Rt){let i=ni[t];e[t]=i.every(o=>n[o]);}return e}r(ii,"createPerMethodPermissionMap");function Er(){let n={};for(let e of Rt)n[e]=true;return n}r(Er,"createPerMethodPermissionMapForTesting");var xe=null;function Mr(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(Mr,"withDisabledCssTransitions");var nt=class{static{r(this,"PluginEngine");}methodInvocationId=0;notificationId=0;postMessage;methodResponseHandlers=new Map;mode;subscriptions=new Map;perMethodPermissionMap;permissionSubscriptions=new Set;messageTypesCheckedInIsAllowedTo=new Set;showUncheckedPermissionToasts=true;environmentInfo=null;initialState;menuItemOnActionCallbackMap=new Map;contextMenuItemOnActionCallbackMap=new Map;rejectAllPending(e){for(let[t,i]of this.methodResponseHandlers)i.reject(e),this.methodResponseHandlers.delete(t);}constructor(e){if(!e){this.postMessage=()=>{},this.mode="canvas",this.perMethodPermissionMap=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 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=ii(e.permissionMap),this.postMessage=(t,i)=>e.transport.send(t,i),this.mode){case "canvas":case "image":case "editImage":case "configureManagedCollection":case "syncManagedCollection":case "collection":case "localization":case "code":typeof window<"u"&&window.addEventListener("pointerdown",()=>{this.invoke("onPointerDown");}),e.theme&&this.applyPluginTheme(e.theme),this.subscribe("theme",this.applyPluginTheme),this.applyPrereleaseStyles();break;case "api":break;default:Fe(this.mode);}}async invoke(e,...t){return this.invokeTransferable(e,void 0,...t)}async invokeTransferable(e,t,...i){return new Promise((a,s)=>{let d={type:"methodInvocation",methodName:e,id:this.methodInvocationId,args:i.map(W)};this.methodInvocationId+=1,this.methodResponseHandlers.set(d.id,{resolve:a,reject:s}),this.postMessage(d,t);})}subscribe(e,t){this.postMessage({type:"subscribe",topic:e});let i=this.subscriptions.get(e)??new Set;return i.add(t),this.subscriptions.set(e,i),()=>{let o=this.subscriptions.get(e)??new Set;o.delete(t),o.size===0&&this.postMessage({type:"unsubscribe",topic:e}),this.subscriptions.set(e,o);}}onMessage=r(e=>{let t=e?.data??e;if(Nr(t))switch(t.type){case "permissionUpdate":{this.perMethodPermissionMap=ii(t.permissionMap);for(let i of this.permissionSubscriptions)i();break}case "methodResponse":{let i=this.methodResponseHandlers.get(t.id);if(!i){switch(this.mode){case "canvas":case "image":case "editImage":case "configureManagedCollection":case "syncManagedCollection":case "collection":case "localization":case "code":throw new Error(`No handler for response with id ${t.id}`);case "api":{if(!(t.id<this.methodInvocationId))throw new Error(`No handler for unknown response id ${t.id}`);break}default:Fe(this.mode);}break}this.methodResponseHandlers.delete(t.id),f(t.error)?i.reject(new tt(t.error)):i.resolve(t.result);break}case "subscriptionMessage":{let{topic:i,payload:o}=t,a=this.subscriptions.get(i);if(!a)throw new Error("Received a subscription message but no handler present");for(let s of a)s(o);break}case "menuAction":{let i=this.getOnActionFromCallbackMap(t.actionId,t.actionType);if(!i)throw new Error("Menu action received for an unknown menu item");i();break}default:Fe(t);}},"onMessage");getOnActionFromCallbackMap(e,t){switch(t){case "pluginMenu":return this.menuItemOnActionCallbackMap.get(e);case "contextMenu":return this.contextMenuItemOnActionCallbackMap.get(e);default:Fe(t);}}applyPluginTheme=r(e=>{Mr(()=>{document.body.setAttribute("data-framer-theme",e.mode);for(let t in e.tokens)document.body.style.setProperty(t,e.tokens[t]);});},"applyPluginTheme");applyPrereleaseStyles(){typeof window>"u"||new URLSearchParams(window.location.search).get("styles")==="prerelease"&&document.body.setAttribute("data-framer-styles","prerelease");}async cloneNode(e){let t=await this.invoke("cloneNode",e);return t?C(t,this):null}async cloneWebPage(e,t){let i=await this.invoke("cloneWebPage",e,t);u(i,"Expected to receive data for cloned web page");let o=C(i,this);return u(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);u(i,"Expected to receive data for cloned design page");let o=C(i,this);return u(o instanceof $,"Expected cloned node to be an instance of DesignPageNode"),o}async setAttributes(e,t){let i=await this.invoke("setAttributes",e,t);return i?C(i,this):null}async getParent(e){let t=await this.invoke("getParent",e);return t?C(t,this):null}async getChildren(e){return (await this.invoke("getChildren",e)).map(i=>{let o=C(i,this);return u(Qe(o)),o})}notify=r((e,t)=>{let i=`notification-${this.notificationId}`;return this.notificationId+=1,this.invoke("notify",e,{notificationId:i,variant:t?.variant??"info",buttonText:t?.button?.text,durationMs:t?.durationMs}).then(o=>{o==="actionButtonClicked"&&t?.button?.onClick&&t.button.onClick(),t?.onDisappear&&t.onDisappear();}),{close:r(()=>this.invoke("closeNotification",i),"close")}},"notify");async setMenu(e){this.menuItemOnActionCallbackMap=new Map;let t=Lt(e,this.menuItemOnActionCallbackMap);await this.invoke("setMenu",t);}async showContextMenu(e,t){this.contextMenuItemOnActionCallbackMap=new Map;let i=Lt(e,this.contextMenuItemOnActionCallbackMap);await this.invoke("showContextMenu",i,t);}};function ka(n){return n.type==="component"}r(ka,"isCodeFileComponentExport");function Na(n){return n.type==="override"}r(Na,"isCodeFileOverrideExport");var ri=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 ri(t,this.#t))}async showProgressOnInstances(e){return this.#t.invoke("showProgressOnInstances",this.id,e)}async removeProgressFromInstances(){return this.#t.invoke("removeProgressFromInstances",this.id)}async lint(e){return Promise.resolve([])}async typecheck(e){return await this.#t.invoke("typecheckCode",this.name,this.content,e,this.id)}async navigateTo(){return this.#t.invoke("navigateTo",this.id)}};var Bt=class n{static{r(this,"ComponentInstancePlaceholder");}#e;#t;constructor(e,t){this.#e=e,this.#t=t;}get id(){return this.#e.id}get width(){return this.#e.width}get height(){return this.#e.height}get title(){return this.#e.title}get codePreview(){return this.#e.codePreview}async setAttributes(e){let t=await this.#t.invoke("updateComponentInstancePlaceholder",this.id,e);return t?new n(t,this.#t):null}async remove(){await this.#t.invoke("removeComponentInstancePlaceholder",this.id);}async replaceWithComponentInstance(e,t){let i=await this.#t.invoke("replaceComponentInstancePlaceholderWithComponentInstance",this.id,e,t);if(!i)return null;let o=C(i,this.#t);return u(be(o)),o}};var Aa=(()=>{let n=null;return {disableUntilMouseUp:r(()=>{if(n)return;n=document.createElement("style"),n.textContent="* { pointer-events: none !important; user-select: none !important; -webkit-user-select: none !important; }",document.head.appendChild(n);let e=r(()=>{n&&(document.head.removeChild(n),n=null,o());},"enablePointerEvents"),t=r(a=>{a.buttons>0&&a.buttons&1||e();},"handlePointerChange"),i=r(()=>{e();},"handleBlur");window.addEventListener("pointerup",t,true),window.addEventListener("pointermove",t,true),window.addEventListener("blur",i);function o(){window.removeEventListener("pointerup",t,true),window.removeEventListener("pointermove",t,true),window.removeEventListener("blur",i);}r(o,"cleanup");},"disableUntilMouseUp")}})(),wr=5,Ea=(()=>{let n=1;return {next:r(()=>`drag-${n++}`,"next")}})();function Ma(){}r(Ma,"noop");function Vr(n,e,t,i){if(n.mode!=="canvas")return Ma;let o=Ea.next(),a=document.body.style.cursor,s={type:"idle"},d=document.body,m=ae.subscribeToIsAllowedTo("makeDraggable",p=>{p||P();}),T=r(p=>{ae.isAllowedTo("makeDraggable")&&s.type!=="idle"&&(s.type==="dragging"&&n.invoke("onDragEnd",{...p,dragSessionId:o}).then(h=>{try{i?.(h);}catch{}}).catch(h=>{if(h instanceof Error){i?.({status:"error",reason:h.message});return}if(typeof h=="string"){i?.({status:"error",reason:h});return}i?.({status:"error"});}),P());},"endDrag"),v=r(p=>{if(!ae.isAllowedTo("makeDraggable")||s.type==="idle")return;if(!(p.buttons>0&&!!(p.buttons&1))){T({cancelled:false});return}let{clientX:w,clientY:z}=p;if(s.type==="pointerDown"){let E=w-s.dragStart.mouse.x,ct=z-s.dragStart.mouse.y;if(Math.abs(E)<wr&&Math.abs(ct)<wr)return;s={type:"dragging",dragStart:s.dragStart},n.invoke("onDragStart",s.dragStart),document.getSelection()?.empty(),Aa.disableUntilMouseUp();}d.setPointerCapture(p.pointerId);let ee={x:w,y:z};n.invoke("onDrag",{dragSessionId:o,mouse:ee}).then(E=>{s.type==="dragging"&&(document.body.style.cursor=E??"");});},"handlePointerChange"),D=r(p=>{p.key==="Escape"&&T({cancelled:true});},"handleKeyDown"),_=r(()=>{T({cancelled:true});},"handleBlur"),x=r(p=>{if(!ae.isAllowedTo("makeDraggable"))return;T({cancelled:true});let h=e.getBoundingClientRect(),w={x:h.x,y:h.y,width:h.width,height:h.height},z,ee=e.querySelectorAll("svg");if(ee.length===1){let ce=ee.item(0).getBoundingClientRect();z={x:ce.x,y:ce.y,width:ce.width,height:ce.height};}let E={x:p.clientX,y:p.clientY};s={type:"pointerDown",dragStart:{dragSessionId:o,elementRect:w,svgRect:z,mouse:E}},n.invoke("setDragData",o,t()),d.addEventListener("pointermove",v,true),d.addEventListener("pointerup",v,true),window.addEventListener("keydown",D,true),window.addEventListener("blur",_);},"handlePointerDown"),c=r(()=>{if(!ae.isAllowedTo("makeDraggable"))return;let p=t();p.type==="detachedComponentLayers"&&n.invoke("preloadDetachedComponentLayers",p.url),p.type==="image"&&n.invoke("preloadImageUrlForInsertion",p.image),p.previewImage&&n.invoke("preloadDragPreviewImage",p.previewImage);},"preload");e.addEventListener("pointerdown",x),e.addEventListener("mouseenter",c);function P(){s={type:"idle"},document.body.style.cursor=a,d.removeEventListener("pointermove",v,true),d.removeEventListener("pointerup",v,true),window.removeEventListener("keydown",D,true),window.removeEventListener("blur",_);}return r(P,"dragCleanup"),()=>{e.removeEventListener("pointerdown",x),e.removeEventListener("mouseenter",c),T({cancelled:true}),m();}}r(Vr,"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 u(pt(i)),I(i)?null:new n(i,this.#t)}};var oi=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]=vi(e),o=this.isAllowedTo(...t),a=r(()=>{let s=this.isAllowedTo(...t);s!==o&&(o=s,i(o));},"update");return this.#e.permissionSubscriptions.add(a),()=>{this.#e.permissionSubscriptions.delete(a);}}async showUI(e){return this.#e.invoke("showUI",e)}async hideUI(){return this.#e.invoke("hideUI")}async setBackgroundMessage(e){return this.#e.invoke("setBackgroundMessage",e)}closePlugin(e,t){throw this.#e.invoke("closePlugin",e,t),new J}async getCurrentUser(){return this.#e.invoke("getCurrentUser2")}async getProjectInfo(){return this.#e.invoke("getProjectInfo2")}async getSelection(){return (await this.#e.invoke("getSelection")).map(t=>{let i=C(t,this.#e);return u(Qe(i)),i})}async setSelection(e){let t=f(e)?[e]:Array.from(e);return this.#e.invoke("setSelection",t)}subscribeToSelection(e){return this.#e.subscribe("selection",t=>{let i=t.map(o=>{let a=C(o,this.#e);return u(Qe(a)),a});e(i);})}async getCanvasRoot(){let e=await this.#e.invoke("getCanvasRoot"),t=C(e,this.#e);return u(Sn(t)),t}subscribeToCanvasRoot(e){return this.#e.subscribe("canvasRoot",t=>{let i=C(t,this.#e);u(Sn(i)),e(i);})}async getPublishInfo(){return this.#e.invoke("getPublishInfo")}subscribeToPublishInfo(e){return this.#e.subscribe("publishInfo",e)}async createFrameNode(e,t){let i=await this.#e.invoke("createNode","FrameNode",t??null,e);if(!i)return null;let o=C(i,this.#e);return u(o instanceof O),o}async removeNodes(e){return this.#e.invoke("removeNodes2",e)}async removeNode(e){return this.removeNodes([e])}async cloneNode(e){return this.#e.cloneNode(e)}async getNode(e){let t=await this.#e.invoke("getNode",e);return t?C(t,this.#e):null}async getParent(e){return this.#e.getParent(e)}async getChildren(e){return this.#e.getChildren(e)}async getRect(e){return this.#e.invoke("getRect",e)}async zoomIntoView(e,t){let i=f(e)?[e]:Array.from(e);return this.#e.invoke("zoomIntoView",i,t)}async setAttributes(e,t){return this.#e.setAttributes(e,t)}async setParent(e,t,i){return this.#e.invoke("setParent",e,t,i)}async getNodesWithType(e){return (await this.#e.invoke("getNodesWithType",null,e)).map(i=>C(i,this.#e))}async getNodesWithAttribute(e){return (await this.#e.invoke("getNodesWithAttribute",null,e)).map(i=>C(i,this.#e))}async getNodesWithAttributeSet(e){return (await this.#e.invoke("getNodesWithAttributeSet",null,e)).map(i=>C(i,this.#e))}async getImage(){let e=await this.#e.invoke("getImage");return e?y(this.#e,e):null}subscribeToImage(e){return this.#e.subscribe("image",t=>{if(!t){e(null);return}e(y(this.#e,t));})}async addImage(e){let t=await ze(e),i=Z(t);return this.#e.invokeTransferable("addImage",i,t)}async setImage(e){let t=await ze(e),i=Z(t);return this.#e.invokeTransferable("setImage",i,t)}async uploadImage(e){let t=await ze(e),i=Z(t),o=await this.#e.invokeTransferable("uploadImage",i,t);return y(this.#e,o)}async addImages(e){let t=await xn(e),i=t.flatMap(Z);await this.#e.invokeTransferable("addImages",i,t);}async uploadImages(e){let t=await xn(e),i=t.flatMap(Z),o=await this.#e.invokeTransferable("uploadImages",i,t);return y(this.#e,o)}async uploadFile(e){let t=await bn(e),i=await this.#e.invokeTransferable("uploadFile",Z(t),t);return y(this.#e,i)}async uploadFiles(e){let t=await Promise.all(e.map(bn)),i=t.flatMap(Z),o=await this.#e.invokeTransferable("uploadFiles",i,t);return y(this.#e,o)}async addSVG(e){return this.#e.invoke("addSVG",e)}async addComponentInstance({url:e,attributes:t,parentId:i}){let o=await this.#e.invoke("addComponentInstance",{url:e,attributes:t,parentId:i}),a=C(o,this.#e);return u(be(a)),a}async addDetachedComponentLayers({url:e,layout:t,attributes:i}){let o=await this.#e.invoke("addDetachedComponentLayers",{url:e,layout:t,attributes:i}),a=C(o,this.#e);return u(wt(a)),a}async preloadDetachedComponentLayers(e){await this.#e.invoke("preloadDetachedComponentLayers",e);}async preloadImageUrlForInsertion(e){await this.#e.invoke("preloadImageUrlForInsertion",e);}async preloadDragPreviewImage(e){await this.#e.invoke("preloadDragPreviewImage",e);}async getText(){return this.#e.invoke("getText")}async setText(e){return this.#e.invoke("setText",e)}async addText(e,t){return this.#e.invoke("addText",e,t)}async setCustomCode(e){return this.#e.invoke("setCustomCode",e)}async getCustomCode(){return this.#e.invoke("getCustomCode")}subscribeToCustomCode(e){return this.#e.subscribe("customCode",e)}subscribeToText(e){return this.#e.subscribe("text",e)}makeDraggable(e,t,i){return Vr(this.#e,e,t,i)}async getActiveManagedCollection(){let e=await this.#e.invoke("getActiveManagedCollection");return u(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 u(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 ne(t,this.#e):null}async getActiveCollection(){let e=await this.#e.invoke("getActiveCollection");return e?new ne(e,this.#e):null}async getCollections(){return (await this.#e.invoke("getCollections")).map(t=>new ne(t,this.#e))}notify=r((e,t)=>this.#e.notify(e,t),"notify");async getPluginData(e){return this.#e.invoke("getPluginData",e)}async setPluginData(e,t){return this.#e.invoke("setPluginData",e,t)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeys")}async getColorStyles(){let e=await this.#e.invoke("getColorStyles");return y(this.#e,e)}async getColorStyle(e){let t=await this.#e.invoke("getColorStyle",e);return t?y(this.#e,t):null}async createColorStyle(e){let t=await this.#e.invoke("createColorStyle",e);return y(this.#e,t)}subscribeToColorStyles(e){return this.#e.subscribe("colorStyles",t=>{let i=y(this.#e,t);return e(i)})}async getTextStyles(){let e=await this.#e.invoke("getTextStyles");return y(this.#e,e)}async getTextStyle(e){let t=await this.#e.invoke("getTextStyle",e);return t?y(this.#e,t):null}async createTextStyle(e){let t=await this.#e.invoke("createTextStyle",e);return y(this.#e,t)}subscribeToTextStyles(e){return this.#e.subscribe("textStyles",t=>{let i=y(this.#e,t);return e(i)})}async getFont(e,t){let i=await this.#e.invoke("getFont",e,t);return i?y(this.#e,i):null}async getFonts(){let e=await this.#e.invoke("getFonts");return y(this.#e,e)}getLocales(){return this.#e.invoke("getLocales")}getDefaultLocale(){return this.#e.invoke("getDefaultLocale")}getActiveLocale(){return this.#e.invoke("getActiveLocale")}async getLocalizationGroups(e){return this.#e.invoke("getLocalizationGroups",e)}setLocalizationData(e){return this.#e.invoke("setLocalizationData",e)}async getRedirects(){return (await this.#e.invoke("getRedirects")).map(t=>new Ce(t,this.#e))}subscribeToRedirects(e){return this.#e.subscribe("redirects",t=>{let i=t.map(o=>new Ce(o,this.#e));return e(i)})}async addRedirects(e){return (await this.#e.invoke("addRedirects",e)).map(i=>new Ce(i,this.#e))}async removeRedirects(e){return this.#e.invoke("removeRedirects",e)}async setRedirectOrder(e){return this.#e.invoke("setRedirectOrder",e)}async createCodeFile(e,t,i){let o=await this.#e.invoke("createCodeFile",e,t,i);return new Q(o,this.#e)}async getCodeFiles(){let e=await this.#e.invoke("getCodeFiles"),t=[];for(let i of e)t.push(new Q(i,this.#e));return t}async getCodeFile(e){let t=await this.#e.invoke("getCodeFile",e);return t?new Q(t,this.#e):null}lintCode(e,t,i){return Promise.resolve([])}typecheckCode(e,t,i,o){return this.#e.invoke("typecheckCode",e,t,i,o)}subscribeToCodeFiles(e){return this.#e.subscribe("codeFiles",t=>{let i=t?.map(o=>new Q(o,this.#e));return e(i)})}setMenu(e){return this.#e.setMenu(e)}showContextMenu(e,t){return this.#e.showContextMenu(e,t)}async unstable_ensureMinimumDependencyVersion(e,t){return this.#e.invoke("unstable_ensureMinimumDependencyVersion",e,t)}async navigateTo(e,t){return this.#e.invoke("navigateTo",e,t)}subscribeToOpenCodeFile(e){return this.#e.subscribe("openCodeFile",t=>{let i=t?new Q(t,this.#e):null;return e(i)})}async createDesignPage(e){let t=await this.#e.invoke("createDesignPage",e),i=C(t,this.#e);return u(i instanceof $,"Expected node to be a DesignPageNode"),i}async createWebPage(e){let t=await this.#e.invoke("createWebPage",e),i=C(t,this.#e);return u(i instanceof K,"Expected node to be a WebPageNode"),i}async createCollection(e){let t=await this.#e.invoke("createCollection",e);return new ne(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}},ai=class extends oi{static{r(this,"FramerPluginAPIBeta");}#e;constructor(e){super(e),this.#e=e,this.#e;}},it=class extends ai{static{r(this,"FramerPluginAPIAlpha");}#e;constructor(e){super(e),this.#e=e,this.#e;}async unstable_getDependencyVersion(e){return this.#e.invoke("unstable_getDependencyVersion",e)}async addComponentInstancePlaceholder(e){let t=await this.#e.invoke("addComponentInstancePlaceholder",e);return new Bt(t,this.#e)}async[l.getAiServiceInfo](e){return this.#e.invoke(mt,e)}async[l.sendTrackingEvent](e,t,i){return this.#e.invoke(ft,e,t,i)}async[l.getCurrentUser](){return this.#e.invoke(yt)}async[l.getProjectInfo](){return this.#e.invoke(ht)}async[l.getHTMLForNode](e){return this.#e.invoke(ge,e)}async[l.setHTMLForNode](e,t){return this.#e.invoke(me,e,t)}get[l.environmentInfo](){return this.#e.environmentInfo}get[l.showUncheckedPermissionToasts](){return this.#e.showUncheckedPermissionToasts}set[l.showUncheckedPermissionToasts](e){this.#e.showUncheckedPermissionToasts=e;}async createTextNode(e,t){let i=await this.#e.invoke("createNode","TextNode",t??null,e);if(!i)return null;let o=C(i,this.#e);return u(o instanceof re),o}async createComponentNode(e){let t=await this.#e.invoke("createNode","ComponentNode",null,{name:e});if(!t)return null;let i=C(t,this.#e);return u(i instanceof oe),i}async getVectorSets(){return (await this.#e.invoke("getVectorSets")).map(t=>new et(t,this.#e))}async createLocale(e){return this.#e.invoke("createLocale",e)}async getLocaleLanguages(){return this.#e.invoke("getLocaleLanguages")}async getLocaleRegions(e){return this.#e.invoke("getLocaleRegions",e)}async[b.publish](){return this.#e.invoke("publish")}async[b.getDeployments](){return this.#e.invoke("getDeployments")}async[b.deploy](e,t){return this.#e.invoke("deploy",e,t)}async[b.getChangedPaths](){return this.#e.invoke("getChangedPaths")}async[b.getChangeContributors](e,t){return this.#e.invoke("getChangeContributors",e,t)}async[b.createManagedCollection](e){return this.createManagedCollection(e)}[b.rejectAllPending](e){this.#e.rejectAllPending(e);}async[b.getAgentSystemPrompt](){return this.#e.invoke("getAgentSystemPrompt")}async[b.getAgentContext](e){return this.#e.invoke("getAgentContext",e)}async[b.readProjectForAgent](e,t){return this.#e.invoke("readProjectForAgent",e,t)}async[b.applyAgentChanges](e,t){return this.#e.invoke("applyAgentChanges",e,t)}async[b.publishForAgent](e){return this.#e.invoke("publishForAgent",e)}async[b.queryImagesForAgent](e){return this.#e.invoke("queryImagesForAgent",e)}async[b.reviewChangesForAgent](e){return this.#e.invoke("reviewChangesForAgent",e)}async[b.flattenComponentInstanceForAgent](e,t){return this.#e.invoke("flattenComponentInstanceForAgent",e,t)}async[b.makeExternalComponentLocalForAgent](e,t){return this.#e.invoke("makeExternalComponentLocalForAgent",e,t)}async[b.getNodeForAgent](e,t){return this.#e.invoke("getNodeForAgent",e,t)}async[b.getNodesForAgent](e,t){return this.#e.invoke("getNodesForAgent",e,t)}async[b.getNodesOfTypesForAgent](e,t){return this.#e.invoke("getNodesOfTypesForAgent",e,t)}async[b.getScopeNodeForAgent](e,t){return this.#e.invoke("getScopeNodeForAgent",e,t)}async[b.getGroundNodeForAgent](e,t){return this.#e.invoke("getGroundNodeForAgent",e,t)}async[b.getParentNodeForAgent](e,t){return this.#e.invoke("getParentNodeForAgent",e,t)}async[b.getAncestorsForAgent](e,t){return this.#e.invoke("getAncestorsForAgent",e,t)}async[b.serializeForAgent](e,t){return this.#e.invoke("serializeForAgent",e,t)}async[b.serializeNodesForAgent](e,t){return this.#e.invoke("serializeNodesForAgent",e,t)}async[b.paginateForAgent](e,t){return this.#e.invoke("paginateForAgent",e,t)}async[b.startAgentConversation](e,t){return this.#e.invoke("startAgentConversation",e,t)}async[b.continueAgentConversation](e,t){return this.#e.invoke("continueAgentConversation",e,t)}async[b.submitAgentClarification](e){return this.#e.invoke("submitAgentClarification",e)}async[b.runSupervisorAgentCommand](e){return this.#e.invoke("runSupervisorAgentCommand",e)}};var si=class{constructor(e){this.origin=e;}origin;static{r(this,"IframeTransport");}send(e,t){window.parent.postMessage(e,this.origin,t);}onMessage(e){window.addEventListener("message",e);}};async function wa(){return new Promise(n=>{function e({data:t,origin:i}){if(!Ar(t))return;window.removeEventListener("message",e);let a={transport:new si(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(kr,"*");})}r(wa,"createBrowserContext");async function Va(){return typeof window>"u"||"Deno"in globalThis?null:wa()}r(Va,"bootstrap");var Lr=await Va(),ae=Lr?new it(new nt(Lr)):new Proxy({},{get(n,e){throw new Error(`Cannot access framer.${String(e)} in server runtime. Use createFramerInstance() with a custom transport.`)}});function Wr(n){return new it(new nt(n))}r(Wr,"createFramerInstance");var Rr={};function Wa(n){if(env)try{Object.assign(env,n);}catch{}Object.assign(Rr,n);}r(Wa,"configure");function Ie(n,e){let t=Rr[n]??env[n];return t&&t.length>0?t:e}r(Ie,"getEnv");var Br=isWorkerd,di=globalThis.WebSocket;async function Ur(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(Ur,"connectWebSocketCF");var Or,zr;try{Or=await import('fs'),zr=await import('path');}catch{}var ui=Or,ci=zr;var se=(D=>(D.PROJECT_CLOSED="PROJECT_CLOSED",D.POOL_EXHAUSTED="POOL_EXHAUSTED",D.TIMEOUT="TIMEOUT",D.INTERNAL="INTERNAL",D.NODE_NOT_FOUND="NODE_NOT_FOUND",D.SCREENSHOT_TOO_LARGE="SCREENSHOT_TOO_LARGE",D.SCREENSHOT_PREPARE_FAILED="SCREENSHOT_PREPARE_FAILED",D.EXPORT_SVG_FAILED="EXPORT_SVG_FAILED",D.INVALID_REQUEST="INVALID_REQUEST",D.INVALID_RELEASE_CHANNEL="INVALID_RELEASE_CHANNEL",D.UNAUTHORIZED="UNAUTHORIZED",D))(se||{}),k=class extends Error{static{r(this,"FramerAPIError");}code;ref;constructor(e,t,i){super(e),this.name="FramerAPIError",this.code=t,i?.ref!==void 0&&(this.ref=i.ref),this.stack=void 0;}toString(){let e=super.toString();return this.ref?`${e} [ref: ${this.ref}]`:e}};function Ra(n){return n instanceof k?n.code==="POOL_EXHAUSTED":false}r(Ra,"isRetryableError");var Ba=new Map(Object.values(se).map(n=>[n,n]));function Kr(n){return typeof n=="string"?Ba.get(n)??"INTERNAL":"INTERNAL"}r(Kr,"parseErrorCode");var Ua={pluginMarshalTag:Et};var pi={silent:0,error:1,warn:2,info:3,debug:4};function Oa(){let n=Ie("FRAMER_API_LOG_LEVEL")?.toLowerCase();return n&&n in pi?n:"warn"}r(Oa,"getLogLevel");var gi=Oa();function rt(n){return pi[n]<=pi[gi]}r(rt,"shouldLog");var ot=globalThis.console,za="\x1B[90m",Ga="\x1B[0m";function Ka(n){return n?`[FramerAPI:${n}]`:"[FramerAPI]"}r(Ka,"formatPrefix");function $a(n,...e){return [za+n,...e,Ga]}r($a,"formatDebug");function $r(n){let e=Ka(n);return {warn:r((...t)=>{rt("warn")&&ot.warn(e,...t);},"warn"),error:r((...t)=>{rt("error")&&ot.error(e,...t);},"error"),log:r((...t)=>{rt("info")&&ot.log(e,...t);},"log"),info:r((...t)=>{rt("info")&&ot.info(e,...t);},"info"),debug:r((...t)=>{rt("debug")&&ot.debug(...$a(e,...t));},"debug"),setLevel:r(t=>{gi=t;},"setLevel"),getLevel:r(()=>gi,"getLevel"),withRequestId:r(t=>$r(t),"withRequestId")}}r($r,"createLogger");var A=$r();A.warn;A.error;A.log;A.info;A.debug;A.setLevel;A.getLevel;var Ut="0.1.12";var Hr="wss://api.framer.com/channel/headless-plugin";function Te(n,...e){if(n)return;let t=Error("Assertion Error"+(e.length>0?": "+e.join(" "):""));if(t.stack)try{let i=t.stack.split(`
5
+ `));}catch{}throw t}r(u,"assert");function v(n){for(let e of Reflect.ownKeys(n)){let t=n[e];!t||typeof t!="object"&&!So(t)||v(t);}return Object.freeze(n)}r(v,"deepFreeze");function Ai(n){return [n.slice(0,-1),n.at(-1)]}r(Ai,"splitRestAndLast");var f="__class";var qt=Symbol(),Yt=Symbol(),Xt=Symbol(),Zt=Symbol(),Fo=Symbol(),vo=Symbol(),Do=Symbol(),ko=Symbol(),No=Symbol(),Jt=Symbol(),Qt=Symbol(),l={getAiServiceInfo:qt,sendTrackingEvent:Yt,getCurrentUser:Xt,getProjectInfo:Zt,environmentInfo:Fo,initialState:vo,showUncheckedPermissionToasts:Do,marshal:ko,unmarshal:No,getHTMLForNode:Jt,setHTMLForNode:Qt},pe="INTERNAL_",mt=`${pe}getAiServiceInfo`,ft=`${pe}sendTrackingEvent`,yt=`${pe}getCurrentUser`,ht=`${pe}getProjectInfo`,ge=`${pe}getHTMLForNode`,me=`${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(T(t))return null;let i=this.constructor;return new i(this.#e,t)}async remove(){await this.#e.invoke("removeVariables",this.nodeId,[this.id]);}},V="Variable";function L(n){let e=n.at(0);return u(!ki(e)),`${e.toLowerCase()}${n.slice(1,-V.length)}`}r(L,"classToType");var Ao=`Boolean${V}`,Eo=L(Ao),ve=class n extends M{static{r(this,"BooleanVariable");}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}},Mo=`Number${V}`,wo=L(Mo),De=class n extends M{static{r(this,"NumberVariable");}type=wo;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},Vo=`String${V}`,Lo=L(Vo),ke=class n extends M{static{r(this,"StringVariable");}type=Lo;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},Wo=`FormattedText${V}`,Ro=L(Wo),Ne=class n extends M{static{r(this,"FormattedTextVariable");}type=Ro;#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}},Bo=`Enum${V}`,Uo=L(Bo),Y=class n{static{r(this,"EnumCase");}#e;#t;#n;#i;get id(){return this.#i.id}get name(){return this.#i.name}get nameByLocale(){return this.#i.nameByLocale}constructor(e,t,i,o){this.#e=e,this.#t=t,this.#n=i,this.#i=o;}async setAttributes(e){let t=await this.#e.invoke("updateEnumCase",this.#t,this.#n,this.id,e);return t?new n(this.#e,this.#t,this.#n,t):null}async remove(){await this.#e.invoke("removeEnumCase",this.#t,this.#n,this.id);}},Ae=class n extends M{static{r(this,"EnumVariable");}type=Uo;#e;#t;#n;get cases(){return this.#n||(this.#n=v(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);}},Oo=`Color${V}`,zo=L(Oo),Ee=class n extends M{static{r(this,"ColorVariable");}type=zo;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},Go=`Image${V}`,Ko=L(Go),Me=class n extends M{static{r(this,"ImageVariable");}type=Ko;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},$o=`File${V}`,Ho=L($o),we=class n extends M{static{r(this,"FileVariable");}type=Ho;#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}},jo=`Link${V}`,_o=L(jo),Ve=class n extends M{static{r(this,"LinkVariable");}type=_o;#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}},qo=`Date${V}`,Yo=L(qo),Le=class n extends M{static{r(this,"DateVariable");}type=Yo;#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}},Xo=`Border${V}`,Zo=L(Xo),We=class n extends M{static{r(this,"BorderVariable");}type=Zo;#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}},Jo=`Unsupported${V}`,Qo=L(Jo),Re=class n extends M{static{r(this,"UnsupportedVariable");}type=Qo;#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 Ei(n){return n instanceof M}r(Ei,"isVariable");function ea(n){return Ei(n)&&n.nodeType==="component"}r(ea,"isComponentVariable");var U=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(u(pt(i)),T(i))return null;u(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]);}},B=class extends U{static{r(this,"FieldBaseWithRequired");}#e;get required(){return this.#e.required}constructor(e,t,i){super(e,t,i),this.#e=i;}},bt=class extends U{static{r(this,"BooleanField");}type=nn},xt=class extends U{static{r(this,"ColorField");}type=rn},Ct=class extends U{static{r(this,"NumberField");}type=on},It=class extends B{static{r(this,"StringField");}type=an;#e;constructor(e,t,i){super(e,t,i),this.#e=i;}get basedOn(){return this.#e.basedOn}},Tt=class extends B{static{r(this,"FormattedTextField");}type=sn},Be=class extends B{static{r(this,"ImageField");}type=ln},Pt=class extends B{static{r(this,"LinkField");}type=un},St=class extends B{static{r(this,"DateField");}type=cn;#e;get displayTime(){return this.#e.displayTime}constructor(e,t,i){super(e,t,i),this.#e=i;}},Ft=class extends U{static{r(this,"FieldDivider");}type=yn},Ue=class extends U{static{r(this,"UnsupportedField");}type=hn},vt=class extends B{static{r(this,"FileField");}type=pn;#e;get allowedFileTypes(){return this.#e.allowedFileTypes}constructor(e,t,i){super(e,t,i),this.#e=i;}},Dt=class extends U{static{r(this,"EnumField");}type=gn;#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)),v(this.#i)),this.#i}constructor(e,t,i){super(e,t,i),this.#e=e,this.#t=t,this.#n=i;}async addCase(e){let t=await this.#e.invoke("addEnumCase",this.#t,this.id,e);return t?new Y(this.#e,this.#t,this.id,t):null}async setCaseOrder(e){await this.#e.invoke("setEnumCaseOrder",this.#t,this.id,e);}},kt=class extends B{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 B{static{r(this,"MultiCollectionReferenceField");}type=fn;#e;get collectionId(){return this.#e.collectionId}constructor(e,t,i){super(e,t,i),this.#e=i;}},en=class extends B{static{r(this,"ArrayField");}type=dn;fields;constructor(e,t,i){super(e,t,i);let o=i.fields[0];this.fields=[new Be(e,t,o)];}};function tn(n,e,t){return n.map(i=>{switch(i.type){case nn:return new bt(e,t,i);case rn:return new xt(e,t,i);case on:return new Ct(e,t,i);case an:return new It(e,t,i);case sn:return new Tt(e,t,i);case ln:return new Be(e,t,i);case un:return new Pt(e,t,i);case cn:return new St(e,t,i);case yn:return new Ft(e,t,i);case hn:return new Ue(e,t,i);case pn:return new vt(e,t,i);case gn:return new Dt(e,t,i);case mn:return new kt(e,t,i);case fn:return new Nt(e,t,i);case dn:return new en(e,t,i);default:return new Ue(e,t,i)}})}r(tn,"fieldDefinitionDataArrayToFieldClassInstances");function ta(n){return n instanceof U}r(ta,"isField");var Mi="action";function na(n){return !!n&&Mi in n&&y(n[Mi])}r(na,"isLocalizedValueUpdate");function wi(n){return Object.keys(n).reduce((e,t)=>{let i=n[t];return na(i)&&(e[t]=i),e},{})}r(wi,"filterInlineLocalizationValues");var Oe=class n{static{r(this,"FileAsset");}id;url;extension;constructor(e){this.url=e.url,this.id=e.id,this.extension=e.extension;}static[l.unmarshal](e,t){return new n(t)}[l.marshal](){return {[f]:"FileAsset",id:this.id,url:this.url,extension:this.extension}}};function ia(n){return n instanceof Oe}r(ia,"isFileAsset");var ra="ImageAsset";function Vi(n){return N(n)?n[f]===ra:false}r(Vi,"isImageAssetData");var X=class n{static{r(this,"ImageAsset");}id;url;thumbnailUrl;altText;resolution;#e;#t;constructor(e,t){this.#t=e,this.url=t.url,this.id=t.id,this.thumbnailUrl=t.thumbnailUrl,this.altText=t.altText,this.resolution=t.resolution;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return {[f]:"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,{[f]:"ImageAsset",id:this.id,url:this.url,thumbnailUrl:this.thumbnailUrl,altText:e??this.altText,resolution:t??this.resolution})}async measure(){return sa(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 oa(n){return n instanceof X}r(oa,"isImageAsset");function Z(n){return n.type==="bytes"?[n.bytes.buffer]:[]}r(Z,"getTransferable");function aa(n){if(!N(n))return false;let e="bytes",t="mimeType";return !(!(e in n)||!(t in n)||!(n[e]instanceof Uint8Array)||!y(n[t]))}r(aa,"isBytesData");async function ze(n){if(n instanceof File)return Cn(n);let e=await Li(n.image);return {name:n.name,altText:n.altText,resolution:n.resolution,preferredImageRendering:n.preferredImageRendering,...e}}r(ze,"createImageTransferFromInput");async function bn(n){if(n instanceof File)return Cn(n);let e=await Li(n.file);return {name:n.name,...e}}r(bn,"createFileTransferFromInput");async function Li(n){return n instanceof File?Cn(n):aa(n)?{type:"bytes",mimeType:n.mimeType,bytes:n.bytes}:{type:"url",url:n}}r(Li,"createAssetTransferFromAssetInput");function xn(n){return Promise.all(n.map(ze))}r(xn,"createNamedAssetDataTransferFromInput");async function Cn(n){return new Promise((e,t)=>{let i=new FileReader;i.onload=o=>{let a=n.type,s=o.target?.result;if(!s||!(s instanceof ArrayBuffer)){t(new Error("Failed to read file, arrayBuffer is null"));return}let d=new Uint8Array(s);e({bytes:d,mimeType:a,type:"bytes",name:n.name});},i.onerror=o=>{t(o);},i.readAsArrayBuffer(n);})}r(Cn,"getAssetDataFromFile");async function sa(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(sa,"measureImage");var At=class{static{r(this,"ComputedValueBase");}};var la="unsupported",Ge=class n extends At{static{r(this,"UnsupportedComputedValue");}type=la;#e;constructor(e){super(),this.#e=e;}static[l.unmarshal](e,t){return new n(t)}[l.marshal](){return this.#e}};function da(n){return n instanceof At}r(da,"isComputedValue");var ua="Font";function Ri(n){return N(n)&&n[f]===ua}r(Ri,"isFontData");function ca(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(ca,"isFontWeight");function pa(n){if(!y(n))return false;switch(n){case "normal":case "italic":return true;default:return false}}r(pa,"isFontStyle");function Bi(n){return N(n)?y(n.family)&&y(n.selector)&&ca(n.weight)&&pa(n.style):false}r(Bi,"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=Wi.get(t.selector);if(i)return i;let o=new n(t);return Wi.set(t.selector,o),o}[l.marshal](){return {[f]:"Font",selector:this.selector,family:this.family,weight:this.weight,style:this.style}}},Wi=new Map;var Et="plugin-marshal";function In(n){return N(n)&&l.marshal in n}r(In,"isSelfMarshalable");function W(n){if(In(n))return n[l.marshal]();if(gt(n))return n.map(W);if(Se(n)){let e={};for(let t of Object.keys(n))e[t]=W(n[t]);return e}return n}r(W,"marshal");var ga="LinearGradient",ma="RadialGradient",fa="ConicGradient",fe=class{static{r(this,"GradientBase");}#e;get stops(){return this.#e.stops}constructor(e){this.#e=e;}cloneWithAttributes(e){let t=this.constructor;return new t({...this.#e,...e})}},Ke=class n extends fe{static{r(this,"LinearGradient");}[f]=ga;#e;get angle(){return this.#e.angle}constructor(e){super(e),this.#e=e;}static[l.unmarshal](e,t){return new n({...t,stops:h(e,t.stops)})}[l.marshal](){return W({...this.#e,[f]:this[f]})}toCSS(){let e=this.#e.stops.map(t=>(u(y(t.color),"ColorStyle not supported yet"),`${t.color} ${t.position*100}%`)).join(", ");return `linear-gradient(${this.angle}deg, ${e})`}},$e=class n extends fe{static{r(this,"RadialGradient");}[f]=ma;#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:h(e,t.stops)})}[l.marshal](){return W({...this.#e,[f]:this[f]})}toCSS(){let e=this.stops.map((t,i)=>{u(y(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})`}},He=class n extends fe{static{r(this,"ConicGradient");}[f]=fa;#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:h(e,t.stops)})}[l.marshal](){return W({...this.#e,[f]:this[f]})}toCSS(){let e=this.stops.map(t=>(u(y(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 Ui(n){return n instanceof fe}r(Ui,"isGradient");var ya="ColorStyle";function Mt(n){return N(n)?n[f]===ya:false}r(Mt,"isColorStyleData");var te=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 {[f]:"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 te}r(ye,"isColorStyle");var ha="TextStyle";function Oi(n){return N(n)?n[f]===ha:false}r(Oi,"isTextStyleData");var je=class n{static{r(this,"TextStyle");}id;name;path;tag;font;boldFont;italicFont;boldItalicFont;color;transform;alignment;decoration;decorationColor;decorationThickness;decorationStyle;decorationSkipInk;decorationOffset;balance;breakpoints;minWidth;fontSize;letterSpacing;lineHeight;paragraphSpacing;#e;constructor(e,t){this.id=t.id,this.name=t.name,this.path=t.path,this.tag=t.tag,this.font=G[l.unmarshal](e,t.font),this.boldFont=t.boldFont&&G[l.unmarshal](e,t.boldFont),this.italicFont=t.italicFont&&G[l.unmarshal](e,t.italicFont),this.boldItalicFont=t.boldItalicFont&&G[l.unmarshal](e,t.boldItalicFont),this.color=Mt(t.color)?te[l.unmarshal](e,t.color):t.color,this.transform=t.transform,this.alignment=t.alignment,this.decoration=t.decoration,this.decorationColor=Mt(t.decorationColor)?te[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 {[f]:"TextStyle",id:this.id,name:this.name,path:this.path,tag:this.tag,font:this.font[l.marshal](),boldFont:this.boldFont?.[l.marshal]()??null,italicFont:this.italicFont?.[l.marshal]()??null,boldItalicFont:this.boldItalicFont?.[l.marshal]()??null,color:ye(this.color)?this.color[l.marshal]():this.color,transform:this.transform,alignment:this.alignment,decoration:this.decoration,decorationColor:ye(this.decorationColor)?this.decorationColor[l.marshal]():this.decorationColor,decorationThickness:this.decorationThickness,decorationStyle:this.decorationStyle,decorationSkipInk:this.decorationSkipInk,decorationOffset:this.decorationOffset,balance:this.balance,breakpoints:this.breakpoints,minWidth:this.minWidth,fontSize:this.fontSize,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,paragraphSpacing:this.paragraphSpacing}}async setAttributes(e){let t=await this.#e.invoke("setTextStyleAttributes",this.id,e);return t?new n(this.#e,t):null}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async setPluginData(e,t){return this.#e.invoke("setPluginDataForNode",this.id,e,t)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}async remove(){return this.#e.invoke("removeTextStyle",this.id)}};function Tn(n){return n instanceof je}r(Tn,"isTextStyle");var zi={ColorStyle:te,ConicGradient:He,FileAsset:Oe,Font:G,ImageAsset:X,LinearGradient:Ke,RadialGradient:$e,TextStyle:je,BooleanVariable:ve,BorderVariable:We,ColorVariable:Ee,DateVariable:Le,EnumVariable:Ae,FileVariable:we,FormattedTextVariable:Ne,ImageVariable:Me,LinkVariable:Ve,NumberVariable:De,StringVariable:ke,UnsupportedVariable:Re,UnsupportedComputedValue:Ge};function ba(n){return Se(n)&&y(n[f])&&n[f]in zi}r(ba,"isSelfUnmarshalable");function h(n,e){if(ba(e))return zi[e[f]][l.unmarshal](n,e);if(gt(e))return e.map(t=>h(n,t));if(Se(e)){let t={};for(let i of Object.keys(e))t[i]=h(n,e[i]);return t}return e}r(h,"unmarshal");var xa={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 Ca(n){return xa[n]}r(Ca,"isSupportedArrayItemFieldType");function Ia(n){return Ca(n.type)}r(Ia,"isSupportedArrayItemFieldDataEntry");var nn="boolean",rn="color",on="number",an="string",sn="formattedText",ln="image",dn="array",un="link",cn="date",pn="file",gn="enum",mn="collectionReference",fn="multiCollectionReference",yn="divider",hn="unsupported";function Ta(n){return n.map(e=>{if(e.type!=="enum")return e;let t=e.cases.map(i=>{let o=i.nameByLocale?wi(i.nameByLocale):void 0;return {...i,nameByLocale:o}});return {...e,cases:t}})}r(Ta,"sanitizeEnumFieldForMessage");function Gi(n,e){let t={};for(let i in n){let o=n[i];if(!o)continue;if(o.type!=="array"){t[i]=h(e,o);continue}let a=o.value.map(s=>{let d=Gi(s.fieldData,e),m={};for(let C in d){let F=d[C];u(F&&Ia(F),"Unsupported array item field data entry"),m[C]=F;}return {...s,fieldData:m}});t[i]={...o,value:a};}return t}r(Gi,"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,u(e.managedBy!=="user","Managed Collection can only be managed by a plugin"),this.managedBy=e.managedBy,this.#e=t,v(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=Ta(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)}},ne=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,v(this);}async setItemOrder(e){return this.#e.invoke("setCollectionItemOrder",this.id,e)}async getFields(){let e=await this.#e.invoke("getCollectionFields2",this.id,true);return tn(e,this.#e,this.id)}async addFields(e){let t=await this.#e.invoke("addCollectionFields2",this.id,e);return u(t.every(Ni)),tn(t,this.#e,this.id)}async removeFields(e){return this.#e.invoke("removeCollectionFields",this.id,e)}async setFieldOrder(e){return this.#e.invoke("setCollectionFieldOrder",this.id,e)}async getItems(){return (await this.#e.invoke("getCollectionItems2",this.id)).map(t=>new _e(t,this.#e))}async addItems(e){await this.#e.invoke("addCollectionItems2",this.id,e);}async removeItems(e){return this.#e.invoke("removeCollectionItems",e)}async setAsActive(){return this.#e.invoke("setActiveCollection",this.id)}async setPluginData(e,t){return this.#e.invoke("setPluginDataForNode",this.id,e,t)}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}async navigateTo(e){return this.#e.invoke("navigateTo",this.id,e)}},_e=class n{static{r(this,"CollectionItem");}id;nodeId;slug;slugByLocale;draft;fieldData;#e;constructor(e,t){let i=Gi(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,v(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 Pa={fixed:true,sticky:true,absolute:true,relative:true},Ki="position";function wl(n){if(!(Ki in n))return false;let e=n[Ki];return y(e)&&Pa[e]===true}r(wl,"supportsPosition");var $i="top";function Vl(n){if(!($i in n))return false;let e=n[$i];return y(e)||T(e)}r(Vl,"supportsPins");var Hi="width";function Ll(n){if(!(Hi in n))return false;let e=n[Hi];return y(e)||T(e)}r(Ll,"supportsSize");var ji="maxWidth";function Wl(n){if(!(ji in n))return false;let e=n[ji];return y(e)||T(e)}r(Wl,"supportsSizeConstraints");var _i="aspectRatio";function Rl(n){if(!(_i in n))return false;let e=n[_i];return q(e)||T(e)}r(Rl,"supportsAspectRatio");var qi="name";function Bl(n){if(!(qi in n))return false;let e=n[qi];return y(e)||T(e)}r(Bl,"supportsName");var Yi="visible";function Ul(n){if(!(Yi in n))return false;let e=n[Yi];return Pe(e)}r(Ul,"supportsVisible");var Xi="locked";function Ol(n){if(!(Xi in n))return false;let e=n[Xi];return Pe(e)}r(Ol,"supportsLocked");var Zi="backgroundColor";function zl(n){if(!(Zi in n))return false;let e=n[Zi];return y(e)||ye(e)||T(e)}r(zl,"supportsBackgroundColor");var Ji="backgroundColor";function Gl(n){if(!(Ji in n))return false;let e=n[Ji];return y(e)||Mt(e)||T(e)}r(Gl,"supportsBackgroundColorData");var Qi="backgroundImage";function Kl(n){if(!(Qi in n))return false;let e=n[Qi];return e instanceof X||T(e)}r(Kl,"supportsBackgroundImage");var er="backgroundImage";function $l(n){if(!(er in n))return false;let e=n[er];return e instanceof X?false:Vi(e)||T(e)}r($l,"supportsBackgroundImageData");var tr="backgroundGradient";function Hl(n){if(!(tr in n))return false;let e=n[tr];return Ui(e)||T(e)}r(Hl,"supportsBackgroundGradient");var nr="backgroundGradient";function jl(n){if(!(nr in n))return false;let e=n[nr];return N(e)||T(e)}r(jl,"supportsBackgroundGradientData");var ir="rotation";function _l(n){if(!(ir in n))return false;let e=n[ir];return q(e)}r(_l,"supportsRotation");var rr="opacity";function ql(n){if(!(rr in n))return false;let e=n[rr];return q(e)}r(ql,"supportsOpacity");var or="borderRadius";function Yl(n){if(!(or in n))return false;let e=n[or];return y(e)||T(e)}r(Yl,"supportsBorderRadius");var ar="border";function Xl(n){if(!(ar in n))return false;let e=n[ar];return T(e)||ye(e.color)}r(Xl,"supportsBorder");var sr="svg";function Zl(n){if(!(sr in n))return false;let e=n[sr];return y(e)}r(Zl,"supportsSVG");var lr="textTruncation";function Jl(n){if(!(lr in n))return false;let e=n[lr];return q(e)||T(e)}r(Jl,"supportsTextTruncation");var dr="zIndex";function Ql(n){if(!(dr in n))return false;let e=n[dr];return q(e)||T(e)}r(Ql,"supportsZIndex");var ur="overflow";function ed(n){if(!(ur in n))return false;let e=n[ur];return y(e)||T(e)}r(ed,"supportsOverflow");var cr="componentIdentifier";function td(n){if(!(cr in n))return false;let e=n[cr];return y(e)}r(td,"supportsComponentInfo");var pr="font";function nd(n){if(!(pr in n))return false;let e=n[pr];return Bi(e)}r(nd,"supportsFont");var gr="font";function id(n){if(!(gr in n))return false;let e=n[gr];return Ri(e)||T(e)}r(id,"supportsFontData");var mr="inlineTextStyle";function rd(n){if(!(mr in n))return false;let e=n[mr];return Tn(e)||T(e)}r(rd,"supportsInlineTextStyle");var fr="inlineTextStyle";function od(n){if(!(fr in n))return false;let e=n[fr];return Oi(e)||T(e)}r(od,"supportsInlineTextStyleData");var yr="link";function ad(n){if(!(yr in n))return false;let e=n[yr];return y(e)||T(e)}r(ad,"supportsLink");var hr="imageRendering";function sd(n){if(!(hr in n))return false;let e=n[hr];return y(e)||T(e)}r(sd,"supportsImageRendering");var br="layout";function Ir(n){if(!(br in n))return false;let e=n[br];return y(e)||T(e)}r(Ir,"supportsLayout");function ld(n){return Ir(n)?n.layout==="stack":false}r(ld,"hasStackLayout");function dd(n){return Ir(n)?n.layout==="grid":false}r(dd,"hasGridLayout");var xr="isVariant";function Tr(n){if(!(xr in n))return false;let e=n[xr];return Pe(e)}r(Tr,"supportsComponentVariant");function Pn(n){return Tr(n)?n.isVariant:false}r(Pn,"isComponentVariant");function Pr(n){return !Tr(n)||!Pn(n)?false:!T(n.gesture)}r(Pr,"isComponentGestureVariant");var Cr="isBreakpoint";function Sa(n){if(!(Cr in n))return false;let e=n[Cr];return Pe(e)}r(Sa,"supportsBreakpoint");function Sr(n){return Sa(n)?n.isBreakpoint:false}r(Sr,"isBreakpoint");var R=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[f]==="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 ie(this)?Promise.resolve([]):this.#e.getChildren(this.id)}async getNodesWithType(e){return ie(this)?Promise.resolve([]):(await this.#e.invoke("getNodesWithType",this.id,e)).map(i=>I(i,this.#e))}async getNodesWithAttribute(e){return ie(this)?Promise.resolve([]):(await this.#e.invoke("getNodesWithAttribute",this.id,e)).map(i=>I(i,this.#e))}async getNodesWithAttributeSet(e){return ie(this)?Promise.resolve([]):(await this.#e.invoke("getNodesWithAttributeSet",this.id,e)).map(i=>I(i,this.#e))}async*walk(){if(yield this,!ie(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)}},O=class extends R{static{r(this,"FrameNode");}[f]="FrameNode";name;visible;locked;backgroundColor;backgroundImage;backgroundGradient;rotation;opacity;borderRadius;border;imageRendering;position;top;right;bottom;left;centerX;centerY;width;height;maxWidth;minWidth;maxHeight;minHeight;aspectRatio;zIndex;link;linkOpenInNewTab;linkSmoothScroll;linkClickTrackingId;linkRelValues;linkPreserveParams;overflow;overflowX;overflowY;layout;gap;padding;stackDirection;stackDistribution;stackAlignment;stackWrapEnabled;gridColumnCount;gridRowCount;gridAlignment;gridColumnWidthType;gridColumnWidth;gridColumnMinWidth;gridRowHeightType;gridRowHeight;gridItemFillCellWidth;gridItemFillCellHeight;gridItemHorizontalAlignment;gridItemVerticalAlignment;gridItemColumnSpan;gridItemRowSpan;isVariant;isPrimaryVariant;isBreakpoint;isPrimaryBreakpoint;inheritsFromId;gesture;constructor(e,t){super(e,t),this.name=e.name??null,this.visible=e.visible??true,this.locked=e.locked??false,this.backgroundColor=h(t,e.backgroundColor)??null,this.backgroundImage=h(t,e.backgroundImage)??null,this.rotation=e.rotation??0,this.opacity=e.opacity??1,this.borderRadius=e.borderRadius??null,this.border=h(t,e.border)??null,this.backgroundGradient=h(t,e.backgroundGradient)??null,this.imageRendering=e.imageRendering??null,this.position=e.position,this.left=e.left??null,this.right=e.right??null,this.top=e.top??null,this.bottom=e.bottom??null,this.centerX=e.centerX??null,this.centerY=e.centerY??null,this.width=e.width??null,this.height=e.height??null,this.maxWidth=e.maxWidth??null,this.minWidth=e.minWidth??null,this.maxHeight=e.maxHeight??null,this.minHeight=e.minHeight??null,this.aspectRatio=e.aspectRatio??null,this.zIndex=e.zIndex??null,this.link=e.link??null,this.linkOpenInNewTab=e.linkOpenInNewTab??null,this.linkSmoothScroll=e.linkSmoothScroll??null,this.linkClickTrackingId=e.linkClickTrackingId??null,this.linkRelValues=e.linkRelValues??null,this.linkPreserveParams=e.linkPreserveParams??null,this.overflow=e.overflow??null,this.overflowX=e.overflowX??null,this.overflowY=e.overflowY??null,this.layout=e.layout??null,this.gap=e.gap??null,this.padding=e.padding??null,this.stackDirection=e.stackDirection??null,this.stackDistribution=e.stackDistribution??null,this.stackAlignment=e.stackAlignment??null,this.stackWrapEnabled=e.stackWrapEnabled??null,this.gridColumnCount=e.gridColumnCount??null,this.gridRowCount=e.gridRowCount??null,this.gridAlignment=e.gridAlignment??null,this.gridColumnWidthType=e.gridColumnWidthType??null,this.gridColumnWidth=e.gridColumnWidth??null,this.gridColumnMinWidth=e.gridColumnMinWidth??null,this.gridRowHeightType=e.gridRowHeightType??null,this.gridRowHeight=e.gridRowHeight??null,this.gridItemFillCellWidth=e.gridItemFillCellWidth??null,this.gridItemFillCellHeight=e.gridItemFillCellHeight??null,this.gridItemHorizontalAlignment=e.gridItemHorizontalAlignment??null,this.gridItemVerticalAlignment=e.gridItemVerticalAlignment??null,this.gridItemColumnSpan=e.gridItemColumnSpan??null,this.gridItemRowSpan=e.gridItemRowSpan??null,this.inheritsFromId=e.inheritsFromId??null,this.gesture=e.gesture??null,this.isVariant=e.isVariant??false,this.isPrimaryVariant=e.isPrimaryVariant??false,this.isBreakpoint=e.isBreakpoint??false,this.isPrimaryBreakpoint=e.isPrimaryBreakpoint??false,v(this);}},re=class extends R{static{r(this,"TextNode");}[f]="TextNode";name;visible;locked;rotation;opacity;zIndex;font;inlineTextStyle;position;top;right;bottom;left;centerX;centerY;width;height;maxWidth;minWidth;maxHeight;minHeight;link;linkOpenInNewTab;linkSmoothScroll;linkClickTrackingId;linkRelValues;linkPreserveParams;gridItemFillCellWidth;gridItemFillCellHeight;gridItemHorizontalAlignment;gridItemVerticalAlignment;gridItemColumnSpan;gridItemRowSpan;overflow;overflowX;overflowY;textTruncation;#e;constructor(e,t){super(e,t),this.#e=t,this.name=e.name??null,this.visible=e.visible??true,this.locked=e.locked??false,this.rotation=e.rotation??0,this.opacity=e.opacity??1,this.zIndex=e.zIndex??null,this.font=h(t,e.font)??null,this.inlineTextStyle=h(t,e.inlineTextStyle)??null,this.position=e.position,this.left=e.left??null,this.right=e.right??null,this.top=e.top??null,this.bottom=e.bottom??null,this.centerX=e.centerX??null,this.centerY=e.centerY??null,this.width=e.width??null,this.height=e.height??null,this.maxWidth=e.maxWidth??null,this.minWidth=e.minWidth??null,this.maxHeight=e.maxHeight??null,this.minHeight=e.minHeight??null,this.link=e.link??null,this.linkOpenInNewTab=e.linkOpenInNewTab??null,this.linkSmoothScroll=e.linkSmoothScroll??null,this.linkClickTrackingId=e.linkClickTrackingId??null,this.linkRelValues=e.linkRelValues??null,this.linkPreserveParams=e.linkPreserveParams??null,this.overflow=e.overflow??null,this.overflowX=e.overflowX??null,this.overflowY=e.overflowY??null,this.textTruncation=e.textTruncation??null,this.gridItemFillCellWidth=e.gridItemFillCellWidth??null,this.gridItemFillCellHeight=e.gridItemFillCellHeight??null,this.gridItemHorizontalAlignment=e.gridItemHorizontalAlignment??null,this.gridItemVerticalAlignment=e.gridItemVerticalAlignment??null,this.gridItemColumnSpan=e.gridItemColumnSpan??null,this.gridItemRowSpan=e.gridItemRowSpan??null,v(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(me,this.id,e),await new Promise(t=>{setTimeout(t,30);});}async getHTML(){return this.#e.invoke(ge,this.id)}},qe=class extends R{static{r(this,"SVGNode");}[f]="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,v(this);}},Ye=class extends R{static{r(this,"VectorSetItemNode");}[f]="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,v(this);}async getSVG(){return this.#e.invoke("getSVGForNode",this.id)}},Xe=class extends R{static{r(this,"ComponentInstanceNode");}[f]="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=h(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=h(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,v(this);}async getRuntimeError(){return this.#e.invoke("getRuntimeErrorForCodeComponentNode",this.id)}},K=class extends R{static{r(this,"WebPageNode");}[f]="WebPageNode";#e;path;collectionId;constructor(e,t){super(e,t),this.path=e.path??null,this.collectionId=e.collectionId??null,this.#e=t,v(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=I(i,this.#e);return u(o instanceof O),u(Sr(o),"Expected node to be a FrameNode"),o}async getActiveCollectionItem(){let e=await this.#e.invoke("getActiveCollectionItemForWebPage",this.id);return e?new _e(e,this.#e):null}},oe=class extends R{static{r(this,"ComponentNode");}[f]="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,v(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 u(o instanceof O),u(Pn(o),"Node is not a component variant"),o}async addGestureVariant(e,t,i){let o=await this.#e.invoke("addGestureVariantToComponent",this.id,e,t,i);if(!o)throw new Error("Failed to add state to component");let a=I(o,this.#e);return u(a instanceof O),u(Pr(a),"Node is not a gesture variant"),a}async getVariables(){let e=await this.#e.invoke("getVariables",this.id);return h(this.#e,e)}async addVariables(e){let t=await this.#e.invoke("addVariables",this.id,W(e));return h(this.#e,t)}async removeVariables(e){await this.#e.invoke("removeVariables",this.id,e);}async setVariableOrder(e){await this.#e.invoke("setVariableOrder",this.id,e);}},Ze=class extends R{static{r(this,"VectorSetNode");}[f]="VectorSetNode";name;constructor(e,t){super(e,t),this.name=e.name??null,v(this);}},$=class extends R{static{r(this,"DesignPageNode");}[f]="DesignPageNode";name;#e;constructor(e,t){super(e,t),this.#e=t,this.name=e.name??null,v(this);}async clone(e){return this.#e.cloneDesignPage(this.id,e)}},Je=class extends R{static{r(this,"UnknownNode");}[f]="UnknownNode";constructor(e,t){super(e,t),v(this);}async clone(){throw new Error("Cannot clone an unknown node")}};function I(n,e){switch(n[f]){case "DesignPageNode":return new $(n,e);case "WebPageNode":return new K(n,e);case "ComponentNode":return new oe(n,e);case "VectorSetNode":return new Ze(n,e);case "VectorSetItemNode":return new Ye(n,e);case "ComponentInstanceNode":return new Xe(n,e);case "FrameNode":return new O(n,e);case "SVGNode":return new qe(n,e);case "TextNode":return new re(n,e);case "UnknownNode":return new Je(n,e);default:return new Je(n,e)}}r(I,"convertRawNodeDataToNode");function wt(n){return n instanceof O}r(wt,"isFrameNode");function Fr(n){return n instanceof re}r(Fr,"isTextNode");function vr(n){return n instanceof qe}r(vr,"isSVGNode");function be(n){return n instanceof Xe}r(be,"isComponentInstanceNode");function Dr(n){return n instanceof K}r(Dr,"isWebPageNode");function kr(n){return n instanceof oe}r(kr,"isComponentNode");function Nr(n){return n instanceof $}r(Nr,"isDesignPageNode");function Ar(n){return n instanceof Ze}r(Ar,"isVectorSetNode");function Er(n){return n instanceof Ye}r(Er,"isVectorSetItemNode");function ie(n){return n instanceof Je}r(ie,"isUnknownNode");function Qe(n){return !!(wt(n)||Fr(n)||be(n)||vr(n)||Er(n)||ie(n))}r(Qe,"isCanvasNode");function Sn(n){return !!(Dr(n)||Nr(n)||kr(n)||Ar(n)||ie(n))}r(Sn,"isCanvasRootNode");var et=class{static{r(this,"VectorSet");}id;name;owner;#e;constructor(e,t){this.id=e.id,this.name=e.name,this.owner=e.owner,this.#e=t;}async getItems(){return (await this.#e.invoke("getVectorSetItems",this.id)).map(t=>new Vt(t,this.#e))}},Vt=class{static{r(this,"VectorSetItem");}id;name;insertUrl;iconUrl;#e;#t;constructor(e,t){this.id=e.id,this.name=e.name,this.insertUrl=e.insertUrl,this.iconUrl=e.iconUrl,this.#e=e.moduleId,this.#t=t;}async getVariables(){return this.#t.invoke("getVectorSetItemVariables",this.id,this.#e)}};var tt=class extends Error{static{r(this,"FramerPluginError");}name=this.constructor.name},J=class extends Error{static{r(this,"FramerPluginClosedError");}name=this.constructor.name};function Fa(n){return n.type==="separator"}r(Fa,"isSeparatorMenuItem");function Lt(n,e){let t=[];for(let i of n){if(Fa(i)){t.push(i);continue}let{onAction:o,...a}=i,s=a;if(i.onAction){let d=Math.random();e.set(d,i.onAction),s.actionId=d;}i.submenu&&(s.submenu=Lt(i.submenu,e)),t.push(s);}return t}r(Lt,"addMenuItemsToOnActionCallbackMap");var Wt="type",Mr={[Wt]:"pluginReadySignal"},Da="pluginReadyResponse";var ka={methodResponse:true,subscriptionMessage:true,permissionUpdate:true,menuAction:true};function wr(n){return N(n)&&y(n[Wt])&&n[Wt]in ka}r(wr,"isVekterToPluginNonHandshakeMessage");function Vr(n){return N(n)&&n[Wt]===Da}r(Vr,"isPluginReadyResponse");var Fn=Symbol(),vn=Symbol(),Dn=Symbol(),kn=Symbol(),Nn=Symbol(),An=Symbol(),En=Symbol(),Mn=Symbol(),wn=Symbol(),Vn=Symbol(),Ln=Symbol(),Wn=Symbol(),Rn=Symbol(),Bn=Symbol(),Un=Symbol(),On=Symbol(),zn=Symbol(),Gn=Symbol(),Kn=Symbol(),$n=Symbol(),Hn=Symbol(),jn=Symbol(),_n=Symbol(),qn=Symbol(),Yn=Symbol(),Xn=Symbol(),Zn=Symbol(),Jn=Symbol(),Qn=Symbol(),ei=Symbol(),ti=Symbol(),ni=Symbol(),ii=Symbol(),ri=Symbol(),oi=Symbol(),ai=Symbol(),g={ping:ai,publish:Fn,getDeployments:vn,deploy:Dn,getChangedPaths:kn,getChangeContributors:Nn,createManagedCollection:An,rejectAllPending:En,readProjectForAgent:Mn,readComponentControlsForAgent:wn,readIconSetControlsForAgent:Vn,readIconsForAgent:Ln,readLayoutTemplateControlsForAgent:Wn,readShaderControlsForAgent:Rn,getAgentSystemPrompt:Bn,getAgentContext:Un,applyAgentChanges:On,flattenComponentInstanceForAgent:zn,getAncestorsForAgent:Gn,getGroundNodeForAgent:Kn,getNodeForAgent:$n,getNodesForAgent:Hn,getNodesOfTypesForAgent:jn,getParentNodeForAgent:_n,getScopeNodeForAgent:qn,makeExternalComponentLocalForAgent:Yn,paginateForAgent:Xn,publishForAgent:Zn,queryImagesForAgent:Jn,reviewChangesForAgent:Qn,serializeForAgent:ei,serializeNodesForAgent:ti,startAgentConversation:ni,continueAgentConversation:ii,submitAgentClarification:ri,runSupervisorAgentCommand:oi};function si(n){return typeof n=="string"&&n in g}r(si,"isFramerApiOnlyMethod");var Na=["unstable_getCodeFile","unstable_getCodeFiles","unstable_getCodeFileVersionContent","unstable_getCodeFileLint2","unstable_getCodeFileTypecheck2","unstable_getCodeFileVersions","lintCode"],Aa=["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","unstable_getDependencyVersion","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","readComponentControlsForAgent","readIconSetControlsForAgent","readIconsForAgent","readLayoutTemplateControlsForAgent","readShaderControlsForAgent","getAgentSystemPrompt","getAgentContext","ping","queryImagesForAgent","reviewChangesForAgent","getNodeForAgent","getNodesForAgent","getNodesOfTypesForAgent","getScopeNodeForAgent","getGroundNodeForAgent","getParentNodeForAgent","getAncestorsForAgent","paginateForAgent","serializeForAgent","serializeNodesForAgent",mt,ft,yt,ht,ge,"getAiServiceInfo","sendTrackingEvent",...Na];new Set(Aa);var li={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_getDependencyVersion:[],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":[me],"TextNode.getHTML":[],"ComponentNode.addVariant":["addVariantToComponent"],"ComponentNode.addGestureVariant":["addGestureVariantToComponent"],"ComponentNode.getVariables":[],"ComponentNode.addVariables":["addVariables"],"ComponentNode.removeVariables":["removeVariables"],"WebPageNode.getBreakpointSuggestions":[],"WebPageNode.addBreakpoint":["addBreakpointToWebPage"],"WebPageNode.getActiveCollectionItem":[],"ColorStyle.getPluginData":[],"ColorStyle.getPluginDataKeys":[],"ColorStyle.remove":["removeColorStyle"],"ColorStyle.setAttributes":["setColorStyleAttributes"],"ColorStyle.setPluginData":["setPluginDataForNode"],"TextStyle.getPluginData":[],"TextStyle.getPluginDataKeys":[],"TextStyle.remove":["removeTextStyle"],"TextStyle.setAttributes":["setTextStyleAttributes"],"TextStyle.setPluginData":["setPluginDataForNode"],"Variable.setAttributes":["updateVariable"],"Variable.remove":["removeVariables"],"ComponentNode.setVariableOrder":["setVariableOrder"],"EnumCase.remove":["removeEnumCase"],"EnumCase.setAttributes":["updateEnumCase"],"EnumVariable.addCase":["addEnumCase"],"EnumVariable.setCaseOrder":["setEnumCaseOrder"],createCollection:["createCollection"],createManagedCollection:["createManagedCollection"],[qt]:[],[Yt]:[],[Xt]:[],[Zt]:[],[Jt]:[],[Qt]:[],[Fn]:["publish"],[vn]:[],[Dn]:["deploy"],[kn]:[],[Nn]:[],[An]:["createManagedCollection"],[En]:[],[Mn]:[],[wn]:[],[Vn]:[],[Ln]:[],[Wn]:[],[Rn]:[],[Bn]:[],[Un]:[],[ai]:[],[On]:["applyAgentChanges"],[zn]:["flattenComponentInstanceForAgent"],[Gn]:[],[Kn]:[],[$n]:[],[Hn]:[],[jn]:[],[_n]:[],[qn]:[],[Yn]:["makeExternalComponentLocalForAgent"],[Xn]:[],[Zn]:["publishForAgent"],[Jn]:[],[Qn]:[],[ei]:[],[ti]:[],[ni]:["startAgentConversation"],[ii]:["continueAgentConversation"],[ri]:["submitAgentClarification"],[oi]:["runSupervisorAgentCommand"]},Rt=[];for(let n of Object.keys(li))li[n].length!==0&&Rt.push(n);v(Rt);function di(n){let e={};for(let t of Rt){let i=li[t];e[t]=i.every(o=>n[o]);}return e}r(di,"createPerMethodPermissionMap");function Lr(){let n={};for(let e of Rt)n[e]=true;return n}r(Lr,"createPerMethodPermissionMapForTesting");var xe=null;function Wr(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(Wr,"withDisabledCssTransitions");var nt=class{static{r(this,"PluginEngine");}methodInvocationId=0;notificationId=0;postMessage;methodResponseHandlers=new Map;mode;subscriptions=new Map;perMethodPermissionMap;permissionSubscriptions=new Set;messageTypesCheckedInIsAllowedTo=new Set;showUncheckedPermissionToasts=true;environmentInfo=null;initialState;menuItemOnActionCallbackMap=new Map;contextMenuItemOnActionCallbackMap=new Map;rejectAllPending(e){for(let[t,i]of this.methodResponseHandlers)i.reject(e),this.methodResponseHandlers.delete(t);}constructor(e){if(!e){this.postMessage=()=>{},this.mode="canvas",this.perMethodPermissionMap=Lr(),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=di(e.permissionMap),this.postMessage=(t,i)=>e.transport.send(t,i),this.mode){case "canvas":case "image":case "editImage":case "configureManagedCollection":case "syncManagedCollection":case "collection":case "localization":case "code":typeof window<"u"&&window.addEventListener("pointerdown",()=>{this.invoke("onPointerDown");}),e.theme&&this.applyPluginTheme(e.theme),this.subscribe("theme",this.applyPluginTheme),this.applyPrereleaseStyles();break;case "api":break;default:Fe(this.mode);}}async invoke(e,...t){return this.invokeTransferable(e,void 0,...t)}async invokeTransferable(e,t,...i){return new Promise((a,s)=>{let d={type:"methodInvocation",methodName:e,id:this.methodInvocationId,args:i.map(W)};this.methodInvocationId+=1,this.methodResponseHandlers.set(d.id,{resolve:a,reject:s}),this.postMessage(d,t);})}subscribe(e,t){this.postMessage({type:"subscribe",topic:e});let i=this.subscriptions.get(e)??new Set;return i.add(t),this.subscriptions.set(e,i),()=>{let o=this.subscriptions.get(e)??new Set;o.delete(t),o.size===0&&this.postMessage({type:"unsubscribe",topic:e}),this.subscriptions.set(e,o);}}onMessage=r(e=>{let t=e?.data??e;if(wr(t))switch(t.type){case "permissionUpdate":{this.perMethodPermissionMap=di(t.permissionMap);for(let i of this.permissionSubscriptions)i();break}case "methodResponse":{let i=this.methodResponseHandlers.get(t.id);if(!i){switch(this.mode){case "canvas":case "image":case "editImage":case "configureManagedCollection":case "syncManagedCollection":case "collection":case "localization":case "code":throw new Error(`No handler for response with id ${t.id}`);case "api":{if(!(t.id<this.methodInvocationId))throw new Error(`No handler for unknown response id ${t.id}`);break}default:Fe(this.mode);}break}this.methodResponseHandlers.delete(t.id),y(t.error)?i.reject(new tt(t.error)):i.resolve(t.result);break}case "subscriptionMessage":{let{topic:i,payload:o}=t,a=this.subscriptions.get(i);if(!a)throw new Error("Received a subscription message but no handler present");for(let s of a)s(o);break}case "menuAction":{let i=this.getOnActionFromCallbackMap(t.actionId,t.actionType);if(!i)throw new Error("Menu action received for an unknown menu item");i();break}default:Fe(t);}},"onMessage");getOnActionFromCallbackMap(e,t){switch(t){case "pluginMenu":return this.menuItemOnActionCallbackMap.get(e);case "contextMenu":return this.contextMenuItemOnActionCallbackMap.get(e);default:Fe(t);}}applyPluginTheme=r(e=>{Wr(()=>{document.body.setAttribute("data-framer-theme",e.mode);for(let t in e.tokens)document.body.style.setProperty(t,e.tokens[t]);});},"applyPluginTheme");applyPrereleaseStyles(){typeof window>"u"||new URLSearchParams(window.location.search).get("styles")==="prerelease"&&document.body.setAttribute("data-framer-styles","prerelease");}async cloneNode(e){let t=await this.invoke("cloneNode",e);return t?I(t,this):null}async cloneWebPage(e,t){let i=await this.invoke("cloneWebPage",e,t);u(i,"Expected to receive data for cloned web page");let o=I(i,this);return u(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);u(i,"Expected to receive data for cloned design page");let o=I(i,this);return u(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?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 u(Qe(o)),o})}notify=r((e,t)=>{let i=`notification-${this.notificationId}`;return this.notificationId+=1,this.invoke("notify",e,{notificationId:i,variant:t?.variant??"info",buttonText:t?.button?.text,durationMs:t?.durationMs}).then(o=>{o==="actionButtonClicked"&&t?.button?.onClick&&t.button.onClick(),t?.onDisappear&&t.onDisappear();}),{close:r(()=>this.invoke("closeNotification",i),"close")}},"notify");async setMenu(e){this.menuItemOnActionCallbackMap=new Map;let t=Lt(e,this.menuItemOnActionCallbackMap);await this.invoke("setMenu",t);}async showContextMenu(e,t){this.contextMenuItemOnActionCallbackMap=new Map;let i=Lt(e,this.contextMenuItemOnActionCallbackMap);await this.invoke("showContextMenu",i,t);}};function Ea(n){return n.type==="component"}r(Ea,"isCodeFileComponentExport");function Ma(n){return n.type==="override"}r(Ma,"isCodeFileOverrideExport");var ui=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 ui(t,this.#t))}async showProgressOnInstances(e){return this.#t.invoke("showProgressOnInstances",this.id,e)}async removeProgressFromInstances(){return this.#t.invoke("removeProgressFromInstances",this.id)}async lint(e){return Promise.resolve([])}async typecheck(e){return await this.#t.invoke("typecheckCode",this.name,this.content,e,this.id)}async navigateTo(){return this.#t.invoke("navigateTo",this.id)}};var Bt=class n{static{r(this,"ComponentInstancePlaceholder");}#e;#t;constructor(e,t){this.#e=e,this.#t=t;}get id(){return this.#e.id}get width(){return this.#e.width}get height(){return this.#e.height}get title(){return this.#e.title}get codePreview(){return this.#e.codePreview}async setAttributes(e){let t=await this.#t.invoke("updateComponentInstancePlaceholder",this.id,e);return t?new n(t,this.#t):null}async remove(){await this.#t.invoke("removeComponentInstancePlaceholder",this.id);}async replaceWithComponentInstance(e,t){let i=await this.#t.invoke("replaceComponentInstancePlaceholderWithComponentInstance",this.id,e,t);if(!i)return null;let o=I(i,this.#t);return u(be(o)),o}};var wa=(()=>{let n=null;return {disableUntilMouseUp:r(()=>{if(n)return;n=document.createElement("style"),n.textContent="* { pointer-events: none !important; user-select: none !important; -webkit-user-select: none !important; }",document.head.appendChild(n);let e=r(()=>{n&&(document.head.removeChild(n),n=null,o());},"enablePointerEvents"),t=r(a=>{a.buttons>0&&a.buttons&1||e();},"handlePointerChange"),i=r(()=>{e();},"handleBlur");window.addEventListener("pointerup",t,true),window.addEventListener("pointermove",t,true),window.addEventListener("blur",i);function o(){window.removeEventListener("pointerup",t,true),window.removeEventListener("pointermove",t,true),window.removeEventListener("blur",i);}r(o,"cleanup");},"disableUntilMouseUp")}})(),Rr=5,Va=(()=>{let n=1;return {next:r(()=>`drag-${n++}`,"next")}})();function La(){}r(La,"noop");function Br(n,e,t,i){if(n.mode!=="canvas")return La;let o=Va.next(),a=document.body.style.cursor,s={type:"idle"},d=document.body,m=ae.subscribeToIsAllowedTo("makeDraggable",p=>{p||P();}),C=r(p=>{ae.isAllowedTo("makeDraggable")&&s.type!=="idle"&&(s.type==="dragging"&&n.invoke("onDragEnd",{...p,dragSessionId:o}).then(b=>{try{i?.(b);}catch{}}).catch(b=>{if(b instanceof Error){i?.({status:"error",reason:b.message});return}if(typeof b=="string"){i?.({status:"error",reason:b});return}i?.({status:"error"});}),P());},"endDrag"),F=r(p=>{if(!ae.isAllowedTo("makeDraggable")||s.type==="idle")return;if(!(p.buttons>0&&!!(p.buttons&1))){C({cancelled:false});return}let{clientX:w,clientY:z}=p;if(s.type==="pointerDown"){let E=w-s.dragStart.mouse.x,ct=z-s.dragStart.mouse.y;if(Math.abs(E)<Rr&&Math.abs(ct)<Rr)return;s={type:"dragging",dragStart:s.dragStart},n.invoke("onDragStart",s.dragStart),document.getSelection()?.empty(),wa.disableUntilMouseUp();}d.setPointerCapture(p.pointerId);let ee={x:w,y:z};n.invoke("onDrag",{dragSessionId:o,mouse:ee}).then(E=>{s.type==="dragging"&&(document.body.style.cursor=E??"");});},"handlePointerChange"),D=r(p=>{p.key==="Escape"&&C({cancelled:true});},"handleKeyDown"),_=r(()=>{C({cancelled:true});},"handleBlur"),x=r(p=>{if(!ae.isAllowedTo("makeDraggable"))return;C({cancelled:true});let b=e.getBoundingClientRect(),w={x:b.x,y:b.y,width:b.width,height:b.height},z,ee=e.querySelectorAll("svg");if(ee.length===1){let ce=ee.item(0).getBoundingClientRect();z={x:ce.x,y:ce.y,width:ce.width,height:ce.height};}let E={x:p.clientX,y:p.clientY};s={type:"pointerDown",dragStart:{dragSessionId:o,elementRect:w,svgRect:z,mouse:E}},n.invoke("setDragData",o,t()),d.addEventListener("pointermove",F,true),d.addEventListener("pointerup",F,true),window.addEventListener("keydown",D,true),window.addEventListener("blur",_);},"handlePointerDown"),c=r(()=>{if(!ae.isAllowedTo("makeDraggable"))return;let p=t();p.type==="detachedComponentLayers"&&n.invoke("preloadDetachedComponentLayers",p.url),p.type==="image"&&n.invoke("preloadImageUrlForInsertion",p.image),p.previewImage&&n.invoke("preloadDragPreviewImage",p.previewImage);},"preload");e.addEventListener("pointerdown",x),e.addEventListener("mouseenter",c);function P(){s={type:"idle"},document.body.style.cursor=a,d.removeEventListener("pointermove",F,true),d.removeEventListener("pointerup",F,true),window.removeEventListener("keydown",D,true),window.removeEventListener("blur",_);}return r(P,"dragCleanup"),()=>{e.removeEventListener("pointerdown",x),e.removeEventListener("mouseenter",c),C({cancelled:true}),m();}}r(Br,"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 u(pt(i)),T(i)?null:new n(i,this.#t)}};var ci=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]=Ai(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=I(t,this.#e);return u(Qe(i)),i})}async setSelection(e){let t=y(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 u(Qe(a)),a});e(i);})}async getCanvasRoot(){let e=await this.#e.invoke("getCanvasRoot"),t=I(e,this.#e);return u(Sn(t)),t}subscribeToCanvasRoot(e){return this.#e.subscribe("canvasRoot",t=>{let i=I(t,this.#e);u(Sn(i)),e(i);})}async getPublishInfo(){return this.#e.invoke("getPublishInfo")}subscribeToPublishInfo(e){return this.#e.subscribe("publishInfo",e)}async createFrameNode(e,t){let i=await this.#e.invoke("createNode","FrameNode",t??null,e);if(!i)return null;let o=I(i,this.#e);return u(o instanceof O),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=y(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?h(this.#e,e):null}subscribeToImage(e){return this.#e.subscribe("image",t=>{if(!t){e(null);return}e(h(this.#e,t));})}async addImage(e){let t=await ze(e),i=Z(t);return this.#e.invokeTransferable("addImage",i,t)}async setImage(e){let t=await ze(e),i=Z(t);return this.#e.invokeTransferable("setImage",i,t)}async uploadImage(e){let t=await ze(e),i=Z(t),o=await this.#e.invokeTransferable("uploadImage",i,t);return h(this.#e,o)}async addImages(e){let t=await xn(e),i=t.flatMap(Z);await this.#e.invokeTransferable("addImages",i,t);}async uploadImages(e){let t=await xn(e),i=t.flatMap(Z),o=await this.#e.invokeTransferable("uploadImages",i,t);return h(this.#e,o)}async uploadFile(e){let t=await bn(e),i=await this.#e.invokeTransferable("uploadFile",Z(t),t);return h(this.#e,i)}async uploadFiles(e){let t=await Promise.all(e.map(bn)),i=t.flatMap(Z),o=await this.#e.invokeTransferable("uploadFiles",i,t);return h(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 u(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=I(o,this.#e);return u(wt(a)),a}async preloadDetachedComponentLayers(e){await this.#e.invoke("preloadDetachedComponentLayers",e);}async preloadImageUrlForInsertion(e){await this.#e.invoke("preloadImageUrlForInsertion",e);}async preloadDragPreviewImage(e){await this.#e.invoke("preloadDragPreviewImage",e);}async getText(){return this.#e.invoke("getText")}async setText(e){return this.#e.invoke("setText",e)}async addText(e,t){return this.#e.invoke("addText",e,t)}async setCustomCode(e){return this.#e.invoke("setCustomCode",e)}async getCustomCode(){return this.#e.invoke("getCustomCode")}subscribeToCustomCode(e){return this.#e.subscribe("customCode",e)}subscribeToText(e){return this.#e.subscribe("text",e)}makeDraggable(e,t,i){return Br(this.#e,e,t,i)}async getActiveManagedCollection(){let e=await this.#e.invoke("getActiveManagedCollection");return u(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 u(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 ne(t,this.#e):null}async getActiveCollection(){let e=await this.#e.invoke("getActiveCollection");return e?new ne(e,this.#e):null}async getCollections(){return (await this.#e.invoke("getCollections")).map(t=>new ne(t,this.#e))}notify=r((e,t)=>this.#e.notify(e,t),"notify");async getPluginData(e){return this.#e.invoke("getPluginData",e)}async setPluginData(e,t){return this.#e.invoke("setPluginData",e,t)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeys")}async getColorStyles(){let e=await this.#e.invoke("getColorStyles");return h(this.#e,e)}async getColorStyle(e){let t=await this.#e.invoke("getColorStyle",e);return t?h(this.#e,t):null}async createColorStyle(e){let t=await this.#e.invoke("createColorStyle",e);return h(this.#e,t)}subscribeToColorStyles(e){return this.#e.subscribe("colorStyles",t=>{let i=h(this.#e,t);return e(i)})}async getTextStyles(){let e=await this.#e.invoke("getTextStyles");return h(this.#e,e)}async getTextStyle(e){let t=await this.#e.invoke("getTextStyle",e);return t?h(this.#e,t):null}async createTextStyle(e){let t=await this.#e.invoke("createTextStyle",e);return h(this.#e,t)}subscribeToTextStyles(e){return this.#e.subscribe("textStyles",t=>{let i=h(this.#e,t);return e(i)})}async getFont(e,t){let i=await this.#e.invoke("getFont",e,t);return i?h(this.#e,i):null}async getFonts(){let e=await this.#e.invoke("getFonts");return h(this.#e,e)}getLocales(){return this.#e.invoke("getLocales")}getDefaultLocale(){return this.#e.invoke("getDefaultLocale")}getActiveLocale(){return this.#e.invoke("getActiveLocale")}async getLocalizationGroups(e){return this.#e.invoke("getLocalizationGroups",e)}setLocalizationData(e){return this.#e.invoke("setLocalizationData",e)}async getRedirects(){return (await this.#e.invoke("getRedirects")).map(t=>new Ce(t,this.#e))}subscribeToRedirects(e){return this.#e.subscribe("redirects",t=>{let i=t.map(o=>new Ce(o,this.#e));return e(i)})}async addRedirects(e){return (await this.#e.invoke("addRedirects",e)).map(i=>new Ce(i,this.#e))}async removeRedirects(e){return this.#e.invoke("removeRedirects",e)}async setRedirectOrder(e){return this.#e.invoke("setRedirectOrder",e)}async createCodeFile(e,t,i){let o=await this.#e.invoke("createCodeFile",e,t,i);return new Q(o,this.#e)}async getCodeFiles(){let e=await this.#e.invoke("getCodeFiles"),t=[];for(let i of e)t.push(new Q(i,this.#e));return t}async getCodeFile(e){let t=await this.#e.invoke("getCodeFile",e);return t?new Q(t,this.#e):null}lintCode(e,t,i){return Promise.resolve([])}typecheckCode(e,t,i,o){return this.#e.invoke("typecheckCode",e,t,i,o)}subscribeToCodeFiles(e){return this.#e.subscribe("codeFiles",t=>{let i=t?.map(o=>new Q(o,this.#e));return e(i)})}setMenu(e){return this.#e.setMenu(e)}showContextMenu(e,t){return this.#e.showContextMenu(e,t)}async unstable_ensureMinimumDependencyVersion(e,t){return this.#e.invoke("unstable_ensureMinimumDependencyVersion",e,t)}async navigateTo(e,t){return this.#e.invoke("navigateTo",e,t)}subscribeToOpenCodeFile(e){return this.#e.subscribe("openCodeFile",t=>{let i=t?new Q(t,this.#e):null;return e(i)})}async createDesignPage(e){let t=await this.#e.invoke("createDesignPage",e),i=I(t,this.#e);return u(i instanceof $,"Expected node to be a DesignPageNode"),i}async createWebPage(e){let t=await this.#e.invoke("createWebPage",e),i=I(t,this.#e);return u(i instanceof K,"Expected node to be a WebPageNode"),i}async createCollection(e){let t=await this.#e.invoke("createCollection",e);return new ne(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}},pi=class extends ci{static{r(this,"FramerPluginAPIBeta");}#e;constructor(e){super(e),this.#e=e,this.#e;}},it=class extends pi{static{r(this,"FramerPluginAPIAlpha");}#e;constructor(e){super(e),this.#e=e,this.#e;}async unstable_getDependencyVersion(e){return this.#e.invoke("unstable_getDependencyVersion",e)}async addComponentInstancePlaceholder(e){let t=await this.#e.invoke("addComponentInstancePlaceholder",e);return new Bt(t,this.#e)}async[l.getAiServiceInfo](e){return this.#e.invoke(mt,e)}async[l.sendTrackingEvent](e,t,i){return this.#e.invoke(ft,e,t,i)}async[l.getCurrentUser](){return this.#e.invoke(yt)}async[l.getProjectInfo](){return this.#e.invoke(ht)}async[l.getHTMLForNode](e){return this.#e.invoke(ge,e)}async[l.setHTMLForNode](e,t){return this.#e.invoke(me,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 u(o instanceof re),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 u(i instanceof oe),i}async getVectorSets(){return (await this.#e.invoke("getVectorSets")).map(t=>new et(t,this.#e))}async createLocale(e){return this.#e.invoke("createLocale",e)}async getLocaleLanguages(){return this.#e.invoke("getLocaleLanguages")}async getLocaleRegions(e){return this.#e.invoke("getLocaleRegions",e)}async[g.publish](){return this.#e.invoke("publish")}async[g.getDeployments](){return this.#e.invoke("getDeployments")}async[g.deploy](e,t){return this.#e.invoke("deploy",e,t)}async[g.getChangedPaths](){return this.#e.invoke("getChangedPaths")}async[g.getChangeContributors](e,t){return this.#e.invoke("getChangeContributors",e,t)}async[g.createManagedCollection](e){return this.createManagedCollection(e)}[g.rejectAllPending](e){this.#e.rejectAllPending(e);}async[g.getAgentSystemPrompt](){return this.#e.invoke("getAgentSystemPrompt")}async[g.getAgentContext](e){return this.#e.invoke("getAgentContext",e)}async[g.readProjectForAgent](e,t){return this.#e.invoke("readProjectForAgent",e,t)}async[g.readComponentControlsForAgent](e,t){return this.#e.invoke("readComponentControlsForAgent",e,t)}async[g.readIconSetControlsForAgent](e,t){return this.#e.invoke("readIconSetControlsForAgent",e,t)}async[g.readIconsForAgent](e,t){return this.#e.invoke("readIconsForAgent",e,t)}async[g.readLayoutTemplateControlsForAgent](e,t){return this.#e.invoke("readLayoutTemplateControlsForAgent",e,t)}async[g.readShaderControlsForAgent](e,t){return this.#e.invoke("readShaderControlsForAgent",e,t)}async[g.applyAgentChanges](e,t){return this.#e.invoke("applyAgentChanges",e,t)}async[g.ping](){return this.#e.invoke("ping")}async[g.publishForAgent](e){return this.#e.invoke("publishForAgent",e)}async[g.queryImagesForAgent](e){return this.#e.invoke("queryImagesForAgent",e)}async[g.reviewChangesForAgent](e){return this.#e.invoke("reviewChangesForAgent",e)}async[g.flattenComponentInstanceForAgent](e,t){return this.#e.invoke("flattenComponentInstanceForAgent",e,t)}async[g.makeExternalComponentLocalForAgent](e,t){return this.#e.invoke("makeExternalComponentLocalForAgent",e,t)}async[g.getNodeForAgent](e,t){return this.#e.invoke("getNodeForAgent",e,t)}async[g.getNodesForAgent](e,t){return this.#e.invoke("getNodesForAgent",e,t)}async[g.getNodesOfTypesForAgent](e,t){return this.#e.invoke("getNodesOfTypesForAgent",e,t)}async[g.getScopeNodeForAgent](e,t){return this.#e.invoke("getScopeNodeForAgent",e,t)}async[g.getGroundNodeForAgent](e,t){return this.#e.invoke("getGroundNodeForAgent",e,t)}async[g.getParentNodeForAgent](e,t){return this.#e.invoke("getParentNodeForAgent",e,t)}async[g.getAncestorsForAgent](e,t){return this.#e.invoke("getAncestorsForAgent",e,t)}async[g.serializeForAgent](e,t){return this.#e.invoke("serializeForAgent",e,t)}async[g.serializeNodesForAgent](e,t){return this.#e.invoke("serializeNodesForAgent",e,t)}async[g.paginateForAgent](e,t){return this.#e.invoke("paginateForAgent",e,t)}async[g.startAgentConversation](e,t){return this.#e.invoke("startAgentConversation",e,t)}async[g.continueAgentConversation](e,t){return this.#e.invoke("continueAgentConversation",e,t)}async[g.submitAgentClarification](e){return this.#e.invoke("submitAgentClarification",e)}async[g.runSupervisorAgentCommand](e){return this.#e.invoke("runSupervisorAgentCommand",e)}};var gi=class{constructor(e){this.origin=e;}origin;static{r(this,"IframeTransport");}send(e,t){window.parent.postMessage(e,this.origin,t);}onMessage(e){window.addEventListener("message",e);}};async function Wa(){return new Promise(n=>{function e({data:t,origin:i}){if(!Vr(t))return;window.removeEventListener("message",e);let a={transport:new gi(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(Mr,"*");})}r(Wa,"createBrowserContext");async function Ra(){return typeof window>"u"||"Deno"in globalThis?null:Wa()}r(Ra,"bootstrap");var Ur=await Ra(),ae=Ur?new it(new nt(Ur)):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 it(new nt(n))}r(Or,"createFramerInstance");var zr={};function Ua(n){if(env)try{Object.assign(env,n);}catch{}Object.assign(zr,n);}r(Ua,"configure");function Ie(n,e){let t=zr[n]??env[n];return t&&t.length>0?t:e}r(Ie,"getEnv");var Gr=isWorkerd,fi=globalThis.WebSocket;async function Kr(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(Kr,"connectWebSocketCF");async function $r(){try{return {fs:await import('fs'),path:await import('path')}}catch{return {}}}r($r,"getNodeModules");var se=(D=>(D.PROJECT_CLOSED="PROJECT_CLOSED",D.POOL_EXHAUSTED="POOL_EXHAUSTED",D.TIMEOUT="TIMEOUT",D.INTERNAL="INTERNAL",D.NODE_NOT_FOUND="NODE_NOT_FOUND",D.SCREENSHOT_TOO_LARGE="SCREENSHOT_TOO_LARGE",D.SCREENSHOT_PREPARE_FAILED="SCREENSHOT_PREPARE_FAILED",D.EXPORT_SVG_FAILED="EXPORT_SVG_FAILED",D.INVALID_REQUEST="INVALID_REQUEST",D.INVALID_RELEASE_CHANNEL="INVALID_RELEASE_CHANNEL",D.UNAUTHORIZED="UNAUTHORIZED",D))(se||{}),k=class extends Error{static{r(this,"FramerAPIError");}code;ref;retryable;recentMethods;constructor(e,t,i){super(e),this.name="FramerAPIError",this.code=t,i?.ref!==void 0&&(this.ref=i.ref),this.retryable=i?.retryable??false,i?.recentMethods!==void 0&&(this.recentMethods=i.recentMethods),this.stack=void 0;}toString(){let e=super.toString();return this.ref?`${e} [ref: ${this.ref}]`:e}};function Oa(n){return n instanceof k?n.code==="POOL_EXHAUSTED"||n.retryable:false}r(Oa,"isRetryableError");var za=new Map(Object.values(se).map(n=>[n,n]));function jr(n){return typeof n=="string"?za.get(n)??"INTERNAL":"INTERNAL"}r(jr,"parseErrorCode");var Ga={pluginMarshalTag:Et};var yi={silent:0,error:1,warn:2,info:3,debug:4};function Ka(){let n=Ie("FRAMER_API_LOG_LEVEL")?.toLowerCase();return n&&n in yi?n:"warn"}r(Ka,"getLogLevel");var hi=Ka();function rt(n){return yi[n]<=yi[hi]}r(rt,"shouldLog");var ot=globalThis.console,$a="\x1B[90m",Ha="\x1B[0m";function ja(n){return n?`[FramerAPI:${n}]`:"[FramerAPI]"}r(ja,"formatPrefix");function _a(n,...e){return [$a+n,...e,Ha]}r(_a,"formatDebug");function _r(n){let e=ja(n);return {warn:r((...t)=>{rt("warn")&&ot.warn(e,...t);},"warn"),error:r((...t)=>{rt("error")&&ot.error(e,...t);},"error"),log:r((...t)=>{rt("info")&&ot.log(e,...t);},"log"),info:r((...t)=>{rt("info")&&ot.info(e,...t);},"info"),debug:r((...t)=>{rt("debug")&&ot.debug(..._a(e,...t));},"debug"),setLevel:r(t=>{hi=t;},"setLevel"),getLevel:r(()=>hi,"getLevel"),withRequestId:r(t=>_r(t),"withRequestId")}}r(_r,"createLogger");var A=_r();A.warn;A.error;A.log;A.info;A.debug;A.setLevel;A.getLevel;var Ut="0.1.14-beta";var qr="wss://api.framer.com/channel/headless-plugin";function Te(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(Te,"assert");var _r=false;function qr({error:n,tags:e,extras:t,critical:i,caller:o}){let a=fi(n,o);return _r||(_r=true,console.error("Set up an error callback with setErrorReporter, or configure Sentry with initializeEnvironment")),a}r(qr,"reportError");function fi(n,e=fi){return n instanceof Error?n:new mi(n,e)}r(fi,"reportableError");var mi=class extends Error{static{r(this,"UnhandledError");}constructor(e,t){let i=e?JSON.stringify(e):"No error message provided";if(super(i),this.message=i,t&&Error.captureStackTrace)Error.captureStackTrace(this,t);else try{throw new Error}catch(o){this.stack=o.stack;}}};var at=typeof window<"u"&&!("Deno"in globalThis)?window.location.hostname:void 0,Yr=!!(at&&["web.framerlocal.com","localhost","127.0.0.1","[::1]"].includes(at)),yi=(()=>{if(!at)return;if(Yr)return {main:at,previewLink:void 0};let n=/^(([^.]+\.)?beta\.)?((?:development\.)?framer\.com)$/u,e=at.match(n);if(!(!e||!e[3]))return {previewLink:e[2]&&e[0],main:e[3]}})();({isDevelopment:yi?.main==="development.framer.com",isProduction:yi?.main==="framer.com"});var Ot;function zt(){return typeof window>"u"?{}:Ot||(Ot=_a(),Ot)}r(zt,"getServiceMap");function _a(){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(_a,"extractServiceMap");function st(n,e=0,t=new Set){if(n===null)return n;if(typeof n=="function")return `[Function: ${n.name??"unknown"}]`;if(typeof n!="object")return n;if(n instanceof Error)return `[${n.toString()}]`;if(t.has(n))return "[Circular]";if(e>2)return "...";t.add(n);try{if("toJSON"in n&&typeof n.toJSON=="function")return st(n.toJSON(),e+1,t);if(Array.isArray(n))return n.map(i=>st(i,e+1,t));if(Object.getPrototypeOf(n)!==Object.prototype)return `[Object: ${"__class"in n&&n.__class||n.constructor?.name}]`;{let i={};for(let[o,a]of Object.entries(n))i[o]=st(a,e+1,t);return i}}catch(i){return `[Throws: ${i instanceof Error?i.message:i}]`}finally{t.delete(n);}}r(st,"jsonSafeCopy");var hi=["trace","debug","info","warn","error"],qa=["\u{1F50D}","\u{1F9EA}","\u2139\uFE0F","\u26A0\uFE0F","\u274C"],Ya=[":trace",":debug",":info",":warn",":error"],Jr="logTimestamps";function Qr(n){return new Date(n).toISOString().substring(10,24)}r(Qr,"formatLogTimestamp");function eo(n,e){let t=[];for(let i of n.split(/[ ,]/u)){let o=i.trim();if(o.length===0)continue;let a=1,s=false;o.startsWith("-")&&(o=o.slice(1),a=3,s=true);for(let T=0;T<=4;T++){let v=Ya[T];if(v&&o.endsWith(v)){a=T,s&&(a+=1),o=o.slice(0,o.length-v.length),o.length===0&&(o="*");break}}let d=new RegExp("^"+ao(o).replace(/\\\*/gu,".*")+"$"),m=0;for(let T of e)T.id.match(d)&&(T.level=a,++m);m===0&&t.push(i);}return t}r(eo,"applyLogLevelSpec");var lt=class n{constructor(e,t,i){this.logger=e;this.level=t;this.parts=i;this.id=n.nextId++,this.time=Date.now();}logger;level;parts;static{r(this,"LogEntry");}static nextId=0;id;time;stringPrefix;cachedMessage;toMessage(){if(this.stringPrefix)return this.cachedMessage??this.parts;let e=[hi[this.level]+": ["+this.logger.id+"]"];Gt&&e.unshift(Qr(this.time)),this.stringPrefix=e.join(" ");let t=this.parts[0];if(typeof t=="string"){let i=ts(t,this.logger.id,this.level);this.cachedMessage=[i.length>0?`${this.stringPrefix} ${i}`:this.stringPrefix,...this.parts.slice(1)];}else this.cachedMessage=[this.stringPrefix,...this.parts];return this.cachedMessage}resetMessagePrefix(){this.stringPrefix=void 0,this.cachedMessage=void 0;}toConsoleMessage(){let e=this.toMessage().slice(),t=e[0];if(typeof t!="string")return e;let i=hi[this.level],o=qa[this.level];i&&o&&(e[0]=t.replace(`${i}:`,`${o}`));let a=`[${this.logger.id}]`,s=e[0];if(typeof s!="string")return e;let d=s.indexOf(a);return d<0||(e[0]=s.slice(0,d)+"%c"+a+"%c"+s.slice(d+a.length),e.splice(1,0,"color: #9ca3af","")),e}toString(){return this.toMessage().map(e=>{let t=typeof e;if(t==="string")return e;if(t==="function")return `[Function: ${e.name??"unknown"}]`;if(e instanceof Error)return e.stack??e.toString();let i=JSON.stringify(st(e));return i?.length>253?i.slice(0,250)+"...":i}).join(" ")}},j="*:app:info,app:info",Gt=true,to=typeof process<"u"&&!!process.kill,Xa=to&&!!process.env.CI;Xa?j="-:warn":to&&(j="");try{typeof window<"u"&&window.localStorage&&(j=window.localStorage.logLevel||j,Gt=window.localStorage[Jr]!=="false");}catch{}try{typeof process<"u"&&(j=process.env.DEBUG||j);}catch{}try{typeof window<"u"&&Object.assign(window,{setLogLevel:ro,setLogTimestamps:oo});}catch{}try{typeof window<"u"&&window.postMessage&&window.top===window&&window.addEventListener("message",n=>{if(!n.data||typeof n.data!="object")return;let{loggerId:e,level:t,parts:i,printed:o}=n.data;if(typeof e!="string"||!Array.isArray(i)||i.length<1||typeof t!="number")return;let a=dt(e);if(t<0||t>5)return;i[0]=i[0].replace("[","*[");let s=new lt(a,t,i);s.stringPrefix=i[0],H.push(s),!o&&(a.level>t||console?.log(...s.toConsoleMessage()));});}catch{}var xi;try{typeof window<"u"&&window.postMessage&&window.parent!==window&&!window.location.pathname.startsWith("/edit")&&(xi=r(n=>{try{let e=n.toMessage().map(s=>st(s)),t=n.logger,i=n.level,o=t.level<=n.level,a={loggerId:t.id,level:i,parts:e,printed:o};window.parent?.postMessage(a,zt().app);}catch{}},"postLogEntry"));}catch{}var bi={},H=[],no=1e3;function le(n,e,t){let i=new lt(n,e,t);for(H.push(i),xi?.(i);H.length>no;)H.shift();return i}r(le,"createLogEntry");function io(n){return typeof n=="number"&&(no=n),H}r(io,"getLogReplayBuffer");var Za=/\/(?<filename>[^/.]+)(?=\.(?:debug\.)?html$)/u,Zr;function Ja(){if(!(typeof window>"u"||!window.location))return Zr??=Za.exec(window.location.pathname)?.groups?.filename,Zr}r(Ja,"getFilenameFromWindowPathname");function dt(n){let e=Ja();n=(e?e+":":"")+n;let t=bi[n];if(t)return t;let i=new Kt(n);return bi[n]=i,eo(j,[i]),xi?.(new lt(i,-1,[])),i}r(dt,"getLogger");function ro(n,e=true){try{typeof window<"u"&&window.localStorage&&(window.localStorage.logLevel=n);}catch{}let t=j;j=n;let i=Object.values(bi);for(let a of i)a.level=3;let o=eo(n,i);if(o.length>0&&console?.warn("Some log level specs matched no loggers:",o),e&&H.length>0){console?.log("--- LOG REPLAY ---");for(let a of H)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(ro,"setLogLevel");function oo(n){let e=Gt;Gt=n;for(let t of H)t.resetMessagePrefix();try{typeof window<"u"&&window.localStorage&&(window.localStorage[Jr]=String(n));}catch{}return e}r(oo,"setLogTimestamps");var Qa=r(n=>{let e={...n,logs:io().slice(-50).map(t=>t.toString().slice(0,600)).join(`
9
- `)};return n.logs&&console?.warn("extras.logs is reserved for log replay buffer, use another key"),e},"enrichWithLogs"),Kt=class{constructor(e,t){this.id=e;this.errorIsCritical=t??(e==="fatal"||e.endsWith(":fatal"));}id;static{r(this,"Logger");}level=3;didLog={};errorIsCritical;extend(e){let t=this.id+":"+e;return dt(t)}getBufferedMessages(){return H.filter(e=>e.logger===this)}setLevel(e){let t=this.level;return this.level=e,t}isLoggingTraceMessages(){return this.level>=0}trace=r((...e)=>{if(this.level>0)return;let t=le(this,0,e);console?.log(...t.toConsoleMessage());},"trace");debug=r((...e)=>{let t=le(this,1,e);this.level>1||console?.log(...t.toConsoleMessage());},"debug");info=r((...e)=>{let t=le(this,2,e);this.level>2||console?.info(...t.toConsoleMessage());},"info");warn=r((...e)=>{let t=le(this,3,e);this.level>3||console?.warn(...t.toConsoleMessage());},"warn");warnOncePerMinute=r((e,...t)=>{let i=this.didLog[e];if(i&&i>Date.now())return;this.didLog[e]=Date.now()+1e3*60,t.unshift(e);let o=le(this,3,t);this.level>3||console?.warn(...o.toConsoleMessage());},"warnOncePerMinute");error=r((...e)=>{let t=le(this,4,e);this.level>4||console?.error(...t.toConsoleMessage());},"error");errorOncePerMinute=r((e,...t)=>{let i=this.didLog[e];if(i&&i>Date.now())return;this.didLog[e]=Date.now()+1e3*60,t.unshift(e);let o=le(this,4,t);this.level>4||console?.error(...o.toConsoleMessage());},"errorOncePerMinute");reportWithoutLogging=r((e,t,i,o)=>{let a=Qa(t??{}),s=qr({caller:this.reportWithoutLogging,error:e,tags:{...i,where:this.id},extras:t,critical:o??this.errorIsCritical});return [a,s]},"reportWithoutLogging");reportError=r((e,t,i,o)=>{let[a,s]=this.reportWithoutLogging(e,t,i,o);a?this.error(s,a):this.error(s);},"reportError");reportErrorWithThrottle=r((e,t,i,o,a)=>{if(!es(t))return;let s=this.didLog[t.message];s&&s>Date.now()||(this.didLog[t.message]=Date.now()+e,this.reportError(t,i,o,a));},"reportErrorWithThrottle");reportErrorOncePerMinute=r((e,t,i,o)=>this.reportErrorWithThrottle(1e3*60,e,t,i,o),"reportErrorOncePerMinute");reportErrorOnceEveryTenMinutes=r((e,t,i,o)=>this.reportErrorWithThrottle(1e3*60*10,e,t,i,o),"reportErrorOnceEveryTenMinutes");reportCriticalError=r((e,t,i)=>this.reportError(e,t,i,true),"reportCriticalError")};function es(n){return Object.prototype.hasOwnProperty.call(n,"message")}r(es,"isErrorWithMessage");function ao(n){return n.replace(/[/\-\\^$*+?.()|[\]{}]/gu,"\\$&")}r(ao,"escapeRegExp");function ts(n,e,t){let i=hi[t];if(!i)return n;let o=`${i}: [${e}]`,a=ao(o).replace("\\[","\\*?\\["),s=new RegExp(`^(?:T?\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z\\s+)?${a}\\s*`);return n.replace(s,"")}r(ts,"stripLogEntryPrefix");var uo;(_=>{function n(x,...c){return x.concat(c)}_.push=n,r(n,"push");function e(x){return x.slice(0,-1)}_.pop=e,r(e,"pop");function t(x,...c){return c.concat(x)}_.unshift=t,r(t,"unshift");function i(x,c,...P){let p=x.length;if(c<0||c>p)throw Error("index out of range: "+c);let h=x.slice();return h.splice(c,0,...P),h}_.insert=i,r(i,"insert");function o(x,c,P){let p=x.length;if(c<0||c>=p)throw Error("index out of range: "+c);let h=Array.isArray(P)?P:[P],w=x.slice();return w.splice(c,1,...h),w}_.replace=o,r(o,"replace");function a(x,c){let P=x.length;if(c<0||c>=P)throw Error("index out of range: "+c);let p=x.slice();return p.splice(c,1),p}_.remove=a,r(a,"remove");function s(x,c,P){let p=x.length;if(c<0||c>=p)throw Error("from index out of range: "+c);if(P<0||P>=p)throw Error("to index out of range: "+P);let h=x.slice();if(P===c)return h;let w=h[c];return c<P?(h.splice(P+1,0,w),h.splice(c,1)):(h.splice(c,1),h.splice(P,0,w)),h}_.move=s,r(s,"move");function d(x,c){let P=[],p=Math.min(x.length,c.length);for(let h=0;h<p;h++)P.push([x[h],c[h]]);return P}_.zip=d,r(d,"zip");function m(x,c,P){let p=x.slice(),h=p[c];return h===void 0||(p[c]=P(h)),p}_.update=m,r(m,"update");function T(x){return Array.from(new Set(x))}_.unique=T,r(T,"unique");function v(x,...c){return Array.from(new Set([...x,...c.flat()]))}_.union=v,r(v,"union");function D(x,c){return x.filter(c)}_.filter=D,r(D,"filter");})(uo||={});var ss=Object.prototype.hasOwnProperty;function ls(n,e){return ss.call(n,e)}r(ls,"hasOwnProperty");var co;(i=>{function n(o,a){for(let s of Object.keys(o))ls(a,s)||delete o[s];for(let s of Object.keys(a))o[s]===void 0&&(o[s]=a[s]);return Object.setPrototypeOf(o,Object.getPrototypeOf(a)),o}i.morphUsingTemplate=n,r(n,"morphUsingTemplate");function e(o,a){a&&Object.assign(o,a);}i.writeOnce=e,r(e,"writeOnce");function t(o,a){return Object.assign(Object.create(Object.getPrototypeOf(o)),o,a)}i.update=t,r(t,"update");})(co||={});var po;(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 m of s)d.delete(m);return d}o.remove=e,r(e,"remove");function t(...a){let s=new Set;for(let d of a)for(let m of d)s.add(m);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");})(po||={});var go;(i=>{function n(o,...a){let s=new Map;o.forEach((m,T)=>s.set(T,m));let d=false;for(let m of a)m&&(m.forEach((T,v)=>s.set(v,T)),d=true);return d?s:o}i.merge=n,r(n,"merge");function e(o,a,s){let d=new Map(o);return d.set(a,s),d}i.set=e,r(e,"set");function t(o,a){let s=new Map(o);return s.delete(a),s}i.remove=t,r(t,"remove");})(go||={});var $t=class extends Promise{static{r(this,"ResolvablePromise");}_state="initial";resolve;reject;get state(){return this._state}pending(){return this._state="pending",this}isResolved(){return this._state==="fulfilled"||this._state==="rejected"}constructor(){let e,t;super((i,o)=>{e=i,t=o;}),this.resolve=i=>{this._state="fulfilled",e(i);},this.reject=i=>{this._state="rejected",t(i);};}};$t.prototype.constructor=Promise;dt("task-queue");function mo(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}r(mo,"isObject");var ps=-1,Ht=class{static{r(this,"WebSocketTransport");}onError;closed=false;ws;messageHandlers=new Set;chunkBuffers=new Map;constructor(e){this.ws=e,this.setupListeners();}setupListeners(){this.ws.addEventListener("close",this.handleClose),this.ws.addEventListener("message",this.handleMessage);}removeListeners(){this.ws.removeEventListener("close",this.handleClose),this.ws.removeEventListener("message",this.handleMessage);}handleClose=r(()=>{this.removeListeners(),this.closed=true,this.chunkBuffers.clear(),this.onError?.(new k("Connection closed","PROJECT_CLOSED"));},"handleClose");handleMessage=r(e=>{let t=typeof e.data=="string"?e.data:String(e.data),i=this.tryParseChunkEnvelope(t);if(i){let o=this.handleChunk(i);if(!o)return;let a=new MessageEvent("message",{data:o});if(this.tryHandleDebugArchive(o))return;for(let s of this.messageHandlers)s(a);return}if(!this.tryHandleDebugArchive(t))for(let o of this.messageHandlers)o(e);},"handleMessage");tryHandleDebugArchive(e){try{let t=ue.parse(e);if(mo(t)&&t.type==="debug-archive")return Ii(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 k("Connection closed","PROJECT_CLOSED");this.ws.send(ue.stringify(e,{[Et]:t=>In(t)&&W(t)}));}handleChunk(e){let t=this.chunkBuffers.get(e.id);return t||(t=[],this.chunkBuffers.set(e.id,t)),t.push(e.data),e.seq===ps?(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(mo(i)&&i.type==="error"){let o=i.message||JSON.stringify(i),a=i.code??"INTERNAL",s=typeof i.ref=="string"?i.ref:void 0;A.error(s?`Server error: ${o} [ref: ${s}]`:`Server error: ${o}`),this.onError?.(new k(`Server error: ${o}`,a,s?{ref:s}:void 0));return}t(i);}};function Ii(n){Te(ui,"File system module is not available."),Te(ci,"Path module is not available.");let t=`debug-archive-${new Date().toISOString().replace(/[:.]/gu,"-")}.zip`,i=process.cwd(),o=ci.resolve(i,t);ui.writeFileSync(o,Buffer.from(n)),A.info(`Debug archive saved to ${o}`);}r(Ii,"handleDebugArchive");function de(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}r(de,"isObject");var gs={type:"pluginReadySignal"};function ms(n){return de(n)&&n.type==="pluginReadyResponse"}r(ms,"isPluginReadyResponse");var fo=9e4,fs=2e4;function ys(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);de(s)&&s.type==="disconnect-ack"&&(clearTimeout(i),n.removeEventListener("message",o),t());}catch{}},"handler");n.addEventListener("message",o);})}r(ys,"waitForDisconnectAck");async function hs(n,e){let t={Authorization:`Token ${e}`};if(Br)return A.debug("Using Cloudflare Workers WebSocket connection"),Ur(n,t);if(isDeno)return new di(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"),A.debug("Using standard WebSocket connection");let a=new di(n.href,{headers:t});return i&&(process.env.NODE_TLS_REJECT_UNAUTHORIZED=o),a}r(hs,"createWebSocket");async function jt(n,e,t,i){let o=new URL(i??Ie("FRAMER_HEADLESS_SERVER_URL",Hr));o.protocol=o.protocol==="https:"?"wss:":o.protocol==="http:"?"ws:":o.protocol,o.searchParams.set("projectId",n),o.searchParams.set("sdkVersion",Ut),t&&o.searchParams.set("clientId",t),A.debug(`Connecting to ${o.href}`);let a=await hs(o,e);A.debug(`WebSocket created, readyState: ${a.readyState}`);let s,d,m=A,T=false,v=setInterval(()=>{a.readyState===a.OPEN&&(a.send(ue.stringify({type:"ping"})),m.debug("Sent ping"));},fs),D=r(()=>{clearInterval(v),a.readyState!==a.CLOSED&&a.readyState!==a.CLOSING&&a.close(1e3,"Client disconnect");},"forceClose"),_=r(async()=>{clearInterval(v),!(a.readyState===a.CLOSED||a.readyState===a.CLOSING)&&(T&&(m.debug("Initiating graceful disconnect"),a.send(ue.stringify({type:"client-disconnect"})),await ys(a,15e3)),a.readyState!==a.CLOSED&&a.readyState!==a.CLOSING&&a.close(1e3,"Client disconnect"));},"cleanup"),x=await new Promise((c,P)=>{let p=setTimeout(()=>{D(),P(new k(`Connection timeout after ${fo}ms`,"TIMEOUT"));},fo),h=r(()=>{m.debug("WebSocket opened, waiting for ready");},"onOpen"),w=r(E=>{m.debug("WebSocket error:",E),clearTimeout(p),D(),P(new k("No connection to the server","INTERNAL"));},"onError"),z=r(E=>{m.debug(`WebSocket closed: code=${E.code}, reason=${E.reason||"(no reason)"}, wasClean=${E.wasClean}`),clearTimeout(p),clearInterval(v),P(new k(`Connection to the server was closed (code: ${E.code})`,"PROJECT_CLOSED"));},"onClose");function ee(E){m.debug("Received message");let ct=typeof E.data=="string"?E.data:E.data.toString(),S=ue.parse(ct);if(m.debug(`Message type: ${S.type}`),S.type==="error"){clearTimeout(p),a.removeEventListener("close",z),a.removeEventListener("error",w);let ce=Kr(S.code),Pi=de(S)&&"ref"in S&&typeof S.ref=="string"?S.ref:void 0;P(new k(S.message||"Server error",ce,Pi?{ref:Pi}:void 0)),D();}else S.type==="ready"?(de(S)&&"requestId"in S&&(s=String(S.requestId),m=A.withRequestId(s),m.debug(`Server request ID: ${s}`)),de(S)&&"sessionId"in S&&(d=String(S.sessionId),m.debug(`Server session ID: ${d}`)),de(S)&&"version"in S&&m.debug(`Server version: ${S.version}`),de(S)&&S.gracefulDisconnect===true&&(T=true),m.debug("Sending pluginReadySignal"),a.send(ue.stringify(gs))):S.type==="debug-archive"?Ii(S.data):ms(S)&&(clearTimeout(p),a.removeEventListener("message",ee),a.removeEventListener("error",w),a.removeEventListener("close",z),c(S));}r(ee,"handshakeMessageHandler"),a.addEventListener("open",h),a.addEventListener("message",ee),a.addEventListener("error",w),a.addEventListener("close",z);});return a.addEventListener("close",()=>{_();}),{ws:a,pluginReadyData:x,requestId:s,sessionId:d,clientId:t,logger:m,gracefulDisconnect:T,cleanup:_}}r(jt,"connectAndHandshake");var yo={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_getDependencyVersion: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 yo?yo[n]===true:false}r(Ti,"isAllowedMethod");var _t=class n{static{r(this,"FramerAPI");}requestId;sessionId;#e;#t;#n;#i=new Map;#r=new Map;#p=0;#a;#s;#l;#d;constructor(e){this.#t=e.pluginAPI,this.#n=e.transport,this.#e=e.cleanup,this.#a=e.projectId,this.#s=e.apiKey,this.#l=e.serverUrl,this.requestId=e.requestId,this.sessionId=e.sessionId,this.#d=e.clientId,this.#n.onMessage(t=>{this.#g(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[b.rejectAllPending](e);}#c(){return `req-${++this.#p}-${Date.now()}`}#g=r(e=>{switch(e.type){case "screenshotResult":{let t=this.#i.get(e.id);if(t){this.#i.delete(e.id);let i=Buffer.from(e.data,"base64");t.resolve({data:i,mimeType:e.mimeType});}return true}case "screenshotError":{let t=this.#i.get(e.id);if(t){this.#i.delete(e.id);let i=e.code??"INTERNAL";t.reject(new k(e.error,i,e.ref?{ref:e.ref}:void 0));}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 k(e.error,i,e.ref?{ref:e.ref}:void 0));}return true}default:return false}},"#handleServerApiResponse");static create(e){let t=new n(e);return new Proxy(t,{get(i,o){if(o in i)return Reflect.get(i,o);if(ti(o)){let s=b[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||ti(o)?true:Ti(o)?o in i.#t:false}})}async#o(){this.#u(new k("Connection closed","PROJECT_CLOSED")),await this.#e();}disconnect=r(()=>this.#o(),"disconnect");reconnect=r(async()=>{await this.#o();let e=await jt(this.#a,this.#s,this.#d,this.#l);this.#n.replaceSocket(e.ws),this.#e=e.cleanup,this.requestId=e.requestId,this.sessionId=e.sessionId;},"reconnect");screenshot=r((e,t)=>{let i=this.#c(),{format:o,quality:a,scale:s,clip:d}=t??{};return new Promise((m,T)=>{this.#i.set(i,{resolve:m,reject:T}),this.#n.send({type:"screenshot",id:i,nodeId:e,format:o,quality:a,scale:s,clip:d});})},"screenshot");exportSVG=r(e=>{let t=this.#c();return new Promise((i,o)=>{this.#r.set(t,{resolve:i,reject:o}),this.#n.send({type:"exportSVG",id:t,nodeId:e});})},"exportSVG");[Symbol.dispose]=()=>{this.#o();};[Symbol.asyncDispose]=()=>this.#o()};var bs=/^.+--([A-Za-z0-9]+)/u,ho=/^[A-Za-z0-9]{20}$/u;function bo(n){if(ho.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(bs)?.[1]??a;if(ho.test(d))return d}}return null}catch{return null}}r(bo,"parseProjectId");async function xo(n,e,t){let i=performance.now();if(!n)throw new k("FRAMER_PROJECT_URL environment variable is required","INVALID_REQUEST");let o=bo(n);if(!o)throw new k(`Invalid project URL or ID: ${n}`,"INVALID_REQUEST");let a=e??Ie("FRAMER_API_KEY");if(!a)throw new k("FRAMER_API_KEY environment variable is required","INVALID_REQUEST");let s=t?.clientId?.trim()||`framer-api/${Ut}`,d=await jt(o,a,s,t?.serverUrl);try{let m=new Ht(d.ws),T={transport:m,mode:d.pluginReadyData.mode,permissionMap:d.pluginReadyData.permissionMap,environmentInfo:d.pluginReadyData.environmentInfo,origin:null,theme:null,initialState:d.pluginReadyData.initialState},v=Wr(T),D=r(async()=>{let _=((performance.now()-i)/1e3).toFixed(2);d.logger.debug(`Connection ended after ${_}s`),await d.cleanup();},"cleanup");return _t.create({pluginAPI:v,transport:m,cleanup:D,projectId:o,apiKey:a,serverUrl:t?.serverUrl,clientId:d.clientId,requestId:d.requestId,sessionId:d.sessionId})}catch(m){throw await d.cleanup(),m}}r(xo,"connect");async function xs(n,e,t,i){let o=await xo(n,t,i);try{return await e(o)}finally{await o.disconnect();}}r(xs,"withConnection");
10
- export{Ua as $framerApiInternal,bt as BooleanField,ve as BooleanVariable,We as BorderVariable,kt as CollectionReferenceField,xt as ColorField,Ee as ColorVariable,Xe as ComponentInstanceNode,oe as ComponentNode,He as ConicGradient,St as DateField,Le as DateVariable,$ as DesignPageNode,Y as EnumCase,Dt as EnumField,Ae as EnumVariable,se as ErrorCode,Ft as FieldDivider,vt as FileField,we as FileVariable,Tt as FormattedTextField,Ne as FormattedTextVariable,O as FrameNode,k as FramerAPIError,J as FramerPluginClosedError,tt as FramerPluginError,Be as ImageField,Me as ImageVariable,Ke as LinearGradient,Pt as LinkField,Ve as LinkVariable,Nt as MultiCollectionReferenceField,Ct as NumberField,De as NumberVariable,$e as RadialGradient,qe as SVGNode,It as StringField,ke as StringVariable,re as TextNode,Ge as UnsupportedComputedValue,Ue as UnsupportedField,Re as UnsupportedVariable,et as VectorSet,Vt as VectorSetItem,Ye as VectorSetItemNode,Ze as VectorSetNode,K as WebPageNode,Wa as configure,xo as connect,ae as framer,od as hasGridLayout,rd as hasStackLayout,Cr as isBreakpoint,ka as isCodeFileComponentExport,Na as isCodeFileOverrideExport,ye as isColorStyle,xr as isComponentGestureVariant,be as isComponentInstanceNode,Sr as isComponentNode,Zo as isComponentVariable,Pn as isComponentVariant,aa as isComputedValue,Fr as isDesignPageNode,Jo as isField,ea as isFileAsset,wt as isFrameNode,na as isImageAsset,Ra as isRetryableError,Tr as isSVGNode,Ir as isTextNode,Tn as isTextStyle,Di as isVariable,Dr as isVectorSetItemNode,vr as isVectorSetNode,Pr as isWebPageNode,wl as supportsAspectRatio,Rl as supportsBackgroundColor,Bl as supportsBackgroundColorData,zl as supportsBackgroundGradient,Gl as supportsBackgroundGradientData,Ul as supportsBackgroundImage,Ol as supportsBackgroundImageData,jl as supportsBorder,Hl as supportsBorderRadius,Ia as supportsBreakpoint,Zl as supportsComponentInfo,br as supportsComponentVariant,Jl as supportsFont,Ql as supportsFontData,id as supportsImageRendering,ed as supportsInlineTextStyle,td as supportsInlineTextStyleData,hr as supportsLayout,nd as supportsLink,Wl as supportsLocked,Vl as supportsName,$l as supportsOpacity,Xl as supportsOverflow,Al as supportsPins,Nl as supportsPosition,Kl as supportsRotation,_l as supportsSVG,El as supportsSize,Ml as supportsSizeConstraints,ql as supportsTextTruncation,Ll as supportsVisible,Yl as supportsZIndex,xs as withConnection};
8
+ `));}catch{}throw t}r(Te,"assert");var Xr=false;function Zr({error:n,tags:e,extras:t,critical:i,caller:o}){let a=xi(n,o);return Xr||(Xr=true,console.error("Set up an error callback with setErrorReporter, or configure Sentry with initializeEnvironment")),a}r(Zr,"reportError");function xi(n,e=xi){return n instanceof Error?n:new bi(n,e)}r(xi,"reportableError");var bi=class extends Error{static{r(this,"UnhandledError");}constructor(e,t){let i=e?JSON.stringify(e):"No error message provided";if(super(i),this.message=i,t&&Error.captureStackTrace)Error.captureStackTrace(this,t);else try{throw new Error}catch(o){this.stack=o.stack;}}};var at=typeof window<"u"&&!("Deno"in globalThis)?window.location.hostname:void 0,Jr=!!(at&&["web.framerlocal.com","localhost","127.0.0.1","[::1]"].includes(at)),Ci=(()=>{if(!at)return;if(Jr)return {main:at,previewLink:void 0};let n=/^(([^.]+\.)?beta\.)?((?:development\.)?framer\.com)$/u,e=at.match(n);if(!(!e||!e[3]))return {previewLink:e[2]&&e[0],main:e[3]}})();({isDevelopment:Ci?.main==="development.framer.com",isProduction:Ci?.main==="framer.com"});var Ot;function zt(){return typeof window>"u"?{}:Ot||(Ot=Xa(),Ot)}r(zt,"getServiceMap");function Xa(){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(Xa,"extractServiceMap");function st(n,e=0,t=new Set){if(n===null)return n;if(typeof n=="function")return `[Function: ${n.name??"unknown"}]`;if(typeof n!="object")return n;if(n instanceof Error)return `[${n.toString()}]`;if(t.has(n))return "[Circular]";if(e>2)return "...";t.add(n);try{if("toJSON"in n&&typeof n.toJSON=="function")return st(n.toJSON(),e+1,t);if(Array.isArray(n))return n.map(i=>st(i,e+1,t));if(Object.getPrototypeOf(n)!==Object.prototype)return `[Object: ${"__class"in n&&n.__class||n.constructor?.name}]`;{let i={};for(let[o,a]of Object.entries(n))i[o]=st(a,e+1,t);return i}}catch(i){return `[Throws: ${i instanceof Error?i.message:i}]`}finally{t.delete(n);}}r(st,"jsonSafeCopy");var Ii=["trace","debug","info","warn","error"],Za=["\u{1F50D}","\u{1F9EA}","\u2139\uFE0F","\u26A0\uFE0F","\u274C"],Ja=[":trace",":debug",":info",":warn",":error"],to="logTimestamps";function no(n){return new Date(n).toISOString().substring(10,24)}r(no,"formatLogTimestamp");function io(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 C=0;C<=4;C++){let F=Ja[C];if(F&&o.endsWith(F)){a=C,s&&(a+=1),o=o.slice(0,o.length-F.length),o.length===0&&(o="*");break}}let d=new RegExp("^"+uo(o).replace(/\\\*/gu,".*")+"$"),m=0;for(let C of e)C.id.match(d)&&(C.level=a,++m);m===0&&t.push(i);}return t}r(io,"applyLogLevelSpec");var lt=class n{constructor(e,t,i){this.logger=e;this.level=t;this.parts=i;this.id=n.nextId++,this.time=Date.now();}logger;level;parts;static{r(this,"LogEntry");}static nextId=0;id;time;stringPrefix;cachedMessage;toMessage(){if(this.stringPrefix)return this.cachedMessage??this.parts;let e=[Ii[this.level]+": ["+this.logger.id+"]"];Gt&&e.unshift(no(this.time)),this.stringPrefix=e.join(" ");let t=this.parts[0];if(typeof t=="string"){let i=rs(t,this.logger.id,this.level);this.cachedMessage=[i.length>0?`${this.stringPrefix} ${i}`:this.stringPrefix,...this.parts.slice(1)];}else this.cachedMessage=[this.stringPrefix,...this.parts];return this.cachedMessage}resetMessagePrefix(){this.stringPrefix=void 0,this.cachedMessage=void 0;}toConsoleMessage(){let e=this.toMessage().slice(),t=e[0];if(typeof t!="string")return e;let i=Ii[this.level],o=Za[this.level];i&&o&&(e[0]=t.replace(`${i}:`,`${o}`));let a=`[${this.logger.id}]`,s=e[0];if(typeof s!="string")return e;let d=s.indexOf(a);return d<0||(e[0]=s.slice(0,d)+"%c"+a+"%c"+s.slice(d+a.length),e.splice(1,0,"color: #9ca3af","")),e}toString(){return this.toMessage().map(e=>{let t=typeof e;if(t==="string")return e;if(t==="function")return `[Function: ${e.name??"unknown"}]`;if(e instanceof Error)return e.stack??e.toString();let i=JSON.stringify(st(e));return i?.length>253?i.slice(0,250)+"...":i}).join(" ")}},j="*:app:info,app:info",Gt=true,ro=typeof process<"u"&&!!process.kill,Qa=ro&&!!process.env.CI;Qa?j="-:warn":ro&&(j="");try{typeof window<"u"&&window.localStorage&&(j=window.localStorage.logLevel||j,Gt=window.localStorage[to]!=="false");}catch{}try{typeof process<"u"&&(j=process.env.DEBUG||j);}catch{}try{typeof window<"u"&&Object.assign(window,{setLogLevel:so,setLogTimestamps:lo});}catch{}try{typeof window<"u"&&window.postMessage&&window.top===window&&window.addEventListener("message",n=>{if(!n.data||typeof n.data!="object")return;let{loggerId:e,level:t,parts:i,printed:o}=n.data;if(typeof e!="string"||!Array.isArray(i)||i.length<1||typeof t!="number")return;let a=dt(e);if(t<0||t>5)return;i[0]=i[0].replace("[","*[");let s=new lt(a,t,i);s.stringPrefix=i[0],H.push(s),!o&&(a.level>t||console?.log(...s.toConsoleMessage()));});}catch{}var Pi;try{typeof window<"u"&&window.postMessage&&window.parent!==window&&!window.location.pathname.startsWith("/edit")&&(Pi=r(n=>{try{let e=n.toMessage().map(s=>st(s)),t=n.logger,i=n.level,o=t.level<=n.level,a={loggerId:t.id,level:i,parts:e,printed:o};window.parent?.postMessage(a,zt().app);}catch{}},"postLogEntry"));}catch{}var Ti={},H=[],oo=1e3;function le(n,e,t){let i=new lt(n,e,t);for(H.push(i),Pi?.(i);H.length>oo;)H.shift();return i}r(le,"createLogEntry");function ao(n){return typeof n=="number"&&(oo=n),H}r(ao,"getLogReplayBuffer");var es=/\/(?<filename>[^/.]+)(?=\.(?:debug\.)?html$)/u,eo;function ts(){if(!(typeof window>"u"||!window.location))return eo??=es.exec(window.location.pathname)?.groups?.filename,eo}r(ts,"getFilenameFromWindowPathname");function dt(n){let e=ts();n=(e?e+":":"")+n;let t=Ti[n];if(t)return t;let i=new Kt(n);return Ti[n]=i,io(j,[i]),Pi?.(new lt(i,-1,[])),i}r(dt,"getLogger");function so(n,e=true){try{typeof window<"u"&&window.localStorage&&(window.localStorage.logLevel=n);}catch{}let t=j;j=n;let i=Object.values(Ti);for(let a of i)a.level=3;let o=io(n,i);if(o.length>0&&console?.warn("Some log level specs matched no loggers:",o),e&&H.length>0){console?.log("--- LOG REPLAY ---");for(let a of H)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(so,"setLogLevel");function lo(n){let e=Gt;Gt=n;for(let t of H)t.resetMessagePrefix();try{typeof window<"u"&&window.localStorage&&(window.localStorage[to]=String(n));}catch{}return e}r(lo,"setLogTimestamps");var ns=r(n=>{let e={...n,logs:ao().slice(-50).map(t=>t.toString().slice(0,600)).join(`
9
+ `)};return n.logs&&console?.warn("extras.logs is reserved for log replay buffer, use another key"),e},"enrichWithLogs"),Kt=class{constructor(e,t){this.id=e;this.errorIsCritical=t??(e==="fatal"||e.endsWith(":fatal"));}id;static{r(this,"Logger");}level=3;didLog={};errorIsCritical;extend(e){let t=this.id+":"+e;return dt(t)}getBufferedMessages(){return H.filter(e=>e.logger===this)}setLevel(e){let t=this.level;return this.level=e,t}isLoggingTraceMessages(){return this.level>=0}trace=r((...e)=>{if(this.level>0)return;let t=le(this,0,e);console?.log(...t.toConsoleMessage());},"trace");debug=r((...e)=>{let t=le(this,1,e);this.level>1||console?.log(...t.toConsoleMessage());},"debug");info=r((...e)=>{let t=le(this,2,e);this.level>2||console?.info(...t.toConsoleMessage());},"info");warn=r((...e)=>{let t=le(this,3,e);this.level>3||console?.warn(...t.toConsoleMessage());},"warn");warnOncePerMinute=r((e,...t)=>{let i=this.didLog[e];if(i&&i>Date.now())return;this.didLog[e]=Date.now()+1e3*60,t.unshift(e);let o=le(this,3,t);this.level>3||console?.warn(...o.toConsoleMessage());},"warnOncePerMinute");error=r((...e)=>{let t=le(this,4,e);this.level>4||console?.error(...t.toConsoleMessage());},"error");errorOncePerMinute=r((e,...t)=>{let i=this.didLog[e];if(i&&i>Date.now())return;this.didLog[e]=Date.now()+1e3*60,t.unshift(e);let o=le(this,4,t);this.level>4||console?.error(...o.toConsoleMessage());},"errorOncePerMinute");reportWithoutLogging=r((e,t,i,o)=>{let a=ns(t??{}),s=Zr({caller:this.reportWithoutLogging,error:e,tags:{...i,where:this.id},extras:t,critical:o??this.errorIsCritical});return [a,s]},"reportWithoutLogging");reportError=r((e,t,i,o)=>{let[a,s]=this.reportWithoutLogging(e,t,i,o);a?this.error(s,a):this.error(s);},"reportError");reportErrorWithThrottle=r((e,t,i,o,a)=>{if(!is(t))return;let s=this.didLog[t.message];s&&s>Date.now()||(this.didLog[t.message]=Date.now()+e,this.reportError(t,i,o,a));},"reportErrorWithThrottle");reportErrorOncePerMinute=r((e,t,i,o)=>this.reportErrorWithThrottle(1e3*60,e,t,i,o),"reportErrorOncePerMinute");reportErrorOnceEveryTenMinutes=r((e,t,i,o)=>this.reportErrorWithThrottle(1e3*60*10,e,t,i,o),"reportErrorOnceEveryTenMinutes");reportCriticalError=r((e,t,i)=>this.reportError(e,t,i,true),"reportCriticalError")};function is(n){return Object.prototype.hasOwnProperty.call(n,"message")}r(is,"isErrorWithMessage");function uo(n){return n.replace(/[/\-\\^$*+?.()|[\]{}]/gu,"\\$&")}r(uo,"escapeRegExp");function rs(n,e,t){let i=Ii[t];if(!i)return n;let o=`${i}: [${e}]`,a=uo(o).replace("\\[","\\*?\\["),s=new RegExp(`^(?:T?\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z\\s+)?${a}\\s*`);return n.replace(s,"")}r(rs,"stripLogEntryPrefix");var go;(_=>{function n(x,...c){return x.concat(c)}_.push=n,r(n,"push");function e(x){return x.slice(0,-1)}_.pop=e,r(e,"pop");function t(x,...c){return c.concat(x)}_.unshift=t,r(t,"unshift");function i(x,c,...P){let p=x.length;if(c<0||c>p)throw Error("index out of range: "+c);let b=x.slice();return b.splice(c,0,...P),b}_.insert=i,r(i,"insert");function o(x,c,P){let p=x.length;if(c<0||c>=p)throw Error("index out of range: "+c);let b=Array.isArray(P)?P:[P],w=x.slice();return w.splice(c,1,...b),w}_.replace=o,r(o,"replace");function a(x,c){let P=x.length;if(c<0||c>=P)throw Error("index out of range: "+c);let p=x.slice();return p.splice(c,1),p}_.remove=a,r(a,"remove");function s(x,c,P){let p=x.length;if(c<0||c>=p)throw Error("from index out of range: "+c);if(P<0||P>=p)throw Error("to index out of range: "+P);let b=x.slice();if(P===c)return b;let w=b[c];return c<P?(b.splice(P+1,0,w),b.splice(c,1)):(b.splice(c,1),b.splice(P,0,w)),b}_.move=s,r(s,"move");function d(x,c){let P=[],p=Math.min(x.length,c.length);for(let b=0;b<p;b++)P.push([x[b],c[b]]);return P}_.zip=d,r(d,"zip");function m(x,c,P){let p=x.slice(),b=p[c];return b===void 0||(p[c]=P(b)),p}_.update=m,r(m,"update");function C(x){return Array.from(new Set(x))}_.unique=C,r(C,"unique");function F(x,...c){return Array.from(new Set([...x,...c.flat()]))}_.union=F,r(F,"union");function D(x,c){return x.filter(c)}_.filter=D,r(D,"filter");})(go||={});var us=Object.prototype.hasOwnProperty;function cs(n,e){return us.call(n,e)}r(cs,"hasOwnProperty");var mo;(i=>{function n(o,a){for(let s of Object.keys(o))cs(a,s)||delete o[s];for(let s of Object.keys(a))o[s]===void 0&&(o[s]=a[s]);return Object.setPrototypeOf(o,Object.getPrototypeOf(a)),o}i.morphUsingTemplate=n,r(n,"morphUsingTemplate");function e(o,a){a&&Object.assign(o,a);}i.writeOnce=e,r(e,"writeOnce");function t(o,a){return Object.assign(Object.create(Object.getPrototypeOf(o)),o,a)}i.update=t,r(t,"update");})(mo||={});var fo;(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 m of s)d.delete(m);return d}o.remove=e,r(e,"remove");function t(...a){let s=new Set;for(let d of a)for(let m of d)s.add(m);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");})(fo||={});var yo;(i=>{function n(o,...a){let s=new Map;o.forEach((m,C)=>s.set(C,m));let d=false;for(let m of a)m&&(m.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");})(yo||={});var $t=class extends Promise{static{r(this,"ResolvablePromise");}_state="initial";resolve;reject;get state(){return this._state}pending(){return this._state="pending",this}isResolved(){return this._state==="fulfilled"||this._state==="rejected"}constructor(){let e,t;super((i,o)=>{e=i,t=o;}),this.resolve=i=>{this._state="fulfilled",e(i);},this.reject=i=>{this._state="rejected",t(i);};}};$t.prototype.constructor=Promise;dt("task-queue");function ho(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}r(ho,"isObject");var fs=-1,ys=1e3,Ht=class{static{r(this,"WebSocketTransport");}onError;closed=false;ws;messageHandlers=new Set;chunkBuffers=new Map;#e;constructor(e){this.ws=e,this.setupListeners();}setupListeners(){this.ws.addEventListener("close",this.handleClose),this.ws.addEventListener("message",this.handleMessage);}removeListeners(){this.ws.removeEventListener("close",this.handleClose),this.ws.removeEventListener("message",this.handleMessage);}handleClose=r(e=>{this.removeListeners(),this.closed=true,this.chunkBuffers.clear();let t=this.#e;if(t&&Date.now()-t.at<=ys){this.onError?.(t.error);return}let i=e?.code,o=i!==void 0?`Connection closed (code: ${i})`:"Connection closed";this.onError?.(new k(o,"PROJECT_CLOSED",{retryable:true}));},"handleClose");handleMessage=r(e=>{let t=typeof e.data=="string"?e.data:String(e.data),i=this.tryParseChunkEnvelope(t);if(i){let o=this.handleChunk(i);if(!o)return;let a=new MessageEvent("message",{data:o});if(this.tryHandleDebugArchive(o))return;for(let s of this.messageHandlers)s(a);return}if(!this.tryHandleDebugArchive(t))for(let o of this.messageHandlers)o(e);},"handleMessage");tryHandleDebugArchive(e){try{let t=ue.parse(e);if(ho(t)&&t.type==="debug-archive")return t.data instanceof Uint8Array?(Fi(t.data),!0):!1}catch{}return false}replaceSocket(e){this.removeListeners(),this.chunkBuffers.clear(),this.#e=void 0,this.ws=e,this.closed=false,this.setupListeners();}setOnError(e){this.onError=e;}send(e){if(this.closed)throw new k("Connection closed","PROJECT_CLOSED");this.ws.send(ue.stringify(e,{[Et]:t=>In(t)&&W(t)}));}handleChunk(e){let t=this.chunkBuffers.get(e.id);return t||(t=[],this.chunkBuffers.set(e.id,t)),t.push(e.data),e.seq===fs?(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(ho(i)&&i.type==="error"){let o=i.message||JSON.stringify(i),a=i.code??"INTERNAL",s=typeof i.ref=="string"?i.ref:void 0,d=i.retryable===true,m=Array.isArray(i.recentMethods)?i.recentMethods.filter(F=>typeof F=="string"):void 0;A.error(s?`Server error: ${o} [ref: ${s}]`:`Server error: ${o}`);let C=new k(`Server error: ${o}`,a,{ref:s,retryable:d,recentMethods:m});this.#e={error:C,at:Date.now()},this.onError?.(C);return}t(i);}};async function Fi(n){let{fs:e,path:t}=await $r();Te(e,"File system module is not available."),Te(t,"Path module is not available.");let o=`debug-archive-${new Date().toISOString().replace(/[:.]/gu,"-")}.zip`,a=process.cwd(),s=t.resolve(a,o);e.writeFileSync(s,Buffer.from(n)),A.info(`Debug archive saved to ${s}`);}r(Fi,"handleDebugArchive");function de(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}r(de,"isObject");var hs={type:"pluginReadySignal"};function bs(n){return de(n)&&n.type==="pluginReadyResponse"}r(bs,"isPluginReadyResponse");var bo=9e4,xs=2e4;function Cs(n,e){return new Promise(t=>{let i=setTimeout(()=>{n.removeEventListener("message",o),t();},e),o=r(a=>{if(!(typeof a.data!="string"&&!(a.data instanceof String)))try{let s=ue.parse(a.data);de(s)&&s.type==="disconnect-ack"&&(clearTimeout(i),n.removeEventListener("message",o),t());}catch{}},"handler");n.addEventListener("message",o);})}r(Cs,"waitForDisconnectAck");async function Is(n,e){let t={Authorization:`Token ${e}`};if(Gr)return A.debug("Using Cloudflare Workers WebSocket connection"),Kr(n,t);if(isDeno)return new fi(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"),A.debug("Using standard WebSocket connection");let a=new fi(n.href,{headers:t});return i&&(process.env.NODE_TLS_REJECT_UNAUTHORIZED=o),a}r(Is,"createWebSocket");async function jt(n,e,t,i){let o=new URL(i??Ie("FRAMER_HEADLESS_SERVER_URL",qr));o.protocol=o.protocol==="https:"?"wss:":o.protocol==="http:"?"ws:":o.protocol,o.searchParams.set("projectId",n),o.searchParams.set("sdkVersion",Ut),t&&o.searchParams.set("clientId",t),A.debug(`Connecting to ${o.href}`);let a=await Is(o,e);A.debug(`WebSocket created, readyState: ${a.readyState}`);let s,d,m=A,C=false,F=setInterval(()=>{a.readyState===a.OPEN&&(a.send(ue.stringify({type:"ping"})),m.debug("Sent ping"));},xs),D=r(()=>{clearInterval(F),a.readyState!==a.CLOSED&&a.readyState!==a.CLOSING&&a.close(1e3,"Client disconnect");},"forceClose"),_=r(async()=>{clearInterval(F),!(a.readyState===a.CLOSED||a.readyState===a.CLOSING)&&(C&&(m.debug("Initiating graceful disconnect"),a.send(ue.stringify({type:"client-disconnect"})),await Cs(a,15e3)),a.readyState!==a.CLOSED&&a.readyState!==a.CLOSING&&a.close(1e3,"Client disconnect"));},"cleanup"),x=await new Promise((c,P)=>{let p=setTimeout(()=>{D(),P(new k(`Connection timeout after ${bo}ms`,"TIMEOUT"));},bo),b=r(()=>{m.debug("WebSocket opened, waiting for ready");},"onOpen"),w=r(E=>{m.debug("WebSocket error:",E),clearTimeout(p),D(),P(new k("No connection to the server","INTERNAL"));},"onError"),z=r(E=>{m.debug(`WebSocket closed: code=${E.code}, reason=${E.reason||"(no reason)"}, wasClean=${E.wasClean}`),clearTimeout(p),clearInterval(F),P(new k(`Connection to the server was closed (code: ${E.code})`,"PROJECT_CLOSED"));},"onClose");function ee(E){m.debug("Received message");let ct=typeof E.data=="string"?E.data:E.data.toString(),S=ue.parse(ct);if(m.debug(`Message type: ${S.type}`),S.type==="error"){clearTimeout(p),a.removeEventListener("close",z),a.removeEventListener("error",w);let ce=jr(S.code),Di=de(S)&&"ref"in S&&typeof S.ref=="string"?S.ref:void 0;P(new k(S.message||"Server error",ce,Di?{ref:Di}:void 0)),D();}else S.type==="ready"?(de(S)&&"requestId"in S&&(s=String(S.requestId),m=A.withRequestId(s),m.debug(`Server request ID: ${s}`)),de(S)&&"sessionId"in S&&(d=String(S.sessionId),m.debug(`Server session ID: ${d}`)),de(S)&&"version"in S&&m.debug(`Server version: ${S.version}`),de(S)&&S.gracefulDisconnect===true&&(C=true),m.debug("Sending pluginReadySignal"),a.send(ue.stringify(hs))):S.type==="debug-archive"?S.data instanceof Uint8Array&&Fi(S.data):bs(S)&&(clearTimeout(p),a.removeEventListener("message",ee),a.removeEventListener("error",w),a.removeEventListener("close",z),c(S));}r(ee,"handshakeMessageHandler"),a.addEventListener("open",b),a.addEventListener("message",ee),a.addEventListener("error",w),a.addEventListener("close",z);});return a.addEventListener("close",()=>{_();}),{ws:a,pluginReadyData:x,requestId:s,sessionId:d,clientId:t,logger:m,gracefulDisconnect:C,cleanup:_}}r(jt,"connectAndHandshake");var xo={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_getDependencyVersion: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 vi(n){return n in xo?xo[n]===true:false}r(vi,"isAllowedMethod");var _t=class n{static{r(this,"FramerAPI");}requestId;sessionId;#e;#t;#n;#i=new Map;#r=new Map;#p=0;#a;#s;#l;#d;constructor(e){this.#t=e.pluginAPI,this.#n=e.transport,this.#e=e.cleanup,this.#a=e.projectId,this.#s=e.apiKey,this.#l=e.serverUrl,this.requestId=e.requestId,this.sessionId=e.sessionId,this.#d=e.clientId,this.#n.onMessage(t=>{this.#g(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[g.rejectAllPending](e);}#c(){return `req-${++this.#p}-${Date.now()}`}#g=r(e=>{switch(e.type){case "screenshotResult":{let t=this.#i.get(e.id);if(t){this.#i.delete(e.id);let i=Buffer.from(e.data,"base64");t.resolve({data:i,mimeType:e.mimeType});}return true}case "screenshotError":{let t=this.#i.get(e.id);if(t){this.#i.delete(e.id);let i=e.code??"INTERNAL";t.reject(new k(e.error,i,e.ref?{ref:e.ref}:void 0));}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 k(e.error,i,e.ref?{ref:e.ref}:void 0));}return true}default:return false}},"#handleServerApiResponse");static create(e){let t=new n(e);return new Proxy(t,{get(i,o){if(o in i)return Reflect.get(i,o);if(si(o)){let s=g[o],d=Reflect.get(i.#t,s);return typeof d=="function"?d.bind(i.#t):d}if(!vi(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||si(o)?true:vi(o)?o in i.#t:false}})}async#o(){this.#u(new k("Connection closed","PROJECT_CLOSED")),await this.#e();}disconnect=r(()=>this.#o(),"disconnect");reconnect=r(async()=>{await this.#o();let e=await jt(this.#a,this.#s,this.#d,this.#l);this.#n.replaceSocket(e.ws),this.#e=e.cleanup,this.requestId=e.requestId,this.sessionId=e.sessionId;},"reconnect");screenshot=r((e,t)=>{let i=this.#c(),{format:o,quality:a,scale:s,clip:d}=t??{};return new Promise((m,C)=>{this.#i.set(i,{resolve:m,reject:C}),this.#n.send({type:"screenshot",id:i,nodeId:e,format:o,quality:a,scale:s,clip:d});})},"screenshot");exportSVG=r(e=>{let t=this.#c();return new Promise((i,o)=>{this.#r.set(t,{resolve:i,reject:o}),this.#n.send({type:"exportSVG",id:t,nodeId:e});})},"exportSVG");[Symbol.dispose]=()=>{this.#o();};[Symbol.asyncDispose]=()=>this.#o()};var Ts=/^.+--([A-Za-z0-9]+)/u,Co=/^[A-Za-z0-9]{20}$/u;function Io(n){if(Co.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(Ts)?.[1]??a;if(Co.test(d))return d}}return null}catch{return null}}r(Io,"parseProjectId");async function To(n,e,t){let i=performance.now();if(!n)throw new k("FRAMER_PROJECT_URL environment variable is required","INVALID_REQUEST");let o=Io(n);if(!o)throw new k(`Invalid project URL or ID: ${n}`,"INVALID_REQUEST");let a=e??Ie("FRAMER_API_KEY");if(!a)throw new k("FRAMER_API_KEY environment variable is required","INVALID_REQUEST");let s=t?.clientId?.trim()||`framer-api/${Ut}`,d=await jt(o,a,s,t?.serverUrl);try{let m=new Ht(d.ws),C={transport:m,mode:d.pluginReadyData.mode,permissionMap:d.pluginReadyData.permissionMap,environmentInfo:d.pluginReadyData.environmentInfo,origin:null,theme:null,initialState:d.pluginReadyData.initialState},F=Or(C),D=r(async()=>{let _=((performance.now()-i)/1e3).toFixed(2);d.logger.debug(`Connection ended after ${_}s`),await d.cleanup();},"cleanup");return _t.create({pluginAPI:F,transport:m,cleanup:D,projectId:o,apiKey:a,serverUrl:t?.serverUrl,clientId:d.clientId,requestId:d.requestId,sessionId:d.sessionId})}catch(m){throw await d.cleanup(),m}}r(To,"connect");async function Ps(n,e,t,i){let o=await To(n,t,i);try{return await e(o)}finally{await o.disconnect();}}r(Ps,"withConnection");
10
+ export{Ga as $framerApiInternal,bt as BooleanField,ve as BooleanVariable,We as BorderVariable,kt as CollectionReferenceField,xt as ColorField,Ee as ColorVariable,Xe as ComponentInstanceNode,oe as ComponentNode,He as ConicGradient,St as DateField,Le as DateVariable,$ as DesignPageNode,Y as EnumCase,Dt as EnumField,Ae as EnumVariable,se as ErrorCode,Ft as FieldDivider,vt as FileField,we as FileVariable,Tt as FormattedTextField,Ne as FormattedTextVariable,O as FrameNode,k as FramerAPIError,J as FramerPluginClosedError,tt as FramerPluginError,Be as ImageField,Me as ImageVariable,Ke as LinearGradient,Pt as LinkField,Ve as LinkVariable,Nt as MultiCollectionReferenceField,Ct as NumberField,De as NumberVariable,$e as RadialGradient,qe as SVGNode,It as StringField,ke as StringVariable,re as TextNode,Ge as UnsupportedComputedValue,Ue as UnsupportedField,Re as UnsupportedVariable,et as VectorSet,Vt as VectorSetItem,Ye as VectorSetItemNode,Ze as VectorSetNode,K as WebPageNode,Ua as configure,To as connect,ae as framer,dd as hasGridLayout,ld as hasStackLayout,Sr as isBreakpoint,Ea as isCodeFileComponentExport,Ma as isCodeFileOverrideExport,ye as isColorStyle,Pr as isComponentGestureVariant,be as isComponentInstanceNode,kr as isComponentNode,ea as isComponentVariable,Pn as isComponentVariant,da as isComputedValue,Nr as isDesignPageNode,ta as isField,ia as isFileAsset,wt as isFrameNode,oa as isImageAsset,Oa as isRetryableError,vr as isSVGNode,Fr as isTextNode,Tn as isTextStyle,Ei as isVariable,Er as isVectorSetItemNode,Ar as isVectorSetNode,Dr as isWebPageNode,Rl as supportsAspectRatio,zl as supportsBackgroundColor,Gl as supportsBackgroundColorData,Hl as supportsBackgroundGradient,jl as supportsBackgroundGradientData,Kl as supportsBackgroundImage,$l as supportsBackgroundImageData,Xl as supportsBorder,Yl as supportsBorderRadius,Sa as supportsBreakpoint,td as supportsComponentInfo,Tr as supportsComponentVariant,nd as supportsFont,id as supportsFontData,sd as supportsImageRendering,rd as supportsInlineTextStyle,od as supportsInlineTextStyleData,Ir as supportsLayout,ad as supportsLink,Ol as supportsLocked,Bl as supportsName,ql as supportsOpacity,ed as supportsOverflow,Vl as supportsPins,wl as supportsPosition,_l as supportsRotation,Zl as supportsSVG,Ll as supportsSize,Wl as supportsSizeConstraints,Jl as supportsTextTruncation,Ul as supportsVisible,Ql as supportsZIndex,Ps as withConnection};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "framer-api",
3
- "version": "0.1.12",
3
+ "version": "0.1.14-beta",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "types": "dist/index.d.ts",