@rogieking/figui3 8.9.47 → 8.9.49
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/.cursor/skills/fig-lab/components.md +1 -1
- package/README.md +1 -0
- package/components.css +2 -0
- package/dist/components.css +1 -1
- package/dist/fig-lab.css +1 -1
- package/dist/fig-lab.js +2 -2
- package/dist/fig.css +1 -1
- package/dist/fig.js +1 -1
- package/fig-lab.css +11 -5
- package/fig-lab.js +113 -40
- package/fig.js +1 -0
- package/package.json +1 -1
package/dist/fig-lab.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
function U(J,Q){if(!customElements.get(J))customElements.define(J,Q)}function Y(J,Q){return J.hasAttribute(Q)&&J.getAttribute(Q)!=="false"}var ZJ="http://www.w3.org/2000/svg";function $J(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 jJ(J,Q={}){for(let[Z,$]of Object.entries(Q)){if($===null||$===void 0||$===!1)continue;if(Z==="className")if(J.namespaceURI===ZJ)J.setAttribute("class",String($));else J.className=String($);else if($===!0)J.setAttribute(Z,"");else J.setAttribute(Z,String($))}return J}function L(J,Q,Z){let $=document.createElement(J);return jJ($,Q),$J($,Z)}function E(J,Q,Z){let $=document.createElementNS(ZJ,J);return jJ($,Q),$J($,Z)}function l(J,Q){let Z=Y(J,"disabled");for(let $ of Q)$?.toggleAttribute("disabled",Z)}function HJ(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 n=new WeakMap;function f(J){let Q=n.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 O=Q?.point;if(O)Z.showAt?.(O.x,O.y)};Q={menu:Z,point:null,clearPendingOpen:_,handleContextMenu:(O)=>{if(Y(J,"disabled")||O.target?.closest?.("fig-menu"))return;O.preventDefault(),O.stopPropagation(),O.stopImmediatePropagation?.(),Q.point={x:O.clientX,y:O.clientY},_(),window.addEventListener("pointerup",X,{once:!0,capture:!0}),window.addEventListener("pointercancel",X,{once:!0,capture:!0}),j=window.setTimeout(X,180)},handleChange:(O)=>{if(O.stopPropagation(),O.detail?.value==="reset-default")J.resetToDefault?.()}},n.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 D(J){let Q=n.get(J);if(!Q)return;Q.clearPendingOpen(),J.removeEventListener("contextmenu",Q.handleContextMenu),Q.menu.removeEventListener("change",Q.handleChange)}function g(J,Q){for(let Z of["input","change"])J.dispatchEvent(new CustomEvent(Z,{detail:Q,bubbles:!0,cancelable:!0,composed:!0}))}function c(J,Q){if(typeof J==="boolean"||typeof Q==="boolean")return Boolean(J)===Boolean(Q);return String(J??"")===String(Q??"")}function e(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 RJ(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,O]=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*O<=Z?"light":"dark"}var JJ=0;function _J(J="fig-lab"){return JJ+=1,`${J}-${JJ}`}class XJ extends HTMLElement{}U("fig-ai-prompt",XJ);class BJ extends HTMLElement{}U("fig-ai-context",BJ);class qJ extends HTMLElement{}U("fig-chat-message",qJ);class OJ extends HTMLElement{#Z=null;#Q=null;#J=null;#X=null;#j=null;#$=null;#O=this.#P.bind(this);#B=this.#U.bind(this);#G=this.#N.bind(this);static get observedAttributes(){return["src","name","value","removable","disabled"]}connectedCallback(){if(!this.#Q)this.#_();this.#j.removeEventListener("click",this.#O),this.#j.addEventListener("click",this.#O),this.#q(),this.#Y()}disconnectedCallback(){this.#j?.removeEventListener("click",this.#O),this.#M()}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Q)return;this.#Y()}#_(){this.#Z=document.createElement("fig-tooltip"),this.#Z.className="fig-attachment-tooltip",this.#Q=document.createElement("fig-image"),this.#Q.setAttribute("aspect-ratio","1/1"),this.#Q.setAttribute("fit","cover"),this.#Q.setAttribute("full",""),this.#J=document.createElement("span"),this.#J.className="fig-attachment-fallback",this.#J.setAttribute("aria-hidden","true"),this.#X=document.createElement("fig-tooltip"),this.#X.className="fig-attachment-remove-tooltip",this.#X.setAttribute("text","Remove attachment"),this.#j=document.createElement("fig-button"),this.#j.className="fig-attachment-remove",this.#j.setAttribute("variant","overlay"),this.#j.setAttribute("size","small"),this.#j.setAttribute("icon","");let J=document.createElement("fig-icon");J.setAttribute("name","close"),J.setAttribute("size","small"),this.#j.append(J),this.#X.append(this.#j),this.#Q.append(this.#J),this.#Z.append(this.#Q),this.replaceChildren(this.#Z,this.#X),this.#j.addEventListener("click",this.#O),this.#q()}#q(){let J=this.#Q?.mediaEl;if(!J||J===this.#$)return;this.#M(),this.#$=J,this.#$.addEventListener("load",this.#B),this.#$.addEventListener("error",this.#G)}#M(){if(!this.#$)return;this.#$.removeEventListener("load",this.#B),this.#$.removeEventListener("error",this.#G),this.#$=null}#Y(){let J=this.getAttribute("src")||"",Q=this.getAttribute("name")||"Attachment",Z=!this.hasAttribute("removable")||Y(this,"removable"),$=Y(this,"disabled");if(this.#Z.setAttribute("text",Q),this.#Q.setAttribute("alt",Q),J)this.#Q.setAttribute("src",J);else this.#Q.removeAttribute("src");if(this.#q(),this.#J.textContent=this.#k(Q),this.#j.hidden=!Z,this.#j.toggleAttribute("disabled",$),this.#j.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","")}#P(J){if(J.stopPropagation(),Y(this,"disabled")||this.hasAttribute("removable")&&!Y(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}}))}}U("fig-attachment",OJ);class YJ extends HTMLElement{#Z=null;connectedCallback(){if(!this.hasAttribute("role"))this.setAttribute("role","list"),this.setAttribute("data-generated-role","");if(this.#Q(),!this.#Z)this.#Z=new MutationObserver(()=>this.#Q()),this.#Z.observe(this,{childList:!0})}disconnectedCallback(){this.#Z?.disconnect(),this.#Z=null}#Q(){for(let J of this.querySelectorAll(":scope > fig-attachment"))if(!J.hasAttribute("role"))J.setAttribute("role","listitem"),J.setAttribute("data-generated-role","")}}U("fig-attachments",YJ);class GJ extends HTMLElement{#Z=null;#Q=null;#J=null;#X=!1;#j=null;#$=new Set;#O=null;#B=null;#G=this.#L.bind(this);#_=!1;static get observedAttributes(){return["label","direction"]}connectedCallback(){if(!this.#Z)this.#q();if(this.#M(),this.#k(),this.#U(),this.removeEventListener("click",this.#G),this.addEventListener("click",this.#G),f(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==="direction")Q=!0;else Z=!0}if(Q)this.#M();if(Z)this.#k()});this.#j.observe(this,{attributes:!0})}disconnectedCallback(){this.#j?.disconnect(),this.#N(),this.removeEventListener("click",this.#G),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction")this.#M()}#q(){this.#_=Y(this,"checked");let Q=Array.from(this.childNodes).filter((q)=>q.nodeType!==Node.TEXT_NODE||Boolean(q.textContent?.trim())).find((q)=>q.nodeType===Node.ELEMENT_NODE&&q.matches("label")),Z=document.createElement("fig-field"),$=Q||document.createElement("label"),j=document.createElement("fig-segmented-control"),_=document.createElement("fig-segment"),X=document.createElement("fig-segment");j.setAttribute("sizing","equal"),_.setAttribute("value","off"),_.textContent="Off",X.setAttribute("value","on"),X.textContent="On",j.append(_,X),Z.append($,j),this.#Z=Z,this.#Q=$,this.#J=j,this.#X=Boolean(Q),this.replaceChildren(Z)}#M(){if(!this.#Z||!this.#Q)return;let J=this.hasAttribute("label"),Q=this.getAttribute("label");if(J&&(Q??"").trim()==="")this.#Q.remove();else{if(!this.#X)this.#Q.textContent=J?Q??"":"Label";if(this.#Q.parentElement!==this.#Z)this.#Z.prepend(this.#Q)}this.#Z.setAttribute("direction",this.getAttribute("direction")||"horizontal")}#Y(){let J=new Set(["label","direction","size","oninput","onchange","class","style","id","checked","value","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.#$)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#J.setAttribute("value",Y(this,"checked")?"on":"off"),this.#$=Q}#U(){if(!this.#J)return;this.#O??=this.#P.bind(this,"input"),this.#B??=this.#P.bind(this,"change"),this.#J.addEventListener("input",this.#O),this.#J.addEventListener("change",this.#B)}#N(){if(!this.#J)return;if(this.#O)this.#J.removeEventListener("input",this.#O);if(this.#B)this.#J.removeEventListener("change",this.#B)}#P(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=this.#J?.value==="on";this.toggleAttribute("checked",Z);let $={checked:Z,value:this.getAttribute("value")??""};this.dispatchEvent(new CustomEvent(J,{detail:$,bubbles:!0,cancelable:!0,composed:!0}))}#L(J){if(Y(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-segmented-control, fig-menu"))return;let Q=this.#J?.value==="on"?"off":"on";this.#J?.querySelector(`fig-segment[value="${Q}"]`)?.click()}get checked(){return this.#J?this.#J.value==="on":Y(this,"checked")}set checked(J){let Q=Boolean(J);if(this.toggleAttribute("checked",Q),this.#J)this.#J.value=Q?"on":"off"}get value(){return this.#J?.value??this.getAttribute("value")??""}set value(J){this.setAttribute("value",J??"")}get defaultValue(){return this.hasAttribute("default")?Y(this,"default"):this.#_}get isDefault(){return this.checked===this.defaultValue}resetToDefault(){let J=this.defaultValue;this.checked=J,g(this,{checked:J,value:this.getAttribute("value")??""})}focus(J){(this.#J?.querySelector("fig-segment[selected]")||this.#J?.querySelector("fig-segment"))?.focus(J)}}U("propskit-switch",GJ);function w(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 VJ(J){let{color:Q,alpha:Z}=w(J);return JSON.stringify({type:"solid",color:Q,alpha:Z})}function t(J){return`url("${String(J).replace(/\\/g,"\\\\").replace(/"/g,"\\\"")}")`}function fJ(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 x(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:$}=w(Q);return{type:"solid",color:Z,alpha:$}}if(fJ(Q))return CJ(Q);return{type:"solid",color:"#D9D9D9",alpha:1}}function s(J){if(J==null)return"";return typeof J==="string"?J:JSON.stringify(J)}function AJ(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||AJ(J.gradient)||"";case"image":return J.image?.url?t(J.image.url):"";case"video":return J.video?.poster?t(J.video.poster):"";case"webcam":return J.webcam?.snapshot?t(J.webcam.snapshot):"";default:return J?.swatchBackground||J?.background||J?.css||Q?.getAttribute("swatch-background")||""}}function EJ(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 DJ(J){let Q=EJ(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 IJ(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 MJ extends HTMLElement{#Z=null;#Q=null;#J=null;#X=null;#j=!1;#$=null;#O=new Set;#B=null;#G=null;#_=this.#W.bind(this);#q=null;static get observedAttributes(){return["label","direction","aria-label"]}connectedCallback(){if(!this.#Z)this.#M();if(this.#Y(),this.#P(),this.#L(),this.#q===null)this.#q=this.getAttribute("default")??this.getAttribute("value")??"";if(this.removeEventListener("click",this.#_),this.addEventListener("click",this.#_),f(this),!this.#$)this.#$=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="direction"||$.attributeName==="aria-label")Q=!0;else Z=!0}if(Q)this.#Y();if(Z)this.#P()});this.#$.observe(this,{attributes:!0})}disconnectedCallback(){this.#$?.disconnect(),this.#K(),this.removeEventListener("click",this.#_),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction"||J==="aria-label")this.#Y()}#M(){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=document.createElement("fig-field"),$=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.#Q=$,this.#J=j,this.#X=_,this.#j=Boolean(Q),this.replaceChildren(Z)}#Y(){if(!this.#Z||!this.#Q||!this.#J)return;let J=this.hasAttribute("label"),Q=this.getAttribute("label");if(J&&(Q??"").trim()==="")this.#Q.remove();else{if(!this.#j)this.#Q.textContent=J?Q??"":"Label";if(this.#Q.parentElement!==this.#Z)this.#Z.prepend(this.#Q)}this.#Z.setAttribute("direction",this.getAttribute("direction")||"horizontal"),this.#J.setAttribute("aria-label",this.getAttribute("aria-label")||this.#Q.textContent?.trim()||"Color")}#k(){return w(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-"))}#P(){if(!this.#J)return;let J=this.#N(),Q=new Set(J);for(let _ of this.#O)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.#X)this.#X.setAttribute("background",$),this.#X.setAttribute("alpha",String(j));this.#O=Q}#L(){if(!this.#J)return;this.#B??=this.#z.bind(this,"input"),this.#G??=this.#z.bind(this,"change"),this.#J.addEventListener("input",this.#B),this.#J.addEventListener("change",this.#G)}#K(){if(!this.#J)return;if(this.#B)this.#J.removeEventListener("input",this.#B);if(this.#G)this.#J.removeEventListener("change",this.#G)}#S(J){let Q=J instanceof CustomEvent&&J.detail!==void 0?J.detail:void 0;if(typeof Q==="string"&&Q)return w(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 w(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 w(Z).color;return this.#k().color}#T(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)}}#z(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=this.#S(Q),$=this.#T(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.#X)this.#X.setAttribute("background",$.color),this.#X.setAttribute("alpha",String($.alpha));this.dispatchEvent(new CustomEvent(J,{detail:$,bubbles:!0,cancelable:!0,composed:!0}))}#W(J){if(Y(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.#F(Q)}#F(J){if(!this.#J)return;let Q=VJ(J);if(this.#J.getAttribute("value")===Q)this.#J.removeAttribute("value");if(this.#J.setAttribute("value",Q),this.#X){let Z=w(J);this.#X.setAttribute("background",Z.color),this.#X.setAttribute("alpha",String(Z.alpha))}}#R(){return this.getAttribute("default")??this.#q??""}get defaultValue(){return String(this.#R())}get isDefault(){return c(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.setAttribute("value",J),this.#F(J),this.dispatchEvent(new CustomEvent("input",{detail:J,bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:J,bubbles:!0,cancelable:!0,composed:!0}))}focus(J){let Q=this.querySelector("fig-swatch");if(Q instanceof HTMLElement)Q.focus(J)}}U("propskit-color",MJ);class kJ extends HTMLElement{#Z=null;#Q=null;#J=null;#X=null;#j=!1;#$=null;#O=new Set;#B=null;#G=null;#_=this.#H.bind(this);#q=null;static get observedAttributes(){return["label","direction","aria-label"]}connectedCallback(){if(!this.#Z)this.#M();if(this.#Y(),this.#T(),this.#z(),this.#q===null)this.#q=this.getAttribute("default")??this.getAttribute("value")??"";if(this.removeEventListener("click",this.#_),this.addEventListener("click",this.#_),f(this),!this.#$)this.#$=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="direction"||$.attributeName==="aria-label")Q=!0;else Z=!0}if(Q)this.#Y();if(Z)this.#T()});this.#$.observe(this,{attributes:!0})}disconnectedCallback(){this.#$?.disconnect(),this.#W(),this.removeEventListener("click",this.#_),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction"||J==="aria-label")this.#Y()}#M(){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=document.createElement("fig-field"),$=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.#Q=$,this.#J=j,this.#X=_,this.#j=Boolean(Q),this.replaceChildren(Z)}#Y(){if(!this.#Z||!this.#Q||!this.#J)return;let J=this.hasAttribute("label"),Q=this.getAttribute("label");if(J&&(Q??"").trim()==="")this.#Q.remove();else{if(!this.#j)this.#Q.textContent=J?Q??"":"Label";if(this.#Q.parentElement!==this.#Z)this.#Z.prepend(this.#Q)}this.#Z.setAttribute("direction",this.getAttribute("direction")||"horizontal"),this.#J.setAttribute("aria-label",this.getAttribute("aria-label")||this.#Q.textContent?.trim()||"Fill")}#k(){return x(this.getAttribute("value"))}#U(){return s(this.#k())}#N(){let J=this.#k()?.type;if(!J)return null;return this.querySelector(`[slot="mode-${J}"]`)}#P(){let J=this.#J?.value;if(J&&typeof J==="object")return J;if(typeof J==="string"&&J)return x(J);return null}#L(J){let Q=this.#P();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}}}#K(J=this.#k()){if(!this.#X)return;let Q=this.#L(J),Z=QJ(Q,this.#N());if(!Z)Z=QJ(this.#P(),this.#N());if(!Z){let j=this.#X.getAttribute("background")??"";if(j.startsWith("url("))Z=j}this.#X.setAttribute("background",Z),this.#X.setAttribute("alpha",String(IJ(Q)));let $=DJ(Q||J);if($)this.#X.style.setProperty("--swatch-bg-size",$.size),this.#X.style.setProperty("--swatch-bg-position",$.position)}#S(){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-"))}#T(){if(!this.#J)return;let J=this.#S(),Q=new Set(J);for(let $ of this.#O)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.#K(),this.#O=Q}#z(){if(!this.#J)return;this.#B??=this.#R.bind(this,"input"),this.#G??=this.#R.bind(this,"change"),this.#J.addEventListener("input",this.#B),this.#J.addEventListener("change",this.#G)}#W(){if(!this.#J)return;if(this.#B)this.#J.removeEventListener("input",this.#B);if(this.#G)this.#J.removeEventListener("change",this.#G)}#F(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 x(Q);let Z=this.#J?.value;if(Z&&typeof Z==="object")return Z;if(typeof Z==="string"&&Z)return x(Z);return this.#k()}#R(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=this.#L(this.#F(Q)),$=s(Z);if(this.setAttribute("value",$),this.#J&&this.#J.getAttribute("value")!==$)this.#J.setAttribute("value",$);this.#K(Z),this.dispatchEvent(new CustomEvent(J,{detail:Z,bubbles:!0,cancelable:!0,composed:!0}))}#H(J){if(Y(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")??s(this.#J?.value)??""}set value(J){if(J===null||J===void 0||J===""){this.removeAttribute("value"),this.#J?.removeAttribute("value"),this.#K({type:"solid",color:"",alpha:1});return}let Q=s(typeof J==="string"?x(J):J);this.setAttribute("value",Q),this.#D(Q)}#D(J){if(!this.#J)return;let Q=s(x(J));if(this.#J.getAttribute("value")===Q)this.#J.removeAttribute("value");this.#J.setAttribute("value",Q),this.#K(x(Q))}#w(){return this.getAttribute("default")??this.#q??""}get defaultValue(){return String(this.#w())}get isDefault(){return e(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.setAttribute("value",J),this.#D(J);let Q=x(J);this.dispatchEvent(new CustomEvent("input",{detail:Q,bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:Q,bubbles:!0,cancelable:!0,composed:!0}))}focus(J){let Q=this.querySelector("fig-swatch");if(Q instanceof HTMLElement)Q.focus(J)}}U("propskit-fill",kJ);class NJ extends HTMLElement{#Z=null;#Q=null;#J=null;#X=!1;#j=null;#$=new Set;#O=null;#B=null;#G=this.#K.bind(this);#_=null;static get observedAttributes(){return["label","direction","aria-label"]}connectedCallback(){if(!this.#Z)this.#q();if(this.#M(),this.#k(),this.#U(),this.#_===null)this.#_=this.getAttribute("default")??this.getAttribute("value")??JSON.stringify(this.#J?.value??{});if(this.removeEventListener("click",this.#G),this.addEventListener("click",this.#G),f(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==="direction"||$.attributeName==="aria-label")Q=!0;else Z=!0}if(Q)this.#M();if(Z)this.#k()});this.#j.observe(this,{attributes:!0})}disconnectedCallback(){this.#j?.disconnect(),this.#N(),this.removeEventListener("click",this.#G),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction"||J==="aria-label")this.#M()}#q(){let Q=Array.from(this.childNodes).filter((_)=>_.nodeType!==Node.TEXT_NODE||Boolean(_.textContent?.trim())).find((_)=>_.nodeType===Node.ELEMENT_NODE&&_.matches("label")),Z=document.createElement("fig-field"),$=Q||document.createElement("label"),j=document.createElement("fig-input-gradient");j.anchorElement=this,Z.append($,j),this.#Z=Z,this.#Q=$,this.#J=j,this.#X=Boolean(Q),this.replaceChildren(Z)}#M(){if(!this.#Z||!this.#Q||!this.#J)return;let J=this.hasAttribute("label"),Q=this.getAttribute("label");if(J&&(Q??"").trim()==="")this.#Q.remove();else{if(!this.#X)this.#Q.textContent=J?Q??"":"Label";if(this.#Q.parentElement!==this.#Z)this.#Z.prepend(this.#Q)}this.#Z.setAttribute("direction",this.getAttribute("direction")||"horizontal"),this.#J.setAttribute("aria-label",this.getAttribute("aria-label")||this.#Q.textContent?.trim()||"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.#$)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.#$=Q}#U(){if(!this.#J)return;this.#O??=this.#L.bind(this,"input"),this.#B??=this.#L.bind(this,"change"),this.#J.addEventListener("input",this.#O),this.#J.addEventListener("change",this.#B)}#N(){if(!this.#J)return;if(this.#O)this.#J.removeEventListener("input",this.#O);if(this.#B)this.#J.removeEventListener("change",this.#B)}#P(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)}#L(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=this.#P(Q);this.setAttribute("value",Z);let $=Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:this.#J?.value;this.dispatchEvent(new CustomEvent(J,{detail:$,bubbles:!0,cancelable:!0,composed:!0}))}#K(J){if(Y(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.#_??""}get isDefault(){return e(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;if(!J)return;this.value=J;let Q=this.#J?.value;g(this,Q)}focus(J){this.#J?.focus(J)}}U("propskit-gradient",NJ);class u extends HTMLElement{#Z=null;#Q=null;#J=null;#X=!1;#j=!1;#$=null;#O=new Set;#B=null;#G=null;#_=null;#q=this.#I.bind(this);#M=this.#w.bind(this);#Y=!1;#k=null;static get observedAttributes(){return["label","direction","aria-label","options","value"]}static#U(){return["fig-select","fig-select-options","fig-select-option"].every((J)=>{let Q=customElements.get(J);return typeof Q==="function"&&Q.prototype instanceof HTMLElement})}static#N(J){let Q=J||"";if(Q.startsWith("["))try{let $=JSON.parse(Q);return Array.isArray($)?$:[]}catch{}let Z=Q.includes(`
|
|
1
|
+
function U(J,Q){if(!customElements.get(J))customElements.define(J,Q)}function Y(J,Q){return J.hasAttribute(Q)&&J.getAttribute(Q)!=="false"}var ZJ="http://www.w3.org/2000/svg";function $J(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 jJ(J,Q={}){for(let[Z,$]of Object.entries(Q)){if($===null||$===void 0||$===!1)continue;if(Z==="className")if(J.namespaceURI===ZJ)J.setAttribute("class",String($));else J.className=String($);else if($===!0)J.setAttribute(Z,"");else J.setAttribute(Z,String($))}return J}function L(J,Q,Z){let $=document.createElement(J);return jJ($,Q),$J($,Z)}function E(J,Q,Z){let $=document.createElementNS(ZJ,J);return jJ($,Q),$J($,Z)}function l(J,Q){let Z=Y(J,"disabled");for(let $ of Q)$?.toggleAttribute("disabled",Z)}function HJ(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 n=new WeakMap;function f(J){let Q=n.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 O=Q?.point;if(O)Z.showAt?.(O.x,O.y)};Q={menu:Z,point:null,clearPendingOpen:_,handleContextMenu:(O)=>{if(Y(J,"disabled")||O.target?.closest?.("fig-menu"))return;O.preventDefault(),O.stopPropagation(),O.stopImmediatePropagation?.(),Q.point={x:O.clientX,y:O.clientY},_(),window.addEventListener("pointerup",X,{once:!0,capture:!0}),window.addEventListener("pointercancel",X,{once:!0,capture:!0}),j=window.setTimeout(X,180)},handleChange:(O)=>{if(O.stopPropagation(),O.detail?.value==="reset-default")J.resetToDefault?.()}},n.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 D(J){let Q=n.get(J);if(!Q)return;Q.clearPendingOpen(),J.removeEventListener("contextmenu",Q.handleContextMenu),Q.menu.removeEventListener("change",Q.handleChange)}function g(J,Q){for(let Z of["input","change"])J.dispatchEvent(new CustomEvent(Z,{detail:Q,bubbles:!0,cancelable:!0,composed:!0}))}function c(J,Q){if(typeof J==="boolean"||typeof Q==="boolean")return Boolean(J)===Boolean(Q);return String(J??"")===String(Q??"")}function e(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 RJ(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,O]=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*O<=Z?"light":"dark"}var JJ=0;function _J(J="fig-lab"){return JJ+=1,`${J}-${JJ}`}class XJ extends HTMLElement{}U("fig-ai-prompt",XJ);class BJ extends HTMLElement{}U("fig-ai-context",BJ);class qJ extends HTMLElement{}U("fig-chat-message",qJ);class OJ extends HTMLElement{#Z=null;#Q=null;#J=null;#_=null;#j=null;#$=null;#O=this.#L.bind(this);#B=this.#K.bind(this);#G=this.#P.bind(this);static get observedAttributes(){return["src","name","value","removable","disabled"]}connectedCallback(){if(!this.#Q)this.#X();this.#j.removeEventListener("click",this.#O),this.#j.addEventListener("click",this.#O),this.#q(),this.#Y()}disconnectedCallback(){this.#j?.removeEventListener("click",this.#O),this.#M()}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Q)return;this.#Y()}#X(){this.#Z=document.createElement("fig-tooltip"),this.#Z.className="fig-attachment-tooltip",this.#Q=document.createElement("fig-image"),this.#Q.setAttribute("aspect-ratio","1/1"),this.#Q.setAttribute("fit","cover"),this.#Q.setAttribute("full",""),this.#J=document.createElement("span"),this.#J.className="fig-attachment-fallback",this.#J.setAttribute("aria-hidden","true"),this.#_=document.createElement("fig-tooltip"),this.#_.className="fig-attachment-remove-tooltip",this.#_.setAttribute("text","Remove attachment"),this.#j=document.createElement("fig-button"),this.#j.className="fig-attachment-remove",this.#j.setAttribute("variant","overlay"),this.#j.setAttribute("size","small"),this.#j.setAttribute("icon","");let J=document.createElement("fig-icon");J.setAttribute("name","close"),J.setAttribute("size","small"),this.#j.append(J),this.#_.append(this.#j),this.#Q.append(this.#J),this.#Z.append(this.#Q),this.replaceChildren(this.#Z,this.#_),this.#j.addEventListener("click",this.#O),this.#q()}#q(){let J=this.#Q?.mediaEl;if(!J||J===this.#$)return;this.#M(),this.#$=J,this.#$.addEventListener("load",this.#B),this.#$.addEventListener("error",this.#G)}#M(){if(!this.#$)return;this.#$.removeEventListener("load",this.#B),this.#$.removeEventListener("error",this.#G),this.#$=null}#Y(){let J=this.getAttribute("src")||"",Q=this.getAttribute("name")||"Attachment",Z=!this.hasAttribute("removable")||Y(this,"removable"),$=Y(this,"disabled");if(this.#Z.setAttribute("text",Q),this.#Q.setAttribute("alt",Q),J)this.#Q.setAttribute("src",J);else this.#Q.removeAttribute("src");if(this.#q(),this.#J.textContent=this.#k(Q),this.#j.hidden=!Z,this.#j.toggleAttribute("disabled",$),this.#j.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","")}#L(J){if(J.stopPropagation(),Y(this,"disabled")||this.hasAttribute("removable")&&!Y(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}}))}}U("fig-attachment",OJ);class YJ extends HTMLElement{#Z=null;connectedCallback(){if(!this.hasAttribute("role"))this.setAttribute("role","list"),this.setAttribute("data-generated-role","");if(this.#Q(),!this.#Z)this.#Z=new MutationObserver(()=>this.#Q()),this.#Z.observe(this,{childList:!0})}disconnectedCallback(){this.#Z?.disconnect(),this.#Z=null}#Q(){for(let J of this.querySelectorAll(":scope > fig-attachment"))if(!J.hasAttribute("role"))J.setAttribute("role","listitem"),J.setAttribute("data-generated-role","")}}U("fig-attachments",YJ);class GJ extends HTMLElement{#Z=null;#Q=null;#J=null;#_=!1;#j=null;#$=new Set;#O=null;#B=null;#G=this.#U.bind(this);#X=!1;static get observedAttributes(){return["label","direction"]}connectedCallback(){if(!this.#Z)this.#q();if(this.#M(),this.#k(),this.#K(),this.removeEventListener("click",this.#G),this.addEventListener("click",this.#G),f(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==="direction")Q=!0;else Z=!0}if(Q)this.#M();if(Z)this.#k()});this.#j.observe(this,{attributes:!0})}disconnectedCallback(){this.#j?.disconnect(),this.#P(),this.removeEventListener("click",this.#G),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction")this.#M()}#q(){this.#X=Y(this,"checked");let Q=Array.from(this.childNodes).filter((q)=>q.nodeType!==Node.TEXT_NODE||Boolean(q.textContent?.trim())).find((q)=>q.nodeType===Node.ELEMENT_NODE&&q.matches("label")),Z=document.createElement("fig-field"),$=Q||document.createElement("label"),j=document.createElement("fig-segmented-control"),_=document.createElement("fig-segment"),X=document.createElement("fig-segment");j.setAttribute("sizing","equal"),_.setAttribute("value","off"),_.textContent="Off",X.setAttribute("value","on"),X.textContent="On",j.append(_,X),Z.append($,j),this.#Z=Z,this.#Q=$,this.#J=j,this.#_=Boolean(Q),this.replaceChildren(Z)}#M(){if(!this.#Z||!this.#Q)return;let J=this.hasAttribute("label"),Q=this.getAttribute("label");if(J&&(Q??"").trim()==="")this.#Q.remove();else{if(!this.#_)this.#Q.textContent=J?Q??"":"Label";if(this.#Q.parentElement!==this.#Z)this.#Z.prepend(this.#Q)}this.#Z.setAttribute("direction",this.getAttribute("direction")||"horizontal")}#Y(){let J=new Set(["label","direction","size","oninput","onchange","class","style","id","checked","value","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.#$)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#J.setAttribute("value",Y(this,"checked")?"on":"off"),this.#$=Q}#K(){if(!this.#J)return;this.#O??=this.#L.bind(this,"input"),this.#B??=this.#L.bind(this,"change"),this.#J.addEventListener("input",this.#O),this.#J.addEventListener("change",this.#B)}#P(){if(!this.#J)return;if(this.#O)this.#J.removeEventListener("input",this.#O);if(this.#B)this.#J.removeEventListener("change",this.#B)}#L(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=this.#J?.value==="on";this.toggleAttribute("checked",Z);let $={checked:Z,value:this.getAttribute("value")??""};this.dispatchEvent(new CustomEvent(J,{detail:$,bubbles:!0,cancelable:!0,composed:!0}))}#U(J){if(Y(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-segmented-control, fig-menu"))return;let Q=this.#J?.value==="on"?"off":"on";this.#J?.querySelector(`fig-segment[value="${Q}"]`)?.click()}get checked(){return this.#J?this.#J.value==="on":Y(this,"checked")}set checked(J){let Q=Boolean(J);if(this.toggleAttribute("checked",Q),this.#J)this.#J.value=Q?"on":"off"}get value(){return this.#J?.value??this.getAttribute("value")??""}set value(J){this.setAttribute("value",J??"")}get defaultValue(){return this.hasAttribute("default")?Y(this,"default"):this.#X}get isDefault(){return this.checked===this.defaultValue}resetToDefault(){let J=this.defaultValue;this.checked=J,g(this,{checked:J,value:this.getAttribute("value")??""})}focus(J){(this.#J?.querySelector("fig-segment[selected]")||this.#J?.querySelector("fig-segment"))?.focus(J)}}U("propskit-switch",GJ);function w(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 VJ(J){let{color:Q,alpha:Z}=w(J);return JSON.stringify({type:"solid",color:Q,alpha:Z})}function t(J){return`url("${String(J).replace(/\\/g,"\\\\").replace(/"/g,"\\\"")}")`}function fJ(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 x(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:$}=w(Q);return{type:"solid",color:Z,alpha:$}}if(fJ(Q))return CJ(Q);return{type:"solid",color:"#D9D9D9",alpha:1}}function s(J){if(J==null)return"";return typeof J==="string"?J:JSON.stringify(J)}function AJ(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||AJ(J.gradient)||"";case"image":return J.image?.url?t(J.image.url):"";case"video":return J.video?.poster?t(J.video.poster):"";case"webcam":return J.webcam?.snapshot?t(J.webcam.snapshot):"";default:return J?.swatchBackground||J?.background||J?.css||Q?.getAttribute("swatch-background")||""}}function EJ(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 DJ(J){let Q=EJ(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 IJ(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 MJ extends HTMLElement{#Z=null;#Q=null;#J=null;#_=null;#j=!1;#$=null;#O=new Set;#B=null;#G=null;#X=this.#H.bind(this);#q=null;static get observedAttributes(){return["label","direction","aria-label"]}connectedCallback(){if(!this.#Z)this.#M();if(this.#Y(),this.#L(),this.#U(),this.#q===null)this.#q=this.getAttribute("default")??this.getAttribute("value")??"";if(this.removeEventListener("click",this.#X),this.addEventListener("click",this.#X),f(this),!this.#$)this.#$=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="direction"||$.attributeName==="aria-label")Q=!0;else Z=!0}if(Q)this.#Y();if(Z)this.#L()});this.#$.observe(this,{attributes:!0})}disconnectedCallback(){this.#$?.disconnect(),this.#S(),this.removeEventListener("click",this.#X),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction"||J==="aria-label")this.#Y()}#M(){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=document.createElement("fig-field"),$=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.#Q=$,this.#J=j,this.#_=_,this.#j=Boolean(Q),this.replaceChildren(Z)}#Y(){if(!this.#Z||!this.#Q||!this.#J)return;let J=this.hasAttribute("label"),Q=this.getAttribute("label");if(J&&(Q??"").trim()==="")this.#Q.remove();else{if(!this.#j)this.#Q.textContent=J?Q??"":"Label";if(this.#Q.parentElement!==this.#Z)this.#Z.prepend(this.#Q)}this.#Z.setAttribute("direction",this.getAttribute("direction")||"horizontal"),this.#J.setAttribute("aria-label",this.getAttribute("aria-label")||this.#Q.textContent?.trim()||"Color")}#k(){return w(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-"))}#L(){if(!this.#J)return;let J=this.#P(),Q=new Set(J);for(let _ of this.#O)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.#_)this.#_.setAttribute("background",$),this.#_.setAttribute("alpha",String(j));this.#O=Q}#U(){if(!this.#J)return;this.#B??=this.#W.bind(this,"input"),this.#G??=this.#W.bind(this,"change"),this.#J.addEventListener("input",this.#B),this.#J.addEventListener("change",this.#G)}#S(){if(!this.#J)return;if(this.#B)this.#J.removeEventListener("input",this.#B);if(this.#G)this.#J.removeEventListener("change",this.#G)}#T(J){let Q=J instanceof CustomEvent&&J.detail!==void 0?J.detail:void 0;if(typeof Q==="string"&&Q)return w(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 w(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 w(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(),Y(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.#_)this.#_.setAttribute("background",$.color),this.#_.setAttribute("alpha",String($.alpha));this.dispatchEvent(new CustomEvent(J,{detail:$,bubbles:!0,cancelable:!0,composed:!0}))}#H(J){if(Y(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=VJ(J);if(this.#J.getAttribute("value")===Q)this.#J.removeAttribute("value");if(this.#J.setAttribute("value",Q),this.#_){let Z=w(J);this.#_.setAttribute("background",Z.color),this.#_.setAttribute("alpha",String(Z.alpha))}}#V(){return this.getAttribute("default")??this.#q??""}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),this.dispatchEvent(new CustomEvent("input",{detail:J,bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:J,bubbles:!0,cancelable:!0,composed:!0}))}focus(J){let Q=this.querySelector("fig-swatch");if(Q instanceof HTMLElement)Q.focus(J)}}U("propskit-color",MJ);class kJ extends HTMLElement{#Z=null;#Q=null;#J=null;#_=null;#j=!1;#$=null;#O=new Set;#B=null;#G=null;#X=this.#R.bind(this);#q=null;static get observedAttributes(){return["label","direction","aria-label"]}connectedCallback(){if(!this.#Z)this.#M();if(this.#Y(),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),f(this),!this.#$)this.#$=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J){if($.type!=="attributes")continue;if($.attributeName==="label"||$.attributeName==="direction"||$.attributeName==="aria-label")Q=!0;else Z=!0}if(Q)this.#Y();if(Z)this.#F()});this.#$.observe(this,{attributes:!0})}disconnectedCallback(){this.#$?.disconnect(),this.#H(),this.removeEventListener("click",this.#X),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction"||J==="aria-label")this.#Y()}#M(){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=document.createElement("fig-field"),$=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.#Q=$,this.#J=j,this.#_=_,this.#j=Boolean(Q),this.replaceChildren(Z)}#Y(){if(!this.#Z||!this.#Q||!this.#J)return;let J=this.hasAttribute("label"),Q=this.getAttribute("label");if(J&&(Q??"").trim()==="")this.#Q.remove();else{if(!this.#j)this.#Q.textContent=J?Q??"":"Label";if(this.#Q.parentElement!==this.#Z)this.#Z.prepend(this.#Q)}this.#Z.setAttribute("direction",this.getAttribute("direction")||"horizontal"),this.#J.setAttribute("aria-label",this.getAttribute("aria-label")||this.#Q.textContent?.trim()||"Fill")}#k(){return x(this.getAttribute("value"))}#K(){return s(this.#k())}#P(){let J=this.#k()?.type;if(!J)return null;return this.querySelector(`[slot="mode-${J}"]`)}#L(){let J=this.#J?.value;if(J&&typeof J==="object")return J;if(typeof J==="string"&&J)return x(J);return null}#U(J){let Q=this.#L();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}}}#S(J=this.#k()){if(!this.#_)return;let Q=this.#U(J),Z=QJ(Q,this.#P());if(!Z)Z=QJ(this.#L(),this.#P());if(!Z){let j=this.#_.getAttribute("background")??"";if(j.startsWith("url("))Z=j}this.#_.setAttribute("background",Z),this.#_.setAttribute("alpha",String(IJ(Q)));let $=DJ(Q||J);if($)this.#_.style.setProperty("--swatch-bg-size",$.size),this.#_.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.#O)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.#S(),this.#O=Q}#W(){if(!this.#J)return;this.#B??=this.#V.bind(this,"input"),this.#G??=this.#V.bind(this,"change"),this.#J.addEventListener("input",this.#B),this.#J.addEventListener("change",this.#G)}#H(){if(!this.#J)return;if(this.#B)this.#J.removeEventListener("input",this.#B);if(this.#G)this.#J.removeEventListener("change",this.#G)}#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 x(Q);let Z=this.#J?.value;if(Z&&typeof Z==="object")return Z;if(typeof Z==="string"&&Z)return x(Z);return this.#k()}#V(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=this.#U(this.#z(Q)),$=s(Z);if(this.setAttribute("value",$),this.#J&&this.#J.getAttribute("value")!==$)this.#J.setAttribute("value",$);this.#S(Z),this.dispatchEvent(new CustomEvent(J,{detail:Z,bubbles:!0,cancelable:!0,composed:!0}))}#R(J){if(Y(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")??s(this.#J?.value)??""}set value(J){if(J===null||J===void 0||J===""){this.removeAttribute("value"),this.#J?.removeAttribute("value"),this.#S({type:"solid",color:"",alpha:1});return}let Q=s(typeof J==="string"?x(J):J);this.setAttribute("value",Q),this.#D(Q)}#D(J){if(!this.#J)return;let Q=s(x(J));if(this.#J.getAttribute("value")===Q)this.#J.removeAttribute("value");this.#J.setAttribute("value",Q),this.#S(x(Q))}#h(){return this.getAttribute("default")??this.#q??""}get defaultValue(){return String(this.#h())}get isDefault(){return e(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.setAttribute("value",J),this.#D(J);let Q=x(J);this.dispatchEvent(new CustomEvent("input",{detail:Q,bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:Q,bubbles:!0,cancelable:!0,composed:!0}))}focus(J){let Q=this.querySelector("fig-swatch");if(Q instanceof HTMLElement)Q.focus(J)}}U("propskit-fill",kJ);class NJ extends HTMLElement{#Z=null;#Q=null;#J=null;#_=!1;#j=null;#$=new Set;#O=null;#B=null;#G=this.#S.bind(this);#X=null;static get observedAttributes(){return["label","direction","aria-label"]}connectedCallback(){if(!this.#Z)this.#q();if(this.#M(),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.#G),this.addEventListener("click",this.#G),f(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==="direction"||$.attributeName==="aria-label")Q=!0;else Z=!0}if(Q)this.#M();if(Z)this.#k()});this.#j.observe(this,{attributes:!0})}disconnectedCallback(){this.#j?.disconnect(),this.#P(),this.removeEventListener("click",this.#G),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction"||J==="aria-label")this.#M()}#q(){let Q=Array.from(this.childNodes).filter((_)=>_.nodeType!==Node.TEXT_NODE||Boolean(_.textContent?.trim())).find((_)=>_.nodeType===Node.ELEMENT_NODE&&_.matches("label")),Z=document.createElement("fig-field"),$=Q||document.createElement("label"),j=document.createElement("fig-input-gradient");j.anchorElement=this,Z.append($,j),this.#Z=Z,this.#Q=$,this.#J=j,this.#_=Boolean(Q),this.replaceChildren(Z)}#M(){if(!this.#Z||!this.#Q||!this.#J)return;let J=this.hasAttribute("label"),Q=this.getAttribute("label");if(J&&(Q??"").trim()==="")this.#Q.remove();else{if(!this.#_)this.#Q.textContent=J?Q??"":"Label";if(this.#Q.parentElement!==this.#Z)this.#Z.prepend(this.#Q)}this.#Z.setAttribute("direction",this.getAttribute("direction")||"horizontal"),this.#J.setAttribute("aria-label",this.getAttribute("aria-label")||this.#Q.textContent?.trim()||"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.#$)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.#$=Q}#K(){if(!this.#J)return;this.#O??=this.#U.bind(this,"input"),this.#B??=this.#U.bind(this,"change"),this.#J.addEventListener("input",this.#O),this.#J.addEventListener("change",this.#B)}#P(){if(!this.#J)return;if(this.#O)this.#J.removeEventListener("input",this.#O);if(this.#B)this.#J.removeEventListener("change",this.#B)}#L(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)}#U(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=this.#L(Q);this.setAttribute("value",Z);let $=Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:this.#J?.value;this.dispatchEvent(new CustomEvent(J,{detail:$,bubbles:!0,cancelable:!0,composed:!0}))}#S(J){if(Y(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 e(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;if(!J)return;this.value=J;let Q=this.#J?.value;g(this,Q)}focus(J){this.#J?.focus(J)}}U("propskit-gradient",NJ);class u extends HTMLElement{#Z=null;#Q=null;#J=null;#_=!1;#j=!1;#$=null;#O=new Set;#B=null;#G=null;#X=null;#q=this.#I.bind(this);#M=this.#h.bind(this);#Y=!1;#k=null;static get observedAttributes(){return["label","direction","aria-label","options","value"]}static#K(){return["fig-select","fig-select-options","fig-select-option"].every((J)=>{let Q=customElements.get(J);return typeof Q==="function"&&Q.prototype instanceof HTMLElement})}static#P(J){let Q=J||"";if(Q.startsWith("["))try{let $=JSON.parse(Q);return Array.isArray($)?$:[]}catch{}let Z=Q.includes(`
|
|
2
2
|
`)?`
|
|
3
|
-
`:",";return Q.split(Z).map(($)=>$.trim()).filter(Boolean)}static#P(J){if(J&&typeof J==="object")return String(J.value??J.label??"");return String(J??"")}static#L(J){if(J&&typeof J==="object")return String(J.label??J.value??"");return String(J??"")}connectedCallback(){if(!this.#Z)this.#K();if(this.#S(),this.#W(),this.#F(),this.removeEventListener("click",this.#q),this.addEventListener("click",this.#q),this.removeEventListener("pointerdown",this.#M,!0),this.addEventListener("pointerdown",this.#M,!0),f(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==="direction"||j==="aria-label")Q=!0;else Z=!0}if(Q)this.#S();if(Z)this.#W()});this.#$.observe(this,{attributes:!0})}disconnectedCallback(){this.#$?.disconnect(),this.#R(),this.removeEventListener("click",this.#q),this.removeEventListener("pointerdown",this.#M,!0),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction"||J==="aria-label"){this.#S();return}if(J==="options"||J==="value")this.#W()}#K(){this.#k=this.getAttribute("value")??"";let J=this.querySelector(":scope > label"),Q=this.querySelector(":scope > fig-select-options"),Z=document.createElement("fig-field"),$=J||document.createElement("label");this.#X=u.#U();let j=document.createElement(this.#X?"fig-select":"fig-dropdown");if(j.setAttribute("full",""),this.#X&&Q)j.append(Q);Z.append($,j),this.#Z=Z,this.#Q=$,this.#J=j,this.#j=Boolean(J),this.replaceChildren(Z)}#S(){if(!this.#Z||!this.#Q||!this.#J)return;let J=this.hasAttribute("label"),Q=this.getAttribute("label");if(J&&(Q??"").trim()==="")this.#Q.remove();else{if(!this.#j)this.#Q.textContent=J?Q??"":"Label";if(this.#Q.parentElement!==this.#Z)this.#Z.prepend(this.#Q)}this.#Z.setAttribute("direction",this.getAttribute("direction")||"horizontal"),this.#J.setAttribute("label",this.getAttribute("aria-label")||this.#Q.textContent?.trim()||"Select"),this.#J.setAttribute("full","")}#T(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","full","default","variant"]);if(!this.#X)J.add("options");return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#z(){if(!this.#J||this.#X)return;let J=u.#N(this.getAttribute("options"));for(let Z of[...this.#J.children])if(Z.localName==="option"||Z.localName==="optgroup")Z.remove();for(let Z of J){let $=document.createElement("option");$.value=u.#P(Z),$.textContent=u.#L(Z),this.#J.appendChild($)}let Q=this.getAttribute("value");if(Q!=null){let Z=()=>{if(this.#J?.setAttribute("value",Q),this.#J&&"value"in this.#J)this.#J.value=Q};Z(),queueMicrotask(Z)}}#W(){if(!this.#J)return;if(!this.#X)this.#z();let J=this.#T().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.#O)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#O=Q}#F(){if(!this.#J)return;if(this.#B??=this.#H.bind(this,"input"),this.#G??=this.#H.bind(this,"change"),this.#J.addEventListener("input",this.#B),this.#J.addEventListener("change",this.#G),this.#X)this.#_??=this.#H.bind(this,"optionhover"),this.#J.addEventListener("optionhover",this.#_)}#R(){if(!this.#J)return;if(this.#B)this.#J.removeEventListener("input",this.#B);if(this.#G)this.#J.removeEventListener("change",this.#G);if(this.#_)this.#J.removeEventListener("optionhover",this.#_)}#H(J,Q){if(Q.target!==this.#J)return;if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=this.#J?.value??"";if(J!=="optionhover")this.setAttribute("value",String(Z));let $=Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:Z;this.dispatchEvent(new CustomEvent(J,{detail:$,bubbles:!0,cancelable:!0,composed:!0}))}#D(){if(!this.#J||!this.#X)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"))}#w(J){if(!(J.target instanceof Element))return;if(J.target.closest("fig-menu"))return;if(J.target.closest("fig-select, fig-dropdown")){this.#Y=!1;return}if(!this.#X)return;this.#Y=this.#D()}#I(J){if(Y(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-menu"))return;if(J.target instanceof Element&&J.target.closest("fig-select, fig-dropdown")){this.#Y=!1;return}if(!this.#J||Y(this.#J,"disabled")){this.#Y=!1;return}if(this.#J.focus(),!this.#X)return;if(this.#Y||this.#D()){this.#Y=!1,this.#J.open=!1;return}this.#J.open=!0}get value(){return 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;g(this,J)}focus(J){this.#J?.focus(J)}}U("propskit-select",u);class PJ extends HTMLElement{#Z=null;#Q=null;#J=null;#X=!1;#j=null;#$=new Set;#O=null;#B=null;#G=this.#L.bind(this);#_=null;static get observedAttributes(){return["label","direction","aria-label"]}connectedCallback(){if(!this.#Z)this.#q();if(this.#M(),this.#k(),this.#U(),this.removeEventListener("click",this.#G),this.addEventListener("click",this.#G),f(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==="direction"||$.attributeName==="aria-label")Q=!0;else Z=!0}if(Q)this.#M();if(Z)this.#k()});this.#j.observe(this,{attributes:!0})}disconnectedCallback(){this.#j?.disconnect(),this.#N(),this.removeEventListener("click",this.#G),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction"||J==="aria-label")this.#M()}#q(){this.#_=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=document.createElement("fig-field"),$=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.#Q=$,this.#J=j,this.#X=Boolean(Q),this.replaceChildren(Z)}#M(){if(!this.#Z||!this.#Q||!this.#J)return;let J=this.hasAttribute("label"),Q=this.getAttribute("label");if(J&&(Q??"").trim()==="")this.#Q.remove();else{if(!this.#X)this.#Q.textContent=J?Q??"":"Label";if(this.#Q.parentElement!==this.#Z)this.#Z.prepend(this.#Q)}this.#Z.setAttribute("direction",this.getAttribute("direction")||"horizontal"),this.#J.setAttribute("aria-label",this.getAttribute("aria-label")||this.#Q.textContent?.trim()||"Text")}#Y(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","multiline","resizable","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.#$)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#$=Q}#U(){if(!this.#J)return;this.#O??=this.#P.bind(this,"input"),this.#B??=this.#P.bind(this,"change"),this.#J.addEventListener("input",this.#O),this.#J.addEventListener("change",this.#B)}#N(){if(!this.#J)return;if(this.#O)this.#J.removeEventListener("input",this.#O);if(this.#B)this.#J.removeEventListener("change",this.#B)}#P(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=this.#J?.value??"";this.setAttribute("value",String(Z));let $=Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:Z;this.dispatchEvent(new CustomEvent(J,{detail:$,bubbles:!0,cancelable:!0,composed:!0}))}#L(J){if(Y(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.#_??""}get isDefault(){return c(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.value=J,g(this,J)}focus(J){this.#J?.focus(J)}}U("propskit-text",PJ);class LJ extends HTMLElement{#Z=null;#Q=null;#J=null;#X=!1;#j=null;#$=new Set;#O=null;#B=null;#G=this.#L.bind(this);#_=null;static get observedAttributes(){return["label","direction"]}connectedCallback(){if(!this.#Z)this.#q();if(this.#M(),this.#k(),this.#U(),this.removeEventListener("click",this.#G),this.addEventListener("click",this.#G),f(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==="direction")Q=!0;else Z=!0}if(Q)this.#M();if(Z)this.#k()});this.#j.observe(this,{attributes:!0})}disconnectedCallback(){this.#j?.disconnect(),this.#N(),this.removeEventListener("click",this.#G),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction")this.#M()}#q(){this.#_=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=document.createElement("fig-field"),$=Q||document.createElement("label"),j=document.createElement("fig-input-number");Z.append($,j),this.#Z=Z,this.#Q=$,this.#J=j,this.#X=Boolean(Q),this.replaceChildren(Z);for(let _ of J)if(_!==Q)j.appendChild(_)}#M(){if(!this.#Z||!this.#Q)return;let J=this.hasAttribute("label"),Q=this.getAttribute("label");if(J&&(Q??"").trim()==="")this.#Q.remove();else{if(!this.#X)this.#Q.textContent=J?Q??"":"Label";if(this.#Q.parentElement!==this.#Z)this.#Z.prepend(this.#Q)}this.#Z.setAttribute("direction",this.getAttribute("direction")||"horizontal")}#Y(){let J=new Set(["label","direction","size","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.#Y(),Q=new Set(J);for(let Z of this.#$)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#$=Q}#U(){if(!this.#J)return;this.#O??=this.#P.bind(this,"input"),this.#B??=this.#P.bind(this,"change"),this.#J.addEventListener("input",this.#O),this.#J.addEventListener("change",this.#B)}#N(){if(!this.#J)return;if(this.#O)this.#J.removeEventListener("input",this.#O);if(this.#B)this.#J.removeEventListener("change",this.#B)}#P(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:this.#J?.value;if(this.#J?.value!==void 0)this.setAttribute("value",String(this.#J.value));this.dispatchEvent(new CustomEvent(J,{detail:Z,bubbles:!0,cancelable:!0,composed:!0}))}#L(J){if(Y(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number, fig-menu"))return;this.focus()}get value(){return 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.#_??"0"}get isDefault(){return c(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.value=J,g(this,this.#J?.value??J)}focus(J){this.#J?.focus(J)}}U("propskit-number",LJ);class UJ extends HTMLElement{static observedAttributes=["x","y","default","label","units","disabled","size"];#Z=null;#Q=null;#J=null;#X=null;#j=!1;#$=!1;#O=this.#z.bind(this,"input");#B=this.#z.bind(this,"change");#G=this.#W.bind(this);connectedCallback(){if(!this.#j)this.#X=this.#q(),this.#Y(this.#X),this.#j=!0;if(!this.#Z)this.#U();this.#N(),this.#P(),this.#S(),this.removeEventListener("click",this.#G),this.addEventListener("click",this.#G),f(this)}disconnectedCallback(){this.#T(),this.removeEventListener("click",this.#G),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#j)return;if((J==="x"||J==="y")&&!this.#$)this.#P();else if(J==="label")this.#N();else if(J==="units")this.#L();else if(J==="disabled")this.#K()}#_(J,Q=50){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#q(){let J=this.getAttribute("x"),Q=this.getAttribute("y");return{x:J===null||!J.trim()?50:this.#_(J,50),y:Q===null||!Q.trim()?50:this.#_(Q,50)}}#M(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.#_(Q.x,this.#X?.x??50),y:this.#_(Q.y,this.#X?.y??50)}}catch{return null}}#Y(J){let Q=this.#q(),Z={x:this.#_(J?.x,Q.x),y:this.#_(J?.y,Q.y)};return this.#$=!0,this.setAttribute("x",String(Z.x)),this.setAttribute("y",String(Z.y)),this.#$=!1,Z}#k(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($),Y(this,"disabled"))Z.setAttribute("disabled","");return Z}#U(){let J=this.#q(),Q=document.createElement("fig-field");Q.className="propskit-position-row",Q.setAttribute("direction","horizontal");let Z=document.createElement("label"),$=this.#k("x",J.x),j=this.#k("y",J.y);Q.append(Z,$,j),this.#Z=Q,this.#Q=$,this.#J=j,this.replaceChildren(Q),f(this)}#N(){let J=this.#Z?.querySelector(":scope > label");if(!J)return;let Q=this.getAttribute("label");J.textContent=Q?.trim()||"Position"}#P(){let J=this.#q();this.#Q?.setAttribute("value",String(J.x)),this.#J?.setAttribute("value",String(J.y)),this.#L(),this.#K()}#L(){let J=this.units==="percent"?"%":null;for(let Q of[this.#Q,this.#J]){if(!Q)continue;if(J)Q.setAttribute("units",J);else Q.removeAttribute("units")}}#K(){let J=Y(this,"disabled");this.#Q?.toggleAttribute("disabled",J),this.#J?.toggleAttribute("disabled",J)}#S(){this.#T(),this.#Q?.addEventListener("input",this.#O),this.#Q?.addEventListener("change",this.#B),this.#J?.addEventListener("input",this.#O),this.#J?.addEventListener("change",this.#B)}#T(){this.#Q?.removeEventListener("input",this.#O),this.#Q?.removeEventListener("change",this.#B),this.#J?.removeEventListener("input",this.#O),this.#J?.removeEventListener("change",this.#B)}#z(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=Q.currentTarget?.getAttribute("data-propskit-position-axis");if(Z!=="x"&&Z!=="y")return;let $=this.value;$[Z]=this.#_(Q.currentTarget.value,$[Z]);let j=this.#Y($);this.dispatchEvent(new CustomEvent(J,{detail:{...j,units:this.units},bubbles:!0,cancelable:!0,composed:!0}))}#W(J){if(Y(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number, fig-menu"))return;this.focus()}get x(){return this.#q().x}set x(J){this.setAttribute("x",String(this.#_(J,50)))}get y(){return this.#q().y}set y(J){this.setAttribute("y",String(this.#_(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.#q()}}set value(J){let Q=this.#Y(J);this.#P(Q)}get defaultValue(){return this.#M(this.getAttribute("default"))||{...this.#X||{x:50,y:50}}}get isDefault(){return e(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.value=J,g(this,{...J,units:this.units})}focus(J){this.#Q?.focus(J)}}U("propskit-position",UJ);class KJ extends HTMLElement{static observedAttributes=["label","collapsible","open","size","disabled","value"];#Z=null;#Q=null;#J=null;#X=!1;#j=!1;#$=!1;#O=this.#K.bind(this,"input");#B=this.#K.bind(this,"change");#G=this.#S.bind(this);connectedCallback(){if(!this.#X)this.#Y(this.#M()),this.#X=!0;if(!this.#Z)this.#k();this.#U(),this.#N(),this.#P(),this.#L(this.#M()),this.removeEventListener("input",this.#O),this.addEventListener("input",this.#O),this.removeEventListener("change",this.#B),this.addEventListener("change",this.#B),this.removeEventListener("openchange",this.#G),this.addEventListener("openchange",this.#G)}disconnectedCallback(){this.removeEventListener("input",this.#O),this.removeEventListener("change",this.#B),this.removeEventListener("openchange",this.#G)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#X)return;if(J==="value"){if(!this.#j){let $=this.#Y(this.#M());this.#L($)}return}if(J==="size"){this.#N();return}if(J==="disabled"){this.#P();return}this.#U()}#_(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.#_(Q.x,50),y:this.#_(Q.y,50),color:typeof Q.color==="string"&&Q.color.trim()?Q.color.trim():"#D9D9D9"}}#M(){return this.#q(this.getAttribute("value"))}#Y(J){let Q=this.#q(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#j=!0,this.setAttribute("value",Z),this.#j=!1,Q}#k(){let J=this.#M(),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.#Q=Z,this.#J=$,this.#U(),this.#N(),this.#P(),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(){let J=this.getAttribute("size");for(let Q of[this.#Q,this.#J]){if(!Q)continue;if(J===null)Q.removeAttribute("size");else Q.setAttribute("size",J)}}#P(){l(this,[this.#Q,this.#J])}#L(J){let Q=this.#q(J);if(this.#Q)this.#Q.value=Q.color;if(this.#J)this.#J.value={x:Q.x,y:Q.y}}#K(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(),Y(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.#_(Z.value?.x,$.x),$.y=this.#_(Z.value?.y,$.y);else return;let _=this.#Y($);this.dispatchEvent(new CustomEvent(J,{detail:{..._,units:"percent"},bubbles:!0,cancelable:!0,composed:!0}))}#S(J){if(J.target!==this.#Z||this.#$)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#$=!0,this.setAttribute("open",String(Q)),this.#$=!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.#M()}}set value(J){let Q=this.#Y(J);this.#L(Q)}focus(J){this.#Q?.focus(J)}}U("propskit-color-point",KJ);class SJ extends HTMLElement{static observedAttributes=["label","collapsible","open","size","units","disabled","value"];#Z=null;#Q=null;#J=null;#X=!1;#j=!1;#$=!1;#O=this.#W.bind(this,"input");#B=this.#W.bind(this,"change");#G=this.#F.bind(this);connectedCallback(){if(!this.#X)this.#k(this.#Y()),this.#X=!0;if(!this.#Z)this.#N();this.#P(),this.#L(),this.#K(),this.#S(),this.#T(this.#Y()),this.removeEventListener("input",this.#O),this.addEventListener("input",this.#O),this.removeEventListener("change",this.#B),this.addEventListener("change",this.#B),this.removeEventListener("openchange",this.#G),this.addEventListener("openchange",this.#G)}disconnectedCallback(){this.removeEventListener("input",this.#O),this.removeEventListener("change",this.#B),this.removeEventListener("openchange",this.#G)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#X)return;if(J==="value"){if(!this.#j){let $=this.#k(this.#Y());this.#T($)}return}if(J==="size"){this.#L();return}if(J==="units"){this.#K();return}if(J==="disabled"){this.#S();return}this.#P()}#_(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.#_(J,0)}#M(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.x,50),y:this.#_(Q.y,50),radius:this.#q(Q.radius)}}#Y(){return this.#M(this.getAttribute("value"))}#k(J){let Q=this.#M(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#j=!0,this.setAttribute("value",Z),this.#j=!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.#Y(),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.#Q=$,this.#J=j,this.#P(),this.#L(),this.#S(),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(){let J=this.getAttribute("size");for(let Q of[this.#Q,this.#J]){if(!Q)continue;if(J===null)Q.removeAttribute("size");else Q.setAttribute("size",J)}}#K(){if(this.hasAttribute("units"))this.#Q?.setAttribute("units",this.units);else this.#Q?.removeAttribute("units");if(this.units==="percent")this.#J?.setAttribute("units","%");else this.#J?.removeAttribute("units")}#S(){l(this,[this.#Q,this.#J])}#T(J){let Q=this.#M(J);if(this.#Q)this.#Q.value={x:Q.x,y:Q.y};if(this.#J){let Z=this.#U(Q.radius);this.#J.value=Z.value}}#z(J,Q){let Z=this.#U(Q).value,$=this.#_(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(),Y(this,"disabled"))return;let $=this.value,j=Z.getAttribute("data-propskit-point-radius-control");if(j==="position")$.x=this.#_(Z.value?.x,$.x),$.y=this.#_(Z.value?.y,$.y);else if(j==="radius")$.radius=this.#z(Z,$.radius);else return;let _=this.#k($);this.dispatchEvent(new CustomEvent(J,{detail:{..._,radius:this.#U(_.radius).value,units:this.units},bubbles:!0,cancelable:!0,composed:!0}))}#F(J){if(J.target!==this.#Z||this.#$)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#$=!0,this.setAttribute("open",String(Q)),this.#$=!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.#Q?.focus(J)}}U("propskit-point-radius",SJ);class TJ extends HTMLElement{static observedAttributes=["label","collapsible","open","size","units","disabled","value"];#Z=null;#Q=null;#J=null;#X=null;#j=!1;#$=!1;#O=!1;#B=this.#F.bind(this,"input");#G=this.#F.bind(this,"change");#_=this.#R.bind(this);connectedCallback(){if(!this.#j)this.#U(this.#k()),this.#j=!0;if(!this.#Z)this.#P();this.#L(),this.#K(),this.#S(),this.#T(),this.#z(this.#k()),this.removeEventListener("input",this.#B),this.addEventListener("input",this.#B),this.removeEventListener("change",this.#G),this.addEventListener("change",this.#G),this.removeEventListener("openchange",this.#_),this.addEventListener("openchange",this.#_)}disconnectedCallback(){this.removeEventListener("input",this.#B),this.removeEventListener("change",this.#G),this.removeEventListener("openchange",this.#_)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#j)return;if(J==="value"){if(!this.#$){let $=this.#U(this.#k());this.#z($)}return}if(J==="size"){this.#K();return}if(J==="units"){this.#S();return}if(J==="disabled"){this.#T();return}this.#L()}#q(J,Q){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#M(J){if(typeof J==="string"&&J.trim().endsWith("%")){let Q=Number.parseFloat(J);if(Number.isFinite(Q))return`${Q}%`}return this.#q(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.#q(Q.x,50),y:this.#q(Q.y,50),radius:this.#M(Q.radius),angle:this.#q(Q.angle,0)}}#k(){return this.#Y(this.getAttribute("value"))}#U(J){let Q=this.#Y(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#$=!0,this.setAttribute("value",Z),this.#$=!1,Q}#N(J){let Q=typeof J==="string"&&J.trim().endsWith("%");return{value:Q?Number.parseFloat(J):J,units:Q?"%":"px"}}#P(){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.#Q=$,this.#J=j,this.#X=_,this.#L(),this.#K(),this.#T(),Z.append($,j,_),this.replaceChildren(Z)}#L(){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(){let J=this.getAttribute("size");for(let Q of[this.#Q,this.#J,this.#X]){if(!Q)continue;if(J===null)Q.removeAttribute("size");else Q.setAttribute("size",J)}}#S(){if(this.hasAttribute("units"))this.#Q?.setAttribute("units",this.units);else this.#Q?.removeAttribute("units");if(this.units==="percent")this.#J?.setAttribute("units","%");else this.#J?.removeAttribute("units")}#T(){l(this,[this.#Q,this.#J,this.#X])}#z(J){let Q=this.#Y(J);if(this.#Q)this.#Q.value={x:Q.x,y:Q.y};if(this.#J){let Z=this.#N(Q.radius);this.#J.value=Z.value}if(this.#X)this.#X.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"))==="%"?`${$}%`:$}#F(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(),Y(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;let _=this.#U($);this.dispatchEvent(new CustomEvent(J,{detail:{..._,radius:this.#N(_.radius).value,units:this.units},bubbles:!0,cancelable:!0,composed:!0}))}#R(J){if(J.target!==this.#Z||this.#O)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#O=!0,this.setAttribute("open",String(Q)),this.#O=!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.#z(Q)}focus(J){this.#Q?.focus(J)}}U("propskit-point-radius-angle",TJ);class FJ extends HTMLElement{static observedAttributes=["label","collapsible","open","size","units","disabled","value"];#Z=null;#Q=null;#J=null;#X=!1;#j=!1;#$=!1;#O=this.#T.bind(this,"input");#B=this.#T.bind(this,"change");#G=this.#z.bind(this);connectedCallback(){if(!this.#X)this.#Y(this.#M()),this.#X=!0;if(!this.#Z)this.#U();this.#N(),this.#P(),this.#L(),this.#K(),this.#S(this.#M()),this.removeEventListener("input",this.#O),this.addEventListener("input",this.#O),this.removeEventListener("change",this.#B),this.addEventListener("change",this.#B),this.removeEventListener("openchange",this.#G),this.addEventListener("openchange",this.#G)}disconnectedCallback(){this.removeEventListener("input",this.#O),this.removeEventListener("change",this.#B),this.removeEventListener("openchange",this.#G)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#X)return;if(J==="value"){if(!this.#j){let $=this.#Y(this.#M());this.#S($)}return}if(J==="size"){this.#P();return}if(J==="units"){this.#L();return}if(J==="disabled"){this.#K();return}this.#N()}#_(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.#_(Q.x,50),y:this.#_(Q.y,50),x2:this.#_(Q.x2,75),y2:this.#_(Q.y2,75)}}#M(){return this.#q(this.getAttribute("value"))}#Y(J){let Q=this.#q(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#j=!0,this.setAttribute("value",Z),this.#j=!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.#M(),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.#Q=Z,this.#J=$,this.#N(),this.#P(),this.#K(),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")}#P(){let J=this.getAttribute("size");for(let Q of[this.#Q,this.#J]){if(!Q)continue;if(J===null)Q.removeAttribute("size");else Q.setAttribute("size",J)}}#L(){for(let J of[this.#Q,this.#J]){if(!J)continue;if(this.hasAttribute("units"))J.setAttribute("units",this.units);else J.removeAttribute("units")}}#K(){l(this,[this.#Q,this.#J])}#S(J){let Q=this.#q(J);if(this.#Q)this.#Q.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(),Y(this,"disabled"))return;let $=this.value,j=Z.value,_=Z.getAttribute("data-propskit-point-point-control");if(_==="start")$.x=this.#_(j?.x,$.x),$.y=this.#_(j?.y,$.y);else if(_==="end")$.x2=this.#_(j?.x,$.x2),$.y2=this.#_(j?.y,$.y2);else return;let X=this.#Y($);this.dispatchEvent(new CustomEvent(J,{detail:{...X,units:this.units},bubbles:!0,cancelable:!0,composed:!0}))}#z(J){if(J.target!==this.#Z||this.#$)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#$=!0,this.setAttribute("open",String(Q)),this.#$=!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.#M()}}set value(J){let Q=this.#Y(J);this.#S(Q)}focus(J){this.#Q?.focus(J)}}U("propskit-point-point",FJ);class r extends HTMLElement{static observedAttributes=["name","open","show-reset","disabled","size"];static#Z=["propskit-color","propskit-fill","propskit-gradient","propskit-number","propskit-position","propskit-color-point","propskit-point-radius","propskit-point-radius-angle","propskit-point-point","propskit-select","propskit-slider","propskit-switch","propskit-text","propskit-wheel","propskit-oscillator"].join(",");#Q=null;#J=null;#X=null;#j=null;#$=0;#O=()=>this.#_();connectedCallback(){this.#R(),this.#N(),this.#P(),this.#B(),requestAnimationFrame(()=>{this.#S()})}disconnectedCallback(){if(this.#G(),this.#$)cancelAnimationFrame(this.#$),this.#$=0;this.#Q?.removeEventListener("click",this.#M),this.#Q?.removeEventListener("keydown",this.#Y),this.#X?.querySelector("fig-button")?.removeEventListener("click",this.#k)}attributeChangedCallback(J,Q,Z){if(Q===Z)return;if(J==="open"){this.#Q?.setAttribute("aria-expanded",String(this.open));return}if(J==="show-reset"){this.#W(),this.#S();return}if(J==="disabled"){this.#N();return}if(J==="size"){this.#P();return}this.#R()}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.#Q?.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.#z()}#B(){if(this.removeEventListener("input",this.#O,!0),this.removeEventListener("change",this.#O,!0),this.addEventListener("input",this.#O,!0),this.addEventListener("change",this.#O,!0),!this.#j)this.#j=new MutationObserver(()=>{this.#N(),this.#P(),this.#_()});this.#j.disconnect(),this.#j.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value","checked","default","x","y"]})}#G(){this.removeEventListener("input",this.#O,!0),this.removeEventListener("change",this.#O,!0),this.#j?.disconnect()}#_(){if(this.#$)return;this.#$=requestAnimationFrame(()=>{this.#$=0,this.#S()})}#q(J){return J instanceof Element&&Boolean(J.closest(".propskit-group-reset, .propskit-group-reset-tooltip"))}#M=(J)=>{if(Y(this,"disabled"))return;if(this.#q(J.target))return;J.stopPropagation(),this.open=!this.open};#Y=(J)=>{if(Y(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(),Y(this,"disabled"))return;this.#z()};#U(){return[...this.querySelectorAll(r.#Z)].filter((J)=>J.closest("propskit-group")===this&&!J.parentElement?.closest(r.#Z))}#N(){let J=Y(this,"disabled");for(let Q of this.#U())if(J){if(!Y(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.#Q?.setAttribute("aria-disabled",String(J)),this.#Q?.setAttribute("tabindex",J?"-1":"0"),this.#X?.querySelector("fig-button")?.toggleAttribute("disabled",J)}#P(){let J=this.getAttribute("size")==="small";for(let Q of this.#U()){let Z=Q.hasAttribute("data-propskit-group-size");if(J&&!Q.hasAttribute("size"))Q.setAttribute("data-propskit-group-size",""),Q.setAttribute("size","small");else if(J&&Z&&Q.getAttribute("size")!=="small")Q.setAttribute("size","small");else if(!J&&Z)Q.removeAttribute("size"),Q.removeAttribute("data-propskit-group-size")}}#L(J){return J.isDefault===!1}#K(){for(let J of this.#U())if(this.#L(J))return!0;return!1}#S(){if(this.#K())this.setAttribute("data-dirty","");else this.removeAttribute("data-dirty");this.#W()}#T(J){if(typeof J.resetToDefault==="function")J.resetToDefault()}#z(){for(let J of this.#U())this.#T(J);this.#S(),this.dispatchEvent(new CustomEvent("reset",{bubbles:!0,composed:!0}))}#W(){if(!this.showReset){this.#X?.setAttribute("hidden","");return}this.#F(),this.#X?.removeAttribute("hidden")}#F(){if(!this.#Q||!this.showReset)return;let J=this.#Q.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.#Q.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.#X=J}#R(){let Q=this.getAttribute("name")||"Group",Z=this.querySelector(":scope > fig-header");if(Z)this.#Q=Z;else if(!this.#Q||!this.#Q.dataset.generated||this.#Q.parentElement!==this)this.#Q=document.createElement("fig-header"),this.#Q.setAttribute("borderless",""),this.#Q.dataset.generated="true",this.prepend(this.#Q);let $=this.#Q.querySelector(":scope > h3"),j=this.#Q.querySelector(":scope > fig-button.propskit-group-disclosure");if(!$&&j){if($=j.querySelector(":scope > h3"),$)this.#Q.insertBefore($,j);j.remove()}if(!$)$=document.createElement("h3"),this.#Q.prepend($);let _=$.querySelector(":scope > button.propskit-group-disclosure");if(_){while(_.firstChild)$.insertBefore(_.firstChild,_);_.remove()}if(!$.id)$.id=_J("propskit-group");if(this.#Q.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.#Q.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.#Q.insertBefore(X,$),this.#J=X,this.#W(),this.#Q.setAttribute("role","button"),this.#N(),this.#Q.setAttribute("aria-expanded",String(this.open)),this.#Q.removeEventListener("click",this.#M),this.#Q.addEventListener("click",this.#M),this.#Q.removeEventListener("keydown",this.#Y),this.#Q.addEventListener("keydown",this.#Y),!this.hasAttribute("open"))this.setAttribute("open","false"),this.#Q.setAttribute("aria-expanded","false")}}U("propskit-group",r);class p extends HTMLElement{static#Z=4;static#Q="propskit-slider-dragging";static#J=null;#X=null;#j=null;#$=null;#O=!1;#B=null;#G=new Set;#_=0;#q=0;#M=0;#Y=null;#k=!0;#U=0;#N=1;#P=0;#L=null;#K=null;#S=0;#T=null;#z=null;#W=!1;#F=0;#R=null;#H=0;#D=null;#w=0;#I=null;#V=0;#g=0;#y=!1;#b=!1;#x=0;#E=null;#C=null;#a=this.#MJ.bind(this);#u=this.#kJ.bind(this);#A=this.#TJ.bind(this);#f=this.#HJ.bind(this);#l=this.#RJ.bind(this);#c=this.#_J.bind(this);#p=this.#zJ.bind(this);#t=this.#fJ.bind(this);#r=this.#DJ.bind(this);#XJ=this.#SJ.bind(this);#h=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","direction"]}connectedCallback(){if(!this.#X)this.#BJ();if(this.#QJ(),this.#qJ(),this.#gJ(),this.#e(),this.#PJ(),this.#ZJ(),this.removeEventListener("pointerdown",this.#a,{capture:!0}),this.addEventListener("pointerdown",this.#a,{capture:!0,passive:!0}),this.removeEventListener("pointerdown",this.#f,{capture:!0}),this.addEventListener("pointerdown",this.#f,{capture:!0}),this.removeEventListener("contextmenu",this.#t),this.addEventListener("contextmenu",this.#t),this.removeEventListener("click",this.#XJ,!0),this.addEventListener("click",this.#XJ,!0),this.#K?.removeEventListener("change",this.#r),this.#K?.addEventListener("change",this.#r),!this.#B)this.#B=new MutationObserver((J)=>{let Q=!1,Z=!1;for(let $ of J)if($.type==="attributes"){if($.attributeName==="value"){this.#LJ();continue}if($.attributeName==="color"){Z=!0;continue}if($.attributeName&&this.#h.has($.attributeName))continue;if($.attributeName==="label"||$.attributeName==="direction")Q=!0;else Z=!0}if(Q)this.#QJ();if(Z)this.#qJ(),this.#e()});this.#B.observe(this,{attributes:!0})}disconnectedCallback(){if(this.#B?.disconnect(),this.#_)cancelAnimationFrame(this.#_),this.#_=0;if(this.#q)cancelAnimationFrame(this.#q),this.#q=0;if(this.#M)cancelAnimationFrame(this.#M),this.#M=0;this.#Y?.disconnect(),this.#VJ(),this.#v(),clearTimeout(this.#x),this.#x=0,this.#NJ(),this.#AJ(),this.#o(),this.#cJ(),this.removeEventListener("pointerdown",this.#a,{capture:!0}),this.removeEventListener("pointerdown",this.#f,{capture:!0}),this.removeEventListener("contextmenu",this.#t),this.removeEventListener("click",this.#XJ,!0),this.#K?.removeEventListener("change",this.#r)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#X)return;if(J==="label"||J==="direction")this.#QJ()}#BJ(){let J=(this.getAttribute("type")||"range").toLowerCase();this.#z=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")),$=document.createElement("fig-field"),j=Z||document.createElement("label"),_=document.createElement("fig-slider");_.setAttribute("text","true");for(let X of this.#KJ()){let q=this.getAttribute(X);_.setAttribute(X,q??"")}$.append(j,_),this.#X=$,this.#j=j,this.#$=_,this.#O=Boolean(Z),this.replaceChildren($),this.#d();for(let X of Q){if(X===Z)continue;this.#$.appendChild(X)}}#d(){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.#r),this.#K=J,this.appendChild(J)}#QJ(){if(!this.#X||!this.#j)return;let J=this.hasAttribute("label"),Q=this.getAttribute("label");if(J&&(Q??"").trim()===""){if(this.#j.parentElement===this.#X)this.#j.remove()}else{if(!this.#O)this.#j.textContent=J?Q??"":"Label";if(this.#j.parentElement!==this.#X)this.#X.prepend(this.#j)}this.#X.setAttribute("direction",this.getAttribute("direction")||"horizontal"),this.#ZJ()}#qJ(){if(!this.#$)return;let J=this.#KJ(),Q=new Set(J.filter(($)=>$!=="text"&&$!=="value"));for(let $ of this.#G)if(!Q.has($))this.#$.removeAttribute($);for(let $ of J){if($==="text"||$==="value")continue;let j=this.getAttribute($)??"";if(this.#$.getAttribute($)!==j)this.#$.setAttribute($,j)}this.#$.removeAttribute("variant"),this.#$.removeAttribute("color"),this.#$.removeAttribute("transform"),this.#$.removeAttribute("full"),this.#$.setAttribute("text","true");let Z=(this.getAttribute("type")||"range").toLowerCase();if(Z==="delta"){let $=Number(this.#$.min),j=Number(this.#$.max),_=Number.isFinite($)&&Number.isFinite(j)?$+(j-$)/2:0;this.#$.setAttribute("default",String(_))}else this.#$.removeAttribute("default");if(Z==="stepper")this.#$.setAttribute("step",this.getAttribute("step")??"10");else if(!this.hasAttribute("step"))this.#$.removeAttribute("step");if(Z==="opacity")this.#$.style.setProperty("--color",this.getAttribute("color")||"var(--figma-color-bg-secondary)");else this.#$.style.removeProperty("--color");this.#s(Z),this.#G=Q,this.#LJ(),this.#FJ(),this.#k=!0,this.#PJ(),this.#ZJ()}#s(J){let Q=this.#$?.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.#$?.min),j=Number(this.#$?.max),_=Number(this.#$?.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))`,O=getComputedStyle(this).colorScheme.trim().toLowerCase()==="dark",G=RJ(this.#$,B,J==="hue"?0.35:O?0.2:0.35);if(G){Q?.setAttribute("theme",G);let M=G==="light"&&O||G==="dark"&&!O;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")}#OJ(){if(!this.#$)return;let J=Number(this.#$.min),Q=Number(this.#$.max),Z=Number(this.#$.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.#ZJ()}#PJ(){if(!globalThis.ResizeObserver)return;if(!this.#Y)this.#Y=new ResizeObserver(()=>{this.#k=!0,this.#ZJ()});this.#Y.disconnect();for(let J of[this,this.#j,this.#$?.querySelector("fig-input-number"),this.#$?.querySelector("fig-input-number input"),this.#$?.querySelector('input[type="range"]')])if(J)this.#Y.observe(J)}#ZJ(){if(this.#M)cancelAnimationFrame(this.#M);this.#M=requestAnimationFrame(()=>{this.#M=0,this.#$J()})}#$J(){let J=this.#$?.querySelector('input[type="range"]');if(!J||!this.#$)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.#GJ("--slider-thumb-width",this.#$)/2,this.#N=Math.max(1,this.#GJ("--propskit-slider-handle-fade-start-threshold")),this.#P=Math.min(this.#N,this.#GJ("--propskit-slider-handle-fade-end-threshold")),this.#k=!1;let q=this.#U,B=[],O=this.#j?.parentElement===this.#X?this.#YJ(this.#j):null,G=this.#$.querySelector("fig-input-number input"),M=G?this.#jJ(G):null;if(O?.width&&O.bottom>Q.top&&O.top<Q.bottom)B.push(X-q-O.right);if(M?.width&&M.bottom>Q.top&&M.top<Q.bottom)B.push(M.left-X-q);let k=this.#N,P=this.#P,N=B.length?Math.min(...B):k,S=Math.max(0.001,k-P),F=Math.max(0,Math.min(1,(N-P)/S));this.style.setProperty("--propskit-slider-handle-proximity",String(F))}#YJ(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.#n(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),O=$.textAlign,G=_;if(O==="right"||O==="end")G=X-B;else if(O==="center")G=_+(q-B)/2;return{left:G,right:G+B,top:Z.top,bottom:Z.bottom,width:B,height:Z.height}}#n(J,Q){if(!p.#J)p.#J=document.createElement("canvas");let Z=p.#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}#GJ(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}#LJ(){if(!this.#$)return;let J=this.hasAttribute("value")?this.getAttribute("value")??"":this.#z??"";if(String(this.#$.value)!==J)this.#$.value=J;this.#OJ()}#KJ(){let J=new Set(["label","direction","oninput","onchange","steppers"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!this.#h.has(Q))}#FJ(){if(this.#_)cancelAnimationFrame(this.#_);this.#_=requestAnimationFrame(()=>{this.#_=0,this.#pJ(),this.#JJ()})}#e(){if(this.#q)cancelAnimationFrame(this.#q);this.#q=requestAnimationFrame(()=>{this.#q=0,this.#JJ()})}#JJ(){let J=this.#$?.querySelector('input[type="range"]'),Q=this.#$?.querySelector("fig-input-number input");if(J!==this.#L)this.#UJ(J);if(J){J.removeAttribute("tabindex"),J.removeAttribute("aria-hidden");let Z=this.getAttribute("aria-label")||this.#j?.textContent?.trim()||"Slider";if(!J.hasAttribute("aria-label")&&!J.hasAttribute("aria-labelledby"))J.setAttribute("aria-label",Z)}if(Q)Q.removeAttribute("tabindex"),Q.removeAttribute("aria-hidden")}#SJ(J){if(Y(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.#m()}#m(){requestAnimationFrame(()=>{requestAnimationFrame(()=>{if(this.isConnected&&!Y(this,"disabled"))this.focus()})})}#UJ(J){if(this.#o(),this.#L=J,!this.#L)return;this.#L.addEventListener("dblclick",this.#p,{capture:!0})}#o(){if(!this.#L)return;this.#L.removeEventListener("dblclick",this.#p,{capture:!0}),this.#L=null}#zJ(J){J.preventDefault(),J.stopImmediatePropagation(),this.#bJ()}#HJ(J){if(J.button!==0||J.altKey||Y(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.#v(),this.#I=J.pointerId,this.#V=J.clientX,this.#g=J.clientY,this.#y=!1,window.addEventListener("pointermove",this.#l),window.addEventListener("pointerup",this.#c,{once:!0}),window.addEventListener("pointercancel",this.#c,{once:!0}),window.addEventListener("blur",this.#c,{once:!0})}#RJ(J){if(J.pointerId!==this.#I)return;if(J.buttons===0){this.#_J(J);return}if(!this.#y){if(Math.hypot(J.clientX-this.#V,J.clientY-this.#g)<4)return;this.#y=!0,this.setAttribute("data-number-scrubbing",""),this.#WJ(!0)}this.#EJ(this.#wJ(J),"input")}#_J(J){if(J?.pointerId!==void 0&&this.#I!==null&&J.pointerId!==this.#I)return;let Q=this.#y;if(this.#v(),Q){this.#EJ(this.#$?.value,"change"),this.#b=!0,clearTimeout(this.#x),this.#x=window.setTimeout(()=>{this.#b=!1,this.#x=0},0),this.#m();return}this.#$?.querySelector("fig-input-number input")?.focus()}#v(){window.removeEventListener("pointermove",this.#l),window.removeEventListener("pointerup",this.#c),window.removeEventListener("pointercancel",this.#c),window.removeEventListener("blur",this.#c),this.#I=null,this.#y=!1,this.removeAttribute("data-number-scrubbing"),this.#WJ(!1)}#MJ(J){if(J.button!==0||Y(this,"disabled"))return;if(J.target?.closest?.("fig-input-number"))return;let Q=this.#$?.querySelector('input[type="range"]')??this.#L;if(!Q)return;this.#NJ(),this.#AJ(),this.#L=Q,this.#W=!0,this.#D=J.pointerId,this.#w=J.clientX,this.#F=this.getAttribute("elastic")==="false"?0:this.#CJ();let Z=Q.getBoundingClientRect(),$=this.getBoundingClientRect();this.#R={left:Z.left,right:Z.right,width:Z.width},this.#H=$.width,window.addEventListener("pointermove",this.#u,{passive:!0}),window.addEventListener("pointerup",this.#A,{once:!0}),window.addEventListener("pointercancel",this.#A,{once:!0}),window.addEventListener("blur",this.#A,{once:!0})}#kJ(J){if(!this.#W)return;if(J.pointerId!==this.#D)return;if(J.buttons===0){this.#TJ(J);return}if(Math.abs(J.clientX-this.#w)>=p.#Z)this.#WJ(!0);if(this.#F)this.#hJ(J.clientX)}#TJ(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.#NJ(),this.#AJ(),Q)this.#m()}#NJ(){window.removeEventListener("pointermove",this.#u),window.removeEventListener("pointerup",this.#A),window.removeEventListener("pointercancel",this.#A),window.removeEventListener("blur",this.#A),this.#W=!1,this.#D=null,this.#w=0,this.#WJ(!1)}#WJ(J){this.toggleAttribute("data-propskit-slider-dragging",J),document.body.classList.toggle(p.#Q,J)}#fJ(J){if(Y(this,"disabled"))return;J.preventDefault(),J.stopPropagation(),J.stopImmediatePropagation(),this.#VJ(),this.#i(J.clientX,J.clientY)}#i(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.#K?.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.#bJ()}#VJ(){if(this.#S)clearTimeout(this.#S),this.#S=0;this.#T=null}#CJ(){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}#hJ(J){let Q=this.#R;if(!Q||!this.#F){this.#AJ();return}let Z=J<Q.left?J-Q.left:J>Q.right?J-Q.right:0;if(!Z){this.#yJ();return}let $=Math.max(-this.#F,Math.min(this.#F,Z*0.5)),j=Math.abs($),_=this.#H?(this.#H+j)/this.#H: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")}#AJ(){this.#yJ(),this.#F=0,this.#R=null,this.#H=0,this.#D=null}#yJ(){this.removeAttribute("data-elastic-dragging"),this.style.removeProperty("--propskit-slider-elastic-size"),this.style.removeProperty("--propskit-slider-elastic-scale")}#wJ(J){let Q=this.#L;if(!Q)return this.#$?.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,O=Math.max(0,`${X}`.split(".")[1]?.length||0);return String(Number(B.toFixed(O)))}#IJ(){return this.getAttribute("default")??this.#z??this.#L?.min??"0"}#bJ(){this.#VJ(),this.#EJ(this.#IJ(),"input"),this.#EJ(this.#IJ(),"change")}#EJ(J,Q){if(!this.#$||J===null||J===void 0)return;this.#$.value=J,this.setAttribute("value",String(this.#$.value)),this.dispatchEvent(new CustomEvent(Q,{detail:this.#$.value,bubbles:!0,cancelable:!0,composed:!0}))}#pJ(){if(!this.#$)return;let J=this.#$.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.#$)return;if(!this.#E)this.#E=this.#xJ.bind(this,"input");if(!this.#C)this.#C=this.#xJ.bind(this,"change");this.#$.addEventListener("input",this.#E),this.#$.addEventListener("change",this.#C)}#cJ(){if(!this.#$)return;if(this.#E)this.#$.removeEventListener("input",this.#E);if(this.#C)this.#$.removeEventListener("change",this.#C)}#xJ(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;if(J==="change")this.#AJ();let Z=Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:this.#$?.value;if(this.#$?.value!==void 0){let $=String(this.#$.value);if(this.getAttribute("value")!==$)this.setAttribute("value",$)}this.#OJ(),this.dispatchEvent(new CustomEvent(J,{detail:Z,bubbles:!0,cancelable:!0,composed:!0}))}focus(J){this.#JJ();let Q=this.#$?.querySelector('input[type="range"]');Q?.setAttribute("data-propskit-focus-called",""),Q?.focus(J)}get value(){return this.getAttribute("value")??this.#$?.value??""}set value(J){if(J===null||J===void 0||J===""){if(this.removeAttribute("value"),this.#$)this.#$.value="";return}let Q=String(J);if(this.setAttribute("value",Q),this.#$)this.#$.value=Q}get defaultValue(){return this.#IJ()}get isDefault(){return c(this.value,this.defaultValue)}resetToDefault(){this.#bJ()}}U("propskit-slider",p);class z extends HTMLElement{static#Z=33;static#Q=60;static#J=0.55;static#X=1.5;static#j=80;static#$=4;static#O="fig-input-wheel-dragging";#B=null;#G=null;#_=null;#q=null;#M=null;#Y=null;#k=null;#U=0;#N=0;#P=0;#L=0;#K=0;#S=null;#T=!1;#z=null;#W=0;#F=0;#R=!1;#H=null;#D=0;#w=null;#I=0;#V=0;#g=this.#$J.bind(this);#y=this.#YJ.bind(this);#b=this.#n.bind(this);#x=this.#zJ.bind(this);#E=this.#HJ.bind(this);static get observedAttributes(){return["value","disabled","step","min","max","spin"]}connectedCallback(){if(!this.#B)this.#C();if(this.#QJ(),this.#BJ(),this.#PJ(),this.#S?.disconnect(),globalThis.ResizeObserver)this.#S=new ResizeObserver((J)=>{let Q=J.at(-1)?.contentRect;if(Q)this.#qJ(Q.width,Q.height)}),this.#S.observe(this);this.#s()}disconnectedCallback(){if(this.#S?.disconnect(),this.#P)cancelAnimationFrame(this.#P);this.#P=0,this.#_J(),this.#ZJ(),this.#GJ()}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#B)return;if(J==="disabled")this.#QJ();if(J==="value"&&!this.#T)this.#BJ();if(J==="step")this.#d(),this.#s();if(J==="spin")this.#s();if(J==="min"||J==="max")this.#h(this.#f())}#C(){if(this.#B=this,this.#G=this,this.#_=this,this.setAttribute("role","spinbutton"),!this.hasAttribute("aria-label")&&!this.hasAttribute("aria-labelledby"))this.setAttribute("aria-label","Value");this.setAttribute("tabindex","0");let J=E("svg",{className:"fig-input-wheel-svg","aria-hidden":"true"}),Q=L("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.#a()}#a(){if(!this.#q||this.#M)return;this.#M=E("path",{className:"fig-input-wheel-tick"}),this.#q.append(this.#M)}#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}#A(){if(this.hasAttribute("step")){let J=Number(this.getAttribute("step"));if(J>0)return J}return 1}#f(){let J=Number(this.getAttribute("value")??0);return Number.isFinite(J)?J:0}#l(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}#c(){return this.#l("min")}#p(){return this.#l("max")}#t(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))}#r(J){let Q=J,Z=this.#c(),$=this.#p();if(Z!==null)Q=Math.max(Z,Q);if($!==null)Q=Math.min($,Q);return Q}#XJ(J){let Q=this.#A();if(Q<=0)return J;let Z=this.#c()??0,$=Math.round((J-Z)/Q)*Q+Z;return Number($.toPrecision(15))}#h(J,{snap:Q=!1,emit:Z=null}={}){let $=Q?this.#XJ(J):J;$=this.#r($);let j=String($);if(this.getAttribute("value")!==j)this.setAttribute("value",j);if(this.#d($),this.#s(),Z)this.dispatchEvent(new CustomEvent(Z,{detail:$,bubbles:!0,cancelable:!0,composed:!0}))}#BJ(){let J=this.#f(),Q=this.#r(J);if(Q!==J||this.getAttribute("value")!==String(Q)){this.#h(Q);return}this.#d(J),this.#s()}#d(J=this.#f()){if(!this.#_)return;let Q=this.#c(),Z=this.#p();if(this.#_.setAttribute("aria-valuenow",String(J)),this.#_.setAttribute("aria-valuetext",String(J)),Q===null)this.#_.removeAttribute("aria-valuemin");else this.#_.setAttribute("aria-valuemin",String(Q));if(Z===null)this.#_.removeAttribute("aria-valuemax");else this.#_.setAttribute("aria-valuemax",String(Z))}#QJ(){let J=Y(this,"disabled");if(!this.#_)return;if(J){if(this.#T)this.#GJ();this.#_J(),this.setAttribute("aria-disabled","true"),this.#_.setAttribute("tabindex","-1"),this.#_.setAttribute("aria-disabled","true")}else this.removeAttribute("aria-disabled"),this.#_.setAttribute("tabindex","0"),this.#_.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.#Y=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.#P)return;this.#P=requestAnimationFrame(()=>{if(!this.isConnected){this.#P=0;return}if(this.#U<1||this.#N<1){let J=this.#_?.getBoundingClientRect();if(J)this.#qJ(J.width,J.height)}this.#OJ(),this.#P=0})}#OJ(){if(!this.#M)return;let J=this.#U,Q=this.#N;if(J<1||Q<1)return;let Z=this.getAttribute("spin")==="false"?this.#c()??0:this.#H??this.#f(),$=360/z.#Z,j=this.#A(),_=this.#c()??0,X=(Z-_)/j*$,q=z.#J,B=J/2,O=Q/2,{maxH:G,minH:M,maxW:k,minW:P}=this.#u(),N=z.#Q,S=Math.max(J/2,1),F=S*0.84,R=[];for(let W=0;W<z.#Z;W+=1){let T=X+W*$;if(T=((T+180)%360+360)%360-180,T<-N||T>=N)continue;let V=T*Math.PI/180,H=B+F*Math.sin(V)/(1-q*Math.cos(V)),C=Math.min(1,Math.abs(H-B)/Math.max(S,1)),I=Math.cos(C*Math.PI*0.5),A=M+(G-M)*I,d=P+(k-P)*I,o=A/2,b=d/2,y=O-o,m=O+o,i=H-b,a=H+b;R.push(`M ${H} ${y} Q ${a} ${y} ${a} ${y+b} V ${m-b} Q ${a} ${m} ${H} ${m} Q ${i} ${m} ${i} ${m-b} V ${y+b} Q ${i} ${y} ${H} ${y} Z`)}this.#M.setAttribute("d",R.join(" "))}#PJ(){this.#B?.addEventListener("pointerdown",this.#g),this.#_?.addEventListener("wheel",this.#x,{passive:!1}),this.#_?.addEventListener("keydown",this.#E)}#ZJ(){this.#B?.removeEventListener("pointerdown",this.#g),this.#_?.removeEventListener("wheel",this.#x),this.#_?.removeEventListener("keydown",this.#E),window.removeEventListener("pointermove",this.#y),window.removeEventListener("pointerup",this.#b),window.removeEventListener("pointercancel",this.#b)}#$J(J){if(Y(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(Y(this,"disabled"))return!1;let Q=typeof J==="number"?J:Number(J?.clientX??J?.x);if(!Number.isFinite(Q))return!1;this.#_J(),this.#T=!0,this.#z=J&&typeof J==="object"&&J.pointerId!==void 0?J.pointerId:null,this.#W=Q;let Z=J&&typeof J==="object"?Number(J.startValue):Number.NaN;return this.#F=Number.isFinite(Z)?this.#r(Z):this.#f(),this.#R=!1,this.#SJ(Q),this.#LJ(),this.setAttribute("data-fig-input-wheel-active",""),document.body.classList.remove(z.#O),this.focus(),!0}updateScrub(J,Q){if(!this.#T)return this.#f();let Z=typeof J==="number"?J:Number(J?.clientX??J?.x);if(!Number.isFinite(Z))return this.#f();let $=Q??(typeof J==="object"&&J?.shiftKey?10:1);return this.#jJ(Z,$),this.#f()}endScrub(J=!0){if(!this.#T)return this.#f();if(J&&this.#f()!==this.#F)this.#h(this.#f(),{snap:!0,emit:"change"});return this.#GJ(),this.#f()}#YJ(J){if(!this.#T)return;if(this.#z!==null&&J.pointerId!==this.#z)return;this.updateScrub(J)}#jJ(J,Q=1){if(!this.#R&&Math.abs(J-this.#W)>=z.#$)this.#R=!0,document.body.classList.add(z.#O);let Z=this.#_?.clientWidth||1,$=z.#Z*(z.#Q*2/360),j=this.#A()*$,_=(J-this.#W)*(j/Z)*Q,X=this.#H??this.#F,q=this.#r(this.#F+_);this.#m(J,Q,q!==X),this.#H=q,this.#h(q,{snap:!0,emit:"input"}),this.#FJ(J)}#n(J){if(!this.#T)return;if(this.#z!==null&&J.pointerId!==this.#z)return;this.endScrub()}#GJ(){this.#T=!1,this.#z=null,this.#R=!1,this.#H=null,this.removeAttribute("data-fig-input-wheel-active"),document.body.classList.remove(z.#O),this.#UJ(),this.#e(),window.removeEventListener("pointermove",this.#y),window.removeEventListener("pointerup",this.#b),window.removeEventListener("pointercancel",this.#b),this.#s()}#LJ(){this.#e(),this.#D=this.#KJ("--fig-input-wheel-handle-drag-max")}#KJ(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}#FJ(J){if(!this.#D){this.#JJ();return}let Q=J-this.#W;if(!Q){this.#JJ();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`)}#e(){this.#JJ(),this.#D=0}#JJ(){this.style.removeProperty("--fig-input-wheel-handle-drag-offset")}#SJ(J){this.#UJ(),this.#w=J,this.#I=performance.now()}#m(J,Q,Z){let $=performance.now(),j=$-this.#I,_=this.#w===null?0:Math.abs(J-this.#w);this.#w=J,this.#I=$;let X=j>0?_/j*Math.max(1,Math.abs(Q)):0;if(!Z||X<z.#X){this.#o();return}this.toggleAttribute("data-fig-input-wheel-fast",!0),clearTimeout(this.#V),this.#V=window.setTimeout(()=>{this.#o()},z.#j)}#UJ(){this.#w=null,this.#I=0,this.#o()}#o(){clearTimeout(this.#V),this.#V=0,this.removeAttribute("data-fig-input-wheel-fast")}#zJ(J){if(Y(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.#h(this.#f()+this.#A()*Z*Q,{snap:!0,emit:"input"}),this.#h(this.#f(),{emit:"change"})}#HJ(J){if(Y(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number"))return;if(J.key==="Home"){let _=this.#c();if(_===null)return;J.preventDefault(),this.#h(_,{snap:!0,emit:"input"}),this.#h(this.#f(),{emit:"change"});return}if(J.key==="End"){let _=this.#p();if(_===null)return;J.preventDefault(),this.#h(_,{snap:!0,emit:"input"}),this.#h(this.#f(),{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.#f();this.#h(j+this.#A()*$*Z,{snap:!0,emit:"input"}),this.#RJ(j,this.#f(),Z,$),this.#h(this.#f(),{emit:"change"})}#RJ(J,Q,Z,$,j=!0){if(J===Q||globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches){this.#_J();return}if(this.#L)cancelAnimationFrame(this.#L),this.#L=0;clearTimeout(this.#K),this.#K=0,this.removeAttribute("data-fig-input-wheel-keyboard-settling");let _=this.#H??J,X=Number.parseFloat(this.style.getPropertyValue("--fig-input-wheel-handle-drag-offset"))||0,q=$>1?120:90,B=performance.now(),O=j;this.setAttribute("data-fig-input-wheel-keyboard-moving","");let G=(M)=>{let k=Math.min(1,(M-B)/q);if(this.#H=_+(Q-_)*k,O){let P=Math.sin(k*Math.PI/2),N=X+(Z*4-X)*P;this.style.setProperty("--fig-input-wheel-handle-drag-offset",`${N}px`)}if(this.#OJ(),k<1){this.#L=requestAnimationFrame(G);return}this.#L=0,this.#H=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.#K=window.setTimeout(()=>{this.removeAttribute("data-fig-input-wheel-keyboard-settling"),this.#K=0},140),this.#s()};this.#L=requestAnimationFrame(G)}#_J(){if(this.#L)cancelAnimationFrame(this.#L),this.#L=0;if(clearTimeout(this.#K),this.#K=0,this.#H=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.#h(0);return}let Q=Number(J);this.#h(Number.isFinite(Q)?Q:0)}spinTo(J,{animateHandle:Q=!1}={}){let Z=this.#f();this.value=J;let $=this.#f();if(this.getAttribute("spin")==="false")return this.#_J(),$;let j=Math.sign($-Z);return this.#RJ(Z,$,j,Math.abs($-Z)>this.#A()?10:1,Q),$}get min(){return this.#c()}set min(J){this.#t("min",J)}get max(){return this.#p()}set max(J){this.#t("max",J)}get step(){return this.#A()}focus(J){HTMLElement.prototype.focus.call(this,J)}}U("fig-input-wheel",z);class v extends HTMLElement{static#Z=new Set(["label","size","disabled","variant","elastic","spin","text","default","class","style","id","oninput","onchange"]);static get observedAttributes(){return["label","units","value","disabled","step","precision","min","max","elastic","spin","text"]}#Q=null;#J=null;#X=null;#j=null;#$=!1;#O=null;#B=new Set;#G=null;#_=null;#q=0;#M=null;#Y=0;#k=null;#U=null;#N=0;#P=0;#L=0;#K=!1;#S=!1;#T=0;#z=!1;#W=this.#s.bind(this,"input");#F=this.#s.bind(this,"change");#R=this.#OJ.bind(this,"input");#H=this.#OJ.bind(this,"change");#D=this.#PJ.bind(this);#w=this.#SJ.bind(this);#I=this.#m.bind(this);#V=this.#UJ.bind(this);#g=this.#ZJ.bind(this);#y=this.#$J.bind(this);#b=this.#YJ.bind(this);#x=this.#GJ.bind(this);#E=this.#LJ.bind(this);#C=this.#zJ.bind(this);connectedCallback(){if(!this.#Q)this.#a();this.#u(),this.#A(),this.#l(),this.#h(),this.#BJ(),f(this),this.#O?.disconnect(),this.#O=new MutationObserver((J)=>{if(J.some(({type:Q,attributeName:Z})=>Q==="attributes"&&Z&&!v.#Z.has(Z)&&!v.observedAttributes.includes(Z)&&!Z.startsWith("data-")))this.#h()}),this.#O.observe(this,{attributes:!0})}disconnectedCallback(){this.#O?.disconnect(),this.#jJ(),this.#e(),this.#d(),this.#o(),clearTimeout(this.#T),this.#T=0,this.#J?.endScrub(!1),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Q)return;if(J==="label")this.#u();if(J==="text")this.#A();if(J==="elastic"&&Z==="false")this.#e();if(["units","value","disabled","step","min","max","elastic","spin"].includes(J))this.#l();if(["units","value","disabled","step","precision","min","max"].includes(J))this.#h()}#a(){this.#G=this.getAttribute("value")??"0";let J=Array.from(this.childNodes).filter((q)=>q.nodeType!==Node.TEXT_NODE||Boolean(q.textContent?.trim())),Q=J.find((q)=>q.nodeType===Node.ELEMENT_NODE&&q.matches("label")),Z=L("div",{className:"propskit-wheel-surface"}),$=Q||document.createElement("label"),j=document.createElement("fig-input-wheel"),_=document.createElement("fig-input-number"),X=_J("propskit-wheel-label");$.id=X,j.setAttribute("aria-labelledby",X),_.setAttribute("aria-labelledby",X),Z.append($,j,_),this.#Q=Z,this.#J=j,this.#X=$,this.#j=_,this.#$=Boolean(Q),this.replaceChildren(Z);for(let q of J)if(q!==Q)_.appendChild(q)}#u(){if(!this.#X)return;if(!this.#$)this.#X.textContent=this.hasAttribute("label")?this.getAttribute("label")??"":"Value";this.toggleAttribute("data-label-empty",!(this.#X.textContent??"").trim())}#A(){if(!this.#Q||!this.#j)return;let J=this.getAttribute("text")!=="false",Q=this.#j.parentElement===this.#Q;if(J&&!Q)this.#Q.append(this.#j);else if(!J&&Q)this.#j.remove()}#f(J){if(!this.#J)return;if(this.hasAttribute(J))this.#J.setAttribute(J,this.getAttribute(J)??"");else this.#J.removeAttribute(J)}#l(){if(!this.#J)return;this.#J.removeAttribute("units");for(let Q of["min","max","spin"])this.#f(Q);if(this.hasAttribute("step"))this.#f("step");else this.#J.setAttribute("step",String(this.#t()));this.#J.toggleAttribute("disabled",Y(this,"disabled")),this.#J.value=this.getAttribute("value")??"0";let J=this.#J.value;if(this.getAttribute("value")!==J)this.setAttribute("value",J);if(this.#j?.getAttribute("value")!==J)this.#j?.setAttribute("value",J);this.#XJ()}#c(){return this.getAttributeNames().filter((J)=>!v.#Z.has(J)&&!v.observedAttributes.includes(J)&&!J.startsWith("data-"))}#p(){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}#t(){let J=this.#p();if(J==="s")return 0.1;if(J==="ms")return 100;return 1}#r(){return this.#p()==="s"?2:0}#XJ(){if(!this.#J)return;let J=Number(this.#J.value),Q=this.#p();this.#J.setAttribute("aria-valuetext",Q?`${J} ${Q==="s"?"seconds":Q==="ms"?"milliseconds":Q}`:String(J))}#h(){if(!this.#j||!this.#J)return;let J=this.#c(),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.#p();if(Z)this.#j.setAttribute("units",Z);else this.#j.removeAttribute("units");if(this.#j.setAttribute("step",String(this.#J.step)),this.hasAttribute("precision"))this.#j.setAttribute("precision",this.getAttribute("precision")??"");else this.#j.setAttribute("precision",String(this.#r()));for(let $ of["min","max"]){let j=this.#J[$];if(j===null)this.#j.removeAttribute($);else this.#j.setAttribute($,String(j))}this.#j.toggleAttribute("disabled",Y(this,"disabled")),this.#j.setAttribute("value",this.#J.value),this.#B=Q}#BJ(){this.#d(),this.#J?.addEventListener("input",this.#W),this.#J?.addEventListener("change",this.#F),this.#j?.addEventListener("input",this.#R),this.#j?.addEventListener("change",this.#H),this.#j?.addEventListener("keydown",this.#D,{capture:!0}),this.addEventListener("pointerdown",this.#g,{capture:!0}),this.addEventListener("pointerdown",this.#w,{capture:!0}),this.addEventListener("click",this.#C,!0)}#d(){this.#J?.removeEventListener("input",this.#W),this.#J?.removeEventListener("change",this.#F),this.#j?.removeEventListener("input",this.#R),this.#j?.removeEventListener("change",this.#H),this.#j?.removeEventListener("keydown",this.#D,{capture:!0}),this.removeEventListener("pointerdown",this.#g,{capture:!0}),this.removeEventListener("pointerdown",this.#w,{capture:!0}),this.removeEventListener("click",this.#C,!0)}#QJ(J,{spin:Q=!1,animateHandle:Z=!1}={}){let $=Number(J);if(!this.#J){let X=Number.isFinite($)?$:0;return this.setAttribute("value",String(X)),X}let j=Number.isFinite($)?$:0;if(Q)this.#J.spinTo(j,{animateHandle:Z});else this.#J.value=j;let _=this.#J.value;if(this.getAttribute("value")!==_)this.setAttribute("value",_);if(this.#j?.getAttribute("value")!==_)this.#j?.setAttribute("value",_);return this.#XJ(),Number(_)}#qJ(J,Q){this.dispatchEvent(new CustomEvent(J,{detail:Q,bubbles:!0,cancelable:!0,composed:!0}))}#s(J,Q){Q.stopImmediatePropagation();let Z=this.#QJ(Q.detail);this.#qJ(J,Z)}#OJ(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:this.#j?.value,$=this.#QJ(Z,{spin:J==="input",animateHandle:J==="input"&&this.#z});if(J==="input")this.#z=!1;this.#qJ(J,$)}#PJ(J){this.#z=!Y(this,"disabled")&&(J.key==="ArrowUp"||J.key==="ArrowDown"),window.setTimeout(()=>{this.#z=!1},0)}#ZJ(J){if(J.button!==0||Y(this,"disabled")||!(J.target instanceof Element)||J.target.closest("fig-input-number")||J.target.closest(".propskit-wheel-surface")!==this.#Q)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.#n(J.pointerId),window.addEventListener("pointermove",this.#y),window.addEventListener("pointerup",this.#b),window.addEventListener("pointercancel",this.#b),window.addEventListener("blur",this.#b)}#$J(J){if(J.pointerId!==this.#k)return;if(J.buttons===0){this.#YJ(J);return}this.#J?.updateScrub(J)}#YJ(J){if(J?.pointerId!==void 0&&this.#k!==null&&J.pointerId!==this.#k)return;this.#J?.endScrub(),this.#jJ(),this.#e()}#jJ(){window.removeEventListener("pointermove",this.#y),window.removeEventListener("pointerup",this.#b),window.removeEventListener("pointercancel",this.#b),window.removeEventListener("blur",this.#b),this.#k=null}#n(J){if(this.#e(),this.getAttribute("elastic")==="false")return;this.#_=J,this.#q=this.#FJ("--propskit-wheel-elastic-distance");let Q=this.getBoundingClientRect();if(Q)this.#M={left:Q.left,right:Q.right};this.#Y=this.getBoundingClientRect().width,window.addEventListener("pointermove",this.#x,{passive:!0}),window.addEventListener("pointerup",this.#E),window.addEventListener("pointercancel",this.#E),window.addEventListener("blur",this.#E)}#GJ(J){if(J.pointerId!==this.#_)return;if(J.buttons===0){this.#LJ(J);return}this.#KJ(J.clientX)}#LJ(J){if(J?.pointerId!==void 0&&this.#_!==null&&J.pointerId!==this.#_)return;this.#e()}#KJ(J){let Q=this.#M;if(!Q||!this.#q){this.#JJ();return}let Z=J<Q.left?J-Q.left:J>Q.right?J-Q.right:0;if(!Z){this.#JJ();return}let $=Math.min(this.#q,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")}#FJ(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}#e(){window.removeEventListener("pointermove",this.#x),window.removeEventListener("pointerup",this.#E),window.removeEventListener("pointercancel",this.#E),window.removeEventListener("blur",this.#E),this.#_=null,this.#q=0,this.#M=null,this.#Y=0,this.#JJ()}#JJ(){this.removeAttribute("data-propskit-wheel-elastic-dragging"),this.style.removeProperty("--propskit-wheel-elastic-scale"),this.style.removeProperty("--propskit-wheel-elastic-origin")}#SJ(J){if(J.button!==0||J.altKey||Y(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.#o(),this.#U=J.pointerId,this.#N=J.clientX,this.#P=J.clientY,this.#L=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})}#m(J){if(J.pointerId!==this.#U)return;if(J.buttons===0){this.#UJ(J);return}if(!this.#K){if(Math.hypot(J.clientX-this.#N,J.clientY-this.#P)<4)return;this.#K=!0,this.setAttribute("data-number-scrubbing",""),this.#n(J.pointerId),this.#J?.beginScrub({clientX:this.#N,pointerId:J.pointerId,startValue:this.#L})}this.#J?.updateScrub(J),this.#KJ(J.clientX)}#UJ(J){if(J?.pointerId!==void 0&&this.#U!==null&&J.pointerId!==this.#U)return;let Q=this.#K;if(this.#e(),this.#o(),Q){this.#J?.endScrub(),this.#S=!0,clearTimeout(this.#T),this.#T=window.setTimeout(()=>{this.#S=!1,this.#T=0},0),requestAnimationFrame(()=>this.#J?.focus());return}this.#j?.querySelector("input")?.focus()}#o(){window.removeEventListener("pointermove",this.#I),window.removeEventListener("pointerup",this.#V),window.removeEventListener("pointercancel",this.#V),window.removeEventListener("blur",this.#V),this.#U=null,this.#K=!1,this.removeAttribute("data-number-scrubbing")}#zJ(J){if(Y(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number, fig-menu")){if(this.#S&&J.target.closest("fig-input-number"))J.preventDefault(),J.stopImmediatePropagation(),this.#S=!1;return}if(!(J.target instanceof Element)||!J.target.closest("fig-input-wheel"))this.#J?.focus()}get value(){return this.getAttribute("value")??this.#J?.value??"0"}set value(J){let Q=Number(J);this.#QJ(Number.isFinite(Q)?Q:0)}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.#G??"0"}get isDefault(){return c(this.value,this.defaultValue)}resetToDefault(){let J=Number(this.defaultValue),Q=this.#QJ(Number.isFinite(J)?J:0);g(this,Q)}focus(J){this.#J?.focus(J)}}U("propskit-wheel",v);class zJ extends HTMLElement{static observedAttributes=["type","value","color","name","tooltips","disabled","drag-surface","snapping"];#Z=50;#Q=50;#J=75;#X=75;#j=0;#$=!1;#O=0;#B=null;#G=null;#_=null;#q=null;#M=null;#Y=null;#k=null;#U=null;#N=null;#P=!1;#L=!1;#K=!1;#S=!1;#T=null;#z="";#W="";#F=null;#R=null;#H=null;#D="";#w="";#I=null;#V=null;#g=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#E(){return this.#y==="point-point"}get#C(){return this.#y==="point-radius-angle"||this.#y==="point-point"}get#a(){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"}#A(J){let Q=this.#u;if(Q==="true")return!0;if(Q==="modifier")return!!J;return!1}get#f(){let J=this.getAttribute("name");if(J)return J.split(",")[0].trim();return`${Math.round(this.#Z)}%, ${Math.round(this.#Q)}%`}get#l(){let J=this.getAttribute("name");if(J){let Q=J.split(",");if(Q.length>1)return Q[1].trim()}return`${Math.round(this.#J)}%, ${Math.round(this.#X)}%`}get#c(){return this.getAttribute("drag-surface")||"parent"}get#p(){let J=this.#c;if(J==="parent")return this.parentElement;return this.closest(J)}get#t(){let J=this.#c;if(J==="parent"){let Q=this.parentElement;if(Q)return Q.setAttribute("data-fig-canvas-control-surface",""),"[data-fig-canvas-control-surface]"}return J}#r(J){if(this.#$)return this.#j/100*J;return this.#j}#XJ(){if(this.#$)return`Radius ${Math.round(this.#j)}%`;return`Radius ${Math.round(this.#j)}`}connectedCallback(){this.#h(),this.#BJ()}disconnectedCallback(){this.#CJ(),this.#DJ(),this.#qJ(),this.#ZJ(),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.#P&&!this.#L&&!this.#K&&!this.#S)if(this.#h(),this.#B)this.#v();else this.#BJ();if(J==="type")this.#CJ(),this.#h(),this.#BJ();if(J==="color"&&this.#B)if(Z)this.#B.setAttribute("color",Z);else this.#B.removeAttribute("color");if(J==="disabled")this.#CJ(),this.#BJ();if(J==="tooltips")this.#BJ();if(J==="snapping"&&this.#B){if(this.#B.setAttribute("drag-snapping",Z||"false"),this.#G)this.#G.setAttribute("drag-snapping",Z||"false")}if(J==="name"){if(this.#Y)this.#Y.setAttribute("text",this.#f);if(this.#k)this.#k.setAttribute("text",this.#l)}}#h(){let J=this.getAttribute("value");if(!J)return;try{let Q=JSON.parse(J);if(typeof Q.x==="number")this.#Z=Q.x;if(typeof Q.y==="number")this.#Q=Q.y;if(Q.radius!==void 0){let Z=String(Q.radius);if(Z.endsWith("%"))this.#$=!0,this.#j=parseFloat(Z);else this.#$=!1,this.#j=parseFloat(Z);if(!Number.isFinite(this.#j))this.#j=0}if(typeof Q.angle==="number")this.#O=Q.angle;if(typeof Q.x2==="number")this.#J=Q.x2;if(typeof Q.y2==="number")this.#X=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.#Z,y:this.#Q};if(this.#y==="color"){let Q=this.getAttribute("color")||this.#B?.getAttribute("color");if(Q)J.color=Q}if(this.#b)J.radius=this.#$?`${this.#j}%`:this.#j;if(this.#x)J.angle=this.#O;if(this.#E)J.x2=this.#J,J.y2=this.#X;return J}set value(J){if(typeof J==="object")this.setAttribute("value",JSON.stringify(J));else if(typeof J==="string")this.setAttribute("value",J)}#BJ(){this.#CJ(),this.replaceChildren(),this.#B=null,this.#G=null,this.#_=null,this.#q=null,this.#M=null,this.#Y=null,this.#k=null,this.#U=null,this.#N=null;let J=Y(this,"disabled"),Q=this.#y,Z=this.#a,$=this.#t,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.#Z}% ${this.#Q}%`),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.#E)j.setAttribute("hit-area","12 circle"),j.setAttribute("hit-area-mode","delegate");if(this.#B=j,this.#b)this.#LJ();if(this.#C)this.#KJ();if(Z){let _=document.createElement("fig-tooltip");_.setAttribute("action","manual"),_.setAttribute("theme","canvas"),_.setAttribute("pointer","false"),_.setAttribute("text",this.#f),_.appendChild(j),this.appendChild(_),this.#Y=_}else this.appendChild(j);if(this.#x)this.#e(J,Z,$);if(this.#E)this.#JJ(J,Z,$);this.#d(this.#B),this.#d(this.#_),this.#d(this.#G),this.#WJ(),this.#jJ(),requestAnimationFrame(()=>this.#v())}#d(J){if(!J)return;J.addEventListener("pointerdown",(Q)=>{if(Q.target?.classList?.contains("fig-handle-hit-area")&&J.querySelector(".fig-handle-hit-area"))this.#PJ(Q,J);else this.#QJ(Q)},{capture:!0})}#QJ(J){if(Y(this,"disabled"))return;if(J?.button!==void 0&&J.button!==0)return;if(J?.isPrimary===!1)return;if(this.#T===null)this.#z=document.body.style.getPropertyValue("cursor"),this.#W=document.body.style.getPropertyPriority("cursor");if(this.#T=J?.pointerId??-1,document.body.classList.add("fig-lab-move-active"),document.body.style.setProperty("cursor","var(--fig-lab-cursor-move)","important"),!this.#F)this.#F=(Q)=>{if(Q?.pointerId!==void 0&&this.#T!==null&&Q.pointerId!==this.#T)return;if(Q?.type==="blur")this.#qJ();else requestAnimationFrame(()=>this.#qJ())};window.addEventListener("pointerup",this.#F),window.addEventListener("pointercancel",this.#F),window.addEventListener("blur",this.#F)}#qJ(){if(this.#T===null)return;if(document.body.classList.remove("fig-lab-move-active"),this.#z)document.body.style.setProperty("cursor",this.#z,this.#W);else document.body.style.removeProperty("cursor");if(this.#T=null,this.#z="",this.#W="",this.#F)window.removeEventListener("pointerup",this.#F),window.removeEventListener("pointercancel",this.#F),window.removeEventListener("blur",this.#F)}#s(J){if(!J)return 0;if(J===this.#_)return this.#O;if(!this.#E)return 0;let Q=this.#HJ();return J===this.#B?Q+180:Q}#OJ(){if(this.#R===null)return;let J=this.#m(this.#s(this.#H));document.body.style.setProperty("--fig-lab-cursor-rotate",J),document.body.style.setProperty("cursor",J,"important")}#PJ(J,Q){if(Y(this,"disabled"))return;if(J?.button!==void 0&&J.button!==0)return;if(J?.isPrimary===!1)return;if(this.#R===null)this.#D=document.body.style.getPropertyValue("cursor"),this.#w=document.body.style.getPropertyPriority("cursor");if(this.#R=J?.pointerId??-1,this.#H=Q,document.body.classList.add("fig-lab-rotate-active"),this.#OJ(),!this.#I)this.#I=(Z)=>{if(Z?.pointerId!==void 0&&this.#R!==null&&Z.pointerId!==this.#R)return;if(Z?.type==="blur")this.#ZJ();else requestAnimationFrame(()=>this.#ZJ())};window.addEventListener("pointerup",this.#I),window.addEventListener("pointercancel",this.#I),window.addEventListener("blur",this.#I)}#ZJ(){if(this.#R===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.#w);else document.body.style.removeProperty("cursor");if(this.#R=null,this.#H=null,this.#D="",this.#w="",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)}#YJ(){return this.#P||this.#L||this.#K||this.#S}#jJ(){if(this.#B)this.#$J(this.#B,()=>this.#Y,()=>this.#f,()=>this.#YJ()||!!this.#B?.querySelector("fig-color-tip"));if(this.#_)this.#$J(this.#_,()=>this.#N,()=>`Angle ${Math.round(this.#O)}°`,()=>this.#YJ());if(this.#G)this.#$J(this.#G,()=>this.#k,()=>this.#l,()=>this.#YJ());if(this.#q){let J=this.#q.querySelector(".fig-canvas-control-radius-hit");this.#GJ(J||this.#q)}if(this.#y==="color"&&this.#B&&this.#Y)new MutationObserver(()=>{if(this.#B?.querySelector("fig-color-tip"))this.#Y?.removeAttribute("show"),this.#Y?.hidePopup?.()}).observe(this.#B,{childList:!0,subtree:!0})}#n(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?.()}#GJ(J){if(!J)return;J.addEventListener("pointerenter",(Q)=>{let Z=this.#U;if(!Z)return;Z.setAttribute("text",this.#XJ()),Z.setAttribute("show","true"),Z.showPopup?.(),this.#n(Q.clientX,Q.clientY)}),J.addEventListener("pointermove",(Q)=>{if(this.#K)return;this.#n(Q.clientX,Q.clientY)}),J.addEventListener("pointerleave",()=>{if(this.#K)return;let Q=this.#U;if(!Q)return;Q.removeAttribute("show")})}#LJ(){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.#a){let _=document.createElement("fig-tooltip");_.setAttribute("action","manual"),_.setAttribute("theme","canvas"),_.setAttribute("pointer","false"),_.setAttribute("text",this.#XJ()),_.appendChild(Q),this.appendChild(_),this.#U=_}else this.appendChild(Q);this.#i(Z)}#KJ(){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.#E){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.#FJ(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.#M=Q,this.appendChild(Q)}#FJ(J){J.addEventListener("pointerdown",(Q)=>{if(Y(this,"disabled"))return;Q.preventDefault(),Q.stopPropagation();let Z=this.#p;if(!Z)return;let{clientX:$,clientY:j}=Q,_=this.#Z,X=this.#Q,q=this.#J,B=this.#X;this.#P=!0,this.#L=!0,document.body.classList.add("fig-lab-move-active"),J.style.pointerEvents="none";let O=(M)=>{let k=Z.getBoundingClientRect(),P=k.width>0?(M.clientX-$)/k.width*100:0,N=k.height>0?(M.clientY-j)/k.height*100:0,S=-Math.min(_,q),F=100-Math.max(_,q),R=-Math.min(X,B),W=100-Math.max(X,B),T=Math.max(S,Math.min(F,P)),V=Math.max(R,Math.min(W,N));this.#Z=_+T,this.#Q=X+V,this.#J=q+T,this.#X=B+V,this.#v(),this.#MJ()},G=this.#VJ((M)=>{if(document.body.classList.remove("fig-lab-move-active"),J.style.pointerEvents="stroke",this.#P=!1,this.#L=!1,M)this.#NJ(),this.#kJ()});window.addEventListener("pointermove",O,{signal:G.signal}),window.addEventListener("pointerup",()=>G.finish(!0),{signal:G.signal}),window.addEventListener("pointercancel",()=>G.finish(!1),{signal:G.signal})})}#e(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"),J)$.setAttribute("disabled","");if(this.#_=$,Q){let j=document.createElement("fig-tooltip");j.setAttribute("action","manual"),j.setAttribute("theme","canvas"),j.setAttribute("pointer","false"),j.setAttribute("text",`${Math.round(this.#O)}°`),j.appendChild($),this.appendChild(j),this.#N=j}else this.appendChild($)}#JJ(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.#X}%`),J)$.setAttribute("disabled","");if(this.#G=$,Q){let j=document.createElement("fig-tooltip");j.setAttribute("action","manual"),j.setAttribute("theme","canvas"),j.setAttribute("pointer","false"),j.setAttribute("text",this.#l),j.appendChild($),this.appendChild(j),this.#k=j}else this.appendChild($)}#SJ(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`}#m(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`}#UJ(J,Q){if(!J)return;J.style.setProperty("cursor",Q,"important")}#o(J,Q){if(!J)return;let Z=J.querySelector(".fig-handle-hit-area");if(!Z)return;if(Z.setAttribute("data-cursor","rotate"),this.#UJ(Z,this.#m(Q)),this.#H===J)this.#OJ()}#zJ(){if(!this.#_||!this.#x)return;this.#o(this.#_,this.#O)}#HJ(){return Math.atan2(this.#X-this.#Q,this.#J-this.#Z)*180/Math.PI}#RJ(){if(!this.#E)return;let J=this.#HJ();this.#B?.style.removeProperty("cursor"),this.#G?.style.removeProperty("cursor"),this.#o(this.#B,J+180),this.#o(this.#G,J)}#_J(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`}#v(){let J=this.#p;if(!J||!this.#B)return;let Q=J.getBoundingClientRect();if(this.#_J(this.#B,this.#Z,this.#Q,Q),this.#q){let Z=this.#Z/100*Q.width,$=this.#Q/100*Q.height,j=this.#r(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.#M&&this.#C){let Z=this.#Z/100*Q.width,$=this.#Q/100*Q.height,j,_;if(this.#E)j=this.#J/100*Q.width,_=this.#X/100*Q.height;else{let B=this.#r(Q.width),O=this.#O*Math.PI/180;j=Z+B*Math.cos(O),_=$+B*Math.sin(O)}let X=this.#M;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.#_&&this.#x){let Z=this.#Z/100*Q.width,$=this.#Q/100*Q.height,j=this.#r(Q.width),_=this.#O*Math.PI/180,X=Z+j*Math.cos(_),q=$+j*Math.sin(_),B=Q.width>0?X/Q.width*100:0,O=Q.height>0?q/Q.height*100:0;this.#_J(this.#_,B,O,Q)}if(this.#G&&this.#E)this.#_J(this.#G,this.#J,this.#X,Q);this.#zJ(),this.#RJ()}#MJ(J=this.value){this.dispatchEvent(new CustomEvent("input",{bubbles:!0,detail:J}))}#kJ(J=this.value){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:J}))}#TJ(J){return{...this.value,...HJ(J.color,J.alpha,J.opacity)}}#NJ(){this.setAttribute("value",JSON.stringify(this.value))}#WJ(){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.#MJ(this.#TJ(J.detail));return}this.#P=!0;let Q=J.detail?.px??this.#Z/100,Z=J.detail?.py??this.#Q/100;if(this.#Z=Math.round(Math.max(0,Math.min(100,Q*100))),this.#Q=Math.round(Math.max(0,Math.min(100,Z*100))),this.#Y)this.#Y.removeAttribute("show"),this.#Y.hidePopup?.();this.#v(),this.#MJ()}),this.#B.addEventListener("change",(J)=>{if(J.stopPropagation(),J.detail?.color){this.setAttribute("color",this.#B.getAttribute("color")||J.detail.color),this.#kJ(this.#TJ(J.detail));return}let Q=J.detail?.px??this.#Z/100,Z=J.detail?.py??this.#Q/100;if(this.#Z=Math.round(Math.max(0,Math.min(100,Q*100))),this.#Q=Math.round(Math.max(0,Math.min(100,Z*100))),this.#Y)this.#Y.removeAttribute("show");this.#v(),this.#NJ(),this.#kJ(),requestAnimationFrame(()=>{this.#P=!1})}),this.#_)this.#_.addEventListener("input",(J)=>{J.stopPropagation();let Q=this.#p;if(!Q)return;this.#S=!0,this.classList.add("fig-canvas-control-ring-active");let Z=Q.getBoundingClientRect(),$=this.#Z/100*Z.width,j=this.#Q/100*Z.height,_=J.detail?.x??0,X=J.detail?.y??0,q=this.#_.offsetWidth/2,B=this.#_.offsetHeight/2,O=_+q-$,G=X+B-j,M=Math.atan2(G,O)*180/Math.PI;if(this.#A(J.detail?.shiftKey))M=Math.round(M/15)*15;this.#O=M;let k=Math.sqrt(O*O+G*G);if(this.#A(J.detail?.shiftKey)){let P=this.#$?5:10;if(this.#$){let N=k/Z.width*100;N=Math.round(N/P)*P,k=N/100*Z.width}else k=Math.round(k/P)*P}if(this.#$)this.#j=Math.max(0,k/Z.width*100);else this.#j=Math.max(0,k);if(this.#N)this.#N.setAttribute("text",`Angle ${Math.round(this.#O)}°`),this.#N.setAttribute("show","true"),this.#N.showPopup?.();this.#v(),this.#MJ()}),this.#_.addEventListener("change",(J)=>{if(J.stopPropagation(),this.classList.remove("fig-canvas-control-ring-active"),this.#N)this.#N.removeAttribute("show");this.#v(),this.#NJ(),this.#kJ(),requestAnimationFrame(()=>{this.#S=!1})}),this.#_.addEventListener("hitareadown",(J)=>{J.stopPropagation();let Q=J.detail?.originalEvent;if(!Q)return;Q.preventDefault();let Z=this.#p;if(!Z)return;if(this.#S=!0,this.classList.add("fig-canvas-control-ring-active"),this.#_.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.#Q/100*X.height,O=_.clientX-X.left-q,G=_.clientY-X.top-B,M=Math.atan2(G,O)*180/Math.PI;if(this.#A(_.shiftKey))M=Math.round(M/15)*15;if(this.#O=M,this.#N)this.#N.setAttribute("text",`Angle ${Math.round(M)}°`);this.#v(),this.#MJ()},j=this.#VJ((_)=>{if(this.#S=!1,this.classList.remove("fig-canvas-control-ring-active"),this.#_.removeAttribute("selected"),this.#N)this.#N.removeAttribute("show");if(_)this.#NJ(),this.#kJ()});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.#G)this.#G.addEventListener("input",(J)=>{J.stopPropagation(),this.#L=!0;let Q=J.detail?.px??this.#J/100,Z=J.detail?.py??this.#X/100;if(this.#J=Math.round(Math.max(0,Math.min(100,Q*100))),this.#X=Math.round(Math.max(0,Math.min(100,Z*100))),this.#k)this.#k.removeAttribute("show"),this.#k.hidePopup?.();this.#v(),this.#MJ()}),this.#G.addEventListener("change",(J)=>{if(J.stopPropagation(),this.#k)this.#k.removeAttribute("show");this.#v(),this.#NJ(),this.#kJ(),requestAnimationFrame(()=>{this.#L=!1})}),this.#fJ(this.#B,!0),this.#fJ(this.#G,!1)}#fJ(J,Q){if(!J)return;J.addEventListener("hitareadown",(Z)=>{Z.stopPropagation();let $=Z.detail?.originalEvent;if(!$)return;$.preventDefault();let j=this.#p;if(!j)return;this.#P=!0;let _=j.getBoundingClientRect(),X=Q?this.#J:this.#Z,q=Q?this.#X:this.#Q,B=Q?this.#Z:this.#J,O=Q?this.#Q:this.#X,G=X/100*_.width,M=q/100*_.height,k=B/100*_.width,P=O/100*_.height,N=Math.sqrt((k-G)**2+(P-M)**2),S=Q?this.#Y:this.#k;if(S)S.removeAttribute("show"),S.hidePopup?.();let F=(W)=>{let T=j.getBoundingClientRect(),V=X/100*T.width,H=q/100*T.height,C=W.clientX-T.left-V,I=W.clientY-T.top-H,A=Math.atan2(I,C);if(this.#A(W.shiftKey))A=Math.round(A*180/Math.PI/15)*15*Math.PI/180;let d=V+N*Math.cos(A),o=H+N*Math.sin(A),b=Math.max(0,Math.min(100,d/T.width*100)),y=Math.max(0,Math.min(100,o/T.height*100));if(Q)this.#Z=b,this.#Q=y;else this.#J=b,this.#X=y;this.#v(),this.#MJ()},R=this.#VJ((W)=>{if(this.#P=!1,S)S.removeAttribute("show");if(W)this.#NJ(),this.#kJ()});window.addEventListener("pointermove",F,{signal:R.signal}),window.addEventListener("pointerup",()=>R.finish(!0),{signal:R.signal}),window.addEventListener("pointercancel",()=>R.finish(!1),{signal:R.signal})})}#i(J){if(!J)return;J.addEventListener("pointermove",(Z)=>{if(this.#K)return;let $=this.#p;if(!$)return;let j=$.getBoundingClientRect(),_=this.#Z/100*j.width,X=this.#Q/100*j.height,q=Math.atan2(Z.clientY-j.top-X,Z.clientX-j.left-_)*180/Math.PI;this.#UJ(J,this.#SJ(q))});let Q=(Z)=>{if(Y(this,"disabled"))return;Z.preventDefault(),Z.stopPropagation(),this.#K=!0,this.classList.add("fig-canvas-control-ring-active");let $=this.#p;if(!$)return;if(this.#U)this.#U.setAttribute("show","true"),this.#U.showPopup?.(),this.#n(Z.clientX,Z.clientY);if(this.#N)this.#N.removeAttribute("show"),this.#N.hidePopup?.();let j=this.#_?.style.pointerEvents,_=this.#_?.querySelector(".fig-handle-hit-area"),X=_?.style.pointerEvents;if(this.#_)this.#_.style.pointerEvents="none";if(_)_.style.pointerEvents="none";let q=document.body.style.cursor;J.style.pointerEvents="none";let B=$.getBoundingClientRect(),O=this.#Z/100*B.width,G=this.#Q/100*B.height,M=Math.atan2(Z.clientY-B.top-G,Z.clientX-B.left-O)*180/Math.PI,k=Math.round(M);document.body.style.cursor=this.#SJ(k);let P=(S)=>{let F=$.getBoundingClientRect(),R=this.#Z/100*F.width,W=this.#Q/100*F.height,T=S.clientX-F.left-R,V=S.clientY-F.top-W,H=Math.round(Math.atan2(V,T)*180/Math.PI);if(H!==k)k=H,document.body.style.cursor=this.#SJ(H);let C=Math.sqrt(T*T+V*V);if(this.#A(S.shiftKey)){let I=this.#$?5:10;if(this.#$){let A=C/F.width*100;A=Math.round(A/I)*I,C=A/100*F.width}else C=Math.round(C/I)*I}if(this.#$)this.#j=Math.max(0,C/F.width*100);else this.#j=Math.max(0,C);if(this.#U)this.#U.setAttribute("text",this.#XJ()),this.#n(S.clientX,S.clientY);this.#v(),this.#MJ()},N=this.#VJ((S)=>{if(this.#K=!1,this.classList.remove("fig-canvas-control-ring-active"),J.style.pointerEvents="",this.#_)this.#_.style.pointerEvents=j??"";if(_)_.style.pointerEvents=X??"";if(document.body.style.cursor=q,this.#U)this.#U.removeAttribute("show");if(S)this.#NJ(),this.#kJ()});window.addEventListener("pointermove",P,{signal:N.signal}),window.addEventListener("pointerup",()=>N.finish(!0),{signal:N.signal}),window.addEventListener("pointercancel",()=>N.finish(!1),{signal:N.signal})};J.addEventListener("pointerdown",Q),this._radiusDragCleanup=()=>J.removeEventListener("pointerdown",Q)}#DJ(){if(this._radiusDragCleanup)this._radiusDragCleanup(),this._radiusDragCleanup=null}#VJ(J){this.#CJ();let Q=new AbortController,Z=!1,$=(j=!1)=>{if(Z)return;if(Z=!0,Q.abort(),this.#V===Q)this.#V=null,this.#g=null;J(j)};return this.#V=Q,this.#g=$,{signal:Q.signal,finish:$}}#CJ(){this.#g?.(!1),this.#V?.abort(),this.#V=null,this.#g=null}}U("fig-canvas-control",zJ);class K extends HTMLElement{#Z=[K.#H()];#Q=0;#J=2;#X=240;#j=120;#$={min:-1,max:1};#O=null;#B=null;#G=null;#_=null;#q=0;#M=null;#Y=null;#k=null;#U=null;#N=[];#P=[];#L=[];#K=[];#S=new Set;#T=null;#z=null;#W=null;#F=null;#R=null;static TYPES=[{name:"Wave",value:"sine"},{name:"Square",value:"square"},{name:"Sawtooth",value:"sawtooth"},{name:"Triangle",value:"triangle"}];static#H(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.#R===null)this.#R=this.getAttribute("default")??this.getAttribute("value")??JSON.stringify({waves:[K.#H()]});this.#J=this.#D("precision",2),this.#y(this.getAttribute("value")),this.#g(),this.#t(),this.#OJ(),f(this)}disconnectedCallback(){if(this.#v(),this.#LJ(),this.#T)this.#T.disconnect(),this.#T=null;D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z)return;if(J==="value"){if(this.#y(Z),this.isConnected)this.#t();return}if(J==="precision"){if(this.#J=this.#D("precision",2),this.isConnected)this.#TJ();return}if(J==="aspect-ratio"){if(this.#g(),this.#B)this.#n();return}if(J==="edit"||J==="disabled"){if(this.isConnected)this.#t()}}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.#R??""}get isDefault(){let J=this.#b(this.defaultValue);if(!J)return!1;return JSON.stringify(this.data.waves)===JSON.stringify(J.map((Q)=>this.#E(Q)))}resetToDefault(){let J=this.defaultValue;if(!J)return;this.value=J,this.#i("input"),this.#i("change")}get data(){return{waves:this.#Z.map((J)=>this.#E(J))}}get preset(){let J=this.#C;return K.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}#w(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.#w("disabled",!1)}#g(){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=[K.#H()];return this.#Q=Math.min(this.#Q,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.#a(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)}}#E(J){return{type:J.type,frequency:this.#A(J.frequency),amplitude:this.#A(J.amplitude),phase:this.#A(J.phase),offset:this.#A(J.offset)}}get#C(){if(!this.#Z[this.#Q])this.#Q=0;return this.#Z[this.#Q]||K.#H()}#a(J){let Q=String(J||"").toLowerCase();return K.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))}#A(J){let Q=10**this.#J;return Math.round(J*Q)/Q}static#f(J){return K.TYPES.find((Q)=>Q.value===J)?.name||"Wave"}static#l(J,Q=24){let j=Q-10,_="";for(let X=0;X<=32;X++){let q=X/32,B=K.#p(J,q),O=5+q*j,G=5+(1-(B+1)/2)*j;_+=`${X===0?"M":"L"}${O.toFixed(1)},${G.toFixed(1)}`}return _}static#c(J,Q=24){return E("svg",{width:Q,height:Q,viewBox:`0 0 ${Q} ${Q}`,fill:"none"},E("path",{d:K.#l(J,Q),stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round"}))}static waveIcon(J,Q=24){let Z=K.#l(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#p(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(_)}}#t(){if(this.#v(),this.#LJ(),this.replaceChildren(...this.#XJ()),this.#QJ(),this.#PJ(),this.#n(),this.#SJ(),!this.#V())this.#GJ();f(this)}#r(J,Q){return E("foreignObject",{className:`propskit-oscillator-handle propskit-oscillator-${J}-handle`,"data-handle":J,width:"20",height:"20"},L("div",{className:"propskit-oscillator-handle-inner"},L("fig-tooltip",{text:Q},L("fig-handle",{size:"small",type:"minimal","aria-label":`Oscillator ${J} handle`}))))}#XJ(){let J=this.#I()&&!this.#V(),Q=[E("rect",{className:"propskit-oscillator-bounds",x:"0",y:"0",width:this.#X,height:this.#j}),E("line",{className:"propskit-oscillator-baseline"}),E("path",{className:"propskit-oscillator-path"}),E("circle",{className:"propskit-oscillator-playhead"})];if(J)Q.push(this.#r("amplitude","Amplitude"),this.#r("frequency","Frequency"));let Z=E("svg",{viewBox:`0 0 ${this.#X} ${this.#j}`,className:"propskit-oscillator-svg"},Q),$=[L("div",{className:"propskit-oscillator-svg-container"},Z)];if(this.#I())$.push(L("div",{className:"propskit-oscillator-waves"},this.#Z.map((j,_)=>this.#h(j,_,!J))));return $}#h(J,Q,Z){let $=Z||this.#Z.length<=1,j=Q===this.#Q,_=K.#f(J.type),X=L("fig-tooltip",{text:"Remove form"},L("fig-button",{className:"propskit-oscillator-remove-button",variant:"ghost",icon:!0,"data-wave-index":Q,"aria-label":"Remove form",disabled:$},L("fig-icon",{name:"minus"}))),q=L("fig-header",{borderless:!0},[L("h3",{},_),X,this.#BJ(Z,Q)]),B=L("div",{className:"propskit-oscillator-fields","data-wave-index":Q,"data-active":j},[this.#d(Q,"frequency","Frequency",0.1,16,0.1,""),this.#d(Q,"amplitude","Amplitude",-4,4,0.1,""),this.#d(Q,"phase","Phase",-360,360,1,"°"),this.#d(Q,"offset","Offset",-4,4,0.1,"")]);return L("fig-group",{className:"propskit-oscillator-wave",collapsible:!0,borderless:!0,compact:"true",open:this.#S.has(Q)?"true":"false","data-wave-index":Q},[q,B])}#BJ(J,Q){let Z=L("fig-tooltip",{text:"Add form"},L("fig-button",{className:"propskit-oscillator-add-type-button",variant:"ghost",icon:!0,"fig-menu-trigger":!0,"aria-label":"Add form",disabled:J},L("fig-icon",{name:"plus"}))),$=K.TYPES.map((j)=>L("fig-menu-item",{value:j.value},[K.#c(j.value,24),L("span",{},j.name)]));return L("fig-menu",{className:"propskit-oscillator-add-type",position:"bottom right","data-wave-index":Q,disabled:J},[Z,$])}#d(J,Q,Z,$,j,_,X){let q=this.#Z[J]||K.#H(),B=Q==="amplitude"||Q==="offset";return L("propskit-slider",{className:"propskit-oscillator-field",label:Z,direction:"horizontal",name:Q,"data-wave-index":J,value:this.#A(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()})}#QJ(){this.#B=this.querySelector(".propskit-oscillator-svg"),this.#G=this.querySelector(".propskit-oscillator-path"),this.#_=this.querySelector(".propskit-oscillator-playhead"),this.#M=this.querySelector(".propskit-oscillator-baseline"),this.#Y=this.querySelector(".propskit-oscillator-bounds"),this.#k=this.querySelector('[data-handle="amplitude"]'),this.#U=this.querySelector('[data-handle="frequency"]'),this.#P=Array.from(this.querySelectorAll(".propskit-oscillator-wave-type")),this.#N=Array.from(this.querySelectorAll("propskit-slider[name]")),this.#K=Array.from(this.querySelectorAll("fig-group.propskit-oscillator-wave")),this.#L=Array.from(this.querySelectorAll(".propskit-oscillator-fields"))}#qJ(J){let Q=new Set;for(let Z of this.#S)if(Z<J)Q.add(Z);else if(Z>J)Q.add(Z-1);this.#S=Q}#s(J){let Q=new Set;for(let Z of this.#S)Q.add(Z>=J?Z+1:Z);Q.add(J),this.#S=Q}#OJ(){if(this.#T||!window.ResizeObserver)return;this.#T=new ResizeObserver(()=>{if(this.#PJ())this.#n()}),this.#T.observe(this)}#PJ(){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.#X||Z!==this.#j;return this.#X=Q,this.#j=Z,this.#B.setAttribute("viewBox",`0 0 ${Q} ${Z}`),$}#ZJ(){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}}#$J(J){let{min:Q,max:Z}=this.#$;return this.#j-(J-Q)/(Z-Q)*this.#j}#YJ(J){let{min:Q,max:Z}=this.#$;return Q+(1-J/this.#j)*(Z-Q)}#jJ(J){return this.#Z.reduce((Q,Z)=>{let $=J*Z.frequency,j=K.#p(Z.type,$,Z.phase);return Q+Z.offset+j*Z.amplitude},0)}#n(){if(!this.#B||!this.#G)return;if(this.#PJ(),this.#$=this.#ZJ(),this.#Y)this.#Y.setAttribute("width",this.#X),this.#Y.setAttribute("height",this.#j);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.#X,B=this.#$J(this.#jJ(X));$+=`${_===0?"M":"L"}${q.toFixed(1)},${B.toFixed(1)}`}this.#G.setAttribute("d",$);let j=this.#$J(0);this.#M?.setAttribute("x1","0"),this.#M?.setAttribute("y1",j),this.#M?.setAttribute("x2",this.#X),this.#M?.setAttribute("y2",j),this.#FJ()}#GJ(){if(this.#q||!this.#_)return;let J=(Q)=>{if(!this.isConnected||!this.#_){this.#q=0;return}this.#KJ(Q%1000/1000),this.#q=requestAnimationFrame(J)};this.#q=requestAnimationFrame(J)}#LJ(){if(!this.#q)return;cancelAnimationFrame(this.#q),this.#q=0}#KJ(J){if(!this.#_)return;let Q=J*this.#X,Z=this.#$J(this.#jJ(J));this.#_.setAttribute("cx",Q.toFixed(1)),this.#_.setAttribute("cy",Z.toFixed(1))}#FJ(){let Q=this.#C,Z=this.#e(),$=Math.max(8,Math.min(this.#X-8,this.#X/Q.frequency)),j=this.#$J(this.#jJ(Z/this.#X)),_=this.#$J(this.#jJ($/this.#X));this.#JJ(this.#k,Z,j,8),this.#JJ(this.#U,$,_,8)}#e(){let J=this.#C,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.#X-8,j*this.#X))}#JJ(J,Q,Z,$){if(!J)return;J.setAttribute("x",Q-$),J.setAttribute("y",Z-$),J.setAttribute("width",$*2),J.setAttribute("height",$*2)}#SJ(){if(!this.#I()||this.#V())return;for(let Q of this.#P)Q.addEventListener("change",(Z)=>{if(this.#V())return;let $=this.#m(Q);this.#o($),this.#Z[$].type=this.#a(Z.detail??Z.target?.value),this.#TJ(),this.#i("input"),this.#i("change")});for(let Q of this.#N)Q.addEventListener("input",(Z)=>{Z.stopPropagation(),this.#z=Q;try{this.#zJ(this.#m(Q),Q.getAttribute("name"),Z.detail??Z.currentTarget?.value??Z.target?.value,"input")}finally{this.#z=null}}),Q.addEventListener("change",(Z)=>{Z.stopPropagation(),this.#zJ(this.#m(Q),Q.getAttribute("name"),Z.detail??Z.currentTarget?.value??Z.target?.value,"change")});for(let Q of this.#K)Q.addEventListener("pointerdown",()=>{this.#o(this.#m(Q))}),Q.addEventListener("focusin",()=>{this.#o(this.#m(Q))}),Q.addEventListener("openchange",(Z)=>{let $=this.#m(Q);if(Z.detail?.open)this.#S.add($);else this.#S.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.#m(Q)+1,X=this.#a($.detail?.value??Q.value);this.#Z.splice(_,0,K.#H(X)),this.#s(_),this.#Q=_,this.#t(),this.#i("input"),this.#i("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.#m(Q);this.#Z.splice($,1),this.#qJ($),this.#Q=Math.min(this.#Q,this.#Z.length-1),this.#t(),this.#i("input"),this.#i("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.#_J(Q,"offset")})}#m(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.#_J($,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})}#o(J){let Q=Math.min(this.#Z.length-1,Math.max(0,J));if(Q===this.#Q)return;this.#Q=Q,this.#fJ(),this.#FJ()}#zJ(J,Q,Z,$){if(this.#V())return;this.#o(J);let j=Number.parseFloat(Z);if(!Number.isFinite(j)){if($==="change")this.#WJ();return}this.#Z[J]=this.#x({...this.#Z[J],[Q]:j}),this.#TJ({skipFieldSync:$=="input"}),this.#i($)}#HJ(J,Q){let Z=J.shiftKey?0.5:0.1,$=this.#C;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.#Q]=this.#x($),this.#TJ(),this.#i("input"),this.#i("change"),!0}#RJ(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}}#_J(J,Q){this.#v(),this.#O=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.#O)return;let B=this.#RJ(q),O=this.#C;if(Q==="frequency"){let G=Math.max(1,Math.min(this.#X,B.x));O.frequency=this.#X/G}else if(Q==="offset"){let G=this.#u(B.x/this.#X,0,0,1),M=this.#kJ(O,G);O.offset=this.#YJ(B.y)-this.#MJ(this.#Q,G)-M*O.amplitude}else if(Q==="amplitude"){let G=this.#u(B.x/this.#X,0,0,1),M=this.#kJ(O,G),k=this.#YJ(B.y)-this.#MJ(this.#Q,G)-O.offset;O.amplitude=Math.abs(M)<0.001?O.amplitude:k/M}this.#Z[this.#Q]=this.#x(O),this.#TJ(),this.#i("input")},_=new AbortController,X=(q=!1)=>{if(this.#O=null,this.#B?.classList.remove("dragging"),Z)document.body.style.cursor=$;if(_.abort(),this.#W===_)this.#W=null,this.#F=null;if(q)this.#i("change")};this.#W=_,this.#F=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})}#v(){this.#F?.(!1),this.#W?.abort(),this.#W=null,this.#F=null,this.#O=null,this.#B?.classList.remove("dragging")}#MJ(J,Q){return this.#Z.reduce((Z,$,j)=>{if(j===J)return Z;let _=Q*$.frequency,X=K.#p($.type,_,$.phase);return Z+$.offset+X*$.amplitude},0)}#kJ(J,Q){return K.#p(J.type,Q*J.frequency,J.phase)}#TJ({skipFieldSync:J=!1}={}){if(this.#NJ(),!J)this.#WJ();this.#fJ(),this.#n()}#NJ(){for(let J of this.#P){let Q=this.#m(J);J.value=this.#Z[Q]?.type||"sine"}}#WJ(){for(let J of this.#N){if(J===this.#z)continue;let Q=this.#m(J),Z=J.getAttribute("name"),$=this.#A(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.#L)if(this.#m(J)===this.#Q)J.setAttribute("data-active","");else J.removeAttribute("data-active")}#i(J){this.dispatchEvent(new CustomEvent(J,{bubbles:!0,detail:{value:this.value,data:this.data,preset:K.#f(this.#C.type)}}))}}U("propskit-oscillator",K);class WJ extends HTMLElement{#Z;#Q;#J=null;#X;#j;#$;#O;#B;#G;#_;#q=null;#M=null;constructor(){super();this.angle=0,this.#Z=1,this.#Q=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.#X=this.#w.bind(this),this.#j=this.#a.bind(this),this.#$=this.#u.bind(this),this.#O=this.#l.bind(this),this.#B=this.#c.bind(this),this.#G=this.#I.bind(this),this.#_=this.#f.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.#Y(),this.#H(),this.#C(),this.text&&this.angleInput)this.angleInput.setAttribute("value",this.angle.toFixed(this.precision))})}disconnectedCallback(){this.#A(),this.#D()}#Y(){this.#A(),this.#D();let J=this.#z(),Q=this.#P(),Z=this.getAttribute("aria-label")||this.getAttribute("name")||"Angle",$=this.min??this.#F(0),j=this.max??this.#F(360),_=[];if(this.dial)_.push(L("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},L("div",{className:"fig-input-angle-handle"})));if(this.text)_.push(L("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?L("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.#W(this.angle));return Math.floor(J/360)}#P(){return Y(this,"disabled")}#L(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}#K(J,{reflect:Q=!0}={}){let Z=this.#L(J);if(this.angle=Z,this.#V(),Q){let $=String(Z);if(this.getAttribute("value")!==$)this.setAttribute("value",$)}if(this.#C(),this.angleInput)this.angleInput.value=Z.toFixed(this.precision);this.#S(),this.#T()}#S(){if(!this.plane)return;this.plane.setAttribute("aria-valuenow",String(this.angle)),this.plane.setAttribute("aria-valuetext",`${this.angle.toFixed(this.precision)}${this.units}`)}#T(){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"}#z(){switch(this.units){case"rad":return 0.01;case"turn":return 0.001;default:return 0.1}}#W(J){switch(this.units){case"rad":return J*180/Math.PI;case"turn":return J*360;default:return J}}#F(J){switch(this.units){case"rad":return J*Math.PI/180;case"turn":return J/360;default:return J}}#R(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 $}}#H(){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.#T(),this.plane?.addEventListener("mousedown",this.#j),this.plane?.addEventListener("touchstart",this.#$),this.plane?.addEventListener("keydown",this.#_),window.addEventListener("keydown",this.#O),window.addEventListener("keyup",this.#B),this.text&&this.angleInput)this.angleInput.addEventListener("input",this.#G),this.angleInput.addEventListener("change",this.#G);this.addEventListener("change",this.#X,!0)}#D(){if(this.plane?.removeEventListener("mousedown",this.#j),this.plane?.removeEventListener("touchstart",this.#$),this.plane?.removeEventListener("keydown",this.#_),window.removeEventListener("keydown",this.#O),window.removeEventListener("keyup",this.#B),this.text&&this.angleInput)this.angleInput.removeEventListener("input",this.#G),this.angleInput.removeEventListener("change",this.#G);this.removeEventListener("change",this.#X,!0)}#w(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.#R($,j,this.units);J.target.value=String(_)}}}#I(J){if(J.stopPropagation(),this.#P())return;if(this.#K(Number(J.target.value)),J.type==="change")this.#E();else this.#x()}#V(){let Q=this.#W(this.angle)*Math.PI/180;this.#Z=Math.cos(Q),this.#Q=Math.sin(Q)}#g(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.#g(Z),this.min!==null||this.max!==null)this.angle=this.#L(this.#F(Z));else if(this.#J===null){this.#J=Z;let _=(this.#W(this.angle)%360+360)%360,X=Z-_;if(X>180)X-=360;if(X<-180)X+=360;this.angle=this.#L(this.angle+this.#F(X))}else{let j=Z-this.#J;if(j>180)j-=360;if(j<-180)j+=360;this.angle=this.#L(this.angle+this.#F(j)),this.#J=Z}if(this.#V(),this.setAttribute("value",String(this.angle)),this.#C(),this.text&&this.angleInput)this.angleInput.setAttribute("value",this.angle.toFixed(this.precision));this.#T(),this.#S(),this.#x()}#x(){this.dispatchEvent(new CustomEvent("input",{bubbles:!0,cancelable:!0,detail:{value:this.value,angle:this.angle}}))}#E(){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0,detail:{value:this.value,angle:this.angle}}))}#C(){if(this.handle){let Q=this.#W(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)`}}#a(J){if(this.#P()||J.button!==0)return;this.#A(),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.#M=null;if(j)this.#E()};this.#q=Z,this.#M=$,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.#P())return;J.preventDefault(),this.#A(),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.#M=null;if(j)this.#E()};this.#q=Z,this.#M=$,window.addEventListener("touchmove",Q,{signal:Z.signal}),window.addEventListener("touchend",()=>$(!0),{signal:Z.signal}),window.addEventListener("touchcancel",()=>$(!1),{signal:Z.signal})}#A(){this.#M?.(!1),this.#q?.abort(),this.#q=null,this.#M=null,this.isDragging=!1,this.#J=null,this.plane?.classList.remove("dragging")}#f(J){if(this.#P())return;let Q=this.#z()*(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.#F(0);else if(J.key==="End")Z=this.max??this.#F(360);else return;J.preventDefault(),J.stopPropagation(),this.#K(Z),this.#x(),this.#E()}#l(J){if(J.key==="Shift")this.isShiftHeld=!0}#c(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.#Q}set value(J){if(isNaN(J)){console.error("Invalid value: must be a number.");return}this.#K(Number(J))}attributeChangedCallback(J,Q,Z){switch(J){case"value":if(this.isDragging)break;if(Z!==null)this.#K(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.#H(),this.#C()}break;case"dial":if(this.dial=this.#k("dial",!0),this.isConnected)this.#Y(),this.#H(),this.#C();break;case"units":{let $=Z||"°";if($==="deg")$="°";if(this.units=$,this.isConnected)this.#Y(),this.#H(),this.#C();break}case"min":if(this.min=Z!==null?Number(Z):null,this.#K(this.angle),this.isConnected)this.#Y(),this.#H(),this.#C();break;case"max":if(this.max=Z!==null?Number(Z):null,this.#K(this.angle),this.isConnected)this.#Y(),this.#H(),this.#C();break;case"disabled":if(this.#A(),this.isConnected)this.#Y(),this.#H(),this.#C();break;case"aria-label":case"name":if(this.isConnected)this.#Y(),this.#H(),this.#C();break;case"rotations":case"show-rotations":if(this.showRotations=this.#U(),this.isConnected)this.#Y(),this.#H(),this.#C();break}}}U("fig-input-angle",WJ);class h extends HTMLElement{static observedAttributes=["axis","handle","disabled"];static#Z=6;static#Q=['[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-input-joystick","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;#X=new Map;#j=null;#$=null;#O=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.#S(),this.#M(),this.#J=new MutationObserver(()=>this.#M()),this.#J.observe(this,{childList:!0})}disconnectedCallback(){this.#J?.disconnect(),this.#J=null,this.#E(),this.#C(),this.#g(),this.#O?.remove(),this.#O=null}attributeChangedCallback(){if(this.isConnected){if(this.#B)this.#C();this.#M()}}get#B(){return this.hasAttribute("disabled")&&this.getAttribute("disabled")!=="false"}get#G(){return(this.getAttribute("axis")||"vertical").trim().toLowerCase()==="horizontal"?"horizontal":"vertical"}get#_(){return(this.getAttribute("handle")||"").trim()}#q(){return[...this.children].filter((J)=>J.nodeType===Node.ELEMENT_NODE&&!J.hasAttribute("data-reorder-live"))}#M(){let J=this.#q(),Q=new Set(J);for(let[Z,$]of this.#X)if(!Q.has(Z))$.target.removeEventListener("pointerdown",$.onPointerDown,!0),$.target.removeEventListener("keydown",$.onKeyDown),this.#K($),this.#X.delete(Z);if(this.#U(J),this.#Y(J),this.#B||J.length<2){this.#E();return}for(let Z of J){let $=this.#P(Z),j=this.#X.get(Z);if(j&&j.target===$)continue;if(j)j.target.removeEventListener("pointerdown",j.onPointerDown,!0),this.#X.delete(Z);if(!$)continue;this.#L(Z,$)}this.#N(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","")}#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.#_)return;for(let Q of J){let Z=Q.querySelector(this.#_);if(Z)Z.setAttribute("data-reorder-handle",""),Z.setAttribute("aria-roledescription","reorder handle")}}#P(J){if(this.#_)return J.querySelector(this.#_);return J}#L(J,Q){let Z=(B)=>{if(this.#B||this.#q().length<2)return;if(B.button!==0)return;if(!this.#_&&this.#z(B.target,J))return;this.#R(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 O=this.#G==="horizontal",G=O?"ArrowLeft":"ArrowUp",M=O?"ArrowRight":"ArrowDown";if(B.key!==G&&B.key!==M&&B.key!=="Home"&&B.key!=="End")return;B.preventDefault(),B.stopPropagation();let k=this.#q(),P=k.indexOf(J),N=P;if(B.key===G)N=Math.max(0,P-1);else if(B.key===M)N=Math.min(k.length-1,P+1);else if(B.key==="Home")N=0;else if(B.key==="End")N=k.length-1;if(N===P){this.#T(`${X}, position ${P+1} of ${k.length}`);return}this.#b(J,N),this.#M(),this.#P(J)?.focus(),this.dispatchEvent(new CustomEvent("reorder",{bubbles:!0,detail:{oldIndex:P,newIndex:N,item:J}})),this.#T(`${X}, position ${N+1} of ${k.length}`)};Q.addEventListener("pointerdown",Z,!0),Q.addEventListener("keydown",q),this.#X.set(J,{target:Q,onPointerDown:Z,onKeyDown:q,originalTabIndex:$,originalAriaLabel:j,originalRole:_})}#K(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)}#S(){if(this.#O?.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.#O=J,document.body.appendChild(J)}#T(J){if(!this.#O)return;this.#O.textContent="",requestAnimationFrame(()=>{if(this.#O)this.#O.textContent=J})}#z(J,Q){let Z=J;while(Z&&Z!==Q){if(Z instanceof Element){for(let $ of h.#Q)if(Z.matches($))return!0}Z=Z.parentElement}return!1}static#W="fig-reorder-dragging";static#F(J){document.body.classList.toggle(h.#W,J)}#R(J,Q,Z){this.#C();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<h.#Z*h.#Z)return;$.active=!0,J.preventDefault(),J.stopPropagation(),Q.classList.add("dragging"),h.#F(!0);try{Z.setPointerCapture($.pointerId)}catch{}}j.preventDefault();let q=this.#G==="horizontal"?j.clientX:j.clientY,B=this.#H(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.#j=$,window.addEventListener("pointermove",$.onMove),window.addEventListener("pointerup",$.onUp),window.addEventListener("pointercancel",$.onUp),window.addEventListener("keydown",$.onKeyDown)}#H(J){let Q=this.#q(),Z=this.#G==="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}#w(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.#$)return this.#$;let J=document.createElement("div");return J.className="fig-reorder-indicator",J.setAttribute("data-axis",this.#G),document.body.appendChild(J),this.#$=J,J}#V(J,Q){let Z=this.#q();if(!this.#D(Q,J)){this.#g();return}let $=this.#w(Z);if(!$){this.#g();return}let j=this.#I();if(j.setAttribute("data-axis",this.#G),this.#G==="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"}#g(){this.#$?.remove(),this.#$=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 O=Z.getAttribute("aria-label")||Z.textContent?.trim().replace(/\s+/g," ").slice(0,80)||"item";this.#T(`${O}, position ${B+1} of ${this.#q().length}`)}}}if(Z.classList.remove("dragging"),h.#F(!1),this.#g(),this.#j===J)this.#j=null}#E(){for(let[,J]of this.#X)J.target.removeEventListener("pointerdown",J.onPointerDown,!0),J.target.removeEventListener("keydown",J.onKeyDown),this.#K(J);this.#X.clear()}#C(){if(!this.#j)return;this.#x(this.#j,!0)}}U("fig-reorder",h);
|
|
3
|
+
`:",";return Q.split(Z).map(($)=>$.trim()).filter(Boolean)}static#L(J){if(J&&typeof J==="object")return String(J.value??J.label??"");return String(J??"")}static#U(J){if(J&&typeof J==="object")return String(J.label??J.value??"");return String(J??"")}connectedCallback(){if(!this.#Z)this.#S();if(this.#T(),this.#H(),this.#z(),this.removeEventListener("click",this.#q),this.addEventListener("click",this.#q),this.removeEventListener("pointerdown",this.#M,!0),this.addEventListener("pointerdown",this.#M,!0),f(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==="direction"||j==="aria-label")Q=!0;else Z=!0}if(Q)this.#T();if(Z)this.#H()});this.#$.observe(this,{attributes:!0})}disconnectedCallback(){this.#$?.disconnect(),this.#V(),this.removeEventListener("click",this.#q),this.removeEventListener("pointerdown",this.#M,!0),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction"||J==="aria-label"){this.#T();return}if(J==="options"||J==="value")this.#H()}#S(){this.#k=this.getAttribute("value")??"";let J=this.querySelector(":scope > label"),Q=this.querySelector(":scope > fig-select-options"),Z=document.createElement("fig-field"),$=J||document.createElement("label");this.#_=u.#K();let j=document.createElement(this.#_?"fig-select":"fig-dropdown");if(j.setAttribute("full",""),this.#_&&Q)j.append(Q);Z.append($,j),this.#Z=Z,this.#Q=$,this.#J=j,this.#j=Boolean(J),this.replaceChildren(Z)}#T(){if(!this.#Z||!this.#Q||!this.#J)return;let J=this.hasAttribute("label"),Q=this.getAttribute("label");if(J&&(Q??"").trim()==="")this.#Q.remove();else{if(!this.#j)this.#Q.textContent=J?Q??"":"Label";if(this.#Q.parentElement!==this.#Z)this.#Z.prepend(this.#Q)}this.#Z.setAttribute("direction",this.getAttribute("direction")||"horizontal"),this.#J.setAttribute("label",this.getAttribute("aria-label")||this.#Q.textContent?.trim()||"Select"),this.#J.setAttribute("full","")}#F(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","full","default","variant"]);if(!this.#_)J.add("options");return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!Q.startsWith("data-"))}#W(){if(!this.#J||this.#_)return;let J=u.#P(this.getAttribute("options"));for(let Z of[...this.#J.children])if(Z.localName==="option"||Z.localName==="optgroup")Z.remove();for(let Z of J){let $=document.createElement("option");$.value=u.#L(Z),$.textContent=u.#U(Z),this.#J.appendChild($)}let Q=this.getAttribute("value");if(Q!=null){let Z=()=>{if(this.#J?.setAttribute("value",Q),this.#J&&"value"in this.#J)this.#J.value=Q};Z(),queueMicrotask(Z)}}#H(){if(!this.#J)return;if(!this.#_)this.#W();let J=this.#F().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.#O)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#O=Q}#z(){if(!this.#J)return;if(this.#B??=this.#R.bind(this,"input"),this.#G??=this.#R.bind(this,"change"),this.#J.addEventListener("input",this.#B),this.#J.addEventListener("change",this.#G),this.#_)this.#X??=this.#R.bind(this,"optionhover"),this.#J.addEventListener("optionhover",this.#X)}#V(){if(!this.#J)return;if(this.#B)this.#J.removeEventListener("input",this.#B);if(this.#G)this.#J.removeEventListener("change",this.#G);if(this.#X)this.#J.removeEventListener("optionhover",this.#X)}#R(J,Q){if(Q.target!==this.#J)return;if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=this.#J?.value??"";if(J!=="optionhover")this.setAttribute("value",String(Z));let $=Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:Z;this.dispatchEvent(new CustomEvent(J,{detail:$,bubbles:!0,cancelable:!0,composed:!0}))}#D(){if(!this.#J||!this.#_)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, fig-dropdown")){this.#Y=!1;return}if(!this.#_)return;this.#Y=this.#D()}#I(J){if(Y(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-menu"))return;if(J.target instanceof Element&&J.target.closest("fig-select, fig-dropdown")){this.#Y=!1;return}if(!this.#J||Y(this.#J,"disabled")){this.#Y=!1;return}if(this.#J.focus(),!this.#_)return;if(this.#Y||this.#D()){this.#Y=!1,this.#J.open=!1;return}this.#J.open=!0}get value(){return 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;g(this,J)}focus(J){this.#J?.focus(J)}}U("propskit-select",u);class PJ extends HTMLElement{#Z=null;#Q=null;#J=null;#_=!1;#j=null;#$=new Set;#O=null;#B=null;#G=this.#U.bind(this);#X=null;static get observedAttributes(){return["label","direction","aria-label"]}connectedCallback(){if(!this.#Z)this.#q();if(this.#M(),this.#k(),this.#K(),this.removeEventListener("click",this.#G),this.addEventListener("click",this.#G),f(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==="direction"||$.attributeName==="aria-label")Q=!0;else Z=!0}if(Q)this.#M();if(Z)this.#k()});this.#j.observe(this,{attributes:!0})}disconnectedCallback(){this.#j?.disconnect(),this.#P(),this.removeEventListener("click",this.#G),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction"||J==="aria-label")this.#M()}#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=document.createElement("fig-field"),$=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.#Q=$,this.#J=j,this.#_=Boolean(Q),this.replaceChildren(Z)}#M(){if(!this.#Z||!this.#Q||!this.#J)return;let J=this.hasAttribute("label"),Q=this.getAttribute("label");if(J&&(Q??"").trim()==="")this.#Q.remove();else{if(!this.#_)this.#Q.textContent=J?Q??"":"Label";if(this.#Q.parentElement!==this.#Z)this.#Z.prepend(this.#Q)}this.#Z.setAttribute("direction",this.getAttribute("direction")||"horizontal"),this.#J.setAttribute("aria-label",this.getAttribute("aria-label")||this.#Q.textContent?.trim()||"Text")}#Y(){let J=new Set(["label","direction","oninput","onchange","class","style","id","size","aria-label","multiline","resizable","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.#$)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#$=Q}#K(){if(!this.#J)return;this.#O??=this.#L.bind(this,"input"),this.#B??=this.#L.bind(this,"change"),this.#J.addEventListener("input",this.#O),this.#J.addEventListener("change",this.#B)}#P(){if(!this.#J)return;if(this.#O)this.#J.removeEventListener("input",this.#O);if(this.#B)this.#J.removeEventListener("change",this.#B)}#L(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=this.#J?.value??"";this.setAttribute("value",String(Z));let $=Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:Z;this.dispatchEvent(new CustomEvent(J,{detail:$,bubbles:!0,cancelable:!0,composed:!0}))}#U(J){if(Y(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,g(this,J)}focus(J){this.#J?.focus(J)}}U("propskit-text",PJ);class LJ extends HTMLElement{#Z=null;#Q=null;#J=null;#_=!1;#j=null;#$=new Set;#O=null;#B=null;#G=this.#U.bind(this);#X=null;static get observedAttributes(){return["label","direction"]}connectedCallback(){if(!this.#Z)this.#q();if(this.#M(),this.#k(),this.#K(),this.removeEventListener("click",this.#G),this.addEventListener("click",this.#G),f(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==="direction")Q=!0;else Z=!0}if(Q)this.#M();if(Z)this.#k()});this.#j.observe(this,{attributes:!0})}disconnectedCallback(){this.#j?.disconnect(),this.#P(),this.removeEventListener("click",this.#G),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Z)return;if(J==="label"||J==="direction")this.#M()}#q(){this.#X=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=document.createElement("fig-field"),$=Q||document.createElement("label"),j=document.createElement("fig-input-number");Z.append($,j),this.#Z=Z,this.#Q=$,this.#J=j,this.#_=Boolean(Q),this.replaceChildren(Z);for(let _ of J)if(_!==Q)j.appendChild(_)}#M(){if(!this.#Z||!this.#Q)return;let J=this.hasAttribute("label"),Q=this.getAttribute("label");if(J&&(Q??"").trim()==="")this.#Q.remove();else{if(!this.#_)this.#Q.textContent=J?Q??"":"Label";if(this.#Q.parentElement!==this.#Z)this.#Z.prepend(this.#Q)}this.#Z.setAttribute("direction",this.getAttribute("direction")||"horizontal")}#Y(){let J=new Set(["label","direction","size","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.#Y(),Q=new Set(J);for(let Z of this.#$)if(!Q.has(Z))this.#J.removeAttribute(Z);for(let Z of J)this.#J.setAttribute(Z,this.getAttribute(Z)??"");this.#$=Q}#K(){if(!this.#J)return;this.#O??=this.#L.bind(this,"input"),this.#B??=this.#L.bind(this,"change"),this.#J.addEventListener("input",this.#O),this.#J.addEventListener("change",this.#B)}#P(){if(!this.#J)return;if(this.#O)this.#J.removeEventListener("input",this.#O);if(this.#B)this.#J.removeEventListener("change",this.#B)}#L(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:this.#J?.value;if(this.#J?.value!==void 0)this.setAttribute("value",String(this.#J.value));this.dispatchEvent(new CustomEvent(J,{detail:Z,bubbles:!0,cancelable:!0,composed:!0}))}#U(J){if(Y(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number, fig-menu"))return;this.focus()}get value(){return 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.#X??"0"}get isDefault(){return c(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.value=J,g(this,this.#J?.value??J)}focus(J){this.#J?.focus(J)}}U("propskit-number",LJ);class UJ extends HTMLElement{static observedAttributes=["x","y","default","label","units","disabled","size"];#Z=null;#Q=null;#J=null;#_=null;#j=!1;#$=!1;#O=this.#W.bind(this,"input");#B=this.#W.bind(this,"change");#G=this.#H.bind(this);connectedCallback(){if(!this.#j)this.#_=this.#q(),this.#Y(this.#_),this.#j=!0;if(!this.#Z)this.#K();this.#P(),this.#L(),this.#T(),this.removeEventListener("click",this.#G),this.addEventListener("click",this.#G),f(this)}disconnectedCallback(){this.#F(),this.removeEventListener("click",this.#G),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#j)return;if((J==="x"||J==="y")&&!this.#$)this.#L();else if(J==="label")this.#P();else if(J==="units")this.#U();else if(J==="disabled")this.#S()}#X(J,Q=50){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#q(){let J=this.getAttribute("x"),Q=this.getAttribute("y");return{x:J===null||!J.trim()?50:this.#X(J,50),y:Q===null||!Q.trim()?50:this.#X(Q,50)}}#M(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.#X(Q.x,this.#_?.x??50),y:this.#X(Q.y,this.#_?.y??50)}}catch{return null}}#Y(J){let Q=this.#q(),Z={x:this.#X(J?.x,Q.x),y:this.#X(J?.y,Q.y)};return this.#$=!0,this.setAttribute("x",String(Z.x)),this.setAttribute("y",String(Z.y)),this.#$=!1,Z}#k(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($),Y(this,"disabled"))Z.setAttribute("disabled","");return Z}#K(){let J=this.#q(),Q=document.createElement("fig-field");Q.className="propskit-position-row",Q.setAttribute("direction","horizontal");let Z=document.createElement("label"),$=this.#k("x",J.x),j=this.#k("y",J.y);Q.append(Z,$,j),this.#Z=Q,this.#Q=$,this.#J=j,this.replaceChildren(Q),f(this)}#P(){let J=this.#Z?.querySelector(":scope > label");if(!J)return;let Q=this.getAttribute("label");J.textContent=Q?.trim()||"Position"}#L(){let J=this.#q();this.#Q?.setAttribute("value",String(J.x)),this.#J?.setAttribute("value",String(J.y)),this.#U(),this.#S()}#U(){let J=this.units==="percent"?"%":null;for(let Q of[this.#Q,this.#J]){if(!Q)continue;if(J)Q.setAttribute("units",J);else Q.removeAttribute("units")}}#S(){let J=Y(this,"disabled");this.#Q?.toggleAttribute("disabled",J),this.#J?.toggleAttribute("disabled",J)}#T(){this.#F(),this.#Q?.addEventListener("input",this.#O),this.#Q?.addEventListener("change",this.#B),this.#J?.addEventListener("input",this.#O),this.#J?.addEventListener("change",this.#B)}#F(){this.#Q?.removeEventListener("input",this.#O),this.#Q?.removeEventListener("change",this.#B),this.#J?.removeEventListener("input",this.#O),this.#J?.removeEventListener("change",this.#B)}#W(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=Q.currentTarget?.getAttribute("data-propskit-position-axis");if(Z!=="x"&&Z!=="y")return;let $=this.value;$[Z]=this.#X(Q.currentTarget.value,$[Z]);let j=this.#Y($);this.dispatchEvent(new CustomEvent(J,{detail:{...j,units:this.units},bubbles:!0,cancelable:!0,composed:!0}))}#H(J){if(Y(this,"disabled"))return;if(J.target instanceof Element&&J.target.closest("fig-input-number, fig-menu"))return;this.focus()}get x(){return this.#q().x}set x(J){this.setAttribute("x",String(this.#X(J,50)))}get y(){return this.#q().y}set y(J){this.setAttribute("y",String(this.#X(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.#q()}}set value(J){let Q=this.#Y(J);this.#L(Q)}get defaultValue(){return this.#M(this.getAttribute("default"))||{...this.#_||{x:50,y:50}}}get isDefault(){return e(this.value,this.defaultValue)}resetToDefault(){let J=this.defaultValue;this.value=J,g(this,{...J,units:this.units})}focus(J){this.#Q?.focus(J)}}U("propskit-position",UJ);class KJ extends HTMLElement{static observedAttributes=["label","collapsible","open","size","disabled","value"];#Z=null;#Q=null;#J=null;#_=!1;#j=!1;#$=!1;#O=this.#S.bind(this,"input");#B=this.#S.bind(this,"change");#G=this.#T.bind(this);connectedCallback(){if(!this.#_)this.#Y(this.#M()),this.#_=!0;if(!this.#Z)this.#k();this.#K(),this.#P(),this.#L(),this.#U(this.#M()),this.removeEventListener("input",this.#O),this.addEventListener("input",this.#O),this.removeEventListener("change",this.#B),this.addEventListener("change",this.#B),this.removeEventListener("openchange",this.#G),this.addEventListener("openchange",this.#G)}disconnectedCallback(){this.removeEventListener("input",this.#O),this.removeEventListener("change",this.#B),this.removeEventListener("openchange",this.#G)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#_)return;if(J==="value"){if(!this.#j){let $=this.#Y(this.#M());this.#U($)}return}if(J==="size"){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){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"}}#M(){return this.#q(this.getAttribute("value"))}#Y(J){let Q=this.#q(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#j=!0,this.setAttribute("value",Z),this.#j=!1,Q}#k(){let J=this.#M(),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.#Q=Z,this.#J=$,this.#K(),this.#P(),this.#L(),Q.append(Z,$),this.replaceChildren(Q)}#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(){let J=this.getAttribute("size");for(let Q of[this.#Q,this.#J]){if(!Q)continue;if(J===null)Q.removeAttribute("size");else Q.setAttribute("size",J)}}#L(){l(this,[this.#Q,this.#J])}#U(J){let Q=this.#q(J);if(this.#Q)this.#Q.value=Q.color;if(this.#J)this.#J.value={x:Q.x,y:Q.y}}#S(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(),Y(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;let _=this.#Y($);this.dispatchEvent(new CustomEvent(J,{detail:{..._,units:"percent"},bubbles:!0,cancelable:!0,composed:!0}))}#T(J){if(J.target!==this.#Z||this.#$)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#$=!0,this.setAttribute("open",String(Q)),this.#$=!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.#M()}}set value(J){let Q=this.#Y(J);this.#U(Q)}focus(J){this.#Q?.focus(J)}}U("propskit-color-point",KJ);class SJ extends HTMLElement{static observedAttributes=["label","collapsible","open","size","units","disabled","value"];#Z=null;#Q=null;#J=null;#_=!1;#j=!1;#$=!1;#O=this.#H.bind(this,"input");#B=this.#H.bind(this,"change");#G=this.#z.bind(this);connectedCallback(){if(!this.#_)this.#k(this.#Y()),this.#_=!0;if(!this.#Z)this.#P();this.#L(),this.#U(),this.#S(),this.#T(),this.#F(this.#Y()),this.removeEventListener("input",this.#O),this.addEventListener("input",this.#O),this.removeEventListener("change",this.#B),this.addEventListener("change",this.#B),this.removeEventListener("openchange",this.#G),this.addEventListener("openchange",this.#G)}disconnectedCallback(){this.removeEventListener("input",this.#O),this.removeEventListener("change",this.#B),this.removeEventListener("openchange",this.#G)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#_)return;if(J==="value"){if(!this.#j){let $=this.#k(this.#Y());this.#F($)}return}if(J==="size"){this.#U();return}if(J==="units"){this.#S();return}if(J==="disabled"){this.#T();return}this.#L()}#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)}#M(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)}}#Y(){return this.#M(this.getAttribute("value"))}#k(J){let Q=this.#M(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#j=!0,this.setAttribute("value",Z),this.#j=!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=Z,this.#Q=$,this.#J=j,this.#L(),this.#U(),this.#T(),Z.append($,j),this.replaceChildren(Z)}#L(){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")}#U(){let J=this.getAttribute("size");for(let Q of[this.#Q,this.#J]){if(!Q)continue;if(J===null)Q.removeAttribute("size");else Q.setAttribute("size",J)}}#S(){if(this.hasAttribute("units"))this.#Q?.setAttribute("units",this.units);else this.#Q?.removeAttribute("units");if(this.units==="percent")this.#J?.setAttribute("units","%");else this.#J?.removeAttribute("units")}#T(){l(this,[this.#Q,this.#J])}#F(J){let Q=this.#M(J);if(this.#Q)this.#Q.value={x:Q.x,y:Q.y};if(this.#J){let Z=this.#K(Q.radius);this.#J.value=Z.value}}#W(J,Q){let Z=this.#K(Q).value,$=this.#X(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-control]");if(!Z||!this.contains(Z))return;if(Q.stopImmediatePropagation(),Y(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.#W(Z,$.radius);else return;let _=this.#k($);this.dispatchEvent(new CustomEvent(J,{detail:{..._,radius:this.#K(_.radius).value,units:this.units},bubbles:!0,cancelable:!0,composed:!0}))}#z(J){if(J.target!==this.#Z||this.#$)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#$=!0,this.setAttribute("open",String(Q)),this.#$=!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.#F(Q)}focus(J){this.#Q?.focus(J)}}U("propskit-point-radius",SJ);class TJ extends HTMLElement{static observedAttributes=["label","collapsible","open","size","units","disabled","value"];#Z=null;#Q=null;#J=null;#_=null;#j=!1;#$=!1;#O=!1;#B=this.#z.bind(this,"input");#G=this.#z.bind(this,"change");#X=this.#V.bind(this);connectedCallback(){if(!this.#j)this.#K(this.#k()),this.#j=!0;if(!this.#Z)this.#L();this.#U(),this.#S(),this.#T(),this.#F(),this.#W(this.#k()),this.removeEventListener("input",this.#B),this.addEventListener("input",this.#B),this.removeEventListener("change",this.#G),this.addEventListener("change",this.#G),this.removeEventListener("openchange",this.#X),this.addEventListener("openchange",this.#X)}disconnectedCallback(){this.removeEventListener("input",this.#B),this.removeEventListener("change",this.#G),this.removeEventListener("openchange",this.#X)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#j)return;if(J==="value"){if(!this.#$){let $=this.#K(this.#k());this.#W($)}return}if(J==="size"){this.#S();return}if(J==="units"){this.#T();return}if(J==="disabled"){this.#F();return}this.#U()}#q(J,Q){let Z=Number(J);return Number.isFinite(Z)?Z:Q}#M(J){if(typeof J==="string"&&J.trim().endsWith("%")){let Q=Number.parseFloat(J);if(Number.isFinite(Q))return`${Q}%`}return this.#q(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.#q(Q.x,50),y:this.#q(Q.y,50),radius:this.#M(Q.radius),angle:this.#q(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.#$=!0,this.setAttribute("value",Z),this.#$=!1,Q}#P(J){let Q=typeof J==="string"&&J.trim().endsWith("%");return{value:Q?Number.parseFloat(J):J,units:Q?"%":"px"}}#L(){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=Z,this.#Q=$,this.#J=j,this.#_=_,this.#U(),this.#S(),this.#F(),Z.append($,j,_),this.replaceChildren(Z)}#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")}#S(){let J=this.getAttribute("size");for(let Q of[this.#Q,this.#J,this.#_]){if(!Q)continue;if(J===null)Q.removeAttribute("size");else Q.setAttribute("size",J)}}#T(){if(this.hasAttribute("units"))this.#Q?.setAttribute("units",this.units);else this.#Q?.removeAttribute("units");if(this.units==="percent")this.#J?.setAttribute("units","%");else this.#J?.removeAttribute("units")}#F(){l(this,[this.#Q,this.#J,this.#_])}#W(J){let Q=this.#Y(J);if(this.#Q)this.#Q.value={x:Q.x,y:Q.y};if(this.#J){let Z=this.#P(Q.radius);this.#J.value=Z.value}if(this.#_)this.#_.value=Q.angle}#H(J,Q){let Z=this.#P(Q).value,$=this.#q(J.value,Z);return(J.querySelector("fig-input-number")?.getAttribute("units")||J.getAttribute("units"))==="%"?`${$}%`:$}#z(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(),Y(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.#H(Z,$.radius);else if(j==="angle")$.angle=this.#q(Z.value,$.angle);else return;let _=this.#K($);this.dispatchEvent(new CustomEvent(J,{detail:{..._,radius:this.#P(_.radius).value,units:this.units},bubbles:!0,cancelable:!0,composed:!0}))}#V(J){if(J.target!==this.#Z||this.#O)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#O=!0,this.setAttribute("open",String(Q)),this.#O=!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.#W(Q)}focus(J){this.#Q?.focus(J)}}U("propskit-point-radius-angle",TJ);class FJ extends HTMLElement{static observedAttributes=["label","collapsible","open","size","units","disabled","value"];#Z=null;#Q=null;#J=null;#_=!1;#j=!1;#$=!1;#O=this.#F.bind(this,"input");#B=this.#F.bind(this,"change");#G=this.#W.bind(this);connectedCallback(){if(!this.#_)this.#Y(this.#M()),this.#_=!0;if(!this.#Z)this.#K();this.#P(),this.#L(),this.#U(),this.#S(),this.#T(this.#M()),this.removeEventListener("input",this.#O),this.addEventListener("input",this.#O),this.removeEventListener("change",this.#B),this.addEventListener("change",this.#B),this.removeEventListener("openchange",this.#G),this.addEventListener("openchange",this.#G)}disconnectedCallback(){this.removeEventListener("input",this.#O),this.removeEventListener("change",this.#B),this.removeEventListener("openchange",this.#G)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#_)return;if(J==="value"){if(!this.#j){let $=this.#Y(this.#M());this.#T($)}return}if(J==="size"){this.#L();return}if(J==="units"){this.#U();return}if(J==="disabled"){this.#S();return}this.#P()}#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)}}#M(){return this.#q(this.getAttribute("value"))}#Y(J){let Q=this.#q(J),Z=JSON.stringify(Q);if(this.getAttribute("value")===Z)return Q;return this.#j=!0,this.setAttribute("value",Z),this.#j=!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.#M(),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.#Q=Z,this.#J=$,this.#P(),this.#L(),this.#S(),Q.append(Z,$),this.replaceChildren(Q)}#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(){let J=this.getAttribute("size");for(let Q of[this.#Q,this.#J]){if(!Q)continue;if(J===null)Q.removeAttribute("size");else Q.setAttribute("size",J)}}#U(){for(let J of[this.#Q,this.#J]){if(!J)continue;if(this.hasAttribute("units"))J.setAttribute("units",this.units);else J.removeAttribute("units")}}#S(){l(this,[this.#Q,this.#J])}#T(J){let Q=this.#q(J);if(this.#Q)this.#Q.value={x:Q.x,y:Q.y};if(this.#J)this.#J.value={x:Q.x2,y:Q.y2}}#F(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(),Y(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;let X=this.#Y($);this.dispatchEvent(new CustomEvent(J,{detail:{...X,units:this.units},bubbles:!0,cancelable:!0,composed:!0}))}#W(J){if(J.target!==this.#Z||this.#$)return;J.stopImmediatePropagation();let Q=Boolean(J.detail?.open);this.#$=!0,this.setAttribute("open",String(Q)),this.#$=!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.#M()}}set value(J){let Q=this.#Y(J);this.#T(Q)}focus(J){this.#Q?.focus(J)}}U("propskit-point-point",FJ);class r extends HTMLElement{static observedAttributes=["name","open","show-reset","disabled","size"];static#Z=["propskit-color","propskit-fill","propskit-gradient","propskit-number","propskit-position","propskit-color-point","propskit-point-radius","propskit-point-radius-angle","propskit-point-point","propskit-select","propskit-slider","propskit-switch","propskit-text","propskit-wheel","propskit-oscillator"].join(",");#Q=null;#J=null;#_=null;#j=null;#$=0;#O=()=>this.#X();connectedCallback(){this.#V(),this.#P(),this.#L(),this.#B(),requestAnimationFrame(()=>{this.#T()})}disconnectedCallback(){if(this.#G(),this.#$)cancelAnimationFrame(this.#$),this.#$=0;this.#Q?.removeEventListener("click",this.#M),this.#Q?.removeEventListener("keydown",this.#Y),this.#_?.querySelector("fig-button")?.removeEventListener("click",this.#k)}attributeChangedCallback(J,Q,Z){if(Q===Z)return;if(J==="open"){this.#Q?.setAttribute("aria-expanded",String(this.open));return}if(J==="show-reset"){this.#H(),this.#T();return}if(J==="disabled"){this.#P();return}if(J==="size"){this.#L();return}this.#V()}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.#Q?.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.#W()}#B(){if(this.removeEventListener("input",this.#O,!0),this.removeEventListener("change",this.#O,!0),this.addEventListener("input",this.#O,!0),this.addEventListener("change",this.#O,!0),!this.#j)this.#j=new MutationObserver(()=>{this.#P(),this.#L(),this.#X()});this.#j.disconnect(),this.#j.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value","checked","default","x","y"]})}#G(){this.removeEventListener("input",this.#O,!0),this.removeEventListener("change",this.#O,!0),this.#j?.disconnect()}#X(){if(this.#$)return;this.#$=requestAnimationFrame(()=>{this.#$=0,this.#T()})}#q(J){return J instanceof Element&&Boolean(J.closest(".propskit-group-reset, .propskit-group-reset-tooltip"))}#M=(J)=>{if(Y(this,"disabled"))return;if(this.#q(J.target))return;J.stopPropagation(),this.open=!this.open};#Y=(J)=>{if(Y(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(),Y(this,"disabled"))return;this.#W()};#K(){return[...this.querySelectorAll(r.#Z)].filter((J)=>J.closest("propskit-group")===this&&!J.parentElement?.closest(r.#Z))}#P(){let J=Y(this,"disabled");for(let Q of this.#K())if(J){if(!Y(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.#Q?.setAttribute("aria-disabled",String(J)),this.#Q?.setAttribute("tabindex",J?"-1":"0"),this.#_?.querySelector("fig-button")?.toggleAttribute("disabled",J)}#L(){let J=this.getAttribute("size")==="small";for(let Q of this.#K()){let Z=Q.hasAttribute("data-propskit-group-size");if(J&&!Q.hasAttribute("size"))Q.setAttribute("data-propskit-group-size",""),Q.setAttribute("size","small");else if(J&&Z&&Q.getAttribute("size")!=="small")Q.setAttribute("size","small");else if(!J&&Z)Q.removeAttribute("size"),Q.removeAttribute("data-propskit-group-size")}}#U(J){return J.isDefault===!1}#S(){for(let J of this.#K())if(this.#U(J))return!0;return!1}#T(){if(this.#S())this.setAttribute("data-dirty","");else this.removeAttribute("data-dirty");this.#H()}#F(J){if(typeof J.resetToDefault==="function")J.resetToDefault()}#W(){for(let J of this.#K())this.#F(J);this.#T(),this.dispatchEvent(new CustomEvent("reset",{bubbles:!0,composed:!0}))}#H(){if(!this.showReset){this.#_?.setAttribute("hidden","");return}this.#z(),this.#_?.removeAttribute("hidden")}#z(){if(!this.#Q||!this.showReset)return;let J=this.#Q.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.#Q.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.#_=J}#V(){let Q=this.getAttribute("name")||"Group",Z=this.querySelector(":scope > fig-header");if(Z)this.#Q=Z;else if(!this.#Q||!this.#Q.dataset.generated||this.#Q.parentElement!==this)this.#Q=document.createElement("fig-header"),this.#Q.setAttribute("borderless",""),this.#Q.dataset.generated="true",this.prepend(this.#Q);let $=this.#Q.querySelector(":scope > h3"),j=this.#Q.querySelector(":scope > fig-button.propskit-group-disclosure");if(!$&&j){if($=j.querySelector(":scope > h3"),$)this.#Q.insertBefore($,j);j.remove()}if(!$)$=document.createElement("h3"),this.#Q.prepend($);let _=$.querySelector(":scope > button.propskit-group-disclosure");if(_){while(_.firstChild)$.insertBefore(_.firstChild,_);_.remove()}if(!$.id)$.id=_J("propskit-group");if(this.#Q.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.#Q.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.#Q.insertBefore(X,$),this.#J=X,this.#H(),this.#Q.setAttribute("role","button"),this.#P(),this.#Q.setAttribute("aria-expanded",String(this.open)),this.#Q.removeEventListener("click",this.#M),this.#Q.addEventListener("click",this.#M),this.#Q.removeEventListener("keydown",this.#Y),this.#Q.addEventListener("keydown",this.#Y),!this.hasAttribute("open"))this.setAttribute("open","false"),this.#Q.setAttribute("aria-expanded","false")}}U("propskit-group",r);class p extends HTMLElement{static#Z=4;static#Q="propskit-slider-dragging";static#J=null;#_=null;#j=null;#$=null;#O=!1;#B=null;#G=new Set;#X=0;#q=0;#M=0;#Y=null;#k=!0;#K=0;#P=1;#L=0;#U=null;#S=null;#T=0;#F=null;#W=null;#H=!1;#z=0;#V=null;#R=0;#D=null;#h=0;#I=null;#f=0;#c=0;#y=!1;#b=!1;#x=0;#E=null;#C=null;#e=this.#CJ.bind(this);#o=this.#RJ.bind(this);#A=this.#m.bind(this);#N=this.#HJ.bind(this);#jJ=this.#TJ.bind(this);#w=this.#MJ.bind(this);#u=this.#KJ.bind(this);#l=this.#fJ.bind(this);#i=this.#DJ.bind(this);#d=this.#WJ.bind(this);#p=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","direction"]}connectedCallback(){if(!this.#_)this.#kJ();if(this.#t(),this.#JJ(),this.#gJ(),this.#QJ(),this.#BJ(),this.#GJ(),this.removeEventListener("pointerdown",this.#e,{capture:!0}),this.addEventListener("pointerdown",this.#e,{capture:!0,passive:!0}),this.removeEventListener("pointerdown",this.#N,{capture:!0}),this.addEventListener("pointerdown",this.#N,{capture:!0}),this.removeEventListener("contextmenu",this.#l),this.addEventListener("contextmenu",this.#l),this.removeEventListener("click",this.#d,!0),this.addEventListener("click",this.#d,!0),this.#S?.removeEventListener("change",this.#i),this.#S?.addEventListener("change",this.#i),!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.#p.has($.attributeName))continue;if($.attributeName==="label"||$.attributeName==="direction")Q=!0;else Z=!0}if(Q)this.#t();if(Z)this.#JJ(),this.#QJ()});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.#M)cancelAnimationFrame(this.#M),this.#M=0;this.#Y?.disconnect(),this.#AJ(),this.#FJ(),clearTimeout(this.#x),this.#x=0,this.#YJ(),this.#zJ(),this.#r(),this.#cJ(),this.removeEventListener("pointerdown",this.#e,{capture:!0}),this.removeEventListener("pointerdown",this.#N,{capture:!0}),this.removeEventListener("contextmenu",this.#l),this.removeEventListener("click",this.#d,!0),this.#S?.removeEventListener("change",this.#i)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#_)return;if(J==="label"||J==="direction")this.#t()}#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")),$=document.createElement("fig-field"),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.#_=$,this.#j=j,this.#$=_,this.#O=Boolean(Z),this.replaceChildren($),this.#a();for(let X of Q){if(X===Z)continue;this.#$.appendChild(X)}}#a(){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.#i),this.#S=J,this.appendChild(J)}#t(){if(!this.#_||!this.#j)return;let J=this.hasAttribute("label"),Q=this.getAttribute("label");if(J&&(Q??"").trim()===""){if(this.#j.parentElement===this.#_)this.#j.remove()}else{if(!this.#O)this.#j.textContent=J?Q??"":"Label";if(this.#j.parentElement!==this.#_)this.#_.prepend(this.#j)}this.#_.setAttribute("direction",this.getAttribute("direction")||"horizontal"),this.#GJ()}#JJ(){if(!this.#$)return;let J=this.#OJ(),Q=new Set(J.filter(($)=>$!=="text"&&$!=="value"));for(let $ of this.#G)if(!Q.has($))this.#$.removeAttribute($);for(let $ of J){if($==="text"||$==="value")continue;let j=this.getAttribute($)??"";if(this.#$.getAttribute($)!==j)this.#$.setAttribute($,j)}this.#$.removeAttribute("variant"),this.#$.removeAttribute("color"),this.#$.removeAttribute("transform"),this.#$.removeAttribute("full"),this.#$.setAttribute("text","true");let Z=(this.getAttribute("type")||"range").toLowerCase();if(Z==="delta"){let $=Number(this.#$.min),j=Number(this.#$.max),_=Number.isFinite($)&&Number.isFinite(j)?$+(j-$)/2:0;this.#$.setAttribute("default",String(_))}else this.#$.removeAttribute("default");if(Z==="stepper")this.#$.setAttribute("step",this.getAttribute("step")??"10");else if(!this.hasAttribute("step"))this.#$.removeAttribute("step");if(Z==="opacity")this.#$.style.setProperty("--color",this.getAttribute("color")||"var(--figma-color-bg-secondary)");else this.#$.style.removeProperty("--color");this.#v(Z),this.#G=Q,this.#PJ(),this.#SJ(),this.#k=!0,this.#BJ(),this.#GJ()}#v(J){let Q=this.#$?.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.#$?.min),j=Number(this.#$?.max),_=Number(this.#$?.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))`,O=getComputedStyle(this).colorScheme.trim().toLowerCase()==="dark",G=RJ(this.#$,B,J==="hue"?0.35:O?0.2:0.35);if(G){Q?.setAttribute("theme",G);let M=G==="light"&&O||G==="dark"&&!O;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.#$)return;let J=Number(this.#$.min),Q=Number(this.#$.max),Z=Number(this.#$.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.#v((this.getAttribute("type")||"range").toLowerCase()),this.#GJ()}#BJ(){if(!globalThis.ResizeObserver)return;if(!this.#Y)this.#Y=new ResizeObserver(()=>{this.#k=!0,this.#GJ()});this.#Y.disconnect();for(let J of[this,this.#j,this.#$?.querySelector("fig-input-number"),this.#$?.querySelector("fig-input-number input"),this.#$?.querySelector('input[type="range"]')])if(J)this.#Y.observe(J)}#GJ(){if(this.#M)cancelAnimationFrame(this.#M);this.#M=requestAnimationFrame(()=>{this.#M=0,this.#qJ()})}#qJ(){let J=this.#$?.querySelector('input[type="range"]');if(!J||!this.#$)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.#XJ("--slider-thumb-width",this.#$)/2,this.#P=Math.max(1,this.#XJ("--propskit-slider-handle-fade-start-threshold")),this.#L=Math.min(this.#P,this.#XJ("--propskit-slider-handle-fade-end-threshold")),this.#k=!1;let q=this.#K,B=[],O=this.#j?.parentElement===this.#_?this.#LJ(this.#j):null,G=this.#$.querySelector("fig-input-number input"),M=G?this.#n(G):null;if(O?.width&&O.bottom>Q.top&&O.top<Q.bottom)B.push(X-q-O.right);if(M?.width&&M.bottom>Q.top&&M.top<Q.bottom)B.push(M.left-X-q);let k=this.#P,P=this.#L,N=B.length?Math.min(...B):k,S=Math.max(0.001,k-P),F=Math.max(0,Math.min(1,(N-P)/S));this.style.setProperty("--propskit-slider-handle-proximity",String(F))}#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-_}}#n(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),O=$.textAlign,G=_;if(O==="right"||O==="end")G=X-B;else if(O==="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(!p.#J)p.#J=document.createElement("canvas");let Z=p.#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.#$)return;let J=this.hasAttribute("value")?this.getAttribute("value")??"":this.#W??"";if(String(this.#$.value)!==J)this.#$.value=J;this.#NJ()}#OJ(){let J=new Set(["label","direction","oninput","onchange","steppers"]);return this.getAttributeNames().filter((Q)=>!J.has(Q)&&!this.#p.has(Q))}#SJ(){if(this.#X)cancelAnimationFrame(this.#X);this.#X=requestAnimationFrame(()=>{this.#X=0,this.#pJ(),this.#ZJ()})}#QJ(){if(this.#q)cancelAnimationFrame(this.#q);this.#q=requestAnimationFrame(()=>{this.#q=0,this.#ZJ()})}#ZJ(){let J=this.#$?.querySelector('input[type="range"]'),Q=this.#$?.querySelector("fig-input-number input");if(J!==this.#U)this.#UJ(J);if(J){J.removeAttribute("tabindex"),J.removeAttribute("aria-hidden");let Z=this.getAttribute("aria-label")||this.#j?.textContent?.trim()||"Slider";if(!J.hasAttribute("aria-label")&&!J.hasAttribute("aria-labelledby"))J.setAttribute("aria-label",Z)}if(Q)Q.removeAttribute("tabindex"),Q.removeAttribute("aria-hidden")}#WJ(J){if(Y(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.#s()}#s(){requestAnimationFrame(()=>{requestAnimationFrame(()=>{if(this.isConnected&&!Y(this,"disabled"))this.focus()})})}#UJ(J){if(this.#r(),this.#U=J,!this.#U)return;this.#U.addEventListener("dblclick",this.#u,{capture:!0})}#r(){if(!this.#U)return;this.#U.removeEventListener("dblclick",this.#u,{capture:!0}),this.#U=null}#KJ(J){J.preventDefault(),J.stopImmediatePropagation(),this.#xJ()}#HJ(J){if(J.button!==0||J.altKey||Y(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.#f=J.clientX,this.#c=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.#f,J.clientY-this.#c)<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.#$?.value,"change"),this.#b=!0,clearTimeout(this.#x),this.#x=window.setTimeout(()=>{this.#b=!1,this.#x=0},0),this.#s();return}this.#$?.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||Y(this,"disabled"))return;if(J.target?.closest?.("fig-input-number"))return;let Q=this.#$?.querySelector('input[type="range"]')??this.#U;if(!Q)return;this.#YJ(),this.#zJ(),this.#U=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.#V={left:Z.left,right:Z.right,width:Z.width},this.#R=$.width,window.addEventListener("pointermove",this.#o,{passive:!0}),window.addEventListener("pointerup",this.#A,{once:!0}),window.addEventListener("pointercancel",this.#A,{once:!0}),window.addEventListener("blur",this.#A,{once:!0})}#RJ(J){if(!this.#H)return;if(J.pointerId!==this.#D)return;if(J.buttons===0){this.#m(J);return}if(Math.abs(J.clientX-this.#h)>=p.#Z)this.#$J(!0);if(this.#z)this.#bJ(J.clientX)}#m(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.#s()}#YJ(){window.removeEventListener("pointermove",this.#o),window.removeEventListener("pointerup",this.#A),window.removeEventListener("pointercancel",this.#A),window.removeEventListener("blur",this.#A),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(p.#Q,J)}#fJ(J){if(Y(this,"disabled"))return;J.preventDefault(),J.stopPropagation(),J.stopImmediatePropagation(),this.#AJ(),this.#g(J.clientX,J.clientY)}#g(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.#S?.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.#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.#U;if(!Q)return this.#$?.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,O=Math.max(0,`${X}`.split(".")[1]?.length||0);return String(Number(B.toFixed(O)))}#yJ(){return this.getAttribute("default")??this.#W??this.#U?.min??"0"}#xJ(){this.#AJ(),this.#EJ(this.#yJ(),"input"),this.#EJ(this.#yJ(),"change")}#EJ(J,Q){if(!this.#$||J===null||J===void 0)return;this.#$.value=J,this.setAttribute("value",String(this.#$.value)),this.dispatchEvent(new CustomEvent(Q,{detail:this.#$.value,bubbles:!0,cancelable:!0,composed:!0}))}#pJ(){if(!this.#$)return;let J=this.#$.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.#$)return;if(!this.#E)this.#E=this.#hJ.bind(this,"input");if(!this.#C)this.#C=this.#hJ.bind(this,"change");this.#$.addEventListener("input",this.#E),this.#$.addEventListener("change",this.#C)}#cJ(){if(!this.#$)return;if(this.#E)this.#$.removeEventListener("input",this.#E);if(this.#C)this.#$.removeEventListener("change",this.#C)}#hJ(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;if(J==="change")this.#zJ();let Z=Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:this.#$?.value;if(this.#$?.value!==void 0){let $=String(this.#$.value);if(this.getAttribute("value")!==$)this.setAttribute("value",$)}this.#NJ(),this.dispatchEvent(new CustomEvent(J,{detail:Z,bubbles:!0,cancelable:!0,composed:!0}))}focus(J){this.#ZJ();let Q=this.#$?.querySelector('input[type="range"]');Q?.setAttribute("data-propskit-focus-called",""),Q?.focus(J)}get value(){return this.getAttribute("value")??this.#$?.value??""}set value(J){if(J===null||J===void 0||J===""){if(this.removeAttribute("value"),this.#$)this.#$.value="";return}let Q=String(J);if(this.setAttribute("value",Q),this.#$)this.#$.value=Q}get defaultValue(){return this.#yJ()}get isDefault(){return c(this.value,this.defaultValue)}resetToDefault(){this.#xJ()}}U("propskit-slider",p);class z extends HTMLElement{static#Z=33;static#Q=60;static#J=0.55;static#_=1.5;static#j=80;static#$=4;static#O="fig-input-wheel-dragging";#B=null;#G=null;#X=null;#q=null;#M=null;#Y=null;#k=null;#K=0;#P=0;#L=0;#U=0;#S=0;#T=null;#F=!1;#W=null;#H=0;#z=0;#V=!1;#R=null;#D=0;#h=null;#I=0;#f=0;#c=this.#qJ.bind(this);#y=this.#LJ.bind(this);#b=this.#_J.bind(this);#x=this.#KJ.bind(this);#E=this.#HJ.bind(this);static get observedAttributes(){return["value","disabled","step","min","max","spin"]}connectedCallback(){if(!this.#B)this.#C();if(this.#t(),this.#kJ(),this.#BJ(),this.#T?.disconnect(),globalThis.ResizeObserver)this.#T=new ResizeObserver((J)=>{let Q=J.at(-1)?.contentRect;if(Q)this.#JJ(Q.width,Q.height)}),this.#T.observe(this);this.#v()}disconnectedCallback(){if(this.#T?.disconnect(),this.#L)cancelAnimationFrame(this.#L);this.#L=0,this.#MJ(),this.#GJ(),this.#XJ()}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#B)return;if(J==="disabled")this.#t();if(J==="value"&&!this.#F)this.#kJ();if(J==="step")this.#a(),this.#v();if(J==="spin")this.#v();if(J==="min"||J==="max")this.#p(this.#N())}#C(){if(this.#B=this,this.#G=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=E("svg",{className:"fig-input-wheel-svg","aria-hidden":"true"}),Q=L("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.#e()}#e(){if(!this.#q||this.#M)return;this.#M=E("path",{className:"fig-input-wheel-tick"}),this.#q.append(this.#M)}#o(){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}#A(){if(this.hasAttribute("step")){let J=Number(this.getAttribute("step"));if(J>0)return J}return 1}#N(){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")}#u(){return this.#jJ("max")}#l(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))}#i(J){let Q=J,Z=this.#w(),$=this.#u();if(Z!==null)Q=Math.max(Z,Q);if($!==null)Q=Math.min($,Q);return Q}#d(J){let Q=this.#A();if(Q<=0)return J;let Z=this.#w()??0,$=Math.round((J-Z)/Q)*Q+Z;return Number($.toPrecision(15))}#p(J,{snap:Q=!1,emit:Z=null}={}){let $=Q?this.#d(J):J;$=this.#i($);let j=String($);if(this.getAttribute("value")!==j)this.setAttribute("value",j);if(this.#a($),this.#v(),Z)this.dispatchEvent(new CustomEvent(Z,{detail:$,bubbles:!0,cancelable:!0,composed:!0}))}#kJ(){let J=this.#N(),Q=this.#i(J);if(Q!==J||this.getAttribute("value")!==String(Q)){this.#p(Q);return}this.#a(J),this.#v()}#a(J=this.#N()){if(!this.#X)return;let Q=this.#w(),Z=this.#u();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=Y(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")}#JJ(J,Q){if(!this.#q||J<1||Q<1)return;if(J===this.#K&&Q===this.#P)return;this.#K=J,this.#P=Q,this.#Y=null,this.#q.setAttribute("viewBox",`0 0 ${J} ${Q}`),this.#q.setAttribute("width",String(J)),this.#q.setAttribute("height",String(Q)),this.#v()}#v(){if(this.#L)return;this.#L=requestAnimationFrame(()=>{if(!this.isConnected){this.#L=0;return}if(this.#K<1||this.#P<1){let J=this.#X?.getBoundingClientRect();if(J)this.#JJ(J.width,J.height)}this.#NJ(),this.#L=0})}#NJ(){if(!this.#M)return;let J=this.#K,Q=this.#P;if(J<1||Q<1)return;let Z=this.getAttribute("spin")==="false"?this.#w()??0:this.#R??this.#N(),$=360/z.#Z,j=this.#A(),_=this.#w()??0,X=(Z-_)/j*$,q=z.#J,B=J/2,O=Q/2,{maxH:G,minH:M,maxW:k,minW:P}=this.#o(),N=z.#Q,S=Math.max(J/2,1),F=S*0.84,R=[];for(let W=0;W<z.#Z;W+=1){let T=X+W*$;if(T=((T+180)%360+360)%360-180,T<-N||T>=N)continue;let V=T*Math.PI/180,H=B+F*Math.sin(V)/(1-q*Math.cos(V)),C=Math.min(1,Math.abs(H-B)/Math.max(S,1)),I=Math.cos(C*Math.PI*0.5),A=M+(G-M)*I,d=P+(k-P)*I,o=A/2,b=d/2,y=O-o,m=O+o,i=H-b,a=H+b;R.push(`M ${H} ${y} Q ${a} ${y} ${a} ${y+b} V ${m-b} Q ${a} ${m} ${H} ${m} Q ${i} ${m} ${i} ${m-b} V ${y+b} Q ${i} ${y} ${H} ${y} Z`)}this.#M.setAttribute("d",R.join(" "))}#BJ(){this.#B?.addEventListener("pointerdown",this.#c),this.#X?.addEventListener("wheel",this.#x,{passive:!1}),this.#X?.addEventListener("keydown",this.#E)}#GJ(){this.#B?.removeEventListener("pointerdown",this.#c),this.#X?.removeEventListener("wheel",this.#x),this.#X?.removeEventListener("keydown",this.#E),window.removeEventListener("pointermove",this.#y),window.removeEventListener("pointerup",this.#b),window.removeEventListener("pointercancel",this.#b)}#qJ(J){if(Y(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(Y(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.#i(Z):this.#N(),this.#V=!1,this.#WJ(Q),this.#PJ(),this.setAttribute("data-fig-input-wheel-active",""),document.body.classList.remove(z.#O),this.focus(),!0}updateScrub(J,Q){if(!this.#F)return this.#N();let Z=typeof J==="number"?J:Number(J?.clientX??J?.x);if(!Number.isFinite(Z))return this.#N();let $=Q??(typeof J==="object"&&J?.shiftKey?10:1);return this.#n(Z,$),this.#N()}endScrub(J=!0){if(!this.#F)return this.#N();if(J&&this.#N()!==this.#z)this.#p(this.#N(),{snap:!0,emit:"change"});return this.#XJ(),this.#N()}#LJ(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)>=z.#$)this.#V=!0,document.body.classList.add(z.#O);let Z=this.#X?.clientWidth||1,$=z.#Z*(z.#Q*2/360),j=this.#A()*$,_=(J-this.#H)*(j/Z)*Q,X=this.#R??this.#z,q=this.#i(this.#z+_);this.#s(J,Q,q!==X),this.#R=q,this.#p(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.#V=!1,this.#R=null,this.removeAttribute("data-fig-input-wheel-active"),document.body.classList.remove(z.#O),this.#UJ(),this.#QJ(),window.removeEventListener("pointermove",this.#y),window.removeEventListener("pointerup",this.#b),window.removeEventListener("pointercancel",this.#b),this.#v()}#PJ(){this.#QJ(),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`)}#QJ(){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()}#s(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<z.#_){this.#r();return}this.toggleAttribute("data-fig-input-wheel-fast",!0),clearTimeout(this.#f),this.#f=window.setTimeout(()=>{this.#r()},z.#j)}#UJ(){this.#h=null,this.#I=0,this.#r()}#r(){clearTimeout(this.#f),this.#f=0,this.removeAttribute("data-fig-input-wheel-fast")}#KJ(J){if(Y(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.#p(this.#N()+this.#A()*Z*Q,{snap:!0,emit:"input"}),this.#p(this.#N(),{emit:"change"})}#HJ(J){if(Y(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.#p(_,{snap:!0,emit:"input"}),this.#p(this.#N(),{emit:"change"});return}if(J.key==="End"){let _=this.#u();if(_===null)return;J.preventDefault(),this.#p(_,{snap:!0,emit:"input"}),this.#p(this.#N(),{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.#N();this.#p(j+this.#A()*$*Z,{snap:!0,emit:"input"}),this.#TJ(j,this.#N(),Z,$),this.#p(this.#N(),{emit:"change"})}#TJ(J,Q,Z,$,j=!0){if(J===Q||globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches){this.#MJ();return}if(this.#U)cancelAnimationFrame(this.#U),this.#U=0;clearTimeout(this.#S),this.#S=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(),O=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,O){let P=Math.sin(k*Math.PI/2),N=X+(Z*4-X)*P;this.style.setProperty("--fig-input-wheel-handle-drag-offset",`${N}px`)}if(this.#NJ(),k<1){this.#U=requestAnimationFrame(G);return}this.#U=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.#S=window.setTimeout(()=>{this.removeAttribute("data-fig-input-wheel-keyboard-settling"),this.#S=0},140),this.#v()};this.#U=requestAnimationFrame(G)}#MJ(){if(this.#U)cancelAnimationFrame(this.#U),this.#U=0;if(clearTimeout(this.#S),this.#S=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.#v()}get value(){return this.getAttribute("value")??"0"}set value(J){if(J===null||J===void 0||J===""){this.#p(0);return}let Q=Number(J);this.#p(Number.isFinite(Q)?Q:0)}spinTo(J,{animateHandle:Q=!1}={}){let Z=this.#N();this.value=J;let $=this.#N();if(this.getAttribute("spin")==="false")return this.#MJ(),$;let j=Math.sign($-Z);return this.#TJ(Z,$,j,Math.abs($-Z)>this.#A()?10:1,Q),$}get min(){return this.#w()}set min(J){this.#l("min",J)}get max(){return this.#u()}set max(J){this.#l("max",J)}get step(){return this.#A()}focus(J){HTMLElement.prototype.focus.call(this,J)}}U("fig-input-wheel",z);class v extends HTMLElement{static#Z=new Set(["label","size","disabled","variant","elastic","spin","text","default","class","style","id","oninput","onchange"]);static get observedAttributes(){return["label","units","value","disabled","step","precision","min","max","elastic","spin","text"]}#Q=null;#J=null;#_=null;#j=null;#$=!1;#O=null;#B=new Set;#G=null;#X=null;#q=0;#M=null;#Y=0;#k=null;#K=null;#P=0;#L=0;#U=0;#S=!1;#T=!1;#F=0;#W=!1;#H=this.#v.bind(this,"input");#z=this.#v.bind(this,"change");#V=this.#NJ.bind(this,"input");#R=this.#NJ.bind(this,"change");#D=this.#BJ.bind(this);#h=this.#WJ.bind(this);#I=this.#s.bind(this);#f=this.#UJ.bind(this);#c=this.#GJ.bind(this);#y=this.#qJ.bind(this);#b=this.#LJ.bind(this);#x=this.#XJ.bind(this);#E=this.#PJ.bind(this);#C=this.#KJ.bind(this);connectedCallback(){if(!this.#Q)this.#e();this.#o(),this.#A(),this.#jJ(),this.#p(),this.#kJ(),f(this),this.#O?.disconnect(),this.#O=new MutationObserver((J)=>{if(J.some(({type:Q,attributeName:Z})=>Q==="attributes"&&Z&&!v.#Z.has(Z)&&!v.observedAttributes.includes(Z)&&!Z.startsWith("data-")))this.#p()}),this.#O.observe(this,{attributes:!0})}disconnectedCallback(){this.#O?.disconnect(),this.#n(),this.#QJ(),this.#a(),this.#r(),clearTimeout(this.#F),this.#F=0,this.#J?.endScrub(!1),D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z||!this.#Q)return;if(J==="label")this.#o();if(J==="text")this.#A();if(J==="elastic"&&Z==="false")this.#QJ();if(["units","value","disabled","step","min","max","elastic","spin"].includes(J))this.#jJ();if(["units","value","disabled","step","precision","min","max"].includes(J))this.#p()}#e(){this.#G=this.getAttribute("value")??"0";let J=Array.from(this.childNodes).filter((q)=>q.nodeType!==Node.TEXT_NODE||Boolean(q.textContent?.trim())),Q=J.find((q)=>q.nodeType===Node.ELEMENT_NODE&&q.matches("label")),Z=L("div",{className:"propskit-wheel-surface"}),$=Q||document.createElement("label"),j=document.createElement("fig-input-wheel"),_=document.createElement("fig-input-number"),X=_J("propskit-wheel-label");$.id=X,j.setAttribute("aria-labelledby",X),_.setAttribute("aria-labelledby",X),Z.append($,j,_),this.#Q=Z,this.#J=j,this.#_=$,this.#j=_,this.#$=Boolean(Q),this.replaceChildren(Z);for(let q of J)if(q!==Q)_.appendChild(q)}#o(){if(!this.#_)return;if(!this.#$)this.#_.textContent=this.hasAttribute("label")?this.getAttribute("label")??"":"Value";this.toggleAttribute("data-label-empty",!(this.#_.textContent??"").trim())}#A(){if(!this.#Q||!this.#j)return;let J=this.getAttribute("text")!=="false",Q=this.#j.parentElement===this.#Q;if(J&&!Q)this.#Q.append(this.#j);else if(!J&&Q)this.#j.remove()}#N(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 Q of["min","max","spin"])this.#N(Q);if(this.hasAttribute("step"))this.#N("step");else this.#J.setAttribute("step",String(this.#l()));this.#J.toggleAttribute("disabled",Y(this,"disabled")),this.#J.value=this.getAttribute("value")??"0";let J=this.#J.value;if(this.getAttribute("value")!==J)this.setAttribute("value",J);if(this.#j?.getAttribute("value")!==J)this.#j?.setAttribute("value",J);this.#d()}#w(){return this.getAttributeNames().filter((J)=>!v.#Z.has(J)&&!v.observedAttributes.includes(J)&&!J.startsWith("data-"))}#u(){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}#l(){let J=this.#u();if(J==="s")return 0.1;if(J==="ms")return 100;return 1}#i(){return this.#u()==="s"?2:0}#d(){if(!this.#J)return;let J=Number(this.#J.value),Q=this.#u();this.#J.setAttribute("aria-valuetext",Q?`${J} ${Q==="s"?"seconds":Q==="ms"?"milliseconds":Q}`:String(J))}#p(){if(!this.#j||!this.#J)return;let J=this.#w(),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.#u();if(Z)this.#j.setAttribute("units",Z);else this.#j.removeAttribute("units");if(this.#j.setAttribute("step",String(this.#J.step)),this.hasAttribute("precision"))this.#j.setAttribute("precision",this.getAttribute("precision")??"");else this.#j.setAttribute("precision",String(this.#i()));for(let $ of["min","max"]){let j=this.#J[$];if(j===null)this.#j.removeAttribute($);else this.#j.setAttribute($,String(j))}this.#j.toggleAttribute("disabled",Y(this,"disabled")),this.#j.setAttribute("value",this.#J.value),this.#B=Q}#kJ(){this.#a(),this.#J?.addEventListener("input",this.#H),this.#J?.addEventListener("change",this.#z),this.#j?.addEventListener("input",this.#V),this.#j?.addEventListener("change",this.#R),this.#j?.addEventListener("keydown",this.#D,{capture:!0}),this.addEventListener("pointerdown",this.#c,{capture:!0}),this.addEventListener("pointerdown",this.#h,{capture:!0}),this.addEventListener("click",this.#C,!0)}#a(){this.#J?.removeEventListener("input",this.#H),this.#J?.removeEventListener("change",this.#z),this.#j?.removeEventListener("input",this.#V),this.#j?.removeEventListener("change",this.#R),this.#j?.removeEventListener("keydown",this.#D,{capture:!0}),this.removeEventListener("pointerdown",this.#c,{capture:!0}),this.removeEventListener("pointerdown",this.#h,{capture:!0}),this.removeEventListener("click",this.#C,!0)}#t(J,{spin:Q=!1,animateHandle:Z=!1}={}){let $=Number(J);if(!this.#J){let X=Number.isFinite($)?$:0;return this.setAttribute("value",String(X)),X}let j=Number.isFinite($)?$:0;if(Q)this.#J.spinTo(j,{animateHandle:Z});else this.#J.value=j;let _=this.#J.value;if(this.getAttribute("value")!==_)this.setAttribute("value",_);if(this.#j?.getAttribute("value")!==_)this.#j?.setAttribute("value",_);return this.#d(),Number(_)}#JJ(J,Q){this.dispatchEvent(new CustomEvent(J,{detail:Q,bubbles:!0,cancelable:!0,composed:!0}))}#v(J,Q){Q.stopImmediatePropagation();let Z=this.#t(Q.detail);this.#JJ(J,Z)}#NJ(J,Q){if(Q.stopImmediatePropagation(),Y(this,"disabled"))return;let Z=Q instanceof CustomEvent&&Q.detail!==void 0?Q.detail:this.#j?.value,$=this.#t(Z,{spin:J==="input",animateHandle:J==="input"&&this.#W});if(J==="input")this.#W=!1;this.#JJ(J,$)}#BJ(J){this.#W=!Y(this,"disabled")&&(J.key==="ArrowUp"||J.key==="ArrowDown"),window.setTimeout(()=>{this.#W=!1},0)}#GJ(J){if(J.button!==0||Y(this,"disabled")||!(J.target instanceof Element)||J.target.closest("fig-input-number")||J.target.closest(".propskit-wheel-surface")!==this.#Q)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.#_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.#n(),this.#QJ()}#n(){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.#QJ(),this.getAttribute("elastic")==="false")return;this.#X=J,this.#q=this.#SJ("--propskit-wheel-elastic-distance");let Q=this.getBoundingClientRect();if(Q)this.#M={left:Q.left,right:Q.right};this.#Y=this.getBoundingClientRect().width,window.addEventListener("pointermove",this.#x,{passive:!0}),window.addEventListener("pointerup",this.#E),window.addEventListener("pointercancel",this.#E),window.addEventListener("blur",this.#E)}#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.#QJ()}#OJ(J){let Q=this.#M;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.#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}#QJ(){window.removeEventListener("pointermove",this.#x),window.removeEventListener("pointerup",this.#E),window.removeEventListener("pointercancel",this.#E),window.removeEventListener("blur",this.#E),this.#X=null,this.#q=0,this.#M=null,this.#Y=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||Y(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.#r(),this.#K=J.pointerId,this.#P=J.clientX,this.#L=J.clientY,this.#U=Number(this.#J?.value??0),window.addEventListener("pointermove",this.#I),window.addEventListener("pointerup",this.#f,{once:!0}),window.addEventListener("pointercancel",this.#f,{once:!0}),window.addEventListener("blur",this.#f,{once:!0})}#s(J){if(J.pointerId!==this.#K)return;if(J.buttons===0){this.#UJ(J);return}if(!this.#S){if(Math.hypot(J.clientX-this.#P,J.clientY-this.#L)<4)return;this.#S=!0,this.setAttribute("data-number-scrubbing",""),this.#_J(J.pointerId),this.#J?.beginScrub({clientX:this.#P,pointerId:J.pointerId,startValue:this.#U})}this.#J?.updateScrub(J),this.#OJ(J.clientX)}#UJ(J){if(J?.pointerId!==void 0&&this.#K!==null&&J.pointerId!==this.#K)return;let Q=this.#S;if(this.#QJ(),this.#r(),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.#j?.querySelector("input")?.focus()}#r(){window.removeEventListener("pointermove",this.#I),window.removeEventListener("pointerup",this.#f),window.removeEventListener("pointercancel",this.#f),window.removeEventListener("blur",this.#f),this.#K=null,this.#S=!1,this.removeAttribute("data-number-scrubbing")}#KJ(J){if(Y(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 this.getAttribute("value")??this.#J?.value??"0"}set value(J){let Q=Number(J);this.#t(Number.isFinite(Q)?Q:0)}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.#G??"0"}get isDefault(){return c(this.value,this.defaultValue)}resetToDefault(){let J=Number(this.defaultValue),Q=this.#t(Number.isFinite(J)?J:0);g(this,Q)}focus(J){this.#J?.focus(J)}}U("propskit-wheel",v);class zJ extends HTMLElement{static observedAttributes=["type","value","color","name","tooltips","disabled","drag-surface","snapping","precision"];#Z=50;#Q=50;#J=75;#_=75;#j=0;#$=!1;#O=0;#B=null;#G=null;#X=null;#q=null;#M=null;#Y=null;#k=null;#K=null;#P=null;#L=!1;#U=!1;#S=!1;#T=!1;#F=null;#W="";#H="";#z=null;#V=null;#R=null;#D="";#h="";#I=null;#f=null;#c=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#E(){return this.#y==="point-point"}get#C(){return this.#y==="point-radius-angle"||this.#y==="point-point"}get#e(){let J=this.getAttribute("tooltips");return J===null||J!=="false"}get#o(){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#A(){let J=Number(this.getAttribute("precision")??2);if(!Number.isFinite(J))return 2;return Math.max(0,Math.min(8,Math.trunc(J)))}#N(J){let Q=10**this.#A,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.#G]){if(!Q)continue;if(J===null)Q.removeAttribute("precision");else Q.setAttribute("precision",String(this.#A))}}#w(J){let Q=this.#o;if(Q==="true")return!0;if(Q==="modifier")return!!J;return!1}get#u(){let J=this.getAttribute("name");if(J)return J.split(",")[0].trim();return`${this.#N(this.#Z)}%, ${this.#N(this.#Q)}%`}get#l(){let J=this.getAttribute("name");if(J){let Q=J.split(",");if(Q.length>1)return Q[1].trim()}return`${this.#N(this.#J)}%, ${this.#N(this.#_)}%`}get#i(){return this.getAttribute("drag-surface")||"parent"}get#d(){let J=this.#i;if(J==="parent")return this.parentElement;return this.closest(J)}get#p(){let J=this.#i;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.#$)return this.#j/100*J;return this.#j}#a(){let J=this.#N(this.#j);if(this.#$)return`Radius ${J}%`;return`Radius ${J}`}connectedCallback(){this.#t(),this.#JJ()}disconnectedCallback(){this.#VJ(),this.#bJ(),this.#BJ(),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.#L&&!this.#U&&!this.#S&&!this.#T)if(this.#t(),this.#B)this.#m();else this.#JJ();if(J==="type")this.#VJ(),this.#t(),this.#JJ();if(J==="color"&&this.#B)if(Z)this.#B.setAttribute("color",Z);else this.#B.removeAttribute("color");if(J==="disabled")this.#VJ(),this.#JJ();if(J==="tooltips")this.#JJ();if(J==="snapping"&&this.#B){if(this.#B.setAttribute("drag-snapping",Z||"false"),this.#G)this.#G.setAttribute("drag-snapping",Z||"false")}if(J==="precision"){if(!this.isConnected)return;this.#jJ(),this.#Z=this.#N(this.#Z),this.#Q=this.#N(this.#Q),this.#J=this.#N(this.#J),this.#_=this.#N(this.#_),this.#j=this.#N(this.#j),this.#O=this.#N(this.#O),this.#m(),this.#g()}if(J==="name"){if(this.#Y)this.#Y.setAttribute("text",this.#u);if(this.#k)this.#k.setAttribute("text",this.#l)}}#t(){let J=this.getAttribute("value");if(!J)return;try{let Q=JSON.parse(J);if(typeof Q.x==="number")this.#Z=this.#N(Q.x);if(typeof Q.y==="number")this.#Q=this.#N(Q.y);if(Q.radius!==void 0){let Z=String(Q.radius);if(Z.endsWith("%"))this.#$=!0,this.#j=this.#N(parseFloat(Z));else this.#$=!1,this.#j=this.#N(parseFloat(Z));if(!Number.isFinite(this.#j))this.#j=0}if(typeof Q.angle==="number")this.#O=this.#N(Q.angle);if(typeof Q.x2==="number")this.#J=this.#N(Q.x2);if(typeof Q.y2==="number")this.#_=this.#N(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.#N(this.#Z),y:this.#N(this.#Q)};if(this.#y==="color"){let Q=this.getAttribute("color")||this.#B?.getAttribute("color");if(Q)J.color=Q}if(this.#b){let Q=this.#N(this.#j);J.radius=this.#$?`${Q}%`:Q}if(this.#x)J.angle=this.#N(this.#O);if(this.#E)J.x2=this.#N(this.#J),J.y2=this.#N(this.#_);return J}set value(J){if(typeof J==="object")this.setAttribute("value",JSON.stringify(J));else if(typeof J==="string")this.setAttribute("value",J)}#JJ(){this.#VJ(),this.replaceChildren(),this.#B=null,this.#G=null,this.#X=null,this.#q=null,this.#M=null,this.#Y=null,this.#k=null,this.#K=null,this.#P=null;let J=Y(this,"disabled"),Q=this.#y,Z=this.#e,$=this.#p,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.#o),j.setAttribute("value",`${this.#Z}% ${this.#Q}%`),this.hasAttribute("precision"))j.setAttribute("precision",String(this.#A));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.#E)j.setAttribute("hit-area","12 circle"),j.setAttribute("hit-area-mode","delegate");if(this.#B=j,this.#b)this.#QJ();if(this.#C)this.#ZJ();if(Z){let _=document.createElement("fig-tooltip");_.setAttribute("action","manual"),_.setAttribute("theme","canvas"),_.setAttribute("pointer","false"),_.setAttribute("text",this.#u),_.appendChild(j),this.appendChild(_),this.#Y=_}else this.appendChild(j);if(this.#x)this.#s(J,Z,$);if(this.#E)this.#UJ(J,Z,$);this.#v(this.#B),this.#v(this.#X),this.#v(this.#G),this.#DJ(),this.#PJ(),requestAnimationFrame(()=>this.#m())}#v(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(Y(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.#O;if(!this.#E)return 0;let Q=this.#FJ();return J===this.#B?Q+180:Q}#qJ(){if(this.#V===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(Y(this,"disabled"))return;if(J?.button!==void 0&&J.button!==0)return;if(J?.isPrimary===!1)return;if(this.#V===null)this.#D=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.#qJ(),!this.#I)this.#I=(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.#I),window.addEventListener("pointercancel",this.#I),window.addEventListener("blur",this.#I)}#n(){if(this.#V===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.#V=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.#L||this.#U||this.#S||this.#T}#PJ(){if(this.#B)this.#_J(this.#B,()=>this.#Y,()=>this.#u,()=>this.#XJ()||!!this.#B?.querySelector("fig-color-tip"));if(this.#X)this.#_J(this.#X,()=>this.#P,()=>`Angle ${this.#N(this.#O)}°`,()=>this.#XJ());if(this.#G)this.#_J(this.#G,()=>this.#k,()=>this.#l,()=>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.#Y)new MutationObserver(()=>{if(this.#B?.querySelector("fig-color-tip"))this.#Y?.removeAttribute("show"),this.#Y?.hidePopup?.()}).observe(this.#B,{childList:!0,subtree:!0})}#OJ(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.#a()),Z.setAttribute("show","true"),Z.showPopup?.(),this.#OJ(Q.clientX,Q.clientY)}),J.addEventListener("pointermove",(Q)=>{if(this.#S)return;this.#OJ(Q.clientX,Q.clientY)}),J.addEventListener("pointerleave",()=>{if(this.#S)return;let Q=this.#K;if(!Q)return;Q.removeAttribute("show")})}#QJ(){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.#e){let _=document.createElement("fig-tooltip");_.setAttribute("action","manual"),_.setAttribute("theme","canvas"),_.setAttribute("pointer","false"),_.setAttribute("text",this.#a()),_.appendChild(Q),this.appendChild(_),this.#K=_}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.#E){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.#M=Q,this.appendChild(Q)}#WJ(J){J.addEventListener("pointerdown",(Q)=>{if(Y(this,"disabled"))return;Q.preventDefault(),Q.stopPropagation();let Z=this.#d;if(!Z)return;let{clientX:$,clientY:j}=Q,_=this.#Z,X=this.#Q,q=this.#J,B=this.#_;this.#L=!0,this.#U=!0,document.body.classList.add("fig-lab-move-active"),J.style.pointerEvents="none";let O=(M)=>{let k=Z.getBoundingClientRect(),P=k.width>0?(M.clientX-$)/k.width*100:0,N=k.height>0?(M.clientY-j)/k.height*100:0,S=-Math.min(_,q),F=100-Math.max(_,q),R=-Math.min(X,B),W=100-Math.max(X,B),T=Math.max(S,Math.min(F,P)),V=Math.max(R,Math.min(W,N));this.#Z=this.#N(_+T),this.#Q=this.#N(X+V),this.#J=this.#N(q+T),this.#_=this.#N(B+V),this.#m(),this.#YJ()},G=this.#zJ((M)=>{if(document.body.classList.remove("fig-lab-move-active"),J.style.pointerEvents="stroke",this.#L=!1,this.#U=!1,M)this.#g(),this.#$J()});window.addEventListener("pointermove",O,{signal:G.signal}),window.addEventListener("pointerup",()=>G.finish(!0),{signal:G.signal}),window.addEventListener("pointercancel",()=>G.finish(!1),{signal:G.signal})})}#s(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.#A));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.#N(this.#O)}°`),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.#o),$.setAttribute("hit-area","12 circle"),$.setAttribute("hit-area-mode","delegate"),$.setAttribute("value",`${this.#J}% ${this.#_}%`),this.hasAttribute("precision"))$.setAttribute("precision",String(this.#A));if(J)$.setAttribute("disabled","");if(this.#G=$,Q){let j=document.createElement("fig-tooltip");j.setAttribute("action","manual"),j.setAttribute("theme","canvas"),j.setAttribute("pointer","false"),j.setAttribute("text",this.#l),j.appendChild($),this.appendChild(j),this.#k=j}else this.appendChild($)}#r(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.#O)}#FJ(){return Math.atan2(this.#_-this.#Q,this.#J-this.#Z)*180/Math.PI}#CJ(){if(!this.#E)return;let J=this.#FJ();this.#B?.style.removeProperty("cursor"),this.#G?.style.removeProperty("cursor"),this.#TJ(this.#B,J+180),this.#TJ(this.#G,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`}#m(){let J=this.#d;if(!J||!this.#B)return;let Q=J.getBoundingClientRect();if(this.#RJ(this.#B,this.#Z,this.#Q,Q),this.#q){let Z=this.#Z/100*Q.width,$=this.#Q/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.#M&&this.#C){let Z=this.#Z/100*Q.width,$=this.#Q/100*Q.height,j,_;if(this.#E)j=this.#J/100*Q.width,_=this.#_/100*Q.height;else{let B=this.#kJ(Q.width),O=this.#O*Math.PI/180;j=Z+B*Math.cos(O),_=$+B*Math.sin(O)}let X=this.#M;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.#Q/100*Q.height,j=this.#kJ(Q.width),_=this.#O*Math.PI/180,X=Z+j*Math.cos(_),q=$+j*Math.sin(_),B=Q.width>0?X/Q.width*100:0,O=Q.height>0?q/Q.height*100:0;this.#RJ(this.#X,B,O,Q)}if(this.#G&&this.#E)this.#RJ(this.#G,this.#J,this.#_,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,...HJ(J.color,J.alpha,J.opacity)}}#g(){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.#L=!0;let Q=J.detail?.px??this.#Z/100,Z=J.detail?.py??this.#Q/100;if(this.#Z=this.#N(Math.max(0,Math.min(100,Q*100))),this.#Q=this.#N(Math.max(0,Math.min(100,Z*100))),this.#Y)this.#Y.removeAttribute("show"),this.#Y.hidePopup?.();this.#m(),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.#Q/100;if(this.#Z=this.#N(Math.max(0,Math.min(100,Q*100))),this.#Q=this.#N(Math.max(0,Math.min(100,Z*100))),this.#Y)this.#Y.removeAttribute("show");this.#m(),this.#g(),this.#$J(),requestAnimationFrame(()=>{this.#L=!1})}),this.#X)this.#X.addEventListener("input",(J)=>{J.stopPropagation();let Q=this.#d;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.#Q/100*Z.height,_=J.detail?.x??0,X=J.detail?.y??0,q=this.#X.offsetWidth/2,B=this.#X.offsetHeight/2,O=_+q-$,G=X+B-j,M=Math.atan2(G,O)*180/Math.PI;if(this.#w(J.detail?.shiftKey))M=Math.round(M/15)*15;this.#O=this.#N(M);let k=Math.sqrt(O*O+G*G);if(this.#w(J.detail?.shiftKey)){let P=this.#$?5:10;if(this.#$){let N=k/Z.width*100;N=Math.round(N/P)*P,k=N/100*Z.width}else k=Math.round(k/P)*P}if(this.#$)this.#j=this.#N(Math.max(0,k/Z.width*100));else this.#j=this.#N(Math.max(0,k));if(this.#P)this.#P.setAttribute("text",`Angle ${this.#N(this.#O)}°`),this.#P.setAttribute("show","true"),this.#P.showPopup?.();this.#m(),this.#YJ()}),this.#X.addEventListener("change",(J)=>{if(J.stopPropagation(),this.classList.remove("fig-canvas-control-ring-active"),this.#P)this.#P.removeAttribute("show");this.#m(),this.#g(),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.#d;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.#Z/100*X.width,B=this.#Q/100*X.height,O=_.clientX-X.left-q,G=_.clientY-X.top-B,M=Math.atan2(G,O)*180/Math.PI;if(this.#w(_.shiftKey))M=Math.round(M/15)*15;if(this.#O=this.#N(M),this.#P)this.#P.setAttribute("text",`Angle ${this.#N(M)}°`);this.#m(),this.#YJ()},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.#g(),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.#G)this.#G.addEventListener("input",(J)=>{J.stopPropagation(),this.#U=!0;let Q=J.detail?.px??this.#J/100,Z=J.detail?.py??this.#_/100;if(this.#J=this.#N(Math.max(0,Math.min(100,Q*100))),this.#_=this.#N(Math.max(0,Math.min(100,Z*100))),this.#k)this.#k.removeAttribute("show"),this.#k.hidePopup?.();this.#m(),this.#YJ()}),this.#G.addEventListener("change",(J)=>{if(J.stopPropagation(),this.#k)this.#k.removeAttribute("show");this.#m(),this.#g(),this.#$J(),requestAnimationFrame(()=>{this.#U=!1})}),this.#AJ(this.#B,!0),this.#AJ(this.#G,!1)}#AJ(J,Q){if(!J)return;J.addEventListener("hitareadown",(Z)=>{Z.stopPropagation();let $=Z.detail?.originalEvent;if(!$)return;$.preventDefault();let j=this.#d;if(!j)return;this.#L=!0;let _=j.getBoundingClientRect(),X=Q?this.#J:this.#Z,q=Q?this.#_:this.#Q,B=Q?this.#Z:this.#J,O=Q?this.#Q:this.#_,G=X/100*_.width,M=q/100*_.height,k=B/100*_.width,P=O/100*_.height,N=Math.sqrt((k-G)**2+(P-M)**2),S=Q?this.#Y:this.#k;if(S)S.removeAttribute("show"),S.hidePopup?.();let F=(W)=>{let T=j.getBoundingClientRect(),V=X/100*T.width,H=q/100*T.height,C=W.clientX-T.left-V,I=W.clientY-T.top-H,A=Math.atan2(I,C);if(this.#w(W.shiftKey))A=Math.round(A*180/Math.PI/15)*15*Math.PI/180;let d=V+N*Math.cos(A),o=H+N*Math.sin(A),b=Math.max(0,Math.min(100,d/T.width*100)),y=Math.max(0,Math.min(100,o/T.height*100));if(Q)this.#Z=this.#N(b),this.#Q=this.#N(y);else this.#J=this.#N(b),this.#_=this.#N(y);this.#m(),this.#YJ()},R=this.#zJ((W)=>{if(this.#L=!1,S)S.removeAttribute("show");if(W)this.#g(),this.#$J()});window.addEventListener("pointermove",F,{signal:R.signal}),window.addEventListener("pointerup",()=>R.finish(!0),{signal:R.signal}),window.addEventListener("pointercancel",()=>R.finish(!1),{signal:R.signal})})}#IJ(J){if(!J)return;J.addEventListener("pointermove",(Z)=>{if(this.#S)return;let $=this.#d;if(!$)return;let j=$.getBoundingClientRect(),_=this.#Z/100*j.width,X=this.#Q/100*j.height,q=Math.atan2(Z.clientY-j.top-X,Z.clientX-j.left-_)*180/Math.PI;this.#HJ(J,this.#r(q))});let Q=(Z)=>{if(Y(this,"disabled"))return;Z.preventDefault(),Z.stopPropagation(),this.#S=!0,this.classList.add("fig-canvas-control-ring-active");let $=this.#d;if(!$)return;if(this.#K)this.#K.setAttribute("show","true"),this.#K.showPopup?.(),this.#OJ(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(),O=this.#Z/100*B.width,G=this.#Q/100*B.height,M=Math.atan2(Z.clientY-B.top-G,Z.clientX-B.left-O)*180/Math.PI,k=Math.round(M);document.body.style.cursor=this.#r(k);let P=(S)=>{let F=$.getBoundingClientRect(),R=this.#Z/100*F.width,W=this.#Q/100*F.height,T=S.clientX-F.left-R,V=S.clientY-F.top-W,H=Math.round(Math.atan2(V,T)*180/Math.PI);if(H!==k)k=H,document.body.style.cursor=this.#r(H);let C=Math.sqrt(T*T+V*V);if(this.#w(S.shiftKey)){let I=this.#$?5:10;if(this.#$){let A=C/F.width*100;A=Math.round(A/I)*I,C=A/100*F.width}else C=Math.round(C/I)*I}if(this.#$)this.#j=this.#N(Math.max(0,C/F.width*100));else this.#j=this.#N(Math.max(0,C));if(this.#K)this.#K.setAttribute("text",this.#a()),this.#OJ(S.clientX,S.clientY);this.#m(),this.#YJ()},N=this.#zJ((S)=>{if(this.#S=!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(S)this.#g(),this.#$J()});window.addEventListener("pointermove",P,{signal:N.signal}),window.addEventListener("pointerup",()=>N.finish(!0),{signal:N.signal}),window.addEventListener("pointercancel",()=>N.finish(!1),{signal:N.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.#c=null;J(j)};return this.#f=Q,this.#c=$,{signal:Q.signal,finish:$}}#VJ(){this.#c?.(!1),this.#f?.abort(),this.#f=null,this.#c=null}}U("fig-canvas-control",zJ);class K extends HTMLElement{#Z=[K.#R()];#Q=0;#J=2;#_=240;#j=120;#$={min:-1,max:1};#O=null;#B=null;#G=null;#X=null;#q=0;#M=null;#Y=null;#k=null;#K=null;#P=[];#L=[];#U=[];#S=[];#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:[K.#R()]});this.#J=this.#D("precision",2),this.#y(this.getAttribute("value")),this.#c(),this.#l(),this.#NJ(),f(this)}disconnectedCallback(){if(this.#FJ(),this.#PJ(),this.#F)this.#F.disconnect(),this.#F=null;D(this)}attributeChangedCallback(J,Q,Z){if(Q===Z)return;if(J==="value"){if(this.#y(Z),this.isConnected)this.#l();return}if(J==="precision"){if(this.#J=this.#D("precision",2),this.isConnected)this.#m();return}if(J==="aspect-ratio"){if(this.#c(),this.#B)this.#_J();return}if(J==="edit"||J==="disabled"){if(this.isConnected)this.#l()}}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.#b(this.defaultValue);if(!J)return!1;return JSON.stringify(this.data.waves)===JSON.stringify(J.map((Q)=>this.#E(Q)))}resetToDefault(){let J=this.defaultValue;if(!J)return;this.value=J,this.#g("input"),this.#g("change")}get data(){return{waves:this.#Z.map((J)=>this.#E(J))}}get preset(){let J=this.#C;return K.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"}#f(){return this.#h("disabled",!1)}#c(){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=[K.#R()];return this.#Q=Math.min(this.#Q,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.#e(J.type),frequency:this.#o(J.frequency,1,0.1,16),amplitude:this.#o(J.amplitude,1,-4,4),phase:this.#o(J.phase,0,-360,360),offset:this.#o(J.offset,0,-4,4)}}#E(J){return{type:J.type,frequency:this.#A(J.frequency),amplitude:this.#A(J.amplitude),phase:this.#A(J.phase),offset:this.#A(J.offset)}}get#C(){if(!this.#Z[this.#Q])this.#Q=0;return this.#Z[this.#Q]||K.#R()}#e(J){let Q=String(J||"").toLowerCase();return K.TYPES.some((Z)=>Z.value===Q)?Q:"sine"}#o(J,Q,Z,$){let j=Number.parseFloat(J);if(!Number.isFinite(j))return Q;return Math.min($,Math.max(Z,j))}#A(J){let Q=10**this.#J;return Math.round(J*Q)/Q}static#N(J){return K.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=K.#u(J,q),O=5+q*j,G=5+(1-(B+1)/2)*j;_+=`${X===0?"M":"L"}${O.toFixed(1)},${G.toFixed(1)}`}return _}static#w(J,Q=24){return E("svg",{width:Q,height:Q,viewBox:`0 0 ${Q} ${Q}`,fill:"none"},E("path",{d:K.#jJ(J,Q),stroke:"currentColor","stroke-width":"1","stroke-linecap":"round","stroke-linejoin":"round"}))}static waveIcon(J,Q=24){let Z=K.#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#u(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(_)}}#l(){if(this.#FJ(),this.#PJ(),this.replaceChildren(...this.#d()),this.#t(),this.#BJ(),this.#_J(),this.#WJ(),!this.#f())this.#XJ();f(this)}#i(J,Q){return E("foreignObject",{className:`propskit-oscillator-handle propskit-oscillator-${J}-handle`,"data-handle":J,width:"20",height:"20"},L("div",{className:"propskit-oscillator-handle-inner"},L("fig-tooltip",{text:Q},L("fig-handle",{size:"small",type:"minimal","aria-label":`Oscillator ${J} handle`}))))}#d(){let J=this.#I()&&!this.#f(),Q=[E("rect",{className:"propskit-oscillator-bounds",x:"0",y:"0",width:this.#_,height:this.#j}),E("line",{className:"propskit-oscillator-baseline"}),E("path",{className:"propskit-oscillator-path"}),E("circle",{className:"propskit-oscillator-playhead"})];if(J)Q.push(this.#i("amplitude","Amplitude"),this.#i("frequency","Frequency"));let Z=E("svg",{viewBox:`0 0 ${this.#_} ${this.#j}`,className:"propskit-oscillator-svg"},Q),$=[L("div",{className:"propskit-oscillator-svg-container"},Z)];if(this.#I())$.push(L("div",{className:"propskit-oscillator-waves"},this.#Z.map((j,_)=>this.#p(j,_,!J))));return $}#p(J,Q,Z){let $=Z||this.#Z.length<=1,j=Q===this.#Q,_=K.#N(J.type),X=L("fig-tooltip",{text:"Remove form"},L("fig-button",{className:"propskit-oscillator-remove-button",variant:"ghost",icon:!0,"data-wave-index":Q,"aria-label":"Remove form",disabled:$},L("fig-icon",{name:"minus"}))),q=L("fig-header",{borderless:!0},[L("h3",{},_),X,this.#kJ(Z,Q)]),B=L("div",{className:"propskit-oscillator-fields","data-wave-index":Q,"data-active":j},[this.#a(Q,"frequency","Frequency",0.1,16,0.1,""),this.#a(Q,"amplitude","Amplitude",-4,4,0.1,""),this.#a(Q,"phase","Phase",-360,360,1,"°"),this.#a(Q,"offset","Offset",-4,4,0.1,"")]);return L("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=L("fig-tooltip",{text:"Add form"},L("fig-button",{className:"propskit-oscillator-add-type-button",variant:"ghost",icon:!0,"fig-menu-trigger":!0,"aria-label":"Add form",disabled:J},L("fig-icon",{name:"plus"}))),$=K.TYPES.map((j)=>L("fig-menu-item",{value:j.value},[K.#w(j.value,24),L("span",{},j.name)]));return L("fig-menu",{className:"propskit-oscillator-add-type",position:"bottom right","data-wave-index":Q,disabled:J},[Z,$])}#a(J,Q,Z,$,j,_,X){let q=this.#Z[J]||K.#R(),B=Q==="amplitude"||Q==="offset";return L("propskit-slider",{className:"propskit-oscillator-field",label:Z,direction:"horizontal",name:Q,"data-wave-index":J,value:this.#A(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.#B=this.querySelector(".propskit-oscillator-svg"),this.#G=this.querySelector(".propskit-oscillator-path"),this.#X=this.querySelector(".propskit-oscillator-playhead"),this.#M=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.#L=Array.from(this.querySelectorAll(".propskit-oscillator-wave-type")),this.#P=Array.from(this.querySelectorAll("propskit-slider[name]")),this.#S=Array.from(this.querySelectorAll("fig-group.propskit-oscillator-wave")),this.#U=Array.from(this.querySelectorAll(".propskit-oscillator-fields"))}#JJ(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}#v(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.#_||Z!==this.#j;return this.#_=Q,this.#j=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.#n(Z/Q)));return{min:-J,max:J}}#qJ(J){let{min:Q,max:Z}=this.#$;return this.#j-(J-Q)/(Z-Q)*this.#j}#LJ(J){let{min:Q,max:Z}=this.#$;return Q+(1-J/this.#j)*(Z-Q)}#n(J){return this.#Z.reduce((Q,Z)=>{let $=J*Z.frequency,j=K.#u(Z.type,$,Z.phase);return Q+Z.offset+j*Z.amplitude},0)}#_J(){if(!this.#B||!this.#G)return;if(this.#BJ(),this.#$=this.#GJ(),this.#Y)this.#Y.setAttribute("width",this.#_),this.#Y.setAttribute("height",this.#j);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.#_,B=this.#qJ(this.#n(X));$+=`${_===0?"M":"L"}${q.toFixed(1)},${B.toFixed(1)}`}this.#G.setAttribute("d",$);let j=this.#qJ(0);this.#M?.setAttribute("x1","0"),this.#M?.setAttribute("y1",j),this.#M?.setAttribute("x2",this.#_),this.#M?.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.#_,Z=this.#qJ(this.#n(J));this.#X.setAttribute("cx",Q.toFixed(1)),this.#X.setAttribute("cy",Z.toFixed(1))}#SJ(){let Q=this.#C,Z=this.#QJ(),$=Math.max(8,Math.min(this.#_-8,this.#_/Q.frequency)),j=this.#qJ(this.#n(Z/this.#_)),_=this.#qJ(this.#n($/this.#_));this.#ZJ(this.#k,Z,j,8),this.#ZJ(this.#K,$,_,8)}#QJ(){let J=this.#C,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.#_-8,j*this.#_))}#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.#f())return;for(let Q of this.#L)Q.addEventListener("change",(Z)=>{if(this.#f())return;let $=this.#s(Q);this.#r($),this.#Z[$].type=this.#e(Z.detail??Z.target?.value),this.#m(),this.#g("input"),this.#g("change")});for(let Q of this.#P)Q.addEventListener("input",(Z)=>{Z.stopPropagation(),this.#W=Q;try{this.#KJ(this.#s(Q),Q.getAttribute("name"),Z.detail??Z.currentTarget?.value??Z.target?.value,"input")}finally{this.#W=null}}),Q.addEventListener("change",(Z)=>{Z.stopPropagation(),this.#KJ(this.#s(Q),Q.getAttribute("name"),Z.detail??Z.currentTarget?.value??Z.target?.value,"change")});for(let Q of this.#S)Q.addEventListener("pointerdown",()=>{this.#r(this.#s(Q))}),Q.addEventListener("focusin",()=>{this.#r(this.#s(Q))}),Q.addEventListener("openchange",(Z)=>{let $=this.#s(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.#s(Q)+1,X=this.#e($.detail?.value??Q.value);this.#Z.splice(_,0,K.#R(X)),this.#v(_),this.#Q=_,this.#l(),this.#g("input"),this.#g("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.#Z.length<=1)return;let $=this.#s(Q);this.#Z.splice($,1),this.#JJ($),this.#Q=Math.min(this.#Q,this.#Z.length-1),this.#l(),this.#g("input"),this.#g("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.#MJ(Q,"offset")})}#s(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.#f())return;$.preventDefault(),$.stopImmediatePropagation(),this.#MJ($,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})}#r(J){let Q=Math.min(this.#Z.length-1,Math.max(0,J));if(Q===this.#Q)return;this.#Q=Q,this.#fJ(),this.#SJ()}#KJ(J,Q,Z,$){if(this.#f())return;this.#r(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.#m({skipFieldSync:$=="input"}),this.#g($)}#HJ(J,Q){let Z=J.shiftKey?0.5:0.1,$=this.#C;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.#Q]=this.#x($),this.#m(),this.#g("input"),this.#g("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.#O=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.#O)return;let B=this.#TJ(q),O=this.#C;if(Q==="frequency"){let G=Math.max(1,Math.min(this.#_,B.x));O.frequency=this.#_/G}else if(Q==="offset"){let G=this.#o(B.x/this.#_,0,0,1),M=this.#RJ(O,G);O.offset=this.#LJ(B.y)-this.#CJ(this.#Q,G)-M*O.amplitude}else if(Q==="amplitude"){let G=this.#o(B.x/this.#_,0,0,1),M=this.#RJ(O,G),k=this.#LJ(B.y)-this.#CJ(this.#Q,G)-O.offset;O.amplitude=Math.abs(M)<0.001?O.amplitude:k/M}this.#Z[this.#Q]=this.#x(O),this.#m(),this.#g("input")},_=new AbortController,X=(q=!1)=>{if(this.#O=null,this.#B?.classList.remove("dragging"),Z)document.body.style.cursor=$;if(_.abort(),this.#H===_)this.#H=null,this.#z=null;if(q)this.#g("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.#O=null,this.#B?.classList.remove("dragging")}#CJ(J,Q){return this.#Z.reduce((Z,$,j)=>{if(j===J)return Z;let _=Q*$.frequency,X=K.#u($.type,_,$.phase);return Z+$.offset+X*$.amplitude},0)}#RJ(J,Q){return K.#u(J.type,Q*J.frequency,J.phase)}#m({skipFieldSync:J=!1}={}){if(this.#YJ(),!J)this.#$J();this.#fJ(),this.#_J()}#YJ(){for(let J of this.#L){let Q=this.#s(J);J.value=this.#Z[Q]?.type||"sine"}}#$J(){for(let J of this.#P){if(J===this.#W)continue;let Q=this.#s(J),Z=J.getAttribute("name"),$=this.#A(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.#U)if(this.#s(J)===this.#Q)J.setAttribute("data-active","");else J.removeAttribute("data-active")}#g(J){this.dispatchEvent(new CustomEvent(J,{bubbles:!0,detail:{value:this.value,data:this.data,preset:K.#N(this.#C.type)}}))}}U("propskit-oscillator",K);class WJ extends HTMLElement{#Z;#Q;#J=null;#_;#j;#$;#O;#B;#G;#X;#q=null;#M=null;constructor(){super();this.angle=0,this.#Z=1,this.#Q=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.#_=this.#h.bind(this),this.#j=this.#e.bind(this),this.#$=this.#o.bind(this),this.#O=this.#jJ.bind(this),this.#B=this.#w.bind(this),this.#G=this.#I.bind(this),this.#X=this.#N.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.#C(),this.text&&this.angleInput)this.angleInput.setAttribute("value",this.angle.toFixed(this.precision))})}disconnectedCallback(){this.#A(),this.#D()}#Y(){this.#A(),this.#D();let J=this.#W(),Q=this.#L(),Z=this.getAttribute("aria-label")||this.getAttribute("name")||"Angle",$=this.min??this.#z(0),j=this.max??this.#z(360),_=[];if(this.dial)_.push(L("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},L("div",{className:"fig-input-angle-handle"})));if(this.text)_.push(L("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?L("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)}#L(){return Y(this,"disabled")}#U(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}#S(J,{reflect:Q=!0}={}){let Z=this.#U(J);if(this.angle=Z,this.#f(),Q){let $=String(Z);if(this.getAttribute("value")!==$)this.setAttribute("value",$)}if(this.#C(),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.#j),this.plane?.addEventListener("touchstart",this.#$),this.plane?.addEventListener("keydown",this.#X),window.addEventListener("keydown",this.#O),window.addEventListener("keyup",this.#B),this.text&&this.angleInput)this.angleInput.addEventListener("input",this.#G),this.angleInput.addEventListener("change",this.#G);this.addEventListener("change",this.#_,!0)}#D(){if(this.plane?.removeEventListener("mousedown",this.#j),this.plane?.removeEventListener("touchstart",this.#$),this.plane?.removeEventListener("keydown",this.#X),window.removeEventListener("keydown",this.#O),window.removeEventListener("keyup",this.#B),this.text&&this.angleInput)this.angleInput.removeEventListener("input",this.#G),this.angleInput.removeEventListener("change",this.#G);this.removeEventListener("change",this.#_,!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(_)}}}#I(J){if(J.stopPropagation(),this.#L())return;if(this.#S(Number(J.target.value)),J.type==="change")this.#E();else this.#x()}#f(){let Q=this.#H(this.angle)*Math.PI/180;this.#Z=Math.cos(Q),this.#Q=Math.sin(Q)}#c(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.#c(Z),this.min!==null||this.max!==null)this.angle=this.#U(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.#U(this.angle+this.#z(X))}else{let j=Z-this.#J;if(j>180)j-=360;if(j<-180)j+=360;this.angle=this.#U(this.angle+this.#z(j)),this.#J=Z}if(this.#f(),this.setAttribute("value",String(this.angle)),this.#C(),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}}))}#E(){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0,detail:{value:this.value,angle:this.angle}}))}#C(){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)`}}#e(J){if(this.#L()||J.button!==0)return;this.#A(),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.#M=null;if(j)this.#E()};this.#q=Z,this.#M=$,window.addEventListener("mousemove",Q,{signal:Z.signal}),window.addEventListener("mouseup",()=>$(!0),{signal:Z.signal}),window.addEventListener("blur",()=>$(!1),{signal:Z.signal})}#o(J){if(this.#L())return;J.preventDefault(),this.#A(),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.#M=null;if(j)this.#E()};this.#q=Z,this.#M=$,window.addEventListener("touchmove",Q,{signal:Z.signal}),window.addEventListener("touchend",()=>$(!0),{signal:Z.signal}),window.addEventListener("touchcancel",()=>$(!1),{signal:Z.signal})}#A(){this.#M?.(!1),this.#q?.abort(),this.#q=null,this.#M=null,this.isDragging=!1,this.#J=null,this.plane?.classList.remove("dragging")}#N(J){if(this.#L())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.#S(Z),this.#x(),this.#E()}#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.#Q}set value(J){if(isNaN(J)){console.error("Invalid value: must be a number.");return}this.#S(Number(J))}attributeChangedCallback(J,Q,Z){switch(J){case"value":if(this.isDragging)break;if(Z!==null)this.#S(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.#C()}break;case"dial":if(this.dial=this.#k("dial",!0),this.isConnected)this.#Y(),this.#R(),this.#C();break;case"units":{let $=Z||"°";if($==="deg")$="°";if(this.units=$,this.isConnected)this.#Y(),this.#R(),this.#C();break}case"min":if(this.min=Z!==null?Number(Z):null,this.#S(this.angle),this.isConnected)this.#Y(),this.#R(),this.#C();break;case"max":if(this.max=Z!==null?Number(Z):null,this.#S(this.angle),this.isConnected)this.#Y(),this.#R(),this.#C();break;case"disabled":if(this.#A(),this.isConnected)this.#Y(),this.#R(),this.#C();break;case"aria-label":case"name":if(this.isConnected)this.#Y(),this.#R(),this.#C();break;case"rotations":case"show-rotations":if(this.showRotations=this.#K(),this.isConnected)this.#Y(),this.#R(),this.#C();break}}}U("fig-input-angle",WJ);class h extends HTMLElement{static observedAttributes=["axis","handle","disabled"];static#Z=6;static#Q=['[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-input-joystick","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;#_=new Map;#j=null;#$=null;#O=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.#M(),this.#J=new MutationObserver(()=>this.#M()),this.#J.observe(this,{childList:!0})}disconnectedCallback(){this.#J?.disconnect(),this.#J=null,this.#E(),this.#C(),this.#c(),this.#O?.remove(),this.#O=null}attributeChangedCallback(){if(this.isConnected){if(this.#B)this.#C();this.#M()}}get#B(){return this.hasAttribute("disabled")&&this.getAttribute("disabled")!=="false"}get#G(){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"))}#M(){let J=this.#q(),Q=new Set(J);for(let[Z,$]of this.#_)if(!Q.has(Z))$.target.removeEventListener("pointerdown",$.onPointerDown,!0),$.target.removeEventListener("keydown",$.onKeyDown),this.#S($),this.#_.delete(Z);if(this.#K(J),this.#Y(J),this.#B||J.length<2){this.#E();return}for(let Z of J){let $=this.#L(Z),j=this.#_.get(Z);if(j&&j.target===$)continue;if(j)j.target.removeEventListener("pointerdown",j.onPointerDown,!0),this.#_.delete(Z);if(!$)continue;this.#U(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")}}#L(J){if(this.#X)return J.querySelector(this.#X);return J}#U(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.#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.#B)return;let O=this.#G==="horizontal",G=O?"ArrowLeft":"ArrowUp",M=O?"ArrowRight":"ArrowDown";if(B.key!==G&&B.key!==M&&B.key!=="Home"&&B.key!=="End")return;B.preventDefault(),B.stopPropagation();let k=this.#q(),P=k.indexOf(J),N=P;if(B.key===G)N=Math.max(0,P-1);else if(B.key===M)N=Math.min(k.length-1,P+1);else if(B.key==="Home")N=0;else if(B.key==="End")N=k.length-1;if(N===P){this.#F(`${X}, position ${P+1} of ${k.length}`);return}this.#b(J,N),this.#M(),this.#L(J)?.focus(),this.dispatchEvent(new CustomEvent("reorder",{bubbles:!0,detail:{oldIndex:P,newIndex:N,item:J}})),this.#F(`${X}, position ${N+1} of ${k.length}`)};Q.addEventListener("pointerdown",Z,!0),Q.addEventListener("keydown",q),this.#_.set(J,{target:Q,onPointerDown:Z,onKeyDown:q,originalTabIndex:$,originalAriaLabel:j,originalRole:_})}#S(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.#O?.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.#O=J,document.body.appendChild(J)}#F(J){if(!this.#O)return;this.#O.textContent="",requestAnimationFrame(()=>{if(this.#O)this.#O.textContent=J})}#W(J,Q){let Z=J;while(Z&&Z!==Q){if(Z instanceof Element){for(let $ of h.#Q)if(Z.matches($))return!0}Z=Z.parentElement}return!1}static#H="fig-reorder-dragging";static#z(J){document.body.classList.toggle(h.#H,J)}#V(J,Q,Z){this.#C();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<h.#Z*h.#Z)return;$.active=!0,J.preventDefault(),J.stopPropagation(),Q.classList.add("dragging"),h.#z(!0);try{Z.setPointerCapture($.pointerId)}catch{}}j.preventDefault();let q=this.#G==="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.#x($,!0)},$.onUp=(j)=>{if(j.pointerId!==$.pointerId)return;this.#x($,j.type==="pointercancel")},this.#j=$,window.addEventListener("pointermove",$.onMove),window.addEventListener("pointerup",$.onUp),window.addEventListener("pointercancel",$.onUp),window.addEventListener("keydown",$.onKeyDown)}#R(J){let Q=this.#q(),Z=this.#G==="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.#$)return this.#$;let J=document.createElement("div");return J.className="fig-reorder-indicator",J.setAttribute("data-axis",this.#G),document.body.appendChild(J),this.#$=J,J}#f(J,Q){let Z=this.#q();if(!this.#D(Q,J)){this.#c();return}let $=this.#h(Z);if(!$){this.#c();return}let j=this.#I();if(j.setAttribute("data-axis",this.#G),this.#G==="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"}#c(){this.#$?.remove(),this.#$=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 O=Z.getAttribute("aria-label")||Z.textContent?.trim().replace(/\s+/g," ").slice(0,80)||"item";this.#F(`${O}, position ${B+1} of ${this.#q().length}`)}}}if(Z.classList.remove("dragging"),h.#z(!1),this.#c(),this.#j===J)this.#j=null}#E(){for(let[,J]of this.#_)J.target.removeEventListener("pointerdown",J.onPointerDown,!0),J.target.removeEventListener("keydown",J.onKeyDown),this.#S(J);this.#_.clear()}#C(){if(!this.#j)return;this.#x(this.#j,!0)}}U("fig-reorder",h);
|