New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

framer-plugin

Package Overview
Dependencies
Maintainers
0
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

framer-plugin - npm Package Compare versions

Comparing version 2.2.0 to 3.0.0-beta.0

4

dist/index.js

@@ -1,4 +0,4 @@

import G from"react";import{useCallback as Kt,useEffect as Ht,useRef as jt}from"react";var xt="invoke";function h(t){return xt in t}function m(t){return t===null}function A(t){return t===!0||t===!1}function a(t){return typeof t=="string"}function F(t){return typeof t=="number"&&Number.isFinite(t)}function ie(t){return typeof t=="function"}function d(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function pe(t){return Array.isArray(t)}function T(t,e){throw e||new Error(t?`Unexpected value: ${t}`:"Application entered invalid state")}function s(t,...e){if(t)return;let n=Error("Assertion Error"+(e.length>0?": "+e.join(" "):""));if(n.stack)try{let i=n.stack.split(`
import G from"react";import{useCallback as Kt,useEffect as Ht,useRef as jt}from"react";var xt="invoke";function y(t){return xt in t}function m(t){return t===null}function k(t){return t===!0||t===!1}function s(t){return typeof t=="string"}function A(t){return typeof t=="number"&&Number.isFinite(t)}function ie(t){return typeof t=="function"}function d(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function ge(t){return Array.isArray(t)}function I(t,e){throw e||new Error(t?`Unexpected value: ${t}`:"Application entered invalid state")}function a(t,...e){if(t)return;let n=Error("Assertion Error"+(e.length>0?": "+e.join(" "):""));if(n.stack)try{let i=n.stack.split(`
`);i[1]?.includes("assert")?(i.splice(1,1),n.stack=i.join(`
`)):i[0]?.includes("assert")&&(i.splice(0,1),n.stack=i.join(`
`))}catch{}throw n}var It="FileAsset",Nt="__class";function oe(t){return d(t)?t[Nt]===It:!1}var f=class{id;url;extension;constructor(e){this.url=e.url,this.id=e.id,this.extension=e.extension}};function re(t){return t instanceof f}var Ct="ImageAsset",St="__class";function W(t){return d(t)?t[St]===Ct:!1}var g=class t{id;url;thumbnailUrl;altText;resolution;#e;#t;constructor(e,n){s(h(n)),this.#t=n,this.url=e.url,this.id=e.id,this.thumbnailUrl=e.thumbnailUrl,this.altText=e.altText,this.resolution=e.resolution}cloneWithAttributes({altText:e,resolution:n}){return new t({__class:"ImageAsset",id:this.id,url:this.url,thumbnailUrl:this.thumbnailUrl,altText:e!==void 0?e:this.altText,resolution:n!==void 0?n:this.resolution},this.#t)}async measure(){return kt(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:n}=await this.getData(),i=new Blob([n],{type:e});return createImageBitmap(i)}async loadImage(){let e=await this.getData(),n=URL.createObjectURL(new Blob([e.bytes]));return new Promise((i,o)=>{let r=new Image;r.onload=()=>i(r),r.onerror=()=>o(),r.src=n})}};function se(t){return t instanceof g}function x(t){return t.type==="bytes"?[t.bytes.buffer]:[]}function vt(t){if(!d(t))return!1;let e="bytes",n="mimeType";return!(!(e in t)||!(n in t)||!(t[e]instanceof Uint8Array)||!a(t[n]))}async function U(t){if(t instanceof File)return fe(t);let e=await we(t.image);return{name:t.name,altText:t.altText,resolution:t.resolution,...e}}async function he(t){if(t instanceof File)return fe(t);let e=await we(t.file);return{name:t.name,...e}}async function we(t){return t instanceof File?fe(t):vt(t)?{type:"bytes",mimeType:t.mimeType,bytes:t.bytes}:{type:"url",url:t}}function ye(t){return Promise.all(t.map(U))}async function fe(t){return new Promise((e,n)=>{let i=new FileReader;i.onload=o=>{let r=t.type,l=o.target?.result;if(!l||!(l instanceof ArrayBuffer)){n(new Error("Failed to read file, arrayBuffer is null"));return}let b=new Uint8Array(l);e({bytes:b,mimeType:r,type:"bytes",name:t.name})},i.onerror=o=>{n(o)},i.readAsArrayBuffer(t)})}async function kt(t){let e=t instanceof File,n=e?URL.createObjectURL(t):t,i=new Image;return i.crossOrigin="anonymous",i.src=n,await i.decode().finally(()=>{e&&URL.revokeObjectURL(n)}),{height:i.height,width:i.width}}var Dt="Font";function Le(t){return d(t)&&t.__class===Dt}function At(t){if(!F(t))return!1;switch(t){case 100:case 200:case 300:case 400:case 500:case 600:case 700:case 800:case 900:return!0;default:return!1}}function Ft(t){if(!a(t))return!1;switch(t){case"normal":case"italic":return!0;default:return!1}}function z(t){return d(t)?a(t.family)&&a(t.selector)&&At(t.weight)&&Ft(t.style):!1}var I=class{selector;family;weight;style;constructor(e){this.selector=e.selector,this.family=e.family,this.weight=e.weight,this.style=e.style}},Re=new Map;function N(t){let e=Re.get(t.selector);if(e)return e;let n=new I(t);return Re.set(t.selector,n),n}function C(t){return{__class:"Font",selector:t.selector,family:t.family,weight:t.weight,style:t.style}}var Me="__class",be="LinearGradient",Pe="RadialGradient",Te="ConicGradient";function ae(t){if(!d(t))return!1;switch(t[Me]){case be:case Pe:case Te:return!0;default:return!1}}function K(t){return t instanceof w||t instanceof R||t instanceof L}function Ve(t){if(t instanceof w)return{__class:be,angle:t.angle,stops:t.stops};if(t instanceof R)return{__class:Pe,width:t.width,height:t.height,x:t.x,y:t.y,stops:t.stops};if(t instanceof L)return{__class:Te,angle:t.angle,x:t.x,y:t.y,stops:t.stops};T(t)}function le(t){switch(t[Me]){case be:return new w(t);case Pe:return new R(t);case Te:return new L(t);default:T(t)}}var w=class t{angle;stops;constructor(e){this.angle=e.angle,this.stops=e.stops,Object.freeze(this)}cloneWithAttributes(e){return new t({angle:e.angle??this.angle,stops:e.stops??this.stops})}toCSS(){let e=this.stops.map(n=>`${n.color} ${n.position*100}%`).join(", ");return`linear-gradient(${this.angle}deg, ${e})`}},R=class t{width;height;x;y;stops;constructor(e){this.width=e.width,this.height=e.height,this.x=e.x,this.y=e.y,this.stops=e.stops,Object.freeze(this)}cloneWithAttributes(e){return new t({width:e.width??this.width,height:e.height??this.height,x:e.x??this.x,y:e.y??this.y,stops:e.stops??this.stops})}toCSS(){let e=this.stops.map((n,i)=>{let o=this.stops[i+1],r=n.position===1&&o?.position===1?n.position-1e-4:n.position;return`${n.color} ${r*100}%`}).join(", ");return`radial-gradient(${this.width} ${this.height} at ${this.x} ${this.y}, ${e})`}},L=class t{angle;x;y;stops;constructor(e){this.angle=e.angle,this.x=e.x,this.y=e.y,this.stops=e.stops,Object.freeze(this)}cloneWithAttributes(e){return new t({angle:e.angle??this.angle,x:e.x??this.x,y:e.y??this.y,stops:e.stops??this.stops})}toCSS(){let e=this.stops.map(n=>`${n.color} ${n.position*360}deg`).join(", ");return`conic-gradient(from ${this.angle}deg at ${this.x} ${this.y}, ${e})`}};var Wt="ColorStyle",wt="__class";function S(t){return d(t)?t[wt]===Wt:!1}var p=class t{id;name;light;dark;#e;constructor(e,n){s(a(e.id),"Style must have an id"),this.id=e.id,this.name=e.name,this.light=e.light,this.dark=e.dark,s(h(n)),this.#e=n}async setAttributes(e){let n=await this.#e.invoke("setColorStyleAttributes",this.id,e);return n?new t(n,this.#e):null}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async setPluginData(e,n){return this.#e.invoke("setPluginDataForNode",this.id,e,n)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}async remove(){return this.#e.invoke("removeColorStyle",this.id)}};function v(t){return t instanceof p}function xe(t){return{__class:"ColorStyle",id:t.id,name:t.name,light:t.light,dark:t.dark}}var Rt="TextStyle",Lt="__class";function Ee(t){return d(t)?t[Lt]===Rt:!1}var y=class t{id;name;tag;font;boldFont;italicFont;boldItalicFont;color;transform;alignment;decoration;balance;breakpoints;minWidth;fontSize;letterSpacing;lineHeight;paragraphSpacing;#e;constructor(e,n){s(a(e.id),"Style must have an id"),this.id=e.id,this.name=e.name,this.tag=e.tag,this.font=new I(e.font),this.boldFont=e.boldFont?new I(e.boldFont):null,this.italicFont=e.italicFont?new I(e.italicFont):null,this.boldItalicFont=e.boldItalicFont?new I(e.boldItalicFont):null,this.color=S(e.color)?new p(e.color,n):e.color,this.transform=e.transform,this.alignment=e.alignment,this.decoration=e.decoration,this.balance=e.balance,this.breakpoints=e.breakpoints,this.minWidth=e.minWidth,this.fontSize=e.fontSize,this.letterSpacing=e.letterSpacing,this.lineHeight=e.lineHeight,this.paragraphSpacing=e.paragraphSpacing,s(h(n)),this.#e=n}async setAttributes(e){let n=await this.#e.invoke("setTextStyleAttributes",this.id,e);return n?new t(n,this.#e):null}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async setPluginData(e,n){return this.#e.invoke("setPluginDataForNode",this.id,e,n)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}async remove(){return this.#e.invoke("removeTextStyle",this.id)}};function M(t){return t instanceof y}function Ge(t){return{__class:"TextStyle",id:t.id,name:t.name,tag:t.tag,font:C(t.font),boldFont:t.boldFont?C(t.font):null,italicFont:t.italicFont?C(t.italicFont):null,boldItalicFont:t.boldItalicFont?C(t.boldItalicFont):null,color:v(t.color)?xe(t.color):t.color,transform:t.transform,alignment:t.alignment,decoration:t.decoration,balance:t.balance,breakpoints:t.breakpoints,minWidth:t.minWidth,fontSize:t.fontSize,letterSpacing:t.letterSpacing,lineHeight:t.lineHeight,paragraphSpacing:t.paragraphSpacing}}function de(t){if(Vt(t))return Et(t);if(pe(t))return t.map(de);if(d(t)&&!(t instanceof Uint8Array)){let e={};for(let n in t)e[n]=de(t[n]);return e}return t}function _e(t,e){let n={};for(let i in t)n[i]=Ie(t[i],e);return n}function Ie(t,e){if(Mt(t))switch(t.__class){case"ImageAsset":return new g(t,e);case"FileAsset":return new f(t);case"LinearGradient":case"RadialGradient":case"ConicGradient":return le(t);case"TextStyle":return new y(t,e);case"Font":return N(t);case"ColorStyle":return new p(t,e);default:T(t)}if(d(t)){let n={};for(let i in t)n[i]=Ie(t[i],e);return n}return pe(t)?t.map(n=>Ie(n,e)):t}function Mt(t){return!!(W(t)||oe(t)||ae(t))}function Vt(t){return!!(se(t)||re(t)||K(t)||M(t)||z(t)||v(t))}function Et(t){if(se(t))return{__class:"ImageAsset",id:t.id,thumbnailUrl:t.thumbnailUrl,url:t.url,altText:t.altText,resolution:t.resolution};if(re(t))return{__class:"FileAsset",id:t.id,extension:t.extension,url:t.url};if(K(t))return Ve(t);if(M(t))return Ge(t);if(z(t))return C(t);if(v(t))return xe(t);T(t)}function Gt(t,e){for(let n in t){let i=t[n];W(i)&&(t[n]=new g(i,e)),oe(i)&&(t[n]=new f(i)),S(i)&&(t[n]=new p(i,e))}}var H=class{id;name;readonly;#e;constructor(e,n){s(a(e.id),"Node must have an id"),s(a(e.name),"Node must have a name"),s(A(e.readonly),"Readonly must be set"),this.id=e.id,this.name=e.name,this.readonly=e.readonly,s(h(n)),this.#e=n,Object.freeze(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("getManagedCollectionFields",this.id)}async setFields(e){return this.#e.invoke("setManagedCollectionFields",this.id,e)}async addItems(e){return this.#e.invoke("addManagedCollectionItems",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,n){return this.#e.invoke("setPluginDataForNode",this.id,e,n)}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}},V=class{id;name;slugFieldName;readonly;#e;constructor(e,n){s(a(e.id),"Node must have an id"),s(a(e.name),"Node must have a name"),s(A(e.readonly),"Readonly must be set"),s(e.slugFieldName===null||a(e.slugFieldName),"Node slug field name must be a string or null"),this.id=e.id,this.name=e.name,this.slugFieldName=e.slugFieldName,this.readonly=e.readonly,s(h(n)),this.#e=n,Object.freeze(this)}async setItemOrder(e){return this.#e.invoke("setCollectionItemOrder",this.id,e)}async getFields(){return this.#e.invoke("getCollectionFields",this.id,!0)}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("getCollectionItems",this.id)).map(n=>new Ne(n,this.#e))}async addItems(e){await this.#e.invoke("addCollectionItems",this.id,e)}async removeItems(e){return this.#e.invoke("removeNodes",e)}async setAsActive(){return this.#e.invoke("setActiveCollection",this.id)}async setPluginData(e,n){return this.#e.invoke("setPluginDataForNode",this.id,e,n)}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}},Ne=class t{id;slug;draft;fieldData;#e;constructor(e,n){this.id=e.id,this.slug=e.slug,this.draft=e.draft??!1,this.fieldData=e.fieldData,Gt(this.fieldData,n),s(h(n)),this.#e=n,Object.freeze(this),Object.freeze(this.fieldData)}async remove(){return this.#e.removeNodes([this.id])}async setAttributes(e){let n=await this.#e.invoke("setCollectionItemAttributes",this.id,e);return n?new t(n,this.#e):null}async setPluginData(e,n){return this.#e.invoke("setPluginDataForNode",this.id,e,n)}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}};var _t=(()=>{let t=null;return{disableUntilMouseUp:()=>{if(t)return;t=document.createElement("style"),t.textContent="* { pointer-events: none !important; user-select: none !important; -webkit-user-select: none !important; }",document.head.appendChild(t);let e=()=>{t&&(document.head.removeChild(t),t=null,o())},n=r=>{r.buttons>0&&r.buttons&1||e()},i=()=>{e()};window.addEventListener("pointerup",n,!0),window.addEventListener("pointermove",n,!0),window.addEventListener("blur",i);function o(){window.removeEventListener("pointerup",n,!0),window.removeEventListener("pointermove",n,!0),window.removeEventListener("blur",i)}}}})(),Oe=5,Ot=(()=>{let t=1;return{next:()=>`drag-${t++}`}})();function Bt(){}function Be(t,e,n){if(t.mode!=="canvas")return Bt;s(h(t));let i=Ot.next(),o=document.body.style.cursor,r={type:"idle"},l=document.body,b=c=>{r.type!=="idle"&&(r.type==="dragging"&&t.invoke("onDragEnd",{...c,dragSessionId:i}),r={type:"idle"},Tt())},J=c=>{if(r.type==="idle")return;if(!(c.buttons>0&&!!(c.buttons&1))){b({cancelled:!1});return}let{clientX:ee,clientY:O}=c;if(r.type==="pointerDown"){let B=ee-r.dragStart.mouse.x,We=O-r.dragStart.mouse.y;if(Math.abs(B)<Oe&&Math.abs(We)<Oe)return;r={type:"dragging",dragStart:r.dragStart},t.invoke("onDragStart",r.dragStart),document.getSelection()?.empty(),_t.disableUntilMouseUp()}l.setPointerCapture(c.pointerId);let te={x:ee,y:O};t.invoke("onDrag",{dragSessionId:i,mouse:te}).then(B=>{r.type==="dragging"&&(document.body.style.cursor=B??"")})},ke=c=>{c.key==="Escape"&&b({cancelled:!0})},De=()=>{b({cancelled:!0})},Ae=c=>{b({cancelled:!0});let _=e.getBoundingClientRect(),ee={x:_.x,y:_.y,width:_.width,height:_.height},O,te=e.querySelectorAll("svg");if(te.length===1){let ne=te.item(0).getBoundingClientRect();O={x:ne.x,y:ne.y,width:ne.width,height:ne.height}}let B={x:c.clientX,y:c.clientY};r={type:"pointerDown",dragStart:{dragSessionId:i,elementRect:ee,svgRect:O,mouse:B}},t.invoke("setDragData",i,n()),l.addEventListener("pointermove",J,!0),l.addEventListener("pointerup",J,!0),window.addEventListener("keydown",ke,!0),window.addEventListener("blur",De)},Fe=()=>{let c=n();c.type==="detachedComponentLayers"&&t.invoke("preloadDetachedComponentLayers",c.url),c.type==="image"&&t.invoke("preloadImageUrlForInsertion",c.image),c.previewImage&&t.invoke("preloadDragPreviewImage",c.previewImage)};e.addEventListener("pointerdown",Ae),e.addEventListener("mouseenter",Fe);function Tt(){document.body.style.cursor=o,l.removeEventListener("pointermove",J,!0),l.removeEventListener("pointerup",J,!0),window.removeEventListener("keydown",ke,!0),window.removeEventListener("blur",De)}return()=>{e.removeEventListener("pointerdown",Ae),e.removeEventListener("mouseenter",Fe),b({cancelled:!0})}}var j=class extends Error{};var Ue={canvas:!0,image:!0,editImage:!0,configureManagedCollection:!0,syncManagedCollection:!0,collection:!0,localization:!0},Fn=Object.keys(Ue);function ze(t){return a(t)&&Object.hasOwn(Ue,t)}var Ut={methodResponse:!0,pluginReadyResponse:!0,subscriptionMessage:!0};function zt(t){return a(t)&&t in Ut}function Ke(t){return d(t)&&zt(t["type"])}var P=class{id;#e;#t;#n;constructor(e,n){s(a(e.id),"Node must have an id"),this.id=e.id,this.#t=n,this.#e=e.originalId??null,s(h(n)),this.#n=n}get isReplica(){return this.#e!==null}remove(){return this.#t.removeNodes([this.id])}select(){return this.#t.setSelection([this.id])}clone(){return this.#t.cloneNode(this.id)}setAttributes(e){return this.#t.setAttributes(this.id,e)}getRect(){return this.#t.getRect(this.id)}zoomIntoView(e){return this.#t.zoomIntoView([this.id],e)}getParent(){return this.#t.getParent(this.id)}getChildren(){return k(this)?Promise.resolve([]):this.#t.getChildren(this.id)}async getNodesWithType(e){return k(this)?Promise.resolve([]):(await this.#n.invoke("getNodesWithType",this.id,e)).map(i=>u(i,this.#t))}async getNodesWithAttribute(e){return k(this)?Promise.resolve([]):(await this.#n.invoke("getNodesWithAttribute",this.id,e)).map(i=>u(i,this.#t))}async getNodesWithAttributeSet(e){return k(this)?Promise.resolve([]):(await this.#n.invoke("getNodesWithAttributeSet",this.id,e)).map(i=>u(i,this.#t))}async*walk(){if(yield this,!k(this))for(let e of await this.getChildren())yield*e.walk()}async getPluginData(e){return this.#n.invoke("getPluginDataForNode",this.id,e)}async setPluginData(e,n){return this.#n.invoke("setPluginDataForNode",this.id,e,n)}async getPluginDataKeys(){return this.#n.invoke("getPluginDataKeysForNode",this.id)}},D=class extends P{__class="FrameNode";name;visible;locked;backgroundColor;backgroundImage;backgroundGradient;rotation;opacity;borderRadius;position;top;right;bottom;left;centerX;centerY;width;height;maxWidth;minWidth;maxHeight;minHeight;aspectRatio;link;linkOpenInNewTab;constructor(e,n){super(e,n),s(e.__class==="FrameNode","FrameNode must have a __class property"),this.name=e.name??null,this.visible=e.visible??!0,this.locked=e.locked??!1,this.backgroundColor=S(e.backgroundColor)?new p(e.backgroundColor,n):e.backgroundColor??null,this.backgroundImage=e.backgroundImage?new g(e.backgroundImage,n):null,this.rotation=e.rotation??0,this.opacity=e.opacity??1,this.borderRadius=e.borderRadius??null,this.backgroundGradient=ae(e.backgroundGradient)?le(e.backgroundGradient):null,s(e.position,"Must have a position"),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.link=e.link??null,this.linkOpenInNewTab=e.linkOpenInNewTab??null,Object.freeze(this)}clone(){return super.clone()}setAttributes(e){return super.setAttributes(e)}},$=class extends P{__class="TextNode";name;visible;locked;rotation;opacity;font;inlineTextStyle;position;top;right;bottom;left;centerX;centerY;width;height;maxWidth;minWidth;maxHeight;minHeight;link;linkOpenInNewTab;#e;constructor(e,n){super(e,n),s(h(n)),this.#e=n,this.name=e.name??null,this.visible=e.visible??!0,this.locked=e.locked??!1,this.rotation=e.rotation??0,this.opacity=e.opacity??1,this.font=e.font?N(e.font):null,this.inlineTextStyle=e.inlineTextStyle?new y(e.inlineTextStyle,n):null,s(e.position,"Must have a position"),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,Object.freeze(this)}clone(){return super.clone()}setAttributes(e){return super.setAttributes(e)}async setText(e){await this.#e.invoke("setTextForNode",this.id,e)}async getText(){return this.#e.invoke("getTextForNode",this.id)}},X=class extends P{__class="SVGNode";name;visible;locked;svg;rotation;opacity;position;top;right;bottom;left;centerX;centerY;width;height;constructor(e,n){super(e,n),s(e.svg,"SVG node must have a non-empty SVG string"),this.name=e.name??null,this.visible=e.visible??!0,this.locked=e.locked??!1,this.svg=e.svg,this.rotation=e.rotation??0,this.opacity=e.opacity??1,s(e.position,"Must have a position"),this.position=e.position??null,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,Object.freeze(this)}clone(){return super.clone()}setAttributes(e){return super.setAttributes(e)}},Y=class extends P{__class="ComponentInstanceNode";name;visible;locked;componentIdentifier;insertURL;componentName;controls;rotation;opacity;position;top;right;bottom;left;centerX;centerY;width;height;maxWidth;minWidth;maxHeight;minHeight;aspectRatio;constructor(e,n){super(e,n),s(e.componentIdentifier,"ComponentInstance node must have a component identifier"),this.name=e.name??null,this.visible=e.visible??!0,this.locked=e.locked??!1,this.componentIdentifier=e.componentIdentifier,this.componentName=e.componentName??null,this.insertURL=e.insertURL??null,this.controls=_e(e.controls??{},n),this.rotation=e.rotation??0,this.opacity=e.opacity??1,s(e.position,"Must have a position"),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,Object.freeze(this)}clone(){return super.clone()}setAttributes(e){return super.setAttributes(e)}},q=class extends P{_class="WebPageNode";path;collectionId;constructor(e,n){super(e,n),s(e),this.path=e.path??null,this.collectionId=e.collectionId??null,Object.freeze(this)}clone(){return super.clone()}setAttributes(e){return super.setAttributes(e)}},Z=class extends P{__class="ComponentNode";name;componentIdentifier;insertURL;componentName;constructor(e,n){super(e,n),s(e.componentIdentifier,"ComponentNode must have a componentIdentifier"),this.componentIdentifier=e.componentIdentifier,this.insertURL=e.insertURL??null,this.componentName=e.componentName??null,this.name=e.name??null,Object.freeze(this)}clone(){return super.clone()}setAttributes(e){return super.setAttributes(e)}},Q=class extends P{__class="UnknownNode";constructor(e,n){super(e,n),Object.freeze(this)}clone(){throw Error("Can not clone unknown node")}setAttributes(e){throw Error("Can not set attributes on unknown node")}};function u(t,e){switch(t.__class){case"WebPageNode":return new q(t,e);case"ComponentNode":return new Z(t,e);case"ComponentInstanceNode":return new Y(t,e);case"FrameNode":return new D(t,e);case"SVGNode":return new X(t,e);case"TextNode":return new $(t,e);case"UnknownNode":return new Q(t,e);default:return new Q(t,e)}}function ue(t){return t instanceof D}function He(t){return t instanceof $}function je(t){return t instanceof X}function ce(t){return t instanceof Y}function $e(t){return t instanceof q}function Xe(t){return t instanceof Z}function k(t){return t instanceof Q}function me(t){return!!(ue(t)||He(t)||ce(t)||je(t)||k(t))}function Ce(t){return!!($e(t)||Xe(t)||k(t))}var E=null;function Ye(t){if(!E){let n=document.createElement("style");document.head.appendChild(n),E=n.sheet}if(!E){t();return}let e=E.insertRule("* { transition: none !important; animation: none !important; }");t(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{E&&E.deleteRule(e)})})}var ge=class{#e=0;#t=0;#n=[];#o=void 0;#r=new Map;#i;subscriptions=new Map;constructor({isTestEnv:e}={}){if(e){this.#i="canvas";return}if(typeof window>"u"){console.warn("Framer Plugin API is not supported in non-browser environments"),this.#i="canvas";return}let i=new URL(window.location.href).searchParams.get("mode");s(ze(i),`Invalid mode: ${i}`),this.#i=i,window.addEventListener("message",this.onMessage);let o={type:"pluginReadySignal"};window.parent.postMessage(o,"*"),this.subscribe("theme",this.applyPluginTheme),window.addEventListener("pointerdown",()=>{this.invoke("onPointerDown")})}get mode(){return this.#i}invoke(e,...n){return this.invokeTransferable(e,void 0,...n)}invokeTransferable(e,n,...i){return new Promise((o,r)=>{let l={args:i,methodName:e,id:this.#e++,type:"methodInvocation"},b=o;this.#r.set(l.id,{resolve:b,reject:r}),this.queueMessage(l,n)})}subscribe(e,n){this.queueMessage({type:"subscribe",topic:e});let i=this.subscriptions.get(e)??new Set;return i.add(n),this.subscriptions.set(e,i),()=>{let o=this.subscriptions.get(e)??new Set;o.delete(n),o.size===0&&this.queueMessage({type:"unsubscribe",topic:e}),this.subscriptions.set(e,o)}}queueMessage(e,n){if(e.type==="methodInvocation"&&(e.args=e.args.map(de)),!this.#o){this.#n.push([e,n]);return}this.#o(e,n)}onMessage=e=>{let n=e.data;if(Ke(n))switch(n.type){case"pluginReadyResponse":{if(!e.source)throw new Error("No 'source' on incoming message: "+n.type);s(this.#i===n.mode,"Mode must match"),this.applyPluginTheme(n.theme),this.#o=(o,r)=>window.parent.postMessage(o,e.origin,r);for(let o of this.#n)this.#o(...o);this.#n=[];break}case"methodResponse":{let i=this.#r.get(n.id);if(!i)throw new Error(`No handler for response with id ${n.id}`);this.#r.delete(n.id),n.error?i.reject(new j(n.error)):i.resolve(n.result);break}case"subscriptionMessage":{let{topic:i,payload:o}=n,r=this.subscriptions.get(i);if(!r)throw new Error("Received a subscription message but no handler present");for(let l of r)l(o);break}default:T(n)}};applyPluginTheme=e=>{Ye(()=>{document.body.setAttribute("data-framer-theme",e.mode);for(let n in e.tokens)document.body.style.setProperty(n,e.tokens[n])})};async showUI(e){return this.invoke("showUI",e)}async hideUI(){return this.invoke("hideUI")}async closePlugin(e,n){return this.invoke("closePlugin",e,n)}async getCurrentUser(){return this.invoke("getCurrentUser2")}async getProjectInfo(){return this.invoke("getProjectInfo2")}async getSelection(){return(await this.invoke("getSelection")).map(n=>{let i=u(n,this);return s(me(i)),i})}async setSelection(e){let n=a(e)?[e]:Array.from(e);return this.invoke("setSelection",n)}subscribeToSelection(e){return this.subscribe("selection",n=>{let i=n.map(o=>{let r=u(o,this);return s(me(r)),r});e(i)})}async getCanvasRoot(){let e=await this.invoke("getCanvasRoot"),n=u(e,this);return s(Ce(n)),n}subscribeToCanvasRoot(e){return this.subscribe("canvasRoot",n=>{let i=u(n,this);s(Ce(i)),e(i)})}async getPublishInfo(){return this.invoke("getPublishInfo")}subscribeToPublishInfo(e){return this.subscribe("publishInfo",e)}async createFrameNode(e,n){let i=await this.invoke("createNode","FrameNode",n??null,e);if(!i)return null;let o=u(i,this);return s(o instanceof D),o}async removeNodes(e){return this.invoke("removeNodes",e)}async removeNode(e){return this.removeNodes([e])}async cloneNode(e){let n=await this.invoke("cloneNode",e);return n?u(n,this):null}async getNode(e){let n=await this.invoke("getNode",e);return n?u(n,this):null}async getParent(e){let n=await this.invoke("getParent",e);return n?u(n,this):null}async getChildren(e){return(await this.invoke("getChildren",e)).map(i=>{let o=u(i,this);return s(me(o)),o})}async getRect(e){return this.invoke("getRect",e)}async zoomIntoView(e,n){let i=a(e)?[e]:Array.from(e);return this.invoke("zoomIntoView",i,n)}async setAttributes(e,n){let i=await this.invoke("setAttributes",e,n);return i?u(i,this):null}async setParent(e,n,i){return this.invoke("setParent",e,n,i)}async getNodesWithType(e){return(await this.invoke("getNodesWithType",null,e)).map(i=>u(i,this))}async getNodesWithAttribute(e){return(await this.invoke("getNodesWithAttribute",null,e)).map(i=>u(i,this))}async getNodesWithAttributeSet(e){return(await this.invoke("getNodesWithAttributeSet",null,e)).map(i=>u(i,this))}async getImage(){let e=await this.invoke("getImage");return e?new g(e,this):null}subscribeToImage(e){return this.subscribe("image",n=>{if(!n){e(null);return}e(new g(n,this))})}async addImage(e){let n=await U(e),i=x(n);return this.invokeTransferable("addImage",i,n)}async setImage(e){let n=await U(e),i=x(n);return this.invokeTransferable("setImage",i,n)}async uploadImage(e){let n=await U(e),i=x(n),o=await this.invokeTransferable("uploadImage",i,n);return new g(o,this)}async addImages(e){let n=await ye(e),i=n.flatMap(x);await this.invokeTransferable("addImages",i,n)}async uploadImages(e){let n=await ye(e),i=n.flatMap(x),o=await this.invokeTransferable("uploadImages",i,n),r=[];for(let l of o)r.push(new g(l,this));return r}async uploadFile(e){let n=await he(e),i=await this.invokeTransferable("uploadFile",x(n),n);return new f(i)}async uploadFiles(e){let n=await Promise.all(e.map(he)),i=n.flatMap(x),o=await this.invokeTransferable("uploadFiles",i,n),r=[];for(let l of o)r.push(new f(l));return r}async addSVG(e){return this.invoke("addSVG",e)}async addComponentInstance({url:e,attributes:n}){let i=await this.invoke("addComponentInstance",{url:e,attributes:n}),o=u(i,this);return s(ce(o)),o}async addDetachedComponentLayers({url:e,layout:n,attributes:i}){let o=await this.invoke("addDetachedComponentLayers",{url:e,layout:n,attributes:i}),r=u(o,this);return s(ue(r)),r}async preloadDetachedComponentLayers(e){await this.invoke("preloadDetachedComponentLayers",e)}async preloadImageUrlForInsertion(e){await this.invoke("preloadImageUrlForInsertion",e)}async preloadDragPreviewImage(e){await this.invoke("preloadDragPreviewImage",e)}async getText(){return this.invoke("getText")}async setText(e){return this.invoke("setText",e)}async addText(e,n){return this.invoke("addText",e,n)}async setCustomCode(e){return this.invoke("setCustomCode",e)}async getCustomCode(){return this.invoke("getCustomCode")}subscribeToCustomCode(e){return this.subscribe("customCode",e)}subscribeToText(e){return this.subscribe("text",e)}makeDraggable(e,n){return Be(this,e,n)}async getActiveManagedCollection(){let e=await this.invoke("getActiveManagedCollection");return s(e,"Collection data must be defined"),new H(e,this)}async getManagedCollection(){return this.getActiveManagedCollection()}async getManagedCollections(){let e=await this.invoke("getManagedCollections");return s(e,"Collections data must be defined"),e.map(n=>new H(n,this))}async getCollection(e){let n=await this.invoke("getCollection",e);return n?new V(n,this):null}async getActiveCollection(){let e=await this.invoke("getActiveCollection");return e?new V(e,this):null}async getCollections(){return(await this.invoke("getCollections")).map(n=>new V(n,this))}notify(e,n){let i=`notification-${this.#t++}`;return this.invoke("notify",e,{notificationId:i,variant:n?.variant??"info",buttonText:n?.button?.text,durationMs:n?.durationMs}).then(o=>{o==="actionButtonClicked"&&n?.button?.onClick&&n.button.onClick(),n?.onDisappear&&n.onDisappear()}),{close:()=>this.invoke("closeNotification",i)}}async getPluginData(e){return this.invoke("getPluginData",e)}async setPluginData(e,n){return this.invoke("setPluginData",e,n)}async getPluginDataKeys(){return this.invoke("getPluginDataKeys")}async getColorStyles(){return(await this.invoke("getColorStyles")).map(n=>new p(n,this))}async getColorStyle(e){let n=await this.invoke("getColorStyle",e);return n?new p(n,this):null}async createColorStyle(e){let n=await this.invoke("createColorStyle",e);return new p(n,this)}subscribeToColorStyles(e){return this.subscribe("colorStyles",n=>{let i=n.map(o=>new p(o,this));return e(i)})}async getTextStyles(){return(await this.invoke("getTextStyles")).map(n=>new y(n,this))}async getTextStyle(e){let n=await this.invoke("getTextStyle",e);return n?new y(n,this):null}async createTextStyle(e){let n=await this.invoke("createTextStyle",e);return new y(n,this)}subscribeToTextStyles(e){return this.subscribe("textStyles",n=>{let i=n.map(o=>new y(o,this));return e(i)})}async getFont(e,n){let i=await this.invoke("getFont",e,n);return i?N(i):null}async getFonts(){return(await this.invoke("getFonts")).map(N)}unstable_getLocales(){return this.invoke("unstable_getLocales")}unstable_getDefaultLocale(){return this.invoke("unstable_getDefaultLocale")}unstable_getActiveLocale(){return this.invoke("unstable_getActiveLocale")}async unstable_getLocalizationGroups(){return this.invoke("unstable_getLocalizationGroups")}unstable_setLocalizationData(e){return this.invoke("unstable_setLocalizationData",e)}async unstable_createCodeFile(e,n){return this.invoke("unstable_createCodeFile",e,n)}async unstable_getCodeFileContent(e){return this.invoke("unstable_getCodeFileContent",e)}async unstable_setCodeFileContent(e,n){return this.invoke("unstable_setCodeFileContent",e,n)}async unstable_removeCodeFile(e){return this.invoke("unstable_removeCodeFile",e)}async unstable_renameCodeFile(e,n){return this.invoke("unstable_renameCodeFile",e,n)}async unstable_ensureMinimumDependencyVersion(e,n){return this.invoke("unstable_ensureMinimumDependencyVersion",e,n)}};var Se=new ge;function ve(t,e){let n=$t(()=>ie(e)?e():e);Ht(()=>{let i=t.current;if(i instanceof HTMLElement)return Se.makeDraggable(i,n)},[n])}function $t(t){let e=jt(t);return e.current=t,Kt((...n)=>e.current(...n),[])}var Xt=G.forwardRef(function({data:e,children:n,...i},o){let r=G.useRef(null);if(ve(r,e),G.isValidElement(n)){let l=Object.assign({},i);return d(n.props)&&Object.assign(l,n.props),l.ref=Zt(r,o,n.ref),G.cloneElement(n,l)}return G.Children.count(n)>1&&G.Children.only(n),null}),Yt="current";function qt(t){return d(t)&&Yt in t}function Zt(...t){return e=>{for(let n of t)ie(n)?n(e):qt(n)&&(n.current=e)}}var Qt={fixed:!0,sticky:!0,absolute:!0,relative:!0},qe="position";function hi(t){if(!(qe in t))return!1;let e=t[qe];return a(e)&&Qt[e]===!0}var Ze="top";function yi(t){if(!(Ze in t))return!1;let e=t[Ze];return a(e)||m(e)}var Qe="width";function fi(t){if(!(Qe in t))return!1;let e=t[Qe];return a(e)||m(e)}var Je="maxWidth";function bi(t){if(!(Je in t))return!1;let e=t[Je];return a(e)||m(e)}var et="aspectRatio";function Pi(t){if(!(et in t))return!1;let e=t[et];return F(e)||m(e)}var tt="name";function Ti(t){if(!(tt in t))return!1;let e=t[tt];return a(e)||m(e)}var nt="visible";function xi(t){if(!(nt in t))return!1;let e=t[nt];return A(e)}var it="locked";function Ii(t){if(!(it in t))return!1;let e=t[it];return A(e)}var ot="backgroundColor";function Ni(t){if(!(ot in t))return!1;let e=t[ot];return a(e)||v(e)||m(e)}var rt="backgroundColor";function Ci(t){if(!(rt in t))return!1;let e=t[rt];return a(e)||S(e)||m(e)}var st="backgroundImage";function Si(t){if(!(st in t))return!1;let e=t[st];return e instanceof g||m(e)}var at="backgroundImage";function vi(t){if(!(at in t))return!1;let e=t[at];return e instanceof g?!1:W(e)||m(e)}var lt="backgroundGradient";function ki(t){if(!(lt in t))return!1;let e=t[lt];return K(e)||m(e)}var dt="backgroundGradient";function Di(t){if(!(dt in t))return!1;let e=t[dt];return d(e)||m(e)}var ut="rotation";function Ai(t){if(!(ut in t))return!1;let e=t[ut];return F(e)}var ct="opacity";function Fi(t){if(!(ct in t))return!1;let e=t[ct];return F(e)}var mt="borderRadius";function Wi(t){if(!(mt in t))return!1;let e=t[mt];return a(e)||m(e)}var gt="svg";function wi(t){if(!(gt in t))return!1;let e=t[gt];return a(e)}var pt="componentIdentifier";function Ri(t){if(!(pt in t))return!1;let e=t[pt];return a(e)}var ht="font";function Li(t){if(!(ht in t))return!1;let e=t[ht];return z(e)}var yt="font";function Mi(t){if(!(yt in t))return!1;let e=t[yt];return Le(e)||m(e)}var ft="inlineTextStyle";function Vi(t){if(!(ft in t))return!1;let e=t[ft];return M(e)||m(e)}var bt="inlineTextStyle";function Ei(t){if(!(bt in t))return!1;let e=t[bt];return Ee(e)||m(e)}var Pt="link";function Gi(t){if(!(Pt in t))return!1;let e=t[Pt];return a(e)||m(e)}export{Y as ComponentInstanceNode,Z as ComponentNode,L as ConicGradient,Xt as Draggable,D as FrameNode,j as FramerPluginError,w as LinearGradient,R as RadialGradient,X as SVGNode,$ as TextNode,q as WebPageNode,Se as framer,v as isColorStyle,ce as isComponentInstanceNode,Xe as isComponentNode,re as isFileAsset,ue as isFrameNode,se as isImageAsset,je as isSVGNode,He as isTextNode,M as isTextStyle,$e as isWebPageNode,Pi as supportsAspectRatio,Ni as supportsBackgroundColor,Ci as supportsBackgroundColorData,ki as supportsBackgroundGradient,Di as supportsBackgroundGradientData,Si as supportsBackgroundImage,vi as supportsBackgroundImageData,Wi as supportsBorderRadius,Ri as supportsComponentInfo,Li as supportsFont,Mi as supportsFontData,Vi as supportsInlineTextStyle,Ei as supportsInlineTextStyleData,Gi as supportsLink,Ii as supportsLocked,Ti as supportsName,Fi as supportsOpacity,yi as supportsPins,hi as supportsPosition,Ai as supportsRotation,wi as supportsSVG,fi as supportsSize,bi as supportsSizeConstraints,xi as supportsVisible,ve as useMakeDraggable};
`))}catch{}throw n}var Tt="FileAsset",Ct="__class";function oe(t){return d(t)?t[Ct]===Tt:!1}var f=class{id;url;extension;constructor(e){this.url=e.url,this.id=e.id,this.extension=e.extension}};function re(t){return t instanceof f}var Nt="ImageAsset",Dt="__class";function W(t){return d(t)?t[Dt]===Nt:!1}var p=class t{id;url;thumbnailUrl;altText;resolution;#e;#t;constructor(e,n){a(y(n)),this.#t=n,this.url=e.url,this.id=e.id,this.thumbnailUrl=e.thumbnailUrl,this.altText=e.altText,this.resolution=e.resolution}cloneWithAttributes({altText:e,resolution:n}){return new t({__class:"ImageAsset",id:this.id,url:this.url,thumbnailUrl:this.thumbnailUrl,altText:e!==void 0?e:this.altText,resolution:n!==void 0?n:this.resolution},this.#t)}async measure(){return vt(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:n}=await this.getData(),i=new Blob([n],{type:e});return createImageBitmap(i)}async loadImage(){let e=await this.getData(),n=URL.createObjectURL(new Blob([e.bytes]));return new Promise((i,o)=>{let r=new Image;r.onload=()=>i(r),r.onerror=()=>o(),r.src=n})}};function ae(t){return t instanceof p}function x(t){return t.type==="bytes"?[t.bytes.buffer]:[]}function Ft(t){if(!d(t))return!1;let e="bytes",n="mimeType";return!(!(e in t)||!(n in t)||!(t[e]instanceof Uint8Array)||!s(t[n]))}async function z(t){if(t instanceof File)return fe(t);let e=await we(t.image);return{name:t.name,altText:t.altText,resolution:t.resolution,...e}}async function ye(t){if(t instanceof File)return fe(t);let e=await we(t.file);return{name:t.name,...e}}async function we(t){return t instanceof File?fe(t):Ft(t)?{type:"bytes",mimeType:t.mimeType,bytes:t.bytes}:{type:"url",url:t}}function he(t){return Promise.all(t.map(z))}async function fe(t){return new Promise((e,n)=>{let i=new FileReader;i.onload=o=>{let r=t.type,l=o.target?.result;if(!l||!(l instanceof ArrayBuffer)){n(new Error("Failed to read file, arrayBuffer is null"));return}let b=new Uint8Array(l);e({bytes:b,mimeType:r,type:"bytes",name:t.name})},i.onerror=o=>{n(o)},i.readAsArrayBuffer(t)})}async function vt(t){let e=t instanceof File,n=e?URL.createObjectURL(t):t,i=new Image;return i.crossOrigin="anonymous",i.src=n,await i.decode().finally(()=>{e&&URL.revokeObjectURL(n)}),{height:i.height,width:i.width}}var St="Font";function Ee(t){return d(t)&&t.__class===St}function kt(t){if(!A(t))return!1;switch(t){case 100:case 200:case 300:case 400:case 500:case 600:case 700:case 800:case 900:return!0;default:return!1}}function At(t){if(!s(t))return!1;switch(t){case"normal":case"italic":return!0;default:return!1}}function U(t){return d(t)?s(t.family)&&s(t.selector)&&kt(t.weight)&&At(t.style):!1}var T=class{selector;family;weight;style;constructor(e){this.selector=e.selector,this.family=e.family,this.weight=e.weight,this.style=e.style}},Re=new Map;function C(t){let e=Re.get(t.selector);if(e)return e;let n=new T(t);return Re.set(t.selector,n),n}function N(t){return{__class:"Font",selector:t.selector,family:t.family,weight:t.weight,style:t.style}}var Le="__class",be="LinearGradient",Pe="RadialGradient",Ie="ConicGradient";function se(t){if(!d(t))return!1;switch(t[Le]){case be:case Pe:case Ie:return!0;default:return!1}}function K(t){return t instanceof w||t instanceof R||t instanceof E}function Ve(t){if(t instanceof w)return{__class:be,angle:t.angle,stops:t.stops};if(t instanceof R)return{__class:Pe,width:t.width,height:t.height,x:t.x,y:t.y,stops:t.stops};if(t instanceof E)return{__class:Ie,angle:t.angle,x:t.x,y:t.y,stops:t.stops};I(t)}function le(t){switch(t[Le]){case be:return new w(t);case Pe:return new R(t);case Ie:return new E(t);default:I(t)}}var w=class t{angle;stops;constructor(e){this.angle=e.angle,this.stops=e.stops,Object.freeze(this)}cloneWithAttributes(e){return new t({angle:e.angle??this.angle,stops:e.stops??this.stops})}toCSS(){let e=this.stops.map(n=>`${n.color} ${n.position*100}%`).join(", ");return`linear-gradient(${this.angle}deg, ${e})`}},R=class t{width;height;x;y;stops;constructor(e){this.width=e.width,this.height=e.height,this.x=e.x,this.y=e.y,this.stops=e.stops,Object.freeze(this)}cloneWithAttributes(e){return new t({width:e.width??this.width,height:e.height??this.height,x:e.x??this.x,y:e.y??this.y,stops:e.stops??this.stops})}toCSS(){let e=this.stops.map((n,i)=>{let o=this.stops[i+1],r=n.position===1&&o?.position===1?n.position-1e-4:n.position;return`${n.color} ${r*100}%`}).join(", ");return`radial-gradient(${this.width} ${this.height} at ${this.x} ${this.y}, ${e})`}},E=class t{angle;x;y;stops;constructor(e){this.angle=e.angle,this.x=e.x,this.y=e.y,this.stops=e.stops,Object.freeze(this)}cloneWithAttributes(e){return new t({angle:e.angle??this.angle,x:e.x??this.x,y:e.y??this.y,stops:e.stops??this.stops})}toCSS(){let e=this.stops.map(n=>`${n.color} ${n.position*360}deg`).join(", ");return`conic-gradient(from ${this.angle}deg at ${this.x} ${this.y}, ${e})`}};var Wt="ColorStyle",wt="__class";function D(t){return d(t)?t[wt]===Wt:!1}var g=class t{id;name;light;dark;#e;constructor(e,n){a(s(e.id),"Style must have an id"),this.id=e.id,this.name=e.name,this.light=e.light,this.dark=e.dark,a(y(n)),this.#e=n}async setAttributes(e){let n=await this.#e.invoke("setColorStyleAttributes",this.id,e);return n?new t(n,this.#e):null}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async setPluginData(e,n){return this.#e.invoke("setPluginDataForNode",this.id,e,n)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}async remove(){return this.#e.invoke("removeColorStyle",this.id)}};function F(t){return t instanceof g}function xe(t){return{__class:"ColorStyle",id:t.id,name:t.name,light:t.light,dark:t.dark}}var Rt="TextStyle",Et="__class";function Me(t){return d(t)?t[Et]===Rt:!1}var h=class t{id;name;tag;font;boldFont;italicFont;boldItalicFont;color;transform;alignment;decoration;balance;breakpoints;minWidth;fontSize;letterSpacing;lineHeight;paragraphSpacing;#e;constructor(e,n){a(s(e.id),"Style must have an id"),this.id=e.id,this.name=e.name,this.tag=e.tag,this.font=new T(e.font),this.boldFont=e.boldFont?new T(e.boldFont):null,this.italicFont=e.italicFont?new T(e.italicFont):null,this.boldItalicFont=e.boldItalicFont?new T(e.boldItalicFont):null,this.color=D(e.color)?new g(e.color,n):e.color,this.transform=e.transform,this.alignment=e.alignment,this.decoration=e.decoration,this.balance=e.balance,this.breakpoints=e.breakpoints,this.minWidth=e.minWidth,this.fontSize=e.fontSize,this.letterSpacing=e.letterSpacing,this.lineHeight=e.lineHeight,this.paragraphSpacing=e.paragraphSpacing,a(y(n)),this.#e=n}async setAttributes(e){let n=await this.#e.invoke("setTextStyleAttributes",this.id,e);return n?new t(n,this.#e):null}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async setPluginData(e,n){return this.#e.invoke("setPluginDataForNode",this.id,e,n)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}async remove(){return this.#e.invoke("removeTextStyle",this.id)}};function L(t){return t instanceof h}function Ge(t){return{__class:"TextStyle",id:t.id,name:t.name,tag:t.tag,font:N(t.font),boldFont:t.boldFont?N(t.font):null,italicFont:t.italicFont?N(t.italicFont):null,boldItalicFont:t.boldItalicFont?N(t.boldItalicFont):null,color:F(t.color)?xe(t.color):t.color,transform:t.transform,alignment:t.alignment,decoration:t.decoration,balance:t.balance,breakpoints:t.breakpoints,minWidth:t.minWidth,fontSize:t.fontSize,letterSpacing:t.letterSpacing,lineHeight:t.lineHeight,paragraphSpacing:t.paragraphSpacing}}function de(t){if(Vt(t))return Mt(t);if(ge(t))return t.map(de);if(d(t)&&!(t instanceof Uint8Array)){let e={};for(let n in t)e[n]=de(t[n]);return e}return t}function Be(t,e){let n={};for(let i in t)n[i]=Te(t[i],e);return n}function Te(t,e){if(Lt(t))switch(t.__class){case"ImageAsset":return new p(t,e);case"FileAsset":return new f(t);case"LinearGradient":case"RadialGradient":case"ConicGradient":return le(t);case"TextStyle":return new h(t,e);case"Font":return C(t);case"ColorStyle":return new g(t,e);default:I(t)}if(d(t)){let n={};for(let i in t)n[i]=Te(t[i],e);return n}return ge(t)?t.map(n=>Te(n,e)):t}function Lt(t){return!!(W(t)||oe(t)||se(t))}function Vt(t){return!!(ae(t)||re(t)||K(t)||L(t)||U(t)||F(t))}function Mt(t){if(ae(t))return{__class:"ImageAsset",id:t.id,thumbnailUrl:t.thumbnailUrl,url:t.url,altText:t.altText,resolution:t.resolution};if(re(t))return{__class:"FileAsset",id:t.id,extension:t.extension,url:t.url};if(K(t))return Ve(t);if(L(t))return Ge(t);if(U(t))return N(t);if(F(t))return xe(t);I(t)}function Gt(t,e){let n={};for(let i in t.fieldData){let o=t.fieldData[i];if(o)switch(o.type){case"image":if(W(o.value)){n[i]={...o,value:new p(o.value,e)};break}n[i]={...o,value:o.value};break;case"file":if(oe(o.value)){n[i]={...o,value:new f(o.value)};break}n[i]={...o,value:o.value};break;case"color":if(D(o.value)){n[i]={...o,value:new g(o.value,e)};break}n[i]={...o,value:o.value};break;default:n[i]=o}}return{...t,fieldData:n}}var H=class{id;name;readonly;#e;constructor(e,n){a(s(e.id),"Node must have an id"),a(s(e.name),"Node must have a name"),a(k(e.readonly),"Readonly must be set"),this.id=e.id,this.name=e.name,this.readonly=e.readonly,a(y(n)),this.#e=n,Object.freeze(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("getManagedCollectionFields",this.id)}async setFields(e){return this.#e.invoke("setManagedCollectionFields",this.id,e)}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,n){return this.#e.invoke("setPluginDataForNode",this.id,e,n)}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}},V=class{id;name;slugFieldName;readonly;#e;constructor(e,n){a(s(e.id),"Node must have an id"),a(s(e.name),"Node must have a name"),a(k(e.readonly),"Readonly must be set"),a(e.slugFieldName===null||s(e.slugFieldName),"Node slug field name must be a string or null"),this.id=e.id,this.name=e.name,this.slugFieldName=e.slugFieldName,this.readonly=e.readonly,a(y(n)),this.#e=n,Object.freeze(this)}async setItemOrder(e){return this.#e.invoke("setCollectionItemOrder",this.id,e)}async getFields(){return this.#e.invoke("getCollectionFields",this.id,!0)}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(n=>new Ce(n,this.#e))}async addItems(e){await this.#e.invoke("addCollectionItems2",this.id,e)}async removeItems(e){return this.#e.invoke("removeNodes",e)}async setAsActive(){return this.#e.invoke("setActiveCollection",this.id)}async setPluginData(e,n){return this.#e.invoke("setPluginDataForNode",this.id,e,n)}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}},Ce=class t{id;slug;draft;fieldData;#e;constructor(e,n){let i=Gt(e,n);this.id=i.id,this.slug=i.slug,this.draft=i.draft??!1,this.fieldData=i.fieldData,a(y(n)),this.#e=n,Object.freeze(this),Object.freeze(this.fieldData)}async remove(){return this.#e.removeNodes([this.id])}async setAttributes(e){let n=await this.#e.invoke("setCollectionItemAttributes2",this.id,e);return n?new t(n,this.#e):null}async setPluginData(e,n){return this.#e.invoke("setPluginDataForNode",this.id,e,n)}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}};var Bt=(()=>{let t=null;return{disableUntilMouseUp:()=>{if(t)return;t=document.createElement("style"),t.textContent="* { pointer-events: none !important; user-select: none !important; -webkit-user-select: none !important; }",document.head.appendChild(t);let e=()=>{t&&(document.head.removeChild(t),t=null,o())},n=r=>{r.buttons>0&&r.buttons&1||e()},i=()=>{e()};window.addEventListener("pointerup",n,!0),window.addEventListener("pointermove",n,!0),window.addEventListener("blur",i);function o(){window.removeEventListener("pointerup",n,!0),window.removeEventListener("pointermove",n,!0),window.removeEventListener("blur",i)}}}})(),_e=5,_t=(()=>{let t=1;return{next:()=>`drag-${t++}`}})();function Ot(){}function Oe(t,e,n){if(t.mode!=="canvas")return Ot;a(y(t));let i=_t.next(),o=document.body.style.cursor,r={type:"idle"},l=document.body,b=c=>{r.type!=="idle"&&(r.type==="dragging"&&t.invoke("onDragEnd",{...c,dragSessionId:i}),r={type:"idle"},It())},J=c=>{if(r.type==="idle")return;if(!(c.buttons>0&&!!(c.buttons&1))){b({cancelled:!1});return}let{clientX:ee,clientY:_}=c;if(r.type==="pointerDown"){let O=ee-r.dragStart.mouse.x,We=_-r.dragStart.mouse.y;if(Math.abs(O)<_e&&Math.abs(We)<_e)return;r={type:"dragging",dragStart:r.dragStart},t.invoke("onDragStart",r.dragStart),document.getSelection()?.empty(),Bt.disableUntilMouseUp()}l.setPointerCapture(c.pointerId);let te={x:ee,y:_};t.invoke("onDrag",{dragSessionId:i,mouse:te}).then(O=>{r.type==="dragging"&&(document.body.style.cursor=O??"")})},ve=c=>{c.key==="Escape"&&b({cancelled:!0})},Se=()=>{b({cancelled:!0})},ke=c=>{b({cancelled:!0});let B=e.getBoundingClientRect(),ee={x:B.x,y:B.y,width:B.width,height:B.height},_,te=e.querySelectorAll("svg");if(te.length===1){let ne=te.item(0).getBoundingClientRect();_={x:ne.x,y:ne.y,width:ne.width,height:ne.height}}let O={x:c.clientX,y:c.clientY};r={type:"pointerDown",dragStart:{dragSessionId:i,elementRect:ee,svgRect:_,mouse:O}},t.invoke("setDragData",i,n()),l.addEventListener("pointermove",J,!0),l.addEventListener("pointerup",J,!0),window.addEventListener("keydown",ve,!0),window.addEventListener("blur",Se)},Ae=()=>{let c=n();c.type==="detachedComponentLayers"&&t.invoke("preloadDetachedComponentLayers",c.url),c.type==="image"&&t.invoke("preloadImageUrlForInsertion",c.image),c.previewImage&&t.invoke("preloadDragPreviewImage",c.previewImage)};e.addEventListener("pointerdown",ke),e.addEventListener("mouseenter",Ae);function It(){document.body.style.cursor=o,l.removeEventListener("pointermove",J,!0),l.removeEventListener("pointerup",J,!0),window.removeEventListener("keydown",ve,!0),window.removeEventListener("blur",Se)}return()=>{e.removeEventListener("pointerdown",ke),e.removeEventListener("mouseenter",Ae),b({cancelled:!0})}}var j=class extends Error{};var ze={canvas:!0,image:!0,editImage:!0,configureManagedCollection:!0,syncManagedCollection:!0,collection:!0,localization:!0},An=Object.keys(ze);function Ue(t){return s(t)&&Object.hasOwn(ze,t)}var zt={methodResponse:!0,pluginReadyResponse:!0,subscriptionMessage:!0};function Ut(t){return s(t)&&t in zt}function Ke(t){return d(t)&&Ut(t["type"])}var P=class{id;#e;#t;#n;constructor(e,n){a(s(e.id),"Node must have an id"),this.id=e.id,this.#t=n,this.#e=e.originalId??null,a(y(n)),this.#n=n}get isReplica(){return this.#e!==null}remove(){return this.#t.removeNodes([this.id])}select(){return this.#t.setSelection([this.id])}clone(){return this.#t.cloneNode(this.id)}setAttributes(e){return this.#t.setAttributes(this.id,e)}getRect(){return this.#t.getRect(this.id)}zoomIntoView(e){return this.#t.zoomIntoView([this.id],e)}getParent(){return this.#t.getParent(this.id)}getChildren(){return v(this)?Promise.resolve([]):this.#t.getChildren(this.id)}async getNodesWithType(e){return v(this)?Promise.resolve([]):(await this.#n.invoke("getNodesWithType",this.id,e)).map(i=>u(i,this.#t))}async getNodesWithAttribute(e){return v(this)?Promise.resolve([]):(await this.#n.invoke("getNodesWithAttribute",this.id,e)).map(i=>u(i,this.#t))}async getNodesWithAttributeSet(e){return v(this)?Promise.resolve([]):(await this.#n.invoke("getNodesWithAttributeSet",this.id,e)).map(i=>u(i,this.#t))}async*walk(){if(yield this,!v(this))for(let e of await this.getChildren())yield*e.walk()}async getPluginData(e){return this.#n.invoke("getPluginDataForNode",this.id,e)}async setPluginData(e,n){return this.#n.invoke("setPluginDataForNode",this.id,e,n)}async getPluginDataKeys(){return this.#n.invoke("getPluginDataKeysForNode",this.id)}},S=class extends P{__class="FrameNode";name;visible;locked;backgroundColor;backgroundImage;backgroundGradient;rotation;opacity;borderRadius;position;top;right;bottom;left;centerX;centerY;width;height;maxWidth;minWidth;maxHeight;minHeight;aspectRatio;link;linkOpenInNewTab;constructor(e,n){super(e,n),a(e.__class==="FrameNode","FrameNode must have a __class property"),this.name=e.name??null,this.visible=e.visible??!0,this.locked=e.locked??!1,this.backgroundColor=D(e.backgroundColor)?new g(e.backgroundColor,n):e.backgroundColor??null,this.backgroundImage=e.backgroundImage?new p(e.backgroundImage,n):null,this.rotation=e.rotation??0,this.opacity=e.opacity??1,this.borderRadius=e.borderRadius??null,this.backgroundGradient=se(e.backgroundGradient)?le(e.backgroundGradient):null,a(e.position,"Must have a position"),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.link=e.link??null,this.linkOpenInNewTab=e.linkOpenInNewTab??null,Object.freeze(this)}clone(){return super.clone()}setAttributes(e){return super.setAttributes(e)}},$=class extends P{__class="TextNode";name;visible;locked;rotation;opacity;font;inlineTextStyle;position;top;right;bottom;left;centerX;centerY;width;height;maxWidth;minWidth;maxHeight;minHeight;link;linkOpenInNewTab;#e;constructor(e,n){super(e,n),a(y(n)),this.#e=n,this.name=e.name??null,this.visible=e.visible??!0,this.locked=e.locked??!1,this.rotation=e.rotation??0,this.opacity=e.opacity??1,this.font=e.font?C(e.font):null,this.inlineTextStyle=e.inlineTextStyle?new h(e.inlineTextStyle,n):null,a(e.position,"Must have a position"),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,Object.freeze(this)}clone(){return super.clone()}setAttributes(e){return super.setAttributes(e)}async setText(e){await this.#e.invoke("setTextForNode",this.id,e)}async getText(){return this.#e.invoke("getTextForNode",this.id)}},X=class extends P{__class="SVGNode";name;visible;locked;svg;rotation;opacity;position;top;right;bottom;left;centerX;centerY;width;height;constructor(e,n){super(e,n),a(e.svg,"SVG node must have a non-empty SVG string"),this.name=e.name??null,this.visible=e.visible??!0,this.locked=e.locked??!1,this.svg=e.svg,this.rotation=e.rotation??0,this.opacity=e.opacity??1,a(e.position,"Must have a position"),this.position=e.position??null,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,Object.freeze(this)}clone(){return super.clone()}setAttributes(e){return super.setAttributes(e)}},Y=class extends P{__class="ComponentInstanceNode";name;visible;locked;componentIdentifier;insertURL;componentName;controls;rotation;opacity;position;top;right;bottom;left;centerX;centerY;width;height;maxWidth;minWidth;maxHeight;minHeight;aspectRatio;constructor(e,n){super(e,n),a(e.componentIdentifier,"ComponentInstance node must have a component identifier"),this.name=e.name??null,this.visible=e.visible??!0,this.locked=e.locked??!1,this.componentIdentifier=e.componentIdentifier,this.componentName=e.componentName??null,this.insertURL=e.insertURL??null,this.controls=Be(e.controls??{},n),this.rotation=e.rotation??0,this.opacity=e.opacity??1,a(e.position,"Must have a position"),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,Object.freeze(this)}clone(){return super.clone()}setAttributes(e){return super.setAttributes(e)}},q=class extends P{_class="WebPageNode";path;collectionId;constructor(e,n){super(e,n),a(e),this.path=e.path??null,this.collectionId=e.collectionId??null,Object.freeze(this)}clone(){return super.clone()}setAttributes(e){return super.setAttributes(e)}},Z=class extends P{__class="ComponentNode";name;componentIdentifier;insertURL;componentName;constructor(e,n){super(e,n),a(e.componentIdentifier,"ComponentNode must have a componentIdentifier"),this.componentIdentifier=e.componentIdentifier,this.insertURL=e.insertURL??null,this.componentName=e.componentName??null,this.name=e.name??null,Object.freeze(this)}clone(){return super.clone()}setAttributes(e){return super.setAttributes(e)}},Q=class extends P{__class="UnknownNode";constructor(e,n){super(e,n),Object.freeze(this)}clone(){throw Error("Can not clone unknown node")}setAttributes(e){throw Error("Can not set attributes on unknown node")}};function u(t,e){switch(t.__class){case"WebPageNode":return new q(t,e);case"ComponentNode":return new Z(t,e);case"ComponentInstanceNode":return new Y(t,e);case"FrameNode":return new S(t,e);case"SVGNode":return new X(t,e);case"TextNode":return new $(t,e);case"UnknownNode":return new Q(t,e);default:return new Q(t,e)}}function ue(t){return t instanceof S}function He(t){return t instanceof $}function je(t){return t instanceof X}function ce(t){return t instanceof Y}function $e(t){return t instanceof q}function Xe(t){return t instanceof Z}function v(t){return t instanceof Q}function me(t){return!!(ue(t)||He(t)||ce(t)||je(t)||v(t))}function Ne(t){return!!($e(t)||Xe(t)||v(t))}var M=null;function Ye(t){if(!M){let n=document.createElement("style");document.head.appendChild(n),M=n.sheet}if(!M){t();return}let e=M.insertRule("* { transition: none !important; animation: none !important; }");t(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{M&&M.deleteRule(e)})})}var pe=class{#e=0;#t=0;#n=[];#o=void 0;#r=new Map;#i;subscriptions=new Map;constructor({isTestEnv:e}={}){if(e){this.#i="canvas";return}if(typeof window>"u"){console.warn("Framer Plugin API is not supported in non-browser environments"),this.#i="canvas";return}let i=new URL(window.location.href).searchParams.get("mode");a(Ue(i),`Invalid mode: ${i}`),this.#i=i,window.addEventListener("message",this.onMessage);let o={type:"pluginReadySignal"};window.parent.postMessage(o,"*"),this.subscribe("theme",this.applyPluginTheme),window.addEventListener("pointerdown",()=>{this.invoke("onPointerDown")})}get mode(){return this.#i}invoke(e,...n){return this.invokeTransferable(e,void 0,...n)}invokeTransferable(e,n,...i){return new Promise((o,r)=>{let l={args:i,methodName:e,id:this.#e++,type:"methodInvocation"},b=o;this.#r.set(l.id,{resolve:b,reject:r}),this.queueMessage(l,n)})}subscribe(e,n){this.queueMessage({type:"subscribe",topic:e});let i=this.subscriptions.get(e)??new Set;return i.add(n),this.subscriptions.set(e,i),()=>{let o=this.subscriptions.get(e)??new Set;o.delete(n),o.size===0&&this.queueMessage({type:"unsubscribe",topic:e}),this.subscriptions.set(e,o)}}queueMessage(e,n){if(e.type==="methodInvocation"&&(e.args=e.args.map(de)),!this.#o){this.#n.push([e,n]);return}this.#o(e,n)}onMessage=e=>{let n=e.data;if(Ke(n))switch(n.type){case"pluginReadyResponse":{if(!e.source)throw new Error("No 'source' on incoming message: "+n.type);a(this.#i===n.mode,"Mode must match"),this.applyPluginTheme(n.theme),this.#o=(o,r)=>window.parent.postMessage(o,e.origin,r);for(let o of this.#n)this.#o(...o);this.#n=[];break}case"methodResponse":{let i=this.#r.get(n.id);if(!i)throw new Error(`No handler for response with id ${n.id}`);this.#r.delete(n.id),n.error?i.reject(new j(n.error)):i.resolve(n.result);break}case"subscriptionMessage":{let{topic:i,payload:o}=n,r=this.subscriptions.get(i);if(!r)throw new Error("Received a subscription message but no handler present");for(let l of r)l(o);break}default:I(n)}};applyPluginTheme=e=>{Ye(()=>{document.body.setAttribute("data-framer-theme",e.mode);for(let n in e.tokens)document.body.style.setProperty(n,e.tokens[n])})};async showUI(e){return this.invoke("showUI",e)}async hideUI(){return this.invoke("hideUI")}async closePlugin(e,n){return this.invoke("closePlugin",e,n)}async getCurrentUser(){return this.invoke("getCurrentUser2")}async getProjectInfo(){return this.invoke("getProjectInfo2")}async getSelection(){return(await this.invoke("getSelection")).map(n=>{let i=u(n,this);return a(me(i)),i})}async setSelection(e){let n=s(e)?[e]:Array.from(e);return this.invoke("setSelection",n)}subscribeToSelection(e){return this.subscribe("selection",n=>{let i=n.map(o=>{let r=u(o,this);return a(me(r)),r});e(i)})}async getCanvasRoot(){let e=await this.invoke("getCanvasRoot"),n=u(e,this);return a(Ne(n)),n}subscribeToCanvasRoot(e){return this.subscribe("canvasRoot",n=>{let i=u(n,this);a(Ne(i)),e(i)})}async getPublishInfo(){return this.invoke("getPublishInfo")}subscribeToPublishInfo(e){return this.subscribe("publishInfo",e)}async createFrameNode(e,n){let i=await this.invoke("createNode","FrameNode",n??null,e);if(!i)return null;let o=u(i,this);return a(o instanceof S),o}async removeNodes(e){return this.invoke("removeNodes",e)}async removeNode(e){return this.removeNodes([e])}async cloneNode(e){let n=await this.invoke("cloneNode",e);return n?u(n,this):null}async getNode(e){let n=await this.invoke("getNode",e);return n?u(n,this):null}async getParent(e){let n=await this.invoke("getParent",e);return n?u(n,this):null}async getChildren(e){return(await this.invoke("getChildren",e)).map(i=>{let o=u(i,this);return a(me(o)),o})}async getRect(e){return this.invoke("getRect",e)}async zoomIntoView(e,n){let i=s(e)?[e]:Array.from(e);return this.invoke("zoomIntoView",i,n)}async setAttributes(e,n){let i=await this.invoke("setAttributes",e,n);return i?u(i,this):null}async setParent(e,n,i){return this.invoke("setParent",e,n,i)}async getNodesWithType(e){return(await this.invoke("getNodesWithType",null,e)).map(i=>u(i,this))}async getNodesWithAttribute(e){return(await this.invoke("getNodesWithAttribute",null,e)).map(i=>u(i,this))}async getNodesWithAttributeSet(e){return(await this.invoke("getNodesWithAttributeSet",null,e)).map(i=>u(i,this))}async getImage(){let e=await this.invoke("getImage");return e?new p(e,this):null}subscribeToImage(e){return this.subscribe("image",n=>{if(!n){e(null);return}e(new p(n,this))})}async addImage(e){let n=await z(e),i=x(n);return this.invokeTransferable("addImage",i,n)}async setImage(e){let n=await z(e),i=x(n);return this.invokeTransferable("setImage",i,n)}async uploadImage(e){let n=await z(e),i=x(n),o=await this.invokeTransferable("uploadImage",i,n);return new p(o,this)}async addImages(e){let n=await he(e),i=n.flatMap(x);await this.invokeTransferable("addImages",i,n)}async uploadImages(e){let n=await he(e),i=n.flatMap(x),o=await this.invokeTransferable("uploadImages",i,n),r=[];for(let l of o)r.push(new p(l,this));return r}async uploadFile(e){let n=await ye(e),i=await this.invokeTransferable("uploadFile",x(n),n);return new f(i)}async uploadFiles(e){let n=await Promise.all(e.map(ye)),i=n.flatMap(x),o=await this.invokeTransferable("uploadFiles",i,n),r=[];for(let l of o)r.push(new f(l));return r}async addSVG(e){return this.invoke("addSVG",e)}async addComponentInstance({url:e,attributes:n}){let i=await this.invoke("addComponentInstance",{url:e,attributes:n}),o=u(i,this);return a(ce(o)),o}async addDetachedComponentLayers({url:e,layout:n,attributes:i}){let o=await this.invoke("addDetachedComponentLayers",{url:e,layout:n,attributes:i}),r=u(o,this);return a(ue(r)),r}async preloadDetachedComponentLayers(e){await this.invoke("preloadDetachedComponentLayers",e)}async preloadImageUrlForInsertion(e){await this.invoke("preloadImageUrlForInsertion",e)}async preloadDragPreviewImage(e){await this.invoke("preloadDragPreviewImage",e)}async getText(){return this.invoke("getText")}async setText(e){return this.invoke("setText",e)}async addText(e,n){return this.invoke("addText",e,n)}async setCustomCode(e){return this.invoke("setCustomCode",e)}async getCustomCode(){return this.invoke("getCustomCode")}subscribeToCustomCode(e){return this.subscribe("customCode",e)}subscribeToText(e){return this.subscribe("text",e)}makeDraggable(e,n){return Oe(this,e,n)}async getActiveManagedCollection(){let e=await this.invoke("getActiveManagedCollection");return a(e,"Collection data must be defined"),new H(e,this)}async getManagedCollection(){return this.getActiveManagedCollection()}async getManagedCollections(){let e=await this.invoke("getManagedCollections");return a(e,"Collections data must be defined"),e.map(n=>new H(n,this))}async getCollection(e){let n=await this.invoke("getCollection",e);return n?new V(n,this):null}async getActiveCollection(){let e=await this.invoke("getActiveCollection");return e?new V(e,this):null}async getCollections(){return(await this.invoke("getCollections")).map(n=>new V(n,this))}notify(e,n){let i=`notification-${this.#t++}`;return this.invoke("notify",e,{notificationId:i,variant:n?.variant??"info",buttonText:n?.button?.text,durationMs:n?.durationMs}).then(o=>{o==="actionButtonClicked"&&n?.button?.onClick&&n.button.onClick(),n?.onDisappear&&n.onDisappear()}),{close:()=>this.invoke("closeNotification",i)}}async getPluginData(e){return this.invoke("getPluginData",e)}async setPluginData(e,n){return this.invoke("setPluginData",e,n)}async getPluginDataKeys(){return this.invoke("getPluginDataKeys")}async getColorStyles(){return(await this.invoke("getColorStyles")).map(n=>new g(n,this))}async getColorStyle(e){let n=await this.invoke("getColorStyle",e);return n?new g(n,this):null}async createColorStyle(e){let n=await this.invoke("createColorStyle",e);return new g(n,this)}subscribeToColorStyles(e){return this.subscribe("colorStyles",n=>{let i=n.map(o=>new g(o,this));return e(i)})}async getTextStyles(){return(await this.invoke("getTextStyles")).map(n=>new h(n,this))}async getTextStyle(e){let n=await this.invoke("getTextStyle",e);return n?new h(n,this):null}async createTextStyle(e){let n=await this.invoke("createTextStyle",e);return new h(n,this)}subscribeToTextStyles(e){return this.subscribe("textStyles",n=>{let i=n.map(o=>new h(o,this));return e(i)})}async getFont(e,n){let i=await this.invoke("getFont",e,n);return i?C(i):null}async getFonts(){return(await this.invoke("getFonts")).map(C)}unstable_getLocales(){return this.invoke("unstable_getLocales")}unstable_getDefaultLocale(){return this.invoke("unstable_getDefaultLocale")}unstable_getActiveLocale(){return this.invoke("unstable_getActiveLocale")}async unstable_getLocalizationGroups(){return this.invoke("unstable_getLocalizationGroups")}unstable_setLocalizationData(e){return this.invoke("unstable_setLocalizationData",e)}async unstable_createCodeFile(e,n){return this.invoke("unstable_createCodeFile",e,n)}async unstable_getCodeFileContent(e){return this.invoke("unstable_getCodeFileContent",e)}async unstable_setCodeFileContent(e,n){return this.invoke("unstable_setCodeFileContent",e,n)}async unstable_removeCodeFile(e){return this.invoke("unstable_removeCodeFile",e)}async unstable_renameCodeFile(e,n){return this.invoke("unstable_renameCodeFile",e,n)}async unstable_ensureMinimumDependencyVersion(e,n){return this.invoke("unstable_ensureMinimumDependencyVersion",e,n)}};var De=new pe;function Fe(t,e){let n=$t(()=>ie(e)?e():e);Ht(()=>{let i=t.current;if(i instanceof HTMLElement)return De.makeDraggable(i,n)},[n])}function $t(t){let e=jt(t);return e.current=t,Kt((...n)=>e.current(...n),[])}var Xt=G.forwardRef(function({data:e,children:n,...i},o){let r=G.useRef(null);if(Fe(r,e),G.isValidElement(n)){let l=Object.assign({},i);return d(n.props)&&Object.assign(l,n.props),l.ref=Zt(r,o,n.ref),G.cloneElement(n,l)}return G.Children.count(n)>1&&G.Children.only(n),null}),Yt="current";function qt(t){return d(t)&&Yt in t}function Zt(...t){return e=>{for(let n of t)ie(n)?n(e):qt(n)&&(n.current=e)}}var Qt={fixed:!0,sticky:!0,absolute:!0,relative:!0},qe="position";function yi(t){if(!(qe in t))return!1;let e=t[qe];return s(e)&&Qt[e]===!0}var Ze="top";function hi(t){if(!(Ze in t))return!1;let e=t[Ze];return s(e)||m(e)}var Qe="width";function fi(t){if(!(Qe in t))return!1;let e=t[Qe];return s(e)||m(e)}var Je="maxWidth";function bi(t){if(!(Je in t))return!1;let e=t[Je];return s(e)||m(e)}var et="aspectRatio";function Pi(t){if(!(et in t))return!1;let e=t[et];return A(e)||m(e)}var tt="name";function Ii(t){if(!(tt in t))return!1;let e=t[tt];return s(e)||m(e)}var nt="visible";function xi(t){if(!(nt in t))return!1;let e=t[nt];return k(e)}var it="locked";function Ti(t){if(!(it in t))return!1;let e=t[it];return k(e)}var ot="backgroundColor";function Ci(t){if(!(ot in t))return!1;let e=t[ot];return s(e)||F(e)||m(e)}var rt="backgroundColor";function Ni(t){if(!(rt in t))return!1;let e=t[rt];return s(e)||D(e)||m(e)}var at="backgroundImage";function Di(t){if(!(at in t))return!1;let e=t[at];return e instanceof p||m(e)}var st="backgroundImage";function Fi(t){if(!(st in t))return!1;let e=t[st];return e instanceof p?!1:W(e)||m(e)}var lt="backgroundGradient";function vi(t){if(!(lt in t))return!1;let e=t[lt];return K(e)||m(e)}var dt="backgroundGradient";function Si(t){if(!(dt in t))return!1;let e=t[dt];return d(e)||m(e)}var ut="rotation";function ki(t){if(!(ut in t))return!1;let e=t[ut];return A(e)}var ct="opacity";function Ai(t){if(!(ct in t))return!1;let e=t[ct];return A(e)}var mt="borderRadius";function Wi(t){if(!(mt in t))return!1;let e=t[mt];return s(e)||m(e)}var pt="svg";function wi(t){if(!(pt in t))return!1;let e=t[pt];return s(e)}var gt="componentIdentifier";function Ri(t){if(!(gt in t))return!1;let e=t[gt];return s(e)}var yt="font";function Ei(t){if(!(yt in t))return!1;let e=t[yt];return U(e)}var ht="font";function Li(t){if(!(ht in t))return!1;let e=t[ht];return Ee(e)||m(e)}var ft="inlineTextStyle";function Vi(t){if(!(ft in t))return!1;let e=t[ft];return L(e)||m(e)}var bt="inlineTextStyle";function Mi(t){if(!(bt in t))return!1;let e=t[bt];return Me(e)||m(e)}var Pt="link";function Gi(t){if(!(Pt in t))return!1;let e=t[Pt];return s(e)||m(e)}export{Y as ComponentInstanceNode,Z as ComponentNode,E as ConicGradient,Xt as Draggable,S as FrameNode,j as FramerPluginError,w as LinearGradient,R as RadialGradient,X as SVGNode,$ as TextNode,q as WebPageNode,De as framer,F as isColorStyle,ce as isComponentInstanceNode,Xe as isComponentNode,re as isFileAsset,ue as isFrameNode,ae as isImageAsset,je as isSVGNode,He as isTextNode,L as isTextStyle,$e as isWebPageNode,Pi as supportsAspectRatio,Ci as supportsBackgroundColor,Ni as supportsBackgroundColorData,vi as supportsBackgroundGradient,Si as supportsBackgroundGradientData,Di as supportsBackgroundImage,Fi as supportsBackgroundImageData,Wi as supportsBorderRadius,Ri as supportsComponentInfo,Ei as supportsFont,Li as supportsFontData,Vi as supportsInlineTextStyle,Mi as supportsInlineTextStyleData,Gi as supportsLink,Ti as supportsLocked,Ii as supportsName,Ai as supportsOpacity,hi as supportsPins,yi as supportsPosition,ki as supportsRotation,wi as supportsSVG,fi as supportsSize,bi as supportsSizeConstraints,xi as supportsVisible,Fe as useMakeDraggable};
{
"name": "framer-plugin",
"version": "2.2.0",
"version": "3.0.0-beta.0",
"type": "module",

@@ -5,0 +5,0 @@ "main": "src/index.ts",

@@ -35,21 +35,31 @@ export type { ImageAsset } from "./assets"

export type {
FieldDataEntry,
BooleanField,
Collection,
CollectionField,
CollectionItem,
CollectionField,
CollectionItemData,
CollectionItemInput,
CollectionReferenceField,
ColorField,
DateField,
EditableManagedCollectionField,
EnumCase,
EnumField,
FieldData,
FieldDataInput,
FieldDivider,
FileField,
FieldDataEntryInput,
FormattedTextField,
ImageField,
LinkField,
ManagedCollection,
ManagedCollectionField,
SupportedCollectionField,
CollectionItemData,
ManagedCollectionItemInput,
CollectionItemInput,
BooleanField,
ColorField,
MultiCollectionReferenceField,
NumberField,
StringField,
FormattedTextField,
ImageField,
LinkField,
DateField,
EnumField,
SupportedCollectionField,
UnsupportedField,
} from "./collections"

@@ -56,0 +66,0 @@ export type { TextTransform, TextAlignment, TextDecoration } from "./text"

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc