@rogieking/figui3 6.30.0 → 6.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/components.css +15 -2
- package/dist/components.css +1 -1
- package/dist/fig.css +1 -1
- package/dist/fig.js +2 -2
- package/fig.js +3 -0
- package/package.json +1 -1
package/dist/fig.js
CHANGED
|
@@ -277,7 +277,7 @@ var w1=(Q,Z)=>()=>(Q&&(Z=Q(Q=0)),Z);var v1={};var P0=w1(()=>{/*! Vendored from @
|
|
|
277
277
|
</svg>
|
|
278
278
|
${j}
|
|
279
279
|
</fig-button>
|
|
280
|
-
</div>`,this.#Z=this.querySelector("fig-input-text"),this.#J=this.querySelector("fig-button"),this.#Q&&this.#j&&this.#J){if(!this.#j.hasAttribute("type"))this.#j.setAttribute("type","dropdown");if(!this.#j.hasAttribute("label"))this.#j.setAttribute("label",J);this.#J.append(this.#j)}this.#$=this.querySelector("fig-dropdown"),this.#O()}#U(){this.#L(),this.#$?.addEventListener("input",this.#_),this.#Z?.addEventListener("input",this.#X),this.#Z?.addEventListener("change",this.#W)}#L(){this.#$?.removeEventListener("input",this.#_),this.#Z?.removeEventListener("input",this.#X),this.#Z?.removeEventListener("change",this.#W)}#F(Q){Q.stopPropagation();let Z=Q.target.closest("fig-dropdown")?.value??"";if(this.#q=!0,this.setAttribute("value",Z),this.#q=!1,this.#Z)this.#Z.setAttribute("value",Z);this.#M(),this.#A()}#z(Q){Q.stopPropagation();let Z=Q.target.value??"";this.#q=!0,this.setAttribute("value",Z),this.#q=!1,this.#M()}#B(Q){Q.stopPropagation();let Z=Q.target.value??"";this.#q=!0,this.setAttribute("value",Z),this.#q=!1,this.#A()}#M(){this.dispatchEvent(new CustomEvent("input",{bubbles:!0,cancelable:!0,detail:{value:this.value}}))}#A(){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0,detail:{value:this.value}}))}#P(){return(this.getAttribute("options")||"").split(",").map((Q)=>Q.trim()).filter(Boolean)}#D(){return(this.getAttribute("aria-label")||this.getAttribute("placeholder")||"Combo input").trim()}#H(){return`${this.#D()} options`}#O(){if(this.#Z)this.#Y.forEach((Q)=>{let Z=this.getAttribute(Q);if(Z===null)this.#Z.removeAttribute(Q);else this.#Z.setAttribute(Q,Z)});if(this.#$&&!this.#$.hasAttribute("aria-label"))this.#$.setAttribute("label",this.#H())}#T(Q){if(this.#Z)if(Q)this.#Z.setAttribute("disabled","");else this.#Z.removeAttribute("disabled");if(this.#J)if(Q)this.#J.setAttribute("disabled","");else this.#J.removeAttribute("disabled");if(this.#$)if(Q)this.#$.setAttribute("disabled","");else this.#$.removeAttribute("disabled")}focus(){this.#Z?.focus()}attributeChangedCallback(Q,Z,$){if(Z===$)return;switch(Q){case"options":if(this.#$&&!this.#Q){let J=this.#P();this.#$.replaceChildren(...J.map((j)=>{let q=document.createElement("option");return q.textContent=j,q}))}break;case"placeholder":if(this.#Z)this.#Z.setAttribute("placeholder",$||"");this.#O();break;case"value":if(!this.#q&&this.#Z)this.#Z.setAttribute("value",$||"");break;case"disabled":this.#T($!==null&&$!=="false");break;case"aria-label":case"aria-labelledby":case"aria-describedby":case"aria-invalid":case"aria-required":this.#O();break}}}z("fig-combo-input",q1);class _1 extends HTMLElement{#Q="color";#Z=null;#$=!1;constructor(){super();this.#Z=this.#W.bind(this)}static get observedAttributes(){return["background","size","selected","disabled","alpha","aria-label","aria-labelledby","aria-describedby"]}connectedCallback(){this.#_(),this.#J(),this.#X()}#J(){let Q=this.getAttribute("alpha");if(Q!==null)this.style.setProperty("--alpha",Q);else this.style.removeProperty("--alpha")}#j(Q){if(!Q)return"color";let Z=Q.toLowerCase();if(Z.includes("gradient"))return"gradient";if(Z.includes("url("))return"image";return"color"}#q(Q){if(!Q)return"#D9D9D9";if(Q.startsWith("#"))return Q.slice(0,7);try{let{ctx:Z}=F0(1,1);return Z.fillStyle=Q,Z.fillStyle}catch{return"#D9D9D9"}}#Y(Q){if(!Q||!Q.includes("var("))return Q;let Z=this.style.background;this.style.background=Q;let $=getComputedStyle(this),J=$.backgroundImage,j=$.backgroundColor;if(this.style.background=Z,J&&J!=="none")return J;return j||Q}#_(){let Q=this.getAttribute("background")||"#D9D9D9",Z=Q.includes("var("),$=Z?this.#Y(Q):Q,J=this.#j($);if(J!==this.#Q||!this.input){if(this.#Q=J,this.setAttribute("data-type",this.#Q),this.input)this.input.removeEventListener("input",this.#Z);if(this.#Q==="color"){let q=this.#q($);if(this.innerHTML=`<div></div><input type="color" value="${q}" />`,this.input=this.querySelector("input"),!Z)this.input.addEventListener("input",this.#Z);this.#X()}else this.innerHTML="<div></div>",this.input=null,this.#X()}else if(this.#Q==="color"&&this.input){let q=this.#q($);if(this.input.value!==q)this.input.value=q}let j=/^(linear-gradient|radial-gradient|conic-gradient|repeating-|url)\s*\(/i.test(Q);this.style.setProperty("--swatch-background",j?Q:`linear-gradient(${Q}, ${Q})`)}#X(){let Q=this.hasAttribute("disabled")&&this.getAttribute("disabled")!=="false";if(this.setAttribute("aria-disabled",Q?"true":"false"),this.input){this.input.disabled=Q;let Z=this.getAttribute("aria-labelledby"),$=this.getAttribute("aria-label")||"Color swatch",J=this.getAttribute("aria-describedby");if(Z)this.input.setAttribute("aria-labelledby",Z),this.input.removeAttribute("aria-label");else this.input.setAttribute("aria-label",$),this.input.removeAttribute("aria-labelledby");if(J)this.input.setAttribute("aria-describedby",J);else this.input.removeAttribute("aria-describedby");this.removeAttribute("role"),this.removeAttribute("aria-hidden");return}if(!this.hasAttribute("aria-label")&&!this.hasAttribute("aria-labelledby"))this.setAttribute("aria-hidden","true");else this.setAttribute("role","img"),this.removeAttribute("aria-hidden")}#W(Q){this.#$=!0,this.setAttribute("background",Q.target.value),this.#$=!1}get background(){return this.getAttribute("background")}set background(Q){this.setAttribute("background",Q)}focus(){this.input?.focus()}attributeChangedCallback(Q,Z,$){if(Z===$)return;if(Q==="background"){if(this.#$){let J=/^(linear-gradient|radial-gradient|conic-gradient|repeating-|url)\s*\(/i.test($);this.style.setProperty("--swatch-background",J?$:`linear-gradient(${$}, ${$})`);return}this.#_()}else if(Q==="alpha")this.#J();else if(Q==="disabled"||Q==="aria-label"||Q==="aria-labelledby"||Q==="aria-describedby")this.#X()}get alpha(){return this.getAttribute("alpha")}set alpha(Q){if(Q===null||Q===void 0)this.removeAttribute("alpha");else this.setAttribute("alpha",Q)}}z("fig-swatch",_1);class G0 extends HTMLElement{#Q=null;#Z=null;#$=null;#J=null;#j=null;#q=null;#Y=null;#_=this.#c.bind(this);#X=this.#d.bind(this);#W=this.#s.bind(this);#G=this.#h.bind(this);#K=null;#N=null;#U=null;#L=null;#F=null;#z=null;#B=null;static get observedAttributes(){return["src","type","alt","upload","label","aspect-ratio","fit","checkerboard","caption","controls","autoplay","loop","muted","poster","aria-label","aria-labelledby","title"]}get mediaKind(){return(this.getAttribute("type")||"image").toLowerCase()==="video"?"video":"image"}get src(){return this.#Q}set src(Q){if(this.#Q=Q||"",Q===null||Q===void 0||Q==="")this.removeAttribute("src");else this.setAttribute("src",Q)}get file(){return this.#Y}#M(){return this.#q||this.#Q||""}async getBase64(){if(this.mediaKind!=="image")return null;if(!this.#M())return null;if(!this.#Z)return null;try{if(typeof this.#Z.decode==="function")await this.#Z.decode();else if(!this.#Z.complete)await new Promise((J,j)=>{this.#Z.addEventListener("load",J,{once:!0}),this.#Z.addEventListener("error",j,{once:!0})})}catch{}let Q=this.#Z.naturalWidth,Z=this.#Z.naturalHeight;if(!(Q>0)||!(Z>0))return null;let $=document.createElement("canvas");return $.width=Q,$.height=Z,$.getContext("2d").drawImage(this.#Z,0,0),$.toDataURL()}connectedCallback(){this.#Q=this.getAttribute("src")||"";let Q=this.getAttribute("aspect-ratio");if(Q)this.style.setProperty("--fig-media-aspect-ratio",Q);else this.style.setProperty("--fig-media-aspect-ratio","4/3");let Z=this.getAttribute("fit");if(Z)this.style.setProperty("--fig-media-fit",Z);if(this.querySelectorAll("fig-swatch[data-generated]").forEach((J)=>J.remove()),this.#D(),this.#O(),this.#P(),this.#C(),this.#T(),this.#I(),this.hasAttribute("upload")&&this.getAttribute("upload")!=="false"&&!this.querySelector("fig-input-file[data-generated]"))this.#m();this.#J=this.querySelector("fig-input-file[data-generated]"),this.#J?.removeEventListener("change",this.#_),this.#J?.addEventListener("change",this.#_)}disconnectedCallback(){if(this.#J?.removeEventListener("change",this.#_),this.#A(),this.#V(),this.#j)URL.revokeObjectURL(this.#j),this.#j=null;this.#q=null}#A(){if(!this.#Z)return;if(this.#Z.tagName==="VIDEO")this.#Z.removeEventListener("play",this.#X),this.#Z.removeEventListener("pause",this.#W),this.#Z.removeEventListener("ended",this.#G)}#P(){if(this.#A(),this.#Z?.tagName!=="VIDEO")return;this.#Z.addEventListener("play",this.#X),this.#Z.addEventListener("pause",this.#W),this.#Z.addEventListener("ended",this.#G)}#D(){if(this.#$?.isConnected)return;let Q=this.querySelector(":scope > fig-preview");if(Q){this.#$=Q;return}let Z=document.createElement("fig-preview");Z.setAttribute("data-generated",""),this.prepend(Z),this.#$=Z}#H(){let Q=this.mediaKind==="video"?"video":"img";return this.querySelector(`${Q}:not([data-generated])`)}#O(){let Q=this.#H();if(Q){if(this.#D(),this.#Z&&this.#Z!==Q){if(this.#A(),this.#Z.hasAttribute("data-generated"))this.#Z.remove()}if(this.#Z=Q,this.#$&&Q.parentElement!==this.#$)this.#$.append(Q);this.#T();return}this.#D();let Z=this.mediaKind==="video"?"VIDEO":"IMG";if(this.#Z&&this.#Z.tagName!==Z){if(this.#A(),this.#Z.hasAttribute("data-generated"))this.#Z.remove();this.#Z=null}if(this.#Z)return;if(this.mediaKind==="video"){let $=document.createElement("video");$.setAttribute("data-generated",""),$.className="fig-media-element",$.setAttribute("playsinline",""),$.preload="auto",this.#$.append($),this.#Z=$,this.#P();let J=()=>{if(this.#Z?.autoplay)return;try{this.#Z.currentTime=0.001}catch{}};this.#Z.addEventListener("loadedmetadata",J,{once:!0})}else{let $=document.createElement("img");$.setAttribute("data-generated",""),$.className="fig-media-element",$.loading="lazy",$.decoding="async",$.alt=this.getAttribute("alt")||"",this.#$.append($),this.#Z=$}}#T(){if(!this.#Z)return;if(this.#Z.tagName==="IMG"){if(this.hasAttribute("alt")||this.#Z.hasAttribute("data-generated"))this.#Z.alt=this.getAttribute("alt")||"";return}if(this.#Z.tagName!=="VIDEO")return;["aria-label","aria-labelledby","title"].forEach((Q)=>{let Z=this.getAttribute(Q);if(Z===null)this.#Z.removeAttribute(Q);else this.#Z.setAttribute(Q,Z)})}#S(){return this.querySelector(":scope > figcaption:not([data-generated])")}#f(){return Array.from(this.querySelectorAll(":scope > figcaption[data-generated]"))}#I(){let Q=this.#S(),Z=this.#f();if(Q){Z.forEach((q)=>q.remove());return}let $=this.getAttribute("caption")||"";if(!$){Z.forEach((q)=>q.remove());return}let J=Z[0]||document.createElement("figcaption");if(Z.slice(1).forEach((q)=>q.remove()),!J.hasAttribute("data-generated"))J.setAttribute("data-generated","");if(J.textContent!==$)J.textContent=$;let j=this.querySelector(":scope > fig-media-controls");if(j)j.before(J);else if(this.#$?.isConnected)this.#$.after(J);else if(!J.isConnected)this.append(J)}#R(Q,Z=!1){if(!this.hasAttribute(Q))return Z;return this.getAttribute(Q)!=="false"}#C(){if(!this.#Z)return;if(!this.#Z.hasAttribute("data-generated"))return;let Q=this.#M();if(this.#Z.getAttribute("src")!==Q){if(Q)this.#Z.setAttribute("src",Q);else if(this.#Z.removeAttribute("src"),this.#Z.tagName==="VIDEO")this.#Z.load()}if(this.#Z.tagName==="IMG"){this.#T();return}let Z=this.getAttribute("poster");if(Z)this.#Z.setAttribute("poster",Z);else this.#Z.removeAttribute("poster");this.#Z.controls=!1,this.#Z.removeAttribute("controls"),this.#Z.autoplay=this.#R("autoplay",!1),this.#Z.loop=this.#R("loop",!1),this.#Z.muted=this.#R("muted",!1),this.#Z.playsInline=!0,this.#T(),this.#y(),this.#k()}get mediaEl(){return this.#Z}#E(){if(this.mediaKind!=="video")return!1;return Boolean(this.#M())}#k(){let Q=this.#K||this.querySelector(":scope > fig-media-controls");if(!Q)return;if(this.mediaKind!=="video")return;if(this.#E()){if(Q.hasAttribute("data-fig-empty-disabled"))Q.removeAttribute("disabled"),Q.removeAttribute("data-fig-empty-disabled");return}Q.setAttribute("disabled",""),Q.setAttribute("data-fig-empty-disabled",""),Q.playing=!1,Q.time=0,Q.duration=0}#y(){if(this.mediaKind!=="video"){this.#V();return}let Q=this.querySelector(":scope > fig-media-controls:not([data-generated])");if(Q){if(this.#K!==Q)this.#V(),this.#K=Q;this.#b(),this.#k();return}if(this.#R("controls",!1))this.#w();else this.#V()}#w(){let Q=Array.from(this.querySelectorAll(":scope > fig-media-controls[data-generated]")),Z=Q[0];if(Q.slice(1).forEach((J)=>J.remove()),Z){this.#K=Z,this.#b(),this.#k();return}let $=document.createElement("fig-media-controls");$.setAttribute("data-generated",""),this.append($),this.#K=$,this.#b(),this.#k()}#b(){if(!this.#K||!this.#Z)return;if(this.#N===this.#Z&&this.#U===this.#K){this.#k();return}this.#v();let Q=this.#K,Z=this.#Z;this.#N=Z,this.#U=Q;let $=null,J=()=>{if(this.#k(),!this.#E())return;if(Q.playing=!Z.paused&&!Z.ended,Number.isFinite(Z.duration))Q.duration=Z.duration;if($!==null)if(Math.abs(Z.currentTime-$)<0.25)$=null;else return;Q.time=Z.currentTime||0},j=()=>{if(!this.#E())return;let X=Z.play?.();if(X&&typeof X.catch==="function")X.catch(()=>{})},q=()=>Z.pause?.(),_=(X)=>{if(!this.#E())return;let Y=Number(X?.detail?.time);if(!Number.isFinite(Y))return;$=Y;try{Z.currentTime=Y}catch{}};this.#L=J,this.#F=j,this.#z=q,this.#B=_,Z.addEventListener("play",J),Z.addEventListener("pause",J),Z.addEventListener("ended",J),Z.addEventListener("timeupdate",J),Z.addEventListener("loadedmetadata",J),Z.addEventListener("durationchange",J),Z.addEventListener("seeked",J),Q.addEventListener("play",j),Q.addEventListener("pause",q),Q.addEventListener("seek",_),J()}#v(){let Q=this.#N,Z=this.#U;if(Q&&this.#L)Q.removeEventListener("play",this.#L),Q.removeEventListener("pause",this.#L),Q.removeEventListener("ended",this.#L),Q.removeEventListener("timeupdate",this.#L),Q.removeEventListener("loadedmetadata",this.#L),Q.removeEventListener("durationchange",this.#L),Q.removeEventListener("seeked",this.#L);if(Z){if(this.#F)Z.removeEventListener("play",this.#F);if(this.#z)Z.removeEventListener("pause",this.#z);if(this.#B)Z.removeEventListener("seek",this.#B)}this.#N=null,this.#U=null,this.#L=null,this.#F=null,this.#z=null,this.#B=null}#V(){this.#v(),this.querySelectorAll(":scope > fig-media-controls[data-generated]").forEach((Q)=>{Q.remove()}),this.#K=null}toggle(){if(!this.#Z||this.mediaKind!=="video")return;if(this.#Z.paused||this.#Z.ended)this.play();else this.pause()}play(){if(this.mediaKind!=="video"||!this.#Z)return;let Q=this.#Z.play();if(Q&&typeof Q.catch==="function")Q.catch(()=>{})}pause(){if(this.mediaKind!=="video"||!this.#Z)return;this.#Z.pause()}#m(){let Q=document.createElement("fig-input-file");Q.setAttribute("data-generated",""),Q.setAttribute("accepts",this.mediaKind==="video"?"video/*":"image/*"),Q.setAttribute("variant","overlay");let Z=this.getAttribute("label")||"Upload";if(Q.setAttribute("label",this.#Q?"Replace":Z),this.#Y?.name)Q.setAttribute("filename",this.#Y.name);else if(this.#Q)Q.setAttribute("url",this.#Q);Q.addEventListener("change",this.#_),this.#D(),this.#$.append(Q),this.#J=Q}#x(){if(this.#J)this.#J.removeEventListener("change",this.#_),this.#J.remove(),this.#J=null}#c(Q){if(Q.target!==this.#J)return;let Z=Q.detail?.files?.[0],$=Q.detail?.cleared===!0;if(!Z){if(this.#j)URL.revokeObjectURL(this.#j),this.#j=null;if(this.#Y=null,this.#q=null,$)this.src="";if(this.#C(),this.#J){let J=this.getAttribute("label")||"Upload";if(this.#J.setAttribute("label",this.#Q?"Replace":J),this.#J.removeAttribute("filename"),this.#Q)this.#J.setAttribute("url",this.#Q);else this.#J.removeAttribute("url")}this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0}));return}if(this.#j)URL.revokeObjectURL(this.#j);if(this.#Y=Z,this.#j=URL.createObjectURL(Z),this.#q=this.#j,this.#C(),this.dispatchEvent(new CustomEvent("loaded",{bubbles:!0,cancelable:!0,detail:{file:Z,src:this.#j}})),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0})),this.#J)this.#J.removeAttribute("url"),this.#J.setAttribute("filename",Z.name),this.#J.setAttribute("label","Replace")}#g(Q){if(!this.#Z)return;this.dispatchEvent(new CustomEvent(Q,{bubbles:!0,cancelable:!1,composed:!0,detail:{src:this.#Q||"",currentTime:this.#Z.currentTime,duration:this.#Z.duration}}))}#d(){this.#g("play")}#s(){this.#g("pause")}#h(){this.#g("ended")}attributeChangedCallback(Q,Z,$){if(Z===$)return;if(Q==="src"){let J=$||"",j=J&&(J===this.#q||J===this.#j);if(this.#Q=J,this.#j&&!j)URL.revokeObjectURL(this.#j),this.#j=null,this.#q=null,this.#Y=null;if(this.#C(),this.#J){let q=this.getAttribute("label")||"Upload";if(this.#J.setAttribute("label",this.#Q?"Replace":q),this.#Q)if(this.#Y?.name)this.#J.removeAttribute("url"),this.#J.setAttribute("filename",this.#Y.name);else this.#J.setAttribute("url",this.#Q),this.#J.removeAttribute("filename");else this.#J.removeAttribute("url"),this.#J.removeAttribute("filename")}}if(Q==="type"){if(this.#O(),this.#C(),this.#J)this.#J.setAttribute("accepts",this.mediaKind==="video"?"video/*":"image/*")}if(["alt","aria-label","aria-labelledby","title"].includes(Q))this.#T();if(Q==="upload"){let J=$!==null&&$!=="false";if(J&&!this.#J)this.#m();else if(!J)this.#x()}if(Q==="aspect-ratio")if($)this.style.setProperty("--fig-media-aspect-ratio",$);else this.style.removeProperty("--fig-media-aspect-ratio");if(Q==="fit")if($)this.style.setProperty("--fig-media-fit",$);else this.style.removeProperty("--fig-media-fit");if(Q==="label"&&this.#J){let J=this.getAttribute("label")||"Upload";this.#J.setAttribute("label",this.#Q?"Replace":J)}if(["controls","autoplay","loop","muted","poster"].includes(Q))this.#C();if(Q==="caption")this.#I()}}z("fig-media",G0);class X1 extends G0{get mediaKind(){return"image"}}z("fig-image",X1);class Y1 extends G0{get mediaKind(){return"video"}}z("fig-video",Y1);class K1 extends HTMLElement{static get observedAttributes(){return["src","alt","label","text","sublabel","href","target","selected","disabled","full","aspect-ratio","fit","label-line-clamp"]}#Q=null;#Z=null;#$=null;#J=null;#j=null;#q=!1;#Y=new MutationObserver((Q)=>{if(!Q.some(($)=>[...$.addedNodes,...$.removedNodes].some((J)=>J instanceof Element&&(J.matches("fig-image:not([data-generated]), fig-media:not([data-generated]), fig-preview:not([data-generated])")||J.querySelector("fig-image:not([data-generated]), fig-media:not([data-generated]), fig-preview:not([data-generated])"))))||!this.isConnected)return;this.#U(),this.#F()});connectedCallback(){this.#Y.observe(this,{childList:!0,subtree:!0}),this.#U(),this.#F()}disconnectedCallback(){this.#Y.disconnect()}attributeChangedCallback(){if(!this.isConnected)return;this.#U(),this.#F()}#_(){return this.getAttribute("label")??this.getAttribute("text")??""}#X(){return this.getAttribute("sublabel")??""}#W(){let Q=this.getAttribute("href");return Boolean(Q)&&!F(this,"disabled")}#G(){return this.getAttribute("label-line-clamp")==="2"?"2":"1"}#K(){return Boolean(this.getAttribute("src"))}#N(){return this.querySelector(":scope > fig-image:not([data-generated]), :scope > fig-media:not([data-generated]), :scope > fig-preview:not([data-generated]), :scope > .fig-card-link > fig-image:not([data-generated]), :scope > .fig-card-link > fig-media:not([data-generated]), :scope > .fig-card-link > fig-preview:not([data-generated]), :scope > .fig-card-link > .fig-card-media > fig-image:not([data-generated]), :scope > .fig-card-link > .fig-card-media > fig-media:not([data-generated]), :scope > .fig-card-link > .fig-card-media > fig-preview:not([data-generated])")}#U(){if(!this.#K()){this.#L();return}if(this.querySelectorAll(":scope > .fig-card-text[data-generated]").forEach((j)=>j.remove()),this.#Z?.parentElement===this)this.#Z=null;let Q=this.#N();this.#q=Boolean(Q);let $=this.#W()?"a":"div";if(!this.#Q||this.#Q.tagName.toLowerCase()!==$){let j=document.createElement($);if(j.className="fig-card-link",this.#Q){while(this.#Q.firstChild)j.appendChild(this.#Q.firstChild);this.#Q.replaceWith(j)}else this.appendChild(j);this.#Q=j}let J=this.#Q.querySelector(":scope > .fig-card-media");if(J){while(J.firstChild)this.#Q.insertBefore(J.firstChild,J);J.remove()}if(Q&&Q.parentElement!==this.#Q)this.#Q.querySelectorAll(":scope > [data-generated]:not(.fig-card-text)").forEach((j)=>j.remove()),this.#Q.prepend(Q),this.#$=null;if(!this.#q){if(this.#$=this.#Q.querySelector(":scope > fig-image[data-generated]")||null,!this.#$)this.#Q.querySelectorAll(":scope > fig-image, :scope > fig-media, :scope > fig-preview").forEach((j)=>{if(j.hasAttribute("data-generated"))j.remove()}),this.#$=document.createElement("fig-image"),this.#$.setAttribute("data-generated",""),this.#$.setAttribute("full",""),this.#$.setAttribute("size","auto"),this.#Q.prepend(this.#$)}if(!this.#Z||!this.#Z.isConnected){if(this.#Z=this.#Q.querySelector(":scope > .fig-card-text"),this.#Z?.tagName.toLowerCase()!=="div"){let j=document.createElement("div");if(j.className="fig-card-text",j.setAttribute("data-generated",""),this.#Z){while(this.#Z.firstChild)j.appendChild(this.#Z.firstChild);this.#Z.replaceWith(j)}else this.#Q.appendChild(j);this.#Z=j}if(!this.#Z)this.#Z=document.createElement("div"),this.#Z.className="fig-card-text",this.#Z.setAttribute("data-generated",""),this.#Q.appendChild(this.#Z)}if(!this.#J||!this.#J.isConnected){if(this.#J=this.#Z.querySelector(":scope > .fig-card-label[data-generated]"),!this.#J){if(this.#J=this.#Q.querySelector(":scope > .fig-card-label[data-generated]")||null,!this.#J)this.#J=document.createElement("label"),this.#J.className="fig-card-label",this.#J.setAttribute("data-generated","");this.#Z.appendChild(this.#J)}}if(!this.#j||!this.#j.isConnected){if(this.#j=this.#Z.querySelector(":scope > .fig-card-sublabel[data-generated]"),!this.#j){if(this.#j=this.#Q.querySelector(":scope > .fig-card-sublabel[data-generated]")||null,!this.#j)this.#j=document.createElement("label"),this.#j.className="fig-card-sublabel",this.#j.setAttribute("data-generated","");this.#J.after(this.#j)}}}#L(){let Q=this.#Q||this.querySelector(":scope > .fig-card-link");if(Q)Q.querySelectorAll("fig-image:not([data-generated]), fig-media:not([data-generated]), fig-preview:not([data-generated])").forEach(($)=>this.insertBefore($,Q)),Q.remove();this.querySelectorAll(":scope > [data-generated]").forEach(($)=>$.remove()),this.#Q=null,this.#$=null,this.#q=!0,this.#Z=document.createElement("div"),this.#Z.className="fig-card-text",this.#Z.setAttribute("data-generated",""),this.#J=document.createElement("label"),this.#J.className="fig-card-label",this.#J.setAttribute("data-generated",""),this.#Z.appendChild(this.#J);let Z=this.#X();if(this.#j=null,Z)this.#j=document.createElement("label"),this.#j.className="fig-card-sublabel",this.#j.setAttribute("data-generated",""),this.#Z.appendChild(this.#j);this.appendChild(this.#Z)}#F(){if(!this.#K()){this.#z();return}if(!this.#Q)return;let Q=F(this,"disabled"),Z=F(this,"selected"),$=this.#_(),J=this.#X(),j=this.#G();if(this.style.setProperty("--fig-card-label-line-clamp",j),this.#W()){let q=this.getAttribute("href")||"",_=this.getAttribute("target");if(this.#Q.setAttribute("href",q),_)if(this.#Q.setAttribute("target",_),_==="_blank")this.#Q.setAttribute("rel","noopener noreferrer");else this.#Q.removeAttribute("rel");else this.#Q.removeAttribute("target"),this.#Q.removeAttribute("rel");if(Z)this.#Q.setAttribute("aria-current","true");else this.#Q.removeAttribute("aria-current");this.removeAttribute("role"),this.removeAttribute("aria-label")}else{this.#Q.removeAttribute("href"),this.#Q.removeAttribute("target"),this.#Q.removeAttribute("rel"),this.#Q.removeAttribute("aria-current"),this.setAttribute("role","group");let q=[$,J].filter(Boolean).join(", ");if(q)this.setAttribute("aria-label",q);else this.removeAttribute("aria-label")}if(Q)this.setAttribute("aria-disabled","true");else this.removeAttribute("aria-disabled");if(this.#$&&!this.#q){let q=this.getAttribute("src"),_=this.getAttribute("alt"),X=this.getAttribute("aspect-ratio")||"1/1",Y=this.getAttribute("fit")||"contain",K=_!=null?_:"";if(q)this.#$.setAttribute("src",q);else this.#$.removeAttribute("src");this.#$.setAttribute("alt",K),this.#$.setAttribute("aspect-ratio",X),this.#$.setAttribute("fit",Y),this.#$.setAttribute("full",""),this.#$.setAttribute("size","auto")}if(this.#J)this.#J.textContent=$,this.#J.hidden=!$;if(this.#j)this.#j.textContent=J,this.#j.hidden=!J;if(this.#Z)this.#Z.hidden=!$&&!J}#z(){let Q=F(this,"disabled"),Z=this.#_(),$=this.#X();this.style.setProperty("--fig-card-label-line-clamp",this.#G()),this.setAttribute("role","group");let J=[Z,$].filter(Boolean).join(", ");if(J)this.setAttribute("aria-label",J);else this.removeAttribute("aria-label");if(Q)this.setAttribute("aria-disabled","true");else this.removeAttribute("aria-disabled");if(this.#J)this.#J.textContent=Z,this.#J.hidden=!Z;if(this.#j)this.#j.textContent=$}}z("fig-card",K1);class G1 extends HTMLElement{#Q=null;#Z=null;#$=null;#J=null;#j=!1;#q=!1;static get observedAttributes(){return["playing","duration","time","disabled"]}connectedCallback(){this.#Y(),this.#G(),this.#K(),this.#_()}get playing(){return this.hasAttribute("playing")&&this.getAttribute("playing")!=="false"}set playing(Q){if(Q)this.setAttribute("playing","");else this.removeAttribute("playing")}get duration(){let Q=Number(this.getAttribute("duration"));return Number.isFinite(Q)&&Q>=0?Q:0}set duration(Q){let Z=Number(Q);if(!Number.isFinite(Z)||Z<0){this.removeAttribute("duration");return}this.setAttribute("duration",String(Z))}get time(){let Q=Number(this.getAttribute("time"));return Number.isFinite(Q)&&Q>=0?Q:0}set time(Q){let Z=Number(Q);if(!Number.isFinite(Z)||Z<0){this.removeAttribute("time");return}this.setAttribute("time",String(Z))}get disabled(){return F(this,"disabled")}set disabled(Q){if(Q)this.setAttribute("disabled","");else this.removeAttribute("disabled")}attributeChangedCallback(Q){if(!this.#q)return;if(Q==="playing")this.#G();if(Q==="duration"||Q==="time")this.#K();if(Q==="disabled")this.#_()}#Y(){if(this.#q)return;if(this.#q=!0,!this.hasAttribute("role"))this.setAttribute("role","group");if(!this.hasAttribute("aria-label")&&!this.hasAttribute("aria-labelledby"))this.setAttribute("aria-label","Media controls");let Q=document.createElement("fig-tooltip");Q.setAttribute("text","Play");let Z=document.createElement("fig-button");Z.setAttribute("variant","ghost"),Z.setAttribute("size","small"),Z.setAttribute("icon","true"),Z.setAttribute("aria-label","Play");let $=u("play",{className:"fig-media-controls-play-icon"});Z.append($),Q.append(Z),Z.addEventListener("click",(_)=>{_.preventDefault(),_.stopPropagation(),this.toggle()});let J=document.createElement("fig-slider");J.setAttribute("text","false"),J.setAttribute("min","0"),J.setAttribute("max",String(this.duration)),J.setAttribute("step","1"),J.setAttribute("value",String(this.time)),J.setAttribute("full",""),J.setAttribute("aria-label","Seek"),J.setAttribute("aria-valuetext",this.#W(this.time,this.duration));let j=document.createElement("span");j.className="fig-media-controls-time",j.textContent=this.#X(this.time);let q=(_)=>{if(this.disabled){_.preventDefault?.(),_.stopPropagation();return}let X=_.currentTarget,Y=Number(X?.value);if(!Number.isFinite(Y))return;this.#j=!0,this.setAttribute("time",String(Y)),this.dispatchEvent(new CustomEvent("seek",{bubbles:!0,composed:!0,detail:{time:Y}})),requestAnimationFrame(()=>{this.#j=!1})};J.addEventListener("input",q),J.addEventListener("change",q),this.append(Q,J,j),this.#Q=Z,this.#Z=Q,this.#$=J,this.#J=j,this.#_()}#_(){let Q=this.disabled;if(this.setAttribute("aria-disabled",Q?"true":"false"),this.#Q)if(Q)this.#Q.setAttribute("disabled","");else this.#Q.removeAttribute("disabled");if(this.#$)if(Q)this.#$.setAttribute("disabled","");else this.#$.removeAttribute("disabled")}#X(Q){if(!Number.isFinite(Q)||Q<0)Q=0;let Z=Math.floor(Q),$=Math.floor(Z/60),J=Z%60;return`${String($).padStart(2,"0")}:${String(J).padStart(2,"0")}`}#W(Q,Z=0){let $=this.#X(Q);if(!Number.isFinite(Z)||Z<=0)return $;return`${$} of ${this.#X(Z)}`}#G(){if(!this.#Q)return;let Q=this.playing;this.#Q.setAttribute("aria-label",Q?"Pause":"Play"),this.#Z?.setAttribute("text",Q?"Pause":"Play");let Z=this.#Q.querySelector(".fig-media-controls-play-icon");if(Z)Z.setAttribute("name",Q?"pause":"play")}#K(){if(!this.#$)return;let Q=this.duration;if(Number(this.#$.getAttribute("max"))!==Q)this.#$.setAttribute("max",String(Q));let Z=this.time;if(!this.#j)this.#$.setAttribute("value",String(Z));if(this.#$.setAttribute("aria-valuetext",this.#W(Z,Q)),this.#J)this.#J.textContent=this.#X(Z)}toggle(){if(this.disabled)return;let Q=!this.playing;this.playing=Q,this.dispatchEvent(new CustomEvent(Q?"play":"pause",{bubbles:!0,composed:!0,detail:{playing:Q}}))}play(){if(this.disabled||this.playing)return;this.toggle()}pause(){if(this.disabled||!this.playing)return;this.toggle()}}z("fig-media-controls",G1);class N1 extends HTMLElement{static observedAttributes=["accepts","label","disabled","multiple","variant","url","filename"];#Q=null;#Z=null;#$=null;#J=null;#j=null;#q=null;get files(){return this.#q}get#Y(){let Q=this.getAttribute("filename");if(Q)return Q;let Z=this.getAttribute("url");if(!Z)return"";try{let J=new URL(Z,location.href).pathname.split("/").pop();return J?decodeURIComponent(J):Z}catch{return Z}}get value(){if(this.#q&&this.#q.length>0){if(this.#q.length===1)return this.#q[0].name;return`${this.#q.length} files`}return this.#Y}connectedCallback(){this.#U(),this.addEventListener("dragover",this.#G),this.addEventListener("dragleave",this.#K),this.addEventListener("drop",this.#N)}disconnectedCallback(){this.#Q?.removeEventListener("change",this.#X),this.#$?.removeEventListener("click",this.#W),this.removeEventListener("dragover",this.#G),this.removeEventListener("dragleave",this.#K),this.removeEventListener("drop",this.#N)}attributeChangedCallback(Q,Z,$){if(Z===$)return;this.#U()}clear(){if(this.#q=null,this.#Q)this.#Q.value="";this.removeAttribute("url"),this.removeAttribute("filename"),this.#U(),this.#_({cleared:!0})}#_(Q={}){let Z={files:this.#q,...Q};this.dispatchEvent(new CustomEvent("input",{detail:Z,bubbles:!0})),this.dispatchEvent(new CustomEvent("change",{detail:Z,bubbles:!0}))}#X=()=>{if(this.#Q.files.length>0)this.#q=this.#Q.files,this.removeAttribute("url"),this.#U(),this.#_()};#W=(Q)=>{Q.stopPropagation(),this.clear()};#G=(Q)=>{if(this.hasAttribute("disabled")&&this.getAttribute("disabled")!=="false")return;if(Q.preventDefault(),!this.hasAttribute("dragover")){if(this.setAttribute("dragover",""),this.#j)this.#j.dataset.prevText=this.#j.textContent,this.#j.textContent="Drop file"}};#K=()=>{if(this.removeAttribute("dragover"),this.#j&&this.#j.dataset.prevText!==void 0)this.#j.textContent=this.#j.dataset.prevText,delete this.#j.dataset.prevText};#N=(Q)=>{if(Q.preventDefault(),this.removeAttribute("dragover"),this.#j&&this.#j.dataset.prevText!==void 0)this.#j.textContent=this.#j.dataset.prevText,delete this.#j.dataset.prevText;if(this.hasAttribute("disabled")&&this.getAttribute("disabled")!=="false")return;let Z=this.getAttribute("accepts"),$=Array.from(Q.dataTransfer.files);if(Z){let j=Z.split(",").map((q)=>q.trim().toLowerCase());$=$.filter((q)=>{let _="."+q.name.split(".").pop().toLowerCase(),X=q.type.toLowerCase();return j.some((Y)=>Y===_||Y===X||Y.endsWith("/*")&&X.startsWith(Y.slice(0,-1)))})}if(!this.hasAttribute("multiple")||this.getAttribute("multiple")==="false")$=$.slice(0,1);if($.length===0)return;let J=new DataTransfer;if($.forEach((j)=>J.items.add(j)),this.#q=J.files,this.#Q)this.#Q.files=J.files;this.removeAttribute("url"),this.#U(),this.#_()};#U(){let Q=this.getAttribute("accepts")||"",Z=this.getAttribute("label")||"Upload",$=this.hasAttribute("disabled")&&this.getAttribute("disabled")!=="false",J=this.hasAttribute("multiple")&&this.getAttribute("multiple")!=="false",j=this.getAttribute("variant")||"input",q=this.#q&&this.#q.length>0||!!this.getAttribute("url")||!!this.getAttribute("filename");if(this.innerHTML="",q){let _=Q?`Accepts ${Q.split(",").map((N)=>N.trim()).join(", ")}`:"";if(this.#j=document.createElement("fig-button"),this.#j.setAttribute("variant",j),this.#j.setAttribute("type","upload"),this.#j.className="fig-input-file-filename",$)this.#j.setAttribute("disabled","");let X=document.createElement("fig-truncate");X.setAttribute("position","middle"),X.setAttribute("tooltip","");let Y=this.value,K=Y.lastIndexOf(".");if(K>0)X.setAttribute("tail",Y.slice(K));if(X.textContent=Y,this.#j.appendChild(X),this.#Q=document.createElement("input"),this.#Q.type="file",this.#Q.title="",this.#Q.disabled=$,Q)this.#Q.setAttribute("accept",Q);if(J)this.#Q.setAttribute("multiple","");if(this.#Q.addEventListener("change",this.#X),this.#j.appendChild(this.#Q),_)this.#J=document.createElement("fig-tooltip"),this.#J.setAttribute("text",_),this.#J.appendChild(this.#j),this.appendChild(this.#J);else this.appendChild(this.#j);let G=document.createElement("fig-tooltip");if(G.setAttribute("text","Remove"),this.#$=document.createElement("fig-button"),this.#$.setAttribute("variant",j==="overlay"?"overlay":"ghost"),this.#$.setAttribute("icon","true"),this.#$.setAttribute("aria-label","Remove"),this.#$.className="fig-input-file-clear",$)this.#$.setAttribute("disabled","");this.#$.replaceChildren(u("minus")),this.#$.addEventListener("click",this.#W),G.appendChild(this.#$),this.appendChild(G)}else{let _=Q?`Accepts ${Q.split(",").map((X)=>X.trim()).join(", ")}`:"";if(_)this.#J=document.createElement("fig-tooltip"),this.#J.setAttribute("text",_);if(this.#j=document.createElement("fig-button"),this.#j.setAttribute("variant",j),this.#j.setAttribute("type","upload"),this.#j.textContent=Z,$)this.#j.setAttribute("disabled","");if(this.#Q=document.createElement("input"),this.#Q.type="file",this.#Q.title="",this.#Q.disabled=$,Q)this.#Q.setAttribute("accept",Q);if(J)this.#Q.setAttribute("multiple","");if(this.#Q.addEventListener("change",this.#X),this.#j.appendChild(this.#Q),this.#J)this.#J.appendChild(this.#j),this.appendChild(this.#J);else this.appendChild(this.#j)}}}z("fig-input-file",N1);class w extends HTMLElement{#Q={x:0.42,y:0};#Z={x:0.58,y:1};#$={stiffness:200,damping:15,mass:1};#J="bezier";#j=2;#q=null;#Y=null;#_=null;#X=null;#W=null;#G=null;#K=null;#N=null;#U=null;#L=null;#F=null;#z=0.8;#B=200;#M=200;#A=null;#P=null;#D=null;#H=null;#O=5;#T=10;#S=10;#f=3;static PRESETS=[{group:null,name:"Linear",type:"bezier",value:[0,0,1,1]},{group:"Bezier",name:"Ease in",type:"bezier",value:[0.42,0,1,1]},{group:"Bezier",name:"Ease out",type:"bezier",value:[0,0,0.58,1]},{group:"Bezier",name:"Ease in and out",type:"bezier",value:[0.42,0,0.58,1]},{group:"Bezier",name:"Ease in back",type:"bezier",value:[0.6,-0.28,0.735,0.045]},{group:"Bezier",name:"Ease out back",type:"bezier",value:[0.175,0.885,0.32,1.275]},{group:"Bezier",name:"Ease in and out back",type:"bezier",value:[0.68,-0.55,0.265,1.55]},{group:"Bezier",name:"Custom bezier",type:"bezier",value:null},{group:"Spring",name:"Gentle",type:"spring",spring:{stiffness:120,damping:14,mass:1}},{group:"Spring",name:"Quick",type:"spring",spring:{stiffness:380,damping:20,mass:1}},{group:"Spring",name:"Bouncy",type:"spring",spring:{stiffness:250,damping:8,mass:1}},{group:"Spring",name:"Slow",type:"spring",spring:{stiffness:60,damping:11,mass:1}},{group:"Spring",name:"Custom spring",type:"spring",spring:null}];static get observedAttributes(){return["value","precision","aspect-ratio","edit"]}connectedCallback(){this.#j=parseInt(this.getAttribute("precision")||"2"),b(this,"--aspect-ratio",this.getAttribute("aspect-ratio"));let Q=this.getAttribute("value");if(Q)this.#I(Q);this.#L=this.#R(),this.#y(),this.#g()}disconnectedCallback(){if(this.#q=null,this.#H)this.#H.disconnect(),this.#H=null}attributeChangedCallback(Q,Z,$){if(Z===$)return;if(Q==="aspect-ratio"){if(b(this,"--aspect-ratio",$),this.#Y)this.#d(),this.#u();return}if(Q==="edit"){if(this.isConnected)this.#y();return}if(Q==="value"&&$){let J=this.#J;if(this.#I($),this.#L=this.#R(),J!==this.#J&&this.#k())this.#y();else{if(this.#Y)this.#u();this.#Q0(),this.#l()}}if(Q==="precision")this.#j=parseInt($||"2")}get value(){if(this.#J==="spring"){let{stiffness:Z,damping:$,mass:J}=this.#$;return`spring(${Z}, ${$}, ${J})`}let Q=this.#j;return`${this.#Q.x.toFixed(Q)}, ${this.#Q.y.toFixed(Q)}, ${this.#Z.x.toFixed(Q)}, ${this.#Z.y.toFixed(Q)}`}get cssValue(){if(this.#J==="spring"){let Z=this.#C(),$=20,J=Math.max(1,Math.floor(Z.length/20)),j=[];for(let q=0;q<Z.length;q+=J)j.push(Z[q].value.toFixed(3));if(Z.length>0)j.push(Z[Z.length-1].value.toFixed(3));return`linear(${j.join(", ")})`}let Q=this.#j;return`cubic-bezier(${this.#Q.x.toFixed(Q)}, ${this.#Q.y.toFixed(Q)}, ${this.#Z.x.toFixed(Q)}, ${this.#Z.y.toFixed(Q)})`}get preset(){return this.#L}set value(Q){this.setAttribute("value",Q)}#I(Q){let Z=Q.match(/^spring\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)$/);if(Z)return this.#J="spring",this.#$.stiffness=parseFloat(Z[1]),this.#$.damping=parseFloat(Z[2]),this.#$.mass=parseFloat(Z[3]),!0;let $=Q.split(",").map((J)=>parseFloat(J.trim()));if($.length>=4&&$.every((J)=>!isNaN(J)))return this.#J="bezier",this.#Q.x=$[0],this.#Q.y=$[1],this.#Z.x=$[2],this.#Z.y=$[3],!0;return!1}#R(){if(this.#J==="bezier"){for(let Z of w.PRESETS){if(Z.type!=="bezier"||!Z.value)continue;if(Math.abs(this.#Q.x-Z.value[0])<0.001&&Math.abs(this.#Q.y-Z.value[1])<0.001&&Math.abs(this.#Z.x-Z.value[2])<0.001&&Math.abs(this.#Z.y-Z.value[3])<0.001)return Z.name}return"Custom bezier"}for(let Z of w.PRESETS){if(Z.type!=="spring"||!Z.spring)continue;if(Math.abs(this.#$.stiffness-Z.spring.stiffness)<0.001&&Math.abs(this.#$.damping-Z.spring.damping)<0.001&&Math.abs(this.#$.mass-Z.spring.mass)<0.001)return Z.name}return"Custom spring"}#C(){let{stiffness:Q,damping:Z,mass:$}=this.#$,J=0.004,j=5,q=[],_=0,X=0;for(let Y=0;Y<=5;Y+=0.004){let K=-Q*(_-1)-Z*X;if(X+=K/$*0.004,_+=X*0.004,q.push({t:Y,value:_}),Y>0.1&&Math.abs(_-1)<0.0005&&Math.abs(X)<0.0005)break}return q}static#E(Q,Z=24){let{stiffness:$,damping:J,mass:j}=Q,q=0.004,_=5,X=[],Y=0,K=0;for(let A=0;A<=5;A+=0.004){let M=-$*(Y-1)-J*K;if(K+=M/j*0.004,Y+=K*0.004,X.push({t:A,value:Y}),A>0.1&&Math.abs(Y-1)<0.001&&Math.abs(K)<0.001)break}let G=X[X.length-1].t||1,N=1;for(let A of X)if(A.value>N)N=A.value;let U=0;for(let A of X)if(A.value<U)U=A.value;let O=Math.max(N-U,1),B=6,L=Z-B*2,T=Math.max(1,Math.floor(X.length/30)),R="";for(let A=0;A<X.length;A+=T){let M=B+X[A].t/G*L,C=B+(1-(X[A].value-U)/O)*L;R+=(A===0?"M":"L")+M.toFixed(1)+","+C.toFixed(1)}return`<svg width="${Z}" height="${Z}" viewBox="0 0 ${Z} ${Z}" fill="none"><path d="${R}" stroke="currentColor" stroke-width="1" stroke-linecap="round" fill="none"/></svg>`}static curveIcon(Q,Z,$,J,j=24){let _=(j-12)/2,X=48,Y=[],K=(M,C,k,S,x)=>{let y=1-x;return y*y*y*M+3*y*y*x*C+3*y*x*x*k+x*x*x*S};for(let M=0;M<=48;M++){let C=M/48;Y.push({x:K(0,Q,$,1,C),y:K(0,Z,J,1,C)})}let G=1/0,N=-1/0,U=1/0,O=-1/0;for(let M of Y){if(M.x<G)G=M.x;if(M.x>N)N=M.x;if(M.y<U)U=M.y;if(M.y>O)O=M.y}let B=Math.max(N-G,0.000001),L=Math.max(O-U,0.000001),T=(M)=>_+(M-G)/B*12,R=(M)=>_+(1-(M-U)/L)*12,A="";for(let M=0;M<Y.length;M++){let C=T(Y[M].x),k=R(Y[M].y);A+=`${M===0?"M":"L"}${C.toFixed(1)},${k.toFixed(1)}`}return`<svg width="${j}" height="${j}" viewBox="0 0 ${j} ${j}" fill="none"><path d="${A}" stroke="currentColor" stroke-width="1" stroke-linecap="round"/></svg>`}#k(){return this.getAttribute("edit")!=="false"}#y(){if(this.classList.toggle("spring-mode",this.#J==="spring"),this.classList.toggle("bezier-mode",this.#J!=="spring"),this.#m(),this.innerHTML=this.#v(),this.#x(),this.#Y)this.#c(),this.#d(),this.#u();this.#l(),this.#W0()}static#w(Q){return String(Q).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}#b(){let Q="",Z=void 0;for(let J of w.PRESETS){if(!this.#k()&&!J.value&&!J.spring)continue;if(J.group!==Z){if(J.group)Q+=`<fig-separator label="${w.#w(J.group)}"></fig-separator>`;Z=J.group}let j;if(J.type==="spring"){let _=J.spring||this.#$;j=w.#E(_)}else{let _=J.value||[this.#Q.x,this.#Q.y,this.#Z.x,this.#Z.y];j=w.curveIcon(..._)}let q=w.#w(J.name);Q+=`<fig-select-option value="${q}" label="${q}"><span slot="prepend">${j}</span><span>${q}</span></fig-select-option>`}return`<fig-select class="fig-easing-curve-select" label="Easing preset" value="${w.#w(this.#L)}" full><fig-select-options>${Q}</fig-select-options></fig-select>`}#v(){let Z=this.#b();if(!this.#k())return Z;let $=`<fig-input-text class="fig-easing-curve-value-input" value="${w.#w(this.value)}" full></fig-input-text>`;if(this.#J==="spring")return`${Z}<div class="fig-easing-curve-svg-container"><svg viewBox="0 0 200 200" class="fig-easing-curve-svg">
|
|
280
|
+
</div>`,this.#Z=this.querySelector("fig-input-text"),this.#J=this.querySelector("fig-button"),this.#Q&&this.#j&&this.#J){if(!this.#j.hasAttribute("type"))this.#j.setAttribute("type","dropdown");if(!this.#j.hasAttribute("label"))this.#j.setAttribute("label",J);this.#J.append(this.#j)}this.#$=this.querySelector("fig-dropdown"),this.#O()}#U(){this.#L(),this.#$?.addEventListener("input",this.#_),this.#Z?.addEventListener("input",this.#X),this.#Z?.addEventListener("change",this.#W)}#L(){this.#$?.removeEventListener("input",this.#_),this.#Z?.removeEventListener("input",this.#X),this.#Z?.removeEventListener("change",this.#W)}#F(Q){Q.stopPropagation();let Z=Q.target.closest("fig-dropdown")?.value??"";if(this.#q=!0,this.setAttribute("value",Z),this.#q=!1,this.#Z)this.#Z.setAttribute("value",Z);this.#M(),this.#A()}#z(Q){Q.stopPropagation();let Z=Q.target.value??"";this.#q=!0,this.setAttribute("value",Z),this.#q=!1,this.#M()}#B(Q){Q.stopPropagation();let Z=Q.target.value??"";this.#q=!0,this.setAttribute("value",Z),this.#q=!1,this.#A()}#M(){this.dispatchEvent(new CustomEvent("input",{bubbles:!0,cancelable:!0,detail:{value:this.value}}))}#A(){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0,detail:{value:this.value}}))}#P(){return(this.getAttribute("options")||"").split(",").map((Q)=>Q.trim()).filter(Boolean)}#D(){return(this.getAttribute("aria-label")||this.getAttribute("placeholder")||"Combo input").trim()}#H(){return`${this.#D()} options`}#O(){if(this.#Z)this.#Y.forEach((Q)=>{let Z=this.getAttribute(Q);if(Z===null)this.#Z.removeAttribute(Q);else this.#Z.setAttribute(Q,Z)});if(this.#$&&!this.#$.hasAttribute("aria-label"))this.#$.setAttribute("label",this.#H())}#T(Q){if(this.#Z)if(Q)this.#Z.setAttribute("disabled","");else this.#Z.removeAttribute("disabled");if(this.#J)if(Q)this.#J.setAttribute("disabled","");else this.#J.removeAttribute("disabled");if(this.#$)if(Q)this.#$.setAttribute("disabled","");else this.#$.removeAttribute("disabled")}focus(){this.#Z?.focus()}attributeChangedCallback(Q,Z,$){if(Z===$)return;switch(Q){case"options":if(this.#$&&!this.#Q){let J=this.#P();this.#$.replaceChildren(...J.map((j)=>{let q=document.createElement("option");return q.textContent=j,q}))}break;case"placeholder":if(this.#Z)this.#Z.setAttribute("placeholder",$||"");this.#O();break;case"value":if(!this.#q&&this.#Z)this.#Z.setAttribute("value",$||"");break;case"disabled":this.#T($!==null&&$!=="false");break;case"aria-label":case"aria-labelledby":case"aria-describedby":case"aria-invalid":case"aria-required":this.#O();break}}}z("fig-combo-input",q1);class _1 extends HTMLElement{#Q="color";#Z=null;#$=!1;constructor(){super();this.#Z=this.#W.bind(this)}static get observedAttributes(){return["background","size","selected","disabled","alpha","aria-label","aria-labelledby","aria-describedby"]}connectedCallback(){this.#_(),this.#J(),this.#X()}#J(){let Q=this.getAttribute("alpha");if(Q!==null)this.style.setProperty("--alpha",Q);else this.style.removeProperty("--alpha")}#j(Q){if(!Q)return"color";let Z=Q.toLowerCase();if(Z.includes("gradient"))return"gradient";if(Z.includes("url("))return"image";return"color"}#q(Q){if(!Q)return"#D9D9D9";if(Q.startsWith("#"))return Q.slice(0,7);try{let{ctx:Z}=F0(1,1);return Z.fillStyle=Q,Z.fillStyle}catch{return"#D9D9D9"}}#Y(Q){if(!Q||!Q.includes("var("))return Q;let Z=this.style.background;this.style.background=Q;let $=getComputedStyle(this),J=$.backgroundImage,j=$.backgroundColor;if(this.style.background=Z,J&&J!=="none")return J;return j||Q}#_(){let Q=this.getAttribute("background")||"#D9D9D9",Z=Q.includes("var("),$=Z?this.#Y(Q):Q,J=this.#j($);if(J!==this.#Q||!this.input){if(this.#Q=J,this.setAttribute("data-type",this.#Q),this.input)this.input.removeEventListener("input",this.#Z);if(this.#Q==="color"){let q=this.#q($);if(this.innerHTML=`<div></div><input type="color" value="${q}" />`,this.input=this.querySelector("input"),!Z)this.input.addEventListener("input",this.#Z);this.#X()}else this.innerHTML="<div></div>",this.input=null,this.#X()}else if(this.#Q==="color"&&this.input){let q=this.#q($);if(this.input.value!==q)this.input.value=q}let j=/^(linear-gradient|radial-gradient|conic-gradient|repeating-|url)\s*\(/i.test(Q);this.style.setProperty("--swatch-background",j?Q:`linear-gradient(${Q}, ${Q})`)}#X(){let Q=this.hasAttribute("disabled")&&this.getAttribute("disabled")!=="false";if(this.setAttribute("aria-disabled",Q?"true":"false"),this.input){this.input.disabled=Q;let Z=this.getAttribute("aria-labelledby"),$=this.getAttribute("aria-label")||"Color swatch",J=this.getAttribute("aria-describedby");if(Z)this.input.setAttribute("aria-labelledby",Z),this.input.removeAttribute("aria-label");else this.input.setAttribute("aria-label",$),this.input.removeAttribute("aria-labelledby");if(J)this.input.setAttribute("aria-describedby",J);else this.input.removeAttribute("aria-describedby");this.removeAttribute("role"),this.removeAttribute("aria-hidden");return}if(!this.hasAttribute("aria-label")&&!this.hasAttribute("aria-labelledby"))this.setAttribute("aria-hidden","true");else this.setAttribute("role","img"),this.removeAttribute("aria-hidden")}#W(Q){this.#$=!0,this.setAttribute("background",Q.target.value),this.#$=!1}get background(){return this.getAttribute("background")}set background(Q){this.setAttribute("background",Q)}focus(){this.input?.focus()}attributeChangedCallback(Q,Z,$){if(Z===$)return;if(Q==="background"){if(this.#$){let J=/^(linear-gradient|radial-gradient|conic-gradient|repeating-|url)\s*\(/i.test($);this.style.setProperty("--swatch-background",J?$:`linear-gradient(${$}, ${$})`);return}this.#_()}else if(Q==="alpha")this.#J();else if(Q==="disabled"||Q==="aria-label"||Q==="aria-labelledby"||Q==="aria-describedby")this.#X()}get alpha(){return this.getAttribute("alpha")}set alpha(Q){if(Q===null||Q===void 0)this.removeAttribute("alpha");else this.setAttribute("alpha",Q)}}z("fig-swatch",_1);class G0 extends HTMLElement{#Q=null;#Z=null;#$=null;#J=null;#j=null;#q=null;#Y=null;#_=this.#c.bind(this);#X=this.#d.bind(this);#W=this.#s.bind(this);#G=this.#h.bind(this);#K=null;#N=null;#U=null;#L=null;#F=null;#z=null;#B=null;static get observedAttributes(){return["src","type","alt","upload","label","aspect-ratio","fit","checkerboard","caption","controls","autoplay","loop","muted","poster","aria-label","aria-labelledby","title"]}get mediaKind(){return(this.getAttribute("type")||"image").toLowerCase()==="video"?"video":"image"}get src(){return this.#Q}set src(Q){if(this.#Q=Q||"",Q===null||Q===void 0||Q==="")this.removeAttribute("src");else this.setAttribute("src",Q)}get file(){return this.#Y}#M(){return this.#q||this.#Q||""}async getBase64(){if(this.mediaKind!=="image")return null;if(!this.#M())return null;if(!this.#Z)return null;try{if(typeof this.#Z.decode==="function")await this.#Z.decode();else if(!this.#Z.complete)await new Promise((J,j)=>{this.#Z.addEventListener("load",J,{once:!0}),this.#Z.addEventListener("error",j,{once:!0})})}catch{}let Q=this.#Z.naturalWidth,Z=this.#Z.naturalHeight;if(!(Q>0)||!(Z>0))return null;let $=document.createElement("canvas");return $.width=Q,$.height=Z,$.getContext("2d").drawImage(this.#Z,0,0),$.toDataURL()}connectedCallback(){this.#Q=this.getAttribute("src")||"";let Q=this.getAttribute("aspect-ratio");if(Q)this.style.setProperty("--fig-media-aspect-ratio",Q);else this.style.setProperty("--fig-media-aspect-ratio","4/3");let Z=this.getAttribute("fit");if(Z)this.style.setProperty("--fig-media-fit",Z);if(this.querySelectorAll("fig-swatch[data-generated]").forEach((J)=>J.remove()),this.#D(),this.#O(),this.#P(),this.#C(),this.#T(),this.#I(),this.hasAttribute("upload")&&this.getAttribute("upload")!=="false"&&!this.querySelector("fig-input-file[data-generated]"))this.#m();this.#J=this.querySelector("fig-input-file[data-generated]"),this.#J?.removeEventListener("change",this.#_),this.#J?.addEventListener("change",this.#_)}disconnectedCallback(){if(this.#J?.removeEventListener("change",this.#_),this.#A(),this.#V(),this.#j)URL.revokeObjectURL(this.#j),this.#j=null;this.#q=null}#A(){if(!this.#Z)return;if(this.#Z.tagName==="VIDEO")this.#Z.removeEventListener("play",this.#X),this.#Z.removeEventListener("pause",this.#W),this.#Z.removeEventListener("ended",this.#G)}#P(){if(this.#A(),this.#Z?.tagName!=="VIDEO")return;this.#Z.addEventListener("play",this.#X),this.#Z.addEventListener("pause",this.#W),this.#Z.addEventListener("ended",this.#G)}#D(){if(this.#$?.isConnected)return;let Q=this.querySelector(":scope > fig-preview");if(Q){this.#$=Q;return}let Z=document.createElement("fig-preview");Z.setAttribute("data-generated",""),this.prepend(Z),this.#$=Z}#H(){let Q=this.mediaKind==="video"?"video":"img";return this.querySelector(`${Q}:not([data-generated])`)}#O(){let Q=this.#H();if(Q){if(this.#D(),this.#Z&&this.#Z!==Q){if(this.#A(),this.#Z.hasAttribute("data-generated"))this.#Z.remove()}if(this.#Z=Q,this.#$&&Q.parentElement!==this.#$)this.#$.append(Q);this.#T();return}this.#D();let Z=this.mediaKind==="video"?"VIDEO":"IMG";if(this.#Z&&this.#Z.tagName!==Z){if(this.#A(),this.#Z.hasAttribute("data-generated"))this.#Z.remove();this.#Z=null}if(this.#Z)return;if(this.mediaKind==="video"){let $=document.createElement("video");$.setAttribute("data-generated",""),$.className="fig-media-element",$.setAttribute("playsinline",""),$.preload="auto",this.#$.append($),this.#Z=$,this.#P();let J=()=>{if(this.#Z?.autoplay)return;try{this.#Z.currentTime=0.001}catch{}};this.#Z.addEventListener("loadedmetadata",J,{once:!0})}else{let $=document.createElement("img");$.setAttribute("data-generated",""),$.className="fig-media-element",$.loading="lazy",$.decoding="async",$.alt=this.getAttribute("alt")||"",this.#$.append($),this.#Z=$}}#T(){if(!this.#Z)return;if(this.#Z.tagName==="IMG"){if(this.hasAttribute("alt")||this.#Z.hasAttribute("data-generated"))this.#Z.alt=this.getAttribute("alt")||"";return}if(this.#Z.tagName!=="VIDEO")return;["aria-label","aria-labelledby","title"].forEach((Q)=>{let Z=this.getAttribute(Q);if(Z===null)this.#Z.removeAttribute(Q);else this.#Z.setAttribute(Q,Z)})}#S(){return this.querySelector(":scope > figcaption:not([data-generated])")}#f(){return Array.from(this.querySelectorAll(":scope > figcaption[data-generated]"))}#I(){let Q=this.#S(),Z=this.#f();if(Q){Z.forEach((q)=>q.remove());return}let $=this.getAttribute("caption")||"";if(!$){Z.forEach((q)=>q.remove());return}let J=Z[0]||document.createElement("figcaption");if(Z.slice(1).forEach((q)=>q.remove()),!J.hasAttribute("data-generated"))J.setAttribute("data-generated","");if(J.textContent!==$)J.textContent=$;let j=this.querySelector(":scope > fig-media-controls");if(j)j.before(J);else if(this.#$?.isConnected)this.#$.after(J);else if(!J.isConnected)this.append(J)}#R(Q,Z=!1){if(!this.hasAttribute(Q))return Z;return this.getAttribute(Q)!=="false"}#C(){if(!this.#Z)return;if(!this.#Z.hasAttribute("data-generated"))return;let Q=this.#M();if(this.#Z.getAttribute("src")!==Q){if(Q)this.#Z.setAttribute("src",Q);else if(this.#Z.removeAttribute("src"),this.#Z.tagName==="VIDEO")this.#Z.load()}if(this.#Z.tagName==="IMG"){this.#T();return}let Z=this.getAttribute("poster");if(Z)this.#Z.setAttribute("poster",Z);else this.#Z.removeAttribute("poster");this.#Z.controls=!1,this.#Z.removeAttribute("controls"),this.#Z.autoplay=this.#R("autoplay",!1),this.#Z.loop=this.#R("loop",!1),this.#Z.muted=this.#R("muted",!1),this.#Z.playsInline=!0,this.#T(),this.#y(),this.#k()}get mediaEl(){return this.#Z}#E(){if(this.mediaKind!=="video")return!1;return Boolean(this.#M())}#k(){let Q=this.#K||this.querySelector(":scope > fig-media-controls");if(!Q)return;if(this.mediaKind!=="video")return;if(this.#E()){if(Q.hasAttribute("data-fig-empty-disabled"))Q.removeAttribute("disabled"),Q.removeAttribute("data-fig-empty-disabled");return}Q.setAttribute("disabled",""),Q.setAttribute("data-fig-empty-disabled",""),Q.playing=!1,Q.time=0,Q.duration=0}#y(){if(this.mediaKind!=="video"){this.#V();return}let Q=this.querySelector(":scope > fig-media-controls:not([data-generated])");if(Q){if(this.#K!==Q)this.#V(),this.#K=Q;this.#b(),this.#k();return}if(this.#R("controls",!1))this.#w();else this.#V()}#w(){let Q=Array.from(this.querySelectorAll(":scope > fig-media-controls[data-generated]")),Z=Q[0];if(Q.slice(1).forEach((J)=>J.remove()),Z){this.#K=Z,this.#b(),this.#k();return}let $=document.createElement("fig-media-controls");$.setAttribute("data-generated",""),this.append($),this.#K=$,this.#b(),this.#k()}#b(){if(!this.#K||!this.#Z)return;if(this.#N===this.#Z&&this.#U===this.#K){this.#k();return}this.#v();let Q=this.#K,Z=this.#Z;this.#N=Z,this.#U=Q;let $=null,J=()=>{if(this.#k(),!this.#E())return;if(Q.playing=!Z.paused&&!Z.ended,Number.isFinite(Z.duration))Q.duration=Z.duration;if($!==null)if(Math.abs(Z.currentTime-$)<0.25)$=null;else return;Q.time=Z.currentTime||0},j=()=>{if(!this.#E())return;let X=Z.play?.();if(X&&typeof X.catch==="function")X.catch(()=>{})},q=()=>Z.pause?.(),_=(X)=>{if(!this.#E())return;let Y=Number(X?.detail?.time);if(!Number.isFinite(Y))return;$=Y;try{Z.currentTime=Y}catch{}};this.#L=J,this.#F=j,this.#z=q,this.#B=_,Z.addEventListener("play",J),Z.addEventListener("pause",J),Z.addEventListener("ended",J),Z.addEventListener("timeupdate",J),Z.addEventListener("loadedmetadata",J),Z.addEventListener("durationchange",J),Z.addEventListener("seeked",J),Q.addEventListener("play",j),Q.addEventListener("pause",q),Q.addEventListener("seek",_),J()}#v(){let Q=this.#N,Z=this.#U;if(Q&&this.#L)Q.removeEventListener("play",this.#L),Q.removeEventListener("pause",this.#L),Q.removeEventListener("ended",this.#L),Q.removeEventListener("timeupdate",this.#L),Q.removeEventListener("loadedmetadata",this.#L),Q.removeEventListener("durationchange",this.#L),Q.removeEventListener("seeked",this.#L);if(Z){if(this.#F)Z.removeEventListener("play",this.#F);if(this.#z)Z.removeEventListener("pause",this.#z);if(this.#B)Z.removeEventListener("seek",this.#B)}this.#N=null,this.#U=null,this.#L=null,this.#F=null,this.#z=null,this.#B=null}#V(){this.#v(),this.querySelectorAll(":scope > fig-media-controls[data-generated]").forEach((Q)=>{Q.remove()}),this.#K=null}toggle(){if(!this.#Z||this.mediaKind!=="video")return;if(this.#Z.paused||this.#Z.ended)this.play();else this.pause()}play(){if(this.mediaKind!=="video"||!this.#Z)return;let Q=this.#Z.play();if(Q&&typeof Q.catch==="function")Q.catch(()=>{})}pause(){if(this.mediaKind!=="video"||!this.#Z)return;this.#Z.pause()}#m(){let Q=document.createElement("fig-input-file");Q.setAttribute("data-generated",""),Q.setAttribute("accepts",this.mediaKind==="video"?"video/*":"image/*"),Q.setAttribute("variant","overlay");let Z=this.getAttribute("label")||"Upload";if(Q.setAttribute("label",this.#Q?"Replace":Z),this.#Y?.name)Q.setAttribute("filename",this.#Y.name);else if(this.#Q)Q.setAttribute("url",this.#Q);Q.addEventListener("change",this.#_),this.#D(),this.#$.append(Q),this.#J=Q}#x(){if(this.#J)this.#J.removeEventListener("change",this.#_),this.#J.remove(),this.#J=null}#c(Q){if(Q.target!==this.#J)return;let Z=Q.detail?.files?.[0],$=Q.detail?.cleared===!0;if(!Z){if(this.#j)URL.revokeObjectURL(this.#j),this.#j=null;if(this.#Y=null,this.#q=null,$)this.src="";if(this.#C(),this.#J){let J=this.getAttribute("label")||"Upload";if(this.#J.setAttribute("label",this.#Q?"Replace":J),this.#J.removeAttribute("filename"),this.#Q)this.#J.setAttribute("url",this.#Q);else this.#J.removeAttribute("url")}this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0}));return}if(this.#j)URL.revokeObjectURL(this.#j);if(this.#Y=Z,this.#j=URL.createObjectURL(Z),this.#q=this.#j,this.#C(),this.dispatchEvent(new CustomEvent("loaded",{bubbles:!0,cancelable:!0,detail:{file:Z,src:this.#j}})),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!0})),this.#J)this.#J.removeAttribute("url"),this.#J.setAttribute("filename",Z.name),this.#J.setAttribute("label","Replace")}#g(Q){if(!this.#Z)return;this.dispatchEvent(new CustomEvent(Q,{bubbles:!0,cancelable:!1,composed:!0,detail:{src:this.#Q||"",currentTime:this.#Z.currentTime,duration:this.#Z.duration}}))}#d(){this.#g("play")}#s(){this.#g("pause")}#h(){this.#g("ended")}attributeChangedCallback(Q,Z,$){if(Z===$)return;if(Q==="src"){let J=$||"",j=J&&(J===this.#q||J===this.#j);if(this.#Q=J,this.#j&&!j)URL.revokeObjectURL(this.#j),this.#j=null,this.#q=null,this.#Y=null;if(this.#C(),this.#J){let q=this.getAttribute("label")||"Upload";if(this.#J.setAttribute("label",this.#Q?"Replace":q),this.#Q)if(this.#Y?.name)this.#J.removeAttribute("url"),this.#J.setAttribute("filename",this.#Y.name);else this.#J.setAttribute("url",this.#Q),this.#J.removeAttribute("filename");else this.#J.removeAttribute("url"),this.#J.removeAttribute("filename")}}if(Q==="type"){if(this.#O(),this.#C(),this.#J)this.#J.setAttribute("accepts",this.mediaKind==="video"?"video/*":"image/*")}if(["alt","aria-label","aria-labelledby","title"].includes(Q))this.#T();if(Q==="upload"){let J=$!==null&&$!=="false";if(J&&!this.#J)this.#m();else if(!J)this.#x()}if(Q==="aspect-ratio")if($)this.style.setProperty("--fig-media-aspect-ratio",$);else this.style.removeProperty("--fig-media-aspect-ratio");if(Q==="fit")if($)this.style.setProperty("--fig-media-fit",$);else this.style.removeProperty("--fig-media-fit");if(Q==="label"&&this.#J){let J=this.getAttribute("label")||"Upload";this.#J.setAttribute("label",this.#Q?"Replace":J)}if(["controls","autoplay","loop","muted","poster"].includes(Q))this.#C();if(Q==="caption")this.#I()}}z("fig-media",G0);class X1 extends G0{get mediaKind(){return"image"}}z("fig-image",X1);class Y1 extends G0{get mediaKind(){return"video"}}z("fig-video",Y1);class K1 extends HTMLElement{static get observedAttributes(){return["src","alt","label","text","sublabel","href","target","selected","disabled","full","size","aspect-ratio","fit","label-line-clamp"]}#Q=null;#Z=null;#$=null;#J=null;#j=null;#q=!1;#Y=new MutationObserver((Q)=>{if(!Q.some(($)=>[...$.addedNodes,...$.removedNodes].some((J)=>J instanceof Element&&(J.matches("fig-image:not([data-generated]), fig-media:not([data-generated]), fig-preview:not([data-generated])")||J.querySelector("fig-image:not([data-generated]), fig-media:not([data-generated]), fig-preview:not([data-generated])"))))||!this.isConnected)return;this.#U(),this.#F()});connectedCallback(){this.#Y.observe(this,{childList:!0,subtree:!0}),this.#U(),this.#F()}disconnectedCallback(){this.#Y.disconnect()}attributeChangedCallback(){if(!this.isConnected)return;this.#U(),this.#F()}#_(){return this.getAttribute("label")??this.getAttribute("text")??""}#X(){return this.getAttribute("sublabel")??""}#W(){let Q=this.getAttribute("href");return Boolean(Q)&&!F(this,"disabled")}#G(){return this.getAttribute("label-line-clamp")==="2"?"2":"1"}#K(){return Boolean(this.getAttribute("src"))}#N(){return this.querySelector(":scope > fig-image:not([data-generated]), :scope > fig-media:not([data-generated]), :scope > fig-preview:not([data-generated]), :scope > .fig-card-link > fig-image:not([data-generated]), :scope > .fig-card-link > fig-media:not([data-generated]), :scope > .fig-card-link > fig-preview:not([data-generated]), :scope > .fig-card-link > .fig-card-media > fig-image:not([data-generated]), :scope > .fig-card-link > .fig-card-media > fig-media:not([data-generated]), :scope > .fig-card-link > .fig-card-media > fig-preview:not([data-generated])")}#U(){if(!this.#K()){this.#L();return}if(this.querySelectorAll(":scope > .fig-card-text[data-generated]").forEach((j)=>j.remove()),this.#Z?.parentElement===this)this.#Z=null;let Q=this.#N();this.#q=Boolean(Q);let $=this.#W()?"a":"div";if(!this.#Q||this.#Q.tagName.toLowerCase()!==$){let j=document.createElement($);if(j.className="fig-card-link",this.#Q){while(this.#Q.firstChild)j.appendChild(this.#Q.firstChild);this.#Q.replaceWith(j)}else this.appendChild(j);this.#Q=j}let J=this.#Q.querySelector(":scope > .fig-card-media");if(J){while(J.firstChild)this.#Q.insertBefore(J.firstChild,J);J.remove()}if(Q&&Q.parentElement!==this.#Q)this.#Q.querySelectorAll(":scope > [data-generated]:not(.fig-card-text)").forEach((j)=>j.remove()),this.#Q.prepend(Q),this.#$=null;if(!this.#q){if(this.#$=this.#Q.querySelector(":scope > fig-image[data-generated]")||null,!this.#$)this.#Q.querySelectorAll(":scope > fig-image, :scope > fig-media, :scope > fig-preview").forEach((j)=>{if(j.hasAttribute("data-generated"))j.remove()}),this.#$=document.createElement("fig-image"),this.#$.setAttribute("data-generated",""),this.#$.setAttribute("full",""),this.#$.setAttribute("size","auto"),this.#Q.prepend(this.#$)}if(!this.#Z||!this.#Z.isConnected){if(this.#Z=this.#Q.querySelector(":scope > .fig-card-text"),this.#Z?.tagName.toLowerCase()!=="div"){let j=document.createElement("div");if(j.className="fig-card-text",j.setAttribute("data-generated",""),this.#Z){while(this.#Z.firstChild)j.appendChild(this.#Z.firstChild);this.#Z.replaceWith(j)}else this.#Q.appendChild(j);this.#Z=j}if(!this.#Z)this.#Z=document.createElement("div"),this.#Z.className="fig-card-text",this.#Z.setAttribute("data-generated",""),this.#Q.appendChild(this.#Z)}if(!this.#J||!this.#J.isConnected){if(this.#J=this.#Z.querySelector(":scope > .fig-card-label[data-generated]"),!this.#J){if(this.#J=this.#Q.querySelector(":scope > .fig-card-label[data-generated]")||null,!this.#J)this.#J=document.createElement("label"),this.#J.className="fig-card-label",this.#J.setAttribute("data-generated","");this.#Z.appendChild(this.#J)}}if(!this.#j||!this.#j.isConnected){if(this.#j=this.#Z.querySelector(":scope > .fig-card-sublabel[data-generated]"),!this.#j){if(this.#j=this.#Q.querySelector(":scope > .fig-card-sublabel[data-generated]")||null,!this.#j)this.#j=document.createElement("label"),this.#j.className="fig-card-sublabel",this.#j.setAttribute("data-generated","");this.#J.after(this.#j)}}}#L(){let Q=this.#Q||this.querySelector(":scope > .fig-card-link");if(Q)Q.querySelectorAll("fig-image:not([data-generated]), fig-media:not([data-generated]), fig-preview:not([data-generated])").forEach(($)=>this.insertBefore($,Q)),Q.remove();this.querySelectorAll(":scope > [data-generated]").forEach(($)=>$.remove()),this.#Q=null,this.#$=null,this.#q=!0,this.#Z=document.createElement("div"),this.#Z.className="fig-card-text",this.#Z.setAttribute("data-generated",""),this.#J=document.createElement("label"),this.#J.className="fig-card-label",this.#J.setAttribute("data-generated",""),this.#Z.appendChild(this.#J);let Z=this.#X();if(this.#j=null,Z)this.#j=document.createElement("label"),this.#j.className="fig-card-sublabel",this.#j.setAttribute("data-generated",""),this.#Z.appendChild(this.#j);this.appendChild(this.#Z)}#F(){if(!this.#K()){this.#z();return}if(!this.#Q)return;let Q=F(this,"disabled"),Z=F(this,"selected"),$=this.#_(),J=this.#X(),j=this.#G();if(this.style.setProperty("--fig-card-label-line-clamp",j),this.#W()){let q=this.getAttribute("href")||"",_=this.getAttribute("target");if(this.#Q.setAttribute("href",q),_)if(this.#Q.setAttribute("target",_),_==="_blank")this.#Q.setAttribute("rel","noopener noreferrer");else this.#Q.removeAttribute("rel");else this.#Q.removeAttribute("target"),this.#Q.removeAttribute("rel");if(Z)this.#Q.setAttribute("aria-current","true");else this.#Q.removeAttribute("aria-current");this.removeAttribute("role"),this.removeAttribute("aria-label")}else{this.#Q.removeAttribute("href"),this.#Q.removeAttribute("target"),this.#Q.removeAttribute("rel"),this.#Q.removeAttribute("aria-current"),this.setAttribute("role","group");let q=[$,J].filter(Boolean).join(", ");if(q)this.setAttribute("aria-label",q);else this.removeAttribute("aria-label")}if(Q)this.setAttribute("aria-disabled","true");else this.removeAttribute("aria-disabled");if(this.#$&&!this.#q){let q=this.getAttribute("src"),_=this.getAttribute("alt"),X=this.getAttribute("aspect-ratio")||"1/1",Y=this.getAttribute("fit")||"contain",K=_!=null?_:"";if(q)this.#$.setAttribute("src",q);else this.#$.removeAttribute("src");this.#$.setAttribute("alt",K),this.#$.setAttribute("aspect-ratio",X),this.#$.setAttribute("fit",Y),this.#$.setAttribute("full",""),this.#$.setAttribute("size","auto")}if(this.#J)this.#J.textContent=$,this.#J.hidden=!$;if(this.#j)this.#j.textContent=J,this.#j.hidden=!J;if(this.#Z)this.#Z.hidden=!$&&!J}#z(){let Q=F(this,"disabled"),Z=this.#_(),$=this.#X();this.style.setProperty("--fig-card-label-line-clamp",this.#G()),this.setAttribute("role","group");let J=[Z,$].filter(Boolean).join(", ");if(J)this.setAttribute("aria-label",J);else this.removeAttribute("aria-label");if(Q)this.setAttribute("aria-disabled","true");else this.removeAttribute("aria-disabled");if(this.#J)this.#J.textContent=Z,this.#J.hidden=!Z;if(this.#j)this.#j.textContent=$}}z("fig-card",K1);class G1 extends HTMLElement{#Q=null;#Z=null;#$=null;#J=null;#j=!1;#q=!1;static get observedAttributes(){return["playing","duration","time","disabled"]}connectedCallback(){this.#Y(),this.#G(),this.#K(),this.#_()}get playing(){return this.hasAttribute("playing")&&this.getAttribute("playing")!=="false"}set playing(Q){if(Q)this.setAttribute("playing","");else this.removeAttribute("playing")}get duration(){let Q=Number(this.getAttribute("duration"));return Number.isFinite(Q)&&Q>=0?Q:0}set duration(Q){let Z=Number(Q);if(!Number.isFinite(Z)||Z<0){this.removeAttribute("duration");return}this.setAttribute("duration",String(Z))}get time(){let Q=Number(this.getAttribute("time"));return Number.isFinite(Q)&&Q>=0?Q:0}set time(Q){let Z=Number(Q);if(!Number.isFinite(Z)||Z<0){this.removeAttribute("time");return}this.setAttribute("time",String(Z))}get disabled(){return F(this,"disabled")}set disabled(Q){if(Q)this.setAttribute("disabled","");else this.removeAttribute("disabled")}attributeChangedCallback(Q){if(!this.#q)return;if(Q==="playing")this.#G();if(Q==="duration"||Q==="time")this.#K();if(Q==="disabled")this.#_()}#Y(){if(this.#q)return;if(this.#q=!0,!this.hasAttribute("role"))this.setAttribute("role","group");if(!this.hasAttribute("aria-label")&&!this.hasAttribute("aria-labelledby"))this.setAttribute("aria-label","Media controls");let Q=document.createElement("fig-tooltip");Q.setAttribute("text","Play");let Z=document.createElement("fig-button");Z.setAttribute("variant","ghost"),Z.setAttribute("size","small"),Z.setAttribute("icon","true"),Z.setAttribute("aria-label","Play");let $=u("play",{className:"fig-media-controls-play-icon"});Z.append($),Q.append(Z),Z.addEventListener("click",(_)=>{_.preventDefault(),_.stopPropagation(),this.toggle()});let J=document.createElement("fig-slider");J.setAttribute("text","false"),J.setAttribute("min","0"),J.setAttribute("max",String(this.duration)),J.setAttribute("step","1"),J.setAttribute("value",String(this.time)),J.setAttribute("full",""),J.setAttribute("aria-label","Seek"),J.setAttribute("aria-valuetext",this.#W(this.time,this.duration));let j=document.createElement("span");j.className="fig-media-controls-time",j.textContent=this.#X(this.time);let q=(_)=>{if(this.disabled){_.preventDefault?.(),_.stopPropagation();return}let X=_.currentTarget,Y=Number(X?.value);if(!Number.isFinite(Y))return;this.#j=!0,this.setAttribute("time",String(Y)),this.dispatchEvent(new CustomEvent("seek",{bubbles:!0,composed:!0,detail:{time:Y}})),requestAnimationFrame(()=>{this.#j=!1})};J.addEventListener("input",q),J.addEventListener("change",q),this.append(Q,J,j),this.#Q=Z,this.#Z=Q,this.#$=J,this.#J=j,this.#_()}#_(){let Q=this.disabled;if(this.setAttribute("aria-disabled",Q?"true":"false"),this.#Q)if(Q)this.#Q.setAttribute("disabled","");else this.#Q.removeAttribute("disabled");if(this.#$)if(Q)this.#$.setAttribute("disabled","");else this.#$.removeAttribute("disabled")}#X(Q){if(!Number.isFinite(Q)||Q<0)Q=0;let Z=Math.floor(Q),$=Math.floor(Z/60),J=Z%60;return`${String($).padStart(2,"0")}:${String(J).padStart(2,"0")}`}#W(Q,Z=0){let $=this.#X(Q);if(!Number.isFinite(Z)||Z<=0)return $;return`${$} of ${this.#X(Z)}`}#G(){if(!this.#Q)return;let Q=this.playing;this.#Q.setAttribute("aria-label",Q?"Pause":"Play"),this.#Z?.setAttribute("text",Q?"Pause":"Play");let Z=this.#Q.querySelector(".fig-media-controls-play-icon");if(Z)Z.setAttribute("name",Q?"pause":"play")}#K(){if(!this.#$)return;let Q=this.duration;if(Number(this.#$.getAttribute("max"))!==Q)this.#$.setAttribute("max",String(Q));let Z=this.time;if(!this.#j)this.#$.setAttribute("value",String(Z));if(this.#$.setAttribute("aria-valuetext",this.#W(Z,Q)),this.#J)this.#J.textContent=this.#X(Z)}toggle(){if(this.disabled)return;let Q=!this.playing;this.playing=Q,this.dispatchEvent(new CustomEvent(Q?"play":"pause",{bubbles:!0,composed:!0,detail:{playing:Q}}))}play(){if(this.disabled||this.playing)return;this.toggle()}pause(){if(this.disabled||!this.playing)return;this.toggle()}}z("fig-media-controls",G1);class N1 extends HTMLElement{static observedAttributes=["accepts","label","disabled","multiple","variant","url","filename"];#Q=null;#Z=null;#$=null;#J=null;#j=null;#q=null;get files(){return this.#q}get#Y(){let Q=this.getAttribute("filename");if(Q)return Q;let Z=this.getAttribute("url");if(!Z)return"";try{let J=new URL(Z,location.href).pathname.split("/").pop();return J?decodeURIComponent(J):Z}catch{return Z}}get value(){if(this.#q&&this.#q.length>0){if(this.#q.length===1)return this.#q[0].name;return`${this.#q.length} files`}return this.#Y}connectedCallback(){this.#U(),this.addEventListener("dragover",this.#G),this.addEventListener("dragleave",this.#K),this.addEventListener("drop",this.#N)}disconnectedCallback(){this.#Q?.removeEventListener("change",this.#X),this.#$?.removeEventListener("click",this.#W),this.removeEventListener("dragover",this.#G),this.removeEventListener("dragleave",this.#K),this.removeEventListener("drop",this.#N)}attributeChangedCallback(Q,Z,$){if(Z===$)return;this.#U()}clear(){if(this.#q=null,this.#Q)this.#Q.value="";this.removeAttribute("url"),this.removeAttribute("filename"),this.#U(),this.#_({cleared:!0})}#_(Q={}){let Z={files:this.#q,...Q};this.dispatchEvent(new CustomEvent("input",{detail:Z,bubbles:!0})),this.dispatchEvent(new CustomEvent("change",{detail:Z,bubbles:!0}))}#X=()=>{if(this.#Q.files.length>0)this.#q=this.#Q.files,this.removeAttribute("url"),this.#U(),this.#_()};#W=(Q)=>{Q.stopPropagation(),this.clear()};#G=(Q)=>{if(this.hasAttribute("disabled")&&this.getAttribute("disabled")!=="false")return;if(Q.preventDefault(),!this.hasAttribute("dragover")){if(this.setAttribute("dragover",""),this.#j)this.#j.dataset.prevText=this.#j.textContent,this.#j.textContent="Drop file"}};#K=()=>{if(this.removeAttribute("dragover"),this.#j&&this.#j.dataset.prevText!==void 0)this.#j.textContent=this.#j.dataset.prevText,delete this.#j.dataset.prevText};#N=(Q)=>{if(Q.preventDefault(),this.removeAttribute("dragover"),this.#j&&this.#j.dataset.prevText!==void 0)this.#j.textContent=this.#j.dataset.prevText,delete this.#j.dataset.prevText;if(this.hasAttribute("disabled")&&this.getAttribute("disabled")!=="false")return;let Z=this.getAttribute("accepts"),$=Array.from(Q.dataTransfer.files);if(Z){let j=Z.split(",").map((q)=>q.trim().toLowerCase());$=$.filter((q)=>{let _="."+q.name.split(".").pop().toLowerCase(),X=q.type.toLowerCase();return j.some((Y)=>Y===_||Y===X||Y.endsWith("/*")&&X.startsWith(Y.slice(0,-1)))})}if(!this.hasAttribute("multiple")||this.getAttribute("multiple")==="false")$=$.slice(0,1);if($.length===0)return;let J=new DataTransfer;if($.forEach((j)=>J.items.add(j)),this.#q=J.files,this.#Q)this.#Q.files=J.files;this.removeAttribute("url"),this.#U(),this.#_()};#U(){let Q=this.getAttribute("accepts")||"",Z=this.getAttribute("label")||"Upload",$=this.hasAttribute("disabled")&&this.getAttribute("disabled")!=="false",J=this.hasAttribute("multiple")&&this.getAttribute("multiple")!=="false",j=this.getAttribute("variant")||"input",q=this.#q&&this.#q.length>0||!!this.getAttribute("url")||!!this.getAttribute("filename");if(this.innerHTML="",q){let _=Q?`Accepts ${Q.split(",").map((N)=>N.trim()).join(", ")}`:"";if(this.#j=document.createElement("fig-button"),this.#j.setAttribute("variant",j),this.#j.setAttribute("type","upload"),this.#j.className="fig-input-file-filename",$)this.#j.setAttribute("disabled","");let X=document.createElement("fig-truncate");X.setAttribute("position","middle"),X.setAttribute("tooltip","");let Y=this.value,K=Y.lastIndexOf(".");if(K>0)X.setAttribute("tail",Y.slice(K));if(X.textContent=Y,this.#j.appendChild(X),this.#Q=document.createElement("input"),this.#Q.type="file",this.#Q.title="",this.#Q.disabled=$,Q)this.#Q.setAttribute("accept",Q);if(J)this.#Q.setAttribute("multiple","");if(this.#Q.addEventListener("change",this.#X),this.#j.appendChild(this.#Q),_)this.#J=document.createElement("fig-tooltip"),this.#J.setAttribute("text",_),this.#J.appendChild(this.#j),this.appendChild(this.#J);else this.appendChild(this.#j);let G=document.createElement("fig-tooltip");if(G.setAttribute("text","Remove"),this.#$=document.createElement("fig-button"),this.#$.setAttribute("variant",j==="overlay"?"overlay":"ghost"),this.#$.setAttribute("icon","true"),this.#$.setAttribute("aria-label","Remove"),this.#$.className="fig-input-file-clear",$)this.#$.setAttribute("disabled","");this.#$.replaceChildren(u("minus")),this.#$.addEventListener("click",this.#W),G.appendChild(this.#$),this.appendChild(G)}else{let _=Q?`Accepts ${Q.split(",").map((X)=>X.trim()).join(", ")}`:"";if(_)this.#J=document.createElement("fig-tooltip"),this.#J.setAttribute("text",_);if(this.#j=document.createElement("fig-button"),this.#j.setAttribute("variant",j),this.#j.setAttribute("type","upload"),this.#j.textContent=Z,$)this.#j.setAttribute("disabled","");if(this.#Q=document.createElement("input"),this.#Q.type="file",this.#Q.title="",this.#Q.disabled=$,Q)this.#Q.setAttribute("accept",Q);if(J)this.#Q.setAttribute("multiple","");if(this.#Q.addEventListener("change",this.#X),this.#j.appendChild(this.#Q),this.#J)this.#J.appendChild(this.#j),this.appendChild(this.#J);else this.appendChild(this.#j)}}}z("fig-input-file",N1);class w extends HTMLElement{#Q={x:0.42,y:0};#Z={x:0.58,y:1};#$={stiffness:200,damping:15,mass:1};#J="bezier";#j=2;#q=null;#Y=null;#_=null;#X=null;#W=null;#G=null;#K=null;#N=null;#U=null;#L=null;#F=null;#z=0.8;#B=200;#M=200;#A=null;#P=null;#D=null;#H=null;#O=5;#T=10;#S=10;#f=3;static PRESETS=[{group:null,name:"Linear",type:"bezier",value:[0,0,1,1]},{group:"Bezier",name:"Ease in",type:"bezier",value:[0.42,0,1,1]},{group:"Bezier",name:"Ease out",type:"bezier",value:[0,0,0.58,1]},{group:"Bezier",name:"Ease in and out",type:"bezier",value:[0.42,0,0.58,1]},{group:"Bezier",name:"Ease in back",type:"bezier",value:[0.6,-0.28,0.735,0.045]},{group:"Bezier",name:"Ease out back",type:"bezier",value:[0.175,0.885,0.32,1.275]},{group:"Bezier",name:"Ease in and out back",type:"bezier",value:[0.68,-0.55,0.265,1.55]},{group:"Bezier",name:"Custom bezier",type:"bezier",value:null},{group:"Spring",name:"Gentle",type:"spring",spring:{stiffness:120,damping:14,mass:1}},{group:"Spring",name:"Quick",type:"spring",spring:{stiffness:380,damping:20,mass:1}},{group:"Spring",name:"Bouncy",type:"spring",spring:{stiffness:250,damping:8,mass:1}},{group:"Spring",name:"Slow",type:"spring",spring:{stiffness:60,damping:11,mass:1}},{group:"Spring",name:"Custom spring",type:"spring",spring:null}];static get observedAttributes(){return["value","precision","aspect-ratio","edit"]}connectedCallback(){this.#j=parseInt(this.getAttribute("precision")||"2"),b(this,"--aspect-ratio",this.getAttribute("aspect-ratio"));let Q=this.getAttribute("value");if(Q)this.#I(Q);this.#L=this.#R(),this.#y(),this.#g()}disconnectedCallback(){if(this.#q=null,this.#H)this.#H.disconnect(),this.#H=null}attributeChangedCallback(Q,Z,$){if(Z===$)return;if(Q==="aspect-ratio"){if(b(this,"--aspect-ratio",$),this.#Y)this.#d(),this.#u();return}if(Q==="edit"){if(this.isConnected)this.#y();return}if(Q==="value"&&$){let J=this.#J;if(this.#I($),this.#L=this.#R(),J!==this.#J&&this.#k())this.#y();else{if(this.#Y)this.#u();this.#Q0(),this.#l()}}if(Q==="precision")this.#j=parseInt($||"2")}get value(){if(this.#J==="spring"){let{stiffness:Z,damping:$,mass:J}=this.#$;return`spring(${Z}, ${$}, ${J})`}let Q=this.#j;return`${this.#Q.x.toFixed(Q)}, ${this.#Q.y.toFixed(Q)}, ${this.#Z.x.toFixed(Q)}, ${this.#Z.y.toFixed(Q)}`}get cssValue(){if(this.#J==="spring"){let Z=this.#C(),$=20,J=Math.max(1,Math.floor(Z.length/20)),j=[];for(let q=0;q<Z.length;q+=J)j.push(Z[q].value.toFixed(3));if(Z.length>0)j.push(Z[Z.length-1].value.toFixed(3));return`linear(${j.join(", ")})`}let Q=this.#j;return`cubic-bezier(${this.#Q.x.toFixed(Q)}, ${this.#Q.y.toFixed(Q)}, ${this.#Z.x.toFixed(Q)}, ${this.#Z.y.toFixed(Q)})`}get preset(){return this.#L}set value(Q){this.setAttribute("value",Q)}#I(Q){let Z=Q.match(/^spring\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)$/);if(Z)return this.#J="spring",this.#$.stiffness=parseFloat(Z[1]),this.#$.damping=parseFloat(Z[2]),this.#$.mass=parseFloat(Z[3]),!0;let $=Q.split(",").map((J)=>parseFloat(J.trim()));if($.length>=4&&$.every((J)=>!isNaN(J)))return this.#J="bezier",this.#Q.x=$[0],this.#Q.y=$[1],this.#Z.x=$[2],this.#Z.y=$[3],!0;return!1}#R(){if(this.#J==="bezier"){for(let Z of w.PRESETS){if(Z.type!=="bezier"||!Z.value)continue;if(Math.abs(this.#Q.x-Z.value[0])<0.001&&Math.abs(this.#Q.y-Z.value[1])<0.001&&Math.abs(this.#Z.x-Z.value[2])<0.001&&Math.abs(this.#Z.y-Z.value[3])<0.001)return Z.name}return"Custom bezier"}for(let Z of w.PRESETS){if(Z.type!=="spring"||!Z.spring)continue;if(Math.abs(this.#$.stiffness-Z.spring.stiffness)<0.001&&Math.abs(this.#$.damping-Z.spring.damping)<0.001&&Math.abs(this.#$.mass-Z.spring.mass)<0.001)return Z.name}return"Custom spring"}#C(){let{stiffness:Q,damping:Z,mass:$}=this.#$,J=0.004,j=5,q=[],_=0,X=0;for(let Y=0;Y<=5;Y+=0.004){let K=-Q*(_-1)-Z*X;if(X+=K/$*0.004,_+=X*0.004,q.push({t:Y,value:_}),Y>0.1&&Math.abs(_-1)<0.0005&&Math.abs(X)<0.0005)break}return q}static#E(Q,Z=24){let{stiffness:$,damping:J,mass:j}=Q,q=0.004,_=5,X=[],Y=0,K=0;for(let A=0;A<=5;A+=0.004){let M=-$*(Y-1)-J*K;if(K+=M/j*0.004,Y+=K*0.004,X.push({t:A,value:Y}),A>0.1&&Math.abs(Y-1)<0.001&&Math.abs(K)<0.001)break}let G=X[X.length-1].t||1,N=1;for(let A of X)if(A.value>N)N=A.value;let U=0;for(let A of X)if(A.value<U)U=A.value;let O=Math.max(N-U,1),B=6,L=Z-B*2,T=Math.max(1,Math.floor(X.length/30)),R="";for(let A=0;A<X.length;A+=T){let M=B+X[A].t/G*L,C=B+(1-(X[A].value-U)/O)*L;R+=(A===0?"M":"L")+M.toFixed(1)+","+C.toFixed(1)}return`<svg width="${Z}" height="${Z}" viewBox="0 0 ${Z} ${Z}" fill="none"><path d="${R}" stroke="currentColor" stroke-width="1" stroke-linecap="round" fill="none"/></svg>`}static curveIcon(Q,Z,$,J,j=24){let _=(j-12)/2,X=48,Y=[],K=(M,C,k,S,x)=>{let y=1-x;return y*y*y*M+3*y*y*x*C+3*y*x*x*k+x*x*x*S};for(let M=0;M<=48;M++){let C=M/48;Y.push({x:K(0,Q,$,1,C),y:K(0,Z,J,1,C)})}let G=1/0,N=-1/0,U=1/0,O=-1/0;for(let M of Y){if(M.x<G)G=M.x;if(M.x>N)N=M.x;if(M.y<U)U=M.y;if(M.y>O)O=M.y}let B=Math.max(N-G,0.000001),L=Math.max(O-U,0.000001),T=(M)=>_+(M-G)/B*12,R=(M)=>_+(1-(M-U)/L)*12,A="";for(let M=0;M<Y.length;M++){let C=T(Y[M].x),k=R(Y[M].y);A+=`${M===0?"M":"L"}${C.toFixed(1)},${k.toFixed(1)}`}return`<svg width="${j}" height="${j}" viewBox="0 0 ${j} ${j}" fill="none"><path d="${A}" stroke="currentColor" stroke-width="1" stroke-linecap="round"/></svg>`}#k(){return this.getAttribute("edit")!=="false"}#y(){if(this.classList.toggle("spring-mode",this.#J==="spring"),this.classList.toggle("bezier-mode",this.#J!=="spring"),this.#m(),this.innerHTML=this.#v(),this.#x(),this.#Y)this.#c(),this.#d(),this.#u();this.#l(),this.#W0()}static#w(Q){return String(Q).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}#b(){let Q="",Z=void 0;for(let J of w.PRESETS){if(!this.#k()&&!J.value&&!J.spring)continue;if(J.group!==Z){if(J.group)Q+=`<fig-separator label="${w.#w(J.group)}"></fig-separator>`;Z=J.group}let j;if(J.type==="spring"){let _=J.spring||this.#$;j=w.#E(_)}else{let _=J.value||[this.#Q.x,this.#Q.y,this.#Z.x,this.#Z.y];j=w.curveIcon(..._)}let q=w.#w(J.name);Q+=`<fig-select-option value="${q}" label="${q}"><span slot="prepend">${j}</span><span>${q}</span></fig-select-option>`}return`<fig-select class="fig-easing-curve-select" label="Easing preset" value="${w.#w(this.#L)}" full><fig-select-options>${Q}</fig-select-options></fig-select>`}#v(){let Z=this.#b();if(!this.#k())return Z;let $=`<fig-input-text class="fig-easing-curve-value-input" value="${w.#w(this.value)}" full></fig-input-text>`;if(this.#J==="spring")return`${Z}<div class="fig-easing-curve-svg-container"><svg viewBox="0 0 200 200" class="fig-easing-curve-svg">
|
|
281
281
|
<rect class="fig-easing-curve-bounds" x="0" y="0" width="200" height="200"/>
|
|
282
282
|
<line class="fig-easing-curve-target" x1="0" y1="40" x2="200" y2="40"/>
|
|
283
283
|
<path class="fig-easing-curve-path"/>
|
|
@@ -359,6 +359,6 @@ var w1=(Q,Z)=>()=>(Q&&(Z=Q(Q=0)),Z);var v1={};var P0=w1(()=>{/*! Vendored from @
|
|
|
359
359
|
<circle class="fig-interpolation-swatch-rim" cx="10" cy="10" r="8" fill="none" stroke="currentColor" stroke-width="${Q}"/>
|
|
360
360
|
</svg>
|
|
361
361
|
<div class="fig-interpolation-swatch-fill" aria-hidden="true"></div>
|
|
362
|
-
`,this.#X=this.querySelector(".fig-interpolation-swatch-svg"),this.#W=this.querySelector(".fig-interpolation-swatch-fill"),this.#_=!0}#S(){if(!this.#W)return;let Q=this.#L();if(this.#X)this.#X.style.display=Q?"":"none";let Z=Q?(()=>{let{startDeg:J,sweepDeg:j}=this.#z();return this.#M(J,j)})():this.#A(),$=this.#P(Z);this.#W.style.setProperty("-webkit-mask-image",$),this.#W.style.maskImage=$,this.#W.style.background=this.#O()}}z("fig-interpolation-swatch",E);var a1={chevron:{medium:"--icon-24-chevron",small:"--icon-16-chevron"},checkmark:"--icon-16-checkmark",reset:{medium:"--icon-24-reset",small:"--icon-16-reset"},"arrow-left":{medium:"--icon-24-arrow-left",small:"--icon-16-arrow-left"},steppers:"--icon-24-steppers",eyedropper:"--icon-24-eyedropper",add:"--icon-24-add",send:{medium:"--icon-24-send",small:"--icon-16-send"},adjust:{medium:"--icon-24-adjust",small:"--icon-16-adjust"},minus:"--icon-24-minus",back:"--icon-24-back",forward:"--icon-24-forward",close:{medium:"--icon-24-close",small:"--icon-16-close"},rotate:"--icon-24-rotate",swap:"--icon-24-swap",play:"--icon-24-play",pause:"--icon-24-pause",search:"--icon-24-search",download:"--icon-24-download",upload:"--icon-24-upload",sun:"--icon-24-sun",moon:"--icon-24-moon",edit:{medium:"--icon-24-edit",small:"--icon-16-edit"},settings:{medium:"--icon-24-settings",small:"--icon-16-settings"},more:{medium:"--icon-24-more",small:"--icon-16-more"},visible:{medium:"--icon-24-visible",small:"--icon-16-visible"},hidden:{medium:"--icon-24-hidden",small:"--icon-16-hidden"}};function t1(Q,Z="medium"){let $=Q&&a1[Q];if(!$)return"";let J=typeof $==="string"?$:$[Z==="small"?"small":"medium"];return J?`var(${J})`:""}class H1 extends HTMLElement{static get observedAttributes(){return["name","size","color"]}connectedCallback(){this.#Q()}attributeChangedCallback(Q,Z,$){if(Z!==$)this.#Q()}#Q(){let Q=this.getAttribute("name"),Z=this.getAttribute("size")||"medium",$=t1(Q,Z);if($)this.style.setProperty("--icon",$);else this.style.removeProperty("--icon");if(Z==="small")this.style.setProperty("--size","var(--spacer-3)");else this.style.removeProperty("--size");let J=this.getAttribute("color");if(J)this.style.backgroundColor=J;else this.style.removeProperty("background-color");if(!this.hasAttribute("aria-hidden"))this.setAttribute("aria-hidden","true")}}z("fig-icon",H1);class A1 extends HTMLElement{}z("fig-content",A1);class R1 extends HTMLElement{}z("fig-tab-content",R1);class D1 extends HTMLElement{}z("fig-button-combo",D1);class T1 extends HTMLElement{}z("fig-input-combo",T1);class P1 extends HTMLElement{#Q=null;#Z=null;#$=null;#J=this.#B.bind(this);#j=this.#M.bind(this);static get observedAttributes(){return["value","selected","disabled","alpha","control","aria-label","aria-labelledby","aria-describedby"]}get#q(){return this.getAttribute("control")||"color"}connectedCallback(){this.#W(),this.#L()}disconnectedCallback(){this.#Y(),this.removeEventListener("click",this.#G)}#Y(){if(this.#Q)this.#Q.removeEventListener("input",this.#J),this.#Q.removeEventListener("change",this.#j);if(this.#Z)this.#Z.removeEventListener("input",this.#J),this.#Z.removeEventListener("change",this.#j);if(this.#$)this.#$.disconnect(),this.#$=null}#_(){if(this.#$)this.#$.disconnect(),this.#$=null;if(!this.#Z)return;this.#$=new MutationObserver(()=>{if(this.#Z?.hasAttribute("selected")&&this.#Z.getAttribute("selected")!=="false"){if(!this.hasAttribute("selected"))this.setAttribute("selected","")}else if(this.hasAttribute("selected"))this.removeAttribute("selected")}),this.#$.observe(this.#Z,{attributes:!0,attributeFilter:["selected"]})}get#X(){let Q=this.getAttribute("alpha");return Q===null||Q!=="false"}#W(){let Q=this.#q;if(Q==="add"||Q==="remove"){let X=Q==="add"?"add":"minus",Y=this.getAttribute("aria-label")||(Q==="add"?"Add color stop":"Remove color stop");this.innerHTML=`<fig-button icon variant="ghost" aria-label="${v(Y)}"><fig-icon name="${X}"></fig-icon></fig-button>`,this.#Q=null,this.#Z=null,this.addEventListener("click",this.#G),this.#F();return}this.removeEventListener("click",this.#G);let Z=(this.getAttribute("value")||"").trim(),$=this.#U(Z),J=this.#N(Z),j=this.#X?"":'alpha="false"',q=J<1?JSON.stringify({type:"solid",color:$,opacity:Math.round(J*100)}):JSON.stringify({type:"solid",color:$}),_=J<1?` alpha="${J}"`:"";if(this.innerHTML=i()?`<fig-fill-picker mode="solid" ${j} value='${q}'>
|
|
362
|
+
`,this.#X=this.querySelector(".fig-interpolation-swatch-svg"),this.#W=this.querySelector(".fig-interpolation-swatch-fill"),this.#_=!0}#S(){if(!this.#W)return;let Q=this.#L();if(this.#X)this.#X.style.display=Q?"":"none";let Z=Q?(()=>{let{startDeg:J,sweepDeg:j}=this.#z();return this.#M(J,j)})():this.#A(),$=this.#P(Z);this.#W.style.setProperty("-webkit-mask-image",$),this.#W.style.maskImage=$,this.#W.style.background=this.#O()}}z("fig-interpolation-swatch",E);var a1={chevron:{medium:"--icon-24-chevron",small:"--icon-16-chevron"},checkmark:"--icon-16-checkmark",reset:{medium:"--icon-24-reset",small:"--icon-16-reset"},"arrow-left":{medium:"--icon-24-arrow-left",small:"--icon-16-arrow-left"},steppers:"--icon-24-steppers",eyedropper:"--icon-24-eyedropper",add:"--icon-24-add",send:{medium:"--icon-24-send",small:"--icon-16-send"},adjust:{medium:"--icon-24-adjust",small:"--icon-16-adjust"},minus:"--icon-24-minus",back:"--icon-24-back",forward:"--icon-24-forward",close:{medium:"--icon-24-close",small:"--icon-16-close"},rotate:"--icon-24-rotate",swap:"--icon-24-swap",play:"--icon-24-play",pause:"--icon-24-pause",search:"--icon-24-search",download:"--icon-24-download",upload:"--icon-24-upload",sun:"--icon-24-sun",moon:"--icon-24-moon",edit:{medium:"--icon-24-edit",small:"--icon-16-edit"},settings:{medium:"--icon-24-settings",small:"--icon-16-settings"},more:{medium:"--icon-24-more",small:"--icon-16-more"},visible:{medium:"--icon-24-visible",small:"--icon-16-visible"},hidden:{medium:"--icon-24-hidden",small:"--icon-16-hidden"},globe:{medium:"--icon-24-globe",small:"--icon-16-globe"}};function t1(Q,Z="medium"){let $=Q&&a1[Q];if(!$)return"";let J=typeof $==="string"?$:$[Z==="small"?"small":"medium"];return J?`var(${J})`:""}class H1 extends HTMLElement{static get observedAttributes(){return["name","size","color"]}connectedCallback(){this.#Q()}attributeChangedCallback(Q,Z,$){if(Z!==$)this.#Q()}#Q(){let Q=this.getAttribute("name"),Z=this.getAttribute("size")||"medium",$=t1(Q,Z);if($)this.style.setProperty("--icon",$);else this.style.removeProperty("--icon");if(Z==="small")this.style.setProperty("--size","var(--spacer-3)");else this.style.removeProperty("--size");let J=this.getAttribute("color");if(J)this.style.backgroundColor=J;else this.style.removeProperty("background-color");if(!this.hasAttribute("aria-hidden"))this.setAttribute("aria-hidden","true")}}z("fig-icon",H1);class A1 extends HTMLElement{}z("fig-content",A1);class R1 extends HTMLElement{}z("fig-tab-content",R1);class D1 extends HTMLElement{}z("fig-button-combo",D1);class T1 extends HTMLElement{}z("fig-input-combo",T1);class P1 extends HTMLElement{#Q=null;#Z=null;#$=null;#J=this.#B.bind(this);#j=this.#M.bind(this);static get observedAttributes(){return["value","selected","disabled","alpha","control","aria-label","aria-labelledby","aria-describedby"]}get#q(){return this.getAttribute("control")||"color"}connectedCallback(){this.#W(),this.#L()}disconnectedCallback(){this.#Y(),this.removeEventListener("click",this.#G)}#Y(){if(this.#Q)this.#Q.removeEventListener("input",this.#J),this.#Q.removeEventListener("change",this.#j);if(this.#Z)this.#Z.removeEventListener("input",this.#J),this.#Z.removeEventListener("change",this.#j);if(this.#$)this.#$.disconnect(),this.#$=null}#_(){if(this.#$)this.#$.disconnect(),this.#$=null;if(!this.#Z)return;this.#$=new MutationObserver(()=>{if(this.#Z?.hasAttribute("selected")&&this.#Z.getAttribute("selected")!=="false"){if(!this.hasAttribute("selected"))this.setAttribute("selected","")}else if(this.hasAttribute("selected"))this.removeAttribute("selected")}),this.#$.observe(this.#Z,{attributes:!0,attributeFilter:["selected"]})}get#X(){let Q=this.getAttribute("alpha");return Q===null||Q!=="false"}#W(){let Q=this.#q;if(Q==="add"||Q==="remove"){let X=Q==="add"?"add":"minus",Y=this.getAttribute("aria-label")||(Q==="add"?"Add color stop":"Remove color stop");this.innerHTML=`<fig-button icon variant="ghost" aria-label="${v(Y)}"><fig-icon name="${X}"></fig-icon></fig-button>`,this.#Q=null,this.#Z=null,this.addEventListener("click",this.#G),this.#F();return}this.removeEventListener("click",this.#G);let Z=(this.getAttribute("value")||"").trim(),$=this.#U(Z),J=this.#N(Z),j=this.#X?"":'alpha="false"',q=J<1?JSON.stringify({type:"solid",color:$,opacity:Math.round(J*100)}):JSON.stringify({type:"solid",color:$}),_=J<1?` alpha="${J}"`:"";if(this.innerHTML=i()?`<fig-fill-picker mode="solid" ${j} value='${q}'>
|
|
363
363
|
<fig-swatch background="${$}"${_}></fig-swatch>
|
|
364
364
|
</fig-fill-picker>`:`<fig-swatch background="${$}"${_}></fig-swatch>`,this.#Q=this.querySelector("fig-fill-picker"),this.#Z=this.querySelector("fig-swatch"),this.#Y(),this.#Q?.addEventListener("input",this.#J),this.#Q?.addEventListener("change",this.#j),!this.#Q)this.#Z?.addEventListener("input",this.#J),this.#Z?.addEventListener("change",this.#j);this.#_(),this.#F()}#G=()=>{let Q=this.#q;this.dispatchEvent(new CustomEvent(Q,{bubbles:!0,composed:!0}))};#K(Q){if(!Q)return"#D9D9D9";let Z=Q.replace("#","").trim();if(Z.length===3||Z.length===4){let[$,J,j]=Z;return`#${$}${$}${J}${J}${j}${j}`.toUpperCase()}if(Z.length===6||Z.length===8)return`#${Z.slice(0,6)}`.toUpperCase();return"#D9D9D9"}#N(Q){if(!Q)return 1;let Z=String(Q).trim(),$=Z.replace(/^#/,"");if(/^[0-9a-f]{4}$/i.test($)){let j=$[3];return parseInt(`${j}${j}`,16)/255}if(/^[0-9a-f]{8}$/i.test($))return parseInt($.slice(6,8),16)/255;let J=Z.match(/rgba?\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*([\d.]+)\s*\)/i);if(J)return parseFloat(J[1]);return 1}#U(Q){if(!Q)return"#D9D9D9";let Z=String(Q).trim();if(Z.startsWith("{"))try{let $=JSON.parse(Z);if($?.color)return this.#U($.color)}catch{}if(Z.startsWith("#"))return this.#K(Z);if(/^[0-9a-f]{3,4}$|^[0-9a-f]{6}$|^[0-9a-f]{8}$/i.test(Z))return this.#K(Z);try{let{ctx:$}=F0(1,1);$.fillStyle="#000000",$.fillStyle=Z;let J=$.fillStyle;if(J.startsWith("#"))return this.#K(J);let j=J.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/i);if(j){let q=(_)=>Math.max(0,Math.min(255,Number(_))).toString(16).padStart(2,"0");return`#${q(j[1])}${q(j[2])}${q(j[3])}`.toUpperCase()}}catch{}return"#D9D9D9"}#L(){let Q=this.getAttribute("value"),Z=this.#U(Q),$=this.#N(Q);if(Q!==Z&&$>=1){this.setAttribute("value",Z);return}if(this.#Q){this.#F();let J=$<1?{type:"solid",color:Z,opacity:Math.round($*100)}:{type:"solid",color:Z};if(this.#Q.setAttribute("value",JSON.stringify(J)),this.#X)this.#Q.removeAttribute("alpha");else this.#Q.setAttribute("alpha","false");if(F(this,"disabled"))this.#Q.setAttribute("disabled","");else this.#Q.removeAttribute("disabled")}if(this.#Z){if(this.#F(),this.#Z.setAttribute("background",Z),$<1)this.#Z.setAttribute("alpha",String($));else this.#Z.removeAttribute("alpha");if(F(this,"disabled"))this.#Z.setAttribute("disabled","");else this.#Z.removeAttribute("disabled")}}#F(){let Q=this.#q,Z=this.hasAttribute("disabled")&&this.getAttribute("disabled")!=="false",$=this.hasAttribute("selected")&&this.getAttribute("selected")!=="false";if(this.setAttribute("aria-disabled",Z?"true":"false"),this.setAttribute("aria-pressed",$?"true":"false"),Q==="add"||Q==="remove"){let X=this.querySelector("fig-button"),Y=this.getAttribute("aria-label")||(Q==="add"?"Add color stop":"Remove color stop");if(X?.setAttribute("aria-label",Y),Z)X?.setAttribute("disabled","");else X?.removeAttribute("disabled");return}let J=this.#Q||this.#Z;if(!J)return;let j=this.getAttribute("aria-label")||"Color stop",q=this.getAttribute("aria-labelledby"),_=this.getAttribute("aria-describedby");if(q)J.setAttribute("aria-labelledby",q),J.removeAttribute("aria-label");else J.setAttribute("aria-label",j),J.removeAttribute("aria-labelledby");if(_)J.setAttribute("aria-describedby",_);else J.removeAttribute("aria-describedby")}#z(Q,Z){let $=this.#U(Q?.color),J=this.#U(this.getAttribute("value"));if($!==J)this.setAttribute("value",$);else this.#L();let j={color:this.value};if(this.#X){if(Q?.opacity!==void 0)j.opacity=Q.opacity;else if(Q?.alpha!==void 0)j.opacity=Math.round(Q.alpha*100)}Object.assign(j,l(j.color,this.#X?Q?.alpha:1,j.opacity)),this.dispatchEvent(new CustomEvent(Z,{bubbles:!0,cancelable:!0,composed:!0,detail:j}))}#B(Q){Q.stopPropagation(),this.#z(Q.detail||{color:Q.target?.value},"input")}#M(Q){Q.stopPropagation(),this.#z(Q.detail||{color:Q.target?.value},"change")}attributeChangedCallback(Q,Z,$){if(Z===$)return;if(!this.isConnected)return;switch(Q){case"control":this.#W();break;case"value":case"selected":case"disabled":case"aria-label":case"aria-labelledby":case"aria-describedby":this.#L(),this.#F();break}}get value(){return this.#U(this.getAttribute("value"))}set value(Q){if(Q===null||Q===void 0||Q===""){this.removeAttribute("value");return}this.setAttribute("value",this.#U(Q))}get selected(){return F(this,"selected")}set selected(Q){this.toggleAttribute("selected",Boolean(Q))}get disabled(){return F(this,"disabled")}set disabled(Q){this.toggleAttribute("disabled",Boolean(Q))}}z("fig-color-tip",P1);class C1 extends HTMLElement{static get observedAttributes(){return["selected","disabled"]}connectedCallback(){if(this.setAttribute("role","option"),!this.hasAttribute("tabindex"))this.setAttribute("tabindex","0");if(this.setAttribute("aria-selected",F(this,"selected")?"true":"false"),F(this,"disabled"))this.setAttribute("aria-disabled","true")}attributeChangedCallback(Q){if(Q==="selected")this.setAttribute("aria-selected",F(this,"selected")?"true":"false");if(Q==="disabled")if(this.hasAttribute("disabled")&&this.getAttribute("disabled")!=="false")this.setAttribute("aria-disabled","true"),this.setAttribute("tabindex","-1");else this.removeAttribute("aria-disabled"),this.setAttribute("tabindex","0")}}z("fig-choice",C1);class E1 extends HTMLElement{#Q=null;#Z=this.#A.bind(this);#$=this.#P.bind(this);#J=this.#H.bind(this);#j=null;#q=null;#Y=null;#_=null;#X=null;#W=!1;constructor(){super()}static get observedAttributes(){return["value","disabled","choice-element","columns","drag","layout","overflow","loop"]}get#G(){return this.getAttribute("overflow")==="scrollbar"?"scrollbar":"buttons"}get#K(){let Q=this.getAttribute("drag");return Q===null||Q!=="false"}get#N(){return this.getAttribute("choice-element")||"fig-choice"}#U(){let Q=this.getAttribute("columns"),Z=Q===null?NaN:Number(Q);if(Number.isInteger(Z)&&Z>0)this.style.setProperty("--fig-chooser-grid-columns",String(Z));else this.style.removeProperty("--fig-chooser-grid-columns")}get choices(){return Array.from(this.querySelectorAll(`:scope > ${this.#N}`))}get selectedChoice(){return this.#Q}set selectedChoice(Q){if(Q&&!this.contains(Q))return;let Z=this.choices;for(let J of Z){let j=J===Q,q=F(J,"selected");if(j&&!q)J.setAttribute("selected","");else if(!j&&q)J.removeAttribute("selected")}this.#Q=Q;let $=Q?.getAttribute("value")??"";if(this.getAttribute("value")!==$){if($)this.setAttribute("value",$)}this.#y(Q)}get value(){return this.#Q?.getAttribute("value")??""}set value(Q){if(Q===null||Q===void 0||Q==="")return;this.setAttribute("value",String(Q))}connectedCallback(){if(this.setAttribute("role","listbox"),this.shadowRoot)this.shadowRoot.replaceChildren();this.#U(),this.#f(),this.addEventListener("click",this.#Z),this.addEventListener("keydown",this.#$),this.addEventListener("scroll",this.#J),this.#I(),this.#T(),this.#w(),this.#O(),this.#z(),c(this,()=>{this.#F(),this.#H(),this.#L()})}#L(){let Q=()=>{if(!this.isConnected)return;if(this.#Q)this.#y(this.#Q,"auto")},Z=()=>{let $=this.querySelectorAll("img, video");for(let J of $){if(J.tagName==="IMG"?J.complete:J.readyState>=1)continue;let j=()=>{J.removeEventListener("load",j),J.removeEventListener("loadedmetadata",j),J.removeEventListener("error",j),Q()};J.addEventListener("load",j),J.addEventListener("loadedmetadata",j),J.addEventListener("error",j)}};requestAnimationFrame(()=>{Z(),Q()})}disconnectedCallback(){this.removeEventListener("click",this.#Z),this.removeEventListener("keydown",this.#$),this.removeEventListener("scroll",this.#J),this.#S(),this.#j?.disconnect(),this.#j=null,this.#q?.disconnect(),this.#q=null,this.#R()}attributeChangedCallback(Q,Z,$){if(Q==="value"&&$!==Z&&$)this.#B($);if(Q==="disabled")this.#z();if(Q==="choice-element")requestAnimationFrame(()=>this.#F());if(Q==="columns")this.#U(),this.#k();if(Q==="drag")if(this.#K)this.#T();else this.#S();if(Q==="overflow")this.#I(),requestAnimationFrame(()=>this.#H());if(Q==="layout"){if(this.#I(),$==="horizontal")this.scrollTop=0;else this.scrollLeft=0;this.#k()}}#F(){let Q=this.choices;if(!Q.length){this.#Q=null;return}let Z=this.getAttribute("value");if(Z&&this.#B(Z))return;let $=Q.find((J)=>F(J,"selected"));if($){this.selectedChoice=$;return}this.selectedChoice=Q[0]}#z(){let Q=F(this,"disabled");if(Q)this.setAttribute("aria-disabled","true");else this.removeAttribute("aria-disabled");for(let Z of this.choices)if(Q||F(Z,"disabled"))Z.setAttribute("aria-disabled","true"),Z.setAttribute("tabindex","-1");else Z.removeAttribute("aria-disabled"),Z.setAttribute("tabindex","0")}#B(Q){let Z=this.choices;for(let $ of Z)if($.getAttribute("value")===Q)return this.selectedChoice=$,!0;return!1}#M(Q){let Z=this.#N,$=Q;while($&&$!==this){if($.matches(Z))return $;$=$.parentElement}return null}#A(Q){if(this.hasAttribute("disabled")&&this.getAttribute("disabled")!=="false")return;let Z=this.#M(Q.target);if(!Z)return;if(Z.hasAttribute("disabled")&&Z.getAttribute("disabled")!=="false")return;this.selectedChoice=Z,this.#D()}#P(Q){if(this.hasAttribute("disabled")&&this.getAttribute("disabled")!=="false")return;let Z=this.choices.filter((q)=>!q.hasAttribute("disabled")||q.getAttribute("disabled")==="false");if(!Z.length)return;let $=Z.indexOf(this.#Q),J=$,j=this.hasAttribute("loop");switch(Q.key){case"ArrowDown":case"ArrowRight":if(Q.preventDefault(),$<Z.length-1)J=$+1;else if(j)J=0;break;case"ArrowUp":case"ArrowLeft":if(Q.preventDefault(),$>0)J=$-1;else if(j)J=Z.length-1;break;case"Home":Q.preventDefault(),J=0;break;case"End":Q.preventDefault(),J=Z.length-1;break;case"Enter":case" ":if(Q.preventDefault(),document.activeElement?.matches(this.#N)){let q=this.#M(document.activeElement);if(q&&q!==this.#Q)this.selectedChoice=q,this.#D()}return;default:return}if(J!==$&&Z[J])this.selectedChoice=Z[J],Z[J].focus(),this.#D()}#D(){let Q=this.value;this.dispatchEvent(new CustomEvent("input",{detail:Q,bubbles:!0})),this.dispatchEvent(new CustomEvent("change",{detail:Q,bubbles:!0}))}#H(){if(this.#G==="scrollbar")return;let Q=this.getAttribute("layout")==="horizontal";t(this,this,Q?"x":"y")}#O(){this.#q?.disconnect(),this.#q=new ResizeObserver(()=>{this.#H(),this.#k()}),this.#q.observe(this)}#T(){if(this.#X?.bound)return;if(!this.#K)return;let Q=(q)=>{if(q.button!==0)return;if(q.target.closest("[data-fig-chooser-nav]"))return;if(!(this.getAttribute("layout")==="horizontal"?this.scrollWidth>this.clientWidth:this.scrollHeight>this.clientHeight))return;this.#X.active=!0,this.#X.didDrag=!1,this.#X.startX=q.clientX,this.#X.startY=q.clientY,this.#X.scrollLeft=this.scrollLeft,this.#X.scrollTop=this.scrollTop,this.style.cursor="grab",this.style.userSelect="none"},Z=(q)=>{if(!this.#X.active)return;let _=this.getAttribute("layout")==="horizontal",X=q.clientX-this.#X.startX,Y=q.clientY-this.#X.startY;if(!this.#X.didDrag&&Math.abs(_?X:Y)>3)this.#X.didDrag=!0,this.style.cursor="grabbing",this.setPointerCapture(q.pointerId);if(!this.#X.didDrag)return;if(_)this.scrollLeft=this.#X.scrollLeft-X;else this.scrollTop=this.#X.scrollTop-Y},$=(q)=>{if(!this.#X.active)return;let _=this.#X.didDrag;if(this.#X.active=!1,this.#X.didDrag=!1,this.style.cursor="",this.style.userSelect="",q.pointerId!==void 0)try{this.releasePointerCapture(q.pointerId)}catch{}if(_)q.preventDefault(),q.stopPropagation()},J=(q)=>{if(this.#X?.suppressClick)q.stopPropagation(),q.preventDefault(),this.#X.suppressClick=!1},j=(q)=>{if(this.#X?.didDrag)this.#X.suppressClick=!0,setTimeout(()=>{if(this.#X)this.#X.suppressClick=!1},0)};this.#X={active:!1,didDrag:!1,suppressClick:!1,startX:0,startY:0,scrollLeft:0,scrollTop:0,bound:!0,onPointerDown:Q,onPointerMove:Z,onPointerUp:$,onClick:J,onPointerUpCapture:j},this.addEventListener("pointerdown",Q),window.addEventListener("pointermove",Z),window.addEventListener("pointerup",$),this.addEventListener("pointerup",j,!0),this.addEventListener("click",J,!0)}#S(){if(!this.#X?.bound)return;this.removeEventListener("pointerdown",this.#X.onPointerDown),window.removeEventListener("pointermove",this.#X.onPointerMove),window.removeEventListener("pointerup",this.#X.onPointerUp),this.removeEventListener("pointerup",this.#X.onPointerUpCapture,!0),this.removeEventListener("click",this.#X.onClick,!0),this.style.cursor="",this.style.userSelect="",this.#X=null}#f(){if(this.#W)return;let Q=this.querySelector(":scope > [data-fig-chooser-scroll]");if(!Q)return;this.#W=!0;try{let Z=Array.from(Q.childNodes);Q.replaceWith(...Z)}finally{this.#W=!1}}#I(){if(this.#G==="scrollbar")this.#R();else this.#C()}#R(){this.#Y?.remove(),this.#_?.remove(),this.#Y=null,this.#_=null,this.classList.remove("overflow-start","overflow-end")}#C(){if(this.#Y&&this.#_&&this.contains(this.#Y)&&this.contains(this.#_))return;this.#Y?.remove(),this.#_?.remove(),this.#Y=null,this.#_=null;let Q=Y0({owner:"chooser",startClass:"fig-chooser-nav-start",endClass:"fig-chooser-nav-end",chevronClass:"fig-chooser-nav-chevron",onStart:()=>this.#E(-1),onEnd:()=>this.#E(1)});this.#Y=Q.start,this.#_=Q.end,this.prepend(this.#Y),this.append(this.#_)}#E(Q){let Z=this.getAttribute("layout")==="horizontal";r(this,Z?"x":"y",Q)}#k(){if(!this.#Q)return;this.#y(this.#Q,"auto")}#y(Q,Z="smooth"){if(!Q)return;requestAnimationFrame(()=>{if(!Q.isConnected)return;let $=this.scrollHeight>this.clientHeight,J=this.scrollWidth>this.clientWidth;if(!J&&!$)return;let j=Q.getBoundingClientRect(),q=this.getBoundingClientRect(),_={behavior:Z},X=!1;if($){let Y=j.top-q.top+this.scrollTop,K=this.scrollHeight-this.clientHeight;_.top=Math.max(0,Math.min(Y+j.height/2-this.clientHeight/2,K)),X=!0}if(J){let Y=j.left-q.left+this.scrollLeft,K=this.scrollWidth-this.clientWidth;_.left=Math.max(0,Math.min(Y+j.width/2-this.clientWidth/2,K)),X=!0}if(X)this.scrollTo(_);this.#H()})}#w(){this.#j?.disconnect(),this.#j=new MutationObserver(()=>{if(this.#W)return;this.#f(),this.#I(),this.#z();let Q=this.choices;if(this.#Q&&!Q.includes(this.#Q))this.#Q=null,this.#F();else if(!this.#Q&&Q.length)this.#F();requestAnimationFrame(()=>this.#H())}),this.#j.observe(this,{childList:!0,subtree:!1})}}z("fig-chooser",E1);class k1 extends HTMLElement{static observedAttributes=["color","selected","disabled","drag","drag-surface","drag-axes","drag-snapping","value","type","tip","hit-area","hit-area-mode","aria-label","aria-labelledby"];#Q=!1;#Z=!1;#$=null;#J=null;#j=!1;#q=null;#Y=null;#_=null;#X=null;get#W(){let Q=(this.getAttribute("tip")||"").trim().toLowerCase();return Q==="color"||Q==="add"||Q==="remove"?Q:null}get#G(){return!this.hasAttribute("data-no-color-picker")}get#K(){let Q=this.getAttribute("drag");return Q!==null&&Q!=="false"}get#N(){let Q=(this.getAttribute("drag-axes")||"x,y").toLowerCase();return{x:Q.includes("x"),y:Q.includes("y")}}get#U(){let Q=this.getAttribute("drag-snapping");if(Q===null)return"false";let Z=Q.trim().toLowerCase();if(Z==="modifier")return"modifier";if(Z===""||Z==="true")return"true";return"false"}#L(Q){let Z=this.#U;if(Z==="true")return!0;if(Z==="modifier")return!!Q;return!1}#F(Q){if(Q<0.1)return 0;if(Q>0.9)return 1;if(Q>0.4&&Q<0.6)return 0.5;return Q}#z(Q,Z){if(Math.abs(Q-Z)<0.1){let J=(Q+Z)/2;return{x:J,y:J}}if(Math.abs(1-Q-Z)<0.1)return{x:Q,y:1-Q};return{x:Q,y:Z}}#B(){let Q=this.getAttribute("drag-surface");if(!Q||Q==="parent")return this.parentElement;return this.closest(Q)}get value(){let Q=this.#B();if(!Q)return"0% 0%";let{px:Z,py:$}=this.#a(Q.getBoundingClientRect());return`${Math.round(Z*100)}% ${Math.round($*100)}%`}set value(Q){this.setAttribute("value",Q??"0% 0%")}#M(Q){let Z=Q==null?"":String(Q).trim();if(!Z)return{xPct:0,yPct:0};let $=Z.split(/[\s,]+/).filter(Boolean),J=(_)=>{if(!_)return 0;let X=_.includes("px"),Y=_.includes("%"),K=parseFloat(_.replace(/[%px]/g,""));if(!Number.isFinite(K))return 0;if(X)return{px:K};if(Y||Math.abs(K)>1)return Math.max(0,Math.min(100,K));return Math.max(0,Math.min(100,K*100))},j=J($[0]),q=J($[1]??$[0]);return{xToken:j,yToken:q}}#A(Q){let Z=this.#B();if(!Z)return;let{xToken:$,yToken:J}=this.#M(Q),j=Z.getBoundingClientRect(),q=(Y,K)=>{if(Y&&typeof Y==="object"&&"px"in Y)return Math.max(0,Math.min(K,Y.px));return null},_=(Y)=>{return`${typeof Y==="number"?Y:0}%`},X=this.#N;if(this.#P(X),X.x){let Y=q($,j.width);this.style.left=Y===null?_($):`${Math.round(Y)}px`}if(X.y){let Y=q(J,j.height);this.style.top=Y===null?_(J):`${Math.round(Y)}px`}}#P(Q=this.#N){this.style.setProperty("--fig-handle-position-translate",`${Q.x?"-50%":"0"} ${Q.y?"-50%":"0"}`)}#D(){this.#j=!0,this.setAttribute("value",this.value),this.#j=!1}get#H(){return this.getAttribute("hit-area-mode")||"handle"}#O(){let Q=this.getAttribute("hit-area");if(!Q)return null;let Z=Q.trim().split(/\s+/),$=0,J=0,j=!1,q=[];for(let _ of Z){if(_==="circle"){j=!0;continue}let X=parseFloat(_);if(Number.isFinite(X))q.push(X)}if(q.length>=2)$=q[0],J=q[1];else if(q.length===1)$=q[0],J=q[0];else return null;return{vPad:$,hPad:J,circle:j}}#T(){let Q=this.#O();if(!Q){if(this.#X)this.#X.remove(),this.#X=null;this.style.removeProperty("--fig-handle-hit-area-size");return}if(!this.#X){let Z=document.createElement("div");Z.classList.add("fig-handle-hit-area"),Z.addEventListener("pointerdown",($)=>this.#S($)),this.prepend(Z),this.#X=Z}if(this.style.setProperty("--fig-handle-hit-area-size",String(Q.hPad*2)),Q.circle)this.#X.style.borderRadius="50%";else this.#X.style.borderRadius="inherit"}#S(Q){if(F(this,"disabled"))return;if(Q.target!==this.#X)return;if(this.#H==="delegate")Q.preventDefault(),Q.stopPropagation(),this.dispatchEvent(new CustomEvent("hitareadown",{bubbles:!0,detail:{originalEvent:Q}}));else this.#w(Q)}connectedCallback(){this.#k(),this.#E(),this.#T(),this.addEventListener("click",this.#f),document.addEventListener("pointerdown",this.#I),document.addEventListener("keydown",this.#R);let Q=this.getAttribute("value");if(Q)this.#A(Q);if(this.#W)this.#t()}disconnectedCallback(){if(this.#y(),this.#i(),this.#c(),this.#s(),this.#X)this.#X.remove(),this.#X=null;this.removeEventListener("click",this.#f),document.removeEventListener("pointerdown",this.#I),document.removeEventListener("keydown",this.#R)}select(){if(F(this,"disabled"))return;this.setAttribute("selected","")}deselect(){this.removeAttribute("selected")}#f=(Q)=>{if(this.#Z){this.#Z=!1;return}if(this.getAttribute("type")==="color"&&this.#G&&!this.#W){this.#x();return}this.select()};#I=(Q)=>{if(this.contains(Q.target))return;if((this.#q||this.#Y)&&Q.target.closest?.("dialog, [popover]"))return;this.deselect()};#R=(Q)=>{if(Q.defaultPrevented)return;if(Q.target===this&&this.#K&&["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(Q.key)){if(this.#C(Q)){if(Q.preventDefault(),!F(this,"selected"))this.select()}return}if(Q.key!=="Enter"&&Q.key!==" ")return;if(Q.target===this&&!F(this,"selected")){if(Q.preventDefault(),this.getAttribute("type")==="color"&&this.#G&&!this.#W)this.#x();else this.select();return}if(!F(this,"selected"))return;if(this.getAttribute("type")!=="color")return;if(!this.#G)return;if(Q.preventDefault(),!this.#W)this.#x()};#C(Q){if(F(this,"disabled"))return!1;let Z=this.#B();if(!Z)return!1;let $=Z.getBoundingClientRect();if($.width<=0||$.height<=0)return!1;let J=this.#N,j=this.#a($),q=Q.shiftKey?0.1:0.01,_=j.px,X=j.py;switch(Q.key){case"ArrowLeft":if(!J.x)return!1;_-=q;break;case"ArrowRight":if(!J.x)return!1;_+=q;break;case"ArrowUp":if(!J.y)return!1;X-=q;break;case"ArrowDown":if(!J.y)return!1;X+=q;break;case"Home":if(J.x)_=0;if(J.y)X=0;break;case"End":if(J.x)_=1;if(J.y)X=1;break;default:return!1}if(_=Math.max(0,Math.min(1,_)),X=Math.max(0,Math.min(1,X)),this.#P(J),J.x)this.style.left=`${Math.round(_*$.width)}px`;if(J.y)this.style.top=`${Math.round(X*$.height)}px`;this.#D();let Y={...this.#a($),shiftKey:Q.shiftKey,keyboard:!0};return this.dispatchEvent(new CustomEvent("input",{bubbles:!0,detail:Y})),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:Y})),!0}attributeChangedCallback(Q,Z,$){if(Q==="color"){if(!$||$==="false"||$==="true")this.style.removeProperty("--fill");else this.style.setProperty("--fill",$);if(this.#q&&this.#W==="color"&&$)this.#q.setAttribute("value",$);this.#V()}if(Q==="drag")this.#E();if(Q==="hit-area")this.#T();if(Q==="selected")this.#p();if(Q==="selected"||Q==="disabled"||Q==="type"||Q==="tip"||Q==="aria-label"||Q==="aria-labelledby")this.#k();if(Q==="value"&&!this.#j&&!this.#Q)this.#A($);if(Q==="tip"){if(this.#i(),this.#W)this.#c(),this.#t()}}#E(){if(this.#K&&!this.#$)this.#$=(Q)=>this.#w(Q),this.addEventListener("pointerdown",this.#$);else if(!this.#K&&this.#$)this.#y()}#k(){let Q=this.hasAttribute("disabled")&&this.getAttribute("disabled")!=="false",Z=this.hasAttribute("selected")&&this.getAttribute("selected")!=="false";if(!this.hasAttribute("role"))this.setAttribute("role","button");if(!this.hasAttribute("tabindex"))this.setAttribute("tabindex",Q?"-1":"0");else if(Q)this.setAttribute("tabindex","-1");if(this.setAttribute("aria-disabled",Q?"true":"false"),this.setAttribute("aria-pressed",Z?"true":"false"),!this.hasAttribute("aria-label")&&!this.hasAttribute("aria-labelledby")){let $=this.#W||this.getAttribute("type")||"handle";this.setAttribute("aria-label",$==="color"?"Color handle":$==="add"?"Add handle":$==="remove"?"Remove handle":"Handle")}}#y(){if(this.#J?.(),this.#J=null,this.#$)this.removeEventListener("pointerdown",this.#$),this.#$=null;this.#Q=!1,this.#Z=!1}#w(Q){if(!this.#K||F(this,"disabled"))return;Q.preventDefault();let Z=this.#B();if(!Z)return;this.#J?.(),this.#Q=!0;let $=this.#N,J=null,j=this.getBoundingClientRect(),q=j.left+j.width/2,_=j.top+j.height/2,X=Q.clientX-q,Y=Q.clientY-_,K=Q.clientX,G=Q.clientY,N=3,U=(T,R,A=!1)=>{let M=Z.getBoundingClientRect();J=M;let C=this.#a(M),k=T-X-M.left,S=R-Y-M.top,x=Math.max(0,Math.min(M.width,k)),y=Math.max(0,Math.min(M.height,S)),m=M.width>0?$.x?x/M.width:C.px:0.5,d=M.height>0?$.y?y/M.height:C.py:0.5;if(this.#L(A)){if($.x)m=this.#F(m);if($.y)d=this.#F(d);if($.x&&$.y){let n=this.#z(m,d);m=n.x,d=n.y}}if(this.#P($),$.x)this.style.left=`${Math.round(Math.max(0,Math.min(M.width,m*M.width)))}px`;if($.y)this.style.top=`${Math.round(Math.max(0,Math.min(M.height,d*M.height)))}px`},O=(T)=>{if(!this.#Q)return;if(!this.#Z){let R=T.clientX-K,A=T.clientY-G;if(R*R+A*A<N*N)return;if(this.#h(),this.classList.add("dragging"),this.style.cursor="grabbing",!F(this,"selected"))this.select()}this.#Z=!0,U(T.clientX,T.clientY,T.shiftKey),this.dispatchEvent(new CustomEvent("input",{bubbles:!0,detail:{...this.#a(J),shiftKey:T.shiftKey}}))},B=(T)=>{if(L(),this.#Z){U(T.clientX,T.clientY,T.shiftKey),this.#D(),this.#A(this.getAttribute("value")),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:this.#a(J)}));let R=(A)=>{A.stopPropagation(),A.preventDefault()};this.addEventListener("click",R,{capture:!0,once:!0})}else this.#D();this.#Z=!1},L=()=>{if(window.removeEventListener("pointermove",O),window.removeEventListener("pointerup",B),this.#Q=!1,this.style.cursor="",this.classList.remove("dragging"),this.#J===L)this.#J=null};this.#J=L,window.addEventListener("pointermove",O),window.addEventListener("pointerup",B)}showColorTip(){if(!this.#W)return;if(this.#q){this.#q.style.display="";return}this.#t()}hideColorTip(){if(!this.#q)return;this.#q.style.display="none"}#b(Q=this.getAttribute("color")){let Z={color:"#D9D9D9",opacity:100},$=String(Q||"").trim();if(!$)return Z;let J=(q)=>{let _=q.replace("#","").trim();if(_.length===3||_.length===4){let[X,Y,K,G]=_;return{color:`#${X}${X}${Y}${Y}${K}${K}`.toUpperCase(),opacity:G?Math.round(parseInt(`${G}${G}`,16)/255*100):100}}if(_.length===6||_.length===8)return{color:`#${_.slice(0,6)}`.toUpperCase(),opacity:_.length===8?Math.round(parseInt(_.slice(6,8),16)/255*100):100};return Z},j=(q,_,X)=>{let Y=(K)=>Math.max(0,Math.min(255,Math.round(Number(K)))).toString(16).padStart(2,"0");return`#${Y(q)}${Y(_)}${Y(X)}`.toUpperCase()};if($.startsWith("#"))return J($);try{let{ctx:q}=F0(1,1);q.fillStyle="#000000",q.fillStyle=$;let _=q.fillStyle;if(_.startsWith("#"))return J(_);let X=_.match(/rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)(?:\s*,\s*([\d.]+))?/i);if(X)return{color:j(X[1],X[2],X[3]),opacity:X[4]!==void 0?Math.round(parseFloat(X[4])*100):100}}catch{}return Z}#v(){let{color:Q,opacity:Z}=this.#b();return JSON.stringify(Z<100?{type:"solid",color:Q,opacity:Z}:{type:"solid",color:Q})}#V(){if(!this.#Y)return;this.#Y.setAttribute("value",this.#v())}#m(){if(!i())return null;if(this.#Y)return this.#Y;let Q=document.createElement("fig-fill-picker");Q.setAttribute("mode","solid"),Q.setAttribute("alpha","true"),Q.setAttribute("dialog-offset","8 8"),Q.setAttribute("value",this.#v()),Q.anchorElement=this;let Z=document.createElement("span");return Z.hidden=!0,Q.appendChild(Z),Q.addEventListener("input",this.#n),Q.addEventListener("change",this.#r),Q.addEventListener("close",this.#l),this.appendChild(Q),this.#Y=Q,Q}#x(){if(F(this,"disabled"))return;let Q=this.#m();if(!Q){this.#d();return}this.setAttribute("selected",""),this.#V(),Q.open()}#c(){if(!this.#Y)return;this.#Y.removeEventListener("input",this.#n),this.#Y.removeEventListener("change",this.#r),this.#Y.removeEventListener("close",this.#l),this.#Y.close(),this.#Y.remove(),this.#Y=null,this.removeAttribute("selected")}#g(){if(this.#_)return this.#_;let Q=document.createElement("input");return Q.type="color",Q.tabIndex=-1,Q.setAttribute("aria-hidden","true"),Q.style.position="fixed",Q.style.inlineSize="1px",Q.style.blockSize="1px",Q.style.opacity="0",Q.style.pointerEvents="none",Q.addEventListener("input",this.#q0),Q.addEventListener("change",this.#Q0),this.appendChild(Q),this.#_=Q,Q}#d(){let Q=this.#g(),{color:Z}=this.#b();Q.value=Z,this.setAttribute("selected",""),Q.click()}#s(){if(!this.#_)return;this.#_.removeEventListener("input",this.#q0),this.#_.removeEventListener("change",this.#Q0),this.#_.remove(),this.#_=null}#h(){if(this.getAttribute("type")!=="color")return;this.#Y?.close()}#t(){let Q=this.#W;if(!Q)return;if(this.#q)return;let Z=document.createElement("fig-color-tip");if(Q==="add"||Q==="remove")Z.setAttribute("control",Q);else Z.setAttribute("value",this.getAttribute("color")||"#D9D9D9"),Z.setAttribute("alpha","true");Z.addEventListener("input",this.#_0),Z.addEventListener("change",this.#J0),Z.addEventListener("add",this.#e),Z.addEventListener("remove",this.#e),this.appendChild(Z),this.#q=Z,this.#p()}#i(){if(!this.#q)return;this.#q.removeEventListener("input",this.#_0),this.#q.removeEventListener("change",this.#J0),this.#q.removeEventListener("add",this.#e),this.#q.removeEventListener("remove",this.#e),this.#q.remove(),this.#q=null}#p(){if(!this.#q||this.#W!=="color")return;let Q=this.hasAttribute("selected")&&this.getAttribute("selected")!=="false";this.#q.toggleAttribute("selected",Q)}#u(Q,Z){if(Z===void 0||Z>=100)return Q;let{r:$,g:J,b:j}=o(Q);return`rgba(${$}, ${J}, ${j}, ${Z/100})`}#o(Q){if(!Q?.color)return null;let Z=Q.opacity!==void 0?Q.opacity:Q.alpha!==void 0?Math.round(Q.alpha*100):void 0;return{color:Q.color,opacity:Z,...l(Q.color,Q.alpha,Z)}}#n=(Q)=>{Q.stopPropagation();let Z=this.#o(Q.detail);if(!Z)return;this.setAttribute("color",this.#u(Z.color,Z.opacity)),this.dispatchEvent(new CustomEvent("input",{bubbles:!0,detail:Z}))};#r=(Q)=>{Q.stopPropagation();let Z=this.#o(Q.detail);if(!Z)return;this.setAttribute("color",this.#u(Z.color,Z.opacity)),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:Z}))};#j0(Q){let{opacity:Z}=this.#b();return{...Z<100?{color:Q,opacity:Z}:{color:Q},...l(Q,void 0,Z)}}#q0=(Q)=>{Q.stopPropagation();let Z=this.#j0(Q.target.value);this.setAttribute("color",this.#u(Z.color,Z.opacity)),this.dispatchEvent(new CustomEvent("input",{bubbles:!0,detail:Z}))};#Q0=(Q)=>{Q.stopPropagation();let Z=this.#j0(Q.target.value);this.setAttribute("color",this.#u(Z.color,Z.opacity)),this.removeAttribute("selected"),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:Z}))};#l=()=>{this.removeAttribute("selected")};#_0=(Q)=>{if(Q.stopPropagation(),Q.detail?.color){let Z={color:Q.detail.color,opacity:Q.detail.opacity,...l(Q.detail.color,Q.detail.alpha,Q.detail.opacity)};this.setAttribute("color",this.#u(Z.color,Z.opacity)),this.dispatchEvent(new CustomEvent("input",{bubbles:!0,detail:Z}))}};#J0=(Q)=>{if(Q.stopPropagation(),Q.detail?.color){let Z={color:Q.detail.color,opacity:Q.detail.opacity,...l(Q.detail.color,Q.detail.alpha,Q.detail.opacity)};this.setAttribute("color",this.#u(Z.color,Z.opacity)),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:Z}))}};#e=(Q)=>{Q.stopPropagation(),this.dispatchEvent(new CustomEvent(Q.type,{bubbles:!0,composed:!0}))};#a(Q){let Z=Q||this.#B()?.getBoundingClientRect();if(!Z)return{x:0,y:0,px:0,py:0};let $=this.getBoundingClientRect(),J=this.offsetWidth/2,j=this.offsetHeight/2,q=$.left-Z.left,_=$.top-Z.top,X=q+J,Y=_+j,K=Z.width>0?X/Z.width:0,G=Z.height>0?Y/Z.height:0;return{x:q,y:_,px:K,py:G}}}z("fig-handle",k1);class S1 extends HTMLElement{static get observedAttributes(){return["value","disabled"]}get value(){return this.getAttribute("value")||""}set value(Q){this.setAttribute("value",Q??"")}connectedCallback(){if(!this.hasAttribute("role"))this.setAttribute("role","menuitem");if(!this.hasAttribute("tabindex"))this.setAttribute("tabindex","-1");this.#Q()}attributeChangedCallback(Q,Z,$){if(Z===$)return;if(Q==="disabled")this.#Q()}#Q(){if(this.hasAttribute("disabled")&&this.getAttribute("disabled")!=="false")this.setAttribute("aria-disabled","true"),this.setAttribute("tabindex","-1");else if(this.removeAttribute("aria-disabled"),!this.hasAttribute("tabindex"))this.setAttribute("tabindex","-1")}}z("fig-menu-item",S1);class f1 extends HTMLElement{static get observedAttributes(){return["label"]}get label(){return this.getAttribute("label")??""}set label(Q){if(Q==null||Q==="")this.removeAttribute("label");else this.setAttribute("label",String(Q))}connectedCallback(){this.#Q()}attributeChangedCallback(Q,Z,$){if(Z===$)return;this.#Q()}#Q(){if(!this.hasAttribute("role"))this.setAttribute("role","separator");let Q=this.label.trim();if(Q)this.setAttribute("aria-label",Q);else this.removeAttribute("aria-label")}}z("fig-separator",f1);class I1 extends HTMLElement{#Q=null;#Z=null;#$=null;#J=null;#j=null;#q=null;#Y=null;#_=null;#X;#W;#G;#K;#N;#U=this.#T.bind(this);#L=-1;static get observedAttributes(){return["position","offset","closedby","disabled","open","trigger"]}constructor(){super();this.#X=this.#y.bind(this),this.#W=this.#w.bind(this),this.#G=this.#v.bind(this),this.#K=this.#V.bind(this),this.#N=this.#m.bind(this)}get value(){return this.getAttribute("value")||""}set value(Q){this.setAttribute("value",Q??"")}get open(){return this.hasAttribute("open")&&this.getAttribute("open")!=="false"}set open(Q){if(Q){if(this.#k())return;this.setAttribute("open","")}else this.removeAttribute("open")}connectedCallback(){if(this.#F(),this.#B(),this.#M(),this.#A(),this.#H(),this.#D(),this.#E(),this.open)this.#c()}disconnectedCallback(){if(this.#P(),this.#O(),document.removeEventListener("keydown",this.#K,!0),this.#j)this.#j.disconnect(),this.#j=null;if(this.#Q){this.#Q.removeEventListener("close",this.#N);let Q=Array.from(this.#Z?.querySelectorAll(":scope > fig-menu-item, :scope > fig-separator")??[]);for(let Z of Q)this.insertBefore(Z,this.#Q);this.#Q.remove(),this.#Q=null,this.#Z=null}}attributeChangedCallback(Q,Z,$){if(Z===$)return;if(Q==="open"){if($===null||$==="false")this.#g();else{if(this.#k()){this.removeAttribute("open");return}this.#c()}return}if(Q==="disabled"){this.#E();return}if(this.#Q&&(Q==="position"||Q==="offset"||Q==="closedby"))if($!==null)this.#Q.setAttribute(Q,$);else this.#Q.removeAttribute(Q)}#F(){this.#$=this.querySelector("[fig-menu-trigger]")||this.querySelector(":scope > :not(fig-menu-item):not(fig-separator)")}#z(){return(this.getAttribute("trigger")||"").toLowerCase()==="contextmenu"||this.hasAttribute("contextmenu")}#B(){this.#Q=document.createElement("dialog",{is:"fig-popup"}),this.#Q.setAttribute("is","fig-popup"),this.#Q.classList.add("fig-menu-popup"),this.#Q.setAttribute("theme","menu"),this.#Q.setAttribute("role","menu"),this.#Q.setAttribute("id",this.#Q.getAttribute("id")||h());let Q=this.getAttribute("position")||"bottom left";this.#Q.setAttribute("position",Q);let Z=this.getAttribute("offset");if(Z)this.#Q.setAttribute("offset",Z);let $=this.getAttribute("closedby");if($)this.#Q.setAttribute("closedby",$);if(this.#$)this.#Q.anchor=this.#$;this.#Z=document.createElement("div"),this.#Z.className="fig-menu-options",this.#Z.setAttribute("role","presentation"),this.#Q.appendChild(this.#Z),this.#Q.addEventListener("close",this.#N),this.appendChild(this.#Q)}#M(){if(!this.#Z)return;let Q=Array.from(this.querySelectorAll(":scope > fig-menu-item, :scope > fig-separator"));for(let Z of Q)this.#Z.appendChild(Z)}#A(){if(this.addEventListener("keydown",this.#K),this.#$)this.#$.addEventListener("click",this.#X),this.#$.addEventListener("contextmenu",this.#W),this.#$.setAttribute("aria-haspopup","menu"),this.#$.setAttribute("aria-expanded","false"),this.#$.setAttribute("aria-controls",this.#Q.getAttribute("id"));if(this.#Q)this.#Q.addEventListener("click",this.#G),this.#Q.addEventListener("keydown",this.#K)}#P(){if(this.removeEventListener("keydown",this.#K),this.#$)this.#$.removeEventListener("click",this.#X),this.#$.removeEventListener("contextmenu",this.#W);if(this.#Q)this.#Q.removeEventListener("click",this.#G),this.#Q.removeEventListener("keydown",this.#K)}#D(){this.#j=new MutationObserver((Q)=>{for(let Z of Q)for(let $ of Z.addedNodes){if($.nodeType!==1||$===this.#Q)continue;if(($.tagName==="FIG-MENU-ITEM"||$.tagName==="FIG-SEPARATOR")&&$.parentElement===this)this.#Z?.appendChild($);else if(!this.#$&&$.parentElement===this){if(this.#F(),this.#$)this.#$.addEventListener("click",this.#X),this.#$.addEventListener("contextmenu",this.#W),this.#$.setAttribute("aria-haspopup","menu"),this.#$.setAttribute("aria-expanded","false"),this.#$.setAttribute("aria-controls",this.#Q.getAttribute("id")),this.#Q.anchor=this.#$,this.#E()}}this.#T()}),this.#j.observe(this,{childList:!0})}#H(){if(!this.#Z)return;this.#S(),this.#Z.addEventListener("scroll",this.#U,{passive:!0}),this.#q?.disconnect(),this.#q=new ResizeObserver(()=>this.#T()),this.#q.observe(this.#Z),requestAnimationFrame(()=>this.#T())}#O(){this.#Z?.removeEventListener("scroll",this.#U),this.#q?.disconnect(),this.#q=null,this.#f()}#T(){return t(this.#Z,this.#Z,"y")}#S(){if(this.#Y&&this.#_&&this.#Z?.contains(this.#Y)&&this.#Z?.contains(this.#_))return;this.#f();let Q=Y0({owner:"menu",startLabel:"Scroll up",endLabel:"Scroll down",onStart:()=>r(this.#Z,"y",-1),onEnd:()=>r(this.#Z,"y",1)});this.#Y=Q.start,this.#_=Q.end,this.#Z.prepend(this.#Y),this.#Z.append(this.#_)}#f(){this.#Y?.remove(),this.#_?.remove(),this.#Y=null,this.#_=null,this.#Z?.classList.remove("overflow-start","overflow-end")}#I(){if(!this.#Z)return[];return Array.from(this.#Z.querySelectorAll("fig-menu-item")).filter((Q)=>!Q.hasAttribute("disabled")||Q.getAttribute("disabled")==="false")}#R(){let Q=this.#I();if(!Q.length){this.#L=-1;return}let Z=document.activeElement,$=Q.findIndex((J)=>J===Z||J.contains(Z));this.#L=$>=0?$:-1}#C(Q){let Z=this.#I();if(!Z.length)return;let $=(Q+Z.length)%Z.length;this.#L=$;let J=Z[$];J.focus(),f0(this.#Z,J,"y")}#E(){let Q=this.#k();if(Q)if(this.open)this.removeAttribute("open");else this.#g();if(!this.#$)return;if(Q)this.#$.setAttribute("disabled",""),this.#$.setAttribute("aria-disabled","true"),this.#$.setAttribute("aria-expanded","false");else this.#$.removeAttribute("disabled"),this.#$.removeAttribute("aria-disabled")}#k(){return this.hasAttribute("disabled")&&this.getAttribute("disabled")!=="false"}#y(Q){if(this.#z())return;if(this.#k())return;Q.stopPropagation();let Z=this.#Q?.matches?.(":open")??!1;if(this.open&&!Z)this.removeAttribute("open");if(this.open&&Z)this.open=!1;else{if(this.#Q&&this.#$)this.#Q.anchor=this.#$;this.open=!0}}#w(Q){if(!this.#z())return;if(this.#k())return;Q.preventDefault(),Q.stopPropagation(),this.#b(Q.clientX,Q.clientY)}#b(Q,Z){let $=!1,J=0,j=()=>{window.clearTimeout(J),window.removeEventListener("pointerup",q,!0),window.removeEventListener("pointercancel",_,!0)},q=()=>{if($)return;$=!0,j(),requestAnimationFrame(()=>this.showAt(Q,Z))},_=()=>{if($)return;$=!0,j()};window.addEventListener("pointerup",q,{once:!0,capture:!0}),window.addEventListener("pointercancel",_,{once:!0,capture:!0}),J=window.setTimeout(q,180)}#v(Q){if(this.#k())return;let Z=Q.target.closest("fig-menu-item");if(!Z)return;if(Z.hasAttribute("disabled")&&Z.getAttribute("disabled")!=="false")return;this.#x(Z)}#V(Q){if(this.#k())return;if(Q.currentTarget===document&&Q.key!=="Escape")return;if(Q.currentTarget===this&&this.#Q?.contains(Q.target))return;if(!this.open||!this.#Q?.matches?.(":open")){if(this.#$?.contains(Q.target)&&(Q.key==="ArrowDown"||Q.key==="Enter"||Q.key===" ")){if(Q.preventDefault(),this.#Q&&this.#$)this.#Q.anchor=this.#$;this.open=!0,requestAnimationFrame(()=>this.#C(0))}return}let Z=this.#I();if(!Z.length)return;switch(Q.key){case"ArrowDown":{Q.preventDefault(),this.#R(),this.#C(this.#L+1);break}case"ArrowUp":{Q.preventDefault(),this.#R(),this.#C(this.#L-1);break}case"Home":{Q.preventDefault(),this.#C(0);break}case"End":{Q.preventDefault(),this.#C(Z.length-1);break}case"Escape":{Q.preventDefault(),this.open=!1,this.#$?.focus();break}case"Enter":case" ":{this.#R();let $=Z[this.#L];if(!$)return;Q.preventDefault(),this.#x($);break}}}#m(){if(this.hasAttribute("open"))this.removeAttribute("open");if(this.#$)this.#$.setAttribute("aria-expanded","false"),this.#$.focus();this.#L=-1}#x(Q){let Z=Q.getAttribute("value")||Q.textContent.trim();this.setAttribute("value",Z),this.dispatchEvent(new CustomEvent("change",{detail:{value:Z,item:Q},bubbles:!0})),this.open=!1}showAt(Q,Z){if(this.#k())return;if(this.#J={getBoundingClientRect:()=>({width:0,height:0,top:Z,right:Q,bottom:Z,left:Q,x:Q,y:Z})},this.#Q)this.#Q.anchor=this.#J;if(this.open)this.open=!1;requestAnimationFrame(()=>{if(this.#k())return;this.open=!0})}#c(){if(!this.#Q||this.#k()){if(this.hasAttribute("open"))this.removeAttribute("open");return}if(this.#Q.open=!0,document.addEventListener("keydown",this.#K,!0),this.#$)this.#$.setAttribute("aria-expanded","true");this.#L=-1,requestAnimationFrame(()=>{if(this.#T(),!this.#$?.matches?.(":focus-visible"))return;this.#C(0)})}#g(){if(!this.#Q)return;document.removeEventListener("keydown",this.#K,!0),this.#Q.open=!1,this.#$?.setAttribute("aria-expanded","false")}}z("fig-menu",I1);
|
package/fig.js
CHANGED
|
@@ -13455,6 +13455,7 @@ figDefineElement("fig-video", FigVideo);
|
|
|
13455
13455
|
* @attr {boolean} selected - Selected chrome (CSS only)
|
|
13456
13456
|
* @attr {boolean} disabled - Dim + non-interactive; no `<a>` when disabled
|
|
13457
13457
|
* @attr {boolean} full - Stretch to available width (CSS; default width is already 100%)
|
|
13458
|
+
* @attr {string} size - Set to `large` for spacer-2 card padding and spacer-1 label spacing
|
|
13458
13459
|
* @attr {string} aspect-ratio - Forwarded to fig-image (default `1/1`)
|
|
13459
13460
|
* @attr {string} fit - Forwarded to fig-image (default `contain`)
|
|
13460
13461
|
* @attr {string} label-line-clamp - `1` (default) or `2`
|
|
@@ -13472,6 +13473,7 @@ class FigCard extends HTMLElement {
|
|
|
13472
13473
|
"selected",
|
|
13473
13474
|
"disabled",
|
|
13474
13475
|
"full",
|
|
13476
|
+
"size",
|
|
13475
13477
|
"aspect-ratio",
|
|
13476
13478
|
"fit",
|
|
13477
13479
|
"label-line-clamp",
|
|
@@ -17448,6 +17450,7 @@ const FIG_ICON_TOKENS = {
|
|
|
17448
17450
|
more: { medium: "--icon-24-more", small: "--icon-16-more" },
|
|
17449
17451
|
visible: { medium: "--icon-24-visible", small: "--icon-16-visible" },
|
|
17450
17452
|
hidden: { medium: "--icon-24-hidden", small: "--icon-16-hidden" },
|
|
17453
|
+
globe: { medium: "--icon-24-globe", small: "--icon-16-globe" },
|
|
17451
17454
|
};
|
|
17452
17455
|
|
|
17453
17456
|
function figIconCssVar(name, size = "medium") {
|
package/package.json
CHANGED