@rogieking/figui3 8.10.0 → 8.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/fig-lab.js CHANGED
@@ -1 +1,3 @@
1
- function L(J,Q){if(!customElements.get(J))customElements.define(J,Q)}function O(J,Q){return J.hasAttribute(Q)&&J.getAttribute(Q)!=="false"}var qJ="http://www.w3.org/2000/svg";function OJ(J,Q){let Z=($)=>{if($===null||$===void 0||$===!1)return;if(Array.isArray($)){$.forEach(Z);return}J.append($ instanceof Node?$:String($))};return Z(Q),J}function YJ(J,Q={}){for(let[Z,$]of Object.entries(Q)){if($===null||$===void 0||$===!1)continue;if(Z==="className")if(J.namespaceURI===qJ)J.setAttribute("class",String($));else J.className=String($);else if($===!0)J.setAttribute(Z,"");else J.setAttribute(Z,String($))}return J}function N(J,Q,Z){let $=document.createElement(J);return YJ($,Q),OJ($,Z)}function h(J,Q,Z){let $=document.createElementNS(qJ,J);return YJ($,Q),OJ($,Z)}function n(J,Q){let Z=O(J,"disabled");for(let $ of Q)$?.toggleAttribute("disabled",Z)}function xJ(J,Q,Z){let $=Number(Q),j=Number(Z),_=Number.isFinite($)?Math.max(0,Math.min(1,$)):Number.isFinite(j)?Math.max(0,Math.min(100,j))/100:1,X=Number.isFinite(j)?Math.max(0,Math.min(100,j)):Math.round(_*100);return{color:J,alpha:_,opacity:X}}var $J=new WeakMap;function W(J){let Q=$J.get(J);if(!Q){let Z=document.createElement("fig-menu");Z.setAttribute("position","bottom left"),Z.setAttribute("offset","0 0");let $=document.createElement("fig-menu-item");$.setAttribute("value","reset-default"),$.textContent="Reset",Z.appendChild($);let j=0,_=()=>{if(j)clearTimeout(j),j=0;window.removeEventListener("pointerup",X,!0),window.removeEventListener("pointercancel",X,!0)},X=()=>{_();let Y=Q?.point;if(Y)Z.showAt?.(Y.x,Y.y)};Q={menu:Z,point:null,clearPendingOpen:_,handleContextMenu:(Y)=>{if(O(J,"disabled")||Y.target?.closest?.("fig-menu"))return;Y.preventDefault(),Y.stopPropagation(),Y.stopImmediatePropagation?.(),Q.point={x:Y.clientX,y:Y.clientY},_(),window.addEventListener("pointerup",X,{once:!0,capture:!0}),window.addEventListener("pointercancel",X,{once:!0,capture:!0}),j=window.setTimeout(X,180)},handleChange:(Y)=>{if(Y.stopPropagation(),Y.detail?.value==="reset-default")J.resetToDefault?.()}},$J.set(J,Q)}if(Q.menu.parentElement!==J)J.appendChild(Q.menu);J.removeEventListener("contextmenu",Q.handleContextMenu),J.addEventListener("contextmenu",Q.handleContextMenu),Q.menu.removeEventListener("change",Q.handleChange),Q.menu.addEventListener("change",Q.handleChange)}function f(J){let Q=$J.get(J);if(!Q)return;Q.clearPendingOpen(),J.removeEventListener("contextmenu",Q.handleContextMenu),Q.menu.removeEventListener("change",Q.handleChange)}function hJ(J,Q=J.value){let Z={control:J.localName,value:Q},$=J.getAttribute("name");if($!==null&&$!=="")Z.name=$;return Z}function K(J,Q,Z=J.value){J.dispatchEvent(new CustomEvent(Q,{detail:hJ(J,Z),bubbles:!0,cancelable:!0,composed:!0}))}function d(J){if(J===null||J===void 0||String(J).trim()==="")return null;let Q=Number(J);return Number.isFinite(Q)?Q:null}function b(J){for(let Q of["input","change"])K(J,Q)}function o(J,Q){if(typeof J==="boolean"||typeof Q==="boolean")return Boolean(J)===Boolean(Q);return String(J??"")===String(Q??"")}function m(J,Q){let Z=($)=>{if(Array.isArray($))return $.map(Z);if($&&typeof $==="object")return Object.keys($).sort().reduce((j,_)=>{return j[_]=Z($[_]),j},{});return $};try{let $=typeof J==="string"?JSON.parse(J):J,j=typeof Q==="string"?JSON.parse(Q):Q;return JSON.stringify(Z($))===JSON.stringify(Z(j))}catch{return o(J,Q)}}function wJ(J,Q,Z=0.179){if(!J||!Q)return null;let $=document.createElement("span");$.style.cssText="position:absolute;visibility:hidden;pointer-events:none;color:"+Q,J.appendChild($);let j=getComputedStyle($).color;$.remove();let _=j.match(/[\d.]+/g)?.slice(0,3).map(Number),X=j.startsWith("rgb")?_:j.startsWith("color(srgb")&&_?_.map((M)=>M*255):null;if(!X||X.length<3||X.some(Number.isNaN))return null;let[q,B,Y]=X.map((M)=>{let k=M/255;return k<=0.04045?k/12.92:((k+0.055)/1.055)**2.4});return 0.2126*q+0.7152*B+0.0722*Y<=Z?"light":"dark"}var XJ=0;function GJ(J="fig-lab"){return XJ+=1,`${J}-${XJ}`}class S extends HTMLElement{get name(){return this.getAttribute("name")??""}set name(J){if(J===null||J===void 0||J==="")this.removeAttribute("name");else this.setAttribute("name",String(J))}}function C(J,Q,Z,$=!1){if(!Q||!Z)return null;let j=J.hasAttribute("label"),_=J.getAttribute("label")??"",X=j&&_.trim()==="";if(!$)Z.textContent=j?_:"Label";if(J.toggleAttribute("data-label-empty",X),X)return Z.remove(),null;if(!Z.id)Z.id=GJ(`${J.localName}-label`);if(Z.parentElement!==Q)Q.prepend(Z);return Z.id}function R(J,Q,Z,$="Label"){if(!Q)return;let j=J.getAttribute("aria-label")?.trim();if(j)Q.setAttribute("aria-label",j),Q.removeAttribute("aria-labelledby");else if(Z)Q.setAttribute("aria-labelledby",Z),Q.removeAttribute("aria-label");else Q.setAttribute("aria-label",$),Q.removeAttribute("aria-labelledby")}class MJ extends HTMLElement{}L("fig-ai-prompt",MJ);class kJ extends HTMLElement{}L("fig-ai-context",kJ);class NJ extends HTMLElement{}L("fig-chat-message",NJ);class PJ extends HTMLElement{#Z=null;#$=null;#J=null;#Q=null;#_=null;#j=null;#Y=this.#K.bind(this);#B=this.#U.bind(this);#M=this.#N.bind(this);static get observedAttributes(){return["src","name","value","removable","disabled"]}connectedCallback(){if(!this.#$)this.#X();this.#_.removeEventListener("click",this.#Y),this.#_.addEventListener("click",this.#Y),this.#q(),this.#O()}disconnectedCallback(){this.#_?.removeEventListener("click",this.#Y),this.#G()}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#$)return;this.#O()}#X(){this.#Z=document.createElement("fig-tooltip"),this.#Z.className="fig-attachment-tooltip",this.#$=document.createElement("fig-image"),this.#$.setAttribute("aspect-ratio","1/1"),this.#$.setAttribute("fit","cover"),this.#$.setAttribute("full",""),this.#J=document.createElement("span"),this.#J.className="fig-attachment-fallback",this.#J.setAttribute("aria-hidden","true"),this.#Q=document.createElement("fig-tooltip"),this.#Q.className="fig-attachment-remove-tooltip",this.#Q.setAttribute("text","Remove attachment"),this.#_=document.createElement("fig-button"),this.#_.className="fig-attachment-remove",this.#_.setAttribute("variant","overlay"),this.#_.setAttribute("size","small"),this.#_.setAttribute("icon","");let J=document.createElement("fig-icon");J.setAttribute("name","close"),J.setAttribute("size","small"),this.#_.append(J),this.#Q.append(this.#_),this.#$.append(this.#J),this.#Z.append(this.#$),this.replaceChildren(this.#Z,this.#Q),this.#_.addEventListener("click",this.#Y),this.#q()}#q(){let J=this.#$?.mediaEl;if(!J||J===this.#j)return;this.#G(),this.#j=J,this.#j.addEventListener("load",this.#B),this.#j.addEventListener("error",this.#M)}#G(){if(!this.#j)return;this.#j.removeEventListener("load",this.#B),this.#j.removeEventListener("error",this.#M),this.#j=null}#O(){let J=this.getAttribute("src")||"",Q=this.getAttribute("name")||"Attachment",Z=!this.hasAttribute("removable")||O(this,"removable"),$=O(this,"disabled");if(this.#Z.setAttribute("text",Q),this.#$.setAttribute("alt",Q),J)this.#$.setAttribute("src",J);else this.#$.removeAttribute("src");if(this.#q(),this.#J.textContent=this.#k(Q),this.#_.hidden=!Z,this.#_.toggleAttribute("disabled",$),this.#_.setAttribute("aria-label",`Remove ${Q}`),this.toggleAttribute("data-fallback",!J),$)this.setAttribute("aria-disabled","true");else this.removeAttribute("aria-disabled")}#k(J){let Q=J.split(/[\\/]/).pop()||"",Z=Q.lastIndexOf(".");return(Z>0&&Z<Q.length-1?Q.slice(Z+1).toUpperCase():"FILE").slice(0,4)}#U(){if(this.getAttribute("src"))this.removeAttribute("data-fallback")}#N(){this.setAttribute("data-fallback","")}#K(J){if(J.stopPropagation(),O(this,"disabled")||this.hasAttribute("removable")&&!O(this,"removable"))return;this.dispatchEvent(new CustomEvent("remove",{bubbles:!0,cancelable:!0,composed:!0,detail:{value:this.getAttribute("value"),name:this.getAttribute("name")||"",src:this.getAttribute("src")||"",attachment:this}}))}}L("fig-attachment",PJ);class LJ extends HTMLElement{#Z=null;connectedCallback(){if(!this.hasAttribute("role"))this.setAttribute("role","list"),this.setAttribute("data-generated-role","");if(this.#$(),!this.#Z)this.#Z=new MutationObserver(()=>this.#$()),this.#Z.observe(this,{childList:!0})}disconnectedCallback(){this.#Z?.disconnect(),this.#Z=null}#$(){for(let J of this.querySelectorAll(":scope > fig-attachment"))if(!J.hasAttribute("role"))J.setAttribute("role","listitem"),J.setAttribute("data-generated-role","")}}L("fig-attachments",LJ);class UJ extends S{#Z=null;#$=null;#J=null;#Q=!1;#_=null;#j=new Set;#Y=null;#B=null;#M=this.#T.bind(this);#X=!1;static get observedAttributes(){return["label","aria-label","variant"]}connectedCallback(){if(!this.#Z)this.#q();if(this.#k(),this.#N(),this.#K(),this.removeEventListener("click",this.#M),this.addEventListener("click",this.#M),W(this),!this.#_)this.#_=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="aria-label")Q=!0;else Z=!0}if(Q)this.#k();if(Z)this.#N()});this.#_.observe(this,{attributes:!0})}disconnectedCallback(){this.#_?.disconnect(),this.#P(),this.removeEventListener("click",this.#M),f(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="variant")this.#N();else if(J==="label"||J==="aria-label")this.#k()}#q(){this.#X=O(this,"checked");let Q=Array.from(this.childNodes).filter((j)=>j.nodeType!==Node.TEXT_NODE||Boolean(j.textContent?.trim())).find((j)=>j.nodeType===Node.ELEMENT_NODE&&j.matches("label")),Z=N("div",{className:"propskit-switch-surface"}),$=Q||document.createElement("label");Z.append($),this.#Z=Z,this.#$=$,this.#Q=Boolean(Q),this.replaceChildren(Z),this.#O()}#G(){return this.getAttribute("variant")==="segmented-control"?"segmented-control":"switch"}#O(){let J=this.#G()==="segmented-control"?"fig-segmented-control":"fig-switch";if(this.#J?.localName===J)return;this.#P(),this.#J?.remove();let Q=document.createElement(J);if(J==="fig-segmented-control"){let Z=document.createElement("fig-segment"),$=document.createElement("fig-segment");Q.setAttribute("sizing","equal"),Z.setAttribute("value","off"),Z.textContent="Off",$.setAttribute("value","on"),$.textContent="On",Q.append(Z,$)}if(this.#J=Q,this.#j.clear(),this.#Z?.append(Q),this.isConnected)this.#K()}#k(){let J=C(this,this.#Z,this.#$,this.#Q);if(R(this,this.#J,J,"Switch"),this.#J?.localName==="fig-switch"&&this.#J.input)R(this,this.#J.input,J,"Switch")}#U(){let J=new Set(["label","direction","size","aria-label","oninput","onchange","class","style","id","checked","value","default","variant"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#N(){if(this.#O(),!this.#J)return;let J=this.#U(),Q=new Set(J);for(let $ of this.#j)if(!Q.has($))this.#J.removeAttribute($);for(let $ of J)this.#J.setAttribute($,this.getAttribute($)??"");let Z=O(this,"checked");if(this.#J.localName==="fig-switch")this.#J.checked=Z,this.#J.value=Z?"on":"off";else this.#J.setAttribute("value",Z?"on":"off");this.#j=Q,this.#k()}#K(){if(!this.#J)return;this.#Y??=this.#L.bind(this,"input"),this.#B??=this.#L.bind(this,"change"),this.#J.addEventListener("input",this.#Y),this.#J.addEventListener("change",this.#B)}#P(){if(!this.#J)return;if(this.#Y)this.#J.removeEventListener("input",this.#Y);if(this.#B)this.#J.removeEventListener("change",this.#B)}#L(J,Q){if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let Z=this.#J?.localName==="fig-switch"?Boolean(this.#J.checked):this.#J?.value==="on";this.toggleAttribute("checked",Z),K(this,J)}#T(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-switch, fig-segmented-control, fig-menu"))return;if(this.#J?.localName==="fig-switch")this.#J.click();else{let Q=this.#J?.value==="on"?"off":"on";this.#J?.querySelector(`fig-segment[value="${Q}"]`)?.click()}}get checked(){if(!this.#J)return O(this,"checked");return this.#J.localName==="fig-switch"?Boolean(this.#J.checked):this.#J.value==="on"}set checked(J){let Q=Boolean(J);if(this.toggleAttribute("checked",Q),!this.#J)return;if(this.#J.localName==="fig-switch")this.#J.checked=Q,this.#J.value=Q?"on":"off";else this.#J.value=Q?"on":"off"}get value(){return this.checked}set value(J){let Q=typeof J==="string"?!["","false","off","0"].includes(J.trim().toLowerCase()):Boolean(J);this.checked=Q}get defaultValue(){return this.hasAttribute("default")?O(this,"default"):this.#X}get isDefault(){return this.checked===this.defaultValue}resetToDefault(){let J=this.defaultValue;this.checked=J,b(this)}focus(J){if(this.#J?.localName==="fig-switch")this.#J.focus(J);else(this.#J?.querySelector("fig-segment[selected]")||this.#J?.querySelector("fig-segment"))?.focus(J)}}L("propskit-switch",UJ);function v(J){let Q=String(J??"").trim();if(/^#[0-9a-fA-F]{8}$/.test(Q))return{color:Q.slice(0,7),alpha:parseInt(Q.slice(7,9),16)/255};if(/^#[0-9a-fA-F]{6}$/.test(Q))return{color:Q,alpha:1};if(/^#[0-9a-fA-F]{3}$/.test(Q))return{color:`#${Q[1]}${Q[1]}${Q[2]}${Q[2]}${Q[3]}${Q[3]}`,alpha:1};return{color:Q||"#D9D9D9",alpha:1}}function pJ(J){let{color:Q,alpha:Z}=v(J);return JSON.stringify({type:"solid",color:Q,alpha:Z})}function ZJ(J){return`url("${String(J).replace(/\\/g,"\\\\").replace(/"/g,"\\\"")}")`}function gJ(J){let Q=String(J??"").trim();if(!Q||Q.startsWith("{")||Q.startsWith("#"))return!1;if(Q.startsWith("data:video/"))return!0;try{let Z=new URL(Q,"https://fig.local").pathname;return/\.(mp4|webm|mov|m4v|ogv)$/i.test(Z)}catch{return/\.(mp4|webm|mov|m4v|ogv)(?:[?#]|$)/i.test(Q)}}function cJ(J){return{type:"video",video:{url:J,scaleMode:"fill",scale:50}}}function u(J){if(J&&typeof J==="object")return J;let Q=String(J??"").trim();if(!Q)return{type:"solid",color:"#D9D9D9",alpha:1};if(Q.startsWith("{"))try{let Z=JSON.parse(Q);if(Z&&typeof Z==="object")return Z}catch{}if(Q.startsWith("#")){let{color:Z,alpha:$}=v(Q);return{type:"solid",color:Z,alpha:$}}if(gJ(Q))return cJ(Q);return{type:"solid",color:"#D9D9D9",alpha:1}}function i(J){if(J==null)return"";return typeof J==="string"?J:JSON.stringify(J)}function mJ(J){if(!J)return"";let Q=[...J.stops||[]].sort((Z,$)=>(Z.position??0)-($.position??0)).map((Z)=>`${Z.color} ${Z.position??0}%`).join(", ");if(!Q)return"";switch(J.type){case"radial":return`radial-gradient(circle, ${Q})`;case"angular":return`conic-gradient(from ${J.angle||0}deg, ${Q})`;default:return`linear-gradient(${J.angle??180}deg, ${Q})`}}function BJ(J,Q){switch(J?.type){case"solid":return J.color||"";case"gradient":return J.css||mJ(J.gradient)||"";case"image":return J.image?.url?ZJ(J.image.url):"";case"video":return J.video?.poster?ZJ(J.video.poster):"";case"webcam":return J.webcam?.snapshot?ZJ(J.webcam.snapshot):"";default:return J?.swatchBackground||J?.background||J?.css||Q?.getAttribute("swatch-background")||""}}function uJ(J){if(!J||typeof J!=="object")return null;if(J.type==="image")return J.image;if(J.type==="video")return J.video;if(J.type==="webcam")return J.webcam;return null}function vJ(J){let Q=uJ(J),Z=Number(Q?.scale);switch(Q?.scaleMode){case"fit":return{size:"contain",position:"center"};case"tile":return{size:`${Number.isFinite(Z)?Z:50}%`,position:"top left"};case"fill":case"crop":return{size:"cover",position:"center"};default:return J?.type==="webcam"||J?.type==="image"||J?.type==="video"?{size:"cover",position:"center"}:null}}function sJ(J){switch(J?.type){case"solid":{if(Number.isFinite(J.alpha))return J.alpha;if(Number.isFinite(J.opacity))return J.opacity/100;return 1}case"gradient":return J.gradient?.opacity??J.opacity??1;case"image":return J.image?.opacity??1;case"video":return J.video?.opacity??1;case"webcam":return J.webcam?.opacity??1;default:return J?.opacity??J?.alpha??1}}class KJ extends S{#Z=null;#$=null;#J=null;#Q=null;#_=!1;#j=null;#Y=new Set;#B=null;#M=null;#X=this.#H.bind(this);#q=null;static get observedAttributes(){return["label","aria-label"]}connectedCallback(){if(!this.#Z)this.#G();if(this.#O(),this.#K(),this.#P(),this.#q===null)this.#q=this.getAttribute("default")??this.getAttribute("value")??"";if(this.removeEventListener("click",this.#X),this.addEventListener("click",this.#X),W(this),!this.#j)this.#j=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="aria-label")Q=!0;else if($.attributeName==="direction")continue;else Z=!0}if(Q)this.#O();if(Z)this.#K()});this.#j.observe(this,{attributes:!0})}disconnectedCallback(){this.#j?.disconnect(),this.#L(),this.removeEventListener("click",this.#X),f(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="aria-label")this.#O()}#G(){let J=Array.from(this.childNodes).filter((X)=>X.nodeType!==Node.TEXT_NODE||Boolean(X.textContent?.trim())),Q=J.find((X)=>X.nodeType===Node.ELEMENT_NODE&&X.matches("label")),Z=N("div",{className:"propskit-color-surface"}),$=Q||document.createElement("label"),j=document.createElement("fig-fill-picker"),_=document.createElement("fig-swatch");j.anchorElement=this,j.append(_),_.setAttribute("tabindex","0");for(let X of J)if(X!==Q)j.appendChild(X);Z.append($,j),this.#Z=Z,this.#$=$,this.#J=j,this.#Q=_,this.#_=Boolean(Q),this.replaceChildren(Z)}#O(){if(!this.#Z||!this.#$||!this.#J)return;let J=C(this,this.#Z,this.#$,this.#_);R(this,this.#J,J,"Color")}#k(){return v(this.getAttribute("value"))}#U(){let{color:J,alpha:Q}=this.#k();return JSON.stringify({type:"solid",color:J,alpha:Q})}#N(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","text","default","value","mode","variant"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#K(){if(!this.#J)return;let J=this.#N(),Q=new Set(J);for(let _ of this.#Y)if(!Q.has(_))this.#J.removeAttribute(_);for(let _ of J)this.#J.setAttribute(_,this.getAttribute(_)??"");this.#J.setAttribute("mode","solid");let Z=this.#U();if(this.#J.getAttribute("value")!==Z)this.#J.setAttribute("value",Z);let{color:$,alpha:j}=this.#k();if(this.#Q)this.#Q.setAttribute("background",$),this.#Q.setAttribute("alpha",String(j));this.#Y=Q}#P(){if(!this.#J)return;this.#B??=this.#W.bind(this,"input"),this.#M??=this.#W.bind(this,"change"),this.#J.addEventListener("input",this.#B),this.#J.addEventListener("change",this.#M)}#L(){if(!this.#J)return;if(this.#B)this.#J.removeEventListener("input",this.#B);if(this.#M)this.#J.removeEventListener("change",this.#M)}#T(J){let Q=J instanceof CustomEvent&&J.detail!==void 0?J.detail:void 0;if(typeof Q==="string"&&Q)return v(Q).color;if(Q&&typeof Q==="object"){if(typeof Q.color==="string"&&Q.color)return Q.color;if(typeof Q.value==="string"&&Q.value)return v(Q.value).color;if(typeof Q.hex==="string"&&Q.hex)return Q.hex}let Z=this.#J?.value;if(Z&&typeof Z==="object"&&typeof Z.color==="string")return Z.color;if(typeof Z==="string"&&Z)return v(Z).color;return this.#k().color}#F(J,Q){let Z=J instanceof CustomEvent&&J.detail&&typeof J.detail==="object"?J.detail:void 0,$=Number.isFinite(Z?.alpha)?Math.max(0,Math.min(1,Number(Z.alpha))):this.#k().alpha;return{color:Q,alpha:$,opacity:Math.round($*100)}}#W(J,Q){if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let Z=this.#T(Q),$=this.#F(Q,Z),j=$.alpha<0.996078431372549?Math.round($.alpha*255).toString(16).padStart(2,"0"):"",_=`${$.color.slice(0,7)}${j}`;this.setAttribute("value",_);let X=this.#U();if(this.#J&&this.#J.getAttribute("value")!==X)this.#J.setAttribute("value",X);if(this.#Q)this.#Q.setAttribute("background",$.color),this.#Q.setAttribute("alpha",String($.alpha));K(this,J)}#H(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-menu"))return;if(J.target instanceof Element&&J.target.closest("fig-fill-picker, fig-swatch"))return;this.focus(),this.#J?.open?.()}get value(){return this.getAttribute("value")??this.#J?.value??this.#J?.getAttribute("value")??""}set value(J){if(J===null||J===void 0||J===""){this.removeAttribute("value"),this.#J?.removeAttribute("value");return}let Q=String(J);this.setAttribute("value",Q),this.#z(Q)}#z(J){if(!this.#J)return;let Q=pJ(J);if(this.#J.getAttribute("value")===Q)this.#J.removeAttribute("value");if(this.#J.setAttribute("value",Q),this.#Q){let Z=v(J);this.#Q.setAttribute("background",Z.color),this.#Q.setAttribute("alpha",String(Z.alpha))}}#f(){return this.getAttribute("default")??this.#q??""}get defaultValue(){return String(this.#f())}get isDefault(){return o(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.setAttribute("value",J),this.#z(J),b(this)}focus(J){let Q=this.querySelector("fig-swatch");if(Q instanceof HTMLElement)Q.focus(J)}}L("propskit-color",KJ);class SJ extends S{#Z=null;#$=null;#J=null;#Q=null;#_=!1;#j=null;#Y=new Set;#B=null;#M=null;#X=this.#R.bind(this);#q=null;static get observedAttributes(){return["label","aria-label"]}connectedCallback(){if(!this.#Z)this.#G();if(this.#O(),this.#F(),this.#W(),this.#q===null)this.#q=this.getAttribute("default")??this.getAttribute("value")??"";if(this.removeEventListener("click",this.#X),this.addEventListener("click",this.#X),W(this),!this.#j)this.#j=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="aria-label")Q=!0;else if($.attributeName==="direction")continue;else Z=!0}if(Q)this.#O();if(Z)this.#F()});this.#j.observe(this,{attributes:!0})}disconnectedCallback(){this.#j?.disconnect(),this.#H(),this.removeEventListener("click",this.#X),f(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="aria-label")this.#O()}#G(){let J=Array.from(this.childNodes).filter((X)=>X.nodeType!==Node.TEXT_NODE||Boolean(X.textContent?.trim())),Q=J.find((X)=>X.nodeType===Node.ELEMENT_NODE&&X.matches("label")),Z=N("div",{className:"propskit-fill-surface"}),$=Q||document.createElement("label"),j=document.createElement("fig-fill-picker"),_=document.createElement("fig-swatch");j.anchorElement=this,j.append(_),_.setAttribute("tabindex","0");for(let X of J)if(X!==Q)j.appendChild(X);Z.append($,j),this.#Z=Z,this.#$=$,this.#J=j,this.#Q=_,this.#_=Boolean(Q),this.replaceChildren(Z)}#O(){if(!this.#Z||!this.#$||!this.#J)return;let J=C(this,this.#Z,this.#$,this.#_);R(this,this.#J,J,"Fill")}#k(){return u(this.getAttribute("value"))}#U(){return i(this.#k())}#N(){let J=this.#k()?.type;if(!J)return null;return this.querySelector(`[slot="mode-${J}"]`)}#K(){let J=this.#J?.value;if(J&&typeof J==="object")return J;if(typeof J==="string"&&J)return u(J);return null}#P(J){let Q=this.#K();if(!J||typeof J!=="object")return J;if(J.type!=="webcam")return J;let Z=J.webcam?.snapshot||Q?.webcam?.snapshot;if(!Z||J.webcam?.snapshot)return J;return{...J,webcam:{...Q?.webcam&&typeof Q.webcam==="object"?Q.webcam:{},...J.webcam,snapshot:Z}}}#L(J=this.#k()){if(!this.#Q)return;let Q=this.#P(J),Z=BJ(Q,this.#N());if(!Z)Z=BJ(this.#K(),this.#N());if(!Z){let j=this.#Q.getAttribute("background")??"";if(j.startsWith("url("))Z=j}this.#Q.setAttribute("background",Z),this.#Q.setAttribute("alpha",String(sJ(Q)));let $=vJ(Q||J);if($)this.#Q.style.setProperty("--swatch-bg-size",$.size),this.#Q.style.setProperty("--swatch-bg-position",$.position)}#T(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","text","default","value","variant"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#F(){if(!this.#J)return;let J=this.#T(),Q=new Set(J);for(let $ of this.#Y)if(!Q.has($))this.#J.removeAttribute($);for(let $ of J)this.#J.setAttribute($,this.getAttribute($)??"");let Z=this.#U();if(this.#J.getAttribute("value")!==Z)this.#J.setAttribute("value",Z);this.#L(),this.#Y=Q}#W(){if(!this.#J)return;this.#B??=this.#f.bind(this,"input"),this.#M??=this.#f.bind(this,"change"),this.#J.addEventListener("input",this.#B),this.#J.addEventListener("change",this.#M)}#H(){if(!this.#J)return;if(this.#B)this.#J.removeEventListener("input",this.#B);if(this.#M)this.#J.removeEventListener("change",this.#M)}#z(J){let Q=J instanceof CustomEvent&&J.detail!==void 0?J.detail:void 0;if(Q&&typeof Q==="object")return Q;if(typeof Q==="string"&&Q)return u(Q);let Z=this.#J?.value;if(Z&&typeof Z==="object")return Z;if(typeof Z==="string"&&Z)return u(Z);return this.#k()}#f(J,Q){if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let Z=this.#P(this.#z(Q)),$=i(Z);if(this.setAttribute("value",$),this.#J&&this.#J.getAttribute("value")!==$)this.#J.setAttribute("value",$);this.#L(Z),K(this,J)}#R(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-menu"))return;if(J.target instanceof Element&&J.target.closest("fig-fill-picker, fig-swatch"))return;this.focus(),this.#J?.open?.()}get value(){return this.getAttribute("value")??i(this.#J?.value)??""}set value(J){if(J===null||J===void 0||J===""){this.removeAttribute("value"),this.#J?.removeAttribute("value"),this.#L({type:"solid",color:"",alpha:1});return}let Q=i(typeof J==="string"?u(J):J);this.setAttribute("value",Q),this.#D(Q)}#D(J){if(!this.#J)return;let Q=i(u(J));if(this.#J.getAttribute("value")===Q)this.#J.removeAttribute("value");this.#J.setAttribute("value",Q),this.#L(u(Q))}#h(){return this.getAttribute("default")??this.#q??""}get defaultValue(){return String(this.#h())}get isDefault(){return m(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.setAttribute("value",J),this.#D(J),b(this)}focus(J){let Q=this.querySelector("fig-swatch");if(Q instanceof HTMLElement)Q.focus(J)}}L("propskit-fill",SJ);class TJ extends S{#Z=null;#$=null;#J=null;#Q=!1;#_=null;#j=new Set;#Y=null;#B=null;#M=this.#L.bind(this);#X=null;static get observedAttributes(){return["label","aria-label"]}connectedCallback(){if(!this.#Z)this.#q();if(this.#G(),this.#k(),this.#U(),this.#X===null)this.#X=this.getAttribute("default")??this.getAttribute("value")??JSON.stringify(this.#J?.value??{});if(this.removeEventListener("click",this.#M),this.addEventListener("click",this.#M),W(this),!this.#_)this.#_=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="aria-label")Q=!0;else if($.attributeName==="direction")continue;else Z=!0}if(Q)this.#G();if(Z)this.#k()});this.#_.observe(this,{attributes:!0})}disconnectedCallback(){this.#_?.disconnect(),this.#N(),this.removeEventListener("click",this.#M),f(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="aria-label")this.#G()}#q(){let Q=Array.from(this.childNodes).filter((_)=>_.nodeType!==Node.TEXT_NODE||Boolean(_.textContent?.trim())).find((_)=>_.nodeType===Node.ELEMENT_NODE&&_.matches("label")),Z=N("div",{className:"propskit-gradient-surface"}),$=Q||document.createElement("label"),j=document.createElement("fig-input-gradient");j.anchorElement=this,Z.append($,j),this.#Z=Z,this.#$=$,this.#J=j,this.#Q=Boolean(Q),this.replaceChildren(Z)}#G(){if(!this.#Z||!this.#$||!this.#J)return;let J=C(this,this.#Z,this.#$,this.#Q);R(this,this.#J,J,"Gradient")}#O(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","default","variant"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#k(){if(!this.#J)return;let J=this.#O(),Q=new Set(J);for(let Z of this.#j)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J){let $=this.getAttribute(Z)??"";if(Z==="value"&&this.#J.getAttribute("value")===$)continue;this.#J.setAttribute(Z,$)}if(!this.hasAttribute("edit"))this.#J.setAttribute("edit","picker");this.#j=Q}#U(){if(!this.#J)return;this.#Y??=this.#P.bind(this,"input"),this.#B??=this.#P.bind(this,"change"),this.#J.addEventListener("input",this.#Y),this.#J.addEventListener("change",this.#B)}#N(){if(!this.#J)return;if(this.#Y)this.#J.removeEventListener("input",this.#Y);if(this.#B)this.#J.removeEventListener("change",this.#B)}#K(J){let Q=J instanceof CustomEvent&&J.detail&&typeof J.detail==="object"?J.detail:this.#J?.value;if(!Q||typeof Q!=="object")return this.value;return JSON.stringify(Q)}#P(J,Q){if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let Z=this.#K(Q);this.setAttribute("value",Z),K(this,J)}#L(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-menu"))return;if(J.target instanceof Element&&J.target.closest("fig-input-gradient, fig-fill-picker, fig-swatch"))return;this.focus(),this.#J?.querySelector?.("fig-fill-picker")?.open?.()}get value(){return this.getAttribute("value")??JSON.stringify(this.#J?.value??{})}set value(J){if(J===null||J===void 0||J===""){this.removeAttribute("value"),this.#J?.removeAttribute("value");return}let Q=typeof J==="object"?JSON.stringify(J):String(J);if(this.setAttribute("value",Q),this.#J&&this.#J.getAttribute("value")!==Q)this.#J.setAttribute("value",Q)}get defaultValue(){return this.getAttribute("default")??this.#X??""}get isDefault(){return m(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;if(!J)return;this.value=J,b(this)}focus(J){this.#J?.focus(J)}}L("propskit-gradient",TJ);class jJ extends S{#Z=null;#$=null;#J=null;#Q=[];#_=!1;#j=null;#Y=[];#B=void 0;#M=!1;#X=0;#q=null;#G=null;#O=null;#k=null;#U=this.#m.bind(this);#N=this.#d.bind(this);#K=!1;static get observedAttributes(){return["label","aria-label","options","value","disabled"]}connectedCallback(){if(!this.#Z)this.#P(),this.#Y=this.#L(this.value);if(this.#I(),this.#V(),this.#p(),this.removeEventListener("click",this.#U),this.addEventListener("click",this.#U),this.removeEventListener("pointerdown",this.#N,!0),this.addEventListener("pointerdown",this.#N,!0),W(this),!this.#j)this.#j=new MutationObserver((J)=>{if(J.some(({type:Q,attributeName:Z})=>Q==="attributes"&&Z&&!jJ.observedAttributes.includes(Z)&&!["label","name","options","value","default","size","variant","class","style","id"].includes(Z)&&!Z.startsWith("data-")))this.#V()});this.#j.observe(this,{attributes:!0})}disconnectedCallback(){this.#j?.disconnect(),this.#y(),this.removeEventListener("click",this.#U),this.removeEventListener("pointerdown",this.#N,!0),f(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(this.#M&&J==="value")return;if(J==="label"||J==="aria-label")this.#I();else if(J==="options")this.#f();else if(J==="value")this.#h();else if(J==="disabled")this.#V()}#P(){let J=this.querySelector(":scope > label"),Q=N("div",{className:"propskit-palette-surface"}),Z=J||document.createElement("label"),$=document.createElement("fig-select"),j=this.#H([]);j.setAttribute("slot","trigger"),j.setAttribute("data-propskit-palette-trigger",""),j.hidden=!0,$.setAttribute("full",""),$.setAttribute("subtle",""),$.append(j),Q.append(Z,$),this.#Z=Q,this.#$=Z,this.#J=$,this.#q=j,this.#_=Boolean(J),this.replaceChildren(Q),this.#f()}#L(J){if(!Array.isArray(J))return[];return J.map((Q)=>({...Q}))}#T(J){let Q=document.createElement("fig-input-palette");if(typeof J==="string")Q.setAttribute("value",J);else Q.setAttribute("value",JSON.stringify(J??[]));return this.#L(Q.value)}#F(J){return JSON.stringify(this.#T(J))}#W(){try{let J=JSON.parse(this.getAttribute("options")||"[]");if(!Array.isArray(J))return[];return J.filter((Q)=>Array.isArray(Q)).map((Q)=>this.#T(Q))}catch{return[]}}#H(J){let Q=document.createElement("fig-input-palette");return Q.className="propskit-palette-preview",Q.setAttribute("value",JSON.stringify(J)),Q.setAttribute("fixed",""),Q.setAttribute("disabled",""),Q.setAttribute("full",""),Q.setAttribute("aria-hidden","true"),Q}#z(J){if(!this.#q)return;this.#q.setAttribute("value",JSON.stringify(J)),this.#q.hidden=!J.length}#f(){if(!this.#J)return;let J=++this.#X;this.#Q=this.#W();let Q=document.createElement("fig-select-options");Q.setAttribute("slot","panel"),Q.className="propskit-palette-options",this.#Q.forEach((Z,$)=>{let j=document.createElement("fig-select-option"),_=document.createElement("span");j.setAttribute("value",String($)),j.setAttribute("label",`Palette ${$+1}`),j.setAttribute("aria-label",`Palette ${$+1}`),_.setAttribute("slot","prepend"),_.className="propskit-palette-option-preview",_.append(this.#H(Z)),j.append(_),Q.append(j)}),this.#M=!0,this.#J.replaceChildren(this.#q,Q),this.#h(),queueMicrotask(()=>{if(J!==this.#X)return;this.#h(),this.#M=!1})}#R(J){let Q=this.#T(J);return this.#Q.findIndex((Z)=>m(Z,Q))}#D(J){let Q=this.#F(J);if(this.getAttribute("value")===Q)return;let Z=this.#M;this.#M=!0,this.setAttribute("value",Q),this.#M=Z}#h(){if(!this.#J)return;if(!this.#Q.length){this.#J.removeAttribute("value"),this.#z([]);let $=this.#M;this.#M=!0,this.removeAttribute("value"),this.#M=$;return}let J=this.hasAttribute("value")?this.getAttribute("value"):this.#Q[0],Q=this.#R(J),Z=Q>=0?Q:0;this.#J.setAttribute("value",String(Z)),this.#D(this.#Q[Z]),this.#z(this.#Q[Z])}#I(){if(!this.#Z||!this.#$||!this.#J)return;let J=C(this,this.#Z,this.#$,this.#_);R(this,this.#J,J,"Palette"),this.#J.setAttribute("label",this.getAttribute("aria-label")||this.#$.textContent?.trim()||"Palette"),this.#J.setAttribute("full","")}#V(){if(!this.#J)return;this.#J.toggleAttribute("disabled",O(this,"disabled"));for(let J of["position","offset","closedby"])if(this.hasAttribute(J))this.#J.setAttribute(J,this.getAttribute(J)??"");else this.#J.removeAttribute(J)}#p(){if(!this.#J)return;this.#G??=this.#C.bind(this,"input"),this.#O??=this.#C.bind(this,"change"),this.#k??=this.#C.bind(this,"optionhover"),this.#J.addEventListener("input",this.#G),this.#J.addEventListener("change",this.#O),this.#J.addEventListener("optionhover",this.#k)}#y(){if(!this.#J)return;if(this.#G)this.#J.removeEventListener("input",this.#G);if(this.#O)this.#J.removeEventListener("change",this.#O);if(this.#k)this.#J.removeEventListener("optionhover",this.#k)}#b(J){return this.#L(this.#Q[J]??[])}#x(J,Q){this.#B=Q;try{K(this,J,Q)}finally{this.#B=void 0}}#C(J,Q){if(Q.target!==this.#J)return;if(Q.stopImmediatePropagation(),this.#M||O(this,"disabled"))return;let Z=J==="optionhover"&&Q instanceof CustomEvent?Q.detail:this.#J.getAttribute("value"),$=this.#b(Number(Z));if(J!=="optionhover")this.#D($),this.#z($);this.#x(J,$)}#A(){if(!this.#J)return!1;if(this.#J.open)return!0;let J=this.#J.shadowRoot?.querySelector('dialog[is="fig-popup"]');return Boolean(J?.open||J?.matches?.(":open"))}#d(J){if(!(J.target instanceof Element))return;if(J.target.closest("fig-menu"))return;if(J.target.closest("fig-select")){this.#K=!1;return}this.#K=this.#A()}#m(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-menu, fig-select")){this.#K=!1;return}if(!this.#J||O(this.#J,"disabled")){this.#K=!1;return}if(this.#J.focus(),this.#K||this.#A()){this.#K=!1,this.#J.open=!1;return}this.#J.open=!0}get value(){if(this.#B!==void 0)return this.#B;let J=Number(this.#J?.getAttribute("value"));if(Number.isInteger(J)&&J>=0)return this.#b(J);if(this.hasAttribute("value"))return this.#T(this.getAttribute("value"));return[]}set value(J){if(J===null||J===void 0){this.removeAttribute("value");return}this.setAttribute("value",this.#F(J))}get defaultValue(){if(this.hasAttribute("default"))return this.#T(this.getAttribute("default"));return this.#L(this.#Y)}get isDefault(){return m(this.value,this.defaultValue)}resetToDefault(){this.value=this.defaultValue;for(let J of["input","change"])this.#x(J,this.value)}focus(J){this.#J?.focus(J)}}L("propskit-palette",jJ);class FJ extends S{#Z=null;#$=null;#J=null;#Q=!1;#_=null;#j=new Set;#Y=null;#B=null;#M=null;#X=this.#z.bind(this);#q=this.#H.bind(this);#G=!1;#O=void 0;#k=null;static get observedAttributes(){return["label","aria-label","options","value"]}connectedCallback(){if(!this.#Z)this.#U();if(this.#N(),this.#P(),this.#L(),this.removeEventListener("click",this.#X),this.addEventListener("click",this.#X),this.removeEventListener("pointerdown",this.#q,!0),this.addEventListener("pointerdown",this.#q,!0),W(this),!this.#_)this.#_=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;let j=$.attributeName;if(j==="label"||j==="aria-label")Q=!0;else if(j==="direction")continue;else Z=!0}if(Q)this.#N();if(Z)this.#P()});this.#_.observe(this,{attributes:!0})}disconnectedCallback(){this.#_?.disconnect(),this.#T(),this.removeEventListener("click",this.#X),this.removeEventListener("pointerdown",this.#q,!0),f(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="aria-label"){this.#N();return}if(J==="options"||J==="value")this.#P()}#U(){this.#k=this.getAttribute("value")??"";let J=this.querySelector(":scope > label"),Q=this.querySelector(":scope > fig-select-options"),Z=N("div",{className:"propskit-select-surface"}),$=J||document.createElement("label"),j=document.createElement("fig-select");if(j.setAttribute("full",""),Q)j.append(Q);Z.append($,j),this.#Z=Z,this.#$=$,this.#J=j,this.#Q=Boolean(J),this.replaceChildren(Z)}#N(){if(!this.#Z||!this.#$||!this.#J)return;let J=C(this,this.#Z,this.#$,this.#Q);R(this,this.#J,J,"Select"),this.#J.setAttribute("label",this.getAttribute("aria-label")||this.#$.textContent?.trim()||"Select"),this.#J.setAttribute("full","")}#K(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","full","default","variant"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#P(){if(!this.#J)return;let J=this.#K().sort((Z,$)=>{if(Z==="options")return-1;if($==="options")return 1;if(Z==="value")return 1;if($==="value")return-1;return 0}),Q=new Set(J);for(let Z of this.#j)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#j=Q}#L(){if(!this.#J)return;this.#Y??=this.#F.bind(this,"input"),this.#B??=this.#F.bind(this,"change"),this.#J.addEventListener("input",this.#Y),this.#J.addEventListener("change",this.#B),this.#M??=this.#F.bind(this,"optionhover"),this.#J.addEventListener("optionhover",this.#M)}#T(){if(!this.#J)return;if(this.#Y)this.#J.removeEventListener("input",this.#Y);if(this.#B)this.#J.removeEventListener("change",this.#B);if(this.#M)this.#J.removeEventListener("optionhover",this.#M)}#F(J,Q){if(Q.target!==this.#J)return;if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let Z=this.#J?.value??"";if(J!=="optionhover")this.setAttribute("value",String(Z));let $=J==="optionhover"&&Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:this.value;if(J==="optionhover")this.#O=$;try{K(this,J,$)}finally{this.#O=void 0}}#W(){if(!this.#J)return!1;if(this.#J.open)return!0;let J=this.#J.shadowRoot?.querySelector('dialog[is="fig-popup"]');return Boolean(J?.open||J?.matches?.(":open"))}#H(J){if(!(J.target instanceof Element))return;if(J.target.closest("fig-menu"))return;if(J.target.closest("fig-select")){this.#G=!1;return}this.#G=this.#W()}#z(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-menu"))return;if(J.target instanceof Element&&J.target.closest("fig-select")){this.#G=!1;return}if(!this.#J||O(this.#J,"disabled")){this.#G=!1;return}if(this.#J.focus(),this.#G||this.#W()){this.#G=!1,this.#J.open=!1;return}this.#J.open=!0}get value(){return this.#O??this.#J?.value??this.getAttribute("value")??""}set value(J){if(J===null||J===void 0)this.removeAttribute("value");else this.setAttribute("value",String(J))}get defaultValue(){return this.getAttribute("default")??this.#k??""}get isDefault(){return o(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;if(this.value=J,this.#J)this.#J.value=J;b(this)}focus(J){this.#J?.focus(J)}}L("propskit-select",FJ);class zJ extends S{#Z=null;#$=null;#J=null;#Q=!1;#_=null;#j=new Set;#Y=null;#B=null;#M=this.#P.bind(this);#X=null;static get observedAttributes(){return["label","aria-label"]}connectedCallback(){if(!this.#Z)this.#q();if(this.#G(),this.#k(),this.#U(),this.removeEventListener("click",this.#M),this.addEventListener("click",this.#M),W(this),!this.#_)this.#_=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="aria-label")Q=!0;else if($.attributeName==="direction")continue;else Z=!0}if(Q)this.#G();if(Z)this.#k()});this.#_.observe(this,{attributes:!0})}disconnectedCallback(){this.#_?.disconnect(),this.#N(),this.removeEventListener("click",this.#M),f(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="aria-label")this.#G()}#q(){this.#X=this.getAttribute("value")??"";let J=Array.from(this.childNodes).filter((_)=>_.nodeType!==Node.TEXT_NODE||Boolean(_.textContent?.trim())),Q=J.find((_)=>_.nodeType===Node.ELEMENT_NODE&&_.matches("label")),Z=N("div",{className:"propskit-text-surface"}),$=Q||document.createElement("label"),j=document.createElement("fig-input-text");for(let _ of J)if(_!==Q)j.appendChild(_);Z.append($,j),this.#Z=Z,this.#$=$,this.#J=j,this.#Q=Boolean(Q),this.replaceChildren(Z)}#G(){if(!this.#Z||!this.#$||!this.#J)return;let J=C(this,this.#Z,this.#$,this.#Q);R(this,this.#J,J,"Text")}#O(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","type","aria-label","multiline","autoresize","resizable","default","variant"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#k(){if(!this.#J)return;let J=this.#O(),Q=["multiline","autoresize"],Z=new Set([...J,...Q,"type"]);for(let $ of this.#j)if(!Z.has($))this.#J.removeAttribute($);for(let $ of J)this.#J.setAttribute($,this.getAttribute($)??"");for(let $ of Q)this.#J.setAttribute($,this.getAttribute($)??"");this.#J.setAttribute("type","text"),this.#j=Z}#U(){if(!this.#J)return;this.#Y??=this.#K.bind(this,"input"),this.#B??=this.#K.bind(this,"change"),this.#J.addEventListener("input",this.#Y),this.#J.addEventListener("change",this.#B)}#N(){if(!this.#J)return;if(this.#Y)this.#J.removeEventListener("input",this.#Y);if(this.#B)this.#J.removeEventListener("change",this.#B)}#K(J,Q){if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let Z=this.#J?.value??"";this.setAttribute("value",String(Z)),K(this,J)}#P(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-text, fig-menu"))return;this.focus()}get value(){return this.#J?.value??this.getAttribute("value")??""}set value(J){if(J===null||J===void 0){if(this.removeAttribute("value"),this.#J)this.#J.value=""}else{let Q=String(J);if(this.setAttribute("value",Q),this.#J)this.#J.value=Q}}get defaultValue(){return this.getAttribute("default")??this.#X??""}get isDefault(){return o(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.value=J,b(this)}focus(J){this.#J?.focus(J)}}L("propskit-text",zJ);class WJ extends S{#Z=null;#$=null;#J=null;#Q=!1;#_=null;#j=new Set;#Y=null;#B=null;#M=this.#L.bind(this);#X=this.#T.bind(this);#q=null;static get observedAttributes(){return["label","aria-label"]}connectedCallback(){if(!this.#Z)this.#G();if(this.#O(),this.#U(),this.#N(),this.removeEventListener("click",this.#M),this.addEventListener("click",this.#M),this.removeEventListener("keydown",this.#X),this.addEventListener("keydown",this.#X),W(this),!this.#_)this.#_=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="aria-label")Q=!0;else if($.attributeName==="direction")continue;else Z=!0}if(Q)this.#O();if(Z)this.#U()});this.#_.observe(this,{attributes:!0})}disconnectedCallback(){this.#_?.disconnect(),this.#K(),this.removeEventListener("click",this.#M),this.removeEventListener("keydown",this.#X),f(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="aria-label")this.#O()}#G(){this.#q=this.getAttribute("value")??this.getAttribute("min")??"0";let J=Array.from(this.childNodes).filter((_)=>_.nodeType!==Node.TEXT_NODE||Boolean(_.textContent?.trim())),Q=J.find((_)=>_.nodeType===Node.ELEMENT_NODE&&_.matches("label")),Z=N("div",{className:"propskit-number-surface"}),$=Q||document.createElement("label"),j=document.createElement("fig-input-number");Z.append($,j),this.#Z=Z,this.#$=$,this.#J=j,this.#Q=Boolean(Q),this.replaceChildren(Z);for(let _ of J)if(_!==Q)j.appendChild(_)}#O(){let J=C(this,this.#Z,this.#$,this.#Q);R(this,this.#J,J,"Number")}#k(){let J=new Set(["label","direction","size","aria-label","oninput","onchange","class","style","id","default","variant"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#U(){if(!this.#J)return;let J=this.#k(),Q=new Set(J);for(let Z of this.#j)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#j=Q}#N(){if(!this.#J)return;this.#Y??=this.#P.bind(this,"input"),this.#B??=this.#P.bind(this,"change"),this.#J.addEventListener("input",this.#Y),this.#J.addEventListener("change",this.#B)}#K(){if(!this.#J)return;if(this.#Y)this.#J.removeEventListener("input",this.#Y);if(this.#B)this.#J.removeEventListener("change",this.#B)}#P(J,Q){if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let Z=d(this.#J?.value);if(Z===null)this.removeAttribute("value");else this.setAttribute("value",String(Z));K(this,J)}#L(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number, fig-menu"))return;this.focus()}#T(J){if(!["ArrowUp","ArrowDown"].includes(J.key)||!(J.target instanceof Element)||!J.target.closest("fig-input-number"))return;J.stopPropagation();let Q=this.#J?.querySelector("input");queueMicrotask(()=>{if(this.isConnected&&!O(this,"disabled"))Q?.focus({preventScroll:!0})})}get value(){return d(this.#J?.value??this.getAttribute("value"))}set value(J){if(J===null||J===void 0||J===""){if(this.removeAttribute("value"),this.#J)this.#J.value=""}else{let Q=String(J);if(this.setAttribute("value",Q),this.#J)this.#J.value=Q}}get defaultValue(){return this.getAttribute("default")??this.#q??"0"}get isDefault(){return o(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.value=J,b(this)}focus(J){this.#J?.focus(J)}}L("propskit-number",WJ);class HJ extends S{static observedAttributes=["x","y","default","label","aria-label","units","disabled"];#Z=null;#$=null;#J=!1;#Q=null;#_=null;#j=null;#Y=!1;#B=!1;#M=this.#z.bind(this,"input");#X=this.#z.bind(this,"change");#q=this.#f.bind(this);connectedCallback(){if(!this.#Y)this.#j=this.#O(),this.#U(this.#j),this.#Y=!0;if(!this.#Z)this.#K();this.#P(),this.#L(),this.#W(),this.removeEventListener("click",this.#q),this.addEventListener("click",this.#q),W(this)}disconnectedCallback(){this.#H(),this.removeEventListener("click",this.#q),f(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Y)return;if((J==="x"||J==="y")&&!this.#B)this.#L();else if(J==="label"||J==="aria-label")this.#P();else if(J==="units")this.#T();else if(J==="disabled")this.#F()}#G(J,Q=50){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#O(){let J=this.getAttribute("x"),Q=this.getAttribute("y");return{x:J===null||!J.trim()?50:this.#G(J,50),y:Q===null||!Q.trim()?50:this.#G(Q,50)}}#k(J){if(typeof J!=="string"||!J.trim())return null;try{let Q=JSON.parse(J);if(!Q||typeof Q!=="object"||Array.isArray(Q))return null;return{x:this.#G(Q.x,this.#j?.x??50),y:this.#G(Q.y,this.#j?.y??50)}}catch{return null}}#U(J){let Q=this.#O(),Z={x:this.#G(J?.x,Q.x),y:this.#G(J?.y,Q.y)};return this.#B=!0,this.setAttribute("x",String(Z.x)),this.setAttribute("y",String(Z.y)),this.#B=!1,Z}#N(J,Q){let Z=document.createElement("fig-input-number");if(Z.setAttribute("data-propskit-position-axis",J),Z.setAttribute("value",String(Q)),Z.setAttribute("min","0"),Z.setAttribute("max","100"),Z.setAttribute("step","1"),Z.setAttribute("precision","2"),this.units==="percent")Z.setAttribute("units","%");Z.setAttribute("aria-label",`${J.toUpperCase()} position`);let $=document.createElement("span");if($.setAttribute("slot","prepend"),$.textContent=J.toUpperCase(),Z.append($),O(this,"disabled"))Z.setAttribute("disabled","");return Z}#K(){let J=this.#O(),Q=this.querySelector(":scope > label"),Z=N("div",{className:"propskit-position-surface",role:"group"}),$=Q||document.createElement("label"),j=this.#N("x",J.x),_=this.#N("y",J.y);Z.append($,j,_),this.#Z=Z,this.#$=$,this.#J=Boolean(Q),this.#Q=j,this.#_=_,this.replaceChildren(Z),W(this)}#P(){let J=C(this,this.#Z,this.#$,this.#J);R(this,this.#Z,J,"Position")}#L(){let J=this.#O();this.#Q?.setAttribute("value",String(J.x)),this.#_?.setAttribute("value",String(J.y)),this.#T(),this.#F()}#T(){let J=this.units==="percent"?"%":null;for(let Q of[this.#Q,this.#_]){if(!Q)continue;if(J)Q.setAttribute("units",J);else Q.removeAttribute("units")}}#F(){let J=O(this,"disabled");this.#Q?.toggleAttribute("disabled",J),this.#_?.toggleAttribute("disabled",J)}#W(){this.#H(),this.#Q?.addEventListener("input",this.#M),this.#Q?.addEventListener("change",this.#X),this.#_?.addEventListener("input",this.#M),this.#_?.addEventListener("change",this.#X)}#H(){this.#Q?.removeEventListener("input",this.#M),this.#Q?.removeEventListener("change",this.#X),this.#_?.removeEventListener("input",this.#M),this.#_?.removeEventListener("change",this.#X)}#z(J,Q){if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let Z=Q.currentTarget?.getAttribute("data-propskit-position-axis");if(Z!=="x"&&Z!=="y")return;let $=this.value;$[Z]=this.#G(Q.currentTarget.value,$[Z]),this.#U($),K(this,J)}#f(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number, fig-menu"))return;this.focus()}get x(){return this.#O().x}set x(J){this.setAttribute("x",String(this.#G(J,50)))}get y(){return this.#O().y}set y(J){this.setAttribute("y",String(this.#G(J,50)))}get units(){return this.getAttribute("units")?.trim().toLowerCase()==="percent"?"percent":"none"}set units(J){this.setAttribute("units",String(J).trim().toLowerCase()==="none"?"none":"percent")}get value(){return{...this.#O()}}set value(J){let Q=this.#U(J);this.#L(Q)}get defaultValue(){return this.#k(this.getAttribute("default"))||{...this.#j||{x:50,y:50}}}get isDefault(){return m(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.value=J,b(this)}focus(J){this.#Q?.focus(J)}}L("propskit-position",HJ);class RJ extends S{static observedAttributes=["value","default","label","aria-label","axis-labels","coordinates","precision","disabled"];#Z=null;#$=null;#J=!1;#Q=null;#_=null;#j={x:50,y:50};#Y=!1;#B=this.#W.bind(this,"input");#M=this.#W.bind(this,"change");connectedCallback(){if(!this.#Z)this.#j=this.#q(this.getAttribute("value"),this.#j),this.#G(this.#j),this.#O();this.#k(),this.#U(),this.#T(),this.#_?.observe(this.#Q,{childList:!0,subtree:!0}),W(this)}disconnectedCallback(){this.#F(),this.#_?.disconnect(),f(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="value"&&!this.#Y)this.#G(this.#q(Z,this.value)),this.#K();else if(J==="label"||J==="aria-label")this.#k();else if(J==="axis-labels"||J==="coordinates"||J==="precision")this.#N();else if(J==="disabled")this.#P()}#X(J,Q=50){let Z=Number(J);return Number.isFinite(Z)?Math.max(0,Math.min(100,Z)):Q}#q(J,Q={x:50,y:50}){let Z=J;if(typeof J==="string"){let $=J.trim();if(!$)return{...Q};try{Z=JSON.parse($)}catch{let j=$.split(/[\s,]+/).filter(Boolean),_=(X,q)=>{if(!X)return q;let B=Number.parseFloat(X.replace(/%/g,""));if(!Number.isFinite(B))return q;return X.includes("%")||Math.abs(B)>1?B:B*100};Z={x:_(j[0],Q.x),y:_(j[1]??j[0],Q.y)}}}if(!Z||typeof Z!=="object"||Array.isArray(Z))return{...Q};return{x:this.#X(Z.x,Q.x),y:this.#X(Z.y,Q.y)}}#G(J){let Q=this.#q(J,this.#j),Z=JSON.stringify(Q);if(this.getAttribute("value")!==Z)this.#Y=!0,this.setAttribute("value",Z),this.#Y=!1;return Q}#O(){let J=this.querySelector(":scope > label"),Q=N("div",{className:"propskit-joystick-surface",role:"group"}),Z=J||document.createElement("label"),$=document.createElement("fig-joystick");$.setAttribute("fields","true"),$.setAttribute("aspect-ratio","1 / 1"),Q.append(Z,$),this.#Z=Q,this.#$=Z,this.#J=Boolean(J),this.#Q=$,this.replaceChildren(Q),this.#_=new MutationObserver(()=>this.#L()),this.#_.observe($,{childList:!0,subtree:!0})}#k(){let J=C(this,this.#Z,this.#$,this.#J);R(this,this.#Q,J,"Joystick"),this.#L()}#U(){this.#N(),this.#K(),this.#P()}#N(){if(!this.#Q)return;this.#Q.setAttribute("fields","true"),this.#Q.setAttribute("aspect-ratio","1 / 1");for(let J of["axis-labels","coordinates","precision"])if(this.hasAttribute(J))this.#Q.setAttribute(J,this.getAttribute(J)??"");else this.#Q.removeAttribute(J)}#K(){if(!this.#Q)return;let J=this.value,Q=`${J.x}% ${J.y}%`;if(this.#Q.getAttribute("value")!==Q)this.#Q.setAttribute("value",Q)}#P(){if(!this.#Q||!this.#Z)return;let J=O(this,"disabled");this.#Z.setAttribute("aria-disabled",String(J)),this.#Q.toggleAttribute("disabled",J),this.#Q.inert=J,this.#L()}#L(){if(!this.#Q)return;let J=O(this,"disabled"),Q=this.#$?.isConnected?this.#$.id:"",Z=this.getAttribute("aria-label")?.trim(),$=this.#Q.querySelector("fig-handle");if($)if($.toggleAttribute("disabled",J),Z)$.setAttribute("aria-label",Z),$.removeAttribute("aria-labelledby");else if(Q)$.setAttribute("aria-labelledby",Q),$.removeAttribute("aria-label");else $.setAttribute("aria-label","Joystick"),$.removeAttribute("aria-labelledby");for(let j of this.#Q.querySelectorAll("fig-input-number"))j.toggleAttribute("disabled",J)}#T(){this.#F(),this.#Q?.addEventListener("input",this.#B),this.#Q?.addEventListener("change",this.#M)}#F(){this.#Q?.removeEventListener("input",this.#B),this.#Q?.removeEventListener("change",this.#M)}#W(J,Q){if(Q.stopImmediatePropagation(),Q.target!==this.#Q||O(this,"disabled"))return;let Z=this.#q(Q.detail?.value,this.value);this.#G(Z),this.#K(),K(this,J)}get value(){return this.#q(this.getAttribute("value"),this.#j)}set value(J){this.#G(J),this.#K()}get defaultValue(){return this.#q(this.getAttribute("default"),this.#j)}get isDefault(){return m(this.value,this.defaultValue)}resetToDefault(){this.value=this.defaultValue,b(this)}focus(J){if(O(this,"disabled"))return;this.#Q?.focus(J)}}L("propskit-joystick",RJ);class VJ extends S{static observedAttributes=["value","default","label","aria-label","precision","drag","disabled"];#Z=null;#$=null;#J=!1;#Q=null;#_=null;#j={x:50,y:50};#Y=!1;#B=this.#H.bind(this,"input");#M=this.#H.bind(this,"change");connectedCallback(){if(!this.#Z)this.#j=this.#G(this.getAttribute("value"),this.#j),this.#O(this.#j),this.#k();this.#U(),this.#N(),this.#F(),this.#_?.observe(this.#Q,{childList:!0,subtree:!0}),W(this)}disconnectedCallback(){this.#W(),this.#_?.disconnect(),f(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="value"&&!this.#Y)this.#O(this.#G(Z,this.value)),this.#P();else if(J==="label"||J==="aria-label")this.#U();else if(J==="precision"||J==="drag")this.#K();else if(J==="disabled")this.#L()}#X(J,Q=50){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#q(J,Q,Z){let $=String(J??"").trim().toLowerCase(),j=Q==="x"?{left:0,center:50,right:100}:{top:0,center:50,bottom:100};if($ in j)return j[$];let _=Number.parseFloat($.replace(/%/g,""));return Number.isFinite(_)?_:Z}#G(J,Q={x:50,y:50}){let Z=J;if(typeof J==="string"){let $=J.trim();if(!$)return{...Q};try{Z=JSON.parse($)}catch{let j=$.replace(/,/g," ").split(/\s+/).filter(Boolean);Z={x:this.#q(j[0],"x",Q.x),y:this.#q(j[1]??j[0],"y",Q.y)}}}if(!Z||typeof Z!=="object"||Array.isArray(Z))return{...Q};return{x:this.#X(Z.x,Q.x),y:this.#X(Z.y,Q.y)}}#O(J){let Q=this.#G(J,this.#j),Z=JSON.stringify(Q);if(this.getAttribute("value")!==Z)this.#Y=!0,this.setAttribute("value",Z),this.#Y=!1;return Q}#k(){let J=this.querySelector(":scope > label"),Q=N("div",{className:"propskit-origin-surface",role:"group"}),Z=J||document.createElement("label"),$=document.createElement("fig-origin-grid");$.setAttribute("fields","true"),$.setAttribute("aspect-ratio","1 / 1"),Q.append(Z,$),this.#Z=Q,this.#$=Z,this.#J=Boolean(J),this.#Q=$,this.replaceChildren(Q),this.#_=new MutationObserver(()=>this.#T()),this.#_.observe($,{childList:!0,subtree:!0})}#U(){let J=C(this,this.#Z,this.#$,this.#J);R(this,this.#Q,J,"Origin"),this.#T()}#N(){this.#K(),this.#P(),this.#L()}#K(){if(!this.#Q)return;this.#Q.setAttribute("fields","true"),this.#Q.setAttribute("aspect-ratio","1 / 1");for(let J of["precision","drag"])if(this.hasAttribute(J))this.#Q.setAttribute(J,this.getAttribute(J)??"");else this.#Q.removeAttribute(J)}#P(){if(!this.#Q)return;let J=this.value,Q=`${J.x}% ${J.y}%`;if(this.#Q.getAttribute("value")!==Q)this.#Q.setAttribute("value",Q)}#L(){if(!this.#Q||!this.#Z)return;let J=O(this,"disabled");this.#Z.setAttribute("aria-disabled",String(J)),this.#Q.toggleAttribute("disabled",J),this.#Q.inert=J,this.#T()}#T(){if(!this.#Q)return;let J=O(this,"disabled"),Q=this.#$?.isConnected?this.#$.id:"",Z=this.getAttribute("aria-label")?.trim(),$=this.#Q.querySelector("fig-handle");if($)if($.toggleAttribute("disabled",J),Z)$.setAttribute("aria-label",Z),$.removeAttribute("aria-labelledby");else if(Q)$.setAttribute("aria-labelledby",Q),$.removeAttribute("aria-label");else $.setAttribute("aria-label","Origin"),$.removeAttribute("aria-labelledby");for(let j of this.#Q.querySelectorAll("fig-input-number"))j.toggleAttribute("disabled",J)}#F(){this.#W(),this.#Q?.addEventListener("input",this.#B),this.#Q?.addEventListener("change",this.#M)}#W(){this.#Q?.removeEventListener("input",this.#B),this.#Q?.removeEventListener("change",this.#M)}#H(J,Q){if(Q.stopImmediatePropagation(),Q.target!==this.#Q||O(this,"disabled"))return;let Z=this.#G(Q.detail,this.value);this.#O(Z),this.#P(),K(this,J)}get value(){return this.#G(this.getAttribute("value"),this.#j)}set value(J){this.#O(J),this.#P()}get defaultValue(){return this.#G(this.getAttribute("default"),this.#j)}get isDefault(){return m(this.value,this.defaultValue)}resetToDefault(){this.value=this.defaultValue,b(this)}focus(J){if(O(this,"disabled"))return;this.#Q?.querySelector("fig-handle")?.focus(J)}}L("propskit-origin",VJ);class _J extends S{static observedAttributes=["value","default","label","aria-label","precision","edit","disabled"];#Z=null;#$=null;#J=!1;#Q=null;#_=null;#j=null;#Y=!1;#B=this.#f.bind(this,"input");#M=this.#f.bind(this,"change");connectedCallback(){if(!this.#Z)this.#j=this.#k(this.getAttribute("value"),this.#q()),this.#U(this.#j),this.#N();this.#K(),this.#P(),this.#H(),this.#_?.observe(this.#Q,{childList:!0,subtree:!0}),W(this)}disconnectedCallback(){this.#z(),this.#_?.disconnect(),f(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="value"&&!this.#Y)this.#U(this.#k(Z,this.value)),this.#T();else if(J==="label"||J==="aria-label")this.#K();else if(J==="precision"||J==="edit")this.#L();else if(J==="disabled")this.#F()}#X(){return this.localName==="propskit-spring"}#q(){return this.#X()?{stiffness:200,damping:15,mass:1}:{x1:0.42,y1:0,x2:0.58,y2:1}}#G(J,Q){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#O(J,Q){let Z=this.#G(J,Q);return Z>0?Z:Q}#k(J,Q=this.#q()){let Z=J;if(typeof J==="string"){let $=J.trim();if(!$)return{...Q};try{Z=JSON.parse($)}catch{if(this.#X()){let j=$.match(/^spring\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)$/);Z=j?{stiffness:Number(j[1]),damping:Number(j[2]),mass:Number(j[3])}:null}else{let _=$.replace(/^cubic-bezier\(\s*/i,"").replace(/\s*\)$/,"").split(",").map((X)=>Number(X.trim()));Z=_.length===4&&_.every(Number.isFinite)?{x1:_[0],y1:_[1],x2:_[2],y2:_[3]}:null}}}if(this.#X()){if(!Z||typeof Z!=="object"||Array.isArray(Z))return{...Q};return{stiffness:this.#O(Z.stiffness,Q.stiffness),damping:this.#O(Z.damping,Q.damping),mass:this.#O(Z.mass,Q.mass)}}if(Array.isArray(Z))Z={x1:Z[0],y1:Z[1],x2:Z[2],y2:Z[3]};if(!Z||typeof Z!=="object")return{...Q};return{x1:Math.max(0,Math.min(1,this.#G(Z.x1,Q.x1))),y1:this.#G(Z.y1,Q.y1),x2:Math.max(0,Math.min(1,this.#G(Z.x2,Q.x2))),y2:this.#G(Z.y2,Q.y2)}}#U(J){let Q=this.#j||this.#q(),Z=this.#k(J,Q),$=JSON.stringify(Z);if(this.getAttribute("value")!==$)this.#Y=!0,this.setAttribute("value",$),this.#Y=!1;return Z}#N(){let J=this.querySelector(":scope > label"),Q=N("div",{className:`${this.localName}-surface`,role:"group"}),Z=J||document.createElement("label"),$=document.createElement("fig-easing-curve");$.setAttribute("mode",this.#X()?"spring":"bezier"),$.setAttribute("aspect-ratio","1 / 1"),Q.append(Z,$),this.#Z=Q,this.#$=Z,this.#J=Boolean(J),this.#Q=$,this.replaceChildren(Q),this.#_=new MutationObserver(()=>this.#W()),this.#_.observe($,{childList:!0,subtree:!0})}#K(){let J=C(this,this.#Z,this.#$,this.#J);R(this,this.#Q,J,this.#X()?"Spring":"Easing"),this.#W()}#P(){this.#L(),this.#T(),this.#F()}#L(){if(!this.#Q)return;this.#Q.setAttribute("mode",this.#X()?"spring":"bezier"),this.#Q.setAttribute("aspect-ratio","1 / 1");for(let J of["precision","edit"])if(this.hasAttribute(J))this.#Q.setAttribute(J,this.getAttribute(J)??"");else this.#Q.removeAttribute(J)}#T(){if(!this.#Q)return;let J=this.value,Q=this.#X()?`spring(${J.stiffness}, ${J.damping}, ${J.mass})`:`${J.x1}, ${J.y1}, ${J.x2}, ${J.y2}`;if(this.#Q.getAttribute("value")!==Q)this.#Q.setAttribute("value",Q)}#F(){if(!this.#Q||!this.#Z)return;let J=O(this,"disabled");this.#Z.setAttribute("aria-disabled",String(J)),this.#Q.toggleAttribute("disabled",J),this.#Q.inert=J,this.#W()}#W(){if(!this.#Q)return;let J=O(this,"disabled");this.#Q.querySelector("fig-select")?.setAttribute("variant","ghost");for(let Q of this.#Q.querySelectorAll("fig-handle, fig-select, fig-dropdown, fig-input-text"))Q.toggleAttribute("disabled",J);for(let Q of this.#Q.querySelectorAll("input, select"))Q.disabled=J}#H(){this.#z(),this.#Q?.addEventListener("input",this.#B),this.#Q?.addEventListener("change",this.#M)}#z(){this.#Q?.removeEventListener("input",this.#B),this.#Q?.removeEventListener("change",this.#M)}#f(J,Q){if(Q.stopImmediatePropagation(),Q.target!==this.#Q||O(this,"disabled"))return;let Z=this.#k(Q.detail?.value,this.value);this.#U(Z),this.#T(),K(this,J)}get value(){return this.#k(this.getAttribute("value"),this.#j||this.#q())}set value(J){this.#U(J),this.#T()}get defaultValue(){return this.#k(this.getAttribute("default"),this.#j||this.#q())}get isDefault(){return m(this.value,this.defaultValue)}resetToDefault(){this.value=this.defaultValue,b(this)}focus(J){if(O(this,"disabled"))return;this.#Q?.querySelector("fig-select, fig-dropdown, fig-handle, fig-input-text")?.focus(J)}}class fJ extends _J{}L("propskit-easing",fJ);class CJ extends _J{}L("propskit-spring",CJ);class AJ extends S{static observedAttributes=["label","collapsible","open","disabled","value"];#Z=null;#$=null;#J=null;#Q=!1;#_=!1;#j=!1;#Y=this.#P.bind(this,"input");#B=this.#P.bind(this,"change");#M=this.#L.bind(this);connectedCallback(){if(!this.#Q)this.#O(this.#G()),this.#Q=!0;if(!this.#Z)this.#k();this.#U(),this.#N(),this.#K(this.#G()),this.removeEventListener("input",this.#Y),this.addEventListener("input",this.#Y),this.removeEventListener("change",this.#B),this.addEventListener("change",this.#B),this.removeEventListener("openchange",this.#M),this.addEventListener("openchange",this.#M)}disconnectedCallback(){this.removeEventListener("input",this.#Y),this.removeEventListener("change",this.#B),this.removeEventListener("openchange",this.#M)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Q)return;if(J==="value"){if(!this.#_){let $=this.#O(this.#G());this.#K($)}return}if(J==="disabled"){this.#N();return}this.#U()}#X(J,Q){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#q(J){let Q=J;if(typeof J==="string")try{Q=JSON.parse(J)}catch{Q=null}if(!Q||typeof Q!=="object"||Array.isArray(Q))Q={};return{x:this.#X(Q.x,50),y:this.#X(Q.y,50),color:typeof Q.color==="string"&&Q.color.trim()?Q.color.trim():"#D9D9D9"}}#G(){return this.#q(this.getAttribute("value"))}#O(J){let Q=this.#q(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#_=!0,this.setAttribute("value",Z),this.#_=!1,Q}#k(){let J=this.#G(),Q=document.createElement("fig-group"),Z=document.createElement("propskit-color"),$=document.createElement("propskit-position");Q.setAttribute("compact",""),Z.setAttribute("label","Color"),Z.setAttribute("value",J.color),Z.setAttribute("data-propskit-color-point-control","color"),$.setAttribute("label","Position"),$.setAttribute("x",String(J.x)),$.setAttribute("y",String(J.y)),$.setAttribute("units","percent"),$.setAttribute("data-propskit-color-point-control","position"),this.#Z=Q,this.#$=Z,this.#J=$,this.#U(),this.#N(),Q.append(Z,$),this.replaceChildren(Q)}#U(){if(!this.#Z)return;this.#Z.setAttribute("compact","");let J=this.getAttribute("label")?.trim();if(J)this.#Z.setAttribute("name",J);else this.#Z.removeAttribute("name");if(this.#Z.toggleAttribute("collapsible",this.collapsible),this.collapsible)this.#Z.setAttribute("open",String(this.open));else this.#Z.removeAttribute("open")}#N(){n(this,[this.#$,this.#J])}#K(J){let Q=this.#q(J);if(this.#$)this.#$.value=Q.color;if(this.#J)this.#J.value={x:Q.x,y:Q.y}}#P(J,Q){if(Q.target===this)return;let Z=Q.target?.closest?.("[data-propskit-color-point-control]");if(!Z||!this.contains(Z))return;if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let $=this.value,j=Z.getAttribute("data-propskit-color-point-control");if(j==="color")$.color=Z.value||Z.getAttribute("value");else if(j==="position")$.x=this.#X(Z.value?.x,$.x),$.y=this.#X(Z.value?.y,$.y);else return;this.#O($),K(this,J)}#L(J){if(J.target!==this.#Z||this.#j)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#j=!0,this.setAttribute("open",String(Q)),this.#j=!1,this.dispatchEvent(new CustomEvent("openchange",{detail:{open:Q},bubbles:!0,composed:!0}))}get collapsible(){let J=this.getAttribute("collapsible");return J===null||J!=="false"}set collapsible(J){this.setAttribute("collapsible",String(Boolean(J)))}get open(){let J=this.getAttribute("open");return J===null||J!=="false"}set open(J){this.setAttribute("open",String(Boolean(J)))}get value(){return{...this.#G()}}set value(J){let Q=this.#O(J);this.#K(Q)}focus(J){this.#$?.focus(J)}}L("propskit-color-point",AJ);class EJ extends S{static observedAttributes=["label","collapsible","open","units","disabled","value"];#Z=null;#$=null;#J=null;#Q=!1;#_=!1;#j=!1;#Y=this.#W.bind(this,"input");#B=this.#W.bind(this,"change");#M=this.#H.bind(this);connectedCallback(){if(!this.#Q)this.#k(this.#O()),this.#Q=!0;if(!this.#Z)this.#N();this.#K(),this.#P(),this.#L(),this.#T(this.#O()),this.removeEventListener("input",this.#Y),this.addEventListener("input",this.#Y),this.removeEventListener("change",this.#B),this.addEventListener("change",this.#B),this.removeEventListener("openchange",this.#M),this.addEventListener("openchange",this.#M)}disconnectedCallback(){this.removeEventListener("input",this.#Y),this.removeEventListener("change",this.#B),this.removeEventListener("openchange",this.#M)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Q)return;if(J==="value"){if(!this.#_){let $=this.#k(this.#O());this.#T($)}return}if(J==="units"){this.#P();return}if(J==="disabled"){this.#L();return}this.#K()}#X(J,Q){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#q(J){if(typeof J==="string"&&J.trim().endsWith("%")){let Q=Number.parseFloat(J);if(Number.isFinite(Q))return`${Q}%`}return this.#X(J,0)}#G(J){let Q=J;if(typeof J==="string")try{Q=JSON.parse(J)}catch{Q=null}if(!Q||typeof Q!=="object"||Array.isArray(Q))Q={};return{x:this.#X(Q.x,50),y:this.#X(Q.y,50),radius:this.#q(Q.radius)}}#O(){return this.#G(this.getAttribute("value"))}#k(J){let Q=this.#G(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#_=!0,this.setAttribute("value",Z),this.#_=!1,Q}#U(J){let Q=typeof J==="string"&&J.trim().endsWith("%");return{value:Q?Number.parseFloat(J):J,units:Q?"%":"px"}}#N(){let J=this.#O(),Q=this.#U(J.radius),Z=document.createElement("fig-group"),$=document.createElement("propskit-position"),j=document.createElement("propskit-number");if(Z.setAttribute("compact",""),$.setAttribute("label","Position"),$.setAttribute("x",String(J.x)),$.setAttribute("y",String(J.y)),this.hasAttribute("units"))$.setAttribute("units",this.units);if($.setAttribute("data-propskit-point-radius-control","position"),j.setAttribute("label","Radius"),j.setAttribute("value",String(Q.value)),this.units==="percent")j.setAttribute("units","%");j.setAttribute("units-disallow",""),j.setAttribute("min","0"),j.setAttribute("precision","2"),j.setAttribute("data-propskit-point-radius-control","radius"),this.#Z=Z,this.#$=$,this.#J=j,this.#K(),this.#L(),Z.append($,j),this.replaceChildren(Z)}#K(){if(!this.#Z)return;this.#Z.setAttribute("compact","");let J=this.getAttribute("label")?.trim();if(J)this.#Z.setAttribute("name",J);else this.#Z.removeAttribute("name");if(this.#Z.toggleAttribute("collapsible",this.collapsible),this.collapsible)this.#Z.setAttribute("open",String(this.open));else this.#Z.removeAttribute("open")}#P(){if(this.hasAttribute("units"))this.#$?.setAttribute("units",this.units);else this.#$?.removeAttribute("units");if(this.units==="percent")this.#J?.setAttribute("units","%");else this.#J?.removeAttribute("units")}#L(){n(this,[this.#$,this.#J])}#T(J){let Q=this.#G(J);if(this.#$)this.#$.value={x:Q.x,y:Q.y};if(this.#J){let Z=this.#U(Q.radius);this.#J.value=Z.value}}#F(J,Q){let Z=this.#U(Q).value,$=this.#X(J.value,Z);return(J.querySelector("fig-input-number")?.getAttribute("units")||J.getAttribute("units"))==="%"?`${$}%`:$}#W(J,Q){if(Q.target===this)return;let Z=Q.target?.closest?.("[data-propskit-point-radius-control]");if(!Z||!this.contains(Z))return;if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let $=this.value,j=Z.getAttribute("data-propskit-point-radius-control");if(j==="position")$.x=this.#X(Z.value?.x,$.x),$.y=this.#X(Z.value?.y,$.y);else if(j==="radius")$.radius=this.#F(Z,$.radius);else return;this.#k($),K(this,J)}#H(J){if(J.target!==this.#Z||this.#j)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#j=!0,this.setAttribute("open",String(Q)),this.#j=!1,this.dispatchEvent(new CustomEvent("openchange",{detail:{open:Q},bubbles:!0,composed:!0}))}get collapsible(){let J=this.getAttribute("collapsible");return J===null||J!=="false"}set collapsible(J){this.setAttribute("collapsible",String(Boolean(J)))}get open(){let J=this.getAttribute("open");return J===null||J!=="false"}set open(J){this.setAttribute("open",String(Boolean(J)))}get units(){return this.getAttribute("units")?.trim().toLowerCase()==="percent"?"percent":"none"}set units(J){this.setAttribute("units",String(J).trim().toLowerCase()==="none"?"none":"percent")}get value(){return{...this.#O()}}set value(J){let Q=this.#k(J);this.#T(Q)}focus(J){this.#$?.focus(J)}}L("propskit-point-radius",EJ);class DJ extends S{static observedAttributes=["label","collapsible","open","units","disabled","value"];#Z=null;#$=null;#J=null;#Q=null;#_=!1;#j=!1;#Y=!1;#B=this.#H.bind(this,"input");#M=this.#H.bind(this,"change");#X=this.#z.bind(this);connectedCallback(){if(!this.#_)this.#U(this.#k()),this.#_=!0;if(!this.#Z)this.#K();this.#P(),this.#L(),this.#T(),this.#F(this.#k()),this.removeEventListener("input",this.#B),this.addEventListener("input",this.#B),this.removeEventListener("change",this.#M),this.addEventListener("change",this.#M),this.removeEventListener("openchange",this.#X),this.addEventListener("openchange",this.#X)}disconnectedCallback(){this.removeEventListener("input",this.#B),this.removeEventListener("change",this.#M),this.removeEventListener("openchange",this.#X)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#_)return;if(J==="value"){if(!this.#j){let $=this.#U(this.#k());this.#F($)}return}if(J==="units"){this.#L();return}if(J==="disabled"){this.#T();return}this.#P()}#q(J,Q){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#G(J){if(typeof J==="string"&&J.trim().endsWith("%")){let Q=Number.parseFloat(J);if(Number.isFinite(Q))return`${Q}%`}return this.#q(J,0)}#O(J){let Q=J;if(typeof J==="string")try{Q=JSON.parse(J)}catch{Q=null}if(!Q||typeof Q!=="object"||Array.isArray(Q))Q={};return{x:this.#q(Q.x,50),y:this.#q(Q.y,50),radius:this.#G(Q.radius),angle:this.#q(Q.angle,0)}}#k(){return this.#O(this.getAttribute("value"))}#U(J){let Q=this.#O(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#j=!0,this.setAttribute("value",Z),this.#j=!1,Q}#N(J){let Q=typeof J==="string"&&J.trim().endsWith("%");return{value:Q?Number.parseFloat(J):J,units:Q?"%":"px"}}#K(){let J=this.#k(),Q=this.#N(J.radius),Z=document.createElement("fig-group"),$=document.createElement("propskit-position"),j=document.createElement("propskit-number"),_=document.createElement("propskit-number");if(Z.setAttribute("compact",""),$.setAttribute("label","Position"),$.setAttribute("x",String(J.x)),$.setAttribute("y",String(J.y)),this.hasAttribute("units"))$.setAttribute("units",this.units);if($.setAttribute("data-propskit-point-radius-angle-control","position"),j.setAttribute("label","Radius"),j.setAttribute("value",String(Q.value)),this.units==="percent")j.setAttribute("units","%");j.setAttribute("units-disallow",""),j.setAttribute("min","0"),j.setAttribute("precision","2"),j.setAttribute("data-propskit-point-radius-angle-control","radius"),_.setAttribute("label","Angle"),_.setAttribute("value",String(J.angle)),_.setAttribute("units","°"),_.setAttribute("units-disallow",""),_.setAttribute("precision","1"),_.setAttribute("data-propskit-point-radius-angle-control","angle"),this.#Z=Z,this.#$=$,this.#J=j,this.#Q=_,this.#P(),this.#T(),Z.append($,j,_),this.replaceChildren(Z)}#P(){if(!this.#Z)return;this.#Z.setAttribute("compact","");let J=this.getAttribute("label")?.trim();if(J)this.#Z.setAttribute("name",J);else this.#Z.removeAttribute("name");if(this.#Z.toggleAttribute("collapsible",this.collapsible),this.collapsible)this.#Z.setAttribute("open",String(this.open));else this.#Z.removeAttribute("open")}#L(){if(this.hasAttribute("units"))this.#$?.setAttribute("units",this.units);else this.#$?.removeAttribute("units");if(this.units==="percent")this.#J?.setAttribute("units","%");else this.#J?.removeAttribute("units")}#T(){n(this,[this.#$,this.#J,this.#Q])}#F(J){let Q=this.#O(J);if(this.#$)this.#$.value={x:Q.x,y:Q.y};if(this.#J){let Z=this.#N(Q.radius);this.#J.value=Z.value}if(this.#Q)this.#Q.value=Q.angle}#W(J,Q){let Z=this.#N(Q).value,$=this.#q(J.value,Z);return(J.querySelector("fig-input-number")?.getAttribute("units")||J.getAttribute("units"))==="%"?`${$}%`:$}#H(J,Q){if(Q.target===this)return;let Z=Q.target?.closest?.("[data-propskit-point-radius-angle-control]");if(!Z||!this.contains(Z))return;if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let $=this.value,j=Z.getAttribute("data-propskit-point-radius-angle-control");if(j==="position")$.x=this.#q(Z.value?.x,$.x),$.y=this.#q(Z.value?.y,$.y);else if(j==="radius")$.radius=this.#W(Z,$.radius);else if(j==="angle")$.angle=this.#q(Z.value,$.angle);else return;this.#U($),K(this,J)}#z(J){if(J.target!==this.#Z||this.#Y)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#Y=!0,this.setAttribute("open",String(Q)),this.#Y=!1,this.dispatchEvent(new CustomEvent("openchange",{detail:{open:Q},bubbles:!0,composed:!0}))}get collapsible(){let J=this.getAttribute("collapsible");return J===null||J!=="false"}set collapsible(J){this.setAttribute("collapsible",String(Boolean(J)))}get open(){let J=this.getAttribute("open");return J===null||J!=="false"}set open(J){this.setAttribute("open",String(Boolean(J)))}get units(){return this.getAttribute("units")?.trim().toLowerCase()==="percent"?"percent":"none"}set units(J){this.setAttribute("units",String(J).trim().toLowerCase()==="none"?"none":"percent")}get value(){return{...this.#k()}}set value(J){let Q=this.#U(J);this.#F(Q)}focus(J){this.#$?.focus(J)}}L("propskit-point-radius-angle",DJ);class IJ extends S{static observedAttributes=["label","collapsible","open","units","disabled","value"];#Z=null;#$=null;#J=null;#Q=!1;#_=!1;#j=!1;#Y=this.#T.bind(this,"input");#B=this.#T.bind(this,"change");#M=this.#F.bind(this);connectedCallback(){if(!this.#Q)this.#O(this.#G()),this.#Q=!0;if(!this.#Z)this.#U();this.#N(),this.#K(),this.#P(),this.#L(this.#G()),this.removeEventListener("input",this.#Y),this.addEventListener("input",this.#Y),this.removeEventListener("change",this.#B),this.addEventListener("change",this.#B),this.removeEventListener("openchange",this.#M),this.addEventListener("openchange",this.#M)}disconnectedCallback(){this.removeEventListener("input",this.#Y),this.removeEventListener("change",this.#B),this.removeEventListener("openchange",this.#M)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Q)return;if(J==="value"){if(!this.#_){let $=this.#O(this.#G());this.#L($)}return}if(J==="units"){this.#K();return}if(J==="disabled"){this.#P();return}this.#N()}#X(J,Q){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#q(J){let Q=J;if(typeof J==="string")try{Q=JSON.parse(J)}catch{Q=null}if(!Q||typeof Q!=="object"||Array.isArray(Q))Q={};return{x:this.#X(Q.x,50),y:this.#X(Q.y,50),x2:this.#X(Q.x2,75),y2:this.#X(Q.y2,75)}}#G(){return this.#q(this.getAttribute("value"))}#O(J){let Q=this.#q(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#_=!0,this.setAttribute("value",Z),this.#_=!1,Q}#k(J,Q,Z,$){let j=document.createElement("propskit-position");if(j.setAttribute("label",J),j.setAttribute("x",String(Z)),j.setAttribute("y",String($)),this.hasAttribute("units"))j.setAttribute("units",this.units);return j.setAttribute("data-propskit-point-point-control",Q),j}#U(){let J=this.#G(),Q=document.createElement("fig-group"),Z=this.#k("Start","start",J.x,J.y),$=this.#k("End","end",J.x2,J.y2);Q.setAttribute("compact",""),this.#Z=Q,this.#$=Z,this.#J=$,this.#N(),this.#P(),Q.append(Z,$),this.replaceChildren(Q)}#N(){if(!this.#Z)return;this.#Z.setAttribute("compact","");let J=this.getAttribute("label")?.trim();if(J)this.#Z.setAttribute("name",J);else this.#Z.removeAttribute("name");if(this.#Z.toggleAttribute("collapsible",this.collapsible),this.collapsible)this.#Z.setAttribute("open",String(this.open));else this.#Z.removeAttribute("open")}#K(){for(let J of[this.#$,this.#J]){if(!J)continue;if(this.hasAttribute("units"))J.setAttribute("units",this.units);else J.removeAttribute("units")}}#P(){n(this,[this.#$,this.#J])}#L(J){let Q=this.#q(J);if(this.#$)this.#$.value={x:Q.x,y:Q.y};if(this.#J)this.#J.value={x:Q.x2,y:Q.y2}}#T(J,Q){if(Q.target===this)return;let Z=Q.target?.closest?.("[data-propskit-point-point-control]");if(!Z||!this.contains(Z))return;if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let $=this.value,j=Z.value,_=Z.getAttribute("data-propskit-point-point-control");if(_==="start")$.x=this.#X(j?.x,$.x),$.y=this.#X(j?.y,$.y);else if(_==="end")$.x2=this.#X(j?.x,$.x2),$.y2=this.#X(j?.y,$.y2);else return;this.#O($),K(this,J)}#F(J){if(J.target!==this.#Z||this.#j)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#j=!0,this.setAttribute("open",String(Q)),this.#j=!1,this.dispatchEvent(new CustomEvent("openchange",{detail:{open:Q},bubbles:!0,composed:!0}))}get collapsible(){let J=this.getAttribute("collapsible");return J===null||J!=="false"}set collapsible(J){this.setAttribute("collapsible",String(Boolean(J)))}get open(){let J=this.getAttribute("open");return J===null||J!=="false"}set open(J){this.setAttribute("open",String(Boolean(J)))}get units(){return this.getAttribute("units")?.trim().toLowerCase()==="percent"?"percent":"none"}set units(J){this.setAttribute("units",String(J).trim().toLowerCase()==="none"?"none":"percent")}get value(){return{...this.#G()}}set value(J){let Q=this.#O(J);this.#L(Q)}focus(J){this.#$?.focus(J)}}L("propskit-point-point",IJ);class t extends S{static observedAttributes=["name","open","show-reset","disabled"];static#Z=["propskit-color","propskit-fill","propskit-gradient","propskit-easing","propskit-joystick","propskit-number","propskit-origin","propskit-position","propskit-color-point","propskit-point-radius","propskit-point-radius-angle","propskit-point-point","propskit-select","propskit-slider","propskit-spring","propskit-switch","propskit-text","propskit-wheel","propskit-oscillator"].join(",");#$=null;#J=null;#Q=null;#_=null;#j=0;#Y=()=>this.#X();connectedCallback(){this.#z(),this.#N(),this.#B(),requestAnimationFrame(()=>{this.#L()})}disconnectedCallback(){if(this.#M(),this.#j)cancelAnimationFrame(this.#j),this.#j=0;this.#$?.removeEventListener("click",this.#G),this.#$?.removeEventListener("keydown",this.#O),this.#Q?.querySelector("fig-button")?.removeEventListener("click",this.#k)}attributeChangedCallback(J,Q,Z){if(Q===Z)return;if(J==="open"){this.#$?.setAttribute("aria-expanded",String(this.open));return}if(J==="show-reset"){this.#W(),this.#L();return}if(J==="disabled"){this.#N();return}this.#z()}get open(){let J=this.getAttribute("open");return J!==null&&J!=="false"}set open(J){let Q=this.open;if(J)this.setAttribute("open","true");else this.setAttribute("open","false");if(this.#$?.setAttribute("aria-expanded",String(!!J)),Q!==!!J)this.dispatchEvent(new CustomEvent("openchange",{detail:{open:!!J},bubbles:!0}))}get showReset(){let J=this.getAttribute("show-reset");if(J===null)return!0;return J!=="false"}set showReset(J){if(J)this.setAttribute("show-reset","true");else this.setAttribute("show-reset","false")}get dirty(){return this.hasAttribute("data-dirty")&&this.getAttribute("data-dirty")!=="false"}resetProperties(){this.#F()}#B(){if(this.removeEventListener("input",this.#Y,!0),this.removeEventListener("change",this.#Y,!0),this.addEventListener("input",this.#Y,!0),this.addEventListener("change",this.#Y,!0),!this.#_)this.#_=new MutationObserver(()=>{this.#N(),this.#X()});this.#_.disconnect(),this.#_.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value","checked","default","x","y"]})}#M(){this.removeEventListener("input",this.#Y,!0),this.removeEventListener("change",this.#Y,!0),this.#_?.disconnect()}#X(){if(this.#j)return;this.#j=requestAnimationFrame(()=>{this.#j=0,this.#L()})}#q(J){return J instanceof Element&&Boolean(J.closest(".propskit-group-reset, .propskit-group-reset-tooltip"))}#G=(J)=>{if(O(this,"disabled"))return;if(this.#q(J.target))return;J.stopPropagation(),this.open=!this.open};#O=(J)=>{if(O(this,"disabled"))return;if(this.#q(J.target))return;if(J.key!=="Enter"&&J.key!==" ")return;J.preventDefault(),J.stopPropagation(),this.open=!this.open};#k=(J)=>{if(J.preventDefault(),J.stopPropagation(),O(this,"disabled"))return;this.#F()};#U(){return[...this.querySelectorAll(t.#Z)].filter((J)=>J.closest("propskit-group")===this&&!J.parentElement?.closest(t.#Z))}#N(){let J=O(this,"disabled");for(let Q of this.#U())if(J){if(!O(Q,"disabled"))Q.setAttribute("disabled",""),Q.setAttribute("data-propskit-group-disabled","")}else if(Q.hasAttribute("data-propskit-group-disabled"))Q.removeAttribute("disabled"),Q.removeAttribute("data-propskit-group-disabled");this.#$?.setAttribute("aria-disabled",String(J)),this.#$?.setAttribute("tabindex",J?"-1":"0"),this.#Q?.querySelector("fig-button")?.toggleAttribute("disabled",J)}#K(J){return J.isDefault===!1}#P(){for(let J of this.#U())if(this.#K(J))return!0;return!1}#L(){if(this.#P())this.setAttribute("data-dirty","");else this.removeAttribute("data-dirty");this.#W()}#T(J){if(typeof J.resetToDefault==="function")J.resetToDefault()}#F(){for(let J of this.#U())this.#T(J);this.#L(),this.dispatchEvent(new CustomEvent("reset",{bubbles:!0,composed:!0}))}#W(){if(!this.showReset){this.#Q?.setAttribute("hidden","");return}this.#H(),this.#Q?.removeAttribute("hidden")}#H(){if(!this.#$||!this.showReset)return;let J=this.#$.querySelector(":scope > .propskit-group-reset-tooltip");if(!J){J=document.createElement("fig-tooltip"),J.className="propskit-group-reset-tooltip",J.setAttribute("text","Reset properties");let Q=document.createElement("fig-button");Q.className="propskit-group-reset",Q.setAttribute("variant","ghost"),Q.setAttribute("icon",""),Q.setAttribute("aria-label","Reset properties");let Z=document.createElement("fig-icon");Z.setAttribute("name","reset"),Q.appendChild(Z),J.appendChild(Q),this.#$.appendChild(J),Q.addEventListener("click",this.#k)}else{let Q=J.querySelector("fig-button");Q?.removeEventListener("click",this.#k),Q?.addEventListener("click",this.#k)}this.#Q=J}#z(){let Q=this.getAttribute("name")||"Group",Z=this.querySelector(":scope > fig-header");if(Z)this.#$=Z;else if(!this.#$||!this.#$.dataset.generated||this.#$.parentElement!==this)this.#$=document.createElement("fig-header"),this.#$.setAttribute("borderless",""),this.#$.dataset.generated="true",this.prepend(this.#$);let $=this.#$.querySelector(":scope > h3"),j=this.#$.querySelector(":scope > fig-button.propskit-group-disclosure");if(!$&&j){if($=j.querySelector(":scope > h3"),$)this.#$.insertBefore($,j);j.remove()}if(!$)$=document.createElement("h3"),this.#$.prepend($);let _=$.querySelector(":scope > button.propskit-group-disclosure");if(_){while(_.firstChild)$.insertBefore(_.firstChild,_);_.remove()}if(!$.id)$.id=GJ("propskit-group");if(this.#$.dataset.generated)$.textContent=Q;if(!this.hasAttribute("role"))this.setAttribute("role","group");if(!this.hasAttribute("aria-label")&&!this.hasAttribute("aria-labelledby"))this.setAttribute("aria-labelledby",$.id);let X=this.#$.querySelector(":scope > .propskit-group-chevron")||$.querySelector(":scope > .propskit-group-chevron");if(!X)X=document.createElement("fig-icon"),X.setAttribute("name","chevron"),X.setAttribute("size","small"),X.className="propskit-group-chevron";if(this.#$.insertBefore(X,$),this.#J=X,this.#W(),this.#$.setAttribute("role","button"),this.#N(),this.#$.setAttribute("aria-expanded",String(this.open)),this.#$.removeEventListener("click",this.#G),this.#$.addEventListener("click",this.#G),this.#$.removeEventListener("keydown",this.#O),this.#$.addEventListener("keydown",this.#O),!this.hasAttribute("open"))this.setAttribute("open","false"),this.#$.setAttribute("aria-expanded","false")}}L("propskit-group",t);class s extends S{static#Z=4;static#$="propskit-slider-dragging";static#J=null;#Q=null;#_=null;#j=null;#Y=!1;#B=null;#M=new Set;#X=0;#q=0;#G=0;#O=null;#k=!0;#U=0;#N=1;#K=0;#P=null;#L=null;#T=0;#F=null;#W=null;#H=!1;#z=0;#f=null;#R=0;#D=null;#h=0;#I=null;#V=0;#p=0;#y=!1;#b=!1;#x=0;#C=null;#A=null;#d=this.#CJ.bind(this);#m=this.#RJ.bind(this);#E=this.#u.bind(this);#S=this.#HJ.bind(this);#jJ=this.#TJ.bind(this);#w=this.#MJ.bind(this);#v=this.#KJ.bind(this);#i=this.#fJ.bind(this);#t=this.#DJ.bind(this);#r=this.#WJ.bind(this);#g=new Set(["variant","color","text","full","elastic","size","name","class","data-wave-index","data-active","data-elastic-dragging","default","style"]);static get observedAttributes(){return["label","aria-label"]}connectedCallback(){if(!this.#Q)this.#kJ();if(this.#e(),this.#QJ(),this.#gJ(),this.#a(),this.#BJ(),this.#GJ(),this.removeEventListener("pointerdown",this.#d,{capture:!0}),this.addEventListener("pointerdown",this.#d,{capture:!0,passive:!0}),this.removeEventListener("pointerdown",this.#S,{capture:!0}),this.addEventListener("pointerdown",this.#S,{capture:!0}),this.removeEventListener("contextmenu",this.#i),this.addEventListener("contextmenu",this.#i),this.removeEventListener("click",this.#r,!0),this.addEventListener("click",this.#r,!0),this.#L?.removeEventListener("change",this.#t),this.#L?.addEventListener("change",this.#t),!this.#B)this.#B=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J)if($.type==="attributes"){if($.attributeName==="value"){this.#PJ();continue}if($.attributeName==="color"){Z=!0;continue}if($.attributeName&&this.#g.has($.attributeName))continue;if($.attributeName==="label"||$.attributeName==="aria-label")Q=!0;else if($.attributeName==="direction")continue;else Z=!0}if(Q)this.#e(),this.#a();if(Z)this.#QJ(),this.#a()});this.#B.observe(this,{attributes:!0})}disconnectedCallback(){if(this.#B?.disconnect(),this.#X)cancelAnimationFrame(this.#X),this.#X=0;if(this.#q)cancelAnimationFrame(this.#q),this.#q=0;if(this.#G)cancelAnimationFrame(this.#G),this.#G=0;this.#O?.disconnect(),this.#AJ(),this.#FJ(),clearTimeout(this.#x),this.#x=0,this.#YJ(),this.#zJ(),this.#l(),this.#cJ(),this.removeEventListener("pointerdown",this.#d,{capture:!0}),this.removeEventListener("pointerdown",this.#S,{capture:!0}),this.removeEventListener("contextmenu",this.#i),this.removeEventListener("click",this.#r,!0),this.#L?.removeEventListener("change",this.#t)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Q)return;if(J==="label"||J==="aria-label")this.#e(),this.#a()}#kJ(){let J=(this.getAttribute("type")||"range").toLowerCase();this.#W=this.getAttribute("value")??this.getAttribute("default")??(J==="delta"?"0":this.getAttribute("min")??"0");let Q=Array.from(this.childNodes).filter((X)=>{return X.nodeType!==Node.TEXT_NODE||Boolean(X.textContent?.trim())}),Z=Q.find((X)=>X.nodeType===Node.ELEMENT_NODE&&X.matches("label")),$=N("div",{className:"propskit-slider-surface"}),j=Z||document.createElement("label"),_=document.createElement("fig-slider");_.setAttribute("text","true");for(let X of this.#OJ()){let q=this.getAttribute(X);_.setAttribute(X,q??"")}$.append(j,_),this.#Q=$,this.#_=j,this.#j=_,this.#Y=Boolean(Z),this.replaceChildren($),this.#n();for(let X of Q){if(X===Z)continue;this.#j.appendChild(X)}}#n(){let J=document.createElement("fig-menu");J.setAttribute("position","bottom left"),J.setAttribute("offset","0 0");let Q=document.createElement("fig-menu-item");Q.setAttribute("value","reset-default"),Q.textContent="Reset",J.appendChild(Q),J.addEventListener("change",this.#t),this.#L=J,this.appendChild(J)}#e(){C(this,this.#Q,this.#_,this.#Y),this.#GJ()}#QJ(){if(!this.#j)return;let J=this.#OJ(),Q=new Set(J.filter(($)=>$!=="text"&&$!=="value"));for(let $ of this.#M)if(!Q.has($))this.#j.removeAttribute($);for(let $ of J){if($==="text"||$==="value")continue;let j=this.getAttribute($)??"";if(this.#j.getAttribute($)!==j)this.#j.setAttribute($,j)}this.#j.removeAttribute("variant"),this.#j.removeAttribute("color"),this.#j.removeAttribute("transform"),this.#j.removeAttribute("full"),this.#j.setAttribute("text","true");let Z=(this.getAttribute("type")||"range").toLowerCase();if(Z==="delta"){let $=Number(this.#j.min),j=Number(this.#j.max),_=Number.isFinite($)&&Number.isFinite(j)?$+(j-$)/2:0;this.#j.setAttribute("default",String(_))}else this.#j.removeAttribute("default");if(Z==="stepper")this.#j.setAttribute("step",this.getAttribute("step")??"10");else if(!this.hasAttribute("step"))this.#j.removeAttribute("step");if(Z==="opacity")this.#j.style.setProperty("--color",this.getAttribute("color")||"var(--figma-color-bg-secondary)");else this.#j.style.removeProperty("--color");this.#s(Z),this.#M=Q,this.#PJ(),this.#SJ(),this.#k=!0,this.#BJ(),this.#GJ()}#s(J){let Q=this.#j?.querySelector("fig-input-number");if(!(J==="hue"||J==="opacity"&&this.hasAttribute("color"))){Q?.removeAttribute("theme"),this.style.removeProperty("--propskit-slider-filled-text-color");return}let $=Number(this.#j?.min),j=Number(this.#j?.max),_=Number(this.#j?.value),X=Number.isFinite($)&&Number.isFinite(j)&&j>$&&Number.isFinite(_)?Math.max(0,Math.min(1,(_-$)/(j-$))):0,q=this.getAttribute("color"),B=J==="hue"?`hsl(${X*360}deg 100% 50%)`:`color-mix(in srgb, ${q} ${X*100}%, var(--figma-color-bg-secondary))`,Y=getComputedStyle(this).colorScheme.trim().toLowerCase()==="dark",G=wJ(this.#j,B,J==="hue"?0.35:Y?0.2:0.35);if(G){Q?.setAttribute("theme",G);let M=G==="light"&&Y||G==="dark"&&!Y;this.style.setProperty("--propskit-slider-filled-text-color",M?"var(--figma-color-text)":"var(--figma-color-text-oninverse)")}else Q?.removeAttribute("theme"),this.style.removeProperty("--propskit-slider-filled-text-color")}#NJ(){if(!this.#j)return;let J=Number(this.#j.min),Q=Number(this.#j.max),Z=Number(this.#j.value),$=Number.isFinite(J)&&Number.isFinite(Q)&&Q>J&&Number.isFinite(Z)?Math.max(0,Math.min(1,(Z-J)/(Q-J))):0;this.style.setProperty("--propskit-slider-complete",String($)),this.#s((this.getAttribute("type")||"range").toLowerCase()),this.#GJ()}#BJ(){if(!globalThis.ResizeObserver)return;if(!this.#O)this.#O=new ResizeObserver(()=>{this.#k=!0,this.#GJ()});this.#O.disconnect();for(let J of[this,this.#_,this.#j?.querySelector("fig-input-number"),this.#j?.querySelector("fig-input-number input"),this.#j?.querySelector('input[type="range"]')])if(J)this.#O.observe(J)}#GJ(){if(this.#G)cancelAnimationFrame(this.#G);this.#G=requestAnimationFrame(()=>{this.#G=0,this.#qJ()})}#qJ(){let J=this.#j?.querySelector('input[type="range"]');if(!J||!this.#j)return;let Q=J.getBoundingClientRect();if(!Q.width)return;let Z=Number(J.min||0),$=Number(J.max||100),j=Number(J.value),_=Number.isFinite(Z)&&Number.isFinite($)&&$>Z&&Number.isFinite(j)?Math.max(0,Math.min(1,(j-Z)/($-Z))):0,X=Q.left+_*Q.width;if(this.#k)this.#U=this.#XJ("--slider-thumb-width",this.#j)/2,this.#N=Math.max(1,this.#XJ("--propskit-slider-handle-fade-start-threshold")),this.#K=Math.min(this.#N,this.#XJ("--propskit-slider-handle-fade-end-threshold")),this.#k=!1;let q=this.#U,B=[],Y=this.#_?.parentElement===this.#Q?this.#LJ(this.#_):null,G=this.#j.querySelector("fig-input-number input"),M=G?this.#JJ(G):null;if(Y?.width&&Y.bottom>Q.top&&Y.top<Q.bottom)B.push(X-q-Y.right);if(M?.width&&M.bottom>Q.top&&M.top<Q.bottom)B.push(M.left-X-q);let k=this.#N,U=this.#K,P=B.length?Math.min(...B):k,T=Math.max(0.001,k-U),H=Math.max(0,Math.min(1,(P-U)/T));this.style.setProperty("--propskit-slider-handle-proximity",String(H))}#LJ(J){let Q=document.createRange();Q.selectNodeContents(J);let Z=[...Q.getClientRects()].filter((q)=>q.width>0&&q.height>0);if(Q.detach?.(),!Z.length)return null;let $=Math.min(...Z.map((q)=>q.left)),j=Math.max(...Z.map((q)=>q.right)),_=Math.min(...Z.map((q)=>q.top)),X=Math.max(...Z.map((q)=>q.bottom));return{left:$,right:j,top:_,bottom:X,width:j-$,height:X-_}}#JJ(J){let Q=J.value||J.placeholder||"";if(!Q)return null;let Z=J.getBoundingClientRect(),$=getComputedStyle(J),j=this.#_J(Q,$),_=Z.left+(Number.parseFloat($.borderLeftWidth)||0)+(Number.parseFloat($.paddingLeft)||0),X=Z.right-(Number.parseFloat($.borderRightWidth)||0)-(Number.parseFloat($.paddingRight)||0),q=Math.max(0,X-_),B=Math.min(q,j),Y=$.textAlign,G=_;if(Y==="right"||Y==="end")G=X-B;else if(Y==="center")G=_+(q-B)/2;return{left:G,right:G+B,top:Z.top,bottom:Z.bottom,width:B,height:Z.height}}#_J(J,Q){if(!s.#J)s.#J=document.createElement("canvas");let Z=s.#J.getContext("2d");if(!Z)return 0;if(Z.font=Q.font||`${Q.fontStyle} ${Q.fontWeight} ${Q.fontSize} ${Q.fontFamily}`,"fontKerning"in Z)Z.fontKerning=Q.fontKerning;if("fontStretch"in Z)Z.fontStretch=Q.fontStretch;if("fontVariantCaps"in Z)Z.fontVariantCaps=Q.fontVariantCaps;if("letterSpacing"in Z)Z.letterSpacing=Q.letterSpacing;return Z.measureText(J).width}#XJ(J,Q=this){let Z=document.createElement("div");Z.style.setProperty(J,getComputedStyle(Q).getPropertyValue(J)),Object.assign(Z.style,{position:"absolute",visibility:"hidden",pointerEvents:"none",width:`var(${J})`}),this.appendChild(Z);let $=Number.parseFloat(getComputedStyle(Z).width);return Z.remove(),Number.isFinite($)?Math.max(0,$):0}#PJ(){if(!this.#j)return;let J=this.hasAttribute("value")?this.getAttribute("value")??"":this.#W??"";if(String(this.#j.value)!==J)this.#j.value=J;this.#NJ()}#OJ(){let J=new Set(["label","direction","oninput","onchange","steppers"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!this.#g.has(Q))}#SJ(){if(this.#X)cancelAnimationFrame(this.#X);this.#X=requestAnimationFrame(()=>{this.#X=0,this.#pJ(),this.#ZJ()})}#a(){if(this.#q)cancelAnimationFrame(this.#q);this.#q=requestAnimationFrame(()=>{this.#q=0,this.#ZJ()})}#ZJ(){let J=this.#j?.querySelector('input[type="range"]'),Q=this.#j?.querySelector("fig-input-number input");if(J!==this.#P)this.#UJ(J);if(J){J.removeAttribute("tabindex"),J.removeAttribute("aria-hidden");let Z=this.getAttribute("aria-label")?.trim();if(Z)J.setAttribute("aria-label",Z),J.removeAttribute("aria-labelledby");else if(this.#_?.parentElement===this.#Q&&this.#_.id)J.setAttribute("aria-labelledby",this.#_.id),J.removeAttribute("aria-label");else J.setAttribute("aria-label","Slider"),J.removeAttribute("aria-labelledby")}if(Q)Q.removeAttribute("tabindex"),Q.removeAttribute("aria-hidden")}#WJ(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number, fig-menu")){if(this.#b&&J.target.closest("fig-input-number"))J.preventDefault(),J.stopImmediatePropagation(),this.#b=!1;return}this.#o()}#o(){requestAnimationFrame(()=>{requestAnimationFrame(()=>{if(this.isConnected&&!O(this,"disabled"))this.focus()})})}#UJ(J){if(this.#l(),this.#P=J,!this.#P)return;this.#P.addEventListener("dblclick",this.#v,{capture:!0})}#l(){if(!this.#P)return;this.#P.removeEventListener("dblclick",this.#v,{capture:!0}),this.#P=null}#KJ(J){J.preventDefault(),J.stopImmediatePropagation(),this.#xJ()}#HJ(J){if(J.button!==0||J.altKey||O(this,"disabled")||!(J.target instanceof Element))return;let Q=J.target.closest("fig-input-number input");if(!Q||Q===document.activeElement)return;J.preventDefault(),J.stopImmediatePropagation(),this.#FJ(),this.#I=J.pointerId,this.#V=J.clientX,this.#p=J.clientY,this.#y=!1,window.addEventListener("pointermove",this.#jJ),window.addEventListener("pointerup",this.#w,{once:!0}),window.addEventListener("pointercancel",this.#w,{once:!0}),window.addEventListener("blur",this.#w,{once:!0})}#TJ(J){if(J.pointerId!==this.#I)return;if(J.buttons===0){this.#MJ(J);return}if(!this.#y){if(Math.hypot(J.clientX-this.#V,J.clientY-this.#p)<4)return;this.#y=!0,this.setAttribute("data-number-scrubbing",""),this.#$J(!0)}this.#EJ(this.#wJ(J),"input")}#MJ(J){if(J?.pointerId!==void 0&&this.#I!==null&&J.pointerId!==this.#I)return;let Q=this.#y;if(this.#FJ(),Q){this.#EJ(this.#j?.value,"change"),this.#b=!0,clearTimeout(this.#x),this.#x=window.setTimeout(()=>{this.#b=!1,this.#x=0},0),this.#o();return}this.#j?.querySelector("fig-input-number input")?.focus()}#FJ(){window.removeEventListener("pointermove",this.#jJ),window.removeEventListener("pointerup",this.#w),window.removeEventListener("pointercancel",this.#w),window.removeEventListener("blur",this.#w),this.#I=null,this.#y=!1,this.removeAttribute("data-number-scrubbing"),this.#$J(!1)}#CJ(J){if(J.button!==0||O(this,"disabled"))return;if(J.target?.closest?.("fig-input-number"))return;let Q=this.#j?.querySelector('input[type="range"]')??this.#P;if(!Q)return;this.#YJ(),this.#zJ(),this.#P=Q,this.#H=!0,this.#D=J.pointerId,this.#h=J.clientX,this.#z=this.getAttribute("elastic")==="false"?0:this.#IJ();let Z=Q.getBoundingClientRect(),$=this.getBoundingClientRect();this.#f={left:Z.left,right:Z.right,width:Z.width},this.#R=$.width,window.addEventListener("pointermove",this.#m,{passive:!0}),window.addEventListener("pointerup",this.#E,{once:!0}),window.addEventListener("pointercancel",this.#E,{once:!0}),window.addEventListener("blur",this.#E,{once:!0})}#RJ(J){if(!this.#H)return;if(J.pointerId!==this.#D)return;if(J.buttons===0){this.#u(J);return}if(Math.abs(J.clientX-this.#h)>=s.#Z)this.#$J(!0);if(this.#z)this.#bJ(J.clientX)}#u(J){if(J?.pointerId!==void 0&&this.#D!==null&&J.pointerId!==this.#D)return;let Q=J?.type==="pointerup"||J?.type==="pointermove"&&J.buttons===0;if(this.#YJ(),this.#zJ(),Q)this.#o()}#YJ(){window.removeEventListener("pointermove",this.#m),window.removeEventListener("pointerup",this.#E),window.removeEventListener("pointercancel",this.#E),window.removeEventListener("blur",this.#E),this.#H=!1,this.#D=null,this.#h=0,this.#$J(!1)}#$J(J){this.toggleAttribute("data-propskit-slider-dragging",J),document.body.classList.toggle(s.#$,J)}#fJ(J){if(O(this,"disabled"))return;J.preventDefault(),J.stopPropagation(),J.stopImmediatePropagation(),this.#AJ(),this.#c(J.clientX,J.clientY)}#c(J,Q){let Z=!1,$=0,j=()=>{if(Z)return;Z=!0,window.clearTimeout($),window.removeEventListener("pointerup",j,!0),window.removeEventListener("pointercancel",j,!0),requestAnimationFrame(()=>{this.#L?.showAt?.(J,Q)})};window.addEventListener("pointerup",j,{once:!0,capture:!0}),window.addEventListener("pointercancel",j,{once:!0,capture:!0}),$=window.setTimeout(j,180)}#DJ(J){if(J.stopPropagation(),J.detail?.value!=="reset-default")return;this.#xJ()}#AJ(){if(this.#T)clearTimeout(this.#T),this.#T=0;this.#F=null}#IJ(){let J=getComputedStyle(this).getPropertyValue("--propskit-slider-elastic-distance").trim();if(J.includes("var(")||!J.endsWith("px")){let Z=document.createElement("div");Object.assign(Z.style,{position:"absolute",visibility:"hidden",pointerEvents:"none",width:"var(--propskit-slider-elastic-distance)"}),this.appendChild(Z),J=getComputedStyle(Z).width,Z.remove()}let Q=Number.parseFloat(J);return Number.isFinite(Q)?Math.max(0,Q):0}#bJ(J){let Q=this.#f;if(!Q||!this.#z){this.#zJ();return}let Z=J<Q.left?J-Q.left:J>Q.right?J-Q.right:0;if(!Z){this.#VJ();return}let $=Math.max(-this.#z,Math.min(this.#z,Z*0.5)),j=Math.abs($),_=this.#R?(this.#R+j)/this.#R:1;this.dataset.elasticDragging="true",this.style.setProperty("--propskit-slider-elastic-size",`${j}px`),this.style.setProperty("--propskit-slider-elastic-scale",`${_}`),this.style.setProperty("--propskit-slider-elastic-origin",$<0?"right center":"left center")}#zJ(){this.#VJ(),this.#z=0,this.#f=null,this.#R=0,this.#D=null}#VJ(){this.removeAttribute("data-elastic-dragging"),this.style.removeProperty("--propskit-slider-elastic-size"),this.style.removeProperty("--propskit-slider-elastic-scale")}#wJ(J){let Q=this.#P;if(!Q)return this.#j?.value??"";let Z=Q.getBoundingClientRect(),$=Z.width?Math.min(1,Math.max(0,(J.clientX-Z.left)/Z.width)):0,j=Number(Q.min||0),_=Number(Q.max||100),X=Q.step==="any"?0:Number(Q.step||1),q=j+(_-j)*$;if(!X)return String(q);let B=Math.round((q-j)/X)*X+j,Y=Math.max(0,`${X}`.split(".")[1]?.length||0);return String(Number(B.toFixed(Y)))}#yJ(){return this.getAttribute("default")??this.#W??this.#P?.min??"0"}#xJ(){this.#AJ(),this.#EJ(this.#yJ(),"input"),this.#EJ(this.#yJ(),"change")}#EJ(J,Q){if(!this.#j||J===null||J===void 0)return;this.#j.value=J,this.setAttribute("value",String(this.#j.value)),K(this,Q)}#pJ(){if(!this.#j)return;let J=this.#j.querySelector("fig-input-number");if(!J)return;if(!(this.hasAttribute("steppers")&&this.getAttribute("steppers")!=="false")){J.removeAttribute("steppers");return}let Z=this.getAttribute("steppers");J.setAttribute("steppers",Z??"")}#gJ(){if(!this.#j)return;if(!this.#C)this.#C=this.#hJ.bind(this,"input");if(!this.#A)this.#A=this.#hJ.bind(this,"change");this.#j.addEventListener("input",this.#C),this.#j.addEventListener("change",this.#A)}#cJ(){if(!this.#j)return;if(this.#C)this.#j.removeEventListener("input",this.#C);if(this.#A)this.#j.removeEventListener("change",this.#A)}#hJ(J,Q){if(Q.stopImmediatePropagation(),O(this,"disabled"))return;if(J==="change")this.#zJ();if(this.#j?.value!==void 0){let Z=String(this.#j.value);if(this.getAttribute("value")!==Z)this.setAttribute("value",Z)}this.#NJ(),K(this,J)}focus(J){this.#ZJ();let Q=this.#j?.querySelector('input[type="range"]');Q?.setAttribute("data-propskit-focus-called",""),Q?.focus(J)}get value(){return d(this.getAttribute("value")??this.#j?.value)}set value(J){if(J===null||J===void 0||J===""){if(this.removeAttribute("value"),this.#j)this.#j.value="";return}let Q=String(J);if(this.setAttribute("value",Q),this.#j)this.#j.value=Q}get defaultValue(){return this.#yJ()}get isDefault(){return o(this.value,this.defaultValue)}resetToDefault(){this.#xJ()}}L("propskit-slider",s);class V extends HTMLElement{static#Z=33;static#$=60;static#J=0.55;static#Q=1.5;static#_=80;static#j=4;static#Y="fig-input-wheel-dragging";#B=null;#M=null;#X=null;#q=null;#G=null;#O=null;#k=null;#U=0;#N=0;#K=0;#P=0;#L=0;#T=null;#F=!1;#W=null;#H=0;#z=0;#f=!1;#R=null;#D=0;#h=null;#I=0;#V=0;#p=this.#qJ.bind(this);#y=this.#LJ.bind(this);#b=this.#_J.bind(this);#x=this.#KJ.bind(this);#C=this.#HJ.bind(this);static get observedAttributes(){return["value","disabled","step","min","max","spin"]}connectedCallback(){if(!this.#B)this.#A();if(this.#e(),this.#kJ(),this.#BJ(),this.#T?.disconnect(),globalThis.ResizeObserver)this.#T=new ResizeObserver((J)=>{let Q=J.at(-1)?.contentRect;if(Q)this.#QJ(Q.width,Q.height)}),this.#T.observe(this);this.#s()}disconnectedCallback(){if(this.#T?.disconnect(),this.#K)cancelAnimationFrame(this.#K);this.#K=0,this.#MJ(),this.#GJ(),this.#XJ()}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#B)return;if(J==="disabled")this.#e();if(J==="value"&&!this.#F)this.#kJ();if(J==="step")this.#n(),this.#s();if(J==="spin")this.#s();if(J==="min"||J==="max")this.#g(this.#S())}#A(){if(this.#B=this,this.#M=this,this.#X=this,this.setAttribute("role","spinbutton"),!this.hasAttribute("aria-label")&&!this.hasAttribute("aria-labelledby"))this.setAttribute("aria-label","Value");this.setAttribute("tabindex","0");let J=h("svg",{className:"fig-input-wheel-svg","aria-hidden":"true"}),Q=N("div",{className:"fig-input-wheel-handle"});this.#q=J,this.replaceChildren(J,Q);let Z=document.createElement("div");Z.setAttribute("aria-hidden","true"),Z.style.cssText="position:absolute;visibility:hidden;pointer-events:none;left:0;top:0";let $=document.createElement("div");$.style.height="var(--fig-input-wheel-tick-height)";let j=document.createElement("div");j.style.height="var(--fig-input-wheel-tick-height-min)";let _=document.createElement("div");_.style.width="var(--fig-input-wheel-tick-width)";let X=document.createElement("div");X.style.width="var(--fig-input-wheel-tick-width-min)",Z.append($,j,_,X),this.append(Z),this.#k={maxEl:$,minEl:j,maxWidthEl:_,minWidthEl:X},this.#d()}#d(){if(!this.#q||this.#G)return;this.#G=h("path",{className:"fig-input-wheel-tick"}),this.#q.append(this.#G)}#m(){if(this.#O)return this.#O;return this.#O={maxH:this.#k?.maxEl.getBoundingClientRect().height||8,minH:this.#k?.minEl.getBoundingClientRect().height||4,maxW:this.#k?.maxWidthEl.getBoundingClientRect().width||2,minW:this.#k?.minWidthEl.getBoundingClientRect().width||1},this.#O}#E(){if(this.hasAttribute("step")){let J=Number(this.getAttribute("step"));if(J>0)return J}return 1}#S(){let J=Number(this.getAttribute("value")??0);return Number.isFinite(J)?J:0}#jJ(J){if(!this.hasAttribute(J))return null;let Q=this.getAttribute(J);if(Q===null||Q.trim()==="")return null;let Z=Number(Q);return Number.isFinite(Z)?Z:null}#w(){return this.#jJ("min")}#v(){return this.#jJ("max")}#i(J,Q){if(Q===null||Q===void 0||Q===""){this.removeAttribute(J);return}let Z=Number(Q);if(!Number.isFinite(Z)){this.removeAttribute(J);return}this.setAttribute(J,String(Z))}#t(J){let Q=J,Z=this.#w(),$=this.#v();if(Z!==null)Q=Math.max(Z,Q);if($!==null)Q=Math.min($,Q);return Q}#r(J){let Q=this.#E();if(Q<=0)return J;let Z=this.#w()??0,$=Math.round((J-Z)/Q)*Q+Z;return Number($.toPrecision(15))}#g(J,{snap:Q=!1,emit:Z=null}={}){let $=Q?this.#r(J):J;$=this.#t($);let j=String($);if(this.getAttribute("value")!==j)this.setAttribute("value",j);if(this.#n($),this.#s(),Z)this.dispatchEvent(new CustomEvent(Z,{detail:$,bubbles:!0,cancelable:!0,composed:!0}))}#kJ(){let J=this.#S(),Q=this.#t(J);if(Q!==J||this.getAttribute("value")!==String(Q)){this.#g(Q);return}this.#n(J),this.#s()}#n(J=this.#S()){if(!this.#X)return;let Q=this.#w(),Z=this.#v();if(this.#X.setAttribute("aria-valuenow",String(J)),this.#X.setAttribute("aria-valuetext",String(J)),Q===null)this.#X.removeAttribute("aria-valuemin");else this.#X.setAttribute("aria-valuemin",String(Q));if(Z===null)this.#X.removeAttribute("aria-valuemax");else this.#X.setAttribute("aria-valuemax",String(Z))}#e(){let J=O(this,"disabled");if(!this.#X)return;if(J){if(this.#F)this.#XJ();this.#MJ(),this.setAttribute("aria-disabled","true"),this.#X.setAttribute("tabindex","-1"),this.#X.setAttribute("aria-disabled","true")}else this.removeAttribute("aria-disabled"),this.#X.setAttribute("tabindex","0"),this.#X.removeAttribute("aria-disabled")}#QJ(J,Q){if(!this.#q||J<1||Q<1)return;if(J===this.#U&&Q===this.#N)return;this.#U=J,this.#N=Q,this.#O=null,this.#q.setAttribute("viewBox",`0 0 ${J} ${Q}`),this.#q.setAttribute("width",String(J)),this.#q.setAttribute("height",String(Q)),this.#s()}#s(){if(this.#K)return;this.#K=requestAnimationFrame(()=>{if(!this.isConnected){this.#K=0;return}if(this.#U<1||this.#N<1){let J=this.#X?.getBoundingClientRect();if(J)this.#QJ(J.width,J.height)}this.#NJ(),this.#K=0})}#NJ(){if(!this.#G)return;let J=this.#U,Q=this.#N;if(J<1||Q<1)return;let Z=this.getAttribute("spin")==="false"?this.#w()??0:this.#R??this.#S(),$=360/V.#Z,j=this.#E(),_=this.#w()??0,X=(Z-_)/j*$,q=V.#J,B=J/2,Y=Q/2,{maxH:G,minH:M,maxW:k,minW:U}=this.#m(),P=V.#$,T=Math.max(J/2,1),H=T*0.84,D=[];for(let A=0;A<V.#Z;A+=1){let z=X+A*$;if(z=((z+180)%360+360)%360-180,z<-P||z>=P)continue;let I=z*Math.PI/180,E=B+H*Math.sin(I)/(1-q*Math.cos(I)),y=Math.min(1,Math.abs(E-B)/Math.max(T,1)),w=Math.cos(y*Math.PI*0.5),x=M+(G-M)*w,e=U+(k-U)*w,a=x/2,p=e/2,g=Y-a,r=Y+a,JJ=E-p,QJ=E+p;D.push(`M ${E} ${g} Q ${QJ} ${g} ${QJ} ${g+p} V ${r-p} Q ${QJ} ${r} ${E} ${r} Q ${JJ} ${r} ${JJ} ${r-p} V ${g+p} Q ${JJ} ${g} ${E} ${g} Z`)}this.#G.setAttribute("d",D.join(" "))}#BJ(){this.#B?.addEventListener("pointerdown",this.#p),this.#X?.addEventListener("wheel",this.#x,{passive:!1}),this.#X?.addEventListener("keydown",this.#C)}#GJ(){this.#B?.removeEventListener("pointerdown",this.#p),this.#X?.removeEventListener("wheel",this.#x),this.#X?.removeEventListener("keydown",this.#C),window.removeEventListener("pointermove",this.#y),window.removeEventListener("pointerup",this.#b),window.removeEventListener("pointercancel",this.#b)}#qJ(J){if(O(this,"disabled"))return;if(J.button!==0)return;if(J.preventDefault(),!this.beginScrub(J))return;this.#B?.setPointerCapture?.(J.pointerId),window.addEventListener("pointermove",this.#y),window.addEventListener("pointerup",this.#b),window.addEventListener("pointercancel",this.#b)}beginScrub(J={}){if(O(this,"disabled"))return!1;let Q=typeof J==="number"?J:Number(J?.clientX??J?.x);if(!Number.isFinite(Q))return!1;this.#MJ(),this.#F=!0,this.#W=J&&typeof J==="object"&&J.pointerId!==void 0?J.pointerId:null,this.#H=Q;let Z=J&&typeof J==="object"?Number(J.startValue):Number.NaN;return this.#z=Number.isFinite(Z)?this.#t(Z):this.#S(),this.#f=!1,this.#WJ(Q),this.#PJ(),this.setAttribute("data-fig-input-wheel-active",""),document.body.classList.remove(V.#Y),this.focus(),!0}updateScrub(J,Q){if(!this.#F)return this.#S();let Z=typeof J==="number"?J:Number(J?.clientX??J?.x);if(!Number.isFinite(Z))return this.#S();let $=Q??(typeof J==="object"&&J?.shiftKey?10:1);return this.#JJ(Z,$),this.#S()}endScrub(J=!0){if(!this.#F)return this.#S();if(J&&this.#S()!==this.#z)this.#g(this.#S(),{snap:!0,emit:"change"});return this.#XJ(),this.#S()}#LJ(J){if(!this.#F)return;if(this.#W!==null&&J.pointerId!==this.#W)return;this.updateScrub(J)}#JJ(J,Q=1){if(!this.#f&&Math.abs(J-this.#H)>=V.#j)this.#f=!0,document.body.classList.add(V.#Y);let Z=this.#X?.clientWidth||1,$=V.#Z*(V.#$*2/360),j=this.#E()*$,_=(J-this.#H)*(j/Z)*Q,X=this.#R??this.#z,q=this.#t(this.#z+_);this.#o(J,Q,q!==X),this.#R=q,this.#g(q,{snap:!0,emit:"input"}),this.#SJ(J)}#_J(J){if(!this.#F)return;if(this.#W!==null&&J.pointerId!==this.#W)return;this.endScrub()}#XJ(){this.#F=!1,this.#W=null,this.#f=!1,this.#R=null,this.removeAttribute("data-fig-input-wheel-active"),document.body.classList.remove(V.#Y),this.#UJ(),this.#a(),window.removeEventListener("pointermove",this.#y),window.removeEventListener("pointerup",this.#b),window.removeEventListener("pointercancel",this.#b),this.#s()}#PJ(){this.#a(),this.#D=this.#OJ("--fig-input-wheel-handle-drag-max")}#OJ(J){let Q=getComputedStyle(this).getPropertyValue(J).trim();if(Q.includes("var(")||!Q.endsWith("px")){let $=document.createElement("div");Object.assign($.style,{position:"absolute",visibility:"hidden",pointerEvents:"none",width:`var(${J})`}),this.appendChild($),Q=getComputedStyle($).width,$.remove()}let Z=Number.parseFloat(Q);return Number.isFinite(Z)?Math.max(0,Z):0}#SJ(J){if(!this.#D){this.#ZJ();return}let Q=J-this.#H;if(!Q){this.#ZJ();return}let Z=this.#D*Math.tanh(Q/Math.max(1,this.#D*3));this.style.setProperty("--fig-input-wheel-handle-drag-offset",`${Z}px`)}#a(){this.#ZJ(),this.#D=0}#ZJ(){this.style.removeProperty("--fig-input-wheel-handle-drag-offset")}#WJ(J){this.#UJ(),this.#h=J,this.#I=performance.now()}#o(J,Q,Z){let $=performance.now(),j=$-this.#I,_=this.#h===null?0:Math.abs(J-this.#h);this.#h=J,this.#I=$;let X=j>0?_/j*Math.max(1,Math.abs(Q)):0;if(!Z||X<V.#Q){this.#l();return}this.toggleAttribute("data-fig-input-wheel-fast",!0),clearTimeout(this.#V),this.#V=window.setTimeout(()=>{this.#l()},V.#_)}#UJ(){this.#h=null,this.#I=0,this.#l()}#l(){clearTimeout(this.#V),this.#V=0,this.removeAttribute("data-fig-input-wheel-fast")}#KJ(J){if(O(this,"disabled"))return;J.preventDefault();let Q=J.deltaY===0?Math.sign(J.deltaX):Math.sign(J.deltaY);if(!Q)return;let Z=J.shiftKey?10:1;this.#g(this.#S()+this.#E()*Z*Q,{snap:!0,emit:"input"}),this.#g(this.#S(),{emit:"change"})}#HJ(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number"))return;if(J.key==="Home"){let _=this.#w();if(_===null)return;J.preventDefault(),this.#g(_,{snap:!0,emit:"input"}),this.#g(this.#S(),{emit:"change"});return}if(J.key==="End"){let _=this.#v();if(_===null)return;J.preventDefault(),this.#g(_,{snap:!0,emit:"input"}),this.#g(this.#S(),{emit:"change"});return}if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(J.key))return;J.preventDefault();let Z=J.key==="ArrowRight"||J.key==="ArrowUp"?1:-1,$=J.shiftKey?10:1,j=this.#S();this.#g(j+this.#E()*$*Z,{snap:!0,emit:"input"}),this.#TJ(j,this.#S(),Z,$),this.#g(this.#S(),{emit:"change"})}#TJ(J,Q,Z,$,j=!0){if(J===Q||globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches){this.#MJ();return}if(this.#P)cancelAnimationFrame(this.#P),this.#P=0;clearTimeout(this.#L),this.#L=0,this.removeAttribute("data-fig-input-wheel-keyboard-settling");let _=this.#R??J,X=Number.parseFloat(this.style.getPropertyValue("--fig-input-wheel-handle-drag-offset"))||0,q=$>1?120:90,B=performance.now(),Y=j;this.setAttribute("data-fig-input-wheel-keyboard-moving","");let G=(M)=>{let k=Math.min(1,(M-B)/q);if(this.#R=_+(Q-_)*k,Y){let U=Math.sin(k*Math.PI/2),P=X+(Z*4-X)*U;this.style.setProperty("--fig-input-wheel-handle-drag-offset",`${P}px`)}if(this.#NJ(),k<1){this.#P=requestAnimationFrame(G);return}this.#P=0,this.#R=null,this.removeAttribute("data-fig-input-wheel-keyboard-moving"),this.setAttribute("data-fig-input-wheel-keyboard-settling",""),this.style.removeProperty("--fig-input-wheel-handle-drag-offset"),this.#L=window.setTimeout(()=>{this.removeAttribute("data-fig-input-wheel-keyboard-settling"),this.#L=0},140),this.#s()};this.#P=requestAnimationFrame(G)}#MJ(){if(this.#P)cancelAnimationFrame(this.#P),this.#P=0;if(clearTimeout(this.#L),this.#L=0,this.#R=null,this.removeAttribute("data-fig-input-wheel-keyboard-moving"),this.removeAttribute("data-fig-input-wheel-keyboard-settling"),this.style.removeProperty("--fig-input-wheel-handle-drag-offset"),this.isConnected)this.#s()}get value(){return this.getAttribute("value")??"0"}set value(J){if(J===null||J===void 0||J===""){this.#g(0);return}let Q=Number(J);this.#g(Number.isFinite(Q)?Q:0)}spinTo(J,{animateHandle:Q=!1}={}){let Z=this.#S();this.value=J;let $=this.#S();if(this.getAttribute("spin")==="false")return this.#MJ(),$;let j=Math.sign($-Z);return this.#TJ(Z,$,j,Math.abs($-Z)>this.#E()?10:1,Q),$}get min(){return this.#w()}set min(J){this.#i("min",J)}get max(){return this.#v()}set max(J){this.#i("max",J)}get step(){return this.#E()}focus(J){HTMLElement.prototype.focus.call(this,J)}}L("fig-input-wheel",V);class l extends S{static#Z=new Set(["label","size","disabled","variant","elastic","spin","text","default","class","style","id","oninput","onchange"]);static get observedAttributes(){return["label","aria-label","units","value","disabled","step","precision","min","max","elastic","spin","text"]}#$=null;#J=null;#Q=null;#_=null;#j=!1;#Y=null;#B=new Set;#M=null;#X=null;#q=0;#G=null;#O=0;#k=null;#U=null;#N=0;#K=0;#P=0;#L=!1;#T=!1;#F=0;#W=!1;#H=this.#s.bind(this,"input");#z=this.#s.bind(this,"change");#f=this.#NJ.bind(this,"input");#R=this.#NJ.bind(this,"change");#D=this.#BJ.bind(this);#h=this.#WJ.bind(this);#I=this.#o.bind(this);#V=this.#UJ.bind(this);#p=this.#GJ.bind(this);#y=this.#qJ.bind(this);#b=this.#LJ.bind(this);#x=this.#XJ.bind(this);#C=this.#PJ.bind(this);#A=this.#KJ.bind(this);connectedCallback(){if(!this.#$)this.#d();this.#m(),this.#E(),this.#jJ(),this.#g(),this.#kJ(),W(this),this.#Y?.disconnect(),this.#Y=new MutationObserver((J)=>{if(J.some(({type:Q,attributeName:Z})=>Q==="attributes"&&Z&&!l.#Z.has(Z)&&!l.observedAttributes.includes(Z)&&!Z.startsWith("data-")))this.#g()}),this.#Y.observe(this,{attributes:!0})}disconnectedCallback(){this.#Y?.disconnect(),this.#JJ(),this.#a(),this.#n(),this.#l(),clearTimeout(this.#F),this.#F=0,this.#J?.endScrub(!1),f(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#$)return;if(J==="label"||J==="aria-label")this.#m();if(J==="text")this.#E();if(J==="elastic"&&Z==="false")this.#a();if(["units","value","disabled","step","min","max","elastic","spin"].includes(J))this.#jJ();if(["units","value","disabled","step","precision","min","max"].includes(J))this.#g()}#d(){this.#M=this.getAttribute("value")??"0";let J=Array.from(this.childNodes).filter((X)=>X.nodeType!==Node.TEXT_NODE||Boolean(X.textContent?.trim())),Q=J.find((X)=>X.nodeType===Node.ELEMENT_NODE&&X.matches("label")),Z=N("div",{className:"propskit-wheel-surface"}),$=Q||document.createElement("label"),j=document.createElement("fig-input-wheel"),_=document.createElement("fig-input-number");Z.append($,j,_),this.#$=Z,this.#J=j,this.#Q=$,this.#_=_,this.#j=Boolean(Q),this.replaceChildren(Z);for(let X of J)if(X!==Q)_.appendChild(X)}#m(){let J=C(this,this.#$,this.#Q,this.#j);R(this,this.#J,J,"Wheel"),R(this,this.#_,J,"Number")}#E(){if(!this.#$||!this.#_)return;let J=this.getAttribute("text")!=="false",Q=this.#_.parentElement===this.#$;if(J&&!Q)this.#$.append(this.#_);else if(!J&&Q)this.#_.remove()}#S(J){if(!this.#J)return;if(this.hasAttribute(J))this.#J.setAttribute(J,this.getAttribute(J)??"");else this.#J.removeAttribute(J)}#jJ(){if(!this.#J)return;this.#J.removeAttribute("units");for(let $ of["min","max","spin"])this.#S($);if(this.hasAttribute("step"))this.#S("step");else this.#J.setAttribute("step",String(this.#i()));this.#J.toggleAttribute("disabled",O(this,"disabled"));let J=d(this.getAttribute("value"));this.#J.value=J??0;let Q=String(this.#J.value);if(J!==null&&this.getAttribute("value")!==Q)this.setAttribute("value",Q);let Z=J===null?"":Q;if(this.#_?.getAttribute("value")!==Z)this.#_?.setAttribute("value",Z);this.#r()}#w(){return this.getAttributeNames().filter((J)=>!l.#Z.has(J)&&!l.observedAttributes.includes(J)&&!J.startsWith("data-"))}#v(){let J=(this.getAttribute("units")||"").trim(),Q=J.toLowerCase();if(Q==="ms"||Q==="millisecond"||Q==="milliseconds")return"ms";if(Q==="s"||Q==="second"||Q==="seconds")return"s";return J}#i(){let J=this.#v();if(J==="s")return 0.1;if(J==="ms")return 100;return 1}#t(){return this.#v()==="s"?2:0}#r(){if(!this.#J)return;let J=Number(this.#J.value),Q=this.#v();this.#J.setAttribute("aria-valuetext",Q?`${J} ${Q==="s"?"seconds":Q==="ms"?"milliseconds":Q}`:String(J))}#g(){if(!this.#_||!this.#J)return;let J=this.#w(),Q=new Set(J);for(let $ of this.#B)if(!Q.has($))this.#_.removeAttribute($);for(let $ of J)this.#_.setAttribute($,this.getAttribute($)??"");let Z=this.#v();if(Z)this.#_.setAttribute("units",Z);else this.#_.removeAttribute("units");if(this.#_.setAttribute("step",String(this.#J.step)),this.hasAttribute("precision"))this.#_.setAttribute("precision",this.getAttribute("precision")??"");else this.#_.setAttribute("precision",String(this.#t()));for(let $ of["min","max"]){let j=this.#J[$];if(j===null)this.#_.removeAttribute($);else this.#_.setAttribute($,String(j))}this.#_.toggleAttribute("disabled",O(this,"disabled")),this.#_.setAttribute("value",String(this.value??"")),this.#B=Q}#kJ(){this.#n(),this.#J?.addEventListener("input",this.#H),this.#J?.addEventListener("change",this.#z),this.#_?.addEventListener("input",this.#f),this.#_?.addEventListener("change",this.#R),this.#_?.addEventListener("keydown",this.#D,{capture:!0}),this.addEventListener("pointerdown",this.#p,{capture:!0}),this.addEventListener("pointerdown",this.#h,{capture:!0}),this.addEventListener("click",this.#A,!0)}#n(){this.#J?.removeEventListener("input",this.#H),this.#J?.removeEventListener("change",this.#z),this.#_?.removeEventListener("input",this.#f),this.#_?.removeEventListener("change",this.#R),this.#_?.removeEventListener("keydown",this.#D,{capture:!0}),this.removeEventListener("pointerdown",this.#p,{capture:!0}),this.removeEventListener("pointerdown",this.#h,{capture:!0}),this.removeEventListener("click",this.#A,!0)}#e(J,{spin:Q=!1,animateHandle:Z=!1}={}){let $=d(J);if($===null){if(this.removeAttribute("value"),this.#J)this.#J.value=0;return this.#_?.setAttribute("value",""),this.#r(),null}if(!this.#J)return this.setAttribute("value",String($)),$;if(Q)this.#J.spinTo($,{animateHandle:Z});else this.#J.value=$;let j=this.#J.value;if(this.getAttribute("value")!==j)this.setAttribute("value",j);if(this.#_?.getAttribute("value")!==j)this.#_?.setAttribute("value",j);return this.#r(),Number(j)}#QJ(J){K(this,J)}#s(J,Q){Q.stopImmediatePropagation(),this.#e(Q.detail),this.#QJ(J)}#NJ(J,Q){if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let Z=Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:this.#_?.value;if(this.#e(Z,{spin:J==="input",animateHandle:J==="input"&&this.#W}),J==="input")this.#W=!1;this.#QJ(J)}#BJ(J){this.#W=!O(this,"disabled")&&(J.key==="ArrowUp"||J.key==="ArrowDown"),window.setTimeout(()=>{this.#W=!1},0)}#GJ(J){if(J.button!==0||O(this,"disabled")||!(J.target instanceof Element)||J.target.closest("fig-input-number")||J.target.closest(".propskit-wheel-surface")!==this.#$)return;if(J.preventDefault(),J.stopImmediatePropagation(),this.#JJ(),!this.#J?.beginScrub({clientX:J.clientX,pointerId:J.pointerId,startValue:Number(this.#J.value)}))return;this.#k=J.pointerId,this.#_J(J.pointerId),window.addEventListener("pointermove",this.#y),window.addEventListener("pointerup",this.#b),window.addEventListener("pointercancel",this.#b),window.addEventListener("blur",this.#b)}#qJ(J){if(J.pointerId!==this.#k)return;if(J.buttons===0){this.#LJ(J);return}this.#J?.updateScrub(J)}#LJ(J){if(J?.pointerId!==void 0&&this.#k!==null&&J.pointerId!==this.#k)return;this.#J?.endScrub(),this.#JJ(),this.#a()}#JJ(){window.removeEventListener("pointermove",this.#y),window.removeEventListener("pointerup",this.#b),window.removeEventListener("pointercancel",this.#b),window.removeEventListener("blur",this.#b),this.#k=null}#_J(J){if(this.#a(),this.getAttribute("elastic")==="false")return;this.#X=J,this.#q=this.#SJ("--propskit-wheel-elastic-distance");let Q=this.getBoundingClientRect();if(Q)this.#G={left:Q.left,right:Q.right};this.#O=this.getBoundingClientRect().width,window.addEventListener("pointermove",this.#x,{passive:!0}),window.addEventListener("pointerup",this.#C),window.addEventListener("pointercancel",this.#C),window.addEventListener("blur",this.#C)}#XJ(J){if(J.pointerId!==this.#X)return;if(J.buttons===0){this.#PJ(J);return}this.#OJ(J.clientX)}#PJ(J){if(J?.pointerId!==void 0&&this.#X!==null&&J.pointerId!==this.#X)return;this.#a()}#OJ(J){let Q=this.#G;if(!Q||!this.#q){this.#ZJ();return}let Z=J<Q.left?J-Q.left:J>Q.right?J-Q.right:0;if(!Z){this.#ZJ();return}let $=Math.min(this.#q,Math.abs(Z)*0.5),j=this.#O?(this.#O+$)/this.#O:1;this.toggleAttribute("data-propskit-wheel-elastic-dragging",!0),this.style.setProperty("--propskit-wheel-elastic-scale",String(j)),this.style.setProperty("--propskit-wheel-elastic-origin",Z<0?"right center":"left center")}#SJ(J){let Q=getComputedStyle(this).getPropertyValue(J).trim();if(Q.includes("var(")||!Q.endsWith("px")){let $=document.createElement("div");Object.assign($.style,{position:"absolute",visibility:"hidden",pointerEvents:"none",width:`var(${J})`}),this.appendChild($),Q=getComputedStyle($).width,$.remove()}let Z=Number.parseFloat(Q);return Number.isFinite(Z)?Math.max(0,Z):0}#a(){window.removeEventListener("pointermove",this.#x),window.removeEventListener("pointerup",this.#C),window.removeEventListener("pointercancel",this.#C),window.removeEventListener("blur",this.#C),this.#X=null,this.#q=0,this.#G=null,this.#O=0,this.#ZJ()}#ZJ(){this.removeAttribute("data-propskit-wheel-elastic-dragging"),this.style.removeProperty("--propskit-wheel-elastic-scale"),this.style.removeProperty("--propskit-wheel-elastic-origin")}#WJ(J){if(J.button!==0||J.altKey||O(this,"disabled")||!(J.target instanceof Element))return;let Q=J.target.closest("fig-input-number input");if(!Q||Q===document.activeElement)return;J.preventDefault(),J.stopImmediatePropagation(),this.#l(),this.#U=J.pointerId,this.#N=J.clientX,this.#K=J.clientY,this.#P=Number(this.#J?.value??0),window.addEventListener("pointermove",this.#I),window.addEventListener("pointerup",this.#V,{once:!0}),window.addEventListener("pointercancel",this.#V,{once:!0}),window.addEventListener("blur",this.#V,{once:!0})}#o(J){if(J.pointerId!==this.#U)return;if(J.buttons===0){this.#UJ(J);return}if(!this.#L){if(Math.hypot(J.clientX-this.#N,J.clientY-this.#K)<4)return;this.#L=!0,this.setAttribute("data-number-scrubbing",""),this.#_J(J.pointerId),this.#J?.beginScrub({clientX:this.#N,pointerId:J.pointerId,startValue:this.#P})}this.#J?.updateScrub(J),this.#OJ(J.clientX)}#UJ(J){if(J?.pointerId!==void 0&&this.#U!==null&&J.pointerId!==this.#U)return;let Q=this.#L;if(this.#a(),this.#l(),Q){this.#J?.endScrub(),this.#T=!0,clearTimeout(this.#F),this.#F=window.setTimeout(()=>{this.#T=!1,this.#F=0},0),requestAnimationFrame(()=>this.#J?.focus());return}this.#_?.querySelector("input")?.focus()}#l(){window.removeEventListener("pointermove",this.#I),window.removeEventListener("pointerup",this.#V),window.removeEventListener("pointercancel",this.#V),window.removeEventListener("blur",this.#V),this.#U=null,this.#L=!1,this.removeAttribute("data-number-scrubbing")}#KJ(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number, fig-menu")){if(this.#T&&J.target.closest("fig-input-number"))J.preventDefault(),J.stopImmediatePropagation(),this.#T=!1;return}if(!(J.target instanceof Element)||!J.target.closest("fig-input-wheel"))this.#J?.focus()}get value(){return d(this.getAttribute("value"))}set value(J){this.#e(J)}get min(){return this.#J?.min??null}set min(J){if(J===null||J===void 0||J==="")this.removeAttribute("min");else{let Q=Number(J);if(Number.isFinite(Q))this.setAttribute("min",String(Q));else this.removeAttribute("min")}}get max(){return this.#J?.max??null}set max(J){if(J===null||J===void 0||J==="")this.removeAttribute("max");else{let Q=Number(J);if(Number.isFinite(Q))this.setAttribute("max",String(Q));else this.removeAttribute("max")}}get defaultValue(){return this.getAttribute("default")??this.#M??"0"}get isDefault(){return o(this.value,this.defaultValue)}resetToDefault(){this.#e(this.defaultValue),b(this)}focus(J){this.#J?.focus(J)}}L("propskit-wheel",l);class bJ extends HTMLElement{static observedAttributes=["type","value","color","name","tooltips","disabled","drag-surface","snapping","precision"];#Z=50;#$=50;#J=75;#Q=75;#_=0;#j=!1;#Y=0;#B=null;#M=null;#X=null;#q=null;#G=null;#O=null;#k=null;#U=null;#N=null;#K=!1;#P=!1;#L=!1;#T=!1;#F=null;#W="";#H="";#z=null;#f=null;#R=null;#D="";#h="";#I=null;#V=null;#p=null;get#y(){return this.getAttribute("type")||"point"}get#b(){return this.#y==="point-radius"||this.#y==="point-radius-angle"}get#x(){return this.#y==="point-radius-angle"}get#C(){return this.#y==="point-point"}get#A(){return this.#y==="point-radius-angle"||this.#y==="point-point"}get#d(){let J=this.getAttribute("tooltips");return J===null||J!=="false"}get#m(){let J=this.getAttribute("snapping");if(J===null)return"false";let Q=J.trim().toLowerCase();if(Q==="modifier")return"modifier";if(Q===""||Q==="true")return"true";return"false"}get#E(){let J=Number(this.getAttribute("precision")??2);if(!Number.isFinite(J))return 2;return Math.max(0,Math.min(8,Math.trunc(J)))}#S(J){let Q=10**this.#E,Z=Math.round(J*Q)/Q;return Object.is(Z,-0)?0:Z}#jJ(){let J=this.getAttribute("precision");for(let Q of[this.#B,this.#X,this.#M]){if(!Q)continue;if(J===null)Q.removeAttribute("precision");else Q.setAttribute("precision",String(this.#E))}}#w(J){let Q=this.#m;if(Q==="true")return!0;if(Q==="modifier")return!!J;return!1}get#v(){let J=this.getAttribute("name");if(J)return J.split(",")[0].trim();return`${this.#S(this.#Z)}%, ${this.#S(this.#$)}%`}get#i(){let J=this.getAttribute("name");if(J){let Q=J.split(",");if(Q.length>1)return Q[1].trim()}return`${this.#S(this.#J)}%, ${this.#S(this.#Q)}%`}get#t(){return this.getAttribute("drag-surface")||"parent"}get#r(){let J=this.#t;if(J==="parent")return this.parentElement;return this.closest(J)}get#g(){let J=this.#t;if(J==="parent"){let Q=this.parentElement;if(Q)return Q.setAttribute("data-fig-canvas-control-surface",""),"[data-fig-canvas-control-surface]"}return J}#kJ(J){if(this.#j)return this.#_/100*J;return this.#_}#n(){let J=this.#S(this.#_);if(this.#j)return`Radius ${J}%`;return`Radius ${J}`}connectedCallback(){this.#e(),this.#QJ()}disconnectedCallback(){this.#VJ(),this.#bJ(),this.#BJ(),this.#JJ(),document.body.classList.remove("fig-lab-move-active"),document.body.classList.remove("fig-lab-rotate-active")}attributeChangedCallback(J,Q,Z){if(Q===Z)return;if(J==="value"&&!this.#K&&!this.#P&&!this.#L&&!this.#T)if(this.#e(),this.#B)this.#u();else this.#QJ();if(J==="type")this.#VJ(),this.#e(),this.#QJ();if(J==="color"&&this.#B)if(Z)this.#B.setAttribute("color",Z);else this.#B.removeAttribute("color");if(J==="disabled")this.#VJ(),this.#QJ();if(J==="tooltips")this.#QJ();if(J==="snapping"&&this.#B){if(this.#B.setAttribute("drag-snapping",Z||"false"),this.#M)this.#M.setAttribute("drag-snapping",Z||"false")}if(J==="precision"){if(!this.isConnected)return;this.#jJ(),this.#Z=this.#S(this.#Z),this.#$=this.#S(this.#$),this.#J=this.#S(this.#J),this.#Q=this.#S(this.#Q),this.#_=this.#S(this.#_),this.#Y=this.#S(this.#Y),this.#u(),this.#c()}if(J==="name"){if(this.#O)this.#O.setAttribute("text",this.#v);if(this.#k)this.#k.setAttribute("text",this.#i)}}#e(){let J=this.getAttribute("value");if(!J)return;try{let Q=JSON.parse(J);if(typeof Q.x==="number")this.#Z=this.#S(Q.x);if(typeof Q.y==="number")this.#$=this.#S(Q.y);if(Q.radius!==void 0){let Z=String(Q.radius);if(Z.endsWith("%"))this.#j=!0,this.#_=this.#S(parseFloat(Z));else this.#j=!1,this.#_=this.#S(parseFloat(Z));if(!Number.isFinite(this.#_))this.#_=0}if(typeof Q.angle==="number")this.#Y=this.#S(Q.angle);if(typeof Q.x2==="number")this.#J=this.#S(Q.x2);if(typeof Q.y2==="number")this.#Q=this.#S(Q.y2);if(this.#y==="color"&&typeof Q.color==="string"&&Q.color.trim()&&this.getAttribute("color")!==Q.color.trim())this.setAttribute("color",Q.color.trim())}catch{}}get value(){let J={x:this.#S(this.#Z),y:this.#S(this.#$)};if(this.#y==="color"){let Q=this.getAttribute("color")||this.#B?.getAttribute("color");if(Q)J.color=Q}if(this.#b){let Q=this.#S(this.#_);J.radius=this.#j?`${Q}%`:Q}if(this.#x)J.angle=this.#S(this.#Y);if(this.#C)J.x2=this.#S(this.#J),J.y2=this.#S(this.#Q);return J}set value(J){if(typeof J==="object")this.setAttribute("value",JSON.stringify(J));else if(typeof J==="string")this.setAttribute("value",J)}#QJ(){this.#VJ(),this.replaceChildren(),this.#B=null,this.#M=null,this.#X=null,this.#q=null,this.#G=null,this.#O=null,this.#k=null,this.#U=null,this.#N=null;let J=O(this,"disabled"),Q=this.#y,Z=this.#d,$=this.#g,j=document.createElement("fig-handle");if(j.setAttribute("drag","true"),j.setAttribute("drag-surface",$),j.setAttribute("drag-axes","x,y"),j.setAttribute("drag-snapping",this.#m),j.setAttribute("value",`${this.#Z}% ${this.#$}%`),this.hasAttribute("precision"))j.setAttribute("precision",String(this.#E));if(J)j.setAttribute("disabled","");if(Q==="color"){j.setAttribute("type","color");let _=this.getAttribute("color");if(_)j.setAttribute("color",_)}else j.setAttribute("type","canvas");if(this.#C)j.setAttribute("hit-area","12 circle"),j.setAttribute("hit-area-mode","delegate");if(this.#B=j,this.#b)this.#a();if(this.#A)this.#ZJ();if(Z){let _=document.createElement("fig-tooltip");_.setAttribute("action","manual"),_.setAttribute("theme","canvas"),_.setAttribute("pointer","false"),_.setAttribute("text",this.#v),_.appendChild(j),this.appendChild(_),this.#O=_}else this.appendChild(j);if(this.#x)this.#o(J,Z,$);if(this.#C)this.#UJ(J,Z,$);this.#s(this.#B),this.#s(this.#X),this.#s(this.#M),this.#DJ(),this.#PJ(),requestAnimationFrame(()=>this.#u())}#s(J){if(!J)return;J.addEventListener("pointerdown",(Q)=>{if(Q.target?.classList?.contains("fig-handle-hit-area")&&J.querySelector(".fig-handle-hit-area"))this.#LJ(Q,J);else this.#NJ(Q)},{capture:!0})}#NJ(J){if(O(this,"disabled"))return;if(J?.button!==void 0&&J.button!==0)return;if(J?.isPrimary===!1)return;if(this.#F===null)this.#W=document.body.style.getPropertyValue("cursor"),this.#H=document.body.style.getPropertyPriority("cursor");if(this.#F=J?.pointerId??-1,document.body.classList.add("fig-lab-move-active"),document.body.style.setProperty("cursor","var(--fig-lab-cursor-move)","important"),!this.#z)this.#z=(Q)=>{if(Q?.pointerId!==void 0&&this.#F!==null&&Q.pointerId!==this.#F)return;if(Q?.type==="blur")this.#BJ();else requestAnimationFrame(()=>this.#BJ())};window.addEventListener("pointerup",this.#z),window.addEventListener("pointercancel",this.#z),window.addEventListener("blur",this.#z)}#BJ(){if(this.#F===null)return;if(document.body.classList.remove("fig-lab-move-active"),this.#W)document.body.style.setProperty("cursor",this.#W,this.#H);else document.body.style.removeProperty("cursor");if(this.#F=null,this.#W="",this.#H="",this.#z)window.removeEventListener("pointerup",this.#z),window.removeEventListener("pointercancel",this.#z),window.removeEventListener("blur",this.#z)}#GJ(J){if(!J)return 0;if(J===this.#X)return this.#Y;if(!this.#C)return 0;let Q=this.#FJ();return J===this.#B?Q+180:Q}#qJ(){if(this.#f===null)return;let J=this.#KJ(this.#GJ(this.#R));document.body.style.setProperty("--fig-lab-cursor-rotate",J),document.body.style.setProperty("cursor",J,"important")}#LJ(J,Q){if(O(this,"disabled"))return;if(J?.button!==void 0&&J.button!==0)return;if(J?.isPrimary===!1)return;if(this.#f===null)this.#D=document.body.style.getPropertyValue("cursor"),this.#h=document.body.style.getPropertyPriority("cursor");if(this.#f=J?.pointerId??-1,this.#R=Q,document.body.classList.add("fig-lab-rotate-active"),this.#qJ(),!this.#I)this.#I=(Z)=>{if(Z?.pointerId!==void 0&&this.#f!==null&&Z.pointerId!==this.#f)return;if(Z?.type==="blur")this.#JJ();else requestAnimationFrame(()=>this.#JJ())};window.addEventListener("pointerup",this.#I),window.addEventListener("pointercancel",this.#I),window.addEventListener("blur",this.#I)}#JJ(){if(this.#f===null)return;if(document.body.classList.remove("fig-lab-rotate-active"),document.body.style.removeProperty("--fig-lab-cursor-rotate"),this.#D)document.body.style.setProperty("cursor",this.#D,this.#h);else document.body.style.removeProperty("cursor");if(this.#f=null,this.#R=null,this.#D="",this.#h="",this.#I)window.removeEventListener("pointerup",this.#I),window.removeEventListener("pointercancel",this.#I),window.removeEventListener("blur",this.#I)}#_J(J,Q,Z,$){if(!J)return;let j=()=>!!$?.(),_=()=>{let B=Q();if(!B)return;B.removeAttribute("show"),B.hidePopup?.()},X=()=>{if(j()){_();return}let B=Q();if(!B)return;if(Z)B.setAttribute("text",Z());B.setAttribute("show","true"),B.showPopup?.()},q=()=>{_()};J.addEventListener("pointerenter",X),J.addEventListener("pointerleave",q)}#XJ(){return this.#K||this.#P||this.#L||this.#T}#PJ(){if(this.#B)this.#_J(this.#B,()=>this.#O,()=>this.#v,()=>this.#XJ()||!!this.#B?.querySelector("fig-color-tip"));if(this.#X)this.#_J(this.#X,()=>this.#N,()=>`Angle ${this.#S(this.#Y)}°`,()=>this.#XJ());if(this.#M)this.#_J(this.#M,()=>this.#k,()=>this.#i,()=>this.#XJ());if(this.#q){let J=this.#q.querySelector(".fig-canvas-control-radius-hit");this.#SJ(J||this.#q)}if(this.#y==="color"&&this.#B&&this.#O)new MutationObserver(()=>{if(this.#B?.querySelector("fig-color-tip"))this.#O?.removeAttribute("show"),this.#O?.hidePopup?.()}).observe(this.#B,{childList:!0,subtree:!0})}#OJ(J,Q){let Z=this.#U;if(!Z?.popup)return;let $=Q-8;Z.popup.anchor={getBoundingClientRect:()=>({left:J,top:$,right:J,bottom:$,width:0,height:0,x:J,y:$})},Z.popup.queueReposition?.()}#SJ(J){if(!J)return;J.addEventListener("pointerenter",(Q)=>{let Z=this.#U;if(!Z)return;Z.setAttribute("text",this.#n()),Z.setAttribute("show","true"),Z.showPopup?.(),this.#OJ(Q.clientX,Q.clientY)}),J.addEventListener("pointermove",(Q)=>{if(this.#L)return;this.#OJ(Q.clientX,Q.clientY)}),J.addEventListener("pointerleave",()=>{if(this.#L)return;let Q=this.#U;if(!Q)return;Q.removeAttribute("show")})}#a(){let Q=document.createElementNS("http://www.w3.org/2000/svg","svg");Q.classList.add("fig-canvas-control-radius"),Q.setAttribute("overflow","visible");let Z=document.createElementNS("http://www.w3.org/2000/svg","circle");Z.classList.add("fig-canvas-control-radius-hit"),Q.appendChild(Z);let $=document.createElementNS("http://www.w3.org/2000/svg","circle");$.classList.add("fig-canvas-control-radius-halo"),Q.appendChild($);let j=document.createElementNS("http://www.w3.org/2000/svg","circle");if(Q.appendChild(j),this.#q=Q,this.#d){let _=document.createElement("fig-tooltip");_.setAttribute("action","manual"),_.setAttribute("theme","canvas"),_.setAttribute("pointer","false"),_.setAttribute("text",this.#n()),_.appendChild(Q),this.appendChild(_),this.#U=_}else this.appendChild(Q);this.#IJ(Z)}#ZJ(){let Q=document.createElementNS("http://www.w3.org/2000/svg","svg");if(Q.classList.add("fig-canvas-control-angle-svg"),Q.setAttribute("overflow","visible"),Q.style.position="absolute",Q.style.pointerEvents="none",this.#C){let j=document.createElementNS("http://www.w3.org/2000/svg","line");j.classList.add("fig-canvas-control-angle-line-hit"),j.setAttribute("stroke","transparent"),j.setAttribute("stroke-width","12"),j.setAttribute("stroke-linecap","round"),j.style.pointerEvents="stroke",Q.appendChild(j),this.#WJ(j)}let Z=document.createElementNS("http://www.w3.org/2000/svg","line");Z.classList.add("fig-canvas-control-angle-line-halo"),Q.appendChild(Z);let $=document.createElementNS("http://www.w3.org/2000/svg","line");$.classList.add("fig-canvas-control-angle-line"),Q.appendChild($),this.#G=Q,this.appendChild(Q)}#WJ(J){J.addEventListener("pointerdown",(Q)=>{if(O(this,"disabled"))return;Q.preventDefault(),Q.stopPropagation();let Z=this.#r;if(!Z)return;let{clientX:$,clientY:j}=Q,_=this.#Z,X=this.#$,q=this.#J,B=this.#Q;this.#K=!0,this.#P=!0,document.body.classList.add("fig-lab-move-active"),J.style.pointerEvents="none";let Y=(M)=>{let k=Z.getBoundingClientRect(),U=k.width>0?(M.clientX-$)/k.width*100:0,P=k.height>0?(M.clientY-j)/k.height*100:0,T=-Math.min(_,q),H=100-Math.max(_,q),D=-Math.min(X,B),A=100-Math.max(X,B),z=Math.max(T,Math.min(H,U)),I=Math.max(D,Math.min(A,P));this.#Z=this.#S(_+z),this.#$=this.#S(X+I),this.#J=this.#S(q+z),this.#Q=this.#S(B+I),this.#u(),this.#YJ()},G=this.#zJ((M)=>{if(document.body.classList.remove("fig-lab-move-active"),J.style.pointerEvents="stroke",this.#K=!1,this.#P=!1,M)this.#c(),this.#$J()});window.addEventListener("pointermove",Y,{signal:G.signal}),window.addEventListener("pointerup",()=>G.finish(!0),{signal:G.signal}),window.addEventListener("pointercancel",()=>G.finish(!1),{signal:G.signal})})}#o(J,Q,Z){let $=document.createElement("fig-handle");if($.setAttribute("type","canvas"),$.setAttribute("drag","true"),$.setAttribute("drag-surface",Z),$.setAttribute("drag-axes","x,y"),$.setAttribute("size","small"),$.setAttribute("hit-area","12 circle"),$.setAttribute("hit-area-mode","delegate"),this.hasAttribute("precision"))$.setAttribute("precision",String(this.#E));if(J)$.setAttribute("disabled","");if(this.#X=$,Q){let j=document.createElement("fig-tooltip");j.setAttribute("action","manual"),j.setAttribute("theme","canvas"),j.setAttribute("pointer","false"),j.setAttribute("text",`${this.#S(this.#Y)}°`),j.appendChild($),this.appendChild(j),this.#N=j}else this.appendChild($)}#UJ(J,Q,Z){let $=document.createElement("fig-handle");if($.setAttribute("type","canvas"),$.setAttribute("drag","true"),$.setAttribute("drag-surface",Z),$.setAttribute("drag-axes","x,y"),$.setAttribute("drag-snapping",this.#m),$.setAttribute("hit-area","12 circle"),$.setAttribute("hit-area-mode","delegate"),$.setAttribute("value",`${this.#J}% ${this.#Q}%`),this.hasAttribute("precision"))$.setAttribute("precision",String(this.#E));if(J)$.setAttribute("disabled","");if(this.#M=$,Q){let j=document.createElement("fig-tooltip");j.setAttribute("action","manual"),j.setAttribute("theme","canvas"),j.setAttribute("pointer","false"),j.setAttribute("text",this.#i),j.appendChild($),this.appendChild(j),this.#k=j}else this.appendChild($)}#l(J){return`url("data:image/svg+xml,%3Csvg width='32' height='32' viewBox='0 0 32 32' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cg transform='rotate(${Math.round(J)} 16 16)'%3E%3Cg filter='url(%23f)'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M11.1212 16.9998L11.5607 17.4394C12.1465 18.0252 12.1464 18.975 11.5606 19.5607C10.9748 20.1465 10.0251 20.1465 9.4393 19.5606L6.4393 16.5604C5.85354 15.9746 5.85357 15.0249 6.43938 14.4391L9.43938 11.4393C10.0252 10.8535 10.9749 10.8536 11.5607 11.4394C12.1465 12.0252 12.1464 12.9749 11.5606 13.5607L11.1215 13.9998L20.8786 13.9999L20.4394 13.5607C19.8536 12.9749 19.8535 12.0252 20.4393 11.4394C21.0251 10.8536 21.9749 10.8536 22.5606 11.4394L25.5606 14.4393C25.842 14.7206 26 15.1021 26 15.4999C26 15.8978 25.842 16.2793 25.5607 16.5606L22.5607 19.5607C21.9749 20.1465 21.0251 20.1465 20.4393 19.5607C19.8536 18.9749 19.8535 18.0252 20.4393 17.4394L20.8788 16.9999L11.1212 16.9998Z' fill='white'/%3E%3C/g%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M10.8536 12.1465C11.0488 12.3417 11.0488 12.6583 10.8535 12.8536L8.70715 14.9998L23.2929 14.9999L21.1465 12.8536C20.9512 12.6583 20.9512 12.3417 21.1464 12.1465C21.3417 11.9512 21.6583 11.9512 21.8535 12.1465L24.8535 15.1464C24.9473 15.2402 25 15.3673 25 15.4999C25 15.6326 24.9473 15.7597 24.8536 15.8535L21.8536 18.8536C21.6583 19.0488 21.3417 19.0488 21.1465 18.8536C20.9512 18.6583 20.9512 18.3417 21.1464 18.1465L23.2929 15.9999L8.70705 15.9998L10.8536 18.1465C11.0488 18.3417 11.0488 18.6583 10.8535 18.8536C10.6583 19.0488 10.3417 19.0488 10.1464 18.8535L7.14643 15.8533C6.95118 15.658 6.95119 15.3415 7.14646 15.1462L10.1465 12.1464C10.3417 11.9512 10.6583 11.9512 10.8536 12.1465Z' fill='black'/%3E%3C/g%3E%3Cdefs%3E%3Cfilter id='f' x='3' y='9' width='26' height='15' filterUnits='userSpaceOnUse' color-interpolation-filters='sRGB'%3E%3CfeFlood flood-opacity='0' result='a'/%3E%3CfeColorMatrix in='SourceAlpha' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0' result='b'/%3E%3CfeOffset dy='1'/%3E%3CfeGaussianBlur stdDeviation='1.5'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.35 0'/%3E%3CfeBlend in2='a' result='c'/%3E%3CfeBlend in='SourceGraphic' in2='c'/%3E%3C/filter%3E%3C/defs%3E%3C/svg%3E") 16 16, nwse-resize`}#KJ(J){return`url("data:image/svg+xml,%3Csvg width='32' height='32' viewBox='0 0 32 32' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cg transform='rotate(${Math.round(J-45)} 16 16)'%3E%3Cg filter='url(%23f)'%3E%3Cpath d='M12.5607 22.4393L12.0216 21.9002C17.1558 21.2216 21.2216 17.1558 21.9002 12.0216L22.4393 12.5607C23.0251 13.1464 23.9749 13.1464 24.5607 12.5607C25.1464 11.9749 25.1464 11.0251 24.5607 10.4393L21.5607 7.43934C20.9749 6.85355 20.0251 6.85355 19.4393 7.43934L16.4393 10.4393C15.8536 11.0251 15.8536 11.9749 16.4393 12.5607C17.0251 13.1464 17.9749 13.1464 18.5607 12.5607L18.8056 12.3157C18.1013 15.5527 15.5527 18.1013 12.3157 18.8056L12.5607 18.5607C13.1464 17.9749 13.1464 17.0251 12.5607 16.4393C11.9749 15.8536 11.0251 15.8536 10.4393 16.4393L7.43934 19.4393C6.85356 20.0251 6.85356 20.9749 7.43934 21.5607L10.4393 24.5607C11.0251 25.1464 11.9749 25.1464 12.5607 24.5607C13.1464 23.9749 13.1464 23.0251 12.5607 22.4393Z' fill='white'/%3E%3C/g%3E%3Cpath d='M23.8536 11.8536C23.6583 12.0488 23.3417 12.0488 23.1464 11.8536L21 9.70711V10.5C21 16.299 16.299 21 10.5 21H9.70711L11.8536 23.1464C12.0488 23.3417 12.0488 23.6583 11.8536 23.8536C11.6583 24.0488 11.3417 24.0488 11.1464 23.8536L8.14645 20.8536C7.95119 20.6583 7.95119 20.3417 8.14645 20.1464L11.1464 17.1464C11.3417 16.9512 11.6583 16.9512 11.8536 17.1464C12.0488 17.3417 12.0488 17.6583 11.8536 17.8536L9.70711 20H10.5C15.7467 20 20 15.7467 20 10.5V9.70711L17.8536 11.8536C17.6583 12.0488 17.3417 12.0488 17.1464 11.8536C16.9512 11.6583 16.9512 11.3417 17.1464 11.1464L20.1464 8.14645C20.3417 7.95119 20.6583 7.95119 20.8536 8.14645L23.8536 11.1464C24.0488 11.3417 24.0488 11.6583 23.8536 11.8536Z' fill='black'/%3E%3C/g%3E%3Cdefs%3E%3Cfilter id='f' x='4' y='5' width='24' height='24' filterUnits='userSpaceOnUse' color-interpolation-filters='sRGB'%3E%3CfeFlood flood-opacity='0' result='a'/%3E%3CfeColorMatrix in='SourceAlpha' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0' result='b'/%3E%3CfeOffset dy='1'/%3E%3CfeGaussianBlur stdDeviation='1.5'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.35 0'/%3E%3CfeBlend in2='a' result='c'/%3E%3CfeBlend in='SourceGraphic' in2='c'/%3E%3C/filter%3E%3C/defs%3E%3C/svg%3E") 16 16, pointer`}#HJ(J,Q){if(!J)return;J.style.setProperty("cursor",Q,"important")}#TJ(J,Q){if(!J)return;let Z=J.querySelector(".fig-handle-hit-area");if(!Z)return;if(Z.setAttribute("data-cursor","rotate"),this.#HJ(Z,this.#KJ(Q)),this.#R===J)this.#qJ()}#MJ(){if(!this.#X||!this.#x)return;this.#TJ(this.#X,this.#Y)}#FJ(){return Math.atan2(this.#Q-this.#$,this.#J-this.#Z)*180/Math.PI}#CJ(){if(!this.#C)return;let J=this.#FJ();this.#B?.style.removeProperty("cursor"),this.#M?.style.removeProperty("cursor"),this.#TJ(this.#B,J+180),this.#TJ(this.#M,J)}#RJ(J,Q,Z,$){J.style.setProperty("--fig-handle-position-translate","-50% -50%"),J.style.left=`${Q/100*$.width}px`,J.style.top=`${Z/100*$.height}px`}#u(){let J=this.#r;if(!J||!this.#B)return;let Q=J.getBoundingClientRect();if(this.#RJ(this.#B,this.#Z,this.#$,Q),this.#q){let Z=this.#Z/100*Q.width,$=this.#$/100*Q.height,j=this.#kJ(Q.width),_=this.#q,X=Math.max(j*2,1);_.style.position="absolute",_.style.width=`${X}px`,_.style.height=`${X}px`,_.style.left=`${Z-j}px`,_.style.top=`${$-j}px`,_.setAttribute("viewBox",`0 0 ${X} ${X}`);let q=_.querySelectorAll("circle");for(let B of q)B.setAttribute("cx",String(j)),B.setAttribute("cy",String(j)),B.setAttribute("r",String(Math.max(j-1,0)))}if(this.#G&&this.#A){let Z=this.#Z/100*Q.width,$=this.#$/100*Q.height,j,_;if(this.#C)j=this.#J/100*Q.width,_=this.#Q/100*Q.height;else{let B=this.#kJ(Q.width),Y=this.#Y*Math.PI/180;j=Z+B*Math.cos(Y),_=$+B*Math.sin(Y)}let X=this.#G;X.style.width=`${Q.width}px`,X.style.height=`${Q.height}px`,X.style.left="0",X.style.top="0",X.setAttribute("viewBox",`0 0 ${Q.width} ${Q.height}`);let q=X.querySelectorAll(".fig-canvas-control-angle-line, .fig-canvas-control-angle-line-halo, .fig-canvas-control-angle-line-hit");for(let B of q)B.setAttribute("x1",String(Z)),B.setAttribute("y1",String($)),B.setAttribute("x2",String(j)),B.setAttribute("y2",String(_))}if(this.#X&&this.#x){let Z=this.#Z/100*Q.width,$=this.#$/100*Q.height,j=this.#kJ(Q.width),_=this.#Y*Math.PI/180,X=Z+j*Math.cos(_),q=$+j*Math.sin(_),B=Q.width>0?X/Q.width*100:0,Y=Q.height>0?q/Q.height*100:0;this.#RJ(this.#X,B,Y,Q)}if(this.#M&&this.#C)this.#RJ(this.#M,this.#J,this.#Q,Q);this.#MJ(),this.#CJ()}#YJ(J=this.value){this.dispatchEvent(new CustomEvent("input",{bubbles:!0,detail:J}))}#$J(J=this.value){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:J}))}#fJ(J){return{...this.value,...xJ(J.color,J.alpha,J.opacity)}}#c(){this.setAttribute("value",JSON.stringify(this.value))}#DJ(){if(!this.#B)return;if(this.#B.addEventListener("input",(J)=>{if(J.stopPropagation(),J.detail?.color){this.setAttribute("color",this.#B.getAttribute("color")||J.detail.color),this.#YJ(this.#fJ(J.detail));return}this.#K=!0;let Q=J.detail?.px??this.#Z/100,Z=J.detail?.py??this.#$/100;if(this.#Z=this.#S(Math.max(0,Math.min(100,Q*100))),this.#$=this.#S(Math.max(0,Math.min(100,Z*100))),this.#O)this.#O.removeAttribute("show"),this.#O.hidePopup?.();this.#u(),this.#YJ()}),this.#B.addEventListener("change",(J)=>{if(J.stopPropagation(),J.detail?.color){this.setAttribute("color",this.#B.getAttribute("color")||J.detail.color),this.#$J(this.#fJ(J.detail));return}let Q=J.detail?.px??this.#Z/100,Z=J.detail?.py??this.#$/100;if(this.#Z=this.#S(Math.max(0,Math.min(100,Q*100))),this.#$=this.#S(Math.max(0,Math.min(100,Z*100))),this.#O)this.#O.removeAttribute("show");this.#u(),this.#c(),this.#$J(),requestAnimationFrame(()=>{this.#K=!1})}),this.#X)this.#X.addEventListener("input",(J)=>{J.stopPropagation();let Q=this.#r;if(!Q)return;this.#T=!0,this.classList.add("fig-canvas-control-ring-active");let Z=Q.getBoundingClientRect(),$=this.#Z/100*Z.width,j=this.#$/100*Z.height,_=J.detail?.x??0,X=J.detail?.y??0,q=this.#X.offsetWidth/2,B=this.#X.offsetHeight/2,Y=_+q-$,G=X+B-j,M=Math.atan2(G,Y)*180/Math.PI;if(this.#w(J.detail?.shiftKey))M=Math.round(M/15)*15;this.#Y=this.#S(M);let k=Math.sqrt(Y*Y+G*G);if(this.#w(J.detail?.shiftKey)){let U=this.#j?5:10;if(this.#j){let P=k/Z.width*100;P=Math.round(P/U)*U,k=P/100*Z.width}else k=Math.round(k/U)*U}if(this.#j)this.#_=this.#S(Math.max(0,k/Z.width*100));else this.#_=this.#S(Math.max(0,k));if(this.#N)this.#N.setAttribute("text",`Angle ${this.#S(this.#Y)}°`),this.#N.setAttribute("show","true"),this.#N.showPopup?.();this.#u(),this.#YJ()}),this.#X.addEventListener("change",(J)=>{if(J.stopPropagation(),this.classList.remove("fig-canvas-control-ring-active"),this.#N)this.#N.removeAttribute("show");this.#u(),this.#c(),this.#$J(),requestAnimationFrame(()=>{this.#T=!1})}),this.#X.addEventListener("hitareadown",(J)=>{J.stopPropagation();let Q=J.detail?.originalEvent;if(!Q)return;Q.preventDefault();let Z=this.#r;if(!Z)return;if(this.#T=!0,this.classList.add("fig-canvas-control-ring-active"),this.#X.setAttribute("selected",""),this.#N)this.#N.setAttribute("show","true"),this.#N.showPopup?.();let $=(_)=>{let X=Z.getBoundingClientRect(),q=this.#Z/100*X.width,B=this.#$/100*X.height,Y=_.clientX-X.left-q,G=_.clientY-X.top-B,M=Math.atan2(G,Y)*180/Math.PI;if(this.#w(_.shiftKey))M=Math.round(M/15)*15;if(this.#Y=this.#S(M),this.#N)this.#N.setAttribute("text",`Angle ${this.#S(M)}°`);this.#u(),this.#YJ()},j=this.#zJ((_)=>{if(this.#T=!1,this.classList.remove("fig-canvas-control-ring-active"),this.#X.removeAttribute("selected"),this.#N)this.#N.removeAttribute("show");if(_)this.#c(),this.#$J()});window.addEventListener("pointermove",$,{signal:j.signal}),window.addEventListener("pointerup",()=>j.finish(!0),{signal:j.signal}),window.addEventListener("pointercancel",()=>j.finish(!1),{signal:j.signal})});if(this.#M)this.#M.addEventListener("input",(J)=>{J.stopPropagation(),this.#P=!0;let Q=J.detail?.px??this.#J/100,Z=J.detail?.py??this.#Q/100;if(this.#J=this.#S(Math.max(0,Math.min(100,Q*100))),this.#Q=this.#S(Math.max(0,Math.min(100,Z*100))),this.#k)this.#k.removeAttribute("show"),this.#k.hidePopup?.();this.#u(),this.#YJ()}),this.#M.addEventListener("change",(J)=>{if(J.stopPropagation(),this.#k)this.#k.removeAttribute("show");this.#u(),this.#c(),this.#$J(),requestAnimationFrame(()=>{this.#P=!1})}),this.#AJ(this.#B,!0),this.#AJ(this.#M,!1)}#AJ(J,Q){if(!J)return;J.addEventListener("hitareadown",(Z)=>{Z.stopPropagation();let $=Z.detail?.originalEvent;if(!$)return;$.preventDefault();let j=this.#r;if(!j)return;this.#K=!0;let _=j.getBoundingClientRect(),X=Q?this.#J:this.#Z,q=Q?this.#Q:this.#$,B=Q?this.#Z:this.#J,Y=Q?this.#$:this.#Q,G=X/100*_.width,M=q/100*_.height,k=B/100*_.width,U=Y/100*_.height,P=Math.sqrt((k-G)**2+(U-M)**2),T=Q?this.#O:this.#k;if(T)T.removeAttribute("show"),T.hidePopup?.();let H=(A)=>{let z=j.getBoundingClientRect(),I=X/100*z.width,E=q/100*z.height,y=A.clientX-z.left-I,w=A.clientY-z.top-E,x=Math.atan2(w,y);if(this.#w(A.shiftKey))x=Math.round(x*180/Math.PI/15)*15*Math.PI/180;let e=I+P*Math.cos(x),a=E+P*Math.sin(x),p=Math.max(0,Math.min(100,e/z.width*100)),g=Math.max(0,Math.min(100,a/z.height*100));if(Q)this.#Z=this.#S(p),this.#$=this.#S(g);else this.#J=this.#S(p),this.#Q=this.#S(g);this.#u(),this.#YJ()},D=this.#zJ((A)=>{if(this.#K=!1,T)T.removeAttribute("show");if(A)this.#c(),this.#$J()});window.addEventListener("pointermove",H,{signal:D.signal}),window.addEventListener("pointerup",()=>D.finish(!0),{signal:D.signal}),window.addEventListener("pointercancel",()=>D.finish(!1),{signal:D.signal})})}#IJ(J){if(!J)return;J.addEventListener("pointermove",(Z)=>{if(this.#L)return;let $=this.#r;if(!$)return;let j=$.getBoundingClientRect(),_=this.#Z/100*j.width,X=this.#$/100*j.height,q=Math.atan2(Z.clientY-j.top-X,Z.clientX-j.left-_)*180/Math.PI;this.#HJ(J,this.#l(q))});let Q=(Z)=>{if(O(this,"disabled"))return;Z.preventDefault(),Z.stopPropagation(),this.#L=!0,this.classList.add("fig-canvas-control-ring-active");let $=this.#r;if(!$)return;if(this.#U)this.#U.setAttribute("show","true"),this.#U.showPopup?.(),this.#OJ(Z.clientX,Z.clientY);if(this.#N)this.#N.removeAttribute("show"),this.#N.hidePopup?.();let j=this.#X?.style.pointerEvents,_=this.#X?.querySelector(".fig-handle-hit-area"),X=_?.style.pointerEvents;if(this.#X)this.#X.style.pointerEvents="none";if(_)_.style.pointerEvents="none";let q=document.body.style.cursor;J.style.pointerEvents="none";let B=$.getBoundingClientRect(),Y=this.#Z/100*B.width,G=this.#$/100*B.height,M=Math.atan2(Z.clientY-B.top-G,Z.clientX-B.left-Y)*180/Math.PI,k=Math.round(M);document.body.style.cursor=this.#l(k);let U=(T)=>{let H=$.getBoundingClientRect(),D=this.#Z/100*H.width,A=this.#$/100*H.height,z=T.clientX-H.left-D,I=T.clientY-H.top-A,E=Math.round(Math.atan2(I,z)*180/Math.PI);if(E!==k)k=E,document.body.style.cursor=this.#l(E);let y=Math.sqrt(z*z+I*I);if(this.#w(T.shiftKey)){let w=this.#j?5:10;if(this.#j){let x=y/H.width*100;x=Math.round(x/w)*w,y=x/100*H.width}else y=Math.round(y/w)*w}if(this.#j)this.#_=this.#S(Math.max(0,y/H.width*100));else this.#_=this.#S(Math.max(0,y));if(this.#U)this.#U.setAttribute("text",this.#n()),this.#OJ(T.clientX,T.clientY);this.#u(),this.#YJ()},P=this.#zJ((T)=>{if(this.#L=!1,this.classList.remove("fig-canvas-control-ring-active"),J.style.pointerEvents="",this.#X)this.#X.style.pointerEvents=j??"";if(_)_.style.pointerEvents=X??"";if(document.body.style.cursor=q,this.#U)this.#U.removeAttribute("show");if(T)this.#c(),this.#$J()});window.addEventListener("pointermove",U,{signal:P.signal}),window.addEventListener("pointerup",()=>P.finish(!0),{signal:P.signal}),window.addEventListener("pointercancel",()=>P.finish(!1),{signal:P.signal})};J.addEventListener("pointerdown",Q),this._radiusDragCleanup=()=>J.removeEventListener("pointerdown",Q)}#bJ(){if(this._radiusDragCleanup)this._radiusDragCleanup(),this._radiusDragCleanup=null}#zJ(J){this.#VJ();let Q=new AbortController,Z=!1,$=(j=!1)=>{if(Z)return;if(Z=!0,Q.abort(),this.#V===Q)this.#V=null,this.#p=null;J(j)};return this.#V=Q,this.#p=$,{signal:Q.signal,finish:$}}#VJ(){this.#p?.(!1),this.#V?.abort(),this.#V=null,this.#p=null}}L("fig-canvas-control",bJ);class F extends S{#Z=[F.#R()];#$=0;#J=2;#Q=240;#_=120;#j={min:-1,max:1};#Y=null;#B=null;#M=null;#X=null;#q=0;#G=null;#O=null;#k=null;#U=null;#N=[];#K=[];#P=[];#L=[];#T=new Set;#F=null;#W=null;#H=null;#z=null;#f=null;static TYPES=[{name:"Wave",value:"sine"},{name:"Square",value:"square"},{name:"Sawtooth",value:"sawtooth"},{name:"Triangle",value:"triangle"}];static#R(J="sine"){return{type:J,frequency:1,amplitude:1,phase:0,offset:0}}static get observedAttributes(){return["value","precision","aspect-ratio","edit","disabled"]}connectedCallback(){if(this.#f===null)this.#f=this.getAttribute("default")??this.getAttribute("value")??JSON.stringify({waves:[F.#R()]});this.#J=this.#D("precision",2),this.#y(this.getAttribute("value")),this.#p(),this.#i(),this.#NJ(),W(this)}disconnectedCallback(){if(this.#FJ(),this.#PJ(),this.#F)this.#F.disconnect(),this.#F=null;f(this)}attributeChangedCallback(J,Q,Z){if(Q===Z)return;if(J==="value"){if(this.#y(Z),this.isConnected)this.#i();return}if(J==="precision"){if(this.#J=this.#D("precision",2),this.isConnected)this.#u();return}if(J==="aspect-ratio"){if(this.#p(),this.#B)this.#_J();return}if(J==="edit"||J==="disabled"){if(this.isConnected)this.#i()}}get value(){return JSON.stringify(this.data)}set value(J){this.setAttribute("value",typeof J==="object"&&J!==null?JSON.stringify(J):J)}get defaultValue(){return this.getAttribute("default")??this.#f??""}get isDefault(){let J=this.#b(this.defaultValue);if(!J)return!1;return JSON.stringify(this.data.waves)===JSON.stringify(J.map((Q)=>this.#C(Q)))}resetToDefault(){let J=this.defaultValue;if(!J)return;this.value=J,this.#c("input"),this.#c("change")}get data(){return{waves:this.#Z.map((J)=>this.#C(J))}}get preset(){let J=this.#A;return F.TYPES.find((Q)=>Q.value===J.type)?.name}#D(J,Q){let Z=Number.parseInt(this.getAttribute(J)||"",10);return Number.isFinite(Z)?Math.max(0,Math.min(100,Z)):Q}#h(J,Q=!1){let Z=this.getAttribute(J);if(Z===null)return Q;let $=Z.trim().toLowerCase();if($===""||$==="true")return!0;if($==="false")return!1;return!0}#I(){return this.getAttribute("edit")!=="false"}#V(){return this.#h("disabled",!1)}#p(){let J=this.getAttribute("aspect-ratio")||"2 / 1";this.style.setProperty("--aspect-ratio",J)}#y(J){let Q=this.#b(J);if(!Q)return!1;if(this.#Z=Q,!this.#Z.length)this.#Z=[F.#R()];return this.#$=Math.min(this.#$,this.#Z.length-1),!0}#b(J){if(!J)return null;let Q=null;if(typeof J==="string")try{Q=JSON.parse(J)}catch{return null}else if(typeof J==="object")Q=J;if(!Q)return null;return(Array.isArray(Q)?Q:Array.isArray(Q.waves)?Q.waves:[Q]).map(($)=>this.#x($))}#x(J={}){return{type:this.#d(J.type),frequency:this.#m(J.frequency,1,0.1,16),amplitude:this.#m(J.amplitude,1,-4,4),phase:this.#m(J.phase,0,-360,360),offset:this.#m(J.offset,0,-4,4)}}#C(J){return{type:J.type,frequency:this.#E(J.frequency),amplitude:this.#E(J.amplitude),phase:this.#E(J.phase),offset:this.#E(J.offset)}}get#A(){if(!this.#Z[this.#$])this.#$=0;return this.#Z[this.#$]||F.#R()}#d(J){let Q=String(J||"").toLowerCase();return F.TYPES.some((Z)=>Z.value===Q)?Q:"sine"}#m(J,Q,Z,$){let j=Number.parseFloat(J);if(!Number.isFinite(j))return Q;return Math.min($,Math.max(Z,j))}#E(J){let Q=10**this.#J;return Math.round(J*Q)/Q}static#S(J){return F.TYPES.find((Q)=>Q.value===J)?.name||"Wave"}static#jJ(J,Q=24){let j=Q-10,_="";for(let X=0;X<=32;X++){let q=X/32,B=F.#v(J,q),Y=5+q*j,G=5+(1-(B+1)/2)*j;_+=`${X===0?"M":"L"}${Y.toFixed(1)},${G.toFixed(1)}`}return _}static#w(J,Q=24){return h("svg",{width:Q,height:Q,viewBox:`0 0 ${Q} ${Q}`,fill:"none"},h("path",{d:F.#jJ(J,Q),stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round"}))}static waveIcon(J,Q=24){let Z=F.#jJ(J,Q);return`<svg width="${Q}" height="${Q}" viewBox="0 0 ${Q} ${Q}" fill="none"><path d="${Z}" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"/></svg>`}static#v(J,Q,Z=0){let $=Q+Z/360,j=$-Math.floor($),_=$*Math.PI*2;switch(J){case"square":return Math.sin(_)>=0?1:-1;case"sawtooth":return j*2-1;case"triangle":return 1-Math.abs(j*4-2);default:return Math.sin(_)}}#i(){if(this.#FJ(),this.#PJ(),this.replaceChildren(...this.#r()),this.#e(),this.#BJ(),this.#_J(),this.#WJ(),!this.#V())this.#XJ();W(this)}#t(J,Q){return h("foreignObject",{className:`propskit-oscillator-handle propskit-oscillator-${J}-handle`,"data-handle":J,width:"20",height:"20"},N("div",{className:"propskit-oscillator-handle-inner"},N("fig-tooltip",{text:Q},N("fig-handle",{size:"small",type:"minimal","aria-label":`Oscillator ${J} handle`}))))}#r(){let J=this.#I()&&!this.#V(),Q=[h("rect",{className:"propskit-oscillator-bounds",x:"0",y:"0",width:this.#Q,height:this.#_}),h("line",{className:"propskit-oscillator-baseline"}),h("path",{className:"propskit-oscillator-path"}),h("circle",{className:"propskit-oscillator-playhead"})];if(J)Q.push(this.#t("amplitude","Amplitude"),this.#t("frequency","Frequency"));let Z=h("svg",{viewBox:`0 0 ${this.#Q} ${this.#_}`,className:"propskit-oscillator-svg"},Q),$=[N("div",{className:"propskit-oscillator-svg-container"},Z)];if(this.#I())$.push(N("div",{className:"propskit-oscillator-waves"},this.#Z.map((j,_)=>this.#g(j,_,!J))));return $}#g(J,Q,Z){let $=Z||this.#Z.length<=1,j=Q===this.#$,_=F.#S(J.type),X=N("fig-tooltip",{text:"Remove form"},N("fig-button",{className:"propskit-oscillator-remove-button",variant:"ghost",icon:!0,"data-wave-index":Q,"aria-label":"Remove form",disabled:$},N("fig-icon",{name:"minus"}))),q=N("fig-header",{borderless:!0},[N("h3",{},_),X,this.#kJ(Z,Q)]),B=N("div",{className:"propskit-oscillator-fields","data-wave-index":Q,"data-active":j},[this.#n(Q,"frequency","Frequency",0.1,16,0.1,""),this.#n(Q,"amplitude","Amplitude",-4,4,0.1,""),this.#n(Q,"phase","Phase",-360,360,1,"°"),this.#n(Q,"offset","Offset",-4,4,0.1,"")]);return N("fig-group",{className:"propskit-oscillator-wave",collapsible:!0,borderless:!0,compact:"true",open:this.#T.has(Q)?"true":"false","data-wave-index":Q},[q,B])}#kJ(J,Q){let Z=N("fig-tooltip",{text:"Add form"},N("fig-button",{className:"propskit-oscillator-add-type-button",variant:"ghost",icon:!0,"fig-menu-trigger":!0,"aria-label":"Add form",disabled:J},N("fig-icon",{name:"plus"}))),$=F.TYPES.map((j)=>N("fig-menu-item",{value:j.value},[F.#w(j.value,24),N("span",{},j.name)]));return N("fig-menu",{className:"propskit-oscillator-add-type",position:"bottom right","data-wave-index":Q,disabled:J},[Z,$])}#n(J,Q,Z,$,j,_,X){let q=this.#Z[J]||F.#R(),B=Q==="amplitude"||Q==="offset";return N("propskit-slider",{className:"propskit-oscillator-field",label:Z,name:Q,"data-wave-index":J,value:this.#E(q[Q]),min:$,max:j,step:_,precision:this.#J,elastic:"false",type:B?"delta":null,default:B?"0":null,units:X||null,disabled:this.#V()})}#e(){this.#B=this.querySelector(".propskit-oscillator-svg"),this.#M=this.querySelector(".propskit-oscillator-path"),this.#X=this.querySelector(".propskit-oscillator-playhead"),this.#G=this.querySelector(".propskit-oscillator-baseline"),this.#O=this.querySelector(".propskit-oscillator-bounds"),this.#k=this.querySelector('[data-handle="amplitude"]'),this.#U=this.querySelector('[data-handle="frequency"]'),this.#K=Array.from(this.querySelectorAll(".propskit-oscillator-wave-type")),this.#N=Array.from(this.querySelectorAll("propskit-slider[name]")),this.#L=Array.from(this.querySelectorAll("fig-group.propskit-oscillator-wave")),this.#P=Array.from(this.querySelectorAll(".propskit-oscillator-fields"))}#QJ(J){let Q=new Set;for(let Z of this.#T)if(Z<J)Q.add(Z);else if(Z>J)Q.add(Z-1);this.#T=Q}#s(J){let Q=new Set;for(let Z of this.#T)Q.add(Z>=J?Z+1:Z);Q.add(J),this.#T=Q}#NJ(){if(this.#F||!window.ResizeObserver)return;this.#F=new ResizeObserver(()=>{if(this.#BJ())this.#_J()}),this.#F.observe(this)}#BJ(){if(!this.#B)return!1;let J=this.#B.getBoundingClientRect(),Q=Math.max(1,Math.round(J.width||240)),Z=Math.max(1,Math.round(J.height||120)),$=Q!==this.#Q||Z!==this.#_;return this.#Q=Q,this.#_=Z,this.#B.setAttribute("viewBox",`0 0 ${Q} ${Z}`),$}#GJ(){let J=1,Q=256;for(let Z=0;Z<=Q;Z++)J=Math.max(J,Math.abs(this.#JJ(Z/Q)));return{min:-J,max:J}}#qJ(J){let{min:Q,max:Z}=this.#j;return this.#_-(J-Q)/(Z-Q)*this.#_}#LJ(J){let{min:Q,max:Z}=this.#j;return Q+(1-J/this.#_)*(Z-Q)}#JJ(J){return this.#Z.reduce((Q,Z)=>{let $=J*Z.frequency,j=F.#v(Z.type,$,Z.phase);return Q+Z.offset+j*Z.amplitude},0)}#_J(){if(!this.#B||!this.#M)return;if(this.#BJ(),this.#j=this.#GJ(),this.#O)this.#O.setAttribute("width",this.#Q),this.#O.setAttribute("height",this.#_);let J=Math.max(...this.#Z.map((_)=>_.frequency)),Z=this.#Z.some((_)=>_.type==="square"||_.type==="sawtooth")?Math.max(192,Math.ceil(J*64)):Math.max(96,Math.ceil(J*64)),$="";for(let _=0;_<=Z;_++){let X=_/Z,q=X*this.#Q,B=this.#qJ(this.#JJ(X));$+=`${_===0?"M":"L"}${q.toFixed(1)},${B.toFixed(1)}`}this.#M.setAttribute("d",$);let j=this.#qJ(0);this.#G?.setAttribute("x1","0"),this.#G?.setAttribute("y1",j),this.#G?.setAttribute("x2",this.#Q),this.#G?.setAttribute("y2",j),this.#SJ()}#XJ(){if(this.#q||!this.#X)return;let J=(Q)=>{if(!this.isConnected||!this.#X){this.#q=0;return}this.#OJ(Q%1000/1000),this.#q=requestAnimationFrame(J)};this.#q=requestAnimationFrame(J)}#PJ(){if(!this.#q)return;cancelAnimationFrame(this.#q),this.#q=0}#OJ(J){if(!this.#X)return;let Q=J*this.#Q,Z=this.#qJ(this.#JJ(J));this.#X.setAttribute("cx",Q.toFixed(1)),this.#X.setAttribute("cy",Z.toFixed(1))}#SJ(){let Q=this.#A,Z=this.#a(),$=Math.max(8,Math.min(this.#Q-8,this.#Q/Q.frequency)),j=this.#qJ(this.#JJ(Z/this.#Q)),_=this.#qJ(this.#JJ($/this.#Q));this.#ZJ(this.#k,Z,j,8),this.#ZJ(this.#U,$,_,8)}#a(){let J=this.#A,Q=J.phase/360,Z=Math.max(0.1,J.frequency),$=0.25;if(J.type==="triangle")$=0.5;if(J.type==="sawtooth")$=1;let j=($-Q)/Z;while(j<0)j+=1/Z;while(j>1)j-=1/Z;if(j<0||j>1||!Number.isFinite(j))j=0.25;return Math.max(8,Math.min(this.#Q-8,j*this.#Q))}#ZJ(J,Q,Z,$){if(!J)return;J.setAttribute("x",Q-$),J.setAttribute("y",Z-$),J.setAttribute("width",$*2),J.setAttribute("height",$*2)}#WJ(){if(!this.#I()||this.#V())return;for(let Q of this.#K)Q.addEventListener("change",(Z)=>{if(this.#V())return;let $=this.#o(Q);this.#l($),this.#Z[$].type=this.#d(Z.detail??Z.target?.value),this.#u(),this.#c("input"),this.#c("change")});for(let Q of this.#N)Q.addEventListener("input",(Z)=>{Z.stopPropagation(),this.#W=Q;try{this.#KJ(this.#o(Q),Q.getAttribute("name"),Z.detail?.value??Z.currentTarget?.value??Z.target?.value,"input")}finally{this.#W=null}}),Q.addEventListener("change",(Z)=>{Z.stopPropagation(),this.#KJ(this.#o(Q),Q.getAttribute("name"),Z.detail?.value??Z.currentTarget?.value??Z.target?.value,"change")});for(let Q of this.#L)Q.addEventListener("pointerdown",()=>{this.#l(this.#o(Q))}),Q.addEventListener("focusin",()=>{this.#l(this.#o(Q))}),Q.addEventListener("openchange",(Z)=>{let $=this.#o(Q);if(Z.detail?.open)this.#T.add($);else this.#T.delete($)});for(let Q of this.querySelectorAll(".propskit-oscillator-add-type")){let Z=($)=>{$.stopPropagation()};Q.addEventListener("pointerdown",Z),Q.addEventListener("click",Z),Q.addEventListener("change",($)=>{if($.target!==Q)return;if(this.#V())return;let _=this.#o(Q)+1,X=this.#d($.detail?.value??Q.value);this.#Z.splice(_,0,F.#R(X)),this.#s(_),this.#$=_,this.#i(),this.#c("input"),this.#c("change")})}for(let Q of this.querySelectorAll(".propskit-oscillator-add-type-button")){let Z=($)=>{$.stopPropagation()};Q.addEventListener("pointerdown",Z),Q.addEventListener("click",Z),Q.closest("fig-tooltip")?.addEventListener("pointerdown",Z),Q.closest("fig-tooltip")?.addEventListener("click",Z)}for(let Q of this.querySelectorAll(".propskit-oscillator-remove-button"))Q.addEventListener("pointerdown",(Z)=>{Z.stopPropagation()}),Q.addEventListener("click",(Z)=>{if(Z.stopPropagation(),this.#V()||this.#Z.length<=1)return;let $=this.#o(Q);this.#Z.splice($,1),this.#QJ($),this.#$=Math.min(this.#$,this.#Z.length-1),this.#i(),this.#c("input"),this.#c("change")});for(let Q of[this.#k,this.#U])this.#UJ(Q);this.querySelector(".propskit-oscillator-svg-container")?.addEventListener("pointerdown",(Q)=>{if(this.#V())return;if(Q.target?.closest?.(".propskit-oscillator-handle, fig-handle"))return;this.#MJ(Q,"offset")})}#o(J){let Q=Number.parseInt(J?.getAttribute("data-wave-index")||"",10);return Number.isFinite(Q)?Math.min(this.#Z.length-1,Math.max(0,Q)):0}#UJ(J){let Q=J?.querySelector("fig-handle"),Z=J?.getAttribute("data-handle");if(!Q||!Z)return;Q.addEventListener("pointerdown",($)=>{if(this.#V())return;$.preventDefault(),$.stopImmediatePropagation(),this.#MJ($,Z)},{capture:!0}),Q.addEventListener("keydown",($)=>{if(this.#V())return;if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes($.key))return;if(!this.#HJ($,Z))return;$.preventDefault(),$.stopImmediatePropagation()},{capture:!0})}#l(J){let Q=Math.min(this.#Z.length-1,Math.max(0,J));if(Q===this.#$)return;this.#$=Q,this.#fJ(),this.#SJ()}#KJ(J,Q,Z,$){if(this.#V())return;this.#l(J);let j=Number.parseFloat(Z);if(!Number.isFinite(j)){if($==="change")this.#$J();return}this.#Z[J]=this.#x({...this.#Z[J],[Q]:j}),this.#u({skipFieldSync:$=="input"}),this.#c($)}#HJ(J,Q){let Z=J.shiftKey?0.5:0.1,$=this.#A;switch(Q){case"amplitude":if(J.key==="ArrowUp")$.amplitude+=Z;else if(J.key==="ArrowDown")$.amplitude-=Z;else if(J.key==="Home")$.amplitude=-4;else if(J.key==="End")$.amplitude=4;else return!1;break;case"offset":if(J.key==="ArrowUp")$.offset+=Z;else if(J.key==="ArrowDown")$.offset-=Z;else if(J.key==="Home")$.offset=-4;else if(J.key==="End")$.offset=4;else return!1;break;case"frequency":if(J.key==="ArrowLeft")$.frequency-=Z;else if(J.key==="ArrowRight")$.frequency+=Z;else if(J.key==="Home")$.frequency=0.1;else if(J.key==="End")$.frequency=16;else return!1;break;default:return!1}return this.#Z[this.#$]=this.#x($),this.#u(),this.#c("input"),this.#c("change"),!0}#TJ(J){let Q=this.#B?.getScreenCTM();if(!Q)return{x:0,y:0};let Z=Q.inverse();return{x:Z.a*J.clientX+Z.c*J.clientY+Z.e,y:Z.b*J.clientX+Z.d*J.clientY+Z.f}}#MJ(J,Q){this.#FJ(),this.#Y=Q,this.#B?.classList.add("dragging");let Z=Q==="frequency"?"ew-resize":Q==="amplitude"?"ns-resize":"",$=document.body.style.cursor;if(Z)document.body.style.cursor=Z;let j=(q)=>{if(!this.#Y)return;let B=this.#TJ(q),Y=this.#A;if(Q==="frequency"){let G=Math.max(1,Math.min(this.#Q,B.x));Y.frequency=this.#Q/G}else if(Q==="offset"){let G=this.#m(B.x/this.#Q,0,0,1),M=this.#RJ(Y,G);Y.offset=this.#LJ(B.y)-this.#CJ(this.#$,G)-M*Y.amplitude}else if(Q==="amplitude"){let G=this.#m(B.x/this.#Q,0,0,1),M=this.#RJ(Y,G),k=this.#LJ(B.y)-this.#CJ(this.#$,G)-Y.offset;Y.amplitude=Math.abs(M)<0.001?Y.amplitude:k/M}this.#Z[this.#$]=this.#x(Y),this.#u(),this.#c("input")},_=new AbortController,X=(q=!1)=>{if(this.#Y=null,this.#B?.classList.remove("dragging"),Z)document.body.style.cursor=$;if(_.abort(),this.#H===_)this.#H=null,this.#z=null;if(q)this.#c("change")};this.#H=_,this.#z=X,document.addEventListener("pointermove",j,{signal:_.signal}),document.addEventListener("pointerup",()=>X(!0),{signal:_.signal}),document.addEventListener("pointercancel",()=>X(!1),{signal:_.signal}),window.addEventListener("blur",()=>X(!1),{signal:_.signal})}#FJ(){this.#z?.(!1),this.#H?.abort(),this.#H=null,this.#z=null,this.#Y=null,this.#B?.classList.remove("dragging")}#CJ(J,Q){return this.#Z.reduce((Z,$,j)=>{if(j===J)return Z;let _=Q*$.frequency,X=F.#v($.type,_,$.phase);return Z+$.offset+X*$.amplitude},0)}#RJ(J,Q){return F.#v(J.type,Q*J.frequency,J.phase)}#u({skipFieldSync:J=!1}={}){if(this.#YJ(),!J)this.#$J();this.#fJ(),this.#_J()}#YJ(){for(let J of this.#K){let Q=this.#o(J);J.value=this.#Z[Q]?.type||"sine"}}#$J(){for(let J of this.#N){if(J===this.#W)continue;let Q=this.#o(J),Z=J.getAttribute("name"),$=this.#E(this.#Z[Q]?.[Z]??0),j=J.querySelector("fig-slider");if(j)j.value=$;else J.setAttribute("value",String($))}}#fJ(){for(let J of this.#P)if(this.#o(J)===this.#$)J.setAttribute("data-active","");else J.removeAttribute("data-active")}#c(J){K(this,J)}}L("propskit-oscillator",F);class yJ extends HTMLElement{#Z;#$;#J=null;#Q;#_;#j;#Y;#B;#M;#X;#q=null;#G=null;constructor(){super();this.angle=0,this.#Z=1,this.#$=0,this.isDragging=!1,this.isShiftHeld=!1,this.handle=null,this.angleInput=null,this.plane=null,this.units="°",this.min=null,this.max=null,this.dial=!0,this.showRotations=!1,this.rotationSpan=null,this.#Q=this.#h.bind(this),this.#_=this.#d.bind(this),this.#j=this.#m.bind(this),this.#Y=this.#jJ.bind(this),this.#B=this.#w.bind(this),this.#M=this.#I.bind(this),this.#X=this.#S.bind(this)}connectedCallback(){requestAnimationFrame(()=>{if(!this.isConnected)return;this.precision=this.getAttribute("precision")||1,this.precision=parseInt(this.precision),this.text=this.getAttribute("text")==="true";let J=this.getAttribute("units")||"°";if(J==="deg")J="°";if(this.units=J,this.min=this.hasAttribute("min")?Number(this.getAttribute("min")):null,this.max=this.hasAttribute("max")?Number(this.getAttribute("max")):null,this.dial=this.#k("dial",!0),this.showRotations=this.#U(),this.#O(),this.#R(),this.#A(),this.text&&this.angleInput)this.angleInput.setAttribute("value",this.angle.toFixed(this.precision))})}disconnectedCallback(){this.#E(),this.#D()}#O(){this.#E(),this.#D();let J=this.#W(),Q=this.#K(),Z=this.getAttribute("aria-label")||this.getAttribute("name")||"Angle",$=this.min??this.#z(0),j=this.max??this.#z(360),_=[];if(this.dial)_.push(N("div",{className:"fig-input-angle-plane",role:"slider",tabindex:Q?"-1":"0","aria-label":Z,"aria-valuemin":$,"aria-valuemax":j,"aria-valuenow":this.angle,"aria-valuetext":`${this.angle.toFixed(this.precision)}${this.units}`,"aria-disabled":Q?"true":null},N("div",{className:"fig-input-angle-handle"})));if(this.text)_.push(N("fig-input-number",{name:"angle",step:J,value:this.angle,min:this.min,max:this.max,units:this.units,"aria-label":Z,disabled:Q},this.showRotations?N("span",{slot:"append",className:"fig-input-angle-rotations"}):null));this.replaceChildren(..._)}#k(J,Q=!1){let Z=this.getAttribute(J);if(Z===null)return Q;let $=Z.trim().toLowerCase();if($===""||$==="true")return!0;if($==="false")return!1;return!0}#U(){if(this.hasAttribute("rotations"))return this.#k("rotations",!1);if(this.hasAttribute("show-rotations"))return this.#k("show-rotations",!1);return!1}#N(){let J=Math.abs(this.#H(this.angle));return Math.floor(J/360)}#K(){return O(this,"disabled")}#P(J){let Q=Number(J);if(!Number.isFinite(Q))return this.angle;if(this.min!==null&&Number.isFinite(this.min))Q=Math.max(this.min,Q);if(this.max!==null&&Number.isFinite(this.max))Q=Math.min(this.max,Q);return Q}#L(J,{reflect:Q=!0}={}){let Z=this.#P(J);if(this.angle=Z,this.#V(),Q){let $=String(Z);if(this.getAttribute("value")!==$)this.setAttribute("value",$)}if(this.#A(),this.angleInput)this.angleInput.value=Z.toFixed(this.precision);this.#T(),this.#F()}#T(){if(!this.plane)return;this.plane.setAttribute("aria-valuenow",String(this.angle)),this.plane.setAttribute("aria-valuetext",`${this.angle.toFixed(this.precision)}${this.units}`)}#F(){if(!this.rotationSpan)return;let J=this.#N();if(J>1)this.rotationSpan.textContent=`×${J}`,this.rotationSpan.style.display="";else this.rotationSpan.textContent="",this.rotationSpan.style.display="none"}#W(){switch(this.units){case"rad":return 0.01;case"turn":return 0.001;default:return 0.1}}#H(J){switch(this.units){case"rad":return J*180/Math.PI;case"turn":return J*360;default:return J}}#z(J){switch(this.units){case"rad":return J*Math.PI/180;case"turn":return J/360;default:return J}}#f(J,Q,Z){let $;switch(Q){case"rad":$=J*180/Math.PI;break;case"turn":$=J*360;break;default:$=J}switch(Z){case"rad":return $*Math.PI/180;case"turn":return $/360;default:return $}}#R(){if(this.handle=this.querySelector(".fig-input-angle-handle"),this.plane=this.querySelector(".fig-input-angle-plane"),this.angleInput=this.querySelector("fig-input-number[name='angle']"),this.rotationSpan=this.querySelector(".fig-input-angle-rotations"),this.#F(),this.plane?.addEventListener("mousedown",this.#_),this.plane?.addEventListener("touchstart",this.#j),this.plane?.addEventListener("keydown",this.#X),window.addEventListener("keydown",this.#Y),window.addEventListener("keyup",this.#B),this.text&&this.angleInput)this.angleInput.addEventListener("input",this.#M),this.angleInput.addEventListener("change",this.#M);this.addEventListener("change",this.#Q,!0)}#D(){if(this.plane?.removeEventListener("mousedown",this.#_),this.plane?.removeEventListener("touchstart",this.#j),this.plane?.removeEventListener("keydown",this.#X),window.removeEventListener("keydown",this.#Y),window.removeEventListener("keyup",this.#B),this.text&&this.angleInput)this.angleInput.removeEventListener("input",this.#M),this.angleInput.removeEventListener("change",this.#M);this.removeEventListener("change",this.#Q,!0)}#h(J){if(!J.target?.matches?.("input"))return;let Z=J.target.value.match(/^(-?\d*\.?\d+)\s*(turn|rad|deg|°)$/i);if(Z){let $=parseFloat(Z[1]),j=Z[2].toLowerCase();if(j==="deg")j="°";if(j!==this.units){let _=this.#f($,j,this.units);J.target.value=String(_)}}}#I(J){if(J.stopPropagation(),this.#K())return;if(this.#L(Number(J.target.value)),J.type==="change")this.#C();else this.#x()}#V(){let Q=this.#H(this.angle)*Math.PI/180;this.#Z=Math.cos(Q),this.#$=Math.sin(Q)}#p(J){if(!this.isShiftHeld)return J;let Q=45;return Math.round(J/Q)*Q}#y(J){let Q=this.plane.getBoundingClientRect(),Z=Q.left+Q.width/2,$=Q.top+Q.height/2,j=J.clientX-Z,_=J.clientY-$;return Math.atan2(_,j)*180/Math.PI}#b(J){let Z=(this.#y(J)%360+360)%360;if(Z=this.#p(Z),this.min!==null||this.max!==null)this.angle=this.#P(this.#z(Z));else if(this.#J===null){this.#J=Z;let _=(this.#H(this.angle)%360+360)%360,X=Z-_;if(X>180)X-=360;if(X<-180)X+=360;this.angle=this.#P(this.angle+this.#z(X))}else{let j=Z-this.#J;if(j>180)j-=360;if(j<-180)j+=360;this.angle=this.#P(this.angle+this.#z(j)),this.#J=Z}if(this.#V(),this.setAttribute("value",String(this.angle)),this.#A(),this.text&&this.angleInput)this.angleInput.setAttribute("value",this.angle.toFixed(this.precision));this.#F(),this.#T(),this.#x()}#x(){this.dispatchEvent(new CustomEvent("input",{bubbles:!0,cancelable:!0,detail:{value:this.value,angle:this.angle}}))}#C(){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0,detail:{value:this.value,angle:this.angle}}))}#A(){if(this.handle){let Q=this.#H(this.angle)*Math.PI/180,Z=this.plane.offsetWidth/2-this.handle.offsetWidth/2,$=Math.cos(Q)*Z,j=Math.sin(Q)*Z;this.handle.style.transform=`translate(${$}px, ${j}px)`}}#d(J){if(this.#K()||J.button!==0)return;this.#E(),this.isDragging=!0,this.#J=null,this.#b(J);let Q=(j)=>{if(this.plane.classList.add("dragging"),this.isDragging)this.#b(j)},Z=new AbortController,$=(j=!1)=>{if(this.isDragging=!1,this.#J=null,this.plane.classList.remove("dragging"),Z.abort(),this.#q===Z)this.#q=null,this.#G=null;if(j)this.#C()};this.#q=Z,this.#G=$,window.addEventListener("mousemove",Q,{signal:Z.signal}),window.addEventListener("mouseup",()=>$(!0),{signal:Z.signal}),window.addEventListener("blur",()=>$(!1),{signal:Z.signal})}#m(J){if(this.#K())return;J.preventDefault(),this.#E(),this.isDragging=!0,this.#J=null,this.#b(J.touches[0]);let Q=(j)=>{if(this.plane.classList.add("dragging"),this.isDragging)this.#b(j.touches[0])},Z=new AbortController,$=(j=!1)=>{if(this.isDragging=!1,this.#J=null,this.plane.classList.remove("dragging"),Z.abort(),this.#q===Z)this.#q=null,this.#G=null;if(j)this.#C()};this.#q=Z,this.#G=$,window.addEventListener("touchmove",Q,{signal:Z.signal}),window.addEventListener("touchend",()=>$(!0),{signal:Z.signal}),window.addEventListener("touchcancel",()=>$(!1),{signal:Z.signal})}#E(){this.#G?.(!1),this.#q?.abort(),this.#q=null,this.#G=null,this.isDragging=!1,this.#J=null,this.plane?.classList.remove("dragging")}#S(J){if(this.#K())return;let Q=this.#W()*(J.shiftKey?10:1),Z=this.angle;if(J.key==="ArrowLeft"||J.key==="ArrowDown")Z-=Q;else if(J.key==="ArrowRight"||J.key==="ArrowUp")Z+=Q;else if(J.key==="Home")Z=this.min??this.#z(0);else if(J.key==="End")Z=this.max??this.#z(360);else return;J.preventDefault(),J.stopPropagation(),this.#L(Z),this.#x(),this.#C()}#jJ(J){if(J.key==="Shift")this.isShiftHeld=!0}#w(J){if(J.key==="Shift")this.isShiftHeld=!1}focus(){this.plane?.focus()}static get observedAttributes(){return["value","precision","text","min","max","units","dial","rotations","show-rotations","disabled","aria-label","name"]}get value(){return this.angle}get adjacent(){return this.#Z}get opposite(){return this.#$}set value(J){if(isNaN(J)){console.error("Invalid value: must be a number.");return}this.#L(Number(J))}attributeChangedCallback(J,Q,Z){switch(J){case"value":if(this.isDragging)break;if(Z!==null)this.#L(Number(Z),{reflect:!1});break;case"precision":this.precision=parseInt(Z);break;case"text":if(Z!==Q){if(this.text=Z?.toLowerCase()==="true",this.isConnected)this.#O(),this.#R(),this.#A()}break;case"dial":if(this.dial=this.#k("dial",!0),this.isConnected)this.#O(),this.#R(),this.#A();break;case"units":{let $=Z||"°";if($==="deg")$="°";if(this.units=$,this.isConnected)this.#O(),this.#R(),this.#A();break}case"min":if(this.min=Z!==null?Number(Z):null,this.#L(this.angle),this.isConnected)this.#O(),this.#R(),this.#A();break;case"max":if(this.max=Z!==null?Number(Z):null,this.#L(this.angle),this.isConnected)this.#O(),this.#R(),this.#A();break;case"disabled":if(this.#E(),this.isConnected)this.#O(),this.#R(),this.#A();break;case"aria-label":case"name":if(this.isConnected)this.#O(),this.#R(),this.#A();break;case"rotations":case"show-rotations":if(this.showRotations=this.#U(),this.isConnected)this.#O(),this.#R(),this.#A();break}}}L("fig-input-angle",yJ);class c extends HTMLElement{static observedAttributes=["axis","handle","disabled"];static#Z=6;static#$=['[draggable]:not([draggable="false"])','img:not([draggable="false"])','a[href]:not([draggable="false"])','input[type="range"]',"fig-handle","fig-slider","fig-input-number","fig-input-gradient","fig-easing-curve","fig-input-angle","fig-input-wheel","fig-joystick","fig-origin-grid","fig-canvas-control","propskit-color-point","propskit-number","propskit-point-point","propskit-point-radius","propskit-point-radius-angle","propskit-position","propskit-slider","propskit-oscillator"];#J=null;#Q=new Map;#_=null;#j=null;#Y=null;connectedCallback(){if(this.style.display="contents",!this.hasAttribute("role"))this.setAttribute("role","list");if(!this.hasAttribute("aria-label"))this.setAttribute("aria-label","Reorderable list");this.#T(),this.#G(),this.#J=new MutationObserver(()=>this.#G()),this.#J.observe(this,{childList:!0})}disconnectedCallback(){this.#J?.disconnect(),this.#J=null,this.#C(),this.#A(),this.#p(),this.#Y?.remove(),this.#Y=null}attributeChangedCallback(){if(this.isConnected){if(this.#B)this.#A();this.#G()}}get#B(){return this.hasAttribute("disabled")&&this.getAttribute("disabled")!=="false"}get#M(){return(this.getAttribute("axis")||"vertical").trim().toLowerCase()==="horizontal"?"horizontal":"vertical"}get#X(){return(this.getAttribute("handle")||"").trim()}#q(){return[...this.children].filter((J)=>J.nodeType===Node.ELEMENT_NODE&&!J.hasAttribute("data-reorder-live"))}#G(){let J=this.#q(),Q=new Set(J);for(let[Z,$]of this.#Q)if(!Q.has(Z))$.target.removeEventListener("pointerdown",$.onPointerDown,!0),$.target.removeEventListener("keydown",$.onKeyDown),this.#L($),this.#Q.delete(Z);if(this.#U(J),this.#O(J),this.#B||J.length<2){this.#C();return}for(let Z of J){let $=this.#K(Z),j=this.#Q.get(Z);if(j&&j.target===$)continue;if(j)j.target.removeEventListener("pointerdown",j.onPointerDown,!0),this.#Q.delete(Z);if(!$)continue;this.#P(Z,$)}this.#N(J),this.#k(J)}#O(J){for(let Q of J)if(Q.removeAttribute("data-reorder-item"),Q.hasAttribute("data-reorder-generated-role"))Q.removeAttribute("role"),Q.removeAttribute("data-reorder-generated-role")}#k(J){for(let Q of J)if(Q.setAttribute("data-reorder-item",""),!Q.hasAttribute("role"))Q.setAttribute("role","listitem"),Q.setAttribute("data-reorder-generated-role","")}#U(J){for(let Q of J)Q.querySelectorAll("[data-reorder-handle]").forEach((Z)=>{Z.removeAttribute("data-reorder-handle"),Z.removeAttribute("aria-roledescription")})}#N(J){if(!this.#X)return;for(let Q of J){let Z=Q.querySelector(this.#X);if(Z)Z.setAttribute("data-reorder-handle",""),Z.setAttribute("aria-roledescription","reorder handle")}}#K(J){if(this.#X)return J.querySelector(this.#X);return J}#P(J,Q){let Z=(B)=>{if(this.#B||this.#q().length<2)return;if(B.button!==0)return;if(!this.#X&&this.#W(B.target,J))return;this.#f(B,J,Q)},$=Q.getAttribute("tabindex"),j=Q.getAttribute("aria-label"),_=Q.getAttribute("role"),X=J.getAttribute("aria-label")||J.textContent?.trim().replace(/\s+/g," ").slice(0,80)||"item";if(Q.setAttribute("tabindex","0"),Q.setAttribute("aria-label",`Move ${X}`),Q!==J&&!Q.hasAttribute("role"))Q.setAttribute("role","button");let q=(B)=>{if(this.#B)return;let Y=this.#M==="horizontal",G=Y?"ArrowLeft":"ArrowUp",M=Y?"ArrowRight":"ArrowDown";if(B.key!==G&&B.key!==M&&B.key!=="Home"&&B.key!=="End")return;B.preventDefault(),B.stopPropagation();let k=this.#q(),U=k.indexOf(J),P=U;if(B.key===G)P=Math.max(0,U-1);else if(B.key===M)P=Math.min(k.length-1,U+1);else if(B.key==="Home")P=0;else if(B.key==="End")P=k.length-1;if(P===U){this.#F(`${X}, position ${U+1} of ${k.length}`);return}this.#b(J,P),this.#G(),this.#K(J)?.focus(),this.dispatchEvent(new CustomEvent("reorder",{bubbles:!0,detail:{oldIndex:U,newIndex:P,item:J}})),this.#F(`${X}, position ${P+1} of ${k.length}`)};Q.addEventListener("pointerdown",Z,!0),Q.addEventListener("keydown",q),this.#Q.set(J,{target:Q,onPointerDown:Z,onKeyDown:q,originalTabIndex:$,originalAriaLabel:j,originalRole:_})}#L(J){let{target:Q,originalTabIndex:Z,originalAriaLabel:$,originalRole:j}=J;if(Z===null)Q.removeAttribute("tabindex");else Q.setAttribute("tabindex",Z);if($===null)Q.removeAttribute("aria-label");else Q.setAttribute("aria-label",$);if(j===null)Q.removeAttribute("role");else Q.setAttribute("role",j)}#T(){if(this.#Y?.isConnected)return;let J=document.createElement("span");J.setAttribute("data-reorder-live",""),J.setAttribute("role","status"),J.setAttribute("aria-live","polite"),J.setAttribute("aria-atomic","true"),Object.assign(J.style,{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:"0"}),this.#Y=J,document.body.appendChild(J)}#F(J){if(!this.#Y)return;this.#Y.textContent="",requestAnimationFrame(()=>{if(this.#Y)this.#Y.textContent=J})}#W(J,Q){let Z=J;while(Z&&Z!==Q){if(Z instanceof Element){for(let $ of c.#$)if(Z.matches($))return!0}Z=Z.parentElement}return!1}static#H="fig-reorder-dragging";static#z(J){document.body.classList.toggle(c.#H,J)}#f(J,Q,Z){this.#A();let $={item:Q,target:Z,pointerId:J.pointerId,oldIndex:this.#q().indexOf(Q),targetIndex:this.#q().indexOf(Q),startX:J.clientX,startY:J.clientY,active:!1,onMove:null,onUp:null,onKeyDown:null};$.onMove=(j)=>{if(j.pointerId!==$.pointerId)return;let _=j.clientX-$.startX,X=j.clientY-$.startY;if(!$.active){if(_*_+X*X<c.#Z*c.#Z)return;$.active=!0,J.preventDefault(),J.stopPropagation(),Q.classList.add("dragging"),c.#z(!0);try{Z.setPointerCapture($.pointerId)}catch{}}j.preventDefault();let q=this.#M==="horizontal"?j.clientX:j.clientY,B=this.#R(q);$.targetIndex=B,this.#V(B,Q)},$.onKeyDown=(j)=>{if(j.key!=="Escape"||!$.active)return;j.preventDefault(),this.#x($,!0)},$.onUp=(j)=>{if(j.pointerId!==$.pointerId)return;this.#x($,j.type==="pointercancel")},this.#_=$,window.addEventListener("pointermove",$.onMove),window.addEventListener("pointerup",$.onUp),window.addEventListener("pointercancel",$.onUp),window.addEventListener("keydown",$.onKeyDown)}#R(J){let Q=this.#q(),Z=this.#M==="horizontal";for(let $=0;$<Q.length;$++){let j=Q[$].getBoundingClientRect(),_=Z?j.left+j.width/2:j.top+j.height/2;if(J<_)return $}return Q.length}#D(J,Q){let Z=this.#q(),$=Z.indexOf(J);if($===-1)return!1;let j=Math.max(0,Math.min(Q,Z.length));if(Q===$)return!1;if(j>=Z.length&&$===Z.length-1)return!1;return!0}#h(J){if(!J.length)return null;let Q=1/0,Z=-1/0,$=1/0,j=-1/0;for(let _ of J){let X=_.getBoundingClientRect();Q=Math.min(Q,X.left),Z=Math.max(Z,X.right),$=Math.min($,X.top),j=Math.max(j,X.bottom)}return{left:Q,top:$,width:Z-Q,height:j-$}}#I(){if(this.#j)return this.#j;let J=document.createElement("div");return J.className="fig-reorder-indicator",J.setAttribute("data-axis",this.#M),document.body.appendChild(J),this.#j=J,J}#V(J,Q){let Z=this.#q();if(!this.#D(Q,J)){this.#p();return}let $=this.#h(Z);if(!$){this.#p();return}let j=this.#I();if(j.setAttribute("data-axis",this.#M),this.#M==="horizontal"){let X;if(J<=0)X=Z[0].getBoundingClientRect().left;else if(J>=Z.length)X=Z[Z.length-1].getBoundingClientRect().right;else X=Z[J].getBoundingClientRect().left;j.style.left=`${X-1}px`,j.style.top=`${$.top}px`,j.style.width="2px",j.style.height=`${$.height}px`;return}let _;if(J<=0)_=Z[0].getBoundingClientRect().top;else if(J>=Z.length)_=Z[Z.length-1].getBoundingClientRect().bottom;else _=Z[J].getBoundingClientRect().top;j.style.left=`${$.left}px`,j.style.top=`${_-1}px`,j.style.width=`${$.width}px`,j.style.height="2px"}#p(){this.#j?.remove(),this.#j=null}#y(J,Q){let Z=this.#q(),$=Math.max(0,Math.min(Q,Z.length));if($>=Z.length){if(Z[Z.length-1]!==J)this.appendChild(J);return}let j=Z[$];if(j!==J)this.insertBefore(J,j)}#b(J,Q){let $=this.#q().filter((j)=>j!==J)[Q]??null;if($)this.insertBefore(J,$);else this.appendChild(J)}#x(J,Q){let{item:Z,oldIndex:$,active:j,onMove:_,onUp:X,onKeyDown:q}=J;if(window.removeEventListener("pointermove",_),window.removeEventListener("pointerup",X),window.removeEventListener("pointercancel",X),window.removeEventListener("keydown",q),j){if(!Q){this.#y(Z,J.targetIndex);let B=this.#q().indexOf(Z);if(B!==-1&&B!==$){this.dispatchEvent(new CustomEvent("reorder",{bubbles:!0,detail:{oldIndex:$,newIndex:B,item:Z}}));let Y=Z.getAttribute("aria-label")||Z.textContent?.trim().replace(/\s+/g," ").slice(0,80)||"item";this.#F(`${Y}, position ${B+1} of ${this.#q().length}`)}}}if(Z.classList.remove("dragging"),c.#z(!1),this.#p(),this.#_===J)this.#_=null}#C(){for(let[,J]of this.#Q)J.target.removeEventListener("pointerdown",J.onPointerDown,!0),J.target.removeEventListener("keydown",J.onKeyDown),this.#L(J);this.#Q.clear()}#A(){if(!this.#_)return;this.#x(this.#_,!0)}}L("fig-reorder",c);
1
+ function P(J,Q){if(!customElements.get(J))customElements.define(J,Q)}function O(J,Q){return J.hasAttribute(Q)&&J.getAttribute(Q)!=="false"}var OJ="http://www.w3.org/2000/svg";function YJ(J,Q){let Z=($)=>{if($===null||$===void 0||$===!1)return;if(Array.isArray($)){$.forEach(Z);return}J.append($ instanceof Node?$:String($))};return Z(Q),J}function GJ(J,Q={}){for(let[Z,$]of Object.entries(Q)){if($===null||$===void 0||$===!1)continue;if(Z==="className")if(J.namespaceURI===OJ)J.setAttribute("class",String($));else J.className=String($);else if($===!0)J.setAttribute(Z,"");else J.setAttribute(Z,String($))}return J}function G(J,Q,Z){let $=document.createElement(J);return GJ($,Q),YJ($,Z)}function h(J,Q,Z){let $=document.createElementNS(OJ,J);return GJ($,Q),YJ($,Z)}function n(J,Q){let Z=O(J,"disabled");for(let $ of Q)$?.toggleAttribute("disabled",Z)}function wJ(J,Q,Z){let $=Number(Q),j=Number(Z),_=Number.isFinite($)?Math.max(0,Math.min(1,$)):Number.isFinite(j)?Math.max(0,Math.min(100,j))/100:1,X=Number.isFinite(j)?Math.max(0,Math.min(100,j)):Math.round(_*100);return{color:J,alpha:_,opacity:X}}var $J=new WeakMap;function W(J){let Q=$J.get(J);if(!Q){let Z=document.createElement("fig-menu");Z.setAttribute("position","bottom left"),Z.setAttribute("offset","0 0");let $=document.createElement("fig-menu-item");$.setAttribute("value","reset-default"),$.textContent="Reset",Z.appendChild($);let j=0,_=()=>{if(j)clearTimeout(j),j=0;window.removeEventListener("pointerup",X,!0),window.removeEventListener("pointercancel",X,!0)},X=()=>{_();let Y=Q?.point;if(Y)Z.showAt?.(Y.x,Y.y)};Q={menu:Z,point:null,clearPendingOpen:_,handleContextMenu:(Y)=>{if(O(J,"disabled")||Y.target?.closest?.("fig-menu"))return;Y.preventDefault(),Y.stopPropagation(),Y.stopImmediatePropagation?.(),Q.point={x:Y.clientX,y:Y.clientY},_(),window.addEventListener("pointerup",X,{once:!0,capture:!0}),window.addEventListener("pointercancel",X,{once:!0,capture:!0}),j=window.setTimeout(X,180)},handleChange:(Y)=>{if(Y.stopPropagation(),Y.detail?.value==="reset-default")J.resetToDefault?.()}},$J.set(J,Q)}if(Q.menu.parentElement!==J)J.appendChild(Q.menu);J.removeEventListener("contextmenu",Q.handleContextMenu),J.addEventListener("contextmenu",Q.handleContextMenu),Q.menu.removeEventListener("change",Q.handleChange),Q.menu.addEventListener("change",Q.handleChange)}function R(J){let Q=$J.get(J);if(!Q)return;Q.clearPendingOpen(),J.removeEventListener("contextmenu",Q.handleContextMenu),Q.menu.removeEventListener("change",Q.handleChange)}function pJ(J,Q=J.value){let Z={control:J.localName,value:Q},$=J.getAttribute("name");if($!==null&&$!=="")Z.name=$;return Z}function K(J,Q,Z=J.value,$=null){let j=pJ(J,Z);if($&&typeof $==="object")Object.assign(j,$);J.dispatchEvent(new CustomEvent(Q,{detail:j,bubbles:!0,cancelable:!0,composed:!0}))}function d(J){if(J===null||J===void 0||String(J).trim()==="")return null;let Q=Number(J);return Number.isFinite(Q)?Q:null}function D(J){for(let Q of["input","change"])K(J,Q)}function c(J,Q){if(typeof J==="boolean"||typeof Q==="boolean")return Boolean(J)===Boolean(Q);return String(J??"")===String(Q??"")}function u(J,Q){let Z=($)=>{if(Array.isArray($))return $.map(Z);if($&&typeof $==="object")return Object.keys($).sort().reduce((j,_)=>{return j[_]=Z($[_]),j},{});return $};try{let $=typeof J==="string"?JSON.parse(J):J,j=typeof Q==="string"?JSON.parse(Q):Q;return JSON.stringify(Z($))===JSON.stringify(Z(j))}catch{return c(J,Q)}}function gJ(J,Q,Z=0.179){if(!J||!Q)return null;let $=document.createElement("span");$.style.cssText="position:absolute;visibility:hidden;pointer-events:none;color:"+Q,J.appendChild($);let j=getComputedStyle($).color;$.remove();let _=j.match(/[\d.]+/g)?.slice(0,3).map(Number),X=j.startsWith("rgb")?_:j.startsWith("color(srgb")&&_?_.map((k)=>k*255):null;if(!X||X.length<3||X.some(Number.isNaN))return null;let[q,B,Y]=X.map((k)=>{let N=k/255;return N<=0.04045?N/12.92:((N+0.055)/1.055)**2.4});return 0.2126*q+0.7152*B+0.0722*Y<=Z?"light":"dark"}var BJ=0;function MJ(J="fig-lab"){return BJ+=1,`${J}-${BJ}`}class S extends HTMLElement{get name(){return this.getAttribute("name")??""}set name(J){if(J===null||J===void 0||J==="")this.removeAttribute("name");else this.setAttribute("name",String(J))}}function f(J,Q,Z,$=!1){if(!Q||!Z)return null;let j=J.hasAttribute("label"),_=J.getAttribute("label")??"",X=j&&_.trim()==="";if(!$)Z.textContent=j?_:"Label";if(J.toggleAttribute("data-label-empty",X),X)return Z.remove(),null;if(!Z.id)Z.id=MJ(`${J.localName}-label`);if(Z.parentElement!==Q)Q.prepend(Z);return Z.id}function H(J,Q,Z,$="Label"){if(!Q)return;let j=J.getAttribute("aria-label")?.trim();if(j)Q.setAttribute("aria-label",j),Q.removeAttribute("aria-labelledby");else if(Z)Q.setAttribute("aria-labelledby",Z),Q.removeAttribute("aria-label");else Q.setAttribute("aria-label",$),Q.removeAttribute("aria-labelledby")}class kJ extends HTMLElement{}P("fig-ai-prompt",kJ);class NJ extends HTMLElement{}P("fig-ai-context",NJ);class PJ extends HTMLElement{}P("fig-chat-message",PJ);class LJ extends HTMLElement{#$=null;#Z=null;#J=null;#Q=null;#_=null;#j=null;#B=this.#U.bind(this);#q=this.#K.bind(this);#M=this.#P.bind(this);static get observedAttributes(){return["src","name","value","removable","disabled"]}connectedCallback(){if(!this.#Z)this.#X();this.#_.removeEventListener("click",this.#B),this.#_.addEventListener("click",this.#B),this.#O(),this.#Y()}disconnectedCallback(){this.#_?.removeEventListener("click",this.#B),this.#G()}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;this.#Y()}#X(){this.#$=document.createElement("fig-tooltip"),this.#$.className="fig-attachment-tooltip",this.#Z=document.createElement("fig-image"),this.#Z.setAttribute("aspect-ratio","1/1"),this.#Z.setAttribute("fit","cover"),this.#Z.setAttribute("full",""),this.#J=document.createElement("span"),this.#J.className="fig-attachment-fallback",this.#J.setAttribute("aria-hidden","true"),this.#Q=document.createElement("fig-tooltip"),this.#Q.className="fig-attachment-remove-tooltip",this.#Q.setAttribute("text","Remove attachment"),this.#_=document.createElement("fig-button"),this.#_.className="fig-attachment-remove",this.#_.setAttribute("variant","overlay"),this.#_.setAttribute("size","small"),this.#_.setAttribute("icon","");let J=document.createElement("fig-icon");J.setAttribute("name","close"),J.setAttribute("size","small"),this.#_.append(J),this.#Q.append(this.#_),this.#Z.append(this.#J),this.#$.append(this.#Z),this.replaceChildren(this.#$,this.#Q),this.#_.addEventListener("click",this.#B),this.#O()}#O(){let J=this.#Z?.mediaEl;if(!J||J===this.#j)return;this.#G(),this.#j=J,this.#j.addEventListener("load",this.#q),this.#j.addEventListener("error",this.#M)}#G(){if(!this.#j)return;this.#j.removeEventListener("load",this.#q),this.#j.removeEventListener("error",this.#M),this.#j=null}#Y(){let J=this.getAttribute("src")||"",Q=this.getAttribute("name")||"Attachment",Z=!this.hasAttribute("removable")||O(this,"removable"),$=O(this,"disabled");if(this.#$.setAttribute("text",Q),this.#Z.setAttribute("alt",Q),J)this.#Z.setAttribute("src",J);else this.#Z.removeAttribute("src");if(this.#O(),this.#J.textContent=this.#k(Q),this.#_.hidden=!Z,this.#_.toggleAttribute("disabled",$),this.#_.setAttribute("aria-label",`Remove ${Q}`),this.toggleAttribute("data-fallback",!J),$)this.setAttribute("aria-disabled","true");else this.removeAttribute("aria-disabled")}#k(J){let Q=J.split(/[\\/]/).pop()||"",Z=Q.lastIndexOf(".");return(Z>0&&Z<Q.length-1?Q.slice(Z+1).toUpperCase():"FILE").slice(0,4)}#K(){if(this.getAttribute("src"))this.removeAttribute("data-fallback")}#P(){this.setAttribute("data-fallback","")}#U(J){if(J.stopPropagation(),O(this,"disabled")||this.hasAttribute("removable")&&!O(this,"removable"))return;this.dispatchEvent(new CustomEvent("remove",{bubbles:!0,cancelable:!0,composed:!0,detail:{value:this.getAttribute("value"),name:this.getAttribute("name")||"",src:this.getAttribute("src")||"",attachment:this}}))}}P("fig-attachment",LJ);class UJ extends HTMLElement{#$=null;connectedCallback(){if(!this.hasAttribute("role"))this.setAttribute("role","list"),this.setAttribute("data-generated-role","");if(this.#Z(),!this.#$)this.#$=new MutationObserver(()=>this.#Z()),this.#$.observe(this,{childList:!0})}disconnectedCallback(){this.#$?.disconnect(),this.#$=null}#Z(){for(let J of this.querySelectorAll(":scope > fig-attachment"))if(!J.hasAttribute("role"))J.setAttribute("role","listitem"),J.setAttribute("data-generated-role","")}}P("fig-attachments",UJ);class KJ extends S{#$=null;#Z=null;#J=null;#Q=!1;#_=null;#j=new Set;#B=null;#q=null;#M=this.#T.bind(this);#X=!1;static get observedAttributes(){return["label","aria-label","variant"]}connectedCallback(){if(!this.#$)this.#O();if(this.#k(),this.#P(),this.#U(),this.removeEventListener("click",this.#M),this.addEventListener("click",this.#M),W(this),!this.#_)this.#_=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="aria-label")Q=!0;else Z=!0}if(Q)this.#k();if(Z)this.#P()});this.#_.observe(this,{attributes:!0})}disconnectedCallback(){this.#_?.disconnect(),this.#N(),this.removeEventListener("click",this.#M),R(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#$)return;if(J==="variant")this.#P();else if(J==="label"||J==="aria-label")this.#k()}#O(){this.#X=O(this,"checked");let Q=Array.from(this.childNodes).filter((j)=>j.nodeType!==Node.TEXT_NODE||Boolean(j.textContent?.trim())).find((j)=>j.nodeType===Node.ELEMENT_NODE&&j.matches("label")),Z=G("div",{className:"propskit-switch-surface"}),$=Q||document.createElement("label");Z.append($),this.#$=Z,this.#Z=$,this.#Q=Boolean(Q),this.replaceChildren(Z),this.#Y()}#G(){return this.getAttribute("variant")==="segmented-control"?"segmented-control":"switch"}#Y(){let J=this.#G()==="segmented-control"?"fig-segmented-control":"fig-switch";if(this.#J?.localName===J)return;this.#N(),this.#J?.remove();let Q=document.createElement(J);if(J==="fig-segmented-control"){let Z=document.createElement("fig-segment"),$=document.createElement("fig-segment");Q.setAttribute("sizing","equal"),Z.setAttribute("value","off"),Z.textContent="Off",$.setAttribute("value","on"),$.textContent="On",Q.append(Z,$)}if(this.#J=Q,this.#j.clear(),this.#$?.append(Q),this.isConnected)this.#U()}#k(){let J=f(this,this.#$,this.#Z,this.#Q);if(H(this,this.#J,J,"Switch"),this.#J?.localName==="fig-switch"&&this.#J.input)H(this,this.#J.input,J,"Switch")}#K(){let J=new Set(["label","direction","size","aria-label","oninput","onchange","class","style","id","checked","value","default","variant"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#P(){if(this.#Y(),!this.#J)return;let J=this.#K(),Q=new Set(J);for(let $ of this.#j)if(!Q.has($))this.#J.removeAttribute($);for(let $ of J)this.#J.setAttribute($,this.getAttribute($)??"");let Z=O(this,"checked");if(this.#J.localName==="fig-switch")this.#J.checked=Z,this.#J.value=Z?"on":"off";else this.#J.setAttribute("value",Z?"on":"off");this.#j=Q,this.#k()}#U(){if(!this.#J)return;this.#B??=this.#L.bind(this,"input"),this.#q??=this.#L.bind(this,"change"),this.#J.addEventListener("input",this.#B),this.#J.addEventListener("change",this.#q)}#N(){if(!this.#J)return;if(this.#B)this.#J.removeEventListener("input",this.#B);if(this.#q)this.#J.removeEventListener("change",this.#q)}#L(J,Q){if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let Z=this.#J?.localName==="fig-switch"?Boolean(this.#J.checked):this.#J?.value==="on";this.toggleAttribute("checked",Z),K(this,J)}#T(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-switch, fig-segmented-control, fig-menu"))return;if(this.#J?.localName==="fig-switch")this.#J.click();else{let Q=this.#J?.value==="on"?"off":"on";this.#J?.querySelector(`fig-segment[value="${Q}"]`)?.click()}}get checked(){if(!this.#J)return O(this,"checked");return this.#J.localName==="fig-switch"?Boolean(this.#J.checked):this.#J.value==="on"}set checked(J){let Q=Boolean(J);if(this.toggleAttribute("checked",Q),!this.#J)return;if(this.#J.localName==="fig-switch")this.#J.checked=Q,this.#J.value=Q?"on":"off";else this.#J.value=Q?"on":"off"}get value(){return this.checked}set value(J){let Q=typeof J==="string"?!["","false","off","0"].includes(J.trim().toLowerCase()):Boolean(J);this.checked=Q}get defaultValue(){return this.hasAttribute("default")?O(this,"default"):this.#X}get isDefault(){return this.checked===this.defaultValue}resetToDefault(){let J=this.defaultValue;this.checked=J,D(this)}focus(J){if(this.#J?.localName==="fig-switch")this.#J.focus(J);else(this.#J?.querySelector("fig-segment[selected]")||this.#J?.querySelector("fig-segment"))?.focus(J)}}P("propskit-switch",KJ);function s(J){let Q=String(J??"").trim();if(/^#[0-9a-fA-F]{8}$/.test(Q))return{color:Q.slice(0,7),alpha:parseInt(Q.slice(7,9),16)/255};if(/^#[0-9a-fA-F]{6}$/.test(Q))return{color:Q,alpha:1};if(/^#[0-9a-fA-F]{3}$/.test(Q))return{color:`#${Q[1]}${Q[1]}${Q[2]}${Q[2]}${Q[3]}${Q[3]}`,alpha:1};return{color:Q||"#D9D9D9",alpha:1}}function cJ(J){let{color:Q,alpha:Z}=s(J);return JSON.stringify({type:"solid",color:Q,alpha:Z})}function ZJ(J){return`url("${String(J).replace(/\\/g,"\\\\").replace(/"/g,"\\\"")}")`}function mJ(J){let Q=String(J??"").trim();if(!Q||Q.startsWith("{")||Q.startsWith("#"))return!1;if(Q.startsWith("data:video/"))return!0;try{let Z=new URL(Q,"https://fig.local").pathname;return/\.(mp4|webm|mov|m4v|ogv)$/i.test(Z)}catch{return/\.(mp4|webm|mov|m4v|ogv)(?:[?#]|$)/i.test(Q)}}function uJ(J){return{type:"video",video:{url:J,scaleMode:"fill",scale:50}}}function v(J){if(J&&typeof J==="object")return J;let Q=String(J??"").trim();if(!Q)return{type:"solid",color:"#D9D9D9",alpha:1};if(Q.startsWith("{"))try{let Z=JSON.parse(Q);if(Z&&typeof Z==="object")return Z}catch{}if(Q.startsWith("#")){let{color:Z,alpha:$}=s(Q);return{type:"solid",color:Z,alpha:$}}if(mJ(Q))return uJ(Q);return{type:"solid",color:"#D9D9D9",alpha:1}}function i(J){if(J==null)return"";return typeof J==="string"?J:JSON.stringify(J)}function vJ(J){if(!J)return"";let Q=[...J.stops||[]].sort((Z,$)=>(Z.position??0)-($.position??0)).map((Z)=>`${Z.color} ${Z.position??0}%`).join(", ");if(!Q)return"";switch(J.type){case"radial":return`radial-gradient(circle, ${Q})`;case"angular":return`conic-gradient(from ${J.angle||0}deg, ${Q})`;default:return`linear-gradient(${J.angle??180}deg, ${Q})`}}function qJ(J,Q){switch(J?.type){case"solid":return J.color||"";case"gradient":return J.css||vJ(J.gradient)||"";case"image":return J.image?.url?ZJ(J.image.url):"";case"video":return J.video?.poster?ZJ(J.video.poster):"";case"webcam":return J.webcam?.snapshot?ZJ(J.webcam.snapshot):"";default:return J?.swatchBackground||J?.background||J?.css||Q?.getAttribute("swatch-background")||""}}function sJ(J){if(!J||typeof J!=="object")return null;if(J.type==="image")return J.image;if(J.type==="video")return J.video;if(J.type==="webcam")return J.webcam;return null}function oJ(J){let Q=sJ(J),Z=Number(Q?.scale);switch(Q?.scaleMode){case"fit":return{size:"contain",position:"center"};case"tile":return{size:`${Number.isFinite(Z)?Z:50}%`,position:"top left"};case"fill":case"crop":return{size:"cover",position:"center"};default:return J?.type==="webcam"||J?.type==="image"||J?.type==="video"?{size:"cover",position:"center"}:null}}function rJ(J){switch(J?.type){case"solid":{if(Number.isFinite(J.alpha))return J.alpha;if(Number.isFinite(J.opacity))return J.opacity/100;return 1}case"gradient":return J.gradient?.opacity??J.opacity??1;case"image":return J.image?.opacity??1;case"video":return J.video?.opacity??1;case"webcam":return J.webcam?.opacity??1;default:return J?.opacity??J?.alpha??1}}class SJ extends S{#$=null;#Z=null;#J=null;#Q=null;#_=!1;#j=null;#B=new Set;#q=null;#M=null;#X=this.#H.bind(this);#O=null;static get observedAttributes(){return["label","aria-label"]}connectedCallback(){if(!this.#$)this.#G();if(this.#Y(),this.#U(),this.#N(),this.#O===null)this.#O=this.getAttribute("default")??this.getAttribute("value")??"";if(this.removeEventListener("click",this.#X),this.addEventListener("click",this.#X),W(this),!this.#j)this.#j=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="aria-label")Q=!0;else if($.attributeName==="direction")continue;else Z=!0}if(Q)this.#Y();if(Z)this.#U()});this.#j.observe(this,{attributes:!0})}disconnectedCallback(){this.#j?.disconnect(),this.#L(),this.removeEventListener("click",this.#X),R(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#$)return;if(J==="label"||J==="aria-label")this.#Y()}#G(){let J=Array.from(this.childNodes).filter((X)=>X.nodeType!==Node.TEXT_NODE||Boolean(X.textContent?.trim())),Q=J.find((X)=>X.nodeType===Node.ELEMENT_NODE&&X.matches("label")),Z=G("div",{className:"propskit-color-surface"}),$=Q||document.createElement("label"),j=document.createElement("fig-fill-picker"),_=document.createElement("fig-swatch");j.anchorElement=this,j.append(_),_.setAttribute("tabindex","0");for(let X of J)if(X!==Q)j.appendChild(X);Z.append($,j),this.#$=Z,this.#Z=$,this.#J=j,this.#Q=_,this.#_=Boolean(Q),this.replaceChildren(Z)}#Y(){if(!this.#$||!this.#Z||!this.#J)return;let J=f(this,this.#$,this.#Z,this.#_);H(this,this.#J,J,"Color")}#k(){return s(this.getAttribute("value"))}#K(){let{color:J,alpha:Q}=this.#k();return JSON.stringify({type:"solid",color:J,alpha:Q})}#P(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","text","default","value","mode","variant"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#U(){if(!this.#J)return;let J=this.#P(),Q=new Set(J);for(let _ of this.#B)if(!Q.has(_))this.#J.removeAttribute(_);for(let _ of J)this.#J.setAttribute(_,this.getAttribute(_)??"");this.#J.setAttribute("mode","solid");let Z=this.#K();if(this.#J.getAttribute("value")!==Z)this.#J.setAttribute("value",Z);let{color:$,alpha:j}=this.#k();if(this.#Q)this.#Q.setAttribute("background",$),this.#Q.setAttribute("alpha",String(j));this.#B=Q}#N(){if(!this.#J)return;this.#q??=this.#W.bind(this,"input"),this.#M??=this.#W.bind(this,"change"),this.#J.addEventListener("input",this.#q),this.#J.addEventListener("change",this.#M)}#L(){if(!this.#J)return;if(this.#q)this.#J.removeEventListener("input",this.#q);if(this.#M)this.#J.removeEventListener("change",this.#M)}#T(J){let Q=J instanceof CustomEvent&&J.detail!==void 0?J.detail:void 0;if(typeof Q==="string"&&Q)return s(Q).color;if(Q&&typeof Q==="object"){if(typeof Q.color==="string"&&Q.color)return Q.color;if(typeof Q.value==="string"&&Q.value)return s(Q.value).color;if(typeof Q.hex==="string"&&Q.hex)return Q.hex}let Z=this.#J?.value;if(Z&&typeof Z==="object"&&typeof Z.color==="string")return Z.color;if(typeof Z==="string"&&Z)return s(Z).color;return this.#k().color}#F(J,Q){let Z=J instanceof CustomEvent&&J.detail&&typeof J.detail==="object"?J.detail:void 0,$=Number.isFinite(Z?.alpha)?Math.max(0,Math.min(1,Number(Z.alpha))):this.#k().alpha;return{color:Q,alpha:$,opacity:Math.round($*100)}}#W(J,Q){if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let Z=this.#T(Q),$=this.#F(Q,Z),j=$.alpha<0.996078431372549?Math.round($.alpha*255).toString(16).padStart(2,"0"):"",_=`${$.color.slice(0,7)}${j}`;this.setAttribute("value",_);let X=this.#K();if(this.#J&&this.#J.getAttribute("value")!==X)this.#J.setAttribute("value",X);if(this.#Q)this.#Q.setAttribute("background",$.color),this.#Q.setAttribute("alpha",String($.alpha));K(this,J)}#H(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-menu"))return;if(J.target instanceof Element&&J.target.closest("fig-fill-picker, fig-swatch"))return;this.focus(),this.#J?.open?.()}get value(){return this.getAttribute("value")??this.#J?.value??this.#J?.getAttribute("value")??""}set value(J){if(J===null||J===void 0||J===""){this.removeAttribute("value"),this.#J?.removeAttribute("value");return}let Q=String(J);this.setAttribute("value",Q),this.#z(Q)}#z(J){if(!this.#J)return;let Q=cJ(J);if(this.#J.getAttribute("value")===Q)this.#J.removeAttribute("value");if(this.#J.setAttribute("value",Q),this.#Q){let Z=s(J);this.#Q.setAttribute("background",Z.color),this.#Q.setAttribute("alpha",String(Z.alpha))}}#V(){return this.getAttribute("default")??this.#O??""}get defaultValue(){return String(this.#V())}get isDefault(){return c(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.setAttribute("value",J),this.#z(J),D(this)}focus(J){let Q=this.querySelector("fig-swatch");if(Q instanceof HTMLElement)Q.focus(J)}}P("propskit-color",SJ);class TJ extends S{#$=null;#Z=null;#J=null;#Q=null;#_=!1;#j=null;#B=new Set;#q=null;#M=null;#X=this.#R.bind(this);#O=null;static get observedAttributes(){return["label","aria-label"]}connectedCallback(){if(!this.#$)this.#G();if(this.#Y(),this.#F(),this.#W(),this.#O===null)this.#O=this.getAttribute("default")??this.getAttribute("value")??"";if(this.removeEventListener("click",this.#X),this.addEventListener("click",this.#X),W(this),!this.#j)this.#j=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="aria-label")Q=!0;else if($.attributeName==="direction")continue;else Z=!0}if(Q)this.#Y();if(Z)this.#F()});this.#j.observe(this,{attributes:!0})}disconnectedCallback(){this.#j?.disconnect(),this.#H(),this.removeEventListener("click",this.#X),R(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#$)return;if(J==="label"||J==="aria-label")this.#Y()}#G(){let J=Array.from(this.childNodes).filter((X)=>X.nodeType!==Node.TEXT_NODE||Boolean(X.textContent?.trim())),Q=J.find((X)=>X.nodeType===Node.ELEMENT_NODE&&X.matches("label")),Z=G("div",{className:"propskit-fill-surface"}),$=Q||document.createElement("label"),j=document.createElement("fig-fill-picker"),_=document.createElement("fig-swatch");j.anchorElement=this,j.append(_),_.setAttribute("tabindex","0");for(let X of J)if(X!==Q)j.appendChild(X);Z.append($,j),this.#$=Z,this.#Z=$,this.#J=j,this.#Q=_,this.#_=Boolean(Q),this.replaceChildren(Z)}#Y(){if(!this.#$||!this.#Z||!this.#J)return;let J=f(this,this.#$,this.#Z,this.#_);H(this,this.#J,J,"Fill")}#k(){return v(this.getAttribute("value"))}#K(){return i(this.#k())}#P(){let J=this.#k()?.type;if(!J)return null;return this.querySelector(`[slot="mode-${J}"]`)}#U(){let J=this.#J?.value;if(J&&typeof J==="object")return J;if(typeof J==="string"&&J)return v(J);return null}#N(J){let Q=this.#U();if(!J||typeof J!=="object")return J;if(J.type!=="webcam")return J;let Z=J.webcam?.snapshot||Q?.webcam?.snapshot;if(!Z||J.webcam?.snapshot)return J;return{...J,webcam:{...Q?.webcam&&typeof Q.webcam==="object"?Q.webcam:{},...J.webcam,snapshot:Z}}}#L(J=this.#k()){if(!this.#Q)return;let Q=this.#N(J),Z=qJ(Q,this.#P());if(!Z)Z=qJ(this.#U(),this.#P());if(!Z){let j=this.#Q.getAttribute("background")??"";if(j.startsWith("url("))Z=j}this.#Q.setAttribute("background",Z),this.#Q.setAttribute("alpha",String(rJ(Q)));let $=oJ(Q||J);if($)this.#Q.style.setProperty("--swatch-bg-size",$.size),this.#Q.style.setProperty("--swatch-bg-position",$.position)}#T(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","text","default","value","variant"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#F(){if(!this.#J)return;let J=this.#T(),Q=new Set(J);for(let $ of this.#B)if(!Q.has($))this.#J.removeAttribute($);for(let $ of J)this.#J.setAttribute($,this.getAttribute($)??"");let Z=this.#K();if(this.#J.getAttribute("value")!==Z)this.#J.setAttribute("value",Z);this.#L(),this.#B=Q}#W(){if(!this.#J)return;this.#q??=this.#V.bind(this,"input"),this.#M??=this.#V.bind(this,"change"),this.#J.addEventListener("input",this.#q),this.#J.addEventListener("change",this.#M)}#H(){if(!this.#J)return;if(this.#q)this.#J.removeEventListener("input",this.#q);if(this.#M)this.#J.removeEventListener("change",this.#M)}#z(J){let Q=J instanceof CustomEvent&&J.detail!==void 0?J.detail:void 0;if(Q&&typeof Q==="object")return Q;if(typeof Q==="string"&&Q)return v(Q);let Z=this.#J?.value;if(Z&&typeof Z==="object")return Z;if(typeof Z==="string"&&Z)return v(Z);return this.#k()}#V(J,Q){if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let Z=this.#N(this.#z(Q)),$=i(Z);if(this.setAttribute("value",$),this.#J&&this.#J.getAttribute("value")!==$)this.#J.setAttribute("value",$);this.#L(Z),K(this,J)}#R(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-menu"))return;if(J.target instanceof Element&&J.target.closest("fig-fill-picker, fig-swatch"))return;this.focus(),this.#J?.open?.()}get value(){return this.getAttribute("value")??i(this.#J?.value)??""}set value(J){if(J===null||J===void 0||J===""){this.removeAttribute("value"),this.#J?.removeAttribute("value"),this.#L({type:"solid",color:"",alpha:1});return}let Q=i(typeof J==="string"?v(J):J);this.setAttribute("value",Q),this.#y(Q)}#y(J){if(!this.#J)return;let Q=i(v(J));if(this.#J.getAttribute("value")===Q)this.#J.removeAttribute("value");this.#J.setAttribute("value",Q),this.#L(v(Q))}#h(){return this.getAttribute("default")??this.#O??""}get defaultValue(){return String(this.#h())}get isDefault(){return u(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.setAttribute("value",J),this.#y(J),D(this)}focus(J){let Q=this.querySelector("fig-swatch");if(Q instanceof HTMLElement)Q.focus(J)}}P("propskit-fill",TJ);class FJ extends S{#$=null;#Z=null;#J=null;#Q=!1;#_=null;#j=new Set;#B=null;#q=null;#M=this.#L.bind(this);#X=null;static get observedAttributes(){return["label","aria-label"]}connectedCallback(){if(!this.#$)this.#O();if(this.#G(),this.#k(),this.#K(),this.#X===null)this.#X=this.getAttribute("default")??this.getAttribute("value")??JSON.stringify(this.#J?.value??{});if(this.removeEventListener("click",this.#M),this.addEventListener("click",this.#M),W(this),!this.#_)this.#_=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="aria-label")Q=!0;else if($.attributeName==="direction")continue;else Z=!0}if(Q)this.#G();if(Z)this.#k()});this.#_.observe(this,{attributes:!0})}disconnectedCallback(){this.#_?.disconnect(),this.#P(),this.removeEventListener("click",this.#M),R(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#$)return;if(J==="label"||J==="aria-label")this.#G()}#O(){let Q=Array.from(this.childNodes).filter((_)=>_.nodeType!==Node.TEXT_NODE||Boolean(_.textContent?.trim())).find((_)=>_.nodeType===Node.ELEMENT_NODE&&_.matches("label")),Z=G("div",{className:"propskit-gradient-surface"}),$=Q||document.createElement("label"),j=document.createElement("fig-input-gradient");j.anchorElement=this,Z.append($,j),this.#$=Z,this.#Z=$,this.#J=j,this.#Q=Boolean(Q),this.replaceChildren(Z)}#G(){if(!this.#$||!this.#Z||!this.#J)return;let J=f(this,this.#$,this.#Z,this.#Q);H(this,this.#J,J,"Gradient")}#Y(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","default","variant"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#k(){if(!this.#J)return;let J=this.#Y(),Q=new Set(J);for(let Z of this.#j)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J){let $=this.getAttribute(Z)??"";if(Z==="value"&&this.#J.getAttribute("value")===$)continue;this.#J.setAttribute(Z,$)}if(!this.hasAttribute("edit"))this.#J.setAttribute("edit","picker");this.#j=Q}#K(){if(!this.#J)return;this.#B??=this.#N.bind(this,"input"),this.#q??=this.#N.bind(this,"change"),this.#J.addEventListener("input",this.#B),this.#J.addEventListener("change",this.#q)}#P(){if(!this.#J)return;if(this.#B)this.#J.removeEventListener("input",this.#B);if(this.#q)this.#J.removeEventListener("change",this.#q)}#U(J){let Q=J instanceof CustomEvent&&J.detail&&typeof J.detail==="object"?J.detail:this.#J?.value;if(!Q||typeof Q!=="object")return this.value;return JSON.stringify(Q)}#N(J,Q){if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let Z=this.#U(Q);this.setAttribute("value",Z),K(this,J)}#L(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-menu"))return;if(J.target instanceof Element&&J.target.closest("fig-input-gradient, fig-fill-picker, fig-swatch"))return;this.focus(),this.#J?.querySelector?.("fig-fill-picker")?.open?.()}get value(){return this.getAttribute("value")??JSON.stringify(this.#J?.value??{})}set value(J){if(J===null||J===void 0||J===""){this.removeAttribute("value"),this.#J?.removeAttribute("value");return}let Q=typeof J==="object"?JSON.stringify(J):String(J);if(this.setAttribute("value",Q),this.#J&&this.#J.getAttribute("value")!==Q)this.#J.setAttribute("value",Q)}get defaultValue(){return this.getAttribute("default")??this.#X??""}get isDefault(){return u(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;if(!J)return;this.value=J,D(this)}focus(J){this.#J?.focus(J)}}P("propskit-gradient",FJ);class jJ extends S{#$=null;#Z=null;#J=null;#Q=[];#_=!1;#j=null;#B=[];#q=void 0;#M=!1;#X=0;#O=null;#G=null;#Y=null;#k=null;#K=this.#u.bind(this);#P=this.#c.bind(this);#U=!1;static get observedAttributes(){return["label","aria-label","options","value","disabled"]}connectedCallback(){if(!this.#$)this.#N(),this.#B=this.#L(this.value);if(this.#D(),this.#f(),this.#w(),this.removeEventListener("click",this.#K),this.addEventListener("click",this.#K),this.removeEventListener("pointerdown",this.#P,!0),this.addEventListener("pointerdown",this.#P,!0),W(this),!this.#j)this.#j=new MutationObserver((J)=>{if(J.some(({type:Q,attributeName:Z})=>Q==="attributes"&&Z&&!jJ.observedAttributes.includes(Z)&&!["label","name","options","value","default","size","variant","class","style","id"].includes(Z)&&!Z.startsWith("data-")))this.#f()});this.#j.observe(this,{attributes:!0})}disconnectedCallback(){this.#j?.disconnect(),this.#x(),this.removeEventListener("click",this.#K),this.removeEventListener("pointerdown",this.#P,!0),R(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#$)return;if(this.#M&&J==="value")return;if(J==="label"||J==="aria-label")this.#D();else if(J==="options")this.#V();else if(J==="value")this.#h();else if(J==="disabled")this.#f()}#N(){let J=this.querySelector(":scope > label"),Q=G("div",{className:"propskit-palette-surface"}),Z=J||document.createElement("label"),$=document.createElement("fig-select"),j=this.#H([]);j.setAttribute("slot","trigger"),j.setAttribute("data-propskit-palette-trigger",""),j.hidden=!0,$.setAttribute("full",""),$.setAttribute("subtle",""),$.append(j),Q.append(Z,$),this.#$=Q,this.#Z=Z,this.#J=$,this.#O=j,this.#_=Boolean(J),this.replaceChildren(Q),this.#V()}#L(J){if(!Array.isArray(J))return[];return J.map((Q)=>({...Q}))}#T(J){let Q=document.createElement("fig-input-palette");if(typeof J==="string")Q.setAttribute("value",J);else Q.setAttribute("value",JSON.stringify(J??[]));return this.#L(Q.value)}#F(J){return JSON.stringify(this.#T(J))}#W(){try{let J=JSON.parse(this.getAttribute("options")||"[]");if(!Array.isArray(J))return[];return J.filter((Q)=>Array.isArray(Q)).map((Q)=>this.#T(Q))}catch{return[]}}#H(J){let Q=document.createElement("fig-input-palette");return Q.className="propskit-palette-preview",Q.setAttribute("value",JSON.stringify(J)),Q.setAttribute("fixed",""),Q.setAttribute("disabled",""),Q.setAttribute("full",""),Q.setAttribute("aria-hidden","true"),Q}#z(J){if(!this.#O)return;this.#O.setAttribute("value",JSON.stringify(J)),this.#O.hidden=!J.length}#V(){if(!this.#J)return;let J=++this.#X;this.#Q=this.#W();let Q=document.createElement("fig-select-options");Q.setAttribute("slot","panel"),Q.className="propskit-palette-options",this.#Q.forEach((Z,$)=>{let j=document.createElement("fig-select-option"),_=document.createElement("span");j.setAttribute("value",String($)),j.setAttribute("label",`Palette ${$+1}`),j.setAttribute("aria-label",`Palette ${$+1}`),_.setAttribute("slot","prepend"),_.className="propskit-palette-option-preview",_.append(this.#H(Z)),j.append(_),Q.append(j)}),this.#M=!0,this.#J.replaceChildren(this.#O,Q),this.#h(),queueMicrotask(()=>{if(J!==this.#X)return;this.#h(),this.#M=!1})}#R(J){let Q=this.#T(J);return this.#Q.findIndex((Z)=>u(Z,Q))}#y(J){let Q=this.#F(J);if(this.getAttribute("value")===Q)return;let Z=this.#M;this.#M=!0,this.setAttribute("value",Q),this.#M=Z}#h(){if(!this.#J)return;if(!this.#Q.length){this.#J.removeAttribute("value"),this.#z([]);let $=this.#M;this.#M=!0,this.removeAttribute("value"),this.#M=$;return}let J=this.hasAttribute("value")?this.getAttribute("value"):this.#Q[0],Q=this.#R(J),Z=Q>=0?Q:0;this.#J.setAttribute("value",String(Z)),this.#y(this.#Q[Z]),this.#z(this.#Q[Z])}#D(){if(!this.#$||!this.#Z||!this.#J)return;let J=f(this,this.#$,this.#Z,this.#_);H(this,this.#J,J,"Palette"),this.#J.setAttribute("label",this.getAttribute("aria-label")||this.#Z.textContent?.trim()||"Palette"),this.#J.setAttribute("full","")}#f(){if(!this.#J)return;this.#J.toggleAttribute("disabled",O(this,"disabled"));for(let J of["position","offset","closedby"])if(this.hasAttribute(J))this.#J.setAttribute(J,this.getAttribute(J)??"");else this.#J.removeAttribute(J)}#w(){if(!this.#J)return;this.#G??=this.#A.bind(this,"input"),this.#Y??=this.#A.bind(this,"change"),this.#k??=this.#A.bind(this,"optionhover"),this.#J.addEventListener("input",this.#G),this.#J.addEventListener("change",this.#Y),this.#J.addEventListener("optionhover",this.#k)}#x(){if(!this.#J)return;if(this.#G)this.#J.removeEventListener("input",this.#G);if(this.#Y)this.#J.removeEventListener("change",this.#Y);if(this.#k)this.#J.removeEventListener("optionhover",this.#k)}#I(J){return this.#L(this.#Q[J]??[])}#C(J,Q){this.#q=Q;try{K(this,J,Q)}finally{this.#q=void 0}}#A(J,Q){if(Q.target!==this.#J)return;if(Q.stopImmediatePropagation(),this.#M||O(this,"disabled"))return;let Z=J==="optionhover"&&Q instanceof CustomEvent?Q.detail:this.#J.getAttribute("value"),$=this.#I(Number(Z));if(J!=="optionhover")this.#y($),this.#z($);this.#C(J,$)}#E(){if(!this.#J)return!1;if(this.#J.open)return!0;let J=this.#J.shadowRoot?.querySelector('dialog[is="fig-popup"]');return Boolean(J?.open||J?.matches?.(":open"))}#c(J){if(!(J.target instanceof Element))return;if(J.target.closest("fig-menu"))return;if(J.target.closest("fig-select")){this.#U=!1;return}this.#U=this.#E()}#u(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-menu, fig-select")){this.#U=!1;return}if(!this.#J||O(this.#J,"disabled")){this.#U=!1;return}if(this.#J.focus(),this.#U||this.#E()){this.#U=!1,this.#J.open=!1;return}this.#J.open=!0}get value(){if(this.#q!==void 0)return this.#q;let J=Number(this.#J?.getAttribute("value"));if(Number.isInteger(J)&&J>=0)return this.#I(J);if(this.hasAttribute("value"))return this.#T(this.getAttribute("value"));return[]}set value(J){if(J===null||J===void 0){this.removeAttribute("value");return}this.setAttribute("value",this.#F(J))}get defaultValue(){if(this.hasAttribute("default"))return this.#T(this.getAttribute("default"));return this.#L(this.#B)}get isDefault(){return u(this.value,this.defaultValue)}resetToDefault(){this.value=this.defaultValue;for(let J of["input","change"])this.#C(J,this.value)}focus(J){this.#J?.focus(J)}}P("propskit-palette",jJ);class zJ extends S{#$=null;#Z=null;#J=null;#Q=!1;#_=null;#j=new Set;#B=null;#q=null;#M=null;#X=this.#z.bind(this);#O=this.#H.bind(this);#G=!1;#Y=void 0;#k=null;static get observedAttributes(){return["label","aria-label","options","value"]}connectedCallback(){if(!this.#$)this.#K();if(this.#P(),this.#N(),this.#L(),this.removeEventListener("click",this.#X),this.addEventListener("click",this.#X),this.removeEventListener("pointerdown",this.#O,!0),this.addEventListener("pointerdown",this.#O,!0),W(this),!this.#_)this.#_=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;let j=$.attributeName;if(j==="label"||j==="aria-label")Q=!0;else if(j==="direction")continue;else Z=!0}if(Q)this.#P();if(Z)this.#N()});this.#_.observe(this,{attributes:!0})}disconnectedCallback(){this.#_?.disconnect(),this.#T(),this.removeEventListener("click",this.#X),this.removeEventListener("pointerdown",this.#O,!0),R(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#$)return;if(J==="label"||J==="aria-label"){this.#P();return}if(J==="options"||J==="value")this.#N()}#K(){this.#k=this.getAttribute("value")??"";let J=this.querySelector(":scope > label"),Q=this.querySelector(":scope > fig-select-options"),Z=G("div",{className:"propskit-select-surface"}),$=J||document.createElement("label"),j=document.createElement("fig-select");if(j.setAttribute("full",""),Q)j.append(Q);Z.append($,j),this.#$=Z,this.#Z=$,this.#J=j,this.#Q=Boolean(J),this.replaceChildren(Z)}#P(){if(!this.#$||!this.#Z||!this.#J)return;let J=f(this,this.#$,this.#Z,this.#Q);H(this,this.#J,J,"Select"),this.#J.setAttribute("label",this.getAttribute("aria-label")||this.#Z.textContent?.trim()||"Select"),this.#J.setAttribute("full","")}#U(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","full","default","variant"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#N(){if(!this.#J)return;let J=this.#U().sort((Z,$)=>{if(Z==="options")return-1;if($==="options")return 1;if(Z==="value")return 1;if($==="value")return-1;return 0}),Q=new Set(J);for(let Z of this.#j)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#j=Q}#L(){if(!this.#J)return;this.#B??=this.#F.bind(this,"input"),this.#q??=this.#F.bind(this,"change"),this.#J.addEventListener("input",this.#B),this.#J.addEventListener("change",this.#q),this.#M??=this.#F.bind(this,"optionhover"),this.#J.addEventListener("optionhover",this.#M)}#T(){if(!this.#J)return;if(this.#B)this.#J.removeEventListener("input",this.#B);if(this.#q)this.#J.removeEventListener("change",this.#q);if(this.#M)this.#J.removeEventListener("optionhover",this.#M)}#F(J,Q){if(Q.target!==this.#J)return;if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let Z=this.#J?.value??"";if(J!=="optionhover")this.setAttribute("value",String(Z));let $=J==="optionhover"&&Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:this.value;if(J==="optionhover")this.#Y=$;try{K(this,J,$)}finally{this.#Y=void 0}}#W(){if(!this.#J)return!1;if(this.#J.open)return!0;let J=this.#J.shadowRoot?.querySelector('dialog[is="fig-popup"]');return Boolean(J?.open||J?.matches?.(":open"))}#H(J){if(!(J.target instanceof Element))return;if(J.target.closest("fig-menu"))return;if(J.target.closest("fig-select")){this.#G=!1;return}this.#G=this.#W()}#z(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-menu"))return;if(J.target instanceof Element&&J.target.closest("fig-select")){this.#G=!1;return}if(!this.#J||O(this.#J,"disabled")){this.#G=!1;return}if(this.#J.focus(),this.#G||this.#W()){this.#G=!1,this.#J.open=!1;return}this.#J.open=!0}get value(){return this.#Y??this.#J?.value??this.getAttribute("value")??""}set value(J){if(J===null||J===void 0)this.removeAttribute("value");else this.setAttribute("value",String(J))}get defaultValue(){return this.getAttribute("default")??this.#k??""}get isDefault(){return c(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;if(this.value=J,this.#J)this.#J.value=J;D(this)}focus(J){this.#J?.focus(J)}}P("propskit-select",zJ);class _J extends S{static observedAttributes=["options","value","default","aria-label","disabled"];#$=null;#Z=null;#J=null;#Q=null;#_=null;#j=null;#B="";#q="";#M=void 0;#X=!1;#O=!1;#G=null;#Y=null;#k=0;#K=new Set;#P=null;#U=this.#BJ.bind(this,"input");#N=this.#BJ.bind(this,"change");#L=this.#BJ.bind(this,"optionhover");#T=this.#t.bind(this);#F=this.#r.bind(this);#W=this.#QJ.bind(this);#H=this.#kJ.bind(this);#z=this.#qJ.bind(this);#V=this.#MJ.bind(this);#R=this.#a.bind(this);#y=this.#n.bind(this);#h=this.#XJ.bind(this);#D=(J)=>J.stopImmediatePropagation();connectedCallback(){if(!this.#$)this.#f();if(this.#E(),this.#jJ(),W(this),!this.#G)this.#G=new MutationObserver((J)=>{if(J.some((Q)=>Q.type==="attributes"&&Q.attributeName!=="direction"&&Q.attributeName!=="aria-disabled"&&!Q.attributeName?.startsWith("data-")&&!_J.observedAttributes.includes(Q.attributeName)))this.#c()});this.#G.observe(this,{attributes:!0})}disconnectedCallback(){this.#G?.disconnect(),this.#p(),R(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#$)return;if(J==="value"&&this.#X)return;if(J==="disabled"){this.#b();return}this.#E()}#f(){this.#q=this.#I(this.getAttribute("value"));let J=G("div",{className:"propskit-editable-select-surface"}),Q=G("fig-select",{subtle:!0}),Z=G("fig-select-options",{className:"propskit-editable-select-options",slot:"panel"});Q.append(Z);let $=this.#w("propskit-editable-select-edit","Edit item","edit"),j=this.#w("propskit-editable-select-add","Add item","add"),_=G("fig-tooltip",{className:"propskit-editable-select-edit-tooltip",text:"Edit item"},$),X=G("fig-tooltip",{className:"propskit-editable-select-add-tooltip",text:"Add item"},j);J.append(Q,_,X),this.#$=J,this.#Z=Q,this.#J=Z,this.#_=$,this.#j=j,this.replaceChildren(J),this.#C(this.#q)}#w(J,Q,Z){return G("fig-button",{className:J,variant:"secondary",icon:!0,"aria-label":Q},G("fig-icon",{name:Z,size:"medium","aria-hidden":"true"}))}#x(J=this.getAttribute("options")){let Q=J;if(typeof J==="string"){let j=J.trim();if(j.startsWith("["))try{Q=JSON.parse(j)}catch{Q=[]}else{let _=j.includes(`
2
+ `)?`
3
+ `:",";Q=j.split(_).map((X)=>X.trim()).filter(Boolean)}}if(!Array.isArray(Q))return[];let Z=new Set,$=[];for(let j of Q){let _=j&&typeof j==="object"&&!Array.isArray(j),X=_?j.value??j.label??"":j,q=_?j.label??j.value??"":j,B=String(X??"").trim(),Y=String(q??"").trim();if(!B||Z.has(B))continue;Z.add(B),$.push({value:B,label:Y||B})}return $}#I(J){let Q=this.#x(),Z=String(J??"").trim();if(Z&&Q.some(($)=>$.value===Z))return Z;return Q[0]?.value||""}#C(J){let Q=this.#I(J),Z=this.getAttribute("value");this.#X=!0;try{if(Q){if(Z!==Q)this.setAttribute("value",Q)}else if(Z!==null)this.removeAttribute("value")}finally{this.#X=!1}if(this.#Z)this.#Z.value=Q;return Q}#A(){let J=new Set(["options","value","default","disabled","name","label","aria-label","aria-disabled","direction","oninput","onchange","onoptionhover","class","style","id","size","variant","full","subtle","data-editing"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#E(){let J=this.#C(this.getAttribute("value"));if(this.#Q&&(!this.#B||J!==this.#B))this.#e(!1);this.#c(),this.#b()}#c(){if(!this.#Z)return;let J=this.#A(),Q=new Set(J);for(let $ of this.#K)if(!Q.has($))this.#Z.removeAttribute($);for(let $ of J)this.#Z.setAttribute($,this.getAttribute($)??"");this.#K=Q,this.#u();let Z=this.getAttribute("aria-label")?.trim()||"Select item";this.#Z.setAttribute("label",Z),this.#Z.setAttribute("aria-label",Z),this.#Z.setAttribute("subtle",""),this.#Z.setAttribute("options",JSON.stringify(this.options)),this.#Z.value=this.#I(this.getAttribute("value"))}#u(){if(!this.#J)return;let J=this.options,Q=JSON.stringify(J);if(Q===this.#P)return;this.#P=Q;for(let $ of this.#J.querySelectorAll(":scope > fig-select-option"))$.remove();let Z=this.#J.querySelector(":scope > .fig-overflow-end");for(let $ of J){let j=G("fig-select-option",{value:$.value,label:$.label,"aria-label":`${$.label}. Press Delete to remove this item.`}),_=G("span",{className:"propskit-editable-select-option-label"},$.label),X=G("fig-button",{className:"propskit-editable-select-delete",variant:"ghost",icon:!0,"aria-label":`Delete ${$.label}`,"aria-hidden":"true","data-value":$.value},G("fig-icon",{name:"trash",size:"small","aria-hidden":"true"})),q=G("fig-tooltip",{className:"propskit-editable-select-delete-tooltip",slot:"append",text:`Delete ${$.label}`},X);if(j.append(_,q),Z)this.#J.insertBefore(j,Z);else this.#J.append(j);let B=X.button||X.shadowRoot?.querySelector("button, [role='button']");if(B instanceof HTMLElement)B.inert=!0,B.style.pointerEvents="none"}}#b(){if(!this.#Z||!this.#_||!this.#j)return;let J=O(this,"disabled"),Q=this.options.length<=1;this.setAttribute("aria-disabled",String(J)),this.#Z.toggleAttribute("disabled",J||Q),this.#Q?.toggleAttribute("disabled",J);for(let Z of this.#J?.querySelectorAll(".propskit-editable-select-delete")||[])Z.toggleAttribute("disabled",J||Q);this.#j.toggleAttribute("disabled",J||Boolean(this.#Q)),this.#_.toggleAttribute("disabled",J||!this.#Q&&!this.value)}#S(){if(!this.#_)return;let J=Boolean(this.#Q);this.toggleAttribute("data-editing",J),this.#_.setAttribute("aria-label",J?"Save item":"Edit item"),this.#_.closest("fig-tooltip")?.setAttribute("text",J?"Save item":"Edit item"),this.#_.setAttribute("variant",J?"primary":"secondary"),this.#_.querySelector("fig-icon")?.setAttribute("name",J?"checkmark":"edit"),this.#b()}#jJ(){if(this.#p(),this.#Z?.addEventListener("input",this.#U),this.#Z?.addEventListener("change",this.#N),this.#Z?.addEventListener("optionhover",this.#L),this.#_?.addEventListener("click",this.#T),this.#j?.addEventListener("click",this.#F),this.#J?.addEventListener("pointerdown",this.#H),this.#J?.addEventListener("click",this.#z),this.#J?.addEventListener("keydown",this.#V),this.addEventListener("click",this.#W),this.#m()?.addEventListener("toggle",this.#R),this.#i(),!this.#Y&&typeof ResizeObserver==="function")this.#Y=new ResizeObserver(()=>{if(this.#Z?.open)this.#s()});if(this.#$)this.#Y?.observe(this.#$)}#p(){this.#Z?.removeEventListener("input",this.#U),this.#Z?.removeEventListener("change",this.#N),this.#Z?.removeEventListener("optionhover",this.#L),this.#_?.removeEventListener("click",this.#T),this.#j?.removeEventListener("click",this.#F),this.#J?.removeEventListener("pointerdown",this.#H),this.#J?.removeEventListener("click",this.#z),this.#J?.removeEventListener("keydown",this.#V),this.removeEventListener("click",this.#W),this.#m()?.removeEventListener("toggle",this.#R),this.#Y?.disconnect(),this.#Y=null,cancelAnimationFrame(this.#k),this.#k=0}#m(){return this.#Z?.shadowRoot?.querySelector('dialog[is="fig-popup"]')}#i(){let J=this.#m();if(!J||J.__propskitEditableSelectPositioning||typeof J.positionPopup!=="function")return;let Q=J.positionPopup.bind(J);J.positionPopup=(...Z)=>{let $=Q(...Z);return this.#s(),$},J.__propskitEditableSelectPositioning=!0}#a(J){if(J.newState==="open"||this.#Z?.open)this.#s()}#s(){cancelAnimationFrame(this.#k),this.#k=requestAnimationFrame(()=>{this.#g(),this.#k=requestAnimationFrame(()=>{this.#k=0,this.#g()})})}#g(){let J=this.#m();if(!J||!this.#$||!this.#Z?.open)return;let Q=this.#$.getBoundingClientRect();if(!Q.width)return;J.style.setProperty("box-sizing","border-box","important"),J.style.setProperty("left",`${Q.left}px`,"important"),J.style.setProperty("width",`${Q.width}px`,"important"),J.style.setProperty("min-width",`${Q.width}px`,"important"),J.style.setProperty("max-width",`${Q.width}px`,"important")}#BJ(J,Q){if(Q.target!==this.#Z)return;if(Q.stopImmediatePropagation(),this.#O)return;if(O(this,"disabled"))return;let Z=J==="optionhover"&&Q instanceof CustomEvent?String(Q.detail??""):this.#C(this.#Z.value);this.#o(J,Z)}#o(J,Q=this.value){let Z=String(Q??""),$=this.options.find((j)=>j.value===Z)?.label||"";this.#M=Z;try{K(this,J,Z,{label:$})}finally{this.#M=void 0}}#t(J){if(J.preventDefault(),J.stopPropagation(),O(this,"disabled"))return;if(this.#Q)this.#OJ();else this.#NJ()}#QJ(J){if(this.#Q||!this.#Z||O(this,"disabled")||O(this.#Z,"disabled")||J.target instanceof Element&&J.target.closest(".propskit-editable-select-edit, .propskit-editable-select-add, fig-menu"))return;if(J.target instanceof Element&&J.target.closest("fig-select"))return;J.preventDefault(),this.#Z.open=!0}#r(J){if(J.preventDefault(),J.stopPropagation(),O(this,"disabled")||this.#Q)return;let Q=this.options,Z=`item-${Q.length}`;this.options=[...Q,{value:Z,label:"New item"}],this.#C(Z),this.#c();for(let $ of["input","change"])this.#o($);this.#NJ()}#kJ(J){if(!(J.target instanceof Element)||!J.target.closest(".propskit-editable-select-delete"))return;J.preventDefault(),J.stopPropagation()}#qJ(J){if(!(J.target instanceof Element))return;let Q=J.target.closest(".propskit-editable-select-delete");if(!Q||!this.#J?.contains(Q))return;if(J.preventDefault(),J.stopPropagation(),J.stopImmediatePropagation(),O(this,"disabled")||O(Q,"disabled"))return;this.#_J(Q.getAttribute("data-value")||"")}#MJ(J){if(J.key!=="Delete"&&J.key!=="Backspace"||J.altKey||J.ctrlKey||J.metaKey||J.shiftKey||!(J.target instanceof Element))return;let Q=J.target.closest("fig-select-option");if(!Q||Q.parentElement!==this.#J)return;J.preventDefault(),J.stopImmediatePropagation(),this.#_J(Q.getAttribute("value")||"")}#_J(J){if(!this.#Z||!this.#J||O(this,"disabled"))return;let Q=this.options;if(Q.length<=1)return;let Z=Q.findIndex((B)=>B.value===J);if(Z<0)return;let $=this.#Z.open,j=this.value,_=Q.filter((B)=>B.value!==J),X=Math.min(Z,_.length-1),q=j===J?_[Math.max(0,X)]?.value||"":j;this.#O=!0;try{if(q)this.#C(q);this.options=_,this.#C(q),this.#c()}finally{this.#O=!1}for(let B of["input","change"])this.#o(B);queueMicrotask(()=>{if(_.length>1){if($)this.#Z.open=!0;[...this.#J.querySelectorAll(":scope > fig-select-option")][Math.max(0,X)]?.focus()}else this.#Z.open=!1,requestAnimationFrame(()=>this.#j?.focus())})}#NJ(){if(!this.#$||!this.value||O(this,"disabled"))return;let J=this.options.find((Z)=>Z.value===this.value);if(!J)return;let Q=G("fig-input-text",{type:"text",full:!0,value:J.label,"aria-label":`Rename ${J.label}`});Q.addEventListener("input",this.#D),Q.addEventListener("change",this.#D),Q.addEventListener("keydown",this.#y),Q.addEventListener("focusout",this.#h),this.#B=J.value,this.#Q=Q,this.#Z.replaceWith(Q),this.#S(),queueMicrotask(()=>{Q.focus(),Q.input?.select?.()})}#n(J){if(J.key==="Enter")J.preventDefault(),J.stopImmediatePropagation(),this.#OJ();else if(J.key==="Escape")J.preventDefault(),J.stopImmediatePropagation(),this.#e()}#XJ(J){if(!this.#Q)return;let Q=J.relatedTarget;if(Q instanceof Node&&this.#Q.contains(Q))return;if(Q instanceof Node&&(Q===this.#_||this.#_?.contains(Q)||Q.getRootNode()instanceof ShadowRoot&&Q.getRootNode().host===this.#_))return;this.#OJ(!1)}#ZJ(J=!0){if(!this.#$||!this.#Z)return;let Q=this.#Q;if(this.#Q=null,this.#B="",Q?.parentElement===this.#$)Q.replaceWith(this.#Z);else if(this.#Z.parentElement!==this.#$)this.#$.prepend(this.#Z);if(this.#c(),this.#S(),J)queueMicrotask(()=>this.#Z?.focus())}#OJ(J=!0){if(!this.#Q||!this.#B)return;let Q=this.#B,Z=this.options,$=Z.findIndex((X)=>X.value===Q);if($<0){this.#e(J);return}let j=String(this.#Q.value??"").trim()||Z[$].label,_=j!==Z[$].label;if(this.#ZJ(!1),_)Z[$]={...Z[$],label:j},this.options=Z;if(this.#C(Q),this.#c(),_)for(let X of["input","change"])this.#o(X);if(J)queueMicrotask(()=>this.#Z?.focus())}#e(J=!0){this.#ZJ(J)}get options(){return this.#x()}set options(J){if(J===null||J===void 0){this.removeAttribute("options");return}this.setAttribute("options",JSON.stringify(this.#x(J)))}get value(){return this.#M??this.#I(this.getAttribute("value")??this.#Z?.value??"")}set value(J){this.#C(J),this.#c()}get defaultValue(){let J=this.hasAttribute("default")?this.getAttribute("default"):this.#q;return this.#I(J)}get isDefault(){return c(this.value,this.defaultValue)}get editing(){return Boolean(this.#Q)}resetToDefault(){this.#e(!1),this.value=this.defaultValue;for(let J of["input","change"])this.#o(J)}focus(J){if(O(this,"disabled"))return;if(this.#Q)this.#Q.focus(J);else this.#Z?.focus(J)}}P("propskit-editable-select",_J);class WJ extends S{#$=null;#Z=null;#J=null;#Q=!1;#_=null;#j=new Set;#B=null;#q=null;#M=this.#N.bind(this);#X=null;static get observedAttributes(){return["label","aria-label"]}connectedCallback(){if(!this.#$)this.#O();if(this.#G(),this.#k(),this.#K(),this.removeEventListener("click",this.#M),this.addEventListener("click",this.#M),W(this),!this.#_)this.#_=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="aria-label")Q=!0;else if($.attributeName==="direction")continue;else Z=!0}if(Q)this.#G();if(Z)this.#k()});this.#_.observe(this,{attributes:!0})}disconnectedCallback(){this.#_?.disconnect(),this.#P(),this.removeEventListener("click",this.#M),R(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#$)return;if(J==="label"||J==="aria-label")this.#G()}#O(){this.#X=this.getAttribute("value")??"";let J=Array.from(this.childNodes).filter((_)=>_.nodeType!==Node.TEXT_NODE||Boolean(_.textContent?.trim())),Q=J.find((_)=>_.nodeType===Node.ELEMENT_NODE&&_.matches("label")),Z=G("div",{className:"propskit-text-surface"}),$=Q||document.createElement("label"),j=document.createElement("fig-input-text");for(let _ of J)if(_!==Q)j.appendChild(_);Z.append($,j),this.#$=Z,this.#Z=$,this.#J=j,this.#Q=Boolean(Q),this.replaceChildren(Z)}#G(){if(!this.#$||!this.#Z||!this.#J)return;let J=f(this,this.#$,this.#Z,this.#Q);H(this,this.#J,J,"Text")}#Y(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","type","aria-label","multiline","autoresize","resizable","default","variant"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#k(){if(!this.#J)return;let J=this.#Y(),Q=["multiline","autoresize"],Z=new Set([...J,...Q,"type"]);for(let $ of this.#j)if(!Z.has($))this.#J.removeAttribute($);for(let $ of J)this.#J.setAttribute($,this.getAttribute($)??"");for(let $ of Q)this.#J.setAttribute($,this.getAttribute($)??"");this.#J.setAttribute("type","text"),this.#j=Z}#K(){if(!this.#J)return;this.#B??=this.#U.bind(this,"input"),this.#q??=this.#U.bind(this,"change"),this.#J.addEventListener("input",this.#B),this.#J.addEventListener("change",this.#q)}#P(){if(!this.#J)return;if(this.#B)this.#J.removeEventListener("input",this.#B);if(this.#q)this.#J.removeEventListener("change",this.#q)}#U(J,Q){if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let Z=this.#J?.value??"";this.setAttribute("value",String(Z)),K(this,J)}#N(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-text, fig-menu"))return;this.focus()}get value(){return this.#J?.value??this.getAttribute("value")??""}set value(J){if(J===null||J===void 0){if(this.removeAttribute("value"),this.#J)this.#J.value=""}else{let Q=String(J);if(this.setAttribute("value",Q),this.#J)this.#J.value=Q}}get defaultValue(){return this.getAttribute("default")??this.#X??""}get isDefault(){return c(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.value=J,D(this)}focus(J){this.#J?.focus(J)}}P("propskit-text",WJ);class HJ extends S{#$=null;#Z=null;#J=null;#Q=!1;#_=null;#j=new Set;#B=null;#q=null;#M=this.#L.bind(this);#X=this.#T.bind(this);#O=null;static get observedAttributes(){return["label","aria-label"]}connectedCallback(){if(!this.#$)this.#G();if(this.#Y(),this.#K(),this.#P(),this.removeEventListener("click",this.#M),this.addEventListener("click",this.#M),this.removeEventListener("keydown",this.#X),this.addEventListener("keydown",this.#X),W(this),!this.#_)this.#_=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="aria-label")Q=!0;else if($.attributeName==="direction")continue;else Z=!0}if(Q)this.#Y();if(Z)this.#K()});this.#_.observe(this,{attributes:!0})}disconnectedCallback(){this.#_?.disconnect(),this.#U(),this.removeEventListener("click",this.#M),this.removeEventListener("keydown",this.#X),R(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#$)return;if(J==="label"||J==="aria-label")this.#Y()}#G(){this.#O=this.getAttribute("value")??this.getAttribute("min")??"0";let J=Array.from(this.childNodes).filter((_)=>_.nodeType!==Node.TEXT_NODE||Boolean(_.textContent?.trim())),Q=J.find((_)=>_.nodeType===Node.ELEMENT_NODE&&_.matches("label")),Z=G("div",{className:"propskit-number-surface"}),$=Q||document.createElement("label"),j=document.createElement("fig-input-number");Z.append($,j),this.#$=Z,this.#Z=$,this.#J=j,this.#Q=Boolean(Q),this.replaceChildren(Z);for(let _ of J)if(_!==Q)j.appendChild(_)}#Y(){let J=f(this,this.#$,this.#Z,this.#Q);H(this,this.#J,J,"Number")}#k(){let J=new Set(["label","direction","size","aria-label","oninput","onchange","class","style","id","default","variant"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#K(){if(!this.#J)return;let J=this.#k(),Q=new Set(J);for(let Z of this.#j)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#j=Q}#P(){if(!this.#J)return;this.#B??=this.#N.bind(this,"input"),this.#q??=this.#N.bind(this,"change"),this.#J.addEventListener("input",this.#B),this.#J.addEventListener("change",this.#q)}#U(){if(!this.#J)return;if(this.#B)this.#J.removeEventListener("input",this.#B);if(this.#q)this.#J.removeEventListener("change",this.#q)}#N(J,Q){if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let Z=d(this.#J?.value);if(Z===null)this.removeAttribute("value");else this.setAttribute("value",String(Z));K(this,J)}#L(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number, fig-menu"))return;this.focus()}#T(J){if(!["ArrowUp","ArrowDown"].includes(J.key)||!(J.target instanceof Element)||!J.target.closest("fig-input-number"))return;J.stopPropagation();let Q=this.#J?.querySelector("input");queueMicrotask(()=>{if(this.isConnected&&!O(this,"disabled"))Q?.focus({preventScroll:!0})})}get value(){return d(this.#J?.value??this.getAttribute("value"))}set value(J){if(J===null||J===void 0||J===""){if(this.removeAttribute("value"),this.#J)this.#J.value=""}else{let Q=String(J);if(this.setAttribute("value",Q),this.#J)this.#J.value=Q}}get defaultValue(){return this.getAttribute("default")??this.#O??"0"}get isDefault(){return c(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.value=J,D(this)}focus(J){this.#J?.focus(J)}}P("propskit-number",HJ);class RJ extends S{static observedAttributes=["x","y","default","label","aria-label","units","disabled"];#$=null;#Z=null;#J=!1;#Q=null;#_=null;#j=null;#B=!1;#q=!1;#M=this.#z.bind(this,"input");#X=this.#z.bind(this,"change");#O=this.#V.bind(this);connectedCallback(){if(!this.#B)this.#j=this.#Y(),this.#K(this.#j),this.#B=!0;if(!this.#$)this.#U();this.#N(),this.#L(),this.#W(),this.removeEventListener("click",this.#O),this.addEventListener("click",this.#O),W(this)}disconnectedCallback(){this.#H(),this.removeEventListener("click",this.#O),R(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#B)return;if((J==="x"||J==="y")&&!this.#q)this.#L();else if(J==="label"||J==="aria-label")this.#N();else if(J==="units")this.#T();else if(J==="disabled")this.#F()}#G(J,Q=50){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#Y(){let J=this.getAttribute("x"),Q=this.getAttribute("y");return{x:J===null||!J.trim()?50:this.#G(J,50),y:Q===null||!Q.trim()?50:this.#G(Q,50)}}#k(J){if(typeof J!=="string"||!J.trim())return null;try{let Q=JSON.parse(J);if(!Q||typeof Q!=="object"||Array.isArray(Q))return null;return{x:this.#G(Q.x,this.#j?.x??50),y:this.#G(Q.y,this.#j?.y??50)}}catch{return null}}#K(J){let Q=this.#Y(),Z={x:this.#G(J?.x,Q.x),y:this.#G(J?.y,Q.y)};return this.#q=!0,this.setAttribute("x",String(Z.x)),this.setAttribute("y",String(Z.y)),this.#q=!1,Z}#P(J,Q){let Z=document.createElement("fig-input-number");if(Z.setAttribute("data-propskit-position-axis",J),Z.setAttribute("value",String(Q)),Z.setAttribute("min","0"),Z.setAttribute("max","100"),Z.setAttribute("step","1"),Z.setAttribute("precision","2"),this.units==="percent")Z.setAttribute("units","%");Z.setAttribute("aria-label",`${J.toUpperCase()} position`);let $=document.createElement("span");if($.setAttribute("slot","prepend"),$.textContent=J.toUpperCase(),Z.append($),O(this,"disabled"))Z.setAttribute("disabled","");return Z}#U(){let J=this.#Y(),Q=this.querySelector(":scope > label"),Z=G("div",{className:"propskit-position-surface",role:"group"}),$=Q||document.createElement("label"),j=this.#P("x",J.x),_=this.#P("y",J.y);Z.append($,j,_),this.#$=Z,this.#Z=$,this.#J=Boolean(Q),this.#Q=j,this.#_=_,this.replaceChildren(Z),W(this)}#N(){let J=f(this,this.#$,this.#Z,this.#J);H(this,this.#$,J,"Position")}#L(){let J=this.#Y();this.#Q?.setAttribute("value",String(J.x)),this.#_?.setAttribute("value",String(J.y)),this.#T(),this.#F()}#T(){let J=this.units==="percent"?"%":null;for(let Q of[this.#Q,this.#_]){if(!Q)continue;if(J)Q.setAttribute("units",J);else Q.removeAttribute("units")}}#F(){let J=O(this,"disabled");this.#Q?.toggleAttribute("disabled",J),this.#_?.toggleAttribute("disabled",J)}#W(){this.#H(),this.#Q?.addEventListener("input",this.#M),this.#Q?.addEventListener("change",this.#X),this.#_?.addEventListener("input",this.#M),this.#_?.addEventListener("change",this.#X)}#H(){this.#Q?.removeEventListener("input",this.#M),this.#Q?.removeEventListener("change",this.#X),this.#_?.removeEventListener("input",this.#M),this.#_?.removeEventListener("change",this.#X)}#z(J,Q){if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let Z=Q.currentTarget?.getAttribute("data-propskit-position-axis");if(Z!=="x"&&Z!=="y")return;let $=this.value;$[Z]=this.#G(Q.currentTarget.value,$[Z]),this.#K($),K(this,J)}#V(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number, fig-menu"))return;this.focus()}get x(){return this.#Y().x}set x(J){this.setAttribute("x",String(this.#G(J,50)))}get y(){return this.#Y().y}set y(J){this.setAttribute("y",String(this.#G(J,50)))}get units(){return this.getAttribute("units")?.trim().toLowerCase()==="percent"?"percent":"none"}set units(J){this.setAttribute("units",String(J).trim().toLowerCase()==="none"?"none":"percent")}get value(){return{...this.#Y()}}set value(J){let Q=this.#K(J);this.#L(Q)}get defaultValue(){return this.#k(this.getAttribute("default"))||{...this.#j||{x:50,y:50}}}get isDefault(){return u(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.value=J,D(this)}focus(J){this.#Q?.focus(J)}}P("propskit-position",RJ);class VJ extends S{static observedAttributes=["value","default","label","aria-label","axis-labels","coordinates","precision","disabled"];#$=null;#Z=null;#J=!1;#Q=null;#_=null;#j={x:50,y:50};#B=!1;#q=this.#W.bind(this,"input");#M=this.#W.bind(this,"change");connectedCallback(){if(!this.#$)this.#j=this.#O(this.getAttribute("value"),this.#j),this.#G(this.#j),this.#Y();this.#k(),this.#K(),this.#T(),this.#_?.observe(this.#Q,{childList:!0,subtree:!0}),W(this)}disconnectedCallback(){this.#F(),this.#_?.disconnect(),R(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#$)return;if(J==="value"&&!this.#B)this.#G(this.#O(Z,this.value)),this.#U();else if(J==="label"||J==="aria-label")this.#k();else if(J==="axis-labels"||J==="coordinates"||J==="precision")this.#P();else if(J==="disabled")this.#N()}#X(J,Q=50){let Z=Number(J);return Number.isFinite(Z)?Math.max(0,Math.min(100,Z)):Q}#O(J,Q={x:50,y:50}){let Z=J;if(typeof J==="string"){let $=J.trim();if(!$)return{...Q};try{Z=JSON.parse($)}catch{let j=$.split(/[\s,]+/).filter(Boolean),_=(X,q)=>{if(!X)return q;let B=Number.parseFloat(X.replace(/%/g,""));if(!Number.isFinite(B))return q;return X.includes("%")||Math.abs(B)>1?B:B*100};Z={x:_(j[0],Q.x),y:_(j[1]??j[0],Q.y)}}}if(!Z||typeof Z!=="object"||Array.isArray(Z))return{...Q};return{x:this.#X(Z.x,Q.x),y:this.#X(Z.y,Q.y)}}#G(J){let Q=this.#O(J,this.#j),Z=JSON.stringify(Q);if(this.getAttribute("value")!==Z)this.#B=!0,this.setAttribute("value",Z),this.#B=!1;return Q}#Y(){let J=this.querySelector(":scope > label"),Q=G("div",{className:"propskit-joystick-surface",role:"group"}),Z=J||document.createElement("label"),$=document.createElement("fig-joystick");$.setAttribute("fields","true"),$.setAttribute("aspect-ratio","1 / 1"),Q.append(Z,$),this.#$=Q,this.#Z=Z,this.#J=Boolean(J),this.#Q=$,this.replaceChildren(Q),this.#_=new MutationObserver(()=>this.#L()),this.#_.observe($,{childList:!0,subtree:!0})}#k(){let J=f(this,this.#$,this.#Z,this.#J);H(this,this.#Q,J,"Joystick"),this.#L()}#K(){this.#P(),this.#U(),this.#N()}#P(){if(!this.#Q)return;this.#Q.setAttribute("fields","true"),this.#Q.setAttribute("aspect-ratio","1 / 1");for(let J of["axis-labels","coordinates","precision"])if(this.hasAttribute(J))this.#Q.setAttribute(J,this.getAttribute(J)??"");else this.#Q.removeAttribute(J)}#U(){if(!this.#Q)return;let J=this.value,Q=`${J.x}% ${J.y}%`;if(this.#Q.getAttribute("value")!==Q)this.#Q.setAttribute("value",Q)}#N(){if(!this.#Q||!this.#$)return;let J=O(this,"disabled");this.#$.setAttribute("aria-disabled",String(J)),this.#Q.toggleAttribute("disabled",J),this.#Q.inert=J,this.#L()}#L(){if(!this.#Q)return;let J=O(this,"disabled"),Q=this.#Z?.isConnected?this.#Z.id:"",Z=this.getAttribute("aria-label")?.trim(),$=this.#Q.querySelector("fig-handle");if($)if($.toggleAttribute("disabled",J),Z)$.setAttribute("aria-label",Z),$.removeAttribute("aria-labelledby");else if(Q)$.setAttribute("aria-labelledby",Q),$.removeAttribute("aria-label");else $.setAttribute("aria-label","Joystick"),$.removeAttribute("aria-labelledby");for(let j of this.#Q.querySelectorAll("fig-input-number"))j.toggleAttribute("disabled",J)}#T(){this.#F(),this.#Q?.addEventListener("input",this.#q),this.#Q?.addEventListener("change",this.#M)}#F(){this.#Q?.removeEventListener("input",this.#q),this.#Q?.removeEventListener("change",this.#M)}#W(J,Q){if(Q.stopImmediatePropagation(),Q.target!==this.#Q||O(this,"disabled"))return;let Z=this.#O(Q.detail?.value,this.value);this.#G(Z),this.#U(),K(this,J)}get value(){return this.#O(this.getAttribute("value"),this.#j)}set value(J){this.#G(J),this.#U()}get defaultValue(){return this.#O(this.getAttribute("default"),this.#j)}get isDefault(){return u(this.value,this.defaultValue)}resetToDefault(){this.value=this.defaultValue,D(this)}focus(J){if(O(this,"disabled"))return;this.#Q?.focus(J)}}P("propskit-joystick",VJ);class fJ extends S{static observedAttributes=["value","default","label","aria-label","precision","drag","disabled"];#$=null;#Z=null;#J=!1;#Q=null;#_=null;#j={x:50,y:50};#B=!1;#q=this.#H.bind(this,"input");#M=this.#H.bind(this,"change");connectedCallback(){if(!this.#$)this.#j=this.#G(this.getAttribute("value"),this.#j),this.#Y(this.#j),this.#k();this.#K(),this.#P(),this.#F(),this.#_?.observe(this.#Q,{childList:!0,subtree:!0}),W(this)}disconnectedCallback(){this.#W(),this.#_?.disconnect(),R(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#$)return;if(J==="value"&&!this.#B)this.#Y(this.#G(Z,this.value)),this.#N();else if(J==="label"||J==="aria-label")this.#K();else if(J==="precision"||J==="drag")this.#U();else if(J==="disabled")this.#L()}#X(J,Q=50){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#O(J,Q,Z){let $=String(J??"").trim().toLowerCase(),j=Q==="x"?{left:0,center:50,right:100}:{top:0,center:50,bottom:100};if($ in j)return j[$];let _=Number.parseFloat($.replace(/%/g,""));return Number.isFinite(_)?_:Z}#G(J,Q={x:50,y:50}){let Z=J;if(typeof J==="string"){let $=J.trim();if(!$)return{...Q};try{Z=JSON.parse($)}catch{let j=$.replace(/,/g," ").split(/\s+/).filter(Boolean);Z={x:this.#O(j[0],"x",Q.x),y:this.#O(j[1]??j[0],"y",Q.y)}}}if(!Z||typeof Z!=="object"||Array.isArray(Z))return{...Q};return{x:this.#X(Z.x,Q.x),y:this.#X(Z.y,Q.y)}}#Y(J){let Q=this.#G(J,this.#j),Z=JSON.stringify(Q);if(this.getAttribute("value")!==Z)this.#B=!0,this.setAttribute("value",Z),this.#B=!1;return Q}#k(){let J=this.querySelector(":scope > label"),Q=G("div",{className:"propskit-origin-surface",role:"group"}),Z=J||document.createElement("label"),$=document.createElement("fig-origin-grid");$.setAttribute("fields","true"),$.setAttribute("aspect-ratio","1 / 1"),Q.append(Z,$),this.#$=Q,this.#Z=Z,this.#J=Boolean(J),this.#Q=$,this.replaceChildren(Q),this.#_=new MutationObserver(()=>this.#T()),this.#_.observe($,{childList:!0,subtree:!0})}#K(){let J=f(this,this.#$,this.#Z,this.#J);H(this,this.#Q,J,"Origin"),this.#T()}#P(){this.#U(),this.#N(),this.#L()}#U(){if(!this.#Q)return;this.#Q.setAttribute("fields","true"),this.#Q.setAttribute("aspect-ratio","1 / 1");for(let J of["precision","drag"])if(this.hasAttribute(J))this.#Q.setAttribute(J,this.getAttribute(J)??"");else this.#Q.removeAttribute(J)}#N(){if(!this.#Q)return;let J=this.value,Q=`${J.x}% ${J.y}%`;if(this.#Q.getAttribute("value")!==Q)this.#Q.setAttribute("value",Q)}#L(){if(!this.#Q||!this.#$)return;let J=O(this,"disabled");this.#$.setAttribute("aria-disabled",String(J)),this.#Q.toggleAttribute("disabled",J),this.#Q.inert=J,this.#T()}#T(){if(!this.#Q)return;let J=O(this,"disabled"),Q=this.#Z?.isConnected?this.#Z.id:"",Z=this.getAttribute("aria-label")?.trim(),$=this.#Q.querySelector("fig-handle");if($)if($.toggleAttribute("disabled",J),Z)$.setAttribute("aria-label",Z),$.removeAttribute("aria-labelledby");else if(Q)$.setAttribute("aria-labelledby",Q),$.removeAttribute("aria-label");else $.setAttribute("aria-label","Origin"),$.removeAttribute("aria-labelledby");for(let j of this.#Q.querySelectorAll("fig-input-number"))j.toggleAttribute("disabled",J)}#F(){this.#W(),this.#Q?.addEventListener("input",this.#q),this.#Q?.addEventListener("change",this.#M)}#W(){this.#Q?.removeEventListener("input",this.#q),this.#Q?.removeEventListener("change",this.#M)}#H(J,Q){if(Q.stopImmediatePropagation(),Q.target!==this.#Q||O(this,"disabled"))return;let Z=this.#G(Q.detail,this.value);this.#Y(Z),this.#N(),K(this,J)}get value(){return this.#G(this.getAttribute("value"),this.#j)}set value(J){this.#Y(J),this.#N()}get defaultValue(){return this.#G(this.getAttribute("default"),this.#j)}get isDefault(){return u(this.value,this.defaultValue)}resetToDefault(){this.value=this.defaultValue,D(this)}focus(J){if(O(this,"disabled"))return;this.#Q?.querySelector("fig-handle")?.focus(J)}}P("propskit-origin",fJ);class XJ extends S{static observedAttributes=["value","default","label","aria-label","precision","edit","disabled"];#$=null;#Z=null;#J=!1;#Q=null;#_=null;#j=null;#B=!1;#q=this.#V.bind(this,"input");#M=this.#V.bind(this,"change");connectedCallback(){if(!this.#$)this.#j=this.#k(this.getAttribute("value"),this.#O()),this.#K(this.#j),this.#P();this.#U(),this.#N(),this.#H(),this.#_?.observe(this.#Q,{childList:!0,subtree:!0}),W(this)}disconnectedCallback(){this.#z(),this.#_?.disconnect(),R(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#$)return;if(J==="value"&&!this.#B)this.#K(this.#k(Z,this.value)),this.#T();else if(J==="label"||J==="aria-label")this.#U();else if(J==="precision"||J==="edit")this.#L();else if(J==="disabled")this.#F()}#X(){return this.localName==="propskit-spring"}#O(){return this.#X()?{stiffness:200,damping:15,mass:1}:{x1:0.42,y1:0,x2:0.58,y2:1}}#G(J,Q){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#Y(J,Q){let Z=this.#G(J,Q);return Z>0?Z:Q}#k(J,Q=this.#O()){let Z=J;if(typeof J==="string"){let $=J.trim();if(!$)return{...Q};try{Z=JSON.parse($)}catch{if(this.#X()){let j=$.match(/^spring\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)$/);Z=j?{stiffness:Number(j[1]),damping:Number(j[2]),mass:Number(j[3])}:null}else{let _=$.replace(/^cubic-bezier\(\s*/i,"").replace(/\s*\)$/,"").split(",").map((X)=>Number(X.trim()));Z=_.length===4&&_.every(Number.isFinite)?{x1:_[0],y1:_[1],x2:_[2],y2:_[3]}:null}}}if(this.#X()){if(!Z||typeof Z!=="object"||Array.isArray(Z))return{...Q};return{stiffness:this.#Y(Z.stiffness,Q.stiffness),damping:this.#Y(Z.damping,Q.damping),mass:this.#Y(Z.mass,Q.mass)}}if(Array.isArray(Z))Z={x1:Z[0],y1:Z[1],x2:Z[2],y2:Z[3]};if(!Z||typeof Z!=="object")return{...Q};return{x1:Math.max(0,Math.min(1,this.#G(Z.x1,Q.x1))),y1:this.#G(Z.y1,Q.y1),x2:Math.max(0,Math.min(1,this.#G(Z.x2,Q.x2))),y2:this.#G(Z.y2,Q.y2)}}#K(J){let Q=this.#j||this.#O(),Z=this.#k(J,Q),$=JSON.stringify(Z);if(this.getAttribute("value")!==$)this.#B=!0,this.setAttribute("value",$),this.#B=!1;return Z}#P(){let J=this.querySelector(":scope > label"),Q=G("div",{className:`${this.localName}-surface`,role:"group"}),Z=J||document.createElement("label"),$=document.createElement("fig-easing-curve");$.setAttribute("mode",this.#X()?"spring":"bezier"),$.setAttribute("aspect-ratio","1 / 1"),Q.append(Z,$),this.#$=Q,this.#Z=Z,this.#J=Boolean(J),this.#Q=$,this.replaceChildren(Q),this.#_=new MutationObserver(()=>this.#W()),this.#_.observe($,{childList:!0,subtree:!0})}#U(){let J=f(this,this.#$,this.#Z,this.#J);H(this,this.#Q,J,this.#X()?"Spring":"Easing"),this.#W()}#N(){this.#L(),this.#T(),this.#F()}#L(){if(!this.#Q)return;this.#Q.setAttribute("mode",this.#X()?"spring":"bezier"),this.#Q.setAttribute("aspect-ratio","1 / 1");for(let J of["precision","edit"])if(this.hasAttribute(J))this.#Q.setAttribute(J,this.getAttribute(J)??"");else this.#Q.removeAttribute(J)}#T(){if(!this.#Q)return;let J=this.value,Q=this.#X()?`spring(${J.stiffness}, ${J.damping}, ${J.mass})`:`${J.x1}, ${J.y1}, ${J.x2}, ${J.y2}`;if(this.#Q.getAttribute("value")!==Q)this.#Q.setAttribute("value",Q)}#F(){if(!this.#Q||!this.#$)return;let J=O(this,"disabled");this.#$.setAttribute("aria-disabled",String(J)),this.#Q.toggleAttribute("disabled",J),this.#Q.inert=J,this.#W()}#W(){if(!this.#Q)return;let J=O(this,"disabled");this.#Q.querySelector("fig-select")?.setAttribute("variant","ghost");for(let Q of this.#Q.querySelectorAll("fig-handle, fig-select, fig-dropdown, fig-input-text"))Q.toggleAttribute("disabled",J);for(let Q of this.#Q.querySelectorAll("input, select"))Q.disabled=J}#H(){this.#z(),this.#Q?.addEventListener("input",this.#q),this.#Q?.addEventListener("change",this.#M)}#z(){this.#Q?.removeEventListener("input",this.#q),this.#Q?.removeEventListener("change",this.#M)}#V(J,Q){if(Q.stopImmediatePropagation(),Q.target!==this.#Q||O(this,"disabled"))return;let Z=this.#k(Q.detail?.value,this.value);this.#K(Z),this.#T(),K(this,J)}get value(){return this.#k(this.getAttribute("value"),this.#j||this.#O())}set value(J){this.#K(J),this.#T()}get defaultValue(){return this.#k(this.getAttribute("default"),this.#j||this.#O())}get isDefault(){return u(this.value,this.defaultValue)}resetToDefault(){this.value=this.defaultValue,D(this)}focus(J){if(O(this,"disabled"))return;this.#Q?.querySelector("fig-select, fig-dropdown, fig-handle, fig-input-text")?.focus(J)}}class CJ extends XJ{}P("propskit-easing",CJ);class AJ extends XJ{}P("propskit-spring",AJ);class EJ extends S{static observedAttributes=["options","value","default","label","aria-label","disabled"];#$=null;#Z=null;#J=null;#Q=!1;#_=null;#j=null;#B=null;#q=null;#M="";#X=!1;#O=new Set;#G=new Map;#Y=this.#D.bind(this,"input");#k=this.#D.bind(this,"change");#K=(J)=>J.stopImmediatePropagation();#P=this.#f.bind(this);connectedCallback(){if(!this.#$)this.#M=this.#N(this.getAttribute("value")),this.#L(this.#M),this.#T();this.#F(),this.#H(),this.#R(),this.#y(),this.#q?.observe(this.#B,{childList:!0}),this.#V(),W(this)}disconnectedCallback(){this.#h(),this.#q?.disconnect(),R(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#$)return;if(J==="options")this.#x(),this.#H();else if(J==="value"&&!this.#X)this.#L(Z);else if(J==="label"||J==="aria-label")this.#F();else if(J==="disabled")this.#R()}#U(J=this.getAttribute("options")){let Q=J;if(typeof J==="string")try{Q=JSON.parse(J||"[]")}catch{return[]}if(!Array.isArray(Q))return[];let Z=new Set;for(let $ of Q){if(typeof $!=="string")continue;let j=$.trim();if(j)Z.add(j)}return[...Z]}#N(J){let Q=this.#U(),Z=String(J??"").trim();if(Z&&Q.includes(Z))return Z;return Q[0]||""}#L(J){let Q=this.#N(J),Z=this.getAttribute("value");if(Q){if(Z!==Q)this.#X=!0,this.setAttribute("value",Q),this.#X=!1}else if(Z!==null)this.#X=!0,this.removeAttribute("value"),this.#X=!1;if(this.#B)this.#B.value=Q;return Q}#T(){let J=this.querySelector(":scope > label"),Q=G("div",{className:"propskit-image-surface",role:"group"}),Z=G("div",{className:"propskit-image-header"}),$=J||document.createElement("label"),j=G("fig-tooltip",{className:"propskit-image-upload-tooltip",text:"Upload image"}),_=G("fig-button",{className:"propskit-image-upload",variant:"ghost",type:"upload",icon:!0,"aria-label":"Upload images"}),X=G("fig-icon",{name:"upload","aria-hidden":"true"}),q=G("input",{type:"file",accept:"image/*",multiple:!0,"aria-label":"Upload images"}),B=G("fig-chooser",{className:"propskit-image-chooser",layout:"grid",columns:"2",overflow:"buttons",full:!0});_.append(X,q),j.append(_),Z.append($,j),Q.append(Z,B),this.#$=Q,this.#Z=Z,this.#J=$,this.#Q=Boolean(J),this.#_=_,this.#j=q,this.#B=B,this.#q=new MutationObserver(()=>this.#V()),this.replaceChildren(Q)}#F(){if(!this.#Z||!this.#J||!this.#B||!this.#$)return;let J=f(this,this.#Z,this.#J,this.#Q);H(this,this.#B,J,"Images");let Q=this.getAttribute("aria-label")?.trim();if(Q)this.#$.setAttribute("aria-label",Q),this.#$.removeAttribute("aria-labelledby");else if(J)this.#$.setAttribute("aria-labelledby",J),this.#$.removeAttribute("aria-label");else this.#$.setAttribute("aria-label","Images"),this.#$.removeAttribute("aria-labelledby")}#W(J,Q){let Z=this.#G.get(J);if(Z)return Z;try{let $=new URL(J,document.baseURI).pathname.split("/").filter(Boolean).pop();if($)return decodeURIComponent($)}catch{}return`Image ${Q+1}`}#H(){if(!this.#B)return;let J=this.#U(),Q=this.#N(this.getAttribute("value")),Z=J.map(($,j)=>{let _=this.#W($,j),X=G("fig-choice",{value:$,"aria-label":_,selected:$===Q}),q=G("fig-image",{src:$,alt:"",full:!0,"aspect-ratio":"1 / 1",fit:"cover"}),B=G("fig-tooltip",{className:"propskit-image-remove-tooltip",text:"Remove image"}),Y=G("span",{className:"propskit-image-remove","aria-hidden":"true","data-propskit-image-remove":""}),M=G("fig-icon",{name:"close",size:"small","aria-hidden":"true"});return Y.append(M),Y.addEventListener("click",(k)=>this.#w($,j,k)),X.addEventListener("keydown",(k)=>{if(k.key!=="Delete"&&k.key!=="Backspace")return;this.#w($,j,k)}),B.append(Y),X.dataset.propskitImageLabel=_,X.append(q,B),X});this.#B.replaceChildren(...Z),this.#B.setAttribute("layout","grid"),this.#B.setAttribute("columns","2"),this.#B.setAttribute("overflow","buttons"),this.#B.toggleAttribute("hidden",Z.length===0),this.#L(Q),this.#z(),queueMicrotask(()=>this.#V())}#z(){let J=O(this,"disabled");for(let Q of this.#B?.querySelectorAll(":scope > fig-choice")||[]){if(J)Q.removeAttribute("aria-description"),Q.removeAttribute("aria-keyshortcuts");else Q.setAttribute("aria-description","Press Delete or Backspace to remove this image."),Q.setAttribute("aria-keyshortcuts","Delete Backspace");Q.querySelector(":scope > .propskit-image-remove-tooltip > .propskit-image-remove")?.setAttribute("aria-hidden","true")}}#V(){for(let J of this.#B?.querySelectorAll(":scope > [data-fig-chooser-nav]")||[])J.setAttribute("aria-hidden","true")}#R(){if(!this.#$||!this.#_||!this.#j||!this.#B)return;let J=O(this,"disabled");this.#$.setAttribute("aria-disabled",String(J)),this.#_.toggleAttribute("disabled",J),this.#j.disabled=J,this.#B.toggleAttribute("disabled",J),this.#B.inert=J,this.#z()}#y(){this.#h(),this.#B?.addEventListener("input",this.#Y),this.#B?.addEventListener("change",this.#k),this.#j?.addEventListener("input",this.#K),this.#j?.addEventListener("change",this.#P)}#h(){this.#B?.removeEventListener("input",this.#Y),this.#B?.removeEventListener("change",this.#k),this.#j?.removeEventListener("input",this.#K),this.#j?.removeEventListener("change",this.#P)}#D(J,Q){if(Q.target!==this.#B)return;if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let Z=this.#L(this.#B.value);K(this,J,Z)}#f(J){if(J.target!==this.#j)return;if(J.stopImmediatePropagation(),O(this,"disabled"))return;let Q=[...this.#j.files||[]].filter(($)=>!$.type||$.type.startsWith("image/"));if(!Q.length)return;let Z=Q.map(($)=>{let j=URL.createObjectURL($);return this.#O.add(j),this.#G.set(j,$.name),j});this.options=[...this.options,...Z],this.value=Z[0],this.#j.value="";for(let $ of["input","change"])K(this,$,this.value)}#w(J,Q,Z){if(Z.preventDefault(),Z.stopImmediatePropagation(),O(this,"disabled"))return;let $=this.options;if(!$.includes(J))return;let j=this.value,_=j===J;this.options=$.filter((q)=>q!==J);let X=this.value;if(X!==j)for(let q of["input","change"])K(this,q,X);queueMicrotask(()=>{let q=[...this.#B?.querySelectorAll(":scope > fig-choice")||[]],B=_?this.#B?.selectedChoice:q[Math.min(Q,q.length-1)];if(B instanceof HTMLElement)B.focus();else this.#j?.focus()})}#x(){let J=new Set(this.#U());for(let Q of this.#O){if(J.has(Q))continue;URL.revokeObjectURL(Q),this.#O.delete(Q),this.#G.delete(Q)}}get options(){return this.#U()}set options(J){if(J===null||J===void 0){this.removeAttribute("options");return}this.setAttribute("options",JSON.stringify(this.#U(J)))}get value(){return this.#N(this.#B?.value??this.getAttribute("value"))}set value(J){this.#L(J)}get defaultValue(){let J=this.#M||this.#N(null);return this.#N(this.hasAttribute("default")?this.getAttribute("default"):J)}get isDefault(){return c(this.value,this.defaultValue)}resetToDefault(){this.value=this.defaultValue,D(this)}focus(J){if(O(this,"disabled"))return;let Q=this.#B?.selectedChoice||this.#B?.querySelector("fig-choice");if(Q instanceof HTMLElement)Q.focus(J);else this.#j?.focus(J)}}P("propskit-image",EJ);class DJ extends S{static observedAttributes=["label","collapsible","open","disabled","value"];#$=null;#Z=null;#J=null;#Q=!1;#_=!1;#j=!1;#B=this.#N.bind(this,"input");#q=this.#N.bind(this,"change");#M=this.#L.bind(this);connectedCallback(){if(!this.#Q)this.#Y(this.#G()),this.#Q=!0;if(!this.#$)this.#k();this.#K(),this.#P(),this.#U(this.#G()),this.removeEventListener("input",this.#B),this.addEventListener("input",this.#B),this.removeEventListener("change",this.#q),this.addEventListener("change",this.#q),this.removeEventListener("openchange",this.#M),this.addEventListener("openchange",this.#M)}disconnectedCallback(){this.removeEventListener("input",this.#B),this.removeEventListener("change",this.#q),this.removeEventListener("openchange",this.#M)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Q)return;if(J==="value"){if(!this.#_){let $=this.#Y(this.#G());this.#U($)}return}if(J==="disabled"){this.#P();return}this.#K()}#X(J,Q){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#O(J){let Q=J;if(typeof J==="string")try{Q=JSON.parse(J)}catch{Q=null}if(!Q||typeof Q!=="object"||Array.isArray(Q))Q={};return{x:this.#X(Q.x,50),y:this.#X(Q.y,50),color:typeof Q.color==="string"&&Q.color.trim()?Q.color.trim():"#D9D9D9"}}#G(){return this.#O(this.getAttribute("value"))}#Y(J){let Q=this.#O(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#_=!0,this.setAttribute("value",Z),this.#_=!1,Q}#k(){let J=this.#G(),Q=document.createElement("fig-group"),Z=document.createElement("propskit-color"),$=document.createElement("propskit-position");Q.setAttribute("compact",""),Z.setAttribute("label","Color"),Z.setAttribute("value",J.color),Z.setAttribute("data-propskit-color-point-control","color"),$.setAttribute("label","Position"),$.setAttribute("x",String(J.x)),$.setAttribute("y",String(J.y)),$.setAttribute("units","percent"),$.setAttribute("data-propskit-color-point-control","position"),this.#$=Q,this.#Z=Z,this.#J=$,this.#K(),this.#P(),Q.append(Z,$),this.replaceChildren(Q)}#K(){if(!this.#$)return;this.#$.setAttribute("compact","");let J=this.getAttribute("label")?.trim();if(J)this.#$.setAttribute("name",J);else this.#$.removeAttribute("name");if(this.#$.toggleAttribute("collapsible",this.collapsible),this.collapsible)this.#$.setAttribute("open",String(this.open));else this.#$.removeAttribute("open")}#P(){n(this,[this.#Z,this.#J])}#U(J){let Q=this.#O(J);if(this.#Z)this.#Z.value=Q.color;if(this.#J)this.#J.value={x:Q.x,y:Q.y}}#N(J,Q){if(Q.target===this)return;let Z=Q.target?.closest?.("[data-propskit-color-point-control]");if(!Z||!this.contains(Z))return;if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let $=this.value,j=Z.getAttribute("data-propskit-color-point-control");if(j==="color")$.color=Z.value||Z.getAttribute("value");else if(j==="position")$.x=this.#X(Z.value?.x,$.x),$.y=this.#X(Z.value?.y,$.y);else return;this.#Y($),K(this,J)}#L(J){if(J.target!==this.#$||this.#j)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#j=!0,this.setAttribute("open",String(Q)),this.#j=!1,this.dispatchEvent(new CustomEvent("openchange",{detail:{open:Q},bubbles:!0,composed:!0}))}get collapsible(){let J=this.getAttribute("collapsible");return J===null||J!=="false"}set collapsible(J){this.setAttribute("collapsible",String(Boolean(J)))}get open(){let J=this.getAttribute("open");return J===null||J!=="false"}set open(J){this.setAttribute("open",String(Boolean(J)))}get value(){return{...this.#G()}}set value(J){let Q=this.#Y(J);this.#U(Q)}focus(J){this.#Z?.focus(J)}}P("propskit-color-point",DJ);class IJ extends S{static observedAttributes=["label","collapsible","open","units","disabled","value"];#$=null;#Z=null;#J=null;#Q=!1;#_=!1;#j=!1;#B=this.#W.bind(this,"input");#q=this.#W.bind(this,"change");#M=this.#H.bind(this);connectedCallback(){if(!this.#Q)this.#k(this.#Y()),this.#Q=!0;if(!this.#$)this.#P();this.#U(),this.#N(),this.#L(),this.#T(this.#Y()),this.removeEventListener("input",this.#B),this.addEventListener("input",this.#B),this.removeEventListener("change",this.#q),this.addEventListener("change",this.#q),this.removeEventListener("openchange",this.#M),this.addEventListener("openchange",this.#M)}disconnectedCallback(){this.removeEventListener("input",this.#B),this.removeEventListener("change",this.#q),this.removeEventListener("openchange",this.#M)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Q)return;if(J==="value"){if(!this.#_){let $=this.#k(this.#Y());this.#T($)}return}if(J==="units"){this.#N();return}if(J==="disabled"){this.#L();return}this.#U()}#X(J,Q){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#O(J){if(typeof J==="string"&&J.trim().endsWith("%")){let Q=Number.parseFloat(J);if(Number.isFinite(Q))return`${Q}%`}return this.#X(J,0)}#G(J){let Q=J;if(typeof J==="string")try{Q=JSON.parse(J)}catch{Q=null}if(!Q||typeof Q!=="object"||Array.isArray(Q))Q={};return{x:this.#X(Q.x,50),y:this.#X(Q.y,50),radius:this.#O(Q.radius)}}#Y(){return this.#G(this.getAttribute("value"))}#k(J){let Q=this.#G(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#_=!0,this.setAttribute("value",Z),this.#_=!1,Q}#K(J){let Q=typeof J==="string"&&J.trim().endsWith("%");return{value:Q?Number.parseFloat(J):J,units:Q?"%":"px"}}#P(){let J=this.#Y(),Q=this.#K(J.radius),Z=document.createElement("fig-group"),$=document.createElement("propskit-position"),j=document.createElement("propskit-number");if(Z.setAttribute("compact",""),$.setAttribute("label","Position"),$.setAttribute("x",String(J.x)),$.setAttribute("y",String(J.y)),this.hasAttribute("units"))$.setAttribute("units",this.units);if($.setAttribute("data-propskit-point-radius-control","position"),j.setAttribute("label","Radius"),j.setAttribute("value",String(Q.value)),this.units==="percent")j.setAttribute("units","%");j.setAttribute("units-disallow",""),j.setAttribute("min","0"),j.setAttribute("precision","2"),j.setAttribute("data-propskit-point-radius-control","radius"),this.#$=Z,this.#Z=$,this.#J=j,this.#U(),this.#L(),Z.append($,j),this.replaceChildren(Z)}#U(){if(!this.#$)return;this.#$.setAttribute("compact","");let J=this.getAttribute("label")?.trim();if(J)this.#$.setAttribute("name",J);else this.#$.removeAttribute("name");if(this.#$.toggleAttribute("collapsible",this.collapsible),this.collapsible)this.#$.setAttribute("open",String(this.open));else this.#$.removeAttribute("open")}#N(){if(this.hasAttribute("units"))this.#Z?.setAttribute("units",this.units);else this.#Z?.removeAttribute("units");if(this.units==="percent")this.#J?.setAttribute("units","%");else this.#J?.removeAttribute("units")}#L(){n(this,[this.#Z,this.#J])}#T(J){let Q=this.#G(J);if(this.#Z)this.#Z.value={x:Q.x,y:Q.y};if(this.#J){let Z=this.#K(Q.radius);this.#J.value=Z.value}}#F(J,Q){let Z=this.#K(Q).value,$=this.#X(J.value,Z);return(J.querySelector("fig-input-number")?.getAttribute("units")||J.getAttribute("units"))==="%"?`${$}%`:$}#W(J,Q){if(Q.target===this)return;let Z=Q.target?.closest?.("[data-propskit-point-radius-control]");if(!Z||!this.contains(Z))return;if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let $=this.value,j=Z.getAttribute("data-propskit-point-radius-control");if(j==="position")$.x=this.#X(Z.value?.x,$.x),$.y=this.#X(Z.value?.y,$.y);else if(j==="radius")$.radius=this.#F(Z,$.radius);else return;this.#k($),K(this,J)}#H(J){if(J.target!==this.#$||this.#j)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#j=!0,this.setAttribute("open",String(Q)),this.#j=!1,this.dispatchEvent(new CustomEvent("openchange",{detail:{open:Q},bubbles:!0,composed:!0}))}get collapsible(){let J=this.getAttribute("collapsible");return J===null||J!=="false"}set collapsible(J){this.setAttribute("collapsible",String(Boolean(J)))}get open(){let J=this.getAttribute("open");return J===null||J!=="false"}set open(J){this.setAttribute("open",String(Boolean(J)))}get units(){return this.getAttribute("units")?.trim().toLowerCase()==="percent"?"percent":"none"}set units(J){this.setAttribute("units",String(J).trim().toLowerCase()==="none"?"none":"percent")}get value(){return{...this.#Y()}}set value(J){let Q=this.#k(J);this.#T(Q)}focus(J){this.#Z?.focus(J)}}P("propskit-point-radius",IJ);class bJ extends S{static observedAttributes=["label","collapsible","open","units","disabled","value"];#$=null;#Z=null;#J=null;#Q=null;#_=!1;#j=!1;#B=!1;#q=this.#H.bind(this,"input");#M=this.#H.bind(this,"change");#X=this.#z.bind(this);connectedCallback(){if(!this.#_)this.#K(this.#k()),this.#_=!0;if(!this.#$)this.#U();this.#N(),this.#L(),this.#T(),this.#F(this.#k()),this.removeEventListener("input",this.#q),this.addEventListener("input",this.#q),this.removeEventListener("change",this.#M),this.addEventListener("change",this.#M),this.removeEventListener("openchange",this.#X),this.addEventListener("openchange",this.#X)}disconnectedCallback(){this.removeEventListener("input",this.#q),this.removeEventListener("change",this.#M),this.removeEventListener("openchange",this.#X)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#_)return;if(J==="value"){if(!this.#j){let $=this.#K(this.#k());this.#F($)}return}if(J==="units"){this.#L();return}if(J==="disabled"){this.#T();return}this.#N()}#O(J,Q){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#G(J){if(typeof J==="string"&&J.trim().endsWith("%")){let Q=Number.parseFloat(J);if(Number.isFinite(Q))return`${Q}%`}return this.#O(J,0)}#Y(J){let Q=J;if(typeof J==="string")try{Q=JSON.parse(J)}catch{Q=null}if(!Q||typeof Q!=="object"||Array.isArray(Q))Q={};return{x:this.#O(Q.x,50),y:this.#O(Q.y,50),radius:this.#G(Q.radius),angle:this.#O(Q.angle,0)}}#k(){return this.#Y(this.getAttribute("value"))}#K(J){let Q=this.#Y(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#j=!0,this.setAttribute("value",Z),this.#j=!1,Q}#P(J){let Q=typeof J==="string"&&J.trim().endsWith("%");return{value:Q?Number.parseFloat(J):J,units:Q?"%":"px"}}#U(){let J=this.#k(),Q=this.#P(J.radius),Z=document.createElement("fig-group"),$=document.createElement("propskit-position"),j=document.createElement("propskit-number"),_=document.createElement("propskit-number");if(Z.setAttribute("compact",""),$.setAttribute("label","Position"),$.setAttribute("x",String(J.x)),$.setAttribute("y",String(J.y)),this.hasAttribute("units"))$.setAttribute("units",this.units);if($.setAttribute("data-propskit-point-radius-angle-control","position"),j.setAttribute("label","Radius"),j.setAttribute("value",String(Q.value)),this.units==="percent")j.setAttribute("units","%");j.setAttribute("units-disallow",""),j.setAttribute("min","0"),j.setAttribute("precision","2"),j.setAttribute("data-propskit-point-radius-angle-control","radius"),_.setAttribute("label","Angle"),_.setAttribute("value",String(J.angle)),_.setAttribute("units","°"),_.setAttribute("units-disallow",""),_.setAttribute("precision","1"),_.setAttribute("data-propskit-point-radius-angle-control","angle"),this.#$=Z,this.#Z=$,this.#J=j,this.#Q=_,this.#N(),this.#T(),Z.append($,j,_),this.replaceChildren(Z)}#N(){if(!this.#$)return;this.#$.setAttribute("compact","");let J=this.getAttribute("label")?.trim();if(J)this.#$.setAttribute("name",J);else this.#$.removeAttribute("name");if(this.#$.toggleAttribute("collapsible",this.collapsible),this.collapsible)this.#$.setAttribute("open",String(this.open));else this.#$.removeAttribute("open")}#L(){if(this.hasAttribute("units"))this.#Z?.setAttribute("units",this.units);else this.#Z?.removeAttribute("units");if(this.units==="percent")this.#J?.setAttribute("units","%");else this.#J?.removeAttribute("units")}#T(){n(this,[this.#Z,this.#J,this.#Q])}#F(J){let Q=this.#Y(J);if(this.#Z)this.#Z.value={x:Q.x,y:Q.y};if(this.#J){let Z=this.#P(Q.radius);this.#J.value=Z.value}if(this.#Q)this.#Q.value=Q.angle}#W(J,Q){let Z=this.#P(Q).value,$=this.#O(J.value,Z);return(J.querySelector("fig-input-number")?.getAttribute("units")||J.getAttribute("units"))==="%"?`${$}%`:$}#H(J,Q){if(Q.target===this)return;let Z=Q.target?.closest?.("[data-propskit-point-radius-angle-control]");if(!Z||!this.contains(Z))return;if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let $=this.value,j=Z.getAttribute("data-propskit-point-radius-angle-control");if(j==="position")$.x=this.#O(Z.value?.x,$.x),$.y=this.#O(Z.value?.y,$.y);else if(j==="radius")$.radius=this.#W(Z,$.radius);else if(j==="angle")$.angle=this.#O(Z.value,$.angle);else return;this.#K($),K(this,J)}#z(J){if(J.target!==this.#$||this.#B)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#B=!0,this.setAttribute("open",String(Q)),this.#B=!1,this.dispatchEvent(new CustomEvent("openchange",{detail:{open:Q},bubbles:!0,composed:!0}))}get collapsible(){let J=this.getAttribute("collapsible");return J===null||J!=="false"}set collapsible(J){this.setAttribute("collapsible",String(Boolean(J)))}get open(){let J=this.getAttribute("open");return J===null||J!=="false"}set open(J){this.setAttribute("open",String(Boolean(J)))}get units(){return this.getAttribute("units")?.trim().toLowerCase()==="percent"?"percent":"none"}set units(J){this.setAttribute("units",String(J).trim().toLowerCase()==="none"?"none":"percent")}get value(){return{...this.#k()}}set value(J){let Q=this.#K(J);this.#F(Q)}focus(J){this.#Z?.focus(J)}}P("propskit-point-radius-angle",bJ);class yJ extends S{static observedAttributes=["label","collapsible","open","units","disabled","value"];#$=null;#Z=null;#J=null;#Q=!1;#_=!1;#j=!1;#B=this.#T.bind(this,"input");#q=this.#T.bind(this,"change");#M=this.#F.bind(this);connectedCallback(){if(!this.#Q)this.#Y(this.#G()),this.#Q=!0;if(!this.#$)this.#K();this.#P(),this.#U(),this.#N(),this.#L(this.#G()),this.removeEventListener("input",this.#B),this.addEventListener("input",this.#B),this.removeEventListener("change",this.#q),this.addEventListener("change",this.#q),this.removeEventListener("openchange",this.#M),this.addEventListener("openchange",this.#M)}disconnectedCallback(){this.removeEventListener("input",this.#B),this.removeEventListener("change",this.#q),this.removeEventListener("openchange",this.#M)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Q)return;if(J==="value"){if(!this.#_){let $=this.#Y(this.#G());this.#L($)}return}if(J==="units"){this.#U();return}if(J==="disabled"){this.#N();return}this.#P()}#X(J,Q){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#O(J){let Q=J;if(typeof J==="string")try{Q=JSON.parse(J)}catch{Q=null}if(!Q||typeof Q!=="object"||Array.isArray(Q))Q={};return{x:this.#X(Q.x,50),y:this.#X(Q.y,50),x2:this.#X(Q.x2,75),y2:this.#X(Q.y2,75)}}#G(){return this.#O(this.getAttribute("value"))}#Y(J){let Q=this.#O(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#_=!0,this.setAttribute("value",Z),this.#_=!1,Q}#k(J,Q,Z,$){let j=document.createElement("propskit-position");if(j.setAttribute("label",J),j.setAttribute("x",String(Z)),j.setAttribute("y",String($)),this.hasAttribute("units"))j.setAttribute("units",this.units);return j.setAttribute("data-propskit-point-point-control",Q),j}#K(){let J=this.#G(),Q=document.createElement("fig-group"),Z=this.#k("Start","start",J.x,J.y),$=this.#k("End","end",J.x2,J.y2);Q.setAttribute("compact",""),this.#$=Q,this.#Z=Z,this.#J=$,this.#P(),this.#N(),Q.append(Z,$),this.replaceChildren(Q)}#P(){if(!this.#$)return;this.#$.setAttribute("compact","");let J=this.getAttribute("label")?.trim();if(J)this.#$.setAttribute("name",J);else this.#$.removeAttribute("name");if(this.#$.toggleAttribute("collapsible",this.collapsible),this.collapsible)this.#$.setAttribute("open",String(this.open));else this.#$.removeAttribute("open")}#U(){for(let J of[this.#Z,this.#J]){if(!J)continue;if(this.hasAttribute("units"))J.setAttribute("units",this.units);else J.removeAttribute("units")}}#N(){n(this,[this.#Z,this.#J])}#L(J){let Q=this.#O(J);if(this.#Z)this.#Z.value={x:Q.x,y:Q.y};if(this.#J)this.#J.value={x:Q.x2,y:Q.y2}}#T(J,Q){if(Q.target===this)return;let Z=Q.target?.closest?.("[data-propskit-point-point-control]");if(!Z||!this.contains(Z))return;if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let $=this.value,j=Z.value,_=Z.getAttribute("data-propskit-point-point-control");if(_==="start")$.x=this.#X(j?.x,$.x),$.y=this.#X(j?.y,$.y);else if(_==="end")$.x2=this.#X(j?.x,$.x2),$.y2=this.#X(j?.y,$.y2);else return;this.#Y($),K(this,J)}#F(J){if(J.target!==this.#$||this.#j)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#j=!0,this.setAttribute("open",String(Q)),this.#j=!1,this.dispatchEvent(new CustomEvent("openchange",{detail:{open:Q},bubbles:!0,composed:!0}))}get collapsible(){let J=this.getAttribute("collapsible");return J===null||J!=="false"}set collapsible(J){this.setAttribute("collapsible",String(Boolean(J)))}get open(){let J=this.getAttribute("open");return J===null||J!=="false"}set open(J){this.setAttribute("open",String(Boolean(J)))}get units(){return this.getAttribute("units")?.trim().toLowerCase()==="percent"?"percent":"none"}set units(J){this.setAttribute("units",String(J).trim().toLowerCase()==="none"?"none":"percent")}get value(){return{...this.#G()}}set value(J){let Q=this.#Y(J);this.#L(Q)}focus(J){this.#Z?.focus(J)}}P("propskit-point-point",yJ);class t extends S{static observedAttributes=["name","open","show-reset","disabled"];static#$=["propskit-color","propskit-fill","propskit-gradient","propskit-easing","propskit-image","propskit-joystick","propskit-number","propskit-origin","propskit-position","propskit-color-point","propskit-point-radius","propskit-point-radius-angle","propskit-point-point","propskit-editable-select","propskit-select","propskit-slider","propskit-spring","propskit-switch","propskit-text","propskit-wheel","propskit-oscillator"].join(",");#Z=null;#J=null;#Q=null;#_=null;#j=0;#B=()=>this.#X();connectedCallback(){this.#z(),this.#P(),this.#q(),requestAnimationFrame(()=>{this.#L()})}disconnectedCallback(){if(this.#M(),this.#j)cancelAnimationFrame(this.#j),this.#j=0;this.#Z?.removeEventListener("click",this.#G),this.#Z?.removeEventListener("keydown",this.#Y),this.#Q?.querySelector("fig-button")?.removeEventListener("click",this.#k)}attributeChangedCallback(J,Q,Z){if(Q===Z)return;if(J==="open"){this.#Z?.setAttribute("aria-expanded",String(this.open));return}if(J==="show-reset"){this.#W(),this.#L();return}if(J==="disabled"){this.#P();return}this.#z()}get open(){let J=this.getAttribute("open");return J!==null&&J!=="false"}set open(J){let Q=this.open;if(J)this.setAttribute("open","true");else this.setAttribute("open","false");if(this.#Z?.setAttribute("aria-expanded",String(!!J)),Q!==!!J)this.dispatchEvent(new CustomEvent("openchange",{detail:{open:!!J},bubbles:!0}))}get showReset(){let J=this.getAttribute("show-reset");if(J===null)return!0;return J!=="false"}set showReset(J){if(J)this.setAttribute("show-reset","true");else this.setAttribute("show-reset","false")}get dirty(){return this.hasAttribute("data-dirty")&&this.getAttribute("data-dirty")!=="false"}resetProperties(){this.#F()}#q(){if(this.removeEventListener("input",this.#B,!0),this.removeEventListener("change",this.#B,!0),this.addEventListener("input",this.#B,!0),this.addEventListener("change",this.#B,!0),!this.#_)this.#_=new MutationObserver(()=>{this.#P(),this.#X()});this.#_.disconnect(),this.#_.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value","checked","default","x","y"]})}#M(){this.removeEventListener("input",this.#B,!0),this.removeEventListener("change",this.#B,!0),this.#_?.disconnect()}#X(){if(this.#j)return;this.#j=requestAnimationFrame(()=>{this.#j=0,this.#L()})}#O(J){return J instanceof Element&&Boolean(J.closest(".propskit-group-reset, .propskit-group-reset-tooltip"))}#G=(J)=>{if(O(this,"disabled"))return;if(this.#O(J.target))return;J.stopPropagation(),this.open=!this.open};#Y=(J)=>{if(O(this,"disabled"))return;if(this.#O(J.target))return;if(J.key!=="Enter"&&J.key!==" ")return;J.preventDefault(),J.stopPropagation(),this.open=!this.open};#k=(J)=>{if(J.preventDefault(),J.stopPropagation(),O(this,"disabled"))return;this.#F()};#K(){return[...this.querySelectorAll(t.#$)].filter((J)=>J.closest("propskit-group")===this&&!J.parentElement?.closest(t.#$))}#P(){let J=O(this,"disabled");for(let Q of this.#K())if(J){if(!O(Q,"disabled"))Q.setAttribute("disabled",""),Q.setAttribute("data-propskit-group-disabled","")}else if(Q.hasAttribute("data-propskit-group-disabled"))Q.removeAttribute("disabled"),Q.removeAttribute("data-propskit-group-disabled");this.#Z?.setAttribute("aria-disabled",String(J)),this.#Z?.setAttribute("tabindex",J?"-1":"0"),this.#Q?.querySelector("fig-button")?.toggleAttribute("disabled",J)}#U(J){return J.isDefault===!1}#N(){for(let J of this.#K())if(this.#U(J))return!0;return!1}#L(){if(this.#N())this.setAttribute("data-dirty","");else this.removeAttribute("data-dirty");this.#W()}#T(J){if(typeof J.resetToDefault==="function")J.resetToDefault()}#F(){for(let J of this.#K())this.#T(J);this.#L(),this.dispatchEvent(new CustomEvent("reset",{bubbles:!0,composed:!0}))}#W(){if(!this.showReset){this.#Q?.setAttribute("hidden","");return}this.#H(),this.#Q?.removeAttribute("hidden")}#H(){if(!this.#Z||!this.showReset)return;let J=this.#Z.querySelector(":scope > .propskit-group-reset-tooltip");if(!J){J=document.createElement("fig-tooltip"),J.className="propskit-group-reset-tooltip",J.setAttribute("text","Reset properties");let Q=document.createElement("fig-button");Q.className="propskit-group-reset",Q.setAttribute("variant","ghost"),Q.setAttribute("icon",""),Q.setAttribute("aria-label","Reset properties");let Z=document.createElement("fig-icon");Z.setAttribute("name","reset"),Q.appendChild(Z),J.appendChild(Q),this.#Z.appendChild(J),Q.addEventListener("click",this.#k)}else{let Q=J.querySelector("fig-button");Q?.removeEventListener("click",this.#k),Q?.addEventListener("click",this.#k)}this.#Q=J}#z(){let Q=this.getAttribute("name")||"Group",Z=this.querySelector(":scope > fig-header");if(Z)this.#Z=Z;else if(!this.#Z||!this.#Z.dataset.generated||this.#Z.parentElement!==this)this.#Z=document.createElement("fig-header"),this.#Z.setAttribute("borderless",""),this.#Z.dataset.generated="true",this.prepend(this.#Z);let $=this.#Z.querySelector(":scope > h3"),j=this.#Z.querySelector(":scope > fig-button.propskit-group-disclosure");if(!$&&j){if($=j.querySelector(":scope > h3"),$)this.#Z.insertBefore($,j);j.remove()}if(!$)$=document.createElement("h3"),this.#Z.prepend($);let _=$.querySelector(":scope > button.propskit-group-disclosure");if(_){while(_.firstChild)$.insertBefore(_.firstChild,_);_.remove()}if(!$.id)$.id=MJ("propskit-group");if(this.#Z.dataset.generated)$.textContent=Q;if(!this.hasAttribute("role"))this.setAttribute("role","group");if(!this.hasAttribute("aria-label")&&!this.hasAttribute("aria-labelledby"))this.setAttribute("aria-labelledby",$.id);let X=this.#Z.querySelector(":scope > .propskit-group-chevron")||$.querySelector(":scope > .propskit-group-chevron");if(!X)X=document.createElement("fig-icon"),X.setAttribute("name","chevron"),X.setAttribute("size","small"),X.className="propskit-group-chevron";if(this.#Z.insertBefore(X,$),this.#J=X,this.#W(),this.#Z.setAttribute("role","button"),this.#P(),this.#Z.setAttribute("aria-expanded",String(this.open)),this.#Z.removeEventListener("click",this.#G),this.#Z.addEventListener("click",this.#G),this.#Z.removeEventListener("keydown",this.#Y),this.#Z.addEventListener("keydown",this.#Y),!this.hasAttribute("open"))this.setAttribute("open","false"),this.#Z.setAttribute("aria-expanded","false")}}P("propskit-group",t);class o extends S{static#$=4;static#Z="propskit-slider-dragging";static#J=null;#Q=null;#_=null;#j=null;#B=!1;#q=null;#M=new Set;#X=0;#O=0;#G=0;#Y=null;#k=!0;#K=0;#P=1;#U=0;#N=null;#L=null;#T=0;#F=null;#W=null;#H=!1;#z=0;#V=null;#R=0;#y=null;#h=0;#D=null;#f=0;#w=0;#x=!1;#I=!1;#C=0;#A=null;#E=null;#c=this.#CJ.bind(this);#u=this.#RJ.bind(this);#b=this.#l.bind(this);#S=this.#HJ.bind(this);#jJ=this.#TJ.bind(this);#p=this.#LJ.bind(this);#m=this.#KJ.bind(this);#i=this.#fJ.bind(this);#a=this.#DJ.bind(this);#s=this.#WJ.bind(this);#g=new Set(["variant","color","text","full","elastic","size","name","class","data-wave-index","data-active","data-elastic-dragging","default","style"]);static get observedAttributes(){return["label","aria-label"]}connectedCallback(){if(!this.#Q)this.#BJ();if(this.#t(),this.#QJ(),this.#gJ(),this.#$J(),this.#qJ(),this.#MJ(),this.removeEventListener("pointerdown",this.#c,{capture:!0}),this.addEventListener("pointerdown",this.#c,{capture:!0,passive:!0}),this.removeEventListener("pointerdown",this.#S,{capture:!0}),this.addEventListener("pointerdown",this.#S,{capture:!0}),this.removeEventListener("contextmenu",this.#i),this.addEventListener("contextmenu",this.#i),this.removeEventListener("click",this.#s,!0),this.addEventListener("click",this.#s,!0),this.#L?.removeEventListener("change",this.#a),this.#L?.addEventListener("change",this.#a),!this.#q)this.#q=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J)if($.type==="attributes"){if($.attributeName==="value"){this.#OJ();continue}if($.attributeName==="color"){Z=!0;continue}if($.attributeName&&this.#g.has($.attributeName))continue;if($.attributeName==="label"||$.attributeName==="aria-label")Q=!0;else if($.attributeName==="direction")continue;else Z=!0}if(Q)this.#t(),this.#$J();if(Z)this.#QJ(),this.#$J()});this.#q.observe(this,{attributes:!0})}disconnectedCallback(){if(this.#q?.disconnect(),this.#X)cancelAnimationFrame(this.#X),this.#X=0;if(this.#O)cancelAnimationFrame(this.#O),this.#O=0;if(this.#G)cancelAnimationFrame(this.#G),this.#G=0;this.#Y?.disconnect(),this.#AJ(),this.#FJ(),clearTimeout(this.#C),this.#C=0,this.#PJ(),this.#zJ(),this.#JJ(),this.#cJ(),this.removeEventListener("pointerdown",this.#c,{capture:!0}),this.removeEventListener("pointerdown",this.#S,{capture:!0}),this.removeEventListener("contextmenu",this.#i),this.removeEventListener("click",this.#s,!0),this.#L?.removeEventListener("change",this.#a)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Q)return;if(J==="label"||J==="aria-label")this.#t(),this.#$J()}#BJ(){let J=(this.getAttribute("type")||"range").toLowerCase();this.#W=this.getAttribute("value")??this.getAttribute("default")??(J==="delta"?"0":this.getAttribute("min")??"0");let Q=Array.from(this.childNodes).filter((X)=>{return X.nodeType!==Node.TEXT_NODE||Boolean(X.textContent?.trim())}),Z=Q.find((X)=>X.nodeType===Node.ELEMENT_NODE&&X.matches("label")),$=G("div",{className:"propskit-slider-surface"}),j=Z||document.createElement("label"),_=document.createElement("fig-slider");_.setAttribute("text","true");for(let X of this.#e()){let q=this.getAttribute(X);_.setAttribute(X,q??"")}$.append(j,_),this.#Q=$,this.#_=j,this.#j=_,this.#B=Boolean(Z),this.replaceChildren($),this.#o();for(let X of Q){if(X===Z)continue;this.#j.appendChild(X)}}#o(){let J=document.createElement("fig-menu");J.setAttribute("position","bottom left"),J.setAttribute("offset","0 0");let Q=document.createElement("fig-menu-item");Q.setAttribute("value","reset-default"),Q.textContent="Reset",J.appendChild(Q),J.addEventListener("change",this.#a),this.#L=J,this.appendChild(J)}#t(){f(this,this.#Q,this.#_,this.#B),this.#MJ()}#QJ(){if(!this.#j)return;let J=this.#e(),Q=new Set(J.filter(($)=>$!=="text"&&$!=="value"));for(let $ of this.#M)if(!Q.has($))this.#j.removeAttribute($);for(let $ of J){if($==="text"||$==="value")continue;let j=this.getAttribute($)??"";if(this.#j.getAttribute($)!==j)this.#j.setAttribute($,j)}this.#j.removeAttribute("variant"),this.#j.removeAttribute("color"),this.#j.removeAttribute("transform"),this.#j.removeAttribute("full"),this.#j.setAttribute("text","true");let Z=(this.getAttribute("type")||"range").toLowerCase();if(Z==="delta"){let $=Number(this.#j.min),j=Number(this.#j.max),_=Number.isFinite($)&&Number.isFinite(j)?$+(j-$)/2:0;this.#j.setAttribute("default",String(_))}else this.#j.removeAttribute("default");if(Z==="stepper")this.#j.setAttribute("step",this.getAttribute("step")??"10");else if(!this.hasAttribute("step"))this.#j.removeAttribute("step");if(Z==="opacity")this.#j.style.setProperty("--color",this.getAttribute("color")||"var(--figma-color-bg-secondary)");else this.#j.style.removeProperty("--color");this.#r(Z),this.#M=Q,this.#OJ(),this.#SJ(),this.#k=!0,this.#qJ(),this.#MJ()}#r(J){let Q=this.#j?.querySelector("fig-input-number");if(!(J==="hue"||J==="opacity"&&this.hasAttribute("color"))){Q?.removeAttribute("theme"),this.style.removeProperty("--propskit-slider-filled-text-color");return}let $=Number(this.#j?.min),j=Number(this.#j?.max),_=Number(this.#j?.value),X=Number.isFinite($)&&Number.isFinite(j)&&j>$&&Number.isFinite(_)?Math.max(0,Math.min(1,(_-$)/(j-$))):0,q=this.getAttribute("color"),B=J==="hue"?`hsl(${X*360}deg 100% 50%)`:`color-mix(in srgb, ${q} ${X*100}%, var(--figma-color-bg-secondary))`,Y=getComputedStyle(this).colorScheme.trim().toLowerCase()==="dark",M=gJ(this.#j,B,J==="hue"?0.35:Y?0.2:0.35);if(M){Q?.setAttribute("theme",M);let k=M==="light"&&Y||M==="dark"&&!Y;this.style.setProperty("--propskit-slider-filled-text-color",k?"var(--figma-color-text)":"var(--figma-color-text-oninverse)")}else Q?.removeAttribute("theme"),this.style.removeProperty("--propskit-slider-filled-text-color")}#kJ(){if(!this.#j)return;let J=Number(this.#j.min),Q=Number(this.#j.max),Z=Number(this.#j.value),$=Number.isFinite(J)&&Number.isFinite(Q)&&Q>J&&Number.isFinite(Z)?Math.max(0,Math.min(1,(Z-J)/(Q-J))):0;this.style.setProperty("--propskit-slider-complete",String($)),this.#r((this.getAttribute("type")||"range").toLowerCase()),this.#MJ()}#qJ(){if(!globalThis.ResizeObserver)return;if(!this.#Y)this.#Y=new ResizeObserver(()=>{this.#k=!0,this.#MJ()});this.#Y.disconnect();for(let J of[this,this.#_,this.#j?.querySelector("fig-input-number"),this.#j?.querySelector("fig-input-number input"),this.#j?.querySelector('input[type="range"]')])if(J)this.#Y.observe(J)}#MJ(){if(this.#G)cancelAnimationFrame(this.#G);this.#G=requestAnimationFrame(()=>{this.#G=0,this.#_J()})}#_J(){let J=this.#j?.querySelector('input[type="range"]');if(!J||!this.#j)return;let Q=J.getBoundingClientRect();if(!Q.width)return;let Z=Number(J.min||0),$=Number(J.max||100),j=Number(J.value),_=Number.isFinite(Z)&&Number.isFinite($)&&$>Z&&Number.isFinite(j)?Math.max(0,Math.min(1,(j-Z)/($-Z))):0,X=Q.left+_*Q.width;if(this.#k)this.#K=this.#ZJ("--slider-thumb-width",this.#j)/2,this.#P=Math.max(1,this.#ZJ("--propskit-slider-handle-fade-start-threshold")),this.#U=Math.min(this.#P,this.#ZJ("--propskit-slider-handle-fade-end-threshold")),this.#k=!1;let q=this.#K,B=[],Y=this.#_?.parentElement===this.#Q?this.#NJ(this.#_):null,M=this.#j.querySelector("fig-input-number input"),k=M?this.#n(M):null;if(Y?.width&&Y.bottom>Q.top&&Y.top<Q.bottom)B.push(X-q-Y.right);if(k?.width&&k.bottom>Q.top&&k.top<Q.bottom)B.push(k.left-X-q);let N=this.#P,U=this.#U,L=B.length?Math.min(...B):N,T=Math.max(0.001,N-U),V=Math.max(0,Math.min(1,(L-U)/T));this.style.setProperty("--propskit-slider-handle-proximity",String(V))}#NJ(J){let Q=document.createRange();Q.selectNodeContents(J);let Z=[...Q.getClientRects()].filter((q)=>q.width>0&&q.height>0);if(Q.detach?.(),!Z.length)return null;let $=Math.min(...Z.map((q)=>q.left)),j=Math.max(...Z.map((q)=>q.right)),_=Math.min(...Z.map((q)=>q.top)),X=Math.max(...Z.map((q)=>q.bottom));return{left:$,right:j,top:_,bottom:X,width:j-$,height:X-_}}#n(J){let Q=J.value||J.placeholder||"";if(!Q)return null;let Z=J.getBoundingClientRect(),$=getComputedStyle(J),j=this.#XJ(Q,$),_=Z.left+(Number.parseFloat($.borderLeftWidth)||0)+(Number.parseFloat($.paddingLeft)||0),X=Z.right-(Number.parseFloat($.borderRightWidth)||0)-(Number.parseFloat($.paddingRight)||0),q=Math.max(0,X-_),B=Math.min(q,j),Y=$.textAlign,M=_;if(Y==="right"||Y==="end")M=X-B;else if(Y==="center")M=_+(q-B)/2;return{left:M,right:M+B,top:Z.top,bottom:Z.bottom,width:B,height:Z.height}}#XJ(J,Q){if(!o.#J)o.#J=document.createElement("canvas");let Z=o.#J.getContext("2d");if(!Z)return 0;if(Z.font=Q.font||`${Q.fontStyle} ${Q.fontWeight} ${Q.fontSize} ${Q.fontFamily}`,"fontKerning"in Z)Z.fontKerning=Q.fontKerning;if("fontStretch"in Z)Z.fontStretch=Q.fontStretch;if("fontVariantCaps"in Z)Z.fontVariantCaps=Q.fontVariantCaps;if("letterSpacing"in Z)Z.letterSpacing=Q.letterSpacing;return Z.measureText(J).width}#ZJ(J,Q=this){let Z=document.createElement("div");Z.style.setProperty(J,getComputedStyle(Q).getPropertyValue(J)),Object.assign(Z.style,{position:"absolute",visibility:"hidden",pointerEvents:"none",width:`var(${J})`}),this.appendChild(Z);let $=Number.parseFloat(getComputedStyle(Z).width);return Z.remove(),Number.isFinite($)?Math.max(0,$):0}#OJ(){if(!this.#j)return;let J=this.hasAttribute("value")?this.getAttribute("value")??"":this.#W??"";if(String(this.#j.value)!==J)this.#j.value=J;this.#kJ()}#e(){let J=new Set(["label","direction","oninput","onchange","steppers"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!this.#g.has(Q))}#SJ(){if(this.#X)cancelAnimationFrame(this.#X);this.#X=requestAnimationFrame(()=>{this.#X=0,this.#pJ(),this.#YJ()})}#$J(){if(this.#O)cancelAnimationFrame(this.#O);this.#O=requestAnimationFrame(()=>{this.#O=0,this.#YJ()})}#YJ(){let J=this.#j?.querySelector('input[type="range"]'),Q=this.#j?.querySelector("fig-input-number input");if(J!==this.#N)this.#UJ(J);if(J){J.removeAttribute("tabindex"),J.removeAttribute("aria-hidden");let Z=this.getAttribute("aria-label")?.trim();if(Z)J.setAttribute("aria-label",Z),J.removeAttribute("aria-labelledby");else if(this.#_?.parentElement===this.#Q&&this.#_.id)J.setAttribute("aria-labelledby",this.#_.id),J.removeAttribute("aria-label");else J.setAttribute("aria-label","Slider"),J.removeAttribute("aria-labelledby")}if(Q)Q.removeAttribute("tabindex"),Q.removeAttribute("aria-hidden")}#WJ(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number, fig-menu")){if(this.#I&&J.target.closest("fig-input-number"))J.preventDefault(),J.stopImmediatePropagation(),this.#I=!1;return}this.#d()}#d(){requestAnimationFrame(()=>{requestAnimationFrame(()=>{if(this.isConnected&&!O(this,"disabled"))this.focus()})})}#UJ(J){if(this.#JJ(),this.#N=J,!this.#N)return;this.#N.addEventListener("dblclick",this.#m,{capture:!0})}#JJ(){if(!this.#N)return;this.#N.removeEventListener("dblclick",this.#m,{capture:!0}),this.#N=null}#KJ(J){J.preventDefault(),J.stopImmediatePropagation(),this.#xJ()}#HJ(J){if(J.button!==0||J.altKey||O(this,"disabled")||!(J.target instanceof Element))return;let Q=J.target.closest("fig-input-number input");if(!Q||Q===document.activeElement)return;J.preventDefault(),J.stopImmediatePropagation(),this.#FJ(),this.#D=J.pointerId,this.#f=J.clientX,this.#w=J.clientY,this.#x=!1,window.addEventListener("pointermove",this.#jJ),window.addEventListener("pointerup",this.#p,{once:!0}),window.addEventListener("pointercancel",this.#p,{once:!0}),window.addEventListener("blur",this.#p,{once:!0})}#TJ(J){if(J.pointerId!==this.#D)return;if(J.buttons===0){this.#LJ(J);return}if(!this.#x){if(Math.hypot(J.clientX-this.#f,J.clientY-this.#w)<4)return;this.#x=!0,this.setAttribute("data-number-scrubbing",""),this.#GJ(!0)}this.#EJ(this.#wJ(J),"input")}#LJ(J){if(J?.pointerId!==void 0&&this.#D!==null&&J.pointerId!==this.#D)return;let Q=this.#x;if(this.#FJ(),Q){this.#EJ(this.#j?.value,"change"),this.#I=!0,clearTimeout(this.#C),this.#C=window.setTimeout(()=>{this.#I=!1,this.#C=0},0),this.#d();return}this.#j?.querySelector("fig-input-number input")?.focus()}#FJ(){window.removeEventListener("pointermove",this.#jJ),window.removeEventListener("pointerup",this.#p),window.removeEventListener("pointercancel",this.#p),window.removeEventListener("blur",this.#p),this.#D=null,this.#x=!1,this.removeAttribute("data-number-scrubbing"),this.#GJ(!1)}#CJ(J){if(J.button!==0||O(this,"disabled"))return;if(J.target?.closest?.("fig-input-number"))return;let Q=this.#j?.querySelector('input[type="range"]')??this.#N;if(!Q)return;this.#PJ(),this.#zJ(),this.#N=Q,this.#H=!0,this.#y=J.pointerId,this.#h=J.clientX,this.#z=this.getAttribute("elastic")==="false"?0:this.#IJ();let Z=Q.getBoundingClientRect(),$=this.getBoundingClientRect();this.#V={left:Z.left,right:Z.right,width:Z.width},this.#R=$.width,window.addEventListener("pointermove",this.#u,{passive:!0}),window.addEventListener("pointerup",this.#b,{once:!0}),window.addEventListener("pointercancel",this.#b,{once:!0}),window.addEventListener("blur",this.#b,{once:!0})}#RJ(J){if(!this.#H)return;if(J.pointerId!==this.#y)return;if(J.buttons===0){this.#l(J);return}if(Math.abs(J.clientX-this.#h)>=o.#$)this.#GJ(!0);if(this.#z)this.#bJ(J.clientX)}#l(J){if(J?.pointerId!==void 0&&this.#y!==null&&J.pointerId!==this.#y)return;let Q=J?.type==="pointerup"||J?.type==="pointermove"&&J.buttons===0;if(this.#PJ(),this.#zJ(),Q)this.#d()}#PJ(){window.removeEventListener("pointermove",this.#u),window.removeEventListener("pointerup",this.#b),window.removeEventListener("pointercancel",this.#b),window.removeEventListener("blur",this.#b),this.#H=!1,this.#y=null,this.#h=0,this.#GJ(!1)}#GJ(J){this.toggleAttribute("data-propskit-slider-dragging",J),document.body.classList.toggle(o.#Z,J)}#fJ(J){if(O(this,"disabled"))return;J.preventDefault(),J.stopPropagation(),J.stopImmediatePropagation(),this.#AJ(),this.#v(J.clientX,J.clientY)}#v(J,Q){let Z=!1,$=0,j=()=>{if(Z)return;Z=!0,window.clearTimeout($),window.removeEventListener("pointerup",j,!0),window.removeEventListener("pointercancel",j,!0),requestAnimationFrame(()=>{this.#L?.showAt?.(J,Q)})};window.addEventListener("pointerup",j,{once:!0,capture:!0}),window.addEventListener("pointercancel",j,{once:!0,capture:!0}),$=window.setTimeout(j,180)}#DJ(J){if(J.stopPropagation(),J.detail?.value!=="reset-default")return;this.#xJ()}#AJ(){if(this.#T)clearTimeout(this.#T),this.#T=0;this.#F=null}#IJ(){let J=getComputedStyle(this).getPropertyValue("--propskit-slider-elastic-distance").trim();if(J.includes("var(")||!J.endsWith("px")){let Z=document.createElement("div");Object.assign(Z.style,{position:"absolute",visibility:"hidden",pointerEvents:"none",width:"var(--propskit-slider-elastic-distance)"}),this.appendChild(Z),J=getComputedStyle(Z).width,Z.remove()}let Q=Number.parseFloat(J);return Number.isFinite(Q)?Math.max(0,Q):0}#bJ(J){let Q=this.#V;if(!Q||!this.#z){this.#zJ();return}let Z=J<Q.left?J-Q.left:J>Q.right?J-Q.right:0;if(!Z){this.#VJ();return}let $=Math.max(-this.#z,Math.min(this.#z,Z*0.5)),j=Math.abs($),_=this.#R?(this.#R+j)/this.#R:1;this.dataset.elasticDragging="true",this.style.setProperty("--propskit-slider-elastic-size",`${j}px`),this.style.setProperty("--propskit-slider-elastic-scale",`${_}`),this.style.setProperty("--propskit-slider-elastic-origin",$<0?"right center":"left center")}#zJ(){this.#VJ(),this.#z=0,this.#V=null,this.#R=0,this.#y=null}#VJ(){this.removeAttribute("data-elastic-dragging"),this.style.removeProperty("--propskit-slider-elastic-size"),this.style.removeProperty("--propskit-slider-elastic-scale")}#wJ(J){let Q=this.#N;if(!Q)return this.#j?.value??"";let Z=Q.getBoundingClientRect(),$=Z.width?Math.min(1,Math.max(0,(J.clientX-Z.left)/Z.width)):0,j=Number(Q.min||0),_=Number(Q.max||100),X=Q.step==="any"?0:Number(Q.step||1),q=j+(_-j)*$;if(!X)return String(q);let B=Math.round((q-j)/X)*X+j,Y=Math.max(0,`${X}`.split(".")[1]?.length||0);return String(Number(B.toFixed(Y)))}#yJ(){return this.getAttribute("default")??this.#W??this.#N?.min??"0"}#xJ(){this.#AJ(),this.#EJ(this.#yJ(),"input"),this.#EJ(this.#yJ(),"change")}#EJ(J,Q){if(!this.#j||J===null||J===void 0)return;this.#j.value=J,this.setAttribute("value",String(this.#j.value)),K(this,Q)}#pJ(){if(!this.#j)return;let J=this.#j.querySelector("fig-input-number");if(!J)return;if(!(this.hasAttribute("steppers")&&this.getAttribute("steppers")!=="false")){J.removeAttribute("steppers");return}let Z=this.getAttribute("steppers");J.setAttribute("steppers",Z??"")}#gJ(){if(!this.#j)return;if(!this.#A)this.#A=this.#hJ.bind(this,"input");if(!this.#E)this.#E=this.#hJ.bind(this,"change");this.#j.addEventListener("input",this.#A),this.#j.addEventListener("change",this.#E)}#cJ(){if(!this.#j)return;if(this.#A)this.#j.removeEventListener("input",this.#A);if(this.#E)this.#j.removeEventListener("change",this.#E)}#hJ(J,Q){if(Q.stopImmediatePropagation(),O(this,"disabled"))return;if(J==="change")this.#zJ();if(this.#j?.value!==void 0){let Z=String(this.#j.value);if(this.getAttribute("value")!==Z)this.setAttribute("value",Z)}this.#kJ(),K(this,J)}focus(J){this.#YJ();let Q=this.#j?.querySelector('input[type="range"]');Q?.setAttribute("data-propskit-focus-called",""),Q?.focus(J)}get value(){return d(this.getAttribute("value")??this.#j?.value)}set value(J){if(J===null||J===void 0||J===""){if(this.removeAttribute("value"),this.#j)this.#j.value="";return}let Q=String(J);if(this.setAttribute("value",Q),this.#j)this.#j.value=Q}get defaultValue(){return this.#yJ()}get isDefault(){return c(this.value,this.defaultValue)}resetToDefault(){this.#xJ()}}P("propskit-slider",o);class C extends HTMLElement{static#$=33;static#Z=60;static#J=0.55;static#Q=1.5;static#_=80;static#j=4;static#B="fig-input-wheel-dragging";#q=null;#M=null;#X=null;#O=null;#G=null;#Y=null;#k=null;#K=0;#P=0;#U=0;#N=0;#L=0;#T=null;#F=!1;#W=null;#H=0;#z=0;#V=!1;#R=null;#y=0;#h=null;#D=0;#f=0;#w=this.#_J.bind(this);#x=this.#NJ.bind(this);#I=this.#XJ.bind(this);#C=this.#KJ.bind(this);#A=this.#HJ.bind(this);static get observedAttributes(){return["value","disabled","step","min","max","spin"]}connectedCallback(){if(!this.#q)this.#E();if(this.#t(),this.#BJ(),this.#qJ(),this.#T?.disconnect(),globalThis.ResizeObserver)this.#T=new ResizeObserver((J)=>{let Q=J.at(-1)?.contentRect;if(Q)this.#QJ(Q.width,Q.height)}),this.#T.observe(this);this.#r()}disconnectedCallback(){if(this.#T?.disconnect(),this.#U)cancelAnimationFrame(this.#U);this.#U=0,this.#LJ(),this.#MJ(),this.#ZJ()}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#q)return;if(J==="disabled")this.#t();if(J==="value"&&!this.#F)this.#BJ();if(J==="step")this.#o(),this.#r();if(J==="spin")this.#r();if(J==="min"||J==="max")this.#g(this.#S())}#E(){if(this.#q=this,this.#M=this,this.#X=this,this.setAttribute("role","spinbutton"),!this.hasAttribute("aria-label")&&!this.hasAttribute("aria-labelledby"))this.setAttribute("aria-label","Value");this.setAttribute("tabindex","0");let J=h("svg",{className:"fig-input-wheel-svg","aria-hidden":"true"}),Q=G("div",{className:"fig-input-wheel-handle"});this.#O=J,this.replaceChildren(J,Q);let Z=document.createElement("div");Z.setAttribute("aria-hidden","true"),Z.style.cssText="position:absolute;visibility:hidden;pointer-events:none;left:0;top:0";let $=document.createElement("div");$.style.height="var(--fig-input-wheel-tick-height)";let j=document.createElement("div");j.style.height="var(--fig-input-wheel-tick-height-min)";let _=document.createElement("div");_.style.width="var(--fig-input-wheel-tick-width)";let X=document.createElement("div");X.style.width="var(--fig-input-wheel-tick-width-min)",Z.append($,j,_,X),this.append(Z),this.#k={maxEl:$,minEl:j,maxWidthEl:_,minWidthEl:X},this.#c()}#c(){if(!this.#O||this.#G)return;this.#G=h("path",{className:"fig-input-wheel-tick"}),this.#O.append(this.#G)}#u(){if(this.#Y)return this.#Y;return this.#Y={maxH:this.#k?.maxEl.getBoundingClientRect().height||8,minH:this.#k?.minEl.getBoundingClientRect().height||4,maxW:this.#k?.maxWidthEl.getBoundingClientRect().width||2,minW:this.#k?.minWidthEl.getBoundingClientRect().width||1},this.#Y}#b(){if(this.hasAttribute("step")){let J=Number(this.getAttribute("step"));if(J>0)return J}return 1}#S(){let J=Number(this.getAttribute("value")??0);return Number.isFinite(J)?J:0}#jJ(J){if(!this.hasAttribute(J))return null;let Q=this.getAttribute(J);if(Q===null||Q.trim()==="")return null;let Z=Number(Q);return Number.isFinite(Z)?Z:null}#p(){return this.#jJ("min")}#m(){return this.#jJ("max")}#i(J,Q){if(Q===null||Q===void 0||Q===""){this.removeAttribute(J);return}let Z=Number(Q);if(!Number.isFinite(Z)){this.removeAttribute(J);return}this.setAttribute(J,String(Z))}#a(J){let Q=J,Z=this.#p(),$=this.#m();if(Z!==null)Q=Math.max(Z,Q);if($!==null)Q=Math.min($,Q);return Q}#s(J){let Q=this.#b();if(Q<=0)return J;let Z=this.#p()??0,$=Math.round((J-Z)/Q)*Q+Z;return Number($.toPrecision(15))}#g(J,{snap:Q=!1,emit:Z=null}={}){let $=Q?this.#s(J):J;$=this.#a($);let j=String($);if(this.getAttribute("value")!==j)this.setAttribute("value",j);if(this.#o($),this.#r(),Z)this.dispatchEvent(new CustomEvent(Z,{detail:$,bubbles:!0,cancelable:!0,composed:!0}))}#BJ(){let J=this.#S(),Q=this.#a(J);if(Q!==J||this.getAttribute("value")!==String(Q)){this.#g(Q);return}this.#o(J),this.#r()}#o(J=this.#S()){if(!this.#X)return;let Q=this.#p(),Z=this.#m();if(this.#X.setAttribute("aria-valuenow",String(J)),this.#X.setAttribute("aria-valuetext",String(J)),Q===null)this.#X.removeAttribute("aria-valuemin");else this.#X.setAttribute("aria-valuemin",String(Q));if(Z===null)this.#X.removeAttribute("aria-valuemax");else this.#X.setAttribute("aria-valuemax",String(Z))}#t(){let J=O(this,"disabled");if(!this.#X)return;if(J){if(this.#F)this.#ZJ();this.#LJ(),this.setAttribute("aria-disabled","true"),this.#X.setAttribute("tabindex","-1"),this.#X.setAttribute("aria-disabled","true")}else this.removeAttribute("aria-disabled"),this.#X.setAttribute("tabindex","0"),this.#X.removeAttribute("aria-disabled")}#QJ(J,Q){if(!this.#O||J<1||Q<1)return;if(J===this.#K&&Q===this.#P)return;this.#K=J,this.#P=Q,this.#Y=null,this.#O.setAttribute("viewBox",`0 0 ${J} ${Q}`),this.#O.setAttribute("width",String(J)),this.#O.setAttribute("height",String(Q)),this.#r()}#r(){if(this.#U)return;this.#U=requestAnimationFrame(()=>{if(!this.isConnected){this.#U=0;return}if(this.#K<1||this.#P<1){let J=this.#X?.getBoundingClientRect();if(J)this.#QJ(J.width,J.height)}this.#kJ(),this.#U=0})}#kJ(){if(!this.#G)return;let J=this.#K,Q=this.#P;if(J<1||Q<1)return;let Z=this.getAttribute("spin")==="false"?this.#p()??0:this.#R??this.#S(),$=360/C.#$,j=this.#b(),_=this.#p()??0,X=(Z-_)/j*$,q=C.#J,B=J/2,Y=Q/2,{maxH:M,minH:k,maxW:N,minW:U}=this.#u(),L=C.#Z,T=Math.max(J/2,1),V=T*0.84,I=[];for(let A=0;A<C.#$;A+=1){let z=X+A*$;if(z=((z+180)%360+360)%360-180,z<-L||z>=L)continue;let b=z*Math.PI/180,E=B+V*Math.sin(b)/(1-q*Math.cos(b)),y=Math.min(1,Math.abs(E-B)/Math.max(T,1)),w=Math.cos(y*Math.PI*0.5),x=k+(M-k)*w,e=U+(N-U)*w,a=x/2,p=e/2,g=Y-a,r=Y+a,JJ=E-p,QJ=E+p;I.push(`M ${E} ${g} Q ${QJ} ${g} ${QJ} ${g+p} V ${r-p} Q ${QJ} ${r} ${E} ${r} Q ${JJ} ${r} ${JJ} ${r-p} V ${g+p} Q ${JJ} ${g} ${E} ${g} Z`)}this.#G.setAttribute("d",I.join(" "))}#qJ(){this.#q?.addEventListener("pointerdown",this.#w),this.#X?.addEventListener("wheel",this.#C,{passive:!1}),this.#X?.addEventListener("keydown",this.#A)}#MJ(){this.#q?.removeEventListener("pointerdown",this.#w),this.#X?.removeEventListener("wheel",this.#C),this.#X?.removeEventListener("keydown",this.#A),window.removeEventListener("pointermove",this.#x),window.removeEventListener("pointerup",this.#I),window.removeEventListener("pointercancel",this.#I)}#_J(J){if(O(this,"disabled"))return;if(J.button!==0)return;if(J.preventDefault(),!this.beginScrub(J))return;this.#q?.setPointerCapture?.(J.pointerId),window.addEventListener("pointermove",this.#x),window.addEventListener("pointerup",this.#I),window.addEventListener("pointercancel",this.#I)}beginScrub(J={}){if(O(this,"disabled"))return!1;let Q=typeof J==="number"?J:Number(J?.clientX??J?.x);if(!Number.isFinite(Q))return!1;this.#LJ(),this.#F=!0,this.#W=J&&typeof J==="object"&&J.pointerId!==void 0?J.pointerId:null,this.#H=Q;let Z=J&&typeof J==="object"?Number(J.startValue):Number.NaN;return this.#z=Number.isFinite(Z)?this.#a(Z):this.#S(),this.#V=!1,this.#WJ(Q),this.#OJ(),this.setAttribute("data-fig-input-wheel-active",""),document.body.classList.remove(C.#B),this.focus(),!0}updateScrub(J,Q){if(!this.#F)return this.#S();let Z=typeof J==="number"?J:Number(J?.clientX??J?.x);if(!Number.isFinite(Z))return this.#S();let $=Q??(typeof J==="object"&&J?.shiftKey?10:1);return this.#n(Z,$),this.#S()}endScrub(J=!0){if(!this.#F)return this.#S();if(J&&this.#S()!==this.#z)this.#g(this.#S(),{snap:!0,emit:"change"});return this.#ZJ(),this.#S()}#NJ(J){if(!this.#F)return;if(this.#W!==null&&J.pointerId!==this.#W)return;this.updateScrub(J)}#n(J,Q=1){if(!this.#V&&Math.abs(J-this.#H)>=C.#j)this.#V=!0,document.body.classList.add(C.#B);let Z=this.#X?.clientWidth||1,$=C.#$*(C.#Z*2/360),j=this.#b()*$,_=(J-this.#H)*(j/Z)*Q,X=this.#R??this.#z,q=this.#a(this.#z+_);this.#d(J,Q,q!==X),this.#R=q,this.#g(q,{snap:!0,emit:"input"}),this.#SJ(J)}#XJ(J){if(!this.#F)return;if(this.#W!==null&&J.pointerId!==this.#W)return;this.endScrub()}#ZJ(){this.#F=!1,this.#W=null,this.#V=!1,this.#R=null,this.removeAttribute("data-fig-input-wheel-active"),document.body.classList.remove(C.#B),this.#UJ(),this.#$J(),window.removeEventListener("pointermove",this.#x),window.removeEventListener("pointerup",this.#I),window.removeEventListener("pointercancel",this.#I),this.#r()}#OJ(){this.#$J(),this.#y=this.#e("--fig-input-wheel-handle-drag-max")}#e(J){let Q=getComputedStyle(this).getPropertyValue(J).trim();if(Q.includes("var(")||!Q.endsWith("px")){let $=document.createElement("div");Object.assign($.style,{position:"absolute",visibility:"hidden",pointerEvents:"none",width:`var(${J})`}),this.appendChild($),Q=getComputedStyle($).width,$.remove()}let Z=Number.parseFloat(Q);return Number.isFinite(Z)?Math.max(0,Z):0}#SJ(J){if(!this.#y){this.#YJ();return}let Q=J-this.#H;if(!Q){this.#YJ();return}let Z=this.#y*Math.tanh(Q/Math.max(1,this.#y*3));this.style.setProperty("--fig-input-wheel-handle-drag-offset",`${Z}px`)}#$J(){this.#YJ(),this.#y=0}#YJ(){this.style.removeProperty("--fig-input-wheel-handle-drag-offset")}#WJ(J){this.#UJ(),this.#h=J,this.#D=performance.now()}#d(J,Q,Z){let $=performance.now(),j=$-this.#D,_=this.#h===null?0:Math.abs(J-this.#h);this.#h=J,this.#D=$;let X=j>0?_/j*Math.max(1,Math.abs(Q)):0;if(!Z||X<C.#Q){this.#JJ();return}this.toggleAttribute("data-fig-input-wheel-fast",!0),clearTimeout(this.#f),this.#f=window.setTimeout(()=>{this.#JJ()},C.#_)}#UJ(){this.#h=null,this.#D=0,this.#JJ()}#JJ(){clearTimeout(this.#f),this.#f=0,this.removeAttribute("data-fig-input-wheel-fast")}#KJ(J){if(O(this,"disabled"))return;J.preventDefault();let Q=J.deltaY===0?Math.sign(J.deltaX):Math.sign(J.deltaY);if(!Q)return;let Z=J.shiftKey?10:1;this.#g(this.#S()+this.#b()*Z*Q,{snap:!0,emit:"input"}),this.#g(this.#S(),{emit:"change"})}#HJ(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number"))return;if(J.key==="Home"){let _=this.#p();if(_===null)return;J.preventDefault(),this.#g(_,{snap:!0,emit:"input"}),this.#g(this.#S(),{emit:"change"});return}if(J.key==="End"){let _=this.#m();if(_===null)return;J.preventDefault(),this.#g(_,{snap:!0,emit:"input"}),this.#g(this.#S(),{emit:"change"});return}if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(J.key))return;J.preventDefault();let Z=J.key==="ArrowRight"||J.key==="ArrowUp"?1:-1,$=J.shiftKey?10:1,j=this.#S();this.#g(j+this.#b()*$*Z,{snap:!0,emit:"input"}),this.#TJ(j,this.#S(),Z,$),this.#g(this.#S(),{emit:"change"})}#TJ(J,Q,Z,$,j=!0){if(J===Q||globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches){this.#LJ();return}if(this.#N)cancelAnimationFrame(this.#N),this.#N=0;clearTimeout(this.#L),this.#L=0,this.removeAttribute("data-fig-input-wheel-keyboard-settling");let _=this.#R??J,X=Number.parseFloat(this.style.getPropertyValue("--fig-input-wheel-handle-drag-offset"))||0,q=$>1?120:90,B=performance.now(),Y=j;this.setAttribute("data-fig-input-wheel-keyboard-moving","");let M=(k)=>{let N=Math.min(1,(k-B)/q);if(this.#R=_+(Q-_)*N,Y){let U=Math.sin(N*Math.PI/2),L=X+(Z*4-X)*U;this.style.setProperty("--fig-input-wheel-handle-drag-offset",`${L}px`)}if(this.#kJ(),N<1){this.#N=requestAnimationFrame(M);return}this.#N=0,this.#R=null,this.removeAttribute("data-fig-input-wheel-keyboard-moving"),this.setAttribute("data-fig-input-wheel-keyboard-settling",""),this.style.removeProperty("--fig-input-wheel-handle-drag-offset"),this.#L=window.setTimeout(()=>{this.removeAttribute("data-fig-input-wheel-keyboard-settling"),this.#L=0},140),this.#r()};this.#N=requestAnimationFrame(M)}#LJ(){if(this.#N)cancelAnimationFrame(this.#N),this.#N=0;if(clearTimeout(this.#L),this.#L=0,this.#R=null,this.removeAttribute("data-fig-input-wheel-keyboard-moving"),this.removeAttribute("data-fig-input-wheel-keyboard-settling"),this.style.removeProperty("--fig-input-wheel-handle-drag-offset"),this.isConnected)this.#r()}get value(){return this.getAttribute("value")??"0"}set value(J){if(J===null||J===void 0||J===""){this.#g(0);return}let Q=Number(J);this.#g(Number.isFinite(Q)?Q:0)}spinTo(J,{animateHandle:Q=!1}={}){let Z=this.#S();this.value=J;let $=this.#S();if(this.getAttribute("spin")==="false")return this.#LJ(),$;let j=Math.sign($-Z);return this.#TJ(Z,$,j,Math.abs($-Z)>this.#b()?10:1,Q),$}get min(){return this.#p()}set min(J){this.#i("min",J)}get max(){return this.#m()}set max(J){this.#i("max",J)}get step(){return this.#b()}focus(J){HTMLElement.prototype.focus.call(this,J)}}P("fig-input-wheel",C);class l extends S{static#$=new Set(["label","size","disabled","variant","elastic","spin","text","default","class","style","id","oninput","onchange"]);static get observedAttributes(){return["label","aria-label","units","value","disabled","step","precision","min","max","elastic","spin","text"]}#Z=null;#J=null;#Q=null;#_=null;#j=!1;#B=null;#q=new Set;#M=null;#X=null;#O=0;#G=null;#Y=0;#k=null;#K=null;#P=0;#U=0;#N=0;#L=!1;#T=!1;#F=0;#W=!1;#H=this.#r.bind(this,"input");#z=this.#r.bind(this,"change");#V=this.#kJ.bind(this,"input");#R=this.#kJ.bind(this,"change");#y=this.#qJ.bind(this);#h=this.#WJ.bind(this);#D=this.#d.bind(this);#f=this.#UJ.bind(this);#w=this.#MJ.bind(this);#x=this.#_J.bind(this);#I=this.#NJ.bind(this);#C=this.#ZJ.bind(this);#A=this.#OJ.bind(this);#E=this.#KJ.bind(this);connectedCallback(){if(!this.#Z)this.#c();this.#u(),this.#b(),this.#jJ(),this.#g(),this.#BJ(),W(this),this.#B?.disconnect(),this.#B=new MutationObserver((J)=>{if(J.some(({type:Q,attributeName:Z})=>Q==="attributes"&&Z&&!l.#$.has(Z)&&!l.observedAttributes.includes(Z)&&!Z.startsWith("data-")))this.#g()}),this.#B.observe(this,{attributes:!0})}disconnectedCallback(){this.#B?.disconnect(),this.#n(),this.#$J(),this.#o(),this.#JJ(),clearTimeout(this.#F),this.#F=0,this.#J?.endScrub(!1),R(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="aria-label")this.#u();if(J==="text")this.#b();if(J==="elastic"&&Z==="false")this.#$J();if(["units","value","disabled","step","min","max","elastic","spin"].includes(J))this.#jJ();if(["units","value","disabled","step","precision","min","max"].includes(J))this.#g()}#c(){this.#M=this.getAttribute("value")??"0";let J=Array.from(this.childNodes).filter((X)=>X.nodeType!==Node.TEXT_NODE||Boolean(X.textContent?.trim())),Q=J.find((X)=>X.nodeType===Node.ELEMENT_NODE&&X.matches("label")),Z=G("div",{className:"propskit-wheel-surface"}),$=Q||document.createElement("label"),j=document.createElement("fig-input-wheel"),_=document.createElement("fig-input-number");Z.append($,j,_),this.#Z=Z,this.#J=j,this.#Q=$,this.#_=_,this.#j=Boolean(Q),this.replaceChildren(Z);for(let X of J)if(X!==Q)_.appendChild(X)}#u(){let J=f(this,this.#Z,this.#Q,this.#j);H(this,this.#J,J,"Wheel"),H(this,this.#_,J,"Number")}#b(){if(!this.#Z||!this.#_)return;let J=this.getAttribute("text")!=="false",Q=this.#_.parentElement===this.#Z;if(J&&!Q)this.#Z.append(this.#_);else if(!J&&Q)this.#_.remove()}#S(J){if(!this.#J)return;if(this.hasAttribute(J))this.#J.setAttribute(J,this.getAttribute(J)??"");else this.#J.removeAttribute(J)}#jJ(){if(!this.#J)return;this.#J.removeAttribute("units");for(let $ of["min","max","spin"])this.#S($);if(this.hasAttribute("step"))this.#S("step");else this.#J.setAttribute("step",String(this.#i()));this.#J.toggleAttribute("disabled",O(this,"disabled"));let J=d(this.getAttribute("value"));this.#J.value=J??0;let Q=String(this.#J.value);if(J!==null&&this.getAttribute("value")!==Q)this.setAttribute("value",Q);let Z=J===null?"":Q;if(this.#_?.getAttribute("value")!==Z)this.#_?.setAttribute("value",Z);this.#s()}#p(){return this.getAttributeNames().filter((J)=>!l.#$.has(J)&&!l.observedAttributes.includes(J)&&!J.startsWith("data-"))}#m(){let J=(this.getAttribute("units")||"").trim(),Q=J.toLowerCase();if(Q==="ms"||Q==="millisecond"||Q==="milliseconds")return"ms";if(Q==="s"||Q==="second"||Q==="seconds")return"s";return J}#i(){let J=this.#m();if(J==="s")return 0.1;if(J==="ms")return 100;return 1}#a(){return this.#m()==="s"?2:0}#s(){if(!this.#J)return;let J=Number(this.#J.value),Q=this.#m();this.#J.setAttribute("aria-valuetext",Q?`${J} ${Q==="s"?"seconds":Q==="ms"?"milliseconds":Q}`:String(J))}#g(){if(!this.#_||!this.#J)return;let J=this.#p(),Q=new Set(J);for(let $ of this.#q)if(!Q.has($))this.#_.removeAttribute($);for(let $ of J)this.#_.setAttribute($,this.getAttribute($)??"");let Z=this.#m();if(Z)this.#_.setAttribute("units",Z);else this.#_.removeAttribute("units");if(this.#_.setAttribute("step",String(this.#J.step)),this.hasAttribute("precision"))this.#_.setAttribute("precision",this.getAttribute("precision")??"");else this.#_.setAttribute("precision",String(this.#a()));for(let $ of["min","max"]){let j=this.#J[$];if(j===null)this.#_.removeAttribute($);else this.#_.setAttribute($,String(j))}this.#_.toggleAttribute("disabled",O(this,"disabled")),this.#_.setAttribute("value",String(this.value??"")),this.#q=Q}#BJ(){this.#o(),this.#J?.addEventListener("input",this.#H),this.#J?.addEventListener("change",this.#z),this.#_?.addEventListener("input",this.#V),this.#_?.addEventListener("change",this.#R),this.#_?.addEventListener("keydown",this.#y,{capture:!0}),this.addEventListener("pointerdown",this.#w,{capture:!0}),this.addEventListener("pointerdown",this.#h,{capture:!0}),this.addEventListener("click",this.#E,!0)}#o(){this.#J?.removeEventListener("input",this.#H),this.#J?.removeEventListener("change",this.#z),this.#_?.removeEventListener("input",this.#V),this.#_?.removeEventListener("change",this.#R),this.#_?.removeEventListener("keydown",this.#y,{capture:!0}),this.removeEventListener("pointerdown",this.#w,{capture:!0}),this.removeEventListener("pointerdown",this.#h,{capture:!0}),this.removeEventListener("click",this.#E,!0)}#t(J,{spin:Q=!1,animateHandle:Z=!1}={}){let $=d(J);if($===null){if(this.removeAttribute("value"),this.#J)this.#J.value=0;return this.#_?.setAttribute("value",""),this.#s(),null}if(!this.#J)return this.setAttribute("value",String($)),$;if(Q)this.#J.spinTo($,{animateHandle:Z});else this.#J.value=$;let j=this.#J.value;if(this.getAttribute("value")!==j)this.setAttribute("value",j);if(this.#_?.getAttribute("value")!==j)this.#_?.setAttribute("value",j);return this.#s(),Number(j)}#QJ(J){K(this,J)}#r(J,Q){Q.stopImmediatePropagation(),this.#t(Q.detail),this.#QJ(J)}#kJ(J,Q){if(Q.stopImmediatePropagation(),O(this,"disabled"))return;let Z=Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:this.#_?.value;if(this.#t(Z,{spin:J==="input",animateHandle:J==="input"&&this.#W}),J==="input")this.#W=!1;this.#QJ(J)}#qJ(J){this.#W=!O(this,"disabled")&&(J.key==="ArrowUp"||J.key==="ArrowDown"),window.setTimeout(()=>{this.#W=!1},0)}#MJ(J){if(J.button!==0||O(this,"disabled")||!(J.target instanceof Element)||J.target.closest("fig-input-number")||J.target.closest(".propskit-wheel-surface")!==this.#Z)return;if(J.preventDefault(),J.stopImmediatePropagation(),this.#n(),!this.#J?.beginScrub({clientX:J.clientX,pointerId:J.pointerId,startValue:Number(this.#J.value)}))return;this.#k=J.pointerId,this.#XJ(J.pointerId),window.addEventListener("pointermove",this.#x),window.addEventListener("pointerup",this.#I),window.addEventListener("pointercancel",this.#I),window.addEventListener("blur",this.#I)}#_J(J){if(J.pointerId!==this.#k)return;if(J.buttons===0){this.#NJ(J);return}this.#J?.updateScrub(J)}#NJ(J){if(J?.pointerId!==void 0&&this.#k!==null&&J.pointerId!==this.#k)return;this.#J?.endScrub(),this.#n(),this.#$J()}#n(){window.removeEventListener("pointermove",this.#x),window.removeEventListener("pointerup",this.#I),window.removeEventListener("pointercancel",this.#I),window.removeEventListener("blur",this.#I),this.#k=null}#XJ(J){if(this.#$J(),this.getAttribute("elastic")==="false")return;this.#X=J,this.#O=this.#SJ("--propskit-wheel-elastic-distance");let Q=this.getBoundingClientRect();if(Q)this.#G={left:Q.left,right:Q.right};this.#Y=this.getBoundingClientRect().width,window.addEventListener("pointermove",this.#C,{passive:!0}),window.addEventListener("pointerup",this.#A),window.addEventListener("pointercancel",this.#A),window.addEventListener("blur",this.#A)}#ZJ(J){if(J.pointerId!==this.#X)return;if(J.buttons===0){this.#OJ(J);return}this.#e(J.clientX)}#OJ(J){if(J?.pointerId!==void 0&&this.#X!==null&&J.pointerId!==this.#X)return;this.#$J()}#e(J){let Q=this.#G;if(!Q||!this.#O){this.#YJ();return}let Z=J<Q.left?J-Q.left:J>Q.right?J-Q.right:0;if(!Z){this.#YJ();return}let $=Math.min(this.#O,Math.abs(Z)*0.5),j=this.#Y?(this.#Y+$)/this.#Y:1;this.toggleAttribute("data-propskit-wheel-elastic-dragging",!0),this.style.setProperty("--propskit-wheel-elastic-scale",String(j)),this.style.setProperty("--propskit-wheel-elastic-origin",Z<0?"right center":"left center")}#SJ(J){let Q=getComputedStyle(this).getPropertyValue(J).trim();if(Q.includes("var(")||!Q.endsWith("px")){let $=document.createElement("div");Object.assign($.style,{position:"absolute",visibility:"hidden",pointerEvents:"none",width:`var(${J})`}),this.appendChild($),Q=getComputedStyle($).width,$.remove()}let Z=Number.parseFloat(Q);return Number.isFinite(Z)?Math.max(0,Z):0}#$J(){window.removeEventListener("pointermove",this.#C),window.removeEventListener("pointerup",this.#A),window.removeEventListener("pointercancel",this.#A),window.removeEventListener("blur",this.#A),this.#X=null,this.#O=0,this.#G=null,this.#Y=0,this.#YJ()}#YJ(){this.removeAttribute("data-propskit-wheel-elastic-dragging"),this.style.removeProperty("--propskit-wheel-elastic-scale"),this.style.removeProperty("--propskit-wheel-elastic-origin")}#WJ(J){if(J.button!==0||J.altKey||O(this,"disabled")||!(J.target instanceof Element))return;let Q=J.target.closest("fig-input-number input");if(!Q||Q===document.activeElement)return;J.preventDefault(),J.stopImmediatePropagation(),this.#JJ(),this.#K=J.pointerId,this.#P=J.clientX,this.#U=J.clientY,this.#N=Number(this.#J?.value??0),window.addEventListener("pointermove",this.#D),window.addEventListener("pointerup",this.#f,{once:!0}),window.addEventListener("pointercancel",this.#f,{once:!0}),window.addEventListener("blur",this.#f,{once:!0})}#d(J){if(J.pointerId!==this.#K)return;if(J.buttons===0){this.#UJ(J);return}if(!this.#L){if(Math.hypot(J.clientX-this.#P,J.clientY-this.#U)<4)return;this.#L=!0,this.setAttribute("data-number-scrubbing",""),this.#XJ(J.pointerId),this.#J?.beginScrub({clientX:this.#P,pointerId:J.pointerId,startValue:this.#N})}this.#J?.updateScrub(J),this.#e(J.clientX)}#UJ(J){if(J?.pointerId!==void 0&&this.#K!==null&&J.pointerId!==this.#K)return;let Q=this.#L;if(this.#$J(),this.#JJ(),Q){this.#J?.endScrub(),this.#T=!0,clearTimeout(this.#F),this.#F=window.setTimeout(()=>{this.#T=!1,this.#F=0},0),requestAnimationFrame(()=>this.#J?.focus());return}this.#_?.querySelector("input")?.focus()}#JJ(){window.removeEventListener("pointermove",this.#D),window.removeEventListener("pointerup",this.#f),window.removeEventListener("pointercancel",this.#f),window.removeEventListener("blur",this.#f),this.#K=null,this.#L=!1,this.removeAttribute("data-number-scrubbing")}#KJ(J){if(O(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number, fig-menu")){if(this.#T&&J.target.closest("fig-input-number"))J.preventDefault(),J.stopImmediatePropagation(),this.#T=!1;return}if(!(J.target instanceof Element)||!J.target.closest("fig-input-wheel"))this.#J?.focus()}get value(){return d(this.getAttribute("value"))}set value(J){this.#t(J)}get min(){return this.#J?.min??null}set min(J){if(J===null||J===void 0||J==="")this.removeAttribute("min");else{let Q=Number(J);if(Number.isFinite(Q))this.setAttribute("min",String(Q));else this.removeAttribute("min")}}get max(){return this.#J?.max??null}set max(J){if(J===null||J===void 0||J==="")this.removeAttribute("max");else{let Q=Number(J);if(Number.isFinite(Q))this.setAttribute("max",String(Q));else this.removeAttribute("max")}}get defaultValue(){return this.getAttribute("default")??this.#M??"0"}get isDefault(){return c(this.value,this.defaultValue)}resetToDefault(){this.#t(this.defaultValue),D(this)}focus(J){this.#J?.focus(J)}}P("propskit-wheel",l);class xJ extends HTMLElement{static observedAttributes=["type","value","color","name","tooltips","disabled","drag-surface","snapping","precision"];#$=50;#Z=50;#J=75;#Q=75;#_=0;#j=!1;#B=0;#q=null;#M=null;#X=null;#O=null;#G=null;#Y=null;#k=null;#K=null;#P=null;#U=!1;#N=!1;#L=!1;#T=!1;#F=null;#W="";#H="";#z=null;#V=null;#R=null;#y="";#h="";#D=null;#f=null;#w=null;get#x(){return this.getAttribute("type")||"point"}get#I(){return this.#x==="point-radius"||this.#x==="point-radius-angle"}get#C(){return this.#x==="point-radius-angle"}get#A(){return this.#x==="point-point"}get#E(){return this.#x==="point-radius-angle"||this.#x==="point-point"}get#c(){let J=this.getAttribute("tooltips");return J===null||J!=="false"}get#u(){let J=this.getAttribute("snapping");if(J===null)return"false";let Q=J.trim().toLowerCase();if(Q==="modifier")return"modifier";if(Q===""||Q==="true")return"true";return"false"}get#b(){let J=Number(this.getAttribute("precision")??2);if(!Number.isFinite(J))return 2;return Math.max(0,Math.min(8,Math.trunc(J)))}#S(J){let Q=10**this.#b,Z=Math.round(J*Q)/Q;return Object.is(Z,-0)?0:Z}#jJ(){let J=this.getAttribute("precision");for(let Q of[this.#q,this.#X,this.#M]){if(!Q)continue;if(J===null)Q.removeAttribute("precision");else Q.setAttribute("precision",String(this.#b))}}#p(J){let Q=this.#u;if(Q==="true")return!0;if(Q==="modifier")return!!J;return!1}get#m(){let J=this.getAttribute("name");if(J)return J.split(",")[0].trim();return`${this.#S(this.#$)}%, ${this.#S(this.#Z)}%`}get#i(){let J=this.getAttribute("name");if(J){let Q=J.split(",");if(Q.length>1)return Q[1].trim()}return`${this.#S(this.#J)}%, ${this.#S(this.#Q)}%`}get#a(){return this.getAttribute("drag-surface")||"parent"}get#s(){let J=this.#a;if(J==="parent")return this.parentElement;return this.closest(J)}get#g(){let J=this.#a;if(J==="parent"){let Q=this.parentElement;if(Q)return Q.setAttribute("data-fig-canvas-control-surface",""),"[data-fig-canvas-control-surface]"}return J}#BJ(J){if(this.#j)return this.#_/100*J;return this.#_}#o(){let J=this.#S(this.#_);if(this.#j)return`Radius ${J}%`;return`Radius ${J}`}connectedCallback(){this.#t(),this.#QJ()}disconnectedCallback(){this.#VJ(),this.#bJ(),this.#qJ(),this.#n(),document.body.classList.remove("fig-lab-move-active"),document.body.classList.remove("fig-lab-rotate-active")}attributeChangedCallback(J,Q,Z){if(Q===Z)return;if(J==="value"&&!this.#U&&!this.#N&&!this.#L&&!this.#T)if(this.#t(),this.#q)this.#l();else this.#QJ();if(J==="type")this.#VJ(),this.#t(),this.#QJ();if(J==="color"&&this.#q)if(Z)this.#q.setAttribute("color",Z);else this.#q.removeAttribute("color");if(J==="disabled")this.#VJ(),this.#QJ();if(J==="tooltips")this.#QJ();if(J==="snapping"&&this.#q){if(this.#q.setAttribute("drag-snapping",Z||"false"),this.#M)this.#M.setAttribute("drag-snapping",Z||"false")}if(J==="precision"){if(!this.isConnected)return;this.#jJ(),this.#$=this.#S(this.#$),this.#Z=this.#S(this.#Z),this.#J=this.#S(this.#J),this.#Q=this.#S(this.#Q),this.#_=this.#S(this.#_),this.#B=this.#S(this.#B),this.#l(),this.#v()}if(J==="name"){if(this.#Y)this.#Y.setAttribute("text",this.#m);if(this.#k)this.#k.setAttribute("text",this.#i)}}#t(){let J=this.getAttribute("value");if(!J)return;try{let Q=JSON.parse(J);if(typeof Q.x==="number")this.#$=this.#S(Q.x);if(typeof Q.y==="number")this.#Z=this.#S(Q.y);if(Q.radius!==void 0){let Z=String(Q.radius);if(Z.endsWith("%"))this.#j=!0,this.#_=this.#S(parseFloat(Z));else this.#j=!1,this.#_=this.#S(parseFloat(Z));if(!Number.isFinite(this.#_))this.#_=0}if(typeof Q.angle==="number")this.#B=this.#S(Q.angle);if(typeof Q.x2==="number")this.#J=this.#S(Q.x2);if(typeof Q.y2==="number")this.#Q=this.#S(Q.y2);if(this.#x==="color"&&typeof Q.color==="string"&&Q.color.trim()&&this.getAttribute("color")!==Q.color.trim())this.setAttribute("color",Q.color.trim())}catch{}}get value(){let J={x:this.#S(this.#$),y:this.#S(this.#Z)};if(this.#x==="color"){let Q=this.getAttribute("color")||this.#q?.getAttribute("color");if(Q)J.color=Q}if(this.#I){let Q=this.#S(this.#_);J.radius=this.#j?`${Q}%`:Q}if(this.#C)J.angle=this.#S(this.#B);if(this.#A)J.x2=this.#S(this.#J),J.y2=this.#S(this.#Q);return J}set value(J){if(typeof J==="object")this.setAttribute("value",JSON.stringify(J));else if(typeof J==="string")this.setAttribute("value",J)}#QJ(){this.#VJ(),this.replaceChildren(),this.#q=null,this.#M=null,this.#X=null,this.#O=null,this.#G=null,this.#Y=null,this.#k=null,this.#K=null,this.#P=null;let J=O(this,"disabled"),Q=this.#x,Z=this.#c,$=this.#g,j=document.createElement("fig-handle");if(j.setAttribute("drag","true"),j.setAttribute("drag-surface",$),j.setAttribute("drag-axes","x,y"),j.setAttribute("drag-snapping",this.#u),j.setAttribute("value",`${this.#$}% ${this.#Z}%`),this.hasAttribute("precision"))j.setAttribute("precision",String(this.#b));if(J)j.setAttribute("disabled","");if(Q==="color"){j.setAttribute("type","color");let _=this.getAttribute("color");if(_)j.setAttribute("color",_)}else j.setAttribute("type","canvas");if(this.#A)j.setAttribute("hit-area","12 circle"),j.setAttribute("hit-area-mode","delegate");if(this.#q=j,this.#I)this.#$J();if(this.#E)this.#YJ();if(Z){let _=document.createElement("fig-tooltip");_.setAttribute("action","manual"),_.setAttribute("theme","canvas"),_.setAttribute("pointer","false"),_.setAttribute("text",this.#m),_.appendChild(j),this.appendChild(_),this.#Y=_}else this.appendChild(j);if(this.#C)this.#d(J,Z,$);if(this.#A)this.#UJ(J,Z,$);this.#r(this.#q),this.#r(this.#X),this.#r(this.#M),this.#DJ(),this.#OJ(),requestAnimationFrame(()=>this.#l())}#r(J){if(!J)return;J.addEventListener("pointerdown",(Q)=>{if(Q.target?.classList?.contains("fig-handle-hit-area")&&J.querySelector(".fig-handle-hit-area"))this.#NJ(Q,J);else this.#kJ(Q)},{capture:!0})}#kJ(J){if(O(this,"disabled"))return;if(J?.button!==void 0&&J.button!==0)return;if(J?.isPrimary===!1)return;if(this.#F===null)this.#W=document.body.style.getPropertyValue("cursor"),this.#H=document.body.style.getPropertyPriority("cursor");if(this.#F=J?.pointerId??-1,document.body.classList.add("fig-lab-move-active"),document.body.style.setProperty("cursor","var(--fig-lab-cursor-move)","important"),!this.#z)this.#z=(Q)=>{if(Q?.pointerId!==void 0&&this.#F!==null&&Q.pointerId!==this.#F)return;if(Q?.type==="blur")this.#qJ();else requestAnimationFrame(()=>this.#qJ())};window.addEventListener("pointerup",this.#z),window.addEventListener("pointercancel",this.#z),window.addEventListener("blur",this.#z)}#qJ(){if(this.#F===null)return;if(document.body.classList.remove("fig-lab-move-active"),this.#W)document.body.style.setProperty("cursor",this.#W,this.#H);else document.body.style.removeProperty("cursor");if(this.#F=null,this.#W="",this.#H="",this.#z)window.removeEventListener("pointerup",this.#z),window.removeEventListener("pointercancel",this.#z),window.removeEventListener("blur",this.#z)}#MJ(J){if(!J)return 0;if(J===this.#X)return this.#B;if(!this.#A)return 0;let Q=this.#FJ();return J===this.#q?Q+180:Q}#_J(){if(this.#V===null)return;let J=this.#KJ(this.#MJ(this.#R));document.body.style.setProperty("--fig-lab-cursor-rotate",J),document.body.style.setProperty("cursor",J,"important")}#NJ(J,Q){if(O(this,"disabled"))return;if(J?.button!==void 0&&J.button!==0)return;if(J?.isPrimary===!1)return;if(this.#V===null)this.#y=document.body.style.getPropertyValue("cursor"),this.#h=document.body.style.getPropertyPriority("cursor");if(this.#V=J?.pointerId??-1,this.#R=Q,document.body.classList.add("fig-lab-rotate-active"),this.#_J(),!this.#D)this.#D=(Z)=>{if(Z?.pointerId!==void 0&&this.#V!==null&&Z.pointerId!==this.#V)return;if(Z?.type==="blur")this.#n();else requestAnimationFrame(()=>this.#n())};window.addEventListener("pointerup",this.#D),window.addEventListener("pointercancel",this.#D),window.addEventListener("blur",this.#D)}#n(){if(this.#V===null)return;if(document.body.classList.remove("fig-lab-rotate-active"),document.body.style.removeProperty("--fig-lab-cursor-rotate"),this.#y)document.body.style.setProperty("cursor",this.#y,this.#h);else document.body.style.removeProperty("cursor");if(this.#V=null,this.#R=null,this.#y="",this.#h="",this.#D)window.removeEventListener("pointerup",this.#D),window.removeEventListener("pointercancel",this.#D),window.removeEventListener("blur",this.#D)}#XJ(J,Q,Z,$){if(!J)return;let j=()=>!!$?.(),_=()=>{let B=Q();if(!B)return;B.removeAttribute("show"),B.hidePopup?.()},X=()=>{if(j()){_();return}let B=Q();if(!B)return;if(Z)B.setAttribute("text",Z());B.setAttribute("show","true"),B.showPopup?.()},q=()=>{_()};J.addEventListener("pointerenter",X),J.addEventListener("pointerleave",q)}#ZJ(){return this.#U||this.#N||this.#L||this.#T}#OJ(){if(this.#q)this.#XJ(this.#q,()=>this.#Y,()=>this.#m,()=>this.#ZJ()||!!this.#q?.querySelector("fig-color-tip"));if(this.#X)this.#XJ(this.#X,()=>this.#P,()=>`Angle ${this.#S(this.#B)}°`,()=>this.#ZJ());if(this.#M)this.#XJ(this.#M,()=>this.#k,()=>this.#i,()=>this.#ZJ());if(this.#O){let J=this.#O.querySelector(".fig-canvas-control-radius-hit");this.#SJ(J||this.#O)}if(this.#x==="color"&&this.#q&&this.#Y)new MutationObserver(()=>{if(this.#q?.querySelector("fig-color-tip"))this.#Y?.removeAttribute("show"),this.#Y?.hidePopup?.()}).observe(this.#q,{childList:!0,subtree:!0})}#e(J,Q){let Z=this.#K;if(!Z?.popup)return;let $=Q-8;Z.popup.anchor={getBoundingClientRect:()=>({left:J,top:$,right:J,bottom:$,width:0,height:0,x:J,y:$})},Z.popup.queueReposition?.()}#SJ(J){if(!J)return;J.addEventListener("pointerenter",(Q)=>{let Z=this.#K;if(!Z)return;Z.setAttribute("text",this.#o()),Z.setAttribute("show","true"),Z.showPopup?.(),this.#e(Q.clientX,Q.clientY)}),J.addEventListener("pointermove",(Q)=>{if(this.#L)return;this.#e(Q.clientX,Q.clientY)}),J.addEventListener("pointerleave",()=>{if(this.#L)return;let Q=this.#K;if(!Q)return;Q.removeAttribute("show")})}#$J(){let Q=document.createElementNS("http://www.w3.org/2000/svg","svg");Q.classList.add("fig-canvas-control-radius"),Q.setAttribute("overflow","visible");let Z=document.createElementNS("http://www.w3.org/2000/svg","circle");Z.classList.add("fig-canvas-control-radius-hit"),Q.appendChild(Z);let $=document.createElementNS("http://www.w3.org/2000/svg","circle");$.classList.add("fig-canvas-control-radius-halo"),Q.appendChild($);let j=document.createElementNS("http://www.w3.org/2000/svg","circle");if(Q.appendChild(j),this.#O=Q,this.#c){let _=document.createElement("fig-tooltip");_.setAttribute("action","manual"),_.setAttribute("theme","canvas"),_.setAttribute("pointer","false"),_.setAttribute("text",this.#o()),_.appendChild(Q),this.appendChild(_),this.#K=_}else this.appendChild(Q);this.#IJ(Z)}#YJ(){let Q=document.createElementNS("http://www.w3.org/2000/svg","svg");if(Q.classList.add("fig-canvas-control-angle-svg"),Q.setAttribute("overflow","visible"),Q.style.position="absolute",Q.style.pointerEvents="none",this.#A){let j=document.createElementNS("http://www.w3.org/2000/svg","line");j.classList.add("fig-canvas-control-angle-line-hit"),j.setAttribute("stroke","transparent"),j.setAttribute("stroke-width","12"),j.setAttribute("stroke-linecap","round"),j.style.pointerEvents="stroke",Q.appendChild(j),this.#WJ(j)}let Z=document.createElementNS("http://www.w3.org/2000/svg","line");Z.classList.add("fig-canvas-control-angle-line-halo"),Q.appendChild(Z);let $=document.createElementNS("http://www.w3.org/2000/svg","line");$.classList.add("fig-canvas-control-angle-line"),Q.appendChild($),this.#G=Q,this.appendChild(Q)}#WJ(J){J.addEventListener("pointerdown",(Q)=>{if(O(this,"disabled"))return;Q.preventDefault(),Q.stopPropagation();let Z=this.#s;if(!Z)return;let{clientX:$,clientY:j}=Q,_=this.#$,X=this.#Z,q=this.#J,B=this.#Q;this.#U=!0,this.#N=!0,document.body.classList.add("fig-lab-move-active"),J.style.pointerEvents="none";let Y=(k)=>{let N=Z.getBoundingClientRect(),U=N.width>0?(k.clientX-$)/N.width*100:0,L=N.height>0?(k.clientY-j)/N.height*100:0,T=-Math.min(_,q),V=100-Math.max(_,q),I=-Math.min(X,B),A=100-Math.max(X,B),z=Math.max(T,Math.min(V,U)),b=Math.max(I,Math.min(A,L));this.#$=this.#S(_+z),this.#Z=this.#S(X+b),this.#J=this.#S(q+z),this.#Q=this.#S(B+b),this.#l(),this.#PJ()},M=this.#zJ((k)=>{if(document.body.classList.remove("fig-lab-move-active"),J.style.pointerEvents="stroke",this.#U=!1,this.#N=!1,k)this.#v(),this.#GJ()});window.addEventListener("pointermove",Y,{signal:M.signal}),window.addEventListener("pointerup",()=>M.finish(!0),{signal:M.signal}),window.addEventListener("pointercancel",()=>M.finish(!1),{signal:M.signal})})}#d(J,Q,Z){let $=document.createElement("fig-handle");if($.setAttribute("type","canvas"),$.setAttribute("drag","true"),$.setAttribute("drag-surface",Z),$.setAttribute("drag-axes","x,y"),$.setAttribute("size","small"),$.setAttribute("hit-area","12 circle"),$.setAttribute("hit-area-mode","delegate"),this.hasAttribute("precision"))$.setAttribute("precision",String(this.#b));if(J)$.setAttribute("disabled","");if(this.#X=$,Q){let j=document.createElement("fig-tooltip");j.setAttribute("action","manual"),j.setAttribute("theme","canvas"),j.setAttribute("pointer","false"),j.setAttribute("text",`${this.#S(this.#B)}°`),j.appendChild($),this.appendChild(j),this.#P=j}else this.appendChild($)}#UJ(J,Q,Z){let $=document.createElement("fig-handle");if($.setAttribute("type","canvas"),$.setAttribute("drag","true"),$.setAttribute("drag-surface",Z),$.setAttribute("drag-axes","x,y"),$.setAttribute("drag-snapping",this.#u),$.setAttribute("hit-area","12 circle"),$.setAttribute("hit-area-mode","delegate"),$.setAttribute("value",`${this.#J}% ${this.#Q}%`),this.hasAttribute("precision"))$.setAttribute("precision",String(this.#b));if(J)$.setAttribute("disabled","");if(this.#M=$,Q){let j=document.createElement("fig-tooltip");j.setAttribute("action","manual"),j.setAttribute("theme","canvas"),j.setAttribute("pointer","false"),j.setAttribute("text",this.#i),j.appendChild($),this.appendChild(j),this.#k=j}else this.appendChild($)}#JJ(J){return`url("data:image/svg+xml,%3Csvg width='32' height='32' viewBox='0 0 32 32' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cg transform='rotate(${Math.round(J)} 16 16)'%3E%3Cg filter='url(%23f)'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M11.1212 16.9998L11.5607 17.4394C12.1465 18.0252 12.1464 18.975 11.5606 19.5607C10.9748 20.1465 10.0251 20.1465 9.4393 19.5606L6.4393 16.5604C5.85354 15.9746 5.85357 15.0249 6.43938 14.4391L9.43938 11.4393C10.0252 10.8535 10.9749 10.8536 11.5607 11.4394C12.1465 12.0252 12.1464 12.9749 11.5606 13.5607L11.1215 13.9998L20.8786 13.9999L20.4394 13.5607C19.8536 12.9749 19.8535 12.0252 20.4393 11.4394C21.0251 10.8536 21.9749 10.8536 22.5606 11.4394L25.5606 14.4393C25.842 14.7206 26 15.1021 26 15.4999C26 15.8978 25.842 16.2793 25.5607 16.5606L22.5607 19.5607C21.9749 20.1465 21.0251 20.1465 20.4393 19.5607C19.8536 18.9749 19.8535 18.0252 20.4393 17.4394L20.8788 16.9999L11.1212 16.9998Z' fill='white'/%3E%3C/g%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M10.8536 12.1465C11.0488 12.3417 11.0488 12.6583 10.8535 12.8536L8.70715 14.9998L23.2929 14.9999L21.1465 12.8536C20.9512 12.6583 20.9512 12.3417 21.1464 12.1465C21.3417 11.9512 21.6583 11.9512 21.8535 12.1465L24.8535 15.1464C24.9473 15.2402 25 15.3673 25 15.4999C25 15.6326 24.9473 15.7597 24.8536 15.8535L21.8536 18.8536C21.6583 19.0488 21.3417 19.0488 21.1465 18.8536C20.9512 18.6583 20.9512 18.3417 21.1464 18.1465L23.2929 15.9999L8.70705 15.9998L10.8536 18.1465C11.0488 18.3417 11.0488 18.6583 10.8535 18.8536C10.6583 19.0488 10.3417 19.0488 10.1464 18.8535L7.14643 15.8533C6.95118 15.658 6.95119 15.3415 7.14646 15.1462L10.1465 12.1464C10.3417 11.9512 10.6583 11.9512 10.8536 12.1465Z' fill='black'/%3E%3C/g%3E%3Cdefs%3E%3Cfilter id='f' x='3' y='9' width='26' height='15' filterUnits='userSpaceOnUse' color-interpolation-filters='sRGB'%3E%3CfeFlood flood-opacity='0' result='a'/%3E%3CfeColorMatrix in='SourceAlpha' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0' result='b'/%3E%3CfeOffset dy='1'/%3E%3CfeGaussianBlur stdDeviation='1.5'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.35 0'/%3E%3CfeBlend in2='a' result='c'/%3E%3CfeBlend in='SourceGraphic' in2='c'/%3E%3C/filter%3E%3C/defs%3E%3C/svg%3E") 16 16, nwse-resize`}#KJ(J){return`url("data:image/svg+xml,%3Csvg width='32' height='32' viewBox='0 0 32 32' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cg transform='rotate(${Math.round(J-45)} 16 16)'%3E%3Cg filter='url(%23f)'%3E%3Cpath d='M12.5607 22.4393L12.0216 21.9002C17.1558 21.2216 21.2216 17.1558 21.9002 12.0216L22.4393 12.5607C23.0251 13.1464 23.9749 13.1464 24.5607 12.5607C25.1464 11.9749 25.1464 11.0251 24.5607 10.4393L21.5607 7.43934C20.9749 6.85355 20.0251 6.85355 19.4393 7.43934L16.4393 10.4393C15.8536 11.0251 15.8536 11.9749 16.4393 12.5607C17.0251 13.1464 17.9749 13.1464 18.5607 12.5607L18.8056 12.3157C18.1013 15.5527 15.5527 18.1013 12.3157 18.8056L12.5607 18.5607C13.1464 17.9749 13.1464 17.0251 12.5607 16.4393C11.9749 15.8536 11.0251 15.8536 10.4393 16.4393L7.43934 19.4393C6.85356 20.0251 6.85356 20.9749 7.43934 21.5607L10.4393 24.5607C11.0251 25.1464 11.9749 25.1464 12.5607 24.5607C13.1464 23.9749 13.1464 23.0251 12.5607 22.4393Z' fill='white'/%3E%3C/g%3E%3Cpath d='M23.8536 11.8536C23.6583 12.0488 23.3417 12.0488 23.1464 11.8536L21 9.70711V10.5C21 16.299 16.299 21 10.5 21H9.70711L11.8536 23.1464C12.0488 23.3417 12.0488 23.6583 11.8536 23.8536C11.6583 24.0488 11.3417 24.0488 11.1464 23.8536L8.14645 20.8536C7.95119 20.6583 7.95119 20.3417 8.14645 20.1464L11.1464 17.1464C11.3417 16.9512 11.6583 16.9512 11.8536 17.1464C12.0488 17.3417 12.0488 17.6583 11.8536 17.8536L9.70711 20H10.5C15.7467 20 20 15.7467 20 10.5V9.70711L17.8536 11.8536C17.6583 12.0488 17.3417 12.0488 17.1464 11.8536C16.9512 11.6583 16.9512 11.3417 17.1464 11.1464L20.1464 8.14645C20.3417 7.95119 20.6583 7.95119 20.8536 8.14645L23.8536 11.1464C24.0488 11.3417 24.0488 11.6583 23.8536 11.8536Z' fill='black'/%3E%3C/g%3E%3Cdefs%3E%3Cfilter id='f' x='4' y='5' width='24' height='24' filterUnits='userSpaceOnUse' color-interpolation-filters='sRGB'%3E%3CfeFlood flood-opacity='0' result='a'/%3E%3CfeColorMatrix in='SourceAlpha' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0' result='b'/%3E%3CfeOffset dy='1'/%3E%3CfeGaussianBlur stdDeviation='1.5'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.35 0'/%3E%3CfeBlend in2='a' result='c'/%3E%3CfeBlend in='SourceGraphic' in2='c'/%3E%3C/filter%3E%3C/defs%3E%3C/svg%3E") 16 16, pointer`}#HJ(J,Q){if(!J)return;J.style.setProperty("cursor",Q,"important")}#TJ(J,Q){if(!J)return;let Z=J.querySelector(".fig-handle-hit-area");if(!Z)return;if(Z.setAttribute("data-cursor","rotate"),this.#HJ(Z,this.#KJ(Q)),this.#R===J)this.#_J()}#LJ(){if(!this.#X||!this.#C)return;this.#TJ(this.#X,this.#B)}#FJ(){return Math.atan2(this.#Q-this.#Z,this.#J-this.#$)*180/Math.PI}#CJ(){if(!this.#A)return;let J=this.#FJ();this.#q?.style.removeProperty("cursor"),this.#M?.style.removeProperty("cursor"),this.#TJ(this.#q,J+180),this.#TJ(this.#M,J)}#RJ(J,Q,Z,$){J.style.setProperty("--fig-handle-position-translate","-50% -50%"),J.style.left=`${Q/100*$.width}px`,J.style.top=`${Z/100*$.height}px`}#l(){let J=this.#s;if(!J||!this.#q)return;let Q=J.getBoundingClientRect();if(this.#RJ(this.#q,this.#$,this.#Z,Q),this.#O){let Z=this.#$/100*Q.width,$=this.#Z/100*Q.height,j=this.#BJ(Q.width),_=this.#O,X=Math.max(j*2,1);_.style.position="absolute",_.style.width=`${X}px`,_.style.height=`${X}px`,_.style.left=`${Z-j}px`,_.style.top=`${$-j}px`,_.setAttribute("viewBox",`0 0 ${X} ${X}`);let q=_.querySelectorAll("circle");for(let B of q)B.setAttribute("cx",String(j)),B.setAttribute("cy",String(j)),B.setAttribute("r",String(Math.max(j-1,0)))}if(this.#G&&this.#E){let Z=this.#$/100*Q.width,$=this.#Z/100*Q.height,j,_;if(this.#A)j=this.#J/100*Q.width,_=this.#Q/100*Q.height;else{let B=this.#BJ(Q.width),Y=this.#B*Math.PI/180;j=Z+B*Math.cos(Y),_=$+B*Math.sin(Y)}let X=this.#G;X.style.width=`${Q.width}px`,X.style.height=`${Q.height}px`,X.style.left="0",X.style.top="0",X.setAttribute("viewBox",`0 0 ${Q.width} ${Q.height}`);let q=X.querySelectorAll(".fig-canvas-control-angle-line, .fig-canvas-control-angle-line-halo, .fig-canvas-control-angle-line-hit");for(let B of q)B.setAttribute("x1",String(Z)),B.setAttribute("y1",String($)),B.setAttribute("x2",String(j)),B.setAttribute("y2",String(_))}if(this.#X&&this.#C){let Z=this.#$/100*Q.width,$=this.#Z/100*Q.height,j=this.#BJ(Q.width),_=this.#B*Math.PI/180,X=Z+j*Math.cos(_),q=$+j*Math.sin(_),B=Q.width>0?X/Q.width*100:0,Y=Q.height>0?q/Q.height*100:0;this.#RJ(this.#X,B,Y,Q)}if(this.#M&&this.#A)this.#RJ(this.#M,this.#J,this.#Q,Q);this.#LJ(),this.#CJ()}#PJ(J=this.value){this.dispatchEvent(new CustomEvent("input",{bubbles:!0,detail:J}))}#GJ(J=this.value){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:J}))}#fJ(J){return{...this.value,...wJ(J.color,J.alpha,J.opacity)}}#v(){this.setAttribute("value",JSON.stringify(this.value))}#DJ(){if(!this.#q)return;if(this.#q.addEventListener("input",(J)=>{if(J.stopPropagation(),J.detail?.color){this.setAttribute("color",this.#q.getAttribute("color")||J.detail.color),this.#PJ(this.#fJ(J.detail));return}this.#U=!0;let Q=J.detail?.px??this.#$/100,Z=J.detail?.py??this.#Z/100;if(this.#$=this.#S(Math.max(0,Math.min(100,Q*100))),this.#Z=this.#S(Math.max(0,Math.min(100,Z*100))),this.#Y)this.#Y.removeAttribute("show"),this.#Y.hidePopup?.();this.#l(),this.#PJ()}),this.#q.addEventListener("change",(J)=>{if(J.stopPropagation(),J.detail?.color){this.setAttribute("color",this.#q.getAttribute("color")||J.detail.color),this.#GJ(this.#fJ(J.detail));return}let Q=J.detail?.px??this.#$/100,Z=J.detail?.py??this.#Z/100;if(this.#$=this.#S(Math.max(0,Math.min(100,Q*100))),this.#Z=this.#S(Math.max(0,Math.min(100,Z*100))),this.#Y)this.#Y.removeAttribute("show");this.#l(),this.#v(),this.#GJ(),requestAnimationFrame(()=>{this.#U=!1})}),this.#X)this.#X.addEventListener("input",(J)=>{J.stopPropagation();let Q=this.#s;if(!Q)return;this.#T=!0,this.classList.add("fig-canvas-control-ring-active");let Z=Q.getBoundingClientRect(),$=this.#$/100*Z.width,j=this.#Z/100*Z.height,_=J.detail?.x??0,X=J.detail?.y??0,q=this.#X.offsetWidth/2,B=this.#X.offsetHeight/2,Y=_+q-$,M=X+B-j,k=Math.atan2(M,Y)*180/Math.PI;if(this.#p(J.detail?.shiftKey))k=Math.round(k/15)*15;this.#B=this.#S(k);let N=Math.sqrt(Y*Y+M*M);if(this.#p(J.detail?.shiftKey)){let U=this.#j?5:10;if(this.#j){let L=N/Z.width*100;L=Math.round(L/U)*U,N=L/100*Z.width}else N=Math.round(N/U)*U}if(this.#j)this.#_=this.#S(Math.max(0,N/Z.width*100));else this.#_=this.#S(Math.max(0,N));if(this.#P)this.#P.setAttribute("text",`Angle ${this.#S(this.#B)}°`),this.#P.setAttribute("show","true"),this.#P.showPopup?.();this.#l(),this.#PJ()}),this.#X.addEventListener("change",(J)=>{if(J.stopPropagation(),this.classList.remove("fig-canvas-control-ring-active"),this.#P)this.#P.removeAttribute("show");this.#l(),this.#v(),this.#GJ(),requestAnimationFrame(()=>{this.#T=!1})}),this.#X.addEventListener("hitareadown",(J)=>{J.stopPropagation();let Q=J.detail?.originalEvent;if(!Q)return;Q.preventDefault();let Z=this.#s;if(!Z)return;if(this.#T=!0,this.classList.add("fig-canvas-control-ring-active"),this.#X.setAttribute("selected",""),this.#P)this.#P.setAttribute("show","true"),this.#P.showPopup?.();let $=(_)=>{let X=Z.getBoundingClientRect(),q=this.#$/100*X.width,B=this.#Z/100*X.height,Y=_.clientX-X.left-q,M=_.clientY-X.top-B,k=Math.atan2(M,Y)*180/Math.PI;if(this.#p(_.shiftKey))k=Math.round(k/15)*15;if(this.#B=this.#S(k),this.#P)this.#P.setAttribute("text",`Angle ${this.#S(k)}°`);this.#l(),this.#PJ()},j=this.#zJ((_)=>{if(this.#T=!1,this.classList.remove("fig-canvas-control-ring-active"),this.#X.removeAttribute("selected"),this.#P)this.#P.removeAttribute("show");if(_)this.#v(),this.#GJ()});window.addEventListener("pointermove",$,{signal:j.signal}),window.addEventListener("pointerup",()=>j.finish(!0),{signal:j.signal}),window.addEventListener("pointercancel",()=>j.finish(!1),{signal:j.signal})});if(this.#M)this.#M.addEventListener("input",(J)=>{J.stopPropagation(),this.#N=!0;let Q=J.detail?.px??this.#J/100,Z=J.detail?.py??this.#Q/100;if(this.#J=this.#S(Math.max(0,Math.min(100,Q*100))),this.#Q=this.#S(Math.max(0,Math.min(100,Z*100))),this.#k)this.#k.removeAttribute("show"),this.#k.hidePopup?.();this.#l(),this.#PJ()}),this.#M.addEventListener("change",(J)=>{if(J.stopPropagation(),this.#k)this.#k.removeAttribute("show");this.#l(),this.#v(),this.#GJ(),requestAnimationFrame(()=>{this.#N=!1})}),this.#AJ(this.#q,!0),this.#AJ(this.#M,!1)}#AJ(J,Q){if(!J)return;J.addEventListener("hitareadown",(Z)=>{Z.stopPropagation();let $=Z.detail?.originalEvent;if(!$)return;$.preventDefault();let j=this.#s;if(!j)return;this.#U=!0;let _=j.getBoundingClientRect(),X=Q?this.#J:this.#$,q=Q?this.#Q:this.#Z,B=Q?this.#$:this.#J,Y=Q?this.#Z:this.#Q,M=X/100*_.width,k=q/100*_.height,N=B/100*_.width,U=Y/100*_.height,L=Math.sqrt((N-M)**2+(U-k)**2),T=Q?this.#Y:this.#k;if(T)T.removeAttribute("show"),T.hidePopup?.();let V=(A)=>{let z=j.getBoundingClientRect(),b=X/100*z.width,E=q/100*z.height,y=A.clientX-z.left-b,w=A.clientY-z.top-E,x=Math.atan2(w,y);if(this.#p(A.shiftKey))x=Math.round(x*180/Math.PI/15)*15*Math.PI/180;let e=b+L*Math.cos(x),a=E+L*Math.sin(x),p=Math.max(0,Math.min(100,e/z.width*100)),g=Math.max(0,Math.min(100,a/z.height*100));if(Q)this.#$=this.#S(p),this.#Z=this.#S(g);else this.#J=this.#S(p),this.#Q=this.#S(g);this.#l(),this.#PJ()},I=this.#zJ((A)=>{if(this.#U=!1,T)T.removeAttribute("show");if(A)this.#v(),this.#GJ()});window.addEventListener("pointermove",V,{signal:I.signal}),window.addEventListener("pointerup",()=>I.finish(!0),{signal:I.signal}),window.addEventListener("pointercancel",()=>I.finish(!1),{signal:I.signal})})}#IJ(J){if(!J)return;J.addEventListener("pointermove",(Z)=>{if(this.#L)return;let $=this.#s;if(!$)return;let j=$.getBoundingClientRect(),_=this.#$/100*j.width,X=this.#Z/100*j.height,q=Math.atan2(Z.clientY-j.top-X,Z.clientX-j.left-_)*180/Math.PI;this.#HJ(J,this.#JJ(q))});let Q=(Z)=>{if(O(this,"disabled"))return;Z.preventDefault(),Z.stopPropagation(),this.#L=!0,this.classList.add("fig-canvas-control-ring-active");let $=this.#s;if(!$)return;if(this.#K)this.#K.setAttribute("show","true"),this.#K.showPopup?.(),this.#e(Z.clientX,Z.clientY);if(this.#P)this.#P.removeAttribute("show"),this.#P.hidePopup?.();let j=this.#X?.style.pointerEvents,_=this.#X?.querySelector(".fig-handle-hit-area"),X=_?.style.pointerEvents;if(this.#X)this.#X.style.pointerEvents="none";if(_)_.style.pointerEvents="none";let q=document.body.style.cursor;J.style.pointerEvents="none";let B=$.getBoundingClientRect(),Y=this.#$/100*B.width,M=this.#Z/100*B.height,k=Math.atan2(Z.clientY-B.top-M,Z.clientX-B.left-Y)*180/Math.PI,N=Math.round(k);document.body.style.cursor=this.#JJ(N);let U=(T)=>{let V=$.getBoundingClientRect(),I=this.#$/100*V.width,A=this.#Z/100*V.height,z=T.clientX-V.left-I,b=T.clientY-V.top-A,E=Math.round(Math.atan2(b,z)*180/Math.PI);if(E!==N)N=E,document.body.style.cursor=this.#JJ(E);let y=Math.sqrt(z*z+b*b);if(this.#p(T.shiftKey)){let w=this.#j?5:10;if(this.#j){let x=y/V.width*100;x=Math.round(x/w)*w,y=x/100*V.width}else y=Math.round(y/w)*w}if(this.#j)this.#_=this.#S(Math.max(0,y/V.width*100));else this.#_=this.#S(Math.max(0,y));if(this.#K)this.#K.setAttribute("text",this.#o()),this.#e(T.clientX,T.clientY);this.#l(),this.#PJ()},L=this.#zJ((T)=>{if(this.#L=!1,this.classList.remove("fig-canvas-control-ring-active"),J.style.pointerEvents="",this.#X)this.#X.style.pointerEvents=j??"";if(_)_.style.pointerEvents=X??"";if(document.body.style.cursor=q,this.#K)this.#K.removeAttribute("show");if(T)this.#v(),this.#GJ()});window.addEventListener("pointermove",U,{signal:L.signal}),window.addEventListener("pointerup",()=>L.finish(!0),{signal:L.signal}),window.addEventListener("pointercancel",()=>L.finish(!1),{signal:L.signal})};J.addEventListener("pointerdown",Q),this._radiusDragCleanup=()=>J.removeEventListener("pointerdown",Q)}#bJ(){if(this._radiusDragCleanup)this._radiusDragCleanup(),this._radiusDragCleanup=null}#zJ(J){this.#VJ();let Q=new AbortController,Z=!1,$=(j=!1)=>{if(Z)return;if(Z=!0,Q.abort(),this.#f===Q)this.#f=null,this.#w=null;J(j)};return this.#f=Q,this.#w=$,{signal:Q.signal,finish:$}}#VJ(){this.#w?.(!1),this.#f?.abort(),this.#f=null,this.#w=null}}P("fig-canvas-control",xJ);class F extends S{#$=[F.#R()];#Z=0;#J=2;#Q=240;#_=120;#j={min:-1,max:1};#B=null;#q=null;#M=null;#X=null;#O=0;#G=null;#Y=null;#k=null;#K=null;#P=[];#U=[];#N=[];#L=[];#T=new Set;#F=null;#W=null;#H=null;#z=null;#V=null;static TYPES=[{name:"Wave",value:"sine"},{name:"Square",value:"square"},{name:"Sawtooth",value:"sawtooth"},{name:"Triangle",value:"triangle"}];static#R(J="sine"){return{type:J,frequency:1,amplitude:1,phase:0,offset:0}}static get observedAttributes(){return["value","precision","aspect-ratio","edit","disabled"]}connectedCallback(){if(this.#V===null)this.#V=this.getAttribute("default")??this.getAttribute("value")??JSON.stringify({waves:[F.#R()]});this.#J=this.#y("precision",2),this.#x(this.getAttribute("value")),this.#w(),this.#i(),this.#kJ(),W(this)}disconnectedCallback(){if(this.#FJ(),this.#OJ(),this.#F)this.#F.disconnect(),this.#F=null;R(this)}attributeChangedCallback(J,Q,Z){if(Q===Z)return;if(J==="value"){if(this.#x(Z),this.isConnected)this.#i();return}if(J==="precision"){if(this.#J=this.#y("precision",2),this.isConnected)this.#l();return}if(J==="aspect-ratio"){if(this.#w(),this.#q)this.#XJ();return}if(J==="edit"||J==="disabled"){if(this.isConnected)this.#i()}}get value(){return JSON.stringify(this.data)}set value(J){this.setAttribute("value",typeof J==="object"&&J!==null?JSON.stringify(J):J)}get defaultValue(){return this.getAttribute("default")??this.#V??""}get isDefault(){let J=this.#I(this.defaultValue);if(!J)return!1;return JSON.stringify(this.data.waves)===JSON.stringify(J.map((Q)=>this.#A(Q)))}resetToDefault(){let J=this.defaultValue;if(!J)return;this.value=J,this.#v("input"),this.#v("change")}get data(){return{waves:this.#$.map((J)=>this.#A(J))}}get preset(){let J=this.#E;return F.TYPES.find((Q)=>Q.value===J.type)?.name}#y(J,Q){let Z=Number.parseInt(this.getAttribute(J)||"",10);return Number.isFinite(Z)?Math.max(0,Math.min(100,Z)):Q}#h(J,Q=!1){let Z=this.getAttribute(J);if(Z===null)return Q;let $=Z.trim().toLowerCase();if($===""||$==="true")return!0;if($==="false")return!1;return!0}#D(){return this.getAttribute("edit")!=="false"}#f(){return this.#h("disabled",!1)}#w(){let J=this.getAttribute("aspect-ratio")||"2 / 1";this.style.setProperty("--aspect-ratio",J)}#x(J){let Q=this.#I(J);if(!Q)return!1;if(this.#$=Q,!this.#$.length)this.#$=[F.#R()];return this.#Z=Math.min(this.#Z,this.#$.length-1),!0}#I(J){if(!J)return null;let Q=null;if(typeof J==="string")try{Q=JSON.parse(J)}catch{return null}else if(typeof J==="object")Q=J;if(!Q)return null;return(Array.isArray(Q)?Q:Array.isArray(Q.waves)?Q.waves:[Q]).map(($)=>this.#C($))}#C(J={}){return{type:this.#c(J.type),frequency:this.#u(J.frequency,1,0.1,16),amplitude:this.#u(J.amplitude,1,-4,4),phase:this.#u(J.phase,0,-360,360),offset:this.#u(J.offset,0,-4,4)}}#A(J){return{type:J.type,frequency:this.#b(J.frequency),amplitude:this.#b(J.amplitude),phase:this.#b(J.phase),offset:this.#b(J.offset)}}get#E(){if(!this.#$[this.#Z])this.#Z=0;return this.#$[this.#Z]||F.#R()}#c(J){let Q=String(J||"").toLowerCase();return F.TYPES.some((Z)=>Z.value===Q)?Q:"sine"}#u(J,Q,Z,$){let j=Number.parseFloat(J);if(!Number.isFinite(j))return Q;return Math.min($,Math.max(Z,j))}#b(J){let Q=10**this.#J;return Math.round(J*Q)/Q}static#S(J){return F.TYPES.find((Q)=>Q.value===J)?.name||"Wave"}static#jJ(J,Q=24){let j=Q-10,_="";for(let X=0;X<=32;X++){let q=X/32,B=F.#m(J,q),Y=5+q*j,M=5+(1-(B+1)/2)*j;_+=`${X===0?"M":"L"}${Y.toFixed(1)},${M.toFixed(1)}`}return _}static#p(J,Q=24){return h("svg",{width:Q,height:Q,viewBox:`0 0 ${Q} ${Q}`,fill:"none"},h("path",{d:F.#jJ(J,Q),stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round"}))}static waveIcon(J,Q=24){let Z=F.#jJ(J,Q);return`<svg width="${Q}" height="${Q}" viewBox="0 0 ${Q} ${Q}" fill="none"><path d="${Z}" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"/></svg>`}static#m(J,Q,Z=0){let $=Q+Z/360,j=$-Math.floor($),_=$*Math.PI*2;switch(J){case"square":return Math.sin(_)>=0?1:-1;case"sawtooth":return j*2-1;case"triangle":return 1-Math.abs(j*4-2);default:return Math.sin(_)}}#i(){if(this.#FJ(),this.#OJ(),this.replaceChildren(...this.#s()),this.#t(),this.#qJ(),this.#XJ(),this.#WJ(),!this.#f())this.#ZJ();W(this)}#a(J,Q){return h("foreignObject",{className:`propskit-oscillator-handle propskit-oscillator-${J}-handle`,"data-handle":J,width:"20",height:"20"},G("div",{className:"propskit-oscillator-handle-inner"},G("fig-tooltip",{text:Q},G("fig-handle",{size:"small",type:"minimal","aria-label":`Oscillator ${J} handle`}))))}#s(){let J=this.#D()&&!this.#f(),Q=[h("rect",{className:"propskit-oscillator-bounds",x:"0",y:"0",width:this.#Q,height:this.#_}),h("line",{className:"propskit-oscillator-baseline"}),h("path",{className:"propskit-oscillator-path"}),h("circle",{className:"propskit-oscillator-playhead"})];if(J)Q.push(this.#a("amplitude","Amplitude"),this.#a("frequency","Frequency"));let Z=h("svg",{viewBox:`0 0 ${this.#Q} ${this.#_}`,className:"propskit-oscillator-svg"},Q),$=[G("div",{className:"propskit-oscillator-svg-container"},Z)];if(this.#D())$.push(G("div",{className:"propskit-oscillator-waves"},this.#$.map((j,_)=>this.#g(j,_,!J))));return $}#g(J,Q,Z){let $=Z||this.#$.length<=1,j=Q===this.#Z,_=F.#S(J.type),X=G("fig-tooltip",{text:"Remove form"},G("fig-button",{className:"propskit-oscillator-remove-button",variant:"ghost",icon:!0,"data-wave-index":Q,"aria-label":"Remove form",disabled:$},G("fig-icon",{name:"minus"}))),q=G("fig-header",{borderless:!0},[G("h3",{},_),X,this.#BJ(Z,Q)]),B=G("div",{className:"propskit-oscillator-fields","data-wave-index":Q,"data-active":j},[this.#o(Q,"frequency","Frequency",0.1,16,0.1,""),this.#o(Q,"amplitude","Amplitude",-4,4,0.1,""),this.#o(Q,"phase","Phase",-360,360,1,"°"),this.#o(Q,"offset","Offset",-4,4,0.1,"")]);return G("fig-group",{className:"propskit-oscillator-wave",collapsible:!0,borderless:!0,compact:"true",open:this.#T.has(Q)?"true":"false","data-wave-index":Q},[q,B])}#BJ(J,Q){let Z=G("fig-tooltip",{text:"Add form"},G("fig-button",{className:"propskit-oscillator-add-type-button",variant:"ghost",icon:!0,"fig-menu-trigger":!0,"aria-label":"Add form",disabled:J},G("fig-icon",{name:"plus"}))),$=F.TYPES.map((j)=>G("fig-menu-item",{value:j.value},[F.#p(j.value,24),G("span",{},j.name)]));return G("fig-menu",{className:"propskit-oscillator-add-type",position:"bottom right","data-wave-index":Q,disabled:J},[Z,$])}#o(J,Q,Z,$,j,_,X){let q=this.#$[J]||F.#R(),B=Q==="amplitude"||Q==="offset";return G("propskit-slider",{className:"propskit-oscillator-field",label:Z,name:Q,"data-wave-index":J,value:this.#b(q[Q]),min:$,max:j,step:_,precision:this.#J,elastic:"false",type:B?"delta":null,default:B?"0":null,units:X||null,disabled:this.#f()})}#t(){this.#q=this.querySelector(".propskit-oscillator-svg"),this.#M=this.querySelector(".propskit-oscillator-path"),this.#X=this.querySelector(".propskit-oscillator-playhead"),this.#G=this.querySelector(".propskit-oscillator-baseline"),this.#Y=this.querySelector(".propskit-oscillator-bounds"),this.#k=this.querySelector('[data-handle="amplitude"]'),this.#K=this.querySelector('[data-handle="frequency"]'),this.#U=Array.from(this.querySelectorAll(".propskit-oscillator-wave-type")),this.#P=Array.from(this.querySelectorAll("propskit-slider[name]")),this.#L=Array.from(this.querySelectorAll("fig-group.propskit-oscillator-wave")),this.#N=Array.from(this.querySelectorAll(".propskit-oscillator-fields"))}#QJ(J){let Q=new Set;for(let Z of this.#T)if(Z<J)Q.add(Z);else if(Z>J)Q.add(Z-1);this.#T=Q}#r(J){let Q=new Set;for(let Z of this.#T)Q.add(Z>=J?Z+1:Z);Q.add(J),this.#T=Q}#kJ(){if(this.#F||!window.ResizeObserver)return;this.#F=new ResizeObserver(()=>{if(this.#qJ())this.#XJ()}),this.#F.observe(this)}#qJ(){if(!this.#q)return!1;let J=this.#q.getBoundingClientRect(),Q=Math.max(1,Math.round(J.width||240)),Z=Math.max(1,Math.round(J.height||120)),$=Q!==this.#Q||Z!==this.#_;return this.#Q=Q,this.#_=Z,this.#q.setAttribute("viewBox",`0 0 ${Q} ${Z}`),$}#MJ(){let J=1,Q=256;for(let Z=0;Z<=Q;Z++)J=Math.max(J,Math.abs(this.#n(Z/Q)));return{min:-J,max:J}}#_J(J){let{min:Q,max:Z}=this.#j;return this.#_-(J-Q)/(Z-Q)*this.#_}#NJ(J){let{min:Q,max:Z}=this.#j;return Q+(1-J/this.#_)*(Z-Q)}#n(J){return this.#$.reduce((Q,Z)=>{let $=J*Z.frequency,j=F.#m(Z.type,$,Z.phase);return Q+Z.offset+j*Z.amplitude},0)}#XJ(){if(!this.#q||!this.#M)return;if(this.#qJ(),this.#j=this.#MJ(),this.#Y)this.#Y.setAttribute("width",this.#Q),this.#Y.setAttribute("height",this.#_);let J=Math.max(...this.#$.map((_)=>_.frequency)),Z=this.#$.some((_)=>_.type==="square"||_.type==="sawtooth")?Math.max(192,Math.ceil(J*64)):Math.max(96,Math.ceil(J*64)),$="";for(let _=0;_<=Z;_++){let X=_/Z,q=X*this.#Q,B=this.#_J(this.#n(X));$+=`${_===0?"M":"L"}${q.toFixed(1)},${B.toFixed(1)}`}this.#M.setAttribute("d",$);let j=this.#_J(0);this.#G?.setAttribute("x1","0"),this.#G?.setAttribute("y1",j),this.#G?.setAttribute("x2",this.#Q),this.#G?.setAttribute("y2",j),this.#SJ()}#ZJ(){if(this.#O||!this.#X)return;let J=(Q)=>{if(!this.isConnected||!this.#X){this.#O=0;return}this.#e(Q%1000/1000),this.#O=requestAnimationFrame(J)};this.#O=requestAnimationFrame(J)}#OJ(){if(!this.#O)return;cancelAnimationFrame(this.#O),this.#O=0}#e(J){if(!this.#X)return;let Q=J*this.#Q,Z=this.#_J(this.#n(J));this.#X.setAttribute("cx",Q.toFixed(1)),this.#X.setAttribute("cy",Z.toFixed(1))}#SJ(){let Q=this.#E,Z=this.#$J(),$=Math.max(8,Math.min(this.#Q-8,this.#Q/Q.frequency)),j=this.#_J(this.#n(Z/this.#Q)),_=this.#_J(this.#n($/this.#Q));this.#YJ(this.#k,Z,j,8),this.#YJ(this.#K,$,_,8)}#$J(){let J=this.#E,Q=J.phase/360,Z=Math.max(0.1,J.frequency),$=0.25;if(J.type==="triangle")$=0.5;if(J.type==="sawtooth")$=1;let j=($-Q)/Z;while(j<0)j+=1/Z;while(j>1)j-=1/Z;if(j<0||j>1||!Number.isFinite(j))j=0.25;return Math.max(8,Math.min(this.#Q-8,j*this.#Q))}#YJ(J,Q,Z,$){if(!J)return;J.setAttribute("x",Q-$),J.setAttribute("y",Z-$),J.setAttribute("width",$*2),J.setAttribute("height",$*2)}#WJ(){if(!this.#D()||this.#f())return;for(let Q of this.#U)Q.addEventListener("change",(Z)=>{if(this.#f())return;let $=this.#d(Q);this.#JJ($),this.#$[$].type=this.#c(Z.detail??Z.target?.value),this.#l(),this.#v("input"),this.#v("change")});for(let Q of this.#P)Q.addEventListener("input",(Z)=>{Z.stopPropagation(),this.#W=Q;try{this.#KJ(this.#d(Q),Q.getAttribute("name"),Z.detail?.value??Z.currentTarget?.value??Z.target?.value,"input")}finally{this.#W=null}}),Q.addEventListener("change",(Z)=>{Z.stopPropagation(),this.#KJ(this.#d(Q),Q.getAttribute("name"),Z.detail?.value??Z.currentTarget?.value??Z.target?.value,"change")});for(let Q of this.#L)Q.addEventListener("pointerdown",()=>{this.#JJ(this.#d(Q))}),Q.addEventListener("focusin",()=>{this.#JJ(this.#d(Q))}),Q.addEventListener("openchange",(Z)=>{let $=this.#d(Q);if(Z.detail?.open)this.#T.add($);else this.#T.delete($)});for(let Q of this.querySelectorAll(".propskit-oscillator-add-type")){let Z=($)=>{$.stopPropagation()};Q.addEventListener("pointerdown",Z),Q.addEventListener("click",Z),Q.addEventListener("change",($)=>{if($.target!==Q)return;if(this.#f())return;let _=this.#d(Q)+1,X=this.#c($.detail?.value??Q.value);this.#$.splice(_,0,F.#R(X)),this.#r(_),this.#Z=_,this.#i(),this.#v("input"),this.#v("change")})}for(let Q of this.querySelectorAll(".propskit-oscillator-add-type-button")){let Z=($)=>{$.stopPropagation()};Q.addEventListener("pointerdown",Z),Q.addEventListener("click",Z),Q.closest("fig-tooltip")?.addEventListener("pointerdown",Z),Q.closest("fig-tooltip")?.addEventListener("click",Z)}for(let Q of this.querySelectorAll(".propskit-oscillator-remove-button"))Q.addEventListener("pointerdown",(Z)=>{Z.stopPropagation()}),Q.addEventListener("click",(Z)=>{if(Z.stopPropagation(),this.#f()||this.#$.length<=1)return;let $=this.#d(Q);this.#$.splice($,1),this.#QJ($),this.#Z=Math.min(this.#Z,this.#$.length-1),this.#i(),this.#v("input"),this.#v("change")});for(let Q of[this.#k,this.#K])this.#UJ(Q);this.querySelector(".propskit-oscillator-svg-container")?.addEventListener("pointerdown",(Q)=>{if(this.#f())return;if(Q.target?.closest?.(".propskit-oscillator-handle, fig-handle"))return;this.#LJ(Q,"offset")})}#d(J){let Q=Number.parseInt(J?.getAttribute("data-wave-index")||"",10);return Number.isFinite(Q)?Math.min(this.#$.length-1,Math.max(0,Q)):0}#UJ(J){let Q=J?.querySelector("fig-handle"),Z=J?.getAttribute("data-handle");if(!Q||!Z)return;Q.addEventListener("pointerdown",($)=>{if(this.#f())return;$.preventDefault(),$.stopImmediatePropagation(),this.#LJ($,Z)},{capture:!0}),Q.addEventListener("keydown",($)=>{if(this.#f())return;if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes($.key))return;if(!this.#HJ($,Z))return;$.preventDefault(),$.stopImmediatePropagation()},{capture:!0})}#JJ(J){let Q=Math.min(this.#$.length-1,Math.max(0,J));if(Q===this.#Z)return;this.#Z=Q,this.#fJ(),this.#SJ()}#KJ(J,Q,Z,$){if(this.#f())return;this.#JJ(J);let j=Number.parseFloat(Z);if(!Number.isFinite(j)){if($==="change")this.#GJ();return}this.#$[J]=this.#C({...this.#$[J],[Q]:j}),this.#l({skipFieldSync:$=="input"}),this.#v($)}#HJ(J,Q){let Z=J.shiftKey?0.5:0.1,$=this.#E;switch(Q){case"amplitude":if(J.key==="ArrowUp")$.amplitude+=Z;else if(J.key==="ArrowDown")$.amplitude-=Z;else if(J.key==="Home")$.amplitude=-4;else if(J.key==="End")$.amplitude=4;else return!1;break;case"offset":if(J.key==="ArrowUp")$.offset+=Z;else if(J.key==="ArrowDown")$.offset-=Z;else if(J.key==="Home")$.offset=-4;else if(J.key==="End")$.offset=4;else return!1;break;case"frequency":if(J.key==="ArrowLeft")$.frequency-=Z;else if(J.key==="ArrowRight")$.frequency+=Z;else if(J.key==="Home")$.frequency=0.1;else if(J.key==="End")$.frequency=16;else return!1;break;default:return!1}return this.#$[this.#Z]=this.#C($),this.#l(),this.#v("input"),this.#v("change"),!0}#TJ(J){let Q=this.#q?.getScreenCTM();if(!Q)return{x:0,y:0};let Z=Q.inverse();return{x:Z.a*J.clientX+Z.c*J.clientY+Z.e,y:Z.b*J.clientX+Z.d*J.clientY+Z.f}}#LJ(J,Q){this.#FJ(),this.#B=Q,this.#q?.classList.add("dragging");let Z=Q==="frequency"?"ew-resize":Q==="amplitude"?"ns-resize":"",$=document.body.style.cursor;if(Z)document.body.style.cursor=Z;let j=(q)=>{if(!this.#B)return;let B=this.#TJ(q),Y=this.#E;if(Q==="frequency"){let M=Math.max(1,Math.min(this.#Q,B.x));Y.frequency=this.#Q/M}else if(Q==="offset"){let M=this.#u(B.x/this.#Q,0,0,1),k=this.#RJ(Y,M);Y.offset=this.#NJ(B.y)-this.#CJ(this.#Z,M)-k*Y.amplitude}else if(Q==="amplitude"){let M=this.#u(B.x/this.#Q,0,0,1),k=this.#RJ(Y,M),N=this.#NJ(B.y)-this.#CJ(this.#Z,M)-Y.offset;Y.amplitude=Math.abs(k)<0.001?Y.amplitude:N/k}this.#$[this.#Z]=this.#C(Y),this.#l(),this.#v("input")},_=new AbortController,X=(q=!1)=>{if(this.#B=null,this.#q?.classList.remove("dragging"),Z)document.body.style.cursor=$;if(_.abort(),this.#H===_)this.#H=null,this.#z=null;if(q)this.#v("change")};this.#H=_,this.#z=X,document.addEventListener("pointermove",j,{signal:_.signal}),document.addEventListener("pointerup",()=>X(!0),{signal:_.signal}),document.addEventListener("pointercancel",()=>X(!1),{signal:_.signal}),window.addEventListener("blur",()=>X(!1),{signal:_.signal})}#FJ(){this.#z?.(!1),this.#H?.abort(),this.#H=null,this.#z=null,this.#B=null,this.#q?.classList.remove("dragging")}#CJ(J,Q){return this.#$.reduce((Z,$,j)=>{if(j===J)return Z;let _=Q*$.frequency,X=F.#m($.type,_,$.phase);return Z+$.offset+X*$.amplitude},0)}#RJ(J,Q){return F.#m(J.type,Q*J.frequency,J.phase)}#l({skipFieldSync:J=!1}={}){if(this.#PJ(),!J)this.#GJ();this.#fJ(),this.#XJ()}#PJ(){for(let J of this.#U){let Q=this.#d(J);J.value=this.#$[Q]?.type||"sine"}}#GJ(){for(let J of this.#P){if(J===this.#W)continue;let Q=this.#d(J),Z=J.getAttribute("name"),$=this.#b(this.#$[Q]?.[Z]??0),j=J.querySelector("fig-slider");if(j)j.value=$;else J.setAttribute("value",String($))}}#fJ(){for(let J of this.#N)if(this.#d(J)===this.#Z)J.setAttribute("data-active","");else J.removeAttribute("data-active")}#v(J){K(this,J)}}P("propskit-oscillator",F);class hJ extends HTMLElement{#$;#Z;#J=null;#Q;#_;#j;#B;#q;#M;#X;#O=null;#G=null;constructor(){super();this.angle=0,this.#$=1,this.#Z=0,this.isDragging=!1,this.isShiftHeld=!1,this.handle=null,this.angleInput=null,this.plane=null,this.units="°",this.min=null,this.max=null,this.dial=!0,this.showRotations=!1,this.rotationSpan=null,this.#Q=this.#h.bind(this),this.#_=this.#c.bind(this),this.#j=this.#u.bind(this),this.#B=this.#jJ.bind(this),this.#q=this.#p.bind(this),this.#M=this.#D.bind(this),this.#X=this.#S.bind(this)}connectedCallback(){requestAnimationFrame(()=>{if(!this.isConnected)return;this.precision=this.getAttribute("precision")||1,this.precision=parseInt(this.precision),this.text=this.getAttribute("text")==="true";let J=this.getAttribute("units")||"°";if(J==="deg")J="°";if(this.units=J,this.min=this.hasAttribute("min")?Number(this.getAttribute("min")):null,this.max=this.hasAttribute("max")?Number(this.getAttribute("max")):null,this.dial=this.#k("dial",!0),this.showRotations=this.#K(),this.#Y(),this.#R(),this.#E(),this.text&&this.angleInput)this.angleInput.setAttribute("value",this.angle.toFixed(this.precision))})}disconnectedCallback(){this.#b(),this.#y()}#Y(){this.#b(),this.#y();let J=this.#W(),Q=this.#U(),Z=this.getAttribute("aria-label")||this.getAttribute("name")||"Angle",$=this.min??this.#z(0),j=this.max??this.#z(360),_=[];if(this.dial)_.push(G("div",{className:"fig-input-angle-plane",role:"slider",tabindex:Q?"-1":"0","aria-label":Z,"aria-valuemin":$,"aria-valuemax":j,"aria-valuenow":this.angle,"aria-valuetext":`${this.angle.toFixed(this.precision)}${this.units}`,"aria-disabled":Q?"true":null},G("div",{className:"fig-input-angle-handle"})));if(this.text)_.push(G("fig-input-number",{name:"angle",step:J,value:this.angle,min:this.min,max:this.max,units:this.units,"aria-label":Z,disabled:Q},this.showRotations?G("span",{slot:"append",className:"fig-input-angle-rotations"}):null));this.replaceChildren(..._)}#k(J,Q=!1){let Z=this.getAttribute(J);if(Z===null)return Q;let $=Z.trim().toLowerCase();if($===""||$==="true")return!0;if($==="false")return!1;return!0}#K(){if(this.hasAttribute("rotations"))return this.#k("rotations",!1);if(this.hasAttribute("show-rotations"))return this.#k("show-rotations",!1);return!1}#P(){let J=Math.abs(this.#H(this.angle));return Math.floor(J/360)}#U(){return O(this,"disabled")}#N(J){let Q=Number(J);if(!Number.isFinite(Q))return this.angle;if(this.min!==null&&Number.isFinite(this.min))Q=Math.max(this.min,Q);if(this.max!==null&&Number.isFinite(this.max))Q=Math.min(this.max,Q);return Q}#L(J,{reflect:Q=!0}={}){let Z=this.#N(J);if(this.angle=Z,this.#f(),Q){let $=String(Z);if(this.getAttribute("value")!==$)this.setAttribute("value",$)}if(this.#E(),this.angleInput)this.angleInput.value=Z.toFixed(this.precision);this.#T(),this.#F()}#T(){if(!this.plane)return;this.plane.setAttribute("aria-valuenow",String(this.angle)),this.plane.setAttribute("aria-valuetext",`${this.angle.toFixed(this.precision)}${this.units}`)}#F(){if(!this.rotationSpan)return;let J=this.#P();if(J>1)this.rotationSpan.textContent=`×${J}`,this.rotationSpan.style.display="";else this.rotationSpan.textContent="",this.rotationSpan.style.display="none"}#W(){switch(this.units){case"rad":return 0.01;case"turn":return 0.001;default:return 0.1}}#H(J){switch(this.units){case"rad":return J*180/Math.PI;case"turn":return J*360;default:return J}}#z(J){switch(this.units){case"rad":return J*Math.PI/180;case"turn":return J/360;default:return J}}#V(J,Q,Z){let $;switch(Q){case"rad":$=J*180/Math.PI;break;case"turn":$=J*360;break;default:$=J}switch(Z){case"rad":return $*Math.PI/180;case"turn":return $/360;default:return $}}#R(){if(this.handle=this.querySelector(".fig-input-angle-handle"),this.plane=this.querySelector(".fig-input-angle-plane"),this.angleInput=this.querySelector("fig-input-number[name='angle']"),this.rotationSpan=this.querySelector(".fig-input-angle-rotations"),this.#F(),this.plane?.addEventListener("mousedown",this.#_),this.plane?.addEventListener("touchstart",this.#j),this.plane?.addEventListener("keydown",this.#X),window.addEventListener("keydown",this.#B),window.addEventListener("keyup",this.#q),this.text&&this.angleInput)this.angleInput.addEventListener("input",this.#M),this.angleInput.addEventListener("change",this.#M);this.addEventListener("change",this.#Q,!0)}#y(){if(this.plane?.removeEventListener("mousedown",this.#_),this.plane?.removeEventListener("touchstart",this.#j),this.plane?.removeEventListener("keydown",this.#X),window.removeEventListener("keydown",this.#B),window.removeEventListener("keyup",this.#q),this.text&&this.angleInput)this.angleInput.removeEventListener("input",this.#M),this.angleInput.removeEventListener("change",this.#M);this.removeEventListener("change",this.#Q,!0)}#h(J){if(!J.target?.matches?.("input"))return;let Z=J.target.value.match(/^(-?\d*\.?\d+)\s*(turn|rad|deg|°)$/i);if(Z){let $=parseFloat(Z[1]),j=Z[2].toLowerCase();if(j==="deg")j="°";if(j!==this.units){let _=this.#V($,j,this.units);J.target.value=String(_)}}}#D(J){if(J.stopPropagation(),this.#U())return;if(this.#L(Number(J.target.value)),J.type==="change")this.#A();else this.#C()}#f(){let Q=this.#H(this.angle)*Math.PI/180;this.#$=Math.cos(Q),this.#Z=Math.sin(Q)}#w(J){if(!this.isShiftHeld)return J;let Q=45;return Math.round(J/Q)*Q}#x(J){let Q=this.plane.getBoundingClientRect(),Z=Q.left+Q.width/2,$=Q.top+Q.height/2,j=J.clientX-Z,_=J.clientY-$;return Math.atan2(_,j)*180/Math.PI}#I(J){let Z=(this.#x(J)%360+360)%360;if(Z=this.#w(Z),this.min!==null||this.max!==null)this.angle=this.#N(this.#z(Z));else if(this.#J===null){this.#J=Z;let _=(this.#H(this.angle)%360+360)%360,X=Z-_;if(X>180)X-=360;if(X<-180)X+=360;this.angle=this.#N(this.angle+this.#z(X))}else{let j=Z-this.#J;if(j>180)j-=360;if(j<-180)j+=360;this.angle=this.#N(this.angle+this.#z(j)),this.#J=Z}if(this.#f(),this.setAttribute("value",String(this.angle)),this.#E(),this.text&&this.angleInput)this.angleInput.setAttribute("value",this.angle.toFixed(this.precision));this.#F(),this.#T(),this.#C()}#C(){this.dispatchEvent(new CustomEvent("input",{bubbles:!0,cancelable:!0,detail:{value:this.value,angle:this.angle}}))}#A(){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0,detail:{value:this.value,angle:this.angle}}))}#E(){if(this.handle){let Q=this.#H(this.angle)*Math.PI/180,Z=this.plane.offsetWidth/2-this.handle.offsetWidth/2,$=Math.cos(Q)*Z,j=Math.sin(Q)*Z;this.handle.style.transform=`translate(${$}px, ${j}px)`}}#c(J){if(this.#U()||J.button!==0)return;this.#b(),this.isDragging=!0,this.#J=null,this.#I(J);let Q=(j)=>{if(this.plane.classList.add("dragging"),this.isDragging)this.#I(j)},Z=new AbortController,$=(j=!1)=>{if(this.isDragging=!1,this.#J=null,this.plane.classList.remove("dragging"),Z.abort(),this.#O===Z)this.#O=null,this.#G=null;if(j)this.#A()};this.#O=Z,this.#G=$,window.addEventListener("mousemove",Q,{signal:Z.signal}),window.addEventListener("mouseup",()=>$(!0),{signal:Z.signal}),window.addEventListener("blur",()=>$(!1),{signal:Z.signal})}#u(J){if(this.#U())return;J.preventDefault(),this.#b(),this.isDragging=!0,this.#J=null,this.#I(J.touches[0]);let Q=(j)=>{if(this.plane.classList.add("dragging"),this.isDragging)this.#I(j.touches[0])},Z=new AbortController,$=(j=!1)=>{if(this.isDragging=!1,this.#J=null,this.plane.classList.remove("dragging"),Z.abort(),this.#O===Z)this.#O=null,this.#G=null;if(j)this.#A()};this.#O=Z,this.#G=$,window.addEventListener("touchmove",Q,{signal:Z.signal}),window.addEventListener("touchend",()=>$(!0),{signal:Z.signal}),window.addEventListener("touchcancel",()=>$(!1),{signal:Z.signal})}#b(){this.#G?.(!1),this.#O?.abort(),this.#O=null,this.#G=null,this.isDragging=!1,this.#J=null,this.plane?.classList.remove("dragging")}#S(J){if(this.#U())return;let Q=this.#W()*(J.shiftKey?10:1),Z=this.angle;if(J.key==="ArrowLeft"||J.key==="ArrowDown")Z-=Q;else if(J.key==="ArrowRight"||J.key==="ArrowUp")Z+=Q;else if(J.key==="Home")Z=this.min??this.#z(0);else if(J.key==="End")Z=this.max??this.#z(360);else return;J.preventDefault(),J.stopPropagation(),this.#L(Z),this.#C(),this.#A()}#jJ(J){if(J.key==="Shift")this.isShiftHeld=!0}#p(J){if(J.key==="Shift")this.isShiftHeld=!1}focus(){this.plane?.focus()}static get observedAttributes(){return["value","precision","text","min","max","units","dial","rotations","show-rotations","disabled","aria-label","name"]}get value(){return this.angle}get adjacent(){return this.#$}get opposite(){return this.#Z}set value(J){if(isNaN(J)){console.error("Invalid value: must be a number.");return}this.#L(Number(J))}attributeChangedCallback(J,Q,Z){switch(J){case"value":if(this.isDragging)break;if(Z!==null)this.#L(Number(Z),{reflect:!1});break;case"precision":this.precision=parseInt(Z);break;case"text":if(Z!==Q){if(this.text=Z?.toLowerCase()==="true",this.isConnected)this.#Y(),this.#R(),this.#E()}break;case"dial":if(this.dial=this.#k("dial",!0),this.isConnected)this.#Y(),this.#R(),this.#E();break;case"units":{let $=Z||"°";if($==="deg")$="°";if(this.units=$,this.isConnected)this.#Y(),this.#R(),this.#E();break}case"min":if(this.min=Z!==null?Number(Z):null,this.#L(this.angle),this.isConnected)this.#Y(),this.#R(),this.#E();break;case"max":if(this.max=Z!==null?Number(Z):null,this.#L(this.angle),this.isConnected)this.#Y(),this.#R(),this.#E();break;case"disabled":if(this.#b(),this.isConnected)this.#Y(),this.#R(),this.#E();break;case"aria-label":case"name":if(this.isConnected)this.#Y(),this.#R(),this.#E();break;case"rotations":case"show-rotations":if(this.showRotations=this.#K(),this.isConnected)this.#Y(),this.#R(),this.#E();break}}}P("fig-input-angle",hJ);class m extends HTMLElement{static observedAttributes=["axis","handle","disabled"];static#$=6;static#Z=['[draggable]:not([draggable="false"])','img:not([draggable="false"])','a[href]:not([draggable="false"])','input[type="range"]',"fig-handle","fig-slider","fig-input-number","fig-input-gradient","fig-easing-curve","fig-input-angle","fig-input-wheel","fig-joystick","fig-origin-grid","fig-chooser","fig-canvas-control","propskit-color-point","propskit-image","propskit-number","propskit-point-point","propskit-point-radius","propskit-point-radius-angle","propskit-position","propskit-editable-select","propskit-slider","propskit-oscillator"];#J=null;#Q=new Map;#_=null;#j=null;#B=null;connectedCallback(){if(this.style.display="contents",!this.hasAttribute("role"))this.setAttribute("role","list");if(!this.hasAttribute("aria-label"))this.setAttribute("aria-label","Reorderable list");this.#T(),this.#G(),this.#J=new MutationObserver(()=>this.#G()),this.#J.observe(this,{childList:!0})}disconnectedCallback(){this.#J?.disconnect(),this.#J=null,this.#A(),this.#E(),this.#w(),this.#B?.remove(),this.#B=null}attributeChangedCallback(){if(this.isConnected){if(this.#q)this.#E();this.#G()}}get#q(){return this.hasAttribute("disabled")&&this.getAttribute("disabled")!=="false"}get#M(){return(this.getAttribute("axis")||"vertical").trim().toLowerCase()==="horizontal"?"horizontal":"vertical"}get#X(){return(this.getAttribute("handle")||"").trim()}#O(){return[...this.children].filter((J)=>J.nodeType===Node.ELEMENT_NODE&&!J.hasAttribute("data-reorder-live"))}#G(){let J=this.#O(),Q=new Set(J);for(let[Z,$]of this.#Q)if(!Q.has(Z))$.target.removeEventListener("pointerdown",$.onPointerDown,!0),$.target.removeEventListener("keydown",$.onKeyDown),this.#L($),this.#Q.delete(Z);if(this.#K(J),this.#Y(J),this.#q||J.length<2){this.#A();return}for(let Z of J){let $=this.#U(Z),j=this.#Q.get(Z);if(j&&j.target===$)continue;if(j)j.target.removeEventListener("pointerdown",j.onPointerDown,!0),this.#Q.delete(Z);if(!$)continue;this.#N(Z,$)}this.#P(J),this.#k(J)}#Y(J){for(let Q of J)if(Q.removeAttribute("data-reorder-item"),Q.hasAttribute("data-reorder-generated-role"))Q.removeAttribute("role"),Q.removeAttribute("data-reorder-generated-role")}#k(J){for(let Q of J)if(Q.setAttribute("data-reorder-item",""),!Q.hasAttribute("role"))Q.setAttribute("role","listitem"),Q.setAttribute("data-reorder-generated-role","")}#K(J){for(let Q of J)Q.querySelectorAll("[data-reorder-handle]").forEach((Z)=>{Z.removeAttribute("data-reorder-handle"),Z.removeAttribute("aria-roledescription")})}#P(J){if(!this.#X)return;for(let Q of J){let Z=Q.querySelector(this.#X);if(Z)Z.setAttribute("data-reorder-handle",""),Z.setAttribute("aria-roledescription","reorder handle")}}#U(J){if(this.#X)return J.querySelector(this.#X);return J}#N(J,Q){let Z=(B)=>{if(this.#q||this.#O().length<2)return;if(B.button!==0)return;if(!this.#X&&this.#W(B.target,J))return;this.#V(B,J,Q)},$=Q.getAttribute("tabindex"),j=Q.getAttribute("aria-label"),_=Q.getAttribute("role"),X=J.getAttribute("aria-label")||J.textContent?.trim().replace(/\s+/g," ").slice(0,80)||"item";if(Q.setAttribute("tabindex","0"),Q.setAttribute("aria-label",`Move ${X}`),Q!==J&&!Q.hasAttribute("role"))Q.setAttribute("role","button");let q=(B)=>{if(this.#q)return;let Y=this.#M==="horizontal",M=Y?"ArrowLeft":"ArrowUp",k=Y?"ArrowRight":"ArrowDown";if(B.key!==M&&B.key!==k&&B.key!=="Home"&&B.key!=="End")return;B.preventDefault(),B.stopPropagation();let N=this.#O(),U=N.indexOf(J),L=U;if(B.key===M)L=Math.max(0,U-1);else if(B.key===k)L=Math.min(N.length-1,U+1);else if(B.key==="Home")L=0;else if(B.key==="End")L=N.length-1;if(L===U){this.#F(`${X}, position ${U+1} of ${N.length}`);return}this.#I(J,L),this.#G(),this.#U(J)?.focus(),this.dispatchEvent(new CustomEvent("reorder",{bubbles:!0,detail:{oldIndex:U,newIndex:L,item:J}})),this.#F(`${X}, position ${L+1} of ${N.length}`)};Q.addEventListener("pointerdown",Z,!0),Q.addEventListener("keydown",q),this.#Q.set(J,{target:Q,onPointerDown:Z,onKeyDown:q,originalTabIndex:$,originalAriaLabel:j,originalRole:_})}#L(J){let{target:Q,originalTabIndex:Z,originalAriaLabel:$,originalRole:j}=J;if(Z===null)Q.removeAttribute("tabindex");else Q.setAttribute("tabindex",Z);if($===null)Q.removeAttribute("aria-label");else Q.setAttribute("aria-label",$);if(j===null)Q.removeAttribute("role");else Q.setAttribute("role",j)}#T(){if(this.#B?.isConnected)return;let J=document.createElement("span");J.setAttribute("data-reorder-live",""),J.setAttribute("role","status"),J.setAttribute("aria-live","polite"),J.setAttribute("aria-atomic","true"),Object.assign(J.style,{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:"0"}),this.#B=J,document.body.appendChild(J)}#F(J){if(!this.#B)return;this.#B.textContent="",requestAnimationFrame(()=>{if(this.#B)this.#B.textContent=J})}#W(J,Q){let Z=J;while(Z&&Z!==Q){if(Z instanceof Element){for(let $ of m.#Z)if(Z.matches($))return!0}Z=Z.parentElement}return!1}static#H="fig-reorder-dragging";static#z(J){document.body.classList.toggle(m.#H,J)}#V(J,Q,Z){this.#E();let $={item:Q,target:Z,pointerId:J.pointerId,oldIndex:this.#O().indexOf(Q),targetIndex:this.#O().indexOf(Q),startX:J.clientX,startY:J.clientY,active:!1,onMove:null,onUp:null,onKeyDown:null};$.onMove=(j)=>{if(j.pointerId!==$.pointerId)return;let _=j.clientX-$.startX,X=j.clientY-$.startY;if(!$.active){if(_*_+X*X<m.#$*m.#$)return;$.active=!0,J.preventDefault(),J.stopPropagation(),Q.classList.add("dragging"),m.#z(!0);try{Z.setPointerCapture($.pointerId)}catch{}}j.preventDefault();let q=this.#M==="horizontal"?j.clientX:j.clientY,B=this.#R(q);$.targetIndex=B,this.#f(B,Q)},$.onKeyDown=(j)=>{if(j.key!=="Escape"||!$.active)return;j.preventDefault(),this.#C($,!0)},$.onUp=(j)=>{if(j.pointerId!==$.pointerId)return;this.#C($,j.type==="pointercancel")},this.#_=$,window.addEventListener("pointermove",$.onMove),window.addEventListener("pointerup",$.onUp),window.addEventListener("pointercancel",$.onUp),window.addEventListener("keydown",$.onKeyDown)}#R(J){let Q=this.#O(),Z=this.#M==="horizontal";for(let $=0;$<Q.length;$++){let j=Q[$].getBoundingClientRect(),_=Z?j.left+j.width/2:j.top+j.height/2;if(J<_)return $}return Q.length}#y(J,Q){let Z=this.#O(),$=Z.indexOf(J);if($===-1)return!1;let j=Math.max(0,Math.min(Q,Z.length));if(Q===$)return!1;if(j>=Z.length&&$===Z.length-1)return!1;return!0}#h(J){if(!J.length)return null;let Q=1/0,Z=-1/0,$=1/0,j=-1/0;for(let _ of J){let X=_.getBoundingClientRect();Q=Math.min(Q,X.left),Z=Math.max(Z,X.right),$=Math.min($,X.top),j=Math.max(j,X.bottom)}return{left:Q,top:$,width:Z-Q,height:j-$}}#D(){if(this.#j)return this.#j;let J=document.createElement("div");return J.className="fig-reorder-indicator",J.setAttribute("data-axis",this.#M),document.body.appendChild(J),this.#j=J,J}#f(J,Q){let Z=this.#O();if(!this.#y(Q,J)){this.#w();return}let $=this.#h(Z);if(!$){this.#w();return}let j=this.#D();if(j.setAttribute("data-axis",this.#M),this.#M==="horizontal"){let X;if(J<=0)X=Z[0].getBoundingClientRect().left;else if(J>=Z.length)X=Z[Z.length-1].getBoundingClientRect().right;else X=Z[J].getBoundingClientRect().left;j.style.left=`${X-1}px`,j.style.top=`${$.top}px`,j.style.width="2px",j.style.height=`${$.height}px`;return}let _;if(J<=0)_=Z[0].getBoundingClientRect().top;else if(J>=Z.length)_=Z[Z.length-1].getBoundingClientRect().bottom;else _=Z[J].getBoundingClientRect().top;j.style.left=`${$.left}px`,j.style.top=`${_-1}px`,j.style.width=`${$.width}px`,j.style.height="2px"}#w(){this.#j?.remove(),this.#j=null}#x(J,Q){let Z=this.#O(),$=Math.max(0,Math.min(Q,Z.length));if($>=Z.length){if(Z[Z.length-1]!==J)this.appendChild(J);return}let j=Z[$];if(j!==J)this.insertBefore(J,j)}#I(J,Q){let $=this.#O().filter((j)=>j!==J)[Q]??null;if($)this.insertBefore(J,$);else this.appendChild(J)}#C(J,Q){let{item:Z,oldIndex:$,active:j,onMove:_,onUp:X,onKeyDown:q}=J;if(window.removeEventListener("pointermove",_),window.removeEventListener("pointerup",X),window.removeEventListener("pointercancel",X),window.removeEventListener("keydown",q),j){if(!Q){this.#x(Z,J.targetIndex);let B=this.#O().indexOf(Z);if(B!==-1&&B!==$){this.dispatchEvent(new CustomEvent("reorder",{bubbles:!0,detail:{oldIndex:$,newIndex:B,item:Z}}));let Y=Z.getAttribute("aria-label")||Z.textContent?.trim().replace(/\s+/g," ").slice(0,80)||"item";this.#F(`${Y}, position ${B+1} of ${this.#O().length}`)}}}if(Z.classList.remove("dragging"),m.#z(!1),this.#w(),this.#_===J)this.#_=null}#A(){for(let[,J]of this.#Q)J.target.removeEventListener("pointerdown",J.onPointerDown,!0),J.target.removeEventListener("keydown",J.onKeyDown),this.#L(J);this.#Q.clear()}#E(){if(!this.#_)return;this.#C(this.#_,!0)}}P("fig-reorder",m);